From: support Date: Mon, 4 Jul 2022 11:48:37 +0000 (+0000) Subject: Built motion from commit ed019234.|2.6.12 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22card-image.png//%22?a=commitdiff_plain;h=fd15049cfd247a60f0c6a76ce05937e85d4825e0;p=motion2.git Built motion from commit ed019234.|2.6.12 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 42d60f7..ac78730 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-04T10:35:45.299Z", + "time": "2022-07-04T11:40:26.680Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index a6a028c..02bc81b 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-04T10:35:45.299Z", + "time": "2022-07-04T11:40:26.680Z", "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 09d96ff..c79ace0 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 _0x4621=['motionbar','jscripty','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','action','contactManager','integration'];(function(_0x5c4178,_0x11471c){var _0x384e71=function(_0x4ff0db){while(--_0x4ff0db){_0x5c4178['push'](_0x5c4178['shift']());}};_0x384e71(++_0x11471c);}(_0x4621,0x16d));var _0x1462=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4621[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x508e57){return this['getDataValue'](_0x1462('0x0'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x1462('0x1'),_0x1462('0x2'),_0x1462('0x3'),_0x1462('0x4'),'urlForward',_0x1462('0x5'),_0x1462('0x6'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x1462('0x7')},'data1':{'type':Sequelize[_0x1462('0x8')](0x1000),'comment':_0x1462('0x9')},'data2':{'type':Sequelize[_0x1462('0x8')](0x1000),'comment':_0x1462('0xa')},'data3':{'type':Sequelize[_0x1462('0x8')](0x1000),'comment':_0x1462('0xb')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x1462('0xc')},'data5':{'type':Sequelize[_0x1462('0x8')](0x1000),'comments':_0x1462('0xd')},'data6':{'type':Sequelize[_0x1462('0x8')],'comments':_0x1462('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':_0x1462('0xf')}}; \ No newline at end of file +var _0x61bb=['urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x3df822,_0x299495){var _0x4e457d=function(_0x68a45f){while(--_0x68a45f){_0x3df822['push'](_0x3df822['shift']());}};_0x4e457d(++_0x299495);}(_0x61bb,0xa1));var _0xb61b=function(_0x203351,_0xafbd3b){_0x203351=_0x203351-0x0;var _0x995a89=_0x61bb[_0x203351];return _0x995a89;};'use strict';var Sequelize=require('sequelize');module[_0xb61b('0x0')]={'name':{'type':Sequelize[_0xb61b('0x1')],'get':function(_0xc586c2){return this[_0xb61b('0x2')](_0xb61b('0x3'));}},'action':{'type':Sequelize[_0xb61b('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb61b('0x5'),_0xb61b('0x6'),_0xb61b('0x7'),_0xb61b('0x8'),_0xb61b('0x9'),_0xb61b('0xa'),_0xb61b('0xb'),_0xb61b('0xc')]],'msg':_0xb61b('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](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[_0xb61b('0x4')](0x1000),'comment':_0xb61b('0xe')},'data3':{'type':Sequelize[_0xb61b('0x4')](0x1000),'comment':_0xb61b('0xf')},'data4':{'type':Sequelize[_0xb61b('0x4')](0x1000),'comments':_0xb61b('0x10')},'data5':{'type':Sequelize[_0xb61b('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xb61b('0x4')],'comments':_0xb61b('0x11')},'data7':{'type':Sequelize[_0xb61b('0x12')],'comments':_0xb61b('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 87f26f0..fec5ac7 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 _0x505d=['reject','save','then','end','error','name','send','body','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x19996d,_0x28545c){var _0x4c38bc=function(_0x3abcc8){while(--_0x3abcc8){_0x19996d['push'](_0x19996d['shift']());}};_0x4c38bc(++_0x28545c);}(_0x505d,0xcf));var _0xd505=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x505d[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0xd505('0x0'));var rimraf=require(_0xd505('0x1'));var zipdir=require(_0xd505('0x2'));var jsonpatch=require(_0xd505('0x3'));var rp=require(_0xd505('0x4'));var moment=require(_0xd505('0x5'));var BPromise=require(_0xd505('0x6'));var Mustache=require(_0xd505('0x7'));var util=require(_0xd505('0x8'));var path=require(_0xd505('0x9'));var sox=require(_0xd505('0xa'));var csv=require(_0xd505('0xb'));var ejs=require(_0xd505('0xc'));var fs=require('fs');var fs_extra=require(_0xd505('0xd'));var _=require('lodash');var squel=require(_0xd505('0xe'));var crypto=require(_0xd505('0xf'));var jsforce=require(_0xd505('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd505('0xb'));var querystring=require(_0xd505('0x11'));var Papa=require('papaparse');var Redis=require(_0xd505('0x12'));var authService=require(_0xd505('0x13'));var qs=require(_0xd505('0x14'));var as=require(_0xd505('0x15'));var hardwareService=require(_0xd505('0x16'));var logger=require(_0xd505('0x17'))(_0xd505('0x18'));var utils=require(_0xd505('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd505('0x1a'));var db=require(_0xd505('0x1b'))['db'];function respondWithStatusCode(_0x317365,_0x100e6a){_0x100e6a=_0x100e6a||0xcc;return function(_0x23df6a){if(_0x23df6a){return _0x317365[_0xd505('0x1c')](_0x100e6a);}return _0x317365['status'](_0x100e6a)['end']();};}function respondWithResult(_0x363f23,_0x133c3b){_0x133c3b=_0x133c3b||0xc8;return function(_0xfba51f){if(_0xfba51f){return _0x363f23[_0xd505('0x1d')](_0x133c3b)[_0xd505('0x1e')](_0xfba51f);}};}function respondWithFilteredResult(_0x4b0a22,_0x58e470){return function(_0xf0a8c){if(_0xf0a8c){var _0x40a636=typeof _0x58e470[_0xd505('0x1f')]==='undefined'&&typeof _0x58e470['limit']===_0xd505('0x20');var _0x895405=_0xf0a8c['count'];var _0x2bfe26=_0x40a636?0x0:_0x58e470[_0xd505('0x1f')];var _0x2f5c2a=_0x40a636?_0xf0a8c[_0xd505('0x21')]:_0x58e470[_0xd505('0x1f')]+_0x58e470[_0xd505('0x22')];var _0x1399a0;if(_0x2f5c2a>=_0x895405){_0x2f5c2a=_0x895405;_0x1399a0=0xc8;}else{_0x1399a0=0xce;}_0x4b0a22[_0xd505('0x1d')](_0x1399a0);return _0x4b0a22[_0xd505('0x23')](_0xd505('0x24'),_0x2bfe26+'-'+_0x2f5c2a+'/'+_0x895405)[_0xd505('0x1e')](_0xf0a8c);}return null;};}function patchUpdates(_0x5ccc7b){return function(_0x161c85){try{jsonpatch[_0xd505('0x25')](_0x161c85,_0x5ccc7b,!![]);}catch(_0x56b78f){return BPromise[_0xd505('0x26')](_0x56b78f);}return _0x161c85[_0xd505('0x27')]();};}function saveUpdates(_0x360e08,_0x86055c){return function(_0x172da6){if(_0x172da6){return _0x172da6['update'](_0x360e08)[_0xd505('0x28')](function(_0x3ec700){return _0x3ec700;});}return null;};}function removeEntity(_0x15761a,_0xe9d707){return function(_0x50c180){if(_0x50c180){return _0x50c180['destroy']()[_0xd505('0x28')](function(){_0x15761a[_0xd505('0x1d')](0xcc)[_0xd505('0x29')]();});}};}function handleEntityNotFound(_0x16f990,_0x495281){return function(_0x4e61cd){if(!_0x4e61cd){_0x16f990[_0xd505('0x1c')](0x194);}return _0x4e61cd;};}function handleError(_0x5ab1ee,_0x1040a5){_0x1040a5=_0x1040a5||0x1f4;return function(_0x4d7335){logger[_0xd505('0x2a')](_0x4d7335['stack']);if(_0x4d7335[_0xd505('0x2b')]){delete _0x4d7335['name'];}_0x5ab1ee['status'](_0x1040a5)[_0xd505('0x2c')](_0x4d7335);};}exports['update']=function(_0x52381f,_0xa82ffd){if(_0x52381f[_0xd505('0x2d')]['id']){delete _0x52381f[_0xd505('0x2d')]['id'];}return db['Action'][_0xd505('0x2e')]({'where':{'id':_0x52381f[_0xd505('0x2f')]['id']}})[_0xd505('0x28')](handleEntityNotFound(_0xa82ffd,null))[_0xd505('0x28')](saveUpdates(_0x52381f[_0xd505('0x2d')],null))[_0xd505('0x28')](respondWithResult(_0xa82ffd,null))[_0xd505('0x30')](handleError(_0xa82ffd,null));};exports['destroy']=function(_0x30f057,_0x257c93){return db['Action']['find']({'where':{'id':_0x30f057['params']['id']}})[_0xd505('0x28')](handleEntityNotFound(_0x257c93,null))[_0xd505('0x28')](removeEntity(_0x257c93,null))['catch'](handleError(_0x257c93,null));}; \ No newline at end of file +var _0x62c9=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','find','params','body','catch','Action','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x49939f,_0x2695f3){var _0x1cfcac=function(_0x300216){while(--_0x300216){_0x49939f['push'](_0x49939f['shift']());}};_0x1cfcac(++_0x2695f3);}(_0x62c9,0x1cb));var _0x962c=function(_0x22c50d,_0x3b5e79){_0x22c50d=_0x22c50d-0x0;var _0x1cc24d=_0x62c9[_0x22c50d];return _0x1cc24d;};'use strict';var emlformat=require(_0x962c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x962c('0x1'));var rp=require(_0x962c('0x2'));var moment=require(_0x962c('0x3'));var BPromise=require(_0x962c('0x4'));var Mustache=require(_0x962c('0x5'));var util=require(_0x962c('0x6'));var path=require(_0x962c('0x7'));var sox=require(_0x962c('0x8'));var csv=require('to-csv');var ejs=require(_0x962c('0x9'));var fs=require('fs');var fs_extra=require(_0x962c('0xa'));var _=require('lodash');var squel=require(_0x962c('0xb'));var crypto=require(_0x962c('0xc'));var jsforce=require(_0x962c('0xd'));var deskjs=require(_0x962c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x962c('0xf'));var Papa=require(_0x962c('0x10'));var Redis=require(_0x962c('0x11'));var authService=require(_0x962c('0x12'));var qs=require(_0x962c('0x13'));var as=require(_0x962c('0x14'));var hardwareService=require(_0x962c('0x15'));var logger=require('../../config/logger')(_0x962c('0x16'));var utils=require(_0x962c('0x17'));var config=require(_0x962c('0x18'));var licenseUtil=require(_0x962c('0x19'));var db=require(_0x962c('0x1a'))['db'];function respondWithStatusCode(_0x1bbbd8,_0x5ae9ec){_0x5ae9ec=_0x5ae9ec||0xcc;return function(_0x19f00c){if(_0x19f00c){return _0x1bbbd8[_0x962c('0x1b')](_0x5ae9ec);}return _0x1bbbd8[_0x962c('0x1c')](_0x5ae9ec)[_0x962c('0x1d')]();};}function respondWithResult(_0x3c7a8e,_0x16a619){_0x16a619=_0x16a619||0xc8;return function(_0x49368c){if(_0x49368c){return _0x3c7a8e[_0x962c('0x1c')](_0x16a619)[_0x962c('0x1e')](_0x49368c);}};}function respondWithFilteredResult(_0x5d0e01,_0x497bf5){return function(_0x3eed12){if(_0x3eed12){var _0x2a2067=typeof _0x497bf5[_0x962c('0x1f')]===_0x962c('0x20')&&typeof _0x497bf5[_0x962c('0x21')]===_0x962c('0x20');var _0x1d12bf=_0x3eed12[_0x962c('0x22')];var _0x1e5ba4=_0x2a2067?0x0:_0x497bf5[_0x962c('0x1f')];var _0x3ec2c2=_0x2a2067?_0x3eed12[_0x962c('0x22')]:_0x497bf5[_0x962c('0x1f')]+_0x497bf5[_0x962c('0x21')];var _0x5966e6;if(_0x3ec2c2>=_0x1d12bf){_0x3ec2c2=_0x1d12bf;_0x5966e6=0xc8;}else{_0x5966e6=0xce;}_0x5d0e01[_0x962c('0x1c')](_0x5966e6);return _0x5d0e01[_0x962c('0x23')](_0x962c('0x24'),_0x1e5ba4+'-'+_0x3ec2c2+'/'+_0x1d12bf)[_0x962c('0x1e')](_0x3eed12);}return null;};}function patchUpdates(_0x1483a2){return function(_0x2ac8e7){try{jsonpatch[_0x962c('0x25')](_0x2ac8e7,_0x1483a2,!![]);}catch(_0x69bc59){return BPromise[_0x962c('0x26')](_0x69bc59);}return _0x2ac8e7[_0x962c('0x27')]();};}function saveUpdates(_0x392f8c,_0x45732d){return function(_0x54a466){if(_0x54a466){return _0x54a466[_0x962c('0x28')](_0x392f8c)[_0x962c('0x29')](function(_0x5605f7){return _0x5605f7;});}return null;};}function removeEntity(_0x4bd887,_0x773902){return function(_0x1e64ef){if(_0x1e64ef){return _0x1e64ef['destroy']()[_0x962c('0x29')](function(){_0x4bd887[_0x962c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x389cbb,_0x365d94){return function(_0x11d516){if(!_0x11d516){_0x389cbb['sendStatus'](0x194);}return _0x11d516;};}function handleError(_0x26415,_0x5446b5){_0x5446b5=_0x5446b5||0x1f4;return function(_0x117e2d){logger[_0x962c('0x2a')](_0x117e2d[_0x962c('0x2b')]);if(_0x117e2d['name']){delete _0x117e2d['name'];}_0x26415[_0x962c('0x1c')](_0x5446b5)['send'](_0x117e2d);};}exports['update']=function(_0x33e0d4,_0x1ad09c){if(_0x33e0d4['body']['id']){delete _0x33e0d4['body']['id'];}return db['Action'][_0x962c('0x2c')]({'where':{'id':_0x33e0d4[_0x962c('0x2d')]['id']}})[_0x962c('0x29')](handleEntityNotFound(_0x1ad09c,null))[_0x962c('0x29')](saveUpdates(_0x33e0d4[_0x962c('0x2e')],null))[_0x962c('0x29')](respondWithResult(_0x1ad09c,null))[_0x962c('0x2f')](handleError(_0x1ad09c,null));};exports['destroy']=function(_0x1ac78f,_0x3fadb5){return db[_0x962c('0x30')][_0x962c('0x2c')]({'where':{'id':_0x1ac78f[_0x962c('0x2d')]['id']}})[_0x962c('0x29')](handleEntityNotFound(_0x3fadb5,null))[_0x962c('0x29')](removeEntity(_0x3fadb5,null))['catch'](handleError(_0x3fadb5,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index b4e1ca3..2cd0a33 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 _0xf62d=['../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf62d,0x13e));var _0xdf62=function(_0x46a748,_0x435b16){_0x46a748=_0x46a748-0x0;var _0xbace90=_0xf62d[_0x46a748];return _0xbace90;};'use strict';var _=require(_0xdf62('0x0'));var util=require(_0xdf62('0x1'));var logger=require(_0xdf62('0x2'))('api');var moment=require(_0xdf62('0x3'));var BPromise=require(_0xdf62('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf62('0x5'));var rimraf=require(_0xdf62('0x6'));var config=require(_0xdf62('0x7'));var attributes=require(_0xdf62('0x8'));module[_0xdf62('0x9')]=function(_0x4b90d5,_0x2a3d8f){return _0x4b90d5[_0xdf62('0xa')](_0xdf62('0xb'),attributes,{'tableName':_0xdf62('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1485=['bluebird','rimraf','./action.attributes','Action','lodash','util','../../config/logger','api','moment'];(function(_0x1e1436,_0x57a41f){var _0x224211=function(_0x4eb37a){while(--_0x4eb37a){_0x1e1436['push'](_0x1e1436['shift']());}};_0x224211(++_0x57a41f);}(_0x1485,0xca));var _0x5148=function(_0x839611,_0x54a00b){_0x839611=_0x839611-0x0;var _0x131e80=_0x1485[_0x839611];return _0x131e80;};'use strict';var _=require(_0x5148('0x0'));var util=require(_0x5148('0x1'));var logger=require(_0x5148('0x2'))(_0x5148('0x3'));var moment=require(_0x5148('0x4'));var BPromise=require(_0x5148('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5148('0x6'));var config=require('../../config/environment');var attributes=require(_0x5148('0x7'));module['exports']=function(_0x47922d,_0x5228cb){return _0x47922d['define'](_0x5148('0x8'),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 116017c..6b4673b 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x10b477,_0x3f5cbf){var _0x311ed4=function(_0x4a12dd){while(--_0x4a12dd){_0x10b477['push'](_0x10b477['shift']());}};_0x311ed4(++_0x3f5cbf);}(_0x5fab,0x177));var _0xb5fa=function(_0x358f87,_0x5a4d20){_0x358f87=_0x358f87-0x0;var _0x4b2fdb=_0x5fab[_0x358f87];return _0x4b2fdb;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7217,0x19e));var _0x7721=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7217[_0x411add];return _0x238242;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index bb464fc..df6e3fa 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 _0xede7=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','destroy','exports','util','path'];(function(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0xede7,0x1a2));var _0x7ede=function(_0x2f1172,_0x5f5b26){_0x2f1172=_0x2f1172-0x0;var _0x58e374=_0xede7[_0x2f1172];return _0x58e374;};'use strict';var multer=require('multer');var util=require(_0x7ede('0x0'));var path=require(_0x7ede('0x1'));var timeout=require(_0x7ede('0x2'));var express=require(_0x7ede('0x3'));var router=express[_0x7ede('0x4')]();var fs_extra=require(_0x7ede('0x5'));var auth=require(_0x7ede('0x6'));var interaction=require(_0x7ede('0x7'));var config=require('../../config/environment');var controller=require(_0x7ede('0x8'));router[_0x7ede('0x9')](_0x7ede('0xa'),auth[_0x7ede('0xb')](),controller[_0x7ede('0xc')]);router['delete']('/:id',auth[_0x7ede('0xb')](),controller[_0x7ede('0xd')]);module[_0x7ede('0xe')]=router; \ No newline at end of file +var _0x549f=['../../config/environment','./action.controller','put','isAuthenticated','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x56e1f1,_0x433412){var _0x5a7b9d=function(_0x13248b){while(--_0x13248b){_0x56e1f1['push'](_0x56e1f1['shift']());}};_0x5a7b9d(++_0x433412);}(_0x549f,0xde));var _0xf549=function(_0x1c3abf,_0x2bdfdf){_0x1c3abf=_0x1c3abf-0x0;var _0x44c290=_0x549f[_0x1c3abf];return _0x44c290;};'use strict';var multer=require(_0xf549('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf549('0x1'));var express=require(_0xf549('0x2'));var router=express[_0xf549('0x3')]();var fs_extra=require(_0xf549('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf549('0x5'));var config=require(_0xf549('0x6'));var controller=require(_0xf549('0x7'));router[_0xf549('0x8')]('/:id',auth[_0xf549('0x9')](),controller[_0xf549('0xa')]);router['delete']('/:id',auth[_0xf549('0x9')](),controller[_0xf549('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 379b5ea..b5e8e53 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 _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x43a602,_0x4fe4ef){var _0x5b085c=function(_0xf6f6c4){while(--_0xf6f6c4){_0x43a602['push'](_0x43a602['shift']());}};_0x5b085c(++_0x4fe4ef);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x16bd44,_0x3c91ba){_0x16bd44=_0x16bd44-0x0;var _0x368a61=_0xf2ca[_0x16bd44];return _0x368a61;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0x8958=['TEXT','exports'];(function(_0x36fe46,_0x40010c){var _0x4d2e9c=function(_0x2dfa20){while(--_0x2dfa20){_0x36fe46['push'](_0x36fe46['shift']());}};_0x4d2e9c(++_0x40010c);}(_0x8958,0x93));var _0x8895=function(_0x3fd24a,_0x29526a){_0x3fd24a=_0x3fd24a-0x0;var _0x19499d=_0x8958[_0x3fd24a];return _0x19499d;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index dd60e9c..8488b94 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 _0x7cee=['map','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','pick','filter','merge','VIRTUAL','options','where','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','rawAttributes','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','table','MetricId','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','type','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','Sequelize','ValidationErrorItem','AnalyticMetric','from','metric','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','COUNT(%s)','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','crypto','jsforce','desk.js','to-csv','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','count','set','Content-Range','apply','reject','save','then','UserProfileResource','destroy','error','stack','name','index'];(function(_0x32625b,_0x4f81ec){var _0x56bc3d=function(_0x4569b5){while(--_0x4569b5){_0x32625b['push'](_0x32625b['shift']());}};_0x56bc3d(++_0x4f81ec);}(_0x7cee,0x1c5));var _0xe7ce=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0x7cee[_0x47604d];return _0x388e4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe7ce('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7ce('0x1'));var rp=require(_0xe7ce('0x2'));var moment=require(_0xe7ce('0x3'));var BPromise=require(_0xe7ce('0x4'));var Mustache=require(_0xe7ce('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe7ce('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe7ce('0x7'));var jsforce=require(_0xe7ce('0x8'));var deskjs=require(_0xe7ce('0x9'));var toCsv=require(_0xe7ce('0xa'));var querystring=require(_0xe7ce('0xb'));var Papa=require(_0xe7ce('0xc'));var Redis=require('ioredis');var authService=require(_0xe7ce('0xd'));var qs=require(_0xe7ce('0xe'));var as=require(_0xe7ce('0xf'));var hardwareService=require(_0xe7ce('0x10'));var logger=require('../../config/logger')(_0xe7ce('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe7ce('0x12'));var db=require(_0xe7ce('0x13'))['db'];var dbH=require(_0xe7ce('0x13'))['dbH'];function respondWithStatusCode(_0x20d36b,_0x37aa04){_0x37aa04=_0x37aa04||0xcc;return function(_0xbaf81e){if(_0xbaf81e){return _0x20d36b[_0xe7ce('0x14')](_0x37aa04);}return _0x20d36b[_0xe7ce('0x15')](_0x37aa04)[_0xe7ce('0x16')]();};}function respondWithResult(_0x2569c8,_0x531430){_0x531430=_0x531430||0xc8;return function(_0x4dc28c){if(_0x4dc28c){return _0x2569c8[_0xe7ce('0x15')](_0x531430)[_0xe7ce('0x17')](_0x4dc28c);}};}function respondWithFilteredResult(_0x3a1593,_0x151978){return function(_0x4f4bec){if(_0x4f4bec){var _0x34f2be=typeof _0x151978[_0xe7ce('0x18')]===_0xe7ce('0x19')&&typeof _0x151978['limit']===_0xe7ce('0x19');var _0x56de47=_0x4f4bec[_0xe7ce('0x1a')];var _0x2244fe=_0x34f2be?0x0:_0x151978['offset'];var _0x22c8e0=_0x34f2be?_0x4f4bec[_0xe7ce('0x1a')]:_0x151978[_0xe7ce('0x18')]+_0x151978['limit'];var _0x5b1e6f;if(_0x22c8e0>=_0x56de47){_0x22c8e0=_0x56de47;_0x5b1e6f=0xc8;}else{_0x5b1e6f=0xce;}_0x3a1593['status'](_0x5b1e6f);return _0x3a1593[_0xe7ce('0x1b')](_0xe7ce('0x1c'),_0x2244fe+'-'+_0x22c8e0+'/'+_0x56de47)[_0xe7ce('0x17')](_0x4f4bec);}return null;};}function patchUpdates(_0x510c38){return function(_0x5ba8a8){try{jsonpatch[_0xe7ce('0x1d')](_0x5ba8a8,_0x510c38,!![]);}catch(_0x574cdf){return BPromise[_0xe7ce('0x1e')](_0x574cdf);}return _0x5ba8a8[_0xe7ce('0x1f')]();};}function saveUpdates(_0x2dc0d6,_0x547bbf){return function(_0x516a91){if(_0x516a91){return _0x516a91['update'](_0x2dc0d6)[_0xe7ce('0x20')](function(_0xa2c703){return _0xa2c703;});}return null;};}function removeEntity(_0x104c91,_0x58da7a){return function(_0x485866){if(_0x485866){return _0x485866['destroy']()[_0xe7ce('0x20')](function(){var _0x55bb78=_0x485866['get']({'plain':!![]});var _0x48f321='CustomReports';return db[_0xe7ce('0x21')][_0xe7ce('0x22')]({'where':{'type':_0x48f321,'resourceId':_0x55bb78['id']}})[_0xe7ce('0x20')](function(){return _0x485866;});})['then'](function(){_0x104c91[_0xe7ce('0x15')](0xcc)[_0xe7ce('0x16')]();});}};}function handleEntityNotFound(_0xddfde0,_0x570af6){return function(_0x2cca33){if(!_0x2cca33){_0xddfde0['sendStatus'](0x194);}return _0x2cca33;};}function handleError(_0x168307,_0x45b200){_0x45b200=_0x45b200||0x1f4;return function(_0x2b38b1){logger[_0xe7ce('0x23')](_0x2b38b1[_0xe7ce('0x24')]);if(_0x2b38b1['name']){delete _0x2b38b1[_0xe7ce('0x25')];}_0x168307[_0xe7ce('0x15')](_0x45b200)['send'](_0x2b38b1);};}exports[_0xe7ce('0x26')]=function(_0x263f35,_0x4435ed){var _0x21b979={},_0x21557a={},_0x2f8cf0={'count':0x0,'rows':[]};var _0xbb8dd9=_[_0xe7ce('0x27')](db['AnalyticCustomReport']['rawAttributes'],function(_0x39e1ae){return{'name':_0x39e1ae['fieldName'],'type':_0x39e1ae['type'][_0xe7ce('0x28')]};});_0x21557a[_0xe7ce('0x29')]=_['map'](_0xbb8dd9,_0xe7ce('0x25'));_0x21557a[_0xe7ce('0x2a')]=_[_0xe7ce('0x2b')](_0x263f35['query']);_0x21557a[_0xe7ce('0x2c')]=_[_0xe7ce('0x2d')](_0x21557a[_0xe7ce('0x29')],_0x21557a[_0xe7ce('0x2a')]);_0x21b979[_0xe7ce('0x2e')]=_['intersection'](_0x21557a[_0xe7ce('0x29')],qs[_0xe7ce('0x2f')](_0x263f35['query'][_0xe7ce('0x2f')]));_0x21b979[_0xe7ce('0x2e')]=_0x21b979[_0xe7ce('0x2e')]['length']?_0x21b979[_0xe7ce('0x2e')]:_0x21557a[_0xe7ce('0x29')];if(!_0x263f35[_0xe7ce('0x2a')][_0xe7ce('0x30')]('nolimit')){_0x21b979[_0xe7ce('0x31')]=qs[_0xe7ce('0x31')](_0x263f35[_0xe7ce('0x2a')][_0xe7ce('0x31')]);_0x21b979['offset']=qs[_0xe7ce('0x18')](_0x263f35[_0xe7ce('0x2a')][_0xe7ce('0x18')]);}_0x21b979['order']=qs[_0xe7ce('0x32')](_0x263f35['query']['sort']);_0x21b979['where']=qs[_0xe7ce('0x2c')](_[_0xe7ce('0x33')](_0x263f35[_0xe7ce('0x2a')],_0x21557a[_0xe7ce('0x2c')]),_0xbb8dd9);if(_0x263f35[_0xe7ce('0x2a')][_0xe7ce('0x34')]){_0x21b979['where']=_[_0xe7ce('0x35')](_0x21b979['where'],{'$or':_[_0xe7ce('0x27')](_0xbb8dd9,function(_0x566b36){if(_0x566b36['type']!==_0xe7ce('0x36')){var _0x35bd78={};_0x35bd78[_0x566b36[_0xe7ce('0x25')]]={'$like':'%'+_0x263f35[_0xe7ce('0x2a')][_0xe7ce('0x34')]+'%'};return _0x35bd78;}})});}_0x21b979=_[_0xe7ce('0x35')]({},_0x21b979,_0x263f35[_0xe7ce('0x37')]);var _0x21cea6={'where':_0x21b979[_0xe7ce('0x38')]};return db[_0xe7ce('0x39')][_0xe7ce('0x1a')](_0x21cea6)[_0xe7ce('0x20')](function(_0x2aae68){_0x2f8cf0['count']=_0x2aae68;if(_0x263f35[_0xe7ce('0x2a')][_0xe7ce('0x3a')]){_0x21b979[_0xe7ce('0x3b')]=[{'all':!![]}];}return db[_0xe7ce('0x39')][_0xe7ce('0x3c')](_0x21b979);})['then'](function(_0x2a2aa3){_0x2f8cf0[_0xe7ce('0x3d')]=_0x2a2aa3;return _0x2f8cf0;})[_0xe7ce('0x20')](respondWithFilteredResult(_0x4435ed,_0x21b979))[_0xe7ce('0x3e')](handleError(_0x4435ed,null));};exports[_0xe7ce('0x3f')]=function(_0x39f67d,_0x43fa8e){var _0x1a7ccb={'raw':![],'where':{'id':_0x39f67d['params']['id']}},_0x569909={};_0x569909['model']=_[_0xe7ce('0x2b')](db['AnalyticCustomReport'][_0xe7ce('0x40')]);_0x569909[_0xe7ce('0x2a')]=_['keys'](_0x39f67d[_0xe7ce('0x2a')]);_0x569909['filters']=_[_0xe7ce('0x2d')](_0x569909[_0xe7ce('0x29')],_0x569909[_0xe7ce('0x2a')]);_0x1a7ccb[_0xe7ce('0x2e')]=_[_0xe7ce('0x2d')](_0x569909[_0xe7ce('0x29')],qs[_0xe7ce('0x2f')](_0x39f67d[_0xe7ce('0x2a')][_0xe7ce('0x2f')]));_0x1a7ccb[_0xe7ce('0x2e')]=_0x1a7ccb[_0xe7ce('0x2e')][_0xe7ce('0x41')]?_0x1a7ccb[_0xe7ce('0x2e')]:_0x569909[_0xe7ce('0x29')];if(_0x39f67d[_0xe7ce('0x2a')][_0xe7ce('0x3a')]){_0x1a7ccb[_0xe7ce('0x3b')]=[{'all':!![]}];}_0x1a7ccb=_['merge']({},_0x1a7ccb,_0x39f67d[_0xe7ce('0x37')]);return db[_0xe7ce('0x39')]['find'](_0x1a7ccb)[_0xe7ce('0x20')](handleEntityNotFound(_0x43fa8e,null))['then'](respondWithResult(_0x43fa8e,null))[_0xe7ce('0x3e')](handleError(_0x43fa8e,null));};exports[_0xe7ce('0x42')]=function(_0x470365,_0x1bdfb8){return db[_0xe7ce('0x39')][_0xe7ce('0x42')](_0x470365[_0xe7ce('0x43')],{})[_0xe7ce('0x20')](function(_0x52318d){var _0x3cc801=_0x470365[_0xe7ce('0x44')][_0xe7ce('0x45')]({'plain':!![]});if(!_0x3cc801)throw new Error(_0xe7ce('0x46'));if(_0x3cc801[_0xe7ce('0x47')]==='user'){var _0x1fb174=_0x52318d[_0xe7ce('0x45')]({'plain':!![]});var _0x56a0d0=_0xe7ce('0x48');return db['UserProfileSection'][_0xe7ce('0x49')]({'where':{'name':_0x56a0d0,'userProfileId':_0x3cc801[_0xe7ce('0x4a')]},'raw':!![]})['then'](function(_0x2cdacb){if(_0x2cdacb&&_0x2cdacb[_0xe7ce('0x4b')]===0x0){return db['UserProfileResource'][_0xe7ce('0x42')]({'name':_0x1fb174['name'],'resourceId':_0x1fb174['id'],'type':_0xe7ce('0x4c'),'sectionId':_0x2cdacb['id']},{})['then'](function(){return _0x52318d;});}else{return _0x52318d;}})['catch'](function(_0x342dc6){logger[_0xe7ce('0x23')](_0xe7ce('0x4d'),_0x342dc6);throw _0x342dc6;});}return _0x52318d;})[_0xe7ce('0x20')](respondWithResult(_0x1bdfb8,0xc9))['catch'](handleError(_0x1bdfb8,null));};exports[_0xe7ce('0x4e')]=function(_0x5b0e33,_0x1328df){if(_0x5b0e33[_0xe7ce('0x43')]['id']){delete _0x5b0e33[_0xe7ce('0x43')]['id'];}return db[_0xe7ce('0x39')]['find']({'where':{'id':_0x5b0e33[_0xe7ce('0x4f')]['id']}})[_0xe7ce('0x20')](handleEntityNotFound(_0x1328df,null))[_0xe7ce('0x20')](saveUpdates(_0x5b0e33[_0xe7ce('0x43')],null))['then'](respondWithResult(_0x1328df,null))['catch'](handleError(_0x1328df,null));};exports['destroy']=function(_0x1f1054,_0x2ed567){return db['AnalyticCustomReport'][_0xe7ce('0x49')]({'where':{'id':_0x1f1054[_0xe7ce('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2ed567,null))[_0xe7ce('0x20')](removeEntity(_0x2ed567,null))['catch'](handleError(_0x2ed567,null));};exports[_0xe7ce('0x50')]=function(_0x44673c,_0x1ed4a2){var _0x5073d1=0xa;var _0x225dc7=[_0xe7ce('0x51'),_0xe7ce('0x52'),_0xe7ce('0x53'),_0xe7ce('0x54')];var _0x26f474={'SUM':_0xe7ce('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe7ce('0x56'),'MAX':_0xe7ce('0x57'),'MIN':_0xe7ce('0x58'),'AVG':_0xe7ce('0x59'),'GROUP_CONCAT':_0xe7ce('0x5a'),'GROUP_CONCAT ASC':_0xe7ce('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3cc528={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xe7ce('0x5c'),'ROUND':_0xe7ce('0x5d'),'UNIX_TIMESTAMP':_0xe7ce('0x5e')};var _0x18e45f=function(_0x4f8562){return!_[_0xe7ce('0x5f')]([_0xe7ce('0x60'),_0xe7ce('0x61'),_0xe7ce('0x62'),_0xe7ce('0x63')],_0x4f8562);};var _0x851b60=function(_0x1e65bd){if(!_0x1e65bd||!_0x1e65bd[_0xe7ce('0x64')][_0xe7ce('0x41')]){return'';}for(var _0x23ee44='(',_0x1a1294=0x0;_0x1a1294<_0x1e65bd[_0xe7ce('0x64')][_0xe7ce('0x41')];_0x1a1294+=0x1){_0x1a1294>0x0&&(_0x23ee44+='\x20'+_0x1e65bd[_0xe7ce('0x65')]+'\x20');_0x23ee44+=_0x1e65bd[_0xe7ce('0x64')][_0x1a1294][_0xe7ce('0x66')]?_0x851b60(_0x1e65bd['rules'][_0x1a1294][_0xe7ce('0x66')]):_0x1e65bd[_0xe7ce('0x64')][_0x1a1294][_0xe7ce('0x67')]+'\x20'+_0x1e65bd[_0xe7ce('0x64')][_0x1a1294][_0xe7ce('0x68')]+(_0x18e45f(_0x1e65bd['rules'][_0x1a1294]['condition'])?'\x20'+_0x1e65bd['rules'][_0x1a1294][_0xe7ce('0x69')]:'');}return _0x23ee44+')';};var _0x22def8={'where':{'id':_0x44673c[_0xe7ce('0x4f')]['id']}},_0x2d7806,_0x50c3ab,_0x35587b,_0x48a7a9,_0x58ab4c;_0x22def8=_[_0xe7ce('0x35')]({},_0x22def8,_0x44673c[_0xe7ce('0x37')]);return db[_0xe7ce('0x39')]['find'](_0x22def8)[_0xe7ce('0x20')](function(_0x5c9ac1){if(_0x5c9ac1){_0x2d7806=_0x5c9ac1;return _0x5c9ac1[_0xe7ce('0x6a')]();}return null;})['then'](function(_0x4e445f){if(_0x4e445f){if(!_0x4e445f[_0xe7ce('0x41')]){throw new db['Sequelize']['ValidationErrorItem'](_0xe7ce('0x6b'),0x193);}_0x50c3ab=_0x4e445f;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xe7ce('0x20')](function(_0x17efcc){if(_0x17efcc){_0x35587b=_[_0xe7ce('0x6c')](_0x17efcc,'id');var _0x9c3502;var _0x2f5617=squel[_0xe7ce('0x6d')]();_0x2f5617['from'](_0x2d7806[_0xe7ce('0x6e')]);for(var _0x4f7808=0x0;_0x4f7808<_0x50c3ab[_0xe7ce('0x41')];_0x4f7808+=0x1){_0x9c3502=_0x50c3ab[_0x4f7808][_0xe7ce('0x6f')]?_0x35587b[_0x50c3ab[_0x4f7808]['MetricId']]['metric']:_0x50c3ab[_0x4f7808][_0xe7ce('0x67')];_0x9c3502=_0x50c3ab[_0x4f7808][_0xe7ce('0x70')]?_[_0xe7ce('0x71')](_0x26f474[_0x50c3ab[_0x4f7808][_0xe7ce('0x70')]],'%s',_0x9c3502):_0x9c3502;_0x9c3502=_0x50c3ab[_0x4f7808][_0xe7ce('0x72')]?_[_0xe7ce('0x71')](_0x3cc528[_0x50c3ab[_0x4f7808][_0xe7ce('0x72')]],'%s',_0x9c3502):_0x9c3502;if(_0x50c3ab[_0x4f7808][_0xe7ce('0x73')]){_0x2f5617[_0xe7ce('0x66')](_0x9c3502);}_0x50c3ab[_0x4f7808][_0xe7ce('0x74')]&&_0x2f5617[_0xe7ce('0x75')](_0x9c3502,_0x50c3ab[_0x4f7808][_0xe7ce('0x74')]===_0xe7ce('0x76')?![]:!![]);_0x2f5617[_0xe7ce('0x67')](_0x9c3502,_0x50c3ab[_0x4f7808][_0xe7ce('0x77')]||_0x9c3502);}if(_0x2d7806[_0xe7ce('0x78')]){_0x2d7806[_0xe7ce('0x78')]=JSON[_0xe7ce('0x79')](_0x2d7806[_0xe7ce('0x78')]);for(var _0x269de8=0x0;_0x269de8<_0x2d7806['joins'][_0xe7ce('0x41')];_0x269de8+=0x1){if(_0x2d7806[_0xe7ce('0x78')][_0x269de8][_0xe7ce('0x7a')]&&_[_0xe7ce('0x5f')](_0x225dc7,_0x2d7806[_0xe7ce('0x78')][_0x269de8]['type'])&&_0x2d7806[_0xe7ce('0x78')][_0x269de8][_0xe7ce('0x7b')]&&_0x2d7806['joins'][_0x269de8]['foreignTable']&&_0x2d7806[_0xe7ce('0x78')][_0x269de8][_0xe7ce('0x7c')]){_0x2f5617[_0x2d7806[_0xe7ce('0x78')][_0x269de8]['type']](_0x2d7806[_0xe7ce('0x78')][_0x269de8][_0xe7ce('0x7d')],null,util[_0xe7ce('0x72')](_0xe7ce('0x7e'),_0x2d7806[_0xe7ce('0x6e')],_0x2d7806[_0xe7ce('0x78')][_0x269de8]['parentKey'],_0x2d7806['joins'][_0x269de8][_0xe7ce('0x7d')],_0x2d7806[_0xe7ce('0x78')][_0x269de8][_0xe7ce('0x7c')]));}}}if(_0x2d7806['conditions']){_0x2d7806['conditions']=JSON[_0xe7ce('0x79')](_0x2d7806[_0xe7ce('0x7f')]);_0x2f5617['where'](_0x851b60(_0x2d7806['conditions']['group']));}_0x58ab4c=_0x2f5617[_0xe7ce('0x80')]();_0x2f5617[_0xe7ce('0x31')](_0x5073d1);_0x2f5617['offset'](0x0);logger[_0xe7ce('0x81')](_0xe7ce('0x82'),_0x2f5617[_0xe7ce('0x83')]());return dbH['sequelize']['query'](_0x2f5617['toString'](),{'type':dbH[_0xe7ce('0x84')][_0xe7ce('0x85')][_0xe7ce('0x86')]});}})[_0xe7ce('0x20')](respondWithResult(_0x1ed4a2,null))[_0xe7ce('0x3e')](handleError(_0x1ed4a2,null));};function runReport(_0x351f58,_0x6aaf1f,_0xb847a1){var _0x33d7ec=_0x6aaf1f['name'];var _0x5691cb=0xa;var _0x142981=['join',_0xe7ce('0x52'),'right_join',_0xe7ce('0x54')];var _0x5b3b18={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe7ce('0x56'),'MAX':_0xe7ce('0x57'),'MIN':_0xe7ce('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe7ce('0x5a'),'GROUP_CONCAT ASC':_0xe7ce('0x5b'),'GROUP_CONCAT DESC':_0xe7ce('0x87')};var _0x48b9ec={'SEC_TO_TIME':_0xe7ce('0x88'),'DATE':'DATE(%s)','HOUR':_0xe7ce('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe7ce('0x5e')};var _0x558e11=function(_0x557805){return!_['includes']([_0xe7ce('0x60'),_0xe7ce('0x61'),_0xe7ce('0x62'),_0xe7ce('0x63')],_0x557805);};var _0x49ebf4=function(_0x32d059){if(!_0x32d059||!_0x32d059[_0xe7ce('0x64')]['length']){return'';}for(var _0xb1a28a='(',_0x4c482d=0x0;_0x4c482d<_0x32d059[_0xe7ce('0x64')]['length'];_0x4c482d+=0x1){_0x4c482d>0x0&&(_0xb1a28a+='\x20'+_0x32d059['operator']+'\x20');_0xb1a28a+=_0x32d059['rules'][_0x4c482d]['group']?_0x49ebf4(_0x32d059[_0xe7ce('0x64')][_0x4c482d][_0xe7ce('0x66')]):_0x32d059['rules'][_0x4c482d]['field']+'\x20'+_0x32d059['rules'][_0x4c482d][_0xe7ce('0x68')]+(_0x558e11(_0x32d059[_0xe7ce('0x64')][_0x4c482d][_0xe7ce('0x68')])?'\x20'+_0x32d059[_0xe7ce('0x64')][_0x4c482d][_0xe7ce('0x69')]:'');}return _0xb1a28a+')';};var _0x4d2175={'where':{'id':_0x351f58['id']}},_0x2f5947,_0x4bca1f,_0x14738f,_0x47ebec,_0x48df70;_0x4d2175=_['merge']({},_0x4d2175,_0xb847a1);return db[_0xe7ce('0x39')][_0xe7ce('0x49')](_0x4d2175)[_0xe7ce('0x20')](function(_0x2dacb4){if(_0x2dacb4){_0x2f5947=_0x2dacb4;return _0x2dacb4[_0xe7ce('0x6a')]();}return null;})[_0xe7ce('0x20')](function(_0x18c398){if(_0x18c398){if(!_0x18c398[_0xe7ce('0x41')]){throw new db[(_0xe7ce('0x89'))][(_0xe7ce('0x8a'))](_0xe7ce('0x6b'),0x193);}_0x4bca1f=_0x18c398;return db[_0xe7ce('0x8b')][_0xe7ce('0x3c')]({'raw':!![]});}return null;})['then'](function(_0x5ab307){if(_0x5ab307){_0x14738f=_[_0xe7ce('0x6c')](_0x5ab307,'id');var _0x1588de;var _0x151336=squel[_0xe7ce('0x6d')]();_0x151336[_0xe7ce('0x8c')](_0x2f5947[_0xe7ce('0x6e')]);for(var _0x12c391=0x0;_0x12c391<_0x4bca1f[_0xe7ce('0x41')];_0x12c391+=0x1){_0x1588de=_0x4bca1f[_0x12c391][_0xe7ce('0x6f')]?_0x14738f[_0x4bca1f[_0x12c391][_0xe7ce('0x6f')]][_0xe7ce('0x8d')]:_0x4bca1f[_0x12c391][_0xe7ce('0x67')];_0x1588de=_0x4bca1f[_0x12c391][_0xe7ce('0x70')]?_[_0xe7ce('0x71')](_0x5b3b18[_0x4bca1f[_0x12c391][_0xe7ce('0x70')]],'%s',_0x1588de):_0x1588de;_0x1588de=_0x4bca1f[_0x12c391][_0xe7ce('0x72')]?_['replace'](_0x48b9ec[_0x4bca1f[_0x12c391][_0xe7ce('0x72')]],'%s',_0x1588de):_0x1588de;if(_0x4bca1f[_0x12c391][_0xe7ce('0x73')]){_0x151336['group'](_0x1588de);}_0x4bca1f[_0x12c391][_0xe7ce('0x74')]&&_0x151336[_0xe7ce('0x75')](_0x1588de,_0x4bca1f[_0x12c391][_0xe7ce('0x74')]===_0xe7ce('0x76')?![]:!![]);_0x151336[_0xe7ce('0x67')](_0x1588de,_0x4bca1f[_0x12c391][_0xe7ce('0x77')]||_0x1588de);}if(_0x2f5947[_0xe7ce('0x78')]){_0x2f5947['joins']=JSON[_0xe7ce('0x79')](_0x2f5947[_0xe7ce('0x78')]);for(var _0xff5220=0x0;_0xff5220<_0x2f5947[_0xe7ce('0x78')][_0xe7ce('0x41')];_0xff5220+=0x1){if(_0x2f5947[_0xe7ce('0x78')][_0xff5220][_0xe7ce('0x7a')]&&_[_0xe7ce('0x5f')](_0x142981,_0x2f5947[_0xe7ce('0x78')][_0xff5220][_0xe7ce('0x7a')])&&_0x2f5947[_0xe7ce('0x78')][_0xff5220]['parentKey']&&_0x2f5947[_0xe7ce('0x78')][_0xff5220][_0xe7ce('0x7d')]&&_0x2f5947[_0xe7ce('0x78')][_0xff5220][_0xe7ce('0x7c')]){_0x151336[_0x2f5947[_0xe7ce('0x78')][_0xff5220][_0xe7ce('0x7a')]](_0x2f5947[_0xe7ce('0x78')][_0xff5220][_0xe7ce('0x7d')],null,util['format'](_0xe7ce('0x7e'),_0x2f5947[_0xe7ce('0x6e')],_0x2f5947[_0xe7ce('0x78')][_0xff5220]['parentKey'],_0x2f5947[_0xe7ce('0x78')][_0xff5220][_0xe7ce('0x7d')],_0x2f5947[_0xe7ce('0x78')][_0xff5220][_0xe7ce('0x7c')]));}}}if(_0x2f5947['conditions']){_0x2f5947[_0xe7ce('0x7f')]=JSON[_0xe7ce('0x79')](_0x2f5947['conditions']);_0x151336[_0xe7ce('0x38')](_0x49ebf4(_0x2f5947[_0xe7ce('0x7f')][_0xe7ce('0x66')]));}_0x48df70=_0x151336['clone']();_0x151336['limit'](_0x5691cb);_0x151336['offset'](0x0);return;}})['then'](function(){if(_0x6aaf1f[_0xe7ce('0x8e')]===_0xe7ce('0x8f')){return null;}var _0xc9fcd5=_[_0xe7ce('0x35')](_0x6aaf1f,{'name':_0x6aaf1f[_0xe7ce('0x90')]||_0x6aaf1f['name']||_0x2f5947[_0xe7ce('0x25')],'basename':_0x33d7ec,'savename':util[_0xe7ce('0x72')]('%s-%s.%s',_0x6aaf1f[_0xe7ce('0x25')]||_0x2f5947[_0xe7ce('0x25')],require(_0xe7ce('0x91'))[_0xe7ce('0x92')](0x4),_0x6aaf1f['output']||_0xe7ce('0x93')),'reportId':_0x2f5947['id'],'reportType':_0xe7ce('0x94')});return db[_0xe7ce('0x95')][_0xe7ce('0x42')](_0xc9fcd5,{'raw':!![]});})['then'](function(_0x31960f){if(_0x2f5947['table']===_0xe7ce('0x96')){_0x48df70[_0xe7ce('0x38')](_0x2f5947['table']+_0xe7ce('0x97'),_0x6aaf1f[_0xe7ce('0x98')],_0x6aaf1f[_0xe7ce('0x99')]);}else{_0x48df70[_0xe7ce('0x38')](_0x2f5947['table']+_0xe7ce('0x9a'),_0x6aaf1f[_0xe7ce('0x98')],_0x6aaf1f[_0xe7ce('0x99')]);}if(_0x31960f){logger['info'](_0xe7ce('0x9b'),_0x48df70[_0xe7ce('0x83')]());require(_0xe7ce('0x9c'))['fork'](path[_0xe7ce('0x51')](__dirname,_0xe7ce('0x9d'),_0x31960f['output']),[_0x31960f['id'],_0x48df70[_0xe7ce('0x83')](),path[_0xe7ce('0x51')](__dirname,_0xe7ce('0x9e'),_0x31960f[_0xe7ce('0x9f')]),_0x33d7ec]);return _0x31960f;}else{var _0x39ca4e=squel['select']();_0x39ca4e[_0xe7ce('0x8c')]('('+_0x48df70[_0xe7ce('0x83')]()+')',_0xe7ce('0xa0'));_0x39ca4e['field'](_0xe7ce('0xa1'),'count');_0x48df70[_0xe7ce('0x31')](_0x6aaf1f[_0xe7ce('0x31')]||_0x5691cb);_0x48df70[_0xe7ce('0x18')](_0x6aaf1f[_0xe7ce('0x18')]||0x0);return dbH[_0xe7ce('0x84')][_0xe7ce('0x2a')](_0x39ca4e['toString'](),{'type':dbH[_0xe7ce('0x84')]['QueryTypes'][_0xe7ce('0x86')]})[_0xe7ce('0x20')](function(_0x8dff51){if(!_0x8dff51[_0xe7ce('0x41')]){_0x47ebec=0x0;}else{_0x47ebec=_0x8dff51[0x0][_0xe7ce('0x1a')]||0x0;}return dbH[_0xe7ce('0x84')][_0xe7ce('0x2a')](_0x48df70[_0xe7ce('0x83')](),{'type':dbH[_0xe7ce('0x84')][_0xe7ce('0x85')][_0xe7ce('0x86')]});})[_0xe7ce('0x20')](function(_0x3ceafd){return{'rows':_0x3ceafd||[],'count':_0x47ebec};});}});}exports['run']=function(_0x3f0720,_0x2cea3c){return runReport(_0x3f0720[_0xe7ce('0x4f')],_0x3f0720[_0xe7ce('0x2a')],_0x3f0720[_0xe7ce('0x37')])[_0xe7ce('0x20')](respondWithResult(_0x2cea3c,null))[_0xe7ce('0x3e')](handleError(_0x2cea3c,null));};exports[_0xe7ce('0xa2')]=runReport;exports[_0xe7ce('0x2a')]=function(_0x5eb831,_0x5029d4){var _0x466aa1=0xa;var _0x459f42=['join',_0xe7ce('0x52'),_0xe7ce('0x53'),_0xe7ce('0x54')];var _0x2d83ce={'SUM':'SUM(%s)','COUNT':_0xe7ce('0xa3'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xe7ce('0x58'),'AVG':_0xe7ce('0x59'),'GROUP_CONCAT':_0xe7ce('0x5a'),'GROUP_CONCAT ASC':_0xe7ce('0x5b'),'GROUP_CONCAT DESC':_0xe7ce('0x87')};var _0x517e34={'SEC_TO_TIME':_0xe7ce('0x88'),'DATE':'DATE(%s)','HOUR':_0xe7ce('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2db6dc=function(_0x3cf4b9){return!_[_0xe7ce('0x5f')]([_0xe7ce('0x60'),_0xe7ce('0x61'),_0xe7ce('0x62'),_0xe7ce('0x63')],_0x3cf4b9);};var _0x28aad5=function(_0x4be42e){if(!_0x4be42e||!_0x4be42e[_0xe7ce('0x64')][_0xe7ce('0x41')]){return'';}for(var _0x316051='(',_0xb8bde2=0x0;_0xb8bde2<_0x4be42e['rules'][_0xe7ce('0x41')];_0xb8bde2+=0x1){_0xb8bde2>0x0&&(_0x316051+='\x20'+_0x4be42e[_0xe7ce('0x65')]+'\x20');_0x316051+=_0x4be42e[_0xe7ce('0x64')][_0xb8bde2][_0xe7ce('0x66')]?_0x28aad5(_0x4be42e[_0xe7ce('0x64')][_0xb8bde2][_0xe7ce('0x66')]):_0x4be42e['rules'][_0xb8bde2][_0xe7ce('0x67')]+'\x20'+_0x4be42e[_0xe7ce('0x64')][_0xb8bde2][_0xe7ce('0x68')]+(_0x2db6dc(_0x4be42e[_0xe7ce('0x64')][_0xb8bde2][_0xe7ce('0x68')])?'\x20'+_0x4be42e[_0xe7ce('0x64')][_0xb8bde2]['value']:'');}return _0x316051+')';};var _0x2eb45d={'where':{'id':_0x5eb831[_0xe7ce('0x4f')]['id']}},_0x5ba37d,_0x464a47,_0x16535a,_0xfa40d7,_0x59abd7;_0x2eb45d=_['merge']({},_0x2eb45d,_0x5eb831[_0xe7ce('0x37')]);return db[_0xe7ce('0x39')][_0xe7ce('0x49')](_0x2eb45d)[_0xe7ce('0x20')](function(_0x2ff100){if(_0x2ff100){_0x5ba37d=_0x2ff100;return _0x2ff100[_0xe7ce('0x6a')]();}return null;})[_0xe7ce('0x20')](function(_0x54d3e4){if(_0x54d3e4){if(!_0x54d3e4[_0xe7ce('0x41')]){throw new db[(_0xe7ce('0x89'))][(_0xe7ce('0x8a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x464a47=_0x54d3e4;return db[_0xe7ce('0x8b')][_0xe7ce('0x3c')]({'raw':!![]});}return null;})[_0xe7ce('0x20')](function(_0x2ef963){if(_0x2ef963){_0x16535a=_[_0xe7ce('0x6c')](_0x2ef963,'id');var _0x5d66f4;var _0x8138bd=squel['select']();_0x8138bd['from'](_0x5ba37d[_0xe7ce('0x6e')]);for(var _0x445d7c=0x0;_0x445d7c<_0x464a47[_0xe7ce('0x41')];_0x445d7c+=0x1){_0x5d66f4=_0x464a47[_0x445d7c][_0xe7ce('0x6f')]?_0x16535a[_0x464a47[_0x445d7c]['MetricId']][_0xe7ce('0x8d')]:_0x464a47[_0x445d7c][_0xe7ce('0x67')];_0x5d66f4=_0x464a47[_0x445d7c]['function']?_[_0xe7ce('0x71')](_0x2d83ce[_0x464a47[_0x445d7c]['function']],'%s',_0x5d66f4):_0x5d66f4;_0x5d66f4=_0x464a47[_0x445d7c][_0xe7ce('0x72')]?_[_0xe7ce('0x71')](_0x517e34[_0x464a47[_0x445d7c]['format']],'%s',_0x5d66f4):_0x5d66f4;if(_0x464a47[_0x445d7c]['groupBy']){_0x8138bd[_0xe7ce('0x66')](_0x5d66f4);}_0x464a47[_0x445d7c]['orderBy']&&_0x8138bd[_0xe7ce('0x75')](_0x5d66f4,_0x464a47[_0x445d7c][_0xe7ce('0x74')]===_0xe7ce('0x76')?![]:!![]);_0x8138bd['field'](_0x5d66f4,_0x464a47[_0x445d7c][_0xe7ce('0x77')]||_0x5d66f4);}if(_0x5ba37d[_0xe7ce('0x78')]){_0x5ba37d[_0xe7ce('0x78')]=JSON[_0xe7ce('0x79')](_0x5ba37d['joins']);for(var _0x558593=0x0;_0x558593<_0x5ba37d[_0xe7ce('0x78')][_0xe7ce('0x41')];_0x558593+=0x1){if(_0x5ba37d[_0xe7ce('0x78')][_0x558593][_0xe7ce('0x7a')]&&_[_0xe7ce('0x5f')](_0x459f42,_0x5ba37d['joins'][_0x558593][_0xe7ce('0x7a')])&&_0x5ba37d[_0xe7ce('0x78')][_0x558593][_0xe7ce('0x7b')]&&_0x5ba37d['joins'][_0x558593][_0xe7ce('0x7d')]&&_0x5ba37d[_0xe7ce('0x78')][_0x558593][_0xe7ce('0x7c')]){_0x8138bd[_0x5ba37d[_0xe7ce('0x78')][_0x558593][_0xe7ce('0x7a')]](_0x5ba37d['joins'][_0x558593][_0xe7ce('0x7d')],null,util[_0xe7ce('0x72')]('%s.%s\x20=\x20%s.%s',_0x5ba37d['table'],_0x5ba37d[_0xe7ce('0x78')][_0x558593][_0xe7ce('0x7b')],_0x5ba37d['joins'][_0x558593][_0xe7ce('0x7d')],_0x5ba37d[_0xe7ce('0x78')][_0x558593][_0xe7ce('0x7c')]));}}}if(_0x5ba37d[_0xe7ce('0x7f')]){_0x5ba37d[_0xe7ce('0x7f')]=JSON[_0xe7ce('0x79')](_0x5ba37d[_0xe7ce('0x7f')]);_0x8138bd[_0xe7ce('0x38')](_0x28aad5(_0x5ba37d[_0xe7ce('0x7f')][_0xe7ce('0x66')]));}_0x59abd7=_0x8138bd[_0xe7ce('0x80')]();_0x8138bd['limit'](_0x466aa1);_0x8138bd[_0xe7ce('0x18')](0x0);logger[_0xe7ce('0x81')](_0xe7ce('0x82'),_0x8138bd[_0xe7ce('0x83')]());return dbH['sequelize'][_0xe7ce('0x2a')](_0x8138bd['toString'](),{'type':dbH[_0xe7ce('0x84')][_0xe7ce('0x85')][_0xe7ce('0x86')]});}})['then'](function(){return{'sql':_0x59abd7[_0xe7ce('0x83')]()};})[_0xe7ce('0x20')](respondWithResult(_0x5029d4,null))[_0xe7ce('0x3e')](handleError(_0x5029d4,null));}; \ No newline at end of file +var _0x3f74=['name','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','AnalyticMetric','foreignKey','fullPath','%s-%s.%s','randomstring','generate','output','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','../../files/reports','COUNT(*)','run','right_join','IS\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','undefined','offset','count','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack'];(function(_0x550fe1,_0x2ee147){var _0x1a9e39=function(_0x4632d6){while(--_0x4632d6){_0x550fe1['push'](_0x550fe1['shift']());}};_0x1a9e39(++_0x2ee147);}(_0x3f74,0x121));var _0x43f7=function(_0x13fbbb,_0x40907c){_0x13fbbb=_0x13fbbb-0x0;var _0x24220c=_0x3f74[_0x13fbbb];return _0x24220c;};'use strict';var emlformat=require(_0x43f7('0x0'));var rimraf=require(_0x43f7('0x1'));var zipdir=require(_0x43f7('0x2'));var jsonpatch=require(_0x43f7('0x3'));var rp=require(_0x43f7('0x4'));var moment=require(_0x43f7('0x5'));var BPromise=require(_0x43f7('0x6'));var Mustache=require(_0x43f7('0x7'));var util=require('util');var path=require(_0x43f7('0x8'));var sox=require(_0x43f7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43f7('0xa'));var _=require('lodash');var squel=require(_0x43f7('0xb'));var crypto=require('crypto');var jsforce=require(_0x43f7('0xc'));var deskjs=require(_0x43f7('0xd'));var toCsv=require(_0x43f7('0xe'));var querystring=require(_0x43f7('0xf'));var Papa=require(_0x43f7('0x10'));var Redis=require('ioredis');var authService=require(_0x43f7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x43f7('0x12'));var hardwareService=require(_0x43f7('0x13'));var logger=require('../../config/logger')(_0x43f7('0x14'));var utils=require(_0x43f7('0x15'));var config=require(_0x43f7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x43f7('0x17'))['db'];var dbH=require(_0x43f7('0x17'))[_0x43f7('0x18')];function respondWithStatusCode(_0x14abd8,_0x38c349){_0x38c349=_0x38c349||0xcc;return function(_0x2b2da3){if(_0x2b2da3){return _0x14abd8[_0x43f7('0x19')](_0x38c349);}return _0x14abd8[_0x43f7('0x1a')](_0x38c349)[_0x43f7('0x1b')]();};}function respondWithResult(_0x1ba361,_0x158fe9){_0x158fe9=_0x158fe9||0xc8;return function(_0x30856b){if(_0x30856b){return _0x1ba361[_0x43f7('0x1a')](_0x158fe9)[_0x43f7('0x1c')](_0x30856b);}};}function respondWithFilteredResult(_0x1775b5,_0x2316fa){return function(_0x41d7d9){if(_0x41d7d9){var _0x155bdc=typeof _0x2316fa['offset']===_0x43f7('0x1d')&&typeof _0x2316fa['limit']==='undefined';var _0x3d8571=_0x41d7d9['count'];var _0x44380f=_0x155bdc?0x0:_0x2316fa[_0x43f7('0x1e')];var _0x415f0b=_0x155bdc?_0x41d7d9[_0x43f7('0x1f')]:_0x2316fa[_0x43f7('0x1e')]+_0x2316fa['limit'];var _0x83d922;if(_0x415f0b>=_0x3d8571){_0x415f0b=_0x3d8571;_0x83d922=0xc8;}else{_0x83d922=0xce;}_0x1775b5[_0x43f7('0x1a')](_0x83d922);return _0x1775b5['set'](_0x43f7('0x20'),_0x44380f+'-'+_0x415f0b+'/'+_0x3d8571)['json'](_0x41d7d9);}return null;};}function patchUpdates(_0x3ff7f6){return function(_0x246e06){try{jsonpatch[_0x43f7('0x21')](_0x246e06,_0x3ff7f6,!![]);}catch(_0x22c208){return BPromise[_0x43f7('0x22')](_0x22c208);}return _0x246e06[_0x43f7('0x23')]();};}function saveUpdates(_0x1d15e9,_0x19a2f5){return function(_0x35c9ab){if(_0x35c9ab){return _0x35c9ab[_0x43f7('0x24')](_0x1d15e9)[_0x43f7('0x25')](function(_0x4e6e98){return _0x4e6e98;});}return null;};}function removeEntity(_0x313965,_0x2ca45a){return function(_0x2b805d){if(_0x2b805d){return _0x2b805d[_0x43f7('0x26')]()['then'](function(){var _0x2d7b3a=_0x2b805d['get']({'plain':!![]});var _0x173cf9=_0x43f7('0x27');return db[_0x43f7('0x28')][_0x43f7('0x26')]({'where':{'type':_0x173cf9,'resourceId':_0x2d7b3a['id']}})[_0x43f7('0x25')](function(){return _0x2b805d;});})[_0x43f7('0x25')](function(){_0x313965[_0x43f7('0x1a')](0xcc)[_0x43f7('0x1b')]();});}};}function handleEntityNotFound(_0x1d3ee5,_0x18324c){return function(_0x294b7d){if(!_0x294b7d){_0x1d3ee5[_0x43f7('0x19')](0x194);}return _0x294b7d;};}function handleError(_0x4819b1,_0xf1e837){_0xf1e837=_0xf1e837||0x1f4;return function(_0x1bdd3c){logger[_0x43f7('0x29')](_0x1bdd3c[_0x43f7('0x2a')]);if(_0x1bdd3c[_0x43f7('0x2b')]){delete _0x1bdd3c['name'];}_0x4819b1[_0x43f7('0x1a')](_0xf1e837)['send'](_0x1bdd3c);};}exports['index']=function(_0xb0f888,_0x1b9ca5){var _0x5dd95a={},_0x490561={},_0x198d56={'count':0x0,'rows':[]};var _0x58af2b=_[_0x43f7('0x2c')](db[_0x43f7('0x2d')][_0x43f7('0x2e')],function(_0x36e043){return{'name':_0x36e043[_0x43f7('0x2f')],'type':_0x36e043['type'][_0x43f7('0x30')]};});_0x490561[_0x43f7('0x31')]=_[_0x43f7('0x2c')](_0x58af2b,_0x43f7('0x2b'));_0x490561[_0x43f7('0x32')]=_[_0x43f7('0x33')](_0xb0f888['query']);_0x490561[_0x43f7('0x34')]=_[_0x43f7('0x35')](_0x490561[_0x43f7('0x31')],_0x490561[_0x43f7('0x32')]);_0x5dd95a[_0x43f7('0x36')]=_[_0x43f7('0x35')](_0x490561[_0x43f7('0x31')],qs['fields'](_0xb0f888[_0x43f7('0x32')][_0x43f7('0x37')]));_0x5dd95a['attributes']=_0x5dd95a['attributes']['length']?_0x5dd95a[_0x43f7('0x36')]:_0x490561['model'];if(!_0xb0f888[_0x43f7('0x32')][_0x43f7('0x38')](_0x43f7('0x39'))){_0x5dd95a[_0x43f7('0x3a')]=qs['limit'](_0xb0f888[_0x43f7('0x32')][_0x43f7('0x3a')]);_0x5dd95a[_0x43f7('0x1e')]=qs[_0x43f7('0x1e')](_0xb0f888[_0x43f7('0x32')][_0x43f7('0x1e')]);}_0x5dd95a[_0x43f7('0x3b')]=qs[_0x43f7('0x3c')](_0xb0f888[_0x43f7('0x32')][_0x43f7('0x3c')]);_0x5dd95a[_0x43f7('0x3d')]=qs[_0x43f7('0x34')](_[_0x43f7('0x3e')](_0xb0f888[_0x43f7('0x32')],_0x490561[_0x43f7('0x34')]),_0x58af2b);if(_0xb0f888[_0x43f7('0x32')][_0x43f7('0x3f')]){_0x5dd95a[_0x43f7('0x3d')]=_['merge'](_0x5dd95a['where'],{'$or':_[_0x43f7('0x2c')](_0x58af2b,function(_0x75efcc){if(_0x75efcc['type']!==_0x43f7('0x40')){var _0xbdfbe2={};_0xbdfbe2[_0x75efcc[_0x43f7('0x2b')]]={'$like':'%'+_0xb0f888['query'][_0x43f7('0x3f')]+'%'};return _0xbdfbe2;}})});}_0x5dd95a=_[_0x43f7('0x41')]({},_0x5dd95a,_0xb0f888[_0x43f7('0x42')]);var _0x27978b={'where':_0x5dd95a[_0x43f7('0x3d')]};return db[_0x43f7('0x2d')][_0x43f7('0x1f')](_0x27978b)[_0x43f7('0x25')](function(_0x84ee14){_0x198d56[_0x43f7('0x1f')]=_0x84ee14;if(_0xb0f888['query'][_0x43f7('0x43')]){_0x5dd95a[_0x43f7('0x44')]=[{'all':!![]}];}return db[_0x43f7('0x2d')][_0x43f7('0x45')](_0x5dd95a);})[_0x43f7('0x25')](function(_0x27558c){_0x198d56['rows']=_0x27558c;return _0x198d56;})[_0x43f7('0x25')](respondWithFilteredResult(_0x1b9ca5,_0x5dd95a))[_0x43f7('0x46')](handleError(_0x1b9ca5,null));};exports[_0x43f7('0x47')]=function(_0x12e7ee,_0xfdb614){var _0x2a9448={'raw':![],'where':{'id':_0x12e7ee[_0x43f7('0x48')]['id']}},_0x2ae565={};_0x2ae565[_0x43f7('0x31')]=_[_0x43f7('0x33')](db[_0x43f7('0x2d')]['rawAttributes']);_0x2ae565['query']=_[_0x43f7('0x33')](_0x12e7ee[_0x43f7('0x32')]);_0x2ae565[_0x43f7('0x34')]=_[_0x43f7('0x35')](_0x2ae565[_0x43f7('0x31')],_0x2ae565[_0x43f7('0x32')]);_0x2a9448[_0x43f7('0x36')]=_['intersection'](_0x2ae565[_0x43f7('0x31')],qs[_0x43f7('0x37')](_0x12e7ee['query']['fields']));_0x2a9448[_0x43f7('0x36')]=_0x2a9448[_0x43f7('0x36')][_0x43f7('0x49')]?_0x2a9448[_0x43f7('0x36')]:_0x2ae565[_0x43f7('0x31')];if(_0x12e7ee[_0x43f7('0x32')][_0x43f7('0x43')]){_0x2a9448[_0x43f7('0x44')]=[{'all':!![]}];}_0x2a9448=_['merge']({},_0x2a9448,_0x12e7ee[_0x43f7('0x42')]);return db[_0x43f7('0x2d')][_0x43f7('0x4a')](_0x2a9448)['then'](handleEntityNotFound(_0xfdb614,null))[_0x43f7('0x25')](respondWithResult(_0xfdb614,null))[_0x43f7('0x46')](handleError(_0xfdb614,null));};exports['create']=function(_0xade160,_0x588f38){return db[_0x43f7('0x2d')][_0x43f7('0x4b')](_0xade160['body'],{})[_0x43f7('0x25')](function(_0x15fecf){var _0x462cb0=_0xade160['user'][_0x43f7('0x4c')]({'plain':!![]});if(!_0x462cb0)throw new Error(_0x43f7('0x4d'));if(_0x462cb0['role']==='user'){var _0x3a65d6=_0x15fecf['get']({'plain':!![]});var _0x3dcbea=_0x43f7('0x4e');return db[_0x43f7('0x4f')][_0x43f7('0x4a')]({'where':{'name':_0x3dcbea,'userProfileId':_0x462cb0[_0x43f7('0x50')]},'raw':!![]})[_0x43f7('0x25')](function(_0x19fffd){if(_0x19fffd&&_0x19fffd[_0x43f7('0x51')]===0x0){return db[_0x43f7('0x28')][_0x43f7('0x4b')]({'name':_0x3a65d6[_0x43f7('0x2b')],'resourceId':_0x3a65d6['id'],'type':_0x43f7('0x27'),'sectionId':_0x19fffd['id']},{})[_0x43f7('0x25')](function(){return _0x15fecf;});}else{return _0x15fecf;}})[_0x43f7('0x46')](function(_0x2783eb){logger['error'](_0x43f7('0x52'),_0x2783eb);throw _0x2783eb;});}return _0x15fecf;})[_0x43f7('0x25')](respondWithResult(_0x588f38,0xc9))[_0x43f7('0x46')](handleError(_0x588f38,null));};exports['update']=function(_0x3466e6,_0x256717){if(_0x3466e6['body']['id']){delete _0x3466e6[_0x43f7('0x53')]['id'];}return db[_0x43f7('0x2d')]['find']({'where':{'id':_0x3466e6[_0x43f7('0x48')]['id']}})[_0x43f7('0x25')](handleEntityNotFound(_0x256717,null))[_0x43f7('0x25')](saveUpdates(_0x3466e6[_0x43f7('0x53')],null))['then'](respondWithResult(_0x256717,null))[_0x43f7('0x46')](handleError(_0x256717,null));};exports['destroy']=function(_0xb6386,_0x4bde9a){return db[_0x43f7('0x2d')]['find']({'where':{'id':_0xb6386[_0x43f7('0x48')]['id']}})[_0x43f7('0x25')](handleEntityNotFound(_0x4bde9a,null))[_0x43f7('0x25')](removeEntity(_0x4bde9a,null))['catch'](handleError(_0x4bde9a,null));};exports[_0x43f7('0x54')]=function(_0x53afdf,_0x2b92e5){var _0x57932f=0xa;var _0x507707=[_0x43f7('0x55'),'left_join','right_join',_0x43f7('0x56')];var _0x596ed5={'SUM':_0x43f7('0x57'),'COUNT':_0x43f7('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x43f7('0x59'),'AVG':_0x43f7('0x5a'),'GROUP_CONCAT':_0x43f7('0x5b'),'GROUP_CONCAT ASC':_0x43f7('0x5c'),'GROUP_CONCAT DESC':_0x43f7('0x5d')};var _0x47ed29={'SEC_TO_TIME':_0x43f7('0x5e'),'DATE':_0x43f7('0x5f'),'HOUR':_0x43f7('0x60'),'ROUND':_0x43f7('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1fae81=function(_0x1774cd){return!_[_0x43f7('0x62')](['IS\x20NULL',_0x43f7('0x63'),_0x43f7('0x64'),'IS\x20NOT\x20EMPTY'],_0x1774cd);};var _0x3dde87=function(_0x131b31){if(!_0x131b31||!_0x131b31[_0x43f7('0x65')][_0x43f7('0x49')]){return'';}for(var _0x293875='(',_0x4e142d=0x0;_0x4e142d<_0x131b31[_0x43f7('0x65')][_0x43f7('0x49')];_0x4e142d+=0x1){_0x4e142d>0x0&&(_0x293875+='\x20'+_0x131b31[_0x43f7('0x66')]+'\x20');_0x293875+=_0x131b31[_0x43f7('0x65')][_0x4e142d]['group']?_0x3dde87(_0x131b31['rules'][_0x4e142d][_0x43f7('0x67')]):_0x131b31[_0x43f7('0x65')][_0x4e142d][_0x43f7('0x68')]+'\x20'+_0x131b31['rules'][_0x4e142d][_0x43f7('0x69')]+(_0x1fae81(_0x131b31[_0x43f7('0x65')][_0x4e142d][_0x43f7('0x69')])?'\x20'+_0x131b31[_0x43f7('0x65')][_0x4e142d][_0x43f7('0x6a')]:'');}return _0x293875+')';};var _0x2f37c9={'where':{'id':_0x53afdf[_0x43f7('0x48')]['id']}},_0x4221a3,_0x268b1f,_0x35a02d,_0x5bb015,_0x1d0651;_0x2f37c9=_[_0x43f7('0x41')]({},_0x2f37c9,_0x53afdf[_0x43f7('0x42')]);return db['AnalyticCustomReport'][_0x43f7('0x4a')](_0x2f37c9)[_0x43f7('0x25')](function(_0x3b657f){if(_0x3b657f){_0x4221a3=_0x3b657f;return _0x3b657f[_0x43f7('0x6b')]();}return null;})['then'](function(_0x56ebd0){if(_0x56ebd0){if(!_0x56ebd0[_0x43f7('0x49')]){throw new db[(_0x43f7('0x6c'))]['ValidationErrorItem'](_0x43f7('0x6d'),0x193);}_0x268b1f=_0x56ebd0;return db['AnalyticMetric'][_0x43f7('0x45')]({'raw':!![]});}return null;})['then'](function(_0x3688ac){if(_0x3688ac){_0x35a02d=_[_0x43f7('0x6e')](_0x3688ac,'id');var _0x2a9fe0;var _0x4e526a=squel[_0x43f7('0x6f')]();_0x4e526a[_0x43f7('0x70')](_0x4221a3[_0x43f7('0x71')]);for(var _0x285e35=0x0;_0x285e35<_0x268b1f[_0x43f7('0x49')];_0x285e35+=0x1){_0x2a9fe0=_0x268b1f[_0x285e35]['MetricId']?_0x35a02d[_0x268b1f[_0x285e35][_0x43f7('0x72')]][_0x43f7('0x73')]:_0x268b1f[_0x285e35][_0x43f7('0x68')];_0x2a9fe0=_0x268b1f[_0x285e35]['function']?_[_0x43f7('0x74')](_0x596ed5[_0x268b1f[_0x285e35][_0x43f7('0x75')]],'%s',_0x2a9fe0):_0x2a9fe0;_0x2a9fe0=_0x268b1f[_0x285e35][_0x43f7('0x76')]?_['replace'](_0x47ed29[_0x268b1f[_0x285e35][_0x43f7('0x76')]],'%s',_0x2a9fe0):_0x2a9fe0;if(_0x268b1f[_0x285e35][_0x43f7('0x77')]){_0x4e526a['group'](_0x2a9fe0);}_0x268b1f[_0x285e35]['orderBy']&&_0x4e526a[_0x43f7('0x3b')](_0x2a9fe0,_0x268b1f[_0x285e35][_0x43f7('0x78')]===_0x43f7('0x79')?![]:!![]);_0x4e526a[_0x43f7('0x68')](_0x2a9fe0,_0x268b1f[_0x285e35][_0x43f7('0x7a')]||_0x2a9fe0);}if(_0x4221a3[_0x43f7('0x7b')]){_0x4221a3['joins']=JSON[_0x43f7('0x7c')](_0x4221a3[_0x43f7('0x7b')]);for(var _0x25ebbb=0x0;_0x25ebbb<_0x4221a3[_0x43f7('0x7b')]['length'];_0x25ebbb+=0x1){if(_0x4221a3[_0x43f7('0x7b')][_0x25ebbb][_0x43f7('0x7d')]&&_['includes'](_0x507707,_0x4221a3[_0x43f7('0x7b')][_0x25ebbb][_0x43f7('0x7d')])&&_0x4221a3[_0x43f7('0x7b')][_0x25ebbb]['parentKey']&&_0x4221a3[_0x43f7('0x7b')][_0x25ebbb][_0x43f7('0x7e')]&&_0x4221a3[_0x43f7('0x7b')][_0x25ebbb]['foreignKey']){_0x4e526a[_0x4221a3['joins'][_0x25ebbb][_0x43f7('0x7d')]](_0x4221a3['joins'][_0x25ebbb]['foreignTable'],null,util[_0x43f7('0x76')](_0x43f7('0x7f'),_0x4221a3[_0x43f7('0x71')],_0x4221a3[_0x43f7('0x7b')][_0x25ebbb][_0x43f7('0x80')],_0x4221a3['joins'][_0x25ebbb][_0x43f7('0x7e')],_0x4221a3[_0x43f7('0x7b')][_0x25ebbb]['foreignKey']));}}}if(_0x4221a3[_0x43f7('0x81')]){_0x4221a3[_0x43f7('0x81')]=JSON[_0x43f7('0x7c')](_0x4221a3['conditions']);_0x4e526a[_0x43f7('0x3d')](_0x3dde87(_0x4221a3[_0x43f7('0x81')][_0x43f7('0x67')]));}_0x1d0651=_0x4e526a[_0x43f7('0x82')]();_0x4e526a[_0x43f7('0x3a')](_0x57932f);_0x4e526a['offset'](0x0);logger[_0x43f7('0x83')](_0x43f7('0x84'),_0x4e526a[_0x43f7('0x85')]());return dbH['sequelize']['query'](_0x4e526a[_0x43f7('0x85')](),{'type':dbH[_0x43f7('0x86')][_0x43f7('0x87')][_0x43f7('0x88')]});}})[_0x43f7('0x25')](respondWithResult(_0x2b92e5,null))[_0x43f7('0x46')](handleError(_0x2b92e5,null));};function runReport(_0x34fda2,_0x314982,_0x15d500){var _0x54e82c=_0x314982[_0x43f7('0x2b')];var _0x4b0477=0xa;var _0x5f0d26=[_0x43f7('0x55'),_0x43f7('0x89'),'right_join',_0x43f7('0x56')];var _0x301ce0={'SUM':'SUM(%s)','COUNT':_0x43f7('0x58'),'COUNT DISTINCT':_0x43f7('0x8a'),'MAX':_0x43f7('0x8b'),'MIN':_0x43f7('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x43f7('0x5c'),'GROUP_CONCAT DESC':_0x43f7('0x5d')};var _0x355cf6={'SEC_TO_TIME':_0x43f7('0x5e'),'DATE':_0x43f7('0x5f'),'HOUR':_0x43f7('0x60'),'ROUND':_0x43f7('0x61'),'UNIX_TIMESTAMP':_0x43f7('0x8c')};var _0xe21fc5=function(_0x3d737d){return!_[_0x43f7('0x62')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x43f7('0x64'),_0x43f7('0x8d')],_0x3d737d);};var _0x3008ab=function(_0x418188){if(!_0x418188||!_0x418188[_0x43f7('0x65')][_0x43f7('0x49')]){return'';}for(var _0x544be1='(',_0x40a9fc=0x0;_0x40a9fc<_0x418188['rules'][_0x43f7('0x49')];_0x40a9fc+=0x1){_0x40a9fc>0x0&&(_0x544be1+='\x20'+_0x418188[_0x43f7('0x66')]+'\x20');_0x544be1+=_0x418188[_0x43f7('0x65')][_0x40a9fc][_0x43f7('0x67')]?_0x3008ab(_0x418188['rules'][_0x40a9fc][_0x43f7('0x67')]):_0x418188[_0x43f7('0x65')][_0x40a9fc][_0x43f7('0x68')]+'\x20'+_0x418188['rules'][_0x40a9fc][_0x43f7('0x69')]+(_0xe21fc5(_0x418188[_0x43f7('0x65')][_0x40a9fc][_0x43f7('0x69')])?'\x20'+_0x418188[_0x43f7('0x65')][_0x40a9fc]['value']:'');}return _0x544be1+')';};var _0x25f130={'where':{'id':_0x34fda2['id']}},_0x425246,_0x74f822,_0x23ff41,_0x59cf40,_0x831560;_0x25f130=_[_0x43f7('0x41')]({},_0x25f130,_0x15d500);return db['AnalyticCustomReport']['find'](_0x25f130)[_0x43f7('0x25')](function(_0x5e7d33){if(_0x5e7d33){_0x425246=_0x5e7d33;return _0x5e7d33[_0x43f7('0x6b')]();}return null;})[_0x43f7('0x25')](function(_0x5452c8){if(_0x5452c8){if(!_0x5452c8['length']){throw new db[(_0x43f7('0x6c'))][(_0x43f7('0x8e'))](_0x43f7('0x6d'),0x193);}_0x74f822=_0x5452c8;return db[_0x43f7('0x8f')][_0x43f7('0x45')]({'raw':!![]});}return null;})['then'](function(_0x1778c3){if(_0x1778c3){_0x23ff41=_[_0x43f7('0x6e')](_0x1778c3,'id');var _0x10e909;var _0x68ca4d=squel[_0x43f7('0x6f')]();_0x68ca4d['from'](_0x425246[_0x43f7('0x71')]);for(var _0x36cdc7=0x0;_0x36cdc7<_0x74f822[_0x43f7('0x49')];_0x36cdc7+=0x1){_0x10e909=_0x74f822[_0x36cdc7]['MetricId']?_0x23ff41[_0x74f822[_0x36cdc7][_0x43f7('0x72')]][_0x43f7('0x73')]:_0x74f822[_0x36cdc7][_0x43f7('0x68')];_0x10e909=_0x74f822[_0x36cdc7]['function']?_[_0x43f7('0x74')](_0x301ce0[_0x74f822[_0x36cdc7]['function']],'%s',_0x10e909):_0x10e909;_0x10e909=_0x74f822[_0x36cdc7]['format']?_[_0x43f7('0x74')](_0x355cf6[_0x74f822[_0x36cdc7][_0x43f7('0x76')]],'%s',_0x10e909):_0x10e909;if(_0x74f822[_0x36cdc7][_0x43f7('0x77')]){_0x68ca4d['group'](_0x10e909);}_0x74f822[_0x36cdc7][_0x43f7('0x78')]&&_0x68ca4d['order'](_0x10e909,_0x74f822[_0x36cdc7]['orderBy']==='DESC'?![]:!![]);_0x68ca4d['field'](_0x10e909,_0x74f822[_0x36cdc7]['alias']||_0x10e909);}if(_0x425246[_0x43f7('0x7b')]){_0x425246[_0x43f7('0x7b')]=JSON[_0x43f7('0x7c')](_0x425246[_0x43f7('0x7b')]);for(var _0x877290=0x0;_0x877290<_0x425246[_0x43f7('0x7b')][_0x43f7('0x49')];_0x877290+=0x1){if(_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x7d')]&&_[_0x43f7('0x62')](_0x5f0d26,_0x425246[_0x43f7('0x7b')][_0x877290]['type'])&&_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x80')]&&_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x7e')]&&_0x425246['joins'][_0x877290][_0x43f7('0x90')]){_0x68ca4d[_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x7d')]](_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x7e')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x425246[_0x43f7('0x71')],_0x425246[_0x43f7('0x7b')][_0x877290]['parentKey'],_0x425246[_0x43f7('0x7b')][_0x877290]['foreignTable'],_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x90')]));}}}if(_0x425246[_0x43f7('0x81')]){_0x425246[_0x43f7('0x81')]=JSON[_0x43f7('0x7c')](_0x425246[_0x43f7('0x81')]);_0x68ca4d[_0x43f7('0x3d')](_0x3008ab(_0x425246['conditions'][_0x43f7('0x67')]));}_0x831560=_0x68ca4d[_0x43f7('0x82')]();_0x68ca4d[_0x43f7('0x3a')](_0x4b0477);_0x68ca4d[_0x43f7('0x1e')](0x0);return;}})[_0x43f7('0x25')](function(){if(_0x314982['output']==='web'){return null;}var _0xb14a36=_[_0x43f7('0x41')](_0x314982,{'name':_0x314982[_0x43f7('0x91')]||_0x314982[_0x43f7('0x2b')]||_0x425246[_0x43f7('0x2b')],'basename':_0x54e82c,'savename':util[_0x43f7('0x76')](_0x43f7('0x92'),_0x314982[_0x43f7('0x2b')]||_0x425246['name'],require(_0x43f7('0x93'))[_0x43f7('0x94')](0x4),_0x314982[_0x43f7('0x95')]||'csv'),'reportId':_0x425246['id'],'reportType':_0x43f7('0x96')});return db[_0x43f7('0x97')]['create'](_0xb14a36,{'raw':!![]});})[_0x43f7('0x25')](function(_0x36b92c){if(_0x425246[_0x43f7('0x71')]===_0x43f7('0x98')){_0x831560['where'](_0x425246[_0x43f7('0x71')]+_0x43f7('0x99'),_0x314982[_0x43f7('0x9a')],_0x314982[_0x43f7('0x9b')]);}else{_0x831560[_0x43f7('0x3d')](_0x425246[_0x43f7('0x71')]+_0x43f7('0x9c'),_0x314982[_0x43f7('0x9a')],_0x314982['endDate']);}if(_0x36b92c){logger[_0x43f7('0x9d')](_0x43f7('0x9e'),_0x831560[_0x43f7('0x85')]());require('child_process')[_0x43f7('0x9f')](path[_0x43f7('0x55')](__dirname,_0x43f7('0xa0'),_0x36b92c[_0x43f7('0x95')]),[_0x36b92c['id'],_0x831560['toString'](),path[_0x43f7('0x55')](__dirname,_0x43f7('0xa1'),_0x36b92c['savename']),_0x54e82c]);return _0x36b92c;}else{var _0x4dc7fa=squel[_0x43f7('0x6f')]();_0x4dc7fa[_0x43f7('0x70')]('('+_0x831560[_0x43f7('0x85')]()+')','countTable');_0x4dc7fa[_0x43f7('0x68')](_0x43f7('0xa2'),_0x43f7('0x1f'));_0x831560[_0x43f7('0x3a')](_0x314982[_0x43f7('0x3a')]||_0x4b0477);_0x831560[_0x43f7('0x1e')](_0x314982[_0x43f7('0x1e')]||0x0);return dbH[_0x43f7('0x86')][_0x43f7('0x32')](_0x4dc7fa[_0x43f7('0x85')](),{'type':dbH[_0x43f7('0x86')]['QueryTypes'][_0x43f7('0x88')]})['then'](function(_0xc6a3c6){if(!_0xc6a3c6[_0x43f7('0x49')]){_0x59cf40=0x0;}else{_0x59cf40=_0xc6a3c6[0x0][_0x43f7('0x1f')]||0x0;}return dbH[_0x43f7('0x86')][_0x43f7('0x32')](_0x831560[_0x43f7('0x85')](),{'type':dbH[_0x43f7('0x86')][_0x43f7('0x87')][_0x43f7('0x88')]});})[_0x43f7('0x25')](function(_0x5e75a8){return{'rows':_0x5e75a8||[],'count':_0x59cf40};});}});}exports[_0x43f7('0xa3')]=function(_0x54d36d,_0x48bf42){return runReport(_0x54d36d[_0x43f7('0x48')],_0x54d36d[_0x43f7('0x32')],_0x54d36d[_0x43f7('0x42')])[_0x43f7('0x25')](respondWithResult(_0x48bf42,null))['catch'](handleError(_0x48bf42,null));};exports['runReport']=runReport;exports[_0x43f7('0x32')]=function(_0x4303fe,_0x2e9961){var _0x41c636=0xa;var _0x2bf70d=['join',_0x43f7('0x89'),_0x43f7('0xa4'),_0x43f7('0x56')];var _0x5e6f2e={'SUM':_0x43f7('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x43f7('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x43f7('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x565f81={'SEC_TO_TIME':_0x43f7('0x5e'),'DATE':_0x43f7('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x43f7('0x61'),'UNIX_TIMESTAMP':_0x43f7('0x8c')};var _0x2b748e=function(_0x2e574b){return!_['includes']([_0x43f7('0xa5'),'IS\x20NOT\x20NULL',_0x43f7('0x64'),_0x43f7('0x8d')],_0x2e574b);};var _0x1b19d8=function(_0x1b437e){if(!_0x1b437e||!_0x1b437e[_0x43f7('0x65')][_0x43f7('0x49')]){return'';}for(var _0x1ff3fe='(',_0x5c9e35=0x0;_0x5c9e35<_0x1b437e[_0x43f7('0x65')][_0x43f7('0x49')];_0x5c9e35+=0x1){_0x5c9e35>0x0&&(_0x1ff3fe+='\x20'+_0x1b437e[_0x43f7('0x66')]+'\x20');_0x1ff3fe+=_0x1b437e['rules'][_0x5c9e35][_0x43f7('0x67')]?_0x1b19d8(_0x1b437e[_0x43f7('0x65')][_0x5c9e35][_0x43f7('0x67')]):_0x1b437e[_0x43f7('0x65')][_0x5c9e35][_0x43f7('0x68')]+'\x20'+_0x1b437e[_0x43f7('0x65')][_0x5c9e35][_0x43f7('0x69')]+(_0x2b748e(_0x1b437e[_0x43f7('0x65')][_0x5c9e35][_0x43f7('0x69')])?'\x20'+_0x1b437e['rules'][_0x5c9e35][_0x43f7('0x6a')]:'');}return _0x1ff3fe+')';};var _0x3b93e3={'where':{'id':_0x4303fe[_0x43f7('0x48')]['id']}},_0x3d0a3c,_0x2da23a,_0x42afe5,_0x51ffae,_0xb88aa5;_0x3b93e3=_['merge']({},_0x3b93e3,_0x4303fe[_0x43f7('0x42')]);return db[_0x43f7('0x2d')]['find'](_0x3b93e3)[_0x43f7('0x25')](function(_0x5cfba7){if(_0x5cfba7){_0x3d0a3c=_0x5cfba7;return _0x5cfba7[_0x43f7('0x6b')]();}return null;})[_0x43f7('0x25')](function(_0x5d0d15){if(_0x5d0d15){if(!_0x5d0d15['length']){throw new db['Sequelize'][(_0x43f7('0x8e'))](_0x43f7('0x6d'),0x193);}_0x2da23a=_0x5d0d15;return db[_0x43f7('0x8f')][_0x43f7('0x45')]({'raw':!![]});}return null;})[_0x43f7('0x25')](function(_0x2061dd){if(_0x2061dd){_0x42afe5=_[_0x43f7('0x6e')](_0x2061dd,'id');var _0x17dbc1;var _0xc07364=squel[_0x43f7('0x6f')]();_0xc07364['from'](_0x3d0a3c['table']);for(var _0x4488a2=0x0;_0x4488a2<_0x2da23a[_0x43f7('0x49')];_0x4488a2+=0x1){_0x17dbc1=_0x2da23a[_0x4488a2][_0x43f7('0x72')]?_0x42afe5[_0x2da23a[_0x4488a2][_0x43f7('0x72')]][_0x43f7('0x73')]:_0x2da23a[_0x4488a2][_0x43f7('0x68')];_0x17dbc1=_0x2da23a[_0x4488a2][_0x43f7('0x75')]?_[_0x43f7('0x74')](_0x5e6f2e[_0x2da23a[_0x4488a2][_0x43f7('0x75')]],'%s',_0x17dbc1):_0x17dbc1;_0x17dbc1=_0x2da23a[_0x4488a2][_0x43f7('0x76')]?_[_0x43f7('0x74')](_0x565f81[_0x2da23a[_0x4488a2]['format']],'%s',_0x17dbc1):_0x17dbc1;if(_0x2da23a[_0x4488a2]['groupBy']){_0xc07364['group'](_0x17dbc1);}_0x2da23a[_0x4488a2][_0x43f7('0x78')]&&_0xc07364[_0x43f7('0x3b')](_0x17dbc1,_0x2da23a[_0x4488a2]['orderBy']===_0x43f7('0x79')?![]:!![]);_0xc07364['field'](_0x17dbc1,_0x2da23a[_0x4488a2][_0x43f7('0x7a')]||_0x17dbc1);}if(_0x3d0a3c[_0x43f7('0x7b')]){_0x3d0a3c['joins']=JSON[_0x43f7('0x7c')](_0x3d0a3c[_0x43f7('0x7b')]);for(var _0x2cff95=0x0;_0x2cff95<_0x3d0a3c[_0x43f7('0x7b')]['length'];_0x2cff95+=0x1){if(_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x7d')]&&_[_0x43f7('0x62')](_0x2bf70d,_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x7d')])&&_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95]['parentKey']&&_0x3d0a3c['joins'][_0x2cff95][_0x43f7('0x7e')]&&_0x3d0a3c['joins'][_0x2cff95]['foreignKey']){_0xc07364[_0x3d0a3c['joins'][_0x2cff95][_0x43f7('0x7d')]](_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x7e')],null,util['format'](_0x43f7('0x7f'),_0x3d0a3c[_0x43f7('0x71')],_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x80')],_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x7e')],_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x90')]));}}}if(_0x3d0a3c[_0x43f7('0x81')]){_0x3d0a3c[_0x43f7('0x81')]=JSON['parse'](_0x3d0a3c[_0x43f7('0x81')]);_0xc07364[_0x43f7('0x3d')](_0x1b19d8(_0x3d0a3c[_0x43f7('0x81')][_0x43f7('0x67')]));}_0xb88aa5=_0xc07364[_0x43f7('0x82')]();_0xc07364['limit'](_0x41c636);_0xc07364[_0x43f7('0x1e')](0x0);logger[_0x43f7('0x83')]('Limited\x20Query:',_0xc07364[_0x43f7('0x85')]());return dbH[_0x43f7('0x86')][_0x43f7('0x32')](_0xc07364[_0x43f7('0x85')](),{'type':dbH[_0x43f7('0x86')]['QueryTypes'][_0x43f7('0x88')]});}})['then'](function(){return{'sql':_0xb88aa5[_0x43f7('0x85')]()};})[_0x43f7('0x25')](respondWithResult(_0x2e9961,null))[_0x43f7('0x46')](handleError(_0x2e9961,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index d362d5c..7e3e19d 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 _0x9900=['moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9900,0x6c));var _0x0990=function(_0x28af96,_0x3049fb){_0x28af96=_0x28af96-0x0;var _0x27c8a1=_0x9900[_0x28af96];return _0x27c8a1;};'use strict';var _=require(_0x0990('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0990('0x1'));var moment=require(_0x0990('0x2'));var BPromise=require(_0x0990('0x3'));var rp=require(_0x0990('0x4'));var fs=require('fs');var path=require(_0x0990('0x5'));var rimraf=require(_0x0990('0x6'));var config=require('../../config/environment');var attributes=require(_0x0990('0x7'));module[_0x0990('0x8')]=function(_0x360261,_0x167c01){return _0x360261['define'](_0x0990('0x9'),attributes,{'tableName':_0x0990('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89dd=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./analyticCustomReport.attributes'];(function(_0x372a0a,_0x35182d){var _0x30ae0e=function(_0x158402){while(--_0x158402){_0x372a0a['push'](_0x372a0a['shift']());}};_0x30ae0e(++_0x35182d);}(_0x89dd,0x1be));var _0xd89d=function(_0xe672eb,_0x14af50){_0xe672eb=_0xe672eb-0x0;var _0x5ef77a=_0x89dd[_0xe672eb];return _0x5ef77a;};'use strict';var _=require(_0xd89d('0x0'));var util=require(_0xd89d('0x1'));var logger=require(_0xd89d('0x2'))(_0xd89d('0x3'));var moment=require(_0xd89d('0x4'));var BPromise=require(_0xd89d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd89d('0x6'));var rimraf=require(_0xd89d('0x7'));var config=require('../../config/environment');var attributes=require(_0xd89d('0x8'));module[_0xd89d('0x9')]=function(_0x5a5c91,_0x4fd742){return _0x5a5c91[_0xd89d('0xa')](_0xd89d('0xb'),attributes,{'tableName':_0xd89d('0xc'),'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 0a344ca..a6fb90e 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 _0x2ac3=['then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2d23d2,_0x494788){var _0xcc59f1=function(_0x28aaab){while(--_0x28aaab){_0x2d23d2['push'](_0x2d23d2['shift']());}};_0xcc59f1(++_0x494788);}(_0x2ac3,0x1ad));var _0x32ac=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2ac3[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x32ac('0x0'));var util=require('util');var moment=require(_0x32ac('0x1'));var BPromise=require('bluebird');var rs=require(_0x32ac('0x2'));var fs=require('fs');var Redis=require(_0x32ac('0x3'));var db=require(_0x32ac('0x4'))['db'];var utils=require(_0x32ac('0x5'));var logger=require('../../config/logger')(_0x32ac('0x6'));var config=require(_0x32ac('0x7'));var jayson=require(_0x32ac('0x8'));var client=jayson[_0x32ac('0x9')][_0x32ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c7ee9,_0x236f74,_0x50b2b5){return new BPromise(function(_0x1d6b5b,_0x1fd352){return client['request'](_0x2c7ee9,_0x50b2b5)[_0x32ac('0xb')](function(_0xb2991e){logger['info'](_0x32ac('0xc'),_0x236f74,_0x32ac('0xd'));logger[_0x32ac('0xe')](_0x32ac('0xf'),_0x236f74,'request\x20sent',JSON['stringify'](_0xb2991e));if(_0xb2991e[_0x32ac('0x10')]){if(_0xb2991e[_0x32ac('0x10')][_0x32ac('0x11')]===0x1f4){logger['error'](_0x32ac('0xc'),_0x236f74,_0xb2991e['error'][_0x32ac('0x12')]);return _0x1fd352(_0xb2991e['error'][_0x32ac('0x12')]);}logger[_0x32ac('0x10')](_0x32ac('0xc'),_0x236f74,_0xb2991e[_0x32ac('0x10')][_0x32ac('0x12')]);return _0x1d6b5b(_0xb2991e['error'][_0x32ac('0x12')]);}else{logger[_0x32ac('0x13')](_0x32ac('0xc'),_0x236f74,_0x32ac('0xd'));_0x1d6b5b(_0xb2991e['result'][_0x32ac('0x12')]);}})['catch'](function(_0x55dab9){logger[_0x32ac('0x10')](_0x32ac('0xc'),_0x236f74,_0x55dab9);_0x1fd352(_0x55dab9);});});} \ No newline at end of file +var _0x3177=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5edcd7,_0x4c5e59){var _0x2f5b45=function(_0x11aa0c){while(--_0x11aa0c){_0x5edcd7['push'](_0x5edcd7['shift']());}};_0x2f5b45(++_0x4c5e59);}(_0x3177,0x1b4));var _0x7317=function(_0x3eab50,_0x2c40ba){_0x3eab50=_0x3eab50-0x0;var _0x1d0cb1=_0x3177[_0x3eab50];return _0x1d0cb1;};'use strict';var _=require('lodash');var util=require(_0x7317('0x0'));var moment=require(_0x7317('0x1'));var BPromise=require(_0x7317('0x2'));var rs=require(_0x7317('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7317('0x4'))['db'];var utils=require(_0x7317('0x5'));var logger=require(_0x7317('0x6'))(_0x7317('0x7'));var config=require(_0x7317('0x8'));var jayson=require(_0x7317('0x9'));var client=jayson[_0x7317('0xa')][_0x7317('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eaf37,_0x464341,_0x391fea){return new BPromise(function(_0x3dccdb,_0x55be7b){return client[_0x7317('0xc')](_0x3eaf37,_0x391fea)[_0x7317('0xd')](function(_0x44b168){logger[_0x7317('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x464341,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x464341,_0x7317('0xf'),JSON['stringify'](_0x44b168));if(_0x44b168['error']){if(_0x44b168[_0x7317('0x10')]['code']===0x1f4){logger[_0x7317('0x10')](_0x7317('0x11'),_0x464341,_0x44b168[_0x7317('0x10')]['message']);return _0x55be7b(_0x44b168[_0x7317('0x10')][_0x7317('0x12')]);}logger[_0x7317('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x464341,_0x44b168['error'][_0x7317('0x12')]);return _0x3dccdb(_0x44b168[_0x7317('0x10')][_0x7317('0x12')]);}else{logger[_0x7317('0xe')](_0x7317('0x11'),_0x464341,_0x7317('0xf'));_0x3dccdb(_0x44b168[_0x7317('0x13')][_0x7317('0x12')]);}})[_0x7317('0x14')](function(_0x99230){logger[_0x7317('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x464341,_0x99230);_0x55be7b(_0x99230);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index cb3fcc8..545c146 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 _0xedd7=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/run','/:id/query','query','post'];(function(_0x522973,_0x2b18bf){var _0x654b1=function(_0x37e3cc){while(--_0x37e3cc){_0x522973['push'](_0x522973['shift']());}};_0x654b1(++_0x2b18bf);}(_0xedd7,0x18d));var _0x7edd=function(_0x419b7a,_0x299ca7){_0x419b7a=_0x419b7a-0x0;var _0x4e284d=_0xedd7[_0x419b7a];return _0x4e284d;};'use strict';var multer=require(_0x7edd('0x0'));var util=require('util');var path=require(_0x7edd('0x1'));var timeout=require(_0x7edd('0x2'));var express=require('express');var router=express[_0x7edd('0x3')]();var fs_extra=require(_0x7edd('0x4'));var auth=require(_0x7edd('0x5'));var interaction=require(_0x7edd('0x6'));var config=require(_0x7edd('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x7edd('0x8')]('/',auth[_0x7edd('0x9')](),controller[_0x7edd('0xa')]);router['get'](_0x7edd('0xb'),auth[_0x7edd('0x9')](),controller[_0x7edd('0xc')]);router[_0x7edd('0x8')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0x7edd('0x8')](_0x7edd('0xd'),auth[_0x7edd('0x9')](),controller['run']);router[_0x7edd('0x8')](_0x7edd('0xe'),auth[_0x7edd('0x9')](),controller[_0x7edd('0xf')]);router[_0x7edd('0x10')]('/',auth['isAuthenticated'](),controller[_0x7edd('0x11')]);router[_0x7edd('0x12')]('/:id',auth[_0x7edd('0x9')](),controller[_0x7edd('0x13')]);router[_0x7edd('0x14')]('/:id',auth[_0x7edd('0x9')](),controller[_0x7edd('0x15')]);module[_0x7edd('0x16')]=router; \ No newline at end of file +var _0xe6e4=['./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','post','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xe6e4,0xd4));var _0x4e6e=function(_0x91abdd,_0x4e7e7d){_0x91abdd=_0x91abdd-0x0;var _0x3779ad=_0xe6e4[_0x91abdd];return _0x3779ad;};'use strict';var multer=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var path=require('path');var timeout=require(_0x4e6e('0x2'));var express=require(_0x4e6e('0x3'));var router=express['Router']();var fs_extra=require(_0x4e6e('0x4'));var auth=require(_0x4e6e('0x5'));var interaction=require(_0x4e6e('0x6'));var config=require(_0x4e6e('0x7'));var controller=require(_0x4e6e('0x8'));router[_0x4e6e('0x9')]('/',auth[_0x4e6e('0xa')](),controller[_0x4e6e('0xb')]);router[_0x4e6e('0x9')](_0x4e6e('0xc'),auth[_0x4e6e('0xa')](),controller[_0x4e6e('0xd')]);router[_0x4e6e('0x9')](_0x4e6e('0xe'),auth[_0x4e6e('0xa')](),controller[_0x4e6e('0xf')]);router[_0x4e6e('0x9')]('/:id/run',auth[_0x4e6e('0xa')](),controller[_0x4e6e('0x10')]);router[_0x4e6e('0x9')]('/:id/query',auth[_0x4e6e('0xa')](),controller['query']);router[_0x4e6e('0x11')]('/',auth[_0x4e6e('0xa')](),controller['create']);router[_0x4e6e('0x12')](_0x4e6e('0xc'),auth['isAuthenticated'](),controller[_0x4e6e('0x13')]);router[_0x4e6e('0x14')]('/:id',auth[_0x4e6e('0xa')](),controller['destroy']);module[_0x4e6e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index b01e67a..21bb456 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 _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0xd7b26a,_0x1fc4a5){var _0x2a3ba5=function(_0x4230d9){while(--_0x4230d9){_0xd7b26a['push'](_0xd7b26a['shift']());}};_0x2a3ba5(++_0x1fc4a5);}(_0x98a8,0x12c));var _0x898a=function(_0x52c6e4,_0x2e9fcd){_0x52c6e4=_0x52c6e4-0x0;var _0x45fb80=_0x98a8[_0x52c6e4];return _0x45fb80;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x39d204,_0x1e3701){var _0x403637=function(_0x2c7d99){while(--_0x2c7d99){_0x39d204['push'](_0x39d204['shift']());}};_0x403637(++_0x1e3701);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x382dc2,_0x5aab53){_0x382dc2=_0x382dc2-0x0;var _0x3709b1=_0x9c5a[_0x382dc2];return _0x3709b1;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('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 484fdcf..ce03e72 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 _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x2fe787,_0x3b7876){var _0x51e71e=function(_0x371015){while(--_0x371015){_0x2fe787['push'](_0x2fe787['shift']());}};_0x51e71e(++_0x3b7876);}(_0x5fab,0x177));var _0xb5fa=function(_0x5923be,_0x3023ae){_0x5923be=_0x5923be-0x0;var _0x303700=_0x5fab[_0x5923be];return _0x303700;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file +var _0x1261=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','set','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','show','length','includeAll','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','AVG(%s)','DATE(%s)','value','keyBy','select','order','%s.%s\x20=\x20%s.%s','clone','web','fullPath','randomstring','generate','output','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','../../components/export/','savename','COUNT(*)','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Sequelize','debug'];(function(_0x3e267c,_0x2fcb4d){var _0x4abfeb=function(_0x33f95f){while(--_0x33f95f){_0x3e267c['push'](_0x3e267c['shift']());}};_0x4abfeb(++_0x2fcb4d);}(_0x1261,0x144));var _0x1126=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x1261[_0x7d62cb];return _0x3a6266;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var dbH=require(_0x1126('0x17'))[_0x1126('0x18')];function respondWithStatusCode(_0xca0355,_0x3f10e9){_0x3f10e9=_0x3f10e9||0xcc;return function(_0xd8ca42){if(_0xd8ca42){return _0xca0355[_0x1126('0x19')](_0x3f10e9);}return _0xca0355[_0x1126('0x1a')](_0x3f10e9)['end']();};}function respondWithResult(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xc8;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1a')](_0x1af673)['json'](_0x154e20);}};}function respondWithFilteredResult(_0x45149c,_0x4794a7){return function(_0x35fe9f){if(_0x35fe9f){var _0x42f379=typeof _0x4794a7[_0x1126('0x1b')]==='undefined'&&typeof _0x4794a7[_0x1126('0x1c')]===_0x1126('0x1d');var _0x4a7b49=_0x35fe9f['count'];var _0x22ae0b=_0x42f379?0x0:_0x4794a7[_0x1126('0x1b')];var _0x58d11a=_0x42f379?_0x35fe9f['count']:_0x4794a7[_0x1126('0x1b')]+_0x4794a7['limit'];var _0x22ed37;if(_0x58d11a>=_0x4a7b49){_0x58d11a=_0x4a7b49;_0x22ed37=0xc8;}else{_0x22ed37=0xce;}_0x45149c[_0x1126('0x1a')](_0x22ed37);return _0x45149c[_0x1126('0x1e')]('Content-Range',_0x22ae0b+'-'+_0x58d11a+'/'+_0x4a7b49)[_0x1126('0x1f')](_0x35fe9f);}return null;};}function patchUpdates(_0x49d209){return function(_0x56efeb){try{jsonpatch[_0x1126('0x20')](_0x56efeb,_0x49d209,!![]);}catch(_0x3a9bed){return BPromise[_0x1126('0x21')](_0x3a9bed);}return _0x56efeb[_0x1126('0x22')]();};}function saveUpdates(_0x526ca1,_0x29ab60){return function(_0x477e6a){if(_0x477e6a){return _0x477e6a['update'](_0x526ca1)[_0x1126('0x23')](function(_0x59cd8e){return _0x59cd8e;});}return null;};}function removeEntity(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x24')]()[_0x1126('0x23')](function(){var _0x34bcf1=_0x2199d9[_0x1126('0x25')]({'plain':!![]});var _0x1b07a7=_0x1126('0x26');return db[_0x1126('0x27')]['destroy']({'where':{'type':_0x1b07a7,'resourceId':_0x34bcf1['id']}})[_0x1126('0x23')](function(){return _0x2199d9;});})[_0x1126('0x23')](function(){_0x529dd9[_0x1126('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541bc9,_0xeb7d89){return function(_0x39bf0e){if(!_0x39bf0e){_0x541bc9['sendStatus'](0x194);}return _0x39bf0e;};}function handleError(_0x2fb797,_0x23d2bc){_0x23d2bc=_0x23d2bc||0x1f4;return function(_0x4a334a){logger[_0x1126('0x28')](_0x4a334a['stack']);if(_0x4a334a[_0x1126('0x29')]){delete _0x4a334a['name'];}_0x2fb797[_0x1126('0x1a')](_0x23d2bc)['send'](_0x4a334a);};}exports[_0x1126('0x2a')]=function(_0x5f2611,_0x5252e0){var _0x4a53ab={},_0x17646e={},_0xa8906d={'count':0x0,'rows':[]};var _0x1cef48=_['map'](db[_0x1126('0x2b')][_0x1126('0x2c')],function(_0x56f7f8){return{'name':_0x56f7f8[_0x1126('0x2d')],'type':_0x56f7f8[_0x1126('0x2e')][_0x1126('0x2f')]};});_0x17646e[_0x1126('0x30')]=_['map'](_0x1cef48,'name');_0x17646e[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5f2611[_0x1126('0x31')]);_0x17646e[_0x1126('0x33')]=_['intersection'](_0x17646e[_0x1126('0x30')],_0x17646e[_0x1126('0x31')]);_0x4a53ab[_0x1126('0x34')]=_[_0x1126('0x35')](_0x17646e[_0x1126('0x30')],qs['fields'](_0x5f2611[_0x1126('0x31')][_0x1126('0x36')]));_0x4a53ab[_0x1126('0x34')]=_0x4a53ab[_0x1126('0x34')]['length']?_0x4a53ab['attributes']:_0x17646e[_0x1126('0x30')];if(!_0x5f2611[_0x1126('0x31')]['hasOwnProperty'](_0x1126('0x37'))){_0x4a53ab[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x5f2611['query']['limit']);_0x4a53ab[_0x1126('0x1b')]=qs[_0x1126('0x1b')](_0x5f2611[_0x1126('0x31')][_0x1126('0x1b')]);}_0x4a53ab['order']=qs[_0x1126('0x38')](_0x5f2611['query'][_0x1126('0x38')]);_0x4a53ab[_0x1126('0x39')]=qs[_0x1126('0x33')](_[_0x1126('0x3a')](_0x5f2611[_0x1126('0x31')],_0x17646e['filters']),_0x1cef48);if(_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]){_0x4a53ab[_0x1126('0x39')]=_[_0x1126('0x3c')](_0x4a53ab[_0x1126('0x39')],{'$or':_[_0x1126('0x3d')](_0x1cef48,function(_0x3052f9){if(_0x3052f9['type']!==_0x1126('0x3e')){var _0x154c28={};_0x154c28[_0x3052f9[_0x1126('0x29')]]={'$like':'%'+_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]+'%'};return _0x154c28;}})});}_0x4a53ab=_['merge']({},_0x4a53ab,_0x5f2611['options']);var _0x1c4f06={'where':_0x4a53ab[_0x1126('0x39')]};return db[_0x1126('0x2b')][_0x1126('0x3f')](_0x1c4f06)[_0x1126('0x23')](function(_0x276fd5){_0xa8906d['count']=_0x276fd5;if(_0x5f2611['query']['includeAll']){_0x4a53ab[_0x1126('0x40')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x1126('0x41')](_0x4a53ab);})[_0x1126('0x23')](function(_0x3584a3){_0xa8906d[_0x1126('0x42')]=_0x3584a3;return _0xa8906d;})['then'](respondWithFilteredResult(_0x5252e0,_0x4a53ab))['catch'](handleError(_0x5252e0,null));};exports[_0x1126('0x43')]=function(_0xa93167,_0x1d63b9){var _0x5f5d3a={'raw':!![],'where':{'id':_0xa93167['params']['id']}},_0x2f8551={};_0x2f8551[_0x1126('0x30')]=_['keys'](db[_0x1126('0x2b')][_0x1126('0x2c')]);_0x2f8551[_0x1126('0x31')]=_['keys'](_0xa93167[_0x1126('0x31')]);_0x2f8551[_0x1126('0x33')]=_[_0x1126('0x35')](_0x2f8551['model'],_0x2f8551['query']);_0x5f5d3a['attributes']=_[_0x1126('0x35')](_0x2f8551['model'],qs[_0x1126('0x36')](_0xa93167['query'][_0x1126('0x36')]));_0x5f5d3a[_0x1126('0x34')]=_0x5f5d3a[_0x1126('0x34')][_0x1126('0x44')]?_0x5f5d3a[_0x1126('0x34')]:_0x2f8551['model'];if(_0xa93167[_0x1126('0x31')][_0x1126('0x45')]){_0x5f5d3a['include']=[{'all':!![]}];}_0x5f5d3a=_[_0x1126('0x3c')]({},_0x5f5d3a,_0xa93167[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x5f5d3a)[_0x1126('0x23')](handleEntityNotFound(_0x1d63b9,null))['then'](respondWithResult(_0x1d63b9,null))[_0x1126('0x48')](handleError(_0x1d63b9,null));};exports[_0x1126('0x49')]=function(_0x213a76,_0x59656d){return db[_0x1126('0x2b')][_0x1126('0x49')](_0x213a76[_0x1126('0x4a')],{})[_0x1126('0x23')](function(_0x224456){var _0x2081f2=_0x213a76[_0x1126('0x4b')][_0x1126('0x25')]({'plain':!![]});if(!_0x2081f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2081f2[_0x1126('0x4c')]==='user'){var _0x40168e=_0x224456[_0x1126('0x25')]({'plain':!![]});var _0x4a1831='Reports';return db[_0x1126('0x4d')][_0x1126('0x47')]({'where':{'name':_0x4a1831,'userProfileId':_0x2081f2[_0x1126('0x4e')]},'raw':!![]})['then'](function(_0x3cb44c){if(_0x3cb44c&&_0x3cb44c[_0x1126('0x4f')]===0x0){return db[_0x1126('0x27')][_0x1126('0x49')]({'name':_0x40168e['name'],'resourceId':_0x40168e['id'],'type':_0x1126('0x26'),'sectionId':_0x3cb44c['id']},{})[_0x1126('0x23')](function(){return _0x224456;});}else{return _0x224456;}})['catch'](function(_0x4bcc08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bcc08);throw _0x4bcc08;});}return _0x224456;})[_0x1126('0x23')](respondWithResult(_0x59656d,0xc9))[_0x1126('0x48')](handleError(_0x59656d,null));};exports['update']=function(_0x16552b,_0x1c7a2b){if(_0x16552b[_0x1126('0x4a')]['id']){delete _0x16552b[_0x1126('0x4a')]['id'];}return db[_0x1126('0x2b')]['find']({'where':{'id':_0x16552b[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x1c7a2b,null))['then'](saveUpdates(_0x16552b[_0x1126('0x4a')],null))[_0x1126('0x23')](respondWithResult(_0x1c7a2b,null))[_0x1126('0x48')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x24')]=function(_0xc8a0f,_0x59c3d0){return db[_0x1126('0x2b')]['find']({'where':{'id':_0xc8a0f[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x59c3d0,null))[_0x1126('0x23')](removeEntity(_0x59c3d0,null))['catch'](handleError(_0x59c3d0,null));};exports[_0x1126('0x51')]=function(_0x2340f8,_0x5763b4){var _0x30812d=0xa;var _0x25038f=[_0x1126('0x52'),'left_join',_0x1126('0x53'),_0x1126('0x54')];var _0x22ab18={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x2a5422={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':'DATE(%s)','HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3767e4=function(_0x5246aa){return!_[_0x1126('0x60')]([_0x1126('0x61'),'IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0x5246aa);};var _0x375b76=function(_0x592960){if(!_0x592960||!_0x592960[_0x1126('0x64')]['length']){return'';}for(var _0x558b6e='(',_0xbdc58=0x0;_0xbdc58<_0x592960[_0x1126('0x64')][_0x1126('0x44')];_0xbdc58+=0x1){_0xbdc58>0x0&&(_0x558b6e+='\x20'+_0x592960[_0x1126('0x65')]+'\x20');_0x558b6e+=_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x66')]?_0x375b76(_0x592960[_0x1126('0x64')][_0xbdc58]['group']):_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x67')]+'\x20'+_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')]+(_0x3767e4(_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')])?'\x20'+_0x592960['rules'][_0xbdc58]['value']:'');}return _0x558b6e+')';};var _0x16a343={'where':{'id':_0x2340f8[_0x1126('0x50')]['id']}},_0x3921c2,_0x4bf2b3,_0x5ee130,_0x5e9260,_0x51a28d;_0x16a343=_[_0x1126('0x3c')]({},_0x16a343,_0x2340f8[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x16a343)[_0x1126('0x23')](function(_0x170bf0){if(_0x170bf0){_0x3921c2=_0x170bf0;return _0x170bf0[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x3f007b){if(_0x3f007b){if(!_0x3f007b[_0x1126('0x44')]){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4bf2b3=_0x3f007b;return db[_0x1126('0x6c')][_0x1126('0x41')]({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x56c003){if(_0x56c003){_0x5ee130=_['keyBy'](_0x56c003,'id');var _0x15cf3d;var _0x2643d7=squel['select']();_0x2643d7[_0x1126('0x6d')](_0x3921c2[_0x1126('0x6e')]);for(var _0x366675=0x0;_0x366675<_0x4bf2b3[_0x1126('0x44')];_0x366675+=0x1){_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x6f')]?_0x5ee130[_0x4bf2b3[_0x366675][_0x1126('0x6f')]][_0x1126('0x70')]:_0x4bf2b3[_0x366675][_0x1126('0x67')];_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x71')]?_[_0x1126('0x72')](_0x22ab18[_0x4bf2b3[_0x366675][_0x1126('0x71')]],'%s',_0x15cf3d):_0x15cf3d;_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x73')]?_[_0x1126('0x72')](_0x2a5422[_0x4bf2b3[_0x366675]['format']],'%s',_0x15cf3d):_0x15cf3d;if(_0x4bf2b3[_0x366675][_0x1126('0x74')]){_0x2643d7[_0x1126('0x66')](_0x15cf3d);}_0x4bf2b3[_0x366675][_0x1126('0x75')]&&_0x2643d7['order'](_0x15cf3d,_0x4bf2b3[_0x366675]['orderBy']===_0x1126('0x76')?![]:!![]);_0x2643d7[_0x1126('0x67')](_0x15cf3d,_0x4bf2b3[_0x366675][_0x1126('0x77')]||_0x15cf3d);}if(_0x3921c2[_0x1126('0x78')]){_0x3921c2['joins']=JSON['parse'](_0x3921c2['joins']);for(var _0x79afca=0x0;_0x79afca<_0x3921c2[_0x1126('0x78')][_0x1126('0x44')];_0x79afca+=0x1){if(_0x3921c2[_0x1126('0x78')][_0x79afca]['type']&&_[_0x1126('0x60')](_0x25038f,_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')])&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x79')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7b')]){_0x2643d7[_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')]](_0x3921c2['joins'][_0x79afca][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x3921c2[_0x1126('0x6e')],_0x3921c2[_0x1126('0x78')][_0x79afca]['parentKey'],_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')],_0x3921c2['joins'][_0x79afca]['foreignKey']));}}}if(_0x3921c2[_0x1126('0x7c')]){_0x3921c2[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x3921c2['conditions']);_0x2643d7['where'](_0x375b76(_0x3921c2['conditions'][_0x1126('0x66')]));}_0x51a28d=_0x2643d7['clone']();_0x2643d7['limit'](_0x30812d);_0x2643d7[_0x1126('0x1b')](0x0);logger['debug'](_0x1126('0x7e'),_0x2643d7[_0x1126('0x7f')]());return dbH['sequelize'][_0x1126('0x31')](_0x2643d7[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](respondWithResult(_0x5763b4,null))[_0x1126('0x48')](handleError(_0x5763b4,null));};function runReport(_0x426faa,_0x5679ec,_0xd182b1){var _0x2d6fcf=_0x5679ec[_0x1126('0x29')];var _0x2af2d0=0xa;var _0x2598a7=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x9a2af0={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':_0x1126('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x33cccf={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':'HOUR(%s)','ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5bdb30=function(_0xb1199b){return!_[_0x1126('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0xb1199b);};var _0x228552=function(_0x1ee970){if(!_0x1ee970||!_0x1ee970[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x2d7150='(',_0x35a9a4=0x0;_0x35a9a4<_0x1ee970[_0x1126('0x64')]['length'];_0x35a9a4+=0x1){_0x35a9a4>0x0&&(_0x2d7150+='\x20'+_0x1ee970[_0x1126('0x65')]+'\x20');_0x2d7150+=_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]?_0x228552(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]):_0x1ee970[_0x1126('0x64')][_0x35a9a4]['field']+'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')]+(_0x5bdb30(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')])?'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x86')]:'');}return _0x2d7150+')';};var _0x2418ca={'where':{'id':_0x426faa['id']}},_0x2d2dfc,_0x38eac6,_0xc3503b,_0x5d6edb,_0x50238d;_0x2418ca=_[_0x1126('0x3c')]({},_0x2418ca,_0xd182b1);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x2418ca)['then'](function(_0x4461ae){if(_0x4461ae){_0x2d2dfc=_0x4461ae;return _0x4461ae['getFields']();}return null;})[_0x1126('0x23')](function(_0x4fbd44){if(_0x4fbd44){if(!_0x4fbd44['length']){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x38eac6=_0x4fbd44;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0xe2f82d){if(_0xe2f82d){_0xc3503b=_[_0x1126('0x87')](_0xe2f82d,'id');var _0x5dfb8f;var _0x48f914=squel[_0x1126('0x88')]();_0x48f914['from'](_0x2d2dfc[_0x1126('0x6e')]);for(var _0x39d9a0=0x0;_0x39d9a0<_0x38eac6[_0x1126('0x44')];_0x39d9a0+=0x1){_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x6f')]?_0xc3503b[_0x38eac6[_0x39d9a0][_0x1126('0x6f')]]['metric']:_0x38eac6[_0x39d9a0]['field'];_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x71')]?_[_0x1126('0x72')](_0x9a2af0[_0x38eac6[_0x39d9a0][_0x1126('0x71')]],'%s',_0x5dfb8f):_0x5dfb8f;_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x73')]?_[_0x1126('0x72')](_0x33cccf[_0x38eac6[_0x39d9a0][_0x1126('0x73')]],'%s',_0x5dfb8f):_0x5dfb8f;if(_0x38eac6[_0x39d9a0][_0x1126('0x74')]){_0x48f914[_0x1126('0x66')](_0x5dfb8f);}_0x38eac6[_0x39d9a0][_0x1126('0x75')]&&_0x48f914[_0x1126('0x89')](_0x5dfb8f,_0x38eac6[_0x39d9a0][_0x1126('0x75')]==='DESC'?![]:!![]);_0x48f914[_0x1126('0x67')](_0x5dfb8f,_0x38eac6[_0x39d9a0]['alias']||_0x5dfb8f);}if(_0x2d2dfc[_0x1126('0x78')]){_0x2d2dfc['joins']=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x78')]);for(var _0x215d4d=0x0;_0x215d4d<_0x2d2dfc[_0x1126('0x78')]['length'];_0x215d4d+=0x1){if(_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x2e')]&&_['includes'](_0x2598a7,_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x2e')])&&_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x79')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7a')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7b')]){_0x48f914[_0x2d2dfc[_0x1126('0x78')][_0x215d4d]['type']](_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],null,util[_0x1126('0x73')](_0x1126('0x8a'),_0x2d2dfc[_0x1126('0x6e')],_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x79')],_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],_0x2d2dfc['joins'][_0x215d4d]['foreignKey']));}}}if(_0x2d2dfc['conditions']){_0x2d2dfc[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x7c')]);_0x48f914[_0x1126('0x39')](_0x228552(_0x2d2dfc['conditions'][_0x1126('0x66')]));}_0x50238d=_0x48f914[_0x1126('0x8b')]();_0x48f914[_0x1126('0x1c')](_0x2af2d0);_0x48f914[_0x1126('0x1b')](0x0);return;}})[_0x1126('0x23')](function(){if(_0x5679ec['output']===_0x1126('0x8c')){return null;}var _0x21c487=_['merge'](_0x5679ec,{'name':_0x5679ec[_0x1126('0x8d')]||_0x5679ec['name']||_0x2d2dfc['name'],'basename':_0x2d6fcf,'savename':util[_0x1126('0x73')]('%s-%s.%s',_0x5679ec[_0x1126('0x29')]||_0x2d2dfc[_0x1126('0x29')],require(_0x1126('0x8e'))[_0x1126('0x8f')](0x4),_0x5679ec[_0x1126('0x90')]||_0x1126('0x91')),'reportId':_0x2d2dfc['id'],'reportType':_0x1126('0x92')});return db[_0x1126('0x93')][_0x1126('0x49')](_0x21c487,{'raw':!![]});})['then'](function(_0x2577f5){if(_0x2d2dfc[_0x1126('0x6e')]===_0x1126('0x94')){_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+_0x1126('0x95'),_0x5679ec[_0x1126('0x96')],_0x5679ec[_0x1126('0x97')]);}else{_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5679ec['startDate'],_0x5679ec[_0x1126('0x97')]);}if(_0x2577f5){logger['info'](_0x1126('0x98'),_0x50238d[_0x1126('0x7f')]());require('child_process')['fork'](path[_0x1126('0x52')](__dirname,_0x1126('0x99'),_0x2577f5['output']),[_0x2577f5['id'],_0x50238d[_0x1126('0x7f')](),path[_0x1126('0x52')](__dirname,'../../files/reports',_0x2577f5[_0x1126('0x9a')]),_0x2d6fcf]);return _0x2577f5;}else{var _0x4a9941=squel[_0x1126('0x88')]();_0x4a9941[_0x1126('0x6d')]('('+_0x50238d[_0x1126('0x7f')]()+')','countTable');_0x4a9941[_0x1126('0x67')](_0x1126('0x9b'),_0x1126('0x3f'));_0x50238d[_0x1126('0x1c')](_0x5679ec[_0x1126('0x1c')]||_0x2af2d0);_0x50238d[_0x1126('0x1b')](_0x5679ec[_0x1126('0x1b')]||0x0);return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x4a9941[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]})[_0x1126('0x23')](function(_0x12ffa5){if(!_0x12ffa5[_0x1126('0x44')]){_0x5d6edb=0x0;}else{_0x5d6edb=_0x12ffa5[0x0][_0x1126('0x3f')]||0x0;}return dbH['sequelize'][_0x1126('0x31')](_0x50238d[_0x1126('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x82')]});})[_0x1126('0x23')](function(_0x35065c){return{'rows':_0x35065c||[],'count':_0x5d6edb};});}});}exports[_0x1126('0x9c')]=function(_0x5c0215,_0x444f94){return runReport(_0x5c0215[_0x1126('0x50')],_0x5c0215['query'],_0x5c0215[_0x1126('0x46')])['then'](respondWithResult(_0x444f94,null))[_0x1126('0x48')](handleError(_0x444f94,null));};exports[_0x1126('0x9d')]=runReport;exports['query']=function(_0x4d43ad,_0xa02d9e){var _0x548f9e=0xa;var _0x5edb83=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x4f29ce={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':'MIN(%s)','AVG':_0x1126('0x84'),'GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x17b25d={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':_0x1126('0x9e')};var _0x3a4a91=function(_0x55145f){return!_[_0x1126('0x60')](['IS\x20NULL',_0x1126('0x9f'),_0x1126('0x62'),_0x1126('0x63')],_0x55145f);};var _0x4c7dc7=function(_0x33a27b){if(!_0x33a27b||!_0x33a27b[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x578c1b='(',_0x1562b2=0x0;_0x1562b2<_0x33a27b[_0x1126('0x64')][_0x1126('0x44')];_0x1562b2+=0x1){_0x1562b2>0x0&&(_0x578c1b+='\x20'+_0x33a27b[_0x1126('0x65')]+'\x20');_0x578c1b+=_0x33a27b[_0x1126('0x64')][_0x1562b2]['group']?_0x4c7dc7(_0x33a27b['rules'][_0x1562b2][_0x1126('0x66')]):_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x67')]+'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')]+(_0x3a4a91(_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')])?'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x86')]:'');}return _0x578c1b+')';};var _0x2fb228={'where':{'id':_0x4d43ad[_0x1126('0x50')]['id']}},_0x2c95b6,_0x4a4b43,_0x588f4f,_0x5ac4d6,_0x1168a5;_0x2fb228=_['merge']({},_0x2fb228,_0x4d43ad['options']);return db[_0x1126('0x2b')][_0x1126('0x47')](_0x2fb228)[_0x1126('0x23')](function(_0x48b088){if(_0x48b088){_0x2c95b6=_0x48b088;return _0x48b088[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x5a28f9){if(_0x5a28f9){if(!_0x5a28f9[_0x1126('0x44')]){throw new db[(_0x1126('0xa0'))][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4a4b43=_0x5a28f9;return db[_0x1126('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x1140ec){if(_0x1140ec){_0x588f4f=_['keyBy'](_0x1140ec,'id');var _0x578f5c;var _0x559dae=squel[_0x1126('0x88')]();_0x559dae[_0x1126('0x6d')](_0x2c95b6[_0x1126('0x6e')]);for(var _0x9d7819=0x0;_0x9d7819<_0x4a4b43[_0x1126('0x44')];_0x9d7819+=0x1){_0x578f5c=_0x4a4b43[_0x9d7819]['MetricId']?_0x588f4f[_0x4a4b43[_0x9d7819][_0x1126('0x6f')]]['metric']:_0x4a4b43[_0x9d7819][_0x1126('0x67')];_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x71')]?_['replace'](_0x4f29ce[_0x4a4b43[_0x9d7819]['function']],'%s',_0x578f5c):_0x578f5c;_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x73')]?_[_0x1126('0x72')](_0x17b25d[_0x4a4b43[_0x9d7819]['format']],'%s',_0x578f5c):_0x578f5c;if(_0x4a4b43[_0x9d7819]['groupBy']){_0x559dae[_0x1126('0x66')](_0x578f5c);}_0x4a4b43[_0x9d7819][_0x1126('0x75')]&&_0x559dae[_0x1126('0x89')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x75')]===_0x1126('0x76')?![]:!![]);_0x559dae[_0x1126('0x67')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x77')]||_0x578f5c);}if(_0x2c95b6[_0x1126('0x78')]){_0x2c95b6[_0x1126('0x78')]=JSON[_0x1126('0x7d')](_0x2c95b6['joins']);for(var _0x4d6528=0x0;_0x4d6528<_0x2c95b6[_0x1126('0x78')][_0x1126('0x44')];_0x4d6528+=0x1){if(_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x2e')]&&_[_0x1126('0x60')](_0x5edb83,_0x2c95b6[_0x1126('0x78')][_0x4d6528]['type'])&&_0x2c95b6['joins'][_0x4d6528][_0x1126('0x79')]&&_0x2c95b6['joins'][_0x4d6528]['foreignTable']&&_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]){_0x559dae[_0x2c95b6['joins'][_0x4d6528][_0x1126('0x2e')]](_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x2c95b6[_0x1126('0x6e')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x79')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]));}}}if(_0x2c95b6['conditions']){_0x2c95b6[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2c95b6[_0x1126('0x7c')]);_0x559dae[_0x1126('0x39')](_0x4c7dc7(_0x2c95b6['conditions'][_0x1126('0x66')]));}_0x1168a5=_0x559dae[_0x1126('0x8b')]();_0x559dae['limit'](_0x548f9e);_0x559dae[_0x1126('0x1b')](0x0);logger[_0x1126('0xa1')](_0x1126('0x7e'),_0x559dae['toString']());return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x559dae[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](function(){return{'sql':_0x1168a5[_0x1126('0x7f')]()};})[_0x1126('0x23')](respondWithResult(_0xa02d9e,null))['catch'](handleError(_0xa02d9e,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 74ecd5f..45706f3 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 _0x5aa5=['../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2feaad,_0x1aa6fc){var _0x5514bd=function(_0x4f3a47){while(--_0x4f3a47){_0x2feaad['push'](_0x2feaad['shift']());}};_0x5514bd(++_0x1aa6fc);}(_0x5aa5,0xef));var _0x55aa=function(_0x4c400b,_0x5c2340){_0x4c400b=_0x4c400b-0x0;var _0x41859c=_0x5aa5[_0x4c400b];return _0x41859c;};'use strict';var _=require(_0x55aa('0x0'));var util=require(_0x55aa('0x1'));var logger=require(_0x55aa('0x2'))(_0x55aa('0x3'));var moment=require(_0x55aa('0x4'));var BPromise=require(_0x55aa('0x5'));var rp=require(_0x55aa('0x6'));var fs=require('fs');var path=require(_0x55aa('0x7'));var rimraf=require('rimraf');var config=require(_0x55aa('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x55aa('0x9')]=function(_0x5afc88,_0x568d1b){return _0x5afc88[_0x55aa('0xa')](_0x55aa('0xb'),attributes,{'tableName':_0x55aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0cd=['AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe0cd,0x70));var _0xde0c=function(_0x258fc1,_0xb5ef7d){_0x258fc1=_0x258fc1-0x0;var _0xf89303=_0xe0cd[_0x258fc1];return _0xf89303;};'use strict';var _=require('lodash');var util=require(_0xde0c('0x0'));var logger=require(_0xde0c('0x1'))(_0xde0c('0x2'));var moment=require(_0xde0c('0x3'));var BPromise=require(_0xde0c('0x4'));var rp=require(_0xde0c('0x5'));var fs=require('fs');var path=require(_0xde0c('0x6'));var rimraf=require('rimraf');var config=require(_0xde0c('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0xde0c('0x8')]=function(_0xba21fb,_0x1e112b){return _0xba21fb['define'](_0xde0c('0x9'),attributes,{'tableName':_0xde0c('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 1eaff99..e205362 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 _0x9648=['request\x20sent','stringify','code','error','AnalyticDefaultReport,\x20%s,\x20%s','message','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug'];(function(_0x43fa9c,_0x3f1469){var _0x596325=function(_0x5e2595){while(--_0x5e2595){_0x43fa9c['push'](_0x43fa9c['shift']());}};_0x596325(++_0x3f1469);}(_0x9648,0x196));var _0x8964=function(_0x2d665b,_0x522197){_0x2d665b=_0x2d665b-0x0;var _0x1d54c4=_0x9648[_0x2d665b];return _0x1d54c4;};'use strict';var _=require(_0x8964('0x0'));var util=require(_0x8964('0x1'));var moment=require(_0x8964('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8964('0x3'));var db=require(_0x8964('0x4'))['db'];var utils=require(_0x8964('0x5'));var logger=require('../../config/logger')(_0x8964('0x6'));var config=require(_0x8964('0x7'));var jayson=require(_0x8964('0x8'));var client=jayson[_0x8964('0x9')][_0x8964('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57b62d,_0x2d9575,_0x2656c2){return new BPromise(function(_0x1bc0e5,_0xaafa59){return client[_0x8964('0xb')](_0x57b62d,_0x2656c2)['then'](function(_0x51b9fa){logger[_0x8964('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2d9575,'request\x20sent');logger[_0x8964('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2d9575,_0x8964('0xe'),JSON[_0x8964('0xf')](_0x51b9fa));if(_0x51b9fa['error']){if(_0x51b9fa['error'][_0x8964('0x10')]===0x1f4){logger[_0x8964('0x11')](_0x8964('0x12'),_0x2d9575,_0x51b9fa[_0x8964('0x11')][_0x8964('0x13')]);return _0xaafa59(_0x51b9fa[_0x8964('0x11')][_0x8964('0x13')]);}logger['error'](_0x8964('0x12'),_0x2d9575,_0x51b9fa[_0x8964('0x11')][_0x8964('0x13')]);return _0x1bc0e5(_0x51b9fa[_0x8964('0x11')][_0x8964('0x13')]);}else{logger[_0x8964('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2d9575,_0x8964('0xe'));_0x1bc0e5(_0x51b9fa['result'][_0x8964('0x13')]);}})['catch'](function(_0x356645){logger[_0x8964('0x11')](_0x8964('0x12'),_0x2d9575,_0x356645);_0xaafa59(_0x356645);});});} \ No newline at end of file +var _0x062c=['rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1f3a66,_0x308264){var _0x1b5378=function(_0x29e48c){while(--_0x29e48c){_0x1f3a66['push'](_0x1f3a66['shift']());}};_0x1b5378(++_0x308264);}(_0x062c,0x1b2));var _0xc062=function(_0x4815ca,_0x51c4a9){_0x4815ca=_0x4815ca-0x0;var _0x26a1b1=_0x062c[_0x4815ca];return _0x26a1b1;};'use strict';var _=require(_0xc062('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc062('0x1'));var fs=require('fs');var Redis=require(_0xc062('0x2'));var db=require(_0xc062('0x3'))['db'];var utils=require(_0xc062('0x4'));var logger=require(_0xc062('0x5'))(_0xc062('0x6'));var config=require('../../config/environment');var jayson=require(_0xc062('0x7'));var client=jayson[_0xc062('0x8')][_0xc062('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x313073,_0x84a8d9,_0x491b89){return new BPromise(function(_0x4d8a35,_0x2bdbe6){return client[_0xc062('0xa')](_0x313073,_0x491b89)[_0xc062('0xb')](function(_0x3e4ccf){logger[_0xc062('0xc')](_0xc062('0xd'),_0x84a8d9,_0xc062('0xe'));logger[_0xc062('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x84a8d9,'request\x20sent',JSON[_0xc062('0x10')](_0x3e4ccf));if(_0x3e4ccf['error']){if(_0x3e4ccf[_0xc062('0x11')][_0xc062('0x12')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x84a8d9,_0x3e4ccf[_0xc062('0x11')][_0xc062('0x13')]);return _0x2bdbe6(_0x3e4ccf[_0xc062('0x11')]['message']);}logger[_0xc062('0x11')](_0xc062('0xd'),_0x84a8d9,_0x3e4ccf['error'][_0xc062('0x13')]);return _0x4d8a35(_0x3e4ccf[_0xc062('0x11')][_0xc062('0x13')]);}else{logger[_0xc062('0xc')](_0xc062('0xd'),_0x84a8d9,_0xc062('0xe'));_0x4d8a35(_0x3e4ccf[_0xc062('0x14')][_0xc062('0x13')]);}})[_0xc062('0x15')](function(_0x282676){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x84a8d9,_0x282676);_0x2bdbe6(_0x282676);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 7950ea8..1b56b29 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 _0x2010=['fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x4286b7,_0x2fdb8e){var _0x597fd1=function(_0x220ea3){while(--_0x220ea3){_0x4286b7['push'](_0x4286b7['shift']());}};_0x597fd1(++_0x2fdb8e);}(_0x2010,0x124));var _0x0201=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2010[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0201('0x0'));var util=require(_0x0201('0x1'));var path=require('path');var timeout=require(_0x0201('0x2'));var express=require(_0x0201('0x3'));var router=express[_0x0201('0x4')]();var fs_extra=require(_0x0201('0x5'));var auth=require(_0x0201('0x6'));var interaction=require(_0x0201('0x7'));var config=require('../../config/environment');var controller=require(_0x0201('0x8'));router[_0x0201('0x9')]('/',auth[_0x0201('0xa')](),controller[_0x0201('0xb')]);router[_0x0201('0x9')](_0x0201('0xc'),auth[_0x0201('0xa')](),controller[_0x0201('0xd')]);router[_0x0201('0x9')](_0x0201('0xe'),auth['isAuthenticated'](),controller[_0x0201('0xf')]);router[_0x0201('0x9')](_0x0201('0x10'),auth[_0x0201('0xa')](),controller[_0x0201('0x11')]);router[_0x0201('0x9')](_0x0201('0x12'),auth[_0x0201('0xa')](),controller[_0x0201('0x13')]);router[_0x0201('0x14')]('/',auth[_0x0201('0xa')](),controller[_0x0201('0x15')]);router[_0x0201('0x16')](_0x0201('0xc'),auth[_0x0201('0xa')](),controller[_0x0201('0x17')]);router[_0x0201('0x18')](_0x0201('0xc'),auth[_0x0201('0xa')](),controller[_0x0201('0x19')]);module[_0x0201('0x1a')]=router; \ No newline at end of file +var _0x1f24=['delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','create','update'];(function(_0x2c568b,_0x473d1e){var _0x24cbf8=function(_0x3df2fa){while(--_0x3df2fa){_0x2c568b['push'](_0x2c568b['shift']());}};_0x24cbf8(++_0x473d1e);}(_0x1f24,0x11a));var _0x41f2=function(_0x24e79c,_0x90e9e){_0x24e79c=_0x24e79c-0x0;var _0x4c7209=_0x1f24[_0x24e79c];return _0x4c7209;};'use strict';var multer=require(_0x41f2('0x0'));var util=require(_0x41f2('0x1'));var path=require('path');var timeout=require(_0x41f2('0x2'));var express=require(_0x41f2('0x3'));var router=express['Router']();var fs_extra=require(_0x41f2('0x4'));var auth=require(_0x41f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x41f2('0x6'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x41f2('0x7')](),controller[_0x41f2('0x8')]);router[_0x41f2('0x9')](_0x41f2('0xa'),auth['isAuthenticated'](),controller[_0x41f2('0xb')]);router[_0x41f2('0x9')](_0x41f2('0xc'),auth[_0x41f2('0x7')](),controller[_0x41f2('0xd')]);router['get'](_0x41f2('0xe'),auth[_0x41f2('0x7')](),controller[_0x41f2('0xf')]);router[_0x41f2('0x9')]('/:id/query',auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0x41f2('0x7')](),controller[_0x41f2('0x10')]);router['put'](_0x41f2('0xa'),auth['isAuthenticated'](),controller[_0x41f2('0x11')]);router[_0x41f2('0x12')](_0x41f2('0xa'),auth[_0x41f2('0x7')](),controller[_0x41f2('0x13')]);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 f798cce..faf3a66 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 _0x6242=['scheduled','manual','UNSIGNED','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0x6242,0x11b));var _0x2624=function(_0x530fbf,_0x5d0b13){_0x530fbf=_0x530fbf-0x0;var _0x32dcaf=_0x6242[_0x530fbf];return _0x32dcaf;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x2624('0x0')],'allowNull':![]},'basename':{'type':Sequelize[_0x2624('0x0')],'allowNull':![]},'output':{'type':Sequelize[_0x2624('0x1')](_0x2624('0x2'),_0x2624('0x3'),_0x2624('0x4')),'allowNull':![],'defaultValue':_0x2624('0x2')},'savename':{'type':Sequelize[_0x2624('0x0')],'allowNull':![]},'startDate':{'type':Sequelize[_0x2624('0x5')]},'endDate':{'type':Sequelize[_0x2624('0x5')]},'status':{'type':Sequelize[_0x2624('0x0')],'defaultValue':_0x2624('0x6')},'type':{'type':Sequelize['ENUM']('manual',_0x2624('0x7')),'allowNull':![],'defaultValue':_0x2624('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x2624('0x9')]},'reportType':{'type':Sequelize[_0x2624('0x0')]}}; \ No newline at end of file +var _0x7d27=['csv','DATE','Loading','ENUM','manual','exports','STRING','pdf'];(function(_0x598e09,_0x96d669){var _0x9c89e6=function(_0x30edd9){while(--_0x30edd9){_0x598e09['push'](_0x598e09['shift']());}};_0x9c89e6(++_0x96d669);}(_0x7d27,0x1cd));var _0x77d2=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7d27[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x77d2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x77d2('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x77d2('0x2'),'xlsx'),'allowNull':![],'defaultValue':_0x77d2('0x3')},'savename':{'type':Sequelize[_0x77d2('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x77d2('0x4')]},'endDate':{'type':Sequelize[_0x77d2('0x4')]},'status':{'type':Sequelize[_0x77d2('0x1')],'defaultValue':_0x77d2('0x5')},'type':{'type':Sequelize[_0x77d2('0x6')](_0x77d2('0x7'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index acf9484..2ff1e12 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 _0x3d66=['offset','Content-Range','json','apply','save','update','get','ExtractedReports','UserProfileResource','destroy','then','stack','name','send','AnalyticExtractedReport','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','savename','output','existsSync','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','server/files/reports','%s.%s','basename','toLowerCase','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','limit','undefined','count'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x3d66,0x153));var _0x63d6=function(_0x4f0c25,_0x4e3d94){_0x4f0c25=_0x4f0c25-0x0;var _0xca181c=_0x3d66[_0x4f0c25];return _0xca181c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x63d6('0x0'));var jsonpatch=require(_0x63d6('0x1'));var rp=require(_0x63d6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x63d6('0x3'));var util=require(_0x63d6('0x4'));var path=require(_0x63d6('0x5'));var sox=require('sox');var csv=require(_0x63d6('0x6'));var ejs=require(_0x63d6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x63d6('0x8'));var squel=require(_0x63d6('0x9'));var crypto=require('crypto');var jsforce=require(_0x63d6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x63d6('0x6'));var querystring=require('querystring');var Papa=require(_0x63d6('0xb'));var Redis=require(_0x63d6('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x63d6('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63d6('0xe'));var logger=require(_0x63d6('0xf'))(_0x63d6('0x10'));var utils=require(_0x63d6('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x63d6('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13f5c6,_0x24c8a9){_0x24c8a9=_0x24c8a9||0xcc;return function(_0x30d14c){if(_0x30d14c){return _0x13f5c6[_0x63d6('0x13')](_0x24c8a9);}return _0x13f5c6['status'](_0x24c8a9)[_0x63d6('0x14')]();};}function respondWithResult(_0x56c8cc,_0x352c3b){_0x352c3b=_0x352c3b||0xc8;return function(_0x375bc9){if(_0x375bc9){return _0x56c8cc[_0x63d6('0x15')](_0x352c3b)['json'](_0x375bc9);}};}function respondWithFilteredResult(_0x4be1a2,_0x494e61){return function(_0x8d52e6){if(_0x8d52e6){var _0x38ed9d=typeof _0x494e61['offset']==='undefined'&&typeof _0x494e61[_0x63d6('0x16')]===_0x63d6('0x17');var _0x4df6fc=_0x8d52e6[_0x63d6('0x18')];var _0xfd5d66=_0x38ed9d?0x0:_0x494e61[_0x63d6('0x19')];var _0x4a1672=_0x38ed9d?_0x8d52e6['count']:_0x494e61[_0x63d6('0x19')]+_0x494e61[_0x63d6('0x16')];var _0x45aa55;if(_0x4a1672>=_0x4df6fc){_0x4a1672=_0x4df6fc;_0x45aa55=0xc8;}else{_0x45aa55=0xce;}_0x4be1a2[_0x63d6('0x15')](_0x45aa55);return _0x4be1a2['set'](_0x63d6('0x1a'),_0xfd5d66+'-'+_0x4a1672+'/'+_0x4df6fc)[_0x63d6('0x1b')](_0x8d52e6);}return null;};}function patchUpdates(_0x40c376){return function(_0x39595f){try{jsonpatch[_0x63d6('0x1c')](_0x39595f,_0x40c376,!![]);}catch(_0x2eb78d){return BPromise['reject'](_0x2eb78d);}return _0x39595f[_0x63d6('0x1d')]();};}function saveUpdates(_0x1730e2,_0x34a60b){return function(_0x12585d){if(_0x12585d){return _0x12585d[_0x63d6('0x1e')](_0x1730e2)['then'](function(_0x151e17){return _0x151e17;});}return null;};}function removeEntity(_0x5b5fb4,_0x13a415){return function(_0x5c598a){if(_0x5c598a){return _0x5c598a['destroy']()['then'](function(){var _0x549f29=_0x5c598a[_0x63d6('0x1f')]({'plain':!![]});var _0xcb5c0e=_0x63d6('0x20');return db[_0x63d6('0x21')][_0x63d6('0x22')]({'where':{'type':_0xcb5c0e,'resourceId':_0x549f29['id']}})[_0x63d6('0x23')](function(){return _0x5c598a;});})['then'](function(){_0x5b5fb4[_0x63d6('0x15')](0xcc)[_0x63d6('0x14')]();});}};}function handleEntityNotFound(_0x86e189,_0x1ebddf){return function(_0x489a80){if(!_0x489a80){_0x86e189[_0x63d6('0x13')](0x194);}return _0x489a80;};}function handleError(_0x3ce2b0,_0x3002be){_0x3002be=_0x3002be||0x1f4;return function(_0x40aced){logger['error'](_0x40aced[_0x63d6('0x24')]);if(_0x40aced[_0x63d6('0x25')]){delete _0x40aced[_0x63d6('0x25')];}_0x3ce2b0[_0x63d6('0x15')](_0x3002be)[_0x63d6('0x26')](_0x40aced);};}exports['index']=function(_0x52a380,_0x116128){var _0x186e5c={},_0x18e10c={},_0x7aca2d={'count':0x0,'rows':[]};var _0x4414c8=_['map'](db[_0x63d6('0x27')][_0x63d6('0x28')],function(_0x3942a2){return{'name':_0x3942a2['fieldName'],'type':_0x3942a2[_0x63d6('0x29')][_0x63d6('0x2a')]};});_0x18e10c[_0x63d6('0x2b')]=_[_0x63d6('0x2c')](_0x4414c8,'name');_0x18e10c[_0x63d6('0x2d')]=_['keys'](_0x52a380[_0x63d6('0x2d')]);_0x18e10c[_0x63d6('0x2e')]=_[_0x63d6('0x2f')](_0x18e10c[_0x63d6('0x2b')],_0x18e10c[_0x63d6('0x2d')]);_0x186e5c[_0x63d6('0x30')]=_[_0x63d6('0x2f')](_0x18e10c[_0x63d6('0x2b')],qs[_0x63d6('0x31')](_0x52a380[_0x63d6('0x2d')][_0x63d6('0x31')]));_0x186e5c[_0x63d6('0x30')]=_0x186e5c['attributes'][_0x63d6('0x32')]?_0x186e5c[_0x63d6('0x30')]:_0x18e10c[_0x63d6('0x2b')];if(!_0x52a380[_0x63d6('0x2d')][_0x63d6('0x33')](_0x63d6('0x34'))){_0x186e5c[_0x63d6('0x16')]=qs[_0x63d6('0x16')](_0x52a380[_0x63d6('0x2d')]['limit']);_0x186e5c[_0x63d6('0x19')]=qs[_0x63d6('0x19')](_0x52a380[_0x63d6('0x2d')][_0x63d6('0x19')]);}_0x186e5c[_0x63d6('0x35')]=qs['sort'](_0x52a380[_0x63d6('0x2d')][_0x63d6('0x36')]);_0x186e5c[_0x63d6('0x37')]=qs[_0x63d6('0x2e')](_[_0x63d6('0x38')](_0x52a380[_0x63d6('0x2d')],_0x18e10c['filters']),_0x4414c8);if(_0x52a380['query'][_0x63d6('0x39')]){_0x186e5c['where']=_[_0x63d6('0x3a')](_0x186e5c[_0x63d6('0x37')],{'$or':_['map'](_0x4414c8,function(_0x30cc20){if(_0x30cc20[_0x63d6('0x29')]!==_0x63d6('0x3b')){var _0x3329f8={};_0x3329f8[_0x30cc20[_0x63d6('0x25')]]={'$like':'%'+_0x52a380[_0x63d6('0x2d')][_0x63d6('0x39')]+'%'};return _0x3329f8;}})});}_0x186e5c=_[_0x63d6('0x3a')]({},_0x186e5c,_0x52a380[_0x63d6('0x3c')]);var _0x304d60={'where':_0x186e5c[_0x63d6('0x37')]};return db[_0x63d6('0x27')][_0x63d6('0x18')](_0x304d60)['then'](function(_0x3a95cc){_0x7aca2d[_0x63d6('0x18')]=_0x3a95cc;if(_0x52a380[_0x63d6('0x2d')]['includeAll']){_0x186e5c[_0x63d6('0x3d')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x63d6('0x3e')](_0x186e5c);})['then'](function(_0x2cb60b){_0x7aca2d[_0x63d6('0x3f')]=_0x2cb60b;return _0x7aca2d;})[_0x63d6('0x23')](respondWithFilteredResult(_0x116128,_0x186e5c))[_0x63d6('0x40')](handleError(_0x116128,null));};exports[_0x63d6('0x41')]=function(_0x8ace88,_0x599c0f){var _0x256e60={'raw':!![],'where':{'id':_0x8ace88[_0x63d6('0x42')]['id']}},_0x16e453={};_0x16e453[_0x63d6('0x2b')]=_[_0x63d6('0x43')](db['AnalyticExtractedReport']['rawAttributes']);_0x16e453['query']=_[_0x63d6('0x43')](_0x8ace88['query']);_0x16e453[_0x63d6('0x2e')]=_['intersection'](_0x16e453[_0x63d6('0x2b')],_0x16e453[_0x63d6('0x2d')]);_0x256e60['attributes']=_[_0x63d6('0x2f')](_0x16e453['model'],qs[_0x63d6('0x31')](_0x8ace88[_0x63d6('0x2d')][_0x63d6('0x31')]));_0x256e60[_0x63d6('0x30')]=_0x256e60[_0x63d6('0x30')][_0x63d6('0x32')]?_0x256e60[_0x63d6('0x30')]:_0x16e453[_0x63d6('0x2b')];if(_0x8ace88[_0x63d6('0x2d')][_0x63d6('0x44')]){_0x256e60[_0x63d6('0x3d')]=[{'all':!![]}];}_0x256e60=_[_0x63d6('0x3a')]({},_0x256e60,_0x8ace88[_0x63d6('0x3c')]);return db['AnalyticExtractedReport'][_0x63d6('0x45')](_0x256e60)['then'](handleEntityNotFound(_0x599c0f,null))[_0x63d6('0x23')](respondWithResult(_0x599c0f,null))[_0x63d6('0x40')](handleError(_0x599c0f,null));};exports[_0x63d6('0x46')]=function(_0x295134,_0x196354){return db[_0x63d6('0x27')][_0x63d6('0x46')](_0x295134[_0x63d6('0x47')],{})[_0x63d6('0x23')](function(_0x269fe2){var _0x2c421e=_0x295134['user'][_0x63d6('0x1f')]({'plain':!![]});if(!_0x2c421e)throw new Error(_0x63d6('0x48'));if(_0x2c421e[_0x63d6('0x49')]===_0x63d6('0x4a')){var _0x1f1801=_0x269fe2[_0x63d6('0x1f')]({'plain':!![]});var _0x285df6=_0x63d6('0x20');return db['UserProfileSection'][_0x63d6('0x45')]({'where':{'name':_0x285df6,'userProfileId':_0x2c421e[_0x63d6('0x4b')]},'raw':!![]})[_0x63d6('0x23')](function(_0x3a144f){if(_0x3a144f&&_0x3a144f[_0x63d6('0x4c')]===0x0){return db[_0x63d6('0x21')]['create']({'name':_0x1f1801['name'],'resourceId':_0x1f1801['id'],'type':_0x3a144f[_0x63d6('0x25')],'sectionId':_0x3a144f['id']},{})['then'](function(){return _0x269fe2;});}else{return _0x269fe2;}})['catch'](function(_0x273c35){logger[_0x63d6('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x273c35);throw _0x273c35;});}return _0x269fe2;})[_0x63d6('0x23')](respondWithResult(_0x196354,0xc9))[_0x63d6('0x40')](handleError(_0x196354,null));};exports[_0x63d6('0x1e')]=function(_0x39dc3c,_0xb2560){if(_0x39dc3c[_0x63d6('0x47')]['id']){delete _0x39dc3c['body']['id'];}return db[_0x63d6('0x27')]['find']({'where':{'id':_0x39dc3c['params']['id']}})[_0x63d6('0x23')](handleEntityNotFound(_0xb2560,null))['then'](saveUpdates(_0x39dc3c[_0x63d6('0x47')],null))['then'](respondWithResult(_0xb2560,null))[_0x63d6('0x40')](handleError(_0xb2560,null));};exports['destroy']=function(_0x33d053,_0x47d727){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x33d053[_0x63d6('0x42')]['id']}})['then'](handleEntityNotFound(_0x47d727,null))['then'](removeEntity(_0x47d727,null))[_0x63d6('0x40')](handleError(_0x47d727,null));};exports['download']=function(_0x5a150d,_0x33c0d4,_0x5c8550){return db[_0x63d6('0x27')][_0x63d6('0x45')]({'where':{'id':_0x5a150d[_0x63d6('0x42')]['id']},'attributes':[_0x63d6('0x25'),'basename',_0x63d6('0x4e'),_0x63d6('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x33c0d4,null))[_0x63d6('0x23')](function(_0x17077c){if(_0x17077c){if(!fs[_0x63d6('0x50')](path[_0x63d6('0x51')](config[_0x63d6('0x52')],'server/files/reports',_0x17077c[_0x63d6('0x4e')]))){throw new db[(_0x63d6('0x53'))]['ValidationError'](_0x63d6('0x54'));}if(_0x5a150d[_0x63d6('0x2d')][_0x63d6('0x55')]){return _0x33c0d4[_0x63d6('0x13')](0xc8);}return _0x33c0d4[_0x63d6('0x56')](path[_0x63d6('0x51')](config[_0x63d6('0x52')],_0x63d6('0x57'),_0x17077c['savename']),util['format'](_0x63d6('0x58'),_0x17077c[_0x63d6('0x59')]||_0x17077c['name'],_0x17077c['output'][_0x63d6('0x5a')]()));}})[_0x63d6('0x40')](handleError(_0x33c0d4,null));}; \ No newline at end of file +var _0x9e34=['catch','show','rawAttributes','find','create','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','server/files/reports','output','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x127801,_0x26281a){var _0x362f70=function(_0x372f06){while(--_0x372f06){_0x127801['push'](_0x127801['shift']());}};_0x362f70(++_0x26281a);}(_0x9e34,0xcc));var _0x49e3=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x9e34[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x49e3('0x0'));var rimraf=require(_0x49e3('0x1'));var zipdir=require(_0x49e3('0x2'));var jsonpatch=require(_0x49e3('0x3'));var rp=require(_0x49e3('0x4'));var moment=require('moment');var BPromise=require(_0x49e3('0x5'));var Mustache=require(_0x49e3('0x6'));var util=require('util');var path=require(_0x49e3('0x7'));var sox=require('sox');var csv=require(_0x49e3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49e3('0x9'));var _=require(_0x49e3('0xa'));var squel=require(_0x49e3('0xb'));var crypto=require(_0x49e3('0xc'));var jsforce=require(_0x49e3('0xd'));var deskjs=require(_0x49e3('0xe'));var toCsv=require(_0x49e3('0x8'));var querystring=require(_0x49e3('0xf'));var Papa=require(_0x49e3('0x10'));var Redis=require(_0x49e3('0x11'));var authService=require(_0x49e3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x49e3('0x13'));var hardwareService=require(_0x49e3('0x14'));var logger=require('../../config/logger')(_0x49e3('0x15'));var utils=require('../../config/utils');var config=require(_0x49e3('0x16'));var licenseUtil=require(_0x49e3('0x17'));var db=require(_0x49e3('0x18'))['db'];function respondWithStatusCode(_0x3f7d64,_0x476ced){_0x476ced=_0x476ced||0xcc;return function(_0x5b472a){if(_0x5b472a){return _0x3f7d64[_0x49e3('0x19')](_0x476ced);}return _0x3f7d64[_0x49e3('0x1a')](_0x476ced)['end']();};}function respondWithResult(_0x1f3ac0,_0x1dfe70){_0x1dfe70=_0x1dfe70||0xc8;return function(_0x5e7050){if(_0x5e7050){return _0x1f3ac0[_0x49e3('0x1a')](_0x1dfe70)[_0x49e3('0x1b')](_0x5e7050);}};}function respondWithFilteredResult(_0x52ca9d,_0x655d9e){return function(_0xa96033){if(_0xa96033){var _0x2a3441=typeof _0x655d9e['offset']===_0x49e3('0x1c')&&typeof _0x655d9e['limit']==='undefined';var _0x3db6d7=_0xa96033[_0x49e3('0x1d')];var _0x353cb4=_0x2a3441?0x0:_0x655d9e[_0x49e3('0x1e')];var _0x5b0765=_0x2a3441?_0xa96033['count']:_0x655d9e[_0x49e3('0x1e')]+_0x655d9e['limit'];var _0xf2bcd;if(_0x5b0765>=_0x3db6d7){_0x5b0765=_0x3db6d7;_0xf2bcd=0xc8;}else{_0xf2bcd=0xce;}_0x52ca9d[_0x49e3('0x1a')](_0xf2bcd);return _0x52ca9d[_0x49e3('0x1f')](_0x49e3('0x20'),_0x353cb4+'-'+_0x5b0765+'/'+_0x3db6d7)[_0x49e3('0x1b')](_0xa96033);}return null;};}function patchUpdates(_0x32e0c0){return function(_0x347c8b){try{jsonpatch[_0x49e3('0x21')](_0x347c8b,_0x32e0c0,!![]);}catch(_0x1274ab){return BPromise['reject'](_0x1274ab);}return _0x347c8b[_0x49e3('0x22')]();};}function saveUpdates(_0x3e1966,_0x4629a7){return function(_0x4fa4d1){if(_0x4fa4d1){return _0x4fa4d1[_0x49e3('0x23')](_0x3e1966)[_0x49e3('0x24')](function(_0x49ba07){return _0x49ba07;});}return null;};}function removeEntity(_0x3ce8ee,_0x7921ed){return function(_0x468227){if(_0x468227){return _0x468227[_0x49e3('0x25')]()['then'](function(){var _0x1ea219=_0x468227[_0x49e3('0x26')]({'plain':!![]});var _0xd61532=_0x49e3('0x27');return db[_0x49e3('0x28')]['destroy']({'where':{'type':_0xd61532,'resourceId':_0x1ea219['id']}})[_0x49e3('0x24')](function(){return _0x468227;});})['then'](function(){_0x3ce8ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d15c4,_0x277179){return function(_0x2b0866){if(!_0x2b0866){_0x5d15c4[_0x49e3('0x19')](0x194);}return _0x2b0866;};}function handleError(_0x2196e9,_0x1cbf72){_0x1cbf72=_0x1cbf72||0x1f4;return function(_0x242f5f){logger['error'](_0x242f5f[_0x49e3('0x29')]);if(_0x242f5f[_0x49e3('0x2a')]){delete _0x242f5f[_0x49e3('0x2a')];}_0x2196e9[_0x49e3('0x1a')](_0x1cbf72)[_0x49e3('0x2b')](_0x242f5f);};}exports[_0x49e3('0x2c')]=function(_0x10d05e,_0x4ffca9){var _0x428465={},_0x447d36={},_0x503c15={'count':0x0,'rows':[]};var _0x5eb30d=_[_0x49e3('0x2d')](db[_0x49e3('0x2e')]['rawAttributes'],function(_0x2febd1){return{'name':_0x2febd1[_0x49e3('0x2f')],'type':_0x2febd1[_0x49e3('0x30')]['key']};});_0x447d36[_0x49e3('0x31')]=_[_0x49e3('0x2d')](_0x5eb30d,'name');_0x447d36['query']=_[_0x49e3('0x32')](_0x10d05e[_0x49e3('0x33')]);_0x447d36[_0x49e3('0x34')]=_[_0x49e3('0x35')](_0x447d36[_0x49e3('0x31')],_0x447d36[_0x49e3('0x33')]);_0x428465['attributes']=_[_0x49e3('0x35')](_0x447d36['model'],qs[_0x49e3('0x36')](_0x10d05e[_0x49e3('0x33')][_0x49e3('0x36')]));_0x428465[_0x49e3('0x37')]=_0x428465['attributes'][_0x49e3('0x38')]?_0x428465[_0x49e3('0x37')]:_0x447d36[_0x49e3('0x31')];if(!_0x10d05e['query']['hasOwnProperty'](_0x49e3('0x39'))){_0x428465[_0x49e3('0x3a')]=qs['limit'](_0x10d05e[_0x49e3('0x33')][_0x49e3('0x3a')]);_0x428465[_0x49e3('0x1e')]=qs[_0x49e3('0x1e')](_0x10d05e[_0x49e3('0x33')][_0x49e3('0x1e')]);}_0x428465['order']=qs[_0x49e3('0x3b')](_0x10d05e[_0x49e3('0x33')]['sort']);_0x428465[_0x49e3('0x3c')]=qs['filters'](_[_0x49e3('0x3d')](_0x10d05e['query'],_0x447d36[_0x49e3('0x34')]),_0x5eb30d);if(_0x10d05e[_0x49e3('0x33')][_0x49e3('0x3e')]){_0x428465['where']=_[_0x49e3('0x3f')](_0x428465[_0x49e3('0x3c')],{'$or':_[_0x49e3('0x2d')](_0x5eb30d,function(_0x30bde1){if(_0x30bde1[_0x49e3('0x30')]!==_0x49e3('0x40')){var _0xfca81f={};_0xfca81f[_0x30bde1[_0x49e3('0x2a')]]={'$like':'%'+_0x10d05e[_0x49e3('0x33')][_0x49e3('0x3e')]+'%'};return _0xfca81f;}})});}_0x428465=_[_0x49e3('0x3f')]({},_0x428465,_0x10d05e[_0x49e3('0x41')]);var _0x3053b0={'where':_0x428465[_0x49e3('0x3c')]};return db['AnalyticExtractedReport']['count'](_0x3053b0)[_0x49e3('0x24')](function(_0xaf9ade){_0x503c15[_0x49e3('0x1d')]=_0xaf9ade;if(_0x10d05e[_0x49e3('0x33')][_0x49e3('0x42')]){_0x428465[_0x49e3('0x43')]=[{'all':!![]}];}return db[_0x49e3('0x2e')]['findAll'](_0x428465);})[_0x49e3('0x24')](function(_0x168f39){_0x503c15[_0x49e3('0x44')]=_0x168f39;return _0x503c15;})[_0x49e3('0x24')](respondWithFilteredResult(_0x4ffca9,_0x428465))[_0x49e3('0x45')](handleError(_0x4ffca9,null));};exports[_0x49e3('0x46')]=function(_0x88b9ea,_0x3729a9){var _0x1d38d3={'raw':!![],'where':{'id':_0x88b9ea['params']['id']}},_0x29307a={};_0x29307a[_0x49e3('0x31')]=_['keys'](db[_0x49e3('0x2e')][_0x49e3('0x47')]);_0x29307a[_0x49e3('0x33')]=_['keys'](_0x88b9ea['query']);_0x29307a[_0x49e3('0x34')]=_[_0x49e3('0x35')](_0x29307a[_0x49e3('0x31')],_0x29307a['query']);_0x1d38d3[_0x49e3('0x37')]=_[_0x49e3('0x35')](_0x29307a[_0x49e3('0x31')],qs['fields'](_0x88b9ea[_0x49e3('0x33')][_0x49e3('0x36')]));_0x1d38d3[_0x49e3('0x37')]=_0x1d38d3['attributes'][_0x49e3('0x38')]?_0x1d38d3[_0x49e3('0x37')]:_0x29307a[_0x49e3('0x31')];if(_0x88b9ea[_0x49e3('0x33')][_0x49e3('0x42')]){_0x1d38d3['include']=[{'all':!![]}];}_0x1d38d3=_['merge']({},_0x1d38d3,_0x88b9ea[_0x49e3('0x41')]);return db[_0x49e3('0x2e')][_0x49e3('0x48')](_0x1d38d3)[_0x49e3('0x24')](handleEntityNotFound(_0x3729a9,null))[_0x49e3('0x24')](respondWithResult(_0x3729a9,null))[_0x49e3('0x45')](handleError(_0x3729a9,null));};exports[_0x49e3('0x49')]=function(_0x3d71c0,_0xa45d03){return db[_0x49e3('0x2e')][_0x49e3('0x49')](_0x3d71c0['body'],{})[_0x49e3('0x24')](function(_0x679c57){var _0x27c453=_0x3d71c0[_0x49e3('0x4a')][_0x49e3('0x26')]({'plain':!![]});if(!_0x27c453)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27c453['role']===_0x49e3('0x4a')){var _0x4dee32=_0x679c57['get']({'plain':!![]});var _0x17ec8b=_0x49e3('0x27');return db['UserProfileSection'][_0x49e3('0x48')]({'where':{'name':_0x17ec8b,'userProfileId':_0x27c453['userProfileId']},'raw':!![]})[_0x49e3('0x24')](function(_0x2ac1ee){if(_0x2ac1ee&&_0x2ac1ee[_0x49e3('0x4b')]===0x0){return db[_0x49e3('0x28')][_0x49e3('0x49')]({'name':_0x4dee32[_0x49e3('0x2a')],'resourceId':_0x4dee32['id'],'type':_0x2ac1ee['name'],'sectionId':_0x2ac1ee['id']},{})[_0x49e3('0x24')](function(){return _0x679c57;});}else{return _0x679c57;}})['catch'](function(_0x17a679){logger[_0x49e3('0x4c')](_0x49e3('0x4d'),_0x17a679);throw _0x17a679;});}return _0x679c57;})[_0x49e3('0x24')](respondWithResult(_0xa45d03,0xc9))['catch'](handleError(_0xa45d03,null));};exports[_0x49e3('0x23')]=function(_0x410a36,_0x396be5){if(_0x410a36[_0x49e3('0x4e')]['id']){delete _0x410a36[_0x49e3('0x4e')]['id'];}return db[_0x49e3('0x2e')]['find']({'where':{'id':_0x410a36[_0x49e3('0x4f')]['id']}})[_0x49e3('0x24')](handleEntityNotFound(_0x396be5,null))[_0x49e3('0x24')](saveUpdates(_0x410a36['body'],null))[_0x49e3('0x24')](respondWithResult(_0x396be5,null))[_0x49e3('0x45')](handleError(_0x396be5,null));};exports[_0x49e3('0x25')]=function(_0x5ba632,_0xf03e62){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x5ba632[_0x49e3('0x4f')]['id']}})['then'](handleEntityNotFound(_0xf03e62,null))[_0x49e3('0x24')](removeEntity(_0xf03e62,null))['catch'](handleError(_0xf03e62,null));};exports[_0x49e3('0x50')]=function(_0x445793,_0x52abcc,_0x260bb5){return db[_0x49e3('0x2e')][_0x49e3('0x48')]({'where':{'id':_0x445793[_0x49e3('0x4f')]['id']},'attributes':[_0x49e3('0x2a'),_0x49e3('0x51'),_0x49e3('0x52'),'output'],'raw':!![]})[_0x49e3('0x24')](handleEntityNotFound(_0x52abcc,null))[_0x49e3('0x24')](function(_0x872436){if(_0x872436){if(!fs[_0x49e3('0x53')](path[_0x49e3('0x54')](config[_0x49e3('0x55')],'server/files/reports',_0x872436[_0x49e3('0x52')]))){throw new db[(_0x49e3('0x56'))][(_0x49e3('0x57'))](_0x49e3('0x58'));}if(_0x445793['query']['exists']){return _0x52abcc[_0x49e3('0x19')](0xc8);}return _0x52abcc['download'](path[_0x49e3('0x54')](config[_0x49e3('0x55')],_0x49e3('0x59'),_0x872436[_0x49e3('0x52')]),util['format']('%s.%s',_0x872436[_0x49e3('0x51')]||_0x872436['name'],_0x872436[_0x49e3('0x5a')]['toLowerCase']()));}})['catch'](handleError(_0x52abcc,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 73189e0..afa6060 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 _0x4002=['bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger'];(function(_0x45160b,_0x3fa32d){var _0xaccdde=function(_0x508099){while(--_0x508099){_0x45160b['push'](_0x45160b['shift']());}};_0xaccdde(++_0x3fa32d);}(_0x4002,0xa3));var _0x2400=function(_0x37a75f,_0x213cbd){_0x37a75f=_0x37a75f-0x0;var _0x15b33b=_0x4002[_0x37a75f];return _0x15b33b;};'use strict';var _=require(_0x2400('0x0'));var util=require('util');var logger=require(_0x2400('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2400('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2400('0x3'));var rimraf=require(_0x2400('0x4'));var config=require(_0x2400('0x5'));var attributes=require(_0x2400('0x6'));module[_0x2400('0x7')]=function(_0x44c3af,_0x5377bd){return _0x44c3af[_0x2400('0x8')](_0x2400('0x9'),attributes,{'tableName':_0x2400('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x907f=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x1d4e21,_0x4e8096){var _0x178fef=function(_0x515879){while(--_0x515879){_0x1d4e21['push'](_0x1d4e21['shift']());}};_0x178fef(++_0x4e8096);}(_0x907f,0x174));var _0xf907=function(_0x423d84,_0xa8a08b){_0x423d84=_0x423d84-0x0;var _0x49d0cd=_0x907f[_0x423d84];return _0x49d0cd;};'use strict';var _=require(_0xf907('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf907('0x1'));var moment=require(_0xf907('0x2'));var BPromise=require(_0xf907('0x3'));var rp=require(_0xf907('0x4'));var fs=require('fs');var path=require(_0xf907('0x5'));var rimraf=require('rimraf');var config=require(_0xf907('0x6'));var attributes=require(_0xf907('0x7'));module[_0xf907('0x8')]=function(_0x5b81e3,_0x1c26f1){return _0x5b81e3[_0xf907('0x9')](_0xf907('0xa'),attributes,{'tableName':_0xf907('0xb'),'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 dd052f7..b14d566 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 _0x7b1f=['request\x20sent','debug','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x540df2,_0x51bad5){var _0xf91f38=function(_0xe18d2){while(--_0xe18d2){_0x540df2['push'](_0x540df2['shift']());}};_0xf91f38(++_0x51bad5);}(_0x7b1f,0x13b));var _0xf7b1=function(_0x51a153,_0x21a8e5){_0x51a153=_0x51a153-0x0;var _0x1c501c=_0x7b1f[_0x51a153];return _0x1c501c;};'use strict';var _=require(_0xf7b1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf7b1('0x1'));var rs=require(_0xf7b1('0x2'));var fs=require('fs');var Redis=require(_0xf7b1('0x3'));var db=require(_0xf7b1('0x4'))['db'];var utils=require(_0xf7b1('0x5'));var logger=require(_0xf7b1('0x6'))(_0xf7b1('0x7'));var config=require(_0xf7b1('0x8'));var jayson=require(_0xf7b1('0x9'));var client=jayson[_0xf7b1('0xa')][_0xf7b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x470f53,_0x1e416e,_0x4a11b1){return new BPromise(function(_0x25ce80,_0x6ca5f7){return client['request'](_0x470f53,_0x4a11b1)[_0xf7b1('0xc')](function(_0x44bedb){logger[_0xf7b1('0xd')](_0xf7b1('0xe'),_0x1e416e,_0xf7b1('0xf'));logger[_0xf7b1('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x1e416e,_0xf7b1('0xf'),JSON[_0xf7b1('0x11')](_0x44bedb));if(_0x44bedb[_0xf7b1('0x12')]){if(_0x44bedb[_0xf7b1('0x12')][_0xf7b1('0x13')]===0x1f4){logger[_0xf7b1('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1e416e,_0x44bedb[_0xf7b1('0x12')][_0xf7b1('0x14')]);return _0x6ca5f7(_0x44bedb[_0xf7b1('0x12')][_0xf7b1('0x14')]);}logger[_0xf7b1('0x12')](_0xf7b1('0xe'),_0x1e416e,_0x44bedb[_0xf7b1('0x12')]['message']);return _0x25ce80(_0x44bedb[_0xf7b1('0x12')][_0xf7b1('0x14')]);}else{logger[_0xf7b1('0xd')](_0xf7b1('0xe'),_0x1e416e,_0xf7b1('0xf'));_0x25ce80(_0x44bedb[_0xf7b1('0x15')][_0xf7b1('0x14')]);}})['catch'](function(_0x3d82aa){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1e416e,_0x3d82aa);_0x6ca5f7(_0x3d82aa);});});} \ No newline at end of file +var _0x6be1=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6be1,0x16e));var _0x16be=function(_0x538d1c,_0x170fc9){_0x538d1c=_0x538d1c-0x0;var _0x29be44=_0x6be1[_0x538d1c];return _0x29be44;};'use strict';var _=require(_0x16be('0x0'));var util=require('util');var moment=require(_0x16be('0x1'));var BPromise=require(_0x16be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16be('0x3'));var db=require(_0x16be('0x4'))['db'];var utils=require(_0x16be('0x5'));var logger=require(_0x16be('0x6'))(_0x16be('0x7'));var config=require(_0x16be('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5df1b4,_0xb76054,_0x2078ae){return new BPromise(function(_0x5d27e7,_0x52f4ee){return client[_0x16be('0x9')](_0x5df1b4,_0x2078ae)[_0x16be('0xa')](function(_0x1b1a71){logger[_0x16be('0xb')](_0x16be('0xc'),_0xb76054,_0x16be('0xd'));logger['debug'](_0x16be('0xe'),_0xb76054,_0x16be('0xd'),JSON[_0x16be('0xf')](_0x1b1a71));if(_0x1b1a71[_0x16be('0x10')]){if(_0x1b1a71[_0x16be('0x10')]['code']===0x1f4){logger['error'](_0x16be('0xc'),_0xb76054,_0x1b1a71[_0x16be('0x10')]['message']);return _0x52f4ee(_0x1b1a71['error'][_0x16be('0x11')]);}logger['error'](_0x16be('0xc'),_0xb76054,_0x1b1a71[_0x16be('0x10')]['message']);return _0x5d27e7(_0x1b1a71[_0x16be('0x10')][_0x16be('0x11')]);}else{logger['info'](_0x16be('0xc'),_0xb76054,_0x16be('0xd'));_0x5d27e7(_0x1b1a71[_0x16be('0x12')]['message']);}})['catch'](function(_0x4561bc){logger[_0x16be('0x10')](_0x16be('0xc'),_0xb76054,_0x4561bc);_0x52f4ee(_0x4561bc);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b35d0b6..de200ff 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 _0x5701=['/:id','show','/:id/download','download','post','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index'];(function(_0x4fae39,_0x20183b){var _0x3b86d0=function(_0x436a03){while(--_0x436a03){_0x4fae39['push'](_0x4fae39['shift']());}};_0x3b86d0(++_0x20183b);}(_0x5701,0xef));var _0x1570=function(_0x232945,_0x2e979c){_0x232945=_0x232945-0x0;var _0x119e4b=_0x5701[_0x232945];return _0x119e4b;};'use strict';var multer=require('multer');var util=require(_0x1570('0x0'));var path=require(_0x1570('0x1'));var timeout=require(_0x1570('0x2'));var express=require(_0x1570('0x3'));var router=express[_0x1570('0x4')]();var fs_extra=require(_0x1570('0x5'));var auth=require(_0x1570('0x6'));var interaction=require(_0x1570('0x7'));var config=require(_0x1570('0x8'));var controller=require(_0x1570('0x9'));router[_0x1570('0xa')]('/',auth[_0x1570('0xb')](),controller[_0x1570('0xc')]);router[_0x1570('0xa')](_0x1570('0xd'),auth[_0x1570('0xb')](),controller[_0x1570('0xe')]);router[_0x1570('0xa')](_0x1570('0xf'),auth[_0x1570('0xb')](),controller[_0x1570('0x10')]);router[_0x1570('0x11')]('/',auth[_0x1570('0xb')](),controller['create']);router['put'](_0x1570('0xd'),auth[_0x1570('0xb')](),controller[_0x1570('0x12')]);router[_0x1570('0x13')](_0x1570('0xd'),auth['isAuthenticated'](),controller[_0x1570('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1606=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','download','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1606,0x119));var _0x6160=function(_0x365435,_0x1dfcc3){_0x365435=_0x365435-0x0;var _0x33bed6=_0x1606[_0x365435];return _0x33bed6;};'use strict';var multer=require(_0x6160('0x0'));var util=require(_0x6160('0x1'));var path=require(_0x6160('0x2'));var timeout=require(_0x6160('0x3'));var express=require('express');var router=express[_0x6160('0x4')]();var fs_extra=require(_0x6160('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6160('0x6'));var config=require(_0x6160('0x7'));var controller=require(_0x6160('0x8'));router[_0x6160('0x9')]('/',auth[_0x6160('0xa')](),controller[_0x6160('0xb')]);router['get']('/:id',auth[_0x6160('0xa')](),controller[_0x6160('0xc')]);router[_0x6160('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x6160('0xd')]);router['post']('/',auth[_0x6160('0xa')](),controller['create']);router[_0x6160('0xe')](_0x6160('0xf'),auth[_0x6160('0xa')](),controller[_0x6160('0x10')]);router[_0x6160('0x11')](_0x6160('0xf'),auth[_0x6160('0xa')](),controller[_0x6160('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index c81e314..4e70f39 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 _0xb885=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x37e851,_0x54e8cf){var _0x3ea786=function(_0x4a2294){while(--_0x4a2294){_0x37e851['push'](_0x37e851['shift']());}};_0x3ea786(++_0x54e8cf);}(_0xb885,0x1eb));var _0x5b88=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0xb885[_0x1a89a1];return _0x3d5b46;};'use strict';var Sequelize=require(_0x5b88('0x0'));module[_0x5b88('0x1')]={'field':{'type':Sequelize[_0x5b88('0x2')]},'alias':{'type':Sequelize[_0x5b88('0x3')]},'function':{'type':Sequelize[_0x5b88('0x3')]},'format':{'type':Sequelize[_0x5b88('0x3')]},'groupBy':{'type':Sequelize[_0x5b88('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x5b88('0x3')]},'custom':{'type':Sequelize[_0x5b88('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x184a=['BOOLEAN','sequelize','exports','STRING'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x184a,0x6d));var _0xa184=function(_0x302fae,_0x4c33d9){_0x302fae=_0x302fae-0x0;var _0x63e136=_0x184a[_0x302fae];return _0x63e136;};'use strict';var Sequelize=require(_0xa184('0x0'));module[_0xa184('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xa184('0x2')]},'function':{'type':Sequelize[_0xa184('0x2')]},'format':{'type':Sequelize[_0xa184('0x2')]},'groupBy':{'type':Sequelize[_0xa184('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa184('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a0b7e18..61312c2 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 _0x414d=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0x414d,0x8c));var _0xd414=function(_0xc0213d,_0x4a3b1d){_0xc0213d=_0xc0213d-0x0;var _0x1a93c4=_0x414d[_0xc0213d];return _0x1a93c4;};'use strict';var emlformat=require(_0xd414('0x0'));var rimraf=require(_0xd414('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd414('0x2'));var rp=require(_0xd414('0x3'));var moment=require('moment');var BPromise=require(_0xd414('0x4'));var Mustache=require(_0xd414('0x5'));var util=require(_0xd414('0x6'));var path=require(_0xd414('0x7'));var sox=require('sox');var csv=require(_0xd414('0x8'));var ejs=require(_0xd414('0x9'));var fs=require('fs');var fs_extra=require(_0xd414('0xa'));var _=require(_0xd414('0xb'));var squel=require(_0xd414('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd414('0xd'));var toCsv=require(_0xd414('0x8'));var querystring=require(_0xd414('0xe'));var Papa=require('papaparse');var Redis=require(_0xd414('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd414('0x10'));var as=require(_0xd414('0x11'));var hardwareService=require(_0xd414('0x12'));var logger=require(_0xd414('0x13'))(_0xd414('0x14'));var utils=require(_0xd414('0x15'));var config=require(_0xd414('0x16'));var licenseUtil=require(_0xd414('0x17'));var db=require(_0xd414('0x18'))['db'];function respondWithStatusCode(_0x2b96d0,_0x585370){_0x585370=_0x585370||0xcc;return function(_0x2e8e4d){if(_0x2e8e4d){return _0x2b96d0['sendStatus'](_0x585370);}return _0x2b96d0['status'](_0x585370)[_0xd414('0x19')]();};}function respondWithResult(_0x480fa4,_0x283a8a){_0x283a8a=_0x283a8a||0xc8;return function(_0x3b63f5){if(_0x3b63f5){return _0x480fa4[_0xd414('0x1a')](_0x283a8a)['json'](_0x3b63f5);}};}function respondWithFilteredResult(_0x273f84,_0x4bdfdf){return function(_0x329d40){if(_0x329d40){var _0xcc7876=typeof _0x4bdfdf[_0xd414('0x1b')]===_0xd414('0x1c')&&typeof _0x4bdfdf[_0xd414('0x1d')]==='undefined';var _0x55ca21=_0x329d40['count'];var _0x4d2362=_0xcc7876?0x0:_0x4bdfdf[_0xd414('0x1b')];var _0x3899cb=_0xcc7876?_0x329d40[_0xd414('0x1e')]:_0x4bdfdf['offset']+_0x4bdfdf[_0xd414('0x1d')];var _0xd45505;if(_0x3899cb>=_0x55ca21){_0x3899cb=_0x55ca21;_0xd45505=0xc8;}else{_0xd45505=0xce;}_0x273f84[_0xd414('0x1a')](_0xd45505);return _0x273f84[_0xd414('0x1f')]('Content-Range',_0x4d2362+'-'+_0x3899cb+'/'+_0x55ca21)['json'](_0x329d40);}return null;};}function patchUpdates(_0x9c05a2){return function(_0x3aa2d4){try{jsonpatch['apply'](_0x3aa2d4,_0x9c05a2,!![]);}catch(_0x3a3cad){return BPromise[_0xd414('0x20')](_0x3a3cad);}return _0x3aa2d4[_0xd414('0x21')]();};}function saveUpdates(_0x3deb38,_0x28c241){return function(_0xa6a7d){if(_0xa6a7d){return _0xa6a7d[_0xd414('0x22')](_0x3deb38)[_0xd414('0x23')](function(_0x38afdc){return _0x38afdc;});}return null;};}function removeEntity(_0xaefab8,_0x43eadc){return function(_0xe9ef){if(_0xe9ef){return _0xe9ef[_0xd414('0x24')]()[_0xd414('0x23')](function(){_0xaefab8[_0xd414('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4936f8,_0x25b32a){return function(_0x2f144d){if(!_0x2f144d){_0x4936f8[_0xd414('0x25')](0x194);}return _0x2f144d;};}function handleError(_0x555e91,_0x1cb347){_0x1cb347=_0x1cb347||0x1f4;return function(_0x396db0){logger[_0xd414('0x26')](_0x396db0['stack']);if(_0x396db0[_0xd414('0x27')]){delete _0x396db0['name'];}_0x555e91[_0xd414('0x1a')](_0x1cb347)[_0xd414('0x28')](_0x396db0);};}exports[_0xd414('0x29')]=function(_0x576e65,_0x2f394e){var _0x1a2ada={},_0x598f81={},_0x2f526e={'count':0x0,'rows':[]};var _0xe89a31=_[_0xd414('0x2a')](db[_0xd414('0x2b')][_0xd414('0x2c')],function(_0x83f8fe){return{'name':_0x83f8fe[_0xd414('0x2d')],'type':_0x83f8fe[_0xd414('0x2e')]['key']};});_0x598f81[_0xd414('0x2f')]=_[_0xd414('0x2a')](_0xe89a31,_0xd414('0x27'));_0x598f81[_0xd414('0x30')]=_[_0xd414('0x31')](_0x576e65[_0xd414('0x30')]);_0x598f81['filters']=_[_0xd414('0x32')](_0x598f81['model'],_0x598f81[_0xd414('0x30')]);_0x1a2ada[_0xd414('0x33')]=_[_0xd414('0x32')](_0x598f81[_0xd414('0x2f')],qs[_0xd414('0x34')](_0x576e65['query']['fields']));_0x1a2ada['attributes']=_0x1a2ada[_0xd414('0x33')][_0xd414('0x35')]?_0x1a2ada[_0xd414('0x33')]:_0x598f81[_0xd414('0x2f')];if(!_0x576e65['query']['hasOwnProperty'](_0xd414('0x36'))){_0x1a2ada[_0xd414('0x1d')]=qs['limit'](_0x576e65['query']['limit']);_0x1a2ada['offset']=qs['offset'](_0x576e65[_0xd414('0x30')][_0xd414('0x1b')]);}_0x1a2ada[_0xd414('0x37')]=qs['sort'](_0x576e65['query']['sort']);_0x1a2ada[_0xd414('0x38')]=qs[_0xd414('0x39')](_[_0xd414('0x3a')](_0x576e65[_0xd414('0x30')],_0x598f81['filters']),_0xe89a31);if(_0x576e65[_0xd414('0x30')][_0xd414('0x3b')]){_0x1a2ada[_0xd414('0x38')]=_['merge'](_0x1a2ada[_0xd414('0x38')],{'$or':_[_0xd414('0x2a')](_0xe89a31,function(_0x16bc53){if(_0x16bc53[_0xd414('0x2e')]!==_0xd414('0x3c')){var _0x30d966={};_0x30d966[_0x16bc53[_0xd414('0x27')]]={'$like':'%'+_0x576e65['query'][_0xd414('0x3b')]+'%'};return _0x30d966;}})});}_0x1a2ada=_[_0xd414('0x3d')]({},_0x1a2ada,_0x576e65['options']);var _0x3f4b84={'where':_0x1a2ada[_0xd414('0x38')]};return db[_0xd414('0x2b')][_0xd414('0x1e')](_0x3f4b84)['then'](function(_0x36f998){_0x2f526e['count']=_0x36f998;if(_0x576e65[_0xd414('0x30')][_0xd414('0x3e')]){_0x1a2ada[_0xd414('0x3f')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x1a2ada);})[_0xd414('0x23')](function(_0x368c57){_0x2f526e[_0xd414('0x40')]=_0x368c57;return _0x2f526e;})[_0xd414('0x23')](respondWithFilteredResult(_0x2f394e,_0x1a2ada))[_0xd414('0x41')](handleError(_0x2f394e,null));};exports[_0xd414('0x42')]=function(_0x5db4d0,_0x444099){var _0x534bae={'raw':![],'where':{'id':_0x5db4d0[_0xd414('0x43')]['id']}},_0x4cd2d6={};_0x4cd2d6[_0xd414('0x2f')]=_['keys'](db[_0xd414('0x2b')][_0xd414('0x2c')]);_0x4cd2d6[_0xd414('0x30')]=_[_0xd414('0x31')](_0x5db4d0[_0xd414('0x30')]);_0x4cd2d6[_0xd414('0x39')]=_[_0xd414('0x32')](_0x4cd2d6[_0xd414('0x2f')],_0x4cd2d6[_0xd414('0x30')]);_0x534bae[_0xd414('0x33')]=_[_0xd414('0x32')](_0x4cd2d6['model'],qs[_0xd414('0x34')](_0x5db4d0[_0xd414('0x30')]['fields']));_0x534bae[_0xd414('0x33')]=_0x534bae[_0xd414('0x33')][_0xd414('0x35')]?_0x534bae['attributes']:_0x4cd2d6[_0xd414('0x2f')];if(_0x5db4d0[_0xd414('0x30')]['includeAll']){_0x534bae[_0xd414('0x3f')]=[{'all':!![]}];}_0x534bae=_[_0xd414('0x3d')]({},_0x534bae,_0x5db4d0['options']);return db[_0xd414('0x2b')][_0xd414('0x44')](_0x534bae)[_0xd414('0x23')](handleEntityNotFound(_0x444099,null))[_0xd414('0x23')](respondWithResult(_0x444099,null))[_0xd414('0x41')](handleError(_0x444099,null));};exports[_0xd414('0x45')]=function(_0x396ce8,_0x17daf4){return db[_0xd414('0x2b')]['create'](_0x396ce8[_0xd414('0x46')],{})[_0xd414('0x23')](respondWithResult(_0x17daf4,0xc9))['catch'](handleError(_0x17daf4,null));};exports['bulkCreate']=function(_0x104ed1,_0x13b4c3){return db['AnalyticFieldReport'][_0xd414('0x47')](_0x104ed1['body'],{'raw':![],'individualHooks':!![]})[_0xd414('0x23')](respondWithResult(_0x13b4c3,0xc9))[_0xd414('0x41')](handleError(_0x13b4c3,null));};exports['update']=function(_0x3aec6c,_0x21931c){if(_0x3aec6c[_0xd414('0x46')]['id']){delete _0x3aec6c['body']['id'];}return db[_0xd414('0x2b')]['find']({'where':{'id':_0x3aec6c[_0xd414('0x43')]['id']}})[_0xd414('0x23')](handleEntityNotFound(_0x21931c,null))[_0xd414('0x23')](saveUpdates(_0x3aec6c[_0xd414('0x46')],null))['then'](respondWithResult(_0x21931c,null))[_0xd414('0x41')](handleError(_0x21931c,null));};exports[_0xd414('0x24')]=function(_0x59c622,_0x30a97f){return db[_0xd414('0x2b')][_0xd414('0x44')]({'where':{'id':_0x59c622[_0xd414('0x43')]['id']}})['then'](handleEntityNotFound(_0x30a97f,null))[_0xd414('0x23')](removeEntity(_0x30a97f,null))[_0xd414('0x41')](handleError(_0x30a97f,null));};exports[_0xd414('0x48')]=function(_0x54b9b5,_0x4829f7){return db[_0xd414('0x2b')]['destroy']({'where':{'id':_0x54b9b5['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0xd414('0x23')](respondWithResult(_0x4829f7,0xcc))[_0xd414('0x41')](handleError(_0x4829f7,null));};exports[_0xd414('0x49')]=function(_0x5d6738,_0x1e640c,_0x3e9991){return db[_0xd414('0x4a')][_0xd414('0x4b')]({'where':{'id':_0x5d6738[_0xd414('0x43')]['id']}})[_0xd414('0x23')](handleEntityNotFound(_0x1e640c,null))['then'](function(_0x4da4ec){if(_0x4da4ec){return db[_0xd414('0x4c')][_0xd414('0x4d')](function(_0x5a431b){return db['AnalyticFieldReport'][_0xd414('0x24')]({'where':{'CustomReportId':_0x5d6738[_0xd414('0x43')]['id']},'transaction':_0x5a431b})[_0xd414('0x23')](function(_0x393ddf){var _0xebdce2=_[_0xd414('0x2a')](_0x5d6738['body'],function(_0x32adf3){delete _0x32adf3['id'];_0x32adf3[_0xd414('0x4e')]=_0x5d6738[_0xd414('0x43')]['id'];return _0x32adf3;});return db['AnalyticFieldReport'][_0xd414('0x47')](_0xebdce2,{'transaction':_0x5a431b});});})[_0xd414('0x23')](function(){return db[_0xd414('0x2b')]['findAll']({'where':{'CustomReportId':_0x5d6738[_0xd414('0x43')]['id']}});});}})[_0xd414('0x23')](respondWithResult(_0x1e640c,null))[_0xd414('0x41')](handleError(_0x1e640c,null));}; \ No newline at end of file +var _0xf4cb=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','VIRTUAL','then','includeAll','AnalyticFieldReport','findAll','rows','catch','show','params','keys','include','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x171ea0,_0x20019e){var _0x49f0ad=function(_0x17ed7f){while(--_0x17ed7f){_0x171ea0['push'](_0x171ea0['shift']());}};_0x49f0ad(++_0x20019e);}(_0xf4cb,0x1c5));var _0xbf4c=function(_0x5b9096,_0xeffc85){_0x5b9096=_0x5b9096-0x0;var _0x563fc5=_0xf4cb[_0x5b9096];return _0x563fc5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf4c('0x0'));var zipdir=require(_0xbf4c('0x1'));var jsonpatch=require(_0xbf4c('0x2'));var rp=require(_0xbf4c('0x3'));var moment=require(_0xbf4c('0x4'));var BPromise=require(_0xbf4c('0x5'));var Mustache=require(_0xbf4c('0x6'));var util=require(_0xbf4c('0x7'));var path=require('path');var sox=require(_0xbf4c('0x8'));var csv=require(_0xbf4c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf4c('0xa'));var _=require(_0xbf4c('0xb'));var squel=require(_0xbf4c('0xc'));var crypto=require('crypto');var jsforce=require(_0xbf4c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf4c('0xe'));var Papa=require('papaparse');var Redis=require(_0xbf4c('0xf'));var authService=require(_0xbf4c('0x10'));var qs=require(_0xbf4c('0x11'));var as=require(_0xbf4c('0x12'));var hardwareService=require(_0xbf4c('0x13'));var logger=require(_0xbf4c('0x14'))(_0xbf4c('0x15'));var utils=require('../../config/utils');var config=require(_0xbf4c('0x16'));var licenseUtil=require(_0xbf4c('0x17'));var db=require(_0xbf4c('0x18'))['db'];function respondWithStatusCode(_0x58352e,_0x421fee){_0x421fee=_0x421fee||0xcc;return function(_0x194a66){if(_0x194a66){return _0x58352e[_0xbf4c('0x19')](_0x421fee);}return _0x58352e[_0xbf4c('0x1a')](_0x421fee)['end']();};}function respondWithResult(_0x7716eb,_0x223008){_0x223008=_0x223008||0xc8;return function(_0x9887ff){if(_0x9887ff){return _0x7716eb[_0xbf4c('0x1a')](_0x223008)['json'](_0x9887ff);}};}function respondWithFilteredResult(_0x3bc07f,_0x409bf2){return function(_0x3c3aa5){if(_0x3c3aa5){var _0x504e9f=typeof _0x409bf2[_0xbf4c('0x1b')]===_0xbf4c('0x1c')&&typeof _0x409bf2[_0xbf4c('0x1d')]==='undefined';var _0x247bc1=_0x3c3aa5[_0xbf4c('0x1e')];var _0x1958b9=_0x504e9f?0x0:_0x409bf2[_0xbf4c('0x1b')];var _0x32865b=_0x504e9f?_0x3c3aa5[_0xbf4c('0x1e')]:_0x409bf2['offset']+_0x409bf2[_0xbf4c('0x1d')];var _0x244cf7;if(_0x32865b>=_0x247bc1){_0x32865b=_0x247bc1;_0x244cf7=0xc8;}else{_0x244cf7=0xce;}_0x3bc07f[_0xbf4c('0x1a')](_0x244cf7);return _0x3bc07f['set'](_0xbf4c('0x1f'),_0x1958b9+'-'+_0x32865b+'/'+_0x247bc1)['json'](_0x3c3aa5);}return null;};}function patchUpdates(_0x5a1e72){return function(_0x4cabff){try{jsonpatch[_0xbf4c('0x20')](_0x4cabff,_0x5a1e72,!![]);}catch(_0x32ef0b){return BPromise[_0xbf4c('0x21')](_0x32ef0b);}return _0x4cabff['save']();};}function saveUpdates(_0x1b80f7,_0x4eeec7){return function(_0x42c165){if(_0x42c165){return _0x42c165[_0xbf4c('0x22')](_0x1b80f7)['then'](function(_0x411131){return _0x411131;});}return null;};}function removeEntity(_0xee3e9e,_0x3c2be4){return function(_0x5de919){if(_0x5de919){return _0x5de919[_0xbf4c('0x23')]()['then'](function(){_0xee3e9e[_0xbf4c('0x1a')](0xcc)[_0xbf4c('0x24')]();});}};}function handleEntityNotFound(_0x482bf5,_0x3609d3){return function(_0x31d0f2){if(!_0x31d0f2){_0x482bf5[_0xbf4c('0x19')](0x194);}return _0x31d0f2;};}function handleError(_0x2c73eb,_0x465dad){_0x465dad=_0x465dad||0x1f4;return function(_0x418a9b){logger[_0xbf4c('0x25')](_0x418a9b[_0xbf4c('0x26')]);if(_0x418a9b[_0xbf4c('0x27')]){delete _0x418a9b[_0xbf4c('0x27')];}_0x2c73eb[_0xbf4c('0x1a')](_0x465dad)[_0xbf4c('0x28')](_0x418a9b);};}exports[_0xbf4c('0x29')]=function(_0x5bb87c,_0x340fef){var _0x396ff2={},_0xb1d3b5={},_0x42290d={'count':0x0,'rows':[]};var _0x277277=_[_0xbf4c('0x2a')](db['AnalyticFieldReport'][_0xbf4c('0x2b')],function(_0x1eb4c8){return{'name':_0x1eb4c8['fieldName'],'type':_0x1eb4c8[_0xbf4c('0x2c')][_0xbf4c('0x2d')]};});_0xb1d3b5[_0xbf4c('0x2e')]=_['map'](_0x277277,_0xbf4c('0x27'));_0xb1d3b5[_0xbf4c('0x2f')]=_['keys'](_0x5bb87c[_0xbf4c('0x2f')]);_0xb1d3b5[_0xbf4c('0x30')]=_['intersection'](_0xb1d3b5[_0xbf4c('0x2e')],_0xb1d3b5[_0xbf4c('0x2f')]);_0x396ff2[_0xbf4c('0x31')]=_[_0xbf4c('0x32')](_0xb1d3b5[_0xbf4c('0x2e')],qs['fields'](_0x5bb87c[_0xbf4c('0x2f')][_0xbf4c('0x33')]));_0x396ff2['attributes']=_0x396ff2[_0xbf4c('0x31')][_0xbf4c('0x34')]?_0x396ff2[_0xbf4c('0x31')]:_0xb1d3b5[_0xbf4c('0x2e')];if(!_0x5bb87c[_0xbf4c('0x2f')]['hasOwnProperty']('nolimit')){_0x396ff2[_0xbf4c('0x1d')]=qs['limit'](_0x5bb87c[_0xbf4c('0x2f')][_0xbf4c('0x1d')]);_0x396ff2[_0xbf4c('0x1b')]=qs[_0xbf4c('0x1b')](_0x5bb87c[_0xbf4c('0x2f')]['offset']);}_0x396ff2[_0xbf4c('0x35')]=qs[_0xbf4c('0x36')](_0x5bb87c[_0xbf4c('0x2f')][_0xbf4c('0x36')]);_0x396ff2[_0xbf4c('0x37')]=qs[_0xbf4c('0x30')](_[_0xbf4c('0x38')](_0x5bb87c[_0xbf4c('0x2f')],_0xb1d3b5['filters']),_0x277277);if(_0x5bb87c['query']['filter']){_0x396ff2['where']=_['merge'](_0x396ff2[_0xbf4c('0x37')],{'$or':_['map'](_0x277277,function(_0x50b897){if(_0x50b897[_0xbf4c('0x2c')]!==_0xbf4c('0x39')){var _0x48fb44={};_0x48fb44[_0x50b897[_0xbf4c('0x27')]]={'$like':'%'+_0x5bb87c[_0xbf4c('0x2f')]['filter']+'%'};return _0x48fb44;}})});}_0x396ff2=_['merge']({},_0x396ff2,_0x5bb87c['options']);var _0x1663c6={'where':_0x396ff2[_0xbf4c('0x37')]};return db['AnalyticFieldReport'][_0xbf4c('0x1e')](_0x1663c6)[_0xbf4c('0x3a')](function(_0x5784d7){_0x42290d['count']=_0x5784d7;if(_0x5bb87c['query'][_0xbf4c('0x3b')]){_0x396ff2['include']=[{'all':!![]}];}return db[_0xbf4c('0x3c')][_0xbf4c('0x3d')](_0x396ff2);})[_0xbf4c('0x3a')](function(_0x3a99bd){_0x42290d[_0xbf4c('0x3e')]=_0x3a99bd;return _0x42290d;})[_0xbf4c('0x3a')](respondWithFilteredResult(_0x340fef,_0x396ff2))[_0xbf4c('0x3f')](handleError(_0x340fef,null));};exports[_0xbf4c('0x40')]=function(_0x2426d3,_0x5574b9){var _0x2147f4={'raw':![],'where':{'id':_0x2426d3[_0xbf4c('0x41')]['id']}},_0x1171a3={};_0x1171a3['model']=_[_0xbf4c('0x42')](db[_0xbf4c('0x3c')][_0xbf4c('0x2b')]);_0x1171a3[_0xbf4c('0x2f')]=_['keys'](_0x2426d3[_0xbf4c('0x2f')]);_0x1171a3[_0xbf4c('0x30')]=_[_0xbf4c('0x32')](_0x1171a3[_0xbf4c('0x2e')],_0x1171a3[_0xbf4c('0x2f')]);_0x2147f4['attributes']=_[_0xbf4c('0x32')](_0x1171a3[_0xbf4c('0x2e')],qs[_0xbf4c('0x33')](_0x2426d3[_0xbf4c('0x2f')][_0xbf4c('0x33')]));_0x2147f4[_0xbf4c('0x31')]=_0x2147f4[_0xbf4c('0x31')][_0xbf4c('0x34')]?_0x2147f4['attributes']:_0x1171a3['model'];if(_0x2426d3[_0xbf4c('0x2f')][_0xbf4c('0x3b')]){_0x2147f4[_0xbf4c('0x43')]=[{'all':!![]}];}_0x2147f4=_['merge']({},_0x2147f4,_0x2426d3['options']);return db[_0xbf4c('0x3c')][_0xbf4c('0x44')](_0x2147f4)[_0xbf4c('0x3a')](handleEntityNotFound(_0x5574b9,null))['then'](respondWithResult(_0x5574b9,null))[_0xbf4c('0x3f')](handleError(_0x5574b9,null));};exports['create']=function(_0x5815d4,_0x18994a){return db[_0xbf4c('0x3c')][_0xbf4c('0x45')](_0x5815d4[_0xbf4c('0x46')],{})[_0xbf4c('0x3a')](respondWithResult(_0x18994a,0xc9))[_0xbf4c('0x3f')](handleError(_0x18994a,null));};exports[_0xbf4c('0x47')]=function(_0x4c3bdd,_0x5c040f){return db[_0xbf4c('0x3c')][_0xbf4c('0x47')](_0x4c3bdd['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5c040f,0xc9))[_0xbf4c('0x3f')](handleError(_0x5c040f,null));};exports[_0xbf4c('0x22')]=function(_0x183bc1,_0x36c37d){if(_0x183bc1['body']['id']){delete _0x183bc1['body']['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x183bc1[_0xbf4c('0x41')]['id']}})['then'](handleEntityNotFound(_0x36c37d,null))['then'](saveUpdates(_0x183bc1[_0xbf4c('0x46')],null))['then'](respondWithResult(_0x36c37d,null))['catch'](handleError(_0x36c37d,null));};exports[_0xbf4c('0x23')]=function(_0x12b81b,_0x21ffe1){return db[_0xbf4c('0x3c')]['find']({'where':{'id':_0x12b81b[_0xbf4c('0x41')]['id']}})[_0xbf4c('0x3a')](handleEntityNotFound(_0x21ffe1,null))[_0xbf4c('0x3a')](removeEntity(_0x21ffe1,null))[_0xbf4c('0x3f')](handleError(_0x21ffe1,null));};exports[_0xbf4c('0x48')]=function(_0x14ab43,_0x5dc5a5){return db[_0xbf4c('0x3c')][_0xbf4c('0x23')]({'where':{'id':_0x14ab43[_0xbf4c('0x2f')][_0xbf4c('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xbf4c('0x3a')](respondWithResult(_0x5dc5a5,0xcc))['catch'](handleError(_0x5dc5a5,null));};exports[_0xbf4c('0x4a')]=function(_0x188a0c,_0xaaaed6,_0x41099e){return db[_0xbf4c('0x4b')]['findOne']({'where':{'id':_0x188a0c[_0xbf4c('0x41')]['id']}})[_0xbf4c('0x3a')](handleEntityNotFound(_0xaaaed6,null))['then'](function(_0x2f8879){if(_0x2f8879){return db[_0xbf4c('0x4c')][_0xbf4c('0x4d')](function(_0x359122){return db[_0xbf4c('0x3c')][_0xbf4c('0x23')]({'where':{'CustomReportId':_0x188a0c[_0xbf4c('0x41')]['id']},'transaction':_0x359122})[_0xbf4c('0x3a')](function(_0x5e7ca1){var _0x5ae69f=_[_0xbf4c('0x2a')](_0x188a0c[_0xbf4c('0x46')],function(_0x39abd5){delete _0x39abd5['id'];_0x39abd5[_0xbf4c('0x4e')]=_0x188a0c[_0xbf4c('0x41')]['id'];return _0x39abd5;});return db[_0xbf4c('0x3c')][_0xbf4c('0x47')](_0x5ae69f,{'transaction':_0x359122});});})['then'](function(){return db['AnalyticFieldReport'][_0xbf4c('0x3d')]({'where':{'CustomReportId':_0x188a0c[_0xbf4c('0x41')]['id']}});});}})[_0xbf4c('0x3a')](respondWithResult(_0xaaaed6,null))[_0xbf4c('0x3f')](handleError(_0xaaaed6,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 7f37dfc..b573e92 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 _0x45e8=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x45e8,0x1ef));var _0x845e=function(_0x5b5c66,_0x232916){_0x5b5c66=_0x5b5c66-0x0;var _0x19c519=_0x45e8[_0x5b5c66];return _0x19c519;};'use strict';var _=require(_0x845e('0x0'));var util=require(_0x845e('0x1'));var logger=require('../../config/logger')(_0x845e('0x2'));var moment=require(_0x845e('0x3'));var BPromise=require(_0x845e('0x4'));var rp=require(_0x845e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x845e('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x845e('0x7')]=function(_0x14f7c0,_0x5b8f99){return _0x14f7c0[_0x845e('0x8')](_0x845e('0x9'),attributes,{'tableName':_0x845e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6764=['bluebird','request-promise','../../config/environment','exports','define','analytics_report_fields','util','../../config/logger','api','moment'];(function(_0x57d176,_0x245db7){var _0x47ffbf=function(_0x67109b){while(--_0x67109b){_0x57d176['push'](_0x57d176['shift']());}};_0x47ffbf(++_0x245db7);}(_0x6764,0x1aa));var _0x4676=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6764[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x4676('0x0'));var logger=require(_0x4676('0x1'))(_0x4676('0x2'));var moment=require(_0x4676('0x3'));var BPromise=require(_0x4676('0x4'));var rp=require(_0x4676('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4676('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x4676('0x7')]=function(_0x1fea04,_0x297cd2){return _0x1fea04[_0x4676('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x4676('0x9'),'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 aadb0d5..6313b3e 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 _0x1339=['stringify','error','code','message','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x1019b8,_0x10dce5){var _0x2a2dd9=function(_0x224d44){while(--_0x224d44){_0x1019b8['push'](_0x1019b8['shift']());}};_0x2a2dd9(++_0x10dce5);}(_0x1339,0x145));var _0x9133=function(_0x2048f7,_0x2c6015){_0x2048f7=_0x2048f7-0x0;var _0x1f36dd=_0x1339[_0x2048f7];return _0x1f36dd;};'use strict';var _=require(_0x9133('0x0'));var util=require(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9133('0x4'));var logger=require(_0x9133('0x5'))(_0x9133('0x6'));var config=require(_0x9133('0x7'));var jayson=require(_0x9133('0x8'));var client=jayson['client'][_0x9133('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32f4f8,_0x4363be,_0x59f9a8){return new BPromise(function(_0x4f7bf8,_0x888418){return client['request'](_0x32f4f8,_0x59f9a8)['then'](function(_0x1f6727){logger[_0x9133('0xa')](_0x9133('0xb'),_0x4363be,_0x9133('0xc'));logger[_0x9133('0xd')](_0x9133('0xe'),_0x4363be,'request\x20sent',JSON[_0x9133('0xf')](_0x1f6727));if(_0x1f6727[_0x9133('0x10')]){if(_0x1f6727[_0x9133('0x10')][_0x9133('0x11')]===0x1f4){logger[_0x9133('0x10')](_0x9133('0xb'),_0x4363be,_0x1f6727['error'][_0x9133('0x12')]);return _0x888418(_0x1f6727[_0x9133('0x10')][_0x9133('0x12')]);}logger[_0x9133('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4363be,_0x1f6727[_0x9133('0x10')]['message']);return _0x4f7bf8(_0x1f6727[_0x9133('0x10')][_0x9133('0x12')]);}else{logger[_0x9133('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4363be,'request\x20sent');_0x4f7bf8(_0x1f6727[_0x9133('0x13')][_0x9133('0x12')]);}})['catch'](function(_0x2a0afa){logger['error'](_0x9133('0xb'),_0x4363be,_0x2a0afa);_0x888418(_0x2a0afa);});});} \ No newline at end of file +var _0x392a=['request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0x392a,0x8f));var _0xa392=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x392a[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xa392('0x0'));var util=require(_0xa392('0x1'));var moment=require(_0xa392('0x2'));var BPromise=require(_0xa392('0x3'));var rs=require(_0xa392('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa392('0x5'))(_0xa392('0x6'));var config=require(_0xa392('0x7'));var jayson=require(_0xa392('0x8'));var client=jayson[_0xa392('0x9')][_0xa392('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bf798,_0x38e3a3,_0x46fb56){return new BPromise(function(_0xdb9be,_0x45501b){return client[_0xa392('0xb')](_0x1bf798,_0x46fb56)[_0xa392('0xc')](function(_0x2f2d04){logger[_0xa392('0xd')](_0xa392('0xe'),_0x38e3a3,'request\x20sent');logger['debug'](_0xa392('0xf'),_0x38e3a3,_0xa392('0x10'),JSON['stringify'](_0x2f2d04));if(_0x2f2d04['error']){if(_0x2f2d04[_0xa392('0x11')][_0xa392('0x12')]===0x1f4){logger[_0xa392('0x11')](_0xa392('0xe'),_0x38e3a3,_0x2f2d04['error'][_0xa392('0x13')]);return _0x45501b(_0x2f2d04[_0xa392('0x11')][_0xa392('0x13')]);}logger[_0xa392('0x11')](_0xa392('0xe'),_0x38e3a3,_0x2f2d04[_0xa392('0x11')]['message']);return _0xdb9be(_0x2f2d04[_0xa392('0x11')]['message']);}else{logger['info'](_0xa392('0xe'),_0x38e3a3,'request\x20sent');_0xdb9be(_0x2f2d04[_0xa392('0x14')][_0xa392('0x13')]);}})[_0xa392('0x15')](function(_0x275b61){logger[_0xa392('0x11')](_0xa392('0xe'),_0x38e3a3,_0x275b61);_0x45501b(_0x275b61);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 2d2454a..cab171a 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(_0x1d8024,_0x572013){var _0x564562=function(_0x106eda){while(--_0x106eda){_0x1d8024['push'](_0x1d8024['shift']());}};_0x564562(++_0x572013);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x3b9665,_0x55a64b){var _0x4956d8=function(_0x15b806){while(--_0x15b806){_0x3b9665['push'](_0x3b9665['shift']());}};_0x4956d8(++_0x55a64b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 d30aa62..24030ae 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 _0x9649=['sequelize','exports','name','STRING','TEXT'];(function(_0x355dcb,_0x5756db){var _0x12f4cb=function(_0x5bbc7f){while(--_0x5bbc7f){_0x355dcb['push'](_0x355dcb['shift']());}};_0x12f4cb(++_0x5756db);}(_0x9649,0x118));var _0x9964=function(_0x5312f2,_0x3e2ae0){_0x5312f2=_0x5312f2-0x0;var _0x491ace=_0x9649[_0x5312f2];return _0x491ace;};'use strict';var Sequelize=require(_0x9964('0x0'));module[_0x9964('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9964('0x2')},'table':{'type':Sequelize[_0x9964('0x3')]},'metric':{'type':Sequelize[_0x9964('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c1b=['TEXT','sequelize','exports','STRING','name'];(function(_0x20ee11,_0x2972e9){var _0x408a73=function(_0x557afd){while(--_0x557afd){_0x20ee11['push'](_0x20ee11['shift']());}};_0x408a73(++_0x2972e9);}(_0x2c1b,0xb0));var _0xb2c1=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x2c1b[_0x382e89];return _0x3a1318;};'use strict';var Sequelize=require(_0xb2c1('0x0'));module[_0xb2c1('0x1')]={'name':{'type':Sequelize[_0xb2c1('0x2')],'allowNull':![],'unique':_0xb2c1('0x3')},'table':{'type':Sequelize[_0xb2c1('0x2')]},'metric':{'type':Sequelize[_0xb2c1('0x4')]},'description':{'type':Sequelize[_0xb2c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 60f33e2..13473fb 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 _0xdbf5=['../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1255cd,_0x22b9b7){var _0x292878=function(_0x39a79a){while(--_0x39a79a){_0x1255cd['push'](_0x1255cd['shift']());}};_0x292878(++_0x22b9b7);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x375ceb,_0x44615b){_0x375ceb=_0x375ceb-0x0;var _0x454640=_0xdbf5[_0x375ceb];return _0x454640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){var _0x226b93=_0x2d3e1b[_0x5dbf('0x22')]({'plain':!![]});var _0x20ab1b=_0x5dbf('0x23');return db[_0x5dbf('0x24')][_0x5dbf('0x21')]({'where':{'type':_0x20ab1b,'resourceId':_0x226b93['id']}})[_0x5dbf('0x20')](function(){return _0x2d3e1b;});})[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x25')]();});}};}function handleEntityNotFound(_0x17f135,_0x466985){return function(_0x3f8341){if(!_0x3f8341){_0x17f135[_0x5dbf('0x16')](0x194);}return _0x3f8341;};}function handleError(_0x22ec42,_0x6a9757){_0x6a9757=_0x6a9757||0x1f4;return function(_0x471027){logger[_0x5dbf('0x26')](_0x471027['stack']);if(_0x471027[_0x5dbf('0x27')]){delete _0x471027[_0x5dbf('0x27')];}_0x22ec42[_0x5dbf('0x17')](_0x6a9757)[_0x5dbf('0x28')](_0x471027);};}exports[_0x5dbf('0x29')]=function(_0x6a276d,_0x2a65c5){var _0x31d57a={},_0x406ce6={},_0x273b63={'count':0x0,'rows':[]};var _0x294dd7=_['map'](db['AnalyticMetric'][_0x5dbf('0x2a')],function(_0x19015a){return{'name':_0x19015a[_0x5dbf('0x2b')],'type':_0x19015a[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x406ce6['model']=_['map'](_0x294dd7,_0x5dbf('0x27'));_0x406ce6[_0x5dbf('0x2e')]=_['keys'](_0x6a276d[_0x5dbf('0x2e')]);_0x406ce6[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],_0x406ce6[_0x5dbf('0x2e')]);_0x31d57a['attributes']=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x32')]));_0x31d57a['attributes']=_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x34')]?_0x31d57a[_0x5dbf('0x33')]:_0x406ce6[_0x5dbf('0x31')];if(!_0x6a276d['query'][_0x5dbf('0x35')](_0x5dbf('0x36'))){_0x31d57a[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x37')]);_0x31d57a[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x19')]);}_0x31d57a[_0x5dbf('0x38')]=qs['sort'](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x39')]);_0x31d57a[_0x5dbf('0x3a')]=qs['filters'](_[_0x5dbf('0x3b')](_0x6a276d[_0x5dbf('0x2e')],_0x406ce6[_0x5dbf('0x2f')]),_0x294dd7);if(_0x6a276d['query'][_0x5dbf('0x3c')]){_0x31d57a[_0x5dbf('0x3a')]=_[_0x5dbf('0x3d')](_0x31d57a['where'],{'$or':_[_0x5dbf('0x3e')](_0x294dd7,function(_0x29a62d){if(_0x29a62d[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x10537d={};_0x10537d[_0x29a62d[_0x5dbf('0x27')]]={'$like':'%'+_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x3c')]+'%'};return _0x10537d;}})});}_0x31d57a=_['merge']({},_0x31d57a,_0x6a276d['options']);var _0x57ee72={'where':_0x31d57a['where']};return db[_0x5dbf('0x40')][_0x5dbf('0x1b')](_0x57ee72)['then'](function(_0x3ef0eb){_0x273b63[_0x5dbf('0x1b')]=_0x3ef0eb;if(_0x6a276d['query'][_0x5dbf('0x41')]){_0x31d57a[_0x5dbf('0x42')]=[{'all':!![]}];}return db[_0x5dbf('0x40')][_0x5dbf('0x43')](_0x31d57a);})[_0x5dbf('0x20')](function(_0x7c390d){_0x273b63[_0x5dbf('0x44')]=_0x7c390d;return _0x273b63;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x2a65c5,_0x31d57a))[_0x5dbf('0x45')](handleError(_0x2a65c5,null));};exports[_0x5dbf('0x46')]=function(_0x50ac70,_0x78aef3){var _0x22f958={'raw':!![],'where':{'id':_0x50ac70['params']['id']}},_0xec1d28={};_0xec1d28[_0x5dbf('0x31')]=_[_0x5dbf('0x47')](db[_0x5dbf('0x40')][_0x5dbf('0x2a')]);_0xec1d28['query']=_[_0x5dbf('0x47')](_0x50ac70['query']);_0xec1d28[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0xec1d28[_0x5dbf('0x31')],_0xec1d28[_0x5dbf('0x2e')]);_0x22f958['attributes']=_['intersection'](_0xec1d28[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x50ac70[_0x5dbf('0x2e')]['fields']));_0x22f958[_0x5dbf('0x33')]=_0x22f958['attributes']['length']?_0x22f958['attributes']:_0xec1d28['model'];if(_0x50ac70[_0x5dbf('0x2e')][_0x5dbf('0x41')]){_0x22f958['include']=[{'all':!![]}];}_0x22f958=_[_0x5dbf('0x3d')]({},_0x22f958,_0x50ac70[_0x5dbf('0x48')]);return db['AnalyticMetric'][_0x5dbf('0x49')](_0x22f958)[_0x5dbf('0x20')](handleEntityNotFound(_0x78aef3,null))['then'](respondWithResult(_0x78aef3,null))[_0x5dbf('0x45')](handleError(_0x78aef3,null));};exports['create']=function(_0x5ab862,_0x337897){return db[_0x5dbf('0x40')][_0x5dbf('0x4a')](_0x5ab862['body'],{})['then'](function(_0x442a43){var _0x3e8612=_0x5ab862[_0x5dbf('0x4b')][_0x5dbf('0x22')]({'plain':!![]});if(!_0x3e8612)throw new Error(_0x5dbf('0x4c'));if(_0x3e8612[_0x5dbf('0x4d')]===_0x5dbf('0x4b')){var _0x319906=_0x442a43['get']({'plain':!![]});var _0x3f38a0=_0x5dbf('0x23');return db[_0x5dbf('0x4e')][_0x5dbf('0x49')]({'where':{'name':_0x3f38a0,'userProfileId':_0x3e8612[_0x5dbf('0x4f')]},'raw':!![]})[_0x5dbf('0x20')](function(_0x328dc5){if(_0x328dc5&&_0x328dc5['autoAssociation']===0x0){return db[_0x5dbf('0x24')]['create']({'name':_0x319906[_0x5dbf('0x27')],'resourceId':_0x319906['id'],'type':_0x328dc5[_0x5dbf('0x27')],'sectionId':_0x328dc5['id']},{})[_0x5dbf('0x20')](function(){return _0x442a43;});}else{return _0x442a43;}})[_0x5dbf('0x45')](function(_0x78ab84){logger[_0x5dbf('0x26')](_0x5dbf('0x50'),_0x78ab84);throw _0x78ab84;});}return _0x442a43;})['then'](respondWithResult(_0x337897,0xc9))['catch'](handleError(_0x337897,null));};exports['update']=function(_0x1e1876,_0xfdacc7){if(_0x1e1876[_0x5dbf('0x51')]['id']){delete _0x1e1876['body']['id'];}return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x1e1876[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0xfdacc7,null))['then'](saveUpdates(_0x1e1876[_0x5dbf('0x51')],null))['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0x45')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x21')]=function(_0x2145ea,_0x5da14b){return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x2145ea[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x5da14b,null))[_0x5dbf('0x20')](removeEntity(_0x5da14b,null))['catch'](handleError(_0x5da14b,null));}; \ No newline at end of file +var _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x104993,_0x3f9a6b){var _0x105a96=function(_0x4ad1cb){while(--_0x4ad1cb){_0x104993['push'](_0x104993['shift']());}};_0x105a96(++_0x3f9a6b);}(_0x81bd,0x7c));var _0xd81b=function(_0x21bf0d,_0x91bf98){_0x21bf0d=_0x21bf0d-0x0;var _0x561491=_0x81bd[_0x21bf0d];return _0x561491;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index decfd4e..c376cca 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 _0xe451=['../../config/environment','exports','AnalyticMetric','analytics_metrics','../../config/logger','request-promise','path','rimraf'];(function(_0x2f1214,_0x45afd5){var _0x2d7c0c=function(_0x1fb813){while(--_0x1fb813){_0x2f1214['push'](_0x2f1214['shift']());}};_0x2d7c0c(++_0x45afd5);}(_0xe451,0xec));var _0x1e45=function(_0x16a6ce,_0x5750fd){_0x16a6ce=_0x16a6ce-0x0;var _0x4e3af7=_0xe451[_0x16a6ce];return _0x4e3af7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e45('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1e45('0x1'));var fs=require('fs');var path=require(_0x1e45('0x2'));var rimraf=require(_0x1e45('0x3'));var config=require(_0x1e45('0x4'));var attributes=require('./analyticMetric.attributes');module[_0x1e45('0x5')]=function(_0x1a163c,_0x115f88){return _0x1a163c['define'](_0x1e45('0x6'),attributes,{'tableName':_0x1e45('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc051=['analytics_metrics','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x167303,_0x52e7c0){var _0x1059af=function(_0x23a495){while(--_0x23a495){_0x167303['push'](_0x167303['shift']());}};_0x1059af(++_0x52e7c0);}(_0xc051,0xb5));var _0x1c05=function(_0x31be5c,_0x3bcff7){_0x31be5c=_0x31be5c-0x0;var _0x60979=_0xc051[_0x31be5c];return _0x60979;};'use strict';var _=require(_0x1c05('0x0'));var util=require(_0x1c05('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1c05('0x2'));var BPromise=require(_0x1c05('0x3'));var rp=require(_0x1c05('0x4'));var fs=require('fs');var path=require(_0x1c05('0x5'));var rimraf=require('rimraf');var config=require(_0x1c05('0x6'));var attributes=require(_0x1c05('0x7'));module[_0x1c05('0x8')]=function(_0x294fcb,_0x14284f){return _0x294fcb[_0x1c05('0x9')](_0x1c05('0xa'),attributes,{'tableName':_0x1c05('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index bbaaca7..74baba1 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 _0x77b0=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77b0,0x9c));var _0x077b=function(_0x5915dd,_0x207d7b){_0x5915dd=_0x5915dd-0x0;var _0x4ea472=_0x77b0[_0x5915dd];return _0x4ea472;};'use strict';var _=require('lodash');var util=require(_0x077b('0x0'));var moment=require(_0x077b('0x1'));var BPromise=require(_0x077b('0x2'));var rs=require(_0x077b('0x3'));var fs=require('fs');var Redis=require(_0x077b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x077b('0x5'));var logger=require(_0x077b('0x6'))(_0x077b('0x7'));var config=require(_0x077b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x077b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47fc28,_0x1a1d88,_0x3402bb){return new BPromise(function(_0x4c4a1d,_0x1e9193){return client[_0x077b('0xa')](_0x47fc28,_0x3402bb)['then'](function(_0x2f6c06){logger['info'](_0x077b('0xb'),_0x1a1d88,_0x077b('0xc'));logger[_0x077b('0xd')](_0x077b('0xe'),_0x1a1d88,_0x077b('0xc'),JSON[_0x077b('0xf')](_0x2f6c06));if(_0x2f6c06[_0x077b('0x10')]){if(_0x2f6c06['error'][_0x077b('0x11')]===0x1f4){logger[_0x077b('0x10')](_0x077b('0xb'),_0x1a1d88,_0x2f6c06[_0x077b('0x10')][_0x077b('0x12')]);return _0x1e9193(_0x2f6c06[_0x077b('0x10')][_0x077b('0x12')]);}logger['error'](_0x077b('0xb'),_0x1a1d88,_0x2f6c06[_0x077b('0x10')][_0x077b('0x12')]);return _0x4c4a1d(_0x2f6c06[_0x077b('0x10')][_0x077b('0x12')]);}else{logger[_0x077b('0x13')](_0x077b('0xb'),_0x1a1d88,_0x077b('0xc'));_0x4c4a1d(_0x2f6c06[_0x077b('0x14')][_0x077b('0x12')]);}})[_0x077b('0x15')](function(_0x42efc2){logger[_0x077b('0x10')](_0x077b('0xb'),_0x1a1d88,_0x42efc2);_0x1e9193(_0x42efc2);});});} \ No newline at end of file +var _0x7dd0=['rpc','../../config/environment','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34bd11,_0x322433){var _0x2a4f5c=function(_0x3296e3){while(--_0x3296e3){_0x34bd11['push'](_0x34bd11['shift']());}};_0x2a4f5c(++_0x322433);}(_0x7dd0,0xa1));var _0x07dd=function(_0x2a13b3,_0x485e11){_0x2a13b3=_0x2a13b3-0x0;var _0x43f830=_0x7dd0[_0x2a13b3];return _0x43f830;};'use strict';var _=require('lodash');var util=require(_0x07dd('0x0'));var moment=require(_0x07dd('0x1'));var BPromise=require(_0x07dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07dd('0x3'));var db=require(_0x07dd('0x4'))['db'];var utils=require(_0x07dd('0x5'));var logger=require(_0x07dd('0x6'))(_0x07dd('0x7'));var config=require(_0x07dd('0x8'));var jayson=require(_0x07dd('0x9'));var client=jayson[_0x07dd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43489e,_0x2ba48e,_0x5250fa){return new BPromise(function(_0xda5650,_0x598685){return client[_0x07dd('0xb')](_0x43489e,_0x5250fa)['then'](function(_0xd8c512){logger[_0x07dd('0xc')](_0x07dd('0xd'),_0x2ba48e,_0x07dd('0xe'));logger[_0x07dd('0xf')](_0x07dd('0x10'),_0x2ba48e,_0x07dd('0xe'),JSON['stringify'](_0xd8c512));if(_0xd8c512[_0x07dd('0x11')]){if(_0xd8c512[_0x07dd('0x11')][_0x07dd('0x12')]===0x1f4){logger[_0x07dd('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x2ba48e,_0xd8c512['error'][_0x07dd('0x13')]);return _0x598685(_0xd8c512['error'][_0x07dd('0x13')]);}logger['error'](_0x07dd('0xd'),_0x2ba48e,_0xd8c512[_0x07dd('0x11')][_0x07dd('0x13')]);return _0xda5650(_0xd8c512[_0x07dd('0x11')]['message']);}else{logger[_0x07dd('0xc')](_0x07dd('0xd'),_0x2ba48e,_0x07dd('0xe'));_0xda5650(_0xd8c512[_0x07dd('0x14')][_0x07dd('0x13')]);}})['catch'](function(_0x1c398e){logger[_0x07dd('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x2ba48e,_0x1c398e);_0x598685(_0x1c398e);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index a9f5949..a5b28a2 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 _0xfb82=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x50327e,_0x2f02e5){var _0x1712a2=function(_0x17478b){while(--_0x17478b){_0x50327e['push'](_0x50327e['shift']());}};_0x1712a2(++_0x2f02e5);}(_0xfb82,0x17f));var _0x2fb8=function(_0x4c6f9c,_0x2b791c){_0x4c6f9c=_0x4c6f9c-0x0;var _0x5e028e=_0xfb82[_0x4c6f9c];return _0x5e028e;};'use strict';var multer=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var path=require(_0x2fb8('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fb8('0x3'));var router=express[_0x2fb8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2fb8('0x5'));var interaction=require(_0x2fb8('0x6'));var config=require(_0x2fb8('0x7'));var controller=require(_0x2fb8('0x8'));router[_0x2fb8('0x9')]('/',auth[_0x2fb8('0xa')](),controller[_0x2fb8('0xb')]);router[_0x2fb8('0x9')](_0x2fb8('0xc'),auth[_0x2fb8('0xa')](),controller['show']);router[_0x2fb8('0xd')]('/',auth[_0x2fb8('0xa')](),controller[_0x2fb8('0xe')]);router[_0x2fb8('0xf')](_0x2fb8('0xc'),auth[_0x2fb8('0xa')](),controller[_0x2fb8('0x10')]);router[_0x2fb8('0x11')](_0x2fb8('0xc'),auth[_0x2fb8('0xa')](),controller[_0x2fb8('0x12')]);module['exports']=router; \ No newline at end of file +var _0xce1a=['../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','get','/:id','put','update','exports','multer','express','Router','fs-extra'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xce1a,0xbf));var _0xace1=function(_0x25ad7f,_0x13d63a){_0x25ad7f=_0x25ad7f-0x0;var _0x27ec9d=_0xce1a[_0x25ad7f];return _0x27ec9d;};'use strict';var multer=require(_0xace1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xace1('0x1'));var router=express[_0xace1('0x2')]();var fs_extra=require(_0xace1('0x3'));var auth=require(_0xace1('0x4'));var interaction=require(_0xace1('0x5'));var config=require('../../config/environment');var controller=require(_0xace1('0x6'));router['get']('/',auth[_0xace1('0x7')](),controller['index']);router[_0xace1('0x8')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['show']);router['post']('/',auth[_0xace1('0x7')](),controller['create']);router[_0xace1('0xa')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller[_0xace1('0xb')]);router['delete'](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['destroy']);module[_0xace1('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 3091e78..d4bf913 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 _0xc8e7=['sequelize','exports','TEXT'];(function(_0x520a1c,_0x45b58b){var _0x3af0fa=function(_0x33e20e){while(--_0x33e20e){_0x520a1c['push'](_0x520a1c['shift']());}};_0x3af0fa(++_0x45b58b);}(_0xc8e7,0x1e6));var _0x7c8e=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0xc8e7[_0x1daaa9];return _0x1dd221;};'use strict';var Sequelize=require(_0x7c8e('0x0'));module[_0x7c8e('0x1')]={'tree':{'type':Sequelize[_0x7c8e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x222f=['sequelize','exports','TEXT'];(function(_0x1b964a,_0x40fdc2){var _0x2559fa=function(_0x1afe3e){while(--_0x1afe3e){_0x1b964a['push'](_0x1b964a['shift']());}};_0x2559fa(++_0x40fdc2);}(_0x222f,0x1a4));var _0xf222=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0x222f[_0x2a4fe2];return _0x225c4a;};'use strict';var Sequelize=require(_0xf222('0x0'));module[_0xf222('0x1')]={'tree':{'type':Sequelize[_0xf222('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index efe86ac..9615252 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 _0x6949=['AnalyticTreeReport','count','includeAll','include','findAll','rows','catch','show','params','merge','find','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6949,0xa2));var _0x9694=function(_0x4a0f16,_0x21ba18){_0x4a0f16=_0x4a0f16-0x0;var _0x45d653=_0x6949[_0x4a0f16];return _0x45d653;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9694('0x0'));var zipdir=require(_0x9694('0x1'));var jsonpatch=require(_0x9694('0x2'));var rp=require('request-promise');var moment=require(_0x9694('0x3'));var BPromise=require(_0x9694('0x4'));var Mustache=require(_0x9694('0x5'));var util=require(_0x9694('0x6'));var path=require(_0x9694('0x7'));var sox=require(_0x9694('0x8'));var csv=require(_0x9694('0x9'));var ejs=require(_0x9694('0xa'));var fs=require('fs');var fs_extra=require(_0x9694('0xb'));var _=require(_0x9694('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9694('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9694('0x9'));var querystring=require(_0x9694('0xe'));var Papa=require(_0x9694('0xf'));var Redis=require(_0x9694('0x10'));var authService=require(_0x9694('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9694('0x12'));var hardwareService=require(_0x9694('0x13'));var logger=require(_0x9694('0x14'))(_0x9694('0x15'));var utils=require(_0x9694('0x16'));var config=require(_0x9694('0x17'));var licenseUtil=require(_0x9694('0x18'));var db=require(_0x9694('0x19'))['db'];function respondWithStatusCode(_0x35af6b,_0x50fa3c){_0x50fa3c=_0x50fa3c||0xcc;return function(_0x2cee54){if(_0x2cee54){return _0x35af6b[_0x9694('0x1a')](_0x50fa3c);}return _0x35af6b[_0x9694('0x1b')](_0x50fa3c)[_0x9694('0x1c')]();};}function respondWithResult(_0x4ef570,_0x394493){_0x394493=_0x394493||0xc8;return function(_0x3492de){if(_0x3492de){return _0x4ef570[_0x9694('0x1b')](_0x394493)[_0x9694('0x1d')](_0x3492de);}};}function respondWithFilteredResult(_0x356c2b,_0xfb4902){return function(_0x42a395){if(_0x42a395){var _0xaaeef6=typeof _0xfb4902[_0x9694('0x1e')]===_0x9694('0x1f')&&typeof _0xfb4902[_0x9694('0x20')]===_0x9694('0x1f');var _0x7fb792=_0x42a395['count'];var _0x32004b=_0xaaeef6?0x0:_0xfb4902[_0x9694('0x1e')];var _0x417502=_0xaaeef6?_0x42a395['count']:_0xfb4902[_0x9694('0x1e')]+_0xfb4902[_0x9694('0x20')];var _0x279752;if(_0x417502>=_0x7fb792){_0x417502=_0x7fb792;_0x279752=0xc8;}else{_0x279752=0xce;}_0x356c2b[_0x9694('0x1b')](_0x279752);return _0x356c2b[_0x9694('0x21')]('Content-Range',_0x32004b+'-'+_0x417502+'/'+_0x7fb792)[_0x9694('0x1d')](_0x42a395);}return null;};}function patchUpdates(_0x3814e0){return function(_0x56b457){try{jsonpatch[_0x9694('0x22')](_0x56b457,_0x3814e0,!![]);}catch(_0xebc752){return BPromise[_0x9694('0x23')](_0xebc752);}return _0x56b457[_0x9694('0x24')]();};}function saveUpdates(_0x2b7a85,_0x21104b){return function(_0x3f5a31){if(_0x3f5a31){return _0x3f5a31[_0x9694('0x25')](_0x2b7a85)['then'](function(_0x94cf43){return _0x94cf43;});}return null;};}function removeEntity(_0x57fbc8,_0x23498f){return function(_0x3c3e4b){if(_0x3c3e4b){return _0x3c3e4b[_0x9694('0x26')]()[_0x9694('0x27')](function(){_0x57fbc8[_0x9694('0x1b')](0xcc)[_0x9694('0x1c')]();});}};}function handleEntityNotFound(_0x21d335,_0x1b8a88){return function(_0x3f8dc4){if(!_0x3f8dc4){_0x21d335[_0x9694('0x1a')](0x194);}return _0x3f8dc4;};}function handleError(_0x2b32ff,_0x53f34d){_0x53f34d=_0x53f34d||0x1f4;return function(_0x1a39b2){logger[_0x9694('0x28')](_0x1a39b2[_0x9694('0x29')]);if(_0x1a39b2[_0x9694('0x2a')]){delete _0x1a39b2[_0x9694('0x2a')];}_0x2b32ff[_0x9694('0x1b')](_0x53f34d)['send'](_0x1a39b2);};}exports[_0x9694('0x2b')]=function(_0x2a8afc,_0x2baad){var _0x181ac2={},_0x211347={},_0x1a5850={'count':0x0,'rows':[]};var _0x302f58=_[_0x9694('0x2c')](db['AnalyticTreeReport'][_0x9694('0x2d')],function(_0x5e54b5){return{'name':_0x5e54b5['fieldName'],'type':_0x5e54b5[_0x9694('0x2e')]['key']};});_0x211347[_0x9694('0x2f')]=_['map'](_0x302f58,'name');_0x211347[_0x9694('0x30')]=_[_0x9694('0x31')](_0x2a8afc[_0x9694('0x30')]);_0x211347[_0x9694('0x32')]=_[_0x9694('0x33')](_0x211347[_0x9694('0x2f')],_0x211347[_0x9694('0x30')]);_0x181ac2[_0x9694('0x34')]=_[_0x9694('0x33')](_0x211347[_0x9694('0x2f')],qs[_0x9694('0x35')](_0x2a8afc[_0x9694('0x30')][_0x9694('0x35')]));_0x181ac2[_0x9694('0x34')]=_0x181ac2[_0x9694('0x34')][_0x9694('0x36')]?_0x181ac2[_0x9694('0x34')]:_0x211347['model'];if(!_0x2a8afc[_0x9694('0x30')][_0x9694('0x37')](_0x9694('0x38'))){_0x181ac2[_0x9694('0x20')]=qs['limit'](_0x2a8afc[_0x9694('0x30')][_0x9694('0x20')]);_0x181ac2[_0x9694('0x1e')]=qs['offset'](_0x2a8afc['query'][_0x9694('0x1e')]);}_0x181ac2['order']=qs[_0x9694('0x39')](_0x2a8afc[_0x9694('0x30')][_0x9694('0x39')]);_0x181ac2[_0x9694('0x3a')]=qs[_0x9694('0x32')](_[_0x9694('0x3b')](_0x2a8afc['query'],_0x211347['filters']),_0x302f58);if(_0x2a8afc[_0x9694('0x30')]['filter']){_0x181ac2[_0x9694('0x3a')]=_['merge'](_0x181ac2['where'],{'$or':_[_0x9694('0x2c')](_0x302f58,function(_0x416d5f){if(_0x416d5f['type']!==_0x9694('0x3c')){var _0x365bfb={};_0x365bfb[_0x416d5f['name']]={'$like':'%'+_0x2a8afc[_0x9694('0x30')][_0x9694('0x3d')]+'%'};return _0x365bfb;}})});}_0x181ac2=_['merge']({},_0x181ac2,_0x2a8afc[_0x9694('0x3e')]);var _0x38e812={'where':_0x181ac2[_0x9694('0x3a')]};return db[_0x9694('0x3f')][_0x9694('0x40')](_0x38e812)[_0x9694('0x27')](function(_0x3a0d23){_0x1a5850[_0x9694('0x40')]=_0x3a0d23;if(_0x2a8afc[_0x9694('0x30')][_0x9694('0x41')]){_0x181ac2[_0x9694('0x42')]=[{'all':!![]}];}return db[_0x9694('0x3f')][_0x9694('0x43')](_0x181ac2);})[_0x9694('0x27')](function(_0x3430a8){_0x1a5850[_0x9694('0x44')]=_0x3430a8;return _0x1a5850;})[_0x9694('0x27')](respondWithFilteredResult(_0x2baad,_0x181ac2))[_0x9694('0x45')](handleError(_0x2baad,null));};exports[_0x9694('0x46')]=function(_0x567cbd,_0x3515c7){var _0x4f5d03={'raw':!![],'where':{'id':_0x567cbd[_0x9694('0x47')]['id']}},_0x48f6b3={};_0x48f6b3['model']=_[_0x9694('0x31')](db['AnalyticTreeReport']['rawAttributes']);_0x48f6b3['query']=_[_0x9694('0x31')](_0x567cbd[_0x9694('0x30')]);_0x48f6b3[_0x9694('0x32')]=_[_0x9694('0x33')](_0x48f6b3[_0x9694('0x2f')],_0x48f6b3[_0x9694('0x30')]);_0x4f5d03['attributes']=_[_0x9694('0x33')](_0x48f6b3[_0x9694('0x2f')],qs[_0x9694('0x35')](_0x567cbd[_0x9694('0x30')][_0x9694('0x35')]));_0x4f5d03['attributes']=_0x4f5d03[_0x9694('0x34')][_0x9694('0x36')]?_0x4f5d03[_0x9694('0x34')]:_0x48f6b3[_0x9694('0x2f')];if(_0x567cbd[_0x9694('0x30')][_0x9694('0x41')]){_0x4f5d03['include']=[{'all':!![]}];}_0x4f5d03=_[_0x9694('0x48')]({},_0x4f5d03,_0x567cbd[_0x9694('0x3e')]);return db['AnalyticTreeReport'][_0x9694('0x49')](_0x4f5d03)['then'](handleEntityNotFound(_0x3515c7,null))[_0x9694('0x27')](respondWithResult(_0x3515c7,null))['catch'](handleError(_0x3515c7,null));};exports['create']=function(_0x699260,_0x3a4c1c){return db[_0x9694('0x3f')]['create'](_0x699260[_0x9694('0x4a')],{})[_0x9694('0x27')](respondWithResult(_0x3a4c1c,0xc9))[_0x9694('0x45')](handleError(_0x3a4c1c,null));};exports[_0x9694('0x25')]=function(_0x28284f,_0x216dc2){if(_0x28284f[_0x9694('0x4a')]['id']){delete _0x28284f[_0x9694('0x4a')]['id'];}return db[_0x9694('0x3f')][_0x9694('0x49')]({'where':{'id':_0x28284f[_0x9694('0x47')]['id']}})['then'](handleEntityNotFound(_0x216dc2,null))[_0x9694('0x27')](saveUpdates(_0x28284f['body'],null))[_0x9694('0x27')](respondWithResult(_0x216dc2,null))[_0x9694('0x45')](handleError(_0x216dc2,null));};exports['destroy']=function(_0x39fbce,_0x1c6087){return db[_0x9694('0x3f')][_0x9694('0x49')]({'where':{'id':_0x39fbce[_0x9694('0x47')]['id']}})[_0x9694('0x27')](handleEntityNotFound(_0x1c6087,null))[_0x9694('0x27')](removeEntity(_0x1c6087,null))[_0x9694('0x45')](handleError(_0x1c6087,null));}; \ No newline at end of file +var _0x0ed6=['util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','reject','update','then','destroy','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','order','sort','where','merge','filter','options','includeAll','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x3fd108,_0x5d911f){var _0x4f943f=function(_0x12abdf){while(--_0x12abdf){_0x3fd108['push'](_0x3fd108['shift']());}};_0x4f943f(++_0x5d911f);}(_0x0ed6,0x1dd));var _0x60ed=function(_0x57545b,_0x55be65){_0x57545b=_0x57545b-0x0;var _0x56cc26=_0x0ed6[_0x57545b];return _0x56cc26;};'use strict';var emlformat=require(_0x60ed('0x0'));var rimraf=require(_0x60ed('0x1'));var zipdir=require(_0x60ed('0x2'));var jsonpatch=require(_0x60ed('0x3'));var rp=require(_0x60ed('0x4'));var moment=require('moment');var BPromise=require(_0x60ed('0x5'));var Mustache=require('mustache');var util=require(_0x60ed('0x6'));var path=require(_0x60ed('0x7'));var sox=require(_0x60ed('0x8'));var csv=require('to-csv');var ejs=require(_0x60ed('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60ed('0xa'));var squel=require(_0x60ed('0xb'));var crypto=require(_0x60ed('0xc'));var jsforce=require(_0x60ed('0xd'));var deskjs=require(_0x60ed('0xe'));var toCsv=require(_0x60ed('0xf'));var querystring=require(_0x60ed('0x10'));var Papa=require('papaparse');var Redis=require(_0x60ed('0x11'));var authService=require(_0x60ed('0x12'));var qs=require(_0x60ed('0x13'));var as=require(_0x60ed('0x14'));var hardwareService=require(_0x60ed('0x15'));var logger=require(_0x60ed('0x16'))('api');var utils=require(_0x60ed('0x17'));var config=require(_0x60ed('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x60ed('0x19'))['db'];function respondWithStatusCode(_0x5034fb,_0x1368f3){_0x1368f3=_0x1368f3||0xcc;return function(_0x22cf43){if(_0x22cf43){return _0x5034fb['sendStatus'](_0x1368f3);}return _0x5034fb[_0x60ed('0x1a')](_0x1368f3)[_0x60ed('0x1b')]();};}function respondWithResult(_0x2454fd,_0x342786){_0x342786=_0x342786||0xc8;return function(_0x450806){if(_0x450806){return _0x2454fd[_0x60ed('0x1a')](_0x342786)['json'](_0x450806);}};}function respondWithFilteredResult(_0x4de931,_0x2f54b5){return function(_0x5cdb7b){if(_0x5cdb7b){var _0x23b4c1=typeof _0x2f54b5[_0x60ed('0x1c')]==='undefined'&&typeof _0x2f54b5[_0x60ed('0x1d')]===_0x60ed('0x1e');var _0x4864e7=_0x5cdb7b[_0x60ed('0x1f')];var _0x299150=_0x23b4c1?0x0:_0x2f54b5[_0x60ed('0x1c')];var _0x26de47=_0x23b4c1?_0x5cdb7b[_0x60ed('0x1f')]:_0x2f54b5['offset']+_0x2f54b5['limit'];var _0x4714ea;if(_0x26de47>=_0x4864e7){_0x26de47=_0x4864e7;_0x4714ea=0xc8;}else{_0x4714ea=0xce;}_0x4de931[_0x60ed('0x1a')](_0x4714ea);return _0x4de931[_0x60ed('0x20')]('Content-Range',_0x299150+'-'+_0x26de47+'/'+_0x4864e7)[_0x60ed('0x21')](_0x5cdb7b);}return null;};}function patchUpdates(_0x2d5caa){return function(_0xced070){try{jsonpatch[_0x60ed('0x22')](_0xced070,_0x2d5caa,!![]);}catch(_0x5d8166){return BPromise[_0x60ed('0x23')](_0x5d8166);}return _0xced070['save']();};}function saveUpdates(_0x1c2a97,_0x20d2a1){return function(_0x124c15){if(_0x124c15){return _0x124c15[_0x60ed('0x24')](_0x1c2a97)[_0x60ed('0x25')](function(_0x3f297e){return _0x3f297e;});}return null;};}function removeEntity(_0x16d94e,_0x56c2d2){return function(_0x23bbd0){if(_0x23bbd0){return _0x23bbd0[_0x60ed('0x26')]()['then'](function(){_0x16d94e[_0x60ed('0x1a')](0xcc)[_0x60ed('0x1b')]();});}};}function handleEntityNotFound(_0x347f45,_0x1c8fb8){return function(_0x4aadf5){if(!_0x4aadf5){_0x347f45['sendStatus'](0x194);}return _0x4aadf5;};}function handleError(_0x13c496,_0x25b91e){_0x25b91e=_0x25b91e||0x1f4;return function(_0x4c8262){logger['error'](_0x4c8262[_0x60ed('0x27')]);if(_0x4c8262[_0x60ed('0x28')]){delete _0x4c8262[_0x60ed('0x28')];}_0x13c496[_0x60ed('0x1a')](_0x25b91e)[_0x60ed('0x29')](_0x4c8262);};}exports[_0x60ed('0x2a')]=function(_0x5e7f1f,_0x1c5da4){var _0x510c1d={},_0x4cb8ce={},_0x279883={'count':0x0,'rows':[]};var _0x2effba=_['map'](db[_0x60ed('0x2b')][_0x60ed('0x2c')],function(_0x23fd13){return{'name':_0x23fd13[_0x60ed('0x2d')],'type':_0x23fd13[_0x60ed('0x2e')][_0x60ed('0x2f')]};});_0x4cb8ce[_0x60ed('0x30')]=_[_0x60ed('0x31')](_0x2effba,_0x60ed('0x28'));_0x4cb8ce['query']=_[_0x60ed('0x32')](_0x5e7f1f[_0x60ed('0x33')]);_0x4cb8ce[_0x60ed('0x34')]=_[_0x60ed('0x35')](_0x4cb8ce[_0x60ed('0x30')],_0x4cb8ce[_0x60ed('0x33')]);_0x510c1d[_0x60ed('0x36')]=_[_0x60ed('0x35')](_0x4cb8ce['model'],qs[_0x60ed('0x37')](_0x5e7f1f[_0x60ed('0x33')][_0x60ed('0x37')]));_0x510c1d[_0x60ed('0x36')]=_0x510c1d[_0x60ed('0x36')][_0x60ed('0x38')]?_0x510c1d[_0x60ed('0x36')]:_0x4cb8ce[_0x60ed('0x30')];if(!_0x5e7f1f[_0x60ed('0x33')]['hasOwnProperty']('nolimit')){_0x510c1d[_0x60ed('0x1d')]=qs[_0x60ed('0x1d')](_0x5e7f1f[_0x60ed('0x33')]['limit']);_0x510c1d[_0x60ed('0x1c')]=qs[_0x60ed('0x1c')](_0x5e7f1f[_0x60ed('0x33')][_0x60ed('0x1c')]);}_0x510c1d[_0x60ed('0x39')]=qs[_0x60ed('0x3a')](_0x5e7f1f['query'][_0x60ed('0x3a')]);_0x510c1d['where']=qs[_0x60ed('0x34')](_['pick'](_0x5e7f1f[_0x60ed('0x33')],_0x4cb8ce[_0x60ed('0x34')]),_0x2effba);if(_0x5e7f1f[_0x60ed('0x33')]['filter']){_0x510c1d[_0x60ed('0x3b')]=_[_0x60ed('0x3c')](_0x510c1d[_0x60ed('0x3b')],{'$or':_[_0x60ed('0x31')](_0x2effba,function(_0x45317f){if(_0x45317f['type']!=='VIRTUAL'){var _0x4742c4={};_0x4742c4[_0x45317f[_0x60ed('0x28')]]={'$like':'%'+_0x5e7f1f[_0x60ed('0x33')][_0x60ed('0x3d')]+'%'};return _0x4742c4;}})});}_0x510c1d=_[_0x60ed('0x3c')]({},_0x510c1d,_0x5e7f1f[_0x60ed('0x3e')]);var _0x38f860={'where':_0x510c1d['where']};return db[_0x60ed('0x2b')][_0x60ed('0x1f')](_0x38f860)[_0x60ed('0x25')](function(_0x4c7065){_0x279883[_0x60ed('0x1f')]=_0x4c7065;if(_0x5e7f1f[_0x60ed('0x33')]['includeAll']){_0x510c1d['include']=[{'all':!![]}];}return db[_0x60ed('0x2b')]['findAll'](_0x510c1d);})[_0x60ed('0x25')](function(_0x49cc95){_0x279883['rows']=_0x49cc95;return _0x279883;})['then'](respondWithFilteredResult(_0x1c5da4,_0x510c1d))['catch'](handleError(_0x1c5da4,null));};exports['show']=function(_0x210d8a,_0xb0b6c){var _0x37d8da={'raw':!![],'where':{'id':_0x210d8a['params']['id']}},_0x58d816={};_0x58d816[_0x60ed('0x30')]=_[_0x60ed('0x32')](db[_0x60ed('0x2b')][_0x60ed('0x2c')]);_0x58d816[_0x60ed('0x33')]=_['keys'](_0x210d8a['query']);_0x58d816[_0x60ed('0x34')]=_['intersection'](_0x58d816['model'],_0x58d816[_0x60ed('0x33')]);_0x37d8da['attributes']=_[_0x60ed('0x35')](_0x58d816[_0x60ed('0x30')],qs[_0x60ed('0x37')](_0x210d8a[_0x60ed('0x33')][_0x60ed('0x37')]));_0x37d8da[_0x60ed('0x36')]=_0x37d8da['attributes'][_0x60ed('0x38')]?_0x37d8da[_0x60ed('0x36')]:_0x58d816[_0x60ed('0x30')];if(_0x210d8a[_0x60ed('0x33')][_0x60ed('0x3f')]){_0x37d8da['include']=[{'all':!![]}];}_0x37d8da=_[_0x60ed('0x3c')]({},_0x37d8da,_0x210d8a[_0x60ed('0x3e')]);return db[_0x60ed('0x2b')]['find'](_0x37d8da)[_0x60ed('0x25')](handleEntityNotFound(_0xb0b6c,null))[_0x60ed('0x25')](respondWithResult(_0xb0b6c,null))[_0x60ed('0x40')](handleError(_0xb0b6c,null));};exports[_0x60ed('0x41')]=function(_0x5cabdf,_0x1d3033){return db[_0x60ed('0x2b')][_0x60ed('0x41')](_0x5cabdf[_0x60ed('0x42')],{})[_0x60ed('0x25')](respondWithResult(_0x1d3033,0xc9))[_0x60ed('0x40')](handleError(_0x1d3033,null));};exports[_0x60ed('0x24')]=function(_0x4801b3,_0xdc964c){if(_0x4801b3['body']['id']){delete _0x4801b3['body']['id'];}return db[_0x60ed('0x2b')][_0x60ed('0x43')]({'where':{'id':_0x4801b3[_0x60ed('0x44')]['id']}})[_0x60ed('0x25')](handleEntityNotFound(_0xdc964c,null))[_0x60ed('0x25')](saveUpdates(_0x4801b3[_0x60ed('0x42')],null))[_0x60ed('0x25')](respondWithResult(_0xdc964c,null))[_0x60ed('0x40')](handleError(_0xdc964c,null));};exports[_0x60ed('0x26')]=function(_0x2dc288,_0xd63e9f){return db[_0x60ed('0x2b')]['find']({'where':{'id':_0x2dc288[_0x60ed('0x44')]['id']}})['then'](handleEntityNotFound(_0xd63e9f,null))[_0x60ed('0x25')](removeEntity(_0xd63e9f,null))[_0x60ed('0x40')](handleError(_0xd63e9f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 04ca673..fc46e97 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 _0xed8a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','util','../../config/logger','api'];(function(_0x222342,_0x29c2a8){var _0x517efb=function(_0x4bccfb){while(--_0x4bccfb){_0x222342['push'](_0x222342['shift']());}};_0x517efb(++_0x29c2a8);}(_0xed8a,0x1c5));var _0xaed8=function(_0x105426,_0x1f5361){_0x105426=_0x105426-0x0;var _0x2a37d1=_0xed8a[_0x105426];return _0x2a37d1;};'use strict';var _=require('lodash');var util=require(_0xaed8('0x0'));var logger=require(_0xaed8('0x1'))(_0xaed8('0x2'));var moment=require(_0xaed8('0x3'));var BPromise=require(_0xaed8('0x4'));var rp=require(_0xaed8('0x5'));var fs=require('fs');var path=require(_0xaed8('0x6'));var rimraf=require(_0xaed8('0x7'));var config=require(_0xaed8('0x8'));var attributes=require(_0xaed8('0x9'));module[_0xaed8('0xa')]=function(_0xf24325,_0x8d3efb){return _0xf24325['define'](_0xaed8('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f45=['./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','bluebird','path'];(function(_0x1701b9,_0x3aad79){var _0x102312=function(_0x5f1545){while(--_0x5f1545){_0x1701b9['push'](_0x1701b9['shift']());}};_0x102312(++_0x3aad79);}(_0x1f45,0x87));var _0x51f4=function(_0x56d2e5,_0x1151b9){_0x56d2e5=_0x56d2e5-0x0;var _0x1677b7=_0x1f45[_0x56d2e5];return _0x1677b7;};'use strict';var _=require('lodash');var util=require(_0x51f4('0x0'));var logger=require(_0x51f4('0x1'))(_0x51f4('0x2'));var moment=require('moment');var BPromise=require(_0x51f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51f4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x51f4('0x5'));module[_0x51f4('0x6')]=function(_0x46fbdc,_0x225acd){return _0x46fbdc[_0x51f4('0x7')](_0x51f4('0x8'),attributes,{'tableName':_0x51f4('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 f3be3db..1188e46 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x380b08,_0x1df63a){var _0x22f65d=function(_0x507f73){while(--_0x507f73){_0x380b08['push'](_0x380b08['shift']());}};_0x22f65d(++_0x1df63a);}(_0xadb5,0xad));var _0x5adb=function(_0x3f508f,_0x36cd15){_0x3f508f=_0x3f508f-0x0;var _0x5be915=_0xadb5[_0x3f508f];return _0x5be915;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x10f683,_0x285ba1){_0x10f683=_0x10f683-0x0;var _0x61f5c9=_0x7a54[_0x10f683];return _0x61f5c9;};'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 b234e33..6602fa8 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 _0x3ab7=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','isAuthenticated','get','/:id','show','post','create','put','delete','destroy'];(function(_0x5791f3,_0x5d5453){var _0x1564a2=function(_0x2f3037){while(--_0x2f3037){_0x5791f3['push'](_0x5791f3['shift']());}};_0x1564a2(++_0x5d5453);}(_0x3ab7,0x1b6));var _0x73ab=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x3ab7[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x73ab('0x0'));var util=require('util');var path=require(_0x73ab('0x1'));var timeout=require(_0x73ab('0x2'));var express=require(_0x73ab('0x3'));var router=express[_0x73ab('0x4')]();var fs_extra=require(_0x73ab('0x5'));var auth=require(_0x73ab('0x6'));var interaction=require(_0x73ab('0x7'));var config=require('../../config/environment');var controller=require(_0x73ab('0x8'));router['get']('/',auth[_0x73ab('0x9')](),controller['index']);router[_0x73ab('0xa')](_0x73ab('0xb'),auth[_0x73ab('0x9')](),controller[_0x73ab('0xc')]);router[_0x73ab('0xd')]('/',auth[_0x73ab('0x9')](),controller[_0x73ab('0xe')]);router[_0x73ab('0xf')](_0x73ab('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x73ab('0x10')](_0x73ab('0xb'),auth[_0x73ab('0x9')](),controller[_0x73ab('0x11')]);module[_0x73ab('0x12')]=router; \ No newline at end of file +var _0xf02b=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x2ce3b3,_0x2da0da){var _0x1214b3=function(_0x1ce84b){while(--_0x1ce84b){_0x2ce3b3['push'](_0x2ce3b3['shift']());}};_0x1214b3(++_0x2da0da);}(_0xf02b,0x1e3));var _0xbf02=function(_0xe8b9c7,_0x534838){_0xe8b9c7=_0xe8b9c7-0x0;var _0x4b606f=_0xf02b[_0xe8b9c7];return _0x4b606f;};'use strict';var multer=require(_0xbf02('0x0'));var util=require('util');var path=require(_0xbf02('0x1'));var timeout=require(_0xbf02('0x2'));var express=require(_0xbf02('0x3'));var router=express[_0xbf02('0x4')]();var fs_extra=require(_0xbf02('0x5'));var auth=require(_0xbf02('0x6'));var interaction=require(_0xbf02('0x7'));var config=require(_0xbf02('0x8'));var controller=require(_0xbf02('0x9'));router[_0xbf02('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbf02('0xa')](_0xbf02('0xb'),auth[_0xbf02('0xc')](),controller[_0xbf02('0xd')]);router[_0xbf02('0xe')]('/',auth[_0xbf02('0xc')](),controller[_0xbf02('0xf')]);router[_0xbf02('0x10')]('/:id',auth[_0xbf02('0xc')](),controller[_0xbf02('0x11')]);router[_0xbf02('0x12')](_0xbf02('0xb'),auth[_0xbf02('0xc')](),controller[_0xbf02('0x13')]);module[_0xbf02('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8873101..736255b 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 _0xcdd0=['STRING','sequelize','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xcdd0[_0x18cd5b];return _0x5eaa52;};'use strict';var Sequelize=require(_0x0cdd('0x0'));module[_0x0cdd('0x1')]={'name':{'type':Sequelize[_0x0cdd('0x2')]},'basename':{'type':Sequelize[_0x0cdd('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4350=['exports','STRING','sequelize'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x4350,0x1d0));var _0x0435=function(_0x2ba453,_0x4b4850){_0x2ba453=_0x2ba453-0x0;var _0x44d5d6=_0x4350[_0x2ba453];return _0x44d5d6;};'use strict';var Sequelize=require(_0x0435('0x0'));module[_0x0435('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x0435('0x2')]},'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 032d903..e684acc 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 _0x4a77=['save','update','destroy','then','sendStatus','error','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','clone','get','omit','createdAt','updatedAt','body','create','file','originalname','mimetype','download','findOne','server/files/attachments/','join','offline-chat/','basename','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','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','status','end','json','offset','limit','count','set','Content-Range','apply','reject'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4a77,0x1a0));var _0x74a7=function(_0xb3032,_0x4ce390){_0xb3032=_0xb3032-0x0;var _0x527ca8=_0x4a77[_0xb3032];return _0x527ca8;};'use strict';var emlformat=require(_0x74a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74a7('0x2'));var moment=require(_0x74a7('0x3'));var BPromise=require(_0x74a7('0x4'));var Mustache=require(_0x74a7('0x5'));var util=require(_0x74a7('0x6'));var path=require(_0x74a7('0x7'));var sox=require(_0x74a7('0x8'));var csv=require(_0x74a7('0x9'));var ejs=require(_0x74a7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74a7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74a7('0xc'));var deskjs=require(_0x74a7('0xd'));var toCsv=require(_0x74a7('0x9'));var querystring=require(_0x74a7('0xe'));var Papa=require(_0x74a7('0xf'));var Redis=require(_0x74a7('0x10'));var authService=require(_0x74a7('0x11'));var qs=require(_0x74a7('0x12'));var as=require(_0x74a7('0x13'));var hardwareService=require(_0x74a7('0x14'));var logger=require(_0x74a7('0x15'))(_0x74a7('0x16'));var utils=require(_0x74a7('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53549a,_0x380540){_0x380540=_0x380540||0xcc;return function(_0x159740){if(_0x159740){return _0x53549a['sendStatus'](_0x380540);}return _0x53549a[_0x74a7('0x18')](_0x380540)[_0x74a7('0x19')]();};}function respondWithResult(_0xe1025f,_0x1e3fa1){_0x1e3fa1=_0x1e3fa1||0xc8;return function(_0x43dcc2){if(_0x43dcc2){return _0xe1025f['status'](_0x1e3fa1)[_0x74a7('0x1a')](_0x43dcc2);}};}function respondWithFilteredResult(_0x8f4754,_0x2957ff){return function(_0x35b198){if(_0x35b198){var _0x29bc42=typeof _0x2957ff[_0x74a7('0x1b')]==='undefined'&&typeof _0x2957ff[_0x74a7('0x1c')]==='undefined';var _0x37a8f5=_0x35b198[_0x74a7('0x1d')];var _0x15c15f=_0x29bc42?0x0:_0x2957ff['offset'];var _0x32d50c=_0x29bc42?_0x35b198[_0x74a7('0x1d')]:_0x2957ff[_0x74a7('0x1b')]+_0x2957ff['limit'];var _0x523c95;if(_0x32d50c>=_0x37a8f5){_0x32d50c=_0x37a8f5;_0x523c95=0xc8;}else{_0x523c95=0xce;}_0x8f4754[_0x74a7('0x18')](_0x523c95);return _0x8f4754[_0x74a7('0x1e')](_0x74a7('0x1f'),_0x15c15f+'-'+_0x32d50c+'/'+_0x37a8f5)[_0x74a7('0x1a')](_0x35b198);}return null;};}function patchUpdates(_0x2ab0bd){return function(_0x17331a){try{jsonpatch[_0x74a7('0x20')](_0x17331a,_0x2ab0bd,!![]);}catch(_0x36b416){return BPromise[_0x74a7('0x21')](_0x36b416);}return _0x17331a[_0x74a7('0x22')]();};}function saveUpdates(_0x3447de,_0x47f166){return function(_0x25da4d){if(_0x25da4d){return _0x25da4d[_0x74a7('0x23')](_0x3447de)['then'](function(_0x2a09bf){return _0x2a09bf;});}return null;};}function removeEntity(_0x515379,_0x2561af){return function(_0x485e85){if(_0x485e85){return _0x485e85[_0x74a7('0x24')]()[_0x74a7('0x25')](function(){_0x515379[_0x74a7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa47a90,_0x227e8c){return function(_0x58c2db){if(!_0x58c2db){_0xa47a90[_0x74a7('0x26')](0x194);}return _0x58c2db;};}function handleError(_0x57aa92,_0x25628a){_0x25628a=_0x25628a||0x1f4;return function(_0x4eaeb5){logger[_0x74a7('0x27')](_0x4eaeb5['stack']);if(_0x4eaeb5[_0x74a7('0x28')]){delete _0x4eaeb5[_0x74a7('0x28')];}_0x57aa92[_0x74a7('0x18')](_0x25628a)[_0x74a7('0x29')](_0x4eaeb5);};}exports[_0x74a7('0x2a')]=function(_0x25fc1d,_0x4d510b){var _0x168d20={},_0x4fc65b={},_0xb0183b={'count':0x0,'rows':[]};var _0x343280=_[_0x74a7('0x2b')](db[_0x74a7('0x2c')][_0x74a7('0x2d')],function(_0x450863){return{'name':_0x450863[_0x74a7('0x2e')],'type':_0x450863[_0x74a7('0x2f')][_0x74a7('0x30')]};});_0x4fc65b[_0x74a7('0x31')]=_[_0x74a7('0x2b')](_0x343280,_0x74a7('0x28'));_0x4fc65b[_0x74a7('0x32')]=_[_0x74a7('0x33')](_0x25fc1d[_0x74a7('0x32')]);_0x4fc65b[_0x74a7('0x34')]=_[_0x74a7('0x35')](_0x4fc65b['model'],_0x4fc65b[_0x74a7('0x32')]);_0x168d20[_0x74a7('0x36')]=_[_0x74a7('0x35')](_0x4fc65b[_0x74a7('0x31')],qs[_0x74a7('0x37')](_0x25fc1d['query']['fields']));_0x168d20['attributes']=_0x168d20[_0x74a7('0x36')]['length']?_0x168d20[_0x74a7('0x36')]:_0x4fc65b[_0x74a7('0x31')];if(!_0x25fc1d[_0x74a7('0x32')][_0x74a7('0x38')]('nolimit')){_0x168d20[_0x74a7('0x1c')]=qs[_0x74a7('0x1c')](_0x25fc1d[_0x74a7('0x32')][_0x74a7('0x1c')]);_0x168d20['offset']=qs['offset'](_0x25fc1d[_0x74a7('0x32')][_0x74a7('0x1b')]);}_0x168d20[_0x74a7('0x39')]=qs['sort'](_0x25fc1d[_0x74a7('0x32')][_0x74a7('0x3a')]);_0x168d20[_0x74a7('0x3b')]=qs[_0x74a7('0x34')](_[_0x74a7('0x3c')](_0x25fc1d[_0x74a7('0x32')],_0x4fc65b['filters']),_0x343280);if(_0x25fc1d[_0x74a7('0x32')][_0x74a7('0x3d')]){_0x168d20[_0x74a7('0x3b')]=_[_0x74a7('0x3e')](_0x168d20[_0x74a7('0x3b')],{'$or':_['map'](_0x343280,function(_0x3ec2d3){if(_0x3ec2d3[_0x74a7('0x2f')]!==_0x74a7('0x3f')){var _0xef1406={};_0xef1406[_0x3ec2d3[_0x74a7('0x28')]]={'$like':'%'+_0x25fc1d[_0x74a7('0x32')][_0x74a7('0x3d')]+'%'};return _0xef1406;}})});}_0x168d20=_['merge']({},_0x168d20,_0x25fc1d[_0x74a7('0x40')]);var _0xd7d73d={'where':_0x168d20[_0x74a7('0x3b')]};return db[_0x74a7('0x2c')][_0x74a7('0x1d')](_0xd7d73d)[_0x74a7('0x25')](function(_0x473726){_0xb0183b[_0x74a7('0x1d')]=_0x473726;if(_0x25fc1d[_0x74a7('0x32')][_0x74a7('0x41')]){_0x168d20[_0x74a7('0x42')]=[{'all':!![]}];}return db[_0x74a7('0x2c')][_0x74a7('0x43')](_0x168d20);})[_0x74a7('0x25')](function(_0x45b5b1){_0xb0183b[_0x74a7('0x44')]=_0x45b5b1;return _0xb0183b;})[_0x74a7('0x25')](respondWithFilteredResult(_0x4d510b,_0x168d20))[_0x74a7('0x45')](handleError(_0x4d510b,null));};exports[_0x74a7('0x46')]=function(_0x4e7640,_0x18b66f){var _0x434c83={'raw':!![],'where':{'id':_0x4e7640[_0x74a7('0x47')]['id']}},_0x5e35a8={};_0x5e35a8[_0x74a7('0x31')]=_[_0x74a7('0x33')](db[_0x74a7('0x2c')][_0x74a7('0x2d')]);_0x5e35a8[_0x74a7('0x32')]=_[_0x74a7('0x33')](_0x4e7640['query']);_0x5e35a8[_0x74a7('0x34')]=_[_0x74a7('0x35')](_0x5e35a8[_0x74a7('0x31')],_0x5e35a8[_0x74a7('0x32')]);_0x434c83[_0x74a7('0x36')]=_[_0x74a7('0x35')](_0x5e35a8[_0x74a7('0x31')],qs[_0x74a7('0x37')](_0x4e7640['query']['fields']));_0x434c83[_0x74a7('0x36')]=_0x434c83['attributes'][_0x74a7('0x48')]?_0x434c83[_0x74a7('0x36')]:_0x5e35a8[_0x74a7('0x31')];if(_0x4e7640['query']['includeAll']){_0x434c83[_0x74a7('0x42')]=[{'all':!![]}];}_0x434c83=_[_0x74a7('0x3e')]({},_0x434c83,_0x4e7640['options']);return db[_0x74a7('0x2c')][_0x74a7('0x49')](_0x434c83)[_0x74a7('0x25')](handleEntityNotFound(_0x18b66f,null))[_0x74a7('0x25')](respondWithResult(_0x18b66f,null))[_0x74a7('0x45')](handleError(_0x18b66f,null));};exports[_0x74a7('0x4a')]=function(_0x349cb8,_0x177de8){var _0x6321ad={'where':{'id':_0x349cb8[_0x74a7('0x47')]['id']}},_0x5c3fe6={};_0x5c3fe6['model']=_[_0x74a7('0x33')](db[_0x74a7('0x2c')]['rawAttributes']);_0x6321ad[_0x74a7('0x36')]=_['intersection'](_0x5c3fe6[_0x74a7('0x31')],qs[_0x74a7('0x37')](_0x349cb8['query'][_0x74a7('0x37')]));_0x6321ad['attributes']=_0x6321ad[_0x74a7('0x36')][_0x74a7('0x48')]?_0x6321ad[_0x74a7('0x36')]:_0x5c3fe6[_0x74a7('0x31')];if(_0x349cb8[_0x74a7('0x32')][_0x74a7('0x41')]){_0x6321ad['include']=[{'all':!![]}];}_0x6321ad=_[_0x74a7('0x3e')]({},_0x6321ad,_0x349cb8[_0x74a7('0x40')]);return db[_0x74a7('0x2c')][_0x74a7('0x49')](_0x6321ad)[_0x74a7('0x25')](handleEntityNotFound(_0x177de8,null))[_0x74a7('0x25')](function(_0x390fd8){if(_0x390fd8){var _0x5f04c0=_0x390fd8[_0x74a7('0x4b')]({'plain':!![]});_0x5f04c0=qs[_0x74a7('0x4c')](_0x5f04c0,['id',_0x74a7('0x4d'),_0x74a7('0x4e')]);_0x349cb8[_0x74a7('0x4f')]=_[_0x74a7('0x4c')](_0x349cb8[_0x74a7('0x4f')],['id',_0x74a7('0x4d'),_0x74a7('0x4e')]);return db['Attachment'][_0x74a7('0x50')](_['merge'](_0x5f04c0,_0x349cb8[_0x74a7('0x4f')]),{'include':_0x349cb8['query'][_0x74a7('0x41')]?[{'all':!![]}]:undefined});}})[_0x74a7('0x25')](respondWithResult(_0x177de8,0xc9))[_0x74a7('0x45')](handleError(_0x177de8,null));};exports['update']=function(_0x48ae00,_0x17bed7){if(_0x48ae00['body']['id']){delete _0x48ae00[_0x74a7('0x4f')]['id'];}return db[_0x74a7('0x2c')][_0x74a7('0x49')]({'where':{'id':_0x48ae00['params']['id']}})['then'](handleEntityNotFound(_0x17bed7,null))[_0x74a7('0x25')](saveUpdates(_0x48ae00[_0x74a7('0x4f')],null))[_0x74a7('0x25')](respondWithResult(_0x17bed7,null))['catch'](handleError(_0x17bed7,null));};exports['destroy']=function(_0x3baaea,_0x2478d9){return db[_0x74a7('0x2c')][_0x74a7('0x49')]({'where':{'id':_0x3baaea[_0x74a7('0x47')]['id']}})[_0x74a7('0x25')](handleEntityNotFound(_0x2478d9,null))[_0x74a7('0x25')](removeEntity(_0x2478d9,null))[_0x74a7('0x45')](handleError(_0x2478d9,null));};exports['create']=function(_0x338fee,_0x5b5d2e,_0xeb6969){_0x338fee[_0x74a7('0x4f')]['name']=_0x338fee[_0x74a7('0x51')][_0x74a7('0x52')];_0x338fee['body']['basename']=_0x338fee[_0x74a7('0x51')]['filename'];_0x338fee[_0x74a7('0x4f')]['type']=_0x338fee[_0x74a7('0x51')][_0x74a7('0x53')];return db[_0x74a7('0x2c')][_0x74a7('0x50')](_0x338fee[_0x74a7('0x4f')])[_0x74a7('0x25')](respondWithResult(_0x5b5d2e,0xc9))[_0x74a7('0x45')](handleError(_0x5b5d2e,null));};exports[_0x74a7('0x54')]=function(_0x2901ca,_0x2dc12c,_0x301d25){return db[_0x74a7('0x2c')][_0x74a7('0x55')]({'where':{'id':_0x2901ca[_0x74a7('0x47')]['id']},'raw':!![]})[_0x74a7('0x25')](handleEntityNotFound(_0x2dc12c,null))[_0x74a7('0x25')](function(_0x4e261f){if(_0x4e261f){var _0x33b67d=_0x4e261f['ChatOfflineMessageId']!==null;var _0x7770de=path['join'](config['root'],_0x74a7('0x56'));if(_0x33b67d){_0x7770de=path[_0x74a7('0x57')](_0x7770de,_0x74a7('0x58'));}var _0x76a634=path['join'](_0x7770de,_0x4e261f[_0x74a7('0x59')]);return _0x2dc12c['download'](_0x76a634);}})[_0x74a7('0x45')](handleError(_0x2dc12c,null));}; \ No newline at end of file +var _0x8ba4=['reject','then','destroy','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','catch','show','params','clone','get','omit','createdAt','updatedAt','body','create','update','find','file','originalname','basename','filename','type','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x259e71,_0x178636){var _0x4cde6f=function(_0x4be4ec){while(--_0x4be4ec){_0x259e71['push'](_0x259e71['shift']());}};_0x4cde6f(++_0x178636);}(_0x8ba4,0x19b));var _0x48ba=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0x8ba4[_0x224f65];return _0x3f921c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48ba('0x0'));var zipdir=require(_0x48ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48ba('0x2'));var BPromise=require(_0x48ba('0x3'));var Mustache=require(_0x48ba('0x4'));var util=require(_0x48ba('0x5'));var path=require(_0x48ba('0x6'));var sox=require(_0x48ba('0x7'));var csv=require(_0x48ba('0x8'));var ejs=require(_0x48ba('0x9'));var fs=require('fs');var fs_extra=require(_0x48ba('0xa'));var _=require(_0x48ba('0xb'));var squel=require('squel');var crypto=require(_0x48ba('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x48ba('0xd'));var toCsv=require(_0x48ba('0x8'));var querystring=require('querystring');var Papa=require(_0x48ba('0xe'));var Redis=require('ioredis');var authService=require(_0x48ba('0xf'));var qs=require(_0x48ba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48ba('0x11'));var logger=require(_0x48ba('0x12'))(_0x48ba('0x13'));var utils=require(_0x48ba('0x14'));var config=require(_0x48ba('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x48ba('0x16'))['db'];function respondWithStatusCode(_0x326b32,_0x70858e){_0x70858e=_0x70858e||0xcc;return function(_0x45eac0){if(_0x45eac0){return _0x326b32[_0x48ba('0x17')](_0x70858e);}return _0x326b32[_0x48ba('0x18')](_0x70858e)[_0x48ba('0x19')]();};}function respondWithResult(_0xf304fb,_0x3852cd){_0x3852cd=_0x3852cd||0xc8;return function(_0xc8465){if(_0xc8465){return _0xf304fb[_0x48ba('0x18')](_0x3852cd)[_0x48ba('0x1a')](_0xc8465);}};}function respondWithFilteredResult(_0x13ba8b,_0x321cad){return function(_0x3a8281){if(_0x3a8281){var _0x143570=typeof _0x321cad[_0x48ba('0x1b')]===_0x48ba('0x1c')&&typeof _0x321cad[_0x48ba('0x1d')]===_0x48ba('0x1c');var _0x910cb9=_0x3a8281[_0x48ba('0x1e')];var _0x5e6969=_0x143570?0x0:_0x321cad[_0x48ba('0x1b')];var _0x885127=_0x143570?_0x3a8281[_0x48ba('0x1e')]:_0x321cad[_0x48ba('0x1b')]+_0x321cad[_0x48ba('0x1d')];var _0x596631;if(_0x885127>=_0x910cb9){_0x885127=_0x910cb9;_0x596631=0xc8;}else{_0x596631=0xce;}_0x13ba8b[_0x48ba('0x18')](_0x596631);return _0x13ba8b[_0x48ba('0x1f')](_0x48ba('0x20'),_0x5e6969+'-'+_0x885127+'/'+_0x910cb9)[_0x48ba('0x1a')](_0x3a8281);}return null;};}function patchUpdates(_0xa47a7e){return function(_0x5ce32f){try{jsonpatch[_0x48ba('0x21')](_0x5ce32f,_0xa47a7e,!![]);}catch(_0x1fce57){return BPromise[_0x48ba('0x22')](_0x1fce57);}return _0x5ce32f['save']();};}function saveUpdates(_0xf73caf,_0x2b09a3){return function(_0x52971e){if(_0x52971e){return _0x52971e['update'](_0xf73caf)[_0x48ba('0x23')](function(_0x1f00e6){return _0x1f00e6;});}return null;};}function removeEntity(_0x35152d,_0x4433e7){return function(_0x10c344){if(_0x10c344){return _0x10c344[_0x48ba('0x24')]()[_0x48ba('0x23')](function(){_0x35152d['status'](0xcc)[_0x48ba('0x19')]();});}};}function handleEntityNotFound(_0x351319,_0x40f4fc){return function(_0x4c5b2e){if(!_0x4c5b2e){_0x351319[_0x48ba('0x17')](0x194);}return _0x4c5b2e;};}function handleError(_0xcf9ba3,_0x12337e){_0x12337e=_0x12337e||0x1f4;return function(_0x1f4832){logger['error'](_0x1f4832[_0x48ba('0x25')]);if(_0x1f4832[_0x48ba('0x26')]){delete _0x1f4832[_0x48ba('0x26')];}_0xcf9ba3[_0x48ba('0x18')](_0x12337e)[_0x48ba('0x27')](_0x1f4832);};}exports[_0x48ba('0x28')]=function(_0x3c1e6e,_0x2366d1){var _0x5155ce={},_0x14e19d={},_0x48ff13={'count':0x0,'rows':[]};var _0x19da6d=_[_0x48ba('0x29')](db[_0x48ba('0x2a')][_0x48ba('0x2b')],function(_0x5694f5){return{'name':_0x5694f5[_0x48ba('0x2c')],'type':_0x5694f5['type'][_0x48ba('0x2d')]};});_0x14e19d['model']=_[_0x48ba('0x29')](_0x19da6d,'name');_0x14e19d[_0x48ba('0x2e')]=_[_0x48ba('0x2f')](_0x3c1e6e[_0x48ba('0x2e')]);_0x14e19d[_0x48ba('0x30')]=_[_0x48ba('0x31')](_0x14e19d['model'],_0x14e19d[_0x48ba('0x2e')]);_0x5155ce[_0x48ba('0x32')]=_['intersection'](_0x14e19d['model'],qs[_0x48ba('0x33')](_0x3c1e6e[_0x48ba('0x2e')][_0x48ba('0x33')]));_0x5155ce[_0x48ba('0x32')]=_0x5155ce[_0x48ba('0x32')][_0x48ba('0x34')]?_0x5155ce[_0x48ba('0x32')]:_0x14e19d[_0x48ba('0x35')];if(!_0x3c1e6e[_0x48ba('0x2e')][_0x48ba('0x36')](_0x48ba('0x37'))){_0x5155ce['limit']=qs[_0x48ba('0x1d')](_0x3c1e6e[_0x48ba('0x2e')]['limit']);_0x5155ce[_0x48ba('0x1b')]=qs[_0x48ba('0x1b')](_0x3c1e6e[_0x48ba('0x2e')][_0x48ba('0x1b')]);}_0x5155ce['order']=qs[_0x48ba('0x38')](_0x3c1e6e[_0x48ba('0x2e')]['sort']);_0x5155ce['where']=qs[_0x48ba('0x30')](_[_0x48ba('0x39')](_0x3c1e6e[_0x48ba('0x2e')],_0x14e19d['filters']),_0x19da6d);if(_0x3c1e6e['query']['filter']){_0x5155ce['where']=_[_0x48ba('0x3a')](_0x5155ce[_0x48ba('0x3b')],{'$or':_[_0x48ba('0x29')](_0x19da6d,function(_0x40455c){if(_0x40455c['type']!==_0x48ba('0x3c')){var _0x57d637={};_0x57d637[_0x40455c[_0x48ba('0x26')]]={'$like':'%'+_0x3c1e6e[_0x48ba('0x2e')][_0x48ba('0x3d')]+'%'};return _0x57d637;}})});}_0x5155ce=_['merge']({},_0x5155ce,_0x3c1e6e[_0x48ba('0x3e')]);var _0x5efc6e={'where':_0x5155ce[_0x48ba('0x3b')]};return db['Attachment'][_0x48ba('0x1e')](_0x5efc6e)[_0x48ba('0x23')](function(_0x53d06c){_0x48ff13[_0x48ba('0x1e')]=_0x53d06c;if(_0x3c1e6e[_0x48ba('0x2e')][_0x48ba('0x3f')]){_0x5155ce[_0x48ba('0x40')]=[{'all':!![]}];}return db[_0x48ba('0x2a')]['findAll'](_0x5155ce);})[_0x48ba('0x23')](function(_0x43d923){_0x48ff13['rows']=_0x43d923;return _0x48ff13;})[_0x48ba('0x23')](respondWithFilteredResult(_0x2366d1,_0x5155ce))[_0x48ba('0x41')](handleError(_0x2366d1,null));};exports[_0x48ba('0x42')]=function(_0x73b9ce,_0x3d0bb7){var _0x5696cf={'raw':!![],'where':{'id':_0x73b9ce[_0x48ba('0x43')]['id']}},_0x55991c={};_0x55991c[_0x48ba('0x35')]=_[_0x48ba('0x2f')](db['Attachment'][_0x48ba('0x2b')]);_0x55991c[_0x48ba('0x2e')]=_[_0x48ba('0x2f')](_0x73b9ce[_0x48ba('0x2e')]);_0x55991c[_0x48ba('0x30')]=_[_0x48ba('0x31')](_0x55991c['model'],_0x55991c['query']);_0x5696cf[_0x48ba('0x32')]=_['intersection'](_0x55991c[_0x48ba('0x35')],qs[_0x48ba('0x33')](_0x73b9ce['query'][_0x48ba('0x33')]));_0x5696cf[_0x48ba('0x32')]=_0x5696cf[_0x48ba('0x32')][_0x48ba('0x34')]?_0x5696cf[_0x48ba('0x32')]:_0x55991c[_0x48ba('0x35')];if(_0x73b9ce[_0x48ba('0x2e')][_0x48ba('0x3f')]){_0x5696cf['include']=[{'all':!![]}];}_0x5696cf=_[_0x48ba('0x3a')]({},_0x5696cf,_0x73b9ce[_0x48ba('0x3e')]);return db[_0x48ba('0x2a')]['find'](_0x5696cf)[_0x48ba('0x23')](handleEntityNotFound(_0x3d0bb7,null))[_0x48ba('0x23')](respondWithResult(_0x3d0bb7,null))[_0x48ba('0x41')](handleError(_0x3d0bb7,null));};exports[_0x48ba('0x44')]=function(_0x18f67e,_0x39cc6a){var _0xf3c40c={'where':{'id':_0x18f67e['params']['id']}},_0x58c48d={};_0x58c48d['model']=_[_0x48ba('0x2f')](db['Attachment'][_0x48ba('0x2b')]);_0xf3c40c[_0x48ba('0x32')]=_[_0x48ba('0x31')](_0x58c48d[_0x48ba('0x35')],qs[_0x48ba('0x33')](_0x18f67e[_0x48ba('0x2e')]['fields']));_0xf3c40c[_0x48ba('0x32')]=_0xf3c40c[_0x48ba('0x32')]['length']?_0xf3c40c[_0x48ba('0x32')]:_0x58c48d[_0x48ba('0x35')];if(_0x18f67e['query'][_0x48ba('0x3f')]){_0xf3c40c[_0x48ba('0x40')]=[{'all':!![]}];}_0xf3c40c=_[_0x48ba('0x3a')]({},_0xf3c40c,_0x18f67e[_0x48ba('0x3e')]);return db[_0x48ba('0x2a')]['find'](_0xf3c40c)[_0x48ba('0x23')](handleEntityNotFound(_0x39cc6a,null))[_0x48ba('0x23')](function(_0x1b4dde){if(_0x1b4dde){var _0x49907b=_0x1b4dde[_0x48ba('0x45')]({'plain':!![]});_0x49907b=qs[_0x48ba('0x46')](_0x49907b,['id',_0x48ba('0x47'),_0x48ba('0x48')]);_0x18f67e[_0x48ba('0x49')]=_[_0x48ba('0x46')](_0x18f67e[_0x48ba('0x49')],['id',_0x48ba('0x47'),_0x48ba('0x48')]);return db[_0x48ba('0x2a')][_0x48ba('0x4a')](_[_0x48ba('0x3a')](_0x49907b,_0x18f67e['body']),{'include':_0x18f67e[_0x48ba('0x2e')][_0x48ba('0x3f')]?[{'all':!![]}]:undefined});}})[_0x48ba('0x23')](respondWithResult(_0x39cc6a,0xc9))[_0x48ba('0x41')](handleError(_0x39cc6a,null));};exports[_0x48ba('0x4b')]=function(_0xf03e7,_0xcf19d7){if(_0xf03e7[_0x48ba('0x49')]['id']){delete _0xf03e7[_0x48ba('0x49')]['id'];}return db[_0x48ba('0x2a')][_0x48ba('0x4c')]({'where':{'id':_0xf03e7['params']['id']}})[_0x48ba('0x23')](handleEntityNotFound(_0xcf19d7,null))[_0x48ba('0x23')](saveUpdates(_0xf03e7['body'],null))['then'](respondWithResult(_0xcf19d7,null))[_0x48ba('0x41')](handleError(_0xcf19d7,null));};exports[_0x48ba('0x24')]=function(_0x5c1c7f,_0x48c05b){return db[_0x48ba('0x2a')][_0x48ba('0x4c')]({'where':{'id':_0x5c1c7f[_0x48ba('0x43')]['id']}})[_0x48ba('0x23')](handleEntityNotFound(_0x48c05b,null))['then'](removeEntity(_0x48c05b,null))[_0x48ba('0x41')](handleError(_0x48c05b,null));};exports['create']=function(_0x1e364d,_0x11ea23,_0x3cbf9c){_0x1e364d[_0x48ba('0x49')][_0x48ba('0x26')]=_0x1e364d[_0x48ba('0x4d')][_0x48ba('0x4e')];_0x1e364d['body'][_0x48ba('0x4f')]=_0x1e364d[_0x48ba('0x4d')][_0x48ba('0x50')];_0x1e364d[_0x48ba('0x49')][_0x48ba('0x51')]=_0x1e364d[_0x48ba('0x4d')][_0x48ba('0x52')];return db['Attachment'][_0x48ba('0x4a')](_0x1e364d[_0x48ba('0x49')])[_0x48ba('0x23')](respondWithResult(_0x11ea23,0xc9))[_0x48ba('0x41')](handleError(_0x11ea23,null));};exports[_0x48ba('0x53')]=function(_0x1f0ff4,_0x34653c,_0x4be20b){return db['Attachment'][_0x48ba('0x54')]({'where':{'id':_0x1f0ff4[_0x48ba('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x34653c,null))[_0x48ba('0x23')](function(_0x22a85c){if(_0x22a85c){var _0x4e97af=_0x22a85c[_0x48ba('0x55')]!==null;var _0x37a414=path[_0x48ba('0x56')](config[_0x48ba('0x57')],_0x48ba('0x58'));if(_0x4e97af){_0x37a414=path[_0x48ba('0x56')](_0x37a414,'offline-chat/');}var _0x30c90c=path[_0x48ba('0x56')](_0x37a414,_0x22a85c[_0x48ba('0x4f')]);return _0x34653c[_0x48ba('0x53')](_0x30c90c);}})['catch'](handleError(_0x34653c,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 74fec92..1fec018 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 _0xa75b=['rimraf','../../config/environment','./attachment.attributes','exports','Attachment','util','../../config/logger','api','moment','bluebird','path'];(function(_0xbb4f8a,_0x14e64c){var _0x2585af=function(_0x396911){while(--_0x396911){_0xbb4f8a['push'](_0xbb4f8a['shift']());}};_0x2585af(++_0x14e64c);}(_0xa75b,0x1f4));var _0xba75=function(_0x57d8e7,_0x2ba050){_0x57d8e7=_0x57d8e7-0x0;var _0x2b0143=_0xa75b[_0x57d8e7];return _0x2b0143;};'use strict';var _=require('lodash');var util=require(_0xba75('0x0'));var logger=require(_0xba75('0x1'))(_0xba75('0x2'));var moment=require(_0xba75('0x3'));var BPromise=require(_0xba75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));module[_0xba75('0x9')]=function(_0xc4d78a,_0x3931b4){return _0xc4d78a['define'](_0xba75('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a49=['util','api','moment','path','rimraf','../../config/environment','exports','define','Attachment','attachments','lodash'];(function(_0x47294a,_0x28215b){var _0x42a068=function(_0x31e280){while(--_0x31e280){_0x47294a['push'](_0x47294a['shift']());}};_0x42a068(++_0x28215b);}(_0x3a49,0xaf));var _0x93a4=function(_0x1a5430,_0x277586){_0x1a5430=_0x1a5430-0x0;var _0x11eb06=_0x3a49[_0x1a5430];return _0x11eb06;};'use strict';var _=require(_0x93a4('0x0'));var util=require(_0x93a4('0x1'));var logger=require('../../config/logger')(_0x93a4('0x2'));var moment=require(_0x93a4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x93a4('0x4'));var rimraf=require(_0x93a4('0x5'));var config=require(_0x93a4('0x6'));var attributes=require('./attachment.attributes');module[_0x93a4('0x7')]=function(_0x12284b,_0x3795d5){return _0x12284b[_0x93a4('0x8')](_0x93a4('0x9'),attributes,{'tableName':_0x93a4('0xa'),'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 dbfb941..6dcf2ba 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 _0xd2ea=['Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateAttachment','Attachment','create','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x45a783,_0x573bb5){var _0x33f2f0=function(_0x1c5d47){while(--_0x1c5d47){_0x45a783['push'](_0x45a783['shift']());}};_0x33f2f0(++_0x573bb5);}(_0xd2ea,0x15f));var _0xad2e=function(_0x4b1df0,_0x5de6ef){_0x4b1df0=_0x4b1df0-0x0;var _0xf89763=_0xd2ea[_0x4b1df0];return _0xf89763;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});}exports[_0xad2e('0x18')]=function(_0x34f946){var _0x1b4889=this;return new Promise(function(_0x163e83,_0x4ef16f){return db[_0xad2e('0x19')][_0xad2e('0x1a')](_0x34f946['body'],{'raw':_0x34f946['options']?_0x34f946['options']['raw']===undefined?!![]:![]:!![]})[_0xad2e('0x1b')](function(_0x293adc){logger[_0xad2e('0x15')](_0xad2e('0x18'),_0x34f946);logger[_0xad2e('0xf')](_0xad2e('0x18'),_0x34f946,JSON[_0xad2e('0x11')](_0x293adc));_0x163e83(_0x293adc);})[_0xad2e('0x17')](function(_0x102169){logger[_0xad2e('0x12')](_0xad2e('0x18'),_0x102169[_0xad2e('0x14')],_0x34f946);_0x4ef16f(_0x1b4889[_0xad2e('0x12')](0x1f4,_0x102169[_0xad2e('0x14')]));});});}; \ No newline at end of file +var _0x644a=['../../config/environment','jayson/promise','client','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x124d9e,_0x50addd){var _0x463d39=function(_0x157d10){while(--_0x157d10){_0x124d9e['push'](_0x124d9e['shift']());}};_0x463d39(++_0x50addd);}(_0x644a,0xfd));var _0xa644=function(_0x227fe7,_0x392329){_0x227fe7=_0x227fe7-0x0;var _0x4b98be=_0x644a[_0x227fe7];return _0x4b98be;};'use strict';var _=require(_0xa644('0x0'));var util=require(_0xa644('0x1'));var moment=require(_0xa644('0x2'));var BPromise=require(_0xa644('0x3'));var rs=require(_0xa644('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa644('0x5'))['db'];var utils=require(_0xa644('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa644('0x7'));var jayson=require(_0xa644('0x8'));var client=jayson[_0xa644('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa4af13,_0x1aaaae,_0x4f8b23){return new BPromise(function(_0x15995f,_0x252108){return client['request'](_0xa4af13,_0x4f8b23)['then'](function(_0x36f677){logger[_0xa644('0xa')]('Attachment,\x20%s,\x20%s',_0x1aaaae,_0xa644('0xb'));logger[_0xa644('0xc')](_0xa644('0xd'),_0x1aaaae,_0xa644('0xb'),JSON[_0xa644('0xe')](_0x36f677));if(_0x36f677['error']){if(_0x36f677[_0xa644('0xf')][_0xa644('0x10')]===0x1f4){logger[_0xa644('0xf')](_0xa644('0x11'),_0x1aaaae,_0x36f677[_0xa644('0xf')][_0xa644('0x12')]);return _0x252108(_0x36f677['error'][_0xa644('0x12')]);}logger[_0xa644('0xf')](_0xa644('0x11'),_0x1aaaae,_0x36f677[_0xa644('0xf')][_0xa644('0x12')]);return _0x15995f(_0x36f677[_0xa644('0xf')]['message']);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x1aaaae,'request\x20sent');_0x15995f(_0x36f677['result']['message']);}})[_0xa644('0x13')](function(_0x45e115){logger[_0xa644('0xf')](_0xa644('0x11'),_0x1aaaae,_0x45e115);_0x252108(_0x45e115);});});}exports[_0xa644('0x14')]=function(_0x1536ee){var _0x6fb957=this;return new Promise(function(_0x2cf6c9,_0x300aa0){return db[_0xa644('0x15')][_0xa644('0x16')](_0x1536ee[_0xa644('0x17')],{'raw':_0x1536ee[_0xa644('0x18')]?_0x1536ee[_0xa644('0x18')][_0xa644('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x257e3d){logger[_0xa644('0xa')](_0xa644('0x14'),_0x1536ee);logger['debug'](_0xa644('0x14'),_0x1536ee,JSON[_0xa644('0xe')](_0x257e3d));_0x2cf6c9(_0x257e3d);})['catch'](function(_0x384a2d){logger[_0xa644('0xf')]('CreateAttachment',_0x384a2d[_0xa644('0x12')],_0x1536ee);_0x300aa0(_0x6fb957[_0xa644('0xf')](0x1f4,_0x384a2d[_0xa644('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b1f0d6e..8079b0f 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x5f3ee8,_0x169605){var _0x1d6088=function(_0x2bc78c){while(--_0x2bc78c){_0x5f3ee8['push'](_0x5f3ee8['shift']());}};_0x1d6088(++_0x169605);}(_0xb10b,0x12a));var _0xbb10=function(_0x4969d0,_0x4a5788){_0x4969d0=_0x4969d0-0x0;var _0x754944=_0xb10b[_0x4969d0];return _0x754944;};'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('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x40c17f,_0x5f50b0){var _0x50aa5c=function(_0x154f1f){while(--_0x154f1f){_0x40c17f['push'](_0x40c17f['shift']());}};_0x50aa5c(++_0x5f50b0);}(_0xadb5,0xad));var _0x5adb=function(_0x28c0dd,_0xbacd6b){_0x28c0dd=_0x28c0dd-0x0;var _0x590ee0=_0xadb5[_0x28c0dd];return _0x590ee0;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 3100e54..7cb2469 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 _0x975b=['api','activedirectory','undefined','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','findOne','password','role','disabled','blocked','blockedAt','online','admin','user','agent','name','blockDuration','add','minutes','getLicense','then','catch','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','activedirectory2','bluebird','../../mysqldb','../../components/auth/service'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x975b,0x12e));var _0xb975=function(_0x5344a9,_0x2d7719){_0x5344a9=_0x5344a9-0x0;var _0x131dd5=_0x975b[_0x5344a9];return _0x131dd5;};'use strict';var passport=require(_0xb975('0x0'));var LocalStrategy=require(_0xb975('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0xb975('0x2'));var BPromise=require(_0xb975('0x3'));var util=require('util');var db=require(_0xb975('0x4'))['db'];var authService=require(_0xb975('0x5'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require('../../config/logger')(_0xb975('0x6'));function isActiveDirectoryConfigured(_0x273395){var _0x311f05=![];if(typeof _0x273395[_0xb975('0x7')]!==_0xb975('0x8')){_0x311f05=_0x273395[_0xb975('0x7')][_0xb975('0x9')]&&_0x273395['activedirectory'][_0xb975('0xa')]&&_0x273395['activedirectory']['domain'];}return _0x311f05;}function adAuthenticate(_0x2eba2b,_0x5e4aeb,_0x118aed){return new BPromise(function(_0x19a888,_0x109dd3){try{var _0x29fdd6=new ActiveDirectory(_0x2eba2b);_0x29fdd6[_0xb975('0xb')](_0x5e4aeb,_0x118aed,function(_0x39866c,_0x451697){if(_0x39866c){logger[_0xb975('0xc')](_0xb975('0xd'),_0x5e4aeb,util['inspect'](_0x39866c,{'showHidden':![],'depth':null}));_0x109dd3(_0xb975('0xe'));}else if(!_0x451697){logger[_0xb975('0xc')](_0xb975('0xf'),_0x5e4aeb);_0x109dd3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x19a888(_0x451697);}});}catch(_0x2316a3){_0x109dd3(_0x2316a3);}});}function ActiveDirectoryAuthenticate(_0x33eb87,_0x21cf05,_0x300a7f,_0x1dc991){var _0x97f591,_0x3076fc;if(!isActiveDirectoryConfigured(config)){logger[_0xb975('0xc')](_0xb975('0x10'),_0x21cf05);return _0x1dc991(null,![],{'message':_0xb975('0xe')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xb975('0x11'),'blockDuration'],'raw':!![]})['then'](function(_0x4280ee){_0x97f591=_0x4280ee;if(!_0x97f591[_0xb975('0x11')]){logger[_0xb975('0xc')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x21cf05);throw new Error(_0xb975('0xe'));}return _0x33eb87[_0xb975('0x12')]({'attributes':['id','name',_0xb975('0x13'),'salt',_0xb975('0x14'),_0xb975('0x15'),_0xb975('0x16'),_0xb975('0x17'),_0xb975('0x18')],'where':{'name':_0x21cf05,'role':{'$or':[_0xb975('0x19'),_0xb975('0x1a'),_0xb975('0x1b')]},'adSsoEnabled':!![]}});})['then'](function(_0x38c530){if(!_0x38c530||_0x38c530&&_0x38c530[_0xb975('0x1c')]!==_0x21cf05){throw new Error(_0xb975('0xe'));}_0x3076fc=_0x38c530;var _0x31835f=_0x3076fc[_0xb975('0x1c')]+'@'+config[_0xb975('0x7')]['domain'];return adAuthenticate(config[_0xb975('0x7')],_0x31835f,_0x300a7f);})['then'](function(_0x66b7ea){if(_0x3076fc[_0xb975('0x15')]){throw new Error(_0xb975('0xe'));}if(_0x97f591[_0xb975('0x1d')]>0x0){if(_0x3076fc[_0xb975('0x16')]){if(moment(_0x3076fc[_0xb975('0x17')])[_0xb975('0x1e')](_0x97f591[_0xb975('0x1d')],_0xb975('0x1f'))>moment()){throw new Error(_0xb975('0xe'));}return utils['clearBlockUser'](_0x3076fc,0x0,![],null)['then'](function(){return utils['getLicense'](_0x3076fc);})['then'](function(){return _0x1dc991(null,_0x3076fc);});}else{return utils[_0xb975('0x20')](_0x3076fc)[_0xb975('0x21')](function(){return _0x1dc991(null,_0x3076fc);});}}else{return utils[_0xb975('0x20')](_0x3076fc)[_0xb975('0x21')](function(){return _0x1dc991(null,_0x3076fc);});}})[_0xb975('0x22')](function(_0x595fcb){return _0x1dc991(null,![],_0x595fcb);});}function handleError(_0x428527,_0x17c401,_0x16f297){return _0x428527[_0xb975('0x23')](_0x17c401||0x1f4)['send']({'message':_0x16f297?_0x16f297[_0xb975('0x24')]||_0x16f297:''});}exports[_0xb975('0x25')]=function(_0x1f4814,_0x318141,_0x34ae65){passport[_0xb975('0xb')](_0xb975('0x26'),function(_0x413cec,_0x18ba84,_0x274ed6){var _0xc78d56=_0x413cec||_0x274ed6;if(_0xc78d56){return handleError(_0x318141,0x191,_0xc78d56);}if(!_0x18ba84){return handleError(_0x318141,0x194,{'message':_0xb975('0x27')});}else{var _0x3b792e={'payload':{'id':_0x18ba84['id'],'role':_0x18ba84[_0xb975('0x14')]},'options':{'expiresIn':0x15180}};return authService[_0xb975('0x28')](_0x3b792e)[_0xb975('0x21')](function(_0x379aa1){_0x318141[_0xb975('0x29')]({'id':_0x18ba84['id'],'token':_0x379aa1,'statusCall':'','isAlreadyLogged':_0x18ba84[_0xb975('0x18')]});});}})(_0x1f4814,_0x318141,_0x34ae65);};passport[_0xb975('0x2a')](_0xb975('0x26'),new LocalStrategy({'usernameField':_0xb975('0x1c'),'passwordField':_0xb975('0x13')},function(_0x4b937d,_0x5020d6,_0x59b133){return ActiveDirectoryAuthenticate(db[_0xb975('0x2b')],_0x4b937d,_0x5020d6,_0x59b133);})); \ No newline at end of file +var _0xe682=['login','ad-login','signToken','json','use','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','add','minutes','clearBlockUser','getLicense','catch','status','send','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe682,0xf5));var _0x2e68=function(_0xadcfdc,_0x4bd341){_0xadcfdc=_0xadcfdc-0x0;var _0x119c5e=_0xe682[_0xadcfdc];return _0x119c5e;};'use strict';var passport=require(_0x2e68('0x0'));var LocalStrategy=require(_0x2e68('0x1'))[_0x2e68('0x2')];var moment=require(_0x2e68('0x3'));var ActiveDirectory=require(_0x2e68('0x4'));var BPromise=require('bluebird');var util=require(_0x2e68('0x5'));var db=require(_0x2e68('0x6'))['db'];var authService=require(_0x2e68('0x7'));var utils=require(_0x2e68('0x8'));var config=require('../../config/environment');var logger=require(_0x2e68('0x9'))(_0x2e68('0xa'));function isActiveDirectoryConfigured(_0x2c4b6f){var _0x5ad2ac=![];if(typeof _0x2c4b6f[_0x2e68('0xb')]!==_0x2e68('0xc')){_0x5ad2ac=_0x2c4b6f[_0x2e68('0xb')][_0x2e68('0xd')]&&_0x2c4b6f['activedirectory']['url']&&_0x2c4b6f[_0x2e68('0xb')][_0x2e68('0xe')];}return _0x5ad2ac;}function adAuthenticate(_0x7b869e,_0x2bca59,_0x3a2806){return new BPromise(function(_0x333428,_0x3a5dc5){try{var _0x588eeb=new ActiveDirectory(_0x7b869e);_0x588eeb[_0x2e68('0xf')](_0x2bca59,_0x3a2806,function(_0x4541b4,_0x2eba43){if(_0x4541b4){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x2bca59,util[_0x2e68('0x10')](_0x4541b4,{'showHidden':![],'depth':null}));_0x3a5dc5(_0x2e68('0x11'));}else if(!_0x2eba43){logger[_0x2e68('0x12')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x2bca59);_0x3a5dc5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x333428(_0x2eba43);}});}catch(_0x27d9c9){_0x3a5dc5(_0x27d9c9);}});}function ActiveDirectoryAuthenticate(_0x8c5c56,_0x1a56ee,_0x6599b9,_0x42c26d){var _0x38d88e,_0x3d87b0;if(!isActiveDirectoryConfigured(config)){logger[_0x2e68('0x12')](_0x2e68('0x13'),_0x1a56ee);return _0x42c26d(null,![],{'message':_0x2e68('0x11')});}return db[_0x2e68('0x14')][_0x2e68('0x15')]({'where':{'id':0x1},'attributes':[_0x2e68('0x16'),_0x2e68('0x17')],'raw':!![]})[_0x2e68('0x18')](function(_0x53f2fd){_0x38d88e=_0x53f2fd;if(!_0x38d88e[_0x2e68('0x16')]){logger[_0x2e68('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x1a56ee);throw new Error(_0x2e68('0x11'));}return _0x8c5c56['findOne']({'attributes':['id',_0x2e68('0x19'),_0x2e68('0x1a'),_0x2e68('0x1b'),_0x2e68('0x1c'),_0x2e68('0x1d'),_0x2e68('0x1e'),_0x2e68('0x1f'),_0x2e68('0x20')],'where':{'name':_0x1a56ee,'role':{'$or':[_0x2e68('0x21'),_0x2e68('0x22'),'agent']},'adSsoEnabled':!![]}});})[_0x2e68('0x18')](function(_0x2083ab){if(!_0x2083ab||_0x2083ab&&_0x2083ab[_0x2e68('0x19')]!==_0x1a56ee){throw new Error(_0x2e68('0x11'));}_0x3d87b0=_0x2083ab;var _0x1ab0e0=_0x3d87b0[_0x2e68('0x19')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x2e68('0xb')],_0x1ab0e0,_0x6599b9);})[_0x2e68('0x18')](function(_0x4aec16){if(_0x3d87b0[_0x2e68('0x1d')]){throw new Error(_0x2e68('0x11'));}if(_0x38d88e[_0x2e68('0x17')]>0x0){if(_0x3d87b0[_0x2e68('0x1e')]){if(moment(_0x3d87b0['blockedAt'])[_0x2e68('0x23')](_0x38d88e[_0x2e68('0x17')],_0x2e68('0x24'))>moment()){throw new Error(_0x2e68('0x11'));}return utils[_0x2e68('0x25')](_0x3d87b0,0x0,![],null)[_0x2e68('0x18')](function(){return utils['getLicense'](_0x3d87b0);})['then'](function(){return _0x42c26d(null,_0x3d87b0);});}else{return utils[_0x2e68('0x26')](_0x3d87b0)[_0x2e68('0x18')](function(){return _0x42c26d(null,_0x3d87b0);});}}else{return utils['getLicense'](_0x3d87b0)[_0x2e68('0x18')](function(){return _0x42c26d(null,_0x3d87b0);});}})[_0x2e68('0x27')](function(_0x2c35a0){return _0x42c26d(null,![],_0x2c35a0);});}function handleError(_0xf5af18,_0x1bdedf,_0x43f0e3){return _0xf5af18[_0x2e68('0x28')](_0x1bdedf||0x1f4)[_0x2e68('0x29')]({'message':_0x43f0e3?_0x43f0e3[_0x2e68('0x2a')]||_0x43f0e3:''});}exports[_0x2e68('0x2b')]=function(_0x5087ed,_0x55a23a,_0x448c30){passport[_0x2e68('0xf')](_0x2e68('0x2c'),function(_0x5e9fc8,_0x102f49,_0x1c3ede){var _0x3b53d9=_0x5e9fc8||_0x1c3ede;if(_0x3b53d9){return handleError(_0x55a23a,0x191,_0x3b53d9);}if(!_0x102f49){return handleError(_0x55a23a,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2f5dce={'payload':{'id':_0x102f49['id'],'role':_0x102f49['role']},'options':{'expiresIn':0x15180}};return authService[_0x2e68('0x2d')](_0x2f5dce)['then'](function(_0xcfadce){_0x55a23a[_0x2e68('0x2e')]({'id':_0x102f49['id'],'token':_0xcfadce,'statusCall':'','isAlreadyLogged':_0x102f49[_0x2e68('0x20')]});});}})(_0x5087ed,_0x55a23a,_0x448c30);};passport[_0x2e68('0x2f')](_0x2e68('0x2c'),new LocalStrategy({'usernameField':_0x2e68('0x19'),'passwordField':_0x2e68('0x1a')},function(_0x37fe27,_0x413ff7,_0x6baee3){return ActiveDirectoryAuthenticate(db['User'],_0x37fe27,_0x413ff7,_0x6baee3);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 1355e33..a99b62f 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 _0xb8c8=['./authActiveDirectory.controller','post','exports','express','Router'];(function(_0x205a6b,_0x27e255){var _0x44fd46=function(_0x410d18){while(--_0x410d18){_0x205a6b['push'](_0x205a6b['shift']());}};_0x44fd46(++_0x27e255);}(_0xb8c8,0xa3));var _0x8b8c=function(_0x4e0d7f,_0xa13b87){_0x4e0d7f=_0x4e0d7f-0x0;var _0x16dc4d=_0xb8c8[_0x4e0d7f];return _0x16dc4d;};'use strict';var express=require(_0x8b8c('0x0'));var router=express[_0x8b8c('0x1')]();var controller=require(_0x8b8c('0x2'));router[_0x8b8c('0x3')]('/',controller['login']);module[_0x8b8c('0x4')]=router; \ No newline at end of file +var _0x2f60=['Router','./authActiveDirectory.controller','post','exports'];(function(_0x2397ad,_0x120bbd){var _0xbb1489=function(_0x2587fd){while(--_0x2587fd){_0x2397ad['push'](_0x2397ad['shift']());}};_0xbb1489(++_0x120bbd);}(_0x2f60,0x1f0));var _0x02f6=function(_0x5d1c9d,_0x8bb82d){_0x5d1c9d=_0x5d1c9d-0x0;var _0x8edfe4=_0x2f60[_0x5d1c9d];return _0x8edfe4;};'use strict';var express=require('express');var router=express[_0x02f6('0x0')]();var controller=require(_0x02f6('0x1'));router[_0x02f6('0x2')]('/',controller['login']);module[_0x02f6('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 e381aee..43430b8 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(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x7a54,0x106));var _0x47a5=function(_0x2bc166,_0x5a2bcc){_0x2bc166=_0x2bc166-0x0;var _0x36ab1c=_0x7a54[_0x2bc166];return _0x36ab1c;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x7a54,0x106));var _0x47a5=function(_0x8f5409,_0x259afb){_0x8f5409=_0x8f5409-0x0;var _0x3e656a=_0x7a54[_0x8f5409];return _0x3e656a;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index a6adabb..4bde866 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 _0xc2c8=['login','/callback','isMiddleware','setTokenCookie','express','passport','Router','../user/user.controller.js','../../components/auth/service','get'];(function(_0x184308,_0x26b4d8){var _0x4fb503=function(_0x487772){while(--_0x487772){_0x184308['push'](_0x184308['shift']());}};_0x4fb503(++_0x26b4d8);}(_0xc2c8,0x1e4));var _0x8c2c=function(_0x12249a,_0x395f7a){_0x12249a=_0x12249a-0x0;var _0x55321d=_0xc2c8[_0x12249a];return _0x55321d;};'use strict';var express=require(_0x8c2c('0x0'));var passport=require(_0x8c2c('0x1'));var router=express[_0x8c2c('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x8c2c('0x3'));var authService=require(_0x8c2c('0x4'));router[_0x8c2c('0x5')]('/',controller[_0x8c2c('0x6')]);router['get'](_0x8c2c('0x7'),controller['callback'],authService[_0x8c2c('0x8')],userController[_0x8c2c('0x6')],authService[_0x8c2c('0x9')]);module['exports']=router; \ No newline at end of file +var _0x4a4f=['./authGoogle.controller','../user/user.controller.js','get','/callback','callback','isMiddleware','login','setTokenCookie','exports','express','passport','Router'];(function(_0x5b7613,_0x5de883){var _0x568fce=function(_0x3af372){while(--_0x3af372){_0x5b7613['push'](_0x5b7613['shift']());}};_0x568fce(++_0x5de883);}(_0x4a4f,0x1e9));var _0xf4a4=function(_0x116ce0,_0x1c73bf){_0x116ce0=_0x116ce0-0x0;var _0x2f9644=_0x4a4f[_0x116ce0];return _0x2f9644;};'use strict';var express=require(_0xf4a4('0x0'));var passport=require(_0xf4a4('0x1'));var router=express[_0xf4a4('0x2')]();var controller=require(_0xf4a4('0x3'));var userController=require(_0xf4a4('0x4'));var authService=require('../../components/auth/service');router[_0xf4a4('0x5')]('/',controller['login']);router[_0xf4a4('0x5')](_0xf4a4('0x6'),controller[_0xf4a4('0x7')],authService[_0xf4a4('0x8')],userController[_0xf4a4('0x9')],authService[_0xf4a4('0xa')]);module[_0xf4a4('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index dfafa13..d819373 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 _0x45dc=['agent','authenticate','loginAttempts','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','disabled','getLicense','catch','MailAccount','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','User','util','passport','passport-local','Strategy','jayson/promise','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','blockedAt','admin','user'];(function(_0x2bfb87,_0x3fc43a){var _0x31b9e8=function(_0x4d83a5){while(--_0x4d83a5){_0x2bfb87['push'](_0x2bfb87['shift']());}};_0x31b9e8(++_0x3fc43a);}(_0x45dc,0x149));var _0xc45d=function(_0x15a4dd,_0x187829){_0x15a4dd=_0x15a4dd-0x0;var _0x485988=_0x45dc[_0x15a4dd];return _0x485988;};'use strict';var util=require(_0xc45d('0x0'));var passport=require(_0xc45d('0x1'));var LocalStrategy=require(_0xc45d('0x2'))[_0xc45d('0x3')];var jayson=require(_0xc45d('0x4'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0xc45d('0x5'));var db=require(_0xc45d('0x6'))['db'];var authService=require(_0xc45d('0x7'));var utils=require(_0xc45d('0x8'));var client=jayson[_0xc45d('0x9')][_0xc45d('0xa')]({'port':0x232b});function localAuthenticate(_0x559c26,_0x5c8ec3,_0x37f0bf,_0x38731b){var _0x51b2b3,_0x10ddf9;return db['Setting'][_0xc45d('0xb')]({'where':{'id':0x1},'attributes':[_0xc45d('0xc'),_0xc45d('0xd')],'raw':!![]})[_0xc45d('0xe')](function(_0x3e3fba){_0x51b2b3=_0x3e3fba;return _0x559c26[_0xc45d('0xb')]({'attributes':['id',_0xc45d('0xf'),_0xc45d('0x10'),_0xc45d('0x11'),_0xc45d('0x12'),'disabled',_0xc45d('0x13'),_0xc45d('0x14'),'loginAttempts'],'where':{'name':_0x5c8ec3,'role':{'$or':[_0xc45d('0x15'),_0xc45d('0x16'),_0xc45d('0x17')]}}});})[_0xc45d('0xe')](function(_0x3b3764){if(!_0x3b3764||_0x3b3764&&_0x3b3764['name']!==_0x5c8ec3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x10ddf9=_0x3b3764;return _0x10ddf9;}})['then'](function(){_0x10ddf9[_0xc45d('0x18')](_0x37f0bf,function(_0x149cbb,_0x193dfc){var _0x3f4c6a=_0x10ddf9[_0xc45d('0x19')]+0x1;if(_0x149cbb){return _0x38731b(_0x149cbb);}else if(!_0x193dfc){if(_0x10ddf9['disabled']){return _0x38731b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x51b2b3[_0xc45d('0xc')]>0x0){if(_0x10ddf9['blocked']){if(_0x51b2b3[_0xc45d('0xd')]>0x0){if(moment(_0x10ddf9['blockedAt'])[_0xc45d('0x1a')](_0x51b2b3[_0xc45d('0xd')],_0xc45d('0x1b'))>moment()){return _0x38731b(null,![],{'message':_0xc45d('0x1c')});}else{return utils[_0xc45d('0x1d')](_0x10ddf9,_0x3f4c6a,![],null)[_0xc45d('0xe')](function(){return _0x38731b(null,![],{'message':_0xc45d('0x1c')});});}}else{return _0x38731b(null,![],{'message':_0xc45d('0x1c')});}}else{if(_0x3f4c6a>=_0x51b2b3[_0xc45d('0xc')]){return utils[_0xc45d('0x1d')](_0x10ddf9,0x0,!![],moment())[_0xc45d('0xe')](function(){return _0x38731b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xc45d('0x1d')](_0x10ddf9,_0x3f4c6a,![],null)['then'](function(){return _0x38731b(null,![],{'message':_0xc45d('0x1c')});});}}}else{return _0x38731b(null,![],{'message':_0xc45d('0x1c')});}}else{if(_0x10ddf9[_0xc45d('0x1e')]){return _0x38731b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x51b2b3['allowedLoginAttempts']>0x0){if(_0x10ddf9[_0xc45d('0x13')]){if(_0x51b2b3[_0xc45d('0xd')]>0x0){if(moment(_0x10ddf9[_0xc45d('0x14')])[_0xc45d('0x1a')](_0x51b2b3[_0xc45d('0xd')],'minutes')>moment()){return _0x38731b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc45d('0x1d')](_0x10ddf9,0x0,![],null)[_0xc45d('0xe')](function(){return utils[_0xc45d('0x1f')](_0x10ddf9);})[_0xc45d('0xe')](function(){return _0x38731b(null,_0x10ddf9);});}}else{return _0x38731b(null,![],{'message':_0xc45d('0x1c')});}}else{return utils[_0xc45d('0x1d')](_0x10ddf9,0x0,![],null)['then'](function(){return utils[_0xc45d('0x1f')](_0x10ddf9);})[_0xc45d('0xe')](function(){return _0x38731b(null,_0x10ddf9);})[_0xc45d('0x20')](function(_0x20b80b){return _0x38731b(null,![],_0x20b80b);});}}else{if(_0x10ddf9[_0xc45d('0x13')]){return _0x38731b(null,![],{'message':_0xc45d('0x1c')});}else{return utils[_0xc45d('0x1f')](_0x10ddf9)['then'](function(){return _0x38731b(null,_0x10ddf9);});}}}});})['catch'](function(_0x550bb5){return _0x38731b(null,![],_0x550bb5);});}function sendServiceMail(_0xc997e9){return db[_0xc45d('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0xc45d('0xf'),'email'],'include':[{'model':db[_0xc45d('0x22')],'as':'Smtp','include':[{'model':db[_0xc45d('0x23')],'as':_0xc45d('0x23')}]}]})[_0xc45d('0xe')](function(_0x345ab4){if(!_0x345ab4){throw new Error(_0xc45d('0x24'));}var _0x134477=_0x345ab4[_0xc45d('0x25')]();var _0x358a30={'account':_0x134477,'message':_['merge']({'from':util[_0xc45d('0x26')](_0xc45d('0x27'),_0x345ab4[_0xc45d('0xf')],_0x345ab4[_0xc45d('0x28')]||_0x345ab4[_0xc45d('0x29')]['user'])},_0xc997e9)};return client[_0xc45d('0x2a')](_0xc45d('0x2b'),_0x358a30);})[_0xc45d('0xe')](function(_0x120172){if(_0x120172[_0xc45d('0x2c')]){throw new Error(util[_0xc45d('0x26')](_0xc45d('0x2d'),_0x120172['error'][_0xc45d('0x2e')]||JSON[_0xc45d('0x2f')](_0x120172[_0xc45d('0x2c')])));}return!![];});}function handleError(_0x4602a9,_0x5c8e66,_0x500af3){return _0x4602a9[_0xc45d('0x30')](_0x5c8e66||0x1f4)[_0xc45d('0x31')]({'message':_0x500af3?_0x500af3[_0xc45d('0x2e')]||_0x500af3:''});}exports[_0xc45d('0x32')]=function(_0x3aa515,_0x31c5ad,_0x1da9c3){passport['authenticate'](_0xc45d('0x33'),function(_0x67bb2,_0x482274,_0x1208ba){var _0x2681b2=_0x67bb2||_0x1208ba;if(_0x2681b2){return handleError(_0x31c5ad,0x191,_0x2681b2);}if(!_0x482274){return handleError(_0x31c5ad,0x194,{'message':_0xc45d('0x34')});}else{var _0x387291={'payload':{'id':_0x482274['id'],'role':_0x482274[_0xc45d('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xc45d('0x35')](_0x387291)[_0xc45d('0xe')](function(_0x5a84f5){_0x31c5ad[_0xc45d('0x36')]({'id':_0x482274['id'],'token':_0x5a84f5,'statusCall':'','isAlreadyLogged':_0x482274[_0xc45d('0x37')]});});}})(_0x3aa515,_0x31c5ad,_0x1da9c3);};exports[_0xc45d('0x38')]=function(_0x2c41e0,_0x22c88a){if(!_0x2c41e0['body'][_0xc45d('0x28')]){return handleError(_0x22c88a,0x1f4,{'message':_0xc45d('0x39')});}var _0x3ffe60=rs[_0xc45d('0x3a')]();_0x2c41e0[_0xc45d('0x3b')]['email']=_0x2c41e0['body'][_0xc45d('0x28')][_0xc45d('0x3c')]()[_0xc45d('0x3d')]();var _0xa5a7f4;return db[_0xc45d('0x3e')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc45d('0xd')],'raw':!![]})['then'](function(_0x3090cf){_0xa5a7f4=_0x3090cf;return db['User']['find']({'where':{'email':_0x2c41e0[_0xc45d('0x3b')][_0xc45d('0x28')]}});})[_0xc45d('0xe')](function(_0x3e16a4){if(!_0x3e16a4){throw new Error(_0xc45d('0x3f'));}if(_0x3e16a4[_0xc45d('0x1e')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3e16a4[_0xc45d('0x13')]){if(moment(_0x3e16a4[_0xc45d('0x14')])[_0xc45d('0x1a')](_0xa5a7f4[_0xc45d('0xd')],_0xc45d('0x1b'))>moment()){throw new Error(_0xc45d('0x40'));}else{_0x3e16a4['blocked']=![];_0x3e16a4[_0xc45d('0x14')]=null;}}_0x3e16a4[_0xc45d('0x41')]=_0x3ffe60;_0x3e16a4[_0xc45d('0x42')]=Date[_0xc45d('0x43')]()+0x36ee80;return _0x3e16a4[_0xc45d('0x44')]();})[_0xc45d('0xe')](function(){return sendServiceMail({'to':_0x2c41e0[_0xc45d('0x3b')][_0xc45d('0x28')],'subject':_0xc45d('0x45'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xc45d('0x46')+_0xc45d('0x47')+_0x2c41e0[_0xc45d('0x48')][_0xc45d('0x49')]+'/reset/'+_0x3ffe60+'\x0a\x0a'+_0xc45d('0x4a')});})['then'](function(){_0x22c88a[_0xc45d('0x30')](0xc8)[_0xc45d('0x31')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x4bc58a){return handleError(_0x22c88a,0x1f4,_0x4bc58a);});};exports[_0xc45d('0x4b')]=function(_0x2701b0,_0x7df4c0){return db['User']['find']({'where':{'resetPasswordToken':_0x2701b0[_0xc45d('0x4c')][_0xc45d('0x4d')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xc45d('0xe')](function(_0x1ba0e1){if(!_0x1ba0e1){throw new Error(_0xc45d('0x4e'));}return db[_0xc45d('0x3e')][_0xc45d('0xb')]({'attributes':['id','securePassword',_0xc45d('0x4f'),_0xc45d('0x50')]})[_0xc45d('0xe')](function(_0x3fc3da){if(_0x3fc3da[_0xc45d('0x51')])authService[_0xc45d('0x52')](_0x2701b0[_0xc45d('0x3b')][_0xc45d('0x10')]);if(!_0x3fc3da[_0xc45d('0x4f')]||!_0x1ba0e1[_0xc45d('0x53')])return _0x1ba0e1;authService[_0xc45d('0x54')](_0x2701b0[_0xc45d('0x3b')][_0xc45d('0x10')],_0x1ba0e1['previousPasswords'],_0x3fc3da[_0xc45d('0x50')]);return _0x1ba0e1;})[_0xc45d('0xe')](function(){_0x1ba0e1[_0xc45d('0x10')]=_0x2701b0[_0xc45d('0x3b')][_0xc45d('0x10')];_0x1ba0e1['resetPasswordToken']=null;_0x1ba0e1[_0xc45d('0x42')]=null;return _0x1ba0e1['save']();});})[_0xc45d('0xe')](function(){_0x7df4c0[_0xc45d('0x30')](0xc8)['send']({'message':_0xc45d('0x55')});})['catch'](function(_0x11a583){return handleError(_0x7df4c0,0x1f4,_0x11a583);});};passport[_0xc45d('0x56')]('local-login',new LocalStrategy({'usernameField':_0xc45d('0xf'),'passwordField':_0xc45d('0x10')},function(_0x2b5e04,_0x45d0a7,_0x3af901){return localAuthenticate(db[_0xc45d('0x57')],_0x2b5e04,_0x45d0a7,_0x3af901);})); \ No newline at end of file +var _0xaea2=['previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordExpires','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','stringify','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','now','save','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','findOne','securePassword','enforcePasswordHistory','validatePasswordPattern'];(function(_0x190015,_0x1799f4){var _0x4231ef=function(_0x1106b3){while(--_0x1106b3){_0x190015['push'](_0x190015['shift']());}};_0x4231ef(++_0x1799f4);}(_0xaea2,0xad));var _0x2aea=function(_0x175866,_0x1e48a6){_0x175866=_0x175866-0x0;var _0x4a561b=_0xaea2[_0x175866];return _0x4a561b;};'use strict';var util=require(_0x2aea('0x0'));var passport=require(_0x2aea('0x1'));var LocalStrategy=require(_0x2aea('0x2'))[_0x2aea('0x3')];var jayson=require(_0x2aea('0x4'));var _=require(_0x2aea('0x5'));var rs=require(_0x2aea('0x6'));var moment=require(_0x2aea('0x7'));var db=require(_0x2aea('0x8'))['db'];var authService=require(_0x2aea('0x9'));var utils=require(_0x2aea('0xa'));var client=jayson[_0x2aea('0xb')][_0x2aea('0xc')]({'port':0x232b});function localAuthenticate(_0x20a6b7,_0x1239e2,_0x3d6b70,_0x1a6e03){var _0x44b620,_0x275300;return db[_0x2aea('0xd')]['findOne']({'where':{'id':0x1},'attributes':[_0x2aea('0xe'),_0x2aea('0xf')],'raw':!![]})[_0x2aea('0x10')](function(_0x26924c){_0x44b620=_0x26924c;return _0x20a6b7['findOne']({'attributes':['id',_0x2aea('0x11'),_0x2aea('0x12'),_0x2aea('0x13'),_0x2aea('0x14'),_0x2aea('0x15'),_0x2aea('0x16'),_0x2aea('0x17'),_0x2aea('0x18')],'where':{'name':_0x1239e2,'role':{'$or':[_0x2aea('0x19'),'user',_0x2aea('0x1a')]}}});})['then'](function(_0x11fa61){if(!_0x11fa61||_0x11fa61&&_0x11fa61[_0x2aea('0x11')]!==_0x1239e2){throw new Error(_0x2aea('0x1b'));}else{_0x275300=_0x11fa61;return _0x275300;}})[_0x2aea('0x10')](function(){_0x275300[_0x2aea('0x1c')](_0x3d6b70,function(_0xa3410b,_0x26f939){var _0x7b6d3f=_0x275300[_0x2aea('0x18')]+0x1;if(_0xa3410b){return _0x1a6e03(_0xa3410b);}else if(!_0x26f939){if(_0x275300['disabled']){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}else if(_0x44b620[_0x2aea('0xe')]>0x0){if(_0x275300[_0x2aea('0x16')]){if(_0x44b620[_0x2aea('0xf')]>0x0){if(moment(_0x275300[_0x2aea('0x17')])[_0x2aea('0x1d')](_0x44b620[_0x2aea('0xf')],_0x2aea('0x1e'))>moment()){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}else{return utils[_0x2aea('0x1f')](_0x275300,_0x7b6d3f,![],null)['then'](function(){return _0x1a6e03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}}else{if(_0x7b6d3f>=_0x44b620['allowedLoginAttempts']){return utils['clearBlockUser'](_0x275300,0x0,!![],moment())['then'](function(){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});});}else{return utils[_0x2aea('0x1f')](_0x275300,_0x7b6d3f,![],null)[_0x2aea('0x10')](function(){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});});}}}else{return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}}else{if(_0x275300[_0x2aea('0x15')]){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}else if(_0x44b620['allowedLoginAttempts']>0x0){if(_0x275300['blocked']){if(_0x44b620[_0x2aea('0xf')]>0x0){if(moment(_0x275300[_0x2aea('0x17')])['add'](_0x44b620[_0x2aea('0xf')],'minutes')>moment()){return _0x1a6e03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x275300,0x0,![],null)[_0x2aea('0x10')](function(){return utils['getLicense'](_0x275300);})[_0x2aea('0x10')](function(){return _0x1a6e03(null,_0x275300);});}}else{return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}}else{return utils['clearBlockUser'](_0x275300,0x0,![],null)[_0x2aea('0x10')](function(){return utils[_0x2aea('0x20')](_0x275300);})[_0x2aea('0x10')](function(){return _0x1a6e03(null,_0x275300);})[_0x2aea('0x21')](function(_0x27359c){return _0x1a6e03(null,![],_0x27359c);});}}else{if(_0x275300[_0x2aea('0x16')]){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}else{return utils[_0x2aea('0x20')](_0x275300)[_0x2aea('0x10')](function(){return _0x1a6e03(null,_0x275300);});}}}});})['catch'](function(_0x52be90){return _0x1a6e03(null,![],_0x52be90);});}function sendServiceMail(_0x1ea45f){return db[_0x2aea('0x22')][_0x2aea('0x23')]({'where':{'service':!![]},'attributes':['id',_0x2aea('0x11'),_0x2aea('0x24')],'include':[{'model':db[_0x2aea('0x25')],'as':_0x2aea('0x26'),'include':[{'model':db[_0x2aea('0x27')],'as':_0x2aea('0x27')}]}]})[_0x2aea('0x10')](function(_0x33ec04){if(!_0x33ec04){throw new Error(_0x2aea('0x28'));}var _0x598c42=_0x33ec04[_0x2aea('0x29')]();var _0x4d057a={'account':_0x598c42,'message':_[_0x2aea('0x2a')]({'from':util[_0x2aea('0x2b')](_0x2aea('0x2c'),_0x33ec04[_0x2aea('0x11')],_0x33ec04[_0x2aea('0x24')]||_0x33ec04['Smtp'][_0x2aea('0x2d')])},_0x1ea45f)};return client[_0x2aea('0x2e')](_0x2aea('0x2f'),_0x4d057a);})[_0x2aea('0x10')](function(_0x2e663f){if(_0x2e663f['error']){throw new Error(util[_0x2aea('0x2b')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x2e663f['error']['message']||JSON[_0x2aea('0x30')](_0x2e663f['error'])));}return!![];});}function handleError(_0x412fdd,_0x41662a,_0x9fb962){return _0x412fdd[_0x2aea('0x31')](_0x41662a||0x1f4)[_0x2aea('0x32')]({'message':_0x9fb962?_0x9fb962[_0x2aea('0x33')]||_0x9fb962:''});}exports[_0x2aea('0x34')]=function(_0x3aa685,_0xbee065,_0x3e0fe2){passport[_0x2aea('0x1c')](_0x2aea('0x35'),function(_0x3c14e9,_0x4f5737,_0x38a8d0){var _0x1f9b04=_0x3c14e9||_0x38a8d0;if(_0x1f9b04){return handleError(_0xbee065,0x191,_0x1f9b04);}if(!_0x4f5737){return handleError(_0xbee065,0x194,{'message':_0x2aea('0x36')});}else{var _0x9d4619={'payload':{'id':_0x4f5737['id'],'role':_0x4f5737[_0x2aea('0x14')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x9d4619)[_0x2aea('0x10')](function(_0x40dc66){_0xbee065[_0x2aea('0x37')]({'id':_0x4f5737['id'],'token':_0x40dc66,'statusCall':'','isAlreadyLogged':_0x4f5737[_0x2aea('0x38')]});});}})(_0x3aa685,_0xbee065,_0x3e0fe2);};exports[_0x2aea('0x39')]=function(_0x43f80e,_0x30fed1){if(!_0x43f80e[_0x2aea('0x3a')]['email']){return handleError(_0x30fed1,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x591276=rs[_0x2aea('0x3b')]();_0x43f80e['body']['email']=_0x43f80e[_0x2aea('0x3a')][_0x2aea('0x24')][_0x2aea('0x3c')]()[_0x2aea('0x3d')]();var _0x4ef3d7;return db[_0x2aea('0xd')]['findOne']({'where':{'id':0x1},'attributes':[_0x2aea('0xe'),_0x2aea('0xf')],'raw':!![]})['then'](function(_0x51818b){_0x4ef3d7=_0x51818b;return db[_0x2aea('0x3e')][_0x2aea('0x23')]({'where':{'email':_0x43f80e[_0x2aea('0x3a')]['email']}});})[_0x2aea('0x10')](function(_0x45869d){if(!_0x45869d){throw new Error(_0x2aea('0x3f'));}if(_0x45869d[_0x2aea('0x15')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x45869d['blocked']){if(moment(_0x45869d[_0x2aea('0x17')])['add'](_0x4ef3d7['blockDuration'],_0x2aea('0x1e'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x45869d[_0x2aea('0x16')]=![];_0x45869d['blockedAt']=null;}}_0x45869d[_0x2aea('0x40')]=_0x591276;_0x45869d['resetPasswordExpires']=Date[_0x2aea('0x41')]()+0x36ee80;return _0x45869d[_0x2aea('0x42')]();})[_0x2aea('0x10')](function(){return sendServiceMail({'to':_0x43f80e[_0x2aea('0x3a')][_0x2aea('0x24')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x2aea('0x43')+_0x43f80e[_0x2aea('0x44')][_0x2aea('0x45')]+_0x2aea('0x46')+_0x591276+'\x0a\x0a'+_0x2aea('0x47')});})[_0x2aea('0x10')](function(){_0x30fed1[_0x2aea('0x31')](0xc8)['send']({'message':_0x2aea('0x48')});})['catch'](function(_0x13ff33){return handleError(_0x30fed1,0x1f4,_0x13ff33);});};exports['reset']=function(_0x535394,_0x31eb72){return db[_0x2aea('0x3e')][_0x2aea('0x23')]({'where':{'resetPasswordToken':_0x535394[_0x2aea('0x49')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x2aea('0x10')](function(_0x1fec98){if(!_0x1fec98){throw new Error(_0x2aea('0x4a'));}return db[_0x2aea('0xd')][_0x2aea('0x4b')]({'attributes':['id',_0x2aea('0x4c'),_0x2aea('0x4d'),'passwordHistoryLimit']})[_0x2aea('0x10')](function(_0x3a0bdf){if(_0x3a0bdf['securePassword'])authService[_0x2aea('0x4e')](_0x535394[_0x2aea('0x3a')][_0x2aea('0x12')]);if(!_0x3a0bdf[_0x2aea('0x4d')]||!_0x1fec98[_0x2aea('0x4f')])return _0x1fec98;authService[_0x2aea('0x50')](_0x535394[_0x2aea('0x3a')][_0x2aea('0x12')],_0x1fec98['previousPasswords'],_0x3a0bdf[_0x2aea('0x51')]);return _0x1fec98;})[_0x2aea('0x10')](function(){_0x1fec98[_0x2aea('0x12')]=_0x535394[_0x2aea('0x3a')][_0x2aea('0x12')];_0x1fec98[_0x2aea('0x40')]=null;_0x1fec98[_0x2aea('0x52')]=null;return _0x1fec98['save']();});})[_0x2aea('0x10')](function(){_0x31eb72[_0x2aea('0x31')](0xc8)[_0x2aea('0x32')]({'message':_0x2aea('0x53')});})[_0x2aea('0x21')](function(_0x1eed3){return handleError(_0x31eb72,0x1f4,_0x1eed3);});};passport['use'](_0x2aea('0x35'),new LocalStrategy({'usernameField':_0x2aea('0x11'),'passwordField':'password'},function(_0x3a8c13,_0x38f531,_0x19c0f9){return localAuthenticate(db[_0x2aea('0x3e')],_0x3a8c13,_0x38f531,_0x19c0f9);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 9c4a921..02efde5 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 _0x8c1b=['express','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token'];(function(_0x3feb73,_0x1f03fe){var _0x25adeb=function(_0x38cad1){while(--_0x38cad1){_0x3feb73['push'](_0x3feb73['shift']());}};_0x25adeb(++_0x1f03fe);}(_0x8c1b,0xd2));var _0xb8c1=function(_0x771528,_0x16ed97){_0x771528=_0x771528-0x0;var _0x53b250=_0x8c1b[_0x771528];return _0x53b250;};'use strict';var express=require(_0xb8c1('0x0'));var router=express[_0xb8c1('0x1')]();var controller=require(_0xb8c1('0x2'));router[_0xb8c1('0x3')]('/',controller['login']);router[_0xb8c1('0x3')](_0xb8c1('0x4'),controller[_0xb8c1('0x5')]);router[_0xb8c1('0x3')](_0xb8c1('0x6'),controller['reset']);module['exports']=router; \ No newline at end of file +var _0x4948=['./authLocal.controller','post','/forgot','forgot','reset','exports','express'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4948,0xae));var _0x8494=function(_0x3652f7,_0x39448c){_0x3652f7=_0x3652f7-0x0;var _0x365c5c=_0x4948[_0x3652f7];return _0x365c5c;};'use strict';var express=require(_0x8494('0x0'));var router=express['Router']();var controller=require(_0x8494('0x1'));router[_0x8494('0x2')]('/',controller['login']);router['post'](_0x8494('0x3'),controller[_0x8494('0x4')]);router[_0x8494('0x2')]('/reset/:token',controller[_0x8494('0x5')]);module[_0x8494('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 d96e112..d0f8352 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 _0x5d92=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0x5d92,0x1b7));var _0x25d9=function(_0x385371,_0x4f1061){_0x385371=_0x385371-0x0;var _0xe1f77a=_0x5d92[_0x385371];return _0xe1f77a;};'use strict';var Sequelize=require(_0x25d9('0x0'));module[_0x25d9('0x1')]={'name':{'type':Sequelize[_0x25d9('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x25d9('0x2')]},'description':{'type':Sequelize[_0x25d9('0x2')]},'status':{'type':Sequelize[_0x25d9('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x25d9('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xe3a8=['INTEGER','exports','STRING'];(function(_0x3ccc28,_0x5036d5){var _0x47dd45=function(_0xd86e79){while(--_0xd86e79){_0x3ccc28['push'](_0x3ccc28['shift']());}};_0x47dd45(++_0x5036d5);}(_0xe3a8,0x148));var _0x8e3a=function(_0x2aaf83,_0xfed894){_0x2aaf83=_0x2aaf83-0x0;var _0x1d3b7d=_0xe3a8[_0x2aaf83];return _0x1d3b7d;};'use strict';var Sequelize=require('sequelize');module[_0x8e3a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8e3a('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8e3a('0x2')],'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 376822e..a1313e4 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 _0xd53d=['limit','count','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','index','map','Automation','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','include','find','create','body','catch','Condition','addConditions','ids','omit','getConditions','findOne','Action','addActions','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xd53d,0x1ca));var _0xdd53=function(_0x5e47ef,_0x5805e4){_0x5e47ef=_0x5e47ef-0x0;var _0x1329d8=_0xd53d[_0x5e47ef];return _0x1329d8;};'use strict';var emlformat=require(_0xdd53('0x0'));var rimraf=require(_0xdd53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd53('0x2'));var rp=require(_0xdd53('0x3'));var moment=require(_0xdd53('0x4'));var BPromise=require(_0xdd53('0x5'));var Mustache=require(_0xdd53('0x6'));var util=require(_0xdd53('0x7'));var path=require('path');var sox=require(_0xdd53('0x8'));var csv=require(_0xdd53('0x9'));var ejs=require(_0xdd53('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd53('0xb'));var squel=require(_0xdd53('0xc'));var crypto=require(_0xdd53('0xd'));var jsforce=require(_0xdd53('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdd53('0x9'));var querystring=require(_0xdd53('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdd53('0x10'));var as=require(_0xdd53('0x11'));var hardwareService=require(_0xdd53('0x12'));var logger=require('../../config/logger')(_0xdd53('0x13'));var utils=require('../../config/utils');var config=require(_0xdd53('0x14'));var licenseUtil=require(_0xdd53('0x15'));var db=require(_0xdd53('0x16'))['db'];function respondWithStatusCode(_0x93a4aa,_0x1d5a66){_0x1d5a66=_0x1d5a66||0xcc;return function(_0x522dc6){if(_0x522dc6){return _0x93a4aa[_0xdd53('0x17')](_0x1d5a66);}return _0x93a4aa['status'](_0x1d5a66)['end']();};}function respondWithResult(_0xe29e05,_0x46fc13){_0x46fc13=_0x46fc13||0xc8;return function(_0x439ce5){if(_0x439ce5){return _0xe29e05[_0xdd53('0x18')](_0x46fc13)[_0xdd53('0x19')](_0x439ce5);}};}function respondWithFilteredResult(_0x4d423d,_0x19b8a5){return function(_0x3a6d8b){if(_0x3a6d8b){var _0x3eef90=typeof _0x19b8a5[_0xdd53('0x1a')]===_0xdd53('0x1b')&&typeof _0x19b8a5[_0xdd53('0x1c')]===_0xdd53('0x1b');var _0x4809f9=_0x3a6d8b['count'];var _0x15ce13=_0x3eef90?0x0:_0x19b8a5[_0xdd53('0x1a')];var _0x213284=_0x3eef90?_0x3a6d8b[_0xdd53('0x1d')]:_0x19b8a5[_0xdd53('0x1a')]+_0x19b8a5['limit'];var _0x172ca4;if(_0x213284>=_0x4809f9){_0x213284=_0x4809f9;_0x172ca4=0xc8;}else{_0x172ca4=0xce;}_0x4d423d[_0xdd53('0x18')](_0x172ca4);return _0x4d423d['set'](_0xdd53('0x1e'),_0x15ce13+'-'+_0x213284+'/'+_0x4809f9)[_0xdd53('0x19')](_0x3a6d8b);}return null;};}function patchUpdates(_0x405a7c){return function(_0x1ccb06){try{jsonpatch[_0xdd53('0x1f')](_0x1ccb06,_0x405a7c,!![]);}catch(_0x46cb37){return BPromise[_0xdd53('0x20')](_0x46cb37);}return _0x1ccb06['save']();};}function saveUpdates(_0x9f3843,_0x4684b7){return function(_0x4fad96){if(_0x4fad96){return _0x4fad96[_0xdd53('0x21')](_0x9f3843)['then'](function(_0x3c0c07){return _0x3c0c07;});}return null;};}function removeEntity(_0x18c79b,_0x28edb6){return function(_0x1babbe){if(_0x1babbe){return _0x1babbe[_0xdd53('0x22')]()[_0xdd53('0x23')](function(){_0x18c79b[_0xdd53('0x18')](0xcc)[_0xdd53('0x24')]();});}};}function handleEntityNotFound(_0xdb7a7,_0x4e3936){return function(_0x861af9){if(!_0x861af9){_0xdb7a7[_0xdd53('0x17')](0x194);}return _0x861af9;};}function handleError(_0x3e5a64,_0x2de6ea){_0x2de6ea=_0x2de6ea||0x1f4;return function(_0x16dcc3){logger[_0xdd53('0x25')](_0x16dcc3[_0xdd53('0x26')]);if(_0x16dcc3['name']){delete _0x16dcc3[_0xdd53('0x27')];}_0x3e5a64['status'](_0x2de6ea)['send'](_0x16dcc3);};}exports[_0xdd53('0x28')]=function(_0x5b51de,_0xa8f1a4){var _0x5ac169={},_0x38a2c7={},_0xe5b07={'count':0x0,'rows':[]};var _0x43da98=_[_0xdd53('0x29')](db[_0xdd53('0x2a')][_0xdd53('0x2b')],function(_0x7e1da0){return{'name':_0x7e1da0['fieldName'],'type':_0x7e1da0[_0xdd53('0x2c')][_0xdd53('0x2d')]};});_0x38a2c7[_0xdd53('0x2e')]=_[_0xdd53('0x29')](_0x43da98,_0xdd53('0x27'));_0x38a2c7[_0xdd53('0x2f')]=_[_0xdd53('0x30')](_0x5b51de[_0xdd53('0x2f')]);_0x38a2c7['filters']=_[_0xdd53('0x31')](_0x38a2c7['model'],_0x38a2c7[_0xdd53('0x2f')]);_0x5ac169['attributes']=_[_0xdd53('0x31')](_0x38a2c7[_0xdd53('0x2e')],qs['fields'](_0x5b51de[_0xdd53('0x2f')][_0xdd53('0x32')]));_0x5ac169[_0xdd53('0x33')]=_0x5ac169[_0xdd53('0x33')][_0xdd53('0x34')]?_0x5ac169[_0xdd53('0x33')]:_0x38a2c7['model'];if(!_0x5b51de['query'][_0xdd53('0x35')](_0xdd53('0x36'))){_0x5ac169[_0xdd53('0x1c')]=qs[_0xdd53('0x1c')](_0x5b51de[_0xdd53('0x2f')][_0xdd53('0x1c')]);_0x5ac169[_0xdd53('0x1a')]=qs[_0xdd53('0x1a')](_0x5b51de[_0xdd53('0x2f')][_0xdd53('0x1a')]);}_0x5ac169[_0xdd53('0x37')]=qs[_0xdd53('0x38')](_0x5b51de[_0xdd53('0x2f')][_0xdd53('0x38')]);_0x5ac169[_0xdd53('0x39')]=qs[_0xdd53('0x3a')](_[_0xdd53('0x3b')](_0x5b51de[_0xdd53('0x2f')],_0x38a2c7[_0xdd53('0x3a')]),_0x43da98);if(_0x5b51de[_0xdd53('0x2f')][_0xdd53('0x3c')]){_0x5ac169['where']=_[_0xdd53('0x3d')](_0x5ac169[_0xdd53('0x39')],{'$or':_[_0xdd53('0x29')](_0x43da98,function(_0x3626c5){if(_0x3626c5[_0xdd53('0x2c')]!==_0xdd53('0x3e')){var _0x53266e={};_0x53266e[_0x3626c5[_0xdd53('0x27')]]={'$like':'%'+_0x5b51de['query']['filter']+'%'};return _0x53266e;}})});}_0x5ac169=_[_0xdd53('0x3d')]({},_0x5ac169,_0x5b51de[_0xdd53('0x3f')]);var _0x59ba5d={'where':_0x5ac169['where']};return db[_0xdd53('0x2a')][_0xdd53('0x1d')](_0x59ba5d)[_0xdd53('0x23')](function(_0x19b6a8){_0xe5b07['count']=_0x19b6a8;if(_0x5b51de[_0xdd53('0x2f')][_0xdd53('0x40')]){_0x5ac169['include']=[{'all':!![]}];}return db[_0xdd53('0x2a')]['findAll'](_0x5ac169);})[_0xdd53('0x23')](function(_0x18674b){_0xe5b07[_0xdd53('0x41')]=_0x18674b;return _0xe5b07;})[_0xdd53('0x23')](respondWithFilteredResult(_0xa8f1a4,_0x5ac169))['catch'](handleError(_0xa8f1a4,null));};exports['show']=function(_0x40b79e,_0xf280d3){var _0x1fcb5c={'raw':![],'where':{'id':_0x40b79e[_0xdd53('0x42')]['id']}},_0x41ee12={};_0x41ee12[_0xdd53('0x2e')]=_['keys'](db[_0xdd53('0x2a')][_0xdd53('0x2b')]);_0x41ee12[_0xdd53('0x2f')]=_[_0xdd53('0x30')](_0x40b79e['query']);_0x41ee12[_0xdd53('0x3a')]=_['intersection'](_0x41ee12[_0xdd53('0x2e')],_0x41ee12[_0xdd53('0x2f')]);_0x1fcb5c[_0xdd53('0x33')]=_[_0xdd53('0x31')](_0x41ee12[_0xdd53('0x2e')],qs[_0xdd53('0x32')](_0x40b79e[_0xdd53('0x2f')][_0xdd53('0x32')]));_0x1fcb5c[_0xdd53('0x33')]=_0x1fcb5c['attributes'][_0xdd53('0x34')]?_0x1fcb5c[_0xdd53('0x33')]:_0x41ee12[_0xdd53('0x2e')];if(_0x40b79e['query'][_0xdd53('0x40')]){_0x1fcb5c[_0xdd53('0x43')]=[{'all':!![]}];}_0x1fcb5c=_[_0xdd53('0x3d')]({},_0x1fcb5c,_0x40b79e[_0xdd53('0x3f')]);return db[_0xdd53('0x2a')][_0xdd53('0x44')](_0x1fcb5c)[_0xdd53('0x23')](handleEntityNotFound(_0xf280d3,null))[_0xdd53('0x23')](respondWithResult(_0xf280d3,null))['catch'](handleError(_0xf280d3,null));};exports[_0xdd53('0x45')]=function(_0x1ea85e,_0x442512){return db['Automation']['create'](_0x1ea85e[_0xdd53('0x46')],{})[_0xdd53('0x23')](respondWithResult(_0x442512,0xc9))[_0xdd53('0x47')](handleError(_0x442512,null));};exports[_0xdd53('0x21')]=function(_0x5701c5,_0x289906){if(_0x5701c5[_0xdd53('0x46')]['id']){delete _0x5701c5[_0xdd53('0x46')]['id'];}return db[_0xdd53('0x2a')][_0xdd53('0x44')]({'where':{'id':_0x5701c5[_0xdd53('0x42')]['id']}})[_0xdd53('0x23')](handleEntityNotFound(_0x289906,null))[_0xdd53('0x23')](saveUpdates(_0x5701c5['body'],null))[_0xdd53('0x23')](respondWithResult(_0x289906,null))['catch'](handleError(_0x289906,null));};exports['destroy']=function(_0x1f0b80,_0x3f0bf3){return db[_0xdd53('0x2a')][_0xdd53('0x44')]({'where':{'id':_0x1f0b80[_0xdd53('0x42')]['id']}})[_0xdd53('0x23')](handleEntityNotFound(_0x3f0bf3,null))[_0xdd53('0x23')](removeEntity(_0x3f0bf3,null))[_0xdd53('0x47')](handleError(_0x3f0bf3,null));};exports['addConditions']=function(_0x1c06dc,_0x3f92ce,_0x11cd6f){return db[_0xdd53('0x48')]['find']({'where':{'id':_0x1c06dc[_0xdd53('0x42')]['id']}})[_0xdd53('0x23')](handleEntityNotFound(_0x3f92ce,null))['then'](function(_0x52339e){if(_0x52339e){return _0x52339e[_0xdd53('0x49')](_0x1c06dc[_0xdd53('0x46')][_0xdd53('0x4a')],_[_0xdd53('0x4b')](_0x1c06dc[_0xdd53('0x46')],[_0xdd53('0x4a'),'id'])||{});}})[_0xdd53('0x23')](respondWithResult(_0x3f92ce,null))[_0xdd53('0x47')](handleError(_0x3f92ce,null));};exports[_0xdd53('0x4c')]=function(_0x224730,_0x1fc7fe,_0x4816bc){var _0x3237c6={};var _0x11f3a3={};var _0x5350fc;var _0x271a0f;return db[_0xdd53('0x2a')][_0xdd53('0x4d')]({'where':{'id':_0x224730[_0xdd53('0x42')]['id']}})[_0xdd53('0x23')](handleEntityNotFound(_0x1fc7fe,null))[_0xdd53('0x23')](function(_0x3765d3){if(_0x3765d3){_0x5350fc=_0x3765d3;_0x11f3a3[_0xdd53('0x2e')]=_[_0xdd53('0x30')](db[_0xdd53('0x48')][_0xdd53('0x2b')]);_0x11f3a3[_0xdd53('0x2f')]=_[_0xdd53('0x30')](_0x224730[_0xdd53('0x2f')]);_0x11f3a3[_0xdd53('0x3a')]=_[_0xdd53('0x31')](_0x11f3a3[_0xdd53('0x2e')],_0x11f3a3[_0xdd53('0x2f')]);_0x3237c6['attributes']=_[_0xdd53('0x31')](_0x11f3a3[_0xdd53('0x2e')],qs[_0xdd53('0x32')](_0x224730[_0xdd53('0x2f')][_0xdd53('0x32')]));_0x3237c6[_0xdd53('0x33')]=_0x3237c6[_0xdd53('0x33')][_0xdd53('0x34')]?_0x3237c6[_0xdd53('0x33')]:_0x11f3a3[_0xdd53('0x2e')];_0x3237c6[_0xdd53('0x37')]=qs['sort'](_0x224730[_0xdd53('0x2f')]['sort']);_0x3237c6[_0xdd53('0x39')]=qs[_0xdd53('0x3a')](_[_0xdd53('0x3b')](_0x224730['query'],_0x11f3a3[_0xdd53('0x3a')]));if(_0x224730['query']['filter']){_0x3237c6['where']=_['merge'](_0x3237c6[_0xdd53('0x39')],{'$or':_['map'](_0x3237c6[_0xdd53('0x33')],function(_0x15cb5d){var _0x1dfc81={};_0x1dfc81[_0x15cb5d]={'$like':'%'+_0x224730['query'][_0xdd53('0x3c')]+'%'};return _0x1dfc81;})});}_0x3237c6=_[_0xdd53('0x3d')]({},_0x3237c6,_0x224730['options']);return _0x5350fc[_0xdd53('0x4c')](_0x3237c6);}})['then'](function(_0xdcd90){if(_0xdcd90){_0x271a0f=_0xdcd90[_0xdd53('0x34')];if(!_0x224730[_0xdd53('0x2f')][_0xdd53('0x35')](_0xdd53('0x36'))){_0x3237c6['limit']=qs['limit'](_0x224730[_0xdd53('0x2f')][_0xdd53('0x1c')]);_0x3237c6[_0xdd53('0x1a')]=qs[_0xdd53('0x1a')](_0x224730[_0xdd53('0x2f')][_0xdd53('0x1a')]);}return _0x5350fc[_0xdd53('0x4c')](_0x3237c6);}})[_0xdd53('0x23')](function(_0x1a2cdb){if(_0x1a2cdb){return _0x1a2cdb?{'count':_0x271a0f,'rows':_0x1a2cdb}:null;}})['then'](respondWithResult(_0x1fc7fe,null))[_0xdd53('0x47')](handleError(_0x1fc7fe,null));};exports['addActions']=function(_0x367f8e,_0x1eec63,_0x489989){return db[_0xdd53('0x4e')][_0xdd53('0x44')]({'where':{'id':_0x367f8e['params']['id']}})[_0xdd53('0x23')](handleEntityNotFound(_0x1eec63,null))[_0xdd53('0x23')](function(_0x17eed8){if(_0x17eed8){return _0x17eed8[_0xdd53('0x4f')](_0x367f8e[_0xdd53('0x46')]['ids'],_['omit'](_0x367f8e[_0xdd53('0x46')],[_0xdd53('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x1eec63,null))['catch'](handleError(_0x1eec63,null));};exports['getActions']=function(_0x4423ea,_0x200e5a,_0x380a39){var _0x49a503={};var _0x3b5356={};var _0x226260;var _0x155300;return db['Automation']['findOne']({'where':{'id':_0x4423ea['params']['id']}})[_0xdd53('0x23')](handleEntityNotFound(_0x200e5a,null))[_0xdd53('0x23')](function(_0x5ae93c){if(_0x5ae93c){_0x226260=_0x5ae93c;_0x3b5356[_0xdd53('0x2e')]=_[_0xdd53('0x30')](db[_0xdd53('0x4e')][_0xdd53('0x2b')]);_0x3b5356[_0xdd53('0x2f')]=_[_0xdd53('0x30')](_0x4423ea[_0xdd53('0x2f')]);_0x3b5356[_0xdd53('0x3a')]=_[_0xdd53('0x31')](_0x3b5356['model'],_0x3b5356['query']);_0x49a503[_0xdd53('0x33')]=_['intersection'](_0x3b5356['model'],qs[_0xdd53('0x32')](_0x4423ea[_0xdd53('0x2f')]['fields']));_0x49a503[_0xdd53('0x33')]=_0x49a503[_0xdd53('0x33')][_0xdd53('0x34')]?_0x49a503['attributes']:_0x3b5356[_0xdd53('0x2e')];_0x49a503[_0xdd53('0x37')]=qs[_0xdd53('0x38')](_0x4423ea[_0xdd53('0x2f')][_0xdd53('0x38')]);_0x49a503[_0xdd53('0x39')]=qs[_0xdd53('0x3a')](_[_0xdd53('0x3b')](_0x4423ea['query'],_0x3b5356[_0xdd53('0x3a')]));if(_0x4423ea['query'][_0xdd53('0x3c')]){_0x49a503['where']=_['merge'](_0x49a503['where'],{'$or':_[_0xdd53('0x29')](_0x49a503[_0xdd53('0x33')],function(_0x5e9dd0){var _0x3773ac={};_0x3773ac[_0x5e9dd0]={'$like':'%'+_0x4423ea[_0xdd53('0x2f')]['filter']+'%'};return _0x3773ac;})});}_0x49a503=_[_0xdd53('0x3d')]({},_0x49a503,_0x4423ea[_0xdd53('0x3f')]);return _0x226260['getActions'](_0x49a503);}})[_0xdd53('0x23')](function(_0x35c222){if(_0x35c222){_0x155300=_0x35c222['length'];if(!_0x4423ea[_0xdd53('0x2f')][_0xdd53('0x35')](_0xdd53('0x36'))){_0x49a503[_0xdd53('0x1c')]=qs['limit'](_0x4423ea['query']['limit']);_0x49a503['offset']=qs['offset'](_0x4423ea['query'][_0xdd53('0x1a')]);}return _0x226260[_0xdd53('0x50')](_0x49a503);}})[_0xdd53('0x23')](function(_0x57a74c){if(_0x57a74c){return _0x57a74c?{'count':_0x155300,'rows':_0x57a74c}:null;}})[_0xdd53('0x23')](respondWithResult(_0x200e5a,null))[_0xdd53('0x47')](handleError(_0x200e5a,null));}; \ No newline at end of file +var _0x933d=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','Automation','rows','catch','show','rawAttributes','include','merge','create','body','find','params','addConditions','Condition','ids','omit','getConditions','findOne','Action','addActions','getActions','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','keys','intersection'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x933d,0x1bc));var _0xd933=function(_0x4c99d7,_0x378b6f){_0x4c99d7=_0x4c99d7-0x0;var _0x109a38=_0x933d[_0x4c99d7];return _0x109a38;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd933('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd933('0x1'));var moment=require(_0xd933('0x2'));var BPromise=require(_0xd933('0x3'));var Mustache=require(_0xd933('0x4'));var util=require(_0xd933('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd933('0x6'));var ejs=require(_0xd933('0x7'));var fs=require('fs');var fs_extra=require(_0xd933('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd933('0x9'));var jsforce=require(_0xd933('0xa'));var deskjs=require(_0xd933('0xb'));var toCsv=require(_0xd933('0x6'));var querystring=require(_0xd933('0xc'));var Papa=require(_0xd933('0xd'));var Redis=require(_0xd933('0xe'));var authService=require(_0xd933('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd933('0x10'));var utils=require(_0xd933('0x11'));var config=require(_0xd933('0x12'));var licenseUtil=require(_0xd933('0x13'));var db=require(_0xd933('0x14'))['db'];function respondWithStatusCode(_0x415deb,_0x2756be){_0x2756be=_0x2756be||0xcc;return function(_0x36f301){if(_0x36f301){return _0x415deb[_0xd933('0x15')](_0x2756be);}return _0x415deb[_0xd933('0x16')](_0x2756be)[_0xd933('0x17')]();};}function respondWithResult(_0x3c4bc4,_0x2a3bac){_0x2a3bac=_0x2a3bac||0xc8;return function(_0x5571c1){if(_0x5571c1){return _0x3c4bc4[_0xd933('0x16')](_0x2a3bac)['json'](_0x5571c1);}};}function respondWithFilteredResult(_0x3fd1ab,_0x40732a){return function(_0x3b96c8){if(_0x3b96c8){var _0x44b031=typeof _0x40732a[_0xd933('0x18')]===_0xd933('0x19')&&typeof _0x40732a[_0xd933('0x1a')]===_0xd933('0x19');var _0x4a8104=_0x3b96c8[_0xd933('0x1b')];var _0x139b2d=_0x44b031?0x0:_0x40732a[_0xd933('0x18')];var _0x18f520=_0x44b031?_0x3b96c8[_0xd933('0x1b')]:_0x40732a[_0xd933('0x18')]+_0x40732a[_0xd933('0x1a')];var _0x129a9d;if(_0x18f520>=_0x4a8104){_0x18f520=_0x4a8104;_0x129a9d=0xc8;}else{_0x129a9d=0xce;}_0x3fd1ab[_0xd933('0x16')](_0x129a9d);return _0x3fd1ab[_0xd933('0x1c')](_0xd933('0x1d'),_0x139b2d+'-'+_0x18f520+'/'+_0x4a8104)[_0xd933('0x1e')](_0x3b96c8);}return null;};}function patchUpdates(_0x1e9326){return function(_0x21332b){try{jsonpatch['apply'](_0x21332b,_0x1e9326,!![]);}catch(_0x1d1f38){return BPromise[_0xd933('0x1f')](_0x1d1f38);}return _0x21332b[_0xd933('0x20')]();};}function saveUpdates(_0x3ab56d,_0x23b8a9){return function(_0x5f3ed3){if(_0x5f3ed3){return _0x5f3ed3[_0xd933('0x21')](_0x3ab56d)[_0xd933('0x22')](function(_0x5fa66c){return _0x5fa66c;});}return null;};}function removeEntity(_0x19cf46,_0x5afdec){return function(_0xf70add){if(_0xf70add){return _0xf70add[_0xd933('0x23')]()[_0xd933('0x22')](function(){_0x19cf46[_0xd933('0x16')](0xcc)[_0xd933('0x17')]();});}};}function handleEntityNotFound(_0x45a11b,_0x3f5a32){return function(_0x292ac4){if(!_0x292ac4){_0x45a11b[_0xd933('0x15')](0x194);}return _0x292ac4;};}function handleError(_0x2ca37b,_0x31e5f7){_0x31e5f7=_0x31e5f7||0x1f4;return function(_0xd43cd){logger[_0xd933('0x24')](_0xd43cd[_0xd933('0x25')]);if(_0xd43cd[_0xd933('0x26')]){delete _0xd43cd[_0xd933('0x26')];}_0x2ca37b[_0xd933('0x16')](_0x31e5f7)[_0xd933('0x27')](_0xd43cd);};}exports['index']=function(_0x3bbd22,_0x34d787){var _0x3a9a62={},_0x9d2f5e={},_0x11083d={'count':0x0,'rows':[]};var _0x4cc455=_[_0xd933('0x28')](db['Automation']['rawAttributes'],function(_0x4354f6){return{'name':_0x4354f6[_0xd933('0x29')],'type':_0x4354f6[_0xd933('0x2a')][_0xd933('0x2b')]};});_0x9d2f5e[_0xd933('0x2c')]=_[_0xd933('0x28')](_0x4cc455,_0xd933('0x26'));_0x9d2f5e[_0xd933('0x2d')]=_[_0xd933('0x2e')](_0x3bbd22['query']);_0x9d2f5e['filters']=_[_0xd933('0x2f')](_0x9d2f5e[_0xd933('0x2c')],_0x9d2f5e[_0xd933('0x2d')]);_0x3a9a62[_0xd933('0x30')]=_['intersection'](_0x9d2f5e['model'],qs[_0xd933('0x31')](_0x3bbd22[_0xd933('0x2d')][_0xd933('0x31')]));_0x3a9a62[_0xd933('0x30')]=_0x3a9a62['attributes'][_0xd933('0x32')]?_0x3a9a62['attributes']:_0x9d2f5e['model'];if(!_0x3bbd22['query'][_0xd933('0x33')](_0xd933('0x34'))){_0x3a9a62[_0xd933('0x1a')]=qs['limit'](_0x3bbd22['query']['limit']);_0x3a9a62[_0xd933('0x18')]=qs['offset'](_0x3bbd22[_0xd933('0x2d')][_0xd933('0x18')]);}_0x3a9a62[_0xd933('0x35')]=qs[_0xd933('0x36')](_0x3bbd22[_0xd933('0x2d')][_0xd933('0x36')]);_0x3a9a62[_0xd933('0x37')]=qs[_0xd933('0x38')](_[_0xd933('0x39')](_0x3bbd22[_0xd933('0x2d')],_0x9d2f5e['filters']),_0x4cc455);if(_0x3bbd22[_0xd933('0x2d')][_0xd933('0x3a')]){_0x3a9a62[_0xd933('0x37')]=_['merge'](_0x3a9a62[_0xd933('0x37')],{'$or':_[_0xd933('0x28')](_0x4cc455,function(_0x3485ac){if(_0x3485ac[_0xd933('0x2a')]!==_0xd933('0x3b')){var _0x517264={};_0x517264[_0x3485ac[_0xd933('0x26')]]={'$like':'%'+_0x3bbd22[_0xd933('0x2d')][_0xd933('0x3a')]+'%'};return _0x517264;}})});}_0x3a9a62=_['merge']({},_0x3a9a62,_0x3bbd22[_0xd933('0x3c')]);var _0x5b2d21={'where':_0x3a9a62[_0xd933('0x37')]};return db['Automation'][_0xd933('0x1b')](_0x5b2d21)[_0xd933('0x22')](function(_0x1e6643){_0x11083d[_0xd933('0x1b')]=_0x1e6643;if(_0x3bbd22[_0xd933('0x2d')][_0xd933('0x3d')]){_0x3a9a62['include']=[{'all':!![]}];}return db[_0xd933('0x3e')]['findAll'](_0x3a9a62);})['then'](function(_0x229d87){_0x11083d[_0xd933('0x3f')]=_0x229d87;return _0x11083d;})[_0xd933('0x22')](respondWithFilteredResult(_0x34d787,_0x3a9a62))[_0xd933('0x40')](handleError(_0x34d787,null));};exports[_0xd933('0x41')]=function(_0x2e56fa,_0x5aa31c){var _0x3f109d={'raw':![],'where':{'id':_0x2e56fa['params']['id']}},_0x4711f2={};_0x4711f2[_0xd933('0x2c')]=_[_0xd933('0x2e')](db['Automation'][_0xd933('0x42')]);_0x4711f2[_0xd933('0x2d')]=_['keys'](_0x2e56fa[_0xd933('0x2d')]);_0x4711f2[_0xd933('0x38')]=_['intersection'](_0x4711f2[_0xd933('0x2c')],_0x4711f2[_0xd933('0x2d')]);_0x3f109d['attributes']=_['intersection'](_0x4711f2[_0xd933('0x2c')],qs[_0xd933('0x31')](_0x2e56fa['query'][_0xd933('0x31')]));_0x3f109d[_0xd933('0x30')]=_0x3f109d[_0xd933('0x30')][_0xd933('0x32')]?_0x3f109d[_0xd933('0x30')]:_0x4711f2['model'];if(_0x2e56fa[_0xd933('0x2d')][_0xd933('0x3d')]){_0x3f109d[_0xd933('0x43')]=[{'all':!![]}];}_0x3f109d=_[_0xd933('0x44')]({},_0x3f109d,_0x2e56fa[_0xd933('0x3c')]);return db[_0xd933('0x3e')]['find'](_0x3f109d)[_0xd933('0x22')](handleEntityNotFound(_0x5aa31c,null))['then'](respondWithResult(_0x5aa31c,null))[_0xd933('0x40')](handleError(_0x5aa31c,null));};exports[_0xd933('0x45')]=function(_0x487daf,_0x3e57a8){return db[_0xd933('0x3e')][_0xd933('0x45')](_0x487daf[_0xd933('0x46')],{})[_0xd933('0x22')](respondWithResult(_0x3e57a8,0xc9))[_0xd933('0x40')](handleError(_0x3e57a8,null));};exports[_0xd933('0x21')]=function(_0x4d4e8c,_0x3d0872){if(_0x4d4e8c[_0xd933('0x46')]['id']){delete _0x4d4e8c[_0xd933('0x46')]['id'];}return db[_0xd933('0x3e')][_0xd933('0x47')]({'where':{'id':_0x4d4e8c[_0xd933('0x48')]['id']}})[_0xd933('0x22')](handleEntityNotFound(_0x3d0872,null))[_0xd933('0x22')](saveUpdates(_0x4d4e8c[_0xd933('0x46')],null))['then'](respondWithResult(_0x3d0872,null))[_0xd933('0x40')](handleError(_0x3d0872,null));};exports[_0xd933('0x23')]=function(_0x5c5d04,_0x41e9b3){return db[_0xd933('0x3e')]['find']({'where':{'id':_0x5c5d04[_0xd933('0x48')]['id']}})[_0xd933('0x22')](handleEntityNotFound(_0x41e9b3,null))[_0xd933('0x22')](removeEntity(_0x41e9b3,null))[_0xd933('0x40')](handleError(_0x41e9b3,null));};exports[_0xd933('0x49')]=function(_0x30d6bc,_0x5ebc5b,_0x4c7337){return db[_0xd933('0x4a')][_0xd933('0x47')]({'where':{'id':_0x30d6bc[_0xd933('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ebc5b,null))['then'](function(_0x1356a1){if(_0x1356a1){return _0x1356a1['addConditions'](_0x30d6bc[_0xd933('0x46')][_0xd933('0x4b')],_[_0xd933('0x4c')](_0x30d6bc[_0xd933('0x46')],[_0xd933('0x4b'),'id'])||{});}})[_0xd933('0x22')](respondWithResult(_0x5ebc5b,null))['catch'](handleError(_0x5ebc5b,null));};exports[_0xd933('0x4d')]=function(_0x418b79,_0x2e1365,_0x122eec){var _0xfad260={};var _0x33dceb={};var _0x18c5d7;var _0x5ac562;return db['Automation'][_0xd933('0x4e')]({'where':{'id':_0x418b79[_0xd933('0x48')]['id']}})[_0xd933('0x22')](handleEntityNotFound(_0x2e1365,null))[_0xd933('0x22')](function(_0x36650d){if(_0x36650d){_0x18c5d7=_0x36650d;_0x33dceb[_0xd933('0x2c')]=_[_0xd933('0x2e')](db['Condition'][_0xd933('0x42')]);_0x33dceb['query']=_[_0xd933('0x2e')](_0x418b79['query']);_0x33dceb[_0xd933('0x38')]=_[_0xd933('0x2f')](_0x33dceb[_0xd933('0x2c')],_0x33dceb[_0xd933('0x2d')]);_0xfad260[_0xd933('0x30')]=_[_0xd933('0x2f')](_0x33dceb['model'],qs[_0xd933('0x31')](_0x418b79[_0xd933('0x2d')][_0xd933('0x31')]));_0xfad260[_0xd933('0x30')]=_0xfad260[_0xd933('0x30')]['length']?_0xfad260['attributes']:_0x33dceb[_0xd933('0x2c')];_0xfad260['order']=qs[_0xd933('0x36')](_0x418b79[_0xd933('0x2d')][_0xd933('0x36')]);_0xfad260['where']=qs[_0xd933('0x38')](_[_0xd933('0x39')](_0x418b79[_0xd933('0x2d')],_0x33dceb[_0xd933('0x38')]));if(_0x418b79['query'][_0xd933('0x3a')]){_0xfad260['where']=_[_0xd933('0x44')](_0xfad260[_0xd933('0x37')],{'$or':_['map'](_0xfad260['attributes'],function(_0x4e0124){var _0x33477d={};_0x33477d[_0x4e0124]={'$like':'%'+_0x418b79[_0xd933('0x2d')]['filter']+'%'};return _0x33477d;})});}_0xfad260=_[_0xd933('0x44')]({},_0xfad260,_0x418b79[_0xd933('0x3c')]);return _0x18c5d7[_0xd933('0x4d')](_0xfad260);}})[_0xd933('0x22')](function(_0x1ea8e7){if(_0x1ea8e7){_0x5ac562=_0x1ea8e7['length'];if(!_0x418b79[_0xd933('0x2d')][_0xd933('0x33')]('nolimit')){_0xfad260[_0xd933('0x1a')]=qs['limit'](_0x418b79[_0xd933('0x2d')][_0xd933('0x1a')]);_0xfad260[_0xd933('0x18')]=qs[_0xd933('0x18')](_0x418b79[_0xd933('0x2d')][_0xd933('0x18')]);}return _0x18c5d7[_0xd933('0x4d')](_0xfad260);}})['then'](function(_0x12aab6){if(_0x12aab6){return _0x12aab6?{'count':_0x5ac562,'rows':_0x12aab6}:null;}})['then'](respondWithResult(_0x2e1365,null))['catch'](handleError(_0x2e1365,null));};exports['addActions']=function(_0x1da9f6,_0x391dab,_0x15d6aa){return db[_0xd933('0x4f')]['find']({'where':{'id':_0x1da9f6[_0xd933('0x48')]['id']}})['then'](handleEntityNotFound(_0x391dab,null))[_0xd933('0x22')](function(_0x216f67){if(_0x216f67){return _0x216f67[_0xd933('0x50')](_0x1da9f6[_0xd933('0x46')][_0xd933('0x4b')],_[_0xd933('0x4c')](_0x1da9f6[_0xd933('0x46')],[_0xd933('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x391dab,null))[_0xd933('0x40')](handleError(_0x391dab,null));};exports[_0xd933('0x51')]=function(_0x255821,_0x486d1e,_0x3af657){var _0x10ae41={};var _0xa85f16={};var _0x2eb078;var _0x572781;return db[_0xd933('0x3e')]['findOne']({'where':{'id':_0x255821[_0xd933('0x48')]['id']}})[_0xd933('0x22')](handleEntityNotFound(_0x486d1e,null))['then'](function(_0x2dd1bc){if(_0x2dd1bc){_0x2eb078=_0x2dd1bc;_0xa85f16[_0xd933('0x2c')]=_[_0xd933('0x2e')](db['Action'][_0xd933('0x42')]);_0xa85f16[_0xd933('0x2d')]=_[_0xd933('0x2e')](_0x255821['query']);_0xa85f16[_0xd933('0x38')]=_[_0xd933('0x2f')](_0xa85f16['model'],_0xa85f16['query']);_0x10ae41[_0xd933('0x30')]=_[_0xd933('0x2f')](_0xa85f16['model'],qs[_0xd933('0x31')](_0x255821[_0xd933('0x2d')][_0xd933('0x31')]));_0x10ae41[_0xd933('0x30')]=_0x10ae41[_0xd933('0x30')]['length']?_0x10ae41[_0xd933('0x30')]:_0xa85f16['model'];_0x10ae41[_0xd933('0x35')]=qs[_0xd933('0x36')](_0x255821[_0xd933('0x2d')][_0xd933('0x36')]);_0x10ae41[_0xd933('0x37')]=qs['filters'](_[_0xd933('0x39')](_0x255821['query'],_0xa85f16[_0xd933('0x38')]));if(_0x255821[_0xd933('0x2d')][_0xd933('0x3a')]){_0x10ae41[_0xd933('0x37')]=_[_0xd933('0x44')](_0x10ae41[_0xd933('0x37')],{'$or':_[_0xd933('0x28')](_0x10ae41[_0xd933('0x30')],function(_0x43c8fb){var _0x1aa334={};_0x1aa334[_0x43c8fb]={'$like':'%'+_0x255821[_0xd933('0x2d')][_0xd933('0x3a')]+'%'};return _0x1aa334;})});}_0x10ae41=_[_0xd933('0x44')]({},_0x10ae41,_0x255821[_0xd933('0x3c')]);return _0x2eb078['getActions'](_0x10ae41);}})['then'](function(_0x3b8d4d){if(_0x3b8d4d){_0x572781=_0x3b8d4d[_0xd933('0x32')];if(!_0x255821[_0xd933('0x2d')][_0xd933('0x33')]('nolimit')){_0x10ae41[_0xd933('0x1a')]=qs[_0xd933('0x1a')](_0x255821[_0xd933('0x2d')][_0xd933('0x1a')]);_0x10ae41[_0xd933('0x18')]=qs[_0xd933('0x18')](_0x255821[_0xd933('0x2d')][_0xd933('0x18')]);}return _0x2eb078[_0xd933('0x51')](_0x10ae41);}})[_0xd933('0x22')](function(_0x3e502f){if(_0x3e502f){return _0x3e502f?{'count':_0x572781,'rows':_0x3e502f}:null;}})[_0xd933('0x22')](respondWithResult(_0x486d1e,null))[_0xd933('0x40')](handleError(_0x486d1e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2f4b081..2e3c466 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 _0x5978=['rimraf','../../config/environment','./automation.attributes','define','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5978,0x1a5));var _0x8597=function(_0x460ddf,_0x3adfc9){_0x460ddf=_0x460ddf-0x0;var _0x52e8fb=_0x5978[_0x460ddf];return _0x52e8fb;};'use strict';var _=require(_0x8597('0x0'));var util=require(_0x8597('0x1'));var logger=require(_0x8597('0x2'))(_0x8597('0x3'));var moment=require(_0x8597('0x4'));var BPromise=require(_0x8597('0x5'));var rp=require(_0x8597('0x6'));var fs=require('fs');var path=require(_0x8597('0x7'));var rimraf=require(_0x8597('0x8'));var config=require(_0x8597('0x9'));var attributes=require(_0x8597('0xa'));module['exports']=function(_0x40d856,_0x7341e4){return _0x40d856[_0x8597('0xb')]('Automation',attributes,{'tableName':_0x8597('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e04=['api','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x0e04,0x1de));var _0x40e0=function(_0x2d80be,_0xe94d2f){_0x2d80be=_0x2d80be-0x0;var _0x501350=_0x0e04[_0x2d80be];return _0x501350;};'use strict';var _=require(_0x40e0('0x0'));var util=require(_0x40e0('0x1'));var logger=require(_0x40e0('0x2'))(_0x40e0('0x3'));var moment=require('moment');var BPromise=require(_0x40e0('0x4'));var rp=require(_0x40e0('0x5'));var fs=require('fs');var path=require(_0x40e0('0x6'));var rimraf=require('rimraf');var config=require(_0x40e0('0x7'));var attributes=require(_0x40e0('0x8'));module[_0x40e0('0x9')]=function(_0x1b0f49,_0x46f17c){return _0x1b0f49[_0x40e0('0xa')](_0x40e0('0xb'),attributes,{'tableName':_0x40e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index c08b089..e420326 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 _0x4b0f=['request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2a960f,_0x5aab73){var _0x5027df=function(_0x13bf75){while(--_0x13bf75){_0x2a960f['push'](_0x2a960f['shift']());}};_0x5027df(++_0x5aab73);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x32bb6b,_0x1a5fbe){_0x32bb6b=_0x32bb6b-0x0;var _0x58dcb4=_0x4b0f[_0x32bb6b];return _0x58dcb4;};'use strict';var _=require('lodash');var util=require(_0xf4b0('0x0'));var moment=require(_0xf4b0('0x1'));var BPromise=require(_0xf4b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4b0('0x3'));var db=require(_0xf4b0('0x4'))['db'];var utils=require(_0xf4b0('0x5'));var logger=require(_0xf4b0('0x6'))(_0xf4b0('0x7'));var config=require(_0xf4b0('0x8'));var jayson=require(_0xf4b0('0x9'));var client=jayson[_0xf4b0('0xa')][_0xf4b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x373042,_0x300b64,_0x35160f){return new BPromise(function(_0x3a2236,_0xd132d8){return client[_0xf4b0('0xc')](_0x373042,_0x35160f)[_0xf4b0('0xd')](function(_0x4906e9){logger[_0xf4b0('0xe')](_0xf4b0('0xf'),_0x300b64,_0xf4b0('0x10'));logger[_0xf4b0('0x11')](_0xf4b0('0x12'),_0x300b64,_0xf4b0('0x10'),JSON[_0xf4b0('0x13')](_0x4906e9));if(_0x4906e9[_0xf4b0('0x14')]){if(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x15')]===0x1f4){logger[_0xf4b0('0x14')](_0xf4b0('0xf'),_0x300b64,_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);return _0xd132d8(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);}logger[_0xf4b0('0x14')](_0xf4b0('0xf'),_0x300b64,_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);return _0x3a2236(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);}else{logger['info'](_0xf4b0('0xf'),_0x300b64,_0xf4b0('0x10'));_0x3a2236(_0x4906e9[_0xf4b0('0x17')]['message']);}})[_0xf4b0('0x18')](function(_0x1f2d74){logger[_0xf4b0('0x14')]('Automation,\x20%s,\x20%s',_0x300b64,_0x1f2d74);_0xd132d8(_0x1f2d74);});});} \ No newline at end of file +var _0x07a2=['error','Automation,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','debug','stringify'];(function(_0x66dd23,_0x3db67f){var _0x5d0c36=function(_0x7191bb){while(--_0x7191bb){_0x66dd23['push'](_0x66dd23['shift']());}};_0x5d0c36(++_0x3db67f);}(_0x07a2,0x12c));var _0x207a=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x07a2[_0x25662e];return _0x59b7bc;};'use strict';var _=require(_0x207a('0x0'));var util=require(_0x207a('0x1'));var moment=require('moment');var BPromise=require(_0x207a('0x2'));var rs=require(_0x207a('0x3'));var fs=require('fs');var Redis=require(_0x207a('0x4'));var db=require(_0x207a('0x5'))['db'];var utils=require(_0x207a('0x6'));var logger=require(_0x207a('0x7'))(_0x207a('0x8'));var config=require(_0x207a('0x9'));var jayson=require(_0x207a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18dddc,_0x15d085,_0x7be81c){return new BPromise(function(_0x2a0b70,_0x55412c){return client[_0x207a('0xb')](_0x18dddc,_0x7be81c)['then'](function(_0x5201fe){logger[_0x207a('0xc')]('Automation,\x20%s,\x20%s',_0x15d085,'request\x20sent');logger[_0x207a('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0x15d085,'request\x20sent',JSON[_0x207a('0xe')](_0x5201fe));if(_0x5201fe[_0x207a('0xf')]){if(_0x5201fe[_0x207a('0xf')]['code']===0x1f4){logger[_0x207a('0xf')](_0x207a('0x10'),_0x15d085,_0x5201fe[_0x207a('0xf')]['message']);return _0x55412c(_0x5201fe[_0x207a('0xf')][_0x207a('0x11')]);}logger[_0x207a('0xf')](_0x207a('0x10'),_0x15d085,_0x5201fe[_0x207a('0xf')]['message']);return _0x2a0b70(_0x5201fe[_0x207a('0xf')]['message']);}else{logger[_0x207a('0xc')](_0x207a('0x10'),_0x15d085,_0x207a('0x12'));_0x2a0b70(_0x5201fe[_0x207a('0x13')][_0x207a('0x11')]);}})[_0x207a('0x14')](function(_0xd60aa3){logger[_0x207a('0xf')](_0x207a('0x10'),_0x15d085,_0xd60aa3);_0x55412c(_0xd60aa3);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 768cba1..adef0e0 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 _0xeec3=['destroy','multer','util','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','/:id','show','get','/:id/conditions','getConditions','post','create','addActions','put','update'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xeec3,0x1c3));var _0x3eec=function(_0x3e4019,_0x5e2bf9){_0x3e4019=_0x3e4019-0x0;var _0x53da3c=_0xeec3[_0x3e4019];return _0x53da3c;};'use strict';var multer=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3eec('0x2'));var interaction=require(_0x3eec('0x3'));var config=require('../../config/environment');var controller=require(_0x3eec('0x4'));router['get']('/',auth[_0x3eec('0x5')](),controller[_0x3eec('0x6')]);router['get'](_0x3eec('0x7'),auth[_0x3eec('0x5')](),controller[_0x3eec('0x8')]);router[_0x3eec('0x9')](_0x3eec('0xa'),auth[_0x3eec('0x5')](),controller[_0x3eec('0xb')]);router[_0x3eec('0x9')]('/:id/actions',auth[_0x3eec('0x5')](),controller['getActions']);router[_0x3eec('0xc')]('/',auth[_0x3eec('0x5')](),controller[_0x3eec('0xd')]);router[_0x3eec('0xc')]('/:id/conditions',auth[_0x3eec('0x5')](),controller['addConditions']);router['post']('/:id/actions',auth[_0x3eec('0x5')](),controller[_0x3eec('0xe')]);router[_0x3eec('0xf')](_0x3eec('0x7'),auth['isAuthenticated'](),controller[_0x3eec('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3eec('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6548=['exports','multer','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','create','post','addConditions','addActions','destroy'];(function(_0xfdc30f,_0xe7a613){var _0x176cae=function(_0x24d171){while(--_0x24d171){_0xfdc30f['push'](_0xfdc30f['shift']());}};_0x176cae(++_0xe7a613);}(_0x6548,0x133));var _0x8654=function(_0x5c8fd0,_0x560ba2){_0x5c8fd0=_0x5c8fd0-0x0;var _0x84cbbd=_0x6548[_0x5c8fd0];return _0x84cbbd;};'use strict';var multer=require(_0x8654('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8654('0x1'));var express=require(_0x8654('0x2'));var router=express[_0x8654('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8654('0x4'));var controller=require('./automation.controller');router[_0x8654('0x5')]('/',auth[_0x8654('0x6')](),controller[_0x8654('0x7')]);router[_0x8654('0x5')](_0x8654('0x8'),auth[_0x8654('0x6')](),controller[_0x8654('0x9')]);router['get'](_0x8654('0xa'),auth[_0x8654('0x6')](),controller['getConditions']);router[_0x8654('0x5')](_0x8654('0xb'),auth[_0x8654('0x6')](),controller['getActions']);router['post']('/',auth[_0x8654('0x6')](),controller[_0x8654('0xc')]);router[_0x8654('0xd')](_0x8654('0xa'),auth['isAuthenticated'](),controller[_0x8654('0xe')]);router[_0x8654('0xd')](_0x8654('0xb'),auth['isAuthenticated'](),controller[_0x8654('0xf')]);router['put'](_0x8654('0x8'),auth[_0x8654('0x6')](),controller['update']);router['delete']('/:id',auth[_0x8654('0x6')](),controller[_0x8654('0x10')]);module[_0x8654('0x11')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 70b4128..8901548 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 _0x9353=['#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ENUM','ivr','STRING','BOOLEAN','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x428ccd,_0x259055){var _0x57d4b6=function(_0x1ec989){while(--_0x1ec989){_0x428ccd['push'](_0x428ccd['shift']());}};_0x57d4b6(++_0x259055);}(_0x9353,0xcb));var _0x3935=function(_0x5a9636,_0x4cdf6a){_0x5a9636=_0x5a9636-0x0;var _0x559ce4=_0x9353[_0x5a9636];return _0x559ce4;};'use strict';var Sequelize=require(_0x3935('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3935('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3935('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x3935('0x3')},'description':{'type':Sequelize[_0x3935('0x4')]},'active':{'type':Sequelize[_0x3935('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x3935('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3935('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3935('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3935('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x3935('0x6')](0x3)[_0x3935('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3935('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3935('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3935('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3935('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3935('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x3935('0x6')](0x3)[_0x3935('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3935('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3935('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3935('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3935('0x8')],'defaultValue':0x3,'comment':_0x3935('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3935('0x6')](0x5)[_0x3935('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3935('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3935('0x6')](0x3)[_0x3935('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3935('0x10')},'dialTimezone':{'type':Sequelize[_0x3935('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3935('0x4')],'defaultValue':_0x3935('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x3935('0x2')](_0x3935('0x12'),_0x3935('0x13'),_0x3935('0x14')),'defaultValue':_0x3935('0x12')},'dialAMDActive':{'type':Sequelize[_0x3935('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x3935('0x6')](0x9)[_0x3935('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3935('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x3935('0x6')](0x9)[_0x3935('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3935('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3935('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3935('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x3935('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x3935('0x6')](0x9)[_0x3935('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3935('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3935('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3935('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3935('0x6')](0x9)[_0x3935('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3935('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x3935('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3935('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3935('0x6')](0x9)[_0x3935('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3935('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x3935('0x1d')),'defaultValue':_0x3935('0x1e')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3935('0x1f')},'dialCutDigit':{'type':Sequelize[_0x3935('0x6')](0x3)[_0x3935('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3935('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3935('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3935('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3935('0x6')](0x5)[_0x3935('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3935('0x22')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3935('0x23')},'dialDropRetryFrequency':{'type':Sequelize[_0x3935('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3935('0x24')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3935('0x6')](0x3)[_0x3935('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3935('0x25')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3935('0x6')](0x5)[_0x3935('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3935('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0x3935('0x6')](0x3)[_0x3935('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3935('0x27')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3935('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3935('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3935('0x6')](0x3)[_0x3935('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3935('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3935('0x6')](0x5)[_0x3935('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3935('0x2a')}}; \ No newline at end of file +var _0x9bee=['#Congestion\x20Retry\x20(min:1,\x20max:999)','INTEGER','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9bee,0xfa));var _0xe9be=function(_0x27fa44,_0x148336){_0x27fa44=_0x27fa44-0x0;var _0x563a16=_0x9bee[_0x27fa44];return _0x563a16;};'use strict';var Sequelize=require(_0xe9be('0x0'));module[_0xe9be('0x1')]={'name':{'type':Sequelize[_0xe9be('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe9be('0x3')](_0xe9be('0x4')),'allowNull':![],'defaultValue':_0xe9be('0x4')},'description':{'type':Sequelize[_0xe9be('0x2')]},'active':{'type':Sequelize[_0xe9be('0x5')],'defaultValue':0x0,'comment':_0xe9be('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xe9be('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe9be('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'defaultValue':0x3,'comment':_0xe9be('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe9be('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe9be('0x2')],'defaultValue':_0xe9be('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xe9be('0x3')](_0xe9be('0x11'),_0xe9be('0x12'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xe9be('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe9be('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe9be('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe9be('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe9be('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe9be('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe9be('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xe9be('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe9be('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xe9be('0x19')),'defaultValue':_0xe9be('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe9be('0x1b')},'dialCutDigit':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index ba5eb83..23eed1e 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 _0xbc87=['fromQuery','ContactId','NOW()','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','autoAssociation','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','scheduledAt','ListId','select','field','toString','from','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen'];(function(_0x4736e6,_0x50483b){var _0x3e3e28=function(_0x1be431){while(--_0x1be431){_0x4736e6['push'](_0x4736e6['shift']());}};_0x3e3e28(++_0x50483b);}(_0xbc87,0x1cd));var _0x7bc8=function(_0x1456b0,_0x5eb20a){_0x1456b0=_0x1456b0-0x0;var _0x50dca0=_0xbc87[_0x1456b0];return _0x50dca0;};'use strict';var emlformat=require(_0x7bc8('0x0'));var rimraf=require(_0x7bc8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bc8('0x2'));var rp=require(_0x7bc8('0x3'));var moment=require(_0x7bc8('0x4'));var BPromise=require(_0x7bc8('0x5'));var Mustache=require('mustache');var util=require(_0x7bc8('0x6'));var path=require(_0x7bc8('0x7'));var sox=require(_0x7bc8('0x8'));var csv=require(_0x7bc8('0x9'));var ejs=require(_0x7bc8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7bc8('0xb'));var crypto=require(_0x7bc8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7bc8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7bc8('0xe'));var Papa=require(_0x7bc8('0xf'));var Redis=require('ioredis');var authService=require(_0x7bc8('0x10'));var qs=require(_0x7bc8('0x11'));var as=require(_0x7bc8('0x12'));var hardwareService=require(_0x7bc8('0x13'));var logger=require(_0x7bc8('0x14'))('api');var utils=require(_0x7bc8('0x15'));var config=require(_0x7bc8('0x16'));var licenseUtil=require(_0x7bc8('0x17'));var db=require(_0x7bc8('0x18'))['db'];function respondWithStatusCode(_0x3c15da,_0x474652){_0x474652=_0x474652||0xcc;return function(_0x1a1d46){if(_0x1a1d46){return _0x3c15da[_0x7bc8('0x19')](_0x474652);}return _0x3c15da[_0x7bc8('0x1a')](_0x474652)[_0x7bc8('0x1b')]();};}function respondWithResult(_0x7a74b4,_0x5a3bcc){_0x5a3bcc=_0x5a3bcc||0xc8;return function(_0xaffc57){if(_0xaffc57){return _0x7a74b4[_0x7bc8('0x1a')](_0x5a3bcc)[_0x7bc8('0x1c')](_0xaffc57);}};}function respondWithFilteredResult(_0x119c45,_0x5bebbd){return function(_0x3db956){if(_0x3db956){var _0x53be05=typeof _0x5bebbd[_0x7bc8('0x1d')]===_0x7bc8('0x1e')&&typeof _0x5bebbd[_0x7bc8('0x1f')]===_0x7bc8('0x1e');var _0x2afec4=_0x3db956['count'];var _0xcfb543=_0x53be05?0x0:_0x5bebbd[_0x7bc8('0x1d')];var _0x3f51ec=_0x53be05?_0x3db956[_0x7bc8('0x20')]:_0x5bebbd[_0x7bc8('0x1d')]+_0x5bebbd[_0x7bc8('0x1f')];var _0x7c2bdb;if(_0x3f51ec>=_0x2afec4){_0x3f51ec=_0x2afec4;_0x7c2bdb=0xc8;}else{_0x7c2bdb=0xce;}_0x119c45[_0x7bc8('0x1a')](_0x7c2bdb);return _0x119c45['set'](_0x7bc8('0x21'),_0xcfb543+'-'+_0x3f51ec+'/'+_0x2afec4)['json'](_0x3db956);}return null;};}function patchUpdates(_0x3a3e51){return function(_0x3eda19){try{jsonpatch[_0x7bc8('0x22')](_0x3eda19,_0x3a3e51,!![]);}catch(_0x42a251){return BPromise[_0x7bc8('0x23')](_0x42a251);}return _0x3eda19[_0x7bc8('0x24')]();};}function saveUpdates(_0x5b26fe,_0x83c345){return function(_0x60cbb9){if(_0x60cbb9){return _0x60cbb9[_0x7bc8('0x25')](_0x5b26fe)[_0x7bc8('0x26')](function(_0x2fd38b){return _0x2fd38b;});}return null;};}function removeEntity(_0xc68f2c,_0x30c529){return function(_0x305e52){if(_0x305e52){return _0x305e52[_0x7bc8('0x27')]()[_0x7bc8('0x26')](function(){var _0x1a2835=_0x305e52['get']({'plain':!![]});var _0x3ef138=_0x7bc8('0x28');return db[_0x7bc8('0x29')][_0x7bc8('0x27')]({'where':{'type':_0x3ef138,'resourceId':_0x1a2835['id']}})['then'](function(){return _0x305e52;});})['then'](function(){_0xc68f2c['status'](0xcc)[_0x7bc8('0x1b')]();});}};}function handleEntityNotFound(_0x402f17,_0x157b66){return function(_0x2f519c){if(!_0x2f519c){_0x402f17['sendStatus'](0x194);}return _0x2f519c;};}function handleError(_0x3e4f4c,_0x344fa0){_0x344fa0=_0x344fa0||0x1f4;return function(_0x212515){logger['error'](_0x212515[_0x7bc8('0x2a')]);if(_0x212515['name']){delete _0x212515[_0x7bc8('0x2b')];}_0x3e4f4c[_0x7bc8('0x1a')](_0x344fa0)[_0x7bc8('0x2c')](_0x212515);};}exports[_0x7bc8('0x2d')]=function(_0xe8418c,_0x235ab8){var _0x1540b5={},_0xbe46e2={},_0xd7d333={'count':0x0,'rows':[]};var _0x44afe0=_[_0x7bc8('0x2e')](db[_0x7bc8('0x2f')][_0x7bc8('0x30')],function(_0x43d13d){return{'name':_0x43d13d['fieldName'],'type':_0x43d13d[_0x7bc8('0x31')][_0x7bc8('0x32')]};});_0xbe46e2[_0x7bc8('0x33')]=_['map'](_0x44afe0,_0x7bc8('0x2b'));_0xbe46e2['query']=_[_0x7bc8('0x34')](_0xe8418c['query']);_0xbe46e2[_0x7bc8('0x35')]=_[_0x7bc8('0x36')](_0xbe46e2[_0x7bc8('0x33')],_0xbe46e2[_0x7bc8('0x37')]);_0x1540b5[_0x7bc8('0x38')]=_['intersection'](_0xbe46e2[_0x7bc8('0x33')],qs[_0x7bc8('0x39')](_0xe8418c[_0x7bc8('0x37')][_0x7bc8('0x39')]));_0x1540b5[_0x7bc8('0x38')]=_0x1540b5[_0x7bc8('0x38')][_0x7bc8('0x3a')]?_0x1540b5[_0x7bc8('0x38')]:_0xbe46e2[_0x7bc8('0x33')];if(!_0xe8418c[_0x7bc8('0x37')][_0x7bc8('0x3b')](_0x7bc8('0x3c'))){_0x1540b5[_0x7bc8('0x1f')]=qs[_0x7bc8('0x1f')](_0xe8418c['query'][_0x7bc8('0x1f')]);_0x1540b5[_0x7bc8('0x1d')]=qs[_0x7bc8('0x1d')](_0xe8418c[_0x7bc8('0x37')][_0x7bc8('0x1d')]);}_0x1540b5[_0x7bc8('0x3d')]=qs[_0x7bc8('0x3e')](_0xe8418c[_0x7bc8('0x37')][_0x7bc8('0x3e')]);_0x1540b5[_0x7bc8('0x3f')]=qs[_0x7bc8('0x35')](_[_0x7bc8('0x40')](_0xe8418c[_0x7bc8('0x37')],_0xbe46e2[_0x7bc8('0x35')]),_0x44afe0);if(_0xe8418c[_0x7bc8('0x37')][_0x7bc8('0x41')]){_0x1540b5['where']=_['merge'](_0x1540b5[_0x7bc8('0x3f')],{'$or':_[_0x7bc8('0x2e')](_0x44afe0,function(_0x2a3097){if(_0x2a3097[_0x7bc8('0x31')]!==_0x7bc8('0x42')){var _0x5185c5={};_0x5185c5[_0x2a3097[_0x7bc8('0x2b')]]={'$like':'%'+_0xe8418c[_0x7bc8('0x37')][_0x7bc8('0x41')]+'%'};return _0x5185c5;}})});}_0x1540b5=_[_0x7bc8('0x43')]({},_0x1540b5,_0xe8418c[_0x7bc8('0x44')]);var _0x21172d={'where':_0x1540b5[_0x7bc8('0x3f')]};return db['Campaign']['count'](_0x21172d)[_0x7bc8('0x26')](function(_0xbabf7b){_0xd7d333[_0x7bc8('0x20')]=_0xbabf7b;if(_0xe8418c['query'][_0x7bc8('0x45')]){_0x1540b5[_0x7bc8('0x46')]=[{'all':!![]}];}return db['Campaign'][_0x7bc8('0x47')](_0x1540b5);})[_0x7bc8('0x26')](function(_0x22f361){_0xd7d333[_0x7bc8('0x48')]=_0x22f361;return _0xd7d333;})[_0x7bc8('0x26')](respondWithFilteredResult(_0x235ab8,_0x1540b5))[_0x7bc8('0x49')](handleError(_0x235ab8,null));};exports[_0x7bc8('0x4a')]=function(_0x4c79e3,_0x397966){var _0x159350={'raw':![],'where':{'id':_0x4c79e3[_0x7bc8('0x4b')]['id']}},_0x282fd1={};_0x282fd1[_0x7bc8('0x33')]=_[_0x7bc8('0x34')](db[_0x7bc8('0x2f')][_0x7bc8('0x30')]);_0x282fd1[_0x7bc8('0x37')]=_[_0x7bc8('0x34')](_0x4c79e3[_0x7bc8('0x37')]);_0x282fd1[_0x7bc8('0x35')]=_['intersection'](_0x282fd1[_0x7bc8('0x33')],_0x282fd1[_0x7bc8('0x37')]);_0x159350['attributes']=_['intersection'](_0x282fd1[_0x7bc8('0x33')],qs[_0x7bc8('0x39')](_0x4c79e3[_0x7bc8('0x37')][_0x7bc8('0x39')]));_0x159350[_0x7bc8('0x38')]=_0x159350[_0x7bc8('0x38')][_0x7bc8('0x3a')]?_0x159350[_0x7bc8('0x38')]:_0x282fd1[_0x7bc8('0x33')];if(_0x4c79e3[_0x7bc8('0x37')]['includeAll']){_0x159350[_0x7bc8('0x46')]=[{'all':!![]}];}_0x159350=_[_0x7bc8('0x43')]({},_0x159350,_0x4c79e3['options']);return db[_0x7bc8('0x2f')][_0x7bc8('0x4c')](_0x159350)[_0x7bc8('0x26')](handleEntityNotFound(_0x397966,null))['then'](respondWithResult(_0x397966,null))[_0x7bc8('0x49')](handleError(_0x397966,null));};exports[_0x7bc8('0x4d')]=function(_0x32166f,_0x3bc9b8){return db[_0x7bc8('0x2f')]['create'](_0x32166f[_0x7bc8('0x4e')],{})[_0x7bc8('0x26')](function(_0x1a150d){var _0x4d0d49=_0x32166f['user'][_0x7bc8('0x4f')]({'plain':!![]});if(!_0x4d0d49)throw new Error(_0x7bc8('0x50'));if(_0x4d0d49[_0x7bc8('0x51')]===_0x7bc8('0x52')){var _0x456393=_0x1a150d['get']({'plain':!![]});var _0x1794bc=_0x7bc8('0x28');return db[_0x7bc8('0x53')][_0x7bc8('0x4c')]({'where':{'name':_0x1794bc,'userProfileId':_0x4d0d49[_0x7bc8('0x54')]},'raw':!![]})[_0x7bc8('0x26')](function(_0x4b4577){if(_0x4b4577&&_0x4b4577['autoAssociation']===0x0){return db['UserProfileResource'][_0x7bc8('0x4d')]({'name':_0x456393[_0x7bc8('0x2b')],'resourceId':_0x456393['id'],'type':_0x4b4577[_0x7bc8('0x2b')],'sectionId':_0x4b4577['id']},{})[_0x7bc8('0x26')](function(){return _0x1a150d;});}else{return _0x1a150d;}})['catch'](function(_0x161fc5){logger[_0x7bc8('0x55')](_0x7bc8('0x56'),_0x161fc5);throw _0x161fc5;});}return _0x1a150d;})[_0x7bc8('0x26')](respondWithResult(_0x3bc9b8,0xc9))[_0x7bc8('0x49')](handleError(_0x3bc9b8,null));};exports[_0x7bc8('0x57')]=function(_0x24a8e1,_0x1840d1){var _0x964898={'where':{'id':_0x24a8e1[_0x7bc8('0x4b')]['id']}},_0x252026={};_0x252026[_0x7bc8('0x33')]=_['keys'](db[_0x7bc8('0x2f')][_0x7bc8('0x30')]);_0x964898['attributes']=_['intersection'](_0x252026['model'],qs[_0x7bc8('0x39')](_0x24a8e1[_0x7bc8('0x37')][_0x7bc8('0x39')]));_0x964898[_0x7bc8('0x38')]=_0x964898[_0x7bc8('0x38')][_0x7bc8('0x3a')]?_0x964898[_0x7bc8('0x38')]:_0x252026[_0x7bc8('0x33')];if(_0x24a8e1[_0x7bc8('0x37')][_0x7bc8('0x45')]){_0x964898[_0x7bc8('0x46')]=[{'all':!![]}];}_0x964898=_['merge']({},_0x964898,_0x24a8e1[_0x7bc8('0x44')]);return db[_0x7bc8('0x2f')]['find'](_0x964898)[_0x7bc8('0x26')](handleEntityNotFound(_0x1840d1,null))['then'](function(_0x41c85c){if(_0x41c85c){var _0x42ae87=_0x41c85c[_0x7bc8('0x4f')]({'plain':!![]});_0x42ae87=qs['omit'](_0x42ae87,['id',_0x7bc8('0x58'),_0x7bc8('0x59')]);_0x24a8e1[_0x7bc8('0x4e')]=_[_0x7bc8('0x5a')](_0x24a8e1[_0x7bc8('0x4e')],['id','createdAt',_0x7bc8('0x59')]);return db[_0x7bc8('0x2f')]['create'](_[_0x7bc8('0x43')](_0x42ae87,_0x24a8e1[_0x7bc8('0x4e')]),{'include':_0x24a8e1[_0x7bc8('0x37')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2734ea){var _0xf43fb2=_0x24a8e1[_0x7bc8('0x52')][_0x7bc8('0x4f')]({'plain':!![]});if(!_0xf43fb2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf43fb2[_0x7bc8('0x51')]===_0x7bc8('0x52')){var _0x3af495=_0x2734ea[_0x7bc8('0x4f')]({'plain':!![]});var _0x43f572='IvrCampaigns';return db[_0x7bc8('0x53')][_0x7bc8('0x4c')]({'where':{'name':_0x43f572,'userProfileId':_0xf43fb2[_0x7bc8('0x54')]},'raw':!![]})['then'](function(_0x186481){if(_0x186481&&_0x186481[_0x7bc8('0x5b')]===0x0){return db['UserProfileResource'][_0x7bc8('0x4d')]({'name':_0x3af495[_0x7bc8('0x2b')],'resourceId':_0x3af495['id'],'type':_0x186481['name'],'sectionId':_0x186481['id']},{})['then'](function(){return _0x2734ea;});}else{return _0x2734ea;}})[_0x7bc8('0x49')](function(_0x540f5c){logger['error'](_0x7bc8('0x56'),_0x540f5c);throw _0x540f5c;});}return _0x2734ea;});}})[_0x7bc8('0x26')](respondWithResult(_0x1840d1,0xc9))[_0x7bc8('0x49')](handleError(_0x1840d1,null));};exports[_0x7bc8('0x25')]=function(_0x4b4bf9,_0x43f7a5){if(_0x4b4bf9[_0x7bc8('0x4e')]['id']){delete _0x4b4bf9['body']['id'];}return db[_0x7bc8('0x2f')][_0x7bc8('0x4c')]({'where':{'id':_0x4b4bf9['params']['id']}})['then'](handleEntityNotFound(_0x43f7a5,null))[_0x7bc8('0x26')](saveUpdates(_0x4b4bf9[_0x7bc8('0x4e')],null))['then'](respondWithResult(_0x43f7a5,null))[_0x7bc8('0x49')](handleError(_0x43f7a5,null));};exports[_0x7bc8('0x27')]=function(_0x54184f,_0x55bfa2){return db[_0x7bc8('0x2f')][_0x7bc8('0x4c')]({'where':{'id':_0x54184f[_0x7bc8('0x4b')]['id']}})[_0x7bc8('0x26')](handleEntityNotFound(_0x55bfa2,null))[_0x7bc8('0x26')](removeEntity(_0x55bfa2,null))[_0x7bc8('0x49')](handleError(_0x55bfa2,null));};exports['getHoppers']=function(_0x230d47,_0x253c38,_0x583ac8){var _0x5b0acb={'raw':!![],'where':{}};var _0x41d6d0={};var _0x46c8f3={'count':0x0,'rows':[]};return db[_0x7bc8('0x2f')][_0x7bc8('0x5c')]({'where':{'id':_0x230d47['params']['id']}})[_0x7bc8('0x26')](handleEntityNotFound(_0x253c38,null))[_0x7bc8('0x26')](function(_0x30ac02){if(_0x30ac02){_0x41d6d0['model']=_[_0x7bc8('0x34')](db[_0x7bc8('0x5d')]['rawAttributes']);_0x41d6d0['query']=_['keys'](_0x230d47[_0x7bc8('0x37')]);_0x41d6d0['filters']=_[_0x7bc8('0x36')](_0x41d6d0['model'],_0x41d6d0[_0x7bc8('0x37')]);_0x5b0acb[_0x7bc8('0x38')]=_[_0x7bc8('0x36')](_0x41d6d0[_0x7bc8('0x33')],qs[_0x7bc8('0x39')](_0x230d47[_0x7bc8('0x37')]['fields']));_0x5b0acb[_0x7bc8('0x38')]=_0x5b0acb[_0x7bc8('0x38')][_0x7bc8('0x3a')]?_0x5b0acb['attributes']:_0x41d6d0[_0x7bc8('0x33')];if(!_0x230d47[_0x7bc8('0x37')][_0x7bc8('0x3b')](_0x7bc8('0x3c'))){_0x5b0acb[_0x7bc8('0x1f')]=qs[_0x7bc8('0x1f')](_0x230d47[_0x7bc8('0x37')][_0x7bc8('0x1f')]);_0x5b0acb[_0x7bc8('0x1d')]=qs['offset'](_0x230d47['query'][_0x7bc8('0x1d')]);}_0x5b0acb['order']=qs[_0x7bc8('0x3e')](_0x230d47[_0x7bc8('0x37')][_0x7bc8('0x3e')]);_0x5b0acb[_0x7bc8('0x3f')]=qs[_0x7bc8('0x35')](_[_0x7bc8('0x40')](_0x230d47[_0x7bc8('0x37')],_0x41d6d0['filters']));_0x5b0acb[_0x7bc8('0x3f')][_0x7bc8('0x5e')]=_0x30ac02['id'];if(_0x230d47[_0x7bc8('0x37')][_0x7bc8('0x41')]){_0x5b0acb[_0x7bc8('0x3f')]=_[_0x7bc8('0x43')](_0x5b0acb['where'],{'$or':_[_0x7bc8('0x2e')](_0x5b0acb[_0x7bc8('0x38')],function(_0x406c35){var _0x486021={};_0x486021[_0x406c35]={'$like':'%'+_0x230d47[_0x7bc8('0x37')][_0x7bc8('0x41')]+'%'};return _0x486021;})});}_0x5b0acb=_[_0x7bc8('0x43')]({},_0x5b0acb,_0x230d47[_0x7bc8('0x44')]);return db[_0x7bc8('0x5d')][_0x7bc8('0x20')]({'where':_0x5b0acb['where']})[_0x7bc8('0x26')](function(_0x266ff6){_0x46c8f3[_0x7bc8('0x20')]=_0x266ff6;if(_0x230d47[_0x7bc8('0x37')][_0x7bc8('0x45')]){_0x5b0acb['include']=[{'all':!![]}];}return db[_0x7bc8('0x5d')][_0x7bc8('0x47')](_0x5b0acb);})[_0x7bc8('0x26')](function(_0x548e03){_0x46c8f3[_0x7bc8('0x48')]=_0x548e03;return _0x46c8f3;});}})[_0x7bc8('0x26')](respondWithFilteredResult(_0x253c38,_0x5b0acb))[_0x7bc8('0x49')](handleError(_0x253c38,null));};exports[_0x7bc8('0x5f')]=function(_0x523944,_0x5ac909,_0x1821cd){var _0x3b9408={'raw':!![],'where':{}};var _0xce00bc={};var _0x22e3ec={'count':0x0,'rows':[]};return db['Campaign'][_0x7bc8('0x5c')]({'where':{'id':_0x523944[_0x7bc8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5ac909,null))[_0x7bc8('0x26')](function(_0x250a6e){if(_0x250a6e){_0xce00bc[_0x7bc8('0x33')]=_[_0x7bc8('0x34')](db[_0x7bc8('0x60')]['rawAttributes']);_0xce00bc[_0x7bc8('0x37')]=_[_0x7bc8('0x34')](_0x523944[_0x7bc8('0x37')]);_0xce00bc[_0x7bc8('0x35')]=_[_0x7bc8('0x36')](_0xce00bc['model'],_0xce00bc[_0x7bc8('0x37')]);_0x3b9408[_0x7bc8('0x38')]=_[_0x7bc8('0x36')](_0xce00bc[_0x7bc8('0x33')],qs[_0x7bc8('0x39')](_0x523944[_0x7bc8('0x37')][_0x7bc8('0x39')]));_0x3b9408['attributes']=_0x3b9408[_0x7bc8('0x38')][_0x7bc8('0x3a')]?_0x3b9408['attributes']:_0xce00bc[_0x7bc8('0x33')];if(!_0x523944[_0x7bc8('0x37')][_0x7bc8('0x3b')](_0x7bc8('0x3c'))){_0x3b9408[_0x7bc8('0x1f')]=qs[_0x7bc8('0x1f')](_0x523944['query'][_0x7bc8('0x1f')]);_0x3b9408['offset']=qs['offset'](_0x523944['query'][_0x7bc8('0x1d')]);}_0x3b9408['order']=qs[_0x7bc8('0x3e')](_0x523944['query'][_0x7bc8('0x3e')]);_0x3b9408[_0x7bc8('0x3f')]=qs[_0x7bc8('0x35')](_[_0x7bc8('0x40')](_0x523944[_0x7bc8('0x37')],_0xce00bc['filters']));_0x3b9408[_0x7bc8('0x3f')]['CampaignId']=_0x250a6e['id'];if(_0x523944[_0x7bc8('0x37')][_0x7bc8('0x41')]){_0x3b9408[_0x7bc8('0x3f')]=_[_0x7bc8('0x43')](_0x3b9408[_0x7bc8('0x3f')],{'$or':_[_0x7bc8('0x2e')](_0x3b9408[_0x7bc8('0x38')],function(_0x6a2bc9){var _0x3c0ad3={};_0x3c0ad3[_0x6a2bc9]={'$like':'%'+_0x523944[_0x7bc8('0x37')][_0x7bc8('0x41')]+'%'};return _0x3c0ad3;})});}_0x3b9408=_[_0x7bc8('0x43')]({},_0x3b9408,_0x523944[_0x7bc8('0x44')]);return db[_0x7bc8('0x60')][_0x7bc8('0x20')]({'where':_0x3b9408[_0x7bc8('0x3f')]})[_0x7bc8('0x26')](function(_0x42f254){_0x22e3ec[_0x7bc8('0x20')]=_0x42f254;if(_0x523944[_0x7bc8('0x37')]['includeAll']){_0x3b9408[_0x7bc8('0x46')]=[{'all':!![]}];}return db[_0x7bc8('0x60')][_0x7bc8('0x47')](_0x3b9408);})[_0x7bc8('0x26')](function(_0xfa9422){_0x22e3ec[_0x7bc8('0x48')]=_0xfa9422;return _0x22e3ec;});}})[_0x7bc8('0x26')](respondWithFilteredResult(_0x5ac909,_0x3b9408))[_0x7bc8('0x49')](handleError(_0x5ac909,null));};exports['getHopperFinals']=function(_0x44437c,_0x3dee36,_0x42eaa7){var _0x4a9b8e={'raw':!![],'where':{}};var _0x16b1f8={};var _0x57866d={'count':0x0,'rows':[]};return db[_0x7bc8('0x2f')][_0x7bc8('0x5c')]({'where':{'id':_0x44437c['params']['id']}})[_0x7bc8('0x26')](handleEntityNotFound(_0x3dee36,null))[_0x7bc8('0x26')](function(_0x23ce88){if(_0x23ce88){_0x16b1f8[_0x7bc8('0x33')]=_[_0x7bc8('0x34')](db['CmHopperFinal']['rawAttributes']);_0x16b1f8['query']=_[_0x7bc8('0x34')](_0x44437c[_0x7bc8('0x37')]);_0x16b1f8[_0x7bc8('0x35')]=_[_0x7bc8('0x36')](_0x16b1f8[_0x7bc8('0x33')],_0x16b1f8[_0x7bc8('0x37')]);_0x4a9b8e['attributes']=_[_0x7bc8('0x36')](_0x16b1f8[_0x7bc8('0x33')],qs[_0x7bc8('0x39')](_0x44437c[_0x7bc8('0x37')][_0x7bc8('0x39')]));_0x4a9b8e[_0x7bc8('0x38')]=_0x4a9b8e[_0x7bc8('0x38')][_0x7bc8('0x3a')]?_0x4a9b8e[_0x7bc8('0x38')]:_0x16b1f8[_0x7bc8('0x33')];if(!_0x44437c[_0x7bc8('0x37')]['hasOwnProperty'](_0x7bc8('0x3c'))){_0x4a9b8e[_0x7bc8('0x1f')]=qs[_0x7bc8('0x1f')](_0x44437c[_0x7bc8('0x37')][_0x7bc8('0x1f')]);_0x4a9b8e[_0x7bc8('0x1d')]=qs[_0x7bc8('0x1d')](_0x44437c['query'][_0x7bc8('0x1d')]);}_0x4a9b8e['order']=qs['sort'](_0x44437c[_0x7bc8('0x37')]['sort']);_0x4a9b8e[_0x7bc8('0x3f')]=qs[_0x7bc8('0x35')](_[_0x7bc8('0x40')](_0x44437c[_0x7bc8('0x37')],_0x16b1f8[_0x7bc8('0x35')]));_0x4a9b8e[_0x7bc8('0x3f')][_0x7bc8('0x5e')]=_0x23ce88['id'];if(_0x44437c[_0x7bc8('0x37')][_0x7bc8('0x41')]){_0x4a9b8e[_0x7bc8('0x3f')]=_[_0x7bc8('0x43')](_0x4a9b8e[_0x7bc8('0x3f')],{'$or':_[_0x7bc8('0x2e')](_0x4a9b8e[_0x7bc8('0x38')],function(_0x458b97){var _0x532fbc={};_0x532fbc[_0x458b97]={'$like':'%'+_0x44437c[_0x7bc8('0x37')][_0x7bc8('0x41')]+'%'};return _0x532fbc;})});}_0x4a9b8e=_[_0x7bc8('0x43')]({},_0x4a9b8e,_0x44437c[_0x7bc8('0x44')]);return db[_0x7bc8('0x61')][_0x7bc8('0x20')]({'where':_0x4a9b8e[_0x7bc8('0x3f')]})[_0x7bc8('0x26')](function(_0x37d0c2){_0x57866d[_0x7bc8('0x20')]=_0x37d0c2;if(_0x44437c[_0x7bc8('0x37')][_0x7bc8('0x45')]){_0x4a9b8e[_0x7bc8('0x46')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7bc8('0x47')](_0x4a9b8e);})[_0x7bc8('0x26')](function(_0x32f15b){_0x57866d['rows']=_0x32f15b;return _0x57866d;});}})[_0x7bc8('0x26')](respondWithFilteredResult(_0x3dee36,_0x4a9b8e))[_0x7bc8('0x49')](handleError(_0x3dee36,null));};exports[_0x7bc8('0x62')]=function(_0x42bbcb,_0xdaf6f6,_0x6673b5){var _0x529308={'raw':!![],'where':{}};var _0x4b172f={};var _0x54a74d={'count':0x0,'rows':[]};return db['Campaign'][_0x7bc8('0x5c')]({'where':{'id':_0x42bbcb['params']['id']}})[_0x7bc8('0x26')](handleEntityNotFound(_0xdaf6f6,null))[_0x7bc8('0x26')](function(_0x2b11bc){if(_0x2b11bc){_0x4b172f['model']=_[_0x7bc8('0x34')](db[_0x7bc8('0x63')][_0x7bc8('0x30')]);_0x4b172f[_0x7bc8('0x37')]=_[_0x7bc8('0x34')](_0x42bbcb['query']);_0x4b172f[_0x7bc8('0x35')]=_[_0x7bc8('0x36')](_0x4b172f['model'],_0x4b172f[_0x7bc8('0x37')]);_0x529308[_0x7bc8('0x38')]=_[_0x7bc8('0x36')](_0x4b172f[_0x7bc8('0x33')],qs['fields'](_0x42bbcb[_0x7bc8('0x37')]['fields']));_0x529308[_0x7bc8('0x38')]=_0x529308[_0x7bc8('0x38')]['length']?_0x529308[_0x7bc8('0x38')]:_0x4b172f['model'];if(!_0x42bbcb[_0x7bc8('0x37')][_0x7bc8('0x3b')](_0x7bc8('0x3c'))){_0x529308[_0x7bc8('0x1f')]=qs[_0x7bc8('0x1f')](_0x42bbcb[_0x7bc8('0x37')][_0x7bc8('0x1f')]);_0x529308[_0x7bc8('0x1d')]=qs['offset'](_0x42bbcb['query'][_0x7bc8('0x1d')]);}_0x529308[_0x7bc8('0x3d')]=qs[_0x7bc8('0x3e')](_0x42bbcb[_0x7bc8('0x37')][_0x7bc8('0x3e')]);_0x529308[_0x7bc8('0x3f')]=qs['filters'](_['pick'](_0x42bbcb[_0x7bc8('0x37')],_0x4b172f['filters']));_0x529308[_0x7bc8('0x3f')]['CampaignId']=_0x2b11bc['id'];if(_0x42bbcb['query'][_0x7bc8('0x41')]){_0x529308[_0x7bc8('0x3f')]=_[_0x7bc8('0x43')](_0x529308['where'],{'$or':_[_0x7bc8('0x2e')](_0x529308[_0x7bc8('0x38')],function(_0x56aa09){var _0x2ce097={};_0x2ce097[_0x56aa09]={'$like':'%'+_0x42bbcb[_0x7bc8('0x37')][_0x7bc8('0x41')]+'%'};return _0x2ce097;})});}_0x529308=_[_0x7bc8('0x43')]({},_0x529308,_0x42bbcb[_0x7bc8('0x44')]);return db['CmHopperBlack']['count']({'where':_0x529308[_0x7bc8('0x3f')]})[_0x7bc8('0x26')](function(_0xdba37f){_0x54a74d[_0x7bc8('0x20')]=_0xdba37f;if(_0x42bbcb[_0x7bc8('0x37')][_0x7bc8('0x45')]){_0x529308[_0x7bc8('0x46')]=[{'all':!![]}];}return db[_0x7bc8('0x63')][_0x7bc8('0x47')](_0x529308);})[_0x7bc8('0x26')](function(_0x18221f){_0x54a74d[_0x7bc8('0x48')]=_0x18221f;return _0x54a74d;});}})[_0x7bc8('0x26')](respondWithFilteredResult(_0xdaf6f6,_0x529308))['catch'](handleError(_0xdaf6f6,null));};exports[_0x7bc8('0x64')]=function(_0x29199f,_0x454071,_0x2053b8){var _0x2d92a5={};var _0x3fd971={};var _0x48c0e8;var _0x12acf4;return db['Campaign'][_0x7bc8('0x5c')]({'where':{'id':_0x29199f['params']['id']}})['then'](handleEntityNotFound(_0x454071,null))[_0x7bc8('0x26')](function(_0x123bcd){if(_0x123bcd){_0x48c0e8=_0x123bcd;_0x3fd971[_0x7bc8('0x33')]=_[_0x7bc8('0x34')](db[_0x7bc8('0x65')]['rawAttributes']);_0x3fd971[_0x7bc8('0x37')]=_[_0x7bc8('0x34')](_0x29199f[_0x7bc8('0x37')]);_0x3fd971[_0x7bc8('0x35')]=_[_0x7bc8('0x36')](_0x3fd971[_0x7bc8('0x33')],_0x3fd971['query']);_0x2d92a5['attributes']=_[_0x7bc8('0x36')](_0x3fd971[_0x7bc8('0x33')],qs[_0x7bc8('0x39')](_0x29199f['query'][_0x7bc8('0x39')]));_0x2d92a5[_0x7bc8('0x38')]=_0x2d92a5[_0x7bc8('0x38')]['length']?_0x2d92a5[_0x7bc8('0x38')]:_0x3fd971[_0x7bc8('0x33')];_0x2d92a5[_0x7bc8('0x3d')]=qs[_0x7bc8('0x3e')](_0x29199f[_0x7bc8('0x37')]['sort']);_0x2d92a5['where']=qs[_0x7bc8('0x35')](_[_0x7bc8('0x40')](_0x29199f['query'],_0x3fd971[_0x7bc8('0x35')]));if(_0x29199f[_0x7bc8('0x37')][_0x7bc8('0x41')]){_0x2d92a5['where']=_['merge'](_0x2d92a5[_0x7bc8('0x3f')],{'$or':_[_0x7bc8('0x2e')](_0x2d92a5[_0x7bc8('0x38')],function(_0x26e864){var _0x177dc4={};_0x177dc4[_0x26e864]={'$like':'%'+_0x29199f['query'][_0x7bc8('0x41')]+'%'};return _0x177dc4;})});}_0x2d92a5=_[_0x7bc8('0x43')]({},_0x2d92a5,_0x29199f['options']);return _0x48c0e8[_0x7bc8('0x64')](_0x2d92a5);}})[_0x7bc8('0x26')](function(_0x5b7d92){if(_0x5b7d92){_0x12acf4=_0x5b7d92[_0x7bc8('0x3a')];if(!_0x29199f[_0x7bc8('0x37')]['hasOwnProperty'](_0x7bc8('0x3c'))){_0x2d92a5[_0x7bc8('0x1f')]=qs[_0x7bc8('0x1f')](_0x29199f[_0x7bc8('0x37')][_0x7bc8('0x1f')]);_0x2d92a5[_0x7bc8('0x1d')]=qs[_0x7bc8('0x1d')](_0x29199f[_0x7bc8('0x37')][_0x7bc8('0x1d')]);}return _0x48c0e8[_0x7bc8('0x64')](_0x2d92a5);}})[_0x7bc8('0x26')](function(_0x235910){if(_0x235910){return _0x235910?{'count':_0x12acf4,'rows':_0x235910}:null;}})['then'](respondWithResult(_0x454071,null))[_0x7bc8('0x49')](handleError(_0x454071,null));};exports['addLists']=function(_0x6dbbe3,_0x5723fa,_0x384c6c){var _0x32f09f,_0x7cf132;var _0x292764=[];var _0x21e3bb=moment()[_0x7bc8('0x66')](_0x7bc8('0x67'));return db[_0x7bc8('0x2f')][_0x7bc8('0x4c')]({'where':{'id':_0x6dbbe3[_0x7bc8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5723fa,null))[_0x7bc8('0x26')](function(_0x4c890c){if(_0x4c890c){_0x7cf132=_0x4c890c;return _0x4c890c[_0x7bc8('0x68')](_0x6dbbe3[_0x7bc8('0x4e')][_0x7bc8('0x69')],_['omit'](_0x6dbbe3[_0x7bc8('0x4e')],[_0x7bc8('0x69'),'id'])||{});}return null;})[_0x7bc8('0x6a')](function(_0x571e47){var _0x5f2e6a;var _0x12328c;_0x32f09f=_0x571e47||[];var _0x35108f=[];if(_0x571e47){for(var _0x10a8ef=0x0;_0x10a8ef<_0x571e47[_0x7bc8('0x3a')];_0x10a8ef+=0x1){var _0x3dd8e7=_0x571e47[_0x10a8ef][_0x7bc8('0x4f')]({'plain':!![]});_0x7cf132[_0x7bc8('0x6b')]=_0x6dbbe3['body'][_0x7bc8('0x6b')]?_0x6dbbe3['body']['dialCheckDuplicateType']:_0x7cf132[_0x7bc8('0x6b')];switch(_0x7cf132[_0x7bc8('0x6b')]){case'always':_0x5f2e6a=squel[_0x7bc8('0x6c')]()[_0x7bc8('0x6d')](_0x7bc8('0x6e'))['fromQuery']([_0x7bc8('0x6f'),_0x7bc8('0x70'),'ContactId',_0x7bc8('0x71'),_0x7bc8('0x5e'),'createdAt',_0x7bc8('0x59')],squel[_0x7bc8('0x72')]()[_0x7bc8('0x73')](_0x7bc8('0x6f'),_0x7bc8('0x6f'))[_0x7bc8('0x73')]('NOW()',_0x7bc8('0x70'))['field']('id','ContactId')[_0x7bc8('0x73')](_0x3dd8e7['CmListId'][_0x7bc8('0x74')](),_0x7bc8('0x71'))[_0x7bc8('0x73')](_0x6dbbe3[_0x7bc8('0x4b')]['id']['toString'](),_0x7bc8('0x5e'))['field']('\x27'+_0x21e3bb+'\x27',_0x7bc8('0x58'))[_0x7bc8('0x73')]('\x27'+_0x21e3bb+'\x27','updatedAt')[_0x7bc8('0x75')](_0x7bc8('0x76'))[_0x7bc8('0x3f')]('deletedAt\x20IS\x20NULL')[_0x7bc8('0x3f')](_0x7bc8('0x77'),_0x3dd8e7[_0x7bc8('0x78')][_0x7bc8('0x74')]())[_0x7bc8('0x3f')](_0x7bc8('0x79'))[_0x7bc8('0x3f')](_0x7bc8('0x7a'),squel[_0x7bc8('0x72')]()[_0x7bc8('0x73')]('COALESCE(calleridnum,\x27\x27)')[_0x7bc8('0x75')](_0x7bc8('0x7b'))[_0x7bc8('0x3f')](_0x7bc8('0x7c'),_0x6dbbe3['params']['id'][_0x7bc8('0x74')]()))[_0x7bc8('0x3f')](_0x7bc8('0x7a'),squel[_0x7bc8('0x72')]()[_0x7bc8('0x73')](_0x7bc8('0x7d'))['from'](_0x7bc8('0x6e'))[_0x7bc8('0x3f')](_0x7bc8('0x7c'),_0x6dbbe3[_0x7bc8('0x4b')]['id']['toString']())))[_0x7bc8('0x74')]();break;case _0x7bc8('0x7e'):_0x5f2e6a=squel[_0x7bc8('0x6c')]()[_0x7bc8('0x6d')]('cm_hopper')[_0x7bc8('0x7f')](['phone',_0x7bc8('0x70'),_0x7bc8('0x80'),'ListId',_0x7bc8('0x5e'),_0x7bc8('0x58'),'updatedAt'],squel[_0x7bc8('0x72')]()[_0x7bc8('0x73')](_0x7bc8('0x6f'),_0x7bc8('0x6f'))['field'](_0x7bc8('0x81'),_0x7bc8('0x70'))[_0x7bc8('0x73')]('id',_0x7bc8('0x80'))['field'](_0x3dd8e7[_0x7bc8('0x78')][_0x7bc8('0x74')](),'ListId')[_0x7bc8('0x73')](_0x6dbbe3['params']['id'][_0x7bc8('0x74')](),'CampaignId')[_0x7bc8('0x73')]('\x27'+_0x21e3bb+'\x27',_0x7bc8('0x58'))[_0x7bc8('0x73')]('\x27'+_0x21e3bb+'\x27',_0x7bc8('0x59'))[_0x7bc8('0x75')](_0x7bc8('0x76'))[_0x7bc8('0x3f')](_0x7bc8('0x82'))['where'](_0x7bc8('0x77'),_0x3dd8e7['CmListId'][_0x7bc8('0x74')]())['where'](_0x7bc8('0x79'))[_0x7bc8('0x3f')](_0x7bc8('0x7a'),squel[_0x7bc8('0x72')]()[_0x7bc8('0x73')](_0x7bc8('0x7d'))['from'](_0x7bc8('0x6e'))[_0x7bc8('0x3f')](_0x7bc8('0x7c'),_0x6dbbe3['params']['id'][_0x7bc8('0x74')]())))[_0x7bc8('0x74')]();break;default:_0x5f2e6a=squel[_0x7bc8('0x6c')]()[_0x7bc8('0x6d')]('cm_hopper')[_0x7bc8('0x7f')]([_0x7bc8('0x6f'),_0x7bc8('0x70'),_0x7bc8('0x80'),_0x7bc8('0x71'),_0x7bc8('0x5e'),_0x7bc8('0x58'),_0x7bc8('0x59')],squel[_0x7bc8('0x72')]()[_0x7bc8('0x73')]('phone',_0x7bc8('0x6f'))[_0x7bc8('0x73')]('NOW()',_0x7bc8('0x70'))[_0x7bc8('0x73')]('id',_0x7bc8('0x80'))[_0x7bc8('0x73')](_0x3dd8e7[_0x7bc8('0x78')][_0x7bc8('0x74')](),_0x7bc8('0x71'))[_0x7bc8('0x73')](_0x6dbbe3[_0x7bc8('0x4b')]['id']['toString'](),_0x7bc8('0x5e'))[_0x7bc8('0x73')]('\x27'+_0x21e3bb+'\x27','createdAt')['field']('\x27'+_0x21e3bb+'\x27',_0x7bc8('0x59'))[_0x7bc8('0x75')](_0x7bc8('0x76'))['where'](_0x7bc8('0x82'))[_0x7bc8('0x3f')](_0x7bc8('0x77'),_0x3dd8e7[_0x7bc8('0x78')][_0x7bc8('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x7bc8('0x74')]();}_0x12328c=squel[_0x7bc8('0x6c')]()[_0x7bc8('0x6d')](_0x7bc8('0x83'))[_0x7bc8('0x7f')]([_0x7bc8('0x84'),_0x7bc8('0x70'),_0x7bc8('0x6f'),_0x7bc8('0x85'),'createdAt',_0x7bc8('0x59')],squel[_0x7bc8('0x72')]()[_0x7bc8('0x73')](_0x7bc8('0x86'),'id')['field'](_0x7bc8('0x81'),_0x7bc8('0x70'))['field']('ci.item',_0x7bc8('0x6f'))[_0x7bc8('0x73')](_0x7bc8('0x87'),'OrderBy')[_0x7bc8('0x73')]('\x27'+_0x21e3bb+'\x27',_0x7bc8('0x58'))[_0x7bc8('0x73')]('\x27'+_0x21e3bb+'\x27',_0x7bc8('0x59'))[_0x7bc8('0x75')]('cm_contact_has_items','ci')[_0x7bc8('0x88')]('cm_hopper','h',_0x7bc8('0x89'))[_0x7bc8('0x3f')]('h.ListId\x20=\x20?',_0x3dd8e7[_0x7bc8('0x78')][_0x7bc8('0x74')]())['where'](_0x7bc8('0x8a'),_0x6dbbe3['params']['id'][_0x7bc8('0x74')]())[_0x7bc8('0x3f')](_0x7bc8('0x8b'),_0x21e3bb))[_0x7bc8('0x74')]();_0x35108f['push'](db[_0x7bc8('0x8c')][_0x7bc8('0x37')](_0x5f2e6a));_0x292764['push'](db['sequelize']['query'](_0x12328c));}return BPromise[_0x7bc8('0x8d')](_0x35108f);}})[_0x7bc8('0x26')](function(){return BPromise['all'](_0x292764);})[_0x7bc8('0x26')](function(){return _0x32f09f;})[_0x7bc8('0x26')](respondWithResult(_0x5723fa,null))[_0x7bc8('0x49')](handleError(_0x5723fa,null));};exports[_0x7bc8('0x8e')]=function(_0x2825c8,_0x37bb16,_0xb13689){return db[_0x7bc8('0x2f')][_0x7bc8('0x4c')]({'where':{'id':_0x2825c8['params']['id']}})[_0x7bc8('0x26')](handleEntityNotFound(_0x37bb16,null))[_0x7bc8('0x26')](function(_0x79a0c8){if(_0x79a0c8){return _0x79a0c8[_0x7bc8('0x8e')](_0x2825c8[_0x7bc8('0x37')][_0x7bc8('0x69')]);}})[_0x7bc8('0x26')](function(_0x1acb96){if(_0x1acb96){return db[_0x7bc8('0x5d')]['destroy']({'where':{'ListId':_0x2825c8[_0x7bc8('0x37')][_0x7bc8('0x69')],'CampaignId':_0x2825c8[_0x7bc8('0x4b')]['id']}})[_0x7bc8('0x26')](function(){return _0x1acb96;});}})[_0x7bc8('0x26')](respondWithStatusCode(_0x37bb16,null))[_0x7bc8('0x49')](handleError(_0x37bb16,null));};exports[_0x7bc8('0x8f')]=function(_0x30dd57,_0xa3143f,_0x3b9628){var _0x3bb720={};var _0x277a4a={};var _0x169011;var _0x676223;return db[_0x7bc8('0x2f')][_0x7bc8('0x5c')]({'where':{'id':_0x30dd57[_0x7bc8('0x4b')]['id']}})[_0x7bc8('0x26')](handleEntityNotFound(_0xa3143f,null))[_0x7bc8('0x26')](function(_0x52ce57){if(_0x52ce57){_0x169011=_0x52ce57;_0x277a4a[_0x7bc8('0x33')]=_[_0x7bc8('0x34')](db[_0x7bc8('0x65')][_0x7bc8('0x30')]);_0x277a4a[_0x7bc8('0x37')]=_['keys'](_0x30dd57['query']);_0x277a4a[_0x7bc8('0x35')]=_[_0x7bc8('0x36')](_0x277a4a[_0x7bc8('0x33')],_0x277a4a[_0x7bc8('0x37')]);_0x3bb720[_0x7bc8('0x38')]=_[_0x7bc8('0x36')](_0x277a4a[_0x7bc8('0x33')],qs['fields'](_0x30dd57[_0x7bc8('0x37')][_0x7bc8('0x39')]));_0x3bb720[_0x7bc8('0x38')]=_0x3bb720[_0x7bc8('0x38')][_0x7bc8('0x3a')]?_0x3bb720[_0x7bc8('0x38')]:_0x277a4a[_0x7bc8('0x33')];_0x3bb720[_0x7bc8('0x3d')]=qs[_0x7bc8('0x3e')](_0x30dd57[_0x7bc8('0x37')][_0x7bc8('0x3e')]);_0x3bb720['where']=qs[_0x7bc8('0x35')](_[_0x7bc8('0x40')](_0x30dd57[_0x7bc8('0x37')],_0x277a4a['filters']));if(_0x30dd57['query'][_0x7bc8('0x41')]){_0x3bb720['where']=_['merge'](_0x3bb720[_0x7bc8('0x3f')],{'$or':_['map'](_0x3bb720['attributes'],function(_0x59cf30){var _0x41dc43={};_0x41dc43[_0x59cf30]={'$like':'%'+_0x30dd57[_0x7bc8('0x37')]['filter']+'%'};return _0x41dc43;})});}_0x3bb720=_[_0x7bc8('0x43')]({},_0x3bb720,_0x30dd57[_0x7bc8('0x44')]);return _0x169011[_0x7bc8('0x8f')](_0x3bb720);}})[_0x7bc8('0x26')](function(_0x2a72fd){if(_0x2a72fd){_0x676223=_0x2a72fd[_0x7bc8('0x3a')];if(!_0x30dd57[_0x7bc8('0x37')]['hasOwnProperty']('nolimit')){_0x3bb720['limit']=qs[_0x7bc8('0x1f')](_0x30dd57[_0x7bc8('0x37')][_0x7bc8('0x1f')]);_0x3bb720[_0x7bc8('0x1d')]=qs[_0x7bc8('0x1d')](_0x30dd57[_0x7bc8('0x37')]['offset']);}return _0x169011[_0x7bc8('0x8f')](_0x3bb720);}})['then'](function(_0x15d4f5){if(_0x15d4f5){return _0x15d4f5?{'count':_0x676223,'rows':_0x15d4f5}:null;}})[_0x7bc8('0x26')](respondWithResult(_0xa3143f,null))[_0x7bc8('0x49')](handleError(_0xa3143f,null));};exports[_0x7bc8('0x90')]=function(_0x4ea066,_0x122cc8,_0x325553){var _0x57bbb3,_0x551af2;var _0x4254f7=[];var _0x50c6d6=moment()[_0x7bc8('0x66')](_0x7bc8('0x67'));return db[_0x7bc8('0x2f')][_0x7bc8('0x4c')]({'where':{'id':_0x4ea066['params']['id']}})[_0x7bc8('0x26')](handleEntityNotFound(_0x122cc8,null))[_0x7bc8('0x26')](function(_0x4c3c24){if(_0x4c3c24){_0x551af2=_0x4c3c24;return _0x4c3c24[_0x7bc8('0x90')](_0x4ea066[_0x7bc8('0x4e')][_0x7bc8('0x69')],_[_0x7bc8('0x5a')](_0x4ea066['body'],[_0x7bc8('0x69'),'id'])||{});}return null;})[_0x7bc8('0x6a')](function(_0xa7f1f9){var _0x1c35eb;var _0x25ef72;_0x57bbb3=_0xa7f1f9||[];var _0x114809=[];if(_0xa7f1f9){for(var _0x3fbae2=0x0;_0x3fbae2<_0xa7f1f9[_0x7bc8('0x3a')];_0x3fbae2+=0x1){var _0x6dd331=_0xa7f1f9[_0x3fbae2][_0x7bc8('0x4f')]({'plain':!![]});_0x1c35eb=squel[_0x7bc8('0x6c')]()[_0x7bc8('0x6d')](_0x7bc8('0x91'))[_0x7bc8('0x7f')]([_0x7bc8('0x6f'),_0x7bc8('0x80'),_0x7bc8('0x71'),_0x7bc8('0x5e'),_0x7bc8('0x58'),_0x7bc8('0x59')],squel['select']()['field'](_0x7bc8('0x6f'),_0x7bc8('0x6f'))[_0x7bc8('0x73')]('id',_0x7bc8('0x80'))[_0x7bc8('0x73')](_0x6dd331[_0x7bc8('0x78')][_0x7bc8('0x74')](),_0x7bc8('0x71'))[_0x7bc8('0x73')](_0x4ea066['params']['id'][_0x7bc8('0x74')](),_0x7bc8('0x5e'))[_0x7bc8('0x73')](_0x7bc8('0x81'),_0x7bc8('0x58'))[_0x7bc8('0x73')]('NOW()',_0x7bc8('0x59'))[_0x7bc8('0x75')]('cm_contacts')[_0x7bc8('0x3f')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x6dd331['CmListId'][_0x7bc8('0x74')]())[_0x7bc8('0x3f')](_0x7bc8('0x79')))[_0x7bc8('0x74')]();_0x114809['push'](db['sequelize'][_0x7bc8('0x37')](_0x1c35eb));}return BPromise[_0x7bc8('0x8d')](_0x114809);}})[_0x7bc8('0x26')](function(){return _0x57bbb3;})[_0x7bc8('0x26')](respondWithResult(_0x122cc8,null))[_0x7bc8('0x49')](handleError(_0x122cc8,null));};exports[_0x7bc8('0x92')]=function(_0x401fd5,_0x4aa6d0,_0x555427){return db['Campaign']['find']({'where':{'id':_0x401fd5[_0x7bc8('0x4b')]['id']}})[_0x7bc8('0x26')](handleEntityNotFound(_0x4aa6d0,null))[_0x7bc8('0x26')](function(_0x49dd05){if(_0x49dd05){return _0x49dd05['removeBlackLists'](_0x401fd5[_0x7bc8('0x37')]['ids']);}})['then'](function(_0x42395e){if(_0x42395e){return db[_0x7bc8('0x63')][_0x7bc8('0x27')]({'where':{'ListId':_0x401fd5[_0x7bc8('0x37')][_0x7bc8('0x69')],'CampaignId':_0x401fd5[_0x7bc8('0x4b')]['id']}})[_0x7bc8('0x26')](function(){return _0x42395e;});}})[_0x7bc8('0x26')](respondWithStatusCode(_0x4aa6d0,null))[_0x7bc8('0x49')](handleError(_0x4aa6d0,null));}; \ No newline at end of file +var _0xc273=['h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','sendStatus','status','offset','undefined','limit','count','set','json','apply','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','Campaign','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','merge','updatedAt','createdAt','IvrCampaigns','autoAssociation','getHoppers','findOne','pick','CampaignId','CmHopper','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','omit','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','field','NOW()','ContactId','CmListId','toString','ListId','from','cm_contacts','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0xc273,0x137));var _0x3c27=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0xc273[_0x51d129];return _0x44c377;};'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(_0x3c27('0x9'));var sox=require('sox');var csv=require(_0x3c27('0xa'));var ejs=require(_0x3c27('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c27('0xc'));var squel=require(_0x3c27('0xd'));var crypto=require(_0x3c27('0xe'));var jsforce=require(_0x3c27('0xf'));var deskjs=require(_0x3c27('0x10'));var toCsv=require(_0x3c27('0xa'));var querystring=require(_0x3c27('0x11'));var Papa=require(_0x3c27('0x12'));var Redis=require(_0x3c27('0x13'));var authService=require(_0x3c27('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3c27('0x15'));var hardwareService=require(_0x3c27('0x16'));var logger=require(_0x3c27('0x17'))(_0x3c27('0x18'));var utils=require('../../config/utils');var config=require(_0x3c27('0x19'));var licenseUtil=require(_0x3c27('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24fe22,_0x529147){_0x529147=_0x529147||0xcc;return function(_0x5da394){if(_0x5da394){return _0x24fe22[_0x3c27('0x1b')](_0x529147);}return _0x24fe22['status'](_0x529147)['end']();};}function respondWithResult(_0x463db0,_0x169a85){_0x169a85=_0x169a85||0xc8;return function(_0x1359d5){if(_0x1359d5){return _0x463db0[_0x3c27('0x1c')](_0x169a85)['json'](_0x1359d5);}};}function respondWithFilteredResult(_0x326314,_0x44c9d1){return function(_0x15d97e){if(_0x15d97e){var _0x5db456=typeof _0x44c9d1[_0x3c27('0x1d')]===_0x3c27('0x1e')&&typeof _0x44c9d1[_0x3c27('0x1f')]==='undefined';var _0x5f4b4f=_0x15d97e[_0x3c27('0x20')];var _0x21a214=_0x5db456?0x0:_0x44c9d1[_0x3c27('0x1d')];var _0x4526eb=_0x5db456?_0x15d97e[_0x3c27('0x20')]:_0x44c9d1[_0x3c27('0x1d')]+_0x44c9d1[_0x3c27('0x1f')];var _0x5d8f36;if(_0x4526eb>=_0x5f4b4f){_0x4526eb=_0x5f4b4f;_0x5d8f36=0xc8;}else{_0x5d8f36=0xce;}_0x326314[_0x3c27('0x1c')](_0x5d8f36);return _0x326314[_0x3c27('0x21')]('Content-Range',_0x21a214+'-'+_0x4526eb+'/'+_0x5f4b4f)[_0x3c27('0x22')](_0x15d97e);}return null;};}function patchUpdates(_0x2d0d9a){return function(_0x1e2b8f){try{jsonpatch[_0x3c27('0x23')](_0x1e2b8f,_0x2d0d9a,!![]);}catch(_0x1d9c90){return BPromise['reject'](_0x1d9c90);}return _0x1e2b8f['save']();};}function saveUpdates(_0x5826ea,_0x4130d4){return function(_0x27a218){if(_0x27a218){return _0x27a218[_0x3c27('0x24')](_0x5826ea)[_0x3c27('0x25')](function(_0x367c61){return _0x367c61;});}return null;};}function removeEntity(_0x4cfd76,_0x254084){return function(_0x1a3dd7){if(_0x1a3dd7){return _0x1a3dd7[_0x3c27('0x26')]()['then'](function(){var _0x53de8d=_0x1a3dd7[_0x3c27('0x27')]({'plain':!![]});var _0x534917='IvrCampaigns';return db[_0x3c27('0x28')][_0x3c27('0x26')]({'where':{'type':_0x534917,'resourceId':_0x53de8d['id']}})[_0x3c27('0x25')](function(){return _0x1a3dd7;});})[_0x3c27('0x25')](function(){_0x4cfd76[_0x3c27('0x1c')](0xcc)[_0x3c27('0x29')]();});}};}function handleEntityNotFound(_0x581093,_0x49946e){return function(_0x1eb103){if(!_0x1eb103){_0x581093[_0x3c27('0x1b')](0x194);}return _0x1eb103;};}function handleError(_0x305f96,_0x1436e4){_0x1436e4=_0x1436e4||0x1f4;return function(_0x3376b6){logger[_0x3c27('0x2a')](_0x3376b6[_0x3c27('0x2b')]);if(_0x3376b6[_0x3c27('0x2c')]){delete _0x3376b6[_0x3c27('0x2c')];}_0x305f96[_0x3c27('0x1c')](_0x1436e4)[_0x3c27('0x2d')](_0x3376b6);};}exports[_0x3c27('0x2e')]=function(_0x2f04e9,_0x5c709a){var _0x3b458c={},_0x23444b={},_0x301473={'count':0x0,'rows':[]};var _0x2261e9=_[_0x3c27('0x2f')](db['Campaign'][_0x3c27('0x30')],function(_0x16cdfc){return{'name':_0x16cdfc['fieldName'],'type':_0x16cdfc[_0x3c27('0x31')][_0x3c27('0x32')]};});_0x23444b[_0x3c27('0x33')]=_[_0x3c27('0x2f')](_0x2261e9,_0x3c27('0x2c'));_0x23444b['query']=_[_0x3c27('0x34')](_0x2f04e9['query']);_0x23444b[_0x3c27('0x35')]=_[_0x3c27('0x36')](_0x23444b[_0x3c27('0x33')],_0x23444b[_0x3c27('0x37')]);_0x3b458c['attributes']=_[_0x3c27('0x36')](_0x23444b[_0x3c27('0x33')],qs['fields'](_0x2f04e9[_0x3c27('0x37')][_0x3c27('0x38')]));_0x3b458c[_0x3c27('0x39')]=_0x3b458c[_0x3c27('0x39')][_0x3c27('0x3a')]?_0x3b458c[_0x3c27('0x39')]:_0x23444b[_0x3c27('0x33')];if(!_0x2f04e9[_0x3c27('0x37')][_0x3c27('0x3b')](_0x3c27('0x3c'))){_0x3b458c[_0x3c27('0x1f')]=qs[_0x3c27('0x1f')](_0x2f04e9[_0x3c27('0x37')][_0x3c27('0x1f')]);_0x3b458c[_0x3c27('0x1d')]=qs['offset'](_0x2f04e9[_0x3c27('0x37')]['offset']);}_0x3b458c[_0x3c27('0x3d')]=qs['sort'](_0x2f04e9['query'][_0x3c27('0x3e')]);_0x3b458c['where']=qs['filters'](_['pick'](_0x2f04e9[_0x3c27('0x37')],_0x23444b[_0x3c27('0x35')]),_0x2261e9);if(_0x2f04e9[_0x3c27('0x37')][_0x3c27('0x3f')]){_0x3b458c[_0x3c27('0x40')]=_['merge'](_0x3b458c[_0x3c27('0x40')],{'$or':_[_0x3c27('0x2f')](_0x2261e9,function(_0x2ed7af){if(_0x2ed7af[_0x3c27('0x31')]!==_0x3c27('0x41')){var _0x5a882f={};_0x5a882f[_0x2ed7af[_0x3c27('0x2c')]]={'$like':'%'+_0x2f04e9[_0x3c27('0x37')][_0x3c27('0x3f')]+'%'};return _0x5a882f;}})});}_0x3b458c=_['merge']({},_0x3b458c,_0x2f04e9['options']);var _0x1285c8={'where':_0x3b458c[_0x3c27('0x40')]};return db['Campaign'][_0x3c27('0x20')](_0x1285c8)[_0x3c27('0x25')](function(_0x12f756){_0x301473[_0x3c27('0x20')]=_0x12f756;if(_0x2f04e9[_0x3c27('0x37')]['includeAll']){_0x3b458c['include']=[{'all':!![]}];}return db[_0x3c27('0x42')][_0x3c27('0x43')](_0x3b458c);})[_0x3c27('0x25')](function(_0x1b4e2a){_0x301473['rows']=_0x1b4e2a;return _0x301473;})[_0x3c27('0x25')](respondWithFilteredResult(_0x5c709a,_0x3b458c))[_0x3c27('0x44')](handleError(_0x5c709a,null));};exports[_0x3c27('0x45')]=function(_0x4ed145,_0xdc70cd){var _0x2e05c4={'raw':![],'where':{'id':_0x4ed145[_0x3c27('0x46')]['id']}},_0x280bf9={};_0x280bf9['model']=_[_0x3c27('0x34')](db[_0x3c27('0x42')][_0x3c27('0x30')]);_0x280bf9['query']=_[_0x3c27('0x34')](_0x4ed145[_0x3c27('0x37')]);_0x280bf9[_0x3c27('0x35')]=_['intersection'](_0x280bf9[_0x3c27('0x33')],_0x280bf9[_0x3c27('0x37')]);_0x2e05c4['attributes']=_[_0x3c27('0x36')](_0x280bf9[_0x3c27('0x33')],qs[_0x3c27('0x38')](_0x4ed145['query'][_0x3c27('0x38')]));_0x2e05c4[_0x3c27('0x39')]=_0x2e05c4[_0x3c27('0x39')]['length']?_0x2e05c4[_0x3c27('0x39')]:_0x280bf9[_0x3c27('0x33')];if(_0x4ed145['query']['includeAll']){_0x2e05c4[_0x3c27('0x47')]=[{'all':!![]}];}_0x2e05c4=_['merge']({},_0x2e05c4,_0x4ed145[_0x3c27('0x48')]);return db[_0x3c27('0x42')][_0x3c27('0x49')](_0x2e05c4)[_0x3c27('0x25')](handleEntityNotFound(_0xdc70cd,null))['then'](respondWithResult(_0xdc70cd,null))[_0x3c27('0x44')](handleError(_0xdc70cd,null));};exports[_0x3c27('0x4a')]=function(_0x5d5038,_0xb824c7){return db[_0x3c27('0x42')][_0x3c27('0x4a')](_0x5d5038[_0x3c27('0x4b')],{})[_0x3c27('0x25')](function(_0x973f06){var _0x548bed=_0x5d5038[_0x3c27('0x4c')][_0x3c27('0x27')]({'plain':!![]});if(!_0x548bed)throw new Error(_0x3c27('0x4d'));if(_0x548bed['role']===_0x3c27('0x4c')){var _0x251d88=_0x973f06['get']({'plain':!![]});var _0x19d5a0='IvrCampaigns';return db[_0x3c27('0x4e')]['find']({'where':{'name':_0x19d5a0,'userProfileId':_0x548bed[_0x3c27('0x4f')]},'raw':!![]})['then'](function(_0x35ade2){if(_0x35ade2&&_0x35ade2['autoAssociation']===0x0){return db[_0x3c27('0x28')][_0x3c27('0x4a')]({'name':_0x251d88[_0x3c27('0x2c')],'resourceId':_0x251d88['id'],'type':_0x35ade2['name'],'sectionId':_0x35ade2['id']},{})['then'](function(){return _0x973f06;});}else{return _0x973f06;}})[_0x3c27('0x44')](function(_0x1b9ac4){logger[_0x3c27('0x2a')](_0x3c27('0x50'),_0x1b9ac4);throw _0x1b9ac4;});}return _0x973f06;})[_0x3c27('0x25')](respondWithResult(_0xb824c7,0xc9))['catch'](handleError(_0xb824c7,null));};exports[_0x3c27('0x51')]=function(_0x4336a4,_0x93f3af){var _0x4b2640={'where':{'id':_0x4336a4[_0x3c27('0x46')]['id']}},_0x3e8f55={};_0x3e8f55[_0x3c27('0x33')]=_[_0x3c27('0x34')](db[_0x3c27('0x42')]['rawAttributes']);_0x4b2640[_0x3c27('0x39')]=_[_0x3c27('0x36')](_0x3e8f55[_0x3c27('0x33')],qs['fields'](_0x4336a4[_0x3c27('0x37')][_0x3c27('0x38')]));_0x4b2640[_0x3c27('0x39')]=_0x4b2640[_0x3c27('0x39')][_0x3c27('0x3a')]?_0x4b2640['attributes']:_0x3e8f55['model'];if(_0x4336a4[_0x3c27('0x37')][_0x3c27('0x52')]){_0x4b2640[_0x3c27('0x47')]=[{'all':!![]}];}_0x4b2640=_[_0x3c27('0x53')]({},_0x4b2640,_0x4336a4[_0x3c27('0x48')]);return db[_0x3c27('0x42')]['find'](_0x4b2640)[_0x3c27('0x25')](handleEntityNotFound(_0x93f3af,null))[_0x3c27('0x25')](function(_0x58a67e){if(_0x58a67e){var _0x15cb98=_0x58a67e[_0x3c27('0x27')]({'plain':!![]});_0x15cb98=qs['omit'](_0x15cb98,['id','createdAt',_0x3c27('0x54')]);_0x4336a4['body']=_['omit'](_0x4336a4[_0x3c27('0x4b')],['id',_0x3c27('0x55'),_0x3c27('0x54')]);return db[_0x3c27('0x42')][_0x3c27('0x4a')](_[_0x3c27('0x53')](_0x15cb98,_0x4336a4[_0x3c27('0x4b')]),{'include':_0x4336a4[_0x3c27('0x37')][_0x3c27('0x52')]?[{'all':!![]}]:undefined})[_0x3c27('0x25')](function(_0x3048f8){var _0x366dc9=_0x4336a4['user'][_0x3c27('0x27')]({'plain':!![]});if(!_0x366dc9)throw new Error(_0x3c27('0x4d'));if(_0x366dc9['role']==='user'){var _0x360c13=_0x3048f8[_0x3c27('0x27')]({'plain':!![]});var _0x31e396=_0x3c27('0x56');return db[_0x3c27('0x4e')][_0x3c27('0x49')]({'where':{'name':_0x31e396,'userProfileId':_0x366dc9[_0x3c27('0x4f')]},'raw':!![]})[_0x3c27('0x25')](function(_0x42c9a6){if(_0x42c9a6&&_0x42c9a6[_0x3c27('0x57')]===0x0){return db[_0x3c27('0x28')][_0x3c27('0x4a')]({'name':_0x360c13['name'],'resourceId':_0x360c13['id'],'type':_0x42c9a6[_0x3c27('0x2c')],'sectionId':_0x42c9a6['id']},{})[_0x3c27('0x25')](function(){return _0x3048f8;});}else{return _0x3048f8;}})[_0x3c27('0x44')](function(_0x1314d7){logger[_0x3c27('0x2a')](_0x3c27('0x50'),_0x1314d7);throw _0x1314d7;});}return _0x3048f8;});}})[_0x3c27('0x25')](respondWithResult(_0x93f3af,0xc9))['catch'](handleError(_0x93f3af,null));};exports['update']=function(_0x41ebd2,_0x192bf9){if(_0x41ebd2[_0x3c27('0x4b')]['id']){delete _0x41ebd2['body']['id'];}return db['Campaign']['find']({'where':{'id':_0x41ebd2[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x192bf9,null))[_0x3c27('0x25')](saveUpdates(_0x41ebd2[_0x3c27('0x4b')],null))[_0x3c27('0x25')](respondWithResult(_0x192bf9,null))[_0x3c27('0x44')](handleError(_0x192bf9,null));};exports[_0x3c27('0x26')]=function(_0x5ca67c,_0x544526){return db['Campaign']['find']({'where':{'id':_0x5ca67c['params']['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x544526,null))[_0x3c27('0x25')](removeEntity(_0x544526,null))['catch'](handleError(_0x544526,null));};exports[_0x3c27('0x58')]=function(_0x25a0b2,_0x4ac98c,_0x2adc75){var _0x5a56f4={'raw':!![],'where':{}};var _0x373a29={};var _0x1ef887={'count':0x0,'rows':[]};return db[_0x3c27('0x42')][_0x3c27('0x59')]({'where':{'id':_0x25a0b2[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x4ac98c,null))['then'](function(_0x59e82){if(_0x59e82){_0x373a29['model']=_['keys'](db['CmHopper'][_0x3c27('0x30')]);_0x373a29['query']=_[_0x3c27('0x34')](_0x25a0b2[_0x3c27('0x37')]);_0x373a29[_0x3c27('0x35')]=_[_0x3c27('0x36')](_0x373a29['model'],_0x373a29[_0x3c27('0x37')]);_0x5a56f4[_0x3c27('0x39')]=_['intersection'](_0x373a29['model'],qs[_0x3c27('0x38')](_0x25a0b2['query']['fields']));_0x5a56f4[_0x3c27('0x39')]=_0x5a56f4[_0x3c27('0x39')][_0x3c27('0x3a')]?_0x5a56f4['attributes']:_0x373a29[_0x3c27('0x33')];if(!_0x25a0b2[_0x3c27('0x37')]['hasOwnProperty']('nolimit')){_0x5a56f4['limit']=qs[_0x3c27('0x1f')](_0x25a0b2['query'][_0x3c27('0x1f')]);_0x5a56f4[_0x3c27('0x1d')]=qs['offset'](_0x25a0b2[_0x3c27('0x37')][_0x3c27('0x1d')]);}_0x5a56f4[_0x3c27('0x3d')]=qs[_0x3c27('0x3e')](_0x25a0b2[_0x3c27('0x37')][_0x3c27('0x3e')]);_0x5a56f4[_0x3c27('0x40')]=qs[_0x3c27('0x35')](_[_0x3c27('0x5a')](_0x25a0b2[_0x3c27('0x37')],_0x373a29[_0x3c27('0x35')]));_0x5a56f4['where'][_0x3c27('0x5b')]=_0x59e82['id'];if(_0x25a0b2[_0x3c27('0x37')][_0x3c27('0x3f')]){_0x5a56f4[_0x3c27('0x40')]=_['merge'](_0x5a56f4[_0x3c27('0x40')],{'$or':_['map'](_0x5a56f4['attributes'],function(_0x1129cf){var _0x4b0f22={};_0x4b0f22[_0x1129cf]={'$like':'%'+_0x25a0b2[_0x3c27('0x37')][_0x3c27('0x3f')]+'%'};return _0x4b0f22;})});}_0x5a56f4=_[_0x3c27('0x53')]({},_0x5a56f4,_0x25a0b2[_0x3c27('0x48')]);return db[_0x3c27('0x5c')][_0x3c27('0x20')]({'where':_0x5a56f4['where']})[_0x3c27('0x25')](function(_0x3cd10a){_0x1ef887['count']=_0x3cd10a;if(_0x25a0b2[_0x3c27('0x37')]['includeAll']){_0x5a56f4[_0x3c27('0x47')]=[{'all':!![]}];}return db[_0x3c27('0x5c')][_0x3c27('0x43')](_0x5a56f4);})[_0x3c27('0x25')](function(_0x25005f){_0x1ef887[_0x3c27('0x5d')]=_0x25005f;return _0x1ef887;});}})[_0x3c27('0x25')](respondWithFilteredResult(_0x4ac98c,_0x5a56f4))[_0x3c27('0x44')](handleError(_0x4ac98c,null));};exports[_0x3c27('0x5e')]=function(_0xec7612,_0x26f176,_0x5f507e){var _0x263359={'raw':!![],'where':{}};var _0xbcef1b={};var _0x1da3eb={'count':0x0,'rows':[]};return db[_0x3c27('0x42')][_0x3c27('0x59')]({'where':{'id':_0xec7612[_0x3c27('0x46')]['id']}})['then'](handleEntityNotFound(_0x26f176,null))[_0x3c27('0x25')](function(_0x1fe494){if(_0x1fe494){_0xbcef1b[_0x3c27('0x33')]=_['keys'](db[_0x3c27('0x5f')][_0x3c27('0x30')]);_0xbcef1b[_0x3c27('0x37')]=_[_0x3c27('0x34')](_0xec7612[_0x3c27('0x37')]);_0xbcef1b[_0x3c27('0x35')]=_[_0x3c27('0x36')](_0xbcef1b[_0x3c27('0x33')],_0xbcef1b[_0x3c27('0x37')]);_0x263359[_0x3c27('0x39')]=_[_0x3c27('0x36')](_0xbcef1b['model'],qs[_0x3c27('0x38')](_0xec7612[_0x3c27('0x37')][_0x3c27('0x38')]));_0x263359[_0x3c27('0x39')]=_0x263359[_0x3c27('0x39')][_0x3c27('0x3a')]?_0x263359[_0x3c27('0x39')]:_0xbcef1b['model'];if(!_0xec7612[_0x3c27('0x37')][_0x3c27('0x3b')]('nolimit')){_0x263359[_0x3c27('0x1f')]=qs[_0x3c27('0x1f')](_0xec7612[_0x3c27('0x37')][_0x3c27('0x1f')]);_0x263359[_0x3c27('0x1d')]=qs['offset'](_0xec7612[_0x3c27('0x37')][_0x3c27('0x1d')]);}_0x263359[_0x3c27('0x3d')]=qs[_0x3c27('0x3e')](_0xec7612[_0x3c27('0x37')]['sort']);_0x263359[_0x3c27('0x40')]=qs['filters'](_[_0x3c27('0x5a')](_0xec7612[_0x3c27('0x37')],_0xbcef1b[_0x3c27('0x35')]));_0x263359[_0x3c27('0x40')]['CampaignId']=_0x1fe494['id'];if(_0xec7612[_0x3c27('0x37')][_0x3c27('0x3f')]){_0x263359[_0x3c27('0x40')]=_['merge'](_0x263359[_0x3c27('0x40')],{'$or':_[_0x3c27('0x2f')](_0x263359[_0x3c27('0x39')],function(_0x25c368){var _0x1218f7={};_0x1218f7[_0x25c368]={'$like':'%'+_0xec7612[_0x3c27('0x37')]['filter']+'%'};return _0x1218f7;})});}_0x263359=_['merge']({},_0x263359,_0xec7612[_0x3c27('0x48')]);return db[_0x3c27('0x5f')][_0x3c27('0x20')]({'where':_0x263359[_0x3c27('0x40')]})['then'](function(_0x853fbe){_0x1da3eb['count']=_0x853fbe;if(_0xec7612[_0x3c27('0x37')]['includeAll']){_0x263359[_0x3c27('0x47')]=[{'all':!![]}];}return db[_0x3c27('0x5f')][_0x3c27('0x43')](_0x263359);})[_0x3c27('0x25')](function(_0x563aaf){_0x1da3eb['rows']=_0x563aaf;return _0x1da3eb;});}})[_0x3c27('0x25')](respondWithFilteredResult(_0x26f176,_0x263359))[_0x3c27('0x44')](handleError(_0x26f176,null));};exports[_0x3c27('0x60')]=function(_0x1bfa22,_0x1ccb89,_0x204b91){var _0x3b3cf5={'raw':!![],'where':{}};var _0x5263ea={};var _0x4242a2={'count':0x0,'rows':[]};return db[_0x3c27('0x42')]['findOne']({'where':{'id':_0x1bfa22[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x1ccb89,null))[_0x3c27('0x25')](function(_0x49fdfd){if(_0x49fdfd){_0x5263ea[_0x3c27('0x33')]=_['keys'](db[_0x3c27('0x61')]['rawAttributes']);_0x5263ea[_0x3c27('0x37')]=_[_0x3c27('0x34')](_0x1bfa22['query']);_0x5263ea['filters']=_[_0x3c27('0x36')](_0x5263ea[_0x3c27('0x33')],_0x5263ea[_0x3c27('0x37')]);_0x3b3cf5['attributes']=_[_0x3c27('0x36')](_0x5263ea[_0x3c27('0x33')],qs['fields'](_0x1bfa22[_0x3c27('0x37')][_0x3c27('0x38')]));_0x3b3cf5[_0x3c27('0x39')]=_0x3b3cf5[_0x3c27('0x39')][_0x3c27('0x3a')]?_0x3b3cf5[_0x3c27('0x39')]:_0x5263ea['model'];if(!_0x1bfa22[_0x3c27('0x37')][_0x3c27('0x3b')]('nolimit')){_0x3b3cf5[_0x3c27('0x1f')]=qs['limit'](_0x1bfa22['query'][_0x3c27('0x1f')]);_0x3b3cf5['offset']=qs[_0x3c27('0x1d')](_0x1bfa22[_0x3c27('0x37')]['offset']);}_0x3b3cf5[_0x3c27('0x3d')]=qs[_0x3c27('0x3e')](_0x1bfa22[_0x3c27('0x37')][_0x3c27('0x3e')]);_0x3b3cf5['where']=qs[_0x3c27('0x35')](_[_0x3c27('0x5a')](_0x1bfa22[_0x3c27('0x37')],_0x5263ea['filters']));_0x3b3cf5[_0x3c27('0x40')][_0x3c27('0x5b')]=_0x49fdfd['id'];if(_0x1bfa22['query'][_0x3c27('0x3f')]){_0x3b3cf5[_0x3c27('0x40')]=_[_0x3c27('0x53')](_0x3b3cf5[_0x3c27('0x40')],{'$or':_['map'](_0x3b3cf5[_0x3c27('0x39')],function(_0xad0858){var _0x2c104d={};_0x2c104d[_0xad0858]={'$like':'%'+_0x1bfa22[_0x3c27('0x37')][_0x3c27('0x3f')]+'%'};return _0x2c104d;})});}_0x3b3cf5=_['merge']({},_0x3b3cf5,_0x1bfa22[_0x3c27('0x48')]);return db[_0x3c27('0x61')][_0x3c27('0x20')]({'where':_0x3b3cf5[_0x3c27('0x40')]})['then'](function(_0x5d2a99){_0x4242a2[_0x3c27('0x20')]=_0x5d2a99;if(_0x1bfa22['query'][_0x3c27('0x52')]){_0x3b3cf5['include']=[{'all':!![]}];}return db[_0x3c27('0x61')]['findAll'](_0x3b3cf5);})[_0x3c27('0x25')](function(_0x21926e){_0x4242a2['rows']=_0x21926e;return _0x4242a2;});}})[_0x3c27('0x25')](respondWithFilteredResult(_0x1ccb89,_0x3b3cf5))[_0x3c27('0x44')](handleError(_0x1ccb89,null));};exports[_0x3c27('0x62')]=function(_0x778041,_0x5a7399,_0x23204e){var _0x3cc3c1={'raw':!![],'where':{}};var _0x28e937={};var _0x300a0c={'count':0x0,'rows':[]};return db[_0x3c27('0x42')][_0x3c27('0x59')]({'where':{'id':_0x778041[_0x3c27('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a7399,null))[_0x3c27('0x25')](function(_0x43ff2d){if(_0x43ff2d){_0x28e937[_0x3c27('0x33')]=_['keys'](db['CmHopperBlack'][_0x3c27('0x30')]);_0x28e937[_0x3c27('0x37')]=_[_0x3c27('0x34')](_0x778041[_0x3c27('0x37')]);_0x28e937[_0x3c27('0x35')]=_['intersection'](_0x28e937[_0x3c27('0x33')],_0x28e937['query']);_0x3cc3c1[_0x3c27('0x39')]=_[_0x3c27('0x36')](_0x28e937[_0x3c27('0x33')],qs[_0x3c27('0x38')](_0x778041[_0x3c27('0x37')]['fields']));_0x3cc3c1[_0x3c27('0x39')]=_0x3cc3c1['attributes']['length']?_0x3cc3c1['attributes']:_0x28e937['model'];if(!_0x778041[_0x3c27('0x37')][_0x3c27('0x3b')](_0x3c27('0x3c'))){_0x3cc3c1[_0x3c27('0x1f')]=qs[_0x3c27('0x1f')](_0x778041[_0x3c27('0x37')][_0x3c27('0x1f')]);_0x3cc3c1['offset']=qs[_0x3c27('0x1d')](_0x778041['query'][_0x3c27('0x1d')]);}_0x3cc3c1[_0x3c27('0x3d')]=qs[_0x3c27('0x3e')](_0x778041[_0x3c27('0x37')][_0x3c27('0x3e')]);_0x3cc3c1[_0x3c27('0x40')]=qs[_0x3c27('0x35')](_['pick'](_0x778041[_0x3c27('0x37')],_0x28e937[_0x3c27('0x35')]));_0x3cc3c1[_0x3c27('0x40')]['CampaignId']=_0x43ff2d['id'];if(_0x778041[_0x3c27('0x37')][_0x3c27('0x3f')]){_0x3cc3c1[_0x3c27('0x40')]=_[_0x3c27('0x53')](_0x3cc3c1['where'],{'$or':_['map'](_0x3cc3c1[_0x3c27('0x39')],function(_0xc965ca){var _0x594810={};_0x594810[_0xc965ca]={'$like':'%'+_0x778041[_0x3c27('0x37')][_0x3c27('0x3f')]+'%'};return _0x594810;})});}_0x3cc3c1=_[_0x3c27('0x53')]({},_0x3cc3c1,_0x778041[_0x3c27('0x48')]);return db[_0x3c27('0x63')]['count']({'where':_0x3cc3c1[_0x3c27('0x40')]})[_0x3c27('0x25')](function(_0x28195b){_0x300a0c[_0x3c27('0x20')]=_0x28195b;if(_0x778041[_0x3c27('0x37')][_0x3c27('0x52')]){_0x3cc3c1[_0x3c27('0x47')]=[{'all':!![]}];}return db[_0x3c27('0x63')][_0x3c27('0x43')](_0x3cc3c1);})[_0x3c27('0x25')](function(_0x4458af){_0x300a0c[_0x3c27('0x5d')]=_0x4458af;return _0x300a0c;});}})[_0x3c27('0x25')](respondWithFilteredResult(_0x5a7399,_0x3cc3c1))[_0x3c27('0x44')](handleError(_0x5a7399,null));};exports[_0x3c27('0x64')]=function(_0x22fb27,_0x3e30c3,_0x594394){var _0xedf3de={};var _0x111c50={};var _0x80e793;var _0x4bb4ff;return db[_0x3c27('0x42')][_0x3c27('0x59')]({'where':{'id':_0x22fb27[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x3e30c3,null))[_0x3c27('0x25')](function(_0x2b7d6c){if(_0x2b7d6c){_0x80e793=_0x2b7d6c;_0x111c50[_0x3c27('0x33')]=_[_0x3c27('0x34')](db[_0x3c27('0x65')][_0x3c27('0x30')]);_0x111c50[_0x3c27('0x37')]=_[_0x3c27('0x34')](_0x22fb27[_0x3c27('0x37')]);_0x111c50[_0x3c27('0x35')]=_[_0x3c27('0x36')](_0x111c50[_0x3c27('0x33')],_0x111c50[_0x3c27('0x37')]);_0xedf3de[_0x3c27('0x39')]=_[_0x3c27('0x36')](_0x111c50[_0x3c27('0x33')],qs[_0x3c27('0x38')](_0x22fb27[_0x3c27('0x37')][_0x3c27('0x38')]));_0xedf3de[_0x3c27('0x39')]=_0xedf3de[_0x3c27('0x39')]['length']?_0xedf3de[_0x3c27('0x39')]:_0x111c50['model'];_0xedf3de[_0x3c27('0x3d')]=qs['sort'](_0x22fb27['query'][_0x3c27('0x3e')]);_0xedf3de['where']=qs['filters'](_[_0x3c27('0x5a')](_0x22fb27['query'],_0x111c50['filters']));if(_0x22fb27[_0x3c27('0x37')][_0x3c27('0x3f')]){_0xedf3de['where']=_[_0x3c27('0x53')](_0xedf3de[_0x3c27('0x40')],{'$or':_[_0x3c27('0x2f')](_0xedf3de[_0x3c27('0x39')],function(_0x5f02f5){var _0x39cb37={};_0x39cb37[_0x5f02f5]={'$like':'%'+_0x22fb27['query'][_0x3c27('0x3f')]+'%'};return _0x39cb37;})});}_0xedf3de=_['merge']({},_0xedf3de,_0x22fb27['options']);return _0x80e793[_0x3c27('0x64')](_0xedf3de);}})[_0x3c27('0x25')](function(_0x538b22){if(_0x538b22){_0x4bb4ff=_0x538b22[_0x3c27('0x3a')];if(!_0x22fb27[_0x3c27('0x37')]['hasOwnProperty']('nolimit')){_0xedf3de['limit']=qs[_0x3c27('0x1f')](_0x22fb27['query'][_0x3c27('0x1f')]);_0xedf3de['offset']=qs[_0x3c27('0x1d')](_0x22fb27['query'][_0x3c27('0x1d')]);}return _0x80e793['getLists'](_0xedf3de);}})['then'](function(_0x28e5d8){if(_0x28e5d8){return _0x28e5d8?{'count':_0x4bb4ff,'rows':_0x28e5d8}:null;}})[_0x3c27('0x25')](respondWithResult(_0x3e30c3,null))['catch'](handleError(_0x3e30c3,null));};exports['addLists']=function(_0x1d7411,_0x9dd402,_0xc264cd){var _0x18dd27,_0x49fbb5;var _0x5668b3=[];var _0x262e57=moment()[_0x3c27('0x66')](_0x3c27('0x67'));return db['Campaign']['find']({'where':{'id':_0x1d7411[_0x3c27('0x46')]['id']}})['then'](handleEntityNotFound(_0x9dd402,null))[_0x3c27('0x25')](function(_0x5def26){if(_0x5def26){_0x49fbb5=_0x5def26;return _0x5def26['addLists'](_0x1d7411[_0x3c27('0x4b')]['ids'],_[_0x3c27('0x68')](_0x1d7411[_0x3c27('0x4b')],[_0x3c27('0x69'),'id'])||{});}return null;})[_0x3c27('0x6a')](function(_0x1030f1){var _0x2f85a5;var _0x4fe866;_0x18dd27=_0x1030f1||[];var _0x408dbe=[];if(_0x1030f1){for(var _0xc391d9=0x0;_0xc391d9<_0x1030f1['length'];_0xc391d9+=0x1){var _0x1b5bc2=_0x1030f1[_0xc391d9][_0x3c27('0x27')]({'plain':!![]});_0x49fbb5['dialCheckDuplicateType']=_0x1d7411[_0x3c27('0x4b')]['dialCheckDuplicateType']?_0x1d7411[_0x3c27('0x4b')][_0x3c27('0x6b')]:_0x49fbb5[_0x3c27('0x6b')];switch(_0x49fbb5[_0x3c27('0x6b')]){case _0x3c27('0x6c'):_0x2f85a5=squel['insert']()[_0x3c27('0x6d')](_0x3c27('0x6e'))[_0x3c27('0x6f')]([_0x3c27('0x70'),_0x3c27('0x71'),'ContactId','ListId',_0x3c27('0x5b'),_0x3c27('0x55'),'updatedAt'],squel['select']()['field'](_0x3c27('0x70'),_0x3c27('0x70'))[_0x3c27('0x72')](_0x3c27('0x73'),_0x3c27('0x71'))['field']('id',_0x3c27('0x74'))[_0x3c27('0x72')](_0x1b5bc2[_0x3c27('0x75')][_0x3c27('0x76')](),_0x3c27('0x77'))['field'](_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')](),'CampaignId')[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27',_0x3c27('0x55'))[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27','updatedAt')[_0x3c27('0x78')](_0x3c27('0x79'))['where']('deletedAt\x20IS\x20NULL')[_0x3c27('0x40')]('ListId\x20=\x20?',_0x1b5bc2[_0x3c27('0x75')][_0x3c27('0x76')]())[_0x3c27('0x40')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x3c27('0x7a'),squel[_0x3c27('0x7b')]()[_0x3c27('0x72')](_0x3c27('0x7c'))[_0x3c27('0x78')](_0x3c27('0x7d'))[_0x3c27('0x40')](_0x3c27('0x7e'),_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')]()))['where'](_0x3c27('0x7a'),squel[_0x3c27('0x7b')]()[_0x3c27('0x72')](_0x3c27('0x7f'))[_0x3c27('0x78')]('cm_hopper')[_0x3c27('0x40')](_0x3c27('0x7e'),_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')]())))[_0x3c27('0x76')]();break;case _0x3c27('0x80'):_0x2f85a5=squel[_0x3c27('0x81')]()['into']('cm_hopper')[_0x3c27('0x6f')](['phone',_0x3c27('0x71'),_0x3c27('0x74'),'ListId',_0x3c27('0x5b'),_0x3c27('0x55'),'updatedAt'],squel['select']()[_0x3c27('0x72')](_0x3c27('0x70'),'phone')[_0x3c27('0x72')](_0x3c27('0x73'),_0x3c27('0x71'))[_0x3c27('0x72')]('id',_0x3c27('0x74'))[_0x3c27('0x72')](_0x1b5bc2[_0x3c27('0x75')][_0x3c27('0x76')](),_0x3c27('0x77'))[_0x3c27('0x72')](_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')](),_0x3c27('0x5b'))[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27',_0x3c27('0x55'))['field']('\x27'+_0x262e57+'\x27',_0x3c27('0x54'))[_0x3c27('0x78')]('cm_contacts')[_0x3c27('0x40')]('deletedAt\x20IS\x20NULL')[_0x3c27('0x40')](_0x3c27('0x82'),_0x1b5bc2[_0x3c27('0x75')][_0x3c27('0x76')]())['where'](_0x3c27('0x83'))['where'](_0x3c27('0x7a'),squel[_0x3c27('0x7b')]()['field']('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x3c27('0x40')](_0x3c27('0x7e'),_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')]())))[_0x3c27('0x76')]();break;default:_0x2f85a5=squel[_0x3c27('0x81')]()[_0x3c27('0x6d')]('cm_hopper')[_0x3c27('0x6f')](['phone','scheduledAt',_0x3c27('0x74'),_0x3c27('0x77'),'CampaignId',_0x3c27('0x55'),_0x3c27('0x54')],squel[_0x3c27('0x7b')]()[_0x3c27('0x72')]('phone',_0x3c27('0x70'))[_0x3c27('0x72')](_0x3c27('0x73'),'scheduledAt')[_0x3c27('0x72')]('id',_0x3c27('0x74'))[_0x3c27('0x72')](_0x1b5bc2[_0x3c27('0x75')]['toString'](),_0x3c27('0x77'))[_0x3c27('0x72')](_0x1d7411['params']['id'][_0x3c27('0x76')](),_0x3c27('0x5b'))[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27',_0x3c27('0x55'))['field']('\x27'+_0x262e57+'\x27',_0x3c27('0x54'))[_0x3c27('0x78')](_0x3c27('0x79'))['where'](_0x3c27('0x84'))[_0x3c27('0x40')](_0x3c27('0x82'),_0x1b5bc2[_0x3c27('0x75')][_0x3c27('0x76')]())['where'](_0x3c27('0x83')))[_0x3c27('0x76')]();}_0x4fe866=squel[_0x3c27('0x81')]()[_0x3c27('0x6d')](_0x3c27('0x85'))[_0x3c27('0x6f')]([_0x3c27('0x86'),_0x3c27('0x71'),'phone',_0x3c27('0x87'),_0x3c27('0x55'),_0x3c27('0x54')],squel[_0x3c27('0x7b')]()[_0x3c27('0x72')](_0x3c27('0x88'),'id')[_0x3c27('0x72')](_0x3c27('0x73'),_0x3c27('0x71'))[_0x3c27('0x72')]('ci.item',_0x3c27('0x70'))[_0x3c27('0x72')](_0x3c27('0x89'),'OrderBy')[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27',_0x3c27('0x55'))[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27',_0x3c27('0x54'))['from'](_0x3c27('0x8a'),'ci')[_0x3c27('0x8b')](_0x3c27('0x6e'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x3c27('0x40')](_0x3c27('0x8c'),_0x1b5bc2['CmListId'][_0x3c27('0x76')]())['where'](_0x3c27('0x8d'),_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')]())[_0x3c27('0x40')](_0x3c27('0x8e'),_0x262e57))['toString']();_0x408dbe[_0x3c27('0x8f')](db['sequelize']['query'](_0x2f85a5));_0x5668b3[_0x3c27('0x8f')](db[_0x3c27('0x90')][_0x3c27('0x37')](_0x4fe866));}return BPromise['all'](_0x408dbe);}})[_0x3c27('0x25')](function(){return BPromise[_0x3c27('0x91')](_0x5668b3);})[_0x3c27('0x25')](function(){return _0x18dd27;})['then'](respondWithResult(_0x9dd402,null))[_0x3c27('0x44')](handleError(_0x9dd402,null));};exports[_0x3c27('0x92')]=function(_0x2f906f,_0x3135a3,_0x4f9ad7){return db[_0x3c27('0x42')][_0x3c27('0x49')]({'where':{'id':_0x2f906f[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x3135a3,null))[_0x3c27('0x25')](function(_0x5b1810){if(_0x5b1810){return _0x5b1810[_0x3c27('0x92')](_0x2f906f[_0x3c27('0x37')]['ids']);}})[_0x3c27('0x25')](function(_0xbb151f){if(_0xbb151f){return db[_0x3c27('0x5c')][_0x3c27('0x26')]({'where':{'ListId':_0x2f906f[_0x3c27('0x37')]['ids'],'CampaignId':_0x2f906f['params']['id']}})[_0x3c27('0x25')](function(){return _0xbb151f;});}})['then'](respondWithStatusCode(_0x3135a3,null))[_0x3c27('0x44')](handleError(_0x3135a3,null));};exports[_0x3c27('0x93')]=function(_0x3e76f4,_0x20e399,_0x2f1e7e){var _0x5434b5={};var _0x128fba={};var _0x2aa1f0;var _0x56b004;return db[_0x3c27('0x42')]['findOne']({'where':{'id':_0x3e76f4[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x20e399,null))[_0x3c27('0x25')](function(_0x4f9fbe){if(_0x4f9fbe){_0x2aa1f0=_0x4f9fbe;_0x128fba['model']=_['keys'](db[_0x3c27('0x65')]['rawAttributes']);_0x128fba[_0x3c27('0x37')]=_[_0x3c27('0x34')](_0x3e76f4[_0x3c27('0x37')]);_0x128fba[_0x3c27('0x35')]=_[_0x3c27('0x36')](_0x128fba[_0x3c27('0x33')],_0x128fba['query']);_0x5434b5['attributes']=_[_0x3c27('0x36')](_0x128fba['model'],qs['fields'](_0x3e76f4['query']['fields']));_0x5434b5['attributes']=_0x5434b5['attributes'][_0x3c27('0x3a')]?_0x5434b5[_0x3c27('0x39')]:_0x128fba[_0x3c27('0x33')];_0x5434b5[_0x3c27('0x3d')]=qs['sort'](_0x3e76f4[_0x3c27('0x37')][_0x3c27('0x3e')]);_0x5434b5[_0x3c27('0x40')]=qs[_0x3c27('0x35')](_['pick'](_0x3e76f4[_0x3c27('0x37')],_0x128fba[_0x3c27('0x35')]));if(_0x3e76f4[_0x3c27('0x37')]['filter']){_0x5434b5[_0x3c27('0x40')]=_[_0x3c27('0x53')](_0x5434b5[_0x3c27('0x40')],{'$or':_[_0x3c27('0x2f')](_0x5434b5['attributes'],function(_0x40d49d){var _0x1f7109={};_0x1f7109[_0x40d49d]={'$like':'%'+_0x3e76f4[_0x3c27('0x37')][_0x3c27('0x3f')]+'%'};return _0x1f7109;})});}_0x5434b5=_[_0x3c27('0x53')]({},_0x5434b5,_0x3e76f4['options']);return _0x2aa1f0[_0x3c27('0x93')](_0x5434b5);}})[_0x3c27('0x25')](function(_0x3fedf3){if(_0x3fedf3){_0x56b004=_0x3fedf3[_0x3c27('0x3a')];if(!_0x3e76f4[_0x3c27('0x37')][_0x3c27('0x3b')](_0x3c27('0x3c'))){_0x5434b5[_0x3c27('0x1f')]=qs['limit'](_0x3e76f4[_0x3c27('0x37')][_0x3c27('0x1f')]);_0x5434b5[_0x3c27('0x1d')]=qs[_0x3c27('0x1d')](_0x3e76f4[_0x3c27('0x37')][_0x3c27('0x1d')]);}return _0x2aa1f0[_0x3c27('0x93')](_0x5434b5);}})['then'](function(_0xef9453){if(_0xef9453){return _0xef9453?{'count':_0x56b004,'rows':_0xef9453}:null;}})[_0x3c27('0x25')](respondWithResult(_0x20e399,null))[_0x3c27('0x44')](handleError(_0x20e399,null));};exports[_0x3c27('0x94')]=function(_0x4509ff,_0x1b543b,_0x3a0768){var _0x3cd9eb,_0x2c3297;var _0x3cae61=[];var _0x4b308e=moment()[_0x3c27('0x66')](_0x3c27('0x67'));return db[_0x3c27('0x42')][_0x3c27('0x49')]({'where':{'id':_0x4509ff[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x1b543b,null))['then'](function(_0x3d6017){if(_0x3d6017){_0x2c3297=_0x3d6017;return _0x3d6017[_0x3c27('0x94')](_0x4509ff[_0x3c27('0x4b')][_0x3c27('0x69')],_['omit'](_0x4509ff[_0x3c27('0x4b')],['ids','id'])||{});}return null;})['spread'](function(_0x1e22fe){var _0x57c540;var _0x59664f;_0x3cd9eb=_0x1e22fe||[];var _0x3d8f68=[];if(_0x1e22fe){for(var _0x2b115f=0x0;_0x2b115f<_0x1e22fe[_0x3c27('0x3a')];_0x2b115f+=0x1){var _0x18ec9f=_0x1e22fe[_0x2b115f]['get']({'plain':!![]});_0x57c540=squel[_0x3c27('0x81')]()[_0x3c27('0x6d')](_0x3c27('0x95'))['fromQuery']([_0x3c27('0x70'),_0x3c27('0x74'),_0x3c27('0x77'),_0x3c27('0x5b'),_0x3c27('0x55'),_0x3c27('0x54')],squel[_0x3c27('0x7b')]()[_0x3c27('0x72')]('phone',_0x3c27('0x70'))['field']('id',_0x3c27('0x74'))[_0x3c27('0x72')](_0x18ec9f['CmListId'][_0x3c27('0x76')](),'ListId')[_0x3c27('0x72')](_0x4509ff['params']['id'][_0x3c27('0x76')](),_0x3c27('0x5b'))[_0x3c27('0x72')]('NOW()',_0x3c27('0x55'))[_0x3c27('0x72')]('NOW()','updatedAt')[_0x3c27('0x78')]('cm_contacts')[_0x3c27('0x40')]('deletedAt\x20IS\x20NULL')[_0x3c27('0x40')](_0x3c27('0x82'),_0x18ec9f[_0x3c27('0x75')][_0x3c27('0x76')]())[_0x3c27('0x40')](_0x3c27('0x83')))[_0x3c27('0x76')]();_0x3d8f68[_0x3c27('0x8f')](db[_0x3c27('0x90')][_0x3c27('0x37')](_0x57c540));}return BPromise[_0x3c27('0x91')](_0x3d8f68);}})[_0x3c27('0x25')](function(){return _0x3cd9eb;})[_0x3c27('0x25')](respondWithResult(_0x1b543b,null))[_0x3c27('0x44')](handleError(_0x1b543b,null));};exports['removeBlackLists']=function(_0x2c1d3e,_0x179912,_0x2ac57f){return db['Campaign'][_0x3c27('0x49')]({'where':{'id':_0x2c1d3e[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x179912,null))['then'](function(_0x3f05c4){if(_0x3f05c4){return _0x3f05c4[_0x3c27('0x96')](_0x2c1d3e[_0x3c27('0x37')][_0x3c27('0x69')]);}})[_0x3c27('0x25')](function(_0x3fdc13){if(_0x3fdc13){return db[_0x3c27('0x63')][_0x3c27('0x26')]({'where':{'ListId':_0x2c1d3e[_0x3c27('0x37')]['ids'],'CampaignId':_0x2c1d3e[_0x3c27('0x46')]['id']}})['then'](function(){return _0x3fdc13;});}})[_0x3c27('0x25')](respondWithStatusCode(_0x179912,null))[_0x3c27('0x44')](handleError(_0x179912,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 09b0533..0dad61f 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(_0x23bf67,_0x564d3d){var _0x8f2df5=function(_0x5e31b1){while(--_0x5e31b1){_0x23bf67['push'](_0x23bf67['shift']());}};_0x8f2df5(++_0x564d3d);}(_0x7a54,0x106));var _0x47a5=function(_0x511858,_0x539650){_0x511858=_0x511858-0x0;var _0x1c34a5=_0x7a54[_0x511858];return _0x1c34a5;};'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(_0x2aeb58,_0x575b09){var _0x1f5acc=function(_0x31c0e1){while(--_0x31c0e1){_0x2aeb58['push'](_0x2aeb58['shift']());}};_0x1f5acc(++_0x575b09);}(_0x7a54,0x106));var _0x47a5=function(_0x4205ee,_0x515e2a){_0x4205ee=_0x4205ee-0x0;var _0xd9101d=_0x7a54[_0x4205ee];return _0xd9101d;};'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 72a88c2..2479b47 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 _0xcea2=['rpc','../../config/environment','client','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Campaign','findAll','options','where','attributes','limit','map','include','model','then','GetCampaign','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3bee07,_0x416454){var _0x104f1d=function(_0x32c555){while(--_0x32c555){_0x3bee07['push'](_0x3bee07['shift']());}};_0x104f1d(++_0x416454);}(_0xcea2,0x15a));var _0x2cea=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xcea2[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var moment=require(_0x2cea('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cea('0x2'));var fs=require('fs');var Redis=require(_0x2cea('0x3'));var db=require(_0x2cea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cea('0x5'))(_0x2cea('0x6'));var config=require(_0x2cea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d69ff,_0xc04963,_0x805a1b){return new BPromise(function(_0x160cca,_0x11c5c0){return client[_0x2cea('0x9')](_0x2d69ff,_0x805a1b)['then'](function(_0x1f4d90){logger[_0x2cea('0xa')](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));logger[_0x2cea('0xd')](_0x2cea('0xe'),_0xc04963,_0x2cea('0xc'),JSON[_0x2cea('0xf')](_0x1f4d90));if(_0x1f4d90['error']){if(_0x1f4d90['error'][_0x2cea('0x10')]===0x1f4){logger[_0x2cea('0x11')]('Campaign,\x20%s,\x20%s',_0xc04963,_0x1f4d90['error'][_0x2cea('0x12')]);return _0x11c5c0(_0x1f4d90['error'][_0x2cea('0x12')]);}logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1f4d90['error']['message']);return _0x160cca(_0x1f4d90['error'][_0x2cea('0x12')]);}else{logger['info'](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));_0x160cca(_0x1f4d90[_0x2cea('0x13')][_0x2cea('0x12')]);}})[_0x2cea('0x14')](function(_0x1bbfdb){logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1bbfdb);_0x11c5c0(_0x1bbfdb);});});}exports['GetCampaign']=function(_0x19927a){var _0x464f7d=this;return new Promise(function(_0x20c46c,_0x43ae15){return db[_0x2cea('0x15')][_0x2cea('0x16')]({'raw':_0x19927a['options']?_0x19927a[_0x2cea('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x19927a[_0x2cea('0x17')]?_0x19927a[_0x2cea('0x17')][_0x2cea('0x18')]||null:null,'attributes':_0x19927a['options']?_0x19927a[_0x2cea('0x17')][_0x2cea('0x19')]||null:null,'limit':_0x19927a[_0x2cea('0x17')]?_0x19927a[_0x2cea('0x17')][_0x2cea('0x1a')]||null:null,'include':_0x19927a[_0x2cea('0x17')]?_0x19927a[_0x2cea('0x17')]['include']?_[_0x2cea('0x1b')](_0x19927a['options'][_0x2cea('0x1c')],function(_0x4926ff){return{'model':db[_0x4926ff[_0x2cea('0x1d')]],'as':_0x4926ff['as'],'attributes':_0x4926ff[_0x2cea('0x19')],'include':_0x4926ff['include']?_[_0x2cea('0x1b')](_0x4926ff[_0x2cea('0x1c')],function(_0x101314){return{'model':db[_0x101314[_0x2cea('0x1d')]],'as':_0x101314['as'],'attributes':_0x101314[_0x2cea('0x19')],'include':_0x101314[_0x2cea('0x1c')]?_['map'](_0x101314[_0x2cea('0x1c')],function(_0x32b6a3){return{'model':db[_0x32b6a3[_0x2cea('0x1d')]],'as':_0x32b6a3['as'],'attributes':_0x32b6a3[_0x2cea('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2cea('0x1e')](function(_0x3ea40c){logger[_0x2cea('0xa')](_0x2cea('0x1f'),_0x19927a);logger['debug'](_0x2cea('0x1f'),_0x19927a,JSON[_0x2cea('0xf')](_0x3ea40c));_0x20c46c(_0x3ea40c);})['catch'](function(_0xfeb8bd){logger[_0x2cea('0x11')](_0x2cea('0x1f'),_0xfeb8bd[_0x2cea('0x12')],_0x19927a);_0x43ae15(_0x464f7d['error'](0x1f4,_0xfeb8bd[_0x2cea('0x12')]));});});}; \ No newline at end of file +var _0x80df=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment'];(function(_0x2dd86b,_0x18a5c0){var _0x250064=function(_0x2d19cd){while(--_0x2d19cd){_0x2dd86b['push'](_0x2dd86b['shift']());}};_0x250064(++_0x18a5c0);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62e50f,_0x5068d4,_0x30e2b3){return new BPromise(function(_0x16b219,_0x2f56b3){return client[_0xf80d('0xd')](_0x62e50f,_0x30e2b3)[_0xf80d('0xe')](function(_0x186339){logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));logger[_0xf80d('0x12')](_0xf80d('0x13'),_0x5068d4,_0xf80d('0x11'),JSON[_0xf80d('0x14')](_0x186339));if(_0x186339[_0xf80d('0x15')]){if(_0x186339['error']['code']===0x1f4){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x2f56b3(_0x186339['error'][_0xf80d('0x16')]);}logger['error'](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x16b219(_0x186339[_0xf80d('0x15')][_0xf80d('0x16')]);}else{logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));_0x16b219(_0x186339[_0xf80d('0x17')][_0xf80d('0x16')]);}})[_0xf80d('0x18')](function(_0x3b8a82){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x3b8a82);_0x2f56b3(_0x3b8a82);});});}exports[_0xf80d('0x19')]=function(_0x1d104a){var _0x34b49d=this;return new Promise(function(_0x2ea2c1,_0x7ba89c){return db[_0xf80d('0x1a')][_0xf80d('0x1b')]({'raw':_0x1d104a['options']?_0x1d104a[_0xf80d('0x1c')][_0xf80d('0x1d')]===undefined?!![]:![]:!![],'where':_0x1d104a['options']?_0x1d104a[_0xf80d('0x1c')]['where']||null:null,'attributes':_0x1d104a[_0xf80d('0x1c')]?_0x1d104a[_0xf80d('0x1c')][_0xf80d('0x1e')]||null:null,'limit':_0x1d104a[_0xf80d('0x1c')]?_0x1d104a[_0xf80d('0x1c')][_0xf80d('0x1f')]||null:null,'include':_0x1d104a[_0xf80d('0x1c')]?_0x1d104a[_0xf80d('0x1c')][_0xf80d('0x20')]?_[_0xf80d('0x21')](_0x1d104a[_0xf80d('0x1c')][_0xf80d('0x20')],function(_0x570c99){return{'model':db[_0x570c99[_0xf80d('0x22')]],'as':_0x570c99['as'],'attributes':_0x570c99[_0xf80d('0x1e')],'include':_0x570c99['include']?_[_0xf80d('0x21')](_0x570c99[_0xf80d('0x20')],function(_0x323540){return{'model':db[_0x323540[_0xf80d('0x22')]],'as':_0x323540['as'],'attributes':_0x323540['attributes'],'include':_0x323540[_0xf80d('0x20')]?_[_0xf80d('0x21')](_0x323540[_0xf80d('0x20')],function(_0x2a4597){return{'model':db[_0x2a4597[_0xf80d('0x22')]],'as':_0x2a4597['as'],'attributes':_0x2a4597[_0xf80d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf80d('0xe')](function(_0x68f2c6){logger[_0xf80d('0xf')]('GetCampaign',_0x1d104a);logger[_0xf80d('0x12')](_0xf80d('0x19'),_0x1d104a,JSON[_0xf80d('0x14')](_0x68f2c6));_0x2ea2c1(_0x68f2c6);})[_0xf80d('0x18')](function(_0x3ce924){logger[_0xf80d('0x15')](_0xf80d('0x19'),_0x3ce924['message'],_0x1d104a);_0x7ba89c(_0x34b49d[_0xf80d('0x15')](0x1f4,_0x3ce924[_0xf80d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 9022731..10f52b4 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 _0xc1e8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','/:id/lists','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','multer','util','path','connect-timeout','express'];(function(_0x1c8e66,_0x1c4814){var _0x58d61d=function(_0x268e97){while(--_0x268e97){_0x1c8e66['push'](_0x1c8e66['shift']());}};_0x58d61d(++_0x1c4814);}(_0xc1e8,0x87));var _0x8c1e=function(_0x79ebc5,_0x2df5d1){_0x79ebc5=_0x79ebc5-0x0;var _0x3813b6=_0xc1e8[_0x79ebc5];return _0x3813b6;};'use strict';var multer=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var path=require(_0x8c1e('0x2'));var timeout=require(_0x8c1e('0x3'));var express=require(_0x8c1e('0x4'));var router=express[_0x8c1e('0x5')]();var fs_extra=require(_0x8c1e('0x6'));var auth=require(_0x8c1e('0x7'));var interaction=require(_0x8c1e('0x8'));var config=require(_0x8c1e('0x9'));var controller=require(_0x8c1e('0xa'));router[_0x8c1e('0xb')]('/',auth['isAuthenticated'](),controller[_0x8c1e('0xc')]);router[_0x8c1e('0xb')](_0x8c1e('0xd'),auth['isAuthenticated'](),controller[_0x8c1e('0xe')]);router[_0x8c1e('0xb')](_0x8c1e('0xf'),auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x11')]);router['get'](_0x8c1e('0x12'),auth[_0x8c1e('0x10')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth[_0x8c1e('0x10')](),controller['getHopperFinals']);router[_0x8c1e('0xb')](_0x8c1e('0x13'),auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x14')]);router[_0x8c1e('0xb')]('/:id/lists',auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x15')]);router[_0x8c1e('0xb')](_0x8c1e('0x16'),auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x17')]);router[_0x8c1e('0x18')]('/',auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x19')]);router[_0x8c1e('0x18')](_0x8c1e('0x1a'),auth[_0x8c1e('0x10')](),controller['clone']);router[_0x8c1e('0x18')](_0x8c1e('0x1b'),auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x1c')]);router['post']('/:id/blacklists',auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x1d')]);router[_0x8c1e('0x1e')]('/:id',auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x1f')]);router[_0x8c1e('0x20')](_0x8c1e('0xd'),auth[_0x8c1e('0x10')](),controller['destroy']);router[_0x8c1e('0x20')](_0x8c1e('0x1b'),auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x21')]);router[_0x8c1e('0x20')](_0x8c1e('0x16'),auth['isAuthenticated'](),controller[_0x8c1e('0x22')]);module['exports']=router; \ No newline at end of file +var _0x4c3c=['destroy','removeBlackLists','exports','multer','util','connect-timeout','fs-extra','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete'];(function(_0x12cda1,_0x32d850){var _0x212433=function(_0x4a2e7c){while(--_0x4a2e7c){_0x12cda1['push'](_0x12cda1['shift']());}};_0x212433(++_0x32d850);}(_0x4c3c,0x1e3));var _0xc4c3=function(_0x1507b8,_0x43e312){_0x1507b8=_0x1507b8-0x0;var _0x1f6792=_0x4c3c[_0x1507b8];return _0x1f6792;};'use strict';var multer=require(_0xc4c3('0x0'));var util=require(_0xc4c3('0x1'));var path=require('path');var timeout=require(_0xc4c3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc4c3('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc4c3('0x4'));var controller=require(_0xc4c3('0x5'));router[_0xc4c3('0x6')]('/',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x8')]);router[_0xc4c3('0x6')](_0xc4c3('0x9'),auth['isAuthenticated'](),controller[_0xc4c3('0xa')]);router[_0xc4c3('0x6')]('/:id/hoppers',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0xb')]);router[_0xc4c3('0x6')](_0xc4c3('0xc'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0xd')]);router[_0xc4c3('0x6')](_0xc4c3('0xe'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0xf')]);router['get'](_0xc4c3('0x10'),auth['isAuthenticated'](),controller[_0xc4c3('0x11')]);router['get'](_0xc4c3('0x12'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x13')]);router['get'](_0xc4c3('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xc4c3('0x15')]('/',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x16')]);router[_0xc4c3('0x15')](_0xc4c3('0x17'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x18')]);router[_0xc4c3('0x15')]('/:id/lists',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x19')]);router['post'](_0xc4c3('0x14'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x1a')]);router['put']('/:id',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x1b')]);router[_0xc4c3('0x1c')](_0xc4c3('0x9'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x1d')]);router[_0xc4c3('0x1c')]('/:id/lists',auth['isAuthenticated'](),controller['removeLists']);router[_0xc4c3('0x1c')]('/:id/blacklists',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x1e')]);module[_0xc4c3('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ba8ffa4..8e43748 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 _0x3886=['TEXT','STRING','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x4b05e0,_0x311076){var _0x1fbea2=function(_0x573fda){while(--_0x573fda){_0x4b05e0['push'](_0x4b05e0['shift']());}};_0x1fbea2(++_0x311076);}(_0x3886,0x1a9));var _0x6388=function(_0x10fefb,_0xaef80b){_0x10fefb=_0x10fefb-0x0;var _0x41c4ba=_0x3886[_0x10fefb];return _0x41c4ba;};'use strict';var Sequelize=require(_0x6388('0x0'));module[_0x6388('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x6388('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6388('0x3')]},'name':{'type':Sequelize[_0x6388('0x4')],'get':function(){return this[_0x6388('0x5')](_0x6388('0x6'));}}}; \ No newline at end of file +var _0x84f3=['sequelize','STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x3d29af,_0x3bfbaf){var _0x16812b=function(_0xa0a055){while(--_0xa0a055){_0x3d29af['push'](_0x3d29af['shift']());}};_0x16812b(++_0x3bfbaf);}(_0x84f3,0x114));var _0x384f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x84f3[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x384f('0x0'));module['exports']={'key':{'type':Sequelize[_0x384f('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x384f('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x384f('0x3')],'get':function(){return this[_0x384f('0x4')](_0x384f('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index f2693d5..d93738f 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 _0x9610=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CannedAnswer','includeAll','findAll','rows','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x9b0d12,_0x17e7b6){var _0x55abdb=function(_0x33d49b){while(--_0x33d49b){_0x9b0d12['push'](_0x9b0d12['shift']());}};_0x55abdb(++_0x17e7b6);}(_0x9610,0x164));var _0x0961=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9610[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0961('0x0'));var zipdir=require(_0x0961('0x1'));var jsonpatch=require(_0x0961('0x2'));var rp=require(_0x0961('0x3'));var moment=require(_0x0961('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0961('0x5'));var util=require(_0x0961('0x6'));var path=require(_0x0961('0x7'));var sox=require(_0x0961('0x8'));var csv=require(_0x0961('0x9'));var ejs=require(_0x0961('0xa'));var fs=require('fs');var fs_extra=require(_0x0961('0xb'));var _=require(_0x0961('0xc'));var squel=require(_0x0961('0xd'));var crypto=require(_0x0961('0xe'));var jsforce=require(_0x0961('0xf'));var deskjs=require(_0x0961('0x10'));var toCsv=require(_0x0961('0x9'));var querystring=require(_0x0961('0x11'));var Papa=require(_0x0961('0x12'));var Redis=require(_0x0961('0x13'));var authService=require(_0x0961('0x14'));var qs=require(_0x0961('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0961('0x16'));var logger=require(_0x0961('0x17'))(_0x0961('0x18'));var utils=require('../../config/utils');var config=require(_0x0961('0x19'));var licenseUtil=require(_0x0961('0x1a'));var db=require(_0x0961('0x1b'))['db'];function respondWithStatusCode(_0x4e674f,_0x1eb4eb){_0x1eb4eb=_0x1eb4eb||0xcc;return function(_0x23abf9){if(_0x23abf9){return _0x4e674f[_0x0961('0x1c')](_0x1eb4eb);}return _0x4e674f[_0x0961('0x1d')](_0x1eb4eb)[_0x0961('0x1e')]();};}function respondWithResult(_0x10bfbf,_0x512557){_0x512557=_0x512557||0xc8;return function(_0x326dfc){if(_0x326dfc){return _0x10bfbf[_0x0961('0x1d')](_0x512557)[_0x0961('0x1f')](_0x326dfc);}};}function respondWithFilteredResult(_0x4f58d2,_0x174ba9){return function(_0x4e2445){if(_0x4e2445){var _0x2cd2c3=typeof _0x174ba9[_0x0961('0x20')]===_0x0961('0x21')&&typeof _0x174ba9[_0x0961('0x22')]==='undefined';var _0x132ce0=_0x4e2445[_0x0961('0x23')];var _0x37441a=_0x2cd2c3?0x0:_0x174ba9[_0x0961('0x20')];var _0x103acd=_0x2cd2c3?_0x4e2445[_0x0961('0x23')]:_0x174ba9[_0x0961('0x20')]+_0x174ba9['limit'];var _0x5088a9;if(_0x103acd>=_0x132ce0){_0x103acd=_0x132ce0;_0x5088a9=0xc8;}else{_0x5088a9=0xce;}_0x4f58d2[_0x0961('0x1d')](_0x5088a9);return _0x4f58d2['set'](_0x0961('0x24'),_0x37441a+'-'+_0x103acd+'/'+_0x132ce0)['json'](_0x4e2445);}return null;};}function patchUpdates(_0x37578a){return function(_0x667407){try{jsonpatch[_0x0961('0x25')](_0x667407,_0x37578a,!![]);}catch(_0x5b762f){return BPromise[_0x0961('0x26')](_0x5b762f);}return _0x667407[_0x0961('0x27')]();};}function saveUpdates(_0x1accc1,_0x1d785b){return function(_0x33aa2e){if(_0x33aa2e){return _0x33aa2e[_0x0961('0x28')](_0x1accc1)[_0x0961('0x29')](function(_0x54b21a){return _0x54b21a;});}return null;};}function removeEntity(_0x5c0025,_0x3a102c){return function(_0xa67935){if(_0xa67935){return _0xa67935[_0x0961('0x2a')]()[_0x0961('0x29')](function(){var _0x3ef293=_0xa67935[_0x0961('0x2b')]({'plain':!![]});var _0x1973f8='CannedAnswers';return db[_0x0961('0x2c')][_0x0961('0x2a')]({'where':{'type':_0x1973f8,'resourceId':_0x3ef293['id']}})[_0x0961('0x29')](function(){return _0xa67935;});})[_0x0961('0x29')](function(){_0x5c0025[_0x0961('0x1d')](0xcc)[_0x0961('0x1e')]();});}};}function handleEntityNotFound(_0x45f25e,_0x580922){return function(_0x4c620f){if(!_0x4c620f){_0x45f25e[_0x0961('0x1c')](0x194);}return _0x4c620f;};}function handleError(_0x7f7275,_0x481d7b){_0x481d7b=_0x481d7b||0x1f4;return function(_0x416f2e){logger[_0x0961('0x2d')](_0x416f2e['stack']);if(_0x416f2e['name']){delete _0x416f2e[_0x0961('0x2e')];}_0x7f7275['status'](_0x481d7b)['send'](_0x416f2e);};}exports[_0x0961('0x2f')]=function(_0x4d0c3d,_0x10c85d){var _0x4fd142={},_0x577b1e={},_0x5ab522={'count':0x0,'rows':[]};var _0x42fda8=_[_0x0961('0x30')](db['CannedAnswer'][_0x0961('0x31')],function(_0x63d5b0){return{'name':_0x63d5b0['fieldName'],'type':_0x63d5b0[_0x0961('0x32')][_0x0961('0x33')]};});_0x577b1e[_0x0961('0x34')]=_[_0x0961('0x30')](_0x42fda8,_0x0961('0x2e'));_0x577b1e[_0x0961('0x35')]=_[_0x0961('0x36')](_0x4d0c3d[_0x0961('0x35')]);_0x577b1e[_0x0961('0x37')]=_['intersection'](_0x577b1e[_0x0961('0x34')],_0x577b1e['query']);_0x4fd142[_0x0961('0x38')]=_[_0x0961('0x39')](_0x577b1e['model'],qs[_0x0961('0x3a')](_0x4d0c3d[_0x0961('0x35')][_0x0961('0x3a')]));_0x4fd142['attributes']=_0x4fd142['attributes'][_0x0961('0x3b')]?_0x4fd142['attributes']:_0x577b1e[_0x0961('0x34')];if(!_0x4d0c3d[_0x0961('0x35')][_0x0961('0x3c')](_0x0961('0x3d'))){_0x4fd142['limit']=qs[_0x0961('0x22')](_0x4d0c3d[_0x0961('0x35')][_0x0961('0x22')]);_0x4fd142[_0x0961('0x20')]=qs[_0x0961('0x20')](_0x4d0c3d[_0x0961('0x35')][_0x0961('0x20')]);}_0x4fd142[_0x0961('0x3e')]=qs['sort'](_0x4d0c3d[_0x0961('0x35')][_0x0961('0x3f')]);_0x4fd142[_0x0961('0x40')]=qs['filters'](_[_0x0961('0x41')](_0x4d0c3d[_0x0961('0x35')],_0x577b1e[_0x0961('0x37')]),_0x42fda8);if(_0x4d0c3d['query'][_0x0961('0x42')]){_0x4fd142[_0x0961('0x40')]=_['merge'](_0x4fd142[_0x0961('0x40')],{'$or':[{'key':{'$like':'%'+_0x4d0c3d[_0x0961('0x35')][_0x0961('0x42')]+'%'}},{'value':{'$like':'%'+_0x4d0c3d[_0x0961('0x35')][_0x0961('0x42')]+'%'}}]});}_0x4fd142=_[_0x0961('0x43')]({},_0x4fd142,_0x4d0c3d[_0x0961('0x44')]);var _0x592af9={'where':_0x4fd142['where']};return db[_0x0961('0x45')][_0x0961('0x23')](_0x592af9)['then'](function(_0x1639b4){_0x5ab522[_0x0961('0x23')]=_0x1639b4;if(_0x4d0c3d[_0x0961('0x35')][_0x0961('0x46')]){_0x4fd142['include']=[{'all':!![]}];}return db[_0x0961('0x45')][_0x0961('0x47')](_0x4fd142);})['then'](function(_0x19d5b4){_0x5ab522[_0x0961('0x48')]=_0x19d5b4;return _0x5ab522;})[_0x0961('0x29')](respondWithFilteredResult(_0x10c85d,_0x4fd142))[_0x0961('0x49')](handleError(_0x10c85d,null));};exports[_0x0961('0x4a')]=function(_0x556021,_0x580ab2){var _0x3d887f={'raw':!![],'where':{'id':_0x556021[_0x0961('0x4b')]['id']}},_0x20b7ad={};_0x20b7ad['model']=_[_0x0961('0x36')](db['CannedAnswer'][_0x0961('0x31')]);_0x20b7ad[_0x0961('0x35')]=_[_0x0961('0x36')](_0x556021[_0x0961('0x35')]);_0x20b7ad[_0x0961('0x37')]=_[_0x0961('0x39')](_0x20b7ad[_0x0961('0x34')],_0x20b7ad[_0x0961('0x35')]);_0x3d887f[_0x0961('0x38')]=_[_0x0961('0x39')](_0x20b7ad[_0x0961('0x34')],qs[_0x0961('0x3a')](_0x556021[_0x0961('0x35')][_0x0961('0x3a')]));_0x3d887f['attributes']=_0x3d887f[_0x0961('0x38')][_0x0961('0x3b')]?_0x3d887f[_0x0961('0x38')]:_0x20b7ad['model'];if(_0x556021[_0x0961('0x35')][_0x0961('0x46')]){_0x3d887f['include']=[{'all':!![]}];}_0x3d887f=_['merge']({},_0x3d887f,_0x556021[_0x0961('0x44')]);return db[_0x0961('0x45')][_0x0961('0x4c')](_0x3d887f)[_0x0961('0x29')](handleEntityNotFound(_0x580ab2,null))[_0x0961('0x29')](respondWithResult(_0x580ab2,null))[_0x0961('0x49')](handleError(_0x580ab2,null));};exports[_0x0961('0x28')]=function(_0x4ef4dd,_0xeb88e1){if(_0x4ef4dd[_0x0961('0x4d')]['id']){delete _0x4ef4dd[_0x0961('0x4d')]['id'];}return db['CannedAnswer'][_0x0961('0x4c')]({'where':{'id':_0x4ef4dd['params']['id']}})[_0x0961('0x29')](handleEntityNotFound(_0xeb88e1,null))[_0x0961('0x29')](saveUpdates(_0x4ef4dd[_0x0961('0x4d')],null))[_0x0961('0x29')](respondWithResult(_0xeb88e1,null))[_0x0961('0x49')](handleError(_0xeb88e1,null));};exports[_0x0961('0x2a')]=function(_0x1b5191,_0x2b8584){return db[_0x0961('0x45')][_0x0961('0x4c')]({'where':{'id':_0x1b5191[_0x0961('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2b8584,null))[_0x0961('0x29')](removeEntity(_0x2b8584,null))['catch'](handleError(_0x2b8584,null));};exports[_0x0961('0x4e')]=function(_0x3b9391,_0x32c31c){var _0x9ae33c={'key':_0x3b9391[_0x0961('0x4d')][_0x0961('0x33')]};if(_0x3b9391[_0x0961('0x4d')]['MailAccountId']){_0x9ae33c[_0x0961('0x4f')]=_0x3b9391[_0x0961('0x4d')][_0x0961('0x4f')];}else if(_0x3b9391[_0x0961('0x4d')]['SmsAccountId']){_0x9ae33c[_0x0961('0x50')]=_0x3b9391[_0x0961('0x4d')][_0x0961('0x50')];}else if(_0x3b9391[_0x0961('0x4d')][_0x0961('0x51')]){_0x9ae33c[_0x0961('0x51')]=_0x3b9391['body'][_0x0961('0x51')];}else if(_0x3b9391[_0x0961('0x4d')][_0x0961('0x52')]){_0x9ae33c[_0x0961('0x52')]=_0x3b9391[_0x0961('0x4d')][_0x0961('0x52')];}return db['CannedAnswer'][_0x0961('0x4c')]({'where':_0x9ae33c})['then'](function(_0xf37de3){if(_0xf37de3){throw new db[(_0x0961('0x53'))][(_0x0961('0x54'))](_0x0961('0x55'));}return db[_0x0961('0x45')][_0x0961('0x4e')](_0x3b9391[_0x0961('0x4d')]);})[_0x0961('0x29')](function(_0x546aa8){var _0x2e857c=_0x3b9391[_0x0961('0x56')][_0x0961('0x2b')]({'plain':!![]});if(!_0x2e857c)throw new Error(_0x0961('0x57'));if(_0x2e857c[_0x0961('0x58')]==='user'){var _0x8daca5=_0x546aa8[_0x0961('0x2b')]({'plain':!![]});return db['UserProfileSection'][_0x0961('0x4c')]({'where':{'name':'CannedAnswers','userProfileId':_0x2e857c[_0x0961('0x59')]},'raw':!![]})[_0x0961('0x29')](function(_0xc94834){if(_0xc94834&&_0xc94834[_0x0961('0x5a')]===0x0){return db[_0x0961('0x2c')][_0x0961('0x4e')]({'name':_0x8daca5['name'],'resourceId':_0x8daca5['id'],'type':_0xc94834[_0x0961('0x2e')],'sectionId':_0xc94834['id']},{})[_0x0961('0x29')](function(){return _0x546aa8;});}else{return _0x546aa8;}})['catch'](function(_0x4a8f46){logger[_0x0961('0x2d')](_0x0961('0x5b'),_0x4a8f46);throw _0x4a8f46;});}return _0x546aa8;})[_0x0961('0x29')](respondWithResult(_0x32c31c,0xc9))[_0x0961('0x49')](handleError(_0x32c31c,null));}; \ No newline at end of file +var _0x9525=['key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CannedAnswers','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','CannedAnswer','fieldName','type'];(function(_0xd617f0,_0xca0114){var _0x1df36d=function(_0x165f7a){while(--_0x165f7a){_0xd617f0['push'](_0xd617f0['shift']());}};_0x1df36d(++_0xca0114);}(_0x9525,0xd3));var _0x5952=function(_0x1f1659,_0x270cf9){_0x1f1659=_0x1f1659-0x0;var _0x5d5c06=_0x9525[_0x1f1659];return _0x5d5c06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5952('0x0'));var zipdir=require(_0x5952('0x1'));var jsonpatch=require(_0x5952('0x2'));var rp=require(_0x5952('0x3'));var moment=require(_0x5952('0x4'));var BPromise=require(_0x5952('0x5'));var Mustache=require(_0x5952('0x6'));var util=require(_0x5952('0x7'));var path=require(_0x5952('0x8'));var sox=require(_0x5952('0x9'));var csv=require(_0x5952('0xa'));var ejs=require(_0x5952('0xb'));var fs=require('fs');var fs_extra=require(_0x5952('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5952('0xd'));var jsforce=require(_0x5952('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5952('0xf'));var Papa=require('papaparse');var Redis=require(_0x5952('0x10'));var authService=require(_0x5952('0x11'));var qs=require(_0x5952('0x12'));var as=require(_0x5952('0x13'));var hardwareService=require(_0x5952('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5952('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5952('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59173a,_0x402984){_0x402984=_0x402984||0xcc;return function(_0x10f96c){if(_0x10f96c){return _0x59173a[_0x5952('0x17')](_0x402984);}return _0x59173a[_0x5952('0x18')](_0x402984)[_0x5952('0x19')]();};}function respondWithResult(_0x1b94d6,_0x3148aa){_0x3148aa=_0x3148aa||0xc8;return function(_0xd715d8){if(_0xd715d8){return _0x1b94d6['status'](_0x3148aa)[_0x5952('0x1a')](_0xd715d8);}};}function respondWithFilteredResult(_0x5865a4,_0x52a226){return function(_0x14dc89){if(_0x14dc89){var _0x3219d7=typeof _0x52a226[_0x5952('0x1b')]===_0x5952('0x1c')&&typeof _0x52a226[_0x5952('0x1d')]==='undefined';var _0x4762ee=_0x14dc89[_0x5952('0x1e')];var _0x27606f=_0x3219d7?0x0:_0x52a226['offset'];var _0x5a49e2=_0x3219d7?_0x14dc89[_0x5952('0x1e')]:_0x52a226['offset']+_0x52a226['limit'];var _0x1f8bd3;if(_0x5a49e2>=_0x4762ee){_0x5a49e2=_0x4762ee;_0x1f8bd3=0xc8;}else{_0x1f8bd3=0xce;}_0x5865a4[_0x5952('0x18')](_0x1f8bd3);return _0x5865a4[_0x5952('0x1f')](_0x5952('0x20'),_0x27606f+'-'+_0x5a49e2+'/'+_0x4762ee)[_0x5952('0x1a')](_0x14dc89);}return null;};}function patchUpdates(_0x586b9a){return function(_0x300dec){try{jsonpatch['apply'](_0x300dec,_0x586b9a,!![]);}catch(_0x469afd){return BPromise[_0x5952('0x21')](_0x469afd);}return _0x300dec[_0x5952('0x22')]();};}function saveUpdates(_0x418543,_0x2366b1){return function(_0x5458ca){if(_0x5458ca){return _0x5458ca[_0x5952('0x23')](_0x418543)[_0x5952('0x24')](function(_0x527cc4){return _0x527cc4;});}return null;};}function removeEntity(_0x4becd3,_0xb490d0){return function(_0x49ac96){if(_0x49ac96){return _0x49ac96[_0x5952('0x25')]()[_0x5952('0x24')](function(){var _0x316965=_0x49ac96[_0x5952('0x26')]({'plain':!![]});var _0x1a324f='CannedAnswers';return db[_0x5952('0x27')][_0x5952('0x25')]({'where':{'type':_0x1a324f,'resourceId':_0x316965['id']}})['then'](function(){return _0x49ac96;});})[_0x5952('0x24')](function(){_0x4becd3[_0x5952('0x18')](0xcc)[_0x5952('0x19')]();});}};}function handleEntityNotFound(_0x45e3ff,_0x5956e1){return function(_0x100799){if(!_0x100799){_0x45e3ff['sendStatus'](0x194);}return _0x100799;};}function handleError(_0x7c46,_0x592bc4){_0x592bc4=_0x592bc4||0x1f4;return function(_0x2b5a36){logger[_0x5952('0x28')](_0x2b5a36[_0x5952('0x29')]);if(_0x2b5a36[_0x5952('0x2a')]){delete _0x2b5a36[_0x5952('0x2a')];}_0x7c46['status'](_0x592bc4)[_0x5952('0x2b')](_0x2b5a36);};}exports['index']=function(_0x1632ca,_0x205f24){var _0x592227={},_0x27f3f8={},_0x58bd61={'count':0x0,'rows':[]};var _0x4eca75=_['map'](db[_0x5952('0x2c')]['rawAttributes'],function(_0x129b85){return{'name':_0x129b85[_0x5952('0x2d')],'type':_0x129b85[_0x5952('0x2e')][_0x5952('0x2f')]};});_0x27f3f8[_0x5952('0x30')]=_[_0x5952('0x31')](_0x4eca75,_0x5952('0x2a'));_0x27f3f8[_0x5952('0x32')]=_[_0x5952('0x33')](_0x1632ca[_0x5952('0x32')]);_0x27f3f8[_0x5952('0x34')]=_[_0x5952('0x35')](_0x27f3f8['model'],_0x27f3f8[_0x5952('0x32')]);_0x592227[_0x5952('0x36')]=_['intersection'](_0x27f3f8['model'],qs['fields'](_0x1632ca[_0x5952('0x32')][_0x5952('0x37')]));_0x592227[_0x5952('0x36')]=_0x592227['attributes'][_0x5952('0x38')]?_0x592227[_0x5952('0x36')]:_0x27f3f8['model'];if(!_0x1632ca[_0x5952('0x32')]['hasOwnProperty'](_0x5952('0x39'))){_0x592227[_0x5952('0x1d')]=qs[_0x5952('0x1d')](_0x1632ca[_0x5952('0x32')][_0x5952('0x1d')]);_0x592227[_0x5952('0x1b')]=qs[_0x5952('0x1b')](_0x1632ca['query'][_0x5952('0x1b')]);}_0x592227[_0x5952('0x3a')]=qs[_0x5952('0x3b')](_0x1632ca['query']['sort']);_0x592227[_0x5952('0x3c')]=qs[_0x5952('0x34')](_['pick'](_0x1632ca[_0x5952('0x32')],_0x27f3f8['filters']),_0x4eca75);if(_0x1632ca[_0x5952('0x32')][_0x5952('0x3d')]){_0x592227[_0x5952('0x3c')]=_[_0x5952('0x3e')](_0x592227[_0x5952('0x3c')],{'$or':[{'key':{'$like':'%'+_0x1632ca[_0x5952('0x32')][_0x5952('0x3d')]+'%'}},{'value':{'$like':'%'+_0x1632ca[_0x5952('0x32')]['filter']+'%'}}]});}_0x592227=_[_0x5952('0x3e')]({},_0x592227,_0x1632ca['options']);var _0x16c9ec={'where':_0x592227['where']};return db[_0x5952('0x2c')][_0x5952('0x1e')](_0x16c9ec)[_0x5952('0x24')](function(_0x2f3b9f){_0x58bd61['count']=_0x2f3b9f;if(_0x1632ca['query'][_0x5952('0x3f')]){_0x592227[_0x5952('0x40')]=[{'all':!![]}];}return db[_0x5952('0x2c')][_0x5952('0x41')](_0x592227);})['then'](function(_0x3b1f06){_0x58bd61[_0x5952('0x42')]=_0x3b1f06;return _0x58bd61;})[_0x5952('0x24')](respondWithFilteredResult(_0x205f24,_0x592227))[_0x5952('0x43')](handleError(_0x205f24,null));};exports[_0x5952('0x44')]=function(_0x4cbb56,_0x579910){var _0x4c1509={'raw':!![],'where':{'id':_0x4cbb56[_0x5952('0x45')]['id']}},_0xbe9b53={};_0xbe9b53[_0x5952('0x30')]=_[_0x5952('0x33')](db[_0x5952('0x2c')][_0x5952('0x46')]);_0xbe9b53['query']=_[_0x5952('0x33')](_0x4cbb56['query']);_0xbe9b53[_0x5952('0x34')]=_[_0x5952('0x35')](_0xbe9b53[_0x5952('0x30')],_0xbe9b53[_0x5952('0x32')]);_0x4c1509[_0x5952('0x36')]=_['intersection'](_0xbe9b53[_0x5952('0x30')],qs[_0x5952('0x37')](_0x4cbb56[_0x5952('0x32')]['fields']));_0x4c1509[_0x5952('0x36')]=_0x4c1509[_0x5952('0x36')][_0x5952('0x38')]?_0x4c1509[_0x5952('0x36')]:_0xbe9b53['model'];if(_0x4cbb56[_0x5952('0x32')]['includeAll']){_0x4c1509['include']=[{'all':!![]}];}_0x4c1509=_['merge']({},_0x4c1509,_0x4cbb56[_0x5952('0x47')]);return db['CannedAnswer'][_0x5952('0x48')](_0x4c1509)['then'](handleEntityNotFound(_0x579910,null))['then'](respondWithResult(_0x579910,null))[_0x5952('0x43')](handleError(_0x579910,null));};exports[_0x5952('0x23')]=function(_0x4592e4,_0x3ee891){if(_0x4592e4[_0x5952('0x49')]['id']){delete _0x4592e4[_0x5952('0x49')]['id'];}return db[_0x5952('0x2c')][_0x5952('0x48')]({'where':{'id':_0x4592e4['params']['id']}})[_0x5952('0x24')](handleEntityNotFound(_0x3ee891,null))[_0x5952('0x24')](saveUpdates(_0x4592e4[_0x5952('0x49')],null))['then'](respondWithResult(_0x3ee891,null))[_0x5952('0x43')](handleError(_0x3ee891,null));};exports['destroy']=function(_0x2f593f,_0x418361){return db[_0x5952('0x2c')]['find']({'where':{'id':_0x2f593f[_0x5952('0x45')]['id']}})[_0x5952('0x24')](handleEntityNotFound(_0x418361,null))[_0x5952('0x24')](removeEntity(_0x418361,null))[_0x5952('0x43')](handleError(_0x418361,null));};exports['create']=function(_0x509a0d,_0x540c02){var _0x45a5c2={'key':_0x509a0d[_0x5952('0x49')][_0x5952('0x2f')]};if(_0x509a0d[_0x5952('0x49')][_0x5952('0x4a')]){_0x45a5c2['MailAccountId']=_0x509a0d['body'][_0x5952('0x4a')];}else if(_0x509a0d[_0x5952('0x49')]['SmsAccountId']){_0x45a5c2[_0x5952('0x4b')]=_0x509a0d[_0x5952('0x49')][_0x5952('0x4b')];}else if(_0x509a0d[_0x5952('0x49')][_0x5952('0x4c')]){_0x45a5c2[_0x5952('0x4c')]=_0x509a0d[_0x5952('0x49')]['OpenchannelAccountId'];}else if(_0x509a0d[_0x5952('0x49')][_0x5952('0x4d')]){_0x45a5c2[_0x5952('0x4d')]=_0x509a0d['body']['ChatWebsiteId'];}return db['CannedAnswer'][_0x5952('0x48')]({'where':_0x45a5c2})['then'](function(_0x553248){if(_0x553248){throw new db[(_0x5952('0x4e'))][(_0x5952('0x4f'))](_0x5952('0x50'));}return db['CannedAnswer']['create'](_0x509a0d[_0x5952('0x49')]);})['then'](function(_0xf59181){var _0x41b250=_0x509a0d[_0x5952('0x51')][_0x5952('0x26')]({'plain':!![]});if(!_0x41b250)throw new Error(_0x5952('0x52'));if(_0x41b250['role']===_0x5952('0x51')){var _0x251132=_0xf59181[_0x5952('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x5952('0x48')]({'where':{'name':_0x5952('0x53'),'userProfileId':_0x41b250['userProfileId']},'raw':!![]})['then'](function(_0x3553e0){if(_0x3553e0&&_0x3553e0['autoAssociation']===0x0){return db['UserProfileResource'][_0x5952('0x54')]({'name':_0x251132[_0x5952('0x2a')],'resourceId':_0x251132['id'],'type':_0x3553e0[_0x5952('0x2a')],'sectionId':_0x3553e0['id']},{})[_0x5952('0x24')](function(){return _0xf59181;});}else{return _0xf59181;}})[_0x5952('0x43')](function(_0x1b442c){logger[_0x5952('0x28')](_0x5952('0x55'),_0x1b442c);throw _0x1b442c;});}return _0xf59181;})['then'](respondWithResult(_0x540c02,0xc9))[_0x5952('0x43')](handleError(_0x540c02,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 4c2db4d..81b11b0 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 _0x9106=['lodash','util','../../config/logger','api','bluebird','request-promise','path','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x9c1313,_0x5b7140){var _0x444261=function(_0x3ab2d3){while(--_0x3ab2d3){_0x9c1313['push'](_0x9c1313['shift']());}};_0x444261(++_0x5b7140);}(_0x9106,0x6e));var _0x6910=function(_0x2e1aa2,_0x72bfb2){_0x2e1aa2=_0x2e1aa2-0x0;var _0x13188a=_0x9106[_0x2e1aa2];return _0x13188a;};'use strict';var _=require(_0x6910('0x0'));var util=require(_0x6910('0x1'));var logger=require(_0x6910('0x2'))(_0x6910('0x3'));var moment=require('moment');var BPromise=require(_0x6910('0x4'));var rp=require(_0x6910('0x5'));var fs=require('fs');var path=require(_0x6910('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x28b7a9,_0x582073){return _0x28b7a9[_0x6910('0x7')]('CannedAnswer',attributes,{'tableName':_0x6910('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6910('0x9'),'collate':_0x6910('0xa')});}; \ No newline at end of file +var _0xd5f5=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x502e35,_0x5f0ec7){var _0x82e2d0=function(_0xe24900){while(--_0xe24900){_0x502e35['push'](_0x502e35['shift']());}};_0x82e2d0(++_0x5f0ec7);}(_0xd5f5,0xcc));var _0x5d5f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd5f5[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x5d5f('0x0'));var util=require(_0x5d5f('0x1'));var logger=require('../../config/logger')(_0x5d5f('0x2'));var moment=require(_0x5d5f('0x3'));var BPromise=require(_0x5d5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d5f('0x5'));var rimraf=require(_0x5d5f('0x6'));var config=require(_0x5d5f('0x7'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0xf53d7a,_0x1f3741){return _0xf53d7a[_0x5d5f('0x8')]('CannedAnswer',attributes,{'tableName':_0x5d5f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d5f('0xa'),'collate':_0x5d5f('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 9c97841..e306042 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(_0x318052,_0x53e2af){var _0x132c05=function(_0x5851aa){while(--_0x5851aa){_0x318052['push'](_0x318052['shift']());}};_0x132c05(++_0x53e2af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x5f3acf,_0x358ee8){var _0x46f022=function(_0x5cf2a1){while(--_0x5cf2a1){_0x5f3acf['push'](_0x5f3acf['shift']());}};_0x46f022(++_0x358ee8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var 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 6c89c96..5aa6491 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 _0x025c=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','path'];(function(_0x39ac27,_0x7b441){var _0x24c00a=function(_0x3a83d1){while(--_0x3a83d1){_0x39ac27['push'](_0x39ac27['shift']());}};_0x24c00a(++_0x7b441);}(_0x025c,0x1e4));var _0xc025=function(_0x19a5d9,_0x3bf6ac){_0x19a5d9=_0x19a5d9-0x0;var _0x3a27a6=_0x025c[_0x19a5d9];return _0x3a27a6;};'use strict';var multer=require(_0xc025('0x0'));var util=require('util');var path=require(_0xc025('0x1'));var timeout=require(_0xc025('0x2'));var express=require(_0xc025('0x3'));var router=express['Router']();var fs_extra=require(_0xc025('0x4'));var auth=require(_0xc025('0x5'));var interaction=require(_0xc025('0x6'));var config=require('../../config/environment');var controller=require(_0xc025('0x7'));router[_0xc025('0x8')]('/',auth[_0xc025('0x9')](),controller['index']);router[_0xc025('0x8')](_0xc025('0xa'),auth[_0xc025('0x9')](),controller[_0xc025('0xb')]);router[_0xc025('0xc')]('/',auth[_0xc025('0x9')](),controller[_0xc025('0xd')]);router[_0xc025('0xe')](_0xc025('0xa'),auth['isAuthenticated'](),controller[_0xc025('0xf')]);router[_0xc025('0x10')](_0xc025('0xa'),auth[_0xc025('0x9')](),controller[_0xc025('0x11')]);module['exports']=router; \ No newline at end of file +var _0xdbd8=['../../config/environment','./cannedAnswer.controller','get','index','/:id','post','isAuthenticated','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c8c07,_0x2579af){var _0x4aa88f=function(_0x2ad13d){while(--_0x2ad13d){_0x1c8c07['push'](_0x1c8c07['shift']());}};_0x4aa88f(++_0x2579af);}(_0xdbd8,0xe8));var _0x8dbd=function(_0x486315,_0x4a0c4e){_0x486315=_0x486315-0x0;var _0x369849=_0xdbd8[_0x486315];return _0x369849;};'use strict';var multer=require(_0x8dbd('0x0'));var util=require('util');var path=require(_0x8dbd('0x1'));var timeout=require(_0x8dbd('0x2'));var express=require(_0x8dbd('0x3'));var router=express[_0x8dbd('0x4')]();var fs_extra=require(_0x8dbd('0x5'));var auth=require(_0x8dbd('0x6'));var interaction=require(_0x8dbd('0x7'));var config=require(_0x8dbd('0x8'));var controller=require(_0x8dbd('0x9'));router[_0x8dbd('0xa')]('/',auth['isAuthenticated'](),controller[_0x8dbd('0xb')]);router[_0x8dbd('0xa')](_0x8dbd('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8dbd('0xd')]('/',auth[_0x8dbd('0xe')](),controller[_0x8dbd('0xf')]);router[_0x8dbd('0x10')](_0x8dbd('0xc'),auth[_0x8dbd('0xe')](),controller[_0x8dbd('0x11')]);router[_0x8dbd('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8dbd('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 2d44196..fad6f98 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 _0xb63f=['1970-01-01\x2000:00:01','STRING','INTEGER','DATE'];(function(_0x3f4bb2,_0x1fe283){var _0x113328=function(_0xdb325f){while(--_0xdb325f){_0x3f4bb2['push'](_0x3f4bb2['shift']());}};_0x113328(++_0x1fe283);}(_0xb63f,0xa3));var _0xfb63=function(_0x50f6e5,_0x151ccb){_0x50f6e5=_0x50f6e5-0x0;var _0x5988c5=_0xb63f[_0x50f6e5];return _0x5988c5;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xfb63('0x0')],'allowNull':![],'defaultValue':_0xfb63('0x1')},'clid':{'type':Sequelize[_0xfb63('0x2')]},'src':{'type':Sequelize[_0xfb63('0x2')]},'dst':{'type':Sequelize[_0xfb63('0x2')]},'dcontext':{'type':Sequelize[_0xfb63('0x2')]},'channel':{'type':Sequelize[_0xfb63('0x2')]},'dstchannel':{'type':Sequelize[_0xfb63('0x2')]},'lastapp':{'type':Sequelize[_0xfb63('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xfb63('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfb63('0x2')]},'amaflags':{'type':Sequelize[_0xfb63('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xfb63('0x2')]},'sequence':{'type':Sequelize[_0xfb63('0x2')]},'peeraccount':{'type':Sequelize[_0xfb63('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xfb63('0x2')]}}; \ No newline at end of file +var _0x0b3e=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x5a14d9,_0x3d17ca){var _0x1f933f=function(_0x4cf576){while(--_0x4cf576){_0x5a14d9['push'](_0x5a14d9['shift']());}};_0x1f933f(++_0x3d17ca);}(_0x0b3e,0xfe));var _0xe0b3=function(_0x2c247b,_0x1afa09){_0x2c247b=_0x2c247b-0x0;var _0x227f53=_0x0b3e[_0x2c247b];return _0x227f53;};'use strict';var Sequelize=require('sequelize');module[_0xe0b3('0x0')]={'calldate':{'type':Sequelize[_0xe0b3('0x1')],'allowNull':![],'defaultValue':_0xe0b3('0x2')},'clid':{'type':Sequelize[_0xe0b3('0x3')]},'src':{'type':Sequelize[_0xe0b3('0x3')]},'dst':{'type':Sequelize[_0xe0b3('0x3')]},'dcontext':{'type':Sequelize[_0xe0b3('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xe0b3('0x3')]},'lastapp':{'type':Sequelize[_0xe0b3('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xe0b3('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe0b3('0x3')]},'amaflags':{'type':Sequelize[_0xe0b3('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xe0b3('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xe0b3('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'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 892041d..1b0cfc6 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 _0x5577=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','Cdr','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','rows','show','find','catch','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x4faa5c,_0x596c36){var _0x58c0fa=function(_0x4b07c8){while(--_0x4b07c8){_0x4faa5c['push'](_0x4faa5c['shift']());}};_0x58c0fa(++_0x596c36);}(_0x5577,0x1b4));var _0x7557=function(_0x55d2bc,_0x2f3f1b){_0x55d2bc=_0x55d2bc-0x0;var _0x30e63b=_0x5577[_0x55d2bc];return _0x30e63b;};'use strict';var emlformat=require(_0x7557('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7557('0x1'));var jsonpatch=require(_0x7557('0x2'));var rp=require('request-promise');var moment=require(_0x7557('0x3'));var BPromise=require(_0x7557('0x4'));var Mustache=require(_0x7557('0x5'));var util=require(_0x7557('0x6'));var path=require(_0x7557('0x7'));var sox=require(_0x7557('0x8'));var csv=require('to-csv');var ejs=require(_0x7557('0x9'));var fs=require('fs');var fs_extra=require(_0x7557('0xa'));var _=require(_0x7557('0xb'));var squel=require(_0x7557('0xc'));var crypto=require(_0x7557('0xd'));var jsforce=require(_0x7557('0xe'));var deskjs=require(_0x7557('0xf'));var toCsv=require(_0x7557('0x10'));var querystring=require(_0x7557('0x11'));var Papa=require(_0x7557('0x12'));var Redis=require(_0x7557('0x13'));var authService=require(_0x7557('0x14'));var qs=require(_0x7557('0x15'));var as=require(_0x7557('0x16'));var hardwareService=require(_0x7557('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x7557('0x18'));var config=require(_0x7557('0x19'));var licenseUtil=require(_0x7557('0x1a'));var db=require(_0x7557('0x1b'))['db'];function respondWithStatusCode(_0xb6ed30,_0x467ac5){_0x467ac5=_0x467ac5||0xcc;return function(_0x156ac1){if(_0x156ac1){return _0xb6ed30[_0x7557('0x1c')](_0x467ac5);}return _0xb6ed30[_0x7557('0x1d')](_0x467ac5)[_0x7557('0x1e')]();};}function respondWithResult(_0x5468df,_0x276031){_0x276031=_0x276031||0xc8;return function(_0x3fb7a6){if(_0x3fb7a6){return _0x5468df[_0x7557('0x1d')](_0x276031)['json'](_0x3fb7a6);}};}function respondWithFilteredResult(_0x3ad3a1,_0x3c3953){return function(_0x33098f){if(_0x33098f){var _0x325849=typeof _0x3c3953['offset']===_0x7557('0x1f')&&typeof _0x3c3953[_0x7557('0x20')]==='undefined';var _0x4a9cae=_0x33098f[_0x7557('0x21')];var _0x11f186=_0x325849?0x0:_0x3c3953[_0x7557('0x22')];var _0x40a81b=_0x325849?_0x33098f['count']:_0x3c3953[_0x7557('0x22')]+_0x3c3953['limit'];var _0x3e2972;if(_0x40a81b>=_0x4a9cae){_0x40a81b=_0x4a9cae;_0x3e2972=0xc8;}else{_0x3e2972=0xce;}_0x3ad3a1[_0x7557('0x1d')](_0x3e2972);return _0x3ad3a1[_0x7557('0x23')](_0x7557('0x24'),_0x11f186+'-'+_0x40a81b+'/'+_0x4a9cae)['json'](_0x33098f);}return null;};}function patchUpdates(_0x1b60a9){return function(_0x3180cd){try{jsonpatch[_0x7557('0x25')](_0x3180cd,_0x1b60a9,!![]);}catch(_0x34bed5){return BPromise[_0x7557('0x26')](_0x34bed5);}return _0x3180cd['save']();};}function saveUpdates(_0x502e49,_0x4eb212){return function(_0x211fbe){if(_0x211fbe){return _0x211fbe['update'](_0x502e49)[_0x7557('0x27')](function(_0x352b63){return _0x352b63;});}return null;};}function removeEntity(_0x1e97d3,_0x9bbcf6){return function(_0x1533b2){if(_0x1533b2){return _0x1533b2[_0x7557('0x28')]()[_0x7557('0x27')](function(){_0x1e97d3['status'](0xcc)[_0x7557('0x1e')]();});}};}function handleEntityNotFound(_0x5bc953,_0x3daeac){return function(_0x5b2c6a){if(!_0x5b2c6a){_0x5bc953[_0x7557('0x1c')](0x194);}return _0x5b2c6a;};}function handleError(_0x3aa642,_0x4758b9){_0x4758b9=_0x4758b9||0x1f4;return function(_0x42ae94){logger['error'](_0x42ae94[_0x7557('0x29')]);if(_0x42ae94['name']){delete _0x42ae94[_0x7557('0x2a')];}_0x3aa642[_0x7557('0x1d')](_0x4758b9)[_0x7557('0x2b')](_0x42ae94);};}exports['index']=function(_0x3b36eb,_0x2b4ca8){var _0x1c6df9={},_0x1c4649={},_0x19095d={'count':0x0,'rows':[]};var _0x414eec=_['map'](db[_0x7557('0x2c')][_0x7557('0x2d')],function(_0x9080c6){return{'name':_0x9080c6[_0x7557('0x2e')],'type':_0x9080c6['type'][_0x7557('0x2f')]};});_0x1c4649[_0x7557('0x30')]=_[_0x7557('0x31')](_0x414eec,_0x7557('0x2a'));_0x1c4649[_0x7557('0x32')]=_[_0x7557('0x33')](_0x3b36eb[_0x7557('0x32')]);_0x1c4649[_0x7557('0x34')]=_[_0x7557('0x35')](_0x1c4649[_0x7557('0x30')],_0x1c4649[_0x7557('0x32')]);_0x1c6df9[_0x7557('0x36')]=_[_0x7557('0x35')](_0x1c4649[_0x7557('0x30')],qs[_0x7557('0x37')](_0x3b36eb[_0x7557('0x32')][_0x7557('0x37')]));_0x1c6df9[_0x7557('0x36')]=_0x1c6df9[_0x7557('0x36')][_0x7557('0x38')]?_0x1c6df9[_0x7557('0x36')]:_0x1c4649[_0x7557('0x30')];if(!_0x3b36eb['query'][_0x7557('0x39')]('nolimit')){_0x1c6df9['limit']=qs[_0x7557('0x20')](_0x3b36eb['query'][_0x7557('0x20')]);_0x1c6df9['offset']=qs['offset'](_0x3b36eb[_0x7557('0x32')][_0x7557('0x22')]);}_0x1c6df9[_0x7557('0x3a')]=qs['sort'](_0x3b36eb[_0x7557('0x32')][_0x7557('0x3b')]);_0x1c6df9[_0x7557('0x3c')]=qs[_0x7557('0x34')](_[_0x7557('0x3d')](_0x3b36eb[_0x7557('0x32')],_0x1c4649[_0x7557('0x34')]),_0x414eec);if(_0x3b36eb[_0x7557('0x32')]['filter']){_0x1c6df9['where']=_['merge'](_0x1c6df9['where'],{'$or':_['map'](_0x414eec,function(_0x4f3c68){if(_0x4f3c68[_0x7557('0x3e')]!==_0x7557('0x3f')){var _0x3a7c60={};_0x3a7c60[_0x4f3c68[_0x7557('0x2a')]]={'$like':'%'+_0x3b36eb['query']['filter']+'%'};return _0x3a7c60;}})});}_0x1c6df9=_[_0x7557('0x40')]({},_0x1c6df9,_0x3b36eb[_0x7557('0x41')]);var _0x962488={'where':_0x1c6df9[_0x7557('0x3c')]};return db[_0x7557('0x2c')]['count'](_0x962488)[_0x7557('0x27')](function(_0x5149c9){_0x19095d[_0x7557('0x21')]=_0x5149c9;if(_0x3b36eb[_0x7557('0x32')][_0x7557('0x42')]){_0x1c6df9[_0x7557('0x43')]=[{'all':!![]}];}return db[_0x7557('0x2c')]['findAll'](_0x1c6df9);})[_0x7557('0x27')](function(_0x3023e5){_0x19095d[_0x7557('0x44')]=_0x3023e5;return _0x19095d;})[_0x7557('0x27')](respondWithFilteredResult(_0x2b4ca8,_0x1c6df9))['catch'](handleError(_0x2b4ca8,null));};exports[_0x7557('0x45')]=function(_0x59a75a,_0x156f3b){var _0x576461={'raw':!![],'where':{'id':_0x59a75a['params']['id']}},_0x16e40f={};_0x16e40f[_0x7557('0x30')]=_['keys'](db[_0x7557('0x2c')]['rawAttributes']);_0x16e40f[_0x7557('0x32')]=_[_0x7557('0x33')](_0x59a75a[_0x7557('0x32')]);_0x16e40f[_0x7557('0x34')]=_[_0x7557('0x35')](_0x16e40f[_0x7557('0x30')],_0x16e40f['query']);_0x576461['attributes']=_['intersection'](_0x16e40f[_0x7557('0x30')],qs[_0x7557('0x37')](_0x59a75a[_0x7557('0x32')][_0x7557('0x37')]));_0x576461[_0x7557('0x36')]=_0x576461['attributes'][_0x7557('0x38')]?_0x576461['attributes']:_0x16e40f[_0x7557('0x30')];if(_0x59a75a[_0x7557('0x32')][_0x7557('0x42')]){_0x576461[_0x7557('0x43')]=[{'all':!![]}];}_0x576461=_[_0x7557('0x40')]({},_0x576461,_0x59a75a[_0x7557('0x41')]);return db[_0x7557('0x2c')][_0x7557('0x46')](_0x576461)['then'](handleEntityNotFound(_0x156f3b,null))[_0x7557('0x27')](respondWithResult(_0x156f3b,null))[_0x7557('0x47')](handleError(_0x156f3b,null));};exports[_0x7557('0x48')]=function(_0x59904c,_0xb25031){return db['Cdr']['create'](_0x59904c[_0x7557('0x49')],{})[_0x7557('0x27')](respondWithResult(_0xb25031,0xc9))[_0x7557('0x47')](handleError(_0xb25031,null));};exports[_0x7557('0x4a')]=function(_0x3683c9,_0x4d9b43){if(_0x3683c9[_0x7557('0x49')]['id']){delete _0x3683c9[_0x7557('0x49')]['id'];}return db[_0x7557('0x2c')][_0x7557('0x46')]({'where':{'id':_0x3683c9[_0x7557('0x4b')]['id']}})[_0x7557('0x27')](handleEntityNotFound(_0x4d9b43,null))[_0x7557('0x27')](saveUpdates(_0x3683c9['body'],null))['then'](respondWithResult(_0x4d9b43,null))['catch'](handleError(_0x4d9b43,null));};exports['destroy']=function(_0x2b85c5,_0x36a2a1){return db[_0x7557('0x2c')][_0x7557('0x46')]({'where':{'id':_0x2b85c5[_0x7557('0x4b')]['id']}})[_0x7557('0x27')](handleEntityNotFound(_0x36a2a1,null))[_0x7557('0x27')](removeEntity(_0x36a2a1,null))[_0x7557('0x47')](handleError(_0x36a2a1,null));};exports['describe']=function(_0x46b871,_0x445e17){return db['Cdr'][_0x7557('0x4c')]()['then'](respondWithResult(_0x445e17,null))[_0x7557('0x47')](handleError(_0x445e17,null));}; \ No newline at end of file +var _0x02a7=['then','destroy','end','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','undefined','count','offset','status','set','Content-Range','json','apply','reject','save','update'];(function(_0x51fe15,_0x138833){var _0x103d3f=function(_0x5da5a9){while(--_0x5da5a9){_0x51fe15['push'](_0x51fe15['shift']());}};_0x103d3f(++_0x138833);}(_0x02a7,0x7a));var _0x702a=function(_0x1824d4,_0x5a7420){_0x1824d4=_0x1824d4-0x0;var _0x35d8a7=_0x02a7[_0x1824d4];return _0x35d8a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x702a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x702a('0x1'));var moment=require(_0x702a('0x2'));var BPromise=require(_0x702a('0x3'));var Mustache=require(_0x702a('0x4'));var util=require(_0x702a('0x5'));var path=require(_0x702a('0x6'));var sox=require(_0x702a('0x7'));var csv=require('to-csv');var ejs=require(_0x702a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x702a('0x9'));var squel=require(_0x702a('0xa'));var crypto=require(_0x702a('0xb'));var jsforce=require(_0x702a('0xc'));var deskjs=require(_0x702a('0xd'));var toCsv=require(_0x702a('0xe'));var querystring=require(_0x702a('0xf'));var Papa=require('papaparse');var Redis=require(_0x702a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x702a('0x11'));var hardwareService=require(_0x702a('0x12'));var logger=require(_0x702a('0x13'))(_0x702a('0x14'));var utils=require('../../config/utils');var config=require(_0x702a('0x15'));var licenseUtil=require(_0x702a('0x16'));var db=require(_0x702a('0x17'))['db'];function respondWithStatusCode(_0x221b35,_0x4688d1){_0x4688d1=_0x4688d1||0xcc;return function(_0x75455){if(_0x75455){return _0x221b35[_0x702a('0x18')](_0x4688d1);}return _0x221b35['status'](_0x4688d1)['end']();};}function respondWithResult(_0x38139d,_0x57f5fc){_0x57f5fc=_0x57f5fc||0xc8;return function(_0x576cf8){if(_0x576cf8){return _0x38139d['status'](_0x57f5fc)['json'](_0x576cf8);}};}function respondWithFilteredResult(_0x5c768d,_0x44f7fd){return function(_0x3c9770){if(_0x3c9770){var _0xa124dd=typeof _0x44f7fd['offset']==='undefined'&&typeof _0x44f7fd['limit']===_0x702a('0x19');var _0x469cb2=_0x3c9770[_0x702a('0x1a')];var _0x492cfb=_0xa124dd?0x0:_0x44f7fd[_0x702a('0x1b')];var _0x5ec1b3=_0xa124dd?_0x3c9770[_0x702a('0x1a')]:_0x44f7fd[_0x702a('0x1b')]+_0x44f7fd['limit'];var _0x4f8b29;if(_0x5ec1b3>=_0x469cb2){_0x5ec1b3=_0x469cb2;_0x4f8b29=0xc8;}else{_0x4f8b29=0xce;}_0x5c768d[_0x702a('0x1c')](_0x4f8b29);return _0x5c768d[_0x702a('0x1d')](_0x702a('0x1e'),_0x492cfb+'-'+_0x5ec1b3+'/'+_0x469cb2)[_0x702a('0x1f')](_0x3c9770);}return null;};}function patchUpdates(_0x332254){return function(_0x3152bf){try{jsonpatch[_0x702a('0x20')](_0x3152bf,_0x332254,!![]);}catch(_0x3a4add){return BPromise[_0x702a('0x21')](_0x3a4add);}return _0x3152bf[_0x702a('0x22')]();};}function saveUpdates(_0x47d0f5,_0x1ecd28){return function(_0x3d213c){if(_0x3d213c){return _0x3d213c[_0x702a('0x23')](_0x47d0f5)[_0x702a('0x24')](function(_0x1d6dae){return _0x1d6dae;});}return null;};}function removeEntity(_0x466b74,_0x2aede0){return function(_0x156212){if(_0x156212){return _0x156212[_0x702a('0x25')]()['then'](function(){_0x466b74[_0x702a('0x1c')](0xcc)[_0x702a('0x26')]();});}};}function handleEntityNotFound(_0x57add6,_0xf08699){return function(_0x1a9fbf){if(!_0x1a9fbf){_0x57add6[_0x702a('0x18')](0x194);}return _0x1a9fbf;};}function handleError(_0xf6b463,_0x3d4ed0){_0x3d4ed0=_0x3d4ed0||0x1f4;return function(_0x2eff20){logger['error'](_0x2eff20[_0x702a('0x27')]);if(_0x2eff20[_0x702a('0x28')]){delete _0x2eff20['name'];}_0xf6b463[_0x702a('0x1c')](_0x3d4ed0)[_0x702a('0x29')](_0x2eff20);};}exports[_0x702a('0x2a')]=function(_0x21ba99,_0x1973c7){var _0xa0877a={},_0x1596a8={},_0x5c6da4={'count':0x0,'rows':[]};var _0x2d7044=_[_0x702a('0x2b')](db[_0x702a('0x2c')][_0x702a('0x2d')],function(_0x511e7e){return{'name':_0x511e7e[_0x702a('0x2e')],'type':_0x511e7e['type'][_0x702a('0x2f')]};});_0x1596a8[_0x702a('0x30')]=_['map'](_0x2d7044,'name');_0x1596a8[_0x702a('0x31')]=_[_0x702a('0x32')](_0x21ba99['query']);_0x1596a8[_0x702a('0x33')]=_['intersection'](_0x1596a8['model'],_0x1596a8[_0x702a('0x31')]);_0xa0877a[_0x702a('0x34')]=_[_0x702a('0x35')](_0x1596a8['model'],qs[_0x702a('0x36')](_0x21ba99[_0x702a('0x31')][_0x702a('0x36')]));_0xa0877a[_0x702a('0x34')]=_0xa0877a[_0x702a('0x34')][_0x702a('0x37')]?_0xa0877a[_0x702a('0x34')]:_0x1596a8[_0x702a('0x30')];if(!_0x21ba99[_0x702a('0x31')][_0x702a('0x38')](_0x702a('0x39'))){_0xa0877a[_0x702a('0x3a')]=qs[_0x702a('0x3a')](_0x21ba99[_0x702a('0x31')][_0x702a('0x3a')]);_0xa0877a[_0x702a('0x1b')]=qs[_0x702a('0x1b')](_0x21ba99[_0x702a('0x31')]['offset']);}_0xa0877a[_0x702a('0x3b')]=qs[_0x702a('0x3c')](_0x21ba99[_0x702a('0x31')][_0x702a('0x3c')]);_0xa0877a[_0x702a('0x3d')]=qs[_0x702a('0x33')](_[_0x702a('0x3e')](_0x21ba99[_0x702a('0x31')],_0x1596a8['filters']),_0x2d7044);if(_0x21ba99[_0x702a('0x31')][_0x702a('0x3f')]){_0xa0877a[_0x702a('0x3d')]=_[_0x702a('0x40')](_0xa0877a[_0x702a('0x3d')],{'$or':_[_0x702a('0x2b')](_0x2d7044,function(_0x3bc107){if(_0x3bc107[_0x702a('0x41')]!==_0x702a('0x42')){var _0x10fee4={};_0x10fee4[_0x3bc107[_0x702a('0x28')]]={'$like':'%'+_0x21ba99[_0x702a('0x31')][_0x702a('0x3f')]+'%'};return _0x10fee4;}})});}_0xa0877a=_[_0x702a('0x40')]({},_0xa0877a,_0x21ba99['options']);var _0x252b54={'where':_0xa0877a[_0x702a('0x3d')]};return db[_0x702a('0x2c')]['count'](_0x252b54)[_0x702a('0x24')](function(_0x202425){_0x5c6da4[_0x702a('0x1a')]=_0x202425;if(_0x21ba99[_0x702a('0x31')][_0x702a('0x43')]){_0xa0877a[_0x702a('0x44')]=[{'all':!![]}];}return db['Cdr'][_0x702a('0x45')](_0xa0877a);})[_0x702a('0x24')](function(_0x34a26f){_0x5c6da4[_0x702a('0x46')]=_0x34a26f;return _0x5c6da4;})[_0x702a('0x24')](respondWithFilteredResult(_0x1973c7,_0xa0877a))[_0x702a('0x47')](handleError(_0x1973c7,null));};exports[_0x702a('0x48')]=function(_0x275262,_0x5a67df){var _0x41a7ab={'raw':!![],'where':{'id':_0x275262[_0x702a('0x49')]['id']}},_0x5dc8f8={};_0x5dc8f8[_0x702a('0x30')]=_[_0x702a('0x32')](db['Cdr'][_0x702a('0x2d')]);_0x5dc8f8[_0x702a('0x31')]=_[_0x702a('0x32')](_0x275262[_0x702a('0x31')]);_0x5dc8f8[_0x702a('0x33')]=_[_0x702a('0x35')](_0x5dc8f8[_0x702a('0x30')],_0x5dc8f8['query']);_0x41a7ab['attributes']=_[_0x702a('0x35')](_0x5dc8f8[_0x702a('0x30')],qs['fields'](_0x275262['query']['fields']));_0x41a7ab[_0x702a('0x34')]=_0x41a7ab[_0x702a('0x34')][_0x702a('0x37')]?_0x41a7ab[_0x702a('0x34')]:_0x5dc8f8[_0x702a('0x30')];if(_0x275262[_0x702a('0x31')][_0x702a('0x43')]){_0x41a7ab[_0x702a('0x44')]=[{'all':!![]}];}_0x41a7ab=_[_0x702a('0x40')]({},_0x41a7ab,_0x275262[_0x702a('0x4a')]);return db[_0x702a('0x2c')][_0x702a('0x4b')](_0x41a7ab)[_0x702a('0x24')](handleEntityNotFound(_0x5a67df,null))['then'](respondWithResult(_0x5a67df,null))['catch'](handleError(_0x5a67df,null));};exports[_0x702a('0x4c')]=function(_0x919678,_0x5a1cdf){return db[_0x702a('0x2c')][_0x702a('0x4c')](_0x919678['body'],{})[_0x702a('0x24')](respondWithResult(_0x5a1cdf,0xc9))[_0x702a('0x47')](handleError(_0x5a1cdf,null));};exports[_0x702a('0x23')]=function(_0x55e380,_0x3b1bba){if(_0x55e380[_0x702a('0x4d')]['id']){delete _0x55e380['body']['id'];}return db[_0x702a('0x2c')][_0x702a('0x4b')]({'where':{'id':_0x55e380['params']['id']}})[_0x702a('0x24')](handleEntityNotFound(_0x3b1bba,null))[_0x702a('0x24')](saveUpdates(_0x55e380[_0x702a('0x4d')],null))[_0x702a('0x24')](respondWithResult(_0x3b1bba,null))[_0x702a('0x47')](handleError(_0x3b1bba,null));};exports[_0x702a('0x25')]=function(_0xee9f8d,_0xbf2b99){return db[_0x702a('0x2c')]['find']({'where':{'id':_0xee9f8d[_0x702a('0x49')]['id']}})[_0x702a('0x24')](handleEntityNotFound(_0xbf2b99,null))[_0x702a('0x24')](removeEntity(_0xbf2b99,null))[_0x702a('0x47')](handleError(_0xbf2b99,null));};exports['describe']=function(_0x859fe6,_0x4235b4){return db[_0x702a('0x2c')][_0x702a('0x4e')]()[_0x702a('0x24')](respondWithResult(_0x4235b4,null))['catch'](handleError(_0x4235b4,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 6b0d01f..33580e2 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(_0x12c926,_0x158d01){var _0x14ba0f=function(_0x39fb1f){while(--_0x39fb1f){_0x12c926['push'](_0x12c926['shift']());}};_0x14ba0f(++_0x158d01);}(_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 +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x18f003,_0x188d96){var _0x11aa0b=function(_0x384730){while(--_0x384730){_0x18f003['push'](_0x18f003['shift']());}};_0x11aa0b(++_0x188d96);}(_0x7a54,0x106));var _0x47a5=function(_0x3289b1,_0x57b9a4){_0x3289b1=_0x3289b1-0x0;var _0xfb2402=_0x7a54[_0x3289b1];return _0xfb2402;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index e6196be..0c10749 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 _0x9f73=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0xc0160b,_0xa0101){var _0x14b443=function(_0x6dcdcd){while(--_0x6dcdcd){_0xc0160b['push'](_0xc0160b['shift']());}};_0x14b443(++_0xa0101);}(_0x9f73,0x133));var _0x39f7=function(_0x26dcb7,_0x3146ec){_0x26dcb7=_0x26dcb7-0x0;var _0x142d93=_0x9f73[_0x26dcb7];return _0x142d93;};'use strict';var _=require(_0x39f7('0x0'));var util=require(_0x39f7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x39f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39f7('0x3'))['db'];var utils=require(_0x39f7('0x4'));var logger=require(_0x39f7('0x5'))(_0x39f7('0x6'));var config=require(_0x39f7('0x7'));var jayson=require(_0x39f7('0x8'));var client=jayson['client'][_0x39f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13fceb,_0x246857,_0x27e649){return new BPromise(function(_0x22178c,_0x5950b1){return client[_0x39f7('0xa')](_0x13fceb,_0x27e649)[_0x39f7('0xb')](function(_0x5e0a80){logger[_0x39f7('0xc')]('Cdr,\x20%s,\x20%s',_0x246857,_0x39f7('0xd'));logger[_0x39f7('0xe')](_0x39f7('0xf'),_0x246857,_0x39f7('0xd'),JSON[_0x39f7('0x10')](_0x5e0a80));if(_0x5e0a80[_0x39f7('0x11')]){if(_0x5e0a80[_0x39f7('0x11')][_0x39f7('0x12')]===0x1f4){logger[_0x39f7('0x11')]('Cdr,\x20%s,\x20%s',_0x246857,_0x5e0a80[_0x39f7('0x11')][_0x39f7('0x13')]);return _0x5950b1(_0x5e0a80[_0x39f7('0x11')][_0x39f7('0x13')]);}logger[_0x39f7('0x11')](_0x39f7('0x14'),_0x246857,_0x5e0a80[_0x39f7('0x11')]['message']);return _0x22178c(_0x5e0a80[_0x39f7('0x11')]['message']);}else{logger['info'](_0x39f7('0x14'),_0x246857,'request\x20sent');_0x22178c(_0x5e0a80[_0x39f7('0x15')][_0x39f7('0x13')]);}})[_0x39f7('0x16')](function(_0x2dd987){logger[_0x39f7('0x11')](_0x39f7('0x14'),_0x246857,_0x2dd987);_0x5950b1(_0x2dd987);});});} \ No newline at end of file +var _0x6f67=['stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x6f67,0x8b));var _0x76f6=function(_0x13a6d8,_0x6189c){_0x13a6d8=_0x13a6d8-0x0;var _0x176743=_0x6f67[_0x13a6d8];return _0x176743;};'use strict';var _=require('lodash');var util=require(_0x76f6('0x0'));var moment=require(_0x76f6('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f6('0x2'));var fs=require('fs');var Redis=require(_0x76f6('0x3'));var db=require(_0x76f6('0x4'))['db'];var utils=require(_0x76f6('0x5'));var logger=require(_0x76f6('0x6'))(_0x76f6('0x7'));var config=require('../../config/environment');var jayson=require(_0x76f6('0x8'));var client=jayson['client'][_0x76f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a6b87,_0x193d49,_0x23a047){return new BPromise(function(_0x1bb7e0,_0x3e787e){return client[_0x76f6('0xa')](_0x2a6b87,_0x23a047)[_0x76f6('0xb')](function(_0x531936){logger[_0x76f6('0xc')]('Cdr,\x20%s,\x20%s',_0x193d49,_0x76f6('0xd'));logger[_0x76f6('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x193d49,_0x76f6('0xd'),JSON[_0x76f6('0xf')](_0x531936));if(_0x531936[_0x76f6('0x10')]){if(_0x531936[_0x76f6('0x10')][_0x76f6('0x11')]===0x1f4){logger[_0x76f6('0x10')](_0x76f6('0x12'),_0x193d49,_0x531936[_0x76f6('0x10')][_0x76f6('0x13')]);return _0x3e787e(_0x531936[_0x76f6('0x10')][_0x76f6('0x13')]);}logger['error'](_0x76f6('0x12'),_0x193d49,_0x531936[_0x76f6('0x10')][_0x76f6('0x13')]);return _0x1bb7e0(_0x531936['error']['message']);}else{logger['info'](_0x76f6('0x12'),_0x193d49,_0x76f6('0xd'));_0x1bb7e0(_0x531936[_0x76f6('0x14')][_0x76f6('0x13')]);}})[_0x76f6('0x15')](function(_0x2cf4bd){logger[_0x76f6('0x10')](_0x76f6('0x12'),_0x193d49,_0x2cf4bd);_0x3e787e(_0x2cf4bd);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 26a1d61..415e96d 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c7e1d53..8ac6705 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 _0x1038=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x51c1c0,_0x1ec641){var _0x3c183f=function(_0x43b0f8){while(--_0x43b0f8){_0x51c1c0['push'](_0x51c1c0['shift']());}};_0x3c183f(++_0x1ec641);}(_0x1038,0x1b3));var _0x8103=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x1038[_0x358806];return _0x19fdcb;};'use strict';var Sequelize=require(_0x8103('0x0'));module[_0x8103('0x1')]={'priority':{'type':Sequelize[_0x8103('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8103('0x3')],'allowNull':![],'defaultValue':_0x8103('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8103('0x3')],'defaultValue':_0x8103('0x5')}}; \ No newline at end of file +var _0x8f25=['STRING','*,*,*,*','sequelize','INTEGER','TEXT'];(function(_0x267922,_0x47d81c){var _0x47310a=function(_0x41d8df){while(--_0x41d8df){_0x267922['push'](_0x267922['shift']());}};_0x47310a(++_0x47d81c);}(_0x8f25,0x1c4));var _0x58f2=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x8f25[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x58f2('0x0'));module['exports']={'priority':{'type':Sequelize[_0x58f2('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x58f2('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x58f2('0x3')],'defaultValue':_0x58f2('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 3332f3d..68213ea 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 _0xd624=['rawAttributes','keys','query','filters','intersection','attributes','fields','ChatApplication','find','catch','body','params','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','show','model'];(function(_0x2173da,_0x51ab69){var _0x5e808c=function(_0x5a2a3e){while(--_0x5a2a3e){_0x2173da['push'](_0x2173da['shift']());}};_0x5e808c(++_0x51ab69);}(_0xd624,0x124));var _0x4d62=function(_0x40823e,_0x3d7ee6){_0x40823e=_0x40823e-0x0;var _0x4ab878=_0xd624[_0x40823e];return _0x4ab878;};'use strict';var emlformat=require(_0x4d62('0x0'));var rimraf=require(_0x4d62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d62('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4d62('0x3'));var util=require(_0x4d62('0x4'));var path=require(_0x4d62('0x5'));var sox=require(_0x4d62('0x6'));var csv=require(_0x4d62('0x7'));var ejs=require(_0x4d62('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d62('0x9'));var crypto=require(_0x4d62('0xa'));var jsforce=require(_0x4d62('0xb'));var deskjs=require(_0x4d62('0xc'));var toCsv=require(_0x4d62('0x7'));var querystring=require('querystring');var Papa=require(_0x4d62('0xd'));var Redis=require(_0x4d62('0xe'));var authService=require(_0x4d62('0xf'));var qs=require(_0x4d62('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d62('0x11'));var logger=require(_0x4d62('0x12'))(_0x4d62('0x13'));var utils=require(_0x4d62('0x14'));var config=require(_0x4d62('0x15'));var licenseUtil=require(_0x4d62('0x16'));var db=require(_0x4d62('0x17'))['db'];function respondWithStatusCode(_0xc94193,_0x3d30a7){_0x3d30a7=_0x3d30a7||0xcc;return function(_0x282d79){if(_0x282d79){return _0xc94193[_0x4d62('0x18')](_0x3d30a7);}return _0xc94193[_0x4d62('0x19')](_0x3d30a7)['end']();};}function respondWithResult(_0x117c68,_0x409910){_0x409910=_0x409910||0xc8;return function(_0x1c6768){if(_0x1c6768){return _0x117c68['status'](_0x409910)[_0x4d62('0x1a')](_0x1c6768);}};}function respondWithFilteredResult(_0x1f3b54,_0x142396){return function(_0x5e2cee){if(_0x5e2cee){var _0x4974f4=typeof _0x142396[_0x4d62('0x1b')]===_0x4d62('0x1c')&&typeof _0x142396['limit']==='undefined';var _0x2e8602=_0x5e2cee[_0x4d62('0x1d')];var _0x54920b=_0x4974f4?0x0:_0x142396[_0x4d62('0x1b')];var _0x27ca77=_0x4974f4?_0x5e2cee[_0x4d62('0x1d')]:_0x142396[_0x4d62('0x1b')]+_0x142396[_0x4d62('0x1e')];var _0x45f78f;if(_0x27ca77>=_0x2e8602){_0x27ca77=_0x2e8602;_0x45f78f=0xc8;}else{_0x45f78f=0xce;}_0x1f3b54[_0x4d62('0x19')](_0x45f78f);return _0x1f3b54[_0x4d62('0x1f')](_0x4d62('0x20'),_0x54920b+'-'+_0x27ca77+'/'+_0x2e8602)[_0x4d62('0x1a')](_0x5e2cee);}return null;};}function patchUpdates(_0x494a8f){return function(_0x5d9e64){try{jsonpatch['apply'](_0x5d9e64,_0x494a8f,!![]);}catch(_0x435035){return BPromise[_0x4d62('0x21')](_0x435035);}return _0x5d9e64[_0x4d62('0x22')]();};}function saveUpdates(_0x5a0796,_0x3a5e4f){return function(_0x16fa3a){if(_0x16fa3a){return _0x16fa3a[_0x4d62('0x23')](_0x5a0796)['then'](function(_0x26c5e3){return _0x26c5e3;});}return null;};}function removeEntity(_0x30c443,_0x1a7ee9){return function(_0x57987b){if(_0x57987b){return _0x57987b[_0x4d62('0x24')]()[_0x4d62('0x25')](function(){_0x30c443['status'](0xcc)[_0x4d62('0x26')]();});}};}function handleEntityNotFound(_0x3b4eee,_0x2a09f9){return function(_0x414a9e){if(!_0x414a9e){_0x3b4eee[_0x4d62('0x18')](0x194);}return _0x414a9e;};}function handleError(_0x4e88cc,_0x5635a9){_0x5635a9=_0x5635a9||0x1f4;return function(_0x40c9c8){logger[_0x4d62('0x27')](_0x40c9c8[_0x4d62('0x28')]);if(_0x40c9c8[_0x4d62('0x29')]){delete _0x40c9c8['name'];}_0x4e88cc['status'](_0x5635a9)['send'](_0x40c9c8);};}exports[_0x4d62('0x2a')]=function(_0x566cce,_0x1b1f0c){var _0x2b76af={'raw':!![],'where':{'id':_0x566cce['params']['id']}},_0x132181={};_0x132181[_0x4d62('0x2b')]=_['keys'](db['ChatApplication'][_0x4d62('0x2c')]);_0x132181['query']=_[_0x4d62('0x2d')](_0x566cce[_0x4d62('0x2e')]);_0x132181[_0x4d62('0x2f')]=_[_0x4d62('0x30')](_0x132181[_0x4d62('0x2b')],_0x132181[_0x4d62('0x2e')]);_0x2b76af[_0x4d62('0x31')]=_[_0x4d62('0x30')](_0x132181['model'],qs[_0x4d62('0x32')](_0x566cce[_0x4d62('0x2e')][_0x4d62('0x32')]));_0x2b76af['attributes']=_0x2b76af[_0x4d62('0x31')]['length']?_0x2b76af['attributes']:_0x132181['model'];if(_0x566cce[_0x4d62('0x2e')]['includeAll']){_0x2b76af['include']=[{'all':!![]}];}_0x2b76af=_['merge']({},_0x2b76af,_0x566cce['options']);return db[_0x4d62('0x33')][_0x4d62('0x34')](_0x2b76af)[_0x4d62('0x25')](handleEntityNotFound(_0x1b1f0c,null))[_0x4d62('0x25')](respondWithResult(_0x1b1f0c,null))[_0x4d62('0x35')](handleError(_0x1b1f0c,null));};exports[_0x4d62('0x23')]=function(_0x4643bc,_0x2855ca){if(_0x4643bc[_0x4d62('0x36')]['id']){delete _0x4643bc['body']['id'];}return db[_0x4d62('0x33')]['find']({'where':{'id':_0x4643bc['params']['id']}})['then'](handleEntityNotFound(_0x2855ca,null))[_0x4d62('0x25')](saveUpdates(_0x4643bc[_0x4d62('0x36')],null))[_0x4d62('0x25')](respondWithResult(_0x2855ca,null))[_0x4d62('0x35')](handleError(_0x2855ca,null));};exports[_0x4d62('0x24')]=function(_0x2cc381,_0x522d9b){return db[_0x4d62('0x33')]['find']({'where':{'id':_0x2cc381[_0x4d62('0x37')]['id']}})[_0x4d62('0x25')](handleEntityNotFound(_0x522d9b,null))[_0x4d62('0x25')](removeEntity(_0x522d9b,null))[_0x4d62('0x35')](handleError(_0x522d9b,null));}; \ No newline at end of file +var _0x7070=['catch','update','body','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','set','json','save','then','destroy','error','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','model','fields','length','include','merge','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7070,0x1d7));var _0x0707=function(_0x532e1b,_0x23d37a){_0x532e1b=_0x532e1b-0x0;var _0x44bdf0=_0x7070[_0x532e1b];return _0x44bdf0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0707('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0707('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0707('0x2'));var Mustache=require(_0x0707('0x3'));var util=require(_0x0707('0x4'));var path=require(_0x0707('0x5'));var sox=require('sox');var csv=require(_0x0707('0x6'));var ejs=require(_0x0707('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0707('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0707('0x9'));var toCsv=require(_0x0707('0x6'));var querystring=require(_0x0707('0xa'));var Papa=require(_0x0707('0xb'));var Redis=require(_0x0707('0xc'));var authService=require(_0x0707('0xd'));var qs=require(_0x0707('0xe'));var as=require(_0x0707('0xf'));var hardwareService=require(_0x0707('0x10'));var logger=require(_0x0707('0x11'))('api');var utils=require(_0x0707('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0707('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b55c6,_0x2bd4d8){_0x2bd4d8=_0x2bd4d8||0xcc;return function(_0x3eeea8){if(_0x3eeea8){return _0x3b55c6[_0x0707('0x14')](_0x2bd4d8);}return _0x3b55c6[_0x0707('0x15')](_0x2bd4d8)[_0x0707('0x16')]();};}function respondWithResult(_0x3b0f64,_0x111fd7){_0x111fd7=_0x111fd7||0xc8;return function(_0x380abc){if(_0x380abc){return _0x3b0f64[_0x0707('0x15')](_0x111fd7)['json'](_0x380abc);}};}function respondWithFilteredResult(_0x5bae3d,_0x3fce78){return function(_0x429da2){if(_0x429da2){var _0x1370b3=typeof _0x3fce78[_0x0707('0x17')]==='undefined'&&typeof _0x3fce78[_0x0707('0x18')]===_0x0707('0x19');var _0xe1cf0e=_0x429da2['count'];var _0x13d5de=_0x1370b3?0x0:_0x3fce78['offset'];var _0x471431=_0x1370b3?_0x429da2['count']:_0x3fce78[_0x0707('0x17')]+_0x3fce78[_0x0707('0x18')];var _0x1debb9;if(_0x471431>=_0xe1cf0e){_0x471431=_0xe1cf0e;_0x1debb9=0xc8;}else{_0x1debb9=0xce;}_0x5bae3d[_0x0707('0x15')](_0x1debb9);return _0x5bae3d[_0x0707('0x1a')]('Content-Range',_0x13d5de+'-'+_0x471431+'/'+_0xe1cf0e)[_0x0707('0x1b')](_0x429da2);}return null;};}function patchUpdates(_0x360caf){return function(_0x37d1fd){try{jsonpatch['apply'](_0x37d1fd,_0x360caf,!![]);}catch(_0x5c8731){return BPromise['reject'](_0x5c8731);}return _0x37d1fd[_0x0707('0x1c')]();};}function saveUpdates(_0x3f31e1,_0x1d133c){return function(_0x51dec4){if(_0x51dec4){return _0x51dec4['update'](_0x3f31e1)[_0x0707('0x1d')](function(_0x225a58){return _0x225a58;});}return null;};}function removeEntity(_0x370554,_0x3e9c41){return function(_0x3ba507){if(_0x3ba507){return _0x3ba507[_0x0707('0x1e')]()[_0x0707('0x1d')](function(){_0x370554[_0x0707('0x15')](0xcc)[_0x0707('0x16')]();});}};}function handleEntityNotFound(_0x3dc5fb,_0x392acd){return function(_0x373bca){if(!_0x373bca){_0x3dc5fb['sendStatus'](0x194);}return _0x373bca;};}function handleError(_0x14d68b,_0x1834e0){_0x1834e0=_0x1834e0||0x1f4;return function(_0x3be832){logger[_0x0707('0x1f')](_0x3be832['stack']);if(_0x3be832[_0x0707('0x20')]){delete _0x3be832[_0x0707('0x20')];}_0x14d68b[_0x0707('0x15')](_0x1834e0)[_0x0707('0x21')](_0x3be832);};}exports[_0x0707('0x22')]=function(_0x599090,_0x1a4f0b){var _0x3378a5={'raw':!![],'where':{'id':_0x599090[_0x0707('0x23')]['id']}},_0x2f0ed2={};_0x2f0ed2['model']=_[_0x0707('0x24')](db[_0x0707('0x25')][_0x0707('0x26')]);_0x2f0ed2[_0x0707('0x27')]=_[_0x0707('0x24')](_0x599090[_0x0707('0x27')]);_0x2f0ed2[_0x0707('0x28')]=_['intersection'](_0x2f0ed2['model'],_0x2f0ed2[_0x0707('0x27')]);_0x3378a5[_0x0707('0x29')]=_[_0x0707('0x2a')](_0x2f0ed2[_0x0707('0x2b')],qs['fields'](_0x599090[_0x0707('0x27')][_0x0707('0x2c')]));_0x3378a5['attributes']=_0x3378a5[_0x0707('0x29')][_0x0707('0x2d')]?_0x3378a5['attributes']:_0x2f0ed2[_0x0707('0x2b')];if(_0x599090[_0x0707('0x27')]['includeAll']){_0x3378a5[_0x0707('0x2e')]=[{'all':!![]}];}_0x3378a5=_[_0x0707('0x2f')]({},_0x3378a5,_0x599090['options']);return db[_0x0707('0x25')][_0x0707('0x30')](_0x3378a5)[_0x0707('0x1d')](handleEntityNotFound(_0x1a4f0b,null))[_0x0707('0x1d')](respondWithResult(_0x1a4f0b,null))[_0x0707('0x31')](handleError(_0x1a4f0b,null));};exports[_0x0707('0x32')]=function(_0x19c84,_0x5e5b1a){if(_0x19c84[_0x0707('0x33')]['id']){delete _0x19c84[_0x0707('0x33')]['id'];}return db[_0x0707('0x25')]['find']({'where':{'id':_0x19c84[_0x0707('0x23')]['id']}})[_0x0707('0x1d')](handleEntityNotFound(_0x5e5b1a,null))['then'](saveUpdates(_0x19c84[_0x0707('0x33')],null))[_0x0707('0x1d')](respondWithResult(_0x5e5b1a,null))[_0x0707('0x31')](handleError(_0x5e5b1a,null));};exports['destroy']=function(_0x362d24,_0x4d093c){return db[_0x0707('0x25')][_0x0707('0x30')]({'where':{'id':_0x362d24[_0x0707('0x23')]['id']}})[_0x0707('0x1d')](handleEntityNotFound(_0x4d093c,null))[_0x0707('0x1d')](removeEntity(_0x4d093c,null))[_0x0707('0x31')](handleError(_0x4d093c,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index eed0d6a..18c1a30 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 _0x20e7=['util','api','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','lodash'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x20e7,0x178));var _0x720e=function(_0x3ce44a,_0x216712){_0x3ce44a=_0x3ce44a-0x0;var _0x1906ff=_0x20e7[_0x3ce44a];return _0x1906ff;};'use strict';var _=require(_0x720e('0x0'));var util=require(_0x720e('0x1'));var logger=require('../../config/logger')(_0x720e('0x2'));var moment=require(_0x720e('0x3'));var BPromise=require('bluebird');var rp=require(_0x720e('0x4'));var fs=require('fs');var path=require(_0x720e('0x5'));var rimraf=require(_0x720e('0x6'));var config=require(_0x720e('0x7'));var attributes=require(_0x720e('0x8'));module['exports']=function(_0x14ff38,_0x2b2c47){return _0x14ff38[_0x720e('0x9')](_0x720e('0xa'),attributes,{'tableName':_0x720e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x720e('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x56ce=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0x56ce,0x1e9));var _0xe56c=function(_0x46f6f9,_0x110dba){_0x46f6f9=_0x46f6f9-0x0;var _0x432f94=_0x56ce[_0x46f6f9];return _0x432f94;};'use strict';var _=require(_0xe56c('0x0'));var util=require('util');var logger=require(_0xe56c('0x1'))(_0xe56c('0x2'));var moment=require(_0xe56c('0x3'));var BPromise=require(_0xe56c('0x4'));var rp=require(_0xe56c('0x5'));var fs=require('fs');var path=require(_0xe56c('0x6'));var rimraf=require(_0xe56c('0x7'));var config=require(_0xe56c('0x8'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x253482,_0x53aaf5){return _0x253482[_0xe56c('0x9')](_0xe56c('0xa'),attributes,{'tableName':_0xe56c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe56c('0xc'),'collate':_0xe56c('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 607b12b..8b5bff2 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 _0x8359=['rpc','../../config/environment','jayson/promise','client','http','request','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x1c30bf,_0x247c31){var _0x255b5e=function(_0x70c22b){while(--_0x70c22b){_0x1c30bf['push'](_0x1c30bf['shift']());}};_0x255b5e(++_0x247c31);}(_0x8359,0x19f));var _0x9835=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x8359[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0x9835('0x0'));var util=require('util');var moment=require(_0x9835('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9835('0x2'));var db=require(_0x9835('0x3'))['db'];var utils=require(_0x9835('0x4'));var logger=require('../../config/logger')(_0x9835('0x5'));var config=require(_0x9835('0x6'));var jayson=require(_0x9835('0x7'));var client=jayson[_0x9835('0x8')][_0x9835('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x211029,_0x5cdb7e,_0x1bad9f){return new BPromise(function(_0x5ba23c,_0x1fc42a){return client[_0x9835('0xa')](_0x211029,_0x1bad9f)['then'](function(_0xe4576d){logger['info'](_0x9835('0xb'),_0x5cdb7e,'request\x20sent');logger[_0x9835('0xc')](_0x9835('0xd'),_0x5cdb7e,_0x9835('0xe'),JSON[_0x9835('0xf')](_0xe4576d));if(_0xe4576d[_0x9835('0x10')]){if(_0xe4576d[_0x9835('0x10')]['code']===0x1f4){logger[_0x9835('0x10')](_0x9835('0xb'),_0x5cdb7e,_0xe4576d[_0x9835('0x10')][_0x9835('0x11')]);return _0x1fc42a(_0xe4576d[_0x9835('0x10')][_0x9835('0x11')]);}logger[_0x9835('0x10')](_0x9835('0xb'),_0x5cdb7e,_0xe4576d[_0x9835('0x10')]['message']);return _0x5ba23c(_0xe4576d['error'][_0x9835('0x11')]);}else{logger['info'](_0x9835('0xb'),_0x5cdb7e,_0x9835('0xe'));_0x5ba23c(_0xe4576d[_0x9835('0x12')][_0x9835('0x11')]);}})[_0x9835('0x13')](function(_0x2c0da5){logger[_0x9835('0x10')](_0x9835('0xb'),_0x5cdb7e,_0x2c0da5);_0x1fc42a(_0x2c0da5);});});} \ No newline at end of file +var _0x5dc5=['../../config/environment','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dc5,0x80));var _0x55dc=function(_0x269521,_0x40f520){_0x269521=_0x269521-0x0;var _0x4d57a2=_0x5dc5[_0x269521];return _0x4d57a2;};'use strict';var _=require(_0x55dc('0x0'));var util=require(_0x55dc('0x1'));var moment=require(_0x55dc('0x2'));var BPromise=require(_0x55dc('0x3'));var rs=require(_0x55dc('0x4'));var fs=require('fs');var Redis=require(_0x55dc('0x5'));var db=require(_0x55dc('0x6'))['db'];var utils=require(_0x55dc('0x7'));var logger=require(_0x55dc('0x8'))(_0x55dc('0x9'));var config=require(_0x55dc('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d9432,_0x4bbc26,_0x48a926){return new BPromise(function(_0x1bbea2,_0x1351a5){return client[_0x55dc('0xc')](_0x4d9432,_0x48a926)[_0x55dc('0xd')](function(_0x4cccc4){logger[_0x55dc('0xe')](_0x55dc('0xf'),_0x4bbc26,_0x55dc('0x10'));logger[_0x55dc('0x11')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4bbc26,'request\x20sent',JSON['stringify'](_0x4cccc4));if(_0x4cccc4[_0x55dc('0x12')]){if(_0x4cccc4['error'][_0x55dc('0x13')]===0x1f4){logger[_0x55dc('0x12')](_0x55dc('0xf'),_0x4bbc26,_0x4cccc4[_0x55dc('0x12')][_0x55dc('0x14')]);return _0x1351a5(_0x4cccc4[_0x55dc('0x12')]['message']);}logger[_0x55dc('0x12')](_0x55dc('0xf'),_0x4bbc26,_0x4cccc4[_0x55dc('0x12')][_0x55dc('0x14')]);return _0x1bbea2(_0x4cccc4[_0x55dc('0x12')]['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x4bbc26,_0x55dc('0x10'));_0x1bbea2(_0x4cccc4[_0x55dc('0x15')]['message']);}})[_0x55dc('0x16')](function(_0x328d3e){logger[_0x55dc('0x12')](_0x55dc('0xf'),_0x4bbc26,_0x328d3e);_0x1351a5(_0x328d3e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d61c57c..59f7dc9 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 _0x1194=['show','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x2b24e2,_0x51d6d0){var _0xe60178=function(_0x42a121){while(--_0x42a121){_0x2b24e2['push'](_0x2b24e2['shift']());}};_0xe60178(++_0x51d6d0);}(_0x1194,0x15d));var _0x4119=function(_0x53c33c,_0x27223d){_0x53c33c=_0x53c33c-0x0;var _0x277750=_0x1194[_0x53c33c];return _0x277750;};'use strict';var multer=require(_0x4119('0x0'));var util=require('util');var path=require(_0x4119('0x1'));var timeout=require('connect-timeout');var express=require(_0x4119('0x2'));var router=express[_0x4119('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4119('0x4'));var interaction=require(_0x4119('0x5'));var config=require(_0x4119('0x6'));var controller=require(_0x4119('0x7'));router[_0x4119('0x8')](_0x4119('0x9'),auth[_0x4119('0xa')](),controller[_0x4119('0xb')]);router['put'](_0x4119('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4119('0xc')]('/:id',auth[_0x4119('0xa')](),controller[_0x4119('0xd')]);module[_0x4119('0xe')]=router; \ No newline at end of file +var _0x351b=['exports','multer','path','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','update','destroy'];(function(_0x1c7f48,_0x255687){var _0x274c31=function(_0x58e252){while(--_0x58e252){_0x1c7f48['push'](_0x1c7f48['shift']());}};_0x274c31(++_0x255687);}(_0x351b,0x198));var _0xb351=function(_0x32829c,_0x2768c6){_0x32829c=_0x32829c-0x0;var _0x2114d7=_0x351b[_0x32829c];return _0x2114d7;};'use strict';var multer=require(_0xb351('0x0'));var util=require('util');var path=require(_0xb351('0x1'));var timeout=require('connect-timeout');var express=require(_0xb351('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb351('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb351('0x4'));var controller=require('./chatApplication.controller');router[_0xb351('0x5')](_0xb351('0x6'),auth[_0xb351('0x7')](),controller['show']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb351('0x8')]);router['delete'](_0xb351('0x6'),auth[_0xb351('0x7')](),controller[_0xb351('0x9')]);module[_0xb351('0xa')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index cb3f5f0..a5fad33 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 _0xad68=['STRING'];(function(_0x5eeed2,_0x44fb82){var _0x1b958b=function(_0x4d9221){while(--_0x4d9221){_0x5eeed2['push'](_0x5eeed2['shift']());}};_0x1b958b(++_0x44fb82);}(_0xad68,0x100));var _0x8ad6=function(_0x5c12ae,_0x29ab56){_0x5c12ae=_0x5c12ae-0x0;var _0x6b60d1=_0xad68[_0x5c12ae];return _0x6b60d1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8ad6('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x8ad6('0x0')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9d76=['BOOLEAN','sequelize','STRING'];(function(_0x50d0a5,_0x3ece14){var _0x16a49c=function(_0x5857fb){while(--_0x5857fb){_0x50d0a5['push'](_0x50d0a5['shift']());}};_0x16a49c(++_0x3ece14);}(_0x9d76,0x76));var _0x69d7=function(_0x4f3376,_0x857693){_0x4f3376=_0x4f3376-0x0;var _0x5c6414=_0x9d76[_0x4f3376];return _0x5c6414;};'use strict';var Sequelize=require(_0x69d7('0x0'));module['exports']={'name':{'type':Sequelize[_0x69d7('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x69d7('0x1')]},'write':{'type':Sequelize[_0x69d7('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 1d0c169..3e16640 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 _0x15da=['model','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','getUnread','toInteger','ids','omit','getMembers','findOne','User','pick','removeMembers','ChatGroupId','getMessages','ChatInternalMessage','$gte','format','hasOwnProperty','eml-format','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','api','../../config/license/util','redis','localhost','./chatGroup.socket','register','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatGroup','fieldName','type','key','map','query','keys','filters','intersection','attributes'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0x15da,0x188));var _0xa15d=function(_0x12f9e3,_0x3fadc1){_0x12f9e3=_0x12f9e3-0x0;var _0x2de0c8=_0x15da[_0x12f9e3];return _0x2de0c8;};'use strict';var emlformat=require(_0xa15d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa15d('0x1'));var moment=require(_0xa15d('0x2'));var BPromise=require(_0xa15d('0x3'));var Mustache=require(_0xa15d('0x4'));var util=require(_0xa15d('0x5'));var path=require(_0xa15d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa15d('0x7'));var _=require('lodash');var squel=require(_0xa15d('0x8'));var crypto=require(_0xa15d('0x9'));var jsforce=require(_0xa15d('0xa'));var deskjs=require(_0xa15d('0xb'));var toCsv=require(_0xa15d('0xc'));var querystring=require(_0xa15d('0xd'));var Papa=require('papaparse');var Redis=require(_0xa15d('0xe'));var authService=require(_0xa15d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa15d('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa15d('0x11'));var db=require('../../mysqldb')['db'];config[_0xa15d('0x12')]=_['defaults'](config['redis'],{'host':_0xa15d('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa15d('0x12')]));require(_0xa15d('0x14'))[_0xa15d('0x15')](socket);function respondWithStatusCode(_0x17f2b5,_0x1c7441){_0x1c7441=_0x1c7441||0xcc;return function(_0x4f6b8b){if(_0x4f6b8b){return _0x17f2b5[_0xa15d('0x16')](_0x1c7441);}return _0x17f2b5['status'](_0x1c7441)[_0xa15d('0x17')]();};}function respondWithResult(_0x226305,_0x141683){_0x141683=_0x141683||0xc8;return function(_0x6a4655){if(_0x6a4655){return _0x226305[_0xa15d('0x18')](_0x141683)['json'](_0x6a4655);}};}function respondWithFilteredResult(_0x22e36a,_0x40b216){return function(_0x566766){if(_0x566766){var _0x5296bd=typeof _0x40b216['offset']===_0xa15d('0x19')&&typeof _0x40b216['limit']===_0xa15d('0x19');var _0x531f48=_0x566766[_0xa15d('0x1a')];var _0xa0f17d=_0x5296bd?0x0:_0x40b216['offset'];var _0x1c0db9=_0x5296bd?_0x566766['count']:_0x40b216[_0xa15d('0x1b')]+_0x40b216[_0xa15d('0x1c')];var _0x46a368;if(_0x1c0db9>=_0x531f48){_0x1c0db9=_0x531f48;_0x46a368=0xc8;}else{_0x46a368=0xce;}_0x22e36a[_0xa15d('0x18')](_0x46a368);return _0x22e36a[_0xa15d('0x1d')](_0xa15d('0x1e'),_0xa0f17d+'-'+_0x1c0db9+'/'+_0x531f48)[_0xa15d('0x1f')](_0x566766);}return null;};}function patchUpdates(_0xbd7783){return function(_0x36c72d){try{jsonpatch[_0xa15d('0x20')](_0x36c72d,_0xbd7783,!![]);}catch(_0x28fc0f){return BPromise[_0xa15d('0x21')](_0x28fc0f);}return _0x36c72d[_0xa15d('0x22')]();};}function saveUpdates(_0x2a521a,_0xcc7310){return function(_0x83d94e){if(_0x83d94e){return _0x83d94e[_0xa15d('0x23')](_0x2a521a)[_0xa15d('0x24')](function(_0x1fbbe8){return _0x1fbbe8;});}return null;};}function removeEntity(_0x4a2131,_0x4dff68){return function(_0x2b604e){if(_0x2b604e){return _0x2b604e[_0xa15d('0x25')]()[_0xa15d('0x24')](function(){_0x4a2131[_0xa15d('0x18')](0xcc)[_0xa15d('0x17')]();});}};}function handleEntityNotFound(_0x536d9a,_0x5da9ae){return function(_0x453be7){if(!_0x453be7){_0x536d9a[_0xa15d('0x16')](0x194);}return _0x453be7;};}function handleError(_0x119b51,_0x38b532){_0x38b532=_0x38b532||0x1f4;return function(_0x20edc6){logger[_0xa15d('0x26')](_0x20edc6[_0xa15d('0x27')]);if(_0x20edc6[_0xa15d('0x28')]){delete _0x20edc6[_0xa15d('0x28')];}_0x119b51['status'](_0x38b532)[_0xa15d('0x29')](_0x20edc6);};}exports[_0xa15d('0x2a')]=function(_0x8da602,_0x30a2d9){var _0x20d499={},_0x555f92={},_0x1049e4={'count':0x0,'rows':[]};var _0x38ed60=_['map'](db[_0xa15d('0x2b')]['rawAttributes'],function(_0x56b529){return{'name':_0x56b529[_0xa15d('0x2c')],'type':_0x56b529[_0xa15d('0x2d')][_0xa15d('0x2e')]};});_0x555f92['model']=_[_0xa15d('0x2f')](_0x38ed60,_0xa15d('0x28'));_0x555f92[_0xa15d('0x30')]=_[_0xa15d('0x31')](_0x8da602[_0xa15d('0x30')]);_0x555f92[_0xa15d('0x32')]=_[_0xa15d('0x33')](_0x555f92['model'],_0x555f92['query']);_0x20d499[_0xa15d('0x34')]=_[_0xa15d('0x33')](_0x555f92[_0xa15d('0x35')],qs[_0xa15d('0x36')](_0x8da602['query']['fields']));_0x20d499['attributes']=_0x20d499[_0xa15d('0x34')]['length']?_0x20d499[_0xa15d('0x34')]:_0x555f92[_0xa15d('0x35')];if(!_0x8da602[_0xa15d('0x30')]['hasOwnProperty'](_0xa15d('0x37'))){_0x20d499[_0xa15d('0x1c')]=qs[_0xa15d('0x1c')](_0x8da602[_0xa15d('0x30')][_0xa15d('0x1c')]);_0x20d499[_0xa15d('0x1b')]=qs[_0xa15d('0x1b')](_0x8da602['query'][_0xa15d('0x1b')]);}_0x20d499[_0xa15d('0x38')]=qs[_0xa15d('0x39')](_0x8da602[_0xa15d('0x30')]['sort']);_0x20d499[_0xa15d('0x3a')]=qs[_0xa15d('0x32')](_['pick'](_0x8da602[_0xa15d('0x30')],_0x555f92[_0xa15d('0x32')]),_0x38ed60);if(_0x8da602[_0xa15d('0x30')][_0xa15d('0x3b')]){_0x20d499[_0xa15d('0x3a')]=_[_0xa15d('0x3c')](_0x20d499[_0xa15d('0x3a')],{'$or':_[_0xa15d('0x2f')](_0x38ed60,function(_0x5c3686){if(_0x5c3686[_0xa15d('0x2d')]!==_0xa15d('0x3d')){var _0x5a6671={};_0x5a6671[_0x5c3686[_0xa15d('0x28')]]={'$like':'%'+_0x8da602[_0xa15d('0x30')][_0xa15d('0x3b')]+'%'};return _0x5a6671;}})});}_0x20d499=_['merge']({},_0x20d499,_0x8da602[_0xa15d('0x3e')]);var _0x4bd56c={'where':_0x20d499[_0xa15d('0x3a')]};return db[_0xa15d('0x2b')][_0xa15d('0x1a')](_0x4bd56c)[_0xa15d('0x24')](function(_0x4b3956){_0x1049e4[_0xa15d('0x1a')]=_0x4b3956;if(_0x8da602[_0xa15d('0x30')]['includeAll']){_0x20d499[_0xa15d('0x3f')]=[{'all':!![]}];}return db[_0xa15d('0x2b')]['findAll'](_0x20d499);})[_0xa15d('0x24')](function(_0x9cf75){_0x1049e4['rows']=_0x9cf75;return _0x1049e4;})[_0xa15d('0x24')](respondWithFilteredResult(_0x30a2d9,_0x20d499))[_0xa15d('0x40')](handleError(_0x30a2d9,null));};exports[_0xa15d('0x41')]=function(_0x3e3575,_0x116586){var _0x41b4d1={'raw':!![],'where':{'id':_0x3e3575[_0xa15d('0x42')]['id']}},_0x7ab180={};_0x7ab180[_0xa15d('0x35')]=_[_0xa15d('0x31')](db[_0xa15d('0x2b')][_0xa15d('0x43')]);_0x7ab180[_0xa15d('0x30')]=_['keys'](_0x3e3575['query']);_0x7ab180[_0xa15d('0x32')]=_[_0xa15d('0x33')](_0x7ab180[_0xa15d('0x35')],_0x7ab180[_0xa15d('0x30')]);_0x41b4d1[_0xa15d('0x34')]=_[_0xa15d('0x33')](_0x7ab180[_0xa15d('0x35')],qs['fields'](_0x3e3575[_0xa15d('0x30')][_0xa15d('0x36')]));_0x41b4d1[_0xa15d('0x34')]=_0x41b4d1[_0xa15d('0x34')][_0xa15d('0x44')]?_0x41b4d1[_0xa15d('0x34')]:_0x7ab180[_0xa15d('0x35')];if(_0x3e3575[_0xa15d('0x30')][_0xa15d('0x45')]){_0x41b4d1[_0xa15d('0x3f')]=[{'all':!![]}];}_0x41b4d1=_[_0xa15d('0x3c')]({},_0x41b4d1,_0x3e3575[_0xa15d('0x3e')]);return db[_0xa15d('0x2b')][_0xa15d('0x46')](_0x41b4d1)[_0xa15d('0x24')](handleEntityNotFound(_0x116586,null))[_0xa15d('0x24')](respondWithResult(_0x116586,null))[_0xa15d('0x40')](handleError(_0x116586,null));};exports[_0xa15d('0x47')]=function(_0x4d27e7,_0x2f2ddc){return db['ChatGroup'][_0xa15d('0x47')](_0x4d27e7['body'],{})[_0xa15d('0x24')](respondWithResult(_0x2f2ddc,0xc9))[_0xa15d('0x40')](handleError(_0x2f2ddc,null));};exports[_0xa15d('0x23')]=function(_0x5db0cd,_0xc3942){if(_0x5db0cd[_0xa15d('0x48')]['id']){delete _0x5db0cd[_0xa15d('0x48')]['id'];}return db[_0xa15d('0x2b')][_0xa15d('0x46')]({'where':{'id':_0x5db0cd[_0xa15d('0x42')]['id']}})[_0xa15d('0x24')](handleEntityNotFound(_0xc3942,null))[_0xa15d('0x24')](saveUpdates(_0x5db0cd[_0xa15d('0x48')],null))[_0xa15d('0x24')](respondWithResult(_0xc3942,null))[_0xa15d('0x40')](handleError(_0xc3942,null));};exports[_0xa15d('0x25')]=function(_0x1221d5,_0x5855a1){return db[_0xa15d('0x2b')][_0xa15d('0x46')]({'where':{'id':_0x1221d5['params']['id']}})['then'](handleEntityNotFound(_0x5855a1,null))['then'](removeEntity(_0x5855a1,null))[_0xa15d('0x40')](handleError(_0x5855a1,null));};exports[_0xa15d('0x49')]=function(_0x2a171c,_0x3559fa){return db[_0xa15d('0x2b')][_0xa15d('0x49')]()['then'](respondWithResult(_0x3559fa,null))[_0xa15d('0x40')](handleError(_0x3559fa,null));};exports[_0xa15d('0x4a')]=function(_0x31601f,_0x2c3d04,_0x2e08ef){return db['ChatInternalMessage'][_0xa15d('0x1a')]({'where':{'ChatGroupId':_0x31601f[_0xa15d('0x42')]['id'],'ToId':_0x31601f['user']['id'],'read':![]}})['then'](function(_0x239a92){return{'id':_[_0xa15d('0x4b')](_0x31601f['params']['id']),'count':_0x239a92};})[_0xa15d('0x24')](respondWithResult(_0x2c3d04,null))[_0xa15d('0x40')](handleError(_0x2c3d04,null));};exports['addMembers']=function(_0x4241fa,_0x5cf562,_0x445115){return db[_0xa15d('0x2b')]['find']({'where':{'id':_0x4241fa[_0xa15d('0x42')]['id']}})[_0xa15d('0x24')](handleEntityNotFound(_0x5cf562,null))[_0xa15d('0x24')](function(_0xfb39bc){if(_0xfb39bc){return _0xfb39bc['addMembers'](_0x4241fa[_0xa15d('0x48')][_0xa15d('0x4c')],_[_0xa15d('0x4d')](_0x4241fa[_0xa15d('0x48')],[_0xa15d('0x4c'),'id'])||{});}})[_0xa15d('0x24')](respondWithResult(_0x5cf562,null))[_0xa15d('0x40')](handleError(_0x5cf562,null));};exports[_0xa15d('0x4e')]=function(_0x25c2be,_0x5e7c0b,_0x18cb5c){var _0x43a1a3={};var _0x1f341e={};var _0x270539;var _0x179c35;return db[_0xa15d('0x2b')][_0xa15d('0x4f')]({'where':{'id':_0x25c2be[_0xa15d('0x42')]['id']}})[_0xa15d('0x24')](handleEntityNotFound(_0x5e7c0b,null))[_0xa15d('0x24')](function(_0x4bf4cc){if(_0x4bf4cc){_0x270539=_0x4bf4cc;_0x1f341e[_0xa15d('0x35')]=_['keys'](db[_0xa15d('0x50')][_0xa15d('0x43')]);_0x1f341e[_0xa15d('0x30')]=_[_0xa15d('0x31')](_0x25c2be[_0xa15d('0x30')]);_0x1f341e['filters']=_['intersection'](_0x1f341e[_0xa15d('0x35')],_0x1f341e[_0xa15d('0x30')]);_0x43a1a3[_0xa15d('0x34')]=_[_0xa15d('0x33')](_0x1f341e['model'],qs[_0xa15d('0x36')](_0x25c2be[_0xa15d('0x30')]['fields']));_0x43a1a3['attributes']=_0x43a1a3[_0xa15d('0x34')][_0xa15d('0x44')]?_0x43a1a3[_0xa15d('0x34')]:_0x1f341e[_0xa15d('0x35')];_0x43a1a3[_0xa15d('0x38')]=qs[_0xa15d('0x39')](_0x25c2be[_0xa15d('0x30')]['sort']);_0x43a1a3['where']=qs[_0xa15d('0x32')](_[_0xa15d('0x51')](_0x25c2be[_0xa15d('0x30')],_0x1f341e[_0xa15d('0x32')]));if(_0x25c2be['query']['filter']){_0x43a1a3[_0xa15d('0x3a')]=_[_0xa15d('0x3c')](_0x43a1a3['where'],{'$or':_['map'](_0x43a1a3['attributes'],function(_0x5cd0c9){var _0x3b8dbe={};_0x3b8dbe[_0x5cd0c9]={'$like':'%'+_0x25c2be[_0xa15d('0x30')][_0xa15d('0x3b')]+'%'};return _0x3b8dbe;})});}_0x43a1a3=_[_0xa15d('0x3c')]({},_0x43a1a3,_0x25c2be[_0xa15d('0x3e')]);return _0x270539[_0xa15d('0x4e')](_0x43a1a3);}})['then'](function(_0x260491){if(_0x260491){_0x179c35=_0x260491[_0xa15d('0x44')];if(!_0x25c2be[_0xa15d('0x30')]['hasOwnProperty'](_0xa15d('0x37'))){_0x43a1a3['limit']=qs[_0xa15d('0x1c')](_0x25c2be[_0xa15d('0x30')][_0xa15d('0x1c')]);_0x43a1a3[_0xa15d('0x1b')]=qs[_0xa15d('0x1b')](_0x25c2be['query']['offset']);}return _0x270539[_0xa15d('0x4e')](_0x43a1a3);}})[_0xa15d('0x24')](function(_0x2b997d){if(_0x2b997d){return _0x2b997d?{'count':_0x179c35,'rows':_0x2b997d}:null;}})[_0xa15d('0x24')](respondWithResult(_0x5e7c0b,null))['catch'](handleError(_0x5e7c0b,null));};exports[_0xa15d('0x52')]=function(_0x4f46ae,_0x2d7e9c,_0x28a033){return db['ChatGroup']['find']({'where':{'id':_0x4f46ae[_0xa15d('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d7e9c,null))[_0xa15d('0x24')](function(_0x2e16f9){if(_0x2e16f9){return _0x2e16f9['removeMembers'](_0x4f46ae['query'][_0xa15d('0x4c')]);}})['then'](respondWithStatusCode(_0x2d7e9c,null))[_0xa15d('0x40')](handleError(_0x2d7e9c,null));};exports['addMessage']=function(_0x2cef8c,_0x11f11a,_0x230e6f){if(_0x2cef8c['body']['id']){delete _0x2cef8c[_0xa15d('0x48')]['id'];}return db[_0xa15d('0x2b')][_0xa15d('0x46')]({'where':{'id':_0x2cef8c[_0xa15d('0x42')]['id']}})[_0xa15d('0x24')](handleEntityNotFound(_0x11f11a,null))['then'](function(_0x2cc569){if(_0x2cc569){_0x2cef8c['body'][_0xa15d('0x53')]=_0x2cc569['id'];return db['ChatInternalMessage'][_0xa15d('0x47')](_0x2cef8c['body']);}})[_0xa15d('0x24')](respondWithResult(_0x11f11a,null))[_0xa15d('0x40')](handleError(_0x11f11a,null));};exports[_0xa15d('0x54')]=function(_0x5e505d,_0x900ed,_0x5e4703){var _0x5c793a={};var _0x3eae44={};var _0xafd9f;var _0x3ef9c4;return db[_0xa15d('0x2b')]['findOne']({'where':{'id':_0x5e505d[_0xa15d('0x42')]['id']}})[_0xa15d('0x24')](handleEntityNotFound(_0x900ed,null))[_0xa15d('0x24')](function(_0x2c75fa){if(_0x2c75fa){_0xafd9f=_0x2c75fa;_0x3eae44[_0xa15d('0x35')]=_[_0xa15d('0x31')](db[_0xa15d('0x55')]['rawAttributes']);_0x3eae44[_0xa15d('0x30')]=_['keys'](_0x5e505d['query']);_0x3eae44[_0xa15d('0x32')]=_[_0xa15d('0x33')](_0x3eae44[_0xa15d('0x35')],_0x3eae44['query']);_0x5c793a[_0xa15d('0x34')]=_[_0xa15d('0x33')](_0x3eae44[_0xa15d('0x35')],qs[_0xa15d('0x36')](_0x5e505d[_0xa15d('0x30')]['fields']));_0x5c793a[_0xa15d('0x34')]=_0x5c793a['attributes'][_0xa15d('0x44')]?_0x5c793a[_0xa15d('0x34')]:_0x3eae44[_0xa15d('0x35')];_0x5c793a['order']=qs['sort'](_0x5e505d['query'][_0xa15d('0x39')]);_0x5c793a[_0xa15d('0x3a')]=qs[_0xa15d('0x32')](_['pick'](_0x5e505d[_0xa15d('0x30')],_0x3eae44['filters']));if(_0x5e505d[_0xa15d('0x30')][_0xa15d('0x3b')]){_0x5c793a[_0xa15d('0x3a')]=_[_0xa15d('0x3c')](_0x5c793a[_0xa15d('0x3a')],{'$or':_['map'](_0x5c793a['attributes'],function(_0xe3ea8b){var _0x37e599={};_0x37e599[_0xe3ea8b]={'$like':'%'+_0x5e505d[_0xa15d('0x30')]['filter']+'%'};return _0x37e599;})});}if(_0x5e505d[_0xa15d('0x30')][_0xa15d('0x56')]){var _0x50ad33=_0x5e505d[_0xa15d('0x30')][_0xa15d('0x56')]['split'](',');var _0x279bc0={};_0x279bc0[_0x50ad33[0x0]]={'$gte':moment(_0x50ad33[0x1])[_0xa15d('0x57')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5c793a[_0xa15d('0x3a')]=_['merge'](_0x5c793a[_0xa15d('0x3a')],_0x279bc0);}_0x5c793a=_[_0xa15d('0x3c')]({},_0x5c793a,_0x5e505d[_0xa15d('0x3e')]);return _0xafd9f[_0xa15d('0x54')](_0x5c793a);}})[_0xa15d('0x24')](function(_0x407090){if(_0x407090){_0x3ef9c4=_0x407090['length'];if(!_0x5e505d['query'][_0xa15d('0x58')](_0xa15d('0x37'))){_0x5c793a[_0xa15d('0x1c')]=qs[_0xa15d('0x1c')](_0x5e505d[_0xa15d('0x30')][_0xa15d('0x1c')]);_0x5c793a[_0xa15d('0x1b')]=qs['offset'](_0x5e505d[_0xa15d('0x30')][_0xa15d('0x1b')]);}return _0xafd9f['getMessages'](_0x5c793a);}})[_0xa15d('0x24')](function(_0x38e4ae){if(_0x38e4ae){return _0x38e4ae?{'count':_0x3ef9c4,'rows':_0x38e4ae}:null;}})['then'](respondWithResult(_0x900ed,null))[_0xa15d('0x40')](handleError(_0x900ed,null));}; \ No newline at end of file +var _0x3d50=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','then','catch','show','params','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','length','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','name','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x3d50,0x14f));var _0x03d5=function(_0x182ab6,_0x5036be){_0x182ab6=_0x182ab6-0x0;var _0x1cace0=_0x3d50[_0x182ab6];return _0x1cace0;};'use strict';var emlformat=require(_0x03d5('0x0'));var rimraf=require(_0x03d5('0x1'));var zipdir=require(_0x03d5('0x2'));var jsonpatch=require(_0x03d5('0x3'));var rp=require(_0x03d5('0x4'));var moment=require(_0x03d5('0x5'));var BPromise=require(_0x03d5('0x6'));var Mustache=require(_0x03d5('0x7'));var util=require('util');var path=require(_0x03d5('0x8'));var sox=require(_0x03d5('0x9'));var csv=require(_0x03d5('0xa'));var ejs=require(_0x03d5('0xb'));var fs=require('fs');var fs_extra=require(_0x03d5('0xc'));var _=require('lodash');var squel=require(_0x03d5('0xd'));var crypto=require(_0x03d5('0xe'));var jsforce=require(_0x03d5('0xf'));var deskjs=require(_0x03d5('0x10'));var toCsv=require(_0x03d5('0xa'));var querystring=require('querystring');var Papa=require(_0x03d5('0x11'));var Redis=require('ioredis');var authService=require(_0x03d5('0x12'));var qs=require(_0x03d5('0x13'));var as=require(_0x03d5('0x14'));var hardwareService=require(_0x03d5('0x15'));var logger=require(_0x03d5('0x16'))(_0x03d5('0x17'));var utils=require(_0x03d5('0x18'));var config=require(_0x03d5('0x19'));var licenseUtil=require(_0x03d5('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x03d5('0x1b')](config[_0x03d5('0x1c')],{'host':_0x03d5('0x1d'),'port':0x18eb});var socket=require(_0x03d5('0x1e'))(new Redis(config[_0x03d5('0x1c')]));require('./chatGroup.socket')[_0x03d5('0x1f')](socket);function respondWithStatusCode(_0x3cfce8,_0x139906){_0x139906=_0x139906||0xcc;return function(_0x2587c6){if(_0x2587c6){return _0x3cfce8['sendStatus'](_0x139906);}return _0x3cfce8['status'](_0x139906)[_0x03d5('0x20')]();};}function respondWithResult(_0x4a88a1,_0xa8a6d8){_0xa8a6d8=_0xa8a6d8||0xc8;return function(_0x5bd5d5){if(_0x5bd5d5){return _0x4a88a1[_0x03d5('0x21')](_0xa8a6d8)[_0x03d5('0x22')](_0x5bd5d5);}};}function respondWithFilteredResult(_0x7147f2,_0x2414e2){return function(_0x383c94){if(_0x383c94){var _0x4ed033=typeof _0x2414e2[_0x03d5('0x23')]===_0x03d5('0x24')&&typeof _0x2414e2['limit']==='undefined';var _0x564576=_0x383c94[_0x03d5('0x25')];var _0x7de0b6=_0x4ed033?0x0:_0x2414e2['offset'];var _0x42b048=_0x4ed033?_0x383c94['count']:_0x2414e2[_0x03d5('0x23')]+_0x2414e2[_0x03d5('0x26')];var _0x47096e;if(_0x42b048>=_0x564576){_0x42b048=_0x564576;_0x47096e=0xc8;}else{_0x47096e=0xce;}_0x7147f2[_0x03d5('0x21')](_0x47096e);return _0x7147f2['set'](_0x03d5('0x27'),_0x7de0b6+'-'+_0x42b048+'/'+_0x564576)[_0x03d5('0x22')](_0x383c94);}return null;};}function patchUpdates(_0x151df4){return function(_0x3c0be3){try{jsonpatch[_0x03d5('0x28')](_0x3c0be3,_0x151df4,!![]);}catch(_0x2192c3){return BPromise[_0x03d5('0x29')](_0x2192c3);}return _0x3c0be3[_0x03d5('0x2a')]();};}function saveUpdates(_0x19ab69,_0x45b2c9){return function(_0x20ffce){if(_0x20ffce){return _0x20ffce[_0x03d5('0x2b')](_0x19ab69)['then'](function(_0x5f44c7){return _0x5f44c7;});}return null;};}function removeEntity(_0x592481,_0x3c808a){return function(_0x551635){if(_0x551635){return _0x551635[_0x03d5('0x2c')]()['then'](function(){_0x592481[_0x03d5('0x21')](0xcc)[_0x03d5('0x20')]();});}};}function handleEntityNotFound(_0xcd2cab,_0x232b56){return function(_0x1ad494){if(!_0x1ad494){_0xcd2cab[_0x03d5('0x2d')](0x194);}return _0x1ad494;};}function handleError(_0x4f2c06,_0x44ffaf){_0x44ffaf=_0x44ffaf||0x1f4;return function(_0x5d35e2){logger['error'](_0x5d35e2['stack']);if(_0x5d35e2[_0x03d5('0x2e')]){delete _0x5d35e2['name'];}_0x4f2c06[_0x03d5('0x21')](_0x44ffaf)['send'](_0x5d35e2);};}exports[_0x03d5('0x2f')]=function(_0xc0440e,_0x484c30){var _0x2a2b5b={},_0x5dcaa1={},_0x472a2f={'count':0x0,'rows':[]};var _0x2bba69=_[_0x03d5('0x30')](db[_0x03d5('0x31')][_0x03d5('0x32')],function(_0x3a0687){return{'name':_0x3a0687['fieldName'],'type':_0x3a0687[_0x03d5('0x33')][_0x03d5('0x34')]};});_0x5dcaa1[_0x03d5('0x35')]=_[_0x03d5('0x30')](_0x2bba69,_0x03d5('0x2e'));_0x5dcaa1[_0x03d5('0x36')]=_[_0x03d5('0x37')](_0xc0440e['query']);_0x5dcaa1[_0x03d5('0x38')]=_[_0x03d5('0x39')](_0x5dcaa1[_0x03d5('0x35')],_0x5dcaa1[_0x03d5('0x36')]);_0x2a2b5b[_0x03d5('0x3a')]=_[_0x03d5('0x39')](_0x5dcaa1[_0x03d5('0x35')],qs[_0x03d5('0x3b')](_0xc0440e[_0x03d5('0x36')][_0x03d5('0x3b')]));_0x2a2b5b['attributes']=_0x2a2b5b[_0x03d5('0x3a')]['length']?_0x2a2b5b[_0x03d5('0x3a')]:_0x5dcaa1[_0x03d5('0x35')];if(!_0xc0440e[_0x03d5('0x36')][_0x03d5('0x3c')](_0x03d5('0x3d'))){_0x2a2b5b[_0x03d5('0x26')]=qs[_0x03d5('0x26')](_0xc0440e['query'][_0x03d5('0x26')]);_0x2a2b5b[_0x03d5('0x23')]=qs['offset'](_0xc0440e['query'][_0x03d5('0x23')]);}_0x2a2b5b[_0x03d5('0x3e')]=qs[_0x03d5('0x3f')](_0xc0440e[_0x03d5('0x36')][_0x03d5('0x3f')]);_0x2a2b5b[_0x03d5('0x40')]=qs[_0x03d5('0x38')](_[_0x03d5('0x41')](_0xc0440e[_0x03d5('0x36')],_0x5dcaa1[_0x03d5('0x38')]),_0x2bba69);if(_0xc0440e['query'][_0x03d5('0x42')]){_0x2a2b5b[_0x03d5('0x40')]=_[_0x03d5('0x43')](_0x2a2b5b['where'],{'$or':_['map'](_0x2bba69,function(_0x97dcf1){if(_0x97dcf1[_0x03d5('0x33')]!==_0x03d5('0x44')){var _0x42df95={};_0x42df95[_0x97dcf1[_0x03d5('0x2e')]]={'$like':'%'+_0xc0440e['query'][_0x03d5('0x42')]+'%'};return _0x42df95;}})});}_0x2a2b5b=_['merge']({},_0x2a2b5b,_0xc0440e[_0x03d5('0x45')]);var _0x5e0c27={'where':_0x2a2b5b['where']};return db[_0x03d5('0x31')][_0x03d5('0x25')](_0x5e0c27)['then'](function(_0x4cd200){_0x472a2f[_0x03d5('0x25')]=_0x4cd200;if(_0xc0440e[_0x03d5('0x36')][_0x03d5('0x46')]){_0x2a2b5b[_0x03d5('0x47')]=[{'all':!![]}];}return db[_0x03d5('0x31')][_0x03d5('0x48')](_0x2a2b5b);})['then'](function(_0x4fae17){_0x472a2f[_0x03d5('0x49')]=_0x4fae17;return _0x472a2f;})[_0x03d5('0x4a')](respondWithFilteredResult(_0x484c30,_0x2a2b5b))[_0x03d5('0x4b')](handleError(_0x484c30,null));};exports[_0x03d5('0x4c')]=function(_0x1874c2,_0x51a2e9){var _0x1ea9f2={'raw':!![],'where':{'id':_0x1874c2[_0x03d5('0x4d')]['id']}},_0x3adfec={};_0x3adfec[_0x03d5('0x35')]=_[_0x03d5('0x37')](db[_0x03d5('0x31')]['rawAttributes']);_0x3adfec['query']=_[_0x03d5('0x37')](_0x1874c2[_0x03d5('0x36')]);_0x3adfec[_0x03d5('0x38')]=_[_0x03d5('0x39')](_0x3adfec[_0x03d5('0x35')],_0x3adfec[_0x03d5('0x36')]);_0x1ea9f2[_0x03d5('0x3a')]=_[_0x03d5('0x39')](_0x3adfec['model'],qs[_0x03d5('0x3b')](_0x1874c2[_0x03d5('0x36')]['fields']));_0x1ea9f2[_0x03d5('0x3a')]=_0x1ea9f2['attributes']['length']?_0x1ea9f2['attributes']:_0x3adfec[_0x03d5('0x35')];if(_0x1874c2[_0x03d5('0x36')][_0x03d5('0x46')]){_0x1ea9f2[_0x03d5('0x47')]=[{'all':!![]}];}_0x1ea9f2=_[_0x03d5('0x43')]({},_0x1ea9f2,_0x1874c2['options']);return db[_0x03d5('0x31')][_0x03d5('0x4e')](_0x1ea9f2)['then'](handleEntityNotFound(_0x51a2e9,null))['then'](respondWithResult(_0x51a2e9,null))['catch'](handleError(_0x51a2e9,null));};exports[_0x03d5('0x4f')]=function(_0x2d8624,_0x293c8a){return db[_0x03d5('0x31')][_0x03d5('0x4f')](_0x2d8624[_0x03d5('0x50')],{})[_0x03d5('0x4a')](respondWithResult(_0x293c8a,0xc9))['catch'](handleError(_0x293c8a,null));};exports[_0x03d5('0x2b')]=function(_0x16f3e5,_0x258f82){if(_0x16f3e5['body']['id']){delete _0x16f3e5[_0x03d5('0x50')]['id'];}return db[_0x03d5('0x31')][_0x03d5('0x4e')]({'where':{'id':_0x16f3e5['params']['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0x258f82,null))[_0x03d5('0x4a')](saveUpdates(_0x16f3e5['body'],null))[_0x03d5('0x4a')](respondWithResult(_0x258f82,null))[_0x03d5('0x4b')](handleError(_0x258f82,null));};exports[_0x03d5('0x2c')]=function(_0x24fe72,_0x3dcf4c){return db[_0x03d5('0x31')][_0x03d5('0x4e')]({'where':{'id':_0x24fe72[_0x03d5('0x4d')]['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0x3dcf4c,null))[_0x03d5('0x4a')](removeEntity(_0x3dcf4c,null))[_0x03d5('0x4b')](handleError(_0x3dcf4c,null));};exports[_0x03d5('0x51')]=function(_0x51158c,_0x1ef066){return db[_0x03d5('0x31')][_0x03d5('0x51')]()[_0x03d5('0x4a')](respondWithResult(_0x1ef066,null))['catch'](handleError(_0x1ef066,null));};exports[_0x03d5('0x52')]=function(_0x4363d3,_0x1dff4c,_0x48cd17){return db[_0x03d5('0x53')][_0x03d5('0x25')]({'where':{'ChatGroupId':_0x4363d3['params']['id'],'ToId':_0x4363d3[_0x03d5('0x54')]['id'],'read':![]}})[_0x03d5('0x4a')](function(_0xe4c127){return{'id':_[_0x03d5('0x55')](_0x4363d3[_0x03d5('0x4d')]['id']),'count':_0xe4c127};})[_0x03d5('0x4a')](respondWithResult(_0x1dff4c,null))[_0x03d5('0x4b')](handleError(_0x1dff4c,null));};exports['addMembers']=function(_0x5da0d7,_0x535751,_0x234af0){return db[_0x03d5('0x31')]['find']({'where':{'id':_0x5da0d7['params']['id']}})['then'](handleEntityNotFound(_0x535751,null))[_0x03d5('0x4a')](function(_0x331fff){if(_0x331fff){return _0x331fff[_0x03d5('0x56')](_0x5da0d7[_0x03d5('0x50')][_0x03d5('0x57')],_[_0x03d5('0x58')](_0x5da0d7[_0x03d5('0x50')],[_0x03d5('0x57'),'id'])||{});}})[_0x03d5('0x4a')](respondWithResult(_0x535751,null))[_0x03d5('0x4b')](handleError(_0x535751,null));};exports[_0x03d5('0x59')]=function(_0x2ece44,_0x3178a0,_0x2a8a05){var _0x45f02e={};var _0x15704f={};var _0x2da731;var _0x462246;return db[_0x03d5('0x31')][_0x03d5('0x5a')]({'where':{'id':_0x2ece44[_0x03d5('0x4d')]['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0x3178a0,null))['then'](function(_0x4f2dff){if(_0x4f2dff){_0x2da731=_0x4f2dff;_0x15704f[_0x03d5('0x35')]=_[_0x03d5('0x37')](db[_0x03d5('0x5b')][_0x03d5('0x32')]);_0x15704f[_0x03d5('0x36')]=_[_0x03d5('0x37')](_0x2ece44[_0x03d5('0x36')]);_0x15704f[_0x03d5('0x38')]=_['intersection'](_0x15704f[_0x03d5('0x35')],_0x15704f['query']);_0x45f02e[_0x03d5('0x3a')]=_[_0x03d5('0x39')](_0x15704f[_0x03d5('0x35')],qs[_0x03d5('0x3b')](_0x2ece44[_0x03d5('0x36')][_0x03d5('0x3b')]));_0x45f02e['attributes']=_0x45f02e[_0x03d5('0x3a')][_0x03d5('0x5c')]?_0x45f02e[_0x03d5('0x3a')]:_0x15704f['model'];_0x45f02e['order']=qs['sort'](_0x2ece44[_0x03d5('0x36')][_0x03d5('0x3f')]);_0x45f02e[_0x03d5('0x40')]=qs[_0x03d5('0x38')](_[_0x03d5('0x41')](_0x2ece44['query'],_0x15704f[_0x03d5('0x38')]));if(_0x2ece44[_0x03d5('0x36')][_0x03d5('0x42')]){_0x45f02e['where']=_[_0x03d5('0x43')](_0x45f02e[_0x03d5('0x40')],{'$or':_['map'](_0x45f02e['attributes'],function(_0x1a0d87){var _0x4f73e3={};_0x4f73e3[_0x1a0d87]={'$like':'%'+_0x2ece44[_0x03d5('0x36')][_0x03d5('0x42')]+'%'};return _0x4f73e3;})});}_0x45f02e=_[_0x03d5('0x43')]({},_0x45f02e,_0x2ece44[_0x03d5('0x45')]);return _0x2da731[_0x03d5('0x59')](_0x45f02e);}})[_0x03d5('0x4a')](function(_0x2a6477){if(_0x2a6477){_0x462246=_0x2a6477[_0x03d5('0x5c')];if(!_0x2ece44[_0x03d5('0x36')][_0x03d5('0x3c')](_0x03d5('0x3d'))){_0x45f02e[_0x03d5('0x26')]=qs[_0x03d5('0x26')](_0x2ece44['query']['limit']);_0x45f02e[_0x03d5('0x23')]=qs[_0x03d5('0x23')](_0x2ece44[_0x03d5('0x36')]['offset']);}return _0x2da731[_0x03d5('0x59')](_0x45f02e);}})[_0x03d5('0x4a')](function(_0x38898d){if(_0x38898d){return _0x38898d?{'count':_0x462246,'rows':_0x38898d}:null;}})[_0x03d5('0x4a')](respondWithResult(_0x3178a0,null))['catch'](handleError(_0x3178a0,null));};exports['removeMembers']=function(_0x5723d5,_0x565eaf,_0x16f172){return db[_0x03d5('0x31')][_0x03d5('0x4e')]({'where':{'id':_0x5723d5['params']['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0x565eaf,null))[_0x03d5('0x4a')](function(_0x5cb03d){if(_0x5cb03d){return _0x5cb03d['removeMembers'](_0x5723d5[_0x03d5('0x36')][_0x03d5('0x57')]);}})[_0x03d5('0x4a')](respondWithStatusCode(_0x565eaf,null))['catch'](handleError(_0x565eaf,null));};exports[_0x03d5('0x5d')]=function(_0x3067fb,_0xf11615,_0x47624e){if(_0x3067fb[_0x03d5('0x50')]['id']){delete _0x3067fb[_0x03d5('0x50')]['id'];}return db[_0x03d5('0x31')][_0x03d5('0x4e')]({'where':{'id':_0x3067fb[_0x03d5('0x4d')]['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0xf11615,null))['then'](function(_0x5e68b2){if(_0x5e68b2){_0x3067fb['body'][_0x03d5('0x5e')]=_0x5e68b2['id'];return db[_0x03d5('0x53')]['create'](_0x3067fb[_0x03d5('0x50')]);}})[_0x03d5('0x4a')](respondWithResult(_0xf11615,null))[_0x03d5('0x4b')](handleError(_0xf11615,null));};exports[_0x03d5('0x5f')]=function(_0x30501f,_0x187b98,_0x15bbb6){var _0x5d9db9={};var _0x111023={};var _0x34fd7d;var _0x14dffc;return db[_0x03d5('0x31')]['findOne']({'where':{'id':_0x30501f[_0x03d5('0x4d')]['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0x187b98,null))[_0x03d5('0x4a')](function(_0x40554f){if(_0x40554f){_0x34fd7d=_0x40554f;_0x111023[_0x03d5('0x35')]=_[_0x03d5('0x37')](db[_0x03d5('0x53')][_0x03d5('0x32')]);_0x111023[_0x03d5('0x36')]=_['keys'](_0x30501f[_0x03d5('0x36')]);_0x111023[_0x03d5('0x38')]=_[_0x03d5('0x39')](_0x111023[_0x03d5('0x35')],_0x111023[_0x03d5('0x36')]);_0x5d9db9['attributes']=_[_0x03d5('0x39')](_0x111023[_0x03d5('0x35')],qs['fields'](_0x30501f[_0x03d5('0x36')][_0x03d5('0x3b')]));_0x5d9db9['attributes']=_0x5d9db9[_0x03d5('0x3a')]['length']?_0x5d9db9['attributes']:_0x111023[_0x03d5('0x35')];_0x5d9db9[_0x03d5('0x3e')]=qs[_0x03d5('0x3f')](_0x30501f['query']['sort']);_0x5d9db9[_0x03d5('0x40')]=qs[_0x03d5('0x38')](_['pick'](_0x30501f[_0x03d5('0x36')],_0x111023['filters']));if(_0x30501f['query'][_0x03d5('0x42')]){_0x5d9db9['where']=_[_0x03d5('0x43')](_0x5d9db9['where'],{'$or':_[_0x03d5('0x30')](_0x5d9db9['attributes'],function(_0x3eb4e6){var _0x45eda3={};_0x45eda3[_0x3eb4e6]={'$like':'%'+_0x30501f[_0x03d5('0x36')][_0x03d5('0x42')]+'%'};return _0x45eda3;})});}if(_0x30501f[_0x03d5('0x36')][_0x03d5('0x60')]){var _0x4bcf5d=_0x30501f[_0x03d5('0x36')]['$gte']['split'](',');var _0x1fd6c8={};_0x1fd6c8[_0x4bcf5d[0x0]]={'$gte':moment(_0x4bcf5d[0x1])[_0x03d5('0x61')](_0x03d5('0x62'))};_0x5d9db9['where']=_[_0x03d5('0x43')](_0x5d9db9[_0x03d5('0x40')],_0x1fd6c8);}_0x5d9db9=_[_0x03d5('0x43')]({},_0x5d9db9,_0x30501f[_0x03d5('0x45')]);return _0x34fd7d[_0x03d5('0x5f')](_0x5d9db9);}})[_0x03d5('0x4a')](function(_0x487bff){if(_0x487bff){_0x14dffc=_0x487bff['length'];if(!_0x30501f[_0x03d5('0x36')]['hasOwnProperty'](_0x03d5('0x3d'))){_0x5d9db9[_0x03d5('0x26')]=qs[_0x03d5('0x26')](_0x30501f[_0x03d5('0x36')][_0x03d5('0x26')]);_0x5d9db9[_0x03d5('0x23')]=qs[_0x03d5('0x23')](_0x30501f['query'][_0x03d5('0x23')]);}return _0x34fd7d[_0x03d5('0x5f')](_0x5d9db9);}})[_0x03d5('0x4a')](function(_0x51faa6){if(_0x51faa6){return _0x51faa6?{'count':_0x14dffc,'rows':_0x51faa6}:null;}})[_0x03d5('0x4a')](respondWithResult(_0x187b98,null))[_0x03d5('0x4b')](handleError(_0x187b98,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b7629bf..d5276f8 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 _0x36e0=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x54569d,_0xc709cb){var _0x9c892=function(_0x320d25){while(--_0x320d25){_0x54569d['push'](_0x54569d['shift']());}};_0x9c892(++_0xc709cb);}(_0x36e0,0x15c));var _0x036e=function(_0x27f790,_0xe1a3f5){_0x27f790=_0x27f790-0x0;var _0x3e7235=_0x36e0[_0x27f790];return _0x3e7235;};'use strict';var EventEmitter=require(_0x036e('0x0'));var ChatGroup=require(_0x036e('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x036e('0x2')](0x0);var events={'afterCreate':_0x036e('0x3'),'afterUpdate':_0x036e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2ef73c){return function(_0x400837,_0x4f9d06,_0xac7036){ChatGroupEvents[_0x036e('0x5')](_0x2ef73c+':'+_0x400837['id'],_0x400837);ChatGroupEvents[_0x036e('0x5')](_0x2ef73c,_0x400837);_0xac7036(null);};}for(var e in events){if(events[_0x036e('0x6')](e)){var event=events[e];ChatGroup[_0x036e('0x7')](e,emitEvent(event));}}module[_0x036e('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x6636=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2920b1,_0x3b9959){var _0x1bd6fb=function(_0x18585d){while(--_0x18585d){_0x2920b1['push'](_0x2920b1['shift']());}};_0x1bd6fb(++_0x3b9959);}(_0x6636,0x119));var _0x6663=function(_0x20a701,_0x431182){_0x20a701=_0x20a701-0x0;var _0x357715=_0x6636[_0x20a701];return _0x357715;};'use strict';var EventEmitter=require(_0x6663('0x0'));var ChatGroup=require(_0x6663('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6663('0x2')](0x0);var events={'afterCreate':_0x6663('0x3'),'afterUpdate':_0x6663('0x4'),'afterDestroy':_0x6663('0x5')};function emitEvent(_0x3b27e6){return function(_0x26173b,_0x24de71,_0x39f6ff){ChatGroupEvents[_0x6663('0x6')](_0x3b27e6+':'+_0x26173b['id'],_0x26173b);ChatGroupEvents[_0x6663('0x6')](_0x3b27e6,_0x26173b);_0x39f6ff(null);};}for(var e in events){if(events[_0x6663('0x7')](e)){var event=events[e];ChatGroup[_0x6663('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c407629..9af7f11 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 _0x4c90=['define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes'];(function(_0x47fd21,_0x15f0d1){var _0x4f29fc=function(_0x109eb4){while(--_0x109eb4){_0x47fd21['push'](_0x47fd21['shift']());}};_0x4f29fc(++_0x15f0d1);}(_0x4c90,0x12f));var _0x04c9=function(_0x46ed96,_0x5aa51a){_0x46ed96=_0x46ed96-0x0;var _0x295099=_0x4c90[_0x46ed96];return _0x295099;};'use strict';var _=require('lodash');var util=require(_0x04c9('0x0'));var logger=require(_0x04c9('0x1'))(_0x04c9('0x2'));var moment=require(_0x04c9('0x3'));var BPromise=require(_0x04c9('0x4'));var rp=require(_0x04c9('0x5'));var fs=require('fs');var path=require(_0x04c9('0x6'));var rimraf=require('rimraf');var config=require(_0x04c9('0x7'));var attributes=require(_0x04c9('0x8'));module['exports']=function(_0x49d81e,_0x37b661){return _0x49d81e[_0x04c9('0x9')](_0x04c9('0xa'),attributes,{'tableName':_0x04c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa288=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x10feb7,_0x238e45){var _0x4ae6cf=function(_0x1ff066){while(--_0x1ff066){_0x10feb7['push'](_0x10feb7['shift']());}};_0x4ae6cf(++_0x238e45);}(_0xa288,0x6e));var _0x8a28=function(_0x130d2e,_0xf53241){_0x130d2e=_0x130d2e-0x0;var _0x4798fb=_0xa288[_0x130d2e];return _0x4798fb;};'use strict';var _=require(_0x8a28('0x0'));var util=require('util');var logger=require(_0x8a28('0x1'))(_0x8a28('0x2'));var moment=require('moment');var BPromise=require(_0x8a28('0x3'));var rp=require(_0x8a28('0x4'));var fs=require('fs');var path=require(_0x8a28('0x5'));var rimraf=require(_0x8a28('0x6'));var config=require(_0x8a28('0x7'));var attributes=require(_0x8a28('0x8'));module[_0x8a28('0x9')]=function(_0x27a972,_0x4c4e48){return _0x27a972[_0x8a28('0xa')](_0x8a28('0xb'),attributes,{'tableName':_0x8a28('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 a4b1c13..e9ab7a4 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 _0x851c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x3ee3c4,_0x4e05ef){var _0x4cb093=function(_0x1dd335){while(--_0x1dd335){_0x3ee3c4['push'](_0x3ee3c4['shift']());}};_0x4cb093(++_0x4e05ef);}(_0x851c,0x19d));var _0xc851=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x851c[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xc851('0x0'));var util=require(_0xc851('0x1'));var moment=require(_0xc851('0x2'));var BPromise=require(_0xc851('0x3'));var rs=require(_0xc851('0x4'));var fs=require('fs');var Redis=require(_0xc851('0x5'));var db=require(_0xc851('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc851('0x7'))(_0xc851('0x8'));var config=require('../../config/environment');var jayson=require(_0xc851('0x9'));var client=jayson[_0xc851('0xa')]['http']({'port':0x232a});config[_0xc851('0xb')]=_['defaults'](config['redis'],{'host':_0xc851('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc851('0xd'))[_0xc851('0xe')](socket);function respondWithRpcPromise(_0x3b4e80,_0x177de0,_0x1f1524){return new BPromise(function(_0x1ee38d,_0x33772a){return client[_0xc851('0xf')](_0x3b4e80,_0x1f1524)['then'](function(_0x3a1ce8){logger[_0xc851('0x10')](_0xc851('0x11'),_0x177de0,_0xc851('0x12'));logger[_0xc851('0x13')](_0xc851('0x14'),_0x177de0,_0xc851('0x12'),JSON[_0xc851('0x15')](_0x3a1ce8));if(_0x3a1ce8[_0xc851('0x16')]){if(_0x3a1ce8[_0xc851('0x16')][_0xc851('0x17')]===0x1f4){logger[_0xc851('0x16')](_0xc851('0x11'),_0x177de0,_0x3a1ce8[_0xc851('0x16')][_0xc851('0x18')]);return _0x33772a(_0x3a1ce8[_0xc851('0x16')]['message']);}logger[_0xc851('0x16')]('ChatGroup,\x20%s,\x20%s',_0x177de0,_0x3a1ce8[_0xc851('0x16')]['message']);return _0x1ee38d(_0x3a1ce8[_0xc851('0x16')][_0xc851('0x18')]);}else{logger[_0xc851('0x10')](_0xc851('0x11'),_0x177de0,_0xc851('0x12'));_0x1ee38d(_0x3a1ce8[_0xc851('0x19')][_0xc851('0x18')]);}})['catch'](function(_0x27c098){logger[_0xc851('0x16')]('ChatGroup,\x20%s,\x20%s',_0x177de0,_0x27c098);_0x33772a(_0x27c098);});});} \ No newline at end of file +var _0xb138=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error'];(function(_0x23ac93,_0x19d38c){var _0x1ed344=function(_0x2bf388){while(--_0x2bf388){_0x23ac93['push'](_0x23ac93['shift']());}};_0x1ed344(++_0x19d38c);}(_0xb138,0x1dd));var _0x8b13=function(_0x3ba72d,_0xeb3c6d){_0x3ba72d=_0x3ba72d-0x0;var _0x39491f=_0xb138[_0x3ba72d];return _0x39491f;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8b13('0xa')][_0x8b13('0xb')]({'port':0x232a});config['redis']=_[_0x8b13('0xc')](config[_0x8b13('0xd')],{'host':_0x8b13('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b13('0xd')]));require(_0x8b13('0xf'))['register'](socket);function respondWithRpcPromise(_0x53ae50,_0x1f2528,_0x21fcd9){return new BPromise(function(_0x13fbd1,_0x439451){return client[_0x8b13('0x10')](_0x53ae50,_0x21fcd9)['then'](function(_0x11bc89){logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));logger[_0x8b13('0x14')](_0x8b13('0x15'),_0x1f2528,'request\x20sent',JSON['stringify'](_0x11bc89));if(_0x11bc89[_0x8b13('0x16')]){if(_0x11bc89[_0x8b13('0x16')]['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x439451(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}logger[_0x8b13('0x16')]('ChatGroup,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x13fbd1(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}else{logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));_0x13fbd1(_0x11bc89[_0x8b13('0x18')]['message']);}})['catch'](function(_0xae4966){logger[_0x8b13('0x16')](_0x8b13('0x12'),_0x1f2528,_0xae4966);_0x439451(_0xae4966);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6627bbd..b49209b 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 _0x0584=['chatGroup:','remove','update','emit','removeListener','register'];(function(_0x5b18a0,_0x42f1ba){var _0x2297e1=function(_0x5d402d){while(--_0x5d402d){_0x5b18a0['push'](_0x5b18a0['shift']());}};_0x2297e1(++_0x42f1ba);}(_0x0584,0xd3));var _0x4058=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0584[_0x19e35c];return _0x3e1fe8;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x4058('0x0'),_0x4058('0x1')];function createListener(_0x2dcf70,_0x596b87){return function(_0x3cb33d){_0x596b87[_0x4058('0x2')](_0x2dcf70,_0x3cb33d);};}function removeListener(_0x2d075a,_0x3e6b6c){return function(){ChatGroupEvents[_0x4058('0x3')](_0x2d075a,_0x3e6b6c);};}exports[_0x4058('0x4')]=function(_0x247374){for(var _0x41c11e=0x0,_0xfb710d=events['length'];_0x41c11e<_0xfb710d;_0x41c11e++){var _0x230938=events[_0x41c11e];var _0x3819c6=createListener(_0x4058('0x5')+_0x230938,_0x247374);ChatGroupEvents['on'](_0x230938,_0x3819c6);}}; \ No newline at end of file +var _0x3666=['removeListener','register','length','chatGroup:','./chatGroup.events','remove'];(function(_0x51c4c9,_0x26cbfd){var _0x5b8ff2=function(_0x49b7f8){while(--_0x49b7f8){_0x51c4c9['push'](_0x51c4c9['shift']());}};_0x5b8ff2(++_0x26cbfd);}(_0x3666,0x1b4));var _0x6366=function(_0x2ab386,_0x1df578){_0x2ab386=_0x2ab386-0x0;var _0x385bf8=_0x3666[_0x2ab386];return _0x385bf8;};'use strict';var ChatGroupEvents=require(_0x6366('0x0'));var events=['save',_0x6366('0x1'),'update'];function createListener(_0x502133,_0x4617bc){return function(_0x2feac4){_0x4617bc['emit'](_0x502133,_0x2feac4);};}function removeListener(_0x510538,_0x459d82){return function(){ChatGroupEvents[_0x6366('0x2')](_0x510538,_0x459d82);};}exports[_0x6366('0x3')]=function(_0x4ac38d){for(var _0x19c401=0x0,_0x3573bf=events[_0x6366('0x4')];_0x19c401<_0x3573bf;_0x19c401++){var _0x3f804a=events[_0x19c401];var _0x76bec1=createListener(_0x6366('0x5')+_0x3f804a,_0x4ac38d);ChatGroupEvents['on'](_0x3f804a,_0x76bec1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index abca55f..c9955c6 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 _0x3fc6=['/describe','describe','/:id','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x3a7368,_0x185789){var _0x1aa883=function(_0x41b7b6){while(--_0x41b7b6){_0x3a7368['push'](_0x3a7368['shift']());}};_0x1aa883(++_0x185789);}(_0x3fc6,0x195));var _0x63fc=function(_0x125469,_0x45fdd5){_0x125469=_0x125469-0x0;var _0x30732a=_0x3fc6[_0x125469];return _0x30732a;};'use strict';var multer=require(_0x63fc('0x0'));var util=require(_0x63fc('0x1'));var path=require(_0x63fc('0x2'));var timeout=require(_0x63fc('0x3'));var express=require(_0x63fc('0x4'));var router=express[_0x63fc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x63fc('0x6'));var interaction=require(_0x63fc('0x7'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth[_0x63fc('0x8')](),controller[_0x63fc('0x9')]);router[_0x63fc('0xa')](_0x63fc('0xb'),auth[_0x63fc('0x8')](),controller[_0x63fc('0xc')]);router[_0x63fc('0xa')](_0x63fc('0xd'),auth[_0x63fc('0x8')](),controller['show']);router[_0x63fc('0xa')]('/:id/unread',auth[_0x63fc('0x8')](),controller[_0x63fc('0xe')]);router['get'](_0x63fc('0xf'),auth['isAuthenticated'](),controller[_0x63fc('0x10')]);router[_0x63fc('0xa')](_0x63fc('0x11'),auth[_0x63fc('0x8')](),controller['getMessages']);router[_0x63fc('0x12')]('/',auth[_0x63fc('0x8')](),controller[_0x63fc('0x13')]);router['post'](_0x63fc('0xf'),auth[_0x63fc('0x8')](),controller[_0x63fc('0x14')]);router[_0x63fc('0x12')](_0x63fc('0x11'),auth['isAuthenticated'](),controller[_0x63fc('0x15')]);router[_0x63fc('0x16')](_0x63fc('0xd'),auth[_0x63fc('0x8')](),controller['update']);router[_0x63fc('0x17')](_0x63fc('0xd'),auth[_0x63fc('0x8')](),controller[_0x63fc('0x18')]);router[_0x63fc('0x17')](_0x63fc('0xf'),auth[_0x63fc('0x8')](),controller[_0x63fc('0x19')]);module['exports']=router; \ No newline at end of file +var _0x2ba5=['fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/unread','/:id/members','getMembers','post','create','addMembers','addMessage','update','destroy','delete','removeMembers','multer','util','path','connect-timeout','express','Router'];(function(_0x2df84d,_0x56d874){var _0x2634ce=function(_0x8e8e31){while(--_0x8e8e31){_0x2df84d['push'](_0x2df84d['shift']());}};_0x2634ce(++_0x56d874);}(_0x2ba5,0x1c5));var _0x52ba=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x2ba5[_0x95411e];return _0x2c8718;};'use strict';var multer=require(_0x52ba('0x0'));var util=require(_0x52ba('0x1'));var path=require(_0x52ba('0x2'));var timeout=require(_0x52ba('0x3'));var express=require(_0x52ba('0x4'));var router=express[_0x52ba('0x5')]();var fs_extra=require(_0x52ba('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x52ba('0x7'));var config=require(_0x52ba('0x8'));var controller=require(_0x52ba('0x9'));router[_0x52ba('0xa')]('/',auth[_0x52ba('0xb')](),controller[_0x52ba('0xc')]);router['get'](_0x52ba('0xd'),auth['isAuthenticated'](),controller[_0x52ba('0xe')]);router[_0x52ba('0xa')](_0x52ba('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x52ba('0x10'),auth['isAuthenticated'](),controller['getUnread']);router[_0x52ba('0xa')](_0x52ba('0x11'),auth[_0x52ba('0xb')](),controller[_0x52ba('0x12')]);router['get']('/:id/messages',auth[_0x52ba('0xb')](),controller['getMessages']);router[_0x52ba('0x13')]('/',auth[_0x52ba('0xb')](),controller[_0x52ba('0x14')]);router['post']('/:id/members',auth[_0x52ba('0xb')](),controller[_0x52ba('0x15')]);router[_0x52ba('0x13')]('/:id/messages',auth['isAuthenticated'](),controller[_0x52ba('0x16')]);router['put'](_0x52ba('0xf'),auth[_0x52ba('0xb')](),controller[_0x52ba('0x17')]);router['delete'](_0x52ba('0xf'),auth['isAuthenticated'](),controller[_0x52ba('0x18')]);router[_0x52ba('0x19')](_0x52ba('0x11'),auth[_0x52ba('0xb')](),controller[_0x52ba('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 586d4cd..0d00af3 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 _0x0102=['TEXT','long','out','exports','BOOLEAN','INTEGER','ENUM','STRING','DATE'];(function(_0x261cda,_0x450fc4){var _0x41da28=function(_0x1c4482){while(--_0x1c4482){_0x261cda['push'](_0x261cda['shift']());}};_0x41da28(++_0x450fc4);}(_0x0102,0x186));var _0x2010=function(_0x5a5400,_0x46b277){_0x5a5400=_0x5a5400-0x0;var _0x41c94e=_0x0102[_0x5a5400];return _0x41c94e;};'use strict';var Sequelize=require('sequelize');module[_0x2010('0x0')]={'closed':{'type':Sequelize[_0x2010('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2010('0x2')]},'ratingType':{'type':Sequelize[_0x2010('0x3')]('star','thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x2010('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2010('0x5')]},'disposition':{'type':Sequelize[_0x2010('0x4')]},'secondDisposition':{'type':Sequelize[_0x2010('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2010('0x4')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x2010('0x4')]},'osName':{'type':Sequelize[_0x2010('0x4')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x2010('0x4')]},'deviceVendor':{'type':Sequelize[_0x2010('0x4')]},'deviceType':{'type':Sequelize[_0x2010('0x4')]},'referer':{'type':Sequelize[_0x2010('0x6')]},'customerIp':{'type':Sequelize[_0x2010('0x4')]},'formData':{'type':Sequelize[_0x2010('0x6')](_0x2010('0x7'))},'read1stAt':{'type':Sequelize[_0x2010('0x5')]},'lastMsgAt':{'type':Sequelize[_0x2010('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x2010('0x3')]('in',_0x2010('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2010('0x4')]},'customerPort':{'type':Sequelize[_0x2010('0x4')]},'vidaooSessionId':{'type':Sequelize[_0x2010('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x2010('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x8603=['long','DATE','ENUM','out','exports','BOOLEAN','INTEGER','thumb','star','TEXT','STRING'];(function(_0x548c28,_0x3a0d82){var _0x42128c=function(_0x2fa786){while(--_0x2fa786){_0x548c28['push'](_0x548c28['shift']());}};_0x42128c(++_0x3a0d82);}(_0x8603,0x190));var _0x3860=function(_0x3f1879,_0x436c73){_0x3f1879=_0x3f1879-0x0;var _0x2873d1=_0x8603[_0x3f1879];return _0x2873d1;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'closed':{'type':Sequelize[_0x3860('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3860('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x3860('0x3')),'defaultValue':_0x3860('0x4')},'ratingMessage':{'type':Sequelize[_0x3860('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3860('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3860('0x6')]},'secondDisposition':{'type':Sequelize[_0x3860('0x6')]},'thirdDisposition':{'type':Sequelize[_0x3860('0x6')]},'note':{'type':Sequelize[_0x3860('0x6')]},'browserName':{'type':Sequelize[_0x3860('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x3860('0x6')]},'deviceVendor':{'type':Sequelize[_0x3860('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x3860('0x5')]},'customerIp':{'type':Sequelize[_0x3860('0x6')]},'formData':{'type':Sequelize['TEXT'](_0x3860('0x7'))},'read1stAt':{'type':Sequelize[_0x3860('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3860('0x9')]('in',_0x3860('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x3860('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x3860('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x3860('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 6a4d15a..262c2d3 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 _0x6542=['interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','show','model','keys','intersection','fields','attributes','length','includeAll','include','create','find','params','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','user','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','closed','attachmentUpload','originalname','basename','filename','file','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','close','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','User','format','%s%d','System','customer','Visitor','ContactId','agentIdentifier','website_alias','UserId','agentAlias','agent_alias','alias','fullname','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','filters','hasOwnProperty','nolimit','limit','sort','where','pick','ChatInteractionId','filter','$gte','split','rows','getMyMessages','secret','options','includeAgent','addTags','setTags','color','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','Messages','createdAt','read','get','mkdirSync','Chat','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','browserName','osName','referer','tail','existsSync','createReadStream','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','request-promise','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','offset','undefined','count','set','Content-Range','json','update','destroy','stack','name','send','render','merge','body','contact','agent'];(function(_0x222d09,_0x2f2eef){var _0x128368=function(_0x36374a){while(--_0x36374a){_0x222d09['push'](_0x222d09['shift']());}};_0x128368(++_0x2f2eef);}(_0x6542,0xa2));var _0x2654=function(_0x182a5f,_0x37d4a4){_0x182a5f=_0x182a5f-0x0;var _0x1d2d5e=_0x6542[_0x182a5f];return _0x1d2d5e;};'use strict';var rimraf=require(_0x2654('0x0'));var zipdir=require('zip-dir');var rp=require(_0x2654('0x1'));var moment=require(_0x2654('0x2'));var BPromise=require(_0x2654('0x3'));var Mustache=require('mustache');var util=require(_0x2654('0x4'));var path=require(_0x2654('0x5'));var ejs=require(_0x2654('0x6'));var fs=require('fs');var _=require(_0x2654('0x7'));var Redis=require(_0x2654('0x8'));var interaction=require(_0x2654('0x9'));var qs=require(_0x2654('0xa'));var pdf=require(_0x2654('0xb'));var logger=require(_0x2654('0xc'))(_0x2654('0xd'));var config=require('../../config/environment');var db=require(_0x2654('0xe'))['db'];config[_0x2654('0xf')]=_[_0x2654('0x10')](config[_0x2654('0xf')],{'host':_0x2654('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2654('0xf')]));require('./chatInteraction.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2654('0x12')][_0x2654('0x13')]({'port':0x232b});var client9004=jayson[_0x2654('0x12')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4fff13,_0xcfa822,_0x11e118,_0x2754da){return new BPromise(function(_0x2a7bdf,_0x3d539b){var _0x4daf87=_0x2754da||client;return _0x4daf87[_0x2654('0x14')](_0x4fff13,_0x11e118)[_0x2654('0x15')](function(_0x7d5f32){logger[_0x2654('0x16')](_0x2654('0x17'),_0xcfa822,_0x2654('0x18'));logger[_0x2654('0x19')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xcfa822,_0x2654('0x18'),JSON[_0x2654('0x1a')](_0x7d5f32));if(_0x7d5f32['error']){if(_0x7d5f32[_0x2654('0x1b')][_0x2654('0x1c')]===0x1f4){logger[_0x2654('0x1b')](_0x2654('0x17'),_0xcfa822,_0x7d5f32[_0x2654('0x1b')][_0x2654('0x1d')]);return _0x3d539b(_0x7d5f32['error'][_0x2654('0x1d')]);}logger[_0x2654('0x1b')](_0x2654('0x17'),_0xcfa822,_0x7d5f32[_0x2654('0x1b')]['message']);return _0x2a7bdf(_0x7d5f32['error'][_0x2654('0x1d')]);}else{logger[_0x2654('0x16')](_0x2654('0x17'),_0xcfa822,_0x2654('0x18'));_0x2a7bdf(_0x7d5f32[_0x2654('0x1e')][_0x2654('0x1d')]);}})[_0x2654('0x1f')](function(_0x16ef6d){logger[_0x2654('0x1b')](_0x2654('0x17'),_0xcfa822,_0x16ef6d);_0x3d539b(_0x16ef6d);});});}function respondWithStatusCode(_0x2b706e,_0x32c42c){_0x32c42c=_0x32c42c||0xcc;return function(_0x2546e3){if(_0x2546e3){return _0x2b706e['sendStatus'](_0x32c42c);}return _0x2b706e[_0x2654('0x20')](_0x32c42c)[_0x2654('0x21')]();};}function respondWithResult(_0x31d6a8,_0x16ee72){_0x16ee72=_0x16ee72||0xc8;return function(_0x4157b2){if(_0x4157b2){return _0x31d6a8['status'](_0x16ee72)['json'](_0x4157b2);}};}function respondWithFilteredResult(_0x5756f1,_0xc1dc5a){return function(_0x5d3b28){if(_0x5d3b28){var _0x58a998=typeof _0xc1dc5a[_0x2654('0x22')]===_0x2654('0x23')&&typeof _0xc1dc5a['limit']==='undefined';var _0x997488=_0x5d3b28[_0x2654('0x24')];var _0x555438=_0x58a998?0x0:_0xc1dc5a[_0x2654('0x22')];var _0x6b17f3=_0x58a998?_0x5d3b28[_0x2654('0x24')]:_0xc1dc5a['offset']+_0xc1dc5a['limit'];var _0x3ac481;if(_0x6b17f3>=_0x997488){_0x6b17f3=_0x997488;_0x3ac481=0xc8;}else{_0x3ac481=0xce;}_0x5756f1[_0x2654('0x20')](_0x3ac481);return _0x5756f1[_0x2654('0x25')](_0x2654('0x26'),_0x555438+'-'+_0x6b17f3+'/'+_0x997488)[_0x2654('0x27')](_0x5d3b28);}return null;};}function saveUpdates(_0x1d6ebb){return function(_0x30afe5){if(_0x30afe5){return _0x30afe5[_0x2654('0x28')](_0x1d6ebb)[_0x2654('0x15')](function(_0x2b4324){return _0x2b4324;});}return null;};}function removeEntity(_0x326b36){return function(_0x2c37fc){if(_0x2c37fc){return _0x2c37fc[_0x2654('0x29')]()['then'](function(){_0x326b36[_0x2654('0x20')](0xcc)[_0x2654('0x21')]();});}};}function handleEntityNotFound(_0x2928ab){return function(_0x760d8){if(!_0x760d8){_0x2928ab['sendStatus'](0x194);}return _0x760d8;};}function handleError(_0xab2d94,_0x2df6bb){_0x2df6bb=_0x2df6bb||0x1f4;return function(_0x31c067){logger[_0x2654('0x1b')](_0x31c067[_0x2654('0x2a')]);if(_0x31c067[_0x2654('0x2b')]){delete _0x31c067[_0x2654('0x2b')];}_0xab2d94[_0x2654('0x20')](_0x2df6bb)[_0x2654('0x2c')](_0x31c067);};}function getMustacheRender(_0x479261,_0xe70954){return Mustache[_0x2654('0x2d')](_0x479261,_[_0x2654('0x2e')](_0xe70954[_0x2654('0x2f')],{'contact':_0xe70954[_0x2654('0x30')],'message':_0xe70954[_0x2654('0x1d')],'agent':_0xe70954[_0x2654('0x31')],'interaction':_0xe70954[_0x2654('0x32')],'account':_0xe70954[_0x2654('0x33')]}))||'';}exports[_0x2654('0x34')]=function(_0x3ef121,_0x3f47b6){var _0xdd7639={};var _0x25dfda=_[_0x2654('0x35')](db[_0x2654('0x36')][_0x2654('0x37')],function(_0x241d20){return{'name':_0x241d20[_0x2654('0x38')],'type':_0x241d20[_0x2654('0x39')][_0x2654('0x3a')]};});_0xdd7639=qs[_0x2654('0x3b')](_0x25dfda,_0x3ef121);return interaction[_0x2654('0x3c')]('chat',_0x3ef121[_0x2654('0x3d')],_0x3ef121['user'],_0xdd7639,_0x25dfda)['then'](respondWithFilteredResult(_0x3f47b6,_0xdd7639))[_0x2654('0x1f')](handleError(_0x3f47b6,null));};exports[_0x2654('0x3e')]=function(_0x38865d,_0x39484e){var _0x42f7e1={'raw':![],'where':{'id':_0x38865d['params']['id']}},_0x49eef7={};_0x49eef7[_0x2654('0x3f')]=_[_0x2654('0x40')](db[_0x2654('0x36')][_0x2654('0x37')]);_0x49eef7[_0x2654('0x3d')]=_['keys'](_0x38865d[_0x2654('0x3d')]);_0x49eef7['filters']=_['intersection'](_0x49eef7[_0x2654('0x3f')],_0x49eef7[_0x2654('0x3d')]);_0x42f7e1['attributes']=_[_0x2654('0x41')](_0x49eef7[_0x2654('0x3f')],qs[_0x2654('0x42')](_0x38865d[_0x2654('0x3d')][_0x2654('0x42')]));_0x42f7e1[_0x2654('0x43')]=_0x42f7e1[_0x2654('0x43')][_0x2654('0x44')]?_0x42f7e1[_0x2654('0x43')]:_0x49eef7['model'];if(_0x38865d[_0x2654('0x3d')][_0x2654('0x45')]){_0x42f7e1[_0x2654('0x46')]=[{'all':!![]}];}_0x42f7e1=_[_0x2654('0x2e')]({},_0x42f7e1,_0x38865d['options']);return db['ChatInteraction']['find'](_0x42f7e1)[_0x2654('0x15')](handleEntityNotFound(_0x39484e,null))[_0x2654('0x15')](respondWithResult(_0x39484e,null))[_0x2654('0x1f')](handleError(_0x39484e,null));};exports[_0x2654('0x47')]=function(_0x36f662,_0x4fe9ca){return db['ChatInteraction'][_0x2654('0x47')](_0x36f662[_0x2654('0x2f')],{})[_0x2654('0x15')](respondWithResult(_0x4fe9ca,0xc9))[_0x2654('0x1f')](handleError(_0x4fe9ca,null));};exports['update']=function(_0x2cedab,_0x5e762e){if(_0x2cedab[_0x2654('0x2f')]['id']){delete _0x2cedab[_0x2654('0x2f')]['id'];}return db['ChatInteraction'][_0x2654('0x48')]({'where':{'id':_0x2cedab[_0x2654('0x49')]['id']}})[_0x2654('0x15')](handleEntityNotFound(_0x5e762e,null))[_0x2654('0x15')](saveUpdates(_0x2cedab['body'],null))[_0x2654('0x15')](respondWithResult(_0x5e762e,null))[_0x2654('0x1f')](handleError(_0x5e762e,null));};exports[_0x2654('0x29')]=function(_0x43d9eb,_0x51b504){return db['ChatInteraction'][_0x2654('0x48')]({'where':{'id':_0x43d9eb[_0x2654('0x49')]['id']}})[_0x2654('0x15')](handleEntityNotFound(_0x51b504,null))[_0x2654('0x15')](removeEntity(_0x51b504,null))[_0x2654('0x1f')](handleError(_0x51b504,null));};exports[_0x2654('0x4a')]=function(_0x4084e4,_0x2ee6cc){return db[_0x2654('0x36')][_0x2654('0x4a')]()[_0x2654('0x15')](respondWithResult(_0x2ee6cc,null))[_0x2654('0x1f')](handleError(_0x2ee6cc,null));};exports['createVidaooSession']=function(_0x1855b7,_0x4442ae){var _0xe493bb=_0x1855b7[_0x2654('0x49')]['id'];var _0x19299e;var _0x512642;var _0xa23968;return db[_0x2654('0x36')][_0x2654('0x4b')]({'where':{'id':_0xe493bb}})['then'](function(_0x517b4b){_0x19299e=_0x517b4b;return db[_0x2654('0x4c')][_0x2654('0x4b')]({'where':{'id':_0x517b4b[_0x2654('0x4d')]},'attributes':['id',_0x2654('0x4e'),_0x2654('0x4f'),_0x2654('0x50'),_0x2654('0x51'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0xd330e3){if(_0xd330e3&&_0xd330e3[_0x2654('0x4e')]&&_0xd330e3[_0x2654('0x4f')]){_0x512642=_0xd330e3;var _0x4e2707={'interaction':{'id':_0xe493bb},'agent':{'id':_0x1855b7[_0x2654('0x52')]['id'],'name':_0x1855b7[_0x2654('0x52')][_0x2654('0x2b')],'fullname':_0x1855b7['user']['fullname'],'email':_0x1855b7[_0x2654('0x52')][_0x2654('0x53')]},'contact':_0x1855b7[_0x2654('0x2f')][_0x2654('0x30')],'account':_0x1855b7[_0x2654('0x2f')]['account']};var _0x3468cb={'rejectUnauthorized':![],'method':_0x2654('0x54'),'url':_0x2654('0x55'),'headers':{'X-APIKEY':_0xd330e3[_0x2654('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1855b7[_0x2654('0x52')][_0x2654('0x53')]],'buttons':null,'topic':_0x512642['vidaooTopic'],'note':_[_0x2654('0x56')](_0x512642[_0x2654('0x51')])?null:getMustacheRender(_0x512642[_0x2654('0x51')],_0x4e2707),'metadata':null},'redirect':_0x2654('0x57'),'json':!![]};try{if(!_['isNull'](_0x512642[_0x2654('0x58')])){var _0x1006c7=getMustacheRender(_0x512642[_0x2654('0x58')],_0x4e2707);var _0x6fee68=JSON[_0x2654('0x59')](_0x1006c7);_0x3468cb[_0x2654('0x2f')][_0x2654('0x5a')]=_0x6fee68;}}catch(_0xfad13a){throw new db[(_0x2654('0x5b'))][(_0x2654('0x5c'))](_0x2654('0x5d'));}return rp(_0x3468cb);}else{throw new db[(_0x2654('0x5b'))]['ValidationError'](_0x2654('0x5e'));}})[_0x2654('0x15')](function(_0x145064){_0xa23968=_0x145064;if(_0xa23968['id']){var _0x234abc={'body':_0xa23968[_0x2654('0x5f')],'ChatWebsiteId':_0x512642['id'],'ChatInteractionId':_0x19299e['id'],'direction':_0x2654('0x60'),'UserId':_0x1855b7[_0x2654('0x52')]['id']};return db[_0x2654('0x61')][_0x2654('0x47')](_0x234abc,{});}else{throw new db[(_0x2654('0x5b'))]['ValidationError'](_0x2654('0x62'));}})[_0x2654('0x15')](function(){return _0x19299e[_0x2654('0x63')]({'vidaooSessionId':_0xa23968['id']});})[_0x2654('0x15')](respondWithResult(_0x4442ae,null))['catch'](handleError(_0x4442ae,null));};exports[_0x2654('0x64')]=function(_0xa01b80,_0x457983){if(_0xa01b80['body']['id']){delete _0xa01b80[_0x2654('0x2f')]['id'];}return db[_0x2654('0x36')][_0x2654('0x48')]({'where':{'id':_0xa01b80['params']['id']},'include':[{'model':db[_0x2654('0x65')],'as':_0x2654('0x66')}]})[_0x2654('0x15')](handleEntityNotFound(_0x457983,null))[_0x2654('0x15')](saveUpdates(_0xa01b80['body'],null))[_0x2654('0x15')](respondWithResult(_0x457983,null))[_0x2654('0x1f')](handleError(_0x457983,null));};exports[_0x2654('0x67')]=function(_0x3e02eb,_0x403740){if(_0x3e02eb[_0x2654('0x2f')]['id']){delete _0x3e02eb[_0x2654('0x2f')]['id'];}return db[_0x2654('0x36')][_0x2654('0x48')]({'where':{'id':_0x3e02eb[_0x2654('0x49')]['id']}})[_0x2654('0x15')](function(_0x4570fe){if(!_0x4570fe){logger[_0x2654('0x1b')](_0x2654('0x68'),_0x2654('0x67'),0x194,_0x2654('0x69'));_0x403740[_0x2654('0x6a')](0x194);}else{if(_0x4570fe['UserId']){throw new db[(_0x2654('0x5b'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x4570fe;})['then'](function(_0x5cad4b){if(_0x5cad4b){return _0x5cad4b[_0x2654('0x28')]({'closed':_0x3e02eb['body'][_0x2654('0x6b')],'disposition':_0x3e02eb[_0x2654('0x2f')]['disposition']})[_0x2654('0x15')](function(_0x268bcf){return _0x268bcf;});}})[_0x2654('0x15')](function(){return respondWithRpcPromise('AbandonInteraction',_0x2654('0x67'),_0x3e02eb['body'],client9004);})['then'](respondWithResult(_0x403740,null))[_0x2654('0x1f')](handleError(_0x403740,null));};exports[_0x2654('0x6c')]=function(_0x577d0f,_0x20eb8d){_0x577d0f[_0x2654('0x2f')]['name']=_0x577d0f['file'][_0x2654('0x6d')];_0x577d0f[_0x2654('0x2f')][_0x2654('0x6e')]=_0x577d0f['file'][_0x2654('0x6f')];_0x577d0f[_0x2654('0x2f')]['type']=_0x577d0f[_0x2654('0x70')][_0x2654('0x71')];return db['Attachment'][_0x2654('0x47')](_0x577d0f[_0x2654('0x2f')])[_0x2654('0x15')](respondWithResult(_0x20eb8d,0xc9))['catch'](handleError(_0x20eb8d,null));};exports[_0x2654('0x72')]=function(_0x585304,_0x137389){return db[_0x2654('0x36')][_0x2654('0x4b')]({'where':{'id':_0x585304[_0x2654('0x49')]['id']},'raw':!![]})[_0x2654('0x15')](handleEntityNotFound(_0x137389,null))[_0x2654('0x15')](function(_0x35bcbc){if(_0x35bcbc){if(_0x35bcbc[_0x2654('0x6b')]){return _0x137389['status'](0x193)[_0x2654('0x27')]({'status':0x193,'message':_0x2654('0x73')});}return db[_0x2654('0x74')][_0x2654('0x4b')]({'where':{'id':_0x585304[_0x2654('0x3d')][_0x2654('0x75')]},'raw':!![]})[_0x2654('0x15')](handleEntityNotFound(_0x137389,null));}})[_0x2654('0x15')](function(_0x17178e){if(_0x17178e){var _0x51862b=_0x17178e[_0x2654('0x76')]!==null;var _0x44207a=path[_0x2654('0x77')](config['root'],_0x2654('0x78'));if(_0x51862b){_0x44207a=path['join'](_0x44207a,'offline-chat/');}var _0x398dee=path[_0x2654('0x77')](_0x44207a,_0x17178e[_0x2654('0x6e')]);return _0x137389[_0x2654('0x79')](_0x398dee);}})['catch'](handleError(_0x137389,null));};exports[_0x2654('0x7a')]=function(_0x3b5559,_0x3a3569){var _0x1f0c21=null;var _0x1c96d2=null;var _0x17ac89=null;if(_0x3b5559[_0x2654('0x2f')]['id']){delete _0x3b5559[_0x2654('0x2f')]['id'];}if(_0x3b5559[_0x2654('0x2f')][_0x2654('0x7b')]){_0x17ac89=path[_0x2654('0x77')](config[_0x2654('0x7c')],_0x2654('0x7d'),util['format'](_0x2654('0x7e'),Date[_0x2654('0x7f')]()));_0x3b5559[_0x2654('0x2f')][_0x2654('0x80')]=_0x17ac89;}return db[_0x2654('0x36')]['find']({'where':{'id':_0x3b5559[_0x2654('0x49')]['id']},'include':[{'model':db[_0x2654('0x61')],'as':'Messages','include':[{'model':db[_0x2654('0x81')],'as':'User'}]}]})[_0x2654('0x15')](handleEntityNotFound(_0x3a3569,null))[_0x2654('0x15')](saveUpdates(_0x3b5559[_0x2654('0x2f')],null))[_0x2654('0x15')](function(_0x45c1b4){if(_0x45c1b4){_0x1f0c21=_0x45c1b4;return db[_0x2654('0x4c')][_0x2654('0x48')]({'where':{'id':_0x1f0c21['ChatWebsiteId']}});}})[_0x2654('0x15')](function(_0xde9588){if(_0xde9588){_0x1c96d2=_0xde9588;return db[_0x2654('0x65')][_0x2654('0x48')]({'where':{'id':_0x1f0c21['ContactId']}});}})['then'](function(_0x1d11e0){if(_0x1d11e0){if(_0x17ac89){var _0x22cbbc=null;for(var _0x63313f=0x1;_0x63313f<_0x1f0c21['Messages']['length'];++_0x63313f){_0x22cbbc=_0x1f0c21['Messages'][_0x63313f];var _0x4ac1cf=_0x22cbbc['UserId']?util[_0x2654('0x82')](_0x2654('0x83'),_0x1c96d2['agentAlias'],_0x22cbbc['UserId']):_0x2654('0x84');var _0x14ee15=_0x3b5559[_0x2654('0x2f')][_0x2654('0x85')]||util[_0x2654('0x82')](_0x2654('0x83'),_0x2654('0x86'),_0x22cbbc[_0x2654('0x87')]);switch(_0x1c96d2[_0x2654('0x88')]){case _0x2654('0x89'):_0x4ac1cf=_0x22cbbc[_0x2654('0x8a')]?util['format'](_0x2654('0x83'),_0x1c96d2[_0x2654('0x8b')],_0x22cbbc[_0x2654('0x8a')]):'System';break;case _0x2654('0x8c'):_0x4ac1cf=_0x22cbbc[_0x2654('0x8a')]?_0x22cbbc[_0x2654('0x81')][_0x2654('0x8d')]||_0x22cbbc[_0x2654('0x81')][_0x2654('0x8e')]:_0x2654('0x84');break;case _0x2654('0x8f'):_0x4ac1cf=_0x22cbbc[_0x2654('0x8a')]?_0x22cbbc[_0x2654('0x81')][_0x2654('0x8e')]:'System';break;default:_0x4ac1cf=_0x22cbbc[_0x2654('0x8a')]?util[_0x2654('0x82')](_0x2654('0x83'),_0x1c96d2[_0x2654('0x8b')],_0x22cbbc[_0x2654('0x8a')]):_0x2654('0x84');}var _0x8424c7=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x22cbbc['createdAt'])['format'](_0x2654('0x90')),_0x22cbbc['direction']==='in'?_0x14ee15:_0x4ac1cf,_0x22cbbc[_0x2654('0x2f')]);if(!_0x22cbbc['secret']){fs[_0x2654('0x91')](_0x17ac89,_0x8424c7);}}return db[_0x2654('0x92')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x2654('0x93')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x4767d6){if(!_0x4767d6||!_0x4767d6[_0x2654('0x94')]||!_0x3b5559[_0x2654('0x2f')])return _0x1f0c21;var _0x199d4d=_0x4767d6[_0x2654('0x95')]();return respondWithRpcPromise(_0x2654('0x96'),_0x2654('0x97'),{'account':_0x199d4d,'message':{'from':util['format'](_0x2654('0x98'),_0x4767d6[_0x2654('0x2b')],_0x4767d6[_0x2654('0x53')]||_0x4767d6[_0x2654('0x94')][_0x2654('0x52')]),'to':_0x3b5559[_0x2654('0x2f')][_0x2654('0x7b')],'subject':'Mail\x20Transcript','text':util[_0x2654('0x82')](_0x2654('0x99'),_0x3b5559[_0x2654('0x2f')][_0x2654('0x7b')]),'attachments':[{'path':_0x17ac89}]}})[_0x2654('0x15')](function(){return _0x1f0c21;})[_0x2654('0x1f')](function(_0x2ad9c3){logger[_0x2654('0x1b')](_0x2ad9c3);});})[_0x2654('0x15')](respondWithStatusCode(_0x3a3569,0xc8))[_0x2654('0x1f')](handleError(_0x3a3569,null));};exports[_0x2654('0x9a')]=function(_0x1839a4,_0x391154){return db[_0x2654('0x61')]['find']({'where':{'id':_0x1839a4[_0x2654('0x49')]['id']}})['then'](handleEntityNotFound(_0x391154,null))[_0x2654('0x15')](function(_0x1c6d56){if(_0x1c6d56){return _0x1c6d56['addMessage'](_0x1839a4[_0x2654('0x2f')][_0x2654('0x9b')],_[_0x2654('0x9c')](_0x1839a4[_0x2654('0x2f')],[_0x2654('0x9b'),'id'])||{});}})[_0x2654('0x15')](respondWithResult(_0x391154,null))[_0x2654('0x1f')](handleError(_0x391154,null));};exports['getMessages']=function(_0x190e73,_0x259647){var _0x51bc9c={'raw':![],'where':{}};var _0x184bbe={};var _0x2f2a74={'count':0x0,'rows':[]};return db[_0x2654('0x36')][_0x2654('0x4b')]({'where':{'id':_0x190e73['params']['id']}})[_0x2654('0x15')](handleEntityNotFound(_0x259647,null))[_0x2654('0x15')](function(_0x156842){if(_0x156842){_0x184bbe['model']=_[_0x2654('0x40')](db[_0x2654('0x61')][_0x2654('0x37')]);_0x184bbe[_0x2654('0x3d')]=_['keys'](_0x190e73['query']);_0x184bbe[_0x2654('0x9d')]=_[_0x2654('0x41')](_0x184bbe[_0x2654('0x3f')],_0x184bbe[_0x2654('0x3d')]);_0x51bc9c[_0x2654('0x43')]=_[_0x2654('0x41')](_0x184bbe[_0x2654('0x3f')],qs[_0x2654('0x42')](_0x190e73[_0x2654('0x3d')]['fields']));_0x51bc9c['attributes']=_0x51bc9c[_0x2654('0x43')][_0x2654('0x44')]?_0x51bc9c[_0x2654('0x43')]:_0x184bbe[_0x2654('0x3f')];if(!_0x190e73[_0x2654('0x3d')][_0x2654('0x9e')](_0x2654('0x9f'))){_0x51bc9c['limit']=qs[_0x2654('0xa0')](_0x190e73[_0x2654('0x3d')][_0x2654('0xa0')]);_0x51bc9c['offset']=qs[_0x2654('0x22')](_0x190e73[_0x2654('0x3d')][_0x2654('0x22')]);}_0x51bc9c['order']=qs['sort'](_0x190e73[_0x2654('0x3d')][_0x2654('0xa1')]);_0x51bc9c[_0x2654('0xa2')]=qs[_0x2654('0x9d')](_[_0x2654('0xa3')](_0x190e73[_0x2654('0x3d')],_0x184bbe[_0x2654('0x9d')]));_0x51bc9c[_0x2654('0xa2')][_0x2654('0xa4')]=_0x156842['id'];if(_0x190e73[_0x2654('0x3d')]['filter']){_0x51bc9c[_0x2654('0xa2')]=_[_0x2654('0x2e')](_0x51bc9c[_0x2654('0xa2')],{'$or':_[_0x2654('0x35')](_0x51bc9c[_0x2654('0x43')],function(_0x5f03ab){var _0x53dcaa={};_0x53dcaa[_0x5f03ab]={'$like':'%'+_0x190e73[_0x2654('0x3d')][_0x2654('0xa5')]+'%'};return _0x53dcaa;})});}if(_0x190e73[_0x2654('0x3d')][_0x2654('0xa6')]){var _0x47c9a9=_0x190e73['query'][_0x2654('0xa6')][_0x2654('0xa7')](',');var _0x4d1f2c={};_0x4d1f2c[_0x47c9a9[0x0]]={'$gte':moment(_0x47c9a9[0x1])[_0x2654('0x82')]('YYYY-MM-DD\x20HH:mm:ss')};_0x51bc9c[_0x2654('0xa2')]=_['merge'](_0x51bc9c[_0x2654('0xa2')],_0x4d1f2c);}_0x51bc9c=_[_0x2654('0x2e')]({},_0x51bc9c,_0x190e73['options']);return db[_0x2654('0x61')][_0x2654('0x24')]({'where':_0x51bc9c['where']})[_0x2654('0x15')](function(_0x6e45a8){_0x2f2a74['count']=_0x6e45a8;if(_0x190e73[_0x2654('0x3d')]['includeAll']){_0x51bc9c[_0x2654('0x46')]=[{'all':!![]}];}return db[_0x2654('0x61')]['findAll'](_0x51bc9c);})[_0x2654('0x15')](function(_0x551fc9){_0x2f2a74[_0x2654('0xa8')]=_0x551fc9;return _0x2f2a74;});}})[_0x2654('0x15')](respondWithFilteredResult(_0x259647,_0x51bc9c))['catch'](handleError(_0x259647,null));};exports[_0x2654('0xa9')]=function(_0x4a33cb,_0x370962){var _0x475d10={'where':{}},_0x15a761={},_0x264dde={'count':0x0,'rows':[]};return db[_0x2654('0x36')]['findOne']({'where':{'id':_0x4a33cb['params']['id']}})[_0x2654('0x15')](handleEntityNotFound(_0x370962,null))[_0x2654('0x15')](function(_0x5d6faa){if(_0x5d6faa){_0x15a761[_0x2654('0x3f')]=_[_0x2654('0x40')](db[_0x2654('0x61')][_0x2654('0x37')]);_0x15a761[_0x2654('0x3d')]=_['keys'](_0x4a33cb[_0x2654('0x3d')]);_0x15a761[_0x2654('0x9d')]=_[_0x2654('0x41')](_0x15a761['model'],_0x15a761[_0x2654('0x3d')]);_0x475d10[_0x2654('0x43')]=_[_0x2654('0x41')](_0x15a761[_0x2654('0x3f')],qs[_0x2654('0x42')](_0x4a33cb[_0x2654('0x3d')][_0x2654('0x42')]));_0x475d10[_0x2654('0x43')]=_0x475d10['attributes'][_0x2654('0x44')]?_0x475d10[_0x2654('0x43')]:_0x15a761[_0x2654('0x3f')];if(!_0x4a33cb['query'][_0x2654('0x9e')]('nolimit')){_0x475d10['limit']=qs[_0x2654('0xa0')](_0x4a33cb[_0x2654('0x3d')]['limit']);_0x475d10['offset']=qs['offset'](_0x4a33cb[_0x2654('0x3d')]['offset']);}_0x475d10['order']=qs[_0x2654('0xa1')](_0x4a33cb[_0x2654('0x3d')]['sort']);_0x475d10[_0x2654('0xa2')]=qs[_0x2654('0x9d')](_[_0x2654('0xa3')](_0x4a33cb[_0x2654('0x3d')],_0x15a761[_0x2654('0x9d')]));_0x475d10[_0x2654('0xa2')][_0x2654('0xa4')]=_0x5d6faa['id'];if(_0x4a33cb[_0x2654('0x3d')]['filter']){_0x475d10[_0x2654('0xa2')]=_[_0x2654('0x2e')](_0x475d10[_0x2654('0xa2')],{'$or':_[_0x2654('0x35')](_0x475d10[_0x2654('0x43')],function(_0xcf85d2){var _0x20c2c0={};_0x20c2c0[_0xcf85d2]={'$like':'%'+_0x4a33cb[_0x2654('0x3d')]['filter']+'%'};return _0x20c2c0;})});}_0x475d10['where'][_0x2654('0xaa')]=![];if(_0x4a33cb[_0x2654('0x3d')]['id']){_0x475d10[_0x2654('0xa2')]['id']={'$gt':_0x4a33cb[_0x2654('0x3d')]['id']};}_0x475d10=_[_0x2654('0x2e')]({},_0x475d10,_0x4a33cb[_0x2654('0xab')]);return db[_0x2654('0x61')][_0x2654('0x24')]({'where':_0x475d10[_0x2654('0xa2')]})['then'](function(_0x5ba1bb){_0x264dde[_0x2654('0x24')]=_0x5ba1bb;_0x475d10[_0x2654('0x46')]=[];if(_0x4a33cb['query'][_0x2654('0xac')]){_0x475d10[_0x2654('0x46')]['push']({'model':db[_0x2654('0x81')],'as':_0x2654('0x81'),'attributes':['id',_0x2654('0x8e'),_0x2654('0x8d')]});}if(_0x4a33cb[_0x2654('0x3d')]['includeAll']){_0x475d10[_0x2654('0x46')]=[{'all':!![]}];}return db[_0x2654('0x61')][_0x2654('0x3c')](_0x475d10);})['then'](function(_0x2223ab){_0x264dde[_0x2654('0xa8')]=_0x2223ab;return _0x264dde;});}})[_0x2654('0x15')](respondWithFilteredResult(_0x370962,_0x475d10))[_0x2654('0x1f')](handleError(_0x370962,null));};exports[_0x2654('0xad')]=function(_0x2f349e,_0x4a2539){return db['ChatInteraction'][_0x2654('0x48')]({'where':{'id':_0x2f349e[_0x2654('0x49')]['id']}})[_0x2654('0x15')](handleEntityNotFound(_0x4a2539,null))[_0x2654('0x15')](function(_0x567b61){if(_0x567b61){return _0x567b61[_0x2654('0xae')](_0x2f349e[_0x2654('0x2f')][_0x2654('0x9b')],_[_0x2654('0x9c')](_0x2f349e[_0x2654('0x2f')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x2654('0x3c')]({'attributes':['id','name',_0x2654('0xaf')],'where':{'id':_0x2f349e['body'][_0x2654('0x9b')]}});})[_0x2654('0x15')](function(_0x4a796f){socket['emit']('chatInteractionTags:save',{'id':Number(_0x2f349e[_0x2654('0x49')]['id']),'tags':_0x4a796f||[]});return{'id':Number(_0x2f349e[_0x2654('0x49')]['id']),'tags':_0x4a796f||[]};});}})[_0x2654('0x15')](respondWithResult(_0x4a2539,null))[_0x2654('0x1f')](handleError(_0x4a2539,null));};exports[_0x2654('0xb0')]=function(_0xce4f0d,_0x148c18){return db[_0x2654('0x36')][_0x2654('0x48')]({'where':{'id':_0xce4f0d[_0x2654('0x49')]['id']}})[_0x2654('0x15')](handleEntityNotFound(_0x148c18,null))[_0x2654('0x15')](function(_0x882d20){if(_0x882d20){return _0x882d20[_0x2654('0xb0')](_0xce4f0d[_0x2654('0x3d')][_0x2654('0x9b')]);}})[_0x2654('0x15')](respondWithStatusCode(_0x148c18,null))[_0x2654('0x1f')](handleError(_0x148c18,null));};exports[_0x2654('0x79')]=function(_0x2a592e,_0x20ee3e){var _0x24c21f=moment()[_0x2654('0xb1')]()[_0x2654('0xb2')]();var _0x38e4ad=path['join'](config[_0x2654('0x7c')],_0x2654('0xb3'),_0x2654('0xb4'),_0x2654('0xb5'));var _0x472a42=path[_0x2654('0x77')](config[_0x2654('0x7c')],'server',_0x2654('0xb4'),_0x2654('0xb6'));var _0x301215=path[_0x2654('0x77')](_0x38e4ad,_0x24c21f);var _0x129851=util[_0x2654('0x82')](_0x2654('0xb7'),_0x2a592e[_0x2654('0x49')]['id'],_0x24c21f);var _0x3e42fb=path['join'](_0x38e4ad,_0x129851);var _0x44abce=[];_0x44abce[_0x2654('0xb8')]({'model':db[_0x2654('0x81')],'as':_0x2654('0x81'),'attributes':['id',_0x2654('0x8e')],'raw':!![]});_0x44abce[_0x2654('0xb8')]({'model':db[_0x2654('0x65')],'as':_0x2654('0x66'),'attributes':['id',_0x2654('0xb9'),_0x2654('0xba')],'raw':!![]});if(_0x2a592e[_0x2654('0x3d')][_0x2654('0xb6')]){_0x44abce['push']({'model':db[_0x2654('0x74')],'as':_0x2654('0x74'),'raw':!![]});}var _0x3953fd=[{'model':db[_0x2654('0x61')],'as':_0x2654('0xbb'),'attributes':['id','body',_0x2654('0xbc'),'direction','secret',_0x2654('0xbd')],'include':_0x44abce}];_0x3953fd[_0x2654('0xb8')]({'model':db[_0x2654('0x4c')],'as':'Account','attributes':['id',_0x2654('0x2b')]});_0x3953fd[_0x2654('0xb8')]({'model':db[_0x2654('0x81')],'as':'Owner','attributes':['id',_0x2654('0x8e')]});return db[_0x2654('0x36')]['find']({'where':{'id':_0x2a592e['params']['id']},'include':_0x3953fd})[_0x2654('0x15')](handleEntityNotFound(_0x20ee3e,null))['then'](function(_0xdf91d9){if(_0xdf91d9){var _0xf118c5=_0xdf91d9[_0x2654('0xbe')]({'plain':!![]});fs[_0x2654('0xbf')](_0x301215);var _0x38791f={'channel':_0x2654('0xc0'),'account':_0xf118c5['Account']['name'],'agent':_0xf118c5[_0x2654('0xc1')]?_0xf118c5[_0x2654('0xc1')]['fullname']:_0x2654('0xc2'),'createdAt':moment(_0xf118c5[_0x2654('0xbc')])['format'](_0x2654('0xc3'))[_0x2654('0xb2')](),'closedAt':_0xf118c5[_0x2654('0x6b')]?moment(_0xf118c5['closedAt'])[_0x2654('0x82')](_0x2654('0xc3'))[_0x2654('0xb2')]():'','disposition':_0xf118c5[_0x2654('0xc4')],'chatInfo':{'browser':_0xf118c5[_0x2654('0xc5')],'os':_0xf118c5[_0x2654('0xc6')],'referer':_0xf118c5[_0x2654('0xc7')],'customerIp':_0xf118c5['customerIp'],'customerPort':_0xf118c5['customerPort']?_0xf118c5['customerPort']:_0x2654('0xc2')},'messages':_(_0xf118c5[_0x2654('0xbb')])[_0x2654('0xc8')]()[_0x2654('0xa5')]({'secret':![]})[_0x2654('0x35')](function(_0x3e5828){if(_0x3e5828[_0x2654('0x74')]){var _0x51ef61=path[_0x2654('0x77')](_0x472a42,_0x3e5828[_0x2654('0x74')][_0x2654('0x6e')]);if(fs[_0x2654('0xc9')](_0x51ef61)){fs[_0x2654('0xca')](_0x51ef61)['pipe'](fs[_0x2654('0xcb')](path['join'](_0x301215,_0x3e5828[_0x2654('0x74')][_0x2654('0x6e')])));}}return{'date':moment(_0x3e5828[_0x2654('0xbc')])[_0x2654('0x82')](_0x2654('0xc3'))['toString'](),'sender':_0x3e5828['direction']===_0x2654('0x60')?_0x3e5828['User']?_0x3e5828['User'][_0x2654('0x8e')]:'System':_0x3e5828['Contact'][_0x2654('0xb9')]+(_0x3e5828[_0x2654('0x66')][_0x2654('0xba')]?'\x20'+_0x3e5828[_0x2654('0x66')][_0x2654('0xba')]:''),'body':_0x3e5828[_0x2654('0x74')]?_0x3e5828[_0x2654('0x74')]['basename']:_0x3e5828[_0x2654('0x2f')],'direction':_0x3e5828['direction']===_0x2654('0x60')?'A':'C','secret':_0x3e5828['secret'],'read':_0x3e5828[_0x2654('0xbd')],'attachment':_0x3e5828[_0x2654('0x74')]};})[_0x2654('0xcc')]()};return ejs[_0x2654('0xcd')](path['join'](config[_0x2654('0x7c')],'server',_0x2654('0xce'),_0x2654('0xcf')),{'interaction':_0x38791f})[_0x2654('0x15')](function(_0x387d17){var _0x9c006c=path[_0x2654('0x77')](_0x301215,_0x2654('0xd0')+_0xf118c5['id']+'-'+_0x24c21f+_0x2654('0xd1'));var _0x5d97eb={'path':_0x9c006c,'channel':_0x2654('0xc0'),'interactionId':_0xf118c5['id']};return pdf['createPdfFromHTML'](_0x387d17,_0x5d97eb);})[_0x2654('0x15')](function(){return new Promise(function(_0x373bc4,_0x5e348a){zipdir(_0x301215,{'saveTo':_0x3e42fb},function(_0x9f84b4,_0x4ab1d5){if(_0x9f84b4)return _0x5e348a(_0x9f84b4);return _0x373bc4(_0x4ab1d5);});})[_0x2654('0x15')](function(){return new BPromise(function(_0x4c25a1,_0x87db7c){rimraf(_0x301215,function(_0x51d7b9){if(_0x51d7b9)_0x87db7c(_0x51d7b9);return _0x4c25a1();});});})[_0x2654('0x15')](function(){return _0x20ee3e[_0x2654('0x79')](_0x3e42fb,_0x129851,function(_0x1dc0df){if(_0x1dc0df){logger[_0x2654('0x1b')](_0x2654('0xd2'),_0x1dc0df);}else{fs[_0x2654('0xd3')](_0x3e42fb);}});});});}else{return _0x20ee3e[_0x2654('0x6a')](0xc8);}})[_0x2654('0x1f')](handleError(_0x20ee3e,null));}; \ No newline at end of file +var _0xe4fd=['Tag','emit','chatInteractionTags:save','removeTags','toString','tmp','server','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','N.A.','closedAt','browserName','customerIp','customerPort','tail','existsSync','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','client','http','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','merge','body','agent','interaction','account','map','rawAttributes','type','key','getOptions','findAll','chat','user','keys','ChatInteraction','filters','intersection','model','fields','length','attributes','query','includeAll','include','find','create','params','describe','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','contact','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','parse','Sequelize','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','findOne','join','root','offline-chat/','download','close','server/files/chat/upload/','format','now','pathTranscript','Messages','User','ContactId','%s%d','System','agentIdentifier','agentAlias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','\x22%s\x22\x20<%s>','Mail\x20Transcript','mailTranscript','addMessage','ids','omit','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','order','ChatInteractionId','includeAgent','push','addTags','setTags'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0xe4fd,0x1af));var _0xde4f=function(_0x136420,_0x29e998){_0x136420=_0x136420-0x0;var _0x5999f5=_0xe4fd[_0x136420];return _0x5999f5;};'use strict';var rimraf=require(_0xde4f('0x0'));var zipdir=require(_0xde4f('0x1'));var rp=require(_0xde4f('0x2'));var moment=require(_0xde4f('0x3'));var BPromise=require(_0xde4f('0x4'));var Mustache=require(_0xde4f('0x5'));var util=require(_0xde4f('0x6'));var path=require(_0xde4f('0x7'));var ejs=require(_0xde4f('0x8'));var fs=require('fs');var _=require(_0xde4f('0x9'));var Redis=require(_0xde4f('0xa'));var interaction=require(_0xde4f('0xb'));var qs=require(_0xde4f('0xc'));var pdf=require(_0xde4f('0xd'));var logger=require(_0xde4f('0xe'))(_0xde4f('0xf'));var config=require(_0xde4f('0x10'));var db=require('../../mysqldb')['db'];config[_0xde4f('0x11')]=_[_0xde4f('0x12')](config[_0xde4f('0x11')],{'host':_0xde4f('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')[_0xde4f('0x14')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0xde4f('0x15')][_0xde4f('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x368002,_0x5c753a,_0x236a6b,_0x157dfc){return new BPromise(function(_0x553681,_0x13a188){var _0x26039=_0x157dfc||client;return _0x26039[_0xde4f('0x17')](_0x368002,_0x236a6b)['then'](function(_0x347676){logger[_0xde4f('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5c753a,_0xde4f('0x19'));logger[_0xde4f('0x1a')](_0xde4f('0x1b'),_0x5c753a,_0xde4f('0x19'),JSON[_0xde4f('0x1c')](_0x347676));if(_0x347676[_0xde4f('0x1d')]){if(_0x347676[_0xde4f('0x1d')][_0xde4f('0x1e')]===0x1f4){logger[_0xde4f('0x1d')](_0xde4f('0x1f'),_0x5c753a,_0x347676[_0xde4f('0x1d')]['message']);return _0x13a188(_0x347676[_0xde4f('0x1d')]['message']);}logger[_0xde4f('0x1d')](_0xde4f('0x1f'),_0x5c753a,_0x347676[_0xde4f('0x1d')][_0xde4f('0x20')]);return _0x553681(_0x347676[_0xde4f('0x1d')][_0xde4f('0x20')]);}else{logger[_0xde4f('0x18')](_0xde4f('0x1f'),_0x5c753a,_0xde4f('0x19'));_0x553681(_0x347676[_0xde4f('0x21')]['message']);}})[_0xde4f('0x22')](function(_0x580618){logger[_0xde4f('0x1d')](_0xde4f('0x1f'),_0x5c753a,_0x580618);_0x13a188(_0x580618);});});}function respondWithStatusCode(_0x311251,_0x11a013){_0x11a013=_0x11a013||0xcc;return function(_0x22d3b1){if(_0x22d3b1){return _0x311251[_0xde4f('0x23')](_0x11a013);}return _0x311251[_0xde4f('0x24')](_0x11a013)[_0xde4f('0x25')]();};}function respondWithResult(_0x1b915d,_0x1533dd){_0x1533dd=_0x1533dd||0xc8;return function(_0x1299d4){if(_0x1299d4){return _0x1b915d[_0xde4f('0x24')](_0x1533dd)[_0xde4f('0x26')](_0x1299d4);}};}function respondWithFilteredResult(_0x2d5108,_0x48b966){return function(_0x35b3a1){if(_0x35b3a1){var _0x115c44=typeof _0x48b966[_0xde4f('0x27')]===_0xde4f('0x28')&&typeof _0x48b966[_0xde4f('0x29')]===_0xde4f('0x28');var _0x559c4f=_0x35b3a1[_0xde4f('0x2a')];var _0x85d13=_0x115c44?0x0:_0x48b966['offset'];var _0x284cd3=_0x115c44?_0x35b3a1[_0xde4f('0x2a')]:_0x48b966[_0xde4f('0x27')]+_0x48b966[_0xde4f('0x29')];var _0x75b5e5;if(_0x284cd3>=_0x559c4f){_0x284cd3=_0x559c4f;_0x75b5e5=0xc8;}else{_0x75b5e5=0xce;}_0x2d5108[_0xde4f('0x24')](_0x75b5e5);return _0x2d5108[_0xde4f('0x2b')](_0xde4f('0x2c'),_0x85d13+'-'+_0x284cd3+'/'+_0x559c4f)[_0xde4f('0x26')](_0x35b3a1);}return null;};}function saveUpdates(_0x1802a5){return function(_0x200b8f){if(_0x200b8f){return _0x200b8f[_0xde4f('0x2d')](_0x1802a5)[_0xde4f('0x2e')](function(_0x590158){return _0x590158;});}return null;};}function removeEntity(_0x3e6ecf){return function(_0x2bfd47){if(_0x2bfd47){return _0x2bfd47[_0xde4f('0x2f')]()['then'](function(){_0x3e6ecf[_0xde4f('0x24')](0xcc)[_0xde4f('0x25')]();});}};}function handleEntityNotFound(_0x5ccda2){return function(_0x36de2d){if(!_0x36de2d){_0x5ccda2[_0xde4f('0x23')](0x194);}return _0x36de2d;};}function handleError(_0x3db4e3,_0x2131a9){_0x2131a9=_0x2131a9||0x1f4;return function(_0x4755f3){logger[_0xde4f('0x1d')](_0x4755f3[_0xde4f('0x30')]);if(_0x4755f3[_0xde4f('0x31')]){delete _0x4755f3[_0xde4f('0x31')];}_0x3db4e3[_0xde4f('0x24')](_0x2131a9)['send'](_0x4755f3);};}function getMustacheRender(_0x28180f,_0x37cd8d){return Mustache['render'](_0x28180f,_[_0xde4f('0x32')](_0x37cd8d[_0xde4f('0x33')],{'contact':_0x37cd8d['contact'],'message':_0x37cd8d[_0xde4f('0x20')],'agent':_0x37cd8d[_0xde4f('0x34')],'interaction':_0x37cd8d[_0xde4f('0x35')],'account':_0x37cd8d[_0xde4f('0x36')]}))||'';}exports['index']=function(_0x23227d,_0x265c46){var _0x427b3e={};var _0xe66616=_[_0xde4f('0x37')](db['ChatInteraction'][_0xde4f('0x38')],function(_0x50b2be){return{'name':_0x50b2be['fieldName'],'type':_0x50b2be[_0xde4f('0x39')][_0xde4f('0x3a')]};});_0x427b3e=qs[_0xde4f('0x3b')](_0xe66616,_0x23227d);return interaction[_0xde4f('0x3c')](_0xde4f('0x3d'),_0x23227d['query'],_0x23227d[_0xde4f('0x3e')],_0x427b3e,_0xe66616)[_0xde4f('0x2e')](respondWithFilteredResult(_0x265c46,_0x427b3e))[_0xde4f('0x22')](handleError(_0x265c46,null));};exports['show']=function(_0x22690c,_0x2ae83e){var _0x9ae8a5={'raw':![],'where':{'id':_0x22690c['params']['id']}},_0x374509={};_0x374509['model']=_[_0xde4f('0x3f')](db[_0xde4f('0x40')][_0xde4f('0x38')]);_0x374509['query']=_[_0xde4f('0x3f')](_0x22690c['query']);_0x374509[_0xde4f('0x41')]=_[_0xde4f('0x42')](_0x374509[_0xde4f('0x43')],_0x374509['query']);_0x9ae8a5['attributes']=_['intersection'](_0x374509[_0xde4f('0x43')],qs[_0xde4f('0x44')](_0x22690c['query'][_0xde4f('0x44')]));_0x9ae8a5['attributes']=_0x9ae8a5['attributes'][_0xde4f('0x45')]?_0x9ae8a5[_0xde4f('0x46')]:_0x374509[_0xde4f('0x43')];if(_0x22690c[_0xde4f('0x47')][_0xde4f('0x48')]){_0x9ae8a5[_0xde4f('0x49')]=[{'all':!![]}];}_0x9ae8a5=_[_0xde4f('0x32')]({},_0x9ae8a5,_0x22690c['options']);return db[_0xde4f('0x40')][_0xde4f('0x4a')](_0x9ae8a5)[_0xde4f('0x2e')](handleEntityNotFound(_0x2ae83e,null))[_0xde4f('0x2e')](respondWithResult(_0x2ae83e,null))['catch'](handleError(_0x2ae83e,null));};exports[_0xde4f('0x4b')]=function(_0x46634e,_0x670ec5){return db['ChatInteraction'][_0xde4f('0x4b')](_0x46634e[_0xde4f('0x33')],{})['then'](respondWithResult(_0x670ec5,0xc9))['catch'](handleError(_0x670ec5,null));};exports[_0xde4f('0x2d')]=function(_0x477e6,_0x55b825){if(_0x477e6[_0xde4f('0x33')]['id']){delete _0x477e6[_0xde4f('0x33')]['id'];}return db[_0xde4f('0x40')]['find']({'where':{'id':_0x477e6[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x55b825,null))[_0xde4f('0x2e')](saveUpdates(_0x477e6[_0xde4f('0x33')],null))['then'](respondWithResult(_0x55b825,null))[_0xde4f('0x22')](handleError(_0x55b825,null));};exports[_0xde4f('0x2f')]=function(_0x34f0e3,_0x3b5e09){return db[_0xde4f('0x40')][_0xde4f('0x4a')]({'where':{'id':_0x34f0e3[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x3b5e09,null))[_0xde4f('0x2e')](removeEntity(_0x3b5e09,null))[_0xde4f('0x22')](handleError(_0x3b5e09,null));};exports[_0xde4f('0x4d')]=function(_0x8ff547,_0xbb1f41){return db[_0xde4f('0x40')][_0xde4f('0x4d')]()[_0xde4f('0x2e')](respondWithResult(_0xbb1f41,null))[_0xde4f('0x22')](handleError(_0xbb1f41,null));};exports['createVidaooSession']=function(_0x16b43e,_0x12467e){var _0x6b6866=_0x16b43e[_0xde4f('0x4c')]['id'];var _0x26968d;var _0x150612;var _0x47d159;return db['ChatInteraction']['findOne']({'where':{'id':_0x6b6866}})['then'](function(_0x18fd68){_0x26968d=_0x18fd68;return db[_0xde4f('0x4e')]['findOne']({'where':{'id':_0x18fd68[_0xde4f('0x4f')]},'attributes':['id',_0xde4f('0x50'),_0xde4f('0x51'),_0xde4f('0x52'),_0xde4f('0x53'),_0xde4f('0x54')],'raw':!![]});})[_0xde4f('0x2e')](function(_0xb89d97){if(_0xb89d97&&_0xb89d97[_0xde4f('0x50')]&&_0xb89d97[_0xde4f('0x51')]){_0x150612=_0xb89d97;var _0x382459={'interaction':{'id':_0x6b6866},'agent':{'id':_0x16b43e[_0xde4f('0x3e')]['id'],'name':_0x16b43e[_0xde4f('0x3e')][_0xde4f('0x31')],'fullname':_0x16b43e[_0xde4f('0x3e')][_0xde4f('0x55')],'email':_0x16b43e[_0xde4f('0x3e')][_0xde4f('0x56')]},'contact':_0x16b43e[_0xde4f('0x33')][_0xde4f('0x57')],'account':_0x16b43e[_0xde4f('0x33')][_0xde4f('0x36')]};var _0x10c27a={'rejectUnauthorized':![],'method':'POST','url':_0xde4f('0x58'),'headers':{'X-APIKEY':_0xb89d97[_0xde4f('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x16b43e[_0xde4f('0x3e')][_0xde4f('0x56')]],'buttons':null,'topic':_0x150612[_0xde4f('0x52')],'note':_['isNull'](_0x150612[_0xde4f('0x53')])?null:getMustacheRender(_0x150612['vidaooNote'],_0x382459),'metadata':null},'redirect':_0xde4f('0x59'),'json':!![]};try{if(!_[_0xde4f('0x5a')](_0x150612[_0xde4f('0x54')])){var _0x31ea8a=getMustacheRender(_0x150612[_0xde4f('0x54')],_0x382459);var _0x1456f5=JSON[_0xde4f('0x5b')](_0x31ea8a);_0x10c27a['body']['metadata']=_0x1456f5;}}catch(_0xfc19b3){throw new db[(_0xde4f('0x5c'))][(_0xde4f('0x5d'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x10c27a);}else{throw new db[(_0xde4f('0x5c'))][(_0xde4f('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xde4f('0x2e')](function(_0x86d6b5){_0x47d159=_0x86d6b5;if(_0x47d159['id']){var _0x1ce4ff={'body':_0x47d159[_0xde4f('0x5e')],'ChatWebsiteId':_0x150612['id'],'ChatInteractionId':_0x26968d['id'],'direction':_0xde4f('0x5f'),'UserId':_0x16b43e[_0xde4f('0x3e')]['id']};return db[_0xde4f('0x60')][_0xde4f('0x4b')](_0x1ce4ff,{});}else{throw new db[(_0xde4f('0x5c'))][(_0xde4f('0x5d'))](_0xde4f('0x61'));}})['then'](function(){return _0x26968d[_0xde4f('0x62')]({'vidaooSessionId':_0x47d159['id']});})[_0xde4f('0x2e')](respondWithResult(_0x12467e,null))[_0xde4f('0x22')](handleError(_0x12467e,null));};exports[_0xde4f('0x63')]=function(_0x8b65b3,_0x54a21d){if(_0x8b65b3['body']['id']){delete _0x8b65b3['body']['id'];}return db[_0xde4f('0x40')][_0xde4f('0x4a')]({'where':{'id':_0x8b65b3['params']['id']},'include':[{'model':db[_0xde4f('0x64')],'as':_0xde4f('0x65')}]})[_0xde4f('0x2e')](handleEntityNotFound(_0x54a21d,null))[_0xde4f('0x2e')](saveUpdates(_0x8b65b3[_0xde4f('0x33')],null))['then'](respondWithResult(_0x54a21d,null))[_0xde4f('0x22')](handleError(_0x54a21d,null));};exports[_0xde4f('0x66')]=function(_0x224d40,_0x2b530a){if(_0x224d40[_0xde4f('0x33')]['id']){delete _0x224d40[_0xde4f('0x33')]['id'];}return db[_0xde4f('0x40')]['find']({'where':{'id':_0x224d40[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](function(_0xd4d2f1){if(!_0xd4d2f1){logger[_0xde4f('0x1d')](_0xde4f('0x67'),_0xde4f('0x66'),0x194,'entity\x20not\x20found');_0x2b530a[_0xde4f('0x23')](0x194);}else{if(_0xd4d2f1[_0xde4f('0x68')]){throw new db['Sequelize'][(_0xde4f('0x5d'))](_0xde4f('0x69'));}}return _0xd4d2f1;})[_0xde4f('0x2e')](function(_0x3ececa){if(_0x3ececa){return _0x3ececa[_0xde4f('0x2d')]({'closed':_0x224d40[_0xde4f('0x33')][_0xde4f('0x6a')],'disposition':_0x224d40[_0xde4f('0x33')][_0xde4f('0x6b')]})[_0xde4f('0x2e')](function(_0x292d6f){return _0x292d6f;});}})[_0xde4f('0x2e')](function(){return respondWithRpcPromise(_0xde4f('0x6c'),'abandon',_0x224d40[_0xde4f('0x33')],client9004);})[_0xde4f('0x2e')](respondWithResult(_0x2b530a,null))[_0xde4f('0x22')](handleError(_0x2b530a,null));};exports['attachmentUpload']=function(_0x44ec98,_0xec1c7f){_0x44ec98['body'][_0xde4f('0x31')]=_0x44ec98[_0xde4f('0x6d')][_0xde4f('0x6e')];_0x44ec98['body'][_0xde4f('0x6f')]=_0x44ec98['file'][_0xde4f('0x70')];_0x44ec98['body'][_0xde4f('0x39')]=_0x44ec98[_0xde4f('0x6d')]['mimetype'];return db[_0xde4f('0x71')][_0xde4f('0x4b')](_0x44ec98[_0xde4f('0x33')])[_0xde4f('0x2e')](respondWithResult(_0xec1c7f,0xc9))['catch'](handleError(_0xec1c7f,null));};exports[_0xde4f('0x72')]=function(_0x1384a6,_0x54e91a){return db[_0xde4f('0x40')]['findOne']({'where':{'id':_0x1384a6['params']['id']},'raw':!![]})[_0xde4f('0x2e')](handleEntityNotFound(_0x54e91a,null))['then'](function(_0x601ec9){if(_0x601ec9){if(_0x601ec9[_0xde4f('0x6a')]){return _0x54e91a[_0xde4f('0x24')](0x193)[_0xde4f('0x26')]({'status':0x193,'message':_0xde4f('0x73')});}return db[_0xde4f('0x71')][_0xde4f('0x74')]({'where':{'id':_0x1384a6[_0xde4f('0x47')]['attachId']},'raw':!![]})[_0xde4f('0x2e')](handleEntityNotFound(_0x54e91a,null));}})[_0xde4f('0x2e')](function(_0x162074){if(_0x162074){var _0x2c5948=_0x162074['ChatOfflineMessageId']!==null;var _0x36de35=path[_0xde4f('0x75')](config[_0xde4f('0x76')],'server/files/attachments/');if(_0x2c5948){_0x36de35=path[_0xde4f('0x75')](_0x36de35,_0xde4f('0x77'));}var _0x17dbd7=path[_0xde4f('0x75')](_0x36de35,_0x162074[_0xde4f('0x6f')]);return _0x54e91a[_0xde4f('0x78')](_0x17dbd7);}})[_0xde4f('0x22')](handleError(_0x54e91a,null));};exports[_0xde4f('0x79')]=function(_0x4f6754,_0x59504e){var _0x1ef525=null;var _0x1c75f8=null;var _0x597b3d=null;if(_0x4f6754[_0xde4f('0x33')]['id']){delete _0x4f6754[_0xde4f('0x33')]['id'];}if(_0x4f6754[_0xde4f('0x33')]['mailTranscript']){_0x597b3d=path['join'](config[_0xde4f('0x76')],_0xde4f('0x7a'),util[_0xde4f('0x7b')]('transcript-%s.txt',Date[_0xde4f('0x7c')]()));_0x4f6754[_0xde4f('0x33')][_0xde4f('0x7d')]=_0x597b3d;}return db[_0xde4f('0x40')][_0xde4f('0x4a')]({'where':{'id':_0x4f6754[_0xde4f('0x4c')]['id']},'include':[{'model':db[_0xde4f('0x60')],'as':_0xde4f('0x7e'),'include':[{'model':db['User'],'as':_0xde4f('0x7f')}]}]})['then'](handleEntityNotFound(_0x59504e,null))[_0xde4f('0x2e')](saveUpdates(_0x4f6754[_0xde4f('0x33')],null))[_0xde4f('0x2e')](function(_0x460548){if(_0x460548){_0x1ef525=_0x460548;return db['ChatWebsite'][_0xde4f('0x4a')]({'where':{'id':_0x1ef525[_0xde4f('0x4f')]}});}})['then'](function(_0x34bbb9){if(_0x34bbb9){_0x1c75f8=_0x34bbb9;return db[_0xde4f('0x64')][_0xde4f('0x4a')]({'where':{'id':_0x1ef525[_0xde4f('0x80')]}});}})[_0xde4f('0x2e')](function(_0x6c8a2e){if(_0x6c8a2e){if(_0x597b3d){var _0x375edd=null;for(var _0x4e5b00=0x1;_0x4e5b00<_0x1ef525[_0xde4f('0x7e')][_0xde4f('0x45')];++_0x4e5b00){_0x375edd=_0x1ef525[_0xde4f('0x7e')][_0x4e5b00];var _0x15a251=_0x375edd['UserId']?util[_0xde4f('0x7b')](_0xde4f('0x81'),_0x1c75f8['agentAlias'],_0x375edd['UserId']):_0xde4f('0x82');var _0x37d311=_0x4f6754[_0xde4f('0x33')]['customer']||util[_0xde4f('0x7b')]('%s%d','Visitor',_0x375edd['ContactId']);switch(_0x1c75f8[_0xde4f('0x83')]){case'website_alias':_0x15a251=_0x375edd[_0xde4f('0x68')]?util['format']('%s%d',_0x1c75f8[_0xde4f('0x84')],_0x375edd[_0xde4f('0x68')]):_0xde4f('0x82');break;case'agent_alias':_0x15a251=_0x375edd['UserId']?_0x375edd['User'][_0xde4f('0x85')]||_0x375edd[_0xde4f('0x7f')][_0xde4f('0x55')]:'System';break;case _0xde4f('0x86'):_0x15a251=_0x375edd['UserId']?_0x375edd['User'][_0xde4f('0x55')]:_0xde4f('0x82');break;default:_0x15a251=_0x375edd[_0xde4f('0x68')]?util[_0xde4f('0x7b')](_0xde4f('0x81'),_0x1c75f8['agentAlias'],_0x375edd[_0xde4f('0x68')]):_0xde4f('0x82');}var _0x370042=util[_0xde4f('0x7b')](_0xde4f('0x87'),moment(_0x375edd[_0xde4f('0x88')])[_0xde4f('0x7b')](_0xde4f('0x89')),_0x375edd[_0xde4f('0x8a')]==='in'?_0x37d311:_0x15a251,_0x375edd[_0xde4f('0x33')]);if(!_0x375edd[_0xde4f('0x8b')]){fs[_0xde4f('0x8c')](_0x597b3d,_0x370042);}}return db[_0xde4f('0x8d')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xde4f('0x8e')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xde4f('0x8f'),'raw':!![]}]}]});}}})['then'](function(_0x328304){if(!_0x328304||!_0x328304[_0xde4f('0x90')]||!_0x4f6754[_0xde4f('0x33')])return _0x1ef525;var _0x380efc=_0x328304[_0xde4f('0x91')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x380efc,'message':{'from':util[_0xde4f('0x7b')](_0xde4f('0x92'),_0x328304[_0xde4f('0x31')],_0x328304['email']||_0x328304['Smtp'][_0xde4f('0x3e')]),'to':_0x4f6754['body']['mailTranscript'],'subject':_0xde4f('0x93'),'text':util[_0xde4f('0x7b')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4f6754['body'][_0xde4f('0x94')]),'attachments':[{'path':_0x597b3d}]}})['then'](function(){return _0x1ef525;})['catch'](function(_0x327207){logger[_0xde4f('0x1d')](_0x327207);});})['then'](respondWithStatusCode(_0x59504e,0xc8))[_0xde4f('0x22')](handleError(_0x59504e,null));};exports[_0xde4f('0x95')]=function(_0x261287,_0x3f57c8){return db['ChatMessage'][_0xde4f('0x4a')]({'where':{'id':_0x261287['params']['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x3f57c8,null))[_0xde4f('0x2e')](function(_0x5b25d3){if(_0x5b25d3){return _0x5b25d3[_0xde4f('0x95')](_0x261287['body'][_0xde4f('0x96')],_[_0xde4f('0x97')](_0x261287['body'],['ids','id'])||{});}})[_0xde4f('0x2e')](respondWithResult(_0x3f57c8,null))[_0xde4f('0x22')](handleError(_0x3f57c8,null));};exports['getMessages']=function(_0x230bc1,_0x5df3fb){var _0x5e1678={'raw':![],'where':{}};var _0x529503={};var _0x5f20c0={'count':0x0,'rows':[]};return db[_0xde4f('0x40')][_0xde4f('0x74')]({'where':{'id':_0x230bc1[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x5df3fb,null))[_0xde4f('0x2e')](function(_0x1d8dd3){if(_0x1d8dd3){_0x529503[_0xde4f('0x43')]=_['keys'](db[_0xde4f('0x60')]['rawAttributes']);_0x529503[_0xde4f('0x47')]=_[_0xde4f('0x3f')](_0x230bc1[_0xde4f('0x47')]);_0x529503[_0xde4f('0x41')]=_[_0xde4f('0x42')](_0x529503['model'],_0x529503[_0xde4f('0x47')]);_0x5e1678[_0xde4f('0x46')]=_[_0xde4f('0x42')](_0x529503[_0xde4f('0x43')],qs[_0xde4f('0x44')](_0x230bc1[_0xde4f('0x47')][_0xde4f('0x44')]));_0x5e1678[_0xde4f('0x46')]=_0x5e1678[_0xde4f('0x46')]['length']?_0x5e1678[_0xde4f('0x46')]:_0x529503[_0xde4f('0x43')];if(!_0x230bc1['query'][_0xde4f('0x98')](_0xde4f('0x99'))){_0x5e1678[_0xde4f('0x29')]=qs[_0xde4f('0x29')](_0x230bc1[_0xde4f('0x47')]['limit']);_0x5e1678[_0xde4f('0x27')]=qs[_0xde4f('0x27')](_0x230bc1[_0xde4f('0x47')]['offset']);}_0x5e1678['order']=qs['sort'](_0x230bc1[_0xde4f('0x47')][_0xde4f('0x9a')]);_0x5e1678[_0xde4f('0x9b')]=qs[_0xde4f('0x41')](_[_0xde4f('0x9c')](_0x230bc1[_0xde4f('0x47')],_0x529503['filters']));_0x5e1678[_0xde4f('0x9b')]['ChatInteractionId']=_0x1d8dd3['id'];if(_0x230bc1['query']['filter']){_0x5e1678[_0xde4f('0x9b')]=_[_0xde4f('0x32')](_0x5e1678[_0xde4f('0x9b')],{'$or':_['map'](_0x5e1678[_0xde4f('0x46')],function(_0x1742a8){var _0xba0384={};_0xba0384[_0x1742a8]={'$like':'%'+_0x230bc1[_0xde4f('0x47')][_0xde4f('0x9d')]+'%'};return _0xba0384;})});}if(_0x230bc1[_0xde4f('0x47')][_0xde4f('0x9e')]){var _0x4cf9fc=_0x230bc1[_0xde4f('0x47')]['$gte']['split'](',');var _0x206969={};_0x206969[_0x4cf9fc[0x0]]={'$gte':moment(_0x4cf9fc[0x1])[_0xde4f('0x7b')](_0xde4f('0x9f'))};_0x5e1678[_0xde4f('0x9b')]=_[_0xde4f('0x32')](_0x5e1678[_0xde4f('0x9b')],_0x206969);}_0x5e1678=_[_0xde4f('0x32')]({},_0x5e1678,_0x230bc1[_0xde4f('0xa0')]);return db['ChatMessage']['count']({'where':_0x5e1678[_0xde4f('0x9b')]})[_0xde4f('0x2e')](function(_0xcf71d7){_0x5f20c0[_0xde4f('0x2a')]=_0xcf71d7;if(_0x230bc1[_0xde4f('0x47')][_0xde4f('0x48')]){_0x5e1678[_0xde4f('0x49')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x5e1678);})[_0xde4f('0x2e')](function(_0x1f814a){_0x5f20c0[_0xde4f('0xa1')]=_0x1f814a;return _0x5f20c0;});}})['then'](respondWithFilteredResult(_0x5df3fb,_0x5e1678))[_0xde4f('0x22')](handleError(_0x5df3fb,null));};exports[_0xde4f('0xa2')]=function(_0x2a3540,_0x43ce81){var _0x509949={'where':{}},_0x3162fd={},_0x5a4aae={'count':0x0,'rows':[]};return db[_0xde4f('0x40')][_0xde4f('0x74')]({'where':{'id':_0x2a3540[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x43ce81,null))[_0xde4f('0x2e')](function(_0x27d96c){if(_0x27d96c){_0x3162fd[_0xde4f('0x43')]=_[_0xde4f('0x3f')](db['ChatMessage'][_0xde4f('0x38')]);_0x3162fd[_0xde4f('0x47')]=_[_0xde4f('0x3f')](_0x2a3540[_0xde4f('0x47')]);_0x3162fd[_0xde4f('0x41')]=_[_0xde4f('0x42')](_0x3162fd['model'],_0x3162fd[_0xde4f('0x47')]);_0x509949['attributes']=_[_0xde4f('0x42')](_0x3162fd[_0xde4f('0x43')],qs[_0xde4f('0x44')](_0x2a3540[_0xde4f('0x47')][_0xde4f('0x44')]));_0x509949[_0xde4f('0x46')]=_0x509949[_0xde4f('0x46')][_0xde4f('0x45')]?_0x509949['attributes']:_0x3162fd[_0xde4f('0x43')];if(!_0x2a3540[_0xde4f('0x47')][_0xde4f('0x98')](_0xde4f('0x99'))){_0x509949[_0xde4f('0x29')]=qs[_0xde4f('0x29')](_0x2a3540[_0xde4f('0x47')][_0xde4f('0x29')]);_0x509949[_0xde4f('0x27')]=qs[_0xde4f('0x27')](_0x2a3540[_0xde4f('0x47')][_0xde4f('0x27')]);}_0x509949[_0xde4f('0xa3')]=qs[_0xde4f('0x9a')](_0x2a3540['query'][_0xde4f('0x9a')]);_0x509949[_0xde4f('0x9b')]=qs[_0xde4f('0x41')](_['pick'](_0x2a3540[_0xde4f('0x47')],_0x3162fd[_0xde4f('0x41')]));_0x509949['where'][_0xde4f('0xa4')]=_0x27d96c['id'];if(_0x2a3540['query'][_0xde4f('0x9d')]){_0x509949[_0xde4f('0x9b')]=_[_0xde4f('0x32')](_0x509949[_0xde4f('0x9b')],{'$or':_['map'](_0x509949['attributes'],function(_0x27cee1){var _0xcd49ff={};_0xcd49ff[_0x27cee1]={'$like':'%'+_0x2a3540[_0xde4f('0x47')][_0xde4f('0x9d')]+'%'};return _0xcd49ff;})});}_0x509949[_0xde4f('0x9b')][_0xde4f('0x8b')]=![];if(_0x2a3540[_0xde4f('0x47')]['id']){_0x509949[_0xde4f('0x9b')]['id']={'$gt':_0x2a3540[_0xde4f('0x47')]['id']};}_0x509949=_[_0xde4f('0x32')]({},_0x509949,_0x2a3540[_0xde4f('0xa0')]);return db[_0xde4f('0x60')][_0xde4f('0x2a')]({'where':_0x509949[_0xde4f('0x9b')]})[_0xde4f('0x2e')](function(_0x12c39b){_0x5a4aae[_0xde4f('0x2a')]=_0x12c39b;_0x509949[_0xde4f('0x49')]=[];if(_0x2a3540[_0xde4f('0x47')][_0xde4f('0xa5')]){_0x509949['include'][_0xde4f('0xa6')]({'model':db[_0xde4f('0x7f')],'as':_0xde4f('0x7f'),'attributes':['id',_0xde4f('0x55'),_0xde4f('0x85')]});}if(_0x2a3540[_0xde4f('0x47')][_0xde4f('0x48')]){_0x509949[_0xde4f('0x49')]=[{'all':!![]}];}return db[_0xde4f('0x60')]['findAll'](_0x509949);})[_0xde4f('0x2e')](function(_0x26201e){_0x5a4aae[_0xde4f('0xa1')]=_0x26201e;return _0x5a4aae;});}})[_0xde4f('0x2e')](respondWithFilteredResult(_0x43ce81,_0x509949))[_0xde4f('0x22')](handleError(_0x43ce81,null));};exports[_0xde4f('0xa7')]=function(_0x1d32b8,_0x19c448){return db[_0xde4f('0x40')]['find']({'where':{'id':_0x1d32b8[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x19c448,null))[_0xde4f('0x2e')](function(_0xb12cd4){if(_0xb12cd4){return _0xb12cd4[_0xde4f('0xa8')](_0x1d32b8[_0xde4f('0x33')]['ids'],_['omit'](_0x1d32b8[_0xde4f('0x33')],['ids','id'])||{})['spread'](function(){return db[_0xde4f('0xa9')][_0xde4f('0x3c')]({'attributes':['id',_0xde4f('0x31'),'color'],'where':{'id':_0x1d32b8['body'][_0xde4f('0x96')]}});})[_0xde4f('0x2e')](function(_0x4641ea){socket[_0xde4f('0xaa')](_0xde4f('0xab'),{'id':Number(_0x1d32b8[_0xde4f('0x4c')]['id']),'tags':_0x4641ea||[]});return{'id':Number(_0x1d32b8['params']['id']),'tags':_0x4641ea||[]};});}})['then'](respondWithResult(_0x19c448,null))['catch'](handleError(_0x19c448,null));};exports['removeTags']=function(_0x5a0ac0,_0x583348){return db[_0xde4f('0x40')][_0xde4f('0x4a')]({'where':{'id':_0x5a0ac0[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x583348,null))['then'](function(_0x5bb234){if(_0x5bb234){return _0x5bb234[_0xde4f('0xac')](_0x5a0ac0[_0xde4f('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x583348,null))[_0xde4f('0x22')](handleError(_0x583348,null));};exports[_0xde4f('0x78')]=function(_0x2c92a0,_0x516bee){var _0x471aec=moment()['unix']()[_0xde4f('0xad')]();var _0xbc98c7=path['join'](config['root'],'server','files',_0xde4f('0xae'));var _0x5c7fa3=path[_0xde4f('0x75')](config['root'],_0xde4f('0xaf'),'files',_0xde4f('0xb0'));var _0x376881=path[_0xde4f('0x75')](_0xbc98c7,_0x471aec);var _0x17a358=util[_0xde4f('0x7b')](_0xde4f('0xb1'),_0x2c92a0[_0xde4f('0x4c')]['id'],_0x471aec);var _0x33f247=path[_0xde4f('0x75')](_0xbc98c7,_0x17a358);var _0x12c8bb=[];_0x12c8bb[_0xde4f('0xa6')]({'model':db['User'],'as':_0xde4f('0x7f'),'attributes':['id',_0xde4f('0x55')],'raw':!![]});_0x12c8bb[_0xde4f('0xa6')]({'model':db['CmContact'],'as':_0xde4f('0x65'),'attributes':['id',_0xde4f('0xb2'),_0xde4f('0xb3')],'raw':!![]});if(_0x2c92a0[_0xde4f('0x47')][_0xde4f('0xb0')]){_0x12c8bb[_0xde4f('0xa6')]({'model':db[_0xde4f('0x71')],'as':_0xde4f('0x71'),'raw':!![]});}var _0x5624f7=[{'model':db['ChatMessage'],'as':_0xde4f('0x7e'),'attributes':['id','body',_0xde4f('0x88'),_0xde4f('0x8a'),'secret',_0xde4f('0xb4')],'include':_0x12c8bb}];_0x5624f7[_0xde4f('0xa6')]({'model':db[_0xde4f('0x4e')],'as':_0xde4f('0xb5'),'attributes':['id','name']});_0x5624f7[_0xde4f('0xa6')]({'model':db['User'],'as':_0xde4f('0xb6'),'attributes':['id',_0xde4f('0x55')]});return db[_0xde4f('0x40')]['find']({'where':{'id':_0x2c92a0[_0xde4f('0x4c')]['id']},'include':_0x5624f7})[_0xde4f('0x2e')](handleEntityNotFound(_0x516bee,null))[_0xde4f('0x2e')](function(_0xb6e4d1){if(_0xb6e4d1){var _0x2175c7=_0xb6e4d1[_0xde4f('0xb7')]({'plain':!![]});fs['mkdirSync'](_0x376881);var _0x20e548={'channel':'Chat','account':_0x2175c7[_0xde4f('0xb5')][_0xde4f('0x31')],'agent':_0x2175c7[_0xde4f('0xb6')]?_0x2175c7[_0xde4f('0xb6')]['fullname']:_0xde4f('0xb8'),'createdAt':moment(_0x2175c7[_0xde4f('0x88')])[_0xde4f('0x7b')](_0xde4f('0x9f'))[_0xde4f('0xad')](),'closedAt':_0x2175c7[_0xde4f('0x6a')]?moment(_0x2175c7[_0xde4f('0xb9')])[_0xde4f('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xde4f('0xad')]():'','disposition':_0x2175c7[_0xde4f('0x6b')],'chatInfo':{'browser':_0x2175c7[_0xde4f('0xba')],'os':_0x2175c7['osName'],'referer':_0x2175c7['referer'],'customerIp':_0x2175c7[_0xde4f('0xbb')],'customerPort':_0x2175c7[_0xde4f('0xbc')]?_0x2175c7[_0xde4f('0xbc')]:'N.A.'},'messages':_(_0x2175c7['Messages'])[_0xde4f('0xbd')]()[_0xde4f('0x9d')]({'secret':![]})[_0xde4f('0x37')](function(_0x5ad627){if(_0x5ad627[_0xde4f('0x71')]){var _0x44c4c4=path[_0xde4f('0x75')](_0x5c7fa3,_0x5ad627[_0xde4f('0x71')][_0xde4f('0x6f')]);if(fs[_0xde4f('0xbe')](_0x44c4c4)){fs['createReadStream'](_0x44c4c4)['pipe'](fs[_0xde4f('0xbf')](path[_0xde4f('0x75')](_0x376881,_0x5ad627['Attachment'][_0xde4f('0x6f')])));}}return{'date':moment(_0x5ad627['createdAt'])[_0xde4f('0x7b')](_0xde4f('0x9f'))[_0xde4f('0xad')](),'sender':_0x5ad627[_0xde4f('0x8a')]===_0xde4f('0x5f')?_0x5ad627[_0xde4f('0x7f')]?_0x5ad627[_0xde4f('0x7f')]['fullname']:_0xde4f('0x82'):_0x5ad627[_0xde4f('0x65')]['firstName']+(_0x5ad627[_0xde4f('0x65')][_0xde4f('0xb3')]?'\x20'+_0x5ad627[_0xde4f('0x65')][_0xde4f('0xb3')]:''),'body':_0x5ad627[_0xde4f('0x71')]?_0x5ad627['Attachment']['basename']:_0x5ad627[_0xde4f('0x33')],'direction':_0x5ad627[_0xde4f('0x8a')]===_0xde4f('0x5f')?'A':'C','secret':_0x5ad627[_0xde4f('0x8b')],'read':_0x5ad627[_0xde4f('0xb4')],'attachment':_0x5ad627[_0xde4f('0x71')]};})['value']()};return ejs[_0xde4f('0xc0')](path[_0xde4f('0x75')](config[_0xde4f('0x76')],'server',_0xde4f('0xc1'),_0xde4f('0xc2')),{'interaction':_0x20e548})[_0xde4f('0x2e')](function(_0x56b8aa){var _0x15ab8b=path[_0xde4f('0x75')](_0x376881,_0xde4f('0xc3')+_0x2175c7['id']+'-'+_0x471aec+_0xde4f('0xc4'));var _0x3d8904={'path':_0x15ab8b,'channel':'Chat','interactionId':_0x2175c7['id']};return pdf[_0xde4f('0xc5')](_0x56b8aa,_0x3d8904);})[_0xde4f('0x2e')](function(){return new Promise(function(_0x436a5b,_0x809e8d){zipdir(_0x376881,{'saveTo':_0x33f247},function(_0x4c4168,_0x1c6091){if(_0x4c4168)return _0x809e8d(_0x4c4168);return _0x436a5b(_0x1c6091);});})[_0xde4f('0x2e')](function(){return new BPromise(function(_0x733817,_0x2cea3c){rimraf(_0x376881,function(_0x2d529d){if(_0x2d529d)_0x2cea3c(_0x2d529d);return _0x733817();});});})['then'](function(){return _0x516bee['download'](_0x33f247,_0x17a358,function(_0x2eb4cb){if(_0x2eb4cb){logger[_0xde4f('0x1d')](_0xde4f('0xc6'),_0x2eb4cb);}else{fs[_0xde4f('0xc7')](_0x33f247);}});});});}else{return _0x516bee[_0xde4f('0x23')](0xc8);}})[_0xde4f('0x22')](handleError(_0x516bee,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5e5b4eb..0a524ea 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 _0x6c6b=['update','remove','then','map','findAll','setDataValue','unreadMessages','emit','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0x2af053,_0x4f6d28){var _0x4b4001=function(_0x9200c1){while(--_0x9200c1){_0x2af053['push'](_0x2af053['shift']());}};_0x4b4001(++_0x4f6d28);}(_0x6c6b,0x1db));var _0xb6c6=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x6c6b[_0xfa634c];return _0x73e478;};'use strict';var EventEmitter=require(_0xb6c6('0x0'));var ChatInteraction=require(_0xb6c6('0x1'))['db'][_0xb6c6('0x2')];var ChatMessage=require(_0xb6c6('0x1'))['db'][_0xb6c6('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb6c6('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb6c6('0x5'),'afterDestroy':_0xb6c6('0x6')};function emitEvent(_0x42d5e2){return function(_0xd9346,_0x31f5df,_0x8530fd){_0xd9346['getUsers']({'attributes':['id'],'raw':!![]})[_0xb6c6('0x7')](function(_0x3b14fe){_0xd9346['setDataValue']('Users',_0x3b14fe[_0xb6c6('0x8')](function(_0x6b033e){return{'id':_0x6b033e['id']};}));return ChatMessage[_0xb6c6('0x9')]({'where':{'ChatInteractionId':_0xd9346['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb6c6('0x7')](function(_0x13846f){_0xd9346[_0xb6c6('0xa')](_0xb6c6('0xb'),_0x13846f['length']);ChatInteractionEvents[_0xb6c6('0xc')](_0x42d5e2+':'+_0xd9346['id'],_0xd9346);ChatInteractionEvents[_0xb6c6('0xc')](_0x42d5e2,_0xd9346);_0x8530fd(null);})['catch'](_0x8530fd(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xb6c6('0xd')](e,emitEvent(event));}}module[_0xb6c6('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x8b44=['remove','then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','save','update'];(function(_0x112147,_0x4e692e){var _0x3ba744=function(_0x191b87){while(--_0x191b87){_0x112147['push'](_0x112147['shift']());}};_0x3ba744(++_0x4e692e);}(_0x8b44,0xbf));var _0x48b4=function(_0x3fd097,_0x59a875){_0x3fd097=_0x3fd097-0x0;var _0x4a0750=_0x8b44[_0x3fd097];return _0x4a0750;};'use strict';var EventEmitter=require(_0x48b4('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x48b4('0x1'))['db'][_0x48b4('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x48b4('0x3'),'afterUpdate':_0x48b4('0x4'),'afterDestroy':_0x48b4('0x5')};function emitEvent(_0x260482){return function(_0x51482e,_0x505ddf,_0x38a47e){_0x51482e['getUsers']({'attributes':['id'],'raw':!![]})[_0x48b4('0x6')](function(_0x111027){_0x51482e['setDataValue']('Users',_0x111027[_0x48b4('0x7')](function(_0x2b45a9){return{'id':_0x2b45a9['id']};}));return ChatMessage[_0x48b4('0x8')]({'where':{'ChatInteractionId':_0x51482e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x48b4('0x6')](function(_0x463bac){_0x51482e['setDataValue'](_0x48b4('0x9'),_0x463bac['length']);ChatInteractionEvents[_0x48b4('0xa')](_0x260482+':'+_0x51482e['id'],_0x51482e);ChatInteractionEvents[_0x48b4('0xa')](_0x260482,_0x51482e);_0x38a47e(null);})[_0x48b4('0xb')](_0x38a47e(null));};}for(var e in events){if(events[_0x48b4('0xc')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x48b4('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 9f2e1c4..0f61a13 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 _0x832b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x219fa0,_0x18b239){var _0xc603fb=function(_0x3371ad){while(--_0x3371ad){_0x219fa0['push'](_0x219fa0['shift']());}};_0xc603fb(++_0x18b239);}(_0x832b,0x152));var _0xb832=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x832b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb832('0x0'));var util=require(_0xb832('0x1'));var logger=require(_0xb832('0x2'))(_0xb832('0x3'));var moment=require(_0xb832('0x4'));var BPromise=require(_0xb832('0x5'));var rp=require(_0xb832('0x6'));var fs=require('fs');var path=require(_0xb832('0x7'));var rimraf=require(_0xb832('0x8'));var config=require(_0xb832('0x9'));var attributes=require(_0xb832('0xa'));module[_0xb832('0xb')]=function(_0x55d2b2,_0x258964){return _0x55d2b2[_0xb832('0xc')](_0xb832('0xd'),attributes,{'tableName':_0xb832('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52428d,_0x398005,_0x50ff2a){if(_0x52428d[_0xb832('0xf')]('closed')){_0x52428d['closedAt']=moment()[_0xb832('0x10')](_0xb832('0x11'));}_0x50ff2a(null,_0x52428d);}},'charset':_0xb832('0x12'),'collate':_0xb832('0x13')});}; \ No newline at end of file +var _0x174b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','../../config/logger','api'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0x174b,0xce));var _0xb174=function(_0x1aefae,_0x21dd74){_0x1aefae=_0x1aefae-0x0;var _0x29b23c=_0x174b[_0x1aefae];return _0x29b23c;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var logger=require(_0xb174('0x1'))(_0xb174('0x2'));var moment=require(_0xb174('0x3'));var BPromise=require(_0xb174('0x4'));var rp=require(_0xb174('0x5'));var fs=require('fs');var path=require(_0xb174('0x6'));var rimraf=require(_0xb174('0x7'));var config=require(_0xb174('0x8'));var attributes=require(_0xb174('0x9'));module[_0xb174('0xa')]=function(_0x157d89,_0x498a66){return _0x157d89[_0xb174('0xb')](_0xb174('0xc'),attributes,{'tableName':_0xb174('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x61183e,_0x8dd2fd,_0x10e84f){if(_0x61183e['changed'](_0xb174('0xe'))){_0x61183e[_0xb174('0xf')]=moment()[_0xb174('0x10')](_0xb174('0x11'));}_0x10e84f(null,_0x61183e);}},'charset':_0xb174('0x12'),'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 b15de3b..dd55eb6 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 _0x2c31=['then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','catch','find','where','addTags','ids','omit','spread','AddTags','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request'];(function(_0x1f71d8,_0x278518){var _0x10b045=function(_0x57aea4){while(--_0x57aea4){_0x1f71d8['push'](_0x1f71d8['shift']());}};_0x10b045(++_0x278518);}(_0x2c31,0xc6));var _0x12c3=function(_0x1e4f5e,_0x649ccc){_0x1e4f5e=_0x1e4f5e-0x0;var _0x2c5bb8=_0x2c31[_0x1e4f5e];return _0x2c5bb8;};'use strict';var _=require(_0x12c3('0x0'));var util=require(_0x12c3('0x1'));var moment=require('moment');var BPromise=require(_0x12c3('0x2'));var rs=require(_0x12c3('0x3'));var fs=require('fs');var Redis=require(_0x12c3('0x4'));var db=require(_0x12c3('0x5'))['db'];var utils=require(_0x12c3('0x6'));var logger=require('../../config/logger')(_0x12c3('0x7'));var config=require(_0x12c3('0x8'));var jayson=require(_0x12c3('0x9'));var client=jayson[_0x12c3('0xa')]['http']({'port':0x232a});config[_0x12c3('0xb')]=_[_0x12c3('0xc')](config[_0x12c3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x12c3('0xd'))(new Redis(config[_0x12c3('0xb')]));require(_0x12c3('0xe'))[_0x12c3('0xf')](socket);function respondWithRpcPromise(_0x2da221,_0x420584,_0x403ef6){return new BPromise(function(_0x10f0af,_0x3def7b){return client[_0x12c3('0x10')](_0x2da221,_0x403ef6)[_0x12c3('0x11')](function(_0x34283b){logger[_0x12c3('0x12')](_0x12c3('0x13'),_0x420584,_0x12c3('0x14'));logger[_0x12c3('0x15')](_0x12c3('0x16'),_0x420584,_0x12c3('0x14'),JSON['stringify'](_0x34283b));if(_0x34283b[_0x12c3('0x17')]){if(_0x34283b[_0x12c3('0x17')][_0x12c3('0x18')]===0x1f4){logger[_0x12c3('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x420584,_0x34283b[_0x12c3('0x17')][_0x12c3('0x19')]);return _0x3def7b(_0x34283b[_0x12c3('0x17')][_0x12c3('0x19')]);}logger[_0x12c3('0x17')](_0x12c3('0x13'),_0x420584,_0x34283b['error']['message']);return _0x10f0af(_0x34283b[_0x12c3('0x17')][_0x12c3('0x19')]);}else{logger[_0x12c3('0x12')](_0x12c3('0x13'),_0x420584,'request\x20sent');_0x10f0af(_0x34283b[_0x12c3('0x1a')][_0x12c3('0x19')]);}})['catch'](function(_0x4c248c){logger[_0x12c3('0x17')](_0x12c3('0x13'),_0x420584,_0x4c248c);_0x3def7b(_0x4c248c);});});}exports[_0x12c3('0x1b')]=function(_0x1b954f){var _0x2e7855=this;return new Promise(function(_0x139e27,_0x4aa5b6){return db[_0x12c3('0x1c')][_0x12c3('0x1d')](_0x1b954f[_0x12c3('0x1e')],{'raw':_0x1b954f[_0x12c3('0x1f')]?_0x1b954f[_0x12c3('0x1f')][_0x12c3('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b954f[_0x12c3('0x1f')]?_0x1b954f[_0x12c3('0x1f')]['where']||null:null,'attributes':_0x1b954f['options']?_0x1b954f[_0x12c3('0x1f')][_0x12c3('0x21')]||null:null,'limit':_0x1b954f[_0x12c3('0x1f')]?_0x1b954f[_0x12c3('0x1f')]['limit']||null:null})[_0x12c3('0x11')](function(_0x2a2ab3){logger[_0x12c3('0x12')](_0x12c3('0x1b'),_0x1b954f);logger['debug'](_0x12c3('0x1b'),_0x1b954f,JSON['stringify'](_0x2a2ab3));_0x139e27(_0x2a2ab3);})[_0x12c3('0x22')](function(_0x320110){logger['error'](_0x12c3('0x1b'),_0x320110['message'],_0x1b954f);_0x4aa5b6(_0x2e7855[_0x12c3('0x17')](0x1f4,_0x320110[_0x12c3('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x599bc0){return new Promise(function(_0x4dbc3f,_0x10a3f7){return db[_0x12c3('0x1c')][_0x12c3('0x23')]({'where':_0x599bc0[_0x12c3('0x1f')]?_0x599bc0[_0x12c3('0x1f')][_0x12c3('0x24')]||null:null})[_0x12c3('0x11')](function(_0x91bc25){if(_0x91bc25){return _0x91bc25[_0x12c3('0x25')](_0x599bc0[_0x12c3('0x1e')][_0x12c3('0x26')],_[_0x12c3('0x27')](_0x599bc0[_0x12c3('0x1e')],[_0x12c3('0x26'),'id'])||{});}})[_0x12c3('0x28')](function(_0x4b1d43){logger[_0x12c3('0x12')](_0x12c3('0x29'),_0x599bc0);logger['debug'](_0x12c3('0x29'),_0x599bc0,JSON[_0x12c3('0x2a')](_0x4b1d43));_0x4dbc3f(_0x4b1d43);})[_0x12c3('0x22')](function(_0x184490){logger['error'](_0x12c3('0x29'),_0x184490[_0x12c3('0x19')],_0x599bc0);_0x10a3f7(_this[_0x12c3('0x17')](0x1f4,_0x184490[_0x12c3('0x19')]));});});}; \ No newline at end of file +var _0x2c4b=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2c4b,0x10e));var _0xb2c4=function(_0x71f648,_0x19654f){_0x71f648=_0x71f648-0x0;var _0x56203f=_0x2c4b[_0x71f648];return _0x56203f;};'use strict';var _=require(_0xb2c4('0x0'));var util=require(_0xb2c4('0x1'));var moment=require(_0xb2c4('0x2'));var BPromise=require(_0xb2c4('0x3'));var rs=require(_0xb2c4('0x4'));var fs=require('fs');var Redis=require(_0xb2c4('0x5'));var db=require(_0xb2c4('0x6'))['db'];var utils=require(_0xb2c4('0x7'));var logger=require(_0xb2c4('0x8'))(_0xb2c4('0x9'));var config=require('../../config/environment');var jayson=require(_0xb2c4('0xa'));var client=jayson[_0xb2c4('0xb')][_0xb2c4('0xc')]({'port':0x232a});config[_0xb2c4('0xd')]=_[_0xb2c4('0xe')](config[_0xb2c4('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb2c4('0xd')]));require(_0xb2c4('0xf'))[_0xb2c4('0x10')](socket);function respondWithRpcPromise(_0x505cab,_0x5f140f,_0x1738d0){return new BPromise(function(_0x2addad,_0x4086fe){return client[_0xb2c4('0x11')](_0x505cab,_0x1738d0)[_0xb2c4('0x12')](function(_0x574d01){logger[_0xb2c4('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x5f140f,_0xb2c4('0x14'));logger[_0xb2c4('0x15')](_0xb2c4('0x16'),_0x5f140f,_0xb2c4('0x14'),JSON[_0xb2c4('0x17')](_0x574d01));if(_0x574d01[_0xb2c4('0x18')]){if(_0x574d01[_0xb2c4('0x18')][_0xb2c4('0x19')]===0x1f4){logger[_0xb2c4('0x18')](_0xb2c4('0x1a'),_0x5f140f,_0x574d01[_0xb2c4('0x18')]['message']);return _0x4086fe(_0x574d01[_0xb2c4('0x18')][_0xb2c4('0x1b')]);}logger[_0xb2c4('0x18')](_0xb2c4('0x1a'),_0x5f140f,_0x574d01[_0xb2c4('0x18')][_0xb2c4('0x1b')]);return _0x2addad(_0x574d01[_0xb2c4('0x18')][_0xb2c4('0x1b')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5f140f,'request\x20sent');_0x2addad(_0x574d01[_0xb2c4('0x1c')][_0xb2c4('0x1b')]);}})[_0xb2c4('0x1d')](function(_0x18dab8){logger[_0xb2c4('0x18')](_0xb2c4('0x1a'),_0x5f140f,_0x18dab8);_0x4086fe(_0x18dab8);});});}exports[_0xb2c4('0x1e')]=function(_0x4ee18c){var _0x14fac1=this;return new Promise(function(_0x3308c5,_0x4671fd){return db[_0xb2c4('0x1f')][_0xb2c4('0x20')](_0x4ee18c[_0xb2c4('0x21')],{'raw':_0x4ee18c[_0xb2c4('0x22')]?_0x4ee18c[_0xb2c4('0x22')][_0xb2c4('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ee18c[_0xb2c4('0x22')]?_0x4ee18c[_0xb2c4('0x22')][_0xb2c4('0x24')]||null:null,'attributes':_0x4ee18c[_0xb2c4('0x22')]?_0x4ee18c[_0xb2c4('0x22')]['attributes']||null:null,'limit':_0x4ee18c[_0xb2c4('0x22')]?_0x4ee18c[_0xb2c4('0x22')][_0xb2c4('0x25')]||null:null})[_0xb2c4('0x12')](function(_0x31839e){logger['info']('UpdateChatInteraction',_0x4ee18c);logger[_0xb2c4('0x15')](_0xb2c4('0x1e'),_0x4ee18c,JSON[_0xb2c4('0x17')](_0x31839e));_0x3308c5(_0x31839e);})[_0xb2c4('0x1d')](function(_0x2efb59){logger['error'](_0xb2c4('0x1e'),_0x2efb59['message'],_0x4ee18c);_0x4671fd(_0x14fac1[_0xb2c4('0x18')](0x1f4,_0x2efb59[_0xb2c4('0x1b')]));});});};exports[_0xb2c4('0x26')]=function(_0x4ac179){return new Promise(function(_0x320005,_0x12a35b){return db['ChatInteraction'][_0xb2c4('0x27')]({'where':_0x4ac179[_0xb2c4('0x22')]?_0x4ac179[_0xb2c4('0x22')][_0xb2c4('0x24')]||null:null})[_0xb2c4('0x12')](function(_0x3c05e9){if(_0x3c05e9){return _0x3c05e9[_0xb2c4('0x28')](_0x4ac179['body'][_0xb2c4('0x29')],_[_0xb2c4('0x2a')](_0x4ac179[_0xb2c4('0x21')],[_0xb2c4('0x29'),'id'])||{});}})[_0xb2c4('0x2b')](function(_0x25f8c1){logger['info'](_0xb2c4('0x2c'),_0x4ac179);logger[_0xb2c4('0x15')](_0xb2c4('0x2c'),_0x4ac179,JSON[_0xb2c4('0x17')](_0x25f8c1));_0x320005(_0x25f8c1);})[_0xb2c4('0x1d')](function(_0x3ae0c8){logger[_0xb2c4('0x18')]('AddTags',_0x3ae0c8[_0xb2c4('0x1b')],_0x4ac179);_0x12a35b(_this[_0xb2c4('0x18')](0x1f4,_0x3ae0c8['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0b1b1fc..d851e3a 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 _0xb96c=['update','emit','removeListener','register','length','chatInteraction:'];(function(_0x1ea85b,_0x1fbaf0){var _0x38665a=function(_0x1e3695){while(--_0x1e3695){_0x1ea85b['push'](_0x1ea85b['shift']());}};_0x38665a(++_0x1fbaf0);}(_0xb96c,0xd2));var _0xcb96=function(_0x43e54d,_0xc34f31){_0x43e54d=_0x43e54d-0x0;var _0x2fc9e7=_0xb96c[_0x43e54d];return _0x2fc9e7;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save','remove',_0xcb96('0x0')];function createListener(_0x55b95a,_0x5b2b21){return function(_0x7098c9){_0x5b2b21[_0xcb96('0x1')](_0x55b95a,_0x7098c9);};}function removeListener(_0x4216a0,_0x226a91){return function(){ChatInteractionEvents[_0xcb96('0x2')](_0x4216a0,_0x226a91);};}exports[_0xcb96('0x3')]=function(_0x48dbfd){for(var _0x4345df=0x0,_0x334821=events[_0xcb96('0x4')];_0x4345df<_0x334821;_0x4345df++){var _0x2e5b5e=events[_0x4345df];var _0x573e15=createListener(_0xcb96('0x5')+_0x2e5b5e,_0x48dbfd);ChatInteractionEvents['on'](_0x2e5b5e,_0x573e15);}}; \ No newline at end of file +var _0x427f=['update','emit','removeListener','length','./chatInteraction.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x427f,0x1ba));var _0xf427=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x427f[_0x3947c9];return _0x2e7871;};'use strict';var ChatInteractionEvents=require(_0xf427('0x0'));var events=[_0xf427('0x1'),'remove',_0xf427('0x2')];function createListener(_0x59f4ae,_0x20688a){return function(_0x443bfb){_0x20688a[_0xf427('0x3')](_0x59f4ae,_0x443bfb);};}function removeListener(_0x580bb6,_0x4cabc2){return function(){ChatInteractionEvents[_0xf427('0x4')](_0x580bb6,_0x4cabc2);};}exports['register']=function(_0xf282bf){for(var _0xb9c752=0x0,_0xd484e6=events[_0xf427('0x5')];_0xb9c752<_0xd484e6;_0xb9c752++){var _0x1705f2=events[_0xb9c752];var _0x136fa9=createListener('chatInteraction:'+_0x1705f2,_0xf282bf);ChatInteractionEvents['on'](_0x1705f2,_0x136fa9);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3ece281..fe2d718 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 _0x1fd9=['/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','update','abandon','/:id/close','close','delete','destroy','removeTags','multer','path','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x1fd9,0x7f));var _0x91fd=function(_0x1a9894,_0x491603){_0x1a9894=_0x1a9894-0x0;var _0x9e9b9d=_0x1fd9[_0x1a9894];return _0x9e9b9d;};'use strict';var multer=require(_0x91fd('0x0'));var util=require('util');var path=require(_0x91fd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x91fd('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x91fd('0x3'));var config=require(_0x91fd('0x4'));var controller=require(_0x91fd('0x5'));router[_0x91fd('0x6')]('/',auth['isAuthenticated'](),controller[_0x91fd('0x7')]);router[_0x91fd('0x6')](_0x91fd('0x8'),auth[_0x91fd('0x9')](),controller[_0x91fd('0xa')]);router[_0x91fd('0x6')](_0x91fd('0xb'),auth[_0x91fd('0xc')](),controller[_0x91fd('0xd')]);router[_0x91fd('0x6')](_0x91fd('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x91fd('0xf')]);router[_0x91fd('0x6')](_0x91fd('0x10'),auth[_0x91fd('0x9')](),controller['getMessages']);router[_0x91fd('0x6')](_0x91fd('0x11'),auth[_0x91fd('0xc')](),controller['getMyMessages']);router[_0x91fd('0x6')](_0x91fd('0x12'),auth['isAuthenticated'](),controller[_0x91fd('0x13')]);router[_0x91fd('0x14')]('/',auth[_0x91fd('0x9')](),controller['create']);router[_0x91fd('0x14')](_0x91fd('0x15'),auth[_0x91fd('0x9')](),controller[_0x91fd('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c58e6,_0x3415fb,_0x3cec6c){_0x3cec6c(null,path[_0x91fd('0x17')](config[_0x91fd('0x18')],_0x91fd('0x19')));},'filename':function(_0x5117fc,_0x32f6c7,_0x436863){_0x436863(null,util[_0x91fd('0x1a')](_0x91fd('0x1b'),Date[_0x91fd('0x1c')](),_0x32f6c7[_0x91fd('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x91fd('0x1e')](_0x91fd('0x1f')),controller[_0x91fd('0x20')]);router[_0x91fd('0x14')]('/:id/messages',auth[_0x91fd('0xc')](),controller[_0x91fd('0x21')]);router[_0x91fd('0x14')](_0x91fd('0x22'),auth['isAuthenticated'](),interaction[_0x91fd('0x23')](_0x91fd('0x24'),'chatinteraction:addtags'),controller[_0x91fd('0x25')]);router[_0x91fd('0x26')](_0x91fd('0xb'),auth[_0x91fd('0x9')](),interaction['tracked']('chat',_0x91fd('0x27')),controller[_0x91fd('0x28')]);router[_0x91fd('0x26')]('/:id/custom_update',controller['customUpdate']);router[_0x91fd('0x26')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x91fd('0x29')]);router[_0x91fd('0x26')](_0x91fd('0x2a'),controller[_0x91fd('0x2b')]);router[_0x91fd('0x2c')](_0x91fd('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x91fd('0x24'),'chatinteraction:destroy'),controller[_0x91fd('0x2d')]);router['delete'](_0x91fd('0x22'),auth[_0x91fd('0x9')](),controller[_0x91fd('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x4e0c=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','close','chatinteraction:destroy','delete','removeTags'];(function(_0x35a724,_0x1ff8ab){var _0x324516=function(_0x27829a){while(--_0x27829a){_0x35a724['push'](_0x35a724['shift']());}};_0x324516(++_0x1ff8ab);}(_0x4e0c,0x139));var _0xc4e0=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x4e0c[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0xc4e0('0x0'));var util=require(_0xc4e0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc4e0('0x2'));var router=express[_0xc4e0('0x3')]();var fs_extra=require(_0xc4e0('0x4'));var auth=require(_0xc4e0('0x5'));var interaction=require(_0xc4e0('0x6'));var config=require(_0xc4e0('0x7'));var controller=require('./chatInteraction.controller');router[_0xc4e0('0x8')]('/',auth[_0xc4e0('0x9')](),controller['index']);router[_0xc4e0('0x8')](_0xc4e0('0xa'),auth[_0xc4e0('0x9')](),controller[_0xc4e0('0xb')]);router[_0xc4e0('0x8')](_0xc4e0('0xc'),auth[_0xc4e0('0xd')](),controller[_0xc4e0('0xe')]);router[_0xc4e0('0x8')](_0xc4e0('0xf'),auth[_0xc4e0('0xd')](),controller['attachmentDownload']);router[_0xc4e0('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc4e0('0x10')]);router[_0xc4e0('0x8')](_0xc4e0('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xc4e0('0x12')]);router[_0xc4e0('0x8')](_0xc4e0('0x13'),auth[_0xc4e0('0x9')](),controller[_0xc4e0('0x14')]);router[_0xc4e0('0x15')]('/',auth[_0xc4e0('0x9')](),controller[_0xc4e0('0x16')]);router[_0xc4e0('0x15')](_0xc4e0('0x17'),auth[_0xc4e0('0x9')](),controller[_0xc4e0('0x18')]);var upload=multer({'storage':multer[_0xc4e0('0x19')]({'destination':function(_0x5c2973,_0x11993e,_0x39f35f){_0x39f35f(null,path[_0xc4e0('0x1a')](config['root'],_0xc4e0('0x1b')));},'filename':function(_0x579977,_0x1b9d84,_0x3fcd24){_0x3fcd24(null,util[_0xc4e0('0x1c')]('%s-%s',Date[_0xc4e0('0x1d')](),_0x1b9d84[_0xc4e0('0x1e')][_0xc4e0('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xc4e0('0x20')](_0xc4e0('0x21')),controller[_0xc4e0('0x22')]);router[_0xc4e0('0x15')](_0xc4e0('0x23'),auth[_0xc4e0('0xd')](),controller[_0xc4e0('0x24')]);router[_0xc4e0('0x15')](_0xc4e0('0x25'),auth[_0xc4e0('0x9')](),interaction[_0xc4e0('0x26')](_0xc4e0('0x27'),_0xc4e0('0x28')),controller['addTags']);router[_0xc4e0('0x29')](_0xc4e0('0xc'),auth[_0xc4e0('0x9')](),interaction[_0xc4e0('0x26')]('chat',_0xc4e0('0x2a')),controller[_0xc4e0('0x2b')]);router[_0xc4e0('0x29')]('/:id/custom_update',controller[_0xc4e0('0x2c')]);router[_0xc4e0('0x29')](_0xc4e0('0x2d'),auth[_0xc4e0('0xd')](),controller[_0xc4e0('0x2e')]);router[_0xc4e0('0x29')]('/:id/close',controller[_0xc4e0('0x2f')]);router['delete'](_0xc4e0('0xc'),auth[_0xc4e0('0x9')](),interaction[_0xc4e0('0x26')]('chat',_0xc4e0('0x30')),controller['destroy']);router[_0xc4e0('0x31')](_0xc4e0('0x25'),auth[_0xc4e0('0x9')](),controller[_0xc4e0('0x32')]);module[_0xc4e0('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4259ffc..aa98379 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 _0x2c99=['BOOLEAN','INTEGER','medium'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c99,0x1cd));var _0x92c9=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x2c99[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x92c9('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x92c9('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x92c9('0x2')]}}; \ No newline at end of file +var _0x5bbd=['INTEGER','sequelize','exports','TEXT','BOOLEAN'];(function(_0x4f6194,_0x1e31de){var _0x350b3c=function(_0x26dc15){while(--_0x26dc15){_0x4f6194['push'](_0x4f6194['shift']());}};_0x350b3c(++_0x1e31de);}(_0x5bbd,0x119));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd5bb('0x0'));module[_0xd5bb('0x1')]={'body':{'type':Sequelize[_0xd5bb('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd5bb('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xd5bb('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9fee2c8..5f7714a 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 _0x5ca6=['Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','FromId','ToId','-createdAt','all','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatInternalMessage.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','ChatInternalMessage','fieldName','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','options','includeAll','include','show','params','keys','find','create','body','catch','describe','get','messages','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','findAll','agent','admin','user','online','-online','VoiceQueue','VoiceQueues','role','UserProfileSection'];(function(_0x277d51,_0x31c8ed){var _0xc569fe=function(_0x257c5b){while(--_0x257c5b){_0x277d51['push'](_0x277d51['shift']());}};_0xc569fe(++_0x31c8ed);}(_0x5ca6,0x1ae));var _0x65ca=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0x5ca6[_0xc87d08];return _0x30a714;};'use strict';var emlformat=require(_0x65ca('0x0'));var rimraf=require(_0x65ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x65ca('0x2'));var moment=require('moment');var BPromise=require(_0x65ca('0x3'));var Mustache=require(_0x65ca('0x4'));var util=require(_0x65ca('0x5'));var path=require('path');var sox=require(_0x65ca('0x6'));var csv=require(_0x65ca('0x7'));var ejs=require(_0x65ca('0x8'));var fs=require('fs');var fs_extra=require(_0x65ca('0x9'));var _=require('lodash');var squel=require(_0x65ca('0xa'));var crypto=require('crypto');var jsforce=require(_0x65ca('0xb'));var deskjs=require(_0x65ca('0xc'));var toCsv=require(_0x65ca('0x7'));var querystring=require(_0x65ca('0xd'));var Papa=require(_0x65ca('0xe'));var Redis=require(_0x65ca('0xf'));var authService=require(_0x65ca('0x10'));var qs=require(_0x65ca('0x11'));var as=require(_0x65ca('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65ca('0x13'))(_0x65ca('0x14'));var utils=require(_0x65ca('0x15'));var config=require(_0x65ca('0x16'));var licenseUtil=require(_0x65ca('0x17'));var db=require(_0x65ca('0x18'))['db'];config['redis']=_[_0x65ca('0x19')](config[_0x65ca('0x1a')],{'host':_0x65ca('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65ca('0x1a')]));require(_0x65ca('0x1c'))['register'](socket);function respondWithStatusCode(_0x19f6e4,_0x1d67e5){_0x1d67e5=_0x1d67e5||0xcc;return function(_0x1b27f1){if(_0x1b27f1){return _0x19f6e4['sendStatus'](_0x1d67e5);}return _0x19f6e4[_0x65ca('0x1d')](_0x1d67e5)[_0x65ca('0x1e')]();};}function respondWithResult(_0x394eee,_0x4fe99a){_0x4fe99a=_0x4fe99a||0xc8;return function(_0x57b949){if(_0x57b949){return _0x394eee[_0x65ca('0x1d')](_0x4fe99a)[_0x65ca('0x1f')](_0x57b949);}};}function respondWithFilteredResult(_0x32f7cf,_0x54758e){return function(_0x36bcfe){if(_0x36bcfe){var _0x24c366=typeof _0x54758e[_0x65ca('0x20')]===_0x65ca('0x21')&&typeof _0x54758e[_0x65ca('0x22')]===_0x65ca('0x21');var _0xd6d101=_0x36bcfe[_0x65ca('0x23')];var _0x33f52e=_0x24c366?0x0:_0x54758e[_0x65ca('0x20')];var _0x3509cb=_0x24c366?_0x36bcfe['count']:_0x54758e[_0x65ca('0x20')]+_0x54758e[_0x65ca('0x22')];var _0x2c3bb7;if(_0x3509cb>=_0xd6d101){_0x3509cb=_0xd6d101;_0x2c3bb7=0xc8;}else{_0x2c3bb7=0xce;}_0x32f7cf[_0x65ca('0x1d')](_0x2c3bb7);return _0x32f7cf[_0x65ca('0x24')](_0x65ca('0x25'),_0x33f52e+'-'+_0x3509cb+'/'+_0xd6d101)[_0x65ca('0x1f')](_0x36bcfe);}return null;};}function patchUpdates(_0x930c57){return function(_0x59db96){try{jsonpatch[_0x65ca('0x26')](_0x59db96,_0x930c57,!![]);}catch(_0x11a40e){return BPromise[_0x65ca('0x27')](_0x11a40e);}return _0x59db96[_0x65ca('0x28')]();};}function saveUpdates(_0x56e6bd,_0xfdc2d4){return function(_0x2d3dfa){if(_0x2d3dfa){return _0x2d3dfa[_0x65ca('0x29')](_0x56e6bd)[_0x65ca('0x2a')](function(_0x52c2ab){return _0x52c2ab;});}return null;};}function removeEntity(_0x2f34ba,_0x56a547){return function(_0x52f8ff){if(_0x52f8ff){return _0x52f8ff[_0x65ca('0x2b')]()['then'](function(){_0x2f34ba[_0x65ca('0x1d')](0xcc)[_0x65ca('0x1e')]();});}};}function handleEntityNotFound(_0xf5569a,_0x223fbe){return function(_0x18bebd){if(!_0x18bebd){_0xf5569a['sendStatus'](0x194);}return _0x18bebd;};}function handleError(_0x41c373,_0x32d30d){_0x32d30d=_0x32d30d||0x1f4;return function(_0x399e0f){logger[_0x65ca('0x2c')](_0x399e0f['stack']);if(_0x399e0f[_0x65ca('0x2d')]){delete _0x399e0f['name'];}_0x41c373[_0x65ca('0x1d')](_0x32d30d)[_0x65ca('0x2e')](_0x399e0f);};}exports['index']=function(_0x431357,_0x2b95bc){var _0x22257c={},_0x258e9f={},_0x2123e2={'count':0x0,'rows':[]};var _0x75b3f7=_['map'](db[_0x65ca('0x2f')]['rawAttributes'],function(_0x3c56b8){return{'name':_0x3c56b8[_0x65ca('0x30')],'type':_0x3c56b8[_0x65ca('0x31')]['key']};});_0x258e9f['model']=_['map'](_0x75b3f7,_0x65ca('0x2d'));_0x258e9f[_0x65ca('0x32')]=_['keys'](_0x431357[_0x65ca('0x32')]);_0x258e9f['filters']=_[_0x65ca('0x33')](_0x258e9f['model'],_0x258e9f[_0x65ca('0x32')]);_0x22257c[_0x65ca('0x34')]=_[_0x65ca('0x33')](_0x258e9f[_0x65ca('0x35')],qs[_0x65ca('0x36')](_0x431357[_0x65ca('0x32')][_0x65ca('0x36')]));_0x22257c['attributes']=_0x22257c['attributes'][_0x65ca('0x37')]?_0x22257c['attributes']:_0x258e9f['model'];if(!_0x431357[_0x65ca('0x32')][_0x65ca('0x38')](_0x65ca('0x39'))){_0x22257c[_0x65ca('0x22')]=qs[_0x65ca('0x22')](_0x431357[_0x65ca('0x32')][_0x65ca('0x22')]);_0x22257c[_0x65ca('0x20')]=qs['offset'](_0x431357['query'][_0x65ca('0x20')]);}_0x22257c['order']=qs[_0x65ca('0x3a')](_0x431357[_0x65ca('0x32')][_0x65ca('0x3a')]);_0x22257c[_0x65ca('0x3b')]=qs[_0x65ca('0x3c')](_[_0x65ca('0x3d')](_0x431357[_0x65ca('0x32')],_0x258e9f[_0x65ca('0x3c')]),_0x75b3f7);if(_0x431357[_0x65ca('0x32')][_0x65ca('0x3e')]){_0x22257c['where']=_['merge'](_0x22257c[_0x65ca('0x3b')],{'$or':_[_0x65ca('0x3f')](_0x75b3f7,function(_0x2ead77){if(_0x2ead77['type']!=='VIRTUAL'){var _0x2e3358={};_0x2e3358[_0x2ead77[_0x65ca('0x2d')]]={'$like':'%'+_0x431357[_0x65ca('0x32')][_0x65ca('0x3e')]+'%'};return _0x2e3358;}})});}_0x22257c=_[_0x65ca('0x40')]({},_0x22257c,_0x431357[_0x65ca('0x41')]);var _0x23d8ea={'where':_0x22257c['where']};return db[_0x65ca('0x2f')]['count'](_0x23d8ea)[_0x65ca('0x2a')](function(_0x351999){_0x2123e2[_0x65ca('0x23')]=_0x351999;if(_0x431357[_0x65ca('0x32')][_0x65ca('0x42')]){_0x22257c[_0x65ca('0x43')]=[{'all':!![]}];}return db[_0x65ca('0x2f')]['findAll'](_0x22257c);})[_0x65ca('0x2a')](function(_0x2e4275){_0x2123e2['rows']=_0x2e4275;return _0x2123e2;})[_0x65ca('0x2a')](respondWithFilteredResult(_0x2b95bc,_0x22257c))['catch'](handleError(_0x2b95bc,null));};exports[_0x65ca('0x44')]=function(_0x283ec6,_0x5e056c){var _0x1fe50c={'raw':!![],'where':{'id':_0x283ec6[_0x65ca('0x45')]['id']}},_0x9a6f57={};_0x9a6f57[_0x65ca('0x35')]=_[_0x65ca('0x46')](db[_0x65ca('0x2f')]['rawAttributes']);_0x9a6f57[_0x65ca('0x32')]=_[_0x65ca('0x46')](_0x283ec6[_0x65ca('0x32')]);_0x9a6f57[_0x65ca('0x3c')]=_[_0x65ca('0x33')](_0x9a6f57[_0x65ca('0x35')],_0x9a6f57[_0x65ca('0x32')]);_0x1fe50c['attributes']=_['intersection'](_0x9a6f57[_0x65ca('0x35')],qs[_0x65ca('0x36')](_0x283ec6[_0x65ca('0x32')][_0x65ca('0x36')]));_0x1fe50c[_0x65ca('0x34')]=_0x1fe50c['attributes'][_0x65ca('0x37')]?_0x1fe50c[_0x65ca('0x34')]:_0x9a6f57[_0x65ca('0x35')];if(_0x283ec6[_0x65ca('0x32')][_0x65ca('0x42')]){_0x1fe50c[_0x65ca('0x43')]=[{'all':!![]}];}_0x1fe50c=_['merge']({},_0x1fe50c,_0x283ec6[_0x65ca('0x41')]);return db['ChatInternalMessage'][_0x65ca('0x47')](_0x1fe50c)[_0x65ca('0x2a')](handleEntityNotFound(_0x5e056c,null))[_0x65ca('0x2a')](respondWithResult(_0x5e056c,null))['catch'](handleError(_0x5e056c,null));};exports['create']=function(_0xbc8323,_0x2f1203){return db[_0x65ca('0x2f')][_0x65ca('0x48')](_0xbc8323[_0x65ca('0x49')],{})[_0x65ca('0x2a')](respondWithResult(_0x2f1203,0xc9))[_0x65ca('0x4a')](handleError(_0x2f1203,null));};exports[_0x65ca('0x29')]=function(_0x148c0a,_0x11922d){if(_0x148c0a['body']['id']){delete _0x148c0a[_0x65ca('0x49')]['id'];}return db[_0x65ca('0x2f')]['find']({'where':{'id':_0x148c0a[_0x65ca('0x45')]['id']}})[_0x65ca('0x2a')](handleEntityNotFound(_0x11922d,null))[_0x65ca('0x2a')](saveUpdates(_0x148c0a[_0x65ca('0x49')],null))[_0x65ca('0x2a')](respondWithResult(_0x11922d,null))[_0x65ca('0x4a')](handleError(_0x11922d,null));};exports[_0x65ca('0x2b')]=function(_0x1b401c,_0x265ff9){return db[_0x65ca('0x2f')][_0x65ca('0x47')]({'where':{'id':_0x1b401c[_0x65ca('0x45')]['id']}})[_0x65ca('0x2a')](handleEntityNotFound(_0x265ff9,null))[_0x65ca('0x2a')](removeEntity(_0x265ff9,null))['catch'](handleError(_0x265ff9,null));};exports[_0x65ca('0x4b')]=function(_0x294fbf,_0x5e7fb2){return db[_0x65ca('0x2f')]['describe']()[_0x65ca('0x2a')](respondWithResult(_0x5e7fb2,null))[_0x65ca('0x4a')](handleError(_0x5e7fb2,null));};function wrapUser(_0x42fcbe){return function(_0x2724b8){var _0x51b1b8=_0x42fcbe[_0x65ca('0x4c')]({'plain':!![]});_0x51b1b8[_0x65ca('0x4d')]=[];if(_0x2724b8){_0x51b1b8['lastMessageAt']=_0x2724b8[_0x65ca('0x4e')];_0x51b1b8['lastMessage']=_0x2724b8;}else{_0x51b1b8[_0x65ca('0x4f')]=moment(0x0)[_0x65ca('0x50')](_0x65ca('0x51'));_0x51b1b8[_0x65ca('0x52')]={};}return _0x51b1b8;};}exports[_0x65ca('0x53')]=function(_0x37627c,_0x54d413,_0x39565d){var _0x2d9d41=[];return db[_0x65ca('0x54')][_0x65ca('0x55')]({'where':{'role':[_0x65ca('0x56'),_0x65ca('0x57'),_0x65ca('0x58')]},'attributes':['id','fullname',_0x65ca('0x2d'),'role','userpic','internal',_0x65ca('0x59'),'lastLoginAt','allowmessenger','showWebBar'],'order':qs['sort'](_0x65ca('0x5a')),'include':[{'model':db[_0x65ca('0x5b')],'as':_0x65ca('0x5c'),'attributes':['id',_0x65ca('0x2d'),_0x65ca('0x31')],'through':{'attributes':[]}}]})[_0x65ca('0x2a')](function(_0x1536b3){if(_0x1536b3){var _0x5cd53a=_0x37627c['user']['get']({'plain':!![]});if(!_0x5cd53a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cd53a[_0x65ca('0x5d')]==='user'){return db[_0x65ca('0x5e')][_0x65ca('0x47')]({'where':{'name':_0x65ca('0x5f'),'userProfileId':_0x5cd53a[_0x65ca('0x60')]},'raw':!![]})[_0x65ca('0x2a')](function(_0x2d4fb7){if(_0x2d4fb7){if(_0x2d4fb7[_0x65ca('0x61')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2d4fb7['id']},'raw':!![]})[_0x65ca('0x2a')](function(_0x10c6f1){var _0x59113b=[];if(_[_0x65ca('0x62')](_0x10c6f1)){_0x59113b=_['filter'](_0x1536b3,function(_0x1575f3){if(_0x1575f3[_0x65ca('0x5d')]!=='agent'){return _0x1575f3;}});return _0x59113b;}else{for(var _0x3793a8=0x0;_0x3793a8<_0x1536b3['length'];_0x3793a8++){var _0x3edc82=_0x1536b3[_0x3793a8];if(_0x3edc82[_0x65ca('0x5d')]===_0x65ca('0x56')){var _0x319b62=_[_0x65ca('0x47')](_0x10c6f1,function(_0x3585e5){return _0x3585e5[_0x65ca('0x63')]===_0x3edc82['id'];});if(_0x319b62)_0x59113b[_0x65ca('0x64')](_0x3edc82);}else{_0x59113b[_0x65ca('0x64')](_0x3edc82);}}return _0x59113b;}});}else{return _0x1536b3;}}else{var _0x173ff6=_[_0x65ca('0x3e')](_0x1536b3,function(_0xd58d18){if(_0xd58d18[_0x65ca('0x5d')]!==_0x65ca('0x56')){return _0xd58d18;}});return _0x173ff6;}});}else{return _0x1536b3;}}})[_0x65ca('0x2a')](function(_0x6e2e24){var _0x52766f=[];if(_0x6e2e24){_0x2d9d41=_0x6e2e24;for(var _0x58b224=0x0;_0x58b224<_0x6e2e24['length'];_0x58b224+=0x1){_0x2d9d41[_0x58b224]['messages']=[];_0x52766f['push'](db[_0x65ca('0x2f')]['find']({'where':{'FromId':[_0x37627c[_0x65ca('0x58')]['id'],_0x6e2e24[_0x58b224]['id']],'ToId':[_0x37627c[_0x65ca('0x58')]['id'],_0x6e2e24[_0x58b224]['id']],'ChatGroupId':null},'attributes':['id',_0x65ca('0x4e'),_0x65ca('0x65'),_0x65ca('0x66'),'read',_0x65ca('0x49')],'order':qs[_0x65ca('0x3a')](_0x65ca('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x65ca('0x2a')](wrapUser(_0x6e2e24[_0x58b224])));}return BPromise[_0x65ca('0x68')](_0x52766f);}return[];})[_0x65ca('0x2a')](function(_0x50121b){return{'rows':_0x50121b,'count':_0x50121b['length']};})[_0x65ca('0x2a')](respondWithResult(_0x54d413,null))[_0x65ca('0x4a')](handleError(_0x54d413,null));}; \ No newline at end of file +var _0xbfd5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','length','include','find','create','body','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','findAll','agent','admin','user','fullname','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','autoAssociation','UserProfileResource','push','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key'];(function(_0x4a1c63,_0x47ca29){var _0x46b72b=function(_0x428da9){while(--_0x428da9){_0x4a1c63['push'](_0x4a1c63['shift']());}};_0x46b72b(++_0x47ca29);}(_0xbfd5,0xa5));var _0x5bfd=function(_0x2a8e7b,_0x10a139){_0x2a8e7b=_0x2a8e7b-0x0;var _0x2c7f59=_0xbfd5[_0x2a8e7b];return _0x2c7f59;};'use strict';var emlformat=require(_0x5bfd('0x0'));var rimraf=require(_0x5bfd('0x1'));var zipdir=require(_0x5bfd('0x2'));var jsonpatch=require(_0x5bfd('0x3'));var rp=require(_0x5bfd('0x4'));var moment=require(_0x5bfd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5bfd('0x6'));var path=require(_0x5bfd('0x7'));var sox=require('sox');var csv=require(_0x5bfd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bfd('0x9'));var _=require(_0x5bfd('0xa'));var squel=require(_0x5bfd('0xb'));var crypto=require(_0x5bfd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5bfd('0xd'));var toCsv=require(_0x5bfd('0x8'));var querystring=require(_0x5bfd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5bfd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5bfd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bfd('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5bfd('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bfd('0x13'))['db'];config[_0x5bfd('0x14')]=_['defaults'](config[_0x5bfd('0x14')],{'host':_0x5bfd('0x15'),'port':0x18eb});var socket=require(_0x5bfd('0x16'))(new Redis(config[_0x5bfd('0x14')]));require('./chatInternalMessage.socket')[_0x5bfd('0x17')](socket);function respondWithStatusCode(_0x303824,_0x3e98d9){_0x3e98d9=_0x3e98d9||0xcc;return function(_0x14671f){if(_0x14671f){return _0x303824[_0x5bfd('0x18')](_0x3e98d9);}return _0x303824['status'](_0x3e98d9)[_0x5bfd('0x19')]();};}function respondWithResult(_0x5d71a4,_0x4720d0){_0x4720d0=_0x4720d0||0xc8;return function(_0xd090ff){if(_0xd090ff){return _0x5d71a4['status'](_0x4720d0)[_0x5bfd('0x1a')](_0xd090ff);}};}function respondWithFilteredResult(_0x50e15c,_0x421549){return function(_0x32364e){if(_0x32364e){var _0x51bdb5=typeof _0x421549[_0x5bfd('0x1b')]===_0x5bfd('0x1c')&&typeof _0x421549[_0x5bfd('0x1d')]===_0x5bfd('0x1c');var _0x24a945=_0x32364e[_0x5bfd('0x1e')];var _0x500c42=_0x51bdb5?0x0:_0x421549[_0x5bfd('0x1b')];var _0x409d19=_0x51bdb5?_0x32364e[_0x5bfd('0x1e')]:_0x421549[_0x5bfd('0x1b')]+_0x421549[_0x5bfd('0x1d')];var _0x7b9ce5;if(_0x409d19>=_0x24a945){_0x409d19=_0x24a945;_0x7b9ce5=0xc8;}else{_0x7b9ce5=0xce;}_0x50e15c[_0x5bfd('0x1f')](_0x7b9ce5);return _0x50e15c[_0x5bfd('0x20')](_0x5bfd('0x21'),_0x500c42+'-'+_0x409d19+'/'+_0x24a945)[_0x5bfd('0x1a')](_0x32364e);}return null;};}function patchUpdates(_0x8aca42){return function(_0x22e033){try{jsonpatch[_0x5bfd('0x22')](_0x22e033,_0x8aca42,!![]);}catch(_0x18b59d){return BPromise[_0x5bfd('0x23')](_0x18b59d);}return _0x22e033[_0x5bfd('0x24')]();};}function saveUpdates(_0x36864f,_0x158306){return function(_0x29ef36){if(_0x29ef36){return _0x29ef36['update'](_0x36864f)[_0x5bfd('0x25')](function(_0x4cce77){return _0x4cce77;});}return null;};}function removeEntity(_0x53a265,_0xce2657){return function(_0x5c8390){if(_0x5c8390){return _0x5c8390[_0x5bfd('0x26')]()[_0x5bfd('0x25')](function(){_0x53a265['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1845a3,_0x54235d){return function(_0x1f72a9){if(!_0x1f72a9){_0x1845a3[_0x5bfd('0x18')](0x194);}return _0x1f72a9;};}function handleError(_0x479893,_0x58a2ec){_0x58a2ec=_0x58a2ec||0x1f4;return function(_0x36cde8){logger['error'](_0x36cde8[_0x5bfd('0x27')]);if(_0x36cde8[_0x5bfd('0x28')]){delete _0x36cde8[_0x5bfd('0x28')];}_0x479893['status'](_0x58a2ec)[_0x5bfd('0x29')](_0x36cde8);};}exports[_0x5bfd('0x2a')]=function(_0x14c2f0,_0x3dd46b){var _0x2049b2={},_0x34b9b1={},_0x2489b6={'count':0x0,'rows':[]};var _0x54e326=_[_0x5bfd('0x2b')](db[_0x5bfd('0x2c')][_0x5bfd('0x2d')],function(_0x461d56){return{'name':_0x461d56[_0x5bfd('0x2e')],'type':_0x461d56[_0x5bfd('0x2f')][_0x5bfd('0x30')]};});_0x34b9b1[_0x5bfd('0x31')]=_[_0x5bfd('0x2b')](_0x54e326,_0x5bfd('0x28'));_0x34b9b1[_0x5bfd('0x32')]=_[_0x5bfd('0x33')](_0x14c2f0[_0x5bfd('0x32')]);_0x34b9b1['filters']=_[_0x5bfd('0x34')](_0x34b9b1[_0x5bfd('0x31')],_0x34b9b1[_0x5bfd('0x32')]);_0x2049b2[_0x5bfd('0x35')]=_[_0x5bfd('0x34')](_0x34b9b1[_0x5bfd('0x31')],qs[_0x5bfd('0x36')](_0x14c2f0[_0x5bfd('0x32')]['fields']));_0x2049b2[_0x5bfd('0x35')]=_0x2049b2['attributes']['length']?_0x2049b2[_0x5bfd('0x35')]:_0x34b9b1[_0x5bfd('0x31')];if(!_0x14c2f0[_0x5bfd('0x32')][_0x5bfd('0x37')](_0x5bfd('0x38'))){_0x2049b2[_0x5bfd('0x1d')]=qs['limit'](_0x14c2f0[_0x5bfd('0x32')][_0x5bfd('0x1d')]);_0x2049b2[_0x5bfd('0x1b')]=qs[_0x5bfd('0x1b')](_0x14c2f0[_0x5bfd('0x32')][_0x5bfd('0x1b')]);}_0x2049b2[_0x5bfd('0x39')]=qs[_0x5bfd('0x3a')](_0x14c2f0[_0x5bfd('0x32')][_0x5bfd('0x3a')]);_0x2049b2[_0x5bfd('0x3b')]=qs[_0x5bfd('0x3c')](_[_0x5bfd('0x3d')](_0x14c2f0[_0x5bfd('0x32')],_0x34b9b1['filters']),_0x54e326);if(_0x14c2f0[_0x5bfd('0x32')]['filter']){_0x2049b2[_0x5bfd('0x3b')]=_[_0x5bfd('0x3e')](_0x2049b2[_0x5bfd('0x3b')],{'$or':_[_0x5bfd('0x2b')](_0x54e326,function(_0x24e941){if(_0x24e941[_0x5bfd('0x2f')]!==_0x5bfd('0x3f')){var _0x18ecd4={};_0x18ecd4[_0x24e941[_0x5bfd('0x28')]]={'$like':'%'+_0x14c2f0['query'][_0x5bfd('0x40')]+'%'};return _0x18ecd4;}})});}_0x2049b2=_[_0x5bfd('0x3e')]({},_0x2049b2,_0x14c2f0[_0x5bfd('0x41')]);var _0x47b72f={'where':_0x2049b2[_0x5bfd('0x3b')]};return db['ChatInternalMessage'][_0x5bfd('0x1e')](_0x47b72f)[_0x5bfd('0x25')](function(_0x30c53f){_0x2489b6['count']=_0x30c53f;if(_0x14c2f0['query'][_0x5bfd('0x42')]){_0x2049b2['include']=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x2049b2);})[_0x5bfd('0x25')](function(_0x23f662){_0x2489b6[_0x5bfd('0x43')]=_0x23f662;return _0x2489b6;})['then'](respondWithFilteredResult(_0x3dd46b,_0x2049b2))[_0x5bfd('0x44')](handleError(_0x3dd46b,null));};exports[_0x5bfd('0x45')]=function(_0x59709a,_0x114218){var _0x3d73da={'raw':!![],'where':{'id':_0x59709a[_0x5bfd('0x46')]['id']}},_0x42f877={};_0x42f877[_0x5bfd('0x31')]=_[_0x5bfd('0x33')](db[_0x5bfd('0x2c')][_0x5bfd('0x2d')]);_0x42f877['query']=_['keys'](_0x59709a[_0x5bfd('0x32')]);_0x42f877['filters']=_[_0x5bfd('0x34')](_0x42f877[_0x5bfd('0x31')],_0x42f877[_0x5bfd('0x32')]);_0x3d73da['attributes']=_[_0x5bfd('0x34')](_0x42f877[_0x5bfd('0x31')],qs[_0x5bfd('0x36')](_0x59709a['query']['fields']));_0x3d73da[_0x5bfd('0x35')]=_0x3d73da[_0x5bfd('0x35')][_0x5bfd('0x47')]?_0x3d73da[_0x5bfd('0x35')]:_0x42f877['model'];if(_0x59709a['query']['includeAll']){_0x3d73da[_0x5bfd('0x48')]=[{'all':!![]}];}_0x3d73da=_['merge']({},_0x3d73da,_0x59709a[_0x5bfd('0x41')]);return db['ChatInternalMessage'][_0x5bfd('0x49')](_0x3d73da)[_0x5bfd('0x25')](handleEntityNotFound(_0x114218,null))['then'](respondWithResult(_0x114218,null))[_0x5bfd('0x44')](handleError(_0x114218,null));};exports[_0x5bfd('0x4a')]=function(_0x5e4f1f,_0x410c26){return db['ChatInternalMessage'][_0x5bfd('0x4a')](_0x5e4f1f[_0x5bfd('0x4b')],{})[_0x5bfd('0x25')](respondWithResult(_0x410c26,0xc9))[_0x5bfd('0x44')](handleError(_0x410c26,null));};exports['update']=function(_0x23f94d,_0xb47295){if(_0x23f94d[_0x5bfd('0x4b')]['id']){delete _0x23f94d[_0x5bfd('0x4b')]['id'];}return db[_0x5bfd('0x2c')][_0x5bfd('0x49')]({'where':{'id':_0x23f94d[_0x5bfd('0x46')]['id']}})[_0x5bfd('0x25')](handleEntityNotFound(_0xb47295,null))[_0x5bfd('0x25')](saveUpdates(_0x23f94d[_0x5bfd('0x4b')],null))[_0x5bfd('0x25')](respondWithResult(_0xb47295,null))[_0x5bfd('0x44')](handleError(_0xb47295,null));};exports[_0x5bfd('0x26')]=function(_0x35a8a7,_0x4b02e5){return db['ChatInternalMessage'][_0x5bfd('0x49')]({'where':{'id':_0x35a8a7[_0x5bfd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b02e5,null))[_0x5bfd('0x25')](removeEntity(_0x4b02e5,null))[_0x5bfd('0x44')](handleError(_0x4b02e5,null));};exports[_0x5bfd('0x4c')]=function(_0x5dd747,_0x173b10){return db['ChatInternalMessage'][_0x5bfd('0x4c')]()[_0x5bfd('0x25')](respondWithResult(_0x173b10,null))[_0x5bfd('0x44')](handleError(_0x173b10,null));};function wrapUser(_0x5f599c){return function(_0x294314){var _0x3874b8=_0x5f599c[_0x5bfd('0x4d')]({'plain':!![]});_0x3874b8[_0x5bfd('0x4e')]=[];if(_0x294314){_0x3874b8[_0x5bfd('0x4f')]=_0x294314[_0x5bfd('0x50')];_0x3874b8['lastMessage']=_0x294314;}else{_0x3874b8[_0x5bfd('0x4f')]=moment(0x0)[_0x5bfd('0x51')](_0x5bfd('0x52'));_0x3874b8[_0x5bfd('0x53')]={};}return _0x3874b8;};}exports[_0x5bfd('0x54')]=function(_0x56706c,_0x49d628,_0x8ff180){var _0x398f80=[];return db['User'][_0x5bfd('0x55')]({'where':{'role':[_0x5bfd('0x56'),_0x5bfd('0x57'),_0x5bfd('0x58')]},'attributes':['id',_0x5bfd('0x59'),_0x5bfd('0x28'),'role','userpic',_0x5bfd('0x5a'),_0x5bfd('0x5b'),_0x5bfd('0x5c'),_0x5bfd('0x5d'),_0x5bfd('0x5e')],'order':qs[_0x5bfd('0x3a')]('-online'),'include':[{'model':db[_0x5bfd('0x5f')],'as':'VoiceQueues','attributes':['id',_0x5bfd('0x28'),_0x5bfd('0x2f')],'through':{'attributes':[]}}]})[_0x5bfd('0x25')](function(_0x182655){if(_0x182655){var _0x3746f8=_0x56706c['user']['get']({'plain':!![]});if(!_0x3746f8)throw new Error(_0x5bfd('0x60'));if(_0x3746f8[_0x5bfd('0x61')]===_0x5bfd('0x58')){return db[_0x5bfd('0x62')][_0x5bfd('0x49')]({'where':{'name':_0x5bfd('0x63'),'userProfileId':_0x3746f8['userProfileId']},'raw':!![]})[_0x5bfd('0x25')](function(_0x3274a0){if(_0x3274a0){if(_0x3274a0[_0x5bfd('0x64')]===0x0){return db[_0x5bfd('0x65')][_0x5bfd('0x55')]({'where':{'sectionId':_0x3274a0['id']},'raw':!![]})[_0x5bfd('0x25')](function(_0x34cadb){var _0x271162=[];if(_['isEmpty'](_0x34cadb)){_0x271162=_[_0x5bfd('0x40')](_0x182655,function(_0x509d2e){if(_0x509d2e[_0x5bfd('0x61')]!==_0x5bfd('0x56')){return _0x509d2e;}});return _0x271162;}else{for(var _0x217b83=0x0;_0x217b83<_0x182655['length'];_0x217b83++){var _0x4d099b=_0x182655[_0x217b83];if(_0x4d099b[_0x5bfd('0x61')]===_0x5bfd('0x56')){var _0x1a0655=_[_0x5bfd('0x49')](_0x34cadb,function(_0x4be323){return _0x4be323['resourceId']===_0x4d099b['id'];});if(_0x1a0655)_0x271162['push'](_0x4d099b);}else{_0x271162[_0x5bfd('0x66')](_0x4d099b);}}return _0x271162;}});}else{return _0x182655;}}else{var _0x504792=_[_0x5bfd('0x40')](_0x182655,function(_0x1e72f4){if(_0x1e72f4[_0x5bfd('0x61')]!==_0x5bfd('0x56')){return _0x1e72f4;}});return _0x504792;}});}else{return _0x182655;}}})[_0x5bfd('0x25')](function(_0x283b50){var _0x30f612=[];if(_0x283b50){_0x398f80=_0x283b50;for(var _0x1a5194=0x0;_0x1a5194<_0x283b50[_0x5bfd('0x47')];_0x1a5194+=0x1){_0x398f80[_0x1a5194][_0x5bfd('0x4e')]=[];_0x30f612['push'](db['ChatInternalMessage'][_0x5bfd('0x49')]({'where':{'FromId':[_0x56706c[_0x5bfd('0x58')]['id'],_0x283b50[_0x1a5194]['id']],'ToId':[_0x56706c['user']['id'],_0x283b50[_0x1a5194]['id']],'ChatGroupId':null},'attributes':['id',_0x5bfd('0x50'),_0x5bfd('0x67'),_0x5bfd('0x68'),_0x5bfd('0x69'),_0x5bfd('0x4b')],'order':qs[_0x5bfd('0x3a')](_0x5bfd('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5bfd('0x25')](wrapUser(_0x283b50[_0x1a5194])));}return BPromise['all'](_0x30f612);}return[];})[_0x5bfd('0x25')](function(_0x59cfec){return{'rows':_0x59cfec,'count':_0x59cfec[_0x5bfd('0x47')]};})['then'](respondWithResult(_0x49d628,null))[_0x5bfd('0x44')](handleError(_0x49d628,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index db7dde5..a6deabf 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 _0x9a4d=['emit','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x9a4d,0xb7));var _0xd9a4=function(_0x563129,_0x26d5f9){_0x563129=_0x563129-0x0;var _0x28d1a3=_0x9a4d[_0x563129];return _0x28d1a3;};'use strict';var EventEmitter=require(_0xd9a4('0x0'));var ChatInternalMessage=require(_0xd9a4('0x1'))['db'][_0xd9a4('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd9a4('0x3')](0x0);var events={'afterCreate':_0xd9a4('0x4'),'afterUpdate':'update','afterDestroy':_0xd9a4('0x5')};function emitEvent(_0x386d89){return function(_0x411faf,_0x124aa3,_0xeae116){ChatInternalMessageEvents[_0xd9a4('0x6')](_0x386d89+':'+_0x411faf['id'],_0x411faf);ChatInternalMessageEvents[_0xd9a4('0x6')](_0x386d89,_0x411faf);_0xeae116(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xd9a4('0x7')](e,emitEvent(event));}}module[_0xd9a4('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1ab1=['events','setMaxListeners','emit','hook','exports'];(function(_0x3a7f8b,_0x7fe06c){var _0x34f066=function(_0x38f2a7){while(--_0x38f2a7){_0x3a7f8b['push'](_0x3a7f8b['shift']());}};_0x34f066(++_0x7fe06c);}(_0x1ab1,0x12c));var _0x11ab=function(_0x34df85,_0x13ab3c){_0x34df85=_0x34df85-0x0;var _0x1163f7=_0x1ab1[_0x34df85];return _0x1163f7;};'use strict';var EventEmitter=require(_0x11ab('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x11ab('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28a19c){return function(_0x4a6492,_0x1fc2bd,_0x363103){ChatInternalMessageEvents[_0x11ab('0x2')](_0x28a19c+':'+_0x4a6492['id'],_0x4a6492);ChatInternalMessageEvents[_0x11ab('0x2')](_0x28a19c,_0x4a6492);_0x363103(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x11ab('0x3')](e,emitEvent(event));}}module[_0x11ab('0x4')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index bf2134a..9dfe9ae 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 _0xa22d=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa22d,0x13b));var _0xda22=function(_0xc5c526,_0x5e3b32){_0xc5c526=_0xc5c526-0x0;var _0x32bc6e=_0xa22d[_0xc5c526];return _0x32bc6e;};'use strict';var _=require(_0xda22('0x0'));var util=require(_0xda22('0x1'));var logger=require(_0xda22('0x2'))('api');var moment=require(_0xda22('0x3'));var BPromise=require(_0xda22('0x4'));var rp=require(_0xda22('0x5'));var fs=require('fs');var path=require(_0xda22('0x6'));var rimraf=require(_0xda22('0x7'));var config=require(_0xda22('0x8'));var attributes=require(_0xda22('0x9'));module[_0xda22('0xa')]=function(_0x39ed3c,_0x556ed5){return _0x39ed3c[_0xda22('0xb')](_0xda22('0xc'),attributes,{'tableName':_0xda22('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xda22('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7779=['utf8mb4','lodash','util','api','bluebird','request-promise','path','define'];(function(_0x1aa5c9,_0x3229d9){var _0x137bf7=function(_0x229bc2){while(--_0x229bc2){_0x1aa5c9['push'](_0x1aa5c9['shift']());}};_0x137bf7(++_0x3229d9);}(_0x7779,0x91));var _0x9777=function(_0x3284cd,_0x2e10a2){_0x3284cd=_0x3284cd-0x0;var _0xe92280=_0x7779[_0x3284cd];return _0xe92280;};'use strict';var _=require(_0x9777('0x0'));var util=require(_0x9777('0x1'));var logger=require('../../config/logger')(_0x9777('0x2'));var moment=require('moment');var BPromise=require(_0x9777('0x3'));var rp=require(_0x9777('0x4'));var fs=require('fs');var path=require(_0x9777('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x53e03e,_0x308a63){return _0x53e03e[_0x9777('0x6')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9777('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index f6d6e4c..01c5930 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 _0xebe7=['randomstring','ioredis','../../config/logger','jayson/promise','http','redis','localhost','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3c2781,_0x50e44b){var _0xafd317=function(_0x183da4){while(--_0x183da4){_0x3c2781['push'](_0x3c2781['shift']());}};_0xafd317(++_0x50e44b);}(_0xebe7,0x165));var _0x7ebe=function(_0x65ce4e,_0x208069){_0x65ce4e=_0x65ce4e-0x0;var _0x1f68a2=_0xebe7[_0x65ce4e];return _0x1f68a2;};'use strict';var _=require(_0x7ebe('0x0'));var util=require(_0x7ebe('0x1'));var moment=require(_0x7ebe('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ebe('0x3'));var fs=require('fs');var Redis=require(_0x7ebe('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7ebe('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7ebe('0x6'));var client=jayson['client'][_0x7ebe('0x7')]({'port':0x232a});config[_0x7ebe('0x8')]=_['defaults'](config[_0x7ebe('0x8')],{'host':_0x7ebe('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ebe('0x8')]));require(_0x7ebe('0xa'))[_0x7ebe('0xb')](socket);function respondWithRpcPromise(_0x57cd3a,_0x46e234,_0x497142){return new BPromise(function(_0x502dcc,_0x12b07f){return client[_0x7ebe('0xc')](_0x57cd3a,_0x497142)['then'](function(_0xf4e5b9){logger[_0x7ebe('0xd')](_0x7ebe('0xe'),_0x46e234,_0x7ebe('0xf'));logger[_0x7ebe('0x10')](_0x7ebe('0x11'),_0x46e234,_0x7ebe('0xf'),JSON[_0x7ebe('0x12')](_0xf4e5b9));if(_0xf4e5b9[_0x7ebe('0x13')]){if(_0xf4e5b9[_0x7ebe('0x13')][_0x7ebe('0x14')]===0x1f4){logger['error'](_0x7ebe('0xe'),_0x46e234,_0xf4e5b9[_0x7ebe('0x13')][_0x7ebe('0x15')]);return _0x12b07f(_0xf4e5b9[_0x7ebe('0x13')][_0x7ebe('0x15')]);}logger[_0x7ebe('0x13')](_0x7ebe('0xe'),_0x46e234,_0xf4e5b9[_0x7ebe('0x13')][_0x7ebe('0x15')]);return _0x502dcc(_0xf4e5b9[_0x7ebe('0x13')][_0x7ebe('0x15')]);}else{logger[_0x7ebe('0xd')](_0x7ebe('0xe'),_0x46e234,_0x7ebe('0xf'));_0x502dcc(_0xf4e5b9[_0x7ebe('0x16')][_0x7ebe('0x15')]);}})[_0x7ebe('0x17')](function(_0x4de664){logger['error'](_0x7ebe('0xe'),_0x46e234,_0x4de664);_0x12b07f(_0x4de664);});});} \ No newline at end of file +var _0x1145=['util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x49a4b5,_0x420d0c){var _0x343547=function(_0xdd6b78){while(--_0xdd6b78){_0x49a4b5['push'](_0x49a4b5['shift']());}};_0x343547(++_0x420d0c);}(_0x1145,0xc7));var _0x5114=function(_0x2f7033,_0xb50c23){_0x2f7033=_0x2f7033-0x0;var _0x335046=_0x1145[_0x2f7033];return _0x335046;};'use strict';var _=require(_0x5114('0x0'));var util=require(_0x5114('0x1'));var moment=require(_0x5114('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5114('0x3'));var logger=require(_0x5114('0x4'))(_0x5114('0x5'));var config=require(_0x5114('0x6'));var jayson=require(_0x5114('0x7'));var client=jayson[_0x5114('0x8')][_0x5114('0x9')]({'port':0x232a});config[_0x5114('0xa')]=_[_0x5114('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5114('0xc'))(new Redis(config['redis']));require(_0x5114('0xd'))['register'](socket);function respondWithRpcPromise(_0x4f0807,_0x523a29,_0x5a6a6d){return new BPromise(function(_0x157767,_0xc22ee5){return client[_0x5114('0xe')](_0x4f0807,_0x5a6a6d)['then'](function(_0x1eca82){logger[_0x5114('0xf')](_0x5114('0x10'),_0x523a29,_0x5114('0x11'));logger[_0x5114('0x12')](_0x5114('0x13'),_0x523a29,_0x5114('0x11'),JSON[_0x5114('0x14')](_0x1eca82));if(_0x1eca82['error']){if(_0x1eca82[_0x5114('0x15')]['code']===0x1f4){logger[_0x5114('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x523a29,_0x1eca82['error'][_0x5114('0x16')]);return _0xc22ee5(_0x1eca82[_0x5114('0x15')][_0x5114('0x16')]);}logger['error'](_0x5114('0x10'),_0x523a29,_0x1eca82[_0x5114('0x15')]['message']);return _0x157767(_0x1eca82[_0x5114('0x15')][_0x5114('0x16')]);}else{logger[_0x5114('0xf')](_0x5114('0x10'),_0x523a29,_0x5114('0x11'));_0x157767(_0x1eca82[_0x5114('0x17')][_0x5114('0x16')]);}})[_0x5114('0x18')](function(_0x3d3893){logger['error'](_0x5114('0x10'),_0x523a29,_0x3d3893);_0xc22ee5(_0x3d3893);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 541c570..01a208e 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 _0xafd1=['removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x4e175a,_0x2bae34){var _0x2ff2c4=function(_0x2849eb){while(--_0x2849eb){_0x4e175a['push'](_0x4e175a['shift']());}};_0x2ff2c4(++_0x2bae34);}(_0xafd1,0x1e3));var _0x1afd=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0xafd1[_0x81f000];return _0x337aa2;};'use strict';var ChatInternalMessageEvents=require(_0x1afd('0x0'));var events=[_0x1afd('0x1'),_0x1afd('0x2'),_0x1afd('0x3')];function createListener(_0x254b2f,_0x3867f2){return function(_0x3da381){_0x3867f2[_0x1afd('0x4')](_0x254b2f,_0x3da381);};}function removeListener(_0x4ea749,_0x345893){return function(){ChatInternalMessageEvents[_0x1afd('0x5')](_0x4ea749,_0x345893);};}exports[_0x1afd('0x6')]=function(_0x409b28){for(var _0xda917f=0x0,_0x7765a0=events['length'];_0xda917f<_0x7765a0;_0xda917f++){var _0x8cfa7=events[_0xda917f];var _0x421e0a=createListener(_0x1afd('0x7')+_0x8cfa7,_0x409b28);ChatInternalMessageEvents['on'](_0x8cfa7,_0x421e0a);}}; \ No newline at end of file +var _0x8800=['emit','register','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x1fd59f,_0x369cbb){var _0x4c095e=function(_0x20d040){while(--_0x20d040){_0x1fd59f['push'](_0x1fd59f['shift']());}};_0x4c095e(++_0x369cbb);}(_0x8800,0x171));var _0x0880=function(_0x5cc33b,_0x18c11e){_0x5cc33b=_0x5cc33b-0x0;var _0x55400c=_0x8800[_0x5cc33b];return _0x55400c;};'use strict';var ChatInternalMessageEvents=require(_0x0880('0x0'));var events=[_0x0880('0x1'),_0x0880('0x2'),'update'];function createListener(_0x51fa64,_0x4f1267){return function(_0x4c8f81){_0x4f1267[_0x0880('0x3')](_0x51fa64,_0x4c8f81);};}function removeListener(_0x14c0dd,_0x1a9ed7){return function(){ChatInternalMessageEvents['removeListener'](_0x14c0dd,_0x1a9ed7);};}exports[_0x0880('0x4')]=function(_0x2183c8){for(var _0x17bebd=0x0,_0x4c478c=events['length'];_0x17bebd<_0x4c478c;_0x17bebd++){var _0x193459=events[_0x17bebd];var _0x39c19=createListener(_0x0880('0x5')+_0x193459,_0x2183c8);ChatInternalMessageEvents['on'](_0x193459,_0x39c19);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a6f5ec0..432c245 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 _0xdfbd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/users','getUsers','/:id','show','post','put','update','delete','destroy','multer','util'];(function(_0x308950,_0x1e3dba){var _0x147cb6=function(_0x5d5bc2){while(--_0x5d5bc2){_0x308950['push'](_0x308950['shift']());}};_0x147cb6(++_0x1e3dba);}(_0xdfbd,0x178));var _0xddfb=function(_0x4cd8d0,_0x5f082d){_0x4cd8d0=_0x4cd8d0-0x0;var _0x42eec2=_0xdfbd[_0x4cd8d0];return _0x42eec2;};'use strict';var multer=require(_0xddfb('0x0'));var util=require(_0xddfb('0x1'));var path=require(_0xddfb('0x2'));var timeout=require(_0xddfb('0x3'));var express=require(_0xddfb('0x4'));var router=express[_0xddfb('0x5')]();var fs_extra=require(_0xddfb('0x6'));var auth=require(_0xddfb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xddfb('0x8'));var controller=require('./chatInternalMessage.controller');router[_0xddfb('0x9')]('/',auth[_0xddfb('0xa')](),controller[_0xddfb('0xb')]);router[_0xddfb('0x9')]('/describe',auth[_0xddfb('0xa')](),controller['describe']);router[_0xddfb('0x9')](_0xddfb('0xc'),auth['isAuthenticated'](),controller[_0xddfb('0xd')]);router[_0xddfb('0x9')](_0xddfb('0xe'),auth['isAuthenticated'](),controller[_0xddfb('0xf')]);router[_0xddfb('0x10')]('/',auth[_0xddfb('0xa')](),controller['create']);router[_0xddfb('0x11')]('/:id',controller[_0xddfb('0x12')]);router[_0xddfb('0x13')]('/:id',auth[_0xddfb('0xa')](),controller[_0xddfb('0x14')]);module['exports']=router; \ No newline at end of file +var _0xffcc=['create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','getUsers','show','post'];(function(_0x153bfd,_0x468e54){var _0x2da318=function(_0x2a0b42){while(--_0x2a0b42){_0x153bfd['push'](_0x153bfd['shift']());}};_0x2da318(++_0x468e54);}(_0xffcc,0x90));var _0xcffc=function(_0x2a3bb6,_0x378638){_0x2a3bb6=_0x2a3bb6-0x0;var _0x2c3e03=_0xffcc[_0x2a3bb6];return _0x2c3e03;};'use strict';var multer=require(_0xcffc('0x0'));var util=require(_0xcffc('0x1'));var path=require(_0xcffc('0x2'));var timeout=require(_0xcffc('0x3'));var express=require('express');var router=express[_0xcffc('0x4')]();var fs_extra=require(_0xcffc('0x5'));var auth=require(_0xcffc('0x6'));var interaction=require(_0xcffc('0x7'));var config=require(_0xcffc('0x8'));var controller=require(_0xcffc('0x9'));router[_0xcffc('0xa')]('/',auth[_0xcffc('0xb')](),controller[_0xcffc('0xc')]);router['get'](_0xcffc('0xd'),auth[_0xcffc('0xb')](),controller['describe']);router['get']('/users',auth[_0xcffc('0xb')](),controller[_0xcffc('0xe')]);router[_0xcffc('0xa')]('/:id',auth[_0xcffc('0xb')](),controller[_0xcffc('0xf')]);router[_0xcffc('0x10')]('/',auth['isAuthenticated'](),controller[_0xcffc('0x11')]);router[_0xcffc('0x12')](_0xcffc('0x13'),controller['update']);router[_0xcffc('0x14')](_0xcffc('0x13'),auth[_0xcffc('0xb')](),controller[_0xcffc('0x15')]);module[_0xcffc('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 429b06e..bdaed8d 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 _0x7033=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x129046,_0x519448){var _0x4d06d9=function(_0x425c26){while(--_0x425c26){_0x129046['push'](_0x129046['shift']());}};_0x4d06d9(++_0x519448);}(_0x7033,0x19e));var _0x3703=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7033[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x3703('0x0'));module[_0x3703('0x1')]={'body':{'type':Sequelize[_0x3703('0x2')](_0x3703('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x3703('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3703('0x5')]('in',_0x3703('0x6')),'defaultValue':_0x3703('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3703('0x7')]},'providerName':{'type':Sequelize[_0x3703('0x8')]},'providerResponse':{'type':Sequelize[_0x3703('0x2')]}}; \ No newline at end of file +var _0x6000=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6000,0x17c));var _0x0600=function(_0x5e3978,_0x3caf78){_0x5e3978=_0x5e3978-0x0;var _0x4edbd6=_0x6000[_0x5e3978];return _0x4edbd6;};'use strict';var Sequelize=require(_0x0600('0x0'));module[_0x0600('0x1')]={'body':{'type':Sequelize[_0x0600('0x2')](_0x0600('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0600('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0600('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0600('0x5')),'defaultValue':_0x0600('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x0600('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d4a73a3..09dbfd7 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 _0x4eab=['VIRTUAL','options','includeAll','include','rows','catch','params','create','body','find','describe','chat-interactions','accept','chat','read','readAt','format','UserId','user','agent','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','User','manual','SIP/%s','motionChannel','channel','event','EventManager','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','Sequelize','contact','internal','interface','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','send','index','map','ChatMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4eab,0x1d1));var _0xb4ea=function(_0x44f827,_0x305e00){_0x44f827=_0x44f827-0x0;var _0x2cc524=_0x4eab[_0x44f827];return _0x2cc524;};'use strict';var emlformat=require(_0xb4ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4ea('0x1'));var jsonpatch=require(_0xb4ea('0x2'));var rp=require(_0xb4ea('0x3'));var moment=require(_0xb4ea('0x4'));var BPromise=require(_0xb4ea('0x5'));var Mustache=require('mustache');var util=require(_0xb4ea('0x6'));var path=require(_0xb4ea('0x7'));var sox=require(_0xb4ea('0x8'));var csv=require('to-csv');var ejs=require(_0xb4ea('0x9'));var fs=require('fs');var fs_extra=require(_0xb4ea('0xa'));var _=require(_0xb4ea('0xb'));var squel=require('squel');var crypto=require(_0xb4ea('0xc'));var jsforce=require(_0xb4ea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb4ea('0xe'));var querystring=require(_0xb4ea('0xf'));var Papa=require(_0xb4ea('0x10'));var Redis=require(_0xb4ea('0x11'));var authService=require(_0xb4ea('0x12'));var qs=require(_0xb4ea('0x13'));var as=require(_0xb4ea('0x14'));var hardwareService=require(_0xb4ea('0x15'));var logger=require(_0xb4ea('0x16'))(_0xb4ea('0x17'));var utils=require(_0xb4ea('0x18'));var config=require(_0xb4ea('0x19'));var licenseUtil=require(_0xb4ea('0x1a'));var db=require('../../mysqldb')['db'];config[_0xb4ea('0x1b')]=_[_0xb4ea('0x1c')](config['redis'],{'host':_0xb4ea('0x1d'),'port':0x18eb});var socket=require(_0xb4ea('0x1e'))(new Redis(config['redis']));require(_0xb4ea('0x1f'))[_0xb4ea('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb4ea('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xb4ea('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d4b59,_0x3b347c,_0x75772b,_0x5e850c){return new BPromise(function(_0x94fe4c,_0x16f297){var _0x442891=_0x5e850c||client;return _0x442891[_0xb4ea('0x22')](_0x1d4b59,_0x75772b)[_0xb4ea('0x23')](function(_0x16da58){logger['info'](_0xb4ea('0x24'),_0x3b347c,'request\x20sent');logger[_0xb4ea('0x25')](_0xb4ea('0x26'),_0x3b347c,_0xb4ea('0x27'),JSON['stringify'](_0x16da58));if(_0x16da58[_0xb4ea('0x28')]){if(_0x16da58[_0xb4ea('0x28')][_0xb4ea('0x29')]===0x1f4){logger[_0xb4ea('0x28')]('ChatMessage,\x20%s,\x20%s',_0x3b347c,_0x16da58[_0xb4ea('0x28')]['message']);return _0x16f297(_0x16da58[_0xb4ea('0x28')][_0xb4ea('0x2a')]);}logger['error'](_0xb4ea('0x24'),_0x3b347c,_0x16da58[_0xb4ea('0x28')][_0xb4ea('0x2a')]);return _0x94fe4c(_0x16da58['error'][_0xb4ea('0x2a')]);}else{logger[_0xb4ea('0x2b')](_0xb4ea('0x24'),_0x3b347c,_0xb4ea('0x27'));_0x94fe4c(_0x16da58[_0xb4ea('0x2c')]['message']);}})['catch'](function(_0xb99bbb){logger[_0xb4ea('0x28')]('ChatMessage,\x20%s,\x20%s',_0x3b347c,_0xb99bbb);_0x16f297(_0xb99bbb);});});}function respondWithStatusCode(_0x238bc5,_0x3aaf48){_0x3aaf48=_0x3aaf48||0xcc;return function(_0x414a84){if(_0x414a84){return _0x238bc5[_0xb4ea('0x2d')](_0x3aaf48);}return _0x238bc5[_0xb4ea('0x2e')](_0x3aaf48)['end']();};}function respondWithResult(_0x53276a,_0x138fa5){_0x138fa5=_0x138fa5||0xc8;return function(_0x4c900f){if(_0x4c900f){return _0x53276a[_0xb4ea('0x2e')](_0x138fa5)[_0xb4ea('0x2f')](_0x4c900f);}};}function respondWithFilteredResult(_0x392299,_0x5244b6){return function(_0x1159e7){if(_0x1159e7){var _0x29bbbd=typeof _0x5244b6[_0xb4ea('0x30')]===_0xb4ea('0x31')&&typeof _0x5244b6['limit']===_0xb4ea('0x31');var _0x3b2419=_0x1159e7[_0xb4ea('0x32')];var _0x3f8c67=_0x29bbbd?0x0:_0x5244b6[_0xb4ea('0x30')];var _0x2f9922=_0x29bbbd?_0x1159e7[_0xb4ea('0x32')]:_0x5244b6['offset']+_0x5244b6[_0xb4ea('0x33')];var _0x5ab63b;if(_0x2f9922>=_0x3b2419){_0x2f9922=_0x3b2419;_0x5ab63b=0xc8;}else{_0x5ab63b=0xce;}_0x392299[_0xb4ea('0x2e')](_0x5ab63b);return _0x392299[_0xb4ea('0x34')](_0xb4ea('0x35'),_0x3f8c67+'-'+_0x2f9922+'/'+_0x3b2419)[_0xb4ea('0x2f')](_0x1159e7);}return null;};}function patchUpdates(_0x4a96e7){return function(_0x506d6c){try{jsonpatch[_0xb4ea('0x36')](_0x506d6c,_0x4a96e7,!![]);}catch(_0x10dcf5){return BPromise[_0xb4ea('0x37')](_0x10dcf5);}return _0x506d6c[_0xb4ea('0x38')]();};}function saveUpdates(_0x3fd82c,_0x421bc4){return function(_0x324c5b){if(_0x324c5b){return _0x324c5b[_0xb4ea('0x39')](_0x3fd82c)[_0xb4ea('0x23')](function(_0x2fa2dc){return _0x2fa2dc;});}return null;};}function removeEntity(_0x15ad74,_0x164a13){return function(_0x1cd4f7){if(_0x1cd4f7){return _0x1cd4f7[_0xb4ea('0x3a')]()[_0xb4ea('0x23')](function(){_0x15ad74[_0xb4ea('0x2e')](0xcc)[_0xb4ea('0x3b')]();});}};}function handleEntityNotFound(_0x395f16,_0x472e4b){return function(_0x525ccc){if(!_0x525ccc){_0x395f16[_0xb4ea('0x2d')](0x194);}return _0x525ccc;};}function handleError(_0x43c451,_0x216aae){_0x216aae=_0x216aae||0x1f4;return function(_0x507f5a){logger['error'](_0x507f5a[_0xb4ea('0x3c')]);if(_0x507f5a['name']){delete _0x507f5a['name'];}_0x43c451['status'](_0x216aae)[_0xb4ea('0x3d')](_0x507f5a);};}exports[_0xb4ea('0x3e')]=function(_0x968682,_0x251ec4){var _0x4bde14={},_0x53294c={},_0x2b275f={'count':0x0,'rows':[]};var _0x1f389d=_[_0xb4ea('0x3f')](db[_0xb4ea('0x40')]['rawAttributes'],function(_0x56d2e7){return{'name':_0x56d2e7[_0xb4ea('0x41')],'type':_0x56d2e7[_0xb4ea('0x42')][_0xb4ea('0x43')]};});_0x53294c[_0xb4ea('0x44')]=_['map'](_0x1f389d,'name');_0x53294c[_0xb4ea('0x45')]=_[_0xb4ea('0x46')](_0x968682[_0xb4ea('0x45')]);_0x53294c[_0xb4ea('0x47')]=_[_0xb4ea('0x48')](_0x53294c[_0xb4ea('0x44')],_0x53294c[_0xb4ea('0x45')]);_0x4bde14[_0xb4ea('0x49')]=_[_0xb4ea('0x48')](_0x53294c[_0xb4ea('0x44')],qs['fields'](_0x968682['query']['fields']));_0x4bde14[_0xb4ea('0x49')]=_0x4bde14['attributes'][_0xb4ea('0x4a')]?_0x4bde14[_0xb4ea('0x49')]:_0x53294c[_0xb4ea('0x44')];if(!_0x968682[_0xb4ea('0x45')][_0xb4ea('0x4b')](_0xb4ea('0x4c'))){_0x4bde14[_0xb4ea('0x33')]=qs['limit'](_0x968682[_0xb4ea('0x45')][_0xb4ea('0x33')]);_0x4bde14[_0xb4ea('0x30')]=qs[_0xb4ea('0x30')](_0x968682[_0xb4ea('0x45')][_0xb4ea('0x30')]);}_0x4bde14[_0xb4ea('0x4d')]=qs['sort'](_0x968682[_0xb4ea('0x45')][_0xb4ea('0x4e')]);_0x4bde14[_0xb4ea('0x4f')]=qs[_0xb4ea('0x47')](_[_0xb4ea('0x50')](_0x968682[_0xb4ea('0x45')],_0x53294c[_0xb4ea('0x47')]),_0x1f389d);if(_0x968682[_0xb4ea('0x45')][_0xb4ea('0x51')]){_0x4bde14[_0xb4ea('0x4f')]=_[_0xb4ea('0x52')](_0x4bde14[_0xb4ea('0x4f')],{'$or':_[_0xb4ea('0x3f')](_0x1f389d,function(_0x1ff4ae){if(_0x1ff4ae[_0xb4ea('0x42')]!==_0xb4ea('0x53')){var _0x562195={};_0x562195[_0x1ff4ae['name']]={'$like':'%'+_0x968682['query'][_0xb4ea('0x51')]+'%'};return _0x562195;}})});}_0x4bde14=_[_0xb4ea('0x52')]({},_0x4bde14,_0x968682[_0xb4ea('0x54')]);var _0x2643a2={'where':_0x4bde14[_0xb4ea('0x4f')]};return db['ChatMessage'][_0xb4ea('0x32')](_0x2643a2)['then'](function(_0x4a0cd9){_0x2b275f[_0xb4ea('0x32')]=_0x4a0cd9;if(_0x968682[_0xb4ea('0x45')][_0xb4ea('0x55')]){_0x4bde14[_0xb4ea('0x56')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4bde14);})[_0xb4ea('0x23')](function(_0x46ef16){_0x2b275f[_0xb4ea('0x57')]=_0x46ef16;return _0x2b275f;})[_0xb4ea('0x23')](respondWithFilteredResult(_0x251ec4,_0x4bde14))[_0xb4ea('0x58')](handleError(_0x251ec4,null));};exports['show']=function(_0x30b652,_0x1e6b40){var _0x1f33e5={'raw':!![],'where':{'id':_0x30b652[_0xb4ea('0x59')]['id']}},_0x1bad2f={};_0x1bad2f[_0xb4ea('0x44')]=_[_0xb4ea('0x46')](db[_0xb4ea('0x40')]['rawAttributes']);_0x1bad2f[_0xb4ea('0x45')]=_[_0xb4ea('0x46')](_0x30b652[_0xb4ea('0x45')]);_0x1bad2f[_0xb4ea('0x47')]=_[_0xb4ea('0x48')](_0x1bad2f['model'],_0x1bad2f[_0xb4ea('0x45')]);_0x1f33e5[_0xb4ea('0x49')]=_[_0xb4ea('0x48')](_0x1bad2f[_0xb4ea('0x44')],qs['fields'](_0x30b652['query']['fields']));_0x1f33e5[_0xb4ea('0x49')]=_0x1f33e5[_0xb4ea('0x49')][_0xb4ea('0x4a')]?_0x1f33e5[_0xb4ea('0x49')]:_0x1bad2f[_0xb4ea('0x44')];if(_0x30b652[_0xb4ea('0x45')]['includeAll']){_0x1f33e5[_0xb4ea('0x56')]=[{'all':!![]}];}_0x1f33e5=_[_0xb4ea('0x52')]({},_0x1f33e5,_0x30b652[_0xb4ea('0x54')]);return db[_0xb4ea('0x40')]['find'](_0x1f33e5)[_0xb4ea('0x23')](handleEntityNotFound(_0x1e6b40,null))[_0xb4ea('0x23')](respondWithResult(_0x1e6b40,null))[_0xb4ea('0x58')](handleError(_0x1e6b40,null));};exports[_0xb4ea('0x5a')]=function(_0x4ce61b,_0x135439){return db[_0xb4ea('0x40')]['create'](_0x4ce61b[_0xb4ea('0x5b')],{})[_0xb4ea('0x23')](respondWithResult(_0x135439,0xc9))[_0xb4ea('0x58')](handleError(_0x135439,null));};exports['update']=function(_0x153f56,_0x2cfdd0){if(_0x153f56[_0xb4ea('0x5b')]['id']){delete _0x153f56[_0xb4ea('0x5b')]['id'];}return db[_0xb4ea('0x40')][_0xb4ea('0x5c')]({'where':{'id':_0x153f56[_0xb4ea('0x59')]['id']}})[_0xb4ea('0x23')](handleEntityNotFound(_0x2cfdd0,null))[_0xb4ea('0x23')](saveUpdates(_0x153f56[_0xb4ea('0x5b')],null))[_0xb4ea('0x23')](respondWithResult(_0x2cfdd0,null))['catch'](handleError(_0x2cfdd0,null));};exports[_0xb4ea('0x3a')]=function(_0x2d4509,_0x3b4556){return db[_0xb4ea('0x40')][_0xb4ea('0x5c')]({'where':{'id':_0x2d4509['params']['id']}})['then'](handleEntityNotFound(_0x3b4556,null))['then'](removeEntity(_0x3b4556,null))[_0xb4ea('0x58')](handleError(_0x3b4556,null));};exports[_0xb4ea('0x5d')]=function(_0x29325e,_0x3535bc){return db[_0xb4ea('0x40')][_0xb4ea('0x5d')]()[_0xb4ea('0x23')](respondWithResult(_0x3535bc,null))[_0xb4ea('0x58')](handleError(_0x3535bc,null));};var interaction_log=require(_0xb4ea('0x16'))(_0xb4ea('0x5e'));exports[_0xb4ea('0x5f')]=function(_0x538a52,_0x42f2c9,_0x4987f9){var _0x33875e={'agent':{},'channel':_0xb4ea('0x60')};if(_0x538a52[_0xb4ea('0x5b')]['id']){delete _0x538a52[_0xb4ea('0x5b')]['id'];}_0x538a52[_0xb4ea('0x5b')][_0xb4ea('0x61')]=!![];_0x538a52[_0xb4ea('0x5b')][_0xb4ea('0x62')]=moment()[_0xb4ea('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x538a52['body'][_0xb4ea('0x64')]=_0x538a52[_0xb4ea('0x5b')][_0xb4ea('0x64')]||_0x538a52[_0xb4ea('0x65')]['id'];_0x33875e[_0xb4ea('0x66')]['id']=_0x538a52[_0xb4ea('0x5b')][_0xb4ea('0x64')];return db[_0xb4ea('0x40')][_0xb4ea('0x5c')]({'where':{'id':_0x538a52[_0xb4ea('0x59')]['id'],'UserId':null}})[_0xb4ea('0x23')](handleEntityNotFound(_0x42f2c9,null))[_0xb4ea('0x23')](saveUpdates(_0x538a52[_0xb4ea('0x5b')],null))['then'](function(_0x3e4edf){if(_0x3e4edf){_0x33875e[_0xb4ea('0x2a')]=_0x3e4edf['get']({'plain':!![]});return db['ChatInteraction'][_0xb4ea('0x5c')]({'where':{'id':_0x3e4edf[_0xb4ea('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x42f2c9,null))[_0xb4ea('0x23')](function(_0x5af4fe){if(_0x5af4fe){return _0x5af4fe[_0xb4ea('0x39')]({'UserId':_0x538a52[_0xb4ea('0x5b')][_0xb4ea('0x64')],'read1stAt':_[_0xb4ea('0x68')](_0x5af4fe[_0xb4ea('0x69')])?moment()[_0xb4ea('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x583eca){if(_0x583eca){_0x33875e[_0xb4ea('0x6a')]=_0x583eca[_0xb4ea('0x6b')]({'plain':!![]});interaction_log[_0xb4ea('0x2b')](_0xb4ea('0x6c'),_0x538a52['user']['id'],_0x538a52['user'][_0xb4ea('0x6d')],_0x538a52['user'][_0xb4ea('0x6e')],_0x33875e[_0xb4ea('0x6a')]['id'],_0x538a52[_0xb4ea('0x5b')]?JSON[_0xb4ea('0x6f')](_0x538a52[_0xb4ea('0x5b')]):_0xb4ea('0x70'));return respondWithRpcPromise(_0xb4ea('0x71'),_0xb4ea('0x72'),_0x33875e);}return null;})[_0xb4ea('0x23')](function(_0x33cf8b){var _0x494fd5=_0xb4ea('0x73')+_0x33cf8b['message'][_0xb4ea('0x74')];return db['sequelize'][_0xb4ea('0x45')](_0x494fd5,{'type':db['Sequelize'][_0xb4ea('0x75')]['SELECT'],'raw':!![]})[_0xb4ea('0x23')](function(_0x530452){return _0x530452;});})[_0xb4ea('0x23')](function(_0x5c57b7){if(_0x5c57b7){_0x33875e[_0xb4ea('0x2a')]['contact']=_0x5c57b7[0x0];if(!_0x538a52[_0xb4ea('0x5b')]['UserId'])return;return db[_0xb4ea('0x76')][_0xb4ea('0x5c')]({'where':{'id':_0x538a52[_0xb4ea('0x5b')][_0xb4ea('0x64')],'role':_0xb4ea('0x66')},'attributes':['id',_0xb4ea('0x6d'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xb4ea('0x23')](function(_0x5a55d3){if(!_0x5a55d3)return null;_0x33875e['message'][_0xb4ea('0x66')]=_0x5a55d3;return _0x33875e;})[_0xb4ea('0x23')](function(_0x5e991e){if(_0x5e991e){if(_0x538a52[_0xb4ea('0x5b')][_0xb4ea('0x77')]){_0x33875e[_0xb4ea('0x2a')]['interface']=util[_0xb4ea('0x63')](_0xb4ea('0x78'),_0x538a52[_0xb4ea('0x65')][_0xb4ea('0x6d')]);_0x33875e[_0xb4ea('0x2a')]['channel']=_0x33875e['channel'];_0x33875e[_0xb4ea('0x2a')][_0xb4ea('0x79')]=_0x33875e[_0xb4ea('0x7a')];_0x33875e[_0xb4ea('0x2a')][_0xb4ea('0x7b')]=_0xb4ea('0x5f');return respondWithRpcPromise(_0xb4ea('0x7c'),'EventManager',{'event':'acceptmessage','message':_[_0xb4ea('0x52')](_0x33875e['message'],JSON[_0xb4ea('0x7d')](_0x33875e[_0xb4ea('0x6a')][_0xb4ea('0x7e')]))},client9002)['then'](function(){return _0x33875e;});}return _0x33875e;}return null;})[_0xb4ea('0x23')](respondWithResult(_0x42f2c9,null))['catch'](handleError(_0x42f2c9,null));};var interaction_log=require(_0xb4ea('0x16'))('chat-interactions');exports[_0xb4ea('0x37')]=function(_0x28c730,_0x3c8f11,_0x5d4d6e){var _0x1be648={'agent':{},'channel':'chat'};if(_0x28c730[_0xb4ea('0x5b')]['id']){delete _0x28c730[_0xb4ea('0x5b')]['id'];}_0x28c730[_0xb4ea('0x5b')][_0xb4ea('0x64')]=_0x28c730['body'][_0xb4ea('0x64')]||_0x28c730[_0xb4ea('0x65')]['id'];_0x1be648['agent']['id']=_0x28c730[_0xb4ea('0x5b')]['UserId'];return db[_0xb4ea('0x40')][_0xb4ea('0x5c')]({'where':{'id':_0x28c730[_0xb4ea('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c8f11,null))[_0xb4ea('0x23')](function(_0x36e680){if(_0x36e680){_0x1be648[_0xb4ea('0x2a')]=_0x36e680[_0xb4ea('0x6b')]({'plain':!![]});return db[_0xb4ea('0x7f')][_0xb4ea('0x5c')]({'where':{'id':_0x36e680[_0xb4ea('0x67')]}});}return null;})[_0xb4ea('0x23')](handleEntityNotFound(_0x3c8f11,null))['then'](function(_0x28c21c){if(_0x28c21c){_0x1be648[_0xb4ea('0x6a')]=_0x28c21c[_0xb4ea('0x6b')]({'plain':!![]});interaction_log[_0xb4ea('0x2b')](_0xb4ea('0x80'),_0x28c730['user']['id'],_0x28c730['user'][_0xb4ea('0x6d')],_0x28c730[_0xb4ea('0x65')]['role'],_0x1be648['interaction']['id'],_0x28c730['body']?JSON[_0xb4ea('0x6f')](_0x28c730[_0xb4ea('0x5b')]):'null');return respondWithRpcPromise(_0xb4ea('0x81'),_0xb4ea('0x82'),_0x1be648);}return null;})['then'](function(_0x2971da){var _0x2be34b=_0xb4ea('0x73')+_0x2971da['message'][_0xb4ea('0x74')];return db[_0xb4ea('0x83')][_0xb4ea('0x45')](_0x2be34b,{'type':db[_0xb4ea('0x84')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x3bb1a9){return _0x3bb1a9;});})['then'](function(_0x1a526d){if(_0x1a526d){_0x1be648[_0xb4ea('0x2a')][_0xb4ea('0x85')]=_0x1a526d[0x0];if(!_0x28c730[_0xb4ea('0x5b')][_0xb4ea('0x64')])return;return db['User'][_0xb4ea('0x5c')]({'where':{'id':_0x28c730[_0xb4ea('0x5b')][_0xb4ea('0x64')],'role':_0xb4ea('0x66')},'attributes':['id','name','fullname','email',_0xb4ea('0x86')],'raw':!![]});}return null;})[_0xb4ea('0x23')](function(_0x173038){if(!_0x173038)return null;_0x1be648['message'][_0xb4ea('0x66')]=_0x173038;return _0x1be648;})['then'](function(_0xa1c05a){if(_0xa1c05a){_0xa1c05a[_0xb4ea('0x2a')][_0xb4ea('0x87')]=util[_0xb4ea('0x63')]('SIP/%s',_0x28c730[_0xb4ea('0x65')][_0xb4ea('0x6d')]);_0xa1c05a[_0xb4ea('0x2a')]['channel']=_0x1be648[_0xb4ea('0x7a')];_0xa1c05a[_0xb4ea('0x2a')]['motionChannel']=_0x1be648[_0xb4ea('0x7a')];_0xa1c05a['message'][_0xb4ea('0x7b')]=_0xb4ea('0x37');respondWithRpcPromise(_0xb4ea('0x7c'),_0xb4ea('0x7c'),{'event':_0xb4ea('0x88'),'message':_[_0xb4ea('0x52')](_0x1be648[_0xb4ea('0x2a')],JSON['parse'](_0x1be648[_0xb4ea('0x6a')][_0xb4ea('0x7e')]))},client9002);return _0x1be648;}return null;})['then'](respondWithResult(_0x3c8f11,null))[_0xb4ea('0x58')](handleError(_0x3c8f11,null));}; \ No newline at end of file +var _0x3370=['event','EventManager','acceptmessage','parse','interaction','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','reject','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','localhost','redis','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','name','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','merge','options','find','create','body','params','describe','../../config/logger','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','[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','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','motionChannel'];(function(_0x27ce17,_0x6a72){var _0x5a966c=function(_0x4d5bbd){while(--_0x4d5bbd){_0x27ce17['push'](_0x27ce17['shift']());}};_0x5a966c(++_0x6a72);}(_0x3370,0x191));var _0x0337=function(_0x1e9dd4,_0xc065f4){_0x1e9dd4=_0x1e9dd4-0x0;var _0x25dc42=_0x3370[_0x1e9dd4];return _0x25dc42;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0337('0x0'));var jsonpatch=require(_0x0337('0x1'));var rp=require(_0x0337('0x2'));var moment=require(_0x0337('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0337('0x4'));var path=require(_0x0337('0x5'));var sox=require(_0x0337('0x6'));var csv=require(_0x0337('0x7'));var ejs=require(_0x0337('0x8'));var fs=require('fs');var fs_extra=require(_0x0337('0x9'));var _=require(_0x0337('0xa'));var squel=require(_0x0337('0xb'));var crypto=require(_0x0337('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0337('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0337('0xe'));var Redis=require(_0x0337('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0337('0x10'));var logger=require('../../config/logger')(_0x0337('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0337('0x12'));var db=require(_0x0337('0x13'))['db'];config['redis']=_[_0x0337('0x14')](config['redis'],{'host':_0x0337('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0337('0x16')]));require(_0x0337('0x17'))[_0x0337('0x18')](socket);var jayson=require(_0x0337('0x19'));var client=jayson[_0x0337('0x1a')][_0x0337('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1211fc,_0xe7cb5b,_0x10ea66,_0x5ad0af){return new BPromise(function(_0x31e5c3,_0x34207e){var _0x1630ed=_0x5ad0af||client;return _0x1630ed[_0x0337('0x1c')](_0x1211fc,_0x10ea66)[_0x0337('0x1d')](function(_0x18e275){logger[_0x0337('0x1e')](_0x0337('0x1f'),_0xe7cb5b,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0xe7cb5b,_0x0337('0x20'),JSON[_0x0337('0x21')](_0x18e275));if(_0x18e275[_0x0337('0x22')]){if(_0x18e275[_0x0337('0x22')][_0x0337('0x23')]===0x1f4){logger['error'](_0x0337('0x1f'),_0xe7cb5b,_0x18e275[_0x0337('0x22')][_0x0337('0x24')]);return _0x34207e(_0x18e275[_0x0337('0x22')][_0x0337('0x24')]);}logger['error'](_0x0337('0x1f'),_0xe7cb5b,_0x18e275['error'][_0x0337('0x24')]);return _0x31e5c3(_0x18e275['error'][_0x0337('0x24')]);}else{logger['info'](_0x0337('0x1f'),_0xe7cb5b,'request\x20sent');_0x31e5c3(_0x18e275[_0x0337('0x25')][_0x0337('0x24')]);}})[_0x0337('0x26')](function(_0x5ec35c){logger[_0x0337('0x22')](_0x0337('0x1f'),_0xe7cb5b,_0x5ec35c);_0x34207e(_0x5ec35c);});});}function respondWithStatusCode(_0x360762,_0xac9d88){_0xac9d88=_0xac9d88||0xcc;return function(_0x2c7dd5){if(_0x2c7dd5){return _0x360762[_0x0337('0x27')](_0xac9d88);}return _0x360762[_0x0337('0x28')](_0xac9d88)[_0x0337('0x29')]();};}function respondWithResult(_0x1d00f0,_0x267389){_0x267389=_0x267389||0xc8;return function(_0x5d965e){if(_0x5d965e){return _0x1d00f0[_0x0337('0x28')](_0x267389)[_0x0337('0x2a')](_0x5d965e);}};}function respondWithFilteredResult(_0x343e6f,_0x4a5055){return function(_0x57da08){if(_0x57da08){var _0x35bf8c=typeof _0x4a5055['offset']===_0x0337('0x2b')&&typeof _0x4a5055['limit']==='undefined';var _0x5cf15c=_0x57da08[_0x0337('0x2c')];var _0x838211=_0x35bf8c?0x0:_0x4a5055[_0x0337('0x2d')];var _0x1fa3df=_0x35bf8c?_0x57da08[_0x0337('0x2c')]:_0x4a5055[_0x0337('0x2d')]+_0x4a5055[_0x0337('0x2e')];var _0x390055;if(_0x1fa3df>=_0x5cf15c){_0x1fa3df=_0x5cf15c;_0x390055=0xc8;}else{_0x390055=0xce;}_0x343e6f[_0x0337('0x28')](_0x390055);return _0x343e6f['set'](_0x0337('0x2f'),_0x838211+'-'+_0x1fa3df+'/'+_0x5cf15c)[_0x0337('0x2a')](_0x57da08);}return null;};}function patchUpdates(_0x25adf4){return function(_0x4932f9){try{jsonpatch[_0x0337('0x30')](_0x4932f9,_0x25adf4,!![]);}catch(_0x1d5794){return BPromise['reject'](_0x1d5794);}return _0x4932f9[_0x0337('0x31')]();};}function saveUpdates(_0x4997a5,_0x221b46){return function(_0x2411d1){if(_0x2411d1){return _0x2411d1[_0x0337('0x32')](_0x4997a5)[_0x0337('0x1d')](function(_0x47fca9){return _0x47fca9;});}return null;};}function removeEntity(_0x582548,_0x5d79b4){return function(_0x25cc02){if(_0x25cc02){return _0x25cc02['destroy']()['then'](function(){_0x582548[_0x0337('0x28')](0xcc)[_0x0337('0x29')]();});}};}function handleEntityNotFound(_0x12a9ad,_0x17e962){return function(_0x2cca14){if(!_0x2cca14){_0x12a9ad[_0x0337('0x27')](0x194);}return _0x2cca14;};}function handleError(_0x370513,_0x3c5d2c){_0x3c5d2c=_0x3c5d2c||0x1f4;return function(_0x351bd1){logger[_0x0337('0x22')](_0x351bd1['stack']);if(_0x351bd1[_0x0337('0x33')]){delete _0x351bd1[_0x0337('0x33')];}_0x370513['status'](_0x3c5d2c)['send'](_0x351bd1);};}exports['index']=function(_0x13c277,_0x2da7e2){var _0x477c35={},_0x25a05e={},_0x91c619={'count':0x0,'rows':[]};var _0x536846=_[_0x0337('0x34')](db[_0x0337('0x35')][_0x0337('0x36')],function(_0x30ccd6){return{'name':_0x30ccd6[_0x0337('0x37')],'type':_0x30ccd6[_0x0337('0x38')][_0x0337('0x39')]};});_0x25a05e['model']=_[_0x0337('0x34')](_0x536846,'name');_0x25a05e[_0x0337('0x3a')]=_[_0x0337('0x3b')](_0x13c277[_0x0337('0x3a')]);_0x25a05e[_0x0337('0x3c')]=_[_0x0337('0x3d')](_0x25a05e[_0x0337('0x3e')],_0x25a05e['query']);_0x477c35['attributes']=_[_0x0337('0x3d')](_0x25a05e[_0x0337('0x3e')],qs[_0x0337('0x3f')](_0x13c277[_0x0337('0x3a')]['fields']));_0x477c35[_0x0337('0x40')]=_0x477c35['attributes'][_0x0337('0x41')]?_0x477c35[_0x0337('0x40')]:_0x25a05e[_0x0337('0x3e')];if(!_0x13c277[_0x0337('0x3a')][_0x0337('0x42')](_0x0337('0x43'))){_0x477c35['limit']=qs[_0x0337('0x2e')](_0x13c277[_0x0337('0x3a')][_0x0337('0x2e')]);_0x477c35[_0x0337('0x2d')]=qs[_0x0337('0x2d')](_0x13c277['query'][_0x0337('0x2d')]);}_0x477c35[_0x0337('0x44')]=qs[_0x0337('0x45')](_0x13c277['query'][_0x0337('0x45')]);_0x477c35[_0x0337('0x46')]=qs[_0x0337('0x3c')](_[_0x0337('0x47')](_0x13c277['query'],_0x25a05e[_0x0337('0x3c')]),_0x536846);if(_0x13c277['query'][_0x0337('0x48')]){_0x477c35['where']=_['merge'](_0x477c35[_0x0337('0x46')],{'$or':_[_0x0337('0x34')](_0x536846,function(_0x2100ed){if(_0x2100ed['type']!==_0x0337('0x49')){var _0x211cc1={};_0x211cc1[_0x2100ed[_0x0337('0x33')]]={'$like':'%'+_0x13c277[_0x0337('0x3a')][_0x0337('0x48')]+'%'};return _0x211cc1;}})});}_0x477c35=_['merge']({},_0x477c35,_0x13c277['options']);var _0x24a431={'where':_0x477c35[_0x0337('0x46')]};return db['ChatMessage']['count'](_0x24a431)[_0x0337('0x1d')](function(_0x5ccb4a){_0x91c619['count']=_0x5ccb4a;if(_0x13c277[_0x0337('0x3a')][_0x0337('0x4a')]){_0x477c35[_0x0337('0x4b')]=[{'all':!![]}];}return db[_0x0337('0x35')][_0x0337('0x4c')](_0x477c35);})[_0x0337('0x1d')](function(_0xbbc101){_0x91c619[_0x0337('0x4d')]=_0xbbc101;return _0x91c619;})[_0x0337('0x1d')](respondWithFilteredResult(_0x2da7e2,_0x477c35))[_0x0337('0x26')](handleError(_0x2da7e2,null));};exports[_0x0337('0x4e')]=function(_0x55a081,_0x59aa81){var _0x5598e1={'raw':!![],'where':{'id':_0x55a081['params']['id']}},_0x19d4d5={};_0x19d4d5[_0x0337('0x3e')]=_[_0x0337('0x3b')](db[_0x0337('0x35')][_0x0337('0x36')]);_0x19d4d5[_0x0337('0x3a')]=_[_0x0337('0x3b')](_0x55a081[_0x0337('0x3a')]);_0x19d4d5['filters']=_[_0x0337('0x3d')](_0x19d4d5['model'],_0x19d4d5['query']);_0x5598e1[_0x0337('0x40')]=_[_0x0337('0x3d')](_0x19d4d5[_0x0337('0x3e')],qs[_0x0337('0x3f')](_0x55a081['query'][_0x0337('0x3f')]));_0x5598e1[_0x0337('0x40')]=_0x5598e1['attributes'][_0x0337('0x41')]?_0x5598e1[_0x0337('0x40')]:_0x19d4d5[_0x0337('0x3e')];if(_0x55a081[_0x0337('0x3a')][_0x0337('0x4a')]){_0x5598e1[_0x0337('0x4b')]=[{'all':!![]}];}_0x5598e1=_[_0x0337('0x4f')]({},_0x5598e1,_0x55a081[_0x0337('0x50')]);return db[_0x0337('0x35')][_0x0337('0x51')](_0x5598e1)[_0x0337('0x1d')](handleEntityNotFound(_0x59aa81,null))[_0x0337('0x1d')](respondWithResult(_0x59aa81,null))[_0x0337('0x26')](handleError(_0x59aa81,null));};exports[_0x0337('0x52')]=function(_0x30fcee,_0x55418a){return db['ChatMessage'][_0x0337('0x52')](_0x30fcee[_0x0337('0x53')],{})[_0x0337('0x1d')](respondWithResult(_0x55418a,0xc9))[_0x0337('0x26')](handleError(_0x55418a,null));};exports[_0x0337('0x32')]=function(_0x5495f8,_0x445575){if(_0x5495f8[_0x0337('0x53')]['id']){delete _0x5495f8[_0x0337('0x53')]['id'];}return db[_0x0337('0x35')][_0x0337('0x51')]({'where':{'id':_0x5495f8[_0x0337('0x54')]['id']}})[_0x0337('0x1d')](handleEntityNotFound(_0x445575,null))[_0x0337('0x1d')](saveUpdates(_0x5495f8[_0x0337('0x53')],null))['then'](respondWithResult(_0x445575,null))[_0x0337('0x26')](handleError(_0x445575,null));};exports['destroy']=function(_0x36f439,_0x50953a){return db[_0x0337('0x35')][_0x0337('0x51')]({'where':{'id':_0x36f439[_0x0337('0x54')]['id']}})['then'](handleEntityNotFound(_0x50953a,null))[_0x0337('0x1d')](removeEntity(_0x50953a,null))['catch'](handleError(_0x50953a,null));};exports[_0x0337('0x55')]=function(_0x5b8092,_0x3ad47e){return db[_0x0337('0x35')][_0x0337('0x55')]()[_0x0337('0x1d')](respondWithResult(_0x3ad47e,null))[_0x0337('0x26')](handleError(_0x3ad47e,null));};var interaction_log=require(_0x0337('0x56'))(_0x0337('0x57'));exports['accept']=function(_0x420a61,_0x133959,_0x55c8c1){var _0x54e2da={'agent':{},'channel':_0x0337('0x58')};if(_0x420a61['body']['id']){delete _0x420a61[_0x0337('0x53')]['id'];}_0x420a61['body'][_0x0337('0x59')]=!![];_0x420a61[_0x0337('0x53')][_0x0337('0x5a')]=moment()[_0x0337('0x5b')](_0x0337('0x5c'));_0x420a61[_0x0337('0x53')][_0x0337('0x5d')]=_0x420a61[_0x0337('0x53')]['UserId']||_0x420a61['user']['id'];_0x54e2da[_0x0337('0x5e')]['id']=_0x420a61[_0x0337('0x53')][_0x0337('0x5d')];return db[_0x0337('0x35')]['find']({'where':{'id':_0x420a61[_0x0337('0x54')]['id'],'UserId':null}})[_0x0337('0x1d')](handleEntityNotFound(_0x133959,null))[_0x0337('0x1d')](saveUpdates(_0x420a61[_0x0337('0x53')],null))[_0x0337('0x1d')](function(_0x826207){if(_0x826207){_0x54e2da[_0x0337('0x24')]=_0x826207[_0x0337('0x5f')]({'plain':!![]});return db['ChatInteraction'][_0x0337('0x51')]({'where':{'id':_0x826207[_0x0337('0x60')]}});}return null;})[_0x0337('0x1d')](handleEntityNotFound(_0x133959,null))[_0x0337('0x1d')](function(_0x1abc4a){if(_0x1abc4a){return _0x1abc4a[_0x0337('0x32')]({'UserId':_0x420a61['body'][_0x0337('0x5d')],'read1stAt':_[_0x0337('0x61')](_0x1abc4a[_0x0337('0x62')])?moment()[_0x0337('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0337('0x1d')](function(_0x5659f3){if(_0x5659f3){_0x54e2da['interaction']=_0x5659f3[_0x0337('0x5f')]({'plain':!![]});interaction_log[_0x0337('0x1e')](_0x0337('0x63'),_0x420a61['user']['id'],_0x420a61[_0x0337('0x64')]['name'],_0x420a61['user'][_0x0337('0x65')],_0x54e2da['interaction']['id'],_0x420a61[_0x0337('0x53')]?JSON[_0x0337('0x21')](_0x420a61['body']):_0x0337('0x66'));return respondWithRpcPromise(_0x0337('0x67'),_0x0337('0x68'),_0x54e2da);}return null;})[_0x0337('0x1d')](function(_0x4a85e9){var _0x2b2984=_0x0337('0x69')+_0x4a85e9[_0x0337('0x24')][_0x0337('0x6a')];return db[_0x0337('0x6b')][_0x0337('0x3a')](_0x2b2984,{'type':db[_0x0337('0x6c')][_0x0337('0x6d')]['SELECT'],'raw':!![]})[_0x0337('0x1d')](function(_0xd5ab0a){return _0xd5ab0a;});})[_0x0337('0x1d')](function(_0x18de33){if(_0x18de33){_0x54e2da[_0x0337('0x24')][_0x0337('0x6e')]=_0x18de33[0x0];if(!_0x420a61[_0x0337('0x53')][_0x0337('0x5d')])return;return db[_0x0337('0x6f')][_0x0337('0x51')]({'where':{'id':_0x420a61[_0x0337('0x53')][_0x0337('0x5d')],'role':_0x0337('0x5e')},'attributes':['id',_0x0337('0x33'),_0x0337('0x70'),_0x0337('0x71'),_0x0337('0x72')],'raw':!![]});}return null;})[_0x0337('0x1d')](function(_0x3ca92f){if(!_0x3ca92f)return null;_0x54e2da['message']['agent']=_0x3ca92f;return _0x54e2da;})[_0x0337('0x1d')](function(_0x37328b){if(_0x37328b){if(_0x420a61[_0x0337('0x53')][_0x0337('0x73')]){_0x54e2da[_0x0337('0x24')][_0x0337('0x74')]=util[_0x0337('0x5b')]('SIP/%s',_0x420a61['user']['name']);_0x54e2da[_0x0337('0x24')][_0x0337('0x75')]=_0x54e2da['channel'];_0x54e2da[_0x0337('0x24')][_0x0337('0x76')]=_0x54e2da[_0x0337('0x75')];_0x54e2da['message'][_0x0337('0x77')]='accept';return respondWithRpcPromise(_0x0337('0x78'),_0x0337('0x78'),{'event':_0x0337('0x79'),'message':_[_0x0337('0x4f')](_0x54e2da[_0x0337('0x24')],JSON[_0x0337('0x7a')](_0x54e2da[_0x0337('0x7b')][_0x0337('0x7c')]))},client9002)[_0x0337('0x1d')](function(){return _0x54e2da;});}return _0x54e2da;}return null;})[_0x0337('0x1d')](respondWithResult(_0x133959,null))['catch'](handleError(_0x133959,null));};var interaction_log=require(_0x0337('0x56'))(_0x0337('0x57'));exports['reject']=function(_0x3e51ab,_0x5f09d7,_0x360453){var _0x2bc220={'agent':{},'channel':_0x0337('0x58')};if(_0x3e51ab[_0x0337('0x53')]['id']){delete _0x3e51ab[_0x0337('0x53')]['id'];}_0x3e51ab[_0x0337('0x53')][_0x0337('0x5d')]=_0x3e51ab[_0x0337('0x53')][_0x0337('0x5d')]||_0x3e51ab[_0x0337('0x64')]['id'];_0x2bc220[_0x0337('0x5e')]['id']=_0x3e51ab[_0x0337('0x53')]['UserId'];return db[_0x0337('0x35')][_0x0337('0x51')]({'where':{'id':_0x3e51ab[_0x0337('0x54')]['id'],'UserId':null}})[_0x0337('0x1d')](handleEntityNotFound(_0x5f09d7,null))[_0x0337('0x1d')](function(_0x5c7aa3){if(_0x5c7aa3){_0x2bc220['message']=_0x5c7aa3['get']({'plain':!![]});return db[_0x0337('0x7d')][_0x0337('0x51')]({'where':{'id':_0x5c7aa3['ChatInteractionId']}});}return null;})[_0x0337('0x1d')](handleEntityNotFound(_0x5f09d7,null))[_0x0337('0x1d')](function(_0x206cb9){if(_0x206cb9){_0x2bc220[_0x0337('0x7b')]=_0x206cb9['get']({'plain':!![]});interaction_log['info'](_0x0337('0x7e'),_0x3e51ab[_0x0337('0x64')]['id'],_0x3e51ab['user'][_0x0337('0x33')],_0x3e51ab['user'][_0x0337('0x65')],_0x2bc220['interaction']['id'],_0x3e51ab['body']?JSON[_0x0337('0x21')](_0x3e51ab['body']):_0x0337('0x66'));return respondWithRpcPromise(_0x0337('0x7f'),_0x0337('0x80'),_0x2bc220);}return null;})['then'](function(_0x3d77c8){var _0xd287b8=_0x0337('0x69')+_0x3d77c8[_0x0337('0x24')]['ContactId'];return db['sequelize']['query'](_0xd287b8,{'type':db[_0x0337('0x6c')][_0x0337('0x6d')]['SELECT'],'raw':!![]})[_0x0337('0x1d')](function(_0x1f72d7){return _0x1f72d7;});})['then'](function(_0x4ae0c8){if(_0x4ae0c8){_0x2bc220[_0x0337('0x24')][_0x0337('0x6e')]=_0x4ae0c8[0x0];if(!_0x3e51ab[_0x0337('0x53')]['UserId'])return;return db[_0x0337('0x6f')][_0x0337('0x51')]({'where':{'id':_0x3e51ab['body'][_0x0337('0x5d')],'role':'agent'},'attributes':['id','name','fullname',_0x0337('0x71'),_0x0337('0x72')],'raw':!![]});}return null;})[_0x0337('0x1d')](function(_0xcda408){if(!_0xcda408)return null;_0x2bc220[_0x0337('0x24')][_0x0337('0x5e')]=_0xcda408;return _0x2bc220;})[_0x0337('0x1d')](function(_0x58dc01){if(_0x58dc01){_0x58dc01[_0x0337('0x24')]['interface']=util[_0x0337('0x5b')]('SIP/%s',_0x3e51ab['user']['name']);_0x58dc01[_0x0337('0x24')]['channel']=_0x2bc220[_0x0337('0x75')];_0x58dc01['message']['motionChannel']=_0x2bc220[_0x0337('0x75')];_0x58dc01[_0x0337('0x24')][_0x0337('0x77')]=_0x0337('0x81');respondWithRpcPromise(_0x0337('0x78'),_0x0337('0x78'),{'event':'rejectmessage','message':_[_0x0337('0x4f')](_0x2bc220[_0x0337('0x24')],JSON[_0x0337('0x7a')](_0x2bc220[_0x0337('0x7b')][_0x0337('0x7c')]))},client9002);return _0x2bc220;}return null;})[_0x0337('0x1d')](respondWithResult(_0x5f09d7,null))[_0x0337('0x26')](handleError(_0x5f09d7,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index e1c7888..3fb8cd0 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 _0x9474=['ChatMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x41615f,_0x11c4fe){var _0x3987c4=function(_0x290c10){while(--_0x290c10){_0x41615f['push'](_0x41615f['shift']());}};_0x3987c4(++_0x11c4fe);}(_0x9474,0x1ca));var _0x4947=function(_0x227c55,_0x49db56){_0x227c55=_0x227c55-0x0;var _0x49e02b=_0x9474[_0x227c55];return _0x49e02b;};'use strict';var EventEmitter=require(_0x4947('0x0'));var ChatMessage=require(_0x4947('0x1'))['db'][_0x4947('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4947('0x3'),'afterUpdate':_0x4947('0x4'),'afterDestroy':_0x4947('0x5')};function emitEvent(_0x80b18){return function(_0x2cc163,_0x50e501,_0x49a461){ChatMessageEvents[_0x4947('0x6')](_0x80b18+':'+_0x2cc163['id'],_0x2cc163);ChatMessageEvents[_0x4947('0x6')](_0x80b18,_0x2cc163);_0x49a461(null);};}for(var e in events){if(events[_0x4947('0x7')](e)){var event=events[e];ChatMessage[_0x4947('0x8')](e,emitEvent(event));}}module[_0x4947('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xcde8=['hook','exports','events','ChatMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x53a83b,_0x31aaee){var _0x5eb250=function(_0xb3edbc){while(--_0xb3edbc){_0x53a83b['push'](_0x53a83b['shift']());}};_0x5eb250(++_0x31aaee);}(_0xcde8,0xa4));var _0x8cde=function(_0x177b5f,_0x1acadf){_0x177b5f=_0x177b5f-0x0;var _0x408777=_0xcde8[_0x177b5f];return _0x408777;};'use strict';var EventEmitter=require(_0x8cde('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x8cde('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8cde('0x2'),'afterUpdate':_0x8cde('0x3'),'afterDestroy':_0x8cde('0x4')};function emitEvent(_0x313b1a){return function(_0x4da4df,_0x34d131,_0x4c7f1d){ChatMessageEvents['emit'](_0x313b1a+':'+_0x4da4df['id'],_0x4da4df);ChatMessageEvents[_0x8cde('0x5')](_0x313b1a,_0x4da4df);_0x4c7f1d(null);};}for(var e in events){if(events[_0x8cde('0x6')](e)){var event=events[e];ChatMessage[_0x8cde('0x7')](e,emitEvent(event));}}module[_0x8cde('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index bb63fbf..1cde51d 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 _0xdbd2=['UserId','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','exports','define','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdbd2,0x90));var _0x2dbd=function(_0x3ed57e,_0x11c7f2){_0x3ed57e=_0x3ed57e-0x0;var _0x292b4f=_0xdbd2[_0x3ed57e];return _0x292b4f;};'use strict';var _=require(_0x2dbd('0x0'));var util=require(_0x2dbd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2dbd('0x2'));var BPromise=require('bluebird');var rp=require(_0x2dbd('0x3'));var fs=require('fs');var path=require(_0x2dbd('0x4'));var rimraf=require(_0x2dbd('0x5'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0x2dbd('0x6')]=function(_0x5e2b89,_0xbbd33f){return _0x5e2b89[_0x2dbd('0x7')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x2dbd('0x8'),'fields':[_0x2dbd('0x9')],'type':_0x2dbd('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x162e5c,_0x3a1f9d,_0x3c500b){var _0x18b500=_0x5e2b89[_0x2dbd('0xb')];var _0x26fea8=_0x162e5c[_0x2dbd('0xc')]({'plain':!![]});if(_0x26fea8[_0x2dbd('0xd')]['toLowerCase']()==='in'||_0x26fea8[_0x2dbd('0xd')][_0x2dbd('0xe')]()===_0x2dbd('0xf')&&!_0x26fea8[_0x2dbd('0x10')]&&!_[_0x2dbd('0x11')](_0x26fea8[_0x2dbd('0x12')])){_0x18b500['ChatInteraction'][_0x2dbd('0x13')]({'where':{'id':_0x26fea8[_0x2dbd('0x14')]}})[_0x2dbd('0x15')](function(_0x405a31){if(_0x405a31){_0x405a31[_0x2dbd('0x16')]({'lastMsgAt':_0x26fea8[_0x2dbd('0x17')],'lastMsgDirection':_0x26fea8[_0x2dbd('0xd')][_0x2dbd('0xe')]()});}})[_0x2dbd('0x18')](function(_0x1012c5){console[_0x2dbd('0x19')](_0x1012c5);});}_0x3c500b();}},'charset':'utf8mb4','collate':_0x2dbd('0x1a')});}; \ No newline at end of file +var _0x953a=['exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf'];(function(_0x5600c6,_0x58e4e3){var _0x231a14=function(_0x30fd54){while(--_0x30fd54){_0x5600c6['push'](_0x5600c6['shift']());}};_0x231a14(++_0x58e4e3);}(_0x953a,0xf6));var _0xa953=function(_0x8ee616,_0x452cc7){_0x8ee616=_0x8ee616-0x0;var _0xe88371=_0x953a[_0x8ee616];return _0xe88371;};'use strict';var _=require('lodash');var util=require(_0xa953('0x0'));var logger=require('../../config/logger')(_0xa953('0x1'));var moment=require('moment');var BPromise=require(_0xa953('0x2'));var rp=require(_0xa953('0x3'));var fs=require('fs');var path=require(_0xa953('0x4'));var rimraf=require(_0xa953('0x5'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0xa953('0x6')]=function(_0x5e171d,_0x1e6592){return _0x5e171d[_0xa953('0x7')](_0xa953('0x8'),attributes,{'tableName':_0xa953('0x9'),'paranoid':![],'indexes':[{'name':_0xa953('0xa'),'fields':['body'],'type':_0xa953('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38891d,_0x2fafe0,_0x1d55d9){var _0xddfbe1=_0x5e171d[_0xa953('0xc')];var _0x2cd9d9=_0x38891d[_0xa953('0xd')]({'plain':!![]});if(_0x2cd9d9[_0xa953('0xe')][_0xa953('0xf')]()==='in'||_0x2cd9d9[_0xa953('0xe')][_0xa953('0xf')]()==='out'&&!_0x2cd9d9['secret']&&!_[_0xa953('0x10')](_0x2cd9d9[_0xa953('0x11')])){_0xddfbe1[_0xa953('0x12')][_0xa953('0x13')]({'where':{'id':_0x2cd9d9[_0xa953('0x14')]}})[_0xa953('0x15')](function(_0x5642a4){if(_0x5642a4){_0x5642a4[_0xa953('0x16')]({'lastMsgAt':_0x2cd9d9[_0xa953('0x17')],'lastMsgDirection':_0x2cd9d9['direction']['toLowerCase']()});}})[_0xa953('0x18')](function(_0x3162a2){console[_0xa953('0x19')](_0x3162a2);});}_0x1d55d9();}},'charset':_0xa953('0x1a'),'collate':_0xa953('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index df6590d..1badf7f 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 _0xd677=['stringify','error','message','result','create','options','CreateChatMessage','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','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'];(function(_0x114964,_0xb8323b){var _0x1006cd=function(_0x59c7d4){while(--_0x59c7d4){_0x114964['push'](_0x114964['shift']());}};_0x1006cd(++_0xb8323b);}(_0xd677,0x88));var _0x7d67=function(_0x578ee9,_0x4f8c8c){_0x578ee9=_0x578ee9-0x0;var _0x2d303f=_0xd677[_0x578ee9];return _0x2d303f;};'use strict';var _=require(_0x7d67('0x0'));var util=require('util');var moment=require(_0x7d67('0x1'));var BPromise=require(_0x7d67('0x2'));var rs=require(_0x7d67('0x3'));var fs=require('fs');var Redis=require(_0x7d67('0x4'));var db=require(_0x7d67('0x5'))['db'];var utils=require(_0x7d67('0x6'));var logger=require('../../config/logger')(_0x7d67('0x7'));var config=require(_0x7d67('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7d67('0x9')][_0x7d67('0xa')]({'port':0x232a});config[_0x7d67('0xb')]=_[_0x7d67('0xc')](config[_0x7d67('0xb')],{'host':_0x7d67('0xd'),'port':0x18eb});var socket=require(_0x7d67('0xe'))(new Redis(config[_0x7d67('0xb')]));require(_0x7d67('0xf'))[_0x7d67('0x10')](socket);function respondWithRpcPromise(_0x4ff632,_0x3e794a,_0xb41b68){return new BPromise(function(_0x3321b9,_0x4643f8){return client[_0x7d67('0x11')](_0x4ff632,_0xb41b68)[_0x7d67('0x12')](function(_0x41f0bb){logger[_0x7d67('0x13')](_0x7d67('0x14'),_0x3e794a,_0x7d67('0x15'));logger[_0x7d67('0x16')](_0x7d67('0x17'),_0x3e794a,_0x7d67('0x15'),JSON[_0x7d67('0x18')](_0x41f0bb));if(_0x41f0bb[_0x7d67('0x19')]){if(_0x41f0bb[_0x7d67('0x19')]['code']===0x1f4){logger[_0x7d67('0x19')](_0x7d67('0x14'),_0x3e794a,_0x41f0bb[_0x7d67('0x19')][_0x7d67('0x1a')]);return _0x4643f8(_0x41f0bb['error'][_0x7d67('0x1a')]);}logger['error'](_0x7d67('0x14'),_0x3e794a,_0x41f0bb[_0x7d67('0x19')][_0x7d67('0x1a')]);return _0x3321b9(_0x41f0bb[_0x7d67('0x19')]['message']);}else{logger[_0x7d67('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3e794a,_0x7d67('0x15'));_0x3321b9(_0x41f0bb[_0x7d67('0x1b')][_0x7d67('0x1a')]);}})['catch'](function(_0x57bb8c){logger[_0x7d67('0x19')](_0x7d67('0x14'),_0x3e794a,_0x57bb8c);_0x4643f8(_0x57bb8c);});});}exports['CreateChatMessage']=function(_0x15f413){var _0x4cb85f=this;return new Promise(function(_0x5d3722,_0x1e8b93){return db['ChatMessage'][_0x7d67('0x1c')](_0x15f413['body'],{'raw':_0x15f413[_0x7d67('0x1d')]?_0x15f413[_0x7d67('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x7d67('0x12')](function(_0x20500d){logger['info'](_0x7d67('0x1e'),_0x15f413);logger[_0x7d67('0x16')](_0x7d67('0x1e'),_0x15f413,JSON['stringify'](_0x20500d));_0x5d3722(_0x20500d);})[_0x7d67('0x1f')](function(_0x1689c0){logger['error'](_0x7d67('0x1e'),_0x1689c0[_0x7d67('0x1a')],_0x15f413);_0x1e8b93(_0x4cb85f[_0x7d67('0x19')](0x1f4,_0x1689c0[_0x7d67('0x1a')]));});});}; \ No newline at end of file +var _0x5843=['result','catch','CreateChatMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2da443,_0xc79d40){var _0x377feb=function(_0x44174b){while(--_0x44174b){_0x2da443['push'](_0x2da443['shift']());}};_0x377feb(++_0xc79d40);}(_0x5843,0x107));var _0x3584=function(_0x305be3,_0x2baf51){_0x305be3=_0x305be3-0x0;var _0x547993=_0x5843[_0x305be3];return _0x547993;};'use strict';var _=require('lodash');var util=require(_0x3584('0x0'));var moment=require(_0x3584('0x1'));var BPromise=require(_0x3584('0x2'));var rs=require(_0x3584('0x3'));var fs=require('fs');var Redis=require(_0x3584('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3584('0x5'));var logger=require(_0x3584('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3584('0x7'));var client=jayson[_0x3584('0x8')][_0x3584('0x9')]({'port':0x232a});config[_0x3584('0xa')]=_[_0x3584('0xb')](config[_0x3584('0xa')],{'host':_0x3584('0xc'),'port':0x18eb});var socket=require(_0x3584('0xd'))(new Redis(config[_0x3584('0xa')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x56cf4c,_0x75ffdb,_0x224b5d){return new BPromise(function(_0x1c545d,_0x4e5175){return client[_0x3584('0xe')](_0x56cf4c,_0x224b5d)[_0x3584('0xf')](function(_0x5d7f4e){logger[_0x3584('0x10')](_0x3584('0x11'),_0x75ffdb,_0x3584('0x12'));logger[_0x3584('0x13')](_0x3584('0x14'),_0x75ffdb,_0x3584('0x12'),JSON[_0x3584('0x15')](_0x5d7f4e));if(_0x5d7f4e[_0x3584('0x16')]){if(_0x5d7f4e[_0x3584('0x16')][_0x3584('0x17')]===0x1f4){logger[_0x3584('0x16')]('ChatMessage,\x20%s,\x20%s',_0x75ffdb,_0x5d7f4e[_0x3584('0x16')]['message']);return _0x4e5175(_0x5d7f4e[_0x3584('0x16')][_0x3584('0x18')]);}logger[_0x3584('0x16')](_0x3584('0x11'),_0x75ffdb,_0x5d7f4e['error'][_0x3584('0x18')]);return _0x1c545d(_0x5d7f4e[_0x3584('0x16')][_0x3584('0x18')]);}else{logger[_0x3584('0x10')](_0x3584('0x11'),_0x75ffdb,_0x3584('0x12'));_0x1c545d(_0x5d7f4e[_0x3584('0x19')][_0x3584('0x18')]);}})[_0x3584('0x1a')](function(_0x136af2){logger['error'](_0x3584('0x11'),_0x75ffdb,_0x136af2);_0x4e5175(_0x136af2);});});}exports[_0x3584('0x1b')]=function(_0x1d5dab){var _0x53c661=this;return new Promise(function(_0x5e518f,_0x1bc6e2){return db['ChatMessage'][_0x3584('0x1c')](_0x1d5dab[_0x3584('0x1d')],{'raw':_0x1d5dab[_0x3584('0x1e')]?_0x1d5dab[_0x3584('0x1e')][_0x3584('0x1f')]===undefined?!![]:![]:!![]})[_0x3584('0xf')](function(_0x25eff5){logger[_0x3584('0x10')](_0x3584('0x1b'),_0x1d5dab);logger[_0x3584('0x13')](_0x3584('0x1b'),_0x1d5dab,JSON[_0x3584('0x15')](_0x25eff5));_0x5e518f(_0x25eff5);})['catch'](function(_0x40f1d1){logger[_0x3584('0x16')](_0x3584('0x1b'),_0x40f1d1[_0x3584('0x18')],_0x1d5dab);_0x1bc6e2(_0x53c661[_0x3584('0x16')](0x1f4,_0x40f1d1[_0x3584('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 52a07a3..2e01de5 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 _0xeb5d=['register','length','chatMessage:','save','remove','update','emit','removeListener'];(function(_0x4b52eb,_0x52ba52){var _0x4722c9=function(_0x27214c){while(--_0x27214c){_0x4b52eb['push'](_0x4b52eb['shift']());}};_0x4722c9(++_0x52ba52);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xeb5d[_0x57b54c];return _0x59cc19;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xdeb5('0x0'),_0xdeb5('0x1'),_0xdeb5('0x2')];function createListener(_0x2b0a09,_0x55bbde){return function(_0x5acd11){_0x55bbde[_0xdeb5('0x3')](_0x2b0a09,_0x5acd11);};}function removeListener(_0x16c31b,_0x546313){return function(){ChatMessageEvents[_0xdeb5('0x4')](_0x16c31b,_0x546313);};}exports[_0xdeb5('0x5')]=function(_0x164ecb){for(var _0x33af72=0x0,_0x120329=events[_0xdeb5('0x6')];_0x33af72<_0x120329;_0x33af72++){var _0x328d6b=events[_0x33af72];var _0x35c086=createListener(_0xdeb5('0x7')+_0x328d6b,_0x164ecb);ChatMessageEvents['on'](_0x328d6b,_0x35c086);}}; \ No newline at end of file +var _0x42b0=['register','length','./chatMessage.events','save','update','removeListener'];(function(_0x3c9463,_0xfba58f){var _0x551147=function(_0x103fb4){while(--_0x103fb4){_0x3c9463['push'](_0x3c9463['shift']());}};_0x551147(++_0xfba58f);}(_0x42b0,0xbc));var _0x042b=function(_0x15bc31,_0x14f70c){_0x15bc31=_0x15bc31-0x0;var _0x1989fe=_0x42b0[_0x15bc31];return _0x1989fe;};'use strict';var ChatMessageEvents=require(_0x042b('0x0'));var events=[_0x042b('0x1'),'remove',_0x042b('0x2')];function createListener(_0x4bf494,_0x1d7aa3){return function(_0x5a7e27){_0x1d7aa3['emit'](_0x4bf494,_0x5a7e27);};}function removeListener(_0x401a0c,_0xd73d53){return function(){ChatMessageEvents[_0x042b('0x3')](_0x401a0c,_0xd73d53);};}exports[_0x042b('0x4')]=function(_0x135bc1){for(var _0x5d194a=0x0,_0x51c41c=events[_0x042b('0x5')];_0x5d194a<_0x51c41c;_0x5d194a++){var _0x1ec28f=events[_0x5d194a];var _0x49ab70=createListener('chatMessage:'+_0x1ec28f,_0x135bc1);ChatMessageEvents['on'](_0x1ec28f,_0x49ab70);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 3d70247..52b2ed8 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 _0x90c6=['/:id/accept','reject','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe','get','/:id','show','post','chat','create','put','update'];(function(_0x216a0b,_0x3c1fc4){var _0x361a85=function(_0x580231){while(--_0x580231){_0x216a0b['push'](_0x216a0b['shift']());}};_0x361a85(++_0x3c1fc4);}(_0x90c6,0xca));var _0x690c=function(_0x252e13,_0x1245f3){_0x252e13=_0x252e13-0x0;var _0x14d0a0=_0x90c6[_0x252e13];return _0x14d0a0;};'use strict';var multer=require(_0x690c('0x0'));var util=require(_0x690c('0x1'));var path=require('path');var timeout=require(_0x690c('0x2'));var express=require(_0x690c('0x3'));var router=express['Router']();var fs_extra=require(_0x690c('0x4'));var auth=require(_0x690c('0x5'));var interaction=require(_0x690c('0x6'));var config=require(_0x690c('0x7'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0x690c('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x690c('0x9')]);router[_0x690c('0xa')](_0x690c('0xb'),auth[_0x690c('0x8')](),controller[_0x690c('0xc')]);router[_0x690c('0xd')]('/',auth[_0x690c('0x8')](),interaction['tracked'](_0x690c('0xe'),'chatmessage:create'),controller[_0x690c('0xf')]);router[_0x690c('0x10')](_0x690c('0xb'),controller[_0x690c('0x11')]);router[_0x690c('0x10')](_0x690c('0x12'),auth['isAuthenticated'](),controller['accept']);router[_0x690c('0x10')]('/:id/reject',auth[_0x690c('0x8')](),controller[_0x690c('0x13')]);router[_0x690c('0x14')](_0x690c('0xb'),auth[_0x690c('0x8')](),controller[_0x690c('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4194=['chat','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x4194,0x70));var _0x4419=function(_0x5dd62f,_0x28976c){_0x5dd62f=_0x5dd62f-0x0;var _0x1febbd=_0x4194[_0x5dd62f];return _0x1febbd;};'use strict';var multer=require(_0x4419('0x0'));var util=require(_0x4419('0x1'));var path=require(_0x4419('0x2'));var timeout=require('connect-timeout');var express=require(_0x4419('0x3'));var router=express[_0x4419('0x4')]();var fs_extra=require(_0x4419('0x5'));var auth=require(_0x4419('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4419('0x7'));var controller=require(_0x4419('0x8'));router[_0x4419('0x9')]('/',auth[_0x4419('0xa')](),controller[_0x4419('0xb')]);router['get'](_0x4419('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x4419('0xa')](),controller['show']);router['post']('/',auth[_0x4419('0xa')](),interaction['tracked'](_0x4419('0xd'),_0x4419('0xe')),controller[_0x4419('0xf')]);router['put']('/:id',controller['update']);router[_0x4419('0x10')](_0x4419('0x11'),auth['isAuthenticated'](),controller[_0x4419('0x12')]);router['put'](_0x4419('0x13'),auth[_0x4419('0xa')](),controller[_0x4419('0x14')]);router[_0x4419('0x15')](_0x4419('0x16'),auth[_0x4419('0xa')](),controller[_0x4419('0x17')]);module[_0x4419('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 7df0f85..9a112af 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['medium','TEXT','exports'];(function(_0x2ad885,_0x35fdd5){var _0x3a2275=function(_0x320430){while(--_0x320430){_0x2ad885['push'](_0x2ad885['shift']());}};_0x3a2275(++_0x35fdd5);}(_0xadb5,0xad));var _0x5adb=function(_0x5bcf24,_0x447b79){_0x5bcf24=_0x5bcf24-0x0;var _0x301f12=_0xadb5[_0x5bcf24];return _0x301f12;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0xc524fd,_0x249fd3){var _0x198f3b=function(_0x1d70c2){while(--_0x1d70c2){_0xc524fd['push'](_0xc524fd['shift']());}};_0x198f3b(++_0x249fd3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index d5d7889..b78a7a7 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(_0x12616a,_0x425ad8){var _0x4db9e3=function(_0x5bae10){while(--_0x5bae10){_0x12616a['push'](_0x12616a['shift']());}};_0x4db9e3(++_0x425ad8);}(_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 +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(_0x39ffa0,_0x12d01b){var _0x1a5ace=function(_0x28f028){while(--_0x28f028){_0x39ffa0['push'](_0x39ffa0['shift']());}};_0x1a5ace(++_0x12d01b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 72ac70e..c123563 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 _0x42d4=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x22614e,_0x27fbde){var _0x15e25c=function(_0x2b6141){while(--_0x2b6141){_0x22614e['push'](_0x22614e['shift']());}};_0x15e25c(++_0x27fbde);}(_0x42d4,0x8f));var _0x442d=function(_0x3e7e74,_0xed4d87){_0x3e7e74=_0x3e7e74-0x0;var _0x251ff0=_0x42d4[_0x3e7e74];return _0x251ff0;};'use strict';var EventEmitter=require(_0x442d('0x0'));var ChatOfflineMessage=require(_0x442d('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x442d('0x2'),'afterUpdate':_0x442d('0x3'),'afterDestroy':_0x442d('0x4')};function emitEvent(_0x4c3154){return function(_0x116d6e,_0x519dc2,_0x5e1a38){ChatOfflineMessageEvents[_0x442d('0x5')](_0x4c3154+':'+_0x116d6e['id'],_0x116d6e);ChatOfflineMessageEvents['emit'](_0x4c3154,_0x116d6e);_0x5e1a38(null);};}for(var e in events){if(events[_0x442d('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x442d('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x5aa0=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','update','remove'];(function(_0x298894,_0x4144b9){var _0x113c61=function(_0x3f5aa8){while(--_0x3f5aa8){_0x298894['push'](_0x298894['shift']());}};_0x113c61(++_0x4144b9);}(_0x5aa0,0x135));var _0x05aa=function(_0x4fcd44,_0x2ff7e2){_0x4fcd44=_0x4fcd44-0x0;var _0xf8fefd=_0x5aa0[_0x4fcd44];return _0xf8fefd;};'use strict';var EventEmitter=require(_0x05aa('0x0'));var ChatOfflineMessage=require(_0x05aa('0x1'))['db'][_0x05aa('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x05aa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x05aa('0x4'),'afterDestroy':_0x05aa('0x5')};function emitEvent(_0xfcdea8){return function(_0x3903c0,_0x579f13,_0x58e8e2){ChatOfflineMessageEvents['emit'](_0xfcdea8+':'+_0x3903c0['id'],_0x3903c0);ChatOfflineMessageEvents[_0x05aa('0x6')](_0xfcdea8,_0x3903c0);_0x58e8e2(null);};}for(var e in events){if(events[_0x05aa('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x05aa('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index b48ad8e..eb82e12 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 _0xe31c=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe31c,0xc7));var _0xce31=function(_0x137428,_0x1d6199){_0x137428=_0x137428-0x0;var _0x9c6e15=_0xe31c[_0x137428];return _0x9c6e15;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xce31('0x0')]=function(_0x3766e9){return _0x3766e9[_0xce31('0x1')](_0xce31('0x2'),attributes,{'tableName':_0xce31('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xce31('0x4')});}; \ No newline at end of file +var _0x4848=['chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage'];(function(_0x3aa556,_0x3f7d88){var _0x36bd20=function(_0x20bb60){while(--_0x20bb60){_0x3aa556['push'](_0x3aa556['shift']());}};_0x36bd20(++_0x3f7d88);}(_0x4848,0xb6));var _0x8484=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x4848[_0x286bfb];return _0x52b683;};'use strict';var attributes=require(_0x8484('0x0'));module['exports']=function(_0x4fd95a){return _0x4fd95a[_0x8484('0x1')](_0x8484('0x2'),attributes,{'tableName':_0x8484('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8484('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f94953d..ee3f8b5 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 _0xb3db=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1b3e45,_0x34c2ea){var _0x9a784c=function(_0x353a86){while(--_0x353a86){_0x1b3e45['push'](_0x1b3e45['shift']());}};_0x9a784c(++_0x34c2ea);}(_0xb3db,0x159));var _0xbb3d=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0xb3db[_0x2d91c6];return _0x3a8d19;};'use strict';var _=require('lodash');var util=require(_0xbb3d('0x0'));var moment=require(_0xbb3d('0x1'));var BPromise=require(_0xbb3d('0x2'));var rs=require(_0xbb3d('0x3'));var fs=require('fs');var Redis=require(_0xbb3d('0x4'));var db=require(_0xbb3d('0x5'))['db'];var utils=require(_0xbb3d('0x6'));var logger=require('../../config/logger')(_0xbb3d('0x7'));var config=require(_0xbb3d('0x8'));var jayson=require(_0xbb3d('0x9'));var client=jayson[_0xbb3d('0xa')][_0xbb3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f4758,_0x23a9ee,_0x42ee65){return new BPromise(function(_0x13e399,_0x1211ce){return client[_0xbb3d('0xc')](_0x3f4758,_0x42ee65)[_0xbb3d('0xd')](function(_0x54221b){logger[_0xbb3d('0xe')](_0xbb3d('0xf'),_0x23a9ee,'request\x20sent');logger['debug'](_0xbb3d('0x10'),_0x23a9ee,'request\x20sent',JSON[_0xbb3d('0x11')](_0x54221b));if(_0x54221b[_0xbb3d('0x12')]){if(_0x54221b['error']['code']===0x1f4){logger[_0xbb3d('0x12')](_0xbb3d('0xf'),_0x23a9ee,_0x54221b[_0xbb3d('0x12')][_0xbb3d('0x13')]);return _0x1211ce(_0x54221b[_0xbb3d('0x12')][_0xbb3d('0x13')]);}logger[_0xbb3d('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x23a9ee,_0x54221b[_0xbb3d('0x12')][_0xbb3d('0x13')]);return _0x13e399(_0x54221b['error']['message']);}else{logger[_0xbb3d('0xe')](_0xbb3d('0xf'),_0x23a9ee,_0xbb3d('0x14'));_0x13e399(_0x54221b[_0xbb3d('0x15')][_0xbb3d('0x13')]);}})['catch'](function(_0x346908){logger[_0xbb3d('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x23a9ee,_0x346908);_0x1211ce(_0x346908);});});} \ No newline at end of file +var _0xb6a8=['http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb6a8,0xc8));var _0x8b6a=function(_0x109d45,_0x30d816){_0x109d45=_0x109d45-0x0;var _0xb762c8=_0xb6a8[_0x109d45];return _0xb762c8;};'use strict';var _=require(_0x8b6a('0x0'));var util=require(_0x8b6a('0x1'));var moment=require(_0x8b6a('0x2'));var BPromise=require(_0x8b6a('0x3'));var rs=require(_0x8b6a('0x4'));var fs=require('fs');var Redis=require(_0x8b6a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8b6a('0x6'));var jayson=require(_0x8b6a('0x7'));var client=jayson[_0x8b6a('0x8')][_0x8b6a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x275feb,_0x27b1f5,_0x2843cf){return new BPromise(function(_0x3fba29,_0x7915b3){return client[_0x8b6a('0xa')](_0x275feb,_0x2843cf)['then'](function(_0x102e1b){logger['info'](_0x8b6a('0xb'),_0x27b1f5,_0x8b6a('0xc'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x27b1f5,_0x8b6a('0xc'),JSON[_0x8b6a('0xd')](_0x102e1b));if(_0x102e1b[_0x8b6a('0xe')]){if(_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0xf')]===0x1f4){logger['error'](_0x8b6a('0xb'),_0x27b1f5,_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0x10')]);return _0x7915b3(_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0x10')]);}logger[_0x8b6a('0xe')](_0x8b6a('0xb'),_0x27b1f5,_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0x10')]);return _0x3fba29(_0x102e1b['error'][_0x8b6a('0x10')]);}else{logger[_0x8b6a('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x27b1f5,_0x8b6a('0xc'));_0x3fba29(_0x102e1b['result'][_0x8b6a('0x10')]);}})[_0x8b6a('0x12')](function(_0x2ed166){logger[_0x8b6a('0xe')](_0x8b6a('0xb'),_0x27b1f5,_0x2ed166);_0x7915b3(_0x2ed166);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bf867a5..ec55683 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 _0x795d=['../../components/interaction/service','../../config/environment','get','describe','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x1d6282,_0x1729e2){var _0x5896ba=function(_0x427429){while(--_0x427429){_0x1d6282['push'](_0x1d6282['shift']());}};_0x5896ba(++_0x1729e2);}(_0x795d,0x109));var _0xd795=function(_0xd3e0b9,_0xd80d4d){_0xd3e0b9=_0xd3e0b9-0x0;var _0x470133=_0x795d[_0xd3e0b9];return _0x470133;};'use strict';var multer=require('multer');var util=require(_0xd795('0x0'));var path=require(_0xd795('0x1'));var timeout=require(_0xd795('0x2'));var express=require(_0xd795('0x3'));var router=express['Router']();var fs_extra=require(_0xd795('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd795('0x5'));var config=require(_0xd795('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd795('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd795('0x8')]);router[_0xd795('0x7')](_0xd795('0x9'),auth[_0xd795('0xa')](),controller[_0xd795('0xb')]);router[_0xd795('0xc')]('/',auth[_0xd795('0xa')](),controller[_0xd795('0xd')]);router['put'](_0xd795('0x9'),auth[_0xd795('0xa')](),controller[_0xd795('0xe')]);router[_0xd795('0xf')](_0xd795('0x9'),auth[_0xd795('0xa')](),controller[_0xd795('0x10')]);module[_0xd795('0x11')]=router; \ No newline at end of file +var _0xbf0b=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x37cd7e,_0xc3e949){var _0xa8bdf3=function(_0x48eee1){while(--_0x48eee1){_0x37cd7e['push'](_0x37cd7e['shift']());}};_0xa8bdf3(++_0xc3e949);}(_0xbf0b,0x1c9));var _0xbbf0=function(_0x32cfff,_0x30f953){_0x32cfff=_0x32cfff-0x0;var _0x56bd8c=_0xbf0b[_0x32cfff];return _0x56bd8c;};'use strict';var multer=require(_0xbbf0('0x0'));var util=require(_0xbbf0('0x1'));var path=require(_0xbbf0('0x2'));var timeout=require(_0xbbf0('0x3'));var express=require(_0xbbf0('0x4'));var router=express[_0xbbf0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbbf0('0x6'));var interaction=require(_0xbbf0('0x7'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0xbbf0('0x8')]('/',auth[_0xbbf0('0x9')](),controller['index']);router['get'](_0xbbf0('0xa'),auth[_0xbbf0('0x9')](),controller[_0xbbf0('0xb')]);router[_0xbbf0('0x8')](_0xbbf0('0xc'),auth[_0xbbf0('0x9')](),controller[_0xbbf0('0xd')]);router[_0xbbf0('0xe')]('/',auth[_0xbbf0('0x9')](),controller['create']);router[_0xbbf0('0xf')](_0xbbf0('0xc'),auth[_0xbbf0('0x9')](),controller[_0xbbf0('0x10')]);router[_0xbbf0('0x11')](_0xbbf0('0xc'),auth['isAuthenticated'](),controller[_0xbbf0('0x12')]);module[_0xbbf0('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index f339037..a0a3550 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 _0x6063=['INTEGER','sequelize','ENUM','mouseOver','timeout'];(function(_0x2cada4,_0x5007f8){var _0x9b6d2e=function(_0x1ade35){while(--_0x1ade35){_0x2cada4['push'](_0x2cada4['shift']());}};_0x9b6d2e(++_0x5007f8);}(_0x6063,0x79));var _0x3606=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6063[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x3606('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3606('0x1')](_0x3606('0x2'),_0x3606('0x3')),'defaultValue':_0x3606('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3606('0x4')]}}; \ No newline at end of file +var _0x480b=['mouseOver','timeout','STRING','INTEGER','sequelize','exports','ENUM'];(function(_0x4a3fc9,_0x363e4c){var _0x39659d=function(_0x14c848){while(--_0x14c848){_0x4a3fc9['push'](_0x4a3fc9['shift']());}};_0x39659d(++_0x363e4c);}(_0x480b,0x138));var _0xb480=function(_0xe88963,_0xa223ca){_0xe88963=_0xe88963-0x0;var _0x578f04=_0x480b[_0xe88963];return _0x578f04;};'use strict';var Sequelize=require(_0xb480('0x0'));module[_0xb480('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb480('0x2')](_0xb480('0x3'),_0xb480('0x4')),'defaultValue':_0xb480('0x3')},'selector':{'type':Sequelize[_0xb480('0x5')]},'timeout':{'type':Sequelize[_0xb480('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 5387d79..72b4565 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 _0x24ce=['query','keys','filters','attributes','fields','includeAll','merge','options','ChatProactiveAction','find','create','body','update','catch','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','destroy','then','end','error','stack','name','send','show','params','model','rawAttributes'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x24ce,0x1de));var _0xe24c=function(_0x4a6f37,_0x39f336){_0x4a6f37=_0x4a6f37-0x0;var _0x5daac6=_0x24ce[_0x4a6f37];return _0x5daac6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe24c('0x0'));var zipdir=require(_0xe24c('0x1'));var jsonpatch=require(_0xe24c('0x2'));var rp=require(_0xe24c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe24c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe24c('0x5'));var csv=require(_0xe24c('0x6'));var ejs=require(_0xe24c('0x7'));var fs=require('fs');var fs_extra=require(_0xe24c('0x8'));var _=require(_0xe24c('0x9'));var squel=require('squel');var crypto=require(_0xe24c('0xa'));var jsforce=require(_0xe24c('0xb'));var deskjs=require(_0xe24c('0xc'));var toCsv=require(_0xe24c('0x6'));var querystring=require(_0xe24c('0xd'));var Papa=require(_0xe24c('0xe'));var Redis=require(_0xe24c('0xf'));var authService=require(_0xe24c('0x10'));var qs=require(_0xe24c('0x11'));var as=require(_0xe24c('0x12'));var hardwareService=require(_0xe24c('0x13'));var logger=require(_0xe24c('0x14'))(_0xe24c('0x15'));var utils=require('../../config/utils');var config=require(_0xe24c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe24c('0x17'))['db'];function respondWithStatusCode(_0x59a9b5,_0x1030bb){_0x1030bb=_0x1030bb||0xcc;return function(_0x1492c6){if(_0x1492c6){return _0x59a9b5['sendStatus'](_0x1030bb);}return _0x59a9b5['status'](_0x1030bb)['end']();};}function respondWithResult(_0x3f0955,_0x59b4d1){_0x59b4d1=_0x59b4d1||0xc8;return function(_0x1cb6c0){if(_0x1cb6c0){return _0x3f0955[_0xe24c('0x18')](_0x59b4d1)[_0xe24c('0x19')](_0x1cb6c0);}};}function respondWithFilteredResult(_0x33979b,_0x48a435){return function(_0x21c00d){if(_0x21c00d){var _0x36b1e6=typeof _0x48a435[_0xe24c('0x1a')]===_0xe24c('0x1b')&&typeof _0x48a435[_0xe24c('0x1c')]===_0xe24c('0x1b');var _0xbd9e1d=_0x21c00d[_0xe24c('0x1d')];var _0x384bd2=_0x36b1e6?0x0:_0x48a435[_0xe24c('0x1a')];var _0xed9c0b=_0x36b1e6?_0x21c00d[_0xe24c('0x1d')]:_0x48a435[_0xe24c('0x1a')]+_0x48a435['limit'];var _0x3db589;if(_0xed9c0b>=_0xbd9e1d){_0xed9c0b=_0xbd9e1d;_0x3db589=0xc8;}else{_0x3db589=0xce;}_0x33979b[_0xe24c('0x18')](_0x3db589);return _0x33979b[_0xe24c('0x1e')]('Content-Range',_0x384bd2+'-'+_0xed9c0b+'/'+_0xbd9e1d)[_0xe24c('0x19')](_0x21c00d);}return null;};}function patchUpdates(_0x258d10){return function(_0x2462f2){try{jsonpatch[_0xe24c('0x1f')](_0x2462f2,_0x258d10,!![]);}catch(_0x3e9d00){return BPromise[_0xe24c('0x20')](_0x3e9d00);}return _0x2462f2['save']();};}function saveUpdates(_0x4def0b,_0x5a2315){return function(_0x354430){if(_0x354430){return _0x354430['update'](_0x4def0b)['then'](function(_0x7e7bda){return _0x7e7bda;});}return null;};}function removeEntity(_0x2edb8f,_0x267de3){return function(_0x4525e3){if(_0x4525e3){return _0x4525e3[_0xe24c('0x21')]()[_0xe24c('0x22')](function(){_0x2edb8f[_0xe24c('0x18')](0xcc)[_0xe24c('0x23')]();});}};}function handleEntityNotFound(_0x2b6bcf,_0x291018){return function(_0x25aeb2){if(!_0x25aeb2){_0x2b6bcf['sendStatus'](0x194);}return _0x25aeb2;};}function handleError(_0x431cde,_0x1dcd46){_0x1dcd46=_0x1dcd46||0x1f4;return function(_0x12b536){logger[_0xe24c('0x24')](_0x12b536[_0xe24c('0x25')]);if(_0x12b536[_0xe24c('0x26')]){delete _0x12b536[_0xe24c('0x26')];}_0x431cde[_0xe24c('0x18')](_0x1dcd46)[_0xe24c('0x27')](_0x12b536);};}exports[_0xe24c('0x28')]=function(_0x5c668e,_0x190cc3){var _0x375aab={'raw':!![],'where':{'id':_0x5c668e[_0xe24c('0x29')]['id']}},_0x51d81e={};_0x51d81e[_0xe24c('0x2a')]=_['keys'](db['ChatProactiveAction'][_0xe24c('0x2b')]);_0x51d81e[_0xe24c('0x2c')]=_[_0xe24c('0x2d')](_0x5c668e['query']);_0x51d81e[_0xe24c('0x2e')]=_['intersection'](_0x51d81e['model'],_0x51d81e[_0xe24c('0x2c')]);_0x375aab[_0xe24c('0x2f')]=_['intersection'](_0x51d81e['model'],qs[_0xe24c('0x30')](_0x5c668e[_0xe24c('0x2c')][_0xe24c('0x30')]));_0x375aab[_0xe24c('0x2f')]=_0x375aab['attributes']['length']?_0x375aab['attributes']:_0x51d81e[_0xe24c('0x2a')];if(_0x5c668e[_0xe24c('0x2c')][_0xe24c('0x31')]){_0x375aab['include']=[{'all':!![]}];}_0x375aab=_[_0xe24c('0x32')]({},_0x375aab,_0x5c668e[_0xe24c('0x33')]);return db[_0xe24c('0x34')][_0xe24c('0x35')](_0x375aab)[_0xe24c('0x22')](handleEntityNotFound(_0x190cc3,null))['then'](respondWithResult(_0x190cc3,null))['catch'](handleError(_0x190cc3,null));};exports[_0xe24c('0x36')]=function(_0x77f337,_0x530f2e){return db['ChatProactiveAction'][_0xe24c('0x36')](_0x77f337[_0xe24c('0x37')],{})[_0xe24c('0x22')](respondWithResult(_0x530f2e,0xc9))['catch'](handleError(_0x530f2e,null));};exports[_0xe24c('0x38')]=function(_0x725784,_0x614472){if(_0x725784[_0xe24c('0x37')]['id']){delete _0x725784[_0xe24c('0x37')]['id'];}return db['ChatProactiveAction'][_0xe24c('0x35')]({'where':{'id':_0x725784[_0xe24c('0x29')]['id']}})[_0xe24c('0x22')](handleEntityNotFound(_0x614472,null))['then'](saveUpdates(_0x725784[_0xe24c('0x37')],null))[_0xe24c('0x22')](respondWithResult(_0x614472,null))['catch'](handleError(_0x614472,null));};exports[_0xe24c('0x21')]=function(_0x327a24,_0x1338b9){return db[_0xe24c('0x34')][_0xe24c('0x35')]({'where':{'id':_0x327a24[_0xe24c('0x29')]['id']}})[_0xe24c('0x22')](handleEntityNotFound(_0x1338b9,null))[_0xe24c('0x22')](removeEntity(_0x1338b9,null))[_0xe24c('0x39')](handleError(_0x1338b9,null));}; \ No newline at end of file +var _0xc18a=['rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','show','params','model','keys','ChatProactiveAction'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0xc18a,0x1cf));var _0xac18=function(_0x264efa,_0x17659c){_0x264efa=_0x264efa-0x0;var _0x911da6=_0xc18a[_0x264efa];return _0x911da6;};'use strict';var emlformat=require(_0xac18('0x0'));var rimraf=require(_0xac18('0x1'));var zipdir=require(_0xac18('0x2'));var jsonpatch=require(_0xac18('0x3'));var rp=require('request-promise');var moment=require(_0xac18('0x4'));var BPromise=require(_0xac18('0x5'));var Mustache=require(_0xac18('0x6'));var util=require(_0xac18('0x7'));var path=require(_0xac18('0x8'));var sox=require(_0xac18('0x9'));var csv=require(_0xac18('0xa'));var ejs=require(_0xac18('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac18('0xc'));var squel=require(_0xac18('0xd'));var crypto=require(_0xac18('0xe'));var jsforce=require(_0xac18('0xf'));var deskjs=require(_0xac18('0x10'));var toCsv=require(_0xac18('0xa'));var querystring=require(_0xac18('0x11'));var Papa=require(_0xac18('0x12'));var Redis=require(_0xac18('0x13'));var authService=require(_0xac18('0x14'));var qs=require(_0xac18('0x15'));var as=require(_0xac18('0x16'));var hardwareService=require(_0xac18('0x17'));var logger=require(_0xac18('0x18'))('api');var utils=require(_0xac18('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xac18('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x567d8d,_0x215482){_0x215482=_0x215482||0xcc;return function(_0x53b975){if(_0x53b975){return _0x567d8d['sendStatus'](_0x215482);}return _0x567d8d[_0xac18('0x1b')](_0x215482)[_0xac18('0x1c')]();};}function respondWithResult(_0x4a7219,_0x1e6150){_0x1e6150=_0x1e6150||0xc8;return function(_0x33eb5a){if(_0x33eb5a){return _0x4a7219['status'](_0x1e6150)[_0xac18('0x1d')](_0x33eb5a);}};}function respondWithFilteredResult(_0x518187,_0x362b31){return function(_0x550438){if(_0x550438){var _0x4a747c=typeof _0x362b31[_0xac18('0x1e')]===_0xac18('0x1f')&&typeof _0x362b31['limit']==='undefined';var _0x436009=_0x550438[_0xac18('0x20')];var _0x506819=_0x4a747c?0x0:_0x362b31[_0xac18('0x1e')];var _0x98b7d3=_0x4a747c?_0x550438[_0xac18('0x20')]:_0x362b31[_0xac18('0x1e')]+_0x362b31[_0xac18('0x21')];var _0x3666d0;if(_0x98b7d3>=_0x436009){_0x98b7d3=_0x436009;_0x3666d0=0xc8;}else{_0x3666d0=0xce;}_0x518187[_0xac18('0x1b')](_0x3666d0);return _0x518187['set'](_0xac18('0x22'),_0x506819+'-'+_0x98b7d3+'/'+_0x436009)[_0xac18('0x1d')](_0x550438);}return null;};}function patchUpdates(_0x3f6498){return function(_0xbcd5fd){try{jsonpatch[_0xac18('0x23')](_0xbcd5fd,_0x3f6498,!![]);}catch(_0x4a55c0){return BPromise[_0xac18('0x24')](_0x4a55c0);}return _0xbcd5fd[_0xac18('0x25')]();};}function saveUpdates(_0x3924a7,_0x147a03){return function(_0x4f2f18){if(_0x4f2f18){return _0x4f2f18[_0xac18('0x26')](_0x3924a7)[_0xac18('0x27')](function(_0x2c10f3){return _0x2c10f3;});}return null;};}function removeEntity(_0x2c5b19,_0x20d639){return function(_0x204a05){if(_0x204a05){return _0x204a05['destroy']()[_0xac18('0x27')](function(){_0x2c5b19[_0xac18('0x1b')](0xcc)[_0xac18('0x1c')]();});}};}function handleEntityNotFound(_0x53fd81,_0x2d2f69){return function(_0x302b23){if(!_0x302b23){_0x53fd81[_0xac18('0x28')](0x194);}return _0x302b23;};}function handleError(_0x39086e,_0x3e3202){_0x3e3202=_0x3e3202||0x1f4;return function(_0x1aae67){logger[_0xac18('0x29')](_0x1aae67[_0xac18('0x2a')]);if(_0x1aae67['name']){delete _0x1aae67[_0xac18('0x2b')];}_0x39086e[_0xac18('0x1b')](_0x3e3202)['send'](_0x1aae67);};}exports[_0xac18('0x2c')]=function(_0x65f692,_0x14d74a){var _0x2d1492={'raw':!![],'where':{'id':_0x65f692[_0xac18('0x2d')]['id']}},_0xb710bb={};_0xb710bb[_0xac18('0x2e')]=_[_0xac18('0x2f')](db[_0xac18('0x30')][_0xac18('0x31')]);_0xb710bb[_0xac18('0x32')]=_['keys'](_0x65f692['query']);_0xb710bb[_0xac18('0x33')]=_[_0xac18('0x34')](_0xb710bb[_0xac18('0x2e')],_0xb710bb['query']);_0x2d1492[_0xac18('0x35')]=_[_0xac18('0x34')](_0xb710bb[_0xac18('0x2e')],qs[_0xac18('0x36')](_0x65f692[_0xac18('0x32')]['fields']));_0x2d1492[_0xac18('0x35')]=_0x2d1492[_0xac18('0x35')]['length']?_0x2d1492[_0xac18('0x35')]:_0xb710bb[_0xac18('0x2e')];if(_0x65f692['query'][_0xac18('0x37')]){_0x2d1492[_0xac18('0x38')]=[{'all':!![]}];}_0x2d1492=_[_0xac18('0x39')]({},_0x2d1492,_0x65f692[_0xac18('0x3a')]);return db[_0xac18('0x30')][_0xac18('0x3b')](_0x2d1492)[_0xac18('0x27')](handleEntityNotFound(_0x14d74a,null))[_0xac18('0x27')](respondWithResult(_0x14d74a,null))[_0xac18('0x3c')](handleError(_0x14d74a,null));};exports['create']=function(_0x38b847,_0x3c318c){return db[_0xac18('0x30')][_0xac18('0x3d')](_0x38b847[_0xac18('0x3e')],{})[_0xac18('0x27')](respondWithResult(_0x3c318c,0xc9))[_0xac18('0x3c')](handleError(_0x3c318c,null));};exports[_0xac18('0x26')]=function(_0x2404de,_0x678f26){if(_0x2404de['body']['id']){delete _0x2404de['body']['id'];}return db[_0xac18('0x30')][_0xac18('0x3b')]({'where':{'id':_0x2404de['params']['id']}})[_0xac18('0x27')](handleEntityNotFound(_0x678f26,null))['then'](saveUpdates(_0x2404de[_0xac18('0x3e')],null))['then'](respondWithResult(_0x678f26,null))[_0xac18('0x3c')](handleError(_0x678f26,null));};exports[_0xac18('0x3f')]=function(_0x5d1721,_0x4ed58d){return db['ChatProactiveAction']['find']({'where':{'id':_0x5d1721['params']['id']}})[_0xac18('0x27')](handleEntityNotFound(_0x4ed58d,null))['then'](removeEntity(_0x4ed58d,null))[_0xac18('0x3c')](handleError(_0x4ed58d,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 01a8db5..9c613da 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 _0x6a17=['path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','util','api','bluebird'];(function(_0x453810,_0x4de33e){var _0x37f3cb=function(_0x297e0a){while(--_0x297e0a){_0x453810['push'](_0x453810['shift']());}};_0x37f3cb(++_0x4de33e);}(_0x6a17,0x15d));var _0x76a1=function(_0x3b506a,_0x5960f5){_0x3b506a=_0x3b506a-0x0;var _0x4e12a2=_0x6a17[_0x3b506a];return _0x4e12a2;};'use strict';var _=require('lodash');var util=require(_0x76a1('0x0'));var logger=require('../../config/logger')(_0x76a1('0x1'));var moment=require('moment');var BPromise=require(_0x76a1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76a1('0x3'));var rimraf=require(_0x76a1('0x4'));var config=require(_0x76a1('0x5'));var attributes=require(_0x76a1('0x6'));module[_0x76a1('0x7')]=function(_0x3c9c0f,_0x2c61e1){return _0x3c9c0f[_0x76a1('0x8')](_0x76a1('0x9'),attributes,{'tableName':_0x76a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6726=['../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4316ba,_0x2d6196){var _0x3113ba=function(_0x30f009){while(--_0x30f009){_0x4316ba['push'](_0x4316ba['shift']());}};_0x3113ba(++_0x2d6196);}(_0x6726,0x1c0));var _0x6672=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x6726[_0x53e3fa];return _0xe8584a;};'use strict';var _=require(_0x6672('0x0'));var util=require(_0x6672('0x1'));var logger=require(_0x6672('0x2'))(_0x6672('0x3'));var moment=require(_0x6672('0x4'));var BPromise=require(_0x6672('0x5'));var rp=require(_0x6672('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6672('0x7'));var config=require(_0x6672('0x8'));var attributes=require(_0x6672('0x9'));module['exports']=function(_0xa23ceb,_0x3b5014){return _0xa23ceb[_0x6672('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x6672('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 3243420..1c3b99c 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 _0x20b3=['ChatProactiveAction,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code'];(function(_0x447955,_0x95e57e){var _0x445e19=function(_0x580775){while(--_0x580775){_0x447955['push'](_0x447955['shift']());}};_0x445e19(++_0x95e57e);}(_0x20b3,0xd6));var _0x320b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x320b('0x0'));var util=require(_0x320b('0x1'));var moment=require('moment');var BPromise=require(_0x320b('0x2'));var rs=require(_0x320b('0x3'));var fs=require('fs');var Redis=require(_0x320b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x320b('0x5'));var logger=require('../../config/logger')(_0x320b('0x6'));var config=require(_0x320b('0x7'));var jayson=require(_0x320b('0x8'));var client=jayson[_0x320b('0x9')][_0x320b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x316b1a,_0x294eef,_0x4e740f){return new BPromise(function(_0x1a536e,_0x37b0c6){return client[_0x320b('0xb')](_0x316b1a,_0x4e740f)['then'](function(_0x45e431){logger[_0x320b('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x294eef,'request\x20sent');logger[_0x320b('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x294eef,'request\x20sent',JSON[_0x320b('0xe')](_0x45e431));if(_0x45e431[_0x320b('0xf')]){if(_0x45e431['error'][_0x320b('0x10')]===0x1f4){logger[_0x320b('0xf')](_0x320b('0x11'),_0x294eef,_0x45e431[_0x320b('0xf')][_0x320b('0x12')]);return _0x37b0c6(_0x45e431[_0x320b('0xf')][_0x320b('0x12')]);}logger[_0x320b('0xf')](_0x320b('0x11'),_0x294eef,_0x45e431[_0x320b('0xf')]['message']);return _0x1a536e(_0x45e431[_0x320b('0xf')][_0x320b('0x12')]);}else{logger[_0x320b('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x294eef,_0x320b('0x13'));_0x1a536e(_0x45e431[_0x320b('0x14')][_0x320b('0x12')]);}})['catch'](function(_0x443a3d){logger[_0x320b('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x294eef,_0x443a3d);_0x37b0c6(_0x443a3d);});});} \ No newline at end of file +var _0xa881=['request\x20sent','stringify','error','code','message','ChatProactiveAction,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x39fc31,_0x373ae0){var _0x4d90f8=function(_0x1e6313){while(--_0x1e6313){_0x39fc31['push'](_0x39fc31['shift']());}};_0x4d90f8(++_0x373ae0);}(_0xa881,0x16f));var _0x1a88=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa881[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1a88('0x0'));var util=require(_0x1a88('0x1'));var moment=require(_0x1a88('0x2'));var BPromise=require(_0x1a88('0x3'));var rs=require(_0x1a88('0x4'));var fs=require('fs');var Redis=require(_0x1a88('0x5'));var db=require(_0x1a88('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a88('0x7'))('rpc');var config=require(_0x1a88('0x8'));var jayson=require(_0x1a88('0x9'));var client=jayson[_0x1a88('0xa')][_0x1a88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x695df7,_0x527db6,_0x47e9f9){return new BPromise(function(_0x4d8af8,_0x2c83bf){return client[_0x1a88('0xc')](_0x695df7,_0x47e9f9)[_0x1a88('0xd')](function(_0x3f4516){logger[_0x1a88('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x527db6,'request\x20sent');logger[_0x1a88('0xf')](_0x1a88('0x10'),_0x527db6,_0x1a88('0x11'),JSON[_0x1a88('0x12')](_0x3f4516));if(_0x3f4516[_0x1a88('0x13')]){if(_0x3f4516[_0x1a88('0x13')][_0x1a88('0x14')]===0x1f4){logger[_0x1a88('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x527db6,_0x3f4516[_0x1a88('0x13')][_0x1a88('0x15')]);return _0x2c83bf(_0x3f4516[_0x1a88('0x13')][_0x1a88('0x15')]);}logger['error'](_0x1a88('0x16'),_0x527db6,_0x3f4516[_0x1a88('0x13')]['message']);return _0x4d8af8(_0x3f4516[_0x1a88('0x13')]['message']);}else{logger[_0x1a88('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x527db6,_0x1a88('0x11'));_0x4d8af8(_0x3f4516[_0x1a88('0x17')]['message']);}})['catch'](function(_0x280525){logger['error'](_0x1a88('0x16'),_0x527db6,_0x280525);_0x2c83bf(_0x280525);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index d44dad6..492934c 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 _0x425d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x425d,0x1e0));var _0xd425=function(_0x3a698f,_0x4a82fc){_0x3a698f=_0x3a698f-0x0;var _0x1b7cf3=_0x425d[_0x3a698f];return _0x1b7cf3;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0xc')]);router[_0xd425('0xd')]('/',auth['isAuthenticated'](),controller[_0xd425('0xe')]);router[_0xd425('0xf')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0x10')]);router[_0xd425('0x11')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0x12')]);module[_0xd425('0x13')]=router; \ No newline at end of file +var _0x5075=['show','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated'];(function(_0x3af04a,_0x36494a){var _0x4d3479=function(_0x259ba9){while(--_0x259ba9){_0x3af04a['push'](_0x3af04a['shift']());}};_0x4d3479(++_0x36494a);}(_0x5075,0x73));var _0x5507=function(_0x19e9a7,_0x57e686){_0x19e9a7=_0x19e9a7-0x0;var _0x3a8442=_0x5075[_0x19e9a7];return _0x3a8442;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/:id',auth[_0x5507('0xa')](),controller[_0x5507('0xb')]);router['post']('/',auth[_0x5507('0xa')](),controller[_0x5507('0xc')]);router[_0x5507('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')](_0x5507('0x10'),auth[_0x5507('0xa')](),controller['destroy']);module[_0x5507('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 c99d5ac..d704440 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 _0xd8a4=['INTEGER','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x3cad88,_0x557b98){var _0x229909=function(_0x2fbadb){while(--_0x2fbadb){_0x3cad88['push'](_0x3cad88['shift']());}};_0x229909(++_0x557b98);}(_0xd8a4,0x1c5));var _0x4d8a=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xd8a4[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0x4d8a('0x0'));module[_0x4d8a('0x1')]={'name':{'type':Sequelize[_0x4d8a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4d8a('0x2')]},'timeout':{'type':Sequelize[_0x4d8a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4d8a('0x4'),'beepall',_0x4d8a('0x5'))}}; \ No newline at end of file +var _0x8de6=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0xfc71a8,_0x464a6f){var _0x15ede8=function(_0x20e4a7){while(--_0x20e4a7){_0xfc71a8['push'](_0xfc71a8['shift']());}};_0x15ede8(++_0x464a6f);}(_0x8de6,0xf6));var _0x68de=function(_0x5e83ec,_0x5abaaf){_0x5e83ec=_0x5e83ec-0x0;var _0x43c08c=_0x8de6[_0x5e83ec];return _0x43c08c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x68de('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x68de('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x68de('0x2')](_0x68de('0x3'),_0x68de('0x4'),_0x68de('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 60a5f2c..0a83405 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 _0x5520=['body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','ChatQueueId','UserChatQueue','User','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','ChatQueues','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','merge','where','VIRTUAL','filter','options','ChatQueue','includeAll','findAll','rows','show','params','keys','include','find','create'];(function(_0x43e19d,_0x4a7442){var _0x435abe=function(_0x2bc566){while(--_0x2bc566){_0x43e19d['push'](_0x43e19d['shift']());}};_0x435abe(++_0x4a7442);}(_0x5520,0xde));var _0x0552=function(_0x4d4b18,_0x3d3871){_0x4d4b18=_0x4d4b18-0x0;var _0x331ea4=_0x5520[_0x4d4b18];return _0x331ea4;};'use strict';var emlformat=require(_0x0552('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0552('0x1'));var jsonpatch=require(_0x0552('0x2'));var rp=require(_0x0552('0x3'));var moment=require('moment');var BPromise=require(_0x0552('0x4'));var Mustache=require(_0x0552('0x5'));var util=require('util');var path=require(_0x0552('0x6'));var sox=require(_0x0552('0x7'));var csv=require('to-csv');var ejs=require(_0x0552('0x8'));var fs=require('fs');var fs_extra=require(_0x0552('0x9'));var _=require(_0x0552('0xa'));var squel=require('squel');var crypto=require(_0x0552('0xb'));var jsforce=require(_0x0552('0xc'));var deskjs=require(_0x0552('0xd'));var toCsv=require(_0x0552('0xe'));var querystring=require(_0x0552('0xf'));var Papa=require(_0x0552('0x10'));var Redis=require(_0x0552('0x11'));var authService=require(_0x0552('0x12'));var qs=require(_0x0552('0x13'));var as=require(_0x0552('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0552('0x15'))(_0x0552('0x16'));var utils=require('../../config/utils');var config=require(_0x0552('0x17'));var licenseUtil=require(_0x0552('0x18'));var db=require(_0x0552('0x19'))['db'];config[_0x0552('0x1a')]=_[_0x0552('0x1b')](config[_0x0552('0x1a')],{'host':_0x0552('0x1c'),'port':0x18eb});var socket=require(_0x0552('0x1d'))(new Redis(config[_0x0552('0x1a')]));require('./chatQueue.socket')[_0x0552('0x1e')](socket);var jayson=require(_0x0552('0x1f'));var client=jayson[_0x0552('0x20')][_0x0552('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x56dd44,_0x13a2b9,_0x163174,_0x287214){return new BPromise(function(_0x25f9a5,_0x2ec0f3){var _0x425934=_0x287214||client;return _0x425934[_0x0552('0x22')](_0x56dd44,_0x163174)['then'](function(_0x1bc3e0){logger['info']('ChatQueue,\x20%s,\x20%s',_0x13a2b9,_0x0552('0x23'));logger[_0x0552('0x24')](_0x0552('0x25'),_0x13a2b9,_0x0552('0x23'),JSON[_0x0552('0x26')](_0x1bc3e0));if(_0x1bc3e0[_0x0552('0x27')]){if(_0x1bc3e0[_0x0552('0x27')][_0x0552('0x28')]===0x1f4){logger[_0x0552('0x27')](_0x0552('0x29'),_0x13a2b9,_0x1bc3e0[_0x0552('0x27')][_0x0552('0x2a')]);return _0x2ec0f3(_0x1bc3e0[_0x0552('0x27')][_0x0552('0x2a')]);}logger[_0x0552('0x27')](_0x0552('0x29'),_0x13a2b9,_0x1bc3e0[_0x0552('0x27')][_0x0552('0x2a')]);return _0x25f9a5(_0x1bc3e0['error'][_0x0552('0x2a')]);}else{logger[_0x0552('0x2b')](_0x0552('0x29'),_0x13a2b9,_0x0552('0x23'));_0x25f9a5(_0x1bc3e0[_0x0552('0x2c')][_0x0552('0x2a')]);}})[_0x0552('0x2d')](function(_0x30a7b6){logger[_0x0552('0x27')](_0x0552('0x29'),_0x13a2b9,_0x30a7b6);_0x2ec0f3(_0x30a7b6);});});}function respondWithStatusCode(_0xbf56e4,_0x51c3ad){_0x51c3ad=_0x51c3ad||0xcc;return function(_0x468e4e){if(_0x468e4e){return _0xbf56e4[_0x0552('0x2e')](_0x51c3ad);}return _0xbf56e4[_0x0552('0x2f')](_0x51c3ad)[_0x0552('0x30')]();};}function respondWithResult(_0x11ba68,_0x2bbf31){_0x2bbf31=_0x2bbf31||0xc8;return function(_0x11a428){if(_0x11a428){return _0x11ba68['status'](_0x2bbf31)[_0x0552('0x31')](_0x11a428);}};}function respondWithFilteredResult(_0x5d11f7,_0x339b68){return function(_0x271085){if(_0x271085){var _0x330207=typeof _0x339b68[_0x0552('0x32')]===_0x0552('0x33')&&typeof _0x339b68['limit']===_0x0552('0x33');var _0x1c7a0a=_0x271085[_0x0552('0x34')];var _0x3e273f=_0x330207?0x0:_0x339b68[_0x0552('0x32')];var _0xacae3b=_0x330207?_0x271085[_0x0552('0x34')]:_0x339b68[_0x0552('0x32')]+_0x339b68['limit'];var _0x522f6e;if(_0xacae3b>=_0x1c7a0a){_0xacae3b=_0x1c7a0a;_0x522f6e=0xc8;}else{_0x522f6e=0xce;}_0x5d11f7[_0x0552('0x2f')](_0x522f6e);return _0x5d11f7['set'](_0x0552('0x35'),_0x3e273f+'-'+_0xacae3b+'/'+_0x1c7a0a)[_0x0552('0x31')](_0x271085);}return null;};}function patchUpdates(_0x5a3545){return function(_0x55c26f){try{jsonpatch[_0x0552('0x36')](_0x55c26f,_0x5a3545,!![]);}catch(_0xbc63b0){return BPromise[_0x0552('0x37')](_0xbc63b0);}return _0x55c26f[_0x0552('0x38')]();};}function saveUpdates(_0x135cb4,_0x33ca44){return function(_0x2ccb15){if(_0x2ccb15){return _0x2ccb15[_0x0552('0x39')](_0x135cb4)[_0x0552('0x3a')](function(_0x22cada){return _0x22cada;});}return null;};}function removeEntity(_0x134582,_0x59fdd3){return function(_0x2ede15){if(_0x2ede15){return _0x2ede15['destroy']()[_0x0552('0x3a')](function(){var _0x468ad1=_0x2ede15['get']({'plain':!![]});var _0x38602c=_0x0552('0x3b');return db['UserProfileResource'][_0x0552('0x3c')]({'where':{'type':_0x38602c,'resourceId':_0x468ad1['id']}})['then'](function(){return _0x2ede15;});})[_0x0552('0x3a')](function(){_0x134582[_0x0552('0x2f')](0xcc)[_0x0552('0x30')]();});}};}function handleEntityNotFound(_0x3de398,_0x167732){return function(_0x509233){if(!_0x509233){_0x3de398[_0x0552('0x2e')](0x194);}return _0x509233;};}function handleError(_0x53a365,_0x324aa7){_0x324aa7=_0x324aa7||0x1f4;return function(_0x4aeb14){logger[_0x0552('0x27')](_0x4aeb14[_0x0552('0x3d')]);if(_0x4aeb14[_0x0552('0x3e')]){delete _0x4aeb14['name'];}_0x53a365[_0x0552('0x2f')](_0x324aa7)[_0x0552('0x3f')](_0x4aeb14);};}exports[_0x0552('0x40')]=function(_0x12f9b4,_0xd1a87d){var _0x24e778={},_0x22e360={},_0x39c758={'count':0x0,'rows':[]};var _0x5e68ec=_[_0x0552('0x41')](db['ChatQueue'][_0x0552('0x42')],function(_0x59a6d7){return{'name':_0x59a6d7[_0x0552('0x43')],'type':_0x59a6d7[_0x0552('0x44')][_0x0552('0x45')]};});_0x22e360[_0x0552('0x46')]=_[_0x0552('0x41')](_0x5e68ec,'name');_0x22e360[_0x0552('0x47')]=_['keys'](_0x12f9b4[_0x0552('0x47')]);_0x22e360[_0x0552('0x48')]=_[_0x0552('0x49')](_0x22e360['model'],_0x22e360[_0x0552('0x47')]);_0x24e778['attributes']=_[_0x0552('0x49')](_0x22e360[_0x0552('0x46')],qs[_0x0552('0x4a')](_0x12f9b4[_0x0552('0x47')][_0x0552('0x4a')]));_0x24e778[_0x0552('0x4b')]=_0x24e778[_0x0552('0x4b')][_0x0552('0x4c')]?_0x24e778[_0x0552('0x4b')]:_0x22e360[_0x0552('0x46')];if(!_0x12f9b4[_0x0552('0x47')][_0x0552('0x4d')](_0x0552('0x4e'))){_0x24e778[_0x0552('0x4f')]=qs[_0x0552('0x4f')](_0x12f9b4[_0x0552('0x47')][_0x0552('0x4f')]);_0x24e778['offset']=qs[_0x0552('0x32')](_0x12f9b4[_0x0552('0x47')][_0x0552('0x32')]);}_0x24e778[_0x0552('0x50')]=qs[_0x0552('0x51')](_0x12f9b4[_0x0552('0x47')]['sort']);_0x24e778['where']=qs[_0x0552('0x48')](_[_0x0552('0x52')](_0x12f9b4[_0x0552('0x47')],_0x22e360[_0x0552('0x48')]),_0x5e68ec);if(_0x12f9b4[_0x0552('0x47')]['filter']){_0x24e778['where']=_[_0x0552('0x53')](_0x24e778[_0x0552('0x54')],{'$or':_['map'](_0x5e68ec,function(_0x121781){if(_0x121781[_0x0552('0x44')]!==_0x0552('0x55')){var _0x58e5d6={};_0x58e5d6[_0x121781[_0x0552('0x3e')]]={'$like':'%'+_0x12f9b4[_0x0552('0x47')][_0x0552('0x56')]+'%'};return _0x58e5d6;}})});}_0x24e778=_[_0x0552('0x53')]({},_0x24e778,_0x12f9b4[_0x0552('0x57')]);var _0xcea619={'where':_0x24e778[_0x0552('0x54')]};return db[_0x0552('0x58')][_0x0552('0x34')](_0xcea619)['then'](function(_0x2d3cdc){_0x39c758['count']=_0x2d3cdc;if(_0x12f9b4[_0x0552('0x47')][_0x0552('0x59')]){_0x24e778['include']=[{'all':!![]}];}return db[_0x0552('0x58')][_0x0552('0x5a')](_0x24e778);})[_0x0552('0x3a')](function(_0x40d1d6){_0x39c758[_0x0552('0x5b')]=_0x40d1d6;return _0x39c758;})['then'](respondWithFilteredResult(_0xd1a87d,_0x24e778))[_0x0552('0x2d')](handleError(_0xd1a87d,null));};exports[_0x0552('0x5c')]=function(_0x39edac,_0x4f17c5){var _0x2ba356={'raw':!![],'where':{'id':_0x39edac[_0x0552('0x5d')]['id']}},_0x4505db={};_0x4505db[_0x0552('0x46')]=_[_0x0552('0x5e')](db[_0x0552('0x58')][_0x0552('0x42')]);_0x4505db[_0x0552('0x47')]=_[_0x0552('0x5e')](_0x39edac[_0x0552('0x47')]);_0x4505db[_0x0552('0x48')]=_[_0x0552('0x49')](_0x4505db[_0x0552('0x46')],_0x4505db['query']);_0x2ba356[_0x0552('0x4b')]=_[_0x0552('0x49')](_0x4505db['model'],qs[_0x0552('0x4a')](_0x39edac[_0x0552('0x47')]['fields']));_0x2ba356[_0x0552('0x4b')]=_0x2ba356[_0x0552('0x4b')][_0x0552('0x4c')]?_0x2ba356[_0x0552('0x4b')]:_0x4505db['model'];if(_0x39edac[_0x0552('0x47')][_0x0552('0x59')]){_0x2ba356[_0x0552('0x5f')]=[{'all':!![]}];}_0x2ba356=_[_0x0552('0x53')]({},_0x2ba356,_0x39edac['options']);return db['ChatQueue'][_0x0552('0x60')](_0x2ba356)['then'](handleEntityNotFound(_0x4f17c5,null))[_0x0552('0x3a')](respondWithResult(_0x4f17c5,null))[_0x0552('0x2d')](handleError(_0x4f17c5,null));};exports[_0x0552('0x61')]=function(_0xb04722,_0x3717d1){return db['ChatQueue'][_0x0552('0x61')](_0xb04722[_0x0552('0x62')],{})[_0x0552('0x3a')](function(_0x5cba42){var _0x40ac46=_0xb04722[_0x0552('0x63')][_0x0552('0x64')]({'plain':!![]});if(!_0x40ac46)throw new Error(_0x0552('0x65'));if(_0x40ac46['role']==='user'){var _0x320340=_0x5cba42[_0x0552('0x64')]({'plain':!![]});var _0x23142b=_0x0552('0x3b');return db[_0x0552('0x66')][_0x0552('0x60')]({'where':{'name':_0x23142b,'userProfileId':_0x40ac46[_0x0552('0x67')]},'raw':!![]})['then'](function(_0x209130){if(_0x209130&&_0x209130['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x320340['name'],'resourceId':_0x320340['id'],'type':_0x209130[_0x0552('0x3e')],'sectionId':_0x209130['id']},{})['then'](function(){return _0x5cba42;});}else{return _0x5cba42;}})[_0x0552('0x2d')](function(_0x547fdf){logger[_0x0552('0x27')](_0x0552('0x68'),_0x547fdf);throw _0x547fdf;});}return _0x5cba42;})['then'](respondWithResult(_0x3717d1,0xc9))[_0x0552('0x2d')](handleError(_0x3717d1,null));};exports['update']=function(_0x486ff1,_0x2c94d9){if(_0x486ff1['body']['id']){delete _0x486ff1['body']['id'];}return db[_0x0552('0x58')][_0x0552('0x60')]({'where':{'id':_0x486ff1[_0x0552('0x5d')]['id']}})[_0x0552('0x3a')](handleEntityNotFound(_0x2c94d9,null))[_0x0552('0x3a')](saveUpdates(_0x486ff1['body'],null))[_0x0552('0x3a')](respondWithResult(_0x2c94d9,null))[_0x0552('0x2d')](handleError(_0x2c94d9,null));};exports[_0x0552('0x3c')]=function(_0x28fd71,_0x10a05c){return db['ChatQueue'][_0x0552('0x60')]({'where':{'id':_0x28fd71[_0x0552('0x5d')]['id']}})['then'](handleEntityNotFound(_0x10a05c,null))[_0x0552('0x3a')](removeEntity(_0x10a05c,null))['catch'](handleError(_0x10a05c,null));};exports[_0x0552('0x69')]=function(_0x4b67d5,_0x24dc7c){return db[_0x0552('0x58')]['describe']()[_0x0552('0x3a')](respondWithResult(_0x24dc7c,null))['catch'](handleError(_0x24dc7c,null));};exports[_0x0552('0x6a')]=function(_0x441be6,_0x4d86b7,_0x53a39f){var _0x2ee057={'raw':!![],'where':{}},_0x1ad5f7={},_0x3da253;return db['ChatQueue']['findOne']({'where':{'id':_0x441be6['params']['id']}})[_0x0552('0x3a')](handleEntityNotFound(_0x4d86b7,null))[_0x0552('0x3a')](function(_0x1e7440){if(_0x1e7440){_0x3da253=_0x1e7440[_0x0552('0x64')]({'plain':!![]});_0x1ad5f7[_0x0552('0x46')]=_[_0x0552('0x5e')](db['UserChatQueue'][_0x0552('0x42')]);_0x1ad5f7[_0x0552('0x47')]=_['keys'](_0x441be6[_0x0552('0x47')]);_0x1ad5f7[_0x0552('0x48')]=_[_0x0552('0x49')](_0x1ad5f7[_0x0552('0x46')],_0x1ad5f7[_0x0552('0x47')]);_0x2ee057['attributes']=_[_0x0552('0x49')](_0x1ad5f7['model'],qs[_0x0552('0x4a')](_0x441be6[_0x0552('0x47')][_0x0552('0x4a')]));_0x2ee057[_0x0552('0x4b')]=_0x2ee057['attributes'][_0x0552('0x4c')]?_0x2ee057[_0x0552('0x4b')]:_0x1ad5f7['model'];if(!_0x441be6[_0x0552('0x47')][_0x0552('0x4d')](_0x0552('0x4e'))){_0x2ee057[_0x0552('0x4f')]=qs['limit'](_0x441be6[_0x0552('0x47')][_0x0552('0x4f')]);_0x2ee057[_0x0552('0x32')]=qs['offset'](_0x441be6[_0x0552('0x47')][_0x0552('0x32')]);}_0x2ee057[_0x0552('0x50')]=qs[_0x0552('0x51')](_0x441be6[_0x0552('0x47')][_0x0552('0x51')]);_0x2ee057[_0x0552('0x54')]=qs['filters'](_[_0x0552('0x52')](_0x441be6[_0x0552('0x47')],_0x1ad5f7[_0x0552('0x48')]));_0x2ee057[_0x0552('0x54')][_0x0552('0x6b')]=_0x1e7440['id'];if(_0x441be6[_0x0552('0x47')][_0x0552('0x56')]){_0x2ee057[_0x0552('0x54')]=_[_0x0552('0x53')](_0x2ee057[_0x0552('0x54')],{'$or':_[_0x0552('0x41')](_0x2ee057['attributes'],function(_0x1fbec5){var _0x590b45={};_0x590b45[_0x1fbec5]={'$like':'%'+_0x441be6[_0x0552('0x47')][_0x0552('0x56')]+'%'};return _0x590b45;})});}_0x2ee057=_['merge']({},_0x2ee057,_0x441be6[_0x0552('0x57')]);return db[_0x0552('0x6c')][_0x0552('0x5a')](_0x2ee057);}})[_0x0552('0x3a')](function(_0x27e359){if(_0x27e359){return db[_0x0552('0x6d')]['findAndCountAll']({'where':{'id':_[_0x0552('0x41')](_0x27e359,_0x0552('0x6e')),'role':_0x0552('0x6f')},'attributes':['id',_0x0552('0x3e'),_0x0552('0x70'),_0x0552('0x71'),_0x0552('0x72')]});}})[_0x0552('0x3a')](function(_0x457e40){if(_0x457e40){return{'count':_0x457e40['count'],'rows':_[_0x0552('0x41')](_0x457e40['rows'],function(_0x83d749){return{'membername':_0x83d749['name'],'UserId':_0x83d749['id'],'queue_name':_0x3da253['name'],'ChatQueueId':_0x3da253['id'],'interface':util[_0x0552('0x73')](_0x0552('0x74'),_0x0552('0x75'),_0x83d749[_0x0552('0x3e')]),'penalty':0x0,'paused':_0x83d749['chatPause'],'createdAt':_0x83d749[_0x0552('0x72')],'updatedAt':_0x83d749[_0x0552('0x71')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d86b7,_0x2ee057))['catch'](handleError(_0x4d86b7,null));};exports[_0x0552('0x76')]=function(_0x696632,_0x147aaf,_0x20e3b7){var _0x43337b={};var _0x2a4b54={};var _0x155409;var _0x335cd5;return db[_0x0552('0x58')][_0x0552('0x77')]({'where':{'id':_0x696632['params']['id']}})[_0x0552('0x3a')](handleEntityNotFound(_0x147aaf,null))[_0x0552('0x3a')](function(_0x415139){if(_0x415139){_0x155409=_0x415139;_0x2a4b54[_0x0552('0x46')]=_[_0x0552('0x5e')](db[_0x0552('0x78')][_0x0552('0x42')]);_0x2a4b54[_0x0552('0x47')]=_['keys'](_0x696632[_0x0552('0x47')]);_0x2a4b54[_0x0552('0x48')]=_['intersection'](_0x2a4b54[_0x0552('0x46')],_0x2a4b54[_0x0552('0x47')]);_0x43337b[_0x0552('0x4b')]=_[_0x0552('0x49')](_0x2a4b54[_0x0552('0x46')],qs[_0x0552('0x4a')](_0x696632[_0x0552('0x47')][_0x0552('0x4a')]));_0x43337b[_0x0552('0x4b')]=_0x43337b['attributes'][_0x0552('0x4c')]?_0x43337b[_0x0552('0x4b')]:_0x2a4b54[_0x0552('0x46')];_0x43337b[_0x0552('0x50')]=qs['sort'](_0x696632[_0x0552('0x47')][_0x0552('0x51')]);_0x43337b['where']=qs[_0x0552('0x48')](_[_0x0552('0x52')](_0x696632[_0x0552('0x47')],_0x2a4b54[_0x0552('0x48')]));if(_0x696632['query'][_0x0552('0x56')]){_0x43337b[_0x0552('0x54')]=_[_0x0552('0x53')](_0x43337b[_0x0552('0x54')],{'$or':_['map'](_0x43337b[_0x0552('0x4b')],function(_0x4a4423){var _0x3bc488={};_0x3bc488[_0x4a4423]={'$like':'%'+_0x696632[_0x0552('0x47')]['filter']+'%'};return _0x3bc488;})});}_0x43337b=_[_0x0552('0x53')]({},_0x43337b,_0x696632[_0x0552('0x57')]);return _0x155409[_0x0552('0x76')](_0x43337b);}})[_0x0552('0x3a')](function(_0x4c4d52){if(_0x4c4d52){_0x335cd5=_0x4c4d52[_0x0552('0x4c')];if(!_0x696632['query']['hasOwnProperty']('nolimit')){_0x43337b[_0x0552('0x4f')]=qs[_0x0552('0x4f')](_0x696632[_0x0552('0x47')]['limit']);_0x43337b['offset']=qs[_0x0552('0x32')](_0x696632[_0x0552('0x47')]['offset']);}return _0x155409[_0x0552('0x76')](_0x43337b);}})[_0x0552('0x3a')](function(_0x440ef7){if(_0x440ef7){return _0x440ef7?{'count':_0x335cd5,'rows':_0x440ef7}:null;}})[_0x0552('0x3a')](respondWithResult(_0x147aaf,null))[_0x0552('0x2d')](handleError(_0x147aaf,null));};exports['addTeams']=function(_0x28c49b,_0x5e1840,_0x57ba3f){var _0x13cd50=_0x28c49b[_0x0552('0x62')][_0x0552('0x79')];return db['Team'][_0x0552('0x5a')]({'where':{'id':_0x13cd50},'attributes':['id'],'include':[{'model':db[_0x0552('0x6d')],'as':_0x0552('0x7a'),'attributes':['id',_0x0552('0x3e'),_0x0552('0x7b'),_0x0552('0x7c'),_0x0552('0x7d')],'raw':!![]}]})[_0x0552('0x3a')](function(_0x1b703c){if(_0x1b703c){var _0x386c24=_[_0x0552('0x7e')](_0x1b703c,function(_0x115a73){var _0x35a493=_0x115a73[_0x0552('0x64')]({'plain':!![]});return _0x35a493['Agents'];});return db[_0x0552('0x58')][_0x0552('0x60')]({'where':{'id':_0x28c49b[_0x0552('0x5d')]['id']}})[_0x0552('0x3a')](function(_0x47c7b6){return db[_0x0552('0x7f')]['transaction'](function(_0x44178f){return _0x47c7b6[_0x0552('0x80')](_0x13cd50,{'transaction':_0x44178f})[_0x0552('0x3a')](function(){return BPromise['each'](_0x386c24,function(_0x3e9457){return db['UserChatQueue'][_0x0552('0x81')]({'where':{'UserId':_0x3e9457['id'],'ChatQueueId':_0x28c49b[_0x0552('0x5d')]['id']},'transaction':_0x44178f});});})[_0x0552('0x3a')](function(){_0x386c24[_0x0552('0x82')](function(_0x1570b5){socket[_0x0552('0x83')](_0x0552('0x84'),{'UserId':_0x1570b5['id'],'ChatQueueId':_0x47c7b6['id']});});});});});}})['then'](respondWithStatusCode(_0x5e1840,null))['catch'](handleError(_0x5e1840,null));};exports[_0x0552('0x85')]=function(_0x30e228,_0x1d23d7,_0x53c489){return db[_0x0552('0x78')]['findAll']({'where':{'id':_0x30e228[_0x0552('0x47')][_0x0552('0x79')]},'attributes':['id'],'include':[{'model':db[_0x0552('0x6d')],'as':_0x0552('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x0552('0x3a')](handleEntityNotFound(_0x1d23d7,null))[_0x0552('0x3a')](function(_0x1f2ff1){var _0x1778a8=_[_0x0552('0x41')](_0x1f2ff1,'id');var _0x23a314=[];var _0x37132c=[];var _0x19dc5a=squel[_0x0552('0x86')]();_0x19dc5a[_0x0552('0x87')](_0x0552('0x88'))[_0x0552('0x89')](_0x0552('0x8a'),'tq')[_0x0552('0x8b')](_0x0552('0x8c'),'ut',_0x0552('0x8d'))[_0x0552('0x54')]('ChatQueueId\x20=\x20?',_0x30e228[_0x0552('0x5d')]['id']);for(var _0x45366f=0x0;_0x45366f<_0x1f2ff1['length'];_0x45366f+=0x1){let _0xd513ef=_0x1f2ff1[_0x45366f];for(var _0x2a16f7=0x0;_0x2a16f7<_0xd513ef[_0x0552('0x7a')][_0x0552('0x4c')];_0x2a16f7+=0x1){let _0x1fc83d=_0xd513ef[_0x0552('0x7a')][_0x2a16f7];var _0x2de273=_0x19dc5a['clone']();_0x2de273[_0x0552('0x54')]('ut.UserId\x20=\x20?',_0x1fc83d['id']);_0x37132c[_0x0552('0x8e')](db[_0x0552('0x7f')]['query'](_0x2de273[_0x0552('0x8f')](),{'type':db[_0x0552('0x7f')]['QueryTypes'][_0x0552('0x90')]})[_0x0552('0x3a')](function(_0x29344f){if(_0x29344f[_0x0552('0x4c')]===0x1){return _0x1fc83d['id'];}else{var _0x55d3e1=_[_0x0552('0x91')](_[_0x0552('0x41')](_0x29344f,_0x0552('0x92')),function(_0x46559c){return _[_0x0552('0x93')](_0x1778a8,_0x46559c);});if(_0x55d3e1){return _0x1fc83d['id'];}}}));}}return BPromise[_0x0552('0x94')](_0x37132c)['then'](function(_0x3b4f3e){_0x23a314=_(_0x23a314)['union'](_0x3b4f3e)[_0x0552('0x95')]()[_0x0552('0x96')]();return db[_0x0552('0x58')][_0x0552('0x60')]({'where':{'id':_0x30e228['params']['id']}})[_0x0552('0x3a')](function(_0x4e717d){return db[_0x0552('0x7f')][_0x0552('0x97')](function(_0x41939d){return _0x4e717d[_0x0552('0x85')](_0x30e228[_0x0552('0x47')][_0x0552('0x79')],{'transaction':_0x41939d})['then'](function(){if(!_[_0x0552('0x98')](_0x23a314)){return _0x4e717d['removeAgents'](_0x23a314,{'transaction':_0x41939d});}})['then'](function(){_0x23a314[_0x0552('0x82')](function(_0x26331a){socket['emit'](_0x0552('0x99'),{'UserId':_0x26331a,'ChatQueueId':_0x4e717d['id']});});});});});});})[_0x0552('0x3a')](respondWithStatusCode(_0x1d23d7,null))[_0x0552('0x2d')](handleError(_0x1d23d7,null));};exports[_0x0552('0x9a')]=function(_0x2653d2,_0x5a0c81,_0xa0828c){return db[_0x0552('0x58')][_0x0552('0x60')]({'where':{'id':_0x2653d2[_0x0552('0x5d')]['id']}})[_0x0552('0x3a')](handleEntityNotFound(_0x5a0c81,null))[_0x0552('0x3a')](function(_0xd84c58){if(_0xd84c58){return _0xd84c58[_0x0552('0x9a')](_0x2653d2['body'][_0x0552('0x79')],_[_0x0552('0x9b')](_0x2653d2[_0x0552('0x62')],[_0x0552('0x79'),'id'])||{})[_0x0552('0x9c')](function(_0x1cfb91){for(var _0x423713=0x0;_0x423713<_0x2653d2['body'][_0x0552('0x79')]['length'];_0x423713+=0x1){socket['emit'](_0x0552('0x84'),{'UserId':Number(_0x2653d2[_0x0552('0x62')][_0x0552('0x79')][_0x423713]),'ChatQueueId':Number(_0x2653d2[_0x0552('0x5d')]['id'])});}return _0x1cfb91;});}})[_0x0552('0x3a')](respondWithResult(_0x5a0c81,null))['catch'](handleError(_0x5a0c81,null));};exports[_0x0552('0x9d')]=function(_0x39c045,_0x111338,_0x532f77){return db['ChatQueue'][_0x0552('0x60')]({'where':{'id':_0x39c045[_0x0552('0x5d')]['id']}})[_0x0552('0x3a')](handleEntityNotFound(_0x111338,null))[_0x0552('0x3a')](function(_0x487020){if(_0x487020){return _0x487020[_0x0552('0x9d')](_0x39c045['query']['ids'])['then'](function(){if(_[_0x0552('0x9e')](_0x39c045['query'][_0x0552('0x79')])){for(var _0x24dde4=0x0;_0x24dde4<_0x39c045['query']['ids'][_0x0552('0x4c')];_0x24dde4+=0x1){socket[_0x0552('0x83')](_0x0552('0x99'),{'UserId':Number(_0x39c045['query']['ids'][_0x24dde4]),'ChatQueueId':Number(_0x39c045[_0x0552('0x5d')]['id'])});}}else{socket[_0x0552('0x83')](_0x0552('0x99'),{'UserId':Number(_0x39c045[_0x0552('0x47')][_0x0552('0x79')]),'ChatQueueId':Number(_0x39c045[_0x0552('0x5d')]['id'])});}});}})[_0x0552('0x3a')](respondWithStatusCode(_0x111338,null))[_0x0552('0x2d')](handleError(_0x111338,null));};exports[_0x0552('0x9f')]=function(_0x23a7aa,_0x2e8b0b,_0x531427){var _0x25d868={};var _0x245aa0={};var _0x2a2f85;var _0x37e1f1;return db[_0x0552('0x58')]['findOne']({'where':{'id':_0x23a7aa[_0x0552('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2e8b0b,null))[_0x0552('0x3a')](function(_0x5a5df0){if(_0x5a5df0){_0x2a2f85=_0x5a5df0;_0x245aa0[_0x0552('0x46')]=_[_0x0552('0x5e')](db[_0x0552('0x6d')][_0x0552('0x42')]);_0x245aa0['query']=_[_0x0552('0x5e')](_0x23a7aa[_0x0552('0x47')]);_0x245aa0[_0x0552('0x48')]=_[_0x0552('0x49')](_0x245aa0[_0x0552('0x46')],_0x245aa0[_0x0552('0x47')]);_0x25d868[_0x0552('0x4b')]=_['intersection'](_0x245aa0[_0x0552('0x46')],qs[_0x0552('0x4a')](_0x23a7aa[_0x0552('0x47')][_0x0552('0x4a')]));_0x25d868['attributes']=_0x25d868['attributes']['length']?_0x25d868['attributes']:_0x245aa0[_0x0552('0x46')];_0x25d868[_0x0552('0x50')]=qs[_0x0552('0x51')](_0x23a7aa[_0x0552('0x47')][_0x0552('0x51')]);_0x25d868[_0x0552('0x54')]=qs[_0x0552('0x48')](_[_0x0552('0x52')](_0x23a7aa[_0x0552('0x47')],_0x245aa0[_0x0552('0x48')]));if(_0x23a7aa[_0x0552('0x47')]['filter']){_0x25d868[_0x0552('0x54')]=_['merge'](_0x25d868['where'],{'$or':_[_0x0552('0x41')](_0x25d868[_0x0552('0x4b')],function(_0x29db88){var _0x4ed6b4={};_0x4ed6b4[_0x29db88]={'$like':'%'+_0x23a7aa['query'][_0x0552('0x56')]+'%'};return _0x4ed6b4;})});}_0x25d868=_[_0x0552('0x53')]({},_0x25d868,_0x23a7aa[_0x0552('0x57')]);return _0x2a2f85[_0x0552('0x9f')](_0x25d868);}})[_0x0552('0x3a')](function(_0x52faa2){if(_0x52faa2){_0x37e1f1=_0x52faa2[_0x0552('0x4c')];if(!_0x23a7aa[_0x0552('0x47')]['hasOwnProperty'](_0x0552('0x4e'))){_0x25d868[_0x0552('0x4f')]=qs[_0x0552('0x4f')](_0x23a7aa[_0x0552('0x47')][_0x0552('0x4f')]);_0x25d868[_0x0552('0x32')]=qs[_0x0552('0x32')](_0x23a7aa[_0x0552('0x47')]['offset']);}return _0x2a2f85[_0x0552('0x9f')](_0x25d868);}})[_0x0552('0x3a')](function(_0x3ef4fd){if(_0x3ef4fd){return _0x3ef4fd?{'count':_0x37e1f1,'rows':_0x3ef4fd}:null;}})[_0x0552('0x3a')](respondWithResult(_0x2e8b0b,null))[_0x0552('0x2d')](handleError(_0x2e8b0b,null));}; \ No newline at end of file +var _0xf2b4=['Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','ChatQueue','findAll','rows','show','params','length','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','ChatQueueId','options','User','findAndCountAll','agent','updatedAt','createdAt','%s/%s','getTeams','findOne','Team','addTeams','ids'];(function(_0x18ea99,_0x5d0dc6){var _0x4e1a63=function(_0x560366){while(--_0x560366){_0x18ea99['push'](_0x18ea99['shift']());}};_0x4e1a63(++_0x5d0dc6);}(_0xf2b4,0xb9));var _0x4f2b=function(_0x2ebb2b,_0x1bc2af){_0x2ebb2b=_0x2ebb2b-0x0;var _0x2d8925=_0xf2b4[_0x2ebb2b];return _0x2d8925;};'use strict';var emlformat=require(_0x4f2b('0x0'));var rimraf=require(_0x4f2b('0x1'));var zipdir=require(_0x4f2b('0x2'));var jsonpatch=require(_0x4f2b('0x3'));var rp=require(_0x4f2b('0x4'));var moment=require(_0x4f2b('0x5'));var BPromise=require(_0x4f2b('0x6'));var Mustache=require(_0x4f2b('0x7'));var util=require('util');var path=require(_0x4f2b('0x8'));var sox=require(_0x4f2b('0x9'));var csv=require(_0x4f2b('0xa'));var ejs=require(_0x4f2b('0xb'));var fs=require('fs');var fs_extra=require(_0x4f2b('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4f2b('0xd'));var toCsv=require(_0x4f2b('0xa'));var querystring=require(_0x4f2b('0xe'));var Papa=require('papaparse');var Redis=require(_0x4f2b('0xf'));var authService=require(_0x4f2b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4f2b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f2b('0x12'))(_0x4f2b('0x13'));var utils=require(_0x4f2b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4f2b('0x15'));var db=require(_0x4f2b('0x16'))['db'];config[_0x4f2b('0x17')]=_['defaults'](config[_0x4f2b('0x17')],{'host':_0x4f2b('0x18'),'port':0x18eb});var socket=require(_0x4f2b('0x19'))(new Redis(config[_0x4f2b('0x17')]));require(_0x4f2b('0x1a'))[_0x4f2b('0x1b')](socket);var jayson=require(_0x4f2b('0x1c'));var client=jayson['client'][_0x4f2b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1a8357,_0x5b3787,_0x353447,_0x46077c){return new BPromise(function(_0x4e8a6e,_0x584cf9){var _0x2e5e14=_0x46077c||client;return _0x2e5e14[_0x4f2b('0x1e')](_0x1a8357,_0x353447)[_0x4f2b('0x1f')](function(_0x26eeac){logger[_0x4f2b('0x20')](_0x4f2b('0x21'),_0x5b3787,_0x4f2b('0x22'));logger[_0x4f2b('0x23')](_0x4f2b('0x24'),_0x5b3787,_0x4f2b('0x22'),JSON[_0x4f2b('0x25')](_0x26eeac));if(_0x26eeac[_0x4f2b('0x26')]){if(_0x26eeac['error'][_0x4f2b('0x27')]===0x1f4){logger[_0x4f2b('0x26')](_0x4f2b('0x21'),_0x5b3787,_0x26eeac[_0x4f2b('0x26')]['message']);return _0x584cf9(_0x26eeac[_0x4f2b('0x26')][_0x4f2b('0x28')]);}logger[_0x4f2b('0x26')](_0x4f2b('0x21'),_0x5b3787,_0x26eeac[_0x4f2b('0x26')][_0x4f2b('0x28')]);return _0x4e8a6e(_0x26eeac[_0x4f2b('0x26')][_0x4f2b('0x28')]);}else{logger[_0x4f2b('0x20')](_0x4f2b('0x21'),_0x5b3787,_0x4f2b('0x22'));_0x4e8a6e(_0x26eeac[_0x4f2b('0x29')][_0x4f2b('0x28')]);}})['catch'](function(_0x304c5b){logger[_0x4f2b('0x26')](_0x4f2b('0x21'),_0x5b3787,_0x304c5b);_0x584cf9(_0x304c5b);});});}function respondWithStatusCode(_0x2ee1f4,_0x507144){_0x507144=_0x507144||0xcc;return function(_0x45777f){if(_0x45777f){return _0x2ee1f4['sendStatus'](_0x507144);}return _0x2ee1f4[_0x4f2b('0x2a')](_0x507144)[_0x4f2b('0x2b')]();};}function respondWithResult(_0x1ae12f,_0x1c750a){_0x1c750a=_0x1c750a||0xc8;return function(_0x109481){if(_0x109481){return _0x1ae12f[_0x4f2b('0x2a')](_0x1c750a)[_0x4f2b('0x2c')](_0x109481);}};}function respondWithFilteredResult(_0x9a0ec,_0x4cc472){return function(_0x219e80){if(_0x219e80){var _0x22a554=typeof _0x4cc472[_0x4f2b('0x2d')]===_0x4f2b('0x2e')&&typeof _0x4cc472[_0x4f2b('0x2f')]==='undefined';var _0x13c8f3=_0x219e80[_0x4f2b('0x30')];var _0x9c1c78=_0x22a554?0x0:_0x4cc472[_0x4f2b('0x2d')];var _0x572ffe=_0x22a554?_0x219e80[_0x4f2b('0x30')]:_0x4cc472[_0x4f2b('0x2d')]+_0x4cc472['limit'];var _0x5dfac9;if(_0x572ffe>=_0x13c8f3){_0x572ffe=_0x13c8f3;_0x5dfac9=0xc8;}else{_0x5dfac9=0xce;}_0x9a0ec[_0x4f2b('0x2a')](_0x5dfac9);return _0x9a0ec[_0x4f2b('0x31')](_0x4f2b('0x32'),_0x9c1c78+'-'+_0x572ffe+'/'+_0x13c8f3)[_0x4f2b('0x2c')](_0x219e80);}return null;};}function patchUpdates(_0x53d510){return function(_0x310caa){try{jsonpatch[_0x4f2b('0x33')](_0x310caa,_0x53d510,!![]);}catch(_0x5977b2){return BPromise[_0x4f2b('0x34')](_0x5977b2);}return _0x310caa[_0x4f2b('0x35')]();};}function saveUpdates(_0xfbe7e,_0x3d9ff6){return function(_0x244afd){if(_0x244afd){return _0x244afd[_0x4f2b('0x36')](_0xfbe7e)['then'](function(_0x243457){return _0x243457;});}return null;};}function removeEntity(_0x3356ef,_0x5e59d4){return function(_0x355fe6){if(_0x355fe6){return _0x355fe6[_0x4f2b('0x37')]()[_0x4f2b('0x1f')](function(){var _0x551f14=_0x355fe6[_0x4f2b('0x38')]({'plain':!![]});var _0x37ba44=_0x4f2b('0x39');return db[_0x4f2b('0x3a')][_0x4f2b('0x37')]({'where':{'type':_0x37ba44,'resourceId':_0x551f14['id']}})['then'](function(){return _0x355fe6;});})[_0x4f2b('0x1f')](function(){_0x3356ef[_0x4f2b('0x2a')](0xcc)[_0x4f2b('0x2b')]();});}};}function handleEntityNotFound(_0xd0676d,_0x70f24d){return function(_0x25f0fa){if(!_0x25f0fa){_0xd0676d[_0x4f2b('0x3b')](0x194);}return _0x25f0fa;};}function handleError(_0x3328a8,_0x4a90f4){_0x4a90f4=_0x4a90f4||0x1f4;return function(_0xfd6c31){logger[_0x4f2b('0x26')](_0xfd6c31[_0x4f2b('0x3c')]);if(_0xfd6c31[_0x4f2b('0x3d')]){delete _0xfd6c31['name'];}_0x3328a8[_0x4f2b('0x2a')](_0x4a90f4)['send'](_0xfd6c31);};}exports[_0x4f2b('0x3e')]=function(_0xea6278,_0x346e60){var _0x3b3c2b={},_0x172a40={},_0x85f6f2={'count':0x0,'rows':[]};var _0xc8d89a=_[_0x4f2b('0x3f')](db['ChatQueue'][_0x4f2b('0x40')],function(_0x39dca6){return{'name':_0x39dca6[_0x4f2b('0x41')],'type':_0x39dca6[_0x4f2b('0x42')]['key']};});_0x172a40['model']=_[_0x4f2b('0x3f')](_0xc8d89a,_0x4f2b('0x3d'));_0x172a40['query']=_[_0x4f2b('0x43')](_0xea6278[_0x4f2b('0x44')]);_0x172a40[_0x4f2b('0x45')]=_[_0x4f2b('0x46')](_0x172a40['model'],_0x172a40[_0x4f2b('0x44')]);_0x3b3c2b['attributes']=_[_0x4f2b('0x46')](_0x172a40[_0x4f2b('0x47')],qs[_0x4f2b('0x48')](_0xea6278[_0x4f2b('0x44')][_0x4f2b('0x48')]));_0x3b3c2b[_0x4f2b('0x49')]=_0x3b3c2b[_0x4f2b('0x49')]['length']?_0x3b3c2b[_0x4f2b('0x49')]:_0x172a40[_0x4f2b('0x47')];if(!_0xea6278[_0x4f2b('0x44')][_0x4f2b('0x4a')](_0x4f2b('0x4b'))){_0x3b3c2b[_0x4f2b('0x2f')]=qs['limit'](_0xea6278['query'][_0x4f2b('0x2f')]);_0x3b3c2b[_0x4f2b('0x2d')]=qs['offset'](_0xea6278[_0x4f2b('0x44')][_0x4f2b('0x2d')]);}_0x3b3c2b[_0x4f2b('0x4c')]=qs['sort'](_0xea6278['query'][_0x4f2b('0x4d')]);_0x3b3c2b[_0x4f2b('0x4e')]=qs[_0x4f2b('0x45')](_[_0x4f2b('0x4f')](_0xea6278[_0x4f2b('0x44')],_0x172a40[_0x4f2b('0x45')]),_0xc8d89a);if(_0xea6278['query'][_0x4f2b('0x50')]){_0x3b3c2b[_0x4f2b('0x4e')]=_[_0x4f2b('0x51')](_0x3b3c2b['where'],{'$or':_[_0x4f2b('0x3f')](_0xc8d89a,function(_0x357fc9){if(_0x357fc9[_0x4f2b('0x42')]!==_0x4f2b('0x52')){var _0x1a97f4={};_0x1a97f4[_0x357fc9[_0x4f2b('0x3d')]]={'$like':'%'+_0xea6278[_0x4f2b('0x44')][_0x4f2b('0x50')]+'%'};return _0x1a97f4;}})});}_0x3b3c2b=_['merge']({},_0x3b3c2b,_0xea6278['options']);var _0x340400={'where':_0x3b3c2b[_0x4f2b('0x4e')]};return db['ChatQueue'][_0x4f2b('0x30')](_0x340400)['then'](function(_0x5cfba6){_0x85f6f2[_0x4f2b('0x30')]=_0x5cfba6;if(_0xea6278[_0x4f2b('0x44')][_0x4f2b('0x53')]){_0x3b3c2b['include']=[{'all':!![]}];}return db[_0x4f2b('0x54')][_0x4f2b('0x55')](_0x3b3c2b);})[_0x4f2b('0x1f')](function(_0x11bbbf){_0x85f6f2[_0x4f2b('0x56')]=_0x11bbbf;return _0x85f6f2;})['then'](respondWithFilteredResult(_0x346e60,_0x3b3c2b))['catch'](handleError(_0x346e60,null));};exports[_0x4f2b('0x57')]=function(_0x417c3d,_0x16a0d2){var _0x47e08d={'raw':!![],'where':{'id':_0x417c3d[_0x4f2b('0x58')]['id']}},_0x413ba6={};_0x413ba6[_0x4f2b('0x47')]=_['keys'](db['ChatQueue'][_0x4f2b('0x40')]);_0x413ba6['query']=_[_0x4f2b('0x43')](_0x417c3d[_0x4f2b('0x44')]);_0x413ba6[_0x4f2b('0x45')]=_[_0x4f2b('0x46')](_0x413ba6[_0x4f2b('0x47')],_0x413ba6[_0x4f2b('0x44')]);_0x47e08d[_0x4f2b('0x49')]=_['intersection'](_0x413ba6[_0x4f2b('0x47')],qs[_0x4f2b('0x48')](_0x417c3d['query'][_0x4f2b('0x48')]));_0x47e08d[_0x4f2b('0x49')]=_0x47e08d['attributes'][_0x4f2b('0x59')]?_0x47e08d[_0x4f2b('0x49')]:_0x413ba6[_0x4f2b('0x47')];if(_0x417c3d[_0x4f2b('0x44')][_0x4f2b('0x53')]){_0x47e08d[_0x4f2b('0x5a')]=[{'all':!![]}];}_0x47e08d=_[_0x4f2b('0x51')]({},_0x47e08d,_0x417c3d['options']);return db[_0x4f2b('0x54')]['find'](_0x47e08d)[_0x4f2b('0x1f')](handleEntityNotFound(_0x16a0d2,null))[_0x4f2b('0x1f')](respondWithResult(_0x16a0d2,null))[_0x4f2b('0x5b')](handleError(_0x16a0d2,null));};exports[_0x4f2b('0x5c')]=function(_0x645732,_0x444059){return db[_0x4f2b('0x54')][_0x4f2b('0x5c')](_0x645732[_0x4f2b('0x5d')],{})['then'](function(_0x428843){var _0x4399d5=_0x645732[_0x4f2b('0x5e')][_0x4f2b('0x38')]({'plain':!![]});if(!_0x4399d5)throw new Error(_0x4f2b('0x5f'));if(_0x4399d5[_0x4f2b('0x60')]===_0x4f2b('0x5e')){var _0x301e81=_0x428843['get']({'plain':!![]});var _0x3d181f='ChatQueues';return db['UserProfileSection'][_0x4f2b('0x61')]({'where':{'name':_0x3d181f,'userProfileId':_0x4399d5[_0x4f2b('0x62')]},'raw':!![]})[_0x4f2b('0x1f')](function(_0xce8776){if(_0xce8776&&_0xce8776[_0x4f2b('0x63')]===0x0){return db[_0x4f2b('0x3a')][_0x4f2b('0x5c')]({'name':_0x301e81['name'],'resourceId':_0x301e81['id'],'type':_0xce8776[_0x4f2b('0x3d')],'sectionId':_0xce8776['id']},{})[_0x4f2b('0x1f')](function(){return _0x428843;});}else{return _0x428843;}})['catch'](function(_0xae1273){logger['error'](_0x4f2b('0x64'),_0xae1273);throw _0xae1273;});}return _0x428843;})[_0x4f2b('0x1f')](respondWithResult(_0x444059,0xc9))[_0x4f2b('0x5b')](handleError(_0x444059,null));};exports['update']=function(_0x197494,_0x2a104e){if(_0x197494[_0x4f2b('0x5d')]['id']){delete _0x197494[_0x4f2b('0x5d')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x197494[_0x4f2b('0x58')]['id']}})['then'](handleEntityNotFound(_0x2a104e,null))[_0x4f2b('0x1f')](saveUpdates(_0x197494[_0x4f2b('0x5d')],null))[_0x4f2b('0x1f')](respondWithResult(_0x2a104e,null))[_0x4f2b('0x5b')](handleError(_0x2a104e,null));};exports[_0x4f2b('0x37')]=function(_0x3dcf12,_0x380604){return db['ChatQueue'][_0x4f2b('0x61')]({'where':{'id':_0x3dcf12['params']['id']}})[_0x4f2b('0x1f')](handleEntityNotFound(_0x380604,null))[_0x4f2b('0x1f')](removeEntity(_0x380604,null))[_0x4f2b('0x5b')](handleError(_0x380604,null));};exports[_0x4f2b('0x65')]=function(_0x430769,_0x1294a3){return db['ChatQueue'][_0x4f2b('0x65')]()['then'](respondWithResult(_0x1294a3,null))[_0x4f2b('0x5b')](handleError(_0x1294a3,null));};exports[_0x4f2b('0x66')]=function(_0x3b3565,_0x1dc1d5,_0x52e8d3){var _0x1b9811={'raw':!![],'where':{}},_0x463083={},_0x4e2b7c;return db[_0x4f2b('0x54')]['findOne']({'where':{'id':_0x3b3565[_0x4f2b('0x58')]['id']}})['then'](handleEntityNotFound(_0x1dc1d5,null))[_0x4f2b('0x1f')](function(_0x4507c6){if(_0x4507c6){_0x4e2b7c=_0x4507c6[_0x4f2b('0x38')]({'plain':!![]});_0x463083[_0x4f2b('0x47')]=_[_0x4f2b('0x43')](db[_0x4f2b('0x67')][_0x4f2b('0x40')]);_0x463083[_0x4f2b('0x44')]=_['keys'](_0x3b3565[_0x4f2b('0x44')]);_0x463083['filters']=_['intersection'](_0x463083['model'],_0x463083['query']);_0x1b9811['attributes']=_[_0x4f2b('0x46')](_0x463083[_0x4f2b('0x47')],qs[_0x4f2b('0x48')](_0x3b3565['query'][_0x4f2b('0x48')]));_0x1b9811[_0x4f2b('0x49')]=_0x1b9811['attributes'][_0x4f2b('0x59')]?_0x1b9811[_0x4f2b('0x49')]:_0x463083[_0x4f2b('0x47')];if(!_0x3b3565[_0x4f2b('0x44')]['hasOwnProperty'](_0x4f2b('0x4b'))){_0x1b9811[_0x4f2b('0x2f')]=qs[_0x4f2b('0x2f')](_0x3b3565[_0x4f2b('0x44')][_0x4f2b('0x2f')]);_0x1b9811[_0x4f2b('0x2d')]=qs[_0x4f2b('0x2d')](_0x3b3565[_0x4f2b('0x44')][_0x4f2b('0x2d')]);}_0x1b9811[_0x4f2b('0x4c')]=qs[_0x4f2b('0x4d')](_0x3b3565['query'][_0x4f2b('0x4d')]);_0x1b9811[_0x4f2b('0x4e')]=qs[_0x4f2b('0x45')](_[_0x4f2b('0x4f')](_0x3b3565[_0x4f2b('0x44')],_0x463083[_0x4f2b('0x45')]));_0x1b9811[_0x4f2b('0x4e')][_0x4f2b('0x68')]=_0x4507c6['id'];if(_0x3b3565[_0x4f2b('0x44')][_0x4f2b('0x50')]){_0x1b9811[_0x4f2b('0x4e')]=_[_0x4f2b('0x51')](_0x1b9811[_0x4f2b('0x4e')],{'$or':_['map'](_0x1b9811['attributes'],function(_0x3a5a13){var _0xf2d348={};_0xf2d348[_0x3a5a13]={'$like':'%'+_0x3b3565[_0x4f2b('0x44')][_0x4f2b('0x50')]+'%'};return _0xf2d348;})});}_0x1b9811=_['merge']({},_0x1b9811,_0x3b3565[_0x4f2b('0x69')]);return db[_0x4f2b('0x67')][_0x4f2b('0x55')](_0x1b9811);}})[_0x4f2b('0x1f')](function(_0x21e5ec){if(_0x21e5ec){return db[_0x4f2b('0x6a')][_0x4f2b('0x6b')]({'where':{'id':_[_0x4f2b('0x3f')](_0x21e5ec,'UserId'),'role':_0x4f2b('0x6c')},'attributes':['id',_0x4f2b('0x3d'),'chatPause',_0x4f2b('0x6d'),_0x4f2b('0x6e')]});}})[_0x4f2b('0x1f')](function(_0x37eb42){if(_0x37eb42){return{'count':_0x37eb42[_0x4f2b('0x30')],'rows':_[_0x4f2b('0x3f')](_0x37eb42[_0x4f2b('0x56')],function(_0x2cba8f){return{'membername':_0x2cba8f['name'],'UserId':_0x2cba8f['id'],'queue_name':_0x4e2b7c[_0x4f2b('0x3d')],'ChatQueueId':_0x4e2b7c['id'],'interface':util['format'](_0x4f2b('0x6f'),'SIP',_0x2cba8f[_0x4f2b('0x3d')]),'penalty':0x0,'paused':_0x2cba8f['chatPause'],'createdAt':_0x2cba8f['createdAt'],'updatedAt':_0x2cba8f[_0x4f2b('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4f2b('0x1f')](respondWithFilteredResult(_0x1dc1d5,_0x1b9811))['catch'](handleError(_0x1dc1d5,null));};exports[_0x4f2b('0x70')]=function(_0x30981d,_0x1f5ef0,_0x5c5e30){var _0x416da5={};var _0x19839e={};var _0x515365;var _0x1a31fe;return db['ChatQueue'][_0x4f2b('0x71')]({'where':{'id':_0x30981d[_0x4f2b('0x58')]['id']}})[_0x4f2b('0x1f')](handleEntityNotFound(_0x1f5ef0,null))['then'](function(_0x5c2659){if(_0x5c2659){_0x515365=_0x5c2659;_0x19839e[_0x4f2b('0x47')]=_[_0x4f2b('0x43')](db[_0x4f2b('0x72')][_0x4f2b('0x40')]);_0x19839e['query']=_['keys'](_0x30981d[_0x4f2b('0x44')]);_0x19839e['filters']=_[_0x4f2b('0x46')](_0x19839e['model'],_0x19839e[_0x4f2b('0x44')]);_0x416da5[_0x4f2b('0x49')]=_[_0x4f2b('0x46')](_0x19839e['model'],qs[_0x4f2b('0x48')](_0x30981d[_0x4f2b('0x44')]['fields']));_0x416da5[_0x4f2b('0x49')]=_0x416da5[_0x4f2b('0x49')][_0x4f2b('0x59')]?_0x416da5[_0x4f2b('0x49')]:_0x19839e['model'];_0x416da5[_0x4f2b('0x4c')]=qs[_0x4f2b('0x4d')](_0x30981d[_0x4f2b('0x44')][_0x4f2b('0x4d')]);_0x416da5[_0x4f2b('0x4e')]=qs[_0x4f2b('0x45')](_[_0x4f2b('0x4f')](_0x30981d[_0x4f2b('0x44')],_0x19839e['filters']));if(_0x30981d[_0x4f2b('0x44')][_0x4f2b('0x50')]){_0x416da5[_0x4f2b('0x4e')]=_[_0x4f2b('0x51')](_0x416da5['where'],{'$or':_['map'](_0x416da5[_0x4f2b('0x49')],function(_0x5179d7){var _0x3bf0b7={};_0x3bf0b7[_0x5179d7]={'$like':'%'+_0x30981d[_0x4f2b('0x44')][_0x4f2b('0x50')]+'%'};return _0x3bf0b7;})});}_0x416da5=_['merge']({},_0x416da5,_0x30981d[_0x4f2b('0x69')]);return _0x515365[_0x4f2b('0x70')](_0x416da5);}})[_0x4f2b('0x1f')](function(_0x269754){if(_0x269754){_0x1a31fe=_0x269754[_0x4f2b('0x59')];if(!_0x30981d['query'][_0x4f2b('0x4a')]('nolimit')){_0x416da5[_0x4f2b('0x2f')]=qs['limit'](_0x30981d[_0x4f2b('0x44')][_0x4f2b('0x2f')]);_0x416da5[_0x4f2b('0x2d')]=qs['offset'](_0x30981d['query'][_0x4f2b('0x2d')]);}return _0x515365[_0x4f2b('0x70')](_0x416da5);}})[_0x4f2b('0x1f')](function(_0x5b8de3){if(_0x5b8de3){return _0x5b8de3?{'count':_0x1a31fe,'rows':_0x5b8de3}:null;}})['then'](respondWithResult(_0x1f5ef0,null))[_0x4f2b('0x5b')](handleError(_0x1f5ef0,null));};exports[_0x4f2b('0x73')]=function(_0x4d6067,_0x2bb02b,_0x561e8f){var _0x221f31=_0x4d6067[_0x4f2b('0x5d')][_0x4f2b('0x74')];return db['Team']['findAll']({'where':{'id':_0x221f31},'attributes':['id'],'include':[{'model':db[_0x4f2b('0x6a')],'as':_0x4f2b('0x75'),'attributes':['id',_0x4f2b('0x3d'),_0x4f2b('0x76'),'voicePause',_0x4f2b('0x77')],'raw':!![]}]})[_0x4f2b('0x1f')](function(_0x6f7798){if(_0x6f7798){var _0x4c664f=_[_0x4f2b('0x78')](_0x6f7798,function(_0x529d35){var _0x3ce7d6=_0x529d35[_0x4f2b('0x38')]({'plain':!![]});return _0x3ce7d6[_0x4f2b('0x75')];});return db[_0x4f2b('0x54')]['find']({'where':{'id':_0x4d6067[_0x4f2b('0x58')]['id']}})[_0x4f2b('0x1f')](function(_0x3b733a){return db[_0x4f2b('0x79')][_0x4f2b('0x7a')](function(_0x2c4f31){return _0x3b733a[_0x4f2b('0x73')](_0x221f31,{'transaction':_0x2c4f31})[_0x4f2b('0x1f')](function(){return BPromise['each'](_0x4c664f,function(_0x194a11){return db[_0x4f2b('0x67')][_0x4f2b('0x7b')]({'where':{'UserId':_0x194a11['id'],'ChatQueueId':_0x4d6067[_0x4f2b('0x58')]['id']},'transaction':_0x2c4f31});});})[_0x4f2b('0x1f')](function(){_0x4c664f[_0x4f2b('0x7c')](function(_0x280c3c){socket[_0x4f2b('0x7d')](_0x4f2b('0x7e'),{'UserId':_0x280c3c['id'],'ChatQueueId':_0x3b733a['id']});});});});});}})[_0x4f2b('0x1f')](respondWithStatusCode(_0x2bb02b,null))[_0x4f2b('0x5b')](handleError(_0x2bb02b,null));};exports[_0x4f2b('0x7f')]=function(_0x3b6709,_0x2fbf34,_0x3d0d2d){return db[_0x4f2b('0x72')]['findAll']({'where':{'id':_0x3b6709[_0x4f2b('0x44')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4f2b('0x6a')],'as':_0x4f2b('0x75'),'attributes':['id'],'raw':!![]}]})[_0x4f2b('0x1f')](handleEntityNotFound(_0x2fbf34,null))[_0x4f2b('0x1f')](function(_0x369a38){var _0x5cc34e=_[_0x4f2b('0x3f')](_0x369a38,'id');var _0x27deb0=[];var _0x55cb31=[];var _0x2b8238=squel['select']();_0x2b8238[_0x4f2b('0x80')](_0x4f2b('0x81'))[_0x4f2b('0x82')](_0x4f2b('0x83'),'tq')[_0x4f2b('0x84')](_0x4f2b('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4f2b('0x4e')](_0x4f2b('0x86'),_0x3b6709['params']['id']);for(var _0x51e149=0x0;_0x51e149<_0x369a38[_0x4f2b('0x59')];_0x51e149+=0x1){let _0x1d9b91=_0x369a38[_0x51e149];for(var _0x2cd501=0x0;_0x2cd501<_0x1d9b91[_0x4f2b('0x75')][_0x4f2b('0x59')];_0x2cd501+=0x1){let _0x2bbf10=_0x1d9b91[_0x4f2b('0x75')][_0x2cd501];var _0x32de16=_0x2b8238[_0x4f2b('0x87')]();_0x32de16[_0x4f2b('0x4e')](_0x4f2b('0x88'),_0x2bbf10['id']);_0x55cb31['push'](db['sequelize']['query'](_0x32de16[_0x4f2b('0x89')](),{'type':db['sequelize'][_0x4f2b('0x8a')][_0x4f2b('0x8b')]})[_0x4f2b('0x1f')](function(_0x26acac){if(_0x26acac[_0x4f2b('0x59')]===0x1){return _0x2bbf10['id'];}else{var _0x4f6bf6=_[_0x4f2b('0x8c')](_['map'](_0x26acac,'TeamId'),function(_0x5050ab){return _[_0x4f2b('0x8d')](_0x5cc34e,_0x5050ab);});if(_0x4f6bf6){return _0x2bbf10['id'];}}}));}}return BPromise[_0x4f2b('0x8e')](_0x55cb31)[_0x4f2b('0x1f')](function(_0x4478f){_0x27deb0=_(_0x27deb0)['union'](_0x4478f)[_0x4f2b('0x8f')]()['value']();return db[_0x4f2b('0x54')][_0x4f2b('0x61')]({'where':{'id':_0x3b6709[_0x4f2b('0x58')]['id']}})[_0x4f2b('0x1f')](function(_0x345c7c){return db['sequelize'][_0x4f2b('0x7a')](function(_0x363317){return _0x345c7c[_0x4f2b('0x7f')](_0x3b6709[_0x4f2b('0x44')]['ids'],{'transaction':_0x363317})[_0x4f2b('0x1f')](function(){if(!_[_0x4f2b('0x90')](_0x27deb0)){return _0x345c7c[_0x4f2b('0x91')](_0x27deb0,{'transaction':_0x363317});}})[_0x4f2b('0x1f')](function(){_0x27deb0[_0x4f2b('0x7c')](function(_0x43129d){socket[_0x4f2b('0x7d')]('userChatQueue:remove',{'UserId':_0x43129d,'ChatQueueId':_0x345c7c['id']});});});});});});})[_0x4f2b('0x1f')](respondWithStatusCode(_0x2fbf34,null))[_0x4f2b('0x5b')](handleError(_0x2fbf34,null));};exports[_0x4f2b('0x92')]=function(_0x308285,_0x5db6ec,_0x5d7b27){return db['ChatQueue'][_0x4f2b('0x61')]({'where':{'id':_0x308285[_0x4f2b('0x58')]['id']}})[_0x4f2b('0x1f')](handleEntityNotFound(_0x5db6ec,null))[_0x4f2b('0x1f')](function(_0x35a26a){if(_0x35a26a){return _0x35a26a['addAgents'](_0x308285['body'][_0x4f2b('0x74')],_[_0x4f2b('0x93')](_0x308285['body'],[_0x4f2b('0x74'),'id'])||{})[_0x4f2b('0x94')](function(_0x173b39){for(var _0x399006=0x0;_0x399006<_0x308285[_0x4f2b('0x5d')][_0x4f2b('0x74')][_0x4f2b('0x59')];_0x399006+=0x1){socket[_0x4f2b('0x7d')](_0x4f2b('0x7e'),{'UserId':Number(_0x308285[_0x4f2b('0x5d')]['ids'][_0x399006]),'ChatQueueId':Number(_0x308285[_0x4f2b('0x58')]['id'])});}return _0x173b39;});}})[_0x4f2b('0x1f')](respondWithResult(_0x5db6ec,null))['catch'](handleError(_0x5db6ec,null));};exports['removeAgents']=function(_0xc2b11c,_0x95c845,_0x2b091f){return db[_0x4f2b('0x54')][_0x4f2b('0x61')]({'where':{'id':_0xc2b11c[_0x4f2b('0x58')]['id']}})[_0x4f2b('0x1f')](handleEntityNotFound(_0x95c845,null))[_0x4f2b('0x1f')](function(_0x32d24f){if(_0x32d24f){return _0x32d24f['removeAgents'](_0xc2b11c[_0x4f2b('0x44')][_0x4f2b('0x74')])[_0x4f2b('0x1f')](function(){if(_[_0x4f2b('0x95')](_0xc2b11c[_0x4f2b('0x44')][_0x4f2b('0x74')])){for(var _0xe39528=0x0;_0xe39528<_0xc2b11c[_0x4f2b('0x44')]['ids'][_0x4f2b('0x59')];_0xe39528+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0xc2b11c['query']['ids'][_0xe39528]),'ChatQueueId':Number(_0xc2b11c[_0x4f2b('0x58')]['id'])});}}else{socket[_0x4f2b('0x7d')]('userChatQueue:remove',{'UserId':Number(_0xc2b11c[_0x4f2b('0x44')]['ids']),'ChatQueueId':Number(_0xc2b11c[_0x4f2b('0x58')]['id'])});}});}})[_0x4f2b('0x1f')](respondWithStatusCode(_0x95c845,null))['catch'](handleError(_0x95c845,null));};exports[_0x4f2b('0x96')]=function(_0xb6aae8,_0x337846,_0x3b5d5a){var _0x577641={};var _0x5789d7={};var _0x33d0f3;var _0x4b8696;return db[_0x4f2b('0x54')]['findOne']({'where':{'id':_0xb6aae8[_0x4f2b('0x58')]['id']}})['then'](handleEntityNotFound(_0x337846,null))['then'](function(_0x4aebeb){if(_0x4aebeb){_0x33d0f3=_0x4aebeb;_0x5789d7['model']=_[_0x4f2b('0x43')](db[_0x4f2b('0x6a')][_0x4f2b('0x40')]);_0x5789d7[_0x4f2b('0x44')]=_['keys'](_0xb6aae8[_0x4f2b('0x44')]);_0x5789d7[_0x4f2b('0x45')]=_[_0x4f2b('0x46')](_0x5789d7[_0x4f2b('0x47')],_0x5789d7[_0x4f2b('0x44')]);_0x577641[_0x4f2b('0x49')]=_['intersection'](_0x5789d7[_0x4f2b('0x47')],qs['fields'](_0xb6aae8['query'][_0x4f2b('0x48')]));_0x577641['attributes']=_0x577641[_0x4f2b('0x49')][_0x4f2b('0x59')]?_0x577641[_0x4f2b('0x49')]:_0x5789d7[_0x4f2b('0x47')];_0x577641[_0x4f2b('0x4c')]=qs[_0x4f2b('0x4d')](_0xb6aae8[_0x4f2b('0x44')]['sort']);_0x577641[_0x4f2b('0x4e')]=qs[_0x4f2b('0x45')](_[_0x4f2b('0x4f')](_0xb6aae8[_0x4f2b('0x44')],_0x5789d7[_0x4f2b('0x45')]));if(_0xb6aae8[_0x4f2b('0x44')][_0x4f2b('0x50')]){_0x577641[_0x4f2b('0x4e')]=_[_0x4f2b('0x51')](_0x577641['where'],{'$or':_[_0x4f2b('0x3f')](_0x577641[_0x4f2b('0x49')],function(_0x1a04c7){var _0x2880b6={};_0x2880b6[_0x1a04c7]={'$like':'%'+_0xb6aae8['query']['filter']+'%'};return _0x2880b6;})});}_0x577641=_[_0x4f2b('0x51')]({},_0x577641,_0xb6aae8['options']);return _0x33d0f3['getAgents'](_0x577641);}})[_0x4f2b('0x1f')](function(_0x233aab){if(_0x233aab){_0x4b8696=_0x233aab[_0x4f2b('0x59')];if(!_0xb6aae8[_0x4f2b('0x44')][_0x4f2b('0x4a')](_0x4f2b('0x4b'))){_0x577641[_0x4f2b('0x2f')]=qs[_0x4f2b('0x2f')](_0xb6aae8[_0x4f2b('0x44')][_0x4f2b('0x2f')]);_0x577641[_0x4f2b('0x2d')]=qs['offset'](_0xb6aae8[_0x4f2b('0x44')][_0x4f2b('0x2d')]);}return _0x33d0f3[_0x4f2b('0x96')](_0x577641);}})[_0x4f2b('0x1f')](function(_0x5218b6){if(_0x5218b6){return _0x5218b6?{'count':_0x4b8696,'rows':_0x5218b6}:null;}})[_0x4f2b('0x1f')](respondWithResult(_0x337846,null))[_0x4f2b('0x5b')](handleError(_0x337846,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 61c4326..04e3ac2 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 _0xae7c=['events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x373afe,_0x4841f3){var _0x4decea=function(_0x441ed5){while(--_0x441ed5){_0x373afe['push'](_0x373afe['shift']());}};_0x4decea(++_0x4841f3);}(_0xae7c,0x104));var _0xcae7=function(_0x6b5e76,_0x25a104){_0x6b5e76=_0x6b5e76-0x0;var _0x1f8e50=_0xae7c[_0x6b5e76];return _0x1f8e50;};'use strict';var EventEmitter=require(_0xcae7('0x0'));var ChatQueue=require(_0xcae7('0x1'))['db'][_0xcae7('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xcae7('0x3')](0x0);var events={'afterCreate':_0xcae7('0x4'),'afterUpdate':_0xcae7('0x5'),'afterDestroy':_0xcae7('0x6')};function emitEvent(_0x2f15c1){return function(_0x515a0d,_0x180939,_0x3e1946){ChatQueueEvents[_0xcae7('0x7')](_0x2f15c1+':'+_0x515a0d['id'],_0x515a0d);ChatQueueEvents['emit'](_0x2f15c1,_0x515a0d);_0x3e1946(null);};}for(var e in events){if(events[_0xcae7('0x8')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xcae7('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0xb9f7=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x41fce6,_0x25a107){var _0x4c13bb=function(_0x43778b){while(--_0x43778b){_0x41fce6['push'](_0x41fce6['shift']());}};_0x4c13bb(++_0x25a107);}(_0xb9f7,0xca));var _0x7b9f=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0xb9f7[_0x903228];return _0xcec81d;};'use strict';var EventEmitter=require(_0x7b9f('0x0'));var ChatQueue=require(_0x7b9f('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7b9f('0x2')](0x0);var events={'afterCreate':_0x7b9f('0x3'),'afterUpdate':_0x7b9f('0x4'),'afterDestroy':_0x7b9f('0x5')};function emitEvent(_0x24867c){return function(_0x3f4b91,_0x3fd6e5,_0x48b808){ChatQueueEvents[_0x7b9f('0x6')](_0x24867c+':'+_0x3f4b91['id'],_0x3f4b91);ChatQueueEvents[_0x7b9f('0x6')](_0x24867c,_0x3f4b91);_0x48b808(null);};}for(var e in events){if(events[_0x7b9f('0x7')](e)){var event=events[e];ChatQueue[_0x7b9f('0x8')](e,emitEvent(event));}}module[_0x7b9f('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 364c450..49c89e6 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 _0x579d=['chat_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define'];(function(_0x31df6f,_0x380e73){var _0x31e353=function(_0x3a434b){while(--_0x3a434b){_0x31df6f['push'](_0x31df6f['shift']());}};_0x31e353(++_0x380e73);}(_0x579d,0x1a3));var _0xd579=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x579d[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd579('0x0'))(_0xd579('0x1'));var moment=require(_0xd579('0x2'));var BPromise=require(_0xd579('0x3'));var rp=require(_0xd579('0x4'));var fs=require('fs');var path=require(_0xd579('0x5'));var rimraf=require(_0xd579('0x6'));var config=require(_0xd579('0x7'));var attributes=require(_0xd579('0x8'));module['exports']=function(_0x24f5f1,_0x5a7bb7){return _0x24f5f1[_0xd579('0x9')]('ChatQueue',attributes,{'tableName':_0xd579('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bbb=['rimraf','../../config/environment','./chatQueue.attributes','lodash','util','moment','request-promise','path'];(function(_0x48391b,_0x51132d){var _0x16cd8f=function(_0x59fa13){while(--_0x59fa13){_0x48391b['push'](_0x48391b['shift']());}};_0x16cd8f(++_0x51132d);}(_0x4bbb,0x1d3));var _0xb4bb=function(_0x4d4968,_0x2fbe38){_0x4d4968=_0x4d4968-0x0;var _0x19e5e6=_0x4bbb[_0x4d4968];return _0x19e5e6;};'use strict';var _=require(_0xb4bb('0x0'));var util=require(_0xb4bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb4bb('0x2'));var BPromise=require('bluebird');var rp=require(_0xb4bb('0x3'));var fs=require('fs');var path=require(_0xb4bb('0x4'));var rimraf=require(_0xb4bb('0x5'));var config=require(_0xb4bb('0x6'));var attributes=require(_0xb4bb('0x7'));module['exports']=function(_0x34b5ca,_0x564412){return _0x34b5ca['define']('ChatQueue',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 7634c40..80013f7 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 _0x8188=['ShowChatQueue','lodash','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','request','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model','catch','find','raw','then'];(function(_0x34c646,_0xa5519c){var _0x351d34=function(_0x4bb9d3){while(--_0x4bb9d3){_0x34c646['push'](_0x34c646['shift']());}};_0x351d34(++_0xa5519c);}(_0x8188,0x76));var _0x8818=function(_0x21f649,_0x550328){_0x21f649=_0x21f649-0x0;var _0x87e52e=_0x8188[_0x21f649];return _0x87e52e;};'use strict';var _=require(_0x8818('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8818('0x1'));var fs=require('fs');var Redis=require(_0x8818('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8818('0x3'))(_0x8818('0x4'));var config=require(_0x8818('0x5'));var jayson=require(_0x8818('0x6'));var client=jayson[_0x8818('0x7')][_0x8818('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8818('0x9')],{'host':_0x8818('0xa'),'port':0x18eb});var socket=require(_0x8818('0xb'))(new Redis(config[_0x8818('0x9')]));require(_0x8818('0xc'))['register'](socket);function respondWithRpcPromise(_0x246ca8,_0x3f6c0d,_0x47136e){return new BPromise(function(_0x2b5d0b,_0x553716){return client[_0x8818('0xd')](_0x246ca8,_0x47136e)['then'](function(_0x3276d0){logger[_0x8818('0xe')]('ChatQueue,\x20%s,\x20%s',_0x3f6c0d,'request\x20sent');logger[_0x8818('0xf')](_0x8818('0x10'),_0x3f6c0d,_0x8818('0x11'),JSON[_0x8818('0x12')](_0x3276d0));if(_0x3276d0[_0x8818('0x13')]){if(_0x3276d0[_0x8818('0x13')][_0x8818('0x14')]===0x1f4){logger['error'](_0x8818('0x15'),_0x3f6c0d,_0x3276d0[_0x8818('0x13')][_0x8818('0x16')]);return _0x553716(_0x3276d0[_0x8818('0x13')][_0x8818('0x16')]);}logger[_0x8818('0x13')]('ChatQueue,\x20%s,\x20%s',_0x3f6c0d,_0x3276d0[_0x8818('0x13')]['message']);return _0x2b5d0b(_0x3276d0[_0x8818('0x13')][_0x8818('0x16')]);}else{logger[_0x8818('0xe')]('ChatQueue,\x20%s,\x20%s',_0x3f6c0d,_0x8818('0x11'));_0x2b5d0b(_0x3276d0[_0x8818('0x17')]['message']);}})['catch'](function(_0x22eda6){logger[_0x8818('0x13')](_0x8818('0x15'),_0x3f6c0d,_0x22eda6);_0x553716(_0x22eda6);});});}exports[_0x8818('0x18')]=function(_0x6e880d){var _0x5402c1=this;return new Promise(function(_0xd054b5,_0x397d28){return db[_0x8818('0x19')][_0x8818('0x1a')]({'raw':_0x6e880d[_0x8818('0x1b')]?_0x6e880d['options']['raw']===undefined?!![]:![]:!![],'where':_0x6e880d['options']?_0x6e880d[_0x8818('0x1b')][_0x8818('0x1c')]||null:null,'attributes':_0x6e880d[_0x8818('0x1b')]?_0x6e880d[_0x8818('0x1b')][_0x8818('0x1d')]||null:null,'limit':_0x6e880d[_0x8818('0x1b')]?_0x6e880d['options'][_0x8818('0x1e')]||null:null,'include':_0x6e880d[_0x8818('0x1b')]?_0x6e880d['options'][_0x8818('0x1f')]?_[_0x8818('0x20')](_0x6e880d[_0x8818('0x1b')][_0x8818('0x1f')],function(_0x46747f){return{'model':db[_0x46747f[_0x8818('0x21')]],'as':_0x46747f['as'],'attributes':_0x46747f['attributes'],'include':_0x46747f[_0x8818('0x1f')]?_[_0x8818('0x20')](_0x46747f[_0x8818('0x1f')],function(_0x225b9b){return{'model':db[_0x225b9b[_0x8818('0x21')]],'as':_0x225b9b['as'],'attributes':_0x225b9b[_0x8818('0x1d')],'include':_0x225b9b[_0x8818('0x1f')]?_['map'](_0x225b9b[_0x8818('0x1f')],function(_0x4aa3dd){return{'model':db[_0x4aa3dd[_0x8818('0x21')]],'as':_0x4aa3dd['as'],'attributes':_0x4aa3dd[_0x8818('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15ab06){logger[_0x8818('0xe')](_0x8818('0x18'),_0x6e880d);logger[_0x8818('0xf')](_0x8818('0x18'),_0x6e880d,JSON[_0x8818('0x12')](_0x15ab06));_0xd054b5(_0x15ab06);})[_0x8818('0x22')](function(_0x3792c7){logger[_0x8818('0x13')](_0x8818('0x18'),_0x3792c7[_0x8818('0x16')],_0x6e880d);_0x397d28(_0x5402c1[_0x8818('0x13')](0x1f4,_0x3792c7['message']));});});};exports['ShowChatQueue']=function(_0x2b2eba){var _0x2094cc=this;return new Promise(function(_0x3c3ef9,_0x2d91ac){return db[_0x8818('0x19')][_0x8818('0x23')]({'raw':_0x2b2eba[_0x8818('0x1b')]?_0x2b2eba['options'][_0x8818('0x24')]===undefined?!![]:![]:!![],'where':_0x2b2eba[_0x8818('0x1b')]?_0x2b2eba[_0x8818('0x1b')][_0x8818('0x1c')]||null:null,'attributes':_0x2b2eba[_0x8818('0x1b')]?_0x2b2eba[_0x8818('0x1b')]['attributes']||null:null,'include':_0x2b2eba[_0x8818('0x1b')]?_0x2b2eba[_0x8818('0x1b')]['include']?_[_0x8818('0x20')](_0x2b2eba['options'][_0x8818('0x1f')],function(_0x1a1d80){return{'model':db[_0x1a1d80[_0x8818('0x21')]],'as':_0x1a1d80['as'],'attributes':_0x1a1d80['attributes'],'include':_0x1a1d80[_0x8818('0x1f')]?_['map'](_0x1a1d80['include'],function(_0x4e0dca){return{'model':db[_0x4e0dca['model']],'as':_0x4e0dca['as'],'attributes':_0x4e0dca['attributes'],'include':_0x4e0dca['include']?_[_0x8818('0x20')](_0x4e0dca[_0x8818('0x1f')],function(_0x328f5f){return{'model':db[_0x328f5f[_0x8818('0x21')]],'as':_0x328f5f['as'],'attributes':_0x328f5f[_0x8818('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8818('0x25')](function(_0x54f82e){logger[_0x8818('0xe')]('ShowChatQueue',_0x2b2eba);logger[_0x8818('0xf')](_0x8818('0x26'),_0x2b2eba,JSON[_0x8818('0x12')](_0x54f82e));_0x3c3ef9(_0x54f82e);})[_0x8818('0x22')](function(_0x2bb206){logger[_0x8818('0x13')](_0x8818('0x26'),_0x2bb206['message'],_0x2b2eba);_0x2d91ac(_0x2094cc[_0x8818('0x13')](0x1f4,_0x2bb206[_0x8818('0x16')]));});});}; \ No newline at end of file +var _0x96f9=['info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowChatQueue','ChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','register','request','then'];(function(_0x1b0229,_0x53e271){var _0x23551e=function(_0x4cc25f){while(--_0x4cc25f){_0x1b0229['push'](_0x1b0229['shift']());}};_0x23551e(++_0x53e271);}(_0x96f9,0x64));var _0x996f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x96f9[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x996f('0x0'));var util=require(_0x996f('0x1'));var moment=require(_0x996f('0x2'));var BPromise=require(_0x996f('0x3'));var rs=require(_0x996f('0x4'));var fs=require('fs');var Redis=require(_0x996f('0x5'));var db=require(_0x996f('0x6'))['db'];var utils=require(_0x996f('0x7'));var logger=require(_0x996f('0x8'))('rpc');var config=require(_0x996f('0x9'));var jayson=require(_0x996f('0xa'));var client=jayson['client'][_0x996f('0xb')]({'port':0x232a});config[_0x996f('0xc')]=_[_0x996f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x996f('0xe')](socket);function respondWithRpcPromise(_0x120c79,_0x226986,_0x54e4a3){return new BPromise(function(_0x4775ff,_0xeb28b9){return client[_0x996f('0xf')](_0x120c79,_0x54e4a3)[_0x996f('0x10')](function(_0x5560a0){logger[_0x996f('0x11')](_0x996f('0x12'),_0x226986,'request\x20sent');logger[_0x996f('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x226986,_0x996f('0x14'),JSON[_0x996f('0x15')](_0x5560a0));if(_0x5560a0['error']){if(_0x5560a0[_0x996f('0x16')]['code']===0x1f4){logger[_0x996f('0x16')](_0x996f('0x12'),_0x226986,_0x5560a0[_0x996f('0x16')][_0x996f('0x17')]);return _0xeb28b9(_0x5560a0['error'][_0x996f('0x17')]);}logger[_0x996f('0x16')]('ChatQueue,\x20%s,\x20%s',_0x226986,_0x5560a0[_0x996f('0x16')]['message']);return _0x4775ff(_0x5560a0['error'][_0x996f('0x17')]);}else{logger[_0x996f('0x11')](_0x996f('0x12'),_0x226986,'request\x20sent');_0x4775ff(_0x5560a0[_0x996f('0x18')][_0x996f('0x17')]);}})['catch'](function(_0x275691){logger[_0x996f('0x16')](_0x996f('0x12'),_0x226986,_0x275691);_0xeb28b9(_0x275691);});});}exports[_0x996f('0x19')]=function(_0x4db317){var _0x10efb6=this;return new Promise(function(_0x5db588,_0x35d508){return db['ChatQueue'][_0x996f('0x1a')]({'raw':_0x4db317[_0x996f('0x1b')]?_0x4db317[_0x996f('0x1b')][_0x996f('0x1c')]===undefined?!![]:![]:!![],'where':_0x4db317[_0x996f('0x1b')]?_0x4db317[_0x996f('0x1b')][_0x996f('0x1d')]||null:null,'attributes':_0x4db317[_0x996f('0x1b')]?_0x4db317[_0x996f('0x1b')]['attributes']||null:null,'limit':_0x4db317[_0x996f('0x1b')]?_0x4db317['options'][_0x996f('0x1e')]||null:null,'include':_0x4db317[_0x996f('0x1b')]?_0x4db317['options'][_0x996f('0x1f')]?_[_0x996f('0x20')](_0x4db317['options']['include'],function(_0x492b5f){return{'model':db[_0x492b5f[_0x996f('0x21')]],'as':_0x492b5f['as'],'attributes':_0x492b5f[_0x996f('0x22')],'include':_0x492b5f['include']?_[_0x996f('0x20')](_0x492b5f['include'],function(_0x5b08d0){return{'model':db[_0x5b08d0[_0x996f('0x21')]],'as':_0x5b08d0['as'],'attributes':_0x5b08d0[_0x996f('0x22')],'include':_0x5b08d0[_0x996f('0x1f')]?_[_0x996f('0x20')](_0x5b08d0[_0x996f('0x1f')],function(_0x419662){return{'model':db[_0x419662[_0x996f('0x21')]],'as':_0x419662['as'],'attributes':_0x419662[_0x996f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x996f('0x10')](function(_0x8c07d7){logger[_0x996f('0x11')](_0x996f('0x19'),_0x4db317);logger[_0x996f('0x13')]('GetChatQueue',_0x4db317,JSON[_0x996f('0x15')](_0x8c07d7));_0x5db588(_0x8c07d7);})[_0x996f('0x23')](function(_0x2216e1){logger[_0x996f('0x16')]('GetChatQueue',_0x2216e1[_0x996f('0x17')],_0x4db317);_0x35d508(_0x10efb6[_0x996f('0x16')](0x1f4,_0x2216e1[_0x996f('0x17')]));});});};exports[_0x996f('0x24')]=function(_0x5c58cf){var _0x587356=this;return new Promise(function(_0x6a42c4,_0x2facc2){return db[_0x996f('0x25')][_0x996f('0x26')]({'raw':_0x5c58cf[_0x996f('0x1b')]?_0x5c58cf[_0x996f('0x1b')][_0x996f('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c58cf[_0x996f('0x1b')]?_0x5c58cf[_0x996f('0x1b')][_0x996f('0x1d')]||null:null,'attributes':_0x5c58cf[_0x996f('0x1b')]?_0x5c58cf['options'][_0x996f('0x22')]||null:null,'include':_0x5c58cf[_0x996f('0x1b')]?_0x5c58cf[_0x996f('0x1b')][_0x996f('0x1f')]?_[_0x996f('0x20')](_0x5c58cf[_0x996f('0x1b')][_0x996f('0x1f')],function(_0x148908){return{'model':db[_0x148908[_0x996f('0x21')]],'as':_0x148908['as'],'attributes':_0x148908['attributes'],'include':_0x148908[_0x996f('0x1f')]?_[_0x996f('0x20')](_0x148908[_0x996f('0x1f')],function(_0x6e0b5c){return{'model':db[_0x6e0b5c[_0x996f('0x21')]],'as':_0x6e0b5c['as'],'attributes':_0x6e0b5c[_0x996f('0x22')],'include':_0x6e0b5c[_0x996f('0x1f')]?_['map'](_0x6e0b5c[_0x996f('0x1f')],function(_0x50c0b1){return{'model':db[_0x50c0b1['model']],'as':_0x50c0b1['as'],'attributes':_0x50c0b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x996f('0x10')](function(_0x547f3c){logger[_0x996f('0x11')]('ShowChatQueue',_0x5c58cf);logger[_0x996f('0x13')](_0x996f('0x24'),_0x5c58cf,JSON[_0x996f('0x15')](_0x547f3c));_0x6a42c4(_0x547f3c);})[_0x996f('0x23')](function(_0x5252b4){logger['error'](_0x996f('0x24'),_0x5252b4[_0x996f('0x17')],_0x5c58cf);_0x2facc2(_0x587356[_0x996f('0x16')](0x1f4,_0x5252b4['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index e419b33..9c1db36 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 _0x5178=['remove','update','register','length','save'];(function(_0x36403e,_0x440182){var _0x334dee=function(_0x4b3d6e){while(--_0x4b3d6e){_0x36403e['push'](_0x36403e['shift']());}};_0x334dee(++_0x440182);}(_0x5178,0x171));var _0x8517=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5178[_0x618414];return _0x21c19a;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8517('0x0'),_0x8517('0x1'),_0x8517('0x2')];function createListener(_0x2dc28f,_0x38d5b3){return function(_0x5e0a44){_0x38d5b3['emit'](_0x2dc28f,_0x5e0a44);};}function removeListener(_0x3ed6a5,_0x221184){return function(){ChatQueueEvents['removeListener'](_0x3ed6a5,_0x221184);};}exports[_0x8517('0x3')]=function(_0x58ed7e){for(var _0x13ba05=0x0,_0x45498e=events[_0x8517('0x4')];_0x13ba05<_0x45498e;_0x13ba05++){var _0x10f918=events[_0x13ba05];var _0x25146d=createListener('chatQueue:'+_0x10f918,_0x58ed7e);ChatQueueEvents['on'](_0x10f918,_0x25146d);}}; \ No newline at end of file +var _0x6334=['length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x389911,_0x2d61b2){var _0x5d3cdc=function(_0x1b0818){while(--_0x1b0818){_0x389911['push'](_0x389911['shift']());}};_0x5d3cdc(++_0x2d61b2);}(_0x6334,0x119));var _0x4633=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0x6334[_0x190681];return _0x4f2ada;};'use strict';var ChatQueueEvents=require(_0x4633('0x0'));var events=[_0x4633('0x1'),_0x4633('0x2'),_0x4633('0x3')];function createListener(_0x1e53a0,_0x47254b){return function(_0x5109db){_0x47254b[_0x4633('0x4')](_0x1e53a0,_0x5109db);};}function removeListener(_0x205442,_0x2a2b3c){return function(){ChatQueueEvents[_0x4633('0x5')](_0x205442,_0x2a2b3c);};}exports[_0x4633('0x6')]=function(_0x6493dc){for(var _0x175e14=0x0,_0x4a8997=events[_0x4633('0x7')];_0x175e14<_0x4a8997;_0x175e14++){var _0x56891d=events[_0x175e14];var _0x21af74=createListener(_0x4633('0x8')+_0x56891d,_0x6493dc);ChatQueueEvents['on'](_0x56891d,_0x21af74);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 25d7f36..9b5c106 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x42e961,_0x12b8d5){var _0x30d9f3=function(_0x30f3c1){while(--_0x30f3c1){_0x42e961['push'](_0x42e961['shift']());}};_0x30d9f3(++_0x12b8d5);}(_0xe14b,0x93));var _0xbe14=function(_0x26b9d0,_0x5c1549){_0x26b9d0=_0x26b9d0-0x0;var _0x495a45=_0xe14b[_0x26b9d0];return _0x495a45;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e2faa,_0x4ddbce){var _0x160b67=function(_0x50863b){while(--_0x50863b){_0x2e2faa['push'](_0x2e2faa['shift']());}};_0x160b67(++_0x4ddbce);}(_0x008c,0x188));var _0xc008=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0x008c[_0x3e2480];return _0x652c0;};'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')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);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('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 2907aec..a5b7ccf 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 _0x1668=['DATE','sequelize','exports','STRING'];(function(_0x36db62,_0x97922d){var _0x2b29fd=function(_0x1c6629){while(--_0x1c6629){_0x36db62['push'](_0x36db62['shift']());}};_0x2b29fd(++_0x97922d);}(_0x1668,0x65));var _0x8166=function(_0xc87c9d,_0x4b5c5a){_0xc87c9d=_0xc87c9d-0x0;var _0x42a431=_0x1668[_0xc87c9d];return _0x42a431;};'use strict';var moment=require('moment');var Sequelize=require(_0x8166('0x0'));module[_0x8166('0x1')]={'uniqueid':{'type':Sequelize[_0x8166('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8166('0x3')]},'leaveAt':{'type':Sequelize[_0x8166('0x3')]},'acceptAt':{'type':Sequelize[_0x8166('0x3')]},'exitAt':{'type':Sequelize[_0x8166('0x3')]},'reason':{'type':Sequelize[_0x8166('0x2')]}}; \ No newline at end of file +var _0x01e3=['moment','sequelize','exports','STRING','DATE'];(function(_0x3ee03a,_0x402057){var _0x54a72a=function(_0x199b38){while(--_0x199b38){_0x3ee03a['push'](_0x3ee03a['shift']());}};_0x54a72a(++_0x402057);}(_0x01e3,0x122));var _0x301e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01e3[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x301e('0x0'));var Sequelize=require(_0x301e('0x1'));module[_0x301e('0x2')]={'uniqueid':{'type':Sequelize[_0x301e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x301e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x301e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x301e('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 5853a8f..3b09b78 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 _0x16a6=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x43000,_0x469121){var _0x26c0f0=function(_0x26dbc1){while(--_0x26dbc1){_0x43000['push'](_0x43000['shift']());}};_0x26c0f0(++_0x469121);}(_0x16a6,0x15c));var _0x616a=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x16a6[_0x588011];return _0x3b3773;};'use strict';var emlformat=require(_0x616a('0x0'));var rimraf=require(_0x616a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x616a('0x2'));var rp=require(_0x616a('0x3'));var moment=require(_0x616a('0x4'));var BPromise=require(_0x616a('0x5'));var Mustache=require(_0x616a('0x6'));var util=require(_0x616a('0x7'));var path=require('path');var sox=require(_0x616a('0x8'));var csv=require(_0x616a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x616a('0xa'));var squel=require(_0x616a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x616a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x616a('0xd'));var Papa=require('papaparse');var Redis=require(_0x616a('0xe'));var authService=require(_0x616a('0xf'));var qs=require(_0x616a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x616a('0x11'));var logger=require(_0x616a('0x12'))(_0x616a('0x13'));var utils=require(_0x616a('0x14'));var config=require(_0x616a('0x15'));var licenseUtil=require(_0x616a('0x16'));var db=require(_0x616a('0x17'))['db'];function respondWithStatusCode(_0x4122b7,_0x5755c7){_0x5755c7=_0x5755c7||0xcc;return function(_0x318dfe){if(_0x318dfe){return _0x4122b7[_0x616a('0x18')](_0x5755c7);}return _0x4122b7[_0x616a('0x19')](_0x5755c7)[_0x616a('0x1a')]();};}function respondWithResult(_0x295fc2,_0x4a33d5){_0x4a33d5=_0x4a33d5||0xc8;return function(_0x1399c1){if(_0x1399c1){return _0x295fc2[_0x616a('0x19')](_0x4a33d5)[_0x616a('0x1b')](_0x1399c1);}};}function respondWithFilteredResult(_0x18b6dc,_0x3bcf20){return function(_0x53f228){if(_0x53f228){var _0x204e68=typeof _0x3bcf20[_0x616a('0x1c')]==='undefined'&&typeof _0x3bcf20['limit']===_0x616a('0x1d');var _0x4768b2=_0x53f228[_0x616a('0x1e')];var _0x4d59e7=_0x204e68?0x0:_0x3bcf20[_0x616a('0x1c')];var _0x1f3241=_0x204e68?_0x53f228['count']:_0x3bcf20['offset']+_0x3bcf20[_0x616a('0x1f')];var _0x27e95c;if(_0x1f3241>=_0x4768b2){_0x1f3241=_0x4768b2;_0x27e95c=0xc8;}else{_0x27e95c=0xce;}_0x18b6dc[_0x616a('0x19')](_0x27e95c);return _0x18b6dc[_0x616a('0x20')]('Content-Range',_0x4d59e7+'-'+_0x1f3241+'/'+_0x4768b2)['json'](_0x53f228);}return null;};}function patchUpdates(_0x5568fd){return function(_0x5f2e80){try{jsonpatch['apply'](_0x5f2e80,_0x5568fd,!![]);}catch(_0x5ee3f2){return BPromise[_0x616a('0x21')](_0x5ee3f2);}return _0x5f2e80['save']();};}function saveUpdates(_0xb8ceeb,_0x137974){return function(_0x4f5594){if(_0x4f5594){return _0x4f5594[_0x616a('0x22')](_0xb8ceeb)[_0x616a('0x23')](function(_0x3d484b){return _0x3d484b;});}return null;};}function removeEntity(_0x100c98,_0x500c22){return function(_0x2db2bb){if(_0x2db2bb){return _0x2db2bb[_0x616a('0x24')]()[_0x616a('0x23')](function(){_0x100c98[_0x616a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e11f2,_0x4be8a8){return function(_0x30c1a){if(!_0x30c1a){_0x3e11f2[_0x616a('0x18')](0x194);}return _0x30c1a;};}function handleError(_0x5f1e6a,_0x55abc8){_0x55abc8=_0x55abc8||0x1f4;return function(_0x50c6b8){logger[_0x616a('0x25')](_0x50c6b8[_0x616a('0x26')]);if(_0x50c6b8[_0x616a('0x27')]){delete _0x50c6b8[_0x616a('0x27')];}_0x5f1e6a['status'](_0x55abc8)[_0x616a('0x28')](_0x50c6b8);};}exports[_0x616a('0x29')]=function(_0x195b73,_0x163fd0){var _0x28ca50={},_0x87db00={},_0x41a22d={'count':0x0,'rows':[]};var _0x5f3a59=_[_0x616a('0x2a')](db[_0x616a('0x2b')]['rawAttributes'],function(_0x41f722){return{'name':_0x41f722['fieldName'],'type':_0x41f722['type'][_0x616a('0x2c')]};});_0x87db00[_0x616a('0x2d')]=_[_0x616a('0x2a')](_0x5f3a59,'name');_0x87db00[_0x616a('0x2e')]=_[_0x616a('0x2f')](_0x195b73[_0x616a('0x2e')]);_0x87db00[_0x616a('0x30')]=_[_0x616a('0x31')](_0x87db00[_0x616a('0x2d')],_0x87db00['query']);_0x28ca50[_0x616a('0x32')]=_['intersection'](_0x87db00[_0x616a('0x2d')],qs[_0x616a('0x33')](_0x195b73[_0x616a('0x2e')]['fields']));_0x28ca50[_0x616a('0x32')]=_0x28ca50[_0x616a('0x32')]['length']?_0x28ca50['attributes']:_0x87db00[_0x616a('0x2d')];if(!_0x195b73[_0x616a('0x2e')][_0x616a('0x34')](_0x616a('0x35'))){_0x28ca50['limit']=qs['limit'](_0x195b73['query'][_0x616a('0x1f')]);_0x28ca50[_0x616a('0x1c')]=qs[_0x616a('0x1c')](_0x195b73[_0x616a('0x2e')][_0x616a('0x1c')]);}_0x28ca50[_0x616a('0x36')]=qs[_0x616a('0x37')](_0x195b73[_0x616a('0x2e')][_0x616a('0x37')]);_0x28ca50[_0x616a('0x38')]=qs['filters'](_[_0x616a('0x39')](_0x195b73['query'],_0x87db00[_0x616a('0x30')]),_0x5f3a59);if(_0x195b73[_0x616a('0x2e')][_0x616a('0x3a')]){_0x28ca50[_0x616a('0x38')]=_[_0x616a('0x3b')](_0x28ca50[_0x616a('0x38')],{'$or':_[_0x616a('0x2a')](_0x5f3a59,function(_0x220c32){if(_0x220c32[_0x616a('0x3c')]!=='VIRTUAL'){var _0x304e27={};_0x304e27[_0x220c32[_0x616a('0x27')]]={'$like':'%'+_0x195b73[_0x616a('0x2e')][_0x616a('0x3a')]+'%'};return _0x304e27;}})});}_0x28ca50=_['merge']({},_0x28ca50,_0x195b73[_0x616a('0x3d')]);var _0x4c6a76={'where':_0x28ca50[_0x616a('0x38')]};return db['ChatQueueReport'][_0x616a('0x1e')](_0x4c6a76)[_0x616a('0x23')](function(_0x598085){_0x41a22d[_0x616a('0x1e')]=_0x598085;if(_0x195b73['query'][_0x616a('0x3e')]){_0x28ca50[_0x616a('0x3f')]=[{'all':!![]}];}return db[_0x616a('0x2b')][_0x616a('0x40')](_0x28ca50);})[_0x616a('0x23')](function(_0x21fd2b){_0x41a22d[_0x616a('0x41')]=_0x21fd2b;return _0x41a22d;})['then'](respondWithFilteredResult(_0x163fd0,_0x28ca50))[_0x616a('0x42')](handleError(_0x163fd0,null));};exports['show']=function(_0x409689,_0x35e3e3){var _0x199140={'raw':!![],'where':{'id':_0x409689[_0x616a('0x43')]['id']}},_0x4dbb8b={};_0x4dbb8b[_0x616a('0x2d')]=_[_0x616a('0x2f')](db[_0x616a('0x2b')][_0x616a('0x44')]);_0x4dbb8b['query']=_[_0x616a('0x2f')](_0x409689[_0x616a('0x2e')]);_0x4dbb8b[_0x616a('0x30')]=_['intersection'](_0x4dbb8b[_0x616a('0x2d')],_0x4dbb8b[_0x616a('0x2e')]);_0x199140[_0x616a('0x32')]=_[_0x616a('0x31')](_0x4dbb8b[_0x616a('0x2d')],qs[_0x616a('0x33')](_0x409689[_0x616a('0x2e')]['fields']));_0x199140[_0x616a('0x32')]=_0x199140[_0x616a('0x32')]['length']?_0x199140['attributes']:_0x4dbb8b[_0x616a('0x2d')];if(_0x409689[_0x616a('0x2e')][_0x616a('0x3e')]){_0x199140[_0x616a('0x3f')]=[{'all':!![]}];}_0x199140=_[_0x616a('0x3b')]({},_0x199140,_0x409689[_0x616a('0x3d')]);return db['ChatQueueReport'][_0x616a('0x45')](_0x199140)[_0x616a('0x23')](handleEntityNotFound(_0x35e3e3,null))[_0x616a('0x23')](respondWithResult(_0x35e3e3,null))['catch'](handleError(_0x35e3e3,null));};exports[_0x616a('0x46')]=function(_0x507efa,_0x52d38){return db[_0x616a('0x2b')][_0x616a('0x46')](_0x507efa[_0x616a('0x47')],{})['then'](respondWithResult(_0x52d38,0xc9))[_0x616a('0x42')](handleError(_0x52d38,null));};exports[_0x616a('0x22')]=function(_0x3bea90,_0x3d42fc){if(_0x3bea90[_0x616a('0x47')]['id']){delete _0x3bea90['body']['id'];}return db[_0x616a('0x2b')][_0x616a('0x45')]({'where':{'id':_0x3bea90[_0x616a('0x43')]['id']}})[_0x616a('0x23')](handleEntityNotFound(_0x3d42fc,null))[_0x616a('0x23')](saveUpdates(_0x3bea90[_0x616a('0x47')],null))['then'](respondWithResult(_0x3d42fc,null))[_0x616a('0x42')](handleError(_0x3d42fc,null));};exports[_0x616a('0x24')]=function(_0x349cd0,_0x16e6c2){return db['ChatQueueReport'][_0x616a('0x45')]({'where':{'id':_0x349cd0['params']['id']}})[_0x616a('0x23')](handleEntityNotFound(_0x16e6c2,null))[_0x616a('0x23')](removeEntity(_0x16e6c2,null))['catch'](handleError(_0x16e6c2,null));};exports[_0x616a('0x48')]=function(_0x1ea086,_0x30a48e){return db['ChatQueueReport'][_0x616a('0x48')]()[_0x616a('0x23')](respondWithResult(_0x30a48e,null))[_0x616a('0x42')](handleError(_0x30a48e,null));}; \ No newline at end of file +var _0x53ec=['then','sendStatus','name','send','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','create','update','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x30c5ab,_0x1ba368){var _0x4d9825=function(_0x56c8c1){while(--_0x56c8c1){_0x30c5ab['push'](_0x30c5ab['shift']());}};_0x4d9825(++_0x1ba368);}(_0x53ec,0x192));var _0xc53e=function(_0x55af86,_0x5c8ff6){_0x55af86=_0x55af86-0x0;var _0x58df3b=_0x53ec[_0x55af86];return _0x58df3b;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':!![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')](_0x4458c8['body'],{})[_0xc53e('0x24')](respondWithResult(_0x15e744,0xc9))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x5a6e41,_0x33d45c){if(_0x5a6e41[_0xc53e('0x46')]['id']){delete _0x5a6e41[_0xc53e('0x46')]['id'];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x5a6e41[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x33d45c,null))[_0xc53e('0x24')](saveUpdates(_0x5a6e41[_0xc53e('0x46')],null))[_0xc53e('0x24')](respondWithResult(_0x33d45c,null))['catch'](handleError(_0x33d45c,null));};exports[_0xc53e('0x47')]=function(_0x17cf13,_0x38520c){return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x17cf13['params']['id']}})['then'](handleEntityNotFound(_0x38520c,null))[_0xc53e('0x24')](removeEntity(_0x38520c,null))['catch'](handleError(_0x38520c,null));};exports[_0xc53e('0x48')]=function(_0x575a13,_0x3a49a4){return db[_0xc53e('0x29')][_0xc53e('0x48')]()['then'](respondWithResult(_0x3a49a4,null))[_0xc53e('0x43')](handleError(_0x3a49a4,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2e51abe..cd0471d 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(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3ac954,_0x32ef8e){var _0x5c1bdc=function(_0x3089ed){while(--_0x3089ed){_0x3ac954['push'](_0x3ac954['shift']());}};_0x5c1bdc(++_0x32ef8e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xb7e7[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 542d16f..5a97dbc 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 _0x32ac=['message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xa9f0d7,_0x27c50f){var _0x51ae50=function(_0x22bebb){while(--_0x22bebb){_0xa9f0d7['push'](_0xa9f0d7['shift']());}};_0x51ae50(++_0x27c50f);}(_0x32ac,0x16e));var _0xc32a=function(_0x1b0a7b,_0x80aba){_0x1b0a7b=_0x1b0a7b-0x0;var _0x5be56b=_0x32ac[_0x1b0a7b];return _0x5be56b;};'use strict';var _=require(_0xc32a('0x0'));var util=require(_0xc32a('0x1'));var moment=require(_0xc32a('0x2'));var BPromise=require(_0xc32a('0x3'));var rs=require(_0xc32a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc32a('0x5'));var logger=require(_0xc32a('0x6'))('rpc');var config=require(_0xc32a('0x7'));var jayson=require(_0xc32a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ddf6d,_0x1737e0,_0x33aa84){return new BPromise(function(_0x3c7d8b,_0x268aa3){return client[_0xc32a('0x9')](_0x4ddf6d,_0x33aa84)[_0xc32a('0xa')](function(_0x25ea75){logger['info'](_0xc32a('0xb'),_0x1737e0,_0xc32a('0xc'));logger[_0xc32a('0xd')](_0xc32a('0xe'),_0x1737e0,'request\x20sent',JSON[_0xc32a('0xf')](_0x25ea75));if(_0x25ea75[_0xc32a('0x10')]){if(_0x25ea75[_0xc32a('0x10')][_0xc32a('0x11')]===0x1f4){logger[_0xc32a('0x10')](_0xc32a('0xb'),_0x1737e0,_0x25ea75[_0xc32a('0x10')][_0xc32a('0x12')]);return _0x268aa3(_0x25ea75[_0xc32a('0x10')][_0xc32a('0x12')]);}logger[_0xc32a('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x1737e0,_0x25ea75[_0xc32a('0x10')][_0xc32a('0x12')]);return _0x3c7d8b(_0x25ea75[_0xc32a('0x10')][_0xc32a('0x12')]);}else{logger[_0xc32a('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x1737e0,'request\x20sent');_0x3c7d8b(_0x25ea75[_0xc32a('0x14')][_0xc32a('0x12')]);}})[_0xc32a('0x15')](function(_0x510d7b){logger['error'](_0xc32a('0xb'),_0x1737e0,_0x510d7b);_0x268aa3(_0x510d7b);});});}exports[_0xc32a('0x16')]=function(_0x59e72b){var _0x3912c3=this;return new Promise(function(_0x25becf,_0x527b28){return db[_0xc32a('0x17')][_0xc32a('0x18')](_0x59e72b['body'],{'raw':_0x59e72b[_0xc32a('0x19')]?_0x59e72b[_0xc32a('0x19')][_0xc32a('0x1a')]===undefined?!![]:![]:!![]})[_0xc32a('0xa')](function(_0x5d2d0e){logger[_0xc32a('0x13')]('CreateChatQueueReport',_0x59e72b);logger[_0xc32a('0xd')](_0xc32a('0x16'),_0x59e72b,JSON[_0xc32a('0xf')](_0x5d2d0e));_0x25becf(_0x5d2d0e);})[_0xc32a('0x15')](function(_0x243ed9){logger[_0xc32a('0x10')](_0xc32a('0x16'),_0x243ed9['message'],_0x59e72b);_0x527b28(_0x3912c3['error'](0x1f4,_0x243ed9[_0xc32a('0x12')]));});});};exports[_0xc32a('0x1b')]=function(_0x10d1aa){var _0x5de435=this;return new Promise(function(_0xe965c9,_0x5ecfca){return db[_0xc32a('0x17')]['update'](_0x10d1aa[_0xc32a('0x1c')],{'raw':_0x10d1aa[_0xc32a('0x19')]?_0x10d1aa[_0xc32a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10d1aa[_0xc32a('0x19')]?_0x10d1aa['options'][_0xc32a('0x1d')]||null:null,'attributes':_0x10d1aa[_0xc32a('0x19')]?_0x10d1aa[_0xc32a('0x19')][_0xc32a('0x1e')]||null:null,'limit':_0x10d1aa[_0xc32a('0x19')]?_0x10d1aa['options'][_0xc32a('0x1f')]||null:null})['then'](function(_0x1703ca){logger[_0xc32a('0x13')](_0xc32a('0x1b'),_0x10d1aa);logger[_0xc32a('0xd')]('UpdateChatQueueReport',_0x10d1aa,JSON[_0xc32a('0xf')](_0x1703ca));_0xe965c9(_0x1703ca);})[_0xc32a('0x15')](function(_0x2d1f87){logger[_0xc32a('0x10')](_0xc32a('0x1b'),_0x2d1f87['message'],_0x10d1aa);_0x5ecfca(_0x5de435[_0xc32a('0x10')](0x1f4,_0x2d1f87[_0xc32a('0x12')]));});});}; \ No newline at end of file +var _0x4201=['rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','stringify','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x36a3d1,_0x4a32cd){var _0x821ef4=function(_0x1dfb29){while(--_0x1dfb29){_0x36a3d1['push'](_0x36a3d1['shift']());}};_0x821ef4(++_0x4a32cd);}(_0x4201,0x102));var _0x1420=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0x4201[_0xe3e0af];return _0x4828e9;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var moment=require(_0x1420('0x2'));var BPromise=require('bluebird');var rs=require(_0x1420('0x3'));var fs=require('fs');var Redis=require(_0x1420('0x4'));var db=require(_0x1420('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1420('0x6'));var config=require(_0x1420('0x7'));var jayson=require(_0x1420('0x8'));var client=jayson[_0x1420('0x9')][_0x1420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dae38,_0x174ccf,_0x272e97){return new BPromise(function(_0x5c6211,_0xf9d2f6){return client[_0x1420('0xb')](_0x2dae38,_0x272e97)['then'](function(_0x4cc945){logger[_0x1420('0xc')](_0x1420('0xd'),_0x174ccf,_0x1420('0xe'));logger[_0x1420('0xf')](_0x1420('0x10'),_0x174ccf,'request\x20sent',JSON['stringify'](_0x4cc945));if(_0x4cc945[_0x1420('0x11')]){if(_0x4cc945[_0x1420('0x11')]['code']===0x1f4){logger[_0x1420('0x11')](_0x1420('0xd'),_0x174ccf,_0x4cc945[_0x1420('0x11')][_0x1420('0x12')]);return _0xf9d2f6(_0x4cc945['error'][_0x1420('0x12')]);}logger[_0x1420('0x11')](_0x1420('0xd'),_0x174ccf,_0x4cc945[_0x1420('0x11')][_0x1420('0x12')]);return _0x5c6211(_0x4cc945['error'][_0x1420('0x12')]);}else{logger[_0x1420('0xc')](_0x1420('0xd'),_0x174ccf,_0x1420('0xe'));_0x5c6211(_0x4cc945[_0x1420('0x13')]['message']);}})[_0x1420('0x14')](function(_0x901a0a){logger['error'](_0x1420('0xd'),_0x174ccf,_0x901a0a);_0xf9d2f6(_0x901a0a);});});}exports[_0x1420('0x15')]=function(_0x3f85cb){var _0x3ff1b7=this;return new Promise(function(_0x5634ab,_0x41701e){return db[_0x1420('0x16')][_0x1420('0x17')](_0x3f85cb[_0x1420('0x18')],{'raw':_0x3f85cb[_0x1420('0x19')]?_0x3f85cb[_0x1420('0x19')][_0x1420('0x1a')]===undefined?!![]:![]:!![]})[_0x1420('0x1b')](function(_0x255cef){logger['info']('CreateChatQueueReport',_0x3f85cb);logger[_0x1420('0xf')](_0x1420('0x15'),_0x3f85cb,JSON[_0x1420('0x1c')](_0x255cef));_0x5634ab(_0x255cef);})[_0x1420('0x14')](function(_0x59340f){logger['error'](_0x1420('0x15'),_0x59340f[_0x1420('0x12')],_0x3f85cb);_0x41701e(_0x3ff1b7[_0x1420('0x11')](0x1f4,_0x59340f[_0x1420('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x2d0430){var _0xc75d2=this;return new Promise(function(_0x6300ca,_0x1fddd4){return db[_0x1420('0x16')]['update'](_0x2d0430['body'],{'raw':_0x2d0430[_0x1420('0x19')]?_0x2d0430[_0x1420('0x19')][_0x1420('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0430[_0x1420('0x19')]?_0x2d0430[_0x1420('0x19')][_0x1420('0x1d')]||null:null,'attributes':_0x2d0430[_0x1420('0x19')]?_0x2d0430[_0x1420('0x19')][_0x1420('0x1e')]||null:null,'limit':_0x2d0430['options']?_0x2d0430[_0x1420('0x19')][_0x1420('0x1f')]||null:null})[_0x1420('0x1b')](function(_0x2c2e90){logger[_0x1420('0xc')]('UpdateChatQueueReport',_0x2d0430);logger['debug'](_0x1420('0x20'),_0x2d0430,JSON[_0x1420('0x1c')](_0x2c2e90));_0x6300ca(_0x2c2e90);})[_0x1420('0x14')](function(_0x2d2fcb){logger['error'](_0x1420('0x20'),_0x2d2fcb[_0x1420('0x12')],_0x2d0430);_0x1fddd4(_0xc75d2[_0x1420('0x11')](0x1f4,_0x2d2fcb[_0x1420('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 4490b49..79395ee 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 _0xd3fa=['/:id','show','put','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','isAuthenticated','index','describe','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3fa,0x1e6));var _0xad3f=function(_0x4e704f,_0x150701){_0x4e704f=_0x4e704f-0x0;var _0x4a77fd=_0xd3fa[_0x4e704f];return _0x4a77fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xad3f('0x0'));var timeout=require(_0xad3f('0x1'));var express=require('express');var router=express[_0xad3f('0x2')]();var fs_extra=require(_0xad3f('0x3'));var auth=require(_0xad3f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0xad3f('0x5')](),controller[_0xad3f('0x6')]);router['get']('/describe',auth[_0xad3f('0x5')](),controller[_0xad3f('0x7')]);router[_0xad3f('0x8')](_0xad3f('0x9'),auth[_0xad3f('0x5')](),controller[_0xad3f('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xad3f('0xb')](_0xad3f('0x9'),auth[_0xad3f('0x5')](),controller[_0xad3f('0xc')]);router[_0xad3f('0xd')](_0xad3f('0x9'),auth[_0xad3f('0x5')](),controller[_0xad3f('0xe')]);module['exports']=router; \ No newline at end of file +var _0x04e4=['describe','show','post','create','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x3cc69c,_0x534406){var _0x15be76=function(_0x36beb8){while(--_0x36beb8){_0x3cc69c['push'](_0x3cc69c['shift']());}};_0x15be76(++_0x534406);}(_0x04e4,0x103));var _0x404e=function(_0x18a68e,_0x29f1f0){_0x18a68e=_0x18a68e-0x0;var _0x2e6aee=_0x04e4[_0x18a68e];return _0x2e6aee;};'use strict';var multer=require(_0x404e('0x0'));var util=require(_0x404e('0x1'));var path=require(_0x404e('0x2'));var timeout=require(_0x404e('0x3'));var express=require(_0x404e('0x4'));var router=express['Router']();var fs_extra=require(_0x404e('0x5'));var auth=require(_0x404e('0x6'));var interaction=require(_0x404e('0x7'));var config=require(_0x404e('0x8'));var controller=require(_0x404e('0x9'));router[_0x404e('0xa')]('/',auth['isAuthenticated'](),controller[_0x404e('0xb')]);router[_0x404e('0xa')](_0x404e('0xc'),auth[_0x404e('0xd')](),controller[_0x404e('0xe')]);router[_0x404e('0xa')]('/:id',auth[_0x404e('0xd')](),controller[_0x404e('0xf')]);router[_0x404e('0x10')]('/',auth[_0x404e('0xd')](),controller[_0x404e('0x11')]);router['put'](_0x404e('0x12'),auth[_0x404e('0xd')](),controller['update']);router['delete'](_0x404e('0x12'),auth[_0x404e('0xd')](),controller[_0x404e('0x13')]);module[_0x404e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 4e976c3..2e11a1f 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(_0x5222d8,_0x5ce15e){var _0x396790=function(_0x261a29){while(--_0x261a29){_0x5222d8['push'](_0x5222d8['shift']());}};_0x396790(++_0x5ce15e);}(_0x70e0,0x17b));var _0x070e=function(_0x11449d,_0x324476){_0x11449d=_0x11449d-0x0;var _0x391300=_0x70e0[_0x11449d];return _0x391300;};'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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x45fda1,_0x1a96d0){var _0x4d0df8=function(_0x395a74){while(--_0x395a74){_0x45fda1['push'](_0x45fda1['shift']());}};_0x4d0df8(++_0x1a96d0);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0xf3cd[_0x415603];return _0x131e72;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2118fcd..c2e526a 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 _0x9c1b=['name','map','rawAttributes','type','key','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ChatTransferReport','include','findAll','rows','catch','show','model','length','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack'];(function(_0x2f23c6,_0x8eacbc){var _0x12e26a=function(_0x2b2b4b){while(--_0x2b2b4b){_0x2f23c6['push'](_0x2f23c6['shift']());}};_0x12e26a(++_0x8eacbc);}(_0x9c1b,0x68));var _0xb9c1=function(_0x20b8b6,_0x29a14c){_0x20b8b6=_0x20b8b6-0x0;var _0x22c341=_0x9c1b[_0x20b8b6];return _0x22c341;};'use strict';var emlformat=require(_0xb9c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9c1('0x1'));var jsonpatch=require(_0xb9c1('0x2'));var rp=require('request-promise');var moment=require(_0xb9c1('0x3'));var BPromise=require(_0xb9c1('0x4'));var Mustache=require('mustache');var util=require(_0xb9c1('0x5'));var path=require(_0xb9c1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb9c1('0x7'));var fs=require('fs');var fs_extra=require(_0xb9c1('0x8'));var _=require('lodash');var squel=require(_0xb9c1('0x9'));var crypto=require(_0xb9c1('0xa'));var jsforce=require(_0xb9c1('0xb'));var deskjs=require(_0xb9c1('0xc'));var toCsv=require(_0xb9c1('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9c1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb9c1('0xf'));var as=require(_0xb9c1('0x10'));var hardwareService=require(_0xb9c1('0x11'));var logger=require(_0xb9c1('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb9c1('0x13'));var db=require(_0xb9c1('0x14'))['db'];function respondWithStatusCode(_0x3593bb,_0x53a29a){_0x53a29a=_0x53a29a||0xcc;return function(_0x4cc3ef){if(_0x4cc3ef){return _0x3593bb[_0xb9c1('0x15')](_0x53a29a);}return _0x3593bb['status'](_0x53a29a)['end']();};}function respondWithResult(_0x32f584,_0x29e868){_0x29e868=_0x29e868||0xc8;return function(_0x1e1c59){if(_0x1e1c59){return _0x32f584[_0xb9c1('0x16')](_0x29e868)['json'](_0x1e1c59);}};}function respondWithFilteredResult(_0x541e04,_0x508a66){return function(_0x383d0f){if(_0x383d0f){var _0x42a6e3=typeof _0x508a66['offset']==='undefined'&&typeof _0x508a66[_0xb9c1('0x17')]==='undefined';var _0x34a008=_0x383d0f[_0xb9c1('0x18')];var _0x4ec4cf=_0x42a6e3?0x0:_0x508a66['offset'];var _0x68e768=_0x42a6e3?_0x383d0f[_0xb9c1('0x18')]:_0x508a66[_0xb9c1('0x19')]+_0x508a66[_0xb9c1('0x17')];var _0x4953d3;if(_0x68e768>=_0x34a008){_0x68e768=_0x34a008;_0x4953d3=0xc8;}else{_0x4953d3=0xce;}_0x541e04[_0xb9c1('0x16')](_0x4953d3);return _0x541e04[_0xb9c1('0x1a')](_0xb9c1('0x1b'),_0x4ec4cf+'-'+_0x68e768+'/'+_0x34a008)[_0xb9c1('0x1c')](_0x383d0f);}return null;};}function patchUpdates(_0x1a6ccd){return function(_0x10b172){try{jsonpatch[_0xb9c1('0x1d')](_0x10b172,_0x1a6ccd,!![]);}catch(_0x1e6655){return BPromise[_0xb9c1('0x1e')](_0x1e6655);}return _0x10b172[_0xb9c1('0x1f')]();};}function saveUpdates(_0xcef375,_0x13f2ef){return function(_0x58918c){if(_0x58918c){return _0x58918c[_0xb9c1('0x20')](_0xcef375)[_0xb9c1('0x21')](function(_0x396c8e){return _0x396c8e;});}return null;};}function removeEntity(_0x2b9064,_0x3d5548){return function(_0x2efb25){if(_0x2efb25){return _0x2efb25[_0xb9c1('0x22')]()[_0xb9c1('0x21')](function(){_0x2b9064[_0xb9c1('0x16')](0xcc)[_0xb9c1('0x23')]();});}};}function handleEntityNotFound(_0x6dcc0a,_0x4231dd){return function(_0x3bdc8c){if(!_0x3bdc8c){_0x6dcc0a[_0xb9c1('0x15')](0x194);}return _0x3bdc8c;};}function handleError(_0x479e7c,_0x4cd8d5){_0x4cd8d5=_0x4cd8d5||0x1f4;return function(_0xbd56d6){logger[_0xb9c1('0x24')](_0xbd56d6[_0xb9c1('0x25')]);if(_0xbd56d6[_0xb9c1('0x26')]){delete _0xbd56d6[_0xb9c1('0x26')];}_0x479e7c['status'](_0x4cd8d5)['send'](_0xbd56d6);};}exports['index']=function(_0x2f5fed,_0x1b06c4){var _0x4dfcf1={},_0x12baed={},_0x3eea8f={'count':0x0,'rows':[]};var _0x445d07=_[_0xb9c1('0x27')](db['ChatTransferReport'][_0xb9c1('0x28')],function(_0x3cdf53){return{'name':_0x3cdf53['fieldName'],'type':_0x3cdf53[_0xb9c1('0x29')][_0xb9c1('0x2a')]};});_0x12baed['model']=_[_0xb9c1('0x27')](_0x445d07,'name');_0x12baed[_0xb9c1('0x2b')]=_[_0xb9c1('0x2c')](_0x2f5fed[_0xb9c1('0x2b')]);_0x12baed[_0xb9c1('0x2d')]=_['intersection'](_0x12baed['model'],_0x12baed[_0xb9c1('0x2b')]);_0x4dfcf1[_0xb9c1('0x2e')]=_[_0xb9c1('0x2f')](_0x12baed['model'],qs[_0xb9c1('0x30')](_0x2f5fed[_0xb9c1('0x2b')]['fields']));_0x4dfcf1[_0xb9c1('0x2e')]=_0x4dfcf1[_0xb9c1('0x2e')]['length']?_0x4dfcf1[_0xb9c1('0x2e')]:_0x12baed['model'];if(!_0x2f5fed[_0xb9c1('0x2b')][_0xb9c1('0x31')](_0xb9c1('0x32'))){_0x4dfcf1[_0xb9c1('0x17')]=qs[_0xb9c1('0x17')](_0x2f5fed[_0xb9c1('0x2b')][_0xb9c1('0x17')]);_0x4dfcf1[_0xb9c1('0x19')]=qs[_0xb9c1('0x19')](_0x2f5fed['query'][_0xb9c1('0x19')]);}_0x4dfcf1[_0xb9c1('0x33')]=qs[_0xb9c1('0x34')](_0x2f5fed[_0xb9c1('0x2b')]['sort']);_0x4dfcf1[_0xb9c1('0x35')]=qs[_0xb9c1('0x2d')](_['pick'](_0x2f5fed[_0xb9c1('0x2b')],_0x12baed[_0xb9c1('0x2d')]),_0x445d07);if(_0x2f5fed[_0xb9c1('0x2b')][_0xb9c1('0x36')]){_0x4dfcf1[_0xb9c1('0x35')]=_[_0xb9c1('0x37')](_0x4dfcf1[_0xb9c1('0x35')],{'$or':_[_0xb9c1('0x27')](_0x445d07,function(_0x3592af){if(_0x3592af['type']!==_0xb9c1('0x38')){var _0x544487={};_0x544487[_0x3592af[_0xb9c1('0x26')]]={'$like':'%'+_0x2f5fed[_0xb9c1('0x2b')][_0xb9c1('0x36')]+'%'};return _0x544487;}})});}_0x4dfcf1=_[_0xb9c1('0x37')]({},_0x4dfcf1,_0x2f5fed[_0xb9c1('0x39')]);var _0x5c157a={'where':_0x4dfcf1[_0xb9c1('0x35')]};return db[_0xb9c1('0x3a')][_0xb9c1('0x18')](_0x5c157a)['then'](function(_0x832dc0){_0x3eea8f['count']=_0x832dc0;if(_0x2f5fed['query']['includeAll']){_0x4dfcf1[_0xb9c1('0x3b')]=[{'all':!![]}];}return db[_0xb9c1('0x3a')][_0xb9c1('0x3c')](_0x4dfcf1);})[_0xb9c1('0x21')](function(_0x246f80){_0x3eea8f[_0xb9c1('0x3d')]=_0x246f80;return _0x3eea8f;})[_0xb9c1('0x21')](respondWithFilteredResult(_0x1b06c4,_0x4dfcf1))[_0xb9c1('0x3e')](handleError(_0x1b06c4,null));};exports[_0xb9c1('0x3f')]=function(_0x56ab15,_0x16fc10){var _0x362692={'raw':!![],'where':{'id':_0x56ab15['params']['id']}},_0x1565d9={};_0x1565d9[_0xb9c1('0x40')]=_[_0xb9c1('0x2c')](db[_0xb9c1('0x3a')]['rawAttributes']);_0x1565d9[_0xb9c1('0x2b')]=_[_0xb9c1('0x2c')](_0x56ab15['query']);_0x1565d9[_0xb9c1('0x2d')]=_[_0xb9c1('0x2f')](_0x1565d9[_0xb9c1('0x40')],_0x1565d9[_0xb9c1('0x2b')]);_0x362692[_0xb9c1('0x2e')]=_[_0xb9c1('0x2f')](_0x1565d9[_0xb9c1('0x40')],qs[_0xb9c1('0x30')](_0x56ab15['query'][_0xb9c1('0x30')]));_0x362692[_0xb9c1('0x2e')]=_0x362692['attributes'][_0xb9c1('0x41')]?_0x362692[_0xb9c1('0x2e')]:_0x1565d9[_0xb9c1('0x40')];if(_0x56ab15[_0xb9c1('0x2b')]['includeAll']){_0x362692[_0xb9c1('0x3b')]=[{'all':!![]}];}_0x362692=_[_0xb9c1('0x37')]({},_0x362692,_0x56ab15['options']);return db['ChatTransferReport'][_0xb9c1('0x42')](_0x362692)[_0xb9c1('0x21')](handleEntityNotFound(_0x16fc10,null))[_0xb9c1('0x21')](respondWithResult(_0x16fc10,null))[_0xb9c1('0x3e')](handleError(_0x16fc10,null));};exports[_0xb9c1('0x43')]=function(_0x2aa4b9,_0x2ac9a8){return db[_0xb9c1('0x3a')][_0xb9c1('0x43')](_0x2aa4b9[_0xb9c1('0x44')],{})['then'](respondWithResult(_0x2ac9a8,0xc9))[_0xb9c1('0x3e')](handleError(_0x2ac9a8,null));};exports[_0xb9c1('0x20')]=function(_0x381ea1,_0x1cb057){if(_0x381ea1[_0xb9c1('0x44')]['id']){delete _0x381ea1[_0xb9c1('0x44')]['id'];}return db[_0xb9c1('0x3a')][_0xb9c1('0x42')]({'where':{'id':_0x381ea1['params']['id']}})[_0xb9c1('0x21')](handleEntityNotFound(_0x1cb057,null))[_0xb9c1('0x21')](saveUpdates(_0x381ea1[_0xb9c1('0x44')],null))['then'](respondWithResult(_0x1cb057,null))['catch'](handleError(_0x1cb057,null));};exports[_0xb9c1('0x22')]=function(_0x10511f,_0x5c4918){return db[_0xb9c1('0x3a')][_0xb9c1('0x42')]({'where':{'id':_0x10511f[_0xb9c1('0x45')]['id']}})[_0xb9c1('0x21')](handleEntityNotFound(_0x5c4918,null))[_0xb9c1('0x21')](removeEntity(_0x5c4918,null))[_0xb9c1('0x3e')](handleError(_0x5c4918,null));};exports[_0xb9c1('0x46')]=function(_0x2f98ff,_0x449edc){return db[_0xb9c1('0x3a')][_0xb9c1('0x46')]()[_0xb9c1('0x21')](respondWithResult(_0x449edc,null))['catch'](handleError(_0x449edc,null));}; \ No newline at end of file +var _0x2f56=['update','then','end','error','stack','name','index','ChatTransferReport','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','fields','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save'];(function(_0x53076d,_0x3170a4){var _0xabdd81=function(_0xfb1ce3){while(--_0xfb1ce3){_0x53076d['push'](_0x53076d['shift']());}};_0xabdd81(++_0x3170a4);}(_0x2f56,0xbe));var _0x62f5=function(_0x29fee8,_0x22ef76){_0x29fee8=_0x29fee8-0x0;var _0x3e4e97=_0x2f56[_0x29fee8];return _0x3e4e97;};'use strict';var emlformat=require(_0x62f5('0x0'));var rimraf=require(_0x62f5('0x1'));var zipdir=require(_0x62f5('0x2'));var jsonpatch=require(_0x62f5('0x3'));var rp=require(_0x62f5('0x4'));var moment=require(_0x62f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x62f5('0x6'));var util=require(_0x62f5('0x7'));var path=require('path');var sox=require(_0x62f5('0x8'));var csv=require(_0x62f5('0x9'));var ejs=require(_0x62f5('0xa'));var fs=require('fs');var fs_extra=require(_0x62f5('0xb'));var _=require(_0x62f5('0xc'));var squel=require(_0x62f5('0xd'));var crypto=require(_0x62f5('0xe'));var jsforce=require(_0x62f5('0xf'));var deskjs=require(_0x62f5('0x10'));var toCsv=require(_0x62f5('0x9'));var querystring=require(_0x62f5('0x11'));var Papa=require(_0x62f5('0x12'));var Redis=require(_0x62f5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x62f5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62f5('0x15'));var logger=require(_0x62f5('0x16'))(_0x62f5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41601d,_0x290854){_0x290854=_0x290854||0xcc;return function(_0x59ccf1){if(_0x59ccf1){return _0x41601d[_0x62f5('0x18')](_0x290854);}return _0x41601d[_0x62f5('0x19')](_0x290854)['end']();};}function respondWithResult(_0x5f0869,_0x247730){_0x247730=_0x247730||0xc8;return function(_0x4f2a65){if(_0x4f2a65){return _0x5f0869[_0x62f5('0x19')](_0x247730)[_0x62f5('0x1a')](_0x4f2a65);}};}function respondWithFilteredResult(_0x491936,_0x6710db){return function(_0x33b128){if(_0x33b128){var _0x5cbc7b=typeof _0x6710db[_0x62f5('0x1b')]==='undefined'&&typeof _0x6710db[_0x62f5('0x1c')]===_0x62f5('0x1d');var _0x28d7f6=_0x33b128[_0x62f5('0x1e')];var _0x2fc202=_0x5cbc7b?0x0:_0x6710db[_0x62f5('0x1b')];var _0x3b5f9d=_0x5cbc7b?_0x33b128[_0x62f5('0x1e')]:_0x6710db[_0x62f5('0x1b')]+_0x6710db[_0x62f5('0x1c')];var _0x4c179b;if(_0x3b5f9d>=_0x28d7f6){_0x3b5f9d=_0x28d7f6;_0x4c179b=0xc8;}else{_0x4c179b=0xce;}_0x491936['status'](_0x4c179b);return _0x491936[_0x62f5('0x1f')](_0x62f5('0x20'),_0x2fc202+'-'+_0x3b5f9d+'/'+_0x28d7f6)[_0x62f5('0x1a')](_0x33b128);}return null;};}function patchUpdates(_0x162d81){return function(_0x4fec27){try{jsonpatch[_0x62f5('0x21')](_0x4fec27,_0x162d81,!![]);}catch(_0x62c99b){return BPromise['reject'](_0x62c99b);}return _0x4fec27[_0x62f5('0x22')]();};}function saveUpdates(_0x47e853,_0x37ea8d){return function(_0x4894b1){if(_0x4894b1){return _0x4894b1[_0x62f5('0x23')](_0x47e853)[_0x62f5('0x24')](function(_0x502052){return _0x502052;});}return null;};}function removeEntity(_0x33164e,_0x2bd9a6){return function(_0x4102a9){if(_0x4102a9){return _0x4102a9['destroy']()[_0x62f5('0x24')](function(){_0x33164e['status'](0xcc)[_0x62f5('0x25')]();});}};}function handleEntityNotFound(_0x5925f1,_0x12e48c){return function(_0x4972c1){if(!_0x4972c1){_0x5925f1[_0x62f5('0x18')](0x194);}return _0x4972c1;};}function handleError(_0x3948ee,_0x4515a1){_0x4515a1=_0x4515a1||0x1f4;return function(_0x2cbba9){logger[_0x62f5('0x26')](_0x2cbba9[_0x62f5('0x27')]);if(_0x2cbba9[_0x62f5('0x28')]){delete _0x2cbba9['name'];}_0x3948ee[_0x62f5('0x19')](_0x4515a1)['send'](_0x2cbba9);};}exports[_0x62f5('0x29')]=function(_0x2fa09e,_0x277df9){var _0x4490a8={},_0x458a99={},_0x4fc66b={'count':0x0,'rows':[]};var _0x3fe19d=_['map'](db[_0x62f5('0x2a')][_0x62f5('0x2b')],function(_0x5bd8fa){return{'name':_0x5bd8fa[_0x62f5('0x2c')],'type':_0x5bd8fa['type'][_0x62f5('0x2d')]};});_0x458a99['model']=_[_0x62f5('0x2e')](_0x3fe19d,_0x62f5('0x28'));_0x458a99['query']=_[_0x62f5('0x2f')](_0x2fa09e[_0x62f5('0x30')]);_0x458a99[_0x62f5('0x31')]=_[_0x62f5('0x32')](_0x458a99[_0x62f5('0x33')],_0x458a99['query']);_0x4490a8[_0x62f5('0x34')]=_[_0x62f5('0x32')](_0x458a99['model'],qs['fields'](_0x2fa09e[_0x62f5('0x30')]['fields']));_0x4490a8['attributes']=_0x4490a8['attributes'][_0x62f5('0x35')]?_0x4490a8[_0x62f5('0x34')]:_0x458a99[_0x62f5('0x33')];if(!_0x2fa09e['query'][_0x62f5('0x36')](_0x62f5('0x37'))){_0x4490a8[_0x62f5('0x1c')]=qs['limit'](_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x1c')]);_0x4490a8[_0x62f5('0x1b')]=qs[_0x62f5('0x1b')](_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x1b')]);}_0x4490a8[_0x62f5('0x38')]=qs[_0x62f5('0x39')](_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x39')]);_0x4490a8[_0x62f5('0x3a')]=qs[_0x62f5('0x31')](_['pick'](_0x2fa09e[_0x62f5('0x30')],_0x458a99[_0x62f5('0x31')]),_0x3fe19d);if(_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x3b')]){_0x4490a8[_0x62f5('0x3a')]=_[_0x62f5('0x3c')](_0x4490a8[_0x62f5('0x3a')],{'$or':_[_0x62f5('0x2e')](_0x3fe19d,function(_0x81c593){if(_0x81c593[_0x62f5('0x3d')]!==_0x62f5('0x3e')){var _0x251468={};_0x251468[_0x81c593[_0x62f5('0x28')]]={'$like':'%'+_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x3b')]+'%'};return _0x251468;}})});}_0x4490a8=_['merge']({},_0x4490a8,_0x2fa09e[_0x62f5('0x3f')]);var _0x490171={'where':_0x4490a8['where']};return db[_0x62f5('0x2a')][_0x62f5('0x1e')](_0x490171)[_0x62f5('0x24')](function(_0x3c7486){_0x4fc66b[_0x62f5('0x1e')]=_0x3c7486;if(_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x40')]){_0x4490a8[_0x62f5('0x41')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x4490a8);})['then'](function(_0xecdda4){_0x4fc66b[_0x62f5('0x42')]=_0xecdda4;return _0x4fc66b;})[_0x62f5('0x24')](respondWithFilteredResult(_0x277df9,_0x4490a8))[_0x62f5('0x43')](handleError(_0x277df9,null));};exports[_0x62f5('0x44')]=function(_0x98804a,_0xb188fe){var _0x1e3c05={'raw':!![],'where':{'id':_0x98804a['params']['id']}},_0x1ef4ba={};_0x1ef4ba[_0x62f5('0x33')]=_[_0x62f5('0x2f')](db['ChatTransferReport'][_0x62f5('0x2b')]);_0x1ef4ba[_0x62f5('0x30')]=_[_0x62f5('0x2f')](_0x98804a[_0x62f5('0x30')]);_0x1ef4ba['filters']=_[_0x62f5('0x32')](_0x1ef4ba[_0x62f5('0x33')],_0x1ef4ba[_0x62f5('0x30')]);_0x1e3c05[_0x62f5('0x34')]=_[_0x62f5('0x32')](_0x1ef4ba[_0x62f5('0x33')],qs[_0x62f5('0x45')](_0x98804a[_0x62f5('0x30')]['fields']));_0x1e3c05[_0x62f5('0x34')]=_0x1e3c05['attributes'][_0x62f5('0x35')]?_0x1e3c05[_0x62f5('0x34')]:_0x1ef4ba[_0x62f5('0x33')];if(_0x98804a[_0x62f5('0x30')]['includeAll']){_0x1e3c05['include']=[{'all':!![]}];}_0x1e3c05=_[_0x62f5('0x3c')]({},_0x1e3c05,_0x98804a[_0x62f5('0x3f')]);return db[_0x62f5('0x2a')]['find'](_0x1e3c05)[_0x62f5('0x24')](handleEntityNotFound(_0xb188fe,null))[_0x62f5('0x24')](respondWithResult(_0xb188fe,null))[_0x62f5('0x43')](handleError(_0xb188fe,null));};exports[_0x62f5('0x46')]=function(_0x45a800,_0x43539d){return db[_0x62f5('0x2a')][_0x62f5('0x46')](_0x45a800[_0x62f5('0x47')],{})[_0x62f5('0x24')](respondWithResult(_0x43539d,0xc9))[_0x62f5('0x43')](handleError(_0x43539d,null));};exports[_0x62f5('0x23')]=function(_0x43ccb5,_0x2d15fa){if(_0x43ccb5[_0x62f5('0x47')]['id']){delete _0x43ccb5['body']['id'];}return db[_0x62f5('0x2a')][_0x62f5('0x48')]({'where':{'id':_0x43ccb5['params']['id']}})['then'](handleEntityNotFound(_0x2d15fa,null))[_0x62f5('0x24')](saveUpdates(_0x43ccb5[_0x62f5('0x47')],null))['then'](respondWithResult(_0x2d15fa,null))[_0x62f5('0x43')](handleError(_0x2d15fa,null));};exports[_0x62f5('0x49')]=function(_0x4a77d5,_0x96d1b0){return db[_0x62f5('0x2a')][_0x62f5('0x48')]({'where':{'id':_0x4a77d5['params']['id']}})['then'](handleEntityNotFound(_0x96d1b0,null))[_0x62f5('0x24')](removeEntity(_0x96d1b0,null))[_0x62f5('0x43')](handleError(_0x96d1b0,null));};exports[_0x62f5('0x4a')]=function(_0x552c88,_0x5e19b2){return db[_0x62f5('0x2a')][_0x62f5('0x4a')]()[_0x62f5('0x24')](respondWithResult(_0x5e19b2,null))[_0x62f5('0x43')](handleError(_0x5e19b2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 250daf5..aa02e87 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 _0x75b8=['api','moment','path','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x399647,_0x154a5e){var _0x3f66a8=function(_0x4cd16b){while(--_0x4cd16b){_0x399647['push'](_0x399647['shift']());}};_0x3f66a8(++_0x154a5e);}(_0x75b8,0x8d));var _0x875b=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0x75b8[_0x152449];return _0x5b58b2;};'use strict';var _=require(_0x875b('0x0'));var util=require(_0x875b('0x1'));var logger=require('../../config/logger')(_0x875b('0x2'));var moment=require(_0x875b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x875b('0x4'));var rimraf=require('rimraf');var config=require(_0x875b('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0x875b('0x6')]=function(_0x160da6,_0x728b0b){return _0x160da6[_0x875b('0x7')](_0x875b('0x8'),attributes,{'tableName':_0x875b('0x9'),'paranoid':![],'indexes':[{'name':_0x875b('0xa'),'fields':[_0x875b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x681c=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','bluebird'];(function(_0x4e16fd,_0x28e642){var _0x258205=function(_0x62eec0){while(--_0x62eec0){_0x4e16fd['push'](_0x4e16fd['shift']());}};_0x258205(++_0x28e642);}(_0x681c,0x1c6));var _0xc681=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x681c[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0xc681('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc681('0x1'));var rp=require(_0xc681('0x2'));var fs=require('fs');var path=require(_0xc681('0x3'));var rimraf=require(_0xc681('0x4'));var config=require(_0xc681('0x5'));var attributes=require(_0xc681('0x6'));module[_0xc681('0x7')]=function(_0x1a16d6,_0x21c971){return _0x1a16d6[_0xc681('0x8')](_0xc681('0x9'),attributes,{'tableName':_0xc681('0xa'),'paranoid':![],'indexes':[{'name':_0xc681('0xb'),'fields':[_0xc681('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d7cfbd4..93d1a65 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 _0x5366=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird'];(function(_0x48d191,_0x3cb2a0){var _0x5a9cfa=function(_0x5519be){while(--_0x5519be){_0x48d191['push'](_0x48d191['shift']());}};_0x5a9cfa(++_0x3cb2a0);}(_0x5366,0x18d));var _0x6536=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x5366[_0x6a0266];return _0x309e00;};'use strict';var _=require(_0x6536('0x0'));var util=require(_0x6536('0x1'));var moment=require('moment');var BPromise=require(_0x6536('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6536('0x3'));var db=require(_0x6536('0x4'))['db'];var utils=require(_0x6536('0x5'));var logger=require(_0x6536('0x6'))(_0x6536('0x7'));var config=require(_0x6536('0x8'));var jayson=require(_0x6536('0x9'));var client=jayson['client'][_0x6536('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a56d0,_0x557ee7,_0x29346f){return new BPromise(function(_0x5b3647,_0x2ea2cf){return client['request'](_0x4a56d0,_0x29346f)[_0x6536('0xb')](function(_0x5b750f){logger[_0x6536('0xc')](_0x6536('0xd'),_0x557ee7,_0x6536('0xe'));logger['debug'](_0x6536('0xf'),_0x557ee7,_0x6536('0xe'),JSON[_0x6536('0x10')](_0x5b750f));if(_0x5b750f['error']){if(_0x5b750f[_0x6536('0x11')][_0x6536('0x12')]===0x1f4){logger[_0x6536('0x11')](_0x6536('0xd'),_0x557ee7,_0x5b750f[_0x6536('0x11')][_0x6536('0x13')]);return _0x2ea2cf(_0x5b750f['error']['message']);}logger[_0x6536('0x11')](_0x6536('0xd'),_0x557ee7,_0x5b750f[_0x6536('0x11')][_0x6536('0x13')]);return _0x5b3647(_0x5b750f[_0x6536('0x11')]['message']);}else{logger[_0x6536('0xc')](_0x6536('0xd'),_0x557ee7,'request\x20sent');_0x5b3647(_0x5b750f['result']['message']);}})['catch'](function(_0xf2f4f7){logger['error'](_0x6536('0xd'),_0x557ee7,_0xf2f4f7);_0x2ea2cf(_0xf2f4f7);});});} \ No newline at end of file +var _0xb9e6=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x57e1b2,_0x4d7a48){var _0x5218b7=function(_0x54fcd3){while(--_0x54fcd3){_0x57e1b2['push'](_0x57e1b2['shift']());}};_0x5218b7(++_0x4d7a48);}(_0xb9e6,0xf8));var _0x6b9e=function(_0x5ef455,_0x3cf7d5){_0x5ef455=_0x5ef455-0x0;var _0x1b788d=_0xb9e6[_0x5ef455];return _0x1b788d;};'use strict';var _=require('lodash');var util=require(_0x6b9e('0x0'));var moment=require(_0x6b9e('0x1'));var BPromise=require(_0x6b9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b9e('0x3'));var db=require(_0x6b9e('0x4'))['db'];var utils=require(_0x6b9e('0x5'));var logger=require(_0x6b9e('0x6'))(_0x6b9e('0x7'));var config=require(_0x6b9e('0x8'));var jayson=require(_0x6b9e('0x9'));var client=jayson['client'][_0x6b9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25d678,_0x2a35d9,_0x3f6685){return new BPromise(function(_0xfdc84d,_0x939637){return client[_0x6b9e('0xb')](_0x25d678,_0x3f6685)['then'](function(_0x25e252){logger[_0x6b9e('0xc')](_0x6b9e('0xd'),_0x2a35d9,_0x6b9e('0xe'));logger[_0x6b9e('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2a35d9,_0x6b9e('0xe'),JSON['stringify'](_0x25e252));if(_0x25e252['error']){if(_0x25e252[_0x6b9e('0x10')][_0x6b9e('0x11')]===0x1f4){logger[_0x6b9e('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x2a35d9,_0x25e252[_0x6b9e('0x10')][_0x6b9e('0x12')]);return _0x939637(_0x25e252['error']['message']);}logger['error'](_0x6b9e('0xd'),_0x2a35d9,_0x25e252[_0x6b9e('0x10')][_0x6b9e('0x12')]);return _0xfdc84d(_0x25e252[_0x6b9e('0x10')][_0x6b9e('0x12')]);}else{logger[_0x6b9e('0xc')](_0x6b9e('0xd'),_0x2a35d9,_0x6b9e('0xe'));_0xfdc84d(_0x25e252[_0x6b9e('0x13')][_0x6b9e('0x12')]);}})[_0x6b9e('0x14')](function(_0x35ce22){logger[_0x6b9e('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x2a35d9,_0x35ce22);_0x939637(_0x35ce22);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 8419120..c49fda1 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 _0x262e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','exports','multer','path'];(function(_0x37c525,_0x18aeb1){var _0xc52249=function(_0x17196e){while(--_0x17196e){_0x37c525['push'](_0x37c525['shift']());}};_0xc52249(++_0x18aeb1);}(_0x262e,0x1f2));var _0xe262=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x262e[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xe262('0x0'));var util=require('util');var path=require(_0xe262('0x1'));var timeout=require(_0xe262('0x2'));var express=require(_0xe262('0x3'));var router=express[_0xe262('0x4')]();var fs_extra=require(_0xe262('0x5'));var auth=require(_0xe262('0x6'));var interaction=require(_0xe262('0x7'));var config=require(_0xe262('0x8'));var controller=require('./chatTransferReport.controller');router[_0xe262('0x9')]('/',auth[_0xe262('0xa')](),controller['index']);router[_0xe262('0x9')](_0xe262('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe262('0x9')](_0xe262('0xc'),auth[_0xe262('0xa')](),controller[_0xe262('0xd')]);router[_0xe262('0xe')]('/',auth[_0xe262('0xa')](),controller[_0xe262('0xf')]);router[_0xe262('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe262('0x11')]);router[_0xe262('0x12')](_0xe262('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe262('0x13')]=router; \ No newline at end of file +var _0xb4c3=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c3,0x1e1));var _0x3b4c=function(_0x527c5f,_0x593d0d){_0x527c5f=_0x527c5f-0x0;var _0x38ae95=_0xb4c3[_0x527c5f];return _0x38ae95;};'use strict';var multer=require(_0x3b4c('0x0'));var util=require(_0x3b4c('0x1'));var path=require(_0x3b4c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b4c('0x3'));var router=express['Router']();var fs_extra=require(_0x3b4c('0x4'));var auth=require(_0x3b4c('0x5'));var interaction=require(_0x3b4c('0x6'));var config=require(_0x3b4c('0x7'));var controller=require(_0x3b4c('0x8'));router[_0x3b4c('0x9')]('/',auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xb')]);router[_0x3b4c('0x9')](_0x3b4c('0xc'),auth[_0x3b4c('0xa')](),controller['describe']);router[_0x3b4c('0x9')](_0x3b4c('0xd'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xe')]);router[_0x3b4c('0xf')]('/',auth[_0x3b4c('0xa')](),controller['create']);router[_0x3b4c('0x10')](_0x3b4c('0xd'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0x11')]);router['delete'](_0x3b4c('0xd'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0x12')]);module[_0x3b4c('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 7d88c75..cbfcbe6 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 _0x55e0=['CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right'];(function(_0x56568a,_0x25efcb){var _0x3eeb13=function(_0x2b6123){while(--_0x2b6123){_0x56568a['push'](_0x56568a['shift']());}};_0x3eeb13(++_0x25efcb);}(_0x55e0,0xdc));var _0x055e=function(_0x3eaae1,_0x1d200e){_0x3eaae1=_0x3eaae1-0x0;var _0x46bf2a=_0x55e0[_0x3eaae1];return _0x46bf2a;};'use strict';var Sequelize=require(_0x055e('0x0'));var rs=require(_0x055e('0x1'));module[_0x055e('0x2')]={'name':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x055e('0x3')]},'mapKey':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'mapKeyOffline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'key':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x055e('0x3')]},'animation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x055e('0x9')]('rounded','squared'),'defaultValue':_0x055e('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0xb')},'start_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xc')},'offline_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'header_offline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x055e('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x13')},'noteTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x14')},'placeholderMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x16')},'closingMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'skipMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x17')},'ratingType':{'type':Sequelize[_0x055e('0x9')](_0x055e('0x18'),_0x055e('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON[_0x055e('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x055e('0x1b'),'type':_0x055e('0x1c'),'required':!![]},'props':{'title':_0x055e('0x1b'),'helpText':''}},{'type':_0x055e('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x1f'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')](_0x055e('0x1f'))):{};},'set':function(_0x4c653c){return this['setDataValue'](_0x055e('0x1f'),JSON[_0x055e('0x1a')](_0x4c653c));}},'offlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x055e('0x1d'),'props':{'title':_0x055e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':_0x055e('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x055e('0x21')},'props':{'title':'Comments','helpText':_0x055e('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x23'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')]('offlineForm')):{};},'set':function(_0x99a372){return this[_0x055e('0x24')](_0x055e('0x23'),JSON[_0x055e('0x1a')](_0x99a372));}},'token':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return rs[_0x055e('0x25')]();}},'autoclose':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x055e('0x3')]},'forwardOffline':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x26')},'waitingMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x29')},'sendUnmanaged':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x055e('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x055e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return _0x055e('0x2a');}},'notificationSound':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2c')},'verticalAlignment':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2e')},'defaultTitle':{'type':Sequelize[_0x055e('0x3')]},'customerAvatar':{'type':Sequelize[_0x055e('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x30')},'systemAvatar':{'type':Sequelize[_0x055e('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x055e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1012a4){if(!_0x1012a4)this[_0x055e('0x24')](_0x055e('0x32'),null);this['setDataValue'](_0x055e('0x33'),_0x1012a4);}},'vidaooEscalation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x34')},'vidaooNote':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x055e('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x055e('0x10')]}}; \ No newline at end of file +var _0x0713=['offlineForm','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','thumb','star','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x3071('0x0')]={'name':{'type':Sequelize[_0x3071('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'unique':_0x3071('0x2')},'description':{'type':Sequelize[_0x3071('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x3')},'mapKeyOffline':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x3')},'key':{'type':Sequelize[_0x3071('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x4')},'customerAlias':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3071('0x1')]},'animation':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3071('0x9')]('rounded',_0x3071('0xa')),'defaultValue':_0x3071('0xb')},'header_online':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0xc')},'start_chat_button':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0xe')},'download_transcript':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3071('0xf')]},'closingQuestion':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x12')},'noteTitle':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x14')},'closingMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x15')},'closingMessageButton':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0xd')},'skipMessageButton':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x16')},'conditionAgreement':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x3071('0x9')]('star',_0x3071('0x17')),'defaultValue':_0x3071('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3071('0xf')],'defaultValue':function(){return JSON[_0x3071('0x19')]({'items':[{'type':_0x3071('0x1a'),'variable':null,'config':{'placeholder':_0x3071('0x1b'),'type':_0x3071('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0x3071('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x3071('0x3'),'type':_0x3071('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3071('0x1d')](_0x3071('0x1e'))?JSON[_0x3071('0x1f')](this[_0x3071('0x1d')](_0x3071('0x1e'))):{};},'set':function(_0x1de5fb){return this['setDataValue'](_0x3071('0x1e'),JSON[_0x3071('0x19')](_0x1de5fb));}},'offlineForm':{'type':Sequelize[_0x3071('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x3071('0x1a'),'props':{'title':_0x3071('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x3071('0x3'),'type':_0x3071('0x3')},'variable':null},{'type':_0x3071('0x20'),'config':{'placeholder':_0x3071('0x21')},'props':{'title':_0x3071('0x21'),'helpText':_0x3071('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x3071('0x1d')](_0x3071('0x23'))?JSON[_0x3071('0x1f')](this['getDataValue']('offlineForm')):{};},'set':function(_0x9e26d1){return this[_0x3071('0x24')](_0x3071('0x23'),JSON[_0x3071('0x19')](_0x9e26d1));}},'token':{'type':Sequelize[_0x3071('0x1')],'defaultValue':function(){return rs[_0x3071('0x25')]();}},'autoclose':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3071('0x1')]},'waitingTitle':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x29')},'skipUnmanaged':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x16')},'sendUnmanaged':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3071('0x1')]},'notificationTemplate':{'type':Sequelize[_0x3071('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3071('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2b')},'verticalAlignment':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2c')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2d')},'defaultTitle':{'type':Sequelize[_0x3071('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3071('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3071('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2f')},'systemAvatar':{'type':Sequelize[_0x3071('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3071('0x7')],'comment':_0x3071('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x53ed25){if(!_0x53ed25)this[_0x3071('0x24')](_0x3071('0x31'),null);this[_0x3071('0x24')](_0x3071('0x32'),_0x53ed25);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3071('0x1')]},'vidaooTopic':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x33')},'vidaooNote':{'type':Sequelize[_0x3071('0x1')],'defaultValue':function(){return _0x3071('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x3071('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3071('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6b3b196..8dd61c5 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 _0x122e=['CompanyId','ListId','from','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','List','DESC','account','Applications','list','priority','asc','contact','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','push','applications','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','files','offline-chat','openNewInteraction','sequelize','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','toPairsIn','Chat','MailAccountId','NotifyMailAccount','notifyMail','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Owner','fullname','internal','Tag','Tags','tag','Command','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','remote','x-real-ip','connection','remoteAddress','referer','virtual','replace','alignment','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','stack','finally','getApplications','chatProactiveAction','omit','getProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','fs-extra','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','sendStatus','offset','limit','undefined','count','status','set','Content-Range','json','update','destroy','get','UserProfileResource','end','name','send','Pause','ChatWebsite','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','options','includeAll','include','catch','params','mandatoryDispositionPause','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','hasOwnProperty','filter','findAll','removeDispositions','ids','addAnswer','ChatWebsiteId','CannedAnswer','getAnswers','rows','removeAnswers','addLogo','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','sitepic','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','getAvatar','isNil','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','server/files/images/avatars/system_avatar.png','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt'];(function(_0x631032,_0x5858ef){var _0x18cfc9=function(_0x340680){while(--_0x340680){_0x631032['push'](_0x631032['shift']());}};_0x18cfc9(++_0x5858ef);}(_0x122e,0xa6));var _0xe122=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x122e[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xe122('0x0'));var Mustache=require(_0xe122('0x1'));var util=require('util');var path=require(_0xe122('0x2'));var ejs=require(_0xe122('0x3'));var fs=require('fs');var fs_extra=require(_0xe122('0x4'));var _=require(_0xe122('0x5'));var querystring=require('querystring');var Redis=require('ioredis');var qs=require(_0xe122('0x6'));var logger=require(_0xe122('0x7'))(_0xe122('0x8'));var config=require(_0xe122('0x9'));var url=require(_0xe122('0xa'));var db=require(_0xe122('0xb'))['db'];config[_0xe122('0xc')]=_[_0xe122('0xd')](config[_0xe122('0xc')],{'host':_0xe122('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe122('0xc')]));require(_0xe122('0xf'))[_0xe122('0x10')](socket);var htmlToText=require(_0xe122('0x11'));var jayson=require(_0xe122('0x12'));var client=jayson[_0xe122('0x13')]['http']({'port':0x232c});var client9002=jayson[_0xe122('0x13')][_0xe122('0x14')]({'port':0x232a});var client9003=jayson['client'][_0xe122('0x14')]({'port':0x232b});var client9001=jayson[_0xe122('0x13')][_0xe122('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x54dd0a,_0x107275,_0x13b132,_0x342e1a){return new BPromise(function(_0x53ac86,_0x5b6eca){var _0x2f27d8=_0x342e1a||client;return _0x2f27d8['request'](_0x54dd0a,_0x13b132)[_0xe122('0x15')](function(_0x2e108c){logger[_0xe122('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x107275,_0xe122('0x17'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x107275,_0xe122('0x17'),JSON[_0xe122('0x18')](_0x2e108c));if(_0x2e108c[_0xe122('0x19')]){if(_0x2e108c['error'][_0xe122('0x1a')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x107275,_0x2e108c[_0xe122('0x19')][_0xe122('0x1b')]);return _0x5b6eca(_0x2e108c[_0xe122('0x19')][_0xe122('0x1b')]);}logger[_0xe122('0x19')](_0xe122('0x1c'),_0x107275,_0x2e108c[_0xe122('0x19')][_0xe122('0x1b')]);return _0x53ac86(_0x2e108c[_0xe122('0x19')][_0xe122('0x1b')]);}else{logger[_0xe122('0x16')](_0xe122('0x1c'),_0x107275,_0xe122('0x17'));_0x53ac86(_0x2e108c[_0xe122('0x1d')]['message']);}})['catch'](function(_0x3b1b94){logger[_0xe122('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x107275,_0x3b1b94);_0x5b6eca(_0x3b1b94);});});}function respondWithStatusCode(_0x1ce5b2,_0x50442b){_0x50442b=_0x50442b||0xcc;return function(_0x52fb3c){if(_0x52fb3c){return _0x1ce5b2[_0xe122('0x1e')](_0x50442b);}return _0x1ce5b2['status'](_0x50442b)['end']();};}function respondWithResult(_0x528286,_0x1a5dcd){_0x1a5dcd=_0x1a5dcd||0xc8;return function(_0x15b976){if(_0x15b976){return _0x528286['status'](_0x1a5dcd)['json'](_0x15b976);}};}function respondWithFilteredResult(_0x395e53,_0x3e8dd5){return function(_0x15b191){if(_0x15b191){var _0x17b034=typeof _0x3e8dd5[_0xe122('0x1f')]==='undefined'&&typeof _0x3e8dd5[_0xe122('0x20')]===_0xe122('0x21');var _0x32af81=_0x15b191[_0xe122('0x22')];var _0x3476a4=_0x17b034?0x0:_0x3e8dd5[_0xe122('0x1f')];var _0x305595=_0x17b034?_0x15b191['count']:_0x3e8dd5[_0xe122('0x1f')]+_0x3e8dd5[_0xe122('0x20')];var _0x5efbe0;if(_0x305595>=_0x32af81){_0x305595=_0x32af81;_0x5efbe0=0xc8;}else{_0x5efbe0=0xce;}_0x395e53[_0xe122('0x23')](_0x5efbe0);return _0x395e53[_0xe122('0x24')](_0xe122('0x25'),_0x3476a4+'-'+_0x305595+'/'+_0x32af81)[_0xe122('0x26')](_0x15b191);}return null;};}function saveUpdates(_0x1aa637){return function(_0x58864d){if(_0x58864d){return _0x58864d[_0xe122('0x27')](_0x1aa637)['then'](function(_0x49a215){return _0x49a215;});}return null;};}function removeEntity(_0x5d4bde){return function(_0x5c2ffd){if(_0x5c2ffd){return _0x5c2ffd[_0xe122('0x28')]()['then'](function(){var _0x3a0b6b=_0x5c2ffd[_0xe122('0x29')]({'plain':!![]});var _0x1a6107='ChatWebsites';return db[_0xe122('0x2a')][_0xe122('0x28')]({'where':{'type':_0x1a6107,'resourceId':_0x3a0b6b['id']}})[_0xe122('0x15')](function(){return _0x5c2ffd;});})[_0xe122('0x15')](function(){_0x5d4bde[_0xe122('0x23')](0xcc)[_0xe122('0x2b')]();});}};}function handleEntityNotFound(_0x28b3cf){return function(_0x56f28a){if(!_0x56f28a){_0x28b3cf[_0xe122('0x1e')](0x194);}return _0x56f28a;};}function handleError(_0x8b716c,_0x49d77c){_0x49d77c=_0x49d77c||0x1f4;return function(_0x241a48){logger[_0xe122('0x19')](_0x241a48['stack']);if(_0x241a48['name']){delete _0x241a48[_0xe122('0x2c')];}_0x8b716c['status'](_0x49d77c)[_0xe122('0x2d')](_0x241a48);};}exports['index']=function(_0x16bfca,_0x3fac5c){var _0x4600c2={'include':[{'model':db[_0xe122('0x2e')],'as':'mandatoryDispositionPause'}]},_0x66263={},_0x49a630={'count':0x0,'rows':[]};var _0x20393a=_['map'](db[_0xe122('0x2f')]['rawAttributes'],function(_0x495cc5){return{'name':_0x495cc5[_0xe122('0x30')],'type':_0x495cc5[_0xe122('0x31')][_0xe122('0x32')]};});_0x66263[_0xe122('0x33')]=_[_0xe122('0x34')](_0x20393a,_0xe122('0x2c'));_0x66263[_0xe122('0x35')]=_[_0xe122('0x36')](_0x16bfca[_0xe122('0x35')]);_0x66263['filters']=_[_0xe122('0x37')](_0x66263['model'],_0x66263[_0xe122('0x35')]);_0x4600c2[_0xe122('0x38')]=_[_0xe122('0x37')](_0x66263['model'],qs[_0xe122('0x39')](_0x16bfca[_0xe122('0x35')]['fields']));_0x4600c2[_0xe122('0x38')]=_0x4600c2[_0xe122('0x38')][_0xe122('0x3a')]?_0x4600c2['attributes']:_0x66263[_0xe122('0x33')];if(!_0x16bfca[_0xe122('0x35')]['hasOwnProperty'](_0xe122('0x3b'))){_0x4600c2[_0xe122('0x20')]=qs[_0xe122('0x20')](_0x16bfca[_0xe122('0x35')][_0xe122('0x20')]);_0x4600c2[_0xe122('0x1f')]=qs[_0xe122('0x1f')](_0x16bfca[_0xe122('0x35')][_0xe122('0x1f')]);}_0x4600c2[_0xe122('0x3c')]=qs[_0xe122('0x3d')](_0x16bfca[_0xe122('0x35')][_0xe122('0x3d')]);_0x4600c2['where']=qs[_0xe122('0x3e')](_[_0xe122('0x3f')](_0x16bfca[_0xe122('0x35')],_0x66263[_0xe122('0x3e')]),_0x20393a);if(_0x16bfca[_0xe122('0x35')]['filter']){_0x4600c2['where']=_[_0xe122('0x40')](_0x4600c2[_0xe122('0x41')],{'$or':_[_0xe122('0x34')](_0x20393a,function(_0x499ab0){if(_0x499ab0['type']!==_0xe122('0x42')){var _0x89f193={};_0x89f193[_0x499ab0[_0xe122('0x2c')]]={'$like':'%'+_0x16bfca['query']['filter']+'%'};return _0x89f193;}})});}_0x4600c2=_['merge']({},_0x4600c2,_0x16bfca[_0xe122('0x43')]);var _0x4397a3={'where':_0x4600c2[_0xe122('0x41')]};return db[_0xe122('0x2f')][_0xe122('0x22')](_0x4397a3)['then'](function(_0x370e7a){_0x49a630[_0xe122('0x22')]=_0x370e7a;if(_0x16bfca[_0xe122('0x35')][_0xe122('0x44')]){_0x4600c2[_0xe122('0x45')]=[{'all':!![]}];}return db[_0xe122('0x2f')]['findAll'](_0x4600c2);})[_0xe122('0x15')](function(_0x1d4d02){_0x49a630['rows']=_0x1d4d02;return _0x49a630;})['then'](respondWithFilteredResult(_0x3fac5c,_0x4600c2))[_0xe122('0x46')](handleError(_0x3fac5c,null));};exports['show']=function(_0x7fcf8f,_0x933220){var _0x379c07={'raw':![],'where':{'id':_0x7fcf8f[_0xe122('0x47')]['id']},'include':[{'model':db[_0xe122('0x2e')],'as':_0xe122('0x48')}]},_0x25d977={};_0x25d977[_0xe122('0x33')]=_[_0xe122('0x36')](db[_0xe122('0x2f')]['rawAttributes']);_0x25d977['query']=_[_0xe122('0x36')](_0x7fcf8f['query']);_0x25d977[_0xe122('0x3e')]=_[_0xe122('0x37')](_0x25d977['model'],_0x25d977['query']);_0x379c07[_0xe122('0x38')]=_['intersection'](_0x25d977[_0xe122('0x33')],qs['fields'](_0x7fcf8f[_0xe122('0x35')][_0xe122('0x39')]));_0x379c07['attributes']=_0x379c07[_0xe122('0x38')]['length']?_0x379c07[_0xe122('0x38')]:_0x25d977[_0xe122('0x33')];if(_0x7fcf8f[_0xe122('0x35')]['includeAll']){_0x379c07[_0xe122('0x45')]=[{'all':!![]}];}_0x379c07=_['merge']({},_0x379c07,_0x7fcf8f[_0xe122('0x43')]);return db[_0xe122('0x2f')]['find'](_0x379c07)['then'](handleEntityNotFound(_0x933220,null))[_0xe122('0x15')](respondWithResult(_0x933220,null))[_0xe122('0x46')](handleError(_0x933220,null));};exports['create']=function(_0x11f13c,_0x30922d){return db[_0xe122('0x2f')][_0xe122('0x49')](_0x11f13c[_0xe122('0x4a')],{})['then'](function(_0x301669){var _0x1f8651=_0x11f13c[_0xe122('0x4b')][_0xe122('0x29')]({'plain':!![]});if(!_0x1f8651)throw new Error(_0xe122('0x4c'));if(_0x1f8651[_0xe122('0x4d')]===_0xe122('0x4b')){var _0x423b81=_0x301669['get']({'plain':!![]});var _0x2c7f9c=_0xe122('0x4e');return db[_0xe122('0x4f')][_0xe122('0x50')]({'where':{'name':_0x2c7f9c,'userProfileId':_0x1f8651[_0xe122('0x51')]},'raw':!![]})[_0xe122('0x15')](function(_0x821967){if(_0x821967&&_0x821967['autoAssociation']===0x0){return db[_0xe122('0x2a')][_0xe122('0x49')]({'name':_0x423b81[_0xe122('0x2c')],'resourceId':_0x423b81['id'],'type':_0x821967[_0xe122('0x2c')],'sectionId':_0x821967['id']},{})['then'](function(){return _0x301669;});}else{return _0x301669;}})['catch'](function(_0x3edb38){logger['error'](_0xe122('0x52'),_0x3edb38);throw _0x3edb38;});}return _0x301669;})['then'](respondWithResult(_0x30922d,0xc9))[_0xe122('0x46')](handleError(_0x30922d,null));};exports[_0xe122('0x27')]=function(_0x29a9d5,_0x31439a){if(_0x29a9d5[_0xe122('0x4a')]['id']){delete _0x29a9d5[_0xe122('0x4a')]['id'];}return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x29a9d5[_0xe122('0x47')]['id']},'include':[{'model':db[_0xe122('0x2e')],'as':_0xe122('0x48')}]})[_0xe122('0x15')](handleEntityNotFound(_0x31439a,null))[_0xe122('0x15')](saveUpdates(_0x29a9d5[_0xe122('0x4a')],null))['then'](respondWithResult(_0x31439a,null))[_0xe122('0x46')](handleError(_0x31439a,null));};exports[_0xe122('0x28')]=function(_0x3ade12,_0x359741){return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x3ade12[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x359741,null))['then'](removeEntity(_0x359741,null))[_0xe122('0x46')](handleError(_0x359741,null));};exports[_0xe122('0x53')]=function(_0x4c2ed7,_0x14418a){return db[_0xe122('0x2f')][_0xe122('0x53')]()['then'](respondWithResult(_0x14418a,null))[_0xe122('0x46')](handleError(_0x14418a,null));};exports[_0xe122('0x54')]=function(_0x179024,_0x3ee762){if(_0x179024['body']['id']){delete _0x179024[_0xe122('0x4a')]['id'];}return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x179024[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x3ee762,null))[_0xe122('0x15')](function(_0x551bd8){if(_0x551bd8){_0x179024['body']['ChatWebsiteId']=_0x551bd8['id'];return db[_0xe122('0x55')][_0xe122('0x49')](_0x179024[_0xe122('0x4a')]);}})[_0xe122('0x15')](respondWithResult(_0x3ee762,null))[_0xe122('0x46')](handleError(_0x3ee762,null));};exports[_0xe122('0x56')]=function(_0x3be372,_0x6661aa){var _0x558b1={'raw':![],'where':{}};var _0x4b811a={};var _0x18d28f={'count':0x0,'rows':[]};return db[_0xe122('0x2f')][_0xe122('0x57')]({'where':{'id':_0x3be372[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x6661aa,null))['then'](function(_0x563abf){if(_0x563abf){_0x4b811a[_0xe122('0x33')]=_['keys'](db[_0xe122('0x55')][_0xe122('0x58')]);_0x4b811a[_0xe122('0x35')]=_[_0xe122('0x36')](_0x3be372['query']);_0x4b811a[_0xe122('0x3e')]=_[_0xe122('0x37')](_0x4b811a[_0xe122('0x33')],_0x4b811a[_0xe122('0x35')]);_0x558b1[_0xe122('0x38')]=_[_0xe122('0x37')](_0x4b811a['model'],qs['fields'](_0x3be372[_0xe122('0x35')][_0xe122('0x39')]));_0x558b1[_0xe122('0x38')]=_0x558b1[_0xe122('0x38')][_0xe122('0x3a')]?_0x558b1['attributes']:_0x4b811a[_0xe122('0x33')];if(!_0x3be372[_0xe122('0x35')][_0xe122('0x59')](_0xe122('0x3b'))){_0x558b1[_0xe122('0x20')]=qs['limit'](_0x3be372[_0xe122('0x35')][_0xe122('0x20')]);_0x558b1[_0xe122('0x1f')]=qs['offset'](_0x3be372['query'][_0xe122('0x1f')]);}_0x558b1[_0xe122('0x3c')]=qs[_0xe122('0x3d')](_0x3be372[_0xe122('0x35')][_0xe122('0x3d')]);_0x558b1['where']=qs[_0xe122('0x3e')](_[_0xe122('0x3f')](_0x3be372[_0xe122('0x35')],_0x4b811a[_0xe122('0x3e')]));_0x558b1['where']['ChatWebsiteId']=_0x563abf['id'];if(_0x3be372[_0xe122('0x35')][_0xe122('0x5a')]){_0x558b1[_0xe122('0x41')]=_['merge'](_0x558b1[_0xe122('0x41')],{'$or':_[_0xe122('0x34')](_0x558b1[_0xe122('0x38')],function(_0x2ad34e){var _0x202b50={};_0x202b50[_0x2ad34e]={'$like':'%'+_0x3be372['query'][_0xe122('0x5a')]+'%'};return _0x202b50;})});}_0x558b1=_[_0xe122('0x40')]({},_0x558b1,_0x3be372[_0xe122('0x43')]);return db['Disposition'][_0xe122('0x22')]({'where':_0x558b1[_0xe122('0x41')]})[_0xe122('0x15')](function(_0x5e25dc){_0x18d28f[_0xe122('0x22')]=_0x5e25dc;if(_0x3be372[_0xe122('0x35')]['includeAll']){_0x558b1[_0xe122('0x45')]=[{'all':!![]}];}return db['Disposition'][_0xe122('0x5b')](_0x558b1);})['then'](function(_0x3176e6){_0x18d28f['rows']=_0x3176e6;return _0x18d28f;});}})[_0xe122('0x15')](respondWithFilteredResult(_0x6661aa,_0x558b1))[_0xe122('0x46')](handleError(_0x6661aa,null));};exports[_0xe122('0x5c')]=function(_0x1a89f8,_0x36e959){return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x1a89f8[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x36e959,null))[_0xe122('0x15')](function(_0x5c068a){if(_0x5c068a){return _0x5c068a[_0xe122('0x5c')](_0x1a89f8[_0xe122('0x35')][_0xe122('0x5d')]);}})[_0xe122('0x15')](respondWithStatusCode(_0x36e959,null))[_0xe122('0x46')](handleError(_0x36e959,null));};exports[_0xe122('0x5e')]=function(_0x59dc95,_0x733959){if(_0x59dc95[_0xe122('0x4a')]['id']){delete _0x59dc95[_0xe122('0x4a')]['id'];}return db[_0xe122('0x2f')]['find']({'where':{'id':_0x59dc95[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x733959,null))[_0xe122('0x15')](function(_0x48e243){if(_0x48e243){_0x59dc95[_0xe122('0x4a')][_0xe122('0x5f')]=_0x48e243['id'];return db[_0xe122('0x60')][_0xe122('0x49')](_0x59dc95[_0xe122('0x4a')]);}})[_0xe122('0x15')](respondWithResult(_0x733959,null))[_0xe122('0x46')](handleError(_0x733959,null));};exports[_0xe122('0x61')]=function(_0x45994b,_0x1a6420){var _0x46590f={'raw':![],'where':{}};var _0x142a15={};var _0x5a4286={'count':0x0,'rows':[]};return db[_0xe122('0x2f')][_0xe122('0x57')]({'where':{'id':_0x45994b['params']['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x1a6420,null))[_0xe122('0x15')](function(_0x40ecb8){if(_0x40ecb8){_0x142a15[_0xe122('0x33')]=_[_0xe122('0x36')](db['CannedAnswer'][_0xe122('0x58')]);_0x142a15[_0xe122('0x35')]=_[_0xe122('0x36')](_0x45994b[_0xe122('0x35')]);_0x142a15[_0xe122('0x3e')]=_[_0xe122('0x37')](_0x142a15[_0xe122('0x33')],_0x142a15[_0xe122('0x35')]);_0x46590f[_0xe122('0x38')]=_[_0xe122('0x37')](_0x142a15['model'],qs['fields'](_0x45994b[_0xe122('0x35')]['fields']));_0x46590f[_0xe122('0x38')]=_0x46590f[_0xe122('0x38')][_0xe122('0x3a')]?_0x46590f[_0xe122('0x38')]:_0x142a15[_0xe122('0x33')];if(!_0x45994b[_0xe122('0x35')][_0xe122('0x59')](_0xe122('0x3b'))){_0x46590f['limit']=qs[_0xe122('0x20')](_0x45994b[_0xe122('0x35')][_0xe122('0x20')]);_0x46590f['offset']=qs['offset'](_0x45994b[_0xe122('0x35')][_0xe122('0x1f')]);}_0x46590f[_0xe122('0x3c')]=qs[_0xe122('0x3d')](_0x45994b[_0xe122('0x35')]['sort']);_0x46590f[_0xe122('0x41')]=qs['filters'](_[_0xe122('0x3f')](_0x45994b[_0xe122('0x35')],_0x142a15[_0xe122('0x3e')]));_0x46590f[_0xe122('0x41')][_0xe122('0x5f')]=_0x40ecb8['id'];if(_0x45994b[_0xe122('0x35')][_0xe122('0x5a')]){_0x46590f[_0xe122('0x41')]=_[_0xe122('0x40')](_0x46590f[_0xe122('0x41')],{'$or':_[_0xe122('0x34')](_0x46590f[_0xe122('0x38')],function(_0x5c1aac){var _0x324c9f={};_0x324c9f[_0x5c1aac]={'$like':'%'+_0x45994b[_0xe122('0x35')]['filter']+'%'};return _0x324c9f;})});}_0x46590f=_['merge']({},_0x46590f,_0x45994b[_0xe122('0x43')]);return db[_0xe122('0x60')][_0xe122('0x22')]({'where':_0x46590f[_0xe122('0x41')]})[_0xe122('0x15')](function(_0x496ba3){_0x5a4286[_0xe122('0x22')]=_0x496ba3;if(_0x45994b[_0xe122('0x35')][_0xe122('0x44')]){_0x46590f[_0xe122('0x45')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x46590f);})[_0xe122('0x15')](function(_0xbcd2a0){_0x5a4286[_0xe122('0x62')]=_0xbcd2a0;return _0x5a4286;});}})[_0xe122('0x15')](respondWithFilteredResult(_0x1a6420,_0x46590f))[_0xe122('0x46')](handleError(_0x1a6420,null));};exports[_0xe122('0x63')]=function(_0x787fee,_0x4060ee){return db['ChatWebsite'][_0xe122('0x50')]({'where':{'id':_0x787fee[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x4060ee,null))[_0xe122('0x15')](function(_0x1014b1){if(_0x1014b1){return _0x1014b1[_0xe122('0x63')](_0x787fee[_0xe122('0x35')][_0xe122('0x5d')]);}})['then'](respondWithStatusCode(_0x4060ee,null))[_0xe122('0x46')](handleError(_0x4060ee,null));};exports[_0xe122('0x64')]=function(_0x44f978,_0x395a67){_0x44f978[_0xe122('0x4a')]['sitepic']=_0x44f978[_0xe122('0x65')][_0xe122('0x66')];return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x44f978[_0xe122('0x47')]['id']}})['then'](handleEntityNotFound(_0x395a67,null))['then'](saveUpdates(_0x44f978[_0xe122('0x4a')],null))[_0xe122('0x15')](respondWithResult(_0x395a67,null))[_0xe122('0x46')](handleError(_0x395a67,null));};exports[_0xe122('0x67')]=function(_0x46f2a5,_0x6cc977){_0x46f2a5[_0xe122('0x4a')]['agentAvatar']=_0x46f2a5[_0xe122('0x65')][_0xe122('0x66')];return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x46f2a5[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x6cc977,null))['then'](saveUpdates(_0x46f2a5['body'],null))[_0xe122('0x15')](respondWithResult(_0x6cc977,null))[_0xe122('0x46')](handleError(_0x6cc977,null));};exports[_0xe122('0x68')]=function(_0x5ac376,_0x3615f2){_0x5ac376[_0xe122('0x4a')][_0xe122('0x69')]=_0x5ac376['file'][_0xe122('0x66')];return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x5ac376[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x3615f2,null))['then'](saveUpdates(_0x5ac376['body'],null))[_0xe122('0x15')](respondWithResult(_0x3615f2,null))['catch'](handleError(_0x3615f2,null));};exports[_0xe122('0x6a')]=function(_0x5dfc4d,_0x3384a5){_0x5dfc4d['body'][_0xe122('0x6b')]=_0x5dfc4d[_0xe122('0x65')]['filename'];return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x5dfc4d[_0xe122('0x47')]['id']}})['then'](handleEntityNotFound(_0x3384a5,null))[_0xe122('0x15')](saveUpdates(_0x5dfc4d['body'],null))[_0xe122('0x15')](respondWithResult(_0x3384a5,null))[_0xe122('0x46')](handleError(_0x3384a5,null));};exports['getLogo']=function(_0x577ebc,_0x27f132){var _0x1e8a0a=path[_0xe122('0x6c')](config[_0xe122('0x6d')],'server/files/images/logos/default_logo.svg');var _0x30c877={'where':{'id':_0x577ebc[_0xe122('0x47')]['id']},'attributes':['id',_0xe122('0x6e')],'raw':!![]};var _0x98f920=![];return require(_0xe122('0x6f'))[_0xe122('0x70')]()[_0xe122('0x15')](function(_0x28ae7c){if(_0x28ae7c){_0x98f920=_0x28ae7c[_0xe122('0x71')];}})['then'](function(){return db['ChatWebsite']['find'](_0x30c877);})[_0xe122('0x15')](handleEntityNotFound(_0x27f132,null))['then'](function(_0x30a945){if(_0x30a945){if(!_['isNil'](_0x30a945['sitepic'])){if(fs[_0xe122('0x72')](path[_0xe122('0x6c')](config[_0xe122('0x6d')],_0xe122('0x73'),_0x30a945[_0xe122('0x6e')]))&&_0x98f920){_0x1e8a0a=path[_0xe122('0x6c')](config['root'],_0xe122('0x73'),_0x30a945['sitepic']);}}return _0x27f132['download'](_0x1e8a0a);}})[_0xe122('0x46')](handleError(_0x27f132,null));};exports[_0xe122('0x74')]=function(_0x1a2edc,_0x24b2be){var _0x312108=path['join'](config['root'],'server/files/images/avatars/default_avatar.png');var _0x414a6f={'where':{'id':_0x1a2edc[_0xe122('0x47')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xe122('0x2f')]['find'](_0x414a6f)[_0xe122('0x15')](handleEntityNotFound(_0x24b2be,null))[_0xe122('0x15')](function(_0x59b636){if(_0x59b636){if(!_[_0xe122('0x75')](_0x59b636[_0xe122('0x76')])){if(fs[_0xe122('0x72')](path[_0xe122('0x6c')](config[_0xe122('0x6d')],'server/files/images/avatars/',_0x59b636[_0xe122('0x76')]))){_0x312108=path['join'](config[_0xe122('0x6d')],_0xe122('0x77'),_0x59b636[_0xe122('0x76')]);}}return _0x24b2be['download'](_0x312108);}})[_0xe122('0x46')](handleError(_0x24b2be,null));};exports[_0xe122('0x78')]=function(_0x4b821a,_0x4d068b){var _0x4a9cb7=path[_0xe122('0x6c')](config[_0xe122('0x6d')],_0xe122('0x79'));var _0x300e81={'where':{'id':_0x4b821a['params']['id']},'attributes':['id',_0xe122('0x69'),_0xe122('0x7a')],'raw':!![]};return db['ChatWebsite']['find'](_0x300e81)['then'](handleEntityNotFound(_0x4d068b,null))[_0xe122('0x15')](function(_0x21ead6){if(_0x21ead6){if(!_[_0xe122('0x75')](_0x21ead6[_0xe122('0x69')])){if(fs[_0xe122('0x72')](path[_0xe122('0x6c')](config[_0xe122('0x6d')],'server/files/images/avatars/',_0x21ead6['customerAvatar']))&&_0x21ead6['showCustomerAvatar']){_0x4a9cb7=path[_0xe122('0x6c')](config['root'],_0xe122('0x77'),_0x21ead6['customerAvatar']);}}return _0x4d068b[_0xe122('0x7b')](_0x4a9cb7);}})['catch'](handleError(_0x4d068b,null));};exports['getSystemAvatar']=function(_0x261afe,_0x503670){var _0x2076e2=path[_0xe122('0x6c')](config[_0xe122('0x6d')],_0xe122('0x7c'));var _0x53e60c={'where':{'id':_0x261afe['params']['id']},'attributes':['id',_0xe122('0x6b')],'raw':!![]};return db['ChatWebsite'][_0xe122('0x50')](_0x53e60c)['then'](handleEntityNotFound(_0x503670,null))[_0xe122('0x15')](function(_0x5a7b0c){if(_0x5a7b0c){if(!_[_0xe122('0x75')](_0x5a7b0c[_0xe122('0x6b')])){if(fs[_0xe122('0x72')](path[_0xe122('0x6c')](config['root'],'server/files/images/avatars/',_0x5a7b0c[_0xe122('0x6b')]))){_0x2076e2=path['join'](config[_0xe122('0x6d')],'server/files/images/avatars/',_0x5a7b0c[_0xe122('0x6b')]);}}return _0x503670[_0xe122('0x7b')](_0x2076e2);}})[_0xe122('0x46')](handleError(_0x503670,null));};exports['notify']=function(_0x41148a,_0x4fc61c){var _0x1f99a7=require(_0xe122('0x7d'));var _0x37fdcc=new _0x1f99a7();var _0x4d47a6=_0x37fdcc['setUA'](_0x41148a[_0xe122('0x7e')][_0xe122('0x7f')])[_0xe122('0x80')]();var _0x16c643={'body':_0x41148a['body'],'channel':_0xe122('0x81')};var _0x748177=[];var _0x31d2e6=[];var _0x1437e2={};var _0x574fb5=![];return db[_0xe122('0x82')][_0xe122('0x53')]()[_0xe122('0x15')](function(_0x355d2b){if(!_0x355d2b){throw new db[(_0xe122('0x83'))][(_0xe122('0x84'))](_0xe122('0x85'));}_0x748177=_[_0xe122('0x86')](_[_0xe122('0x36')](_0x355d2b),[_0xe122('0x87'),'updatedAt']);_0x31d2e6=_[_0xe122('0x86')](_[_0xe122('0x36')](_0x355d2b),[_0xe122('0x87'),_0xe122('0x88'),_0xe122('0x89'),_0xe122('0x8a')]);if(_0x41148a[_0xe122('0x4a')]['id']){delete _0x41148a[_0xe122('0x4a')]['id'];}if(_[_0xe122('0x75')](_0x41148a[_0xe122('0x4a')][_0xe122('0x8b')])){throw new db['Sequelize'][(_0xe122('0x84'))]('from\x20is\x20mandatory');}if(_[_0xe122('0x75')](_0x41148a[_0xe122('0x4a')][_0xe122('0x4a')])||_0x41148a[_0xe122('0x4a')][_0xe122('0x4a')]===''){throw new db[(_0xe122('0x83'))][(_0xe122('0x84'))](_0xe122('0x8c'));}if(_[_0xe122('0x75')](_0x41148a['body']['mapKey'])){throw new db['Sequelize'][(_0xe122('0x84'))](_0xe122('0x8d')+_0x31d2e6);}if(!_[_0xe122('0x8e')](_0x31d2e6,_0x41148a[_0xe122('0x4a')][_0xe122('0x8f')])){throw new db[(_0xe122('0x83'))][(_0xe122('0x84'))](_0xe122('0x90')+_0x31d2e6);}_0x1437e2[_0x41148a[_0xe122('0x4a')][_0xe122('0x8f')]]=_0x41148a[_0xe122('0x4a')][_0xe122('0x8b')];})['then'](function(){return db[_0xe122('0x2f')]['find']({'where':{'id':_0x41148a[_0xe122('0x47')]['id']},'include':[{'model':db[_0xe122('0x91')],'as':_0xe122('0x92'),'include':[{'model':db[_0xe122('0x82')],'as':'Contacts','where':_0x1437e2,'limit':0x1,'order':[[_0xe122('0x88'),_0xe122('0x93')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0xe122('0x15')](handleEntityNotFound(_0x4fc61c,null))['then'](function(_0x1d47d0){if(_0x1d47d0&&_0x1d47d0[_0xe122('0x92')]){_0x16c643[_0xe122('0x94')]=_0x1d47d0;_0x16c643['applications']=_0x1d47d0[_0xe122('0x95')];_0x16c643[_0xe122('0x96')]=_0x1d47d0[_0xe122('0x92')];_0x16c643['applications']=_['orderBy'](_0x16c643['applications'],[_0xe122('0x97')],[_0xe122('0x98')]);if(_0x16c643[_0xe122('0x94')][_0xe122('0x95')]){delete _0x16c643[_0xe122('0x94')][_0xe122('0x95')];}if(_0x16c643['account'][_0xe122('0x92')]&&_0x16c643[_0xe122('0x94')]['List']['Contacts'][_0xe122('0x3a')]){return _0x16c643[_0xe122('0x94')]['List']['Contacts'][0x0];}var _0x5ac305=_[_0xe122('0xd')](_0x41148a[_0xe122('0x4a')],{'firstName':_0x41148a['body'][_0xe122('0x8b')],'ListId':_0x1d47d0[_0xe122('0x8a')]});_0x5ac305[_0x41148a[_0xe122('0x4a')][_0xe122('0x8f')]]=_0x41148a[_0xe122('0x4a')]['from'];return db[_0xe122('0x82')][_0xe122('0x49')](_0x5ac305,{'fields':_0x748177,'raw':!![]});}})[_0xe122('0x15')](handleEntityNotFound(_0x4fc61c,null))['then'](function(_0x8e2bc){_0x16c643[_0xe122('0x99')]=_0x8e2bc;var _0x39025e=_0x41148a[_0xe122('0x4a')]['customerIp'];if(_0x41148a[_0xe122('0x7e')]['cf-connecting-ip']){_0x39025e=_0x41148a[_0xe122('0x7e')][_0xe122('0x9a')];}else if(_0x41148a['headers'][_0xe122('0x9b')]){_0x39025e=_[_0xe122('0x9c')](_0x41148a[_0xe122('0x7e')][_0xe122('0x9b')]['split'](','));}if(_0x8e2bc){var _0x20a622={'ContactId':_0x8e2bc['id'],'ChatWebsiteId':_0x41148a[_0xe122('0x47')]['id'],'from':(_0x8e2bc[_0xe122('0x9d')]||'')+'\x20'+(_0x8e2bc[_0xe122('0x9e')]||''),'customerIp':_0x39025e,'customerPort':_0x41148a['headers'][_0xe122('0x9f')]?_0x41148a['headers'][_0xe122('0x9f')]:null,'referer':_0x41148a[_0xe122('0x4a')]['referer'],'browserName':_0x4d47a6[_0xe122('0xa0')]['name']&&_0x4d47a6['browser'][_0xe122('0xa1')]?util[_0xe122('0xa2')](_0xe122('0xa3'),_0x4d47a6['browser']['name'],_0x4d47a6['browser'][_0xe122('0xa1')]):'unknown','browserVersion':_0x4d47a6[_0xe122('0xa0')][_0xe122('0xa1')]||_0xe122('0xa4'),'osName':util[_0xe122('0xa2')](_0xe122('0xa3'),_0x4d47a6['os'][_0xe122('0x2c')],_0x4d47a6['os'][_0xe122('0xa1')]),'osVersion':_0x4d47a6['os'][_0xe122('0xa1')],'deviceModel':_0x4d47a6[_0xe122('0xa5')][_0xe122('0x33')]&&_0x4d47a6['device'][_0xe122('0xa6')]?util[_0xe122('0xa2')](_0xe122('0xa7'),_0x4d47a6[_0xe122('0xa5')][_0xe122('0x33')],_0x4d47a6[_0xe122('0xa5')]['vendor'],_0x4d47a6[_0xe122('0xa5')][_0xe122('0x31')]):null,'deviceVendor':_0x4d47a6[_0xe122('0xa5')][_0xe122('0xa6')],'deviceType':_0x4d47a6[_0xe122('0xa5')][_0xe122('0x31')],'formData':JSON[_0xe122('0x18')](_0x41148a[_0xe122('0x4a')])};var _0x2483da={'ChatWebsiteId':_0x41148a[_0xe122('0x47')]['id'],'closed':![]};if(_0x41148a['body']['threadId']){_0x2483da['threadId']=_0x41148a['body'][_0xe122('0xa8')];return db[_0xe122('0xa9')]['find']({'where':_0x2483da})[_0xe122('0x15')](function(_0x21e9e6){if(_0x21e9e6){return[_0x21e9e6,![]];}_0x20a622['threadId']=_0x41148a[_0xe122('0x4a')][_0xe122('0xa8')];_0x20a622[_0xe122('0xaa')]=_0x41148a['body'][_0xe122('0xaa')];return db[_0xe122('0xa9')][_0xe122('0x49')](_0x20a622)[_0xe122('0x15')](function(_0x54f8d0){return[_0x54f8d0,!![]];});});}_0x2483da[_0xe122('0xab')]=_0x8e2bc['id'];if(_0x41148a[_0xe122('0x4a')][_0xe122('0xac')]&&_0x41148a[_0xe122('0x4a')][_0xe122('0xac')]['id']){_0x2483da['id']=_0x41148a['body'][_0xe122('0xac')]['id'];return db[_0xe122('0xa9')]['find']({'where':_0x2483da})[_0xe122('0x15')](function(_0x1251e5){if(_0x1251e5){return[_0x1251e5,![]];}return db[_0xe122('0xa9')]['create'](_0x20a622)['then'](function(_0x3db911){return[_0x3db911,!![]];});});}return db[_0xe122('0xa9')][_0xe122('0x49')](_0x20a622)[_0xe122('0x15')](function(_0x563c1a){return[_0x563c1a,!![]];});}})['spread'](function(_0x23dd7f,_0x47f8b4){if(_0x23dd7f){_0x574fb5=_0x47f8b4;if(!_0x47f8b4){var _0x36b89e={'from':(_0x16c643[_0xe122('0x99')][_0xe122('0x9d')]||'')+'\x20'+(_0x16c643[_0xe122('0x99')]['lastName']||'')};if(_0x41148a[_0xe122('0x4a')][_0xe122('0xa8')]&&_0x41148a['body'][_0xe122('0xad')]&&_0x41148a[_0xe122('0x4a')][_0xe122('0xa8')]!=_0x41148a[_0xe122('0x4a')][_0xe122('0xad')]){_0x36b89e[_0xe122('0xa8')]=_0x41148a['body']['messageId'];}return _0x23dd7f[_0xe122('0x27')](_0x36b89e);}else{return _0x23dd7f;}}})[_0xe122('0x15')](function(_0x34202e){_0x16c643[_0xe122('0xac')]=_0x34202e[_0xe122('0x29')]({'plain':!![]});_0x16c643[_0xe122('0xac')][_0xe122('0xae')]=_0x574fb5;if(_0x16c643[_0xe122('0xac')][_0xe122('0xae')]){if(_0x16c643[_0xe122('0x94')]['autoclose']){_0x16c643['applications'][_0xe122('0xaf')]({'id':0x0,'priority':_0x16c643[_0xe122('0xb0')][_0xe122('0x3a')]+0x1,'app':_0xe122('0xb1'),'appdata':_0xe122('0xb2'),'interval':_0xe122('0xb3')});}}return db[_0xe122('0xb4')][_0xe122('0x49')]({'body':_0x41148a['body']['body'],'ChatWebsiteId':_0x41148a['params']['id'],'ChatInteractionId':_0x34202e['id'],'direction':'in','ContactId':_0x16c643['contact']['id'],'AttachmentId':_0x41148a['body'][_0xe122('0xb5')]});})[_0xe122('0x15')](function(_0x34131f){_0x16c643[_0xe122('0x1b')]=_0x34131f;if(_0x16c643[_0xe122('0xac')][_0xe122('0xb6')]){return db[_0xe122('0xb7')][_0xe122('0x50')]({'attributes':['id',_0xe122('0x2c')],'where':{'id':_0x16c643['interaction'][_0xe122('0xb6')]}})['then'](function(_0x96e7b5){if(_0x96e7b5){_0x16c643[_0xe122('0xb0')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe122('0xb8'),'appdata':_0x96e7b5[_0xe122('0x2c')]+','+(_0x16c643[_0xe122('0x94')][_0xe122('0xb9')]||0xa),'interval':_0xe122('0xb3')});_0x16c643[_0xe122('0xba')]=!![];}return respondWithRpcPromise(_0xe122('0xbb'),_0xe122('0xbc'),_0x16c643);});}return respondWithRpcPromise(_0xe122('0xbb'),_0xe122('0xbc'),_0x16c643);})[_0xe122('0x15')](function(_0x254341){respondWithRpcPromise(_0xe122('0xbd'),'EventManager',{'event':_0xe122('0xbe'),'message':_0x254341},client9002);return _0x254341;})[_0xe122('0x15')](respondWithResult(_0x4fc61c,null))[_0xe122('0x46')](handleError(_0x4fc61c,null));};exports['offline']=function(_0x50c304,_0x3e63c4){var _0x3e4880,_0x5ddf33,_0x1353b3;var _0x444fc3=[];var _0x379553={};var _0x242477=_0x50c304['files']||[];var _0x18d8d2=[];var _0x31ddfe;return db[_0xe122('0x82')][_0xe122('0x53')]()[_0xe122('0x15')](function(_0x9e219b){if(!_0x9e219b){throw new db[(_0xe122('0x83'))]['ValidationError'](_0xe122('0x85'));}_0x444fc3=_[_0xe122('0x86')](_['keys'](_0x9e219b),[_0xe122('0x87'),'updatedAt',_0xe122('0x89'),_0xe122('0x8a')]);if(_0x50c304[_0xe122('0x4a')]['id']){delete _0x50c304[_0xe122('0x4a')]['id'];}if(_[_0xe122('0x75')](_0x50c304['body'][_0xe122('0x8b')])){throw _0x3e63c4['status'](0x1f4)[_0xe122('0x2d')](new db[(_0xe122('0x83'))][(_0xe122('0x84'))](_0xe122('0xbf')));}if(_[_0xe122('0x75')](_0x50c304[_0xe122('0x4a')]['body'])||_0x50c304[_0xe122('0x4a')]['body']===''){throw _0x3e63c4[_0xe122('0x23')](0x1f4)[_0xe122('0x2d')](new db[(_0xe122('0x83'))][(_0xe122('0x84'))](_0xe122('0x8c')));}if(_[_0xe122('0x75')](_0x50c304['body']['mapKeyOffline'])){throw _0x3e63c4['status'](0x1f4)[_0xe122('0x2d')](new db[(_0xe122('0x83'))][(_0xe122('0x84'))](_0xe122('0xc0')+_0x444fc3));}if(!_['includes'](_0x444fc3,_0x50c304['body'][_0xe122('0xc1')])){throw _0x3e63c4[_0xe122('0x23')](0x1f4)[_0xe122('0x2d')](new db['Sequelize']['ValidationError'](_0xe122('0xc2')+_0x444fc3));}_0x379553[_0x50c304['body'][_0xe122('0xc1')]]=_0x50c304[_0xe122('0x4a')][_0xe122('0x8b')];})['then'](function(){return db[_0xe122('0x2f')]['find']({'where':{'id':_0x50c304[_0xe122('0x47')]['id']},'include':[{'model':db[_0xe122('0x91')],'as':_0xe122('0x92')},{'model':db[_0xe122('0xc3')],'as':_0xe122('0xc3')}]});})[_0xe122('0x15')](handleEntityNotFound(_0x3e63c4,null))[_0xe122('0x15')](function(_0x53865b){if(_0x53865b&&_0x53865b['List']){_0x5ddf33=_0x53865b;var _0x11ac63=_['defaults'](_0x50c304[_0xe122('0x4a')],{'firstName':_0x50c304[_0xe122('0x4a')]['from'],'phone':_0x50c304[_0xe122('0x4a')][_0xe122('0x8b')],'ListId':_0x53865b['ListId']});_0x11ac63[_0x50c304['body'][_0xe122('0xc1')]]=_0x50c304[_0xe122('0x4a')]['from'];return db[_0xe122('0x82')][_0xe122('0xc4')]({'where':_0x379553,'defaults':_0x11ac63});}})['spread'](function(_0x57b8fc){if(_0x57b8fc){_0x1353b3=_0x57b8fc;var _0x251989=fs[_0xe122('0xc5')](path[_0xe122('0x6c')](config['root'],_0xe122('0xc6')),_0xe122('0xc7'));var _0x504651=ejs[_0xe122('0xc8')](_0x251989,{'body':_[_0xe122('0xc9')](_0x50c304['body'][_0xe122('0x4a')]),'bodyTitle':_0x5ddf33['offlineMessageBody']});return db[_0xe122('0xca')][_0xe122('0x49')]({'body':_0x504651,'plainBody':htmlToText[_0xe122('0xcb')](_0x504651),'ContactId':_0x57b8fc['id'],'ChatWebsiteId':_0x5ddf33['id']});}})['then'](function(_0x56c9d3){_0x31ddfe=_0x56c9d3;if(_0x242477['length']){var _0x3b3f49=_0x242477['map'](function(_0x4b8af0){return{'name':_0x4b8af0[_0xe122('0xcc')],'basename':_0x4b8af0[_0xe122('0x66')],'type':_0x4b8af0[_0xe122('0xcd')],'ChatOfflineMessageId':_0x56c9d3['id']};});_0x18d8d2=_0x3b3f49[_0xe122('0x34')](_0x38c6fd=>{var _0x59e403={'filename':_0x38c6fd[_0xe122('0x2c')],'path':path[_0xe122('0x6c')](config[_0xe122('0x6d')],_0xe122('0xce'),_0xe122('0xcf'),'attachments',_0xe122('0xd0'),_0x38c6fd['basename'])};return _0x59e403;});if(!_0x5ddf33[_0xe122('0xd1')]){return db[_0xe122('0xd2')]['transaction'](function(_0x5aa508){return db['Attachment'][_0xe122('0xd3')](_0x3b3f49,{'transaction':_0x5aa508});});}}})[_0xe122('0x15')](function(){if(_0x31ddfe){_0x3e4880=_0x31ddfe;return db[_0xe122('0xc3')][_0xe122('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0xe122('0xd4')],'as':_0xe122('0xd5'),'raw':!![],'include':[{'model':db[_0xe122('0xd6')],'as':_0xe122('0xd6'),'raw':!![]}]}]});}})['then'](function(_0x176641){if(_0x176641&&_0x176641[_0xe122('0xd5')]&&_0x5ddf33[_0xe122('0xd7')]&&_0x5ddf33[_0xe122('0xd8')]){var _0x20e0d9=_0x176641[_0xe122('0xd9')]();return respondWithRpcPromise('SendMail',_0xe122('0xda'),{'account':_0x20e0d9,'message':{'from':util[_0xe122('0xa2')](_0xe122('0xdb'),_0x176641[_0xe122('0x2c')],_0x176641[_0xe122('0xdc')]||_0x176641[_0xe122('0xd5')][_0xe122('0x4b')]),'to':_0x5ddf33[_0xe122('0xd8')],'subject':_0x5ddf33[_0xe122('0xdd')],'html':_0x3e4880[_0xe122('0x4a')],'attachments':_0x18d8d2}},client9003)[_0xe122('0x15')](function(){return _0x3e4880;})[_0xe122('0x46')](function(_0x529bb6){logger[_0xe122('0x19')](_0x529bb6);});}})[_0xe122('0x15')](function(){if(_0x5ddf33&&_0x5ddf33['openNewInteraction']&&_0x5ddf33['MailAccountId']){var _0x99dfba=[];if(_0x242477[_0xe122('0x3a')]){_0x99dfba=_0x242477[_0xe122('0x34')](function(_0x5b2c14){return{'name':_0x5b2c14[_0xe122('0xcc')],'basename':_0x5b2c14[_0xe122('0x66')],'type':_0x5b2c14['mimetype'],'ChatOfflineMessageId':_0x31ddfe['id']};});}var _0x3a49a5;if(!_[_0xe122('0x75')](_0x5ddf33[_0xe122('0xde')])){var _0x3dff60=_[_0xe122('0x34')](_0x50c304[_0xe122('0x4a')],function(_0x582847){return _0x582847;});var _0x10432e=_[_0xe122('0xdf')](_0x3dff60)[0x0];var _0x42bdc8=_['mapValues'](_0x10432e,function(_0xed96d1){return _0xed96d1;});_0x3a49a5=_0x42bdc8[0x1][_0x5ddf33[_0xe122('0xde')]];}var _0x43fa26={'from':_0x1353b3[_0xe122('0xdc')],'firstName':_0x1353b3[_0xe122('0x9d')],'lastName':_0x1353b3[_0xe122('0x9e')],'mapKey':_0xe122('0xdc'),'message':{'from':_0x1353b3['email'],'to':_0x5ddf33[_0xe122('0xc3')][_0xe122('0xdc')],'cc':'','subject':_[_0xe122('0x75')](_0x3a49a5)?_0x5ddf33['offlineMessageSubject']:_0x3a49a5,'messageId':'','sentAt':new Date(),'attach':_0x99dfba[_0xe122('0x3a')],'attachments':_0x99dfba,'originChannel':_0xe122('0xe0'),'ChatWebsiteId':_0x5ddf33['id'],'ChatOfflineMessageId':_0x3e4880['id'],'originTo':_0x5ddf33[_0xe122('0xc3')][_0xe122('0xdc')]},'body':_0x3e4880['body']};var _0x72974f={'account':{'id':_0x5ddf33[_0xe122('0xe1')]},'body':_0x43fa26,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xe122('0xe2'),_0xe122('0xe3'),_0x72974f,client9001)[_0xe122('0x15')](function(){return _0x3e4880;})[_0xe122('0x46')](function(_0x6673ff){logger[_0xe122('0x19')](_0x6673ff);});}return;})[_0xe122('0x15')](function(){if(_0x3e4880){return _0x3e4880;}})[_0xe122('0x15')](respondWithResult(_0x3e63c4,null))[_0xe122('0x46')](function(_0xe3fb9b){logger[_0xe122('0x19')](_0xe122('0x46'),_0xe3fb9b);for(var _0x464850 of _0x242477){var _0x46526c=path[_0xe122('0x6c')](config[_0xe122('0x6d')],_0xe122('0xce'),'files',_0xe122('0xe4'),_0xe122('0xd0'),_0x464850[_0xe122('0x66')]);fs_extra['remove'](_0x46526c)[_0xe122('0x46')](function(_0x1d468a){logger[_0xe122('0x19')](_0xe122('0xe5'),_0x46526c,_0x1d468a);});}});};exports[_0xe122('0xe6')]=function(_0x2ff7d9,_0x274c9d){return db[_0xe122('0xa9')][_0xe122('0x50')]({'where':{'id':_0x2ff7d9[_0xe122('0x47')]['id']}})['then'](handleEntityNotFound(_0x274c9d,null))[_0xe122('0x15')](function(_0x505d27){if(_0x505d27){return _0x505d27[_0xe122('0xe6')](_0x2ff7d9['body']['ids'],_['omit'](_0x2ff7d9[_0xe122('0x4a')],[_0xe122('0x5d'),'id'])||{});}})[_0xe122('0x15')](respondWithResult(_0x274c9d,null))[_0xe122('0x46')](handleError(_0x274c9d,null));};exports[_0xe122('0xe7')]=function(_0x133048,_0x1132e8){var _0x257293={'raw':![],'where':{}};var _0x3d920c={};var _0x5d4ca9={'count':0x0,'rows':[]};return db[_0xe122('0x2f')]['findOne']({'where':{'id':_0x133048['params']['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x1132e8,null))[_0xe122('0x15')](function(_0x3c65d2){if(_0x3c65d2){_0x3d920c['model']=_['keys'](db[_0xe122('0xa9')][_0xe122('0x58')]);_0x3d920c['query']=_[_0xe122('0x36')](_0x133048[_0xe122('0x35')]);_0x3d920c['filters']=_[_0xe122('0x37')](_0x3d920c[_0xe122('0x33')],_0x3d920c['query']);_0x257293[_0xe122('0x38')]=_[_0xe122('0x37')](_0x3d920c[_0xe122('0x33')],qs['fields'](_0x133048[_0xe122('0x35')][_0xe122('0x39')]));_0x257293[_0xe122('0x38')]=_0x257293[_0xe122('0x38')][_0xe122('0x3a')]?_0x257293[_0xe122('0x38')]:_0x3d920c['model'];if(!_0x133048['query'][_0xe122('0x59')](_0xe122('0x3b'))){_0x257293[_0xe122('0x20')]=qs['limit'](_0x133048[_0xe122('0x35')][_0xe122('0x20')]);_0x257293['offset']=qs['offset'](_0x133048[_0xe122('0x35')]['offset']);}_0x257293[_0xe122('0x3c')]=qs[_0xe122('0x3d')](_0x133048[_0xe122('0x35')]['sort']);_0x257293['where']=qs['filters'](_['pick'](_0x133048[_0xe122('0x35')],_0x3d920c[_0xe122('0x3e')]));_0x257293[_0xe122('0x41')][_0xe122('0x5f')]=_0x3c65d2['id'];if(_0x133048['query'][_0xe122('0x5a')]){_0x257293[_0xe122('0x41')]=_[_0xe122('0x40')](_0x257293[_0xe122('0x41')],{'$or':_[_0xe122('0x34')](_0x257293[_0xe122('0x38')],function(_0x329f09){var _0x2107fc={};_0x2107fc[_0x329f09]={'$like':'%'+_0x133048[_0xe122('0x35')][_0xe122('0x5a')]+'%'};return _0x2107fc;})});}_0x257293=_[_0xe122('0x40')]({},_0x257293,_0x133048['options']);return db[_0xe122('0xa9')][_0xe122('0x22')]({'where':_0x257293['where']})['then'](function(_0x59850f){_0x5d4ca9['count']=_0x59850f;if(_0x133048[_0xe122('0x35')]['includeAll']){_0x257293['include']=[{'model':db[_0xe122('0x82')],'as':'Contact','required':![]},{'model':db[_0xe122('0xb7')],'as':_0xe122('0xe8'),'attributes':[_0xe122('0x2c'),_0xe122('0xe9'),_0xe122('0xea')],'required':![]},{'model':db[_0xe122('0xeb')],'as':_0xe122('0xec'),'attributes':['id',_0xe122('0x2c'),'color'],'where':_0x133048['query']['tag']?{'id':_0x133048[_0xe122('0x35')][_0xe122('0xed')]}:undefined,'required':_0x133048[_0xe122('0x35')][_0xe122('0xed')]?!![]:![]}];}return db[_0xe122('0xa9')]['findAll'](_0x257293);})[_0xe122('0x15')](function(_0x4d14bb){_0x5d4ca9['rows']=_0x4d14bb;return _0x5d4ca9;});}})['then'](respondWithFilteredResult(_0x1132e8,_0x257293))['catch'](handleError(_0x1132e8,null));};function iftimePromise(_0x4c7799,_0x137e2f){return respondWithRpcPromise(_0xe122('0xee'),'getSnippet',{'command':_0x137e2f[_0xe122('0xef')]?util[_0xe122('0xa2')](_0xe122('0xf0'),_0x4c7799['interval'],_0x137e2f['timezone']):util['format']('iftime\x20%s',_0x4c7799[_0xe122('0xf1')])},client9002)[_0xe122('0x15')](function(_0x397a6c){var _0x4ffce8=_0x397a6c&&_0x397a6c[_0xe122('0xf2')](_0xe122('0xf3'))>=0x0?!![]:![];logger[_0xe122('0x16')](_0xe122('0xf4'),_0x137e2f['id'],_0x4c7799['id'],_0x4c7799[_0xe122('0xf1')],_0x4ffce8?_0xe122('0xf5'):'OFFLINE',_0x137e2f[_0xe122('0xef')]?_0x137e2f['timezone']:_0xe122('0xf6'));return _0x4ffce8;})[_0xe122('0x46')](function(_0x35d7c4){logger[_0xe122('0x19')](_0xe122('0xf4'),_0x137e2f['id'],_0x4c7799['id'],_0x4c7799[_0xe122('0xf1')],util[_0xe122('0xf7')](_0x35d7c4,{'showHidden':![],'depth':null}),_0x137e2f[_0xe122('0xef')]?_0x137e2f[_0xe122('0xef')]:_0xe122('0xf6'));return![];});}exports[_0xe122('0xf8')]=function(_0x400cd1,_0x5530a9){var _0x51cd46=0x0;var _0x28fb5a=0x0;var _0x2e69d9=![];var _0x9eb196;var _0x2fe2f9;return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x400cd1[_0xe122('0x47')]['id']},'include':[{'model':db[_0xe122('0xf9')],'as':_0xe122('0xf9'),'include':[{'model':db[_0xe122('0xf9')],'as':_0xe122('0xfa'),'attributes':['id',_0xe122('0xf1')],'raw':!![]}]}]})[_0xe122('0x15')](handleEntityNotFound(_0x5530a9,null))['then'](function(_0x49c86b){if(_0x49c86b){_0x9eb196=_0x49c86b;return _0x49c86b['getProactiveActions']({'raw':!![]});}})['then'](function(_0x444770){if(_0x9eb196){if(_0x444770){_0x2fe2f9=_0x444770;}}return require(_0xe122('0x6f'))[_0xe122('0x70')]();})[_0xe122('0x15')](function(_0x473bef){if(_0x473bef){_0x28fb5a=_0x473bef['virtual'];_0x2e69d9=_0x473bef['custom'];}})['then'](function(){return db[_0xe122('0xa9')]['count']({'where':{'closed':![]}});})[_0xe122('0x15')](function(_0x2d1842){_0x51cd46=_0x2d1842;if(_0x28fb5a&&_0x2d1842>_0x28fb5a){return db[_0xe122('0xfb')]['findOne']({'where':{'id':0x1}})[_0xe122('0x15')](function(_0x38bb69){if(_0x38bb69){_0x38bb69[_0xe122('0xfc')](_0xe122('0xfd'));}});}})[_0xe122('0x15')](function(){if(_0x9eb196[_0xe122('0xf9')]&&_0x9eb196['Interval']['Intervals']){var _0x17dd97=[];for(var _0x81375e=0x0;_0x81375e<_0x9eb196[_0xe122('0xf9')][_0xe122('0xfa')][_0xe122('0x3a')];_0x81375e++){var _0x29edc8=_0x9eb196[_0xe122('0xf9')][_0xe122('0xfa')][_0x81375e][_0xe122('0x29')]({'plain':!![]});_0x17dd97[_0xe122('0xaf')](iftimePromise(_0x29edc8,_0x9eb196));}return BPromise[_0xe122('0xfe')](_0x17dd97)['then'](function(_0x3f1ad4){return _[_0xe122('0xff')](_0x3f1ad4);});}else{return!![];}})['then'](function(_0x2e12d7){var _0xe1f4c8=fs[_0xe122('0xc5')](path[_0xe122('0x6c')](config['root'],_0xe122('0x100')),'utf8');var _0x12df2c=new url[(_0xe122('0x101'))](_0x9eb196[_0xe122('0x102')])[_0xe122('0x103')];var _0x25596c=_0xe122('0x104');var _0x41cbd8=![];var _0x10cb0d={'chatVersion':_0x25596c,'chatWebsiteAddressOrigin':_0x12df2c,'remote':_0x9eb196[_0xe122('0x105')],'query':querystring[_0xe122('0x18')](_[_0xe122('0x40')](_0x9eb196[_0xe122('0x29')]({'plain':!![]}),{'customerIp':_0x400cd1[_0xe122('0x7e')][_0xe122('0x9b')]||_0x400cd1[_0xe122('0x7e')][_0xe122('0x106')]||_0x400cd1[_0xe122('0x107')][_0xe122('0x108')]||_0x400cd1['ip'],'referer':_0x400cd1[_0xe122('0x7e')][_0xe122('0x109')],'openedInteractions':_0x51cd46,'maxInteractions':_0x28fb5a,'virtual':_0x2e69d9[_0xe122('0x10a')],'online':_0x2e12d7,'custom':_0x2e69d9}))[_0xe122('0x10b')](/'/g,'\x5c\x27')};_0x5530a9[_0xe122('0x2d')](ejs[_0xe122('0xc8')](Mustache[_0xe122('0xc8')](_0xe1f4c8,_0x10cb0d),{'proactiveActions':_0x2fe2f9,'alignment':_0x9eb196[_0xe122('0x10c')],'verticalAlignment':_0x9eb196['verticalAlignment'],'div_color':_0x9eb196['color'],'labelText':_0x9eb196['labelText'],'text_color':_0x9eb196[_0xe122('0x10d')],'text_button_color':_0x9eb196[_0xe122('0x10e')],'button_color':_0x9eb196[_0xe122('0x10f')],'background_color':_0x9eb196[_0xe122('0x110')],'hideWhenOffline':_0x9eb196[_0xe122('0x111')],'intervalId':_0x9eb196[_0xe122('0x112')],'isDevelopment':_0x41cbd8,'chatVersion':_0x25596c}));})[_0xe122('0x46')](handleError(_0x5530a9,null));};exports[_0xe122('0x113')]=function(_0x5f3afe,_0x1e9c35){var _0x3892b2=_0x5f3afe[_0xe122('0x47')]['id'];var _0x53555e=_0x5f3afe[_0xe122('0x4a')];var _0x2963df=0xc8;var _0x45f76a=null;return db[_0xe122('0xd2')][_0xe122('0x114')]({'isolationLevel':db[_0xe122('0xd2')]['Transaction'][_0xe122('0x115')][_0xe122('0x116')]},function(_0x32d54c){return db['ChatWebsite']['findOne']({'where':{'id':_0x3892b2},'transaction':_0x32d54c})['then'](function(_0x2fa4ad){if(_0x2fa4ad){return db[_0xe122('0x117')][_0xe122('0x28')]({'where':{'ChatWebsiteId':_0x3892b2},'transaction':_0x32d54c})[_0xe122('0x15')](function(){var _0x4b8e94=_[_0xe122('0x34')](_0x53555e,function(_0x4f2ec0){_0x4f2ec0[_0xe122('0x5f')]=_0x3892b2;return _0x4f2ec0;});return db['ChatApplication'][_0xe122('0xd3')](_0x4b8e94,{'transaction':_0x32d54c});});}else{_0x2963df=0x194;_0x45f76a=[];}});})['then'](function(){if(_0x2963df!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x3892b2},'order':_0xe122('0x97')})[_0xe122('0x15')](function(_0x1c3790){_0x45f76a=_0x1c3790;});}})['catch'](function(_0x356218){_0x2963df=0x1f4;logger[_0xe122('0x19')](_0x356218[_0xe122('0x118')]);if(_0x356218[_0xe122('0x2c')]){delete _0x356218['name'];}_0x45f76a=_0x356218;})[_0xe122('0x119')](function(){if(_0x45f76a===null){_0x1e9c35[_0xe122('0x1e')](_0x2963df);}else{if(_0x2963df===0x1f4){_0x1e9c35['status'](_0x2963df)[_0xe122('0x2d')](_0x45f76a);}else{_0x1e9c35[_0xe122('0x23')](_0x2963df)['json'](_0x45f76a);}}});};exports[_0xe122('0x11a')]=function(_0x28e161,_0x25ea84){var _0x26980f={};var _0x1fd520={};var _0x9e253e;var _0x3cc701;return db['ChatWebsite'][_0xe122('0x57')]({'where':{'id':_0x28e161[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x25ea84,null))[_0xe122('0x15')](function(_0x1d8b4f){if(_0x1d8b4f){_0x9e253e=_0x1d8b4f;_0x1fd520[_0xe122('0x33')]=_[_0xe122('0x36')](db[_0xe122('0x117')][_0xe122('0x58')]);_0x1fd520[_0xe122('0x35')]=_[_0xe122('0x36')](_0x28e161[_0xe122('0x35')]);_0x1fd520[_0xe122('0x3e')]=_[_0xe122('0x37')](_0x1fd520[_0xe122('0x33')],_0x1fd520[_0xe122('0x35')]);_0x26980f[_0xe122('0x38')]=_['intersection'](_0x1fd520['model'],qs[_0xe122('0x39')](_0x28e161['query'][_0xe122('0x39')]));_0x26980f[_0xe122('0x38')]=_0x26980f['attributes'][_0xe122('0x3a')]?_0x26980f[_0xe122('0x38')]:_0x1fd520[_0xe122('0x33')];_0x26980f['order']=qs['sort'](_0x28e161['query'][_0xe122('0x3d')]);_0x26980f['where']=qs[_0xe122('0x3e')](_[_0xe122('0x3f')](_0x28e161[_0xe122('0x35')],_0x1fd520[_0xe122('0x3e')]));if(_0x28e161[_0xe122('0x35')][_0xe122('0x5a')]){_0x26980f[_0xe122('0x41')]=_[_0xe122('0x40')](_0x26980f[_0xe122('0x41')],{'$or':_[_0xe122('0x34')](_0x26980f['attributes'],function(_0x16dc16){var _0x29c57={};_0x29c57[_0x16dc16]={'$like':'%'+_0x28e161[_0xe122('0x35')]['filter']+'%'};return _0x29c57;})});}_0x26980f=_[_0xe122('0x40')]({},_0x26980f,_0x28e161[_0xe122('0x43')]);return _0x9e253e[_0xe122('0x11a')](_0x26980f);}})[_0xe122('0x15')](function(_0x3ee117){if(_0x3ee117){_0x3cc701=_0x3ee117[_0xe122('0x3a')];if(!_0x28e161[_0xe122('0x35')]['hasOwnProperty'](_0xe122('0x3b'))){_0x26980f[_0xe122('0x20')]=qs[_0xe122('0x20')](_0x28e161['query'][_0xe122('0x20')]);_0x26980f[_0xe122('0x1f')]=qs[_0xe122('0x1f')](_0x28e161[_0xe122('0x35')][_0xe122('0x1f')]);}return _0x9e253e[_0xe122('0x11a')](_0x26980f);}})[_0xe122('0x15')](function(_0x471fc9){if(_0x471fc9){return _0x471fc9?{'count':_0x3cc701,'rows':_0x471fc9}:null;}})[_0xe122('0x15')](respondWithResult(_0x25ea84,null))['catch'](handleError(_0x25ea84,null));};exports['addProactiveActions']=function(_0x4fc99a,_0x3d863e){return db[_0xe122('0x11b')][_0xe122('0x50')]({'where':{'id':_0x4fc99a[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x3d863e,null))[_0xe122('0x15')](function(_0x35cc0e){if(_0x35cc0e){return _0x35cc0e['addProactiveActions'](_0x4fc99a[_0xe122('0x4a')]['ids'],_[_0xe122('0x11c')](_0x4fc99a['body'],[_0xe122('0x5d'),'id'])||{});}})[_0xe122('0x15')](respondWithResult(_0x3d863e,null))['catch'](handleError(_0x3d863e,null));};exports[_0xe122('0x11d')]=function(_0x5236d6,_0x578e52){var _0x152d08={};var _0x4c9b41={};var _0x533a4a;var _0x7b623a;return db[_0xe122('0x2f')][_0xe122('0x57')]({'where':{'id':_0x5236d6[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x578e52,null))[_0xe122('0x15')](function(_0x5716b4){if(_0x5716b4){_0x533a4a=_0x5716b4;_0x4c9b41['model']=_[_0xe122('0x36')](db[_0xe122('0x11e')][_0xe122('0x58')]);_0x4c9b41['query']=_[_0xe122('0x36')](_0x5236d6[_0xe122('0x35')]);_0x4c9b41[_0xe122('0x3e')]=_[_0xe122('0x37')](_0x4c9b41[_0xe122('0x33')],_0x4c9b41[_0xe122('0x35')]);_0x152d08[_0xe122('0x38')]=_[_0xe122('0x37')](_0x4c9b41[_0xe122('0x33')],qs[_0xe122('0x39')](_0x5236d6[_0xe122('0x35')][_0xe122('0x39')]));_0x152d08[_0xe122('0x38')]=_0x152d08['attributes'][_0xe122('0x3a')]?_0x152d08[_0xe122('0x38')]:_0x4c9b41[_0xe122('0x33')];_0x152d08[_0xe122('0x3c')]=qs[_0xe122('0x3d')](_0x5236d6[_0xe122('0x35')][_0xe122('0x3d')]);_0x152d08[_0xe122('0x41')]=qs[_0xe122('0x3e')](_['pick'](_0x5236d6['query'],_0x4c9b41[_0xe122('0x3e')]));if(_0x5236d6[_0xe122('0x35')]['filter']){_0x152d08[_0xe122('0x41')]=_['merge'](_0x152d08[_0xe122('0x41')],{'$or':_[_0xe122('0x34')](_0x152d08[_0xe122('0x38')],function(_0x2a7df5){var _0x1063f2={};_0x1063f2[_0x2a7df5]={'$like':'%'+_0x5236d6[_0xe122('0x35')]['filter']+'%'};return _0x1063f2;})});}_0x152d08=_[_0xe122('0x40')]({},_0x152d08,_0x5236d6[_0xe122('0x43')]);return _0x533a4a[_0xe122('0x11d')](_0x152d08);}})['then'](function(_0xe37058){if(_0xe37058){_0x7b623a=_0xe37058[_0xe122('0x3a')];if(!_0x5236d6[_0xe122('0x35')][_0xe122('0x59')]('nolimit')){_0x152d08[_0xe122('0x20')]=qs['limit'](_0x5236d6['query'][_0xe122('0x20')]);_0x152d08[_0xe122('0x1f')]=qs['offset'](_0x5236d6['query'][_0xe122('0x1f')]);}return _0x533a4a[_0xe122('0x11d')](_0x152d08);}})[_0xe122('0x15')](function(_0x122097){if(_0x122097){return _0x122097?{'count':_0x7b623a,'rows':_0x122097}:null;}})['then'](respondWithResult(_0x578e52,null))[_0xe122('0x46')](handleError(_0x578e52,null));};exports[_0xe122('0x11f')]=function(_0xfeccfc,_0x2655ef){var _0x5de392=_0xfeccfc[_0xe122('0x35')][_0xe122('0x120')]==='false'?_0xe122('0x121'):_0xe122('0x122');return db[_0xe122('0x2f')][_0xe122('0x50')]({'attributes':['id',_0x5de392],'where':{'id':_0xfeccfc[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x2655ef,null))['then'](function(_0x2b10dc){if(_0x2b10dc){var _0x4faffd=_0x2b10dc[_0x5de392];var _0x467e77=_0x4faffd&&_0x4faffd[_0xe122('0x123')]?_0x4faffd[_0xe122('0x123')]:[];_0x2655ef['send']({'fromKey':_[_0xe122('0x75')](_0x4faffd[_0xe122('0x124')])?undefined:_0x4faffd[_0xe122('0x124')],'count':_0x467e77[_0xe122('0x3a')],'rows':_0x467e77});}})[_0xe122('0x46')](handleError(_0x2655ef,null));};exports[_0xe122('0x125')]=function(_0x417aa7,_0x1c59c9){var _0x51f281={'raw':![],'where':{}};var _0x3cb42f={};var _0x20935d={'count':0x0,'rows':[]};return db[_0xe122('0x2f')]['findOne']({'where':{'id':_0x417aa7[_0xe122('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c59c9,null))[_0xe122('0x15')](function(_0x19af0f){if(_0x19af0f){_0x3cb42f[_0xe122('0x33')]=_['keys'](db[_0xe122('0xca')][_0xe122('0x58')]);_0x3cb42f[_0xe122('0x35')]=_[_0xe122('0x36')](_0x417aa7['query']);_0x3cb42f['filters']=_[_0xe122('0x37')](_0x3cb42f[_0xe122('0x33')],_0x3cb42f[_0xe122('0x35')]);_0x51f281['attributes']=_[_0xe122('0x37')](_0x3cb42f['model'],qs[_0xe122('0x39')](_0x417aa7[_0xe122('0x35')][_0xe122('0x39')]));_0x51f281[_0xe122('0x38')]=_0x51f281[_0xe122('0x38')][_0xe122('0x3a')]?_0x51f281['attributes']:_0x3cb42f['model'];if(!_0x417aa7[_0xe122('0x35')][_0xe122('0x59')](_0xe122('0x3b'))){_0x51f281[_0xe122('0x20')]=qs[_0xe122('0x20')](_0x417aa7['query']['limit']);_0x51f281[_0xe122('0x1f')]=qs['offset'](_0x417aa7['query'][_0xe122('0x1f')]);}_0x51f281[_0xe122('0x3c')]=qs[_0xe122('0x3d')](_0x417aa7[_0xe122('0x35')]['sort']);_0x51f281[_0xe122('0x41')]=qs[_0xe122('0x3e')](_[_0xe122('0x3f')](_0x417aa7[_0xe122('0x35')],_0x3cb42f[_0xe122('0x3e')]));_0x51f281[_0xe122('0x41')][_0xe122('0x5f')]=_0x19af0f['id'];if(_0x417aa7[_0xe122('0x35')][_0xe122('0x5a')]){_0x51f281[_0xe122('0x41')]=_[_0xe122('0x40')](_0x51f281[_0xe122('0x41')],{'$or':_[_0xe122('0x34')](_0x51f281[_0xe122('0x38')],function(_0x3ad218){var _0x3f5667={};_0x3f5667[_0x3ad218]={'$like':'%'+_0x417aa7[_0xe122('0x35')][_0xe122('0x5a')]+'%'};return _0x3f5667;})});}_0x51f281=_['merge']({},_0x51f281,_0x417aa7[_0xe122('0x43')]);return db[_0xe122('0xca')]['count']({'where':_0x51f281['where']})[_0xe122('0x15')](function(_0x59ee9a){_0x20935d[_0xe122('0x22')]=_0x59ee9a;if(_0x417aa7[_0xe122('0x35')]['includeAll']){_0x51f281[_0xe122('0x45')]=[{'all':!![]}];}else{_0x51f281[_0xe122('0x45')]=[{'model':db[_0xe122('0x82')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0xe122('0x126'),'required':![]}];}return db['ChatOfflineMessage'][_0xe122('0x5b')](_0x51f281);})[_0xe122('0x15')](function(_0x5d6743){_0x20935d['rows']=_0x5d6743;return _0x20935d;});}})['then'](respondWithFilteredResult(_0x1c59c9,_0x51f281))[_0xe122('0x46')](handleError(_0x1c59c9,null));};exports[_0xe122('0x127')]=function(_0x5e1428,_0x3074fd){return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x5e1428[_0xe122('0x47')]['id']}})['then'](handleEntityNotFound(_0x3074fd,null))['then'](function(_0x1c5e51){if(_0x1c5e51){return _0x1c5e51[_0xe122('0x127')](_0x5e1428['body'][_0xe122('0x5d')],_[_0xe122('0x11c')](_0x5e1428[_0xe122('0x4a')],[_0xe122('0x5d'),'id'])||{})[_0xe122('0x128')](function(_0xa60928){for(var _0x1a5d82=0x0;_0x1a5d82<_0x5e1428[_0xe122('0x4a')][_0xe122('0x5d')][_0xe122('0x3a')];_0x1a5d82+=0x1){socket[_0xe122('0x129')](_0xe122('0x12a'),{'UserId':Number(_0x5e1428[_0xe122('0x4a')][_0xe122('0x5d')][_0x1a5d82]),'ChatWebsiteId':Number(_0x5e1428['params']['id'])});}return _0xa60928;});}})[_0xe122('0x15')](respondWithResult(_0x3074fd,null))[_0xe122('0x46')](handleError(_0x3074fd,null));};exports[_0xe122('0x12b')]=function(_0x356b21,_0x5e3aff){return db[_0xe122('0x2f')][_0xe122('0x50')]({'where':{'id':_0x356b21['params']['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x5e3aff,null))['then'](function(_0x1b4059){if(_0x1b4059){return _0x1b4059[_0xe122('0x12b')](_0x356b21[_0xe122('0x35')]['ids'])[_0xe122('0x15')](function(){if(_[_0xe122('0x12c')](_0x356b21[_0xe122('0x35')][_0xe122('0x5d')])){for(var _0xc955d=0x0;_0xc955d<_0x356b21[_0xe122('0x35')][_0xe122('0x5d')][_0xe122('0x3a')];_0xc955d+=0x1){socket[_0xe122('0x129')](_0xe122('0x12d'),{'UserId':Number(_0x356b21[_0xe122('0x35')]['ids'][_0xc955d]),'ChatWebsiteId':Number(_0x356b21['params']['id'])});}}else{socket[_0xe122('0x129')](_0xe122('0x12d'),{'UserId':Number(_0x356b21['query'][_0xe122('0x5d')]),'ChatWebsiteId':Number(_0x356b21[_0xe122('0x47')]['id'])});}});}})[_0xe122('0x15')](respondWithStatusCode(_0x5e3aff,null))[_0xe122('0x46')](handleError(_0x5e3aff,null));};exports['getAgents']=function(_0x4b971c,_0x29c210){var _0x3e8331={};var _0x1e6406={};var _0x3a4738;var _0x377811;return db[_0xe122('0x2f')][_0xe122('0x57')]({'where':{'id':_0x4b971c[_0xe122('0x47')]['id']}})[_0xe122('0x15')](handleEntityNotFound(_0x29c210,null))[_0xe122('0x15')](function(_0x5ec69e){if(_0x5ec69e){_0x3a4738=_0x5ec69e;_0x1e6406[_0xe122('0x33')]=_[_0xe122('0x36')](db[_0xe122('0xb7')]['rawAttributes']);_0x1e6406['query']=_[_0xe122('0x36')](_0x4b971c[_0xe122('0x35')]);_0x1e6406['filters']=_[_0xe122('0x37')](_0x1e6406[_0xe122('0x33')],_0x1e6406[_0xe122('0x35')]);_0x3e8331[_0xe122('0x38')]=_[_0xe122('0x37')](_0x1e6406[_0xe122('0x33')],qs[_0xe122('0x39')](_0x4b971c[_0xe122('0x35')]['fields']));_0x3e8331[_0xe122('0x38')]=_0x3e8331[_0xe122('0x38')][_0xe122('0x3a')]?_0x3e8331[_0xe122('0x38')]:_0x1e6406[_0xe122('0x33')];_0x3e8331[_0xe122('0x3c')]=qs[_0xe122('0x3d')](_0x4b971c[_0xe122('0x35')]['sort']);_0x3e8331[_0xe122('0x41')]=qs[_0xe122('0x3e')](_[_0xe122('0x3f')](_0x4b971c[_0xe122('0x35')],_0x1e6406[_0xe122('0x3e')]));if(_0x4b971c[_0xe122('0x35')][_0xe122('0x5a')]){_0x3e8331[_0xe122('0x41')]=_[_0xe122('0x40')](_0x3e8331[_0xe122('0x41')],{'$or':_[_0xe122('0x34')](_0x3e8331[_0xe122('0x38')],function(_0x2b6a63){var _0x6c4a13={};_0x6c4a13[_0x2b6a63]={'$like':'%'+_0x4b971c[_0xe122('0x35')][_0xe122('0x5a')]+'%'};return _0x6c4a13;})});}_0x3e8331=_[_0xe122('0x40')]({},_0x3e8331,_0x4b971c[_0xe122('0x43')]);return _0x3a4738[_0xe122('0x12e')](_0x3e8331);}})['then'](function(_0x24e029){if(_0x24e029){_0x377811=_0x24e029['length'];if(!_0x4b971c[_0xe122('0x35')][_0xe122('0x59')](_0xe122('0x3b'))){_0x3e8331[_0xe122('0x20')]=qs[_0xe122('0x20')](_0x4b971c[_0xe122('0x35')][_0xe122('0x20')]);_0x3e8331[_0xe122('0x1f')]=qs['offset'](_0x4b971c['query'][_0xe122('0x1f')]);}return _0x3a4738[_0xe122('0x12e')](_0x3e8331);}})[_0xe122('0x15')](function(_0x3b7e6f){if(_0x3b7e6f){return _0x3b7e6f?{'count':_0x377811,'rows':_0x3b7e6f}:null;}})[_0xe122('0x15')](respondWithResult(_0x29c210,null))[_0xe122('0x46')](handleError(_0x29c210,null));}; \ No newline at end of file +var _0x1e3c=['sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','toPairsIn','subjectOffline','email','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','virtual','increment','chatLicenseExceeded','push','all','some','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','remote','x-real-ip','connection','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','addApplications','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','update','get','ChatWebsites','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','keys','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','params','ChatWebsiteId','findOne','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','download','getAvatar','server/files/images/avatars/default_avatar.png','root','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','CmContact','Contacts','DESC','ChatApplication','account','applications','list','orderBy','priority','asc','Applications','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','%s\x20%s\x20%s','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','offline','ListId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','openNewInteraction','sequelize','transaction','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail'];(function(_0x4f24e8,_0xe02072){var _0x15e2b8=function(_0x5ca31f){while(--_0x5ca31f){_0x4f24e8['push'](_0x4f24e8['shift']());}};_0x15e2b8(++_0xe02072);}(_0x1e3c,0x178));var _0xc1e3=function(_0x1d9088,_0x1cc0bd){_0x1d9088=_0x1d9088-0x0;var _0x4ee896=_0x1e3c[_0x1d9088];return _0x4ee896;};'use strict';var BPromise=require(_0xc1e3('0x0'));var Mustache=require(_0xc1e3('0x1'));var util=require(_0xc1e3('0x2'));var path=require(_0xc1e3('0x3'));var ejs=require(_0xc1e3('0x4'));var fs=require('fs');var fs_extra=require(_0xc1e3('0x5'));var _=require(_0xc1e3('0x6'));var querystring=require(_0xc1e3('0x7'));var Redis=require(_0xc1e3('0x8'));var qs=require(_0xc1e3('0x9'));var logger=require(_0xc1e3('0xa'))(_0xc1e3('0xb'));var config=require(_0xc1e3('0xc'));var url=require(_0xc1e3('0xd'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc1e3('0xe')](config[_0xc1e3('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xc1e3('0x10'))(new Redis(config[_0xc1e3('0xf')]));require('./chatWebsite.socket')[_0xc1e3('0x11')](socket);var htmlToText=require('html-to-text');var jayson=require(_0xc1e3('0x12'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc1e3('0x13')][_0xc1e3('0x14')]({'port':0x232a});var client9003=jayson[_0xc1e3('0x13')][_0xc1e3('0x14')]({'port':0x232b});var client9001=jayson['client'][_0xc1e3('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x10adb6,_0x509630,_0x53462b,_0x4765df){return new BPromise(function(_0x3adac0,_0x249875){var _0x5814a1=_0x4765df||client;return _0x5814a1[_0xc1e3('0x15')](_0x10adb6,_0x53462b)[_0xc1e3('0x16')](function(_0x41b544){logger[_0xc1e3('0x17')](_0xc1e3('0x18'),_0x509630,_0xc1e3('0x19'));logger[_0xc1e3('0x1a')](_0xc1e3('0x1b'),_0x509630,_0xc1e3('0x19'),JSON['stringify'](_0x41b544));if(_0x41b544[_0xc1e3('0x1c')]){if(_0x41b544['error'][_0xc1e3('0x1d')]===0x1f4){logger['error'](_0xc1e3('0x18'),_0x509630,_0x41b544[_0xc1e3('0x1c')]['message']);return _0x249875(_0x41b544['error'][_0xc1e3('0x1e')]);}logger['error'](_0xc1e3('0x18'),_0x509630,_0x41b544[_0xc1e3('0x1c')]['message']);return _0x3adac0(_0x41b544[_0xc1e3('0x1c')][_0xc1e3('0x1e')]);}else{logger[_0xc1e3('0x17')](_0xc1e3('0x18'),_0x509630,'request\x20sent');_0x3adac0(_0x41b544[_0xc1e3('0x1f')][_0xc1e3('0x1e')]);}})[_0xc1e3('0x20')](function(_0x28066a){logger[_0xc1e3('0x1c')](_0xc1e3('0x18'),_0x509630,_0x28066a);_0x249875(_0x28066a);});});}function respondWithStatusCode(_0x20daf7,_0x4eb8e2){_0x4eb8e2=_0x4eb8e2||0xcc;return function(_0x104129){if(_0x104129){return _0x20daf7[_0xc1e3('0x21')](_0x4eb8e2);}return _0x20daf7[_0xc1e3('0x22')](_0x4eb8e2)['end']();};}function respondWithResult(_0x472859,_0x4bcd73){_0x4bcd73=_0x4bcd73||0xc8;return function(_0x38fdfa){if(_0x38fdfa){return _0x472859[_0xc1e3('0x22')](_0x4bcd73)[_0xc1e3('0x23')](_0x38fdfa);}};}function respondWithFilteredResult(_0x496959,_0x491143){return function(_0x465527){if(_0x465527){var _0x17837e=typeof _0x491143[_0xc1e3('0x24')]===_0xc1e3('0x25')&&typeof _0x491143['limit']==='undefined';var _0x1c6116=_0x465527['count'];var _0x5aef7d=_0x17837e?0x0:_0x491143[_0xc1e3('0x24')];var _0x68ac43=_0x17837e?_0x465527[_0xc1e3('0x26')]:_0x491143[_0xc1e3('0x24')]+_0x491143[_0xc1e3('0x27')];var _0x346e29;if(_0x68ac43>=_0x1c6116){_0x68ac43=_0x1c6116;_0x346e29=0xc8;}else{_0x346e29=0xce;}_0x496959[_0xc1e3('0x22')](_0x346e29);return _0x496959[_0xc1e3('0x28')]('Content-Range',_0x5aef7d+'-'+_0x68ac43+'/'+_0x1c6116)['json'](_0x465527);}return null;};}function saveUpdates(_0x44299a){return function(_0x476c5c){if(_0x476c5c){return _0x476c5c[_0xc1e3('0x29')](_0x44299a)[_0xc1e3('0x16')](function(_0x14fcac){return _0x14fcac;});}return null;};}function removeEntity(_0x4297a5){return function(_0x3eee41){if(_0x3eee41){return _0x3eee41['destroy']()[_0xc1e3('0x16')](function(){var _0x58a4e0=_0x3eee41[_0xc1e3('0x2a')]({'plain':!![]});var _0x535f9f=_0xc1e3('0x2b');return db[_0xc1e3('0x2c')]['destroy']({'where':{'type':_0x535f9f,'resourceId':_0x58a4e0['id']}})[_0xc1e3('0x16')](function(){return _0x3eee41;});})[_0xc1e3('0x16')](function(){_0x4297a5[_0xc1e3('0x22')](0xcc)[_0xc1e3('0x2d')]();});}};}function handleEntityNotFound(_0x45ed64){return function(_0x3bf1fe){if(!_0x3bf1fe){_0x45ed64['sendStatus'](0x194);}return _0x3bf1fe;};}function handleError(_0x4da27f,_0x15290f){_0x15290f=_0x15290f||0x1f4;return function(_0x347603){logger[_0xc1e3('0x1c')](_0x347603[_0xc1e3('0x2e')]);if(_0x347603[_0xc1e3('0x2f')]){delete _0x347603[_0xc1e3('0x2f')];}_0x4da27f[_0xc1e3('0x22')](_0x15290f)[_0xc1e3('0x30')](_0x347603);};}exports[_0xc1e3('0x31')]=function(_0x337674,_0x4f5cb8){var _0xe8666={'include':[{'model':db[_0xc1e3('0x32')],'as':_0xc1e3('0x33')}]},_0x20a813={},_0x2b6359={'count':0x0,'rows':[]};var _0x1d184c=_[_0xc1e3('0x34')](db[_0xc1e3('0x35')][_0xc1e3('0x36')],function(_0x3f65fd){return{'name':_0x3f65fd[_0xc1e3('0x37')],'type':_0x3f65fd[_0xc1e3('0x38')][_0xc1e3('0x39')]};});_0x20a813[_0xc1e3('0x3a')]=_[_0xc1e3('0x34')](_0x1d184c,'name');_0x20a813[_0xc1e3('0x3b')]=_['keys'](_0x337674[_0xc1e3('0x3b')]);_0x20a813[_0xc1e3('0x3c')]=_[_0xc1e3('0x3d')](_0x20a813['model'],_0x20a813[_0xc1e3('0x3b')]);_0xe8666[_0xc1e3('0x3e')]=_[_0xc1e3('0x3d')](_0x20a813[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x3f')]));_0xe8666[_0xc1e3('0x3e')]=_0xe8666['attributes']['length']?_0xe8666[_0xc1e3('0x3e')]:_0x20a813[_0xc1e3('0x3a')];if(!_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x40')](_0xc1e3('0x41'))){_0xe8666['limit']=qs[_0xc1e3('0x27')](_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x27')]);_0xe8666['offset']=qs[_0xc1e3('0x24')](_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}_0xe8666[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x43')]);_0xe8666[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_[_0xc1e3('0x45')](_0x337674[_0xc1e3('0x3b')],_0x20a813[_0xc1e3('0x3c')]),_0x1d184c);if(_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x46')]){_0xe8666[_0xc1e3('0x44')]=_[_0xc1e3('0x47')](_0xe8666[_0xc1e3('0x44')],{'$or':_[_0xc1e3('0x34')](_0x1d184c,function(_0x16cc1f){if(_0x16cc1f[_0xc1e3('0x38')]!==_0xc1e3('0x48')){var _0x249023={};_0x249023[_0x16cc1f[_0xc1e3('0x2f')]]={'$like':'%'+_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x46')]+'%'};return _0x249023;}})});}_0xe8666=_[_0xc1e3('0x47')]({},_0xe8666,_0x337674['options']);var _0x558d13={'where':_0xe8666['where']};return db['ChatWebsite'][_0xc1e3('0x26')](_0x558d13)[_0xc1e3('0x16')](function(_0x27dbc0){_0x2b6359['count']=_0x27dbc0;if(_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x49')]){_0xe8666['include']=[{'all':!![]}];}return db[_0xc1e3('0x35')][_0xc1e3('0x4a')](_0xe8666);})[_0xc1e3('0x16')](function(_0x3c5a0c){_0x2b6359['rows']=_0x3c5a0c;return _0x2b6359;})[_0xc1e3('0x16')](respondWithFilteredResult(_0x4f5cb8,_0xe8666))['catch'](handleError(_0x4f5cb8,null));};exports['show']=function(_0x118d28,_0x1c4a65){var _0x1b3915={'raw':![],'where':{'id':_0x118d28['params']['id']},'include':[{'model':db[_0xc1e3('0x32')],'as':_0xc1e3('0x33')}]},_0x4c30bf={};_0x4c30bf[_0xc1e3('0x3a')]=_[_0xc1e3('0x4b')](db[_0xc1e3('0x35')][_0xc1e3('0x36')]);_0x4c30bf[_0xc1e3('0x3b')]=_[_0xc1e3('0x4b')](_0x118d28[_0xc1e3('0x3b')]);_0x4c30bf['filters']=_['intersection'](_0x4c30bf['model'],_0x4c30bf[_0xc1e3('0x3b')]);_0x1b3915['attributes']=_[_0xc1e3('0x3d')](_0x4c30bf[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0x118d28[_0xc1e3('0x3b')][_0xc1e3('0x3f')]));_0x1b3915[_0xc1e3('0x3e')]=_0x1b3915[_0xc1e3('0x3e')][_0xc1e3('0x4c')]?_0x1b3915[_0xc1e3('0x3e')]:_0x4c30bf[_0xc1e3('0x3a')];if(_0x118d28[_0xc1e3('0x3b')][_0xc1e3('0x49')]){_0x1b3915[_0xc1e3('0x4d')]=[{'all':!![]}];}_0x1b3915=_['merge']({},_0x1b3915,_0x118d28[_0xc1e3('0x4e')]);return db[_0xc1e3('0x35')][_0xc1e3('0x4f')](_0x1b3915)[_0xc1e3('0x16')](handleEntityNotFound(_0x1c4a65,null))[_0xc1e3('0x16')](respondWithResult(_0x1c4a65,null))[_0xc1e3('0x20')](handleError(_0x1c4a65,null));};exports['create']=function(_0xe108f1,_0x58fa1c){return db[_0xc1e3('0x35')][_0xc1e3('0x50')](_0xe108f1[_0xc1e3('0x51')],{})[_0xc1e3('0x16')](function(_0x3492d2){var _0x2a2882=_0xe108f1[_0xc1e3('0x52')][_0xc1e3('0x2a')]({'plain':!![]});if(!_0x2a2882)throw new Error(_0xc1e3('0x53'));if(_0x2a2882[_0xc1e3('0x54')]===_0xc1e3('0x52')){var _0x3dd0b8=_0x3492d2['get']({'plain':!![]});var _0x376e5d=_0xc1e3('0x2b');return db[_0xc1e3('0x55')][_0xc1e3('0x4f')]({'where':{'name':_0x376e5d,'userProfileId':_0x2a2882[_0xc1e3('0x56')]},'raw':!![]})['then'](function(_0x78898d){if(_0x78898d&&_0x78898d['autoAssociation']===0x0){return db[_0xc1e3('0x2c')][_0xc1e3('0x50')]({'name':_0x3dd0b8[_0xc1e3('0x2f')],'resourceId':_0x3dd0b8['id'],'type':_0x78898d['name'],'sectionId':_0x78898d['id']},{})[_0xc1e3('0x16')](function(){return _0x3492d2;});}else{return _0x3492d2;}})[_0xc1e3('0x20')](function(_0x591994){logger[_0xc1e3('0x1c')](_0xc1e3('0x57'),_0x591994);throw _0x591994;});}return _0x3492d2;})['then'](respondWithResult(_0x58fa1c,0xc9))[_0xc1e3('0x20')](handleError(_0x58fa1c,null));};exports[_0xc1e3('0x29')]=function(_0x3e964e,_0x18601b){if(_0x3e964e[_0xc1e3('0x51')]['id']){delete _0x3e964e[_0xc1e3('0x51')]['id'];}return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x3e964e['params']['id']},'include':[{'model':db[_0xc1e3('0x32')],'as':_0xc1e3('0x33')}]})[_0xc1e3('0x16')](handleEntityNotFound(_0x18601b,null))[_0xc1e3('0x16')](saveUpdates(_0x3e964e[_0xc1e3('0x51')],null))[_0xc1e3('0x16')](respondWithResult(_0x18601b,null))[_0xc1e3('0x20')](handleError(_0x18601b,null));};exports[_0xc1e3('0x58')]=function(_0x46f5f0,_0x4507b2){return db[_0xc1e3('0x35')]['find']({'where':{'id':_0x46f5f0['params']['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x4507b2,null))['then'](removeEntity(_0x4507b2,null))['catch'](handleError(_0x4507b2,null));};exports['describe']=function(_0x2efa68,_0x223bb7){return db[_0xc1e3('0x35')][_0xc1e3('0x59')]()['then'](respondWithResult(_0x223bb7,null))[_0xc1e3('0x20')](handleError(_0x223bb7,null));};exports[_0xc1e3('0x5a')]=function(_0x4c0f93,_0x3c6fbe){if(_0x4c0f93[_0xc1e3('0x51')]['id']){delete _0x4c0f93[_0xc1e3('0x51')]['id'];}return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x4c0f93[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x3c6fbe,null))[_0xc1e3('0x16')](function(_0x1b936f){if(_0x1b936f){_0x4c0f93[_0xc1e3('0x51')][_0xc1e3('0x5c')]=_0x1b936f['id'];return db['Disposition'][_0xc1e3('0x50')](_0x4c0f93[_0xc1e3('0x51')]);}})[_0xc1e3('0x16')](respondWithResult(_0x3c6fbe,null))['catch'](handleError(_0x3c6fbe,null));};exports['getDispositions']=function(_0x207e4e,_0x789146){var _0x24b9bf={'raw':![],'where':{}};var _0x3a2d4d={};var _0x40c3cd={'count':0x0,'rows':[]};return db[_0xc1e3('0x35')][_0xc1e3('0x5d')]({'where':{'id':_0x207e4e[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x789146,null))[_0xc1e3('0x16')](function(_0x225a37){if(_0x225a37){_0x3a2d4d[_0xc1e3('0x3a')]=_[_0xc1e3('0x4b')](db['Disposition']['rawAttributes']);_0x3a2d4d['query']=_[_0xc1e3('0x4b')](_0x207e4e[_0xc1e3('0x3b')]);_0x3a2d4d[_0xc1e3('0x3c')]=_[_0xc1e3('0x3d')](_0x3a2d4d[_0xc1e3('0x3a')],_0x3a2d4d[_0xc1e3('0x3b')]);_0x24b9bf[_0xc1e3('0x3e')]=_['intersection'](_0x3a2d4d['model'],qs[_0xc1e3('0x3f')](_0x207e4e[_0xc1e3('0x3b')]['fields']));_0x24b9bf[_0xc1e3('0x3e')]=_0x24b9bf[_0xc1e3('0x3e')]['length']?_0x24b9bf[_0xc1e3('0x3e')]:_0x3a2d4d[_0xc1e3('0x3a')];if(!_0x207e4e['query'][_0xc1e3('0x40')](_0xc1e3('0x41'))){_0x24b9bf['limit']=qs[_0xc1e3('0x27')](_0x207e4e[_0xc1e3('0x3b')]['limit']);_0x24b9bf[_0xc1e3('0x24')]=qs['offset'](_0x207e4e[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}_0x24b9bf[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0x207e4e[_0xc1e3('0x3b')]['sort']);_0x24b9bf['where']=qs[_0xc1e3('0x3c')](_[_0xc1e3('0x45')](_0x207e4e[_0xc1e3('0x3b')],_0x3a2d4d[_0xc1e3('0x3c')]));_0x24b9bf[_0xc1e3('0x44')][_0xc1e3('0x5c')]=_0x225a37['id'];if(_0x207e4e[_0xc1e3('0x3b')][_0xc1e3('0x46')]){_0x24b9bf['where']=_[_0xc1e3('0x47')](_0x24b9bf[_0xc1e3('0x44')],{'$or':_[_0xc1e3('0x34')](_0x24b9bf['attributes'],function(_0x636b6b){var _0x56055b={};_0x56055b[_0x636b6b]={'$like':'%'+_0x207e4e[_0xc1e3('0x3b')][_0xc1e3('0x46')]+'%'};return _0x56055b;})});}_0x24b9bf=_[_0xc1e3('0x47')]({},_0x24b9bf,_0x207e4e[_0xc1e3('0x4e')]);return db[_0xc1e3('0x5e')][_0xc1e3('0x26')]({'where':_0x24b9bf[_0xc1e3('0x44')]})[_0xc1e3('0x16')](function(_0xf44f45){_0x40c3cd[_0xc1e3('0x26')]=_0xf44f45;if(_0x207e4e[_0xc1e3('0x3b')][_0xc1e3('0x49')]){_0x24b9bf[_0xc1e3('0x4d')]=[{'all':!![]}];}return db[_0xc1e3('0x5e')]['findAll'](_0x24b9bf);})[_0xc1e3('0x16')](function(_0x770ee6){_0x40c3cd[_0xc1e3('0x5f')]=_0x770ee6;return _0x40c3cd;});}})['then'](respondWithFilteredResult(_0x789146,_0x24b9bf))['catch'](handleError(_0x789146,null));};exports[_0xc1e3('0x60')]=function(_0x2ca93d,_0x27dd8f){return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x2ca93d[_0xc1e3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x27dd8f,null))[_0xc1e3('0x16')](function(_0x43c9ec){if(_0x43c9ec){return _0x43c9ec[_0xc1e3('0x60')](_0x2ca93d[_0xc1e3('0x3b')][_0xc1e3('0x61')]);}})[_0xc1e3('0x16')](respondWithStatusCode(_0x27dd8f,null))[_0xc1e3('0x20')](handleError(_0x27dd8f,null));};exports[_0xc1e3('0x62')]=function(_0x17697d,_0x467502){if(_0x17697d[_0xc1e3('0x51')]['id']){delete _0x17697d['body']['id'];}return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x17697d[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x467502,null))[_0xc1e3('0x16')](function(_0x187841){if(_0x187841){_0x17697d[_0xc1e3('0x51')]['ChatWebsiteId']=_0x187841['id'];return db[_0xc1e3('0x63')][_0xc1e3('0x50')](_0x17697d[_0xc1e3('0x51')]);}})[_0xc1e3('0x16')](respondWithResult(_0x467502,null))[_0xc1e3('0x20')](handleError(_0x467502,null));};exports[_0xc1e3('0x64')]=function(_0xf2225d,_0x44dc46){var _0x356b25={'raw':![],'where':{}};var _0x270752={};var _0x5618f1={'count':0x0,'rows':[]};return db[_0xc1e3('0x35')][_0xc1e3('0x5d')]({'where':{'id':_0xf2225d[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x44dc46,null))[_0xc1e3('0x16')](function(_0x46399b){if(_0x46399b){_0x270752[_0xc1e3('0x3a')]=_[_0xc1e3('0x4b')](db[_0xc1e3('0x63')][_0xc1e3('0x36')]);_0x270752['query']=_[_0xc1e3('0x4b')](_0xf2225d['query']);_0x270752[_0xc1e3('0x3c')]=_['intersection'](_0x270752[_0xc1e3('0x3a')],_0x270752[_0xc1e3('0x3b')]);_0x356b25[_0xc1e3('0x3e')]=_[_0xc1e3('0x3d')](_0x270752[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0xf2225d[_0xc1e3('0x3b')][_0xc1e3('0x3f')]));_0x356b25[_0xc1e3('0x3e')]=_0x356b25[_0xc1e3('0x3e')][_0xc1e3('0x4c')]?_0x356b25[_0xc1e3('0x3e')]:_0x270752['model'];if(!_0xf2225d[_0xc1e3('0x3b')]['hasOwnProperty'](_0xc1e3('0x41'))){_0x356b25[_0xc1e3('0x27')]=qs[_0xc1e3('0x27')](_0xf2225d[_0xc1e3('0x3b')]['limit']);_0x356b25['offset']=qs[_0xc1e3('0x24')](_0xf2225d[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}_0x356b25[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0xf2225d[_0xc1e3('0x3b')][_0xc1e3('0x43')]);_0x356b25[_0xc1e3('0x44')]=qs['filters'](_[_0xc1e3('0x45')](_0xf2225d[_0xc1e3('0x3b')],_0x270752[_0xc1e3('0x3c')]));_0x356b25[_0xc1e3('0x44')][_0xc1e3('0x5c')]=_0x46399b['id'];if(_0xf2225d[_0xc1e3('0x3b')]['filter']){_0x356b25[_0xc1e3('0x44')]=_['merge'](_0x356b25['where'],{'$or':_['map'](_0x356b25['attributes'],function(_0x2b714f){var _0x4d321d={};_0x4d321d[_0x2b714f]={'$like':'%'+_0xf2225d['query']['filter']+'%'};return _0x4d321d;})});}_0x356b25=_[_0xc1e3('0x47')]({},_0x356b25,_0xf2225d[_0xc1e3('0x4e')]);return db[_0xc1e3('0x63')][_0xc1e3('0x26')]({'where':_0x356b25[_0xc1e3('0x44')]})['then'](function(_0x35113f){_0x5618f1[_0xc1e3('0x26')]=_0x35113f;if(_0xf2225d['query'][_0xc1e3('0x49')]){_0x356b25['include']=[{'all':!![]}];}return db[_0xc1e3('0x63')][_0xc1e3('0x4a')](_0x356b25);})[_0xc1e3('0x16')](function(_0x188a1e){_0x5618f1[_0xc1e3('0x5f')]=_0x188a1e;return _0x5618f1;});}})[_0xc1e3('0x16')](respondWithFilteredResult(_0x44dc46,_0x356b25))[_0xc1e3('0x20')](handleError(_0x44dc46,null));};exports[_0xc1e3('0x65')]=function(_0x1fc52b,_0x47da25){return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x1fc52b[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x47da25,null))['then'](function(_0x2cecd4){if(_0x2cecd4){return _0x2cecd4['removeAnswers'](_0x1fc52b[_0xc1e3('0x3b')]['ids']);}})[_0xc1e3('0x16')](respondWithStatusCode(_0x47da25,null))[_0xc1e3('0x20')](handleError(_0x47da25,null));};exports[_0xc1e3('0x66')]=function(_0x3b682f,_0x30ea8b){_0x3b682f[_0xc1e3('0x51')][_0xc1e3('0x67')]=_0x3b682f[_0xc1e3('0x68')][_0xc1e3('0x69')];return db[_0xc1e3('0x35')]['find']({'where':{'id':_0x3b682f['params']['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x30ea8b,null))[_0xc1e3('0x16')](saveUpdates(_0x3b682f[_0xc1e3('0x51')],null))[_0xc1e3('0x16')](respondWithResult(_0x30ea8b,null))[_0xc1e3('0x20')](handleError(_0x30ea8b,null));};exports[_0xc1e3('0x6a')]=function(_0x27e93c,_0x4e584e){_0x27e93c[_0xc1e3('0x51')][_0xc1e3('0x6b')]=_0x27e93c[_0xc1e3('0x68')][_0xc1e3('0x69')];return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x27e93c[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x4e584e,null))['then'](saveUpdates(_0x27e93c[_0xc1e3('0x51')],null))[_0xc1e3('0x16')](respondWithResult(_0x4e584e,null))['catch'](handleError(_0x4e584e,null));};exports['addCustomerAvatar']=function(_0x2dfb6d,_0x5ef432){_0x2dfb6d[_0xc1e3('0x51')][_0xc1e3('0x6c')]=_0x2dfb6d['file'][_0xc1e3('0x69')];return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x2dfb6d[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x5ef432,null))[_0xc1e3('0x16')](saveUpdates(_0x2dfb6d[_0xc1e3('0x51')],null))[_0xc1e3('0x16')](respondWithResult(_0x5ef432,null))[_0xc1e3('0x20')](handleError(_0x5ef432,null));};exports[_0xc1e3('0x6d')]=function(_0x460659,_0x329419){_0x460659['body'][_0xc1e3('0x6e')]=_0x460659['file'][_0xc1e3('0x69')];return db['ChatWebsite'][_0xc1e3('0x4f')]({'where':{'id':_0x460659[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x329419,null))[_0xc1e3('0x16')](saveUpdates(_0x460659[_0xc1e3('0x51')],null))[_0xc1e3('0x16')](respondWithResult(_0x329419,null))['catch'](handleError(_0x329419,null));};exports['getLogo']=function(_0x1b6499,_0x507605){var _0x6c839=path[_0xc1e3('0x6f')](config['root'],_0xc1e3('0x70'));var _0xcdddc2={'where':{'id':_0x1b6499[_0xc1e3('0x5b')]['id']},'attributes':['id',_0xc1e3('0x67')],'raw':!![]};var _0x531c1d=![];return require(_0xc1e3('0x71'))[_0xc1e3('0x72')]()['then'](function(_0x3ad8d1){if(_0x3ad8d1){_0x531c1d=_0x3ad8d1[_0xc1e3('0x73')];}})[_0xc1e3('0x16')](function(){return db[_0xc1e3('0x35')][_0xc1e3('0x4f')](_0xcdddc2);})[_0xc1e3('0x16')](handleEntityNotFound(_0x507605,null))[_0xc1e3('0x16')](function(_0x5c7e0a){if(_0x5c7e0a){if(!_[_0xc1e3('0x74')](_0x5c7e0a[_0xc1e3('0x67')])){if(fs[_0xc1e3('0x75')](path[_0xc1e3('0x6f')](config['root'],'server/files/images/logos/',_0x5c7e0a[_0xc1e3('0x67')]))&&_0x531c1d){_0x6c839=path[_0xc1e3('0x6f')](config['root'],'server/files/images/logos/',_0x5c7e0a[_0xc1e3('0x67')]);}}return _0x507605[_0xc1e3('0x76')](_0x6c839);}})[_0xc1e3('0x20')](handleError(_0x507605,null));};exports[_0xc1e3('0x77')]=function(_0x5b1139,_0x3dd27a){var _0x5b254a=path[_0xc1e3('0x6f')](config['root'],_0xc1e3('0x78'));var _0x47832b={'where':{'id':_0x5b1139[_0xc1e3('0x5b')]['id']},'attributes':['id',_0xc1e3('0x6b')],'raw':!![]};return db['ChatWebsite'][_0xc1e3('0x4f')](_0x47832b)[_0xc1e3('0x16')](handleEntityNotFound(_0x3dd27a,null))[_0xc1e3('0x16')](function(_0x3259b1){if(_0x3259b1){if(!_[_0xc1e3('0x74')](_0x3259b1[_0xc1e3('0x6b')])){if(fs[_0xc1e3('0x75')](path['join'](config[_0xc1e3('0x79')],_0xc1e3('0x7a'),_0x3259b1[_0xc1e3('0x6b')]))){_0x5b254a=path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],_0xc1e3('0x7a'),_0x3259b1[_0xc1e3('0x6b')]);}}return _0x3dd27a[_0xc1e3('0x76')](_0x5b254a);}})['catch'](handleError(_0x3dd27a,null));};exports['getCustomerAvatar']=function(_0x11bdda,_0x103b98){var _0x4bcac2=path[_0xc1e3('0x6f')](config['root'],_0xc1e3('0x7b'));var _0x1663bd={'where':{'id':_0x11bdda[_0xc1e3('0x5b')]['id']},'attributes':['id',_0xc1e3('0x6c'),'showCustomerAvatar'],'raw':!![]};return db[_0xc1e3('0x35')][_0xc1e3('0x4f')](_0x1663bd)[_0xc1e3('0x16')](handleEntityNotFound(_0x103b98,null))[_0xc1e3('0x16')](function(_0x31d96f){if(_0x31d96f){if(!_[_0xc1e3('0x74')](_0x31d96f[_0xc1e3('0x6c')])){if(fs[_0xc1e3('0x75')](path['join'](config[_0xc1e3('0x79')],'server/files/images/avatars/',_0x31d96f[_0xc1e3('0x6c')]))&&_0x31d96f['showCustomerAvatar']){_0x4bcac2=path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],_0xc1e3('0x7a'),_0x31d96f[_0xc1e3('0x6c')]);}}return _0x103b98[_0xc1e3('0x76')](_0x4bcac2);}})[_0xc1e3('0x20')](handleError(_0x103b98,null));};exports[_0xc1e3('0x7c')]=function(_0x215b93,_0x209b7c){var _0x591cf0=path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],_0xc1e3('0x7d'));var _0x9e3b6d={'where':{'id':_0x215b93[_0xc1e3('0x5b')]['id']},'attributes':['id',_0xc1e3('0x6e')],'raw':!![]};return db[_0xc1e3('0x35')][_0xc1e3('0x4f')](_0x9e3b6d)[_0xc1e3('0x16')](handleEntityNotFound(_0x209b7c,null))[_0xc1e3('0x16')](function(_0x3d8aa8){if(_0x3d8aa8){if(!_[_0xc1e3('0x74')](_0x3d8aa8['systemAvatar'])){if(fs[_0xc1e3('0x75')](path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],_0xc1e3('0x7a'),_0x3d8aa8['systemAvatar']))){_0x591cf0=path['join'](config[_0xc1e3('0x79')],_0xc1e3('0x7a'),_0x3d8aa8[_0xc1e3('0x6e')]);}}return _0x209b7c['download'](_0x591cf0);}})['catch'](handleError(_0x209b7c,null));};exports[_0xc1e3('0x7e')]=function(_0x279c8f,_0x582f63){var _0x18137b=require('user-agent-parser');var _0xd53e46=new _0x18137b();var _0x465019=_0xd53e46[_0xc1e3('0x7f')](_0x279c8f[_0xc1e3('0x80')][_0xc1e3('0x81')])[_0xc1e3('0x82')]();var _0x3ed6d7={'body':_0x279c8f['body'],'channel':_0xc1e3('0x83')};var _0xcf23bc=[];var _0x3514a5=[];var _0xebc1c2={};var _0x146d28=![];return db['CmContact'][_0xc1e3('0x59')]()[_0xc1e3('0x16')](function(_0x47392f){if(!_0x47392f){throw new db[(_0xc1e3('0x84'))][(_0xc1e3('0x85'))](_0xc1e3('0x86'));}_0xcf23bc=_[_0xc1e3('0x87')](_[_0xc1e3('0x4b')](_0x47392f),[_0xc1e3('0x88'),_0xc1e3('0x89')]);_0x3514a5=_[_0xc1e3('0x87')](_[_0xc1e3('0x4b')](_0x47392f),[_0xc1e3('0x88'),'updatedAt',_0xc1e3('0x8a'),'ListId']);if(_0x279c8f[_0xc1e3('0x51')]['id']){delete _0x279c8f[_0xc1e3('0x51')]['id'];}if(_[_0xc1e3('0x74')](_0x279c8f[_0xc1e3('0x51')]['from'])){throw new db[(_0xc1e3('0x84'))][(_0xc1e3('0x85'))](_0xc1e3('0x8b'));}if(_['isNil'](_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x51')])||_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x51')]===''){throw new db[(_0xc1e3('0x84'))]['ValidationError'](_0xc1e3('0x8c'));}if(_[_0xc1e3('0x74')](_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x8d')])){throw new db['Sequelize'][(_0xc1e3('0x85'))](_0xc1e3('0x8e')+_0x3514a5);}if(!_[_0xc1e3('0x8f')](_0x3514a5,_0x279c8f[_0xc1e3('0x51')]['mapKey'])){throw new db[(_0xc1e3('0x84'))][(_0xc1e3('0x85'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3514a5);}_0xebc1c2[_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x8d')]]=_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x90')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x279c8f[_0xc1e3('0x5b')]['id']},'include':[{'model':db[_0xc1e3('0x91')],'as':_0xc1e3('0x92'),'include':[{'model':db[_0xc1e3('0x93')],'as':_0xc1e3('0x94'),'where':_0xebc1c2,'limit':0x1,'order':[[_0xc1e3('0x89'),_0xc1e3('0x95')]]}]},{'model':db[_0xc1e3('0x96')],'as':'Applications'}]});})[_0xc1e3('0x16')](handleEntityNotFound(_0x582f63,null))[_0xc1e3('0x16')](function(_0x1f08df){if(_0x1f08df&&_0x1f08df[_0xc1e3('0x92')]){_0x3ed6d7[_0xc1e3('0x97')]=_0x1f08df;_0x3ed6d7[_0xc1e3('0x98')]=_0x1f08df['Applications'];_0x3ed6d7[_0xc1e3('0x99')]=_0x1f08df[_0xc1e3('0x92')];_0x3ed6d7[_0xc1e3('0x98')]=_[_0xc1e3('0x9a')](_0x3ed6d7['applications'],[_0xc1e3('0x9b')],[_0xc1e3('0x9c')]);if(_0x3ed6d7[_0xc1e3('0x97')][_0xc1e3('0x9d')]){delete _0x3ed6d7[_0xc1e3('0x97')]['Applications'];}if(_0x3ed6d7[_0xc1e3('0x97')][_0xc1e3('0x92')]&&_0x3ed6d7[_0xc1e3('0x97')][_0xc1e3('0x92')][_0xc1e3('0x94')]['length']){return _0x3ed6d7['account']['List'][_0xc1e3('0x94')][0x0];}var _0x3ef7c1=_[_0xc1e3('0xe')](_0x279c8f[_0xc1e3('0x51')],{'firstName':_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x90')],'ListId':_0x1f08df['ListId']});_0x3ef7c1[_0x279c8f['body']['mapKey']]=_0x279c8f[_0xc1e3('0x51')]['from'];return db[_0xc1e3('0x93')][_0xc1e3('0x50')](_0x3ef7c1,{'fields':_0xcf23bc,'raw':!![]});}})[_0xc1e3('0x16')](handleEntityNotFound(_0x582f63,null))[_0xc1e3('0x16')](function(_0x23b31b){_0x3ed6d7[_0xc1e3('0x9e')]=_0x23b31b;var _0x490758=_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x9f')];if(_0x279c8f[_0xc1e3('0x80')][_0xc1e3('0xa0')]){_0x490758=_0x279c8f[_0xc1e3('0x80')][_0xc1e3('0xa0')];}else if(_0x279c8f['headers'][_0xc1e3('0xa1')]){_0x490758=_['first'](_0x279c8f['headers']['x-forwarded-for'][_0xc1e3('0xa2')](','));}if(_0x23b31b){var _0x1865a3={'ContactId':_0x23b31b['id'],'ChatWebsiteId':_0x279c8f[_0xc1e3('0x5b')]['id'],'from':(_0x23b31b[_0xc1e3('0xa3')]||'')+'\x20'+(_0x23b31b[_0xc1e3('0xa4')]||''),'customerIp':_0x490758,'customerPort':_0x279c8f[_0xc1e3('0x80')][_0xc1e3('0xa5')]?_0x279c8f[_0xc1e3('0x80')][_0xc1e3('0xa5')]:null,'referer':_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xa6')],'browserName':_0x465019[_0xc1e3('0xa7')][_0xc1e3('0x2f')]&&_0x465019[_0xc1e3('0xa7')]['version']?util[_0xc1e3('0xa8')](_0xc1e3('0xa9'),_0x465019[_0xc1e3('0xa7')][_0xc1e3('0x2f')],_0x465019['browser'][_0xc1e3('0xaa')]):_0xc1e3('0xab'),'browserVersion':_0x465019['browser'][_0xc1e3('0xaa')]||_0xc1e3('0xab'),'osName':util['format'](_0xc1e3('0xa9'),_0x465019['os'][_0xc1e3('0x2f')],_0x465019['os']['version']),'osVersion':_0x465019['os'][_0xc1e3('0xaa')],'deviceModel':_0x465019[_0xc1e3('0xac')][_0xc1e3('0x3a')]&&_0x465019[_0xc1e3('0xac')]['vendor']?util[_0xc1e3('0xa8')](_0xc1e3('0xad'),_0x465019[_0xc1e3('0xac')][_0xc1e3('0x3a')],_0x465019['device'][_0xc1e3('0xae')],_0x465019['device'][_0xc1e3('0x38')]):null,'deviceVendor':_0x465019[_0xc1e3('0xac')]['vendor'],'deviceType':_0x465019['device'][_0xc1e3('0x38')],'formData':JSON[_0xc1e3('0xaf')](_0x279c8f[_0xc1e3('0x51')])};var _0x3b9052={'ChatWebsiteId':_0x279c8f[_0xc1e3('0x5b')]['id'],'closed':![]};if(_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb0')]){_0x3b9052[_0xc1e3('0xb0')]=_0x279c8f['body']['threadId'];return db[_0xc1e3('0xb1')][_0xc1e3('0x4f')]({'where':_0x3b9052})[_0xc1e3('0x16')](function(_0x2103ea){if(_0x2103ea){return[_0x2103ea,![]];}_0x1865a3['threadId']=_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb0')];_0x1865a3[_0xc1e3('0xb2')]=_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb2')];return db['ChatInteraction'][_0xc1e3('0x50')](_0x1865a3)['then'](function(_0x4e430a){return[_0x4e430a,!![]];});});}_0x3b9052[_0xc1e3('0xb3')]=_0x23b31b['id'];if(_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb4')]&&_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb4')]['id']){_0x3b9052['id']=_0x279c8f['body'][_0xc1e3('0xb4')]['id'];return db[_0xc1e3('0xb1')][_0xc1e3('0x4f')]({'where':_0x3b9052})[_0xc1e3('0x16')](function(_0x369482){if(_0x369482){return[_0x369482,![]];}return db[_0xc1e3('0xb1')][_0xc1e3('0x50')](_0x1865a3)[_0xc1e3('0x16')](function(_0x4ae784){return[_0x4ae784,!![]];});});}return db[_0xc1e3('0xb1')][_0xc1e3('0x50')](_0x1865a3)[_0xc1e3('0x16')](function(_0x73e9c9){return[_0x73e9c9,!![]];});}})[_0xc1e3('0xb5')](function(_0x583aec,_0x2a822c){if(_0x583aec){_0x146d28=_0x2a822c;if(!_0x2a822c){var _0x289bef={'from':(_0x3ed6d7['contact'][_0xc1e3('0xa3')]||'')+'\x20'+(_0x3ed6d7[_0xc1e3('0x9e')][_0xc1e3('0xa4')]||'')};if(_0x279c8f['body'][_0xc1e3('0xb0')]&&_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb6')]&&_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb0')]!=_0x279c8f['body'][_0xc1e3('0xb6')]){_0x289bef[_0xc1e3('0xb0')]=_0x279c8f['body'][_0xc1e3('0xb6')];}return _0x583aec[_0xc1e3('0x29')](_0x289bef);}else{return _0x583aec;}}})['then'](function(_0x540bf9){_0x3ed6d7[_0xc1e3('0xb4')]=_0x540bf9[_0xc1e3('0x2a')]({'plain':!![]});_0x3ed6d7[_0xc1e3('0xb4')][_0xc1e3('0xb7')]=_0x146d28;if(_0x3ed6d7[_0xc1e3('0xb4')][_0xc1e3('0xb7')]){if(_0x3ed6d7[_0xc1e3('0x97')][_0xc1e3('0xb8')]){_0x3ed6d7[_0xc1e3('0x98')]['push']({'id':0x0,'priority':_0x3ed6d7[_0xc1e3('0x98')][_0xc1e3('0x4c')]+0x1,'app':_0xc1e3('0xb9'),'appdata':_0xc1e3('0xba'),'interval':_0xc1e3('0xbb')});}}return db[_0xc1e3('0xbc')]['create']({'body':_0x279c8f['body'][_0xc1e3('0x51')],'ChatWebsiteId':_0x279c8f['params']['id'],'ChatInteractionId':_0x540bf9['id'],'direction':'in','ContactId':_0x3ed6d7[_0xc1e3('0x9e')]['id'],'AttachmentId':_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xbd')]});})[_0xc1e3('0x16')](function(_0x16eec5){_0x3ed6d7[_0xc1e3('0x1e')]=_0x16eec5;if(_0x3ed6d7[_0xc1e3('0xb4')][_0xc1e3('0xbe')]){return db[_0xc1e3('0xbf')][_0xc1e3('0x4f')]({'attributes':['id',_0xc1e3('0x2f')],'where':{'id':_0x3ed6d7['interaction'][_0xc1e3('0xbe')]}})[_0xc1e3('0x16')](function(_0x4adff5){if(_0x4adff5){_0x3ed6d7['applications'][_0xc1e3('0xc0')]({'id':0x0,'priority':0x0,'app':_0xc1e3('0xc1'),'appdata':_0x4adff5[_0xc1e3('0x2f')]+','+(_0x3ed6d7['account'][_0xc1e3('0xc2')]||0xa),'interval':_0xc1e3('0xbb')});_0x3ed6d7['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xc1e3('0xc3'),_0x3ed6d7);});}return respondWithRpcPromise(_0xc1e3('0xc4'),_0xc1e3('0xc3'),_0x3ed6d7);})[_0xc1e3('0x16')](function(_0x1e60c9){respondWithRpcPromise('EventManager','EventManager',{'event':'notify','message':_0x1e60c9},client9002);return _0x1e60c9;})[_0xc1e3('0x16')](respondWithResult(_0x582f63,null))[_0xc1e3('0x20')](handleError(_0x582f63,null));};exports[_0xc1e3('0xc5')]=function(_0x5c3b78,_0x436d90){var _0x27eb37,_0x1dd4d2,_0x2d42be;var _0x183985=[];var _0x142295={};var _0x5f2d57=_0x5c3b78['files']||[];var _0x1f0133=[];var _0x2a2c44;return db['CmContact'][_0xc1e3('0x59')]()[_0xc1e3('0x16')](function(_0x5cdae5){if(!_0x5cdae5){throw new db[(_0xc1e3('0x84'))]['ValidationError']('no\x20available\x20attributes');}_0x183985=_[_0xc1e3('0x87')](_[_0xc1e3('0x4b')](_0x5cdae5),[_0xc1e3('0x88'),'updatedAt',_0xc1e3('0x8a'),_0xc1e3('0xc6')]);if(_0x5c3b78[_0xc1e3('0x51')]['id']){delete _0x5c3b78[_0xc1e3('0x51')]['id'];}if(_[_0xc1e3('0x74')](_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0x90')])){throw _0x436d90[_0xc1e3('0x22')](0x1f4)[_0xc1e3('0x30')](new db[(_0xc1e3('0x84'))][(_0xc1e3('0x85'))](_0xc1e3('0x8b')));}if(_[_0xc1e3('0x74')](_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0x51')])||_0x5c3b78['body'][_0xc1e3('0x51')]===''){throw _0x436d90[_0xc1e3('0x22')](0x1f4)['send'](new db[(_0xc1e3('0x84'))][(_0xc1e3('0x85'))](_0xc1e3('0x8c')));}if(_[_0xc1e3('0x74')](_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0xc7')])){throw _0x436d90[_0xc1e3('0x22')](0x1f4)[_0xc1e3('0x30')](new db[(_0xc1e3('0x84'))]['ValidationError'](_0xc1e3('0xc8')+_0x183985));}if(!_[_0xc1e3('0x8f')](_0x183985,_0x5c3b78['body'][_0xc1e3('0xc7')])){throw _0x436d90[_0xc1e3('0x22')](0x1f4)[_0xc1e3('0x30')](new db['Sequelize'][(_0xc1e3('0x85'))](_0xc1e3('0xc9')+_0x183985));}_0x142295[_0x5c3b78['body'][_0xc1e3('0xc7')]]=_0x5c3b78[_0xc1e3('0x51')]['from'];})['then'](function(){return db[_0xc1e3('0x35')]['find']({'where':{'id':_0x5c3b78['params']['id']},'include':[{'model':db[_0xc1e3('0x91')],'as':_0xc1e3('0x92')},{'model':db[_0xc1e3('0xca')],'as':'MailAccount'}]});})[_0xc1e3('0x16')](handleEntityNotFound(_0x436d90,null))[_0xc1e3('0x16')](function(_0x3f73cd){if(_0x3f73cd&&_0x3f73cd[_0xc1e3('0x92')]){_0x1dd4d2=_0x3f73cd;var _0x3a26e0=_[_0xc1e3('0xe')](_0x5c3b78[_0xc1e3('0x51')],{'firstName':_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0x90')],'phone':_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0x90')],'ListId':_0x3f73cd['ListId']});_0x3a26e0[_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0xc7')]]=_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0x90')];return db['CmContact']['findOrCreate']({'where':_0x142295,'defaults':_0x3a26e0});}})[_0xc1e3('0xb5')](function(_0x503ffd){if(_0x503ffd){_0x2d42be=_0x503ffd;var _0x39a811=fs['readFileSync'](path['join'](config['root'],_0xc1e3('0xcb')),_0xc1e3('0xcc'));var _0x2f2198=ejs[_0xc1e3('0xcd')](_0x39a811,{'body':_[_0xc1e3('0xce')](_0x5c3b78[_0xc1e3('0x51')]['body']),'bodyTitle':_0x1dd4d2[_0xc1e3('0xcf')]});return db[_0xc1e3('0xd0')][_0xc1e3('0x50')]({'body':_0x2f2198,'plainBody':htmlToText[_0xc1e3('0xd1')](_0x2f2198),'ContactId':_0x503ffd['id'],'ChatWebsiteId':_0x1dd4d2['id']});}})[_0xc1e3('0x16')](function(_0x21be62){_0x2a2c44=_0x21be62;if(_0x5f2d57[_0xc1e3('0x4c')]){var _0x57559f=_0x5f2d57['map'](function(_0x35a585){return{'name':_0x35a585[_0xc1e3('0xd2')],'basename':_0x35a585[_0xc1e3('0x69')],'type':_0x35a585[_0xc1e3('0xd3')],'ChatOfflineMessageId':_0x21be62['id']};});_0x1f0133=_0x57559f[_0xc1e3('0x34')](_0x28bc1d=>{var _0x20ec81={'filename':_0x28bc1d['name'],'path':path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],_0xc1e3('0xd4'),_0xc1e3('0xd5'),_0xc1e3('0xd6'),'offline-chat',_0x28bc1d['basename'])};return _0x20ec81;});if(!_0x1dd4d2[_0xc1e3('0xd7')]){return db[_0xc1e3('0xd8')][_0xc1e3('0xd9')](function(_0x53c048){return db['Attachment']['bulkCreate'](_0x57559f,{'transaction':_0x53c048});});}}})['then'](function(){if(_0x2a2c44){_0x27eb37=_0x2a2c44;return db[_0xc1e3('0xca')][_0xc1e3('0x5d')]({'where':{'service':!![]},'include':[{'model':db[_0xc1e3('0xda')],'as':_0xc1e3('0xdb'),'raw':!![],'include':[{'model':db[_0xc1e3('0xdc')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x1adcf3){if(_0x1adcf3&&_0x1adcf3[_0xc1e3('0xdb')]&&_0x1dd4d2['forwardOffline']&&_0x1dd4d2[_0xc1e3('0xdd')]){var _0x300ace=_0x1adcf3[_0xc1e3('0xde')]();return respondWithRpcPromise(_0xc1e3('0xdf'),_0xc1e3('0xe0'),{'account':_0x300ace,'message':{'from':util[_0xc1e3('0xa8')](_0xc1e3('0xe1'),_0x1adcf3[_0xc1e3('0x2f')],_0x1adcf3['email']||_0x1adcf3[_0xc1e3('0xdb')][_0xc1e3('0x52')]),'to':_0x1dd4d2[_0xc1e3('0xdd')],'subject':_0x1dd4d2[_0xc1e3('0xe2')],'html':_0x27eb37[_0xc1e3('0x51')],'attachments':_0x1f0133}},client9003)[_0xc1e3('0x16')](function(){return _0x27eb37;})['catch'](function(_0x291a41){logger['error'](_0x291a41);});}})[_0xc1e3('0x16')](function(){if(_0x1dd4d2&&_0x1dd4d2[_0xc1e3('0xd7')]&&_0x1dd4d2[_0xc1e3('0xe3')]){var _0x28ce88=[];if(_0x5f2d57[_0xc1e3('0x4c')]){_0x28ce88=_0x5f2d57[_0xc1e3('0x34')](function(_0xb57935){return{'name':_0xb57935[_0xc1e3('0xd2')],'basename':_0xb57935[_0xc1e3('0x69')],'type':_0xb57935[_0xc1e3('0xd3')],'ChatOfflineMessageId':_0x2a2c44['id']};});}var _0x18f3c0;if(!_[_0xc1e3('0x74')](_0x1dd4d2['subjectOffline'])){var _0x584391=_['map'](_0x5c3b78['body'],function(_0x5be3c3){return _0x5be3c3;});var _0x2bbf5f=_[_0xc1e3('0xe4')](_0x584391)[0x0];var _0x534657=_['mapValues'](_0x2bbf5f,function(_0x1626a6){return _0x1626a6;});_0x18f3c0=_0x534657[0x1][_0x1dd4d2[_0xc1e3('0xe5')]];}var _0xffc35d={'from':_0x2d42be[_0xc1e3('0xe6')],'firstName':_0x2d42be[_0xc1e3('0xa3')],'lastName':_0x2d42be[_0xc1e3('0xa4')],'mapKey':_0xc1e3('0xe6'),'message':{'from':_0x2d42be[_0xc1e3('0xe6')],'to':_0x1dd4d2[_0xc1e3('0xca')][_0xc1e3('0xe6')],'cc':'','subject':_['isNil'](_0x18f3c0)?_0x1dd4d2[_0xc1e3('0xe2')]:_0x18f3c0,'messageId':'','sentAt':new Date(),'attach':_0x28ce88[_0xc1e3('0x4c')],'attachments':_0x28ce88,'originChannel':'Chat','ChatWebsiteId':_0x1dd4d2['id'],'ChatOfflineMessageId':_0x27eb37['id'],'originTo':_0x1dd4d2[_0xc1e3('0xca')]['email']},'body':_0x27eb37['body']};var _0x49bcb9={'account':{'id':_0x1dd4d2[_0xc1e3('0xe3')]},'body':_0xffc35d,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xc1e3('0xe7'),_0xc1e3('0xe8'),_0x49bcb9,client9001)[_0xc1e3('0x16')](function(){return _0x27eb37;})[_0xc1e3('0x20')](function(_0x11c6f8){logger[_0xc1e3('0x1c')](_0x11c6f8);});}return;})[_0xc1e3('0x16')](function(){if(_0x27eb37){return _0x27eb37;}})[_0xc1e3('0x16')](respondWithResult(_0x436d90,null))[_0xc1e3('0x20')](function(_0x2a50e8){logger[_0xc1e3('0x1c')](_0xc1e3('0x20'),_0x2a50e8);for(var _0x2827a7 of _0x5f2d57){var _0x378c4d=path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],'server','files','attachments','offline-chat',_0x2827a7['filename']);fs_extra[_0xc1e3('0xe9')](_0x378c4d)[_0xc1e3('0x20')](function(_0x3f5049){logger[_0xc1e3('0x1c')](_0xc1e3('0xea'),_0x378c4d,_0x3f5049);});}});};exports[_0xc1e3('0xeb')]=function(_0x4e131b,_0x54aacc){return db[_0xc1e3('0xb1')][_0xc1e3('0x4f')]({'where':{'id':_0x4e131b[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x54aacc,null))[_0xc1e3('0x16')](function(_0x49e63f){if(_0x49e63f){return _0x49e63f[_0xc1e3('0xeb')](_0x4e131b[_0xc1e3('0x51')]['ids'],_[_0xc1e3('0xec')](_0x4e131b['body'],[_0xc1e3('0x61'),'id'])||{});}})['then'](respondWithResult(_0x54aacc,null))[_0xc1e3('0x20')](handleError(_0x54aacc,null));};exports[_0xc1e3('0xed')]=function(_0x176428,_0x3fc972){var _0xbb746f={'raw':![],'where':{}};var _0x6acd2d={};var _0x20ac35={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x176428[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x3fc972,null))[_0xc1e3('0x16')](function(_0x51a07a){if(_0x51a07a){_0x6acd2d[_0xc1e3('0x3a')]=_[_0xc1e3('0x4b')](db['ChatInteraction']['rawAttributes']);_0x6acd2d[_0xc1e3('0x3b')]=_[_0xc1e3('0x4b')](_0x176428[_0xc1e3('0x3b')]);_0x6acd2d['filters']=_[_0xc1e3('0x3d')](_0x6acd2d[_0xc1e3('0x3a')],_0x6acd2d[_0xc1e3('0x3b')]);_0xbb746f[_0xc1e3('0x3e')]=_['intersection'](_0x6acd2d['model'],qs['fields'](_0x176428['query']['fields']));_0xbb746f[_0xc1e3('0x3e')]=_0xbb746f[_0xc1e3('0x3e')]['length']?_0xbb746f[_0xc1e3('0x3e')]:_0x6acd2d['model'];if(!_0x176428[_0xc1e3('0x3b')]['hasOwnProperty']('nolimit')){_0xbb746f[_0xc1e3('0x27')]=qs[_0xc1e3('0x27')](_0x176428[_0xc1e3('0x3b')][_0xc1e3('0x27')]);_0xbb746f[_0xc1e3('0x24')]=qs[_0xc1e3('0x24')](_0x176428[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}_0xbb746f[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0x176428['query'][_0xc1e3('0x43')]);_0xbb746f[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_['pick'](_0x176428[_0xc1e3('0x3b')],_0x6acd2d[_0xc1e3('0x3c')]));_0xbb746f[_0xc1e3('0x44')][_0xc1e3('0x5c')]=_0x51a07a['id'];if(_0x176428['query']['filter']){_0xbb746f[_0xc1e3('0x44')]=_[_0xc1e3('0x47')](_0xbb746f[_0xc1e3('0x44')],{'$or':_['map'](_0xbb746f['attributes'],function(_0x4ba5fb){var _0x352e43={};_0x352e43[_0x4ba5fb]={'$like':'%'+_0x176428['query'][_0xc1e3('0x46')]+'%'};return _0x352e43;})});}_0xbb746f=_[_0xc1e3('0x47')]({},_0xbb746f,_0x176428['options']);return db[_0xc1e3('0xb1')]['count']({'where':_0xbb746f[_0xc1e3('0x44')]})['then'](function(_0x53ddc0){_0x20ac35[_0xc1e3('0x26')]=_0x53ddc0;if(_0x176428[_0xc1e3('0x3b')][_0xc1e3('0x49')]){_0xbb746f[_0xc1e3('0x4d')]=[{'model':db['CmContact'],'as':_0xc1e3('0xee'),'required':![]},{'model':db[_0xc1e3('0xbf')],'as':'Owner','attributes':[_0xc1e3('0x2f'),_0xc1e3('0xef'),'internal'],'required':![]},{'model':db[_0xc1e3('0xf0')],'as':_0xc1e3('0xf1'),'attributes':['id',_0xc1e3('0x2f'),_0xc1e3('0xf2')],'where':_0x176428[_0xc1e3('0x3b')][_0xc1e3('0xf3')]?{'id':_0x176428[_0xc1e3('0x3b')]['tag']}:undefined,'required':_0x176428['query'][_0xc1e3('0xf3')]?!![]:![]}];}return db['ChatInteraction'][_0xc1e3('0x4a')](_0xbb746f);})[_0xc1e3('0x16')](function(_0x5791ee){_0x20ac35[_0xc1e3('0x5f')]=_0x5791ee;return _0x20ac35;});}})[_0xc1e3('0x16')](respondWithFilteredResult(_0x3fc972,_0xbb746f))[_0xc1e3('0x20')](handleError(_0x3fc972,null));};function iftimePromise(_0x4f0478,_0x28de81){return respondWithRpcPromise(_0xc1e3('0xf4'),_0xc1e3('0xf5'),{'command':_0x28de81[_0xc1e3('0xf6')]?util['format'](_0xc1e3('0xf7'),_0x4f0478[_0xc1e3('0xf8')],_0x28de81[_0xc1e3('0xf6')]):util[_0xc1e3('0xa8')](_0xc1e3('0xf9'),_0x4f0478[_0xc1e3('0xf8')])},client9002)[_0xc1e3('0x16')](function(_0x41a38e){var _0xa45008=_0x41a38e&&_0x41a38e[_0xc1e3('0xfa')]('true')>=0x0?!![]:![];logger[_0xc1e3('0x17')](_0xc1e3('0xfb'),_0x28de81['id'],_0x4f0478['id'],_0x4f0478[_0xc1e3('0xf8')],_0xa45008?'ONLINE':'OFFLINE',_0x28de81['timezone']?_0x28de81['timezone']:'No\x20timezone');return _0xa45008;})[_0xc1e3('0x20')](function(_0x4405de){logger[_0xc1e3('0x1c')](_0xc1e3('0xfb'),_0x28de81['id'],_0x4f0478['id'],_0x4f0478['interval'],util[_0xc1e3('0xfc')](_0x4405de,{'showHidden':![],'depth':null}),_0x28de81[_0xc1e3('0xf6')]?_0x28de81[_0xc1e3('0xf6')]:_0xc1e3('0xfd'));return![];});}exports[_0xc1e3('0xf5')]=function(_0x5cea6c,_0x3e1910){var _0x28d5fd=0x0;var _0x38790d=0x0;var _0x55683b=![];var _0x9911ed;var _0x36f945;return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x5cea6c['params']['id']},'include':[{'model':db[_0xc1e3('0xfe')],'as':_0xc1e3('0xfe'),'include':[{'model':db['Interval'],'as':_0xc1e3('0xff'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3e1910,null))[_0xc1e3('0x16')](function(_0x254d83){if(_0x254d83){_0x9911ed=_0x254d83;return _0x254d83['getProactiveActions']({'raw':!![]});}})['then'](function(_0x2c3f56){if(_0x9911ed){if(_0x2c3f56){_0x36f945=_0x2c3f56;}}return require(_0xc1e3('0x71'))[_0xc1e3('0x72')]();})[_0xc1e3('0x16')](function(_0x176843){if(_0x176843){_0x38790d=_0x176843[_0xc1e3('0x100')];_0x55683b=_0x176843[_0xc1e3('0x73')];}})[_0xc1e3('0x16')](function(){return db[_0xc1e3('0xb1')][_0xc1e3('0x26')]({'where':{'closed':![]}});})['then'](function(_0x5b3304){_0x28d5fd=_0x5b3304;if(_0x38790d&&_0x5b3304>_0x38790d){return db['License'][_0xc1e3('0x5d')]({'where':{'id':0x1}})[_0xc1e3('0x16')](function(_0x53921c){if(_0x53921c){_0x53921c[_0xc1e3('0x101')](_0xc1e3('0x102'));}});}})[_0xc1e3('0x16')](function(){if(_0x9911ed['Interval']&&_0x9911ed[_0xc1e3('0xfe')][_0xc1e3('0xff')]){var _0x570c47=[];for(var _0x65f32f=0x0;_0x65f32f<_0x9911ed['Interval'][_0xc1e3('0xff')][_0xc1e3('0x4c')];_0x65f32f++){var _0x43bf7f=_0x9911ed['Interval']['Intervals'][_0x65f32f][_0xc1e3('0x2a')]({'plain':!![]});_0x570c47[_0xc1e3('0x103')](iftimePromise(_0x43bf7f,_0x9911ed));}return BPromise[_0xc1e3('0x104')](_0x570c47)[_0xc1e3('0x16')](function(_0x3b9eef){return _[_0xc1e3('0x105')](_0x3b9eef);});}else{return!![];}})[_0xc1e3('0x16')](function(_0x55022f){var _0x307b08=fs[_0xc1e3('0x106')](path[_0xc1e3('0x6f')](config['root'],_0xc1e3('0x107')),'utf8');var _0x597197=new url[(_0xc1e3('0x108'))](_0x9911ed[_0xc1e3('0x109')])[_0xc1e3('0x10a')];var _0x15698d=_0xc1e3('0x10b');var _0x11694f=![];var _0x3218ec={'chatVersion':_0x15698d,'chatWebsiteAddressOrigin':_0x597197,'remote':_0x9911ed[_0xc1e3('0x10c')],'query':querystring[_0xc1e3('0xaf')](_[_0xc1e3('0x47')](_0x9911ed[_0xc1e3('0x2a')]({'plain':!![]}),{'customerIp':_0x5cea6c['headers']['x-forwarded-for']||_0x5cea6c[_0xc1e3('0x80')][_0xc1e3('0x10d')]||_0x5cea6c[_0xc1e3('0x10e')]['remoteAddress']||_0x5cea6c['ip'],'referer':_0x5cea6c[_0xc1e3('0x80')]['referer'],'openedInteractions':_0x28d5fd,'maxInteractions':_0x38790d,'virtual':_0x55683b['virtual'],'online':_0x55022f,'custom':_0x55683b}))['replace'](/'/g,'\x5c\x27')};_0x3e1910[_0xc1e3('0x30')](ejs[_0xc1e3('0xcd')](Mustache[_0xc1e3('0xcd')](_0x307b08,_0x3218ec),{'proactiveActions':_0x36f945,'alignment':_0x9911ed[_0xc1e3('0x10f')],'verticalAlignment':_0x9911ed[_0xc1e3('0x110')],'div_color':_0x9911ed['color'],'labelText':_0x9911ed[_0xc1e3('0x111')],'text_color':_0x9911ed[_0xc1e3('0x112')],'text_button_color':_0x9911ed[_0xc1e3('0x113')],'button_color':_0x9911ed['color_button'],'background_color':_0x9911ed[_0xc1e3('0x114')],'hideWhenOffline':_0x9911ed['hideWhenOffline'],'intervalId':_0x9911ed['IntervalId'],'isDevelopment':_0x11694f,'chatVersion':_0x15698d}));})[_0xc1e3('0x20')](handleError(_0x3e1910,null));};exports[_0xc1e3('0x115')]=function(_0x29c34b,_0x3f8306){var _0x52aca6=_0x29c34b[_0xc1e3('0x5b')]['id'];var _0x54a7cb=_0x29c34b[_0xc1e3('0x51')];var _0x4bc06f=0xc8;var _0x4cfd5d=null;return db[_0xc1e3('0xd8')]['transaction']({'isolationLevel':db[_0xc1e3('0xd8')]['Transaction'][_0xc1e3('0x116')][_0xc1e3('0x117')]},function(_0x10c7ee){return db[_0xc1e3('0x35')]['findOne']({'where':{'id':_0x52aca6},'transaction':_0x10c7ee})['then'](function(_0x2a19b7){if(_0x2a19b7){return db[_0xc1e3('0x96')]['destroy']({'where':{'ChatWebsiteId':_0x52aca6},'transaction':_0x10c7ee})[_0xc1e3('0x16')](function(){var _0x448864=_[_0xc1e3('0x34')](_0x54a7cb,function(_0x45f35d){_0x45f35d[_0xc1e3('0x5c')]=_0x52aca6;return _0x45f35d;});return db[_0xc1e3('0x96')][_0xc1e3('0x118')](_0x448864,{'transaction':_0x10c7ee});});}else{_0x4bc06f=0x194;_0x4cfd5d=[];}});})[_0xc1e3('0x16')](function(){if(_0x4bc06f!==0x194){return db[_0xc1e3('0x96')][_0xc1e3('0x119')]({'where':{'ChatWebsiteId':_0x52aca6},'order':_0xc1e3('0x9b')})[_0xc1e3('0x16')](function(_0x302597){_0x4cfd5d=_0x302597;});}})[_0xc1e3('0x20')](function(_0x5be72c){_0x4bc06f=0x1f4;logger['error'](_0x5be72c[_0xc1e3('0x2e')]);if(_0x5be72c[_0xc1e3('0x2f')]){delete _0x5be72c['name'];}_0x4cfd5d=_0x5be72c;})[_0xc1e3('0x11a')](function(){if(_0x4cfd5d===null){_0x3f8306[_0xc1e3('0x21')](_0x4bc06f);}else{if(_0x4bc06f===0x1f4){_0x3f8306[_0xc1e3('0x22')](_0x4bc06f)[_0xc1e3('0x30')](_0x4cfd5d);}else{_0x3f8306['status'](_0x4bc06f)[_0xc1e3('0x23')](_0x4cfd5d);}}});};exports[_0xc1e3('0x11b')]=function(_0x114b15,_0x507ee1){var _0x3799a3={};var _0x4e2b81={};var _0x3b4d7d;var _0x599691;return db[_0xc1e3('0x35')]['findOne']({'where':{'id':_0x114b15[_0xc1e3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x507ee1,null))[_0xc1e3('0x16')](function(_0x1d4793){if(_0x1d4793){_0x3b4d7d=_0x1d4793;_0x4e2b81[_0xc1e3('0x3a')]=_[_0xc1e3('0x4b')](db['ChatApplication'][_0xc1e3('0x36')]);_0x4e2b81[_0xc1e3('0x3b')]=_['keys'](_0x114b15[_0xc1e3('0x3b')]);_0x4e2b81[_0xc1e3('0x3c')]=_[_0xc1e3('0x3d')](_0x4e2b81[_0xc1e3('0x3a')],_0x4e2b81[_0xc1e3('0x3b')]);_0x3799a3[_0xc1e3('0x3e')]=_[_0xc1e3('0x3d')](_0x4e2b81[_0xc1e3('0x3a')],qs['fields'](_0x114b15[_0xc1e3('0x3b')][_0xc1e3('0x3f')]));_0x3799a3[_0xc1e3('0x3e')]=_0x3799a3[_0xc1e3('0x3e')][_0xc1e3('0x4c')]?_0x3799a3[_0xc1e3('0x3e')]:_0x4e2b81[_0xc1e3('0x3a')];_0x3799a3[_0xc1e3('0x42')]=qs['sort'](_0x114b15[_0xc1e3('0x3b')][_0xc1e3('0x43')]);_0x3799a3[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_['pick'](_0x114b15[_0xc1e3('0x3b')],_0x4e2b81[_0xc1e3('0x3c')]));if(_0x114b15[_0xc1e3('0x3b')][_0xc1e3('0x46')]){_0x3799a3[_0xc1e3('0x44')]=_[_0xc1e3('0x47')](_0x3799a3[_0xc1e3('0x44')],{'$or':_[_0xc1e3('0x34')](_0x3799a3[_0xc1e3('0x3e')],function(_0x435b2f){var _0x3635e6={};_0x3635e6[_0x435b2f]={'$like':'%'+_0x114b15['query']['filter']+'%'};return _0x3635e6;})});}_0x3799a3=_[_0xc1e3('0x47')]({},_0x3799a3,_0x114b15[_0xc1e3('0x4e')]);return _0x3b4d7d[_0xc1e3('0x11b')](_0x3799a3);}})[_0xc1e3('0x16')](function(_0x3ec175){if(_0x3ec175){_0x599691=_0x3ec175[_0xc1e3('0x4c')];if(!_0x114b15['query'][_0xc1e3('0x40')](_0xc1e3('0x41'))){_0x3799a3[_0xc1e3('0x27')]=qs['limit'](_0x114b15[_0xc1e3('0x3b')][_0xc1e3('0x27')]);_0x3799a3['offset']=qs[_0xc1e3('0x24')](_0x114b15['query'][_0xc1e3('0x24')]);}return _0x3b4d7d[_0xc1e3('0x11b')](_0x3799a3);}})[_0xc1e3('0x16')](function(_0x2915b4){if(_0x2915b4){return _0x2915b4?{'count':_0x599691,'rows':_0x2915b4}:null;}})[_0xc1e3('0x16')](respondWithResult(_0x507ee1,null))[_0xc1e3('0x20')](handleError(_0x507ee1,null));};exports[_0xc1e3('0x11c')]=function(_0x3ae246,_0x194fb6){return db[_0xc1e3('0x11d')][_0xc1e3('0x4f')]({'where':{'id':_0x3ae246['params']['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x194fb6,null))[_0xc1e3('0x16')](function(_0x3af91c){if(_0x3af91c){return _0x3af91c[_0xc1e3('0x11c')](_0x3ae246[_0xc1e3('0x51')][_0xc1e3('0x61')],_[_0xc1e3('0xec')](_0x3ae246['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x194fb6,null))[_0xc1e3('0x20')](handleError(_0x194fb6,null));};exports[_0xc1e3('0x11e')]=function(_0x311ded,_0x2ce300){var _0x4f2a80={};var _0x1f5d04={};var _0x3dd41e;var _0x48ac8a;return db[_0xc1e3('0x35')][_0xc1e3('0x5d')]({'where':{'id':_0x311ded['params']['id']}})['then'](handleEntityNotFound(_0x2ce300,null))[_0xc1e3('0x16')](function(_0x2c941b){if(_0x2c941b){_0x3dd41e=_0x2c941b;_0x1f5d04[_0xc1e3('0x3a')]=_['keys'](db['ChatProactiveAction'][_0xc1e3('0x36')]);_0x1f5d04['query']=_[_0xc1e3('0x4b')](_0x311ded[_0xc1e3('0x3b')]);_0x1f5d04[_0xc1e3('0x3c')]=_[_0xc1e3('0x3d')](_0x1f5d04['model'],_0x1f5d04[_0xc1e3('0x3b')]);_0x4f2a80[_0xc1e3('0x3e')]=_['intersection'](_0x1f5d04[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0x311ded[_0xc1e3('0x3b')]['fields']));_0x4f2a80[_0xc1e3('0x3e')]=_0x4f2a80['attributes'][_0xc1e3('0x4c')]?_0x4f2a80['attributes']:_0x1f5d04[_0xc1e3('0x3a')];_0x4f2a80[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0x311ded[_0xc1e3('0x3b')][_0xc1e3('0x43')]);_0x4f2a80[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_[_0xc1e3('0x45')](_0x311ded['query'],_0x1f5d04['filters']));if(_0x311ded[_0xc1e3('0x3b')][_0xc1e3('0x46')]){_0x4f2a80[_0xc1e3('0x44')]=_['merge'](_0x4f2a80[_0xc1e3('0x44')],{'$or':_[_0xc1e3('0x34')](_0x4f2a80[_0xc1e3('0x3e')],function(_0xd81ba9){var _0x2ceefd={};_0x2ceefd[_0xd81ba9]={'$like':'%'+_0x311ded['query']['filter']+'%'};return _0x2ceefd;})});}_0x4f2a80=_[_0xc1e3('0x47')]({},_0x4f2a80,_0x311ded[_0xc1e3('0x4e')]);return _0x3dd41e[_0xc1e3('0x11e')](_0x4f2a80);}})[_0xc1e3('0x16')](function(_0x1b1874){if(_0x1b1874){_0x48ac8a=_0x1b1874[_0xc1e3('0x4c')];if(!_0x311ded['query'][_0xc1e3('0x40')](_0xc1e3('0x41'))){_0x4f2a80[_0xc1e3('0x27')]=qs[_0xc1e3('0x27')](_0x311ded[_0xc1e3('0x3b')][_0xc1e3('0x27')]);_0x4f2a80['offset']=qs['offset'](_0x311ded[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}return _0x3dd41e[_0xc1e3('0x11e')](_0x4f2a80);}})['then'](function(_0x3f8e39){if(_0x3f8e39){return _0x3f8e39?{'count':_0x48ac8a,'rows':_0x3f8e39}:null;}})['then'](respondWithResult(_0x2ce300,null))[_0xc1e3('0x20')](handleError(_0x2ce300,null));};exports[_0xc1e3('0x11f')]=function(_0x459955,_0x36a82b){var _0xb0577e=_0x459955[_0xc1e3('0x3b')]['online']===_0xc1e3('0x120')?_0xc1e3('0x121'):_0xc1e3('0x122');return db[_0xc1e3('0x35')]['find']({'attributes':['id',_0xb0577e],'where':{'id':_0x459955['params']['id']}})['then'](handleEntityNotFound(_0x36a82b,null))[_0xc1e3('0x16')](function(_0x3239e4){if(_0x3239e4){var _0x20eb26=_0x3239e4[_0xb0577e];var _0x5d605d=_0x20eb26&&_0x20eb26['items']?_0x20eb26[_0xc1e3('0x123')]:[];_0x36a82b[_0xc1e3('0x30')]({'fromKey':_[_0xc1e3('0x74')](_0x20eb26[_0xc1e3('0x124')])?undefined:_0x20eb26[_0xc1e3('0x124')],'count':_0x5d605d[_0xc1e3('0x4c')],'rows':_0x5d605d});}})[_0xc1e3('0x20')](handleError(_0x36a82b,null));};exports[_0xc1e3('0x125')]=function(_0x5830d1,_0x25f938){var _0x4ff05e={'raw':![],'where':{}};var _0x50d706={};var _0x61a96a={'count':0x0,'rows':[]};return db[_0xc1e3('0x35')]['findOne']({'where':{'id':_0x5830d1[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x25f938,null))[_0xc1e3('0x16')](function(_0x40d78a){if(_0x40d78a){_0x50d706['model']=_['keys'](db[_0xc1e3('0xd0')][_0xc1e3('0x36')]);_0x50d706[_0xc1e3('0x3b')]=_['keys'](_0x5830d1[_0xc1e3('0x3b')]);_0x50d706['filters']=_[_0xc1e3('0x3d')](_0x50d706['model'],_0x50d706['query']);_0x4ff05e[_0xc1e3('0x3e')]=_[_0xc1e3('0x3d')](_0x50d706[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0x5830d1[_0xc1e3('0x3b')][_0xc1e3('0x3f')]));_0x4ff05e[_0xc1e3('0x3e')]=_0x4ff05e[_0xc1e3('0x3e')][_0xc1e3('0x4c')]?_0x4ff05e[_0xc1e3('0x3e')]:_0x50d706[_0xc1e3('0x3a')];if(!_0x5830d1['query'][_0xc1e3('0x40')](_0xc1e3('0x41'))){_0x4ff05e[_0xc1e3('0x27')]=qs[_0xc1e3('0x27')](_0x5830d1[_0xc1e3('0x3b')][_0xc1e3('0x27')]);_0x4ff05e[_0xc1e3('0x24')]=qs[_0xc1e3('0x24')](_0x5830d1[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}_0x4ff05e[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0x5830d1['query']['sort']);_0x4ff05e[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_[_0xc1e3('0x45')](_0x5830d1[_0xc1e3('0x3b')],_0x50d706[_0xc1e3('0x3c')]));_0x4ff05e[_0xc1e3('0x44')][_0xc1e3('0x5c')]=_0x40d78a['id'];if(_0x5830d1[_0xc1e3('0x3b')]['filter']){_0x4ff05e[_0xc1e3('0x44')]=_[_0xc1e3('0x47')](_0x4ff05e[_0xc1e3('0x44')],{'$or':_[_0xc1e3('0x34')](_0x4ff05e[_0xc1e3('0x3e')],function(_0x728266){var _0x2b287a={};_0x2b287a[_0x728266]={'$like':'%'+_0x5830d1['query']['filter']+'%'};return _0x2b287a;})});}_0x4ff05e=_[_0xc1e3('0x47')]({},_0x4ff05e,_0x5830d1['options']);return db[_0xc1e3('0xd0')]['count']({'where':_0x4ff05e[_0xc1e3('0x44')]})[_0xc1e3('0x16')](function(_0x5a3106){_0x61a96a['count']=_0x5a3106;if(_0x5830d1[_0xc1e3('0x3b')][_0xc1e3('0x49')]){_0x4ff05e[_0xc1e3('0x4d')]=[{'all':!![]}];}else{_0x4ff05e[_0xc1e3('0x4d')]=[{'model':db[_0xc1e3('0x93')],'as':'Contact','required':![]},{'model':db[_0xc1e3('0x126')],'as':_0xc1e3('0x127'),'required':![]}];}return db[_0xc1e3('0xd0')][_0xc1e3('0x4a')](_0x4ff05e);})['then'](function(_0x11276f){_0x61a96a[_0xc1e3('0x5f')]=_0x11276f;return _0x61a96a;});}})['then'](respondWithFilteredResult(_0x25f938,_0x4ff05e))['catch'](handleError(_0x25f938,null));};exports[_0xc1e3('0x128')]=function(_0x3cfd40,_0x5056f0){return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x3cfd40[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x5056f0,null))[_0xc1e3('0x16')](function(_0x43fd12){if(_0x43fd12){return _0x43fd12[_0xc1e3('0x128')](_0x3cfd40[_0xc1e3('0x51')][_0xc1e3('0x61')],_[_0xc1e3('0xec')](_0x3cfd40[_0xc1e3('0x51')],[_0xc1e3('0x61'),'id'])||{})[_0xc1e3('0xb5')](function(_0x13a5ca){for(var _0xe5bb82=0x0;_0xe5bb82<_0x3cfd40['body'][_0xc1e3('0x61')][_0xc1e3('0x4c')];_0xe5bb82+=0x1){socket[_0xc1e3('0x129')](_0xc1e3('0x12a'),{'UserId':Number(_0x3cfd40[_0xc1e3('0x51')][_0xc1e3('0x61')][_0xe5bb82]),'ChatWebsiteId':Number(_0x3cfd40[_0xc1e3('0x5b')]['id'])});}return _0x13a5ca;});}})[_0xc1e3('0x16')](respondWithResult(_0x5056f0,null))['catch'](handleError(_0x5056f0,null));};exports['removeAgents']=function(_0x8c4b23,_0x5ca597){return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x8c4b23[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x5ca597,null))[_0xc1e3('0x16')](function(_0x535fa5){if(_0x535fa5){return _0x535fa5['removeAgents'](_0x8c4b23[_0xc1e3('0x3b')][_0xc1e3('0x61')])[_0xc1e3('0x16')](function(){if(_['isArray'](_0x8c4b23['query'][_0xc1e3('0x61')])){for(var _0x1ac50c=0x0;_0x1ac50c<_0x8c4b23['query'][_0xc1e3('0x61')][_0xc1e3('0x4c')];_0x1ac50c+=0x1){socket[_0xc1e3('0x129')]('userChatWebsite:remove',{'UserId':Number(_0x8c4b23[_0xc1e3('0x3b')][_0xc1e3('0x61')][_0x1ac50c]),'ChatWebsiteId':Number(_0x8c4b23[_0xc1e3('0x5b')]['id'])});}}else{socket[_0xc1e3('0x129')]('userChatWebsite:remove',{'UserId':Number(_0x8c4b23[_0xc1e3('0x3b')]['ids']),'ChatWebsiteId':Number(_0x8c4b23[_0xc1e3('0x5b')]['id'])});}});}})[_0xc1e3('0x16')](respondWithStatusCode(_0x5ca597,null))[_0xc1e3('0x20')](handleError(_0x5ca597,null));};exports[_0xc1e3('0x12b')]=function(_0x4be452,_0x596afd){var _0x4fc9c5={};var _0x22b879={};var _0x4f30e1;var _0x12135a;return db[_0xc1e3('0x35')]['findOne']({'where':{'id':_0x4be452['params']['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x596afd,null))[_0xc1e3('0x16')](function(_0x19623e){if(_0x19623e){_0x4f30e1=_0x19623e;_0x22b879[_0xc1e3('0x3a')]=_['keys'](db['User'][_0xc1e3('0x36')]);_0x22b879[_0xc1e3('0x3b')]=_[_0xc1e3('0x4b')](_0x4be452[_0xc1e3('0x3b')]);_0x22b879[_0xc1e3('0x3c')]=_[_0xc1e3('0x3d')](_0x22b879['model'],_0x22b879[_0xc1e3('0x3b')]);_0x4fc9c5[_0xc1e3('0x3e')]=_[_0xc1e3('0x3d')](_0x22b879[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0x4be452['query']['fields']));_0x4fc9c5[_0xc1e3('0x3e')]=_0x4fc9c5['attributes']['length']?_0x4fc9c5['attributes']:_0x22b879[_0xc1e3('0x3a')];_0x4fc9c5[_0xc1e3('0x42')]=qs['sort'](_0x4be452['query'][_0xc1e3('0x43')]);_0x4fc9c5[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_[_0xc1e3('0x45')](_0x4be452['query'],_0x22b879[_0xc1e3('0x3c')]));if(_0x4be452[_0xc1e3('0x3b')]['filter']){_0x4fc9c5[_0xc1e3('0x44')]=_[_0xc1e3('0x47')](_0x4fc9c5[_0xc1e3('0x44')],{'$or':_['map'](_0x4fc9c5[_0xc1e3('0x3e')],function(_0x5a420f){var _0x2c1123={};_0x2c1123[_0x5a420f]={'$like':'%'+_0x4be452[_0xc1e3('0x3b')][_0xc1e3('0x46')]+'%'};return _0x2c1123;})});}_0x4fc9c5=_[_0xc1e3('0x47')]({},_0x4fc9c5,_0x4be452[_0xc1e3('0x4e')]);return _0x4f30e1[_0xc1e3('0x12b')](_0x4fc9c5);}})['then'](function(_0x4632a1){if(_0x4632a1){_0x12135a=_0x4632a1[_0xc1e3('0x4c')];if(!_0x4be452['query'][_0xc1e3('0x40')]('nolimit')){_0x4fc9c5[_0xc1e3('0x27')]=qs['limit'](_0x4be452[_0xc1e3('0x3b')]['limit']);_0x4fc9c5[_0xc1e3('0x24')]=qs[_0xc1e3('0x24')](_0x4be452['query'][_0xc1e3('0x24')]);}return _0x4f30e1[_0xc1e3('0x12b')](_0x4fc9c5);}})[_0xc1e3('0x16')](function(_0x16a816){if(_0x16a816){return _0x16a816?{'count':_0x12135a,'rows':_0x16a816}:null;}})[_0xc1e3('0x16')](respondWithResult(_0x596afd,null))[_0xc1e3('0x20')](handleError(_0x596afd,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 8741373..a34b1f2 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 _0xf5a7=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0xf5a7,0x133));var _0x7f5a=function(_0x1f37df,_0x19f6cd){_0x1f37df=_0x1f37df-0x0;var _0x356c54=_0xf5a7[_0x1f37df];return _0x356c54;};'use strict';var EventEmitter=require(_0x7f5a('0x0'));var ChatWebsite=require(_0x7f5a('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7f5a('0x2')](0x0);var events={'afterCreate':_0x7f5a('0x3'),'afterUpdate':_0x7f5a('0x4'),'afterDestroy':_0x7f5a('0x5')};function emitEvent(_0x108c34){return function(_0x342fa0,_0x6da3f3,_0x8a76a){ChatWebsiteEvents[_0x7f5a('0x6')](_0x108c34+':'+_0x342fa0['id'],_0x342fa0);ChatWebsiteEvents['emit'](_0x108c34,_0x342fa0);_0x8a76a(null);};}for(var e in events){if(events[_0x7f5a('0x7')](e)){var event=events[e];ChatWebsite[_0x7f5a('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x89fe=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x89fe,0x83));var _0xe89f=function(_0xfc939d,_0x1d07a9){_0xfc939d=_0xfc939d-0x0;var _0x4a5cc7=_0x89fe[_0xfc939d];return _0x4a5cc7;};'use strict';var EventEmitter=require(_0xe89f('0x0'));var ChatWebsite=require(_0xe89f('0x1'))['db'][_0xe89f('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe89f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe89f('0x4'),'afterDestroy':_0xe89f('0x5')};function emitEvent(_0x580dce){return function(_0x3d3aa8,_0x3d8b30,_0x159e6b){ChatWebsiteEvents[_0xe89f('0x6')](_0x580dce+':'+_0x3d3aa8['id'],_0x3d3aa8);ChatWebsiteEvents[_0xe89f('0x6')](_0x580dce,_0x3d3aa8);_0x159e6b(null);};}for(var e in events){if(events[_0xe89f('0x7')](e)){var event=events[e];ChatWebsite[_0xe89f('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 425c594..6a754a9 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 _0x537d=['exports','ChatWebsite','chat_websites','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x1d8145,_0x17ed90){var _0x16f934=function(_0x3a9806){while(--_0x3a9806){_0x1d8145['push'](_0x1d8145['shift']());}};_0x16f934(++_0x17ed90);}(_0x537d,0x158));var _0xd537=function(_0x19dcc3,_0x58651a){_0x19dcc3=_0x19dcc3-0x0;var _0x24d519=_0x537d[_0x19dcc3];return _0x24d519;};'use strict';var _=require(_0xd537('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd537('0x1'));var moment=require(_0xd537('0x2'));var BPromise=require(_0xd537('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd537('0x4'));var rimraf=require(_0xd537('0x5'));var config=require(_0xd537('0x6'));var attributes=require(_0xd537('0x7'));module[_0xd537('0x8')]=function(_0x76804f,_0x43a58b){return _0x76804f['define'](_0xd537('0x9'),attributes,{'tableName':_0xd537('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b2e=['bluebird','request-promise','../../config/environment','./chatWebsite.attributes','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment'];(function(_0x394685,_0x1d3d47){var _0xf60ccb=function(_0x3d2a3b){while(--_0x3d2a3b){_0x394685['push'](_0x394685['shift']());}};_0xf60ccb(++_0x1d3d47);}(_0x1b2e,0xba));var _0xe1b2=function(_0x4cabea,_0x45c2e1){_0x4cabea=_0x4cabea-0x0;var _0x224bc2=_0x1b2e[_0x4cabea];return _0x224bc2;};'use strict';var _=require(_0xe1b2('0x0'));var util=require('util');var logger=require(_0xe1b2('0x1'))(_0xe1b2('0x2'));var moment=require(_0xe1b2('0x3'));var BPromise=require(_0xe1b2('0x4'));var rp=require(_0xe1b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe1b2('0x6'));var attributes=require(_0xe1b2('0x7'));module['exports']=function(_0x37d29f,_0x28e286){return _0x37d29f['define'](_0xe1b2('0x8'),attributes,{'tableName':_0xe1b2('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 6402bbc..8f28c7e 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 _0x9e49=['redis','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x19b824,_0x7c53f3){var _0x4d64c9=function(_0x6e130e){while(--_0x6e130e){_0x19b824['push'](_0x19b824['shift']());}};_0x4d64c9(++_0x7c53f3);}(_0x9e49,0x1e3));var _0x99e4=function(_0x1404c3,_0x588b81){_0x1404c3=_0x1404c3-0x0;var _0x5740a9=_0x9e49[_0x1404c3];return _0x5740a9;};'use strict';var _=require(_0x99e4('0x0'));var util=require(_0x99e4('0x1'));var moment=require('moment');var BPromise=require(_0x99e4('0x2'));var rs=require(_0x99e4('0x3'));var fs=require('fs');var Redis=require(_0x99e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99e4('0x5'));var logger=require(_0x99e4('0x6'))(_0x99e4('0x7'));var config=require('../../config/environment');var jayson=require(_0x99e4('0x8'));var client=jayson[_0x99e4('0x9')][_0x99e4('0xa')]({'port':0x232a});config[_0x99e4('0xb')]=_['defaults'](config['redis'],{'host':_0x99e4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99e4('0xb')]));require(_0x99e4('0xd'))[_0x99e4('0xe')](socket);function respondWithRpcPromise(_0x39ea3c,_0x34a031,_0x57416e){return new BPromise(function(_0x39e157,_0x58c637){return client[_0x99e4('0xf')](_0x39ea3c,_0x57416e)[_0x99e4('0x10')](function(_0x509ad2){logger['info'](_0x99e4('0x11'),_0x34a031,'request\x20sent');logger[_0x99e4('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x34a031,_0x99e4('0x13'),JSON['stringify'](_0x509ad2));if(_0x509ad2['error']){if(_0x509ad2['error'][_0x99e4('0x14')]===0x1f4){logger['error'](_0x99e4('0x11'),_0x34a031,_0x509ad2[_0x99e4('0x15')][_0x99e4('0x16')]);return _0x58c637(_0x509ad2[_0x99e4('0x15')][_0x99e4('0x16')]);}logger[_0x99e4('0x15')](_0x99e4('0x11'),_0x34a031,_0x509ad2[_0x99e4('0x15')]['message']);return _0x39e157(_0x509ad2[_0x99e4('0x15')][_0x99e4('0x16')]);}else{logger[_0x99e4('0x17')](_0x99e4('0x11'),_0x34a031,_0x99e4('0x13'));_0x39e157(_0x509ad2[_0x99e4('0x18')][_0x99e4('0x16')]);}})[_0x99e4('0x19')](function(_0xb3430c){logger[_0x99e4('0x15')](_0x99e4('0x11'),_0x34a031,_0xb3430c);_0x58c637(_0xb3430c);});});} \ No newline at end of file +var _0x8159=['http','redis','defaults','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dc712,_0xd18201){var _0x280e1e=function(_0x21cbdf){while(--_0x21cbdf){_0x3dc712['push'](_0x3dc712['shift']());}};_0x280e1e(++_0xd18201);}(_0x8159,0x1ca));var _0x9815=function(_0x26c47a,_0x526d5b){_0x26c47a=_0x26c47a-0x0;var _0x53c0c0=_0x8159[_0x26c47a];return _0x53c0c0;};'use strict';var _=require(_0x9815('0x0'));var util=require(_0x9815('0x1'));var moment=require('moment');var BPromise=require(_0x9815('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9815('0x3'))['db'];var utils=require(_0x9815('0x4'));var logger=require(_0x9815('0x5'))(_0x9815('0x6'));var config=require(_0x9815('0x7'));var jayson=require(_0x9815('0x8'));var client=jayson[_0x9815('0x9')][_0x9815('0xa')]({'port':0x232a});config[_0x9815('0xb')]=_[_0x9815('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9815('0xb')]));require(_0x9815('0xd'))[_0x9815('0xe')](socket);function respondWithRpcPromise(_0x32f930,_0x5a99fe,_0x4f20e6){return new BPromise(function(_0x1a9501,_0x50921e){return client[_0x9815('0xf')](_0x32f930,_0x4f20e6)[_0x9815('0x10')](function(_0x24265c){logger[_0x9815('0x11')](_0x9815('0x12'),_0x5a99fe,'request\x20sent');logger['debug'](_0x9815('0x13'),_0x5a99fe,'request\x20sent',JSON[_0x9815('0x14')](_0x24265c));if(_0x24265c[_0x9815('0x15')]){if(_0x24265c[_0x9815('0x15')][_0x9815('0x16')]===0x1f4){logger[_0x9815('0x15')](_0x9815('0x12'),_0x5a99fe,_0x24265c[_0x9815('0x15')]['message']);return _0x50921e(_0x24265c['error'][_0x9815('0x17')]);}logger[_0x9815('0x15')](_0x9815('0x12'),_0x5a99fe,_0x24265c[_0x9815('0x15')]['message']);return _0x1a9501(_0x24265c[_0x9815('0x15')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5a99fe,'request\x20sent');_0x1a9501(_0x24265c[_0x9815('0x18')][_0x9815('0x17')]);}})[_0x9815('0x19')](function(_0x3984ca){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5a99fe,_0x3984ca);_0x50921e(_0x3984ca);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index b64ade8..6134d3b 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 _0xa363=['./chatWebsite.events','remove','emit','register','length','chatWebsite:'];(function(_0x319d4d,_0x326f1f){var _0x4e4bdc=function(_0x2cae0d){while(--_0x2cae0d){_0x319d4d['push'](_0x319d4d['shift']());}};_0x4e4bdc(++_0x326f1f);}(_0xa363,0x1a4));var _0x3a36=function(_0x42946c,_0x577d97){_0x42946c=_0x42946c-0x0;var _0x5d7687=_0xa363[_0x42946c];return _0x5d7687;};'use strict';var ChatWebsiteEvents=require(_0x3a36('0x0'));var events=['save',_0x3a36('0x1'),'update'];function createListener(_0x313b9e,_0xaba874){return function(_0x2769e2){_0xaba874[_0x3a36('0x2')](_0x313b9e,_0x2769e2);};}function removeListener(_0x36c53b,_0x12d8d3){return function(){ChatWebsiteEvents['removeListener'](_0x36c53b,_0x12d8d3);};}exports[_0x3a36('0x3')]=function(_0x5a7761){for(var _0x4edefa=0x0,_0x5ac9e9=events[_0x3a36('0x4')];_0x4edefa<_0x5ac9e9;_0x4edefa++){var _0x2e136b=events[_0x4edefa];var _0x3b052e=createListener(_0x3a36('0x5')+_0x2e136b,_0x5a7761);ChatWebsiteEvents['on'](_0x2e136b,_0x3b052e);}}; \ No newline at end of file +var _0x7dfb=['register','length','chatWebsite:','./chatWebsite.events','save','remove','removeListener'];(function(_0x2f4d5f,_0xda7f63){var _0x13dfeb=function(_0x567b81){while(--_0x567b81){_0x2f4d5f['push'](_0x2f4d5f['shift']());}};_0x13dfeb(++_0xda7f63);}(_0x7dfb,0x1ed));var _0xb7df=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x7dfb[_0x397cfb];return _0x15fed9;};'use strict';var ChatWebsiteEvents=require(_0xb7df('0x0'));var events=[_0xb7df('0x1'),_0xb7df('0x2'),'update'];function createListener(_0x183599,_0xe66a98){return function(_0x515725){_0xe66a98['emit'](_0x183599,_0x515725);};}function removeListener(_0x42ab85,_0x5cab27){return function(){ChatWebsiteEvents[_0xb7df('0x3')](_0x42ab85,_0x5cab27);};}exports[_0xb7df('0x4')]=function(_0x5e2bbe){for(var _0x2dfabf=0x0,_0x5d2a07=events[_0xb7df('0x5')];_0x2dfabf<_0x5d2a07;_0x2dfabf++){var _0xfcec61=events[_0x2dfabf];var _0x2d442d=createListener(_0xb7df('0x6')+_0xfcec61,_0x5e2bbe);ChatWebsiteEvents['on'](_0xfcec61,_0x2d442d);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e53069d..c38d8d0 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 _0xeb65=['/:id/offline','any','offline','/:id/interactions','addApplications','addProactiveActions','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','describe','/:id','show','isAuthenticated','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','%s-%s','now','file','addLogo','join','server/files/images/avatars/','originalname','single','addAvatar','addCustomerAvatar','format','addSystemAvatar','/:id/notify','notify','attachments','ensureDir','replace'];(function(_0x3f89e5,_0x2d9fe9){var _0x187d83=function(_0x50ef05){while(--_0x50ef05){_0x3f89e5['push'](_0x3f89e5['shift']());}};_0x187d83(++_0x2d9fe9);}(_0xeb65,0x9e));var _0x5eb6=function(_0x194a08,_0x3cc12d){_0x194a08=_0x194a08-0x0;var _0x5f490c=_0xeb65[_0x194a08];return _0x5f490c;};'use strict';var multer=require('multer');var util=require(_0x5eb6('0x0'));var path=require('path');var timeout=require(_0x5eb6('0x1'));var express=require(_0x5eb6('0x2'));var router=express[_0x5eb6('0x3')]();var fs_extra=require(_0x5eb6('0x4'));var auth=require(_0x5eb6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5eb6('0x6'));var controller=require(_0x5eb6('0x7'));router[_0x5eb6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5eb6('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5eb6('0x9')]);router[_0x5eb6('0x8')](_0x5eb6('0xa'),auth['isAuthenticated'](),controller[_0x5eb6('0xb')]);router[_0x5eb6('0x8')]('/:id/dispositions',auth[_0x5eb6('0xc')](),controller[_0x5eb6('0xd')]);router[_0x5eb6('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x5eb6('0xe'),controller[_0x5eb6('0xf')]);router['get'](_0x5eb6('0x10'),controller[_0x5eb6('0x11')]);router[_0x5eb6('0x8')](_0x5eb6('0x12'),controller[_0x5eb6('0x13')]);router[_0x5eb6('0x8')](_0x5eb6('0x14'),controller[_0x5eb6('0x15')]);router[_0x5eb6('0x8')]('/:id/interactions',auth[_0x5eb6('0xc')](),controller[_0x5eb6('0x16')]);router['get'](_0x5eb6('0x17'),controller[_0x5eb6('0x18')]);router['get'](_0x5eb6('0x19'),auth[_0x5eb6('0xc')](),controller['getApplications']);router['get'](_0x5eb6('0x1a'),auth[_0x5eb6('0xc')](),controller[_0x5eb6('0x1b')]);router[_0x5eb6('0x8')](_0x5eb6('0x1c'),controller[_0x5eb6('0x1d')]);router[_0x5eb6('0x8')]('/:id/offline_messages',auth[_0x5eb6('0xc')](),controller[_0x5eb6('0x1e')]);router[_0x5eb6('0x8')](_0x5eb6('0x1f'),auth[_0x5eb6('0xc')](),controller[_0x5eb6('0x20')]);router[_0x5eb6('0x21')]('/',auth['isAuthenticated'](),controller[_0x5eb6('0x22')]);router[_0x5eb6('0x21')](_0x5eb6('0x23'),auth[_0x5eb6('0xc')](),controller['addDisposition']);router['post'](_0x5eb6('0x24'),auth[_0x5eb6('0xc')](),controller[_0x5eb6('0x25')]);var upload=multer({'storage':multer[_0x5eb6('0x26')]({'destination':function(_0x38ef91,_0x3ae9d2,_0x1e99be){_0x1e99be(null,path['join'](config[_0x5eb6('0x27')],_0x5eb6('0x28')));},'filename':function(_0x1ba819,_0x122c31,_0x25ae40){_0x25ae40(null,util['format'](_0x5eb6('0x29'),Date[_0x5eb6('0x2a')](),_0x122c31['originalname']));}})});router['post'](_0x5eb6('0xe'),upload['single'](_0x5eb6('0x2b')),controller[_0x5eb6('0x2c')]);var upload=multer({'storage':multer[_0x5eb6('0x26')]({'destination':function(_0x47abaf,_0x41ce3f,_0x295100){_0x295100(null,path[_0x5eb6('0x2d')](config[_0x5eb6('0x27')],_0x5eb6('0x2e')));},'filename':function(_0x521cae,_0x1eb3f1,_0x2a74c1){_0x2a74c1(null,util['format']('%s-%s',Date['now'](),_0x1eb3f1[_0x5eb6('0x2f')]));}})});router[_0x5eb6('0x21')](_0x5eb6('0x10'),upload[_0x5eb6('0x30')]('file'),controller[_0x5eb6('0x31')]);var upload=multer({'storage':multer[_0x5eb6('0x26')]({'destination':function(_0x3a8b5a,_0xb0eb0a,_0x8e9139){_0x8e9139(null,path['join'](config[_0x5eb6('0x27')],_0x5eb6('0x2e')));},'filename':function(_0x49c0ef,_0x408daa,_0x112db6){_0x112db6(null,util['format']('%s-%s',Date[_0x5eb6('0x2a')](),_0x408daa[_0x5eb6('0x2f')]));}})});router[_0x5eb6('0x21')](_0x5eb6('0x12'),upload[_0x5eb6('0x30')](_0x5eb6('0x2b')),controller[_0x5eb6('0x32')]);var upload=multer({'storage':multer[_0x5eb6('0x26')]({'destination':function(_0xdcebd8,_0x13f477,_0x498bbc){_0x498bbc(null,path[_0x5eb6('0x2d')](config[_0x5eb6('0x27')],_0x5eb6('0x2e')));},'filename':function(_0x1ce27e,_0x11c1d1,_0x36087e){_0x36087e(null,util[_0x5eb6('0x33')](_0x5eb6('0x29'),Date[_0x5eb6('0x2a')](),_0x11c1d1['originalname']));}})});router[_0x5eb6('0x21')](_0x5eb6('0x14'),upload[_0x5eb6('0x30')](_0x5eb6('0x2b')),controller[_0x5eb6('0x34')]);router['post'](_0x5eb6('0x35'),controller[_0x5eb6('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2c523f,_0x1ac438,_0x4a3ac3){const _0x44f83f=path[_0x5eb6('0x2d')](config['root'],'server/files',_0x5eb6('0x37'),'offline-chat');fs_extra[_0x5eb6('0x38')](_0x44f83f,function(){_0x4a3ac3(null,_0x44f83f);});},'filename':function(_0x181253,_0x38e7f5,_0x4e253f){const _0x1726dc=_0x38e7f5[_0x5eb6('0x2f')][_0x5eb6('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3b38a1=path['extname'](_0x1726dc);const _0x19a563=Date[_0x5eb6('0x2a')]()+'-'+_0x1726dc[_0x5eb6('0x39')](_0x3b38a1,'')+_0x3b38a1;_0x4e253f(null,_0x19a563);}})});router['post'](_0x5eb6('0x3a'),offlineUploadMulter[_0x5eb6('0x3b')](),controller[_0x5eb6('0x3c')]);router['post'](_0x5eb6('0x3d'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x5eb6('0x21')](_0x5eb6('0x19'),auth[_0x5eb6('0xc')](),controller[_0x5eb6('0x3e')]);router[_0x5eb6('0x21')]('/:id/proactive_actions',auth[_0x5eb6('0xc')](),controller[_0x5eb6('0x3f')]);router[_0x5eb6('0x21')](_0x5eb6('0x1f'),auth['isAuthenticated'](),controller[_0x5eb6('0x40')]);router[_0x5eb6('0x41')](_0x5eb6('0xa'),auth[_0x5eb6('0xc')](),controller['update']);router[_0x5eb6('0x42')]('/:id',auth[_0x5eb6('0xc')](),controller[_0x5eb6('0x43')]);router[_0x5eb6('0x42')](_0x5eb6('0x23'),auth['isAuthenticated'](),controller[_0x5eb6('0x44')]);router[_0x5eb6('0x42')](_0x5eb6('0x24'),auth[_0x5eb6('0xc')](),controller[_0x5eb6('0x45')]);router[_0x5eb6('0x42')](_0x5eb6('0x1f'),auth['isAuthenticated'](),controller[_0x5eb6('0x46')]);module[_0x5eb6('0x47')]=router; \ No newline at end of file +var _0xd590=['post','addDisposition','addAnswer','diskStorage','join','root','format','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','/:id/avatar','addAvatar','%s-%s','addCustomerAvatar','/:id/notify','server/files','attachments','offline-chat','replace','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/dispositions','getDispositions','getAnswers','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create'];(function(_0x36b349,_0x27bd8d){var _0x19b37d=function(_0x48be0d){while(--_0x48be0d){_0x36b349['push'](_0x36b349['shift']());}};_0x19b37d(++_0x27bd8d);}(_0xd590,0xfa));var _0x0d59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd590[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0d59('0x0'));var timeout=require('connect-timeout');var express=require(_0x0d59('0x1'));var router=express[_0x0d59('0x2')]();var fs_extra=require(_0x0d59('0x3'));var auth=require(_0x0d59('0x4'));var interaction=require(_0x0d59('0x5'));var config=require(_0x0d59('0x6'));var controller=require(_0x0d59('0x7'));router['get']('/',auth[_0x0d59('0x8')](),controller[_0x0d59('0x9')]);router['get'](_0x0d59('0xa'),auth[_0x0d59('0x8')](),controller[_0x0d59('0xb')]);router[_0x0d59('0xc')](_0x0d59('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0d59('0xc')](_0x0d59('0xe'),auth['isAuthenticated'](),controller[_0x0d59('0xf')]);router[_0x0d59('0xc')]('/:id/canned_answers',auth[_0x0d59('0x8')](),controller[_0x0d59('0x10')]);router[_0x0d59('0xc')]('/:id/logo',controller[_0x0d59('0x11')]);router['get']('/:id/avatar',controller[_0x0d59('0x12')]);router['get'](_0x0d59('0x13'),controller[_0x0d59('0x14')]);router[_0x0d59('0xc')](_0x0d59('0x15'),controller[_0x0d59('0x16')]);router[_0x0d59('0xc')](_0x0d59('0x17'),auth[_0x0d59('0x8')](),controller[_0x0d59('0x18')]);router['get'](_0x0d59('0x19'),controller['getSnippet']);router[_0x0d59('0xc')]('/:id/applications',auth[_0x0d59('0x8')](),controller[_0x0d59('0x1a')]);router['get']('/:id/proactive_actions',auth[_0x0d59('0x8')](),controller['getProactiveActions']);router[_0x0d59('0xc')](_0x0d59('0x1b'),controller[_0x0d59('0x1c')]);router[_0x0d59('0xc')](_0x0d59('0x1d'),auth['isAuthenticated'](),controller[_0x0d59('0x1e')]);router[_0x0d59('0xc')](_0x0d59('0x1f'),auth[_0x0d59('0x8')](),controller[_0x0d59('0x20')]);router['post']('/',auth[_0x0d59('0x8')](),controller[_0x0d59('0x21')]);router[_0x0d59('0x22')](_0x0d59('0xe'),auth['isAuthenticated'](),controller[_0x0d59('0x23')]);router[_0x0d59('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0d59('0x24')]);var upload=multer({'storage':multer[_0x0d59('0x25')]({'destination':function(_0x35c407,_0x1b9197,_0x129633){_0x129633(null,path[_0x0d59('0x26')](config[_0x0d59('0x27')],'server/files/images/logos/'));},'filename':function(_0x147d55,_0xc77e49,_0x27fd85){_0x27fd85(null,util[_0x0d59('0x28')]('%s-%s',Date[_0x0d59('0x29')](),_0xc77e49[_0x0d59('0x2a')]));}})});router['post'](_0x0d59('0x2b'),upload[_0x0d59('0x2c')](_0x0d59('0x2d')),controller[_0x0d59('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2cf959,_0x4f84b5,_0x328552){_0x328552(null,path[_0x0d59('0x26')](config[_0x0d59('0x27')],_0x0d59('0x2f')));},'filename':function(_0x56d8e1,_0x2aec36,_0x597509){_0x597509(null,util[_0x0d59('0x28')]('%s-%s',Date[_0x0d59('0x29')](),_0x2aec36[_0x0d59('0x2a')]));}})});router[_0x0d59('0x22')](_0x0d59('0x30'),upload[_0x0d59('0x2c')](_0x0d59('0x2d')),controller[_0x0d59('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c49b8,_0x16ca27,_0x19d7e8){_0x19d7e8(null,path['join'](config[_0x0d59('0x27')],_0x0d59('0x2f')));},'filename':function(_0x553343,_0x4ad377,_0xaaf3ad){_0xaaf3ad(null,util[_0x0d59('0x28')](_0x0d59('0x32'),Date['now'](),_0x4ad377[_0x0d59('0x2a')]));}})});router['post'](_0x0d59('0x13'),upload[_0x0d59('0x2c')](_0x0d59('0x2d')),controller[_0x0d59('0x33')]);var upload=multer({'storage':multer[_0x0d59('0x25')]({'destination':function(_0x125784,_0x216e94,_0x1b5a13){_0x1b5a13(null,path[_0x0d59('0x26')](config[_0x0d59('0x27')],_0x0d59('0x2f')));},'filename':function(_0x2d44f3,_0x2924b9,_0x2df364){_0x2df364(null,util[_0x0d59('0x28')](_0x0d59('0x32'),Date[_0x0d59('0x29')](),_0x2924b9['originalname']));}})});router[_0x0d59('0x22')](_0x0d59('0x15'),upload['single'](_0x0d59('0x2d')),controller['addSystemAvatar']);router[_0x0d59('0x22')](_0x0d59('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2c4cee,_0x4fad3c,_0x48505a){const _0x558d0a=path['join'](config['root'],_0x0d59('0x35'),_0x0d59('0x36'),_0x0d59('0x37'));fs_extra['ensureDir'](_0x558d0a,function(){_0x48505a(null,_0x558d0a);});},'filename':function(_0x21c3e5,_0x2ae1d6,_0x202688){const _0x2914cc=_0x2ae1d6[_0x0d59('0x2a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3c2f74=path['extname'](_0x2914cc);const _0x4c8bcc=Date[_0x0d59('0x29')]()+'-'+_0x2914cc[_0x0d59('0x38')](_0x3c2f74,'')+_0x3c2f74;_0x202688(null,_0x4c8bcc);}})});router[_0x0d59('0x22')](_0x0d59('0x39'),offlineUploadMulter[_0x0d59('0x3a')](),controller[_0x0d59('0x3b')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x0d59('0x3c')]);router['post'](_0x0d59('0x3d'),auth[_0x0d59('0x8')](),controller[_0x0d59('0x3e')]);router[_0x0d59('0x22')]('/:id/proactive_actions',auth[_0x0d59('0x8')](),controller[_0x0d59('0x3f')]);router[_0x0d59('0x22')](_0x0d59('0x1f'),auth[_0x0d59('0x8')](),controller[_0x0d59('0x40')]);router[_0x0d59('0x41')](_0x0d59('0xd'),auth[_0x0d59('0x8')](),controller['update']);router[_0x0d59('0x42')](_0x0d59('0xd'),auth[_0x0d59('0x8')](),controller['destroy']);router[_0x0d59('0x42')]('/:id/dispositions',auth[_0x0d59('0x8')](),controller[_0x0d59('0x43')]);router[_0x0d59('0x42')](_0x0d59('0x44'),auth[_0x0d59('0x8')](),controller[_0x0d59('0x45')]);router[_0x0d59('0x42')]('/:id/users',auth[_0x0d59('0x8')](),controller[_0x0d59('0x46')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 59c7b15..2d12db4 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 _0x39d2=['get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','production','app'];(function(_0x4073a2,_0x35b64b){var _0x1794c1=function(_0xd7af05){while(--_0xd7af05){_0x4073a2['push'](_0x4073a2['shift']());}};_0x1794c1(++_0x35b64b);}(_0x39d2,0x14c));var _0x239d=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x39d2[_0x568496];return _0x26c5c1;};var beaverLogger=require(_0x239d('0x0'));var express=require(_0x239d('0x1'));var auth=require(_0x239d('0x2'));var config=require('../config/environment');var router=express[_0x239d('0x3')]();var isProduction=config['env']===_0x239d('0x4')||![];function clientSideLogs(_0x5002e3,_0x183f96,_0x17ff4a){var _0x11f762=_0x5002e3[_0x239d('0x5')][_0x239d('0x6')]('client-side-logger');if(!_0x11f762){throw new Error(_0x239d('0x7'));}return beaverLogger[_0x239d('0x8')]({'uri':_0x239d('0x9'),'logger':_0x11f762,'enableCors':!isProduction})(_0x5002e3,_0x183f96,_0x17ff4a);}router[_0x239d('0xa')](auth[_0x239d('0xb')](),clientSideLogs);module[_0x239d('0xc')]=router; \ No newline at end of file +var _0xe713=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe713,0x1e0));var _0x3e71=function(_0x248c90,_0x1ed333){_0x248c90=_0x248c90-0x0;var _0x449036=_0xe713[_0x248c90];return _0x449036;};var beaverLogger=require(_0x3e71('0x0'));var express=require(_0x3e71('0x1'));var auth=require(_0x3e71('0x2'));var config=require('../config/environment');var router=express[_0x3e71('0x3')]();var isProduction=config['env']===_0x3e71('0x4')||![];function clientSideLogs(_0x33deea,_0x5128aa,_0xeb27ac){var _0x506712=_0x33deea[_0x3e71('0x5')][_0x3e71('0x6')](_0x3e71('0x7'));if(!_0x506712){throw new Error(_0x3e71('0x8'));}return beaverLogger[_0x3e71('0x9')]({'uri':_0x3e71('0xa'),'logger':_0x506712,'enableCors':!isProduction})(_0x33deea,_0x5128aa,_0xeb27ac);}router[_0x3e71('0xb')](auth[_0x3e71('0xc')](),clientSideLogs);module[_0x3e71('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 4f21eca..d50e045 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 _0xd3bc=['MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','Google'];(function(_0x4baadb,_0x236e1b){var _0xd6d791=function(_0x218e41){while(--_0x218e41){_0x4baadb['push'](_0x4baadb['shift']());}};_0xd6d791(++_0x236e1b);}(_0xd3bc,0xc7));var _0xcd3b=function(_0x2114a7,_0x31f2a5){_0x2114a7=_0x2114a7-0x0;var _0x2211c4=_0xd3bc[_0x2114a7];return _0x2211c4;};'use strict';var Sequelize=require(_0xcd3b('0x0'));module[_0xcd3b('0x1')]={'name':{'type':Sequelize[_0xcd3b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xcd3b('0x3')]('AmazonAWS',_0xcd3b('0x4'),_0xcd3b('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0xcd3b('0x6'))},'data1':{'type':Sequelize[_0xcd3b('0x2')],'comment':_0xcd3b('0x7')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0xcd3b('0x8')},'data4':{'type':Sequelize[_0xcd3b('0x2')],'comment':_0xcd3b('0x9')},'data5':{'type':Sequelize[_0xcd3b('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xcd3b('0xa')],'comment':_0xcd3b('0xb')},'data7':{'type':Sequelize[_0xcd3b('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x670e=['MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant'];(function(_0x547af,_0x17abff){var _0x22f7f4=function(_0x5f0384){while(--_0x5f0384){_0x547af['push'](_0x547af['shift']());}};_0x22f7f4(++_0x17abff);}(_0x670e,0x100));var _0xe670=function(_0x1aa359,_0x27927e){_0x1aa359=_0x1aa359-0x0;var _0x5bce5e=_0x670e[_0x1aa359];return _0x5bce5e;};'use strict';var Sequelize=require(_0xe670('0x0'));module['exports']={'name':{'type':Sequelize[_0xe670('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe670('0x2')]('AmazonAWS',_0xe670('0x3'),_0xe670('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe670('0x2')](_0xe670('0x5'),_0xe670('0x6'))},'data1':{'type':Sequelize[_0xe670('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xe670('0x1')],'comment':_0xe670('0x7')},'data3':{'type':Sequelize[_0xe670('0x1')],'comment':_0xe670('0x8')},'data4':{'type':Sequelize[_0xe670('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xe670('0x9')],'comment':_0xe670('0xa')},'data6':{'type':Sequelize[_0xe670('0x9')],'comment':_0xe670('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 58d33c3..b72f94f 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 _0xe46a=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','merge','service','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','find','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','parse','from','state','base64','toString','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','emit','microsoftAuthorization:success','message','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','api','defaults','localhost','redis','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','error','stack','name','send','padEnd','slice','index','map','CloudProvider','fieldName','type'];(function(_0x61ad75,_0x198be6){var _0x37bab5=function(_0x13835f){while(--_0x13835f){_0x61ad75['push'](_0x61ad75['shift']());}};_0x37bab5(++_0x198be6);}(_0xe46a,0x1b8));var _0xae46=function(_0x367e21,_0x5373a5){_0x367e21=_0x367e21-0x0;var _0x30901a=_0xe46a[_0x367e21];return _0x30901a;};'use strict';var _=require(_0xae46('0x0'));var Redis=require(_0xae46('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xae46('0x2'));var config=require(_0xae46('0x3'));var logger=require('../../config/logger')(_0xae46('0x4'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_[_0xae46('0x5')](config['redis'],{'host':_0xae46('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae46('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x49609e,_0x297386){_0x297386=_0x297386||0xcc;return function(_0x1aad23){if(_0x1aad23){return _0x49609e[_0xae46('0x8')](_0x297386);}return _0x49609e[_0xae46('0x9')](_0x297386)[_0xae46('0xa')]();};}function respondWithResult(_0x1b7cf2,_0x4e0d23){_0x4e0d23=_0x4e0d23||0xc8;return function(_0x19f36f){if(_0x19f36f){return _0x1b7cf2['status'](_0x4e0d23)[_0xae46('0xb')](_0x19f36f);}};}function respondWithFilteredResult(_0x45ca38,_0x5acf0f){return function(_0x2eba73){if(_0x2eba73){var _0xb34b8b=typeof _0x5acf0f[_0xae46('0xc')]===_0xae46('0xd')&&typeof _0x5acf0f['limit']===_0xae46('0xd');var _0x241f4f=_0x2eba73['count'];var _0x37b760=_0xb34b8b?0x0:_0x5acf0f[_0xae46('0xc')];var _0x50be8c=_0xb34b8b?_0x2eba73['count']:_0x5acf0f[_0xae46('0xc')]+_0x5acf0f[_0xae46('0xe')];var _0x2e41ab;if(_0x50be8c>=_0x241f4f){_0x50be8c=_0x241f4f;_0x2e41ab=0xc8;}else{_0x2e41ab=0xce;}_0x45ca38['status'](_0x2e41ab);return _0x45ca38[_0xae46('0xf')](_0xae46('0x10'),_0x37b760+'-'+_0x50be8c+'/'+_0x241f4f)[_0xae46('0xb')](_0x2eba73);}return null;};}function saveUpdates(_0x4d614b){return function(_0xcd6118){if(_0xcd6118){return _0xcd6118[_0xae46('0x11')](_0x4d614b)[_0xae46('0x12')](function(_0x3ef607){return _0x3ef607;});}return null;};}function removeEntity(_0x528927){return function(_0x24e34b){if(_0x24e34b){return _0x24e34b['destroy']()[_0xae46('0x12')](function(){_0x528927['status'](0xcc)[_0xae46('0xa')]();});}};}function handleEntityNotFound(_0x116d28){return function(_0x13b5e7){if(!_0x13b5e7){_0x116d28[_0xae46('0x8')](0x194);}return _0x13b5e7;};}function handleError(_0x3dfa1b,_0x1b8141){_0x1b8141=_0x1b8141||0x1f4;return function(_0x17c4d8){logger[_0xae46('0x13')](_0x17c4d8[_0xae46('0x14')]);if(_0x17c4d8[_0xae46('0x15')]){delete _0x17c4d8[_0xae46('0x15')];}_0x3dfa1b[_0xae46('0x9')](_0x1b8141)[_0xae46('0x16')](_0x17c4d8);};}function maskClientSecret(_0x5d33b3){return _[_0xae46('0x17')](_0x5d33b3[_0xae46('0x18')](0x0,0x3),0x14,'*');}exports[_0xae46('0x19')]=function(_0x5103e7,_0x2f8555){var _0x40c3a0={},_0x53663d={},_0x2aebef={'count':0x0,'rows':[]};var _0x551678=_[_0xae46('0x1a')](db[_0xae46('0x1b')]['rawAttributes'],function(_0x51fa01){return{'name':_0x51fa01[_0xae46('0x1c')],'type':_0x51fa01[_0xae46('0x1d')][_0xae46('0x1e')]};});_0x53663d[_0xae46('0x1f')]=_[_0xae46('0x1a')](_0x551678,_0xae46('0x15'));_0x53663d[_0xae46('0x20')]=_[_0xae46('0x21')](_0x5103e7[_0xae46('0x20')]);_0x53663d[_0xae46('0x22')]=_[_0xae46('0x23')](_0x53663d[_0xae46('0x1f')],_0x53663d[_0xae46('0x20')]);_0x40c3a0[_0xae46('0x24')]=_[_0xae46('0x23')](_0x53663d[_0xae46('0x1f')],qs[_0xae46('0x25')](_0x5103e7['query'][_0xae46('0x25')]));_0x40c3a0[_0xae46('0x24')]=_0x40c3a0[_0xae46('0x24')][_0xae46('0x26')]?_0x40c3a0['attributes']:_0x53663d[_0xae46('0x1f')];if(!_0x5103e7[_0xae46('0x20')][_0xae46('0x27')](_0xae46('0x28'))){_0x40c3a0[_0xae46('0xe')]=qs[_0xae46('0xe')](_0x5103e7[_0xae46('0x20')]['limit']);_0x40c3a0[_0xae46('0xc')]=qs[_0xae46('0xc')](_0x5103e7[_0xae46('0x20')]['offset']);}_0x40c3a0[_0xae46('0x29')]=qs[_0xae46('0x2a')](_0x5103e7[_0xae46('0x20')][_0xae46('0x2a')]);_0x40c3a0[_0xae46('0x2b')]=qs[_0xae46('0x22')](_[_0xae46('0x2c')](_0x5103e7[_0xae46('0x20')],_0x53663d[_0xae46('0x22')]),_0x551678);if(_0x5103e7[_0xae46('0x20')]['filter']){_0x40c3a0[_0xae46('0x2b')]=_['merge'](_0x40c3a0[_0xae46('0x2b')],{'$or':_[_0xae46('0x1a')](_0x551678,function(_0x11e779){if(_0x11e779[_0xae46('0x1d')]!==_0xae46('0x2d')){var _0x32dd5a={};_0x32dd5a[_0x11e779[_0xae46('0x15')]]={'$like':'%'+_0x5103e7['query'][_0xae46('0x2e')]+'%'};return _0x32dd5a;}})});}_0x40c3a0=_['merge']({},_0x40c3a0,_0x5103e7[_0xae46('0x2f')]);var _0x5f2d2f={'where':_0x40c3a0[_0xae46('0x2b')]};return db[_0xae46('0x1b')][_0xae46('0x30')](_0x5f2d2f)[_0xae46('0x12')](function(_0x5de1aa){_0x2aebef[_0xae46('0x30')]=_0x5de1aa;if(_0x5103e7[_0xae46('0x20')][_0xae46('0x31')]){_0x40c3a0[_0xae46('0x32')]=[{'all':!![]}];}return db['CloudProvider'][_0xae46('0x33')](_0x40c3a0);})['then'](function(_0x1200de){_0x2aebef[_0xae46('0x34')]=_[_0xae46('0x1a')](_0x1200de,function(_0x33505c){if(_0x33505c['service']===_0xae46('0x35')){var _0x52e040=encryptor[_0xae46('0x36')](_0x33505c[_0xae46('0x37')]);_0x33505c[_0xae46('0x37')]=maskClientSecret(_0x52e040);}return _0x33505c;});return _0x2aebef;})[_0xae46('0x12')](respondWithFilteredResult(_0x2f8555,_0x40c3a0))[_0xae46('0x38')](handleError(_0x2f8555,null));};exports[_0xae46('0x39')]=function(_0x5f1287,_0x486d28){var _0x22d9fd={'raw':!![],'where':{'id':_0x5f1287[_0xae46('0x3a')]['id']}},_0x150454={};_0x150454[_0xae46('0x1f')]=_[_0xae46('0x21')](db[_0xae46('0x1b')][_0xae46('0x3b')]);_0x150454[_0xae46('0x20')]=_[_0xae46('0x21')](_0x5f1287[_0xae46('0x20')]);_0x150454[_0xae46('0x22')]=_['intersection'](_0x150454['model'],_0x150454['query']);_0x22d9fd['attributes']=_[_0xae46('0x23')](_0x150454[_0xae46('0x1f')],qs['fields'](_0x5f1287[_0xae46('0x20')]['fields']));_0x22d9fd[_0xae46('0x24')]=_0x22d9fd[_0xae46('0x24')][_0xae46('0x26')]?_0x22d9fd[_0xae46('0x24')]:_0x150454[_0xae46('0x1f')];if(_0x5f1287[_0xae46('0x20')][_0xae46('0x31')]){_0x22d9fd['include']=[{'all':!![]}];}_0x22d9fd=_[_0xae46('0x3c')]({},_0x22d9fd,_0x5f1287['options']);return db[_0xae46('0x1b')]['find'](_0x22d9fd)['then'](handleEntityNotFound(_0x486d28,null))[_0xae46('0x12')](function(_0x1d8179){if(_0x1d8179[_0xae46('0x3d')]===_0xae46('0x35')){var _0x5ca01b=encryptor[_0xae46('0x36')](_0x1d8179['data3']);_0x1d8179[_0xae46('0x37')]=maskClientSecret(_0x5ca01b);}return _0x1d8179;})[_0xae46('0x12')](respondWithResult(_0x486d28,null))['catch'](handleError(_0x486d28,null));};exports[_0xae46('0x3e')]=function(_0x36d554,_0x18f7c3){if(!_0x36d554['body'][_0xae46('0x15')])throw new Error(_0xae46('0x3f'));if(!_0x36d554[_0xae46('0x40')]['service'])throw new Error(_0xae46('0x41'));var _0x5274b0=db[_0xae46('0x1b')]['rawAttributes'][_0xae46('0x3d')][_0xae46('0x42')];if(!_0x5274b0[_0xae46('0x43')](_0x36d554[_0xae46('0x40')][_0xae46('0x3d')]))throw new Error(_0xae46('0x44')+_0x5274b0['join'](',\x20'));if(_0x36d554[_0xae46('0x40')][_0xae46('0x3d')]===_0xae46('0x35')&&_0x36d554[_0xae46('0x40')]['data3']){_0x36d554[_0xae46('0x40')][_0xae46('0x37')]=encryptor[_0xae46('0x45')](_0x36d554['body'][_0xae46('0x37')]);}return db[_0xae46('0x1b')][_0xae46('0x3e')](_0x36d554['body'],{})[_0xae46('0x12')](respondWithResult(_0x18f7c3,0xc9))[_0xae46('0x38')](handleError(_0x18f7c3,null));};exports[_0xae46('0x11')]=function(_0x259005,_0x410ee3){if(_0x259005[_0xae46('0x40')]['id']){delete _0x259005[_0xae46('0x40')]['id'];}return db[_0xae46('0x1b')][_0xae46('0x46')]({'where':{'id':_0x259005[_0xae46('0x3a')]['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x410ee3,null))[_0xae46('0x12')](function(_0x4e4961){if(_0x4e4961[_0xae46('0x3d')]===_0xae46('0x35')&&_0x259005[_0xae46('0x40')][_0xae46('0x37')]){_0x259005[_0xae46('0x40')][_0xae46('0x37')]=encryptor[_0xae46('0x45')](_0x259005[_0xae46('0x40')][_0xae46('0x37')]);}return _0x4e4961;})[_0xae46('0x12')](saveUpdates(_0x259005[_0xae46('0x40')],null))[_0xae46('0x12')](respondWithResult(_0x410ee3,null))[_0xae46('0x38')](handleError(_0x410ee3,null));};exports[_0xae46('0x47')]=function(_0x4ba5c2,_0x1dd47e){return db[_0xae46('0x1b')][_0xae46('0x46')]({'where':{'id':_0x4ba5c2[_0xae46('0x3a')]['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x1dd47e,null))[_0xae46('0x12')](removeEntity(_0x1dd47e,null))[_0xae46('0x38')](handleError(_0x1dd47e,null));};exports[_0xae46('0x48')]=function(_0x354760,_0x48be6c){return db[_0xae46('0x1b')][_0xae46('0x49')]({'where':{'id':_0x354760[_0xae46('0x3a')]['id']},'raw':!![]})[_0xae46('0x12')](function(_0x5013c8){if(!_0x5013c8)return _0x48be6c[_0xae46('0x8')](0x194);return{'url':oauth[_0xae46('0x4a')](_0x5013c8,_0x354760['user']['id'])};})['then'](respondWithResult(_0x48be6c,null))[_0xae46('0x38')](handleError(_0x48be6c,null));};exports[_0xae46('0x4b')]=function(_0x3d24ff,_0x25ac14){var _0x253008=_0x3d24ff[_0xae46('0x40')];var _0x43eeca;var _0xfee1b8;if(_0x253008['error'])throw _0x253008;redis[_0xae46('0x4c')](_0x253008['state'])[_0xae46('0x12')](function(_0x5e1f99){if(!_0x5e1f99)throw new Error('Invalid\x20state\x20parameter');_0x43eeca=JSON[_0xae46('0x4d')](_0x5e1f99);var _0x42ace2=Buffer[_0xae46('0x4e')](_0x253008[_0xae46('0x4f')],_0xae46('0x50'))[_0xae46('0x51')]('ascii');_0xfee1b8=JSON[_0xae46('0x4d')](_0x42ace2);if(!oauth[_0xae46('0x52')](_0x253008[_0xae46('0x53')],_0x43eeca['oauth2Claims']))throw new Error(_0xae46('0x54'));redis[_0xae46('0x55')](_0x253008[_0xae46('0x4f')]);return oauth[_0xae46('0x56')](_0x253008[_0xae46('0x57')],_0x43eeca);})[_0xae46('0x12')](function(_0x2ebd31){_0x43eeca[_0xae46('0x58')]=_0x2ebd31['access_token'];_0x43eeca['data6']=_0x2ebd31['refresh_token'];return db[_0xae46('0x1b')]['update']({'data5':_0x43eeca['data5'],'data6':_0x43eeca[_0xae46('0x59')]},{'where':{'id':_0x43eeca['id']}});})[_0xae46('0x12')](function(){oauth['startRefreshInterval'](_0x43eeca);socket[_0xae46('0x5a')](_0xae46('0x5b'),{'id':_0xfee1b8['id']});return;})[_0xae46('0x12')](respondWithStatusCode(_0x25ac14,null))[_0xae46('0x38')](function(_0x3a64b6){if(_0xfee1b8){socket['emit']('microsoftAuthorization:error',{'id':_0xfee1b8['id']});}if(!_0x43eeca){logger[_0xae46('0x13')]('Invalid\x20authentication\x20state\x20parameter',_0x3a64b6);return _0x25ac14['status'](0x1f4)['send'](_0x3a64b6[_0xae46('0x5c')]);}logger[_0xae46('0x13')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x43eeca['id'],JSON[_0xae46('0x5d')](_0x3a64b6));});}; \ No newline at end of file +var _0x56f1=['sendStatus','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','status','end','name','padEnd','slice','index','CloudProvider','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','MicrosoftAzure','decryptString','data3','catch','rawAttributes','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','service','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','error','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','refresh_token','data6','startRefreshInterval','emit','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter'];(function(_0x28a2f4,_0x188689){var _0x1919fa=function(_0x3d1585){while(--_0x3d1585){_0x28a2f4['push'](_0x28a2f4['shift']());}};_0x1919fa(++_0x188689);}(_0x56f1,0x1b8));var _0x156f=function(_0x6bc5cb,_0x291daa){_0x6bc5cb=_0x6bc5cb-0x0;var _0x4436a2=_0x56f1[_0x6bc5cb];return _0x4436a2;};'use strict';var _=require(_0x156f('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x156f('0x1'));var config=require(_0x156f('0x2'));var logger=require(_0x156f('0x3'))(_0x156f('0x4'));var db=require(_0x156f('0x5'))['db'];var oauth=require(_0x156f('0x6'));config[_0x156f('0x7')]=_[_0x156f('0x8')](config[_0x156f('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x156f('0x9'))(new Redis(config[_0x156f('0x7')]));var redis=new Redis(config[_0x156f('0x7')]);function respondWithStatusCode(_0x49d3db,_0x409d61){_0x409d61=_0x409d61||0xcc;return function(_0x405a0c){if(_0x405a0c){return _0x49d3db[_0x156f('0xa')](_0x409d61);}return _0x49d3db['status'](_0x409d61)['end']();};}function respondWithResult(_0x3614b9,_0x3e044a){_0x3e044a=_0x3e044a||0xc8;return function(_0x19c927){if(_0x19c927){return _0x3614b9['status'](_0x3e044a)[_0x156f('0xb')](_0x19c927);}};}function respondWithFilteredResult(_0x34c811,_0x5add11){return function(_0x34ec37){if(_0x34ec37){var _0x1d98a6=typeof _0x5add11[_0x156f('0xc')]===_0x156f('0xd')&&typeof _0x5add11[_0x156f('0xe')]===_0x156f('0xd');var _0x5bb99d=_0x34ec37[_0x156f('0xf')];var _0x3a32df=_0x1d98a6?0x0:_0x5add11[_0x156f('0xc')];var _0x8ee942=_0x1d98a6?_0x34ec37[_0x156f('0xf')]:_0x5add11[_0x156f('0xc')]+_0x5add11[_0x156f('0xe')];var _0x463703;if(_0x8ee942>=_0x5bb99d){_0x8ee942=_0x5bb99d;_0x463703=0xc8;}else{_0x463703=0xce;}_0x34c811['status'](_0x463703);return _0x34c811[_0x156f('0x10')](_0x156f('0x11'),_0x3a32df+'-'+_0x8ee942+'/'+_0x5bb99d)[_0x156f('0xb')](_0x34ec37);}return null;};}function saveUpdates(_0x1ce470){return function(_0x28cca0){if(_0x28cca0){return _0x28cca0[_0x156f('0x12')](_0x1ce470)[_0x156f('0x13')](function(_0x275beb){return _0x275beb;});}return null;};}function removeEntity(_0xd1c10d){return function(_0x292ef9){if(_0x292ef9){return _0x292ef9[_0x156f('0x14')]()[_0x156f('0x13')](function(){_0xd1c10d[_0x156f('0x15')](0xcc)[_0x156f('0x16')]();});}};}function handleEntityNotFound(_0x3ca94e){return function(_0x4cd577){if(!_0x4cd577){_0x3ca94e[_0x156f('0xa')](0x194);}return _0x4cd577;};}function handleError(_0x37cd3b,_0x1be653){_0x1be653=_0x1be653||0x1f4;return function(_0x4039a1){logger['error'](_0x4039a1['stack']);if(_0x4039a1[_0x156f('0x17')]){delete _0x4039a1[_0x156f('0x17')];}_0x37cd3b[_0x156f('0x15')](_0x1be653)['send'](_0x4039a1);};}function maskClientSecret(_0xc0076f){return _[_0x156f('0x18')](_0xc0076f[_0x156f('0x19')](0x0,0x3),0x14,'*');}exports[_0x156f('0x1a')]=function(_0x1eec4f,_0x6a1ddb){var _0x448fbd={},_0x3d59cb={},_0x51035c={'count':0x0,'rows':[]};var _0x497db0=_['map'](db[_0x156f('0x1b')]['rawAttributes'],function(_0x242233){return{'name':_0x242233[_0x156f('0x1c')],'type':_0x242233[_0x156f('0x1d')][_0x156f('0x1e')]};});_0x3d59cb[_0x156f('0x1f')]=_[_0x156f('0x20')](_0x497db0,_0x156f('0x17'));_0x3d59cb['query']=_[_0x156f('0x21')](_0x1eec4f[_0x156f('0x22')]);_0x3d59cb[_0x156f('0x23')]=_[_0x156f('0x24')](_0x3d59cb[_0x156f('0x1f')],_0x3d59cb[_0x156f('0x22')]);_0x448fbd[_0x156f('0x25')]=_[_0x156f('0x24')](_0x3d59cb['model'],qs[_0x156f('0x26')](_0x1eec4f['query']['fields']));_0x448fbd[_0x156f('0x25')]=_0x448fbd[_0x156f('0x25')][_0x156f('0x27')]?_0x448fbd[_0x156f('0x25')]:_0x3d59cb[_0x156f('0x1f')];if(!_0x1eec4f[_0x156f('0x22')][_0x156f('0x28')]('nolimit')){_0x448fbd[_0x156f('0xe')]=qs[_0x156f('0xe')](_0x1eec4f['query'][_0x156f('0xe')]);_0x448fbd[_0x156f('0xc')]=qs[_0x156f('0xc')](_0x1eec4f[_0x156f('0x22')][_0x156f('0xc')]);}_0x448fbd['order']=qs['sort'](_0x1eec4f[_0x156f('0x22')][_0x156f('0x29')]);_0x448fbd[_0x156f('0x2a')]=qs[_0x156f('0x23')](_[_0x156f('0x2b')](_0x1eec4f[_0x156f('0x22')],_0x3d59cb[_0x156f('0x23')]),_0x497db0);if(_0x1eec4f[_0x156f('0x22')][_0x156f('0x2c')]){_0x448fbd[_0x156f('0x2a')]=_[_0x156f('0x2d')](_0x448fbd[_0x156f('0x2a')],{'$or':_[_0x156f('0x20')](_0x497db0,function(_0x435bd1){if(_0x435bd1['type']!=='VIRTUAL'){var _0x208b9b={};_0x208b9b[_0x435bd1['name']]={'$like':'%'+_0x1eec4f[_0x156f('0x22')]['filter']+'%'};return _0x208b9b;}})});}_0x448fbd=_[_0x156f('0x2d')]({},_0x448fbd,_0x1eec4f[_0x156f('0x2e')]);var _0x8d880={'where':_0x448fbd[_0x156f('0x2a')]};return db[_0x156f('0x1b')][_0x156f('0xf')](_0x8d880)[_0x156f('0x13')](function(_0x1066fd){_0x51035c[_0x156f('0xf')]=_0x1066fd;if(_0x1eec4f[_0x156f('0x22')][_0x156f('0x2f')]){_0x448fbd[_0x156f('0x30')]=[{'all':!![]}];}return db[_0x156f('0x1b')]['findAll'](_0x448fbd);})['then'](function(_0x2c9550){_0x51035c['rows']=_[_0x156f('0x20')](_0x2c9550,function(_0x492792){if(_0x492792['service']===_0x156f('0x31')){var _0x5d7b86=encryptor[_0x156f('0x32')](_0x492792[_0x156f('0x33')]);_0x492792[_0x156f('0x33')]=maskClientSecret(_0x5d7b86);}return _0x492792;});return _0x51035c;})[_0x156f('0x13')](respondWithFilteredResult(_0x6a1ddb,_0x448fbd))[_0x156f('0x34')](handleError(_0x6a1ddb,null));};exports['show']=function(_0x48eb79,_0x4f952f){var _0x455739={'raw':!![],'where':{'id':_0x48eb79['params']['id']}},_0x402564={};_0x402564[_0x156f('0x1f')]=_[_0x156f('0x21')](db[_0x156f('0x1b')][_0x156f('0x35')]);_0x402564[_0x156f('0x22')]=_[_0x156f('0x21')](_0x48eb79[_0x156f('0x22')]);_0x402564['filters']=_[_0x156f('0x24')](_0x402564[_0x156f('0x1f')],_0x402564[_0x156f('0x22')]);_0x455739[_0x156f('0x25')]=_[_0x156f('0x24')](_0x402564['model'],qs[_0x156f('0x26')](_0x48eb79[_0x156f('0x22')][_0x156f('0x26')]));_0x455739[_0x156f('0x25')]=_0x455739[_0x156f('0x25')][_0x156f('0x27')]?_0x455739[_0x156f('0x25')]:_0x402564[_0x156f('0x1f')];if(_0x48eb79['query'][_0x156f('0x2f')]){_0x455739[_0x156f('0x30')]=[{'all':!![]}];}_0x455739=_[_0x156f('0x2d')]({},_0x455739,_0x48eb79[_0x156f('0x2e')]);return db[_0x156f('0x1b')][_0x156f('0x36')](_0x455739)[_0x156f('0x13')](handleEntityNotFound(_0x4f952f,null))[_0x156f('0x13')](function(_0x39c0ec){if(_0x39c0ec['service']===_0x156f('0x31')){var _0x2d95b5=encryptor[_0x156f('0x32')](_0x39c0ec[_0x156f('0x33')]);_0x39c0ec[_0x156f('0x33')]=maskClientSecret(_0x2d95b5);}return _0x39c0ec;})['then'](respondWithResult(_0x4f952f,null))['catch'](handleError(_0x4f952f,null));};exports[_0x156f('0x37')]=function(_0x1766bc,_0xde3d61){if(!_0x1766bc[_0x156f('0x38')][_0x156f('0x17')])throw new Error(_0x156f('0x39'));if(!_0x1766bc[_0x156f('0x38')]['service'])throw new Error(_0x156f('0x3a'));var _0x524b9d=db[_0x156f('0x1b')][_0x156f('0x35')][_0x156f('0x3b')][_0x156f('0x3c')];if(!_0x524b9d[_0x156f('0x3d')](_0x1766bc[_0x156f('0x38')][_0x156f('0x3b')]))throw new Error(_0x156f('0x3e')+_0x524b9d['join'](',\x20'));if(_0x1766bc[_0x156f('0x38')]['service']===_0x156f('0x31')&&_0x1766bc['body']['data3']){_0x1766bc[_0x156f('0x38')][_0x156f('0x33')]=encryptor[_0x156f('0x3f')](_0x1766bc[_0x156f('0x38')][_0x156f('0x33')]);}return db[_0x156f('0x1b')]['create'](_0x1766bc['body'],{})[_0x156f('0x13')](respondWithResult(_0xde3d61,0xc9))[_0x156f('0x34')](handleError(_0xde3d61,null));};exports[_0x156f('0x12')]=function(_0x24ba9e,_0x48c68a){if(_0x24ba9e[_0x156f('0x38')]['id']){delete _0x24ba9e[_0x156f('0x38')]['id'];}return db['CloudProvider'][_0x156f('0x36')]({'where':{'id':_0x24ba9e[_0x156f('0x40')]['id']}})['then'](handleEntityNotFound(_0x48c68a,null))['then'](function(_0x3b0dd3){if(_0x3b0dd3[_0x156f('0x3b')]===_0x156f('0x31')&&_0x24ba9e[_0x156f('0x38')][_0x156f('0x33')]){_0x24ba9e['body'][_0x156f('0x33')]=encryptor[_0x156f('0x3f')](_0x24ba9e[_0x156f('0x38')][_0x156f('0x33')]);}return _0x3b0dd3;})['then'](saveUpdates(_0x24ba9e[_0x156f('0x38')],null))['then'](respondWithResult(_0x48c68a,null))[_0x156f('0x34')](handleError(_0x48c68a,null));};exports[_0x156f('0x14')]=function(_0x3b6899,_0x58f688){return db[_0x156f('0x1b')][_0x156f('0x36')]({'where':{'id':_0x3b6899['params']['id']}})['then'](handleEntityNotFound(_0x58f688,null))[_0x156f('0x13')](removeEntity(_0x58f688,null))['catch'](handleError(_0x58f688,null));};exports[_0x156f('0x41')]=function(_0x5c391d,_0x565ceb){return db[_0x156f('0x1b')][_0x156f('0x42')]({'where':{'id':_0x5c391d[_0x156f('0x40')]['id']},'raw':!![]})[_0x156f('0x13')](function(_0x4eff75){if(!_0x4eff75)return _0x565ceb['sendStatus'](0x194);return{'url':oauth[_0x156f('0x43')](_0x4eff75,_0x5c391d[_0x156f('0x44')]['id'])};})['then'](respondWithResult(_0x565ceb,null))[_0x156f('0x34')](handleError(_0x565ceb,null));};exports['oauth2MicrosoftCallback']=function(_0x576e19,_0xfc2575){var _0x52e1f9=_0x576e19[_0x156f('0x38')];var _0x231b56;var _0x815fb4;if(_0x52e1f9[_0x156f('0x45')])throw _0x52e1f9;redis[_0x156f('0x46')](_0x52e1f9[_0x156f('0x47')])['then'](function(_0x439781){if(!_0x439781)throw new Error(_0x156f('0x48'));_0x231b56=JSON[_0x156f('0x49')](_0x439781);var _0x35639a=Buffer[_0x156f('0x4a')](_0x52e1f9[_0x156f('0x47')],_0x156f('0x4b'))[_0x156f('0x4c')]('ascii');_0x815fb4=JSON[_0x156f('0x49')](_0x35639a);if(!oauth['isValidIdToken'](_0x52e1f9['id_token'],_0x231b56[_0x156f('0x4d')]))throw new Error(_0x156f('0x4e'));redis[_0x156f('0x4f')](_0x52e1f9[_0x156f('0x47')]);return oauth[_0x156f('0x50')](_0x52e1f9[_0x156f('0x51')],_0x231b56);})['then'](function(_0xae93c1){_0x231b56[_0x156f('0x52')]=_0xae93c1['access_token'];_0x231b56['data6']=_0xae93c1[_0x156f('0x53')];return db[_0x156f('0x1b')][_0x156f('0x12')]({'data5':_0x231b56[_0x156f('0x52')],'data6':_0x231b56[_0x156f('0x54')]},{'where':{'id':_0x231b56['id']}});})[_0x156f('0x13')](function(){oauth[_0x156f('0x55')](_0x231b56);socket[_0x156f('0x56')]('microsoftAuthorization:success',{'id':_0x815fb4['id']});return;})[_0x156f('0x13')](respondWithStatusCode(_0xfc2575,null))['catch'](function(_0x31fbf7){if(_0x815fb4){socket[_0x156f('0x56')]('microsoftAuthorization:error',{'id':_0x815fb4['id']});}if(!_0x231b56){logger[_0x156f('0x45')]('Invalid\x20authentication\x20state\x20parameter',_0x31fbf7);return _0xfc2575[_0x156f('0x15')](0x1f4)[_0x156f('0x57')](_0x31fbf7[_0x156f('0x58')]);}logger[_0x156f('0x45')](_0x156f('0x59'),_0x231b56['id'],JSON['stringify'](_0x31fbf7));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 9333f6e..2b61ccf 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 _0x357a=['./cloudProvider.attributes','exports','define','cloud_providers','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x278596,_0x26b3ae){var _0x4b0e5a=function(_0x5f2cdc){while(--_0x5f2cdc){_0x278596['push'](_0x278596['shift']());}};_0x4b0e5a(++_0x26b3ae);}(_0x357a,0x154));var _0xa357=function(_0x16b16f,_0x4a9cb6){_0x16b16f=_0x16b16f-0x0;var _0x45b687=_0x357a[_0x16b16f];return _0x45b687;};'use strict';var _=require(_0xa357('0x0'));var util=require('util');var logger=require(_0xa357('0x1'))(_0xa357('0x2'));var moment=require(_0xa357('0x3'));var BPromise=require(_0xa357('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa357('0x5'));var rimraf=require(_0xa357('0x6'));var config=require(_0xa357('0x7'));var attributes=require(_0xa357('0x8'));module[_0xa357('0x9')]=function(_0x5336a5,_0xd78cc2){return _0x5336a5[_0xa357('0xa')]('CloudProvider',attributes,{'tableName':_0xa357('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9ec=['api','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','cloud_providers','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb9ec,0x1c5));var _0xcb9e=function(_0x44c097,_0x2372d0){_0x44c097=_0x44c097-0x0;var _0x819396=_0xb9ec[_0x44c097];return _0x819396;};'use strict';var _=require(_0xcb9e('0x0'));var util=require(_0xcb9e('0x1'));var logger=require(_0xcb9e('0x2'))(_0xcb9e('0x3'));var moment=require(_0xcb9e('0x4'));var BPromise=require(_0xcb9e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb9e('0x6'));var rimraf=require(_0xcb9e('0x7'));var config=require(_0xcb9e('0x8'));var attributes=require(_0xcb9e('0x9'));module[_0xcb9e('0xa')]=function(_0xe09f91,_0xbaee1b){return _0xe09f91['define']('CloudProvider',attributes,{'tableName':_0xcb9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index f559447..b5aee79 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 _0x85e7=['Dynamics365','push','data7','Outlook365','/.default','replace','code','from','stringify','toString','base64','randomBytes','client_id','response_type','join','redirect_uri','response_mode','form_post','scope','nonce','prompt','login','oauth2/','data1','set','decode','payload','iss','audience','isAfter','exp','then','CloudProvider','refresh_token','data6','data4','decryptString','data3','POST','{TENANT_ID}','data2','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','map','type'];(function(_0x405299,_0x5c02b5){var _0x5e0f2e=function(_0x2a10c9){while(--_0x2a10c9){_0x405299['push'](_0x405299['shift']());}};_0x5e0f2e(++_0x5c02b5);}(_0x85e7,0x1a2));var _0x785e=function(_0x27ba12,_0x23ca8a){_0x27ba12=_0x27ba12-0x0;var _0x5a4834=_0x85e7[_0x27ba12];return _0x5a4834;};'use strict';var _=require('lodash');var crypto=require(_0x785e('0x0'));var jwt=require(_0x785e('0x1'));var moment=require('moment');var Redis=require(_0x785e('0x2'));var rp=require('request-promise');var util=require(_0x785e('0x3'));var encryptor=require(_0x785e('0x4'));var config=require(_0x785e('0x5'));var logger=require(_0x785e('0x6'))('api');var schedule=require(_0x785e('0x7'));var db=require(_0x785e('0x8'))['db'];config[_0x785e('0x9')]=_['defaults'](config[_0x785e('0x9')],{'host':_0x785e('0xa'),'port':0x18eb});var redis=new Redis(config[_0x785e('0x9')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x785e('0xb'),_0x785e('0xc'),'email',_0x785e('0xd'),_0x785e('0xe'),_0x785e('0xf'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x785e('0xb'),_0x785e('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0x785e('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x785e('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1936b6){var _0x5d0584=_[_0x785e('0x12')](AZURE_AUTH_SCOPES[_0x1936b6['type']]);if(_0x1936b6[_0x785e('0x13')]===_0x785e('0x14'))_0x5d0584[_0x785e('0x15')](_0x1936b6[_0x785e('0x16')]+'/.default');return _0x5d0584['join']('\x20');}function getAccessTokenScope(_0x1d0439){if(_0x1d0439[_0x785e('0x13')]===_0x785e('0x17'))return _0x785e('0xe');if(_0x1d0439['type']===_0x785e('0x14'))return _0x1d0439[_0x785e('0x16')]+_0x785e('0x18');}function generateMicrosoftAuthorizationUrl(_0x2cb246,_0x3ff156){var _0x36d623=MICROSOFT_AUTH_URL[_0x785e('0x19')]('{TENANT_ID}',_0x2cb246['data2']);var _0xd0e6ab=[_0x785e('0x1a'),'id_token'];var _0x25faca=Buffer[_0x785e('0x1b')](JSON[_0x785e('0x1c')]({'id':_0x3ff156}))[_0x785e('0x1d')](_0x785e('0x1e'));var _0x45b0e1=crypto[_0x785e('0x1f')](0x10)[_0x785e('0x1d')]('hex');var _0x4cc9cb=getAuthorizationScopes(_0x2cb246);var _0x59ee68=[{'key':_0x785e('0x20'),'value':_0x2cb246['data1']},{'key':_0x785e('0x21'),'value':encodeURIComponent(_0xd0e6ab[_0x785e('0x22')]('\x20'))},{'key':_0x785e('0x23'),'value':_0x2cb246['data4']},{'key':_0x785e('0x24'),'value':_0x785e('0x25')},{'key':_0x785e('0x26'),'value':encodeURIComponent(_0x4cc9cb)},{'key':'state','value':_0x25faca},{'key':_0x785e('0x27'),'value':_0x45b0e1},{'key':_0x785e('0x28'),'value':_0x785e('0x29')}];var _0x54e9ee=_0x36d623+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x785e('0x12')](_0x59ee68,function(_0x516852){return _0x516852['key']+'='+_0x516852['value'];})['join']('&');_0x2cb246['oauth2Claims']={'issuer':_0x36d623[_0x785e('0x19')](_0x785e('0x2a'),''),'audience':_0x2cb246[_0x785e('0x2b')],'state':_0x25faca,'nonce':_0x45b0e1};redis[_0x785e('0x2c')](_0x25faca,JSON[_0x785e('0x1c')](_0x2cb246));return _0x54e9ee;}function isValidIdToken(_0x362db4,_0x5a81ea){try{var _0x39c699=jwt[_0x785e('0x2d')](_0x362db4,{'complete':!![]});var _0x2965a6=_0x39c699[_0x785e('0x2e')];if(_0x2965a6[_0x785e('0x2f')]!==_0x5a81ea['issuer'])return![];if(_0x2965a6['aud']!==_0x5a81ea[_0x785e('0x30')])return![];if(_0x2965a6[_0x785e('0x27')]!==_0x5a81ea[_0x785e('0x27')])return![];if(moment()[_0x785e('0x31')](moment['unix'](_0x2965a6[_0x785e('0x32')])))return![];return!![];}catch(_0x37336a){throw _0x37336a;}}function refreshOauth2MicrosoftAccessToken(_0x25b4dd){return Promise['resolve']()[_0x785e('0x33')](function(){if(_0x25b4dd['data3'])return _0x25b4dd;return db[_0x785e('0x34')]['findOne']({'where':{'id':_0x25b4dd['id']},'raw':!![]});})[_0x785e('0x33')](function(_0x1b3a23){var _0x31c2ea={'grant_type':_0x785e('0x35'),'refresh_token':_0x1b3a23[_0x785e('0x36')],'scope':getAccessTokenScope(_0x1b3a23),'redirect_uri':_0x1b3a23[_0x785e('0x37')],'client_id':_0x1b3a23[_0x785e('0x2b')],'client_secret':encryptor[_0x785e('0x38')](_0x1b3a23[_0x785e('0x39')])};var _0xf82c17={'method':_0x785e('0x3a'),'uri':MICROSOFT_AUTH_URL[_0x785e('0x19')](_0x785e('0x3b'),_0x1b3a23[_0x785e('0x3c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x31c2ea,'json':!![]};return rp(_0xf82c17);})[_0x785e('0x33')](function(_0x841339){_0x25b4dd[_0x785e('0x3d')]=_0x841339[_0x785e('0x3e')];_0x25b4dd[_0x785e('0x36')]=_0x841339['refresh_token'];return db[_0x785e('0x34')][_0x785e('0x3f')]({'data5':_0x25b4dd[_0x785e('0x3d')],'data6':_0x25b4dd[_0x785e('0x36')]},{'where':{'id':_0x25b4dd['id']}});})[_0x785e('0x33')](function(){return _0x25b4dd;})[_0x785e('0x40')](function(_0x57bf50){logger[_0x785e('0x41')](_0x785e('0x42'),_0x25b4dd['id'],_0x57bf50);});}function getOauth2MicrosoftAccessToken(_0x1d82f8,_0x358acd){var _0x577f7d={'grant_type':'authorization_code','code':_0x1d82f8,'scope':getAccessTokenScope(_0x358acd),'redirect_uri':_0x358acd[_0x785e('0x37')],'client_id':_0x358acd['data1'],'client_secret':encryptor[_0x785e('0x38')](_0x358acd[_0x785e('0x39')])};var _0x214219={'method':_0x785e('0x3a'),'uri':MICROSOFT_AUTH_URL[_0x785e('0x19')]('{TENANT_ID}',_0x358acd[_0x785e('0x3c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x577f7d,'json':!![]};return rp(_0x214219);}function startRefreshInterval(_0xee7055){var _0x6b9b19=schedule[_0x785e('0x43')];if(_0x6b9b19[_0xee7055['id']])clearInterval(_0x6b9b19[_0xee7055['id']]);_0x6b9b19[_0xee7055['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0xee7055['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x785e('0x43')]=_0x6b9b19;}function startAllRefreshIntervals(){return db[_0x785e('0x34')][_0x785e('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x785e('0x33')](function(_0x279639){var _0x558e33=_0x279639[_0x785e('0x12')](function(_0x3faa23){return refreshOauth2MicrosoftAccessToken(_0x3faa23)[_0x785e('0x33')](function(_0x2cdee7){startRefreshInterval(_0x2cdee7);});});return Promise[_0x785e('0x45')](_0x558e33);})[_0x785e('0x40')](function(_0x309149){var _0x59e728=_0x309149?util[_0x785e('0x46')](_0x309149,{'showHidden':![],'depth':null}):'';logger[_0x785e('0x41')](_0x785e('0x47'),_0x59e728);});}module[_0x785e('0x48')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x993f=['openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','type','Dynamics365','push','data7','/.default','join','Outlook365','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','state','nonce','prompt','login','value','oauth2Claims','oauth2/','set','decode','iss','audience','isAfter','unix','resolve','then','data3','CloudProvider','refresh_token','data6','data4','POST','replace','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','map','all','inspect','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0'];(function(_0x5e6515,_0x2954b1){var _0xd33ce2=function(_0x5ce7ea){while(--_0x5ce7ea){_0x5e6515['push'](_0x5e6515['shift']());}};_0xd33ce2(++_0x2954b1);}(_0x993f,0x172));var _0xf993=function(_0x2758ea,_0xae05fe){_0x2758ea=_0x2758ea-0x0;var _0x130cad=_0x993f[_0x2758ea];return _0x130cad;};'use strict';var _=require(_0xf993('0x0'));var crypto=require(_0xf993('0x1'));var jwt=require(_0xf993('0x2'));var moment=require(_0xf993('0x3'));var Redis=require('ioredis');var rp=require(_0xf993('0x4'));var util=require(_0xf993('0x5'));var encryptor=require(_0xf993('0x6'));var config=require(_0xf993('0x7'));var logger=require(_0xf993('0x8'))(_0xf993('0x9'));var schedule=require(_0xf993('0xa'));var db=require(_0xf993('0xb'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf993('0xc'),'port':0x18eb});var redis=new Redis(config[_0xf993('0xd')]);var MICROSOFT_AUTH_URL=_0xf993('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xf993('0xf'),_0xf993('0x10'),_0xf993('0x11'),'offline_access',_0xf993('0x12'),_0xf993('0x13'),_0xf993('0x14')],'Dynamics365':[_0xf993('0xf'),_0xf993('0x15')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5721c7){var _0x24378f=_['map'](AZURE_AUTH_SCOPES[_0x5721c7[_0xf993('0x16')]]);if(_0x5721c7[_0xf993('0x16')]===_0xf993('0x17'))_0x24378f[_0xf993('0x18')](_0x5721c7[_0xf993('0x19')]+_0xf993('0x1a'));return _0x24378f[_0xf993('0x1b')]('\x20');}function getAccessTokenScope(_0x4bfcf2){if(_0x4bfcf2[_0xf993('0x16')]===_0xf993('0x1c'))return _0xf993('0x12');if(_0x4bfcf2['type']===_0xf993('0x17'))return _0x4bfcf2['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4d8a21,_0x580f88){var _0x4cc798=MICROSOFT_AUTH_URL['replace'](_0xf993('0x1d'),_0x4d8a21[_0xf993('0x1e')]);var _0x3b5940=[_0xf993('0x1f'),_0xf993('0x20')];var _0x22487d=Buffer[_0xf993('0x21')](JSON[_0xf993('0x22')]({'id':_0x580f88}))[_0xf993('0x23')](_0xf993('0x24'));var _0x126ece=crypto['randomBytes'](0x10)['toString'](_0xf993('0x25'));var _0x529652=getAuthorizationScopes(_0x4d8a21);var _0x1d89ac=[{'key':_0xf993('0x26'),'value':_0x4d8a21[_0xf993('0x27')]},{'key':_0xf993('0x28'),'value':encodeURIComponent(_0x3b5940[_0xf993('0x1b')]('\x20'))},{'key':_0xf993('0x29'),'value':_0x4d8a21['data4']},{'key':_0xf993('0x2a'),'value':_0xf993('0x2b')},{'key':'scope','value':encodeURIComponent(_0x529652)},{'key':_0xf993('0x2c'),'value':_0x22487d},{'key':_0xf993('0x2d'),'value':_0x126ece},{'key':_0xf993('0x2e'),'value':_0xf993('0x2f')}];var _0x46793e=_0x4cc798+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x1d89ac,function(_0x1e79c5){return _0x1e79c5['key']+'='+_0x1e79c5[_0xf993('0x30')];})['join']('&');_0x4d8a21[_0xf993('0x31')]={'issuer':_0x4cc798['replace'](_0xf993('0x32'),''),'audience':_0x4d8a21[_0xf993('0x27')],'state':_0x22487d,'nonce':_0x126ece};redis[_0xf993('0x33')](_0x22487d,JSON[_0xf993('0x22')](_0x4d8a21));return _0x46793e;}function isValidIdToken(_0x198f20,_0x9ba87e){try{var _0xa88400=jwt[_0xf993('0x34')](_0x198f20,{'complete':!![]});var _0x33fbce=_0xa88400['payload'];if(_0x33fbce[_0xf993('0x35')]!==_0x9ba87e['issuer'])return![];if(_0x33fbce['aud']!==_0x9ba87e[_0xf993('0x36')])return![];if(_0x33fbce[_0xf993('0x2d')]!==_0x9ba87e['nonce'])return![];if(moment()[_0xf993('0x37')](moment[_0xf993('0x38')](_0x33fbce['exp'])))return![];return!![];}catch(_0x1e64b7){throw _0x1e64b7;}}function refreshOauth2MicrosoftAccessToken(_0x5c6b7f){return Promise[_0xf993('0x39')]()[_0xf993('0x3a')](function(){if(_0x5c6b7f[_0xf993('0x3b')])return _0x5c6b7f;return db[_0xf993('0x3c')]['findOne']({'where':{'id':_0x5c6b7f['id']},'raw':!![]});})['then'](function(_0x1a2a10){var _0x280b97={'grant_type':_0xf993('0x3d'),'refresh_token':_0x1a2a10[_0xf993('0x3e')],'scope':getAccessTokenScope(_0x1a2a10),'redirect_uri':_0x1a2a10[_0xf993('0x3f')],'client_id':_0x1a2a10[_0xf993('0x27')],'client_secret':encryptor['decryptString'](_0x1a2a10['data3'])};var _0x298447={'method':_0xf993('0x40'),'uri':MICROSOFT_AUTH_URL[_0xf993('0x41')](_0xf993('0x1d'),_0x1a2a10[_0xf993('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x280b97,'json':!![]};return rp(_0x298447);})[_0xf993('0x3a')](function(_0x578da4){_0x5c6b7f[_0xf993('0x42')]=_0x578da4[_0xf993('0x43')];_0x5c6b7f[_0xf993('0x3e')]=_0x578da4[_0xf993('0x3d')];return db['CloudProvider'][_0xf993('0x44')]({'data5':_0x5c6b7f[_0xf993('0x42')],'data6':_0x5c6b7f[_0xf993('0x3e')]},{'where':{'id':_0x5c6b7f['id']}});})['then'](function(){return _0x5c6b7f;})['catch'](function(_0x20650d){logger[_0xf993('0x45')](_0xf993('0x46'),_0x5c6b7f['id'],_0x20650d);});}function getOauth2MicrosoftAccessToken(_0x4ddbe9,_0x597966){var _0x3c01cc={'grant_type':'authorization_code','code':_0x4ddbe9,'scope':getAccessTokenScope(_0x597966),'redirect_uri':_0x597966[_0xf993('0x3f')],'client_id':_0x597966[_0xf993('0x27')],'client_secret':encryptor['decryptString'](_0x597966['data3'])};var _0x5d0bbe={'method':_0xf993('0x40'),'uri':MICROSOFT_AUTH_URL['replace'](_0xf993('0x1d'),_0x597966[_0xf993('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3c01cc,'json':!![]};return rp(_0x5d0bbe);}function startRefreshInterval(_0x2b2983){var _0x370822=schedule[_0xf993('0x47')];if(_0x370822[_0x2b2983['id']])clearInterval(_0x370822[_0x2b2983['id']]);_0x370822[_0x2b2983['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xf993('0x48')](this,{'id':_0x2b2983['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf993('0x47')]=_0x370822;}function startAllRefreshIntervals(){return db[_0xf993('0x3c')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xf993('0x3a')](function(_0x45cddb){var _0x22c3e3=_0x45cddb[_0xf993('0x49')](function(_0x546912){return refreshOauth2MicrosoftAccessToken(_0x546912)[_0xf993('0x3a')](function(_0x55c985){startRefreshInterval(_0x55c985);});});return Promise[_0xf993('0x4a')](_0x22c3e3);})['catch'](function(_0x11837b){var _0xaa16=_0x11837b?util[_0xf993('0x4b')](_0x11837b,{'showHidden':![],'depth':null}):'';logger[_0xf993('0x45')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0xaa16);});}module[_0xf993('0x4c')]={'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 b007d6a..4d27a0d 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 _0xde46=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a31cc,_0x1827ec){var _0x44f59a=function(_0x5eb20e){while(--_0x5eb20e){_0x1a31cc['push'](_0x1a31cc['shift']());}};_0x44f59a(++_0x1827ec);}(_0xde46,0x14e));var _0x6de4=function(_0x30ec49,_0xa4744b){_0x30ec49=_0x30ec49-0x0;var _0xe10a45=_0xde46[_0x30ec49];return _0xe10a45;};'use strict';var _=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var moment=require(_0x6de4('0x2'));var BPromise=require(_0x6de4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6de4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6de4('0x5'))(_0x6de4('0x6'));var config=require(_0x6de4('0x7'));var jayson=require(_0x6de4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17f7ae,_0x507ca0,_0xb20ddf){return new BPromise(function(_0x12d3bb,_0x503d50){return client[_0x6de4('0x9')](_0x17f7ae,_0xb20ddf)[_0x6de4('0xa')](function(_0xe81ab9){logger[_0x6de4('0xb')](_0x6de4('0xc'),_0x507ca0,_0x6de4('0xd'));logger[_0x6de4('0xe')](_0x6de4('0xf'),_0x507ca0,_0x6de4('0xd'),JSON[_0x6de4('0x10')](_0xe81ab9));if(_0xe81ab9[_0x6de4('0x11')]){if(_0xe81ab9['error'][_0x6de4('0x12')]===0x1f4){logger[_0x6de4('0x11')](_0x6de4('0xc'),_0x507ca0,_0xe81ab9[_0x6de4('0x11')][_0x6de4('0x13')]);return _0x503d50(_0xe81ab9[_0x6de4('0x11')][_0x6de4('0x13')]);}logger[_0x6de4('0x11')]('CloudProvider,\x20%s,\x20%s',_0x507ca0,_0xe81ab9[_0x6de4('0x11')]['message']);return _0x12d3bb(_0xe81ab9[_0x6de4('0x11')][_0x6de4('0x13')]);}else{logger[_0x6de4('0xb')]('CloudProvider,\x20%s,\x20%s',_0x507ca0,_0x6de4('0xd'));_0x12d3bb(_0xe81ab9[_0x6de4('0x14')][_0x6de4('0x13')]);}})[_0x6de4('0x15')](function(_0x4b1584){logger[_0x6de4('0x11')]('CloudProvider,\x20%s,\x20%s',_0x507ca0,_0x4b1584);_0x503d50(_0x4b1584);});});} \ No newline at end of file +var _0x5c96=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0xe61ab6,_0x2b7371){var _0x48dccc=function(_0x1d567c){while(--_0x1d567c){_0xe61ab6['push'](_0xe61ab6['shift']());}};_0x48dccc(++_0x2b7371);}(_0x5c96,0x133));var _0x65c9=function(_0x56d6e,_0x5033a4){_0x56d6e=_0x56d6e-0x0;var _0x42a32f=_0x5c96[_0x56d6e];return _0x42a32f;};'use strict';var _=require(_0x65c9('0x0'));var util=require(_0x65c9('0x1'));var moment=require(_0x65c9('0x2'));var BPromise=require(_0x65c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65c9('0x4'));var db=require(_0x65c9('0x5'))['db'];var utils=require(_0x65c9('0x6'));var logger=require(_0x65c9('0x7'))(_0x65c9('0x8'));var config=require(_0x65c9('0x9'));var jayson=require(_0x65c9('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x502c63,_0x4eb25b,_0x1a9b93){return new BPromise(function(_0x10a355,_0x1c679d){return client['request'](_0x502c63,_0x1a9b93)[_0x65c9('0xb')](function(_0x3249da){logger[_0x65c9('0xc')](_0x65c9('0xd'),_0x4eb25b,_0x65c9('0xe'));logger[_0x65c9('0xf')](_0x65c9('0x10'),_0x4eb25b,'request\x20sent',JSON['stringify'](_0x3249da));if(_0x3249da['error']){if(_0x3249da[_0x65c9('0x11')][_0x65c9('0x12')]===0x1f4){logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x3249da[_0x65c9('0x11')]['message']);return _0x1c679d(_0x3249da[_0x65c9('0x11')][_0x65c9('0x13')]);}logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x3249da['error'][_0x65c9('0x13')]);return _0x10a355(_0x3249da[_0x65c9('0x11')][_0x65c9('0x13')]);}else{logger[_0x65c9('0xc')](_0x65c9('0xd'),_0x4eb25b,_0x65c9('0xe'));_0x10a355(_0x3249da[_0x65c9('0x14')][_0x65c9('0x13')]);}})[_0x65c9('0x15')](function(_0x25c0e9){logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x25c0e9);_0x1c679d(_0x25c0e9);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 1f6919c..28e6532 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x41de0e,_0x12bcbe){var _0x727b80=function(_0x281deb){while(--_0x281deb){_0x41de0e['push'](_0x41de0e['shift']());}};_0x727b80(++_0x12bcbe);}(_0x2ef3,0xba));var _0x32ef=function(_0x407710,_0x4df452){_0x407710=_0x407710-0x0;var _0xba8ce0=_0x2ef3[_0x407710];return _0xba8ce0;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x68a425,_0x304716){var _0x2cc916=function(_0x425264){while(--_0x425264){_0x68a425['push'](_0x68a425['shift']());}};_0x2cc916(++_0x304716);}(_0xadb5,0xad));var _0x5adb=function(_0x194ce3,_0x240ba3){_0x194ce3=_0x194ce3-0x0;var _0x44372e=_0xadb5[_0x194ce3];return _0x44372e;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 19ca1b5..844c311 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 _0x3cfa=['STRING','sequelize','exports','name'];(function(_0x28a757,_0x14c700){var _0x141d1f=function(_0x118c17){while(--_0x118c17){_0x28a757['push'](_0x28a757['shift']());}};_0x141d1f(++_0x14c700);}(_0x3cfa,0x129));var _0xa3cf=function(_0xdfa86d,_0x465c6a){_0xdfa86d=_0xdfa86d-0x0;var _0x71d6cc=_0x3cfa[_0xdfa86d];return _0x71d6cc;};'use strict';var Sequelize=require(_0xa3cf('0x0'));module[_0xa3cf('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa3cf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa3cf('0x3')]},'companyId':{'type':Sequelize[_0xa3cf('0x3')]},'website':{'type':Sequelize[_0xa3cf('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa3cf('0x3')]},'street':{'type':Sequelize[_0xa3cf('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa3cf('0x3')]},'email':{'type':Sequelize[_0xa3cf('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xa3cf('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xa3cf('0x3')]},'sCountry':{'type':Sequelize[_0xa3cf('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x38f8=['STRING','sequelize'];(function(_0x105114,_0x213db9){var _0xea4357=function(_0x56a477){while(--_0x56a477){_0x105114['push'](_0x105114['shift']());}};_0xea4357(++_0x213db9);}(_0x38f8,0x121));var _0x838f=function(_0x37a924,_0xff5916){_0x37a924=_0x37a924-0x0;var _0x5b5aaf=_0x38f8[_0x37a924];return _0x5b5aaf;};'use strict';var Sequelize=require(_0x838f('0x0'));module['exports']={'name':{'type':Sequelize[_0x838f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x838f('0x1')]},'companyId':{'type':Sequelize[_0x838f('0x1')]},'website':{'type':Sequelize[_0x838f('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x838f('0x1')]},'type':{'type':Sequelize[_0x838f('0x1')]},'street':{'type':Sequelize[_0x838f('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x838f('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x838f('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x838f('0x1')]},'sCity':{'type':Sequelize[_0x838f('0x1')]},'sCountry':{'type':Sequelize[_0x838f('0x1')]},'description':{'type':Sequelize[_0x838f('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index acaabe2..aedfe5a 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 _0x75b7=['json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','Companies','UserProfileResource','error','stack','name','status','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','include','findAll','catch','show','params','rawAttributes','length','find','user','get','UserProfileSection','userProfileId','autoAssociation','create','update','body','addContacts','CmContact','ids','getContacts','pick','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0xe3d85b,_0x4fbfd0){var _0x39da04=function(_0x4b80e6){while(--_0x4b80e6){_0xe3d85b['push'](_0xe3d85b['shift']());}};_0x39da04(++_0x4fbfd0);}(_0x75b7,0xdf));var _0x775b=function(_0x371335,_0x53e2c4){_0x371335=_0x371335-0x0;var _0x367dfa=_0x75b7[_0x371335];return _0x367dfa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x775b('0x0'));var zipdir=require(_0x775b('0x1'));var jsonpatch=require(_0x775b('0x2'));var rp=require(_0x775b('0x3'));var moment=require(_0x775b('0x4'));var BPromise=require(_0x775b('0x5'));var Mustache=require(_0x775b('0x6'));var util=require('util');var path=require(_0x775b('0x7'));var sox=require(_0x775b('0x8'));var csv=require(_0x775b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x775b('0xa'));var _=require(_0x775b('0xb'));var squel=require(_0x775b('0xc'));var crypto=require(_0x775b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x775b('0xe'));var toCsv=require(_0x775b('0x9'));var querystring=require(_0x775b('0xf'));var Papa=require(_0x775b('0x10'));var Redis=require(_0x775b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x775b('0x12'));var as=require(_0x775b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x775b('0x14'))(_0x775b('0x15'));var utils=require(_0x775b('0x16'));var config=require(_0x775b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x775b('0x18'))['db'];function respondWithStatusCode(_0x45829c,_0x4983ff){_0x4983ff=_0x4983ff||0xcc;return function(_0x45b147){if(_0x45b147){return _0x45829c[_0x775b('0x19')](_0x4983ff);}return _0x45829c['status'](_0x4983ff)['end']();};}function respondWithResult(_0x4fd3dd,_0x406525){_0x406525=_0x406525||0xc8;return function(_0x4bebb5){if(_0x4bebb5){return _0x4fd3dd['status'](_0x406525)[_0x775b('0x1a')](_0x4bebb5);}};}function respondWithFilteredResult(_0x3e4471,_0x42eb9d){return function(_0x2ba13f){if(_0x2ba13f){var _0x50b3b6=typeof _0x42eb9d[_0x775b('0x1b')]===_0x775b('0x1c')&&typeof _0x42eb9d[_0x775b('0x1d')]==='undefined';var _0x5f3446=_0x2ba13f[_0x775b('0x1e')];var _0x29d510=_0x50b3b6?0x0:_0x42eb9d[_0x775b('0x1b')];var _0x4646e7=_0x50b3b6?_0x2ba13f[_0x775b('0x1e')]:_0x42eb9d['offset']+_0x42eb9d[_0x775b('0x1d')];var _0xe04b9a;if(_0x4646e7>=_0x5f3446){_0x4646e7=_0x5f3446;_0xe04b9a=0xc8;}else{_0xe04b9a=0xce;}_0x3e4471['status'](_0xe04b9a);return _0x3e4471[_0x775b('0x1f')](_0x775b('0x20'),_0x29d510+'-'+_0x4646e7+'/'+_0x5f3446)[_0x775b('0x1a')](_0x2ba13f);}return null;};}function patchUpdates(_0x400b43){return function(_0x558978){try{jsonpatch[_0x775b('0x21')](_0x558978,_0x400b43,!![]);}catch(_0x32bb48){return BPromise['reject'](_0x32bb48);}return _0x558978[_0x775b('0x22')]();};}function saveUpdates(_0x3cf933,_0x2afb18){return function(_0x1355e9){if(_0x1355e9){return _0x1355e9['update'](_0x3cf933)[_0x775b('0x23')](function(_0x119b46){return _0x119b46;});}return null;};}function removeEntity(_0x35ebd8,_0x191137){return function(_0x559af9){if(_0x559af9){return _0x559af9[_0x775b('0x24')]()[_0x775b('0x23')](function(){var _0x3e939b=_0x559af9['get']({'plain':!![]});var _0x35c8a2=_0x775b('0x25');return db[_0x775b('0x26')]['destroy']({'where':{'type':_0x35c8a2,'resourceId':_0x3e939b['id']}})[_0x775b('0x23')](function(){return _0x559af9;});})[_0x775b('0x23')](function(){_0x35ebd8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c66ba,_0x3b906b){return function(_0x49e95f){if(!_0x49e95f){_0x6c66ba[_0x775b('0x19')](0x194);}return _0x49e95f;};}function handleError(_0x4d8d79,_0x5e2fba){_0x5e2fba=_0x5e2fba||0x1f4;return function(_0x415190){logger[_0x775b('0x27')](_0x415190[_0x775b('0x28')]);if(_0x415190[_0x775b('0x29')]){delete _0x415190[_0x775b('0x29')];}_0x4d8d79[_0x775b('0x2a')](_0x5e2fba)['send'](_0x415190);};}exports[_0x775b('0x2b')]=function(_0xc268e8,_0x41a4bc){var _0x72d57b={},_0x140139={},_0x682d07={'count':0x0,'rows':[]};return db[_0x775b('0x2c')][_0x775b('0x2d')]()[_0x775b('0x23')](function(_0x19891f){_0x140139[_0x775b('0x2e')]=_[_0x775b('0x2f')](_0x19891f);_0x140139[_0x775b('0x30')]=_[_0x775b('0x2f')](_0xc268e8[_0x775b('0x30')]);_0x140139['filters']=_[_0x775b('0x31')](_0x140139[_0x775b('0x2e')],_0x140139['query']);_0x72d57b[_0x775b('0x32')]=_['intersection'](_0x140139[_0x775b('0x2e')],qs[_0x775b('0x33')](_0xc268e8[_0x775b('0x30')][_0x775b('0x33')]));_0x72d57b['attributes']=_0x72d57b[_0x775b('0x32')]['length']?_0x72d57b[_0x775b('0x32')]:_0x140139[_0x775b('0x2e')];if(!_0xc268e8['query'][_0x775b('0x34')](_0x775b('0x35'))){_0x72d57b[_0x775b('0x1d')]=qs[_0x775b('0x1d')](_0xc268e8[_0x775b('0x30')]['limit']);_0x72d57b[_0x775b('0x1b')]=qs['offset'](_0xc268e8[_0x775b('0x30')][_0x775b('0x1b')]);}_0x72d57b[_0x775b('0x36')]=qs[_0x775b('0x37')](_0xc268e8[_0x775b('0x30')][_0x775b('0x37')]);_0x72d57b[_0x775b('0x38')]=qs['filters'](_['pick'](_0xc268e8[_0x775b('0x30')],_0x140139[_0x775b('0x39')]),_0x19891f);if(_0xc268e8[_0x775b('0x30')]['filter']){_0x72d57b[_0x775b('0x38')]=_[_0x775b('0x3a')](_0x72d57b[_0x775b('0x38')],{'$or':_['map'](_0x72d57b[_0x775b('0x32')],function(_0x28c36a){var _0x11838c={};_0x11838c[_0x28c36a]={'$like':'%'+_0xc268e8[_0x775b('0x30')][_0x775b('0x3b')]+'%'};return _0x11838c;})});}_0x72d57b=_[_0x775b('0x3a')]({},_0x72d57b,_0xc268e8[_0x775b('0x3c')]);var _0x1a5821={'where':_0x72d57b['where']};return db[_0x775b('0x2c')][_0x775b('0x1e')](_0x1a5821)[_0x775b('0x23')](function(_0x49588e){_0x682d07[_0x775b('0x1e')]=_0x49588e;if(_0xc268e8[_0x775b('0x30')]['includeAll']){_0x72d57b[_0x775b('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0x775b('0x3e')](_0x72d57b);})['then'](function(_0x52d8c7){_0x682d07['rows']=_0x52d8c7;return _0x682d07;})[_0x775b('0x23')](respondWithFilteredResult(_0x41a4bc,_0x72d57b))[_0x775b('0x3f')](handleError(_0x41a4bc,null));})[_0x775b('0x3f')](handleError(_0x41a4bc,null));};exports[_0x775b('0x40')]=function(_0x2d9a58,_0x3c4e03){var _0x15576d={'raw':![],'where':{'id':_0x2d9a58[_0x775b('0x41')]['id']}},_0x703da7={};_0x703da7[_0x775b('0x2e')]=_[_0x775b('0x2f')](db[_0x775b('0x2c')][_0x775b('0x42')]);_0x703da7[_0x775b('0x30')]=_[_0x775b('0x2f')](_0x2d9a58[_0x775b('0x30')]);_0x703da7[_0x775b('0x39')]=_[_0x775b('0x31')](_0x703da7['model'],_0x703da7[_0x775b('0x30')]);_0x15576d[_0x775b('0x32')]=_[_0x775b('0x31')](_0x703da7[_0x775b('0x2e')],qs[_0x775b('0x33')](_0x2d9a58[_0x775b('0x30')][_0x775b('0x33')]));_0x15576d['attributes']=_0x15576d[_0x775b('0x32')][_0x775b('0x43')]?_0x15576d[_0x775b('0x32')]:_0x703da7['model'];if(_0x2d9a58[_0x775b('0x30')]['includeAll']){_0x15576d['include']=[{'all':!![]}];}_0x15576d=_['merge']({},_0x15576d,_0x2d9a58[_0x775b('0x3c')]);return db['CmCompany'][_0x775b('0x44')](_0x15576d)[_0x775b('0x23')](handleEntityNotFound(_0x3c4e03,null))[_0x775b('0x23')](respondWithResult(_0x3c4e03,null))[_0x775b('0x3f')](handleError(_0x3c4e03,null));};exports['create']=function(_0x35416c,_0x3812df){return db[_0x775b('0x2c')]['create'](_0x35416c['body'],{})[_0x775b('0x23')](function(_0x1adc35){var _0x483b2c=_0x35416c['user']['get']({'plain':!![]});if(!_0x483b2c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x483b2c['role']===_0x775b('0x45')){var _0x203c4b=_0x1adc35[_0x775b('0x46')]({'plain':!![]});var _0x1a4738=_0x775b('0x25');return db[_0x775b('0x47')]['find']({'where':{'name':_0x1a4738,'userProfileId':_0x483b2c[_0x775b('0x48')]},'raw':!![]})[_0x775b('0x23')](function(_0x7aeb66){if(_0x7aeb66&&_0x7aeb66[_0x775b('0x49')]===0x0){return db['UserProfileResource'][_0x775b('0x4a')]({'name':_0x203c4b[_0x775b('0x29')],'resourceId':_0x203c4b['id'],'type':_0x7aeb66[_0x775b('0x29')],'sectionId':_0x7aeb66['id']},{})[_0x775b('0x23')](function(){return _0x1adc35;});}else{return _0x1adc35;}})[_0x775b('0x3f')](function(_0x88f7ec){logger[_0x775b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x88f7ec);throw _0x88f7ec;});}return _0x1adc35;})['then'](respondWithResult(_0x3812df,0xc9))[_0x775b('0x3f')](handleError(_0x3812df,null));};exports[_0x775b('0x4b')]=function(_0x212268,_0x53373c){if(_0x212268['body']['id']){delete _0x212268[_0x775b('0x4c')]['id'];}return db[_0x775b('0x2c')][_0x775b('0x44')]({'where':{'id':_0x212268[_0x775b('0x41')]['id']}})[_0x775b('0x23')](handleEntityNotFound(_0x53373c,null))['then'](saveUpdates(_0x212268[_0x775b('0x4c')],null))[_0x775b('0x23')](respondWithResult(_0x53373c,null))[_0x775b('0x3f')](handleError(_0x53373c,null));};exports[_0x775b('0x24')]=function(_0x8c0e40,_0xaa3d5a){return db[_0x775b('0x2c')][_0x775b('0x44')]({'where':{'id':_0x8c0e40[_0x775b('0x41')]['id']}})['then'](handleEntityNotFound(_0xaa3d5a,null))[_0x775b('0x23')](removeEntity(_0xaa3d5a,null))[_0x775b('0x3f')](handleError(_0xaa3d5a,null));};exports[_0x775b('0x2d')]=function(_0x5ea341,_0x3e5b4f){return db[_0x775b('0x2c')][_0x775b('0x2d')]()[_0x775b('0x23')](respondWithResult(_0x3e5b4f,null))['catch'](handleError(_0x3e5b4f,null));};exports[_0x775b('0x4d')]=function(_0x5f453f,_0x488783,_0x45b584){return db[_0x775b('0x4e')][_0x775b('0x44')]({'where':{'id':_0x5f453f['params']['id']}})['then'](handleEntityNotFound(_0x488783,null))[_0x775b('0x23')](function(_0x5285a5){if(_0x5285a5){return _0x5285a5['addContacts'](_0x5f453f[_0x775b('0x4c')][_0x775b('0x4f')],_['omit'](_0x5f453f[_0x775b('0x4c')],[_0x775b('0x4f'),'id'])||{});}})[_0x775b('0x23')](respondWithResult(_0x488783,null))[_0x775b('0x3f')](handleError(_0x488783,null));};exports[_0x775b('0x50')]=function(_0x5ccf87,_0x458ef0,_0x5aeb32){var _0xc3bb5c={};var _0x5564dc={};var _0x367c08;var _0x555820;return db['CmCompany']['findOne']({'where':{'id':_0x5ccf87[_0x775b('0x41')]['id']}})[_0x775b('0x23')](handleEntityNotFound(_0x458ef0,null))[_0x775b('0x23')](function(_0x243b99){if(_0x243b99){_0x367c08=_0x243b99;_0x5564dc['model']=_[_0x775b('0x2f')](db[_0x775b('0x4e')][_0x775b('0x42')]);_0x5564dc[_0x775b('0x30')]=_[_0x775b('0x2f')](_0x5ccf87[_0x775b('0x30')]);_0x5564dc['filters']=_[_0x775b('0x31')](_0x5564dc['model'],_0x5564dc[_0x775b('0x30')]);_0xc3bb5c[_0x775b('0x32')]=_['intersection'](_0x5564dc['model'],qs[_0x775b('0x33')](_0x5ccf87[_0x775b('0x30')][_0x775b('0x33')]));_0xc3bb5c[_0x775b('0x32')]=_0xc3bb5c[_0x775b('0x32')][_0x775b('0x43')]?_0xc3bb5c[_0x775b('0x32')]:_0x5564dc[_0x775b('0x2e')];_0xc3bb5c[_0x775b('0x36')]=qs[_0x775b('0x37')](_0x5ccf87[_0x775b('0x30')][_0x775b('0x37')]);_0xc3bb5c[_0x775b('0x38')]=qs['filters'](_[_0x775b('0x51')](_0x5ccf87['query'],_0x5564dc['filters']));if(_0x5ccf87[_0x775b('0x30')][_0x775b('0x3b')]){_0xc3bb5c[_0x775b('0x38')]=_[_0x775b('0x3a')](_0xc3bb5c['where'],{'$or':_[_0x775b('0x52')](_0xc3bb5c[_0x775b('0x32')],function(_0x188371){var _0x2520c3={};_0x2520c3[_0x188371]={'$like':'%'+_0x5ccf87[_0x775b('0x30')]['filter']+'%'};return _0x2520c3;})});}_0xc3bb5c=_[_0x775b('0x3a')]({},_0xc3bb5c,_0x5ccf87[_0x775b('0x3c')]);return _0x367c08[_0x775b('0x50')](_0xc3bb5c);}})[_0x775b('0x23')](function(_0xdb55f4){if(_0xdb55f4){_0x555820=_0xdb55f4[_0x775b('0x43')];if(!_0x5ccf87[_0x775b('0x30')][_0x775b('0x34')](_0x775b('0x35'))){_0xc3bb5c[_0x775b('0x1d')]=qs['limit'](_0x5ccf87['query'][_0x775b('0x1d')]);_0xc3bb5c['offset']=qs[_0x775b('0x1b')](_0x5ccf87[_0x775b('0x30')][_0x775b('0x1b')]);}return _0x367c08['getContacts'](_0xc3bb5c);}})[_0x775b('0x23')](function(_0x10c1e4){if(_0x10c1e4){return _0x10c1e4?{'count':_0x555820,'rows':_0x10c1e4}:null;}})['then'](respondWithResult(_0x458ef0,null))[_0x775b('0x3f')](handleError(_0x458ef0,null));}; \ No newline at end of file +var _0xbee6=['catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','getContacts','findOne','order','nolimit','eml-format','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','options','includeAll','include','findAll'];(function(_0x3d86f4,_0x2a9220){var _0x5d8e87=function(_0x542c7c){while(--_0x542c7c){_0x3d86f4['push'](_0x3d86f4['shift']());}};_0x5d8e87(++_0x2a9220);}(_0xbee6,0x6e));var _0x6bee=function(_0x26d89e,_0x2f0571){_0x26d89e=_0x26d89e-0x0;var _0x220fe3=_0xbee6[_0x26d89e];return _0x220fe3;};'use strict';var emlformat=require(_0x6bee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bee('0x1'));var moment=require(_0x6bee('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6bee('0x3'));var path=require(_0x6bee('0x4'));var sox=require(_0x6bee('0x5'));var csv=require(_0x6bee('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bee('0x7'));var _=require(_0x6bee('0x8'));var squel=require(_0x6bee('0x9'));var crypto=require(_0x6bee('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6bee('0xb'));var toCsv=require(_0x6bee('0x6'));var querystring=require(_0x6bee('0xc'));var Papa=require(_0x6bee('0xd'));var Redis=require(_0x6bee('0xe'));var authService=require(_0x6bee('0xf'));var qs=require(_0x6bee('0x10'));var as=require(_0x6bee('0x11'));var hardwareService=require(_0x6bee('0x12'));var logger=require(_0x6bee('0x13'))('api');var utils=require(_0x6bee('0x14'));var config=require(_0x6bee('0x15'));var licenseUtil=require(_0x6bee('0x16'));var db=require(_0x6bee('0x17'))['db'];function respondWithStatusCode(_0x5dcc26,_0x444680){_0x444680=_0x444680||0xcc;return function(_0x205e01){if(_0x205e01){return _0x5dcc26['sendStatus'](_0x444680);}return _0x5dcc26[_0x6bee('0x18')](_0x444680)['end']();};}function respondWithResult(_0x44dc1a,_0x401ff4){_0x401ff4=_0x401ff4||0xc8;return function(_0x353d36){if(_0x353d36){return _0x44dc1a[_0x6bee('0x18')](_0x401ff4)[_0x6bee('0x19')](_0x353d36);}};}function respondWithFilteredResult(_0x59a436,_0x402dde){return function(_0x371c5b){if(_0x371c5b){var _0x5424d3=typeof _0x402dde[_0x6bee('0x1a')]===_0x6bee('0x1b')&&typeof _0x402dde['limit']===_0x6bee('0x1b');var _0x2deb46=_0x371c5b[_0x6bee('0x1c')];var _0x1d0083=_0x5424d3?0x0:_0x402dde[_0x6bee('0x1a')];var _0x3d7b4a=_0x5424d3?_0x371c5b[_0x6bee('0x1c')]:_0x402dde[_0x6bee('0x1a')]+_0x402dde[_0x6bee('0x1d')];var _0x3839c9;if(_0x3d7b4a>=_0x2deb46){_0x3d7b4a=_0x2deb46;_0x3839c9=0xc8;}else{_0x3839c9=0xce;}_0x59a436[_0x6bee('0x18')](_0x3839c9);return _0x59a436[_0x6bee('0x1e')](_0x6bee('0x1f'),_0x1d0083+'-'+_0x3d7b4a+'/'+_0x2deb46)[_0x6bee('0x19')](_0x371c5b);}return null;};}function patchUpdates(_0x14861a){return function(_0x39a1ec){try{jsonpatch[_0x6bee('0x20')](_0x39a1ec,_0x14861a,!![]);}catch(_0x23a668){return BPromise[_0x6bee('0x21')](_0x23a668);}return _0x39a1ec[_0x6bee('0x22')]();};}function saveUpdates(_0x3c175a,_0x141a6a){return function(_0x505e18){if(_0x505e18){return _0x505e18[_0x6bee('0x23')](_0x3c175a)[_0x6bee('0x24')](function(_0x27d5f2){return _0x27d5f2;});}return null;};}function removeEntity(_0x4b214c,_0x15c640){return function(_0x3ab95f){if(_0x3ab95f){return _0x3ab95f[_0x6bee('0x25')]()[_0x6bee('0x24')](function(){var _0xa5119e=_0x3ab95f[_0x6bee('0x26')]({'plain':!![]});var _0x3d8b86='Companies';return db['UserProfileResource'][_0x6bee('0x25')]({'where':{'type':_0x3d8b86,'resourceId':_0xa5119e['id']}})[_0x6bee('0x24')](function(){return _0x3ab95f;});})['then'](function(){_0x4b214c[_0x6bee('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cfd55,_0x2f5c34){return function(_0x29fb8d){if(!_0x29fb8d){_0x2cfd55[_0x6bee('0x27')](0x194);}return _0x29fb8d;};}function handleError(_0x23ebbe,_0x4bbf16){_0x4bbf16=_0x4bbf16||0x1f4;return function(_0x4132e8){logger[_0x6bee('0x28')](_0x4132e8[_0x6bee('0x29')]);if(_0x4132e8[_0x6bee('0x2a')]){delete _0x4132e8[_0x6bee('0x2a')];}_0x23ebbe[_0x6bee('0x18')](_0x4bbf16)[_0x6bee('0x2b')](_0x4132e8);};}exports['index']=function(_0x957d0,_0x46a698){var _0x4a92b7={},_0x2c7deb={},_0x128d88={'count':0x0,'rows':[]};return db[_0x6bee('0x2c')]['describe']()['then'](function(_0x278ba7){_0x2c7deb[_0x6bee('0x2d')]=_[_0x6bee('0x2e')](_0x278ba7);_0x2c7deb[_0x6bee('0x2f')]=_[_0x6bee('0x2e')](_0x957d0[_0x6bee('0x2f')]);_0x2c7deb[_0x6bee('0x30')]=_[_0x6bee('0x31')](_0x2c7deb['model'],_0x2c7deb['query']);_0x4a92b7[_0x6bee('0x32')]=_[_0x6bee('0x31')](_0x2c7deb[_0x6bee('0x2d')],qs[_0x6bee('0x33')](_0x957d0['query']['fields']));_0x4a92b7['attributes']=_0x4a92b7[_0x6bee('0x32')][_0x6bee('0x34')]?_0x4a92b7['attributes']:_0x2c7deb[_0x6bee('0x2d')];if(!_0x957d0[_0x6bee('0x2f')][_0x6bee('0x35')]('nolimit')){_0x4a92b7[_0x6bee('0x1d')]=qs[_0x6bee('0x1d')](_0x957d0['query']['limit']);_0x4a92b7[_0x6bee('0x1a')]=qs[_0x6bee('0x1a')](_0x957d0[_0x6bee('0x2f')][_0x6bee('0x1a')]);}_0x4a92b7['order']=qs[_0x6bee('0x36')](_0x957d0['query'][_0x6bee('0x36')]);_0x4a92b7[_0x6bee('0x37')]=qs['filters'](_[_0x6bee('0x38')](_0x957d0[_0x6bee('0x2f')],_0x2c7deb[_0x6bee('0x30')]),_0x278ba7);if(_0x957d0['query'][_0x6bee('0x39')]){_0x4a92b7['where']=_[_0x6bee('0x3a')](_0x4a92b7[_0x6bee('0x37')],{'$or':_[_0x6bee('0x3b')](_0x4a92b7[_0x6bee('0x32')],function(_0x8a35d4){var _0x30bb9e={};_0x30bb9e[_0x8a35d4]={'$like':'%'+_0x957d0['query'][_0x6bee('0x39')]+'%'};return _0x30bb9e;})});}_0x4a92b7=_[_0x6bee('0x3a')]({},_0x4a92b7,_0x957d0[_0x6bee('0x3c')]);var _0x58b2a7={'where':_0x4a92b7['where']};return db[_0x6bee('0x2c')][_0x6bee('0x1c')](_0x58b2a7)['then'](function(_0x5023cc){_0x128d88['count']=_0x5023cc;if(_0x957d0[_0x6bee('0x2f')][_0x6bee('0x3d')]){_0x4a92b7[_0x6bee('0x3e')]=[{'all':!![]}];}return db[_0x6bee('0x2c')][_0x6bee('0x3f')](_0x4a92b7);})[_0x6bee('0x24')](function(_0x264c86){_0x128d88['rows']=_0x264c86;return _0x128d88;})[_0x6bee('0x24')](respondWithFilteredResult(_0x46a698,_0x4a92b7))['catch'](handleError(_0x46a698,null));})[_0x6bee('0x40')](handleError(_0x46a698,null));};exports[_0x6bee('0x41')]=function(_0x36d965,_0x56210e){var _0x39532c={'raw':![],'where':{'id':_0x36d965[_0x6bee('0x42')]['id']}},_0x4909de={};_0x4909de[_0x6bee('0x2d')]=_['keys'](db[_0x6bee('0x2c')][_0x6bee('0x43')]);_0x4909de[_0x6bee('0x2f')]=_[_0x6bee('0x2e')](_0x36d965['query']);_0x4909de[_0x6bee('0x30')]=_[_0x6bee('0x31')](_0x4909de[_0x6bee('0x2d')],_0x4909de['query']);_0x39532c['attributes']=_[_0x6bee('0x31')](_0x4909de[_0x6bee('0x2d')],qs['fields'](_0x36d965[_0x6bee('0x2f')][_0x6bee('0x33')]));_0x39532c[_0x6bee('0x32')]=_0x39532c[_0x6bee('0x32')][_0x6bee('0x34')]?_0x39532c[_0x6bee('0x32')]:_0x4909de[_0x6bee('0x2d')];if(_0x36d965[_0x6bee('0x2f')]['includeAll']){_0x39532c[_0x6bee('0x3e')]=[{'all':!![]}];}_0x39532c=_[_0x6bee('0x3a')]({},_0x39532c,_0x36d965[_0x6bee('0x3c')]);return db[_0x6bee('0x2c')][_0x6bee('0x44')](_0x39532c)[_0x6bee('0x24')](handleEntityNotFound(_0x56210e,null))[_0x6bee('0x24')](respondWithResult(_0x56210e,null))[_0x6bee('0x40')](handleError(_0x56210e,null));};exports[_0x6bee('0x45')]=function(_0x1a75a1,_0x1891a1){return db[_0x6bee('0x2c')][_0x6bee('0x45')](_0x1a75a1[_0x6bee('0x46')],{})[_0x6bee('0x24')](function(_0x784c5){var _0x42ad75=_0x1a75a1[_0x6bee('0x47')][_0x6bee('0x26')]({'plain':!![]});if(!_0x42ad75)throw new Error(_0x6bee('0x48'));if(_0x42ad75[_0x6bee('0x49')]==='user'){var _0x5070b3=_0x784c5[_0x6bee('0x26')]({'plain':!![]});var _0x15457b=_0x6bee('0x4a');return db[_0x6bee('0x4b')]['find']({'where':{'name':_0x15457b,'userProfileId':_0x42ad75[_0x6bee('0x4c')]},'raw':!![]})['then'](function(_0x9868fd){if(_0x9868fd&&_0x9868fd['autoAssociation']===0x0){return db[_0x6bee('0x4d')][_0x6bee('0x45')]({'name':_0x5070b3[_0x6bee('0x2a')],'resourceId':_0x5070b3['id'],'type':_0x9868fd[_0x6bee('0x2a')],'sectionId':_0x9868fd['id']},{})[_0x6bee('0x24')](function(){return _0x784c5;});}else{return _0x784c5;}})['catch'](function(_0x392c4b){logger['error'](_0x6bee('0x4e'),_0x392c4b);throw _0x392c4b;});}return _0x784c5;})['then'](respondWithResult(_0x1891a1,0xc9))['catch'](handleError(_0x1891a1,null));};exports[_0x6bee('0x23')]=function(_0x11d684,_0x2195fd){if(_0x11d684[_0x6bee('0x46')]['id']){delete _0x11d684[_0x6bee('0x46')]['id'];}return db['CmCompany'][_0x6bee('0x44')]({'where':{'id':_0x11d684[_0x6bee('0x42')]['id']}})[_0x6bee('0x24')](handleEntityNotFound(_0x2195fd,null))[_0x6bee('0x24')](saveUpdates(_0x11d684['body'],null))[_0x6bee('0x24')](respondWithResult(_0x2195fd,null))[_0x6bee('0x40')](handleError(_0x2195fd,null));};exports[_0x6bee('0x25')]=function(_0x2446e2,_0x3f4c7b){return db[_0x6bee('0x2c')][_0x6bee('0x44')]({'where':{'id':_0x2446e2[_0x6bee('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f4c7b,null))[_0x6bee('0x24')](removeEntity(_0x3f4c7b,null))['catch'](handleError(_0x3f4c7b,null));};exports[_0x6bee('0x4f')]=function(_0x1c9c7a,_0x3b32bc){return db[_0x6bee('0x2c')][_0x6bee('0x4f')]()[_0x6bee('0x24')](respondWithResult(_0x3b32bc,null))[_0x6bee('0x40')](handleError(_0x3b32bc,null));};exports[_0x6bee('0x50')]=function(_0x1169ca,_0x110384,_0x1b757d){return db[_0x6bee('0x51')][_0x6bee('0x44')]({'where':{'id':_0x1169ca[_0x6bee('0x42')]['id']}})[_0x6bee('0x24')](handleEntityNotFound(_0x110384,null))[_0x6bee('0x24')](function(_0x5b8bd3){if(_0x5b8bd3){return _0x5b8bd3[_0x6bee('0x50')](_0x1169ca[_0x6bee('0x46')][_0x6bee('0x52')],_['omit'](_0x1169ca[_0x6bee('0x46')],['ids','id'])||{});}})[_0x6bee('0x24')](respondWithResult(_0x110384,null))[_0x6bee('0x40')](handleError(_0x110384,null));};exports[_0x6bee('0x53')]=function(_0x4b0144,_0x1af774,_0x5572b8){var _0x5b2c6c={};var _0x52b9a7={};var _0x1d59e6;var _0x2f3f0a;return db[_0x6bee('0x2c')][_0x6bee('0x54')]({'where':{'id':_0x4b0144['params']['id']}})['then'](handleEntityNotFound(_0x1af774,null))['then'](function(_0x35d06d){if(_0x35d06d){_0x1d59e6=_0x35d06d;_0x52b9a7[_0x6bee('0x2d')]=_[_0x6bee('0x2e')](db[_0x6bee('0x51')][_0x6bee('0x43')]);_0x52b9a7['query']=_[_0x6bee('0x2e')](_0x4b0144[_0x6bee('0x2f')]);_0x52b9a7[_0x6bee('0x30')]=_[_0x6bee('0x31')](_0x52b9a7[_0x6bee('0x2d')],_0x52b9a7[_0x6bee('0x2f')]);_0x5b2c6c[_0x6bee('0x32')]=_[_0x6bee('0x31')](_0x52b9a7['model'],qs[_0x6bee('0x33')](_0x4b0144[_0x6bee('0x2f')][_0x6bee('0x33')]));_0x5b2c6c['attributes']=_0x5b2c6c[_0x6bee('0x32')][_0x6bee('0x34')]?_0x5b2c6c['attributes']:_0x52b9a7[_0x6bee('0x2d')];_0x5b2c6c[_0x6bee('0x55')]=qs[_0x6bee('0x36')](_0x4b0144[_0x6bee('0x2f')][_0x6bee('0x36')]);_0x5b2c6c[_0x6bee('0x37')]=qs[_0x6bee('0x30')](_[_0x6bee('0x38')](_0x4b0144[_0x6bee('0x2f')],_0x52b9a7['filters']));if(_0x4b0144[_0x6bee('0x2f')][_0x6bee('0x39')]){_0x5b2c6c[_0x6bee('0x37')]=_[_0x6bee('0x3a')](_0x5b2c6c[_0x6bee('0x37')],{'$or':_[_0x6bee('0x3b')](_0x5b2c6c['attributes'],function(_0x53f188){var _0x2a7682={};_0x2a7682[_0x53f188]={'$like':'%'+_0x4b0144[_0x6bee('0x2f')]['filter']+'%'};return _0x2a7682;})});}_0x5b2c6c=_['merge']({},_0x5b2c6c,_0x4b0144['options']);return _0x1d59e6[_0x6bee('0x53')](_0x5b2c6c);}})[_0x6bee('0x24')](function(_0x10ab72){if(_0x10ab72){_0x2f3f0a=_0x10ab72[_0x6bee('0x34')];if(!_0x4b0144[_0x6bee('0x2f')]['hasOwnProperty'](_0x6bee('0x56'))){_0x5b2c6c[_0x6bee('0x1d')]=qs[_0x6bee('0x1d')](_0x4b0144['query']['limit']);_0x5b2c6c[_0x6bee('0x1a')]=qs[_0x6bee('0x1a')](_0x4b0144[_0x6bee('0x2f')][_0x6bee('0x1a')]);}return _0x1d59e6['getContacts'](_0x5b2c6c);}})[_0x6bee('0x24')](function(_0x54ac27){if(_0x54ac27){return _0x54ac27?{'count':_0x2f3f0a,'rows':_0x54ac27}:null;}})['then'](respondWithResult(_0x1af774,null))['catch'](handleError(_0x1af774,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 0ec4813..8433261 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 _0xd0ed=['request-promise','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','api','bluebird'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0xd0ed,0x80));var _0xdd0e=function(_0x277607,_0x345a06){_0x277607=_0x277607-0x0;var _0x15fe23=_0xd0ed[_0x277607];return _0x15fe23;};'use strict';var _=require(_0xdd0e('0x0'));var util=require(_0xdd0e('0x1'));var logger=require('../../config/logger')(_0xdd0e('0x2'));var moment=require('moment');var BPromise=require(_0xdd0e('0x3'));var rp=require(_0xdd0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd0e('0x5'));var config=require('../../config/environment');var attributes=require(_0xdd0e('0x6'));module[_0xdd0e('0x7')]=function(_0x33bf49,_0x5e124d){return _0x33bf49[_0xdd0e('0x8')](_0xdd0e('0x9'),attributes,{'tableName':_0xdd0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33d5=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','CmCompany','cm_companies','lodash','util'];(function(_0x1bcf71,_0x23f1a7){var _0x1c9c77=function(_0x5a5fcb){while(--_0x5a5fcb){_0x1bcf71['push'](_0x1bcf71['shift']());}};_0x1c9c77(++_0x23f1a7);}(_0x33d5,0x136));var _0x533d=function(_0x746366,_0x2c25b2){_0x746366=_0x746366-0x0;var _0x3d19c3=_0x33d5[_0x746366];return _0x3d19c3;};'use strict';var _=require(_0x533d('0x0'));var util=require(_0x533d('0x1'));var logger=require(_0x533d('0x2'))(_0x533d('0x3'));var moment=require(_0x533d('0x4'));var BPromise=require(_0x533d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x533d('0x6'));var rimraf=require(_0x533d('0x7'));var config=require(_0x533d('0x8'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0xb4e962,_0x53bb78){return _0xb4e962[_0x533d('0x9')](_0x533d('0xa'),attributes,{'tableName':_0x533d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index e05f07e..a7f6b65 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 _0x5f32=['CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x3e3bbc,_0x374fb4){var _0x3bb3f6=function(_0x15bfd1){while(--_0x15bfd1){_0x3e3bbc['push'](_0x3e3bbc['shift']());}};_0x3bb3f6(++_0x374fb4);}(_0x5f32,0x126));var _0x25f3=function(_0x32eb3f,_0x3cc610){_0x32eb3f=_0x32eb3f-0x0;var _0x372d5f=_0x5f32[_0x32eb3f];return _0x372d5f;};'use strict';var _=require('lodash');var util=require(_0x25f3('0x0'));var moment=require(_0x25f3('0x1'));var BPromise=require(_0x25f3('0x2'));var rs=require(_0x25f3('0x3'));var fs=require('fs');var Redis=require(_0x25f3('0x4'));var db=require(_0x25f3('0x5'))['db'];var utils=require(_0x25f3('0x6'));var logger=require(_0x25f3('0x7'))(_0x25f3('0x8'));var config=require(_0x25f3('0x9'));var jayson=require(_0x25f3('0xa'));var client=jayson['client'][_0x25f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e6052,_0xaf05ef,_0xa90d2){return new BPromise(function(_0xf918ec,_0x253eed){return client[_0x25f3('0xc')](_0x5e6052,_0xa90d2)['then'](function(_0x105078){logger[_0x25f3('0xd')](_0x25f3('0xe'),_0xaf05ef,_0x25f3('0xf'));logger[_0x25f3('0x10')](_0x25f3('0x11'),_0xaf05ef,_0x25f3('0xf'),JSON['stringify'](_0x105078));if(_0x105078[_0x25f3('0x12')]){if(_0x105078['error'][_0x25f3('0x13')]===0x1f4){logger[_0x25f3('0x12')]('CmCompany,\x20%s,\x20%s',_0xaf05ef,_0x105078[_0x25f3('0x12')][_0x25f3('0x14')]);return _0x253eed(_0x105078[_0x25f3('0x12')][_0x25f3('0x14')]);}logger[_0x25f3('0x12')](_0x25f3('0xe'),_0xaf05ef,_0x105078[_0x25f3('0x12')][_0x25f3('0x14')]);return _0xf918ec(_0x105078[_0x25f3('0x12')]['message']);}else{logger[_0x25f3('0xd')](_0x25f3('0xe'),_0xaf05ef,'request\x20sent');_0xf918ec(_0x105078[_0x25f3('0x15')][_0x25f3('0x14')]);}})['catch'](function(_0x2f7606){logger['error'](_0x25f3('0xe'),_0xaf05ef,_0x2f7606);_0x253eed(_0x2f7606);});});} \ No newline at end of file +var _0xb742=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','CmCompany,\x20%s,\x20%s'];(function(_0x57cc38,_0x471274){var _0x571228=function(_0xc80995){while(--_0xc80995){_0x57cc38['push'](_0x57cc38['shift']());}};_0x571228(++_0x471274);}(_0xb742,0x12e));var _0x2b74=function(_0x5f8000,_0x4a56b1){_0x5f8000=_0x5f8000-0x0;var _0xc8f261=_0xb742[_0x5f8000];return _0xc8f261;};'use strict';var _=require(_0x2b74('0x0'));var util=require('util');var moment=require(_0x2b74('0x1'));var BPromise=require(_0x2b74('0x2'));var rs=require(_0x2b74('0x3'));var fs=require('fs');var Redis=require(_0x2b74('0x4'));var db=require(_0x2b74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b74('0x6'))(_0x2b74('0x7'));var config=require('../../config/environment');var jayson=require(_0x2b74('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45f873,_0x56a15b,_0x4558b0){return new BPromise(function(_0x35d115,_0xa1299f){return client[_0x2b74('0x9')](_0x45f873,_0x4558b0)['then'](function(_0xd64b5b){logger[_0x2b74('0xa')]('CmCompany,\x20%s,\x20%s',_0x56a15b,_0x2b74('0xb'));logger[_0x2b74('0xc')](_0x2b74('0xd'),_0x56a15b,_0x2b74('0xb'),JSON[_0x2b74('0xe')](_0xd64b5b));if(_0xd64b5b['error']){if(_0xd64b5b[_0x2b74('0xf')]['code']===0x1f4){logger[_0x2b74('0xf')]('CmCompany,\x20%s,\x20%s',_0x56a15b,_0xd64b5b[_0x2b74('0xf')][_0x2b74('0x10')]);return _0xa1299f(_0xd64b5b[_0x2b74('0xf')]['message']);}logger['error'](_0x2b74('0x11'),_0x56a15b,_0xd64b5b[_0x2b74('0xf')][_0x2b74('0x10')]);return _0x35d115(_0xd64b5b[_0x2b74('0xf')][_0x2b74('0x10')]);}else{logger[_0x2b74('0xa')]('CmCompany,\x20%s,\x20%s',_0x56a15b,_0x2b74('0xb'));_0x35d115(_0xd64b5b[_0x2b74('0x12')]['message']);}})[_0x2b74('0x13')](function(_0xf63c0a){logger[_0x2b74('0xf')]('CmCompany,\x20%s,\x20%s',_0x56a15b,_0xf63c0a);_0xa1299f(_0xf63c0a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 41e6401..f431d1a 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 _0xdfdf=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','create','post','/:id/contacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x54b17e,_0xc7f0d0){var _0x283ed9=function(_0x438829){while(--_0x438829){_0x54b17e['push'](_0x54b17e['shift']());}};_0x283ed9(++_0xc7f0d0);}(_0xdfdf,0x130));var _0xfdfd=function(_0xe6e867,_0x174b84){_0xe6e867=_0xe6e867-0x0;var _0x475ba5=_0xdfdf[_0xe6e867];return _0x475ba5;};'use strict';var multer=require(_0xfdfd('0x0'));var util=require(_0xfdfd('0x1'));var path=require(_0xfdfd('0x2'));var timeout=require(_0xfdfd('0x3'));var express=require(_0xfdfd('0x4'));var router=express[_0xfdfd('0x5')]();var fs_extra=require(_0xfdfd('0x6'));var auth=require(_0xfdfd('0x7'));var interaction=require(_0xfdfd('0x8'));var config=require(_0xfdfd('0x9'));var controller=require('./cmCompany.controller');router[_0xfdfd('0xa')]('/',auth[_0xfdfd('0xb')](),controller[_0xfdfd('0xc')]);router[_0xfdfd('0xa')](_0xfdfd('0xd'),auth[_0xfdfd('0xb')](),controller[_0xfdfd('0xe')]);router['get'](_0xfdfd('0xf'),auth[_0xfdfd('0xb')](),controller[_0xfdfd('0x10')]);router[_0xfdfd('0xa')]('/:id/contacts',auth[_0xfdfd('0xb')](),controller[_0xfdfd('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfdfd('0x12')]);router[_0xfdfd('0x13')](_0xfdfd('0x14'),auth[_0xfdfd('0xb')](),controller['addContacts']);router[_0xfdfd('0x15')](_0xfdfd('0xf'),auth['isAuthenticated'](),controller[_0xfdfd('0x16')]);router[_0xfdfd('0x17')](_0xfdfd('0xf'),auth[_0xfdfd('0xb')](),controller[_0xfdfd('0x18')]);module[_0xfdfd('0x19')]=router; \ No newline at end of file +var _0x976c=['post','create','addContacts','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','describe','/:id','isAuthenticated','show','/:id/contacts','getContacts'];(function(_0x58a73e,_0x219f97){var _0x3c9492=function(_0x2917f8){while(--_0x2917f8){_0x58a73e['push'](_0x58a73e['shift']());}};_0x3c9492(++_0x219f97);}(_0x976c,0x1bf));var _0xc976=function(_0x2a5d30,_0x4803d1){_0x2a5d30=_0x2a5d30-0x0;var _0x24257d=_0x976c[_0x2a5d30];return _0x24257d;};'use strict';var multer=require(_0xc976('0x0'));var util=require('util');var path=require(_0xc976('0x1'));var timeout=require(_0xc976('0x2'));var express=require('express');var router=express[_0xc976('0x3')]();var fs_extra=require(_0xc976('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc976('0x5'));var config=require(_0xc976('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc976('0x7')]);router[_0xc976('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xc976('0x9')]);router[_0xc976('0x8')](_0xc976('0xa'),auth[_0xc976('0xb')](),controller[_0xc976('0xc')]);router['get'](_0xc976('0xd'),auth[_0xc976('0xb')](),controller[_0xc976('0xe')]);router[_0xc976('0xf')]('/',auth[_0xc976('0xb')](),controller[_0xc976('0x10')]);router[_0xc976('0xf')](_0xc976('0xd'),auth['isAuthenticated'](),controller[_0xc976('0x11')]);router[_0xc976('0x12')](_0xc976('0xa'),auth[_0xc976('0xb')](),controller[_0xc976('0x13')]);router['delete'](_0xc976('0xa'),auth[_0xc976('0xb')](),controller[_0xc976('0x14')]);module[_0xc976('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 25b4f98..9f34fc1 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 _0x54d0=['TEXT','INTEGER','UNSIGNED','DATE','NOW','sequelize','exports','STRING'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x54d0,0x175));var _0x054d=function(_0xec3cab,_0x3d89a1){_0xec3cab=_0xec3cab-0x0;var _0x2e4e51=_0x54d0[_0xec3cab];return _0x2e4e51;};'use strict';var _=require('lodash');var Sequelize=require(_0x054d('0x0'));module[_0x054d('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x054d('0x2')]},'street':{'type':Sequelize[_0x054d('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x054d('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x054d('0x2')]},'description':{'type':Sequelize[_0x054d('0x3')]},'phone':{'type':Sequelize[_0x054d('0x2')]},'mobile':{'type':Sequelize[_0x054d('0x2')]},'fax':{'type':Sequelize[_0x054d('0x2')]},'email':{'type':Sequelize[_0x054d('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x054d('0x2')]},'fb_data':{'type':Sequelize[_0x054d('0x2')]},'twitter':{'type':Sequelize[_0x054d('0x2')]},'skype':{'type':Sequelize[_0x054d('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x054d('0x2')]},'line':{'type':Sequelize[_0x054d('0x2')]},'wechat':{'type':Sequelize[_0x054d('0x2')]},'telegram':{'type':Sequelize[_0x054d('0x2')]},'UserId':{'type':Sequelize[_0x054d('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x054d('0x2')]},'priority':{'type':Sequelize[_0x054d('0x4')](0x2)[_0x054d('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x054d('0x6')],'defaultValue':Sequelize[_0x054d('0x7')]},'dialTimezone':{'type':Sequelize[_0x054d('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3d74=['INTEGER','UNSIGNED','DATE','lodash','sequelize','exports','STRING','TEXT'];(function(_0x58ab22,_0x42c988){var _0x3bedba=function(_0x121f16){while(--_0x121f16){_0x58ab22['push'](_0x58ab22['shift']());}};_0x3bedba(++_0x42c988);}(_0x3d74,0x11b));var _0x43d7=function(_0x5abe7f,_0x23775a){_0x5abe7f=_0x5abe7f-0x0;var _0x415ae1=_0x3d74[_0x5abe7f];return _0x415ae1;};'use strict';var _=require(_0x43d7('0x0'));var Sequelize=require(_0x43d7('0x1'));module[_0x43d7('0x2')]={'firstName':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x43d7('0x3')]},'street':{'type':Sequelize[_0x43d7('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x43d7('0x3')]},'country':{'type':Sequelize[_0x43d7('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x43d7('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x43d7('0x3')]},'email':{'type':Sequelize[_0x43d7('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x43d7('0x3')]},'fb_data':{'type':Sequelize[_0x43d7('0x3')]},'twitter':{'type':Sequelize[_0x43d7('0x3')]},'skype':{'type':Sequelize[_0x43d7('0x3')]},'teams':{'type':Sequelize[_0x43d7('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x43d7('0x3')]},'telegram':{'type':Sequelize[_0x43d7('0x3')]},'UserId':{'type':Sequelize[_0x43d7('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x43d7('0x3')]},'priority':{'type':Sequelize[_0x43d7('0x5')](0x2)[_0x43d7('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x43d7('0x7')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x43d7('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 74cfcb6..f856de3 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];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 respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];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 respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 0ab4c20..f9366d4 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 _0x3095=['../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x17a24a,_0x2fcf92){var _0x82f671=function(_0x15bd6d){while(--_0x15bd6d){_0x17a24a['push'](_0x17a24a['shift']());}};_0x82f671(++_0x2fcf92);}(_0x3095,0x15f));var _0x5309=function(_0x347733,_0x5de9fa){_0x347733=_0x347733-0x0;var _0x398c75=_0x3095[_0x347733];return _0x398c75;};'use strict';var EventEmitter=require(_0x5309('0x0'));var CmContact=require(_0x5309('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5309('0x2'),'afterUpdate':'update','afterDestroy':_0x5309('0x3')};function emitEvent(_0x5b6ed5){return function(_0x3610e3,_0x1d9782,_0x15641a){CmContactEvents['emit'](_0x5b6ed5+':'+_0x3610e3['id'],_0x3610e3);CmContactEvents[_0x5309('0x4')](_0x5b6ed5,_0x3610e3);_0x15641a(null);};}for(var e in events){if(events[_0x5309('0x5')](e)){var event=events[e];CmContact[_0x5309('0x6')](e,emitEvent(event));}}module[_0x5309('0x7')]=CmContactEvents; \ No newline at end of file +var _0x30bf=['CmContact','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x1d4f33,_0x165f68){var _0x103ca4=function(_0x10cbd5){while(--_0x10cbd5){_0x1d4f33['push'](_0x1d4f33['shift']());}};_0x103ca4(++_0x165f68);}(_0x30bf,0xca));var _0xf30b=function(_0x33160f,_0x484f9c){_0x33160f=_0x33160f-0x0;var _0x428d82=_0x30bf[_0x33160f];return _0x428d82;};'use strict';var EventEmitter=require(_0xf30b('0x0'));var CmContact=require('../../mysqldb')['db'][_0xf30b('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf30b('0x2')](0x0);var events={'afterCreate':_0xf30b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ba9cc){return function(_0x48f245,_0x413c7d,_0x2ae328){CmContactEvents[_0xf30b('0x4')](_0x3ba9cc+':'+_0x48f245['id'],_0x48f245);CmContactEvents[_0xf30b('0x4')](_0x3ba9cc,_0x48f245);_0x2ae328(null);};}for(var e in events){if(events[_0xf30b('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xf30b('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 3685ad1..a210058 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 _0x3ea9=['findOne','then','isNil','utcOffset','add','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','afterCreate','timezones','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','length','get','always','onlyIfOpen','outbound','cmContact,\x20%s,\x20%s','message','Campaign','BlackLists','List\x20not\x20found','isEmpty','destroy','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','cmContact','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone'];(function(_0x535c2b,_0x13368b){var _0x347f9d=function(_0x1c3b4d){while(--_0x1c3b4d){_0x535c2b['push'](_0x535c2b['shift']());}};_0x347f9d(++_0x13368b);}(_0x3ea9,0xca));var _0x93ea=function(_0x486a47,_0x4412ed){_0x486a47=_0x486a47-0x0;var _0x2dcb89=_0x3ea9[_0x486a47];return _0x2dcb89;};'use strict';var _=require(_0x93ea('0x0'));var util=require(_0x93ea('0x1'));var logger=require('../../config/logger')(_0x93ea('0x2'));var moment=require(_0x93ea('0x3'));var BPromise=require(_0x93ea('0x4'));var rp=require(_0x93ea('0x5'));var fs=require('fs');var path=require(_0x93ea('0x6'));var rimraf=require(_0x93ea('0x7'));var config=require(_0x93ea('0x8'));var shared=require(_0x93ea('0x9'));var attributes=require(_0x93ea('0xa'));module[_0x93ea('0xb')]=function(_0x153f27,_0x507197){return _0x153f27[_0x93ea('0xc')]('CmContact',attributes,{'tableName':_0x93ea('0xd'),'paranoid':!![],'indexes':[{'name':_0x93ea('0xe'),'fields':[_0x93ea('0xe')]},{'name':_0x93ea('0xf'),'fields':[_0x93ea('0x10'),_0x93ea('0x11'),_0x93ea('0xe'),_0x93ea('0x12'),_0x93ea('0x13'),_0x93ea('0x14')],'type':_0x93ea('0x15')}],'timestamps':!![],'charset':_0x93ea('0x16'),'collate':_0x93ea('0x17'),'hooks':{'afterCreate':function(_0x2bc1a3,_0x51a422,_0x1e2ec6){var _0x1dca5e=_0x153f27[_0x93ea('0x18')];var _0x12f1bc=_0x2bc1a3['get']({'plain':!![]});function _0x3b734a(){return function(_0x35f813){logger[_0x93ea('0x19')](_0x93ea('0x1a'),'afterCreate',util[_0x93ea('0x1b')](_0x35f813,{'showHidden':![],'depth':null}));};}function _0x23d9d2(_0x29f743,_0xb0a21c){var _0x3a4378=_0xb0a21c[_0x93ea('0x1c')]?_0xb0a21c[_0x93ea('0x1c')]:moment()[_0x93ea('0x1d')](_0x93ea('0x1e'));return new BPromise(function(_0x11a14a,_0x455faf){if(_['isNil'](_0xb0a21c[_0x93ea('0x1f')])){_0x11a14a({'ret':_0x3a4378});}else{_0x1dca5e['VoiceQueue'][_0x93ea('0x20')]({'where':{'id':_0x29f743['id']}})[_0x93ea('0x21')](function(_0x5e8094){if(!_['isNil'](_0x5e8094)){var _0x531fe2=_0x5e8094[_0x93ea('0x1f')];if(!_[_0x93ea('0x22')](_0x531fe2)){var _0x506a7e=shared['timezones'];var _0x49646d=_0x506a7e[_0x531fe2];var _0x4760ec=_0x506a7e[_0xb0a21c[_0x93ea('0x1f')]];if(!_[_0x93ea('0x22')](_0x49646d)&&!_['isNil'](_0x4760ec)){var _0x300282=_0x49646d[_0x93ea('0x23')]-_0x4760ec[_0x93ea('0x23')];_0x3a4378=_0xb0a21c[_0x93ea('0x1c')]?_0xb0a21c['scheduledat']:moment();var _0x350af1=moment(_0x3a4378)[_0x93ea('0x24')](_0x300282,'minutes');_0x11a14a({'ret':_0x350af1[_0x93ea('0x1d')](_0x93ea('0x1e'))});}else _0x11a14a({'ret':_0x3a4378});}else _0x11a14a({'ret':_0x3a4378});}else{_0x11a14a({'ret':_0x3a4378});}});}});return 0xa;}var _0x943954=function(_0xfbc254){return new BPromise(function(_0x335ed2,_0x230909){_0x23d9d2(_0xfbc254,_0x12f1bc)['then'](function(_0x283369){_0x12f1bc[_0x93ea('0x1c')]=_0x283369[_0x93ea('0x25')];_0x1dca5e[_0x93ea('0x26')][_0x93ea('0x20')]({'where':{'phone':_0x12f1bc[_0x93ea('0xe')],'VoiceQueueId':_0xfbc254['id']}})['then'](function(_0x720efd){if(!_[_0x93ea('0x22')](_0x720efd)){throw new Error('cmContact,\x20afterCreate\x20'+_0x12f1bc[_0x93ea('0xe')]+_0x93ea('0x27')+_0xfbc254['id']);}return _0x1dca5e['CmHopper'][_0x93ea('0x28')]({'phone':_0x12f1bc['phone'],'ContactId':_0x12f1bc['id'],'ListId':_0x12f1bc[_0x93ea('0x29')],'priority':_0x12f1bc['priority']?_0x12f1bc[_0x93ea('0x2a')]:0x2,'scheduledat':_0x12f1bc[_0x93ea('0x1c')]?_0x12f1bc[_0x93ea('0x1c')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x12f1bc[_0x93ea('0x2b')]?!![]:![],'callbackuniqueid':_0x12f1bc[_0x93ea('0x2b')]?_0x12f1bc[_0x93ea('0x2b')]:undefined,'callbackat':_0x12f1bc[_0x93ea('0x2b')]?moment()[_0x93ea('0x1d')](_0x93ea('0x1e')):undefined,'VoiceQueueId':_0xfbc254['id']});})[_0x93ea('0x2c')](function(_0x3418cd){_0x230909(_0x3418cd);});});});};var _0x133024=function(_0x4f3055){return new BPromise(function(_0x30a87a,_0x44d8d9){_0x23d9d2(_0x4f3055,_0x12f1bc)[_0x93ea('0x21')](function(_0x4d1939){_0x12f1bc[_0x93ea('0x1c')]=_0x4d1939[_0x93ea('0x25')];_0x1dca5e['CmHopper'][_0x93ea('0x20')]({'where':{'phone':_0x12f1bc[_0x93ea('0xe')],'VoiceQueueId':_0x4f3055['id']}})[_0x93ea('0x21')](function(_0x48eaed){if(!_[_0x93ea('0x22')](_0x48eaed)){throw new Error(_0x93ea('0x2d')+_0x12f1bc[_0x93ea('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x4f3055['id']);}return _0x1dca5e[_0x93ea('0x2e')][_0x93ea('0x20')]({'where':{'calleridnum':_0x12f1bc[_0x93ea('0xe')],'VoiceQueueId':_0x4f3055['id']}});})['then'](function(_0x405527){if(!_['isNil'](_0x405527)){throw new Error(_0x93ea('0x2f')+_0x12f1bc['phone']+_0x93ea('0x30')+_0x4f3055['id']);}return _0x1dca5e['CmHopper'][_0x93ea('0x28')]({'phone':_0x12f1bc['phone'],'ContactId':_0x12f1bc['id'],'ListId':_0x12f1bc['ListId'],'priority':_0x12f1bc[_0x93ea('0x2a')]?_0x12f1bc[_0x93ea('0x2a')]:0x2,'scheduledat':_0x12f1bc[_0x93ea('0x1c')]?_0x12f1bc[_0x93ea('0x1c')]:moment()[_0x93ea('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x12f1bc[_0x93ea('0x2b')]?!![]:![],'callbackuniqueid':_0x12f1bc[_0x93ea('0x2b')]?_0x12f1bc[_0x93ea('0x2b')]:undefined,'callbackat':_0x12f1bc[_0x93ea('0x2b')]?moment()[_0x93ea('0x1d')](_0x93ea('0x1e')):undefined,'VoiceQueueId':_0x4f3055['id']});})[_0x93ea('0x2c')](function(_0x21a965){_0x44d8d9(_0x21a965);});});});};function _0x3bd785(){return function(_0x1fa6b6){logger[_0x93ea('0x19')](_0x93ea('0x1a'),_0x93ea('0x31'),util[_0x93ea('0x1b')](_0x1fa6b6,{'showHidden':![],'depth':null}));};}function _0x4240e3(_0x336a52,_0x4ffec4){var _0x408a5b=_0x4ffec4['scheduledat']?_0x4ffec4[_0x93ea('0x1c')]:moment()[_0x93ea('0x1d')](_0x93ea('0x1e'));return new BPromise(function(_0x3865a0,_0x234a4f){if(_[_0x93ea('0x22')](_0x4ffec4[_0x93ea('0x1f')])){_0x3865a0({'ret':_0x408a5b});}else{_0x1dca5e['Campaign'][_0x93ea('0x20')]({'where':{'id':_0x336a52['id']}})['then'](function(_0x58d447){if(!_[_0x93ea('0x22')](_0x58d447)){var _0x589508=_0x58d447[_0x93ea('0x1f')];if(!_[_0x93ea('0x22')](_0x589508)){var _0x2aa4e1=shared[_0x93ea('0x32')];var _0x11ac1d=_0x2aa4e1[_0x589508];var _0x93a4cf=_0x2aa4e1[_0x4ffec4[_0x93ea('0x1f')]];if(!_[_0x93ea('0x22')](_0x11ac1d)&&!_[_0x93ea('0x22')](_0x93a4cf)){var _0x494ff5=_0x11ac1d[_0x93ea('0x23')]-_0x93a4cf['utcOffset'];_0x408a5b=_0x4ffec4[_0x93ea('0x1c')]?_0x4ffec4[_0x93ea('0x1c')]:moment();var _0x1bf215=moment(_0x408a5b)[_0x93ea('0x24')](_0x494ff5,_0x93ea('0x33'));_0x3865a0({'ret':_0x1bf215[_0x93ea('0x1d')](_0x93ea('0x1e'))});}else _0x3865a0({'ret':_0x408a5b});}else _0x3865a0({'ret':_0x408a5b});}else{_0x3865a0({'ret':_0x408a5b});}});}});return 0xa;}var _0xf45c48=function(_0x133ac9){return new BPromise(function(_0x32c937,_0x504ae0){_0x4240e3(_0x133ac9,_0x12f1bc)[_0x93ea('0x21')](function(_0x24e759){_0x12f1bc['scheduledat']=_0x24e759[_0x93ea('0x25')];_0x1dca5e[_0x93ea('0x26')][_0x93ea('0x20')]({'where':{'phone':_0x12f1bc[_0x93ea('0xe')],'CampaignId':_0x133ac9['id']}})[_0x93ea('0x21')](function(_0x43bc75){if(!_[_0x93ea('0x22')](_0x43bc75)){throw new Error(_0x93ea('0x2d')+_0x12f1bc[_0x93ea('0xe')]+_0x93ea('0x34')+_0x133ac9['id']);}return _0x1dca5e[_0x93ea('0x26')]['create']({'phone':_0x12f1bc[_0x93ea('0xe')],'ContactId':_0x12f1bc['id'],'ListId':_0x12f1bc['ListId'],'priority':_0x12f1bc[_0x93ea('0x2a')]?_0x12f1bc[_0x93ea('0x2a')]:0x2,'scheduledat':_0x12f1bc[_0x93ea('0x1c')]?_0x12f1bc['scheduledat']:moment()[_0x93ea('0x1d')](_0x93ea('0x1e')),'callback':_0x12f1bc[_0x93ea('0x2b')]?!![]:![],'callbackuniqueid':_0x12f1bc[_0x93ea('0x2b')]?_0x12f1bc[_0x93ea('0x2b')]:undefined,'callbackat':_0x12f1bc[_0x93ea('0x2b')]?moment()[_0x93ea('0x1d')](_0x93ea('0x1e')):undefined,'CampaignId':_0x133ac9['id']});})[_0x93ea('0x2c')](function(_0x96ebfd){_0x504ae0(_0x96ebfd);});});});};var _0x5f2888=function(_0x5dedc7){return new BPromise(function(_0x34a9d2,_0x175d54){_0x4240e3(_0x5dedc7,_0x12f1bc)['then'](function(_0x5d0cac){_0x12f1bc['scheduledat']=_0x5d0cac['ret'];_0x1dca5e[_0x93ea('0x26')][_0x93ea('0x20')]({'where':{'phone':_0x12f1bc[_0x93ea('0xe')],'CampaignId':_0x5dedc7['id']}})['then'](function(_0x5cd525){if(!_[_0x93ea('0x22')](_0x5cd525)){throw new Error('cmContact,\x20afterCreate\x20'+_0x12f1bc[_0x93ea('0xe')]+_0x93ea('0x35')+_0x5dedc7['id']);}return _0x1dca5e[_0x93ea('0x2e')]['findOne']({'where':{'calleridnum':_0x12f1bc[_0x93ea('0xe')],'CampaignId':_0x5dedc7['id']}});})[_0x93ea('0x21')](function(_0x2ef5b8){if(!_[_0x93ea('0x22')](_0x2ef5b8)){throw new Error(_0x93ea('0x2f')+_0x12f1bc[_0x93ea('0xe')]+_0x93ea('0x36')+_0x5dedc7['id']);}return _0x1dca5e['CmHopper']['create']({'phone':_0x12f1bc[_0x93ea('0xe')],'ContactId':_0x12f1bc['id'],'ListId':_0x12f1bc['ListId'],'priority':_0x12f1bc['priority']?_0x12f1bc[_0x93ea('0x2a')]:0x2,'scheduledat':_0x12f1bc[_0x93ea('0x1c')]?_0x12f1bc[_0x93ea('0x1c')]:moment()[_0x93ea('0x1d')](_0x93ea('0x1e')),'callback':_0x12f1bc[_0x93ea('0x2b')]?!![]:![],'callbackuniqueid':_0x12f1bc[_0x93ea('0x2b')]?_0x12f1bc['callbackUniqueid']:undefined,'callbackat':_0x12f1bc[_0x93ea('0x2b')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5dedc7['id']});})[_0x93ea('0x2c')](function(_0xa4fa){_0x175d54(_0xa4fa);});});});};if(_0x12f1bc[_0x93ea('0x29')]){_0x1dca5e[_0x93ea('0x37')][_0x93ea('0x38')]({'where':{'type':'outbound'},'attributes':['id',_0x93ea('0x39'),_0x93ea('0x1f')],'include':[{'model':_0x1dca5e[_0x93ea('0x3a')],'as':_0x93ea('0x3b'),'where':{'id':_0x12f1bc[_0x93ea('0x29')]}}]})['then'](function(_0x16e40d){if(_0x16e40d){var _0x2b888b=[];for(var _0x4e9961=0x0,_0x1b1e62;_0x4e9961<_0x16e40d[_0x93ea('0x3c')];_0x4e9961+=0x1){_0x1b1e62=_0x16e40d[_0x4e9961][_0x93ea('0x3d')]({'plain':!![]});switch(_0x1b1e62[_0x93ea('0x39')]){case _0x93ea('0x3e'):_0x133024(_0x1b1e62)[_0x93ea('0x2c')](_0x3b734a());break;case _0x93ea('0x3f'):_0x943954(_0x1b1e62)[_0x93ea('0x2c')](_0x3b734a());break;default:_0x4240e3(_0x1b1e62,_0x12f1bc)['then'](function(_0x223029){_0x12f1bc[_0x93ea('0x1c')]=_0x223029[_0x93ea('0x25')];_0x1dca5e[_0x93ea('0x26')][_0x93ea('0x28')]({'phone':_0x12f1bc['phone'],'ContactId':_0x12f1bc['id'],'ListId':_0x12f1bc['ListId'],'scheduledat':_0x12f1bc['scheduledat']?_0x12f1bc[_0x93ea('0x1c')]:moment()[_0x93ea('0x1d')](_0x93ea('0x1e')),'priority':_0x12f1bc[_0x93ea('0x2a')]?_0x12f1bc[_0x93ea('0x2a')]:0x2,'callback':_0x12f1bc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x12f1bc[_0x93ea('0x2b')]?_0x12f1bc[_0x93ea('0x2b')]:undefined,'callbackat':_0x12f1bc[_0x93ea('0x2b')]?moment()[_0x93ea('0x1d')](_0x93ea('0x1e')):undefined,'VoiceQueueId':_0x1b1e62['id']})[_0x93ea('0x2c')](_0x3b734a());});}}}})[_0x93ea('0x21')](function(){return _0x1dca5e[_0x93ea('0x37')][_0x93ea('0x38')]({'where':{'type':_0x93ea('0x40')},'attributes':['id'],'include':[{'model':_0x1dca5e[_0x93ea('0x3a')],'as':'BlackLists','where':{'id':_0x12f1bc[_0x93ea('0x29')]}}]})['then'](function(_0x2cf3ef){if(_0x2cf3ef){var _0x2e17ea=[];for(var _0x1e66d5=0x0,_0x4e2d1e;_0x1e66d5<_0x2cf3ef[_0x93ea('0x3c')];_0x1e66d5+=0x1){_0x4e2d1e=_0x2cf3ef[_0x1e66d5][_0x93ea('0x3d')]({'plain':!![]});_0x1dca5e['CmHopperBlack'][_0x93ea('0x28')]({'phone':_0x12f1bc[_0x93ea('0xe')],'ContactId':_0x12f1bc['id'],'ListId':_0x12f1bc['ListId'],'VoiceQueueId':_0x4e2d1e['id']})[_0x93ea('0x2c')](function(_0x524f4b){logger['error'](_0x93ea('0x41'),_0x93ea('0x31'),_0x524f4b[_0x93ea('0x42')]);});}}});})['then'](function(){return _0x1dca5e[_0x93ea('0x43')][_0x93ea('0x38')]({'attributes':['id',_0x93ea('0x39'),_0x93ea('0x1f')],'include':[{'model':_0x1dca5e['CmList'],'as':'Lists','where':{'id':_0x12f1bc[_0x93ea('0x29')]}}]})[_0x93ea('0x21')](function(_0x28db85){if(_0x28db85){var _0x19fd9b=[];for(var _0xa024c3=0x0,_0x535d98;_0xa024c3<_0x28db85[_0x93ea('0x3c')];_0xa024c3+=0x1){_0x535d98=_0x28db85[_0xa024c3][_0x93ea('0x3d')]({'plain':!![]});switch(_0x535d98['dialCheckDuplicateType']){case _0x93ea('0x3e'):_0x5f2888(_0x535d98)[_0x93ea('0x2c')](_0x3bd785());break;case _0x93ea('0x3f'):_0xf45c48(_0x535d98)[_0x93ea('0x2c')](_0x3bd785());break;default:_0x1dca5e[_0x93ea('0x26')][_0x93ea('0x28')]({'phone':_0x12f1bc[_0x93ea('0xe')],'ContactId':_0x12f1bc['id'],'ListId':_0x12f1bc[_0x93ea('0x29')],'scheduledat':_0x12f1bc[_0x93ea('0x1c')]?_0x12f1bc[_0x93ea('0x1c')]:moment()[_0x93ea('0x1d')](_0x93ea('0x1e')),'priority':_0x12f1bc[_0x93ea('0x2a')]?_0x12f1bc[_0x93ea('0x2a')]:0x2,'callback':_0x12f1bc[_0x93ea('0x2b')]?!![]:![],'callbackuniqueid':_0x12f1bc[_0x93ea('0x2b')]?_0x12f1bc[_0x93ea('0x2b')]:undefined,'callbackat':_0x12f1bc[_0x93ea('0x2b')]?moment()[_0x93ea('0x1d')](_0x93ea('0x1e')):undefined,'CampaignId':_0x535d98['id']})['catch'](_0x3bd785());}}}});})[_0x93ea('0x21')](function(){return _0x1dca5e['Campaign'][_0x93ea('0x38')]({'attributes':['id'],'include':[{'model':_0x1dca5e[_0x93ea('0x3a')],'as':_0x93ea('0x44'),'where':{'id':_0x12f1bc['ListId']}}]})['then'](function(_0x152bd5){if(_0x152bd5){var _0x53b394=[];for(var _0x2e779f=0x0,_0x3257f2;_0x2e779f<_0x152bd5['length'];_0x2e779f+=0x1){_0x3257f2=_0x152bd5[_0x2e779f][_0x93ea('0x3d')]({'plain':!![]});_0x1dca5e['CmHopperBlack'][_0x93ea('0x28')]({'phone':_0x12f1bc[_0x93ea('0xe')],'ContactId':_0x12f1bc['id'],'ListId':_0x12f1bc[_0x93ea('0x29')],'CampaignId':_0x3257f2['id']})['catch'](function(_0x183508){logger['error'](_0x93ea('0x41'),'afterCreate',_0x183508[_0x93ea('0x42')]);});}}});})[_0x93ea('0x21')](function(){_0x1e2ec6();})[_0x93ea('0x2c')](function(_0x9484e5){logger[_0x93ea('0x19')]('cmContact,\x20%s,\x20%s','afterCreate',_0x9484e5['message']);_0x1e2ec6(_0x9484e5);});}else{_0x1e2ec6(new Error(_0x93ea('0x45')));}},'afterDestroy':function(_0x42cb89,_0xecddc3,_0x11523f){var _0x100031=_0x153f27[_0x93ea('0x18')];var _0x2f7e67=_0x42cb89[_0x93ea('0x3d')]({'plain':!![]});return _0x100031[_0x93ea('0x26')][_0x93ea('0x38')]({'raw':!![],'where':{'ListId':_0x2f7e67[_0x93ea('0x29')],'ContactId':_0x2f7e67['id']}})[_0x93ea('0x21')](function(_0x20e479){if(!_[_0x93ea('0x46')](_0x20e479)){var _0x4e336f=[];for(var _0x2fbfe5=0x0;_0x2fbfe5<_0x20e479['length'];_0x2fbfe5+=0x1){var _0x411181=_0x100031[_0x93ea('0x26')][_0x93ea('0x47')]({'where':{'ListId':_0x20e479[_0x2fbfe5][_0x93ea('0x29')],'ContactId':_0x20e479[_0x2fbfe5]['ContactId'],'VoiceQueueId':_0x20e479[_0x2fbfe5]['VoiceQueueId'],'CampaignId':_0x20e479[_0x2fbfe5][_0x93ea('0x48')]}});_0x4e336f[_0x93ea('0x49')](_0x411181);}return BPromise[_0x93ea('0x4a')](_0x4e336f);}})['then'](function(_0x60575c){logger[_0x93ea('0x4b')](_0x93ea('0x4c'),util[_0x93ea('0x1b')](_0x60575c,{'showHidden':![],'depth':null}));_0x11523f();})[_0x93ea('0x2c')](function(_0x1f9fc4){logger[_0x93ea('0x19')](_0x93ea('0x4d'),util[_0x93ea('0x1b')](_0x1f9fc4,{'showHidden':![],'depth':null}));_0x11523f(_0x1f9fc4);});}}});}; \ No newline at end of file +var _0x54d8=['phone','fti_cm_contacts','lastName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','inspect','scheduledat','format','VoiceQueue','findOne','then','isNil','timezones','dialTimezone','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','catch','Campaign','add','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','always','onlyIfOpen','BlackLists','length','CmHopperBlack','afterCreate','dialCheckDuplicateType','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','CampaignId','all','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmContact.attributes','CmContact','cm_contacts'];(function(_0xe64ec5,_0x50ddd4){var _0x2cc3fc=function(_0x2d0500){while(--_0x2d0500){_0xe64ec5['push'](_0xe64ec5['shift']());}};_0x2cc3fc(++_0x50ddd4);}(_0x54d8,0xcb));var _0x854d=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x54d8[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x854d('0x0'));var util=require(_0x854d('0x1'));var logger=require(_0x854d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x854d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x854d('0x4'));var rimraf=require(_0x854d('0x5'));var config=require(_0x854d('0x6'));var shared=require('../../config/environment/shared');var attributes=require(_0x854d('0x7'));module['exports']=function(_0x3c1d34,_0x5266bc){return _0x3c1d34['define'](_0x854d('0x8'),attributes,{'tableName':_0x854d('0x9'),'paranoid':!![],'indexes':[{'name':_0x854d('0xa'),'fields':[_0x854d('0xa')]},{'name':_0x854d('0xb'),'fields':['firstName',_0x854d('0xc'),_0x854d('0xa'),_0x854d('0xd'),'fax',_0x854d('0xe')],'type':_0x854d('0xf')}],'timestamps':!![],'charset':_0x854d('0x10'),'collate':_0x854d('0x11'),'hooks':{'afterCreate':function(_0x5c810b,_0x51aa90,_0x4c76cc){var _0x235c34=_0x3c1d34[_0x854d('0x12')];var _0x28b201=_0x5c810b[_0x854d('0x13')]({'plain':!![]});function _0x20e887(){return function(_0x42d422){logger[_0x854d('0x14')](_0x854d('0x15'),'afterCreate',util[_0x854d('0x16')](_0x42d422,{'showHidden':![],'depth':null}));};}function _0x4eb957(_0x2554a0,_0x4c2167){var _0x208b69=_0x4c2167[_0x854d('0x17')]?_0x4c2167[_0x854d('0x17')]:moment()[_0x854d('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x530e73,_0x3921ef){if(_['isNil'](_0x4c2167['dialTimezone'])){_0x530e73({'ret':_0x208b69});}else{_0x235c34[_0x854d('0x19')][_0x854d('0x1a')]({'where':{'id':_0x2554a0['id']}})[_0x854d('0x1b')](function(_0x2a0884){if(!_[_0x854d('0x1c')](_0x2a0884)){var _0x5f2cf9=_0x2a0884['dialTimezone'];if(!_[_0x854d('0x1c')](_0x5f2cf9)){var _0x2f64a0=shared[_0x854d('0x1d')];var _0x31c77c=_0x2f64a0[_0x5f2cf9];var _0x3c39b1=_0x2f64a0[_0x4c2167[_0x854d('0x1e')]];if(!_[_0x854d('0x1c')](_0x31c77c)&&!_['isNil'](_0x3c39b1)){var _0x2ba039=_0x31c77c[_0x854d('0x1f')]-_0x3c39b1[_0x854d('0x1f')];_0x208b69=_0x4c2167[_0x854d('0x17')]?_0x4c2167[_0x854d('0x17')]:moment();var _0xa2a651=moment(_0x208b69)['add'](_0x2ba039,_0x854d('0x20'));_0x530e73({'ret':_0xa2a651['format'](_0x854d('0x21'))});}else _0x530e73({'ret':_0x208b69});}else _0x530e73({'ret':_0x208b69});}else{_0x530e73({'ret':_0x208b69});}});}});return 0xa;}var _0x489e4d=function(_0xfecc8b){return new BPromise(function(_0x30f032,_0x48e4c9){_0x4eb957(_0xfecc8b,_0x28b201)[_0x854d('0x1b')](function(_0x263691){_0x28b201[_0x854d('0x17')]=_0x263691['ret'];_0x235c34['CmHopper']['findOne']({'where':{'phone':_0x28b201[_0x854d('0xa')],'VoiceQueueId':_0xfecc8b['id']}})[_0x854d('0x1b')](function(_0x3d8ddf){if(!_[_0x854d('0x1c')](_0x3d8ddf)){throw new Error('cmContact,\x20afterCreate\x20'+_0x28b201['phone']+_0x854d('0x22')+_0xfecc8b['id']);}return _0x235c34[_0x854d('0x23')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201['ListId'],'priority':_0x28b201[_0x854d('0x25')]?_0x28b201[_0x854d('0x25')]:0x2,'scheduledat':_0x28b201['scheduledat']?_0x28b201[_0x854d('0x17')]:moment()[_0x854d('0x18')](_0x854d('0x21')),'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201[_0x854d('0x26')]?_0x28b201[_0x854d('0x26')]:undefined,'callbackat':_0x28b201['callbackUniqueid']?moment()[_0x854d('0x18')](_0x854d('0x21')):undefined,'VoiceQueueId':_0xfecc8b['id']});})['catch'](function(_0x5121ec){_0x48e4c9(_0x5121ec);});});});};var _0xd55cc0=function(_0x378da8){return new BPromise(function(_0x1db9ed,_0x42b14a){_0x4eb957(_0x378da8,_0x28b201)[_0x854d('0x1b')](function(_0x3128b3){_0x28b201['scheduledat']=_0x3128b3['ret'];_0x235c34[_0x854d('0x23')][_0x854d('0x1a')]({'where':{'phone':_0x28b201[_0x854d('0xa')],'VoiceQueueId':_0x378da8['id']}})[_0x854d('0x1b')](function(_0x498cd4){if(!_[_0x854d('0x1c')](_0x498cd4)){throw new Error('cmContact,\x20afterCreate\x20'+_0x28b201['phone']+_0x854d('0x27')+_0x378da8['id']);}return _0x235c34[_0x854d('0x28')][_0x854d('0x1a')]({'where':{'calleridnum':_0x28b201[_0x854d('0xa')],'VoiceQueueId':_0x378da8['id']}});})[_0x854d('0x1b')](function(_0x5eb242){if(!_['isNil'](_0x5eb242)){throw new Error(_0x854d('0x29')+_0x28b201['phone']+_0x854d('0x2a')+_0x378da8['id']);}return _0x235c34[_0x854d('0x23')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'priority':_0x28b201[_0x854d('0x25')]?_0x28b201['priority']:0x2,'scheduledat':_0x28b201[_0x854d('0x17')]?_0x28b201[_0x854d('0x17')]:moment()[_0x854d('0x18')](_0x854d('0x21')),'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201[_0x854d('0x26')]?_0x28b201[_0x854d('0x26')]:undefined,'callbackat':_0x28b201[_0x854d('0x26')]?moment()[_0x854d('0x18')](_0x854d('0x21')):undefined,'VoiceQueueId':_0x378da8['id']});})[_0x854d('0x2c')](function(_0x2f3688){_0x42b14a(_0x2f3688);});});});};function _0x451625(){return function(_0x3eac7c){logger[_0x854d('0x14')]('cmContact','afterCreate',util[_0x854d('0x16')](_0x3eac7c,{'showHidden':![],'depth':null}));};}function _0x410fa3(_0x12a3b7,_0x3f3248){var _0x27a435=_0x3f3248[_0x854d('0x17')]?_0x3f3248[_0x854d('0x17')]:moment()['format'](_0x854d('0x21'));return new BPromise(function(_0x3751ff,_0x3f3c7b){if(_[_0x854d('0x1c')](_0x3f3248[_0x854d('0x1e')])){_0x3751ff({'ret':_0x27a435});}else{_0x235c34[_0x854d('0x2d')][_0x854d('0x1a')]({'where':{'id':_0x12a3b7['id']}})[_0x854d('0x1b')](function(_0x3e91f6){if(!_[_0x854d('0x1c')](_0x3e91f6)){var _0x186653=_0x3e91f6[_0x854d('0x1e')];if(!_[_0x854d('0x1c')](_0x186653)){var _0x551a3d=shared[_0x854d('0x1d')];var _0x1a7df6=_0x551a3d[_0x186653];var _0x48ddc5=_0x551a3d[_0x3f3248[_0x854d('0x1e')]];if(!_[_0x854d('0x1c')](_0x1a7df6)&&!_[_0x854d('0x1c')](_0x48ddc5)){var _0x1f92aa=_0x1a7df6['utcOffset']-_0x48ddc5[_0x854d('0x1f')];_0x27a435=_0x3f3248[_0x854d('0x17')]?_0x3f3248[_0x854d('0x17')]:moment();var _0x598e95=moment(_0x27a435)[_0x854d('0x2e')](_0x1f92aa,_0x854d('0x20'));_0x3751ff({'ret':_0x598e95[_0x854d('0x18')](_0x854d('0x21'))});}else _0x3751ff({'ret':_0x27a435});}else _0x3751ff({'ret':_0x27a435});}else{_0x3751ff({'ret':_0x27a435});}});}});return 0xa;}var _0x105199=function(_0x266545){return new BPromise(function(_0xf2d73c,_0x42bc54){_0x410fa3(_0x266545,_0x28b201)['then'](function(_0x3ec4f4){_0x28b201[_0x854d('0x17')]=_0x3ec4f4[_0x854d('0x2f')];_0x235c34[_0x854d('0x23')][_0x854d('0x1a')]({'where':{'phone':_0x28b201['phone'],'CampaignId':_0x266545['id']}})[_0x854d('0x1b')](function(_0x3fb0e7){if(!_['isNil'](_0x3fb0e7)){throw new Error('cmContact,\x20afterCreate\x20'+_0x28b201[_0x854d('0xa')]+_0x854d('0x30')+_0x266545['id']);}return _0x235c34[_0x854d('0x23')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'priority':_0x28b201['priority']?_0x28b201[_0x854d('0x25')]:0x2,'scheduledat':_0x28b201[_0x854d('0x17')]?_0x28b201[_0x854d('0x17')]:moment()['format'](_0x854d('0x21')),'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201[_0x854d('0x26')]?_0x28b201['callbackUniqueid']:undefined,'callbackat':_0x28b201[_0x854d('0x26')]?moment()[_0x854d('0x18')](_0x854d('0x21')):undefined,'CampaignId':_0x266545['id']});})['catch'](function(_0x31d926){_0x42bc54(_0x31d926);});});});};var _0x5a8131=function(_0x5dc957){return new BPromise(function(_0x5c7a2e,_0x3466a2){_0x410fa3(_0x5dc957,_0x28b201)[_0x854d('0x1b')](function(_0x237ba7){_0x28b201[_0x854d('0x17')]=_0x237ba7[_0x854d('0x2f')];_0x235c34[_0x854d('0x23')][_0x854d('0x1a')]({'where':{'phone':_0x28b201['phone'],'CampaignId':_0x5dc957['id']}})[_0x854d('0x1b')](function(_0x3291ff){if(!_[_0x854d('0x1c')](_0x3291ff)){throw new Error(_0x854d('0x31')+_0x28b201['phone']+_0x854d('0x32')+_0x5dc957['id']);}return _0x235c34[_0x854d('0x28')]['findOne']({'where':{'calleridnum':_0x28b201['phone'],'CampaignId':_0x5dc957['id']}});})[_0x854d('0x1b')](function(_0x184939){if(!_[_0x854d('0x1c')](_0x184939)){throw new Error(_0x854d('0x29')+_0x28b201[_0x854d('0xa')]+_0x854d('0x33')+_0x5dc957['id']);}return _0x235c34[_0x854d('0x23')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'priority':_0x28b201[_0x854d('0x25')]?_0x28b201[_0x854d('0x25')]:0x2,'scheduledat':_0x28b201[_0x854d('0x17')]?_0x28b201[_0x854d('0x17')]:moment()[_0x854d('0x18')](_0x854d('0x21')),'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201['callbackUniqueid']?_0x28b201[_0x854d('0x26')]:undefined,'callbackat':_0x28b201['callbackUniqueid']?moment()[_0x854d('0x18')](_0x854d('0x21')):undefined,'CampaignId':_0x5dc957['id']});})['catch'](function(_0x4ba2b6){_0x3466a2(_0x4ba2b6);});});});};if(_0x28b201[_0x854d('0x2b')]){_0x235c34[_0x854d('0x19')][_0x854d('0x34')]({'where':{'type':_0x854d('0x35')},'attributes':['id','dialCheckDuplicateType',_0x854d('0x1e')],'include':[{'model':_0x235c34[_0x854d('0x36')],'as':_0x854d('0x37'),'where':{'id':_0x28b201[_0x854d('0x2b')]}}]})[_0x854d('0x1b')](function(_0xffe18a){if(_0xffe18a){var _0x343fde=[];for(var _0xf7ed3=0x0,_0x4867c7;_0xf7ed3<_0xffe18a['length'];_0xf7ed3+=0x1){_0x4867c7=_0xffe18a[_0xf7ed3][_0x854d('0x13')]({'plain':!![]});switch(_0x4867c7['dialCheckDuplicateType']){case _0x854d('0x38'):_0xd55cc0(_0x4867c7)[_0x854d('0x2c')](_0x20e887());break;case _0x854d('0x39'):_0x489e4d(_0x4867c7)['catch'](_0x20e887());break;default:_0x410fa3(_0x4867c7,_0x28b201)[_0x854d('0x1b')](function(_0x2f1dec){_0x28b201['scheduledat']=_0x2f1dec[_0x854d('0x2f')];_0x235c34[_0x854d('0x23')]['create']({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'scheduledat':_0x28b201['scheduledat']?_0x28b201[_0x854d('0x17')]:moment()[_0x854d('0x18')](_0x854d('0x21')),'priority':_0x28b201[_0x854d('0x25')]?_0x28b201[_0x854d('0x25')]:0x2,'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201['callbackUniqueid']?_0x28b201[_0x854d('0x26')]:undefined,'callbackat':_0x28b201[_0x854d('0x26')]?moment()[_0x854d('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4867c7['id']})[_0x854d('0x2c')](_0x20e887());});}}}})[_0x854d('0x1b')](function(){return _0x235c34['VoiceQueue'][_0x854d('0x34')]({'where':{'type':_0x854d('0x35')},'attributes':['id'],'include':[{'model':_0x235c34[_0x854d('0x36')],'as':_0x854d('0x3a'),'where':{'id':_0x28b201[_0x854d('0x2b')]}}]})[_0x854d('0x1b')](function(_0x2d0792){if(_0x2d0792){var _0x3fe501=[];for(var _0x5e3fb6=0x0,_0x3c8e36;_0x5e3fb6<_0x2d0792[_0x854d('0x3b')];_0x5e3fb6+=0x1){_0x3c8e36=_0x2d0792[_0x5e3fb6][_0x854d('0x13')]({'plain':!![]});_0x235c34[_0x854d('0x3c')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'VoiceQueueId':_0x3c8e36['id']})[_0x854d('0x2c')](function(_0x1c9e49){logger[_0x854d('0x14')]('cmContact,\x20%s,\x20%s',_0x854d('0x3d'),_0x1c9e49['message']);});}}});})[_0x854d('0x1b')](function(){return _0x235c34[_0x854d('0x2d')]['findAll']({'attributes':['id',_0x854d('0x3e'),_0x854d('0x1e')],'include':[{'model':_0x235c34[_0x854d('0x36')],'as':'Lists','where':{'id':_0x28b201[_0x854d('0x2b')]}}]})['then'](function(_0x1abf33){if(_0x1abf33){var _0x2c894d=[];for(var _0x35e4ee=0x0,_0x61d631;_0x35e4ee<_0x1abf33['length'];_0x35e4ee+=0x1){_0x61d631=_0x1abf33[_0x35e4ee][_0x854d('0x13')]({'plain':!![]});switch(_0x61d631[_0x854d('0x3e')]){case _0x854d('0x38'):_0x5a8131(_0x61d631)[_0x854d('0x2c')](_0x451625());break;case _0x854d('0x39'):_0x105199(_0x61d631)['catch'](_0x451625());break;default:_0x235c34['CmHopper'][_0x854d('0x24')]({'phone':_0x28b201['phone'],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'scheduledat':_0x28b201[_0x854d('0x17')]?_0x28b201[_0x854d('0x17')]:moment()[_0x854d('0x18')](_0x854d('0x21')),'priority':_0x28b201[_0x854d('0x25')]?_0x28b201[_0x854d('0x25')]:0x2,'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201[_0x854d('0x26')]?_0x28b201[_0x854d('0x26')]:undefined,'callbackat':_0x28b201[_0x854d('0x26')]?moment()[_0x854d('0x18')](_0x854d('0x21')):undefined,'CampaignId':_0x61d631['id']})[_0x854d('0x2c')](_0x451625());}}}});})[_0x854d('0x1b')](function(){return _0x235c34[_0x854d('0x2d')][_0x854d('0x34')]({'attributes':['id'],'include':[{'model':_0x235c34[_0x854d('0x36')],'as':'BlackLists','where':{'id':_0x28b201[_0x854d('0x2b')]}}]})[_0x854d('0x1b')](function(_0x530e3f){if(_0x530e3f){var _0x421571=[];for(var _0x156c28=0x0,_0x4fdaec;_0x156c28<_0x530e3f['length'];_0x156c28+=0x1){_0x4fdaec=_0x530e3f[_0x156c28][_0x854d('0x13')]({'plain':!![]});_0x235c34[_0x854d('0x3c')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201['ListId'],'CampaignId':_0x4fdaec['id']})[_0x854d('0x2c')](function(_0x2cd4a3){logger[_0x854d('0x14')](_0x854d('0x3f'),_0x854d('0x3d'),_0x2cd4a3['message']);});}}});})[_0x854d('0x1b')](function(){_0x4c76cc();})[_0x854d('0x2c')](function(_0x48a1bd){logger[_0x854d('0x14')](_0x854d('0x3f'),'afterCreate',_0x48a1bd[_0x854d('0x40')]);_0x4c76cc(_0x48a1bd);});}else{_0x4c76cc(new Error(_0x854d('0x41')));}},'afterDestroy':function(_0x3d5e66,_0x547215,_0x12a427){var _0x3a5a2d=_0x3c1d34['models'];var _0x523042=_0x3d5e66[_0x854d('0x13')]({'plain':!![]});return _0x3a5a2d[_0x854d('0x23')][_0x854d('0x34')]({'raw':!![],'where':{'ListId':_0x523042[_0x854d('0x2b')],'ContactId':_0x523042['id']}})[_0x854d('0x1b')](function(_0x3fb297){if(!_[_0x854d('0x42')](_0x3fb297)){var _0x55fb0b=[];for(var _0x4191d3=0x0;_0x4191d3<_0x3fb297[_0x854d('0x3b')];_0x4191d3+=0x1){var _0x23dcec=_0x3a5a2d[_0x854d('0x23')][_0x854d('0x43')]({'where':{'ListId':_0x3fb297[_0x4191d3][_0x854d('0x2b')],'ContactId':_0x3fb297[_0x4191d3][_0x854d('0x44')],'VoiceQueueId':_0x3fb297[_0x4191d3]['VoiceQueueId'],'CampaignId':_0x3fb297[_0x4191d3][_0x854d('0x45')]}});_0x55fb0b['push'](_0x23dcec);}return BPromise[_0x854d('0x46')](_0x55fb0b);}})[_0x854d('0x1b')](function(_0x5809b0){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x854d('0x16')](_0x5809b0,{'showHidden':![],'depth':null}));_0x12a427();})[_0x854d('0x2c')](function(_0xc7378e){logger[_0x854d('0x14')]('[CmContact][afterDestroy][Error]',util[_0x854d('0x16')](_0xc7378e,{'showHidden':![],'depth':null}));_0x12a427(_0xc7378e);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 3cad436..fb99be9 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x4bca59,_0x5b1efe){var _0x45d3c9=function(_0x43ef11){while(--_0x43ef11){_0x4bca59['push'](_0x4bca59['shift']());}};_0x45d3c9(++_0x5b1efe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 baabc87..dfadfd2 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a9a=['STRING','INTEGER','PHONE','exports'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x0a9a,0x183));var _0xa0a9=function(_0x321f95,_0x1be6cf){_0x321f95=_0x321f95-0x0;var _0x32a51e=_0x0a9a[_0x321f95];return _0x32a51e;};'use strict';var Sequelize=require('sequelize');module[_0xa0a9('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xa0a9('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa0a9('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa0a9('0x1')],'defaultValue':_0xa0a9('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xa0a9('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xe3ed=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe3ed,0x8d));var _0xde3e=function(_0x13a0fa,_0xb3398d){_0x13a0fa=_0x13a0fa-0x0;var _0x5a3888=_0xe3ed[_0x13a0fa];return _0x5a3888;};'use strict';var Sequelize=require(_0xde3e('0x0'));module[_0xde3e('0x1')]={'CmContactId':{'type':Sequelize[_0xde3e('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xde3e('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xde3e('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xde3e('0x3')],'defaultValue':_0xde3e('0x4')},'OrderBy':{'type':Sequelize[_0xde3e('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 60f2d3d..2187581 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 _0x5128=['keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','body','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','map','CmContactHasItem','rawAttributes','type','key','model','query'];(function(_0x58c8ae,_0x20dff2){var _0xadbae2=function(_0x5a102a){while(--_0x5a102a){_0x58c8ae['push'](_0x58c8ae['shift']());}};_0xadbae2(++_0x20dff2);}(_0x5128,0xfc));var _0x8512=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5128[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x8512('0x0'));var rimraf=require(_0x8512('0x1'));var zipdir=require(_0x8512('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8512('0x3'));var Mustache=require('mustache');var util=require(_0x8512('0x4'));var path=require('path');var sox=require(_0x8512('0x5'));var csv=require(_0x8512('0x6'));var ejs=require(_0x8512('0x7'));var fs=require('fs');var fs_extra=require(_0x8512('0x8'));var _=require(_0x8512('0x9'));var squel=require(_0x8512('0xa'));var crypto=require(_0x8512('0xb'));var jsforce=require(_0x8512('0xc'));var deskjs=require(_0x8512('0xd'));var toCsv=require(_0x8512('0x6'));var querystring=require('querystring');var Papa=require(_0x8512('0xe'));var Redis=require('ioredis');var authService=require(_0x8512('0xf'));var qs=require(_0x8512('0x10'));var as=require(_0x8512('0x11'));var hardwareService=require(_0x8512('0x12'));var logger=require(_0x8512('0x13'))(_0x8512('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaf2f68,_0xc94ec5){_0xc94ec5=_0xc94ec5||0xcc;return function(_0x101247){if(_0x101247){return _0xaf2f68['sendStatus'](_0xc94ec5);}return _0xaf2f68[_0x8512('0x15')](_0xc94ec5)['end']();};}function respondWithResult(_0x4dc757,_0x59dbdf){_0x59dbdf=_0x59dbdf||0xc8;return function(_0x55e8ae){if(_0x55e8ae){return _0x4dc757[_0x8512('0x15')](_0x59dbdf)['json'](_0x55e8ae);}};}function respondWithFilteredResult(_0x582ad1,_0x398d82){return function(_0x32e431){if(_0x32e431){var _0x24007b=typeof _0x398d82[_0x8512('0x16')]===_0x8512('0x17')&&typeof _0x398d82[_0x8512('0x18')]===_0x8512('0x17');var _0x10ba4f=_0x32e431[_0x8512('0x19')];var _0x44c0cd=_0x24007b?0x0:_0x398d82['offset'];var _0x13cb82=_0x24007b?_0x32e431[_0x8512('0x19')]:_0x398d82[_0x8512('0x16')]+_0x398d82['limit'];var _0x36e544;if(_0x13cb82>=_0x10ba4f){_0x13cb82=_0x10ba4f;_0x36e544=0xc8;}else{_0x36e544=0xce;}_0x582ad1[_0x8512('0x15')](_0x36e544);return _0x582ad1[_0x8512('0x1a')](_0x8512('0x1b'),_0x44c0cd+'-'+_0x13cb82+'/'+_0x10ba4f)['json'](_0x32e431);}return null;};}function patchUpdates(_0x9d3701){return function(_0x49390f){try{jsonpatch[_0x8512('0x1c')](_0x49390f,_0x9d3701,!![]);}catch(_0x29f18d){return BPromise['reject'](_0x29f18d);}return _0x49390f[_0x8512('0x1d')]();};}function saveUpdates(_0x1a99e0,_0x2412e7){return function(_0x7a3d29){if(_0x7a3d29){return _0x7a3d29[_0x8512('0x1e')](_0x1a99e0)[_0x8512('0x1f')](function(_0x3e4d6f){return _0x3e4d6f;});}return null;};}function removeEntity(_0x45586c,_0x59c808){return function(_0x221c5d){if(_0x221c5d){return _0x221c5d[_0x8512('0x20')]()[_0x8512('0x1f')](function(){var _0x15b913=_0x221c5d[_0x8512('0x21')]({'plain':!![]});var _0x562740=_0x8512('0x22');return db[_0x8512('0x23')][_0x8512('0x20')]({'where':{'type':_0x562740,'resourceId':_0x15b913['id']}})[_0x8512('0x1f')](function(){return _0x221c5d;});})['then'](function(){_0x45586c[_0x8512('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bee18,_0x2f212f){return function(_0x35d2be){if(!_0x35d2be){_0x5bee18[_0x8512('0x24')](0x194);}return _0x35d2be;};}function handleError(_0x4deb8c,_0xfb135){_0xfb135=_0xfb135||0x1f4;return function(_0x3694d1){logger[_0x8512('0x25')](_0x3694d1[_0x8512('0x26')]);if(_0x3694d1[_0x8512('0x27')]){delete _0x3694d1[_0x8512('0x27')];}_0x4deb8c[_0x8512('0x15')](_0xfb135)[_0x8512('0x28')](_0x3694d1);};}exports['index']=function(_0x4a070e,_0x107edd){var _0x1bf77f={},_0x146957={},_0x1e9ca7={'count':0x0,'rows':[]};var _0x1a93bd=_[_0x8512('0x29')](db[_0x8512('0x2a')][_0x8512('0x2b')],function(_0x1b7ec3){return{'name':_0x1b7ec3['fieldName'],'type':_0x1b7ec3[_0x8512('0x2c')][_0x8512('0x2d')]};});_0x146957[_0x8512('0x2e')]=_[_0x8512('0x29')](_0x1a93bd,_0x8512('0x27'));_0x146957[_0x8512('0x2f')]=_[_0x8512('0x30')](_0x4a070e[_0x8512('0x2f')]);_0x146957[_0x8512('0x31')]=_['intersection'](_0x146957[_0x8512('0x2e')],_0x146957[_0x8512('0x2f')]);_0x1bf77f[_0x8512('0x32')]=_[_0x8512('0x33')](_0x146957[_0x8512('0x2e')],qs[_0x8512('0x34')](_0x4a070e['query'][_0x8512('0x34')]));_0x1bf77f[_0x8512('0x32')]=_0x1bf77f['attributes'][_0x8512('0x35')]?_0x1bf77f[_0x8512('0x32')]:_0x146957[_0x8512('0x2e')];if(!_0x4a070e['query']['hasOwnProperty'](_0x8512('0x36'))){_0x1bf77f[_0x8512('0x18')]=qs[_0x8512('0x18')](_0x4a070e[_0x8512('0x2f')][_0x8512('0x18')]);_0x1bf77f['offset']=qs[_0x8512('0x16')](_0x4a070e[_0x8512('0x2f')][_0x8512('0x16')]);}_0x1bf77f[_0x8512('0x37')]=qs[_0x8512('0x38')](_0x4a070e[_0x8512('0x2f')][_0x8512('0x38')]);_0x1bf77f[_0x8512('0x39')]=qs[_0x8512('0x31')](_[_0x8512('0x3a')](_0x4a070e[_0x8512('0x2f')],_0x146957[_0x8512('0x31')]),_0x1a93bd);if(_0x4a070e[_0x8512('0x2f')][_0x8512('0x3b')]){_0x1bf77f['where']=_[_0x8512('0x3c')](_0x1bf77f['where'],{'$or':_['map'](_0x1a93bd,function(_0x3004af){if(_0x3004af[_0x8512('0x2c')]!==_0x8512('0x3d')){var _0x2c28fb={};_0x2c28fb[_0x3004af[_0x8512('0x27')]]={'$like':'%'+_0x4a070e[_0x8512('0x2f')][_0x8512('0x3b')]+'%'};return _0x2c28fb;}})});}_0x1bf77f=_[_0x8512('0x3c')]({},_0x1bf77f,_0x4a070e[_0x8512('0x3e')]);var _0x492e4f={'where':_0x1bf77f[_0x8512('0x39')]};return db['CmContactHasItem'][_0x8512('0x19')](_0x492e4f)[_0x8512('0x1f')](function(_0x26787c){_0x1e9ca7['count']=_0x26787c;if(_0x4a070e[_0x8512('0x2f')][_0x8512('0x3f')]){_0x1bf77f[_0x8512('0x40')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x8512('0x41')](_0x1bf77f);})[_0x8512('0x1f')](function(_0x4cb6fe){_0x1e9ca7['rows']=_0x4cb6fe;return _0x1e9ca7;})[_0x8512('0x1f')](respondWithFilteredResult(_0x107edd,_0x1bf77f))['catch'](handleError(_0x107edd,null));};exports[_0x8512('0x42')]=function(_0x5f4165,_0x55e9c4){var _0x4abe62={'raw':!![],'where':{'id':_0x5f4165[_0x8512('0x43')]['id']}},_0x2e3920={};_0x2e3920['model']=_['keys'](db['CmContactHasItem'][_0x8512('0x2b')]);_0x2e3920['query']=_['keys'](_0x5f4165[_0x8512('0x2f')]);_0x2e3920[_0x8512('0x31')]=_[_0x8512('0x33')](_0x2e3920[_0x8512('0x2e')],_0x2e3920[_0x8512('0x2f')]);_0x4abe62[_0x8512('0x32')]=_[_0x8512('0x33')](_0x2e3920[_0x8512('0x2e')],qs[_0x8512('0x34')](_0x5f4165['query'][_0x8512('0x34')]));_0x4abe62[_0x8512('0x32')]=_0x4abe62[_0x8512('0x32')]['length']?_0x4abe62[_0x8512('0x32')]:_0x2e3920[_0x8512('0x2e')];if(_0x5f4165[_0x8512('0x2f')][_0x8512('0x3f')]){_0x4abe62[_0x8512('0x40')]=[{'all':!![]}];}_0x4abe62=_[_0x8512('0x3c')]({},_0x4abe62,_0x5f4165[_0x8512('0x3e')]);return db[_0x8512('0x2a')]['find'](_0x4abe62)[_0x8512('0x1f')](handleEntityNotFound(_0x55e9c4,null))[_0x8512('0x1f')](respondWithResult(_0x55e9c4,null))[_0x8512('0x44')](handleError(_0x55e9c4,null));};exports['create']=function(_0x3b0870,_0x1c0409){return db[_0x8512('0x2a')]['create'](_0x3b0870[_0x8512('0x45')],{})[_0x8512('0x1f')](function(_0x33d8ec){var _0x484256=_0x3b0870[_0x8512('0x46')]['get']({'plain':!![]});if(!_0x484256)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x484256['role']===_0x8512('0x46')){var _0x1d44ee=_0x33d8ec[_0x8512('0x21')]({'plain':!![]});var _0x45deb4=_0x8512('0x22');return db[_0x8512('0x47')][_0x8512('0x48')]({'where':{'name':_0x45deb4,'userProfileId':_0x484256[_0x8512('0x49')]},'raw':!![]})['then'](function(_0x19a85c){if(_0x19a85c&&_0x19a85c['autoAssociation']===0x0){return db[_0x8512('0x23')]['create']({'name':_0x1d44ee[_0x8512('0x27')],'resourceId':_0x1d44ee['id'],'type':_0x19a85c[_0x8512('0x27')],'sectionId':_0x19a85c['id']},{})['then'](function(){return _0x33d8ec;});}else{return _0x33d8ec;}})[_0x8512('0x44')](function(_0x59c630){logger[_0x8512('0x25')](_0x8512('0x4a'),_0x59c630);throw _0x59c630;});}return _0x33d8ec;})['then'](respondWithResult(_0x1c0409,0xc9))[_0x8512('0x44')](handleError(_0x1c0409,null));};exports[_0x8512('0x1e')]=function(_0x512048,_0x4ae201){if(_0x512048[_0x8512('0x45')]['id']){delete _0x512048[_0x8512('0x45')]['id'];}return db['CmContactHasItem'][_0x8512('0x48')]({'where':{'id':_0x512048['params']['id']}})['then'](handleEntityNotFound(_0x4ae201,null))[_0x8512('0x1f')](saveUpdates(_0x512048[_0x8512('0x45')],null))[_0x8512('0x1f')](respondWithResult(_0x4ae201,null))['catch'](handleError(_0x4ae201,null));};exports[_0x8512('0x20')]=function(_0x219718,_0x21ec8a){return db[_0x8512('0x2a')][_0x8512('0x48')]({'where':{'id':_0x219718[_0x8512('0x43')]['id']}})['then'](handleEntityNotFound(_0x21ec8a,null))[_0x8512('0x1f')](removeEntity(_0x21ec8a,null))[_0x8512('0x44')](handleError(_0x21ec8a,null));}; \ No newline at end of file +var _0xcd8a=['findAll','rows','catch','show','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include'];(function(_0xa2ad57,_0x2ed7ec){var _0x4e99d6=function(_0x3f74c6){while(--_0x3f74c6){_0xa2ad57['push'](_0xa2ad57['shift']());}};_0x4e99d6(++_0x2ed7ec);}(_0xcd8a,0x1a8));var _0xacd8=function(_0x466a67,_0x2e9624){_0x466a67=_0x466a67-0x0;var _0x4ceb18=_0xcd8a[_0x466a67];return _0x4ceb18;};'use strict';var emlformat=require(_0xacd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xacd8('0x1'));var jsonpatch=require(_0xacd8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xacd8('0x3'));var Mustache=require(_0xacd8('0x4'));var util=require(_0xacd8('0x5'));var path=require(_0xacd8('0x6'));var sox=require('sox');var csv=require(_0xacd8('0x7'));var ejs=require(_0xacd8('0x8'));var fs=require('fs');var fs_extra=require(_0xacd8('0x9'));var _=require(_0xacd8('0xa'));var squel=require(_0xacd8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xacd8('0xc'));var toCsv=require(_0xacd8('0x7'));var querystring=require('querystring');var Papa=require(_0xacd8('0xd'));var Redis=require('ioredis');var authService=require(_0xacd8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xacd8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacd8('0x10'))(_0xacd8('0x11'));var utils=require(_0xacd8('0x12'));var config=require(_0xacd8('0x13'));var licenseUtil=require(_0xacd8('0x14'));var db=require(_0xacd8('0x15'))['db'];function respondWithStatusCode(_0x306247,_0x343f61){_0x343f61=_0x343f61||0xcc;return function(_0x506d1c){if(_0x506d1c){return _0x306247[_0xacd8('0x16')](_0x343f61);}return _0x306247[_0xacd8('0x17')](_0x343f61)[_0xacd8('0x18')]();};}function respondWithResult(_0x5e319d,_0x2e87b7){_0x2e87b7=_0x2e87b7||0xc8;return function(_0x16c832){if(_0x16c832){return _0x5e319d[_0xacd8('0x17')](_0x2e87b7)[_0xacd8('0x19')](_0x16c832);}};}function respondWithFilteredResult(_0x4c3c64,_0x13a4bf){return function(_0x29729f){if(_0x29729f){var _0x2a6039=typeof _0x13a4bf[_0xacd8('0x1a')]==='undefined'&&typeof _0x13a4bf[_0xacd8('0x1b')]===_0xacd8('0x1c');var _0x5a0105=_0x29729f[_0xacd8('0x1d')];var _0x4678c6=_0x2a6039?0x0:_0x13a4bf[_0xacd8('0x1a')];var _0x30001e=_0x2a6039?_0x29729f[_0xacd8('0x1d')]:_0x13a4bf[_0xacd8('0x1a')]+_0x13a4bf[_0xacd8('0x1b')];var _0x48672f;if(_0x30001e>=_0x5a0105){_0x30001e=_0x5a0105;_0x48672f=0xc8;}else{_0x48672f=0xce;}_0x4c3c64[_0xacd8('0x17')](_0x48672f);return _0x4c3c64[_0xacd8('0x1e')]('Content-Range',_0x4678c6+'-'+_0x30001e+'/'+_0x5a0105)[_0xacd8('0x19')](_0x29729f);}return null;};}function patchUpdates(_0x4e6ce4){return function(_0x53293b){try{jsonpatch['apply'](_0x53293b,_0x4e6ce4,!![]);}catch(_0x306392){return BPromise['reject'](_0x306392);}return _0x53293b[_0xacd8('0x1f')]();};}function saveUpdates(_0xfdc6ce,_0x30c312){return function(_0x108a0b){if(_0x108a0b){return _0x108a0b[_0xacd8('0x20')](_0xfdc6ce)[_0xacd8('0x21')](function(_0x5ac1e2){return _0x5ac1e2;});}return null;};}function removeEntity(_0x1ee815,_0x4ddc5c){return function(_0x2d14e1){if(_0x2d14e1){return _0x2d14e1[_0xacd8('0x22')]()[_0xacd8('0x21')](function(){var _0x4e6a5e=_0x2d14e1['get']({'plain':!![]});var _0x4b6d81=_0xacd8('0x23');return db[_0xacd8('0x24')]['destroy']({'where':{'type':_0x4b6d81,'resourceId':_0x4e6a5e['id']}})[_0xacd8('0x21')](function(){return _0x2d14e1;});})[_0xacd8('0x21')](function(){_0x1ee815[_0xacd8('0x17')](0xcc)[_0xacd8('0x18')]();});}};}function handleEntityNotFound(_0x5c1c6c,_0x3fe28f){return function(_0x1d9d1f){if(!_0x1d9d1f){_0x5c1c6c[_0xacd8('0x16')](0x194);}return _0x1d9d1f;};}function handleError(_0x55f034,_0x160d0b){_0x160d0b=_0x160d0b||0x1f4;return function(_0x1780a1){logger[_0xacd8('0x25')](_0x1780a1[_0xacd8('0x26')]);if(_0x1780a1[_0xacd8('0x27')]){delete _0x1780a1['name'];}_0x55f034[_0xacd8('0x17')](_0x160d0b)[_0xacd8('0x28')](_0x1780a1);};}exports[_0xacd8('0x29')]=function(_0x606f23,_0x3b0057){var _0xe4fae7={},_0x20e7c5={},_0x17c774={'count':0x0,'rows':[]};var _0x513953=_[_0xacd8('0x2a')](db[_0xacd8('0x2b')][_0xacd8('0x2c')],function(_0x409d30){return{'name':_0x409d30[_0xacd8('0x2d')],'type':_0x409d30['type'][_0xacd8('0x2e')]};});_0x20e7c5[_0xacd8('0x2f')]=_['map'](_0x513953,'name');_0x20e7c5[_0xacd8('0x30')]=_[_0xacd8('0x31')](_0x606f23[_0xacd8('0x30')]);_0x20e7c5[_0xacd8('0x32')]=_[_0xacd8('0x33')](_0x20e7c5['model'],_0x20e7c5[_0xacd8('0x30')]);_0xe4fae7[_0xacd8('0x34')]=_[_0xacd8('0x33')](_0x20e7c5['model'],qs[_0xacd8('0x35')](_0x606f23[_0xacd8('0x30')][_0xacd8('0x35')]));_0xe4fae7[_0xacd8('0x34')]=_0xe4fae7[_0xacd8('0x34')][_0xacd8('0x36')]?_0xe4fae7[_0xacd8('0x34')]:_0x20e7c5[_0xacd8('0x2f')];if(!_0x606f23[_0xacd8('0x30')][_0xacd8('0x37')](_0xacd8('0x38'))){_0xe4fae7[_0xacd8('0x1b')]=qs[_0xacd8('0x1b')](_0x606f23[_0xacd8('0x30')][_0xacd8('0x1b')]);_0xe4fae7[_0xacd8('0x1a')]=qs['offset'](_0x606f23[_0xacd8('0x30')][_0xacd8('0x1a')]);}_0xe4fae7[_0xacd8('0x39')]=qs['sort'](_0x606f23[_0xacd8('0x30')][_0xacd8('0x3a')]);_0xe4fae7['where']=qs[_0xacd8('0x32')](_[_0xacd8('0x3b')](_0x606f23['query'],_0x20e7c5[_0xacd8('0x32')]),_0x513953);if(_0x606f23[_0xacd8('0x30')][_0xacd8('0x3c')]){_0xe4fae7[_0xacd8('0x3d')]=_[_0xacd8('0x3e')](_0xe4fae7[_0xacd8('0x3d')],{'$or':_[_0xacd8('0x2a')](_0x513953,function(_0x3dca89){if(_0x3dca89[_0xacd8('0x3f')]!==_0xacd8('0x40')){var _0x495172={};_0x495172[_0x3dca89[_0xacd8('0x27')]]={'$like':'%'+_0x606f23[_0xacd8('0x30')][_0xacd8('0x3c')]+'%'};return _0x495172;}})});}_0xe4fae7=_['merge']({},_0xe4fae7,_0x606f23[_0xacd8('0x41')]);var _0x54e437={'where':_0xe4fae7['where']};return db[_0xacd8('0x2b')][_0xacd8('0x1d')](_0x54e437)[_0xacd8('0x21')](function(_0x5a3711){_0x17c774[_0xacd8('0x1d')]=_0x5a3711;if(_0x606f23[_0xacd8('0x30')][_0xacd8('0x42')]){_0xe4fae7[_0xacd8('0x43')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xacd8('0x44')](_0xe4fae7);})[_0xacd8('0x21')](function(_0x1512fb){_0x17c774[_0xacd8('0x45')]=_0x1512fb;return _0x17c774;})['then'](respondWithFilteredResult(_0x3b0057,_0xe4fae7))[_0xacd8('0x46')](handleError(_0x3b0057,null));};exports[_0xacd8('0x47')]=function(_0x57e741,_0x33162c){var _0x3b4307={'raw':!![],'where':{'id':_0x57e741['params']['id']}},_0x40f223={};_0x40f223[_0xacd8('0x2f')]=_[_0xacd8('0x31')](db['CmContactHasItem'][_0xacd8('0x2c')]);_0x40f223[_0xacd8('0x30')]=_[_0xacd8('0x31')](_0x57e741[_0xacd8('0x30')]);_0x40f223[_0xacd8('0x32')]=_[_0xacd8('0x33')](_0x40f223[_0xacd8('0x2f')],_0x40f223[_0xacd8('0x30')]);_0x3b4307[_0xacd8('0x34')]=_['intersection'](_0x40f223[_0xacd8('0x2f')],qs[_0xacd8('0x35')](_0x57e741['query']['fields']));_0x3b4307[_0xacd8('0x34')]=_0x3b4307[_0xacd8('0x34')][_0xacd8('0x36')]?_0x3b4307['attributes']:_0x40f223['model'];if(_0x57e741[_0xacd8('0x30')]['includeAll']){_0x3b4307[_0xacd8('0x43')]=[{'all':!![]}];}_0x3b4307=_['merge']({},_0x3b4307,_0x57e741[_0xacd8('0x41')]);return db[_0xacd8('0x2b')][_0xacd8('0x48')](_0x3b4307)[_0xacd8('0x21')](handleEntityNotFound(_0x33162c,null))[_0xacd8('0x21')](respondWithResult(_0x33162c,null))['catch'](handleError(_0x33162c,null));};exports['create']=function(_0x51bb3f,_0x4820e8){return db[_0xacd8('0x2b')]['create'](_0x51bb3f[_0xacd8('0x49')],{})[_0xacd8('0x21')](function(_0x366bd0){var _0x28c3a4=_0x51bb3f[_0xacd8('0x4a')][_0xacd8('0x4b')]({'plain':!![]});if(!_0x28c3a4)throw new Error(_0xacd8('0x4c'));if(_0x28c3a4[_0xacd8('0x4d')]===_0xacd8('0x4a')){var _0x2a2486=_0x366bd0[_0xacd8('0x4b')]({'plain':!![]});var _0x1fd2db=_0xacd8('0x23');return db[_0xacd8('0x4e')][_0xacd8('0x48')]({'where':{'name':_0x1fd2db,'userProfileId':_0x28c3a4[_0xacd8('0x4f')]},'raw':!![]})[_0xacd8('0x21')](function(_0x4ddbcd){if(_0x4ddbcd&&_0x4ddbcd['autoAssociation']===0x0){return db[_0xacd8('0x24')][_0xacd8('0x50')]({'name':_0x2a2486[_0xacd8('0x27')],'resourceId':_0x2a2486['id'],'type':_0x4ddbcd[_0xacd8('0x27')],'sectionId':_0x4ddbcd['id']},{})[_0xacd8('0x21')](function(){return _0x366bd0;});}else{return _0x366bd0;}})[_0xacd8('0x46')](function(_0x5967f5){logger[_0xacd8('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5967f5);throw _0x5967f5;});}return _0x366bd0;})[_0xacd8('0x21')](respondWithResult(_0x4820e8,0xc9))[_0xacd8('0x46')](handleError(_0x4820e8,null));};exports[_0xacd8('0x20')]=function(_0x137e43,_0x386d44){if(_0x137e43[_0xacd8('0x49')]['id']){delete _0x137e43[_0xacd8('0x49')]['id'];}return db[_0xacd8('0x2b')][_0xacd8('0x48')]({'where':{'id':_0x137e43[_0xacd8('0x51')]['id']}})[_0xacd8('0x21')](handleEntityNotFound(_0x386d44,null))[_0xacd8('0x21')](saveUpdates(_0x137e43[_0xacd8('0x49')],null))['then'](respondWithResult(_0x386d44,null))[_0xacd8('0x46')](handleError(_0x386d44,null));};exports[_0xacd8('0x22')]=function(_0x45e4be,_0x437bb7){return db[_0xacd8('0x2b')][_0xacd8('0x48')]({'where':{'id':_0x45e4be[_0xacd8('0x51')]['id']}})[_0xacd8('0x21')](handleEntityNotFound(_0x437bb7,null))[_0xacd8('0x21')](removeEntity(_0x437bb7,null))['catch'](handleError(_0x437bb7,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 5a31273..1ee63dc 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 _0x1c0b=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','lodash','util'];(function(_0x5890e0,_0xd23b71){var _0x45823b=function(_0x12bcd4){while(--_0x12bcd4){_0x5890e0['push'](_0x5890e0['shift']());}};_0x45823b(++_0xd23b71);}(_0x1c0b,0x13d));var _0xb1c0=function(_0x26c7fc,_0x359bb3){_0x26c7fc=_0x26c7fc-0x0;var _0x4c6302=_0x1c0b[_0x26c7fc];return _0x4c6302;};'use strict';var _=require(_0xb1c0('0x0'));var util=require(_0xb1c0('0x1'));var logger=require('../../config/logger')(_0xb1c0('0x2'));var moment=require(_0xb1c0('0x3'));var BPromise=require(_0xb1c0('0x4'));var rp=require(_0xb1c0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1c0('0x6'));var config=require(_0xb1c0('0x7'));var attributes=require(_0xb1c0('0x8'));module['exports']=function(_0x4380ef,_0x1da0c0){return _0x4380ef[_0xb1c0('0x9')](_0xb1c0('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb606=['CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x4e354d,_0x2d8b96){var _0x38bdf9=function(_0x4b99d0){while(--_0x4b99d0){_0x4e354d['push'](_0x4e354d['shift']());}};_0x38bdf9(++_0x2d8b96);}(_0xb606,0x14c));var _0x6b60=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb606[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x6b60('0x0'));var util=require(_0x6b60('0x1'));var logger=require(_0x6b60('0x2'))('api');var moment=require(_0x6b60('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b60('0x4'));var fs=require('fs');var path=require(_0x6b60('0x5'));var rimraf=require(_0x6b60('0x6'));var config=require(_0x6b60('0x7'));var attributes=require(_0x6b60('0x8'));module['exports']=function(_0x533fe5,_0x3fc90f){return _0x533fe5['define'](_0x6b60('0x9'),attributes,{'tableName':_0x6b60('0xa'),'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 0ed6184..1295aed 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 _0x43be=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error'];(function(_0x39f66d,_0x330ca0){var _0x224b0a=function(_0x242c18){while(--_0x242c18){_0x39f66d['push'](_0x39f66d['shift']());}};_0x224b0a(++_0x330ca0);}(_0x43be,0x1df));var _0xe43b=function(_0x20e295,_0x308599){_0x20e295=_0x20e295-0x0;var _0x33ffbe=_0x43be[_0x20e295];return _0x33ffbe;};'use strict';var _=require(_0xe43b('0x0'));var util=require(_0xe43b('0x1'));var moment=require(_0xe43b('0x2'));var BPromise=require('bluebird');var rs=require(_0xe43b('0x3'));var fs=require('fs');var Redis=require(_0xe43b('0x4'));var db=require(_0xe43b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe43b('0x6'))(_0xe43b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x397f1e,_0x3b6f27,_0x24cccc){return new BPromise(function(_0xdb125d,_0x38a8f9){return client[_0xe43b('0x8')](_0x397f1e,_0x24cccc)[_0xe43b('0x9')](function(_0x49e99f){logger['info'](_0xe43b('0xa'),_0x3b6f27,_0xe43b('0xb'));logger[_0xe43b('0xc')](_0xe43b('0xd'),_0x3b6f27,_0xe43b('0xb'),JSON['stringify'](_0x49e99f));if(_0x49e99f[_0xe43b('0xe')]){if(_0x49e99f[_0xe43b('0xe')]['code']===0x1f4){logger[_0xe43b('0xe')](_0xe43b('0xa'),_0x3b6f27,_0x49e99f[_0xe43b('0xe')][_0xe43b('0xf')]);return _0x38a8f9(_0x49e99f[_0xe43b('0xe')]['message']);}logger[_0xe43b('0xe')](_0xe43b('0xa'),_0x3b6f27,_0x49e99f[_0xe43b('0xe')][_0xe43b('0xf')]);return _0xdb125d(_0x49e99f[_0xe43b('0xe')][_0xe43b('0xf')]);}else{logger[_0xe43b('0x10')](_0xe43b('0xa'),_0x3b6f27,_0xe43b('0xb'));_0xdb125d(_0x49e99f[_0xe43b('0x11')][_0xe43b('0xf')]);}})[_0xe43b('0x12')](function(_0x19f8fb){logger[_0xe43b('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x3b6f27,_0x19f8fb);_0x38a8f9(_0x19f8fb);});});} \ No newline at end of file +var _0xfb4b=['../../config/environment','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0xfb4b,0x67));var _0xbfb4=function(_0x7ad69b,_0x11ae97){_0x7ad69b=_0x7ad69b-0x0;var _0x5e8d5d=_0xfb4b[_0x7ad69b];return _0x5e8d5d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbfb4('0x0'));var BPromise=require(_0xbfb4('0x1'));var rs=require(_0xbfb4('0x2'));var fs=require('fs');var Redis=require(_0xbfb4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfb4('0x4'));var logger=require(_0xbfb4('0x5'))(_0xbfb4('0x6'));var config=require(_0xbfb4('0x7'));var jayson=require(_0xbfb4('0x8'));var client=jayson[_0xbfb4('0x9')][_0xbfb4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x93d1c9,_0x1be572,_0xb43bef){return new BPromise(function(_0x1feeab,_0x3381f8){return client[_0xbfb4('0xb')](_0x93d1c9,_0xb43bef)['then'](function(_0x342fde){logger[_0xbfb4('0xc')](_0xbfb4('0xd'),_0x1be572,'request\x20sent');logger[_0xbfb4('0xe')](_0xbfb4('0xf'),_0x1be572,_0xbfb4('0x10'),JSON['stringify'](_0x342fde));if(_0x342fde[_0xbfb4('0x11')]){if(_0x342fde[_0xbfb4('0x11')][_0xbfb4('0x12')]===0x1f4){logger[_0xbfb4('0x11')](_0xbfb4('0xd'),_0x1be572,_0x342fde['error'][_0xbfb4('0x13')]);return _0x3381f8(_0x342fde['error'][_0xbfb4('0x13')]);}logger[_0xbfb4('0x11')](_0xbfb4('0xd'),_0x1be572,_0x342fde[_0xbfb4('0x11')][_0xbfb4('0x13')]);return _0x1feeab(_0x342fde[_0xbfb4('0x11')][_0xbfb4('0x13')]);}else{logger[_0xbfb4('0xc')](_0xbfb4('0xd'),_0x1be572,_0xbfb4('0x10'));_0x1feeab(_0x342fde[_0xbfb4('0x14')][_0xbfb4('0x13')]);}})[_0xbfb4('0x15')](function(_0x2464a2){logger['error'](_0xbfb4('0xd'),_0x1be572,_0x2464a2);_0x3381f8(_0x2464a2);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 494984d..4dccd95 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 _0x957b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x957b,0x1ee));var _0xb957=function(_0x3ed70a,_0x18c849){_0x3ed70a=_0x3ed70a-0x0;var _0x2add57=_0x957b[_0x3ed70a];return _0x2add57;};'use strict';var multer=require(_0xb957('0x0'));var util=require(_0xb957('0x1'));var path=require(_0xb957('0x2'));var timeout=require(_0xb957('0x3'));var express=require(_0xb957('0x4'));var router=express[_0xb957('0x5')]();var fs_extra=require(_0xb957('0x6'));var auth=require(_0xb957('0x7'));var interaction=require(_0xb957('0x8'));var config=require(_0xb957('0x9'));var controller=require('./cmContactHasItem.controller');router[_0xb957('0xa')]('/',auth[_0xb957('0xb')](),controller['index']);router[_0xb957('0xa')](_0xb957('0xc'),auth[_0xb957('0xb')](),controller['show']);router[_0xb957('0xd')]('/',auth['isAuthenticated'](),controller[_0xb957('0xe')]);router[_0xb957('0xf')](_0xb957('0xc'),auth[_0xb957('0xb')](),controller[_0xb957('0x10')]);router[_0xb957('0x11')](_0xb957('0xc'),auth['isAuthenticated'](),controller[_0xb957('0x12')]);module[_0xb957('0x13')]=router; \ No newline at end of file +var _0x6de9=['./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6de9,0xe6));var _0x96de=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x6de9[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x96de('0x0'));var util=require(_0x96de('0x1'));var path=require(_0x96de('0x2'));var timeout=require(_0x96de('0x3'));var express=require(_0x96de('0x4'));var router=express['Router']();var fs_extra=require(_0x96de('0x5'));var auth=require(_0x96de('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x96de('0x7'));var controller=require(_0x96de('0x8'));router['get']('/',auth[_0x96de('0x9')](),controller[_0x96de('0xa')]);router[_0x96de('0xb')](_0x96de('0xc'),auth['isAuthenticated'](),controller[_0x96de('0xd')]);router[_0x96de('0xe')]('/',auth[_0x96de('0x9')](),controller['create']);router[_0x96de('0xf')](_0x96de('0xc'),auth[_0x96de('0x9')](),controller['update']);router['delete'](_0x96de('0xc'),auth[_0x96de('0x9')](),controller['destroy']);module[_0x96de('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index be65c72..fb42005 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 _0x884e=['select','values','setDataValue','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','name','long','type'];(function(_0x1e73ef,_0x22a67a){var _0x34eb2a=function(_0x567bd1){while(--_0x567bd1){_0x1e73ef['push'](_0x1e73ef['shift']());}};_0x34eb2a(++_0x22a67a);}(_0x884e,0x1e6));var _0xe884=function(_0x29d57f,_0x69ef7){_0x29d57f=_0x29d57f-0x0;var _0x3ef3b1=_0x884e[_0x29d57f];return _0x3ef3b1;};'use strict';var Sequelize=require(_0xe884('0x0'));var _=require(_0xe884('0x1'));module[_0xe884('0x2')]={'name':{'type':Sequelize[_0xe884('0x3')],'get':function(_0x140d52){return this[_0xe884('0x4')]('alias');}},'alias':{'type':Sequelize[_0xe884('0x5')],'allowNull':![],'set':function(_0x32e4b7){this['setDataValue']('alias',_0x32e4b7?_0x32e4b7:this[_0xe884('0x4')](_0xe884('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xe884('0x7')),'get':function(){if(this['getDataValue'](_0xe884('0x8'))===_0xe884('0x9')){return JSON['parse'](this[_0xe884('0x4')]('values'));}else{return this[_0xe884('0x4')](_0xe884('0xa'));}},'set':function(_0x29786e){if(Array['isArray'](_0x29786e)){this[_0xe884('0xb')]('values',JSON[_0xe884('0xc')](_0x29786e));}else{this['setDataValue'](_0xe884('0xa'),_0x29786e);}}},'required':{'type':Sequelize[_0xe884('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe884('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xe884('0xe'))}}; \ No newline at end of file +var _0x4bbc=['long','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','alias','STRING','TEXT'];(function(_0x26b0ea,_0x35518a){var _0x5a2d25=function(_0x2a1cc3){while(--_0x2a1cc3){_0x26b0ea['push'](_0x26b0ea['shift']());}};_0x5a2d25(++_0x35518a);}(_0x4bbc,0x1d6));var _0xc4bb=function(_0x181916,_0x376121){_0x181916=_0x181916-0x0;var _0x29d507=_0x4bbc[_0x181916];return _0x29d507;};'use strict';var Sequelize=require(_0xc4bb('0x0'));var _=require(_0xc4bb('0x1'));module['exports']={'name':{'type':Sequelize[_0xc4bb('0x2')],'get':function(_0x34f179){return this['getDataValue'](_0xc4bb('0x3'));}},'alias':{'type':Sequelize[_0xc4bb('0x4')],'allowNull':![],'set':function(_0x9d0433){this['setDataValue'](_0xc4bb('0x3'),_0x9d0433?_0x9d0433:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xc4bb('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xc4bb('0x5')](_0xc4bb('0x6')),'get':function(){if(this['getDataValue'](_0xc4bb('0x7'))===_0xc4bb('0x8')){return JSON[_0xc4bb('0x9')](this['getDataValue'](_0xc4bb('0xa')));}else{return this['getDataValue'](_0xc4bb('0xa'));}},'set':function(_0x29b4f6){if(Array[_0xc4bb('0xb')](_0x29b4f6)){this[_0xc4bb('0xc')](_0xc4bb('0xa'),JSON[_0xc4bb('0xd')](_0x29b4f6));}else{this[_0xc4bb('0xc')](_0xc4bb('0xa'),_0x29b4f6);}}},'required':{'type':Sequelize[_0xc4bb('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc4bb('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc4bb('0xf')](_0xc4bb('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0e668d5..027c604 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 _0x75bd=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','options','include','findAll','rows','catch','show','params','keys','includeAll','merge','find','body','create','sequelize','transaction','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x75bd,0x161));var _0xd75b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x75bd[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd75b('0x0'));var zipdir=require(_0xd75b('0x1'));var jsonpatch=require(_0xd75b('0x2'));var rp=require(_0xd75b('0x3'));var moment=require(_0xd75b('0x4'));var BPromise=require(_0xd75b('0x5'));var Mustache=require(_0xd75b('0x6'));var util=require(_0xd75b('0x7'));var path=require(_0xd75b('0x8'));var sox=require(_0xd75b('0x9'));var csv=require(_0xd75b('0xa'));var ejs=require(_0xd75b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd75b('0xc'));var squel=require(_0xd75b('0xd'));var crypto=require(_0xd75b('0xe'));var jsforce=require(_0xd75b('0xf'));var deskjs=require(_0xd75b('0x10'));var toCsv=require(_0xd75b('0xa'));var querystring=require(_0xd75b('0x11'));var Papa=require(_0xd75b('0x12'));var Redis=require(_0xd75b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd75b('0x14'));var as=require(_0xd75b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd75b('0x16'))(_0xd75b('0x17'));var utils=require(_0xd75b('0x18'));var config=require(_0xd75b('0x19'));var licenseUtil=require(_0xd75b('0x1a'));var db=require(_0xd75b('0x1b'))['db'];function respondWithStatusCode(_0xf0ddb0,_0x4ce12c){_0x4ce12c=_0x4ce12c||0xcc;return function(_0x1e97d3){if(_0x1e97d3){return _0xf0ddb0[_0xd75b('0x1c')](_0x4ce12c);}return _0xf0ddb0[_0xd75b('0x1d')](_0x4ce12c)['end']();};}function respondWithResult(_0x5c4b60,_0x51540a){_0x51540a=_0x51540a||0xc8;return function(_0x34b5ae){if(_0x34b5ae){return _0x5c4b60[_0xd75b('0x1d')](_0x51540a)[_0xd75b('0x1e')](_0x34b5ae);}};}function respondWithFilteredResult(_0x29de5a,_0x51512d){return function(_0x1e99ec){if(_0x1e99ec){var _0x2c4ca3=typeof _0x51512d['offset']===_0xd75b('0x1f')&&typeof _0x51512d[_0xd75b('0x20')]==='undefined';var _0x4bdd05=_0x1e99ec[_0xd75b('0x21')];var _0x4fee55=_0x2c4ca3?0x0:_0x51512d[_0xd75b('0x22')];var _0x4fb561=_0x2c4ca3?_0x1e99ec[_0xd75b('0x21')]:_0x51512d[_0xd75b('0x22')]+_0x51512d['limit'];var _0x1cd891;if(_0x4fb561>=_0x4bdd05){_0x4fb561=_0x4bdd05;_0x1cd891=0xc8;}else{_0x1cd891=0xce;}_0x29de5a['status'](_0x1cd891);return _0x29de5a['set'](_0xd75b('0x23'),_0x4fee55+'-'+_0x4fb561+'/'+_0x4bdd05)['json'](_0x1e99ec);}return null;};}function patchUpdates(_0x904038){return function(_0x41143a){try{jsonpatch[_0xd75b('0x24')](_0x41143a,_0x904038,!![]);}catch(_0x3b53a9){return BPromise[_0xd75b('0x25')](_0x3b53a9);}return _0x41143a[_0xd75b('0x26')]();};}function saveUpdates(_0x163923,_0x3209be){return function(_0x10df30){if(_0x10df30){return _0x10df30[_0xd75b('0x27')](_0x163923)[_0xd75b('0x28')](function(_0x4f121e){return _0x4f121e;});}return null;};}function removeEntity(_0x2ede3d,_0x434450){return function(_0x17a204){if(_0x17a204){return _0x17a204[_0xd75b('0x29')]()[_0xd75b('0x28')](function(){_0x2ede3d[_0xd75b('0x1d')](0xcc)[_0xd75b('0x2a')]();});}};}function handleEntityNotFound(_0x3054df,_0x4d9e8d){return function(_0x5e7939){if(!_0x5e7939){_0x3054df['sendStatus'](0x194);}return _0x5e7939;};}function handleError(_0xd6a559,_0x312145){_0x312145=_0x312145||0x1f4;return function(_0x3d8940){logger[_0xd75b('0x2b')](_0x3d8940[_0xd75b('0x2c')]);if(_0x3d8940[_0xd75b('0x2d')]){delete _0x3d8940[_0xd75b('0x2d')];}_0xd6a559[_0xd75b('0x1d')](_0x312145)[_0xd75b('0x2e')](_0x3d8940);};}exports[_0xd75b('0x2f')]=function(_0x5ebfcf,_0x31ed34){var _0xaf9a04={},_0x56e417={},_0x7c2ae7={'count':0x0,'rows':[]};var _0x5e5fa3=_['map'](db[_0xd75b('0x30')][_0xd75b('0x31')],function(_0x35636a){return{'name':_0x35636a[_0xd75b('0x32')],'type':_0x35636a[_0xd75b('0x33')][_0xd75b('0x34')]};});_0x56e417[_0xd75b('0x35')]=_[_0xd75b('0x36')](_[_0xd75b('0x37')](_0x5e5fa3,_0xd75b('0x2d')),[_0xd75b('0x2d')]);_0x56e417[_0xd75b('0x38')]=_['keys'](_0x5ebfcf[_0xd75b('0x38')]);_0x56e417['filters']=_[_0xd75b('0x39')](_0x56e417['model'],_0x56e417[_0xd75b('0x38')]);_0xaf9a04[_0xd75b('0x3a')]=_[_0xd75b('0x39')](_0x56e417[_0xd75b('0x35')],qs[_0xd75b('0x3b')](_0x5ebfcf[_0xd75b('0x38')][_0xd75b('0x3b')]));_0xaf9a04[_0xd75b('0x3a')]=_0xaf9a04['attributes'][_0xd75b('0x3c')]?_0xaf9a04[_0xd75b('0x3a')]:_0x56e417[_0xd75b('0x35')];if(!_0x5ebfcf[_0xd75b('0x38')]['hasOwnProperty'](_0xd75b('0x3d'))){_0xaf9a04[_0xd75b('0x20')]=qs['limit'](_0x5ebfcf[_0xd75b('0x38')][_0xd75b('0x20')]);_0xaf9a04[_0xd75b('0x22')]=qs['offset'](_0x5ebfcf[_0xd75b('0x38')][_0xd75b('0x22')]);}_0xaf9a04[_0xd75b('0x3e')]=qs[_0xd75b('0x3f')](_0x5ebfcf[_0xd75b('0x38')]['sort']);_0xaf9a04[_0xd75b('0x40')]=qs[_0xd75b('0x41')](_[_0xd75b('0x42')](_0x5ebfcf[_0xd75b('0x38')],_0x56e417[_0xd75b('0x41')]),_0x5e5fa3);if(_0x5ebfcf[_0xd75b('0x38')]['filter']){_0xaf9a04[_0xd75b('0x40')]=_['merge'](_0xaf9a04[_0xd75b('0x40')],{'$or':_[_0xd75b('0x37')](_0x5e5fa3,function(_0x5a1d35){if(_0x5a1d35['type']!=='VIRTUAL'){var _0x14efc5={};_0x14efc5[_0x5a1d35['name']]={'$like':'%'+_0x5ebfcf[_0xd75b('0x38')]['filter']+'%'};return _0x14efc5;}})});}_0xaf9a04=_['merge']({},_0xaf9a04,_0x5ebfcf[_0xd75b('0x43')]);var _0x1f81b1={'where':_0xaf9a04[_0xd75b('0x40')]};return db[_0xd75b('0x30')][_0xd75b('0x21')](_0x1f81b1)[_0xd75b('0x28')](function(_0x18d53e){_0x7c2ae7[_0xd75b('0x21')]=_0x18d53e;if(_0x5ebfcf['query']['includeAll']){_0xaf9a04[_0xd75b('0x44')]=[{'all':!![]}];}return db['CmCustomField'][_0xd75b('0x45')](_0xaf9a04);})[_0xd75b('0x28')](function(_0x55c57f){_0x7c2ae7[_0xd75b('0x46')]=_0x55c57f;return _0x7c2ae7;})[_0xd75b('0x28')](respondWithFilteredResult(_0x31ed34,_0xaf9a04))[_0xd75b('0x47')](handleError(_0x31ed34,null));};exports[_0xd75b('0x48')]=function(_0x4cd6f6,_0x42feb4){var _0x51494b={'raw':!![],'where':{'id':_0x4cd6f6[_0xd75b('0x49')]['id']}},_0x7cfb33={};_0x7cfb33['model']=_['keys'](db[_0xd75b('0x30')][_0xd75b('0x31')]);_0x7cfb33[_0xd75b('0x38')]=_[_0xd75b('0x4a')](_0x4cd6f6[_0xd75b('0x38')]);_0x7cfb33['filters']=_[_0xd75b('0x39')](_0x7cfb33['model'],_0x7cfb33[_0xd75b('0x38')]);_0x51494b[_0xd75b('0x3a')]=_[_0xd75b('0x39')](_0x7cfb33['model'],qs[_0xd75b('0x3b')](_0x4cd6f6['query']['fields']));_0x51494b[_0xd75b('0x3a')]=_0x51494b[_0xd75b('0x3a')]['length']?_0x51494b['attributes']:_0x7cfb33['model'];if(_0x4cd6f6[_0xd75b('0x38')][_0xd75b('0x4b')]){_0x51494b[_0xd75b('0x44')]=[{'all':!![]}];}_0x51494b=_[_0xd75b('0x4c')]({},_0x51494b,_0x4cd6f6['options']);return db[_0xd75b('0x30')][_0xd75b('0x4d')](_0x51494b)[_0xd75b('0x28')](handleEntityNotFound(_0x42feb4,null))[_0xd75b('0x28')](respondWithResult(_0x42feb4,null))[_0xd75b('0x47')](handleError(_0x42feb4,null));};exports[_0xd75b('0x27')]=function(_0x16b291,_0x1b897f){if(_0x16b291['body']['id']){delete _0x16b291[_0xd75b('0x4e')]['id'];}return db[_0xd75b('0x30')][_0xd75b('0x4d')]({'where':{'id':_0x16b291[_0xd75b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b897f,null))['then'](saveUpdates(_0x16b291[_0xd75b('0x4e')],null))['then'](respondWithResult(_0x1b897f,null))[_0xd75b('0x47')](handleError(_0x1b897f,null));};exports['destroy']=function(_0x5395e9,_0x2cf1f3){return db['CmCustomField']['find']({'where':{'id':_0x5395e9[_0xd75b('0x49')]['id']}})[_0xd75b('0x28')](handleEntityNotFound(_0x2cf1f3,null))[_0xd75b('0x28')](removeEntity(_0x2cf1f3,null))[_0xd75b('0x47')](handleError(_0x2cf1f3,null));};exports[_0xd75b('0x4f')]=function(_0x471246,_0x200c51){var _0x45e8ef;return db[_0xd75b('0x50')][_0xd75b('0x51')](function(_0x22c985){return db[_0xd75b('0x30')]['create'](_0x471246['body'],{'transaction':_0x22c985})[_0xd75b('0x28')](function(_0x4ae6e1){_0x45e8ef=_0x4ae6e1;var _0x3b8547={'type':db[_0xd75b('0x52')]['TEXT'],'transaction':_0x22c985};switch(_0x471246[_0xd75b('0x4e')][_0xd75b('0x33')]){case _0xd75b('0x53'):_0x3b8547['type']=db[_0xd75b('0x52')][_0xd75b('0x54')];break;case'number':_0x3b8547[_0xd75b('0x33')]=db[_0xd75b('0x52')][_0xd75b('0x55')];break;case _0xd75b('0x56'):_0x3b8547[_0xd75b('0x33')]=db[_0xd75b('0x52')][_0xd75b('0x57')];_0x3b8547[_0xd75b('0x58')]=![];break;default:}return db[_0xd75b('0x50')][_0xd75b('0x59')][_0xd75b('0x5a')]('cm_contacts',util[_0xd75b('0x5b')](_0xd75b('0x5c'),_0x45e8ef['id']),_0x3b8547);})[_0xd75b('0x28')](function(){return _0x45e8ef;});})['then'](respondWithResult(_0x200c51,0xc9))[_0xd75b('0x47')](handleError(_0x200c51,null));}; \ No newline at end of file +var _0xafe1=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','rawAttributes','type','key','model','differenceBy','map','query','keys','intersection','fields','attributes','hasOwnProperty','order','where','pick','filters','filter','merge','VIRTUAL','CmCustomField','includeAll','catch','show','params','length','include','options','find','body','create','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','sequelize','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path'];(function(_0x1b79fa,_0x209061){var _0x864a7c=function(_0x4c1402){while(--_0x4c1402){_0x1b79fa['push'](_0x1b79fa['shift']());}};_0x864a7c(++_0x209061);}(_0xafe1,0x14a));var _0x1afe=function(_0x1f7367,_0x2bc8e6){_0x1f7367=_0x1f7367-0x0;var _0xb41671=_0xafe1[_0x1f7367];return _0xb41671;};'use strict';var emlformat=require(_0x1afe('0x0'));var rimraf=require(_0x1afe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1afe('0x2'));var rp=require(_0x1afe('0x3'));var moment=require('moment');var BPromise=require(_0x1afe('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1afe('0x5'));var sox=require(_0x1afe('0x6'));var csv=require(_0x1afe('0x7'));var ejs=require(_0x1afe('0x8'));var fs=require('fs');var fs_extra=require(_0x1afe('0x9'));var _=require(_0x1afe('0xa'));var squel=require(_0x1afe('0xb'));var crypto=require('crypto');var jsforce=require(_0x1afe('0xc'));var deskjs=require(_0x1afe('0xd'));var toCsv=require(_0x1afe('0x7'));var querystring=require(_0x1afe('0xe'));var Papa=require(_0x1afe('0xf'));var Redis=require('ioredis');var authService=require(_0x1afe('0x10'));var qs=require(_0x1afe('0x11'));var as=require(_0x1afe('0x12'));var hardwareService=require(_0x1afe('0x13'));var logger=require(_0x1afe('0x14'))('api');var utils=require(_0x1afe('0x15'));var config=require(_0x1afe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1afe('0x17'))['db'];function respondWithStatusCode(_0x517339,_0x5d6eb5){_0x5d6eb5=_0x5d6eb5||0xcc;return function(_0x58c457){if(_0x58c457){return _0x517339[_0x1afe('0x18')](_0x5d6eb5);}return _0x517339[_0x1afe('0x19')](_0x5d6eb5)[_0x1afe('0x1a')]();};}function respondWithResult(_0x46796f,_0x15007a){_0x15007a=_0x15007a||0xc8;return function(_0x148eb7){if(_0x148eb7){return _0x46796f[_0x1afe('0x19')](_0x15007a)['json'](_0x148eb7);}};}function respondWithFilteredResult(_0xbd3c4c,_0x317cca){return function(_0x3e7b4d){if(_0x3e7b4d){var _0x4c7442=typeof _0x317cca[_0x1afe('0x1b')]===_0x1afe('0x1c')&&typeof _0x317cca[_0x1afe('0x1d')]===_0x1afe('0x1c');var _0x2c3007=_0x3e7b4d[_0x1afe('0x1e')];var _0x1cb0e4=_0x4c7442?0x0:_0x317cca['offset'];var _0x344489=_0x4c7442?_0x3e7b4d[_0x1afe('0x1e')]:_0x317cca['offset']+_0x317cca[_0x1afe('0x1d')];var _0x2283bd;if(_0x344489>=_0x2c3007){_0x344489=_0x2c3007;_0x2283bd=0xc8;}else{_0x2283bd=0xce;}_0xbd3c4c[_0x1afe('0x19')](_0x2283bd);return _0xbd3c4c[_0x1afe('0x1f')](_0x1afe('0x20'),_0x1cb0e4+'-'+_0x344489+'/'+_0x2c3007)['json'](_0x3e7b4d);}return null;};}function patchUpdates(_0x64cc83){return function(_0x448069){try{jsonpatch['apply'](_0x448069,_0x64cc83,!![]);}catch(_0x177907){return BPromise[_0x1afe('0x21')](_0x177907);}return _0x448069[_0x1afe('0x22')]();};}function saveUpdates(_0x3188e5,_0x5caaf5){return function(_0x53fc9b){if(_0x53fc9b){return _0x53fc9b[_0x1afe('0x23')](_0x3188e5)[_0x1afe('0x24')](function(_0x5263a9){return _0x5263a9;});}return null;};}function removeEntity(_0xc76c95,_0x16adf4){return function(_0x3a58a3){if(_0x3a58a3){return _0x3a58a3[_0x1afe('0x25')]()['then'](function(){_0xc76c95[_0x1afe('0x19')](0xcc)[_0x1afe('0x1a')]();});}};}function handleEntityNotFound(_0x30c2f8,_0x10072f){return function(_0x40eb3f){if(!_0x40eb3f){_0x30c2f8['sendStatus'](0x194);}return _0x40eb3f;};}function handleError(_0x44b8c9,_0x34806f){_0x34806f=_0x34806f||0x1f4;return function(_0x410be8){logger[_0x1afe('0x26')](_0x410be8['stack']);if(_0x410be8['name']){delete _0x410be8[_0x1afe('0x27')];}_0x44b8c9[_0x1afe('0x19')](_0x34806f)[_0x1afe('0x28')](_0x410be8);};}exports[_0x1afe('0x29')]=function(_0x5615c8,_0x4d98cc){var _0x8d687b={},_0x4c319a={},_0x5c804b={'count':0x0,'rows':[]};var _0xd8834e=_['map'](db['CmCustomField'][_0x1afe('0x2a')],function(_0x8a0d03){return{'name':_0x8a0d03['fieldName'],'type':_0x8a0d03[_0x1afe('0x2b')][_0x1afe('0x2c')]};});_0x4c319a[_0x1afe('0x2d')]=_[_0x1afe('0x2e')](_[_0x1afe('0x2f')](_0xd8834e,_0x1afe('0x27')),[_0x1afe('0x27')]);_0x4c319a[_0x1afe('0x30')]=_[_0x1afe('0x31')](_0x5615c8['query']);_0x4c319a['filters']=_[_0x1afe('0x32')](_0x4c319a[_0x1afe('0x2d')],_0x4c319a['query']);_0x8d687b['attributes']=_['intersection'](_0x4c319a[_0x1afe('0x2d')],qs[_0x1afe('0x33')](_0x5615c8[_0x1afe('0x30')][_0x1afe('0x33')]));_0x8d687b[_0x1afe('0x34')]=_0x8d687b[_0x1afe('0x34')]['length']?_0x8d687b['attributes']:_0x4c319a[_0x1afe('0x2d')];if(!_0x5615c8['query'][_0x1afe('0x35')]('nolimit')){_0x8d687b[_0x1afe('0x1d')]=qs[_0x1afe('0x1d')](_0x5615c8['query'][_0x1afe('0x1d')]);_0x8d687b[_0x1afe('0x1b')]=qs[_0x1afe('0x1b')](_0x5615c8[_0x1afe('0x30')][_0x1afe('0x1b')]);}_0x8d687b[_0x1afe('0x36')]=qs['sort'](_0x5615c8[_0x1afe('0x30')]['sort']);_0x8d687b[_0x1afe('0x37')]=qs['filters'](_[_0x1afe('0x38')](_0x5615c8[_0x1afe('0x30')],_0x4c319a[_0x1afe('0x39')]),_0xd8834e);if(_0x5615c8[_0x1afe('0x30')][_0x1afe('0x3a')]){_0x8d687b[_0x1afe('0x37')]=_[_0x1afe('0x3b')](_0x8d687b[_0x1afe('0x37')],{'$or':_[_0x1afe('0x2f')](_0xd8834e,function(_0x3eb5b8){if(_0x3eb5b8['type']!==_0x1afe('0x3c')){var _0x271997={};_0x271997[_0x3eb5b8[_0x1afe('0x27')]]={'$like':'%'+_0x5615c8[_0x1afe('0x30')][_0x1afe('0x3a')]+'%'};return _0x271997;}})});}_0x8d687b=_[_0x1afe('0x3b')]({},_0x8d687b,_0x5615c8['options']);var _0xa6e31b={'where':_0x8d687b[_0x1afe('0x37')]};return db[_0x1afe('0x3d')]['count'](_0xa6e31b)['then'](function(_0x37837b){_0x5c804b[_0x1afe('0x1e')]=_0x37837b;if(_0x5615c8['query'][_0x1afe('0x3e')]){_0x8d687b['include']=[{'all':!![]}];}return db[_0x1afe('0x3d')]['findAll'](_0x8d687b);})[_0x1afe('0x24')](function(_0x484475){_0x5c804b['rows']=_0x484475;return _0x5c804b;})[_0x1afe('0x24')](respondWithFilteredResult(_0x4d98cc,_0x8d687b))[_0x1afe('0x3f')](handleError(_0x4d98cc,null));};exports[_0x1afe('0x40')]=function(_0x2c06b7,_0x7e8ab9){var _0x142ad0={'raw':!![],'where':{'id':_0x2c06b7[_0x1afe('0x41')]['id']}},_0x4d18c1={};_0x4d18c1[_0x1afe('0x2d')]=_[_0x1afe('0x31')](db[_0x1afe('0x3d')]['rawAttributes']);_0x4d18c1['query']=_[_0x1afe('0x31')](_0x2c06b7[_0x1afe('0x30')]);_0x4d18c1[_0x1afe('0x39')]=_[_0x1afe('0x32')](_0x4d18c1['model'],_0x4d18c1[_0x1afe('0x30')]);_0x142ad0[_0x1afe('0x34')]=_['intersection'](_0x4d18c1['model'],qs[_0x1afe('0x33')](_0x2c06b7[_0x1afe('0x30')]['fields']));_0x142ad0['attributes']=_0x142ad0[_0x1afe('0x34')][_0x1afe('0x42')]?_0x142ad0[_0x1afe('0x34')]:_0x4d18c1['model'];if(_0x2c06b7[_0x1afe('0x30')][_0x1afe('0x3e')]){_0x142ad0[_0x1afe('0x43')]=[{'all':!![]}];}_0x142ad0=_[_0x1afe('0x3b')]({},_0x142ad0,_0x2c06b7[_0x1afe('0x44')]);return db[_0x1afe('0x3d')][_0x1afe('0x45')](_0x142ad0)['then'](handleEntityNotFound(_0x7e8ab9,null))[_0x1afe('0x24')](respondWithResult(_0x7e8ab9,null))[_0x1afe('0x3f')](handleError(_0x7e8ab9,null));};exports['update']=function(_0x3ab36f,_0x38596b){if(_0x3ab36f['body']['id']){delete _0x3ab36f[_0x1afe('0x46')]['id'];}return db[_0x1afe('0x3d')][_0x1afe('0x45')]({'where':{'id':_0x3ab36f[_0x1afe('0x41')]['id']}})[_0x1afe('0x24')](handleEntityNotFound(_0x38596b,null))[_0x1afe('0x24')](saveUpdates(_0x3ab36f['body'],null))[_0x1afe('0x24')](respondWithResult(_0x38596b,null))[_0x1afe('0x3f')](handleError(_0x38596b,null));};exports['destroy']=function(_0x544d33,_0x40e70f){return db[_0x1afe('0x3d')][_0x1afe('0x45')]({'where':{'id':_0x544d33['params']['id']}})[_0x1afe('0x24')](handleEntityNotFound(_0x40e70f,null))[_0x1afe('0x24')](removeEntity(_0x40e70f,null))[_0x1afe('0x3f')](handleError(_0x40e70f,null));};exports[_0x1afe('0x47')]=function(_0x161f1f,_0x2c992e){var _0x307c32;return db['sequelize']['transaction'](function(_0x221c19){return db[_0x1afe('0x3d')][_0x1afe('0x47')](_0x161f1f['body'],{'transaction':_0x221c19})['then'](function(_0x3a4c60){_0x307c32=_0x3a4c60;var _0x44e0d6={'type':db['Sequelize'][_0x1afe('0x48')],'transaction':_0x221c19};switch(_0x161f1f[_0x1afe('0x46')][_0x1afe('0x2b')]){case _0x1afe('0x49'):_0x44e0d6[_0x1afe('0x2b')]=db[_0x1afe('0x4a')][_0x1afe('0x48')];break;case _0x1afe('0x4b'):_0x44e0d6[_0x1afe('0x2b')]=db['Sequelize'][_0x1afe('0x4c')];break;case _0x1afe('0x4d'):_0x44e0d6[_0x1afe('0x2b')]=db['Sequelize']['BOOLEAN'];_0x44e0d6[_0x1afe('0x4e')]=![];break;default:}return db[_0x1afe('0x4f')]['queryInterface'][_0x1afe('0x50')](_0x1afe('0x51'),util[_0x1afe('0x52')](_0x1afe('0x53'),_0x307c32['id']),_0x44e0d6);})[_0x1afe('0x24')](function(){return _0x307c32;});})[_0x1afe('0x24')](respondWithResult(_0x2c992e,0xc9))['catch'](handleError(_0x2c992e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 46ea320..d639230 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 _0x742b=['rimraf','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','bluebird'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x742b,0x145));var _0xb742=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x742b[_0x432682];return _0x463d05;};'use strict';var _=require(_0xb742('0x0'));var util=require(_0xb742('0x1'));var logger=require(_0xb742('0x2'))(_0xb742('0x3'));var moment=require('moment');var BPromise=require(_0xb742('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb742('0x5'));var config=require('../../config/environment');var attributes=require(_0xb742('0x6'));module[_0xb742('0x7')]=function(_0x579e86,_0x1df028){return _0x579e86[_0xb742('0x8')](_0xb742('0x9'),attributes,{'tableName':_0xb742('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2710=['cm_custom_fields','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x34a3b0,_0x323584){var _0x4224fc=function(_0xe4af2f){while(--_0xe4af2f){_0x34a3b0['push'](_0x34a3b0['shift']());}};_0x4224fc(++_0x323584);}(_0x2710,0xe7));var _0x0271=function(_0x59d7b7,_0x25bf2f){_0x59d7b7=_0x59d7b7-0x0;var _0x31db17=_0x2710[_0x59d7b7];return _0x31db17;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0271('0x0'))('api');var moment=require(_0x0271('0x1'));var BPromise=require(_0x0271('0x2'));var rp=require(_0x0271('0x3'));var fs=require('fs');var path=require(_0x0271('0x4'));var rimraf=require('rimraf');var config=require(_0x0271('0x5'));var attributes=require(_0x0271('0x6'));module[_0x0271('0x7')]=function(_0x4139dd,_0x184e9e){return _0x4139dd[_0x0271('0x8')]('CmCustomField',attributes,{'tableName':_0x0271('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 9c2fe90..ef659ce 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 _0x4cd1=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4cd1,0x176));var _0x14cd=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x4cd1[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x14cd('0x0'));var rs=require(_0x14cd('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14cd('0x2'))['db'];var utils=require(_0x14cd('0x3'));var logger=require(_0x14cd('0x4'))(_0x14cd('0x5'));var config=require(_0x14cd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x14cd('0x7')][_0x14cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fcbe7,_0x4a7f9b,_0x33f34a){return new BPromise(function(_0x567e1f,_0x262768){return client[_0x14cd('0x9')](_0x3fcbe7,_0x33f34a)[_0x14cd('0xa')](function(_0x194fa6){logger[_0x14cd('0xb')]('CmCustomField,\x20%s,\x20%s',_0x4a7f9b,_0x14cd('0xc'));logger[_0x14cd('0xd')](_0x14cd('0xe'),_0x4a7f9b,_0x14cd('0xc'),JSON[_0x14cd('0xf')](_0x194fa6));if(_0x194fa6[_0x14cd('0x10')]){if(_0x194fa6[_0x14cd('0x10')]['code']===0x1f4){logger['error'](_0x14cd('0x11'),_0x4a7f9b,_0x194fa6[_0x14cd('0x10')][_0x14cd('0x12')]);return _0x262768(_0x194fa6[_0x14cd('0x10')]['message']);}logger[_0x14cd('0x10')]('CmCustomField,\x20%s,\x20%s',_0x4a7f9b,_0x194fa6['error']['message']);return _0x567e1f(_0x194fa6[_0x14cd('0x10')][_0x14cd('0x12')]);}else{logger[_0x14cd('0xb')](_0x14cd('0x11'),_0x4a7f9b,_0x14cd('0xc'));_0x567e1f(_0x194fa6[_0x14cd('0x13')]['message']);}})[_0x14cd('0x14')](function(_0x3388e8){logger[_0x14cd('0x10')](_0x14cd('0x11'),_0x4a7f9b,_0x3388e8);_0x262768(_0x3388e8);});});} \ No newline at end of file +var _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4cc642,_0x2838e2){var _0x24ea52=function(_0x17f709){while(--_0x17f709){_0x4cc642['push'](_0x4cc642['shift']());}};_0x24ea52(++_0x2838e2);}(_0x33af,0xec));var _0xf33a=function(_0x47f719,_0x2e559d){_0x47f719=_0x47f719-0x0;var _0x407f4e=_0x33af[_0x47f719];return _0x407f4e;};'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')]('CmCustomField,\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')]('CmCustomField,\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 diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 6c813ab..4854cbf 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 _0xacea=['path','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util'];(function(_0x2d32a3,_0x13cc58){var _0x391131=function(_0x4c3a64){while(--_0x4c3a64){_0x2d32a3['push'](_0x2d32a3['shift']());}};_0x391131(++_0x13cc58);}(_0xacea,0x1d2));var _0xaace=function(_0x5e2799,_0x18fe1c){_0x5e2799=_0x5e2799-0x0;var _0x3cd939=_0xacea[_0x5e2799];return _0x3cd939;};'use strict';var multer=require(_0xaace('0x0'));var util=require(_0xaace('0x1'));var path=require(_0xaace('0x2'));var timeout=require('connect-timeout');var express=require(_0xaace('0x3'));var router=express[_0xaace('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaace('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaace('0x6'));var controller=require(_0xaace('0x7'));router[_0xaace('0x8')]('/',auth[_0xaace('0x9')](),controller[_0xaace('0xa')]);router[_0xaace('0x8')](_0xaace('0xb'),auth[_0xaace('0x9')](),controller[_0xaace('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaace('0xd')]);router['put']('/:id',auth[_0xaace('0x9')](),controller[_0xaace('0xe')]);router[_0xaace('0xf')](_0xaace('0xb'),auth['isAuthenticated'](),controller[_0xaace('0x10')]);module[_0xaace('0x11')]=router; \ No newline at end of file +var _0xb175=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','isAuthenticated','index','get','/:id','show','post','put'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xb175,0x1a4));var _0x5b17=function(_0x55a44c,_0x262d6c){_0x55a44c=_0x55a44c-0x0;var _0x3f723f=_0xb175[_0x55a44c];return _0x3f723f;};'use strict';var multer=require(_0x5b17('0x0'));var util=require(_0x5b17('0x1'));var path=require(_0x5b17('0x2'));var timeout=require(_0x5b17('0x3'));var express=require('express');var router=express[_0x5b17('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('./cmCustomField.controller');router['get']('/',auth[_0x5b17('0x5')](),controller[_0x5b17('0x6')]);router[_0x5b17('0x7')](_0x5b17('0x8'),auth[_0x5b17('0x5')](),controller[_0x5b17('0x9')]);router[_0x5b17('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5b17('0xb')]('/:id',auth[_0x5b17('0x5')](),controller[_0x5b17('0xc')]);router[_0x5b17('0xd')](_0x5b17('0x8'),auth[_0x5b17('0x5')](),controller[_0x5b17('0xe')]);module[_0x5b17('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 28c13dd..030b59b 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 _0xab9a=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','exports','STRING','BOOLEAN','DATE','format'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xab9a,0x148));var _0xaab9=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xab9a[_0x47a7d0];return _0xb9bd08;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xaab9('0x0')]={'phone':{'type':Sequelize[_0xaab9('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xaab9('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xaab9('0x3')],'defaultValue':moment()[_0xaab9('0x4')](_0xaab9('0x5'))},'countbusyretry':{'type':Sequelize[_0xaab9('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaab9('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xaab9('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xaab9('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xaab9('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xaab9('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xaab9('0x8')},'ListId':{'type':Sequelize[_0xaab9('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xaab9('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xaab9('0x6')],'unique':_0xaab9('0x8')},'CampaignId':{'type':Sequelize[_0xaab9('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xaab9('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xaab9('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xaab9('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xaab9('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xaab9('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xaab9('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xaab9('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0xaab9('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xf808=['INTEGER','UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xd411c4,_0x125263){var _0x3827b0=function(_0x10daa4){while(--_0x10daa4){_0xd411c4['push'](_0xd411c4['shift']());}};_0x3827b0(++_0x125263);}(_0xf808,0x108));var _0x8f80=function(_0xa3502a,_0x406144){_0xa3502a=_0xa3502a-0x0;var _0x2d5c58=_0xf808[_0xa3502a];return _0x2d5c58;};'use strict';var moment=require('moment');var Sequelize=require(_0x8f80('0x0'));module[_0x8f80('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x8f80('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8f80('0x3')],'defaultValue':moment()[_0x8f80('0x4')](_0x8f80('0x5'))},'countbusyretry':{'type':Sequelize[_0x8f80('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8f80('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8f80('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x8f80('0x6')](0x2)[_0x8f80('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8f80('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8f80('0x6')],'unique':_0x8f80('0x8')},'ListId':{'type':Sequelize[_0x8f80('0x6')],'unique':_0x8f80('0x8')},'UserId':{'type':Sequelize[_0x8f80('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x8f80('0x6')],'unique':_0x8f80('0x8')},'CampaignId':{'type':Sequelize[_0x8f80('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8f80('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f80('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8f80('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x8f80('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 8f0fe16..0ff9ed4 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 _0x0faf=['sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','CmContact','CmCompany','CmList','List','dialActive','getPreviewRecall','scheduledat','recallme','UPDATE','Contact','Company','getOpenContacts','preview','json','CmHopper,\x20%s,\x20%s,\x20%s','timezones','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','limit','undefined','count','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','intersection','concat','$and','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$iLike','$notILike','$like','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','deleted','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0faf,0x132));var _0xf0fa=function(_0x47888a,_0x7d2f3a){_0x47888a=_0x47888a-0x0;var _0x2b15a4=_0x0faf[_0x47888a];return _0x2b15a4;};'use strict';var moment=require(_0xf0fa('0x0'));var _=require('lodash');var qs=require(_0xf0fa('0x1'));var logger=require(_0xf0fa('0x2'))(_0xf0fa('0x3'));var shared=require(_0xf0fa('0x4'));var db=require(_0xf0fa('0x5'))['db'];function respondWithResult(_0xdc9ce3,_0x515b12){_0x515b12=_0x515b12||0xc8;return function(_0xc83253){if(_0xc83253){return _0xdc9ce3[_0xf0fa('0x6')](_0x515b12)['json'](_0xc83253);}};}function respondWithFilteredResult(_0x3637a3,_0x44ffa0){return function(_0x25b5c4){if(_0x25b5c4){var _0x3a703b=typeof _0x44ffa0[_0xf0fa('0x7')]==='undefined'&&typeof _0x44ffa0[_0xf0fa('0x8')]===_0xf0fa('0x9');var _0x481a42=_0x25b5c4['count'];var _0x3bda51=_0x3a703b?0x0:_0x44ffa0[_0xf0fa('0x7')];var _0x25dfec=_0x3a703b?_0x25b5c4[_0xf0fa('0xa')]:_0x44ffa0[_0xf0fa('0x7')]+_0x44ffa0[_0xf0fa('0x8')];var _0x379ff6;if(_0x25dfec>=_0x481a42){_0x25dfec=_0x481a42;_0x379ff6=0xc8;}else{_0x379ff6=0xce;}_0x3637a3[_0xf0fa('0x6')](_0x379ff6);return _0x3637a3['set'](_0xf0fa('0xb'),_0x3bda51+'-'+_0x25dfec+'/'+_0x481a42)['json'](_0x25b5c4);}return null;};}function saveUpdates(_0x2f46ff,_0x521034){return function(_0x39ae2b){if(_0x39ae2b){return _0x39ae2b[_0xf0fa('0xc')](_0x2f46ff)[_0xf0fa('0xd')](function(_0x547952){return _0x547952;});}return null;};}function handleEntityNotFound(_0x5821ae,_0x42591b){return function(_0x540a04){if(!_0x540a04){_0x5821ae[_0xf0fa('0xe')](0x194);}return _0x540a04;};}function handleError(_0x81fc49,_0x10ce43){_0x10ce43=_0x10ce43||0x1f4;return function(_0x3203ce){logger[_0xf0fa('0xf')](_0x3203ce[_0xf0fa('0x10')]);if(_0x3203ce[_0xf0fa('0x11')]){delete _0x3203ce[_0xf0fa('0x11')];}_0x81fc49['status'](_0x10ce43)[_0xf0fa('0x12')](_0x3203ce);};}exports[_0xf0fa('0x13')]=function(_0x30ce17,_0x1d3c22){var _0x2bdf82={},_0x386e5f={},_0x5ba2eb={'count':0x0,'rows':[]};var _0x56ef81=_[_0xf0fa('0x14')](db[_0xf0fa('0x15')][_0xf0fa('0x16')],function(_0x2385e2){return{'name':_0x2385e2[_0xf0fa('0x17')],'type':_0x2385e2[_0xf0fa('0x18')][_0xf0fa('0x19')]};});_0x386e5f[_0xf0fa('0x1a')]=_[_0xf0fa('0x14')](_0x56ef81,_0xf0fa('0x11'));_0x386e5f[_0xf0fa('0x1b')]=_['keys'](_0x30ce17[_0xf0fa('0x1b')]);_0x386e5f[_0xf0fa('0x1c')]=_[_0xf0fa('0x1d')](_0x386e5f[_0xf0fa('0x1a')],_0x386e5f[_0xf0fa('0x1b')]);_0x386e5f[_0xf0fa('0x1c')]=_[_0xf0fa('0x1e')](_0x386e5f[_0xf0fa('0x1c')],[_0xf0fa('0x1f'),'$or',_0xf0fa('0x20'),_0xf0fa('0x21'),'$lt',_0xf0fa('0x22'),_0xf0fa('0x23'),_0xf0fa('0x24'),'$not',_0xf0fa('0x25'),_0xf0fa('0x26'),_0xf0fa('0x27'),_0xf0fa('0x28'),'$like','$notLike',_0xf0fa('0x29'),_0xf0fa('0x2a'),_0xf0fa('0x2b'),_0xf0fa('0x2c'),'$contains',_0xf0fa('0x2d'),_0xf0fa('0x2e')]);_0x2bdf82[_0xf0fa('0x2f')]=_['intersection'](_0x386e5f[_0xf0fa('0x1a')],qs['fields'](_0x30ce17[_0xf0fa('0x1b')][_0xf0fa('0x30')]));_0x2bdf82[_0xf0fa('0x2f')]=_0x2bdf82['attributes'][_0xf0fa('0x31')]?_0x2bdf82[_0xf0fa('0x2f')]:_0x386e5f[_0xf0fa('0x1a')];if(!_0x30ce17[_0xf0fa('0x1b')][_0xf0fa('0x32')](_0xf0fa('0x33'))){_0x2bdf82['limit']=qs['limit'](_0x30ce17[_0xf0fa('0x1b')][_0xf0fa('0x8')]);_0x2bdf82['offset']=qs[_0xf0fa('0x7')](_0x30ce17['query']['offset']);}_0x2bdf82['order']=qs[_0xf0fa('0x34')](_0x30ce17['query'][_0xf0fa('0x34')]);_0x2bdf82[_0xf0fa('0x35')]=qs[_0xf0fa('0x1c')](_[_0xf0fa('0x36')](_0x30ce17[_0xf0fa('0x1b')],_0x386e5f[_0xf0fa('0x1c')]),_0x56ef81);if(_0x30ce17[_0xf0fa('0x1b')][_0xf0fa('0x37')]){_0x2bdf82['where']=_[_0xf0fa('0x38')](_0x2bdf82[_0xf0fa('0x35')],{'$or':_[_0xf0fa('0x14')](_0x56ef81,function(_0x5c59a6){if(_0x5c59a6[_0xf0fa('0x18')]!==_0xf0fa('0x39')){var _0x19b137={};_0x19b137[_0x5c59a6[_0xf0fa('0x11')]]={'$like':'%'+_0x30ce17['query']['filter']+'%'};return _0x19b137;}})});}_0x2bdf82=_[_0xf0fa('0x38')]({},_0x2bdf82,_0x30ce17[_0xf0fa('0x3a')]);var _0x2a6560={'where':_0x2bdf82[_0xf0fa('0x35')]};return db[_0xf0fa('0x15')]['count'](_0x2a6560)['then'](function(_0x5a2be0){_0x5ba2eb['count']=_0x5a2be0;if(_0x30ce17[_0xf0fa('0x1b')][_0xf0fa('0x3b')]){_0x2bdf82['include']=[{'all':!![]}];}return db['CmHopper'][_0xf0fa('0x3c')](_0x2bdf82);})[_0xf0fa('0xd')](function(_0x28068c){_0x5ba2eb[_0xf0fa('0x3d')]=_0x28068c;return _0x5ba2eb;})[_0xf0fa('0xd')](respondWithFilteredResult(_0x1d3c22,_0x2bdf82))[_0xf0fa('0x3e')](handleError(_0x1d3c22,null));};exports[_0xf0fa('0x3f')]=function(_0x4f5664,_0x53f408){var _0x344bb0={'raw':!![],'where':{'id':_0x4f5664[_0xf0fa('0x40')]['id']}},_0x1d4830={};_0x1d4830[_0xf0fa('0x1a')]=_[_0xf0fa('0x41')](db[_0xf0fa('0x15')]['rawAttributes']);_0x1d4830[_0xf0fa('0x1b')]=_['keys'](_0x4f5664[_0xf0fa('0x1b')]);_0x1d4830[_0xf0fa('0x1c')]=_[_0xf0fa('0x1d')](_0x1d4830[_0xf0fa('0x1a')],_0x1d4830[_0xf0fa('0x1b')]);_0x344bb0[_0xf0fa('0x2f')]=_[_0xf0fa('0x1d')](_0x1d4830[_0xf0fa('0x1a')],qs[_0xf0fa('0x30')](_0x4f5664['query']['fields']));_0x344bb0['attributes']=_0x344bb0[_0xf0fa('0x2f')][_0xf0fa('0x31')]?_0x344bb0['attributes']:_0x1d4830[_0xf0fa('0x1a')];if(_0x4f5664[_0xf0fa('0x1b')][_0xf0fa('0x3b')]){_0x344bb0[_0xf0fa('0x42')]=[{'all':!![]}];}_0x344bb0=_['merge']({},_0x344bb0,_0x4f5664[_0xf0fa('0x3a')]);return db[_0xf0fa('0x15')][_0xf0fa('0x43')](_0x344bb0)[_0xf0fa('0xd')](handleEntityNotFound(_0x53f408,null))[_0xf0fa('0xd')](respondWithResult(_0x53f408,null))[_0xf0fa('0x3e')](handleError(_0x53f408,null));};exports[_0xf0fa('0x44')]=function(_0x295edd,_0x1b435f){return db['CmHopper'][_0xf0fa('0x44')](_0x295edd[_0xf0fa('0x45')],{})[_0xf0fa('0xd')](respondWithResult(_0x1b435f,0xc9))[_0xf0fa('0x3e')](handleError(_0x1b435f,null));};exports[_0xf0fa('0xc')]=function(_0x2f8c74,_0x53b2a6){if(_0x2f8c74[_0xf0fa('0x45')]['id']){delete _0x2f8c74[_0xf0fa('0x45')]['id'];}return db['CmHopper'][_0xf0fa('0x43')]({'where':{'id':_0x2f8c74[_0xf0fa('0x40')]['id']}})[_0xf0fa('0xd')](handleEntityNotFound(_0x53b2a6,null))[_0xf0fa('0xd')](saveUpdates(_0x2f8c74[_0xf0fa('0x45')],null))[_0xf0fa('0xd')](respondWithResult(_0x53b2a6,null))[_0xf0fa('0x3e')](handleError(_0x53b2a6,null));};exports[_0xf0fa('0x46')]=function(_0x35272e,_0x4cd85e){return db[_0xf0fa('0x15')]['describe']()[_0xf0fa('0xd')](respondWithResult(_0x4cd85e,null))[_0xf0fa('0x3e')](handleError(_0x4cd85e,null));};exports[_0xf0fa('0x47')]=function(_0x569ba9,_0x324765){var _0x20ea09;var _0x354f03=_0x569ba9[_0xf0fa('0x40')]['id'];return db[_0xf0fa('0x15')]['find']({'where':{'id':_0x569ba9[_0xf0fa('0x40')]['id']}})['then'](handleEntityNotFound(_0x324765,null))[_0xf0fa('0xd')](function(_0x821e40){if(_0x821e40){return _0x821e40[_0xf0fa('0x47')]()[_0xf0fa('0xd')](function(_0x8090a7){return _0x8090a7;});}})['then'](function(_0x368f0c){_0x20ea09=_0x368f0c;if(_0x368f0c){if(_0x368f0c[_0xf0fa('0x48')]||_0x368f0c[_0xf0fa('0x49')]){return db[_0x368f0c[_0xf0fa('0x48')]?_0xf0fa('0x4a'):_0xf0fa('0x4b')]['find']({'where':{'id':_0x368f0c[_0xf0fa('0x48')]?_0x368f0c['VoiceQueueId']:_0x368f0c['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xf0fa('0xd')](function(_0x31b4b0){var _0xa256ee={};if(_0x31b4b0){_[_0xf0fa('0x38')](_0xa256ee,_[_0xf0fa('0x4c')](_0x20ea09[_0xf0fa('0x4d')],[_0xf0fa('0x4e'),_0xf0fa('0x4f'),'id']));_0xa256ee[_0xf0fa('0x50')]=0x15;_0xa256ee['statedesc']=_0xf0fa('0x51');_0xa256ee['campaign']=_0x31b4b0[_0xf0fa('0x11')];_0xa256ee[_0xf0fa('0x52')]=_0x569ba9[_0xf0fa('0x53')][_0xf0fa('0x11')];_0xa256ee['UserId']=_0x569ba9[_0xf0fa('0x53')]['id'];_0xa256ee['deleted']=!![];_0xa256ee[_0xf0fa('0x54')]=moment()[_0xf0fa('0x55')](_0xf0fa('0x56'));_0xa256ee[_0xf0fa('0x57')]=_0x20ea09[_0xf0fa('0x58')];_0xa256ee[_0xf0fa('0x59')]=_0x20ea09['VoiceQueueId']?_0xf0fa('0x5a'):_0xf0fa('0x5b');return db['CmContact'][_0xf0fa('0x43')]({'where':{'id':_0xa256ee[_0xf0fa('0x5c')]},'attributes':['firstName',_0xf0fa('0x5d')]})[_0xf0fa('0xd')](function(_0x57dccd){if(!_[_0xf0fa('0x5e')](_0x324765)&&!_[_0xf0fa('0x5e')](_0x57dccd[_0xf0fa('0x5f')])){_0xa256ee['calleridname']=_0x57dccd[_0xf0fa('0x5f')];if(!_[_0xf0fa('0x5e')](_0x57dccd['lastName'])){_0xa256ee[_0xf0fa('0x60')]+='\x20'+_0x57dccd[_0xf0fa('0x5d')];}}})[_0xf0fa('0x61')](function(){return db['CmHopperFinal'][_0xf0fa('0x44')](_0xa256ee);});}})[_0xf0fa('0xd')](function(_0x5c6dde){return db[_0xf0fa('0x62')][_0xf0fa('0x47')]({'where':{'CmHopperId':_0x354f03}});})[_0xf0fa('0xd')](function(){return _0x324765[_0xf0fa('0x6')](0xcc)[_0xf0fa('0x63')]();})[_0xf0fa('0x3e')](handleError(_0x324765,null));};exports[_0xf0fa('0x64')]=function(_0x337640,_0x32c846){var _0x2c2c30=[];return db['CmContact'][_0xf0fa('0x46')]()[_0xf0fa('0xd')](function(_0x298f47){_0x2c2c30=_[_0xf0fa('0x41')](_0x298f47);return _0x337640[_0xf0fa('0x53')][_0xf0fa('0x65')]({'where':{'type':_0xf0fa('0x66'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xf0fa('0x67'),_0xf0fa('0x68')],'raw':!![]});})[_0xf0fa('0xd')](function(_0x28fdf5){if(_0x28fdf5&&_0x28fdf5[_0xf0fa('0x31')]){return db[_0xf0fa('0x69')][_0xf0fa('0x6a')](function(_0x543a2c){var _0x5638e6={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf0fa('0x55')](_0xf0fa('0x56'))},'VoiceQueueId':{'$in':_[_0xf0fa('0x14')](_0x28fdf5,'id')},'$or':[{'UserId':null},{'UserId':_0x337640[_0xf0fa('0x53')]['id']}]};var _0x5bf7f2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x28fdf5)['filter'](['dialPreviewAutoRecallMe',0x0])[_0xf0fa('0x14')]('id')[_0xf0fa('0x6b')]()},'$or':[{'UserId':null},{'UserId':_0x337640[_0xf0fa('0x53')]['id']}]};var _0x189d30={'$or':[_0x5638e6,_0x5bf7f2]};var _0x508df9=[];if(_0x337640['body'][_0xf0fa('0x6c')]&&_0x337640['body'][_0xf0fa('0x6c')]===_0xf0fa('0x6d')){if(!_[_0xf0fa('0x6e')](_0x337640[_0xf0fa('0x45')][_0xf0fa('0x6f')])){_0x189d30['id']={'$in':_0x337640['body'][_0xf0fa('0x6f')]};}_0x508df9=[[_0xf0fa('0x70'),_0xf0fa('0x71')],[_0xf0fa('0x72'),_0x28fdf5[0x0][_0xf0fa('0x67')]===_0xf0fa('0x71')?_0xf0fa('0x73'):_0xf0fa('0x71')],db[_0xf0fa('0x69')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xf0fa('0x73')]];}else{if(!_['isEmpty'](_0x337640[_0xf0fa('0x45')]['hopperIds'])){_0x189d30['id']={'$notIn':_0x337640['body']['hopperIds']};}_0x508df9=[[_0xf0fa('0x70'),_0xf0fa('0x73')],[_0xf0fa('0x72'),_0x28fdf5[0x0][_0xf0fa('0x67')]],db[_0xf0fa('0x69')][_0xf0fa('0x74')](_0xf0fa('0x75')),['id',_0xf0fa('0x71')]];}return db[_0xf0fa('0x15')][_0xf0fa('0x76')]({'attributes':['id','scheduledat',_0xf0fa('0x58'),'recallme'],'where':_0x189d30,'order':_0x508df9,'transaction':_0x543a2c,'lock':_0x543a2c[_0xf0fa('0x77')]['UPDATE'],'include':[{'model':db[_0xf0fa('0x78')],'as':'Contact','attributes':_0x2c2c30,'include':[{'model':db[_0xf0fa('0x79')],'as':'Company','attributes':['id',_0xf0fa('0x11')]}]},{'model':db[_0xf0fa('0x7a')],'as':_0xf0fa('0x7b'),'attributes':['id',_0xf0fa('0x11')]},{'model':db[_0xf0fa('0x4a')],'as':'Queue','attributes':['id','name',_0xf0fa('0x7c')]}]})[_0xf0fa('0xd')](function(_0x5da2e6){if(_0x5da2e6){return _0x5da2e6['update']({'UserId':_0x337640[_0xf0fa('0x53')]['id']},{'transaction':_0x543a2c});}});});}})[_0xf0fa('0xd')](handleEntityNotFound(_0x32c846,null))[_0xf0fa('0xd')](respondWithResult(_0x32c846,null))[_0xf0fa('0x3e')](handleError(_0x32c846,null));};exports[_0xf0fa('0x7d')]=function(_0x56838f,_0x1a661d,_0x3bdb88){var _0x16492b=[];var _0x5ab304=_0x56838f['params']['id'];var _0x82277a=_0x56838f[_0xf0fa('0x53')]['id'];return db['CmContact']['describe']()[_0xf0fa('0xd')](function(_0x294c1a){_0x16492b=_[_0xf0fa('0x41')](_0x294c1a);return db['sequelize']['transaction'](function(_0x516eec){const _0x39711c={'id':_0x5ab304};return db['CmHopper']['findOne']({'attributes':['id',_0xf0fa('0x7e'),_0xf0fa('0x7f')],'where':_0x39711c,'transaction':_0x516eec,'lock':_0x516eec[_0xf0fa('0x77')][_0xf0fa('0x80')],'include':[{'model':db[_0xf0fa('0x78')],'as':_0xf0fa('0x81'),'attributes':_0x16492b,'include':[{'model':db['CmCompany'],'as':_0xf0fa('0x82'),'attributes':['id',_0xf0fa('0x11')]}]},{'model':db[_0xf0fa('0x7a')],'as':'List','attributes':['id',_0xf0fa('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xf0fa('0x11'),'dialActive']}]})['then'](function(_0x1f8977){if(_0x1f8977){return _0x1f8977[_0xf0fa('0xc')]({'UserId':_0x82277a},{'transaction':_0x516eec});}});});})[_0xf0fa('0xd')](handleEntityNotFound(_0x1a661d,null))['then'](respondWithResult(_0x1a661d,null))[_0xf0fa('0x3e')](handleError(_0x1a661d,null));};exports[_0xf0fa('0x83')]=function(_0x552b9e,_0x6fc2af){return _0x552b9e[_0xf0fa('0x53')][_0xf0fa('0x65')]({'where':{'type':_0xf0fa('0x66'),'dialActive':!![],'dialMethod':_0xf0fa('0x84')},'attributes':['id'],'raw':!![]})[_0xf0fa('0xd')](function(_0x56265f){if(_0x56265f&&_0x56265f[_0xf0fa('0x31')]){return db['CmHopper'][_0xf0fa('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf0fa('0x55')](_0xf0fa('0x56'))},'VoiceQueueId':{'$in':_[_0xf0fa('0x14')](_0x56265f,'id')},'$or':[{'UserId':null},{'UserId':_0x552b9e[_0xf0fa('0x53')]['id']}]}});}return 0x0;})[_0xf0fa('0xd')](function(_0x626079){if(!_['isNil'](_0x626079)&&_['isNumber'](_0x626079)){return _0x6fc2af[_0xf0fa('0x6')](0xc8)[_0xf0fa('0x85')]({'contacts':_0x626079});}else{logger['error'](_0xf0fa('0x86'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x6fc2af[_0xf0fa('0xe')](0x194);}})[_0xf0fa('0x3e')](handleError(_0x6fc2af,null));};exports['getTimezones']=function(_0x5a2717,_0x2fe9b0){var _0x5fbd7f=shared[_0xf0fa('0x87')];var _0x21778b=[];_[_0xf0fa('0x14')](_0x5fbd7f,function(_0x52343e){_0x21778b['push']({'id':_0x52343e[_0xf0fa('0x11')],'name':_0x52343e[_0xf0fa('0x11')],'utcOffset':_0x52343e['utcOffset']});});return _0x2fe9b0[_0xf0fa('0x6')](0xc8)['json']({'tz':_0x21778b});};exports[_0xf0fa('0x88')]=function(_0x57f309,_0x4867ca){var _0x2bb0bf=shared['timezones'];var _0x51db99={};if(!_['isNil'](_0x2bb0bf[_0x57f309['body']['id']]))_0x51db99=_0x2bb0bf[_0x57f309[_0xf0fa('0x45')]['id']];return _0x4867ca['status'](0xc8)[_0xf0fa('0x85')](_0x51db99);}; \ No newline at end of file +var _0xc3b5=['model','keys','query','intersection','filters','concat','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','format','direction','prev','isEmpty','priority','ASC','scheduledAt','literal','DESC','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','getPreviewRecall','transaction','recallme','Queue','dialActive','isNumber','status','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','getTimezones','timezones','push','getTimezone','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key'];(function(_0x5ec891,_0x1fd3b0){var _0x3782db=function(_0xd77e73){while(--_0xd77e73){_0x5ec891['push'](_0x5ec891['shift']());}};_0x3782db(++_0x1fd3b0);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x38d7be,_0x5b1b6b){_0x38d7be=_0x38d7be-0x0;var _0x11d972=_0xc3b5[_0x38d7be];return _0x11d972;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require(_0x5c3b('0x0'));var logger=require(_0x5c3b('0x1'))(_0x5c3b('0x2'));var shared=require(_0x5c3b('0x3'));var db=require(_0x5c3b('0x4'))['db'];function respondWithResult(_0x34be81,_0x237a61){_0x237a61=_0x237a61||0xc8;return function(_0x48f8a1){if(_0x48f8a1){return _0x34be81['status'](_0x237a61)[_0x5c3b('0x5')](_0x48f8a1);}};}function respondWithFilteredResult(_0x6b8a1e,_0x56345e){return function(_0x568a28){if(_0x568a28){var _0x30a08f=typeof _0x56345e[_0x5c3b('0x6')]===_0x5c3b('0x7')&&typeof _0x56345e['limit']===_0x5c3b('0x7');var _0x438255=_0x568a28[_0x5c3b('0x8')];var _0x20e71=_0x30a08f?0x0:_0x56345e['offset'];var _0x20dd86=_0x30a08f?_0x568a28[_0x5c3b('0x8')]:_0x56345e[_0x5c3b('0x6')]+_0x56345e[_0x5c3b('0x9')];var _0x363c3d;if(_0x20dd86>=_0x438255){_0x20dd86=_0x438255;_0x363c3d=0xc8;}else{_0x363c3d=0xce;}_0x6b8a1e['status'](_0x363c3d);return _0x6b8a1e[_0x5c3b('0xa')](_0x5c3b('0xb'),_0x20e71+'-'+_0x20dd86+'/'+_0x438255)['json'](_0x568a28);}return null;};}function saveUpdates(_0x1b2815,_0x3b953d){return function(_0x507c2e){if(_0x507c2e){return _0x507c2e[_0x5c3b('0xc')](_0x1b2815)[_0x5c3b('0xd')](function(_0x3e24bd){return _0x3e24bd;});}return null;};}function handleEntityNotFound(_0x2384b9,_0x315e68){return function(_0x3fef28){if(!_0x3fef28){_0x2384b9[_0x5c3b('0xe')](0x194);}return _0x3fef28;};}function handleError(_0x4f20eb,_0x2f7ab2){_0x2f7ab2=_0x2f7ab2||0x1f4;return function(_0x5b55be){logger['error'](_0x5b55be[_0x5c3b('0xf')]);if(_0x5b55be[_0x5c3b('0x10')]){delete _0x5b55be[_0x5c3b('0x10')];}_0x4f20eb['status'](_0x2f7ab2)[_0x5c3b('0x11')](_0x5b55be);};}exports[_0x5c3b('0x12')]=function(_0x5b5810,_0x59f71b){var _0x385053={},_0x34144d={},_0x48d662={'count':0x0,'rows':[]};var _0x3973bc=_[_0x5c3b('0x13')](db[_0x5c3b('0x14')][_0x5c3b('0x15')],function(_0x103943){return{'name':_0x103943[_0x5c3b('0x16')],'type':_0x103943[_0x5c3b('0x17')][_0x5c3b('0x18')]};});_0x34144d[_0x5c3b('0x19')]=_[_0x5c3b('0x13')](_0x3973bc,'name');_0x34144d['query']=_[_0x5c3b('0x1a')](_0x5b5810[_0x5c3b('0x1b')]);_0x34144d['filters']=_[_0x5c3b('0x1c')](_0x34144d['model'],_0x34144d[_0x5c3b('0x1b')]);_0x34144d[_0x5c3b('0x1d')]=_[_0x5c3b('0x1e')](_0x34144d[_0x5c3b('0x1d')],['$and',_0x5c3b('0x1f'),_0x5c3b('0x20'),'$gte',_0x5c3b('0x21'),_0x5c3b('0x22'),_0x5c3b('0x23'),_0x5c3b('0x24'),'$not',_0x5c3b('0x25'),_0x5c3b('0x26'),_0x5c3b('0x27'),_0x5c3b('0x28'),_0x5c3b('0x29'),_0x5c3b('0x2a'),'$iLike','$notILike','$like',_0x5c3b('0x2b'),_0x5c3b('0x2c'),'$contained',_0x5c3b('0x2d')]);_0x385053[_0x5c3b('0x2e')]=_[_0x5c3b('0x1c')](_0x34144d[_0x5c3b('0x19')],qs[_0x5c3b('0x2f')](_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x2f')]));_0x385053[_0x5c3b('0x2e')]=_0x385053[_0x5c3b('0x2e')][_0x5c3b('0x30')]?_0x385053[_0x5c3b('0x2e')]:_0x34144d[_0x5c3b('0x19')];if(!_0x5b5810['query'][_0x5c3b('0x31')](_0x5c3b('0x32'))){_0x385053[_0x5c3b('0x9')]=qs[_0x5c3b('0x9')](_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x9')]);_0x385053[_0x5c3b('0x6')]=qs[_0x5c3b('0x6')](_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x6')]);}_0x385053[_0x5c3b('0x33')]=qs[_0x5c3b('0x34')](_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x34')]);_0x385053[_0x5c3b('0x35')]=qs[_0x5c3b('0x1d')](_[_0x5c3b('0x36')](_0x5b5810['query'],_0x34144d[_0x5c3b('0x1d')]),_0x3973bc);if(_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x37')]){_0x385053[_0x5c3b('0x35')]=_['merge'](_0x385053[_0x5c3b('0x35')],{'$or':_[_0x5c3b('0x13')](_0x3973bc,function(_0x478aca){if(_0x478aca[_0x5c3b('0x17')]!==_0x5c3b('0x38')){var _0x32581a={};_0x32581a[_0x478aca[_0x5c3b('0x10')]]={'$like':'%'+_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x37')]+'%'};return _0x32581a;}})});}_0x385053=_[_0x5c3b('0x39')]({},_0x385053,_0x5b5810[_0x5c3b('0x3a')]);var _0x1fa1df={'where':_0x385053['where']};return db[_0x5c3b('0x14')][_0x5c3b('0x8')](_0x1fa1df)['then'](function(_0x59e079){_0x48d662[_0x5c3b('0x8')]=_0x59e079;if(_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x3b')]){_0x385053[_0x5c3b('0x3c')]=[{'all':!![]}];}return db[_0x5c3b('0x14')][_0x5c3b('0x3d')](_0x385053);})[_0x5c3b('0xd')](function(_0x5e78de){_0x48d662['rows']=_0x5e78de;return _0x48d662;})[_0x5c3b('0xd')](respondWithFilteredResult(_0x59f71b,_0x385053))[_0x5c3b('0x3e')](handleError(_0x59f71b,null));};exports[_0x5c3b('0x3f')]=function(_0x3902d7,_0x526436){var _0x16400b={'raw':!![],'where':{'id':_0x3902d7[_0x5c3b('0x40')]['id']}},_0x4b9a81={};_0x4b9a81[_0x5c3b('0x19')]=_[_0x5c3b('0x1a')](db[_0x5c3b('0x14')][_0x5c3b('0x15')]);_0x4b9a81[_0x5c3b('0x1b')]=_[_0x5c3b('0x1a')](_0x3902d7[_0x5c3b('0x1b')]);_0x4b9a81[_0x5c3b('0x1d')]=_['intersection'](_0x4b9a81['model'],_0x4b9a81[_0x5c3b('0x1b')]);_0x16400b[_0x5c3b('0x2e')]=_[_0x5c3b('0x1c')](_0x4b9a81[_0x5c3b('0x19')],qs[_0x5c3b('0x2f')](_0x3902d7[_0x5c3b('0x1b')][_0x5c3b('0x2f')]));_0x16400b[_0x5c3b('0x2e')]=_0x16400b[_0x5c3b('0x2e')]['length']?_0x16400b[_0x5c3b('0x2e')]:_0x4b9a81[_0x5c3b('0x19')];if(_0x3902d7[_0x5c3b('0x1b')]['includeAll']){_0x16400b[_0x5c3b('0x3c')]=[{'all':!![]}];}_0x16400b=_[_0x5c3b('0x39')]({},_0x16400b,_0x3902d7[_0x5c3b('0x3a')]);return db[_0x5c3b('0x14')][_0x5c3b('0x41')](_0x16400b)[_0x5c3b('0xd')](handleEntityNotFound(_0x526436,null))[_0x5c3b('0xd')](respondWithResult(_0x526436,null))[_0x5c3b('0x3e')](handleError(_0x526436,null));};exports[_0x5c3b('0x42')]=function(_0x28c68a,_0x18e704){return db['CmHopper'][_0x5c3b('0x42')](_0x28c68a['body'],{})[_0x5c3b('0xd')](respondWithResult(_0x18e704,0xc9))[_0x5c3b('0x3e')](handleError(_0x18e704,null));};exports['update']=function(_0x1b24e6,_0x285346){if(_0x1b24e6[_0x5c3b('0x43')]['id']){delete _0x1b24e6['body']['id'];}return db[_0x5c3b('0x14')]['find']({'where':{'id':_0x1b24e6[_0x5c3b('0x40')]['id']}})[_0x5c3b('0xd')](handleEntityNotFound(_0x285346,null))[_0x5c3b('0xd')](saveUpdates(_0x1b24e6[_0x5c3b('0x43')],null))[_0x5c3b('0xd')](respondWithResult(_0x285346,null))[_0x5c3b('0x3e')](handleError(_0x285346,null));};exports[_0x5c3b('0x44')]=function(_0x3d6034,_0x42d34f){return db[_0x5c3b('0x14')][_0x5c3b('0x44')]()['then'](respondWithResult(_0x42d34f,null))[_0x5c3b('0x3e')](handleError(_0x42d34f,null));};exports['destroy']=function(_0x155b22,_0x11bf0a){var _0x2751a2;var _0x4b85c1=_0x155b22[_0x5c3b('0x40')]['id'];return db[_0x5c3b('0x14')]['find']({'where':{'id':_0x155b22[_0x5c3b('0x40')]['id']}})[_0x5c3b('0xd')](handleEntityNotFound(_0x11bf0a,null))[_0x5c3b('0xd')](function(_0x2744cd){if(_0x2744cd){return _0x2744cd[_0x5c3b('0x45')]()[_0x5c3b('0xd')](function(_0x37870f){return _0x37870f;});}})[_0x5c3b('0xd')](function(_0x3f3947){_0x2751a2=_0x3f3947;if(_0x3f3947){if(_0x3f3947[_0x5c3b('0x46')]||_0x3f3947[_0x5c3b('0x47')]){return db[_0x3f3947['VoiceQueueId']?'VoiceQueue':'Campaign'][_0x5c3b('0x41')]({'where':{'id':_0x3f3947[_0x5c3b('0x46')]?_0x3f3947['VoiceQueueId']:_0x3f3947[_0x5c3b('0x47')]},'attributes':['id',_0x5c3b('0x10')],'raw':!![]});}}})[_0x5c3b('0xd')](function(_0x2ff7e2){var _0x53c2c2={};if(_0x2ff7e2){_[_0x5c3b('0x39')](_0x53c2c2,_[_0x5c3b('0x48')](_0x2751a2['dataValues'],[_0x5c3b('0x49'),_0x5c3b('0x4a'),'id']));_0x53c2c2[_0x5c3b('0x4b')]=0x15;_0x53c2c2[_0x5c3b('0x4c')]=_0x5c3b('0x4d');_0x53c2c2[_0x5c3b('0x4e')]=_0x2ff7e2[_0x5c3b('0x10')];_0x53c2c2[_0x5c3b('0x4f')]=_0x155b22[_0x5c3b('0x50')][_0x5c3b('0x10')];_0x53c2c2[_0x5c3b('0x51')]=_0x155b22[_0x5c3b('0x50')]['id'];_0x53c2c2[_0x5c3b('0x4d')]=!![];_0x53c2c2['deletedat']=moment()['format'](_0x5c3b('0x52'));_0x53c2c2[_0x5c3b('0x53')]=_0x2751a2[_0x5c3b('0x54')];_0x53c2c2['campaigntype']=_0x2751a2['VoiceQueueId']?'queue':_0x5c3b('0x55');return db['CmContact'][_0x5c3b('0x41')]({'where':{'id':_0x53c2c2[_0x5c3b('0x56')]},'attributes':[_0x5c3b('0x57'),_0x5c3b('0x58')]})[_0x5c3b('0xd')](function(_0x4d7ecb){if(!_[_0x5c3b('0x59')](_0x11bf0a)&&!_['isNil'](_0x4d7ecb[_0x5c3b('0x57')])){_0x53c2c2['calleridname']=_0x4d7ecb[_0x5c3b('0x57')];if(!_[_0x5c3b('0x59')](_0x4d7ecb[_0x5c3b('0x58')])){_0x53c2c2[_0x5c3b('0x5a')]+='\x20'+_0x4d7ecb[_0x5c3b('0x58')];}}})[_0x5c3b('0x5b')](function(){return db[_0x5c3b('0x5c')][_0x5c3b('0x42')](_0x53c2c2);});}})[_0x5c3b('0xd')](function(_0x41e5e0){return db[_0x5c3b('0x5d')]['destroy']({'where':{'CmHopperId':_0x4b85c1}});})['then'](function(){return _0x11bf0a['status'](0xcc)[_0x5c3b('0x5e')]();})[_0x5c3b('0x3e')](handleError(_0x11bf0a,null));};exports[_0x5c3b('0x5f')]=function(_0x150868,_0x532120){var _0x4edba0=[];return db[_0x5c3b('0x60')]['describe']()['then'](function(_0x137458){_0x4edba0=_[_0x5c3b('0x1a')](_0x137458);return _0x150868[_0x5c3b('0x50')][_0x5c3b('0x61')]({'where':{'type':_0x5c3b('0x62'),'dialActive':!![],'dialMethod':_0x5c3b('0x63')},'attributes':['id',_0x5c3b('0x64'),_0x5c3b('0x65')],'raw':!![]});})[_0x5c3b('0xd')](function(_0x460461){if(_0x460461&&_0x460461[_0x5c3b('0x30')]){return db[_0x5c3b('0x66')]['transaction'](function(_0x3faa19){var _0x5564ad={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5c3b('0x67')](_0x5c3b('0x52'))},'VoiceQueueId':{'$in':_[_0x5c3b('0x13')](_0x460461,'id')},'$or':[{'UserId':null},{'UserId':_0x150868[_0x5c3b('0x50')]['id']}]};var _0x3ac366={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x460461)[_0x5c3b('0x37')]([_0x5c3b('0x65'),0x0])[_0x5c3b('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x150868[_0x5c3b('0x50')]['id']}]};var _0x5acd17={'$or':[_0x5564ad,_0x3ac366]};var _0x56c5bb=[];if(_0x150868[_0x5c3b('0x43')][_0x5c3b('0x68')]&&_0x150868[_0x5c3b('0x43')]['direction']===_0x5c3b('0x69')){if(!_[_0x5c3b('0x6a')](_0x150868[_0x5c3b('0x43')]['hopperIds'])){_0x5acd17['id']={'$in':_0x150868[_0x5c3b('0x43')]['hopperIds']};}_0x56c5bb=[[_0x5c3b('0x6b'),_0x5c3b('0x6c')],[_0x5c3b('0x6d'),_0x460461[0x0]['dialOrderByScheduledAt']===_0x5c3b('0x6c')?'DESC':_0x5c3b('0x6c')],db[_0x5c3b('0x66')][_0x5c3b('0x6e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x5c3b('0x6f')]];}else{if(!_['isEmpty'](_0x150868[_0x5c3b('0x43')][_0x5c3b('0x70')])){_0x5acd17['id']={'$notIn':_0x150868[_0x5c3b('0x43')][_0x5c3b('0x70')]};}_0x56c5bb=[[_0x5c3b('0x6b'),_0x5c3b('0x6f')],[_0x5c3b('0x6d'),_0x460461[0x0][_0x5c3b('0x64')]],db[_0x5c3b('0x66')][_0x5c3b('0x6e')](_0x5c3b('0x71')),['id',_0x5c3b('0x6c')]];}return db[_0x5c3b('0x14')]['findOne']({'attributes':['id',_0x5c3b('0x72'),_0x5c3b('0x54'),'recallme'],'where':_0x5acd17,'order':_0x56c5bb,'transaction':_0x3faa19,'lock':_0x3faa19[_0x5c3b('0x73')][_0x5c3b('0x74')],'include':[{'model':db[_0x5c3b('0x60')],'as':_0x5c3b('0x75'),'attributes':_0x4edba0,'include':[{'model':db[_0x5c3b('0x76')],'as':_0x5c3b('0x77'),'attributes':['id',_0x5c3b('0x10')]}]},{'model':db[_0x5c3b('0x78')],'as':_0x5c3b('0x79'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x5c3b('0xd')](function(_0x402717){if(_0x402717){return _0x402717[_0x5c3b('0xc')]({'UserId':_0x150868['user']['id']},{'transaction':_0x3faa19});}});});}})[_0x5c3b('0xd')](handleEntityNotFound(_0x532120,null))['then'](respondWithResult(_0x532120,null))[_0x5c3b('0x3e')](handleError(_0x532120,null));};exports[_0x5c3b('0x7a')]=function(_0x256ccb,_0x36ba41,_0x3419db){var _0xbc0e51=[];var _0x183fa9=_0x256ccb[_0x5c3b('0x40')]['id'];var _0x419955=_0x256ccb[_0x5c3b('0x50')]['id'];return db[_0x5c3b('0x60')][_0x5c3b('0x44')]()['then'](function(_0x2312d1){_0xbc0e51=_[_0x5c3b('0x1a')](_0x2312d1);return db[_0x5c3b('0x66')][_0x5c3b('0x7b')](function(_0x3d2b86){const _0xa84b04={'id':_0x183fa9};return db['CmHopper']['findOne']({'attributes':['id',_0x5c3b('0x72'),_0x5c3b('0x7c')],'where':_0xa84b04,'transaction':_0x3d2b86,'lock':_0x3d2b86['LOCK'][_0x5c3b('0x74')],'include':[{'model':db[_0x5c3b('0x60')],'as':_0x5c3b('0x75'),'attributes':_0xbc0e51,'include':[{'model':db['CmCompany'],'as':_0x5c3b('0x77'),'attributes':['id',_0x5c3b('0x10')]}]},{'model':db[_0x5c3b('0x78')],'as':_0x5c3b('0x79'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x5c3b('0x7d'),'attributes':['id',_0x5c3b('0x10'),_0x5c3b('0x7e')]}]})[_0x5c3b('0xd')](function(_0x31ab7c){if(_0x31ab7c){return _0x31ab7c[_0x5c3b('0xc')]({'UserId':_0x419955},{'transaction':_0x3d2b86});}});});})[_0x5c3b('0xd')](handleEntityNotFound(_0x36ba41,null))[_0x5c3b('0xd')](respondWithResult(_0x36ba41,null))[_0x5c3b('0x3e')](handleError(_0x36ba41,null));};exports['getOpenContacts']=function(_0xb9e542,_0x2348cb){return _0xb9e542[_0x5c3b('0x50')][_0x5c3b('0x61')]({'where':{'type':_0x5c3b('0x62'),'dialActive':!![],'dialMethod':_0x5c3b('0x63')},'attributes':['id'],'raw':!![]})[_0x5c3b('0xd')](function(_0x36c6cd){if(_0x36c6cd&&_0x36c6cd[_0x5c3b('0x30')]){return db['CmHopper'][_0x5c3b('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5c3b('0x67')](_0x5c3b('0x52'))},'VoiceQueueId':{'$in':_[_0x5c3b('0x13')](_0x36c6cd,'id')},'$or':[{'UserId':null},{'UserId':_0xb9e542['user']['id']}]}});}return 0x0;})['then'](function(_0x59ac9e){if(!_[_0x5c3b('0x59')](_0x59ac9e)&&_[_0x5c3b('0x7f')](_0x59ac9e)){return _0x2348cb[_0x5c3b('0x80')](0xc8)['json']({'contacts':_0x59ac9e});}else{logger[_0x5c3b('0x81')](_0x5c3b('0x82'),_0x5c3b('0x83'),0x194,'entity\x20not\x20found');_0x2348cb[_0x5c3b('0xe')](0x194);}})[_0x5c3b('0x3e')](handleError(_0x2348cb,null));};exports[_0x5c3b('0x84')]=function(_0x5e4c11,_0x3b91e6){var _0x3e272a=shared[_0x5c3b('0x85')];var _0x25aef8=[];_[_0x5c3b('0x13')](_0x3e272a,function(_0x4dfd97){_0x25aef8[_0x5c3b('0x86')]({'id':_0x4dfd97[_0x5c3b('0x10')],'name':_0x4dfd97['name'],'utcOffset':_0x4dfd97['utcOffset']});});return _0x3b91e6['status'](0xc8)[_0x5c3b('0x5')]({'tz':_0x25aef8});};exports[_0x5c3b('0x87')]=function(_0x133eaa,_0x3a44c4){var _0x57f7b3=shared[_0x5c3b('0x85')];var _0x309c51={};if(!_[_0x5c3b('0x59')](_0x57f7b3[_0x133eaa[_0x5c3b('0x43')]['id']]))_0x309c51=_0x57f7b3[_0x133eaa[_0x5c3b('0x43')]['id']];return _0x3a44c4[_0x5c3b('0x80')](0xc8)[_0x5c3b('0x5')](_0x309c51);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index e641314..772c4b8 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 _0xfdbd=['path','rimraf','./cmHopper.attributes','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4af147,_0x133ca9){var _0x460b1a=function(_0x19f1cb){while(--_0x19f1cb){_0x4af147['push'](_0x4af147['shift']());}};_0x460b1a(++_0x133ca9);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x4f46f1,_0x2a39b9){_0x4f46f1=_0x4f46f1-0x0;var _0x5e146b=_0xfdbd[_0x4f46f1];return _0x5e146b;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xdfdb('0xa'),'fields':[_0xdfdb('0xa')]},{'name':'phone','fields':[_0xdfdb('0xb')]},{'name':_0xdfdb('0xc'),'fields':[_0xdfdb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['path','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x45f31b,_0x549b96){var _0x3bab4a=function(_0x505055){while(--_0x505055){_0x45f31b['push'](_0x45f31b['shift']());}};_0x3bab4a(++_0x549b96);}(_0x1261,0x144));var _0x1126=function(_0x274208,_0x3182ff){_0x274208=_0x274208-0x0;var _0x209164=_0x1261[_0x274208];return _0x209164;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('CmHopper',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]},{'name':_0x1126('0xd'),'fields':[_0x1126('0xd')]},{'name':'priority','fields':[_0x1126('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8d80a75..95cebc3 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 _0x562c=['destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','User','Agent','name','voicePause','length','UserId','push','update','all','dataValues','active','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','List','NOW()','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','GetCmHopper','debug','stringify','catch','error','ShowCmHopper','find','info','message','CreateCmHopper','create','body','UpdateCmHopper'];(function(_0x339db5,_0x441041){var _0x142ff8=function(_0x4c8ac0){while(--_0x4c8ac0){_0x339db5['push'](_0x339db5['shift']());}};_0x142ff8(++_0x441041);}(_0x562c,0x121));var _0xc562=function(_0xb85b48,_0x3b5463){_0xb85b48=_0xb85b48-0x0;var _0x2b9e14=_0x562c[_0xb85b48];return _0x2b9e14;};'use strict';var _=require(_0xc562('0x0'));var util=require(_0xc562('0x1'));var moment=require(_0xc562('0x2'));var BPromise=require(_0xc562('0x3'));var db=require(_0xc562('0x4'))['db'];var logger=require(_0xc562('0x5'))(_0xc562('0x6'));exports['GetCmHopper']=function(_0x17fb6a){var _0x2665e3=this;return new Promise(function(_0x4ecf1e,_0x444624){return db[_0xc562('0x7')][_0xc562('0x8')]({'raw':_0x17fb6a['options']?_0x17fb6a[_0xc562('0x9')][_0xc562('0xa')]===undefined?!![]:![]:!![],'where':_0x17fb6a['options']?_0x17fb6a['options'][_0xc562('0xb')]||null:null,'attributes':_0x17fb6a[_0xc562('0x9')]?_0x17fb6a[_0xc562('0x9')][_0xc562('0xc')]||null:null,'limit':_0x17fb6a[_0xc562('0x9')]?_0x17fb6a[_0xc562('0x9')][_0xc562('0xd')]||null:null,'include':_0x17fb6a[_0xc562('0x9')]?_0x17fb6a[_0xc562('0x9')][_0xc562('0xe')]?_['map'](_0x17fb6a[_0xc562('0x9')]['include'],function(_0x2fe312){return{'model':db[_0x2fe312['model']],'as':_0x2fe312['as'],'attributes':_0x2fe312['attributes'],'include':_0x2fe312[_0xc562('0xe')]?_[_0xc562('0xf')](_0x2fe312['include'],function(_0x46defb){return{'model':db[_0x46defb[_0xc562('0x10')]],'as':_0x46defb['as'],'attributes':_0x46defb[_0xc562('0xc')],'include':_0x46defb[_0xc562('0xe')]?_['map'](_0x46defb['include'],function(_0x2ac8d9){return{'model':db[_0x2ac8d9[_0xc562('0x10')]],'as':_0x2ac8d9['as'],'attributes':_0x2ac8d9[_0xc562('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc562('0x11')](function(_0x5a8fcd){logger['info'](_0xc562('0x12'),_0x17fb6a);logger[_0xc562('0x13')]('GetCmHopper',_0x17fb6a,JSON[_0xc562('0x14')](_0x5a8fcd));_0x4ecf1e(_0x5a8fcd);})[_0xc562('0x15')](function(_0x338087){logger[_0xc562('0x16')](_0xc562('0x12'),_0x338087['message'],_0x17fb6a);_0x444624(_0x2665e3[_0xc562('0x16')](0x1f4,_0x338087['message']));});});};exports[_0xc562('0x17')]=function(_0x54aae6){var _0x18a971=this;return new Promise(function(_0x112f9f,_0x5c81a3){return db[_0xc562('0x7')][_0xc562('0x18')]({'raw':_0x54aae6[_0xc562('0x9')]?_0x54aae6['options'][_0xc562('0xa')]===undefined?!![]:![]:!![],'where':_0x54aae6[_0xc562('0x9')]?_0x54aae6['options']['where']||null:null,'attributes':_0x54aae6[_0xc562('0x9')]?_0x54aae6['options'][_0xc562('0xc')]||null:null,'include':_0x54aae6[_0xc562('0x9')]?_0x54aae6[_0xc562('0x9')][_0xc562('0xe')]?_[_0xc562('0xf')](_0x54aae6['options']['include'],function(_0x3d43a7){return{'model':db[_0x3d43a7[_0xc562('0x10')]],'as':_0x3d43a7['as'],'attributes':_0x3d43a7[_0xc562('0xc')],'include':_0x3d43a7[_0xc562('0xe')]?_[_0xc562('0xf')](_0x3d43a7[_0xc562('0xe')],function(_0x219895){return{'model':db[_0x219895['model']],'as':_0x219895['as'],'attributes':_0x219895[_0xc562('0xc')],'include':_0x219895[_0xc562('0xe')]?_[_0xc562('0xf')](_0x219895[_0xc562('0xe')],function(_0x301411){return{'model':db[_0x301411['model']],'as':_0x301411['as'],'attributes':_0x301411[_0xc562('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc562('0x11')](function(_0x11367b){logger[_0xc562('0x19')](_0xc562('0x17'),_0x54aae6);logger[_0xc562('0x13')](_0xc562('0x17'),_0x54aae6,JSON[_0xc562('0x14')](_0x11367b));_0x112f9f(_0x11367b);})[_0xc562('0x15')](function(_0x17824f){logger['error'](_0xc562('0x17'),_0x17824f[_0xc562('0x1a')],_0x54aae6);_0x5c81a3(_0x18a971[_0xc562('0x16')](0x1f4,_0x17824f[_0xc562('0x1a')]));});});};exports[_0xc562('0x1b')]=function(_0x249dd0){var _0x6d4c7=this;return new Promise(function(_0x3781a6,_0x3ceaa0){return db[_0xc562('0x7')][_0xc562('0x1c')](_0x249dd0[_0xc562('0x1d')],{'raw':_0x249dd0[_0xc562('0x9')]?_0x249dd0[_0xc562('0x9')][_0xc562('0xa')]===undefined?!![]:![]:!![]})['then'](function(_0x3b4cbd){logger['info'](_0xc562('0x1b'),_0x249dd0);logger['debug'](_0xc562('0x1b'),_0x249dd0,JSON[_0xc562('0x14')](_0x3b4cbd));_0x3781a6(_0x3b4cbd);})[_0xc562('0x15')](function(_0x3bf35f){logger[_0xc562('0x16')]('CreateCmHopper',_0x3bf35f[_0xc562('0x1a')],_0x249dd0);_0x3ceaa0(_0x6d4c7[_0xc562('0x16')](0x1f4,_0x3bf35f[_0xc562('0x1a')]));});});};exports[_0xc562('0x1e')]=function(_0x2a1654){var _0x17013f=this;return new Promise(function(_0x94707f,_0x449209){return db[_0xc562('0x7')]['update'](_0x2a1654[_0xc562('0x1d')],{'raw':_0x2a1654[_0xc562('0x9')]?_0x2a1654[_0xc562('0x9')][_0xc562('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a1654[_0xc562('0x9')]?_0x2a1654[_0xc562('0x9')][_0xc562('0xb')]||null:null,'attributes':_0x2a1654['options']?_0x2a1654[_0xc562('0x9')][_0xc562('0xc')]||null:null,'limit':_0x2a1654['options']?_0x2a1654['options'][_0xc562('0xd')]||null:null})['then'](function(_0x2a4c2f){logger['info']('UpdateCmHopper',_0x2a1654);logger[_0xc562('0x19')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc562('0x14')](_0x2a1654[_0xc562('0x9')]['where']),_0x2a1654[_0xc562('0x1d')]['active']);logger[_0xc562('0x13')](_0xc562('0x1e'),_0x2a1654,JSON[_0xc562('0x14')](_0x2a4c2f));_0x94707f(_0x2a4c2f);})[_0xc562('0x15')](function(_0x40f6d5){logger['error'](_0xc562('0x1e'),_0x40f6d5[_0xc562('0x1a')],_0x2a1654);_0x449209(_0x17013f['error'](0x1f4,_0x40f6d5[_0xc562('0x1a')]));});});};exports['DestroyCmHopper']=function(_0x2b3c6c){var _0x2b77bf=this;return new Promise(function(_0x1bc2c7,_0x1f4009){return db[_0xc562('0x7')][_0xc562('0x1f')]({'where':_0x2b3c6c[_0xc562('0x9')]?_0x2b3c6c[_0xc562('0x9')][_0xc562('0xb')]||null:null})[_0xc562('0x11')](function(_0x5946d8){logger[_0xc562('0x19')]('DestroyCmHopper',_0x2b3c6c);logger['debug'](_0xc562('0x20'),_0x2b3c6c,JSON['stringify'](_0x5946d8));_0x1bc2c7(_0x5946d8);})[_0xc562('0x15')](function(_0x2c1187){logger[_0xc562('0x16')](_0xc562('0x20'),_0x2c1187['message'],_0x2b3c6c);_0x1f4009(_0x2b77bf[_0xc562('0x16')](0x1f4,_0x2c1187[_0xc562('0x1a')]));});});};exports[_0xc562('0x21')]=function(_0x431d99){var _0x44ba8b=this;return new Promise(function(_0x4e7178,_0x423c2a){return db[_0xc562('0x22')][_0xc562('0x23')]()[_0xc562('0x11')](function(_0x4abc5e){return db[_0xc562('0x24')][_0xc562('0x25')](function(_0x1ed1b1){return db[_0xc562('0x7')][_0xc562('0x8')]({'where':_0x431d99[_0xc562('0x9')]?_0x431d99[_0xc562('0x9')][_0xc562('0xb')]||null:null,'attributes':_0x431d99[_0xc562('0x9')]?_0x431d99['options']['attributes']||null:null,'limit':_0x431d99['options']?_0x431d99[_0xc562('0x9')][_0xc562('0xd')]||null:null,'order':_0x431d99[_0xc562('0x9')]?_0x431d99[_0xc562('0x9')][_0xc562('0x26')]||null:null,'transaction':_0x1ed1b1,'lock':_0x1ed1b1[_0xc562('0x27')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xc562('0x28'),'attributes':_[_0xc562('0x29')](_0x4abc5e)},{'model':db[_0xc562('0x2a')],'as':_0xc562('0x2b'),'attributes':['id',_0xc562('0x2c'),_0xc562('0x2d')]}]})[_0xc562('0x11')](function(_0x54c995){var _0x2d6380=[];var _0x54ffe1=[];for(var _0x574fc2=0x0;_0x574fc2<_0x54c995[_0xc562('0x2e')];_0x574fc2+=0x1){var _0x5d4c01=_0x54c995[_0x574fc2][_0xc562('0x2f')];if(_0x5d4c01===null){_0x2d6380['push'](_0x54c995[_0x574fc2]['update'](_0x431d99[_0xc562('0x1d')],{'transaction':_0x1ed1b1}));}else if(!_0x54ffe1['includes'](_0x5d4c01)){_0x54ffe1['push'](_0x5d4c01);_0x2d6380[_0xc562('0x30')](_0x54c995[_0x574fc2][_0xc562('0x31')](_0x431d99['body'],{'transaction':_0x1ed1b1}));}}return BPromise[_0xc562('0x32')](_0x2d6380);});})[_0xc562('0x11')](function(_0x382083){logger[_0xc562('0x19')]('GetContactDialer',_0x431d99);if(_0x382083[_0xc562('0x2e')]>0x0){logger[_0xc562('0x19')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x382083[0x0][_0xc562('0x33')]['id'],_0x382083[0x0][_0xc562('0x33')]['ContactId'],_0x382083[0x0][_0xc562('0x33')][_0xc562('0x34')]);}logger['debug']('GetContactDialer',_0x431d99,JSON[_0xc562('0x14')](_0x382083));_0x4e7178(_0x382083);})['catch'](function(_0xa5f785){logger[_0xc562('0x16')](_0xc562('0x21'),_0xa5f785[_0xc562('0x1a')],_0x431d99);_0x423c2a(_0x44ba8b[_0xc562('0x16')](0x1f4,_0xa5f785[_0xc562('0x1a')]));});});});};exports[_0xc562('0x35')]=function(_0x1e326a){var _0x5e4841=this;return new Promise(function(_0x41ecf4,_0x3f1c91){return db[_0xc562('0x24')][_0xc562('0x25')](function(_0x1b884a){return db[_0xc562('0x36')][_0xc562('0x1c')](_0x1e326a[_0xc562('0x1d')],{'raw':_0x1e326a[_0xc562('0x9')]?_0x1e326a[_0xc562('0x9')][_0xc562('0xa')]===undefined?!![]:![]:!![],'transaction':_0x1b884a})['then'](function(){logger[_0xc562('0x19')](_0xc562('0x37'),JSON[_0xc562('0x14')](_0x1e326a[_0xc562('0x9')]['where']),_0x1e326a[_0xc562('0x9')][_0xc562('0xb')]['active']);return db[_0xc562('0x7')]['destroy']({'where':_0x1e326a['options']?_0x1e326a[_0xc562('0x9')]['where']||null:null,'transaction':_0x1b884a});});})[_0xc562('0x11')](function(_0x3fd515){logger[_0xc562('0x19')]('MoveContactManagedDialer',_0x1e326a);logger[_0xc562('0x13')]('MoveContactManagedDialer',_0x1e326a,JSON['stringify'](_0x3fd515));_0x41ecf4(_0x3fd515);})['catch'](function(_0x51e1bb){logger[_0xc562('0x16')]('MoveContactManagedDialer',_0x51e1bb[_0xc562('0x1a')],_0x1e326a);_0x3f1c91(_0x5e4841[_0xc562('0x16')](0x1f4,_0x51e1bb[_0xc562('0x1a')]));});});};exports[_0xc562('0x38')]=function(_0x4cdd3c){var _0x8a185b=this;return new Promise(function(_0x3c7918,_0x4f8ff8){return db[_0xc562('0x7')][_0xc562('0x8')]({'raw':_0x4cdd3c[_0xc562('0x9')]?_0x4cdd3c[_0xc562('0x9')][_0xc562('0xa')]===undefined?!![]:![]:!![],'where':_0x4cdd3c['options']?_0x4cdd3c[_0xc562('0x9')]['where']||null:null,'attributes':[[db[_0xc562('0x24')]['fn'](_0xc562('0x39'),db['sequelize']['fn']('IF',db[_0xc562('0x24')][_0xc562('0x3a')]('`scheduledat`\x20>=\x20'+util['format'](_0xc562('0x3b'),moment()[_0xc562('0x3c')](_0xc562('0x3d')))+_0xc562('0x3e')))),_0xc562('0x3f')]]})[_0xc562('0x11')](function(_0x3a4019){logger['info'](_0xc562('0x38'),_0x4cdd3c);logger[_0xc562('0x13')](_0xc562('0x38'),_0x4cdd3c,JSON[_0xc562('0x14')](_0x3a4019));_0x3c7918(_0x3a4019);})[_0xc562('0x15')](function(_0x3c21c4){logger[_0xc562('0x16')]('CountReScheduled',_0x3c21c4[_0xc562('0x1a')],_0x4cdd3c);_0x4f8ff8(_0x8a185b[_0xc562('0x16')](0x1f4,_0x3c21c4[_0xc562('0x1a')]));});});};exports[_0xc562('0x40')]=function(_0x584e7f){var _0x5de156=this;return new Promise(function(_0x3e7f80,_0x50a60b){return db[_0xc562('0x22')]['describe']()[_0xc562('0x11')](function(){return db[_0xc562('0x24')]['transaction'](function(_0x3b17b0){return db[_0xc562('0x7')]['findAll']({'where':_0x584e7f[_0xc562('0x9')]?_0x584e7f[_0xc562('0x9')][_0xc562('0xb')]||null:null,'attributes':_0x584e7f['options']?_0x584e7f[_0xc562('0x9')]['attributes']||null:null,'limit':0x1,'order':_0x584e7f[_0xc562('0x9')]?_0x584e7f['options'][_0xc562('0x26')]||null:null,'group':db[_0xc562('0x7')][_0xc562('0x2f')],'transaction':_0x3b17b0,'lock':_0x3b17b0[_0xc562('0x27')][_0xc562('0x41')],'include':_0x584e7f[_0xc562('0x9')]?_0x584e7f[_0xc562('0x9')][_0xc562('0xe')]?_['map'](_0x584e7f[_0xc562('0x9')][_0xc562('0xe')],function(_0x16c795){return{'model':db[_0x16c795['model']],'as':_0x16c795['as'],'attributes':_0x16c795[_0xc562('0xc')],'include':_0x16c795[_0xc562('0xe')]?_[_0xc562('0xf')](_0x16c795[_0xc562('0xe')],function(_0x14315f){return{'model':db[_0x14315f['model']],'as':_0x14315f['as'],'attributes':_0x14315f[_0xc562('0xc')],'include':_0x14315f[_0xc562('0xe')]?_['map'](_0x14315f[_0xc562('0xe')],function(_0x509cc9){return{'model':db[_0x509cc9[_0xc562('0x10')]],'as':_0x509cc9['as'],'attributes':_0x509cc9[_0xc562('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc562('0x11')](function(_0x461491){var _0x37ba38=[];for(var _0x31365e=0x0;_0x31365e<_0x461491['length'];_0x31365e+=0x1){_0x37ba38[_0xc562('0x30')](_0x461491[_0x31365e][_0xc562('0x31')](_0x584e7f['body'],{'transaction':_0x3b17b0}));}return BPromise['all'](_0x37ba38);});})[_0xc562('0x11')](function(_0x2386ab){logger[_0xc562('0x19')]('GetContactRecallMe',_0x584e7f);logger['debug']('GetContactRecallMe',_0x584e7f,JSON['stringify'](_0x2386ab));_0x3e7f80(_0x2386ab);})['catch'](function(_0x33a7f1){logger[_0xc562('0x16')]('GetContactRecallMe',_0x33a7f1[_0xc562('0x1a')],_0x584e7f);_0x50a60b(_0x5de156[_0xc562('0x16')](0x1f4,_0x33a7f1[_0xc562('0x1a')]));});});});};exports['GetCmHopperPreview']=function(_0x444767){var _0x363f7c=this;return new Promise(function(_0x1893bd,_0x5864f2){db[_0xc562('0x22')][_0xc562('0x23')]()[_0xc562('0x11')](function(_0x196423){return db[_0xc562('0x7')][_0xc562('0x8')]({'raw':_0x444767[_0xc562('0x9')]?_0x444767['options']['raw']===undefined?!![]:![]:!![],'where':_0x444767[_0xc562('0x9')]?_0x444767[_0xc562('0x9')][_0xc562('0xb')]||null:null,'attributes':_0x444767['options']?_0x444767['options'][_0xc562('0xc')]||null:null,'limit':_0x444767['options']?_0x444767[_0xc562('0x9')][_0xc562('0xd')]||null:null,'include':_0x444767[_0xc562('0x9')]?_0x444767[_0xc562('0x9')][_0xc562('0xe')]?_[_0xc562('0xf')](_0x444767['options'][_0xc562('0xe')],function(_0x2c7aee){return{'model':db[_0x2c7aee[_0xc562('0x10')]],'as':_0x2c7aee['as'],'attributes':_0x2c7aee['as']===_0xc562('0x28')?_[_0xc562('0x29')](_0x196423):_0x2c7aee['attributes'],'include':_0x2c7aee[_0xc562('0xe')]?_['map'](_0x2c7aee[_0xc562('0xe')],function(_0x5d175d){return{'model':db[_0x5d175d['model']],'as':_0x5d175d['as'],'attributes':_0x5d175d[_0xc562('0xc')],'include':_0x5d175d['include']?_[_0xc562('0xf')](_0x5d175d[_0xc562('0xe')],function(_0x15429f){return{'model':db[_0x15429f[_0xc562('0x10')]],'as':_0x15429f['as'],'attributes':_0x15429f['attributes']};}):[]};}):[]};}):[]:[]})[_0xc562('0x11')](function(_0xf169e5){logger[_0xc562('0x19')](_0xc562('0x12'),_0x444767);logger[_0xc562('0x13')](_0xc562('0x12'),_0x444767,JSON['stringify'](_0xf169e5));_0x1893bd(_0xf169e5);})[_0xc562('0x15')](function(_0x1c0e83){logger[_0xc562('0x16')](_0xc562('0x12'),_0x1c0e83[_0xc562('0x1a')],_0x444767);_0x5864f2(_0x363f7c[_0xc562('0x16')](0x1f4,_0x1c0e83[_0xc562('0x1a')]));});});});};exports[_0xc562('0x42')]=function(_0x1c88c2){var _0x48602f=this;return new Promise(function(_0x16bb71,_0x58f662){return db[_0xc562('0x22')][_0xc562('0x43')]({'raw':!![],'where':{'phone':_0x1c88c2[_0xc562('0x9')][_0xc562('0xb')]['phone']},'attributes':['id',_0xc562('0x44')],'order':[['id',_0xc562('0x45')]]})[_0xc562('0x11')](function(_0x507d4d){logger[_0xc562('0x19')](_0xc562('0x46'),_0x1c88c2);logger[_0xc562('0x13')](_0xc562('0x46'),_0x1c88c2,JSON[_0xc562('0x14')](_0x507d4d));_0x16bb71(_0x507d4d);})[_0xc562('0x15')](function(_0x56e692){logger['error'](_0xc562('0x46'),_0x56e692['message'],_0x1c88c2);_0x58f662(_0x48602f[_0xc562('0x16')](0x1f4,_0x56e692[_0xc562('0x1a')]));});});};exports[_0xc562('0x47')]=function(_0xdab026){var _0x153821=this;return new Promise(function(_0x583fce,_0x22d406){return db[_0xc562('0x24')]['transaction'](function(_0x225ee3){var _0x2b12f0=_0xdab026[_0xc562('0x9')]&&_0xdab026[_0xc562('0x9')][_0xc562('0xb')]?_0xdab026[_0xc562('0x9')][_0xc562('0xb')]:{};return db[_0xc562('0x7')][_0xc562('0x31')](_0xdab026['body'],{'where':_0x2b12f0,'transaction':_0x225ee3})[_0xc562('0x11')](function(_0x41bde4){logger[_0xc562('0x19')](_0xc562('0x47'),_0xdab026);logger[_0xc562('0x13')]('ResetActiveCalls',_0xdab026,JSON['stringify'](_0x41bde4));_0x583fce(_0x41bde4);})[_0xc562('0x15')](function(_0x3ef2fb){logger['error'](_0xc562('0x47'),_0x3ef2fb[_0xc562('0x1a')],_0xdab026);_0x22d406(_0x153821[_0xc562('0x16')](0x1f4,_0x3ef2fb[_0xc562('0x1a')]));});});});};exports[_0xc562('0x48')]=function(_0x20d007){var _0x300f52=this;var _0x2052b7=_0x20d007['body'][_0xc562('0xb')][_0xc562('0x49')];var _0x21ec49=_0x20d007[_0xc562('0x1d')][_0xc562('0xb')][_0xc562('0x4a')];var _0x6d00e2=_0x20d007[_0xc562('0x1d')][_0xc562('0xb')][_0xc562('0x4b')];return new Promise(function(_0xb53a48,_0x22f461){return db[_0xc562('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x2052b7},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xc562('0x4c')+_0x21ec49+_0xc562('0x4d')),'$gt':db[_0xc562('0x24')][_0xc562('0x3a')]('NOW()')}},'UserId':{'$in':_0x6d00e2}},'include':[{'model':db[_0xc562('0x22')],'as':_0xc562('0x28')},{'model':db[_0xc562('0x2a')],'as':_0xc562('0x2b'),'attributes':['id',_0xc562('0x2c'),_0xc562('0x2d')]},{'model':db['CmList'],'as':_0xc562('0x4e')}]})[_0xc562('0x11')](function(_0x369fd2){if(_0x369fd2[_0xc562('0x2e')]>0x0){return db[_0xc562('0x24')][_0xc562('0x25')](function(_0x23bf92){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0xc562('0x24')]['literal'](_0xc562('0x4f'))},{'where':{'id':{'$in':_[_0xc562('0xf')](_0x369fd2,'id')}},'transaction':_0x23bf92})[_0xc562('0x11')](function(){_0xb53a48(_0x369fd2);})[_0xc562('0x15')](function(_0x26ab34){logger[_0xc562('0x16')](_0xc562('0x48'),_0x26ab34[_0xc562('0x1a')],_0x20d007);_0x22f461(_0x300f52['error'](0x1f4,_0x26ab34[_0xc562('0x1a')]));});})[_0xc562('0x15')](function(_0x29d1e8){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x29d1e8[_0xc562('0x1a')],_0x20d007);_0x22f461(_0x300f52[_0xc562('0x16')](0x1f4,_0x29d1e8[_0xc562('0x1a')]));});}else{_0xb53a48(_0x369fd2);}});});}; \ No newline at end of file +var _0x605f=['UpdateCmHopper','DestroyCmHopper','GetContactDialer','describe','sequelize','transaction','findAll','LOCK','CmContact','Contact','keys','User','Agent','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','order','UPDATE','GetCmHopperPreview','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()','name','CmList','List','util','moment','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','options','raw','attributes','limit','map','include','model','then','info','debug','stringify','catch','message','error','ShowCmHopper','find','create','body','update','where','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active'];(function(_0x302854,_0x503b53){var _0x3588b8=function(_0x531035){while(--_0x531035){_0x302854['push'](_0x302854['shift']());}};_0x3588b8(++_0x503b53);}(_0x605f,0x1a6));var _0xf605=function(_0x27981a,_0x3fa7c2){_0x27981a=_0x27981a-0x0;var _0x10bf7b=_0x605f[_0x27981a];return _0x10bf7b;};'use strict';var _=require('lodash');var util=require(_0xf605('0x0'));var moment=require(_0xf605('0x1'));var BPromise=require('bluebird');var db=require(_0xf605('0x2'))['db'];var logger=require(_0xf605('0x3'))('rpc');exports[_0xf605('0x4')]=function(_0x12242b){var _0x5bcbc6=this;return new Promise(function(_0x44d678,_0x28bd0e){return db[_0xf605('0x5')]['findAll']({'raw':_0x12242b[_0xf605('0x6')]?_0x12242b[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![],'where':_0x12242b[_0xf605('0x6')]?_0x12242b[_0xf605('0x6')]['where']||null:null,'attributes':_0x12242b[_0xf605('0x6')]?_0x12242b[_0xf605('0x6')][_0xf605('0x8')]||null:null,'limit':_0x12242b[_0xf605('0x6')]?_0x12242b[_0xf605('0x6')][_0xf605('0x9')]||null:null,'include':_0x12242b[_0xf605('0x6')]?_0x12242b[_0xf605('0x6')]['include']?_[_0xf605('0xa')](_0x12242b[_0xf605('0x6')][_0xf605('0xb')],function(_0x6cfbed){return{'model':db[_0x6cfbed[_0xf605('0xc')]],'as':_0x6cfbed['as'],'attributes':_0x6cfbed[_0xf605('0x8')],'include':_0x6cfbed['include']?_['map'](_0x6cfbed[_0xf605('0xb')],function(_0x6881db){return{'model':db[_0x6881db[_0xf605('0xc')]],'as':_0x6881db['as'],'attributes':_0x6881db['attributes'],'include':_0x6881db[_0xf605('0xb')]?_['map'](_0x6881db[_0xf605('0xb')],function(_0x94112c){return{'model':db[_0x94112c[_0xf605('0xc')]],'as':_0x94112c['as'],'attributes':_0x94112c[_0xf605('0x8')]};}):[]};}):[]};}):[]:[]})[_0xf605('0xd')](function(_0x116514){logger[_0xf605('0xe')](_0xf605('0x4'),_0x12242b);logger[_0xf605('0xf')](_0xf605('0x4'),_0x12242b,JSON[_0xf605('0x10')](_0x116514));_0x44d678(_0x116514);})[_0xf605('0x11')](function(_0x5f09c3){logger['error']('GetCmHopper',_0x5f09c3[_0xf605('0x12')],_0x12242b);_0x28bd0e(_0x5bcbc6[_0xf605('0x13')](0x1f4,_0x5f09c3[_0xf605('0x12')]));});});};exports[_0xf605('0x14')]=function(_0x1e7acd){var _0x437489=this;return new Promise(function(_0x1655a0,_0x477967){return db[_0xf605('0x5')][_0xf605('0x15')]({'raw':_0x1e7acd[_0xf605('0x6')]?_0x1e7acd['options'][_0xf605('0x7')]===undefined?!![]:![]:!![],'where':_0x1e7acd['options']?_0x1e7acd[_0xf605('0x6')]['where']||null:null,'attributes':_0x1e7acd[_0xf605('0x6')]?_0x1e7acd['options'][_0xf605('0x8')]||null:null,'include':_0x1e7acd[_0xf605('0x6')]?_0x1e7acd[_0xf605('0x6')][_0xf605('0xb')]?_[_0xf605('0xa')](_0x1e7acd[_0xf605('0x6')]['include'],function(_0x751746){return{'model':db[_0x751746[_0xf605('0xc')]],'as':_0x751746['as'],'attributes':_0x751746['attributes'],'include':_0x751746['include']?_[_0xf605('0xa')](_0x751746[_0xf605('0xb')],function(_0x42bd98){return{'model':db[_0x42bd98[_0xf605('0xc')]],'as':_0x42bd98['as'],'attributes':_0x42bd98[_0xf605('0x8')],'include':_0x42bd98[_0xf605('0xb')]?_[_0xf605('0xa')](_0x42bd98['include'],function(_0x3d8fd0){return{'model':db[_0x3d8fd0[_0xf605('0xc')]],'as':_0x3d8fd0['as'],'attributes':_0x3d8fd0[_0xf605('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f43fa){logger['info'](_0xf605('0x14'),_0x1e7acd);logger[_0xf605('0xf')](_0xf605('0x14'),_0x1e7acd,JSON[_0xf605('0x10')](_0x5f43fa));_0x1655a0(_0x5f43fa);})[_0xf605('0x11')](function(_0x73aeb4){logger[_0xf605('0x13')](_0xf605('0x14'),_0x73aeb4[_0xf605('0x12')],_0x1e7acd);_0x477967(_0x437489['error'](0x1f4,_0x73aeb4[_0xf605('0x12')]));});});};exports['CreateCmHopper']=function(_0x1eb5a9){var _0x361e37=this;return new Promise(function(_0x1dc9e0,_0x218bbc){return db[_0xf605('0x5')][_0xf605('0x16')](_0x1eb5a9[_0xf605('0x17')],{'raw':_0x1eb5a9[_0xf605('0x6')]?_0x1eb5a9[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![]})[_0xf605('0xd')](function(_0x4e12d3){logger[_0xf605('0xe')]('CreateCmHopper',_0x1eb5a9);logger[_0xf605('0xf')]('CreateCmHopper',_0x1eb5a9,JSON['stringify'](_0x4e12d3));_0x1dc9e0(_0x4e12d3);})[_0xf605('0x11')](function(_0x4cfbb7){logger[_0xf605('0x13')]('CreateCmHopper',_0x4cfbb7['message'],_0x1eb5a9);_0x218bbc(_0x361e37[_0xf605('0x13')](0x1f4,_0x4cfbb7[_0xf605('0x12')]));});});};exports['UpdateCmHopper']=function(_0x77a8f6){var _0x32caa1=this;return new Promise(function(_0x23dd38,_0x31ac3a){return db[_0xf605('0x5')][_0xf605('0x18')](_0x77a8f6[_0xf605('0x17')],{'raw':_0x77a8f6['options']?_0x77a8f6[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x77a8f6['options']?_0x77a8f6[_0xf605('0x6')][_0xf605('0x19')]||null:null,'attributes':_0x77a8f6[_0xf605('0x6')]?_0x77a8f6['options'][_0xf605('0x8')]||null:null,'limit':_0x77a8f6[_0xf605('0x6')]?_0x77a8f6['options'][_0xf605('0x9')]||null:null})[_0xf605('0xd')](function(_0x117ef3){logger[_0xf605('0xe')]('UpdateCmHopper',_0x77a8f6);logger[_0xf605('0xe')](_0xf605('0x1a'),JSON[_0xf605('0x10')](_0x77a8f6[_0xf605('0x6')][_0xf605('0x19')]),_0x77a8f6[_0xf605('0x17')][_0xf605('0x1b')]);logger[_0xf605('0xf')](_0xf605('0x1c'),_0x77a8f6,JSON[_0xf605('0x10')](_0x117ef3));_0x23dd38(_0x117ef3);})['catch'](function(_0x418807){logger[_0xf605('0x13')](_0xf605('0x1c'),_0x418807[_0xf605('0x12')],_0x77a8f6);_0x31ac3a(_0x32caa1[_0xf605('0x13')](0x1f4,_0x418807[_0xf605('0x12')]));});});};exports[_0xf605('0x1d')]=function(_0x4efcb8){var _0x4691f3=this;return new Promise(function(_0xdee2da,_0x2704a8){return db[_0xf605('0x5')]['destroy']({'where':_0x4efcb8[_0xf605('0x6')]?_0x4efcb8[_0xf605('0x6')][_0xf605('0x19')]||null:null})[_0xf605('0xd')](function(_0x42b026){logger[_0xf605('0xe')](_0xf605('0x1d'),_0x4efcb8);logger[_0xf605('0xf')](_0xf605('0x1d'),_0x4efcb8,JSON[_0xf605('0x10')](_0x42b026));_0xdee2da(_0x42b026);})[_0xf605('0x11')](function(_0x48b418){logger['error']('DestroyCmHopper',_0x48b418[_0xf605('0x12')],_0x4efcb8);_0x2704a8(_0x4691f3[_0xf605('0x13')](0x1f4,_0x48b418[_0xf605('0x12')]));});});};exports[_0xf605('0x1e')]=function(_0x260346){var _0x163e6b=this;return new Promise(function(_0x41cab2,_0x585f3f){return db['CmContact'][_0xf605('0x1f')]()['then'](function(_0x42c9b6){return db[_0xf605('0x20')][_0xf605('0x21')](function(_0x17a1c6){return db[_0xf605('0x5')][_0xf605('0x22')]({'where':_0x260346[_0xf605('0x6')]?_0x260346[_0xf605('0x6')][_0xf605('0x19')]||null:null,'attributes':_0x260346[_0xf605('0x6')]?_0x260346[_0xf605('0x6')][_0xf605('0x8')]||null:null,'limit':_0x260346[_0xf605('0x6')]?_0x260346[_0xf605('0x6')][_0xf605('0x9')]||null:null,'order':_0x260346[_0xf605('0x6')]?_0x260346[_0xf605('0x6')]['order']||null:null,'transaction':_0x17a1c6,'lock':_0x17a1c6[_0xf605('0x23')]['UPDATE'],'include':[{'model':db[_0xf605('0x24')],'as':_0xf605('0x25'),'attributes':_[_0xf605('0x26')](_0x42c9b6)},{'model':db[_0xf605('0x27')],'as':_0xf605('0x28'),'attributes':['id','name',_0xf605('0x29')]}]})['then'](function(_0x2c16e0){var _0x5bde1a=[];var _0x1eb03d=[];for(var _0x3ea58c=0x0;_0x3ea58c<_0x2c16e0[_0xf605('0x2a')];_0x3ea58c+=0x1){var _0x1e7031=_0x2c16e0[_0x3ea58c][_0xf605('0x2b')];if(_0x1e7031===null){_0x5bde1a[_0xf605('0x2c')](_0x2c16e0[_0x3ea58c][_0xf605('0x18')](_0x260346[_0xf605('0x17')],{'transaction':_0x17a1c6}));}else if(!_0x1eb03d['includes'](_0x1e7031)){_0x1eb03d[_0xf605('0x2c')](_0x1e7031);_0x5bde1a[_0xf605('0x2c')](_0x2c16e0[_0x3ea58c][_0xf605('0x18')](_0x260346[_0xf605('0x17')],{'transaction':_0x17a1c6}));}}return BPromise[_0xf605('0x2d')](_0x5bde1a);});})[_0xf605('0xd')](function(_0x2e3896){logger[_0xf605('0xe')]('GetContactDialer',_0x260346);if(_0x2e3896[_0xf605('0x2a')]>0x0){logger[_0xf605('0xe')](_0xf605('0x2e'),_0x2e3896[0x0][_0xf605('0x2f')]['id'],_0x2e3896[0x0][_0xf605('0x2f')]['ContactId'],_0x2e3896[0x0][_0xf605('0x2f')][_0xf605('0x1b')]);}logger[_0xf605('0xf')](_0xf605('0x1e'),_0x260346,JSON[_0xf605('0x10')](_0x2e3896));_0x41cab2(_0x2e3896);})[_0xf605('0x11')](function(_0x51829f){logger[_0xf605('0x13')](_0xf605('0x1e'),_0x51829f[_0xf605('0x12')],_0x260346);_0x585f3f(_0x163e6b[_0xf605('0x13')](0x1f4,_0x51829f[_0xf605('0x12')]));});});});};exports[_0xf605('0x30')]=function(_0x25c205){var _0x52fc75=this;return new Promise(function(_0x424125,_0x111399){return db[_0xf605('0x20')][_0xf605('0x21')](function(_0x24ad7c){return db[_0xf605('0x31')]['create'](_0x25c205[_0xf605('0x17')],{'raw':_0x25c205[_0xf605('0x6')]?_0x25c205[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![],'transaction':_0x24ad7c})['then'](function(){logger[_0xf605('0xe')](_0xf605('0x32'),JSON['stringify'](_0x25c205[_0xf605('0x6')]['where']),_0x25c205[_0xf605('0x6')][_0xf605('0x19')]['active']);return db[_0xf605('0x5')][_0xf605('0x33')]({'where':_0x25c205[_0xf605('0x6')]?_0x25c205[_0xf605('0x6')][_0xf605('0x19')]||null:null,'transaction':_0x24ad7c});});})['then'](function(_0x4bf00b){logger[_0xf605('0xe')](_0xf605('0x30'),_0x25c205);logger[_0xf605('0xf')](_0xf605('0x30'),_0x25c205,JSON[_0xf605('0x10')](_0x4bf00b));_0x424125(_0x4bf00b);})[_0xf605('0x11')](function(_0x49a77f){logger['error'](_0xf605('0x30'),_0x49a77f[_0xf605('0x12')],_0x25c205);_0x111399(_0x52fc75[_0xf605('0x13')](0x1f4,_0x49a77f[_0xf605('0x12')]));});});};exports[_0xf605('0x34')]=function(_0x4b156e){var _0x505e81=this;return new Promise(function(_0x4eeacb,_0x56852a){return db[_0xf605('0x5')][_0xf605('0x22')]({'raw':_0x4b156e[_0xf605('0x6')]?_0x4b156e[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![],'where':_0x4b156e[_0xf605('0x6')]?_0x4b156e[_0xf605('0x6')][_0xf605('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf605('0x35'),db[_0xf605('0x20')]['fn']('IF',db['sequelize'][_0xf605('0x36')](_0xf605('0x37')+util[_0xf605('0x38')](_0xf605('0x39'),moment()[_0xf605('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xf605('0x3a')))),'contactsRescheduled']]})['then'](function(_0x224e85){logger[_0xf605('0xe')](_0xf605('0x34'),_0x4b156e);logger['debug'](_0xf605('0x34'),_0x4b156e,JSON[_0xf605('0x10')](_0x224e85));_0x4eeacb(_0x224e85);})[_0xf605('0x11')](function(_0x3fcc70){logger[_0xf605('0x13')](_0xf605('0x34'),_0x3fcc70[_0xf605('0x12')],_0x4b156e);_0x56852a(_0x505e81[_0xf605('0x13')](0x1f4,_0x3fcc70[_0xf605('0x12')]));});});};exports[_0xf605('0x3b')]=function(_0x42ecbc){var _0x470242=this;return new Promise(function(_0x2ee700,_0x136956){return db[_0xf605('0x24')][_0xf605('0x1f')]()['then'](function(){return db[_0xf605('0x20')][_0xf605('0x21')](function(_0x1760c1){return db['CmHopper']['findAll']({'where':_0x42ecbc['options']?_0x42ecbc[_0xf605('0x6')][_0xf605('0x19')]||null:null,'attributes':_0x42ecbc[_0xf605('0x6')]?_0x42ecbc['options'][_0xf605('0x8')]||null:null,'limit':0x1,'order':_0x42ecbc[_0xf605('0x6')]?_0x42ecbc['options'][_0xf605('0x3c')]||null:null,'group':db[_0xf605('0x5')][_0xf605('0x2b')],'transaction':_0x1760c1,'lock':_0x1760c1[_0xf605('0x23')][_0xf605('0x3d')],'include':_0x42ecbc[_0xf605('0x6')]?_0x42ecbc[_0xf605('0x6')][_0xf605('0xb')]?_[_0xf605('0xa')](_0x42ecbc['options']['include'],function(_0x33bee9){return{'model':db[_0x33bee9[_0xf605('0xc')]],'as':_0x33bee9['as'],'attributes':_0x33bee9[_0xf605('0x8')],'include':_0x33bee9[_0xf605('0xb')]?_[_0xf605('0xa')](_0x33bee9[_0xf605('0xb')],function(_0x3fd733){return{'model':db[_0x3fd733['model']],'as':_0x3fd733['as'],'attributes':_0x3fd733[_0xf605('0x8')],'include':_0x3fd733[_0xf605('0xb')]?_['map'](_0x3fd733[_0xf605('0xb')],function(_0x41c3f6){return{'model':db[_0x41c3f6[_0xf605('0xc')]],'as':_0x41c3f6['as'],'attributes':_0x41c3f6[_0xf605('0x8')]};}):[]};}):[]};}):[]:[]})[_0xf605('0xd')](function(_0x42c389){var _0x3ccff8=[];for(var _0x535384=0x0;_0x535384<_0x42c389[_0xf605('0x2a')];_0x535384+=0x1){_0x3ccff8['push'](_0x42c389[_0x535384][_0xf605('0x18')](_0x42ecbc[_0xf605('0x17')],{'transaction':_0x1760c1}));}return BPromise[_0xf605('0x2d')](_0x3ccff8);});})[_0xf605('0xd')](function(_0x474a2c){logger[_0xf605('0xe')]('GetContactRecallMe',_0x42ecbc);logger[_0xf605('0xf')](_0xf605('0x3b'),_0x42ecbc,JSON['stringify'](_0x474a2c));_0x2ee700(_0x474a2c);})[_0xf605('0x11')](function(_0x325b5e){logger[_0xf605('0x13')](_0xf605('0x3b'),_0x325b5e[_0xf605('0x12')],_0x42ecbc);_0x136956(_0x470242[_0xf605('0x13')](0x1f4,_0x325b5e[_0xf605('0x12')]));});});});};exports[_0xf605('0x3e')]=function(_0x2a7816){var _0xa28464=this;return new Promise(function(_0x2a4325,_0x276eab){db[_0xf605('0x24')][_0xf605('0x1f')]()[_0xf605('0xd')](function(_0x1fc54a){return db[_0xf605('0x5')][_0xf605('0x22')]({'raw':_0x2a7816[_0xf605('0x6')]?_0x2a7816[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![],'where':_0x2a7816[_0xf605('0x6')]?_0x2a7816[_0xf605('0x6')][_0xf605('0x19')]||null:null,'attributes':_0x2a7816[_0xf605('0x6')]?_0x2a7816[_0xf605('0x6')]['attributes']||null:null,'limit':_0x2a7816[_0xf605('0x6')]?_0x2a7816[_0xf605('0x6')][_0xf605('0x9')]||null:null,'include':_0x2a7816[_0xf605('0x6')]?_0x2a7816[_0xf605('0x6')][_0xf605('0xb')]?_['map'](_0x2a7816[_0xf605('0x6')]['include'],function(_0x177782){return{'model':db[_0x177782[_0xf605('0xc')]],'as':_0x177782['as'],'attributes':_0x177782['as']===_0xf605('0x25')?_[_0xf605('0x26')](_0x1fc54a):_0x177782[_0xf605('0x8')],'include':_0x177782[_0xf605('0xb')]?_[_0xf605('0xa')](_0x177782['include'],function(_0x183ae2){return{'model':db[_0x183ae2[_0xf605('0xc')]],'as':_0x183ae2['as'],'attributes':_0x183ae2[_0xf605('0x8')],'include':_0x183ae2[_0xf605('0xb')]?_[_0xf605('0xa')](_0x183ae2[_0xf605('0xb')],function(_0xb79e){return{'model':db[_0xb79e[_0xf605('0xc')]],'as':_0xb79e['as'],'attributes':_0xb79e[_0xf605('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1aa7aa){logger['info'](_0xf605('0x4'),_0x2a7816);logger[_0xf605('0xf')](_0xf605('0x4'),_0x2a7816,JSON['stringify'](_0x1aa7aa));_0x2a4325(_0x1aa7aa);})[_0xf605('0x11')](function(_0x1c3767){logger[_0xf605('0x13')](_0xf605('0x4'),_0x1c3767['message'],_0x2a7816);_0x276eab(_0xa28464[_0xf605('0x13')](0x1f4,_0x1c3767[_0xf605('0x12')]));});});});};exports[_0xf605('0x3f')]=function(_0xc4443b){var _0x31599d=this;return new Promise(function(_0x1ab61d,_0x49e09b){return db[_0xf605('0x24')]['findOne']({'raw':!![],'where':{'phone':_0xc4443b[_0xf605('0x6')][_0xf605('0x19')][_0xf605('0x40')]},'attributes':['id','dialTimezone'],'order':[['id',_0xf605('0x41')]]})[_0xf605('0xd')](function(_0x649cfc){logger[_0xf605('0xe')](_0xf605('0x42'),_0xc4443b);logger[_0xf605('0xf')](_0xf605('0x42'),_0xc4443b,JSON['stringify'](_0x649cfc));_0x1ab61d(_0x649cfc);})[_0xf605('0x11')](function(_0x56fc60){logger[_0xf605('0x13')](_0xf605('0x42'),_0x56fc60[_0xf605('0x12')],_0xc4443b);_0x49e09b(_0x31599d[_0xf605('0x13')](0x1f4,_0x56fc60[_0xf605('0x12')]));});});};exports[_0xf605('0x43')]=function(_0x45b500){var _0x9ab9c4=this;return new Promise(function(_0x16c298,_0xc46a5){return db[_0xf605('0x20')][_0xf605('0x21')](function(_0x8183a1){var _0xb386da=_0x45b500[_0xf605('0x6')]&&_0x45b500[_0xf605('0x6')][_0xf605('0x19')]?_0x45b500[_0xf605('0x6')][_0xf605('0x19')]:{};return db['CmHopper']['update'](_0x45b500[_0xf605('0x17')],{'where':_0xb386da,'transaction':_0x8183a1})['then'](function(_0x37a828){logger[_0xf605('0xe')]('ResetActiveCalls',_0x45b500);logger['debug'](_0xf605('0x43'),_0x45b500,JSON[_0xf605('0x10')](_0x37a828));_0x16c298(_0x37a828);})[_0xf605('0x11')](function(_0x1eaa72){logger[_0xf605('0x13')](_0xf605('0x43'),_0x1eaa72['message'],_0x45b500);_0xc46a5(_0x9ab9c4[_0xf605('0x13')](0x1f4,_0x1eaa72[_0xf605('0x12')]));});});});};exports[_0xf605('0x44')]=function(_0x5568e1){var _0x582537=this;var _0x5ca204=_0x5568e1[_0xf605('0x17')][_0xf605('0x19')]['voiceQueueIds'];var _0x4cb3bb=_0x5568e1[_0xf605('0x17')]['where'][_0xf605('0x45')];var _0x1fea36=_0x5568e1[_0xf605('0x17')]['where'][_0xf605('0x46')];return new Promise(function(_0x52a585,_0x7fc5f6){return db[_0xf605('0x5')][_0xf605('0x22')]({'where':{'voiceQueueId':{'$in':_0x5ca204},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xf605('0x36')]('NOW()\x20+\x20INTERVAL\x20'+_0x4cb3bb+'\x20MINUTE'),'$gt':db[_0xf605('0x20')]['literal'](_0xf605('0x47'))}},'UserId':{'$in':_0x1fea36}},'include':[{'model':db[_0xf605('0x24')],'as':_0xf605('0x25')},{'model':db[_0xf605('0x27')],'as':_0xf605('0x28'),'attributes':['id',_0xf605('0x48'),_0xf605('0x29')]},{'model':db[_0xf605('0x49')],'as':_0xf605('0x4a')}]})['then'](function(_0x5a8842){if(_0x5a8842[_0xf605('0x2a')]>0x0){return db[_0xf605('0x20')][_0xf605('0x21')](function(_0x8f44c2){return db[_0xf605('0x5')][_0xf605('0x18')]({'recallmeNotifiedDate':db[_0xf605('0x20')][_0xf605('0x36')](_0xf605('0x47'))},{'where':{'id':{'$in':_[_0xf605('0xa')](_0x5a8842,'id')}},'transaction':_0x8f44c2})[_0xf605('0xd')](function(){_0x52a585(_0x5a8842);})[_0xf605('0x11')](function(_0x10e574){logger['error'](_0xf605('0x44'),_0x10e574[_0xf605('0x12')],_0x5568e1);_0x7fc5f6(_0x582537['error'](0x1f4,_0x10e574[_0xf605('0x12')]));});})[_0xf605('0x11')](function(_0x1c2a88){logger[_0xf605('0x13')](_0xf605('0x44'),_0x1c2a88[_0xf605('0x12')],_0x5568e1);_0x7fc5f6(_0x582537[_0xf605('0x13')](0x1f4,_0x1c2a88[_0xf605('0x12')]));});}else{_0x52a585(_0x5a8842);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 088bfed..06c916b 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 _0x48ed=['getOpenContacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','express','Router','./cmHopper.controller','get','isAuthenticated','/describe','describe'];(function(_0x473ea3,_0x2b3481){var _0x2385ac=function(_0x31d70a){while(--_0x31d70a){_0x473ea3['push'](_0x473ea3['shift']());}};_0x2385ac(++_0x2b3481);}(_0x48ed,0x131));var _0xd48e=function(_0x2ed395,_0x24323b){_0x2ed395=_0x2ed395-0x0;var _0x14a5eb=_0x48ed[_0x2ed395];return _0x14a5eb;};'use strict';var express=require(_0xd48e('0x0'));var router=express[_0xd48e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd48e('0x2'));router[_0xd48e('0x3')]('/',auth[_0xd48e('0x4')](),controller['index']);router[_0xd48e('0x3')](_0xd48e('0x5'),auth[_0xd48e('0x4')](),controller[_0xd48e('0x6')]);router[_0xd48e('0x3')]('/opencontacts',auth[_0xd48e('0x4')](),controller[_0xd48e('0x7')]);router[_0xd48e('0x3')](_0xd48e('0x8'),auth[_0xd48e('0x4')](),controller[_0xd48e('0x9')]);router[_0xd48e('0x3')](_0xd48e('0xa'),auth[_0xd48e('0x4')](),controller[_0xd48e('0xb')]);router[_0xd48e('0x3')]('/:id/previewrecall',auth[_0xd48e('0x4')](),controller[_0xd48e('0xc')]);router[_0xd48e('0xd')]('/',auth[_0xd48e('0x4')](),controller[_0xd48e('0xe')]);router[_0xd48e('0xd')](_0xd48e('0xf'),auth['isAuthenticated'](),controller[_0xd48e('0x10')]);router[_0xd48e('0xd')](_0xd48e('0x11'),auth['isAuthenticated'](),controller[_0xd48e('0x12')]);router[_0xd48e('0x13')](_0xd48e('0xa'),auth['isAuthenticated'](),controller[_0xd48e('0x14')]);router[_0xd48e('0x15')](_0xd48e('0xa'),auth[_0xd48e('0x4')](),controller[_0xd48e('0x16')]);module[_0xd48e('0x17')]=router; \ No newline at end of file +var _0x42df=['getPreview','/timezone','getTimezone','put','/:id','update','express','Router','./cmHopper.controller','get','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','show','/:id/previewrecall','getPreviewRecall','create','post'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0x42df,0x1aa));var _0xf42d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x42df[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0xf42d('0x0'));var router=express[_0xf42d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xf42d('0x2'));router[_0xf42d('0x3')]('/',auth[_0xf42d('0x4')](),controller['index']);router[_0xf42d('0x3')]('/describe',auth[_0xf42d('0x4')](),controller[_0xf42d('0x5')]);router[_0xf42d('0x3')](_0xf42d('0x6'),auth['isAuthenticated'](),controller[_0xf42d('0x7')]);router[_0xf42d('0x3')](_0xf42d('0x8'),auth[_0xf42d('0x4')](),controller['getTimezones']);router[_0xf42d('0x3')]('/:id',auth[_0xf42d('0x4')](),controller[_0xf42d('0x9')]);router[_0xf42d('0x3')](_0xf42d('0xa'),auth[_0xf42d('0x4')](),controller[_0xf42d('0xb')]);router['post']('/',auth[_0xf42d('0x4')](),controller[_0xf42d('0xc')]);router[_0xf42d('0xd')]('/preview',auth[_0xf42d('0x4')](),controller[_0xf42d('0xe')]);router['post'](_0xf42d('0xf'),auth[_0xf42d('0x4')](),controller[_0xf42d('0x10')]);router[_0xf42d('0x11')](_0xf42d('0x12'),auth['isAuthenticated'](),controller[_0xf42d('0x13')]);router['delete'](_0xf42d('0x12'),auth[_0xf42d('0x4')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 3729e65..a9b8b01 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 _0xd115=['INTEGER','moment','sequelize','exports','STRING','DATE','format'];(function(_0x35964b,_0x229594){var _0x4abfb3=function(_0x25bb5f){while(--_0x25bb5f){_0x35964b['push'](_0x35964b['shift']());}};_0x4abfb3(++_0x229594);}(_0xd115,0x94));var _0x5d11=function(_0x3eedee,_0x300b45){_0x3eedee=_0x3eedee-0x0;var _0x17a503=_0xd115[_0x3eedee];return _0x17a503;};'use strict';var moment=require(_0x5d11('0x0'));var Sequelize=require(_0x5d11('0x1'));module[_0x5d11('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x5d11('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x5d11('0x4')],'defaultValue':moment()[_0x5d11('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x5d11('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5d11('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5d11('0x6')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5d11('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5d11('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5d11('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5d11('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5d11('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf71d=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x47979c,_0x279829){var _0xda3562=function(_0x39518b){while(--_0x39518b){_0x47979c['push'](_0x47979c['shift']());}};_0xda3562(++_0x279829);}(_0xf71d,0x116));var _0xdf71=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xf71d[_0x1f36bb];return _0xaf97fa;};'use strict';var moment=require('moment');var Sequelize=require(_0xdf71('0x0'));module[_0xdf71('0x1')]={'CmHopperId':{'type':Sequelize[_0xdf71('0x2')]},'phone':{'type':Sequelize[_0xdf71('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xdf71('0x4')],'defaultValue':moment()[_0xdf71('0x5')](_0xdf71('0x6'))},'countbusyretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 2ec0adf..3bfee75 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 _0xb5e1=['attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','CmHopperAdditionalPhone','findAll','rows','catch','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','end','error','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection'];(function(_0x153b6f,_0x324ea4){var _0x15809b=function(_0x3a26b4){while(--_0x3a26b4){_0x153b6f['push'](_0x153b6f['shift']());}};_0x15809b(++_0x324ea4);}(_0xb5e1,0x168));var _0x1b5e=function(_0x4f6885,_0x10b682){_0x4f6885=_0x4f6885-0x0;var _0x5817a7=_0xb5e1[_0x4f6885];return _0x5817a7;};'use strict';var emlformat=require(_0x1b5e('0x0'));var rimraf=require(_0x1b5e('0x1'));var zipdir=require(_0x1b5e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b5e('0x3'));var moment=require(_0x1b5e('0x4'));var BPromise=require(_0x1b5e('0x5'));var Mustache=require('mustache');var util=require(_0x1b5e('0x6'));var path=require(_0x1b5e('0x7'));var sox=require(_0x1b5e('0x8'));var csv=require(_0x1b5e('0x9'));var ejs=require(_0x1b5e('0xa'));var fs=require('fs');var fs_extra=require(_0x1b5e('0xb'));var _=require(_0x1b5e('0xc'));var squel=require(_0x1b5e('0xd'));var crypto=require(_0x1b5e('0xe'));var jsforce=require(_0x1b5e('0xf'));var deskjs=require(_0x1b5e('0x10'));var toCsv=require(_0x1b5e('0x9'));var querystring=require(_0x1b5e('0x11'));var Papa=require(_0x1b5e('0x12'));var Redis=require('ioredis');var authService=require(_0x1b5e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b5e('0x14'));var logger=require(_0x1b5e('0x15'))(_0x1b5e('0x16'));var utils=require('../../config/utils');var config=require(_0x1b5e('0x17'));var licenseUtil=require(_0x1b5e('0x18'));var db=require(_0x1b5e('0x19'))['db'];function respondWithStatusCode(_0x2fd552,_0x427098){_0x427098=_0x427098||0xcc;return function(_0x4f123f){if(_0x4f123f){return _0x2fd552['sendStatus'](_0x427098);}return _0x2fd552[_0x1b5e('0x1a')](_0x427098)['end']();};}function respondWithResult(_0x4cd302,_0x9f1c62){_0x9f1c62=_0x9f1c62||0xc8;return function(_0x39a81a){if(_0x39a81a){return _0x4cd302[_0x1b5e('0x1a')](_0x9f1c62)[_0x1b5e('0x1b')](_0x39a81a);}};}function respondWithFilteredResult(_0x59b807,_0x12413f){return function(_0x113f25){if(_0x113f25){var _0x45cb06=typeof _0x12413f['offset']===_0x1b5e('0x1c')&&typeof _0x12413f['limit']===_0x1b5e('0x1c');var _0x5c7090=_0x113f25[_0x1b5e('0x1d')];var _0x43130c=_0x45cb06?0x0:_0x12413f['offset'];var _0xc195c4=_0x45cb06?_0x113f25['count']:_0x12413f[_0x1b5e('0x1e')]+_0x12413f[_0x1b5e('0x1f')];var _0x4dc90a;if(_0xc195c4>=_0x5c7090){_0xc195c4=_0x5c7090;_0x4dc90a=0xc8;}else{_0x4dc90a=0xce;}_0x59b807[_0x1b5e('0x1a')](_0x4dc90a);return _0x59b807[_0x1b5e('0x20')](_0x1b5e('0x21'),_0x43130c+'-'+_0xc195c4+'/'+_0x5c7090)[_0x1b5e('0x1b')](_0x113f25);}return null;};}function patchUpdates(_0x3805a8){return function(_0x59cafe){try{jsonpatch[_0x1b5e('0x22')](_0x59cafe,_0x3805a8,!![]);}catch(_0x58257e){return BPromise[_0x1b5e('0x23')](_0x58257e);}return _0x59cafe[_0x1b5e('0x24')]();};}function saveUpdates(_0x1ad363,_0x3eb494){return function(_0x4e2222){if(_0x4e2222){return _0x4e2222[_0x1b5e('0x25')](_0x1ad363)[_0x1b5e('0x26')](function(_0x170c66){return _0x170c66;});}return null;};}function removeEntity(_0x1095ac,_0x1f0b79){return function(_0x46a2e7){if(_0x46a2e7){return _0x46a2e7[_0x1b5e('0x27')]()[_0x1b5e('0x26')](function(){var _0x1932ce=_0x46a2e7[_0x1b5e('0x28')]({'plain':!![]});var _0x2028fb=_0x1b5e('0x29');return db['UserProfileResource'][_0x1b5e('0x27')]({'where':{'type':_0x2028fb,'resourceId':_0x1932ce['id']}})[_0x1b5e('0x26')](function(){return _0x46a2e7;});})[_0x1b5e('0x26')](function(){_0x1095ac[_0x1b5e('0x1a')](0xcc)[_0x1b5e('0x2a')]();});}};}function handleEntityNotFound(_0x4feb5b,_0x405c36){return function(_0x4b9278){if(!_0x4b9278){_0x4feb5b['sendStatus'](0x194);}return _0x4b9278;};}function handleError(_0x685abc,_0x5b286e){_0x5b286e=_0x5b286e||0x1f4;return function(_0x30bf2e){logger[_0x1b5e('0x2b')](_0x30bf2e['stack']);if(_0x30bf2e['name']){delete _0x30bf2e[_0x1b5e('0x2c')];}_0x685abc[_0x1b5e('0x1a')](_0x5b286e)[_0x1b5e('0x2d')](_0x30bf2e);};}exports[_0x1b5e('0x2e')]=function(_0x2d9341,_0x2e3322){var _0x46fc2f={},_0x8d9ab4={},_0x5078d6={'count':0x0,'rows':[]};var _0x51aa38=_['map'](db['CmHopperAdditionalPhone'][_0x1b5e('0x2f')],function(_0x34acf0){return{'name':_0x34acf0[_0x1b5e('0x30')],'type':_0x34acf0[_0x1b5e('0x31')][_0x1b5e('0x32')]};});_0x8d9ab4[_0x1b5e('0x33')]=_['map'](_0x51aa38,_0x1b5e('0x2c'));_0x8d9ab4[_0x1b5e('0x34')]=_[_0x1b5e('0x35')](_0x2d9341[_0x1b5e('0x34')]);_0x8d9ab4['filters']=_[_0x1b5e('0x36')](_0x8d9ab4[_0x1b5e('0x33')],_0x8d9ab4[_0x1b5e('0x34')]);_0x46fc2f['attributes']=_[_0x1b5e('0x36')](_0x8d9ab4[_0x1b5e('0x33')],qs['fields'](_0x2d9341['query']['fields']));_0x46fc2f[_0x1b5e('0x37')]=_0x46fc2f[_0x1b5e('0x37')][_0x1b5e('0x38')]?_0x46fc2f['attributes']:_0x8d9ab4['model'];if(!_0x2d9341[_0x1b5e('0x34')][_0x1b5e('0x39')](_0x1b5e('0x3a'))){_0x46fc2f[_0x1b5e('0x1f')]=qs['limit'](_0x2d9341['query'][_0x1b5e('0x1f')]);_0x46fc2f[_0x1b5e('0x1e')]=qs[_0x1b5e('0x1e')](_0x2d9341[_0x1b5e('0x34')][_0x1b5e('0x1e')]);}_0x46fc2f['order']=qs[_0x1b5e('0x3b')](_0x2d9341[_0x1b5e('0x34')]['sort']);_0x46fc2f[_0x1b5e('0x3c')]=qs[_0x1b5e('0x3d')](_[_0x1b5e('0x3e')](_0x2d9341['query'],_0x8d9ab4[_0x1b5e('0x3d')]),_0x51aa38);if(_0x2d9341[_0x1b5e('0x34')][_0x1b5e('0x3f')]){_0x46fc2f[_0x1b5e('0x3c')]=_[_0x1b5e('0x40')](_0x46fc2f['where'],{'$or':_['map'](_0x51aa38,function(_0x320115){if(_0x320115[_0x1b5e('0x31')]!=='VIRTUAL'){var _0x13cf2b={};_0x13cf2b[_0x320115[_0x1b5e('0x2c')]]={'$like':'%'+_0x2d9341[_0x1b5e('0x34')][_0x1b5e('0x3f')]+'%'};return _0x13cf2b;}})});}_0x46fc2f=_[_0x1b5e('0x40')]({},_0x46fc2f,_0x2d9341[_0x1b5e('0x41')]);var _0x2955c2={'where':_0x46fc2f['where']};return db['CmHopperAdditionalPhone'][_0x1b5e('0x1d')](_0x2955c2)[_0x1b5e('0x26')](function(_0x358682){_0x5078d6[_0x1b5e('0x1d')]=_0x358682;if(_0x2d9341[_0x1b5e('0x34')][_0x1b5e('0x42')]){_0x46fc2f['include']=[{'all':!![]}];}return db[_0x1b5e('0x43')][_0x1b5e('0x44')](_0x46fc2f);})[_0x1b5e('0x26')](function(_0x119da4){_0x5078d6[_0x1b5e('0x45')]=_0x119da4;return _0x5078d6;})[_0x1b5e('0x26')](respondWithFilteredResult(_0x2e3322,_0x46fc2f))[_0x1b5e('0x46')](handleError(_0x2e3322,null));};exports[_0x1b5e('0x47')]=function(_0x995d78,_0x4dcda5){var _0x34a873={'raw':!![],'where':{'id':_0x995d78[_0x1b5e('0x48')]['id']}},_0x1fa283={};_0x1fa283[_0x1b5e('0x33')]=_[_0x1b5e('0x35')](db[_0x1b5e('0x43')][_0x1b5e('0x2f')]);_0x1fa283['query']=_['keys'](_0x995d78[_0x1b5e('0x34')]);_0x1fa283['filters']=_[_0x1b5e('0x36')](_0x1fa283[_0x1b5e('0x33')],_0x1fa283[_0x1b5e('0x34')]);_0x34a873[_0x1b5e('0x37')]=_[_0x1b5e('0x36')](_0x1fa283[_0x1b5e('0x33')],qs[_0x1b5e('0x49')](_0x995d78['query'][_0x1b5e('0x49')]));_0x34a873[_0x1b5e('0x37')]=_0x34a873[_0x1b5e('0x37')][_0x1b5e('0x38')]?_0x34a873['attributes']:_0x1fa283['model'];if(_0x995d78[_0x1b5e('0x34')][_0x1b5e('0x42')]){_0x34a873['include']=[{'all':!![]}];}_0x34a873=_[_0x1b5e('0x40')]({},_0x34a873,_0x995d78[_0x1b5e('0x41')]);return db[_0x1b5e('0x43')][_0x1b5e('0x4a')](_0x34a873)['then'](handleEntityNotFound(_0x4dcda5,null))[_0x1b5e('0x26')](respondWithResult(_0x4dcda5,null))[_0x1b5e('0x46')](handleError(_0x4dcda5,null));};exports[_0x1b5e('0x4b')]=function(_0x1e3a96,_0x1a7fc5){return db[_0x1b5e('0x43')][_0x1b5e('0x4b')](_0x1e3a96[_0x1b5e('0x4c')],{})[_0x1b5e('0x26')](function(_0x172060){var _0x30ffd6=_0x1e3a96[_0x1b5e('0x4d')][_0x1b5e('0x28')]({'plain':!![]});if(!_0x30ffd6)throw new Error(_0x1b5e('0x4e'));if(_0x30ffd6[_0x1b5e('0x4f')]===_0x1b5e('0x4d')){var _0x37fb8e=_0x172060['get']({'plain':!![]});var _0x598862=_0x1b5e('0x29');return db['UserProfileSection'][_0x1b5e('0x4a')]({'where':{'name':_0x598862,'userProfileId':_0x30ffd6[_0x1b5e('0x50')]},'raw':!![]})[_0x1b5e('0x26')](function(_0x21a066){if(_0x21a066&&_0x21a066[_0x1b5e('0x51')]===0x0){return db[_0x1b5e('0x52')][_0x1b5e('0x4b')]({'name':_0x37fb8e['name'],'resourceId':_0x37fb8e['id'],'type':_0x21a066[_0x1b5e('0x2c')],'sectionId':_0x21a066['id']},{})[_0x1b5e('0x26')](function(){return _0x172060;});}else{return _0x172060;}})['catch'](function(_0x19ff6e){logger[_0x1b5e('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19ff6e);throw _0x19ff6e;});}return _0x172060;})[_0x1b5e('0x26')](respondWithResult(_0x1a7fc5,0xc9))[_0x1b5e('0x46')](handleError(_0x1a7fc5,null));};exports[_0x1b5e('0x25')]=function(_0x48842b,_0x1afbb3){if(_0x48842b[_0x1b5e('0x4c')]['id']){delete _0x48842b['body']['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x48842b[_0x1b5e('0x48')]['id']}})[_0x1b5e('0x26')](handleEntityNotFound(_0x1afbb3,null))[_0x1b5e('0x26')](saveUpdates(_0x48842b[_0x1b5e('0x4c')],null))['then'](respondWithResult(_0x1afbb3,null))[_0x1b5e('0x46')](handleError(_0x1afbb3,null));};exports[_0x1b5e('0x27')]=function(_0x1b6309,_0x42493b){return db[_0x1b5e('0x43')][_0x1b5e('0x4a')]({'where':{'id':_0x1b6309[_0x1b5e('0x48')]['id']}})[_0x1b5e('0x26')](handleEntityNotFound(_0x42493b,null))[_0x1b5e('0x26')](removeEntity(_0x42493b,null))[_0x1b5e('0x46')](handleError(_0x42493b,null));}; \ No newline at end of file +var _0x104c=['index','map','CmHopperAdditionalPhone','fieldName','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x104c,0xd1));var _0xc104=function(_0x3dd3ed,_0x22611d){_0x3dd3ed=_0x3dd3ed-0x0;var _0x260711=_0x104c[_0x3dd3ed];return _0x260711;};'use strict';var emlformat=require(_0xc104('0x0'));var rimraf=require(_0xc104('0x1'));var zipdir=require(_0xc104('0x2'));var jsonpatch=require(_0xc104('0x3'));var rp=require(_0xc104('0x4'));var moment=require(_0xc104('0x5'));var BPromise=require(_0xc104('0x6'));var Mustache=require('mustache');var util=require(_0xc104('0x7'));var path=require(_0xc104('0x8'));var sox=require('sox');var csv=require(_0xc104('0x9'));var ejs=require(_0xc104('0xa'));var fs=require('fs');var fs_extra=require(_0xc104('0xb'));var _=require(_0xc104('0xc'));var squel=require(_0xc104('0xd'));var crypto=require('crypto');var jsforce=require(_0xc104('0xe'));var deskjs=require(_0xc104('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc104('0x10'));var Papa=require(_0xc104('0x11'));var Redis=require(_0xc104('0x12'));var authService=require(_0xc104('0x13'));var qs=require(_0xc104('0x14'));var as=require(_0xc104('0x15'));var hardwareService=require(_0xc104('0x16'));var logger=require(_0xc104('0x17'))(_0xc104('0x18'));var utils=require(_0xc104('0x19'));var config=require(_0xc104('0x1a'));var licenseUtil=require(_0xc104('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x239ed3,_0x30b5db){_0x30b5db=_0x30b5db||0xcc;return function(_0x483466){if(_0x483466){return _0x239ed3[_0xc104('0x1c')](_0x30b5db);}return _0x239ed3['status'](_0x30b5db)[_0xc104('0x1d')]();};}function respondWithResult(_0x4d6d62,_0x5524ea){_0x5524ea=_0x5524ea||0xc8;return function(_0x48efa6){if(_0x48efa6){return _0x4d6d62[_0xc104('0x1e')](_0x5524ea)[_0xc104('0x1f')](_0x48efa6);}};}function respondWithFilteredResult(_0x3c3f61,_0x160212){return function(_0x4db57e){if(_0x4db57e){var _0x58f45f=typeof _0x160212[_0xc104('0x20')]===_0xc104('0x21')&&typeof _0x160212[_0xc104('0x22')]===_0xc104('0x21');var _0x16d9a7=_0x4db57e[_0xc104('0x23')];var _0xff0db3=_0x58f45f?0x0:_0x160212['offset'];var _0x2eb3f3=_0x58f45f?_0x4db57e[_0xc104('0x23')]:_0x160212[_0xc104('0x20')]+_0x160212[_0xc104('0x22')];var _0x4241f3;if(_0x2eb3f3>=_0x16d9a7){_0x2eb3f3=_0x16d9a7;_0x4241f3=0xc8;}else{_0x4241f3=0xce;}_0x3c3f61['status'](_0x4241f3);return _0x3c3f61[_0xc104('0x24')]('Content-Range',_0xff0db3+'-'+_0x2eb3f3+'/'+_0x16d9a7)[_0xc104('0x1f')](_0x4db57e);}return null;};}function patchUpdates(_0x1284c5){return function(_0x417290){try{jsonpatch[_0xc104('0x25')](_0x417290,_0x1284c5,!![]);}catch(_0x1dc144){return BPromise['reject'](_0x1dc144);}return _0x417290[_0xc104('0x26')]();};}function saveUpdates(_0x4633e2,_0x227ce9){return function(_0x2b27e3){if(_0x2b27e3){return _0x2b27e3[_0xc104('0x27')](_0x4633e2)[_0xc104('0x28')](function(_0xd58e56){return _0xd58e56;});}return null;};}function removeEntity(_0x3e508f,_0x287157){return function(_0x3d0651){if(_0x3d0651){return _0x3d0651[_0xc104('0x29')]()[_0xc104('0x28')](function(){var _0x2d5b5a=_0x3d0651['get']({'plain':!![]});var _0x416640=_0xc104('0x2a');return db[_0xc104('0x2b')][_0xc104('0x29')]({'where':{'type':_0x416640,'resourceId':_0x2d5b5a['id']}})['then'](function(){return _0x3d0651;});})[_0xc104('0x28')](function(){_0x3e508f[_0xc104('0x1e')](0xcc)[_0xc104('0x1d')]();});}};}function handleEntityNotFound(_0x3f830f,_0xcf6bbe){return function(_0x1eeeff){if(!_0x1eeeff){_0x3f830f[_0xc104('0x1c')](0x194);}return _0x1eeeff;};}function handleError(_0x1b5cf6,_0x4df7d0){_0x4df7d0=_0x4df7d0||0x1f4;return function(_0x530422){logger[_0xc104('0x2c')](_0x530422['stack']);if(_0x530422[_0xc104('0x2d')]){delete _0x530422[_0xc104('0x2d')];}_0x1b5cf6[_0xc104('0x1e')](_0x4df7d0)['send'](_0x530422);};}exports[_0xc104('0x2e')]=function(_0x246e1e,_0x112371){var _0x24c943={},_0x1c1a9d={},_0xf21bdc={'count':0x0,'rows':[]};var _0x165031=_[_0xc104('0x2f')](db[_0xc104('0x30')]['rawAttributes'],function(_0x4cf106){return{'name':_0x4cf106[_0xc104('0x31')],'type':_0x4cf106['type']['key']};});_0x1c1a9d[_0xc104('0x32')]=_[_0xc104('0x2f')](_0x165031,_0xc104('0x2d'));_0x1c1a9d[_0xc104('0x33')]=_[_0xc104('0x34')](_0x246e1e[_0xc104('0x33')]);_0x1c1a9d['filters']=_['intersection'](_0x1c1a9d[_0xc104('0x32')],_0x1c1a9d[_0xc104('0x33')]);_0x24c943[_0xc104('0x35')]=_[_0xc104('0x36')](_0x1c1a9d[_0xc104('0x32')],qs[_0xc104('0x37')](_0x246e1e[_0xc104('0x33')][_0xc104('0x37')]));_0x24c943[_0xc104('0x35')]=_0x24c943[_0xc104('0x35')][_0xc104('0x38')]?_0x24c943[_0xc104('0x35')]:_0x1c1a9d[_0xc104('0x32')];if(!_0x246e1e[_0xc104('0x33')]['hasOwnProperty'](_0xc104('0x39'))){_0x24c943['limit']=qs['limit'](_0x246e1e[_0xc104('0x33')][_0xc104('0x22')]);_0x24c943[_0xc104('0x20')]=qs[_0xc104('0x20')](_0x246e1e['query'][_0xc104('0x20')]);}_0x24c943[_0xc104('0x3a')]=qs[_0xc104('0x3b')](_0x246e1e[_0xc104('0x33')][_0xc104('0x3b')]);_0x24c943[_0xc104('0x3c')]=qs[_0xc104('0x3d')](_[_0xc104('0x3e')](_0x246e1e['query'],_0x1c1a9d[_0xc104('0x3d')]),_0x165031);if(_0x246e1e[_0xc104('0x33')][_0xc104('0x3f')]){_0x24c943[_0xc104('0x3c')]=_['merge'](_0x24c943[_0xc104('0x3c')],{'$or':_[_0xc104('0x2f')](_0x165031,function(_0x158ca2){if(_0x158ca2['type']!==_0xc104('0x40')){var _0x8b27b5={};_0x8b27b5[_0x158ca2[_0xc104('0x2d')]]={'$like':'%'+_0x246e1e['query'][_0xc104('0x3f')]+'%'};return _0x8b27b5;}})});}_0x24c943=_[_0xc104('0x41')]({},_0x24c943,_0x246e1e['options']);var _0x348aba={'where':_0x24c943[_0xc104('0x3c')]};return db[_0xc104('0x30')][_0xc104('0x23')](_0x348aba)[_0xc104('0x28')](function(_0x54c14a){_0xf21bdc[_0xc104('0x23')]=_0x54c14a;if(_0x246e1e['query'][_0xc104('0x42')]){_0x24c943[_0xc104('0x43')]=[{'all':!![]}];}return db[_0xc104('0x30')][_0xc104('0x44')](_0x24c943);})['then'](function(_0x53e2c3){_0xf21bdc[_0xc104('0x45')]=_0x53e2c3;return _0xf21bdc;})['then'](respondWithFilteredResult(_0x112371,_0x24c943))[_0xc104('0x46')](handleError(_0x112371,null));};exports[_0xc104('0x47')]=function(_0x4df6a7,_0x4a98fa){var _0x5473e3={'raw':!![],'where':{'id':_0x4df6a7[_0xc104('0x48')]['id']}},_0x2b79e0={};_0x2b79e0[_0xc104('0x32')]=_[_0xc104('0x34')](db[_0xc104('0x30')][_0xc104('0x49')]);_0x2b79e0['query']=_['keys'](_0x4df6a7[_0xc104('0x33')]);_0x2b79e0[_0xc104('0x3d')]=_[_0xc104('0x36')](_0x2b79e0[_0xc104('0x32')],_0x2b79e0['query']);_0x5473e3[_0xc104('0x35')]=_[_0xc104('0x36')](_0x2b79e0[_0xc104('0x32')],qs['fields'](_0x4df6a7[_0xc104('0x33')][_0xc104('0x37')]));_0x5473e3['attributes']=_0x5473e3[_0xc104('0x35')][_0xc104('0x38')]?_0x5473e3['attributes']:_0x2b79e0[_0xc104('0x32')];if(_0x4df6a7[_0xc104('0x33')][_0xc104('0x42')]){_0x5473e3[_0xc104('0x43')]=[{'all':!![]}];}_0x5473e3=_['merge']({},_0x5473e3,_0x4df6a7[_0xc104('0x4a')]);return db[_0xc104('0x30')]['find'](_0x5473e3)[_0xc104('0x28')](handleEntityNotFound(_0x4a98fa,null))[_0xc104('0x28')](respondWithResult(_0x4a98fa,null))['catch'](handleError(_0x4a98fa,null));};exports[_0xc104('0x4b')]=function(_0x10fc54,_0x323754){return db[_0xc104('0x30')][_0xc104('0x4b')](_0x10fc54[_0xc104('0x4c')],{})[_0xc104('0x28')](function(_0x2c6955){var _0x4f3407=_0x10fc54[_0xc104('0x4d')][_0xc104('0x4e')]({'plain':!![]});if(!_0x4f3407)throw new Error(_0xc104('0x4f'));if(_0x4f3407[_0xc104('0x50')]==='user'){var _0x5c7851=_0x2c6955[_0xc104('0x4e')]({'plain':!![]});var _0x21917c='CmHopperAdditionalPhones';return db[_0xc104('0x51')][_0xc104('0x52')]({'where':{'name':_0x21917c,'userProfileId':_0x4f3407[_0xc104('0x53')]},'raw':!![]})[_0xc104('0x28')](function(_0x5b2143){if(_0x5b2143&&_0x5b2143['autoAssociation']===0x0){return db[_0xc104('0x2b')]['create']({'name':_0x5c7851['name'],'resourceId':_0x5c7851['id'],'type':_0x5b2143[_0xc104('0x2d')],'sectionId':_0x5b2143['id']},{})[_0xc104('0x28')](function(){return _0x2c6955;});}else{return _0x2c6955;}})[_0xc104('0x46')](function(_0x185066){logger[_0xc104('0x2c')](_0xc104('0x54'),_0x185066);throw _0x185066;});}return _0x2c6955;})[_0xc104('0x28')](respondWithResult(_0x323754,0xc9))[_0xc104('0x46')](handleError(_0x323754,null));};exports[_0xc104('0x27')]=function(_0x163a6b,_0x156a5e){if(_0x163a6b[_0xc104('0x4c')]['id']){delete _0x163a6b['body']['id'];}return db[_0xc104('0x30')]['find']({'where':{'id':_0x163a6b[_0xc104('0x48')]['id']}})[_0xc104('0x28')](handleEntityNotFound(_0x156a5e,null))['then'](saveUpdates(_0x163a6b[_0xc104('0x4c')],null))[_0xc104('0x28')](respondWithResult(_0x156a5e,null))[_0xc104('0x46')](handleError(_0x156a5e,null));};exports[_0xc104('0x29')]=function(_0x2bf1ee,_0x3a35da){return db['CmHopperAdditionalPhone'][_0xc104('0x52')]({'where':{'id':_0x2bf1ee['params']['id']}})['then'](handleEntityNotFound(_0x3a35da,null))['then'](removeEntity(_0x3a35da,null))['catch'](handleError(_0x3a35da,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a4fb08e..ea4a7ef 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 _0x36fe=['exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x4a746b,_0x2864fc){var _0x2ad77b=function(_0x22abd2){while(--_0x22abd2){_0x4a746b['push'](_0x4a746b['shift']());}};_0x2ad77b(++_0x2864fc);}(_0x36fe,0x17b));var _0xe36f=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0x36fe[_0x3132e8];return _0x43eb8c;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var logger=require(_0xe36f('0x2'))(_0xe36f('0x3'));var moment=require(_0xe36f('0x4'));var BPromise=require(_0xe36f('0x5'));var rp=require(_0xe36f('0x6'));var fs=require('fs');var path=require(_0xe36f('0x7'));var rimraf=require(_0xe36f('0x8'));var config=require(_0xe36f('0x9'));var attributes=require(_0xe36f('0xa'));module[_0xe36f('0xb')]=function(_0x24e508,_0x2a4d54){return _0x24e508[_0xe36f('0xc')](_0xe36f('0xd'),attributes,{'tableName':_0xe36f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b68=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x18830d,_0x31f95e){var _0x50ff0d=function(_0x5e2fc5){while(--_0x5e2fc5){_0x18830d['push'](_0x18830d['shift']());}};_0x50ff0d(++_0x31f95e);}(_0x7b68,0x1e7));var _0x87b6=function(_0x34c45a,_0x3dd983){_0x34c45a=_0x34c45a-0x0;var _0x5d5c50=_0x7b68[_0x34c45a];return _0x5d5c50;};'use strict';var _=require(_0x87b6('0x0'));var util=require(_0x87b6('0x1'));var logger=require(_0x87b6('0x2'))(_0x87b6('0x3'));var moment=require(_0x87b6('0x4'));var BPromise=require(_0x87b6('0x5'));var rp=require(_0x87b6('0x6'));var fs=require('fs');var path=require(_0x87b6('0x7'));var rimraf=require(_0x87b6('0x8'));var config=require(_0x87b6('0x9'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x87b6('0xa')]=function(_0x2623d2,_0x163d28){return _0x2623d2[_0x87b6('0xb')](_0x87b6('0xc'),attributes,{'tableName':_0x87b6('0xd'),'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 5152f19..9144b39 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 _0xfec7=['client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','catch','VerifyAdditionalPhones','ContactId','duration','scheduledat','add','minutes','isNil','createdAt','phone','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x104aea,_0x541bf1){var _0x472ade=function(_0x364e88){while(--_0x364e88){_0x104aea['push'](_0x104aea['shift']());}};_0x472ade(++_0x541bf1);}(_0xfec7,0x147));var _0x7fec=function(_0x2b3668,_0x1e0f28){_0x2b3668=_0x2b3668-0x0;var _0x1f23dd=_0xfec7[_0x2b3668];return _0x1f23dd;};'use strict';var _=require(_0x7fec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7fec('0x1'));var rs=require(_0x7fec('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fec('0x3'))['db'];var utils=require(_0x7fec('0x4'));var logger=require(_0x7fec('0x5'))(_0x7fec('0x6'));var config=require(_0x7fec('0x7'));var jayson=require(_0x7fec('0x8'));var client=jayson[_0x7fec('0x9')][_0x7fec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35d883,_0x3c314a,_0x2b62a2){return new BPromise(function(_0x56262b,_0x26d94b){return client[_0x7fec('0xb')](_0x35d883,_0x2b62a2)[_0x7fec('0xc')](function(_0x4e578f){logger['info'](_0x7fec('0xd'),_0x3c314a,'request\x20sent');logger[_0x7fec('0xe')](_0x7fec('0xf'),_0x3c314a,_0x7fec('0x10'),JSON[_0x7fec('0x11')](_0x4e578f));if(_0x4e578f['error']){if(_0x4e578f[_0x7fec('0x12')]['code']===0x1f4){logger[_0x7fec('0x12')](_0x7fec('0xd'),_0x3c314a,_0x4e578f[_0x7fec('0x12')][_0x7fec('0x13')]);return _0x26d94b(_0x4e578f[_0x7fec('0x12')][_0x7fec('0x13')]);}logger[_0x7fec('0x12')](_0x7fec('0xd'),_0x3c314a,_0x4e578f[_0x7fec('0x12')]['message']);return _0x56262b(_0x4e578f['error']['message']);}else{logger[_0x7fec('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3c314a,_0x7fec('0x10'));_0x56262b(_0x4e578f[_0x7fec('0x15')]['message']);}})['catch'](function(_0x155223){logger['error'](_0x7fec('0xd'),_0x3c314a,_0x155223);_0x26d94b(_0x155223);});});}exports['VerifyAdditionalPhones']=function(_0x3a029d){var _0x5455a5=this;return new Promise(function(_0x19d9ee,_0x3f0772){return db[_0x7fec('0x16')][_0x7fec('0x17')]({'raw':!![],'where':{'ContactId':_0x3a029d[_0x7fec('0x18')]['ContactId'],'ListId':_0x3a029d[_0x7fec('0x18')][_0x7fec('0x19')],'VoiceQueueId':_0x3a029d['body'][_0x7fec('0x1a')]===undefined?null:_0x3a029d['body']['VoiceQueueId'],'CampaignId':_0x3a029d[_0x7fec('0x18')][_0x7fec('0x1b')]===undefined?null:_0x3a029d[_0x7fec('0x18')][_0x7fec('0x1b')]}})[_0x7fec('0xc')](function(_0x3dc493){if(_0x3dc493!=null){return db[_0x7fec('0x1c')][_0x7fec('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3dc493['id'],'OrderBy':{'$gt':_0x3dc493[_0x7fec('0x1d')]}},'order':[[_0x7fec('0x1d'),_0x7fec('0x1e')]]})[_0x7fec('0xc')](function(_0xaf4fab){var _0x56afaf=0x0;if(_0xaf4fab){if(_0xaf4fab[_0x7fec('0x1f')]+_0xaf4fab[_0x7fec('0x20')]+_0xaf4fab[_0x7fec('0x21')]+_0xaf4fab['countnosuchnumberretry']+_0xaf4fab[_0x7fec('0x22')]+_0xaf4fab['countabandonedretry']+_0xaf4fab[_0x7fec('0x23')]+_0xaf4fab['countagentrejectretry']<_0x3a029d[_0x7fec('0x24')][_0x7fec('0x25')])_0x56afaf=0x1;_0x19d9ee({'additional':_0x56afaf});}else{return db[_0x7fec('0x1c')][_0x7fec('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3dc493['id']},'order':[[_0x7fec('0x1d'),'ASC']]})[_0x7fec('0xc')](function(_0x543ff4){var _0x40b830=0x0;if(_0x543ff4){if(_0x543ff4[_0x7fec('0x1f')]+_0x543ff4[_0x7fec('0x20')]+_0x543ff4[_0x7fec('0x21')]+_0x543ff4[_0x7fec('0x26')]+_0x543ff4[_0x7fec('0x22')]+_0x543ff4[_0x7fec('0x27')]+_0x543ff4[_0x7fec('0x23')]+_0x543ff4[_0x7fec('0x28')]<_0x3a029d[_0x7fec('0x24')][_0x7fec('0x25')])_0x40b830=0x1;_0x19d9ee({'additional':_0x40b830});}else{_0x19d9ee({'additional':0x0});}})['catch'](function(_0x7d66d){logger[_0x7fec('0x12')]('VerifyAdditionalPhones',_0x7d66d[_0x7fec('0x13')]);_0x3f0772(_0x5455a5[_0x7fec('0x12')](0x1f4,_0x7d66d[_0x7fec('0x13')]));});}})[_0x7fec('0x29')](function(_0x4a4b45){logger[_0x7fec('0x12')](_0x7fec('0x2a'),_0x4a4b45[_0x7fec('0x13')]);_0x3f0772(_0x5455a5[_0x7fec('0x12')](0x1f4,_0x4a4b45['message']));});}else _0x19d9ee({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x18b297){var _0x5c9915=this;return new Promise(function(_0x10208b,_0x32f54b){return db['CmHopper'][_0x7fec('0x17')]({'raw':!![],'where':{'ContactId':_0x18b297[_0x7fec('0x18')][_0x7fec('0x2b')],'ListId':_0x18b297[_0x7fec('0x18')][_0x7fec('0x19')],'VoiceQueueId':_0x18b297['body'][_0x7fec('0x1a')]===undefined?null:_0x18b297[_0x7fec('0x18')][_0x7fec('0x1a')],'CampaignId':_0x18b297[_0x7fec('0x18')][_0x7fec('0x1b')]===undefined?null:_0x18b297[_0x7fec('0x18')][_0x7fec('0x1b')]}})[_0x7fec('0xc')](function(_0x3cf6c5){if(_0x3cf6c5!=null){return db[_0x7fec('0x1c')][_0x7fec('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3cf6c5['id'],'OrderBy':{'$gte':_0x3cf6c5['OrderBy']}},'order':[[_0x7fec('0x1d'),_0x7fec('0x1e')]]})[_0x7fec('0xc')](function(_0xff287b){if(_0xff287b)return activateAdditionalPhone(_0x3cf6c5,_0x18b297[_0x7fec('0x18')],_0xff287b,_0x18b297[_0x7fec('0x2c')],_0x18b297['waitTime'])[_0x7fec('0xc')](function(_0x489385){_0x10208b(_0x489385);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x3cf6c5['id']},'order':[[_0x7fec('0x1d'),_0x7fec('0x1e')]]})['then'](function(_0x4cfb41){if(_0x4cfb41)return activateAdditionalPhone(_0x3cf6c5,_0x18b297[_0x7fec('0x18')],_0x4cfb41,_0x18b297['duration'],_0x18b297['waitTime'])[_0x7fec('0xc')](function(_0x2d3824){_0x10208b(_0x2d3824);});else{_0x10208b({'id':_0x3cf6c5['id'],'phone':''});}})[_0x7fec('0x29')](function(_0x1365d1){logger[_0x7fec('0x12')](_0x7fec('0x2a'),_0x1365d1['message']);_0x32f54b(_0x5c9915[_0x7fec('0x12')](0x1f4,_0x1365d1[_0x7fec('0x13')]));});}})[_0x7fec('0x29')](function(_0x5ed624){logger[_0x7fec('0x12')](_0x7fec('0x2a'),_0x5ed624['message']);_0x32f54b(_0x5c9915[_0x7fec('0x12')](0x1f4,_0x5ed624[_0x7fec('0x13')]));});}else _0x10208b(0x1);});});};function activateAdditionalPhone(_0x443388,_0x512db8,_0x3735be,_0x4bd423,_0x524aec){return new Promise(function(_0xdddf33,_0x160b83){var _0x3323bd;if(_['isNil'](_0x3735be[_0x7fec('0x2d')])){_0x3735be[_0x7fec('0x2d')]=moment();}if(moment()>moment(_0x3735be[_0x7fec('0x2d')])){_0x3323bd=moment()[_0x7fec('0x2e')](_0x524aec||0x3,_0x7fec('0x2f'));}else{if(_0x3735be['OrderBy']==0x0){_0x3323bd=moment(_0x3735be['scheduledat']);}else{_0x3323bd=moment()[_0x7fec('0x2e')](_0x524aec||0x3,_0x7fec('0x2f'));}}if(_[_0x7fec('0x30')](_0x3323bd)){_0x3323bd=moment()[_0x7fec('0x2e')](_0x524aec||0x3,_0x7fec('0x2f'));}var _0x4f3312={'phone':_0x443388['phone'],'active':0x0,'OrderBy':_[_0x7fec('0x30')](_0x443388[_0x7fec('0x1d')])?0x0:_0x443388['OrderBy'],'scheduledat':moment()[_0x7fec('0x2e')](_0x4bd423||0x1,_0x7fec('0x2f')),'countbusyretry':_0x512db8[_0x7fec('0x1f')],'countcongestionretry':_0x512db8['countcongestionretry'],'countnoanswerretry':_0x512db8['countnoanswerretry'],'countnosuchnumberretry':_0x512db8[_0x7fec('0x26')],'countdropretry':_0x512db8[_0x7fec('0x22')],'countabandonedretry':_0x512db8[_0x7fec('0x27')],'countmachineretry':_0x512db8['countmachineretry'],'countagentrejectretry':_0x512db8[_0x7fec('0x28')],'createdAt':_0x512db8[_0x7fec('0x31')],'updatedAt':_0x512db8['updatedAt']};var _0x56961a={'CmHopperId':_0x443388['id'],'phone':_0x3735be[_0x7fec('0x32')],'active':0x0,'OrderBy':_[_0x7fec('0x30')](_0x3735be[_0x7fec('0x1d')])?0x0:_0x3735be[_0x7fec('0x1d')],'scheduledat':_0x3323bd,'countbusyretry':_0x3735be['countbusyretry'],'countcongestionretry':_0x3735be[_0x7fec('0x20')],'countnoanswerretry':_0x3735be[_0x7fec('0x21')],'countnosuchnumberretry':_0x3735be[_0x7fec('0x26')],'countdropretry':_0x3735be['countdropretry'],'countabandonedretry':_0x3735be[_0x7fec('0x27')],'countmachineretry':_0x3735be['countmachineretry'],'countagentrejectretry':_0x3735be[_0x7fec('0x28')],'createdAt':_0x3735be['createdAt'],'updatedAt':_0x3735be[_0x7fec('0x33')]};return db[_0x7fec('0x34')]['transaction'](function(_0x481c0d){return db[_0x7fec('0x1c')]['update'](_0x4f3312,{'where':{'id':_0x3735be['id']}},{'transaction':_0x481c0d})[_0x7fec('0xc')](function(){return db[_0x7fec('0x16')][_0x7fec('0x35')](_0x56961a,{'where':{'id':_0x443388['id']}},{'transaction':_0x481c0d});});})[_0x7fec('0xc')](function(_0x5d71dc){_0xdddf33({'id':_0x443388['id'],'phone':_0x3735be['phone']});})['catch'](function(_0x24a57f){logger[_0x7fec('0x12')](_0x7fec('0x36'),_0x24a57f[_0x7fec('0x13')]);_0x160b83({'error':_0x24a57f[_0x7fec('0x13')]});});});}exports[_0x7fec('0x37')]=function(_0x3b93e6){var _0x318b40=this;return new Promise(function(_0x3916bb,_0x5f02b0){return db[_0x7fec('0x16')]['update'](_0x3b93e6['body']['field'],{'where':{'id':_0x3b93e6[_0x7fec('0x18')]['id']}})['then'](function(_0x140a7b){_0x3916bb(_0x140a7b);})[_0x7fec('0x29')](function(_0xc21574){logger['error'](_0x7fec('0x37'),_0xc21574[_0x7fec('0x13')]);_0x5f02b0(_0x318b40[_0x7fec('0x12')](0x1f4,_0xc21574[_0x7fec('0x13')]));});});}; \ No newline at end of file +var _0x34be=['transaction','update','activateAdditionalPhone','field','lodash','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','CmHopper','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt'];(function(_0xaf44f6,_0x38bb85){var _0x5aadda=function(_0x297a94){while(--_0x297a94){_0xaf44f6['push'](_0xaf44f6['shift']());}};_0x5aadda(++_0x38bb85);}(_0x34be,0x177));var _0xe34b=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x34be[_0x1305e3];return _0x1068e9;};'use strict';var _=require(_0xe34b('0x0'));var util=require('util');var moment=require(_0xe34b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe34b('0x2'));var db=require(_0xe34b('0x3'))['db'];var utils=require(_0xe34b('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe34b('0x5'));var client=jayson[_0xe34b('0x6')][_0xe34b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28fce3,_0xa9a6dc,_0x4c6442){return new BPromise(function(_0xd2b6ea,_0x469da9){return client['request'](_0x28fce3,_0x4c6442)[_0xe34b('0x8')](function(_0x33f6ed){logger['info'](_0xe34b('0x9'),_0xa9a6dc,_0xe34b('0xa'));logger['debug'](_0xe34b('0xb'),_0xa9a6dc,_0xe34b('0xa'),JSON[_0xe34b('0xc')](_0x33f6ed));if(_0x33f6ed[_0xe34b('0xd')]){if(_0x33f6ed[_0xe34b('0xd')][_0xe34b('0xe')]===0x1f4){logger[_0xe34b('0xd')](_0xe34b('0x9'),_0xa9a6dc,_0x33f6ed['error'][_0xe34b('0xf')]);return _0x469da9(_0x33f6ed['error']['message']);}logger[_0xe34b('0xd')](_0xe34b('0x9'),_0xa9a6dc,_0x33f6ed['error'][_0xe34b('0xf')]);return _0xd2b6ea(_0x33f6ed[_0xe34b('0xd')][_0xe34b('0xf')]);}else{logger[_0xe34b('0x10')](_0xe34b('0x9'),_0xa9a6dc,_0xe34b('0xa'));_0xd2b6ea(_0x33f6ed['result'][_0xe34b('0xf')]);}})[_0xe34b('0x11')](function(_0x35bf72){logger[_0xe34b('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xa9a6dc,_0x35bf72);_0x469da9(_0x35bf72);});});}exports[_0xe34b('0x12')]=function(_0x257012){var _0x5d2491=this;return new Promise(function(_0x152eec,_0x54819f){return db['CmHopper'][_0xe34b('0x13')]({'raw':!![],'where':{'ContactId':_0x257012[_0xe34b('0x14')][_0xe34b('0x15')],'ListId':_0x257012['body'][_0xe34b('0x16')],'VoiceQueueId':_0x257012[_0xe34b('0x14')]['VoiceQueueId']===undefined?null:_0x257012[_0xe34b('0x14')][_0xe34b('0x17')],'CampaignId':_0x257012[_0xe34b('0x14')][_0xe34b('0x18')]===undefined?null:_0x257012[_0xe34b('0x14')][_0xe34b('0x18')]}})['then'](function(_0x1161e5){if(_0x1161e5!=null){return db[_0xe34b('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1161e5['id'],'OrderBy':{'$gt':_0x1161e5[_0xe34b('0x1a')]}},'order':[[_0xe34b('0x1a'),_0xe34b('0x1b')]]})[_0xe34b('0x8')](function(_0x24bdf4){var _0x4bb811=0x0;if(_0x24bdf4){if(_0x24bdf4[_0xe34b('0x1c')]+_0x24bdf4[_0xe34b('0x1d')]+_0x24bdf4[_0xe34b('0x1e')]+_0x24bdf4[_0xe34b('0x1f')]+_0x24bdf4[_0xe34b('0x20')]+_0x24bdf4[_0xe34b('0x21')]+_0x24bdf4[_0xe34b('0x22')]+_0x24bdf4[_0xe34b('0x23')]<_0x257012[_0xe34b('0x24')][_0xe34b('0x25')])_0x4bb811=0x1;_0x152eec({'additional':_0x4bb811});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1161e5['id']},'order':[['OrderBy',_0xe34b('0x1b')]]})[_0xe34b('0x8')](function(_0x1be7e2){var _0x4f36b4=0x0;if(_0x1be7e2){if(_0x1be7e2[_0xe34b('0x1c')]+_0x1be7e2[_0xe34b('0x1d')]+_0x1be7e2[_0xe34b('0x1e')]+_0x1be7e2[_0xe34b('0x1f')]+_0x1be7e2['countdropretry']+_0x1be7e2[_0xe34b('0x21')]+_0x1be7e2[_0xe34b('0x22')]+_0x1be7e2[_0xe34b('0x23')]<_0x257012[_0xe34b('0x24')][_0xe34b('0x25')])_0x4f36b4=0x1;_0x152eec({'additional':_0x4f36b4});}else{_0x152eec({'additional':0x0});}})[_0xe34b('0x11')](function(_0x5180be){logger[_0xe34b('0xd')](_0xe34b('0x12'),_0x5180be[_0xe34b('0xf')]);_0x54819f(_0x5d2491['error'](0x1f4,_0x5180be[_0xe34b('0xf')]));});}})['catch'](function(_0x27a2e8){logger['error'](_0xe34b('0x12'),_0x27a2e8[_0xe34b('0xf')]);_0x54819f(_0x5d2491['error'](0x1f4,_0x27a2e8[_0xe34b('0xf')]));});}else _0x152eec({'additional':0x0});});});};exports[_0xe34b('0x26')]=function(_0x4d70ee){var _0x1aded6=this;return new Promise(function(_0x2182e5,_0x32dc76){return db[_0xe34b('0x27')][_0xe34b('0x13')]({'raw':!![],'where':{'ContactId':_0x4d70ee[_0xe34b('0x14')]['ContactId'],'ListId':_0x4d70ee[_0xe34b('0x14')][_0xe34b('0x16')],'VoiceQueueId':_0x4d70ee[_0xe34b('0x14')]['VoiceQueueId']===undefined?null:_0x4d70ee[_0xe34b('0x14')][_0xe34b('0x17')],'CampaignId':_0x4d70ee['body'][_0xe34b('0x18')]===undefined?null:_0x4d70ee[_0xe34b('0x14')][_0xe34b('0x18')]}})[_0xe34b('0x8')](function(_0x9722eb){if(_0x9722eb!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x9722eb['id'],'OrderBy':{'$gte':_0x9722eb[_0xe34b('0x1a')]}},'order':[[_0xe34b('0x1a'),_0xe34b('0x1b')]]})[_0xe34b('0x8')](function(_0x360808){if(_0x360808)return activateAdditionalPhone(_0x9722eb,_0x4d70ee[_0xe34b('0x14')],_0x360808,_0x4d70ee[_0xe34b('0x28')],_0x4d70ee[_0xe34b('0x29')])[_0xe34b('0x8')](function(_0x24c057){_0x2182e5(_0x24c057);});else{return db[_0xe34b('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x9722eb['id']},'order':[['OrderBy',_0xe34b('0x1b')]]})[_0xe34b('0x8')](function(_0x5acbd3){if(_0x5acbd3)return activateAdditionalPhone(_0x9722eb,_0x4d70ee[_0xe34b('0x14')],_0x5acbd3,_0x4d70ee['duration'],_0x4d70ee['waitTime'])[_0xe34b('0x8')](function(_0x2b3c60){_0x2182e5(_0x2b3c60);});else{_0x2182e5({'id':_0x9722eb['id'],'phone':''});}})[_0xe34b('0x11')](function(_0x46057d){logger[_0xe34b('0xd')]('VerifyAdditionalPhones',_0x46057d[_0xe34b('0xf')]);_0x32dc76(_0x1aded6[_0xe34b('0xd')](0x1f4,_0x46057d['message']));});}})[_0xe34b('0x11')](function(_0x36ab2e){logger[_0xe34b('0xd')](_0xe34b('0x12'),_0x36ab2e['message']);_0x32dc76(_0x1aded6[_0xe34b('0xd')](0x1f4,_0x36ab2e[_0xe34b('0xf')]));});}else _0x2182e5(0x1);});});};function activateAdditionalPhone(_0x233069,_0x2193fc,_0x2f2703,_0xec0d31,_0x560f20){return new Promise(function(_0x3ccd07,_0x107db6){var _0x3d2c77;if(_['isNil'](_0x2f2703[_0xe34b('0x2a')])){_0x2f2703[_0xe34b('0x2a')]=moment();}if(moment()>moment(_0x2f2703['scheduledat'])){_0x3d2c77=moment()[_0xe34b('0x2b')](_0x560f20||0x3,'minutes');}else{if(_0x2f2703[_0xe34b('0x1a')]==0x0){_0x3d2c77=moment(_0x2f2703[_0xe34b('0x2a')]);}else{_0x3d2c77=moment()['add'](_0x560f20||0x3,_0xe34b('0x2c'));}}if(_[_0xe34b('0x2d')](_0x3d2c77)){_0x3d2c77=moment()[_0xe34b('0x2b')](_0x560f20||0x3,_0xe34b('0x2c'));}var _0xaa2e94={'phone':_0x233069[_0xe34b('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x233069[_0xe34b('0x1a')])?0x0:_0x233069[_0xe34b('0x1a')],'scheduledat':moment()[_0xe34b('0x2b')](_0xec0d31||0x1,_0xe34b('0x2c')),'countbusyretry':_0x2193fc['countbusyretry'],'countcongestionretry':_0x2193fc[_0xe34b('0x1d')],'countnoanswerretry':_0x2193fc['countnoanswerretry'],'countnosuchnumberretry':_0x2193fc[_0xe34b('0x1f')],'countdropretry':_0x2193fc[_0xe34b('0x20')],'countabandonedretry':_0x2193fc[_0xe34b('0x21')],'countmachineretry':_0x2193fc[_0xe34b('0x22')],'countagentrejectretry':_0x2193fc['countagentrejectretry'],'createdAt':_0x2193fc[_0xe34b('0x2f')],'updatedAt':_0x2193fc[_0xe34b('0x30')]};var _0xd655c1={'CmHopperId':_0x233069['id'],'phone':_0x2f2703[_0xe34b('0x2e')],'active':0x0,'OrderBy':_[_0xe34b('0x2d')](_0x2f2703[_0xe34b('0x1a')])?0x0:_0x2f2703['OrderBy'],'scheduledat':_0x3d2c77,'countbusyretry':_0x2f2703[_0xe34b('0x1c')],'countcongestionretry':_0x2f2703['countcongestionretry'],'countnoanswerretry':_0x2f2703['countnoanswerretry'],'countnosuchnumberretry':_0x2f2703[_0xe34b('0x1f')],'countdropretry':_0x2f2703[_0xe34b('0x20')],'countabandonedretry':_0x2f2703['countabandonedretry'],'countmachineretry':_0x2f2703[_0xe34b('0x22')],'countagentrejectretry':_0x2f2703[_0xe34b('0x23')],'createdAt':_0x2f2703['createdAt'],'updatedAt':_0x2f2703['updatedAt']};return db['sequelize'][_0xe34b('0x31')](function(_0x4cf3fe){return db[_0xe34b('0x19')][_0xe34b('0x32')](_0xaa2e94,{'where':{'id':_0x2f2703['id']}},{'transaction':_0x4cf3fe})[_0xe34b('0x8')](function(){return db[_0xe34b('0x27')][_0xe34b('0x32')](_0xd655c1,{'where':{'id':_0x233069['id']}},{'transaction':_0x4cf3fe});});})[_0xe34b('0x8')](function(_0x5e7aed){_0x3ccd07({'id':_0x233069['id'],'phone':_0x2f2703[_0xe34b('0x2e')]});})['catch'](function(_0x37f15e){logger[_0xe34b('0xd')](_0xe34b('0x33'),_0x37f15e['message']);_0x107db6({'error':_0x37f15e[_0xe34b('0xf')]});});});}exports['IncrementPreviewCounters']=function(_0x2b91bb){var _0x1f37d9=this;return new Promise(function(_0x2c9698,_0x3f5ab1){return db[_0xe34b('0x27')][_0xe34b('0x32')](_0x2b91bb[_0xe34b('0x14')][_0xe34b('0x34')],{'where':{'id':_0x2b91bb[_0xe34b('0x14')]['id']}})[_0xe34b('0x8')](function(_0x7ca739){_0x2c9698(_0x7ca739);})[_0xe34b('0x11')](function(_0x21651a){logger[_0xe34b('0xd')]('IncrementPreviewCounters',_0x21651a[_0xe34b('0xf')]);_0x3f5ab1(_0x1f37d9[_0xe34b('0xd')](0x1f4,_0x21651a[_0xe34b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index e089909..b97fba9 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 _0x4972=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4972,0x130));var _0x2497=function(_0x37b013,_0x364739){_0x37b013=_0x37b013-0x0;var _0x2f241e=_0x4972[_0x37b013];return _0x2f241e;};'use strict';var multer=require('multer');var util=require(_0x2497('0x0'));var path=require(_0x2497('0x1'));var timeout=require('connect-timeout');var express=require(_0x2497('0x2'));var router=express[_0x2497('0x3')]();var fs_extra=require(_0x2497('0x4'));var auth=require(_0x2497('0x5'));var interaction=require(_0x2497('0x6'));var config=require(_0x2497('0x7'));var controller=require(_0x2497('0x8'));router['get']('/',auth[_0x2497('0x9')](),controller[_0x2497('0xa')]);router['get'](_0x2497('0xb'),auth[_0x2497('0x9')](),controller[_0x2497('0xc')]);router[_0x2497('0xd')]('/',auth[_0x2497('0x9')](),controller[_0x2497('0xe')]);router[_0x2497('0xf')](_0x2497('0xb'),auth['isAuthenticated'](),controller[_0x2497('0x10')]);router[_0x2497('0x11')](_0x2497('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2497('0x12')]=router; \ No newline at end of file +var _0x590a=['./cmHopperAdditionalPhone.controller','isAuthenticated','get','/:id','show','create','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x54719d,_0xf894e1){var _0x270473=function(_0x2f1efe){while(--_0x2f1efe){_0x54719d['push'](_0x54719d['shift']());}};_0x270473(++_0xf894e1);}(_0x590a,0x159));var _0xa590=function(_0x14819b,_0xbc02f9){_0x14819b=_0x14819b-0x0;var _0x3170d6=_0x590a[_0x14819b];return _0x3170d6;};'use strict';var multer=require('multer');var util=require(_0xa590('0x0'));var path=require(_0xa590('0x1'));var timeout=require(_0xa590('0x2'));var express=require(_0xa590('0x3'));var router=express[_0xa590('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa590('0x5'));var config=require(_0xa590('0x6'));var controller=require(_0xa590('0x7'));router['get']('/',auth[_0xa590('0x8')](),controller['index']);router[_0xa590('0x9')](_0xa590('0xa'),auth[_0xa590('0x8')](),controller[_0xa590('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa590('0xc')]);router['put'](_0xa590('0xa'),auth[_0xa590('0x8')](),controller[_0xa590('0xd')]);router['delete'](_0xa590('0xa'),auth[_0xa590('0x8')](),controller[_0xa590('0xe')]);module[_0xa590('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 75d46f5..c3760b9 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 _0x044a=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x252159,_0x1545ee){var _0x17512b=function(_0x2fce69){while(--_0x2fce69){_0x252159['push'](_0x252159['shift']());}};_0x17512b(++_0x1545ee);}(_0x044a,0x173));var _0xa044=function(_0x5ec4df,_0x1de0de){_0x5ec4df=_0x5ec4df-0x0;var _0x4fb5b9=_0x044a[_0x5ec4df];return _0x4fb5b9;};'use strict';var moment=require(_0xa044('0x0'));var Sequelize=require(_0xa044('0x1'));module[_0xa044('0x2')]={'phone':{'type':Sequelize[_0xa044('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa044('0x4')],'unique':_0xa044('0x5')},'ListId':{'type':Sequelize[_0xa044('0x4')],'unique':_0xa044('0x5')},'VoiceQueueId':{'type':Sequelize[_0xa044('0x4')],'unique':_0xa044('0x5')}}; \ No newline at end of file +var _0x99a0=['contactListQueue','moment','sequelize','INTEGER'];(function(_0x58fdc6,_0x590a69){var _0x30d6af=function(_0x1c0508){while(--_0x1c0508){_0x58fdc6['push'](_0x58fdc6['shift']());}};_0x30d6af(++_0x590a69);}(_0x99a0,0x121));var _0x099a=function(_0x1f369b,_0x67489d){_0x1f369b=_0x1f369b-0x0;var _0x30c615=_0x99a0[_0x1f369b];return _0x30c615;};'use strict';var moment=require(_0x099a('0x0'));var Sequelize=require(_0x099a('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x099a('0x2')],'unique':_0x099a('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x099a('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2e6eccf..ccfef9b 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 _0xb757=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','length','include','body','find','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0xb757,0xf0));var _0x7b75=function(_0x114420,_0x35f783){_0x114420=_0x114420-0x0;var _0x2a9eb7=_0xb757[_0x114420];return _0x2a9eb7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b75('0x0'));var zipdir=require(_0x7b75('0x1'));var jsonpatch=require(_0x7b75('0x2'));var rp=require(_0x7b75('0x3'));var moment=require(_0x7b75('0x4'));var BPromise=require(_0x7b75('0x5'));var Mustache=require('mustache');var util=require(_0x7b75('0x6'));var path=require(_0x7b75('0x7'));var sox=require('sox');var csv=require(_0x7b75('0x8'));var ejs=require(_0x7b75('0x9'));var fs=require('fs');var fs_extra=require(_0x7b75('0xa'));var _=require(_0x7b75('0xb'));var squel=require(_0x7b75('0xc'));var crypto=require(_0x7b75('0xd'));var jsforce=require(_0x7b75('0xe'));var deskjs=require(_0x7b75('0xf'));var toCsv=require(_0x7b75('0x8'));var querystring=require('querystring');var Papa=require(_0x7b75('0x10'));var Redis=require(_0x7b75('0x11'));var authService=require(_0x7b75('0x12'));var qs=require(_0x7b75('0x13'));var as=require(_0x7b75('0x14'));var hardwareService=require(_0x7b75('0x15'));var logger=require('../../config/logger')(_0x7b75('0x16'));var utils=require(_0x7b75('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7b75('0x18'))['db'];function respondWithStatusCode(_0x33d44b,_0x4a70a3){_0x4a70a3=_0x4a70a3||0xcc;return function(_0x596dae){if(_0x596dae){return _0x33d44b[_0x7b75('0x19')](_0x4a70a3);}return _0x33d44b[_0x7b75('0x1a')](_0x4a70a3)[_0x7b75('0x1b')]();};}function respondWithResult(_0x463642,_0x160996){_0x160996=_0x160996||0xc8;return function(_0x5a1731){if(_0x5a1731){return _0x463642[_0x7b75('0x1a')](_0x160996)[_0x7b75('0x1c')](_0x5a1731);}};}function respondWithFilteredResult(_0x5a20f0,_0x2f8567){return function(_0x4ca520){if(_0x4ca520){var _0x318bdb=typeof _0x2f8567['offset']===_0x7b75('0x1d')&&typeof _0x2f8567[_0x7b75('0x1e')]==='undefined';var _0x1fafbd=_0x4ca520[_0x7b75('0x1f')];var _0x51be05=_0x318bdb?0x0:_0x2f8567['offset'];var _0x3094d3=_0x318bdb?_0x4ca520[_0x7b75('0x1f')]:_0x2f8567[_0x7b75('0x20')]+_0x2f8567[_0x7b75('0x1e')];var _0x36fee5;if(_0x3094d3>=_0x1fafbd){_0x3094d3=_0x1fafbd;_0x36fee5=0xc8;}else{_0x36fee5=0xce;}_0x5a20f0[_0x7b75('0x1a')](_0x36fee5);return _0x5a20f0['set'](_0x7b75('0x21'),_0x51be05+'-'+_0x3094d3+'/'+_0x1fafbd)[_0x7b75('0x1c')](_0x4ca520);}return null;};}function patchUpdates(_0x10bfc6){return function(_0x36e705){try{jsonpatch[_0x7b75('0x22')](_0x36e705,_0x10bfc6,!![]);}catch(_0x1b1977){return BPromise['reject'](_0x1b1977);}return _0x36e705[_0x7b75('0x23')]();};}function saveUpdates(_0x3d67d7,_0x3b6a9e){return function(_0x11550c){if(_0x11550c){return _0x11550c[_0x7b75('0x24')](_0x3d67d7)[_0x7b75('0x25')](function(_0x27b94e){return _0x27b94e;});}return null;};}function removeEntity(_0x5b1568,_0x6ea23d){return function(_0x174e34){if(_0x174e34){return _0x174e34[_0x7b75('0x26')]()[_0x7b75('0x25')](function(){_0x5b1568[_0x7b75('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10ae7d,_0x2df84c){return function(_0x5c4371){if(!_0x5c4371){_0x10ae7d[_0x7b75('0x19')](0x194);}return _0x5c4371;};}function handleError(_0x48fba6,_0x235aa0){_0x235aa0=_0x235aa0||0x1f4;return function(_0x73c298){logger['error'](_0x73c298['stack']);if(_0x73c298[_0x7b75('0x27')]){delete _0x73c298[_0x7b75('0x27')];}_0x48fba6['status'](_0x235aa0)[_0x7b75('0x28')](_0x73c298);};}exports['index']=function(_0x4f8450,_0x22103b){var _0x138578={},_0x5414e2={},_0x1fa2c1={'count':0x0,'rows':[]};var _0x2e5a71=_[_0x7b75('0x29')](db[_0x7b75('0x2a')][_0x7b75('0x2b')],function(_0x372caa){return{'name':_0x372caa[_0x7b75('0x2c')],'type':_0x372caa[_0x7b75('0x2d')][_0x7b75('0x2e')]};});_0x5414e2[_0x7b75('0x2f')]=_[_0x7b75('0x29')](_0x2e5a71,_0x7b75('0x27'));_0x5414e2[_0x7b75('0x30')]=_[_0x7b75('0x31')](_0x4f8450[_0x7b75('0x30')]);_0x5414e2[_0x7b75('0x32')]=_['intersection'](_0x5414e2['model'],_0x5414e2[_0x7b75('0x30')]);_0x138578[_0x7b75('0x33')]=_[_0x7b75('0x34')](_0x5414e2[_0x7b75('0x2f')],qs[_0x7b75('0x35')](_0x4f8450[_0x7b75('0x30')][_0x7b75('0x35')]));_0x138578[_0x7b75('0x33')]=_0x138578[_0x7b75('0x33')]['length']?_0x138578[_0x7b75('0x33')]:_0x5414e2['model'];if(!_0x4f8450['query'][_0x7b75('0x36')](_0x7b75('0x37'))){_0x138578[_0x7b75('0x1e')]=qs[_0x7b75('0x1e')](_0x4f8450['query'][_0x7b75('0x1e')]);_0x138578['offset']=qs[_0x7b75('0x20')](_0x4f8450['query']['offset']);}_0x138578[_0x7b75('0x38')]=qs[_0x7b75('0x39')](_0x4f8450[_0x7b75('0x30')][_0x7b75('0x39')]);_0x138578[_0x7b75('0x3a')]=qs[_0x7b75('0x32')](_[_0x7b75('0x3b')](_0x4f8450[_0x7b75('0x30')],_0x5414e2['filters']),_0x2e5a71);if(_0x4f8450['query'][_0x7b75('0x3c')]){_0x138578[_0x7b75('0x3a')]=_[_0x7b75('0x3d')](_0x138578['where'],{'$or':_[_0x7b75('0x29')](_0x2e5a71,function(_0x51a7c8){if(_0x51a7c8[_0x7b75('0x2d')]!==_0x7b75('0x3e')){var _0x26560d={};_0x26560d[_0x51a7c8[_0x7b75('0x27')]]={'$like':'%'+_0x4f8450[_0x7b75('0x30')]['filter']+'%'};return _0x26560d;}})});}_0x138578=_[_0x7b75('0x3d')]({},_0x138578,_0x4f8450[_0x7b75('0x3f')]);var _0x4da4ca={'where':_0x138578[_0x7b75('0x3a')]};return db[_0x7b75('0x2a')][_0x7b75('0x1f')](_0x4da4ca)[_0x7b75('0x25')](function(_0x1efc15){_0x1fa2c1['count']=_0x1efc15;if(_0x4f8450['query'][_0x7b75('0x40')]){_0x138578['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x7b75('0x41')](_0x138578);})['then'](function(_0x19f2c2){_0x1fa2c1['rows']=_0x19f2c2;return _0x1fa2c1;})[_0x7b75('0x25')](respondWithFilteredResult(_0x22103b,_0x138578))['catch'](handleError(_0x22103b,null));};exports[_0x7b75('0x42')]=function(_0x4cd532,_0x401dcf){var _0x103f56={'raw':!![],'where':{'id':_0x4cd532[_0x7b75('0x43')]['id']}},_0x3e18b6={};_0x3e18b6[_0x7b75('0x2f')]=_[_0x7b75('0x31')](db[_0x7b75('0x2a')]['rawAttributes']);_0x3e18b6[_0x7b75('0x30')]=_[_0x7b75('0x31')](_0x4cd532[_0x7b75('0x30')]);_0x3e18b6['filters']=_[_0x7b75('0x34')](_0x3e18b6[_0x7b75('0x2f')],_0x3e18b6[_0x7b75('0x30')]);_0x103f56[_0x7b75('0x33')]=_[_0x7b75('0x34')](_0x3e18b6[_0x7b75('0x2f')],qs[_0x7b75('0x35')](_0x4cd532[_0x7b75('0x30')]['fields']));_0x103f56[_0x7b75('0x33')]=_0x103f56['attributes'][_0x7b75('0x44')]?_0x103f56['attributes']:_0x3e18b6[_0x7b75('0x2f')];if(_0x4cd532[_0x7b75('0x30')]['includeAll']){_0x103f56[_0x7b75('0x45')]=[{'all':!![]}];}_0x103f56=_['merge']({},_0x103f56,_0x4cd532[_0x7b75('0x3f')]);return db[_0x7b75('0x2a')]['find'](_0x103f56)['then'](handleEntityNotFound(_0x401dcf,null))['then'](respondWithResult(_0x401dcf,null))['catch'](handleError(_0x401dcf,null));};exports['update']=function(_0x2730d1,_0xfd9aee){if(_0x2730d1['body']['id']){delete _0x2730d1[_0x7b75('0x46')]['id'];}return db[_0x7b75('0x2a')][_0x7b75('0x47')]({'where':{'id':_0x2730d1[_0x7b75('0x43')]['id']}})['then'](handleEntityNotFound(_0xfd9aee,null))[_0x7b75('0x25')](saveUpdates(_0x2730d1['body'],null))[_0x7b75('0x25')](respondWithResult(_0xfd9aee,null))[_0x7b75('0x48')](handleError(_0xfd9aee,null));};exports[_0x7b75('0x26')]=function(_0x1b227a,_0x48ebc1){return db[_0x7b75('0x2a')]['find']({'where':{'id':_0x1b227a[_0x7b75('0x43')]['id']}})['then'](handleEntityNotFound(_0x48ebc1,null))[_0x7b75('0x25')](removeEntity(_0x48ebc1,null))['catch'](handleError(_0x48ebc1,null));};exports[_0x7b75('0x49')]=function(_0x810c7f,_0xb40c61){return db[_0x7b75('0x2a')][_0x7b75('0x49')]()[_0x7b75('0x25')](respondWithResult(_0xb40c61,null))['catch'](handleError(_0xb40c61,null));}; \ No newline at end of file +var _0x2174=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','fields','options','find','update','body','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','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','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','CmHopperBlack','rawAttributes','model','map','query','keys','filters','attributes','intersection'];(function(_0x259cad,_0x3dae11){var _0x4e6a68=function(_0x1669dc){while(--_0x1669dc){_0x259cad['push'](_0x259cad['shift']());}};_0x4e6a68(++_0x3dae11);}(_0x2174,0x142));var _0x4217=function(_0x4bdf46,_0x177898){_0x4bdf46=_0x4bdf46-0x0;var _0x104b14=_0x2174[_0x4bdf46];return _0x104b14;};'use strict';var emlformat=require(_0x4217('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4217('0x1'));var rp=require(_0x4217('0x2'));var moment=require('moment');var BPromise=require(_0x4217('0x3'));var Mustache=require(_0x4217('0x4'));var util=require(_0x4217('0x5'));var path=require(_0x4217('0x6'));var sox=require(_0x4217('0x7'));var csv=require('to-csv');var ejs=require(_0x4217('0x8'));var fs=require('fs');var fs_extra=require(_0x4217('0x9'));var _=require('lodash');var squel=require(_0x4217('0xa'));var crypto=require('crypto');var jsforce=require(_0x4217('0xb'));var deskjs=require(_0x4217('0xc'));var toCsv=require(_0x4217('0xd'));var querystring=require(_0x4217('0xe'));var Papa=require(_0x4217('0xf'));var Redis=require(_0x4217('0x10'));var authService=require(_0x4217('0x11'));var qs=require(_0x4217('0x12'));var as=require(_0x4217('0x13'));var hardwareService=require(_0x4217('0x14'));var logger=require(_0x4217('0x15'))(_0x4217('0x16'));var utils=require(_0x4217('0x17'));var config=require(_0x4217('0x18'));var licenseUtil=require(_0x4217('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e555e,_0x230cc0){_0x230cc0=_0x230cc0||0xcc;return function(_0x1556f6){if(_0x1556f6){return _0x4e555e['sendStatus'](_0x230cc0);}return _0x4e555e[_0x4217('0x1a')](_0x230cc0)[_0x4217('0x1b')]();};}function respondWithResult(_0x25e046,_0x5c6792){_0x5c6792=_0x5c6792||0xc8;return function(_0x45b1c6){if(_0x45b1c6){return _0x25e046[_0x4217('0x1a')](_0x5c6792)[_0x4217('0x1c')](_0x45b1c6);}};}function respondWithFilteredResult(_0x17f3cf,_0x523a48){return function(_0xadacbd){if(_0xadacbd){var _0x355d01=typeof _0x523a48['offset']===_0x4217('0x1d')&&typeof _0x523a48[_0x4217('0x1e')]===_0x4217('0x1d');var _0x5159f5=_0xadacbd['count'];var _0x1588e0=_0x355d01?0x0:_0x523a48['offset'];var _0x2d6bf7=_0x355d01?_0xadacbd[_0x4217('0x1f')]:_0x523a48[_0x4217('0x20')]+_0x523a48[_0x4217('0x1e')];var _0x193c83;if(_0x2d6bf7>=_0x5159f5){_0x2d6bf7=_0x5159f5;_0x193c83=0xc8;}else{_0x193c83=0xce;}_0x17f3cf['status'](_0x193c83);return _0x17f3cf['set'](_0x4217('0x21'),_0x1588e0+'-'+_0x2d6bf7+'/'+_0x5159f5)[_0x4217('0x1c')](_0xadacbd);}return null;};}function patchUpdates(_0x34aa16){return function(_0x5619bc){try{jsonpatch[_0x4217('0x22')](_0x5619bc,_0x34aa16,!![]);}catch(_0x4d4465){return BPromise[_0x4217('0x23')](_0x4d4465);}return _0x5619bc[_0x4217('0x24')]();};}function saveUpdates(_0x5080b9,_0x332d14){return function(_0x367e1f){if(_0x367e1f){return _0x367e1f['update'](_0x5080b9)['then'](function(_0x273948){return _0x273948;});}return null;};}function removeEntity(_0x45b7ed,_0x5a64d4){return function(_0x1e11e1){if(_0x1e11e1){return _0x1e11e1[_0x4217('0x25')]()[_0x4217('0x26')](function(){_0x45b7ed[_0x4217('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0439,_0x1f872e){return function(_0x351c78){if(!_0x351c78){_0x3a0439['sendStatus'](0x194);}return _0x351c78;};}function handleError(_0x4b1fd4,_0x30a145){_0x30a145=_0x30a145||0x1f4;return function(_0x2c33a4){logger[_0x4217('0x27')](_0x2c33a4[_0x4217('0x28')]);if(_0x2c33a4[_0x4217('0x29')]){delete _0x2c33a4[_0x4217('0x29')];}_0x4b1fd4[_0x4217('0x1a')](_0x30a145)[_0x4217('0x2a')](_0x2c33a4);};}exports[_0x4217('0x2b')]=function(_0x4c87a2,_0x11516f){var _0x2fb928={},_0x2f3c19={},_0x55859d={'count':0x0,'rows':[]};var _0x5e77bc=_['map'](db[_0x4217('0x2c')][_0x4217('0x2d')],function(_0x914bd7){return{'name':_0x914bd7['fieldName'],'type':_0x914bd7['type']['key']};});_0x2f3c19[_0x4217('0x2e')]=_[_0x4217('0x2f')](_0x5e77bc,_0x4217('0x29'));_0x2f3c19[_0x4217('0x30')]=_[_0x4217('0x31')](_0x4c87a2[_0x4217('0x30')]);_0x2f3c19[_0x4217('0x32')]=_['intersection'](_0x2f3c19[_0x4217('0x2e')],_0x2f3c19[_0x4217('0x30')]);_0x2fb928[_0x4217('0x33')]=_[_0x4217('0x34')](_0x2f3c19[_0x4217('0x2e')],qs['fields'](_0x4c87a2[_0x4217('0x30')]['fields']));_0x2fb928[_0x4217('0x33')]=_0x2fb928[_0x4217('0x33')][_0x4217('0x35')]?_0x2fb928[_0x4217('0x33')]:_0x2f3c19['model'];if(!_0x4c87a2['query'][_0x4217('0x36')](_0x4217('0x37'))){_0x2fb928[_0x4217('0x1e')]=qs[_0x4217('0x1e')](_0x4c87a2[_0x4217('0x30')][_0x4217('0x1e')]);_0x2fb928[_0x4217('0x20')]=qs[_0x4217('0x20')](_0x4c87a2['query'][_0x4217('0x20')]);}_0x2fb928[_0x4217('0x38')]=qs[_0x4217('0x39')](_0x4c87a2[_0x4217('0x30')][_0x4217('0x39')]);_0x2fb928['where']=qs['filters'](_[_0x4217('0x3a')](_0x4c87a2[_0x4217('0x30')],_0x2f3c19[_0x4217('0x32')]),_0x5e77bc);if(_0x4c87a2[_0x4217('0x30')][_0x4217('0x3b')]){_0x2fb928[_0x4217('0x3c')]=_[_0x4217('0x3d')](_0x2fb928['where'],{'$or':_[_0x4217('0x2f')](_0x5e77bc,function(_0x3cb96a){if(_0x3cb96a['type']!==_0x4217('0x3e')){var _0x2991e7={};_0x2991e7[_0x3cb96a[_0x4217('0x29')]]={'$like':'%'+_0x4c87a2[_0x4217('0x30')][_0x4217('0x3b')]+'%'};return _0x2991e7;}})});}_0x2fb928=_['merge']({},_0x2fb928,_0x4c87a2['options']);var _0x399f5e={'where':_0x2fb928[_0x4217('0x3c')]};return db[_0x4217('0x2c')][_0x4217('0x1f')](_0x399f5e)[_0x4217('0x26')](function(_0x86dbb4){_0x55859d[_0x4217('0x1f')]=_0x86dbb4;if(_0x4c87a2[_0x4217('0x30')][_0x4217('0x3f')]){_0x2fb928[_0x4217('0x40')]=[{'all':!![]}];}return db[_0x4217('0x2c')]['findAll'](_0x2fb928);})['then'](function(_0x2b3cbd){_0x55859d[_0x4217('0x41')]=_0x2b3cbd;return _0x55859d;})[_0x4217('0x26')](respondWithFilteredResult(_0x11516f,_0x2fb928))[_0x4217('0x42')](handleError(_0x11516f,null));};exports[_0x4217('0x43')]=function(_0x30d764,_0x47fac3){var _0x5cb1fb={'raw':!![],'where':{'id':_0x30d764[_0x4217('0x44')]['id']}},_0x855535={};_0x855535['model']=_['keys'](db[_0x4217('0x2c')][_0x4217('0x2d')]);_0x855535['query']=_[_0x4217('0x31')](_0x30d764[_0x4217('0x30')]);_0x855535[_0x4217('0x32')]=_[_0x4217('0x34')](_0x855535[_0x4217('0x2e')],_0x855535[_0x4217('0x30')]);_0x5cb1fb[_0x4217('0x33')]=_[_0x4217('0x34')](_0x855535['model'],qs[_0x4217('0x45')](_0x30d764[_0x4217('0x30')][_0x4217('0x45')]));_0x5cb1fb[_0x4217('0x33')]=_0x5cb1fb['attributes'][_0x4217('0x35')]?_0x5cb1fb['attributes']:_0x855535['model'];if(_0x30d764['query'][_0x4217('0x3f')]){_0x5cb1fb[_0x4217('0x40')]=[{'all':!![]}];}_0x5cb1fb=_[_0x4217('0x3d')]({},_0x5cb1fb,_0x30d764[_0x4217('0x46')]);return db['CmHopperBlack'][_0x4217('0x47')](_0x5cb1fb)['then'](handleEntityNotFound(_0x47fac3,null))[_0x4217('0x26')](respondWithResult(_0x47fac3,null))['catch'](handleError(_0x47fac3,null));};exports[_0x4217('0x48')]=function(_0x1e0de0,_0x238424){if(_0x1e0de0[_0x4217('0x49')]['id']){delete _0x1e0de0[_0x4217('0x49')]['id'];}return db[_0x4217('0x2c')][_0x4217('0x47')]({'where':{'id':_0x1e0de0['params']['id']}})[_0x4217('0x26')](handleEntityNotFound(_0x238424,null))['then'](saveUpdates(_0x1e0de0[_0x4217('0x49')],null))[_0x4217('0x26')](respondWithResult(_0x238424,null))[_0x4217('0x42')](handleError(_0x238424,null));};exports[_0x4217('0x25')]=function(_0x5da8f3,_0xcc41d8){return db[_0x4217('0x2c')][_0x4217('0x47')]({'where':{'id':_0x5da8f3['params']['id']}})['then'](handleEntityNotFound(_0xcc41d8,null))[_0x4217('0x26')](removeEntity(_0xcc41d8,null))[_0x4217('0x42')](handleError(_0xcc41d8,null));};exports[_0x4217('0x4a')]=function(_0x1fc511,_0x250cf6){return db[_0x4217('0x2c')][_0x4217('0x4a')]()[_0x4217('0x26')](respondWithResult(_0x250cf6,null))[_0x4217('0x42')](handleError(_0x250cf6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index c59b047..c9e1e91 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 _0xb6f6=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','moment','bluebird','path'];(function(_0x64bec,_0x37225c){var _0x46b9c6=function(_0x4cd9af){while(--_0x4cd9af){_0x64bec['push'](_0x64bec['shift']());}};_0x46b9c6(++_0x37225c);}(_0xb6f6,0x10f));var _0x6b6f=function(_0x4eddea,_0x1c3398){_0x4eddea=_0x4eddea-0x0;var _0x285994=_0xb6f6[_0x4eddea];return _0x285994;};'use strict';var _=require(_0x6b6f('0x0'));var util=require(_0x6b6f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b6f('0x2'));var BPromise=require(_0x6b6f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b6f('0x4'));var rimraf=require(_0x6b6f('0x5'));var config=require(_0x6b6f('0x6'));var attributes=require(_0x6b6f('0x7'));module[_0x6b6f('0x8')]=function(_0x1eefa3,_0x2c270c){return _0x1eefa3[_0x6b6f('0x9')](_0x6b6f('0xa'),attributes,{'tableName':_0x6b6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe150=['./cmHopperBlack.attributes','define','CmHopperBlack','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x5e8ba0,_0x1f684d){var _0x391d74=function(_0x4ea358){while(--_0x4ea358){_0x5e8ba0['push'](_0x5e8ba0['shift']());}};_0x391d74(++_0x1f684d);}(_0xe150,0x19a));var _0x0e15=function(_0x1c4a60,_0x506b93){_0x1c4a60=_0x1c4a60-0x0;var _0x2f3b9a=_0xe150[_0x1c4a60];return _0x2f3b9a;};'use strict';var _=require(_0x0e15('0x0'));var util=require(_0x0e15('0x1'));var logger=require(_0x0e15('0x2'))(_0x0e15('0x3'));var moment=require('moment');var BPromise=require(_0x0e15('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e15('0x5'));var rimraf=require(_0x0e15('0x6'));var config=require(_0x0e15('0x7'));var attributes=require(_0x0e15('0x8'));module['exports']=function(_0x387547,_0x12d697){return _0x387547[_0x0e15('0x9')](_0x0e15('0xa'),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 f36f245..edcfe0c 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 _0x7a5e=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','request\x20sent','result','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','include','map','attributes','UpdateCmHopperBlack','update','where','DestroyCmHopperBlack','destroy','lodash'];(function(_0x79d19e,_0x33173a){var _0x28f000=function(_0x28dead){while(--_0x28dead){_0x79d19e['push'](_0x79d19e['shift']());}};_0x28f000(++_0x33173a);}(_0x7a5e,0xb3));var _0xe7a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe7a5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7a5('0x2'));var db=require(_0xe7a5('0x3'))['db'];var utils=require(_0xe7a5('0x4'));var logger=require('../../config/logger')(_0xe7a5('0x5'));var config=require(_0xe7a5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe7a5('0x7')][_0xe7a5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ec159,_0x5b3c26,_0x341c06){return new BPromise(function(_0x54b6b9,_0x599fb4){return client[_0xe7a5('0x9')](_0x4ec159,_0x341c06)[_0xe7a5('0xa')](function(_0x1e5431){logger[_0xe7a5('0xb')](_0xe7a5('0xc'),_0x5b3c26,'request\x20sent');logger[_0xe7a5('0xd')](_0xe7a5('0xe'),_0x5b3c26,'request\x20sent',JSON[_0xe7a5('0xf')](_0x1e5431));if(_0x1e5431[_0xe7a5('0x10')]){if(_0x1e5431[_0xe7a5('0x10')][_0xe7a5('0x11')]===0x1f4){logger['error'](_0xe7a5('0xc'),_0x5b3c26,_0x1e5431[_0xe7a5('0x10')]['message']);return _0x599fb4(_0x1e5431[_0xe7a5('0x10')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x5b3c26,_0x1e5431[_0xe7a5('0x10')]['message']);return _0x54b6b9(_0x1e5431[_0xe7a5('0x10')]['message']);}else{logger['info'](_0xe7a5('0xc'),_0x5b3c26,_0xe7a5('0x12'));_0x54b6b9(_0x1e5431[_0xe7a5('0x13')][_0xe7a5('0x14')]);}})[_0xe7a5('0x15')](function(_0x2d55e3){logger[_0xe7a5('0x10')](_0xe7a5('0xc'),_0x5b3c26,_0x2d55e3);_0x599fb4(_0x2d55e3);});});}exports[_0xe7a5('0x16')]=function(_0x38accf){var _0x3545b3=this;return new Promise(function(_0x21e133,_0x15296e){return db[_0xe7a5('0x17')][_0xe7a5('0x18')]({'raw':_0x38accf[_0xe7a5('0x19')]?_0x38accf[_0xe7a5('0x19')][_0xe7a5('0x1a')]===undefined?!![]:![]:!![],'where':_0x38accf['options']?_0x38accf[_0xe7a5('0x19')]['where']||null:null,'attributes':_0x38accf[_0xe7a5('0x19')]?_0x38accf['options']['attributes']||null:null,'limit':_0x38accf[_0xe7a5('0x19')]?_0x38accf[_0xe7a5('0x19')][_0xe7a5('0x1b')]||null:null,'include':_0x38accf[_0xe7a5('0x19')]?_0x38accf['options'][_0xe7a5('0x1c')]?_[_0xe7a5('0x1d')](_0x38accf[_0xe7a5('0x19')][_0xe7a5('0x1c')],function(_0x4f3122){return{'model':db[_0x4f3122['model']],'as':_0x4f3122['as'],'attributes':_0x4f3122[_0xe7a5('0x1e')],'include':_0x4f3122['include']?_[_0xe7a5('0x1d')](_0x4f3122[_0xe7a5('0x1c')],function(_0x4c4b9c){return{'model':db[_0x4c4b9c['model']],'as':_0x4c4b9c['as'],'attributes':_0x4c4b9c['attributes'],'include':_0x4c4b9c['include']?_[_0xe7a5('0x1d')](_0x4c4b9c[_0xe7a5('0x1c')],function(_0x1a58b7){return{'model':db[_0x1a58b7['model']],'as':_0x1a58b7['as'],'attributes':_0x1a58b7[_0xe7a5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe7a5('0xa')](function(_0x8444d8){logger['info'](_0xe7a5('0x16'),_0x38accf);logger[_0xe7a5('0xd')](_0xe7a5('0x16'),_0x38accf,JSON[_0xe7a5('0xf')](_0x8444d8));_0x21e133(_0x8444d8);})['catch'](function(_0x2c4c31){logger[_0xe7a5('0x10')](_0xe7a5('0x16'),_0x2c4c31[_0xe7a5('0x14')],_0x38accf);_0x15296e(_0x3545b3['error'](0x1f4,_0x2c4c31[_0xe7a5('0x14')]));});});};exports[_0xe7a5('0x1f')]=function(_0x1e689f){var _0xbcdf68=this;return new Promise(function(_0x21a40b,_0x4f5268){return db['CmHopperBlack'][_0xe7a5('0x20')](_0x1e689f['body'],{'raw':_0x1e689f[_0xe7a5('0x19')]?_0x1e689f[_0xe7a5('0x19')][_0xe7a5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e689f['options']?_0x1e689f[_0xe7a5('0x19')][_0xe7a5('0x21')]||null:null,'attributes':_0x1e689f['options']?_0x1e689f['options'][_0xe7a5('0x1e')]||null:null,'limit':_0x1e689f[_0xe7a5('0x19')]?_0x1e689f[_0xe7a5('0x19')]['limit']||null:null})[_0xe7a5('0xa')](function(_0x744fd5){logger[_0xe7a5('0xb')](_0xe7a5('0x1f'),_0x1e689f);logger[_0xe7a5('0xd')](_0xe7a5('0x1f'),_0x1e689f,JSON[_0xe7a5('0xf')](_0x744fd5));_0x21a40b(_0x744fd5);})['catch'](function(_0x183a5c){logger[_0xe7a5('0x10')](_0xe7a5('0x1f'),_0x183a5c[_0xe7a5('0x14')],_0x1e689f);_0x4f5268(_0xbcdf68[_0xe7a5('0x10')](0x1f4,_0x183a5c[_0xe7a5('0x14')]));});});};exports[_0xe7a5('0x22')]=function(_0x233d6a){var _0x2b52bd=this;return new Promise(function(_0x8ef93e,_0x2ba4f8){return db[_0xe7a5('0x17')][_0xe7a5('0x23')]({'where':_0x233d6a['options']?_0x233d6a['options'][_0xe7a5('0x21')]||null:null})[_0xe7a5('0xa')](function(_0x456433){logger[_0xe7a5('0xb')]('DestroyCmHopperBlack',_0x233d6a);logger['debug'](_0xe7a5('0x22'),_0x233d6a,JSON[_0xe7a5('0xf')](_0x456433));_0x8ef93e(_0x456433);})[_0xe7a5('0x15')](function(_0x2e3ac0){logger[_0xe7a5('0x10')](_0xe7a5('0x22'),_0x2e3ac0['message'],_0x233d6a);_0x2ba4f8(_0x2b52bd[_0xe7a5('0x10')](0x1f4,_0x2e3ac0[_0xe7a5('0x14')]));});});}; \ No newline at end of file +var _0xcd24=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','CmHopperBlack,\x20%s,\x20%s','GetCmHopperBlack','findAll','options','raw','include','map','model','attributes','stringify','catch','body','where','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment'];(function(_0x22788e,_0x1c277){var _0x91255=function(_0x14809b){while(--_0x14809b){_0x22788e['push'](_0x22788e['shift']());}};_0x91255(++_0x1c277);}(_0xcd24,0x16f));var _0x4cd2=function(_0x256463,_0x4f64c3){_0x256463=_0x256463-0x0;var _0x1fcebf=_0xcd24[_0x256463];return _0x1fcebf;};'use strict';var _=require(_0x4cd2('0x0'));var util=require(_0x4cd2('0x1'));var moment=require(_0x4cd2('0x2'));var BPromise=require(_0x4cd2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cd2('0x4'));var db=require(_0x4cd2('0x5'))['db'];var utils=require(_0x4cd2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4cd2('0x7'));var jayson=require(_0x4cd2('0x8'));var client=jayson[_0x4cd2('0x9')][_0x4cd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c5e4f,_0x46aa01,_0x56d96c){return new BPromise(function(_0x3333e8,_0x21dab0){return client[_0x4cd2('0xb')](_0x5c5e4f,_0x56d96c)[_0x4cd2('0xc')](function(_0x5f082d){logger[_0x4cd2('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x46aa01,_0x4cd2('0xe'));logger[_0x4cd2('0xf')](_0x4cd2('0x10'),_0x46aa01,_0x4cd2('0xe'),JSON['stringify'](_0x5f082d));if(_0x5f082d[_0x4cd2('0x11')]){if(_0x5f082d[_0x4cd2('0x11')][_0x4cd2('0x12')]===0x1f4){logger[_0x4cd2('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x46aa01,_0x5f082d['error']['message']);return _0x21dab0(_0x5f082d[_0x4cd2('0x11')][_0x4cd2('0x13')]);}logger[_0x4cd2('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x46aa01,_0x5f082d['error'][_0x4cd2('0x13')]);return _0x3333e8(_0x5f082d[_0x4cd2('0x11')][_0x4cd2('0x13')]);}else{logger[_0x4cd2('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x46aa01,_0x4cd2('0xe'));_0x3333e8(_0x5f082d[_0x4cd2('0x14')]['message']);}})['catch'](function(_0x3d1dfb){logger[_0x4cd2('0x11')](_0x4cd2('0x15'),_0x46aa01,_0x3d1dfb);_0x21dab0(_0x3d1dfb);});});}exports[_0x4cd2('0x16')]=function(_0x4da0a2){var _0x4640e3=this;return new Promise(function(_0x23ece3,_0x333a02){return db['CmHopperBlack'][_0x4cd2('0x17')]({'raw':_0x4da0a2['options']?_0x4da0a2[_0x4cd2('0x18')][_0x4cd2('0x19')]===undefined?!![]:![]:!![],'where':_0x4da0a2[_0x4cd2('0x18')]?_0x4da0a2[_0x4cd2('0x18')]['where']||null:null,'attributes':_0x4da0a2[_0x4cd2('0x18')]?_0x4da0a2[_0x4cd2('0x18')]['attributes']||null:null,'limit':_0x4da0a2[_0x4cd2('0x18')]?_0x4da0a2['options']['limit']||null:null,'include':_0x4da0a2[_0x4cd2('0x18')]?_0x4da0a2[_0x4cd2('0x18')][_0x4cd2('0x1a')]?_[_0x4cd2('0x1b')](_0x4da0a2['options'][_0x4cd2('0x1a')],function(_0x15588b){return{'model':db[_0x15588b[_0x4cd2('0x1c')]],'as':_0x15588b['as'],'attributes':_0x15588b[_0x4cd2('0x1d')],'include':_0x15588b[_0x4cd2('0x1a')]?_[_0x4cd2('0x1b')](_0x15588b['include'],function(_0x30f26d){return{'model':db[_0x30f26d[_0x4cd2('0x1c')]],'as':_0x30f26d['as'],'attributes':_0x30f26d[_0x4cd2('0x1d')],'include':_0x30f26d[_0x4cd2('0x1a')]?_['map'](_0x30f26d[_0x4cd2('0x1a')],function(_0x572b93){return{'model':db[_0x572b93[_0x4cd2('0x1c')]],'as':_0x572b93['as'],'attributes':_0x572b93[_0x4cd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4cd2('0xc')](function(_0x33171c){logger[_0x4cd2('0xd')](_0x4cd2('0x16'),_0x4da0a2);logger[_0x4cd2('0xf')](_0x4cd2('0x16'),_0x4da0a2,JSON[_0x4cd2('0x1e')](_0x33171c));_0x23ece3(_0x33171c);})[_0x4cd2('0x1f')](function(_0x87f11d){logger[_0x4cd2('0x11')](_0x4cd2('0x16'),_0x87f11d[_0x4cd2('0x13')],_0x4da0a2);_0x333a02(_0x4640e3[_0x4cd2('0x11')](0x1f4,_0x87f11d[_0x4cd2('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x1880f3){var _0x55c369=this;return new Promise(function(_0x2f93be,_0x222f3a){return db['CmHopperBlack']['update'](_0x1880f3[_0x4cd2('0x20')],{'raw':_0x1880f3['options']?_0x1880f3[_0x4cd2('0x18')][_0x4cd2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1880f3['options']?_0x1880f3[_0x4cd2('0x18')][_0x4cd2('0x21')]||null:null,'attributes':_0x1880f3[_0x4cd2('0x18')]?_0x1880f3[_0x4cd2('0x18')][_0x4cd2('0x1d')]||null:null,'limit':_0x1880f3['options']?_0x1880f3[_0x4cd2('0x18')]['limit']||null:null})['then'](function(_0x270627){logger[_0x4cd2('0xd')](_0x4cd2('0x22'),_0x1880f3);logger[_0x4cd2('0xf')]('UpdateCmHopperBlack',_0x1880f3,JSON['stringify'](_0x270627));_0x2f93be(_0x270627);})[_0x4cd2('0x1f')](function(_0x4d6e7b){logger[_0x4cd2('0x11')](_0x4cd2('0x22'),_0x4d6e7b[_0x4cd2('0x13')],_0x1880f3);_0x222f3a(_0x55c369[_0x4cd2('0x11')](0x1f4,_0x4d6e7b[_0x4cd2('0x13')]));});});};exports[_0x4cd2('0x23')]=function(_0x1a644c){var _0xa120eb=this;return new Promise(function(_0x1a7054,_0x397a33){return db['CmHopperBlack'][_0x4cd2('0x24')]({'where':_0x1a644c[_0x4cd2('0x18')]?_0x1a644c['options'][_0x4cd2('0x21')]||null:null})[_0x4cd2('0xc')](function(_0xe72bb){logger[_0x4cd2('0xd')](_0x4cd2('0x23'),_0x1a644c);logger[_0x4cd2('0xf')](_0x4cd2('0x23'),_0x1a644c,JSON[_0x4cd2('0x1e')](_0xe72bb));_0x1a7054(_0xe72bb);})[_0x4cd2('0x1f')](function(_0x534b99){logger[_0x4cd2('0x11')]('DestroyCmHopperBlack',_0x534b99[_0x4cd2('0x13')],_0x1a644c);_0x397a33(_0xa120eb[_0x4cd2('0x11')](0x1f4,_0x534b99[_0x4cd2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 1e607e8..5052742 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 _0x3e24=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','/:id','delete','exports','multer'];(function(_0x42f46f,_0x326127){var _0xed56ef=function(_0x1f8f59){while(--_0x1f8f59){_0x42f46f['push'](_0x42f46f['shift']());}};_0xed56ef(++_0x326127);}(_0x3e24,0x167));var _0x43e2=function(_0xf3f0cc,_0x5a6ff3){_0xf3f0cc=_0xf3f0cc-0x0;var _0x30935a=_0x3e24[_0xf3f0cc];return _0x30935a;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require(_0x43e2('0x3'));var express=require(_0x43e2('0x4'));var router=express['Router']();var fs_extra=require(_0x43e2('0x5'));var auth=require(_0x43e2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x43e2('0x7'));var controller=require(_0x43e2('0x8'));router[_0x43e2('0x9')]('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0xb')]);router[_0x43e2('0x9')](_0x43e2('0xc'),auth['isAuthenticated'](),controller[_0x43e2('0xd')]);router[_0x43e2('0x9')]('/:id',auth[_0x43e2('0xa')](),controller[_0x43e2('0xe')]);router['put'](_0x43e2('0xf'),auth[_0x43e2('0xa')](),controller['update']);router[_0x43e2('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x43e2('0x11')]=router; \ No newline at end of file +var _0x3c6c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','put','update','destroy','multer','path','connect-timeout','express','Router'];(function(_0x647b,_0x3c1fa3){var _0x22de87=function(_0x20312c){while(--_0x20312c){_0x647b['push'](_0x647b['shift']());}};_0x22de87(++_0x3c1fa3);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x535bdc,_0x24868d){_0x535bdc=_0x535bdc-0x0;var _0x36f727=_0x3c6c[_0x535bdc];return _0x36f727;};'use strict';var multer=require(_0xc3c6('0x0'));var util=require('util');var path=require(_0xc3c6('0x1'));var timeout=require(_0xc3c6('0x2'));var express=require(_0xc3c6('0x3'));var router=express[_0xc3c6('0x4')]();var fs_extra=require(_0xc3c6('0x5'));var auth=require(_0xc3c6('0x6'));var interaction=require(_0xc3c6('0x7'));var config=require(_0xc3c6('0x8'));var controller=require('./cmHopperBlack.controller');router[_0xc3c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3c6('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller['show']);router[_0xc3c6('0xd')](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xe')]);router['delete'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f91e3f2..931a9b0 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 _0x9ee3=['seconds','BOOLEAN','moment','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9ee3,0x1c5));var _0x39ee=function(_0x3cc98e,_0x52bf02){_0x3cc98e=_0x3cc98e-0x0;var _0x47987d=_0x9ee3[_0x3cc98e];return _0x47987d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x39ee('0x0'));module['exports']={'state':{'type':Sequelize[_0x39ee('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x39ee('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x39ee('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x39ee('0x3')]},'originatecalleridname':{'type':Sequelize[_0x39ee('0x3')]},'calleridnum':{'type':Sequelize[_0x39ee('0x3')]},'calleridname':{'type':Sequelize[_0x39ee('0x3')]},'starttime':{'type':Sequelize[_0x39ee('0x2')]},'responsetime':{'type':Sequelize[_0x39ee('0x2')]},'answertime':{'type':Sequelize[_0x39ee('0x2')]},'droptime':{'type':Sequelize[_0x39ee('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x39ee('0x3')]},'campaign':{'type':Sequelize[_0x39ee('0x3')]},'campaigntype':{'type':Sequelize[_0x39ee('0x3')]},'membername':{'type':Sequelize[_0x39ee('0x3')]},'reason':{'type':Sequelize[_0x39ee('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x39ee('0x2')],'set':function(_0x2ed2cb){var _0x46e7e8=this[_0x39ee('0x4')](_0x39ee('0x5'));if(_0x46e7e8&&_0x2ed2cb){this[_0x39ee('0x6')](_0x39ee('0x7'),moment(_0x2ed2cb)[_0x39ee('0x8')](moment(_0x46e7e8),_0x39ee('0x9')));}}},'amd':{'type':Sequelize[_0x39ee('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x39ee('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x39ee('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x39ee('0x2')]},'deleted':{'type':Sequelize[_0x39ee('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x39ee('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x39ee('0x2')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x39ee('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcebe=['seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x2fd138,_0x38635e){var _0x122003=function(_0x3f6644){while(--_0x3f6644){_0x2fd138['push'](_0x2fd138['shift']());}};_0x122003(++_0x38635e);}(_0xcebe,0x1b2));var _0xeceb=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xcebe[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xeceb('0x0'));var moment=require('moment');module[_0xeceb('0x1')]={'state':{'type':Sequelize[_0xeceb('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xeceb('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xeceb('0x3')]},'originatecalleridname':{'type':Sequelize[_0xeceb('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xeceb('0x4')]},'responsetime':{'type':Sequelize[_0xeceb('0x4')]},'answertime':{'type':Sequelize[_0xeceb('0x4')]},'droptime':{'type':Sequelize[_0xeceb('0x4')]},'endtime':{'type':Sequelize[_0xeceb('0x4')]},'ringtime':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xeceb('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xeceb('0x3')]},'membername':{'type':Sequelize[_0xeceb('0x3')]},'reason':{'type':Sequelize[_0xeceb('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xeceb('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xeceb('0x4')],'set':function(_0x4212b4){var _0x9f4f60=this[_0xeceb('0x5')](_0xeceb('0x6'));if(_0x9f4f60&&_0x4212b4){this[_0xeceb('0x7')](_0xeceb('0x8'),moment(_0x4212b4)[_0xeceb('0x9')](moment(_0x9f4f60),_0xeceb('0xa')));}}},'amd':{'type':Sequelize[_0xeceb('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xeceb('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xeceb('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xeceb('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xeceb('0x4')]},'callback':{'type':Sequelize[_0xeceb('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xeceb('0x4')]},'deleted':{'type':Sequelize[_0xeceb('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xeceb('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xeceb('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xeceb('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 1886cf1..e39d667 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 _0x687b=['filter','VIRTUAL','options','include','findAll','rows','show','length','includeAll','merge','find','catch','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper_final','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0x687b,0x14a));var _0xb687=function(_0x4a450a,_0x54d42f){_0x4a450a=_0x4a450a-0x0;var _0x28baf9=_0x687b[_0x4a450a];return _0x28baf9;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':!![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['CmHopperFinal'][_0xb687('0x4b')]()[_0xb687('0x26')](respondWithResult(_0x4f3069,null))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports[_0xb687('0x25')]=function(_0x535c00,_0x33a0b0){if(_0x535c00[_0xb687('0x4c')][_0xb687('0x4d')]){delete _0x535c00[_0xb687('0x4c')]['uniqueid'];}return db['CmHopperFinal'][_0xb687('0x49')]({'where':{'uniqueid':_0x535c00[_0xb687('0x4e')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x33a0b0,null))['then'](saveUpdates(_0x535c00['body'],null))[_0xb687('0x26')](respondWithResult(_0x33a0b0,null))[_0xb687('0x4a')](handleError(_0x33a0b0,null));};exports[_0xb687('0x4f')]=function(_0x22e618,_0x34205d,_0x1fb31a){return db[_0xb687('0x2f')][_0xb687('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x22e618['params']['id']},'attributes':[[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x53')))),_0xb687('0x54')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x55')))),_0xb687('0x56')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb687('0x57')))),_0xb687('0x58')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb687('0x59')],[db['sequelize']['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb687('0x5a')))),_0xb687('0x5b')],[db['sequelize']['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')]['literal'](_0xb687('0x5c')))),'reCallContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xb687('0x26')](handleEntityNotFound(_0x34205d,null))['then'](respondWithResult(_0x34205d,null))['catch'](handleError(_0x34205d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5d266c,_0x1cc507,_0x1db4ca){return db[_0xb687('0x2f')][_0xb687('0x43')]({'raw':![],'where':{'CampaignId':_0x5d266c[_0xb687('0x4e')]['id']},'attributes':[[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5d')))),'noSuchContacts'],[db['sequelize']['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x53')))),_0xb687('0x54')],[db[_0xb687('0x50')]['fn']('COUNT',db[_0xb687('0x50')]['fn']('IF',db['sequelize'][_0xb687('0x52')](_0xb687('0x55')))),_0xb687('0x56')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')]['literal'](_0xb687('0x57')))),_0xb687('0x58')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize'][_0xb687('0x52')](_0xb687('0x5e')))),_0xb687('0x59')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5a')))),_0xb687('0x5b')],[db[_0xb687('0x50')]['fn']('COUNT',db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5c')))),'reCallContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5f')))),'answeringMachine']]})[_0xb687('0x26')](handleEntityNotFound(_0x1cc507,null))[_0xb687('0x26')](respondWithResult(_0x1cc507,null))['catch'](handleError(_0x1cc507,null));};exports[_0xb687('0x60')]=function(_0x5449c4,_0x2c2add,_0x431cc5){return db['VoiceQueue'][_0xb687('0x49')]({'where':{'id':_0x5449c4[_0xb687('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c2add,null))[_0xb687('0x26')](function(_0x1736ef){var _0x52285e;if(_0x1736ef){_0x52285e=squel['insert']()[_0xb687('0x61')]('cm_hopper')[_0xb687('0x62')]([_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65'),_0xb687('0x66'),_0xb687('0x67'),_0xb687('0x68'),_0xb687('0x69')],squel['select']()[_0xb687('0x6a')](_0xb687('0x6b'),_0xb687('0x63'))[_0xb687('0x6a')](_0xb687('0x6c'),_0xb687('0x64'))['field'](_0xb687('0x6d'),_0xb687('0x65'))['field'](_0xb687('0x6e'),_0xb687('0x66'))[_0xb687('0x6a')](_0xb687('0x6f'),'VoiceQueueId')[_0xb687('0x6a')]('NOW()','createdAt')[_0xb687('0x6a')]('NOW()','updatedAt')[_0xb687('0x70')]('cm_hopper_final')[_0xb687('0x3e')](_0xb687('0x71'),_0x5449c4['params']['id'][_0xb687('0x72')]())[_0xb687('0x3e')]('state\x20=\x20?',_0x5449c4[_0xb687('0x4c')][_0xb687('0x73')][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x74'))[_0xb687('0x3e')](_0xb687('0x75'),squel[_0xb687('0x76')]()[_0xb687('0x6a')](_0xb687('0x63'))[_0xb687('0x70')]('cm_hopper')[_0xb687('0x3e')]('VoiceQueueId\x20=\x20?',_0x5449c4['params']['id'][_0xb687('0x72')]()))[_0xb687('0x3e')](_0xb687('0x75'),squel[_0xb687('0x76')]()[_0xb687('0x6a')]('calleridnum')['from'](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x71'),_0x5449c4[_0xb687('0x4e')]['id']['toString']())[_0xb687('0x3e')](_0xb687('0x78')))[_0xb687('0x79')](_0xb687('0x65')))[_0xb687('0x72')]();return db[_0xb687('0x50')][_0xb687('0x34')](_0x52285e);}return[];})[_0xb687('0x26')](respondWithResult(_0x2c2add,null))[_0xb687('0x4a')](handleError(_0x2c2add,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x25f5c3,_0x33d1fc,_0x207953){return db[_0xb687('0x7a')][_0xb687('0x49')]({'where':{'id':_0x25f5c3['params']['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x33d1fc,null))[_0xb687('0x26')](function(_0x48bbee){var _0x19ac6d;if(_0x48bbee){_0x19ac6d=squel['insert']()[_0xb687('0x61')](_0xb687('0x7b'))['fromQuery']([_0xb687('0x63'),_0xb687('0x64'),'ContactId',_0xb687('0x66'),_0xb687('0x7c'),_0xb687('0x68'),_0xb687('0x69')],squel[_0xb687('0x76')]()[_0xb687('0x6a')]('ANY_VALUE(calleridnum)',_0xb687('0x63'))[_0xb687('0x6a')](_0xb687('0x6c'),_0xb687('0x64'))[_0xb687('0x6a')](_0xb687('0x6d'),_0xb687('0x65'))[_0xb687('0x6a')](_0xb687('0x6e'),_0xb687('0x66'))[_0xb687('0x6a')]('ANY_VALUE(CampaignId)',_0xb687('0x7c'))['field'](_0xb687('0x6c'),_0xb687('0x68'))['field']('NOW()',_0xb687('0x69'))[_0xb687('0x70')](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3[_0xb687('0x4e')]['id'][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x7e'),_0x25f5c3[_0xb687('0x4c')][_0xb687('0x73')][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x74'))[_0xb687('0x3e')](_0xb687('0x75'),squel['select']()['field'](_0xb687('0x63'))['from']('cm_hopper')[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3['params']['id'][_0xb687('0x72')]()))[_0xb687('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb687('0x76')]()[_0xb687('0x6a')](_0xb687('0x7f'))[_0xb687('0x70')](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3[_0xb687('0x4e')]['id'][_0xb687('0x72')]())['where'](_0xb687('0x78')))[_0xb687('0x79')]('ContactId'))[_0xb687('0x72')]();return db['sequelize'][_0xb687('0x34')](_0x19ac6d);}return[];})[_0xb687('0x26')](respondWithResult(_0x33d1fc,null))['catch'](handleError(_0x33d1fc,null));};exports[_0xb687('0x80')]=function(_0x20e46a,_0x1c389f,_0x45d0ab){return db[_0xb687('0x81')][_0xb687('0x82')]({'where':{'VoiceQueueId':_0x20e46a[_0xb687('0x4c')]['VoiceQueueId'],'CampaignId':_0x20e46a['body'][_0xb687('0x7c')],'ContactId':_0x20e46a['body'][_0xb687('0x65')]}})[_0xb687('0x26')](handleEntityNotFound(_0x1c389f,null))[_0xb687('0x26')](function(_0x312529){if(_0x312529){return _0x312529;}return null;})['then'](respondWithResult(_0x1c389f,null))[_0xb687('0x4a')](handleError(_0x1c389f,null));}; \ No newline at end of file +var _0xc4aa=['ContactId','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','phone','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../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','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','describe','uniqueid','find','body','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','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','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)'];(function(_0x3f3a47,_0x28f84b){var _0x57a682=function(_0x1175d3){while(--_0x1175d3){_0x3f3a47['push'](_0x3f3a47['shift']());}};_0x57a682(++_0x28f84b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')]()['then'](respondWithResult(_0x244950,null))['catch'](handleError(_0x244950,null));};exports[_0xac4a('0x23')]=function(_0x4aaeff,_0x18ae96){if(_0x4aaeff['body'][_0xac4a('0x4a')]){delete _0x4aaeff['body'][_0xac4a('0x4a')];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'uniqueid':_0x4aaeff[_0xac4a('0x46')]['id']}})['then'](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x24')](saveUpdates(_0x4aaeff[_0xac4a('0x4c')],null))[_0xac4a('0x24')](respondWithResult(_0x18ae96,null))[_0xac4a('0x44')](handleError(_0x18ae96,null));};exports[_0xac4a('0x4d')]=function(_0x138876,_0x187306,_0x4e6e19){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'VoiceQueueId':_0x138876['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')]('`state`\x20=\x203,\x201,\x20null'))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')]('`state`\x20=\x205,\x201,\x20null'))),_0xac4a('0x55')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db['sequelize']['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x5e')))),'answeringMachine']]})[_0xac4a('0x24')](handleEntityNotFound(_0x187306,null))['then'](respondWithResult(_0x187306,null))['catch'](handleError(_0x187306,null));};exports[_0xac4a('0x5f')]=function(_0x568ffb,_0x3bcae2,_0x3c2f84){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'CampaignId':_0x568ffb['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn']('COUNT',db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x60')))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x61')))),_0xac4a('0x55')],[db['sequelize']['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5e')))),_0xac4a('0x62')]]})[_0xac4a('0x24')](handleEntityNotFound(_0x3bcae2,null))['then'](respondWithResult(_0x3bcae2,null))[_0xac4a('0x44')](handleError(_0x3bcae2,null));};exports[_0xac4a('0x63')]=function(_0x26bd31,_0x231932,_0x513976){return db[_0xac4a('0x64')]['find']({'where':{'id':_0x26bd31[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x231932,null))['then'](function(_0x5bd95b){var _0x17eac2;if(_0x5bd95b){_0x17eac2=squel[_0xac4a('0x65')]()[_0xac4a('0x66')]('cm_hopper')[_0xac4a('0x67')](['phone',_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x69'),'createdAt',_0xac4a('0x6a')],squel['select']()[_0xac4a('0x6b')](_0xac4a('0x6c'),'phone')[_0xac4a('0x6b')]('NOW()',_0xac4a('0x68'))[_0xac4a('0x6b')]('ANY_VALUE(ContactId)',_0xac4a('0x6d'))['field']('ANY_VALUE(ListId)',_0xac4a('0x6e'))['field'](_0xac4a('0x6f'),'VoiceQueueId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')]('NOW()','updatedAt')[_0xac4a('0x72')](_0xac4a('0x73'))['where']('VoiceQueueId\x20=\x20?',_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x75'),_0x26bd31[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))['where'](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')]('phone')[_0xac4a('0x72')](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id']['toString']()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x7d')))[_0xac4a('0x7e')]('ContactId'))[_0xac4a('0x74')]();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x17eac2);}return[];})[_0xac4a('0x24')](respondWithResult(_0x231932,null))['catch'](handleError(_0x231932,null));};exports[_0xac4a('0x7f')]=function(_0x56a934,_0x4447b5,_0x22b718){return db['Campaign']['find']({'where':{'id':_0x56a934[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x4447b5,null))[_0xac4a('0x24')](function(_0x4bb03d){var _0x1f3f1c;if(_0x4bb03d){_0x1f3f1c=squel['insert']()[_0xac4a('0x66')](_0xac4a('0x7a'))[_0xac4a('0x67')]([_0xac4a('0x80'),_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x81'),_0xac4a('0x71'),_0xac4a('0x6a')],squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x6c'),_0xac4a('0x80'))[_0xac4a('0x6b')]('NOW()','scheduledAt')[_0xac4a('0x6b')](_0xac4a('0x82'),_0xac4a('0x6d'))[_0xac4a('0x6b')](_0xac4a('0x83'),_0xac4a('0x6e'))[_0xac4a('0x6b')](_0xac4a('0x84'),'CampaignId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')](_0xac4a('0x70'),_0xac4a('0x6a'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where'](_0xac4a('0x75'),_0x56a934[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()['field'](_0xac4a('0x80'))['from'](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel['select']()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))[_0xac4a('0x3d')]('CampaignId\x20=\x20?',_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where']('state\x20=\x204'))[_0xac4a('0x7e')](_0xac4a('0x6d')))['toString']();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x1f3f1c);}return[];})[_0xac4a('0x24')](respondWithResult(_0x4447b5,null))[_0xac4a('0x44')](handleError(_0x4447b5,null));};exports[_0xac4a('0x86')]=function(_0x34787c,_0x599775,_0xbdff4b){return db[_0xac4a('0x87')][_0xac4a('0x88')]({'where':{'VoiceQueueId':_0x34787c['body'][_0xac4a('0x69')],'CampaignId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x81')],'ContactId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x6d')]}})[_0xac4a('0x24')](handleEntityNotFound(_0x599775,null))['then'](function(_0xe84bf7){if(_0xe84bf7){return _0xe84bf7;}return null;})[_0xac4a('0x24')](respondWithResult(_0x599775,null))['catch'](handleError(_0x599775,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 34af0e6..60da711 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 _0x81a5=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x140ae0,_0x3d3b73){var _0x1ecbd8=function(_0x2e0bd4){while(--_0x2e0bd4){_0x140ae0['push'](_0x140ae0['shift']());}};_0x1ecbd8(++_0x3d3b73);}(_0x81a5,0x13d));var _0x581a=function(_0x1903ac,_0x5e96b2){_0x1903ac=_0x1903ac-0x0;var _0x38d640=_0x81a5[_0x1903ac];return _0x38d640;};'use strict';var _=require(_0x581a('0x0'));var util=require(_0x581a('0x1'));var logger=require(_0x581a('0x2'))(_0x581a('0x3'));var moment=require(_0x581a('0x4'));var BPromise=require(_0x581a('0x5'));var rp=require(_0x581a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x581a('0x7'));var config=require(_0x581a('0x8'));var attributes=require(_0x581a('0x9'));module[_0x581a('0xa')]=function(_0xeec1ec,_0x1f77c7){return _0xeec1ec[_0x581a('0xb')](_0x581a('0xc'),attributes,{'tableName':_0x581a('0xd'),'paranoid':![],'indexes':[{'name':_0x581a('0xe'),'fields':[_0x581a('0xe')]},{'name':_0x581a('0xf'),'fields':[_0x581a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28a0=['define','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x28a0,0xad));var _0x028a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x28a0[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x028a('0x0'));var util=require('util');var logger=require(_0x028a('0x1'))(_0x028a('0x2'));var moment=require('moment');var BPromise=require(_0x028a('0x3'));var rp=require(_0x028a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x028a('0x5'));var config=require(_0x028a('0x6'));var attributes=require(_0x028a('0x7'));module[_0x028a('0x8')]=function(_0x2a60e6,_0x43195d){return _0x2a60e6[_0x028a('0x9')]('CmHopperFinal',attributes,{'tableName':_0x028a('0xa'),'paranoid':![],'indexes':[{'name':_0x028a('0xb'),'fields':[_0x028a('0xb')]},{'name':_0x028a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index b5a63a3..0e1aa5c 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(_0x542aa4,_0x37e638){var _0x37bd40=function(_0x5d5db9){while(--_0x5d5db9){_0x542aa4['push'](_0x542aa4['shift']());}};_0x37bd40(++_0x37e638);}(_0xb10b,0x12a));var _0xbb10=function(_0x568eca,_0x549174){_0x568eca=_0x568eca-0x0;var _0x767192=_0xb10b[_0x568eca];return _0x767192;};'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(_0x384217,_0x2b6539){var _0x5ba1ba=function(_0x1832e6){while(--_0x1832e6){_0x384217['push'](_0x384217['shift']());}};_0x5ba1ba(++_0x2b6539);}(_0x7a54,0x106));var _0x47a5=function(_0x43da19,_0x6bfb47){_0x43da19=_0x43da19-0x0;var _0x4ac756=_0x7a54[_0x43da19];return _0x4ac756;};'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 27837a5..070f53a 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 _0x15b5=['post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','multer','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x15b5,0x1bf));var _0x515b=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0x15b5[_0x5d88c0];return _0x1b40f0;};'use strict';var multer=require(_0x515b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x515b('0x1'));var auth=require(_0x515b('0x2'));var interaction=require(_0x515b('0x3'));var config=require(_0x515b('0x4'));var controller=require(_0x515b('0x5'));router[_0x515b('0x6')]('/',auth[_0x515b('0x7')](),controller[_0x515b('0x8')]);router['get'](_0x515b('0x9'),auth[_0x515b('0x7')](),controller['describe']);router[_0x515b('0x6')](_0x515b('0xa'),auth[_0x515b('0x7')](),controller['show']);router[_0x515b('0x6')](_0x515b('0xb'),auth[_0x515b('0x7')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x515b('0x6')]('/campaign/countAttributes/:id',auth[_0x515b('0x7')](),controller[_0x515b('0xc')]);router[_0x515b('0xd')](_0x515b('0xe'),auth[_0x515b('0x7')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x515b('0xd')](_0x515b('0xf'),auth['isAuthenticated'](),controller[_0x515b('0x10')]);router[_0x515b('0xd')](_0x515b('0x11'),auth[_0x515b('0x7')](),controller[_0x515b('0x12')]);router['put']('/:id',auth[_0x515b('0x7')](),controller[_0x515b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x429a=['get','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated'];(function(_0x47ee6b,_0x1b3906){var _0x1780c5=function(_0x513118){while(--_0x513118){_0x47ee6b['push'](_0x47ee6b['shift']());}};_0x1780c5(++_0x1b3906);}(_0x429a,0x116));var _0xa429=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0x429a[_0x71b765];return _0x34cb24;};'use strict';var multer=require(_0xa429('0x0'));var util=require(_0xa429('0x1'));var path=require(_0xa429('0x2'));var timeout=require(_0xa429('0x3'));var express=require('express');var router=express[_0xa429('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa429('0x5'));var interaction=require(_0xa429('0x6'));var config=require(_0xa429('0x7'));var controller=require(_0xa429('0x8'));router['get']('/',auth[_0xa429('0x9')](),controller['index']);router['get']('/describe',auth[_0xa429('0x9')](),controller['describe']);router[_0xa429('0xa')](_0xa429('0xb'),auth[_0xa429('0x9')](),controller[_0xa429('0xc')]);router[_0xa429('0xa')](_0xa429('0xd'),auth[_0xa429('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xa429('0xe'),auth[_0xa429('0x9')](),controller[_0xa429('0xf')]);router[_0xa429('0x10')](_0xa429('0x11'),auth[_0xa429('0x9')](),controller[_0xa429('0x12')]);router[_0xa429('0x10')](_0xa429('0x13'),auth[_0xa429('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xa429('0x10')](_0xa429('0x14'),auth[_0xa429('0x9')](),controller['checkContactHopper']);router[_0xa429('0x15')](_0xa429('0xb'),auth['isAuthenticated'](),controller[_0xa429('0x16')]);module[_0xa429('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f63e7d1..ae6e01b 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 _0x4c97=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x2af732,_0x852a76){var _0x2f0a55=function(_0x1e87cd){while(--_0x1e87cd){_0x2af732['push'](_0x2af732['shift']());}};_0x2f0a55(++_0x852a76);}(_0x4c97,0xd0));var _0x74c9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x4c97[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x74c9('0x0'));module[_0x74c9('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x74c9('0x2')]},'scheduledat':{'type':Sequelize[_0x74c9('0x3')]},'countbusyretry':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x74c9('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x74c9('0x2')]},'starttime':{'type':Sequelize[_0x74c9('0x3')]},'responsetime':{'type':Sequelize[_0x74c9('0x3')]},'answertime':{'type':Sequelize[_0x74c9('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x74c9('0x3')]},'ringtime':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x74c9('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x74c9('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x74c9('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x74c9('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x74c9('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x74c9('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x74c9('0x3')]},'recallme':{'type':Sequelize[_0x74c9('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x74c9('0x3')]},'edited':{'type':Sequelize[_0x74c9('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x74c9('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf5ec=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x29ddc9,_0x199f64){var _0x31def5=function(_0x14aed8){while(--_0x14aed8){_0x29ddc9['push'](_0x29ddc9['shift']());}};_0x31def5(++_0x199f64);}(_0xf5ec,0x165));var _0xcf5e=function(_0x4384c0,_0x41e746){_0x4384c0=_0x4384c0-0x0;var _0x910021=_0xf5ec[_0x4384c0];return _0x910021;};'use strict';var Sequelize=require(_0xcf5e('0x0'));module[_0xcf5e('0x1')]={'state':{'type':Sequelize[_0xcf5e('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xcf5e('0x3')]},'countbusyretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcf5e('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xcf5e('0x4')]},'originatecalleridname':{'type':Sequelize[_0xcf5e('0x4')]},'calleridnum':{'type':Sequelize[_0xcf5e('0x4')]},'calleridname':{'type':Sequelize[_0xcf5e('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcf5e('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xcf5e('0x3')]},'endtime':{'type':Sequelize[_0xcf5e('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcf5e('0x4')]},'campaign':{'type':Sequelize[_0xcf5e('0x4')]},'campaigntype':{'type':Sequelize[_0xcf5e('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xcf5e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcf5e('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcf5e('0x3')]},'recallme':{'type':Sequelize[_0xcf5e('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 753b420..3465208 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 _0x2024=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','CmHopperHistory','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','findAll','catch','params','rawAttributes','merge','options','create','describe','body','uniqueid','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x2024,0x121));var _0x4202=function(_0x2861d3,_0x23a015){_0x2861d3=_0x2861d3-0x0;var _0x4f2dc3=_0x2024[_0x2861d3];return _0x4f2dc3;};'use strict';var emlformat=require(_0x4202('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4202('0x1'));var jsonpatch=require(_0x4202('0x2'));var rp=require(_0x4202('0x3'));var moment=require('moment');var BPromise=require(_0x4202('0x4'));var Mustache=require(_0x4202('0x5'));var util=require(_0x4202('0x6'));var path=require('path');var sox=require(_0x4202('0x7'));var csv=require('to-csv');var ejs=require(_0x4202('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4202('0x9'));var squel=require(_0x4202('0xa'));var crypto=require(_0x4202('0xb'));var jsforce=require(_0x4202('0xc'));var deskjs=require(_0x4202('0xd'));var toCsv=require(_0x4202('0xe'));var querystring=require(_0x4202('0xf'));var Papa=require(_0x4202('0x10'));var Redis=require(_0x4202('0x11'));var authService=require(_0x4202('0x12'));var qs=require(_0x4202('0x13'));var as=require(_0x4202('0x14'));var hardwareService=require(_0x4202('0x15'));var logger=require('../../config/logger')(_0x4202('0x16'));var utils=require('../../config/utils');var config=require(_0x4202('0x17'));var licenseUtil=require(_0x4202('0x18'));var db=require(_0x4202('0x19'))['db'];function respondWithStatusCode(_0x33a25c,_0x365cf6){_0x365cf6=_0x365cf6||0xcc;return function(_0x40ce5e){if(_0x40ce5e){return _0x33a25c[_0x4202('0x1a')](_0x365cf6);}return _0x33a25c['status'](_0x365cf6)[_0x4202('0x1b')]();};}function respondWithResult(_0xe30a2,_0x28538e){_0x28538e=_0x28538e||0xc8;return function(_0x8f14f9){if(_0x8f14f9){return _0xe30a2[_0x4202('0x1c')](_0x28538e)[_0x4202('0x1d')](_0x8f14f9);}};}function respondWithFilteredResult(_0xb13b04,_0x223636){return function(_0x50d78c){if(_0x50d78c){var _0x5ac2a0=typeof _0x223636[_0x4202('0x1e')]===_0x4202('0x1f')&&typeof _0x223636[_0x4202('0x20')]===_0x4202('0x1f');var _0x5ba152=_0x50d78c[_0x4202('0x21')];var _0x1e6403=_0x5ac2a0?0x0:_0x223636[_0x4202('0x1e')];var _0x54d006=_0x5ac2a0?_0x50d78c['count']:_0x223636[_0x4202('0x1e')]+_0x223636[_0x4202('0x20')];var _0x1a20ee;if(_0x54d006>=_0x5ba152){_0x54d006=_0x5ba152;_0x1a20ee=0xc8;}else{_0x1a20ee=0xce;}_0xb13b04[_0x4202('0x1c')](_0x1a20ee);return _0xb13b04[_0x4202('0x22')](_0x4202('0x23'),_0x1e6403+'-'+_0x54d006+'/'+_0x5ba152)['json'](_0x50d78c);}return null;};}function patchUpdates(_0x35d542){return function(_0xc15523){try{jsonpatch[_0x4202('0x24')](_0xc15523,_0x35d542,!![]);}catch(_0x2cf0d0){return BPromise['reject'](_0x2cf0d0);}return _0xc15523[_0x4202('0x25')]();};}function saveUpdates(_0x469eef,_0x4a8677){return function(_0x1e1bf7){if(_0x1e1bf7){return _0x1e1bf7[_0x4202('0x26')](_0x469eef)[_0x4202('0x27')](function(_0x574ec3){return _0x574ec3;});}return null;};}function removeEntity(_0x7bf72d,_0x3891de){return function(_0x3fb887){if(_0x3fb887){return _0x3fb887[_0x4202('0x28')]()[_0x4202('0x27')](function(){_0x7bf72d[_0x4202('0x1c')](0xcc)[_0x4202('0x1b')]();});}};}function handleEntityNotFound(_0x36dafd,_0x325eb0){return function(_0x4abc2b){if(!_0x4abc2b){_0x36dafd['sendStatus'](0x194);}return _0x4abc2b;};}function handleError(_0x5765d9,_0xc8739a){_0xc8739a=_0xc8739a||0x1f4;return function(_0x537959){logger[_0x4202('0x29')](_0x537959[_0x4202('0x2a')]);if(_0x537959[_0x4202('0x2b')]){delete _0x537959[_0x4202('0x2b')];}_0x5765d9[_0x4202('0x1c')](_0xc8739a)[_0x4202('0x2c')](_0x537959);};}exports['index']=function(_0x3e5417,_0x5c1d4f){var _0x1286cc={},_0x93d31a={},_0x16bc3e={'count':0x0,'rows':[]};var _0x3a2ab=_[_0x4202('0x2d')](db[_0x4202('0x2e')]['rawAttributes'],function(_0x21406a){return{'name':_0x21406a[_0x4202('0x2f')],'type':_0x21406a[_0x4202('0x30')][_0x4202('0x31')]};});_0x93d31a[_0x4202('0x32')]=_['map'](_0x3a2ab,_0x4202('0x2b'));_0x93d31a[_0x4202('0x33')]=_[_0x4202('0x34')](_0x3e5417['query']);_0x93d31a['filters']=_[_0x4202('0x35')](_0x93d31a['model'],_0x93d31a['query']);_0x1286cc[_0x4202('0x36')]=_[_0x4202('0x35')](_0x93d31a['model'],qs[_0x4202('0x37')](_0x3e5417[_0x4202('0x33')][_0x4202('0x37')]));_0x1286cc['attributes']=_0x1286cc['attributes'][_0x4202('0x38')]?_0x1286cc[_0x4202('0x36')]:_0x93d31a[_0x4202('0x32')];if(!_0x3e5417['query'][_0x4202('0x39')](_0x4202('0x3a'))){_0x1286cc[_0x4202('0x20')]=qs[_0x4202('0x20')](_0x3e5417[_0x4202('0x33')]['limit']);_0x1286cc[_0x4202('0x1e')]=qs[_0x4202('0x1e')](_0x3e5417['query'][_0x4202('0x1e')]);}_0x1286cc[_0x4202('0x3b')]=qs[_0x4202('0x3c')](_0x3e5417[_0x4202('0x33')][_0x4202('0x3c')]);_0x1286cc[_0x4202('0x3d')]=qs['filters'](_[_0x4202('0x3e')](_0x3e5417[_0x4202('0x33')],_0x93d31a[_0x4202('0x3f')]),_0x3a2ab);if(_0x3e5417[_0x4202('0x33')][_0x4202('0x40')]){_0x1286cc['where']=_['merge'](_0x1286cc[_0x4202('0x3d')],{'$or':_[_0x4202('0x2d')](_0x3a2ab,function(_0x21bd0c){if(_0x21bd0c[_0x4202('0x30')]!==_0x4202('0x41')){var _0x526027={};_0x526027[_0x21bd0c[_0x4202('0x2b')]]={'$like':'%'+_0x3e5417[_0x4202('0x33')]['filter']+'%'};return _0x526027;}})});}_0x1286cc=_['merge']({},_0x1286cc,_0x3e5417['options']);var _0x9ab945={'where':_0x1286cc[_0x4202('0x3d')]};return db[_0x4202('0x2e')][_0x4202('0x21')](_0x9ab945)[_0x4202('0x27')](function(_0x534dcd){_0x16bc3e[_0x4202('0x21')]=_0x534dcd;if(_0x3e5417[_0x4202('0x33')][_0x4202('0x42')]){_0x1286cc[_0x4202('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4202('0x44')](_0x1286cc);})[_0x4202('0x27')](function(_0x435b3a){_0x16bc3e['rows']=_0x435b3a;return _0x16bc3e;})[_0x4202('0x27')](respondWithFilteredResult(_0x5c1d4f,_0x1286cc))[_0x4202('0x45')](handleError(_0x5c1d4f,null));};exports['show']=function(_0x495cde,_0x590e3b){var _0x15e373={'raw':!![],'where':{'id':_0x495cde[_0x4202('0x46')]['id']}},_0x1134a4={};_0x1134a4['model']=_[_0x4202('0x34')](db[_0x4202('0x2e')][_0x4202('0x47')]);_0x1134a4[_0x4202('0x33')]=_[_0x4202('0x34')](_0x495cde[_0x4202('0x33')]);_0x1134a4['filters']=_['intersection'](_0x1134a4[_0x4202('0x32')],_0x1134a4[_0x4202('0x33')]);_0x15e373[_0x4202('0x36')]=_[_0x4202('0x35')](_0x1134a4[_0x4202('0x32')],qs['fields'](_0x495cde[_0x4202('0x33')]['fields']));_0x15e373[_0x4202('0x36')]=_0x15e373[_0x4202('0x36')]['length']?_0x15e373[_0x4202('0x36')]:_0x1134a4[_0x4202('0x32')];if(_0x495cde[_0x4202('0x33')][_0x4202('0x42')]){_0x15e373[_0x4202('0x43')]=[{'all':!![]}];}_0x15e373=_[_0x4202('0x48')]({},_0x15e373,_0x495cde[_0x4202('0x49')]);return db[_0x4202('0x2e')]['find'](_0x15e373)[_0x4202('0x27')](handleEntityNotFound(_0x590e3b,null))[_0x4202('0x27')](respondWithResult(_0x590e3b,null))['catch'](handleError(_0x590e3b,null));};exports[_0x4202('0x4a')]=function(_0x371f9c,_0x3c4285){return db[_0x4202('0x2e')][_0x4202('0x4a')](_0x371f9c['body'],{})[_0x4202('0x27')](respondWithResult(_0x3c4285,0xc9))['catch'](handleError(_0x3c4285,null));};exports[_0x4202('0x4b')]=function(_0x3ac183,_0x302aad){return db['CmHopperHistory'][_0x4202('0x4b')]()[_0x4202('0x27')](respondWithResult(_0x302aad,null))['catch'](handleError(_0x302aad,null));};exports['update']=function(_0x37ee4a,_0x573cbc){if(_0x37ee4a[_0x4202('0x4c')][_0x4202('0x4d')]){delete _0x37ee4a[_0x4202('0x4c')][_0x4202('0x4d')];}return db[_0x4202('0x2e')][_0x4202('0x4e')]({'where':{'uniqueid':_0x37ee4a['params']['id']}})[_0x4202('0x27')](handleEntityNotFound(_0x573cbc,null))[_0x4202('0x27')](saveUpdates(_0x37ee4a['body'],null))[_0x4202('0x27')](respondWithResult(_0x573cbc,null))['catch'](handleError(_0x573cbc,null));}; \ No newline at end of file +var _0x7084=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','create','body','describe','uniqueid','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0x7084,0x118));var _0x4708=function(_0x8eac2f,_0x5f08e){_0x8eac2f=_0x8eac2f-0x0;var _0x5f5cd9=_0x7084[_0x8eac2f];return _0x5f5cd9;};'use strict';var emlformat=require(_0x4708('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4708('0x1'));var jsonpatch=require(_0x4708('0x2'));var rp=require(_0x4708('0x3'));var moment=require(_0x4708('0x4'));var BPromise=require(_0x4708('0x5'));var Mustache=require('mustache');var util=require(_0x4708('0x6'));var path=require('path');var sox=require(_0x4708('0x7'));var csv=require('to-csv');var ejs=require(_0x4708('0x8'));var fs=require('fs');var fs_extra=require(_0x4708('0x9'));var _=require(_0x4708('0xa'));var squel=require(_0x4708('0xb'));var crypto=require(_0x4708('0xc'));var jsforce=require(_0x4708('0xd'));var deskjs=require(_0x4708('0xe'));var toCsv=require(_0x4708('0xf'));var querystring=require(_0x4708('0x10'));var Papa=require(_0x4708('0x11'));var Redis=require(_0x4708('0x12'));var authService=require(_0x4708('0x13'));var qs=require(_0x4708('0x14'));var as=require(_0x4708('0x15'));var hardwareService=require(_0x4708('0x16'));var logger=require(_0x4708('0x17'))(_0x4708('0x18'));var utils=require(_0x4708('0x19'));var config=require(_0x4708('0x1a'));var licenseUtil=require(_0x4708('0x1b'));var db=require(_0x4708('0x1c'))['db'];function respondWithStatusCode(_0x300d78,_0x25f22a){_0x25f22a=_0x25f22a||0xcc;return function(_0x231785){if(_0x231785){return _0x300d78[_0x4708('0x1d')](_0x25f22a);}return _0x300d78[_0x4708('0x1e')](_0x25f22a)['end']();};}function respondWithResult(_0x34029a,_0x8d5a5f){_0x8d5a5f=_0x8d5a5f||0xc8;return function(_0x3dd093){if(_0x3dd093){return _0x34029a[_0x4708('0x1e')](_0x8d5a5f)[_0x4708('0x1f')](_0x3dd093);}};}function respondWithFilteredResult(_0x1ecc4b,_0xd46b39){return function(_0x4e0bb6){if(_0x4e0bb6){var _0x3eb6eb=typeof _0xd46b39['offset']===_0x4708('0x20')&&typeof _0xd46b39[_0x4708('0x21')]===_0x4708('0x20');var _0x23d80a=_0x4e0bb6[_0x4708('0x22')];var _0x4e1c6b=_0x3eb6eb?0x0:_0xd46b39[_0x4708('0x23')];var _0x1a12ab=_0x3eb6eb?_0x4e0bb6[_0x4708('0x22')]:_0xd46b39[_0x4708('0x23')]+_0xd46b39[_0x4708('0x21')];var _0x33b779;if(_0x1a12ab>=_0x23d80a){_0x1a12ab=_0x23d80a;_0x33b779=0xc8;}else{_0x33b779=0xce;}_0x1ecc4b['status'](_0x33b779);return _0x1ecc4b['set'](_0x4708('0x24'),_0x4e1c6b+'-'+_0x1a12ab+'/'+_0x23d80a)[_0x4708('0x1f')](_0x4e0bb6);}return null;};}function patchUpdates(_0x40e9f4){return function(_0x29856a){try{jsonpatch[_0x4708('0x25')](_0x29856a,_0x40e9f4,!![]);}catch(_0xd7646f){return BPromise[_0x4708('0x26')](_0xd7646f);}return _0x29856a[_0x4708('0x27')]();};}function saveUpdates(_0x445150,_0x4a7052){return function(_0x4a1f4f){if(_0x4a1f4f){return _0x4a1f4f[_0x4708('0x28')](_0x445150)[_0x4708('0x29')](function(_0x372ae5){return _0x372ae5;});}return null;};}function removeEntity(_0x4d0de8,_0xa22189){return function(_0xb7b826){if(_0xb7b826){return _0xb7b826[_0x4708('0x2a')]()[_0x4708('0x29')](function(){_0x4d0de8[_0x4708('0x1e')](0xcc)[_0x4708('0x2b')]();});}};}function handleEntityNotFound(_0x4517c9,_0x4b0a48){return function(_0x3db434){if(!_0x3db434){_0x4517c9[_0x4708('0x1d')](0x194);}return _0x3db434;};}function handleError(_0x9b22a4,_0x59fce4){_0x59fce4=_0x59fce4||0x1f4;return function(_0x24daed){logger['error'](_0x24daed[_0x4708('0x2c')]);if(_0x24daed[_0x4708('0x2d')]){delete _0x24daed[_0x4708('0x2d')];}_0x9b22a4[_0x4708('0x1e')](_0x59fce4)[_0x4708('0x2e')](_0x24daed);};}exports[_0x4708('0x2f')]=function(_0x467ea5,_0x43e12b){var _0x1fb418={},_0x1c3d08={},_0x48ee67={'count':0x0,'rows':[]};var _0x4ef40a=_['map'](db[_0x4708('0x30')][_0x4708('0x31')],function(_0x49bc6a){return{'name':_0x49bc6a[_0x4708('0x32')],'type':_0x49bc6a[_0x4708('0x33')][_0x4708('0x34')]};});_0x1c3d08[_0x4708('0x35')]=_[_0x4708('0x36')](_0x4ef40a,_0x4708('0x2d'));_0x1c3d08[_0x4708('0x37')]=_['keys'](_0x467ea5[_0x4708('0x37')]);_0x1c3d08[_0x4708('0x38')]=_[_0x4708('0x39')](_0x1c3d08[_0x4708('0x35')],_0x1c3d08[_0x4708('0x37')]);_0x1fb418[_0x4708('0x3a')]=_[_0x4708('0x39')](_0x1c3d08['model'],qs['fields'](_0x467ea5[_0x4708('0x37')][_0x4708('0x3b')]));_0x1fb418[_0x4708('0x3a')]=_0x1fb418[_0x4708('0x3a')][_0x4708('0x3c')]?_0x1fb418[_0x4708('0x3a')]:_0x1c3d08[_0x4708('0x35')];if(!_0x467ea5[_0x4708('0x37')][_0x4708('0x3d')](_0x4708('0x3e'))){_0x1fb418[_0x4708('0x21')]=qs[_0x4708('0x21')](_0x467ea5[_0x4708('0x37')][_0x4708('0x21')]);_0x1fb418[_0x4708('0x23')]=qs['offset'](_0x467ea5[_0x4708('0x37')]['offset']);}_0x1fb418[_0x4708('0x3f')]=qs[_0x4708('0x40')](_0x467ea5[_0x4708('0x37')][_0x4708('0x40')]);_0x1fb418[_0x4708('0x41')]=qs[_0x4708('0x38')](_[_0x4708('0x42')](_0x467ea5[_0x4708('0x37')],_0x1c3d08[_0x4708('0x38')]),_0x4ef40a);if(_0x467ea5[_0x4708('0x37')][_0x4708('0x43')]){_0x1fb418[_0x4708('0x41')]=_[_0x4708('0x44')](_0x1fb418['where'],{'$or':_[_0x4708('0x36')](_0x4ef40a,function(_0x3b9a42){if(_0x3b9a42[_0x4708('0x33')]!==_0x4708('0x45')){var _0x5af139={};_0x5af139[_0x3b9a42[_0x4708('0x2d')]]={'$like':'%'+_0x467ea5['query']['filter']+'%'};return _0x5af139;}})});}_0x1fb418=_[_0x4708('0x44')]({},_0x1fb418,_0x467ea5['options']);var _0x4fd7ec={'where':_0x1fb418[_0x4708('0x41')]};return db['CmHopperHistory']['count'](_0x4fd7ec)['then'](function(_0x304fc8){_0x48ee67[_0x4708('0x22')]=_0x304fc8;if(_0x467ea5['query'][_0x4708('0x46')]){_0x1fb418[_0x4708('0x47')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4708('0x48')](_0x1fb418);})[_0x4708('0x29')](function(_0x14497e){_0x48ee67[_0x4708('0x49')]=_0x14497e;return _0x48ee67;})[_0x4708('0x29')](respondWithFilteredResult(_0x43e12b,_0x1fb418))[_0x4708('0x4a')](handleError(_0x43e12b,null));};exports[_0x4708('0x4b')]=function(_0x3f3dd2,_0x250102){var _0xde4924={'raw':!![],'where':{'id':_0x3f3dd2[_0x4708('0x4c')]['id']}},_0x2ff18d={};_0x2ff18d[_0x4708('0x35')]=_[_0x4708('0x4d')](db[_0x4708('0x30')][_0x4708('0x31')]);_0x2ff18d[_0x4708('0x37')]=_['keys'](_0x3f3dd2['query']);_0x2ff18d[_0x4708('0x38')]=_[_0x4708('0x39')](_0x2ff18d[_0x4708('0x35')],_0x2ff18d['query']);_0xde4924[_0x4708('0x3a')]=_[_0x4708('0x39')](_0x2ff18d[_0x4708('0x35')],qs['fields'](_0x3f3dd2[_0x4708('0x37')][_0x4708('0x3b')]));_0xde4924[_0x4708('0x3a')]=_0xde4924[_0x4708('0x3a')][_0x4708('0x3c')]?_0xde4924['attributes']:_0x2ff18d[_0x4708('0x35')];if(_0x3f3dd2[_0x4708('0x37')]['includeAll']){_0xde4924[_0x4708('0x47')]=[{'all':!![]}];}_0xde4924=_[_0x4708('0x44')]({},_0xde4924,_0x3f3dd2['options']);return db['CmHopperHistory']['find'](_0xde4924)[_0x4708('0x29')](handleEntityNotFound(_0x250102,null))['then'](respondWithResult(_0x250102,null))[_0x4708('0x4a')](handleError(_0x250102,null));};exports[_0x4708('0x4e')]=function(_0x380d07,_0x1e9400){return db[_0x4708('0x30')][_0x4708('0x4e')](_0x380d07[_0x4708('0x4f')],{})[_0x4708('0x29')](respondWithResult(_0x1e9400,0xc9))[_0x4708('0x4a')](handleError(_0x1e9400,null));};exports[_0x4708('0x50')]=function(_0x57afe8,_0x48e697){return db['CmHopperHistory'][_0x4708('0x50')]()['then'](respondWithResult(_0x48e697,null))[_0x4708('0x4a')](handleError(_0x48e697,null));};exports[_0x4708('0x28')]=function(_0xa9efc8,_0x288175){if(_0xa9efc8['body'][_0x4708('0x51')]){delete _0xa9efc8[_0x4708('0x4f')][_0x4708('0x51')];}return db[_0x4708('0x30')][_0x4708('0x52')]({'where':{'uniqueid':_0xa9efc8['params']['id']}})[_0x4708('0x29')](handleEntityNotFound(_0x288175,null))['then'](saveUpdates(_0xa9efc8[_0x4708('0x4f')],null))[_0x4708('0x29')](respondWithResult(_0x288175,null))['catch'](handleError(_0x288175,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 67bf9bb..4d972a1 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 _0xeda7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x432caa,_0x1edfa1){var _0x21458f=function(_0x37bd18){while(--_0x37bd18){_0x432caa['push'](_0x432caa['shift']());}};_0x21458f(++_0x1edfa1);}(_0xeda7,0x196));var _0x7eda=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeda7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var logger=require(_0x7eda('0x2'))(_0x7eda('0x3'));var moment=require(_0x7eda('0x4'));var BPromise=require(_0x7eda('0x5'));var rp=require(_0x7eda('0x6'));var fs=require('fs');var path=require(_0x7eda('0x7'));var rimraf=require(_0x7eda('0x8'));var config=require(_0x7eda('0x9'));var attributes=require(_0x7eda('0xa'));module[_0x7eda('0xb')]=function(_0x6ee7be,_0x328430){return _0x6ee7be[_0x7eda('0xc')](_0x7eda('0xd'),attributes,{'tableName':_0x7eda('0xe'),'paranoid':![],'indexes':[{'name':_0x7eda('0xf'),'fields':[_0x7eda('0xf')]},{'name':_0x7eda('0x10'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x896e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x896e,0x1e9));var _0xe896=function(_0xd7e7f4,_0x4a1fdb){_0xd7e7f4=_0xd7e7f4-0x0;var _0x540c3d=_0x896e[_0xd7e7f4];return _0x540c3d;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'paranoid':![],'indexes':[{'name':_0xe896('0xf'),'fields':['endtime']},{'name':_0xe896('0x10'),'fields':[_0xe896('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index c54ed03..0368c2a 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 _0xa45c=['AvgHandleTime','where','sequelize','COUNT','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa45c,0x6d));var _0xca45=function(_0x538e64,_0xdeed89){_0x538e64=_0x538e64-0x0;var _0x5f0d32=_0xa45c[_0x538e64];return _0x5f0d32;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca45('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15628b,_0x578a7b,_0x1a8b9c){return new BPromise(function(_0x276897,_0x7ceab1){return client[_0xca45('0x8')](_0x15628b,_0x1a8b9c)[_0xca45('0x9')](function(_0x5c18b9){logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));logger[_0xca45('0xd')](_0xca45('0xe'),_0x578a7b,_0xca45('0xc'),JSON[_0xca45('0xf')](_0x5c18b9));if(_0x5c18b9['error']){if(_0x5c18b9[_0xca45('0x10')][_0xca45('0x11')]===0x1f4){logger[_0xca45('0x10')](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x7ceab1(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}logger['error'](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x276897(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}else{logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));_0x276897(_0x5c18b9[_0xca45('0x13')]['message']);}})[_0xca45('0x14')](function(_0x5b4e29){logger['error'](_0xca45('0xb'),_0x578a7b,_0x5b4e29);_0x7ceab1(_0x5b4e29);});});}exports[_0xca45('0x15')]=function(_0x553af4){var _0x2e18aa=this;return new Promise(function(_0x184bbf,_0x5820c8){return db[_0xca45('0x16')][_0xca45('0x17')](_0x553af4[_0xca45('0x18')],{'raw':_0x553af4[_0xca45('0x19')]?_0x553af4['options'][_0xca45('0x1a')]===undefined?!![]:![]:!![]})[_0xca45('0x9')](function(_0x1a16f1){logger[_0xca45('0xa')]('CreateCmHopperHistory',_0x553af4);logger[_0xca45('0xd')](_0xca45('0x15'),_0x553af4,JSON[_0xca45('0xf')](_0x1a16f1));_0x184bbf(_0x1a16f1);})[_0xca45('0x14')](function(_0x2068df){logger[_0xca45('0x10')](_0xca45('0x15'),_0x2068df[_0xca45('0x12')],_0x553af4);_0x5820c8(_0x2e18aa[_0xca45('0x10')](0x1f4,_0x2068df['message']));});});};exports[_0xca45('0x1b')]=function(_0x1acb89){var _0x2cac3d=this;return new Promise(function(_0x295403,_0x242cb1){return db['CmHopperHistory']['findAll']({'raw':_0x1acb89['options']?_0x1acb89[_0xca45('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1acb89['options']?_0x1acb89[_0xca45('0x19')][_0xca45('0x1c')]||null:null,'attributes':[[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['col']('id')),_0xca45('0x1f')],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xca45('0x20')))),_0xca45('0x21')],[db['sequelize']['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0xca45('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xca45('0x23')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xca45('0x24'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')]['literal'](_0xca45('0x25')))),_0xca45('0x26')],[db['sequelize']['fn'](_0xca45('0x24'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x27')))),_0xca45('0x28')]]})[_0xca45('0x9')](function(_0x291dd6){logger[_0xca45('0xa')](_0xca45('0x1b'),_0x1acb89);logger[_0xca45('0xd')](_0xca45('0x1b'),_0x1acb89,JSON[_0xca45('0xf')](_0x291dd6));_0x295403(_0x291dd6);})['catch'](function(_0x5b3a4f){logger['error'](_0xca45('0x1b'),_0x5b3a4f[_0xca45('0x12')],_0x1acb89);_0x242cb1(_0x2cac3d['error'](0x1f4,_0x5b3a4f['message']));});});};exports[_0xca45('0x29')]=function(_0x4a3eb9){var _0x34cfae=this;return new Promise(function(_0x53202c,_0x4de1d0){return db[_0xca45('0x16')][_0xca45('0x2a')]({'raw':_0x4a3eb9[_0xca45('0x19')]?_0x4a3eb9[_0xca45('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4a3eb9[_0xca45('0x19')]?_0x4a3eb9['options'][_0xca45('0x1c')]||null:null,'attributes':[[_0xca45('0x2b'),_0xca45('0x2c')],[db[_0xca45('0x1d')]['fn']('COUNT',db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x2d')))),_0xca45('0x2e')],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x20')))),_0xca45('0x2f')],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')]['literal'](_0xca45('0x30')))),_0xca45('0x31')],[db[_0xca45('0x1d')]['fn']('COUNT',db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x32')))),'outboundCongestionCallsDay'],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x33')))),_0xca45('0x34')],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x35')))),_0xca45('0x36')],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0xca45('0x37')],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x38')))),_0xca45('0x39')],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x3a')))),'outboundOriginateFailureCallsDay'],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x3b')))),_0xca45('0x3c')],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0xca45('0x3d')],[db[_0xca45('0x1d')]['fn']('COUNT',db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x3e')))),_0xca45('0x3c')],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')](_0xca45('0x3f')))),_0xca45('0x40')]],'group':[_0xca45('0x2b')]})['then'](function(_0x45de07){logger[_0xca45('0xa')](_0xca45('0x29'),_0x4a3eb9);logger[_0xca45('0xd')](_0xca45('0x29'),_0x4a3eb9,JSON[_0xca45('0xf')](_0x45de07));_0x53202c(_0x45de07);})[_0xca45('0x14')](function(_0x20b060){logger[_0xca45('0x10')]('GetVoiceQueueHopperHistory',_0x20b060['message'],_0x4a3eb9);_0x4de1d0(_0x34cfae['error'](0x1f4,_0x20b060['message']));});});};exports[_0xca45('0x41')]=function(_0x95a764){var _0x3827fa=this;return new Promise(function(_0x3a674f,_0x4e7332){return db[_0xca45('0x16')][_0xca45('0x2a')]({'raw':_0x95a764['options']?_0x95a764[_0xca45('0x19')][_0xca45('0x1a')]===undefined?!![]:![]:!![],'where':_0x95a764['options']?_0x95a764[_0xca45('0x19')]['where']||null:null,'attributes':[[_0xca45('0x2b'),'name'],[db[_0xca45('0x1d')]['fn'](_0xca45('0x1e'),db['sequelize']['col']('id')),_0xca45('0x42')],[db[_0xca45('0x1d')]['fn']('COUNT',db[_0xca45('0x1d')]['fn']('IF',db[_0xca45('0x1d')][_0xca45('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xca45('0x43')]],'group':[_0xca45('0x2b')]})[_0xca45('0x9')](function(_0xb3544e){logger[_0xca45('0xa')](_0xca45('0x41'),_0x95a764);logger[_0xca45('0xd')](_0xca45('0x41'),_0x95a764,JSON[_0xca45('0xf')](_0xb3544e));_0x3a674f(_0xb3544e);})['catch'](function(_0x11fe68){logger[_0xca45('0x10')](_0xca45('0x41'),_0x11fe68[_0xca45('0x12')],_0x95a764);_0x4e7332(_0x3827fa[_0xca45('0x10')](0x1f4,_0x11fe68['message']));});});}; \ No newline at end of file +var _0xd8ea=['literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','CmHopperHistory','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','sequelize','col','predictiveIntervalTotalCalls'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xd8ea,0x1bd));var _0xad8e=function(_0xd2b0b1,_0x13acf0){_0xd2b0b1=_0xd2b0b1-0x0;var _0x1a8303=_0xd8ea[_0xd2b0b1];return _0x1a8303;};'use strict';var _=require(_0xad8e('0x0'));var util=require(_0xad8e('0x1'));var moment=require(_0xad8e('0x2'));var BPromise=require(_0xad8e('0x3'));var rs=require(_0xad8e('0x4'));var fs=require('fs');var Redis=require(_0xad8e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xad8e('0x6'));var logger=require(_0xad8e('0x7'))(_0xad8e('0x8'));var config=require('../../config/environment');var jayson=require(_0xad8e('0x9'));var client=jayson[_0xad8e('0xa')][_0xad8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27bbcb,_0x5141d5,_0x5313f4){return new BPromise(function(_0x396cc6,_0x47627c){return client[_0xad8e('0xc')](_0x27bbcb,_0x5313f4)[_0xad8e('0xd')](function(_0xbef199){logger[_0xad8e('0xe')](_0xad8e('0xf'),_0x5141d5,_0xad8e('0x10'));logger[_0xad8e('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5141d5,_0xad8e('0x10'),JSON['stringify'](_0xbef199));if(_0xbef199[_0xad8e('0x12')]){if(_0xbef199[_0xad8e('0x12')]['code']===0x1f4){logger[_0xad8e('0x12')](_0xad8e('0xf'),_0x5141d5,_0xbef199[_0xad8e('0x12')]['message']);return _0x47627c(_0xbef199[_0xad8e('0x12')][_0xad8e('0x13')]);}logger[_0xad8e('0x12')](_0xad8e('0xf'),_0x5141d5,_0xbef199[_0xad8e('0x12')][_0xad8e('0x13')]);return _0x396cc6(_0xbef199[_0xad8e('0x12')][_0xad8e('0x13')]);}else{logger[_0xad8e('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x5141d5,_0xad8e('0x10'));_0x396cc6(_0xbef199['result'][_0xad8e('0x13')]);}})[_0xad8e('0x14')](function(_0x14eb38){logger[_0xad8e('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x5141d5,_0x14eb38);_0x47627c(_0x14eb38);});});}exports['CreateCmHopperHistory']=function(_0x4e7e83){var _0x6f2b1d=this;return new Promise(function(_0x549aa3,_0xba837b){return db[_0xad8e('0x15')]['create'](_0x4e7e83[_0xad8e('0x16')],{'raw':_0x4e7e83[_0xad8e('0x17')]?_0x4e7e83[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![]})[_0xad8e('0xd')](function(_0x4b3a6a){logger[_0xad8e('0xe')](_0xad8e('0x19'),_0x4e7e83);logger[_0xad8e('0x11')](_0xad8e('0x19'),_0x4e7e83,JSON['stringify'](_0x4b3a6a));_0x549aa3(_0x4b3a6a);})[_0xad8e('0x14')](function(_0x34a269){logger[_0xad8e('0x12')](_0xad8e('0x19'),_0x34a269[_0xad8e('0x13')],_0x4e7e83);_0xba837b(_0x6f2b1d[_0xad8e('0x12')](0x1f4,_0x34a269[_0xad8e('0x13')]));});});};exports[_0xad8e('0x1a')]=function(_0x39372e){var _0x22dd2a=this;return new Promise(function(_0x30aa07,_0x556ed7){return db[_0xad8e('0x15')][_0xad8e('0x1b')]({'raw':_0x39372e['options']?_0x39372e[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![],'where':_0x39372e[_0xad8e('0x17')]?_0x39372e['options']['where']||null:null,'attributes':[[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')][_0xad8e('0x1d')]('id')),_0xad8e('0x1e')],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x20')))),_0xad8e('0x21')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0xad8e('0x23')],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x24')))),_0xad8e('0x25')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x26'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xad8e('0x27')))),_0xad8e('0x28')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x26'),db['sequelize']['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x29')))),_0xad8e('0x2a')]]})['then'](function(_0x2951a8){logger[_0xad8e('0xe')](_0xad8e('0x1a'),_0x39372e);logger['debug']('AvgHandleTime',_0x39372e,JSON[_0xad8e('0x2b')](_0x2951a8));_0x30aa07(_0x2951a8);})[_0xad8e('0x14')](function(_0x4be6d0){logger[_0xad8e('0x12')](_0xad8e('0x1a'),_0x4be6d0['message'],_0x39372e);_0x556ed7(_0x22dd2a['error'](0x1f4,_0x4be6d0['message']));});});};exports[_0xad8e('0x2c')]=function(_0x5c92c7){var _0x3ab613=this;return new Promise(function(_0x18462d,_0x1afbd5){return db['CmHopperHistory'][_0xad8e('0x1b')]({'raw':_0x5c92c7[_0xad8e('0x17')]?_0x5c92c7[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![],'where':_0x5c92c7[_0xad8e('0x17')]?_0x5c92c7[_0xad8e('0x17')]['where']||null:null,'attributes':[[_0xad8e('0x2d'),_0xad8e('0x2e')],[db['sequelize']['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),_0xad8e('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x30')))),_0xad8e('0x31')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x20')))),_0xad8e('0x32')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x33')))),_0xad8e('0x34')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xad8e('0x35')))),'outboundCongestionCallsDay'],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x36')))),_0xad8e('0x37')],[db['sequelize']['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x38')))),_0xad8e('0x39')],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x3a')))),'outboundUnknownCallsDay'],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x3b')))),_0xad8e('0x3c')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x3d')))),'outboundOriginateFailureCallsDay'],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x3e')))),_0xad8e('0x3f')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x40')))),_0xad8e('0x41')]],'group':[_0xad8e('0x2d')]})['then'](function(_0x5158d0){logger[_0xad8e('0xe')](_0xad8e('0x2c'),_0x5c92c7);logger[_0xad8e('0x11')](_0xad8e('0x2c'),_0x5c92c7,JSON[_0xad8e('0x2b')](_0x5158d0));_0x18462d(_0x5158d0);})[_0xad8e('0x14')](function(_0x22f2b6){logger[_0xad8e('0x12')](_0xad8e('0x2c'),_0x22f2b6[_0xad8e('0x13')],_0x5c92c7);_0x1afbd5(_0x3ab613[_0xad8e('0x12')](0x1f4,_0x22f2b6[_0xad8e('0x13')]));});});};exports[_0xad8e('0x42')]=function(_0x44a4b8){var _0x4e48b1=this;return new Promise(function(_0x406e74,_0x2f561d){return db[_0xad8e('0x15')][_0xad8e('0x1b')]({'raw':_0x44a4b8[_0xad8e('0x17')]?_0x44a4b8[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![],'where':_0x44a4b8['options']?_0x44a4b8['options']['where']||null:null,'attributes':[[_0xad8e('0x2d'),_0xad8e('0x2e')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['col']('id')),_0xad8e('0x43')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')]['literal'](_0xad8e('0x20')))),'ivrAnswerCallsDay']],'group':[_0xad8e('0x2d')]})[_0xad8e('0xd')](function(_0x4a8927){logger['info'](_0xad8e('0x42'),_0x44a4b8);logger[_0xad8e('0x11')](_0xad8e('0x42'),_0x44a4b8,JSON['stringify'](_0x4a8927));_0x406e74(_0x4a8927);})[_0xad8e('0x14')](function(_0x485f37){logger[_0xad8e('0x12')](_0xad8e('0x42'),_0x485f37['message'],_0x44a4b8);_0x2f561d(_0x4e48b1['error'](0x1f4,_0x485f37[_0xad8e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9ed1edf..af5799a 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 _0xab15=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','exports','util','path','connect-timeout','express','Router'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xab15,0x8e));var _0x5ab1=function(_0x576e6a,_0x8f1f1c){_0x576e6a=_0x576e6a-0x0;var _0x91d0a9=_0xab15[_0x576e6a];return _0x91d0a9;};'use strict';var multer=require('multer');var util=require(_0x5ab1('0x0'));var path=require(_0x5ab1('0x1'));var timeout=require(_0x5ab1('0x2'));var express=require(_0x5ab1('0x3'));var router=express[_0x5ab1('0x4')]();var fs_extra=require(_0x5ab1('0x5'));var auth=require(_0x5ab1('0x6'));var interaction=require(_0x5ab1('0x7'));var config=require(_0x5ab1('0x8'));var controller=require(_0x5ab1('0x9'));router[_0x5ab1('0xa')]('/',auth[_0x5ab1('0xb')](),controller[_0x5ab1('0xc')]);router[_0x5ab1('0xa')](_0x5ab1('0xd'),auth[_0x5ab1('0xb')](),controller[_0x5ab1('0xe')]);router[_0x5ab1('0xa')](_0x5ab1('0xf'),auth['isAuthenticated'](),controller[_0x5ab1('0x10')]);router[_0x5ab1('0x11')]('/',auth[_0x5ab1('0xb')](),controller[_0x5ab1('0x12')]);router['put'](_0x5ab1('0xf'),auth[_0x5ab1('0xb')](),controller[_0x5ab1('0x13')]);module[_0x5ab1('0x14')]=router; \ No newline at end of file +var _0xa209=['./cmHopperHistory.controller','index','get','/describe','describe','/:id','show','post','isAuthenticated','create','put','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa209,0xc0));var _0x9a20=function(_0x440ba4,_0x3b7413){_0x440ba4=_0x440ba4-0x0;var _0x17e8f5=_0xa209[_0x440ba4];return _0x17e8f5;};'use strict';var multer=require(_0x9a20('0x0'));var util=require(_0x9a20('0x1'));var path=require(_0x9a20('0x2'));var timeout=require(_0x9a20('0x3'));var express=require('express');var router=express[_0x9a20('0x4')]();var fs_extra=require(_0x9a20('0x5'));var auth=require(_0x9a20('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9a20('0x7'));var controller=require(_0x9a20('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9a20('0x9')]);router[_0x9a20('0xa')](_0x9a20('0xb'),auth['isAuthenticated'](),controller[_0x9a20('0xc')]);router[_0x9a20('0xa')](_0x9a20('0xd'),auth['isAuthenticated'](),controller[_0x9a20('0xe')]);router[_0x9a20('0xf')]('/',auth[_0x9a20('0x10')](),controller[_0x9a20('0x11')]);router[_0x9a20('0x12')](_0x9a20('0xd'),auth[_0x9a20('0x10')](),controller[_0x9a20('0x13')]);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 0119cb2..99f5b39 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 _0x0dba=['STRING','name','sequelize','exports'];(function(_0x2265bf,_0xf7dbc9){var _0x21085b=function(_0x50c670){while(--_0x50c670){_0x2265bf['push'](_0x2265bf['shift']());}};_0x21085b(++_0xf7dbc9);}(_0x0dba,0x136));var _0xa0db=function(_0x5cc0a7,_0x9309a4){_0x5cc0a7=_0x5cc0a7-0x0;var _0xdeaf11=_0x0dba[_0x5cc0a7];return _0xdeaf11;};'use strict';var Sequelize=require(_0xa0db('0x0'));module[_0xa0db('0x1')]={'name':{'type':Sequelize[_0xa0db('0x2')],'unique':_0xa0db('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa0db('0x2')]},'dialPrefix':{'type':Sequelize[_0xa0db('0x2')]}}; \ No newline at end of file +var _0xf53f=['name','sequelize','exports','STRING'];(function(_0x4bfcb9,_0x6eb6f3){var _0x84611c=function(_0x1f6248){while(--_0x1f6248){_0x4bfcb9['push'](_0x4bfcb9['shift']());}};_0x84611c(++_0x6eb6f3);}(_0xf53f,0x8d));var _0xff53=function(_0x2499dd,_0x3ffa0d){_0x2499dd=_0x2499dd-0x0;var _0x29330e=_0xf53f[_0x2499dd];return _0x29330e;};'use strict';var Sequelize=require(_0xff53('0x0'));module[_0xff53('0x1')]={'name':{'type':Sequelize[_0xff53('0x2')],'unique':_0xff53('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xff53('0x2')]},'dialPrefix':{'type':Sequelize[_0xff53('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 8f86c60..842e017 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 _0x601b=['getContacts','CmCustomField','concat','format','raw','getContactsCsv','ContactItemType','alias','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','field','select','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','each','isEmpty','now','writeFileSync','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','message','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','CmList','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','order','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','sort','pick','filter','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','omit','push','dataValues','errors','Malformed\x20request\x20syntax'];(function(_0x99a6c9,_0x3ee884){var _0x4aff06=function(_0x27d0a6){while(--_0x27d0a6){_0x99a6c9['push'](_0x99a6c9['shift']());}};_0x4aff06(++_0x3ee884);}(_0x601b,0x195));var _0xb601=function(_0x27be07,_0x12b093){_0x27be07=_0x27be07-0x0;var _0x5c4a35=_0x601b[_0x27be07];return _0x5c4a35;};'use strict';var emlformat=require(_0xb601('0x0'));var rimraf=require(_0xb601('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb601('0x2'));var rp=require(_0xb601('0x3'));var moment=require(_0xb601('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb601('0x5'));var util=require(_0xb601('0x6'));var path=require('path');var sox=require(_0xb601('0x7'));var csv=require('to-csv');var ejs=require(_0xb601('0x8'));var fs=require('fs');var fs_extra=require(_0xb601('0x9'));var _=require(_0xb601('0xa'));var squel=require(_0xb601('0xb'));var crypto=require(_0xb601('0xc'));var jsforce=require(_0xb601('0xd'));var deskjs=require(_0xb601('0xe'));var toCsv=require(_0xb601('0xf'));var querystring=require('querystring');var Papa=require(_0xb601('0x10'));var Redis=require(_0xb601('0x11'));var authService=require(_0xb601('0x12'));var qs=require(_0xb601('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb601('0x14'))(_0xb601('0x15'));var utils=require(_0xb601('0x16'));var config=require(_0xb601('0x17'));var licenseUtil=require(_0xb601('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xb601('0x19')]=_[_0xb601('0x1a')](config[_0xb601('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb601('0x1b'))(new Redis(config[_0xb601('0x19')]));require(_0xb601('0x1c'))[_0xb601('0x1d')](socket);function respondWithStatusCode(_0x4259f6,_0x1a31a6){_0x1a31a6=_0x1a31a6||0xcc;return function(_0x410c73){if(_0x410c73){return _0x4259f6[_0xb601('0x1e')](_0x1a31a6);}return _0x4259f6[_0xb601('0x1f')](_0x1a31a6)[_0xb601('0x20')]();};}function respondWithResult(_0x988239,_0x2ffc6f){_0x2ffc6f=_0x2ffc6f||0xc8;return function(_0x226db7){if(_0x226db7){return _0x988239['status'](_0x2ffc6f)[_0xb601('0x21')](_0x226db7);}};}function respondWithFilteredResult(_0x2e8967,_0x49809b){return function(_0x3ceeab){if(_0x3ceeab){var _0x19bf3d=typeof _0x49809b['offset']===_0xb601('0x22')&&typeof _0x49809b[_0xb601('0x23')]===_0xb601('0x22');var _0x16f989=_0x3ceeab[_0xb601('0x24')];var _0x364287=_0x19bf3d?0x0:_0x49809b[_0xb601('0x25')];var _0x1cfdc7=_0x19bf3d?_0x3ceeab['count']:_0x49809b[_0xb601('0x25')]+_0x49809b['limit'];var _0x3d8fff;if(_0x1cfdc7>=_0x16f989){_0x1cfdc7=_0x16f989;_0x3d8fff=0xc8;}else{_0x3d8fff=0xce;}_0x2e8967[_0xb601('0x1f')](_0x3d8fff);return _0x2e8967[_0xb601('0x26')](_0xb601('0x27'),_0x364287+'-'+_0x1cfdc7+'/'+_0x16f989)[_0xb601('0x21')](_0x3ceeab);}return null;};}function patchUpdates(_0x1564e8){return function(_0x144e1e){try{jsonpatch[_0xb601('0x28')](_0x144e1e,_0x1564e8,!![]);}catch(_0x1ab58a){return BPromise[_0xb601('0x29')](_0x1ab58a);}return _0x144e1e[_0xb601('0x2a')]();};}function saveUpdates(_0x4274e4,_0x3ae6b4){return function(_0x5b9889){if(_0x5b9889){return _0x5b9889[_0xb601('0x2b')](_0x4274e4)[_0xb601('0x2c')](function(_0xc4bfc6){return _0xc4bfc6;});}return null;};}function removeEntity(_0x486544,_0x155fe5){return function(_0x2312d3){if(_0x2312d3){return _0x2312d3[_0xb601('0x2d')]()[_0xb601('0x2c')](function(){var _0x20f3c2=_0x2312d3['get']({'plain':!![]});var _0x16b3c7='Lists';return db[_0xb601('0x2e')]['destroy']({'where':{'type':_0x16b3c7,'resourceId':_0x20f3c2['id']}})['then'](function(){return _0x2312d3;});})[_0xb601('0x2c')](function(){_0x486544[_0xb601('0x1f')](0xcc)[_0xb601('0x20')]();});}};}function handleEntityNotFound(_0x35b92d,_0x30e54d){return function(_0x121633){if(!_0x121633){_0x35b92d[_0xb601('0x1e')](0x194);}return _0x121633;};}function handleError(_0x56a238,_0x11cd5e){_0x11cd5e=_0x11cd5e||0x1f4;return function(_0x5cbb94){logger[_0xb601('0x2f')](_0x5cbb94['stack']);if(_0x5cbb94['name']){delete _0x5cbb94[_0xb601('0x30')];}_0x56a238[_0xb601('0x1f')](_0x11cd5e)[_0xb601('0x31')](_0x5cbb94);};}exports[_0xb601('0x32')]=function(_0x47e189,_0x4a936a){var _0x29819e={},_0x5db4a7={},_0x23177b={'count':0x0,'rows':[]};var _0x34bfc8=_[_0xb601('0x33')](db[_0xb601('0x34')][_0xb601('0x35')],function(_0x516277){return{'name':_0x516277[_0xb601('0x36')],'type':_0x516277[_0xb601('0x37')][_0xb601('0x38')]};});_0x5db4a7['model']=_[_0xb601('0x33')](_0x34bfc8,_0xb601('0x30'));_0x5db4a7['query']=_[_0xb601('0x39')](_0x47e189[_0xb601('0x3a')]);_0x5db4a7['filters']=_[_0xb601('0x3b')](_0x5db4a7[_0xb601('0x3c')],_0x5db4a7['query']);_0x29819e[_0xb601('0x3d')]=_[_0xb601('0x3b')](_0x5db4a7[_0xb601('0x3c')],qs[_0xb601('0x3e')](_0x47e189[_0xb601('0x3a')]['fields']));_0x29819e['attributes']=_0x29819e[_0xb601('0x3d')][_0xb601('0x3f')]?_0x29819e[_0xb601('0x3d')]:_0x5db4a7[_0xb601('0x3c')];if(!_0x47e189['query']['hasOwnProperty']('nolimit')){_0x29819e[_0xb601('0x23')]=qs[_0xb601('0x23')](_0x47e189[_0xb601('0x3a')]['limit']);_0x29819e['offset']=qs[_0xb601('0x25')](_0x47e189[_0xb601('0x3a')][_0xb601('0x25')]);}_0x29819e[_0xb601('0x40')]=qs['sort'](_0x47e189[_0xb601('0x3a')]['sort']);_0x29819e[_0xb601('0x41')]=qs[_0xb601('0x42')](_['pick'](_0x47e189[_0xb601('0x3a')],_0x5db4a7[_0xb601('0x42')]),_0x34bfc8);if(_0x47e189['query']['filter']){_0x29819e[_0xb601('0x41')]=_[_0xb601('0x43')](_0x29819e['where'],{'$or':_['map'](_0x34bfc8,function(_0x14c217){if(_0x14c217[_0xb601('0x37')]!==_0xb601('0x44')){var _0x305321={};_0x305321[_0x14c217[_0xb601('0x30')]]={'$like':'%'+_0x47e189[_0xb601('0x3a')]['filter']+'%'};return _0x305321;}})});}_0x29819e=_[_0xb601('0x43')]({},_0x29819e,_0x47e189[_0xb601('0x45')]);var _0x4dafcd={'where':_0x29819e['where']};return db[_0xb601('0x34')][_0xb601('0x24')](_0x4dafcd)['then'](function(_0x54971b){_0x23177b[_0xb601('0x24')]=_0x54971b;if(_0x47e189[_0xb601('0x3a')][_0xb601('0x46')]){_0x29819e[_0xb601('0x47')]=[{'all':!![]}];}return db[_0xb601('0x34')][_0xb601('0x48')](_0x29819e);})[_0xb601('0x2c')](function(_0x52d783){_0x23177b[_0xb601('0x49')]=_0x52d783;return _0x23177b;})[_0xb601('0x2c')](respondWithFilteredResult(_0x4a936a,_0x29819e))[_0xb601('0x4a')](handleError(_0x4a936a,null));};exports[_0xb601('0x4b')]=function(_0x55c848,_0x380f6d){var _0x354534={'raw':![],'where':{'id':_0x55c848[_0xb601('0x4c')]['id']}},_0x5a6a1e={};_0x5a6a1e['model']=_['keys'](db[_0xb601('0x34')][_0xb601('0x35')]);_0x5a6a1e['query']=_['keys'](_0x55c848[_0xb601('0x3a')]);_0x5a6a1e[_0xb601('0x42')]=_[_0xb601('0x3b')](_0x5a6a1e[_0xb601('0x3c')],_0x5a6a1e['query']);_0x354534[_0xb601('0x3d')]=_[_0xb601('0x3b')](_0x5a6a1e[_0xb601('0x3c')],qs['fields'](_0x55c848[_0xb601('0x3a')]['fields']));_0x354534['attributes']=_0x354534['attributes'][_0xb601('0x3f')]?_0x354534['attributes']:_0x5a6a1e['model'];if(_0x55c848['query']['includeAll']){_0x354534[_0xb601('0x47')]=[{'all':!![]}];}_0x354534=_['merge']({},_0x354534,_0x55c848[_0xb601('0x45')]);return db[_0xb601('0x34')]['find'](_0x354534)[_0xb601('0x2c')](handleEntityNotFound(_0x380f6d,null))[_0xb601('0x2c')](respondWithResult(_0x380f6d,null))['catch'](handleError(_0x380f6d,null));};exports[_0xb601('0x4d')]=function(_0x73695b,_0xdeba89){return db[_0xb601('0x34')][_0xb601('0x4d')](_0x73695b[_0xb601('0x4e')],{})[_0xb601('0x2c')](function(_0x332333){var _0x12af73=_0x73695b[_0xb601('0x4f')][_0xb601('0x50')]({'plain':!![]});if(!_0x12af73)throw new Error(_0xb601('0x51'));if(_0x12af73[_0xb601('0x52')]==='user'){var _0x4b7647=_0x332333[_0xb601('0x50')]({'plain':!![]});var _0x267637=_0xb601('0x53');return db[_0xb601('0x54')][_0xb601('0x55')]({'where':{'name':_0x267637,'userProfileId':_0x12af73[_0xb601('0x56')]},'raw':!![]})[_0xb601('0x2c')](function(_0x4bc6c6){if(_0x4bc6c6&&_0x4bc6c6[_0xb601('0x57')]===0x0){return db[_0xb601('0x2e')][_0xb601('0x4d')]({'name':_0x4b7647[_0xb601('0x30')],'resourceId':_0x4b7647['id'],'type':_0x4bc6c6[_0xb601('0x30')],'sectionId':_0x4bc6c6['id']},{})['then'](function(){return _0x332333;});}else{return _0x332333;}})['catch'](function(_0x533dd6){logger[_0xb601('0x2f')](_0xb601('0x58'),_0x533dd6);throw _0x533dd6;});}return _0x332333;})['then'](respondWithResult(_0xdeba89,0xc9))['catch'](handleError(_0xdeba89,null));};exports[_0xb601('0x2b')]=function(_0x4c624f,_0x56391a){if(_0x4c624f[_0xb601('0x4e')]['id']){delete _0x4c624f[_0xb601('0x4e')]['id'];}return db[_0xb601('0x34')][_0xb601('0x55')]({'where':{'id':_0x4c624f[_0xb601('0x4c')]['id']}})['then'](handleEntityNotFound(_0x56391a,null))[_0xb601('0x2c')](saveUpdates(_0x4c624f[_0xb601('0x4e')],null))[_0xb601('0x2c')](respondWithResult(_0x56391a,null))[_0xb601('0x4a')](handleError(_0x56391a,null));};exports[_0xb601('0x2d')]=function(_0x1e35f7,_0x6ee2af){return db['CmList'][_0xb601('0x55')]({'where':{'id':_0x1e35f7[_0xb601('0x4c')]['id']}})['then'](handleEntityNotFound(_0x6ee2af,null))[_0xb601('0x2c')](removeEntity(_0x6ee2af,null))[_0xb601('0x4a')](handleError(_0x6ee2af,null));};exports[_0xb601('0x59')]=function(_0x255578,_0x5aa08c){return db[_0xb601('0x34')][_0xb601('0x59')]()['then'](respondWithResult(_0x5aa08c,null))['catch'](handleError(_0x5aa08c,null));};exports[_0xb601('0x5a')]=function(_0x347d4c,_0x6f8385,_0x3d833c){if(_0x347d4c[_0xb601('0x4e')]['id']){delete _0x347d4c[_0xb601('0x4e')]['id'];}return db['CmList'][_0xb601('0x55')]({'where':{'id':_0x347d4c[_0xb601('0x4c')]['id']}})[_0xb601('0x2c')](handleEntityNotFound(_0x6f8385,null))[_0xb601('0x2c')](function(_0x18a589){if(_0x18a589){_0x347d4c[_0xb601('0x4e')][_0xb601('0x5b')]=_0x18a589['id'];return db[_0xb601('0x5c')]['create'](_0x347d4c[_0xb601('0x4e')]);}})[_0xb601('0x2c')](respondWithResult(_0x6f8385,null))[_0xb601('0x4a')](handleError(_0x6f8385,null));};exports[_0xb601('0x5d')]=function(_0x4db44b,_0x3f9621,_0xa1cb9a){var _0x1e816a={'raw':![],'where':{}};var _0x3fd8ab={};var _0x2e5a4b={'count':0x0,'rows':[]};return db[_0xb601('0x34')][_0xb601('0x5e')]({'where':{'id':_0x4db44b[_0xb601('0x4c')]['id']}})[_0xb601('0x2c')](handleEntityNotFound(_0x3f9621,null))[_0xb601('0x2c')](function(_0x5a7eaf){if(_0x5a7eaf){_0x3fd8ab[_0xb601('0x3c')]=_['keys'](db[_0xb601('0x5c')][_0xb601('0x35')]);_0x3fd8ab['query']=_[_0xb601('0x39')](_0x4db44b[_0xb601('0x3a')]);_0x3fd8ab[_0xb601('0x42')]=_['intersection'](_0x3fd8ab[_0xb601('0x3c')],_0x3fd8ab[_0xb601('0x3a')]);_0x1e816a[_0xb601('0x3d')]=_[_0xb601('0x3b')](_0x3fd8ab['model'],qs[_0xb601('0x3e')](_0x4db44b['query']['fields']));_0x1e816a[_0xb601('0x3d')]=_0x1e816a[_0xb601('0x3d')][_0xb601('0x3f')]?_0x1e816a[_0xb601('0x3d')]:_0x3fd8ab[_0xb601('0x3c')];if(!_0x4db44b['query']['hasOwnProperty'](_0xb601('0x5f'))){_0x1e816a[_0xb601('0x23')]=qs[_0xb601('0x23')](_0x4db44b[_0xb601('0x3a')]['limit']);_0x1e816a[_0xb601('0x25')]=qs[_0xb601('0x25')](_0x4db44b[_0xb601('0x3a')][_0xb601('0x25')]);}_0x1e816a[_0xb601('0x40')]=qs[_0xb601('0x60')](_0x4db44b[_0xb601('0x3a')][_0xb601('0x60')]);_0x1e816a[_0xb601('0x41')]=qs['filters'](_[_0xb601('0x61')](_0x4db44b[_0xb601('0x3a')],_0x3fd8ab[_0xb601('0x42')]));_0x1e816a['where'][_0xb601('0x5b')]=_0x5a7eaf['id'];if(_0x4db44b['query']['filter']){_0x1e816a['where']=_[_0xb601('0x43')](_0x1e816a['where'],{'$or':_[_0xb601('0x33')](_0x1e816a['attributes'],function(_0x42d4d2){var _0x169b13={};_0x169b13[_0x42d4d2]={'$like':'%'+_0x4db44b[_0xb601('0x3a')][_0xb601('0x62')]+'%'};return _0x169b13;})});}_0x1e816a=_[_0xb601('0x43')]({},_0x1e816a,_0x4db44b[_0xb601('0x45')]);return db[_0xb601('0x5c')][_0xb601('0x24')]({'where':_0x1e816a[_0xb601('0x41')]})[_0xb601('0x2c')](function(_0x328bc9){_0x2e5a4b[_0xb601('0x24')]=_0x328bc9;if(_0x4db44b[_0xb601('0x3a')][_0xb601('0x46')]){_0x1e816a[_0xb601('0x47')]=[{'all':!![]}];}return db[_0xb601('0x5c')][_0xb601('0x48')](_0x1e816a);})[_0xb601('0x2c')](function(_0xffea40){_0x2e5a4b['rows']=_0xffea40;return _0x2e5a4b;});}})[_0xb601('0x2c')](respondWithFilteredResult(_0x3f9621,_0x1e816a))['catch'](handleError(_0x3f9621,null));};exports[_0xb601('0x63')]=function(_0x3e7421,_0x3f5187,_0x4b19a7){return db[_0xb601('0x34')][_0xb601('0x55')]({'where':{'id':_0x3e7421[_0xb601('0x4c')]['id']}})[_0xb601('0x2c')](handleEntityNotFound(_0x3f5187,null))[_0xb601('0x2c')](function(_0x1bcacc){if(_0x1bcacc){return _0x1bcacc[_0xb601('0x63')](_0x3e7421[_0xb601('0x3a')][_0xb601('0x64')]);}})[_0xb601('0x2c')](respondWithStatusCode(_0x3f5187,null))['catch'](handleError(_0x3f5187,null));};exports[_0xb601('0x65')]=function(_0x10d7c3,_0x53c7f7,_0x2b4345){return db[_0xb601('0x34')]['find']({'where':{'id':_0x10d7c3['params']['id']}})[_0xb601('0x2c')](handleEntityNotFound(_0x53c7f7,null))['then'](function(_0x246111){if(_0x246111){var _0x2a495d=[];var _0x33f900={'success':[],'errors':[]};return db[_0xb601('0x66')][_0xb601('0x59')]()[_0xb601('0x2c')](function(_0x18a6af){if(_0x10d7c3[_0xb601('0x4e')][_0xb601('0x67')]&&_['isArray'](_0x10d7c3[_0xb601('0x4e')][_0xb601('0x67')])){if(_0x10d7c3[_0xb601('0x4e')][_0xb601('0x67')][_0xb601('0x3f')]){_0x10d7c3[_0xb601('0x4e')][_0xb601('0x67')]=_0x10d7c3[_0xb601('0x4e')][_0xb601('0x67')][_0xb601('0x68')](';')+';';}else{_0x10d7c3[_0xb601('0x4e')][_0xb601('0x67')]=null;}}else{_0x10d7c3[_0xb601('0x4e')]['tags']=null;}if(_0x10d7c3['body']&&_[_0xb601('0x69')](_0x10d7c3[_0xb601('0x4e')])){for(var _0x2b83f9=0x0;_0x2b83f9<_0x10d7c3[_0xb601('0x4e')][_0xb601('0x3f')];_0x2b83f9+=0x1){_0x10d7c3[_0xb601('0x4e')][_0x2b83f9][_0xb601('0x5b')]=_0x10d7c3['params']['id'];_0x2a495d['push'](_0x10d7c3['body'][_0x2b83f9]);}return BPromise['each'](_0x2a495d,function(_0x3b32d5){return db[_0xb601('0x66')][_0xb601('0x4d')](_[_0xb601('0x6a')](_0x3b32d5,[_0xb601('0x64'),'id'])||{},{'fields':_[_0xb601('0x39')](_0x18a6af),'raw':!![]})[_0xb601('0x2c')](function(_0x4bbcbf){_0x33f900['success'][_0xb601('0x6b')](_0x4bbcbf[_0xb601('0x6c')]);})[_0xb601('0x4a')](function(_0x41ee69){_0x33f900[_0xb601('0x6d')][_0xb601('0x6b')]({'data':_0x3b32d5,'error':_0x41ee69['message']});});})[_0xb601('0x2c')](function(_0x5285d3){return _0x33f900;})[_0xb601('0x4a')](function(_0x28c1db){return _0x28c1db;});}else{_0x53c7f7[_0xb601('0x1f')](0x190)['json']({'message':_0xb601('0x6e')});}});}})['then'](respondWithResult(_0x53c7f7,null))[_0xb601('0x4a')](handleError(_0x53c7f7,null));};exports[_0xb601('0x6f')]=function(_0x466b15,_0x16095e,_0x3d4e81){var _0x1475e0;return db[_0xb601('0x34')][_0xb601('0x55')]({'where':{'id':_0x466b15['params']['id']},'include':[{'model':db[_0xb601('0x70')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x16095e,null))[_0xb601('0x2c')](function(_0x58858a){if(_0x58858a){_0x1475e0=_0x58858a;return db['CmContact'][_0xb601('0x35')];}})[_0xb601('0x2c')](function(_0x16a903){if(_0x16a903){var _0x2afc7a={};var _0x3d0ca2={};_0x3d0ca2[_0xb601('0x3c')]=_[_0xb601('0x71')](_[_0xb601('0x39')](_0x16a903),_[_0xb601('0x33')](_0x1475e0['CustomFields'],function(_0x142602){return util[_0xb601('0x72')]('cf_%d',_0x142602['id']);}));_0x3d0ca2[_0xb601('0x3a')]=_[_0xb601('0x39')](_0x466b15['query']);_0x3d0ca2[_0xb601('0x42')]=_[_0xb601('0x3b')](_0x3d0ca2['model'],_0x3d0ca2[_0xb601('0x3a')]);_0x2afc7a['attributes']=_[_0xb601('0x3b')](_0x3d0ca2['model'],qs['fields'](_0x466b15[_0xb601('0x3a')][_0xb601('0x3e')]));_0x2afc7a['attributes']=_0x2afc7a[_0xb601('0x3d')]['length']?_0x2afc7a[_0xb601('0x3d')]:_0x3d0ca2['model'];if(!_0x466b15[_0xb601('0x3a')]['hasOwnProperty'](_0xb601('0x5f'))){_0x2afc7a[_0xb601('0x23')]=qs['limit'](_0x466b15[_0xb601('0x3a')][_0xb601('0x23')]);_0x2afc7a[_0xb601('0x25')]=qs['offset'](_0x466b15[_0xb601('0x3a')][_0xb601('0x25')]);}_0x2afc7a[_0xb601('0x40')]=qs['sort'](_0x466b15[_0xb601('0x3a')][_0xb601('0x60')]);_0x2afc7a['where']=qs[_0xb601('0x42')](_[_0xb601('0x61')](_0x466b15[_0xb601('0x3a')],_0x3d0ca2[_0xb601('0x42')]));_0x2afc7a[_0xb601('0x73')]=!![];if(_0x466b15[_0xb601('0x3a')][_0xb601('0x62')]){_0x2afc7a[_0xb601('0x41')]=_[_0xb601('0x43')](_0x2afc7a[_0xb601('0x41')],{'$or':_[_0xb601('0x33')](_0x2afc7a[_0xb601('0x3d')],function(_0x189118){var _0x5ad137={};_0x5ad137[_0x189118]={'$like':'%'+_0x466b15['query'][_0xb601('0x62')]+'%'};return _0x5ad137;})});}_0x2afc7a=_['merge']({},_0x2afc7a,_0x466b15[_0xb601('0x45')]);return _0x1475e0[_0xb601('0x6f')](_0x2afc7a);}})['then'](respondWithResult(_0x16095e,null))['catch'](handleError(_0x16095e,null));};exports[_0xb601('0x74')]=function(_0x1892e0,_0x55dfe4,_0x51c6af){var _0x373a40;var _0x4ef828;var _0x51d573;var _0x3ca4c8=_0x1892e0[_0xb601('0x4c')]['id'];csv_results=[];return db[_0xb601('0x75')][_0xb601('0x48')]({'attributes':['id',_0xb601('0x30')],'raw':!![],'order':['OrderBy']})[_0xb601('0x2c')](function(_0xffc45b){_0x373a40=_0xffc45b;var _0x499883=_[_0xb601('0x39')](db['CmContact'][_0xb601('0x35')]);return db[_0xb601('0x70')][_0xb601('0x48')]({'raw':!![],'attributes':['id',_0xb601('0x76')]})['then'](function(_0x413926){_0x4ef828=_0x413926;var _0x423023=squel['select']()[_0xb601('0x3e')](_0x499883)['from'](_0xb601('0x77'),'c')[_0xb601('0x41')](_0xb601('0x78'),_0x3ca4c8)[_0xb601('0x41')](_0xb601('0x79'))[_0xb601('0x7a')]();for(var _0x4ef355=0x0;_0x4ef355<_0x4ef828[_0xb601('0x3f')];_0x4ef355++){_0x423023['field'](_0xb601('0x7b')+_0x4ef828[_0x4ef355]['id'],'customField_'+_0x4ef828[_0x4ef355][_0xb601('0x76')]);}for(var _0x4ef355=0x0;_0x4ef355<_0x373a40[_0xb601('0x3f')];_0x4ef355++){_0x423023[_0xb601('0x7c')](squel[_0xb601('0x7d')]()[_0xb601('0x7c')](_0xb601('0x7e'))[_0xb601('0x7f')](_0xb601('0x80'))[_0xb601('0x41')](_0xb601('0x81'),_0x373a40[_0x4ef355]['id'])[_0xb601('0x41')](_0xb601('0x82')),_0xb601('0x83')+_0x373a40[_0x4ef355][_0xb601('0x30')]);_0x423023[_0xb601('0x7c')](squel[_0xb601('0x7d')]()[_0xb601('0x7c')]('description')[_0xb601('0x7f')]('cm_contact_has_items')[_0xb601('0x41')](_0xb601('0x81'),_0x373a40[_0x4ef355]['id'])[_0xb601('0x41')](_0xb601('0x82')),_0xb601('0x84')+_0x373a40[_0x4ef355][_0xb601('0x30')]);}var _0x352921=[];_0x352921['push'](_0x423023[_0xb601('0x85')]());BPromise[_0xb601('0x86')](_0x352921,handleQuery)[_0xb601('0x2c')](function(_0xd22efc){handleQuery(_0x423023[_0xb601('0x85')]());var _0x2779d2=csv_results[0x0];if(!_[_0xb601('0x87')](_0x2779d2)){var _0x2717b9=toCsv(_0x2779d2);var _0x58715d=Date[_0xb601('0x88')]();fs[_0xb601('0x89')](util[_0xb601('0x72')]('/tmp/list_%d_%s.csv',_0x3ca4c8,_0x58715d),_0x2717b9);_0x55dfe4['setHeader']('Content-disposition',_0xb601('0x8a')+util['format'](_0xb601('0x8b'),_0x3ca4c8,_0x58715d));_0x55dfe4[_0xb601('0x8c')](_0xb601('0x8d'),_0xb601('0x8e'));return _0x55dfe4[_0xb601('0x8f')](util[_0xb601('0x72')](_0xb601('0x90'),_0x3ca4c8,_0x58715d));}else{return _0x55dfe4['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x2c9bbd,_0x1a0864,_0xe59fa){var _0x410f2a;delete _0x2c9bbd[_0xb601('0x4e')]['id'];return db[_0xb601('0x34')]['findOne']({'where':{'id':_0x2c9bbd[_0xb601('0x4c')]['id']}})[_0xb601('0x2c')](handleEntityNotFound(_0x1a0864,null))[_0xb601('0x2c')](function(_0x50da47){if(_0x50da47){return db[_0xb601('0x91')][_0xb601('0x92')](function(_0x111d3f){return db[_0xb601('0x70')][_0xb601('0x4d')](_0x2c9bbd[_0xb601('0x4e')],{'transaction':_0x111d3f})[_0xb601('0x2c')](function(_0x4f7b1a){_0x410f2a=_0x4f7b1a;return _0x50da47[_0xb601('0x93')](_0x4f7b1a,{'transaction':_0x111d3f});})[_0xb601('0x2c')](function(){var _0x2a5335={'type':db[_0xb601('0x94')][_0xb601('0x95')],'transaction':_0x111d3f};switch(_0x2c9bbd[_0xb601('0x4e')][_0xb601('0x37')]){case _0xb601('0x96'):_0x2a5335[_0xb601('0x37')]=db[_0xb601('0x94')]['TEXT'];break;case _0xb601('0x97'):_0x2a5335[_0xb601('0x37')]=db[_0xb601('0x94')][_0xb601('0x98')];break;case _0xb601('0x99'):_0x2a5335[_0xb601('0x37')]=db[_0xb601('0x94')][_0xb601('0x9a')];_0x2a5335[_0xb601('0x9b')]=![];break;default:}return db['sequelize'][_0xb601('0x9c')][_0xb601('0x9d')](_0xb601('0x77'),util[_0xb601('0x72')](_0xb601('0x9e'),_0x410f2a['id']),_0x2a5335);})['then'](function(){return _0x410f2a;});});}})['then'](respondWithResult(_0x1a0864,null))[_0xb601('0x4a')](handleError(_0x1a0864,null));};exports[_0xb601('0x9f')]=function(_0x3afbd2,_0xe5b2c7,_0x2ef634){var _0x3cc48a={};var _0x52b2f3={};var _0x51810c;var _0x1ae352;return db[_0xb601('0x34')][_0xb601('0x5e')]({'where':{'id':_0x3afbd2[_0xb601('0x4c')]['id']}})[_0xb601('0x2c')](handleEntityNotFound(_0xe5b2c7,null))[_0xb601('0x2c')](function(_0x448b70){if(_0x448b70){_0x51810c=_0x448b70;_0x52b2f3[_0xb601('0x3c')]=_['keys'](db['CmCustomField'][_0xb601('0x35')]);_0x52b2f3['query']=_[_0xb601('0x39')](_0x3afbd2[_0xb601('0x3a')]);_0x52b2f3[_0xb601('0x42')]=_[_0xb601('0x3b')](_0x52b2f3[_0xb601('0x3c')],_0x52b2f3[_0xb601('0x3a')]);_0x3cc48a['attributes']=_['intersection'](_0x52b2f3[_0xb601('0x3c')],qs[_0xb601('0x3e')](_0x3afbd2['query'][_0xb601('0x3e')]));_0x3cc48a['attributes']=_0x3cc48a[_0xb601('0x3d')]['length']?_0x3cc48a['attributes']:_0x52b2f3[_0xb601('0x3c')];_0x3cc48a[_0xb601('0x40')]=qs[_0xb601('0x60')](_0x3afbd2[_0xb601('0x3a')]['sort']);_0x3cc48a[_0xb601('0x41')]=qs[_0xb601('0x42')](_[_0xb601('0x61')](_0x3afbd2[_0xb601('0x3a')],_0x52b2f3['filters']));_0x3cc48a[_0xb601('0x41')]=_[_0xb601('0x43')](_0x3cc48a[_0xb601('0x41')],{'$or':[{'ListId':_0x448b70['id']},{'ListId':null}]});if(_0x3afbd2[_0xb601('0x3a')][_0xb601('0x62')]){_0x3cc48a[_0xb601('0x41')]=_['merge'](_0x3cc48a[_0xb601('0x41')],{'$or':_[_0xb601('0x33')](_0x3cc48a[_0xb601('0x3d')],function(_0x4423ca){var _0x434589={};_0x434589[_0x4423ca]={'$like':'%'+_0x3afbd2['query'][_0xb601('0x62')]+'%'};return _0x434589;})});}_0x3cc48a=_['merge']({},_0x3cc48a,_0x3afbd2['options']);return db['CmCustomField'][_0xb601('0xa0')](_0x3cc48a);}})[_0xb601('0x2c')](respondWithResult(_0xe5b2c7,null))[_0xb601('0x4a')](handleError(_0xe5b2c7,null));};exports[_0xb601('0xa1')]=function(_0x39c9a8,_0x40210f){return db['CmCustomField'][_0xb601('0xa0')]({'where':{'ListId':null}})[_0xb601('0x2c')](handleEntityNotFound(_0x40210f,null))['then'](function(_0x1ea44f){return _0x1ea44f;})['then'](respondWithResult(_0x40210f,null))['catch'](handleError(_0x40210f,null));};exports[_0xb601('0xa2')]=function(_0x37b982,_0xd1b7ef,_0x12fc7c){return db[_0xb601('0x34')][_0xb601('0x55')]({'where':{'id':_0x37b982[_0xb601('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd1b7ef,null))['then'](function(_0x20c137){if(_0x20c137){return _0x20c137['addAgents'](_0x37b982[_0xb601('0x4e')][_0xb601('0x64')],_[_0xb601('0x6a')](_0x37b982[_0xb601('0x4e')],[_0xb601('0x64'),'id'])||{})[_0xb601('0xa3')](function(_0xf9def7){for(var _0x6f8b5b=0x0;_0x6f8b5b<_0x37b982['body'][_0xb601('0x64')][_0xb601('0x3f')];_0x6f8b5b+=0x1){socket[_0xb601('0xa4')](_0xb601('0xa5'),{'UserId':Number(_0x37b982[_0xb601('0x4e')]['ids'][_0x6f8b5b]),'CmListId':Number(_0x37b982[_0xb601('0x4c')]['id'])});}return _0xf9def7;});}})[_0xb601('0x2c')](respondWithResult(_0xd1b7ef,null))['catch'](handleError(_0xd1b7ef,null));};exports[_0xb601('0xa6')]=function(_0x4c416d,_0x2008b1,_0x3cc9cd){return db[_0xb601('0x34')][_0xb601('0x55')]({'where':{'id':_0x4c416d[_0xb601('0x4c')]['id']}})[_0xb601('0x2c')](handleEntityNotFound(_0x2008b1,null))[_0xb601('0x2c')](function(_0x26bbb2){if(_0x26bbb2){return _0x26bbb2[_0xb601('0xa6')](_0x4c416d[_0xb601('0x3a')]['ids'])['then'](function(){if(_[_0xb601('0x69')](_0x4c416d['query'][_0xb601('0x64')])){for(var _0x3ef477=0x0;_0x3ef477<_0x4c416d[_0xb601('0x3a')][_0xb601('0x64')][_0xb601('0x3f')];_0x3ef477+=0x1){socket[_0xb601('0xa4')](_0xb601('0xa7'),{'UserId':Number(_0x4c416d[_0xb601('0x3a')]['ids'][_0x3ef477]),'CmListId':Number(_0x4c416d[_0xb601('0x4c')]['id'])});}}else{socket[_0xb601('0xa4')](_0xb601('0xa7'),{'UserId':Number(_0x4c416d[_0xb601('0x3a')][_0xb601('0x64')]),'CmListId':Number(_0x4c416d[_0xb601('0x4c')]['id'])});}});}})[_0xb601('0x2c')](respondWithStatusCode(_0x2008b1,null))['catch'](handleError(_0x2008b1,null));};exports[_0xb601('0xa8')]=function(_0x28dc38,_0xcce54f,_0x5c15e2){var _0xa470b6={};var _0x2c876={};var _0x1633d6;var _0x512819;return db[_0xb601('0x34')][_0xb601('0x5e')]({'where':{'id':_0x28dc38['params']['id']}})['then'](handleEntityNotFound(_0xcce54f,null))[_0xb601('0x2c')](function(_0x444e12){if(_0x444e12){_0x1633d6=_0x444e12;_0x2c876[_0xb601('0x3c')]=_[_0xb601('0x39')](db[_0xb601('0xa9')]['rawAttributes']);_0x2c876[_0xb601('0x3a')]=_[_0xb601('0x39')](_0x28dc38[_0xb601('0x3a')]);_0x2c876[_0xb601('0x42')]=_[_0xb601('0x3b')](_0x2c876[_0xb601('0x3c')],_0x2c876[_0xb601('0x3a')]);_0xa470b6[_0xb601('0x3d')]=_[_0xb601('0x3b')](_0x2c876[_0xb601('0x3c')],qs[_0xb601('0x3e')](_0x28dc38[_0xb601('0x3a')][_0xb601('0x3e')]));_0xa470b6[_0xb601('0x3d')]=_0xa470b6[_0xb601('0x3d')]['length']?_0xa470b6['attributes']:_0x2c876[_0xb601('0x3c')];_0xa470b6[_0xb601('0x40')]=qs[_0xb601('0x60')](_0x28dc38[_0xb601('0x3a')]['sort']);_0xa470b6[_0xb601('0x41')]=qs[_0xb601('0x42')](_[_0xb601('0x61')](_0x28dc38[_0xb601('0x3a')],_0x2c876[_0xb601('0x42')]));if(_0x28dc38[_0xb601('0x3a')]['filter']){_0xa470b6[_0xb601('0x41')]=_[_0xb601('0x43')](_0xa470b6[_0xb601('0x41')],{'$or':_[_0xb601('0x33')](_0xa470b6[_0xb601('0x3d')],function(_0x5d3b7e){var _0x183e59={};_0x183e59[_0x5d3b7e]={'$like':'%'+_0x28dc38[_0xb601('0x3a')][_0xb601('0x62')]+'%'};return _0x183e59;})});}_0xa470b6=_[_0xb601('0x43')]({},_0xa470b6,_0x28dc38[_0xb601('0x45')]);return _0x1633d6[_0xb601('0xa8')](_0xa470b6);}})[_0xb601('0x2c')](function(_0x382bf6){if(_0x382bf6){_0x512819=_0x382bf6[_0xb601('0x3f')];if(!_0x28dc38[_0xb601('0x3a')]['hasOwnProperty'](_0xb601('0x5f'))){_0xa470b6[_0xb601('0x23')]=qs[_0xb601('0x23')](_0x28dc38[_0xb601('0x3a')][_0xb601('0x23')]);_0xa470b6['offset']=qs['offset'](_0x28dc38[_0xb601('0x3a')][_0xb601('0x25')]);}return _0x1633d6[_0xb601('0xa8')](_0xa470b6);}})[_0xb601('0x2c')](function(_0x17ebfb){if(_0x17ebfb){return _0x17ebfb?{'count':_0x512819,'rows':_0x17ebfb}:null;}})['then'](respondWithResult(_0xcce54f,null))[_0xb601('0x4a')](handleError(_0xcce54f,null));};function handleQuery(_0x4b29e9){logger[_0xb601('0xaa')](_0x4b29e9);return db['sequelize']['query'](_0x4b29e9)[_0xb601('0xa3')](function(_0x1cb98c){csv_results[_0xb601('0x6b')](_0x1cb98c);})[_0xb601('0x4a')](function(_0x40658a){logger[_0xb601('0x2f')](_0x40658a[_0xb601('0xab')]);});} \ No newline at end of file +var _0x4559=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./cmList.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','CmList','type','key','model','query','filters','intersection','attributes','length','order','sort','where','filter','merge','map','VIRTUAL','include','findAll','rows','show','params','keys','fields','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','nolimit','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','ListId','each','omit','success','push','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','writeFileSync','format','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','rawAttributes','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','hasOwnProperty','message','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x4559,0x145));var _0x9455=function(_0x1d3e3f,_0x495ec1){_0x1d3e3f=_0x1d3e3f-0x0;var _0x3879fa=_0x4559[_0x1d3e3f];return _0x3879fa;};'use strict';var emlformat=require(_0x9455('0x0'));var rimraf=require(_0x9455('0x1'));var zipdir=require(_0x9455('0x2'));var jsonpatch=require(_0x9455('0x3'));var rp=require('request-promise');var moment=require(_0x9455('0x4'));var BPromise=require(_0x9455('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9455('0x6'));var sox=require(_0x9455('0x7'));var csv=require(_0x9455('0x8'));var ejs=require(_0x9455('0x9'));var fs=require('fs');var fs_extra=require(_0x9455('0xa'));var _=require(_0x9455('0xb'));var squel=require('squel');var crypto=require(_0x9455('0xc'));var jsforce=require(_0x9455('0xd'));var deskjs=require(_0x9455('0xe'));var toCsv=require(_0x9455('0x8'));var querystring=require(_0x9455('0xf'));var Papa=require(_0x9455('0x10'));var Redis=require(_0x9455('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9455('0x12'));var as=require(_0x9455('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9455('0x14'))(_0x9455('0x15'));var utils=require('../../config/utils');var config=require(_0x9455('0x16'));var licenseUtil=require(_0x9455('0x17'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x9455('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9455('0x19'))(new Redis(config[_0x9455('0x18')]));require(_0x9455('0x1a'))['register'](socket);function respondWithStatusCode(_0x5af34d,_0x2b2aac){_0x2b2aac=_0x2b2aac||0xcc;return function(_0x4e1f9c){if(_0x4e1f9c){return _0x5af34d['sendStatus'](_0x2b2aac);}return _0x5af34d[_0x9455('0x1b')](_0x2b2aac)[_0x9455('0x1c')]();};}function respondWithResult(_0x51d4ec,_0x15c13a){_0x15c13a=_0x15c13a||0xc8;return function(_0x10c2a0){if(_0x10c2a0){return _0x51d4ec[_0x9455('0x1b')](_0x15c13a)['json'](_0x10c2a0);}};}function respondWithFilteredResult(_0x3bda61,_0x296a06){return function(_0x5a1823){if(_0x5a1823){var _0x1f4f5f=typeof _0x296a06[_0x9455('0x1d')]===_0x9455('0x1e')&&typeof _0x296a06[_0x9455('0x1f')]==='undefined';var _0x4a4def=_0x5a1823[_0x9455('0x20')];var _0x48dce9=_0x1f4f5f?0x0:_0x296a06[_0x9455('0x1d')];var _0x4e3b17=_0x1f4f5f?_0x5a1823[_0x9455('0x20')]:_0x296a06[_0x9455('0x1d')]+_0x296a06['limit'];var _0xaff40;if(_0x4e3b17>=_0x4a4def){_0x4e3b17=_0x4a4def;_0xaff40=0xc8;}else{_0xaff40=0xce;}_0x3bda61[_0x9455('0x1b')](_0xaff40);return _0x3bda61[_0x9455('0x21')](_0x9455('0x22'),_0x48dce9+'-'+_0x4e3b17+'/'+_0x4a4def)[_0x9455('0x23')](_0x5a1823);}return null;};}function patchUpdates(_0x274743){return function(_0x2880a1){try{jsonpatch[_0x9455('0x24')](_0x2880a1,_0x274743,!![]);}catch(_0x5dda06){return BPromise[_0x9455('0x25')](_0x5dda06);}return _0x2880a1[_0x9455('0x26')]();};}function saveUpdates(_0x44b462,_0x2f22a9){return function(_0xc129f6){if(_0xc129f6){return _0xc129f6[_0x9455('0x27')](_0x44b462)[_0x9455('0x28')](function(_0x27094d){return _0x27094d;});}return null;};}function removeEntity(_0x3dddde,_0x377eac){return function(_0x146cdd){if(_0x146cdd){return _0x146cdd[_0x9455('0x29')]()[_0x9455('0x28')](function(){var _0x5b02a1=_0x146cdd[_0x9455('0x2a')]({'plain':!![]});var _0x125517=_0x9455('0x2b');return db[_0x9455('0x2c')][_0x9455('0x29')]({'where':{'type':_0x125517,'resourceId':_0x5b02a1['id']}})[_0x9455('0x28')](function(){return _0x146cdd;});})[_0x9455('0x28')](function(){_0x3dddde[_0x9455('0x1b')](0xcc)[_0x9455('0x1c')]();});}};}function handleEntityNotFound(_0x1b9465,_0x117f1f){return function(_0x51e3f0){if(!_0x51e3f0){_0x1b9465[_0x9455('0x2d')](0x194);}return _0x51e3f0;};}function handleError(_0x35e62e,_0xb9c020){_0xb9c020=_0xb9c020||0x1f4;return function(_0x47aeb3){logger[_0x9455('0x2e')](_0x47aeb3[_0x9455('0x2f')]);if(_0x47aeb3[_0x9455('0x30')]){delete _0x47aeb3['name'];}_0x35e62e['status'](_0xb9c020)[_0x9455('0x31')](_0x47aeb3);};}exports[_0x9455('0x32')]=function(_0x1df54c,_0x4adc74){var _0x59adb7={},_0x4d7b30={},_0x500ed0={'count':0x0,'rows':[]};var _0x424e0e=_['map'](db[_0x9455('0x33')]['rawAttributes'],function(_0x27138b){return{'name':_0x27138b['fieldName'],'type':_0x27138b[_0x9455('0x34')][_0x9455('0x35')]};});_0x4d7b30[_0x9455('0x36')]=_['map'](_0x424e0e,_0x9455('0x30'));_0x4d7b30[_0x9455('0x37')]=_['keys'](_0x1df54c['query']);_0x4d7b30[_0x9455('0x38')]=_[_0x9455('0x39')](_0x4d7b30['model'],_0x4d7b30[_0x9455('0x37')]);_0x59adb7[_0x9455('0x3a')]=_[_0x9455('0x39')](_0x4d7b30[_0x9455('0x36')],qs['fields'](_0x1df54c[_0x9455('0x37')]['fields']));_0x59adb7[_0x9455('0x3a')]=_0x59adb7[_0x9455('0x3a')][_0x9455('0x3b')]?_0x59adb7[_0x9455('0x3a')]:_0x4d7b30[_0x9455('0x36')];if(!_0x1df54c['query']['hasOwnProperty']('nolimit')){_0x59adb7[_0x9455('0x1f')]=qs[_0x9455('0x1f')](_0x1df54c[_0x9455('0x37')][_0x9455('0x1f')]);_0x59adb7[_0x9455('0x1d')]=qs[_0x9455('0x1d')](_0x1df54c[_0x9455('0x37')]['offset']);}_0x59adb7[_0x9455('0x3c')]=qs[_0x9455('0x3d')](_0x1df54c[_0x9455('0x37')][_0x9455('0x3d')]);_0x59adb7[_0x9455('0x3e')]=qs[_0x9455('0x38')](_['pick'](_0x1df54c[_0x9455('0x37')],_0x4d7b30[_0x9455('0x38')]),_0x424e0e);if(_0x1df54c[_0x9455('0x37')][_0x9455('0x3f')]){_0x59adb7[_0x9455('0x3e')]=_[_0x9455('0x40')](_0x59adb7[_0x9455('0x3e')],{'$or':_[_0x9455('0x41')](_0x424e0e,function(_0x1cd9e6){if(_0x1cd9e6[_0x9455('0x34')]!==_0x9455('0x42')){var _0x4ba78b={};_0x4ba78b[_0x1cd9e6[_0x9455('0x30')]]={'$like':'%'+_0x1df54c[_0x9455('0x37')][_0x9455('0x3f')]+'%'};return _0x4ba78b;}})});}_0x59adb7=_[_0x9455('0x40')]({},_0x59adb7,_0x1df54c['options']);var _0xa21a72={'where':_0x59adb7[_0x9455('0x3e')]};return db[_0x9455('0x33')][_0x9455('0x20')](_0xa21a72)[_0x9455('0x28')](function(_0x2ffd31){_0x500ed0[_0x9455('0x20')]=_0x2ffd31;if(_0x1df54c[_0x9455('0x37')]['includeAll']){_0x59adb7[_0x9455('0x43')]=[{'all':!![]}];}return db[_0x9455('0x33')][_0x9455('0x44')](_0x59adb7);})[_0x9455('0x28')](function(_0x3f4318){_0x500ed0[_0x9455('0x45')]=_0x3f4318;return _0x500ed0;})[_0x9455('0x28')](respondWithFilteredResult(_0x4adc74,_0x59adb7))['catch'](handleError(_0x4adc74,null));};exports[_0x9455('0x46')]=function(_0x7b6469,_0x2393ee){var _0x217002={'raw':![],'where':{'id':_0x7b6469[_0x9455('0x47')]['id']}},_0xdc1639={};_0xdc1639[_0x9455('0x36')]=_[_0x9455('0x48')](db[_0x9455('0x33')]['rawAttributes']);_0xdc1639[_0x9455('0x37')]=_[_0x9455('0x48')](_0x7b6469[_0x9455('0x37')]);_0xdc1639[_0x9455('0x38')]=_['intersection'](_0xdc1639['model'],_0xdc1639[_0x9455('0x37')]);_0x217002['attributes']=_[_0x9455('0x39')](_0xdc1639['model'],qs[_0x9455('0x49')](_0x7b6469['query']['fields']));_0x217002[_0x9455('0x3a')]=_0x217002[_0x9455('0x3a')][_0x9455('0x3b')]?_0x217002[_0x9455('0x3a')]:_0xdc1639['model'];if(_0x7b6469['query'][_0x9455('0x4a')]){_0x217002['include']=[{'all':!![]}];}_0x217002=_['merge']({},_0x217002,_0x7b6469[_0x9455('0x4b')]);return db[_0x9455('0x33')][_0x9455('0x4c')](_0x217002)[_0x9455('0x28')](handleEntityNotFound(_0x2393ee,null))[_0x9455('0x28')](respondWithResult(_0x2393ee,null))[_0x9455('0x4d')](handleError(_0x2393ee,null));};exports[_0x9455('0x4e')]=function(_0x3e98f8,_0x2db2a6){return db[_0x9455('0x33')][_0x9455('0x4e')](_0x3e98f8[_0x9455('0x4f')],{})['then'](function(_0x3048d0){var _0x1918ea=_0x3e98f8[_0x9455('0x50')]['get']({'plain':!![]});if(!_0x1918ea)throw new Error(_0x9455('0x51'));if(_0x1918ea['role']===_0x9455('0x50')){var _0x40a24b=_0x3048d0[_0x9455('0x2a')]({'plain':!![]});var _0x3f9168=_0x9455('0x2b');return db['UserProfileSection'][_0x9455('0x4c')]({'where':{'name':_0x3f9168,'userProfileId':_0x1918ea[_0x9455('0x52')]},'raw':!![]})[_0x9455('0x28')](function(_0x202ae7){if(_0x202ae7&&_0x202ae7[_0x9455('0x53')]===0x0){return db[_0x9455('0x2c')][_0x9455('0x4e')]({'name':_0x40a24b[_0x9455('0x30')],'resourceId':_0x40a24b['id'],'type':_0x202ae7[_0x9455('0x30')],'sectionId':_0x202ae7['id']},{})['then'](function(){return _0x3048d0;});}else{return _0x3048d0;}})['catch'](function(_0x291ef6){logger['error'](_0x9455('0x54'),_0x291ef6);throw _0x291ef6;});}return _0x3048d0;})[_0x9455('0x28')](respondWithResult(_0x2db2a6,0xc9))[_0x9455('0x4d')](handleError(_0x2db2a6,null));};exports[_0x9455('0x27')]=function(_0x522989,_0x4e3ae3){if(_0x522989[_0x9455('0x4f')]['id']){delete _0x522989[_0x9455('0x4f')]['id'];}return db[_0x9455('0x33')]['find']({'where':{'id':_0x522989[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x4e3ae3,null))[_0x9455('0x28')](saveUpdates(_0x522989[_0x9455('0x4f')],null))[_0x9455('0x28')](respondWithResult(_0x4e3ae3,null))[_0x9455('0x4d')](handleError(_0x4e3ae3,null));};exports[_0x9455('0x29')]=function(_0x4e4201,_0x1b0764){return db[_0x9455('0x33')]['find']({'where':{'id':_0x4e4201[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x1b0764,null))[_0x9455('0x28')](removeEntity(_0x1b0764,null))[_0x9455('0x4d')](handleError(_0x1b0764,null));};exports[_0x9455('0x55')]=function(_0xb40b74,_0x118557){return db[_0x9455('0x33')]['describe']()[_0x9455('0x28')](respondWithResult(_0x118557,null))[_0x9455('0x4d')](handleError(_0x118557,null));};exports[_0x9455('0x56')]=function(_0x520125,_0x552ad8,_0x4b4aa6){if(_0x520125['body']['id']){delete _0x520125['body']['id'];}return db[_0x9455('0x33')][_0x9455('0x4c')]({'where':{'id':_0x520125['params']['id']}})['then'](handleEntityNotFound(_0x552ad8,null))['then'](function(_0x9c2a94){if(_0x9c2a94){_0x520125[_0x9455('0x4f')]['ListId']=_0x9c2a94['id'];return db[_0x9455('0x57')][_0x9455('0x4e')](_0x520125[_0x9455('0x4f')]);}})[_0x9455('0x28')](respondWithResult(_0x552ad8,null))[_0x9455('0x4d')](handleError(_0x552ad8,null));};exports['getDispositions']=function(_0x4293ce,_0x3b2ad3,_0x2b0672){var _0x4c30c3={'raw':![],'where':{}};var _0x422e5a={};var _0x51719b={'count':0x0,'rows':[]};return db[_0x9455('0x33')][_0x9455('0x58')]({'where':{'id':_0x4293ce['params']['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x3b2ad3,null))[_0x9455('0x28')](function(_0x547d5b){if(_0x547d5b){_0x422e5a[_0x9455('0x36')]=_[_0x9455('0x48')](db[_0x9455('0x57')]['rawAttributes']);_0x422e5a['query']=_[_0x9455('0x48')](_0x4293ce[_0x9455('0x37')]);_0x422e5a[_0x9455('0x38')]=_[_0x9455('0x39')](_0x422e5a[_0x9455('0x36')],_0x422e5a[_0x9455('0x37')]);_0x4c30c3[_0x9455('0x3a')]=_[_0x9455('0x39')](_0x422e5a[_0x9455('0x36')],qs['fields'](_0x4293ce[_0x9455('0x37')][_0x9455('0x49')]));_0x4c30c3[_0x9455('0x3a')]=_0x4c30c3[_0x9455('0x3a')][_0x9455('0x3b')]?_0x4c30c3['attributes']:_0x422e5a[_0x9455('0x36')];if(!_0x4293ce[_0x9455('0x37')]['hasOwnProperty'](_0x9455('0x59'))){_0x4c30c3[_0x9455('0x1f')]=qs[_0x9455('0x1f')](_0x4293ce[_0x9455('0x37')][_0x9455('0x1f')]);_0x4c30c3['offset']=qs[_0x9455('0x1d')](_0x4293ce['query']['offset']);}_0x4c30c3[_0x9455('0x3c')]=qs['sort'](_0x4293ce['query']['sort']);_0x4c30c3['where']=qs['filters'](_[_0x9455('0x5a')](_0x4293ce['query'],_0x422e5a['filters']));_0x4c30c3['where']['ListId']=_0x547d5b['id'];if(_0x4293ce[_0x9455('0x37')][_0x9455('0x3f')]){_0x4c30c3[_0x9455('0x3e')]=_[_0x9455('0x40')](_0x4c30c3['where'],{'$or':_['map'](_0x4c30c3[_0x9455('0x3a')],function(_0x37a1fb){var _0x3e1f1a={};_0x3e1f1a[_0x37a1fb]={'$like':'%'+_0x4293ce[_0x9455('0x37')][_0x9455('0x3f')]+'%'};return _0x3e1f1a;})});}_0x4c30c3=_['merge']({},_0x4c30c3,_0x4293ce['options']);return db[_0x9455('0x57')]['count']({'where':_0x4c30c3[_0x9455('0x3e')]})['then'](function(_0x45630b){_0x51719b[_0x9455('0x20')]=_0x45630b;if(_0x4293ce[_0x9455('0x37')]['includeAll']){_0x4c30c3[_0x9455('0x43')]=[{'all':!![]}];}return db[_0x9455('0x57')][_0x9455('0x44')](_0x4c30c3);})[_0x9455('0x28')](function(_0xce8f){_0x51719b['rows']=_0xce8f;return _0x51719b;});}})['then'](respondWithFilteredResult(_0x3b2ad3,_0x4c30c3))[_0x9455('0x4d')](handleError(_0x3b2ad3,null));};exports[_0x9455('0x5b')]=function(_0x20d996,_0x3cc78a,_0x4f324d){return db[_0x9455('0x33')][_0x9455('0x4c')]({'where':{'id':_0x20d996['params']['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x3cc78a,null))[_0x9455('0x28')](function(_0x4162fb){if(_0x4162fb){return _0x4162fb[_0x9455('0x5b')](_0x20d996[_0x9455('0x37')][_0x9455('0x5c')]);}})[_0x9455('0x28')](respondWithStatusCode(_0x3cc78a,null))[_0x9455('0x4d')](handleError(_0x3cc78a,null));};exports[_0x9455('0x5d')]=function(_0x44af1e,_0x4f343c,_0xc77ba2){return db[_0x9455('0x33')]['find']({'where':{'id':_0x44af1e[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x4f343c,null))[_0x9455('0x28')](function(_0x5517f7){if(_0x5517f7){var _0x1be95a=[];var _0x452c43={'success':[],'errors':[]};return db[_0x9455('0x5e')]['describe']()['then'](function(_0x344017){if(_0x44af1e['body'][_0x9455('0x5f')]&&_['isArray'](_0x44af1e['body']['tags'])){if(_0x44af1e[_0x9455('0x4f')][_0x9455('0x5f')][_0x9455('0x3b')]){_0x44af1e[_0x9455('0x4f')][_0x9455('0x5f')]=_0x44af1e[_0x9455('0x4f')][_0x9455('0x5f')]['join'](';')+';';}else{_0x44af1e['body']['tags']=null;}}else{_0x44af1e[_0x9455('0x4f')][_0x9455('0x5f')]=null;}if(_0x44af1e[_0x9455('0x4f')]&&_[_0x9455('0x60')](_0x44af1e[_0x9455('0x4f')])){for(var _0x989000=0x0;_0x989000<_0x44af1e[_0x9455('0x4f')][_0x9455('0x3b')];_0x989000+=0x1){_0x44af1e[_0x9455('0x4f')][_0x989000][_0x9455('0x61')]=_0x44af1e[_0x9455('0x47')]['id'];_0x1be95a['push'](_0x44af1e[_0x9455('0x4f')][_0x989000]);}return BPromise[_0x9455('0x62')](_0x1be95a,function(_0x19a6d7){return db[_0x9455('0x5e')]['create'](_[_0x9455('0x63')](_0x19a6d7,[_0x9455('0x5c'),'id'])||{},{'fields':_['keys'](_0x344017),'raw':!![]})['then'](function(_0x1acfab){_0x452c43[_0x9455('0x64')][_0x9455('0x65')](_0x1acfab[_0x9455('0x66')]);})[_0x9455('0x4d')](function(_0x324306){_0x452c43[_0x9455('0x67')][_0x9455('0x65')]({'data':_0x19a6d7,'error':_0x324306['message']});});})[_0x9455('0x28')](function(_0x1d3097){return _0x452c43;})[_0x9455('0x4d')](function(_0x15b379){return _0x15b379;});}else{_0x4f343c[_0x9455('0x1b')](0x190)[_0x9455('0x23')]({'message':_0x9455('0x68')});}});}})[_0x9455('0x28')](respondWithResult(_0x4f343c,null))['catch'](handleError(_0x4f343c,null));};exports[_0x9455('0x69')]=function(_0x51238c,_0x299a9c,_0x15ddac){var _0x1692df;return db[_0x9455('0x33')][_0x9455('0x4c')]({'where':{'id':_0x51238c[_0x9455('0x47')]['id']},'include':[{'model':db[_0x9455('0x6a')],'as':'CustomFields'}]})[_0x9455('0x28')](handleEntityNotFound(_0x299a9c,null))[_0x9455('0x28')](function(_0x233d45){if(_0x233d45){_0x1692df=_0x233d45;return db[_0x9455('0x5e')]['rawAttributes'];}})[_0x9455('0x28')](function(_0x5a26d9){if(_0x5a26d9){var _0x129926={};var _0x23d61f={};_0x23d61f['model']=_[_0x9455('0x6b')](_[_0x9455('0x48')](_0x5a26d9),_[_0x9455('0x41')](_0x1692df[_0x9455('0x6c')],function(_0x4ea0d1){return util['format']('cf_%d',_0x4ea0d1['id']);}));_0x23d61f['query']=_[_0x9455('0x48')](_0x51238c[_0x9455('0x37')]);_0x23d61f[_0x9455('0x38')]=_[_0x9455('0x39')](_0x23d61f[_0x9455('0x36')],_0x23d61f[_0x9455('0x37')]);_0x129926[_0x9455('0x3a')]=_[_0x9455('0x39')](_0x23d61f[_0x9455('0x36')],qs[_0x9455('0x49')](_0x51238c[_0x9455('0x37')][_0x9455('0x49')]));_0x129926[_0x9455('0x3a')]=_0x129926[_0x9455('0x3a')][_0x9455('0x3b')]?_0x129926[_0x9455('0x3a')]:_0x23d61f[_0x9455('0x36')];if(!_0x51238c[_0x9455('0x37')]['hasOwnProperty'](_0x9455('0x59'))){_0x129926['limit']=qs['limit'](_0x51238c[_0x9455('0x37')]['limit']);_0x129926[_0x9455('0x1d')]=qs[_0x9455('0x1d')](_0x51238c[_0x9455('0x37')][_0x9455('0x1d')]);}_0x129926['order']=qs[_0x9455('0x3d')](_0x51238c[_0x9455('0x37')]['sort']);_0x129926[_0x9455('0x3e')]=qs[_0x9455('0x38')](_[_0x9455('0x5a')](_0x51238c[_0x9455('0x37')],_0x23d61f['filters']));_0x129926['raw']=!![];if(_0x51238c[_0x9455('0x37')][_0x9455('0x3f')]){_0x129926[_0x9455('0x3e')]=_[_0x9455('0x40')](_0x129926[_0x9455('0x3e')],{'$or':_[_0x9455('0x41')](_0x129926[_0x9455('0x3a')],function(_0x432b3f){var _0x44f719={};_0x44f719[_0x432b3f]={'$like':'%'+_0x51238c['query']['filter']+'%'};return _0x44f719;})});}_0x129926=_[_0x9455('0x40')]({},_0x129926,_0x51238c[_0x9455('0x4b')]);return _0x1692df[_0x9455('0x69')](_0x129926);}})[_0x9455('0x28')](respondWithResult(_0x299a9c,null))[_0x9455('0x4d')](handleError(_0x299a9c,null));};exports[_0x9455('0x6d')]=function(_0x27cbfb,_0x2f0327,_0x152956){var _0x1dc2f4;var _0x5f3c37;var _0x5a619c;var _0x4b431e=_0x27cbfb['params']['id'];csv_results=[];return db[_0x9455('0x6e')][_0x9455('0x44')]({'attributes':['id',_0x9455('0x30')],'raw':!![],'order':[_0x9455('0x6f')]})[_0x9455('0x28')](function(_0x4659f2){_0x1dc2f4=_0x4659f2;var _0x1259fa=_[_0x9455('0x48')](db[_0x9455('0x5e')]['rawAttributes']);return db['CmCustomField'][_0x9455('0x44')]({'raw':!![],'attributes':['id',_0x9455('0x70')]})[_0x9455('0x28')](function(_0x25dd2a){_0x5f3c37=_0x25dd2a;var _0x2ef6c3=squel[_0x9455('0x71')]()['fields'](_0x1259fa)[_0x9455('0x72')](_0x9455('0x73'),'c')[_0x9455('0x3e')]('c.ListId\x20=\x20?',_0x4b431e)['where'](_0x9455('0x74'))[_0x9455('0x75')]();for(var _0x1446cc=0x0;_0x1446cc<_0x5f3c37[_0x9455('0x3b')];_0x1446cc++){_0x2ef6c3['field'](_0x9455('0x76')+_0x5f3c37[_0x1446cc]['id'],_0x9455('0x77')+_0x5f3c37[_0x1446cc][_0x9455('0x70')]);}for(var _0x1446cc=0x0;_0x1446cc<_0x1dc2f4[_0x9455('0x3b')];_0x1446cc++){_0x2ef6c3[_0x9455('0x78')](squel[_0x9455('0x71')]()[_0x9455('0x78')](_0x9455('0x79'))[_0x9455('0x72')](_0x9455('0x7a'))[_0x9455('0x3e')](_0x9455('0x7b'),_0x1dc2f4[_0x1446cc]['id'])[_0x9455('0x3e')]('CmContactId\x20=\x20c.id'),_0x9455('0x7c')+_0x1dc2f4[_0x1446cc][_0x9455('0x30')]);_0x2ef6c3[_0x9455('0x78')](squel[_0x9455('0x71')]()['field'](_0x9455('0x7d'))[_0x9455('0x72')](_0x9455('0x7a'))[_0x9455('0x3e')](_0x9455('0x7b'),_0x1dc2f4[_0x1446cc]['id'])[_0x9455('0x3e')](_0x9455('0x7e')),_0x9455('0x7f')+_0x1dc2f4[_0x1446cc]['name']);}var _0x7be2ab=[];_0x7be2ab[_0x9455('0x65')](_0x2ef6c3[_0x9455('0x80')]());BPromise[_0x9455('0x62')](_0x7be2ab,handleQuery)[_0x9455('0x28')](function(_0x216727){handleQuery(_0x2ef6c3[_0x9455('0x80')]());var _0x10eb9a=csv_results[0x0];if(!_['isEmpty'](_0x10eb9a)){var _0x4c85e6=toCsv(_0x10eb9a);var _0x350c39=Date['now']();fs[_0x9455('0x81')](util[_0x9455('0x82')]('/tmp/list_%d_%s.csv',_0x4b431e,_0x350c39),_0x4c85e6);_0x2f0327[_0x9455('0x83')](_0x9455('0x84'),'attachment;\x20filename='+util['format'](_0x9455('0x85'),_0x4b431e,_0x350c39));_0x2f0327['setHeader'](_0x9455('0x86'),_0x9455('0x87'));return _0x2f0327[_0x9455('0x88')](util[_0x9455('0x82')]('/tmp/list_%d_%s.csv',_0x4b431e,_0x350c39));}else{return _0x2f0327[_0x9455('0x2d')](0xcc);}});});});};exports[_0x9455('0x89')]=function(_0x2c40d4,_0x1683ba,_0x6befb5){var _0x276f7c;delete _0x2c40d4[_0x9455('0x4f')]['id'];return db[_0x9455('0x33')][_0x9455('0x58')]({'where':{'id':_0x2c40d4[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x1683ba,null))[_0x9455('0x28')](function(_0x16db46){if(_0x16db46){return db[_0x9455('0x8a')][_0x9455('0x8b')](function(_0xd1988f){return db[_0x9455('0x6a')]['create'](_0x2c40d4[_0x9455('0x4f')],{'transaction':_0xd1988f})[_0x9455('0x28')](function(_0x2a91f3){_0x276f7c=_0x2a91f3;return _0x16db46[_0x9455('0x8c')](_0x2a91f3,{'transaction':_0xd1988f});})[_0x9455('0x28')](function(){var _0x47c0de={'type':db[_0x9455('0x8d')][_0x9455('0x8e')],'transaction':_0xd1988f};switch(_0x2c40d4[_0x9455('0x4f')][_0x9455('0x34')]){case _0x9455('0x8f'):_0x47c0de[_0x9455('0x34')]=db['Sequelize'][_0x9455('0x8e')];break;case _0x9455('0x90'):_0x47c0de[_0x9455('0x34')]=db[_0x9455('0x8d')][_0x9455('0x91')];break;case _0x9455('0x92'):_0x47c0de[_0x9455('0x34')]=db[_0x9455('0x8d')][_0x9455('0x93')];_0x47c0de[_0x9455('0x94')]=![];break;default:}return db[_0x9455('0x8a')][_0x9455('0x95')][_0x9455('0x96')](_0x9455('0x73'),util[_0x9455('0x82')](_0x9455('0x97'),_0x276f7c['id']),_0x47c0de);})[_0x9455('0x28')](function(){return _0x276f7c;});});}})[_0x9455('0x28')](respondWithResult(_0x1683ba,null))['catch'](handleError(_0x1683ba,null));};exports[_0x9455('0x98')]=function(_0x46db1c,_0x9dc020,_0x176509){var _0x29d795={};var _0x1b2359={};var _0x1b94ec;var _0x457a98;return db[_0x9455('0x33')][_0x9455('0x58')]({'where':{'id':_0x46db1c['params']['id']}})['then'](handleEntityNotFound(_0x9dc020,null))[_0x9455('0x28')](function(_0x132bfa){if(_0x132bfa){_0x1b94ec=_0x132bfa;_0x1b2359[_0x9455('0x36')]=_['keys'](db[_0x9455('0x6a')][_0x9455('0x99')]);_0x1b2359[_0x9455('0x37')]=_[_0x9455('0x48')](_0x46db1c[_0x9455('0x37')]);_0x1b2359[_0x9455('0x38')]=_[_0x9455('0x39')](_0x1b2359[_0x9455('0x36')],_0x1b2359[_0x9455('0x37')]);_0x29d795[_0x9455('0x3a')]=_[_0x9455('0x39')](_0x1b2359[_0x9455('0x36')],qs[_0x9455('0x49')](_0x46db1c['query']['fields']));_0x29d795[_0x9455('0x3a')]=_0x29d795[_0x9455('0x3a')]['length']?_0x29d795[_0x9455('0x3a')]:_0x1b2359['model'];_0x29d795[_0x9455('0x3c')]=qs[_0x9455('0x3d')](_0x46db1c[_0x9455('0x37')][_0x9455('0x3d')]);_0x29d795[_0x9455('0x3e')]=qs[_0x9455('0x38')](_[_0x9455('0x5a')](_0x46db1c[_0x9455('0x37')],_0x1b2359[_0x9455('0x38')]));_0x29d795[_0x9455('0x3e')]=_[_0x9455('0x40')](_0x29d795[_0x9455('0x3e')],{'$or':[{'ListId':_0x132bfa['id']},{'ListId':null}]});if(_0x46db1c[_0x9455('0x37')][_0x9455('0x3f')]){_0x29d795[_0x9455('0x3e')]=_['merge'](_0x29d795[_0x9455('0x3e')],{'$or':_[_0x9455('0x41')](_0x29d795[_0x9455('0x3a')],function(_0x253c8f){var _0x384f49={};_0x384f49[_0x253c8f]={'$like':'%'+_0x46db1c[_0x9455('0x37')][_0x9455('0x3f')]+'%'};return _0x384f49;})});}_0x29d795=_[_0x9455('0x40')]({},_0x29d795,_0x46db1c[_0x9455('0x4b')]);return db[_0x9455('0x6a')][_0x9455('0x9a')](_0x29d795);}})[_0x9455('0x28')](respondWithResult(_0x9dc020,null))[_0x9455('0x4d')](handleError(_0x9dc020,null));};exports[_0x9455('0x9b')]=function(_0x2a7d80,_0x2779ac){return db[_0x9455('0x6a')][_0x9455('0x9a')]({'where':{'ListId':null}})[_0x9455('0x28')](handleEntityNotFound(_0x2779ac,null))[_0x9455('0x28')](function(_0x2f0cc5){return _0x2f0cc5;})[_0x9455('0x28')](respondWithResult(_0x2779ac,null))[_0x9455('0x4d')](handleError(_0x2779ac,null));};exports[_0x9455('0x9c')]=function(_0x15bf2d,_0x2da533,_0x3f2e41){return db[_0x9455('0x33')]['find']({'where':{'id':_0x15bf2d[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x2da533,null))[_0x9455('0x28')](function(_0x2e68a8){if(_0x2e68a8){return _0x2e68a8[_0x9455('0x9c')](_0x15bf2d[_0x9455('0x4f')]['ids'],_['omit'](_0x15bf2d[_0x9455('0x4f')],[_0x9455('0x5c'),'id'])||{})[_0x9455('0x9d')](function(_0x230bca){for(var _0x40a51f=0x0;_0x40a51f<_0x15bf2d[_0x9455('0x4f')]['ids']['length'];_0x40a51f+=0x1){socket[_0x9455('0x9e')](_0x9455('0x9f'),{'UserId':Number(_0x15bf2d[_0x9455('0x4f')]['ids'][_0x40a51f]),'CmListId':Number(_0x15bf2d['params']['id'])});}return _0x230bca;});}})[_0x9455('0x28')](respondWithResult(_0x2da533,null))['catch'](handleError(_0x2da533,null));};exports[_0x9455('0xa0')]=function(_0x441751,_0x328372,_0x27b49f){return db[_0x9455('0x33')][_0x9455('0x4c')]({'where':{'id':_0x441751[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x328372,null))[_0x9455('0x28')](function(_0x2980a4){if(_0x2980a4){return _0x2980a4['removeAgents'](_0x441751[_0x9455('0x37')][_0x9455('0x5c')])[_0x9455('0x28')](function(){if(_['isArray'](_0x441751[_0x9455('0x37')][_0x9455('0x5c')])){for(var _0x13cee9=0x0;_0x13cee9<_0x441751[_0x9455('0x37')][_0x9455('0x5c')][_0x9455('0x3b')];_0x13cee9+=0x1){socket[_0x9455('0x9e')](_0x9455('0xa1'),{'UserId':Number(_0x441751['query'][_0x9455('0x5c')][_0x13cee9]),'CmListId':Number(_0x441751[_0x9455('0x47')]['id'])});}}else{socket['emit'](_0x9455('0xa1'),{'UserId':Number(_0x441751[_0x9455('0x37')]['ids']),'CmListId':Number(_0x441751[_0x9455('0x47')]['id'])});}});}})[_0x9455('0x28')](respondWithStatusCode(_0x328372,null))['catch'](handleError(_0x328372,null));};exports[_0x9455('0xa2')]=function(_0x57d2bd,_0x43963f,_0x4aaa27){var _0x24462d={};var _0x3fde21={};var _0x458b76;var _0x314d0a;return db[_0x9455('0x33')][_0x9455('0x58')]({'where':{'id':_0x57d2bd[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x43963f,null))[_0x9455('0x28')](function(_0x548e07){if(_0x548e07){_0x458b76=_0x548e07;_0x3fde21['model']=_['keys'](db[_0x9455('0xa3')][_0x9455('0x99')]);_0x3fde21[_0x9455('0x37')]=_[_0x9455('0x48')](_0x57d2bd[_0x9455('0x37')]);_0x3fde21['filters']=_[_0x9455('0x39')](_0x3fde21['model'],_0x3fde21[_0x9455('0x37')]);_0x24462d[_0x9455('0x3a')]=_[_0x9455('0x39')](_0x3fde21[_0x9455('0x36')],qs[_0x9455('0x49')](_0x57d2bd[_0x9455('0x37')][_0x9455('0x49')]));_0x24462d[_0x9455('0x3a')]=_0x24462d[_0x9455('0x3a')][_0x9455('0x3b')]?_0x24462d[_0x9455('0x3a')]:_0x3fde21[_0x9455('0x36')];_0x24462d[_0x9455('0x3c')]=qs[_0x9455('0x3d')](_0x57d2bd[_0x9455('0x37')][_0x9455('0x3d')]);_0x24462d[_0x9455('0x3e')]=qs[_0x9455('0x38')](_[_0x9455('0x5a')](_0x57d2bd[_0x9455('0x37')],_0x3fde21[_0x9455('0x38')]));if(_0x57d2bd[_0x9455('0x37')][_0x9455('0x3f')]){_0x24462d[_0x9455('0x3e')]=_[_0x9455('0x40')](_0x24462d[_0x9455('0x3e')],{'$or':_[_0x9455('0x41')](_0x24462d[_0x9455('0x3a')],function(_0xe5257){var _0x822ec8={};_0x822ec8[_0xe5257]={'$like':'%'+_0x57d2bd[_0x9455('0x37')][_0x9455('0x3f')]+'%'};return _0x822ec8;})});}_0x24462d=_[_0x9455('0x40')]({},_0x24462d,_0x57d2bd[_0x9455('0x4b')]);return _0x458b76[_0x9455('0xa2')](_0x24462d);}})[_0x9455('0x28')](function(_0x373a97){if(_0x373a97){_0x314d0a=_0x373a97[_0x9455('0x3b')];if(!_0x57d2bd[_0x9455('0x37')][_0x9455('0xa4')](_0x9455('0x59'))){_0x24462d['limit']=qs[_0x9455('0x1f')](_0x57d2bd[_0x9455('0x37')]['limit']);_0x24462d[_0x9455('0x1d')]=qs[_0x9455('0x1d')](_0x57d2bd[_0x9455('0x37')][_0x9455('0x1d')]);}return _0x458b76[_0x9455('0xa2')](_0x24462d);}})[_0x9455('0x28')](function(_0x41d54e){if(_0x41d54e){return _0x41d54e?{'count':_0x314d0a,'rows':_0x41d54e}:null;}})['then'](respondWithResult(_0x43963f,null))[_0x9455('0x4d')](handleError(_0x43963f,null));};function handleQuery(_0x4c891a){logger['info'](_0x4c891a);return db[_0x9455('0x8a')][_0x9455('0x37')](_0x4c891a)[_0x9455('0x9d')](function(_0x1d0b02){csv_results[_0x9455('0x65')](_0x1d0b02);})[_0x9455('0x4d')](function(_0x29a681){logger[_0x9455('0x2e')](_0x29a681[_0x9455('0xa5')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 919423c..c9fddb3 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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0xdeabd7,_0x379111){_0xdeabd7=_0xdeabd7-0x0;var _0x160a3f=_0xe14b[_0xdeabd7];return _0x160a3f;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x181728,_0x471cc4){var _0x3525db=function(_0x59c05c){while(--_0x59c05c){_0x181728['push'](_0x181728['shift']());}};_0x3525db(++_0x471cc4);}(_0x814b,0x1a2));var _0xb814=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x814b[_0x17823f];return _0x51fc21;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 910323f..a4cad22 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 _0x6f0d=['./cmList.attributes','define','CmList','cm_lists','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3bcaa3,_0x4cd872){_0x3bcaa3=_0x3bcaa3-0x0;var _0x4d4d6d=_0x6f0d[_0x3bcaa3];return _0x4d4d6d;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x1233a2,_0x3f39b5){var _0x44e056=function(_0x30e79c){while(--_0x30e79c){_0x1233a2['push'](_0x1233a2['shift']());}};_0x44e056(++_0x3f39b5);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1bda3a,_0x382e0b){_0x1bda3a=_0x1bda3a-0x0;var _0x3d2c24=_0xa8a8[_0x1bda3a];return _0x3d2c24;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'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 87bd558..035d2f5 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 _0x32e2=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x544372,_0x102d0a){var _0x45bf94=function(_0x4ffbdc){while(--_0x4ffbdc){_0x544372['push'](_0x544372['shift']());}};_0x45bf94(++_0x102d0a);}(_0x32e2,0x1b0));var _0x232e=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x32e2[_0x16e0c8];return _0xe4b5af;};'use strict';var _=require(_0x232e('0x0'));var util=require(_0x232e('0x1'));var moment=require(_0x232e('0x2'));var BPromise=require('bluebird');var rs=require(_0x232e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x232e('0x4'))['db'];var utils=require(_0x232e('0x5'));var logger=require(_0x232e('0x6'))(_0x232e('0x7'));var config=require(_0x232e('0x8'));var jayson=require(_0x232e('0x9'));var client=jayson[_0x232e('0xa')][_0x232e('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x232e('0xc')],{'host':_0x232e('0xd'),'port':0x18eb});var socket=require(_0x232e('0xe'))(new Redis(config[_0x232e('0xc')]));require(_0x232e('0xf'))[_0x232e('0x10')](socket);function respondWithRpcPromise(_0x3a1c2f,_0x5e6161,_0x5c4116){return new BPromise(function(_0x6a9072,_0xad00c8){return client[_0x232e('0x11')](_0x3a1c2f,_0x5c4116)['then'](function(_0x2d3145){logger[_0x232e('0x12')](_0x232e('0x13'),_0x5e6161,'request\x20sent');logger[_0x232e('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x5e6161,_0x232e('0x15'),JSON[_0x232e('0x16')](_0x2d3145));if(_0x2d3145[_0x232e('0x17')]){if(_0x2d3145['error'][_0x232e('0x18')]===0x1f4){logger[_0x232e('0x17')](_0x232e('0x13'),_0x5e6161,_0x2d3145[_0x232e('0x17')]['message']);return _0xad00c8(_0x2d3145[_0x232e('0x17')][_0x232e('0x19')]);}logger[_0x232e('0x17')](_0x232e('0x13'),_0x5e6161,_0x2d3145[_0x232e('0x17')][_0x232e('0x19')]);return _0x6a9072(_0x2d3145[_0x232e('0x17')][_0x232e('0x19')]);}else{logger['info'](_0x232e('0x13'),_0x5e6161,_0x232e('0x15'));_0x6a9072(_0x2d3145[_0x232e('0x1a')][_0x232e('0x19')]);}})['catch'](function(_0x433bce){logger['error'](_0x232e('0x13'),_0x5e6161,_0x433bce);_0xad00c8(_0x433bce);});});} \ No newline at end of file +var _0x6957=['../../config/environment','redis','defaults','localhost','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x29bbd9,_0x1dfa51){var _0x31209f=function(_0x17156f){while(--_0x17156f){_0x29bbd9['push'](_0x29bbd9['shift']());}};_0x31209f(++_0x1dfa51);}(_0x6957,0x13d));var _0x7695=function(_0x3c3ec7,_0x1a4363){_0x3c3ec7=_0x3c3ec7-0x0;var _0x2c6b89=_0x6957[_0x3c3ec7];return _0x2c6b89;};'use strict';var _=require('lodash');var util=require(_0x7695('0x0'));var moment=require(_0x7695('0x1'));var BPromise=require(_0x7695('0x2'));var rs=require(_0x7695('0x3'));var fs=require('fs');var Redis=require(_0x7695('0x4'));var db=require(_0x7695('0x5'))['db'];var utils=require(_0x7695('0x6'));var logger=require('../../config/logger')(_0x7695('0x7'));var config=require(_0x7695('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7695('0x9')]=_[_0x7695('0xa')](config[_0x7695('0x9')],{'host':_0x7695('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7695('0x9')]));require(_0x7695('0xc'))['register'](socket);function respondWithRpcPromise(_0xbb66c,_0x3bee8e,_0x2843cf){return new BPromise(function(_0x5303d8,_0x54cf21){return client[_0x7695('0xd')](_0xbb66c,_0x2843cf)[_0x7695('0xe')](function(_0x156614){logger[_0x7695('0xf')](_0x7695('0x10'),_0x3bee8e,_0x7695('0x11'));logger[_0x7695('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x3bee8e,_0x7695('0x11'),JSON[_0x7695('0x13')](_0x156614));if(_0x156614['error']){if(_0x156614[_0x7695('0x14')][_0x7695('0x15')]===0x1f4){logger[_0x7695('0x14')](_0x7695('0x10'),_0x3bee8e,_0x156614[_0x7695('0x14')][_0x7695('0x16')]);return _0x54cf21(_0x156614[_0x7695('0x14')]['message']);}logger[_0x7695('0x14')](_0x7695('0x10'),_0x3bee8e,_0x156614[_0x7695('0x14')][_0x7695('0x16')]);return _0x5303d8(_0x156614[_0x7695('0x14')][_0x7695('0x16')]);}else{logger[_0x7695('0xf')](_0x7695('0x10'),_0x3bee8e,'request\x20sent');_0x5303d8(_0x156614[_0x7695('0x17')][_0x7695('0x16')]);}})[_0x7695('0x18')](function(_0x15e086){logger[_0x7695('0x14')](_0x7695('0x10'),_0x3bee8e,_0x15e086);_0x54cf21(_0x15e086);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4a1d996..0a41426 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 _0xd381=['update','emit','removeListener','register','./cmList.events','save','remove'];(function(_0x135511,_0x323278){var _0xa9b6c0=function(_0x19574f){while(--_0x19574f){_0x135511['push'](_0x135511['shift']());}};_0xa9b6c0(++_0x323278);}(_0xd381,0x193));var _0x1d38=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0xd381[_0x35d3a8];return _0x182378;};'use strict';var CmListEvents=require(_0x1d38('0x0'));var events=[_0x1d38('0x1'),_0x1d38('0x2'),_0x1d38('0x3')];function createListener(_0x3fb197,_0x48c3ac){return function(_0x24aa08){_0x48c3ac[_0x1d38('0x4')](_0x3fb197,_0x24aa08);};}function removeListener(_0x4af455,_0x22feb8){return function(){CmListEvents[_0x1d38('0x5')](_0x4af455,_0x22feb8);};}exports[_0x1d38('0x6')]=function(_0x2f3f2c){for(var _0x281ff4=0x0,_0x3ecf49=events['length'];_0x281ff4<_0x3ecf49;_0x281ff4++){var _0x122727=events[_0x281ff4];var _0x361794=createListener('cmList:'+_0x122727,_0x2f3f2c);CmListEvents['on'](_0x122727,_0x361794);}}; \ No newline at end of file +var _0xb9e7=['update','emit','removeListener','register','length','cmList:','./cmList.events','save','remove'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0xb9e7,0x1a4));var _0x7b9e=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0xb9e7[_0x3e0763];return _0x351ca2;};'use strict';var CmListEvents=require(_0x7b9e('0x0'));var events=[_0x7b9e('0x1'),_0x7b9e('0x2'),_0x7b9e('0x3')];function createListener(_0x5dbee4,_0xa394d2){return function(_0x36d2c3){_0xa394d2[_0x7b9e('0x4')](_0x5dbee4,_0x36d2c3);};}function removeListener(_0x2af15c,_0x5623a2){return function(){CmListEvents[_0x7b9e('0x5')](_0x2af15c,_0x5623a2);};}exports[_0x7b9e('0x6')]=function(_0x444751){for(var _0x3417ca=0x0,_0x28109a=events[_0x7b9e('0x7')];_0x3417ca<_0x28109a;_0x3417ca++){var _0x8534dc=events[_0x3417ca];var _0x23549c=createListener(_0x7b9e('0x8')+_0x8534dc,_0x444751);CmListEvents['on'](_0x8534dc,_0x23549c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9e85109..777b1ae 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 _0xb2b1=['update','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','getCustomFields','getAgents','create','post','/:id/fields','addCustomField','/:id/users','put','/:id'];(function(_0x396309,_0x4e2adf){var _0x4a0888=function(_0x22e748){while(--_0x22e748){_0x396309['push'](_0x396309['shift']());}};_0x4a0888(++_0x4e2adf);}(_0xb2b1,0x190));var _0x1b2b=function(_0x204911,_0x4d76d3){_0x204911=_0x204911-0x0;var _0x19c0eb=_0xb2b1[_0x204911];return _0x19c0eb;};'use strict';var multer=require(_0x1b2b('0x0'));var util=require(_0x1b2b('0x1'));var path=require(_0x1b2b('0x2'));var timeout=require(_0x1b2b('0x3'));var express=require(_0x1b2b('0x4'));var router=express[_0x1b2b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1b2b('0x6'));var interaction=require(_0x1b2b('0x7'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x1b2b('0x8')]('/',auth[_0x1b2b('0x9')](),controller[_0x1b2b('0xa')]);router[_0x1b2b('0x8')](_0x1b2b('0xb'),auth[_0x1b2b('0x9')](),controller[_0x1b2b('0xc')]);router[_0x1b2b('0x8')](_0x1b2b('0xd'),auth['isAuthenticated'](),controller[_0x1b2b('0xe')]);router[_0x1b2b('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1b2b('0x8')](_0x1b2b('0xf'),auth['isAuthenticated'](),controller[_0x1b2b('0x10')]);router[_0x1b2b('0x8')](_0x1b2b('0x11'),auth[_0x1b2b('0x9')](),controller['getContacts']);router[_0x1b2b('0x8')](_0x1b2b('0x12'),auth[_0x1b2b('0x9')](),controller[_0x1b2b('0x13')]);router[_0x1b2b('0x8')]('/:id/fields',auth[_0x1b2b('0x9')](),controller[_0x1b2b('0x14')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x1b2b('0x15')]);router['post']('/',auth[_0x1b2b('0x9')](),controller[_0x1b2b('0x16')]);router[_0x1b2b('0x17')](_0x1b2b('0xf'),auth[_0x1b2b('0x9')](),controller['addDisposition']);router[_0x1b2b('0x17')](_0x1b2b('0x11'),auth[_0x1b2b('0x9')](),controller['addContacts']);router[_0x1b2b('0x17')](_0x1b2b('0x18'),auth[_0x1b2b('0x9')](),controller[_0x1b2b('0x19')]);router[_0x1b2b('0x17')](_0x1b2b('0x1a'),auth[_0x1b2b('0x9')](),controller['addAgents']);router[_0x1b2b('0x1b')](_0x1b2b('0x1c'),auth[_0x1b2b('0x9')](),controller[_0x1b2b('0x1d')]);router['delete']('/:id',auth[_0x1b2b('0x9')](),controller[_0x1b2b('0x1e')]);router['delete'](_0x1b2b('0xf'),auth[_0x1b2b('0x9')](),controller[_0x1b2b('0x1f')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x1b2b('0x20')]);module['exports']=router; \ No newline at end of file +var _0x996b=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','/:id','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','/:id/contacts','addContacts','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer'];(function(_0x2c6736,_0x41de4d){var _0x9a471=function(_0x1b6549){while(--_0x1b6549){_0x2c6736['push'](_0x2c6736['shift']());}};_0x9a471(++_0x41de4d);}(_0x996b,0x9b));var _0xb996=function(_0x1bd8fa,_0x286ce2){_0x1bd8fa=_0x1bd8fa-0x0;var _0x517df8=_0x996b[_0x1bd8fa];return _0x517df8;};'use strict';var multer=require(_0xb996('0x0'));var util=require(_0xb996('0x1'));var path=require(_0xb996('0x2'));var timeout=require(_0xb996('0x3'));var express=require(_0xb996('0x4'));var router=express[_0xb996('0x5')]();var fs_extra=require(_0xb996('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb996('0x7'));var controller=require(_0xb996('0x8'));router[_0xb996('0x9')]('/',auth[_0xb996('0xa')](),controller[_0xb996('0xb')]);router[_0xb996('0x9')](_0xb996('0xc'),auth['isAuthenticated'](),controller[_0xb996('0xd')]);router[_0xb996('0x9')](_0xb996('0xe'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0xb996('0x9')](_0xb996('0xf'),auth[_0xb996('0xa')](),controller['show']);router['get'](_0xb996('0x10'),auth[_0xb996('0xa')](),controller[_0xb996('0x11')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0xb996('0x12')]);router[_0xb996('0x9')](_0xb996('0x13'),auth[_0xb996('0xa')](),controller[_0xb996('0x14')]);router[_0xb996('0x9')](_0xb996('0x15'),auth[_0xb996('0xa')](),controller[_0xb996('0x16')]);router[_0xb996('0x9')](_0xb996('0x17'),auth[_0xb996('0xa')](),controller[_0xb996('0x18')]);router['post']('/',auth[_0xb996('0xa')](),controller[_0xb996('0x19')]);router[_0xb996('0x1a')](_0xb996('0x10'),auth[_0xb996('0xa')](),controller[_0xb996('0x1b')]);router['post'](_0xb996('0x1c'),auth[_0xb996('0xa')](),controller[_0xb996('0x1d')]);router['post'](_0xb996('0x15'),auth['isAuthenticated'](),controller[_0xb996('0x1e')]);router[_0xb996('0x1a')](_0xb996('0x17'),auth[_0xb996('0xa')](),controller[_0xb996('0x1f')]);router[_0xb996('0x20')](_0xb996('0xf'),auth[_0xb996('0xa')](),controller[_0xb996('0x21')]);router['delete'](_0xb996('0xf'),auth[_0xb996('0xa')](),controller[_0xb996('0x22')]);router[_0xb996('0x23')](_0xb996('0x10'),auth[_0xb996('0xa')](),controller[_0xb996('0x24')]);router['delete'](_0xb996('0x17'),auth[_0xb996('0xa')](),controller[_0xb996('0x25')]);module[_0xb996('0x26')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 3c29fd3..d7378d8 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 _0x9c36=['VIRTUAL','getDataValue','STRING'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x9c36,0x1e0));var _0x69c3=function(_0x17b0f3,_0x1904bc){_0x17b0f3=_0x17b0f3-0x0;var _0x38ea34=_0x9c36[_0x17b0f3];return _0x38ea34;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x69c3('0x0')],'get':function(_0x59e8c5){return this[_0x69c3('0x1')]('field');}},'field':{'type':Sequelize[_0x69c3('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x69c3('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x69c3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfd57=['VIRTUAL','field','STRING','sequelize'];(function(_0x386c2b,_0x13efac){var _0xdeed24=function(_0x5cf2fa){while(--_0x5cf2fa){_0x386c2b['push'](_0x386c2b['shift']());}};_0xdeed24(++_0x13efac);}(_0xfd57,0x1ef));var _0x7fd5=function(_0x5d8d4c,_0x5810f5){_0x5d8d4c=_0x5d8d4c-0x0;var _0x2d8942=_0xfd57[_0x5d8d4c];return _0x2d8942;};'use strict';var Sequelize=require(_0x7fd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x7fd5('0x1')],'get':function(_0x49a777){return this['getDataValue'](_0x7fd5('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x7fd5('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x7fd5('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 77543d5..95b1e22 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x213b99,_0x38be9c){var _0x3169c0=function(_0x210dda){while(--_0x210dda){_0x213b99['push'](_0x213b99['shift']());}};_0x3169c0(++_0x38be9c);}(_0x7a54,0x106));var _0x47a5=function(_0x2cb8e6,_0x347a5a){_0x2cb8e6=_0x2cb8e6-0x0;var _0x4c9a04=_0x7a54[_0x2cb8e6];return _0x4c9a04;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3c0d8d,_0x1b08c9){var _0x1d0eca=function(_0x42d0d4){while(--_0x42d0d4){_0x3c0d8d['push'](_0x3c0d8d['shift']());}};_0x1d0eca(++_0x1b08c9);}(_0x7a54,0x106));var _0x47a5=function(_0x3e1bbc,_0x6df62e){_0x3e1bbc=_0x3e1bbc-0x0;var _0x1d75cd=_0x7a54[_0x3e1bbc];return _0x1d75cd;};'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 d983a75..0ff18d2 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 _0xe3f4=['define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe3f4,0x117));var _0x4e3f=function(_0x4ba19b,_0x5673e1){_0x4ba19b=_0x4ba19b-0x0;var _0x3253a7=_0xe3f4[_0x4ba19b];return _0x3253a7;};'use strict';var _=require(_0x4e3f('0x0'));var util=require(_0x4e3f('0x1'));var logger=require(_0x4e3f('0x2'))(_0x4e3f('0x3'));var moment=require(_0x4e3f('0x4'));var BPromise=require(_0x4e3f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e3f('0x6'));var rimraf=require('rimraf');var config=require(_0x4e3f('0x7'));var attributes=require('./condition.attributes');module[_0x4e3f('0x8')]=function(_0x2a9b13,_0x40231f){return _0x2a9b13[_0x4e3f('0x9')](_0x4e3f('0xa'),attributes,{'tableName':_0x4e3f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe663=['request-promise','path','rimraf','../../config/environment','./condition.attributes','define','Condition','lodash','util','api','moment','bluebird'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0xe663,0xf7));var _0x3e66=function(_0x315dcf,_0x5d5660){_0x315dcf=_0x315dcf-0x0;var _0x20b96e=_0xe663[_0x315dcf];return _0x20b96e;};'use strict';var _=require(_0x3e66('0x0'));var util=require(_0x3e66('0x1'));var logger=require('../../config/logger')(_0x3e66('0x2'));var moment=require(_0x3e66('0x3'));var BPromise=require(_0x3e66('0x4'));var rp=require(_0x3e66('0x5'));var fs=require('fs');var path=require(_0x3e66('0x6'));var rimraf=require(_0x3e66('0x7'));var config=require(_0x3e66('0x8'));var attributes=require(_0x3e66('0x9'));module['exports']=function(_0x1566d0,_0x16a610){return _0x1566d0[_0x3e66('0xa')](_0x3e66('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index f77a4f5..dd2c720 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 _0x3ca4=['../../config/logger','../../config/environment','jayson/promise','client','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2f0244,_0x5c752b){var _0x1699a1=function(_0x32d4f9){while(--_0x32d4f9){_0x2f0244['push'](_0x2f0244['shift']());}};_0x1699a1(++_0x5c752b);}(_0x3ca4,0x100));var _0x43ca=function(_0x53fac4,_0x261df7){_0x53fac4=_0x53fac4-0x0;var _0x1971ca=_0x3ca4[_0x53fac4];return _0x1971ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x43ca('0x0'));var BPromise=require(_0x43ca('0x1'));var rs=require(_0x43ca('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43ca('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x43ca('0x4'))('rpc');var config=require(_0x43ca('0x5'));var jayson=require(_0x43ca('0x6'));var client=jayson[_0x43ca('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39e9c6,_0x454bff,_0x343767){return new BPromise(function(_0x309095,_0x39bead){return client['request'](_0x39e9c6,_0x343767)[_0x43ca('0x8')](function(_0x4cc23b){logger['info'](_0x43ca('0x9'),_0x454bff,_0x43ca('0xa'));logger[_0x43ca('0xb')](_0x43ca('0xc'),_0x454bff,_0x43ca('0xa'),JSON[_0x43ca('0xd')](_0x4cc23b));if(_0x4cc23b[_0x43ca('0xe')]){if(_0x4cc23b['error'][_0x43ca('0xf')]===0x1f4){logger[_0x43ca('0xe')](_0x43ca('0x9'),_0x454bff,_0x4cc23b[_0x43ca('0xe')][_0x43ca('0x10')]);return _0x39bead(_0x4cc23b[_0x43ca('0xe')][_0x43ca('0x10')]);}logger[_0x43ca('0xe')](_0x43ca('0x9'),_0x454bff,_0x4cc23b[_0x43ca('0xe')][_0x43ca('0x10')]);return _0x309095(_0x4cc23b['error'][_0x43ca('0x10')]);}else{logger[_0x43ca('0x11')](_0x43ca('0x9'),_0x454bff,_0x43ca('0xa'));_0x309095(_0x4cc23b[_0x43ca('0x12')][_0x43ca('0x10')]);}})[_0x43ca('0x13')](function(_0x31ed64){logger[_0x43ca('0xe')](_0x43ca('0x9'),_0x454bff,_0x31ed64);_0x39bead(_0x31ed64);});});} \ No newline at end of file +var _0xcceb=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0xa11b3f,_0x42f243){var _0x26ed64=function(_0xe60a72){while(--_0xe60a72){_0xa11b3f['push'](_0xa11b3f['shift']());}};_0x26ed64(++_0x42f243);}(_0xcceb,0xe8));var _0xbcce=function(_0x171028,_0x7ee648){_0x171028=_0x171028-0x0;var _0x5c4c7b=_0xcceb[_0x171028];return _0x5c4c7b;};'use strict';var _=require(_0xbcce('0x0'));var util=require(_0xbcce('0x1'));var moment=require(_0xbcce('0x2'));var BPromise=require(_0xbcce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcce('0x4'));var db=require(_0xbcce('0x5'))['db'];var utils=require(_0xbcce('0x6'));var logger=require(_0xbcce('0x7'))(_0xbcce('0x8'));var config=require(_0xbcce('0x9'));var jayson=require(_0xbcce('0xa'));var client=jayson[_0xbcce('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a6e2e,_0x3e94b8,_0x13ceb3){return new BPromise(function(_0x20487c,_0x109e4b){return client[_0xbcce('0xc')](_0x4a6e2e,_0x13ceb3)[_0xbcce('0xd')](function(_0x269f02){logger['info'](_0xbcce('0xe'),_0x3e94b8,_0xbcce('0xf'));logger[_0xbcce('0x10')](_0xbcce('0x11'),_0x3e94b8,_0xbcce('0xf'),JSON[_0xbcce('0x12')](_0x269f02));if(_0x269f02[_0xbcce('0x13')]){if(_0x269f02[_0xbcce('0x13')][_0xbcce('0x14')]===0x1f4){logger[_0xbcce('0x13')](_0xbcce('0xe'),_0x3e94b8,_0x269f02[_0xbcce('0x13')][_0xbcce('0x15')]);return _0x109e4b(_0x269f02[_0xbcce('0x13')][_0xbcce('0x15')]);}logger['error'](_0xbcce('0xe'),_0x3e94b8,_0x269f02[_0xbcce('0x13')][_0xbcce('0x15')]);return _0x20487c(_0x269f02[_0xbcce('0x13')][_0xbcce('0x15')]);}else{logger[_0xbcce('0x16')](_0xbcce('0xe'),_0x3e94b8,_0xbcce('0xf'));_0x20487c(_0x269f02[_0xbcce('0x17')][_0xbcce('0x15')]);}})[_0xbcce('0x18')](function(_0x418e14){logger['error'](_0xbcce('0xe'),_0x3e94b8,_0x418e14);_0x109e4b(_0x418e14);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 51c1258..2017589 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 _0x6068=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','/:id'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x6068,0x81));var _0x8606=function(_0x1a72d3,_0x5aeab4){_0x1a72d3=_0x1a72d3-0x0;var _0x59b506=_0x6068[_0x1a72d3];return _0x59b506;};'use strict';var multer=require(_0x8606('0x0'));var util=require(_0x8606('0x1'));var path=require(_0x8606('0x2'));var timeout=require(_0x8606('0x3'));var express=require(_0x8606('0x4'));var router=express[_0x8606('0x5')]();var fs_extra=require(_0x8606('0x6'));var auth=require(_0x8606('0x7'));var interaction=require(_0x8606('0x8'));var config=require(_0x8606('0x9'));var controller=require(_0x8606('0xa'));router[_0x8606('0xb')]('/:id',auth[_0x8606('0xc')](),controller[_0x8606('0xd')]);router['delete'](_0x8606('0xe'),auth[_0x8606('0xc')](),controller[_0x8606('0xf')]);module['exports']=router; \ No newline at end of file +var _0x299d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x299d,0x18a));var _0xd299=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x299d[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0xd299('0x0'));var util=require(_0xd299('0x1'));var path=require(_0xd299('0x2'));var timeout=require(_0xd299('0x3'));var express=require(_0xd299('0x4'));var router=express[_0xd299('0x5')]();var fs_extra=require(_0xd299('0x6'));var auth=require(_0xd299('0x7'));var interaction=require(_0xd299('0x8'));var config=require(_0xd299('0x9'));var controller=require(_0xd299('0xa'));router['put'](_0xd299('0xb'),auth[_0xd299('0xc')](),controller['update']);router[_0xd299('0xd')](_0xd299('0xb'),auth['isAuthenticated'](),controller[_0xd299('0xe')]);module[_0xd299('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 5b642e8..abd77eb 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 _0x1265=['STRING','sequelize','exports','name','INTEGER'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x1265,0x182));var _0x5126=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x1265[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x5126('0x0'));module[_0x5126('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5126('0x2')},'OrderBy':{'type':Sequelize[_0x5126('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x5126('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x67c6=['STRING','name','INTEGER','sequelize'];(function(_0x3f9d6b,_0x15d32d){var _0x11a34d=function(_0xbee0ab){while(--_0xbee0ab){_0x3f9d6b['push'](_0x3f9d6b['shift']());}};_0x11a34d(++_0x15d32d);}(_0x67c6,0x147));var _0x667c=function(_0x4b2d2c,_0xa8f929){_0x4b2d2c=_0x4b2d2c-0x0;var _0x486eb5=_0x67c6[_0x4b2d2c];return _0x486eb5;};'use strict';var Sequelize=require(_0x667c('0x0'));module['exports']={'name':{'type':Sequelize[_0x667c('0x1')],'allowNull':![],'unique':_0x667c('0x2')},'OrderBy':{'type':Sequelize[_0x667c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x667c('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 59db4db..1d2c82b 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 _0x4b17=['sort','pick','filters','filter','where','merge','options','ContactItemType','include','findAll','rows','show','length','includeAll','find','catch','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','params','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','query'];(function(_0x23ca3a,_0xe44c43){var _0x5c1aab=function(_0x29bcdd){while(--_0x29bcdd){_0x23ca3a['push'](_0x23ca3a['shift']());}};_0x5c1aab(++_0xe44c43);}(_0x4b17,0x10f));var _0x74b1=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x4b17[_0x15ca1a];return _0x507626;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];function respondWithStatusCode(_0x5cfe85,_0x5f2865){_0x5f2865=_0x5f2865||0xcc;return function(_0x239d04){if(_0x239d04){return _0x5cfe85[_0x74b1('0x17')](_0x5f2865);}return _0x5cfe85['status'](_0x5f2865)['end']();};}function respondWithResult(_0x500ce2,_0x86390){_0x86390=_0x86390||0xc8;return function(_0x5c12eb){if(_0x5c12eb){return _0x500ce2['status'](_0x86390)[_0x74b1('0x18')](_0x5c12eb);}};}function respondWithFilteredResult(_0x12a2c0,_0x3779c5){return function(_0x420662){if(_0x420662){var _0x16b147=typeof _0x3779c5[_0x74b1('0x19')]==='undefined'&&typeof _0x3779c5[_0x74b1('0x1a')]===_0x74b1('0x1b');var _0x1a0851=_0x420662[_0x74b1('0x1c')];var _0xde2736=_0x16b147?0x0:_0x3779c5[_0x74b1('0x19')];var _0x1ab838=_0x16b147?_0x420662['count']:_0x3779c5[_0x74b1('0x19')]+_0x3779c5[_0x74b1('0x1a')];var _0x524ece;if(_0x1ab838>=_0x1a0851){_0x1ab838=_0x1a0851;_0x524ece=0xc8;}else{_0x524ece=0xce;}_0x12a2c0[_0x74b1('0x1d')](_0x524ece);return _0x12a2c0[_0x74b1('0x1e')](_0x74b1('0x1f'),_0xde2736+'-'+_0x1ab838+'/'+_0x1a0851)[_0x74b1('0x18')](_0x420662);}return null;};}function patchUpdates(_0x13bb44){return function(_0x33fee9){try{jsonpatch[_0x74b1('0x20')](_0x33fee9,_0x13bb44,!![]);}catch(_0xaac5f7){return BPromise['reject'](_0xaac5f7);}return _0x33fee9[_0x74b1('0x21')]();};}function saveUpdates(_0x4f1ec9,_0x5da0f7){return function(_0x481bf2){if(_0x481bf2){return _0x481bf2[_0x74b1('0x22')](_0x4f1ec9)[_0x74b1('0x23')](function(_0x405a22){return _0x405a22;});}return null;};}function removeEntity(_0x44bf7e,_0x563781){return function(_0x4ee88b){if(_0x4ee88b){return _0x4ee88b[_0x74b1('0x24')]()['then'](function(){var _0x3a7ef9=_0x4ee88b[_0x74b1('0x25')]({'plain':!![]});var _0xb5af0=_0x74b1('0x26');return db[_0x74b1('0x27')][_0x74b1('0x24')]({'where':{'type':_0xb5af0,'resourceId':_0x3a7ef9['id']}})[_0x74b1('0x23')](function(){return _0x4ee88b;});})[_0x74b1('0x23')](function(){_0x44bf7e['status'](0xcc)[_0x74b1('0x28')]();});}};}function handleEntityNotFound(_0x42b69d,_0x4099af){return function(_0x5c32d2){if(!_0x5c32d2){_0x42b69d[_0x74b1('0x17')](0x194);}return _0x5c32d2;};}function handleError(_0x351392,_0x94b1f8){_0x94b1f8=_0x94b1f8||0x1f4;return function(_0x1b011a){logger[_0x74b1('0x29')](_0x1b011a[_0x74b1('0x2a')]);if(_0x1b011a[_0x74b1('0x2b')]){delete _0x1b011a[_0x74b1('0x2b')];}_0x351392['status'](_0x94b1f8)[_0x74b1('0x2c')](_0x1b011a);};}exports[_0x74b1('0x2d')]=function(_0x51ce6d,_0x543b5){var _0x45404f={},_0x1ac433={},_0x5f4d1b={'count':0x0,'rows':[]};var _0x113300=_[_0x74b1('0x2e')](db['ContactItemType'][_0x74b1('0x2f')],function(_0x33ec7c){return{'name':_0x33ec7c[_0x74b1('0x30')],'type':_0x33ec7c[_0x74b1('0x31')][_0x74b1('0x32')]};});_0x1ac433[_0x74b1('0x33')]=_[_0x74b1('0x2e')](_0x113300,_0x74b1('0x2b'));_0x1ac433['query']=_[_0x74b1('0x34')](_0x51ce6d['query']);_0x1ac433['filters']=_[_0x74b1('0x35')](_0x1ac433['model'],_0x1ac433['query']);_0x45404f[_0x74b1('0x36')]=_[_0x74b1('0x35')](_0x1ac433[_0x74b1('0x33')],qs[_0x74b1('0x37')](_0x51ce6d[_0x74b1('0x38')][_0x74b1('0x37')]));_0x45404f[_0x74b1('0x36')]=_0x45404f[_0x74b1('0x36')]['length']?_0x45404f['attributes']:_0x1ac433['model'];if(!_0x51ce6d[_0x74b1('0x38')]['hasOwnProperty']('nolimit')){_0x45404f[_0x74b1('0x1a')]=qs[_0x74b1('0x1a')](_0x51ce6d[_0x74b1('0x38')]['limit']);_0x45404f[_0x74b1('0x19')]=qs['offset'](_0x51ce6d[_0x74b1('0x38')][_0x74b1('0x19')]);}_0x45404f['order']=qs['sort'](_0x51ce6d[_0x74b1('0x38')][_0x74b1('0x39')]);_0x45404f['where']=qs['filters'](_[_0x74b1('0x3a')](_0x51ce6d['query'],_0x1ac433[_0x74b1('0x3b')]),_0x113300);if(_0x51ce6d[_0x74b1('0x38')][_0x74b1('0x3c')]){_0x45404f[_0x74b1('0x3d')]=_[_0x74b1('0x3e')](_0x45404f['where'],{'$or':_[_0x74b1('0x2e')](_0x113300,function(_0x5a981b){if(_0x5a981b[_0x74b1('0x31')]!=='VIRTUAL'){var _0x23cac2={};_0x23cac2[_0x5a981b['name']]={'$like':'%'+_0x51ce6d['query'][_0x74b1('0x3c')]+'%'};return _0x23cac2;}})});}_0x45404f=_[_0x74b1('0x3e')]({},_0x45404f,_0x51ce6d[_0x74b1('0x3f')]);var _0x49f7da={'where':_0x45404f[_0x74b1('0x3d')]};return db[_0x74b1('0x40')][_0x74b1('0x1c')](_0x49f7da)['then'](function(_0xfecdc){_0x5f4d1b[_0x74b1('0x1c')]=_0xfecdc;if(_0x51ce6d['query']['includeAll']){_0x45404f[_0x74b1('0x41')]=[{'all':!![]}];}return db[_0x74b1('0x40')][_0x74b1('0x42')](_0x45404f);})[_0x74b1('0x23')](function(_0x1d9f5b){_0x5f4d1b[_0x74b1('0x43')]=_0x1d9f5b;return _0x5f4d1b;})[_0x74b1('0x23')](respondWithFilteredResult(_0x543b5,_0x45404f))['catch'](handleError(_0x543b5,null));};exports[_0x74b1('0x44')]=function(_0x118623,_0x456c6e){var _0x452fa0={'raw':!![],'where':{'id':_0x118623['params']['id']}},_0x17a44f={};_0x17a44f[_0x74b1('0x33')]=_[_0x74b1('0x34')](db['ContactItemType']['rawAttributes']);_0x17a44f[_0x74b1('0x38')]=_[_0x74b1('0x34')](_0x118623['query']);_0x17a44f[_0x74b1('0x3b')]=_[_0x74b1('0x35')](_0x17a44f[_0x74b1('0x33')],_0x17a44f[_0x74b1('0x38')]);_0x452fa0[_0x74b1('0x36')]=_[_0x74b1('0x35')](_0x17a44f[_0x74b1('0x33')],qs['fields'](_0x118623['query']['fields']));_0x452fa0[_0x74b1('0x36')]=_0x452fa0[_0x74b1('0x36')][_0x74b1('0x45')]?_0x452fa0[_0x74b1('0x36')]:_0x17a44f[_0x74b1('0x33')];if(_0x118623['query'][_0x74b1('0x46')]){_0x452fa0[_0x74b1('0x41')]=[{'all':!![]}];}_0x452fa0=_[_0x74b1('0x3e')]({},_0x452fa0,_0x118623[_0x74b1('0x3f')]);return db[_0x74b1('0x40')][_0x74b1('0x47')](_0x452fa0)[_0x74b1('0x23')](handleEntityNotFound(_0x456c6e,null))[_0x74b1('0x23')](respondWithResult(_0x456c6e,null))[_0x74b1('0x48')](handleError(_0x456c6e,null));};exports[_0x74b1('0x49')]=function(_0x186516,_0x3038f9){return db['ContactItemType'][_0x74b1('0x49')](_0x186516[_0x74b1('0x4a')],{})['then'](function(_0xf3735e){var _0x4923d2=_0x186516[_0x74b1('0x4b')][_0x74b1('0x25')]({'plain':!![]});if(!_0x4923d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4923d2[_0x74b1('0x4c')]===_0x74b1('0x4b')){var _0x326b98=_0xf3735e['get']({'plain':!![]});var _0x497006=_0x74b1('0x26');return db[_0x74b1('0x4d')][_0x74b1('0x47')]({'where':{'name':_0x497006,'userProfileId':_0x4923d2[_0x74b1('0x4e')]},'raw':!![]})['then'](function(_0x1e7507){if(_0x1e7507&&_0x1e7507['autoAssociation']===0x0){return db[_0x74b1('0x27')][_0x74b1('0x49')]({'name':_0x326b98['name'],'resourceId':_0x326b98['id'],'type':_0x1e7507[_0x74b1('0x2b')],'sectionId':_0x1e7507['id']},{})[_0x74b1('0x23')](function(){return _0xf3735e;});}else{return _0xf3735e;}})[_0x74b1('0x48')](function(_0x54a221){logger[_0x74b1('0x29')](_0x74b1('0x4f'),_0x54a221);throw _0x54a221;});}return _0xf3735e;})['then'](respondWithResult(_0x3038f9,0xc9))[_0x74b1('0x48')](handleError(_0x3038f9,null));};exports['update']=function(_0x4ba250,_0x18cd64){if(_0x4ba250[_0x74b1('0x4a')]['id']){delete _0x4ba250[_0x74b1('0x4a')]['id'];}return db[_0x74b1('0x40')][_0x74b1('0x47')]({'where':{'id':_0x4ba250['params']['id']}})[_0x74b1('0x23')](handleEntityNotFound(_0x18cd64,null))[_0x74b1('0x23')](saveUpdates(_0x4ba250['body'],null))[_0x74b1('0x23')](respondWithResult(_0x18cd64,null))[_0x74b1('0x48')](handleError(_0x18cd64,null));};exports[_0x74b1('0x24')]=function(_0x5634d1,_0x2fac5d){return db[_0x74b1('0x40')][_0x74b1('0x47')]({'where':{'id':_0x5634d1['params']['id']}})[_0x74b1('0x23')](handleEntityNotFound(_0x2fac5d,null))[_0x74b1('0x23')](db[_0x74b1('0x50')][_0x74b1('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5634d1[_0x74b1('0x51')]['id']}}))[_0x74b1('0x23')](removeEntity(_0x2fac5d,null))['catch'](handleError(_0x2fac5d,null));}; \ No newline at end of file +var _0x7708=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','stack','send','index','map','ContactItemType','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','show','params','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','fast-json-patch'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x7708,0x188));var _0x8770=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x7708[_0x5b3950];return _0x41e436;};'use strict';var emlformat=require(_0x8770('0x0'));var rimraf=require(_0x8770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8770('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8770('0x3'));var path=require(_0x8770('0x4'));var sox=require('sox');var csv=require(_0x8770('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8770('0x6'));var _=require(_0x8770('0x7'));var squel=require(_0x8770('0x8'));var crypto=require(_0x8770('0x9'));var jsforce=require(_0x8770('0xa'));var deskjs=require(_0x8770('0xb'));var toCsv=require(_0x8770('0x5'));var querystring=require('querystring');var Papa=require(_0x8770('0xc'));var Redis=require(_0x8770('0xd'));var authService=require(_0x8770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8770('0xf'));var hardwareService=require(_0x8770('0x10'));var logger=require(_0x8770('0x11'))(_0x8770('0x12'));var utils=require('../../config/utils');var config=require(_0x8770('0x13'));var licenseUtil=require(_0x8770('0x14'));var db=require(_0x8770('0x15'))['db'];function respondWithStatusCode(_0x51efbc,_0xb52d60){_0xb52d60=_0xb52d60||0xcc;return function(_0x455a65){if(_0x455a65){return _0x51efbc[_0x8770('0x16')](_0xb52d60);}return _0x51efbc[_0x8770('0x17')](_0xb52d60)[_0x8770('0x18')]();};}function respondWithResult(_0x12a06f,_0x1ce41d){_0x1ce41d=_0x1ce41d||0xc8;return function(_0x12439f){if(_0x12439f){return _0x12a06f['status'](_0x1ce41d)[_0x8770('0x19')](_0x12439f);}};}function respondWithFilteredResult(_0x106a20,_0x5dd4e7){return function(_0x2f7918){if(_0x2f7918){var _0x52254f=typeof _0x5dd4e7[_0x8770('0x1a')]==='undefined'&&typeof _0x5dd4e7['limit']==='undefined';var _0x155e83=_0x2f7918[_0x8770('0x1b')];var _0x17b634=_0x52254f?0x0:_0x5dd4e7[_0x8770('0x1a')];var _0x4b0691=_0x52254f?_0x2f7918['count']:_0x5dd4e7[_0x8770('0x1a')]+_0x5dd4e7[_0x8770('0x1c')];var _0x26cbcd;if(_0x4b0691>=_0x155e83){_0x4b0691=_0x155e83;_0x26cbcd=0xc8;}else{_0x26cbcd=0xce;}_0x106a20[_0x8770('0x17')](_0x26cbcd);return _0x106a20[_0x8770('0x1d')]('Content-Range',_0x17b634+'-'+_0x4b0691+'/'+_0x155e83)[_0x8770('0x19')](_0x2f7918);}return null;};}function patchUpdates(_0x1234dd){return function(_0x384b1e){try{jsonpatch[_0x8770('0x1e')](_0x384b1e,_0x1234dd,!![]);}catch(_0x582048){return BPromise['reject'](_0x582048);}return _0x384b1e[_0x8770('0x1f')]();};}function saveUpdates(_0x348e2f,_0x443716){return function(_0x2918a7){if(_0x2918a7){return _0x2918a7[_0x8770('0x20')](_0x348e2f)[_0x8770('0x21')](function(_0x5819dc){return _0x5819dc;});}return null;};}function removeEntity(_0x468fc0,_0x23ad66){return function(_0x4274dd){if(_0x4274dd){return _0x4274dd[_0x8770('0x22')]()['then'](function(){var _0x460474=_0x4274dd['get']({'plain':!![]});var _0x7b4755=_0x8770('0x23');return db[_0x8770('0x24')][_0x8770('0x22')]({'where':{'type':_0x7b4755,'resourceId':_0x460474['id']}})[_0x8770('0x21')](function(){return _0x4274dd;});})[_0x8770('0x21')](function(){_0x468fc0[_0x8770('0x17')](0xcc)[_0x8770('0x18')]();});}};}function handleEntityNotFound(_0xb3f4aa,_0xa480){return function(_0x5f4973){if(!_0x5f4973){_0xb3f4aa[_0x8770('0x16')](0x194);}return _0x5f4973;};}function handleError(_0x199b96,_0x1df627){_0x1df627=_0x1df627||0x1f4;return function(_0x5c7bd){logger[_0x8770('0x25')](_0x5c7bd[_0x8770('0x26')]);if(_0x5c7bd['name']){delete _0x5c7bd['name'];}_0x199b96[_0x8770('0x17')](_0x1df627)[_0x8770('0x27')](_0x5c7bd);};}exports[_0x8770('0x28')]=function(_0x365080,_0x23f4b0){var _0x4bc072={},_0x5282dd={},_0x45fff4={'count':0x0,'rows':[]};var _0x144c24=_[_0x8770('0x29')](db[_0x8770('0x2a')]['rawAttributes'],function(_0x2f4e44){return{'name':_0x2f4e44['fieldName'],'type':_0x2f4e44['type'][_0x8770('0x2b')]};});_0x5282dd['model']=_[_0x8770('0x29')](_0x144c24,_0x8770('0x2c'));_0x5282dd[_0x8770('0x2d')]=_[_0x8770('0x2e')](_0x365080[_0x8770('0x2d')]);_0x5282dd[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],_0x5282dd[_0x8770('0x2d')]);_0x4bc072['attributes']=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],qs[_0x8770('0x32')](_0x365080['query']['fields']));_0x4bc072[_0x8770('0x33')]=_0x4bc072[_0x8770('0x33')][_0x8770('0x34')]?_0x4bc072['attributes']:_0x5282dd[_0x8770('0x31')];if(!_0x365080['query'][_0x8770('0x35')](_0x8770('0x36'))){_0x4bc072[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x365080[_0x8770('0x2d')][_0x8770('0x1c')]);_0x4bc072[_0x8770('0x1a')]=qs[_0x8770('0x1a')](_0x365080[_0x8770('0x2d')][_0x8770('0x1a')]);}_0x4bc072['order']=qs[_0x8770('0x37')](_0x365080[_0x8770('0x2d')][_0x8770('0x37')]);_0x4bc072['where']=qs[_0x8770('0x2f')](_[_0x8770('0x38')](_0x365080[_0x8770('0x2d')],_0x5282dd[_0x8770('0x2f')]),_0x144c24);if(_0x365080[_0x8770('0x2d')][_0x8770('0x39')]){_0x4bc072['where']=_[_0x8770('0x3a')](_0x4bc072['where'],{'$or':_[_0x8770('0x29')](_0x144c24,function(_0x57f52e){if(_0x57f52e[_0x8770('0x3b')]!==_0x8770('0x3c')){var _0x306142={};_0x306142[_0x57f52e['name']]={'$like':'%'+_0x365080[_0x8770('0x2d')][_0x8770('0x39')]+'%'};return _0x306142;}})});}_0x4bc072=_[_0x8770('0x3a')]({},_0x4bc072,_0x365080[_0x8770('0x3d')]);var _0x408e86={'where':_0x4bc072[_0x8770('0x3e')]};return db['ContactItemType'][_0x8770('0x1b')](_0x408e86)['then'](function(_0x4bcfc7){_0x45fff4[_0x8770('0x1b')]=_0x4bcfc7;if(_0x365080[_0x8770('0x2d')][_0x8770('0x3f')]){_0x4bc072[_0x8770('0x40')]=[{'all':!![]}];}return db[_0x8770('0x2a')]['findAll'](_0x4bc072);})[_0x8770('0x21')](function(_0x26ae1b){_0x45fff4['rows']=_0x26ae1b;return _0x45fff4;})[_0x8770('0x21')](respondWithFilteredResult(_0x23f4b0,_0x4bc072))['catch'](handleError(_0x23f4b0,null));};exports[_0x8770('0x41')]=function(_0x6bfa55,_0xc29c65){var _0x39c0d3={'raw':!![],'where':{'id':_0x6bfa55[_0x8770('0x42')]['id']}},_0x29dae5={};_0x29dae5[_0x8770('0x31')]=_[_0x8770('0x2e')](db[_0x8770('0x2a')][_0x8770('0x43')]);_0x29dae5[_0x8770('0x2d')]=_['keys'](_0x6bfa55[_0x8770('0x2d')]);_0x29dae5[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x29dae5[_0x8770('0x31')],_0x29dae5[_0x8770('0x2d')]);_0x39c0d3[_0x8770('0x33')]=_['intersection'](_0x29dae5[_0x8770('0x31')],qs[_0x8770('0x32')](_0x6bfa55[_0x8770('0x2d')][_0x8770('0x32')]));_0x39c0d3[_0x8770('0x33')]=_0x39c0d3[_0x8770('0x33')][_0x8770('0x34')]?_0x39c0d3[_0x8770('0x33')]:_0x29dae5['model'];if(_0x6bfa55[_0x8770('0x2d')][_0x8770('0x3f')]){_0x39c0d3[_0x8770('0x40')]=[{'all':!![]}];}_0x39c0d3=_[_0x8770('0x3a')]({},_0x39c0d3,_0x6bfa55[_0x8770('0x3d')]);return db['ContactItemType']['find'](_0x39c0d3)[_0x8770('0x21')](handleEntityNotFound(_0xc29c65,null))['then'](respondWithResult(_0xc29c65,null))[_0x8770('0x44')](handleError(_0xc29c65,null));};exports['create']=function(_0x4f9e0b,_0x3805d8){return db[_0x8770('0x2a')][_0x8770('0x45')](_0x4f9e0b[_0x8770('0x46')],{})['then'](function(_0x136cc1){var _0x48dea0=_0x4f9e0b['user']['get']({'plain':!![]});if(!_0x48dea0)throw new Error(_0x8770('0x47'));if(_0x48dea0[_0x8770('0x48')]===_0x8770('0x49')){var _0x4f5cb8=_0x136cc1[_0x8770('0x4a')]({'plain':!![]});var _0x5b6638=_0x8770('0x23');return db[_0x8770('0x4b')][_0x8770('0x4c')]({'where':{'name':_0x5b6638,'userProfileId':_0x48dea0['userProfileId']},'raw':!![]})[_0x8770('0x21')](function(_0x5de11e){if(_0x5de11e&&_0x5de11e['autoAssociation']===0x0){return db['UserProfileResource'][_0x8770('0x45')]({'name':_0x4f5cb8[_0x8770('0x2c')],'resourceId':_0x4f5cb8['id'],'type':_0x5de11e[_0x8770('0x2c')],'sectionId':_0x5de11e['id']},{})[_0x8770('0x21')](function(){return _0x136cc1;});}else{return _0x136cc1;}})[_0x8770('0x44')](function(_0x1df5cd){logger['error'](_0x8770('0x4d'),_0x1df5cd);throw _0x1df5cd;});}return _0x136cc1;})['then'](respondWithResult(_0x3805d8,0xc9))[_0x8770('0x44')](handleError(_0x3805d8,null));};exports[_0x8770('0x20')]=function(_0x475e9d,_0x3e4f77){if(_0x475e9d['body']['id']){delete _0x475e9d[_0x8770('0x46')]['id'];}return db[_0x8770('0x2a')]['find']({'where':{'id':_0x475e9d['params']['id']}})['then'](handleEntityNotFound(_0x3e4f77,null))['then'](saveUpdates(_0x475e9d[_0x8770('0x46')],null))[_0x8770('0x21')](respondWithResult(_0x3e4f77,null))['catch'](handleError(_0x3e4f77,null));};exports[_0x8770('0x22')]=function(_0x38b68f,_0x435c23){return db[_0x8770('0x2a')][_0x8770('0x4c')]({'where':{'id':_0x38b68f[_0x8770('0x42')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x435c23,null))[_0x8770('0x21')](db[_0x8770('0x4e')][_0x8770('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x38b68f[_0x8770('0x42')]['id']}}))['then'](removeEntity(_0x435c23,null))[_0x8770('0x44')](handleError(_0x435c23,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index bfca2a0..91baaee 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 _0xfd2e=['path','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','util','moment','request-promise'];(function(_0x4b8338,_0xd13dd1){var _0x5381cc=function(_0x26de0a){while(--_0x26de0a){_0x4b8338['push'](_0x4b8338['shift']());}};_0x5381cc(++_0xd13dd1);}(_0xfd2e,0xe3));var _0xefd2=function(_0x11e4f2,_0x128f5b){_0x11e4f2=_0x11e4f2-0x0;var _0x362eff=_0xfd2e[_0x11e4f2];return _0x362eff;};'use strict';var _=require(_0xefd2('0x0'));var util=require(_0xefd2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xefd2('0x2'));var BPromise=require('bluebird');var rp=require(_0xefd2('0x3'));var fs=require('fs');var path=require(_0xefd2('0x4'));var rimraf=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var attributes=require(_0xefd2('0x7'));module[_0xefd2('0x8')]=function(_0x5b428b,_0x4fa157){return _0x5b428b['define'](_0xefd2('0x9'),attributes,{'tableName':_0xefd2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1377=['api','moment','bluebird','request-promise','path','./contactItemType.attributes','exports','define','lodash','../../config/logger'];(function(_0xafa8d9,_0x4aa4fd){var _0x2567ed=function(_0x3c1104){while(--_0x3c1104){_0xafa8d9['push'](_0xafa8d9['shift']());}};_0x2567ed(++_0x4aa4fd);}(_0x1377,0x102));var _0x7137=function(_0x3ae751,_0xd90911){_0x3ae751=_0x3ae751-0x0;var _0x4a005c=_0x1377[_0x3ae751];return _0x4a005c;};'use strict';var _=require(_0x7137('0x0'));var util=require('util');var logger=require(_0x7137('0x1'))(_0x7137('0x2'));var moment=require(_0x7137('0x3'));var BPromise=require(_0x7137('0x4'));var rp=require(_0x7137('0x5'));var fs=require('fs');var path=require(_0x7137('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7137('0x7'));module[_0x7137('0x8')]=function(_0x3a204f,_0xd82f1f){return _0x3a204f[_0x7137('0x9')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index c1d87b6..6f6b507 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 _0x1a67=['client','http','then','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x8eaa3,_0x1f6af2){var _0x30138c=function(_0x42b717){while(--_0x42b717){_0x8eaa3['push'](_0x8eaa3['shift']());}};_0x30138c(++_0x1f6af2);}(_0x1a67,0x1c5));var _0x71a6=function(_0x5453be,_0x469909){_0x5453be=_0x5453be-0x0;var _0x2c8372=_0x1a67[_0x5453be];return _0x2c8372;};'use strict';var _=require(_0x71a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x71a6('0x1'));var rs=require(_0x71a6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71a6('0x3'))['db'];var utils=require(_0x71a6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x71a6('0x5'));var jayson=require(_0x71a6('0x6'));var client=jayson[_0x71a6('0x7')][_0x71a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b0639,_0x19a03d,_0x236196){return new BPromise(function(_0x2da358,_0x477db7){return client['request'](_0x1b0639,_0x236196)[_0x71a6('0x9')](function(_0x310f92){logger['info']('ContactItemType,\x20%s,\x20%s',_0x19a03d,_0x71a6('0xa'));logger['debug'](_0x71a6('0xb'),_0x19a03d,_0x71a6('0xa'),JSON[_0x71a6('0xc')](_0x310f92));if(_0x310f92[_0x71a6('0xd')]){if(_0x310f92[_0x71a6('0xd')][_0x71a6('0xe')]===0x1f4){logger[_0x71a6('0xd')](_0x71a6('0xf'),_0x19a03d,_0x310f92[_0x71a6('0xd')][_0x71a6('0x10')]);return _0x477db7(_0x310f92[_0x71a6('0xd')][_0x71a6('0x10')]);}logger[_0x71a6('0xd')]('ContactItemType,\x20%s,\x20%s',_0x19a03d,_0x310f92[_0x71a6('0xd')]['message']);return _0x2da358(_0x310f92[_0x71a6('0xd')][_0x71a6('0x10')]);}else{logger[_0x71a6('0x11')](_0x71a6('0xf'),_0x19a03d,_0x71a6('0xa'));_0x2da358(_0x310f92[_0x71a6('0x12')][_0x71a6('0x10')]);}})[_0x71a6('0x13')](function(_0xc8ed30){logger['error'](_0x71a6('0xf'),_0x19a03d,_0xc8ed30);_0x477db7(_0xc8ed30);});});} \ No newline at end of file +var _0x51ed=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3274a2,_0x41f0da){var _0x24f4bd=function(_0x3370b8){while(--_0x3370b8){_0x3274a2['push'](_0x3274a2['shift']());}};_0x24f4bd(++_0x41f0da);}(_0x51ed,0x1a3));var _0xd51e=function(_0x52b73c,_0x26f780){_0x52b73c=_0x52b73c-0x0;var _0x19de8c=_0x51ed[_0x52b73c];return _0x19de8c;};'use strict';var _=require(_0xd51e('0x0'));var util=require('util');var moment=require(_0xd51e('0x1'));var BPromise=require(_0xd51e('0x2'));var rs=require(_0xd51e('0x3'));var fs=require('fs');var Redis=require(_0xd51e('0x4'));var db=require(_0xd51e('0x5'))['db'];var utils=require(_0xd51e('0x6'));var logger=require('../../config/logger')(_0xd51e('0x7'));var config=require(_0xd51e('0x8'));var jayson=require(_0xd51e('0x9'));var client=jayson[_0xd51e('0xa')][_0xd51e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15f43c,_0x541a63,_0x153fa9){return new BPromise(function(_0x548853,_0x3d01e1){return client[_0xd51e('0xc')](_0x15f43c,_0x153fa9)['then'](function(_0x2396ff){logger[_0xd51e('0xd')](_0xd51e('0xe'),_0x541a63,_0xd51e('0xf'));logger[_0xd51e('0x10')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x541a63,_0xd51e('0xf'),JSON[_0xd51e('0x11')](_0x2396ff));if(_0x2396ff[_0xd51e('0x12')]){if(_0x2396ff[_0xd51e('0x12')][_0xd51e('0x13')]===0x1f4){logger[_0xd51e('0x12')](_0xd51e('0xe'),_0x541a63,_0x2396ff[_0xd51e('0x12')][_0xd51e('0x14')]);return _0x3d01e1(_0x2396ff['error'][_0xd51e('0x14')]);}logger[_0xd51e('0x12')](_0xd51e('0xe'),_0x541a63,_0x2396ff[_0xd51e('0x12')][_0xd51e('0x14')]);return _0x548853(_0x2396ff[_0xd51e('0x12')][_0xd51e('0x14')]);}else{logger[_0xd51e('0xd')](_0xd51e('0xe'),_0x541a63,_0xd51e('0xf'));_0x548853(_0x2396ff[_0xd51e('0x15')][_0xd51e('0x14')]);}})[_0xd51e('0x16')](function(_0x4a94d7){logger[_0xd51e('0x12')](_0xd51e('0xe'),_0x541a63,_0x4a94d7);_0x3d01e1(_0x4a94d7);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 6c03b77..6e7145b 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 _0xb17b=['show','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xb17b,0x135));var _0xbb17=function(_0x43bf56,_0x14c2b2){_0x43bf56=_0x43bf56-0x0;var _0xd5ecfa=_0xb17b[_0x43bf56];return _0xd5ecfa;};'use strict';var multer=require(_0xbb17('0x0'));var util=require(_0xbb17('0x1'));var path=require(_0xbb17('0x2'));var timeout=require(_0xbb17('0x3'));var express=require(_0xbb17('0x4'));var router=express[_0xbb17('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbb17('0x6'));var interaction=require(_0xbb17('0x7'));var config=require(_0xbb17('0x8'));var controller=require(_0xbb17('0x9'));router[_0xbb17('0xa')]('/',auth[_0xbb17('0xb')](),controller[_0xbb17('0xc')]);router['get'](_0xbb17('0xd'),auth[_0xbb17('0xb')](),controller[_0xbb17('0xe')]);router['post']('/',auth[_0xbb17('0xb')](),controller[_0xbb17('0xf')]);router[_0xbb17('0x10')](_0xbb17('0xd'),auth[_0xbb17('0xb')](),controller[_0xbb17('0x11')]);router['delete']('/:id',auth[_0xbb17('0xb')](),controller['destroy']);module[_0xbb17('0x12')]=router; \ No newline at end of file +var _0xda77=['create','put','update','delete','destroy','multer','util','connect-timeout','../../config/environment','isAuthenticated','get','/:id','post'];(function(_0x36ec77,_0x1b893a){var _0x442ea8=function(_0xe6cc6d){while(--_0xe6cc6d){_0x36ec77['push'](_0x36ec77['shift']());}};_0x442ea8(++_0x1b893a);}(_0xda77,0x1bf));var _0x7da7=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xda77[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0x7da7('0x0'));var util=require(_0x7da7('0x1'));var path=require('path');var timeout=require(_0x7da7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7da7('0x3'));var controller=require('./contactItemType.controller');router['get']('/',auth[_0x7da7('0x4')](),controller['index']);router[_0x7da7('0x5')](_0x7da7('0x6'),auth['isAuthenticated'](),controller['show']);router[_0x7da7('0x7')]('/',auth['isAuthenticated'](),controller[_0x7da7('0x8')]);router[_0x7da7('0x9')](_0x7da7('0x6'),auth[_0x7da7('0x4')](),controller[_0x7da7('0xa')]);router[_0x7da7('0xb')]('/:id',auth[_0x7da7('0x4')](),controller[_0x7da7('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 6146aac..7937887 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 _0xd8b0=['exports','sequelize'];(function(_0x5b76b2,_0x12070e){var _0x52ec35=function(_0x42ee7f){while(--_0x42ee7f){_0x5b76b2['push'](_0x5b76b2['shift']());}};_0x52ec35(++_0x12070e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 +var _0xb10b=['name','sequelize','STRING'];(function(_0x50357d,_0xe18fd5){var _0x5f3ac2=function(_0xc94574){while(--_0xc94574){_0x50357d['push'](_0x50357d['shift']());}};_0x5f3ac2(++_0xe18fd5);}(_0xb10b,0x12a));var _0xbb10=function(_0xfcbf57,_0x4b05fd){_0xfcbf57=_0xfcbf57-0x0;var _0x1078fa=_0xb10b[_0xfcbf57];return _0x1078fa;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3cbd0d2..67ef335 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 _0x7bc5=['mustache','path','to-csv','ejs','fs-extra','squel','crypto','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','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','Dashboard','findAll','show','params','keys','includeAll','include','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','body','createdAt','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','getItems','DashboardItem','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x4ea135,_0xf2f379){var _0x5ddee4=function(_0x10765e){while(--_0x10765e){_0x4ea135['push'](_0x4ea135['shift']());}};_0x5ddee4(++_0xf2f379);}(_0x7bc5,0x17d));var _0x57bc=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0x7bc5[_0x152121];return _0x592a85;};'use strict';var emlformat=require(_0x57bc('0x0'));var rimraf=require(_0x57bc('0x1'));var zipdir=require(_0x57bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57bc('0x3'));var moment=require(_0x57bc('0x4'));var BPromise=require(_0x57bc('0x5'));var Mustache=require(_0x57bc('0x6'));var util=require('util');var path=require(_0x57bc('0x7'));var sox=require('sox');var csv=require(_0x57bc('0x8'));var ejs=require(_0x57bc('0x9'));var fs=require('fs');var fs_extra=require(_0x57bc('0xa'));var _=require('lodash');var squel=require(_0x57bc('0xb'));var crypto=require(_0x57bc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x57bc('0xd'));var toCsv=require(_0x57bc('0x8'));var querystring=require('querystring');var Papa=require(_0x57bc('0xe'));var Redis=require('ioredis');var authService=require(_0x57bc('0xf'));var qs=require(_0x57bc('0x10'));var as=require(_0x57bc('0x11'));var hardwareService=require(_0x57bc('0x12'));var logger=require(_0x57bc('0x13'))(_0x57bc('0x14'));var utils=require(_0x57bc('0x15'));var config=require(_0x57bc('0x16'));var licenseUtil=require(_0x57bc('0x17'));var db=require(_0x57bc('0x18'))['db'];config[_0x57bc('0x19')]=_[_0x57bc('0x1a')](config[_0x57bc('0x19')],{'host':_0x57bc('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57bc('0x19')]));require(_0x57bc('0x1c'))[_0x57bc('0x1d')](socket);function respondWithStatusCode(_0x29201c,_0xfad42e){_0xfad42e=_0xfad42e||0xcc;return function(_0x2452c0){if(_0x2452c0){return _0x29201c[_0x57bc('0x1e')](_0xfad42e);}return _0x29201c['status'](_0xfad42e)['end']();};}function respondWithResult(_0x4a810b,_0x3e7fa6){_0x3e7fa6=_0x3e7fa6||0xc8;return function(_0xc961ae){if(_0xc961ae){return _0x4a810b[_0x57bc('0x1f')](_0x3e7fa6)[_0x57bc('0x20')](_0xc961ae);}};}function respondWithFilteredResult(_0x4dcb5a,_0x56d788){return function(_0x3cf334){if(_0x3cf334){var _0x39becd=typeof _0x56d788[_0x57bc('0x21')]===_0x57bc('0x22')&&typeof _0x56d788[_0x57bc('0x23')]===_0x57bc('0x22');var _0x16106c=_0x3cf334[_0x57bc('0x24')];var _0x1ad2f2=_0x39becd?0x0:_0x56d788[_0x57bc('0x21')];var _0x425527=_0x39becd?_0x3cf334['count']:_0x56d788['offset']+_0x56d788[_0x57bc('0x23')];var _0x194008;if(_0x425527>=_0x16106c){_0x425527=_0x16106c;_0x194008=0xc8;}else{_0x194008=0xce;}_0x4dcb5a['status'](_0x194008);return _0x4dcb5a[_0x57bc('0x25')](_0x57bc('0x26'),_0x1ad2f2+'-'+_0x425527+'/'+_0x16106c)['json'](_0x3cf334);}return null;};}function patchUpdates(_0x44a520){return function(_0x20c0d6){try{jsonpatch[_0x57bc('0x27')](_0x20c0d6,_0x44a520,!![]);}catch(_0x1e2c09){return BPromise[_0x57bc('0x28')](_0x1e2c09);}return _0x20c0d6[_0x57bc('0x29')]();};}function saveUpdates(_0x1c34ed,_0xef7604){return function(_0x5dacc5){if(_0x5dacc5){return _0x5dacc5[_0x57bc('0x2a')](_0x1c34ed)[_0x57bc('0x2b')](function(_0xe13a23){return _0xe13a23;});}return null;};}function removeEntity(_0xd70672,_0xd20782){return function(_0x531a64){if(_0x531a64){return _0x531a64[_0x57bc('0x2c')]()[_0x57bc('0x2b')](function(){var _0x6fa0e3=_0x531a64[_0x57bc('0x2d')]({'plain':!![]});var _0x2806d3=_0x57bc('0x2e');return db[_0x57bc('0x2f')][_0x57bc('0x2c')]({'where':{'type':_0x2806d3,'resourceId':_0x6fa0e3['id']}})[_0x57bc('0x2b')](function(){return _0x531a64;});})[_0x57bc('0x2b')](function(){_0xd70672['status'](0xcc)[_0x57bc('0x30')]();});}};}function handleEntityNotFound(_0x203aef,_0x2917dc){return function(_0x5d3717){if(!_0x5d3717){_0x203aef[_0x57bc('0x1e')](0x194);}return _0x5d3717;};}function handleError(_0x6ad20f,_0x232826){_0x232826=_0x232826||0x1f4;return function(_0xa457d4){logger[_0x57bc('0x31')](_0xa457d4['stack']);if(_0xa457d4[_0x57bc('0x32')]){delete _0xa457d4[_0x57bc('0x32')];}_0x6ad20f[_0x57bc('0x1f')](_0x232826)[_0x57bc('0x33')](_0xa457d4);};}exports[_0x57bc('0x34')]=function(_0x2ca2a9,_0x588299){var _0x3a606a={},_0x18d565={},_0x240b40={'count':0x0,'rows':[]};var _0x1c0768=_[_0x57bc('0x35')](db['Dashboard'][_0x57bc('0x36')],function(_0xa2e5f6){return{'name':_0xa2e5f6[_0x57bc('0x37')],'type':_0xa2e5f6[_0x57bc('0x38')]['key']};});_0x18d565[_0x57bc('0x39')]=_[_0x57bc('0x35')](_0x1c0768,_0x57bc('0x32'));_0x18d565[_0x57bc('0x3a')]=_['keys'](_0x2ca2a9[_0x57bc('0x3a')]);_0x18d565['filters']=_[_0x57bc('0x3b')](_0x18d565[_0x57bc('0x39')],_0x18d565['query']);_0x3a606a[_0x57bc('0x3c')]=_[_0x57bc('0x3b')](_0x18d565['model'],qs[_0x57bc('0x3d')](_0x2ca2a9[_0x57bc('0x3a')][_0x57bc('0x3d')]));_0x3a606a[_0x57bc('0x3c')]=_0x3a606a[_0x57bc('0x3c')][_0x57bc('0x3e')]?_0x3a606a[_0x57bc('0x3c')]:_0x18d565['model'];if(!_0x2ca2a9[_0x57bc('0x3a')][_0x57bc('0x3f')](_0x57bc('0x40'))){_0x3a606a['limit']=qs[_0x57bc('0x23')](_0x2ca2a9[_0x57bc('0x3a')][_0x57bc('0x23')]);_0x3a606a[_0x57bc('0x21')]=qs[_0x57bc('0x21')](_0x2ca2a9[_0x57bc('0x3a')][_0x57bc('0x21')]);}_0x3a606a[_0x57bc('0x41')]=qs[_0x57bc('0x42')](_0x2ca2a9[_0x57bc('0x3a')]['sort']);_0x3a606a[_0x57bc('0x43')]=qs[_0x57bc('0x44')](_['pick'](_0x2ca2a9[_0x57bc('0x3a')],_0x18d565['filters']),_0x1c0768);if(_0x2ca2a9['query']['filter']){_0x3a606a[_0x57bc('0x43')]=_[_0x57bc('0x45')](_0x3a606a[_0x57bc('0x43')],{'$or':_['map'](_0x1c0768,function(_0x5a707d){if(_0x5a707d[_0x57bc('0x38')]!==_0x57bc('0x46')){var _0x349229={};_0x349229[_0x5a707d['name']]={'$like':'%'+_0x2ca2a9['query'][_0x57bc('0x47')]+'%'};return _0x349229;}})});}_0x3a606a=_['merge']({},_0x3a606a,_0x2ca2a9[_0x57bc('0x48')]);var _0x48986b={'where':_0x3a606a[_0x57bc('0x43')]};return db[_0x57bc('0x49')][_0x57bc('0x24')](_0x48986b)['then'](function(_0x3fa616){_0x240b40[_0x57bc('0x24')]=_0x3fa616;if(_0x2ca2a9[_0x57bc('0x3a')]['includeAll']){_0x3a606a['include']=[{'all':!![]}];}return db['Dashboard'][_0x57bc('0x4a')](_0x3a606a);})[_0x57bc('0x2b')](function(_0x1eec79){_0x240b40['rows']=_0x1eec79;return _0x240b40;})['then'](respondWithFilteredResult(_0x588299,_0x3a606a))['catch'](handleError(_0x588299,null));};exports[_0x57bc('0x4b')]=function(_0x52b1c5,_0x25548){var _0x1e1f28={'raw':![],'where':{'id':_0x52b1c5[_0x57bc('0x4c')]['id']}},_0x23fd9c={};_0x23fd9c[_0x57bc('0x39')]=_[_0x57bc('0x4d')](db['Dashboard'][_0x57bc('0x36')]);_0x23fd9c[_0x57bc('0x3a')]=_['keys'](_0x52b1c5['query']);_0x23fd9c[_0x57bc('0x44')]=_[_0x57bc('0x3b')](_0x23fd9c['model'],_0x23fd9c['query']);_0x1e1f28['attributes']=_[_0x57bc('0x3b')](_0x23fd9c[_0x57bc('0x39')],qs['fields'](_0x52b1c5[_0x57bc('0x3a')][_0x57bc('0x3d')]));_0x1e1f28['attributes']=_0x1e1f28[_0x57bc('0x3c')][_0x57bc('0x3e')]?_0x1e1f28[_0x57bc('0x3c')]:_0x23fd9c[_0x57bc('0x39')];if(_0x52b1c5[_0x57bc('0x3a')][_0x57bc('0x4e')]){_0x1e1f28[_0x57bc('0x4f')]=[{'all':!![]}];}_0x1e1f28=_[_0x57bc('0x45')]({},_0x1e1f28,_0x52b1c5[_0x57bc('0x48')]);return db['Dashboard'][_0x57bc('0x50')](_0x1e1f28)[_0x57bc('0x2b')](handleEntityNotFound(_0x25548,null))[_0x57bc('0x2b')](respondWithResult(_0x25548,null))[_0x57bc('0x51')](handleError(_0x25548,null));};exports[_0x57bc('0x52')]=function(_0x49478e,_0x178c41){return db[_0x57bc('0x49')][_0x57bc('0x52')](_0x49478e['body'],{})[_0x57bc('0x2b')](function(_0x5113df){var _0x5ae2f9=_0x49478e['user'][_0x57bc('0x2d')]({'plain':!![]});if(!_0x5ae2f9)throw new Error(_0x57bc('0x53'));if(_0x5ae2f9[_0x57bc('0x54')]===_0x57bc('0x55')){var _0x499fa7=_0x5113df[_0x57bc('0x2d')]({'plain':!![]});var _0x23eff8='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x23eff8,'userProfileId':_0x5ae2f9[_0x57bc('0x56')]},'raw':!![]})[_0x57bc('0x2b')](function(_0x51362c){if(_0x51362c&&_0x51362c[_0x57bc('0x57')]===0x0){return db[_0x57bc('0x2f')][_0x57bc('0x52')]({'name':_0x499fa7[_0x57bc('0x32')],'resourceId':_0x499fa7['id'],'type':_0x51362c[_0x57bc('0x32')],'sectionId':_0x51362c['id']},{})[_0x57bc('0x2b')](function(){return _0x5113df;});}else{return _0x5113df;}})[_0x57bc('0x51')](function(_0x9b09f9){logger[_0x57bc('0x31')](_0x57bc('0x58'),_0x9b09f9);throw _0x9b09f9;});}return _0x5113df;})[_0x57bc('0x2b')](respondWithResult(_0x178c41,0xc9))[_0x57bc('0x51')](handleError(_0x178c41,null));};exports['clone']=function(_0x510da9,_0x2bd695){var _0x2e643b={'where':{'id':_0x510da9[_0x57bc('0x4c')]['id']}},_0x309895={};_0x309895[_0x57bc('0x39')]=_[_0x57bc('0x4d')](db[_0x57bc('0x49')][_0x57bc('0x36')]);_0x2e643b[_0x57bc('0x3c')]=_['intersection'](_0x309895['model'],qs[_0x57bc('0x3d')](_0x510da9['query'][_0x57bc('0x3d')]));_0x2e643b['attributes']=_0x2e643b['attributes'][_0x57bc('0x3e')]?_0x2e643b[_0x57bc('0x3c')]:_0x309895[_0x57bc('0x39')];if(_0x510da9['query'][_0x57bc('0x4e')]){_0x2e643b[_0x57bc('0x4f')]=[{'all':!![]}];}_0x2e643b=_[_0x57bc('0x45')]({},_0x2e643b,_0x510da9[_0x57bc('0x48')]);return db[_0x57bc('0x49')][_0x57bc('0x50')](_0x2e643b)[_0x57bc('0x2b')](handleEntityNotFound(_0x2bd695,null))[_0x57bc('0x2b')](function(_0x36bbe0){if(_0x36bbe0){var _0x3e512a=_0x36bbe0[_0x57bc('0x2d')]({'plain':!![]});_0x3e512a=qs[_0x57bc('0x59')](_0x3e512a,['id','createdAt',_0x57bc('0x5a')]);_0x510da9['body']=_[_0x57bc('0x59')](_0x510da9[_0x57bc('0x5b')],['id',_0x57bc('0x5c'),_0x57bc('0x5a')]);return db[_0x57bc('0x49')]['create'](_[_0x57bc('0x45')](_0x3e512a,_0x510da9['body']),{'include':_0x510da9[_0x57bc('0x3a')][_0x57bc('0x4e')]?[{'all':!![]}]:undefined})[_0x57bc('0x2b')](function(_0x1690ce){var _0x2c5328=_0x510da9[_0x57bc('0x55')]['get']({'plain':!![]});if(!_0x2c5328)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c5328[_0x57bc('0x54')]==='user'){var _0x5e5f86=_0x1690ce[_0x57bc('0x2d')]({'plain':!![]});var _0x59ffbb='CustomDashboards';return db['UserProfileSection'][_0x57bc('0x50')]({'where':{'name':_0x59ffbb,'userProfileId':_0x2c5328[_0x57bc('0x56')]},'raw':!![]})[_0x57bc('0x2b')](function(_0xc3bc32){if(_0xc3bc32&&_0xc3bc32[_0x57bc('0x57')]===0x0){return db[_0x57bc('0x2f')][_0x57bc('0x52')]({'name':_0x5e5f86[_0x57bc('0x32')],'resourceId':_0x5e5f86['id'],'type':_0xc3bc32[_0x57bc('0x32')],'sectionId':_0xc3bc32['id']},{})[_0x57bc('0x2b')](function(){return _0x1690ce;});}else{return _0x1690ce;}})[_0x57bc('0x51')](function(_0x1f7515){logger['error'](_0x57bc('0x58'),_0x1f7515);throw _0x1f7515;});}return _0x1690ce;});}})[_0x57bc('0x2b')](respondWithResult(_0x2bd695,0xc9))['catch'](handleError(_0x2bd695,null));};exports[_0x57bc('0x2a')]=function(_0x18337d,_0x1086de){if(_0x18337d[_0x57bc('0x5b')]['id']){delete _0x18337d[_0x57bc('0x5b')]['id'];}return db[_0x57bc('0x49')]['find']({'where':{'id':_0x18337d[_0x57bc('0x4c')]['id']}})[_0x57bc('0x2b')](handleEntityNotFound(_0x1086de,null))[_0x57bc('0x2b')](saveUpdates(_0x18337d['body'],null))[_0x57bc('0x2b')](respondWithResult(_0x1086de,null))[_0x57bc('0x51')](handleError(_0x1086de,null));};exports[_0x57bc('0x2c')]=function(_0x2cd509,_0x25c465){return db['Dashboard'][_0x57bc('0x50')]({'where':{'id':_0x2cd509[_0x57bc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25c465,null))[_0x57bc('0x2b')](removeEntity(_0x25c465,null))[_0x57bc('0x51')](handleError(_0x25c465,null));};function widgetAttributes(_0x2c03a4){try{switch(_0x2c03a4[_0x57bc('0x38')]){case _0x57bc('0x5d'):return[{'name':_0x57bc('0x5e'),'value':_0x2c03a4[_0x57bc('0x5e')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4['attrs'][0x0]?_0x2c03a4[_0x57bc('0x5f')][0x0][_0x57bc('0x60')]:undefined)||_0x57bc('0x61')}];case'custom':return[{'name':_0x57bc('0x62'),'value':_0x2c03a4[_0x57bc('0x62')]||(_0x2c03a4['attrs']&&_0x2c03a4[_0x57bc('0x5f')][0x0]?_0x2c03a4[_0x57bc('0x5f')][0x0]['value']:undefined)||''}];case _0x57bc('0x63'):return[{'name':_0x57bc('0x64'),'value':_0x2c03a4[_0x57bc('0x64')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x0]?_0x2c03a4[_0x57bc('0x5f')][0x0][_0x57bc('0x60')]:undefined)||_0x57bc('0x65')},{'name':_0x57bc('0x66'),'value':_0x2c03a4[_0x57bc('0x66')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x1]?_0x2c03a4[_0x57bc('0x5f')][0x1][_0x57bc('0x60')]:undefined)||_0x57bc('0x67')},{'name':_0x57bc('0x68'),'value':_0x2c03a4['attrFontSize']||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x2]?_0x2c03a4[_0x57bc('0x5f')][0x2][_0x57bc('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0x57bc('0x69'),'value':_0x2c03a4[_0x57bc('0x69')]||(_0x2c03a4['attrs']&&_0x2c03a4[_0x57bc('0x5f')][0x0]?_0x2c03a4[_0x57bc('0x5f')][0x0][_0x57bc('0x60')]:undefined)||_0x57bc('0x6a')},{'name':_0x57bc('0x6b'),'value':_0x2c03a4[_0x57bc('0x6b')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x1]?_0x2c03a4[_0x57bc('0x5f')][0x1][_0x57bc('0x60')]:undefined)||[]},{'name':_0x57bc('0x68'),'value':_0x2c03a4[_0x57bc('0x68')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4['attrs'][0x2]?_0x2c03a4[_0x57bc('0x5f')][0x2][_0x57bc('0x60')]:undefined)||0x14},{'name':'attrChannel','value':_0x2c03a4['attrChannel']||(_0x2c03a4['attrs']&&_0x2c03a4['attrs'][0x3]?_0x2c03a4[_0x57bc('0x5f')][0x3][_0x57bc('0x60')]:undefined)||_0x57bc('0x6c')},{'name':'attrEmailAccounts','value':_0x2c03a4[_0x57bc('0x6d')]||(_0x2c03a4['attrs']&&_0x2c03a4[_0x57bc('0x5f')][0x4]?_0x2c03a4[_0x57bc('0x5f')][0x4][_0x57bc('0x60')]:undefined)||''},{'name':_0x57bc('0x6e'),'value':_0x2c03a4[_0x57bc('0x6e')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x5]?_0x2c03a4['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x2c03a4[_0x57bc('0x6f')]||(_0x2c03a4['attrs']&&_0x2c03a4[_0x57bc('0x5f')][0x6]?_0x2c03a4[_0x57bc('0x5f')][0x6][_0x57bc('0x60')]:undefined)||''},{'name':_0x57bc('0x70'),'value':_0x2c03a4[_0x57bc('0x70')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x7]?_0x2c03a4['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2c03a4[_0x57bc('0x71')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x8]?_0x2c03a4[_0x57bc('0x5f')][0x8][_0x57bc('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2c03a4[_0x57bc('0x72')]||(_0x2c03a4['attrs']&&_0x2c03a4[_0x57bc('0x5f')][0x9]?_0x2c03a4['attrs'][0x9][_0x57bc('0x60')]:undefined)||''}];case _0x57bc('0x73'):case _0x57bc('0x74'):return[{'name':_0x57bc('0x75'),'value':_0x2c03a4[_0x57bc('0x75')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x0]?_0x2c03a4[_0x57bc('0x5f')][0x0]['value']:undefined)||'total'},{'name':_0x57bc('0x76'),'value':_0x2c03a4[_0x57bc('0x76')]||(_0x2c03a4['attrs']&&_0x2c03a4[_0x57bc('0x5f')][0x1]?_0x2c03a4['attrs'][0x1]['value']:undefined)||null},{'name':_0x57bc('0x77'),'value':_0x2c03a4[_0x57bc('0x77')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x2]?_0x2c03a4[_0x57bc('0x5f')][0x2][_0x57bc('0x60')]:undefined)||null},{'name':_0x57bc('0x6b'),'value':_0x2c03a4['attrVoiceQueues']||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x3]?_0x2c03a4[_0x57bc('0x5f')][0x3][_0x57bc('0x60')]:undefined)||[]},{'name':_0x57bc('0x78'),'value':_0x2c03a4[_0x57bc('0x78')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x4]?_0x2c03a4[_0x57bc('0x5f')][0x4]['value']:undefined)||_0x57bc('0x6c')},{'name':_0x57bc('0x6d'),'value':_0x2c03a4['attrEmailAccounts']||(_0x2c03a4['attrs']&&_0x2c03a4[_0x57bc('0x5f')][0x5]?_0x2c03a4[_0x57bc('0x5f')][0x5][_0x57bc('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2c03a4[_0x57bc('0x6e')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4['attrs'][0x6]?_0x2c03a4['attrs'][0x6][_0x57bc('0x60')]:undefined)||''},{'name':_0x57bc('0x6f'),'value':_0x2c03a4[_0x57bc('0x6f')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4['attrs'][0x7]?_0x2c03a4[_0x57bc('0x5f')][0x7][_0x57bc('0x60')]:undefined)||''},{'name':_0x57bc('0x70'),'value':_0x2c03a4[_0x57bc('0x70')]||(_0x2c03a4['attrs']&&_0x2c03a4[_0x57bc('0x5f')][0x8]?_0x2c03a4[_0x57bc('0x5f')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2c03a4[_0x57bc('0x71')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4['attrs'][0x9]?_0x2c03a4[_0x57bc('0x5f')][0x9][_0x57bc('0x60')]:undefined)||''},{'name':_0x57bc('0x72'),'value':_0x2c03a4['attrChatWebsites']||(_0x2c03a4['attrs']&&_0x2c03a4[_0x57bc('0x5f')][0xa]?_0x2c03a4[_0x57bc('0x5f')][0xa][_0x57bc('0x60')]:undefined)||''}];case'web-report':return[{'name':_0x57bc('0x79'),'type':_0x2c03a4['reportType']||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x0]?_0x2c03a4['attrs'][0x0][_0x57bc('0x38')]:undefined)||null,'value':_0x2c03a4['attrReport']||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x0]?_0x2c03a4[_0x57bc('0x5f')][0x0][_0x57bc('0x60')]:undefined)||null},{'name':_0x57bc('0x7a'),'value':_0x2c03a4[_0x57bc('0x7a')]||(_0x2c03a4[_0x57bc('0x5f')]&&_0x2c03a4[_0x57bc('0x5f')][0x1]?_0x2c03a4[_0x57bc('0x5f')][0x1][_0x57bc('0x60')]:undefined)||0x0}];default:return[];}}catch(_0xda72a7){logger[_0x57bc('0x31')](_0x57bc('0x7b'),JSON[_0x57bc('0x7c')](_0xda72a7));return[];}}exports['addItem']=function(_0x568e04,_0x1831b0,_0x1b5f39){if(_0x568e04[_0x57bc('0x5b')]['id']){delete _0x568e04[_0x57bc('0x5b')]['id'];}return db[_0x57bc('0x49')][_0x57bc('0x50')]({'where':{'id':_0x568e04[_0x57bc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1831b0,null))['then'](function(_0x381a32){if(_0x381a32){_0x568e04['body'][_0x57bc('0x7d')]=_0x381a32['id'];_0x568e04[_0x57bc('0x5b')][_0x57bc('0x5f')]=widgetAttributes(_0x568e04['body']);return db['DashboardItem'][_0x57bc('0x52')](_0x568e04['body']);}})[_0x57bc('0x2b')](respondWithResult(_0x1831b0,null))['catch'](handleError(_0x1831b0,null));};exports[_0x57bc('0x7e')]=function(_0x40dbb8,_0x14a29d,_0x531453){var _0x4df998={};var _0x2bb8ae={};var _0x98ffac;var _0x32863f;return db[_0x57bc('0x49')]['findOne']({'where':{'id':_0x40dbb8[_0x57bc('0x4c')]['id']}})[_0x57bc('0x2b')](handleEntityNotFound(_0x14a29d,null))[_0x57bc('0x2b')](function(_0x36374e){if(_0x36374e){_0x98ffac=_0x36374e;_0x2bb8ae['model']=_[_0x57bc('0x4d')](db[_0x57bc('0x7f')][_0x57bc('0x36')]);_0x2bb8ae['query']=_[_0x57bc('0x4d')](_0x40dbb8[_0x57bc('0x3a')]);_0x2bb8ae[_0x57bc('0x44')]=_[_0x57bc('0x3b')](_0x2bb8ae['model'],_0x2bb8ae[_0x57bc('0x3a')]);_0x4df998['attributes']=_[_0x57bc('0x3b')](_0x2bb8ae['model'],qs[_0x57bc('0x3d')](_0x40dbb8[_0x57bc('0x3a')][_0x57bc('0x3d')]));_0x4df998[_0x57bc('0x3c')]=_0x4df998[_0x57bc('0x3c')][_0x57bc('0x3e')]?_0x4df998[_0x57bc('0x3c')]:_0x2bb8ae[_0x57bc('0x39')];_0x4df998[_0x57bc('0x41')]=qs['sort'](_0x40dbb8['query'][_0x57bc('0x42')]);_0x4df998[_0x57bc('0x43')]=qs['filters'](_[_0x57bc('0x80')](_0x40dbb8['query'],_0x2bb8ae[_0x57bc('0x44')]));if(_0x40dbb8['query'][_0x57bc('0x47')]){_0x4df998[_0x57bc('0x43')]=_[_0x57bc('0x45')](_0x4df998[_0x57bc('0x43')],{'$or':_[_0x57bc('0x35')](_0x4df998[_0x57bc('0x3c')],function(_0x1588b7){var _0x813d7f={};_0x813d7f[_0x1588b7]={'$like':'%'+_0x40dbb8[_0x57bc('0x3a')][_0x57bc('0x47')]+'%'};return _0x813d7f;})});}_0x4df998=_[_0x57bc('0x45')]({},_0x4df998,_0x40dbb8['options']);return _0x98ffac['getItems'](_0x4df998);}})[_0x57bc('0x2b')](function(_0x1addbc){if(_0x1addbc){_0x32863f=_0x1addbc[_0x57bc('0x3e')];if(!_0x40dbb8[_0x57bc('0x3a')][_0x57bc('0x3f')](_0x57bc('0x40'))){_0x4df998['limit']=qs[_0x57bc('0x23')](_0x40dbb8[_0x57bc('0x3a')][_0x57bc('0x23')]);_0x4df998['offset']=qs[_0x57bc('0x21')](_0x40dbb8['query'][_0x57bc('0x21')]);}return _0x98ffac['getItems'](_0x4df998);}})[_0x57bc('0x2b')](function(_0x3e6633){if(_0x3e6633){return _0x3e6633?{'count':_0x32863f,'rows':_0x3e6633}:null;}})[_0x57bc('0x2b')](respondWithResult(_0x14a29d,null))[_0x57bc('0x51')](handleError(_0x14a29d,null));}; \ No newline at end of file +var _0xcdd9=['catch','show','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','get','omit','createdAt','updatedAt','params','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrFaxAccounts','attrOpenchannelAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','end','status','offset','limit','undefined','count','set','reject','update','then','destroy','CustomDashboards','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll'];(function(_0x26a672,_0x59f5be){var _0x348f43=function(_0x461812){while(--_0x461812){_0x26a672['push'](_0x26a672['shift']());}};_0x348f43(++_0x59f5be);}(_0xcdd9,0xbe));var _0x9cdd=function(_0x49ad05,_0x1acffe){_0x49ad05=_0x49ad05-0x0;var _0x3d51b0=_0xcdd9[_0x49ad05];return _0x3d51b0;};'use strict';var emlformat=require(_0x9cdd('0x0'));var rimraf=require(_0x9cdd('0x1'));var zipdir=require(_0x9cdd('0x2'));var jsonpatch=require(_0x9cdd('0x3'));var rp=require(_0x9cdd('0x4'));var moment=require(_0x9cdd('0x5'));var BPromise=require(_0x9cdd('0x6'));var Mustache=require(_0x9cdd('0x7'));var util=require(_0x9cdd('0x8'));var path=require(_0x9cdd('0x9'));var sox=require('sox');var csv=require(_0x9cdd('0xa'));var ejs=require(_0x9cdd('0xb'));var fs=require('fs');var fs_extra=require(_0x9cdd('0xc'));var _=require(_0x9cdd('0xd'));var squel=require(_0x9cdd('0xe'));var crypto=require('crypto');var jsforce=require(_0x9cdd('0xf'));var deskjs=require(_0x9cdd('0x10'));var toCsv=require(_0x9cdd('0xa'));var querystring=require('querystring');var Papa=require(_0x9cdd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9cdd('0x12'));var hardwareService=require(_0x9cdd('0x13'));var logger=require(_0x9cdd('0x14'))(_0x9cdd('0x15'));var utils=require(_0x9cdd('0x16'));var config=require(_0x9cdd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9cdd('0x18'))['db'];config[_0x9cdd('0x19')]=_[_0x9cdd('0x1a')](config[_0x9cdd('0x19')],{'host':_0x9cdd('0x1b'),'port':0x18eb});var socket=require(_0x9cdd('0x1c'))(new Redis(config[_0x9cdd('0x19')]));require(_0x9cdd('0x1d'))[_0x9cdd('0x1e')](socket);function respondWithStatusCode(_0x43f140,_0x225382){_0x225382=_0x225382||0xcc;return function(_0xf3b957){if(_0xf3b957){return _0x43f140['sendStatus'](_0x225382);}return _0x43f140['status'](_0x225382)[_0x9cdd('0x1f')]();};}function respondWithResult(_0x3f9a80,_0x37cc0a){_0x37cc0a=_0x37cc0a||0xc8;return function(_0x40de53){if(_0x40de53){return _0x3f9a80[_0x9cdd('0x20')](_0x37cc0a)['json'](_0x40de53);}};}function respondWithFilteredResult(_0x4924d0,_0x173d1a){return function(_0x4a8d42){if(_0x4a8d42){var _0x1b83cf=typeof _0x173d1a[_0x9cdd('0x21')]==='undefined'&&typeof _0x173d1a[_0x9cdd('0x22')]===_0x9cdd('0x23');var _0x23e2db=_0x4a8d42[_0x9cdd('0x24')];var _0x355e3c=_0x1b83cf?0x0:_0x173d1a[_0x9cdd('0x21')];var _0x5a4169=_0x1b83cf?_0x4a8d42[_0x9cdd('0x24')]:_0x173d1a[_0x9cdd('0x21')]+_0x173d1a[_0x9cdd('0x22')];var _0x177859;if(_0x5a4169>=_0x23e2db){_0x5a4169=_0x23e2db;_0x177859=0xc8;}else{_0x177859=0xce;}_0x4924d0[_0x9cdd('0x20')](_0x177859);return _0x4924d0[_0x9cdd('0x25')]('Content-Range',_0x355e3c+'-'+_0x5a4169+'/'+_0x23e2db)['json'](_0x4a8d42);}return null;};}function patchUpdates(_0x3576c9){return function(_0x7bdca6){try{jsonpatch['apply'](_0x7bdca6,_0x3576c9,!![]);}catch(_0xd51c46){return BPromise[_0x9cdd('0x26')](_0xd51c46);}return _0x7bdca6['save']();};}function saveUpdates(_0x5dbee4,_0x429cef){return function(_0x200b28){if(_0x200b28){return _0x200b28[_0x9cdd('0x27')](_0x5dbee4)[_0x9cdd('0x28')](function(_0x43bbc3){return _0x43bbc3;});}return null;};}function removeEntity(_0x1102fb,_0x2bfa72){return function(_0x4aefdc){if(_0x4aefdc){return _0x4aefdc[_0x9cdd('0x29')]()[_0x9cdd('0x28')](function(){var _0x5d08f2=_0x4aefdc['get']({'plain':!![]});var _0x1a9d3f=_0x9cdd('0x2a');return db['UserProfileResource'][_0x9cdd('0x29')]({'where':{'type':_0x1a9d3f,'resourceId':_0x5d08f2['id']}})[_0x9cdd('0x28')](function(){return _0x4aefdc;});})[_0x9cdd('0x28')](function(){_0x1102fb[_0x9cdd('0x20')](0xcc)[_0x9cdd('0x1f')]();});}};}function handleEntityNotFound(_0x1c8b8e,_0x305192){return function(_0x3b105c){if(!_0x3b105c){_0x1c8b8e[_0x9cdd('0x2b')](0x194);}return _0x3b105c;};}function handleError(_0x3faf00,_0x1065fa){_0x1065fa=_0x1065fa||0x1f4;return function(_0x4b7206){logger[_0x9cdd('0x2c')](_0x4b7206[_0x9cdd('0x2d')]);if(_0x4b7206[_0x9cdd('0x2e')]){delete _0x4b7206['name'];}_0x3faf00[_0x9cdd('0x20')](_0x1065fa)[_0x9cdd('0x2f')](_0x4b7206);};}exports[_0x9cdd('0x30')]=function(_0x35e684,_0x4092b0){var _0x24a49a={},_0x2b2be0={},_0x25c1cf={'count':0x0,'rows':[]};var _0x337a2b=_[_0x9cdd('0x31')](db[_0x9cdd('0x32')][_0x9cdd('0x33')],function(_0x4a5e16){return{'name':_0x4a5e16[_0x9cdd('0x34')],'type':_0x4a5e16[_0x9cdd('0x35')][_0x9cdd('0x36')]};});_0x2b2be0[_0x9cdd('0x37')]=_[_0x9cdd('0x31')](_0x337a2b,_0x9cdd('0x2e'));_0x2b2be0[_0x9cdd('0x38')]=_[_0x9cdd('0x39')](_0x35e684[_0x9cdd('0x38')]);_0x2b2be0[_0x9cdd('0x3a')]=_[_0x9cdd('0x3b')](_0x2b2be0[_0x9cdd('0x37')],_0x2b2be0['query']);_0x24a49a[_0x9cdd('0x3c')]=_[_0x9cdd('0x3b')](_0x2b2be0[_0x9cdd('0x37')],qs[_0x9cdd('0x3d')](_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x3d')]));_0x24a49a[_0x9cdd('0x3c')]=_0x24a49a[_0x9cdd('0x3c')][_0x9cdd('0x3e')]?_0x24a49a[_0x9cdd('0x3c')]:_0x2b2be0[_0x9cdd('0x37')];if(!_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x3f')](_0x9cdd('0x40'))){_0x24a49a['limit']=qs[_0x9cdd('0x22')](_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x22')]);_0x24a49a['offset']=qs[_0x9cdd('0x21')](_0x35e684[_0x9cdd('0x38')]['offset']);}_0x24a49a[_0x9cdd('0x41')]=qs[_0x9cdd('0x42')](_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x42')]);_0x24a49a[_0x9cdd('0x43')]=qs[_0x9cdd('0x3a')](_[_0x9cdd('0x44')](_0x35e684['query'],_0x2b2be0[_0x9cdd('0x3a')]),_0x337a2b);if(_0x35e684[_0x9cdd('0x38')]['filter']){_0x24a49a[_0x9cdd('0x43')]=_[_0x9cdd('0x45')](_0x24a49a[_0x9cdd('0x43')],{'$or':_[_0x9cdd('0x31')](_0x337a2b,function(_0xb8d7e3){if(_0xb8d7e3[_0x9cdd('0x35')]!==_0x9cdd('0x46')){var _0x5439f5={};_0x5439f5[_0xb8d7e3[_0x9cdd('0x2e')]]={'$like':'%'+_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x47')]+'%'};return _0x5439f5;}})});}_0x24a49a=_[_0x9cdd('0x45')]({},_0x24a49a,_0x35e684[_0x9cdd('0x48')]);var _0xbfdca1={'where':_0x24a49a['where']};return db[_0x9cdd('0x32')]['count'](_0xbfdca1)[_0x9cdd('0x28')](function(_0x14830b){_0x25c1cf['count']=_0x14830b;if(_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x49')]){_0x24a49a[_0x9cdd('0x4a')]=[{'all':!![]}];}return db[_0x9cdd('0x32')][_0x9cdd('0x4b')](_0x24a49a);})[_0x9cdd('0x28')](function(_0x130f6b){_0x25c1cf['rows']=_0x130f6b;return _0x25c1cf;})['then'](respondWithFilteredResult(_0x4092b0,_0x24a49a))[_0x9cdd('0x4c')](handleError(_0x4092b0,null));};exports[_0x9cdd('0x4d')]=function(_0x4c7df1,_0x3e4395){var _0x38c061={'raw':![],'where':{'id':_0x4c7df1['params']['id']}},_0x12c3f9={};_0x12c3f9[_0x9cdd('0x37')]=_[_0x9cdd('0x39')](db[_0x9cdd('0x32')][_0x9cdd('0x33')]);_0x12c3f9['query']=_['keys'](_0x4c7df1[_0x9cdd('0x38')]);_0x12c3f9[_0x9cdd('0x3a')]=_[_0x9cdd('0x3b')](_0x12c3f9[_0x9cdd('0x37')],_0x12c3f9[_0x9cdd('0x38')]);_0x38c061[_0x9cdd('0x3c')]=_[_0x9cdd('0x3b')](_0x12c3f9[_0x9cdd('0x37')],qs[_0x9cdd('0x3d')](_0x4c7df1[_0x9cdd('0x38')]['fields']));_0x38c061[_0x9cdd('0x3c')]=_0x38c061[_0x9cdd('0x3c')][_0x9cdd('0x3e')]?_0x38c061[_0x9cdd('0x3c')]:_0x12c3f9['model'];if(_0x4c7df1[_0x9cdd('0x38')]['includeAll']){_0x38c061[_0x9cdd('0x4a')]=[{'all':!![]}];}_0x38c061=_[_0x9cdd('0x45')]({},_0x38c061,_0x4c7df1[_0x9cdd('0x48')]);return db['Dashboard'][_0x9cdd('0x4e')](_0x38c061)[_0x9cdd('0x28')](handleEntityNotFound(_0x3e4395,null))[_0x9cdd('0x28')](respondWithResult(_0x3e4395,null))[_0x9cdd('0x4c')](handleError(_0x3e4395,null));};exports[_0x9cdd('0x4f')]=function(_0x40dcdc,_0x28139d){return db[_0x9cdd('0x32')]['create'](_0x40dcdc[_0x9cdd('0x50')],{})[_0x9cdd('0x28')](function(_0x1689ed){var _0x2a060e=_0x40dcdc[_0x9cdd('0x51')]['get']({'plain':!![]});if(!_0x2a060e)throw new Error(_0x9cdd('0x52'));if(_0x2a060e[_0x9cdd('0x53')]===_0x9cdd('0x51')){var _0x7bb574=_0x1689ed['get']({'plain':!![]});var _0x377177=_0x9cdd('0x2a');return db[_0x9cdd('0x54')][_0x9cdd('0x4e')]({'where':{'name':_0x377177,'userProfileId':_0x2a060e[_0x9cdd('0x55')]},'raw':!![]})['then'](function(_0x302024){if(_0x302024&&_0x302024[_0x9cdd('0x56')]===0x0){return db[_0x9cdd('0x57')][_0x9cdd('0x4f')]({'name':_0x7bb574['name'],'resourceId':_0x7bb574['id'],'type':_0x302024['name'],'sectionId':_0x302024['id']},{})[_0x9cdd('0x28')](function(){return _0x1689ed;});}else{return _0x1689ed;}})[_0x9cdd('0x4c')](function(_0x2e691a){logger[_0x9cdd('0x2c')](_0x9cdd('0x58'),_0x2e691a);throw _0x2e691a;});}return _0x1689ed;})['then'](respondWithResult(_0x28139d,0xc9))[_0x9cdd('0x4c')](handleError(_0x28139d,null));};exports['clone']=function(_0x51907b,_0x280a1b){var _0x1bb8d1={'where':{'id':_0x51907b['params']['id']}},_0x7c25e2={};_0x7c25e2[_0x9cdd('0x37')]=_['keys'](db[_0x9cdd('0x32')][_0x9cdd('0x33')]);_0x1bb8d1[_0x9cdd('0x3c')]=_['intersection'](_0x7c25e2[_0x9cdd('0x37')],qs[_0x9cdd('0x3d')](_0x51907b[_0x9cdd('0x38')][_0x9cdd('0x3d')]));_0x1bb8d1[_0x9cdd('0x3c')]=_0x1bb8d1[_0x9cdd('0x3c')][_0x9cdd('0x3e')]?_0x1bb8d1[_0x9cdd('0x3c')]:_0x7c25e2[_0x9cdd('0x37')];if(_0x51907b[_0x9cdd('0x38')]['includeAll']){_0x1bb8d1[_0x9cdd('0x4a')]=[{'all':!![]}];}_0x1bb8d1=_[_0x9cdd('0x45')]({},_0x1bb8d1,_0x51907b[_0x9cdd('0x48')]);return db[_0x9cdd('0x32')][_0x9cdd('0x4e')](_0x1bb8d1)['then'](handleEntityNotFound(_0x280a1b,null))[_0x9cdd('0x28')](function(_0x5dee93){if(_0x5dee93){var _0x325a7e=_0x5dee93[_0x9cdd('0x59')]({'plain':!![]});_0x325a7e=qs[_0x9cdd('0x5a')](_0x325a7e,['id',_0x9cdd('0x5b'),_0x9cdd('0x5c')]);_0x51907b[_0x9cdd('0x50')]=_[_0x9cdd('0x5a')](_0x51907b[_0x9cdd('0x50')],['id',_0x9cdd('0x5b'),_0x9cdd('0x5c')]);return db[_0x9cdd('0x32')][_0x9cdd('0x4f')](_[_0x9cdd('0x45')](_0x325a7e,_0x51907b[_0x9cdd('0x50')]),{'include':_0x51907b[_0x9cdd('0x38')][_0x9cdd('0x49')]?[{'all':!![]}]:undefined})[_0x9cdd('0x28')](function(_0x4f0b2e){var _0x2904f6=_0x51907b['user']['get']({'plain':!![]});if(!_0x2904f6)throw new Error(_0x9cdd('0x52'));if(_0x2904f6[_0x9cdd('0x53')]===_0x9cdd('0x51')){var _0x4a0c90=_0x4f0b2e[_0x9cdd('0x59')]({'plain':!![]});var _0x434de5=_0x9cdd('0x2a');return db['UserProfileSection'][_0x9cdd('0x4e')]({'where':{'name':_0x434de5,'userProfileId':_0x2904f6[_0x9cdd('0x55')]},'raw':!![]})[_0x9cdd('0x28')](function(_0x52335e){if(_0x52335e&&_0x52335e[_0x9cdd('0x56')]===0x0){return db[_0x9cdd('0x57')][_0x9cdd('0x4f')]({'name':_0x4a0c90['name'],'resourceId':_0x4a0c90['id'],'type':_0x52335e[_0x9cdd('0x2e')],'sectionId':_0x52335e['id']},{})[_0x9cdd('0x28')](function(){return _0x4f0b2e;});}else{return _0x4f0b2e;}})[_0x9cdd('0x4c')](function(_0x388713){logger['error'](_0x9cdd('0x58'),_0x388713);throw _0x388713;});}return _0x4f0b2e;});}})[_0x9cdd('0x28')](respondWithResult(_0x280a1b,0xc9))['catch'](handleError(_0x280a1b,null));};exports[_0x9cdd('0x27')]=function(_0x56fcac,_0x3f90b3){if(_0x56fcac[_0x9cdd('0x50')]['id']){delete _0x56fcac[_0x9cdd('0x50')]['id'];}return db[_0x9cdd('0x32')][_0x9cdd('0x4e')]({'where':{'id':_0x56fcac[_0x9cdd('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3f90b3,null))[_0x9cdd('0x28')](saveUpdates(_0x56fcac[_0x9cdd('0x50')],null))[_0x9cdd('0x28')](respondWithResult(_0x3f90b3,null))[_0x9cdd('0x4c')](handleError(_0x3f90b3,null));};exports['destroy']=function(_0x2041b8,_0x515f94){return db['Dashboard'][_0x9cdd('0x4e')]({'where':{'id':_0x2041b8[_0x9cdd('0x5d')]['id']}})[_0x9cdd('0x28')](handleEntityNotFound(_0x515f94,null))[_0x9cdd('0x28')](removeEntity(_0x515f94,null))[_0x9cdd('0x4c')](handleError(_0x515f94,null));};function widgetAttributes(_0x1a355d){try{switch(_0x1a355d[_0x9cdd('0x35')]){case _0x9cdd('0x5e'):return[{'name':'attrUrl','value':_0x1a355d[_0x9cdd('0x5f')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d[_0x9cdd('0x60')][0x0]['value']:undefined)||_0x9cdd('0x61')}];case _0x9cdd('0x62'):return[{'name':_0x9cdd('0x63'),'value':_0x1a355d['attrPath']||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d[_0x9cdd('0x60')][0x0]['value']:undefined)||''}];case _0x9cdd('0x64'):return[{'name':_0x9cdd('0x65'),'value':_0x1a355d['attrHourFormat']||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d['attrs'][0x0][_0x9cdd('0x66')]:undefined)||_0x9cdd('0x67')},{'name':_0x9cdd('0x68'),'value':_0x1a355d[_0x9cdd('0x68')]||(_0x1a355d['attrs']&&_0x1a355d['attrs'][0x1]?_0x1a355d[_0x9cdd('0x60')][0x1][_0x9cdd('0x66')]:undefined)||_0x9cdd('0x69')},{'name':'attrFontSize','value':_0x1a355d[_0x9cdd('0x6a')]||(_0x1a355d['attrs']&&_0x1a355d['attrs'][0x2]?_0x1a355d['attrs'][0x2][_0x9cdd('0x66')]:undefined)||0xc}];case _0x9cdd('0x6b'):return[{'name':'attrMetric','value':_0x1a355d[_0x9cdd('0x6c')]||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d['attrs'][0x0]['value']:undefined)||_0x9cdd('0x6d')},{'name':_0x9cdd('0x6e'),'value':_0x1a355d[_0x9cdd('0x6e')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x1]?_0x1a355d['attrs'][0x1][_0x9cdd('0x66')]:undefined)||[]},{'name':_0x9cdd('0x6a'),'value':_0x1a355d[_0x9cdd('0x6a')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x2]?_0x1a355d[_0x9cdd('0x60')][0x2][_0x9cdd('0x66')]:undefined)||0x14},{'name':'attrChannel','value':_0x1a355d['attrChannel']||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x3]?_0x1a355d[_0x9cdd('0x60')][0x3]['value']:undefined)||_0x9cdd('0x6f')},{'name':_0x9cdd('0x70'),'value':_0x1a355d[_0x9cdd('0x70')]||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x4]?_0x1a355d[_0x9cdd('0x60')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x1a355d['attrFaxAccounts']||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x5]?_0x1a355d[_0x9cdd('0x60')][0x5][_0x9cdd('0x66')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1a355d[_0x9cdd('0x71')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x6]?_0x1a355d[_0x9cdd('0x60')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1a355d['attrOpenchannelAccounts']||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x7]?_0x1a355d[_0x9cdd('0x60')][0x7][_0x9cdd('0x66')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1a355d[_0x9cdd('0x72')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x8]?_0x1a355d[_0x9cdd('0x60')][0x8][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x73'),'value':_0x1a355d[_0x9cdd('0x73')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x9]?_0x1a355d[_0x9cdd('0x60')][0x9][_0x9cdd('0x66')]:undefined)||''}];case _0x9cdd('0x74'):case _0x9cdd('0x75'):return[{'name':_0x9cdd('0x76'),'value':_0x1a355d[_0x9cdd('0x76')]||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d[_0x9cdd('0x60')][0x0][_0x9cdd('0x66')]:undefined)||_0x9cdd('0x6d')},{'name':_0x9cdd('0x77'),'value':_0x1a355d[_0x9cdd('0x77')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x1]?_0x1a355d[_0x9cdd('0x60')][0x1][_0x9cdd('0x66')]:undefined)||null},{'name':_0x9cdd('0x78'),'value':_0x1a355d[_0x9cdd('0x78')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x2]?_0x1a355d['attrs'][0x2]['value']:undefined)||null},{'name':_0x9cdd('0x6e'),'value':_0x1a355d['attrVoiceQueues']||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x3]?_0x1a355d['attrs'][0x3]['value']:undefined)||[]},{'name':_0x9cdd('0x79'),'value':_0x1a355d[_0x9cdd('0x79')]||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x4]?_0x1a355d[_0x9cdd('0x60')][0x4][_0x9cdd('0x66')]:undefined)||_0x9cdd('0x6f')},{'name':_0x9cdd('0x70'),'value':_0x1a355d[_0x9cdd('0x70')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x5]?_0x1a355d[_0x9cdd('0x60')][0x5][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x7a'),'value':_0x1a355d[_0x9cdd('0x7a')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x6]?_0x1a355d[_0x9cdd('0x60')][0x6][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x71'),'value':_0x1a355d['attrSmsAccounts']||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x7]?_0x1a355d[_0x9cdd('0x60')][0x7][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x7b'),'value':_0x1a355d[_0x9cdd('0x7b')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x8]?_0x1a355d[_0x9cdd('0x60')][0x8][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x72'),'value':_0x1a355d[_0x9cdd('0x72')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x9]?_0x1a355d['attrs'][0x9][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x73'),'value':_0x1a355d[_0x9cdd('0x73')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0xa]?_0x1a355d[_0x9cdd('0x60')][0xa][_0x9cdd('0x66')]:undefined)||''}];case'web-report':return[{'name':_0x9cdd('0x7c'),'type':_0x1a355d[_0x9cdd('0x7d')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d['attrs'][0x0]['type']:undefined)||null,'value':_0x1a355d[_0x9cdd('0x7c')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x0]?_0x1a355d[_0x9cdd('0x60')][0x0][_0x9cdd('0x66')]:undefined)||null},{'name':_0x9cdd('0x7e'),'value':_0x1a355d[_0x9cdd('0x7e')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x1]?_0x1a355d[_0x9cdd('0x60')][0x1][_0x9cdd('0x66')]:undefined)||0x0}];default:return[];}}catch(_0xdfbb1){logger[_0x9cdd('0x2c')](_0x9cdd('0x7f'),JSON['stringify'](_0xdfbb1));return[];}}exports[_0x9cdd('0x80')]=function(_0x43553b,_0xd073ca,_0x1b4105){if(_0x43553b[_0x9cdd('0x50')]['id']){delete _0x43553b[_0x9cdd('0x50')]['id'];}return db['Dashboard'][_0x9cdd('0x4e')]({'where':{'id':_0x43553b['params']['id']}})[_0x9cdd('0x28')](handleEntityNotFound(_0xd073ca,null))['then'](function(_0x450204){if(_0x450204){_0x43553b[_0x9cdd('0x50')][_0x9cdd('0x81')]=_0x450204['id'];_0x43553b[_0x9cdd('0x50')][_0x9cdd('0x60')]=widgetAttributes(_0x43553b[_0x9cdd('0x50')]);return db[_0x9cdd('0x82')][_0x9cdd('0x4f')](_0x43553b[_0x9cdd('0x50')]);}})['then'](respondWithResult(_0xd073ca,null))[_0x9cdd('0x4c')](handleError(_0xd073ca,null));};exports[_0x9cdd('0x83')]=function(_0x403ab1,_0x3cf23b,_0xf396b6){var _0x2e6be9={};var _0xdb7fd6={};var _0x236fa6;var _0x15420b;return db[_0x9cdd('0x32')][_0x9cdd('0x84')]({'where':{'id':_0x403ab1[_0x9cdd('0x5d')]['id']}})[_0x9cdd('0x28')](handleEntityNotFound(_0x3cf23b,null))[_0x9cdd('0x28')](function(_0x95d0b3){if(_0x95d0b3){_0x236fa6=_0x95d0b3;_0xdb7fd6[_0x9cdd('0x37')]=_[_0x9cdd('0x39')](db['DashboardItem']['rawAttributes']);_0xdb7fd6[_0x9cdd('0x38')]=_['keys'](_0x403ab1[_0x9cdd('0x38')]);_0xdb7fd6['filters']=_[_0x9cdd('0x3b')](_0xdb7fd6[_0x9cdd('0x37')],_0xdb7fd6[_0x9cdd('0x38')]);_0x2e6be9[_0x9cdd('0x3c')]=_['intersection'](_0xdb7fd6['model'],qs[_0x9cdd('0x3d')](_0x403ab1[_0x9cdd('0x38')]['fields']));_0x2e6be9[_0x9cdd('0x3c')]=_0x2e6be9['attributes'][_0x9cdd('0x3e')]?_0x2e6be9['attributes']:_0xdb7fd6[_0x9cdd('0x37')];_0x2e6be9['order']=qs[_0x9cdd('0x42')](_0x403ab1[_0x9cdd('0x38')][_0x9cdd('0x42')]);_0x2e6be9[_0x9cdd('0x43')]=qs[_0x9cdd('0x3a')](_[_0x9cdd('0x44')](_0x403ab1[_0x9cdd('0x38')],_0xdb7fd6[_0x9cdd('0x3a')]));if(_0x403ab1[_0x9cdd('0x38')]['filter']){_0x2e6be9[_0x9cdd('0x43')]=_[_0x9cdd('0x45')](_0x2e6be9['where'],{'$or':_['map'](_0x2e6be9[_0x9cdd('0x3c')],function(_0x21ecf5){var _0x11ab04={};_0x11ab04[_0x21ecf5]={'$like':'%'+_0x403ab1[_0x9cdd('0x38')]['filter']+'%'};return _0x11ab04;})});}_0x2e6be9=_['merge']({},_0x2e6be9,_0x403ab1[_0x9cdd('0x48')]);return _0x236fa6[_0x9cdd('0x83')](_0x2e6be9);}})[_0x9cdd('0x28')](function(_0x5ed353){if(_0x5ed353){_0x15420b=_0x5ed353[_0x9cdd('0x3e')];if(!_0x403ab1[_0x9cdd('0x38')][_0x9cdd('0x3f')]('nolimit')){_0x2e6be9[_0x9cdd('0x22')]=qs[_0x9cdd('0x22')](_0x403ab1[_0x9cdd('0x38')][_0x9cdd('0x22')]);_0x2e6be9[_0x9cdd('0x21')]=qs[_0x9cdd('0x21')](_0x403ab1[_0x9cdd('0x38')][_0x9cdd('0x21')]);}return _0x236fa6[_0x9cdd('0x83')](_0x2e6be9);}})['then'](function(_0x1c7fca){if(_0x1c7fca){return _0x1c7fca?{'count':_0x15420b,'rows':_0x1c7fca}:null;}})[_0x9cdd('0x28')](respondWithResult(_0x3cf23b,null))['catch'](handleError(_0x3cf23b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7edb627..8b83628 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 _0xa699=['setMaxListeners','save','update','remove','emit','../../mysqldb','Dashboard'];(function(_0x1670d5,_0x335c9c){var _0x151edc=function(_0x289b84){while(--_0x289b84){_0x1670d5['push'](_0x1670d5['shift']());}};_0x151edc(++_0x335c9c);}(_0xa699,0x132));var _0x9a69=function(_0x122e9b,_0x391bf4){_0x122e9b=_0x122e9b-0x0;var _0x22c247=_0xa699[_0x122e9b];return _0x22c247;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x9a69('0x0'))['db'][_0x9a69('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9a69('0x2')](0x0);var events={'afterCreate':_0x9a69('0x3'),'afterUpdate':_0x9a69('0x4'),'afterDestroy':_0x9a69('0x5')};function emitEvent(_0x4cda3e){return function(_0x8b45a3,_0x8faacd,_0x17440b){DashboardEvents[_0x9a69('0x6')](_0x4cda3e+':'+_0x8b45a3['id'],_0x8b45a3);DashboardEvents[_0x9a69('0x6')](_0x4cda3e,_0x8b45a3);_0x17440b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x52aa=['exports','events','Dashboard','save','update','emit','hook'];(function(_0x5a62cd,_0x2cf6bb){var _0x32bd21=function(_0x1c87ef){while(--_0x1c87ef){_0x5a62cd['push'](_0x5a62cd['shift']());}};_0x32bd21(++_0x2cf6bb);}(_0x52aa,0x1c1));var _0xa52a=function(_0x194f0a,_0x44e965){_0x194f0a=_0x194f0a-0x0;var _0x433080=_0x52aa[_0x194f0a];return _0x433080;};'use strict';var EventEmitter=require(_0xa52a('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xa52a('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa52a('0x2'),'afterUpdate':_0xa52a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x26c796){return function(_0x4f8f04,_0x5dd4d0,_0x541dd5){DashboardEvents[_0xa52a('0x4')](_0x26c796+':'+_0x4f8f04['id'],_0x4f8f04);DashboardEvents[_0xa52a('0x4')](_0x26c796,_0x4f8f04);_0x541dd5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xa52a('0x5')](e,emitEvent(event));}}module[_0xa52a('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f4293fa..66833aa 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 _0x4ee5=['./dashboard.attributes','Dashboard','dashboards','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4ee5,0x1dc));var _0x54ee=function(_0x3bfb5d,_0x47293e){_0x3bfb5d=_0x3bfb5d-0x0;var _0x14fd84=_0x4ee5[_0x3bfb5d];return _0x14fd84;};'use strict';var _=require(_0x54ee('0x0'));var util=require('util');var logger=require(_0x54ee('0x1'))(_0x54ee('0x2'));var moment=require(_0x54ee('0x3'));var BPromise=require(_0x54ee('0x4'));var rp=require(_0x54ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x54ee('0x6'));var config=require(_0x54ee('0x7'));var attributes=require(_0x54ee('0x8'));module['exports']=function(_0x59a282,_0x200892){return _0x59a282['define'](_0x54ee('0x9'),attributes,{'tableName':_0x54ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba58=['path','rimraf','./dashboard.attributes','Dashboard','api','moment'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xba58,0x166));var _0x8ba5=function(_0x336b55,_0x51ce29){_0x336b55=_0x336b55-0x0;var _0x45965e=_0xba58[_0x336b55];return _0x45965e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8ba5('0x0'));var moment=require(_0x8ba5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ba5('0x2'));var rimraf=require(_0x8ba5('0x3'));var config=require('../../config/environment');var attributes=require(_0x8ba5('0x4'));module['exports']=function(_0x2b75b6,_0x38dc78){return _0x2b75b6['define'](_0x8ba5('0x5'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index e049e5e..4928e84 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 _0x6a96=['./dashboard.socket','register','request','then','info','debug','error','code','Dashboard,\x20%s,\x20%s','message','request\x20sent','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x2a11be,_0x4fe6fe){var _0x16b4d6=function(_0x31cd5f){while(--_0x31cd5f){_0x2a11be['push'](_0x2a11be['shift']());}};_0x16b4d6(++_0x4fe6fe);}(_0x6a96,0x12a));var _0x66a9=function(_0x5875ad,_0x3597b8){_0x5875ad=_0x5875ad-0x0;var _0x32a922=_0x6a96[_0x5875ad];return _0x32a922;};'use strict';var _=require(_0x66a9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x66a9('0x1'));var rs=require(_0x66a9('0x2'));var fs=require('fs');var Redis=require(_0x66a9('0x3'));var db=require(_0x66a9('0x4'))['db'];var utils=require(_0x66a9('0x5'));var logger=require(_0x66a9('0x6'))(_0x66a9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x66a9('0x8')][_0x66a9('0x9')]({'port':0x232a});config[_0x66a9('0xa')]=_[_0x66a9('0xb')](config['redis'],{'host':_0x66a9('0xc'),'port':0x18eb});var socket=require(_0x66a9('0xd'))(new Redis(config[_0x66a9('0xa')]));require(_0x66a9('0xe'))[_0x66a9('0xf')](socket);function respondWithRpcPromise(_0x1b7b95,_0x5c6c40,_0x17be5b){return new BPromise(function(_0x50861f,_0x123ab0){return client[_0x66a9('0x10')](_0x1b7b95,_0x17be5b)[_0x66a9('0x11')](function(_0x534b06){logger[_0x66a9('0x12')]('Dashboard,\x20%s,\x20%s',_0x5c6c40,'request\x20sent');logger[_0x66a9('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5c6c40,'request\x20sent',JSON['stringify'](_0x534b06));if(_0x534b06[_0x66a9('0x14')]){if(_0x534b06[_0x66a9('0x14')][_0x66a9('0x15')]===0x1f4){logger[_0x66a9('0x14')](_0x66a9('0x16'),_0x5c6c40,_0x534b06[_0x66a9('0x14')][_0x66a9('0x17')]);return _0x123ab0(_0x534b06[_0x66a9('0x14')][_0x66a9('0x17')]);}logger['error'](_0x66a9('0x16'),_0x5c6c40,_0x534b06[_0x66a9('0x14')][_0x66a9('0x17')]);return _0x50861f(_0x534b06['error'][_0x66a9('0x17')]);}else{logger[_0x66a9('0x12')](_0x66a9('0x16'),_0x5c6c40,_0x66a9('0x18'));_0x50861f(_0x534b06[_0x66a9('0x19')][_0x66a9('0x17')]);}})['catch'](function(_0x544a66){logger['error'](_0x66a9('0x16'),_0x5c6c40,_0x544a66);_0x123ab0(_0x544a66);});});} \ No newline at end of file +var _0x305f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x577c60,_0x250fff){var _0x887a24=function(_0x11e370){while(--_0x11e370){_0x577c60['push'](_0x577c60['shift']());}};_0x887a24(++_0x250fff);}(_0x305f,0x97));var _0xf305=function(_0x3e35d9,_0x30b3dd){_0x3e35d9=_0x3e35d9-0x0;var _0x455aeb=_0x305f[_0x3e35d9];return _0x455aeb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf305('0x0'));var BPromise=require(_0xf305('0x1'));var rs=require(_0xf305('0x2'));var fs=require('fs');var Redis=require(_0xf305('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf305('0x4'));var logger=require(_0xf305('0x5'))(_0xf305('0x6'));var config=require(_0xf305('0x7'));var jayson=require(_0xf305('0x8'));var client=jayson[_0xf305('0x9')][_0xf305('0xa')]({'port':0x232a});config['redis']=_[_0xf305('0xb')](config[_0xf305('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf305('0xd'))(new Redis(config['redis']));require(_0xf305('0xe'))[_0xf305('0xf')](socket);function respondWithRpcPromise(_0x163d8f,_0x4faccf,_0x534288){return new BPromise(function(_0x11e67a,_0x30c7f7){return client[_0xf305('0x10')](_0x163d8f,_0x534288)['then'](function(_0x310ba5){logger[_0xf305('0x11')](_0xf305('0x12'),_0x4faccf,'request\x20sent');logger[_0xf305('0x13')](_0xf305('0x14'),_0x4faccf,_0xf305('0x15'),JSON['stringify'](_0x310ba5));if(_0x310ba5[_0xf305('0x16')]){if(_0x310ba5[_0xf305('0x16')][_0xf305('0x17')]===0x1f4){logger[_0xf305('0x16')](_0xf305('0x12'),_0x4faccf,_0x310ba5[_0xf305('0x16')][_0xf305('0x18')]);return _0x30c7f7(_0x310ba5['error'][_0xf305('0x18')]);}logger[_0xf305('0x16')]('Dashboard,\x20%s,\x20%s',_0x4faccf,_0x310ba5['error'][_0xf305('0x18')]);return _0x11e67a(_0x310ba5[_0xf305('0x16')][_0xf305('0x18')]);}else{logger[_0xf305('0x11')](_0xf305('0x12'),_0x4faccf,_0xf305('0x15'));_0x11e67a(_0x310ba5[_0xf305('0x19')][_0xf305('0x18')]);}})['catch'](function(_0x2a641f){logger[_0xf305('0x16')](_0xf305('0x12'),_0x4faccf,_0x2a641f);_0x30c7f7(_0x2a641f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 17dec23..9486cd0 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 _0x35a5=['./dashboard.events','update','emit','removeListener','register','length','dashboard:'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0x35a5,0x1c0));var _0x535a=function(_0x2a01b4,_0x21c5b1){_0x2a01b4=_0x2a01b4-0x0;var _0x5c2e9c=_0x35a5[_0x2a01b4];return _0x5c2e9c;};'use strict';var DashboardEvents=require(_0x535a('0x0'));var events=['save','remove',_0x535a('0x1')];function createListener(_0x490e33,_0x13133c){return function(_0xa634d2){_0x13133c[_0x535a('0x2')](_0x490e33,_0xa634d2);};}function removeListener(_0xe6464c,_0x1bcc6c){return function(){DashboardEvents[_0x535a('0x3')](_0xe6464c,_0x1bcc6c);};}exports[_0x535a('0x4')]=function(_0x131961){for(var _0x2f43e1=0x0,_0x1a84c4=events[_0x535a('0x5')];_0x2f43e1<_0x1a84c4;_0x2f43e1++){var _0x2082e6=events[_0x2f43e1];var _0x26afde=createListener(_0x535a('0x6')+_0x2082e6,_0x131961);DashboardEvents['on'](_0x2082e6,_0x26afde);}}; \ No newline at end of file +var _0x5e1a=['./dashboard.events','save','update','emit','register','length'];(function(_0x4a8a9e,_0x202429){var _0x2398de=function(_0x3462a7){while(--_0x3462a7){_0x4a8a9e['push'](_0x4a8a9e['shift']());}};_0x2398de(++_0x202429);}(_0x5e1a,0x156));var _0xa5e1=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0x5e1a[_0x35c5a8];return _0x34782c;};'use strict';var DashboardEvents=require(_0xa5e1('0x0'));var events=[_0xa5e1('0x1'),'remove',_0xa5e1('0x2')];function createListener(_0x57e9d4,_0x16f63b){return function(_0x37af8f){_0x16f63b[_0xa5e1('0x3')](_0x57e9d4,_0x37af8f);};}function removeListener(_0x4a75e5,_0x507329){return function(){DashboardEvents['removeListener'](_0x4a75e5,_0x507329);};}exports[_0xa5e1('0x4')]=function(_0x542059){for(var _0x59d776=0x0,_0x104e41=events[_0xa5e1('0x5')];_0x59d776<_0x104e41;_0x59d776++){var _0x37eea7=events[_0x59d776];var _0x59ac38=createListener('dashboard:'+_0x37eea7,_0x542059);DashboardEvents['on'](_0x37eea7,_0x59ac38);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index bf76630..0cc8c4c 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 _0x0f53=['isAuthenticated','index','get','/:id','/:id/items','getItems','post','/:id/clone','addItem','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0f53,0xf4));var _0x30f5=function(_0x22a18c,_0x1ddc4c){_0x22a18c=_0x22a18c-0x0;var _0x146773=_0x0f53[_0x22a18c];return _0x146773;};'use strict';var multer=require(_0x30f5('0x0'));var util=require(_0x30f5('0x1'));var path=require(_0x30f5('0x2'));var timeout=require(_0x30f5('0x3'));var express=require(_0x30f5('0x4'));var router=express[_0x30f5('0x5')]();var fs_extra=require(_0x30f5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x30f5('0x7'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router['get']('/',auth[_0x30f5('0x8')](),controller[_0x30f5('0x9')]);router[_0x30f5('0xa')](_0x30f5('0xb'),auth[_0x30f5('0x8')](),controller['show']);router[_0x30f5('0xa')](_0x30f5('0xc'),auth[_0x30f5('0x8')](),controller[_0x30f5('0xd')]);router[_0x30f5('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x30f5('0xe')](_0x30f5('0xf'),auth[_0x30f5('0x8')](),controller['clone']);router[_0x30f5('0xe')](_0x30f5('0xc'),auth['isAuthenticated'](),controller[_0x30f5('0x10')]);router[_0x30f5('0x11')]('/:id',auth[_0x30f5('0x8')](),controller[_0x30f5('0x12')]);router[_0x30f5('0x13')](_0x30f5('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x30f5('0x14')]=router; \ No newline at end of file +var _0xa4e7=['connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','/:id/items','getItems','post','create','/:id/clone','addItem','put','update','delete','exports','util','path'];(function(_0x4c9254,_0x1bff96){var _0x289c02=function(_0x1ca5f0){while(--_0x1ca5f0){_0x4c9254['push'](_0x4c9254['shift']());}};_0x289c02(++_0x1bff96);}(_0xa4e7,0x10f));var _0x7a4e=function(_0x14e603,_0x115454){_0x14e603=_0x14e603-0x0;var _0x453a10=_0xa4e7[_0x14e603];return _0x453a10;};'use strict';var multer=require('multer');var util=require(_0x7a4e('0x0'));var path=require(_0x7a4e('0x1'));var timeout=require(_0x7a4e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7a4e('0x3'));var auth=require(_0x7a4e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7a4e('0x5'));var controller=require(_0x7a4e('0x6'));router['get']('/',auth[_0x7a4e('0x7')](),controller[_0x7a4e('0x8')]);router[_0x7a4e('0x9')](_0x7a4e('0xa'),auth[_0x7a4e('0x7')](),controller['show']);router['get'](_0x7a4e('0xb'),auth[_0x7a4e('0x7')](),controller[_0x7a4e('0xc')]);router[_0x7a4e('0xd')]('/',auth[_0x7a4e('0x7')](),controller[_0x7a4e('0xe')]);router[_0x7a4e('0xd')](_0x7a4e('0xf'),auth[_0x7a4e('0x7')](),controller['clone']);router[_0x7a4e('0xd')](_0x7a4e('0xb'),auth[_0x7a4e('0x7')](),controller[_0x7a4e('0x10')]);router[_0x7a4e('0x11')](_0x7a4e('0xa'),auth[_0x7a4e('0x7')](),controller[_0x7a4e('0x12')]);router[_0x7a4e('0x13')]('/:id',auth[_0x7a4e('0x7')](),controller['destroy']);module[_0x7a4e('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 885802d..aaaa8e5 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 _0xf61e=['TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x3254cf,_0xf77ee2){var _0x37b354=function(_0x509bcb){while(--_0x509bcb){_0x3254cf['push'](_0x3254cf['shift']());}};_0x37b354(++_0xf77ee2);}(_0xf61e,0x191));var _0xef61=function(_0x33ea3d,_0x310532){_0x33ea3d=_0x33ea3d-0x0;var _0x3aa298=_0xf61e[_0x33ea3d];return _0x3aa298;};'use strict';var Sequelize=require(_0xef61('0x0'));var squel=require(_0xef61('0x1'));var _=require(_0xef61('0x2'));module[_0xef61('0x3')]={'title':{'type':Sequelize[_0xef61('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xef61('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xef61('0x5')](_0xef61('0x6')),'get':function(){try{return JSON[_0xef61('0x7')](this[_0xef61('0x8')](_0xef61('0x9')));}catch(_0x45a18d){return[];}},'set':function(_0x5b00b2){try{this[_0xef61('0xa')](_0xef61('0x9'),JSON['stringify'](_0x5b00b2));}catch(_0x2242a7){this[_0xef61('0xa')](_0xef61('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xef61('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xef61('0xb')]},'col':{'type':Sequelize[_0xef61('0xb')]},'background':{'type':Sequelize[_0xef61('0x4')],'allowNull':![],'defaultValue':_0xef61('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xef61('0x4')],'allowNull':![],'defaultValue':_0xef61('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xef61('0x4')]},'titleFontSize':{'type':Sequelize[_0xef61('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1967=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','squel','lodash','exports','STRING','TEXT','long'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x1967,0x173));var _0x7196=function(_0x3dd280,_0x51fdea){_0x3dd280=_0x3dd280-0x0;var _0xd3d59c=_0x1967[_0x3dd280];return _0xd3d59c;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x7196('0x0'));var _=require(_0x7196('0x1'));module[_0x7196('0x2')]={'title':{'type':Sequelize[_0x7196('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7196('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7196('0x4')](_0x7196('0x5')),'get':function(){try{return JSON[_0x7196('0x6')](this[_0x7196('0x7')](_0x7196('0x8')));}catch(_0x5c128f){return[];}},'set':function(_0x36b01e){try{this[_0x7196('0x9')](_0x7196('0x8'),JSON[_0x7196('0xa')](_0x36b01e));}catch(_0x266a6e){this[_0x7196('0x9')]('attrs',JSON[_0x7196('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x7196('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7196('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7196('0xb')]},'col':{'type':Sequelize[_0x7196('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7196('0x3')],'allowNull':![],'defaultValue':_0x7196('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7196('0x3')]},'titleFontSize':{'type':Sequelize[_0x7196('0xb')],'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 a33f35d..cd5acc1 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 _0x6363=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','fields','attributes','includeAll','include','merge','options','find','catch','type','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6363,0x13a));var _0x3636=function(_0x480086,_0x26cd3b){_0x480086=_0x480086-0x0;var _0x1ea4a1=_0x6363[_0x480086];return _0x1ea4a1;};'use strict';var emlformat=require(_0x3636('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3636('0x1'));var jsonpatch=require(_0x3636('0x2'));var rp=require(_0x3636('0x3'));var moment=require(_0x3636('0x4'));var BPromise=require(_0x3636('0x5'));var Mustache=require(_0x3636('0x6'));var util=require(_0x3636('0x7'));var path=require(_0x3636('0x8'));var sox=require(_0x3636('0x9'));var csv=require(_0x3636('0xa'));var ejs=require(_0x3636('0xb'));var fs=require('fs');var fs_extra=require(_0x3636('0xc'));var _=require(_0x3636('0xd'));var squel=require(_0x3636('0xe'));var crypto=require('crypto');var jsforce=require(_0x3636('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3636('0xa'));var querystring=require(_0x3636('0x10'));var Papa=require(_0x3636('0x11'));var Redis=require(_0x3636('0x12'));var authService=require(_0x3636('0x13'));var qs=require(_0x3636('0x14'));var as=require(_0x3636('0x15'));var hardwareService=require(_0x3636('0x16'));var logger=require(_0x3636('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x3636('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3636('0x19'))['db'];config[_0x3636('0x1a')]=_[_0x3636('0x1b')](config[_0x3636('0x1a')],{'host':_0x3636('0x1c'),'port':0x18eb});var socket=require(_0x3636('0x1d'))(new Redis(config[_0x3636('0x1a')]));require(_0x3636('0x1e'))[_0x3636('0x1f')](socket);function respondWithStatusCode(_0x7b4b16,_0x102f90){_0x102f90=_0x102f90||0xcc;return function(_0xaacadb){if(_0xaacadb){return _0x7b4b16[_0x3636('0x20')](_0x102f90);}return _0x7b4b16[_0x3636('0x21')](_0x102f90)[_0x3636('0x22')]();};}function respondWithResult(_0x3cbd0d,_0x2dbd4d){_0x2dbd4d=_0x2dbd4d||0xc8;return function(_0x50474f){if(_0x50474f){return _0x3cbd0d[_0x3636('0x21')](_0x2dbd4d)[_0x3636('0x23')](_0x50474f);}};}function respondWithFilteredResult(_0x4aa7fc,_0xe3be56){return function(_0x5aa0ff){if(_0x5aa0ff){var _0x5e85f2=typeof _0xe3be56[_0x3636('0x24')]===_0x3636('0x25')&&typeof _0xe3be56[_0x3636('0x26')]===_0x3636('0x25');var _0xe0e633=_0x5aa0ff[_0x3636('0x27')];var _0xa2b8fe=_0x5e85f2?0x0:_0xe3be56[_0x3636('0x24')];var _0x538006=_0x5e85f2?_0x5aa0ff['count']:_0xe3be56[_0x3636('0x24')]+_0xe3be56[_0x3636('0x26')];var _0x42b271;if(_0x538006>=_0xe0e633){_0x538006=_0xe0e633;_0x42b271=0xc8;}else{_0x42b271=0xce;}_0x4aa7fc['status'](_0x42b271);return _0x4aa7fc[_0x3636('0x28')](_0x3636('0x29'),_0xa2b8fe+'-'+_0x538006+'/'+_0xe0e633)[_0x3636('0x23')](_0x5aa0ff);}return null;};}function patchUpdates(_0xe34cd9){return function(_0x325dce){try{jsonpatch[_0x3636('0x2a')](_0x325dce,_0xe34cd9,!![]);}catch(_0x4f5b0e){return BPromise['reject'](_0x4f5b0e);}return _0x325dce[_0x3636('0x2b')]();};}function saveUpdates(_0x4ee098,_0x50ba2f){return function(_0x8b3182){if(_0x8b3182){return _0x8b3182['update'](_0x4ee098)[_0x3636('0x2c')](function(_0x4c24cf){return _0x4c24cf;});}return null;};}function removeEntity(_0x36f4c5,_0x477c34){return function(_0xbf9a67){if(_0xbf9a67){return _0xbf9a67[_0x3636('0x2d')]()[_0x3636('0x2c')](function(){_0x36f4c5[_0x3636('0x21')](0xcc)[_0x3636('0x22')]();});}};}function handleEntityNotFound(_0x3c3d45,_0x37ad2d){return function(_0x701651){if(!_0x701651){_0x3c3d45[_0x3636('0x20')](0x194);}return _0x701651;};}function handleError(_0x550443,_0x43811e){_0x43811e=_0x43811e||0x1f4;return function(_0x236f54){logger[_0x3636('0x2e')](_0x236f54[_0x3636('0x2f')]);if(_0x236f54[_0x3636('0x30')]){delete _0x236f54[_0x3636('0x30')];}_0x550443['status'](_0x43811e)[_0x3636('0x31')](_0x236f54);};}exports[_0x3636('0x32')]=function(_0x5ce0ee,_0x8fffb0){var _0x26b6de={'raw':![],'where':{'id':_0x5ce0ee[_0x3636('0x33')]['id']}},_0x306774={};_0x306774[_0x3636('0x34')]=_['keys'](db[_0x3636('0x35')][_0x3636('0x36')]);_0x306774[_0x3636('0x37')]=_[_0x3636('0x38')](_0x5ce0ee[_0x3636('0x37')]);_0x306774[_0x3636('0x39')]=_[_0x3636('0x3a')](_0x306774[_0x3636('0x34')],_0x306774[_0x3636('0x37')]);_0x26b6de['attributes']=_['intersection'](_0x306774[_0x3636('0x34')],qs['fields'](_0x5ce0ee['query'][_0x3636('0x3b')]));_0x26b6de[_0x3636('0x3c')]=_0x26b6de[_0x3636('0x3c')]['length']?_0x26b6de[_0x3636('0x3c')]:_0x306774[_0x3636('0x34')];if(_0x5ce0ee[_0x3636('0x37')][_0x3636('0x3d')]){_0x26b6de[_0x3636('0x3e')]=[{'all':!![]}];}_0x26b6de=_[_0x3636('0x3f')]({},_0x26b6de,_0x5ce0ee[_0x3636('0x40')]);return db[_0x3636('0x35')][_0x3636('0x41')](_0x26b6de)[_0x3636('0x2c')](handleEntityNotFound(_0x8fffb0,null))[_0x3636('0x2c')](respondWithResult(_0x8fffb0,null))[_0x3636('0x42')](handleError(_0x8fffb0,null));};exports[_0x3636('0x2d')]=function(_0x488d51,_0x27b929){return db[_0x3636('0x35')][_0x3636('0x41')]({'where':{'id':_0x488d51[_0x3636('0x33')]['id']}})['then'](handleEntityNotFound(_0x27b929,null))['then'](removeEntity(_0x27b929,null))[_0x3636('0x42')](handleError(_0x27b929,null));};function widgetAttributes(_0x3807ad){try{switch(_0x3807ad[_0x3636('0x43')]){case'iframe':return[{'name':_0x3636('0x44'),'value':_0x3807ad[_0x3636('0x44')]||(_0x3807ad['attrs']&&_0x3807ad['attrs'][0x0]?_0x3807ad[_0x3636('0x45')][0x0]['value']:undefined)||_0x3636('0x46')}];case _0x3636('0x47'):return[{'name':_0x3636('0x48'),'value':_0x3807ad[_0x3636('0x48')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x0]?_0x3807ad[_0x3636('0x45')][0x0][_0x3636('0x49')]:undefined)||''}];case _0x3636('0x4a'):return[{'name':'attrHourFormat','value':_0x3807ad[_0x3636('0x4b')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x0]?_0x3807ad[_0x3636('0x45')][0x0][_0x3636('0x49')]:undefined)||_0x3636('0x4c')},{'name':_0x3636('0x4d'),'value':_0x3807ad[_0x3636('0x4d')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad['attrs'][0x1]?_0x3807ad[_0x3636('0x45')][0x1][_0x3636('0x49')]:undefined)||_0x3636('0x4e')},{'name':_0x3636('0x4f'),'value':_0x3807ad[_0x3636('0x4f')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x2]?_0x3807ad[_0x3636('0x45')][0x2][_0x3636('0x49')]:undefined)||0xc}];case _0x3636('0x50'):return[{'name':_0x3636('0x51'),'value':_0x3807ad[_0x3636('0x51')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x0]?_0x3807ad[_0x3636('0x45')][0x0]['value']:undefined)||_0x3636('0x52')},{'name':_0x3636('0x53'),'value':_0x3807ad[_0x3636('0x53')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x1]?_0x3807ad[_0x3636('0x45')][0x1][_0x3636('0x49')]:undefined)||[]},{'name':_0x3636('0x4f'),'value':_0x3807ad[_0x3636('0x4f')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x2]?_0x3807ad[_0x3636('0x45')][0x2][_0x3636('0x49')]:undefined)||0x14},{'name':'attrChannel','value':_0x3807ad['attrChannel']||(_0x3807ad['attrs']&&_0x3807ad[_0x3636('0x45')][0x3]?_0x3807ad['attrs'][0x3]['value']:undefined)||_0x3636('0x54')},{'name':_0x3636('0x55'),'value':_0x3807ad[_0x3636('0x55')]||(_0x3807ad['attrs']&&_0x3807ad[_0x3636('0x45')][0x4]?_0x3807ad[_0x3636('0x45')][0x4][_0x3636('0x49')]:undefined)||''},{'name':_0x3636('0x56'),'value':_0x3807ad[_0x3636('0x56')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x5]?_0x3807ad[_0x3636('0x45')][0x5][_0x3636('0x49')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3807ad[_0x3636('0x57')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x6]?_0x3807ad[_0x3636('0x45')][0x6][_0x3636('0x49')]:undefined)||''},{'name':_0x3636('0x58'),'value':_0x3807ad['attrOpenchannelAccounts']||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x7]?_0x3807ad[_0x3636('0x45')][0x7][_0x3636('0x49')]:undefined)||''},{'name':_0x3636('0x59'),'value':_0x3807ad['attrWhatsappAccounts']||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x8]?_0x3807ad[_0x3636('0x45')][0x8][_0x3636('0x49')]:undefined)||''},{'name':_0x3636('0x5a'),'value':_0x3807ad['attrChatWebsites']||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad['attrs'][0x9]?_0x3807ad['attrs'][0x9][_0x3636('0x49')]:undefined)||''}];case _0x3636('0x5b'):case _0x3636('0x5c'):return[{'name':_0x3636('0x5d'),'value':_0x3807ad['attrSerie1']||(_0x3807ad['attrs']&&_0x3807ad[_0x3636('0x45')][0x0]?_0x3807ad[_0x3636('0x45')][0x0][_0x3636('0x49')]:undefined)||_0x3636('0x52')},{'name':_0x3636('0x5e'),'value':_0x3807ad[_0x3636('0x5e')]||(_0x3807ad['attrs']&&_0x3807ad[_0x3636('0x45')][0x1]?_0x3807ad[_0x3636('0x45')][0x1][_0x3636('0x49')]:undefined)||null},{'name':_0x3636('0x5f'),'value':_0x3807ad[_0x3636('0x5f')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x2]?_0x3807ad[_0x3636('0x45')][0x2]['value']:undefined)||null},{'name':_0x3636('0x53'),'value':_0x3807ad['attrVoiceQueues']||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad['attrs'][0x3]?_0x3807ad[_0x3636('0x45')][0x3][_0x3636('0x49')]:undefined)||[]},{'name':_0x3636('0x60'),'value':_0x3807ad[_0x3636('0x60')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x4]?_0x3807ad['attrs'][0x4][_0x3636('0x49')]:undefined)||'voice'},{'name':_0x3636('0x55'),'value':_0x3807ad[_0x3636('0x55')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x5]?_0x3807ad['attrs'][0x5][_0x3636('0x49')]:undefined)||''},{'name':_0x3636('0x56'),'value':_0x3807ad[_0x3636('0x56')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x6]?_0x3807ad[_0x3636('0x45')][0x6][_0x3636('0x49')]:undefined)||''},{'name':_0x3636('0x57'),'value':_0x3807ad[_0x3636('0x57')]||(_0x3807ad['attrs']&&_0x3807ad[_0x3636('0x45')][0x7]?_0x3807ad[_0x3636('0x45')][0x7][_0x3636('0x49')]:undefined)||''},{'name':_0x3636('0x58'),'value':_0x3807ad[_0x3636('0x58')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x8]?_0x3807ad[_0x3636('0x45')][0x8][_0x3636('0x49')]:undefined)||''},{'name':_0x3636('0x59'),'value':_0x3807ad[_0x3636('0x59')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x9]?_0x3807ad[_0x3636('0x45')][0x9][_0x3636('0x49')]:undefined)||''},{'name':_0x3636('0x5a'),'value':_0x3807ad[_0x3636('0x5a')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0xa]?_0x3807ad[_0x3636('0x45')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x3636('0x61'),'type':_0x3807ad[_0x3636('0x62')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad[_0x3636('0x45')][0x0]?_0x3807ad[_0x3636('0x45')][0x0][_0x3636('0x43')]:undefined)||null,'value':_0x3807ad[_0x3636('0x61')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad['attrs'][0x0]?_0x3807ad[_0x3636('0x45')][0x0]['value']:undefined)||null},{'name':_0x3636('0x63'),'value':_0x3807ad[_0x3636('0x63')]||(_0x3807ad[_0x3636('0x45')]&&_0x3807ad['attrs'][0x1]?_0x3807ad[_0x3636('0x45')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x38d542){logger[_0x3636('0x2e')](_0x3636('0x64'),JSON[_0x3636('0x65')](_0x38d542));return[];}}exports[_0x3636('0x66')]=function(_0x466926,_0xd35a0e){if(_0x466926[_0x3636('0x67')]){_0x466926[_0x3636('0x67')][_0x3636('0x45')]=widgetAttributes(_0x466926['body']);}return db['DashboardItem']['create'](_0x466926[_0x3636('0x67')],{})['then'](respondWithResult(_0xd35a0e,0xc9))[_0x3636('0x42')](handleError(_0xd35a0e,null));};exports[_0x3636('0x68')]=function(_0x4216c9,_0x50b5a7){if(_0x4216c9[_0x3636('0x67')]['id']){delete _0x4216c9[_0x3636('0x67')]['id'];}_0x4216c9[_0x3636('0x67')][_0x3636('0x45')]=widgetAttributes(_0x4216c9['body']);return db[_0x3636('0x35')]['find']({'where':{'id':_0x4216c9[_0x3636('0x33')]['id']}})['then'](handleEntityNotFound(_0x50b5a7,null))['then'](saveUpdates(_0x4216c9[_0x3636('0x67')],null))[_0x3636('0x2c')](respondWithResult(_0x50b5a7,null))[_0x3636('0x42')](handleError(_0x50b5a7,null));}; \ No newline at end of file +var _0xa423=['../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','offset','limit','undefined','count','status','Content-Range','json','apply','reject','save','update','then','error','name','send','show','params','model','keys','DashboardItem','filters','intersection','query','attributes','fields','length','includeAll','options','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xa423,0x16c));var _0x3a42=function(_0x202b05,_0x5a246c){_0x202b05=_0x202b05-0x0;var _0x22a0a7=_0xa423[_0x202b05];return _0x22a0a7;};'use strict';var emlformat=require(_0x3a42('0x0'));var rimraf=require(_0x3a42('0x1'));var zipdir=require(_0x3a42('0x2'));var jsonpatch=require(_0x3a42('0x3'));var rp=require(_0x3a42('0x4'));var moment=require('moment');var BPromise=require(_0x3a42('0x5'));var Mustache=require(_0x3a42('0x6'));var util=require('util');var path=require(_0x3a42('0x7'));var sox=require(_0x3a42('0x8'));var csv=require(_0x3a42('0x9'));var ejs=require(_0x3a42('0xa'));var fs=require('fs');var fs_extra=require(_0x3a42('0xb'));var _=require('lodash');var squel=require(_0x3a42('0xc'));var crypto=require(_0x3a42('0xd'));var jsforce=require(_0x3a42('0xe'));var deskjs=require(_0x3a42('0xf'));var toCsv=require(_0x3a42('0x9'));var querystring=require(_0x3a42('0x10'));var Papa=require(_0x3a42('0x11'));var Redis=require(_0x3a42('0x12'));var authService=require(_0x3a42('0x13'));var qs=require(_0x3a42('0x14'));var as=require(_0x3a42('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a42('0x16'))(_0x3a42('0x17'));var utils=require(_0x3a42('0x18'));var config=require(_0x3a42('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3a42('0x1a')]=_['defaults'](config[_0x3a42('0x1a')],{'host':_0x3a42('0x1b'),'port':0x18eb});var socket=require(_0x3a42('0x1c'))(new Redis(config[_0x3a42('0x1a')]));require(_0x3a42('0x1d'))[_0x3a42('0x1e')](socket);function respondWithStatusCode(_0x5f5244,_0xd32889){_0xd32889=_0xd32889||0xcc;return function(_0x4f715c){if(_0x4f715c){return _0x5f5244[_0x3a42('0x1f')](_0xd32889);}return _0x5f5244['status'](_0xd32889)[_0x3a42('0x20')]();};}function respondWithResult(_0x5895a8,_0x46ef1e){_0x46ef1e=_0x46ef1e||0xc8;return function(_0x4edcf5){if(_0x4edcf5){return _0x5895a8['status'](_0x46ef1e)['json'](_0x4edcf5);}};}function respondWithFilteredResult(_0x26c844,_0x3a1dd0){return function(_0x438cf1){if(_0x438cf1){var _0x39e620=typeof _0x3a1dd0[_0x3a42('0x21')]==='undefined'&&typeof _0x3a1dd0[_0x3a42('0x22')]===_0x3a42('0x23');var _0x49f00e=_0x438cf1[_0x3a42('0x24')];var _0xa89087=_0x39e620?0x0:_0x3a1dd0[_0x3a42('0x21')];var _0x59f337=_0x39e620?_0x438cf1[_0x3a42('0x24')]:_0x3a1dd0[_0x3a42('0x21')]+_0x3a1dd0[_0x3a42('0x22')];var _0x477605;if(_0x59f337>=_0x49f00e){_0x59f337=_0x49f00e;_0x477605=0xc8;}else{_0x477605=0xce;}_0x26c844[_0x3a42('0x25')](_0x477605);return _0x26c844['set'](_0x3a42('0x26'),_0xa89087+'-'+_0x59f337+'/'+_0x49f00e)[_0x3a42('0x27')](_0x438cf1);}return null;};}function patchUpdates(_0x379fe6){return function(_0x434283){try{jsonpatch[_0x3a42('0x28')](_0x434283,_0x379fe6,!![]);}catch(_0x5b41d2){return BPromise[_0x3a42('0x29')](_0x5b41d2);}return _0x434283[_0x3a42('0x2a')]();};}function saveUpdates(_0x477cb9,_0x1add9b){return function(_0x1540e5){if(_0x1540e5){return _0x1540e5[_0x3a42('0x2b')](_0x477cb9)[_0x3a42('0x2c')](function(_0x434044){return _0x434044;});}return null;};}function removeEntity(_0x2c4b3a,_0x3a3f87){return function(_0x29a4d0){if(_0x29a4d0){return _0x29a4d0['destroy']()[_0x3a42('0x2c')](function(){_0x2c4b3a[_0x3a42('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3027dd,_0x5b5897){return function(_0x462a56){if(!_0x462a56){_0x3027dd[_0x3a42('0x1f')](0x194);}return _0x462a56;};}function handleError(_0x409910,_0x299282){_0x299282=_0x299282||0x1f4;return function(_0x1559cd){logger[_0x3a42('0x2d')](_0x1559cd['stack']);if(_0x1559cd[_0x3a42('0x2e')]){delete _0x1559cd[_0x3a42('0x2e')];}_0x409910[_0x3a42('0x25')](_0x299282)[_0x3a42('0x2f')](_0x1559cd);};}exports[_0x3a42('0x30')]=function(_0x44ef39,_0x41776f){var _0x56ee5d={'raw':![],'where':{'id':_0x44ef39[_0x3a42('0x31')]['id']}},_0x2d6192={};_0x2d6192[_0x3a42('0x32')]=_[_0x3a42('0x33')](db[_0x3a42('0x34')]['rawAttributes']);_0x2d6192['query']=_[_0x3a42('0x33')](_0x44ef39['query']);_0x2d6192[_0x3a42('0x35')]=_[_0x3a42('0x36')](_0x2d6192[_0x3a42('0x32')],_0x2d6192[_0x3a42('0x37')]);_0x56ee5d[_0x3a42('0x38')]=_[_0x3a42('0x36')](_0x2d6192['model'],qs[_0x3a42('0x39')](_0x44ef39[_0x3a42('0x37')][_0x3a42('0x39')]));_0x56ee5d['attributes']=_0x56ee5d['attributes'][_0x3a42('0x3a')]?_0x56ee5d[_0x3a42('0x38')]:_0x2d6192[_0x3a42('0x32')];if(_0x44ef39[_0x3a42('0x37')][_0x3a42('0x3b')]){_0x56ee5d['include']=[{'all':!![]}];}_0x56ee5d=_['merge']({},_0x56ee5d,_0x44ef39[_0x3a42('0x3c')]);return db[_0x3a42('0x34')][_0x3a42('0x3d')](_0x56ee5d)[_0x3a42('0x2c')](handleEntityNotFound(_0x41776f,null))['then'](respondWithResult(_0x41776f,null))[_0x3a42('0x3e')](handleError(_0x41776f,null));};exports[_0x3a42('0x3f')]=function(_0x4fb43f,_0x479e5e){return db['DashboardItem'][_0x3a42('0x3d')]({'where':{'id':_0x4fb43f['params']['id']}})[_0x3a42('0x2c')](handleEntityNotFound(_0x479e5e,null))[_0x3a42('0x2c')](removeEntity(_0x479e5e,null))[_0x3a42('0x3e')](handleError(_0x479e5e,null));};function widgetAttributes(_0x1fcbcb){try{switch(_0x1fcbcb[_0x3a42('0x40')]){case _0x3a42('0x41'):return[{'name':_0x3a42('0x42'),'value':_0x1fcbcb[_0x3a42('0x42')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb['attrs'][0x0]?_0x1fcbcb[_0x3a42('0x43')][0x0][_0x3a42('0x44')]:undefined)||_0x3a42('0x45')}];case _0x3a42('0x46'):return[{'name':_0x3a42('0x47'),'value':_0x1fcbcb['attrPath']||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb['attrs'][0x0]?_0x1fcbcb['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x3a42('0x48'),'value':_0x1fcbcb['attrHourFormat']||(_0x1fcbcb['attrs']&&_0x1fcbcb['attrs'][0x0]?_0x1fcbcb[_0x3a42('0x43')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x3a42('0x49'),'value':_0x1fcbcb[_0x3a42('0x49')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x1]?_0x1fcbcb[_0x3a42('0x43')][0x1][_0x3a42('0x44')]:undefined)||'0.00'},{'name':_0x3a42('0x4a'),'value':_0x1fcbcb[_0x3a42('0x4a')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb['attrs'][0x2]?_0x1fcbcb[_0x3a42('0x43')][0x2][_0x3a42('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0x3a42('0x4b'),'value':_0x1fcbcb[_0x3a42('0x4b')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x0]?_0x1fcbcb[_0x3a42('0x43')][0x0][_0x3a42('0x44')]:undefined)||_0x3a42('0x4c')},{'name':'attrVoiceQueues','value':_0x1fcbcb[_0x3a42('0x4d')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x1]?_0x1fcbcb[_0x3a42('0x43')][0x1][_0x3a42('0x44')]:undefined)||[]},{'name':'attrFontSize','value':_0x1fcbcb[_0x3a42('0x4a')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x2]?_0x1fcbcb['attrs'][0x2][_0x3a42('0x44')]:undefined)||0x14},{'name':_0x3a42('0x4e'),'value':_0x1fcbcb[_0x3a42('0x4e')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x3]?_0x1fcbcb['attrs'][0x3][_0x3a42('0x44')]:undefined)||_0x3a42('0x4f')},{'name':_0x3a42('0x50'),'value':_0x1fcbcb[_0x3a42('0x50')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x4]?_0x1fcbcb[_0x3a42('0x43')][0x4][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x51'),'value':_0x1fcbcb[_0x3a42('0x51')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x5]?_0x1fcbcb['attrs'][0x5][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x52'),'value':_0x1fcbcb[_0x3a42('0x52')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x6]?_0x1fcbcb[_0x3a42('0x43')][0x6]['value']:undefined)||''},{'name':_0x3a42('0x53'),'value':_0x1fcbcb['attrOpenchannelAccounts']||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x7]?_0x1fcbcb[_0x3a42('0x43')][0x7][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x54'),'value':_0x1fcbcb[_0x3a42('0x54')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x8]?_0x1fcbcb[_0x3a42('0x43')][0x8]['value']:undefined)||''},{'name':_0x3a42('0x55'),'value':_0x1fcbcb[_0x3a42('0x55')]||(_0x1fcbcb['attrs']&&_0x1fcbcb['attrs'][0x9]?_0x1fcbcb[_0x3a42('0x43')][0x9][_0x3a42('0x44')]:undefined)||''}];case'multibar-chart':case _0x3a42('0x56'):return[{'name':_0x3a42('0x57'),'value':_0x1fcbcb[_0x3a42('0x57')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x0]?_0x1fcbcb[_0x3a42('0x43')][0x0]['value']:undefined)||_0x3a42('0x4c')},{'name':'attrSerie2','value':_0x1fcbcb[_0x3a42('0x58')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb['attrs'][0x1]?_0x1fcbcb[_0x3a42('0x43')][0x1][_0x3a42('0x44')]:undefined)||null},{'name':_0x3a42('0x59'),'value':_0x1fcbcb[_0x3a42('0x59')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x2]?_0x1fcbcb[_0x3a42('0x43')][0x2][_0x3a42('0x44')]:undefined)||null},{'name':_0x3a42('0x4d'),'value':_0x1fcbcb[_0x3a42('0x4d')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x3]?_0x1fcbcb[_0x3a42('0x43')][0x3][_0x3a42('0x44')]:undefined)||[]},{'name':_0x3a42('0x4e'),'value':_0x1fcbcb[_0x3a42('0x4e')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x4]?_0x1fcbcb[_0x3a42('0x43')][0x4][_0x3a42('0x44')]:undefined)||'voice'},{'name':_0x3a42('0x50'),'value':_0x1fcbcb[_0x3a42('0x50')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x5]?_0x1fcbcb[_0x3a42('0x43')][0x5][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x51'),'value':_0x1fcbcb[_0x3a42('0x51')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb['attrs'][0x6]?_0x1fcbcb['attrs'][0x6]['value']:undefined)||''},{'name':_0x3a42('0x52'),'value':_0x1fcbcb[_0x3a42('0x52')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x7]?_0x1fcbcb['attrs'][0x7][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x53'),'value':_0x1fcbcb[_0x3a42('0x53')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x8]?_0x1fcbcb[_0x3a42('0x43')][0x8]['value']:undefined)||''},{'name':_0x3a42('0x54'),'value':_0x1fcbcb[_0x3a42('0x54')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x9]?_0x1fcbcb[_0x3a42('0x43')][0x9][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x55'),'value':_0x1fcbcb[_0x3a42('0x55')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0xa]?_0x1fcbcb[_0x3a42('0x43')][0xa][_0x3a42('0x44')]:undefined)||''}];case _0x3a42('0x5a'):return[{'name':_0x3a42('0x5b'),'type':_0x1fcbcb[_0x3a42('0x5c')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x0]?_0x1fcbcb[_0x3a42('0x43')][0x0]['type']:undefined)||null,'value':_0x1fcbcb[_0x3a42('0x5b')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x0]?_0x1fcbcb['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x1fcbcb[_0x3a42('0x5d')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x1]?_0x1fcbcb[_0x3a42('0x43')][0x1][_0x3a42('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x3cf363){logger[_0x3a42('0x2d')]('widgetAttributes:\x20%s',JSON[_0x3a42('0x5e')](_0x3cf363));return[];}}exports[_0x3a42('0x5f')]=function(_0x5986fc,_0xbe17c3){if(_0x5986fc[_0x3a42('0x60')]){_0x5986fc['body'][_0x3a42('0x43')]=widgetAttributes(_0x5986fc['body']);}return db[_0x3a42('0x34')]['create'](_0x5986fc[_0x3a42('0x60')],{})[_0x3a42('0x2c')](respondWithResult(_0xbe17c3,0xc9))[_0x3a42('0x3e')](handleError(_0xbe17c3,null));};exports[_0x3a42('0x2b')]=function(_0x3d448e,_0x46a14d){if(_0x3d448e[_0x3a42('0x60')]['id']){delete _0x3d448e['body']['id'];}_0x3d448e[_0x3a42('0x60')][_0x3a42('0x43')]=widgetAttributes(_0x3d448e['body']);return db[_0x3a42('0x34')][_0x3a42('0x3d')]({'where':{'id':_0x3d448e['params']['id']}})[_0x3a42('0x2c')](handleEntityNotFound(_0x46a14d,null))[_0x3a42('0x2c')](saveUpdates(_0x3d448e[_0x3a42('0x60')],null))[_0x3a42('0x2c')](respondWithResult(_0x46a14d,null))[_0x3a42('0x3e')](handleError(_0x46a14d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 98fc4e7..0470ac1 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 _0xcbe1=['../../mysqldb','DashboardItem','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x32de1c,_0x1b9e3b){var _0x34efc5=function(_0x16779d){while(--_0x16779d){_0x32de1c['push'](_0x32de1c['shift']());}};_0x34efc5(++_0x1b9e3b);}(_0xcbe1,0xd7));var _0x1cbe=function(_0x43ddb5,_0x2eafc0){_0x43ddb5=_0x43ddb5-0x0;var _0x540961=_0xcbe1[_0x43ddb5];return _0x540961;};'use strict';var EventEmitter=require(_0x1cbe('0x0'));var DashboardItem=require(_0x1cbe('0x1'))['db'][_0x1cbe('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cbe('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x205ea1){return function(_0x4865c2,_0x402af5,_0x11acde){DashboardItemEvents[_0x1cbe('0x4')](_0x205ea1+':'+_0x4865c2['id'],_0x4865c2);DashboardItemEvents[_0x1cbe('0x4')](_0x205ea1,_0x4865c2);_0x11acde(null);};}for(var e in events){if(events[_0x1cbe('0x5')](e)){var event=events[e];DashboardItem[_0x1cbe('0x6')](e,emitEvent(event));}}module[_0x1cbe('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x6054=['DashboardItem','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6054,0x127));var _0x4605=function(_0x5f1d5a,_0x1c85a7){_0x5f1d5a=_0x5f1d5a-0x0;var _0x449071=_0x6054[_0x5f1d5a];return _0x449071;};'use strict';var EventEmitter=require(_0x4605('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x4605('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4605('0x2'),'afterUpdate':_0x4605('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4e4a89){return function(_0x216beb,_0x166281,_0x1f1088){DashboardItemEvents[_0x4605('0x4')](_0x4e4a89+':'+_0x216beb['id'],_0x216beb);DashboardItemEvents['emit'](_0x4e4a89,_0x216beb);_0x1f1088(null);};}for(var e in events){if(events[_0x4605('0x5')](e)){var event=events[e];DashboardItem[_0x4605('0x6')](e,emitEvent(event));}}module[_0x4605('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index af036ae..f8d6385 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 _0x63e1=['util','api','moment','bluebird','path','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','lodash'];(function(_0x13a422,_0x4465a4){var _0x9e7e83=function(_0x111831){while(--_0x111831){_0x13a422['push'](_0x13a422['shift']());}};_0x9e7e83(++_0x4465a4);}(_0x63e1,0x6d));var _0x163e=function(_0x4c3131,_0x491c5f){_0x4c3131=_0x4c3131-0x0;var _0x646470=_0x63e1[_0x4c3131];return _0x646470;};'use strict';var _=require(_0x163e('0x0'));var util=require(_0x163e('0x1'));var logger=require('../../config/logger')(_0x163e('0x2'));var moment=require(_0x163e('0x3'));var BPromise=require(_0x163e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x163e('0x5'));var rimraf=require(_0x163e('0x6'));var config=require('../../config/environment');var attributes=require(_0x163e('0x7'));module[_0x163e('0x8')]=function(_0x260bd,_0x4e2ac6){return _0x260bd[_0x163e('0x9')](_0x163e('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0852=['./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3b362b,_0x21cfc3){var _0x4542c0=function(_0x11a2ec){while(--_0x11a2ec){_0x3b362b['push'](_0x3b362b['shift']());}};_0x4542c0(++_0x21cfc3);}(_0x0852,0x130));var _0x2085=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x0852[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x2085('0x0'));var util=require(_0x2085('0x1'));var logger=require(_0x2085('0x2'))(_0x2085('0x3'));var moment=require(_0x2085('0x4'));var BPromise=require('bluebird');var rp=require(_0x2085('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2085('0x6'));var config=require(_0x2085('0x7'));var attributes=require(_0x2085('0x8'));module[_0x2085('0x9')]=function(_0xf78836,_0xdaf21){return _0xf78836['define'](_0x2085('0xa'),attributes,{'tableName':_0x2085('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 7a1149d..d60aff8 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 _0x0c47=['request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register'];(function(_0x3396cd,_0x4047f0){var _0x2d6b4a=function(_0x389663){while(--_0x389663){_0x3396cd['push'](_0x3396cd['shift']());}};_0x2d6b4a(++_0x4047f0);}(_0x0c47,0xc8));var _0x70c4=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0x0c47[_0x2fbcf6];return _0x3e7265;};'use strict';var _=require(_0x70c4('0x0'));var util=require(_0x70c4('0x1'));var moment=require('moment');var BPromise=require(_0x70c4('0x2'));var rs=require(_0x70c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70c4('0x4'))['db'];var utils=require(_0x70c4('0x5'));var logger=require(_0x70c4('0x6'))(_0x70c4('0x7'));var config=require(_0x70c4('0x8'));var jayson=require(_0x70c4('0x9'));var client=jayson['client'][_0x70c4('0xa')]({'port':0x232a});config[_0x70c4('0xb')]=_['defaults'](config[_0x70c4('0xb')],{'host':_0x70c4('0xc'),'port':0x18eb});var socket=require(_0x70c4('0xd'))(new Redis(config[_0x70c4('0xb')]));require(_0x70c4('0xe'))[_0x70c4('0xf')](socket);function respondWithRpcPromise(_0x597d2b,_0x29adf2,_0x1c16e9){return new BPromise(function(_0x415642,_0xd831eb){return client[_0x70c4('0x10')](_0x597d2b,_0x1c16e9)[_0x70c4('0x11')](function(_0x4ea990){logger[_0x70c4('0x12')](_0x70c4('0x13'),_0x29adf2,'request\x20sent');logger[_0x70c4('0x14')](_0x70c4('0x15'),_0x29adf2,_0x70c4('0x16'),JSON[_0x70c4('0x17')](_0x4ea990));if(_0x4ea990['error']){if(_0x4ea990[_0x70c4('0x18')][_0x70c4('0x19')]===0x1f4){logger[_0x70c4('0x18')](_0x70c4('0x13'),_0x29adf2,_0x4ea990[_0x70c4('0x18')][_0x70c4('0x1a')]);return _0xd831eb(_0x4ea990[_0x70c4('0x18')][_0x70c4('0x1a')]);}logger[_0x70c4('0x18')](_0x70c4('0x13'),_0x29adf2,_0x4ea990[_0x70c4('0x18')]['message']);return _0x415642(_0x4ea990[_0x70c4('0x18')]['message']);}else{logger['info'](_0x70c4('0x13'),_0x29adf2,_0x70c4('0x16'));_0x415642(_0x4ea990['result'][_0x70c4('0x1a')]);}})['catch'](function(_0x3943ff){logger[_0x70c4('0x18')](_0x70c4('0x13'),_0x29adf2,_0x3943ff);_0xd831eb(_0x3943ff);});});} \ No newline at end of file +var _0xe254=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x35c1a5,_0x2e70ca){var _0x14efce=function(_0xa94b62){while(--_0xa94b62){_0x35c1a5['push'](_0x35c1a5['shift']());}};_0x14efce(++_0x2e70ca);}(_0xe254,0xaa));var _0x4e25=function(_0x3f8f64,_0x4acb83){_0x3f8f64=_0x3f8f64-0x0;var _0x2a6f78=_0xe254[_0x3f8f64];return _0x2a6f78;};'use strict';var _=require(_0x4e25('0x0'));var util=require(_0x4e25('0x1'));var moment=require(_0x4e25('0x2'));var BPromise=require(_0x4e25('0x3'));var rs=require(_0x4e25('0x4'));var fs=require('fs');var Redis=require(_0x4e25('0x5'));var db=require(_0x4e25('0x6'))['db'];var utils=require(_0x4e25('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x4e25('0x8'));var jayson=require(_0x4e25('0x9'));var client=jayson['client'][_0x4e25('0xa')]({'port':0x232a});config[_0x4e25('0xb')]=_[_0x4e25('0xc')](config[_0x4e25('0xb')],{'host':_0x4e25('0xd'),'port':0x18eb});var socket=require(_0x4e25('0xe'))(new Redis(config[_0x4e25('0xb')]));require(_0x4e25('0xf'))['register'](socket);function respondWithRpcPromise(_0x2e0db2,_0x239c51,_0x5b5b78){return new BPromise(function(_0x19280e,_0x2d2e43){return client[_0x4e25('0x10')](_0x2e0db2,_0x5b5b78)[_0x4e25('0x11')](function(_0x2112b5){logger[_0x4e25('0x12')](_0x4e25('0x13'),_0x239c51,_0x4e25('0x14'));logger[_0x4e25('0x15')](_0x4e25('0x16'),_0x239c51,_0x4e25('0x14'),JSON[_0x4e25('0x17')](_0x2112b5));if(_0x2112b5[_0x4e25('0x18')]){if(_0x2112b5[_0x4e25('0x18')][_0x4e25('0x19')]===0x1f4){logger[_0x4e25('0x18')]('DashboardItem,\x20%s,\x20%s',_0x239c51,_0x2112b5[_0x4e25('0x18')][_0x4e25('0x1a')]);return _0x2d2e43(_0x2112b5[_0x4e25('0x18')][_0x4e25('0x1a')]);}logger[_0x4e25('0x18')](_0x4e25('0x13'),_0x239c51,_0x2112b5[_0x4e25('0x18')][_0x4e25('0x1a')]);return _0x19280e(_0x2112b5['error'][_0x4e25('0x1a')]);}else{logger[_0x4e25('0x12')](_0x4e25('0x13'),_0x239c51,'request\x20sent');_0x19280e(_0x2112b5['result'][_0x4e25('0x1a')]);}})[_0x4e25('0x1b')](function(_0x563463){logger[_0x4e25('0x18')](_0x4e25('0x13'),_0x239c51,_0x563463);_0x2d2e43(_0x563463);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5293230..795faf6 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 _0x8f15=['./dashboardItem.events','save','emit','length','dashboardItem:'];(function(_0x258f50,_0x2a4bd1){var _0x5699d7=function(_0x48e9fb){while(--_0x48e9fb){_0x258f50['push'](_0x258f50['shift']());}};_0x5699d7(++_0x2a4bd1);}(_0x8f15,0x15e));var _0x58f1=function(_0x58a64e,_0x2951fb){_0x58a64e=_0x58a64e-0x0;var _0x5969fd=_0x8f15[_0x58a64e];return _0x5969fd;};'use strict';var DashboardItemEvents=require(_0x58f1('0x0'));var events=[_0x58f1('0x1'),'remove','update'];function createListener(_0x45322c,_0x47a669){return function(_0x705118){_0x47a669[_0x58f1('0x2')](_0x45322c,_0x705118);};}function removeListener(_0x386c6,_0x30021a){return function(){DashboardItemEvents['removeListener'](_0x386c6,_0x30021a);};}exports['register']=function(_0x19fa16){for(var _0x5a2b8e=0x0,_0x1a080d=events[_0x58f1('0x3')];_0x5a2b8e<_0x1a080d;_0x5a2b8e++){var _0x3461fe=events[_0x5a2b8e];var _0x120789=createListener(_0x58f1('0x4')+_0x3461fe,_0x19fa16);DashboardItemEvents['on'](_0x3461fe,_0x120789);}}; \ No newline at end of file +var _0xba76=['remove','emit','dashboardItem:','./dashboardItem.events','save'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xba76,0x116));var _0x6ba7=function(_0x4835c1,_0x1527a3){_0x4835c1=_0x4835c1-0x0;var _0x50e995=_0xba76[_0x4835c1];return _0x50e995;};'use strict';var DashboardItemEvents=require(_0x6ba7('0x0'));var events=[_0x6ba7('0x1'),_0x6ba7('0x2'),'update'];function createListener(_0x458fd6,_0x577d4e){return function(_0x115dc5){_0x577d4e[_0x6ba7('0x3')](_0x458fd6,_0x115dc5);};}function removeListener(_0x4d4f26,_0x40162c){return function(){DashboardItemEvents['removeListener'](_0x4d4f26,_0x40162c);};}exports['register']=function(_0x2754a5){for(var _0x1739d4=0x0,_0x1c24a3=events['length'];_0x1739d4<_0x1c24a3;_0x1739d4++){var _0x3cd4d5=events[_0x1739d4];var _0x55394f=createListener(_0x6ba7('0x4')+_0x3cd4d5,_0x2754a5);DashboardItemEvents['on'](_0x3cd4d5,_0x55394f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ba013e2..206ea61 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 _0x3aba=['/:id','isAuthenticated','create','put','update','delete','destroy','exports','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x5d43b7,_0x2403d5){var _0x31d19a=function(_0x2a93cb){while(--_0x2a93cb){_0x5d43b7['push'](_0x5d43b7['shift']());}};_0x31d19a(++_0x2403d5);}(_0x3aba,0xe8));var _0xa3ab=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0x3aba[_0x4c9380];return _0x49a523;};'use strict';var multer=require('multer');var util=require(_0xa3ab('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa3ab('0x1'));var interaction=require(_0xa3ab('0x2'));var config=require(_0xa3ab('0x3'));var controller=require(_0xa3ab('0x4'));router[_0xa3ab('0x5')](_0xa3ab('0x6'),auth[_0xa3ab('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa3ab('0x8')]);router[_0xa3ab('0x9')](_0xa3ab('0x6'),auth[_0xa3ab('0x7')](),controller[_0xa3ab('0xa')]);router[_0xa3ab('0xb')]('/:id',auth[_0xa3ab('0x7')](),controller[_0xa3ab('0xc')]);module[_0xa3ab('0xd')]=router; \ No newline at end of file +var _0x333c=['../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x333c,0x1a3));var _0xc333=function(_0x3500d7,_0x1ac308){_0x3500d7=_0x3500d7-0x0;var _0x41b7fc=_0x333c[_0x3500d7];return _0x41b7fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc333('0x0'));var timeout=require(_0xc333('0x1'));var express=require(_0xc333('0x2'));var router=express['Router']();var fs_extra=require(_0xc333('0x3'));var auth=require(_0xc333('0x4'));var interaction=require(_0xc333('0x5'));var config=require(_0xc333('0x6'));var controller=require(_0xc333('0x7'));router[_0xc333('0x8')](_0xc333('0x9'),auth[_0xc333('0xa')](),controller['show']);router[_0xc333('0xb')]('/',auth[_0xc333('0xa')](),controller['create']);router[_0xc333('0xc')](_0xc333('0x9'),auth[_0xc333('0xa')](),controller[_0xc333('0xd')]);router[_0xc333('0xe')](_0xc333('0x9'),auth[_0xc333('0xa')](),controller[_0xc333('0xf')]);module[_0xc333('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index c43c63d..5ce2723 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 _0xf731=['first','second','third','sequelize','STRING'];(function(_0x18e333,_0x1caf42){var _0x41c26e=function(_0x3e3606){while(--_0x3e3606){_0x18e333['push'](_0x18e333['shift']());}};_0x41c26e(++_0x1caf42);}(_0xf731,0x13e));var _0x1f73=function(_0x183a2c,_0x4f851b){_0x183a2c=_0x183a2c-0x0;var _0x4ec838=_0xf731[_0x183a2c];return _0x4ec838;};'use strict';var Sequelize=require(_0x1f73('0x0'));module['exports']={'name':{'type':Sequelize[_0x1f73('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x1f73('0x2'),_0x1f73('0x3'),_0x1f73('0x4')),'allowNull':![],'defaultValue':_0x1f73('0x2')},'description':{'type':Sequelize[_0x1f73('0x1')]}}; \ No newline at end of file +var _0x2e80=['first','second','third','sequelize','STRING','ENUM'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x2e80,0x1e3));var _0x02e8=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0x2e80[_0x568cf0];return _0x360f81;};'use strict';var Sequelize=require(_0x02e8('0x0'));module['exports']={'name':{'type':Sequelize[_0x02e8('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x02e8('0x2')](_0x02e8('0x3'),_0x02e8('0x4'),_0x02e8('0x5')),'allowNull':![],'defaultValue':_0x02e8('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e972cbf..1802de8 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 _0x39bb=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','include','findAll','show','params','intersection','find','catch','create','body','user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0x39bb,0x1f4));var _0xb39b=function(_0x252834,_0x55f763){_0x252834=_0x252834-0x0;var _0x58c864=_0x39bb[_0x252834];return _0x58c864;};'use strict';var emlformat=require(_0xb39b('0x0'));var rimraf=require(_0xb39b('0x1'));var zipdir=require(_0xb39b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb39b('0x3'));var moment=require('moment');var BPromise=require(_0xb39b('0x4'));var Mustache=require(_0xb39b('0x5'));var util=require(_0xb39b('0x6'));var path=require(_0xb39b('0x7'));var sox=require(_0xb39b('0x8'));var csv=require(_0xb39b('0x9'));var ejs=require(_0xb39b('0xa'));var fs=require('fs');var fs_extra=require(_0xb39b('0xb'));var _=require(_0xb39b('0xc'));var squel=require(_0xb39b('0xd'));var crypto=require(_0xb39b('0xe'));var jsforce=require(_0xb39b('0xf'));var deskjs=require(_0xb39b('0x10'));var toCsv=require(_0xb39b('0x9'));var querystring=require('querystring');var Papa=require(_0xb39b('0x11'));var Redis=require(_0xb39b('0x12'));var authService=require(_0xb39b('0x13'));var qs=require(_0xb39b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb39b('0x15'));var logger=require(_0xb39b('0x16'))(_0xb39b('0x17'));var utils=require(_0xb39b('0x18'));var config=require(_0xb39b('0x19'));var licenseUtil=require(_0xb39b('0x1a'));var db=require(_0xb39b('0x1b'))['db'];function respondWithStatusCode(_0xcd1463,_0xda33d8){_0xda33d8=_0xda33d8||0xcc;return function(_0x17ed6a){if(_0x17ed6a){return _0xcd1463[_0xb39b('0x1c')](_0xda33d8);}return _0xcd1463[_0xb39b('0x1d')](_0xda33d8)[_0xb39b('0x1e')]();};}function respondWithResult(_0x27ff7b,_0x1ea7a4){_0x1ea7a4=_0x1ea7a4||0xc8;return function(_0xd90ee4){if(_0xd90ee4){return _0x27ff7b[_0xb39b('0x1d')](_0x1ea7a4)[_0xb39b('0x1f')](_0xd90ee4);}};}function respondWithFilteredResult(_0x4843a9,_0x2f39bd){return function(_0x1f5f83){if(_0x1f5f83){var _0x1e1f51=typeof _0x2f39bd[_0xb39b('0x20')]===_0xb39b('0x21')&&typeof _0x2f39bd[_0xb39b('0x22')]===_0xb39b('0x21');var _0x4c0c24=_0x1f5f83[_0xb39b('0x23')];var _0xe7dba3=_0x1e1f51?0x0:_0x2f39bd['offset'];var _0x39c03c=_0x1e1f51?_0x1f5f83['count']:_0x2f39bd[_0xb39b('0x20')]+_0x2f39bd[_0xb39b('0x22')];var _0xb24a11;if(_0x39c03c>=_0x4c0c24){_0x39c03c=_0x4c0c24;_0xb24a11=0xc8;}else{_0xb24a11=0xce;}_0x4843a9[_0xb39b('0x1d')](_0xb24a11);return _0x4843a9[_0xb39b('0x24')]('Content-Range',_0xe7dba3+'-'+_0x39c03c+'/'+_0x4c0c24)[_0xb39b('0x1f')](_0x1f5f83);}return null;};}function patchUpdates(_0x14c2d6){return function(_0x3e5818){try{jsonpatch['apply'](_0x3e5818,_0x14c2d6,!![]);}catch(_0x44d772){return BPromise[_0xb39b('0x25')](_0x44d772);}return _0x3e5818['save']();};}function saveUpdates(_0x532395,_0x328e3f){return function(_0x322d93){if(_0x322d93){return _0x322d93['update'](_0x532395)[_0xb39b('0x26')](function(_0x1a9b6c){return _0x1a9b6c;});}return null;};}function removeEntity(_0x5d7b0d,_0x261935){return function(_0x2f702f){if(_0x2f702f){return _0x2f702f['destroy']()[_0xb39b('0x26')](function(){var _0x482513=_0x2f702f[_0xb39b('0x27')]({'plain':!![]});var _0x561615='Dispositions';return db[_0xb39b('0x28')][_0xb39b('0x29')]({'where':{'type':_0x561615,'resourceId':_0x482513['id']}})[_0xb39b('0x26')](function(){return _0x2f702f;});})['then'](function(){_0x5d7b0d[_0xb39b('0x1d')](0xcc)[_0xb39b('0x1e')]();});}};}function handleEntityNotFound(_0x1b57d4,_0x2bb8d8){return function(_0x313b97){if(!_0x313b97){_0x1b57d4[_0xb39b('0x1c')](0x194);}return _0x313b97;};}function handleError(_0x505a64,_0xeb1057){_0xeb1057=_0xeb1057||0x1f4;return function(_0x1bd258){logger[_0xb39b('0x2a')](_0x1bd258[_0xb39b('0x2b')]);if(_0x1bd258['name']){delete _0x1bd258[_0xb39b('0x2c')];}_0x505a64[_0xb39b('0x1d')](_0xeb1057)[_0xb39b('0x2d')](_0x1bd258);};}exports[_0xb39b('0x2e')]=function(_0x2bd589,_0x4c1d21){var _0x443b82={},_0x444994={},_0x5195b8={'count':0x0,'rows':[]};var _0x352b51=_[_0xb39b('0x2f')](db[_0xb39b('0x30')][_0xb39b('0x31')],function(_0x1316ef){return{'name':_0x1316ef[_0xb39b('0x32')],'type':_0x1316ef['type'][_0xb39b('0x33')]};});_0x444994[_0xb39b('0x34')]=_['map'](_0x352b51,'name');_0x444994[_0xb39b('0x35')]=_[_0xb39b('0x36')](_0x2bd589[_0xb39b('0x35')]);_0x444994['filters']=_['intersection'](_0x444994['model'],_0x444994['query']);_0x443b82['attributes']=_['intersection'](_0x444994['model'],qs[_0xb39b('0x37')](_0x2bd589[_0xb39b('0x35')]['fields']));_0x443b82[_0xb39b('0x38')]=_0x443b82[_0xb39b('0x38')][_0xb39b('0x39')]?_0x443b82[_0xb39b('0x38')]:_0x444994[_0xb39b('0x34')];if(!_0x2bd589[_0xb39b('0x35')][_0xb39b('0x3a')](_0xb39b('0x3b'))){_0x443b82['limit']=qs[_0xb39b('0x22')](_0x2bd589[_0xb39b('0x35')][_0xb39b('0x22')]);_0x443b82[_0xb39b('0x20')]=qs[_0xb39b('0x20')](_0x2bd589[_0xb39b('0x35')][_0xb39b('0x20')]);}_0x443b82[_0xb39b('0x3c')]=qs['sort'](_0x2bd589[_0xb39b('0x35')][_0xb39b('0x3d')]);_0x443b82[_0xb39b('0x3e')]=qs[_0xb39b('0x3f')](_[_0xb39b('0x40')](_0x2bd589[_0xb39b('0x35')],_0x444994[_0xb39b('0x3f')]),_0x352b51);if(_0x2bd589[_0xb39b('0x35')][_0xb39b('0x41')]){_0x443b82[_0xb39b('0x3e')]=_['merge'](_0x443b82['where'],{'$or':_[_0xb39b('0x2f')](_0x352b51,function(_0x25d6b6){if(_0x25d6b6[_0xb39b('0x42')]!=='VIRTUAL'){var _0x251ae8={};_0x251ae8[_0x25d6b6['name']]={'$like':'%'+_0x2bd589[_0xb39b('0x35')]['filter']+'%'};return _0x251ae8;}})});}_0x443b82=_[_0xb39b('0x43')]({},_0x443b82,_0x2bd589['options']);var _0x487ded={'where':_0x443b82[_0xb39b('0x3e')]};return db[_0xb39b('0x30')][_0xb39b('0x23')](_0x487ded)[_0xb39b('0x26')](function(_0x4d6462){_0x5195b8['count']=_0x4d6462;if(_0x2bd589[_0xb39b('0x35')]['includeAll']){_0x443b82[_0xb39b('0x44')]=[{'all':!![]}];}return db[_0xb39b('0x30')][_0xb39b('0x45')](_0x443b82);})[_0xb39b('0x26')](function(_0x3e9db1){_0x5195b8['rows']=_0x3e9db1;return _0x5195b8;})['then'](respondWithFilteredResult(_0x4c1d21,_0x443b82))['catch'](handleError(_0x4c1d21,null));};exports[_0xb39b('0x46')]=function(_0xf63c35,_0x538265){var _0x53b85a={'raw':!![],'where':{'id':_0xf63c35[_0xb39b('0x47')]['id']}},_0x527121={};_0x527121[_0xb39b('0x34')]=_[_0xb39b('0x36')](db['Disposition']['rawAttributes']);_0x527121[_0xb39b('0x35')]=_[_0xb39b('0x36')](_0xf63c35['query']);_0x527121[_0xb39b('0x3f')]=_[_0xb39b('0x48')](_0x527121[_0xb39b('0x34')],_0x527121['query']);_0x53b85a[_0xb39b('0x38')]=_[_0xb39b('0x48')](_0x527121[_0xb39b('0x34')],qs[_0xb39b('0x37')](_0xf63c35[_0xb39b('0x35')][_0xb39b('0x37')]));_0x53b85a[_0xb39b('0x38')]=_0x53b85a['attributes'][_0xb39b('0x39')]?_0x53b85a['attributes']:_0x527121['model'];if(_0xf63c35[_0xb39b('0x35')]['includeAll']){_0x53b85a[_0xb39b('0x44')]=[{'all':!![]}];}_0x53b85a=_[_0xb39b('0x43')]({},_0x53b85a,_0xf63c35['options']);return db[_0xb39b('0x30')][_0xb39b('0x49')](_0x53b85a)[_0xb39b('0x26')](handleEntityNotFound(_0x538265,null))[_0xb39b('0x26')](respondWithResult(_0x538265,null))[_0xb39b('0x4a')](handleError(_0x538265,null));};exports[_0xb39b('0x4b')]=function(_0x53e82a,_0x313a20){return db['Disposition']['create'](_0x53e82a[_0xb39b('0x4c')],{})[_0xb39b('0x26')](function(_0x97e609){var _0x5c14ac=_0x53e82a[_0xb39b('0x4d')][_0xb39b('0x27')]({'plain':!![]});if(!_0x5c14ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c14ac[_0xb39b('0x4e')]==='user'){var _0x4da9ee=_0x97e609[_0xb39b('0x27')]({'plain':!![]});var _0x5ca290=_0xb39b('0x4f');return db[_0xb39b('0x50')][_0xb39b('0x49')]({'where':{'name':_0x5ca290,'userProfileId':_0x5c14ac[_0xb39b('0x51')]},'raw':!![]})[_0xb39b('0x26')](function(_0x303316){if(_0x303316&&_0x303316[_0xb39b('0x52')]===0x0){return db[_0xb39b('0x28')][_0xb39b('0x4b')]({'name':_0x4da9ee[_0xb39b('0x2c')],'resourceId':_0x4da9ee['id'],'type':_0x303316['name'],'sectionId':_0x303316['id']},{})['then'](function(){return _0x97e609;});}else{return _0x97e609;}})[_0xb39b('0x4a')](function(_0x18c83e){logger[_0xb39b('0x2a')](_0xb39b('0x53'),_0x18c83e);throw _0x18c83e;});}return _0x97e609;})[_0xb39b('0x26')](respondWithResult(_0x313a20,0xc9))['catch'](handleError(_0x313a20,null));};exports[_0xb39b('0x54')]=function(_0x26d2fc,_0x1e6db9){if(_0x26d2fc[_0xb39b('0x4c')]['id']){delete _0x26d2fc['body']['id'];}return db[_0xb39b('0x30')][_0xb39b('0x49')]({'where':{'id':_0x26d2fc[_0xb39b('0x47')]['id']}})[_0xb39b('0x26')](handleEntityNotFound(_0x1e6db9,null))[_0xb39b('0x26')](saveUpdates(_0x26d2fc['body'],null))[_0xb39b('0x26')](respondWithResult(_0x1e6db9,null))['catch'](handleError(_0x1e6db9,null));};exports['destroy']=function(_0x517e84,_0x1aaaff){return db['Disposition'][_0xb39b('0x49')]({'where':{'id':_0x517e84['params']['id']}})[_0xb39b('0x26')](handleEntityNotFound(_0x1aaaff,null))[_0xb39b('0x26')](removeEntity(_0x1aaaff,null))[_0xb39b('0x4a')](handleError(_0x1aaaff,null));}; \ No newline at end of file +var _0xcb14=['include','rows','catch','show','params','rawAttributes','length','create','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','index','map','Disposition','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0xcb14,0x106));var _0x4cb1=function(_0x5ed493,_0x2e626d){_0x5ed493=_0x5ed493-0x0;var _0x5515c8=_0xcb14[_0x5ed493];return _0x5515c8;};'use strict';var emlformat=require(_0x4cb1('0x0'));var rimraf=require(_0x4cb1('0x1'));var zipdir=require(_0x4cb1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4cb1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4cb1('0x4'));var util=require(_0x4cb1('0x5'));var path=require(_0x4cb1('0x6'));var sox=require(_0x4cb1('0x7'));var csv=require(_0x4cb1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4cb1('0x9'));var crypto=require(_0x4cb1('0xa'));var jsforce=require(_0x4cb1('0xb'));var deskjs=require(_0x4cb1('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4cb1('0xd'));var Redis=require(_0x4cb1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4cb1('0xf'));var as=require(_0x4cb1('0x10'));var hardwareService=require(_0x4cb1('0x11'));var logger=require(_0x4cb1('0x12'))(_0x4cb1('0x13'));var utils=require(_0x4cb1('0x14'));var config=require(_0x4cb1('0x15'));var licenseUtil=require(_0x4cb1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43d9f1,_0x1c466e){_0x1c466e=_0x1c466e||0xcc;return function(_0x2cb7c4){if(_0x2cb7c4){return _0x43d9f1[_0x4cb1('0x17')](_0x1c466e);}return _0x43d9f1[_0x4cb1('0x18')](_0x1c466e)[_0x4cb1('0x19')]();};}function respondWithResult(_0x5a419f,_0x5ad5b0){_0x5ad5b0=_0x5ad5b0||0xc8;return function(_0x3f2827){if(_0x3f2827){return _0x5a419f[_0x4cb1('0x18')](_0x5ad5b0)[_0x4cb1('0x1a')](_0x3f2827);}};}function respondWithFilteredResult(_0x5d6490,_0x17e0af){return function(_0x500edb){if(_0x500edb){var _0x27f572=typeof _0x17e0af['offset']==='undefined'&&typeof _0x17e0af[_0x4cb1('0x1b')]===_0x4cb1('0x1c');var _0x35f7b9=_0x500edb[_0x4cb1('0x1d')];var _0x5a2f9b=_0x27f572?0x0:_0x17e0af['offset'];var _0xaebce2=_0x27f572?_0x500edb[_0x4cb1('0x1d')]:_0x17e0af[_0x4cb1('0x1e')]+_0x17e0af[_0x4cb1('0x1b')];var _0x38b210;if(_0xaebce2>=_0x35f7b9){_0xaebce2=_0x35f7b9;_0x38b210=0xc8;}else{_0x38b210=0xce;}_0x5d6490[_0x4cb1('0x18')](_0x38b210);return _0x5d6490[_0x4cb1('0x1f')](_0x4cb1('0x20'),_0x5a2f9b+'-'+_0xaebce2+'/'+_0x35f7b9)['json'](_0x500edb);}return null;};}function patchUpdates(_0x466d33){return function(_0x2afb57){try{jsonpatch['apply'](_0x2afb57,_0x466d33,!![]);}catch(_0x571264){return BPromise['reject'](_0x571264);}return _0x2afb57[_0x4cb1('0x21')]();};}function saveUpdates(_0x2db720,_0x311d35){return function(_0x20cd2d){if(_0x20cd2d){return _0x20cd2d[_0x4cb1('0x22')](_0x2db720)[_0x4cb1('0x23')](function(_0x2b1512){return _0x2b1512;});}return null;};}function removeEntity(_0x11ac81,_0x18f7d1){return function(_0x1462ea){if(_0x1462ea){return _0x1462ea[_0x4cb1('0x24')]()['then'](function(){var _0x5e0db6=_0x1462ea[_0x4cb1('0x25')]({'plain':!![]});var _0x336d9b=_0x4cb1('0x26');return db[_0x4cb1('0x27')][_0x4cb1('0x24')]({'where':{'type':_0x336d9b,'resourceId':_0x5e0db6['id']}})[_0x4cb1('0x23')](function(){return _0x1462ea;});})[_0x4cb1('0x23')](function(){_0x11ac81[_0x4cb1('0x18')](0xcc)[_0x4cb1('0x19')]();});}};}function handleEntityNotFound(_0x316544,_0x4ddecd){return function(_0x3ebd74){if(!_0x3ebd74){_0x316544['sendStatus'](0x194);}return _0x3ebd74;};}function handleError(_0xb95b2f,_0x3040d5){_0x3040d5=_0x3040d5||0x1f4;return function(_0x4c1d37){logger['error'](_0x4c1d37[_0x4cb1('0x28')]);if(_0x4c1d37['name']){delete _0x4c1d37[_0x4cb1('0x29')];}_0xb95b2f['status'](_0x3040d5)[_0x4cb1('0x2a')](_0x4c1d37);};}exports[_0x4cb1('0x2b')]=function(_0x4d1135,_0x251acd){var _0xa4e8ba={},_0x3fee0e={},_0x564d32={'count':0x0,'rows':[]};var _0x105fa2=_[_0x4cb1('0x2c')](db[_0x4cb1('0x2d')]['rawAttributes'],function(_0x4a3404){return{'name':_0x4a3404[_0x4cb1('0x2e')],'type':_0x4a3404['type'][_0x4cb1('0x2f')]};});_0x3fee0e[_0x4cb1('0x30')]=_[_0x4cb1('0x2c')](_0x105fa2,_0x4cb1('0x29'));_0x3fee0e[_0x4cb1('0x31')]=_[_0x4cb1('0x32')](_0x4d1135[_0x4cb1('0x31')]);_0x3fee0e['filters']=_[_0x4cb1('0x33')](_0x3fee0e['model'],_0x3fee0e['query']);_0xa4e8ba[_0x4cb1('0x34')]=_[_0x4cb1('0x33')](_0x3fee0e[_0x4cb1('0x30')],qs[_0x4cb1('0x35')](_0x4d1135[_0x4cb1('0x31')]['fields']));_0xa4e8ba['attributes']=_0xa4e8ba['attributes']['length']?_0xa4e8ba[_0x4cb1('0x34')]:_0x3fee0e['model'];if(!_0x4d1135[_0x4cb1('0x31')][_0x4cb1('0x36')](_0x4cb1('0x37'))){_0xa4e8ba['limit']=qs[_0x4cb1('0x1b')](_0x4d1135['query']['limit']);_0xa4e8ba[_0x4cb1('0x1e')]=qs['offset'](_0x4d1135[_0x4cb1('0x31')]['offset']);}_0xa4e8ba['order']=qs[_0x4cb1('0x38')](_0x4d1135[_0x4cb1('0x31')][_0x4cb1('0x38')]);_0xa4e8ba[_0x4cb1('0x39')]=qs[_0x4cb1('0x3a')](_[_0x4cb1('0x3b')](_0x4d1135['query'],_0x3fee0e[_0x4cb1('0x3a')]),_0x105fa2);if(_0x4d1135[_0x4cb1('0x31')][_0x4cb1('0x3c')]){_0xa4e8ba[_0x4cb1('0x39')]=_[_0x4cb1('0x3d')](_0xa4e8ba[_0x4cb1('0x39')],{'$or':_[_0x4cb1('0x2c')](_0x105fa2,function(_0xdd064e){if(_0xdd064e[_0x4cb1('0x3e')]!==_0x4cb1('0x3f')){var _0x43ec88={};_0x43ec88[_0xdd064e[_0x4cb1('0x29')]]={'$like':'%'+_0x4d1135[_0x4cb1('0x31')][_0x4cb1('0x3c')]+'%'};return _0x43ec88;}})});}_0xa4e8ba=_[_0x4cb1('0x3d')]({},_0xa4e8ba,_0x4d1135[_0x4cb1('0x40')]);var _0x6c9e73={'where':_0xa4e8ba[_0x4cb1('0x39')]};return db['Disposition'][_0x4cb1('0x1d')](_0x6c9e73)[_0x4cb1('0x23')](function(_0x120b25){_0x564d32['count']=_0x120b25;if(_0x4d1135['query'][_0x4cb1('0x41')]){_0xa4e8ba[_0x4cb1('0x42')]=[{'all':!![]}];}return db[_0x4cb1('0x2d')]['findAll'](_0xa4e8ba);})[_0x4cb1('0x23')](function(_0x41053f){_0x564d32[_0x4cb1('0x43')]=_0x41053f;return _0x564d32;})[_0x4cb1('0x23')](respondWithFilteredResult(_0x251acd,_0xa4e8ba))[_0x4cb1('0x44')](handleError(_0x251acd,null));};exports[_0x4cb1('0x45')]=function(_0x39a59c,_0x5f3185){var _0x7618a1={'raw':!![],'where':{'id':_0x39a59c[_0x4cb1('0x46')]['id']}},_0x1442c7={};_0x1442c7['model']=_[_0x4cb1('0x32')](db['Disposition'][_0x4cb1('0x47')]);_0x1442c7['query']=_['keys'](_0x39a59c[_0x4cb1('0x31')]);_0x1442c7[_0x4cb1('0x3a')]=_[_0x4cb1('0x33')](_0x1442c7[_0x4cb1('0x30')],_0x1442c7['query']);_0x7618a1[_0x4cb1('0x34')]=_['intersection'](_0x1442c7['model'],qs[_0x4cb1('0x35')](_0x39a59c[_0x4cb1('0x31')][_0x4cb1('0x35')]));_0x7618a1['attributes']=_0x7618a1['attributes'][_0x4cb1('0x48')]?_0x7618a1['attributes']:_0x1442c7[_0x4cb1('0x30')];if(_0x39a59c['query'][_0x4cb1('0x41')]){_0x7618a1['include']=[{'all':!![]}];}_0x7618a1=_[_0x4cb1('0x3d')]({},_0x7618a1,_0x39a59c[_0x4cb1('0x40')]);return db['Disposition']['find'](_0x7618a1)[_0x4cb1('0x23')](handleEntityNotFound(_0x5f3185,null))[_0x4cb1('0x23')](respondWithResult(_0x5f3185,null))['catch'](handleError(_0x5f3185,null));};exports[_0x4cb1('0x49')]=function(_0x13c0e5,_0x5b6cbb){return db['Disposition'][_0x4cb1('0x49')](_0x13c0e5['body'],{})[_0x4cb1('0x23')](function(_0x1fbf1b){var _0x3cef51=_0x13c0e5[_0x4cb1('0x4a')]['get']({'plain':!![]});if(!_0x3cef51)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cef51[_0x4cb1('0x4b')]===_0x4cb1('0x4a')){var _0x5b99e5=_0x1fbf1b['get']({'plain':!![]});var _0x3fc360=_0x4cb1('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x3fc360,'userProfileId':_0x3cef51[_0x4cb1('0x4c')]},'raw':!![]})['then'](function(_0x2e88bc){if(_0x2e88bc&&_0x2e88bc[_0x4cb1('0x4d')]===0x0){return db['UserProfileResource'][_0x4cb1('0x49')]({'name':_0x5b99e5['name'],'resourceId':_0x5b99e5['id'],'type':_0x2e88bc[_0x4cb1('0x29')],'sectionId':_0x2e88bc['id']},{})[_0x4cb1('0x23')](function(){return _0x1fbf1b;});}else{return _0x1fbf1b;}})[_0x4cb1('0x44')](function(_0x5aff12){logger[_0x4cb1('0x4e')](_0x4cb1('0x4f'),_0x5aff12);throw _0x5aff12;});}return _0x1fbf1b;})[_0x4cb1('0x23')](respondWithResult(_0x5b6cbb,0xc9))[_0x4cb1('0x44')](handleError(_0x5b6cbb,null));};exports[_0x4cb1('0x22')]=function(_0x2bee32,_0x167da7){if(_0x2bee32[_0x4cb1('0x50')]['id']){delete _0x2bee32[_0x4cb1('0x50')]['id'];}return db[_0x4cb1('0x2d')][_0x4cb1('0x51')]({'where':{'id':_0x2bee32[_0x4cb1('0x46')]['id']}})[_0x4cb1('0x23')](handleEntityNotFound(_0x167da7,null))[_0x4cb1('0x23')](saveUpdates(_0x2bee32['body'],null))[_0x4cb1('0x23')](respondWithResult(_0x167da7,null))[_0x4cb1('0x44')](handleError(_0x167da7,null));};exports[_0x4cb1('0x24')]=function(_0x5cf80c,_0x3cc317){return db[_0x4cb1('0x2d')][_0x4cb1('0x51')]({'where':{'id':_0x5cf80c[_0x4cb1('0x46')]['id']}})[_0x4cb1('0x23')](handleEntityNotFound(_0x3cc317,null))['then'](removeEntity(_0x3cc317,null))[_0x4cb1('0x44')](handleError(_0x3cc317,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 29a3784..301aa80 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 _0xf065=['define','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','exports'];(function(_0x5b6d17,_0x153be1){var _0x2bf9c8=function(_0x4c1bb2){while(--_0x4c1bb2){_0x5b6d17['push'](_0x5b6d17['shift']());}};_0x2bf9c8(++_0x153be1);}(_0xf065,0x139));var _0x5f06=function(_0x38ed9a,_0x472fc0){_0x38ed9a=_0x38ed9a-0x0;var _0x21bf38=_0xf065[_0x38ed9a];return _0x21bf38;};'use strict';var _=require(_0x5f06('0x0'));var util=require('util');var logger=require(_0x5f06('0x1'))(_0x5f06('0x2'));var moment=require('moment');var BPromise=require(_0x5f06('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f06('0x4'));var config=require(_0x5f06('0x5'));var attributes=require('./disposition.attributes');module[_0x5f06('0x6')]=function(_0x207108,_0x525caa){return _0x207108[_0x5f06('0x7')]('Disposition',attributes,{'tableName':_0x5f06('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x5f06('0x9'),_0x5f06('0xa')]},{'unique':!![],'name':_0x5f06('0xb'),'fields':['name',_0x5f06('0xc')]},{'unique':!![],'name':_0x5f06('0xd'),'fields':[_0x5f06('0x9'),_0x5f06('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0x5f06('0x9'),'SmsAccountId']},{'unique':!![],'name':_0x5f06('0xf'),'fields':['name',_0x5f06('0x10')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0x5f06('0x11')]},{'unique':!![],'name':_0x5f06('0x12'),'fields':[_0x5f06('0x9'),_0x5f06('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4baf=['bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name','name_chat','name_mail','MailAccountId','name_sms','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','util','api','moment'];(function(_0x38ed42,_0x3d9a37){var _0x474931=function(_0x1fa601){while(--_0x1fa601){_0x38ed42['push'](_0x38ed42['shift']());}};_0x474931(++_0x3d9a37);}(_0x4baf,0xf9));var _0xf4ba=function(_0x34ab55,_0x2a188d){_0x34ab55=_0x34ab55-0x0;var _0x2a63aa=_0x4baf[_0x34ab55];return _0x2a63aa;};'use strict';var _=require('lodash');var util=require(_0xf4ba('0x0'));var logger=require('../../config/logger')(_0xf4ba('0x1'));var moment=require(_0xf4ba('0x2'));var BPromise=require(_0xf4ba('0x3'));var rp=require(_0xf4ba('0x4'));var fs=require('fs');var path=require(_0xf4ba('0x5'));var rimraf=require(_0xf4ba('0x6'));var config=require(_0xf4ba('0x7'));var attributes=require(_0xf4ba('0x8'));module['exports']=function(_0x3cc806,_0x203e33){return _0x3cc806[_0xf4ba('0x9')](_0xf4ba('0xa'),attributes,{'tableName':_0xf4ba('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xf4ba('0xc'),'ListId']},{'unique':!![],'name':_0xf4ba('0xd'),'fields':[_0xf4ba('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0xf4ba('0xe'),'fields':[_0xf4ba('0xc'),_0xf4ba('0xf')]},{'unique':!![],'name':_0xf4ba('0x10'),'fields':[_0xf4ba('0xc'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name',_0xf4ba('0x11')]},{'unique':!![],'name':_0xf4ba('0x12'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xf4ba('0x13'),'fields':[_0xf4ba('0xc'),_0xf4ba('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 9506303..917f6a1 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(_0x3fd8a4,_0x150691){var _0x502f14=function(_0x3966d6){while(--_0x3966d6){_0x3fd8a4['push'](_0x3fd8a4['shift']());}};_0x502f14(++_0x150691);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x401818,_0x3f1df5){var _0x37753a=function(_0x210809){while(--_0x210809){_0x401818['push'](_0x401818['shift']());}};_0x37753a(++_0x3f1df5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 486c857..aeb340e 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 _0x9d3d=['multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x9d3d,0x77));var _0xd9d3=function(_0x2711b4,_0x3bcdab){_0x2711b4=_0x2711b4-0x0;var _0x2ee5e6=_0x9d3d[_0x2711b4];return _0x2ee5e6;};'use strict';var multer=require(_0xd9d3('0x0'));var util=require(_0xd9d3('0x1'));var path=require(_0xd9d3('0x2'));var timeout=require(_0xd9d3('0x3'));var express=require(_0xd9d3('0x4'));var router=express['Router']();var fs_extra=require(_0xd9d3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd9d3('0x6'));var controller=require(_0xd9d3('0x7'));router[_0xd9d3('0x8')]('/',auth[_0xd9d3('0x9')](),controller[_0xd9d3('0xa')]);router[_0xd9d3('0x8')](_0xd9d3('0xb'),auth[_0xd9d3('0x9')](),controller['show']);router[_0xd9d3('0xc')]('/',auth[_0xd9d3('0x9')](),controller[_0xd9d3('0xd')]);router[_0xd9d3('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd9d3('0xf')]);router[_0xd9d3('0x10')]('/:id',auth[_0xd9d3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x24ca=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4f63c0,_0x4abc0d){var _0x3f7729=function(_0x1bd3f1){while(--_0x1bd3f1){_0x4f63c0['push'](_0x4f63c0['shift']());}};_0x3f7729(++_0x4abc0d);}(_0x24ca,0x1aa));var _0xa24c=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x24ca[_0x4c3ffe];return _0x28d3eb;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express[_0xa24c('0x4')]();var fs_extra=require(_0xa24c('0x5'));var auth=require(_0xa24c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa24c('0x7'));var controller=require('./disposition.controller');router['get']('/',auth[_0xa24c('0x8')](),controller[_0xa24c('0x9')]);router[_0xa24c('0xa')](_0xa24c('0xb'),auth['isAuthenticated'](),controller[_0xa24c('0xc')]);router['post']('/',auth[_0xa24c('0x8')](),controller[_0xa24c('0xd')]);router[_0xa24c('0xe')]('/:id',auth[_0xa24c('0x8')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xb'),auth['isAuthenticated'](),controller[_0xa24c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 0ba0d51..3581290 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 _0x7aae=['2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','yes','localstationid','ENUM'];(function(_0x347340,_0x1e0356){var _0x265841=function(_0x4eccfe){while(--_0x4eccfe){_0x347340['push'](_0x347340['shift']());}};_0x265841(++_0x1e0356);}(_0x7aae,0x1c7));var _0xe7aa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7aae[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xe7aa('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7aa('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe7aa('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xe7aa('0x2'),'no'),'defaultValue':_0xe7aa('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xe7aa('0x1')],'unique':_0xe7aa('0x3')},'minrate':{'type':Sequelize[_0xe7aa('0x4')](_0xe7aa('0x5'),_0xe7aa('0x6'),_0xe7aa('0x7'),_0xe7aa('0x8'),'12000',_0xe7aa('0x9')),'defaultValue':_0xe7aa('0x6')},'maxrate':{'type':Sequelize[_0xe7aa('0x4')]('2400',_0xe7aa('0x6'),_0xe7aa('0x7'),_0xe7aa('0x8'),_0xe7aa('0xa'),_0xe7aa('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xe7aa('0x1')],'defaultValue':_0xe7aa('0xb')},'gateway':{'type':Sequelize[_0xe7aa('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe7aa('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xe7aa('0xd'),_0xe7aa('0xe'),'DADHI','KHOMP'),'defaultValue':_0xe7aa('0xd')},'key':{'type':Sequelize[_0xe7aa('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe7aa('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe7aa('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe7aa('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe7aa('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe7aa('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe7aa('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe7aa('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe7aa('0x10')],'defaultValue':![],'comment':_0xe7aa('0x11'),'set':function(_0x7d5f04){if(!_0x7d5f04)this[_0xe7aa('0x12')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xe7aa('0x13'),_0x7d5f04);}}}; \ No newline at end of file +var _0xe7df=['yes','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','IAX','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM'];(function(_0x1e9c8f,_0x2bd677){var _0x5a99cb=function(_0x282633){while(--_0x282633){_0x1e9c8f['push'](_0x1e9c8f['shift']());}};_0x5a99cb(++_0x2bd677);}(_0xe7df,0x9d));var _0xfe7d=function(_0x726917,_0x2516b2){_0x726917=_0x726917-0x0;var _0x5d3d40=_0xe7df[_0x726917];return _0x5d3d40;};'use strict';var Sequelize=require(_0xfe7d('0x0'));module[_0xfe7d('0x1')]={'name':{'type':Sequelize[_0xfe7d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfe7d('0x2')]},'ecm':{'type':Sequelize[_0xfe7d('0x3')](_0xfe7d('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xfe7d('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xfe7d('0x2')],'unique':_0xfe7d('0x5')},'minrate':{'type':Sequelize[_0xfe7d('0x3')]('2400',_0xfe7d('0x6'),_0xfe7d('0x7'),_0xfe7d('0x8'),_0xfe7d('0x9'),_0xfe7d('0xa')),'defaultValue':_0xfe7d('0x6')},'maxrate':{'type':Sequelize[_0xfe7d('0x3')](_0xfe7d('0xb'),_0xfe7d('0x6'),_0xfe7d('0x7'),_0xfe7d('0x8'),_0xfe7d('0x9'),_0xfe7d('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xfe7d('0x2')],'defaultValue':_0xfe7d('0xc')},'gateway':{'type':Sequelize[_0xfe7d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xfe7d('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfe7d('0x3')](_0xfe7d('0xe'),_0xfe7d('0xf'),'DADHI','KHOMP'),'defaultValue':_0xfe7d('0xe')},'key':{'type':Sequelize[_0xfe7d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfe7d('0x10')],'defaultValue':function(){return _0xfe7d('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfe7d('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfe7d('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfe7d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfe7d('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfe7d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe7d('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xfe7d('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xfe7d('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3e6aba){if(!_0x3e6aba)this[_0xfe7d('0x14')](_0xfe7d('0x15'),null);this[_0xfe7d('0x14')](_0xfe7d('0x16'),_0x3e6aba);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index f4e1b33..5d3583a 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 _0x4c9d=['catch','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','hasOwnProperty','sort','pick','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','options','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','send','json','getApplications','context','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','modem','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','FaxMessage','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Messages','Contact\x20not\x20found','spread','out','filename','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','reject','save','update','destroy','get','FaxAccounts','stack','name','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','where','filters','filter','merge','VIRTUAL','include','findAll','rows'];(function(_0x24b61b,_0x47b269){var _0x494602=function(_0x5006b9){while(--_0x5006b9){_0x24b61b['push'](_0x24b61b['shift']());}};_0x494602(++_0x47b269);}(_0x4c9d,0x6e));var _0xd4c9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4c9d[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd4c9('0x0'));var jsonpatch=require(_0xd4c9('0x1'));var rp=require('request-promise');var moment=require(_0xd4c9('0x2'));var BPromise=require(_0xd4c9('0x3'));var Mustache=require(_0xd4c9('0x4'));var util=require(_0xd4c9('0x5'));var path=require(_0xd4c9('0x6'));var sox=require(_0xd4c9('0x7'));var csv=require(_0xd4c9('0x8'));var ejs=require(_0xd4c9('0x9'));var fs=require('fs');var fs_extra=require(_0xd4c9('0xa'));var _=require('lodash');var squel=require(_0xd4c9('0xb'));var crypto=require('crypto');var jsforce=require(_0xd4c9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd4c9('0xd'));var Papa=require(_0xd4c9('0xe'));var Redis=require(_0xd4c9('0xf'));var authService=require(_0xd4c9('0x10'));var qs=require(_0xd4c9('0x11'));var as=require(_0xd4c9('0x12'));var hardwareService=require(_0xd4c9('0x13'));var logger=require(_0xd4c9('0x14'))(_0xd4c9('0x15'));var utils=require(_0xd4c9('0x16'));var config=require(_0xd4c9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4c9('0x18'))['db'];config[_0xd4c9('0x19')]=_[_0xd4c9('0x1a')](config[_0xd4c9('0x19')],{'host':_0xd4c9('0x1b'),'port':0x18eb});var socket=require(_0xd4c9('0x1c'))(new Redis(config[_0xd4c9('0x19')]));require(_0xd4c9('0x1d'))[_0xd4c9('0x1e')](socket);var jayson=require(_0xd4c9('0x1f'));var client=jayson[_0xd4c9('0x20')][_0xd4c9('0x21')]({'port':0x232c});var client9002=jayson[_0xd4c9('0x20')][_0xd4c9('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1259e9,_0x4cb265,_0xd834ec,_0x14b330){return new BPromise(function(_0x2549e8,_0x26f252){var _0x2c1561=_0x14b330||client;return _0x2c1561[_0xd4c9('0x22')](_0x1259e9,_0xd834ec)[_0xd4c9('0x23')](function(_0x25b4c6){logger[_0xd4c9('0x24')](_0xd4c9('0x25'),_0x4cb265,_0xd4c9('0x26'));logger[_0xd4c9('0x27')](_0xd4c9('0x28'),_0x4cb265,_0xd4c9('0x26'),JSON[_0xd4c9('0x29')](_0x25b4c6));if(_0x25b4c6[_0xd4c9('0x2a')]){if(_0x25b4c6[_0xd4c9('0x2a')][_0xd4c9('0x2b')]===0x1f4){logger['error'](_0xd4c9('0x25'),_0x4cb265,_0x25b4c6[_0xd4c9('0x2a')][_0xd4c9('0x2c')]);return _0x26f252(_0x25b4c6[_0xd4c9('0x2a')][_0xd4c9('0x2c')]);}logger['error'](_0xd4c9('0x25'),_0x4cb265,_0x25b4c6[_0xd4c9('0x2a')]['message']);return _0x2549e8(_0x25b4c6['error']['message']);}else{logger[_0xd4c9('0x24')]('FaxAccount,\x20%s,\x20%s',_0x4cb265,_0xd4c9('0x26'));_0x2549e8(_0x25b4c6[_0xd4c9('0x2d')][_0xd4c9('0x2c')]);}})['catch'](function(_0x4d112a){logger[_0xd4c9('0x2a')](_0xd4c9('0x25'),_0x4cb265,_0x4d112a);_0x26f252(_0x4d112a);});});}function respondWithStatusCode(_0x189733,_0x1733a9){_0x1733a9=_0x1733a9||0xcc;return function(_0x157f0c){if(_0x157f0c){return _0x189733[_0xd4c9('0x2e')](_0x1733a9);}return _0x189733['status'](_0x1733a9)['end']();};}function respondWithResult(_0x17218c,_0x133c07){_0x133c07=_0x133c07||0xc8;return function(_0x328b55){if(_0x328b55){return _0x17218c[_0xd4c9('0x2f')](_0x133c07)['json'](_0x328b55);}};}function respondWithFilteredResult(_0x555b64,_0x4aab07){return function(_0xf3fd81){if(_0xf3fd81){var _0x3fdde9=typeof _0x4aab07[_0xd4c9('0x30')]===_0xd4c9('0x31')&&typeof _0x4aab07[_0xd4c9('0x32')]===_0xd4c9('0x31');var _0x11a09a=_0xf3fd81[_0xd4c9('0x33')];var _0x9cc0fc=_0x3fdde9?0x0:_0x4aab07['offset'];var _0x564a79=_0x3fdde9?_0xf3fd81['count']:_0x4aab07['offset']+_0x4aab07[_0xd4c9('0x32')];var _0x3d733d;if(_0x564a79>=_0x11a09a){_0x564a79=_0x11a09a;_0x3d733d=0xc8;}else{_0x3d733d=0xce;}_0x555b64[_0xd4c9('0x2f')](_0x3d733d);return _0x555b64[_0xd4c9('0x34')]('Content-Range',_0x9cc0fc+'-'+_0x564a79+'/'+_0x11a09a)['json'](_0xf3fd81);}return null;};}function patchUpdates(_0x3ea140){return function(_0x51ad20){try{jsonpatch['apply'](_0x51ad20,_0x3ea140,!![]);}catch(_0x352bf8){return BPromise[_0xd4c9('0x35')](_0x352bf8);}return _0x51ad20[_0xd4c9('0x36')]();};}function saveUpdates(_0x5c431c,_0x3b1704){return function(_0xeced9d){if(_0xeced9d){return _0xeced9d[_0xd4c9('0x37')](_0x5c431c)[_0xd4c9('0x23')](function(_0x351494){return _0x351494;});}return null;};}function removeEntity(_0x7dbe4,_0x464e7e){return function(_0x55b2ef){if(_0x55b2ef){return _0x55b2ef[_0xd4c9('0x38')]()['then'](function(){var _0x4e6294=_0x55b2ef[_0xd4c9('0x39')]({'plain':!![]});var _0x3e255d=_0xd4c9('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x3e255d,'resourceId':_0x4e6294['id']}})[_0xd4c9('0x23')](function(){return _0x55b2ef;});})[_0xd4c9('0x23')](function(){_0x7dbe4[_0xd4c9('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x394b18,_0x4a686b){return function(_0x227bec){if(!_0x227bec){_0x394b18[_0xd4c9('0x2e')](0x194);}return _0x227bec;};}function handleError(_0x21d00a,_0x1f57ac){_0x1f57ac=_0x1f57ac||0x1f4;return function(_0x5e2b41){logger[_0xd4c9('0x2a')](_0x5e2b41[_0xd4c9('0x3b')]);if(_0x5e2b41[_0xd4c9('0x3c')]){delete _0x5e2b41[_0xd4c9('0x3c')];}_0x21d00a[_0xd4c9('0x2f')](_0x1f57ac)['send'](_0x5e2b41);};}exports['index']=function(_0x260159,_0x49dd5e){var _0x5217ac={'include':[{'model':db[_0xd4c9('0x3d')],'as':_0xd4c9('0x3e')}]},_0x57f4b7={},_0x4f0aea={'count':0x0,'rows':[]};var _0x568b4c=_['map'](db[_0xd4c9('0x3f')][_0xd4c9('0x40')],function(_0x2dd030){return{'name':_0x2dd030[_0xd4c9('0x41')],'type':_0x2dd030[_0xd4c9('0x42')][_0xd4c9('0x43')]};});_0x57f4b7[_0xd4c9('0x44')]=_[_0xd4c9('0x45')](_0x568b4c,_0xd4c9('0x3c'));_0x57f4b7[_0xd4c9('0x46')]=_[_0xd4c9('0x47')](_0x260159[_0xd4c9('0x46')]);_0x57f4b7['filters']=_[_0xd4c9('0x48')](_0x57f4b7[_0xd4c9('0x44')],_0x57f4b7[_0xd4c9('0x46')]);_0x5217ac[_0xd4c9('0x49')]=_['intersection'](_0x57f4b7[_0xd4c9('0x44')],qs[_0xd4c9('0x4a')](_0x260159[_0xd4c9('0x46')]['fields']));_0x5217ac[_0xd4c9('0x49')]=_0x5217ac[_0xd4c9('0x49')]['length']?_0x5217ac[_0xd4c9('0x49')]:_0x57f4b7[_0xd4c9('0x44')];if(!_0x260159[_0xd4c9('0x46')]['hasOwnProperty'](_0xd4c9('0x4b'))){_0x5217ac[_0xd4c9('0x32')]=qs[_0xd4c9('0x32')](_0x260159[_0xd4c9('0x46')]['limit']);_0x5217ac[_0xd4c9('0x30')]=qs[_0xd4c9('0x30')](_0x260159[_0xd4c9('0x46')]['offset']);}_0x5217ac[_0xd4c9('0x4c')]=qs['sort'](_0x260159['query']['sort']);_0x5217ac[_0xd4c9('0x4d')]=qs[_0xd4c9('0x4e')](_['pick'](_0x260159['query'],_0x57f4b7[_0xd4c9('0x4e')]),_0x568b4c);if(_0x260159[_0xd4c9('0x46')][_0xd4c9('0x4f')]){_0x5217ac[_0xd4c9('0x4d')]=_[_0xd4c9('0x50')](_0x5217ac[_0xd4c9('0x4d')],{'$or':_[_0xd4c9('0x45')](_0x568b4c,function(_0x43b8a0){if(_0x43b8a0[_0xd4c9('0x42')]!==_0xd4c9('0x51')){var _0x3e5a02={};_0x3e5a02[_0x43b8a0[_0xd4c9('0x3c')]]={'$like':'%'+_0x260159['query'][_0xd4c9('0x4f')]+'%'};return _0x3e5a02;}})});}_0x5217ac=_[_0xd4c9('0x50')]({},_0x5217ac,_0x260159['options']);var _0x2e47b0={'where':_0x5217ac['where']};return db[_0xd4c9('0x3f')][_0xd4c9('0x33')](_0x2e47b0)[_0xd4c9('0x23')](function(_0x367f1d){_0x4f0aea[_0xd4c9('0x33')]=_0x367f1d;if(_0x260159[_0xd4c9('0x46')]['includeAll']){_0x5217ac[_0xd4c9('0x52')]=[{'all':!![]}];}return db[_0xd4c9('0x3f')][_0xd4c9('0x53')](_0x5217ac);})['then'](function(_0xca283a){_0x4f0aea[_0xd4c9('0x54')]=_0xca283a;return _0x4f0aea;})['then'](respondWithFilteredResult(_0x49dd5e,_0x5217ac))[_0xd4c9('0x55')](handleError(_0x49dd5e,null));};exports[_0xd4c9('0x56')]=function(_0x463741,_0x38f4d0){var _0x57713e={'raw':![],'where':{'id':_0x463741['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x567c7e={};_0x567c7e[_0xd4c9('0x44')]=_[_0xd4c9('0x47')](db[_0xd4c9('0x3f')]['rawAttributes']);_0x567c7e[_0xd4c9('0x46')]=_[_0xd4c9('0x47')](_0x463741[_0xd4c9('0x46')]);_0x567c7e[_0xd4c9('0x4e')]=_[_0xd4c9('0x48')](_0x567c7e['model'],_0x567c7e[_0xd4c9('0x46')]);_0x57713e[_0xd4c9('0x49')]=_[_0xd4c9('0x48')](_0x567c7e[_0xd4c9('0x44')],qs['fields'](_0x463741[_0xd4c9('0x46')][_0xd4c9('0x4a')]));_0x57713e[_0xd4c9('0x49')]=_0x57713e[_0xd4c9('0x49')][_0xd4c9('0x57')]?_0x57713e[_0xd4c9('0x49')]:_0x567c7e[_0xd4c9('0x44')];if(_0x463741[_0xd4c9('0x46')]['includeAll']){_0x57713e['include']=[{'all':!![]}];}_0x57713e=_[_0xd4c9('0x50')]({},_0x57713e,_0x463741['options']);return db[_0xd4c9('0x3f')][_0xd4c9('0x58')](_0x57713e)['then'](handleEntityNotFound(_0x38f4d0,null))[_0xd4c9('0x23')](respondWithResult(_0x38f4d0,null))['catch'](handleError(_0x38f4d0,null));};exports[_0xd4c9('0x59')]=function(_0x67d674,_0x16be5c){return db[_0xd4c9('0x3f')][_0xd4c9('0x59')](_0x67d674['body'],{})[_0xd4c9('0x23')](function(_0xc371a1){var _0x1dc641=_0x67d674[_0xd4c9('0x5a')]['get']({'plain':!![]});if(!_0x1dc641)throw new Error(_0xd4c9('0x5b'));if(_0x1dc641[_0xd4c9('0x5c')]==='user'){var _0x1d42f6=_0xc371a1[_0xd4c9('0x39')]({'plain':!![]});var _0x589e5f=_0xd4c9('0x3a');return db[_0xd4c9('0x5d')][_0xd4c9('0x58')]({'where':{'name':_0x589e5f,'userProfileId':_0x1dc641['userProfileId']},'raw':!![]})[_0xd4c9('0x23')](function(_0x7e168e){if(_0x7e168e&&_0x7e168e[_0xd4c9('0x5e')]===0x0){return db[_0xd4c9('0x5f')][_0xd4c9('0x59')]({'name':_0x1d42f6[_0xd4c9('0x3c')],'resourceId':_0x1d42f6['id'],'type':_0x7e168e['name'],'sectionId':_0x7e168e['id']},{})[_0xd4c9('0x23')](function(){return _0xc371a1;});}else{return _0xc371a1;}})[_0xd4c9('0x55')](function(_0x4fc747){logger[_0xd4c9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fc747);throw _0x4fc747;});}return _0xc371a1;})[_0xd4c9('0x23')](respondWithResult(_0x16be5c,0xc9))[_0xd4c9('0x55')](handleError(_0x16be5c,null));};exports['update']=function(_0x6e633c,_0x30cf64){if(_0x6e633c[_0xd4c9('0x60')]['id']){delete _0x6e633c['body']['id'];}return db['FaxAccount'][_0xd4c9('0x58')]({'where':{'id':_0x6e633c[_0xd4c9('0x61')]['id']},'include':[{'model':db[_0xd4c9('0x3d')],'as':_0xd4c9('0x3e')}]})[_0xd4c9('0x23')](handleEntityNotFound(_0x30cf64,null))['then'](saveUpdates(_0x6e633c[_0xd4c9('0x60')],null))[_0xd4c9('0x23')](respondWithResult(_0x30cf64,null))[_0xd4c9('0x55')](handleError(_0x30cf64,null));};exports['destroy']=function(_0x4ef398,_0x39000b){return db[_0xd4c9('0x3f')][_0xd4c9('0x58')]({'where':{'id':_0x4ef398[_0xd4c9('0x61')]['id']}})['then'](handleEntityNotFound(_0x39000b,null))[_0xd4c9('0x23')](removeEntity(_0x39000b,null))[_0xd4c9('0x55')](handleError(_0x39000b,null));};exports[_0xd4c9('0x62')]=function(_0x29d6f9,_0x43aa6c){return db[_0xd4c9('0x3f')][_0xd4c9('0x62')]()[_0xd4c9('0x23')](respondWithResult(_0x43aa6c,null))[_0xd4c9('0x55')](handleError(_0x43aa6c,null));};exports[_0xd4c9('0x63')]=function(_0x382150,_0x12e492,_0x3f6920){if(_0x382150[_0xd4c9('0x60')]['id']){delete _0x382150[_0xd4c9('0x60')]['id'];}return db[_0xd4c9('0x3f')][_0xd4c9('0x58')]({'where':{'id':_0x382150[_0xd4c9('0x61')]['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x12e492,null))['then'](function(_0xdcbed9){if(_0xdcbed9){_0x382150['body'][_0xd4c9('0x64')]=_0xdcbed9['id'];return db[_0xd4c9('0x65')][_0xd4c9('0x59')](_0x382150[_0xd4c9('0x60')]);}})['then'](respondWithResult(_0x12e492,null))[_0xd4c9('0x55')](handleError(_0x12e492,null));};exports[_0xd4c9('0x66')]=function(_0x769b67,_0x5e31f3,_0x4d36fd){var _0x4a2c39={'raw':![],'where':{}};var _0x2c782f={};var _0x3b3d44={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x769b67['params']['id']}})['then'](handleEntityNotFound(_0x5e31f3,null))['then'](function(_0x18d011){if(_0x18d011){_0x2c782f[_0xd4c9('0x44')]=_[_0xd4c9('0x47')](db[_0xd4c9('0x65')][_0xd4c9('0x40')]);_0x2c782f[_0xd4c9('0x46')]=_[_0xd4c9('0x47')](_0x769b67[_0xd4c9('0x46')]);_0x2c782f[_0xd4c9('0x4e')]=_[_0xd4c9('0x48')](_0x2c782f['model'],_0x2c782f[_0xd4c9('0x46')]);_0x4a2c39[_0xd4c9('0x49')]=_[_0xd4c9('0x48')](_0x2c782f[_0xd4c9('0x44')],qs['fields'](_0x769b67[_0xd4c9('0x46')][_0xd4c9('0x4a')]));_0x4a2c39[_0xd4c9('0x49')]=_0x4a2c39[_0xd4c9('0x49')][_0xd4c9('0x57')]?_0x4a2c39[_0xd4c9('0x49')]:_0x2c782f[_0xd4c9('0x44')];if(!_0x769b67[_0xd4c9('0x46')][_0xd4c9('0x67')]('nolimit')){_0x4a2c39[_0xd4c9('0x32')]=qs['limit'](_0x769b67[_0xd4c9('0x46')][_0xd4c9('0x32')]);_0x4a2c39[_0xd4c9('0x30')]=qs[_0xd4c9('0x30')](_0x769b67[_0xd4c9('0x46')]['offset']);}_0x4a2c39[_0xd4c9('0x4c')]=qs[_0xd4c9('0x68')](_0x769b67[_0xd4c9('0x46')][_0xd4c9('0x68')]);_0x4a2c39['where']=qs['filters'](_[_0xd4c9('0x69')](_0x769b67[_0xd4c9('0x46')],_0x2c782f[_0xd4c9('0x4e')]));_0x4a2c39[_0xd4c9('0x4d')]['FaxAccountId']=_0x18d011['id'];if(_0x769b67['query'][_0xd4c9('0x4f')]){_0x4a2c39['where']=_[_0xd4c9('0x50')](_0x4a2c39[_0xd4c9('0x4d')],{'$or':_['map'](_0x4a2c39[_0xd4c9('0x49')],function(_0x32772c){var _0x187cc1={};_0x187cc1[_0x32772c]={'$like':'%'+_0x769b67[_0xd4c9('0x46')][_0xd4c9('0x4f')]+'%'};return _0x187cc1;})});}_0x4a2c39=_[_0xd4c9('0x50')]({},_0x4a2c39,_0x769b67['options']);return db[_0xd4c9('0x65')][_0xd4c9('0x33')]({'where':_0x4a2c39['where']})['then'](function(_0x39c320){_0x3b3d44[_0xd4c9('0x33')]=_0x39c320;if(_0x769b67[_0xd4c9('0x46')][_0xd4c9('0x6a')]){_0x4a2c39[_0xd4c9('0x52')]=[{'all':!![]}];}return db[_0xd4c9('0x65')][_0xd4c9('0x53')](_0x4a2c39);})[_0xd4c9('0x23')](function(_0x148829){_0x3b3d44['rows']=_0x148829;return _0x3b3d44;});}})[_0xd4c9('0x23')](respondWithFilteredResult(_0x5e31f3,_0x4a2c39))[_0xd4c9('0x55')](handleError(_0x5e31f3,null));};exports[_0xd4c9('0x6b')]=function(_0x3deab1,_0x240bb4,_0x33d9f8){return db[_0xd4c9('0x3f')]['find']({'where':{'id':_0x3deab1[_0xd4c9('0x61')]['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x240bb4,null))[_0xd4c9('0x23')](function(_0xdd044d){if(_0xdd044d){return _0xdd044d[_0xd4c9('0x6b')](_0x3deab1[_0xd4c9('0x46')][_0xd4c9('0x6c')]);}})[_0xd4c9('0x23')](respondWithStatusCode(_0x240bb4,null))[_0xd4c9('0x55')](handleError(_0x240bb4,null));};exports[_0xd4c9('0x6d')]=function(_0x45dcc0,_0x131c2f,_0x459bb7){if(_0x45dcc0[_0xd4c9('0x60')]['id']){delete _0x45dcc0[_0xd4c9('0x60')]['id'];}return db[_0xd4c9('0x3f')][_0xd4c9('0x58')]({'where':{'id':_0x45dcc0['params']['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x131c2f,null))['then'](function(_0x3b3230){if(_0x3b3230){_0x45dcc0['body'][_0xd4c9('0x64')]=_0x3b3230['id'];return db[_0xd4c9('0x6e')][_0xd4c9('0x59')](_0x45dcc0[_0xd4c9('0x60')]);}})[_0xd4c9('0x23')](respondWithResult(_0x131c2f,null))[_0xd4c9('0x55')](handleError(_0x131c2f,null));};exports['getAnswers']=function(_0x72c4b6,_0x1f1773,_0x58057c){var _0x3bdddc={'raw':![],'where':{}};var _0x33fed3={};var _0x4e84b6={'count':0x0,'rows':[]};return db[_0xd4c9('0x3f')][_0xd4c9('0x6f')]({'where':{'id':_0x72c4b6[_0xd4c9('0x61')]['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x1f1773,null))[_0xd4c9('0x23')](function(_0x4183a6){if(_0x4183a6){_0x33fed3['model']=_[_0xd4c9('0x47')](db[_0xd4c9('0x6e')][_0xd4c9('0x40')]);_0x33fed3[_0xd4c9('0x46')]=_[_0xd4c9('0x47')](_0x72c4b6[_0xd4c9('0x46')]);_0x33fed3[_0xd4c9('0x4e')]=_[_0xd4c9('0x48')](_0x33fed3[_0xd4c9('0x44')],_0x33fed3[_0xd4c9('0x46')]);_0x3bdddc['attributes']=_[_0xd4c9('0x48')](_0x33fed3['model'],qs[_0xd4c9('0x4a')](_0x72c4b6['query'][_0xd4c9('0x4a')]));_0x3bdddc[_0xd4c9('0x49')]=_0x3bdddc[_0xd4c9('0x49')][_0xd4c9('0x57')]?_0x3bdddc['attributes']:_0x33fed3[_0xd4c9('0x44')];if(!_0x72c4b6[_0xd4c9('0x46')][_0xd4c9('0x67')](_0xd4c9('0x4b'))){_0x3bdddc['limit']=qs[_0xd4c9('0x32')](_0x72c4b6[_0xd4c9('0x46')][_0xd4c9('0x32')]);_0x3bdddc[_0xd4c9('0x30')]=qs['offset'](_0x72c4b6['query'][_0xd4c9('0x30')]);}_0x3bdddc[_0xd4c9('0x4c')]=qs['sort'](_0x72c4b6['query'][_0xd4c9('0x68')]);_0x3bdddc[_0xd4c9('0x4d')]=qs[_0xd4c9('0x4e')](_[_0xd4c9('0x69')](_0x72c4b6[_0xd4c9('0x46')],_0x33fed3['filters']));_0x3bdddc['where'][_0xd4c9('0x64')]=_0x4183a6['id'];if(_0x72c4b6[_0xd4c9('0x46')][_0xd4c9('0x4f')]){_0x3bdddc['where']=_['merge'](_0x3bdddc[_0xd4c9('0x4d')],{'$or':_[_0xd4c9('0x45')](_0x3bdddc[_0xd4c9('0x49')],function(_0x3d8490){var _0xd3c39d={};_0xd3c39d[_0x3d8490]={'$like':'%'+_0x72c4b6[_0xd4c9('0x46')][_0xd4c9('0x4f')]+'%'};return _0xd3c39d;})});}_0x3bdddc=_['merge']({},_0x3bdddc,_0x72c4b6[_0xd4c9('0x70')]);return db[_0xd4c9('0x6e')][_0xd4c9('0x33')]({'where':_0x3bdddc[_0xd4c9('0x4d')]})[_0xd4c9('0x23')](function(_0x3dfc8f){_0x4e84b6['count']=_0x3dfc8f;if(_0x72c4b6[_0xd4c9('0x46')][_0xd4c9('0x6a')]){_0x3bdddc[_0xd4c9('0x52')]=[{'all':!![]}];}return db[_0xd4c9('0x6e')][_0xd4c9('0x53')](_0x3bdddc);})[_0xd4c9('0x23')](function(_0x149a91){_0x4e84b6['rows']=_0x149a91;return _0x4e84b6;});}})[_0xd4c9('0x23')](respondWithFilteredResult(_0x1f1773,_0x3bdddc))[_0xd4c9('0x55')](handleError(_0x1f1773,null));};exports['removeAnswers']=function(_0x16db8d,_0x508188,_0x2ab98e){return db[_0xd4c9('0x3f')]['find']({'where':{'id':_0x16db8d[_0xd4c9('0x61')]['id']}})['then'](handleEntityNotFound(_0x508188,null))[_0xd4c9('0x23')](function(_0x4e0df4){if(_0x4e0df4){return _0x4e0df4[_0xd4c9('0x71')](_0x16db8d[_0xd4c9('0x46')][_0xd4c9('0x6c')]);}})[_0xd4c9('0x23')](respondWithStatusCode(_0x508188,null))[_0xd4c9('0x55')](handleError(_0x508188,null));};exports['addInteraction']=function(_0x2145e7,_0x31b047,_0x24409b){return db['FaxInteraction'][_0xd4c9('0x58')]({'where':{'id':_0x2145e7[_0xd4c9('0x61')]['id']}})['then'](handleEntityNotFound(_0x31b047,null))['then'](function(_0x4d5797){if(_0x4d5797){return _0x4d5797[_0xd4c9('0x72')](_0x2145e7[_0xd4c9('0x60')][_0xd4c9('0x6c')],_[_0xd4c9('0x73')](_0x2145e7[_0xd4c9('0x60')],[_0xd4c9('0x6c'),'id'])||{});}})[_0xd4c9('0x23')](respondWithResult(_0x31b047,null))[_0xd4c9('0x55')](handleError(_0x31b047,null));};exports[_0xd4c9('0x74')]=function(_0x3cc874,_0x1e24cc,_0x122f48){var _0x2a660c={'raw':![],'where':{}};var _0x1146b9={};var _0x993c7f={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd4c9('0x6f')]({'where':{'id':_0x3cc874[_0xd4c9('0x61')]['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x1e24cc,null))[_0xd4c9('0x23')](function(_0x4bde7e){if(_0x4bde7e){_0x1146b9['model']=_[_0xd4c9('0x47')](db['FaxInteraction'][_0xd4c9('0x40')]);_0x1146b9[_0xd4c9('0x46')]=_[_0xd4c9('0x47')](_0x3cc874[_0xd4c9('0x46')]);_0x1146b9['filters']=_[_0xd4c9('0x48')](_0x1146b9['model'],_0x1146b9['query']);_0x2a660c[_0xd4c9('0x49')]=_[_0xd4c9('0x48')](_0x1146b9[_0xd4c9('0x44')],qs[_0xd4c9('0x4a')](_0x3cc874[_0xd4c9('0x46')][_0xd4c9('0x4a')]));_0x2a660c[_0xd4c9('0x49')]=_0x2a660c['attributes'][_0xd4c9('0x57')]?_0x2a660c['attributes']:_0x1146b9[_0xd4c9('0x44')];if(!_0x3cc874[_0xd4c9('0x46')][_0xd4c9('0x67')](_0xd4c9('0x4b'))){_0x2a660c['limit']=qs[_0xd4c9('0x32')](_0x3cc874[_0xd4c9('0x46')][_0xd4c9('0x32')]);_0x2a660c[_0xd4c9('0x30')]=qs['offset'](_0x3cc874[_0xd4c9('0x46')][_0xd4c9('0x30')]);}_0x2a660c[_0xd4c9('0x4c')]=qs['sort'](_0x3cc874['query'][_0xd4c9('0x68')]);_0x2a660c[_0xd4c9('0x4d')]=qs[_0xd4c9('0x4e')](_[_0xd4c9('0x69')](_0x3cc874[_0xd4c9('0x46')],_0x1146b9[_0xd4c9('0x4e')]));_0x2a660c[_0xd4c9('0x4d')]['FaxAccountId']=_0x4bde7e['id'];if(_0x3cc874[_0xd4c9('0x46')][_0xd4c9('0x4f')]){_0x2a660c[_0xd4c9('0x4d')]=_[_0xd4c9('0x50')](_0x2a660c[_0xd4c9('0x4d')],{'$or':_[_0xd4c9('0x45')](_0x2a660c['attributes'],function(_0x4701db){var _0x49cdb6={};_0x49cdb6[_0x4701db]={'$like':'%'+_0x3cc874[_0xd4c9('0x46')][_0xd4c9('0x4f')]+'%'};return _0x49cdb6;})});}_0x2a660c=_[_0xd4c9('0x50')]({},_0x2a660c,_0x3cc874[_0xd4c9('0x70')]);return db[_0xd4c9('0x75')][_0xd4c9('0x33')]({'where':_0x2a660c[_0xd4c9('0x4d')]})['then'](function(_0x38e6dd){_0x993c7f[_0xd4c9('0x33')]=_0x38e6dd;if(_0x3cc874[_0xd4c9('0x46')]['includeAll']){_0x2a660c[_0xd4c9('0x52')]=[{'model':db[_0xd4c9('0x76')],'as':_0xd4c9('0x77'),'required':![]},{'model':db[_0xd4c9('0x78')],'as':_0xd4c9('0x79'),'attributes':[_0xd4c9('0x3c'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0xd4c9('0x7a'),'attributes':['id',_0xd4c9('0x3c'),_0xd4c9('0x7b')],'where':_0x3cc874[_0xd4c9('0x46')][_0xd4c9('0x7c')]?{'id':_0x3cc874[_0xd4c9('0x46')][_0xd4c9('0x7c')]}:undefined,'required':_0x3cc874[_0xd4c9('0x46')]['tag']?!![]:![]}];}return db[_0xd4c9('0x75')][_0xd4c9('0x53')](_0x2a660c);})[_0xd4c9('0x23')](function(_0xd0a252){_0x993c7f[_0xd4c9('0x54')]=_0xd0a252;return _0x993c7f;});}})[_0xd4c9('0x23')](respondWithFilteredResult(_0x1e24cc,_0x2a660c))[_0xd4c9('0x55')](handleError(_0x1e24cc,null));};exports[_0xd4c9('0x7d')]=function(_0x443451,_0x141a77){var _0x285c5a=_0x443451[_0xd4c9('0x61')]['id'];var _0x37e439=_0x443451[_0xd4c9('0x60')];var _0x544525=0xc8;var _0x5b4118=null;return db[_0xd4c9('0x7e')]['transaction']({'isolationLevel':db[_0xd4c9('0x7e')]['Transaction'][_0xd4c9('0x7f')][_0xd4c9('0x80')]},function(_0x1c9842){return db[_0xd4c9('0x3f')][_0xd4c9('0x6f')]({'where':{'id':_0x285c5a},'transaction':_0x1c9842})[_0xd4c9('0x23')](function(_0x38c226){if(_0x38c226){return db['FaxApplication'][_0xd4c9('0x38')]({'where':{'FaxAccountId':_0x285c5a},'transaction':_0x1c9842})[_0xd4c9('0x23')](function(){var _0x5ad977=_[_0xd4c9('0x45')](_0x37e439,function(_0x43d980){_0x43d980[_0xd4c9('0x64')]=_0x285c5a;return _0x43d980;});return db[_0xd4c9('0x81')][_0xd4c9('0x82')](_0x5ad977,{'transaction':_0x1c9842});});}else{_0x544525=0x194;_0x5b4118=[];}});})[_0xd4c9('0x23')](function(){if(_0x544525!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x285c5a},'order':'priority'})[_0xd4c9('0x23')](function(_0x53b4c5){_0x5b4118=_0x53b4c5;});}})[_0xd4c9('0x55')](function(_0x59bf03){_0x544525=0x1f4;logger[_0xd4c9('0x2a')](_0x59bf03['stack']);if(_0x59bf03[_0xd4c9('0x3c')]){delete _0x59bf03[_0xd4c9('0x3c')];}_0x5b4118=_0x59bf03;})['finally'](function(){if(_0x5b4118===null){_0x141a77['sendStatus'](_0x544525);}else{if(_0x544525===0x1f4){_0x141a77[_0xd4c9('0x2f')](_0x544525)[_0xd4c9('0x83')](_0x5b4118);}else{_0x141a77['status'](_0x544525)[_0xd4c9('0x84')](_0x5b4118);}}});};exports[_0xd4c9('0x85')]=function(_0x1cc214,_0x4e6658,_0x1bb92e){var _0x31b094={};var _0x28bcc2={};var _0x25f18d;var _0xc3d287;return db['FaxAccount'][_0xd4c9('0x6f')]({'where':{'id':_0x1cc214[_0xd4c9('0x61')]['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x4e6658,null))[_0xd4c9('0x23')](function(_0x1f8ca5){if(_0x1f8ca5){_0x25f18d=_0x1f8ca5;_0x28bcc2[_0xd4c9('0x44')]=_[_0xd4c9('0x47')](db[_0xd4c9('0x81')]['rawAttributes']);_0x28bcc2[_0xd4c9('0x46')]=_[_0xd4c9('0x47')](_0x1cc214[_0xd4c9('0x46')]);_0x28bcc2[_0xd4c9('0x4e')]=_['intersection'](_0x28bcc2[_0xd4c9('0x44')],_0x28bcc2['query']);_0x31b094[_0xd4c9('0x49')]=_[_0xd4c9('0x48')](_0x28bcc2[_0xd4c9('0x44')],qs['fields'](_0x1cc214[_0xd4c9('0x46')][_0xd4c9('0x4a')]));_0x31b094[_0xd4c9('0x49')]=_0x31b094[_0xd4c9('0x49')][_0xd4c9('0x57')]?_0x31b094[_0xd4c9('0x49')]:_0x28bcc2[_0xd4c9('0x44')];_0x31b094[_0xd4c9('0x4c')]=qs[_0xd4c9('0x68')](_0x1cc214[_0xd4c9('0x46')][_0xd4c9('0x68')]);_0x31b094[_0xd4c9('0x4d')]=qs['filters'](_[_0xd4c9('0x69')](_0x1cc214[_0xd4c9('0x46')],_0x28bcc2[_0xd4c9('0x4e')]));if(_0x1cc214[_0xd4c9('0x46')]['filter']){_0x31b094['where']=_['merge'](_0x31b094['where'],{'$or':_[_0xd4c9('0x45')](_0x31b094[_0xd4c9('0x49')],function(_0x3fd582){var _0x1a6eea={};_0x1a6eea[_0x3fd582]={'$like':'%'+_0x1cc214[_0xd4c9('0x46')]['filter']+'%'};return _0x1a6eea;})});}_0x31b094=_[_0xd4c9('0x50')]({},_0x31b094,_0x1cc214['options']);return _0x25f18d[_0xd4c9('0x85')](_0x31b094);}})['then'](function(_0x571665){if(_0x571665){_0xc3d287=_0x571665[_0xd4c9('0x57')];if(!_0x1cc214[_0xd4c9('0x46')]['hasOwnProperty'](_0xd4c9('0x4b'))){_0x31b094[_0xd4c9('0x32')]=qs[_0xd4c9('0x32')](_0x1cc214[_0xd4c9('0x46')][_0xd4c9('0x32')]);_0x31b094[_0xd4c9('0x30')]=qs[_0xd4c9('0x30')](_0x1cc214[_0xd4c9('0x46')]['offset']);}return _0x25f18d[_0xd4c9('0x85')](_0x31b094);}})['then'](function(_0x11b394){if(_0x11b394){return _0x11b394?{'count':_0xc3d287,'rows':_0x11b394}:null;}})[_0xd4c9('0x23')](respondWithResult(_0x4e6658,null))['catch'](handleError(_0x4e6658,null));};function Extension(_0x213126,_0x251626,_0x4a227e,_0x3fdcf3){this[_0xd4c9('0x86')]=_0xd4c9('0x87');this['exten']=_0x213126[_0xd4c9('0x88')];this[_0xd4c9('0x89')]=_0x3fdcf3;this[_0xd4c9('0x42')]=_0xd4c9('0x8a');this[_0xd4c9('0x8b')]=_0xd4c9('0x8c');this[_0xd4c9('0x64')]=_0x213126['id'];this['priority']=_0x251626;this[_0xd4c9('0x8d')]=_0x4a227e;}function createExtensionsReciveFax(_0x9aa6ca){var _0xcbad28=0x1;var _0x2c83d5=[];_0x2c83d5[_0xd4c9('0x8e')](new Extension(_0x9aa6ca,_0xcbad28,'',_0xd4c9('0x8f')));_0xcbad28+=0x1;_0x2c83d5[_0xd4c9('0x8e')](new Extension(_0x9aa6ca,_0xcbad28,_0xd4c9('0x90'),'Set'));_0xcbad28+=0x1;for(var _0x3a6844 in _0x9aa6ca){if(_0x9aa6ca['hasOwnProperty'](_0x3a6844)&&(_0x3a6844===_0xd4c9('0x91')||_0x3a6844===_0xd4c9('0x88')||_0x3a6844===_0xd4c9('0x92')||_0x3a6844===_0xd4c9('0x93')||_0x3a6844===_0xd4c9('0x94')||_0x3a6844===_0xd4c9('0x95')||_0x3a6844==='minrate'||_0x3a6844===_0xd4c9('0x96')||_0x3a6844==='t38timeout')){_0x2c83d5[_0xd4c9('0x8e')](new Extension(_0x9aa6ca,_0xcbad28,'FAXOPT('+_0x3a6844+')='+_0x9aa6ca[_0x3a6844],_0xd4c9('0x97')));_0xcbad28+=0x1;}}_0x2c83d5[_0xd4c9('0x8e')](new Extension(_0x9aa6ca,_0xcbad28,'6',_0xd4c9('0x98')));_0xcbad28+=0x1;_0x2c83d5[_0xd4c9('0x8e')](new Extension(_0x9aa6ca,_0xcbad28,_0xd4c9('0x99'),'ReceiveFax'));_0xcbad28=0x0;return _0x2c83d5;}exports[_0xd4c9('0x9a')]=function(_0x424652,_0x4a4a6e,_0x30dcd1){var _0x1d7c8e;return db[_0xd4c9('0x7e')][_0xd4c9('0x9b')](function(_0xb98836){return db[_0xd4c9('0x3f')][_0xd4c9('0x59')](_0x424652['body'],{'transaction':_0xb98836})[_0xd4c9('0x23')](function(_0x1ef751){_0x1d7c8e=_0x1ef751[_0xd4c9('0x39')]({'plain':!![]});return db[_0xd4c9('0x9c')]['bulkCreate'](createExtensionsReciveFax(_0x1d7c8e),{'transaction':_0xb98836});});})['then'](function(){return _0x1d7c8e;})['then'](respondWithResult(_0x4a4a6e,null))[_0xd4c9('0x55')](handleError(_0x4a4a6e,null));};exports[_0xd4c9('0x9d')]=function(_0x4fbc32,_0x132f79,_0x4c4777){var _0x3997dd;return db[_0xd4c9('0x7e')][_0xd4c9('0x9b')](function(_0x430fd0){return db[_0xd4c9('0x3f')][_0xd4c9('0x37')](_0x4fbc32[_0xd4c9('0x60')],{'where':{'id':_0x4fbc32[_0xd4c9('0x60')]['id']},'transaction':_0x430fd0})['then'](function(_0x1b7d1b){return db[_0xd4c9('0x9c')]['destroy']({'where':{'FaxAccountId':_0x4fbc32[_0xd4c9('0x60')]['id']},'transaction':_0x430fd0})['then'](function(_0x2d8e00){return db[_0xd4c9('0x9c')]['bulkCreate'](createExtensionsReciveFax(_[_0xd4c9('0x73')](_0x4fbc32[_0xd4c9('0x60')],[_0xd4c9('0x9e'),_0xd4c9('0x43'),_0xd4c9('0x9f'),_0xd4c9('0xa0'),_0xd4c9('0xa1'),_0xd4c9('0xa2')])),{'transaction':_0x430fd0});});});})[_0xd4c9('0x23')](function(){return db[_0xd4c9('0x3f')][_0xd4c9('0xa3')](_0x4fbc32[_0xd4c9('0x60')]['id']);})[_0xd4c9('0x23')](respondWithResult(_0x132f79,null))[_0xd4c9('0x55')](handleError(_0x132f79,null));};exports[_0xd4c9('0xa4')]=function(_0x546576,_0x147e1f,_0x4c92c6){var _0x2c5306={'raw':!![],'where':{}};var _0x6229b1={};var _0x1d07a9={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd4c9('0x6f')]({'where':{'id':_0x546576[_0xd4c9('0x61')]['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x147e1f,null))['then'](function(_0x350f9a){if(_0x350f9a){_0x6229b1[_0xd4c9('0x44')]=_['keys'](db['FaxMessage'][_0xd4c9('0x40')]);_0x6229b1[_0xd4c9('0x46')]=_[_0xd4c9('0x47')](_0x546576[_0xd4c9('0x46')]);_0x6229b1['filters']=_[_0xd4c9('0x48')](_0x6229b1['model'],_0x6229b1[_0xd4c9('0x46')]);_0x2c5306[_0xd4c9('0x49')]=_[_0xd4c9('0x48')](_0x6229b1[_0xd4c9('0x44')],qs[_0xd4c9('0x4a')](_0x546576['query'][_0xd4c9('0x4a')]));_0x2c5306[_0xd4c9('0x49')]=_0x2c5306[_0xd4c9('0x49')][_0xd4c9('0x57')]?_0x2c5306['attributes']:_0x6229b1[_0xd4c9('0x44')];if(!_0x546576[_0xd4c9('0x46')][_0xd4c9('0x67')](_0xd4c9('0x4b'))){_0x2c5306[_0xd4c9('0x32')]=qs[_0xd4c9('0x32')](_0x546576[_0xd4c9('0x46')][_0xd4c9('0x32')]);_0x2c5306['offset']=qs[_0xd4c9('0x30')](_0x546576[_0xd4c9('0x46')][_0xd4c9('0x30')]);}_0x2c5306[_0xd4c9('0x4c')]=qs[_0xd4c9('0x68')](_0x546576[_0xd4c9('0x46')][_0xd4c9('0x68')]);_0x2c5306[_0xd4c9('0x4d')]=qs[_0xd4c9('0x4e')](_[_0xd4c9('0x69')](_0x546576[_0xd4c9('0x46')],_0x6229b1['filters']));_0x2c5306[_0xd4c9('0x4d')]['FaxAccountId']=_0x350f9a['id'];if(_0x546576[_0xd4c9('0x46')][_0xd4c9('0x4f')]){_0x2c5306[_0xd4c9('0x4d')]=_[_0xd4c9('0x50')](_0x2c5306[_0xd4c9('0x4d')],{'$or':_[_0xd4c9('0x45')](_0x2c5306[_0xd4c9('0x49')],function(_0x464925){var _0x1be8ab={};_0x1be8ab[_0x464925]={'$like':'%'+_0x546576[_0xd4c9('0x46')]['filter']+'%'};return _0x1be8ab;})});}if(_0x546576[_0xd4c9('0x46')]['$gte']){var _0x1e10be=_0x546576[_0xd4c9('0x46')][_0xd4c9('0xa5')]['split'](',');var _0x212281={};_0x212281[_0x1e10be[0x0]]={'$gte':moment(_0x1e10be[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2c5306[_0xd4c9('0x4d')]=_[_0xd4c9('0x50')](_0x2c5306[_0xd4c9('0x4d')],_0x212281);}_0x2c5306=_[_0xd4c9('0x50')]({},_0x2c5306,_0x546576[_0xd4c9('0x70')]);return db[_0xd4c9('0xa6')][_0xd4c9('0x33')]({'where':_0x2c5306[_0xd4c9('0x4d')]})[_0xd4c9('0x23')](function(_0x3f4542){_0x1d07a9[_0xd4c9('0x33')]=_0x3f4542;if(_0x546576['query'][_0xd4c9('0x6a')]){_0x2c5306[_0xd4c9('0x52')]=[{'all':!![]}];}return db[_0xd4c9('0xa6')][_0xd4c9('0x53')](_0x2c5306);})[_0xd4c9('0x23')](function(_0xbdc541){_0x1d07a9[_0xd4c9('0x54')]=_0xbdc541;return _0x1d07a9;});}})['then'](respondWithFilteredResult(_0x147e1f,_0x2c5306))[_0xd4c9('0x55')](handleError(_0x147e1f,null));};exports[_0xd4c9('0x83')]=function(_0x24ad0b,_0x17f41a,_0x383085){var _0x3e9d5d,_0x2e2b9e={},_0x21ffdd;if(_0x24ad0b['body']['to']){_0x21ffdd=_0x24ad0b[_0xd4c9('0x60')]['to'][0x0];}return db['FaxAccount'][_0xd4c9('0x58')]({'where':{'id':_0x24ad0b[_0xd4c9('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0xd4c9('0xa7'),'include':[{'model':db[_0xd4c9('0x76')],'as':_0xd4c9('0xa8'),'where':{'fax':_0x21ffdd},'limit':0x1,'order':[['updatedAt',_0xd4c9('0xa9')]]}]}]})[_0xd4c9('0x23')](handleEntityNotFound(_0x17f41a,null))['then'](function(_0x22b23b){_0x3e9d5d=_0x22b23b;if(_0x24ad0b[_0xd4c9('0x60')]['attachments']&&_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')][_0xd4c9('0x57')]){for(var _0x4d2445=0x0;_0x4d2445<_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')]['length'];_0x4d2445+=0x1){_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')][_0x4d2445]={'filename':_0x24ad0b['body'][_0xd4c9('0xaa')][_0x4d2445][_0xd4c9('0x3c')],'id':_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')][_0x4d2445]['id'],'path':path[_0xd4c9('0xab')](config['root'],_0xd4c9('0xac'),_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')][_0x4d2445][_0xd4c9('0xad')])};}}return respondWithRpcPromise('CheckAfterSend',_0xd4c9('0xae'),{'FaxAccountId':_['isNil'](_0x24ad0b['params']['id'])?undefined:_0x24ad0b[_0xd4c9('0x61')]['id'],'path':_[_0xd4c9('0xaf')](_0x24ad0b['body'][_0xd4c9('0xaa')][0x0][_0xd4c9('0x6')])?undefined:_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')][0x0]['path'],'fax':_[_0xd4c9('0xaf')](_0x24ad0b['body']['to'][0x0])?undefined:_0x24ad0b['body']['to'][0x0]},client9002);})[_0xd4c9('0x23')](function(){if(_0x3e9d5d){if(_[_0xd4c9('0xaf')](_0x24ad0b['body'][_0xd4c9('0xb0')])){_0x24ad0b[_0xd4c9('0x60')]['from']=util[_0xd4c9('0xb1')](_0xd4c9('0xb2'),_0x3e9d5d[_0xd4c9('0x3c')],_0x3e9d5d[_0xd4c9('0xb3')]);}if(_0x3e9d5d[_0xd4c9('0xa7')]){if(_0x3e9d5d[_0xd4c9('0xa7')]['Contacts'][_0xd4c9('0x57')]){return _0x3e9d5d[_0xd4c9('0xa7')]['Contacts'][0x0];}else{return db['CmContact'][_0xd4c9('0x59')](_[_0xd4c9('0x1a')](_0x24ad0b[_0xd4c9('0x60')],{'firstName':_0x24ad0b[_0xd4c9('0x60')]['to'][0x0],'phone':_0x24ad0b[_0xd4c9('0x60')]['to'][0x0],'fax':_0x24ad0b['body']['to'][0x0],'ListId':_0x3e9d5d[_0xd4c9('0xa2')]}));}}else{throw new Error(_0xd4c9('0xb4'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x147bc8){if(_0x147bc8){return db[_0xd4c9('0x75')][_0xd4c9('0x58')]({'where':{'ContactId':_0x147bc8['id'],'closed':![],'FaxAccountId':_0x3e9d5d['id']}})[_0xd4c9('0x23')](function(_0x102af8){if(_0x102af8){return[_0x102af8,![]];}return db['FaxInteraction']['create']({'UserId':_0x24ad0b[_0xd4c9('0x5a')]['id'],'ContactId':_0x147bc8['id'],'FaxAccountId':_0x3e9d5d['id'],'fax':_0x24ad0b[_0xd4c9('0x60')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xd4c9('0x50')](_0x24ad0b[_0xd4c9('0x60')],{'read':![],'body':_0x24ad0b[_0xd4c9('0x60')]['attachments'][0x0]['filename'],'FaxAccountId':_0x3e9d5d['id'],'UserId':_0x24ad0b[_0xd4c9('0x5a')]['id'],'ContactId':_0x147bc8['id'],'AttachmentId':_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xd4c9('0xa6')],'as':_0xd4c9('0xb5')}]})[_0xd4c9('0x23')](function(_0x59dd01){return[_0x59dd01,!![]];});});}else{throw new Error(_0xd4c9('0xb6'));}})[_0xd4c9('0xb7')](function(_0x1cb589,_0x5e6473){if(_0x5e6473){return _0x1cb589;}return db[_0xd4c9('0xa6')]['create']({'direction':_0xd4c9('0xb8'),'read':![],'body':_0x24ad0b['body']['attachments'][0x0][_0xd4c9('0xb9')],'FaxAccountId':_0x3e9d5d['id'],'FaxInteractionId':_0x1cb589['id'],'UserId':_0x24ad0b[_0xd4c9('0x5a')]['id'],'ContactId':_0x1cb589[_0xd4c9('0xba')],'AttachmentId':_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')][0x0]['id']})['then'](function(_0x21c703){_0x1cb589[_0xd4c9('0xbb')]['Messages']=[];_0x1cb589[_0xd4c9('0xbb')][_0xd4c9('0xb5')][_0xd4c9('0x8e')](_0x21c703[_0xd4c9('0xbb')]);return _0x1cb589;});})[_0xd4c9('0x23')](function(_0x138aaa){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xd4c9('0xaf')](_0x24ad0b[_0xd4c9('0x61')]['id'])?undefined:_0x24ad0b[_0xd4c9('0x61')]['id'],'path':_[_0xd4c9('0xaf')](_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')][0x0][_0xd4c9('0x6')])?undefined:_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')][0x0][_0xd4c9('0x6')],'fax':_[_0xd4c9('0xaf')](_0x24ad0b['body']['to'][0x0])?undefined:_0x24ad0b[_0xd4c9('0x60')]['to'][0x0],'AttachmentId':_0x24ad0b[_0xd4c9('0x60')][_0xd4c9('0xaa')][0x0]['id']},client9002)['then'](function(_0x421b6a){logger['info']('SendFaxRpc,\x20%s',_0x421b6a);})[_0xd4c9('0x55')](function(_0x1aba06){logger['info'](_0xd4c9('0xbc'),_0x1aba06);});return _0x138aaa;})[_0xd4c9('0x23')](respondWithResult(_0x17f41a,null))[_0xd4c9('0x55')](handleError(_0x17f41a,null));};exports[_0xd4c9('0xbd')]=function(_0x17cb46,_0x3911d3,_0x481525){return db['FaxAccount'][_0xd4c9('0x58')]({'where':{'id':_0x17cb46['params']['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x3911d3,null))[_0xd4c9('0x23')](function(_0x1b7762){if(_0x1b7762){return _0x1b7762[_0xd4c9('0xbd')](_0x17cb46[_0xd4c9('0x60')][_0xd4c9('0x6c')],_[_0xd4c9('0x73')](_0x17cb46[_0xd4c9('0x60')],[_0xd4c9('0x6c'),'id'])||{})[_0xd4c9('0xb7')](function(_0x248d09){for(var _0x40f011=0x0;_0x40f011<_0x17cb46[_0xd4c9('0x60')][_0xd4c9('0x6c')][_0xd4c9('0x57')];_0x40f011+=0x1){socket[_0xd4c9('0xbe')]('userFaxAccount:save',{'UserId':Number(_0x17cb46['body']['ids'][_0x40f011]),'FaxAccountId':Number(_0x17cb46['params']['id'])});}return _0x248d09;});}})['then'](respondWithResult(_0x3911d3,null))[_0xd4c9('0x55')](handleError(_0x3911d3,null));};exports[_0xd4c9('0xbf')]=function(_0x38cf3e,_0x3fc941,_0x1aa143){return db[_0xd4c9('0x3f')][_0xd4c9('0x58')]({'where':{'id':_0x38cf3e[_0xd4c9('0x61')]['id']}})['then'](handleEntityNotFound(_0x3fc941,null))[_0xd4c9('0x23')](function(_0x1c9d4b){if(_0x1c9d4b){return _0x1c9d4b[_0xd4c9('0xbf')](_0x38cf3e[_0xd4c9('0x46')]['ids'])[_0xd4c9('0x23')](function(){if(_[_0xd4c9('0xc0')](_0x38cf3e[_0xd4c9('0x46')][_0xd4c9('0x6c')])){for(var _0x51aea9=0x0;_0x51aea9<_0x38cf3e[_0xd4c9('0x46')][_0xd4c9('0x6c')][_0xd4c9('0x57')];_0x51aea9+=0x1){socket[_0xd4c9('0xbe')](_0xd4c9('0xc1'),{'UserId':Number(_0x38cf3e['query']['ids'][_0x51aea9]),'FaxAccountId':Number(_0x38cf3e[_0xd4c9('0x61')]['id'])});}}else{socket[_0xd4c9('0xbe')](_0xd4c9('0xc1'),{'UserId':Number(_0x38cf3e[_0xd4c9('0x46')][_0xd4c9('0x6c')]),'FaxAccountId':Number(_0x38cf3e[_0xd4c9('0x61')]['id'])});}});}})[_0xd4c9('0x23')](respondWithStatusCode(_0x3fc941,null))[_0xd4c9('0x55')](handleError(_0x3fc941,null));};exports[_0xd4c9('0xc2')]=function(_0x934a2d,_0x57fada,_0x542616){var _0x274878={};var _0x250814={};var _0x3adb64;var _0x3728bf;return db[_0xd4c9('0x3f')]['findOne']({'where':{'id':_0x934a2d[_0xd4c9('0x61')]['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x57fada,null))[_0xd4c9('0x23')](function(_0x205ac6){if(_0x205ac6){_0x3adb64=_0x205ac6;_0x250814[_0xd4c9('0x44')]=_[_0xd4c9('0x47')](db[_0xd4c9('0x78')][_0xd4c9('0x40')]);_0x250814[_0xd4c9('0x46')]=_[_0xd4c9('0x47')](_0x934a2d[_0xd4c9('0x46')]);_0x250814['filters']=_['intersection'](_0x250814[_0xd4c9('0x44')],_0x250814[_0xd4c9('0x46')]);_0x274878[_0xd4c9('0x49')]=_[_0xd4c9('0x48')](_0x250814[_0xd4c9('0x44')],qs[_0xd4c9('0x4a')](_0x934a2d[_0xd4c9('0x46')]['fields']));_0x274878['attributes']=_0x274878[_0xd4c9('0x49')][_0xd4c9('0x57')]?_0x274878['attributes']:_0x250814['model'];_0x274878[_0xd4c9('0x4c')]=qs[_0xd4c9('0x68')](_0x934a2d[_0xd4c9('0x46')][_0xd4c9('0x68')]);_0x274878['where']=qs[_0xd4c9('0x4e')](_[_0xd4c9('0x69')](_0x934a2d[_0xd4c9('0x46')],_0x250814['filters']));if(_0x934a2d[_0xd4c9('0x46')]['filter']){_0x274878[_0xd4c9('0x4d')]=_[_0xd4c9('0x50')](_0x274878[_0xd4c9('0x4d')],{'$or':_[_0xd4c9('0x45')](_0x274878[_0xd4c9('0x49')],function(_0x56fbe3){var _0x181bd7={};_0x181bd7[_0x56fbe3]={'$like':'%'+_0x934a2d[_0xd4c9('0x46')]['filter']+'%'};return _0x181bd7;})});}_0x274878=_[_0xd4c9('0x50')]({},_0x274878,_0x934a2d[_0xd4c9('0x70')]);return _0x3adb64['getAgents'](_0x274878);}})['then'](function(_0x32a705){if(_0x32a705){_0x3728bf=_0x32a705[_0xd4c9('0x57')];if(!_0x934a2d[_0xd4c9('0x46')][_0xd4c9('0x67')](_0xd4c9('0x4b'))){_0x274878[_0xd4c9('0x32')]=qs[_0xd4c9('0x32')](_0x934a2d[_0xd4c9('0x46')][_0xd4c9('0x32')]);_0x274878[_0xd4c9('0x30')]=qs['offset'](_0x934a2d['query'][_0xd4c9('0x30')]);}return _0x3adb64[_0xd4c9('0xc2')](_0x274878);}})[_0xd4c9('0x23')](function(_0x308d5a){if(_0x308d5a){return _0x308d5a?{'count':_0x3728bf,'rows':_0x308d5a}:null;}})[_0xd4c9('0x23')](respondWithResult(_0x57fada,null))['catch'](handleError(_0x57fada,null));}; \ No newline at end of file +var _0xab19=['then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','merge','where','filter','options','FaxAccount','include','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','findOne','order','pick','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','addInteraction','FaxInteraction','omit','User','fullname','internal','Tag','Tags','color','tag','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','sequelize','VoiceExtension','updateAccountApplications','updatedAt','TrunkId','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','fax','List','ListId','List\x20not\x20found','out','Messages','spread','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request'];(function(_0x57ef11,_0x23a9b2){var _0x1bf2be=function(_0x1c43ae){while(--_0x1c43ae){_0x57ef11['push'](_0x57ef11['shift']());}};_0x1bf2be(++_0x23a9b2);}(_0xab19,0x156));var _0x9ab1=function(_0x1e0eba,_0x15a84c){_0x1e0eba=_0x1e0eba-0x0;var _0x631c66=_0xab19[_0x1e0eba];return _0x631c66;};'use strict';var emlformat=require(_0x9ab1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9ab1('0x1'));var rp=require('request-promise');var moment=require(_0x9ab1('0x2'));var BPromise=require(_0x9ab1('0x3'));var Mustache=require(_0x9ab1('0x4'));var util=require(_0x9ab1('0x5'));var path=require('path');var sox=require(_0x9ab1('0x6'));var csv=require(_0x9ab1('0x7'));var ejs=require(_0x9ab1('0x8'));var fs=require('fs');var fs_extra=require(_0x9ab1('0x9'));var _=require(_0x9ab1('0xa'));var squel=require(_0x9ab1('0xb'));var crypto=require(_0x9ab1('0xc'));var jsforce=require(_0x9ab1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9ab1('0x7'));var querystring=require(_0x9ab1('0xe'));var Papa=require(_0x9ab1('0xf'));var Redis=require(_0x9ab1('0x10'));var authService=require(_0x9ab1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9ab1('0x12'));var hardwareService=require(_0x9ab1('0x13'));var logger=require(_0x9ab1('0x14'))(_0x9ab1('0x15'));var utils=require(_0x9ab1('0x16'));var config=require(_0x9ab1('0x17'));var licenseUtil=require(_0x9ab1('0x18'));var db=require(_0x9ab1('0x19'))['db'];config[_0x9ab1('0x1a')]=_[_0x9ab1('0x1b')](config[_0x9ab1('0x1a')],{'host':_0x9ab1('0x1c'),'port':0x18eb});var socket=require(_0x9ab1('0x1d'))(new Redis(config['redis']));require(_0x9ab1('0x1e'))[_0x9ab1('0x1f')](socket);var jayson=require(_0x9ab1('0x20'));var client=jayson[_0x9ab1('0x21')][_0x9ab1('0x22')]({'port':0x232c});var client9002=jayson[_0x9ab1('0x21')][_0x9ab1('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x41f54b,_0x8dbddf,_0x20409a,_0x3c1506){return new BPromise(function(_0x3e1c67,_0x5dc5da){var _0x43951c=_0x3c1506||client;return _0x43951c[_0x9ab1('0x23')](_0x41f54b,_0x20409a)[_0x9ab1('0x24')](function(_0x430c39){logger[_0x9ab1('0x25')](_0x9ab1('0x26'),_0x8dbddf,_0x9ab1('0x27'));logger['debug'](_0x9ab1('0x28'),_0x8dbddf,_0x9ab1('0x27'),JSON[_0x9ab1('0x29')](_0x430c39));if(_0x430c39[_0x9ab1('0x2a')]){if(_0x430c39[_0x9ab1('0x2a')]['code']===0x1f4){logger[_0x9ab1('0x2a')](_0x9ab1('0x26'),_0x8dbddf,_0x430c39[_0x9ab1('0x2a')][_0x9ab1('0x2b')]);return _0x5dc5da(_0x430c39['error']['message']);}logger[_0x9ab1('0x2a')](_0x9ab1('0x26'),_0x8dbddf,_0x430c39[_0x9ab1('0x2a')][_0x9ab1('0x2b')]);return _0x3e1c67(_0x430c39[_0x9ab1('0x2a')][_0x9ab1('0x2b')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x8dbddf,_0x9ab1('0x27'));_0x3e1c67(_0x430c39['result']['message']);}})[_0x9ab1('0x2c')](function(_0x2c4db4){logger[_0x9ab1('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x8dbddf,_0x2c4db4);_0x5dc5da(_0x2c4db4);});});}function respondWithStatusCode(_0x1b376f,_0xa464d9){_0xa464d9=_0xa464d9||0xcc;return function(_0x955d40){if(_0x955d40){return _0x1b376f[_0x9ab1('0x2d')](_0xa464d9);}return _0x1b376f['status'](_0xa464d9)[_0x9ab1('0x2e')]();};}function respondWithResult(_0x2ef930,_0x42b3b9){_0x42b3b9=_0x42b3b9||0xc8;return function(_0x11bbe8){if(_0x11bbe8){return _0x2ef930[_0x9ab1('0x2f')](_0x42b3b9)['json'](_0x11bbe8);}};}function respondWithFilteredResult(_0x4c67aa,_0x5c5e8c){return function(_0x5f12d3){if(_0x5f12d3){var _0x161d4b=typeof _0x5c5e8c[_0x9ab1('0x30')]===_0x9ab1('0x31')&&typeof _0x5c5e8c[_0x9ab1('0x32')]===_0x9ab1('0x31');var _0xd245ef=_0x5f12d3[_0x9ab1('0x33')];var _0x33cb8a=_0x161d4b?0x0:_0x5c5e8c[_0x9ab1('0x30')];var _0x3adb56=_0x161d4b?_0x5f12d3[_0x9ab1('0x33')]:_0x5c5e8c[_0x9ab1('0x30')]+_0x5c5e8c[_0x9ab1('0x32')];var _0x501d5b;if(_0x3adb56>=_0xd245ef){_0x3adb56=_0xd245ef;_0x501d5b=0xc8;}else{_0x501d5b=0xce;}_0x4c67aa[_0x9ab1('0x2f')](_0x501d5b);return _0x4c67aa[_0x9ab1('0x34')](_0x9ab1('0x35'),_0x33cb8a+'-'+_0x3adb56+'/'+_0xd245ef)[_0x9ab1('0x36')](_0x5f12d3);}return null;};}function patchUpdates(_0x4ebf55){return function(_0x4e68e9){try{jsonpatch['apply'](_0x4e68e9,_0x4ebf55,!![]);}catch(_0x351ef){return BPromise[_0x9ab1('0x37')](_0x351ef);}return _0x4e68e9['save']();};}function saveUpdates(_0xf44ed0,_0xd2d392){return function(_0x1dfea9){if(_0x1dfea9){return _0x1dfea9[_0x9ab1('0x38')](_0xf44ed0)[_0x9ab1('0x24')](function(_0x5a92b9){return _0x5a92b9;});}return null;};}function removeEntity(_0x13174f,_0x5a4700){return function(_0x3060d0){if(_0x3060d0){return _0x3060d0['destroy']()[_0x9ab1('0x24')](function(){var _0x2530f3=_0x3060d0[_0x9ab1('0x39')]({'plain':!![]});var _0x2c56e5=_0x9ab1('0x3a');return db[_0x9ab1('0x3b')][_0x9ab1('0x3c')]({'where':{'type':_0x2c56e5,'resourceId':_0x2530f3['id']}})[_0x9ab1('0x24')](function(){return _0x3060d0;});})[_0x9ab1('0x24')](function(){_0x13174f[_0x9ab1('0x2f')](0xcc)[_0x9ab1('0x2e')]();});}};}function handleEntityNotFound(_0x58798e,_0x2e8bb6){return function(_0x206012){if(!_0x206012){_0x58798e['sendStatus'](0x194);}return _0x206012;};}function handleError(_0x11eda6,_0x5b0298){_0x5b0298=_0x5b0298||0x1f4;return function(_0x2cebfa){logger[_0x9ab1('0x2a')](_0x2cebfa[_0x9ab1('0x3d')]);if(_0x2cebfa['name']){delete _0x2cebfa[_0x9ab1('0x3e')];}_0x11eda6[_0x9ab1('0x2f')](_0x5b0298)[_0x9ab1('0x3f')](_0x2cebfa);};}exports[_0x9ab1('0x40')]=function(_0x17afcb,_0xe1e8a6){var _0x54ddeb={'include':[{'model':db[_0x9ab1('0x41')],'as':_0x9ab1('0x42')}]},_0x5374e0={},_0x5dcabf={'count':0x0,'rows':[]};var _0x27d2ed=_[_0x9ab1('0x43')](db['FaxAccount'][_0x9ab1('0x44')],function(_0x3c1804){return{'name':_0x3c1804[_0x9ab1('0x45')],'type':_0x3c1804[_0x9ab1('0x46')][_0x9ab1('0x47')]};});_0x5374e0[_0x9ab1('0x48')]=_[_0x9ab1('0x43')](_0x27d2ed,_0x9ab1('0x3e'));_0x5374e0[_0x9ab1('0x49')]=_[_0x9ab1('0x4a')](_0x17afcb[_0x9ab1('0x49')]);_0x5374e0[_0x9ab1('0x4b')]=_['intersection'](_0x5374e0[_0x9ab1('0x48')],_0x5374e0[_0x9ab1('0x49')]);_0x54ddeb['attributes']=_[_0x9ab1('0x4c')](_0x5374e0[_0x9ab1('0x48')],qs[_0x9ab1('0x4d')](_0x17afcb[_0x9ab1('0x49')][_0x9ab1('0x4d')]));_0x54ddeb['attributes']=_0x54ddeb[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x54ddeb[_0x9ab1('0x4e')]:_0x5374e0[_0x9ab1('0x48')];if(!_0x17afcb[_0x9ab1('0x49')][_0x9ab1('0x50')](_0x9ab1('0x51'))){_0x54ddeb[_0x9ab1('0x32')]=qs[_0x9ab1('0x32')](_0x17afcb[_0x9ab1('0x49')][_0x9ab1('0x32')]);_0x54ddeb[_0x9ab1('0x30')]=qs['offset'](_0x17afcb['query'][_0x9ab1('0x30')]);}_0x54ddeb['order']=qs[_0x9ab1('0x52')](_0x17afcb['query']['sort']);_0x54ddeb['where']=qs[_0x9ab1('0x4b')](_['pick'](_0x17afcb[_0x9ab1('0x49')],_0x5374e0['filters']),_0x27d2ed);if(_0x17afcb[_0x9ab1('0x49')]['filter']){_0x54ddeb['where']=_[_0x9ab1('0x53')](_0x54ddeb[_0x9ab1('0x54')],{'$or':_[_0x9ab1('0x43')](_0x27d2ed,function(_0x48e9fd){if(_0x48e9fd[_0x9ab1('0x46')]!=='VIRTUAL'){var _0x50a34d={};_0x50a34d[_0x48e9fd[_0x9ab1('0x3e')]]={'$like':'%'+_0x17afcb[_0x9ab1('0x49')][_0x9ab1('0x55')]+'%'};return _0x50a34d;}})});}_0x54ddeb=_[_0x9ab1('0x53')]({},_0x54ddeb,_0x17afcb[_0x9ab1('0x56')]);var _0x255768={'where':_0x54ddeb[_0x9ab1('0x54')]};return db[_0x9ab1('0x57')][_0x9ab1('0x33')](_0x255768)['then'](function(_0x448058){_0x5dcabf[_0x9ab1('0x33')]=_0x448058;if(_0x17afcb[_0x9ab1('0x49')]['includeAll']){_0x54ddeb[_0x9ab1('0x58')]=[{'all':!![]}];}return db[_0x9ab1('0x57')]['findAll'](_0x54ddeb);})[_0x9ab1('0x24')](function(_0x46117e){_0x5dcabf['rows']=_0x46117e;return _0x5dcabf;})[_0x9ab1('0x24')](respondWithFilteredResult(_0xe1e8a6,_0x54ddeb))[_0x9ab1('0x2c')](handleError(_0xe1e8a6,null));};exports[_0x9ab1('0x59')]=function(_0x3d8205,_0x89ea0a){var _0x233fec={'raw':![],'where':{'id':_0x3d8205[_0x9ab1('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x9ab1('0x42')}]},_0x3c6a41={};_0x3c6a41['model']=_[_0x9ab1('0x4a')](db[_0x9ab1('0x57')][_0x9ab1('0x44')]);_0x3c6a41[_0x9ab1('0x49')]=_[_0x9ab1('0x4a')](_0x3d8205[_0x9ab1('0x49')]);_0x3c6a41[_0x9ab1('0x4b')]=_['intersection'](_0x3c6a41['model'],_0x3c6a41['query']);_0x233fec[_0x9ab1('0x4e')]=_[_0x9ab1('0x4c')](_0x3c6a41['model'],qs[_0x9ab1('0x4d')](_0x3d8205[_0x9ab1('0x49')][_0x9ab1('0x4d')]));_0x233fec[_0x9ab1('0x4e')]=_0x233fec[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x233fec['attributes']:_0x3c6a41[_0x9ab1('0x48')];if(_0x3d8205[_0x9ab1('0x49')]['includeAll']){_0x233fec[_0x9ab1('0x58')]=[{'all':!![]}];}_0x233fec=_[_0x9ab1('0x53')]({},_0x233fec,_0x3d8205[_0x9ab1('0x56')]);return db['FaxAccount'][_0x9ab1('0x5b')](_0x233fec)[_0x9ab1('0x24')](handleEntityNotFound(_0x89ea0a,null))[_0x9ab1('0x24')](respondWithResult(_0x89ea0a,null))[_0x9ab1('0x2c')](handleError(_0x89ea0a,null));};exports['create']=function(_0x46b2fd,_0x43eda5){return db[_0x9ab1('0x57')][_0x9ab1('0x5c')](_0x46b2fd['body'],{})[_0x9ab1('0x24')](function(_0x1e06e0){var _0x424f1b=_0x46b2fd[_0x9ab1('0x5d')][_0x9ab1('0x39')]({'plain':!![]});if(!_0x424f1b)throw new Error(_0x9ab1('0x5e'));if(_0x424f1b['role']===_0x9ab1('0x5d')){var _0x3d4120=_0x1e06e0[_0x9ab1('0x39')]({'plain':!![]});var _0x37a023=_0x9ab1('0x3a');return db['UserProfileSection'][_0x9ab1('0x5b')]({'where':{'name':_0x37a023,'userProfileId':_0x424f1b['userProfileId']},'raw':!![]})['then'](function(_0x52b5e4){if(_0x52b5e4&&_0x52b5e4[_0x9ab1('0x5f')]===0x0){return db[_0x9ab1('0x3b')][_0x9ab1('0x5c')]({'name':_0x3d4120[_0x9ab1('0x3e')],'resourceId':_0x3d4120['id'],'type':_0x52b5e4[_0x9ab1('0x3e')],'sectionId':_0x52b5e4['id']},{})[_0x9ab1('0x24')](function(){return _0x1e06e0;});}else{return _0x1e06e0;}})[_0x9ab1('0x2c')](function(_0x3ac35c){logger['error'](_0x9ab1('0x60'),_0x3ac35c);throw _0x3ac35c;});}return _0x1e06e0;})[_0x9ab1('0x24')](respondWithResult(_0x43eda5,0xc9))[_0x9ab1('0x2c')](handleError(_0x43eda5,null));};exports['update']=function(_0x5464d3,_0x54b84d){if(_0x5464d3[_0x9ab1('0x61')]['id']){delete _0x5464d3[_0x9ab1('0x61')]['id'];}return db[_0x9ab1('0x57')][_0x9ab1('0x5b')]({'where':{'id':_0x5464d3['params']['id']},'include':[{'model':db[_0x9ab1('0x41')],'as':_0x9ab1('0x42')}]})[_0x9ab1('0x24')](handleEntityNotFound(_0x54b84d,null))[_0x9ab1('0x24')](saveUpdates(_0x5464d3[_0x9ab1('0x61')],null))[_0x9ab1('0x24')](respondWithResult(_0x54b84d,null))[_0x9ab1('0x2c')](handleError(_0x54b84d,null));};exports[_0x9ab1('0x3c')]=function(_0x446ff7,_0x348be2){return db['FaxAccount'][_0x9ab1('0x5b')]({'where':{'id':_0x446ff7[_0x9ab1('0x5a')]['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x348be2,null))[_0x9ab1('0x24')](removeEntity(_0x348be2,null))[_0x9ab1('0x2c')](handleError(_0x348be2,null));};exports[_0x9ab1('0x62')]=function(_0x3aa6e1,_0x40e33e){return db[_0x9ab1('0x57')][_0x9ab1('0x62')]()[_0x9ab1('0x24')](respondWithResult(_0x40e33e,null))[_0x9ab1('0x2c')](handleError(_0x40e33e,null));};exports[_0x9ab1('0x63')]=function(_0x2b3150,_0x4e2719,_0x253f5f){if(_0x2b3150[_0x9ab1('0x61')]['id']){delete _0x2b3150['body']['id'];}return db[_0x9ab1('0x57')]['find']({'where':{'id':_0x2b3150[_0x9ab1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4e2719,null))[_0x9ab1('0x24')](function(_0x384f6e){if(_0x384f6e){_0x2b3150[_0x9ab1('0x61')][_0x9ab1('0x64')]=_0x384f6e['id'];return db[_0x9ab1('0x65')][_0x9ab1('0x5c')](_0x2b3150[_0x9ab1('0x61')]);}})[_0x9ab1('0x24')](respondWithResult(_0x4e2719,null))[_0x9ab1('0x2c')](handleError(_0x4e2719,null));};exports['getDispositions']=function(_0xafac82,_0x1d4af3,_0xb81b4c){var _0x4f64ee={'raw':![],'where':{}};var _0x278416={};var _0x5d1984={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9ab1('0x66')]({'where':{'id':_0xafac82['params']['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x1d4af3,null))[_0x9ab1('0x24')](function(_0x2b5738){if(_0x2b5738){_0x278416[_0x9ab1('0x48')]=_['keys'](db['Disposition'][_0x9ab1('0x44')]);_0x278416['query']=_[_0x9ab1('0x4a')](_0xafac82[_0x9ab1('0x49')]);_0x278416[_0x9ab1('0x4b')]=_['intersection'](_0x278416[_0x9ab1('0x48')],_0x278416[_0x9ab1('0x49')]);_0x4f64ee['attributes']=_[_0x9ab1('0x4c')](_0x278416['model'],qs['fields'](_0xafac82[_0x9ab1('0x49')][_0x9ab1('0x4d')]));_0x4f64ee[_0x9ab1('0x4e')]=_0x4f64ee[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x4f64ee['attributes']:_0x278416['model'];if(!_0xafac82[_0x9ab1('0x49')][_0x9ab1('0x50')]('nolimit')){_0x4f64ee[_0x9ab1('0x32')]=qs['limit'](_0xafac82[_0x9ab1('0x49')][_0x9ab1('0x32')]);_0x4f64ee['offset']=qs['offset'](_0xafac82['query'][_0x9ab1('0x30')]);}_0x4f64ee[_0x9ab1('0x67')]=qs[_0x9ab1('0x52')](_0xafac82[_0x9ab1('0x49')][_0x9ab1('0x52')]);_0x4f64ee[_0x9ab1('0x54')]=qs[_0x9ab1('0x4b')](_[_0x9ab1('0x68')](_0xafac82[_0x9ab1('0x49')],_0x278416[_0x9ab1('0x4b')]));_0x4f64ee['where'][_0x9ab1('0x64')]=_0x2b5738['id'];if(_0xafac82['query'][_0x9ab1('0x55')]){_0x4f64ee[_0x9ab1('0x54')]=_['merge'](_0x4f64ee['where'],{'$or':_[_0x9ab1('0x43')](_0x4f64ee[_0x9ab1('0x4e')],function(_0x6812ca){var _0x145f22={};_0x145f22[_0x6812ca]={'$like':'%'+_0xafac82['query'][_0x9ab1('0x55')]+'%'};return _0x145f22;})});}_0x4f64ee=_[_0x9ab1('0x53')]({},_0x4f64ee,_0xafac82[_0x9ab1('0x56')]);return db[_0x9ab1('0x65')]['count']({'where':_0x4f64ee[_0x9ab1('0x54')]})[_0x9ab1('0x24')](function(_0x3b54d7){_0x5d1984[_0x9ab1('0x33')]=_0x3b54d7;if(_0xafac82[_0x9ab1('0x49')][_0x9ab1('0x69')]){_0x4f64ee[_0x9ab1('0x58')]=[{'all':!![]}];}return db[_0x9ab1('0x65')]['findAll'](_0x4f64ee);})[_0x9ab1('0x24')](function(_0x51feda){_0x5d1984[_0x9ab1('0x6a')]=_0x51feda;return _0x5d1984;});}})[_0x9ab1('0x24')](respondWithFilteredResult(_0x1d4af3,_0x4f64ee))[_0x9ab1('0x2c')](handleError(_0x1d4af3,null));};exports[_0x9ab1('0x6b')]=function(_0x2b1a3b,_0x5569f6,_0x322102){return db['FaxAccount'][_0x9ab1('0x5b')]({'where':{'id':_0x2b1a3b[_0x9ab1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5569f6,null))[_0x9ab1('0x24')](function(_0x52d7f7){if(_0x52d7f7){return _0x52d7f7['removeDispositions'](_0x2b1a3b[_0x9ab1('0x49')][_0x9ab1('0x6c')]);}})[_0x9ab1('0x24')](respondWithStatusCode(_0x5569f6,null))['catch'](handleError(_0x5569f6,null));};exports[_0x9ab1('0x6d')]=function(_0x5c30a7,_0x104583,_0x1d7e9f){if(_0x5c30a7['body']['id']){delete _0x5c30a7[_0x9ab1('0x61')]['id'];}return db[_0x9ab1('0x57')]['find']({'where':{'id':_0x5c30a7['params']['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x104583,null))[_0x9ab1('0x24')](function(_0x5b4d45){if(_0x5b4d45){_0x5c30a7[_0x9ab1('0x61')]['FaxAccountId']=_0x5b4d45['id'];return db[_0x9ab1('0x6e')]['create'](_0x5c30a7[_0x9ab1('0x61')]);}})['then'](respondWithResult(_0x104583,null))[_0x9ab1('0x2c')](handleError(_0x104583,null));};exports[_0x9ab1('0x6f')]=function(_0x27828e,_0x3a4cda,_0x3c7641){var _0x5634c9={'raw':![],'where':{}};var _0x404f09={};var _0x125de2={'count':0x0,'rows':[]};return db[_0x9ab1('0x57')][_0x9ab1('0x66')]({'where':{'id':_0x27828e[_0x9ab1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3a4cda,null))['then'](function(_0x478ec4){if(_0x478ec4){_0x404f09[_0x9ab1('0x48')]=_[_0x9ab1('0x4a')](db['CannedAnswer'][_0x9ab1('0x44')]);_0x404f09[_0x9ab1('0x49')]=_['keys'](_0x27828e[_0x9ab1('0x49')]);_0x404f09[_0x9ab1('0x4b')]=_[_0x9ab1('0x4c')](_0x404f09['model'],_0x404f09['query']);_0x5634c9['attributes']=_[_0x9ab1('0x4c')](_0x404f09[_0x9ab1('0x48')],qs[_0x9ab1('0x4d')](_0x27828e['query'][_0x9ab1('0x4d')]));_0x5634c9[_0x9ab1('0x4e')]=_0x5634c9[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x5634c9['attributes']:_0x404f09[_0x9ab1('0x48')];if(!_0x27828e[_0x9ab1('0x49')][_0x9ab1('0x50')]('nolimit')){_0x5634c9['limit']=qs['limit'](_0x27828e['query'][_0x9ab1('0x32')]);_0x5634c9[_0x9ab1('0x30')]=qs[_0x9ab1('0x30')](_0x27828e[_0x9ab1('0x49')][_0x9ab1('0x30')]);}_0x5634c9[_0x9ab1('0x67')]=qs[_0x9ab1('0x52')](_0x27828e[_0x9ab1('0x49')][_0x9ab1('0x52')]);_0x5634c9[_0x9ab1('0x54')]=qs[_0x9ab1('0x4b')](_[_0x9ab1('0x68')](_0x27828e[_0x9ab1('0x49')],_0x404f09[_0x9ab1('0x4b')]));_0x5634c9[_0x9ab1('0x54')]['FaxAccountId']=_0x478ec4['id'];if(_0x27828e[_0x9ab1('0x49')][_0x9ab1('0x55')]){_0x5634c9['where']=_[_0x9ab1('0x53')](_0x5634c9['where'],{'$or':_[_0x9ab1('0x43')](_0x5634c9[_0x9ab1('0x4e')],function(_0x52a1a4){var _0x402359={};_0x402359[_0x52a1a4]={'$like':'%'+_0x27828e[_0x9ab1('0x49')][_0x9ab1('0x55')]+'%'};return _0x402359;})});}_0x5634c9=_['merge']({},_0x5634c9,_0x27828e[_0x9ab1('0x56')]);return db[_0x9ab1('0x6e')][_0x9ab1('0x33')]({'where':_0x5634c9[_0x9ab1('0x54')]})['then'](function(_0x15ba0f){_0x125de2[_0x9ab1('0x33')]=_0x15ba0f;if(_0x27828e['query'][_0x9ab1('0x69')]){_0x5634c9[_0x9ab1('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9ab1('0x70')](_0x5634c9);})[_0x9ab1('0x24')](function(_0x1032d7){_0x125de2[_0x9ab1('0x6a')]=_0x1032d7;return _0x125de2;});}})['then'](respondWithFilteredResult(_0x3a4cda,_0x5634c9))[_0x9ab1('0x2c')](handleError(_0x3a4cda,null));};exports['removeAnswers']=function(_0x1ac036,_0x3eb65b,_0x4e42fe){return db[_0x9ab1('0x57')]['find']({'where':{'id':_0x1ac036[_0x9ab1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3eb65b,null))[_0x9ab1('0x24')](function(_0x17b3e1){if(_0x17b3e1){return _0x17b3e1['removeAnswers'](_0x1ac036[_0x9ab1('0x49')][_0x9ab1('0x6c')]);}})[_0x9ab1('0x24')](respondWithStatusCode(_0x3eb65b,null))[_0x9ab1('0x2c')](handleError(_0x3eb65b,null));};exports[_0x9ab1('0x71')]=function(_0x42a69a,_0x4c27b7,_0x172d72){return db[_0x9ab1('0x72')][_0x9ab1('0x5b')]({'where':{'id':_0x42a69a['params']['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x4c27b7,null))[_0x9ab1('0x24')](function(_0x444673){if(_0x444673){return _0x444673[_0x9ab1('0x71')](_0x42a69a['body'][_0x9ab1('0x6c')],_[_0x9ab1('0x73')](_0x42a69a[_0x9ab1('0x61')],[_0x9ab1('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x4c27b7,null))[_0x9ab1('0x2c')](handleError(_0x4c27b7,null));};exports['getInteractions']=function(_0x5d9e50,_0x5f0226,_0x509044){var _0x5159a3={'raw':![],'where':{}};var _0x487ee6={};var _0x5be674={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9ab1('0x66')]({'where':{'id':_0x5d9e50['params']['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x5f0226,null))[_0x9ab1('0x24')](function(_0x41db89){if(_0x41db89){_0x487ee6['model']=_['keys'](db[_0x9ab1('0x72')][_0x9ab1('0x44')]);_0x487ee6[_0x9ab1('0x49')]=_[_0x9ab1('0x4a')](_0x5d9e50[_0x9ab1('0x49')]);_0x487ee6[_0x9ab1('0x4b')]=_[_0x9ab1('0x4c')](_0x487ee6[_0x9ab1('0x48')],_0x487ee6['query']);_0x5159a3['attributes']=_[_0x9ab1('0x4c')](_0x487ee6[_0x9ab1('0x48')],qs[_0x9ab1('0x4d')](_0x5d9e50['query']['fields']));_0x5159a3[_0x9ab1('0x4e')]=_0x5159a3['attributes'][_0x9ab1('0x4f')]?_0x5159a3[_0x9ab1('0x4e')]:_0x487ee6[_0x9ab1('0x48')];if(!_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x50')]('nolimit')){_0x5159a3[_0x9ab1('0x32')]=qs['limit'](_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x32')]);_0x5159a3[_0x9ab1('0x30')]=qs[_0x9ab1('0x30')](_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x30')]);}_0x5159a3[_0x9ab1('0x67')]=qs[_0x9ab1('0x52')](_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x52')]);_0x5159a3[_0x9ab1('0x54')]=qs[_0x9ab1('0x4b')](_['pick'](_0x5d9e50[_0x9ab1('0x49')],_0x487ee6['filters']));_0x5159a3['where'][_0x9ab1('0x64')]=_0x41db89['id'];if(_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x55')]){_0x5159a3['where']=_[_0x9ab1('0x53')](_0x5159a3['where'],{'$or':_[_0x9ab1('0x43')](_0x5159a3[_0x9ab1('0x4e')],function(_0x36995a){var _0x578cab={};_0x578cab[_0x36995a]={'$like':'%'+_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x55')]+'%'};return _0x578cab;})});}_0x5159a3=_[_0x9ab1('0x53')]({},_0x5159a3,_0x5d9e50['options']);return db['FaxInteraction'][_0x9ab1('0x33')]({'where':_0x5159a3[_0x9ab1('0x54')]})[_0x9ab1('0x24')](function(_0x5188da){_0x5be674[_0x9ab1('0x33')]=_0x5188da;if(_0x5d9e50['query'][_0x9ab1('0x69')]){_0x5159a3[_0x9ab1('0x58')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x9ab1('0x74')],'as':'Owner','attributes':[_0x9ab1('0x3e'),_0x9ab1('0x75'),_0x9ab1('0x76')],'required':![]},{'model':db[_0x9ab1('0x77')],'as':_0x9ab1('0x78'),'attributes':['id',_0x9ab1('0x3e'),_0x9ab1('0x79')],'where':_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x7a')]?{'id':_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x7a')]}:undefined,'required':_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x7a')]?!![]:![]}];}return db[_0x9ab1('0x72')][_0x9ab1('0x70')](_0x5159a3);})[_0x9ab1('0x24')](function(_0x1895c0){_0x5be674[_0x9ab1('0x6a')]=_0x1895c0;return _0x5be674;});}})[_0x9ab1('0x24')](respondWithFilteredResult(_0x5f0226,_0x5159a3))['catch'](handleError(_0x5f0226,null));};exports['addApplications']=function(_0x3d98c1,_0x3d7aa4){var _0x1bfec4=_0x3d98c1[_0x9ab1('0x5a')]['id'];var _0x3f1f27=_0x3d98c1[_0x9ab1('0x61')];var _0x271332=0xc8;var _0x569d50=null;return db['sequelize'][_0x9ab1('0x7b')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x500841){return db[_0x9ab1('0x57')][_0x9ab1('0x66')]({'where':{'id':_0x1bfec4},'transaction':_0x500841})[_0x9ab1('0x24')](function(_0x543466){if(_0x543466){return db[_0x9ab1('0x7c')][_0x9ab1('0x3c')]({'where':{'FaxAccountId':_0x1bfec4},'transaction':_0x500841})['then'](function(){var _0x2aa457=_['map'](_0x3f1f27,function(_0x357a1d){_0x357a1d[_0x9ab1('0x64')]=_0x1bfec4;return _0x357a1d;});return db[_0x9ab1('0x7c')][_0x9ab1('0x7d')](_0x2aa457,{'transaction':_0x500841});});}else{_0x271332=0x194;_0x569d50=[];}});})[_0x9ab1('0x24')](function(){if(_0x271332!==0x194){return db[_0x9ab1('0x7c')][_0x9ab1('0x7e')]({'where':{'FaxAccountId':_0x1bfec4},'order':_0x9ab1('0x7f')})[_0x9ab1('0x24')](function(_0x445820){_0x569d50=_0x445820;});}})[_0x9ab1('0x2c')](function(_0x108dc8){_0x271332=0x1f4;logger[_0x9ab1('0x2a')](_0x108dc8[_0x9ab1('0x3d')]);if(_0x108dc8[_0x9ab1('0x3e')]){delete _0x108dc8[_0x9ab1('0x3e')];}_0x569d50=_0x108dc8;})['finally'](function(){if(_0x569d50===null){_0x3d7aa4[_0x9ab1('0x2d')](_0x271332);}else{if(_0x271332===0x1f4){_0x3d7aa4['status'](_0x271332)[_0x9ab1('0x3f')](_0x569d50);}else{_0x3d7aa4[_0x9ab1('0x2f')](_0x271332)[_0x9ab1('0x36')](_0x569d50);}}});};exports['getApplications']=function(_0x3ea506,_0x121154,_0x104b58){var _0x40a885={};var _0x4d8f95={};var _0x3b8d7e;var _0x418abc;return db['FaxAccount'][_0x9ab1('0x66')]({'where':{'id':_0x3ea506[_0x9ab1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x121154,null))[_0x9ab1('0x24')](function(_0x52072b){if(_0x52072b){_0x3b8d7e=_0x52072b;_0x4d8f95[_0x9ab1('0x48')]=_[_0x9ab1('0x4a')](db[_0x9ab1('0x7c')][_0x9ab1('0x44')]);_0x4d8f95['query']=_[_0x9ab1('0x4a')](_0x3ea506[_0x9ab1('0x49')]);_0x4d8f95[_0x9ab1('0x4b')]=_[_0x9ab1('0x4c')](_0x4d8f95[_0x9ab1('0x48')],_0x4d8f95[_0x9ab1('0x49')]);_0x40a885[_0x9ab1('0x4e')]=_[_0x9ab1('0x4c')](_0x4d8f95[_0x9ab1('0x48')],qs[_0x9ab1('0x4d')](_0x3ea506['query'][_0x9ab1('0x4d')]));_0x40a885[_0x9ab1('0x4e')]=_0x40a885[_0x9ab1('0x4e')]['length']?_0x40a885[_0x9ab1('0x4e')]:_0x4d8f95[_0x9ab1('0x48')];_0x40a885[_0x9ab1('0x67')]=qs[_0x9ab1('0x52')](_0x3ea506[_0x9ab1('0x49')]['sort']);_0x40a885[_0x9ab1('0x54')]=qs[_0x9ab1('0x4b')](_['pick'](_0x3ea506[_0x9ab1('0x49')],_0x4d8f95[_0x9ab1('0x4b')]));if(_0x3ea506[_0x9ab1('0x49')][_0x9ab1('0x55')]){_0x40a885[_0x9ab1('0x54')]=_[_0x9ab1('0x53')](_0x40a885['where'],{'$or':_['map'](_0x40a885[_0x9ab1('0x4e')],function(_0xb68a39){var _0x28df83={};_0x28df83[_0xb68a39]={'$like':'%'+_0x3ea506[_0x9ab1('0x49')]['filter']+'%'};return _0x28df83;})});}_0x40a885=_[_0x9ab1('0x53')]({},_0x40a885,_0x3ea506[_0x9ab1('0x56')]);return _0x3b8d7e[_0x9ab1('0x80')](_0x40a885);}})[_0x9ab1('0x24')](function(_0x8fcd9e){if(_0x8fcd9e){_0x418abc=_0x8fcd9e[_0x9ab1('0x4f')];if(!_0x3ea506[_0x9ab1('0x49')][_0x9ab1('0x50')](_0x9ab1('0x51'))){_0x40a885[_0x9ab1('0x32')]=qs[_0x9ab1('0x32')](_0x3ea506[_0x9ab1('0x49')][_0x9ab1('0x32')]);_0x40a885[_0x9ab1('0x30')]=qs[_0x9ab1('0x30')](_0x3ea506[_0x9ab1('0x49')][_0x9ab1('0x30')]);}return _0x3b8d7e[_0x9ab1('0x80')](_0x40a885);}})['then'](function(_0x70619f){if(_0x70619f){return _0x70619f?{'count':_0x418abc,'rows':_0x70619f}:null;}})[_0x9ab1('0x24')](respondWithResult(_0x121154,null))[_0x9ab1('0x2c')](handleError(_0x121154,null));};function Extension(_0x4ac4d2,_0x34750b,_0x563cfc,_0x3ebb30){this['context']=_0x9ab1('0x81');this[_0x9ab1('0x82')]=_0x4ac4d2[_0x9ab1('0x83')];this[_0x9ab1('0x84')]=_0x3ebb30;this['type']=_0x9ab1('0x85');this[_0x9ab1('0x86')]=_0x9ab1('0x87');this[_0x9ab1('0x64')]=_0x4ac4d2['id'];this[_0x9ab1('0x7f')]=_0x34750b;this[_0x9ab1('0x88')]=_0x563cfc;}function createExtensionsReciveFax(_0x5a904d){var _0x3f133a=0x1;var _0x1e798c=[];_0x1e798c[_0x9ab1('0x89')](new Extension(_0x5a904d,_0x3f133a,'','Answer'));_0x3f133a+=0x1;_0x1e798c[_0x9ab1('0x89')](new Extension(_0x5a904d,_0x3f133a,_0x9ab1('0x8a'),_0x9ab1('0x8b')));_0x3f133a+=0x1;for(var _0x25415d in _0x5a904d){if(_0x5a904d[_0x9ab1('0x50')](_0x25415d)&&(_0x25415d===_0x9ab1('0x8c')||_0x25415d===_0x9ab1('0x83')||_0x25415d==='gateway'||_0x25415d==='faxdetect'||_0x25415d===_0x9ab1('0x8d')||_0x25415d===_0x9ab1('0x8e')||_0x25415d===_0x9ab1('0x8f')||_0x25415d===_0x9ab1('0x90')||_0x25415d===_0x9ab1('0x91'))){_0x1e798c[_0x9ab1('0x89')](new Extension(_0x5a904d,_0x3f133a,_0x9ab1('0x92')+_0x25415d+')='+_0x5a904d[_0x25415d],_0x9ab1('0x8b')));_0x3f133a+=0x1;}}_0x1e798c[_0x9ab1('0x89')](new Extension(_0x5a904d,_0x3f133a,'6',_0x9ab1('0x93')));_0x3f133a+=0x1;_0x1e798c[_0x9ab1('0x89')](new Extension(_0x5a904d,_0x3f133a,_0x9ab1('0x94'),'ReceiveFax'));_0x3f133a=0x0;return _0x1e798c;}exports['addAccountApplications']=function(_0x590400,_0x516c36,_0x46961e){var _0x24c969;return db[_0x9ab1('0x95')][_0x9ab1('0x7b')](function(_0x1a7cb4){return db[_0x9ab1('0x57')][_0x9ab1('0x5c')](_0x590400['body'],{'transaction':_0x1a7cb4})['then'](function(_0x9f30fd){_0x24c969=_0x9f30fd[_0x9ab1('0x39')]({'plain':!![]});return db[_0x9ab1('0x96')][_0x9ab1('0x7d')](createExtensionsReciveFax(_0x24c969),{'transaction':_0x1a7cb4});});})[_0x9ab1('0x24')](function(){return _0x24c969;})[_0x9ab1('0x24')](respondWithResult(_0x516c36,null))[_0x9ab1('0x2c')](handleError(_0x516c36,null));};exports[_0x9ab1('0x97')]=function(_0x3acce8,_0xdee5d3,_0x2383b){var _0x125e93;return db[_0x9ab1('0x95')]['transaction'](function(_0xcf0a8a){return db[_0x9ab1('0x57')][_0x9ab1('0x38')](_0x3acce8[_0x9ab1('0x61')],{'where':{'id':_0x3acce8[_0x9ab1('0x61')]['id']},'transaction':_0xcf0a8a})[_0x9ab1('0x24')](function(_0x219066){return db[_0x9ab1('0x96')][_0x9ab1('0x3c')]({'where':{'FaxAccountId':_0x3acce8[_0x9ab1('0x61')]['id']},'transaction':_0xcf0a8a})[_0x9ab1('0x24')](function(_0x378532){return db[_0x9ab1('0x96')][_0x9ab1('0x7d')](createExtensionsReciveFax(_[_0x9ab1('0x73')](_0x3acce8[_0x9ab1('0x61')],['tech',_0x9ab1('0x47'),'createdAt',_0x9ab1('0x98'),_0x9ab1('0x99'),'ListId'])),{'transaction':_0xcf0a8a});});});})['then'](function(){return db['FaxAccount']['findById'](_0x3acce8[_0x9ab1('0x61')]['id']);})[_0x9ab1('0x24')](respondWithResult(_0xdee5d3,null))[_0x9ab1('0x2c')](handleError(_0xdee5d3,null));};exports[_0x9ab1('0x9a')]=function(_0x74123d,_0x515e05,_0x3800b7){var _0x29dd5={'raw':!![],'where':{}};var _0x3c4c70={};var _0x3a9988={'count':0x0,'rows':[]};return db[_0x9ab1('0x57')]['findOne']({'where':{'id':_0x74123d[_0x9ab1('0x5a')]['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x515e05,null))['then'](function(_0x596936){if(_0x596936){_0x3c4c70[_0x9ab1('0x48')]=_[_0x9ab1('0x4a')](db[_0x9ab1('0x9b')][_0x9ab1('0x44')]);_0x3c4c70[_0x9ab1('0x49')]=_[_0x9ab1('0x4a')](_0x74123d[_0x9ab1('0x49')]);_0x3c4c70['filters']=_['intersection'](_0x3c4c70[_0x9ab1('0x48')],_0x3c4c70[_0x9ab1('0x49')]);_0x29dd5[_0x9ab1('0x4e')]=_[_0x9ab1('0x4c')](_0x3c4c70[_0x9ab1('0x48')],qs['fields'](_0x74123d['query']['fields']));_0x29dd5[_0x9ab1('0x4e')]=_0x29dd5[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x29dd5[_0x9ab1('0x4e')]:_0x3c4c70['model'];if(!_0x74123d['query'][_0x9ab1('0x50')](_0x9ab1('0x51'))){_0x29dd5[_0x9ab1('0x32')]=qs[_0x9ab1('0x32')](_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x32')]);_0x29dd5[_0x9ab1('0x30')]=qs[_0x9ab1('0x30')](_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x30')]);}_0x29dd5[_0x9ab1('0x67')]=qs['sort'](_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x52')]);_0x29dd5['where']=qs[_0x9ab1('0x4b')](_[_0x9ab1('0x68')](_0x74123d[_0x9ab1('0x49')],_0x3c4c70[_0x9ab1('0x4b')]));_0x29dd5['where'][_0x9ab1('0x64')]=_0x596936['id'];if(_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x55')]){_0x29dd5[_0x9ab1('0x54')]=_[_0x9ab1('0x53')](_0x29dd5[_0x9ab1('0x54')],{'$or':_['map'](_0x29dd5[_0x9ab1('0x4e')],function(_0x68af70){var _0x502156={};_0x502156[_0x68af70]={'$like':'%'+_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x55')]+'%'};return _0x502156;})});}if(_0x74123d['query']['$gte']){var _0x1d834e=_0x74123d[_0x9ab1('0x49')]['$gte'][_0x9ab1('0x9c')](',');var _0x14c605={};_0x14c605[_0x1d834e[0x0]]={'$gte':moment(_0x1d834e[0x1])[_0x9ab1('0x9d')](_0x9ab1('0x9e'))};_0x29dd5[_0x9ab1('0x54')]=_['merge'](_0x29dd5['where'],_0x14c605);}_0x29dd5=_[_0x9ab1('0x53')]({},_0x29dd5,_0x74123d[_0x9ab1('0x56')]);return db[_0x9ab1('0x9b')][_0x9ab1('0x33')]({'where':_0x29dd5['where']})[_0x9ab1('0x24')](function(_0x27c6ce){_0x3a9988['count']=_0x27c6ce;if(_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x69')]){_0x29dd5['include']=[{'all':!![]}];}return db[_0x9ab1('0x9b')][_0x9ab1('0x70')](_0x29dd5);})[_0x9ab1('0x24')](function(_0x577669){_0x3a9988[_0x9ab1('0x6a')]=_0x577669;return _0x3a9988;});}})['then'](respondWithFilteredResult(_0x515e05,_0x29dd5))[_0x9ab1('0x2c')](handleError(_0x515e05,null));};exports[_0x9ab1('0x3f')]=function(_0x1afb2c,_0x5492ee,_0x3455c9){var _0x1052f0,_0x10d266={},_0x2377bc;if(_0x1afb2c[_0x9ab1('0x61')]['to']){_0x2377bc=_0x1afb2c[_0x9ab1('0x61')]['to'][0x0];}return db['FaxAccount'][_0x9ab1('0x5b')]({'where':{'id':_0x1afb2c[_0x9ab1('0x5a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9ab1('0x9f')],'as':_0x9ab1('0xa0'),'where':{'fax':_0x2377bc},'limit':0x1,'order':[[_0x9ab1('0x98'),_0x9ab1('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x5492ee,null))['then'](function(_0x3428d4){_0x1052f0=_0x3428d4;if(_0x1afb2c['body']['attachments']&&_0x1afb2c[_0x9ab1('0x61')]['attachments'][_0x9ab1('0x4f')]){for(var _0x1d8d4b=0x0;_0x1d8d4b<_0x1afb2c[_0x9ab1('0x61')]['attachments'][_0x9ab1('0x4f')];_0x1d8d4b+=0x1){_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][_0x1d8d4b]={'filename':_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][_0x1d8d4b][_0x9ab1('0x3e')],'id':_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][_0x1d8d4b]['id'],'path':path[_0x9ab1('0xa3')](config[_0x9ab1('0xa4')],_0x9ab1('0xa5'),_0x1afb2c['body'][_0x9ab1('0xa2')][_0x1d8d4b][_0x9ab1('0xa6')])};}}return respondWithRpcPromise(_0x9ab1('0xa7'),_0x9ab1('0xa7'),{'FaxAccountId':_[_0x9ab1('0xa8')](_0x1afb2c[_0x9ab1('0x5a')]['id'])?undefined:_0x1afb2c[_0x9ab1('0x5a')]['id'],'path':_['isNil'](_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0][_0x9ab1('0xa9')])?undefined:_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0][_0x9ab1('0xa9')],'fax':_[_0x9ab1('0xa8')](_0x1afb2c[_0x9ab1('0x61')]['to'][0x0])?undefined:_0x1afb2c['body']['to'][0x0]},client9002);})['then'](function(){if(_0x1052f0){if(_[_0x9ab1('0xa8')](_0x1afb2c['body'][_0x9ab1('0xaa')])){_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xaa')]=util[_0x9ab1('0x9d')]('\x22%s\x22\x20<%s>',_0x1052f0[_0x9ab1('0x3e')],_0x1052f0[_0x9ab1('0xab')]);}if(_0x1052f0[_0x9ab1('0xac')]){if(_0x1052f0[_0x9ab1('0xac')][_0x9ab1('0xa0')]['length']){return _0x1052f0['List'][_0x9ab1('0xa0')][0x0];}else{return db[_0x9ab1('0x9f')][_0x9ab1('0x5c')](_[_0x9ab1('0x1b')](_0x1afb2c['body'],{'firstName':_0x1afb2c[_0x9ab1('0x61')]['to'][0x0],'phone':_0x1afb2c[_0x9ab1('0x61')]['to'][0x0],'fax':_0x1afb2c[_0x9ab1('0x61')]['to'][0x0],'ListId':_0x1052f0[_0x9ab1('0xad')]}));}}else{throw new Error(_0x9ab1('0xae'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x9ab1('0x24')](function(_0x5b390c){if(_0x5b390c){return db['FaxInteraction']['find']({'where':{'ContactId':_0x5b390c['id'],'closed':![],'FaxAccountId':_0x1052f0['id']}})['then'](function(_0x5cbd9c){if(_0x5cbd9c){return[_0x5cbd9c,![]];}return db[_0x9ab1('0x72')][_0x9ab1('0x5c')]({'UserId':_0x1afb2c[_0x9ab1('0x5d')]['id'],'ContactId':_0x5b390c['id'],'FaxAccountId':_0x1052f0['id'],'fax':_0x1afb2c[_0x9ab1('0x61')]['to'][0x0],'firstMsgDirection':_0x9ab1('0xaf'),'Messages':[_['merge'](_0x1afb2c[_0x9ab1('0x61')],{'read':![],'body':_0x1afb2c[_0x9ab1('0x61')]['attachments'][0x0]['filename'],'FaxAccountId':_0x1052f0['id'],'UserId':_0x1afb2c[_0x9ab1('0x5d')]['id'],'ContactId':_0x5b390c['id'],'AttachmentId':_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0]['id']})]},{'include':[{'model':db[_0x9ab1('0x9b')],'as':_0x9ab1('0xb0')}]})[_0x9ab1('0x24')](function(_0x14b460){return[_0x14b460,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9ab1('0xb1')](function(_0x413424,_0x300980){if(_0x300980){return _0x413424;}return db[_0x9ab1('0x9b')][_0x9ab1('0x5c')]({'direction':'out','read':![],'body':_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0][_0x9ab1('0xb2')],'FaxAccountId':_0x1052f0['id'],'FaxInteractionId':_0x413424['id'],'UserId':_0x1afb2c[_0x9ab1('0x5d')]['id'],'ContactId':_0x413424['ContactId'],'AttachmentId':_0x1afb2c[_0x9ab1('0x61')]['attachments'][0x0]['id']})[_0x9ab1('0x24')](function(_0x519c18){_0x413424[_0x9ab1('0xb3')][_0x9ab1('0xb0')]=[];_0x413424['dataValues'][_0x9ab1('0xb0')][_0x9ab1('0x89')](_0x519c18[_0x9ab1('0xb3')]);return _0x413424;});})['then'](function(_0x1ebe5a){respondWithRpcPromise('SendFax',_0x9ab1('0xb4'),{'FaxAccountId':_['isNil'](_0x1afb2c[_0x9ab1('0x5a')]['id'])?undefined:_0x1afb2c[_0x9ab1('0x5a')]['id'],'path':_[_0x9ab1('0xa8')](_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0][_0x9ab1('0xa9')])?undefined:_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0][_0x9ab1('0xa9')],'fax':_[_0x9ab1('0xa8')](_0x1afb2c[_0x9ab1('0x61')]['to'][0x0])?undefined:_0x1afb2c['body']['to'][0x0],'AttachmentId':_0x1afb2c[_0x9ab1('0x61')]['attachments'][0x0]['id']},client9002)[_0x9ab1('0x24')](function(_0x14ca33){logger['info'](_0x9ab1('0xb5'),_0x14ca33);})[_0x9ab1('0x2c')](function(_0x1d126f){logger[_0x9ab1('0x25')](_0x9ab1('0xb5'),_0x1d126f);});return _0x1ebe5a;})[_0x9ab1('0x24')](respondWithResult(_0x5492ee,null))[_0x9ab1('0x2c')](handleError(_0x5492ee,null));};exports[_0x9ab1('0xb6')]=function(_0x5408ba,_0x4d9cba,_0x1bf0e9){return db['FaxAccount']['find']({'where':{'id':_0x5408ba[_0x9ab1('0x5a')]['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x4d9cba,null))[_0x9ab1('0x24')](function(_0x3ff173){if(_0x3ff173){return _0x3ff173[_0x9ab1('0xb6')](_0x5408ba['body'][_0x9ab1('0x6c')],_[_0x9ab1('0x73')](_0x5408ba[_0x9ab1('0x61')],[_0x9ab1('0x6c'),'id'])||{})[_0x9ab1('0xb1')](function(_0x58ec58){for(var _0xbf7972=0x0;_0xbf7972<_0x5408ba[_0x9ab1('0x61')][_0x9ab1('0x6c')][_0x9ab1('0x4f')];_0xbf7972+=0x1){socket[_0x9ab1('0xb7')](_0x9ab1('0xb8'),{'UserId':Number(_0x5408ba[_0x9ab1('0x61')][_0x9ab1('0x6c')][_0xbf7972]),'FaxAccountId':Number(_0x5408ba[_0x9ab1('0x5a')]['id'])});}return _0x58ec58;});}})[_0x9ab1('0x24')](respondWithResult(_0x4d9cba,null))[_0x9ab1('0x2c')](handleError(_0x4d9cba,null));};exports[_0x9ab1('0xb9')]=function(_0x223739,_0x3b8e84,_0x2cf7ad){return db['FaxAccount'][_0x9ab1('0x5b')]({'where':{'id':_0x223739[_0x9ab1('0x5a')]['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x3b8e84,null))[_0x9ab1('0x24')](function(_0x5be989){if(_0x5be989){return _0x5be989[_0x9ab1('0xb9')](_0x223739[_0x9ab1('0x49')][_0x9ab1('0x6c')])[_0x9ab1('0x24')](function(){if(_[_0x9ab1('0xba')](_0x223739[_0x9ab1('0x49')][_0x9ab1('0x6c')])){for(var _0x13a45d=0x0;_0x13a45d<_0x223739[_0x9ab1('0x49')][_0x9ab1('0x6c')][_0x9ab1('0x4f')];_0x13a45d+=0x1){socket[_0x9ab1('0xb7')](_0x9ab1('0xbb'),{'UserId':Number(_0x223739[_0x9ab1('0x49')][_0x9ab1('0x6c')][_0x13a45d]),'FaxAccountId':Number(_0x223739['params']['id'])});}}else{socket['emit'](_0x9ab1('0xbb'),{'UserId':Number(_0x223739[_0x9ab1('0x49')][_0x9ab1('0x6c')]),'FaxAccountId':Number(_0x223739[_0x9ab1('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3b8e84,null))[_0x9ab1('0x2c')](handleError(_0x3b8e84,null));};exports[_0x9ab1('0xbc')]=function(_0x4daba9,_0x1d170f,_0x2724ec){var _0x513f6b={};var _0x47be42={};var _0x4bc5af;var _0x2aa4f1;return db[_0x9ab1('0x57')][_0x9ab1('0x66')]({'where':{'id':_0x4daba9[_0x9ab1('0x5a')]['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x1d170f,null))[_0x9ab1('0x24')](function(_0x13c03b){if(_0x13c03b){_0x4bc5af=_0x13c03b;_0x47be42[_0x9ab1('0x48')]=_[_0x9ab1('0x4a')](db['User'][_0x9ab1('0x44')]);_0x47be42[_0x9ab1('0x49')]=_['keys'](_0x4daba9[_0x9ab1('0x49')]);_0x47be42[_0x9ab1('0x4b')]=_[_0x9ab1('0x4c')](_0x47be42['model'],_0x47be42['query']);_0x513f6b[_0x9ab1('0x4e')]=_['intersection'](_0x47be42[_0x9ab1('0x48')],qs['fields'](_0x4daba9[_0x9ab1('0x49')][_0x9ab1('0x4d')]));_0x513f6b['attributes']=_0x513f6b[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x513f6b[_0x9ab1('0x4e')]:_0x47be42[_0x9ab1('0x48')];_0x513f6b['order']=qs[_0x9ab1('0x52')](_0x4daba9[_0x9ab1('0x49')][_0x9ab1('0x52')]);_0x513f6b[_0x9ab1('0x54')]=qs['filters'](_[_0x9ab1('0x68')](_0x4daba9[_0x9ab1('0x49')],_0x47be42[_0x9ab1('0x4b')]));if(_0x4daba9['query']['filter']){_0x513f6b[_0x9ab1('0x54')]=_['merge'](_0x513f6b[_0x9ab1('0x54')],{'$or':_[_0x9ab1('0x43')](_0x513f6b[_0x9ab1('0x4e')],function(_0x12dc8e){var _0x3c24fa={};_0x3c24fa[_0x12dc8e]={'$like':'%'+_0x4daba9[_0x9ab1('0x49')][_0x9ab1('0x55')]+'%'};return _0x3c24fa;})});}_0x513f6b=_[_0x9ab1('0x53')]({},_0x513f6b,_0x4daba9[_0x9ab1('0x56')]);return _0x4bc5af[_0x9ab1('0xbc')](_0x513f6b);}})[_0x9ab1('0x24')](function(_0x4d8863){if(_0x4d8863){_0x2aa4f1=_0x4d8863[_0x9ab1('0x4f')];if(!_0x4daba9[_0x9ab1('0x49')][_0x9ab1('0x50')](_0x9ab1('0x51'))){_0x513f6b[_0x9ab1('0x32')]=qs['limit'](_0x4daba9[_0x9ab1('0x49')]['limit']);_0x513f6b[_0x9ab1('0x30')]=qs[_0x9ab1('0x30')](_0x4daba9[_0x9ab1('0x49')][_0x9ab1('0x30')]);}return _0x4bc5af[_0x9ab1('0xbc')](_0x513f6b);}})[_0x9ab1('0x24')](function(_0x4bbde7){if(_0x4bbde7){return _0x4bbde7?{'count':_0x2aa4f1,'rows':_0x4bbde7}:null;}})['then'](respondWithResult(_0x1d170f,null))[_0x9ab1('0x2c')](handleError(_0x1d170f,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6f79c22..94e6ae6 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 _0x2363=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x13530f,_0x3d60ad){var _0x33ef81=function(_0x1a80f1){while(--_0x1a80f1){_0x13530f['push'](_0x13530f['shift']());}};_0x33ef81(++_0x3d60ad);}(_0x2363,0x1e6));var _0x3236=function(_0x2b7b50,_0x5a9c78){_0x2b7b50=_0x2b7b50-0x0;var _0x1eacf=_0x2363[_0x2b7b50];return _0x1eacf;};'use strict';var EventEmitter=require(_0x3236('0x0'));var FaxAccount=require(_0x3236('0x1'))['db'][_0x3236('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3236('0x3')](0x0);var events={'afterCreate':_0x3236('0x4'),'afterUpdate':_0x3236('0x5'),'afterDestroy':'remove'};function emitEvent(_0x393612){return function(_0x79f799,_0x2290b2,_0x288a52){FaxAccountEvents[_0x3236('0x6')](_0x393612+':'+_0x79f799['id'],_0x79f799);FaxAccountEvents[_0x3236('0x6')](_0x393612,_0x79f799);_0x288a52(null);};}for(var e in events){if(events[_0x3236('0x7')](e)){var event=events[e];FaxAccount[_0x3236('0x8')](e,emitEvent(event));}}module[_0x3236('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xb9be=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','update','remove'];(function(_0x5da246,_0x4dea24){var _0x461d38=function(_0x402dba){while(--_0x402dba){_0x5da246['push'](_0x5da246['shift']());}};_0x461d38(++_0x4dea24);}(_0xb9be,0xfe));var _0xeb9b=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xb9be[_0x5f1391];return _0x50ebe3;};'use strict';var EventEmitter=require(_0xeb9b('0x0'));var FaxAccount=require(_0xeb9b('0x1'))['db'][_0xeb9b('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xeb9b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeb9b('0x4'),'afterDestroy':_0xeb9b('0x5')};function emitEvent(_0x4dd696){return function(_0x46bb89,_0x4e5601,_0x30e11e){FaxAccountEvents['emit'](_0x4dd696+':'+_0x46bb89['id'],_0x46bb89);FaxAccountEvents[_0xeb9b('0x6')](_0x4dd696,_0x46bb89);_0x30e11e(null);};}for(var e in events){if(events[_0xeb9b('0x7')](e)){var event=events[e];FaxAccount[_0xeb9b('0x8')](e,emitEvent(event));}}module[_0xeb9b('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 61051ad..f634323 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 _0x9fc8=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','lodash','api','moment'];(function(_0x398437,_0x382e5f){var _0x539597=function(_0x296472){while(--_0x296472){_0x398437['push'](_0x398437['shift']());}};_0x539597(++_0x382e5f);}(_0x9fc8,0x13d));var _0x89fc=function(_0x2908c7,_0x538499){_0x2908c7=_0x2908c7-0x0;var _0x16c521=_0x9fc8[_0x2908c7];return _0x16c521;};'use strict';var _=require(_0x89fc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x89fc('0x1'));var moment=require(_0x89fc('0x2'));var BPromise=require('bluebird');var rp=require(_0x89fc('0x3'));var fs=require('fs');var path=require(_0x89fc('0x4'));var rimraf=require(_0x89fc('0x5'));var config=require(_0x89fc('0x6'));var attributes=require(_0x89fc('0x7'));module['exports']=function(_0x29f611,_0x13f37b){return _0x29f611[_0x89fc('0x8')](_0x89fc('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c76=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x0c76,0x151));var _0x60c7=function(_0x5e4976,_0x3fbb6e){_0x5e4976=_0x5e4976-0x0;var _0x5240ec=_0x0c76[_0x5e4976];return _0x5240ec;};'use strict';var _=require(_0x60c7('0x0'));var util=require(_0x60c7('0x1'));var logger=require(_0x60c7('0x2'))(_0x60c7('0x3'));var moment=require(_0x60c7('0x4'));var BPromise=require('bluebird');var rp=require(_0x60c7('0x5'));var fs=require('fs');var path=require(_0x60c7('0x6'));var rimraf=require('rimraf');var config=require(_0x60c7('0x7'));var attributes=require(_0x60c7('0x8'));module[_0x60c7('0x9')]=function(_0x199166,_0x4d59aa){return _0x199166[_0x60c7('0xa')](_0x60c7('0xb'),attributes,{'tableName':_0x60c7('0xc'),'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 c10e483..625e238 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 _0xd9de=['map','model','NotifyFaxAccount','fax','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','ListId','body','isNil','from','ValidationError','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','find','CmList','List','DESC','FaxApplication','get','account','applications','Applications','list','orderBy','priority','length','Contacts','defaults','CmContact','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','debug','request\x20sent','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','include'];(function(_0x4bfc2e,_0x52134d){var _0x285558=function(_0x24bec8){while(--_0x24bec8){_0x4bfc2e['push'](_0x4bfc2e['shift']());}};_0x285558(++_0x52134d);}(_0xd9de,0x140));var _0xed9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd9de[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xed9d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xed9d('0x1'));var rs=require(_0xed9d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed9d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xed9d('0x4'))(_0xed9d('0x5'));var config=require(_0xed9d('0x6'));var jayson=require(_0xed9d('0x7'));var client=jayson['client'][_0xed9d('0x8')]({'port':0x232c});config['redis']=_['defaults'](config[_0xed9d('0x9')],{'host':_0xed9d('0xa'),'port':0x18eb});var socket=require(_0xed9d('0xb'))(new Redis(config['redis']));require(_0xed9d('0xc'))[_0xed9d('0xd')](socket);function respondWithRpcPromise(_0x560d10,_0x324fb4,_0x45fc61){return new BPromise(function(_0x6dcf8c,_0x5d0c3b){return client[_0xed9d('0xe')](_0x560d10,_0x45fc61)[_0xed9d('0xf')](function(_0xd68078){logger[_0xed9d('0x10')]('FaxAccount,\x20%s,\x20%s',_0x324fb4,'request\x20sent');logger[_0xed9d('0x11')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x324fb4,_0xed9d('0x12'),JSON['stringify'](_0xd68078));if(_0xd68078[_0xed9d('0x13')]){if(_0xd68078[_0xed9d('0x13')][_0xed9d('0x14')]===0x1f4){logger[_0xed9d('0x13')](_0xed9d('0x15'),_0x324fb4,_0xd68078[_0xed9d('0x13')][_0xed9d('0x16')]);return _0x5d0c3b(_0xd68078[_0xed9d('0x13')]['message']);}logger[_0xed9d('0x13')](_0xed9d('0x15'),_0x324fb4,_0xd68078[_0xed9d('0x13')][_0xed9d('0x16')]);return _0x6dcf8c(_0xd68078['error']['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x324fb4,_0xed9d('0x12'));_0x6dcf8c(_0xd68078[_0xed9d('0x17')][_0xed9d('0x16')]);}})[_0xed9d('0x18')](function(_0x2cbeac){logger[_0xed9d('0x13')](_0xed9d('0x15'),_0x324fb4,_0x2cbeac);_0x5d0c3b(_0x2cbeac);});});}exports[_0xed9d('0x19')]=function(_0x508492){var _0x284149=this;return new Promise(function(_0x2d7922,_0x12c732){return db[_0xed9d('0x1a')][_0xed9d('0x1b')]({'raw':_0x508492[_0xed9d('0x1c')]?_0x508492[_0xed9d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x508492[_0xed9d('0x1c')]?_0x508492[_0xed9d('0x1c')]['where']||null:null,'attributes':_0x508492[_0xed9d('0x1c')]?_0x508492[_0xed9d('0x1c')][_0xed9d('0x1d')]||null:null,'limit':_0x508492[_0xed9d('0x1c')]?_0x508492[_0xed9d('0x1c')][_0xed9d('0x1e')]||null:null,'include':_0x508492['options']?_0x508492[_0xed9d('0x1c')][_0xed9d('0x1f')]?_[_0xed9d('0x20')](_0x508492['options'][_0xed9d('0x1f')],function(_0x12e42d){return{'model':db[_0x12e42d[_0xed9d('0x21')]],'as':_0x12e42d['as'],'attributes':_0x12e42d[_0xed9d('0x1d')],'include':_0x12e42d[_0xed9d('0x1f')]?_['map'](_0x12e42d[_0xed9d('0x1f')],function(_0x54ada3){return{'model':db[_0x54ada3[_0xed9d('0x21')]],'as':_0x54ada3['as'],'attributes':_0x54ada3['attributes'],'include':_0x54ada3[_0xed9d('0x1f')]?_[_0xed9d('0x20')](_0x54ada3[_0xed9d('0x1f')],function(_0x593c42){return{'model':db[_0x593c42['model']],'as':_0x593c42['as'],'attributes':_0x593c42[_0xed9d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xed9d('0xf')](function(_0x412981){logger['info']('GetFaxAccount',_0x508492);logger['debug'](_0xed9d('0x19'),_0x508492,JSON['stringify'](_0x412981));_0x2d7922(_0x412981);})['catch'](function(_0x17151c){logger[_0xed9d('0x13')](_0xed9d('0x19'),_0x17151c[_0xed9d('0x16')],_0x508492);_0x12c732(_0x284149[_0xed9d('0x13')](0x1f4,_0x17151c[_0xed9d('0x16')]));});});};exports[_0xed9d('0x22')]=function(_0x266779,_0x435f79,_0x3e32e2){var _0x506ffe=this;return new Promise(function(_0x366fa8,_0x18c135){var _0x19be13={'body':_0x266779['body'],'channel':_0xed9d('0x23')};var _0x27791a=[];var _0x4e7910=[];var _0x3ae414={};return db['CmContact']['describe']()[_0xed9d('0xf')](function(_0x3a7cad){if(!_0x3a7cad){throw new db['Sequelize']['ValidationError'](_0xed9d('0x24'));}_0x27791a=_['difference'](_[_0xed9d('0x25')](_0x3a7cad),[_0xed9d('0x26'),_0xed9d('0x27')]);_0x4e7910=_[_0xed9d('0x28')](_[_0xed9d('0x25')](_0x3a7cad),[_0xed9d('0x26'),_0xed9d('0x27'),'CompanyId',_0xed9d('0x29')]);if(_0x266779[_0xed9d('0x2a')]['id']){delete _0x266779[_0xed9d('0x2a')]['id'];}if(_[_0xed9d('0x2b')](_0x266779['body'][_0xed9d('0x2c')])){throw new db['Sequelize'][(_0xed9d('0x2d'))]('from\x20is\x20mandatory');}if(_[_0xed9d('0x2b')](_0x266779[_0xed9d('0x2a')][_0xed9d('0x2a')])||_0x266779[_0xed9d('0x2a')][_0xed9d('0x2a')]===''){throw new db[(_0xed9d('0x2e'))]['ValidationError'](_0xed9d('0x2f'));}if(_[_0xed9d('0x2b')](_0x266779[_0xed9d('0x2a')][_0xed9d('0x30')])){throw new db['Sequelize'][(_0xed9d('0x2d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e7910);}if(!_[_0xed9d('0x31')](_0x4e7910,_0x266779[_0xed9d('0x2a')][_0xed9d('0x30')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e7910);}_0x3ae414[_0x266779[_0xed9d('0x2a')]['mapKey']]=_0x266779['body']['from'];})[_0xed9d('0xf')](function(){return db[_0xed9d('0x1a')][_0xed9d('0x32')]({'where':{'id':_0x266779['account']['id']},'include':[{'model':db[_0xed9d('0x33')],'as':_0xed9d('0x34'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3ae414,'limit':0x1,'order':[[_0xed9d('0x27'),_0xed9d('0x35')]]}]},{'model':db[_0xed9d('0x36')],'as':'Applications'}]});})[_0xed9d('0xf')](function(_0x1c6d59){if(_0x1c6d59&&_0x1c6d59[_0xed9d('0x34')]){var _0x178d0=_0x1c6d59[_0xed9d('0x37')]({'plain':!![]});_0x19be13[_0xed9d('0x38')]=_0x178d0;_0x19be13[_0xed9d('0x39')]=_0x178d0[_0xed9d('0x3a')];_0x19be13[_0xed9d('0x3b')]=_0x178d0[_0xed9d('0x34')];_0x19be13[_0xed9d('0x39')]=_[_0xed9d('0x3c')](_0x19be13[_0xed9d('0x39')],[_0xed9d('0x3d')],['asc']);if(_0x19be13[_0xed9d('0x38')][_0xed9d('0x3a')]){delete _0x19be13[_0xed9d('0x38')][_0xed9d('0x3a')];}if(_0x19be13[_0xed9d('0x38')][_0xed9d('0x34')]&&_0x19be13[_0xed9d('0x38')]['List']['Contacts'][_0xed9d('0x3e')]){return _0x19be13[_0xed9d('0x38')][_0xed9d('0x34')][_0xed9d('0x3f')][0x0];}var _0x1aa16b=_[_0xed9d('0x40')](_0x266779[_0xed9d('0x2a')],{'firstName':_0x266779[_0xed9d('0x2a')][_0xed9d('0x2c')],'ListId':_0x178d0['ListId']});_0x1aa16b[_0x266779[_0xed9d('0x2a')][_0xed9d('0x30')]]=_0x266779[_0xed9d('0x2a')][_0xed9d('0x2c')];return db[_0xed9d('0x41')][_0xed9d('0x42')](_0x1aa16b,{'fields':_0x27791a,'raw':!![]});}})[_0xed9d('0xf')](function(_0x2fb1da){_0x19be13[_0xed9d('0x43')]=_0x2fb1da;if(_0x2fb1da){var _0x3e096e={'ContactId':_0x2fb1da['id'],'FaxAccountId':_0x266779['account']['id'],'fax':_0x2fb1da[_0xed9d('0x23')]};return db['FaxInteraction'][_0xed9d('0x32')]({'where':{'ContactId':_0x2fb1da['id'],'closed':![],'FaxAccountId':_0x266779[_0xed9d('0x38')]['id']}})[_0xed9d('0xf')](function(_0x2e2b2a){if(_0x2e2b2a){return[_0x2e2b2a,![]];}return db[_0xed9d('0x44')][_0xed9d('0x42')](_0x3e096e)[_0xed9d('0xf')](function(_0x11178a){return[_0x11178a,!![]];});});}else{throw new Error(_0xed9d('0x45'));}})[_0xed9d('0x46')](function(_0x364fa8,_0x404880){var _0x3a19a8=_0x364fa8[_0xed9d('0x37')]({'plain':!![]});if(_0x404880){if(_0x19be13[_0xed9d('0x38')][_0xed9d('0x47')]){_0x19be13[_0xed9d('0x39')][_0xed9d('0x48')]({'id':0x0,'priority':_0x19be13[_0xed9d('0x39')][_0xed9d('0x3e')]+0x1,'app':'close','appdata':_0xed9d('0x49'),'interval':_0xed9d('0x4a')});}_0x3a19a8[_0xed9d('0x4b')]=!![];}else{_0x3a19a8[_0xed9d('0x4b')]=![];}_0x19be13[_0xed9d('0x4c')]=_0x3a19a8;return db[_0xed9d('0x4d')][_0xed9d('0x42')]({'body':_0x266779[_0xed9d('0x2a')][_0xed9d('0x2a')],'FaxAccountId':_0x266779['account']['id'],'FaxInteractionId':_0x364fa8['id'],'direction':'in','ContactId':_0x364fa8[_0xed9d('0x4e')],'AttachmentId':_0x266779['body'][_0xed9d('0x4f')]});})[_0xed9d('0xf')](function(_0x560f5b){_0x19be13[_0xed9d('0x16')]=_0x560f5b;if(_0x19be13[_0xed9d('0x4c')][_0xed9d('0x50')]){return db[_0xed9d('0x51')]['find']({'attributes':['id','name'],'where':{'id':_0x19be13[_0xed9d('0x4c')][_0xed9d('0x50')]}})[_0xed9d('0xf')](function(_0x3ee086){if(_0x3ee086){_0x19be13['applications'][_0xed9d('0x52')]({'id':0x0,'priority':0x0,'app':_0xed9d('0x53'),'appdata':_0x3ee086[_0xed9d('0x54')]+','+(_0x19be13[_0xed9d('0x38')][_0xed9d('0x55')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xed9d('0x56'),_0xed9d('0x57'),_0x19be13);});}return respondWithRpcPromise('Start',_0xed9d('0x57'),_0x19be13);})[_0xed9d('0xf')](function(_0x49b8c5){_0x366fa8(_0x49b8c5);})[_0xed9d('0x18')](function(_0x56d2a2){_0x18c135(_0x506ffe['error'](0x1f4,_0x56d2a2[_0xed9d('0x16')]));});});}; \ No newline at end of file +var _0x8d25=['then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','findAll','options','raw','where','attributes','include','map','model','GetFaxAccount','debug','catch','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','List','DESC','account','applications','Applications','list','priority','asc','Contacts','length','ListId','contact','fax','spread','get','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','create','ContactId','AttachmentId','UserId','unshift','name','Start','startRouting','lodash','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request'];(function(_0x25b444,_0x20da5e){var _0x425f88=function(_0xe4183e){while(--_0xe4183e){_0x25b444['push'](_0x25b444['shift']());}};_0x425f88(++_0x20da5e);}(_0x8d25,0x18e));var _0x58d2=function(_0x3a43bd,_0x29477e){_0x3a43bd=_0x3a43bd-0x0;var _0x5c7283=_0x8d25[_0x3a43bd];return _0x5c7283;};'use strict';var _=require(_0x58d2('0x0'));var util=require('util');var moment=require(_0x58d2('0x1'));var BPromise=require(_0x58d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58d2('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x58d2('0x4'));var jayson=require(_0x58d2('0x5'));var client=jayson['client']['http']({'port':0x232c});config[_0x58d2('0x6')]=_['defaults'](config[_0x58d2('0x6')],{'host':_0x58d2('0x7'),'port':0x18eb});var socket=require(_0x58d2('0x8'))(new Redis(config[_0x58d2('0x6')]));require(_0x58d2('0x9'))[_0x58d2('0xa')](socket);function respondWithRpcPromise(_0x176220,_0x2f762d,_0x4f4691){return new BPromise(function(_0x5a3874,_0x9ab82d){return client[_0x58d2('0xb')](_0x176220,_0x4f4691)[_0x58d2('0xc')](function(_0x4d65e4){logger[_0x58d2('0xd')](_0x58d2('0xe'),_0x2f762d,_0x58d2('0xf'));logger['debug'](_0x58d2('0x10'),_0x2f762d,'request\x20sent',JSON[_0x58d2('0x11')](_0x4d65e4));if(_0x4d65e4[_0x58d2('0x12')]){if(_0x4d65e4['error']['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2f762d,_0x4d65e4[_0x58d2('0x12')][_0x58d2('0x13')]);return _0x9ab82d(_0x4d65e4[_0x58d2('0x12')][_0x58d2('0x13')]);}logger['error'](_0x58d2('0xe'),_0x2f762d,_0x4d65e4[_0x58d2('0x12')][_0x58d2('0x13')]);return _0x5a3874(_0x4d65e4[_0x58d2('0x12')][_0x58d2('0x13')]);}else{logger[_0x58d2('0xd')](_0x58d2('0xe'),_0x2f762d,_0x58d2('0xf'));_0x5a3874(_0x4d65e4[_0x58d2('0x14')][_0x58d2('0x13')]);}})['catch'](function(_0x2e71eb){logger[_0x58d2('0x12')](_0x58d2('0xe'),_0x2f762d,_0x2e71eb);_0x9ab82d(_0x2e71eb);});});}exports['GetFaxAccount']=function(_0x6c25ec){var _0x56148b=this;return new Promise(function(_0x39d19a,_0x2838d7){return db['FaxAccount'][_0x58d2('0x15')]({'raw':_0x6c25ec[_0x58d2('0x16')]?_0x6c25ec[_0x58d2('0x16')][_0x58d2('0x17')]===undefined?!![]:![]:!![],'where':_0x6c25ec[_0x58d2('0x16')]?_0x6c25ec['options'][_0x58d2('0x18')]||null:null,'attributes':_0x6c25ec[_0x58d2('0x16')]?_0x6c25ec[_0x58d2('0x16')][_0x58d2('0x19')]||null:null,'limit':_0x6c25ec[_0x58d2('0x16')]?_0x6c25ec[_0x58d2('0x16')]['limit']||null:null,'include':_0x6c25ec[_0x58d2('0x16')]?_0x6c25ec['options'][_0x58d2('0x1a')]?_[_0x58d2('0x1b')](_0x6c25ec[_0x58d2('0x16')][_0x58d2('0x1a')],function(_0x56aee5){return{'model':db[_0x56aee5['model']],'as':_0x56aee5['as'],'attributes':_0x56aee5[_0x58d2('0x19')],'include':_0x56aee5['include']?_[_0x58d2('0x1b')](_0x56aee5[_0x58d2('0x1a')],function(_0x35587b){return{'model':db[_0x35587b[_0x58d2('0x1c')]],'as':_0x35587b['as'],'attributes':_0x35587b[_0x58d2('0x19')],'include':_0x35587b[_0x58d2('0x1a')]?_[_0x58d2('0x1b')](_0x35587b[_0x58d2('0x1a')],function(_0x2bb558){return{'model':db[_0x2bb558['model']],'as':_0x2bb558['as'],'attributes':_0x2bb558[_0x58d2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x58d2('0xc')](function(_0x1d5099){logger['info'](_0x58d2('0x1d'),_0x6c25ec);logger[_0x58d2('0x1e')](_0x58d2('0x1d'),_0x6c25ec,JSON[_0x58d2('0x11')](_0x1d5099));_0x39d19a(_0x1d5099);})[_0x58d2('0x1f')](function(_0x18300c){logger['error'](_0x58d2('0x1d'),_0x18300c['message'],_0x6c25ec);_0x2838d7(_0x56148b[_0x58d2('0x12')](0x1f4,_0x18300c['message']));});});};exports[_0x58d2('0x20')]=function(_0x5acd39,_0x11dfe9,_0x2973d6){var _0x4e5972=this;return new Promise(function(_0x2450fe,_0x253008){var _0x25ec44={'body':_0x5acd39[_0x58d2('0x21')],'channel':'fax'};var _0x1c0da8=[];var _0x2f9c8b=[];var _0x1ed29e={};return db[_0x58d2('0x22')][_0x58d2('0x23')]()['then'](function(_0x31653d){if(!_0x31653d){throw new db[(_0x58d2('0x24'))][(_0x58d2('0x25'))](_0x58d2('0x26'));}_0x1c0da8=_['difference'](_['keys'](_0x31653d),[_0x58d2('0x27'),_0x58d2('0x28')]);_0x2f9c8b=_[_0x58d2('0x29')](_['keys'](_0x31653d),['createdAt',_0x58d2('0x28'),_0x58d2('0x2a'),'ListId']);if(_0x5acd39[_0x58d2('0x21')]['id']){delete _0x5acd39[_0x58d2('0x21')]['id'];}if(_[_0x58d2('0x2b')](_0x5acd39[_0x58d2('0x21')][_0x58d2('0x2c')])){throw new db[(_0x58d2('0x24'))][(_0x58d2('0x25'))]('from\x20is\x20mandatory');}if(_[_0x58d2('0x2b')](_0x5acd39[_0x58d2('0x21')][_0x58d2('0x21')])||_0x5acd39[_0x58d2('0x21')][_0x58d2('0x21')]===''){throw new db[(_0x58d2('0x24'))][(_0x58d2('0x25'))](_0x58d2('0x2d'));}if(_[_0x58d2('0x2b')](_0x5acd39[_0x58d2('0x21')][_0x58d2('0x2e')])){throw new db[(_0x58d2('0x24'))][(_0x58d2('0x25'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2f9c8b);}if(!_[_0x58d2('0x2f')](_0x2f9c8b,_0x5acd39[_0x58d2('0x21')]['mapKey'])){throw new db[(_0x58d2('0x24'))][(_0x58d2('0x25'))](_0x58d2('0x30')+_0x2f9c8b);}_0x1ed29e[_0x5acd39[_0x58d2('0x21')][_0x58d2('0x2e')]]=_0x5acd39['body'][_0x58d2('0x2c')];})['then'](function(){return db[_0x58d2('0x31')][_0x58d2('0x32')]({'where':{'id':_0x5acd39['account']['id']},'include':[{'model':db[_0x58d2('0x33')],'as':_0x58d2('0x34'),'include':[{'model':db[_0x58d2('0x22')],'as':'Contacts','where':_0x1ed29e,'limit':0x1,'order':[[_0x58d2('0x28'),_0x58d2('0x35')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x58d2('0xc')](function(_0x418fba){if(_0x418fba&&_0x418fba[_0x58d2('0x34')]){var _0x50425a=_0x418fba['get']({'plain':!![]});_0x25ec44[_0x58d2('0x36')]=_0x50425a;_0x25ec44[_0x58d2('0x37')]=_0x50425a[_0x58d2('0x38')];_0x25ec44[_0x58d2('0x39')]=_0x50425a[_0x58d2('0x34')];_0x25ec44[_0x58d2('0x37')]=_['orderBy'](_0x25ec44[_0x58d2('0x37')],[_0x58d2('0x3a')],[_0x58d2('0x3b')]);if(_0x25ec44['account']['Applications']){delete _0x25ec44[_0x58d2('0x36')][_0x58d2('0x38')];}if(_0x25ec44[_0x58d2('0x36')][_0x58d2('0x34')]&&_0x25ec44['account'][_0x58d2('0x34')][_0x58d2('0x3c')][_0x58d2('0x3d')]){return _0x25ec44[_0x58d2('0x36')][_0x58d2('0x34')][_0x58d2('0x3c')][0x0];}var _0x9d300a=_['defaults'](_0x5acd39[_0x58d2('0x21')],{'firstName':_0x5acd39[_0x58d2('0x21')]['from'],'ListId':_0x50425a[_0x58d2('0x3e')]});_0x9d300a[_0x5acd39['body'][_0x58d2('0x2e')]]=_0x5acd39[_0x58d2('0x21')][_0x58d2('0x2c')];return db['CmContact']['create'](_0x9d300a,{'fields':_0x1c0da8,'raw':!![]});}})[_0x58d2('0xc')](function(_0xe54bb8){_0x25ec44[_0x58d2('0x3f')]=_0xe54bb8;if(_0xe54bb8){var _0x21050c={'ContactId':_0xe54bb8['id'],'FaxAccountId':_0x5acd39['account']['id'],'fax':_0xe54bb8[_0x58d2('0x40')]};return db['FaxInteraction'][_0x58d2('0x32')]({'where':{'ContactId':_0xe54bb8['id'],'closed':![],'FaxAccountId':_0x5acd39[_0x58d2('0x36')]['id']}})[_0x58d2('0xc')](function(_0xb4b6be){if(_0xb4b6be){return[_0xb4b6be,![]];}return db['FaxInteraction']['create'](_0x21050c)[_0x58d2('0xc')](function(_0x4ed5de){return[_0x4ed5de,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x58d2('0x41')](function(_0x5f2650,_0x29478c){var _0x348890=_0x5f2650[_0x58d2('0x42')]({'plain':!![]});if(_0x29478c){if(_0x25ec44[_0x58d2('0x36')]['autoclose']){_0x25ec44[_0x58d2('0x37')][_0x58d2('0x43')]({'id':0x0,'priority':_0x25ec44[_0x58d2('0x37')][_0x58d2('0x3d')]+0x1,'app':_0x58d2('0x44'),'appdata':_0x58d2('0x45'),'interval':_0x58d2('0x46')});}_0x348890[_0x58d2('0x47')]=!![];}else{_0x348890[_0x58d2('0x47')]=![];}_0x25ec44[_0x58d2('0x48')]=_0x348890;return db[_0x58d2('0x49')][_0x58d2('0x4a')]({'body':_0x5acd39[_0x58d2('0x21')]['body'],'FaxAccountId':_0x5acd39[_0x58d2('0x36')]['id'],'FaxInteractionId':_0x5f2650['id'],'direction':'in','ContactId':_0x5f2650[_0x58d2('0x4b')],'AttachmentId':_0x5acd39[_0x58d2('0x21')][_0x58d2('0x4c')]});})['then'](function(_0x5ba619){_0x25ec44[_0x58d2('0x13')]=_0x5ba619;if(_0x25ec44['interaction'][_0x58d2('0x4d')]){return db['User'][_0x58d2('0x32')]({'attributes':['id','name'],'where':{'id':_0x25ec44[_0x58d2('0x48')][_0x58d2('0x4d')]}})[_0x58d2('0xc')](function(_0x440ff5){if(_0x440ff5){_0x25ec44[_0x58d2('0x37')][_0x58d2('0x4e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x440ff5[_0x58d2('0x4f')]+','+(_0x25ec44['account']['waitForTheAssignedAgent']||0xa),'interval':_0x58d2('0x46')});}return respondWithRpcPromise(_0x58d2('0x50'),_0x58d2('0x51'),_0x25ec44);});}return respondWithRpcPromise(_0x58d2('0x50'),'startRouting',_0x25ec44);})[_0x58d2('0xc')](function(_0x5e4ba9){_0x2450fe(_0x5e4ba9);})[_0x58d2('0x1f')](function(_0x699f22){_0x253008(_0x4e5972[_0x58d2('0x12')](0x1f4,_0x699f22['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b55192e..944a123 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 _0xbd72=['update','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xbd72,0x10d));var _0x2bd7=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xbd72[_0x12ca5f];return _0xfc3ae9;};'use strict';var FaxAccountEvents=require(_0x2bd7('0x0'));var events=[_0x2bd7('0x1'),_0x2bd7('0x2'),_0x2bd7('0x3')];function createListener(_0x119152,_0x20ead9){return function(_0x5c2cba){_0x20ead9['emit'](_0x119152,_0x5c2cba);};}function removeListener(_0xd68fea,_0x44b27a){return function(){FaxAccountEvents[_0x2bd7('0x4')](_0xd68fea,_0x44b27a);};}exports[_0x2bd7('0x5')]=function(_0x4b8491){for(var _0x463f9b=0x0,_0x35659f=events[_0x2bd7('0x6')];_0x463f9b<_0x35659f;_0x463f9b++){var _0x12b039=events[_0x463f9b];var _0x559090=createListener(_0x2bd7('0x7')+_0x12b039,_0x4b8491);FaxAccountEvents['on'](_0x12b039,_0x559090);}}; \ No newline at end of file +var _0xcfde=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x4f78a8,_0x5e7afd){var _0x46f268=function(_0x5ee6d5){while(--_0x5ee6d5){_0x4f78a8['push'](_0x4f78a8['shift']());}};_0x46f268(++_0x5e7afd);}(_0xcfde,0xf9));var _0xecfd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcfde[_0x167cc1];return _0x10bc4b;};'use strict';var FaxAccountEvents=require(_0xecfd('0x0'));var events=[_0xecfd('0x1'),_0xecfd('0x2'),_0xecfd('0x3')];function createListener(_0x275d11,_0x1a7b03){return function(_0x3b86fd){_0x1a7b03[_0xecfd('0x4')](_0x275d11,_0x3b86fd);};}function removeListener(_0x2ba023,_0x2de17b){return function(){FaxAccountEvents[_0xecfd('0x5')](_0x2ba023,_0x2de17b);};}exports[_0xecfd('0x6')]=function(_0x3e3da7){for(var _0x40887c=0x0,_0x2a3a8d=events[_0xecfd('0x7')];_0x40887c<_0x2a3a8d;_0x40887c++){var _0x1281ee=events[_0x40887c];var _0x595bfa=createListener(_0xecfd('0x8')+_0x1281ee,_0x3e3da7);FaxAccountEvents['on'](_0x1281ee,_0x595bfa);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 012307e..0f98e0c 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x49b39b,_0x561f3b){var _0x5e48c7=function(_0x40f8fa){while(--_0x40f8fa){_0x49b39b['push'](_0x49b39b['shift']());}};_0x5e48c7(++_0x561f3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x58b6cc,_0x559b8b){var _0x148892=function(_0x2a0176){while(--_0x2a0176){_0x58b6cc['push'](_0x58b6cc['shift']());}};_0x148892(++_0x559b8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 6cf6bee..522ac05 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 _0x6721=['sequelize','INTEGER','STRING','noop','*,*,*,*'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x6721,0x159));var _0x1672=function(_0x104c6f,_0x34ff6d){_0x104c6f=_0x104c6f-0x0;var _0xdb89b4=_0x6721[_0x104c6f];return _0xdb89b4;};'use strict';var Sequelize=require(_0x1672('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1672('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1672('0x2')],'allowNull':![],'defaultValue':_0x1672('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1672('0x2')]},'interval':{'type':Sequelize[_0x1672('0x2')],'defaultValue':_0x1672('0x4')}}; \ No newline at end of file +var _0x9106=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2b63c4,_0x2fc67e){var _0x75616a=function(_0x16cd33){while(--_0x16cd33){_0x2b63c4['push'](_0x2b63c4['shift']());}};_0x75616a(++_0x2fc67e);}(_0x9106,0x176));var _0x6910=function(_0x2d9359,_0x52473b){_0x2d9359=_0x2d9359-0x0;var _0x3fe0ef=_0x9106[_0x2d9359];return _0x3fe0ef;};'use strict';var Sequelize=require(_0x6910('0x0'));module[_0x6910('0x1')]={'priority':{'type':Sequelize[_0x6910('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6910('0x3')],'allowNull':![],'defaultValue':_0x6910('0x4')},'appdata':{'type':Sequelize[_0x6910('0x5')]()},'description':{'type':Sequelize[_0x6910('0x3')]},'interval':{'type':Sequelize[_0x6910('0x3')],'defaultValue':_0x6910('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 98ae86c..0944547 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 _0xe6f6=['fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../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','update','then','sendStatus','error','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','options','FaxApplication','includeAll','include','rows','catch','show','params','fields','find','create','body','eml-format','zip-dir'];(function(_0x125bd4,_0x129efa){var _0x2ca659=function(_0x296758){while(--_0x296758){_0x125bd4['push'](_0x125bd4['shift']());}};_0x2ca659(++_0x129efa);}(_0xe6f6,0xd3));var _0x6e6f=function(_0x11cd97,_0x1b7d91){_0x11cd97=_0x11cd97-0x0;var _0x273640=_0xe6f6[_0x11cd97];return _0x273640;};'use strict';var emlformat=require(_0x6e6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e6f('0x1'));var jsonpatch=require(_0x6e6f('0x2'));var rp=require(_0x6e6f('0x3'));var moment=require('moment');var BPromise=require(_0x6e6f('0x4'));var Mustache=require(_0x6e6f('0x5'));var util=require(_0x6e6f('0x6'));var path=require('path');var sox=require(_0x6e6f('0x7'));var csv=require(_0x6e6f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e6f('0x9'));var _=require(_0x6e6f('0xa'));var squel=require('squel');var crypto=require(_0x6e6f('0xb'));var jsforce=require(_0x6e6f('0xc'));var deskjs=require(_0x6e6f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6e6f('0xe'));var qs=require(_0x6e6f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e6f('0x10'));var logger=require(_0x6e6f('0x11'))(_0x6e6f('0x12'));var utils=require(_0x6e6f('0x13'));var config=require(_0x6e6f('0x14'));var licenseUtil=require(_0x6e6f('0x15'));var db=require(_0x6e6f('0x16'))['db'];function respondWithStatusCode(_0x3df432,_0x2cfe6f){_0x2cfe6f=_0x2cfe6f||0xcc;return function(_0x3f7549){if(_0x3f7549){return _0x3df432['sendStatus'](_0x2cfe6f);}return _0x3df432['status'](_0x2cfe6f)[_0x6e6f('0x17')]();};}function respondWithResult(_0x92be65,_0x49e21a){_0x49e21a=_0x49e21a||0xc8;return function(_0x50cebb){if(_0x50cebb){return _0x92be65[_0x6e6f('0x18')](_0x49e21a)[_0x6e6f('0x19')](_0x50cebb);}};}function respondWithFilteredResult(_0x294a96,_0x267c29){return function(_0x3cc216){if(_0x3cc216){var _0xbcf8ed=typeof _0x267c29[_0x6e6f('0x1a')]===_0x6e6f('0x1b')&&typeof _0x267c29[_0x6e6f('0x1c')]===_0x6e6f('0x1b');var _0x2d034f=_0x3cc216[_0x6e6f('0x1d')];var _0xbc658f=_0xbcf8ed?0x0:_0x267c29[_0x6e6f('0x1a')];var _0x36d6da=_0xbcf8ed?_0x3cc216[_0x6e6f('0x1d')]:_0x267c29[_0x6e6f('0x1a')]+_0x267c29['limit'];var _0xdc8b05;if(_0x36d6da>=_0x2d034f){_0x36d6da=_0x2d034f;_0xdc8b05=0xc8;}else{_0xdc8b05=0xce;}_0x294a96[_0x6e6f('0x18')](_0xdc8b05);return _0x294a96[_0x6e6f('0x1e')](_0x6e6f('0x1f'),_0xbc658f+'-'+_0x36d6da+'/'+_0x2d034f)[_0x6e6f('0x19')](_0x3cc216);}return null;};}function patchUpdates(_0x5bb2a1){return function(_0x1083df){try{jsonpatch['apply'](_0x1083df,_0x5bb2a1,!![]);}catch(_0x42fa5b){return BPromise[_0x6e6f('0x20')](_0x42fa5b);}return _0x1083df['save']();};}function saveUpdates(_0x15c9d6,_0x10f2c5){return function(_0x5cb640){if(_0x5cb640){return _0x5cb640[_0x6e6f('0x21')](_0x15c9d6)[_0x6e6f('0x22')](function(_0x1f7a64){return _0x1f7a64;});}return null;};}function removeEntity(_0x4dca5d,_0x18fc3c){return function(_0x1d2f4a){if(_0x1d2f4a){return _0x1d2f4a['destroy']()[_0x6e6f('0x22')](function(){_0x4dca5d['status'](0xcc)[_0x6e6f('0x17')]();});}};}function handleEntityNotFound(_0x48699f,_0x18570f){return function(_0x53be9e){if(!_0x53be9e){_0x48699f[_0x6e6f('0x23')](0x194);}return _0x53be9e;};}function handleError(_0x2262dc,_0x3747d0){_0x3747d0=_0x3747d0||0x1f4;return function(_0x4cefea){logger[_0x6e6f('0x24')](_0x4cefea['stack']);if(_0x4cefea[_0x6e6f('0x25')]){delete _0x4cefea[_0x6e6f('0x25')];}_0x2262dc[_0x6e6f('0x18')](_0x3747d0)[_0x6e6f('0x26')](_0x4cefea);};}exports[_0x6e6f('0x27')]=function(_0x4978fd,_0x4e99b4){var _0x1c4f2b={},_0x4f0b73={},_0x374e41={'count':0x0,'rows':[]};var _0x4d6c1f=_['map'](db['FaxApplication'][_0x6e6f('0x28')],function(_0x4bdfc0){return{'name':_0x4bdfc0['fieldName'],'type':_0x4bdfc0[_0x6e6f('0x29')][_0x6e6f('0x2a')]};});_0x4f0b73[_0x6e6f('0x2b')]=_['map'](_0x4d6c1f,'name');_0x4f0b73[_0x6e6f('0x2c')]=_[_0x6e6f('0x2d')](_0x4978fd['query']);_0x4f0b73[_0x6e6f('0x2e')]=_[_0x6e6f('0x2f')](_0x4f0b73['model'],_0x4f0b73[_0x6e6f('0x2c')]);_0x1c4f2b[_0x6e6f('0x30')]=_['intersection'](_0x4f0b73['model'],qs['fields'](_0x4978fd['query']['fields']));_0x1c4f2b[_0x6e6f('0x30')]=_0x1c4f2b[_0x6e6f('0x30')][_0x6e6f('0x31')]?_0x1c4f2b[_0x6e6f('0x30')]:_0x4f0b73[_0x6e6f('0x2b')];if(!_0x4978fd[_0x6e6f('0x2c')][_0x6e6f('0x32')](_0x6e6f('0x33'))){_0x1c4f2b[_0x6e6f('0x1c')]=qs[_0x6e6f('0x1c')](_0x4978fd['query'][_0x6e6f('0x1c')]);_0x1c4f2b[_0x6e6f('0x1a')]=qs['offset'](_0x4978fd['query'][_0x6e6f('0x1a')]);}_0x1c4f2b[_0x6e6f('0x34')]=qs[_0x6e6f('0x35')](_0x4978fd['query'][_0x6e6f('0x35')]);_0x1c4f2b['where']=qs[_0x6e6f('0x2e')](_[_0x6e6f('0x36')](_0x4978fd[_0x6e6f('0x2c')],_0x4f0b73[_0x6e6f('0x2e')]),_0x4d6c1f);if(_0x4978fd['query']['filter']){_0x1c4f2b[_0x6e6f('0x37')]=_[_0x6e6f('0x38')](_0x1c4f2b[_0x6e6f('0x37')],{'$or':_[_0x6e6f('0x39')](_0x4d6c1f,function(_0x53b75f){if(_0x53b75f[_0x6e6f('0x29')]!==_0x6e6f('0x3a')){var _0x523445={};_0x523445[_0x53b75f[_0x6e6f('0x25')]]={'$like':'%'+_0x4978fd['query']['filter']+'%'};return _0x523445;}})});}_0x1c4f2b=_['merge']({},_0x1c4f2b,_0x4978fd[_0x6e6f('0x3b')]);var _0x50173f={'where':_0x1c4f2b[_0x6e6f('0x37')]};return db[_0x6e6f('0x3c')][_0x6e6f('0x1d')](_0x50173f)[_0x6e6f('0x22')](function(_0x1700f6){_0x374e41[_0x6e6f('0x1d')]=_0x1700f6;if(_0x4978fd[_0x6e6f('0x2c')][_0x6e6f('0x3d')]){_0x1c4f2b[_0x6e6f('0x3e')]=[{'all':!![]}];}return db[_0x6e6f('0x3c')]['findAll'](_0x1c4f2b);})[_0x6e6f('0x22')](function(_0x228ab3){_0x374e41[_0x6e6f('0x3f')]=_0x228ab3;return _0x374e41;})[_0x6e6f('0x22')](respondWithFilteredResult(_0x4e99b4,_0x1c4f2b))[_0x6e6f('0x40')](handleError(_0x4e99b4,null));};exports[_0x6e6f('0x41')]=function(_0x4f23b2,_0x2324a0){var _0x3be7b0={'raw':!![],'where':{'id':_0x4f23b2[_0x6e6f('0x42')]['id']}},_0x541dd2={};_0x541dd2['model']=_[_0x6e6f('0x2d')](db[_0x6e6f('0x3c')][_0x6e6f('0x28')]);_0x541dd2[_0x6e6f('0x2c')]=_['keys'](_0x4f23b2[_0x6e6f('0x2c')]);_0x541dd2[_0x6e6f('0x2e')]=_[_0x6e6f('0x2f')](_0x541dd2[_0x6e6f('0x2b')],_0x541dd2[_0x6e6f('0x2c')]);_0x3be7b0[_0x6e6f('0x30')]=_[_0x6e6f('0x2f')](_0x541dd2['model'],qs['fields'](_0x4f23b2[_0x6e6f('0x2c')][_0x6e6f('0x43')]));_0x3be7b0[_0x6e6f('0x30')]=_0x3be7b0[_0x6e6f('0x30')][_0x6e6f('0x31')]?_0x3be7b0[_0x6e6f('0x30')]:_0x541dd2[_0x6e6f('0x2b')];if(_0x4f23b2[_0x6e6f('0x2c')]['includeAll']){_0x3be7b0[_0x6e6f('0x3e')]=[{'all':!![]}];}_0x3be7b0=_[_0x6e6f('0x38')]({},_0x3be7b0,_0x4f23b2[_0x6e6f('0x3b')]);return db[_0x6e6f('0x3c')][_0x6e6f('0x44')](_0x3be7b0)[_0x6e6f('0x22')](handleEntityNotFound(_0x2324a0,null))[_0x6e6f('0x22')](respondWithResult(_0x2324a0,null))['catch'](handleError(_0x2324a0,null));};exports[_0x6e6f('0x45')]=function(_0x4eed55,_0x4d2130){return db[_0x6e6f('0x3c')][_0x6e6f('0x45')](_0x4eed55[_0x6e6f('0x46')],{})[_0x6e6f('0x22')](respondWithResult(_0x4d2130,0xc9))[_0x6e6f('0x40')](handleError(_0x4d2130,null));};exports[_0x6e6f('0x21')]=function(_0x33784b,_0x24067c){if(_0x33784b['body']['id']){delete _0x33784b[_0x6e6f('0x46')]['id'];}return db[_0x6e6f('0x3c')][_0x6e6f('0x44')]({'where':{'id':_0x33784b[_0x6e6f('0x42')]['id']}})[_0x6e6f('0x22')](handleEntityNotFound(_0x24067c,null))[_0x6e6f('0x22')](saveUpdates(_0x33784b[_0x6e6f('0x46')],null))[_0x6e6f('0x22')](respondWithResult(_0x24067c,null))[_0x6e6f('0x40')](handleError(_0x24067c,null));};exports['destroy']=function(_0x42375a,_0x3cb086){return db[_0x6e6f('0x3c')][_0x6e6f('0x44')]({'where':{'id':_0x42375a[_0x6e6f('0x42')]['id']}})[_0x6e6f('0x22')](handleEntityNotFound(_0x3cb086,null))[_0x6e6f('0x22')](removeEntity(_0x3cb086,null))['catch'](handleError(_0x3cb086,null));}; \ No newline at end of file +var _0x68c6=['fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','destroy','find','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','stack','name','send','map','FaxApplication','rawAttributes'];(function(_0x86a170,_0x1a31d7){var _0x640e8b=function(_0xa7d2a2){while(--_0xa7d2a2){_0x86a170['push'](_0x86a170['shift']());}};_0x640e8b(++_0x1a31d7);}(_0x68c6,0x182));var _0x668c=function(_0x2c602e,_0x1d26f5){_0x2c602e=_0x2c602e-0x0;var _0x1a2650=_0x68c6[_0x2c602e];return _0x1a2650;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x668c('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x668c('0x1'));var Mustache=require(_0x668c('0x2'));var util=require(_0x668c('0x3'));var path=require(_0x668c('0x4'));var sox=require('sox');var csv=require(_0x668c('0x5'));var ejs=require(_0x668c('0x6'));var fs=require('fs');var fs_extra=require(_0x668c('0x7'));var _=require(_0x668c('0x8'));var squel=require(_0x668c('0x9'));var crypto=require('crypto');var jsforce=require(_0x668c('0xa'));var deskjs=require(_0x668c('0xb'));var toCsv=require(_0x668c('0x5'));var querystring=require(_0x668c('0xc'));var Papa=require(_0x668c('0xd'));var Redis=require(_0x668c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x668c('0xf'));var as=require(_0x668c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x668c('0x11'))('api');var utils=require(_0x668c('0x12'));var config=require(_0x668c('0x13'));var licenseUtil=require(_0x668c('0x14'));var db=require(_0x668c('0x15'))['db'];function respondWithStatusCode(_0x2c5255,_0x580435){_0x580435=_0x580435||0xcc;return function(_0x4657c7){if(_0x4657c7){return _0x2c5255['sendStatus'](_0x580435);}return _0x2c5255[_0x668c('0x16')](_0x580435)[_0x668c('0x17')]();};}function respondWithResult(_0x4f6264,_0x2c1caa){_0x2c1caa=_0x2c1caa||0xc8;return function(_0x1fb78e){if(_0x1fb78e){return _0x4f6264[_0x668c('0x16')](_0x2c1caa)[_0x668c('0x18')](_0x1fb78e);}};}function respondWithFilteredResult(_0x2c8d1e,_0x55226f){return function(_0x3d1f26){if(_0x3d1f26){var _0x5ccaa4=typeof _0x55226f[_0x668c('0x19')]===_0x668c('0x1a')&&typeof _0x55226f[_0x668c('0x1b')]==='undefined';var _0x4c2c68=_0x3d1f26[_0x668c('0x1c')];var _0x31ca58=_0x5ccaa4?0x0:_0x55226f[_0x668c('0x19')];var _0x1f3850=_0x5ccaa4?_0x3d1f26[_0x668c('0x1c')]:_0x55226f[_0x668c('0x19')]+_0x55226f[_0x668c('0x1b')];var _0x51b249;if(_0x1f3850>=_0x4c2c68){_0x1f3850=_0x4c2c68;_0x51b249=0xc8;}else{_0x51b249=0xce;}_0x2c8d1e['status'](_0x51b249);return _0x2c8d1e[_0x668c('0x1d')](_0x668c('0x1e'),_0x31ca58+'-'+_0x1f3850+'/'+_0x4c2c68)[_0x668c('0x18')](_0x3d1f26);}return null;};}function patchUpdates(_0x56354d){return function(_0xb6a095){try{jsonpatch['apply'](_0xb6a095,_0x56354d,!![]);}catch(_0xec2e18){return BPromise[_0x668c('0x1f')](_0xec2e18);}return _0xb6a095['save']();};}function saveUpdates(_0x2e4d52,_0x33372){return function(_0x3adf49){if(_0x3adf49){return _0x3adf49[_0x668c('0x20')](_0x2e4d52)[_0x668c('0x21')](function(_0x55754d){return _0x55754d;});}return null;};}function removeEntity(_0x27a6e9,_0x457382){return function(_0x268a5a){if(_0x268a5a){return _0x268a5a['destroy']()[_0x668c('0x21')](function(){_0x27a6e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc601,_0x761ec){return function(_0x228316){if(!_0x228316){_0x2bc601['sendStatus'](0x194);}return _0x228316;};}function handleError(_0x2afea2,_0x239f61){_0x239f61=_0x239f61||0x1f4;return function(_0x24b609){logger['error'](_0x24b609[_0x668c('0x22')]);if(_0x24b609[_0x668c('0x23')]){delete _0x24b609[_0x668c('0x23')];}_0x2afea2['status'](_0x239f61)[_0x668c('0x24')](_0x24b609);};}exports['index']=function(_0x3703f5,_0x50c5bc){var _0x612b60={},_0x59183b={},_0x33a671={'count':0x0,'rows':[]};var _0x47731c=_[_0x668c('0x25')](db[_0x668c('0x26')][_0x668c('0x27')],function(_0x1e258a){return{'name':_0x1e258a[_0x668c('0x28')],'type':_0x1e258a[_0x668c('0x29')][_0x668c('0x2a')]};});_0x59183b['model']=_[_0x668c('0x25')](_0x47731c,_0x668c('0x23'));_0x59183b[_0x668c('0x2b')]=_[_0x668c('0x2c')](_0x3703f5[_0x668c('0x2b')]);_0x59183b[_0x668c('0x2d')]=_['intersection'](_0x59183b[_0x668c('0x2e')],_0x59183b[_0x668c('0x2b')]);_0x612b60[_0x668c('0x2f')]=_[_0x668c('0x30')](_0x59183b['model'],qs['fields'](_0x3703f5['query'][_0x668c('0x31')]));_0x612b60['attributes']=_0x612b60[_0x668c('0x2f')][_0x668c('0x32')]?_0x612b60[_0x668c('0x2f')]:_0x59183b[_0x668c('0x2e')];if(!_0x3703f5['query'][_0x668c('0x33')](_0x668c('0x34'))){_0x612b60['limit']=qs[_0x668c('0x1b')](_0x3703f5[_0x668c('0x2b')][_0x668c('0x1b')]);_0x612b60['offset']=qs['offset'](_0x3703f5[_0x668c('0x2b')][_0x668c('0x19')]);}_0x612b60['order']=qs[_0x668c('0x35')](_0x3703f5[_0x668c('0x2b')][_0x668c('0x35')]);_0x612b60['where']=qs[_0x668c('0x2d')](_[_0x668c('0x36')](_0x3703f5[_0x668c('0x2b')],_0x59183b[_0x668c('0x2d')]),_0x47731c);if(_0x3703f5[_0x668c('0x2b')][_0x668c('0x37')]){_0x612b60[_0x668c('0x38')]=_['merge'](_0x612b60[_0x668c('0x38')],{'$or':_['map'](_0x47731c,function(_0xe4247f){if(_0xe4247f[_0x668c('0x29')]!==_0x668c('0x39')){var _0x3f14f3={};_0x3f14f3[_0xe4247f[_0x668c('0x23')]]={'$like':'%'+_0x3703f5[_0x668c('0x2b')]['filter']+'%'};return _0x3f14f3;}})});}_0x612b60=_[_0x668c('0x3a')]({},_0x612b60,_0x3703f5[_0x668c('0x3b')]);var _0x2bf718={'where':_0x612b60[_0x668c('0x38')]};return db['FaxApplication'][_0x668c('0x1c')](_0x2bf718)['then'](function(_0x13bdbe){_0x33a671[_0x668c('0x1c')]=_0x13bdbe;if(_0x3703f5['query'][_0x668c('0x3c')]){_0x612b60[_0x668c('0x3d')]=[{'all':!![]}];}return db[_0x668c('0x26')][_0x668c('0x3e')](_0x612b60);})[_0x668c('0x21')](function(_0x1e6bee){_0x33a671[_0x668c('0x3f')]=_0x1e6bee;return _0x33a671;})['then'](respondWithFilteredResult(_0x50c5bc,_0x612b60))[_0x668c('0x40')](handleError(_0x50c5bc,null));};exports[_0x668c('0x41')]=function(_0x3d782a,_0x5329be){var _0x34c719={'raw':!![],'where':{'id':_0x3d782a[_0x668c('0x42')]['id']}},_0x8dc411={};_0x8dc411[_0x668c('0x2e')]=_[_0x668c('0x2c')](db['FaxApplication'][_0x668c('0x27')]);_0x8dc411[_0x668c('0x2b')]=_[_0x668c('0x2c')](_0x3d782a[_0x668c('0x2b')]);_0x8dc411[_0x668c('0x2d')]=_['intersection'](_0x8dc411[_0x668c('0x2e')],_0x8dc411[_0x668c('0x2b')]);_0x34c719['attributes']=_[_0x668c('0x30')](_0x8dc411[_0x668c('0x2e')],qs[_0x668c('0x31')](_0x3d782a[_0x668c('0x2b')][_0x668c('0x31')]));_0x34c719[_0x668c('0x2f')]=_0x34c719['attributes'][_0x668c('0x32')]?_0x34c719[_0x668c('0x2f')]:_0x8dc411[_0x668c('0x2e')];if(_0x3d782a[_0x668c('0x2b')][_0x668c('0x3c')]){_0x34c719[_0x668c('0x3d')]=[{'all':!![]}];}_0x34c719=_[_0x668c('0x3a')]({},_0x34c719,_0x3d782a['options']);return db[_0x668c('0x26')]['find'](_0x34c719)[_0x668c('0x21')](handleEntityNotFound(_0x5329be,null))[_0x668c('0x21')](respondWithResult(_0x5329be,null))[_0x668c('0x40')](handleError(_0x5329be,null));};exports[_0x668c('0x43')]=function(_0x366b0d,_0x4ef624){return db['FaxApplication'][_0x668c('0x43')](_0x366b0d[_0x668c('0x44')],{})[_0x668c('0x21')](respondWithResult(_0x4ef624,0xc9))[_0x668c('0x40')](handleError(_0x4ef624,null));};exports[_0x668c('0x20')]=function(_0x42ab78,_0x494777){if(_0x42ab78[_0x668c('0x44')]['id']){delete _0x42ab78[_0x668c('0x44')]['id'];}return db[_0x668c('0x26')]['find']({'where':{'id':_0x42ab78[_0x668c('0x42')]['id']}})[_0x668c('0x21')](handleEntityNotFound(_0x494777,null))[_0x668c('0x21')](saveUpdates(_0x42ab78[_0x668c('0x44')],null))['then'](respondWithResult(_0x494777,null))['catch'](handleError(_0x494777,null));};exports[_0x668c('0x45')]=function(_0x454d58,_0x4f4939){return db[_0x668c('0x26')][_0x668c('0x46')]({'where':{'id':_0x454d58[_0x668c('0x42')]['id']}})[_0x668c('0x21')](handleEntityNotFound(_0x4f4939,null))[_0x668c('0x21')](removeEntity(_0x4f4939,null))[_0x668c('0x40')](handleError(_0x4f4939,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4510dc6..ba6ba76 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 _0x1829=['exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x12033e,_0x1a0e23){var _0x229829=function(_0x47b9bf){while(--_0x47b9bf){_0x12033e['push'](_0x12033e['shift']());}};_0x229829(++_0x1a0e23);}(_0x1829,0x1b2));var _0x9182=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x1829[_0x35da42];return _0x370035;};'use strict';var _=require(_0x9182('0x0'));var util=require(_0x9182('0x1'));var logger=require('../../config/logger')(_0x9182('0x2'));var moment=require(_0x9182('0x3'));var BPromise=require(_0x9182('0x4'));var rp=require(_0x9182('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9182('0x6'));var config=require(_0x9182('0x7'));var attributes=require('./faxApplication.attributes');module[_0x9182('0x8')]=function(_0x49bf87,_0x24d2b7){return _0x49bf87[_0x9182('0x9')](_0x9182('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9182('0xb'),'collate':_0x9182('0xc')});}; \ No newline at end of file +var _0x8489=['exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x8489,0x10f));var _0x9848=function(_0x16fea5,_0x566b5d){_0x16fea5=_0x16fea5-0x0;var _0x5c9681=_0x8489[_0x16fea5];return _0x5c9681;};'use strict';var _=require(_0x9848('0x0'));var util=require(_0x9848('0x1'));var logger=require(_0x9848('0x2'))(_0x9848('0x3'));var moment=require(_0x9848('0x4'));var BPromise=require(_0x9848('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9848('0x6'));var rimraf=require(_0x9848('0x7'));var config=require(_0x9848('0x8'));var attributes=require('./faxApplication.attributes');module[_0x9848('0x9')]=function(_0x270782,_0x49efef){return _0x270782[_0x9848('0xa')](_0x9848('0xb'),attributes,{'tableName':_0x9848('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9848('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index bc41d45..2a22958 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 _0xaeda=['attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where'];(function(_0x2d4bf3,_0x35849a){var _0x49fae7=function(_0x1001f3){while(--_0x1001f3){_0x2d4bf3['push'](_0x2d4bf3['shift']());}};_0x49fae7(++_0x35849a);}(_0xaeda,0x1b4));var _0xaaed=function(_0x5f474b,_0xd04e61){_0x5f474b=_0x5f474b-0x0;var _0x3b01c3=_0xaeda[_0x5f474b];return _0x3b01c3;};'use strict';var _=require(_0xaaed('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaaed('0x1'));var rs=require(_0xaaed('0x2'));var fs=require('fs');var Redis=require(_0xaaed('0x3'));var db=require(_0xaaed('0x4'))['db'];var utils=require(_0xaaed('0x5'));var logger=require('../../config/logger')(_0xaaed('0x6'));var config=require(_0xaaed('0x7'));var jayson=require(_0xaaed('0x8'));var client=jayson[_0xaaed('0x9')][_0xaaed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40c228,_0xdd0bcf,_0x44648a){return new BPromise(function(_0x803226,_0x29e870){return client[_0xaaed('0xb')](_0x40c228,_0x44648a)['then'](function(_0x176aa6){logger[_0xaaed('0xc')](_0xaaed('0xd'),_0xdd0bcf,_0xaaed('0xe'));logger[_0xaaed('0xf')](_0xaaed('0x10'),_0xdd0bcf,'request\x20sent',JSON[_0xaaed('0x11')](_0x176aa6));if(_0x176aa6[_0xaaed('0x12')]){if(_0x176aa6[_0xaaed('0x12')][_0xaaed('0x13')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0xdd0bcf,_0x176aa6[_0xaaed('0x12')][_0xaaed('0x14')]);return _0x29e870(_0x176aa6[_0xaaed('0x12')][_0xaaed('0x14')]);}logger[_0xaaed('0x12')](_0xaaed('0xd'),_0xdd0bcf,_0x176aa6[_0xaaed('0x12')][_0xaaed('0x14')]);return _0x803226(_0x176aa6[_0xaaed('0x12')]['message']);}else{logger[_0xaaed('0xc')](_0xaaed('0xd'),_0xdd0bcf,_0xaaed('0xe'));_0x803226(_0x176aa6['result'][_0xaaed('0x14')]);}})[_0xaaed('0x15')](function(_0x16afc4){logger['error'](_0xaaed('0xd'),_0xdd0bcf,_0x16afc4);_0x29e870(_0x16afc4);});});}exports[_0xaaed('0x16')]=function(_0x525c53){var _0x4bdb29=this;return new Promise(function(_0x238493,_0x193119){return db[_0xaaed('0x17')][_0xaaed('0x18')](_0x525c53[_0xaaed('0x19')],{'raw':_0x525c53[_0xaaed('0x1a')]?_0x525c53[_0xaaed('0x1a')][_0xaaed('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x525c53[_0xaaed('0x1a')]?_0x525c53['options'][_0xaaed('0x1c')]||null:null,'attributes':_0x525c53[_0xaaed('0x1a')]?_0x525c53['options'][_0xaaed('0x1d')]||null:null,'limit':_0x525c53[_0xaaed('0x1a')]?_0x525c53['options'][_0xaaed('0x1e')]||null:null})['then'](function(_0x112593){logger[_0xaaed('0xc')](_0xaaed('0x16'),_0x525c53);logger[_0xaaed('0xf')](_0xaaed('0x16'),_0x525c53,JSON['stringify'](_0x112593));_0x238493(_0x112593);})[_0xaaed('0x15')](function(_0x55d623){logger[_0xaaed('0x12')](_0xaaed('0x16'),_0x55d623['message'],_0x525c53);_0x193119(_0x4bdb29['error'](0x1f4,_0x55d623['message']));});});}; \ No newline at end of file +var _0x61bb=['update','body','options','where','attributes','UpdateFaxApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','FaxApplication'];(function(_0x185bdb,_0x5d7cce){var _0x308c39=function(_0x3ee4d4){while(--_0x3ee4d4){_0x185bdb['push'](_0x185bdb['shift']());}};_0x308c39(++_0x5d7cce);}(_0x61bb,0xa1));var _0xb61b=function(_0x2511c1,_0xf4e1d7){_0x2511c1=_0x2511c1-0x0;var _0x25597a=_0x61bb[_0x2511c1];return _0x25597a;};'use strict';var _=require('lodash');var util=require(_0xb61b('0x0'));var moment=require(_0xb61b('0x1'));var BPromise=require(_0xb61b('0x2'));var rs=require(_0xb61b('0x3'));var fs=require('fs');var Redis=require(_0xb61b('0x4'));var db=require(_0xb61b('0x5'))['db'];var utils=require(_0xb61b('0x6'));var logger=require(_0xb61b('0x7'))(_0xb61b('0x8'));var config=require(_0xb61b('0x9'));var jayson=require(_0xb61b('0xa'));var client=jayson[_0xb61b('0xb')][_0xb61b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56e7c4,_0x3c0798,_0x4e5f16){return new BPromise(function(_0x5a3c8b,_0x5a7d57){return client[_0xb61b('0xd')](_0x56e7c4,_0x4e5f16)[_0xb61b('0xe')](function(_0x5bef06){logger[_0xb61b('0xf')](_0xb61b('0x10'),_0x3c0798,_0xb61b('0x11'));logger[_0xb61b('0x12')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3c0798,_0xb61b('0x11'),JSON[_0xb61b('0x13')](_0x5bef06));if(_0x5bef06[_0xb61b('0x14')]){if(_0x5bef06[_0xb61b('0x14')]['code']===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x3c0798,_0x5bef06[_0xb61b('0x14')][_0xb61b('0x15')]);return _0x5a7d57(_0x5bef06[_0xb61b('0x14')][_0xb61b('0x15')]);}logger['error'](_0xb61b('0x10'),_0x3c0798,_0x5bef06['error'][_0xb61b('0x15')]);return _0x5a3c8b(_0x5bef06['error'][_0xb61b('0x15')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x3c0798,_0xb61b('0x11'));_0x5a3c8b(_0x5bef06[_0xb61b('0x16')][_0xb61b('0x15')]);}})[_0xb61b('0x17')](function(_0x283b2c){logger[_0xb61b('0x14')](_0xb61b('0x10'),_0x3c0798,_0x283b2c);_0x5a7d57(_0x283b2c);});});}exports['UpdateFaxApplication']=function(_0x36bd6d){var _0x41c081=this;return new Promise(function(_0x3c2be3,_0xe320d0){return db[_0xb61b('0x18')][_0xb61b('0x19')](_0x36bd6d[_0xb61b('0x1a')],{'raw':_0x36bd6d[_0xb61b('0x1b')]?_0x36bd6d[_0xb61b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36bd6d[_0xb61b('0x1b')]?_0x36bd6d['options'][_0xb61b('0x1c')]||null:null,'attributes':_0x36bd6d[_0xb61b('0x1b')]?_0x36bd6d[_0xb61b('0x1b')][_0xb61b('0x1d')]||null:null,'limit':_0x36bd6d['options']?_0x36bd6d[_0xb61b('0x1b')]['limit']||null:null})['then'](function(_0x589980){logger[_0xb61b('0xf')](_0xb61b('0x1e'),_0x36bd6d);logger[_0xb61b('0x12')](_0xb61b('0x1e'),_0x36bd6d,JSON['stringify'](_0x589980));_0x3c2be3(_0x589980);})['catch'](function(_0x5821b4){logger[_0xb61b('0x14')](_0xb61b('0x1e'),_0x5821b4['message'],_0x36bd6d);_0xe320d0(_0x41c081['error'](0x1f4,_0x5821b4[_0xb61b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 675632f..24edfba 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 _0x3423=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','path','connect-timeout','express','Router'];(function(_0x250f50,_0x3b4f44){var _0x1dd16b=function(_0x427715){while(--_0x427715){_0x250f50['push'](_0x250f50['shift']());}};_0x1dd16b(++_0x3b4f44);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0xe')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xf')]);router['put']('/:id',auth[_0x3342('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3342('0x10')]);module[_0x3342('0x11')]=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x528f09,_0x2ebe0f){var _0x33f4ae=function(_0x748ca5){while(--_0x748ca5){_0x528f09['push'](_0x528f09['shift']());}};_0x33f4ae(++_0x2ebe0f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'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['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('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 b9a3775..48094ac 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 _0xaa4c=['BOOLEAN','DATE','STRING','ENUM','out','exports'];(function(_0x12c0e3,_0x5be87b){var _0xa5ff66=function(_0x593ada){while(--_0x593ada){_0x12c0e3['push'](_0x12c0e3['shift']());}};_0xa5ff66(++_0x5be87b);}(_0xaa4c,0x1e5));var _0xcaa4=function(_0x46f219,_0x49675f){_0x46f219=_0x46f219-0x0;var _0xafab39=_0xaa4c[_0x46f219];return _0xafab39;};'use strict';var Sequelize=require('sequelize');module[_0xcaa4('0x0')]={'closed':{'type':Sequelize[_0xcaa4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcaa4('0x2')]},'disposition':{'type':Sequelize[_0xcaa4('0x3')]},'secondDisposition':{'type':Sequelize[_0xcaa4('0x3')]},'thirdDisposition':{'type':Sequelize[_0xcaa4('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xcaa4('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xcaa4('0x4')]('in',_0xcaa4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcaa4('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x578c=['out','sequelize','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x578c,0x158));var _0xc578=function(_0x6e7061,_0x7d6347){_0x6e7061=_0x6e7061-0x0;var _0x9f40cb=_0x578c[_0x6e7061];return _0x9f40cb;};'use strict';var Sequelize=require(_0xc578('0x0'));module[_0xc578('0x1')]={'closed':{'type':Sequelize[_0xc578('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc578('0x3')]},'secondDisposition':{'type':Sequelize[_0xc578('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc578('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc578('0x4')]},'fax':{'type':Sequelize[_0xc578('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc578('0x5')]('in',_0xc578('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc578('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xc578('0x5')]('in',_0xc578('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 05589bf..126cbbd 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 _0x442b=['attributes','fields','length','includeAll','include','find','then','create','body','catch','describe','addMessage','ids','omit','getMessages','findOne','limit','order','sort','where','pick','FaxInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','FaxMessage','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createWriteStream','resolve','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','destroy','end','error','name','send','index','map','FaxInteraction','fieldName','type','key','findAll','fax','query','user','show','params','model','rawAttributes','keys','filters','intersection'];(function(_0x552dee,_0x1e45b0){var _0x30072e=function(_0x151eca){while(--_0x151eca){_0x552dee['push'](_0x552dee['shift']());}};_0x30072e(++_0x1e45b0);}(_0x442b,0xa3));var _0xb442=function(_0xacc2a,_0x8f5b4){_0xacc2a=_0xacc2a-0x0;var _0x511d55=_0x442b[_0xacc2a];return _0x511d55;};'use strict';var rimraf=require(_0xb442('0x0'));var zipdir=require(_0xb442('0x1'));var moment=require(_0xb442('0x2'));var BPromise=require(_0xb442('0x3'));var util=require(_0xb442('0x4'));var path=require(_0xb442('0x5'));var fs=require('fs');var _=require(_0xb442('0x6'));var Redis=require(_0xb442('0x7'));var interaction=require(_0xb442('0x8'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xb442('0x9'));var config=require(_0xb442('0xa'));var db=require(_0xb442('0xb'))['db'];config[_0xb442('0xc')]=_[_0xb442('0xd')](config[_0xb442('0xc')],{'host':_0xb442('0xe'),'port':0x18eb});var socket=require(_0xb442('0xf'))(new Redis(config[_0xb442('0xc')]));require(_0xb442('0x10'))[_0xb442('0x11')](socket);function respondWithStatusCode(_0xc4fcd5,_0x4fe017){_0x4fe017=_0x4fe017||0xcc;return function(_0x24a1e7){if(_0x24a1e7){return _0xc4fcd5[_0xb442('0x12')](_0x4fe017);}return _0xc4fcd5['status'](_0x4fe017)['end']();};}function respondWithResult(_0x198ac3,_0x2c968b){_0x2c968b=_0x2c968b||0xc8;return function(_0x37e682){if(_0x37e682){return _0x198ac3[_0xb442('0x13')](_0x2c968b)[_0xb442('0x14')](_0x37e682);}};}function respondWithFilteredResult(_0x36d45a,_0x110d2d){return function(_0x26dbbd){if(_0x26dbbd){var _0x37a760=typeof _0x110d2d[_0xb442('0x15')]===_0xb442('0x16')&&typeof _0x110d2d['limit']===_0xb442('0x16');var _0x4640c1=_0x26dbbd[_0xb442('0x17')];var _0x21fd86=_0x37a760?0x0:_0x110d2d[_0xb442('0x15')];var _0x340d2a=_0x37a760?_0x26dbbd['count']:_0x110d2d['offset']+_0x110d2d['limit'];var _0x102718;if(_0x340d2a>=_0x4640c1){_0x340d2a=_0x4640c1;_0x102718=0xc8;}else{_0x102718=0xce;}_0x36d45a[_0xb442('0x13')](_0x102718);return _0x36d45a[_0xb442('0x18')](_0xb442('0x19'),_0x21fd86+'-'+_0x340d2a+'/'+_0x4640c1)['json'](_0x26dbbd);}return null;};}function saveUpdates(_0xd9e89){return function(_0x5f0852){if(_0x5f0852){return _0x5f0852[_0xb442('0x1a')](_0xd9e89)['then'](function(_0x4aab5f){return _0x4aab5f;});}return null;};}function removeEntity(_0x1cc607){return function(_0x211366){if(_0x211366){return _0x211366[_0xb442('0x1b')]()['then'](function(){_0x1cc607[_0xb442('0x13')](0xcc)[_0xb442('0x1c')]();});}};}function handleEntityNotFound(_0xaa1109){return function(_0x51e4cc){if(!_0x51e4cc){_0xaa1109[_0xb442('0x12')](0x194);}return _0x51e4cc;};}function handleError(_0xe8811e,_0x19e1a3){_0x19e1a3=_0x19e1a3||0x1f4;return function(_0x133549){logger[_0xb442('0x1d')](_0x133549['stack']);if(_0x133549[_0xb442('0x1e')]){delete _0x133549[_0xb442('0x1e')];}_0xe8811e[_0xb442('0x13')](_0x19e1a3)[_0xb442('0x1f')](_0x133549);};}exports[_0xb442('0x20')]=function(_0xfe2b1b,_0x5740a8){var _0x17ad90={};var _0x25606b=_[_0xb442('0x21')](db[_0xb442('0x22')]['rawAttributes'],function(_0x385c23){return{'name':_0x385c23[_0xb442('0x23')],'type':_0x385c23[_0xb442('0x24')][_0xb442('0x25')]};});_0x17ad90=qs['getOptions'](_0x25606b,_0xfe2b1b);return interaction[_0xb442('0x26')](_0xb442('0x27'),_0xfe2b1b[_0xb442('0x28')],_0xfe2b1b[_0xb442('0x29')],_0x17ad90,_0x25606b)['then'](respondWithFilteredResult(_0x5740a8,_0x17ad90))['catch'](handleError(_0x5740a8,null));};exports[_0xb442('0x2a')]=function(_0x30f9a0,_0x582b03){var _0x36104b={'raw':![],'where':{'id':_0x30f9a0[_0xb442('0x2b')]['id']}},_0x5e3b2e={};_0x5e3b2e[_0xb442('0x2c')]=_['keys'](db['FaxInteraction'][_0xb442('0x2d')]);_0x5e3b2e['query']=_[_0xb442('0x2e')](_0x30f9a0[_0xb442('0x28')]);_0x5e3b2e[_0xb442('0x2f')]=_[_0xb442('0x30')](_0x5e3b2e['model'],_0x5e3b2e[_0xb442('0x28')]);_0x36104b[_0xb442('0x31')]=_[_0xb442('0x30')](_0x5e3b2e[_0xb442('0x2c')],qs[_0xb442('0x32')](_0x30f9a0['query'][_0xb442('0x32')]));_0x36104b[_0xb442('0x31')]=_0x36104b[_0xb442('0x31')][_0xb442('0x33')]?_0x36104b[_0xb442('0x31')]:_0x5e3b2e['model'];if(_0x30f9a0['query'][_0xb442('0x34')]){_0x36104b[_0xb442('0x35')]=[{'all':!![]}];}_0x36104b=_['merge']({},_0x36104b,_0x30f9a0['options']);return db['FaxInteraction'][_0xb442('0x36')](_0x36104b)[_0xb442('0x37')](handleEntityNotFound(_0x582b03,null))['then'](respondWithResult(_0x582b03,null))['catch'](handleError(_0x582b03,null));};exports['create']=function(_0x47dcca,_0x5e37f3){return db[_0xb442('0x22')][_0xb442('0x38')](_0x47dcca[_0xb442('0x39')],{})[_0xb442('0x37')](respondWithResult(_0x5e37f3,0xc9))[_0xb442('0x3a')](handleError(_0x5e37f3,null));};exports[_0xb442('0x1a')]=function(_0x749b8f,_0x4b808d){if(_0x749b8f['body']['id']){delete _0x749b8f[_0xb442('0x39')]['id'];}return db[_0xb442('0x22')][_0xb442('0x36')]({'where':{'id':_0x749b8f[_0xb442('0x2b')]['id']}})[_0xb442('0x37')](handleEntityNotFound(_0x4b808d,null))['then'](saveUpdates(_0x749b8f[_0xb442('0x39')],null))[_0xb442('0x37')](respondWithResult(_0x4b808d,null))['catch'](handleError(_0x4b808d,null));};exports['destroy']=function(_0x15b805,_0x374324){return db['FaxInteraction'][_0xb442('0x36')]({'where':{'id':_0x15b805['params']['id']}})[_0xb442('0x37')](handleEntityNotFound(_0x374324,null))[_0xb442('0x37')](removeEntity(_0x374324,null))[_0xb442('0x3a')](handleError(_0x374324,null));};exports['describe']=function(_0x1e433c,_0x33bc85){return db[_0xb442('0x22')][_0xb442('0x3b')]()[_0xb442('0x37')](respondWithResult(_0x33bc85,null))[_0xb442('0x3a')](handleError(_0x33bc85,null));};exports[_0xb442('0x3c')]=function(_0x4ac9c6,_0x4ff926){return db['FaxMessage'][_0xb442('0x36')]({'where':{'id':_0x4ac9c6['params']['id']}})[_0xb442('0x37')](handleEntityNotFound(_0x4ff926,null))[_0xb442('0x37')](function(_0x5390b5){if(_0x5390b5){return _0x5390b5[_0xb442('0x3c')](_0x4ac9c6['body'][_0xb442('0x3d')],_[_0xb442('0x3e')](_0x4ac9c6[_0xb442('0x39')],[_0xb442('0x3d'),'id'])||{});}})[_0xb442('0x37')](respondWithResult(_0x4ff926,null))[_0xb442('0x3a')](handleError(_0x4ff926,null));};exports[_0xb442('0x3f')]=function(_0x58438e,_0x429ed0){var _0x2c74d9={'raw':![],'where':{}};var _0x31970b={};var _0x2e60af={'count':0x0,'rows':[]};return db[_0xb442('0x22')][_0xb442('0x40')]({'where':{'id':_0x58438e[_0xb442('0x2b')]['id']}})[_0xb442('0x37')](handleEntityNotFound(_0x429ed0,null))[_0xb442('0x37')](function(_0x274da1){if(_0x274da1){_0x31970b[_0xb442('0x2c')]=_['keys'](db['FaxMessage'][_0xb442('0x2d')]);_0x31970b['query']=_[_0xb442('0x2e')](_0x58438e[_0xb442('0x28')]);_0x31970b[_0xb442('0x2f')]=_['intersection'](_0x31970b[_0xb442('0x2c')],_0x31970b['query']);_0x2c74d9[_0xb442('0x31')]=_[_0xb442('0x30')](_0x31970b['model'],qs['fields'](_0x58438e[_0xb442('0x28')][_0xb442('0x32')]));_0x2c74d9[_0xb442('0x31')]=_0x2c74d9['attributes'][_0xb442('0x33')]?_0x2c74d9[_0xb442('0x31')]:_0x31970b[_0xb442('0x2c')];if(!_0x58438e[_0xb442('0x28')]['hasOwnProperty']('nolimit')){_0x2c74d9[_0xb442('0x41')]=qs[_0xb442('0x41')](_0x58438e[_0xb442('0x28')][_0xb442('0x41')]);_0x2c74d9[_0xb442('0x15')]=qs[_0xb442('0x15')](_0x58438e[_0xb442('0x28')]['offset']);}_0x2c74d9[_0xb442('0x42')]=qs['sort'](_0x58438e['query'][_0xb442('0x43')]);_0x2c74d9[_0xb442('0x44')]=qs[_0xb442('0x2f')](_[_0xb442('0x45')](_0x58438e[_0xb442('0x28')],_0x31970b['filters']));_0x2c74d9['where'][_0xb442('0x46')]=_0x274da1['id'];if(_0x58438e[_0xb442('0x28')][_0xb442('0x47')]){_0x2c74d9['where']=_[_0xb442('0x48')](_0x2c74d9[_0xb442('0x44')],{'$or':_[_0xb442('0x21')](_0x2c74d9[_0xb442('0x31')],function(_0x184e9f){var _0x134dd9={};_0x134dd9[_0x184e9f]={'$like':'%'+_0x58438e['query'][_0xb442('0x47')]+'%'};return _0x134dd9;})});}if(_0x58438e['query'][_0xb442('0x49')]){var _0x53cb8f=_0x58438e[_0xb442('0x28')][_0xb442('0x49')][_0xb442('0x4a')](',');var _0x207c61={};_0x207c61[_0x53cb8f[0x0]]={'$gte':moment(_0x53cb8f[0x1])[_0xb442('0x4b')](_0xb442('0x4c'))};_0x2c74d9[_0xb442('0x44')]=_[_0xb442('0x48')](_0x2c74d9[_0xb442('0x44')],_0x207c61);}_0x2c74d9=_['merge']({},_0x2c74d9,_0x58438e[_0xb442('0x4d')]);return db[_0xb442('0x4e')][_0xb442('0x17')]({'where':_0x2c74d9[_0xb442('0x44')]})[_0xb442('0x37')](function(_0x4b7379){_0x2e60af[_0xb442('0x17')]=_0x4b7379;if(_0x58438e[_0xb442('0x28')]['includeAll']){_0x2c74d9[_0xb442('0x35')]=[{'all':!![]}];}return db[_0xb442('0x4e')][_0xb442('0x26')](_0x2c74d9);})['then'](function(_0x3accd5){_0x2e60af[_0xb442('0x4f')]=_0x3accd5;return _0x2e60af;});}})['then'](respondWithFilteredResult(_0x429ed0,_0x2c74d9))[_0xb442('0x3a')](handleError(_0x429ed0,null));};exports[_0xb442('0x50')]=function(_0x1059d9,_0x153c3b){return db[_0xb442('0x22')]['find']({'where':{'id':_0x1059d9[_0xb442('0x2b')]['id']}})['then'](handleEntityNotFound(_0x153c3b,null))[_0xb442('0x37')](function(_0x5694fe){if(_0x5694fe){return _0x5694fe[_0xb442('0x51')](_0x1059d9['body'][_0xb442('0x3d')],_['omit'](_0x1059d9[_0xb442('0x39')],[_0xb442('0x3d'),'id'])||{})[_0xb442('0x52')](function(){return db[_0xb442('0x53')][_0xb442('0x26')]({'attributes':['id',_0xb442('0x1e'),_0xb442('0x54')],'where':{'id':_0x1059d9[_0xb442('0x39')][_0xb442('0x3d')]}});})[_0xb442('0x37')](function(_0x1a046f){socket[_0xb442('0x55')]('faxInteractionTags:save',{'id':Number(_0x1059d9[_0xb442('0x2b')]['id']),'tags':_0x1a046f||[]});return{'id':Number(_0x1059d9[_0xb442('0x2b')]['id']),'tags':_0x1a046f||[]};});}})['then'](respondWithResult(_0x153c3b,null))[_0xb442('0x3a')](handleError(_0x153c3b,null));};exports[_0xb442('0x56')]=function(_0x5287d4,_0x217fcc){return db[_0xb442('0x22')][_0xb442('0x36')]({'where':{'id':_0x5287d4[_0xb442('0x2b')]['id']}})[_0xb442('0x37')](handleEntityNotFound(_0x217fcc,null))[_0xb442('0x37')](function(_0x47c9f1){if(_0x47c9f1){return _0x47c9f1[_0xb442('0x56')](_0x5287d4[_0xb442('0x28')][_0xb442('0x3d')]);}})[_0xb442('0x37')](respondWithStatusCode(_0x217fcc,null))['catch'](handleError(_0x217fcc,null));};exports[_0xb442('0x57')]=function(_0x517276,_0x45699b){var _0x1c45a9=moment()[_0xb442('0x58')]()[_0xb442('0x59')]();var _0x2dbf5d=path[_0xb442('0x5a')](config[_0xb442('0x5b')],_0xb442('0x5c'),_0xb442('0x5d'),'tmp');var _0x10d743=path[_0xb442('0x5a')](config[_0xb442('0x5b')],_0xb442('0x5c'),_0xb442('0x5d'),_0xb442('0x5e'));var _0x5deea0=path[_0xb442('0x5a')](_0x2dbf5d,_0x1c45a9);var _0x5c2a73=util['format'](_0xb442('0x5f'),_0x517276['params']['id'],_0x1c45a9);var _0x11ca1c=path[_0xb442('0x5a')](_0x2dbf5d,_0x5c2a73);var _0x4d1d37=[];_0x4d1d37[_0xb442('0x60')]({'model':db[_0xb442('0x61')],'as':_0xb442('0x61'),'raw':!![]});var _0x3d3979=[{'model':db['FaxMessage'],'as':_0xb442('0x62'),'attributes':['id',_0xb442('0x39'),_0xb442('0x63')],'include':_0x4d1d37}];return db[_0xb442('0x22')][_0xb442('0x36')]({'where':{'id':_0x517276[_0xb442('0x2b')]['id']},'include':_0x3d3979})['then'](handleEntityNotFound(_0x45699b,null))['then'](function(_0x5e2611){if(_0x5e2611&&_0x5e2611[_0xb442('0x62')]){var _0x5aa7ef=_0x5e2611['get']({'plain':!![]});fs[_0xb442('0x64')](_0x5deea0);for(var _0xd0baea=0x0;_0xd0baea<_0x5aa7ef[_0xb442('0x62')][_0xb442('0x33')];_0xd0baea++){var _0x31150e=_0x5aa7ef[_0xb442('0x62')][_0xd0baea][_0xb442('0x61')];if(_0x31150e){var _0x4ae48e=path['join'](_0x10d743,_0x31150e[_0xb442('0x65')]);if(fs[_0xb442('0x66')](_0x4ae48e)){fs['createReadStream'](_0x4ae48e)['pipe'](fs[_0xb442('0x67')](path[_0xb442('0x5a')](_0x5deea0,_0x31150e[_0xb442('0x65')])));}}}return BPromise[_0xb442('0x68')]()['then'](function(){return new BPromise(function(_0x5a43dd,_0x56a921){zipdir(_0x5deea0,{'saveTo':_0x11ca1c},function(_0x134c85,_0x305cba){if(_0x134c85)return _0x56a921(_0x134c85);return _0x5a43dd(_0x305cba);});})[_0xb442('0x37')](function(){return new BPromise(function(_0x3d90d9,_0xcdb35f){rimraf(_0x5deea0,function(_0x1abd93){if(_0x1abd93)_0xcdb35f(_0x1abd93);return _0x3d90d9();});});})[_0xb442('0x37')](function(){return _0x45699b[_0xb442('0x57')](_0x11ca1c,_0x5c2a73,function(_0x4786cb){if(_0x4786cb){console['log']('err',_0x4786cb);}else{fs[_0xb442('0x69')](_0x11ca1c);}});});});}else{return _0x45699b[_0xb442('0x12')](0xc8);}})[_0xb442('0x3a')](handleError(_0x45699b,null));}; \ No newline at end of file +var _0x2a4d=['removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','resolve','log','err','zip-dir','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','offset','limit','set','Content-Range','update','then','end','stack','name','send','index','map','rawAttributes','key','getOptions','findAll','fax','query','user','show','params','model','FaxInteraction','filters','intersection','fields','attributes','length','include','options','find','catch','create','body','destroy','describe','addMessage','ids','omit','findOne','keys','sort','where','pick','FaxInteractionId','filter','merge','$gte','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','count','includeAll','addTags','setTags','spread','Tag','emit','faxInteractionTags:save'];(function(_0x3ffd44,_0x13bdd5){var _0x229a89=function(_0x527ab3){while(--_0x527ab3){_0x3ffd44['push'](_0x3ffd44['shift']());}};_0x229a89(++_0x13bdd5);}(_0x2a4d,0x1ab));var _0xd2a4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x2a4d[_0x4b055c];return _0x4b62bb;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd2a4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xd2a4('0x1'));var path=require(_0xd2a4('0x2'));var fs=require('fs');var _=require(_0xd2a4('0x3'));var Redis=require(_0xd2a4('0x4'));var interaction=require(_0xd2a4('0x5'));var qs=require(_0xd2a4('0x6'));var logger=require(_0xd2a4('0x7'))(_0xd2a4('0x8'));var config=require(_0xd2a4('0x9'));var db=require(_0xd2a4('0xa'))['db'];config[_0xd2a4('0xb')]=_[_0xd2a4('0xc')](config[_0xd2a4('0xb')],{'host':_0xd2a4('0xd'),'port':0x18eb});var socket=require(_0xd2a4('0xe'))(new Redis(config[_0xd2a4('0xb')]));require('./faxInteraction.socket')[_0xd2a4('0xf')](socket);function respondWithStatusCode(_0x4a6075,_0x5c7977){_0x5c7977=_0x5c7977||0xcc;return function(_0x487121){if(_0x487121){return _0x4a6075[_0xd2a4('0x10')](_0x5c7977);}return _0x4a6075[_0xd2a4('0x11')](_0x5c7977)['end']();};}function respondWithResult(_0x1dce8c,_0x1b3701){_0x1b3701=_0x1b3701||0xc8;return function(_0x1c4c9d){if(_0x1c4c9d){return _0x1dce8c[_0xd2a4('0x11')](_0x1b3701)[_0xd2a4('0x12')](_0x1c4c9d);}};}function respondWithFilteredResult(_0x352a11,_0xd9ec4a){return function(_0x5b7699){if(_0x5b7699){var _0x174ed7=typeof _0xd9ec4a['offset']===_0xd2a4('0x13')&&typeof _0xd9ec4a['limit']===_0xd2a4('0x13');var _0xea2364=_0x5b7699['count'];var _0x3668dc=_0x174ed7?0x0:_0xd9ec4a[_0xd2a4('0x14')];var _0x436dc5=_0x174ed7?_0x5b7699['count']:_0xd9ec4a[_0xd2a4('0x14')]+_0xd9ec4a[_0xd2a4('0x15')];var _0xbf4444;if(_0x436dc5>=_0xea2364){_0x436dc5=_0xea2364;_0xbf4444=0xc8;}else{_0xbf4444=0xce;}_0x352a11[_0xd2a4('0x11')](_0xbf4444);return _0x352a11[_0xd2a4('0x16')](_0xd2a4('0x17'),_0x3668dc+'-'+_0x436dc5+'/'+_0xea2364)[_0xd2a4('0x12')](_0x5b7699);}return null;};}function saveUpdates(_0x43d920){return function(_0xd5213a){if(_0xd5213a){return _0xd5213a[_0xd2a4('0x18')](_0x43d920)[_0xd2a4('0x19')](function(_0xf62195){return _0xf62195;});}return null;};}function removeEntity(_0x103e00){return function(_0x5aa638){if(_0x5aa638){return _0x5aa638['destroy']()['then'](function(){_0x103e00['status'](0xcc)[_0xd2a4('0x1a')]();});}};}function handleEntityNotFound(_0x1fe790){return function(_0x5a5c92){if(!_0x5a5c92){_0x1fe790['sendStatus'](0x194);}return _0x5a5c92;};}function handleError(_0x1a948a,_0x4dd26d){_0x4dd26d=_0x4dd26d||0x1f4;return function(_0x66c315){logger['error'](_0x66c315[_0xd2a4('0x1b')]);if(_0x66c315[_0xd2a4('0x1c')]){delete _0x66c315[_0xd2a4('0x1c')];}_0x1a948a[_0xd2a4('0x11')](_0x4dd26d)[_0xd2a4('0x1d')](_0x66c315);};}exports[_0xd2a4('0x1e')]=function(_0x3ef6d5,_0x5e3d5d){var _0x34b076={};var _0x171dd1=_[_0xd2a4('0x1f')](db['FaxInteraction'][_0xd2a4('0x20')],function(_0x100418){return{'name':_0x100418['fieldName'],'type':_0x100418['type'][_0xd2a4('0x21')]};});_0x34b076=qs[_0xd2a4('0x22')](_0x171dd1,_0x3ef6d5);return interaction[_0xd2a4('0x23')](_0xd2a4('0x24'),_0x3ef6d5[_0xd2a4('0x25')],_0x3ef6d5[_0xd2a4('0x26')],_0x34b076,_0x171dd1)[_0xd2a4('0x19')](respondWithFilteredResult(_0x5e3d5d,_0x34b076))['catch'](handleError(_0x5e3d5d,null));};exports[_0xd2a4('0x27')]=function(_0x47526c,_0x560da3){var _0x22c3d2={'raw':![],'where':{'id':_0x47526c[_0xd2a4('0x28')]['id']}},_0x5b9b28={};_0x5b9b28[_0xd2a4('0x29')]=_['keys'](db[_0xd2a4('0x2a')][_0xd2a4('0x20')]);_0x5b9b28[_0xd2a4('0x25')]=_['keys'](_0x47526c['query']);_0x5b9b28[_0xd2a4('0x2b')]=_[_0xd2a4('0x2c')](_0x5b9b28['model'],_0x5b9b28[_0xd2a4('0x25')]);_0x22c3d2['attributes']=_[_0xd2a4('0x2c')](_0x5b9b28['model'],qs[_0xd2a4('0x2d')](_0x47526c[_0xd2a4('0x25')][_0xd2a4('0x2d')]));_0x22c3d2[_0xd2a4('0x2e')]=_0x22c3d2[_0xd2a4('0x2e')][_0xd2a4('0x2f')]?_0x22c3d2[_0xd2a4('0x2e')]:_0x5b9b28[_0xd2a4('0x29')];if(_0x47526c[_0xd2a4('0x25')]['includeAll']){_0x22c3d2[_0xd2a4('0x30')]=[{'all':!![]}];}_0x22c3d2=_['merge']({},_0x22c3d2,_0x47526c[_0xd2a4('0x31')]);return db[_0xd2a4('0x2a')][_0xd2a4('0x32')](_0x22c3d2)['then'](handleEntityNotFound(_0x560da3,null))['then'](respondWithResult(_0x560da3,null))[_0xd2a4('0x33')](handleError(_0x560da3,null));};exports[_0xd2a4('0x34')]=function(_0x287057,_0x1b887b){return db['FaxInteraction'][_0xd2a4('0x34')](_0x287057['body'],{})['then'](respondWithResult(_0x1b887b,0xc9))[_0xd2a4('0x33')](handleError(_0x1b887b,null));};exports[_0xd2a4('0x18')]=function(_0x4a5c7f,_0x1ecd6e){if(_0x4a5c7f['body']['id']){delete _0x4a5c7f[_0xd2a4('0x35')]['id'];}return db['FaxInteraction'][_0xd2a4('0x32')]({'where':{'id':_0x4a5c7f[_0xd2a4('0x28')]['id']}})[_0xd2a4('0x19')](handleEntityNotFound(_0x1ecd6e,null))[_0xd2a4('0x19')](saveUpdates(_0x4a5c7f['body'],null))['then'](respondWithResult(_0x1ecd6e,null))[_0xd2a4('0x33')](handleError(_0x1ecd6e,null));};exports[_0xd2a4('0x36')]=function(_0x25bf84,_0x345b2f){return db['FaxInteraction']['find']({'where':{'id':_0x25bf84[_0xd2a4('0x28')]['id']}})[_0xd2a4('0x19')](handleEntityNotFound(_0x345b2f,null))[_0xd2a4('0x19')](removeEntity(_0x345b2f,null))[_0xd2a4('0x33')](handleError(_0x345b2f,null));};exports['describe']=function(_0x400eff,_0x550d59){return db[_0xd2a4('0x2a')][_0xd2a4('0x37')]()['then'](respondWithResult(_0x550d59,null))[_0xd2a4('0x33')](handleError(_0x550d59,null));};exports[_0xd2a4('0x38')]=function(_0x384581,_0x32a1a4){return db['FaxMessage'][_0xd2a4('0x32')]({'where':{'id':_0x384581['params']['id']}})[_0xd2a4('0x19')](handleEntityNotFound(_0x32a1a4,null))[_0xd2a4('0x19')](function(_0x4174b9){if(_0x4174b9){return _0x4174b9[_0xd2a4('0x38')](_0x384581[_0xd2a4('0x35')][_0xd2a4('0x39')],_[_0xd2a4('0x3a')](_0x384581[_0xd2a4('0x35')],[_0xd2a4('0x39'),'id'])||{});}})[_0xd2a4('0x19')](respondWithResult(_0x32a1a4,null))[_0xd2a4('0x33')](handleError(_0x32a1a4,null));};exports['getMessages']=function(_0x579b59,_0x446b41){var _0x49bb2d={'raw':![],'where':{}};var _0x2bcc2f={};var _0x3cb04c={'count':0x0,'rows':[]};return db[_0xd2a4('0x2a')][_0xd2a4('0x3b')]({'where':{'id':_0x579b59[_0xd2a4('0x28')]['id']}})[_0xd2a4('0x19')](handleEntityNotFound(_0x446b41,null))['then'](function(_0x2eed30){if(_0x2eed30){_0x2bcc2f[_0xd2a4('0x29')]=_[_0xd2a4('0x3c')](db['FaxMessage'][_0xd2a4('0x20')]);_0x2bcc2f[_0xd2a4('0x25')]=_['keys'](_0x579b59[_0xd2a4('0x25')]);_0x2bcc2f[_0xd2a4('0x2b')]=_[_0xd2a4('0x2c')](_0x2bcc2f[_0xd2a4('0x29')],_0x2bcc2f[_0xd2a4('0x25')]);_0x49bb2d[_0xd2a4('0x2e')]=_[_0xd2a4('0x2c')](_0x2bcc2f[_0xd2a4('0x29')],qs[_0xd2a4('0x2d')](_0x579b59['query'][_0xd2a4('0x2d')]));_0x49bb2d[_0xd2a4('0x2e')]=_0x49bb2d['attributes'][_0xd2a4('0x2f')]?_0x49bb2d[_0xd2a4('0x2e')]:_0x2bcc2f[_0xd2a4('0x29')];if(!_0x579b59[_0xd2a4('0x25')]['hasOwnProperty']('nolimit')){_0x49bb2d[_0xd2a4('0x15')]=qs[_0xd2a4('0x15')](_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x15')]);_0x49bb2d['offset']=qs[_0xd2a4('0x14')](_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x14')]);}_0x49bb2d['order']=qs[_0xd2a4('0x3d')](_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x3d')]);_0x49bb2d[_0xd2a4('0x3e')]=qs[_0xd2a4('0x2b')](_[_0xd2a4('0x3f')](_0x579b59[_0xd2a4('0x25')],_0x2bcc2f[_0xd2a4('0x2b')]));_0x49bb2d[_0xd2a4('0x3e')][_0xd2a4('0x40')]=_0x2eed30['id'];if(_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x41')]){_0x49bb2d[_0xd2a4('0x3e')]=_[_0xd2a4('0x42')](_0x49bb2d['where'],{'$or':_['map'](_0x49bb2d[_0xd2a4('0x2e')],function(_0x1ed9c8){var _0x4fb79={};_0x4fb79[_0x1ed9c8]={'$like':'%'+_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x41')]+'%'};return _0x4fb79;})});}if(_0x579b59[_0xd2a4('0x25')]['$gte']){var _0x3ce7c1=_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x43')]['split'](',');var _0x3b3e01={};_0x3b3e01[_0x3ce7c1[0x0]]={'$gte':moment(_0x3ce7c1[0x1])['format'](_0xd2a4('0x44'))};_0x49bb2d[_0xd2a4('0x3e')]=_['merge'](_0x49bb2d[_0xd2a4('0x3e')],_0x3b3e01);}_0x49bb2d=_['merge']({},_0x49bb2d,_0x579b59[_0xd2a4('0x31')]);return db[_0xd2a4('0x45')][_0xd2a4('0x46')]({'where':_0x49bb2d[_0xd2a4('0x3e')]})[_0xd2a4('0x19')](function(_0x485a58){_0x3cb04c['count']=_0x485a58;if(_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x47')]){_0x49bb2d[_0xd2a4('0x30')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x49bb2d);})[_0xd2a4('0x19')](function(_0x27119d){_0x3cb04c['rows']=_0x27119d;return _0x3cb04c;});}})['then'](respondWithFilteredResult(_0x446b41,_0x49bb2d))['catch'](handleError(_0x446b41,null));};exports[_0xd2a4('0x48')]=function(_0x544e79,_0x1a0dca){return db[_0xd2a4('0x2a')][_0xd2a4('0x32')]({'where':{'id':_0x544e79[_0xd2a4('0x28')]['id']}})['then'](handleEntityNotFound(_0x1a0dca,null))[_0xd2a4('0x19')](function(_0x4125a3){if(_0x4125a3){return _0x4125a3[_0xd2a4('0x49')](_0x544e79[_0xd2a4('0x35')][_0xd2a4('0x39')],_[_0xd2a4('0x3a')](_0x544e79[_0xd2a4('0x35')],[_0xd2a4('0x39'),'id'])||{})[_0xd2a4('0x4a')](function(){return db[_0xd2a4('0x4b')]['findAll']({'attributes':['id',_0xd2a4('0x1c'),'color'],'where':{'id':_0x544e79[_0xd2a4('0x35')][_0xd2a4('0x39')]}});})[_0xd2a4('0x19')](function(_0x141311){socket[_0xd2a4('0x4c')](_0xd2a4('0x4d'),{'id':Number(_0x544e79[_0xd2a4('0x28')]['id']),'tags':_0x141311||[]});return{'id':Number(_0x544e79[_0xd2a4('0x28')]['id']),'tags':_0x141311||[]};});}})[_0xd2a4('0x19')](respondWithResult(_0x1a0dca,null))[_0xd2a4('0x33')](handleError(_0x1a0dca,null));};exports[_0xd2a4('0x4e')]=function(_0x5911a8,_0x5879e3){return db[_0xd2a4('0x2a')][_0xd2a4('0x32')]({'where':{'id':_0x5911a8[_0xd2a4('0x28')]['id']}})[_0xd2a4('0x19')](handleEntityNotFound(_0x5879e3,null))[_0xd2a4('0x19')](function(_0x24c2c8){if(_0x24c2c8){return _0x24c2c8[_0xd2a4('0x4e')](_0x5911a8['query'][_0xd2a4('0x39')]);}})[_0xd2a4('0x19')](respondWithStatusCode(_0x5879e3,null))['catch'](handleError(_0x5879e3,null));};exports[_0xd2a4('0x4f')]=function(_0x2c83b5,_0xd1a430){var _0x1b60f1=moment()[_0xd2a4('0x50')]()[_0xd2a4('0x51')]();var _0x38620b=path[_0xd2a4('0x52')](config[_0xd2a4('0x53')],_0xd2a4('0x54'),_0xd2a4('0x55'),_0xd2a4('0x56'));var _0x2c48c5=path[_0xd2a4('0x52')](config[_0xd2a4('0x53')],_0xd2a4('0x54'),_0xd2a4('0x55'),_0xd2a4('0x57'));var _0x1d9689=path[_0xd2a4('0x52')](_0x38620b,_0x1b60f1);var _0x5f4df3=util[_0xd2a4('0x58')](_0xd2a4('0x59'),_0x2c83b5[_0xd2a4('0x28')]['id'],_0x1b60f1);var _0x18430d=path[_0xd2a4('0x52')](_0x38620b,_0x5f4df3);var _0x567b8f=[];_0x567b8f['push']({'model':db[_0xd2a4('0x5a')],'as':_0xd2a4('0x5a'),'raw':!![]});var _0x25f6c9=[{'model':db[_0xd2a4('0x45')],'as':_0xd2a4('0x5b'),'attributes':['id',_0xd2a4('0x35'),_0xd2a4('0x5c')],'include':_0x567b8f}];return db[_0xd2a4('0x2a')]['find']({'where':{'id':_0x2c83b5[_0xd2a4('0x28')]['id']},'include':_0x25f6c9})[_0xd2a4('0x19')](handleEntityNotFound(_0xd1a430,null))[_0xd2a4('0x19')](function(_0x1876aa){if(_0x1876aa&&_0x1876aa[_0xd2a4('0x5b')]){var _0x3ad538=_0x1876aa[_0xd2a4('0x5d')]({'plain':!![]});fs[_0xd2a4('0x5e')](_0x1d9689);for(var _0x2ab582=0x0;_0x2ab582<_0x3ad538[_0xd2a4('0x5b')]['length'];_0x2ab582++){var _0x597dc8=_0x3ad538[_0xd2a4('0x5b')][_0x2ab582][_0xd2a4('0x5a')];if(_0x597dc8){var _0xa1efa7=path[_0xd2a4('0x52')](_0x2c48c5,_0x597dc8[_0xd2a4('0x5f')]);if(fs[_0xd2a4('0x60')](_0xa1efa7)){fs[_0xd2a4('0x61')](_0xa1efa7)['pipe'](fs['createWriteStream'](path[_0xd2a4('0x52')](_0x1d9689,_0x597dc8[_0xd2a4('0x5f')])));}}}return BPromise[_0xd2a4('0x62')]()['then'](function(){return new BPromise(function(_0x4abc6f,_0x39b6c2){zipdir(_0x1d9689,{'saveTo':_0x18430d},function(_0x43123c,_0x228b8f){if(_0x43123c)return _0x39b6c2(_0x43123c);return _0x4abc6f(_0x228b8f);});})['then'](function(){return new BPromise(function(_0xb506f1,_0x4e6885){rimraf(_0x1d9689,function(_0x86b3fb){if(_0x86b3fb)_0x4e6885(_0x86b3fb);return _0xb506f1();});});})[_0xd2a4('0x19')](function(){return _0xd1a430[_0xd2a4('0x4f')](_0x18430d,_0x5f4df3,function(_0x3f7566){if(_0x3f7566){console[_0xd2a4('0x63')](_0xd2a4('0x64'),_0x3f7566);}else{fs['unlinkSync'](_0x18430d);}});});});}else{return _0xd1a430[_0xd2a4('0x10')](0xc8);}})[_0xd2a4('0x33')](handleError(_0xd1a430,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6ec3345..04be48f 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 _0x8f5f=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','save','update','getUsers','then','setDataValue','map','findAll'];(function(_0x259264,_0xfe2f1f){var _0x333ff4=function(_0x366e5c){while(--_0x366e5c){_0x259264['push'](_0x259264['shift']());}};_0x333ff4(++_0xfe2f1f);}(_0x8f5f,0xf6));var _0xf8f5=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0x8f5f[_0x26e727];return _0x563800;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xf8f5('0x0'))['db'][_0xf8f5('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0xf8f5('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8f5('0x3'),'afterUpdate':_0xf8f5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3140e5){return function(_0x2b0469,_0x3e19e5,_0x518c62){_0x2b0469[_0xf8f5('0x5')]({'attributes':['id'],'raw':!![]})[_0xf8f5('0x6')](function(_0x36d021){_0x2b0469[_0xf8f5('0x7')]('Users',_0x36d021[_0xf8f5('0x8')](function(_0x20a47e){return{'id':_0x20a47e['id']};}));return FaxMessage[_0xf8f5('0x9')]({'where':{'FaxInteractionId':_0x2b0469['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf8f5('0x6')](function(_0x57c59b){_0x2b0469['setDataValue'](_0xf8f5('0xa'),_0x57c59b['length']);FaxInteractionEvents[_0xf8f5('0xb')](_0x3140e5+':'+_0x2b0469['id'],_0x2b0469);FaxInteractionEvents[_0xf8f5('0xb')](_0x3140e5,_0x2b0469);_0x518c62(null);})[_0xf8f5('0xc')](_0x518c62(null));};}for(var e in events){if(events[_0xf8f5('0xd')](e)){var event=events[e];FaxInteraction[_0xf8f5('0xe')](e,emitEvent(event));}}module[_0xf8f5('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0xf22d=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0xf22d,0x6a));var _0xdf22=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xf22d[_0x1bb58c];return _0x277586;};'use strict';var EventEmitter=require(_0xdf22('0x0'));var FaxInteraction=require(_0xdf22('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0xdf22('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdf22('0x3'),'afterUpdate':_0xdf22('0x4'),'afterDestroy':_0xdf22('0x5')};function emitEvent(_0x3bf82d){return function(_0x99e43b,_0x73734e,_0x2caa2c){_0x99e43b[_0xdf22('0x6')]({'attributes':['id'],'raw':!![]})[_0xdf22('0x7')](function(_0x2f161b){_0x99e43b['setDataValue'](_0xdf22('0x8'),_0x2f161b['map'](function(_0x16616c){return{'id':_0x16616c['id']};}));return FaxMessage[_0xdf22('0x9')]({'where':{'FaxInteractionId':_0x99e43b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdf22('0x7')](function(_0x352f0e){_0x99e43b[_0xdf22('0xa')]('unreadMessages',_0x352f0e[_0xdf22('0xb')]);FaxInteractionEvents[_0xdf22('0xc')](_0x3bf82d+':'+_0x99e43b['id'],_0x99e43b);FaxInteractionEvents[_0xdf22('0xc')](_0x3bf82d,_0x99e43b);_0x2caa2c(null);})[_0xdf22('0xd')](_0x2caa2c(null));};}for(var e in events){if(events[_0xdf22('0xe')](e)){var event=events[e];FaxInteraction[_0xdf22('0xf')](e,emitEvent(event));}}module[_0xdf22('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 a57c3dd..499e546 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 _0xafce=['bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xafce,0x9e));var _0xeafc=function(_0x1d982d,_0xfb3a79){_0x1d982d=_0x1d982d-0x0;var _0x2d24ba=_0xafce[_0x1d982d];return _0x2d24ba;};'use strict';var _=require(_0xeafc('0x0'));var util=require(_0xeafc('0x1'));var logger=require('../../config/logger')(_0xeafc('0x2'));var moment=require(_0xeafc('0x3'));var BPromise=require(_0xeafc('0x4'));var rp=require(_0xeafc('0x5'));var fs=require('fs');var path=require(_0xeafc('0x6'));var rimraf=require(_0xeafc('0x7'));var config=require('../../config/environment');var attributes=require(_0xeafc('0x8'));module[_0xeafc('0x9')]=function(_0x1caf2d,_0x2e719c){return _0x1caf2d[_0xeafc('0xa')](_0xeafc('0xb'),attributes,{'tableName':_0xeafc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x556820,_0x5b61a3,_0x37dab7){if(_0x556820[_0xeafc('0xd')](_0xeafc('0xe'))){_0x556820[_0xeafc('0xf')]=moment()[_0xeafc('0x10')](_0xeafc('0x11'));}_0x37dab7(null,_0x556820);}}});}; \ No newline at end of file +var _0x77b4=['util','../../config/logger','moment','request-promise','rimraf','./faxInteraction.attributes','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4a4ba9,_0x206a61){var _0x54ab7d=function(_0x537716){while(--_0x537716){_0x4a4ba9['push'](_0x4a4ba9['shift']());}};_0x54ab7d(++_0x206a61);}(_0x77b4,0x1e0));var _0x477b=function(_0x6b83b1,_0x4b3392){_0x6b83b1=_0x6b83b1-0x0;var _0x30cb37=_0x77b4[_0x6b83b1];return _0x30cb37;};'use strict';var _=require('lodash');var util=require(_0x477b('0x0'));var logger=require(_0x477b('0x1'))('api');var moment=require(_0x477b('0x2'));var BPromise=require('bluebird');var rp=require(_0x477b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x477b('0x4'));var config=require('../../config/environment');var attributes=require(_0x477b('0x5'));module['exports']=function(_0x3d6bac,_0x43bfe0){return _0x3d6bac['define']('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11d884,_0x20b147,_0x451069){if(_0x11d884[_0x477b('0x6')]('closed')){_0x11d884[_0x477b('0x7')]=moment()[_0x477b('0x8')](_0x477b('0x9'));}_0x451069(null,_0x11d884);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 0fbca2e..f1b5498 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 _0xd151=['debug','request\x20sent','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','attributes','then','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','socket.io-emitter','redis','./faxInteraction.socket','request','info','FaxInteraction,\x20%s,\x20%s'];(function(_0x3254c1,_0x508259){var _0x1ca919=function(_0x4221aa){while(--_0x4221aa){_0x3254c1['push'](_0x3254c1['shift']());}};_0x1ca919(++_0x508259);}(_0xd151,0x8e));var _0x1d15=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0xd151[_0x413aac];return _0x569b11;};'use strict';var _=require(_0x1d15('0x0'));var util=require(_0x1d15('0x1'));var moment=require(_0x1d15('0x2'));var BPromise=require(_0x1d15('0x3'));var rs=require(_0x1d15('0x4'));var fs=require('fs');var Redis=require(_0x1d15('0x5'));var db=require(_0x1d15('0x6'))['db'];var utils=require(_0x1d15('0x7'));var logger=require(_0x1d15('0x8'))(_0x1d15('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1d15('0xa')]['http']({'port':0x232a});config['redis']=_[_0x1d15('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1d15('0xc'))(new Redis(config[_0x1d15('0xd')]));require(_0x1d15('0xe'))['register'](socket);function respondWithRpcPromise(_0x202cf8,_0x28f198,_0x5e41a5){return new BPromise(function(_0x3f9434,_0x438aa3){return client[_0x1d15('0xf')](_0x202cf8,_0x5e41a5)['then'](function(_0x157f30){logger[_0x1d15('0x10')](_0x1d15('0x11'),_0x28f198,'request\x20sent');logger[_0x1d15('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x28f198,_0x1d15('0x13'),JSON['stringify'](_0x157f30));if(_0x157f30[_0x1d15('0x14')]){if(_0x157f30['error'][_0x1d15('0x15')]===0x1f4){logger[_0x1d15('0x14')](_0x1d15('0x11'),_0x28f198,_0x157f30['error']['message']);return _0x438aa3(_0x157f30[_0x1d15('0x14')][_0x1d15('0x16')]);}logger[_0x1d15('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x28f198,_0x157f30['error'][_0x1d15('0x16')]);return _0x3f9434(_0x157f30['error'][_0x1d15('0x16')]);}else{logger[_0x1d15('0x10')](_0x1d15('0x11'),_0x28f198,_0x1d15('0x13'));_0x3f9434(_0x157f30[_0x1d15('0x17')][_0x1d15('0x16')]);}})[_0x1d15('0x18')](function(_0xdd3cff){logger[_0x1d15('0x14')](_0x1d15('0x11'),_0x28f198,_0xdd3cff);_0x438aa3(_0xdd3cff);});});}exports[_0x1d15('0x19')]=function(_0x27a460){var _0x49319c=this;return new Promise(function(_0x21dced,_0x57dae3){return db[_0x1d15('0x1a')]['update'](_0x27a460[_0x1d15('0x1b')],{'raw':_0x27a460[_0x1d15('0x1c')]?_0x27a460[_0x1d15('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27a460[_0x1d15('0x1c')]?_0x27a460['options'][_0x1d15('0x1d')]||null:null,'attributes':_0x27a460[_0x1d15('0x1c')]?_0x27a460[_0x1d15('0x1c')][_0x1d15('0x1e')]||null:null,'limit':_0x27a460['options']?_0x27a460['options']['limit']||null:null})[_0x1d15('0x1f')](function(_0x5bce54){logger[_0x1d15('0x10')](_0x1d15('0x19'),_0x27a460);logger[_0x1d15('0x12')](_0x1d15('0x19'),_0x27a460,JSON[_0x1d15('0x20')](_0x5bce54));_0x21dced(_0x5bce54);})[_0x1d15('0x18')](function(_0x5203b0){logger[_0x1d15('0x14')]('UpdateFaxInteraction',_0x5203b0[_0x1d15('0x16')],_0x27a460);_0x57dae3(_0x49319c['error'](0x1f4,_0x5203b0['message']));});});};exports[_0x1d15('0x21')]=function(_0x2ee9ba){return new Promise(function(_0x3fb47f,_0x2946c1){return db['FaxInteraction'][_0x1d15('0x22')]({'where':_0x2ee9ba[_0x1d15('0x1c')]?_0x2ee9ba[_0x1d15('0x1c')][_0x1d15('0x1d')]||null:null})[_0x1d15('0x1f')](function(_0x31df0a){if(_0x31df0a){return _0x31df0a[_0x1d15('0x23')](_0x2ee9ba['body'][_0x1d15('0x24')],_[_0x1d15('0x25')](_0x2ee9ba[_0x1d15('0x1b')],[_0x1d15('0x24'),'id'])||{});}})[_0x1d15('0x26')](function(_0x214b1e){logger[_0x1d15('0x10')]('AddTags',_0x2ee9ba);logger[_0x1d15('0x12')](_0x1d15('0x27'),_0x2ee9ba,JSON['stringify'](_0x214b1e));_0x3fb47f(_0x214b1e);})[_0x1d15('0x18')](function(_0x17fe21){logger['error']('AddTags',_0x17fe21['message'],_0x2ee9ba);_0x2946c1(_this['error'](0x1f4,_0x17fe21[_0x1d15('0x16')]));});});}; \ No newline at end of file +var _0xadb3=['client','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','UpdateFaxInteraction','update','options','raw','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x433818,_0x287818){var _0x3f3358=function(_0x468f9e){while(--_0x468f9e){_0x433818['push'](_0x433818['shift']());}};_0x3f3358(++_0x287818);}(_0xadb3,0x1f1));var _0x3adb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xadb3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x3adb('0x0'));var util=require('util');var moment=require(_0x3adb('0x1'));var BPromise=require(_0x3adb('0x2'));var rs=require(_0x3adb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3adb('0x4'))['db'];var utils=require(_0x3adb('0x5'));var logger=require(_0x3adb('0x6'))(_0x3adb('0x7'));var config=require(_0x3adb('0x8'));var jayson=require(_0x3adb('0x9'));var client=jayson[_0x3adb('0xa')]['http']({'port':0x232a});config[_0x3adb('0xb')]=_['defaults'](config['redis'],{'host':_0x3adb('0xc'),'port':0x18eb});var socket=require(_0x3adb('0xd'))(new Redis(config[_0x3adb('0xb')]));require(_0x3adb('0xe'))[_0x3adb('0xf')](socket);function respondWithRpcPromise(_0x4681e7,_0x1bc59d,_0x1e330f){return new BPromise(function(_0x260da6,_0xe4f48b){return client['request'](_0x4681e7,_0x1e330f)[_0x3adb('0x10')](function(_0x3120c2){logger[_0x3adb('0x11')](_0x3adb('0x12'),_0x1bc59d,'request\x20sent');logger[_0x3adb('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1bc59d,_0x3adb('0x14'),JSON[_0x3adb('0x15')](_0x3120c2));if(_0x3120c2[_0x3adb('0x16')]){if(_0x3120c2[_0x3adb('0x16')][_0x3adb('0x17')]===0x1f4){logger[_0x3adb('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x1bc59d,_0x3120c2[_0x3adb('0x16')][_0x3adb('0x18')]);return _0xe4f48b(_0x3120c2[_0x3adb('0x16')][_0x3adb('0x18')]);}logger[_0x3adb('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x1bc59d,_0x3120c2['error'][_0x3adb('0x18')]);return _0x260da6(_0x3120c2[_0x3adb('0x16')][_0x3adb('0x18')]);}else{logger[_0x3adb('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x1bc59d,_0x3adb('0x14'));_0x260da6(_0x3120c2['result'][_0x3adb('0x18')]);}})['catch'](function(_0x10ec07){logger[_0x3adb('0x16')](_0x3adb('0x12'),_0x1bc59d,_0x10ec07);_0xe4f48b(_0x10ec07);});});}exports[_0x3adb('0x19')]=function(_0x3f817a){var _0x1ee45e=this;return new Promise(function(_0x169f00,_0x4c9d32){return db['FaxInteraction'][_0x3adb('0x1a')](_0x3f817a['body'],{'raw':_0x3f817a[_0x3adb('0x1b')]?_0x3f817a['options'][_0x3adb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f817a[_0x3adb('0x1b')]?_0x3f817a[_0x3adb('0x1b')]['where']||null:null,'attributes':_0x3f817a[_0x3adb('0x1b')]?_0x3f817a[_0x3adb('0x1b')]['attributes']||null:null,'limit':_0x3f817a[_0x3adb('0x1b')]?_0x3f817a[_0x3adb('0x1b')]['limit']||null:null})['then'](function(_0x6dc69a){logger[_0x3adb('0x11')](_0x3adb('0x19'),_0x3f817a);logger[_0x3adb('0x13')](_0x3adb('0x19'),_0x3f817a,JSON[_0x3adb('0x15')](_0x6dc69a));_0x169f00(_0x6dc69a);})[_0x3adb('0x1d')](function(_0x41fd96){logger[_0x3adb('0x16')](_0x3adb('0x19'),_0x41fd96[_0x3adb('0x18')],_0x3f817a);_0x4c9d32(_0x1ee45e[_0x3adb('0x16')](0x1f4,_0x41fd96[_0x3adb('0x18')]));});});};exports[_0x3adb('0x1e')]=function(_0x3abaf4){return new Promise(function(_0x4dba15,_0x4e5c4b){return db[_0x3adb('0x1f')][_0x3adb('0x20')]({'where':_0x3abaf4[_0x3adb('0x1b')]?_0x3abaf4['options']['where']||null:null})[_0x3adb('0x10')](function(_0x5f271a){if(_0x5f271a){return _0x5f271a[_0x3adb('0x21')](_0x3abaf4[_0x3adb('0x22')][_0x3adb('0x23')],_[_0x3adb('0x24')](_0x3abaf4['body'],[_0x3adb('0x23'),'id'])||{});}})[_0x3adb('0x25')](function(_0x3b1c91){logger[_0x3adb('0x11')]('AddTags',_0x3abaf4);logger[_0x3adb('0x13')](_0x3adb('0x26'),_0x3abaf4,JSON[_0x3adb('0x15')](_0x3b1c91));_0x4dba15(_0x3b1c91);})['catch'](function(_0x3a6e64){logger[_0x3adb('0x16')](_0x3adb('0x26'),_0x3a6e64[_0x3adb('0x18')],_0x3abaf4);_0x4e5c4b(_this[_0x3adb('0x16')](0x1f4,_0x3a6e64[_0x3adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 3402d60..dc14c03 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 _0xc21f=['update','emit','removeListener','length','faxInteraction:','./faxInteraction.events','remove'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xc21f,0x1cc));var _0xfc21=function(_0x3ee94e,_0x163707){_0x3ee94e=_0x3ee94e-0x0;var _0x88cd6f=_0xc21f[_0x3ee94e];return _0x88cd6f;};'use strict';var FaxInteractionEvents=require(_0xfc21('0x0'));var events=['save',_0xfc21('0x1'),_0xfc21('0x2')];function createListener(_0x561403,_0x364ead){return function(_0x1bf524){_0x364ead[_0xfc21('0x3')](_0x561403,_0x1bf524);};}function removeListener(_0x3b7ed7,_0x5d2a21){return function(){FaxInteractionEvents[_0xfc21('0x4')](_0x3b7ed7,_0x5d2a21);};}exports['register']=function(_0x245b88){for(var _0x554900=0x0,_0x1d68a4=events[_0xfc21('0x5')];_0x554900<_0x1d68a4;_0x554900++){var _0xb5584c=events[_0x554900];var _0x4f9250=createListener(_0xfc21('0x6')+_0xb5584c,_0x245b88);FaxInteractionEvents['on'](_0xb5584c,_0x4f9250);}}; \ No newline at end of file +var _0x64f0=['./faxInteraction.events','save','update','emit','register'];(function(_0x95e0a,_0x2b689d){var _0x485c54=function(_0x5f08f9){while(--_0x5f08f9){_0x95e0a['push'](_0x95e0a['shift']());}};_0x485c54(++_0x2b689d);}(_0x64f0,0x159));var _0x064f=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x64f0[_0x4b7b69];return _0x173b4c;};'use strict';var FaxInteractionEvents=require(_0x064f('0x0'));var events=[_0x064f('0x1'),'remove',_0x064f('0x2')];function createListener(_0x2273ef,_0x2a9e9f){return function(_0x44a4a6){_0x2a9e9f[_0x064f('0x3')](_0x2273ef,_0x44a4a6);};}function removeListener(_0x1dd665,_0x17ef4d){return function(){FaxInteractionEvents['removeListener'](_0x1dd665,_0x17ef4d);};}exports[_0x064f('0x4')]=function(_0x5aae81){for(var _0x3d8c86=0x0,_0x2eedf8=events['length'];_0x3d8c86<_0x2eedf8;_0x3d8c86++){var _0xe71d12=events[_0x3d8c86];var _0x3e35e6=createListener('faxInteraction:'+_0xe71d12,_0x5aae81);FaxInteractionEvents['on'](_0xe71d12,_0x3e35e6);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2f461c1..490e96b 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 _0xead8=['/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','/:id','faxinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xead8,0x8f));var _0x8ead=function(_0x2a0dc9,_0x3802f4){_0x2a0dc9=_0x2a0dc9-0x0;var _0x198be1=_0xead8[_0x2a0dc9];return _0x198be1;};'use strict';var multer=require('multer');var util=require(_0x8ead('0x0'));var path=require('path');var timeout=require(_0x8ead('0x1'));var express=require(_0x8ead('0x2'));var router=express['Router']();var fs_extra=require(_0x8ead('0x3'));var auth=require(_0x8ead('0x4'));var interaction=require(_0x8ead('0x5'));var config=require(_0x8ead('0x6'));var controller=require(_0x8ead('0x7'));router[_0x8ead('0x8')]('/',auth[_0x8ead('0x9')](),controller[_0x8ead('0xa')]);router[_0x8ead('0x8')](_0x8ead('0xb'),auth[_0x8ead('0x9')](),controller['describe']);router['get']('/:id',auth[_0x8ead('0x9')](),controller['show']);router[_0x8ead('0x8')](_0x8ead('0xc'),auth['isAuthenticated'](),controller[_0x8ead('0xd')]);router[_0x8ead('0x8')](_0x8ead('0xe'),auth['isAuthenticated'](),controller[_0x8ead('0xf')]);router[_0x8ead('0x10')]('/',auth[_0x8ead('0x9')](),controller[_0x8ead('0x11')]);router['post']('/:id/messages',auth[_0x8ead('0x9')](),controller['addMessage']);router[_0x8ead('0x10')](_0x8ead('0x12'),auth[_0x8ead('0x9')](),interaction[_0x8ead('0x13')](_0x8ead('0x14'),_0x8ead('0x15')),controller[_0x8ead('0x16')]);router[_0x8ead('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0x8ead('0x13')](_0x8ead('0x14'),_0x8ead('0x18')),controller['update']);router[_0x8ead('0x19')](_0x8ead('0x1a'),auth['isAuthenticated'](),interaction[_0x8ead('0x13')](_0x8ead('0x14'),_0x8ead('0x1b')),controller[_0x8ead('0x1c')]);router[_0x8ead('0x19')](_0x8ead('0x12'),auth['isAuthenticated'](),controller[_0x8ead('0x1d')]);module[_0x8ead('0x1e')]=router; \ No newline at end of file +var _0xfaa9=['get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','put','fax','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0x54a4e4,_0x4788ec){var _0x4c38bb=function(_0x16d739){while(--_0x16d739){_0x54a4e4['push'](_0x54a4e4['shift']());}};_0x4c38bb(++_0x4788ec);}(_0xfaa9,0x177));var _0x9faa=function(_0x9ae1e,_0x251d11){_0x9ae1e=_0x9ae1e-0x0;var _0x5bd8f3=_0xfaa9[_0x9ae1e];return _0x5bd8f3;};'use strict';var multer=require('multer');var util=require(_0x9faa('0x0'));var path=require(_0x9faa('0x1'));var timeout=require(_0x9faa('0x2'));var express=require(_0x9faa('0x3'));var router=express['Router']();var fs_extra=require(_0x9faa('0x4'));var auth=require(_0x9faa('0x5'));var interaction=require(_0x9faa('0x6'));var config=require(_0x9faa('0x7'));var controller=require(_0x9faa('0x8'));router[_0x9faa('0x9')]('/',auth[_0x9faa('0xa')](),controller[_0x9faa('0xb')]);router[_0x9faa('0x9')]('/describe',auth[_0x9faa('0xa')](),controller[_0x9faa('0xc')]);router[_0x9faa('0x9')](_0x9faa('0xd'),auth[_0x9faa('0xa')](),controller[_0x9faa('0xe')]);router[_0x9faa('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x9faa('0xf')]);router[_0x9faa('0x9')](_0x9faa('0x10'),auth[_0x9faa('0xa')](),controller[_0x9faa('0x11')]);router[_0x9faa('0x12')]('/',auth[_0x9faa('0xa')](),controller[_0x9faa('0x13')]);router['post'](_0x9faa('0x14'),auth[_0x9faa('0xa')](),controller[_0x9faa('0x15')]);router[_0x9faa('0x12')](_0x9faa('0x16'),auth[_0x9faa('0xa')](),interaction[_0x9faa('0x17')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x9faa('0x18')](_0x9faa('0xd'),auth['isAuthenticated'](),interaction[_0x9faa('0x17')](_0x9faa('0x19'),_0x9faa('0x1a')),controller[_0x9faa('0x1b')]);router['delete'](_0x9faa('0xd'),auth[_0x9faa('0xa')](),interaction[_0x9faa('0x17')](_0x9faa('0x19'),_0x9faa('0x1c')),controller[_0x9faa('0x1d')]);router[_0x9faa('0x1e')](_0x9faa('0x16'),auth[_0x9faa('0xa')](),controller['removeTags']);module[_0x9faa('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 5bc8743..af4d6cf 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 _0xc5c7=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x2f36a9,_0x73d0bf){_0x2f36a9=_0x2f36a9-0x0;var _0x1efa62=_0xc5c7[_0x2f36a9];return _0x1efa62;};'use strict';var Sequelize=require('sequelize');module[_0x7c5c('0x0')]={'body':{'type':Sequelize[_0x7c5c('0x1')](_0x7c5c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7c5c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7c5c('0x4')]('in',_0x7c5c('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x7c5c('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7c5c('0x6')]}}; \ No newline at end of file +var _0x28a2=['exports','TEXT','medium','BOOLEAN','ENUM','out','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x228a('0x0'));module[_0x228a('0x1')]={'body':{'type':Sequelize[_0x228a('0x2')](_0x228a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x228a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x228a('0x5')]('in',_0x228a('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x228a('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b9e43a0..adc5ec4 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 _0xf196=['localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','send','index','map','FaxMessage','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','rows','catch','show','merge','options','find','params','describe','fax-interactions','fax','body','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','SELECT','User','rejectmessage','create','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x51a292,_0x59a320){var _0x3ef259=function(_0x41df70){while(--_0x41df70){_0x51a292['push'](_0x51a292['shift']());}};_0x3ef259(++_0x59a320);}(_0xf196,0x10a));var _0x6f19=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf196[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x6f19('0x0'));var rimraf=require(_0x6f19('0x1'));var zipdir=require(_0x6f19('0x2'));var jsonpatch=require(_0x6f19('0x3'));var rp=require(_0x6f19('0x4'));var moment=require(_0x6f19('0x5'));var BPromise=require(_0x6f19('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f19('0x7'));var sox=require(_0x6f19('0x8'));var csv=require(_0x6f19('0x9'));var ejs=require(_0x6f19('0xa'));var fs=require('fs');var fs_extra=require(_0x6f19('0xb'));var _=require(_0x6f19('0xc'));var squel=require(_0x6f19('0xd'));var crypto=require(_0x6f19('0xe'));var jsforce=require(_0x6f19('0xf'));var deskjs=require(_0x6f19('0x10'));var toCsv=require(_0x6f19('0x9'));var querystring=require(_0x6f19('0x11'));var Papa=require(_0x6f19('0x12'));var Redis=require(_0x6f19('0x13'));var authService=require(_0x6f19('0x14'));var qs=require(_0x6f19('0x15'));var as=require(_0x6f19('0x16'));var hardwareService=require(_0x6f19('0x17'));var logger=require(_0x6f19('0x18'))(_0x6f19('0x19'));var utils=require(_0x6f19('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f19('0x1b'))['db'];config[_0x6f19('0x1c')]=_[_0x6f19('0x1d')](config[_0x6f19('0x1c')],{'host':_0x6f19('0x1e'),'port':0x18eb});var socket=require(_0x6f19('0x1f'))(new Redis(config[_0x6f19('0x1c')]));require(_0x6f19('0x20'))[_0x6f19('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6f19('0x22')][_0x6f19('0x23')]({'port':0x232c});var client9002=jayson[_0x6f19('0x22')][_0x6f19('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x534dd5,_0x2d2539,_0x25e60f,_0x29a1d0){return new BPromise(function(_0x4a0a27,_0x4d1551){var _0x3a8be9=_0x29a1d0||client;return _0x3a8be9[_0x6f19('0x24')](_0x534dd5,_0x25e60f)['then'](function(_0x476751){logger[_0x6f19('0x25')]('FaxMessage,\x20%s,\x20%s',_0x2d2539,_0x6f19('0x26'));logger[_0x6f19('0x27')](_0x6f19('0x28'),_0x2d2539,_0x6f19('0x26'),JSON[_0x6f19('0x29')](_0x476751));if(_0x476751[_0x6f19('0x2a')]){if(_0x476751[_0x6f19('0x2a')]['code']===0x1f4){logger['error'](_0x6f19('0x2b'),_0x2d2539,_0x476751[_0x6f19('0x2a')][_0x6f19('0x2c')]);return _0x4d1551(_0x476751[_0x6f19('0x2a')][_0x6f19('0x2c')]);}logger[_0x6f19('0x2a')](_0x6f19('0x2b'),_0x2d2539,_0x476751[_0x6f19('0x2a')][_0x6f19('0x2c')]);return _0x4a0a27(_0x476751['error'][_0x6f19('0x2c')]);}else{logger[_0x6f19('0x25')](_0x6f19('0x2b'),_0x2d2539,'request\x20sent');_0x4a0a27(_0x476751[_0x6f19('0x2d')]['message']);}})['catch'](function(_0x3a5fbd){logger[_0x6f19('0x2a')](_0x6f19('0x2b'),_0x2d2539,_0x3a5fbd);_0x4d1551(_0x3a5fbd);});});}function respondWithStatusCode(_0x519e04,_0x453bec){_0x453bec=_0x453bec||0xcc;return function(_0x177cea){if(_0x177cea){return _0x519e04[_0x6f19('0x2e')](_0x453bec);}return _0x519e04[_0x6f19('0x2f')](_0x453bec)[_0x6f19('0x30')]();};}function respondWithResult(_0x564c40,_0x4a2e10){_0x4a2e10=_0x4a2e10||0xc8;return function(_0x500f37){if(_0x500f37){return _0x564c40[_0x6f19('0x2f')](_0x4a2e10)[_0x6f19('0x31')](_0x500f37);}};}function respondWithFilteredResult(_0x2a69c4,_0x499984){return function(_0x30dbfc){if(_0x30dbfc){var _0x4b3cbf=typeof _0x499984[_0x6f19('0x32')]===_0x6f19('0x33')&&typeof _0x499984[_0x6f19('0x34')]===_0x6f19('0x33');var _0x1c3977=_0x30dbfc[_0x6f19('0x35')];var _0x265133=_0x4b3cbf?0x0:_0x499984['offset'];var _0x2060f1=_0x4b3cbf?_0x30dbfc[_0x6f19('0x35')]:_0x499984[_0x6f19('0x32')]+_0x499984['limit'];var _0x21a252;if(_0x2060f1>=_0x1c3977){_0x2060f1=_0x1c3977;_0x21a252=0xc8;}else{_0x21a252=0xce;}_0x2a69c4[_0x6f19('0x2f')](_0x21a252);return _0x2a69c4[_0x6f19('0x36')](_0x6f19('0x37'),_0x265133+'-'+_0x2060f1+'/'+_0x1c3977)[_0x6f19('0x31')](_0x30dbfc);}return null;};}function patchUpdates(_0x163b0d){return function(_0x39a0b2){try{jsonpatch[_0x6f19('0x38')](_0x39a0b2,_0x163b0d,!![]);}catch(_0x1ef7ac){return BPromise['reject'](_0x1ef7ac);}return _0x39a0b2['save']();};}function saveUpdates(_0x165a97,_0x1e7087){return function(_0x2ff198){if(_0x2ff198){return _0x2ff198[_0x6f19('0x39')](_0x165a97)[_0x6f19('0x3a')](function(_0x46117b){return _0x46117b;});}return null;};}function removeEntity(_0x51e16f,_0x1eda57){return function(_0x326ab3){if(_0x326ab3){return _0x326ab3[_0x6f19('0x3b')]()[_0x6f19('0x3a')](function(){_0x51e16f[_0x6f19('0x2f')](0xcc)[_0x6f19('0x30')]();});}};}function handleEntityNotFound(_0x5e60e9,_0x2597e1){return function(_0x821c3a){if(!_0x821c3a){_0x5e60e9[_0x6f19('0x2e')](0x194);}return _0x821c3a;};}function handleError(_0x513288,_0x30f459){_0x30f459=_0x30f459||0x1f4;return function(_0x5ea8dc){logger[_0x6f19('0x2a')](_0x5ea8dc['stack']);if(_0x5ea8dc[_0x6f19('0x3c')]){delete _0x5ea8dc['name'];}_0x513288[_0x6f19('0x2f')](_0x30f459)[_0x6f19('0x3d')](_0x5ea8dc);};}exports[_0x6f19('0x3e')]=function(_0x32e4cb,_0x4079c9){var _0x57a9f5={},_0x43671f={},_0x261de1={'count':0x0,'rows':[]};var _0x17ed08=_[_0x6f19('0x3f')](db[_0x6f19('0x40')]['rawAttributes'],function(_0x1a2ccb){return{'name':_0x1a2ccb[_0x6f19('0x41')],'type':_0x1a2ccb[_0x6f19('0x42')]['key']};});_0x43671f[_0x6f19('0x43')]=_[_0x6f19('0x3f')](_0x17ed08,_0x6f19('0x3c'));_0x43671f[_0x6f19('0x44')]=_[_0x6f19('0x45')](_0x32e4cb[_0x6f19('0x44')]);_0x43671f[_0x6f19('0x46')]=_[_0x6f19('0x47')](_0x43671f[_0x6f19('0x43')],_0x43671f[_0x6f19('0x44')]);_0x57a9f5['attributes']=_[_0x6f19('0x47')](_0x43671f[_0x6f19('0x43')],qs['fields'](_0x32e4cb['query'][_0x6f19('0x48')]));_0x57a9f5[_0x6f19('0x49')]=_0x57a9f5[_0x6f19('0x49')][_0x6f19('0x4a')]?_0x57a9f5['attributes']:_0x43671f[_0x6f19('0x43')];if(!_0x32e4cb[_0x6f19('0x44')][_0x6f19('0x4b')](_0x6f19('0x4c'))){_0x57a9f5[_0x6f19('0x34')]=qs[_0x6f19('0x34')](_0x32e4cb[_0x6f19('0x44')][_0x6f19('0x34')]);_0x57a9f5[_0x6f19('0x32')]=qs[_0x6f19('0x32')](_0x32e4cb[_0x6f19('0x44')][_0x6f19('0x32')]);}_0x57a9f5[_0x6f19('0x4d')]=qs['sort'](_0x32e4cb[_0x6f19('0x44')][_0x6f19('0x4e')]);_0x57a9f5[_0x6f19('0x4f')]=qs[_0x6f19('0x46')](_['pick'](_0x32e4cb[_0x6f19('0x44')],_0x43671f['filters']),_0x17ed08);if(_0x32e4cb['query'][_0x6f19('0x50')]){_0x57a9f5[_0x6f19('0x4f')]=_['merge'](_0x57a9f5[_0x6f19('0x4f')],{'$or':_['map'](_0x17ed08,function(_0x970850){if(_0x970850['type']!==_0x6f19('0x51')){var _0x5d7444={};_0x5d7444[_0x970850[_0x6f19('0x3c')]]={'$like':'%'+_0x32e4cb['query'][_0x6f19('0x50')]+'%'};return _0x5d7444;}})});}_0x57a9f5=_['merge']({},_0x57a9f5,_0x32e4cb['options']);var _0x471323={'where':_0x57a9f5[_0x6f19('0x4f')]};return db[_0x6f19('0x40')][_0x6f19('0x35')](_0x471323)[_0x6f19('0x3a')](function(_0x332250){_0x261de1[_0x6f19('0x35')]=_0x332250;if(_0x32e4cb['query'][_0x6f19('0x52')]){_0x57a9f5[_0x6f19('0x53')]=[{'all':!![]}];}return db[_0x6f19('0x40')]['findAll'](_0x57a9f5);})[_0x6f19('0x3a')](function(_0x3ae52b){_0x261de1[_0x6f19('0x54')]=_0x3ae52b;return _0x261de1;})[_0x6f19('0x3a')](respondWithFilteredResult(_0x4079c9,_0x57a9f5))[_0x6f19('0x55')](handleError(_0x4079c9,null));};exports[_0x6f19('0x56')]=function(_0x54c2e1,_0x5b0168){var _0x453266={'raw':!![],'where':{'id':_0x54c2e1['params']['id']}},_0x50252e={};_0x50252e[_0x6f19('0x43')]=_[_0x6f19('0x45')](db['FaxMessage']['rawAttributes']);_0x50252e[_0x6f19('0x44')]=_[_0x6f19('0x45')](_0x54c2e1[_0x6f19('0x44')]);_0x50252e[_0x6f19('0x46')]=_[_0x6f19('0x47')](_0x50252e[_0x6f19('0x43')],_0x50252e[_0x6f19('0x44')]);_0x453266['attributes']=_[_0x6f19('0x47')](_0x50252e['model'],qs[_0x6f19('0x48')](_0x54c2e1['query']['fields']));_0x453266['attributes']=_0x453266['attributes']['length']?_0x453266[_0x6f19('0x49')]:_0x50252e[_0x6f19('0x43')];if(_0x54c2e1[_0x6f19('0x44')][_0x6f19('0x52')]){_0x453266[_0x6f19('0x53')]=[{'all':!![]}];}_0x453266=_[_0x6f19('0x57')]({},_0x453266,_0x54c2e1[_0x6f19('0x58')]);return db[_0x6f19('0x40')]['find'](_0x453266)[_0x6f19('0x3a')](handleEntityNotFound(_0x5b0168,null))['then'](respondWithResult(_0x5b0168,null))['catch'](handleError(_0x5b0168,null));};exports[_0x6f19('0x39')]=function(_0x5b86a6,_0x511c66){if(_0x5b86a6['body']['id']){delete _0x5b86a6['body']['id'];}return db[_0x6f19('0x40')][_0x6f19('0x59')]({'where':{'id':_0x5b86a6[_0x6f19('0x5a')]['id']}})['then'](handleEntityNotFound(_0x511c66,null))[_0x6f19('0x3a')](saveUpdates(_0x5b86a6['body'],null))[_0x6f19('0x3a')](respondWithResult(_0x511c66,null))[_0x6f19('0x55')](handleError(_0x511c66,null));};exports[_0x6f19('0x3b')]=function(_0x3e165f,_0xdd26e5){return db[_0x6f19('0x40')]['find']({'where':{'id':_0x3e165f[_0x6f19('0x5a')]['id']}})[_0x6f19('0x3a')](handleEntityNotFound(_0xdd26e5,null))[_0x6f19('0x3a')](removeEntity(_0xdd26e5,null))[_0x6f19('0x55')](handleError(_0xdd26e5,null));};exports[_0x6f19('0x5b')]=function(_0xb5a2e7,_0x934cb2){return db[_0x6f19('0x40')][_0x6f19('0x5b')]()[_0x6f19('0x3a')](respondWithResult(_0x934cb2,null))[_0x6f19('0x55')](handleError(_0x934cb2,null));};var interaction_log=require(_0x6f19('0x18'))(_0x6f19('0x5c'));exports['accept']=function(_0x28c947,_0xfae6db,_0x34dc0e){var _0x3ae511={'agent':{},'channel':_0x6f19('0x5d')};if(_0x28c947['body']['id']){delete _0x28c947[_0x6f19('0x5e')]['id'];}_0x28c947['body'][_0x6f19('0x5f')]=!![];_0x28c947[_0x6f19('0x5e')][_0x6f19('0x60')]=moment()['format'](_0x6f19('0x61'));_0x28c947[_0x6f19('0x5e')][_0x6f19('0x62')]=_0x28c947[_0x6f19('0x5e')][_0x6f19('0x62')]||_0x28c947[_0x6f19('0x63')]['id'];_0x3ae511['agent']['id']=_0x28c947['body'][_0x6f19('0x62')];return db['FaxMessage']['find']({'where':{'id':_0x28c947[_0x6f19('0x5a')]['id'],'UserId':null}})[_0x6f19('0x3a')](handleEntityNotFound(_0xfae6db,null))[_0x6f19('0x3a')](saveUpdates(_0x28c947[_0x6f19('0x5e')],null))[_0x6f19('0x3a')](function(_0x3f5506){if(_0x3f5506){_0x3ae511[_0x6f19('0x2c')]=_0x3f5506[_0x6f19('0x64')]({'plain':!![]});return db[_0x6f19('0x65')][_0x6f19('0x59')]({'where':{'id':_0x3f5506[_0x6f19('0x66')]}});}return null;})['then'](handleEntityNotFound(_0xfae6db,null))[_0x6f19('0x3a')](function(_0x234f91){if(_0x234f91){return _0x234f91[_0x6f19('0x39')]({'UserId':_0x28c947[_0x6f19('0x5e')][_0x6f19('0x62')],'read1stAt':_[_0x6f19('0x67')](_0x234f91[_0x6f19('0x68')])?moment()[_0x6f19('0x69')](_0x6f19('0x61')):undefined});}return null;})[_0x6f19('0x3a')](function(_0x4136f1){if(_0x4136f1){_0x3ae511[_0x6f19('0x6a')]=_0x4136f1[_0x6f19('0x64')]({'plain':!![]});interaction_log[_0x6f19('0x25')](_0x6f19('0x6b'),_0x28c947[_0x6f19('0x63')]['id'],_0x28c947[_0x6f19('0x63')]['name'],_0x28c947[_0x6f19('0x63')][_0x6f19('0x6c')],_0x3ae511[_0x6f19('0x6a')]['id'],_0x28c947[_0x6f19('0x5e')]?JSON[_0x6f19('0x29')](_0x28c947[_0x6f19('0x5e')]):'null');return respondWithRpcPromise(_0x6f19('0x6d'),_0x6f19('0x6e'),_0x3ae511);}return null;})[_0x6f19('0x3a')](function(_0x35c200){var _0x1e813d=_0x6f19('0x6f')+_0x35c200[_0x6f19('0x2c')][_0x6f19('0x70')];return db[_0x6f19('0x71')]['query'](_0x1e813d,{'type':db[_0x6f19('0x72')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6f19('0x3a')](function(_0xb5a0c0){return _0xb5a0c0;});})[_0x6f19('0x3a')](function(_0xbdb7b){if(_0xbdb7b){_0x3ae511[_0x6f19('0x2c')][_0x6f19('0x73')]=_0xbdb7b[0x0];if(!_0x28c947[_0x6f19('0x5e')]['UserId'])return;return db['User']['find']({'where':{'id':_0x28c947[_0x6f19('0x5e')][_0x6f19('0x62')],'role':'agent'},'attributes':['id',_0x6f19('0x3c'),_0x6f19('0x74'),_0x6f19('0x75'),_0x6f19('0x76')],'raw':!![]});}return null;})[_0x6f19('0x3a')](function(_0x2b2449){if(!_0x2b2449)return null;_0x3ae511[_0x6f19('0x2c')]['agent']=_0x2b2449;return _0x3ae511;})[_0x6f19('0x3a')](function(_0x4febcb){if(_0x4febcb){if(_0x28c947[_0x6f19('0x5e')][_0x6f19('0x77')]){_0x3ae511['message'][_0x6f19('0x78')]=util[_0x6f19('0x69')](_0x6f19('0x79'),_0x28c947[_0x6f19('0x63')][_0x6f19('0x3c')]);_0x3ae511['message'][_0x6f19('0x7a')]=_0x3ae511['channel'];_0x3ae511['message']['motionChannel']=_0x3ae511['channel'];_0x3ae511[_0x6f19('0x2c')][_0x6f19('0x7b')]='accept';return respondWithRpcPromise(_0x6f19('0x7c'),_0x6f19('0x7c'),{'event':_0x6f19('0x7d'),'message':_0x3ae511[_0x6f19('0x2c')]},client9002)[_0x6f19('0x3a')](function(){return _0x3ae511;});}return _0x3ae511;}return null;})['then'](respondWithResult(_0xfae6db,null))['catch'](handleError(_0xfae6db,null));};var interaction_log=require(_0x6f19('0x18'))('fax-interactions');exports[_0x6f19('0x7e')]=function(_0x2fa33c,_0x4f2bf6,_0x5c59de){var _0x21fae8={'agent':{},'channel':_0x6f19('0x5d')};if(_0x2fa33c[_0x6f19('0x5e')]['id']){delete _0x2fa33c[_0x6f19('0x5e')]['id'];}_0x2fa33c[_0x6f19('0x5e')][_0x6f19('0x62')]=_0x2fa33c[_0x6f19('0x5e')][_0x6f19('0x62')]||_0x2fa33c[_0x6f19('0x63')]['id'];_0x21fae8[_0x6f19('0x7f')]['id']=_0x2fa33c[_0x6f19('0x5e')][_0x6f19('0x62')];return db[_0x6f19('0x40')][_0x6f19('0x59')]({'where':{'id':_0x2fa33c[_0x6f19('0x5a')]['id'],'UserId':null}})[_0x6f19('0x3a')](handleEntityNotFound(_0x4f2bf6,null))['then'](function(_0x49902b){if(_0x49902b){_0x21fae8[_0x6f19('0x2c')]=_0x49902b[_0x6f19('0x64')]({'plain':!![]});return db[_0x6f19('0x65')][_0x6f19('0x59')]({'where':{'id':_0x49902b[_0x6f19('0x66')]}});}return null;})[_0x6f19('0x3a')](handleEntityNotFound(_0x4f2bf6,null))['then'](function(_0x20210c){if(_0x20210c){_0x21fae8[_0x6f19('0x6a')]=_0x20210c['get']({'plain':!![]});interaction_log[_0x6f19('0x25')](_0x6f19('0x80'),_0x2fa33c[_0x6f19('0x63')]['id'],_0x2fa33c['user'][_0x6f19('0x3c')],_0x2fa33c[_0x6f19('0x63')][_0x6f19('0x6c')],_0x21fae8[_0x6f19('0x6a')]['id'],_0x2fa33c[_0x6f19('0x5e')]?JSON[_0x6f19('0x29')](_0x2fa33c[_0x6f19('0x5e')]):_0x6f19('0x81'));return respondWithRpcPromise(_0x6f19('0x82'),_0x6f19('0x83'),_0x21fae8);}return null;})[_0x6f19('0x3a')](function(_0x346893){var _0x102fe4=_0x6f19('0x6f')+_0x346893[_0x6f19('0x2c')][_0x6f19('0x70')];return db[_0x6f19('0x71')][_0x6f19('0x44')](_0x102fe4,{'type':db[_0x6f19('0x72')][_0x6f19('0x84')][_0x6f19('0x85')],'raw':!![]})[_0x6f19('0x3a')](function(_0x4b8699){return _0x4b8699;});})[_0x6f19('0x3a')](function(_0x180674){if(_0x180674){_0x21fae8[_0x6f19('0x2c')][_0x6f19('0x73')]=_0x180674[0x0];if(!_0x2fa33c[_0x6f19('0x5e')][_0x6f19('0x62')])return;return db[_0x6f19('0x86')][_0x6f19('0x59')]({'where':{'id':_0x2fa33c[_0x6f19('0x5e')][_0x6f19('0x62')],'role':_0x6f19('0x7f')},'attributes':['id',_0x6f19('0x3c'),_0x6f19('0x74'),'email',_0x6f19('0x76')],'raw':!![]});}return null;})[_0x6f19('0x3a')](function(_0xddba10){if(!_0xddba10)return null;_0x21fae8[_0x6f19('0x2c')]['agent']=_0xddba10;return _0x21fae8;})[_0x6f19('0x3a')](function(_0x84e3a){if(_0x84e3a){_0x84e3a['message'][_0x6f19('0x78')]=util['format'](_0x6f19('0x79'),_0x2fa33c['user'][_0x6f19('0x3c')]);_0x84e3a[_0x6f19('0x2c')][_0x6f19('0x7a')]=_0x21fae8[_0x6f19('0x7a')];_0x84e3a['message']['motionChannel']=_0x21fae8[_0x6f19('0x7a')];_0x84e3a[_0x6f19('0x2c')][_0x6f19('0x7b')]=_0x6f19('0x7e');respondWithRpcPromise('EventManager','EventManager',{'event':_0x6f19('0x87'),'message':_0x84e3a[_0x6f19('0x2c')]},client9002);return _0x21fae8;}return null;})[_0x6f19('0x3a')](respondWithResult(_0x4f2bf6,null))['catch'](handleError(_0x4f2bf6,null));};exports['create']=function(_0x56bc7d,_0x513a97){var _0x2eb3fc;return db['FaxMessage'][_0x6f19('0x88')](_0x56bc7d[_0x6f19('0x5e')],{})[_0x6f19('0x3a')](function(_0x282f09){_0x2eb3fc=_0x282f09;return db['CmContact'][_0x6f19('0x89')]({'where':{'id':_0x2eb3fc[_0x6f19('0x70')]}});})[_0x6f19('0x3a')](function(_0x53308a){if(_['isNil'](_0x53308a)){return;}else{_0x2eb3fc[_0x6f19('0x5d')]=_0x53308a[_0x6f19('0x5d')];return db[_0x6f19('0x8a')][_0x6f19('0x89')]({'where':{'id':_0x2eb3fc['AttachmentId']}});}})[_0x6f19('0x3a')](function(_0xe4fd8d){return respondWithRpcPromise(_0x6f19('0x8b'),_0x6f19('0x8b'),{'FaxAccountId':_[_0x6f19('0x67')](_0x56bc7d[_0x6f19('0x5e')])?undefined:_0x56bc7d[_0x6f19('0x5e')][_0x6f19('0x8c')],'path':_['isNil'](_0xe4fd8d)?undefined:util['format'](_0x6f19('0x8d'),_0xe4fd8d[_0x6f19('0x8e')]),'fax':_[_0x6f19('0x67')](_0x2eb3fc[_0x6f19('0x5d')])?undefined:_0x2eb3fc[_0x6f19('0x5d')],'AttachmentId':_0x2eb3fc[_0x6f19('0x8f')]},client9002);})['then'](respondWithResult(_0x513a97,0xc9))[_0x6f19('0x55')](handleError(_0x513a97,null));};exports[_0x6f19('0x90')]=function(_0x374498,_0x2ec4d0){var _0x3a1eff=path[_0x6f19('0x91')](config[_0x6f19('0x92')],'server','files',_0x6f19('0x93'));return db['FaxMessage'][_0x6f19('0x59')]({'where':{'id':_0x374498[_0x6f19('0x5a')]['id']},'include':[{'model':db[_0x6f19('0x8a')],'as':_0x6f19('0x8a')}]})['then'](handleEntityNotFound(_0x2ec4d0,null))[_0x6f19('0x3a')](function(_0x46910a){if(_0x46910a){return _0x2ec4d0[_0x6f19('0x90')](path['join'](_0x3a1eff,_0x46910a[_0x6f19('0x8a')][_0x6f19('0x8e')]));}})['catch'](handleError(_0x2ec4d0,null));}; \ No newline at end of file +var _0xc90c=['http','client','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','filter','merge','type','VIRTUAL','options','then','findAll','rows','show','includeAll','include','find','body','params','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','SIP/%s','channel','event','EventManager','acceptmessage','role','null','RejectMessage','ContactId','Sequelize','motionChannel','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','isNil','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register'];(function(_0x1bf32f,_0x2e994e){var _0x147063=function(_0x423069){while(--_0x423069){_0x1bf32f['push'](_0x1bf32f['shift']());}};_0x147063(++_0x2e994e);}(_0xc90c,0x101));var _0xcc90=function(_0x244b86,_0x12085d){_0x244b86=_0x244b86-0x0;var _0x1ac13b=_0xc90c[_0x244b86];return _0x1ac13b;};'use strict';var emlformat=require(_0xcc90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcc90('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc90('0x2'));var moment=require(_0xcc90('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc90('0x4'));var util=require(_0xcc90('0x5'));var path=require(_0xcc90('0x6'));var sox=require(_0xcc90('0x7'));var csv=require(_0xcc90('0x8'));var ejs=require(_0xcc90('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc90('0xa'));var squel=require(_0xcc90('0xb'));var crypto=require(_0xcc90('0xc'));var jsforce=require(_0xcc90('0xd'));var deskjs=require(_0xcc90('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcc90('0xf'));var Papa=require(_0xcc90('0x10'));var Redis=require(_0xcc90('0x11'));var authService=require(_0xcc90('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcc90('0x13'));var hardwareService=require(_0xcc90('0x14'));var logger=require(_0xcc90('0x15'))(_0xcc90('0x16'));var utils=require(_0xcc90('0x17'));var config=require(_0xcc90('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc90('0x19'))['db'];config[_0xcc90('0x1a')]=_[_0xcc90('0x1b')](config['redis'],{'host':_0xcc90('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc90('0x1a')]));require(_0xcc90('0x1d'))[_0xcc90('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xcc90('0x1f')]({'port':0x232c});var client9002=jayson[_0xcc90('0x20')][_0xcc90('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18d843,_0x5db24f,_0x5d5500,_0x236d22){return new BPromise(function(_0x3258e5,_0x3da503){var _0x128da0=_0x236d22||client;return _0x128da0[_0xcc90('0x21')](_0x18d843,_0x5d5500)['then'](function(_0x80c3b){logger[_0xcc90('0x22')](_0xcc90('0x23'),_0x5db24f,'request\x20sent');logger[_0xcc90('0x24')](_0xcc90('0x25'),_0x5db24f,_0xcc90('0x26'),JSON[_0xcc90('0x27')](_0x80c3b));if(_0x80c3b[_0xcc90('0x28')]){if(_0x80c3b[_0xcc90('0x28')]['code']===0x1f4){logger[_0xcc90('0x28')](_0xcc90('0x23'),_0x5db24f,_0x80c3b['error'][_0xcc90('0x29')]);return _0x3da503(_0x80c3b['error'][_0xcc90('0x29')]);}logger[_0xcc90('0x28')](_0xcc90('0x23'),_0x5db24f,_0x80c3b['error'][_0xcc90('0x29')]);return _0x3258e5(_0x80c3b[_0xcc90('0x28')][_0xcc90('0x29')]);}else{logger[_0xcc90('0x22')](_0xcc90('0x23'),_0x5db24f,_0xcc90('0x26'));_0x3258e5(_0x80c3b[_0xcc90('0x2a')][_0xcc90('0x29')]);}})[_0xcc90('0x2b')](function(_0x36321a){logger[_0xcc90('0x28')](_0xcc90('0x23'),_0x5db24f,_0x36321a);_0x3da503(_0x36321a);});});}function respondWithStatusCode(_0x5e7a39,_0x3502d9){_0x3502d9=_0x3502d9||0xcc;return function(_0x52917a){if(_0x52917a){return _0x5e7a39[_0xcc90('0x2c')](_0x3502d9);}return _0x5e7a39[_0xcc90('0x2d')](_0x3502d9)[_0xcc90('0x2e')]();};}function respondWithResult(_0x1a43e6,_0x2f0f46){_0x2f0f46=_0x2f0f46||0xc8;return function(_0x4bad0a){if(_0x4bad0a){return _0x1a43e6[_0xcc90('0x2d')](_0x2f0f46)[_0xcc90('0x2f')](_0x4bad0a);}};}function respondWithFilteredResult(_0x5d5c0e,_0x364451){return function(_0x361fd6){if(_0x361fd6){var _0x598e75=typeof _0x364451[_0xcc90('0x30')]==='undefined'&&typeof _0x364451['limit']==='undefined';var _0xa5f904=_0x361fd6[_0xcc90('0x31')];var _0x57a463=_0x598e75?0x0:_0x364451['offset'];var _0x5a032d=_0x598e75?_0x361fd6[_0xcc90('0x31')]:_0x364451[_0xcc90('0x30')]+_0x364451['limit'];var _0x4b759a;if(_0x5a032d>=_0xa5f904){_0x5a032d=_0xa5f904;_0x4b759a=0xc8;}else{_0x4b759a=0xce;}_0x5d5c0e[_0xcc90('0x2d')](_0x4b759a);return _0x5d5c0e['set'](_0xcc90('0x32'),_0x57a463+'-'+_0x5a032d+'/'+_0xa5f904)[_0xcc90('0x2f')](_0x361fd6);}return null;};}function patchUpdates(_0x24fb5b){return function(_0x4ab8af){try{jsonpatch[_0xcc90('0x33')](_0x4ab8af,_0x24fb5b,!![]);}catch(_0x78e4a7){return BPromise[_0xcc90('0x34')](_0x78e4a7);}return _0x4ab8af[_0xcc90('0x35')]();};}function saveUpdates(_0x10107b,_0x4d284d){return function(_0x5e049a){if(_0x5e049a){return _0x5e049a[_0xcc90('0x36')](_0x10107b)['then'](function(_0xcabc9e){return _0xcabc9e;});}return null;};}function removeEntity(_0x2a4cab,_0x3bb62e){return function(_0x5691a8){if(_0x5691a8){return _0x5691a8[_0xcc90('0x37')]()['then'](function(){_0x2a4cab[_0xcc90('0x2d')](0xcc)[_0xcc90('0x2e')]();});}};}function handleEntityNotFound(_0x141b9d,_0x5d4a54){return function(_0x2a2148){if(!_0x2a2148){_0x141b9d[_0xcc90('0x2c')](0x194);}return _0x2a2148;};}function handleError(_0x420070,_0x4c9e9b){_0x4c9e9b=_0x4c9e9b||0x1f4;return function(_0x5d4042){logger[_0xcc90('0x28')](_0x5d4042[_0xcc90('0x38')]);if(_0x5d4042[_0xcc90('0x39')]){delete _0x5d4042[_0xcc90('0x39')];}_0x420070[_0xcc90('0x2d')](_0x4c9e9b)[_0xcc90('0x3a')](_0x5d4042);};}exports[_0xcc90('0x3b')]=function(_0x49299a,_0x3d64c8){var _0x155462={},_0x185845={},_0x2bd013={'count':0x0,'rows':[]};var _0x5c6444=_[_0xcc90('0x3c')](db[_0xcc90('0x3d')][_0xcc90('0x3e')],function(_0x4e729c){return{'name':_0x4e729c['fieldName'],'type':_0x4e729c['type']['key']};});_0x185845[_0xcc90('0x3f')]=_['map'](_0x5c6444,_0xcc90('0x39'));_0x185845[_0xcc90('0x40')]=_[_0xcc90('0x41')](_0x49299a['query']);_0x185845[_0xcc90('0x42')]=_['intersection'](_0x185845['model'],_0x185845[_0xcc90('0x40')]);_0x155462[_0xcc90('0x43')]=_[_0xcc90('0x44')](_0x185845[_0xcc90('0x3f')],qs[_0xcc90('0x45')](_0x49299a[_0xcc90('0x40')]['fields']));_0x155462[_0xcc90('0x43')]=_0x155462[_0xcc90('0x43')][_0xcc90('0x46')]?_0x155462[_0xcc90('0x43')]:_0x185845[_0xcc90('0x3f')];if(!_0x49299a['query'][_0xcc90('0x47')]('nolimit')){_0x155462['limit']=qs[_0xcc90('0x48')](_0x49299a[_0xcc90('0x40')][_0xcc90('0x48')]);_0x155462[_0xcc90('0x30')]=qs['offset'](_0x49299a[_0xcc90('0x40')][_0xcc90('0x30')]);}_0x155462['order']=qs[_0xcc90('0x49')](_0x49299a['query'][_0xcc90('0x49')]);_0x155462[_0xcc90('0x4a')]=qs['filters'](_['pick'](_0x49299a['query'],_0x185845[_0xcc90('0x42')]),_0x5c6444);if(_0x49299a[_0xcc90('0x40')][_0xcc90('0x4b')]){_0x155462['where']=_[_0xcc90('0x4c')](_0x155462[_0xcc90('0x4a')],{'$or':_[_0xcc90('0x3c')](_0x5c6444,function(_0x585695){if(_0x585695[_0xcc90('0x4d')]!==_0xcc90('0x4e')){var _0x51e5f0={};_0x51e5f0[_0x585695[_0xcc90('0x39')]]={'$like':'%'+_0x49299a[_0xcc90('0x40')][_0xcc90('0x4b')]+'%'};return _0x51e5f0;}})});}_0x155462=_['merge']({},_0x155462,_0x49299a[_0xcc90('0x4f')]);var _0x398828={'where':_0x155462[_0xcc90('0x4a')]};return db[_0xcc90('0x3d')]['count'](_0x398828)[_0xcc90('0x50')](function(_0x3b1324){_0x2bd013[_0xcc90('0x31')]=_0x3b1324;if(_0x49299a[_0xcc90('0x40')]['includeAll']){_0x155462['include']=[{'all':!![]}];}return db[_0xcc90('0x3d')][_0xcc90('0x51')](_0x155462);})['then'](function(_0x44173e){_0x2bd013[_0xcc90('0x52')]=_0x44173e;return _0x2bd013;})[_0xcc90('0x50')](respondWithFilteredResult(_0x3d64c8,_0x155462))[_0xcc90('0x2b')](handleError(_0x3d64c8,null));};exports[_0xcc90('0x53')]=function(_0x268fe7,_0x1caf03){var _0x44f90e={'raw':!![],'where':{'id':_0x268fe7['params']['id']}},_0x23a848={};_0x23a848[_0xcc90('0x3f')]=_[_0xcc90('0x41')](db['FaxMessage'][_0xcc90('0x3e')]);_0x23a848[_0xcc90('0x40')]=_[_0xcc90('0x41')](_0x268fe7['query']);_0x23a848[_0xcc90('0x42')]=_[_0xcc90('0x44')](_0x23a848[_0xcc90('0x3f')],_0x23a848[_0xcc90('0x40')]);_0x44f90e[_0xcc90('0x43')]=_['intersection'](_0x23a848[_0xcc90('0x3f')],qs[_0xcc90('0x45')](_0x268fe7[_0xcc90('0x40')]['fields']));_0x44f90e['attributes']=_0x44f90e[_0xcc90('0x43')][_0xcc90('0x46')]?_0x44f90e['attributes']:_0x23a848[_0xcc90('0x3f')];if(_0x268fe7[_0xcc90('0x40')][_0xcc90('0x54')]){_0x44f90e[_0xcc90('0x55')]=[{'all':!![]}];}_0x44f90e=_['merge']({},_0x44f90e,_0x268fe7[_0xcc90('0x4f')]);return db[_0xcc90('0x3d')][_0xcc90('0x56')](_0x44f90e)[_0xcc90('0x50')](handleEntityNotFound(_0x1caf03,null))['then'](respondWithResult(_0x1caf03,null))['catch'](handleError(_0x1caf03,null));};exports[_0xcc90('0x36')]=function(_0x45e453,_0x4ec666){if(_0x45e453[_0xcc90('0x57')]['id']){delete _0x45e453[_0xcc90('0x57')]['id'];}return db[_0xcc90('0x3d')][_0xcc90('0x56')]({'where':{'id':_0x45e453[_0xcc90('0x58')]['id']}})[_0xcc90('0x50')](handleEntityNotFound(_0x4ec666,null))['then'](saveUpdates(_0x45e453['body'],null))['then'](respondWithResult(_0x4ec666,null))[_0xcc90('0x2b')](handleError(_0x4ec666,null));};exports[_0xcc90('0x37')]=function(_0x13b71f,_0x3242e9){return db[_0xcc90('0x3d')]['find']({'where':{'id':_0x13b71f[_0xcc90('0x58')]['id']}})[_0xcc90('0x50')](handleEntityNotFound(_0x3242e9,null))['then'](removeEntity(_0x3242e9,null))['catch'](handleError(_0x3242e9,null));};exports[_0xcc90('0x59')]=function(_0x4d4c8a,_0x4a3cab){return db[_0xcc90('0x3d')][_0xcc90('0x59')]()[_0xcc90('0x50')](respondWithResult(_0x4a3cab,null))[_0xcc90('0x2b')](handleError(_0x4a3cab,null));};var interaction_log=require(_0xcc90('0x15'))(_0xcc90('0x5a'));exports[_0xcc90('0x5b')]=function(_0xbf2f41,_0x4bee2a,_0x5b143e){var _0x52c8f7={'agent':{},'channel':_0xcc90('0x5c')};if(_0xbf2f41['body']['id']){delete _0xbf2f41[_0xcc90('0x57')]['id'];}_0xbf2f41[_0xcc90('0x57')][_0xcc90('0x5d')]=!![];_0xbf2f41[_0xcc90('0x57')][_0xcc90('0x5e')]=moment()['format'](_0xcc90('0x5f'));_0xbf2f41[_0xcc90('0x57')][_0xcc90('0x60')]=_0xbf2f41['body'][_0xcc90('0x60')]||_0xbf2f41['user']['id'];_0x52c8f7['agent']['id']=_0xbf2f41[_0xcc90('0x57')]['UserId'];return db[_0xcc90('0x3d')][_0xcc90('0x56')]({'where':{'id':_0xbf2f41[_0xcc90('0x58')]['id'],'UserId':null}})[_0xcc90('0x50')](handleEntityNotFound(_0x4bee2a,null))[_0xcc90('0x50')](saveUpdates(_0xbf2f41[_0xcc90('0x57')],null))[_0xcc90('0x50')](function(_0xf1d9fc){if(_0xf1d9fc){_0x52c8f7[_0xcc90('0x29')]=_0xf1d9fc[_0xcc90('0x61')]({'plain':!![]});return db[_0xcc90('0x62')][_0xcc90('0x56')]({'where':{'id':_0xf1d9fc[_0xcc90('0x63')]}});}return null;})[_0xcc90('0x50')](handleEntityNotFound(_0x4bee2a,null))[_0xcc90('0x50')](function(_0x415d99){if(_0x415d99){return _0x415d99[_0xcc90('0x36')]({'UserId':_0xbf2f41[_0xcc90('0x57')][_0xcc90('0x60')],'read1stAt':_['isNil'](_0x415d99['read1stAt'])?moment()[_0xcc90('0x64')](_0xcc90('0x5f')):undefined});}return null;})[_0xcc90('0x50')](function(_0x59dfeb){if(_0x59dfeb){_0x52c8f7[_0xcc90('0x65')]=_0x59dfeb['get']({'plain':!![]});interaction_log['info'](_0xcc90('0x66'),_0xbf2f41['user']['id'],_0xbf2f41[_0xcc90('0x67')]['name'],_0xbf2f41[_0xcc90('0x67')]['role'],_0x52c8f7['interaction']['id'],_0xbf2f41[_0xcc90('0x57')]?JSON[_0xcc90('0x27')](_0xbf2f41['body']):'null');return respondWithRpcPromise(_0xcc90('0x68'),_0xcc90('0x69'),_0x52c8f7);}return null;})[_0xcc90('0x50')](function(_0x3f2d5f){var _0x1d6cd6=_0xcc90('0x6a')+_0x3f2d5f[_0xcc90('0x29')]['ContactId'];return db[_0xcc90('0x6b')]['query'](_0x1d6cd6,{'type':db['Sequelize'][_0xcc90('0x6c')][_0xcc90('0x6d')],'raw':!![]})['then'](function(_0x5cb984){return _0x5cb984;});})[_0xcc90('0x50')](function(_0xf6d038){if(_0xf6d038){_0x52c8f7[_0xcc90('0x29')][_0xcc90('0x6e')]=_0xf6d038[0x0];if(!_0xbf2f41['body'][_0xcc90('0x60')])return;return db[_0xcc90('0x6f')][_0xcc90('0x56')]({'where':{'id':_0xbf2f41[_0xcc90('0x57')][_0xcc90('0x60')],'role':_0xcc90('0x70')},'attributes':['id','name',_0xcc90('0x71'),_0xcc90('0x72'),_0xcc90('0x73')],'raw':!![]});}return null;})[_0xcc90('0x50')](function(_0x2d362f){if(!_0x2d362f)return null;_0x52c8f7[_0xcc90('0x29')][_0xcc90('0x70')]=_0x2d362f;return _0x52c8f7;})[_0xcc90('0x50')](function(_0x5cbe38){if(_0x5cbe38){if(_0xbf2f41[_0xcc90('0x57')]['manual']){_0x52c8f7[_0xcc90('0x29')]['interface']=util['format'](_0xcc90('0x74'),_0xbf2f41[_0xcc90('0x67')][_0xcc90('0x39')]);_0x52c8f7[_0xcc90('0x29')][_0xcc90('0x75')]=_0x52c8f7[_0xcc90('0x75')];_0x52c8f7['message']['motionChannel']=_0x52c8f7['channel'];_0x52c8f7[_0xcc90('0x29')][_0xcc90('0x76')]=_0xcc90('0x5b');return respondWithRpcPromise(_0xcc90('0x77'),_0xcc90('0x77'),{'event':_0xcc90('0x78'),'message':_0x52c8f7[_0xcc90('0x29')]},client9002)[_0xcc90('0x50')](function(){return _0x52c8f7;});}return _0x52c8f7;}return null;})['then'](respondWithResult(_0x4bee2a,null))[_0xcc90('0x2b')](handleError(_0x4bee2a,null));};var interaction_log=require(_0xcc90('0x15'))('fax-interactions');exports[_0xcc90('0x34')]=function(_0x591345,_0x5e0d94,_0x51e7d7){var _0x169bff={'agent':{},'channel':'fax'};if(_0x591345['body']['id']){delete _0x591345[_0xcc90('0x57')]['id'];}_0x591345[_0xcc90('0x57')][_0xcc90('0x60')]=_0x591345[_0xcc90('0x57')][_0xcc90('0x60')]||_0x591345[_0xcc90('0x67')]['id'];_0x169bff['agent']['id']=_0x591345['body'][_0xcc90('0x60')];return db[_0xcc90('0x3d')][_0xcc90('0x56')]({'where':{'id':_0x591345[_0xcc90('0x58')]['id'],'UserId':null}})[_0xcc90('0x50')](handleEntityNotFound(_0x5e0d94,null))[_0xcc90('0x50')](function(_0x5b8119){if(_0x5b8119){_0x169bff[_0xcc90('0x29')]=_0x5b8119[_0xcc90('0x61')]({'plain':!![]});return db[_0xcc90('0x62')][_0xcc90('0x56')]({'where':{'id':_0x5b8119[_0xcc90('0x63')]}});}return null;})[_0xcc90('0x50')](handleEntityNotFound(_0x5e0d94,null))['then'](function(_0x280013){if(_0x280013){_0x169bff[_0xcc90('0x65')]=_0x280013[_0xcc90('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x591345[_0xcc90('0x67')]['id'],_0x591345[_0xcc90('0x67')][_0xcc90('0x39')],_0x591345[_0xcc90('0x67')][_0xcc90('0x79')],_0x169bff['interaction']['id'],_0x591345['body']?JSON[_0xcc90('0x27')](_0x591345[_0xcc90('0x57')]):_0xcc90('0x7a'));return respondWithRpcPromise(_0xcc90('0x7b'),'rejectMessage',_0x169bff);}return null;})[_0xcc90('0x50')](function(_0xc42263){var _0x1ef534=_0xcc90('0x6a')+_0xc42263[_0xcc90('0x29')][_0xcc90('0x7c')];return db[_0xcc90('0x6b')][_0xcc90('0x40')](_0x1ef534,{'type':db[_0xcc90('0x7d')][_0xcc90('0x6c')][_0xcc90('0x6d')],'raw':!![]})[_0xcc90('0x50')](function(_0x370dfd){return _0x370dfd;});})[_0xcc90('0x50')](function(_0x50b3a6){if(_0x50b3a6){_0x169bff[_0xcc90('0x29')][_0xcc90('0x6e')]=_0x50b3a6[0x0];if(!_0x591345[_0xcc90('0x57')][_0xcc90('0x60')])return;return db[_0xcc90('0x6f')][_0xcc90('0x56')]({'where':{'id':_0x591345[_0xcc90('0x57')][_0xcc90('0x60')],'role':_0xcc90('0x70')},'attributes':['id','name',_0xcc90('0x71'),_0xcc90('0x72'),'internal'],'raw':!![]});}return null;})[_0xcc90('0x50')](function(_0x301998){if(!_0x301998)return null;_0x169bff[_0xcc90('0x29')][_0xcc90('0x70')]=_0x301998;return _0x169bff;})[_0xcc90('0x50')](function(_0x144bd4){if(_0x144bd4){_0x144bd4[_0xcc90('0x29')]['interface']=util[_0xcc90('0x64')](_0xcc90('0x74'),_0x591345['user']['name']);_0x144bd4[_0xcc90('0x29')][_0xcc90('0x75')]=_0x169bff[_0xcc90('0x75')];_0x144bd4['message'][_0xcc90('0x7e')]=_0x169bff['channel'];_0x144bd4['message']['event']=_0xcc90('0x34');respondWithRpcPromise(_0xcc90('0x77'),'EventManager',{'event':_0xcc90('0x7f'),'message':_0x144bd4[_0xcc90('0x29')]},client9002);return _0x169bff;}return null;})['then'](respondWithResult(_0x5e0d94,null))[_0xcc90('0x2b')](handleError(_0x5e0d94,null));};exports[_0xcc90('0x80')]=function(_0x1600d3,_0x132506){var _0x3a007e;return db['FaxMessage'][_0xcc90('0x80')](_0x1600d3[_0xcc90('0x57')],{})['then'](function(_0x198b0f){_0x3a007e=_0x198b0f;return db[_0xcc90('0x81')][_0xcc90('0x82')]({'where':{'id':_0x3a007e[_0xcc90('0x7c')]}});})[_0xcc90('0x50')](function(_0x36f139){if(_['isNil'](_0x36f139)){return;}else{_0x3a007e[_0xcc90('0x5c')]=_0x36f139[_0xcc90('0x5c')];return db[_0xcc90('0x83')]['findOne']({'where':{'id':_0x3a007e[_0xcc90('0x84')]}});}})['then'](function(_0x38e575){return respondWithRpcPromise(_0xcc90('0x85'),'SendFax',{'FaxAccountId':_['isNil'](_0x1600d3[_0xcc90('0x57')])?undefined:_0x1600d3[_0xcc90('0x57')][_0xcc90('0x86')],'path':_[_0xcc90('0x87')](_0x38e575)?undefined:util[_0xcc90('0x64')](_0xcc90('0x88'),_0x38e575[_0xcc90('0x89')]),'fax':_[_0xcc90('0x87')](_0x3a007e['fax'])?undefined:_0x3a007e[_0xcc90('0x5c')],'AttachmentId':_0x3a007e['AttachmentId']},client9002);})[_0xcc90('0x50')](respondWithResult(_0x132506,0xc9))[_0xcc90('0x2b')](handleError(_0x132506,null));};exports[_0xcc90('0x8a')]=function(_0x5788b5,_0x4e9b4e){var _0x2d786b=path[_0xcc90('0x8b')](config[_0xcc90('0x8c')],_0xcc90('0x8d'),_0xcc90('0x8e'),_0xcc90('0x8f'));return db[_0xcc90('0x3d')][_0xcc90('0x56')]({'where':{'id':_0x5788b5[_0xcc90('0x58')]['id']},'include':[{'model':db[_0xcc90('0x83')],'as':'Attachment'}]})[_0xcc90('0x50')](handleEntityNotFound(_0x4e9b4e,null))['then'](function(_0x3e8f81){if(_0x3e8f81){return _0x4e9b4e['download'](path[_0xcc90('0x8b')](_0x2d786b,_0x3e8f81[_0xcc90('0x83')][_0xcc90('0x89')]));}})['catch'](handleError(_0x4e9b4e,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 0dad837..bc49f33 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 _0x720b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','update'];(function(_0x57b4dc,_0x3fbf56){var _0x19a18a=function(_0x31b596){while(--_0x31b596){_0x57b4dc['push'](_0x57b4dc['shift']());}};_0x19a18a(++_0x3fbf56);}(_0x720b,0x1d8));var _0xb720=function(_0xa50d4a,_0x7776cb){_0xa50d4a=_0xa50d4a-0x0;var _0x3498a8=_0x720b[_0xa50d4a];return _0x3498a8;};'use strict';var EventEmitter=require(_0xb720('0x0'));var FaxMessage=require(_0xb720('0x1'))['db'][_0xb720('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb720('0x3'),'afterUpdate':_0xb720('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2f7ac1){return function(_0x3f8acb,_0x33f308,_0x4ddff9){FaxMessageEvents[_0xb720('0x5')](_0x2f7ac1+':'+_0x3f8acb['id'],_0x3f8acb);FaxMessageEvents[_0xb720('0x5')](_0x2f7ac1,_0x3f8acb);_0x4ddff9(null);};}for(var e in events){if(events[_0xb720('0x6')](e)){var event=events[e];FaxMessage[_0xb720('0x7')](e,emitEvent(event));}}module[_0xb720('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x6bfc=['exports','../../mysqldb','FaxMessage','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6bfc,0x159));var _0xc6bf=function(_0x415616,_0x133338){_0x415616=_0x415616-0x0;var _0x5e3fa8=_0x6bfc[_0x415616];return _0x5e3fa8;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xc6bf('0x0'))['db'][_0xc6bf('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc6bf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc6bf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x196d6b){return function(_0x4a6de4,_0x15b991,_0xe23c7e){FaxMessageEvents[_0xc6bf('0x4')](_0x196d6b+':'+_0x4a6de4['id'],_0x4a6de4);FaxMessageEvents['emit'](_0x196d6b,_0x4a6de4);_0xe23c7e(null);};}for(var e in events){if(events[_0xc6bf('0x5')](e)){var event=events[e];FaxMessage[_0xc6bf('0x6')](e,emitEvent(event));}}module[_0xc6bf('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 10cb3f5..b7160db 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 _0xa920=['direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0xa920,0x151));var _0x0a92=function(_0x910745,_0x3a7a69){_0x910745=_0x910745-0x0;var _0x459fbd=_0xa920[_0x910745];return _0x459fbd;};'use strict';var _=require(_0x0a92('0x0'));var util=require('util');var logger=require(_0x0a92('0x1'))('api');var moment=require(_0x0a92('0x2'));var BPromise=require(_0x0a92('0x3'));var rp=require(_0x0a92('0x4'));var fs=require('fs');var path=require(_0x0a92('0x5'));var rimraf=require(_0x0a92('0x6'));var config=require(_0x0a92('0x7'));var attributes=require(_0x0a92('0x8'));module['exports']=function(_0x1193ec,_0x13fb40){return _0x1193ec['define'](_0x0a92('0x9'),attributes,{'tableName':_0x0a92('0xa'),'paranoid':![],'indexes':[{'name':_0x0a92('0xb'),'fields':['body'],'type':_0x0a92('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38312f,_0x368119,_0x4a8a51){var _0x420232=_0x1193ec[_0x0a92('0xd')];var _0x2390b9=_0x38312f['get']({'plain':!![]});if(_0x2390b9[_0x0a92('0xe')][_0x0a92('0xf')]()==='in'||_0x2390b9['direction'][_0x0a92('0xf')]()===_0x0a92('0x10')&&!_0x2390b9[_0x0a92('0x11')]&&!_['isNil'](_0x2390b9[_0x0a92('0x12')])){_0x420232[_0x0a92('0x13')][_0x0a92('0x14')]({'where':{'id':_0x2390b9[_0x0a92('0x15')]}})['then'](function(_0x33e8b2){if(_0x33e8b2){_0x33e8b2['update']({'lastMsgAt':_0x2390b9[_0x0a92('0x16')],'lastMsgDirection':_0x2390b9[_0x0a92('0xe')][_0x0a92('0xf')]()});}})[_0x0a92('0x17')](function(_0x53f686){console[_0x0a92('0x18')](_0x53f686);});}_0x4a8a51();}},'charset':_0x0a92('0x19'),'collate':_0x0a92('0x1a')});}; \ No newline at end of file +var _0x63e2=['createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','out','isNil','UserId','FaxInteraction','FaxInteractionId','then'];(function(_0x4c26b6,_0x14b3e8){var _0x433964=function(_0x42e489){while(--_0x42e489){_0x4c26b6['push'](_0x4c26b6['shift']());}};_0x433964(++_0x14b3e8);}(_0x63e2,0x12d));var _0x263e=function(_0x4e0553,_0x5b9049){_0x4e0553=_0x4e0553-0x0;var _0x53b5a2=_0x63e2[_0x4e0553];return _0x53b5a2;};'use strict';var _=require(_0x263e('0x0'));var util=require('util');var logger=require(_0x263e('0x1'))('api');var moment=require(_0x263e('0x2'));var BPromise=require(_0x263e('0x3'));var rp=require(_0x263e('0x4'));var fs=require('fs');var path=require(_0x263e('0x5'));var rimraf=require(_0x263e('0x6'));var config=require('../../config/environment');var attributes=require(_0x263e('0x7'));module['exports']=function(_0x329fa4,_0x46a80f){return _0x329fa4[_0x263e('0x8')](_0x263e('0x9'),attributes,{'tableName':_0x263e('0xa'),'paranoid':![],'indexes':[{'name':_0x263e('0xb'),'fields':[_0x263e('0xc')],'type':_0x263e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43613a,_0x350e8a,_0x101920){var _0xb2acc4=_0x329fa4['models'];var _0x58ba24=_0x43613a[_0x263e('0xe')]({'plain':!![]});if(_0x58ba24['direction'][_0x263e('0xf')]()==='in'||_0x58ba24[_0x263e('0x10')][_0x263e('0xf')]()===_0x263e('0x11')&&!_0x58ba24['secret']&&!_[_0x263e('0x12')](_0x58ba24[_0x263e('0x13')])){_0xb2acc4[_0x263e('0x14')]['findOne']({'where':{'id':_0x58ba24[_0x263e('0x15')]}})[_0x263e('0x16')](function(_0x13ed8d){if(_0x13ed8d){_0x13ed8d['update']({'lastMsgAt':_0x58ba24[_0x263e('0x17')],'lastMsgDirection':_0x58ba24[_0x263e('0x10')]['toLowerCase']()});}})[_0x263e('0x18')](function(_0x33ba12){console['error'](_0x33ba12);});}_0x101920();}},'charset':_0x263e('0x19'),'collate':_0x263e('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index ff17388..f526704 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 _0xeec6=['FaxMessage','create','body','options','then','catch','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage'];(function(_0x176b51,_0x1f7f28){var _0x113abc=function(_0x32887c){while(--_0x32887c){_0x176b51['push'](_0x176b51['shift']());}};_0x113abc(++_0x1f7f28);}(_0xeec6,0x1c2));var _0x6eec=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0xeec6[_0x2de020];return _0x182b7c;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});config['redis']=_[_0x6eec('0xc')](config[_0x6eec('0xd')],{'host':_0x6eec('0xe'),'port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require(_0x6eec('0x10'))[_0x6eec('0x11')](socket);function respondWithRpcPromise(_0x1c774d,_0x49ad4c,_0x595dd4){return new BPromise(function(_0x5e8aba,_0x295cae){return client[_0x6eec('0x12')](_0x1c774d,_0x595dd4)['then'](function(_0x4b8de1){logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));logger[_0x6eec('0x15')](_0x6eec('0x16'),_0x49ad4c,_0x6eec('0x14'),JSON[_0x6eec('0x17')](_0x4b8de1));if(_0x4b8de1['error']){if(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x19')]===0x1f4){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);return _0x295cae(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);}logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1['error'][_0x6eec('0x1b')]);return _0x5e8aba(_0x4b8de1['error'][_0x6eec('0x1b')]);}else{logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));_0x5e8aba(_0x4b8de1[_0x6eec('0x1c')][_0x6eec('0x1b')]);}})['catch'](function(_0x87f3be){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x87f3be);_0x295cae(_0x87f3be);});});}exports[_0x6eec('0x1d')]=function(_0xd86135){var _0x1761f4=this;return new Promise(function(_0x536429,_0x328693){return db[_0x6eec('0x1e')][_0x6eec('0x1f')](_0xd86135[_0x6eec('0x20')],{'raw':_0xd86135[_0x6eec('0x21')]?_0xd86135[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x6eec('0x22')](function(_0x852d08){logger[_0x6eec('0x13')](_0x6eec('0x1d'),_0xd86135);logger[_0x6eec('0x15')](_0x6eec('0x1d'),_0xd86135,JSON['stringify'](_0x852d08));_0x536429(_0x852d08);})[_0x6eec('0x23')](function(_0x2ad14b){logger[_0x6eec('0x18')](_0x6eec('0x1d'),_0x2ad14b[_0x6eec('0x1b')],_0xd86135);_0x328693(_0x1761f4[_0x6eec('0x18')](0x1f4,_0x2ad14b[_0x6eec('0x1b')]));});});};exports[_0x6eec('0x24')]=function(_0x316317){var _0x58f95c=this;return new Promise(function(_0x1d750c,_0x44b31c){return db[_0x6eec('0x1e')][_0x6eec('0x25')](_0x316317['body'],{'raw':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316317['options']?_0x316317[_0x6eec('0x21')]['where']||null:null,'attributes':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x26')]||null:null,'limit':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x27')]||null:null})[_0x6eec('0x22')](function(_0x33e4a1){logger[_0x6eec('0x13')](_0x6eec('0x24'),_0x316317);logger['debug'](_0x6eec('0x24'),_0x316317,JSON['stringify'](_0x33e4a1));_0x1d750c(_0x33e4a1);})[_0x6eec('0x23')](function(_0x125bfc){logger[_0x6eec('0x18')]('UpdateFaxMessage',_0x125bfc['message'],_0x316317);_0x44b31c(_0x58f95c['error'](0x1f4,_0x125bfc[_0x6eec('0x1b')]));});});}; \ No newline at end of file +var _0x4bc3=['CreateFaxMessage','FaxMessage','create','body','options','raw','then','stringify','catch','UpdateFaxMessage','update','where','attributes','limit','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4bc3,0x16e));var _0x34bc=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4bc3[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});config[_0x34bc('0xb')]=_['defaults'](config['redis'],{'host':_0x34bc('0xc'),'port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config[_0x34bc('0xb')]));require(_0x34bc('0xe'))[_0x34bc('0xf')](socket);function respondWithRpcPromise(_0x41b2ff,_0x5de8b5,_0x5a478d){return new BPromise(function(_0x2b8112,_0x33025c){return client[_0x34bc('0x10')](_0x41b2ff,_0x5a478d)['then'](function(_0x41960e){logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));logger[_0x34bc('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5de8b5,_0x34bc('0x12'),JSON['stringify'](_0x41960e));if(_0x41960e[_0x34bc('0x14')]){if(_0x41960e[_0x34bc('0x14')][_0x34bc('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x41960e[_0x34bc('0x14')]['message']);return _0x33025c(_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);}logger[_0x34bc('0x14')](_0x34bc('0x11'),_0x5de8b5,_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);return _0x2b8112(_0x41960e['error']['message']);}else{logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));_0x2b8112(_0x41960e[_0x34bc('0x17')][_0x34bc('0x16')]);}})['catch'](function(_0x46aa24){logger[_0x34bc('0x14')]('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x46aa24);_0x33025c(_0x46aa24);});});}exports[_0x34bc('0x18')]=function(_0x9e9f14){var _0x4d2d5e=this;return new Promise(function(_0x14cec8,_0x26cdec){return db[_0x34bc('0x19')][_0x34bc('0x1a')](_0x9e9f14[_0x34bc('0x1b')],{'raw':_0x9e9f14[_0x34bc('0x1c')]?_0x9e9f14['options'][_0x34bc('0x1d')]===undefined?!![]:![]:!![]})[_0x34bc('0x1e')](function(_0x38882c){logger['info']('CreateFaxMessage',_0x9e9f14);logger[_0x34bc('0x13')](_0x34bc('0x18'),_0x9e9f14,JSON[_0x34bc('0x1f')](_0x38882c));_0x14cec8(_0x38882c);})[_0x34bc('0x20')](function(_0x13094a){logger[_0x34bc('0x14')](_0x34bc('0x18'),_0x13094a[_0x34bc('0x16')],_0x9e9f14);_0x26cdec(_0x4d2d5e[_0x34bc('0x14')](0x1f4,_0x13094a[_0x34bc('0x16')]));});});};exports[_0x34bc('0x21')]=function(_0x1edcb0){var _0x4fd589=this;return new Promise(function(_0x43e527,_0x48ec13){return db['FaxMessage'][_0x34bc('0x22')](_0x1edcb0['body'],{'raw':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1edcb0['options']?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x23')]||null:null,'attributes':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x24')]||null:null,'limit':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0['options'][_0x34bc('0x25')]||null:null})[_0x34bc('0x1e')](function(_0x22aacc){logger[_0x34bc('0x26')](_0x34bc('0x21'),_0x1edcb0);logger[_0x34bc('0x13')]('UpdateFaxMessage',_0x1edcb0,JSON[_0x34bc('0x1f')](_0x22aacc));_0x43e527(_0x22aacc);})['catch'](function(_0x530748){logger[_0x34bc('0x14')]('UpdateFaxMessage',_0x530748[_0x34bc('0x16')],_0x1edcb0);_0x48ec13(_0x4fd589[_0x34bc('0x14')](0x1f4,_0x530748[_0x34bc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 2849c9c..93b6d8c 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 _0x88c9=['./faxMessage.events','save','remove','update','emit','removeListener','faxMessage:'];(function(_0x46d7bb,_0x3ec5fa){var _0x268d0e=function(_0x5ad191){while(--_0x5ad191){_0x46d7bb['push'](_0x46d7bb['shift']());}};_0x268d0e(++_0x3ec5fa);}(_0x88c9,0x1dc));var _0x988c=function(_0x1154d3,_0x4c24c9){_0x1154d3=_0x1154d3-0x0;var _0x3a28bc=_0x88c9[_0x1154d3];return _0x3a28bc;};'use strict';var FaxMessageEvents=require(_0x988c('0x0'));var events=[_0x988c('0x1'),_0x988c('0x2'),_0x988c('0x3')];function createListener(_0x2724d3,_0x40408e){return function(_0x2547c9){_0x40408e[_0x988c('0x4')](_0x2724d3,_0x2547c9);};}function removeListener(_0x35d07c,_0x5e5951){return function(){FaxMessageEvents[_0x988c('0x5')](_0x35d07c,_0x5e5951);};}exports['register']=function(_0x434b27){for(var _0x2233b9=0x0,_0x385c66=events['length'];_0x2233b9<_0x385c66;_0x2233b9++){var _0x4a5c25=events[_0x2233b9];var _0xe55e41=createListener(_0x988c('0x6')+_0x4a5c25,_0x434b27);FaxMessageEvents['on'](_0x4a5c25,_0xe55e41);}}; \ No newline at end of file +var _0x1107=['update','removeListener','faxMessage:','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1107,0xcb));var _0x7110=function(_0x150322,_0x2199fb){_0x150322=_0x150322-0x0;var _0x606a08=_0x1107[_0x150322];return _0x606a08;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x7110('0x0'),_0x7110('0x1'),_0x7110('0x2')];function createListener(_0x33d551,_0x4b1220){return function(_0x4696f9){_0x4b1220['emit'](_0x33d551,_0x4696f9);};}function removeListener(_0x27e48f,_0x2f89ca){return function(){FaxMessageEvents[_0x7110('0x3')](_0x27e48f,_0x2f89ca);};}exports['register']=function(_0x24aeb4){for(var _0x4c0ac3=0x0,_0x2aefa3=events['length'];_0x4c0ac3<_0x2aefa3;_0x4c0ac3++){var _0x3038e8=events[_0x4c0ac3];var _0x579fd9=createListener(_0x7110('0x4')+_0x3038e8,_0x24aeb4);FaxMessageEvents['on'](_0x3038e8,_0x579fd9);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ce202b9..3098a86 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 _0x2f68=['/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','put','update','/:id/accept','accept'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x2f68,0x9a));var _0x82f6=function(_0x10947b,_0x57f639){_0x10947b=_0x10947b-0x0;var _0x51843b=_0x2f68[_0x10947b];return _0x51843b;};'use strict';var multer=require('multer');var util=require(_0x82f6('0x0'));var path=require(_0x82f6('0x1'));var timeout=require(_0x82f6('0x2'));var express=require(_0x82f6('0x3'));var router=express['Router']();var fs_extra=require(_0x82f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82f6('0x5'));var config=require(_0x82f6('0x6'));var controller=require('./faxMessage.controller');router[_0x82f6('0x7')]('/',auth[_0x82f6('0x8')](),controller['index']);router['get'](_0x82f6('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x82f6('0x7')](_0x82f6('0xa'),auth[_0x82f6('0x8')](),controller['show']);router[_0x82f6('0x7')](_0x82f6('0xb'),auth['isAuthenticated'](),controller[_0x82f6('0xc')]);router[_0x82f6('0xd')]('/',auth[_0x82f6('0x8')](),interaction[_0x82f6('0xe')](_0x82f6('0xf'),_0x82f6('0x10')),controller['create']);router[_0x82f6('0x11')](_0x82f6('0xa'),auth['isAuthenticated'](),controller[_0x82f6('0x12')]);router[_0x82f6('0x11')](_0x82f6('0x13'),auth[_0x82f6('0x8')](),controller[_0x82f6('0x14')]);router[_0x82f6('0x11')](_0x82f6('0x15'),auth[_0x82f6('0x8')](),controller[_0x82f6('0x16')]);router['delete'](_0x82f6('0xa'),auth['isAuthenticated'](),controller[_0x82f6('0x17')]);module[_0x82f6('0x18')]=router; \ No newline at end of file +var _0xa902=['reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','tracked','faxmessage:create','put','/:id/accept'];(function(_0x4851bf,_0x2713ea){var _0x37a58a=function(_0x26a1fc){while(--_0x26a1fc){_0x4851bf['push'](_0x4851bf['shift']());}};_0x37a58a(++_0x2713ea);}(_0xa902,0x8d));var _0x2a90=function(_0x527c30,_0x2a8feb){_0x527c30=_0x527c30-0x0;var _0x34f2b4=_0xa902[_0x527c30];return _0x34f2b4;};'use strict';var multer=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var path=require(_0x2a90('0x2'));var timeout=require(_0x2a90('0x3'));var express=require(_0x2a90('0x4'));var router=express['Router']();var fs_extra=require(_0x2a90('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a90('0x6'));var controller=require(_0x2a90('0x7'));router[_0x2a90('0x8')]('/',auth[_0x2a90('0x9')](),controller[_0x2a90('0xa')]);router[_0x2a90('0x8')]('/describe',auth[_0x2a90('0x9')](),controller['describe']);router['get'](_0x2a90('0xb'),auth[_0x2a90('0x9')](),controller[_0x2a90('0xc')]);router[_0x2a90('0x8')](_0x2a90('0xd'),auth['isAuthenticated'](),controller[_0x2a90('0xe')]);router[_0x2a90('0xf')]('/',auth[_0x2a90('0x9')](),interaction[_0x2a90('0x10')]('fax',_0x2a90('0x11')),controller['create']);router[_0x2a90('0x12')]('/:id',auth[_0x2a90('0x9')](),controller['update']);router[_0x2a90('0x12')](_0x2a90('0x13'),auth[_0x2a90('0x9')](),controller['accept']);router['put']('/:id/reject',auth[_0x2a90('0x9')](),controller[_0x2a90('0x14')]);router['delete'](_0x2a90('0xb'),auth[_0x2a90('0x9')](),controller[_0x2a90('0x15')]);module[_0x2a90('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a809430..5fef80c 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 _0xe76b=['beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x139565,_0x3c39f8){var _0x3c3ef3=function(_0x3de62c){while(--_0x3de62c){_0x139565['push'](_0x139565['shift']());}};_0x3c3ef3(++_0x3c39f8);}(_0xe76b,0x72));var _0xbe76=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0xe76b[_0xed5f9c];return _0x3a1c43;};'use strict';var Sequelize=require('sequelize');module[_0xbe76('0x0')]={'name':{'type':Sequelize[_0xbe76('0x1')],'unique':_0xbe76('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbe76('0x1')]},'timeout':{'type':Sequelize[_0xbe76('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbe76('0x4')]('rrmemory',_0xbe76('0x5'),_0xbe76('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xbe76('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9cae=['roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x2c506f,_0x40d0d5){var _0x30df57=function(_0x579127){while(--_0x579127){_0x2c506f['push'](_0x2c506f['shift']());}};_0x30df57(++_0x40d0d5);}(_0x9cae,0xeb));var _0xe9ca=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9cae[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe9ca('0x0')]={'name':{'type':Sequelize[_0xe9ca('0x1')],'unique':_0xe9ca('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe9ca('0x1')]},'timeout':{'type':Sequelize[_0xe9ca('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe9ca('0x4')]('rrmemory','beepall',_0xe9ca('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index dec0e55..851f514 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 _0x3076=['order','findAndCountAll','faxPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','ids','User','online','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','update','then','destroy','get','UserProfileResource','name','send','FaxQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','map','VIRTUAL','merge','options','where','includeAll','include','findAll','catch','show','keys','create','body','user','role','userProfileId','autoAssociation','find','params','describe','findOne','UserFaxQueue'];(function(_0x2a2e86,_0x3f4667){var _0x62a078=function(_0x4e33b1){while(--_0x4e33b1){_0x2a2e86['push'](_0x2a2e86['shift']());}};_0x62a078(++_0x3f4667);}(_0x3076,0x13a));var _0x6307=function(_0x4b465e,_0x33ac38){_0x4b465e=_0x4b465e-0x0;var _0x18a693=_0x3076[_0x4b465e];return _0x18a693;};'use strict';var emlformat=require(_0x6307('0x0'));var rimraf=require(_0x6307('0x1'));var zipdir=require(_0x6307('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6307('0x3'));var moment=require(_0x6307('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6307('0x5'));var util=require('util');var path=require(_0x6307('0x6'));var sox=require(_0x6307('0x7'));var csv=require(_0x6307('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6307('0x9'));var _=require(_0x6307('0xa'));var squel=require(_0x6307('0xb'));var crypto=require(_0x6307('0xc'));var jsforce=require(_0x6307('0xd'));var deskjs=require(_0x6307('0xe'));var toCsv=require(_0x6307('0x8'));var querystring=require(_0x6307('0xf'));var Papa=require(_0x6307('0x10'));var Redis=require(_0x6307('0x11'));var authService=require(_0x6307('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6307('0x13'));var hardwareService=require(_0x6307('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6307('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6307('0x16'))['db'];config[_0x6307('0x17')]=_[_0x6307('0x18')](config[_0x6307('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x6307('0x19'))(new Redis(config[_0x6307('0x17')]));require(_0x6307('0x1a'))[_0x6307('0x1b')](socket);function respondWithStatusCode(_0x5f2cf6,_0x24d488){_0x24d488=_0x24d488||0xcc;return function(_0x48314b){if(_0x48314b){return _0x5f2cf6[_0x6307('0x1c')](_0x24d488);}return _0x5f2cf6['status'](_0x24d488)[_0x6307('0x1d')]();};}function respondWithResult(_0x12e208,_0x7d38d6){_0x7d38d6=_0x7d38d6||0xc8;return function(_0x145fbe){if(_0x145fbe){return _0x12e208[_0x6307('0x1e')](_0x7d38d6)['json'](_0x145fbe);}};}function respondWithFilteredResult(_0x359cbd,_0x89259b){return function(_0x1057c5){if(_0x1057c5){var _0x21cee6=typeof _0x89259b['offset']===_0x6307('0x1f')&&typeof _0x89259b[_0x6307('0x20')]===_0x6307('0x1f');var _0x4b39ea=_0x1057c5[_0x6307('0x21')];var _0x3a2173=_0x21cee6?0x0:_0x89259b[_0x6307('0x22')];var _0xae00a4=_0x21cee6?_0x1057c5[_0x6307('0x21')]:_0x89259b[_0x6307('0x22')]+_0x89259b[_0x6307('0x20')];var _0x3c38bf;if(_0xae00a4>=_0x4b39ea){_0xae00a4=_0x4b39ea;_0x3c38bf=0xc8;}else{_0x3c38bf=0xce;}_0x359cbd[_0x6307('0x1e')](_0x3c38bf);return _0x359cbd[_0x6307('0x23')]('Content-Range',_0x3a2173+'-'+_0xae00a4+'/'+_0x4b39ea)['json'](_0x1057c5);}return null;};}function patchUpdates(_0x34d188){return function(_0x40ec4d){try{jsonpatch['apply'](_0x40ec4d,_0x34d188,!![]);}catch(_0x56e870){return BPromise['reject'](_0x56e870);}return _0x40ec4d['save']();};}function saveUpdates(_0x263e8a,_0x129a9b){return function(_0x354a6a){if(_0x354a6a){return _0x354a6a[_0x6307('0x24')](_0x263e8a)[_0x6307('0x25')](function(_0x4fa18d){return _0x4fa18d;});}return null;};}function removeEntity(_0x348156,_0x14bda0){return function(_0x2181c1){if(_0x2181c1){return _0x2181c1[_0x6307('0x26')]()[_0x6307('0x25')](function(){var _0x709b50=_0x2181c1[_0x6307('0x27')]({'plain':!![]});var _0x181dc4='FaxQueues';return db[_0x6307('0x28')][_0x6307('0x26')]({'where':{'type':_0x181dc4,'resourceId':_0x709b50['id']}})[_0x6307('0x25')](function(){return _0x2181c1;});})[_0x6307('0x25')](function(){_0x348156[_0x6307('0x1e')](0xcc)[_0x6307('0x1d')]();});}};}function handleEntityNotFound(_0x4feba6,_0x566ff7){return function(_0x502be2){if(!_0x502be2){_0x4feba6[_0x6307('0x1c')](0x194);}return _0x502be2;};}function handleError(_0x397248,_0x184408){_0x184408=_0x184408||0x1f4;return function(_0x4eaa4f){logger['error'](_0x4eaa4f['stack']);if(_0x4eaa4f[_0x6307('0x29')]){delete _0x4eaa4f[_0x6307('0x29')];}_0x397248[_0x6307('0x1e')](_0x184408)[_0x6307('0x2a')](_0x4eaa4f);};}exports['index']=function(_0x1e8cd4,_0x2a21df){var _0x48d20f={},_0x5f3061={},_0x1e393a={'count':0x0,'rows':[]};var _0x5060b2=_['map'](db[_0x6307('0x2b')][_0x6307('0x2c')],function(_0x551f32){return{'name':_0x551f32[_0x6307('0x2d')],'type':_0x551f32[_0x6307('0x2e')][_0x6307('0x2f')]};});_0x5f3061[_0x6307('0x30')]=_['map'](_0x5060b2,'name');_0x5f3061['query']=_['keys'](_0x1e8cd4[_0x6307('0x31')]);_0x5f3061[_0x6307('0x32')]=_[_0x6307('0x33')](_0x5f3061[_0x6307('0x30')],_0x5f3061[_0x6307('0x31')]);_0x48d20f['attributes']=_[_0x6307('0x33')](_0x5f3061['model'],qs[_0x6307('0x34')](_0x1e8cd4[_0x6307('0x31')][_0x6307('0x34')]));_0x48d20f[_0x6307('0x35')]=_0x48d20f[_0x6307('0x35')][_0x6307('0x36')]?_0x48d20f['attributes']:_0x5f3061[_0x6307('0x30')];if(!_0x1e8cd4[_0x6307('0x31')][_0x6307('0x37')](_0x6307('0x38'))){_0x48d20f[_0x6307('0x20')]=qs[_0x6307('0x20')](_0x1e8cd4[_0x6307('0x31')][_0x6307('0x20')]);_0x48d20f[_0x6307('0x22')]=qs[_0x6307('0x22')](_0x1e8cd4[_0x6307('0x31')]['offset']);}_0x48d20f['order']=qs[_0x6307('0x39')](_0x1e8cd4[_0x6307('0x31')][_0x6307('0x39')]);_0x48d20f['where']=qs[_0x6307('0x32')](_[_0x6307('0x3a')](_0x1e8cd4[_0x6307('0x31')],_0x5f3061['filters']),_0x5060b2);if(_0x1e8cd4['query'][_0x6307('0x3b')]){_0x48d20f['where']=_['merge'](_0x48d20f['where'],{'$or':_[_0x6307('0x3c')](_0x5060b2,function(_0x2af6a0){if(_0x2af6a0[_0x6307('0x2e')]!==_0x6307('0x3d')){var _0x2f166c={};_0x2f166c[_0x2af6a0[_0x6307('0x29')]]={'$like':'%'+_0x1e8cd4[_0x6307('0x31')][_0x6307('0x3b')]+'%'};return _0x2f166c;}})});}_0x48d20f=_[_0x6307('0x3e')]({},_0x48d20f,_0x1e8cd4[_0x6307('0x3f')]);var _0x4d30a3={'where':_0x48d20f[_0x6307('0x40')]};return db[_0x6307('0x2b')]['count'](_0x4d30a3)['then'](function(_0x396228){_0x1e393a['count']=_0x396228;if(_0x1e8cd4[_0x6307('0x31')][_0x6307('0x41')]){_0x48d20f[_0x6307('0x42')]=[{'all':!![]}];}return db[_0x6307('0x2b')][_0x6307('0x43')](_0x48d20f);})[_0x6307('0x25')](function(_0x1df242){_0x1e393a['rows']=_0x1df242;return _0x1e393a;})[_0x6307('0x25')](respondWithFilteredResult(_0x2a21df,_0x48d20f))[_0x6307('0x44')](handleError(_0x2a21df,null));};exports[_0x6307('0x45')]=function(_0x506892,_0x13de61){var _0xce41e9={'raw':!![],'where':{'id':_0x506892['params']['id']}},_0x28d362={};_0x28d362['model']=_[_0x6307('0x46')](db['FaxQueue'][_0x6307('0x2c')]);_0x28d362[_0x6307('0x31')]=_[_0x6307('0x46')](_0x506892[_0x6307('0x31')]);_0x28d362[_0x6307('0x32')]=_['intersection'](_0x28d362['model'],_0x28d362['query']);_0xce41e9[_0x6307('0x35')]=_['intersection'](_0x28d362[_0x6307('0x30')],qs[_0x6307('0x34')](_0x506892[_0x6307('0x31')][_0x6307('0x34')]));_0xce41e9[_0x6307('0x35')]=_0xce41e9[_0x6307('0x35')][_0x6307('0x36')]?_0xce41e9[_0x6307('0x35')]:_0x28d362[_0x6307('0x30')];if(_0x506892[_0x6307('0x31')][_0x6307('0x41')]){_0xce41e9['include']=[{'all':!![]}];}_0xce41e9=_[_0x6307('0x3e')]({},_0xce41e9,_0x506892[_0x6307('0x3f')]);return db[_0x6307('0x2b')]['find'](_0xce41e9)['then'](handleEntityNotFound(_0x13de61,null))[_0x6307('0x25')](respondWithResult(_0x13de61,null))[_0x6307('0x44')](handleError(_0x13de61,null));};exports[_0x6307('0x47')]=function(_0xc18d31,_0x2171da){return db[_0x6307('0x2b')][_0x6307('0x47')](_0xc18d31[_0x6307('0x48')],{})[_0x6307('0x25')](function(_0x66037b){var _0x4f170d=_0xc18d31[_0x6307('0x49')]['get']({'plain':!![]});if(!_0x4f170d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f170d[_0x6307('0x4a')]===_0x6307('0x49')){var _0x2b2944=_0x66037b[_0x6307('0x27')]({'plain':!![]});var _0x2707b9='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x2707b9,'userProfileId':_0x4f170d[_0x6307('0x4b')]},'raw':!![]})[_0x6307('0x25')](function(_0x3469ce){if(_0x3469ce&&_0x3469ce[_0x6307('0x4c')]===0x0){return db[_0x6307('0x28')]['create']({'name':_0x2b2944[_0x6307('0x29')],'resourceId':_0x2b2944['id'],'type':_0x3469ce['name'],'sectionId':_0x3469ce['id']},{})[_0x6307('0x25')](function(){return _0x66037b;});}else{return _0x66037b;}})[_0x6307('0x44')](function(_0x4a2a08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a2a08);throw _0x4a2a08;});}return _0x66037b;})[_0x6307('0x25')](respondWithResult(_0x2171da,0xc9))[_0x6307('0x44')](handleError(_0x2171da,null));};exports[_0x6307('0x24')]=function(_0x10da41,_0x1f91dd){if(_0x10da41['body']['id']){delete _0x10da41['body']['id'];}return db['FaxQueue']['find']({'where':{'id':_0x10da41['params']['id']}})[_0x6307('0x25')](handleEntityNotFound(_0x1f91dd,null))['then'](saveUpdates(_0x10da41[_0x6307('0x48')],null))[_0x6307('0x25')](respondWithResult(_0x1f91dd,null))[_0x6307('0x44')](handleError(_0x1f91dd,null));};exports[_0x6307('0x26')]=function(_0x496ec8,_0x267b61){return db[_0x6307('0x2b')][_0x6307('0x4d')]({'where':{'id':_0x496ec8[_0x6307('0x4e')]['id']}})[_0x6307('0x25')](handleEntityNotFound(_0x267b61,null))[_0x6307('0x25')](removeEntity(_0x267b61,null))[_0x6307('0x44')](handleError(_0x267b61,null));};exports[_0x6307('0x4f')]=function(_0x575623,_0x5c49fd){return db[_0x6307('0x2b')]['describe']()[_0x6307('0x25')](respondWithResult(_0x5c49fd,null))[_0x6307('0x44')](handleError(_0x5c49fd,null));};exports['getMembers']=function(_0x3fa165,_0x3d2f2d,_0x374556){var _0x2db4f2={'raw':!![],'where':{}},_0x492e82={},_0x30e942;return db[_0x6307('0x2b')][_0x6307('0x50')]({'where':{'id':_0x3fa165['params']['id']}})[_0x6307('0x25')](handleEntityNotFound(_0x3d2f2d,null))[_0x6307('0x25')](function(_0x3ba3e3){if(_0x3ba3e3){_0x30e942=_0x3ba3e3['get']({'plain':!![]});_0x492e82[_0x6307('0x30')]=_[_0x6307('0x46')](db[_0x6307('0x51')][_0x6307('0x2c')]);_0x492e82[_0x6307('0x31')]=_[_0x6307('0x46')](_0x3fa165[_0x6307('0x31')]);_0x492e82['filters']=_[_0x6307('0x33')](_0x492e82[_0x6307('0x30')],_0x492e82[_0x6307('0x31')]);_0x2db4f2[_0x6307('0x35')]=_[_0x6307('0x33')](_0x492e82['model'],qs[_0x6307('0x34')](_0x3fa165[_0x6307('0x31')][_0x6307('0x34')]));_0x2db4f2[_0x6307('0x35')]=_0x2db4f2['attributes'][_0x6307('0x36')]?_0x2db4f2['attributes']:_0x492e82[_0x6307('0x30')];if(!_0x3fa165['query'][_0x6307('0x37')]('nolimit')){_0x2db4f2[_0x6307('0x20')]=qs[_0x6307('0x20')](_0x3fa165['query'][_0x6307('0x20')]);_0x2db4f2[_0x6307('0x22')]=qs[_0x6307('0x22')](_0x3fa165['query'][_0x6307('0x22')]);}_0x2db4f2[_0x6307('0x52')]=qs[_0x6307('0x39')](_0x3fa165[_0x6307('0x31')][_0x6307('0x39')]);_0x2db4f2['where']=qs[_0x6307('0x32')](_[_0x6307('0x3a')](_0x3fa165['query'],_0x492e82[_0x6307('0x32')]));_0x2db4f2[_0x6307('0x40')]['FaxQueueId']=_0x3ba3e3['id'];if(_0x3fa165[_0x6307('0x31')][_0x6307('0x3b')]){_0x2db4f2[_0x6307('0x40')]=_[_0x6307('0x3e')](_0x2db4f2[_0x6307('0x40')],{'$or':_[_0x6307('0x3c')](_0x2db4f2[_0x6307('0x35')],function(_0x3a15e8){var _0x1d0411={};_0x1d0411[_0x3a15e8]={'$like':'%'+_0x3fa165[_0x6307('0x31')][_0x6307('0x3b')]+'%'};return _0x1d0411;})});}_0x2db4f2=_[_0x6307('0x3e')]({},_0x2db4f2,_0x3fa165['options']);return db[_0x6307('0x51')][_0x6307('0x43')](_0x2db4f2);}})[_0x6307('0x25')](function(_0xa45a7c){if(_0xa45a7c){return db['User'][_0x6307('0x53')]({'where':{'id':_[_0x6307('0x3c')](_0xa45a7c,'UserId'),'role':'agent'},'attributes':['id',_0x6307('0x29'),_0x6307('0x54'),_0x6307('0x55'),_0x6307('0x56')]});}})[_0x6307('0x25')](function(_0x578d25){if(_0x578d25){return{'count':_0x578d25[_0x6307('0x21')],'rows':_[_0x6307('0x3c')](_0x578d25[_0x6307('0x57')],function(_0x1e869e){return{'membername':_0x1e869e[_0x6307('0x29')],'UserId':_0x1e869e['id'],'queue_name':_0x30e942[_0x6307('0x29')],'FaxQueueId':_0x30e942['id'],'interface':util[_0x6307('0x58')](_0x6307('0x59'),'SIP',_0x1e869e[_0x6307('0x29')]),'penalty':0x0,'paused':_0x1e869e[_0x6307('0x54')],'createdAt':_0x1e869e[_0x6307('0x56')],'updatedAt':_0x1e869e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3d2f2d,_0x2db4f2))[_0x6307('0x44')](handleError(_0x3d2f2d,null));};exports[_0x6307('0x5a')]=function(_0x468aa8,_0x550573,_0x4e2369){var _0x224ff3={};var _0x3dac89={};var _0x44a064;var _0x321f29;return db[_0x6307('0x2b')]['findOne']({'where':{'id':_0x468aa8[_0x6307('0x4e')]['id']}})[_0x6307('0x25')](handleEntityNotFound(_0x550573,null))[_0x6307('0x25')](function(_0x726854){if(_0x726854){_0x44a064=_0x726854;_0x3dac89[_0x6307('0x30')]=_[_0x6307('0x46')](db[_0x6307('0x5b')]['rawAttributes']);_0x3dac89[_0x6307('0x31')]=_[_0x6307('0x46')](_0x468aa8[_0x6307('0x31')]);_0x3dac89[_0x6307('0x32')]=_[_0x6307('0x33')](_0x3dac89[_0x6307('0x30')],_0x3dac89[_0x6307('0x31')]);_0x224ff3['attributes']=_[_0x6307('0x33')](_0x3dac89['model'],qs[_0x6307('0x34')](_0x468aa8[_0x6307('0x31')][_0x6307('0x34')]));_0x224ff3['attributes']=_0x224ff3[_0x6307('0x35')]['length']?_0x224ff3[_0x6307('0x35')]:_0x3dac89[_0x6307('0x30')];_0x224ff3['order']=qs[_0x6307('0x39')](_0x468aa8[_0x6307('0x31')][_0x6307('0x39')]);_0x224ff3[_0x6307('0x40')]=qs[_0x6307('0x32')](_[_0x6307('0x3a')](_0x468aa8[_0x6307('0x31')],_0x3dac89[_0x6307('0x32')]));if(_0x468aa8[_0x6307('0x31')][_0x6307('0x3b')]){_0x224ff3[_0x6307('0x40')]=_[_0x6307('0x3e')](_0x224ff3[_0x6307('0x40')],{'$or':_['map'](_0x224ff3['attributes'],function(_0x3c7ebb){var _0x4ebcbb={};_0x4ebcbb[_0x3c7ebb]={'$like':'%'+_0x468aa8[_0x6307('0x31')][_0x6307('0x3b')]+'%'};return _0x4ebcbb;})});}_0x224ff3=_['merge']({},_0x224ff3,_0x468aa8['options']);return _0x44a064[_0x6307('0x5a')](_0x224ff3);}})['then'](function(_0x21adde){if(_0x21adde){_0x321f29=_0x21adde[_0x6307('0x36')];if(!_0x468aa8['query'][_0x6307('0x37')](_0x6307('0x38'))){_0x224ff3[_0x6307('0x20')]=qs[_0x6307('0x20')](_0x468aa8[_0x6307('0x31')]['limit']);_0x224ff3[_0x6307('0x22')]=qs[_0x6307('0x22')](_0x468aa8[_0x6307('0x31')][_0x6307('0x22')]);}return _0x44a064[_0x6307('0x5a')](_0x224ff3);}})['then'](function(_0x260def){if(_0x260def){return _0x260def?{'count':_0x321f29,'rows':_0x260def}:null;}})[_0x6307('0x25')](respondWithResult(_0x550573,null))['catch'](handleError(_0x550573,null));};exports['addTeams']=function(_0x9eee26,_0x5b5dfa,_0x32bca8){var _0x354b55=_0x9eee26[_0x6307('0x48')][_0x6307('0x5c')];return db['Team'][_0x6307('0x43')]({'where':{'id':_0x354b55},'attributes':['id'],'include':[{'model':db[_0x6307('0x5d')],'as':'Agents','attributes':['id',_0x6307('0x29'),_0x6307('0x5e'),'voicePause',_0x6307('0x5f')],'raw':!![]}]})['then'](function(_0x1cf9fc){if(_0x1cf9fc){var _0x2c8166=_[_0x6307('0x60')](_0x1cf9fc,function(_0xf68e0){var _0x931c68=_0xf68e0[_0x6307('0x27')]({'plain':!![]});return _0x931c68[_0x6307('0x61')];});return db[_0x6307('0x2b')][_0x6307('0x4d')]({'where':{'id':_0x9eee26[_0x6307('0x4e')]['id']}})[_0x6307('0x25')](function(_0x4f435c){return db[_0x6307('0x62')][_0x6307('0x63')](function(_0x3cd040){return _0x4f435c[_0x6307('0x64')](_0x354b55,{'transaction':_0x3cd040})[_0x6307('0x25')](function(){return BPromise[_0x6307('0x65')](_0x2c8166,function(_0x5b8c29){return db[_0x6307('0x51')][_0x6307('0x66')]({'where':{'UserId':_0x5b8c29['id'],'FaxQueueId':_0x9eee26[_0x6307('0x4e')]['id']},'transaction':_0x3cd040});});})[_0x6307('0x25')](function(){_0x2c8166[_0x6307('0x67')](function(_0x11b9b0){socket[_0x6307('0x68')]('userFaxQueue:save',{'UserId':_0x11b9b0['id'],'FaxQueueId':_0x4f435c['id']});});});});});}})[_0x6307('0x25')](respondWithStatusCode(_0x5b5dfa,null))['catch'](handleError(_0x5b5dfa,null));};exports[_0x6307('0x69')]=function(_0x16d415,_0x35954c,_0xb57576){return db[_0x6307('0x5b')]['findAll']({'where':{'id':_0x16d415['query'][_0x6307('0x5c')]},'attributes':['id'],'include':[{'model':db[_0x6307('0x5d')],'as':_0x6307('0x61'),'attributes':['id'],'raw':!![]}]})[_0x6307('0x25')](handleEntityNotFound(_0x35954c,null))['then'](function(_0x4164aa){var _0x41fb05=_[_0x6307('0x3c')](_0x4164aa,'id');var _0x3d4cea=[];var _0x596994=[];var _0x4920b6=squel['select']();_0x4920b6[_0x6307('0x6a')]('tq.TeamId')[_0x6307('0x6b')](_0x6307('0x6c'),'tq')[_0x6307('0x6d')](_0x6307('0x6e'),'ut',_0x6307('0x6f'))[_0x6307('0x40')](_0x6307('0x70'),_0x16d415[_0x6307('0x4e')]['id']);for(var _0x1b20d9=0x0;_0x1b20d9<_0x4164aa[_0x6307('0x36')];_0x1b20d9+=0x1){let _0x2c1a2d=_0x4164aa[_0x1b20d9];for(var _0x15392f=0x0;_0x15392f<_0x2c1a2d[_0x6307('0x61')][_0x6307('0x36')];_0x15392f+=0x1){let _0xe67ad0=_0x2c1a2d[_0x6307('0x61')][_0x15392f];var _0x25ef48=_0x4920b6[_0x6307('0x71')]();_0x25ef48['where'](_0x6307('0x72'),_0xe67ad0['id']);_0x596994[_0x6307('0x73')](db[_0x6307('0x62')]['query'](_0x25ef48[_0x6307('0x74')](),{'type':db[_0x6307('0x62')][_0x6307('0x75')]['SELECT']})[_0x6307('0x25')](function(_0x33e401){if(_0x33e401[_0x6307('0x36')]===0x1){return _0xe67ad0['id'];}else{var _0x18e009=_[_0x6307('0x76')](_[_0x6307('0x3c')](_0x33e401,'TeamId'),function(_0xfd05d7){return _['includes'](_0x41fb05,_0xfd05d7);});if(_0x18e009){return _0xe67ad0['id'];}}}));}}return BPromise[_0x6307('0x77')](_0x596994)[_0x6307('0x25')](function(_0x4fc824){_0x3d4cea=_(_0x3d4cea)[_0x6307('0x78')](_0x4fc824)[_0x6307('0x79')]()[_0x6307('0x7a')]();return db[_0x6307('0x2b')][_0x6307('0x4d')]({'where':{'id':_0x16d415[_0x6307('0x4e')]['id']}})['then'](function(_0x549437){return db[_0x6307('0x62')]['transaction'](function(_0x52bb31){return _0x549437[_0x6307('0x69')](_0x16d415[_0x6307('0x31')][_0x6307('0x5c')],{'transaction':_0x52bb31})[_0x6307('0x25')](function(){if(!_[_0x6307('0x7b')](_0x3d4cea)){return _0x549437['removeAgents'](_0x3d4cea,{'transaction':_0x52bb31});}})[_0x6307('0x25')](function(){_0x3d4cea[_0x6307('0x67')](function(_0x40d524){socket[_0x6307('0x68')](_0x6307('0x7c'),{'UserId':_0x40d524,'FaxQueueId':_0x549437['id']});});});});});});})[_0x6307('0x25')](respondWithStatusCode(_0x35954c,null))[_0x6307('0x44')](handleError(_0x35954c,null));};exports['addAgents']=function(_0x52d2f2,_0x345f36,_0x4d9a69){return db[_0x6307('0x2b')][_0x6307('0x4d')]({'where':{'id':_0x52d2f2[_0x6307('0x4e')]['id']}})['then'](handleEntityNotFound(_0x345f36,null))['then'](function(_0x3e6982){if(_0x3e6982){return _0x3e6982[_0x6307('0x7d')](_0x52d2f2[_0x6307('0x48')][_0x6307('0x5c')],_[_0x6307('0x7e')](_0x52d2f2[_0x6307('0x48')],['ids','id'])||{})[_0x6307('0x7f')](function(_0x3a7533){for(var _0x26bd75=0x0;_0x26bd75<_0x52d2f2[_0x6307('0x48')][_0x6307('0x5c')][_0x6307('0x36')];_0x26bd75+=0x1){socket[_0x6307('0x68')](_0x6307('0x80'),{'UserId':Number(_0x52d2f2[_0x6307('0x48')]['ids'][_0x26bd75]),'FaxQueueId':Number(_0x52d2f2['params']['id'])});}return _0x3a7533;});}})['then'](respondWithResult(_0x345f36,null))[_0x6307('0x44')](handleError(_0x345f36,null));};exports[_0x6307('0x81')]=function(_0x214356,_0x7195e0,_0x38231d){return db[_0x6307('0x2b')][_0x6307('0x4d')]({'where':{'id':_0x214356[_0x6307('0x4e')]['id']}})[_0x6307('0x25')](handleEntityNotFound(_0x7195e0,null))[_0x6307('0x25')](function(_0x1c3670){if(_0x1c3670){return _0x1c3670[_0x6307('0x81')](_0x214356[_0x6307('0x31')]['ids'])[_0x6307('0x25')](function(){if(_[_0x6307('0x82')](_0x214356[_0x6307('0x31')][_0x6307('0x5c')])){for(var _0x1fd1c9=0x0;_0x1fd1c9<_0x214356['query'][_0x6307('0x5c')][_0x6307('0x36')];_0x1fd1c9+=0x1){socket[_0x6307('0x68')](_0x6307('0x7c'),{'UserId':Number(_0x214356['query']['ids'][_0x1fd1c9]),'FaxQueueId':Number(_0x214356[_0x6307('0x4e')]['id'])});}}else{socket[_0x6307('0x68')](_0x6307('0x7c'),{'UserId':Number(_0x214356[_0x6307('0x31')][_0x6307('0x5c')]),'FaxQueueId':Number(_0x214356[_0x6307('0x4e')]['id'])});}});}})[_0x6307('0x25')](respondWithStatusCode(_0x7195e0,null))[_0x6307('0x44')](handleError(_0x7195e0,null));};exports[_0x6307('0x83')]=function(_0x2c3921,_0x554e10,_0x20fbd2){var _0xef5dd9={};var _0x34099f={};var _0x24c408;var _0x1da7bf;return db[_0x6307('0x2b')][_0x6307('0x50')]({'where':{'id':_0x2c3921[_0x6307('0x4e')]['id']}})[_0x6307('0x25')](handleEntityNotFound(_0x554e10,null))[_0x6307('0x25')](function(_0x138f6c){if(_0x138f6c){_0x24c408=_0x138f6c;_0x34099f[_0x6307('0x30')]=_[_0x6307('0x46')](db['User'][_0x6307('0x2c')]);_0x34099f[_0x6307('0x31')]=_[_0x6307('0x46')](_0x2c3921[_0x6307('0x31')]);_0x34099f[_0x6307('0x32')]=_[_0x6307('0x33')](_0x34099f['model'],_0x34099f[_0x6307('0x31')]);_0xef5dd9['attributes']=_['intersection'](_0x34099f[_0x6307('0x30')],qs[_0x6307('0x34')](_0x2c3921[_0x6307('0x31')][_0x6307('0x34')]));_0xef5dd9[_0x6307('0x35')]=_0xef5dd9['attributes'][_0x6307('0x36')]?_0xef5dd9[_0x6307('0x35')]:_0x34099f[_0x6307('0x30')];_0xef5dd9[_0x6307('0x52')]=qs[_0x6307('0x39')](_0x2c3921[_0x6307('0x31')][_0x6307('0x39')]);_0xef5dd9[_0x6307('0x40')]=qs[_0x6307('0x32')](_['pick'](_0x2c3921[_0x6307('0x31')],_0x34099f[_0x6307('0x32')]));if(_0x2c3921['query'][_0x6307('0x3b')]){_0xef5dd9[_0x6307('0x40')]=_[_0x6307('0x3e')](_0xef5dd9[_0x6307('0x40')],{'$or':_[_0x6307('0x3c')](_0xef5dd9[_0x6307('0x35')],function(_0x4e4702){var _0xccf7c4={};_0xccf7c4[_0x4e4702]={'$like':'%'+_0x2c3921['query'][_0x6307('0x3b')]+'%'};return _0xccf7c4;})});}_0xef5dd9=_[_0x6307('0x3e')]({},_0xef5dd9,_0x2c3921[_0x6307('0x3f')]);return _0x24c408[_0x6307('0x83')](_0xef5dd9);}})[_0x6307('0x25')](function(_0x3f3b1f){if(_0x3f3b1f){_0x1da7bf=_0x3f3b1f['length'];if(!_0x2c3921[_0x6307('0x31')][_0x6307('0x37')](_0x6307('0x38'))){_0xef5dd9[_0x6307('0x20')]=qs[_0x6307('0x20')](_0x2c3921[_0x6307('0x31')][_0x6307('0x20')]);_0xef5dd9[_0x6307('0x22')]=qs['offset'](_0x2c3921[_0x6307('0x31')][_0x6307('0x22')]);}return _0x24c408[_0x6307('0x83')](_0xef5dd9);}})[_0x6307('0x25')](function(_0x1495d6){if(_0x1495d6){return _0x1495d6?{'count':_0x1da7bf,'rows':_0x1495d6}:null;}})['then'](respondWithResult(_0x554e10,null))[_0x6307('0x44')](handleError(_0x554e10,null));}; \ No newline at end of file +var _0x3976=['getMembers','findOne','nolimit','FaxQueueId','UserFaxQueue','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','emit','userFaxQueue:save','removeTeams','Team','User','select','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','value','transaction','isEmpty','removeAgents','forEach','addAgents','spread','isArray','getAgents','eml-format','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/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','FaxQueue','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','describe'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0x3976,0xc4));var _0x6397=function(_0x19b6d7,_0x41130d){_0x19b6d7=_0x19b6d7-0x0;var _0x5ee0d5=_0x3976[_0x19b6d7];return _0x5ee0d5;};'use strict';var emlformat=require(_0x6397('0x0'));var rimraf=require(_0x6397('0x1'));var zipdir=require(_0x6397('0x2'));var jsonpatch=require(_0x6397('0x3'));var rp=require(_0x6397('0x4'));var moment=require(_0x6397('0x5'));var BPromise=require(_0x6397('0x6'));var Mustache=require('mustache');var util=require(_0x6397('0x7'));var path=require(_0x6397('0x8'));var sox=require(_0x6397('0x9'));var csv=require(_0x6397('0xa'));var ejs=require(_0x6397('0xb'));var fs=require('fs');var fs_extra=require(_0x6397('0xc'));var _=require(_0x6397('0xd'));var squel=require(_0x6397('0xe'));var crypto=require(_0x6397('0xf'));var jsforce=require(_0x6397('0x10'));var deskjs=require(_0x6397('0x11'));var toCsv=require(_0x6397('0xa'));var querystring=require(_0x6397('0x12'));var Papa=require(_0x6397('0x13'));var Redis=require(_0x6397('0x14'));var authService=require(_0x6397('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x6397('0x16'));var hardwareService=require(_0x6397('0x17'));var logger=require(_0x6397('0x18'))(_0x6397('0x19'));var utils=require(_0x6397('0x1a'));var config=require(_0x6397('0x1b'));var licenseUtil=require(_0x6397('0x1c'));var db=require(_0x6397('0x1d'))['db'];config[_0x6397('0x1e')]=_['defaults'](config['redis'],{'host':_0x6397('0x1f'),'port':0x18eb});var socket=require(_0x6397('0x20'))(new Redis(config[_0x6397('0x1e')]));require(_0x6397('0x21'))[_0x6397('0x22')](socket);function respondWithStatusCode(_0x5d6def,_0x3c7b39){_0x3c7b39=_0x3c7b39||0xcc;return function(_0x24585b){if(_0x24585b){return _0x5d6def[_0x6397('0x23')](_0x3c7b39);}return _0x5d6def[_0x6397('0x24')](_0x3c7b39)[_0x6397('0x25')]();};}function respondWithResult(_0x3b466b,_0x14287c){_0x14287c=_0x14287c||0xc8;return function(_0x299acb){if(_0x299acb){return _0x3b466b[_0x6397('0x24')](_0x14287c)[_0x6397('0x26')](_0x299acb);}};}function respondWithFilteredResult(_0x370f4f,_0xcf8958){return function(_0x518ec9){if(_0x518ec9){var _0x2f63a3=typeof _0xcf8958['offset']===_0x6397('0x27')&&typeof _0xcf8958[_0x6397('0x28')]===_0x6397('0x27');var _0x597924=_0x518ec9[_0x6397('0x29')];var _0x1bcdc9=_0x2f63a3?0x0:_0xcf8958[_0x6397('0x2a')];var _0x493014=_0x2f63a3?_0x518ec9['count']:_0xcf8958[_0x6397('0x2a')]+_0xcf8958[_0x6397('0x28')];var _0x2d86f3;if(_0x493014>=_0x597924){_0x493014=_0x597924;_0x2d86f3=0xc8;}else{_0x2d86f3=0xce;}_0x370f4f[_0x6397('0x24')](_0x2d86f3);return _0x370f4f[_0x6397('0x2b')](_0x6397('0x2c'),_0x1bcdc9+'-'+_0x493014+'/'+_0x597924)[_0x6397('0x26')](_0x518ec9);}return null;};}function patchUpdates(_0x5289df){return function(_0xdaaba6){try{jsonpatch[_0x6397('0x2d')](_0xdaaba6,_0x5289df,!![]);}catch(_0x4e7c88){return BPromise['reject'](_0x4e7c88);}return _0xdaaba6['save']();};}function saveUpdates(_0x50272a,_0xd6cd26){return function(_0xba4690){if(_0xba4690){return _0xba4690[_0x6397('0x2e')](_0x50272a)['then'](function(_0x2b491f){return _0x2b491f;});}return null;};}function removeEntity(_0x4984db,_0x2cc56c){return function(_0x5c7749){if(_0x5c7749){return _0x5c7749['destroy']()[_0x6397('0x2f')](function(){var _0x28f6c0=_0x5c7749[_0x6397('0x30')]({'plain':!![]});var _0x56a594=_0x6397('0x31');return db[_0x6397('0x32')]['destroy']({'where':{'type':_0x56a594,'resourceId':_0x28f6c0['id']}})[_0x6397('0x2f')](function(){return _0x5c7749;});})['then'](function(){_0x4984db[_0x6397('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d7c7,_0x33a813){return function(_0x13a046){if(!_0x13a046){_0x23d7c7[_0x6397('0x23')](0x194);}return _0x13a046;};}function handleError(_0x3cedd3,_0x832178){_0x832178=_0x832178||0x1f4;return function(_0x2928de){logger[_0x6397('0x33')](_0x2928de[_0x6397('0x34')]);if(_0x2928de[_0x6397('0x35')]){delete _0x2928de[_0x6397('0x35')];}_0x3cedd3[_0x6397('0x24')](_0x832178)[_0x6397('0x36')](_0x2928de);};}exports[_0x6397('0x37')]=function(_0x272e5e,_0x2efc7d){var _0x58dbef={},_0x8a7415={},_0x190940={'count':0x0,'rows':[]};var _0x1f04db=_[_0x6397('0x38')](db['FaxQueue'][_0x6397('0x39')],function(_0x221fdc){return{'name':_0x221fdc[_0x6397('0x3a')],'type':_0x221fdc['type'][_0x6397('0x3b')]};});_0x8a7415[_0x6397('0x3c')]=_[_0x6397('0x38')](_0x1f04db,_0x6397('0x35'));_0x8a7415[_0x6397('0x3d')]=_['keys'](_0x272e5e[_0x6397('0x3d')]);_0x8a7415[_0x6397('0x3e')]=_[_0x6397('0x3f')](_0x8a7415[_0x6397('0x3c')],_0x8a7415[_0x6397('0x3d')]);_0x58dbef['attributes']=_[_0x6397('0x3f')](_0x8a7415['model'],qs['fields'](_0x272e5e[_0x6397('0x3d')][_0x6397('0x40')]));_0x58dbef[_0x6397('0x41')]=_0x58dbef['attributes']['length']?_0x58dbef[_0x6397('0x41')]:_0x8a7415['model'];if(!_0x272e5e['query'][_0x6397('0x42')]('nolimit')){_0x58dbef[_0x6397('0x28')]=qs[_0x6397('0x28')](_0x272e5e[_0x6397('0x3d')]['limit']);_0x58dbef['offset']=qs[_0x6397('0x2a')](_0x272e5e[_0x6397('0x3d')]['offset']);}_0x58dbef[_0x6397('0x43')]=qs[_0x6397('0x44')](_0x272e5e[_0x6397('0x3d')]['sort']);_0x58dbef[_0x6397('0x45')]=qs[_0x6397('0x3e')](_[_0x6397('0x46')](_0x272e5e[_0x6397('0x3d')],_0x8a7415[_0x6397('0x3e')]),_0x1f04db);if(_0x272e5e[_0x6397('0x3d')][_0x6397('0x47')]){_0x58dbef[_0x6397('0x45')]=_[_0x6397('0x48')](_0x58dbef['where'],{'$or':_[_0x6397('0x38')](_0x1f04db,function(_0x42e4f8){if(_0x42e4f8[_0x6397('0x49')]!=='VIRTUAL'){var _0x4fb235={};_0x4fb235[_0x42e4f8[_0x6397('0x35')]]={'$like':'%'+_0x272e5e[_0x6397('0x3d')]['filter']+'%'};return _0x4fb235;}})});}_0x58dbef=_['merge']({},_0x58dbef,_0x272e5e[_0x6397('0x4a')]);var _0x603e01={'where':_0x58dbef[_0x6397('0x45')]};return db[_0x6397('0x4b')][_0x6397('0x29')](_0x603e01)[_0x6397('0x2f')](function(_0x31e5c2){_0x190940[_0x6397('0x29')]=_0x31e5c2;if(_0x272e5e[_0x6397('0x3d')][_0x6397('0x4c')]){_0x58dbef[_0x6397('0x4d')]=[{'all':!![]}];}return db[_0x6397('0x4b')][_0x6397('0x4e')](_0x58dbef);})['then'](function(_0x3e8f59){_0x190940[_0x6397('0x4f')]=_0x3e8f59;return _0x190940;})[_0x6397('0x2f')](respondWithFilteredResult(_0x2efc7d,_0x58dbef))[_0x6397('0x50')](handleError(_0x2efc7d,null));};exports['show']=function(_0x8db62a,_0x42db33){var _0x3e5f19={'raw':!![],'where':{'id':_0x8db62a[_0x6397('0x51')]['id']}},_0x55a13e={};_0x55a13e[_0x6397('0x3c')]=_['keys'](db['FaxQueue']['rawAttributes']);_0x55a13e[_0x6397('0x3d')]=_[_0x6397('0x52')](_0x8db62a[_0x6397('0x3d')]);_0x55a13e[_0x6397('0x3e')]=_['intersection'](_0x55a13e[_0x6397('0x3c')],_0x55a13e[_0x6397('0x3d')]);_0x3e5f19[_0x6397('0x41')]=_[_0x6397('0x3f')](_0x55a13e[_0x6397('0x3c')],qs[_0x6397('0x40')](_0x8db62a[_0x6397('0x3d')]['fields']));_0x3e5f19[_0x6397('0x41')]=_0x3e5f19[_0x6397('0x41')][_0x6397('0x53')]?_0x3e5f19['attributes']:_0x55a13e[_0x6397('0x3c')];if(_0x8db62a[_0x6397('0x3d')][_0x6397('0x4c')]){_0x3e5f19[_0x6397('0x4d')]=[{'all':!![]}];}_0x3e5f19=_[_0x6397('0x48')]({},_0x3e5f19,_0x8db62a[_0x6397('0x4a')]);return db[_0x6397('0x4b')][_0x6397('0x54')](_0x3e5f19)[_0x6397('0x2f')](handleEntityNotFound(_0x42db33,null))['then'](respondWithResult(_0x42db33,null))[_0x6397('0x50')](handleError(_0x42db33,null));};exports['create']=function(_0x4c22fc,_0x5e8a13){return db[_0x6397('0x4b')][_0x6397('0x55')](_0x4c22fc[_0x6397('0x56')],{})['then'](function(_0xc9abdb){var _0x13ac9f=_0x4c22fc[_0x6397('0x57')]['get']({'plain':!![]});if(!_0x13ac9f)throw new Error(_0x6397('0x58'));if(_0x13ac9f['role']===_0x6397('0x57')){var _0x59b4b6=_0xc9abdb[_0x6397('0x30')]({'plain':!![]});var _0x44bff5=_0x6397('0x31');return db[_0x6397('0x59')]['find']({'where':{'name':_0x44bff5,'userProfileId':_0x13ac9f[_0x6397('0x5a')]},'raw':!![]})[_0x6397('0x2f')](function(_0xc84f8a){if(_0xc84f8a&&_0xc84f8a['autoAssociation']===0x0){return db[_0x6397('0x32')]['create']({'name':_0x59b4b6[_0x6397('0x35')],'resourceId':_0x59b4b6['id'],'type':_0xc84f8a[_0x6397('0x35')],'sectionId':_0xc84f8a['id']},{})[_0x6397('0x2f')](function(){return _0xc9abdb;});}else{return _0xc9abdb;}})[_0x6397('0x50')](function(_0x15e3e7){logger[_0x6397('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15e3e7);throw _0x15e3e7;});}return _0xc9abdb;})[_0x6397('0x2f')](respondWithResult(_0x5e8a13,0xc9))['catch'](handleError(_0x5e8a13,null));};exports[_0x6397('0x2e')]=function(_0x1ae64a,_0x5b39ef){if(_0x1ae64a[_0x6397('0x56')]['id']){delete _0x1ae64a[_0x6397('0x56')]['id'];}return db[_0x6397('0x4b')]['find']({'where':{'id':_0x1ae64a[_0x6397('0x51')]['id']}})[_0x6397('0x2f')](handleEntityNotFound(_0x5b39ef,null))[_0x6397('0x2f')](saveUpdates(_0x1ae64a['body'],null))[_0x6397('0x2f')](respondWithResult(_0x5b39ef,null))[_0x6397('0x50')](handleError(_0x5b39ef,null));};exports['destroy']=function(_0x43cac2,_0x62ce7f){return db['FaxQueue']['find']({'where':{'id':_0x43cac2['params']['id']}})['then'](handleEntityNotFound(_0x62ce7f,null))[_0x6397('0x2f')](removeEntity(_0x62ce7f,null))[_0x6397('0x50')](handleError(_0x62ce7f,null));};exports['describe']=function(_0x359e21,_0x35488e){return db[_0x6397('0x4b')][_0x6397('0x5b')]()[_0x6397('0x2f')](respondWithResult(_0x35488e,null))[_0x6397('0x50')](handleError(_0x35488e,null));};exports[_0x6397('0x5c')]=function(_0x5204e8,_0x14b448,_0x381ede){var _0xa14289={'raw':!![],'where':{}},_0x4d9447={},_0xc5514;return db[_0x6397('0x4b')][_0x6397('0x5d')]({'where':{'id':_0x5204e8[_0x6397('0x51')]['id']}})['then'](handleEntityNotFound(_0x14b448,null))['then'](function(_0x31f754){if(_0x31f754){_0xc5514=_0x31f754[_0x6397('0x30')]({'plain':!![]});_0x4d9447[_0x6397('0x3c')]=_[_0x6397('0x52')](db['UserFaxQueue'][_0x6397('0x39')]);_0x4d9447['query']=_[_0x6397('0x52')](_0x5204e8[_0x6397('0x3d')]);_0x4d9447[_0x6397('0x3e')]=_[_0x6397('0x3f')](_0x4d9447[_0x6397('0x3c')],_0x4d9447['query']);_0xa14289[_0x6397('0x41')]=_[_0x6397('0x3f')](_0x4d9447[_0x6397('0x3c')],qs[_0x6397('0x40')](_0x5204e8[_0x6397('0x3d')][_0x6397('0x40')]));_0xa14289[_0x6397('0x41')]=_0xa14289[_0x6397('0x41')][_0x6397('0x53')]?_0xa14289[_0x6397('0x41')]:_0x4d9447[_0x6397('0x3c')];if(!_0x5204e8['query'][_0x6397('0x42')](_0x6397('0x5e'))){_0xa14289[_0x6397('0x28')]=qs[_0x6397('0x28')](_0x5204e8[_0x6397('0x3d')][_0x6397('0x28')]);_0xa14289[_0x6397('0x2a')]=qs['offset'](_0x5204e8[_0x6397('0x3d')][_0x6397('0x2a')]);}_0xa14289['order']=qs[_0x6397('0x44')](_0x5204e8[_0x6397('0x3d')][_0x6397('0x44')]);_0xa14289[_0x6397('0x45')]=qs['filters'](_['pick'](_0x5204e8['query'],_0x4d9447[_0x6397('0x3e')]));_0xa14289[_0x6397('0x45')][_0x6397('0x5f')]=_0x31f754['id'];if(_0x5204e8['query'][_0x6397('0x47')]){_0xa14289[_0x6397('0x45')]=_[_0x6397('0x48')](_0xa14289[_0x6397('0x45')],{'$or':_[_0x6397('0x38')](_0xa14289[_0x6397('0x41')],function(_0x571648){var _0xed18a4={};_0xed18a4[_0x571648]={'$like':'%'+_0x5204e8[_0x6397('0x3d')][_0x6397('0x47')]+'%'};return _0xed18a4;})});}_0xa14289=_['merge']({},_0xa14289,_0x5204e8['options']);return db[_0x6397('0x60')]['findAll'](_0xa14289);}})[_0x6397('0x2f')](function(_0x237495){if(_0x237495){return db['User'][_0x6397('0x61')]({'where':{'id':_['map'](_0x237495,_0x6397('0x62')),'role':_0x6397('0x63')},'attributes':['id','name',_0x6397('0x64'),_0x6397('0x65'),_0x6397('0x66')]});}})[_0x6397('0x2f')](function(_0x35db98){if(_0x35db98){return{'count':_0x35db98[_0x6397('0x29')],'rows':_[_0x6397('0x38')](_0x35db98[_0x6397('0x4f')],function(_0x1231fc){return{'membername':_0x1231fc[_0x6397('0x35')],'UserId':_0x1231fc['id'],'queue_name':_0xc5514[_0x6397('0x35')],'FaxQueueId':_0xc5514['id'],'interface':util['format'](_0x6397('0x67'),_0x6397('0x68'),_0x1231fc[_0x6397('0x35')]),'penalty':0x0,'paused':_0x1231fc[_0x6397('0x64')],'createdAt':_0x1231fc[_0x6397('0x66')],'updatedAt':_0x1231fc[_0x6397('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14b448,_0xa14289))['catch'](handleError(_0x14b448,null));};exports['getTeams']=function(_0xf3fd91,_0xf33dfc,_0x281492){var _0x140fbb={};var _0x5e3d7e={};var _0x365cf7;var _0x1e0262;return db['FaxQueue'][_0x6397('0x5d')]({'where':{'id':_0xf3fd91['params']['id']}})[_0x6397('0x2f')](handleEntityNotFound(_0xf33dfc,null))[_0x6397('0x2f')](function(_0x37a45a){if(_0x37a45a){_0x365cf7=_0x37a45a;_0x5e3d7e[_0x6397('0x3c')]=_[_0x6397('0x52')](db['Team']['rawAttributes']);_0x5e3d7e[_0x6397('0x3d')]=_[_0x6397('0x52')](_0xf3fd91[_0x6397('0x3d')]);_0x5e3d7e[_0x6397('0x3e')]=_[_0x6397('0x3f')](_0x5e3d7e[_0x6397('0x3c')],_0x5e3d7e[_0x6397('0x3d')]);_0x140fbb[_0x6397('0x41')]=_[_0x6397('0x3f')](_0x5e3d7e[_0x6397('0x3c')],qs['fields'](_0xf3fd91[_0x6397('0x3d')][_0x6397('0x40')]));_0x140fbb['attributes']=_0x140fbb[_0x6397('0x41')]['length']?_0x140fbb[_0x6397('0x41')]:_0x5e3d7e[_0x6397('0x3c')];_0x140fbb[_0x6397('0x43')]=qs[_0x6397('0x44')](_0xf3fd91[_0x6397('0x3d')][_0x6397('0x44')]);_0x140fbb[_0x6397('0x45')]=qs[_0x6397('0x3e')](_[_0x6397('0x46')](_0xf3fd91['query'],_0x5e3d7e[_0x6397('0x3e')]));if(_0xf3fd91['query']['filter']){_0x140fbb[_0x6397('0x45')]=_[_0x6397('0x48')](_0x140fbb[_0x6397('0x45')],{'$or':_[_0x6397('0x38')](_0x140fbb[_0x6397('0x41')],function(_0x472fd6){var _0x5057e8={};_0x5057e8[_0x472fd6]={'$like':'%'+_0xf3fd91[_0x6397('0x3d')][_0x6397('0x47')]+'%'};return _0x5057e8;})});}_0x140fbb=_[_0x6397('0x48')]({},_0x140fbb,_0xf3fd91[_0x6397('0x4a')]);return _0x365cf7[_0x6397('0x69')](_0x140fbb);}})[_0x6397('0x2f')](function(_0x426c06){if(_0x426c06){_0x1e0262=_0x426c06[_0x6397('0x53')];if(!_0xf3fd91[_0x6397('0x3d')]['hasOwnProperty'](_0x6397('0x5e'))){_0x140fbb[_0x6397('0x28')]=qs['limit'](_0xf3fd91[_0x6397('0x3d')]['limit']);_0x140fbb[_0x6397('0x2a')]=qs[_0x6397('0x2a')](_0xf3fd91[_0x6397('0x3d')][_0x6397('0x2a')]);}return _0x365cf7[_0x6397('0x69')](_0x140fbb);}})[_0x6397('0x2f')](function(_0x2475ea){if(_0x2475ea){return _0x2475ea?{'count':_0x1e0262,'rows':_0x2475ea}:null;}})['then'](respondWithResult(_0xf33dfc,null))[_0x6397('0x50')](handleError(_0xf33dfc,null));};exports[_0x6397('0x6a')]=function(_0x13e0b3,_0x381cee,_0x4cad5a){var _0x42dbda=_0x13e0b3[_0x6397('0x56')][_0x6397('0x6b')];return db['Team']['findAll']({'where':{'id':_0x42dbda},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6397('0x6c'),'attributes':['id','name',_0x6397('0x6d'),_0x6397('0x6e'),_0x6397('0x6f')],'raw':!![]}]})['then'](function(_0x295976){if(_0x295976){var _0x19977f=_[_0x6397('0x70')](_0x295976,function(_0x2187fe){var _0xcac35e=_0x2187fe[_0x6397('0x30')]({'plain':!![]});return _0xcac35e[_0x6397('0x6c')];});return db[_0x6397('0x4b')][_0x6397('0x54')]({'where':{'id':_0x13e0b3[_0x6397('0x51')]['id']}})[_0x6397('0x2f')](function(_0x11a169){return db[_0x6397('0x71')]['transaction'](function(_0x15e4b2){return _0x11a169['addTeams'](_0x42dbda,{'transaction':_0x15e4b2})[_0x6397('0x2f')](function(){return BPromise[_0x6397('0x72')](_0x19977f,function(_0x56f5db){return db[_0x6397('0x60')]['findOrCreate']({'where':{'UserId':_0x56f5db['id'],'FaxQueueId':_0x13e0b3[_0x6397('0x51')]['id']},'transaction':_0x15e4b2});});})[_0x6397('0x2f')](function(){_0x19977f['forEach'](function(_0x1faa7c){socket[_0x6397('0x73')](_0x6397('0x74'),{'UserId':_0x1faa7c['id'],'FaxQueueId':_0x11a169['id']});});});});});}})[_0x6397('0x2f')](respondWithStatusCode(_0x381cee,null))['catch'](handleError(_0x381cee,null));};exports[_0x6397('0x75')]=function(_0x321225,_0x1739fb,_0x6cb6d5){return db[_0x6397('0x76')][_0x6397('0x4e')]({'where':{'id':_0x321225[_0x6397('0x3d')][_0x6397('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x6397('0x77')],'as':_0x6397('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x6397('0x2f')](handleEntityNotFound(_0x1739fb,null))[_0x6397('0x2f')](function(_0x4ea355){var _0xdd5ec9=_[_0x6397('0x38')](_0x4ea355,'id');var _0x249eea=[];var _0x552931=[];var _0xe9cacf=squel[_0x6397('0x78')]();_0xe9cacf['field'](_0x6397('0x79'))['from'](_0x6397('0x7a'),'tq')['join'](_0x6397('0x7b'),'ut',_0x6397('0x7c'))['where'](_0x6397('0x7d'),_0x321225[_0x6397('0x51')]['id']);for(var _0x146979=0x0;_0x146979<_0x4ea355['length'];_0x146979+=0x1){let _0x36b60c=_0x4ea355[_0x146979];for(var _0x31d41f=0x0;_0x31d41f<_0x36b60c[_0x6397('0x6c')][_0x6397('0x53')];_0x31d41f+=0x1){let _0x76f60d=_0x36b60c['Agents'][_0x31d41f];var _0x17c534=_0xe9cacf['clone']();_0x17c534[_0x6397('0x45')](_0x6397('0x7e'),_0x76f60d['id']);_0x552931[_0x6397('0x7f')](db[_0x6397('0x71')][_0x6397('0x3d')](_0x17c534[_0x6397('0x80')](),{'type':db[_0x6397('0x71')][_0x6397('0x81')][_0x6397('0x82')]})[_0x6397('0x2f')](function(_0x3d8475){if(_0x3d8475[_0x6397('0x53')]===0x1){return _0x76f60d['id'];}else{var _0x4863f7=_[_0x6397('0x83')](_[_0x6397('0x38')](_0x3d8475,_0x6397('0x84')),function(_0x38642e){return _['includes'](_0xdd5ec9,_0x38642e);});if(_0x4863f7){return _0x76f60d['id'];}}}));}}return BPromise[_0x6397('0x85')](_0x552931)[_0x6397('0x2f')](function(_0x4da14c){_0x249eea=_(_0x249eea)[_0x6397('0x86')](_0x4da14c)['compact']()[_0x6397('0x87')]();return db[_0x6397('0x4b')][_0x6397('0x54')]({'where':{'id':_0x321225['params']['id']}})[_0x6397('0x2f')](function(_0x2c64a9){return db[_0x6397('0x71')][_0x6397('0x88')](function(_0x22e254){return _0x2c64a9[_0x6397('0x75')](_0x321225[_0x6397('0x3d')][_0x6397('0x6b')],{'transaction':_0x22e254})[_0x6397('0x2f')](function(){if(!_[_0x6397('0x89')](_0x249eea)){return _0x2c64a9[_0x6397('0x8a')](_0x249eea,{'transaction':_0x22e254});}})['then'](function(){_0x249eea[_0x6397('0x8b')](function(_0x1b0baf){socket[_0x6397('0x73')]('userFaxQueue:remove',{'UserId':_0x1b0baf,'FaxQueueId':_0x2c64a9['id']});});});});});});})['then'](respondWithStatusCode(_0x1739fb,null))[_0x6397('0x50')](handleError(_0x1739fb,null));};exports['addAgents']=function(_0x308673,_0x29dace,_0x5b9c81){return db['FaxQueue'][_0x6397('0x54')]({'where':{'id':_0x308673[_0x6397('0x51')]['id']}})['then'](handleEntityNotFound(_0x29dace,null))[_0x6397('0x2f')](function(_0x588255){if(_0x588255){return _0x588255[_0x6397('0x8c')](_0x308673[_0x6397('0x56')][_0x6397('0x6b')],_['omit'](_0x308673[_0x6397('0x56')],[_0x6397('0x6b'),'id'])||{})[_0x6397('0x8d')](function(_0x2d8d59){for(var _0x1a0018=0x0;_0x1a0018<_0x308673[_0x6397('0x56')]['ids'][_0x6397('0x53')];_0x1a0018+=0x1){socket[_0x6397('0x73')](_0x6397('0x74'),{'UserId':Number(_0x308673[_0x6397('0x56')][_0x6397('0x6b')][_0x1a0018]),'FaxQueueId':Number(_0x308673[_0x6397('0x51')]['id'])});}return _0x2d8d59;});}})[_0x6397('0x2f')](respondWithResult(_0x29dace,null))[_0x6397('0x50')](handleError(_0x29dace,null));};exports[_0x6397('0x8a')]=function(_0x3537d6,_0xf8bc7e,_0x52ffbb){return db[_0x6397('0x4b')]['find']({'where':{'id':_0x3537d6[_0x6397('0x51')]['id']}})[_0x6397('0x2f')](handleEntityNotFound(_0xf8bc7e,null))[_0x6397('0x2f')](function(_0x38c3fd){if(_0x38c3fd){return _0x38c3fd[_0x6397('0x8a')](_0x3537d6[_0x6397('0x3d')][_0x6397('0x6b')])[_0x6397('0x2f')](function(){if(_[_0x6397('0x8e')](_0x3537d6['query']['ids'])){for(var _0x15f468=0x0;_0x15f468<_0x3537d6[_0x6397('0x3d')][_0x6397('0x6b')][_0x6397('0x53')];_0x15f468+=0x1){socket[_0x6397('0x73')]('userFaxQueue:remove',{'UserId':Number(_0x3537d6['query'][_0x6397('0x6b')][_0x15f468]),'FaxQueueId':Number(_0x3537d6['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x3537d6[_0x6397('0x3d')][_0x6397('0x6b')]),'FaxQueueId':Number(_0x3537d6['params']['id'])});}});}})[_0x6397('0x2f')](respondWithStatusCode(_0xf8bc7e,null))['catch'](handleError(_0xf8bc7e,null));};exports[_0x6397('0x8f')]=function(_0x569abf,_0x29b2c8,_0x102d21){var _0x51a98b={};var _0x220b41={};var _0x245fe4;var _0x1d6bed;return db[_0x6397('0x4b')]['findOne']({'where':{'id':_0x569abf[_0x6397('0x51')]['id']}})['then'](handleEntityNotFound(_0x29b2c8,null))[_0x6397('0x2f')](function(_0xf549c9){if(_0xf549c9){_0x245fe4=_0xf549c9;_0x220b41[_0x6397('0x3c')]=_[_0x6397('0x52')](db['User']['rawAttributes']);_0x220b41[_0x6397('0x3d')]=_['keys'](_0x569abf[_0x6397('0x3d')]);_0x220b41[_0x6397('0x3e')]=_[_0x6397('0x3f')](_0x220b41[_0x6397('0x3c')],_0x220b41[_0x6397('0x3d')]);_0x51a98b[_0x6397('0x41')]=_['intersection'](_0x220b41[_0x6397('0x3c')],qs[_0x6397('0x40')](_0x569abf['query'][_0x6397('0x40')]));_0x51a98b[_0x6397('0x41')]=_0x51a98b[_0x6397('0x41')][_0x6397('0x53')]?_0x51a98b[_0x6397('0x41')]:_0x220b41[_0x6397('0x3c')];_0x51a98b['order']=qs['sort'](_0x569abf[_0x6397('0x3d')][_0x6397('0x44')]);_0x51a98b[_0x6397('0x45')]=qs[_0x6397('0x3e')](_[_0x6397('0x46')](_0x569abf[_0x6397('0x3d')],_0x220b41[_0x6397('0x3e')]));if(_0x569abf[_0x6397('0x3d')][_0x6397('0x47')]){_0x51a98b[_0x6397('0x45')]=_['merge'](_0x51a98b['where'],{'$or':_[_0x6397('0x38')](_0x51a98b[_0x6397('0x41')],function(_0x1a2855){var _0xdd5884={};_0xdd5884[_0x1a2855]={'$like':'%'+_0x569abf['query']['filter']+'%'};return _0xdd5884;})});}_0x51a98b=_[_0x6397('0x48')]({},_0x51a98b,_0x569abf[_0x6397('0x4a')]);return _0x245fe4[_0x6397('0x8f')](_0x51a98b);}})['then'](function(_0x31318a){if(_0x31318a){_0x1d6bed=_0x31318a[_0x6397('0x53')];if(!_0x569abf[_0x6397('0x3d')]['hasOwnProperty']('nolimit')){_0x51a98b['limit']=qs[_0x6397('0x28')](_0x569abf['query'][_0x6397('0x28')]);_0x51a98b[_0x6397('0x2a')]=qs[_0x6397('0x2a')](_0x569abf[_0x6397('0x3d')][_0x6397('0x2a')]);}return _0x245fe4[_0x6397('0x8f')](_0x51a98b);}})[_0x6397('0x2f')](function(_0x3cff1a){if(_0x3cff1a){return _0x3cff1a?{'count':_0x1d6bed,'rows':_0x3cff1a}:null;}})['then'](respondWithResult(_0x29b2c8,null))[_0x6397('0x50')](handleError(_0x29b2c8,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index f176fad..a1d91a8 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 _0x407c=['save','update','remove','emit','hook','events','../../mysqldb'];(function(_0xbfb0aa,_0xac9967){var _0x13fc44=function(_0x5ba494){while(--_0x5ba494){_0xbfb0aa['push'](_0xbfb0aa['shift']());}};_0x13fc44(++_0xac9967);}(_0x407c,0x1e8));var _0xc407=function(_0x26ca0f,_0x45126b){_0x26ca0f=_0x26ca0f-0x0;var _0x5ba1c9=_0x407c[_0x26ca0f];return _0x5ba1c9;};'use strict';var EventEmitter=require(_0xc407('0x0'));var FaxQueue=require(_0xc407('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc407('0x2'),'afterUpdate':_0xc407('0x3'),'afterDestroy':_0xc407('0x4')};function emitEvent(_0x419ab8){return function(_0x28e151,_0x957013,_0x3928a9){FaxQueueEvents[_0xc407('0x5')](_0x419ab8+':'+_0x28e151['id'],_0x28e151);FaxQueueEvents['emit'](_0x419ab8,_0x28e151);_0x3928a9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xc407('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x0ca3=['events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x1c3961,_0x4f5d19){var _0x340ca2=function(_0x1caec3){while(--_0x1caec3){_0x1c3961['push'](_0x1c3961['shift']());}};_0x340ca2(++_0x4f5d19);}(_0x0ca3,0x168));var _0x30ca=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0x0ca3[_0x48e1ec];return _0x3b33eb;};'use strict';var EventEmitter=require(_0x30ca('0x0'));var FaxQueue=require(_0x30ca('0x1'))['db'][_0x30ca('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x30ca('0x3')](0x0);var events={'afterCreate':_0x30ca('0x4'),'afterUpdate':'update','afterDestroy':_0x30ca('0x5')};function emitEvent(_0x28eb9b){return function(_0x55c06a,_0x3e3ad9,_0x3ab599){FaxQueueEvents[_0x30ca('0x6')](_0x28eb9b+':'+_0x55c06a['id'],_0x55c06a);FaxQueueEvents['emit'](_0x28eb9b,_0x55c06a);_0x3ab599(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x30ca('0x7')](e,emitEvent(event));}}module[_0x30ca('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 f13e998..dda62c9 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 _0xdc9d=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash'];(function(_0x4f87c4,_0x47c08e){var _0x8cf521=function(_0x439007){while(--_0x439007){_0x4f87c4['push'](_0x4f87c4['shift']());}};_0x8cf521(++_0x47c08e);}(_0xdc9d,0xe3));var _0xddc9=function(_0x4e7b55,_0x31d9ec){_0x4e7b55=_0x4e7b55-0x0;var _0x3176ba=_0xdc9d[_0x4e7b55];return _0x3176ba;};'use strict';var _=require(_0xddc9('0x0'));var util=require(_0xddc9('0x1'));var logger=require(_0xddc9('0x2'))('api');var moment=require(_0xddc9('0x3'));var BPromise=require(_0xddc9('0x4'));var rp=require(_0xddc9('0x5'));var fs=require('fs');var path=require(_0xddc9('0x6'));var rimraf=require('rimraf');var config=require(_0xddc9('0x7'));var attributes=require(_0xddc9('0x8'));module[_0xddc9('0x9')]=function(_0x2a2cf5,_0x476565){return _0x2a2cf5[_0xddc9('0xa')]('FaxQueue',attributes,{'tableName':_0xddc9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10c5=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash'];(function(_0x4f814c,_0x3e2c4b){var _0x37bccf=function(_0x40f774){while(--_0x40f774){_0x4f814c['push'](_0x4f814c['shift']());}};_0x37bccf(++_0x3e2c4b);}(_0x10c5,0xfb));var _0x510c=function(_0x34b415,_0x2bbe6c){_0x34b415=_0x34b415-0x0;var _0x30b346=_0x10c5[_0x34b415];return _0x30b346;};'use strict';var _=require(_0x510c('0x0'));var util=require(_0x510c('0x1'));var logger=require(_0x510c('0x2'))('api');var moment=require(_0x510c('0x3'));var BPromise=require('bluebird');var rp=require(_0x510c('0x4'));var fs=require('fs');var path=require(_0x510c('0x5'));var rimraf=require(_0x510c('0x6'));var config=require(_0x510c('0x7'));var attributes=require(_0x510c('0x8'));module['exports']=function(_0x40015f,_0x4a2f92){return _0x40015f[_0x510c('0x9')](_0x510c('0xa'),attributes,{'tableName':_0x510c('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 08617be..62a0595 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 _0xa14f=['map','model','attributes','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include'];(function(_0x7741d3,_0x5db5d6){var _0x438d2d=function(_0x1ba703){while(--_0x1ba703){_0x7741d3['push'](_0x7741d3['shift']());}};_0x438d2d(++_0x5db5d6);}(_0xa14f,0x177));var _0xfa14=function(_0x5cd7a9,_0x1e74f8){_0x5cd7a9=_0x5cd7a9-0x0;var _0x1f4990=_0xa14f[_0x5cd7a9];return _0x1f4990;};'use strict';var _=require(_0xfa14('0x0'));var util=require('util');var moment=require(_0xfa14('0x1'));var BPromise=require(_0xfa14('0x2'));var rs=require(_0xfa14('0x3'));var fs=require('fs');var Redis=require(_0xfa14('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfa14('0x5'));var config=require('../../config/environment');var jayson=require(_0xfa14('0x6'));var client=jayson[_0xfa14('0x7')][_0xfa14('0x8')]({'port':0x232a});config[_0xfa14('0x9')]=_[_0xfa14('0xa')](config[_0xfa14('0x9')],{'host':_0xfa14('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfa14('0xc'))['register'](socket);function respondWithRpcPromise(_0x72f990,_0x9995f4,_0x3e9a39){return new BPromise(function(_0x5c9092,_0x3f5dd2){return client[_0xfa14('0xd')](_0x72f990,_0x3e9a39)[_0xfa14('0xe')](function(_0x1f9406){logger[_0xfa14('0xf')](_0xfa14('0x10'),_0x9995f4,'request\x20sent');logger[_0xfa14('0x11')](_0xfa14('0x12'),_0x9995f4,_0xfa14('0x13'),JSON[_0xfa14('0x14')](_0x1f9406));if(_0x1f9406[_0xfa14('0x15')]){if(_0x1f9406[_0xfa14('0x15')]['code']===0x1f4){logger[_0xfa14('0x15')](_0xfa14('0x10'),_0x9995f4,_0x1f9406[_0xfa14('0x15')][_0xfa14('0x16')]);return _0x3f5dd2(_0x1f9406[_0xfa14('0x15')]['message']);}logger[_0xfa14('0x15')](_0xfa14('0x10'),_0x9995f4,_0x1f9406['error']['message']);return _0x5c9092(_0x1f9406[_0xfa14('0x15')][_0xfa14('0x16')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x9995f4,_0xfa14('0x13'));_0x5c9092(_0x1f9406['result'][_0xfa14('0x16')]);}})[_0xfa14('0x17')](function(_0x31f34e){logger[_0xfa14('0x15')](_0xfa14('0x10'),_0x9995f4,_0x31f34e);_0x3f5dd2(_0x31f34e);});});}exports[_0xfa14('0x18')]=function(_0x3d4e22){var _0x2e0b58=this;return new Promise(function(_0x1e7b87,_0x101916){return db[_0xfa14('0x19')][_0xfa14('0x1a')]({'raw':_0x3d4e22[_0xfa14('0x1b')]?_0x3d4e22['options'][_0xfa14('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d4e22['options']?_0x3d4e22[_0xfa14('0x1b')][_0xfa14('0x1d')]||null:null,'attributes':_0x3d4e22[_0xfa14('0x1b')]?_0x3d4e22['options']['attributes']||null:null,'limit':_0x3d4e22['options']?_0x3d4e22[_0xfa14('0x1b')][_0xfa14('0x1e')]||null:null,'include':_0x3d4e22['options']?_0x3d4e22[_0xfa14('0x1b')][_0xfa14('0x1f')]?_[_0xfa14('0x20')](_0x3d4e22[_0xfa14('0x1b')]['include'],function(_0x24b894){return{'model':db[_0x24b894[_0xfa14('0x21')]],'as':_0x24b894['as'],'attributes':_0x24b894[_0xfa14('0x22')],'include':_0x24b894[_0xfa14('0x1f')]?_[_0xfa14('0x20')](_0x24b894[_0xfa14('0x1f')],function(_0x46c83c){return{'model':db[_0x46c83c[_0xfa14('0x21')]],'as':_0x46c83c['as'],'attributes':_0x46c83c['attributes'],'include':_0x46c83c[_0xfa14('0x1f')]?_['map'](_0x46c83c['include'],function(_0x379be4){return{'model':db[_0x379be4['model']],'as':_0x379be4['as'],'attributes':_0x379be4[_0xfa14('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfa14('0xe')](function(_0x45abd6){logger['info'](_0xfa14('0x18'),_0x3d4e22);logger['debug'](_0xfa14('0x18'),_0x3d4e22,JSON[_0xfa14('0x14')](_0x45abd6));_0x1e7b87(_0x45abd6);})['catch'](function(_0x4a03af){logger[_0xfa14('0x15')]('GetFaxQueue',_0x4a03af[_0xfa14('0x16')],_0x3d4e22);_0x101916(_0x2e0b58['error'](0x1f4,_0x4a03af[_0xfa14('0x16')]));});});};exports[_0xfa14('0x23')]=function(_0x355ab2){var _0x13c169=this;return new Promise(function(_0x411130,_0x3d5084){return db[_0xfa14('0x19')][_0xfa14('0x24')]({'raw':_0x355ab2[_0xfa14('0x1b')]?_0x355ab2[_0xfa14('0x1b')][_0xfa14('0x1c')]===undefined?!![]:![]:!![],'where':_0x355ab2[_0xfa14('0x1b')]?_0x355ab2[_0xfa14('0x1b')]['where']||null:null,'attributes':_0x355ab2[_0xfa14('0x1b')]?_0x355ab2[_0xfa14('0x1b')]['attributes']||null:null,'include':_0x355ab2['options']?_0x355ab2['options'][_0xfa14('0x1f')]?_[_0xfa14('0x20')](_0x355ab2['options'][_0xfa14('0x1f')],function(_0x448b3f){return{'model':db[_0x448b3f[_0xfa14('0x21')]],'as':_0x448b3f['as'],'attributes':_0x448b3f[_0xfa14('0x22')],'include':_0x448b3f[_0xfa14('0x1f')]?_[_0xfa14('0x20')](_0x448b3f[_0xfa14('0x1f')],function(_0x5bfacf){return{'model':db[_0x5bfacf['model']],'as':_0x5bfacf['as'],'attributes':_0x5bfacf['attributes'],'include':_0x5bfacf[_0xfa14('0x1f')]?_['map'](_0x5bfacf['include'],function(_0x23c1a5){return{'model':db[_0x23c1a5[_0xfa14('0x21')]],'as':_0x23c1a5['as'],'attributes':_0x23c1a5['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa14('0xe')](function(_0x5da6df){logger[_0xfa14('0xf')](_0xfa14('0x23'),_0x355ab2);logger['debug']('ShowFaxQueue',_0x355ab2,JSON['stringify'](_0x5da6df));_0x411130(_0x5da6df);})['catch'](function(_0x416469){logger[_0xfa14('0x15')](_0xfa14('0x23'),_0x416469[_0xfa14('0x16')],_0x355ab2);_0x3d5084(_0x13c169[_0xfa14('0x15')](0x1f4,_0x416469['message']));});});}; \ No newline at end of file +var _0x62a1=['http','redis','defaults','localhost','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3797bc,_0x4c4319){var _0x36454e=function(_0x2d80af){while(--_0x2d80af){_0x3797bc['push'](_0x3797bc['shift']());}};_0x36454e(++_0x4c4319);}(_0x62a1,0x1e1));var _0x162a=function(_0x474acd,_0x4b8247){_0x474acd=_0x474acd-0x0;var _0xaad65=_0x62a1[_0x474acd];return _0xaad65;};'use strict';var _=require(_0x162a('0x0'));var util=require(_0x162a('0x1'));var moment=require(_0x162a('0x2'));var BPromise=require('bluebird');var rs=require(_0x162a('0x3'));var fs=require('fs');var Redis=require(_0x162a('0x4'));var db=require(_0x162a('0x5'))['db'];var utils=require(_0x162a('0x6'));var logger=require('../../config/logger')(_0x162a('0x7'));var config=require(_0x162a('0x8'));var jayson=require(_0x162a('0x9'));var client=jayson[_0x162a('0xa')][_0x162a('0xb')]({'port':0x232a});config[_0x162a('0xc')]=_[_0x162a('0xd')](config[_0x162a('0xc')],{'host':_0x162a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x162a('0xc')]));require(_0x162a('0xf'))[_0x162a('0x10')](socket);function respondWithRpcPromise(_0x2d32ed,_0x2f62ff,_0x5b43a0){return new BPromise(function(_0x2c2869,_0x31b286){return client['request'](_0x2d32ed,_0x5b43a0)[_0x162a('0x11')](function(_0x1aeae9){logger[_0x162a('0x12')](_0x162a('0x13'),_0x2f62ff,_0x162a('0x14'));logger['debug'](_0x162a('0x15'),_0x2f62ff,_0x162a('0x14'),JSON[_0x162a('0x16')](_0x1aeae9));if(_0x1aeae9[_0x162a('0x17')]){if(_0x1aeae9[_0x162a('0x17')]['code']===0x1f4){logger[_0x162a('0x17')](_0x162a('0x13'),_0x2f62ff,_0x1aeae9['error'][_0x162a('0x18')]);return _0x31b286(_0x1aeae9['error'][_0x162a('0x18')]);}logger[_0x162a('0x17')](_0x162a('0x13'),_0x2f62ff,_0x1aeae9[_0x162a('0x17')][_0x162a('0x18')]);return _0x2c2869(_0x1aeae9[_0x162a('0x17')][_0x162a('0x18')]);}else{logger[_0x162a('0x12')](_0x162a('0x13'),_0x2f62ff,_0x162a('0x14'));_0x2c2869(_0x1aeae9[_0x162a('0x19')][_0x162a('0x18')]);}})[_0x162a('0x1a')](function(_0x4fd29a){logger['error'](_0x162a('0x13'),_0x2f62ff,_0x4fd29a);_0x31b286(_0x4fd29a);});});}exports[_0x162a('0x1b')]=function(_0x328175){var _0xeb18d9=this;return new Promise(function(_0x23b593,_0x1da146){return db[_0x162a('0x1c')][_0x162a('0x1d')]({'raw':_0x328175[_0x162a('0x1e')]?_0x328175[_0x162a('0x1e')][_0x162a('0x1f')]===undefined?!![]:![]:!![],'where':_0x328175[_0x162a('0x1e')]?_0x328175['options'][_0x162a('0x20')]||null:null,'attributes':_0x328175['options']?_0x328175['options'][_0x162a('0x21')]||null:null,'limit':_0x328175[_0x162a('0x1e')]?_0x328175['options'][_0x162a('0x22')]||null:null,'include':_0x328175['options']?_0x328175[_0x162a('0x1e')][_0x162a('0x23')]?_[_0x162a('0x24')](_0x328175[_0x162a('0x1e')][_0x162a('0x23')],function(_0x237b83){return{'model':db[_0x237b83[_0x162a('0x25')]],'as':_0x237b83['as'],'attributes':_0x237b83[_0x162a('0x21')],'include':_0x237b83[_0x162a('0x23')]?_[_0x162a('0x24')](_0x237b83[_0x162a('0x23')],function(_0x5c2357){return{'model':db[_0x5c2357[_0x162a('0x25')]],'as':_0x5c2357['as'],'attributes':_0x5c2357[_0x162a('0x21')],'include':_0x5c2357[_0x162a('0x23')]?_[_0x162a('0x24')](_0x5c2357['include'],function(_0x513564){return{'model':db[_0x513564[_0x162a('0x25')]],'as':_0x513564['as'],'attributes':_0x513564[_0x162a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x506643){logger[_0x162a('0x12')](_0x162a('0x1b'),_0x328175);logger[_0x162a('0x26')](_0x162a('0x1b'),_0x328175,JSON['stringify'](_0x506643));_0x23b593(_0x506643);})[_0x162a('0x1a')](function(_0x275072){logger[_0x162a('0x17')](_0x162a('0x1b'),_0x275072['message'],_0x328175);_0x1da146(_0xeb18d9[_0x162a('0x17')](0x1f4,_0x275072[_0x162a('0x18')]));});});};exports['ShowFaxQueue']=function(_0x5dd246){var _0x27f608=this;return new Promise(function(_0x39ce57,_0x9ab52a){return db[_0x162a('0x1c')][_0x162a('0x27')]({'raw':_0x5dd246[_0x162a('0x1e')]?_0x5dd246[_0x162a('0x1e')][_0x162a('0x1f')]===undefined?!![]:![]:!![],'where':_0x5dd246[_0x162a('0x1e')]?_0x5dd246[_0x162a('0x1e')][_0x162a('0x20')]||null:null,'attributes':_0x5dd246[_0x162a('0x1e')]?_0x5dd246[_0x162a('0x1e')][_0x162a('0x21')]||null:null,'include':_0x5dd246['options']?_0x5dd246[_0x162a('0x1e')][_0x162a('0x23')]?_['map'](_0x5dd246[_0x162a('0x1e')][_0x162a('0x23')],function(_0x1c5d2e){return{'model':db[_0x1c5d2e[_0x162a('0x25')]],'as':_0x1c5d2e['as'],'attributes':_0x1c5d2e['attributes'],'include':_0x1c5d2e[_0x162a('0x23')]?_['map'](_0x1c5d2e[_0x162a('0x23')],function(_0x53a3a3){return{'model':db[_0x53a3a3[_0x162a('0x25')]],'as':_0x53a3a3['as'],'attributes':_0x53a3a3[_0x162a('0x21')],'include':_0x53a3a3[_0x162a('0x23')]?_['map'](_0x53a3a3[_0x162a('0x23')],function(_0x5f2ea1){return{'model':db[_0x5f2ea1['model']],'as':_0x5f2ea1['as'],'attributes':_0x5f2ea1[_0x162a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x162a('0x11')](function(_0x3f74dd){logger[_0x162a('0x12')](_0x162a('0x28'),_0x5dd246);logger[_0x162a('0x26')]('ShowFaxQueue',_0x5dd246,JSON[_0x162a('0x16')](_0x3f74dd));_0x39ce57(_0x3f74dd);})[_0x162a('0x1a')](function(_0x62973c){logger['error'](_0x162a('0x28'),_0x62973c[_0x162a('0x18')],_0x5dd246);_0x9ab52a(_0x27f608['error'](0x1f4,_0x62973c[_0x162a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 61d6c04..bc76ee2 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 _0xf408=['./faxQueue.events','save','remove','update','removeListener','register','length'];(function(_0x3ce94d,_0x331820){var _0x2c627a=function(_0x5c04ac){while(--_0x5c04ac){_0x3ce94d['push'](_0x3ce94d['shift']());}};_0x2c627a(++_0x331820);}(_0xf408,0x1ce));var _0x8f40=function(_0x9166ea,_0x1f21b0){_0x9166ea=_0x9166ea-0x0;var _0xdceec9=_0xf408[_0x9166ea];return _0xdceec9;};'use strict';var FaxQueueEvents=require(_0x8f40('0x0'));var events=[_0x8f40('0x1'),_0x8f40('0x2'),_0x8f40('0x3')];function createListener(_0x20189d,_0x4be15b){return function(_0x28196c){_0x4be15b['emit'](_0x20189d,_0x28196c);};}function removeListener(_0x27234e,_0x5d32ca){return function(){FaxQueueEvents[_0x8f40('0x4')](_0x27234e,_0x5d32ca);};}exports[_0x8f40('0x5')]=function(_0x188f74){for(var _0x41c946=0x0,_0x1ab48a=events[_0x8f40('0x6')];_0x41c946<_0x1ab48a;_0x41c946++){var _0x53dc84=events[_0x41c946];var _0xbf957a=createListener('faxQueue:'+_0x53dc84,_0x188f74);FaxQueueEvents['on'](_0x53dc84,_0xbf957a);}}; \ No newline at end of file +var _0x3bcf=['update','emit','removeListener','length','./faxQueue.events','save','remove'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x3bcf,0xdd));var _0xf3bc=function(_0x246079,_0x3aec24){_0x246079=_0x246079-0x0;var _0x579004=_0x3bcf[_0x246079];return _0x579004;};'use strict';var FaxQueueEvents=require(_0xf3bc('0x0'));var events=[_0xf3bc('0x1'),_0xf3bc('0x2'),_0xf3bc('0x3')];function createListener(_0x13021e,_0x3a7b98){return function(_0x47c1d5){_0x3a7b98[_0xf3bc('0x4')](_0x13021e,_0x47c1d5);};}function removeListener(_0x412e93,_0x31d88a){return function(){FaxQueueEvents[_0xf3bc('0x5')](_0x412e93,_0x31d88a);};}exports['register']=function(_0x403472){for(var _0x3456d0=0x0,_0x37bae7=events[_0xf3bc('0x6')];_0x3456d0<_0x37bae7;_0x3456d0++){var _0x137de6=events[_0x3456d0];var _0x26960c=createListener('faxQueue:'+_0x137de6,_0x403472);FaxQueueEvents['on'](_0x137de6,_0x26960c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 0bc6ea6..c6c1641 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 _0xb145=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users'];(function(_0x2c7740,_0x540c3f){var _0x141372=function(_0x5e8d77){while(--_0x5e8d77){_0x2c7740['push'](_0x2c7740['shift']());}};_0x141372(++_0x540c3f);}(_0xb145,0xa3));var _0x5b14=function(_0x3f3348,_0x3d76cd){_0x3f3348=_0x3f3348-0x0;var _0x3804a0=_0xb145[_0x3f3348];return _0x3804a0;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x9')]('/:id/members',auth[_0x5b14('0xa')](),controller[_0x5b14('0x10')]);router[_0x5b14('0x9')](_0x5b14('0x11'),auth[_0x5b14('0xa')](),controller['getTeams']);router[_0x5b14('0x9')]('/:id/users',auth[_0x5b14('0xa')](),controller[_0x5b14('0x12')]);router[_0x5b14('0x13')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0x14')]);router[_0x5b14('0x13')]('/:id/teams',auth[_0x5b14('0xa')](),controller[_0x5b14('0x15')]);router[_0x5b14('0x13')](_0x5b14('0x16'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x17')]);router[_0x5b14('0x18')](_0x5b14('0xe'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x19')]);router[_0x5b14('0x1a')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0x1b')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x5b14('0x1c')]);router[_0x5b14('0x1a')](_0x5b14('0x16'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x1d')]);module[_0x5b14('0x1e')]=router; \ No newline at end of file +var _0x6a55=['index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0x6a55,0xdb));var _0x56a5=function(_0x330141,_0x1dd290){_0x330141=_0x330141-0x0;var _0x1b68a2=_0x6a55[_0x330141];return _0x1b68a2;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./faxQueue.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0x4')](_0x56a5('0xa'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0x4')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller['getTeams']);router['get'](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);router[_0x56a5('0xf')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x10')]);router['post']('/:id/teams',auth[_0x56a5('0x5')](),controller[_0x56a5('0x11')]);router[_0x56a5('0xf')](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x12')]);router[_0x56a5('0x13')]('/:id',auth[_0x56a5('0x5')](),controller['update']);router[_0x56a5('0x14')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x15')]);router[_0x56a5('0x14')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x16')]);router[_0x56a5('0x14')]('/:id/users',auth[_0x56a5('0x5')](),controller[_0x56a5('0x17')]);module[_0x56a5('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 26e5346..ae249bf 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 _0x231c=['exports','STRING','DATE','moment','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x231c,0x134));var _0xc231=function(_0x5f2f84,_0x443244){_0x5f2f84=_0x5f2f84-0x0;var _0x48965b=_0x231c[_0x5f2f84];return _0x48965b;};'use strict';var moment=require(_0xc231('0x0'));var Sequelize=require(_0xc231('0x1'));module[_0xc231('0x2')]={'uniqueid':{'type':Sequelize[_0xc231('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc231('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc231('0x4')]},'exitAt':{'type':Sequelize[_0xc231('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5f1e=['STRING','sequelize','exports','DATE'];(function(_0x23f359,_0x1d9936){var _0xe0f972=function(_0x5df452){while(--_0x5df452){_0x23f359['push'](_0x23f359['shift']());}};_0xe0f972(++_0x1d9936);}(_0x5f1e,0x71));var _0xe5f1=function(_0x37e1aa,_0xc282a){_0x37e1aa=_0x37e1aa-0x0;var _0x4b1d81=_0x5f1e[_0x37e1aa];return _0x4b1d81;};'use strict';var moment=require('moment');var Sequelize=require(_0xe5f1('0x0'));module[_0xe5f1('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe5f1('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe5f1('0x2')]},'exitAt':{'type':Sequelize[_0xe5f1('0x2')]},'reason':{'type':Sequelize[_0xe5f1('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 9f5eb30..30e0457 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 _0x93e7=['rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','FaxQueueReport','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','count','includeAll','include','findAll'];(function(_0x395a10,_0x44191f){var _0x120b46=function(_0x221005){while(--_0x221005){_0x395a10['push'](_0x395a10['shift']());}};_0x120b46(++_0x44191f);}(_0x93e7,0x9e));var _0x793e=function(_0x18baf4,_0x33086b){_0x18baf4=_0x18baf4-0x0;var _0x278ed1=_0x93e7[_0x18baf4];return _0x278ed1;};'use strict';var emlformat=require(_0x793e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x793e('0x1'));var jsonpatch=require(_0x793e('0x2'));var rp=require('request-promise');var moment=require(_0x793e('0x3'));var BPromise=require(_0x793e('0x4'));var Mustache=require(_0x793e('0x5'));var util=require(_0x793e('0x6'));var path=require('path');var sox=require(_0x793e('0x7'));var csv=require('to-csv');var ejs=require(_0x793e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x793e('0x9'));var squel=require('squel');var crypto=require(_0x793e('0xa'));var jsforce=require(_0x793e('0xb'));var deskjs=require(_0x793e('0xc'));var toCsv=require(_0x793e('0xd'));var querystring=require(_0x793e('0xe'));var Papa=require(_0x793e('0xf'));var Redis=require(_0x793e('0x10'));var authService=require(_0x793e('0x11'));var qs=require(_0x793e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x793e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x793e('0x14'));var db=require(_0x793e('0x15'))['db'];function respondWithStatusCode(_0x57709f,_0x6a5f34){_0x6a5f34=_0x6a5f34||0xcc;return function(_0x2e2efe){if(_0x2e2efe){return _0x57709f[_0x793e('0x16')](_0x6a5f34);}return _0x57709f[_0x793e('0x17')](_0x6a5f34)[_0x793e('0x18')]();};}function respondWithResult(_0x410914,_0x1c7c58){_0x1c7c58=_0x1c7c58||0xc8;return function(_0x3a0952){if(_0x3a0952){return _0x410914[_0x793e('0x17')](_0x1c7c58)[_0x793e('0x19')](_0x3a0952);}};}function respondWithFilteredResult(_0x1121e5,_0x36686c){return function(_0x418b5f){if(_0x418b5f){var _0x18990a=typeof _0x36686c[_0x793e('0x1a')]===_0x793e('0x1b')&&typeof _0x36686c[_0x793e('0x1c')]===_0x793e('0x1b');var _0xeacea6=_0x418b5f['count'];var _0x3b38ef=_0x18990a?0x0:_0x36686c[_0x793e('0x1a')];var _0x4ba056=_0x18990a?_0x418b5f['count']:_0x36686c['offset']+_0x36686c[_0x793e('0x1c')];var _0x2f0494;if(_0x4ba056>=_0xeacea6){_0x4ba056=_0xeacea6;_0x2f0494=0xc8;}else{_0x2f0494=0xce;}_0x1121e5[_0x793e('0x17')](_0x2f0494);return _0x1121e5[_0x793e('0x1d')](_0x793e('0x1e'),_0x3b38ef+'-'+_0x4ba056+'/'+_0xeacea6)[_0x793e('0x19')](_0x418b5f);}return null;};}function patchUpdates(_0x1af167){return function(_0x9413f9){try{jsonpatch[_0x793e('0x1f')](_0x9413f9,_0x1af167,!![]);}catch(_0x31413a){return BPromise[_0x793e('0x20')](_0x31413a);}return _0x9413f9[_0x793e('0x21')]();};}function saveUpdates(_0x1596bf,_0xed37e){return function(_0x33fe28){if(_0x33fe28){return _0x33fe28[_0x793e('0x22')](_0x1596bf)[_0x793e('0x23')](function(_0x4be20c){return _0x4be20c;});}return null;};}function removeEntity(_0x59a4ff,_0xc259c8){return function(_0x36840f){if(_0x36840f){return _0x36840f['destroy']()[_0x793e('0x23')](function(){_0x59a4ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b37a,_0x59b191){return function(_0x5203aa){if(!_0x5203aa){_0x55b37a[_0x793e('0x16')](0x194);}return _0x5203aa;};}function handleError(_0x74048a,_0x4c7816){_0x4c7816=_0x4c7816||0x1f4;return function(_0x361a87){logger[_0x793e('0x24')](_0x361a87[_0x793e('0x25')]);if(_0x361a87[_0x793e('0x26')]){delete _0x361a87[_0x793e('0x26')];}_0x74048a[_0x793e('0x17')](_0x4c7816)[_0x793e('0x27')](_0x361a87);};}exports[_0x793e('0x28')]=function(_0x597c7d,_0xfe7fb9){var _0x48edff={},_0x4a45ae={},_0x530316={'count':0x0,'rows':[]};var _0xeb38af=_['map'](db[_0x793e('0x29')]['rawAttributes'],function(_0x2bebef){return{'name':_0x2bebef[_0x793e('0x2a')],'type':_0x2bebef['type']['key']};});_0x4a45ae[_0x793e('0x2b')]=_['map'](_0xeb38af,_0x793e('0x26'));_0x4a45ae[_0x793e('0x2c')]=_[_0x793e('0x2d')](_0x597c7d['query']);_0x4a45ae[_0x793e('0x2e')]=_[_0x793e('0x2f')](_0x4a45ae[_0x793e('0x2b')],_0x4a45ae[_0x793e('0x2c')]);_0x48edff[_0x793e('0x30')]=_['intersection'](_0x4a45ae[_0x793e('0x2b')],qs[_0x793e('0x31')](_0x597c7d[_0x793e('0x2c')][_0x793e('0x31')]));_0x48edff['attributes']=_0x48edff[_0x793e('0x30')][_0x793e('0x32')]?_0x48edff[_0x793e('0x30')]:_0x4a45ae[_0x793e('0x2b')];if(!_0x597c7d[_0x793e('0x2c')]['hasOwnProperty'](_0x793e('0x33'))){_0x48edff[_0x793e('0x1c')]=qs[_0x793e('0x1c')](_0x597c7d[_0x793e('0x2c')][_0x793e('0x1c')]);_0x48edff[_0x793e('0x1a')]=qs[_0x793e('0x1a')](_0x597c7d[_0x793e('0x2c')]['offset']);}_0x48edff[_0x793e('0x34')]=qs[_0x793e('0x35')](_0x597c7d[_0x793e('0x2c')][_0x793e('0x35')]);_0x48edff[_0x793e('0x36')]=qs[_0x793e('0x2e')](_['pick'](_0x597c7d[_0x793e('0x2c')],_0x4a45ae[_0x793e('0x2e')]),_0xeb38af);if(_0x597c7d[_0x793e('0x2c')][_0x793e('0x37')]){_0x48edff[_0x793e('0x36')]=_[_0x793e('0x38')](_0x48edff[_0x793e('0x36')],{'$or':_[_0x793e('0x39')](_0xeb38af,function(_0x57fdec){if(_0x57fdec[_0x793e('0x3a')]!==_0x793e('0x3b')){var _0x397af4={};_0x397af4[_0x57fdec[_0x793e('0x26')]]={'$like':'%'+_0x597c7d[_0x793e('0x2c')][_0x793e('0x37')]+'%'};return _0x397af4;}})});}_0x48edff=_['merge']({},_0x48edff,_0x597c7d['options']);var _0x2d4037={'where':_0x48edff[_0x793e('0x36')]};return db[_0x793e('0x29')][_0x793e('0x3c')](_0x2d4037)[_0x793e('0x23')](function(_0x28343b){_0x530316[_0x793e('0x3c')]=_0x28343b;if(_0x597c7d[_0x793e('0x2c')][_0x793e('0x3d')]){_0x48edff[_0x793e('0x3e')]=[{'all':!![]}];}return db[_0x793e('0x29')][_0x793e('0x3f')](_0x48edff);})[_0x793e('0x23')](function(_0x1f3059){_0x530316[_0x793e('0x40')]=_0x1f3059;return _0x530316;})[_0x793e('0x23')](respondWithFilteredResult(_0xfe7fb9,_0x48edff))[_0x793e('0x41')](handleError(_0xfe7fb9,null));};exports[_0x793e('0x42')]=function(_0x1bec3d,_0xd0a349){var _0x10f99e={'raw':!![],'where':{'id':_0x1bec3d[_0x793e('0x43')]['id']}},_0x42883d={};_0x42883d[_0x793e('0x2b')]=_['keys'](db[_0x793e('0x29')]['rawAttributes']);_0x42883d['query']=_[_0x793e('0x2d')](_0x1bec3d[_0x793e('0x2c')]);_0x42883d[_0x793e('0x2e')]=_[_0x793e('0x2f')](_0x42883d[_0x793e('0x2b')],_0x42883d[_0x793e('0x2c')]);_0x10f99e[_0x793e('0x30')]=_[_0x793e('0x2f')](_0x42883d[_0x793e('0x2b')],qs['fields'](_0x1bec3d['query'][_0x793e('0x31')]));_0x10f99e[_0x793e('0x30')]=_0x10f99e[_0x793e('0x30')][_0x793e('0x32')]?_0x10f99e['attributes']:_0x42883d[_0x793e('0x2b')];if(_0x1bec3d[_0x793e('0x2c')][_0x793e('0x3d')]){_0x10f99e[_0x793e('0x3e')]=[{'all':!![]}];}_0x10f99e=_['merge']({},_0x10f99e,_0x1bec3d[_0x793e('0x44')]);return db[_0x793e('0x29')][_0x793e('0x45')](_0x10f99e)[_0x793e('0x23')](handleEntityNotFound(_0xd0a349,null))[_0x793e('0x23')](respondWithResult(_0xd0a349,null))['catch'](handleError(_0xd0a349,null));};exports['create']=function(_0x5cb3a8,_0x494921){return db[_0x793e('0x29')][_0x793e('0x46')](_0x5cb3a8[_0x793e('0x47')],{})[_0x793e('0x23')](respondWithResult(_0x494921,0xc9))['catch'](handleError(_0x494921,null));};exports[_0x793e('0x22')]=function(_0x794076,_0x112645){if(_0x794076['body']['id']){delete _0x794076[_0x793e('0x47')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x794076[_0x793e('0x43')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x112645,null))[_0x793e('0x23')](saveUpdates(_0x794076[_0x793e('0x47')],null))['then'](respondWithResult(_0x112645,null))[_0x793e('0x41')](handleError(_0x112645,null));};exports[_0x793e('0x48')]=function(_0x1e1b94,_0x363bf0){return db['FaxQueueReport']['find']({'where':{'id':_0x1e1b94['params']['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x363bf0,null))[_0x793e('0x23')](removeEntity(_0x363bf0,null))[_0x793e('0x41')](handleError(_0x363bf0,null));};exports['describe']=function(_0x40163e,_0x47b465){return db['FaxQueueReport'][_0x793e('0x49')]()[_0x793e('0x23')](respondWithResult(_0x47b465,null))[_0x793e('0x41')](handleError(_0x47b465,null));}; \ No newline at end of file +var _0xb821=['filter','where','merge','VIRTUAL','options','include','findAll','show','keys','includeAll','find','catch','body','update','describe','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb821,0xa7));var _0x1b82=function(_0x45b4ab,_0x35e608){_0x45b4ab=_0x45b4ab-0x0;var _0x57c9a7=_0xb821[_0x45b4ab];return _0x57c9a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];function respondWithStatusCode(_0x241d11,_0x2391f5){_0x2391f5=_0x2391f5||0xcc;return function(_0x61b6eb){if(_0x61b6eb){return _0x241d11['sendStatus'](_0x2391f5);}return _0x241d11[_0x1b82('0x18')](_0x2391f5)['end']();};}function respondWithResult(_0x54915f,_0x1e553a){_0x1e553a=_0x1e553a||0xc8;return function(_0x4bf75b){if(_0x4bf75b){return _0x54915f[_0x1b82('0x18')](_0x1e553a)[_0x1b82('0x19')](_0x4bf75b);}};}function respondWithFilteredResult(_0x5d4cf1,_0x46c2cf){return function(_0x5dab7d){if(_0x5dab7d){var _0x563261=typeof _0x46c2cf[_0x1b82('0x1a')]==='undefined'&&typeof _0x46c2cf[_0x1b82('0x1b')]===_0x1b82('0x1c');var _0xf42818=_0x5dab7d['count'];var _0x514082=_0x563261?0x0:_0x46c2cf[_0x1b82('0x1a')];var _0x5d66c3=_0x563261?_0x5dab7d[_0x1b82('0x1d')]:_0x46c2cf[_0x1b82('0x1a')]+_0x46c2cf[_0x1b82('0x1b')];var _0x594a63;if(_0x5d66c3>=_0xf42818){_0x5d66c3=_0xf42818;_0x594a63=0xc8;}else{_0x594a63=0xce;}_0x5d4cf1[_0x1b82('0x18')](_0x594a63);return _0x5d4cf1[_0x1b82('0x1e')](_0x1b82('0x1f'),_0x514082+'-'+_0x5d66c3+'/'+_0xf42818)[_0x1b82('0x19')](_0x5dab7d);}return null;};}function patchUpdates(_0x10d45c){return function(_0x47e99b){try{jsonpatch[_0x1b82('0x20')](_0x47e99b,_0x10d45c,!![]);}catch(_0x1892b0){return BPromise[_0x1b82('0x21')](_0x1892b0);}return _0x47e99b[_0x1b82('0x22')]();};}function saveUpdates(_0x26e481,_0x31fd64){return function(_0x2d07f4){if(_0x2d07f4){return _0x2d07f4['update'](_0x26e481)[_0x1b82('0x23')](function(_0x233740){return _0x233740;});}return null;};}function removeEntity(_0x5b8d09,_0x561d78){return function(_0x225b81){if(_0x225b81){return _0x225b81[_0x1b82('0x24')]()['then'](function(){_0x5b8d09[_0x1b82('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd458,_0x5f556b){return function(_0xf2e556){if(!_0xf2e556){_0x5cd458[_0x1b82('0x25')](0x194);}return _0xf2e556;};}function handleError(_0xfd00d1,_0x257b79){_0x257b79=_0x257b79||0x1f4;return function(_0x548a3b){logger[_0x1b82('0x26')](_0x548a3b[_0x1b82('0x27')]);if(_0x548a3b[_0x1b82('0x28')]){delete _0x548a3b[_0x1b82('0x28')];}_0xfd00d1[_0x1b82('0x18')](_0x257b79)[_0x1b82('0x29')](_0x548a3b);};}exports[_0x1b82('0x2a')]=function(_0x21ea34,_0x39641a){var _0x1f9c6b={},_0x2fe45d={},_0x37275f={'count':0x0,'rows':[]};var _0x466441=_['map'](db[_0x1b82('0x2b')][_0x1b82('0x2c')],function(_0x155a34){return{'name':_0x155a34[_0x1b82('0x2d')],'type':_0x155a34[_0x1b82('0x2e')][_0x1b82('0x2f')]};});_0x2fe45d[_0x1b82('0x30')]=_[_0x1b82('0x31')](_0x466441,_0x1b82('0x28'));_0x2fe45d[_0x1b82('0x32')]=_['keys'](_0x21ea34[_0x1b82('0x32')]);_0x2fe45d[_0x1b82('0x33')]=_[_0x1b82('0x34')](_0x2fe45d[_0x1b82('0x30')],_0x2fe45d['query']);_0x1f9c6b[_0x1b82('0x35')]=_[_0x1b82('0x34')](_0x2fe45d['model'],qs[_0x1b82('0x36')](_0x21ea34[_0x1b82('0x32')][_0x1b82('0x36')]));_0x1f9c6b['attributes']=_0x1f9c6b['attributes'][_0x1b82('0x37')]?_0x1f9c6b['attributes']:_0x2fe45d['model'];if(!_0x21ea34[_0x1b82('0x32')][_0x1b82('0x38')](_0x1b82('0x39'))){_0x1f9c6b['limit']=qs[_0x1b82('0x1b')](_0x21ea34[_0x1b82('0x32')][_0x1b82('0x1b')]);_0x1f9c6b[_0x1b82('0x1a')]=qs['offset'](_0x21ea34[_0x1b82('0x32')][_0x1b82('0x1a')]);}_0x1f9c6b[_0x1b82('0x3a')]=qs['sort'](_0x21ea34['query'][_0x1b82('0x3b')]);_0x1f9c6b['where']=qs[_0x1b82('0x33')](_[_0x1b82('0x3c')](_0x21ea34[_0x1b82('0x32')],_0x2fe45d[_0x1b82('0x33')]),_0x466441);if(_0x21ea34[_0x1b82('0x32')][_0x1b82('0x3d')]){_0x1f9c6b[_0x1b82('0x3e')]=_[_0x1b82('0x3f')](_0x1f9c6b['where'],{'$or':_['map'](_0x466441,function(_0x18b624){if(_0x18b624['type']!==_0x1b82('0x40')){var _0x592449={};_0x592449[_0x18b624[_0x1b82('0x28')]]={'$like':'%'+_0x21ea34[_0x1b82('0x32')][_0x1b82('0x3d')]+'%'};return _0x592449;}})});}_0x1f9c6b=_[_0x1b82('0x3f')]({},_0x1f9c6b,_0x21ea34[_0x1b82('0x41')]);var _0x202bb4={'where':_0x1f9c6b['where']};return db[_0x1b82('0x2b')]['count'](_0x202bb4)[_0x1b82('0x23')](function(_0x4e5659){_0x37275f[_0x1b82('0x1d')]=_0x4e5659;if(_0x21ea34['query']['includeAll']){_0x1f9c6b[_0x1b82('0x42')]=[{'all':!![]}];}return db[_0x1b82('0x2b')][_0x1b82('0x43')](_0x1f9c6b);})[_0x1b82('0x23')](function(_0x3eb429){_0x37275f['rows']=_0x3eb429;return _0x37275f;})[_0x1b82('0x23')](respondWithFilteredResult(_0x39641a,_0x1f9c6b))['catch'](handleError(_0x39641a,null));};exports[_0x1b82('0x44')]=function(_0x2fcf04,_0x17e47f){var _0x3adf9c={'raw':!![],'where':{'id':_0x2fcf04['params']['id']}},_0x365ab4={};_0x365ab4[_0x1b82('0x30')]=_['keys'](db[_0x1b82('0x2b')][_0x1b82('0x2c')]);_0x365ab4['query']=_[_0x1b82('0x45')](_0x2fcf04[_0x1b82('0x32')]);_0x365ab4[_0x1b82('0x33')]=_[_0x1b82('0x34')](_0x365ab4[_0x1b82('0x30')],_0x365ab4[_0x1b82('0x32')]);_0x3adf9c[_0x1b82('0x35')]=_['intersection'](_0x365ab4[_0x1b82('0x30')],qs['fields'](_0x2fcf04[_0x1b82('0x32')][_0x1b82('0x36')]));_0x3adf9c[_0x1b82('0x35')]=_0x3adf9c[_0x1b82('0x35')][_0x1b82('0x37')]?_0x3adf9c[_0x1b82('0x35')]:_0x365ab4[_0x1b82('0x30')];if(_0x2fcf04[_0x1b82('0x32')][_0x1b82('0x46')]){_0x3adf9c[_0x1b82('0x42')]=[{'all':!![]}];}_0x3adf9c=_[_0x1b82('0x3f')]({},_0x3adf9c,_0x2fcf04[_0x1b82('0x41')]);return db[_0x1b82('0x2b')][_0x1b82('0x47')](_0x3adf9c)['then'](handleEntityNotFound(_0x17e47f,null))['then'](respondWithResult(_0x17e47f,null))[_0x1b82('0x48')](handleError(_0x17e47f,null));};exports['create']=function(_0x12d9ac,_0x3df0af){return db[_0x1b82('0x2b')]['create'](_0x12d9ac[_0x1b82('0x49')],{})['then'](respondWithResult(_0x3df0af,0xc9))['catch'](handleError(_0x3df0af,null));};exports[_0x1b82('0x4a')]=function(_0x2aadf7,_0x242324){if(_0x2aadf7['body']['id']){delete _0x2aadf7[_0x1b82('0x49')]['id'];}return db[_0x1b82('0x2b')]['find']({'where':{'id':_0x2aadf7['params']['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x242324,null))[_0x1b82('0x23')](saveUpdates(_0x2aadf7[_0x1b82('0x49')],null))['then'](respondWithResult(_0x242324,null))[_0x1b82('0x48')](handleError(_0x242324,null));};exports[_0x1b82('0x24')]=function(_0x31fb5d,_0x29f9ae){return db[_0x1b82('0x2b')][_0x1b82('0x47')]({'where':{'id':_0x31fb5d['params']['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x29f9ae,null))['then'](removeEntity(_0x29f9ae,null))[_0x1b82('0x48')](handleError(_0x29f9ae,null));};exports[_0x1b82('0x4b')]=function(_0x5d9708,_0x44ce1c){return db['FaxQueueReport'][_0x1b82('0x4b')]()[_0x1b82('0x23')](respondWithResult(_0x44ce1c,null))[_0x1b82('0x48')](handleError(_0x44ce1c,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index dc49007..3410dde 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x1cb9,0x14e));var _0x91cb=function(_0xf2d192,_0x56a932){_0xf2d192=_0xf2d192-0x0;var _0x43fd3b=_0x1cb9[_0xf2d192];return _0x43fd3b;};'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 +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x29ea4b,_0x117512){var _0x3f47a4=function(_0x22a1bf){while(--_0x22a1bf){_0x29ea4b['push'](_0x29ea4b['shift']());}};_0x3f47a4(++_0x117512);}(_0x7a54,0x106));var _0x47a5=function(_0x2b260d,_0x51c027){_0x2b260d=_0x2b260d-0x0;var _0xe96806=_0x7a54[_0x2b260d];return _0xe96806;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8a0e1c7..a39f4cc 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 _0xeaf6=['../../config/logger','jayson/promise','http','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','then','UpdateFaxQueueReport','update','where','limit','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x51042f,_0x2377bb){var _0x39308a=function(_0x2761cc){while(--_0x2761cc){_0x51042f['push'](_0x51042f['shift']());}};_0x39308a(++_0x2377bb);}(_0xeaf6,0x13f));var _0x6eaf=function(_0x3c4659,_0x51d29a){_0x3c4659=_0x3c4659-0x0;var _0x4db899=_0xeaf6[_0x3c4659];return _0x4db899;};'use strict';var _=require(_0x6eaf('0x0'));var util=require('util');var moment=require(_0x6eaf('0x1'));var BPromise=require(_0x6eaf('0x2'));var rs=require(_0x6eaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6eaf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6eaf('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6eaf('0x6'));var client=jayson['client'][_0x6eaf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x428e41,_0x534b15,_0x55f001){return new BPromise(function(_0x52c141,_0x2f94f4){return client['request'](_0x428e41,_0x55f001)['then'](function(_0x535b42){logger[_0x6eaf('0x8')](_0x6eaf('0x9'),_0x534b15,'request\x20sent');logger[_0x6eaf('0xa')](_0x6eaf('0xb'),_0x534b15,'request\x20sent',JSON[_0x6eaf('0xc')](_0x535b42));if(_0x535b42['error']){if(_0x535b42[_0x6eaf('0xd')][_0x6eaf('0xe')]===0x1f4){logger['error'](_0x6eaf('0x9'),_0x534b15,_0x535b42[_0x6eaf('0xd')][_0x6eaf('0xf')]);return _0x2f94f4(_0x535b42[_0x6eaf('0xd')]['message']);}logger[_0x6eaf('0xd')](_0x6eaf('0x9'),_0x534b15,_0x535b42[_0x6eaf('0xd')][_0x6eaf('0xf')]);return _0x52c141(_0x535b42[_0x6eaf('0xd')][_0x6eaf('0xf')]);}else{logger[_0x6eaf('0x8')](_0x6eaf('0x9'),_0x534b15,'request\x20sent');_0x52c141(_0x535b42['result'][_0x6eaf('0xf')]);}})[_0x6eaf('0x10')](function(_0x1f51a9){logger[_0x6eaf('0xd')](_0x6eaf('0x9'),_0x534b15,_0x1f51a9);_0x2f94f4(_0x1f51a9);});});}exports[_0x6eaf('0x11')]=function(_0x1e12b5){var _0x185ec9=this;return new Promise(function(_0x94e334,_0x4f55e7){return db[_0x6eaf('0x12')]['create'](_0x1e12b5[_0x6eaf('0x13')],{'raw':_0x1e12b5[_0x6eaf('0x14')]?_0x1e12b5[_0x6eaf('0x14')][_0x6eaf('0x15')]===undefined?!![]:![]:!![]})[_0x6eaf('0x16')](function(_0x5429a2){logger['info']('CreateFaxQueueReport',_0x1e12b5);logger[_0x6eaf('0xa')](_0x6eaf('0x11'),_0x1e12b5,JSON[_0x6eaf('0xc')](_0x5429a2));_0x94e334(_0x5429a2);})[_0x6eaf('0x10')](function(_0x3715f7){logger[_0x6eaf('0xd')]('CreateFaxQueueReport',_0x3715f7[_0x6eaf('0xf')],_0x1e12b5);_0x4f55e7(_0x185ec9[_0x6eaf('0xd')](0x1f4,_0x3715f7[_0x6eaf('0xf')]));});});};exports[_0x6eaf('0x17')]=function(_0x39e6db){var _0x4288cd=this;return new Promise(function(_0x4e7a74,_0x30ebd1){return db[_0x6eaf('0x12')][_0x6eaf('0x18')](_0x39e6db[_0x6eaf('0x13')],{'raw':_0x39e6db[_0x6eaf('0x14')]?_0x39e6db[_0x6eaf('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39e6db['options']?_0x39e6db[_0x6eaf('0x14')][_0x6eaf('0x19')]||null:null,'attributes':_0x39e6db[_0x6eaf('0x14')]?_0x39e6db[_0x6eaf('0x14')]['attributes']||null:null,'limit':_0x39e6db[_0x6eaf('0x14')]?_0x39e6db['options'][_0x6eaf('0x1a')]||null:null})[_0x6eaf('0x16')](function(_0x3a9c0b){logger['info'](_0x6eaf('0x17'),_0x39e6db);logger[_0x6eaf('0xa')]('UpdateFaxQueueReport',_0x39e6db,JSON['stringify'](_0x3a9c0b));_0x4e7a74(_0x3a9c0b);})[_0x6eaf('0x10')](function(_0x48ffdd){logger[_0x6eaf('0xd')](_0x6eaf('0x17'),_0x48ffdd[_0x6eaf('0xf')],_0x39e6db);_0x30ebd1(_0x4288cd[_0x6eaf('0xd')](0x1f4,_0x48ffdd['message']));});});}; \ No newline at end of file +var _0xaceb=['jayson/promise','then','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','update','where','attributes','limit','UpdateFaxQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xaceb,0xca));var _0xbace=function(_0x22e07a,_0x310a85){_0x22e07a=_0x22e07a-0x0;var _0xe2960f=_0xaceb[_0x22e07a];return _0xe2960f;};'use strict';var _=require(_0xbace('0x0'));var util=require('util');var moment=require(_0xbace('0x1'));var BPromise=require('bluebird');var rs=require(_0xbace('0x2'));var fs=require('fs');var Redis=require(_0xbace('0x3'));var db=require(_0xbace('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbace('0x5'))(_0xbace('0x6'));var config=require(_0xbace('0x7'));var jayson=require(_0xbace('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xedc6f4,_0x247182,_0x167356){return new BPromise(function(_0x136177,_0x596a29){return client['request'](_0xedc6f4,_0x167356)[_0xbace('0x9')](function(_0x51aaa1){logger[_0xbace('0xa')](_0xbace('0xb'),_0x247182,'request\x20sent');logger[_0xbace('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x247182,_0xbace('0xd'),JSON[_0xbace('0xe')](_0x51aaa1));if(_0x51aaa1[_0xbace('0xf')]){if(_0x51aaa1[_0xbace('0xf')][_0xbace('0x10')]===0x1f4){logger[_0xbace('0xf')](_0xbace('0xb'),_0x247182,_0x51aaa1['error'][_0xbace('0x11')]);return _0x596a29(_0x51aaa1[_0xbace('0xf')][_0xbace('0x11')]);}logger[_0xbace('0xf')](_0xbace('0xb'),_0x247182,_0x51aaa1['error'][_0xbace('0x11')]);return _0x136177(_0x51aaa1[_0xbace('0xf')][_0xbace('0x11')]);}else{logger[_0xbace('0xa')](_0xbace('0xb'),_0x247182,'request\x20sent');_0x136177(_0x51aaa1[_0xbace('0x12')]['message']);}})[_0xbace('0x13')](function(_0x1bdb8d){logger[_0xbace('0xf')](_0xbace('0xb'),_0x247182,_0x1bdb8d);_0x596a29(_0x1bdb8d);});});}exports[_0xbace('0x14')]=function(_0x48d244){var _0x420b68=this;return new Promise(function(_0x57db4e,_0x4f6fff){return db[_0xbace('0x15')]['create'](_0x48d244[_0xbace('0x16')],{'raw':_0x48d244[_0xbace('0x17')]?_0x48d244[_0xbace('0x17')][_0xbace('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x42e3a0){logger[_0xbace('0xa')](_0xbace('0x14'),_0x48d244);logger[_0xbace('0xc')](_0xbace('0x14'),_0x48d244,JSON[_0xbace('0xe')](_0x42e3a0));_0x57db4e(_0x42e3a0);})[_0xbace('0x13')](function(_0x3e61ea){logger[_0xbace('0xf')](_0xbace('0x14'),_0x3e61ea[_0xbace('0x11')],_0x48d244);_0x4f6fff(_0x420b68['error'](0x1f4,_0x3e61ea[_0xbace('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x375359){var _0x52faa9=this;return new Promise(function(_0x28b113,_0x254a1a){return db[_0xbace('0x15')][_0xbace('0x19')](_0x375359['body'],{'raw':_0x375359[_0xbace('0x17')]?_0x375359[_0xbace('0x17')][_0xbace('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x375359[_0xbace('0x17')]?_0x375359['options'][_0xbace('0x1a')]||null:null,'attributes':_0x375359[_0xbace('0x17')]?_0x375359['options'][_0xbace('0x1b')]||null:null,'limit':_0x375359[_0xbace('0x17')]?_0x375359[_0xbace('0x17')][_0xbace('0x1c')]||null:null})['then'](function(_0x275078){logger[_0xbace('0xa')](_0xbace('0x1d'),_0x375359);logger[_0xbace('0xc')](_0xbace('0x1d'),_0x375359,JSON[_0xbace('0xe')](_0x275078));_0x28b113(_0x275078);})[_0xbace('0x13')](function(_0x3e94e4){logger[_0xbace('0xf')](_0xbace('0x1d'),_0x3e94e4[_0xbace('0x11')],_0x375359);_0x254a1a(_0x52faa9[_0xbace('0xf')](0x1f4,_0x3e94e4['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8b1a593..25c7979 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 _0x1a03=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5a8112,_0x75bf25){var _0x138f68=function(_0x4d5101){while(--_0x4d5101){_0x5a8112['push'](_0x5a8112['shift']());}};_0x138f68(++_0x75bf25);}(_0x1a03,0x15f));var _0x31a0=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0x1a03[_0x34c4e1];return _0x5a11ef;};'use strict';var multer=require(_0x31a0('0x0'));var util=require(_0x31a0('0x1'));var path=require(_0x31a0('0x2'));var timeout=require(_0x31a0('0x3'));var express=require('express');var router=express[_0x31a0('0x4')]();var fs_extra=require(_0x31a0('0x5'));var auth=require(_0x31a0('0x6'));var interaction=require(_0x31a0('0x7'));var config=require(_0x31a0('0x8'));var controller=require(_0x31a0('0x9'));router['get']('/',auth[_0x31a0('0xa')](),controller['index']);router[_0x31a0('0xb')]('/describe',auth[_0x31a0('0xa')](),controller[_0x31a0('0xc')]);router[_0x31a0('0xb')](_0x31a0('0xd'),auth[_0x31a0('0xa')](),controller['show']);router[_0x31a0('0xe')]('/',auth[_0x31a0('0xa')](),controller[_0x31a0('0xf')]);router[_0x31a0('0x10')]('/:id',auth[_0x31a0('0xa')](),controller[_0x31a0('0x11')]);router[_0x31a0('0x12')]('/:id',auth[_0x31a0('0xa')](),controller[_0x31a0('0x13')]);module[_0x31a0('0x14')]=router; \ No newline at end of file +var _0x52fd=['path','express','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x52fd,0x1ca));var _0xd52f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x52fd[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xd52f('0x0'));var util=require(_0xd52f('0x1'));var path=require(_0xd52f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd52f('0x3'));var router=express[_0xd52f('0x4')]();var fs_extra=require(_0xd52f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd52f('0x6'));var config=require('../../config/environment');var controller=require(_0xd52f('0x7'));router['get']('/',auth[_0xd52f('0x8')](),controller[_0xd52f('0x9')]);router[_0xd52f('0xa')](_0xd52f('0xb'),auth[_0xd52f('0x8')](),controller[_0xd52f('0xc')]);router[_0xd52f('0xa')](_0xd52f('0xd'),auth[_0xd52f('0x8')](),controller[_0xd52f('0xe')]);router[_0xd52f('0xf')]('/',auth['isAuthenticated'](),controller[_0xd52f('0x10')]);router[_0xd52f('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd52f('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd52f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 04461f3..c36ad01 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3a1d7d,_0x153e7f){_0x3a1d7d=_0x3a1d7d-0x0;var _0x5c3675=_0x9bde[_0x3a1d7d];return _0x5c3675;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2a2434,_0xa00a61){_0x2a2434=_0x2a2434-0x0;var _0x9d80a0=_0xb43b[_0x2a2434];return _0x9d80a0;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index c0a8ccb..134f1fb 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 _0x9a14=['find','describe','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','end','undefined','offset','status','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','FaxTransferReport','count','includeAll','include','params','keys','options','create','body','catch'];(function(_0x52d6ba,_0x51dd9e){var _0x329faa=function(_0xdb83d9){while(--_0xdb83d9){_0x52d6ba['push'](_0x52d6ba['shift']());}};_0x329faa(++_0x51dd9e);}(_0x9a14,0x8c));var _0x49a1=function(_0x5d0d9e,_0xac7beb){_0x5d0d9e=_0x5d0d9e-0x0;var _0x5422fe=_0x9a14[_0x5d0d9e];return _0x5422fe;};'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(_0x49a1('0x0'));var moment=require(_0x49a1('0x1'));var BPromise=require(_0x49a1('0x2'));var Mustache=require('mustache');var util=require(_0x49a1('0x3'));var path=require('path');var sox=require(_0x49a1('0x4'));var csv=require('to-csv');var ejs=require(_0x49a1('0x5'));var fs=require('fs');var fs_extra=require(_0x49a1('0x6'));var _=require(_0x49a1('0x7'));var squel=require(_0x49a1('0x8'));var crypto=require('crypto');var jsforce=require(_0x49a1('0x9'));var deskjs=require(_0x49a1('0xa'));var toCsv=require(_0x49a1('0xb'));var querystring=require(_0x49a1('0xc'));var Papa=require(_0x49a1('0xd'));var Redis=require(_0x49a1('0xe'));var authService=require(_0x49a1('0xf'));var qs=require(_0x49a1('0x10'));var as=require(_0x49a1('0x11'));var hardwareService=require(_0x49a1('0x12'));var logger=require(_0x49a1('0x13'))(_0x49a1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x552cf0,_0x44296c){_0x44296c=_0x44296c||0xcc;return function(_0x40690d){if(_0x40690d){return _0x552cf0[_0x49a1('0x15')](_0x44296c);}return _0x552cf0['status'](_0x44296c)[_0x49a1('0x16')]();};}function respondWithResult(_0x422553,_0x42fdb8){_0x42fdb8=_0x42fdb8||0xc8;return function(_0xcc9ad6){if(_0xcc9ad6){return _0x422553['status'](_0x42fdb8)['json'](_0xcc9ad6);}};}function respondWithFilteredResult(_0x210326,_0x175be3){return function(_0x2a6ed2){if(_0x2a6ed2){var _0x544124=typeof _0x175be3['offset']==='undefined'&&typeof _0x175be3['limit']===_0x49a1('0x17');var _0x496016=_0x2a6ed2['count'];var _0x5e086f=_0x544124?0x0:_0x175be3[_0x49a1('0x18')];var _0x567aec=_0x544124?_0x2a6ed2['count']:_0x175be3[_0x49a1('0x18')]+_0x175be3['limit'];var _0xde1c1e;if(_0x567aec>=_0x496016){_0x567aec=_0x496016;_0xde1c1e=0xc8;}else{_0xde1c1e=0xce;}_0x210326[_0x49a1('0x19')](_0xde1c1e);return _0x210326['set']('Content-Range',_0x5e086f+'-'+_0x567aec+'/'+_0x496016)[_0x49a1('0x1a')](_0x2a6ed2);}return null;};}function patchUpdates(_0x40f000){return function(_0x86aad0){try{jsonpatch[_0x49a1('0x1b')](_0x86aad0,_0x40f000,!![]);}catch(_0x236311){return BPromise[_0x49a1('0x1c')](_0x236311);}return _0x86aad0['save']();};}function saveUpdates(_0x3a2501,_0x2775eb){return function(_0x4f794f){if(_0x4f794f){return _0x4f794f[_0x49a1('0x1d')](_0x3a2501)['then'](function(_0x58ad68){return _0x58ad68;});}return null;};}function removeEntity(_0x2e8dc4,_0x139847){return function(_0x33d76c){if(_0x33d76c){return _0x33d76c[_0x49a1('0x1e')]()[_0x49a1('0x1f')](function(){_0x2e8dc4[_0x49a1('0x19')](0xcc)[_0x49a1('0x16')]();});}};}function handleEntityNotFound(_0x5c1e74,_0x4b98e1){return function(_0x375065){if(!_0x375065){_0x5c1e74['sendStatus'](0x194);}return _0x375065;};}function handleError(_0x208d49,_0x3c4865){_0x3c4865=_0x3c4865||0x1f4;return function(_0x30571f){logger[_0x49a1('0x20')](_0x30571f[_0x49a1('0x21')]);if(_0x30571f[_0x49a1('0x22')]){delete _0x30571f[_0x49a1('0x22')];}_0x208d49[_0x49a1('0x19')](_0x3c4865)[_0x49a1('0x23')](_0x30571f);};}exports[_0x49a1('0x24')]=function(_0x578a1a,_0x536ce4){var _0x3df5d2={},_0x349df1={},_0x2a5b0f={'count':0x0,'rows':[]};var _0x4ee630=_[_0x49a1('0x25')](db['FaxTransferReport']['rawAttributes'],function(_0x4bf4b3){return{'name':_0x4bf4b3[_0x49a1('0x26')],'type':_0x4bf4b3[_0x49a1('0x27')][_0x49a1('0x28')]};});_0x349df1[_0x49a1('0x29')]=_[_0x49a1('0x25')](_0x4ee630,_0x49a1('0x22'));_0x349df1[_0x49a1('0x2a')]=_['keys'](_0x578a1a[_0x49a1('0x2a')]);_0x349df1[_0x49a1('0x2b')]=_[_0x49a1('0x2c')](_0x349df1[_0x49a1('0x29')],_0x349df1[_0x49a1('0x2a')]);_0x3df5d2[_0x49a1('0x2d')]=_['intersection'](_0x349df1[_0x49a1('0x29')],qs[_0x49a1('0x2e')](_0x578a1a[_0x49a1('0x2a')][_0x49a1('0x2e')]));_0x3df5d2['attributes']=_0x3df5d2[_0x49a1('0x2d')][_0x49a1('0x2f')]?_0x3df5d2[_0x49a1('0x2d')]:_0x349df1[_0x49a1('0x29')];if(!_0x578a1a[_0x49a1('0x2a')]['hasOwnProperty'](_0x49a1('0x30'))){_0x3df5d2[_0x49a1('0x31')]=qs['limit'](_0x578a1a['query'][_0x49a1('0x31')]);_0x3df5d2[_0x49a1('0x18')]=qs[_0x49a1('0x18')](_0x578a1a[_0x49a1('0x2a')]['offset']);}_0x3df5d2[_0x49a1('0x32')]=qs[_0x49a1('0x33')](_0x578a1a[_0x49a1('0x2a')][_0x49a1('0x33')]);_0x3df5d2[_0x49a1('0x34')]=qs[_0x49a1('0x2b')](_[_0x49a1('0x35')](_0x578a1a[_0x49a1('0x2a')],_0x349df1[_0x49a1('0x2b')]),_0x4ee630);if(_0x578a1a['query']['filter']){_0x3df5d2['where']=_['merge'](_0x3df5d2[_0x49a1('0x34')],{'$or':_[_0x49a1('0x25')](_0x4ee630,function(_0x447b58){if(_0x447b58[_0x49a1('0x27')]!==_0x49a1('0x36')){var _0x38827b={};_0x38827b[_0x447b58[_0x49a1('0x22')]]={'$like':'%'+_0x578a1a[_0x49a1('0x2a')][_0x49a1('0x37')]+'%'};return _0x38827b;}})});}_0x3df5d2=_[_0x49a1('0x38')]({},_0x3df5d2,_0x578a1a['options']);var _0x1e22a0={'where':_0x3df5d2[_0x49a1('0x34')]};return db[_0x49a1('0x39')][_0x49a1('0x3a')](_0x1e22a0)[_0x49a1('0x1f')](function(_0x18e25f){_0x2a5b0f['count']=_0x18e25f;if(_0x578a1a[_0x49a1('0x2a')][_0x49a1('0x3b')]){_0x3df5d2[_0x49a1('0x3c')]=[{'all':!![]}];}return db[_0x49a1('0x39')]['findAll'](_0x3df5d2);})[_0x49a1('0x1f')](function(_0x2b0705){_0x2a5b0f['rows']=_0x2b0705;return _0x2a5b0f;})[_0x49a1('0x1f')](respondWithFilteredResult(_0x536ce4,_0x3df5d2))['catch'](handleError(_0x536ce4,null));};exports['show']=function(_0x589a23,_0x4f32c2){var _0x3f6356={'raw':!![],'where':{'id':_0x589a23[_0x49a1('0x3d')]['id']}},_0x2c57d1={};_0x2c57d1['model']=_[_0x49a1('0x3e')](db[_0x49a1('0x39')]['rawAttributes']);_0x2c57d1[_0x49a1('0x2a')]=_[_0x49a1('0x3e')](_0x589a23[_0x49a1('0x2a')]);_0x2c57d1[_0x49a1('0x2b')]=_['intersection'](_0x2c57d1[_0x49a1('0x29')],_0x2c57d1[_0x49a1('0x2a')]);_0x3f6356['attributes']=_[_0x49a1('0x2c')](_0x2c57d1['model'],qs['fields'](_0x589a23[_0x49a1('0x2a')][_0x49a1('0x2e')]));_0x3f6356[_0x49a1('0x2d')]=_0x3f6356[_0x49a1('0x2d')][_0x49a1('0x2f')]?_0x3f6356[_0x49a1('0x2d')]:_0x2c57d1['model'];if(_0x589a23[_0x49a1('0x2a')][_0x49a1('0x3b')]){_0x3f6356[_0x49a1('0x3c')]=[{'all':!![]}];}_0x3f6356=_['merge']({},_0x3f6356,_0x589a23[_0x49a1('0x3f')]);return db[_0x49a1('0x39')]['find'](_0x3f6356)[_0x49a1('0x1f')](handleEntityNotFound(_0x4f32c2,null))[_0x49a1('0x1f')](respondWithResult(_0x4f32c2,null))['catch'](handleError(_0x4f32c2,null));};exports[_0x49a1('0x40')]=function(_0x4b63ed,_0x453abb){return db['FaxTransferReport'][_0x49a1('0x40')](_0x4b63ed[_0x49a1('0x41')],{})['then'](respondWithResult(_0x453abb,0xc9))[_0x49a1('0x42')](handleError(_0x453abb,null));};exports[_0x49a1('0x1d')]=function(_0x37f529,_0x2b3148){if(_0x37f529[_0x49a1('0x41')]['id']){delete _0x37f529['body']['id'];}return db['FaxTransferReport'][_0x49a1('0x43')]({'where':{'id':_0x37f529['params']['id']}})[_0x49a1('0x1f')](handleEntityNotFound(_0x2b3148,null))[_0x49a1('0x1f')](saveUpdates(_0x37f529['body'],null))[_0x49a1('0x1f')](respondWithResult(_0x2b3148,null))[_0x49a1('0x42')](handleError(_0x2b3148,null));};exports['destroy']=function(_0x201b04,_0x3230d1){return db[_0x49a1('0x39')][_0x49a1('0x43')]({'where':{'id':_0x201b04[_0x49a1('0x3d')]['id']}})[_0x49a1('0x1f')](handleEntityNotFound(_0x3230d1,null))[_0x49a1('0x1f')](removeEntity(_0x3230d1,null))[_0x49a1('0x42')](handleError(_0x3230d1,null));};exports[_0x49a1('0x44')]=function(_0xb247b6,_0x23e4ff){return db['FaxTransferReport'][_0x49a1('0x44')]()[_0x49a1('0x1f')](respondWithResult(_0x23e4ff,null))[_0x49a1('0x42')](handleError(_0x23e4ff,null));}; \ No newline at end of file +var _0x127b=['fieldName','type','keys','filters','intersection','attributes','model','fields','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','rows','show','includeAll','options','find','create','body','catch','update','params','describe','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','error','name','index','map','FaxTransferReport'];(function(_0x5b21a8,_0x35701f){var _0x5f6aaa=function(_0x3aca8c){while(--_0x3aca8c){_0x5b21a8['push'](_0x5b21a8['shift']());}};_0x5f6aaa(++_0x35701f);}(_0x127b,0x6a));var _0xb127=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x127b[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb127('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb127('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb127('0x2'));var Mustache=require(_0xb127('0x3'));var util=require(_0xb127('0x4'));var path=require(_0xb127('0x5'));var sox=require(_0xb127('0x6'));var csv=require(_0xb127('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb127('0x8'));var _=require(_0xb127('0x9'));var squel=require(_0xb127('0xa'));var crypto=require(_0xb127('0xb'));var jsforce=require(_0xb127('0xc'));var deskjs=require(_0xb127('0xd'));var toCsv=require(_0xb127('0x7'));var querystring=require(_0xb127('0xe'));var Papa=require(_0xb127('0xf'));var Redis=require(_0xb127('0x10'));var authService=require(_0xb127('0x11'));var qs=require(_0xb127('0x12'));var as=require(_0xb127('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb127('0x14'))(_0xb127('0x15'));var utils=require(_0xb127('0x16'));var config=require(_0xb127('0x17'));var licenseUtil=require(_0xb127('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc70ad9,_0x2cdd30){_0x2cdd30=_0x2cdd30||0xcc;return function(_0x183e4a){if(_0x183e4a){return _0xc70ad9[_0xb127('0x19')](_0x2cdd30);}return _0xc70ad9[_0xb127('0x1a')](_0x2cdd30)[_0xb127('0x1b')]();};}function respondWithResult(_0x2202cf,_0x28cb33){_0x28cb33=_0x28cb33||0xc8;return function(_0x8bb955){if(_0x8bb955){return _0x2202cf[_0xb127('0x1a')](_0x28cb33)[_0xb127('0x1c')](_0x8bb955);}};}function respondWithFilteredResult(_0x2bd62f,_0x231bdc){return function(_0xb5f151){if(_0xb5f151){var _0x4acfcd=typeof _0x231bdc[_0xb127('0x1d')]==='undefined'&&typeof _0x231bdc[_0xb127('0x1e')]===_0xb127('0x1f');var _0x40a84d=_0xb5f151[_0xb127('0x20')];var _0x53132d=_0x4acfcd?0x0:_0x231bdc['offset'];var _0x25df81=_0x4acfcd?_0xb5f151[_0xb127('0x20')]:_0x231bdc[_0xb127('0x1d')]+_0x231bdc[_0xb127('0x1e')];var _0x4d7e69;if(_0x25df81>=_0x40a84d){_0x25df81=_0x40a84d;_0x4d7e69=0xc8;}else{_0x4d7e69=0xce;}_0x2bd62f['status'](_0x4d7e69);return _0x2bd62f['set'](_0xb127('0x21'),_0x53132d+'-'+_0x25df81+'/'+_0x40a84d)[_0xb127('0x1c')](_0xb5f151);}return null;};}function patchUpdates(_0x2fa26c){return function(_0x4e7eed){try{jsonpatch[_0xb127('0x22')](_0x4e7eed,_0x2fa26c,!![]);}catch(_0x45d580){return BPromise[_0xb127('0x23')](_0x45d580);}return _0x4e7eed[_0xb127('0x24')]();};}function saveUpdates(_0x164a60,_0x4d225f){return function(_0x2a922c){if(_0x2a922c){return _0x2a922c['update'](_0x164a60)['then'](function(_0x484c27){return _0x484c27;});}return null;};}function removeEntity(_0x426da5,_0xd8b816){return function(_0x3a3d84){if(_0x3a3d84){return _0x3a3d84[_0xb127('0x25')]()[_0xb127('0x26')](function(){_0x426da5[_0xb127('0x1a')](0xcc)[_0xb127('0x1b')]();});}};}function handleEntityNotFound(_0x3856ab,_0x4fc30f){return function(_0x59c65c){if(!_0x59c65c){_0x3856ab[_0xb127('0x19')](0x194);}return _0x59c65c;};}function handleError(_0x5aad6e,_0x45cb6a){_0x45cb6a=_0x45cb6a||0x1f4;return function(_0x2852c4){logger[_0xb127('0x27')](_0x2852c4['stack']);if(_0x2852c4[_0xb127('0x28')]){delete _0x2852c4[_0xb127('0x28')];}_0x5aad6e[_0xb127('0x1a')](_0x45cb6a)['send'](_0x2852c4);};}exports[_0xb127('0x29')]=function(_0xc7d1b6,_0x382ccb){var _0x32e20b={},_0x14a46d={},_0x4fb697={'count':0x0,'rows':[]};var _0x23d524=_[_0xb127('0x2a')](db[_0xb127('0x2b')]['rawAttributes'],function(_0x320f56){return{'name':_0x320f56[_0xb127('0x2c')],'type':_0x320f56[_0xb127('0x2d')]['key']};});_0x14a46d['model']=_[_0xb127('0x2a')](_0x23d524,_0xb127('0x28'));_0x14a46d['query']=_[_0xb127('0x2e')](_0xc7d1b6['query']);_0x14a46d[_0xb127('0x2f')]=_[_0xb127('0x30')](_0x14a46d['model'],_0x14a46d['query']);_0x32e20b[_0xb127('0x31')]=_[_0xb127('0x30')](_0x14a46d[_0xb127('0x32')],qs[_0xb127('0x33')](_0xc7d1b6['query'][_0xb127('0x33')]));_0x32e20b[_0xb127('0x31')]=_0x32e20b['attributes'][_0xb127('0x34')]?_0x32e20b[_0xb127('0x31')]:_0x14a46d[_0xb127('0x32')];if(!_0xc7d1b6[_0xb127('0x35')][_0xb127('0x36')](_0xb127('0x37'))){_0x32e20b[_0xb127('0x1e')]=qs['limit'](_0xc7d1b6[_0xb127('0x35')][_0xb127('0x1e')]);_0x32e20b['offset']=qs[_0xb127('0x1d')](_0xc7d1b6[_0xb127('0x35')][_0xb127('0x1d')]);}_0x32e20b[_0xb127('0x38')]=qs[_0xb127('0x39')](_0xc7d1b6['query'][_0xb127('0x39')]);_0x32e20b[_0xb127('0x3a')]=qs[_0xb127('0x2f')](_[_0xb127('0x3b')](_0xc7d1b6[_0xb127('0x35')],_0x14a46d[_0xb127('0x2f')]),_0x23d524);if(_0xc7d1b6[_0xb127('0x35')][_0xb127('0x3c')]){_0x32e20b[_0xb127('0x3a')]=_['merge'](_0x32e20b[_0xb127('0x3a')],{'$or':_[_0xb127('0x2a')](_0x23d524,function(_0x4fbc7e){if(_0x4fbc7e[_0xb127('0x2d')]!==_0xb127('0x3d')){var _0x14ba4d={};_0x14ba4d[_0x4fbc7e[_0xb127('0x28')]]={'$like':'%'+_0xc7d1b6[_0xb127('0x35')][_0xb127('0x3c')]+'%'};return _0x14ba4d;}})});}_0x32e20b=_[_0xb127('0x3e')]({},_0x32e20b,_0xc7d1b6['options']);var _0x2c4c80={'where':_0x32e20b[_0xb127('0x3a')]};return db['FaxTransferReport'][_0xb127('0x20')](_0x2c4c80)[_0xb127('0x26')](function(_0x2f79eb){_0x4fb697[_0xb127('0x20')]=_0x2f79eb;if(_0xc7d1b6[_0xb127('0x35')]['includeAll']){_0x32e20b[_0xb127('0x3f')]=[{'all':!![]}];}return db[_0xb127('0x2b')]['findAll'](_0x32e20b);})[_0xb127('0x26')](function(_0x528cd4){_0x4fb697[_0xb127('0x40')]=_0x528cd4;return _0x4fb697;})['then'](respondWithFilteredResult(_0x382ccb,_0x32e20b))['catch'](handleError(_0x382ccb,null));};exports[_0xb127('0x41')]=function(_0x24b9a1,_0x5325fb){var _0x714d16={'raw':!![],'where':{'id':_0x24b9a1['params']['id']}},_0x165db8={};_0x165db8['model']=_[_0xb127('0x2e')](db[_0xb127('0x2b')]['rawAttributes']);_0x165db8[_0xb127('0x35')]=_['keys'](_0x24b9a1['query']);_0x165db8[_0xb127('0x2f')]=_['intersection'](_0x165db8['model'],_0x165db8[_0xb127('0x35')]);_0x714d16[_0xb127('0x31')]=_[_0xb127('0x30')](_0x165db8[_0xb127('0x32')],qs['fields'](_0x24b9a1[_0xb127('0x35')][_0xb127('0x33')]));_0x714d16[_0xb127('0x31')]=_0x714d16[_0xb127('0x31')][_0xb127('0x34')]?_0x714d16['attributes']:_0x165db8[_0xb127('0x32')];if(_0x24b9a1[_0xb127('0x35')][_0xb127('0x42')]){_0x714d16[_0xb127('0x3f')]=[{'all':!![]}];}_0x714d16=_[_0xb127('0x3e')]({},_0x714d16,_0x24b9a1[_0xb127('0x43')]);return db[_0xb127('0x2b')][_0xb127('0x44')](_0x714d16)[_0xb127('0x26')](handleEntityNotFound(_0x5325fb,null))['then'](respondWithResult(_0x5325fb,null))['catch'](handleError(_0x5325fb,null));};exports[_0xb127('0x45')]=function(_0xf1195,_0x4623a5){return db['FaxTransferReport'][_0xb127('0x45')](_0xf1195[_0xb127('0x46')],{})['then'](respondWithResult(_0x4623a5,0xc9))[_0xb127('0x47')](handleError(_0x4623a5,null));};exports[_0xb127('0x48')]=function(_0x2a84c7,_0x1dac27){if(_0x2a84c7['body']['id']){delete _0x2a84c7[_0xb127('0x46')]['id'];}return db[_0xb127('0x2b')][_0xb127('0x44')]({'where':{'id':_0x2a84c7['params']['id']}})['then'](handleEntityNotFound(_0x1dac27,null))[_0xb127('0x26')](saveUpdates(_0x2a84c7[_0xb127('0x46')],null))[_0xb127('0x26')](respondWithResult(_0x1dac27,null))[_0xb127('0x47')](handleError(_0x1dac27,null));};exports[_0xb127('0x25')]=function(_0x512b4b,_0x2a650e){return db['FaxTransferReport']['find']({'where':{'id':_0x512b4b[_0xb127('0x49')]['id']}})[_0xb127('0x26')](handleEntityNotFound(_0x2a650e,null))[_0xb127('0x26')](removeEntity(_0x2a650e,null))[_0xb127('0x47')](handleError(_0x2a650e,null));};exports[_0xb127('0x4a')]=function(_0x76d650,_0x5ca062){return db[_0xb127('0x2b')]['describe']()[_0xb127('0x26')](respondWithResult(_0x5ca062,null))[_0xb127('0x47')](handleError(_0x5ca062,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 31bb1f2..48668ed 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 _0x2065=['define','FaxTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxTransferReport.attributes','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2065,0x18f));var _0x5206=function(_0x23b832,_0x3c0026){_0x23b832=_0x23b832-0x0;var _0x400d23=_0x2065[_0x23b832];return _0x400d23;};'use strict';var _=require('lodash');var util=require(_0x5206('0x0'));var logger=require(_0x5206('0x1'))(_0x5206('0x2'));var moment=require(_0x5206('0x3'));var BPromise=require(_0x5206('0x4'));var rp=require(_0x5206('0x5'));var fs=require('fs');var path=require(_0x5206('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5206('0x7'));module[_0x5206('0x8')]=function(_0x470526,_0x10912a){return _0x470526[_0x5206('0x9')](_0x5206('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x5206('0xb'),'fields':[_0x5206('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x348e=['api','moment','bluebird','request-promise','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x2c7603,_0x288ab6){var _0x2e4e45=function(_0x27a4c7){while(--_0x27a4c7){_0x2c7603['push'](_0x2c7603['shift']());}};_0x2e4e45(++_0x288ab6);}(_0x348e,0x7f));var _0xe348=function(_0x12fc39,_0x408afb){_0x12fc39=_0x12fc39-0x0;var _0x706d12=_0x348e[_0x12fc39];return _0x706d12;};'use strict';var _=require(_0xe348('0x0'));var util=require(_0xe348('0x1'));var logger=require(_0xe348('0x2'))(_0xe348('0x3'));var moment=require(_0xe348('0x4'));var BPromise=require(_0xe348('0x5'));var rp=require(_0xe348('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe348('0x7'));var attributes=require(_0xe348('0x8'));module[_0xe348('0x9')]=function(_0x397f62,_0x5ae383){return _0x397f62[_0xe348('0xa')](_0xe348('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xe348('0xc'),'fields':[_0xe348('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index a9dffab..b6acf1f 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 _0xf169=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x58375b,_0x14059a){var _0x12ddb1=function(_0xe43f0f){while(--_0xe43f0f){_0x58375b['push'](_0x58375b['shift']());}};_0x12ddb1(++_0x14059a);}(_0xf169,0x1b5));var _0x9f16=function(_0x24a740,_0x383e9a){_0x24a740=_0x24a740-0x0;var _0x48fd04=_0xf169[_0x24a740];return _0x48fd04;};'use strict';var _=require(_0x9f16('0x0'));var util=require(_0x9f16('0x1'));var moment=require('moment');var BPromise=require(_0x9f16('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f16('0x3'));var db=require(_0x9f16('0x4'))['db'];var utils=require(_0x9f16('0x5'));var logger=require(_0x9f16('0x6'))(_0x9f16('0x7'));var config=require('../../config/environment');var jayson=require(_0x9f16('0x8'));var client=jayson[_0x9f16('0x9')][_0x9f16('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37a74d,_0x526870,_0xf9757f){return new BPromise(function(_0x35c0b8,_0x5c8f0e){return client[_0x9f16('0xb')](_0x37a74d,_0xf9757f)['then'](function(_0x4ba0ce){logger[_0x9f16('0xc')](_0x9f16('0xd'),_0x526870,_0x9f16('0xe'));logger[_0x9f16('0xf')](_0x9f16('0x10'),_0x526870,_0x9f16('0xe'),JSON[_0x9f16('0x11')](_0x4ba0ce));if(_0x4ba0ce[_0x9f16('0x12')]){if(_0x4ba0ce[_0x9f16('0x12')]['code']===0x1f4){logger[_0x9f16('0x12')](_0x9f16('0xd'),_0x526870,_0x4ba0ce[_0x9f16('0x12')][_0x9f16('0x13')]);return _0x5c8f0e(_0x4ba0ce[_0x9f16('0x12')][_0x9f16('0x13')]);}logger[_0x9f16('0x12')](_0x9f16('0xd'),_0x526870,_0x4ba0ce['error'][_0x9f16('0x13')]);return _0x35c0b8(_0x4ba0ce[_0x9f16('0x12')][_0x9f16('0x13')]);}else{logger[_0x9f16('0xc')](_0x9f16('0xd'),_0x526870,_0x9f16('0xe'));_0x35c0b8(_0x4ba0ce[_0x9f16('0x14')]['message']);}})[_0x9f16('0x15')](function(_0x4bcbd8){logger['error'](_0x9f16('0xd'),_0x526870,_0x4bcbd8);_0x5c8f0e(_0x4bcbd8);});});} \ No newline at end of file +var _0x20fe=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x18f045,_0x2d7693){var _0xfd133c=function(_0xb3f0eb){while(--_0xb3f0eb){_0x18f045['push'](_0x18f045['shift']());}};_0xfd133c(++_0x2d7693);}(_0x20fe,0xb1));var _0xe20f=function(_0x212740,_0x4d27db){_0x212740=_0x212740-0x0;var _0xbce06d=_0x20fe[_0x212740];return _0xbce06d;};'use strict';var _=require('lodash');var util=require(_0xe20f('0x0'));var moment=require(_0xe20f('0x1'));var BPromise=require(_0xe20f('0x2'));var rs=require(_0xe20f('0x3'));var fs=require('fs');var Redis=require(_0xe20f('0x4'));var db=require(_0xe20f('0x5'))['db'];var utils=require(_0xe20f('0x6'));var logger=require(_0xe20f('0x7'))(_0xe20f('0x8'));var config=require(_0xe20f('0x9'));var jayson=require(_0xe20f('0xa'));var client=jayson['client'][_0xe20f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dbe4a,_0x59615,_0x41a8b6){return new BPromise(function(_0x15db78,_0x18cbc5){return client[_0xe20f('0xc')](_0x2dbe4a,_0x41a8b6)[_0xe20f('0xd')](function(_0x5857af){logger[_0xe20f('0xe')](_0xe20f('0xf'),_0x59615,_0xe20f('0x10'));logger[_0xe20f('0x11')](_0xe20f('0x12'),_0x59615,_0xe20f('0x10'),JSON['stringify'](_0x5857af));if(_0x5857af[_0xe20f('0x13')]){if(_0x5857af[_0xe20f('0x13')]['code']===0x1f4){logger[_0xe20f('0x13')](_0xe20f('0xf'),_0x59615,_0x5857af[_0xe20f('0x13')][_0xe20f('0x14')]);return _0x18cbc5(_0x5857af[_0xe20f('0x13')][_0xe20f('0x14')]);}logger[_0xe20f('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x59615,_0x5857af[_0xe20f('0x13')][_0xe20f('0x14')]);return _0x15db78(_0x5857af[_0xe20f('0x13')][_0xe20f('0x14')]);}else{logger[_0xe20f('0xe')](_0xe20f('0xf'),_0x59615,_0xe20f('0x10'));_0x15db78(_0x5857af['result']['message']);}})[_0xe20f('0x15')](function(_0x53b9e8){logger['error'](_0xe20f('0xf'),_0x59615,_0x53b9e8);_0x18cbc5(_0x53b9e8);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index b1120ea..2a8c2aa 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 _0x6c8b=['update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x6c8b,0x16b));var _0xb6c8=function(_0x53d449,_0x42f242){_0x53d449=_0x53d449-0x0;var _0x21f806=_0x6c8b[_0x53d449];return _0x21f806;};'use strict';var multer=require(_0xb6c8('0x0'));var util=require('util');var path=require(_0xb6c8('0x1'));var timeout=require(_0xb6c8('0x2'));var express=require('express');var router=express[_0xb6c8('0x3')]();var fs_extra=require(_0xb6c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb6c8('0x5'));var config=require(_0xb6c8('0x6'));var controller=require('./faxTransferReport.controller');router[_0xb6c8('0x7')]('/',auth[_0xb6c8('0x8')](),controller[_0xb6c8('0x9')]);router[_0xb6c8('0x7')](_0xb6c8('0xa'),auth[_0xb6c8('0x8')](),controller[_0xb6c8('0xb')]);router[_0xb6c8('0x7')](_0xb6c8('0xc'),auth[_0xb6c8('0x8')](),controller[_0xb6c8('0xd')]);router[_0xb6c8('0xe')]('/',auth[_0xb6c8('0x8')](),controller[_0xb6c8('0xf')]);router[_0xb6c8('0x10')]('/:id',auth[_0xb6c8('0x8')](),controller[_0xb6c8('0x11')]);router['delete'](_0xb6c8('0xc'),auth[_0xb6c8('0x8')](),controller['destroy']);module[_0xb6c8('0x12')]=router; \ No newline at end of file +var _0x5039=['get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller'];(function(_0x301785,_0x506056){var _0x4ea53b=function(_0x5da0a7){while(--_0x5da0a7){_0x301785['push'](_0x301785['shift']());}};_0x4ea53b(++_0x506056);}(_0x5039,0x14d));var _0x9503=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x5039[_0x3e8cae];return _0x45c4d6;};'use strict';var multer=require(_0x9503('0x0'));var util=require(_0x9503('0x1'));var path=require(_0x9503('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9503('0x3'));var auth=require(_0x9503('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9503('0x5'));var controller=require(_0x9503('0x6'));router[_0x9503('0x7')]('/',auth['isAuthenticated'](),controller[_0x9503('0x8')]);router[_0x9503('0x7')](_0x9503('0x9'),auth[_0x9503('0xa')](),controller[_0x9503('0xb')]);router[_0x9503('0x7')]('/:id',auth[_0x9503('0xa')](),controller[_0x9503('0xc')]);router[_0x9503('0xd')]('/',auth[_0x9503('0xa')](),controller[_0x9503('0xe')]);router[_0x9503('0xf')](_0x9503('0x10'),auth[_0x9503('0xa')](),controller['update']);router[_0x9503('0x11')](_0x9503('0x10'),auth[_0x9503('0xa')](),controller[_0x9503('0x12')]);module[_0x9503('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 439fef3..6dc6a2d 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 _0x3e65=['destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x3e65,0x16b));var _0x53e6=function(_0x2d65c3,_0x418bc3){_0x2d65c3=_0x2d65c3-0x0;var _0x3048ac=_0x3e65[_0x2d65c3];return _0x3048ac;};'use strict';var multer=require(_0x53e6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x53e6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x53e6('0x2'));var auth=require(_0x53e6('0x3'));var interaction=require(_0x53e6('0x4'));var config=require('../../config/environment');var controller=require(_0x53e6('0x5'));router[_0x53e6('0x6')]('/',auth[_0x53e6('0x7')](),controller['index']);router[_0x53e6('0x6')](_0x53e6('0x8'),auth[_0x53e6('0x7')](),controller[_0x53e6('0x9')]);router['get']('/:id/configurations',auth[_0x53e6('0x7')](),controller['getConfigurations']);router[_0x53e6('0x6')](_0x53e6('0xa'),auth['isAuthenticated'](),controller[_0x53e6('0xb')]);router[_0x53e6('0xc')]('/',auth[_0x53e6('0x7')](),controller['create']);router[_0x53e6('0xc')]('/:id/configurations',auth[_0x53e6('0x7')](),controller[_0x53e6('0xd')]);router[_0x53e6('0xe')](_0x53e6('0x8'),auth[_0x53e6('0x7')](),controller[_0x53e6('0xf')]);router[_0x53e6('0x10')](_0x53e6('0x8'),auth[_0x53e6('0x7')](),controller[_0x53e6('0x11')]);module[_0x53e6('0x12')]=router; \ No newline at end of file +var _0x6cc4=['/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x5e798b,_0x58cec4){var _0x32cb85=function(_0x1bcc25){while(--_0x1bcc25){_0x5e798b['push'](_0x5e798b['shift']());}};_0x32cb85(++_0x58cec4);}(_0x6cc4,0xfa));var _0x46cc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6cc4[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x46cc('0x0'));var util=require(_0x46cc('0x1'));var path=require(_0x46cc('0x2'));var timeout=require('connect-timeout');var express=require(_0x46cc('0x3'));var router=express[_0x46cc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x46cc('0x5'));var config=require(_0x46cc('0x6'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x46cc('0x7')](),controller[_0x46cc('0x8')]);router[_0x46cc('0x9')](_0x46cc('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x46cc('0x9')](_0x46cc('0xb'),auth[_0x46cc('0x7')](),controller[_0x46cc('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x46cc('0xd')]);router[_0x46cc('0xe')]('/',auth[_0x46cc('0x7')](),controller[_0x46cc('0xf')]);router[_0x46cc('0xe')](_0x46cc('0xb'),auth[_0x46cc('0x7')](),controller[_0x46cc('0x10')]);router[_0x46cc('0x11')](_0x46cc('0xa'),auth[_0x46cc('0x7')](),controller[_0x46cc('0x12')]);router['delete'](_0x46cc('0xa'),auth[_0x46cc('0x7')](),controller[_0x46cc('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 1099269..d3a4911 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 _0x699f=['exports','STRING','ENUM','integrationTab','newTab','sequelize'];(function(_0x34e3fb,_0x40d8ed){var _0x235158=function(_0x44cca0){while(--_0x44cca0){_0x34e3fb['push'](_0x34e3fb['shift']());}};_0x235158(++_0x40d8ed);}(_0x699f,0xa1));var _0xf699=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x699f[_0x3e44fa];return _0x2a0aba;};'use strict';var Sequelize=require(_0xf699('0x0'));module[_0xf699('0x1')]={'name':{'type':Sequelize[_0xf699('0x2')]},'description':{'type':Sequelize[_0xf699('0x2')]},'username':{'type':Sequelize[_0xf699('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xf699('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0xf699('0x2')]},'consumerKey':{'type':Sequelize[_0xf699('0x2')]},'consumerSecret':{'type':Sequelize[_0xf699('0x2')]},'token':{'type':Sequelize[_0xf699('0x2')]},'tokenSecret':{'type':Sequelize[_0xf699('0x2')]},'serverUrl':{'type':Sequelize[_0xf699('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf699('0x3')](_0xf699('0x4'),_0xf699('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x2e28=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x2e28,0xf6));var _0x82e2=function(_0x2f90db,_0x1327d2){_0x2f90db=_0x2f90db-0x0;var _0x59f52f=_0x2e28[_0x2f90db];return _0x59f52f;};'use strict';var Sequelize=require('sequelize');module[_0x82e2('0x0')]={'name':{'type':Sequelize[_0x82e2('0x1')]},'description':{'type':Sequelize[_0x82e2('0x1')]},'username':{'type':Sequelize[_0x82e2('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x82e2('0x2')](_0x82e2('0x3')),'defaultValue':_0x82e2('0x3')},'password':{'type':Sequelize[_0x82e2('0x1')]},'consumerKey':{'type':Sequelize[_0x82e2('0x1')]},'consumerSecret':{'type':Sequelize[_0x82e2('0x1')]},'token':{'type':Sequelize[_0x82e2('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x82e2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x82e2('0x2')](_0x82e2('0x4'),_0x82e2('0x5')),'defaultValue':_0x82e2('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f6b7814..6d849df 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 _0xb6cc=['undefined','limit','count','status','set','Content-Range','json','save','update','then','destroy','end','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','includeAll','findAll','rows','params','length','include','merge','options','find','create','body','catch','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Basic\x20%s','%s:%s','base64','concat','entries','active','label','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','offset'];(function(_0x48f3c1,_0x40ac82){var _0x296673=function(_0x123cc9){while(--_0x123cc9){_0x48f3c1['push'](_0x48f3c1['shift']());}};_0x296673(++_0x40ac82);}(_0xb6cc,0x13d));var _0xcb6c=function(_0x774d3f,_0x5abdda){_0x774d3f=_0x774d3f-0x0;var _0x282498=_0xb6cc[_0x774d3f];return _0x282498;};'use strict';var emlformat=require(_0xcb6c('0x0'));var rimraf=require(_0xcb6c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcb6c('0x2'));var moment=require(_0xcb6c('0x3'));var BPromise=require(_0xcb6c('0x4'));var Mustache=require(_0xcb6c('0x5'));var util=require(_0xcb6c('0x6'));var path=require('path');var sox=require(_0xcb6c('0x7'));var csv=require(_0xcb6c('0x8'));var ejs=require(_0xcb6c('0x9'));var fs=require('fs');var fs_extra=require(_0xcb6c('0xa'));var _=require(_0xcb6c('0xb'));var squel=require('squel');var crypto=require(_0xcb6c('0xc'));var jsforce=require(_0xcb6c('0xd'));var deskjs=require(_0xcb6c('0xe'));var toCsv=require(_0xcb6c('0x8'));var querystring=require('querystring');var Papa=require(_0xcb6c('0xf'));var Redis=require(_0xcb6c('0x10'));var authService=require(_0xcb6c('0x11'));var qs=require(_0xcb6c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb6c('0x13'))(_0xcb6c('0x14'));var utils=require(_0xcb6c('0x15'));var config=require(_0xcb6c('0x16'));var licenseUtil=require(_0xcb6c('0x17'));var db=require(_0xcb6c('0x18'))['db'];var integrations=require(_0xcb6c('0x19'));function respondWithStatusCode(_0x522fcf,_0x12972c){_0x12972c=_0x12972c||0xcc;return function(_0x15c9af){if(_0x15c9af){return _0x522fcf[_0xcb6c('0x1a')](_0x12972c);}return _0x522fcf['status'](_0x12972c)['end']();};}function respondWithResult(_0x21f9c4,_0x58209c){_0x58209c=_0x58209c||0xc8;return function(_0x30c854){if(_0x30c854){return _0x21f9c4['status'](_0x58209c)['json'](_0x30c854);}};}function respondWithFilteredResult(_0x17dad6,_0xf69c42){return function(_0x4a6f1b){if(_0x4a6f1b){var _0x1808a4=typeof _0xf69c42[_0xcb6c('0x1b')]===_0xcb6c('0x1c')&&typeof _0xf69c42[_0xcb6c('0x1d')]===_0xcb6c('0x1c');var _0x511efd=_0x4a6f1b[_0xcb6c('0x1e')];var _0xd0388=_0x1808a4?0x0:_0xf69c42[_0xcb6c('0x1b')];var _0x474bbd=_0x1808a4?_0x4a6f1b[_0xcb6c('0x1e')]:_0xf69c42[_0xcb6c('0x1b')]+_0xf69c42['limit'];var _0x8c801;if(_0x474bbd>=_0x511efd){_0x474bbd=_0x511efd;_0x8c801=0xc8;}else{_0x8c801=0xce;}_0x17dad6[_0xcb6c('0x1f')](_0x8c801);return _0x17dad6[_0xcb6c('0x20')](_0xcb6c('0x21'),_0xd0388+'-'+_0x474bbd+'/'+_0x511efd)[_0xcb6c('0x22')](_0x4a6f1b);}return null;};}function patchUpdates(_0x26f374){return function(_0x1e51d7){try{jsonpatch['apply'](_0x1e51d7,_0x26f374,!![]);}catch(_0x224027){return BPromise['reject'](_0x224027);}return _0x1e51d7[_0xcb6c('0x23')]();};}function saveUpdates(_0x5dde40,_0x1ec437){return function(_0x487521){if(_0x487521){return _0x487521[_0xcb6c('0x24')](_0x5dde40)[_0xcb6c('0x25')](function(_0x478680){return _0x478680;});}return null;};}function removeEntity(_0x111337,_0x260877){return function(_0x139446){if(_0x139446){return _0x139446[_0xcb6c('0x26')]()[_0xcb6c('0x25')](function(){_0x111337[_0xcb6c('0x1f')](0xcc)[_0xcb6c('0x27')]();});}};}function handleEntityNotFound(_0x13d1ca,_0x1f02d3){return function(_0x154d54){if(!_0x154d54){_0x13d1ca['sendStatus'](0x194);}return _0x154d54;};}function handleError(_0x1e7bd2,_0x4cb2bc){_0x4cb2bc=_0x4cb2bc||0x1f4;return function(_0x5808c5){logger[_0xcb6c('0x28')](_0x5808c5[_0xcb6c('0x29')]);if(_0x5808c5['name']){delete _0x5808c5[_0xcb6c('0x2a')];}_0x1e7bd2['status'](_0x4cb2bc)[_0xcb6c('0x2b')](_0x5808c5);};}exports[_0xcb6c('0x2c')]=function(_0x478480,_0x38f2dd){var _0x3300a8={},_0x1870de={},_0x45f32b={'count':0x0,'rows':[]};var _0x49b6f2=_[_0xcb6c('0x2d')](db[_0xcb6c('0x2e')][_0xcb6c('0x2f')],function(_0x3c6d76){return{'name':_0x3c6d76[_0xcb6c('0x30')],'type':_0x3c6d76[_0xcb6c('0x31')][_0xcb6c('0x32')]};});_0x1870de[_0xcb6c('0x33')]=_[_0xcb6c('0x2d')](_0x49b6f2,_0xcb6c('0x2a'));_0x1870de[_0xcb6c('0x34')]=_[_0xcb6c('0x35')](_0x478480[_0xcb6c('0x34')]);_0x1870de['filters']=_['intersection'](_0x1870de[_0xcb6c('0x33')],_0x1870de['query']);_0x3300a8[_0xcb6c('0x36')]=_[_0xcb6c('0x37')](_0x1870de[_0xcb6c('0x33')],qs[_0xcb6c('0x38')](_0x478480[_0xcb6c('0x34')][_0xcb6c('0x38')]));_0x3300a8[_0xcb6c('0x36')]=_0x3300a8['attributes']['length']?_0x3300a8[_0xcb6c('0x36')]:_0x1870de[_0xcb6c('0x33')];if(!_0x478480['query'][_0xcb6c('0x39')](_0xcb6c('0x3a'))){_0x3300a8[_0xcb6c('0x1d')]=qs[_0xcb6c('0x1d')](_0x478480[_0xcb6c('0x34')][_0xcb6c('0x1d')]);_0x3300a8[_0xcb6c('0x1b')]=qs[_0xcb6c('0x1b')](_0x478480[_0xcb6c('0x34')][_0xcb6c('0x1b')]);}_0x3300a8[_0xcb6c('0x3b')]=qs[_0xcb6c('0x3c')](_0x478480[_0xcb6c('0x34')]['sort']);_0x3300a8[_0xcb6c('0x3d')]=qs[_0xcb6c('0x3e')](_[_0xcb6c('0x3f')](_0x478480[_0xcb6c('0x34')],_0x1870de[_0xcb6c('0x3e')]),_0x49b6f2);if(_0x478480[_0xcb6c('0x34')][_0xcb6c('0x40')]){_0x3300a8['where']=_['merge'](_0x3300a8[_0xcb6c('0x3d')],{'$or':_[_0xcb6c('0x2d')](_0x49b6f2,function(_0x3d298d){if(_0x3d298d[_0xcb6c('0x31')]!=='VIRTUAL'){var _0x3cb101={};_0x3cb101[_0x3d298d['name']]={'$like':'%'+_0x478480[_0xcb6c('0x34')][_0xcb6c('0x40')]+'%'};return _0x3cb101;}})});}_0x3300a8=_['merge']({},_0x3300a8,_0x478480['options']);var _0x2a3200={'where':_0x3300a8[_0xcb6c('0x3d')]};return db[_0xcb6c('0x2e')][_0xcb6c('0x1e')](_0x2a3200)[_0xcb6c('0x25')](function(_0x44b9f9){_0x45f32b[_0xcb6c('0x1e')]=_0x44b9f9;if(_0x478480[_0xcb6c('0x34')][_0xcb6c('0x41')]){_0x3300a8['include']=[{'all':!![]}];}return db[_0xcb6c('0x2e')][_0xcb6c('0x42')](_0x3300a8);})[_0xcb6c('0x25')](function(_0x5d5ffc){_0x45f32b[_0xcb6c('0x43')]=_0x5d5ffc;return _0x45f32b;})['then'](respondWithFilteredResult(_0x38f2dd,_0x3300a8))['catch'](handleError(_0x38f2dd,null));};exports['show']=function(_0x2ddf96,_0x557b48){var _0x433418={'raw':![],'where':{'id':_0x2ddf96[_0xcb6c('0x44')]['id']}},_0x5d6632={};_0x5d6632[_0xcb6c('0x33')]=_[_0xcb6c('0x35')](db[_0xcb6c('0x2e')][_0xcb6c('0x2f')]);_0x5d6632['query']=_[_0xcb6c('0x35')](_0x2ddf96['query']);_0x5d6632[_0xcb6c('0x3e')]=_[_0xcb6c('0x37')](_0x5d6632[_0xcb6c('0x33')],_0x5d6632[_0xcb6c('0x34')]);_0x433418[_0xcb6c('0x36')]=_[_0xcb6c('0x37')](_0x5d6632[_0xcb6c('0x33')],qs['fields'](_0x2ddf96[_0xcb6c('0x34')]['fields']));_0x433418['attributes']=_0x433418[_0xcb6c('0x36')][_0xcb6c('0x45')]?_0x433418[_0xcb6c('0x36')]:_0x5d6632[_0xcb6c('0x33')];if(_0x2ddf96[_0xcb6c('0x34')][_0xcb6c('0x41')]){_0x433418[_0xcb6c('0x46')]=[{'all':!![]}];}_0x433418=_[_0xcb6c('0x47')]({},_0x433418,_0x2ddf96[_0xcb6c('0x48')]);return db[_0xcb6c('0x2e')][_0xcb6c('0x49')](_0x433418)[_0xcb6c('0x25')](handleEntityNotFound(_0x557b48,null))[_0xcb6c('0x25')](respondWithResult(_0x557b48,null))['catch'](handleError(_0x557b48,null));};exports[_0xcb6c('0x4a')]=function(_0x1b5649,_0x3fe50c){return db['DeskAccount']['create'](_0x1b5649[_0xcb6c('0x4b')],{})[_0xcb6c('0x25')](respondWithResult(_0x3fe50c,0xc9))[_0xcb6c('0x4c')](handleError(_0x3fe50c,null));};exports['update']=function(_0x2ed8f0,_0x38b3b7){if(_0x2ed8f0['body']['id']){delete _0x2ed8f0['body']['id'];}return db[_0xcb6c('0x2e')]['find']({'where':{'id':_0x2ed8f0['params']['id']}})[_0xcb6c('0x25')](handleEntityNotFound(_0x38b3b7,null))['then'](saveUpdates(_0x2ed8f0[_0xcb6c('0x4b')],null))[_0xcb6c('0x25')](respondWithResult(_0x38b3b7,null))['catch'](handleError(_0x38b3b7,null));};exports[_0xcb6c('0x26')]=function(_0x572f76,_0x5e0de8){return db['DeskAccount']['find']({'where':{'id':_0x572f76[_0xcb6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e0de8,null))[_0xcb6c('0x25')](removeEntity(_0x5e0de8,null))[_0xcb6c('0x4c')](handleError(_0x5e0de8,null));};exports[_0xcb6c('0x4d')]=function(_0x5e1a69,_0x256109,_0xc8ee21){var _0x31634d={};var _0x2f5d1d={};var _0x22ff97;var _0x2c11e5;return db[_0xcb6c('0x2e')][_0xcb6c('0x4e')]({'where':{'id':_0x5e1a69[_0xcb6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x256109,null))[_0xcb6c('0x25')](function(_0xa7a0d6){if(_0xa7a0d6){_0x22ff97=_0xa7a0d6;_0x2f5d1d[_0xcb6c('0x33')]=_[_0xcb6c('0x35')](db[_0xcb6c('0x4f')][_0xcb6c('0x2f')]);_0x2f5d1d[_0xcb6c('0x34')]=_['keys'](_0x5e1a69[_0xcb6c('0x34')]);_0x2f5d1d[_0xcb6c('0x3e')]=_[_0xcb6c('0x37')](_0x2f5d1d['model'],_0x2f5d1d['query']);_0x31634d[_0xcb6c('0x36')]=_[_0xcb6c('0x37')](_0x2f5d1d['model'],qs[_0xcb6c('0x38')](_0x5e1a69[_0xcb6c('0x34')][_0xcb6c('0x38')]));_0x31634d[_0xcb6c('0x36')]=_0x31634d[_0xcb6c('0x36')]['length']?_0x31634d[_0xcb6c('0x36')]:_0x2f5d1d[_0xcb6c('0x33')];_0x31634d[_0xcb6c('0x3b')]=qs[_0xcb6c('0x3c')](_0x5e1a69[_0xcb6c('0x34')][_0xcb6c('0x3c')]);_0x31634d[_0xcb6c('0x3d')]=qs[_0xcb6c('0x3e')](_[_0xcb6c('0x3f')](_0x5e1a69[_0xcb6c('0x34')],_0x2f5d1d['filters']));if(_0x5e1a69[_0xcb6c('0x34')][_0xcb6c('0x40')]){_0x31634d[_0xcb6c('0x3d')]=_[_0xcb6c('0x47')](_0x31634d[_0xcb6c('0x3d')],{'$or':_[_0xcb6c('0x2d')](_0x31634d[_0xcb6c('0x36')],function(_0x9f63fb){var _0x51e5ad={};_0x51e5ad[_0x9f63fb]={'$like':'%'+_0x5e1a69[_0xcb6c('0x34')]['filter']+'%'};return _0x51e5ad;})});}_0x31634d=_[_0xcb6c('0x47')]({},_0x31634d,_0x5e1a69[_0xcb6c('0x48')]);return _0x22ff97[_0xcb6c('0x4d')](_0x31634d);}})['then'](function(_0x553ae0){if(_0x553ae0){_0x2c11e5=_0x553ae0[_0xcb6c('0x45')];if(!_0x5e1a69[_0xcb6c('0x34')][_0xcb6c('0x39')]('nolimit')){_0x31634d[_0xcb6c('0x1d')]=qs[_0xcb6c('0x1d')](_0x5e1a69['query'][_0xcb6c('0x1d')]);_0x31634d[_0xcb6c('0x1b')]=qs[_0xcb6c('0x1b')](_0x5e1a69[_0xcb6c('0x34')][_0xcb6c('0x1b')]);}return _0x22ff97['getConfigurations'](_0x31634d);}})[_0xcb6c('0x25')](function(_0x98f871){if(_0x98f871){return _0x98f871?{'count':_0x2c11e5,'rows':_0x98f871}:null;}})[_0xcb6c('0x25')](respondWithResult(_0x256109,null))[_0xcb6c('0x4c')](handleError(_0x256109,null));};exports[_0xcb6c('0x50')]=function(_0x29a2d4,_0x57fb4e,_0x1ecaf0){if(_0x29a2d4[_0xcb6c('0x4b')]['id']){delete _0x29a2d4['body']['id'];}return db[_0xcb6c('0x2e')]['findOne']({'where':{'id':_0x29a2d4[_0xcb6c('0x44')]['id']}})[_0xcb6c('0x25')](handleEntityNotFound(_0x57fb4e,null))['then'](function(_0x22bd9b){if(_0x22bd9b){_0x29a2d4[_0xcb6c('0x4b')][_0xcb6c('0x51')]=_0x22bd9b['id'];_0x29a2d4[_0xcb6c('0x4b')][_0xcb6c('0x52')]=integrations[_0xcb6c('0x53')](_0x29a2d4[_0xcb6c('0x4b')]['channel'],_0x29a2d4[_0xcb6c('0x4b')]['type']);_0x29a2d4[_0xcb6c('0x4b')][_0xcb6c('0x54')]=integrations[_0xcb6c('0x55')](_0x29a2d4[_0xcb6c('0x4b')][_0xcb6c('0x56')],_0x29a2d4[_0xcb6c('0x4b')][_0xcb6c('0x31')]);return db['DeskConfiguration']['create'](_0x29a2d4[_0xcb6c('0x4b')],{'include':[{'model':db[_0xcb6c('0x57')],'as':_0xcb6c('0x52')},{'model':db[_0xcb6c('0x57')],'as':_0xcb6c('0x54')}]});}return null;})[_0xcb6c('0x25')](respondWithResult(_0x57fb4e,null))[_0xcb6c('0x4c')](handleError(_0x57fb4e,null));};exports[_0xcb6c('0x58')]=function(_0x2abbd3,_0x12d47e,_0x1c7e67){var _0x4a566f=[{'name':_0xcb6c('0x59'),'label':_0xcb6c('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4be795='';return db['DeskAccount'][_0xcb6c('0x4e')]({'where':{'id':_0x2abbd3[_0xcb6c('0x44')]['id']},'attributes':['id',_0xcb6c('0x5a'),_0xcb6c('0x5b'),_0xcb6c('0x5c'),_0xcb6c('0x5d'),'consumerKey',_0xcb6c('0x5e'),_0xcb6c('0x5f'),_0xcb6c('0x60')]})[_0xcb6c('0x25')](handleEntityNotFound(_0x12d47e,null))[_0xcb6c('0x25')](function(_0x4dc389){if(_0x4dc389){_0x4be795=_0x4dc389[_0xcb6c('0x5a')];var _0xae4bd4=_0x4be795[_0xcb6c('0x61')](-0x1);if(_0xae4bd4==='/'){_0x4be795=_0x4be795['substring'](0x0,_0x4be795[_0xcb6c('0x62')](_0xae4bd4));}var _0x4b14a4={'method':_0xcb6c('0x63'),'uri':util[_0xcb6c('0x64')](_0xcb6c('0x65'),_0x4be795),'headers':{'Content-Type':_0xcb6c('0x66'),'Accept':'application/json'},'json':!![]};if(_0x4dc389['authType']===_0xcb6c('0x67')){_0x4b14a4['headers']['Authorization']=util[_0xcb6c('0x64')](_0xcb6c('0x68'),new Buffer(util[_0xcb6c('0x64')](_0xcb6c('0x69'),_0x4dc389[_0xcb6c('0x5c')],_0x4dc389[_0xcb6c('0x5d')]))['toString'](_0xcb6c('0x6a')));}return rp(_0x4b14a4)[_0xcb6c('0x25')](function(_0x51433f){return _0x4a566f[_0xcb6c('0x6b')](_[_0xcb6c('0x2d')](_0x51433f['_embedded'][_0xcb6c('0x6c')],function(_0x2fd33a){return{'id':_0x2fd33a[_0xcb6c('0x2a')],'name':_0x2fd33a[_0xcb6c('0x2a')],'type':_0x2fd33a[_0xcb6c('0x31')],'active':_0x2fd33a[_0xcb6c('0x6d')],'label':_0x2fd33a[_0xcb6c('0x6e')],'custom':!![]};}));});}})[_0xcb6c('0x25')](function(_0x57e68d){return{'count':_0x57e68d[_0xcb6c('0x45')],'rows':_0x57e68d};})[_0xcb6c('0x25')](respondWithResult(_0x12d47e,null))[_0xcb6c('0x4c')](function(_0x455636){var _0x17ff39=_0x2abbd3[_0xcb6c('0x34')][_0xcb6c('0x6f')]?0x1f4:_0x455636[_0xcb6c('0x70')]||0x1f4;logger[_0xcb6c('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xcb6c('0x58'),_0x17ff39,JSON[_0xcb6c('0x71')](_0x455636));delete _0x455636[_0xcb6c('0x2a')];if(_0x17ff39===0x191){_0x17ff39=0x190;}_0x12d47e['status'](_0x17ff39)[_0xcb6c('0x2b')](_0x2abbd3[_0xcb6c('0x34')][_0xcb6c('0x6f')]?{'message':_0xcb6c('0x72'),'statusCode':_0x455636[_0xcb6c('0x70')]}:_0x455636);});}; \ No newline at end of file +var _0xc600=['offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','DeskAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','merge','find','create','body','getConfigurations','DeskConfiguration','addConfiguration','findOne','Subjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0xc600,0xc6));var _0x0c60=function(_0xdfcdf8,_0x55b8e1){_0xdfcdf8=_0xdfcdf8-0x0;var _0x2e3ccb=_0xc600[_0xdfcdf8];return _0x2e3ccb;};'use strict';var emlformat=require(_0x0c60('0x0'));var rimraf=require(_0x0c60('0x1'));var zipdir=require(_0x0c60('0x2'));var jsonpatch=require(_0x0c60('0x3'));var rp=require(_0x0c60('0x4'));var moment=require(_0x0c60('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0c60('0x6'));var util=require(_0x0c60('0x7'));var path=require('path');var sox=require(_0x0c60('0x8'));var csv=require(_0x0c60('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c60('0xa'));var _=require(_0x0c60('0xb'));var squel=require(_0x0c60('0xc'));var crypto=require(_0x0c60('0xd'));var jsforce=require(_0x0c60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0c60('0x9'));var querystring=require(_0x0c60('0xf'));var Papa=require('papaparse');var Redis=require(_0x0c60('0x10'));var authService=require(_0x0c60('0x11'));var qs=require(_0x0c60('0x12'));var as=require(_0x0c60('0x13'));var hardwareService=require(_0x0c60('0x14'));var logger=require(_0x0c60('0x15'))('api');var utils=require(_0x0c60('0x16'));var config=require(_0x0c60('0x17'));var licenseUtil=require(_0x0c60('0x18'));var db=require(_0x0c60('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16a601,_0x2737c6){_0x2737c6=_0x2737c6||0xcc;return function(_0x4a560d){if(_0x4a560d){return _0x16a601['sendStatus'](_0x2737c6);}return _0x16a601[_0x0c60('0x1a')](_0x2737c6)['end']();};}function respondWithResult(_0x1a9bf2,_0x25dd5d){_0x25dd5d=_0x25dd5d||0xc8;return function(_0x25074c){if(_0x25074c){return _0x1a9bf2[_0x0c60('0x1a')](_0x25dd5d)[_0x0c60('0x1b')](_0x25074c);}};}function respondWithFilteredResult(_0x4a2b3a,_0x2193f6){return function(_0x198ba5){if(_0x198ba5){var _0x58d0f9=typeof _0x2193f6[_0x0c60('0x1c')]===_0x0c60('0x1d')&&typeof _0x2193f6[_0x0c60('0x1e')]===_0x0c60('0x1d');var _0x2ce8f2=_0x198ba5[_0x0c60('0x1f')];var _0x41d135=_0x58d0f9?0x0:_0x2193f6[_0x0c60('0x1c')];var _0x830536=_0x58d0f9?_0x198ba5[_0x0c60('0x1f')]:_0x2193f6['offset']+_0x2193f6[_0x0c60('0x1e')];var _0x36811b;if(_0x830536>=_0x2ce8f2){_0x830536=_0x2ce8f2;_0x36811b=0xc8;}else{_0x36811b=0xce;}_0x4a2b3a['status'](_0x36811b);return _0x4a2b3a[_0x0c60('0x20')](_0x0c60('0x21'),_0x41d135+'-'+_0x830536+'/'+_0x2ce8f2)[_0x0c60('0x1b')](_0x198ba5);}return null;};}function patchUpdates(_0x50060c){return function(_0x57ae8c){try{jsonpatch['apply'](_0x57ae8c,_0x50060c,!![]);}catch(_0x3d7a3a){return BPromise[_0x0c60('0x22')](_0x3d7a3a);}return _0x57ae8c[_0x0c60('0x23')]();};}function saveUpdates(_0x4746f8,_0x452c7f){return function(_0x255df){if(_0x255df){return _0x255df[_0x0c60('0x24')](_0x4746f8)[_0x0c60('0x25')](function(_0xc1857d){return _0xc1857d;});}return null;};}function removeEntity(_0x17eb3f,_0x135986){return function(_0x407f3e){if(_0x407f3e){return _0x407f3e[_0x0c60('0x26')]()['then'](function(){_0x17eb3f[_0x0c60('0x1a')](0xcc)[_0x0c60('0x27')]();});}};}function handleEntityNotFound(_0x4c899c,_0x125631){return function(_0x55cd1c){if(!_0x55cd1c){_0x4c899c[_0x0c60('0x28')](0x194);}return _0x55cd1c;};}function handleError(_0x4ce078,_0x545bce){_0x545bce=_0x545bce||0x1f4;return function(_0x479f47){logger[_0x0c60('0x29')](_0x479f47[_0x0c60('0x2a')]);if(_0x479f47[_0x0c60('0x2b')]){delete _0x479f47[_0x0c60('0x2b')];}_0x4ce078[_0x0c60('0x1a')](_0x545bce)[_0x0c60('0x2c')](_0x479f47);};}exports['index']=function(_0x1a63f5,_0xe27646){var _0x36c579={},_0xa8d72f={},_0xfba4d1={'count':0x0,'rows':[]};var _0x4f9c61=_[_0x0c60('0x2d')](db[_0x0c60('0x2e')][_0x0c60('0x2f')],function(_0x317257){return{'name':_0x317257['fieldName'],'type':_0x317257[_0x0c60('0x30')]['key']};});_0xa8d72f[_0x0c60('0x31')]=_[_0x0c60('0x2d')](_0x4f9c61,_0x0c60('0x2b'));_0xa8d72f[_0x0c60('0x32')]=_[_0x0c60('0x33')](_0x1a63f5[_0x0c60('0x32')]);_0xa8d72f[_0x0c60('0x34')]=_[_0x0c60('0x35')](_0xa8d72f['model'],_0xa8d72f[_0x0c60('0x32')]);_0x36c579[_0x0c60('0x36')]=_[_0x0c60('0x35')](_0xa8d72f['model'],qs['fields'](_0x1a63f5['query'][_0x0c60('0x37')]));_0x36c579['attributes']=_0x36c579[_0x0c60('0x36')][_0x0c60('0x38')]?_0x36c579[_0x0c60('0x36')]:_0xa8d72f['model'];if(!_0x1a63f5[_0x0c60('0x32')][_0x0c60('0x39')](_0x0c60('0x3a'))){_0x36c579[_0x0c60('0x1e')]=qs[_0x0c60('0x1e')](_0x1a63f5['query'][_0x0c60('0x1e')]);_0x36c579[_0x0c60('0x1c')]=qs[_0x0c60('0x1c')](_0x1a63f5['query'][_0x0c60('0x1c')]);}_0x36c579[_0x0c60('0x3b')]=qs[_0x0c60('0x3c')](_0x1a63f5[_0x0c60('0x32')][_0x0c60('0x3c')]);_0x36c579[_0x0c60('0x3d')]=qs[_0x0c60('0x34')](_[_0x0c60('0x3e')](_0x1a63f5[_0x0c60('0x32')],_0xa8d72f[_0x0c60('0x34')]),_0x4f9c61);if(_0x1a63f5[_0x0c60('0x32')][_0x0c60('0x3f')]){_0x36c579[_0x0c60('0x3d')]=_['merge'](_0x36c579[_0x0c60('0x3d')],{'$or':_[_0x0c60('0x2d')](_0x4f9c61,function(_0x35b5d8){if(_0x35b5d8[_0x0c60('0x30')]!==_0x0c60('0x40')){var _0x1cbc0f={};_0x1cbc0f[_0x35b5d8[_0x0c60('0x2b')]]={'$like':'%'+_0x1a63f5[_0x0c60('0x32')]['filter']+'%'};return _0x1cbc0f;}})});}_0x36c579=_['merge']({},_0x36c579,_0x1a63f5[_0x0c60('0x41')]);var _0x3760b8={'where':_0x36c579['where']};return db[_0x0c60('0x2e')][_0x0c60('0x1f')](_0x3760b8)[_0x0c60('0x25')](function(_0x48dc10){_0xfba4d1[_0x0c60('0x1f')]=_0x48dc10;if(_0x1a63f5[_0x0c60('0x32')][_0x0c60('0x42')]){_0x36c579['include']=[{'all':!![]}];}return db[_0x0c60('0x2e')][_0x0c60('0x43')](_0x36c579);})['then'](function(_0x2502f6){_0xfba4d1[_0x0c60('0x44')]=_0x2502f6;return _0xfba4d1;})['then'](respondWithFilteredResult(_0xe27646,_0x36c579))[_0x0c60('0x45')](handleError(_0xe27646,null));};exports['show']=function(_0x40e9ce,_0x8009d){var _0x36d0e3={'raw':![],'where':{'id':_0x40e9ce[_0x0c60('0x46')]['id']}},_0x5cb311={};_0x5cb311[_0x0c60('0x31')]=_[_0x0c60('0x33')](db[_0x0c60('0x2e')]['rawAttributes']);_0x5cb311[_0x0c60('0x32')]=_[_0x0c60('0x33')](_0x40e9ce[_0x0c60('0x32')]);_0x5cb311['filters']=_[_0x0c60('0x35')](_0x5cb311[_0x0c60('0x31')],_0x5cb311['query']);_0x36d0e3[_0x0c60('0x36')]=_[_0x0c60('0x35')](_0x5cb311['model'],qs[_0x0c60('0x37')](_0x40e9ce[_0x0c60('0x32')]['fields']));_0x36d0e3[_0x0c60('0x36')]=_0x36d0e3[_0x0c60('0x36')][_0x0c60('0x38')]?_0x36d0e3[_0x0c60('0x36')]:_0x5cb311[_0x0c60('0x31')];if(_0x40e9ce[_0x0c60('0x32')][_0x0c60('0x42')]){_0x36d0e3[_0x0c60('0x47')]=[{'all':!![]}];}_0x36d0e3=_[_0x0c60('0x48')]({},_0x36d0e3,_0x40e9ce['options']);return db[_0x0c60('0x2e')][_0x0c60('0x49')](_0x36d0e3)[_0x0c60('0x25')](handleEntityNotFound(_0x8009d,null))[_0x0c60('0x25')](respondWithResult(_0x8009d,null))[_0x0c60('0x45')](handleError(_0x8009d,null));};exports[_0x0c60('0x4a')]=function(_0x40c028,_0x2aacf6){return db[_0x0c60('0x2e')][_0x0c60('0x4a')](_0x40c028[_0x0c60('0x4b')],{})[_0x0c60('0x25')](respondWithResult(_0x2aacf6,0xc9))['catch'](handleError(_0x2aacf6,null));};exports[_0x0c60('0x24')]=function(_0x678743,_0x5b1c3a){if(_0x678743['body']['id']){delete _0x678743[_0x0c60('0x4b')]['id'];}return db[_0x0c60('0x2e')]['find']({'where':{'id':_0x678743[_0x0c60('0x46')]['id']}})[_0x0c60('0x25')](handleEntityNotFound(_0x5b1c3a,null))[_0x0c60('0x25')](saveUpdates(_0x678743['body'],null))['then'](respondWithResult(_0x5b1c3a,null))[_0x0c60('0x45')](handleError(_0x5b1c3a,null));};exports[_0x0c60('0x26')]=function(_0x2cfbe8,_0x4ac90f){return db[_0x0c60('0x2e')][_0x0c60('0x49')]({'where':{'id':_0x2cfbe8[_0x0c60('0x46')]['id']}})[_0x0c60('0x25')](handleEntityNotFound(_0x4ac90f,null))[_0x0c60('0x25')](removeEntity(_0x4ac90f,null))['catch'](handleError(_0x4ac90f,null));};exports[_0x0c60('0x4c')]=function(_0x1fdf6b,_0x5b9068,_0x3ff3fc){var _0x213746={};var _0x233d3a={};var _0x306ef1;var _0x2d2ab0;return db['DeskAccount']['findOne']({'where':{'id':_0x1fdf6b['params']['id']}})['then'](handleEntityNotFound(_0x5b9068,null))[_0x0c60('0x25')](function(_0xf3694e){if(_0xf3694e){_0x306ef1=_0xf3694e;_0x233d3a['model']=_[_0x0c60('0x33')](db[_0x0c60('0x4d')][_0x0c60('0x2f')]);_0x233d3a[_0x0c60('0x32')]=_['keys'](_0x1fdf6b[_0x0c60('0x32')]);_0x233d3a[_0x0c60('0x34')]=_[_0x0c60('0x35')](_0x233d3a[_0x0c60('0x31')],_0x233d3a[_0x0c60('0x32')]);_0x213746['attributes']=_[_0x0c60('0x35')](_0x233d3a[_0x0c60('0x31')],qs['fields'](_0x1fdf6b[_0x0c60('0x32')][_0x0c60('0x37')]));_0x213746[_0x0c60('0x36')]=_0x213746[_0x0c60('0x36')][_0x0c60('0x38')]?_0x213746[_0x0c60('0x36')]:_0x233d3a[_0x0c60('0x31')];_0x213746[_0x0c60('0x3b')]=qs[_0x0c60('0x3c')](_0x1fdf6b[_0x0c60('0x32')][_0x0c60('0x3c')]);_0x213746[_0x0c60('0x3d')]=qs[_0x0c60('0x34')](_[_0x0c60('0x3e')](_0x1fdf6b[_0x0c60('0x32')],_0x233d3a[_0x0c60('0x34')]));if(_0x1fdf6b['query'][_0x0c60('0x3f')]){_0x213746[_0x0c60('0x3d')]=_['merge'](_0x213746[_0x0c60('0x3d')],{'$or':_[_0x0c60('0x2d')](_0x213746[_0x0c60('0x36')],function(_0x3b341d){var _0x336928={};_0x336928[_0x3b341d]={'$like':'%'+_0x1fdf6b['query'][_0x0c60('0x3f')]+'%'};return _0x336928;})});}_0x213746=_[_0x0c60('0x48')]({},_0x213746,_0x1fdf6b[_0x0c60('0x41')]);return _0x306ef1[_0x0c60('0x4c')](_0x213746);}})[_0x0c60('0x25')](function(_0x2db7f2){if(_0x2db7f2){_0x2d2ab0=_0x2db7f2[_0x0c60('0x38')];if(!_0x1fdf6b['query']['hasOwnProperty']('nolimit')){_0x213746[_0x0c60('0x1e')]=qs[_0x0c60('0x1e')](_0x1fdf6b['query']['limit']);_0x213746[_0x0c60('0x1c')]=qs['offset'](_0x1fdf6b[_0x0c60('0x32')][_0x0c60('0x1c')]);}return _0x306ef1[_0x0c60('0x4c')](_0x213746);}})[_0x0c60('0x25')](function(_0x18194b){if(_0x18194b){return _0x18194b?{'count':_0x2d2ab0,'rows':_0x18194b}:null;}})[_0x0c60('0x25')](respondWithResult(_0x5b9068,null))[_0x0c60('0x45')](handleError(_0x5b9068,null));};exports[_0x0c60('0x4e')]=function(_0x3a58b8,_0x20ce72,_0x31405d){if(_0x3a58b8['body']['id']){delete _0x3a58b8[_0x0c60('0x4b')]['id'];}return db[_0x0c60('0x2e')][_0x0c60('0x4f')]({'where':{'id':_0x3a58b8[_0x0c60('0x46')]['id']}})[_0x0c60('0x25')](handleEntityNotFound(_0x20ce72,null))['then'](function(_0x575966){if(_0x575966){_0x3a58b8['body']['AccountId']=_0x575966['id'];_0x3a58b8[_0x0c60('0x4b')][_0x0c60('0x50')]=integrations['getSubjects'](_0x3a58b8[_0x0c60('0x4b')][_0x0c60('0x51')],_0x3a58b8[_0x0c60('0x4b')][_0x0c60('0x30')]);_0x3a58b8[_0x0c60('0x4b')]['Descriptions']=integrations[_0x0c60('0x52')](_0x3a58b8[_0x0c60('0x4b')]['channel'],_0x3a58b8[_0x0c60('0x4b')][_0x0c60('0x30')]);return db[_0x0c60('0x4d')]['create'](_0x3a58b8[_0x0c60('0x4b')],{'include':[{'model':db[_0x0c60('0x53')],'as':_0x0c60('0x50')},{'model':db[_0x0c60('0x53')],'as':_0x0c60('0x54')}]});}return null;})[_0x0c60('0x25')](respondWithResult(_0x20ce72,null))[_0x0c60('0x45')](handleError(_0x20ce72,null));};exports[_0x0c60('0x55')]=function(_0x238a2b,_0x13e72f,_0x18a38d){var _0xfa1115=[{'name':_0x0c60('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1e181a='';return db[_0x0c60('0x2e')][_0x0c60('0x4f')]({'where':{'id':_0x238a2b[_0x0c60('0x46')]['id']},'attributes':['id',_0x0c60('0x57'),_0x0c60('0x58'),_0x0c60('0x59'),_0x0c60('0x5a'),'consumerKey',_0x0c60('0x5b'),'token','tokenSecret']})[_0x0c60('0x25')](handleEntityNotFound(_0x13e72f,null))['then'](function(_0x3255d6){if(_0x3255d6){_0x1e181a=_0x3255d6['remoteUri'];var _0x1a8f65=_0x1e181a[_0x0c60('0x5c')](-0x1);if(_0x1a8f65==='/'){_0x1e181a=_0x1e181a[_0x0c60('0x5d')](0x0,_0x1e181a[_0x0c60('0x5e')](_0x1a8f65));}var _0x377728={'method':_0x0c60('0x5f'),'uri':util[_0x0c60('0x60')](_0x0c60('0x61'),_0x1e181a),'headers':{'Content-Type':_0x0c60('0x62'),'Accept':_0x0c60('0x62')},'json':!![]};if(_0x3255d6[_0x0c60('0x58')]===_0x0c60('0x63')){_0x377728[_0x0c60('0x64')][_0x0c60('0x65')]=util[_0x0c60('0x60')](_0x0c60('0x66'),new Buffer(util['format'](_0x0c60('0x67'),_0x3255d6[_0x0c60('0x59')],_0x3255d6[_0x0c60('0x5a')]))[_0x0c60('0x68')]('base64'));}return rp(_0x377728)['then'](function(_0x19387c){return _0xfa1115[_0x0c60('0x69')](_['map'](_0x19387c[_0x0c60('0x6a')][_0x0c60('0x6b')],function(_0x3d3f24){return{'id':_0x3d3f24['name'],'name':_0x3d3f24[_0x0c60('0x2b')],'type':_0x3d3f24['type'],'active':_0x3d3f24['active'],'label':_0x3d3f24[_0x0c60('0x6c')],'custom':!![]};}));});}})['then'](function(_0x3e353f){return{'count':_0x3e353f[_0x0c60('0x38')],'rows':_0x3e353f};})[_0x0c60('0x25')](respondWithResult(_0x13e72f,null))[_0x0c60('0x45')](function(_0x4a239f){var _0x2f6cb3=_0x238a2b[_0x0c60('0x32')][_0x0c60('0x6d')]?0x1f4:_0x4a239f[_0x0c60('0x6e')]||0x1f4;logger[_0x0c60('0x29')](_0x0c60('0x6f'),_0x0c60('0x55'),_0x2f6cb3,JSON[_0x0c60('0x70')](_0x4a239f));delete _0x4a239f[_0x0c60('0x2b')];if(_0x2f6cb3===0x191){_0x2f6cb3=0x190;}_0x13e72f[_0x0c60('0x1a')](_0x2f6cb3)['send'](_0x238a2b['query'][_0x0c60('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x4a239f['statusCode']}:_0x4a239f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 622d7d5..178642f 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 _0x3c61=['../../components/integrations/configuration','exports','define','DeskAccount','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0xe7286d,_0x153012){var _0x573894=function(_0xdfc37f){while(--_0xdfc37f){_0xe7286d['push'](_0xe7286d['shift']());}};_0x573894(++_0x153012);}(_0x3c61,0x94));var _0x13c6=function(_0x532550,_0x49ab2a){_0x532550=_0x532550-0x0;var _0x5cc4d8=_0x3c61[_0x532550];return _0x5cc4d8;};'use strict';var _=require(_0x13c6('0x0'));var util=require('util');var logger=require(_0x13c6('0x1'))('api');var moment=require(_0x13c6('0x2'));var BPromise=require('bluebird');var rp=require(_0x13c6('0x3'));var fs=require('fs');var path=require(_0x13c6('0x4'));var rimraf=require(_0x13c6('0x5'));var config=require(_0x13c6('0x6'));var attributes=require(_0x13c6('0x7'));var integrations=require(_0x13c6('0x8'));module[_0x13c6('0x9')]=function(_0x33ab32,_0x1b852a){return _0x33ab32[_0x13c6('0xa')](_0x13c6('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3497=['DeskAccount','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x36a997,_0x288f0b){var _0x561b1b=function(_0x8ed5bb){while(--_0x8ed5bb){_0x36a997['push'](_0x36a997['shift']());}};_0x561b1b(++_0x288f0b);}(_0x3497,0x8d));var _0x7349=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0x3497[_0x5aa373];return _0x590e8e;};'use strict';var _=require(_0x7349('0x0'));var util=require('util');var logger=require(_0x7349('0x1'))(_0x7349('0x2'));var moment=require('moment');var BPromise=require(_0x7349('0x3'));var rp=require(_0x7349('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7349('0x5'));var config=require(_0x7349('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x7349('0x7'));module['exports']=function(_0x3702c6,_0x45b2c7){return _0x3702c6[_0x7349('0x8')](_0x7349('0x9'),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 23a74f3..67bea9b 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 _0x160b=['http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','map','include','model','debug','ShowDeskAccount','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xf1f395,_0x4b8d53){var _0x5c67f3=function(_0x3db87e){while(--_0x3db87e){_0xf1f395['push'](_0xf1f395['shift']());}};_0x5c67f3(++_0x4b8d53);}(_0x160b,0xd1));var _0xb160=function(_0x22032b,_0xb682b6){_0x22032b=_0x22032b-0x0;var _0x33c487=_0x160b[_0x22032b];return _0x33c487;};'use strict';var _=require(_0xb160('0x0'));var util=require(_0xb160('0x1'));var moment=require(_0xb160('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb160('0x3'))['db'];var utils=require(_0xb160('0x4'));var logger=require('../../config/logger')(_0xb160('0x5'));var config=require(_0xb160('0x6'));var jayson=require(_0xb160('0x7'));var client=jayson['client'][_0xb160('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb1ea5c,_0x28b3cb,_0x219e2c){return new BPromise(function(_0x40ab78,_0x2a58dc){return client[_0xb160('0x9')](_0xb1ea5c,_0x219e2c)[_0xb160('0xa')](function(_0x4f2fb1){logger[_0xb160('0xb')](_0xb160('0xc'),_0x28b3cb,_0xb160('0xd'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x28b3cb,_0xb160('0xd'),JSON[_0xb160('0xe')](_0x4f2fb1));if(_0x4f2fb1[_0xb160('0xf')]){if(_0x4f2fb1['error'][_0xb160('0x10')]===0x1f4){logger[_0xb160('0xf')](_0xb160('0xc'),_0x28b3cb,_0x4f2fb1[_0xb160('0xf')]['message']);return _0x2a58dc(_0x4f2fb1[_0xb160('0xf')][_0xb160('0x11')]);}logger[_0xb160('0xf')](_0xb160('0xc'),_0x28b3cb,_0x4f2fb1['error'][_0xb160('0x11')]);return _0x40ab78(_0x4f2fb1[_0xb160('0xf')][_0xb160('0x11')]);}else{logger[_0xb160('0xb')](_0xb160('0xc'),_0x28b3cb,_0xb160('0xd'));_0x40ab78(_0x4f2fb1[_0xb160('0x12')][_0xb160('0x11')]);}})['catch'](function(_0x2576dd){logger['error'](_0xb160('0xc'),_0x28b3cb,_0x2576dd);_0x2a58dc(_0x2576dd);});});}exports[_0xb160('0x13')]=function(_0x1d24bf){var _0x3880d5=this;return new Promise(function(_0x2b1960,_0x217add){return db[_0xb160('0x14')][_0xb160('0x15')]({'raw':_0x1d24bf[_0xb160('0x16')]?_0x1d24bf[_0xb160('0x16')][_0xb160('0x17')]===undefined?!![]:![]:!![],'where':_0x1d24bf['options']?_0x1d24bf[_0xb160('0x16')][_0xb160('0x18')]||null:null,'attributes':_0x1d24bf[_0xb160('0x16')]?_0x1d24bf[_0xb160('0x16')][_0xb160('0x19')]||null:null,'limit':_0x1d24bf[_0xb160('0x16')]?_0x1d24bf[_0xb160('0x16')]['limit']||null:null,'include':_0x1d24bf[_0xb160('0x16')]?_0x1d24bf[_0xb160('0x16')]['include']?_[_0xb160('0x1a')](_0x1d24bf[_0xb160('0x16')][_0xb160('0x1b')],function(_0x26e284){return{'model':db[_0x26e284[_0xb160('0x1c')]],'as':_0x26e284['as'],'attributes':_0x26e284[_0xb160('0x19')],'include':_0x26e284['include']?_[_0xb160('0x1a')](_0x26e284['include'],function(_0x49a270){return{'model':db[_0x49a270[_0xb160('0x1c')]],'as':_0x49a270['as'],'attributes':_0x49a270[_0xb160('0x19')],'include':_0x49a270[_0xb160('0x1b')]?_[_0xb160('0x1a')](_0x49a270[_0xb160('0x1b')],function(_0x3950c4){return{'model':db[_0x3950c4[_0xb160('0x1c')]],'as':_0x3950c4['as'],'attributes':_0x3950c4[_0xb160('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb160('0xa')](function(_0x10c563){logger[_0xb160('0xb')](_0xb160('0x13'),_0x1d24bf);logger[_0xb160('0x1d')](_0xb160('0x13'),_0x1d24bf,JSON['stringify'](_0x10c563));_0x2b1960(_0x10c563);})['catch'](function(_0x3eabb5){logger[_0xb160('0xf')](_0xb160('0x13'),_0x3eabb5[_0xb160('0x11')],_0x1d24bf);_0x217add(_0x3880d5[_0xb160('0xf')](0x1f4,_0x3eabb5[_0xb160('0x11')]));});});};exports[_0xb160('0x1e')]=function(_0x248f69){var _0x476165=this;return new Promise(function(_0x1c1a90,_0x61578f){return db['DeskAccount']['find']({'raw':_0x248f69[_0xb160('0x16')]?_0x248f69['options'][_0xb160('0x17')]===undefined?!![]:![]:!![],'where':_0x248f69[_0xb160('0x16')]?_0x248f69[_0xb160('0x16')][_0xb160('0x18')]||null:null,'attributes':_0x248f69[_0xb160('0x16')]?_0x248f69[_0xb160('0x16')][_0xb160('0x19')]||null:null,'include':_0x248f69[_0xb160('0x16')]?_0x248f69['options'][_0xb160('0x1b')]?_[_0xb160('0x1a')](_0x248f69[_0xb160('0x16')][_0xb160('0x1b')],function(_0x2eb5bb){return{'model':db[_0x2eb5bb[_0xb160('0x1c')]],'as':_0x2eb5bb['as'],'attributes':_0x2eb5bb[_0xb160('0x19')],'include':_0x2eb5bb[_0xb160('0x1b')]?_[_0xb160('0x1a')](_0x2eb5bb[_0xb160('0x1b')],function(_0xdd8c7e){return{'model':db[_0xdd8c7e[_0xb160('0x1c')]],'as':_0xdd8c7e['as'],'attributes':_0xdd8c7e[_0xb160('0x19')],'include':_0xdd8c7e[_0xb160('0x1b')]?_[_0xb160('0x1a')](_0xdd8c7e[_0xb160('0x1b')],function(_0x476072){return{'model':db[_0x476072[_0xb160('0x1c')]],'as':_0x476072['as'],'attributes':_0x476072[_0xb160('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb160('0xa')](function(_0x3534f8){logger[_0xb160('0xb')](_0xb160('0x1e'),_0x248f69);logger['debug'](_0xb160('0x1e'),_0x248f69,JSON[_0xb160('0xe')](_0x3534f8));_0x1c1a90(_0x3534f8);})['catch'](function(_0x2406b4){logger[_0xb160('0xf')]('ShowDeskAccount',_0x2406b4[_0xb160('0x11')],_0x248f69);_0x61578f(_0x476165[_0xb160('0xf')](0x1f4,_0x2406b4[_0xb160('0x11')]));});});}; \ No newline at end of file +var _0x545c=['include','map','model','then','catch','ShowDeskAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','GetDeskAccount','DeskAccount','findAll','options','attributes','limit'];(function(_0xdb160e,_0x2171e0){var _0x1faba1=function(_0x3eab6e){while(--_0x3eab6e){_0xdb160e['push'](_0xdb160e['shift']());}};_0x1faba1(++_0x2171e0);}(_0x545c,0x87));var _0xc545=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x545c[_0x4d8666];return _0x37175b;};'use strict';var _=require(_0xc545('0x0'));var util=require('util');var moment=require(_0xc545('0x1'));var BPromise=require(_0xc545('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc545('0x3'));var db=require(_0xc545('0x4'))['db'];var utils=require(_0xc545('0x5'));var logger=require(_0xc545('0x6'))(_0xc545('0x7'));var config=require(_0xc545('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc545('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a4b9e,_0x3b29b4,_0x321a24){return new BPromise(function(_0x5c70c0,_0x587cea){return client[_0xc545('0xa')](_0x1a4b9e,_0x321a24)['then'](function(_0x2a3fce){logger[_0xc545('0xb')]('DeskAccount,\x20%s,\x20%s',_0x3b29b4,_0xc545('0xc'));logger[_0xc545('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3b29b4,_0xc545('0xc'),JSON[_0xc545('0xe')](_0x2a3fce));if(_0x2a3fce[_0xc545('0xf')]){if(_0x2a3fce[_0xc545('0xf')][_0xc545('0x10')]===0x1f4){logger[_0xc545('0xf')](_0xc545('0x11'),_0x3b29b4,_0x2a3fce[_0xc545('0xf')]['message']);return _0x587cea(_0x2a3fce[_0xc545('0xf')][_0xc545('0x12')]);}logger[_0xc545('0xf')]('DeskAccount,\x20%s,\x20%s',_0x3b29b4,_0x2a3fce[_0xc545('0xf')][_0xc545('0x12')]);return _0x5c70c0(_0x2a3fce['error']['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x3b29b4,'request\x20sent');_0x5c70c0(_0x2a3fce['result'][_0xc545('0x12')]);}})['catch'](function(_0xbb80b6){logger[_0xc545('0xf')](_0xc545('0x11'),_0x3b29b4,_0xbb80b6);_0x587cea(_0xbb80b6);});});}exports[_0xc545('0x13')]=function(_0x35c776){var _0x47e703=this;return new Promise(function(_0x8fa465,_0x3d6ac7){return db[_0xc545('0x14')][_0xc545('0x15')]({'raw':_0x35c776[_0xc545('0x16')]?_0x35c776[_0xc545('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x35c776['options']?_0x35c776[_0xc545('0x16')]['where']||null:null,'attributes':_0x35c776[_0xc545('0x16')]?_0x35c776['options'][_0xc545('0x17')]||null:null,'limit':_0x35c776[_0xc545('0x16')]?_0x35c776['options'][_0xc545('0x18')]||null:null,'include':_0x35c776['options']?_0x35c776[_0xc545('0x16')][_0xc545('0x19')]?_[_0xc545('0x1a')](_0x35c776['options'][_0xc545('0x19')],function(_0x10d8d3){return{'model':db[_0x10d8d3[_0xc545('0x1b')]],'as':_0x10d8d3['as'],'attributes':_0x10d8d3['attributes'],'include':_0x10d8d3[_0xc545('0x19')]?_[_0xc545('0x1a')](_0x10d8d3[_0xc545('0x19')],function(_0x53e3f0){return{'model':db[_0x53e3f0[_0xc545('0x1b')]],'as':_0x53e3f0['as'],'attributes':_0x53e3f0['attributes'],'include':_0x53e3f0['include']?_[_0xc545('0x1a')](_0x53e3f0[_0xc545('0x19')],function(_0x20206b){return{'model':db[_0x20206b[_0xc545('0x1b')]],'as':_0x20206b['as'],'attributes':_0x20206b[_0xc545('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc545('0x1c')](function(_0x487d96){logger[_0xc545('0xb')](_0xc545('0x13'),_0x35c776);logger[_0xc545('0xd')]('GetDeskAccount',_0x35c776,JSON[_0xc545('0xe')](_0x487d96));_0x8fa465(_0x487d96);})[_0xc545('0x1d')](function(_0x1ef2f2){logger[_0xc545('0xf')](_0xc545('0x13'),_0x1ef2f2[_0xc545('0x12')],_0x35c776);_0x3d6ac7(_0x47e703[_0xc545('0xf')](0x1f4,_0x1ef2f2['message']));});});};exports[_0xc545('0x1e')]=function(_0x426e43){var _0x5edbcb=this;return new Promise(function(_0x45aa5c,_0x56ce7b){return db[_0xc545('0x14')][_0xc545('0x1f')]({'raw':_0x426e43[_0xc545('0x16')]?_0x426e43['options']['raw']===undefined?!![]:![]:!![],'where':_0x426e43['options']?_0x426e43[_0xc545('0x16')]['where']||null:null,'attributes':_0x426e43[_0xc545('0x16')]?_0x426e43[_0xc545('0x16')][_0xc545('0x17')]||null:null,'include':_0x426e43[_0xc545('0x16')]?_0x426e43[_0xc545('0x16')][_0xc545('0x19')]?_[_0xc545('0x1a')](_0x426e43[_0xc545('0x16')][_0xc545('0x19')],function(_0x31fd43){return{'model':db[_0x31fd43[_0xc545('0x1b')]],'as':_0x31fd43['as'],'attributes':_0x31fd43[_0xc545('0x17')],'include':_0x31fd43[_0xc545('0x19')]?_['map'](_0x31fd43[_0xc545('0x19')],function(_0x3bdf14){return{'model':db[_0x3bdf14[_0xc545('0x1b')]],'as':_0x3bdf14['as'],'attributes':_0x3bdf14[_0xc545('0x17')],'include':_0x3bdf14[_0xc545('0x19')]?_[_0xc545('0x1a')](_0x3bdf14[_0xc545('0x19')],function(_0x3e43ed){return{'model':db[_0x3e43ed['model']],'as':_0x3e43ed['as'],'attributes':_0x3e43ed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xea3435){logger[_0xc545('0xb')](_0xc545('0x1e'),_0x426e43);logger[_0xc545('0xd')](_0xc545('0x1e'),_0x426e43,JSON[_0xc545('0xe')](_0xea3435));_0x45aa5c(_0xea3435);})[_0xc545('0x1d')](function(_0xb05288){logger[_0xc545('0xf')]('ShowDeskAccount',_0xb05288[_0xc545('0x12')],_0x426e43);_0x56ce7b(_0x5edbcb[_0xc545('0xf')](0x1f4,_0xb05288['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 18294e6..5ce3354 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x232059,_0x5624da){var _0x36dc05=function(_0x2f617c){while(--_0x2f617c){_0x232059['push'](_0x232059['shift']());}};_0x36dc05(++_0x5624da);}(_0x34e8,0x12c));var _0x834e=function(_0xd73489,_0x443df0){_0xd73489=_0xd73489-0x0;var _0x34df78=_0x34e8[_0xd73489];return _0x34df78;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0x55ca,0x126));var _0xa55c=function(_0x33f2fa,_0x1411d5){_0x33f2fa=_0x33f2fa-0x0;var _0xe5b3b3=_0x55ca[_0x33f2fa];return _0xe5b3b3;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index a7eeff6..90f62a7 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 _0x6c2d=['exports','STRING','sequelize'];(function(_0x5db1a4,_0x14aa78){var _0x21ac3f=function(_0x108068){while(--_0x108068){_0x5db1a4['push'](_0x5db1a4['shift']());}};_0x21ac3f(++_0x14aa78);}(_0x6c2d,0x1eb));var _0xd6c2=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0x6c2d[_0x17c483];return _0x112bdb;};'use strict';var Sequelize=require(_0xd6c2('0x0'));module[_0xd6c2('0x1')]={'name':{'type':Sequelize[_0xd6c2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8f29=['STRING'];(function(_0x5a51d7,_0x4d332c){var _0x254676=function(_0x2344d1){while(--_0x2344d1){_0x5a51d7['push'](_0x5a51d7['shift']());}};_0x254676(++_0x4d332c);}(_0x8f29,0xa9));var _0x98f2=function(_0x28c0a2,_0x261333){_0x28c0a2=_0x28c0a2-0x0;var _0x235b4c=_0x8f29[_0x28c0a2];return _0x235b4c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x98f2('0x0')]},'description':{'type':Sequelize[_0x98f2('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index b91fca2..a11f58d 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 _0x54e4=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','then','destroy','stack','name','index','DeskConfiguration','rawAttributes','fieldName','map','query','keys','intersection','attributes','fields','length','model','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','findOne','DeskField','hasOwnProperty','getFields','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0x54e4,0x148));var _0x454e=function(_0x154473,_0x37936d){_0x154473=_0x154473-0x0;var _0x58f35e=_0x54e4[_0x154473];return _0x58f35e;};'use strict';var emlformat=require(_0x454e('0x0'));var rimraf=require(_0x454e('0x1'));var zipdir=require(_0x454e('0x2'));var jsonpatch=require(_0x454e('0x3'));var rp=require(_0x454e('0x4'));var moment=require(_0x454e('0x5'));var BPromise=require(_0x454e('0x6'));var Mustache=require(_0x454e('0x7'));var util=require(_0x454e('0x8'));var path=require(_0x454e('0x9'));var sox=require(_0x454e('0xa'));var csv=require(_0x454e('0xb'));var ejs=require(_0x454e('0xc'));var fs=require('fs');var fs_extra=require(_0x454e('0xd'));var _=require(_0x454e('0xe'));var squel=require(_0x454e('0xf'));var crypto=require(_0x454e('0x10'));var jsforce=require(_0x454e('0x11'));var deskjs=require(_0x454e('0x12'));var toCsv=require(_0x454e('0xb'));var querystring=require(_0x454e('0x13'));var Papa=require(_0x454e('0x14'));var Redis=require(_0x454e('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x454e('0x16'));var logger=require(_0x454e('0x17'))('api');var utils=require(_0x454e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x454e('0x19'));var db=require(_0x454e('0x1a'))['db'];function respondWithStatusCode(_0x48315e,_0x3bef08){_0x3bef08=_0x3bef08||0xcc;return function(_0x66cea4){if(_0x66cea4){return _0x48315e[_0x454e('0x1b')](_0x3bef08);}return _0x48315e[_0x454e('0x1c')](_0x3bef08)[_0x454e('0x1d')]();};}function respondWithResult(_0x324662,_0x12a0cb){_0x12a0cb=_0x12a0cb||0xc8;return function(_0x3ba589){if(_0x3ba589){return _0x324662['status'](_0x12a0cb)['json'](_0x3ba589);}};}function respondWithFilteredResult(_0x234699,_0x2bec98){return function(_0x5eb15b){if(_0x5eb15b){var _0x4ffb04=typeof _0x2bec98[_0x454e('0x1e')]===_0x454e('0x1f')&&typeof _0x2bec98['limit']==='undefined';var _0x3728be=_0x5eb15b[_0x454e('0x20')];var _0xfa256b=_0x4ffb04?0x0:_0x2bec98['offset'];var _0x2d58cd=_0x4ffb04?_0x5eb15b[_0x454e('0x20')]:_0x2bec98[_0x454e('0x1e')]+_0x2bec98[_0x454e('0x21')];var _0x4aa0c7;if(_0x2d58cd>=_0x3728be){_0x2d58cd=_0x3728be;_0x4aa0c7=0xc8;}else{_0x4aa0c7=0xce;}_0x234699['status'](_0x4aa0c7);return _0x234699['set'](_0x454e('0x22'),_0xfa256b+'-'+_0x2d58cd+'/'+_0x3728be)[_0x454e('0x23')](_0x5eb15b);}return null;};}function patchUpdates(_0x36b61a){return function(_0x55065e){try{jsonpatch[_0x454e('0x24')](_0x55065e,_0x36b61a,!![]);}catch(_0x19f7b4){return BPromise[_0x454e('0x25')](_0x19f7b4);}return _0x55065e[_0x454e('0x26')]();};}function saveUpdates(_0x431872,_0x4d197f){return function(_0x258307){if(_0x258307){return _0x258307['update'](_0x431872)[_0x454e('0x27')](function(_0xc0648){return _0xc0648;});}return null;};}function removeEntity(_0x82d5e3,_0x231490){return function(_0x392111){if(_0x392111){return _0x392111[_0x454e('0x28')]()[_0x454e('0x27')](function(){_0x82d5e3[_0x454e('0x1c')](0xcc)[_0x454e('0x1d')]();});}};}function handleEntityNotFound(_0xaf0432,_0x4654ff){return function(_0x2f8d39){if(!_0x2f8d39){_0xaf0432['sendStatus'](0x194);}return _0x2f8d39;};}function handleError(_0x510045,_0x365b52){_0x365b52=_0x365b52||0x1f4;return function(_0x3fc42b){logger['error'](_0x3fc42b[_0x454e('0x29')]);if(_0x3fc42b[_0x454e('0x2a')]){delete _0x3fc42b[_0x454e('0x2a')];}_0x510045[_0x454e('0x1c')](_0x365b52)['send'](_0x3fc42b);};}exports[_0x454e('0x2b')]=function(_0x18a800,_0x485aa1){var _0x4159dc={},_0x392ad0={},_0x137f61={'count':0x0,'rows':[]};var _0x6b1d5b=_['map'](db[_0x454e('0x2c')][_0x454e('0x2d')],function(_0xf52480){return{'name':_0xf52480[_0x454e('0x2e')],'type':_0xf52480['type']['key']};});_0x392ad0['model']=_[_0x454e('0x2f')](_0x6b1d5b,_0x454e('0x2a'));_0x392ad0[_0x454e('0x30')]=_[_0x454e('0x31')](_0x18a800[_0x454e('0x30')]);_0x392ad0['filters']=_[_0x454e('0x32')](_0x392ad0['model'],_0x392ad0['query']);_0x4159dc[_0x454e('0x33')]=_[_0x454e('0x32')](_0x392ad0['model'],qs[_0x454e('0x34')](_0x18a800[_0x454e('0x30')]['fields']));_0x4159dc['attributes']=_0x4159dc[_0x454e('0x33')][_0x454e('0x35')]?_0x4159dc[_0x454e('0x33')]:_0x392ad0[_0x454e('0x36')];if(!_0x18a800[_0x454e('0x30')]['hasOwnProperty']('nolimit')){_0x4159dc[_0x454e('0x21')]=qs[_0x454e('0x21')](_0x18a800[_0x454e('0x30')][_0x454e('0x21')]);_0x4159dc[_0x454e('0x1e')]=qs[_0x454e('0x1e')](_0x18a800[_0x454e('0x30')][_0x454e('0x1e')]);}_0x4159dc[_0x454e('0x37')]=qs[_0x454e('0x38')](_0x18a800[_0x454e('0x30')][_0x454e('0x38')]);_0x4159dc[_0x454e('0x39')]=qs[_0x454e('0x3a')](_[_0x454e('0x3b')](_0x18a800[_0x454e('0x30')],_0x392ad0[_0x454e('0x3a')]),_0x6b1d5b);if(_0x18a800[_0x454e('0x30')][_0x454e('0x3c')]){_0x4159dc[_0x454e('0x39')]=_[_0x454e('0x3d')](_0x4159dc[_0x454e('0x39')],{'$or':_[_0x454e('0x2f')](_0x6b1d5b,function(_0x391e7e){if(_0x391e7e[_0x454e('0x3e')]!==_0x454e('0x3f')){var _0x155ab1={};_0x155ab1[_0x391e7e['name']]={'$like':'%'+_0x18a800['query'][_0x454e('0x3c')]+'%'};return _0x155ab1;}})});}_0x4159dc=_[_0x454e('0x3d')]({},_0x4159dc,_0x18a800[_0x454e('0x40')]);var _0x48e11e={'where':_0x4159dc[_0x454e('0x39')]};return db[_0x454e('0x2c')][_0x454e('0x20')](_0x48e11e)['then'](function(_0x5d7ef0){_0x137f61[_0x454e('0x20')]=_0x5d7ef0;if(_0x18a800[_0x454e('0x30')][_0x454e('0x41')]){_0x4159dc['include']=[{'all':!![]}];}return db[_0x454e('0x2c')][_0x454e('0x42')](_0x4159dc);})['then'](function(_0x1d6eea){_0x137f61[_0x454e('0x43')]=_0x1d6eea;return _0x137f61;})[_0x454e('0x27')](respondWithFilteredResult(_0x485aa1,_0x4159dc))[_0x454e('0x44')](handleError(_0x485aa1,null));};exports[_0x454e('0x45')]=function(_0x43fcfc,_0x1324fb){var _0x4fcb2e={'raw':![],'where':{'id':_0x43fcfc['params']['id']}},_0xf5d1ac={};_0xf5d1ac['model']=_[_0x454e('0x31')](db['DeskConfiguration'][_0x454e('0x2d')]);_0xf5d1ac[_0x454e('0x30')]=_['keys'](_0x43fcfc[_0x454e('0x30')]);_0xf5d1ac[_0x454e('0x3a')]=_[_0x454e('0x32')](_0xf5d1ac['model'],_0xf5d1ac[_0x454e('0x30')]);_0x4fcb2e[_0x454e('0x33')]=_[_0x454e('0x32')](_0xf5d1ac[_0x454e('0x36')],qs[_0x454e('0x34')](_0x43fcfc[_0x454e('0x30')][_0x454e('0x34')]));_0x4fcb2e['attributes']=_0x4fcb2e[_0x454e('0x33')]['length']?_0x4fcb2e[_0x454e('0x33')]:_0xf5d1ac[_0x454e('0x36')];if(_0x43fcfc[_0x454e('0x30')][_0x454e('0x41')]){_0x4fcb2e[_0x454e('0x46')]=[{'all':!![]}];}_0x4fcb2e=_[_0x454e('0x3d')]({},_0x4fcb2e,_0x43fcfc['options']);return db[_0x454e('0x2c')][_0x454e('0x47')](_0x4fcb2e)[_0x454e('0x27')](handleEntityNotFound(_0x1324fb,null))['then'](respondWithResult(_0x1324fb,null))[_0x454e('0x44')](handleError(_0x1324fb,null));};exports['create']=function(_0x563c3a,_0x45ce20){return db[_0x454e('0x2c')][_0x454e('0x48')](_0x563c3a[_0x454e('0x49')],{})[_0x454e('0x27')](respondWithResult(_0x45ce20,0xc9))[_0x454e('0x44')](handleError(_0x45ce20,null));};exports['update']=function(_0x57821d,_0x1f4747){if(_0x57821d[_0x454e('0x49')]['id']){delete _0x57821d[_0x454e('0x49')]['id'];}return db[_0x454e('0x2c')][_0x454e('0x47')]({'where':{'id':_0x57821d['params']['id']}})[_0x454e('0x27')](handleEntityNotFound(_0x1f4747,null))[_0x454e('0x27')](saveUpdates(_0x57821d['body'],null))[_0x454e('0x27')](respondWithResult(_0x1f4747,null))[_0x454e('0x44')](handleError(_0x1f4747,null));};exports[_0x454e('0x28')]=function(_0x9a4663,_0x328108){return db['DeskConfiguration']['find']({'where':{'id':_0x9a4663[_0x454e('0x4a')]['id']}})[_0x454e('0x27')](handleEntityNotFound(_0x328108,null))[_0x454e('0x27')](removeEntity(_0x328108,null))[_0x454e('0x44')](handleError(_0x328108,null));};exports['getFields']=function(_0x3aba48,_0x14bd1b,_0x2c705d){var _0x3a1ed6={};var _0x30f1de={};var _0x3a3d23;var _0x30d6cb;return db['DeskConfiguration'][_0x454e('0x4b')]({'where':{'id':_0x3aba48[_0x454e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x14bd1b,null))[_0x454e('0x27')](function(_0x154356){if(_0x154356){_0x3a3d23=_0x154356;_0x30f1de['model']=_[_0x454e('0x31')](db[_0x454e('0x4c')][_0x454e('0x2d')]);_0x30f1de[_0x454e('0x30')]=_['keys'](_0x3aba48['query']);_0x30f1de['filters']=_[_0x454e('0x32')](_0x30f1de[_0x454e('0x36')],_0x30f1de[_0x454e('0x30')]);_0x3a1ed6[_0x454e('0x33')]=_[_0x454e('0x32')](_0x30f1de['model'],qs[_0x454e('0x34')](_0x3aba48[_0x454e('0x30')][_0x454e('0x34')]));_0x3a1ed6[_0x454e('0x33')]=_0x3a1ed6['attributes'][_0x454e('0x35')]?_0x3a1ed6[_0x454e('0x33')]:_0x30f1de[_0x454e('0x36')];_0x3a1ed6['order']=qs['sort'](_0x3aba48['query']['sort']);_0x3a1ed6[_0x454e('0x39')]=qs[_0x454e('0x3a')](_[_0x454e('0x3b')](_0x3aba48[_0x454e('0x30')],_0x30f1de[_0x454e('0x3a')]));if(_0x3aba48['query'][_0x454e('0x3c')]){_0x3a1ed6['where']=_[_0x454e('0x3d')](_0x3a1ed6[_0x454e('0x39')],{'$or':_[_0x454e('0x2f')](_0x3a1ed6['attributes'],function(_0x5b53cb){var _0x4e8fb8={};_0x4e8fb8[_0x5b53cb]={'$like':'%'+_0x3aba48[_0x454e('0x30')][_0x454e('0x3c')]+'%'};return _0x4e8fb8;})});}_0x3a1ed6=_[_0x454e('0x3d')]({},_0x3a1ed6,_0x3aba48[_0x454e('0x40')]);return _0x3a3d23['getFields'](_0x3a1ed6);}})[_0x454e('0x27')](function(_0x27d89f){if(_0x27d89f){_0x30d6cb=_0x27d89f[_0x454e('0x35')];if(!_0x3aba48[_0x454e('0x30')][_0x454e('0x4d')]('nolimit')){_0x3a1ed6['limit']=qs[_0x454e('0x21')](_0x3aba48[_0x454e('0x30')][_0x454e('0x21')]);_0x3a1ed6[_0x454e('0x1e')]=qs[_0x454e('0x1e')](_0x3aba48[_0x454e('0x30')][_0x454e('0x1e')]);}return _0x3a3d23[_0x454e('0x4e')](_0x3a1ed6);}})[_0x454e('0x27')](function(_0x54edc7){if(_0x54edc7){return _0x54edc7?{'count':_0x30d6cb,'rows':_0x54edc7}:null;}})[_0x454e('0x27')](respondWithResult(_0x14bd1b,null))[_0x454e('0x44')](handleError(_0x14bd1b,null));};exports[_0x454e('0x4f')]=function(_0x40a92a,_0xfd3e15,_0x32ee32){var _0x5da152={};var _0x46f92b={};var _0x229633;var _0x5bdb0c;return db['DeskConfiguration'][_0x454e('0x4b')]({'where':{'id':_0x40a92a[_0x454e('0x4a')]['id']}})[_0x454e('0x27')](handleEntityNotFound(_0xfd3e15,null))[_0x454e('0x27')](function(_0x1eb700){if(_0x1eb700){_0x229633=_0x1eb700;_0x46f92b[_0x454e('0x36')]=_[_0x454e('0x31')](db[_0x454e('0x4c')][_0x454e('0x2d')]);_0x46f92b[_0x454e('0x30')]=_[_0x454e('0x31')](_0x40a92a[_0x454e('0x30')]);_0x46f92b[_0x454e('0x3a')]=_['intersection'](_0x46f92b[_0x454e('0x36')],_0x46f92b[_0x454e('0x30')]);_0x5da152['attributes']=_[_0x454e('0x32')](_0x46f92b[_0x454e('0x36')],qs['fields'](_0x40a92a['query']['fields']));_0x5da152['attributes']=_0x5da152[_0x454e('0x33')][_0x454e('0x35')]?_0x5da152[_0x454e('0x33')]:_0x46f92b[_0x454e('0x36')];_0x5da152[_0x454e('0x37')]=qs[_0x454e('0x38')](_0x40a92a[_0x454e('0x30')][_0x454e('0x38')]);_0x5da152[_0x454e('0x39')]=qs[_0x454e('0x3a')](_[_0x454e('0x3b')](_0x40a92a[_0x454e('0x30')],_0x46f92b[_0x454e('0x3a')]));if(_0x40a92a[_0x454e('0x30')][_0x454e('0x3c')]){_0x5da152[_0x454e('0x39')]=_[_0x454e('0x3d')](_0x5da152['where'],{'$or':_[_0x454e('0x2f')](_0x5da152[_0x454e('0x33')],function(_0x1851e5){var _0x567271={};_0x567271[_0x1851e5]={'$like':'%'+_0x40a92a['query'][_0x454e('0x3c')]+'%'};return _0x567271;})});}_0x5da152=_[_0x454e('0x3d')]({},_0x5da152,_0x40a92a['options']);return _0x229633[_0x454e('0x4f')](_0x5da152);}})[_0x454e('0x27')](function(_0x35a1f7){if(_0x35a1f7){_0x5bdb0c=_0x35a1f7[_0x454e('0x35')];if(!_0x40a92a[_0x454e('0x30')][_0x454e('0x4d')](_0x454e('0x50'))){_0x5da152[_0x454e('0x21')]=qs[_0x454e('0x21')](_0x40a92a[_0x454e('0x30')][_0x454e('0x21')]);_0x5da152[_0x454e('0x1e')]=qs['offset'](_0x40a92a[_0x454e('0x30')][_0x454e('0x1e')]);}return _0x229633[_0x454e('0x4f')](_0x5da152);}})['then'](function(_0x30b102){if(_0x30b102){return _0x30b102?{'count':_0x5bdb0c,'rows':_0x30b102}:null;}})[_0x454e('0x27')](respondWithResult(_0xfd3e15,null))[_0x454e('0x44')](handleError(_0xfd3e15,null));};exports[_0x454e('0x51')]=function(_0x2deb40,_0x528e60,_0x2b3613){var _0xb2a50e={};var _0x7bb283={};var _0x1935a2;var _0x23d999;return db['DeskConfiguration'][_0x454e('0x4b')]({'where':{'id':_0x2deb40['params']['id']}})[_0x454e('0x27')](handleEntityNotFound(_0x528e60,null))['then'](function(_0x5df4f0){if(_0x5df4f0){_0x1935a2=_0x5df4f0;_0x7bb283[_0x454e('0x36')]=_['keys'](db[_0x454e('0x4c')]['rawAttributes']);_0x7bb283[_0x454e('0x30')]=_['keys'](_0x2deb40[_0x454e('0x30')]);_0x7bb283[_0x454e('0x3a')]=_[_0x454e('0x32')](_0x7bb283[_0x454e('0x36')],_0x7bb283[_0x454e('0x30')]);_0xb2a50e[_0x454e('0x33')]=_[_0x454e('0x32')](_0x7bb283['model'],qs[_0x454e('0x34')](_0x2deb40[_0x454e('0x30')][_0x454e('0x34')]));_0xb2a50e[_0x454e('0x33')]=_0xb2a50e[_0x454e('0x33')][_0x454e('0x35')]?_0xb2a50e['attributes']:_0x7bb283[_0x454e('0x36')];_0xb2a50e[_0x454e('0x37')]=qs[_0x454e('0x38')](_0x2deb40[_0x454e('0x30')][_0x454e('0x38')]);_0xb2a50e[_0x454e('0x39')]=qs[_0x454e('0x3a')](_[_0x454e('0x3b')](_0x2deb40[_0x454e('0x30')],_0x7bb283['filters']));if(_0x2deb40[_0x454e('0x30')][_0x454e('0x3c')]){_0xb2a50e[_0x454e('0x39')]=_['merge'](_0xb2a50e[_0x454e('0x39')],{'$or':_[_0x454e('0x2f')](_0xb2a50e[_0x454e('0x33')],function(_0x390387){var _0x528a49={};_0x528a49[_0x390387]={'$like':'%'+_0x2deb40['query']['filter']+'%'};return _0x528a49;})});}_0xb2a50e=_[_0x454e('0x3d')]({},_0xb2a50e,_0x2deb40[_0x454e('0x40')]);return _0x1935a2[_0x454e('0x51')](_0xb2a50e);}})[_0x454e('0x27')](function(_0x12ad76){if(_0x12ad76){_0x23d999=_0x12ad76[_0x454e('0x35')];if(!_0x2deb40['query']['hasOwnProperty']('nolimit')){_0xb2a50e[_0x454e('0x21')]=qs[_0x454e('0x21')](_0x2deb40[_0x454e('0x30')]['limit']);_0xb2a50e['offset']=qs[_0x454e('0x1e')](_0x2deb40[_0x454e('0x30')][_0x454e('0x1e')]);}return _0x1935a2['getDescriptions'](_0xb2a50e);}})[_0x454e('0x27')](function(_0x19ac94){if(_0x19ac94){return _0x19ac94?{'count':_0x23d999,'rows':_0x19ac94}:null;}})['then'](respondWithResult(_0x528e60,null))['catch'](handleError(_0x528e60,null));};exports[_0x454e('0x52')]=function(_0xb615ef,_0x18a11d,_0xe64a6a){var _0x446684={};var _0x43696d={};var _0x270bc1;var _0x13b0c6;return db[_0x454e('0x2c')]['findOne']({'where':{'id':_0xb615ef[_0x454e('0x4a')]['id']}})[_0x454e('0x27')](handleEntityNotFound(_0x18a11d,null))['then'](function(_0x3050a5){if(_0x3050a5){_0x270bc1=_0x3050a5;_0x43696d[_0x454e('0x36')]=_[_0x454e('0x31')](db[_0x454e('0x53')][_0x454e('0x2d')]);_0x43696d[_0x454e('0x30')]=_[_0x454e('0x31')](_0xb615ef['query']);_0x43696d['filters']=_[_0x454e('0x32')](_0x43696d[_0x454e('0x36')],_0x43696d['query']);_0x446684[_0x454e('0x33')]=_[_0x454e('0x32')](_0x43696d['model'],qs[_0x454e('0x34')](_0xb615ef[_0x454e('0x30')][_0x454e('0x34')]));_0x446684[_0x454e('0x33')]=_0x446684[_0x454e('0x33')]['length']?_0x446684[_0x454e('0x33')]:_0x43696d['model'];_0x446684['order']=qs[_0x454e('0x38')](_0xb615ef['query']['sort']);_0x446684['where']=qs['filters'](_[_0x454e('0x3b')](_0xb615ef['query'],_0x43696d[_0x454e('0x3a')]));if(_0xb615ef['query'][_0x454e('0x3c')]){_0x446684[_0x454e('0x39')]=_['merge'](_0x446684[_0x454e('0x39')],{'$or':_[_0x454e('0x2f')](_0x446684[_0x454e('0x33')],function(_0x52dafd){var _0x314963={};_0x314963[_0x52dafd]={'$like':'%'+_0xb615ef[_0x454e('0x30')][_0x454e('0x3c')]+'%'};return _0x314963;})});}_0x446684=_['merge']({},_0x446684,_0xb615ef[_0x454e('0x40')]);return _0x270bc1[_0x454e('0x52')](_0x446684);}})[_0x454e('0x27')](function(_0x3c5d3a){if(_0x3c5d3a){_0x13b0c6=_0x3c5d3a[_0x454e('0x35')];if(!_0xb615ef[_0x454e('0x30')]['hasOwnProperty'](_0x454e('0x50'))){_0x446684[_0x454e('0x21')]=qs[_0x454e('0x21')](_0xb615ef[_0x454e('0x30')][_0x454e('0x21')]);_0x446684[_0x454e('0x1e')]=qs[_0x454e('0x1e')](_0xb615ef[_0x454e('0x30')]['offset']);}return _0x270bc1[_0x454e('0x52')](_0x446684);}})['then'](function(_0x279c45){if(_0x279c45){return _0x279c45?{'count':_0x13b0c6,'rows':_0x279c45}:null;}})[_0x454e('0x27')](respondWithResult(_0x18a11d,null))[_0x454e('0x44')](handleError(_0x18a11d,null));};exports[_0x454e('0x54')]=function(_0x21b447,_0x346c79,_0x2886bb){if(_0x21b447[_0x454e('0x49')]['id']){delete _0x21b447[_0x454e('0x49')]['id'];}return db[_0x454e('0x2c')]['findOne']({'where':{'id':_0x21b447[_0x454e('0x4a')]['id']}})[_0x454e('0x27')](handleEntityNotFound(_0x346c79,null))[_0x454e('0x27')](function(_0xef3dc8){if(_0xef3dc8){return _0xef3dc8['setTags'](_0x21b447[_0x454e('0x49')][_0x454e('0x55')]||[]);}return null;})[_0x454e('0x27')](respondWithResult(_0x346c79,null))[_0x454e('0x44')](handleError(_0x346c79,null));}; \ No newline at end of file +var _0x4637=['Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','send','DeskConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','rows','show','include','find','create','body','catch','params','getFields','findOne','DeskField','order','getSubjects','getDescriptions'];(function(_0x5f396f,_0x17f585){var _0x467268=function(_0x284584){while(--_0x284584){_0x5f396f['push'](_0x5f396f['shift']());}};_0x467268(++_0x17f585);}(_0x4637,0x1a3));var _0x7463=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x4637[_0xf50820];return _0x2a9b10;};'use strict';var emlformat=require(_0x7463('0x0'));var rimraf=require(_0x7463('0x1'));var zipdir=require(_0x7463('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7463('0x3'));var moment=require('moment');var BPromise=require(_0x7463('0x4'));var Mustache=require(_0x7463('0x5'));var util=require(_0x7463('0x6'));var path=require('path');var sox=require(_0x7463('0x7'));var csv=require(_0x7463('0x8'));var ejs=require(_0x7463('0x9'));var fs=require('fs');var fs_extra=require(_0x7463('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7463('0xb'));var jsforce=require(_0x7463('0xc'));var deskjs=require(_0x7463('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7463('0xe'));var Papa=require(_0x7463('0xf'));var Redis=require(_0x7463('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7463('0x11'));var as=require(_0x7463('0x12'));var hardwareService=require(_0x7463('0x13'));var logger=require('../../config/logger')(_0x7463('0x14'));var utils=require(_0x7463('0x15'));var config=require(_0x7463('0x16'));var licenseUtil=require(_0x7463('0x17'));var db=require(_0x7463('0x18'))['db'];function respondWithStatusCode(_0x125097,_0x123b9b){_0x123b9b=_0x123b9b||0xcc;return function(_0xc87091){if(_0xc87091){return _0x125097[_0x7463('0x19')](_0x123b9b);}return _0x125097[_0x7463('0x1a')](_0x123b9b)['end']();};}function respondWithResult(_0x80c029,_0x534e85){_0x534e85=_0x534e85||0xc8;return function(_0x188033){if(_0x188033){return _0x80c029[_0x7463('0x1a')](_0x534e85)[_0x7463('0x1b')](_0x188033);}};}function respondWithFilteredResult(_0x5d7688,_0x254976){return function(_0x56a26a){if(_0x56a26a){var _0x38ab31=typeof _0x254976[_0x7463('0x1c')]===_0x7463('0x1d')&&typeof _0x254976[_0x7463('0x1e')]===_0x7463('0x1d');var _0x4fca13=_0x56a26a['count'];var _0xcf4745=_0x38ab31?0x0:_0x254976['offset'];var _0x2edda9=_0x38ab31?_0x56a26a[_0x7463('0x1f')]:_0x254976[_0x7463('0x1c')]+_0x254976[_0x7463('0x1e')];var _0x4ea73d;if(_0x2edda9>=_0x4fca13){_0x2edda9=_0x4fca13;_0x4ea73d=0xc8;}else{_0x4ea73d=0xce;}_0x5d7688['status'](_0x4ea73d);return _0x5d7688[_0x7463('0x20')]('Content-Range',_0xcf4745+'-'+_0x2edda9+'/'+_0x4fca13)[_0x7463('0x1b')](_0x56a26a);}return null;};}function patchUpdates(_0x4a3483){return function(_0x5ec7d9){try{jsonpatch[_0x7463('0x21')](_0x5ec7d9,_0x4a3483,!![]);}catch(_0xe747d7){return BPromise[_0x7463('0x22')](_0xe747d7);}return _0x5ec7d9['save']();};}function saveUpdates(_0x4397da,_0x2778b5){return function(_0x3f3dd9){if(_0x3f3dd9){return _0x3f3dd9[_0x7463('0x23')](_0x4397da)[_0x7463('0x24')](function(_0x480228){return _0x480228;});}return null;};}function removeEntity(_0xf400c6,_0x195e61){return function(_0x366c7a){if(_0x366c7a){return _0x366c7a[_0x7463('0x25')]()[_0x7463('0x24')](function(){_0xf400c6[_0x7463('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e638b,_0x561796){return function(_0x45b875){if(!_0x45b875){_0x3e638b[_0x7463('0x19')](0x194);}return _0x45b875;};}function handleError(_0x4fa07b,_0x94a07a){_0x94a07a=_0x94a07a||0x1f4;return function(_0x1c23ed){logger['error'](_0x1c23ed[_0x7463('0x26')]);if(_0x1c23ed['name']){delete _0x1c23ed['name'];}_0x4fa07b['status'](_0x94a07a)[_0x7463('0x27')](_0x1c23ed);};}exports['index']=function(_0x8a3496,_0x409e18){var _0xaaef04={},_0x151c7c={},_0x58cdb5={'count':0x0,'rows':[]};var _0x4dfc3e=_['map'](db[_0x7463('0x28')][_0x7463('0x29')],function(_0x48c4db){return{'name':_0x48c4db[_0x7463('0x2a')],'type':_0x48c4db[_0x7463('0x2b')]['key']};});_0x151c7c[_0x7463('0x2c')]=_[_0x7463('0x2d')](_0x4dfc3e,'name');_0x151c7c[_0x7463('0x2e')]=_[_0x7463('0x2f')](_0x8a3496[_0x7463('0x2e')]);_0x151c7c[_0x7463('0x30')]=_[_0x7463('0x31')](_0x151c7c[_0x7463('0x2c')],_0x151c7c[_0x7463('0x2e')]);_0xaaef04['attributes']=_[_0x7463('0x31')](_0x151c7c[_0x7463('0x2c')],qs[_0x7463('0x32')](_0x8a3496['query'][_0x7463('0x32')]));_0xaaef04[_0x7463('0x33')]=_0xaaef04[_0x7463('0x33')][_0x7463('0x34')]?_0xaaef04[_0x7463('0x33')]:_0x151c7c[_0x7463('0x2c')];if(!_0x8a3496['query'][_0x7463('0x35')](_0x7463('0x36'))){_0xaaef04[_0x7463('0x1e')]=qs['limit'](_0x8a3496['query'][_0x7463('0x1e')]);_0xaaef04[_0x7463('0x1c')]=qs[_0x7463('0x1c')](_0x8a3496['query']['offset']);}_0xaaef04['order']=qs[_0x7463('0x37')](_0x8a3496[_0x7463('0x2e')][_0x7463('0x37')]);_0xaaef04[_0x7463('0x38')]=qs[_0x7463('0x30')](_[_0x7463('0x39')](_0x8a3496[_0x7463('0x2e')],_0x151c7c[_0x7463('0x30')]),_0x4dfc3e);if(_0x8a3496[_0x7463('0x2e')][_0x7463('0x3a')]){_0xaaef04[_0x7463('0x38')]=_[_0x7463('0x3b')](_0xaaef04[_0x7463('0x38')],{'$or':_[_0x7463('0x2d')](_0x4dfc3e,function(_0x15855b){if(_0x15855b[_0x7463('0x2b')]!==_0x7463('0x3c')){var _0x878a0c={};_0x878a0c[_0x15855b[_0x7463('0x3d')]]={'$like':'%'+_0x8a3496[_0x7463('0x2e')][_0x7463('0x3a')]+'%'};return _0x878a0c;}})});}_0xaaef04=_[_0x7463('0x3b')]({},_0xaaef04,_0x8a3496[_0x7463('0x3e')]);var _0x13e2ab={'where':_0xaaef04[_0x7463('0x38')]};return db[_0x7463('0x28')]['count'](_0x13e2ab)[_0x7463('0x24')](function(_0xf849ab){_0x58cdb5[_0x7463('0x1f')]=_0xf849ab;if(_0x8a3496[_0x7463('0x2e')][_0x7463('0x3f')]){_0xaaef04['include']=[{'all':!![]}];}return db[_0x7463('0x28')][_0x7463('0x40')](_0xaaef04);})[_0x7463('0x24')](function(_0x4b3a6e){_0x58cdb5[_0x7463('0x41')]=_0x4b3a6e;return _0x58cdb5;})['then'](respondWithFilteredResult(_0x409e18,_0xaaef04))['catch'](handleError(_0x409e18,null));};exports[_0x7463('0x42')]=function(_0x4f3bef,_0x4ca90f){var _0x1d007e={'raw':![],'where':{'id':_0x4f3bef['params']['id']}},_0x573031={};_0x573031[_0x7463('0x2c')]=_['keys'](db[_0x7463('0x28')][_0x7463('0x29')]);_0x573031[_0x7463('0x2e')]=_[_0x7463('0x2f')](_0x4f3bef[_0x7463('0x2e')]);_0x573031[_0x7463('0x30')]=_['intersection'](_0x573031[_0x7463('0x2c')],_0x573031[_0x7463('0x2e')]);_0x1d007e[_0x7463('0x33')]=_['intersection'](_0x573031['model'],qs[_0x7463('0x32')](_0x4f3bef[_0x7463('0x2e')][_0x7463('0x32')]));_0x1d007e[_0x7463('0x33')]=_0x1d007e[_0x7463('0x33')][_0x7463('0x34')]?_0x1d007e[_0x7463('0x33')]:_0x573031[_0x7463('0x2c')];if(_0x4f3bef[_0x7463('0x2e')][_0x7463('0x3f')]){_0x1d007e[_0x7463('0x43')]=[{'all':!![]}];}_0x1d007e=_['merge']({},_0x1d007e,_0x4f3bef['options']);return db[_0x7463('0x28')][_0x7463('0x44')](_0x1d007e)[_0x7463('0x24')](handleEntityNotFound(_0x4ca90f,null))[_0x7463('0x24')](respondWithResult(_0x4ca90f,null))['catch'](handleError(_0x4ca90f,null));};exports[_0x7463('0x45')]=function(_0x31f639,_0x4c4f2d){return db[_0x7463('0x28')][_0x7463('0x45')](_0x31f639[_0x7463('0x46')],{})[_0x7463('0x24')](respondWithResult(_0x4c4f2d,0xc9))[_0x7463('0x47')](handleError(_0x4c4f2d,null));};exports[_0x7463('0x23')]=function(_0x1eb753,_0x49e86d){if(_0x1eb753[_0x7463('0x46')]['id']){delete _0x1eb753['body']['id'];}return db[_0x7463('0x28')][_0x7463('0x44')]({'where':{'id':_0x1eb753['params']['id']}})[_0x7463('0x24')](handleEntityNotFound(_0x49e86d,null))[_0x7463('0x24')](saveUpdates(_0x1eb753[_0x7463('0x46')],null))[_0x7463('0x24')](respondWithResult(_0x49e86d,null))['catch'](handleError(_0x49e86d,null));};exports[_0x7463('0x25')]=function(_0x3c98f8,_0x33be23){return db[_0x7463('0x28')][_0x7463('0x44')]({'where':{'id':_0x3c98f8[_0x7463('0x48')]['id']}})[_0x7463('0x24')](handleEntityNotFound(_0x33be23,null))[_0x7463('0x24')](removeEntity(_0x33be23,null))[_0x7463('0x47')](handleError(_0x33be23,null));};exports[_0x7463('0x49')]=function(_0x58ae15,_0x2edc2e,_0x13c804){var _0x56558f={};var _0x826f8c={};var _0x178a8a;var _0x2c8ace;return db[_0x7463('0x28')][_0x7463('0x4a')]({'where':{'id':_0x58ae15[_0x7463('0x48')]['id']}})['then'](handleEntityNotFound(_0x2edc2e,null))['then'](function(_0x12e425){if(_0x12e425){_0x178a8a=_0x12e425;_0x826f8c['model']=_[_0x7463('0x2f')](db[_0x7463('0x4b')][_0x7463('0x29')]);_0x826f8c[_0x7463('0x2e')]=_[_0x7463('0x2f')](_0x58ae15[_0x7463('0x2e')]);_0x826f8c[_0x7463('0x30')]=_[_0x7463('0x31')](_0x826f8c[_0x7463('0x2c')],_0x826f8c['query']);_0x56558f[_0x7463('0x33')]=_['intersection'](_0x826f8c[_0x7463('0x2c')],qs[_0x7463('0x32')](_0x58ae15[_0x7463('0x2e')][_0x7463('0x32')]));_0x56558f[_0x7463('0x33')]=_0x56558f[_0x7463('0x33')][_0x7463('0x34')]?_0x56558f[_0x7463('0x33')]:_0x826f8c[_0x7463('0x2c')];_0x56558f[_0x7463('0x4c')]=qs[_0x7463('0x37')](_0x58ae15[_0x7463('0x2e')][_0x7463('0x37')]);_0x56558f[_0x7463('0x38')]=qs[_0x7463('0x30')](_['pick'](_0x58ae15['query'],_0x826f8c[_0x7463('0x30')]));if(_0x58ae15[_0x7463('0x2e')][_0x7463('0x3a')]){_0x56558f['where']=_[_0x7463('0x3b')](_0x56558f['where'],{'$or':_['map'](_0x56558f[_0x7463('0x33')],function(_0x25f81c){var _0x569af3={};_0x569af3[_0x25f81c]={'$like':'%'+_0x58ae15[_0x7463('0x2e')][_0x7463('0x3a')]+'%'};return _0x569af3;})});}_0x56558f=_[_0x7463('0x3b')]({},_0x56558f,_0x58ae15[_0x7463('0x3e')]);return _0x178a8a[_0x7463('0x49')](_0x56558f);}})[_0x7463('0x24')](function(_0x52d532){if(_0x52d532){_0x2c8ace=_0x52d532['length'];if(!_0x58ae15[_0x7463('0x2e')]['hasOwnProperty'](_0x7463('0x36'))){_0x56558f['limit']=qs[_0x7463('0x1e')](_0x58ae15[_0x7463('0x2e')]['limit']);_0x56558f[_0x7463('0x1c')]=qs[_0x7463('0x1c')](_0x58ae15[_0x7463('0x2e')][_0x7463('0x1c')]);}return _0x178a8a[_0x7463('0x49')](_0x56558f);}})[_0x7463('0x24')](function(_0x34311e){if(_0x34311e){return _0x34311e?{'count':_0x2c8ace,'rows':_0x34311e}:null;}})[_0x7463('0x24')](respondWithResult(_0x2edc2e,null))[_0x7463('0x47')](handleError(_0x2edc2e,null));};exports['getSubjects']=function(_0x4e631b,_0x499021,_0x1427da){var _0x7d86ae={};var _0x214116={};var _0x33410b;var _0x534c0b;return db[_0x7463('0x28')][_0x7463('0x4a')]({'where':{'id':_0x4e631b['params']['id']}})[_0x7463('0x24')](handleEntityNotFound(_0x499021,null))[_0x7463('0x24')](function(_0x53fcb1){if(_0x53fcb1){_0x33410b=_0x53fcb1;_0x214116[_0x7463('0x2c')]=_[_0x7463('0x2f')](db[_0x7463('0x4b')][_0x7463('0x29')]);_0x214116[_0x7463('0x2e')]=_[_0x7463('0x2f')](_0x4e631b['query']);_0x214116['filters']=_[_0x7463('0x31')](_0x214116[_0x7463('0x2c')],_0x214116[_0x7463('0x2e')]);_0x7d86ae[_0x7463('0x33')]=_[_0x7463('0x31')](_0x214116[_0x7463('0x2c')],qs['fields'](_0x4e631b[_0x7463('0x2e')]['fields']));_0x7d86ae[_0x7463('0x33')]=_0x7d86ae['attributes']['length']?_0x7d86ae[_0x7463('0x33')]:_0x214116[_0x7463('0x2c')];_0x7d86ae[_0x7463('0x4c')]=qs[_0x7463('0x37')](_0x4e631b[_0x7463('0x2e')][_0x7463('0x37')]);_0x7d86ae[_0x7463('0x38')]=qs[_0x7463('0x30')](_['pick'](_0x4e631b[_0x7463('0x2e')],_0x214116['filters']));if(_0x4e631b[_0x7463('0x2e')][_0x7463('0x3a')]){_0x7d86ae[_0x7463('0x38')]=_[_0x7463('0x3b')](_0x7d86ae['where'],{'$or':_[_0x7463('0x2d')](_0x7d86ae[_0x7463('0x33')],function(_0xde7d0a){var _0x2c4f87={};_0x2c4f87[_0xde7d0a]={'$like':'%'+_0x4e631b['query'][_0x7463('0x3a')]+'%'};return _0x2c4f87;})});}_0x7d86ae=_[_0x7463('0x3b')]({},_0x7d86ae,_0x4e631b[_0x7463('0x3e')]);return _0x33410b[_0x7463('0x4d')](_0x7d86ae);}})[_0x7463('0x24')](function(_0x42b891){if(_0x42b891){_0x534c0b=_0x42b891[_0x7463('0x34')];if(!_0x4e631b[_0x7463('0x2e')][_0x7463('0x35')](_0x7463('0x36'))){_0x7d86ae['limit']=qs[_0x7463('0x1e')](_0x4e631b[_0x7463('0x2e')][_0x7463('0x1e')]);_0x7d86ae['offset']=qs[_0x7463('0x1c')](_0x4e631b[_0x7463('0x2e')][_0x7463('0x1c')]);}return _0x33410b['getSubjects'](_0x7d86ae);}})['then'](function(_0x54c19f){if(_0x54c19f){return _0x54c19f?{'count':_0x534c0b,'rows':_0x54c19f}:null;}})[_0x7463('0x24')](respondWithResult(_0x499021,null))[_0x7463('0x47')](handleError(_0x499021,null));};exports[_0x7463('0x4e')]=function(_0x2a6254,_0x54d8e0,_0x434fff){var _0x18d53c={};var _0x5bb9bb={};var _0x50ee32;var _0x4ceb25;return db['DeskConfiguration'][_0x7463('0x4a')]({'where':{'id':_0x2a6254[_0x7463('0x48')]['id']}})[_0x7463('0x24')](handleEntityNotFound(_0x54d8e0,null))[_0x7463('0x24')](function(_0x9d9ac3){if(_0x9d9ac3){_0x50ee32=_0x9d9ac3;_0x5bb9bb[_0x7463('0x2c')]=_[_0x7463('0x2f')](db[_0x7463('0x4b')]['rawAttributes']);_0x5bb9bb['query']=_[_0x7463('0x2f')](_0x2a6254['query']);_0x5bb9bb['filters']=_[_0x7463('0x31')](_0x5bb9bb['model'],_0x5bb9bb['query']);_0x18d53c['attributes']=_[_0x7463('0x31')](_0x5bb9bb[_0x7463('0x2c')],qs[_0x7463('0x32')](_0x2a6254[_0x7463('0x2e')][_0x7463('0x32')]));_0x18d53c[_0x7463('0x33')]=_0x18d53c[_0x7463('0x33')][_0x7463('0x34')]?_0x18d53c[_0x7463('0x33')]:_0x5bb9bb['model'];_0x18d53c['order']=qs[_0x7463('0x37')](_0x2a6254['query'][_0x7463('0x37')]);_0x18d53c['where']=qs[_0x7463('0x30')](_['pick'](_0x2a6254[_0x7463('0x2e')],_0x5bb9bb[_0x7463('0x30')]));if(_0x2a6254[_0x7463('0x2e')]['filter']){_0x18d53c[_0x7463('0x38')]=_[_0x7463('0x3b')](_0x18d53c[_0x7463('0x38')],{'$or':_['map'](_0x18d53c[_0x7463('0x33')],function(_0x45af67){var _0x1ed4fc={};_0x1ed4fc[_0x45af67]={'$like':'%'+_0x2a6254['query'][_0x7463('0x3a')]+'%'};return _0x1ed4fc;})});}_0x18d53c=_[_0x7463('0x3b')]({},_0x18d53c,_0x2a6254['options']);return _0x50ee32[_0x7463('0x4e')](_0x18d53c);}})['then'](function(_0x36e228){if(_0x36e228){_0x4ceb25=_0x36e228[_0x7463('0x34')];if(!_0x2a6254[_0x7463('0x2e')][_0x7463('0x35')](_0x7463('0x36'))){_0x18d53c[_0x7463('0x1e')]=qs[_0x7463('0x1e')](_0x2a6254[_0x7463('0x2e')]['limit']);_0x18d53c[_0x7463('0x1c')]=qs['offset'](_0x2a6254[_0x7463('0x2e')][_0x7463('0x1c')]);}return _0x50ee32[_0x7463('0x4e')](_0x18d53c);}})[_0x7463('0x24')](function(_0x2eb712){if(_0x2eb712){return _0x2eb712?{'count':_0x4ceb25,'rows':_0x2eb712}:null;}})[_0x7463('0x24')](respondWithResult(_0x54d8e0,null))[_0x7463('0x47')](handleError(_0x54d8e0,null));};exports['getTags']=function(_0x5b7a6b,_0x385440,_0x254821){var _0x4fa9d4={};var _0x937ce0={};var _0x5e6a28;var _0x23afff;return db[_0x7463('0x28')][_0x7463('0x4a')]({'where':{'id':_0x5b7a6b['params']['id']}})['then'](handleEntityNotFound(_0x385440,null))[_0x7463('0x24')](function(_0x18cd9d){if(_0x18cd9d){_0x5e6a28=_0x18cd9d;_0x937ce0[_0x7463('0x2c')]=_['keys'](db[_0x7463('0x4f')][_0x7463('0x29')]);_0x937ce0[_0x7463('0x2e')]=_[_0x7463('0x2f')](_0x5b7a6b[_0x7463('0x2e')]);_0x937ce0[_0x7463('0x30')]=_[_0x7463('0x31')](_0x937ce0[_0x7463('0x2c')],_0x937ce0['query']);_0x4fa9d4[_0x7463('0x33')]=_[_0x7463('0x31')](_0x937ce0[_0x7463('0x2c')],qs[_0x7463('0x32')](_0x5b7a6b['query'][_0x7463('0x32')]));_0x4fa9d4[_0x7463('0x33')]=_0x4fa9d4[_0x7463('0x33')][_0x7463('0x34')]?_0x4fa9d4[_0x7463('0x33')]:_0x937ce0[_0x7463('0x2c')];_0x4fa9d4[_0x7463('0x4c')]=qs[_0x7463('0x37')](_0x5b7a6b[_0x7463('0x2e')]['sort']);_0x4fa9d4[_0x7463('0x38')]=qs[_0x7463('0x30')](_[_0x7463('0x39')](_0x5b7a6b['query'],_0x937ce0[_0x7463('0x30')]));if(_0x5b7a6b[_0x7463('0x2e')][_0x7463('0x3a')]){_0x4fa9d4[_0x7463('0x38')]=_[_0x7463('0x3b')](_0x4fa9d4['where'],{'$or':_[_0x7463('0x2d')](_0x4fa9d4[_0x7463('0x33')],function(_0x585c00){var _0x49b7dd={};_0x49b7dd[_0x585c00]={'$like':'%'+_0x5b7a6b[_0x7463('0x2e')]['filter']+'%'};return _0x49b7dd;})});}_0x4fa9d4=_[_0x7463('0x3b')]({},_0x4fa9d4,_0x5b7a6b[_0x7463('0x3e')]);return _0x5e6a28[_0x7463('0x50')](_0x4fa9d4);}})[_0x7463('0x24')](function(_0x590243){if(_0x590243){_0x23afff=_0x590243[_0x7463('0x34')];if(!_0x5b7a6b[_0x7463('0x2e')][_0x7463('0x35')]('nolimit')){_0x4fa9d4['limit']=qs['limit'](_0x5b7a6b[_0x7463('0x2e')][_0x7463('0x1e')]);_0x4fa9d4[_0x7463('0x1c')]=qs[_0x7463('0x1c')](_0x5b7a6b['query'][_0x7463('0x1c')]);}return _0x5e6a28[_0x7463('0x50')](_0x4fa9d4);}})['then'](function(_0x43f66b){if(_0x43f66b){return _0x43f66b?{'count':_0x23afff,'rows':_0x43f66b}:null;}})[_0x7463('0x24')](respondWithResult(_0x385440,null))['catch'](handleError(_0x385440,null));};exports[_0x7463('0x51')]=function(_0x133985,_0x48b357,_0x1ae134){if(_0x133985[_0x7463('0x46')]['id']){delete _0x133985[_0x7463('0x46')]['id'];}return db[_0x7463('0x28')][_0x7463('0x4a')]({'where':{'id':_0x133985[_0x7463('0x48')]['id']}})[_0x7463('0x24')](handleEntityNotFound(_0x48b357,null))[_0x7463('0x24')](function(_0x264899){if(_0x264899){return _0x264899[_0x7463('0x51')](_0x133985[_0x7463('0x46')][_0x7463('0x52')]||[]);}return null;})[_0x7463('0x24')](respondWithResult(_0x48b357,null))[_0x7463('0x47')](handleError(_0x48b357,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 24bf7e6..f71dcf2 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 _0x2f3d=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2f3d,0xd6));var _0xd2f3=function(_0x419806,_0x23da81){_0x419806=_0x419806-0x0;var _0xef3f42=_0x2f3d[_0x419806];return _0xef3f42;};'use strict';var _=require(_0xd2f3('0x0'));var util=require(_0xd2f3('0x1'));var logger=require(_0xd2f3('0x2'))(_0xd2f3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd2f3('0x4'));var fs=require('fs');var path=require(_0xd2f3('0x5'));var rimraf=require(_0xd2f3('0x6'));var config=require(_0xd2f3('0x7'));var attributes=require(_0xd2f3('0x8'));module[_0xd2f3('0x9')]=function(_0x169237,_0x14b005){return _0x169237['define'](_0xd2f3('0xa'),attributes,{'tableName':_0xd2f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf97b=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x198247,_0x491c12){var _0x2b18bc=function(_0x4a43e2){while(--_0x4a43e2){_0x198247['push'](_0x198247['shift']());}};_0x2b18bc(++_0x491c12);}(_0xf97b,0x19c));var _0xbf97=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xf97b[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xbf97('0x0'));var util=require(_0xbf97('0x1'));var logger=require(_0xbf97('0x2'))(_0xbf97('0x3'));var moment=require(_0xbf97('0x4'));var BPromise=require('bluebird');var rp=require(_0xbf97('0x5'));var fs=require('fs');var path=require(_0xbf97('0x6'));var rimraf=require(_0xbf97('0x7'));var config=require(_0xbf97('0x8'));var attributes=require(_0xbf97('0x9'));module[_0xbf97('0xa')]=function(_0x4486ec,_0x1d58b6){return _0x4486ec[_0xbf97('0xb')](_0xbf97('0xc'),attributes,{'tableName':_0xbf97('0xd'),'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 b586385..57dcbb4 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 _0xc692=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0xc692,0x15f));var _0x2c69=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xc692[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x2c69('0x0'));var util=require(_0x2c69('0x1'));var moment=require(_0x2c69('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c69('0x3'));var db=require(_0x2c69('0x4'))['db'];var utils=require(_0x2c69('0x5'));var logger=require(_0x2c69('0x6'))(_0x2c69('0x7'));var config=require(_0x2c69('0x8'));var jayson=require(_0x2c69('0x9'));var client=jayson['client'][_0x2c69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4da70c,_0x5c1260,_0x31688a){return new BPromise(function(_0x7a913a,_0xfc5ebb){return client[_0x2c69('0xb')](_0x4da70c,_0x31688a)[_0x2c69('0xc')](function(_0x131313){logger['info'](_0x2c69('0xd'),_0x5c1260,'request\x20sent');logger[_0x2c69('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5c1260,_0x2c69('0xf'),JSON[_0x2c69('0x10')](_0x131313));if(_0x131313[_0x2c69('0x11')]){if(_0x131313[_0x2c69('0x11')][_0x2c69('0x12')]===0x1f4){logger[_0x2c69('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x5c1260,_0x131313[_0x2c69('0x11')]['message']);return _0xfc5ebb(_0x131313[_0x2c69('0x11')][_0x2c69('0x13')]);}logger[_0x2c69('0x11')](_0x2c69('0xd'),_0x5c1260,_0x131313[_0x2c69('0x11')][_0x2c69('0x13')]);return _0x7a913a(_0x131313['error'][_0x2c69('0x13')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x5c1260,_0x2c69('0xf'));_0x7a913a(_0x131313['result'][_0x2c69('0x13')]);}})[_0x2c69('0x14')](function(_0x59e48a){logger['error'](_0x2c69('0xd'),_0x5c1260,_0x59e48a);_0xfc5ebb(_0x59e48a);});});} \ No newline at end of file +var _0xc373=['../../config/environment','jayson/promise','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e9097,_0x21c1a8){var _0x167366=function(_0x21e5b1){while(--_0x21e5b1){_0x1e9097['push'](_0x1e9097['shift']());}};_0x167366(++_0x21c1a8);}(_0xc373,0x1c7));var _0x3c37=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xc373[_0x310a1b];return _0xdea206;};'use strict';var _=require('lodash');var util=require(_0x3c37('0x0'));var moment=require(_0x3c37('0x1'));var BPromise=require(_0x3c37('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c37('0x3'))['db'];var utils=require(_0x3c37('0x4'));var logger=require(_0x3c37('0x5'))(_0x3c37('0x6'));var config=require(_0x3c37('0x7'));var jayson=require(_0x3c37('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e1941,_0x1244e6,_0x14b09d){return new BPromise(function(_0x10617,_0x465de6){return client[_0x3c37('0x9')](_0x2e1941,_0x14b09d)[_0x3c37('0xa')](function(_0x59d4f9){logger[_0x3c37('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x1244e6,'request\x20sent');logger[_0x3c37('0xc')](_0x3c37('0xd'),_0x1244e6,_0x3c37('0xe'),JSON[_0x3c37('0xf')](_0x59d4f9));if(_0x59d4f9[_0x3c37('0x10')]){if(_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x11')]===0x1f4){logger['error'](_0x3c37('0x12'),_0x1244e6,_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x13')]);return _0x465de6(_0x59d4f9['error']['message']);}logger[_0x3c37('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x1244e6,_0x59d4f9['error'][_0x3c37('0x13')]);return _0x10617(_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x13')]);}else{logger[_0x3c37('0xb')](_0x3c37('0x12'),_0x1244e6,_0x3c37('0xe'));_0x10617(_0x59d4f9[_0x3c37('0x14')][_0x3c37('0x13')]);}})[_0x3c37('0x15')](function(_0x4e1560){logger[_0x3c37('0x10')](_0x3c37('0x12'),_0x1244e6,_0x4e1560);_0x465de6(_0x4e1560);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 8846430..21db534 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 _0x98e5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','post','isAuthenticated','create','put','update','delete','multer'];(function(_0x22f4d3,_0x4f13b5){var _0x1861cf=function(_0x52e90f){while(--_0x52e90f){_0x22f4d3['push'](_0x22f4d3['shift']());}};_0x1861cf(++_0x4f13b5);}(_0x98e5,0xa1));var _0x598e=function(_0x433015,_0x2638f4){_0x433015=_0x433015-0x0;var _0x4e9880=_0x98e5[_0x433015];return _0x4e9880;};'use strict';var multer=require(_0x598e('0x0'));var util=require('util');var path=require(_0x598e('0x1'));var timeout=require(_0x598e('0x2'));var express=require(_0x598e('0x3'));var router=express[_0x598e('0x4')]();var fs_extra=require(_0x598e('0x5'));var auth=require(_0x598e('0x6'));var interaction=require(_0x598e('0x7'));var config=require(_0x598e('0x8'));var controller=require('./intDeskField.controller');router[_0x598e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x598e('0xa'),auth['isAuthenticated'](),controller[_0x598e('0xb')]);router[_0x598e('0xc')]('/',auth[_0x598e('0xd')](),controller[_0x598e('0xe')]);router[_0x598e('0xf')]('/:id',auth[_0x598e('0xd')](),controller[_0x598e('0x10')]);router[_0x598e('0x11')](_0x598e('0xa'),auth[_0x598e('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xaf5b=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5972a6,_0x3cd054){var _0x51fd0f=function(_0x46ba29){while(--_0x46ba29){_0x5972a6['push'](_0x5972a6['shift']());}};_0x51fd0f(++_0x3cd054);}(_0xaf5b,0x108));var _0xbaf5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xaf5b[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xbaf5('0x0'));var util=require(_0xbaf5('0x1'));var path=require('path');var timeout=require(_0xbaf5('0x2'));var express=require(_0xbaf5('0x3'));var router=express[_0xbaf5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbaf5('0x5'));var interaction=require(_0xbaf5('0x6'));var config=require(_0xbaf5('0x7'));var controller=require('./intDeskField.controller');router[_0xbaf5('0x8')]('/',auth[_0xbaf5('0x9')](),controller[_0xbaf5('0xa')]);router['get'](_0xbaf5('0xb'),auth[_0xbaf5('0x9')](),controller[_0xbaf5('0xc')]);router[_0xbaf5('0xd')]('/',auth[_0xbaf5('0x9')](),controller['create']);router[_0xbaf5('0xe')](_0xbaf5('0xb'),auth['isAuthenticated'](),controller[_0xbaf5('0xf')]);router[_0xbaf5('0x10')](_0xbaf5('0xb'),auth[_0xbaf5('0x9')](),controller['destroy']);module[_0xbaf5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ddf8328..1535cc5 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 _0xe438=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','picklist'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0xe438,0x111));var _0x8e43=function(_0x37dec3,_0x488a3f){_0x37dec3=_0x37dec3-0x0;var _0x266863=_0xe438[_0x37dec3];return _0x266863;};'use strict';var Sequelize=require(_0x8e43('0x0'));module[_0x8e43('0x1')]={'type':{'type':Sequelize[_0x8e43('0x2')](_0x8e43('0x3'),_0x8e43('0x4'),'customVariable','keyValue',_0x8e43('0x5')),'defaultValue':_0x8e43('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8e43('0x6')]},'keyType':{'type':Sequelize[_0x8e43('0x2')]('string','variable',_0x8e43('0x7'))},'keyContent':{'type':Sequelize[_0x8e43('0x6')]},'idField':{'type':Sequelize[_0x8e43('0x6')]},'nameField':{'type':Sequelize[_0x8e43('0x6')]},'customField':{'type':Sequelize[_0x8e43('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1440=['picklist','STRING','exports','ENUM','string','customVariable'];(function(_0x3b7aa8,_0x3b3728){var _0x258bd2=function(_0x5e1a4b){while(--_0x5e1a4b){_0x3b7aa8['push'](_0x3b7aa8['shift']());}};_0x258bd2(++_0x3b3728);}(_0x1440,0x12e));var _0x0144=function(_0x31e878,_0x206e87){_0x31e878=_0x31e878-0x0;var _0x5e7ea5=_0x1440[_0x31e878];return _0x5e7ea5;};'use strict';var Sequelize=require('sequelize');module[_0x0144('0x0')]={'type':{'type':Sequelize[_0x0144('0x1')](_0x0144('0x2'),'variable',_0x0144('0x3'),'keyValue',_0x0144('0x4')),'defaultValue':_0x0144('0x2')},'content':{'type':Sequelize[_0x0144('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0144('0x1')](_0x0144('0x2'),'variable',_0x0144('0x3'))},'keyContent':{'type':Sequelize[_0x0144('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0144('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0144('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1c698b0..22237b8 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 _0x34ec=['../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','index','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','merge','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0x3f371b,_0x33c074){var _0x126d77=function(_0x186b66){while(--_0x186b66){_0x3f371b['push'](_0x3f371b['shift']());}};_0x126d77(++_0x33c074);}(_0x34ec,0x1f4));var _0xc34e=function(_0x4090ba,_0x15e1da){_0x4090ba=_0x4090ba-0x0;var _0x267e30=_0x34ec[_0x4090ba];return _0x267e30;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc34e('0x0'));var jsonpatch=require(_0xc34e('0x1'));var rp=require(_0xc34e('0x2'));var moment=require(_0xc34e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc34e('0x4'));var path=require(_0xc34e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc34e('0x6'));var fs=require('fs');var fs_extra=require(_0xc34e('0x7'));var _=require(_0xc34e('0x8'));var squel=require('squel');var crypto=require(_0xc34e('0x9'));var jsforce=require(_0xc34e('0xa'));var deskjs=require(_0xc34e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc34e('0xc'));var Papa=require(_0xc34e('0xd'));var Redis=require(_0xc34e('0xe'));var authService=require(_0xc34e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc34e('0x10'));var logger=require('../../config/logger')(_0xc34e('0x11'));var utils=require('../../config/utils');var config=require(_0xc34e('0x12'));var licenseUtil=require(_0xc34e('0x13'));var db=require(_0xc34e('0x14'))['db'];function respondWithStatusCode(_0xb73817,_0x45ec78){_0x45ec78=_0x45ec78||0xcc;return function(_0x3cc95a){if(_0x3cc95a){return _0xb73817['sendStatus'](_0x45ec78);}return _0xb73817['status'](_0x45ec78)['end']();};}function respondWithResult(_0x502c07,_0x54baa5){_0x54baa5=_0x54baa5||0xc8;return function(_0x264743){if(_0x264743){return _0x502c07[_0xc34e('0x15')](_0x54baa5)[_0xc34e('0x16')](_0x264743);}};}function respondWithFilteredResult(_0x5966a9,_0x318120){return function(_0x50bff9){if(_0x50bff9){var _0x287691=typeof _0x318120[_0xc34e('0x17')]===_0xc34e('0x18')&&typeof _0x318120[_0xc34e('0x19')]==='undefined';var _0x100d73=_0x50bff9[_0xc34e('0x1a')];var _0x3bd5e4=_0x287691?0x0:_0x318120[_0xc34e('0x17')];var _0x244e61=_0x287691?_0x50bff9[_0xc34e('0x1a')]:_0x318120['offset']+_0x318120[_0xc34e('0x19')];var _0x188d6e;if(_0x244e61>=_0x100d73){_0x244e61=_0x100d73;_0x188d6e=0xc8;}else{_0x188d6e=0xce;}_0x5966a9['status'](_0x188d6e);return _0x5966a9[_0xc34e('0x1b')](_0xc34e('0x1c'),_0x3bd5e4+'-'+_0x244e61+'/'+_0x100d73)[_0xc34e('0x16')](_0x50bff9);}return null;};}function patchUpdates(_0x1fdc98){return function(_0x1f2b7c){try{jsonpatch[_0xc34e('0x1d')](_0x1f2b7c,_0x1fdc98,!![]);}catch(_0x2283ba){return BPromise[_0xc34e('0x1e')](_0x2283ba);}return _0x1f2b7c[_0xc34e('0x1f')]();};}function saveUpdates(_0xc98617,_0x1158e2){return function(_0x2a54af){if(_0x2a54af){return _0x2a54af[_0xc34e('0x20')](_0xc98617)['then'](function(_0x3a06d5){return _0x3a06d5;});}return null;};}function removeEntity(_0x30a83a,_0xb1418e){return function(_0x5adcbc){if(_0x5adcbc){return _0x5adcbc[_0xc34e('0x21')]()[_0xc34e('0x22')](function(){_0x30a83a[_0xc34e('0x15')](0xcc)[_0xc34e('0x23')]();});}};}function handleEntityNotFound(_0x289367,_0x26fdcd){return function(_0x19e842){if(!_0x19e842){_0x289367['sendStatus'](0x194);}return _0x19e842;};}function handleError(_0x23b02d,_0x28102e){_0x28102e=_0x28102e||0x1f4;return function(_0x53513f){logger[_0xc34e('0x24')](_0x53513f['stack']);if(_0x53513f[_0xc34e('0x25')]){delete _0x53513f['name'];}_0x23b02d[_0xc34e('0x15')](_0x28102e)[_0xc34e('0x26')](_0x53513f);};}exports[_0xc34e('0x27')]=function(_0x14a288,_0x187eb9){var _0x4400bf={},_0x7b74d4={},_0x13f737={'count':0x0,'rows':[]};var _0x137d83=_['map'](db[_0xc34e('0x28')][_0xc34e('0x29')],function(_0x235f00){return{'name':_0x235f00[_0xc34e('0x2a')],'type':_0x235f00[_0xc34e('0x2b')][_0xc34e('0x2c')]};});_0x7b74d4[_0xc34e('0x2d')]=_['map'](_0x137d83,_0xc34e('0x25'));_0x7b74d4[_0xc34e('0x2e')]=_[_0xc34e('0x2f')](_0x14a288[_0xc34e('0x2e')]);_0x7b74d4[_0xc34e('0x30')]=_[_0xc34e('0x31')](_0x7b74d4[_0xc34e('0x2d')],_0x7b74d4[_0xc34e('0x2e')]);_0x4400bf[_0xc34e('0x32')]=_[_0xc34e('0x31')](_0x7b74d4[_0xc34e('0x2d')],qs['fields'](_0x14a288[_0xc34e('0x2e')][_0xc34e('0x33')]));_0x4400bf[_0xc34e('0x32')]=_0x4400bf[_0xc34e('0x32')][_0xc34e('0x34')]?_0x4400bf[_0xc34e('0x32')]:_0x7b74d4[_0xc34e('0x2d')];if(!_0x14a288['query'][_0xc34e('0x35')](_0xc34e('0x36'))){_0x4400bf[_0xc34e('0x19')]=qs['limit'](_0x14a288[_0xc34e('0x2e')]['limit']);_0x4400bf[_0xc34e('0x17')]=qs['offset'](_0x14a288[_0xc34e('0x2e')][_0xc34e('0x17')]);}_0x4400bf[_0xc34e('0x37')]=qs[_0xc34e('0x38')](_0x14a288[_0xc34e('0x2e')]['sort']);_0x4400bf[_0xc34e('0x39')]=qs['filters'](_[_0xc34e('0x3a')](_0x14a288['query'],_0x7b74d4[_0xc34e('0x30')]),_0x137d83);if(_0x14a288[_0xc34e('0x2e')][_0xc34e('0x3b')]){_0x4400bf[_0xc34e('0x39')]=_['merge'](_0x4400bf[_0xc34e('0x39')],{'$or':_[_0xc34e('0x3c')](_0x137d83,function(_0x22d499){if(_0x22d499[_0xc34e('0x2b')]!==_0xc34e('0x3d')){var _0x1570e1={};_0x1570e1[_0x22d499[_0xc34e('0x25')]]={'$like':'%'+_0x14a288['query'][_0xc34e('0x3b')]+'%'};return _0x1570e1;}})});}_0x4400bf=_['merge']({},_0x4400bf,_0x14a288[_0xc34e('0x3e')]);var _0x5b937e={'where':_0x4400bf[_0xc34e('0x39')]};return db['DeskField'][_0xc34e('0x1a')](_0x5b937e)[_0xc34e('0x22')](function(_0x3178f0){_0x13f737[_0xc34e('0x1a')]=_0x3178f0;if(_0x14a288['query'][_0xc34e('0x3f')]){_0x4400bf['include']=[{'all':!![]}];}return db[_0xc34e('0x28')][_0xc34e('0x40')](_0x4400bf);})['then'](function(_0x4530c4){_0x13f737[_0xc34e('0x41')]=_0x4530c4;return _0x13f737;})['then'](respondWithFilteredResult(_0x187eb9,_0x4400bf))[_0xc34e('0x42')](handleError(_0x187eb9,null));};exports[_0xc34e('0x43')]=function(_0x53d6b6,_0x2f8eb6){var _0x23f134={'raw':!![],'where':{'id':_0x53d6b6['params']['id']}},_0x4ff093={};_0x4ff093[_0xc34e('0x2d')]=_[_0xc34e('0x2f')](db['DeskField'][_0xc34e('0x29')]);_0x4ff093[_0xc34e('0x2e')]=_[_0xc34e('0x2f')](_0x53d6b6[_0xc34e('0x2e')]);_0x4ff093[_0xc34e('0x30')]=_[_0xc34e('0x31')](_0x4ff093['model'],_0x4ff093[_0xc34e('0x2e')]);_0x23f134[_0xc34e('0x32')]=_['intersection'](_0x4ff093[_0xc34e('0x2d')],qs[_0xc34e('0x33')](_0x53d6b6[_0xc34e('0x2e')][_0xc34e('0x33')]));_0x23f134['attributes']=_0x23f134[_0xc34e('0x32')][_0xc34e('0x34')]?_0x23f134['attributes']:_0x4ff093['model'];if(_0x53d6b6['query'][_0xc34e('0x3f')]){_0x23f134[_0xc34e('0x44')]=[{'all':!![]}];}_0x23f134=_[_0xc34e('0x45')]({},_0x23f134,_0x53d6b6[_0xc34e('0x3e')]);return db[_0xc34e('0x28')][_0xc34e('0x46')](_0x23f134)['then'](handleEntityNotFound(_0x2f8eb6,null))[_0xc34e('0x22')](respondWithResult(_0x2f8eb6,null))[_0xc34e('0x42')](handleError(_0x2f8eb6,null));};exports[_0xc34e('0x47')]=function(_0x470277,_0x297841){return db[_0xc34e('0x28')][_0xc34e('0x47')](_0x470277[_0xc34e('0x48')],{})[_0xc34e('0x22')](respondWithResult(_0x297841,0xc9))[_0xc34e('0x42')](handleError(_0x297841,null));};exports[_0xc34e('0x20')]=function(_0x2fc71d,_0xe6fb43){if(_0x2fc71d['body']['id']){delete _0x2fc71d[_0xc34e('0x48')]['id'];}return db[_0xc34e('0x28')][_0xc34e('0x46')]({'where':{'id':_0x2fc71d[_0xc34e('0x49')]['id']}})[_0xc34e('0x22')](handleEntityNotFound(_0xe6fb43,null))[_0xc34e('0x22')](saveUpdates(_0x2fc71d[_0xc34e('0x48')],null))[_0xc34e('0x22')](respondWithResult(_0xe6fb43,null))[_0xc34e('0x42')](handleError(_0xe6fb43,null));};exports[_0xc34e('0x21')]=function(_0x2947bd,_0x37e97b){return db['DeskField'][_0xc34e('0x46')]({'where':{'id':_0x2947bd['params']['id']}})[_0xc34e('0x22')](handleEntityNotFound(_0x37e97b,null))[_0xc34e('0x22')](removeEntity(_0x37e97b,null))[_0xc34e('0x42')](handleError(_0x37e97b,null));}; \ No newline at end of file +var _0x16a6=['desk.js','querystring','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','offset','undefined','count','limit','set','reject','update','then','destroy','error','stack','name','send','index','map','DeskField','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel'];(function(_0x1427f8,_0x417f31){var _0x30a432=function(_0x1c5037){while(--_0x1c5037){_0x1427f8['push'](_0x1427f8['shift']());}};_0x30a432(++_0x417f31);}(_0x16a6,0x15c));var _0x616a=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x16a6[_0x26b80e];return _0x84a8a8;};'use strict';var emlformat=require(_0x616a('0x0'));var rimraf=require(_0x616a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x616a('0x2'));var rp=require(_0x616a('0x3'));var moment=require(_0x616a('0x4'));var BPromise=require(_0x616a('0x5'));var Mustache=require(_0x616a('0x6'));var util=require(_0x616a('0x7'));var path=require('path');var sox=require(_0x616a('0x8'));var csv=require(_0x616a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x616a('0xa'));var squel=require(_0x616a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x616a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x616a('0xd'));var Papa=require('papaparse');var Redis=require(_0x616a('0xe'));var authService=require(_0x616a('0xf'));var qs=require(_0x616a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x616a('0x11'));var logger=require(_0x616a('0x12'))(_0x616a('0x13'));var utils=require(_0x616a('0x14'));var config=require(_0x616a('0x15'));var licenseUtil=require(_0x616a('0x16'));var db=require(_0x616a('0x17'))['db'];function respondWithStatusCode(_0x4122b7,_0x5755c7){_0x5755c7=_0x5755c7||0xcc;return function(_0x318dfe){if(_0x318dfe){return _0x4122b7[_0x616a('0x18')](_0x5755c7);}return _0x4122b7[_0x616a('0x19')](_0x5755c7)[_0x616a('0x1a')]();};}function respondWithResult(_0x295fc2,_0x4a33d5){_0x4a33d5=_0x4a33d5||0xc8;return function(_0x1399c1){if(_0x1399c1){return _0x295fc2[_0x616a('0x19')](_0x4a33d5)[_0x616a('0x1b')](_0x1399c1);}};}function respondWithFilteredResult(_0x18b6dc,_0x3bcf20){return function(_0x53f228){if(_0x53f228){var _0x204e68=typeof _0x3bcf20[_0x616a('0x1c')]==='undefined'&&typeof _0x3bcf20['limit']===_0x616a('0x1d');var _0x4768b2=_0x53f228[_0x616a('0x1e')];var _0x4d59e7=_0x204e68?0x0:_0x3bcf20[_0x616a('0x1c')];var _0x1f3241=_0x204e68?_0x53f228['count']:_0x3bcf20['offset']+_0x3bcf20[_0x616a('0x1f')];var _0x27e95c;if(_0x1f3241>=_0x4768b2){_0x1f3241=_0x4768b2;_0x27e95c=0xc8;}else{_0x27e95c=0xce;}_0x18b6dc[_0x616a('0x19')](_0x27e95c);return _0x18b6dc[_0x616a('0x20')]('Content-Range',_0x4d59e7+'-'+_0x1f3241+'/'+_0x4768b2)['json'](_0x53f228);}return null;};}function patchUpdates(_0x5568fd){return function(_0x5f2e80){try{jsonpatch['apply'](_0x5f2e80,_0x5568fd,!![]);}catch(_0x5ee3f2){return BPromise[_0x616a('0x21')](_0x5ee3f2);}return _0x5f2e80['save']();};}function saveUpdates(_0xb8ceeb,_0x137974){return function(_0x4f5594){if(_0x4f5594){return _0x4f5594[_0x616a('0x22')](_0xb8ceeb)[_0x616a('0x23')](function(_0x3d484b){return _0x3d484b;});}return null;};}function removeEntity(_0x100c98,_0x500c22){return function(_0x2db2bb){if(_0x2db2bb){return _0x2db2bb[_0x616a('0x24')]()[_0x616a('0x23')](function(){_0x100c98[_0x616a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e11f2,_0x4be8a8){return function(_0x30c1a){if(!_0x30c1a){_0x3e11f2[_0x616a('0x18')](0x194);}return _0x30c1a;};}function handleError(_0x5f1e6a,_0x55abc8){_0x55abc8=_0x55abc8||0x1f4;return function(_0x50c6b8){logger[_0x616a('0x25')](_0x50c6b8[_0x616a('0x26')]);if(_0x50c6b8[_0x616a('0x27')]){delete _0x50c6b8[_0x616a('0x27')];}_0x5f1e6a['status'](_0x55abc8)[_0x616a('0x28')](_0x50c6b8);};}exports[_0x616a('0x29')]=function(_0x195b73,_0x163fd0){var _0x28ca50={},_0x87db00={},_0x41a22d={'count':0x0,'rows':[]};var _0x5f3a59=_[_0x616a('0x2a')](db[_0x616a('0x2b')]['rawAttributes'],function(_0x41f722){return{'name':_0x41f722['fieldName'],'type':_0x41f722['type'][_0x616a('0x2c')]};});_0x87db00[_0x616a('0x2d')]=_[_0x616a('0x2a')](_0x5f3a59,'name');_0x87db00[_0x616a('0x2e')]=_[_0x616a('0x2f')](_0x195b73[_0x616a('0x2e')]);_0x87db00[_0x616a('0x30')]=_[_0x616a('0x31')](_0x87db00[_0x616a('0x2d')],_0x87db00['query']);_0x28ca50[_0x616a('0x32')]=_['intersection'](_0x87db00[_0x616a('0x2d')],qs[_0x616a('0x33')](_0x195b73[_0x616a('0x2e')]['fields']));_0x28ca50[_0x616a('0x32')]=_0x28ca50[_0x616a('0x32')]['length']?_0x28ca50['attributes']:_0x87db00[_0x616a('0x2d')];if(!_0x195b73[_0x616a('0x2e')][_0x616a('0x34')](_0x616a('0x35'))){_0x28ca50['limit']=qs['limit'](_0x195b73['query'][_0x616a('0x1f')]);_0x28ca50[_0x616a('0x1c')]=qs[_0x616a('0x1c')](_0x195b73[_0x616a('0x2e')][_0x616a('0x1c')]);}_0x28ca50[_0x616a('0x36')]=qs[_0x616a('0x37')](_0x195b73[_0x616a('0x2e')][_0x616a('0x37')]);_0x28ca50[_0x616a('0x38')]=qs['filters'](_[_0x616a('0x39')](_0x195b73['query'],_0x87db00[_0x616a('0x30')]),_0x5f3a59);if(_0x195b73[_0x616a('0x2e')][_0x616a('0x3a')]){_0x28ca50[_0x616a('0x38')]=_[_0x616a('0x3b')](_0x28ca50[_0x616a('0x38')],{'$or':_[_0x616a('0x2a')](_0x5f3a59,function(_0x220c32){if(_0x220c32[_0x616a('0x3c')]!=='VIRTUAL'){var _0x304e27={};_0x304e27[_0x220c32[_0x616a('0x27')]]={'$like':'%'+_0x195b73[_0x616a('0x2e')][_0x616a('0x3a')]+'%'};return _0x304e27;}})});}_0x28ca50=_['merge']({},_0x28ca50,_0x195b73[_0x616a('0x3d')]);var _0x4c6a76={'where':_0x28ca50[_0x616a('0x38')]};return db['DeskField'][_0x616a('0x1e')](_0x4c6a76)[_0x616a('0x23')](function(_0x598085){_0x41a22d[_0x616a('0x1e')]=_0x598085;if(_0x195b73['query'][_0x616a('0x3e')]){_0x28ca50[_0x616a('0x3f')]=[{'all':!![]}];}return db[_0x616a('0x2b')][_0x616a('0x40')](_0x28ca50);})[_0x616a('0x23')](function(_0x21fd2b){_0x41a22d[_0x616a('0x41')]=_0x21fd2b;return _0x41a22d;})['then'](respondWithFilteredResult(_0x163fd0,_0x28ca50))[_0x616a('0x42')](handleError(_0x163fd0,null));};exports['show']=function(_0x409689,_0x35e3e3){var _0x199140={'raw':!![],'where':{'id':_0x409689[_0x616a('0x43')]['id']}},_0x4dbb8b={};_0x4dbb8b[_0x616a('0x2d')]=_[_0x616a('0x2f')](db[_0x616a('0x2b')][_0x616a('0x44')]);_0x4dbb8b['query']=_[_0x616a('0x2f')](_0x409689[_0x616a('0x2e')]);_0x4dbb8b[_0x616a('0x30')]=_['intersection'](_0x4dbb8b[_0x616a('0x2d')],_0x4dbb8b[_0x616a('0x2e')]);_0x199140[_0x616a('0x32')]=_[_0x616a('0x31')](_0x4dbb8b[_0x616a('0x2d')],qs[_0x616a('0x33')](_0x409689[_0x616a('0x2e')]['fields']));_0x199140[_0x616a('0x32')]=_0x199140[_0x616a('0x32')]['length']?_0x199140['attributes']:_0x4dbb8b[_0x616a('0x2d')];if(_0x409689[_0x616a('0x2e')][_0x616a('0x3e')]){_0x199140[_0x616a('0x3f')]=[{'all':!![]}];}_0x199140=_[_0x616a('0x3b')]({},_0x199140,_0x409689[_0x616a('0x3d')]);return db['DeskField'][_0x616a('0x45')](_0x199140)[_0x616a('0x23')](handleEntityNotFound(_0x35e3e3,null))[_0x616a('0x23')](respondWithResult(_0x35e3e3,null))['catch'](handleError(_0x35e3e3,null));};exports[_0x616a('0x46')]=function(_0x507efa,_0x52d38){return db[_0x616a('0x2b')][_0x616a('0x46')](_0x507efa[_0x616a('0x47')],{})['then'](respondWithResult(_0x52d38,0xc9))[_0x616a('0x42')](handleError(_0x52d38,null));};exports[_0x616a('0x22')]=function(_0x3bea90,_0x3d42fc){if(_0x3bea90[_0x616a('0x47')]['id']){delete _0x3bea90['body']['id'];}return db[_0x616a('0x2b')][_0x616a('0x45')]({'where':{'id':_0x3bea90[_0x616a('0x43')]['id']}})[_0x616a('0x23')](handleEntityNotFound(_0x3d42fc,null))[_0x616a('0x23')](saveUpdates(_0x3bea90[_0x616a('0x47')],null))['then'](respondWithResult(_0x3d42fc,null))[_0x616a('0x42')](handleError(_0x3d42fc,null));};exports[_0x616a('0x24')]=function(_0x349cd0,_0x16e6c2){return db['DeskField'][_0x616a('0x45')]({'where':{'id':_0x349cd0['params']['id']}})[_0x616a('0x23')](handleEntityNotFound(_0x16e6c2,null))[_0x616a('0x23')](removeEntity(_0x16e6c2,null))['catch'](handleError(_0x16e6c2,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 1a4f995..1c33399 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 _0xf77c=['api','moment','bluebird','path','rimraf','./intDeskField.attributes','define','DeskField','int_desk_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x2e46a7,_0x5ae2e4){var _0x41d1cf=function(_0x5baded){while(--_0x5baded){_0x2e46a7['push'](_0x2e46a7['shift']());}};_0x41d1cf(++_0x5ae2e4);}(_0xf77c,0x123));var _0xcf77=function(_0x364e2b,_0x30b028){_0x364e2b=_0x364e2b-0x0;var _0x943fef=_0xf77c[_0x364e2b];return _0x943fef;};'use strict';var _=require(_0xcf77('0x0'));var util=require(_0xcf77('0x1'));var logger=require(_0xcf77('0x2'))(_0xcf77('0x3'));var moment=require(_0xcf77('0x4'));var BPromise=require(_0xcf77('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf77('0x6'));var rimraf=require(_0xcf77('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf77('0x8'));module['exports']=function(_0x119872,_0x2bd273){return _0x119872[_0xcf77('0x9')](_0xcf77('0xa'),attributes,{'tableName':_0xcf77('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xcf77('0xc'),_0xcf77('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70ca=['path','rimraf','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x70ca,0x6a));var _0xa70c=function(_0x376ef9,_0xe35335){_0x376ef9=_0x376ef9-0x0;var _0x33fcaa=_0x70ca[_0x376ef9];return _0x33fcaa;};'use strict';var _=require(_0xa70c('0x0'));var util=require(_0xa70c('0x1'));var logger=require(_0xa70c('0x2'))(_0xa70c('0x3'));var moment=require(_0xa70c('0x4'));var BPromise=require(_0xa70c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa70c('0x6'));var rimraf=require(_0xa70c('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xa70c('0x8')]=function(_0x38c31c,_0x24004c){return _0x38c31c[_0xa70c('0x9')](_0xa70c('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xa70c('0xb'),'fields':[_0xa70c('0xc'),_0xa70c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index bdcd60b..df41317 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 _0x7266=['error','code','DeskField,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x320243,_0x55038d){var _0x1c9c6a=function(_0x209e5e){while(--_0x209e5e){_0x320243['push'](_0x320243['shift']());}};_0x1c9c6a(++_0x55038d);}(_0x7266,0x1e5));var _0x6726=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7266[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x6726('0x0'));var util=require(_0x6726('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6726('0x2'));var fs=require('fs');var Redis=require(_0x6726('0x3'));var db=require(_0x6726('0x4'))['db'];var utils=require(_0x6726('0x5'));var logger=require(_0x6726('0x6'))(_0x6726('0x7'));var config=require(_0x6726('0x8'));var jayson=require(_0x6726('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x484408,_0x1de27f,_0xc2cee){return new BPromise(function(_0x31e03b,_0x5d6470){return client[_0x6726('0xa')](_0x484408,_0xc2cee)['then'](function(_0x2ff900){logger[_0x6726('0xb')]('DeskField,\x20%s,\x20%s',_0x1de27f,_0x6726('0xc'));logger['debug'](_0x6726('0xd'),_0x1de27f,_0x6726('0xc'),JSON[_0x6726('0xe')](_0x2ff900));if(_0x2ff900['error']){if(_0x2ff900[_0x6726('0xf')][_0x6726('0x10')]===0x1f4){logger['error'](_0x6726('0x11'),_0x1de27f,_0x2ff900[_0x6726('0xf')]['message']);return _0x5d6470(_0x2ff900[_0x6726('0xf')][_0x6726('0x12')]);}logger[_0x6726('0xf')](_0x6726('0x11'),_0x1de27f,_0x2ff900['error'][_0x6726('0x12')]);return _0x31e03b(_0x2ff900[_0x6726('0xf')]['message']);}else{logger[_0x6726('0xb')]('DeskField,\x20%s,\x20%s',_0x1de27f,_0x6726('0xc'));_0x31e03b(_0x2ff900[_0x6726('0x13')][_0x6726('0x12')]);}})['catch'](function(_0x35b212){logger[_0x6726('0xf')](_0x6726('0x11'),_0x1de27f,_0x35b212);_0x5d6470(_0x35b212);});});} \ No newline at end of file +var _0xdc26=['client','http','info','DeskField,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0xdc26,0x1dd));var _0x6dc2=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0xdc26[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0x6dc2('0x0'));var util=require(_0x6dc2('0x1'));var moment=require(_0x6dc2('0x2'));var BPromise=require(_0x6dc2('0x3'));var rs=require(_0x6dc2('0x4'));var fs=require('fs');var Redis=require(_0x6dc2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6dc2('0x6'));var logger=require(_0x6dc2('0x7'))(_0x6dc2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6dc2('0x9')][_0x6dc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bb95c,_0x50b638,_0x4eaffa){return new BPromise(function(_0x4a82b0,_0x20ab05){return client['request'](_0x3bb95c,_0x4eaffa)['then'](function(_0x42cf57){logger[_0x6dc2('0xb')](_0x6dc2('0xc'),_0x50b638,'request\x20sent');logger[_0x6dc2('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x50b638,_0x6dc2('0xe'),JSON['stringify'](_0x42cf57));if(_0x42cf57[_0x6dc2('0xf')]){if(_0x42cf57[_0x6dc2('0xf')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x50b638,_0x42cf57['error'][_0x6dc2('0x10')]);return _0x20ab05(_0x42cf57[_0x6dc2('0xf')][_0x6dc2('0x10')]);}logger[_0x6dc2('0xf')]('DeskField,\x20%s,\x20%s',_0x50b638,_0x42cf57[_0x6dc2('0xf')][_0x6dc2('0x10')]);return _0x4a82b0(_0x42cf57['error'][_0x6dc2('0x10')]);}else{logger['info'](_0x6dc2('0xc'),_0x50b638,_0x6dc2('0xe'));_0x4a82b0(_0x42cf57['result']['message']);}})[_0x6dc2('0x11')](function(_0x492024){logger[_0x6dc2('0xf')]('DeskField,\x20%s,\x20%s',_0x50b638,_0x492024);_0x20ab05(_0x492024);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ba7384e..7605301 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 _0x2cd5=['../../config/environment','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x2cd5,0x74));var _0x52cd=function(_0xfc2678,_0x2cf5b3){_0xfc2678=_0xfc2678-0x0;var _0x464846=_0x2cd5[_0xfc2678];return _0x464846;};'use strict';var multer=require(_0x52cd('0x0'));var util=require(_0x52cd('0x1'));var path=require(_0x52cd('0x2'));var timeout=require(_0x52cd('0x3'));var express=require(_0x52cd('0x4'));var router=express[_0x52cd('0x5')]();var fs_extra=require(_0x52cd('0x6'));var auth=require(_0x52cd('0x7'));var interaction=require(_0x52cd('0x8'));var config=require(_0x52cd('0x9'));var controller=require(_0x52cd('0xa'));router[_0x52cd('0xb')]('/',auth['isAuthenticated'](),controller[_0x52cd('0xc')]);router['get'](_0x52cd('0xd'),auth[_0x52cd('0xe')](),controller['show']);router[_0x52cd('0xb')]('/:id/configurations',auth[_0x52cd('0xe')](),controller['getConfigurations']);router[_0x52cd('0xb')](_0x52cd('0xf'),auth[_0x52cd('0xe')](),controller[_0x52cd('0x10')]);router[_0x52cd('0x11')]('/',auth[_0x52cd('0xe')](),controller[_0x52cd('0x12')]);router[_0x52cd('0x11')](_0x52cd('0x13'),auth['isAuthenticated'](),controller[_0x52cd('0x14')]);router[_0x52cd('0x15')](_0x52cd('0xd'),auth['isAuthenticated'](),controller[_0x52cd('0x16')]);router[_0x52cd('0x17')](_0x52cd('0xd'),auth[_0x52cd('0xe')](),controller[_0x52cd('0x18')]);module['exports']=router; \ No newline at end of file +var _0x4861=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete'];(function(_0x40bcc2,_0x124a63){var _0x346747=function(_0x1521c9){while(--_0x1521c9){_0x40bcc2['push'](_0x40bcc2['shift']());}};_0x346747(++_0x124a63);}(_0x4861,0x105));var _0x1486=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4861[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x1486('0x0'));var util=require(_0x1486('0x1'));var path=require(_0x1486('0x2'));var timeout=require(_0x1486('0x3'));var express=require(_0x1486('0x4'));var router=express[_0x1486('0x5')]();var fs_extra=require(_0x1486('0x6'));var auth=require(_0x1486('0x7'));var interaction=require(_0x1486('0x8'));var config=require(_0x1486('0x9'));var controller=require(_0x1486('0xa'));router[_0x1486('0xb')]('/',auth[_0x1486('0xc')](),controller[_0x1486('0xd')]);router[_0x1486('0xb')](_0x1486('0xe'),auth[_0x1486('0xc')](),controller[_0x1486('0xf')]);router[_0x1486('0xb')](_0x1486('0x10'),auth[_0x1486('0xc')](),controller[_0x1486('0x11')]);router[_0x1486('0xb')](_0x1486('0x12'),auth[_0x1486('0xc')](),controller['getFields']);router[_0x1486('0x13')]('/',auth[_0x1486('0xc')](),controller[_0x1486('0x14')]);router[_0x1486('0x13')](_0x1486('0x10'),auth['isAuthenticated'](),controller[_0x1486('0x15')]);router[_0x1486('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x1486('0x17')]);router[_0x1486('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x1486('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 27f7a93..57ce296 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 _0xdb8b=['STRING','BOOLEAN','exports'];(function(_0x1ac6ec,_0x1f81fc){var _0x48a489=function(_0xf38b04){while(--_0xf38b04){_0x1ac6ec['push'](_0x1ac6ec['shift']());}};_0x48a489(++_0x1f81fc);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x4db3c3,_0x22544e){_0x4db3c3=_0x4db3c3-0x0;var _0x4cff35=_0xdb8b[_0x4db3c3];return _0x4cff35;};'use strict';var Sequelize=require('sequelize');module[_0xbdb8('0x0')]={'name':{'type':Sequelize[_0xbdb8('0x1')]},'username':{'type':Sequelize[_0xbdb8('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xbdb8('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xbdb8('0x1')]},'serverUrl':{'type':Sequelize[_0xbdb8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xbdb8('0x1')]},'modernAuthentication':{'type':Sequelize[_0xbdb8('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd45e=['STRING','BOOLEAN','exports'];(function(_0x3db5e2,_0x52044d){var _0x27fa71=function(_0x22a98c){while(--_0x22a98c){_0x3db5e2['push'](_0x3db5e2['shift']());}};_0x27fa71(++_0x52044d);}(_0xd45e,0x182));var _0xed45=function(_0x19f716,_0x498681){_0x19f716=_0x19f716-0x0;var _0xfaa946=_0xd45e[_0x19f716];return _0xfaa946;};'use strict';var Sequelize=require('sequelize');module[_0xed45('0x0')]={'name':{'type':Sequelize[_0xed45('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xed45('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xed45('0x1')]},'clientId':{'type':Sequelize[_0xed45('0x1')]},'clientSecret':{'type':Sequelize[_0xed45('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xed45('0x1')]},'modernAuthentication':{'type':Sequelize[_0xed45('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 700f97a..9edd9cd 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 _0x4dc5=['type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','then','includeAll','include','findAll','rows','catch','params','merge','find','create','body','findOne','Dynamics365Configuration','getConfigurations','hasOwnProperty','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','substring','lastIndexOf','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','concat','username','remoteUri','clientId','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','tenantId','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes'];(function(_0x60b354,_0x35c4da){var _0xbcc036=function(_0xcb3cc4){while(--_0xcb3cc4){_0x60b354['push'](_0x60b354['shift']());}};_0xbcc036(++_0x35c4da);}(_0x4dc5,0x96));var _0x54dc=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x4dc5[_0x819464];return _0x49dcc0;};'use strict';var rp=require('request-promise');var util=require(_0x54dc('0x0'));var _=require(_0x54dc('0x1'));var qs=require(_0x54dc('0x2'));var logger=require(_0x54dc('0x3'))(_0x54dc('0x4'));var db=require(_0x54dc('0x5'))['db'];var integrations=require(_0x54dc('0x6'));function respondWithResult(_0x1fe977,_0x122bbc){_0x122bbc=_0x122bbc||0xc8;return function(_0x16782c){if(_0x16782c){return _0x1fe977[_0x54dc('0x7')](_0x122bbc)[_0x54dc('0x8')](_0x16782c);}};}function respondWithFilteredResult(_0x3d625f,_0x214f21){return function(_0x391dc6){if(_0x391dc6){var _0x208b8d=typeof _0x214f21[_0x54dc('0x9')]==='undefined'&&typeof _0x214f21[_0x54dc('0xa')]===_0x54dc('0xb');var _0x68da32=_0x391dc6[_0x54dc('0xc')];var _0x26b585=_0x208b8d?0x0:_0x214f21[_0x54dc('0x9')];var _0x2c3a85=_0x208b8d?_0x391dc6[_0x54dc('0xc')]:_0x214f21['offset']+_0x214f21[_0x54dc('0xa')];var _0x43b78a;if(_0x2c3a85>=_0x68da32){_0x2c3a85=_0x68da32;_0x43b78a=0xc8;}else{_0x43b78a=0xce;}_0x3d625f[_0x54dc('0x7')](_0x43b78a);return _0x3d625f[_0x54dc('0xd')](_0x54dc('0xe'),_0x26b585+'-'+_0x2c3a85+'/'+_0x68da32)['json'](_0x391dc6);}return null;};}function saveUpdates(_0x4257c2){return function(_0x47b0ae){if(_0x47b0ae){return _0x47b0ae[_0x54dc('0xf')](_0x4257c2)['then'](function(_0x1222e2){return _0x1222e2;});}return null;};}function removeEntity(_0x55c5f9){return function(_0x30af19){if(_0x30af19){return _0x30af19[_0x54dc('0x10')]()['then'](function(){_0x55c5f9['status'](0xcc)[_0x54dc('0x11')]();});}};}function handleEntityNotFound(_0x401098){return function(_0x1a46e9){if(!_0x1a46e9){_0x401098[_0x54dc('0x12')](0x194);}return _0x1a46e9;};}function handleError(_0x13010a,_0x2e22ce){_0x2e22ce=_0x2e22ce||0x1f4;return function(_0x3a2387){logger[_0x54dc('0x13')](_0x3a2387[_0x54dc('0x14')]);if(_0x3a2387[_0x54dc('0x15')]){delete _0x3a2387[_0x54dc('0x15')];}_0x13010a[_0x54dc('0x7')](_0x2e22ce)[_0x54dc('0x16')](_0x3a2387);};}exports[_0x54dc('0x17')]=function(_0x1b082f,_0x56313c){var _0x1723aa={},_0x3721d8={},_0x2d3947={'count':0x0,'rows':[]};var _0x19b7bc=_[_0x54dc('0x18')](db[_0x54dc('0x19')][_0x54dc('0x1a')],function(_0xf2045c){return{'name':_0xf2045c['fieldName'],'type':_0xf2045c[_0x54dc('0x1b')][_0x54dc('0x1c')]};});_0x3721d8[_0x54dc('0x1d')]=_[_0x54dc('0x18')](_0x19b7bc,_0x54dc('0x15'));_0x3721d8[_0x54dc('0x1e')]=_[_0x54dc('0x1f')](_0x1b082f[_0x54dc('0x1e')]);_0x3721d8[_0x54dc('0x20')]=_['intersection'](_0x3721d8[_0x54dc('0x1d')],_0x3721d8['query']);_0x1723aa[_0x54dc('0x21')]=_[_0x54dc('0x22')](_0x3721d8[_0x54dc('0x1d')],qs[_0x54dc('0x23')](_0x1b082f[_0x54dc('0x1e')][_0x54dc('0x23')]));_0x1723aa[_0x54dc('0x21')]=_0x1723aa['attributes'][_0x54dc('0x24')]?_0x1723aa[_0x54dc('0x21')]:_0x3721d8[_0x54dc('0x1d')];if(!_0x1b082f[_0x54dc('0x1e')]['hasOwnProperty'](_0x54dc('0x25'))){_0x1723aa[_0x54dc('0xa')]=qs[_0x54dc('0xa')](_0x1b082f[_0x54dc('0x1e')]['limit']);_0x1723aa[_0x54dc('0x9')]=qs[_0x54dc('0x9')](_0x1b082f['query'][_0x54dc('0x9')]);}_0x1723aa[_0x54dc('0x26')]=qs[_0x54dc('0x27')](_0x1b082f[_0x54dc('0x1e')][_0x54dc('0x27')]);_0x1723aa[_0x54dc('0x28')]=qs[_0x54dc('0x20')](_[_0x54dc('0x29')](_0x1b082f['query'],_0x3721d8['filters']),_0x19b7bc);if(_0x1b082f[_0x54dc('0x1e')][_0x54dc('0x2a')]){_0x1723aa['where']=_['merge'](_0x1723aa[_0x54dc('0x28')],{'$or':_[_0x54dc('0x18')](_0x19b7bc,function(_0x39f0c9){if(_0x39f0c9[_0x54dc('0x1b')]!=='VIRTUAL'){var _0x99f41e={};_0x99f41e[_0x39f0c9[_0x54dc('0x15')]]={'$like':'%'+_0x1b082f[_0x54dc('0x1e')][_0x54dc('0x2a')]+'%'};return _0x99f41e;}})});}_0x1723aa=_['merge']({},_0x1723aa,_0x1b082f['options']);var _0x4df393={'where':_0x1723aa['where']};return db[_0x54dc('0x19')][_0x54dc('0xc')](_0x4df393)[_0x54dc('0x2b')](function(_0x13f476){_0x2d3947[_0x54dc('0xc')]=_0x13f476;if(_0x1b082f[_0x54dc('0x1e')][_0x54dc('0x2c')]){_0x1723aa[_0x54dc('0x2d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x54dc('0x2e')](_0x1723aa);})['then'](function(_0x3f2849){_0x2d3947[_0x54dc('0x2f')]=_0x3f2849;return _0x2d3947;})[_0x54dc('0x2b')](respondWithFilteredResult(_0x56313c,_0x1723aa))[_0x54dc('0x30')](handleError(_0x56313c,null));};exports['show']=function(_0x2e5072,_0x1b5eb0){var _0xd4a18d={'raw':![],'where':{'id':_0x2e5072[_0x54dc('0x31')]['id']}},_0x166d39={};_0x166d39[_0x54dc('0x1d')]=_['keys'](db[_0x54dc('0x19')][_0x54dc('0x1a')]);_0x166d39[_0x54dc('0x1e')]=_[_0x54dc('0x1f')](_0x2e5072['query']);_0x166d39[_0x54dc('0x20')]=_[_0x54dc('0x22')](_0x166d39[_0x54dc('0x1d')],_0x166d39[_0x54dc('0x1e')]);_0xd4a18d[_0x54dc('0x21')]=_[_0x54dc('0x22')](_0x166d39[_0x54dc('0x1d')],qs[_0x54dc('0x23')](_0x2e5072['query'][_0x54dc('0x23')]));_0xd4a18d[_0x54dc('0x21')]=_0xd4a18d['attributes']['length']?_0xd4a18d[_0x54dc('0x21')]:_0x166d39[_0x54dc('0x1d')];if(_0x2e5072[_0x54dc('0x1e')][_0x54dc('0x2c')]){_0xd4a18d[_0x54dc('0x2d')]=[{'all':!![]}];}_0xd4a18d=_[_0x54dc('0x32')]({},_0xd4a18d,_0x2e5072['options']);return db[_0x54dc('0x19')][_0x54dc('0x33')](_0xd4a18d)[_0x54dc('0x2b')](handleEntityNotFound(_0x1b5eb0,null))[_0x54dc('0x2b')](respondWithResult(_0x1b5eb0,null))[_0x54dc('0x30')](handleError(_0x1b5eb0,null));};exports[_0x54dc('0x34')]=function(_0x2757b8,_0xbc748c){return db[_0x54dc('0x19')][_0x54dc('0x34')](_0x2757b8[_0x54dc('0x35')],{})[_0x54dc('0x2b')](respondWithResult(_0xbc748c,0xc9))[_0x54dc('0x30')](handleError(_0xbc748c,null));};exports[_0x54dc('0xf')]=function(_0x1ef21c,_0x1e9cea){if(_0x1ef21c['body']['id']){delete _0x1ef21c['body']['id'];}return db[_0x54dc('0x19')][_0x54dc('0x33')]({'where':{'id':_0x1ef21c['params']['id']}})[_0x54dc('0x2b')](handleEntityNotFound(_0x1e9cea,null))[_0x54dc('0x2b')](saveUpdates(_0x1ef21c['body'],null))[_0x54dc('0x2b')](respondWithResult(_0x1e9cea,null))['catch'](handleError(_0x1e9cea,null));};exports[_0x54dc('0x10')]=function(_0x3ad85b,_0x144b7a){return db[_0x54dc('0x19')][_0x54dc('0x33')]({'where':{'id':_0x3ad85b[_0x54dc('0x31')]['id']}})[_0x54dc('0x2b')](handleEntityNotFound(_0x144b7a,null))[_0x54dc('0x2b')](removeEntity(_0x144b7a,null))[_0x54dc('0x30')](handleError(_0x144b7a,null));};exports['getConfigurations']=function(_0xe3e992,_0x349629){var _0x504c33={};var _0x46fcbc={};var _0x20c8e2;var _0x486e1c;return db[_0x54dc('0x19')][_0x54dc('0x36')]({'where':{'id':_0xe3e992[_0x54dc('0x31')]['id']}})['then'](handleEntityNotFound(_0x349629,null))['then'](function(_0x38ecf4){if(_0x38ecf4){_0x20c8e2=_0x38ecf4;_0x46fcbc['model']=_[_0x54dc('0x1f')](db[_0x54dc('0x37')][_0x54dc('0x1a')]);_0x46fcbc['query']=_['keys'](_0xe3e992[_0x54dc('0x1e')]);_0x46fcbc['filters']=_['intersection'](_0x46fcbc[_0x54dc('0x1d')],_0x46fcbc['query']);_0x504c33[_0x54dc('0x21')]=_[_0x54dc('0x22')](_0x46fcbc[_0x54dc('0x1d')],qs[_0x54dc('0x23')](_0xe3e992[_0x54dc('0x1e')][_0x54dc('0x23')]));_0x504c33[_0x54dc('0x21')]=_0x504c33[_0x54dc('0x21')][_0x54dc('0x24')]?_0x504c33[_0x54dc('0x21')]:_0x46fcbc['model'];_0x504c33[_0x54dc('0x26')]=qs[_0x54dc('0x27')](_0xe3e992[_0x54dc('0x1e')][_0x54dc('0x27')]);_0x504c33[_0x54dc('0x28')]=qs[_0x54dc('0x20')](_[_0x54dc('0x29')](_0xe3e992['query'],_0x46fcbc[_0x54dc('0x20')]));if(_0xe3e992[_0x54dc('0x1e')][_0x54dc('0x2a')]){_0x504c33['where']=_[_0x54dc('0x32')](_0x504c33['where'],{'$or':_[_0x54dc('0x18')](_0x504c33[_0x54dc('0x21')],function(_0x20f724){var _0x5430d3={};_0x5430d3[_0x20f724]={'$like':'%'+_0xe3e992[_0x54dc('0x1e')][_0x54dc('0x2a')]+'%'};return _0x5430d3;})});}_0x504c33=_[_0x54dc('0x32')]({},_0x504c33,_0xe3e992['options']);return _0x20c8e2[_0x54dc('0x38')](_0x504c33);}})['then'](function(_0x1dc6b6){if(_0x1dc6b6){_0x486e1c=_0x1dc6b6['length'];if(!_0xe3e992[_0x54dc('0x1e')][_0x54dc('0x39')](_0x54dc('0x25'))){_0x504c33['limit']=qs['limit'](_0xe3e992['query']['limit']);_0x504c33[_0x54dc('0x9')]=qs[_0x54dc('0x9')](_0xe3e992[_0x54dc('0x1e')][_0x54dc('0x9')]);}return _0x20c8e2[_0x54dc('0x38')](_0x504c33);}})[_0x54dc('0x2b')](function(_0x5e52dc){if(_0x5e52dc){return _0x5e52dc?{'count':_0x486e1c,'rows':_0x5e52dc}:null;}})[_0x54dc('0x2b')](respondWithResult(_0x349629,null))[_0x54dc('0x30')](handleError(_0x349629,null));};exports['addConfiguration']=function(_0xf39d63,_0x42dee1){if(_0xf39d63[_0x54dc('0x35')]['id']){delete _0xf39d63['body']['id'];}return db['Dynamics365Account'][_0x54dc('0x36')]({'where':{'id':_0xf39d63[_0x54dc('0x31')]['id']}})['then'](handleEntityNotFound(_0x42dee1,null))[_0x54dc('0x2b')](function(_0x3db12a){if(_0x3db12a){_0xf39d63[_0x54dc('0x35')]['AccountId']=_0x3db12a['id'];_0xf39d63['body'][_0x54dc('0x3a')]=integrations[_0x54dc('0x3b')](_0xf39d63[_0x54dc('0x35')][_0x54dc('0x3c')],_0xf39d63[_0x54dc('0x35')][_0x54dc('0x1b')]);_0xf39d63[_0x54dc('0x35')]['Descriptions']=integrations[_0x54dc('0x3d')](_0xf39d63[_0x54dc('0x35')]['channel'],_0xf39d63[_0x54dc('0x35')]['type']);return db[_0x54dc('0x37')][_0x54dc('0x34')](_0xf39d63[_0x54dc('0x35')],{'include':[{'model':db[_0x54dc('0x3e')],'as':'Subjects'},{'model':db[_0x54dc('0x3e')],'as':'Descriptions'}]});}return null;})[_0x54dc('0x2b')](respondWithResult(_0x42dee1,null))[_0x54dc('0x30')](handleError(_0x42dee1,null));};function sanitizeRemoteUri(_0x2c3f22){var _0x229921=_0x2c3f22['slice'](-0x1);if(_0x229921==='/')return _0x2c3f22[_0x54dc('0x3f')](0x0,_0x2c3f22[_0x54dc('0x40')](_0x229921));return _0x2c3f22;}function getWebApiUrl(_0x27f1fa){return util['format'](_0x54dc('0x41'),_0x27f1fa);}exports[_0x54dc('0x42')]=function(_0x4e3859,_0x5d4c15){var _0xdddeed=_0x4e3859[_0x54dc('0x1e')]['ticketType'];var _0x465c99=_0xdddeed===_0x54dc('0x43')?_0x54dc('0x44'):_0x54dc('0x45');var _0x24c407='';var _0x1be7e6='';var _0x1f97dc='';var _0x301fcb='';var _0x303907='';var _0x199f27='';var _0x5aab6b='';var _0xb6dbc1='';var _0x543004=['title','description','customerid',_0x54dc('0x46'),_0x54dc('0x47'),_0x54dc('0x48'),_0x54dc('0x49'),_0x54dc('0x4a'),_0x54dc('0x4b'),_0x54dc('0x4c')];var _0x359c3f=['accountidname',_0x54dc('0x4d'),_0x54dc('0x4e'),_0x54dc('0x4f'),_0x54dc('0x50'),'contactidyominame',_0x54dc('0x51'),_0x54dc('0x52'),_0x54dc('0x53'),_0x54dc('0x54'),'createdbyname',_0x54dc('0x55'),_0x54dc('0x56'),_0x54dc('0x57'),'createdonbehalfbyyominame','customeridname',_0x54dc('0x58'),_0x54dc('0x59'),_0x54dc('0x5a'),_0x54dc('0x5b'),'entityimage_timestamp',_0x54dc('0x5c'),_0x54dc('0x5d'),'exchangerate',_0x54dc('0x5e'),_0x54dc('0x5f'),_0x54dc('0x60'),'influencescore',_0x54dc('0x61'),_0x54dc('0x62'),_0x54dc('0x63'),_0x54dc('0x64'),_0x54dc('0x65'),_0x54dc('0x66'),_0x54dc('0x67'),_0x54dc('0x68'),_0x54dc('0x69'),'modifiedonbehalfbyyominame',_0x54dc('0x6a'),_0x54dc('0x6b'),_0x54dc('0x6c'),_0x54dc('0x6d'),'overriddencreatedon',_0x54dc('0x6e'),_0x54dc('0x6f'),_0x54dc('0x70'),_0x54dc('0x71'),'primarycontactidname',_0x54dc('0x72'),_0x54dc('0x73'),'productidname',_0x54dc('0x74'),_0x54dc('0x75'),_0x54dc('0x76'),_0x54dc('0x77'),_0x54dc('0x78'),_0x54dc('0x79'),'sentimentvalue',_0x54dc('0x7a'),'slaname',_0x54dc('0x7b'),_0x54dc('0x7c'),_0x54dc('0x7d'),_0x54dc('0x7e'),'ticketnumber',_0x54dc('0x7f'),'transactioncurrencyidname',_0x54dc('0x80'),'utcconversiontimezonecode','versionnumber'];var _0x3876ce=_0x543004[_0x54dc('0x81')](_0x359c3f);return db[_0x54dc('0x19')][_0x54dc('0x36')]({'where':{'id':_0x4e3859[_0x54dc('0x31')]['id']},'attributes':['id',_0x54dc('0x82'),'password',_0x54dc('0x83'),'tenantId',_0x54dc('0x84'),'clientSecret',_0x54dc('0x85')],'include':[{'model':db[_0x54dc('0x86')],'as':_0x54dc('0x86'),'attributes':['id',_0x54dc('0x87'),_0x54dc('0x88')]}]})['then'](handleEntityNotFound(_0x5d4c15,null))[_0x54dc('0x2b')](function(_0x2ab934){if(_0x2ab934){if(_0x2ab934[_0x54dc('0x85')]){_0x2ab934['access_token']=_0x2ab934[_0x54dc('0x86')][_0x54dc('0x87')];_0xb6dbc1=sanitizeRemoteUri(_0x2ab934[_0x54dc('0x86')][_0x54dc('0x88')]);_0x5aab6b=getWebApiUrl(_0xb6dbc1);return _0x2ab934;}_0xb6dbc1=sanitizeRemoteUri(_0x2ab934['remoteUri']);_0x5aab6b=getWebApiUrl(_0xb6dbc1);var _0x3010de={'method':_0x54dc('0x89'),'uri':_0x54dc('0x8a')+_0x2ab934[_0x54dc('0x8b')]+'/oauth2/token','form':{'client_id':_0x2ab934['clientId'],'resource':_0xb6dbc1,'username':_0x2ab934[_0x54dc('0x82')],'password':_0x2ab934[_0x54dc('0x8c')],'grant_type':_0x54dc('0x8c'),'client_secret':_0x2ab934['clientSecret']},'json':!![]};return rp(_0x3010de);}})['then'](function(_0x2eecf0){_0x199f27=_0x2eecf0[_0x54dc('0x8d')];var _0x3d9647={'method':'GET','uri':encodeURI(_0x5aab6b+_0x54dc('0x8e')+_0x465c99+'\x27'),'headers':{'Authorization':_0x54dc('0x8f')+_0x199f27,'If-None-Match':null,'OData-Version':_0x54dc('0x90')},'json':!![]};return rp(_0x3d9647);})['then'](function(_0x198b8e){var _0x191b5f=_0x198b8e[_0x54dc('0x91')][0x0];var _0x5d4cea=_0x191b5f[_0x54dc('0x92')];var _0x2e8c6c={'method':_0x54dc('0x93'),'uri':_0x5aab6b+_0x54dc('0x94')+_0x5d4cea+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x54dc('0x8f')+_0x199f27,'If-None-Match':null,'OData-Version':_0x54dc('0x90')},'json':!![]};return rp(_0x2e8c6c);})[_0x54dc('0x2b')](function(_0x4b916d){_0x24c407=_0x4b916d;_0x1be7e6=_0x24c407[_0x54dc('0x95')];_0x1be7e6=_['remove'](_0x1be7e6,function(_0x5745e5){return!_0x3876ce['includes'](_0x5745e5[_0x54dc('0x96')]);});var _0x4abf82=[];var _0x91a9b9=[];_0x1be7e6[_0x54dc('0x97')](function(_0x547a92){if(_0x547a92[_0x54dc('0x98')]){var _0x4f6722=_0x547a92[_0x54dc('0x98')][_0x54dc('0x3f')](_0x547a92[_0x54dc('0x98')][_0x54dc('0x40')]('.')+0x1);if(_0x4f6722===_0x54dc('0x99')){_0x4abf82[_0x54dc('0x9a')](getSelectList(_0x5aab6b,_0xdddeed,_0x91a9b9,_0x24c407[_0x54dc('0x92')],_0x547a92[_0x54dc('0x92')],_0x199f27));}}});return Promise[_0x54dc('0x9b')](_0x4abf82);})['then'](function(_0x84033a){_0x1f97dc=_0x84033a[0x0];var _0x4be982=[];var _0x527298=[];_0x1be7e6[_0x54dc('0x97')](function(_0x38ac61){if(!_['isNil'](_0x38ac61['@odata.type'])){var _0x43556a=_0x38ac61[_0x54dc('0x98')][_0x54dc('0x3f')](_0x38ac61[_0x54dc('0x98')]['lastIndexOf']('.')+0x1);if(_0x43556a==='BooleanAttributeMetadata'){_0x4be982[_0x54dc('0x9a')](getBooleanList(_0x5aab6b,_0xdddeed,_0x527298,_0x24c407[_0x54dc('0x92')],_0x38ac61[_0x54dc('0x92')],_0x199f27));}}});return Promise[_0x54dc('0x9b')](_0x4be982);})[_0x54dc('0x2b')](function(_0x35116f){_0x301fcb=_0x35116f[0x0];var _0x31949a=[];var _0x4f19cb=[];_0x1be7e6['forEach'](function(_0x1cef6f){if(_0x1cef6f[_0x54dc('0x98')]){var _0x54d46c=_0x1cef6f[_0x54dc('0x98')][_0x54dc('0x3f')](_0x1cef6f['@odata.type']['lastIndexOf']('.')+0x1);if(_0x54d46c===_0x54dc('0x9c')||_0x54d46c===_0x54dc('0x9d')||_0x54d46c===_0x54dc('0x9e')||_0x54d46c==='IntegerAttributeMetadata'||_0x54d46c===_0x54dc('0x9f')||_0x54d46c==='DateTimeAttributeMetadata'||_0x54d46c==='StatusAttributeMetadata'||_0x54d46c===_0x54dc('0xa0')||_0x54d46c===_0x54dc('0xa1')||_0x54d46c===_0x54dc('0xa2')){_0x31949a[_0x54dc('0x9a')](getInputList(_0x5aab6b,_0xdddeed,_0x54d46c,_0x4f19cb,_0x24c407[_0x54dc('0x92')],_0x1cef6f['MetadataId'],_0x199f27));}}});return Promise['all'](_0x31949a);})[_0x54dc('0x2b')](function(_0x312794){_0x303907=_0x312794[0x0];var _0x4538bb=_0x1f97dc[_0x54dc('0x81')](_0x301fcb)[_0x54dc('0x81')](_0x303907);var _0x530b36={'count':_0x4538bb[_0x54dc('0x24')],'rows':_0x4538bb};return _0x530b36;})['then'](respondWithResult(_0x5d4c15,null))[_0x54dc('0x30')](function(_0x338749){var _0x55c4ea=_0x4e3859[_0x54dc('0x1e')]['test']?0x1f4:_0x338749['statusCode']||0x1f4;logger[_0x54dc('0x13')](_0x338749[_0x54dc('0x14')]);delete _0x338749['name'];if(_0x55c4ea===0x191){_0x55c4ea=0x190;}_0x5d4c15[_0x54dc('0x7')](_0x55c4ea)['send'](_0x4e3859['query']['test']?{'message':_0x54dc('0xa3'),'statusCode':_0x338749['statusCode']}:_0x338749);});};function getSelectList(_0x2b5c48,_0x3547cd,_0x570cb5,_0x442f69,_0x2b1ef0,_0x27aaab){var _0x5bb27f={'method':_0x54dc('0x93'),'uri':_0x2b5c48+_0x54dc('0x94')+_0x442f69+_0x54dc('0xa4')+_0x2b1ef0+_0x54dc('0xa5')+_0x54dc('0xa6'),'headers':{'Authorization':'Bearer\x20'+_0x27aaab,'If-None-Match':null,'OData-Version':_0x54dc('0x90')},'json':!![]};return rp(_0x5bb27f)['then'](function(_0x5e7341){var _0x1876a2=[];var _0x2d036b=_0x5e7341[_0x54dc('0xa7')][_0x54dc('0xa8')];_0x2d036b[_0x54dc('0x97')](function(_0x20e706){_0x1876a2['push']({'name':_0x20e706[_0x54dc('0xa9')][_0x54dc('0xaa')]['Label'],'value':String(_0x20e706['Value'])});});var _0x5618a1={'id':_0x3547cd+'_'+_0x5e7341[_0x54dc('0x96')],'name':_0x5e7341[_0x54dc('0xab')][_0x54dc('0xaa')][_0x54dc('0xa9')],'custom':![],'options':_0x1876a2};_0x570cb5[_0x54dc('0x9a')](_0x5618a1);return _0x570cb5;});}function getBooleanList(_0x4717cc,_0xedbec3,_0x6989dd,_0x209f22,_0x4af803,_0x280c4e){var _0x28a10a={'method':'GET','uri':_0x4717cc+_0x54dc('0x94')+_0x209f22+_0x54dc('0xa4')+_0x4af803+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x280c4e,'If-None-Match':null,'OData-Version':_0x54dc('0x90')},'json':!![]};return rp(_0x28a10a)['then'](function(_0x466d5b){var _0x37e7e2=[];_0x37e7e2[_0x54dc('0x9a')]({'name':_0x466d5b[_0x54dc('0xa7')]['TrueOption']['Label'][_0x54dc('0xaa')]['Label'],'value':_0x54dc('0xac')},{'name':_0x466d5b[_0x54dc('0xa7')][_0x54dc('0xad')][_0x54dc('0xa9')]['UserLocalizedLabel'][_0x54dc('0xa9')],'value':_0x54dc('0xae')});var _0x320f90={'id':_0xedbec3+'_'+_0x466d5b[_0x54dc('0x96')],'name':_0x466d5b[_0x54dc('0xab')][_0x54dc('0xaa')]['Label'],'custom':![],'options':_0x37e7e2};_0x6989dd[_0x54dc('0x9a')](_0x320f90);return _0x6989dd;});}function getInputList(_0x84e59b,_0x23943,_0x17421c,_0x516cba,_0x5b1297,_0x35e196,_0x5a2385){var _0x10d2e4={'method':_0x54dc('0x93'),'uri':_0x84e59b+'EntityDefinitions('+_0x5b1297+_0x54dc('0xa4')+_0x35e196+_0x54dc('0xaf')+_0x17421c+_0x54dc('0xb0'),'headers':{'Authorization':_0x54dc('0x8f')+_0x5a2385,'If-None-Match':null,'OData-Version':_0x54dc('0x90')},'json':!![]};return rp(_0x10d2e4)[_0x54dc('0x2b')](function(_0x10a33b){var _0x1d8756={'id':_0x23943+'_'+_0x10a33b[_0x54dc('0x96')],'name':_0x10a33b[_0x54dc('0xab')][_0x54dc('0xaa')]?_0x10a33b['DisplayName']['UserLocalizedLabel']['Label']:_0x10a33b['LogicalName'],'custom':![],'options':[]};_0x516cba[_0x54dc('0x9a')](_0x1d8756);return _0x516cba;});} \ No newline at end of file +var _0x66e2=['Incident','title','description','customerid','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','MetadataId','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','UserLocalizedLabel','Label','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','options','includeAll','include','rows','catch','params','find','create','body','update','destroy','getConfigurations','Dynamics365Configuration','order','pick','merge','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType'];(function(_0x20b00e,_0x4ff2f7){var _0x55cae3=function(_0x1ecba0){while(--_0x1ecba0){_0x20b00e['push'](_0x20b00e['shift']());}};_0x55cae3(++_0x4ff2f7);}(_0x66e2,0x74));var _0x266e=function(_0x48fd24,_0x13fa0b){_0x48fd24=_0x48fd24-0x0;var _0x2edb3a=_0x66e2[_0x48fd24];return _0x2edb3a;};'use strict';var rp=require('request-promise');var util=require(_0x266e('0x0'));var _=require(_0x266e('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x266e('0x2'))('api');var db=require(_0x266e('0x3'))['db'];var integrations=require(_0x266e('0x4'));function respondWithResult(_0x51a2fb,_0x381e95){_0x381e95=_0x381e95||0xc8;return function(_0x222245){if(_0x222245){return _0x51a2fb[_0x266e('0x5')](_0x381e95)[_0x266e('0x6')](_0x222245);}};}function respondWithFilteredResult(_0x4ac1fa,_0xc07efd){return function(_0x331073){if(_0x331073){var _0x191a31=typeof _0xc07efd[_0x266e('0x7')]===_0x266e('0x8')&&typeof _0xc07efd[_0x266e('0x9')]===_0x266e('0x8');var _0x464156=_0x331073['count'];var _0x4dd2ef=_0x191a31?0x0:_0xc07efd[_0x266e('0x7')];var _0x50c1ca=_0x191a31?_0x331073[_0x266e('0xa')]:_0xc07efd[_0x266e('0x7')]+_0xc07efd['limit'];var _0x3fa839;if(_0x50c1ca>=_0x464156){_0x50c1ca=_0x464156;_0x3fa839=0xc8;}else{_0x3fa839=0xce;}_0x4ac1fa[_0x266e('0x5')](_0x3fa839);return _0x4ac1fa[_0x266e('0xb')](_0x266e('0xc'),_0x4dd2ef+'-'+_0x50c1ca+'/'+_0x464156)[_0x266e('0x6')](_0x331073);}return null;};}function saveUpdates(_0x5c95c3){return function(_0x2c1393){if(_0x2c1393){return _0x2c1393['update'](_0x5c95c3)['then'](function(_0x1e3ea4){return _0x1e3ea4;});}return null;};}function removeEntity(_0x15ea24){return function(_0x51f92a){if(_0x51f92a){return _0x51f92a['destroy']()[_0x266e('0xd')](function(){_0x15ea24[_0x266e('0x5')](0xcc)[_0x266e('0xe')]();});}};}function handleEntityNotFound(_0x32c3e7){return function(_0x34862e){if(!_0x34862e){_0x32c3e7[_0x266e('0xf')](0x194);}return _0x34862e;};}function handleError(_0x646a4d,_0x354257){_0x354257=_0x354257||0x1f4;return function(_0x46b1a1){logger[_0x266e('0x10')](_0x46b1a1[_0x266e('0x11')]);if(_0x46b1a1['name']){delete _0x46b1a1[_0x266e('0x12')];}_0x646a4d[_0x266e('0x5')](_0x354257)[_0x266e('0x13')](_0x46b1a1);};}exports[_0x266e('0x14')]=function(_0x3d3ec0,_0x2158f7){var _0x10b2ae={},_0x2b56fd={},_0x3b1394={'count':0x0,'rows':[]};var _0x23b058=_[_0x266e('0x15')](db[_0x266e('0x16')][_0x266e('0x17')],function(_0x5aaaf2){return{'name':_0x5aaaf2['fieldName'],'type':_0x5aaaf2[_0x266e('0x18')][_0x266e('0x19')]};});_0x2b56fd['model']=_[_0x266e('0x15')](_0x23b058,_0x266e('0x12'));_0x2b56fd[_0x266e('0x1a')]=_[_0x266e('0x1b')](_0x3d3ec0[_0x266e('0x1a')]);_0x2b56fd[_0x266e('0x1c')]=_[_0x266e('0x1d')](_0x2b56fd[_0x266e('0x1e')],_0x2b56fd[_0x266e('0x1a')]);_0x10b2ae[_0x266e('0x1f')]=_[_0x266e('0x1d')](_0x2b56fd['model'],qs[_0x266e('0x20')](_0x3d3ec0[_0x266e('0x1a')]['fields']));_0x10b2ae[_0x266e('0x1f')]=_0x10b2ae['attributes'][_0x266e('0x21')]?_0x10b2ae['attributes']:_0x2b56fd['model'];if(!_0x3d3ec0[_0x266e('0x1a')][_0x266e('0x22')](_0x266e('0x23'))){_0x10b2ae[_0x266e('0x9')]=qs[_0x266e('0x9')](_0x3d3ec0[_0x266e('0x1a')]['limit']);_0x10b2ae[_0x266e('0x7')]=qs['offset'](_0x3d3ec0[_0x266e('0x1a')][_0x266e('0x7')]);}_0x10b2ae['order']=qs[_0x266e('0x24')](_0x3d3ec0['query']['sort']);_0x10b2ae[_0x266e('0x25')]=qs['filters'](_['pick'](_0x3d3ec0[_0x266e('0x1a')],_0x2b56fd[_0x266e('0x1c')]),_0x23b058);if(_0x3d3ec0[_0x266e('0x1a')][_0x266e('0x26')]){_0x10b2ae[_0x266e('0x25')]=_['merge'](_0x10b2ae[_0x266e('0x25')],{'$or':_['map'](_0x23b058,function(_0xde2767){if(_0xde2767['type']!=='VIRTUAL'){var _0x2ee3d3={};_0x2ee3d3[_0xde2767[_0x266e('0x12')]]={'$like':'%'+_0x3d3ec0[_0x266e('0x1a')]['filter']+'%'};return _0x2ee3d3;}})});}_0x10b2ae=_['merge']({},_0x10b2ae,_0x3d3ec0[_0x266e('0x27')]);var _0x15f863={'where':_0x10b2ae[_0x266e('0x25')]};return db[_0x266e('0x16')][_0x266e('0xa')](_0x15f863)['then'](function(_0x38a489){_0x3b1394[_0x266e('0xa')]=_0x38a489;if(_0x3d3ec0['query'][_0x266e('0x28')]){_0x10b2ae[_0x266e('0x29')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x10b2ae);})[_0x266e('0xd')](function(_0x2b7768){_0x3b1394[_0x266e('0x2a')]=_0x2b7768;return _0x3b1394;})[_0x266e('0xd')](respondWithFilteredResult(_0x2158f7,_0x10b2ae))[_0x266e('0x2b')](handleError(_0x2158f7,null));};exports['show']=function(_0x2fa415,_0x18e912){var _0x1b4bba={'raw':![],'where':{'id':_0x2fa415[_0x266e('0x2c')]['id']}},_0xcec6f8={};_0xcec6f8[_0x266e('0x1e')]=_[_0x266e('0x1b')](db[_0x266e('0x16')][_0x266e('0x17')]);_0xcec6f8['query']=_[_0x266e('0x1b')](_0x2fa415['query']);_0xcec6f8['filters']=_['intersection'](_0xcec6f8[_0x266e('0x1e')],_0xcec6f8[_0x266e('0x1a')]);_0x1b4bba[_0x266e('0x1f')]=_[_0x266e('0x1d')](_0xcec6f8[_0x266e('0x1e')],qs[_0x266e('0x20')](_0x2fa415['query'][_0x266e('0x20')]));_0x1b4bba[_0x266e('0x1f')]=_0x1b4bba[_0x266e('0x1f')]['length']?_0x1b4bba[_0x266e('0x1f')]:_0xcec6f8[_0x266e('0x1e')];if(_0x2fa415[_0x266e('0x1a')][_0x266e('0x28')]){_0x1b4bba[_0x266e('0x29')]=[{'all':!![]}];}_0x1b4bba=_['merge']({},_0x1b4bba,_0x2fa415[_0x266e('0x27')]);return db[_0x266e('0x16')][_0x266e('0x2d')](_0x1b4bba)['then'](handleEntityNotFound(_0x18e912,null))[_0x266e('0xd')](respondWithResult(_0x18e912,null))[_0x266e('0x2b')](handleError(_0x18e912,null));};exports[_0x266e('0x2e')]=function(_0xc1fb2c,_0x482d95){return db['Dynamics365Account'][_0x266e('0x2e')](_0xc1fb2c[_0x266e('0x2f')],{})[_0x266e('0xd')](respondWithResult(_0x482d95,0xc9))[_0x266e('0x2b')](handleError(_0x482d95,null));};exports[_0x266e('0x30')]=function(_0x47435b,_0x246899){if(_0x47435b[_0x266e('0x2f')]['id']){delete _0x47435b[_0x266e('0x2f')]['id'];}return db['Dynamics365Account'][_0x266e('0x2d')]({'where':{'id':_0x47435b[_0x266e('0x2c')]['id']}})[_0x266e('0xd')](handleEntityNotFound(_0x246899,null))['then'](saveUpdates(_0x47435b[_0x266e('0x2f')],null))[_0x266e('0xd')](respondWithResult(_0x246899,null))[_0x266e('0x2b')](handleError(_0x246899,null));};exports[_0x266e('0x31')]=function(_0x294b5e,_0x493131){return db[_0x266e('0x16')][_0x266e('0x2d')]({'where':{'id':_0x294b5e[_0x266e('0x2c')]['id']}})[_0x266e('0xd')](handleEntityNotFound(_0x493131,null))['then'](removeEntity(_0x493131,null))['catch'](handleError(_0x493131,null));};exports[_0x266e('0x32')]=function(_0x5d6b42,_0x515422){var _0x15533e={};var _0x120000={};var _0x41d2ed;var _0x2eb248;return db['Dynamics365Account']['findOne']({'where':{'id':_0x5d6b42['params']['id']}})['then'](handleEntityNotFound(_0x515422,null))[_0x266e('0xd')](function(_0x2439c7){if(_0x2439c7){_0x41d2ed=_0x2439c7;_0x120000[_0x266e('0x1e')]=_[_0x266e('0x1b')](db[_0x266e('0x33')][_0x266e('0x17')]);_0x120000[_0x266e('0x1a')]=_[_0x266e('0x1b')](_0x5d6b42[_0x266e('0x1a')]);_0x120000[_0x266e('0x1c')]=_[_0x266e('0x1d')](_0x120000[_0x266e('0x1e')],_0x120000[_0x266e('0x1a')]);_0x15533e['attributes']=_['intersection'](_0x120000[_0x266e('0x1e')],qs[_0x266e('0x20')](_0x5d6b42['query'][_0x266e('0x20')]));_0x15533e['attributes']=_0x15533e[_0x266e('0x1f')]['length']?_0x15533e[_0x266e('0x1f')]:_0x120000[_0x266e('0x1e')];_0x15533e[_0x266e('0x34')]=qs[_0x266e('0x24')](_0x5d6b42[_0x266e('0x1a')][_0x266e('0x24')]);_0x15533e[_0x266e('0x25')]=qs['filters'](_[_0x266e('0x35')](_0x5d6b42[_0x266e('0x1a')],_0x120000[_0x266e('0x1c')]));if(_0x5d6b42[_0x266e('0x1a')][_0x266e('0x26')]){_0x15533e[_0x266e('0x25')]=_[_0x266e('0x36')](_0x15533e[_0x266e('0x25')],{'$or':_['map'](_0x15533e[_0x266e('0x1f')],function(_0x39be8d){var _0x3ffba8={};_0x3ffba8[_0x39be8d]={'$like':'%'+_0x5d6b42['query']['filter']+'%'};return _0x3ffba8;})});}_0x15533e=_[_0x266e('0x36')]({},_0x15533e,_0x5d6b42[_0x266e('0x27')]);return _0x41d2ed[_0x266e('0x32')](_0x15533e);}})[_0x266e('0xd')](function(_0x159038){if(_0x159038){_0x2eb248=_0x159038[_0x266e('0x21')];if(!_0x5d6b42[_0x266e('0x1a')][_0x266e('0x22')]('nolimit')){_0x15533e['limit']=qs['limit'](_0x5d6b42[_0x266e('0x1a')]['limit']);_0x15533e[_0x266e('0x7')]=qs[_0x266e('0x7')](_0x5d6b42[_0x266e('0x1a')][_0x266e('0x7')]);}return _0x41d2ed['getConfigurations'](_0x15533e);}})[_0x266e('0xd')](function(_0x2a3e26){if(_0x2a3e26){return _0x2a3e26?{'count':_0x2eb248,'rows':_0x2a3e26}:null;}})[_0x266e('0xd')](respondWithResult(_0x515422,null))[_0x266e('0x2b')](handleError(_0x515422,null));};exports[_0x266e('0x37')]=function(_0x30fd69,_0x55aa72){if(_0x30fd69[_0x266e('0x2f')]['id']){delete _0x30fd69[_0x266e('0x2f')]['id'];}return db[_0x266e('0x16')][_0x266e('0x38')]({'where':{'id':_0x30fd69[_0x266e('0x2c')]['id']}})[_0x266e('0xd')](handleEntityNotFound(_0x55aa72,null))[_0x266e('0xd')](function(_0x25aea8){if(_0x25aea8){_0x30fd69[_0x266e('0x2f')][_0x266e('0x39')]=_0x25aea8['id'];_0x30fd69[_0x266e('0x2f')][_0x266e('0x3a')]=integrations[_0x266e('0x3b')](_0x30fd69[_0x266e('0x2f')][_0x266e('0x3c')],_0x30fd69[_0x266e('0x2f')][_0x266e('0x18')]);_0x30fd69[_0x266e('0x2f')][_0x266e('0x3d')]=integrations[_0x266e('0x3e')](_0x30fd69[_0x266e('0x2f')][_0x266e('0x3c')],_0x30fd69[_0x266e('0x2f')]['type']);return db[_0x266e('0x33')]['create'](_0x30fd69[_0x266e('0x2f')],{'include':[{'model':db[_0x266e('0x3f')],'as':_0x266e('0x3a')},{'model':db[_0x266e('0x3f')],'as':_0x266e('0x3d')}]});}return null;})[_0x266e('0xd')](respondWithResult(_0x55aa72,null))[_0x266e('0x2b')](handleError(_0x55aa72,null));};function sanitizeRemoteUri(_0x40d216){var _0x6c4cd3=_0x40d216[_0x266e('0x40')](-0x1);if(_0x6c4cd3==='/')return _0x40d216[_0x266e('0x41')](0x0,_0x40d216[_0x266e('0x42')](_0x6c4cd3));return _0x40d216;}function getWebApiUrl(_0x306dec){return util[_0x266e('0x43')](_0x266e('0x44'),_0x306dec);}exports[_0x266e('0x45')]=function(_0xd4a74b,_0x2688e9){var _0x22c9bb=_0xd4a74b[_0x266e('0x1a')][_0x266e('0x46')];var _0x263ec5=_0x22c9bb==='incident'?_0x266e('0x47'):'PhoneCall';var _0x1922a1='';var _0x54b059='';var _0x50b4dd='';var _0x4e401d='';var _0x18a94b='';var _0x359fb6='';var _0x33627b='';var _0x5f073d='';var _0x434f53=[_0x266e('0x48'),_0x266e('0x49'),_0x266e('0x4a'),_0x266e('0x4b'),_0x266e('0x4c'),_0x266e('0x4d'),'phonenumber','regardingobjectid',_0x266e('0x4e'),_0x266e('0x4f')];var _0x4fcd81=[_0x266e('0x50'),_0x266e('0x51'),_0x266e('0x52'),_0x266e('0x53'),_0x266e('0x54'),_0x266e('0x55'),'contractdetailidname','contractidname',_0x266e('0x56'),_0x266e('0x57'),_0x266e('0x58'),_0x266e('0x59'),'createdon',_0x266e('0x5a'),_0x266e('0x5b'),_0x266e('0x5c'),_0x266e('0x5d'),_0x266e('0x5e'),_0x266e('0x5f'),_0x266e('0x60'),_0x266e('0x61'),_0x266e('0x62'),_0x266e('0x63'),'exchangerate','firstresponsebykpiidname',_0x266e('0x64'),_0x266e('0x65'),_0x266e('0x66'),_0x266e('0x67'),_0x266e('0x68'),'masteridname',_0x266e('0x69'),_0x266e('0x6a'),_0x266e('0x6b'),_0x266e('0x6c'),_0x266e('0x6d'),'modifiedonbehalfbyname',_0x266e('0x6e'),'msdyn_incidenttypename',_0x266e('0x6f'),_0x266e('0x70'),'onholdtime','overriddencreatedon','owneridname','owneridtype',_0x266e('0x71'),_0x266e('0x72'),_0x266e('0x73'),'primarycontactidyominame',_0x266e('0x74'),_0x266e('0x75'),'productserialnumber',_0x266e('0x76'),_0x266e('0x77'),_0x266e('0x78'),_0x266e('0x79'),'responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0x266e('0x7a'),_0x266e('0x7b'),_0x266e('0x7c'),_0x266e('0x7d'),_0x266e('0x7e'),_0x266e('0x7f'),_0x266e('0x80'),_0x266e('0x81'),'traversedpath',_0x266e('0x82'),'versionnumber'];var _0xc6dbb=_0x434f53[_0x266e('0x83')](_0x4fcd81);return db[_0x266e('0x16')][_0x266e('0x38')]({'where':{'id':_0xd4a74b[_0x266e('0x2c')]['id']},'attributes':['id',_0x266e('0x84'),'password',_0x266e('0x85'),_0x266e('0x86'),_0x266e('0x87'),_0x266e('0x88'),_0x266e('0x89')],'include':[{'model':db['CloudProvider'],'as':_0x266e('0x8a'),'attributes':['id','data5',_0x266e('0x8b')]}]})[_0x266e('0xd')](handleEntityNotFound(_0x2688e9,null))[_0x266e('0xd')](function(_0xfd5144){if(_0xfd5144){if(_0xfd5144['modernAuthentication']){_0xfd5144[_0x266e('0x8c')]=_0xfd5144['CloudProvider'][_0x266e('0x8d')];_0x5f073d=sanitizeRemoteUri(_0xfd5144[_0x266e('0x8a')][_0x266e('0x8b')]);_0x33627b=getWebApiUrl(_0x5f073d);return _0xfd5144;}_0x5f073d=sanitizeRemoteUri(_0xfd5144[_0x266e('0x85')]);_0x33627b=getWebApiUrl(_0x5f073d);var _0x1b7bdf={'method':_0x266e('0x8e'),'uri':_0x266e('0x8f')+_0xfd5144[_0x266e('0x86')]+'/oauth2/token','form':{'client_id':_0xfd5144[_0x266e('0x87')],'resource':_0x5f073d,'username':_0xfd5144[_0x266e('0x84')],'password':_0xfd5144[_0x266e('0x90')],'grant_type':_0x266e('0x90'),'client_secret':_0xfd5144['clientSecret']},'json':!![]};return rp(_0x1b7bdf);}})[_0x266e('0xd')](function(_0x5e1c9d){_0x359fb6=_0x5e1c9d['access_token'];var _0x3005d2={'method':_0x266e('0x91'),'uri':encodeURI(_0x33627b+_0x266e('0x92')+_0x263ec5+'\x27'),'headers':{'Authorization':_0x266e('0x93')+_0x359fb6,'If-None-Match':null,'OData-Version':_0x266e('0x94')},'json':!![]};return rp(_0x3005d2);})[_0x266e('0xd')](function(_0x341e11){var _0xc25fb=_0x341e11[_0x266e('0x95')][0x0];var _0x5c2003=_0xc25fb['MetadataId'];var _0x2aa97b={'method':_0x266e('0x91'),'uri':_0x33627b+_0x266e('0x96')+_0x5c2003+_0x266e('0x97'),'headers':{'Authorization':'Bearer\x20'+_0x359fb6,'If-None-Match':null,'OData-Version':_0x266e('0x94')},'json':!![]};return rp(_0x2aa97b);})['then'](function(_0x21aae1){_0x1922a1=_0x21aae1;_0x54b059=_0x1922a1[_0x266e('0x98')];_0x54b059=_[_0x266e('0x99')](_0x54b059,function(_0x2456ce){return!_0xc6dbb[_0x266e('0x9a')](_0x2456ce['LogicalName']);});var _0x1e6853=[];var _0x3ee6c7=[];_0x54b059[_0x266e('0x9b')](function(_0x1bf0e8){if(_0x1bf0e8['@odata.type']){var _0x3512f4=_0x1bf0e8[_0x266e('0x9c')][_0x266e('0x41')](_0x1bf0e8[_0x266e('0x9c')]['lastIndexOf']('.')+0x1);if(_0x3512f4===_0x266e('0x9d')){_0x1e6853[_0x266e('0x9e')](getSelectList(_0x33627b,_0x22c9bb,_0x3ee6c7,_0x1922a1['MetadataId'],_0x1bf0e8['MetadataId'],_0x359fb6));}}});return Promise[_0x266e('0x9f')](_0x1e6853);})[_0x266e('0xd')](function(_0x2bebc6){_0x50b4dd=_0x2bebc6[0x0];var _0x3e247c=[];var _0x49efb7=[];_0x54b059[_0x266e('0x9b')](function(_0x12dbb5){if(!_[_0x266e('0xa0')](_0x12dbb5[_0x266e('0x9c')])){var _0x91e780=_0x12dbb5[_0x266e('0x9c')][_0x266e('0x41')](_0x12dbb5[_0x266e('0x9c')]['lastIndexOf']('.')+0x1);if(_0x91e780===_0x266e('0xa1')){_0x3e247c[_0x266e('0x9e')](getBooleanList(_0x33627b,_0x22c9bb,_0x49efb7,_0x1922a1[_0x266e('0xa2')],_0x12dbb5['MetadataId'],_0x359fb6));}}});return Promise[_0x266e('0x9f')](_0x3e247c);})[_0x266e('0xd')](function(_0xb0dc85){_0x4e401d=_0xb0dc85[0x0];var _0x550a51=[];var _0x4dc7cf=[];_0x54b059[_0x266e('0x9b')](function(_0x395bdf){if(_0x395bdf[_0x266e('0x9c')]){var _0x18e076=_0x395bdf[_0x266e('0x9c')][_0x266e('0x41')](_0x395bdf['@odata.type'][_0x266e('0x42')]('.')+0x1);if(_0x18e076===_0x266e('0xa3')||_0x18e076===_0x266e('0xa4')||_0x18e076==='BigIntAttributeMetadata'||_0x18e076===_0x266e('0xa5')||_0x18e076===_0x266e('0xa6')||_0x18e076==='DateTimeAttributeMetadata'||_0x18e076===_0x266e('0xa7')||_0x18e076==='EntityNameAttributeMetadata'||_0x18e076===_0x266e('0xa8')||_0x18e076==='DecimalAttributeMetadata'){_0x550a51[_0x266e('0x9e')](getInputList(_0x33627b,_0x22c9bb,_0x18e076,_0x4dc7cf,_0x1922a1[_0x266e('0xa2')],_0x395bdf['MetadataId'],_0x359fb6));}}});return Promise[_0x266e('0x9f')](_0x550a51);})[_0x266e('0xd')](function(_0xbc3b19){_0x18a94b=_0xbc3b19[0x0];var _0x46568b=_0x50b4dd[_0x266e('0x83')](_0x4e401d)['concat'](_0x18a94b);var _0x20c106={'count':_0x46568b[_0x266e('0x21')],'rows':_0x46568b};return _0x20c106;})[_0x266e('0xd')](respondWithResult(_0x2688e9,null))[_0x266e('0x2b')](function(_0x340b42){var _0x36c94a=_0xd4a74b[_0x266e('0x1a')]['test']?0x1f4:_0x340b42['statusCode']||0x1f4;logger['error'](_0x340b42[_0x266e('0x11')]);delete _0x340b42['name'];if(_0x36c94a===0x191){_0x36c94a=0x190;}_0x2688e9[_0x266e('0x5')](_0x36c94a)[_0x266e('0x13')](_0xd4a74b[_0x266e('0x1a')][_0x266e('0xa9')]?{'message':_0x266e('0xaa'),'statusCode':_0x340b42[_0x266e('0xab')]}:_0x340b42);});};function getSelectList(_0x2b6656,_0x38e29d,_0x5981ce,_0x119e9f,_0x49d75,_0x1ec218){var _0x3bb438={'method':_0x266e('0x91'),'uri':_0x2b6656+'EntityDefinitions('+_0x119e9f+_0x266e('0xac')+_0x49d75+_0x266e('0xad')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x1ec218,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3bb438)['then'](function(_0x499b40){var _0x50b482=[];var _0x16a8ac=_0x499b40[_0x266e('0xae')]['Options'];_0x16a8ac[_0x266e('0x9b')](function(_0x4a33c8){_0x50b482['push']({'name':_0x4a33c8['Label'][_0x266e('0xaf')][_0x266e('0xb0')],'value':String(_0x4a33c8[_0x266e('0xb1')])});});var _0x43275e={'id':_0x38e29d+'_'+_0x499b40[_0x266e('0xb2')],'name':_0x499b40['DisplayName'][_0x266e('0xaf')]['Label'],'custom':![],'options':_0x50b482};_0x5981ce[_0x266e('0x9e')](_0x43275e);return _0x5981ce;});}function getBooleanList(_0x285eba,_0x33fbad,_0x30fd0a,_0x2e06ff,_0xd2f17d,_0x4abe20){var _0x4bd7af={'method':_0x266e('0x91'),'uri':_0x285eba+_0x266e('0x96')+_0x2e06ff+_0x266e('0xac')+_0xd2f17d+_0x266e('0xb3'),'headers':{'Authorization':_0x266e('0x93')+_0x4abe20,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4bd7af)[_0x266e('0xd')](function(_0x497f14){var _0x44fa1f=[];_0x44fa1f[_0x266e('0x9e')]({'name':_0x497f14['OptionSet'][_0x266e('0xb4')][_0x266e('0xb0')][_0x266e('0xaf')]['Label'],'value':_0x266e('0xb5')},{'name':_0x497f14['OptionSet'][_0x266e('0xb6')][_0x266e('0xb0')][_0x266e('0xaf')][_0x266e('0xb0')],'value':_0x266e('0xb7')});var _0x33cc76={'id':_0x33fbad+'_'+_0x497f14[_0x266e('0xb2')],'name':_0x497f14[_0x266e('0xb8')]['UserLocalizedLabel'][_0x266e('0xb0')],'custom':![],'options':_0x44fa1f};_0x30fd0a['push'](_0x33cc76);return _0x30fd0a;});}function getInputList(_0xca54db,_0x34f8ef,_0x5dfcf9,_0x56b477,_0x1092b7,_0x1545d3,_0x35b042){var _0x1f4935={'method':_0x266e('0x91'),'uri':_0xca54db+_0x266e('0x96')+_0x1092b7+')/Attributes('+_0x1545d3+_0x266e('0xb9')+_0x5dfcf9+_0x266e('0xba'),'headers':{'Authorization':_0x266e('0x93')+_0x35b042,'If-None-Match':null,'OData-Version':_0x266e('0x94')},'json':!![]};return rp(_0x1f4935)['then'](function(_0x23a936){var _0x589cc7={'id':_0x34f8ef+'_'+_0x23a936[_0x266e('0xb2')],'name':_0x23a936[_0x266e('0xb8')][_0x266e('0xaf')]?_0x23a936[_0x266e('0xb8')][_0x266e('0xaf')][_0x266e('0xb0')]:_0x23a936[_0x266e('0xb2')],'custom':![],'options':[]};_0x56b477['push'](_0x589cc7);return _0x56b477;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 390da74..c357e5e 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6ef86b,_0x45f88c){var _0x153e6e=function(_0x1af05c){while(--_0x1af05c){_0x6ef86b['push'](_0x6ef86b['shift']());}};_0x153e6e(++_0x45f88c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 8d6a440..c949c40 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 _0x4bf1=['../../config/logger','rpc','../../config/environment','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowDynamics365Account','find','moment','bluebird','../../mysqldb'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x4bf1,0x19d));var _0x14bf=function(_0xe1384c,_0x4e4a81){_0xe1384c=_0xe1384c-0x0;var _0x31fc85=_0x4bf1[_0xe1384c];return _0x31fc85;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x14bf('0x0'));var BPromise=require(_0x14bf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14bf('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x14bf('0x3'))(_0x14bf('0x4'));var config=require(_0x14bf('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x14bf('0x6')][_0x14bf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xafa455,_0x371c73,_0xe5b84f){return new BPromise(function(_0x4c0f96,_0x3495d4){return client['request'](_0xafa455,_0xe5b84f)[_0x14bf('0x8')](function(_0x4f584a){logger[_0x14bf('0x9')](_0x14bf('0xa'),_0x371c73,'request\x20sent');logger['debug'](_0x14bf('0xb'),_0x371c73,_0x14bf('0xc'),JSON[_0x14bf('0xd')](_0x4f584a));if(_0x4f584a[_0x14bf('0xe')]){if(_0x4f584a[_0x14bf('0xe')][_0x14bf('0xf')]===0x1f4){logger['error'](_0x14bf('0xa'),_0x371c73,_0x4f584a[_0x14bf('0xe')][_0x14bf('0x10')]);return _0x3495d4(_0x4f584a[_0x14bf('0xe')][_0x14bf('0x10')]);}logger[_0x14bf('0xe')](_0x14bf('0xa'),_0x371c73,_0x4f584a[_0x14bf('0xe')][_0x14bf('0x10')]);return _0x4c0f96(_0x4f584a[_0x14bf('0xe')][_0x14bf('0x10')]);}else{logger[_0x14bf('0x9')](_0x14bf('0xa'),_0x371c73,_0x14bf('0xc'));_0x4c0f96(_0x4f584a[_0x14bf('0x11')]['message']);}})[_0x14bf('0x12')](function(_0x45163c){logger[_0x14bf('0xe')](_0x14bf('0xa'),_0x371c73,_0x45163c);_0x3495d4(_0x45163c);});});}exports[_0x14bf('0x13')]=function(_0x593747){var _0x319108=this;return new Promise(function(_0x32c2c7,_0x7f75a5){return db['Dynamics365Account'][_0x14bf('0x14')]({'raw':_0x593747['options']?_0x593747[_0x14bf('0x15')][_0x14bf('0x16')]===undefined?!![]:![]:!![],'where':_0x593747['options']?_0x593747[_0x14bf('0x15')][_0x14bf('0x17')]||null:null,'attributes':_0x593747[_0x14bf('0x15')]?_0x593747[_0x14bf('0x15')]['attributes']||null:null,'limit':_0x593747[_0x14bf('0x15')]?_0x593747['options'][_0x14bf('0x18')]||null:null,'include':_0x593747[_0x14bf('0x15')]?_0x593747[_0x14bf('0x15')][_0x14bf('0x19')]?_[_0x14bf('0x1a')](_0x593747[_0x14bf('0x15')][_0x14bf('0x19')],function(_0x7d41bf){return{'model':db[_0x7d41bf[_0x14bf('0x1b')]],'as':_0x7d41bf['as'],'attributes':_0x7d41bf[_0x14bf('0x1c')],'include':_0x7d41bf['include']?_[_0x14bf('0x1a')](_0x7d41bf['include'],function(_0x14f850){return{'model':db[_0x14f850[_0x14bf('0x1b')]],'as':_0x14f850['as'],'attributes':_0x14f850[_0x14bf('0x1c')],'include':_0x14f850[_0x14bf('0x19')]?_['map'](_0x14f850['include'],function(_0x13dffc){return{'model':db[_0x13dffc[_0x14bf('0x1b')]],'as':_0x13dffc['as'],'attributes':_0x13dffc[_0x14bf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14bf('0x8')](function(_0x2d5fa3){logger[_0x14bf('0x9')](_0x14bf('0x13'),_0x593747);logger[_0x14bf('0x1d')](_0x14bf('0x13'),_0x593747,JSON['stringify'](_0x2d5fa3));_0x32c2c7(_0x2d5fa3);})[_0x14bf('0x12')](function(_0x4728e7){logger['error'](_0x14bf('0x13'),_0x4728e7[_0x14bf('0x10')],_0x593747);_0x7f75a5(_0x319108[_0x14bf('0xe')](0x1f4,_0x4728e7[_0x14bf('0x10')]));});});};exports[_0x14bf('0x1e')]=function(_0x5e5772){var _0x2253b3=this;return new Promise(function(_0x1c9dc1,_0x3c87d3){return db['Dynamics365Account'][_0x14bf('0x1f')]({'raw':_0x5e5772[_0x14bf('0x15')]?_0x5e5772[_0x14bf('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5e5772[_0x14bf('0x15')]?_0x5e5772[_0x14bf('0x15')]['where']||null:null,'attributes':_0x5e5772['options']?_0x5e5772[_0x14bf('0x15')][_0x14bf('0x1c')]||null:null,'include':_0x5e5772[_0x14bf('0x15')]?_0x5e5772[_0x14bf('0x15')]['include']?_['map'](_0x5e5772[_0x14bf('0x15')][_0x14bf('0x19')],function(_0x1aeb3c){return{'model':db[_0x1aeb3c[_0x14bf('0x1b')]],'as':_0x1aeb3c['as'],'attributes':_0x1aeb3c['attributes'],'include':_0x1aeb3c[_0x14bf('0x19')]?_[_0x14bf('0x1a')](_0x1aeb3c[_0x14bf('0x19')],function(_0x312195){return{'model':db[_0x312195[_0x14bf('0x1b')]],'as':_0x312195['as'],'attributes':_0x312195[_0x14bf('0x1c')],'include':_0x312195['include']?_[_0x14bf('0x1a')](_0x312195['include'],function(_0x4101c4){return{'model':db[_0x4101c4[_0x14bf('0x1b')]],'as':_0x4101c4['as'],'attributes':_0x4101c4['attributes']};}):[]};}):[]};}):[]:[]})[_0x14bf('0x8')](function(_0x180d0c){logger[_0x14bf('0x9')](_0x14bf('0x1e'),_0x5e5772);logger[_0x14bf('0x1d')]('ShowDynamics365Account',_0x5e5772,JSON[_0x14bf('0xd')](_0x180d0c));_0x1c9dc1(_0x180d0c);})[_0x14bf('0x12')](function(_0x1db904){logger[_0x14bf('0xe')](_0x14bf('0x1e'),_0x1db904[_0x14bf('0x10')],_0x5e5772);_0x3c87d3(_0x2253b3[_0x14bf('0xe')](0x1f4,_0x1db904[_0x14bf('0x10')]));});});}; \ No newline at end of file +var _0xebfb=['raw','where','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Dynamics365Account','findAll','options','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','find'];(function(_0x1b03fd,_0x337db1){var _0x4bcb04=function(_0x124958){while(--_0x124958){_0x1b03fd['push'](_0x1b03fd['shift']());}};_0x4bcb04(++_0x337db1);}(_0xebfb,0x10a));var _0xbebf=function(_0x295553,_0x10b5be){_0x295553=_0x295553-0x0;var _0xd57296=_0xebfb[_0x295553];return _0xd57296;};'use strict';var _=require('lodash');var util=require(_0xbebf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbebf('0x1'));var fs=require('fs');var Redis=require(_0xbebf('0x2'));var db=require(_0xbebf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbebf('0x4'))(_0xbebf('0x5'));var config=require(_0xbebf('0x6'));var jayson=require(_0xbebf('0x7'));var client=jayson['client'][_0xbebf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a976d,_0x17651b,_0x267bd9){return new BPromise(function(_0x26dd18,_0x8aca07){return client[_0xbebf('0x9')](_0x5a976d,_0x267bd9)[_0xbebf('0xa')](function(_0x4586f1){logger[_0xbebf('0xb')](_0xbebf('0xc'),_0x17651b,_0xbebf('0xd'));logger[_0xbebf('0xe')](_0xbebf('0xf'),_0x17651b,_0xbebf('0xd'),JSON[_0xbebf('0x10')](_0x4586f1));if(_0x4586f1[_0xbebf('0x11')]){if(_0x4586f1[_0xbebf('0x11')]['code']===0x1f4){logger['error'](_0xbebf('0xc'),_0x17651b,_0x4586f1['error']['message']);return _0x8aca07(_0x4586f1[_0xbebf('0x11')][_0xbebf('0x12')]);}logger[_0xbebf('0x11')](_0xbebf('0xc'),_0x17651b,_0x4586f1['error'][_0xbebf('0x12')]);return _0x26dd18(_0x4586f1[_0xbebf('0x11')][_0xbebf('0x12')]);}else{logger[_0xbebf('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x17651b,_0xbebf('0xd'));_0x26dd18(_0x4586f1['result'][_0xbebf('0x12')]);}})[_0xbebf('0x13')](function(_0x2bee91){logger['error'](_0xbebf('0xc'),_0x17651b,_0x2bee91);_0x8aca07(_0x2bee91);});});}exports['GetDynamics365Account']=function(_0x370e94){var _0x3d7d3a=this;return new Promise(function(_0x108837,_0x5e0847){return db[_0xbebf('0x14')][_0xbebf('0x15')]({'raw':_0x370e94[_0xbebf('0x16')]?_0x370e94[_0xbebf('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x370e94[_0xbebf('0x16')]?_0x370e94[_0xbebf('0x16')]['where']||null:null,'attributes':_0x370e94[_0xbebf('0x16')]?_0x370e94['options'][_0xbebf('0x17')]||null:null,'limit':_0x370e94['options']?_0x370e94['options'][_0xbebf('0x18')]||null:null,'include':_0x370e94[_0xbebf('0x16')]?_0x370e94[_0xbebf('0x16')][_0xbebf('0x19')]?_[_0xbebf('0x1a')](_0x370e94[_0xbebf('0x16')][_0xbebf('0x19')],function(_0x5a53e1){return{'model':db[_0x5a53e1[_0xbebf('0x1b')]],'as':_0x5a53e1['as'],'attributes':_0x5a53e1[_0xbebf('0x17')],'include':_0x5a53e1[_0xbebf('0x19')]?_[_0xbebf('0x1a')](_0x5a53e1[_0xbebf('0x19')],function(_0x553fa8){return{'model':db[_0x553fa8['model']],'as':_0x553fa8['as'],'attributes':_0x553fa8[_0xbebf('0x17')],'include':_0x553fa8['include']?_['map'](_0x553fa8[_0xbebf('0x19')],function(_0x53af4e){return{'model':db[_0x53af4e[_0xbebf('0x1b')]],'as':_0x53af4e['as'],'attributes':_0x53af4e[_0xbebf('0x17')]};}):[]};}):[]};}):[]:[]})[_0xbebf('0xa')](function(_0x49a655){logger[_0xbebf('0xb')](_0xbebf('0x1c'),_0x370e94);logger['debug'](_0xbebf('0x1c'),_0x370e94,JSON[_0xbebf('0x10')](_0x49a655));_0x108837(_0x49a655);})[_0xbebf('0x13')](function(_0x1422fd){logger[_0xbebf('0x11')](_0xbebf('0x1c'),_0x1422fd['message'],_0x370e94);_0x5e0847(_0x3d7d3a[_0xbebf('0x11')](0x1f4,_0x1422fd[_0xbebf('0x12')]));});});};exports[_0xbebf('0x1d')]=function(_0x51c5e4){var _0x54f3b0=this;return new Promise(function(_0x587582,_0x3093cf){return db[_0xbebf('0x14')][_0xbebf('0x1e')]({'raw':_0x51c5e4[_0xbebf('0x16')]?_0x51c5e4[_0xbebf('0x16')][_0xbebf('0x1f')]===undefined?!![]:![]:!![],'where':_0x51c5e4[_0xbebf('0x16')]?_0x51c5e4[_0xbebf('0x16')][_0xbebf('0x20')]||null:null,'attributes':_0x51c5e4[_0xbebf('0x16')]?_0x51c5e4['options'][_0xbebf('0x17')]||null:null,'include':_0x51c5e4[_0xbebf('0x16')]?_0x51c5e4['options'][_0xbebf('0x19')]?_[_0xbebf('0x1a')](_0x51c5e4[_0xbebf('0x16')][_0xbebf('0x19')],function(_0x1b395a){return{'model':db[_0x1b395a['model']],'as':_0x1b395a['as'],'attributes':_0x1b395a['attributes'],'include':_0x1b395a[_0xbebf('0x19')]?_[_0xbebf('0x1a')](_0x1b395a[_0xbebf('0x19')],function(_0x561923){return{'model':db[_0x561923[_0xbebf('0x1b')]],'as':_0x561923['as'],'attributes':_0x561923[_0xbebf('0x17')],'include':_0x561923['include']?_['map'](_0x561923[_0xbebf('0x19')],function(_0x2db836){return{'model':db[_0x2db836[_0xbebf('0x1b')]],'as':_0x2db836['as'],'attributes':_0x2db836[_0xbebf('0x17')]};}):[]};}):[]};}):[]:[]})[_0xbebf('0xa')](function(_0x4f1cc9){logger[_0xbebf('0xb')](_0xbebf('0x1d'),_0x51c5e4);logger[_0xbebf('0xe')](_0xbebf('0x1d'),_0x51c5e4,JSON['stringify'](_0x4f1cc9));_0x587582(_0x4f1cc9);})[_0xbebf('0x13')](function(_0x5e0c4a){logger['error'](_0xbebf('0x1d'),_0x5e0c4a[_0xbebf('0x12')],_0x51c5e4);_0x3093cf(_0x54f3b0[_0xbebf('0x11')](0x1f4,_0x5e0c4a[_0xbebf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 71d3c71..5fdfcd4 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 _0xf55c=['getDescriptions','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects'];(function(_0x31e9f3,_0x3d33d8){var _0x551334=function(_0x4d72f0){while(--_0x4d72f0){_0x31e9f3['push'](_0x31e9f3['shift']());}};_0x551334(++_0x3d33d8);}(_0xf55c,0x1e7));var _0xcf55=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xf55c[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xcf55('0x0'));var util=require('util');var path=require(_0xcf55('0x1'));var timeout=require(_0xcf55('0x2'));var express=require(_0xcf55('0x3'));var router=express[_0xcf55('0x4')]();var fs_extra=require(_0xcf55('0x5'));var auth=require(_0xcf55('0x6'));var interaction=require(_0xcf55('0x7'));var config=require('../../config/environment');var controller=require(_0xcf55('0x8'));router[_0xcf55('0x9')]('/',auth[_0xcf55('0xa')](),controller[_0xcf55('0xb')]);router['get'](_0xcf55('0xc'),auth[_0xcf55('0xa')](),controller[_0xcf55('0xd')]);router[_0xcf55('0x9')]('/:id/fields',auth[_0xcf55('0xa')](),controller[_0xcf55('0xe')]);router[_0xcf55('0x9')](_0xcf55('0xf'),auth[_0xcf55('0xa')](),controller[_0xcf55('0x10')]);router[_0xcf55('0x9')]('/:id/descriptions',auth[_0xcf55('0xa')](),controller[_0xcf55('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcf55('0x12')]);router[_0xcf55('0x13')](_0xcf55('0xc'),auth[_0xcf55('0xa')](),controller[_0xcf55('0x14')]);router[_0xcf55('0x15')](_0xcf55('0xc'),auth[_0xcf55('0xa')](),controller[_0xcf55('0x16')]);module[_0xcf55('0x17')]=router; \ No newline at end of file +var _0x10d6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','update','destroy','util','path','connect-timeout','Router','fs-extra'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x10d6,0x145));var _0x610d=function(_0x4184e5,_0x176f62){_0x4184e5=_0x4184e5-0x0;var _0x200b7e=_0x10d6[_0x4184e5];return _0x200b7e;};'use strict';var multer=require('multer');var util=require(_0x610d('0x0'));var path=require(_0x610d('0x1'));var timeout=require(_0x610d('0x2'));var express=require('express');var router=express[_0x610d('0x3')]();var fs_extra=require(_0x610d('0x4'));var auth=require(_0x610d('0x5'));var interaction=require(_0x610d('0x6'));var config=require(_0x610d('0x7'));var controller=require(_0x610d('0x8'));router[_0x610d('0x9')]('/',auth['isAuthenticated'](),controller[_0x610d('0xa')]);router[_0x610d('0x9')](_0x610d('0xb'),auth[_0x610d('0xc')](),controller[_0x610d('0xd')]);router[_0x610d('0x9')](_0x610d('0xe'),auth[_0x610d('0xc')](),controller[_0x610d('0xf')]);router[_0x610d('0x9')](_0x610d('0x10'),auth[_0x610d('0xc')](),controller[_0x610d('0x11')]);router[_0x610d('0x9')]('/:id/descriptions',auth[_0x610d('0xc')](),controller[_0x610d('0x12')]);router['post']('/',auth[_0x610d('0xc')](),controller[_0x610d('0x13')]);router['put'](_0x610d('0xb'),auth[_0x610d('0xc')](),controller[_0x610d('0x14')]);router['delete'](_0x610d('0xb'),auth[_0x610d('0xc')](),controller[_0x610d('0x15')]);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 b72827c..ce21ae3 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 _0xa991=['contact','nothing','BOOLEAN','exports','STRING','ENUM','incident'];(function(_0x352e78,_0x25945c){var _0x183d3e=function(_0xfd9fb7){while(--_0xfd9fb7){_0x352e78['push'](_0x352e78['shift']());}};_0x183d3e(++_0x25945c);}(_0xa991,0x1a7));var _0x1a99=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xa991[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require('sequelize');module[_0x1a99('0x0')]={'name':{'type':Sequelize[_0x1a99('0x1')]},'description':{'type':Sequelize[_0x1a99('0x1')]},'ticketType':{'type':Sequelize[_0x1a99('0x2')](_0x1a99('0x3'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x1a99('0x4'),_0x1a99('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x1a99('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x1a99('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2d8a=['ENUM','incident','phonecall','contact','BOOLEAN','exports','STRING'];(function(_0x441315,_0x55af18){var _0x3f360c=function(_0x1fbe27){while(--_0x1fbe27){_0x441315['push'](_0x441315['shift']());}};_0x3f360c(++_0x55af18);}(_0x2d8a,0x1ef));var _0xa2d8=function(_0x396d48,_0x264959){_0x396d48=_0x396d48-0x0;var _0x5ee81c=_0x2d8a[_0x396d48];return _0x5ee81c;};'use strict';var Sequelize=require('sequelize');module[_0xa2d8('0x0')]={'name':{'type':Sequelize[_0xa2d8('0x1')]},'description':{'type':Sequelize[_0xa2d8('0x1')]},'ticketType':{'type':Sequelize[_0xa2d8('0x2')](_0xa2d8('0x3'),_0xa2d8('0x4')),'defaultValue':_0xa2d8('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0xa2d8('0x5'),'nothing'),'defaultValue':_0xa2d8('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xa2d8('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 b7e51e8..b385be4 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 _0xf45d=['../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','Dynamics365Configuration','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','length','find','create','body','getFields','findOne','options','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x2f7371,_0x17edd0){var _0x15024c=function(_0x4fe539){while(--_0x4fe539){_0x2f7371['push'](_0x2f7371['shift']());}};_0x15024c(++_0x17edd0);}(_0xf45d,0x8c));var _0xdf45=function(_0x26c9ff,_0x1ac963){_0x26c9ff=_0x26c9ff-0x0;var _0x26af67=_0xf45d[_0x26c9ff];return _0x26af67;};'use strict';var emlformat=require(_0xdf45('0x0'));var rimraf=require(_0xdf45('0x1'));var zipdir=require(_0xdf45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf45('0x3'));var moment=require('moment');var BPromise=require(_0xdf45('0x4'));var Mustache=require(_0xdf45('0x5'));var util=require('util');var path=require(_0xdf45('0x6'));var sox=require(_0xdf45('0x7'));var csv=require(_0xdf45('0x8'));var ejs=require(_0xdf45('0x9'));var fs=require('fs');var fs_extra=require(_0xdf45('0xa'));var _=require(_0xdf45('0xb'));var squel=require(_0xdf45('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdf45('0x8'));var querystring=require(_0xdf45('0xd'));var Papa=require('papaparse');var Redis=require(_0xdf45('0xe'));var authService=require(_0xdf45('0xf'));var qs=require(_0xdf45('0x10'));var as=require(_0xdf45('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf45('0x12'))(_0xdf45('0x13'));var utils=require(_0xdf45('0x14'));var config=require(_0xdf45('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf45('0x16'))['db'];function respondWithStatusCode(_0x58db1e,_0x44beed){_0x44beed=_0x44beed||0xcc;return function(_0x3f5c36){if(_0x3f5c36){return _0x58db1e['sendStatus'](_0x44beed);}return _0x58db1e[_0xdf45('0x17')](_0x44beed)[_0xdf45('0x18')]();};}function respondWithResult(_0xc78ff5,_0x2733be){_0x2733be=_0x2733be||0xc8;return function(_0x2ea845){if(_0x2ea845){return _0xc78ff5[_0xdf45('0x17')](_0x2733be)[_0xdf45('0x19')](_0x2ea845);}};}function respondWithFilteredResult(_0x1fcab8,_0x3a63b2){return function(_0x183c43){if(_0x183c43){var _0x4078e5=typeof _0x3a63b2[_0xdf45('0x1a')]===_0xdf45('0x1b')&&typeof _0x3a63b2[_0xdf45('0x1c')]==='undefined';var _0x14ac08=_0x183c43[_0xdf45('0x1d')];var _0xd1bdc6=_0x4078e5?0x0:_0x3a63b2['offset'];var _0x4605ba=_0x4078e5?_0x183c43['count']:_0x3a63b2[_0xdf45('0x1a')]+_0x3a63b2[_0xdf45('0x1c')];var _0x2c690f;if(_0x4605ba>=_0x14ac08){_0x4605ba=_0x14ac08;_0x2c690f=0xc8;}else{_0x2c690f=0xce;}_0x1fcab8[_0xdf45('0x17')](_0x2c690f);return _0x1fcab8[_0xdf45('0x1e')](_0xdf45('0x1f'),_0xd1bdc6+'-'+_0x4605ba+'/'+_0x14ac08)[_0xdf45('0x19')](_0x183c43);}return null;};}function patchUpdates(_0x4b40f0){return function(_0x58bf76){try{jsonpatch[_0xdf45('0x20')](_0x58bf76,_0x4b40f0,!![]);}catch(_0x4918cd){return BPromise[_0xdf45('0x21')](_0x4918cd);}return _0x58bf76[_0xdf45('0x22')]();};}function saveUpdates(_0x268809,_0x21448b){return function(_0x489824){if(_0x489824){return _0x489824[_0xdf45('0x23')](_0x268809)[_0xdf45('0x24')](function(_0x4c7975){return _0x4c7975;});}return null;};}function removeEntity(_0x1d4730,_0x473e4b){return function(_0x40f920){if(_0x40f920){return _0x40f920[_0xdf45('0x25')]()[_0xdf45('0x24')](function(){_0x1d4730[_0xdf45('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3363bd,_0xbc4bf4){return function(_0x1ac458){if(!_0x1ac458){_0x3363bd[_0xdf45('0x26')](0x194);}return _0x1ac458;};}function handleError(_0x3d0fb4,_0x3c35ed){_0x3c35ed=_0x3c35ed||0x1f4;return function(_0x4ed652){logger['error'](_0x4ed652[_0xdf45('0x27')]);if(_0x4ed652[_0xdf45('0x28')]){delete _0x4ed652[_0xdf45('0x28')];}_0x3d0fb4[_0xdf45('0x17')](_0x3c35ed)['send'](_0x4ed652);};}exports[_0xdf45('0x29')]=function(_0x2ef066,_0x1297b5){var _0xff409a={},_0x5e8a69={},_0x3f649c={'count':0x0,'rows':[]};var _0x3b04e4=_['map'](db[_0xdf45('0x2a')][_0xdf45('0x2b')],function(_0x168417){return{'name':_0x168417[_0xdf45('0x2c')],'type':_0x168417['type'][_0xdf45('0x2d')]};});_0x5e8a69['model']=_[_0xdf45('0x2e')](_0x3b04e4,'name');_0x5e8a69[_0xdf45('0x2f')]=_['keys'](_0x2ef066[_0xdf45('0x2f')]);_0x5e8a69[_0xdf45('0x30')]=_[_0xdf45('0x31')](_0x5e8a69[_0xdf45('0x32')],_0x5e8a69[_0xdf45('0x2f')]);_0xff409a[_0xdf45('0x33')]=_[_0xdf45('0x31')](_0x5e8a69[_0xdf45('0x32')],qs[_0xdf45('0x34')](_0x2ef066[_0xdf45('0x2f')][_0xdf45('0x34')]));_0xff409a[_0xdf45('0x33')]=_0xff409a[_0xdf45('0x33')]['length']?_0xff409a[_0xdf45('0x33')]:_0x5e8a69[_0xdf45('0x32')];if(!_0x2ef066[_0xdf45('0x2f')][_0xdf45('0x35')](_0xdf45('0x36'))){_0xff409a[_0xdf45('0x1c')]=qs[_0xdf45('0x1c')](_0x2ef066[_0xdf45('0x2f')]['limit']);_0xff409a[_0xdf45('0x1a')]=qs[_0xdf45('0x1a')](_0x2ef066[_0xdf45('0x2f')][_0xdf45('0x1a')]);}_0xff409a[_0xdf45('0x37')]=qs['sort'](_0x2ef066[_0xdf45('0x2f')][_0xdf45('0x38')]);_0xff409a[_0xdf45('0x39')]=qs[_0xdf45('0x30')](_[_0xdf45('0x3a')](_0x2ef066[_0xdf45('0x2f')],_0x5e8a69[_0xdf45('0x30')]),_0x3b04e4);if(_0x2ef066[_0xdf45('0x2f')]['filter']){_0xff409a['where']=_[_0xdf45('0x3b')](_0xff409a[_0xdf45('0x39')],{'$or':_['map'](_0x3b04e4,function(_0x65d643){if(_0x65d643[_0xdf45('0x3c')]!==_0xdf45('0x3d')){var _0x259b74={};_0x259b74[_0x65d643[_0xdf45('0x28')]]={'$like':'%'+_0x2ef066[_0xdf45('0x2f')][_0xdf45('0x3e')]+'%'};return _0x259b74;}})});}_0xff409a=_[_0xdf45('0x3b')]({},_0xff409a,_0x2ef066['options']);var _0x27be9f={'where':_0xff409a[_0xdf45('0x39')]};return db['Dynamics365Configuration'][_0xdf45('0x1d')](_0x27be9f)[_0xdf45('0x24')](function(_0x27944b){_0x3f649c['count']=_0x27944b;if(_0x2ef066[_0xdf45('0x2f')][_0xdf45('0x3f')]){_0xff409a['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xdf45('0x40')](_0xff409a);})[_0xdf45('0x24')](function(_0x35fd13){_0x3f649c[_0xdf45('0x41')]=_0x35fd13;return _0x3f649c;})[_0xdf45('0x24')](respondWithFilteredResult(_0x1297b5,_0xff409a))[_0xdf45('0x42')](handleError(_0x1297b5,null));};exports[_0xdf45('0x43')]=function(_0x2e1d9c,_0x22dc81){var _0x32d55d={'raw':![],'where':{'id':_0x2e1d9c[_0xdf45('0x44')]['id']}},_0x29b88f={};_0x29b88f[_0xdf45('0x32')]=_[_0xdf45('0x45')](db[_0xdf45('0x2a')][_0xdf45('0x2b')]);_0x29b88f[_0xdf45('0x2f')]=_['keys'](_0x2e1d9c[_0xdf45('0x2f')]);_0x29b88f['filters']=_['intersection'](_0x29b88f[_0xdf45('0x32')],_0x29b88f[_0xdf45('0x2f')]);_0x32d55d[_0xdf45('0x33')]=_['intersection'](_0x29b88f[_0xdf45('0x32')],qs[_0xdf45('0x34')](_0x2e1d9c[_0xdf45('0x2f')][_0xdf45('0x34')]));_0x32d55d[_0xdf45('0x33')]=_0x32d55d[_0xdf45('0x33')][_0xdf45('0x46')]?_0x32d55d['attributes']:_0x29b88f[_0xdf45('0x32')];if(_0x2e1d9c['query'][_0xdf45('0x3f')]){_0x32d55d['include']=[{'all':!![]}];}_0x32d55d=_[_0xdf45('0x3b')]({},_0x32d55d,_0x2e1d9c['options']);return db[_0xdf45('0x2a')][_0xdf45('0x47')](_0x32d55d)['then'](handleEntityNotFound(_0x22dc81,null))['then'](respondWithResult(_0x22dc81,null))[_0xdf45('0x42')](handleError(_0x22dc81,null));};exports['create']=function(_0x1bd13e,_0x26bf6f){return db[_0xdf45('0x2a')][_0xdf45('0x48')](_0x1bd13e['body'],{})[_0xdf45('0x24')](respondWithResult(_0x26bf6f,0xc9))['catch'](handleError(_0x26bf6f,null));};exports[_0xdf45('0x23')]=function(_0x1df376,_0x20f770){if(_0x1df376[_0xdf45('0x49')]['id']){delete _0x1df376[_0xdf45('0x49')]['id'];}return db[_0xdf45('0x2a')]['find']({'where':{'id':_0x1df376[_0xdf45('0x44')]['id']}})[_0xdf45('0x24')](handleEntityNotFound(_0x20f770,null))[_0xdf45('0x24')](saveUpdates(_0x1df376[_0xdf45('0x49')],null))[_0xdf45('0x24')](respondWithResult(_0x20f770,null))[_0xdf45('0x42')](handleError(_0x20f770,null));};exports['destroy']=function(_0x46e6db,_0x4dbc26){return db[_0xdf45('0x2a')][_0xdf45('0x47')]({'where':{'id':_0x46e6db[_0xdf45('0x44')]['id']}})[_0xdf45('0x24')](handleEntityNotFound(_0x4dbc26,null))[_0xdf45('0x24')](removeEntity(_0x4dbc26,null))[_0xdf45('0x42')](handleError(_0x4dbc26,null));};exports[_0xdf45('0x4a')]=function(_0x57a721,_0x943b72,_0x6a509a){var _0x4f4c19={};var _0x4c9528={};var _0x524004;var _0x23d086;return db[_0xdf45('0x2a')][_0xdf45('0x4b')]({'where':{'id':_0x57a721['params']['id']}})[_0xdf45('0x24')](handleEntityNotFound(_0x943b72,null))[_0xdf45('0x24')](function(_0x2716d5){if(_0x2716d5){_0x524004=_0x2716d5;_0x4c9528[_0xdf45('0x32')]=_[_0xdf45('0x45')](db['Dynamics365Field']['rawAttributes']);_0x4c9528['query']=_[_0xdf45('0x45')](_0x57a721[_0xdf45('0x2f')]);_0x4c9528['filters']=_['intersection'](_0x4c9528[_0xdf45('0x32')],_0x4c9528[_0xdf45('0x2f')]);_0x4f4c19['attributes']=_[_0xdf45('0x31')](_0x4c9528[_0xdf45('0x32')],qs['fields'](_0x57a721[_0xdf45('0x2f')][_0xdf45('0x34')]));_0x4f4c19[_0xdf45('0x33')]=_0x4f4c19[_0xdf45('0x33')][_0xdf45('0x46')]?_0x4f4c19['attributes']:_0x4c9528[_0xdf45('0x32')];_0x4f4c19[_0xdf45('0x37')]=qs[_0xdf45('0x38')](_0x57a721['query'][_0xdf45('0x38')]);_0x4f4c19['where']=qs[_0xdf45('0x30')](_[_0xdf45('0x3a')](_0x57a721[_0xdf45('0x2f')],_0x4c9528[_0xdf45('0x30')]));if(_0x57a721['query'][_0xdf45('0x3e')]){_0x4f4c19[_0xdf45('0x39')]=_[_0xdf45('0x3b')](_0x4f4c19[_0xdf45('0x39')],{'$or':_[_0xdf45('0x2e')](_0x4f4c19[_0xdf45('0x33')],function(_0x3c649b){var _0x3bceed={};_0x3bceed[_0x3c649b]={'$like':'%'+_0x57a721[_0xdf45('0x2f')][_0xdf45('0x3e')]+'%'};return _0x3bceed;})});}_0x4f4c19=_['merge']({},_0x4f4c19,_0x57a721[_0xdf45('0x4c')]);return _0x524004['getFields'](_0x4f4c19);}})[_0xdf45('0x24')](function(_0x5ffd6b){if(_0x5ffd6b){_0x23d086=_0x5ffd6b['length'];if(!_0x57a721[_0xdf45('0x2f')][_0xdf45('0x35')](_0xdf45('0x36'))){_0x4f4c19[_0xdf45('0x1c')]=qs[_0xdf45('0x1c')](_0x57a721[_0xdf45('0x2f')][_0xdf45('0x1c')]);_0x4f4c19[_0xdf45('0x1a')]=qs[_0xdf45('0x1a')](_0x57a721['query'][_0xdf45('0x1a')]);}return _0x524004[_0xdf45('0x4a')](_0x4f4c19);}})[_0xdf45('0x24')](function(_0x36902b){if(_0x36902b){return _0x36902b?{'count':_0x23d086,'rows':_0x36902b}:null;}})[_0xdf45('0x24')](respondWithResult(_0x943b72,null))[_0xdf45('0x42')](handleError(_0x943b72,null));};exports['getSubjects']=function(_0x21a4b1,_0x5477e9,_0x2fde3d){var _0x1ddda3={};var _0x3dd85e={};var _0x3b9774;var _0x58abfa;return db[_0xdf45('0x2a')][_0xdf45('0x4b')]({'where':{'id':_0x21a4b1[_0xdf45('0x44')]['id']}})[_0xdf45('0x24')](handleEntityNotFound(_0x5477e9,null))[_0xdf45('0x24')](function(_0x413a7a){if(_0x413a7a){_0x3b9774=_0x413a7a;_0x3dd85e[_0xdf45('0x32')]=_[_0xdf45('0x45')](db[_0xdf45('0x4d')]['rawAttributes']);_0x3dd85e['query']=_['keys'](_0x21a4b1[_0xdf45('0x2f')]);_0x3dd85e[_0xdf45('0x30')]=_['intersection'](_0x3dd85e[_0xdf45('0x32')],_0x3dd85e[_0xdf45('0x2f')]);_0x1ddda3['attributes']=_[_0xdf45('0x31')](_0x3dd85e['model'],qs[_0xdf45('0x34')](_0x21a4b1['query']['fields']));_0x1ddda3[_0xdf45('0x33')]=_0x1ddda3[_0xdf45('0x33')][_0xdf45('0x46')]?_0x1ddda3[_0xdf45('0x33')]:_0x3dd85e[_0xdf45('0x32')];_0x1ddda3[_0xdf45('0x37')]=qs[_0xdf45('0x38')](_0x21a4b1[_0xdf45('0x2f')][_0xdf45('0x38')]);_0x1ddda3['where']=qs['filters'](_[_0xdf45('0x3a')](_0x21a4b1[_0xdf45('0x2f')],_0x3dd85e[_0xdf45('0x30')]));if(_0x21a4b1[_0xdf45('0x2f')][_0xdf45('0x3e')]){_0x1ddda3[_0xdf45('0x39')]=_[_0xdf45('0x3b')](_0x1ddda3['where'],{'$or':_[_0xdf45('0x2e')](_0x1ddda3[_0xdf45('0x33')],function(_0x443ac7){var _0x25f2ff={};_0x25f2ff[_0x443ac7]={'$like':'%'+_0x21a4b1[_0xdf45('0x2f')]['filter']+'%'};return _0x25f2ff;})});}_0x1ddda3=_[_0xdf45('0x3b')]({},_0x1ddda3,_0x21a4b1[_0xdf45('0x4c')]);return _0x3b9774[_0xdf45('0x4e')](_0x1ddda3);}})[_0xdf45('0x24')](function(_0x5d6fa7){if(_0x5d6fa7){_0x58abfa=_0x5d6fa7[_0xdf45('0x46')];if(!_0x21a4b1[_0xdf45('0x2f')][_0xdf45('0x35')]('nolimit')){_0x1ddda3[_0xdf45('0x1c')]=qs[_0xdf45('0x1c')](_0x21a4b1[_0xdf45('0x2f')]['limit']);_0x1ddda3['offset']=qs[_0xdf45('0x1a')](_0x21a4b1[_0xdf45('0x2f')]['offset']);}return _0x3b9774[_0xdf45('0x4e')](_0x1ddda3);}})['then'](function(_0x2d1674){if(_0x2d1674){return _0x2d1674?{'count':_0x58abfa,'rows':_0x2d1674}:null;}})[_0xdf45('0x24')](respondWithResult(_0x5477e9,null))[_0xdf45('0x42')](handleError(_0x5477e9,null));};exports[_0xdf45('0x4f')]=function(_0x36eb46,_0x17a744,_0xeebb22){var _0xa3bf9e={};var _0x472036={};var _0x58bb0c;var _0x5c472b;return db['Dynamics365Configuration'][_0xdf45('0x4b')]({'where':{'id':_0x36eb46[_0xdf45('0x44')]['id']}})[_0xdf45('0x24')](handleEntityNotFound(_0x17a744,null))[_0xdf45('0x24')](function(_0x4ff603){if(_0x4ff603){_0x58bb0c=_0x4ff603;_0x472036[_0xdf45('0x32')]=_['keys'](db[_0xdf45('0x4d')][_0xdf45('0x2b')]);_0x472036[_0xdf45('0x2f')]=_['keys'](_0x36eb46['query']);_0x472036[_0xdf45('0x30')]=_['intersection'](_0x472036['model'],_0x472036['query']);_0xa3bf9e['attributes']=_['intersection'](_0x472036[_0xdf45('0x32')],qs['fields'](_0x36eb46[_0xdf45('0x2f')][_0xdf45('0x34')]));_0xa3bf9e[_0xdf45('0x33')]=_0xa3bf9e['attributes'][_0xdf45('0x46')]?_0xa3bf9e['attributes']:_0x472036[_0xdf45('0x32')];_0xa3bf9e['order']=qs[_0xdf45('0x38')](_0x36eb46[_0xdf45('0x2f')][_0xdf45('0x38')]);_0xa3bf9e[_0xdf45('0x39')]=qs[_0xdf45('0x30')](_[_0xdf45('0x3a')](_0x36eb46[_0xdf45('0x2f')],_0x472036[_0xdf45('0x30')]));if(_0x36eb46[_0xdf45('0x2f')]['filter']){_0xa3bf9e['where']=_[_0xdf45('0x3b')](_0xa3bf9e['where'],{'$or':_[_0xdf45('0x2e')](_0xa3bf9e[_0xdf45('0x33')],function(_0x17d87c){var _0x256648={};_0x256648[_0x17d87c]={'$like':'%'+_0x36eb46[_0xdf45('0x2f')]['filter']+'%'};return _0x256648;})});}_0xa3bf9e=_[_0xdf45('0x3b')]({},_0xa3bf9e,_0x36eb46['options']);return _0x58bb0c[_0xdf45('0x4f')](_0xa3bf9e);}})[_0xdf45('0x24')](function(_0x470f16){if(_0x470f16){_0x5c472b=_0x470f16[_0xdf45('0x46')];if(!_0x36eb46[_0xdf45('0x2f')][_0xdf45('0x35')](_0xdf45('0x36'))){_0xa3bf9e['limit']=qs[_0xdf45('0x1c')](_0x36eb46[_0xdf45('0x2f')][_0xdf45('0x1c')]);_0xa3bf9e[_0xdf45('0x1a')]=qs[_0xdf45('0x1a')](_0x36eb46[_0xdf45('0x2f')][_0xdf45('0x1a')]);}return _0x58bb0c[_0xdf45('0x4f')](_0xa3bf9e);}})[_0xdf45('0x24')](function(_0x3fb5af){if(_0x3fb5af){return _0x3fb5af?{'count':_0x5c472b,'rows':_0x3fb5af}:null;}})['then'](respondWithResult(_0x17a744,null))[_0xdf45('0x42')](handleError(_0x17a744,null));}; \ No newline at end of file +var _0xbd77=['keys','options','find','create','body','getFields','findOne','hasOwnProperty','nolimit','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','error','name','send','index','rawAttributes','fieldName','map','query','filters','attributes','intersection','model','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','Dynamics365Configuration','then','includeAll','include','catch','show','params'];(function(_0x29d4b5,_0x1913e2){var _0x3fbb01=function(_0x8b0a41){while(--_0x8b0a41){_0x29d4b5['push'](_0x29d4b5['shift']());}};_0x3fbb01(++_0x1913e2);}(_0xbd77,0x183));var _0x7bd7=function(_0x472995,_0x269d98){_0x472995=_0x472995-0x0;var _0x521303=_0xbd77[_0x472995];return _0x521303;};'use strict';var emlformat=require(_0x7bd7('0x0'));var rimraf=require(_0x7bd7('0x1'));var zipdir=require(_0x7bd7('0x2'));var jsonpatch=require(_0x7bd7('0x3'));var rp=require('request-promise');var moment=require(_0x7bd7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7bd7('0x5'));var util=require(_0x7bd7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7bd7('0x7'));var ejs=require(_0x7bd7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bd7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bd7('0xa'));var deskjs=require(_0x7bd7('0xb'));var toCsv=require(_0x7bd7('0x7'));var querystring=require(_0x7bd7('0xc'));var Papa=require('papaparse');var Redis=require(_0x7bd7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7bd7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bd7('0xf'));var logger=require(_0x7bd7('0x10'))(_0x7bd7('0x11'));var utils=require(_0x7bd7('0x12'));var config=require(_0x7bd7('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c67d4,_0x1f5f85){_0x1f5f85=_0x1f5f85||0xcc;return function(_0x58d04b){if(_0x58d04b){return _0x5c67d4[_0x7bd7('0x14')](_0x1f5f85);}return _0x5c67d4[_0x7bd7('0x15')](_0x1f5f85)[_0x7bd7('0x16')]();};}function respondWithResult(_0x3ed067,_0x452b3e){_0x452b3e=_0x452b3e||0xc8;return function(_0xd43e41){if(_0xd43e41){return _0x3ed067[_0x7bd7('0x15')](_0x452b3e)[_0x7bd7('0x17')](_0xd43e41);}};}function respondWithFilteredResult(_0xf7f217,_0x4abc6d){return function(_0xa27113){if(_0xa27113){var _0x2c7e7e=typeof _0x4abc6d[_0x7bd7('0x18')]==='undefined'&&typeof _0x4abc6d[_0x7bd7('0x19')]===_0x7bd7('0x1a');var _0xaa218b=_0xa27113[_0x7bd7('0x1b')];var _0x5eac75=_0x2c7e7e?0x0:_0x4abc6d[_0x7bd7('0x18')];var _0x3dc2fd=_0x2c7e7e?_0xa27113[_0x7bd7('0x1b')]:_0x4abc6d[_0x7bd7('0x18')]+_0x4abc6d[_0x7bd7('0x19')];var _0x565133;if(_0x3dc2fd>=_0xaa218b){_0x3dc2fd=_0xaa218b;_0x565133=0xc8;}else{_0x565133=0xce;}_0xf7f217['status'](_0x565133);return _0xf7f217[_0x7bd7('0x1c')](_0x7bd7('0x1d'),_0x5eac75+'-'+_0x3dc2fd+'/'+_0xaa218b)['json'](_0xa27113);}return null;};}function patchUpdates(_0x46da50){return function(_0x41bf70){try{jsonpatch[_0x7bd7('0x1e')](_0x41bf70,_0x46da50,!![]);}catch(_0x3cb6ae){return BPromise[_0x7bd7('0x1f')](_0x3cb6ae);}return _0x41bf70[_0x7bd7('0x20')]();};}function saveUpdates(_0x4df200,_0x218523){return function(_0x16bb46){if(_0x16bb46){return _0x16bb46['update'](_0x4df200)['then'](function(_0x10df86){return _0x10df86;});}return null;};}function removeEntity(_0x443ab5,_0x41cdac){return function(_0x13c9e5){if(_0x13c9e5){return _0x13c9e5[_0x7bd7('0x21')]()['then'](function(){_0x443ab5['status'](0xcc)[_0x7bd7('0x16')]();});}};}function handleEntityNotFound(_0x54be69,_0x3a1ad3){return function(_0xe6a939){if(!_0xe6a939){_0x54be69['sendStatus'](0x194);}return _0xe6a939;};}function handleError(_0x30a9a5,_0x5acda1){_0x5acda1=_0x5acda1||0x1f4;return function(_0x5e4578){logger[_0x7bd7('0x22')](_0x5e4578['stack']);if(_0x5e4578[_0x7bd7('0x23')]){delete _0x5e4578[_0x7bd7('0x23')];}_0x30a9a5['status'](_0x5acda1)[_0x7bd7('0x24')](_0x5e4578);};}exports[_0x7bd7('0x25')]=function(_0x12faf3,_0x428b48){var _0x3fa5ae={},_0xeb5461={},_0x5a8ad6={'count':0x0,'rows':[]};var _0x16042d=_['map'](db['Dynamics365Configuration'][_0x7bd7('0x26')],function(_0x28e57c){return{'name':_0x28e57c[_0x7bd7('0x27')],'type':_0x28e57c['type']['key']};});_0xeb5461['model']=_[_0x7bd7('0x28')](_0x16042d,_0x7bd7('0x23'));_0xeb5461[_0x7bd7('0x29')]=_['keys'](_0x12faf3[_0x7bd7('0x29')]);_0xeb5461[_0x7bd7('0x2a')]=_['intersection'](_0xeb5461['model'],_0xeb5461[_0x7bd7('0x29')]);_0x3fa5ae[_0x7bd7('0x2b')]=_[_0x7bd7('0x2c')](_0xeb5461[_0x7bd7('0x2d')],qs[_0x7bd7('0x2e')](_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x2e')]));_0x3fa5ae[_0x7bd7('0x2b')]=_0x3fa5ae[_0x7bd7('0x2b')][_0x7bd7('0x2f')]?_0x3fa5ae[_0x7bd7('0x2b')]:_0xeb5461[_0x7bd7('0x2d')];if(!_0x12faf3[_0x7bd7('0x29')]['hasOwnProperty']('nolimit')){_0x3fa5ae['limit']=qs[_0x7bd7('0x19')](_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x19')]);_0x3fa5ae[_0x7bd7('0x18')]=qs[_0x7bd7('0x18')](_0x12faf3[_0x7bd7('0x29')]['offset']);}_0x3fa5ae[_0x7bd7('0x30')]=qs[_0x7bd7('0x31')](_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x31')]);_0x3fa5ae[_0x7bd7('0x32')]=qs['filters'](_[_0x7bd7('0x33')](_0x12faf3['query'],_0xeb5461[_0x7bd7('0x2a')]),_0x16042d);if(_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x34')]){_0x3fa5ae['where']=_['merge'](_0x3fa5ae['where'],{'$or':_[_0x7bd7('0x28')](_0x16042d,function(_0x5bfc91){if(_0x5bfc91[_0x7bd7('0x35')]!==_0x7bd7('0x36')){var _0x13e940={};_0x13e940[_0x5bfc91[_0x7bd7('0x23')]]={'$like':'%'+_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x34')]+'%'};return _0x13e940;}})});}_0x3fa5ae=_[_0x7bd7('0x37')]({},_0x3fa5ae,_0x12faf3['options']);var _0x20cc0e={'where':_0x3fa5ae[_0x7bd7('0x32')]};return db[_0x7bd7('0x38')]['count'](_0x20cc0e)[_0x7bd7('0x39')](function(_0x2fb9c8){_0x5a8ad6[_0x7bd7('0x1b')]=_0x2fb9c8;if(_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x3a')]){_0x3fa5ae[_0x7bd7('0x3b')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x3fa5ae);})[_0x7bd7('0x39')](function(_0x11a3f3){_0x5a8ad6['rows']=_0x11a3f3;return _0x5a8ad6;})[_0x7bd7('0x39')](respondWithFilteredResult(_0x428b48,_0x3fa5ae))[_0x7bd7('0x3c')](handleError(_0x428b48,null));};exports[_0x7bd7('0x3d')]=function(_0x1ec57d,_0x2999f2){var _0x2541d2={'raw':![],'where':{'id':_0x1ec57d[_0x7bd7('0x3e')]['id']}},_0x565cb8={};_0x565cb8[_0x7bd7('0x2d')]=_[_0x7bd7('0x3f')](db[_0x7bd7('0x38')][_0x7bd7('0x26')]);_0x565cb8[_0x7bd7('0x29')]=_[_0x7bd7('0x3f')](_0x1ec57d[_0x7bd7('0x29')]);_0x565cb8['filters']=_[_0x7bd7('0x2c')](_0x565cb8[_0x7bd7('0x2d')],_0x565cb8[_0x7bd7('0x29')]);_0x2541d2[_0x7bd7('0x2b')]=_[_0x7bd7('0x2c')](_0x565cb8[_0x7bd7('0x2d')],qs[_0x7bd7('0x2e')](_0x1ec57d[_0x7bd7('0x29')][_0x7bd7('0x2e')]));_0x2541d2['attributes']=_0x2541d2[_0x7bd7('0x2b')]['length']?_0x2541d2[_0x7bd7('0x2b')]:_0x565cb8['model'];if(_0x1ec57d[_0x7bd7('0x29')][_0x7bd7('0x3a')]){_0x2541d2['include']=[{'all':!![]}];}_0x2541d2=_['merge']({},_0x2541d2,_0x1ec57d[_0x7bd7('0x40')]);return db[_0x7bd7('0x38')][_0x7bd7('0x41')](_0x2541d2)[_0x7bd7('0x39')](handleEntityNotFound(_0x2999f2,null))['then'](respondWithResult(_0x2999f2,null))[_0x7bd7('0x3c')](handleError(_0x2999f2,null));};exports[_0x7bd7('0x42')]=function(_0x17ae14,_0x553c7a){return db[_0x7bd7('0x38')][_0x7bd7('0x42')](_0x17ae14[_0x7bd7('0x43')],{})[_0x7bd7('0x39')](respondWithResult(_0x553c7a,0xc9))[_0x7bd7('0x3c')](handleError(_0x553c7a,null));};exports['update']=function(_0x2488d1,_0x32843b){if(_0x2488d1['body']['id']){delete _0x2488d1['body']['id'];}return db['Dynamics365Configuration'][_0x7bd7('0x41')]({'where':{'id':_0x2488d1[_0x7bd7('0x3e')]['id']}})[_0x7bd7('0x39')](handleEntityNotFound(_0x32843b,null))[_0x7bd7('0x39')](saveUpdates(_0x2488d1['body'],null))['then'](respondWithResult(_0x32843b,null))[_0x7bd7('0x3c')](handleError(_0x32843b,null));};exports[_0x7bd7('0x21')]=function(_0x4455bd,_0x5d97fb){return db[_0x7bd7('0x38')][_0x7bd7('0x41')]({'where':{'id':_0x4455bd[_0x7bd7('0x3e')]['id']}})[_0x7bd7('0x39')](handleEntityNotFound(_0x5d97fb,null))[_0x7bd7('0x39')](removeEntity(_0x5d97fb,null))[_0x7bd7('0x3c')](handleError(_0x5d97fb,null));};exports[_0x7bd7('0x44')]=function(_0x3ed5e2,_0x4ae082,_0x138959){var _0x5501ff={};var _0x3ce2f4={};var _0x42fb4b;var _0x2d9ebb;return db[_0x7bd7('0x38')][_0x7bd7('0x45')]({'where':{'id':_0x3ed5e2[_0x7bd7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4ae082,null))['then'](function(_0x2f61f7){if(_0x2f61f7){_0x42fb4b=_0x2f61f7;_0x3ce2f4[_0x7bd7('0x2d')]=_[_0x7bd7('0x3f')](db['Dynamics365Field'][_0x7bd7('0x26')]);_0x3ce2f4[_0x7bd7('0x29')]=_[_0x7bd7('0x3f')](_0x3ed5e2[_0x7bd7('0x29')]);_0x3ce2f4['filters']=_['intersection'](_0x3ce2f4[_0x7bd7('0x2d')],_0x3ce2f4[_0x7bd7('0x29')]);_0x5501ff[_0x7bd7('0x2b')]=_[_0x7bd7('0x2c')](_0x3ce2f4[_0x7bd7('0x2d')],qs['fields'](_0x3ed5e2[_0x7bd7('0x29')][_0x7bd7('0x2e')]));_0x5501ff[_0x7bd7('0x2b')]=_0x5501ff['attributes']['length']?_0x5501ff['attributes']:_0x3ce2f4['model'];_0x5501ff['order']=qs[_0x7bd7('0x31')](_0x3ed5e2['query']['sort']);_0x5501ff[_0x7bd7('0x32')]=qs[_0x7bd7('0x2a')](_[_0x7bd7('0x33')](_0x3ed5e2[_0x7bd7('0x29')],_0x3ce2f4[_0x7bd7('0x2a')]));if(_0x3ed5e2['query'][_0x7bd7('0x34')]){_0x5501ff[_0x7bd7('0x32')]=_[_0x7bd7('0x37')](_0x5501ff[_0x7bd7('0x32')],{'$or':_[_0x7bd7('0x28')](_0x5501ff[_0x7bd7('0x2b')],function(_0x547300){var _0x54e3f7={};_0x54e3f7[_0x547300]={'$like':'%'+_0x3ed5e2[_0x7bd7('0x29')][_0x7bd7('0x34')]+'%'};return _0x54e3f7;})});}_0x5501ff=_[_0x7bd7('0x37')]({},_0x5501ff,_0x3ed5e2[_0x7bd7('0x40')]);return _0x42fb4b['getFields'](_0x5501ff);}})[_0x7bd7('0x39')](function(_0x376375){if(_0x376375){_0x2d9ebb=_0x376375[_0x7bd7('0x2f')];if(!_0x3ed5e2[_0x7bd7('0x29')][_0x7bd7('0x46')](_0x7bd7('0x47'))){_0x5501ff[_0x7bd7('0x19')]=qs['limit'](_0x3ed5e2['query'][_0x7bd7('0x19')]);_0x5501ff[_0x7bd7('0x18')]=qs[_0x7bd7('0x18')](_0x3ed5e2['query']['offset']);}return _0x42fb4b['getFields'](_0x5501ff);}})['then'](function(_0x42390d){if(_0x42390d){return _0x42390d?{'count':_0x2d9ebb,'rows':_0x42390d}:null;}})[_0x7bd7('0x39')](respondWithResult(_0x4ae082,null))[_0x7bd7('0x3c')](handleError(_0x4ae082,null));};exports['getSubjects']=function(_0x3872b6,_0x469516,_0xda8829){var _0x29d0d5={};var _0x13f91d={};var _0x6d9222;var _0x849a20;return db[_0x7bd7('0x38')][_0x7bd7('0x45')]({'where':{'id':_0x3872b6['params']['id']}})[_0x7bd7('0x39')](handleEntityNotFound(_0x469516,null))['then'](function(_0x13a9e0){if(_0x13a9e0){_0x6d9222=_0x13a9e0;_0x13f91d[_0x7bd7('0x2d')]=_[_0x7bd7('0x3f')](db['Dynamics365Field'][_0x7bd7('0x26')]);_0x13f91d[_0x7bd7('0x29')]=_[_0x7bd7('0x3f')](_0x3872b6[_0x7bd7('0x29')]);_0x13f91d[_0x7bd7('0x2a')]=_[_0x7bd7('0x2c')](_0x13f91d[_0x7bd7('0x2d')],_0x13f91d[_0x7bd7('0x29')]);_0x29d0d5['attributes']=_[_0x7bd7('0x2c')](_0x13f91d[_0x7bd7('0x2d')],qs[_0x7bd7('0x2e')](_0x3872b6[_0x7bd7('0x29')]['fields']));_0x29d0d5[_0x7bd7('0x2b')]=_0x29d0d5[_0x7bd7('0x2b')][_0x7bd7('0x2f')]?_0x29d0d5[_0x7bd7('0x2b')]:_0x13f91d[_0x7bd7('0x2d')];_0x29d0d5[_0x7bd7('0x30')]=qs[_0x7bd7('0x31')](_0x3872b6['query']['sort']);_0x29d0d5['where']=qs['filters'](_[_0x7bd7('0x33')](_0x3872b6[_0x7bd7('0x29')],_0x13f91d['filters']));if(_0x3872b6[_0x7bd7('0x29')][_0x7bd7('0x34')]){_0x29d0d5[_0x7bd7('0x32')]=_[_0x7bd7('0x37')](_0x29d0d5[_0x7bd7('0x32')],{'$or':_[_0x7bd7('0x28')](_0x29d0d5[_0x7bd7('0x2b')],function(_0x5647a6){var _0x171169={};_0x171169[_0x5647a6]={'$like':'%'+_0x3872b6['query'][_0x7bd7('0x34')]+'%'};return _0x171169;})});}_0x29d0d5=_[_0x7bd7('0x37')]({},_0x29d0d5,_0x3872b6['options']);return _0x6d9222[_0x7bd7('0x48')](_0x29d0d5);}})['then'](function(_0x5ea1fb){if(_0x5ea1fb){_0x849a20=_0x5ea1fb[_0x7bd7('0x2f')];if(!_0x3872b6['query'][_0x7bd7('0x46')]('nolimit')){_0x29d0d5['limit']=qs[_0x7bd7('0x19')](_0x3872b6[_0x7bd7('0x29')][_0x7bd7('0x19')]);_0x29d0d5['offset']=qs['offset'](_0x3872b6[_0x7bd7('0x29')][_0x7bd7('0x18')]);}return _0x6d9222[_0x7bd7('0x48')](_0x29d0d5);}})[_0x7bd7('0x39')](function(_0x3f7ad6){if(_0x3f7ad6){return _0x3f7ad6?{'count':_0x849a20,'rows':_0x3f7ad6}:null;}})[_0x7bd7('0x39')](respondWithResult(_0x469516,null))[_0x7bd7('0x3c')](handleError(_0x469516,null));};exports[_0x7bd7('0x49')]=function(_0x8b8ba3,_0x37ff2a,_0x5cd53d){var _0x4ab4df={};var _0x5256a3={};var _0xa08bb0;var _0x2ec37b;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x8b8ba3['params']['id']}})[_0x7bd7('0x39')](handleEntityNotFound(_0x37ff2a,null))[_0x7bd7('0x39')](function(_0x1a019e){if(_0x1a019e){_0xa08bb0=_0x1a019e;_0x5256a3[_0x7bd7('0x2d')]=_[_0x7bd7('0x3f')](db[_0x7bd7('0x4a')][_0x7bd7('0x26')]);_0x5256a3[_0x7bd7('0x29')]=_[_0x7bd7('0x3f')](_0x8b8ba3['query']);_0x5256a3[_0x7bd7('0x2a')]=_['intersection'](_0x5256a3[_0x7bd7('0x2d')],_0x5256a3['query']);_0x4ab4df[_0x7bd7('0x2b')]=_[_0x7bd7('0x2c')](_0x5256a3[_0x7bd7('0x2d')],qs[_0x7bd7('0x2e')](_0x8b8ba3[_0x7bd7('0x29')][_0x7bd7('0x2e')]));_0x4ab4df[_0x7bd7('0x2b')]=_0x4ab4df[_0x7bd7('0x2b')][_0x7bd7('0x2f')]?_0x4ab4df[_0x7bd7('0x2b')]:_0x5256a3[_0x7bd7('0x2d')];_0x4ab4df['order']=qs['sort'](_0x8b8ba3['query'][_0x7bd7('0x31')]);_0x4ab4df['where']=qs[_0x7bd7('0x2a')](_[_0x7bd7('0x33')](_0x8b8ba3[_0x7bd7('0x29')],_0x5256a3[_0x7bd7('0x2a')]));if(_0x8b8ba3[_0x7bd7('0x29')]['filter']){_0x4ab4df[_0x7bd7('0x32')]=_[_0x7bd7('0x37')](_0x4ab4df[_0x7bd7('0x32')],{'$or':_['map'](_0x4ab4df['attributes'],function(_0x5f317a){var _0x6910f8={};_0x6910f8[_0x5f317a]={'$like':'%'+_0x8b8ba3['query'][_0x7bd7('0x34')]+'%'};return _0x6910f8;})});}_0x4ab4df=_[_0x7bd7('0x37')]({},_0x4ab4df,_0x8b8ba3[_0x7bd7('0x40')]);return _0xa08bb0['getDescriptions'](_0x4ab4df);}})[_0x7bd7('0x39')](function(_0x40a144){if(_0x40a144){_0x2ec37b=_0x40a144[_0x7bd7('0x2f')];if(!_0x8b8ba3[_0x7bd7('0x29')][_0x7bd7('0x46')](_0x7bd7('0x47'))){_0x4ab4df[_0x7bd7('0x19')]=qs['limit'](_0x8b8ba3[_0x7bd7('0x29')][_0x7bd7('0x19')]);_0x4ab4df[_0x7bd7('0x18')]=qs[_0x7bd7('0x18')](_0x8b8ba3['query']['offset']);}return _0xa08bb0[_0x7bd7('0x49')](_0x4ab4df);}})['then'](function(_0x664f33){if(_0x664f33){return _0x664f33?{'count':_0x2ec37b,'rows':_0x664f33}:null;}})[_0x7bd7('0x39')](respondWithResult(_0x37ff2a,null))['catch'](handleError(_0x37ff2a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index c36935b..f09a610 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3781b4,_0x3d4f15){var _0x2d3b49=function(_0x75af2f){while(--_0x75af2f){_0x3781b4['push'](_0x3781b4['shift']());}};_0x2d3b49(++_0x3d4f15);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xf3cd[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0x3436cb,_0x34a719){var _0x18e2e7=function(_0x476aff){while(--_0x476aff){_0x3436cb['push'](_0x3436cb['shift']());}};_0x18e2e7(++_0x34a719);}(_0xbec5,0xe5));var _0x5bec=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xbec5[_0x3bfdde];return _0x3f752a;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 9a85752..3158f11 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 _0xd212=['info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x46f62c,_0x49eb41){var _0x46d994=function(_0x225d69){while(--_0x225d69){_0x46f62c['push'](_0x46f62c['shift']());}};_0x46d994(++_0x49eb41);}(_0xd212,0x95));var _0x2d21=function(_0x10316a,_0x125dc8){_0x10316a=_0x10316a-0x0;var _0x36ac2e=_0xd212[_0x10316a];return _0x36ac2e;};'use strict';var _=require(_0x2d21('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d21('0x1'));var rs=require(_0x2d21('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d21('0x3'));var logger=require(_0x2d21('0x4'))(_0x2d21('0x5'));var config=require(_0x2d21('0x6'));var jayson=require(_0x2d21('0x7'));var client=jayson[_0x2d21('0x8')][_0x2d21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33abb3,_0x589cd9,_0x2578fe){return new BPromise(function(_0x11d9da,_0x21a55f){return client[_0x2d21('0xa')](_0x33abb3,_0x2578fe)[_0x2d21('0xb')](function(_0x3f5b10){logger[_0x2d21('0xc')](_0x2d21('0xd'),_0x589cd9,'request\x20sent');logger[_0x2d21('0xe')](_0x2d21('0xf'),_0x589cd9,'request\x20sent',JSON[_0x2d21('0x10')](_0x3f5b10));if(_0x3f5b10[_0x2d21('0x11')]){if(_0x3f5b10[_0x2d21('0x11')][_0x2d21('0x12')]===0x1f4){logger['error'](_0x2d21('0xd'),_0x589cd9,_0x3f5b10[_0x2d21('0x11')][_0x2d21('0x13')]);return _0x21a55f(_0x3f5b10['error'][_0x2d21('0x13')]);}logger[_0x2d21('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x589cd9,_0x3f5b10[_0x2d21('0x11')][_0x2d21('0x13')]);return _0x11d9da(_0x3f5b10[_0x2d21('0x11')]['message']);}else{logger[_0x2d21('0xc')](_0x2d21('0xd'),_0x589cd9,_0x2d21('0x14'));_0x11d9da(_0x3f5b10[_0x2d21('0x15')][_0x2d21('0x13')]);}})[_0x2d21('0x16')](function(_0x2298b6){logger[_0x2d21('0x11')](_0x2d21('0xd'),_0x589cd9,_0x2298b6);_0x21a55f(_0x2298b6);});});} \ No newline at end of file +var _0xc4e1=['request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x4332be,_0x2e9ade){var _0x3c99ae=function(_0x682e41){while(--_0x682e41){_0x4332be['push'](_0x4332be['shift']());}};_0x3c99ae(++_0x2e9ade);}(_0xc4e1,0xb3));var _0x1c4e=function(_0x2f7b71,_0x31bedf){_0x2f7b71=_0x2f7b71-0x0;var _0x5887cb=_0xc4e1[_0x2f7b71];return _0x5887cb;};'use strict';var _=require(_0x1c4e('0x0'));var util=require(_0x1c4e('0x1'));var moment=require(_0x1c4e('0x2'));var BPromise=require(_0x1c4e('0x3'));var rs=require(_0x1c4e('0x4'));var fs=require('fs');var Redis=require(_0x1c4e('0x5'));var db=require(_0x1c4e('0x6'))['db'];var utils=require(_0x1c4e('0x7'));var logger=require('../../config/logger')(_0x1c4e('0x8'));var config=require(_0x1c4e('0x9'));var jayson=require(_0x1c4e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21a8f4,_0x16a6af,_0x2f21c9){return new BPromise(function(_0x45afcf,_0x2c25ec){return client[_0x1c4e('0xb')](_0x21a8f4,_0x2f21c9)[_0x1c4e('0xc')](function(_0x11820c){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x16a6af,_0x1c4e('0xd'));logger[_0x1c4e('0xe')](_0x1c4e('0xf'),_0x16a6af,_0x1c4e('0xd'),JSON[_0x1c4e('0x10')](_0x11820c));if(_0x11820c[_0x1c4e('0x11')]){if(_0x11820c['error'][_0x1c4e('0x12')]===0x1f4){logger[_0x1c4e('0x11')](_0x1c4e('0x13'),_0x16a6af,_0x11820c['error']['message']);return _0x2c25ec(_0x11820c[_0x1c4e('0x11')][_0x1c4e('0x14')]);}logger['error'](_0x1c4e('0x13'),_0x16a6af,_0x11820c['error'][_0x1c4e('0x14')]);return _0x45afcf(_0x11820c['error'][_0x1c4e('0x14')]);}else{logger[_0x1c4e('0x15')](_0x1c4e('0x13'),_0x16a6af,_0x1c4e('0xd'));_0x45afcf(_0x11820c[_0x1c4e('0x16')][_0x1c4e('0x14')]);}})[_0x1c4e('0x17')](function(_0xaae8cc){logger[_0x1c4e('0x11')](_0x1c4e('0x13'),_0x16a6af,_0xaae8cc);_0x2c25ec(_0xaae8cc);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 4418981..15b8a30 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 _0xe9cf=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x46884f,_0x2b5c5a){var _0x78c6c0=function(_0x43ba0a){while(--_0x43ba0a){_0x46884f['push'](_0x46884f['shift']());}};_0x78c6c0(++_0x2b5c5a);}(_0xe9cf,0xa3));var _0xfe9c=function(_0x15ea8d,_0x132b40){_0x15ea8d=_0x15ea8d-0x0;var _0x17e921=_0xe9cf[_0x15ea8d];return _0x17e921;};'use strict';var multer=require(_0xfe9c('0x0'));var util=require(_0xfe9c('0x1'));var path=require('path');var timeout=require(_0xfe9c('0x2'));var express=require(_0xfe9c('0x3'));var router=express[_0xfe9c('0x4')]();var fs_extra=require(_0xfe9c('0x5'));var auth=require(_0xfe9c('0x6'));var interaction=require(_0xfe9c('0x7'));var config=require('../../config/environment');var controller=require(_0xfe9c('0x8'));router[_0xfe9c('0x9')]('/',auth[_0xfe9c('0xa')](),controller[_0xfe9c('0xb')]);router[_0xfe9c('0x9')](_0xfe9c('0xc'),auth['isAuthenticated'](),controller[_0xfe9c('0xd')]);router[_0xfe9c('0xe')]('/',auth[_0xfe9c('0xa')](),controller[_0xfe9c('0xf')]);router[_0xfe9c('0x10')](_0xfe9c('0xc'),auth[_0xfe9c('0xa')](),controller[_0xfe9c('0x11')]);router[_0xfe9c('0x12')](_0xfe9c('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xfe9c('0x13')]=router; \ No newline at end of file +var _0x36d8=['./intDynamics365Field.controller','get','isAuthenticated','/:id','show','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0x36d8,0x13a));var _0x836d=function(_0x37c2a8,_0xfa8a08){_0x37c2a8=_0x37c2a8-0x0;var _0x41a1a0=_0x36d8[_0x37c2a8];return _0x41a1a0;};'use strict';var multer=require(_0x836d('0x0'));var util=require(_0x836d('0x1'));var path=require(_0x836d('0x2'));var timeout=require(_0x836d('0x3'));var express=require(_0x836d('0x4'));var router=express[_0x836d('0x5')]();var fs_extra=require(_0x836d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x836d('0x7'));var config=require(_0x836d('0x8'));var controller=require(_0x836d('0x9'));router[_0x836d('0xa')]('/',auth[_0x836d('0xb')](),controller['index']);router['get'](_0x836d('0xc'),auth['isAuthenticated'](),controller[_0x836d('0xd')]);router['post']('/',auth[_0x836d('0xb')](),controller['create']);router[_0x836d('0xe')](_0x836d('0xc'),auth[_0x836d('0xb')](),controller[_0x836d('0xf')]);router['delete'](_0x836d('0xc'),auth[_0x836d('0xb')](),controller[_0x836d('0x10')]);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 47f81c1..bf5f762 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 _0xf4a8=['string','picklist','STRING','variable','customVariable','BOOLEAN','exports','ENUM'];(function(_0x454cc4,_0x49392e){var _0xfd2568=function(_0x36f9b6){while(--_0x36f9b6){_0x454cc4['push'](_0x454cc4['shift']());}};_0xfd2568(++_0x49392e);}(_0xf4a8,0x166));var _0x8f4a=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0xf4a8[_0xcd5a3d];return _0xd43207;};'use strict';var Sequelize=require('sequelize');module[_0x8f4a('0x0')]={'type':{'type':Sequelize[_0x8f4a('0x1')](_0x8f4a('0x2'),'variable','customVariable','keyValue',_0x8f4a('0x3')),'defaultValue':_0x8f4a('0x2')},'content':{'type':Sequelize[_0x8f4a('0x4')]},'key':{'type':Sequelize[_0x8f4a('0x4')]},'keyType':{'type':Sequelize[_0x8f4a('0x1')](_0x8f4a('0x2'),_0x8f4a('0x5'),_0x8f4a('0x6'))},'keyContent':{'type':Sequelize[_0x8f4a('0x4')]},'idField':{'type':Sequelize[_0x8f4a('0x4')]},'nameField':{'type':Sequelize[_0x8f4a('0x4')]},'customField':{'type':Sequelize[_0x8f4a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbcc5=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x14268f,_0x5f0869){var _0x269bcb=function(_0x61157f){while(--_0x61157f){_0x14268f['push'](_0x14268f['shift']());}};_0x269bcb(++_0x5f0869);}(_0xbcc5,0x19e));var _0x5bcc=function(_0x2a0f88,_0x43a5fa){_0x2a0f88=_0x2a0f88-0x0;var _0x39ce06=_0xbcc5[_0x2a0f88];return _0x39ce06;};'use strict';var Sequelize=require('sequelize');module[_0x5bcc('0x0')]={'type':{'type':Sequelize[_0x5bcc('0x1')](_0x5bcc('0x2'),_0x5bcc('0x3'),'customVariable',_0x5bcc('0x4'),_0x5bcc('0x5')),'defaultValue':_0x5bcc('0x2')},'content':{'type':Sequelize[_0x5bcc('0x6')]},'key':{'type':Sequelize[_0x5bcc('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x5bcc('0x2'),_0x5bcc('0x3'),_0x5bcc('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5bcc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5bcc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 6c69f58..f468e6e 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 _0x7585=['reject','update','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','type','VIRTUAL','options','Dynamics365Field','then','includeAll','include','findAll','rows','catch','show','params','keys','filters','find','create','body','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x7585,0x10c));var _0x5758=function(_0x37e934,_0x2bd0ec){_0x37e934=_0x37e934-0x0;var _0xd612d8=_0x7585[_0x37e934];return _0xd612d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5758('0x0'));var zipdir=require(_0x5758('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5758('0x2'));var moment=require(_0x5758('0x3'));var BPromise=require(_0x5758('0x4'));var Mustache=require(_0x5758('0x5'));var util=require(_0x5758('0x6'));var path=require(_0x5758('0x7'));var sox=require(_0x5758('0x8'));var csv=require(_0x5758('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5758('0xa'));var _=require(_0x5758('0xb'));var squel=require(_0x5758('0xc'));var crypto=require(_0x5758('0xd'));var jsforce=require(_0x5758('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5758('0x9'));var querystring=require(_0x5758('0xf'));var Papa=require(_0x5758('0x10'));var Redis=require(_0x5758('0x11'));var authService=require(_0x5758('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5758('0x13'));var hardwareService=require(_0x5758('0x14'));var logger=require(_0x5758('0x15'))(_0x5758('0x16'));var utils=require(_0x5758('0x17'));var config=require(_0x5758('0x18'));var licenseUtil=require(_0x5758('0x19'));var db=require(_0x5758('0x1a'))['db'];function respondWithStatusCode(_0x56a31c,_0x1617b2){_0x1617b2=_0x1617b2||0xcc;return function(_0x54452a){if(_0x54452a){return _0x56a31c['sendStatus'](_0x1617b2);}return _0x56a31c[_0x5758('0x1b')](_0x1617b2)[_0x5758('0x1c')]();};}function respondWithResult(_0x29da43,_0x151afa){_0x151afa=_0x151afa||0xc8;return function(_0x1bc545){if(_0x1bc545){return _0x29da43[_0x5758('0x1b')](_0x151afa)[_0x5758('0x1d')](_0x1bc545);}};}function respondWithFilteredResult(_0x4ba994,_0x4f9831){return function(_0x4ced91){if(_0x4ced91){var _0x36adf9=typeof _0x4f9831[_0x5758('0x1e')]===_0x5758('0x1f')&&typeof _0x4f9831[_0x5758('0x20')]==='undefined';var _0x584ebb=_0x4ced91[_0x5758('0x21')];var _0x25ed6a=_0x36adf9?0x0:_0x4f9831[_0x5758('0x1e')];var _0x2eaebc=_0x36adf9?_0x4ced91[_0x5758('0x21')]:_0x4f9831[_0x5758('0x1e')]+_0x4f9831[_0x5758('0x20')];var _0x2c13eb;if(_0x2eaebc>=_0x584ebb){_0x2eaebc=_0x584ebb;_0x2c13eb=0xc8;}else{_0x2c13eb=0xce;}_0x4ba994[_0x5758('0x1b')](_0x2c13eb);return _0x4ba994[_0x5758('0x22')]('Content-Range',_0x25ed6a+'-'+_0x2eaebc+'/'+_0x584ebb)[_0x5758('0x1d')](_0x4ced91);}return null;};}function patchUpdates(_0x21cbbe){return function(_0x5cd77c){try{jsonpatch[_0x5758('0x23')](_0x5cd77c,_0x21cbbe,!![]);}catch(_0x15e47d){return BPromise[_0x5758('0x24')](_0x15e47d);}return _0x5cd77c['save']();};}function saveUpdates(_0x2bc513,_0x28d806){return function(_0x27e361){if(_0x27e361){return _0x27e361[_0x5758('0x25')](_0x2bc513)['then'](function(_0x5b03b1){return _0x5b03b1;});}return null;};}function removeEntity(_0x2c624a,_0x1955eb){return function(_0x259908){if(_0x259908){return _0x259908['destroy']()['then'](function(){_0x2c624a[_0x5758('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x523833,_0xdd90a7){return function(_0xc2d6d8){if(!_0xc2d6d8){_0x523833[_0x5758('0x26')](0x194);}return _0xc2d6d8;};}function handleError(_0x7fed04,_0x4c574a){_0x4c574a=_0x4c574a||0x1f4;return function(_0x1f566b){logger[_0x5758('0x27')](_0x1f566b[_0x5758('0x28')]);if(_0x1f566b[_0x5758('0x29')]){delete _0x1f566b[_0x5758('0x29')];}_0x7fed04['status'](_0x4c574a)['send'](_0x1f566b);};}exports[_0x5758('0x2a')]=function(_0x366a2a,_0x585942){var _0x21baab={},_0x34c264={},_0x486201={'count':0x0,'rows':[]};var _0x2ef246=_[_0x5758('0x2b')](db['Dynamics365Field'][_0x5758('0x2c')],function(_0x6ef97d){return{'name':_0x6ef97d[_0x5758('0x2d')],'type':_0x6ef97d['type']['key']};});_0x34c264['model']=_[_0x5758('0x2b')](_0x2ef246,_0x5758('0x29'));_0x34c264['query']=_['keys'](_0x366a2a[_0x5758('0x2e')]);_0x34c264['filters']=_[_0x5758('0x2f')](_0x34c264[_0x5758('0x30')],_0x34c264[_0x5758('0x2e')]);_0x21baab[_0x5758('0x31')]=_['intersection'](_0x34c264[_0x5758('0x30')],qs['fields'](_0x366a2a[_0x5758('0x2e')][_0x5758('0x32')]));_0x21baab[_0x5758('0x31')]=_0x21baab[_0x5758('0x31')][_0x5758('0x33')]?_0x21baab[_0x5758('0x31')]:_0x34c264[_0x5758('0x30')];if(!_0x366a2a['query'][_0x5758('0x34')](_0x5758('0x35'))){_0x21baab[_0x5758('0x20')]=qs[_0x5758('0x20')](_0x366a2a[_0x5758('0x2e')][_0x5758('0x20')]);_0x21baab[_0x5758('0x1e')]=qs[_0x5758('0x1e')](_0x366a2a[_0x5758('0x2e')][_0x5758('0x1e')]);}_0x21baab['order']=qs[_0x5758('0x36')](_0x366a2a[_0x5758('0x2e')]['sort']);_0x21baab['where']=qs['filters'](_[_0x5758('0x37')](_0x366a2a[_0x5758('0x2e')],_0x34c264['filters']),_0x2ef246);if(_0x366a2a['query']['filter']){_0x21baab['where']=_[_0x5758('0x38')](_0x21baab[_0x5758('0x39')],{'$or':_['map'](_0x2ef246,function(_0x14a051){if(_0x14a051[_0x5758('0x3a')]!==_0x5758('0x3b')){var _0x405438={};_0x405438[_0x14a051[_0x5758('0x29')]]={'$like':'%'+_0x366a2a[_0x5758('0x2e')]['filter']+'%'};return _0x405438;}})});}_0x21baab=_[_0x5758('0x38')]({},_0x21baab,_0x366a2a[_0x5758('0x3c')]);var _0x2507fc={'where':_0x21baab['where']};return db[_0x5758('0x3d')][_0x5758('0x21')](_0x2507fc)[_0x5758('0x3e')](function(_0x241dd9){_0x486201[_0x5758('0x21')]=_0x241dd9;if(_0x366a2a[_0x5758('0x2e')][_0x5758('0x3f')]){_0x21baab[_0x5758('0x40')]=[{'all':!![]}];}return db[_0x5758('0x3d')][_0x5758('0x41')](_0x21baab);})[_0x5758('0x3e')](function(_0x51681d){_0x486201[_0x5758('0x42')]=_0x51681d;return _0x486201;})[_0x5758('0x3e')](respondWithFilteredResult(_0x585942,_0x21baab))[_0x5758('0x43')](handleError(_0x585942,null));};exports[_0x5758('0x44')]=function(_0x33a1e8,_0x2b806e){var _0x1ba0ba={'raw':!![],'where':{'id':_0x33a1e8[_0x5758('0x45')]['id']}},_0x30a1c2={};_0x30a1c2[_0x5758('0x30')]=_[_0x5758('0x46')](db[_0x5758('0x3d')][_0x5758('0x2c')]);_0x30a1c2['query']=_['keys'](_0x33a1e8[_0x5758('0x2e')]);_0x30a1c2[_0x5758('0x47')]=_[_0x5758('0x2f')](_0x30a1c2[_0x5758('0x30')],_0x30a1c2['query']);_0x1ba0ba[_0x5758('0x31')]=_[_0x5758('0x2f')](_0x30a1c2[_0x5758('0x30')],qs['fields'](_0x33a1e8[_0x5758('0x2e')][_0x5758('0x32')]));_0x1ba0ba[_0x5758('0x31')]=_0x1ba0ba[_0x5758('0x31')][_0x5758('0x33')]?_0x1ba0ba['attributes']:_0x30a1c2[_0x5758('0x30')];if(_0x33a1e8[_0x5758('0x2e')]['includeAll']){_0x1ba0ba[_0x5758('0x40')]=[{'all':!![]}];}_0x1ba0ba=_[_0x5758('0x38')]({},_0x1ba0ba,_0x33a1e8[_0x5758('0x3c')]);return db[_0x5758('0x3d')][_0x5758('0x48')](_0x1ba0ba)[_0x5758('0x3e')](handleEntityNotFound(_0x2b806e,null))[_0x5758('0x3e')](respondWithResult(_0x2b806e,null))[_0x5758('0x43')](handleError(_0x2b806e,null));};exports[_0x5758('0x49')]=function(_0x2d25ca,_0x121e7d){return db['Dynamics365Field']['create'](_0x2d25ca['body'],{})[_0x5758('0x3e')](respondWithResult(_0x121e7d,0xc9))[_0x5758('0x43')](handleError(_0x121e7d,null));};exports[_0x5758('0x25')]=function(_0x38d65b,_0x4b0c36){if(_0x38d65b[_0x5758('0x4a')]['id']){delete _0x38d65b[_0x5758('0x4a')]['id'];}return db[_0x5758('0x3d')][_0x5758('0x48')]({'where':{'id':_0x38d65b[_0x5758('0x45')]['id']}})[_0x5758('0x3e')](handleEntityNotFound(_0x4b0c36,null))[_0x5758('0x3e')](saveUpdates(_0x38d65b['body'],null))[_0x5758('0x3e')](respondWithResult(_0x4b0c36,null))['catch'](handleError(_0x4b0c36,null));};exports[_0x5758('0x4b')]=function(_0x5c8a34,_0x472abc){return db[_0x5758('0x3d')][_0x5758('0x48')]({'where':{'id':_0x5c8a34[_0x5758('0x45')]['id']}})[_0x5758('0x3e')](handleEntityNotFound(_0x472abc,null))['then'](removeEntity(_0x472abc,null))['catch'](handleError(_0x472abc,null));}; \ No newline at end of file +var _0x40cb=['body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','sendStatus','name','index','map','Dynamics365Field','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','fields','catch','create'];(function(_0x197785,_0x406254){var _0x58190f=function(_0x5922a7){while(--_0x5922a7){_0x197785['push'](_0x197785['shift']());}};_0x58190f(++_0x406254);}(_0x40cb,0x1ad));var _0xb40c=function(_0x364afe,_0x38786a){_0x364afe=_0x364afe-0x0;var _0x42fcd6=_0x40cb[_0x364afe];return _0x42fcd6;};'use strict';var emlformat=require(_0xb40c('0x0'));var rimraf=require(_0xb40c('0x1'));var zipdir=require(_0xb40c('0x2'));var jsonpatch=require(_0xb40c('0x3'));var rp=require(_0xb40c('0x4'));var moment=require(_0xb40c('0x5'));var BPromise=require(_0xb40c('0x6'));var Mustache=require(_0xb40c('0x7'));var util=require(_0xb40c('0x8'));var path=require(_0xb40c('0x9'));var sox=require(_0xb40c('0xa'));var csv=require('to-csv');var ejs=require(_0xb40c('0xb'));var fs=require('fs');var fs_extra=require(_0xb40c('0xc'));var _=require(_0xb40c('0xd'));var squel=require(_0xb40c('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb40c('0xf'));var toCsv=require(_0xb40c('0x10'));var querystring=require(_0xb40c('0x11'));var Papa=require(_0xb40c('0x12'));var Redis=require(_0xb40c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb40c('0x14'));var as=require(_0xb40c('0x15'));var hardwareService=require(_0xb40c('0x16'));var logger=require('../../config/logger')(_0xb40c('0x17'));var utils=require('../../config/utils');var config=require(_0xb40c('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36b6a7,_0x11cf7f){_0x11cf7f=_0x11cf7f||0xcc;return function(_0x30f36d){if(_0x30f36d){return _0x36b6a7['sendStatus'](_0x11cf7f);}return _0x36b6a7[_0xb40c('0x19')](_0x11cf7f)[_0xb40c('0x1a')]();};}function respondWithResult(_0x2bfe88,_0x27a9b2){_0x27a9b2=_0x27a9b2||0xc8;return function(_0xb80ae3){if(_0xb80ae3){return _0x2bfe88[_0xb40c('0x19')](_0x27a9b2)[_0xb40c('0x1b')](_0xb80ae3);}};}function respondWithFilteredResult(_0xbd3d70,_0x2a033b){return function(_0x39d21f){if(_0x39d21f){var _0x13ac3d=typeof _0x2a033b[_0xb40c('0x1c')]===_0xb40c('0x1d')&&typeof _0x2a033b['limit']===_0xb40c('0x1d');var _0x292c78=_0x39d21f[_0xb40c('0x1e')];var _0x3f3227=_0x13ac3d?0x0:_0x2a033b['offset'];var _0x22e5d7=_0x13ac3d?_0x39d21f[_0xb40c('0x1e')]:_0x2a033b[_0xb40c('0x1c')]+_0x2a033b[_0xb40c('0x1f')];var _0x29a915;if(_0x22e5d7>=_0x292c78){_0x22e5d7=_0x292c78;_0x29a915=0xc8;}else{_0x29a915=0xce;}_0xbd3d70[_0xb40c('0x19')](_0x29a915);return _0xbd3d70[_0xb40c('0x20')]('Content-Range',_0x3f3227+'-'+_0x22e5d7+'/'+_0x292c78)['json'](_0x39d21f);}return null;};}function patchUpdates(_0x3a9b9d){return function(_0xe1c34d){try{jsonpatch[_0xb40c('0x21')](_0xe1c34d,_0x3a9b9d,!![]);}catch(_0x3f5a27){return BPromise[_0xb40c('0x22')](_0x3f5a27);}return _0xe1c34d[_0xb40c('0x23')]();};}function saveUpdates(_0x2b9f32,_0x41f046){return function(_0x2bbe60){if(_0x2bbe60){return _0x2bbe60['update'](_0x2b9f32)[_0xb40c('0x24')](function(_0x272fb4){return _0x272fb4;});}return null;};}function removeEntity(_0x125dae,_0x383448){return function(_0x3ff0c0){if(_0x3ff0c0){return _0x3ff0c0[_0xb40c('0x25')]()[_0xb40c('0x24')](function(){_0x125dae[_0xb40c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dd0fe,_0x169a16){return function(_0x5c09ab){if(!_0x5c09ab){_0x4dd0fe[_0xb40c('0x26')](0x194);}return _0x5c09ab;};}function handleError(_0x5c717,_0x3cd533){_0x3cd533=_0x3cd533||0x1f4;return function(_0x4cdbce){logger['error'](_0x4cdbce['stack']);if(_0x4cdbce[_0xb40c('0x27')]){delete _0x4cdbce[_0xb40c('0x27')];}_0x5c717['status'](_0x3cd533)['send'](_0x4cdbce);};}exports[_0xb40c('0x28')]=function(_0x5e7c70,_0x1b83b6){var _0x9c059d={},_0x49d9a5={},_0x5e89ae={'count':0x0,'rows':[]};var _0x5ba4aa=_[_0xb40c('0x29')](db[_0xb40c('0x2a')]['rawAttributes'],function(_0x7293d){return{'name':_0x7293d[_0xb40c('0x2b')],'type':_0x7293d[_0xb40c('0x2c')][_0xb40c('0x2d')]};});_0x49d9a5[_0xb40c('0x2e')]=_[_0xb40c('0x29')](_0x5ba4aa,_0xb40c('0x27'));_0x49d9a5[_0xb40c('0x2f')]=_[_0xb40c('0x30')](_0x5e7c70[_0xb40c('0x2f')]);_0x49d9a5[_0xb40c('0x31')]=_[_0xb40c('0x32')](_0x49d9a5['model'],_0x49d9a5[_0xb40c('0x2f')]);_0x9c059d[_0xb40c('0x33')]=_['intersection'](_0x49d9a5['model'],qs['fields'](_0x5e7c70['query']['fields']));_0x9c059d[_0xb40c('0x33')]=_0x9c059d['attributes'][_0xb40c('0x34')]?_0x9c059d[_0xb40c('0x33')]:_0x49d9a5[_0xb40c('0x2e')];if(!_0x5e7c70['query']['hasOwnProperty']('nolimit')){_0x9c059d[_0xb40c('0x1f')]=qs[_0xb40c('0x1f')](_0x5e7c70[_0xb40c('0x2f')][_0xb40c('0x1f')]);_0x9c059d[_0xb40c('0x1c')]=qs['offset'](_0x5e7c70[_0xb40c('0x2f')][_0xb40c('0x1c')]);}_0x9c059d[_0xb40c('0x35')]=qs[_0xb40c('0x36')](_0x5e7c70[_0xb40c('0x2f')]['sort']);_0x9c059d[_0xb40c('0x37')]=qs['filters'](_[_0xb40c('0x38')](_0x5e7c70[_0xb40c('0x2f')],_0x49d9a5[_0xb40c('0x31')]),_0x5ba4aa);if(_0x5e7c70[_0xb40c('0x2f')][_0xb40c('0x39')]){_0x9c059d[_0xb40c('0x37')]=_[_0xb40c('0x3a')](_0x9c059d['where'],{'$or':_[_0xb40c('0x29')](_0x5ba4aa,function(_0x34411c){if(_0x34411c[_0xb40c('0x2c')]!==_0xb40c('0x3b')){var _0x1ec72f={};_0x1ec72f[_0x34411c[_0xb40c('0x27')]]={'$like':'%'+_0x5e7c70[_0xb40c('0x2f')][_0xb40c('0x39')]+'%'};return _0x1ec72f;}})});}_0x9c059d=_['merge']({},_0x9c059d,_0x5e7c70[_0xb40c('0x3c')]);var _0x5f25f0={'where':_0x9c059d[_0xb40c('0x37')]};return db['Dynamics365Field'][_0xb40c('0x1e')](_0x5f25f0)[_0xb40c('0x24')](function(_0x371b1e){_0x5e89ae['count']=_0x371b1e;if(_0x5e7c70['query']['includeAll']){_0x9c059d[_0xb40c('0x3d')]=[{'all':!![]}];}return db[_0xb40c('0x2a')]['findAll'](_0x9c059d);})[_0xb40c('0x24')](function(_0x30d444){_0x5e89ae[_0xb40c('0x3e')]=_0x30d444;return _0x5e89ae;})[_0xb40c('0x24')](respondWithFilteredResult(_0x1b83b6,_0x9c059d))['catch'](handleError(_0x1b83b6,null));};exports[_0xb40c('0x3f')]=function(_0x5f0152,_0x53820c){var _0x182d65={'raw':!![],'where':{'id':_0x5f0152[_0xb40c('0x40')]['id']}},_0x4975d0={};_0x4975d0[_0xb40c('0x2e')]=_[_0xb40c('0x30')](db['Dynamics365Field']['rawAttributes']);_0x4975d0[_0xb40c('0x2f')]=_['keys'](_0x5f0152[_0xb40c('0x2f')]);_0x4975d0['filters']=_[_0xb40c('0x32')](_0x4975d0[_0xb40c('0x2e')],_0x4975d0['query']);_0x182d65[_0xb40c('0x33')]=_['intersection'](_0x4975d0[_0xb40c('0x2e')],qs['fields'](_0x5f0152[_0xb40c('0x2f')][_0xb40c('0x41')]));_0x182d65['attributes']=_0x182d65['attributes'][_0xb40c('0x34')]?_0x182d65[_0xb40c('0x33')]:_0x4975d0['model'];if(_0x5f0152['query']['includeAll']){_0x182d65[_0xb40c('0x3d')]=[{'all':!![]}];}_0x182d65=_[_0xb40c('0x3a')]({},_0x182d65,_0x5f0152[_0xb40c('0x3c')]);return db[_0xb40c('0x2a')]['find'](_0x182d65)[_0xb40c('0x24')](handleEntityNotFound(_0x53820c,null))[_0xb40c('0x24')](respondWithResult(_0x53820c,null))[_0xb40c('0x42')](handleError(_0x53820c,null));};exports[_0xb40c('0x43')]=function(_0x3ac865,_0x2f626b){return db[_0xb40c('0x2a')][_0xb40c('0x43')](_0x3ac865[_0xb40c('0x44')],{})[_0xb40c('0x24')](respondWithResult(_0x2f626b,0xc9))['catch'](handleError(_0x2f626b,null));};exports[_0xb40c('0x45')]=function(_0x260256,_0x3294c1){if(_0x260256['body']['id']){delete _0x260256[_0xb40c('0x44')]['id'];}return db[_0xb40c('0x2a')]['find']({'where':{'id':_0x260256[_0xb40c('0x40')]['id']}})[_0xb40c('0x24')](handleEntityNotFound(_0x3294c1,null))[_0xb40c('0x24')](saveUpdates(_0x260256[_0xb40c('0x44')],null))[_0xb40c('0x24')](respondWithResult(_0x3294c1,null))['catch'](handleError(_0x3294c1,null));};exports[_0xb40c('0x25')]=function(_0x2a3056,_0x101027){return db['Dynamics365Field'][_0xb40c('0x46')]({'where':{'id':_0x2a3056['params']['id']}})['then'](handleEntityNotFound(_0x101027,null))[_0xb40c('0x24')](removeEntity(_0x101027,null))[_0xb40c('0x42')](handleError(_0x101027,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c09d7fc..820e3aa 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 _0xbc07=['exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','util','api','bluebird','request-promise','path','./intDynamics365Field.attributes'];(function(_0x26c19d,_0x3f7b9b){var _0x37d676=function(_0x4d091e){while(--_0x4d091e){_0x26c19d['push'](_0x26c19d['shift']());}};_0x37d676(++_0x3f7b9b);}(_0xbc07,0x118));var _0x7bc0=function(_0x2d8be4,_0x23d58b){_0x2d8be4=_0x2d8be4-0x0;var _0x47a4ed=_0xbc07[_0x2d8be4];return _0x47a4ed;};'use strict';var _=require('lodash');var util=require(_0x7bc0('0x0'));var logger=require('../../config/logger')(_0x7bc0('0x1'));var moment=require('moment');var BPromise=require(_0x7bc0('0x2'));var rp=require(_0x7bc0('0x3'));var fs=require('fs');var path=require(_0x7bc0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7bc0('0x5'));module[_0x7bc0('0x6')]=function(_0x1a4ab3,_0x5ecefe){return _0x1a4ab3[_0x7bc0('0x7')]('Dynamics365Field',attributes,{'tableName':_0x7bc0('0x8'),'paranoid':![],'indexes':[{'name':_0x7bc0('0x9'),'fields':[_0x7bc0('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5b0=['../../config/environment','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x26adcd,_0x54d8e0){var _0x380718=function(_0x3eb674){while(--_0x3eb674){_0x26adcd['push'](_0x26adcd['shift']());}};_0x380718(++_0x54d8e0);}(_0xf5b0,0x1d5));var _0x0f5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0f5b('0x0'))(_0x0f5b('0x1'));var moment=require(_0x0f5b('0x2'));var BPromise=require(_0x0f5b('0x3'));var rp=require(_0x0f5b('0x4'));var fs=require('fs');var path=require(_0x0f5b('0x5'));var rimraf=require(_0x0f5b('0x6'));var config=require(_0x0f5b('0x7'));var attributes=require(_0x0f5b('0x8'));module[_0x0f5b('0x9')]=function(_0x1b50da,_0x37410a){return _0x1b50da[_0x0f5b('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x0f5b('0xb'),'fields':[_0x0f5b('0xc'),_0x0f5b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index b75aaeb..ce68930 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 _0xa68e=['rpc','../../config/environment','client','http','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0xa68e,0x116));var _0xea68=function(_0x2ca0cf,_0x2f56c3){_0x2ca0cf=_0x2ca0cf-0x0;var _0x12e852=_0xa68e[_0x2ca0cf];return _0x12e852;};'use strict';var _=require(_0xea68('0x0'));var util=require(_0xea68('0x1'));var moment=require(_0xea68('0x2'));var BPromise=require(_0xea68('0x3'));var rs=require(_0xea68('0x4'));var fs=require('fs');var Redis=require(_0xea68('0x5'));var db=require(_0xea68('0x6'))['db'];var utils=require(_0xea68('0x7'));var logger=require('../../config/logger')(_0xea68('0x8'));var config=require(_0xea68('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xea68('0xa')][_0xea68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11bd20,_0x412bb5,_0x3945f5){return new BPromise(function(_0xd269ef,_0x224ec7){return client['request'](_0x11bd20,_0x3945f5)['then'](function(_0x509113){logger[_0xea68('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x412bb5,_0xea68('0xd'));logger[_0xea68('0xe')](_0xea68('0xf'),_0x412bb5,_0xea68('0xd'),JSON[_0xea68('0x10')](_0x509113));if(_0x509113[_0xea68('0x11')]){if(_0x509113[_0xea68('0x11')][_0xea68('0x12')]===0x1f4){logger[_0xea68('0x11')](_0xea68('0x13'),_0x412bb5,_0x509113[_0xea68('0x11')]['message']);return _0x224ec7(_0x509113['error'][_0xea68('0x14')]);}logger[_0xea68('0x11')](_0xea68('0x13'),_0x412bb5,_0x509113['error'][_0xea68('0x14')]);return _0xd269ef(_0x509113[_0xea68('0x11')]['message']);}else{logger[_0xea68('0xc')](_0xea68('0x13'),_0x412bb5,_0xea68('0xd'));_0xd269ef(_0x509113[_0xea68('0x15')][_0xea68('0x14')]);}})['catch'](function(_0x12b365){logger[_0xea68('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x412bb5,_0x12b365);_0x224ec7(_0x12b365);});});} \ No newline at end of file +var _0xb6b3=['../../config/logger','rpc','../../config/environment','request','then','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xb6b3,0xcc));var _0x3b6b=function(_0x23d5a6,_0xd0ba9){_0x23d5a6=_0x23d5a6-0x0;var _0x33a126=_0xb6b3[_0x23d5a6];return _0x33a126;};'use strict';var _=require(_0x3b6b('0x0'));var util=require(_0x3b6b('0x1'));var moment=require(_0x3b6b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b6b('0x3'));var db=require(_0x3b6b('0x4'))['db'];var utils=require(_0x3b6b('0x5'));var logger=require(_0x3b6b('0x6'))(_0x3b6b('0x7'));var config=require(_0x3b6b('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43504a,_0x2c9136,_0x15b10e){return new BPromise(function(_0x33ceaa,_0x525d9c){return client[_0x3b6b('0x9')](_0x43504a,_0x15b10e)[_0x3b6b('0xa')](function(_0x2b0bf1){logger[_0x3b6b('0xb')](_0x3b6b('0xc'),_0x2c9136,'request\x20sent');logger['debug'](_0x3b6b('0xd'),_0x2c9136,_0x3b6b('0xe'),JSON[_0x3b6b('0xf')](_0x2b0bf1));if(_0x2b0bf1[_0x3b6b('0x10')]){if(_0x2b0bf1[_0x3b6b('0x10')][_0x3b6b('0x11')]===0x1f4){logger[_0x3b6b('0x10')](_0x3b6b('0xc'),_0x2c9136,_0x2b0bf1[_0x3b6b('0x10')][_0x3b6b('0x12')]);return _0x525d9c(_0x2b0bf1[_0x3b6b('0x10')]['message']);}logger[_0x3b6b('0x10')](_0x3b6b('0xc'),_0x2c9136,_0x2b0bf1['error'][_0x3b6b('0x12')]);return _0x33ceaa(_0x2b0bf1[_0x3b6b('0x10')][_0x3b6b('0x12')]);}else{logger[_0x3b6b('0xb')](_0x3b6b('0xc'),_0x2c9136,_0x3b6b('0xe'));_0x33ceaa(_0x2b0bf1[_0x3b6b('0x13')][_0x3b6b('0x12')]);}})[_0x3b6b('0x14')](function(_0x4a5610){logger[_0x3b6b('0x10')](_0x3b6b('0xc'),_0x2c9136,_0x4a5610);_0x525d9c(_0x4a5610);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7866a11..5e5d502 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 _0x6da0=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/configurations','create','post'];(function(_0x28951d,_0x336a75){var _0x527c69=function(_0x28b919){while(--_0x28b919){_0x28951d['push'](_0x28951d['shift']());}};_0x527c69(++_0x336a75);}(_0x6da0,0x16d));var _0x06da=function(_0x386e84,_0x56e08a){_0x386e84=_0x386e84-0x0;var _0x3a7941=_0x6da0[_0x386e84];return _0x3a7941;};'use strict';var multer=require(_0x06da('0x0'));var util=require('util');var path=require(_0x06da('0x1'));var timeout=require(_0x06da('0x2'));var express=require(_0x06da('0x3'));var router=express[_0x06da('0x4')]();var fs_extra=require(_0x06da('0x5'));var auth=require(_0x06da('0x6'));var interaction=require(_0x06da('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x06da('0x8')]('/',auth[_0x06da('0x9')](),controller[_0x06da('0xa')]);router[_0x06da('0x8')](_0x06da('0xb'),auth[_0x06da('0x9')](),controller['show']);router[_0x06da('0x8')](_0x06da('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x06da('0x8')]('/:id/fields',auth[_0x06da('0x9')](),controller['getFields']);router['post']('/',auth[_0x06da('0x9')](),controller[_0x06da('0xd')]);router[_0x06da('0xe')]('/:id/configurations',auth[_0x06da('0x9')](),controller['addConfiguration']);router[_0x06da('0xf')](_0x06da('0xb'),auth[_0x06da('0x9')](),controller[_0x06da('0x10')]);router[_0x06da('0x11')](_0x06da('0xb'),auth[_0x06da('0x9')](),controller[_0x06da('0x12')]);module[_0x06da('0x13')]=router; \ No newline at end of file +var _0x6671=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6671,0xe6));var _0x1667=function(_0x166301,_0x5798af){_0x166301=_0x166301-0x0;var _0x492147=_0x6671[_0x166301];return _0x492147;};'use strict';var multer=require(_0x1667('0x0'));var util=require(_0x1667('0x1'));var path=require('path');var timeout=require(_0x1667('0x2'));var express=require(_0x1667('0x3'));var router=express[_0x1667('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1667('0x5'));var interaction=require(_0x1667('0x6'));var config=require(_0x1667('0x7'));var controller=require(_0x1667('0x8'));router[_0x1667('0x9')]('/',auth[_0x1667('0xa')](),controller[_0x1667('0xb')]);router[_0x1667('0x9')](_0x1667('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1667('0x9')](_0x1667('0xd'),auth[_0x1667('0xa')](),controller[_0x1667('0xe')]);router['get'](_0x1667('0xf'),auth[_0x1667('0xa')](),controller[_0x1667('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1667('0x11')]);router[_0x1667('0x12')](_0x1667('0xd'),auth['isAuthenticated'](),controller[_0x1667('0x13')]);router[_0x1667('0x14')](_0x1667('0xc'),auth[_0x1667('0xa')](),controller[_0x1667('0x15')]);router['delete'](_0x1667('0xc'),auth[_0x1667('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 7392cd7..378651a 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 _0x5c3c=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5ddd87,_0x4cee42){var _0x4e4161=function(_0x50fb9d){while(--_0x50fb9d){_0x5ddd87['push'](_0x5ddd87['shift']());}};_0x4e4161(++_0x4cee42);}(_0x5c3c,0x132));var _0xc5c3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5c3c[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xc5c3('0x0'));module[_0xc5c3('0x1')]={'name':{'type':Sequelize[_0xc5c3('0x2')]},'description':{'type':Sequelize[_0xc5c3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc5c3('0x3')},'apiKey':{'type':Sequelize[_0xc5c3('0x2')]},'remoteUri':{'type':Sequelize[_0xc5c3('0x2')],'unique':_0xc5c3('0x4')},'serverUrl':{'type':Sequelize[_0xc5c3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xaebd=['remoteUri','sequelize','STRING','username'];(function(_0x2c1ddd,_0x2a667f){var _0x49fa39=function(_0x581c2d){while(--_0x581c2d){_0x2c1ddd['push'](_0x2c1ddd['shift']());}};_0x49fa39(++_0x2a667f);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x1eace4,_0x4d9e77){_0x1eace4=_0x1eace4-0x0;var _0x107580=_0xaebd[_0x1eace4];return _0x107580;};'use strict';var Sequelize=require(_0xdaeb('0x0'));module['exports']={'name':{'type':Sequelize[_0xdaeb('0x1')]},'description':{'type':Sequelize[_0xdaeb('0x1')]},'username':{'type':Sequelize[_0xdaeb('0x1')],'unique':_0xdaeb('0x2')},'apiKey':{'type':Sequelize[_0xdaeb('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xdaeb('0x3')},'serverUrl':{'type':Sequelize[_0xdaeb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 29d5cc1..1e37595 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 _0x74f0=['%s/%s','api/v2/ticket_fields','base64','requester','subject','agent','group','source','company','remove','default','custom_text','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','statusCode','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshdeskAccount','include','findAll','rows','catch','show','params','options','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','AccountId','getSubjects','Descriptions','channel','FreshdeskField','Subjects','getFields','remoteUri','apiKey','lastIndexOf','GET','format'];(function(_0x88a523,_0x4c930c){var _0x3deebf=function(_0x9d3877){while(--_0x9d3877){_0x88a523['push'](_0x88a523['shift']());}};_0x3deebf(++_0x4c930c);}(_0x74f0,0xf3));var _0x074f=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x74f0[_0x7d62cb];return _0x3a6266;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x074f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x074f('0x1'));var moment=require(_0x074f('0x2'));var BPromise=require(_0x074f('0x3'));var Mustache=require(_0x074f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x074f('0x5'));var csv=require(_0x074f('0x6'));var ejs=require(_0x074f('0x7'));var fs=require('fs');var fs_extra=require(_0x074f('0x8'));var _=require(_0x074f('0x9'));var squel=require(_0x074f('0xa'));var crypto=require(_0x074f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x074f('0xc'));var toCsv=require(_0x074f('0x6'));var querystring=require('querystring');var Papa=require(_0x074f('0xd'));var Redis=require(_0x074f('0xe'));var authService=require(_0x074f('0xf'));var qs=require(_0x074f('0x10'));var as=require(_0x074f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x074f('0x12'));var utils=require(_0x074f('0x13'));var config=require(_0x074f('0x14'));var licenseUtil=require(_0x074f('0x15'));var db=require(_0x074f('0x16'))['db'];var integrations=require(_0x074f('0x17'));function respondWithStatusCode(_0x1d3304,_0x46cea0){_0x46cea0=_0x46cea0||0xcc;return function(_0x2c4596){if(_0x2c4596){return _0x1d3304['sendStatus'](_0x46cea0);}return _0x1d3304[_0x074f('0x18')](_0x46cea0)['end']();};}function respondWithResult(_0x12ed92,_0x3bf07f){_0x3bf07f=_0x3bf07f||0xc8;return function(_0x220d0b){if(_0x220d0b){return _0x12ed92[_0x074f('0x18')](_0x3bf07f)[_0x074f('0x19')](_0x220d0b);}};}function respondWithFilteredResult(_0x237960,_0x7e19fe){return function(_0x1edf9c){if(_0x1edf9c){var _0x3f1a47=typeof _0x7e19fe[_0x074f('0x1a')]===_0x074f('0x1b')&&typeof _0x7e19fe['limit']===_0x074f('0x1b');var _0x367b52=_0x1edf9c[_0x074f('0x1c')];var _0x3facd8=_0x3f1a47?0x0:_0x7e19fe[_0x074f('0x1a')];var _0x1c5406=_0x3f1a47?_0x1edf9c['count']:_0x7e19fe['offset']+_0x7e19fe[_0x074f('0x1d')];var _0x5d8c10;if(_0x1c5406>=_0x367b52){_0x1c5406=_0x367b52;_0x5d8c10=0xc8;}else{_0x5d8c10=0xce;}_0x237960['status'](_0x5d8c10);return _0x237960[_0x074f('0x1e')](_0x074f('0x1f'),_0x3facd8+'-'+_0x1c5406+'/'+_0x367b52)[_0x074f('0x19')](_0x1edf9c);}return null;};}function patchUpdates(_0x5feafd){return function(_0xfa07ea){try{jsonpatch[_0x074f('0x20')](_0xfa07ea,_0x5feafd,!![]);}catch(_0x23406f){return BPromise[_0x074f('0x21')](_0x23406f);}return _0xfa07ea[_0x074f('0x22')]();};}function saveUpdates(_0x2c3b23,_0x335170){return function(_0x3bc3f6){if(_0x3bc3f6){return _0x3bc3f6[_0x074f('0x23')](_0x2c3b23)[_0x074f('0x24')](function(_0x39e502){return _0x39e502;});}return null;};}function removeEntity(_0x1bd2c7,_0xdfa2d8){return function(_0x504632){if(_0x504632){return _0x504632[_0x074f('0x25')]()[_0x074f('0x24')](function(){_0x1bd2c7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e35a3,_0x1051ce){return function(_0x22ce4f){if(!_0x22ce4f){_0x4e35a3[_0x074f('0x26')](0x194);}return _0x22ce4f;};}function handleError(_0x3eb67d,_0x5aabea){_0x5aabea=_0x5aabea||0x1f4;return function(_0x21cec2){logger[_0x074f('0x27')](_0x21cec2[_0x074f('0x28')]);if(_0x21cec2[_0x074f('0x29')]){delete _0x21cec2[_0x074f('0x29')];}_0x3eb67d[_0x074f('0x18')](_0x5aabea)['send'](_0x21cec2);};}exports[_0x074f('0x2a')]=function(_0x3246cf,_0x2b98d7){var _0x53b76d={},_0x1ee652={},_0x5d6edd={'count':0x0,'rows':[]};var _0x4fcfb5=_[_0x074f('0x2b')](db['FreshdeskAccount'][_0x074f('0x2c')],function(_0x214611){return{'name':_0x214611[_0x074f('0x2d')],'type':_0x214611[_0x074f('0x2e')]['key']};});_0x1ee652[_0x074f('0x2f')]=_[_0x074f('0x2b')](_0x4fcfb5,_0x074f('0x29'));_0x1ee652['query']=_[_0x074f('0x30')](_0x3246cf[_0x074f('0x31')]);_0x1ee652[_0x074f('0x32')]=_[_0x074f('0x33')](_0x1ee652[_0x074f('0x2f')],_0x1ee652['query']);_0x53b76d[_0x074f('0x34')]=_[_0x074f('0x33')](_0x1ee652['model'],qs[_0x074f('0x35')](_0x3246cf[_0x074f('0x31')][_0x074f('0x35')]));_0x53b76d['attributes']=_0x53b76d[_0x074f('0x34')][_0x074f('0x36')]?_0x53b76d['attributes']:_0x1ee652[_0x074f('0x2f')];if(!_0x3246cf[_0x074f('0x31')][_0x074f('0x37')](_0x074f('0x38'))){_0x53b76d[_0x074f('0x1d')]=qs[_0x074f('0x1d')](_0x3246cf[_0x074f('0x31')][_0x074f('0x1d')]);_0x53b76d[_0x074f('0x1a')]=qs[_0x074f('0x1a')](_0x3246cf['query'][_0x074f('0x1a')]);}_0x53b76d[_0x074f('0x39')]=qs['sort'](_0x3246cf[_0x074f('0x31')][_0x074f('0x3a')]);_0x53b76d[_0x074f('0x3b')]=qs[_0x074f('0x32')](_[_0x074f('0x3c')](_0x3246cf[_0x074f('0x31')],_0x1ee652[_0x074f('0x32')]),_0x4fcfb5);if(_0x3246cf['query'][_0x074f('0x3d')]){_0x53b76d[_0x074f('0x3b')]=_[_0x074f('0x3e')](_0x53b76d[_0x074f('0x3b')],{'$or':_[_0x074f('0x2b')](_0x4fcfb5,function(_0xdb341a){if(_0xdb341a['type']!==_0x074f('0x3f')){var _0x19866e={};_0x19866e[_0xdb341a['name']]={'$like':'%'+_0x3246cf[_0x074f('0x31')][_0x074f('0x3d')]+'%'};return _0x19866e;}})});}_0x53b76d=_[_0x074f('0x3e')]({},_0x53b76d,_0x3246cf['options']);var _0x4e9c55={'where':_0x53b76d['where']};return db[_0x074f('0x40')][_0x074f('0x1c')](_0x4e9c55)[_0x074f('0x24')](function(_0x5b9a17){_0x5d6edd[_0x074f('0x1c')]=_0x5b9a17;if(_0x3246cf[_0x074f('0x31')]['includeAll']){_0x53b76d[_0x074f('0x41')]=[{'all':!![]}];}return db[_0x074f('0x40')][_0x074f('0x42')](_0x53b76d);})[_0x074f('0x24')](function(_0x3a6e10){_0x5d6edd[_0x074f('0x43')]=_0x3a6e10;return _0x5d6edd;})[_0x074f('0x24')](respondWithFilteredResult(_0x2b98d7,_0x53b76d))[_0x074f('0x44')](handleError(_0x2b98d7,null));};exports[_0x074f('0x45')]=function(_0x406d33,_0x58ff4d){var _0x1bee97={'raw':![],'where':{'id':_0x406d33[_0x074f('0x46')]['id']}},_0x595931={};_0x595931['model']=_[_0x074f('0x30')](db['FreshdeskAccount'][_0x074f('0x2c')]);_0x595931['query']=_[_0x074f('0x30')](_0x406d33[_0x074f('0x31')]);_0x595931[_0x074f('0x32')]=_[_0x074f('0x33')](_0x595931[_0x074f('0x2f')],_0x595931[_0x074f('0x31')]);_0x1bee97[_0x074f('0x34')]=_['intersection'](_0x595931[_0x074f('0x2f')],qs[_0x074f('0x35')](_0x406d33[_0x074f('0x31')][_0x074f('0x35')]));_0x1bee97['attributes']=_0x1bee97[_0x074f('0x34')]['length']?_0x1bee97[_0x074f('0x34')]:_0x595931[_0x074f('0x2f')];if(_0x406d33[_0x074f('0x31')]['includeAll']){_0x1bee97[_0x074f('0x41')]=[{'all':!![]}];}_0x1bee97=_['merge']({},_0x1bee97,_0x406d33[_0x074f('0x47')]);return db[_0x074f('0x40')]['find'](_0x1bee97)[_0x074f('0x24')](handleEntityNotFound(_0x58ff4d,null))['then'](respondWithResult(_0x58ff4d,null))[_0x074f('0x44')](handleError(_0x58ff4d,null));};exports[_0x074f('0x48')]=function(_0x598fee,_0x57c89f){return db['FreshdeskAccount']['create'](_0x598fee[_0x074f('0x49')],{})[_0x074f('0x24')](respondWithResult(_0x57c89f,0xc9))[_0x074f('0x44')](handleError(_0x57c89f,null));};exports[_0x074f('0x23')]=function(_0x53b1e5,_0x1e3364){if(_0x53b1e5[_0x074f('0x49')]['id']){delete _0x53b1e5[_0x074f('0x49')]['id'];}return db[_0x074f('0x40')][_0x074f('0x4a')]({'where':{'id':_0x53b1e5[_0x074f('0x46')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x1e3364,null))[_0x074f('0x24')](saveUpdates(_0x53b1e5['body'],null))[_0x074f('0x24')](respondWithResult(_0x1e3364,null))[_0x074f('0x44')](handleError(_0x1e3364,null));};exports[_0x074f('0x25')]=function(_0x306a17,_0x522777){return db[_0x074f('0x40')][_0x074f('0x4a')]({'where':{'id':_0x306a17['params']['id']}})['then'](handleEntityNotFound(_0x522777,null))[_0x074f('0x24')](removeEntity(_0x522777,null))[_0x074f('0x44')](handleError(_0x522777,null));};exports[_0x074f('0x4b')]=function(_0x37f4a8,_0x563343,_0x4ed750){var _0x3db639={};var _0xc38f21={};var _0x2fc9fa;var _0x32684a;return db[_0x074f('0x40')][_0x074f('0x4c')]({'where':{'id':_0x37f4a8[_0x074f('0x46')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x563343,null))[_0x074f('0x24')](function(_0x5bda95){if(_0x5bda95){_0x2fc9fa=_0x5bda95;_0xc38f21[_0x074f('0x2f')]=_[_0x074f('0x30')](db[_0x074f('0x4d')][_0x074f('0x2c')]);_0xc38f21[_0x074f('0x31')]=_[_0x074f('0x30')](_0x37f4a8['query']);_0xc38f21[_0x074f('0x32')]=_[_0x074f('0x33')](_0xc38f21['model'],_0xc38f21[_0x074f('0x31')]);_0x3db639[_0x074f('0x34')]=_[_0x074f('0x33')](_0xc38f21[_0x074f('0x2f')],qs[_0x074f('0x35')](_0x37f4a8[_0x074f('0x31')][_0x074f('0x35')]));_0x3db639[_0x074f('0x34')]=_0x3db639[_0x074f('0x34')][_0x074f('0x36')]?_0x3db639['attributes']:_0xc38f21[_0x074f('0x2f')];_0x3db639['order']=qs['sort'](_0x37f4a8[_0x074f('0x31')]['sort']);_0x3db639['where']=qs[_0x074f('0x32')](_[_0x074f('0x3c')](_0x37f4a8[_0x074f('0x31')],_0xc38f21[_0x074f('0x32')]));if(_0x37f4a8[_0x074f('0x31')][_0x074f('0x3d')]){_0x3db639[_0x074f('0x3b')]=_[_0x074f('0x3e')](_0x3db639['where'],{'$or':_['map'](_0x3db639[_0x074f('0x34')],function(_0x3f48b7){var _0x28fedf={};_0x28fedf[_0x3f48b7]={'$like':'%'+_0x37f4a8['query'][_0x074f('0x3d')]+'%'};return _0x28fedf;})});}_0x3db639=_[_0x074f('0x3e')]({},_0x3db639,_0x37f4a8['options']);return _0x2fc9fa['getConfigurations'](_0x3db639);}})[_0x074f('0x24')](function(_0x4e06cb){if(_0x4e06cb){_0x32684a=_0x4e06cb[_0x074f('0x36')];if(!_0x37f4a8[_0x074f('0x31')]['hasOwnProperty'](_0x074f('0x38'))){_0x3db639[_0x074f('0x1d')]=qs[_0x074f('0x1d')](_0x37f4a8[_0x074f('0x31')][_0x074f('0x1d')]);_0x3db639[_0x074f('0x1a')]=qs[_0x074f('0x1a')](_0x37f4a8[_0x074f('0x31')][_0x074f('0x1a')]);}return _0x2fc9fa[_0x074f('0x4b')](_0x3db639);}})[_0x074f('0x24')](function(_0x4556d0){if(_0x4556d0){return _0x4556d0?{'count':_0x32684a,'rows':_0x4556d0}:null;}})['then'](respondWithResult(_0x563343,null))['catch'](handleError(_0x563343,null));};exports['addConfiguration']=function(_0x3766f0,_0x5f3856,_0x2bb228){if(_0x3766f0['body']['id']){delete _0x3766f0[_0x074f('0x49')]['id'];}return db[_0x074f('0x40')]['findOne']({'where':{'id':_0x3766f0[_0x074f('0x46')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x5f3856,null))[_0x074f('0x24')](function(_0xfb52ca){if(_0xfb52ca){_0x3766f0[_0x074f('0x49')][_0x074f('0x4e')]=_0xfb52ca['id'];_0x3766f0[_0x074f('0x49')]['Subjects']=integrations[_0x074f('0x4f')](_0x3766f0[_0x074f('0x49')]['channel'],_0x3766f0[_0x074f('0x49')][_0x074f('0x2e')]);_0x3766f0[_0x074f('0x49')][_0x074f('0x50')]=integrations['getDescriptions'](_0x3766f0[_0x074f('0x49')][_0x074f('0x51')],_0x3766f0[_0x074f('0x49')]['type']);return db['FreshdeskConfiguration'][_0x074f('0x48')](_0x3766f0[_0x074f('0x49')],{'include':[{'model':db[_0x074f('0x52')],'as':_0x074f('0x53')},{'model':db[_0x074f('0x52')],'as':'Descriptions'}]});}return null;})[_0x074f('0x24')](respondWithResult(_0x5f3856,null))['catch'](handleError(_0x5f3856,null));};exports[_0x074f('0x54')]=function(_0x7eb0e2,_0x174a0d,_0x16136a){var _0x11c51c='';return db[_0x074f('0x40')][_0x074f('0x4c')]({'where':{'id':_0x7eb0e2[_0x074f('0x46')]['id']},'attributes':['id',_0x074f('0x55'),_0x074f('0x56')]})[_0x074f('0x24')](handleEntityNotFound(_0x174a0d,null))['then'](function(_0x10483b){if(_0x10483b){_0x11c51c=_0x10483b[_0x074f('0x55')];var _0x5af568=_0x11c51c['slice'](-0x1);if(_0x5af568==='/'){_0x11c51c=_0x11c51c['substring'](0x0,_0x11c51c[_0x074f('0x57')](_0x5af568));}return rp({'method':_0x074f('0x58'),'uri':util[_0x074f('0x59')](_0x074f('0x5a'),_0x11c51c,_0x074f('0x5b')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x074f('0x59')]('%s:X',_0x10483b[_0x074f('0x56')]))['toString'](_0x074f('0x5c')))},'json':!![]});}})['then'](function(_0x532ed3){if(_0x532ed3){var _0x304732=[_0x074f('0x5d'),_0x074f('0x5e'),_0x074f('0x5f'),'description',_0x074f('0x18'),'priority',_0x074f('0x60'),_0x074f('0x61'),'ticket_type',_0x074f('0x60'),_0x074f('0x62')];_[_0x074f('0x63')](_0x532ed3,function(_0x4cfb9b){return _0x304732['includes'](_0x4cfb9b[_0x074f('0x29')])||!_0x4cfb9b[_0x074f('0x64')]&&_0x4cfb9b[_0x074f('0x2e')]!==_0x074f('0x65')&&_0x4cfb9b[_0x074f('0x2e')]!==_0x074f('0x66');});return{'count':_0x532ed3[_0x074f('0x36')],'rows':_['map'](_0x532ed3,function(_0xf4da83){return{'id':_0xf4da83[_0x074f('0x29')],'name':_0xf4da83[_0x074f('0x67')],'custom':!_0xf4da83['default'],'options':_0xf4da83[_0x074f('0x68')]?_['map'](_0xf4da83[_0x074f('0x68')],function(_0x46d0c6){return{'name':_[_0x074f('0x69')](_0x46d0c6),'value':_0x46d0c6};}):[]};})};}})[_0x074f('0x24')](respondWithResult(_0x174a0d,null))[_0x074f('0x44')](function(_0x4ad3cc){var _0x347030=_0x7eb0e2[_0x074f('0x31')]['test']?0x1f4:_0x4ad3cc['statusCode']||0x1f4;logger['error'](_0x074f('0x6a'),'getFields',_0x347030,JSON[_0x074f('0x6b')](_0x4ad3cc));delete _0x4ad3cc[_0x074f('0x29')];if(_0x347030===0x191){_0x347030=0x190;}_0x174a0d[_0x074f('0x18')](_0x347030)[_0x074f('0x6c')](_0x7eb0e2[_0x074f('0x31')][_0x074f('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x4ad3cc[_0x074f('0x6e')]}:_0x4ad3cc);});}; \ No newline at end of file +var _0x41bb=['../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','pick','map','addConfiguration','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','slice','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','description','source','ticket_type','company','includes','custom_text','custom_dropdown','choices','capitalize','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5c0dfb,_0x29fe5e){var _0x49be35=function(_0xd36496){while(--_0xd36496){_0x5c0dfb['push'](_0x5c0dfb['shift']());}};_0x49be35(++_0x29fe5e);}(_0x41bb,0xc5));var _0xb41b=function(_0x223c01,_0x10a89e){_0x223c01=_0x223c01-0x0;var _0x458dae=_0x41bb[_0x223c01];return _0x458dae;};'use strict';var emlformat=require(_0xb41b('0x0'));var rimraf=require(_0xb41b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb41b('0x2'));var rp=require('request-promise');var moment=require(_0xb41b('0x3'));var BPromise=require(_0xb41b('0x4'));var Mustache=require(_0xb41b('0x5'));var util=require(_0xb41b('0x6'));var path=require('path');var sox=require(_0xb41b('0x7'));var csv=require(_0xb41b('0x8'));var ejs=require(_0xb41b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb41b('0xa'));var jsforce=require(_0xb41b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb41b('0x8'));var querystring=require(_0xb41b('0xc'));var Papa=require(_0xb41b('0xd'));var Redis=require(_0xb41b('0xe'));var authService=require(_0xb41b('0xf'));var qs=require(_0xb41b('0x10'));var as=require(_0xb41b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb41b('0x12'))('api');var utils=require(_0xb41b('0x13'));var config=require(_0xb41b('0x14'));var licenseUtil=require(_0xb41b('0x15'));var db=require(_0xb41b('0x16'))['db'];var integrations=require(_0xb41b('0x17'));function respondWithStatusCode(_0x5f1ea4,_0x353ba3){_0x353ba3=_0x353ba3||0xcc;return function(_0x2d947a){if(_0x2d947a){return _0x5f1ea4[_0xb41b('0x18')](_0x353ba3);}return _0x5f1ea4[_0xb41b('0x19')](_0x353ba3)[_0xb41b('0x1a')]();};}function respondWithResult(_0x4e8603,_0x4e7f11){_0x4e7f11=_0x4e7f11||0xc8;return function(_0x55e507){if(_0x55e507){return _0x4e8603[_0xb41b('0x19')](_0x4e7f11)[_0xb41b('0x1b')](_0x55e507);}};}function respondWithFilteredResult(_0x143a81,_0x338920){return function(_0x29ea51){if(_0x29ea51){var _0x54591e=typeof _0x338920[_0xb41b('0x1c')]===_0xb41b('0x1d')&&typeof _0x338920[_0xb41b('0x1e')]===_0xb41b('0x1d');var _0x43f4ea=_0x29ea51[_0xb41b('0x1f')];var _0x198783=_0x54591e?0x0:_0x338920['offset'];var _0x4b3580=_0x54591e?_0x29ea51['count']:_0x338920[_0xb41b('0x1c')]+_0x338920['limit'];var _0x307633;if(_0x4b3580>=_0x43f4ea){_0x4b3580=_0x43f4ea;_0x307633=0xc8;}else{_0x307633=0xce;}_0x143a81[_0xb41b('0x19')](_0x307633);return _0x143a81[_0xb41b('0x20')]('Content-Range',_0x198783+'-'+_0x4b3580+'/'+_0x43f4ea)['json'](_0x29ea51);}return null;};}function patchUpdates(_0x1a1386){return function(_0x3b6ffb){try{jsonpatch[_0xb41b('0x21')](_0x3b6ffb,_0x1a1386,!![]);}catch(_0x2373f4){return BPromise[_0xb41b('0x22')](_0x2373f4);}return _0x3b6ffb[_0xb41b('0x23')]();};}function saveUpdates(_0x4c73da,_0x58f149){return function(_0x2b436f){if(_0x2b436f){return _0x2b436f[_0xb41b('0x24')](_0x4c73da)[_0xb41b('0x25')](function(_0x583741){return _0x583741;});}return null;};}function removeEntity(_0x14e9c8,_0x2441d6){return function(_0x546101){if(_0x546101){return _0x546101[_0xb41b('0x26')]()[_0xb41b('0x25')](function(){_0x14e9c8['status'](0xcc)[_0xb41b('0x1a')]();});}};}function handleEntityNotFound(_0x4a7992,_0x2d0f27){return function(_0x4c6a91){if(!_0x4c6a91){_0x4a7992['sendStatus'](0x194);}return _0x4c6a91;};}function handleError(_0x3af2c,_0x4265b8){_0x4265b8=_0x4265b8||0x1f4;return function(_0x583099){logger['error'](_0x583099[_0xb41b('0x27')]);if(_0x583099[_0xb41b('0x28')]){delete _0x583099[_0xb41b('0x28')];}_0x3af2c[_0xb41b('0x19')](_0x4265b8)[_0xb41b('0x29')](_0x583099);};}exports[_0xb41b('0x2a')]=function(_0x253efb,_0x545395){var _0x26ef96={},_0xb68029={},_0x5069aa={'count':0x0,'rows':[]};var _0xe64568=_['map'](db[_0xb41b('0x2b')][_0xb41b('0x2c')],function(_0x597a35){return{'name':_0x597a35[_0xb41b('0x2d')],'type':_0x597a35['type'][_0xb41b('0x2e')]};});_0xb68029[_0xb41b('0x2f')]=_['map'](_0xe64568,_0xb41b('0x28'));_0xb68029[_0xb41b('0x30')]=_[_0xb41b('0x31')](_0x253efb[_0xb41b('0x30')]);_0xb68029[_0xb41b('0x32')]=_[_0xb41b('0x33')](_0xb68029[_0xb41b('0x2f')],_0xb68029[_0xb41b('0x30')]);_0x26ef96[_0xb41b('0x34')]=_[_0xb41b('0x33')](_0xb68029['model'],qs[_0xb41b('0x35')](_0x253efb['query']['fields']));_0x26ef96[_0xb41b('0x34')]=_0x26ef96[_0xb41b('0x34')][_0xb41b('0x36')]?_0x26ef96[_0xb41b('0x34')]:_0xb68029[_0xb41b('0x2f')];if(!_0x253efb[_0xb41b('0x30')][_0xb41b('0x37')](_0xb41b('0x38'))){_0x26ef96[_0xb41b('0x1e')]=qs[_0xb41b('0x1e')](_0x253efb[_0xb41b('0x30')]['limit']);_0x26ef96[_0xb41b('0x1c')]=qs[_0xb41b('0x1c')](_0x253efb[_0xb41b('0x30')][_0xb41b('0x1c')]);}_0x26ef96[_0xb41b('0x39')]=qs[_0xb41b('0x3a')](_0x253efb['query']['sort']);_0x26ef96[_0xb41b('0x3b')]=qs[_0xb41b('0x32')](_['pick'](_0x253efb[_0xb41b('0x30')],_0xb68029[_0xb41b('0x32')]),_0xe64568);if(_0x253efb[_0xb41b('0x30')][_0xb41b('0x3c')]){_0x26ef96[_0xb41b('0x3b')]=_['merge'](_0x26ef96[_0xb41b('0x3b')],{'$or':_['map'](_0xe64568,function(_0x7d43d1){if(_0x7d43d1[_0xb41b('0x3d')]!==_0xb41b('0x3e')){var _0x40789b={};_0x40789b[_0x7d43d1[_0xb41b('0x28')]]={'$like':'%'+_0x253efb[_0xb41b('0x30')][_0xb41b('0x3c')]+'%'};return _0x40789b;}})});}_0x26ef96=_[_0xb41b('0x3f')]({},_0x26ef96,_0x253efb[_0xb41b('0x40')]);var _0x578b67={'where':_0x26ef96['where']};return db['FreshdeskAccount'][_0xb41b('0x1f')](_0x578b67)['then'](function(_0x56a415){_0x5069aa[_0xb41b('0x1f')]=_0x56a415;if(_0x253efb['query'][_0xb41b('0x41')]){_0x26ef96[_0xb41b('0x42')]=[{'all':!![]}];}return db[_0xb41b('0x2b')][_0xb41b('0x43')](_0x26ef96);})[_0xb41b('0x25')](function(_0x25c5b7){_0x5069aa[_0xb41b('0x44')]=_0x25c5b7;return _0x5069aa;})['then'](respondWithFilteredResult(_0x545395,_0x26ef96))[_0xb41b('0x45')](handleError(_0x545395,null));};exports[_0xb41b('0x46')]=function(_0x3f181c,_0x174d6c){var _0x47bab5={'raw':![],'where':{'id':_0x3f181c['params']['id']}},_0x2f1391={};_0x2f1391[_0xb41b('0x2f')]=_[_0xb41b('0x31')](db[_0xb41b('0x2b')]['rawAttributes']);_0x2f1391['query']=_[_0xb41b('0x31')](_0x3f181c[_0xb41b('0x30')]);_0x2f1391[_0xb41b('0x32')]=_[_0xb41b('0x33')](_0x2f1391[_0xb41b('0x2f')],_0x2f1391[_0xb41b('0x30')]);_0x47bab5[_0xb41b('0x34')]=_['intersection'](_0x2f1391['model'],qs[_0xb41b('0x35')](_0x3f181c['query'][_0xb41b('0x35')]));_0x47bab5['attributes']=_0x47bab5[_0xb41b('0x34')]['length']?_0x47bab5[_0xb41b('0x34')]:_0x2f1391['model'];if(_0x3f181c[_0xb41b('0x30')][_0xb41b('0x41')]){_0x47bab5[_0xb41b('0x42')]=[{'all':!![]}];}_0x47bab5=_[_0xb41b('0x3f')]({},_0x47bab5,_0x3f181c['options']);return db[_0xb41b('0x2b')][_0xb41b('0x47')](_0x47bab5)['then'](handleEntityNotFound(_0x174d6c,null))[_0xb41b('0x25')](respondWithResult(_0x174d6c,null))['catch'](handleError(_0x174d6c,null));};exports['create']=function(_0x5733d0,_0x5bea5e){return db[_0xb41b('0x2b')][_0xb41b('0x48')](_0x5733d0[_0xb41b('0x49')],{})[_0xb41b('0x25')](respondWithResult(_0x5bea5e,0xc9))[_0xb41b('0x45')](handleError(_0x5bea5e,null));};exports[_0xb41b('0x24')]=function(_0x34d076,_0x3852ae){if(_0x34d076[_0xb41b('0x49')]['id']){delete _0x34d076[_0xb41b('0x49')]['id'];}return db[_0xb41b('0x2b')][_0xb41b('0x47')]({'where':{'id':_0x34d076[_0xb41b('0x4a')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x3852ae,null))[_0xb41b('0x25')](saveUpdates(_0x34d076[_0xb41b('0x49')],null))['then'](respondWithResult(_0x3852ae,null))[_0xb41b('0x45')](handleError(_0x3852ae,null));};exports['destroy']=function(_0x4a7aa3,_0x326145){return db[_0xb41b('0x2b')][_0xb41b('0x47')]({'where':{'id':_0x4a7aa3[_0xb41b('0x4a')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x326145,null))[_0xb41b('0x25')](removeEntity(_0x326145,null))[_0xb41b('0x45')](handleError(_0x326145,null));};exports[_0xb41b('0x4b')]=function(_0x2befc7,_0x1977b1,_0x408d4f){var _0x2e5113={};var _0x236c05={};var _0x3ce89e;var _0x2a6124;return db[_0xb41b('0x2b')][_0xb41b('0x4c')]({'where':{'id':_0x2befc7[_0xb41b('0x4a')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x1977b1,null))[_0xb41b('0x25')](function(_0x2f847e){if(_0x2f847e){_0x3ce89e=_0x2f847e;_0x236c05['model']=_[_0xb41b('0x31')](db['FreshdeskConfiguration'][_0xb41b('0x2c')]);_0x236c05[_0xb41b('0x30')]=_[_0xb41b('0x31')](_0x2befc7[_0xb41b('0x30')]);_0x236c05[_0xb41b('0x32')]=_[_0xb41b('0x33')](_0x236c05[_0xb41b('0x2f')],_0x236c05['query']);_0x2e5113[_0xb41b('0x34')]=_[_0xb41b('0x33')](_0x236c05[_0xb41b('0x2f')],qs['fields'](_0x2befc7[_0xb41b('0x30')][_0xb41b('0x35')]));_0x2e5113[_0xb41b('0x34')]=_0x2e5113[_0xb41b('0x34')][_0xb41b('0x36')]?_0x2e5113[_0xb41b('0x34')]:_0x236c05[_0xb41b('0x2f')];_0x2e5113['order']=qs['sort'](_0x2befc7[_0xb41b('0x30')][_0xb41b('0x3a')]);_0x2e5113['where']=qs[_0xb41b('0x32')](_[_0xb41b('0x4d')](_0x2befc7['query'],_0x236c05[_0xb41b('0x32')]));if(_0x2befc7[_0xb41b('0x30')][_0xb41b('0x3c')]){_0x2e5113[_0xb41b('0x3b')]=_[_0xb41b('0x3f')](_0x2e5113[_0xb41b('0x3b')],{'$or':_[_0xb41b('0x4e')](_0x2e5113[_0xb41b('0x34')],function(_0x182b8a){var _0x331e98={};_0x331e98[_0x182b8a]={'$like':'%'+_0x2befc7['query'][_0xb41b('0x3c')]+'%'};return _0x331e98;})});}_0x2e5113=_[_0xb41b('0x3f')]({},_0x2e5113,_0x2befc7['options']);return _0x3ce89e['getConfigurations'](_0x2e5113);}})[_0xb41b('0x25')](function(_0x185054){if(_0x185054){_0x2a6124=_0x185054[_0xb41b('0x36')];if(!_0x2befc7['query'][_0xb41b('0x37')](_0xb41b('0x38'))){_0x2e5113[_0xb41b('0x1e')]=qs[_0xb41b('0x1e')](_0x2befc7[_0xb41b('0x30')][_0xb41b('0x1e')]);_0x2e5113[_0xb41b('0x1c')]=qs[_0xb41b('0x1c')](_0x2befc7[_0xb41b('0x30')][_0xb41b('0x1c')]);}return _0x3ce89e['getConfigurations'](_0x2e5113);}})[_0xb41b('0x25')](function(_0x164f30){if(_0x164f30){return _0x164f30?{'count':_0x2a6124,'rows':_0x164f30}:null;}})['then'](respondWithResult(_0x1977b1,null))[_0xb41b('0x45')](handleError(_0x1977b1,null));};exports[_0xb41b('0x4f')]=function(_0x28da01,_0x48e95d,_0x23b64e){if(_0x28da01[_0xb41b('0x49')]['id']){delete _0x28da01[_0xb41b('0x49')]['id'];}return db[_0xb41b('0x2b')][_0xb41b('0x4c')]({'where':{'id':_0x28da01[_0xb41b('0x4a')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x48e95d,null))[_0xb41b('0x25')](function(_0x35d1c5){if(_0x35d1c5){_0x28da01[_0xb41b('0x49')]['AccountId']=_0x35d1c5['id'];_0x28da01['body']['Subjects']=integrations['getSubjects'](_0x28da01[_0xb41b('0x49')][_0xb41b('0x50')],_0x28da01[_0xb41b('0x49')][_0xb41b('0x3d')]);_0x28da01[_0xb41b('0x49')][_0xb41b('0x51')]=integrations['getDescriptions'](_0x28da01[_0xb41b('0x49')]['channel'],_0x28da01[_0xb41b('0x49')]['type']);return db[_0xb41b('0x52')]['create'](_0x28da01[_0xb41b('0x49')],{'include':[{'model':db[_0xb41b('0x53')],'as':'Subjects'},{'model':db[_0xb41b('0x53')],'as':_0xb41b('0x51')}]});}return null;})[_0xb41b('0x25')](respondWithResult(_0x48e95d,null))[_0xb41b('0x45')](handleError(_0x48e95d,null));};exports[_0xb41b('0x54')]=function(_0x1c0131,_0x31efa4,_0x523c72){var _0xf3c1bb='';return db['FreshdeskAccount'][_0xb41b('0x4c')]({'where':{'id':_0x1c0131[_0xb41b('0x4a')]['id']},'attributes':['id',_0xb41b('0x55'),'apiKey']})['then'](handleEntityNotFound(_0x31efa4,null))['then'](function(_0x571e41){if(_0x571e41){_0xf3c1bb=_0x571e41[_0xb41b('0x55')];var _0x106fdb=_0xf3c1bb[_0xb41b('0x56')](-0x1);if(_0x106fdb==='/'){_0xf3c1bb=_0xf3c1bb['substring'](0x0,_0xf3c1bb['lastIndexOf'](_0x106fdb));}return rp({'method':_0xb41b('0x57'),'uri':util[_0xb41b('0x58')](_0xb41b('0x59'),_0xf3c1bb,_0xb41b('0x5a')),'headers':{'Authorization':util[_0xb41b('0x58')](_0xb41b('0x5b'),new Buffer(util[_0xb41b('0x58')]('%s:X',_0x571e41['apiKey']))[_0xb41b('0x5c')](_0xb41b('0x5d')))},'json':!![]});}})['then'](function(_0x275e12){if(_0x275e12){var _0x5dd752=[_0xb41b('0x5e'),_0xb41b('0x5f'),'agent',_0xb41b('0x60'),_0xb41b('0x19'),'priority','group',_0xb41b('0x61'),_0xb41b('0x62'),'group',_0xb41b('0x63')];_['remove'](_0x275e12,function(_0x310fec){return _0x5dd752[_0xb41b('0x64')](_0x310fec['name'])||!_0x310fec['default']&&_0x310fec[_0xb41b('0x3d')]!==_0xb41b('0x65')&&_0x310fec['type']!==_0xb41b('0x66');});return{'count':_0x275e12[_0xb41b('0x36')],'rows':_[_0xb41b('0x4e')](_0x275e12,function(_0x5dd56d){return{'id':_0x5dd56d[_0xb41b('0x28')],'name':_0x5dd56d['label'],'custom':!_0x5dd56d['default'],'options':_0x5dd56d[_0xb41b('0x67')]?_[_0xb41b('0x4e')](_0x5dd56d[_0xb41b('0x67')],function(_0x12d086){return{'name':_[_0xb41b('0x68')](_0x12d086),'value':_0x12d086};}):[]};})};}})[_0xb41b('0x25')](respondWithResult(_0x31efa4,null))[_0xb41b('0x45')](function(_0x3872fd){var _0x47577e=_0x1c0131[_0xb41b('0x30')][_0xb41b('0x69')]?0x1f4:_0x3872fd[_0xb41b('0x6a')]||0x1f4;logger[_0xb41b('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0xb41b('0x54'),_0x47577e,JSON[_0xb41b('0x6c')](_0x3872fd));delete _0x3872fd[_0xb41b('0x28')];if(_0x47577e===0x191){_0x47577e=0x190;}_0x31efa4[_0xb41b('0x19')](_0x47577e)[_0xb41b('0x29')](_0x1c0131[_0xb41b('0x30')][_0xb41b('0x69')]?{'message':_0xb41b('0x6d'),'statusCode':_0x3872fd['statusCode']}:_0x3872fd);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index a7c6ef7..78e53ac 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 _0xd381=['../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x20530a,_0xb58828){var _0x5a2397=function(_0x16ece4){while(--_0x16ece4){_0x20530a['push'](_0x20530a['shift']());}};_0x5a2397(++_0xb58828);}(_0xd381,0x1e2));var _0x1d38=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xd381[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x1d38('0x0'));var util=require(_0x1d38('0x1'));var logger=require('../../config/logger')(_0x1d38('0x2'));var moment=require(_0x1d38('0x3'));var BPromise=require(_0x1d38('0x4'));var rp=require(_0x1d38('0x5'));var fs=require('fs');var path=require(_0x1d38('0x6'));var rimraf=require(_0x1d38('0x7'));var config=require(_0x1d38('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x1d38('0x9'));module[_0x1d38('0xa')]=function(_0x1e33bd,_0x176a53){return _0x1e33bd[_0x1d38('0xb')](_0x1d38('0xc'),attributes,{'tableName':_0x1d38('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fe7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x1ff12c,_0x40e32e){var _0x5163f3=function(_0x4c6a98){while(--_0x4c6a98){_0x1ff12c['push'](_0x1ff12c['shift']());}};_0x5163f3(++_0x40e32e);}(_0x6fe7,0x106));var _0x76fe=function(_0x1b2257,_0x51eb18){_0x1b2257=_0x1b2257-0x0;var _0x42023d=_0x6fe7[_0x1b2257];return _0x42023d;};'use strict';var _=require(_0x76fe('0x0'));var util=require(_0x76fe('0x1'));var logger=require(_0x76fe('0x2'))(_0x76fe('0x3'));var moment=require(_0x76fe('0x4'));var BPromise=require(_0x76fe('0x5'));var rp=require(_0x76fe('0x6'));var fs=require('fs');var path=require(_0x76fe('0x7'));var rimraf=require(_0x76fe('0x8'));var config=require(_0x76fe('0x9'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x76fe('0xa'));module['exports']=function(_0x17ffb1,_0x3ddbaf){return _0x17ffb1[_0x76fe('0xb')](_0x76fe('0xc'),attributes,{'tableName':_0x76fe('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 05a6a93..f401a2d 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 _0xca89=['code','message','info','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','limit','map','include','model','attributes','ShowFreshdeskAccount','find','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x578098,_0x299627){var _0x2b1bbd=function(_0x68d050){while(--_0x68d050){_0x578098['push'](_0x578098['shift']());}};_0x2b1bbd(++_0x299627);}(_0xca89,0x187));var _0x9ca8=function(_0x5df28f,_0x49ae9a){_0x5df28f=_0x5df28f-0x0;var _0xac6fec=_0xca89[_0x5df28f];return _0xac6fec;};'use strict';var _=require('lodash');var util=require(_0x9ca8('0x0'));var moment=require(_0x9ca8('0x1'));var BPromise=require(_0x9ca8('0x2'));var rs=require(_0x9ca8('0x3'));var fs=require('fs');var Redis=require(_0x9ca8('0x4'));var db=require(_0x9ca8('0x5'))['db'];var utils=require(_0x9ca8('0x6'));var logger=require(_0x9ca8('0x7'))(_0x9ca8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9ca8('0x9')][_0x9ca8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fc034,_0xc1d3b1,_0x9d4625){return new BPromise(function(_0x26b2d3,_0x5c3d26){return client[_0x9ca8('0xb')](_0x3fc034,_0x9d4625)['then'](function(_0x2e81bf){logger['info'](_0x9ca8('0xc'),_0xc1d3b1,'request\x20sent');logger[_0x9ca8('0xd')](_0x9ca8('0xe'),_0xc1d3b1,_0x9ca8('0xf'),JSON['stringify'](_0x2e81bf));if(_0x2e81bf[_0x9ca8('0x10')]){if(_0x2e81bf[_0x9ca8('0x10')][_0x9ca8('0x11')]===0x1f4){logger['error'](_0x9ca8('0xc'),_0xc1d3b1,_0x2e81bf[_0x9ca8('0x10')]['message']);return _0x5c3d26(_0x2e81bf['error'][_0x9ca8('0x12')]);}logger[_0x9ca8('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xc1d3b1,_0x2e81bf['error']['message']);return _0x26b2d3(_0x2e81bf['error'][_0x9ca8('0x12')]);}else{logger[_0x9ca8('0x13')](_0x9ca8('0xc'),_0xc1d3b1,_0x9ca8('0xf'));_0x26b2d3(_0x2e81bf['result'][_0x9ca8('0x12')]);}})[_0x9ca8('0x14')](function(_0x38224e){logger[_0x9ca8('0x10')](_0x9ca8('0xc'),_0xc1d3b1,_0x38224e);_0x5c3d26(_0x38224e);});});}exports[_0x9ca8('0x15')]=function(_0x41fe6b){var _0x2563bf=this;return new Promise(function(_0x326516,_0x148bb0){return db[_0x9ca8('0x16')]['findAll']({'raw':_0x41fe6b[_0x9ca8('0x17')]?_0x41fe6b[_0x9ca8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x41fe6b[_0x9ca8('0x17')]?_0x41fe6b[_0x9ca8('0x17')][_0x9ca8('0x18')]||null:null,'attributes':_0x41fe6b[_0x9ca8('0x17')]?_0x41fe6b[_0x9ca8('0x17')]['attributes']||null:null,'limit':_0x41fe6b[_0x9ca8('0x17')]?_0x41fe6b[_0x9ca8('0x17')][_0x9ca8('0x19')]||null:null,'include':_0x41fe6b[_0x9ca8('0x17')]?_0x41fe6b['options']['include']?_[_0x9ca8('0x1a')](_0x41fe6b['options'][_0x9ca8('0x1b')],function(_0x3ec9ef){return{'model':db[_0x3ec9ef[_0x9ca8('0x1c')]],'as':_0x3ec9ef['as'],'attributes':_0x3ec9ef[_0x9ca8('0x1d')],'include':_0x3ec9ef[_0x9ca8('0x1b')]?_[_0x9ca8('0x1a')](_0x3ec9ef[_0x9ca8('0x1b')],function(_0x497c7a){return{'model':db[_0x497c7a[_0x9ca8('0x1c')]],'as':_0x497c7a['as'],'attributes':_0x497c7a[_0x9ca8('0x1d')],'include':_0x497c7a['include']?_[_0x9ca8('0x1a')](_0x497c7a[_0x9ca8('0x1b')],function(_0x182285){return{'model':db[_0x182285[_0x9ca8('0x1c')]],'as':_0x182285['as'],'attributes':_0x182285[_0x9ca8('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x303644){logger[_0x9ca8('0x13')](_0x9ca8('0x15'),_0x41fe6b);logger[_0x9ca8('0xd')]('GetFreshdeskAccount',_0x41fe6b,JSON['stringify'](_0x303644));_0x326516(_0x303644);})['catch'](function(_0x11dd51){logger[_0x9ca8('0x10')](_0x9ca8('0x15'),_0x11dd51['message'],_0x41fe6b);_0x148bb0(_0x2563bf['error'](0x1f4,_0x11dd51[_0x9ca8('0x12')]));});});};exports[_0x9ca8('0x1e')]=function(_0x28e5b6){var _0x4a9b4e=this;return new Promise(function(_0x4690c1,_0x3f5831){return db[_0x9ca8('0x16')][_0x9ca8('0x1f')]({'raw':_0x28e5b6[_0x9ca8('0x17')]?_0x28e5b6[_0x9ca8('0x17')][_0x9ca8('0x20')]===undefined?!![]:![]:!![],'where':_0x28e5b6[_0x9ca8('0x17')]?_0x28e5b6[_0x9ca8('0x17')][_0x9ca8('0x18')]||null:null,'attributes':_0x28e5b6[_0x9ca8('0x17')]?_0x28e5b6[_0x9ca8('0x17')][_0x9ca8('0x1d')]||null:null,'include':_0x28e5b6[_0x9ca8('0x17')]?_0x28e5b6['options'][_0x9ca8('0x1b')]?_[_0x9ca8('0x1a')](_0x28e5b6[_0x9ca8('0x17')][_0x9ca8('0x1b')],function(_0x2716c6){return{'model':db[_0x2716c6[_0x9ca8('0x1c')]],'as':_0x2716c6['as'],'attributes':_0x2716c6[_0x9ca8('0x1d')],'include':_0x2716c6[_0x9ca8('0x1b')]?_[_0x9ca8('0x1a')](_0x2716c6[_0x9ca8('0x1b')],function(_0x2dfc69){return{'model':db[_0x2dfc69[_0x9ca8('0x1c')]],'as':_0x2dfc69['as'],'attributes':_0x2dfc69[_0x9ca8('0x1d')],'include':_0x2dfc69[_0x9ca8('0x1b')]?_[_0x9ca8('0x1a')](_0x2dfc69[_0x9ca8('0x1b')],function(_0x39275f){return{'model':db[_0x39275f['model']],'as':_0x39275f['as'],'attributes':_0x39275f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2de12b){logger['info']('ShowFreshdeskAccount',_0x28e5b6);logger[_0x9ca8('0xd')](_0x9ca8('0x1e'),_0x28e5b6,JSON[_0x9ca8('0x21')](_0x2de12b));_0x4690c1(_0x2de12b);})[_0x9ca8('0x14')](function(_0x311bd9){logger[_0x9ca8('0x10')](_0x9ca8('0x1e'),_0x311bd9['message'],_0x28e5b6);_0x3f5831(_0x4a9b4e[_0x9ca8('0x10')](0x1f4,_0x311bd9['message']));});});}; \ No newline at end of file +var _0x8eca=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','include','model','map','ShowFreshdeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info'];(function(_0x41a237,_0x2647d7){var _0x276a84=function(_0x366c14){while(--_0x366c14){_0x41a237['push'](_0x41a237['shift']());}};_0x276a84(++_0x2647d7);}(_0x8eca,0x114));var _0xa8ec=function(_0xd13171,_0xc54453){_0xd13171=_0xd13171-0x0;var _0x452bd0=_0x8eca[_0xd13171];return _0x452bd0;};'use strict';var _=require(_0xa8ec('0x0'));var util=require('util');var moment=require(_0xa8ec('0x1'));var BPromise=require(_0xa8ec('0x2'));var rs=require(_0xa8ec('0x3'));var fs=require('fs');var Redis=require(_0xa8ec('0x4'));var db=require(_0xa8ec('0x5'))['db'];var utils=require(_0xa8ec('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa8ec('0x7'));var client=jayson[_0xa8ec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c85a7,_0x888a29,_0x56cf27){return new BPromise(function(_0x245560,_0x4c1d2f){return client[_0xa8ec('0x9')](_0x3c85a7,_0x56cf27)[_0xa8ec('0xa')](function(_0x603fe3){logger[_0xa8ec('0xb')](_0xa8ec('0xc'),_0x888a29,_0xa8ec('0xd'));logger[_0xa8ec('0xe')](_0xa8ec('0xf'),_0x888a29,_0xa8ec('0xd'),JSON[_0xa8ec('0x10')](_0x603fe3));if(_0x603fe3[_0xa8ec('0x11')]){if(_0x603fe3[_0xa8ec('0x11')]['code']===0x1f4){logger[_0xa8ec('0x11')](_0xa8ec('0xc'),_0x888a29,_0x603fe3['error'][_0xa8ec('0x12')]);return _0x4c1d2f(_0x603fe3[_0xa8ec('0x11')][_0xa8ec('0x12')]);}logger[_0xa8ec('0x11')](_0xa8ec('0xc'),_0x888a29,_0x603fe3[_0xa8ec('0x11')][_0xa8ec('0x12')]);return _0x245560(_0x603fe3[_0xa8ec('0x11')][_0xa8ec('0x12')]);}else{logger[_0xa8ec('0xb')](_0xa8ec('0xc'),_0x888a29,'request\x20sent');_0x245560(_0x603fe3[_0xa8ec('0x13')][_0xa8ec('0x12')]);}})[_0xa8ec('0x14')](function(_0xfc643f){logger[_0xa8ec('0x11')](_0xa8ec('0xc'),_0x888a29,_0xfc643f);_0x4c1d2f(_0xfc643f);});});}exports[_0xa8ec('0x15')]=function(_0xa31918){var _0x4a5286=this;return new Promise(function(_0x4ddf5f,_0x555d79){return db[_0xa8ec('0x16')]['findAll']({'raw':_0xa31918[_0xa8ec('0x17')]?_0xa31918['options'][_0xa8ec('0x18')]===undefined?!![]:![]:!![],'where':_0xa31918[_0xa8ec('0x17')]?_0xa31918[_0xa8ec('0x17')][_0xa8ec('0x19')]||null:null,'attributes':_0xa31918['options']?_0xa31918['options'][_0xa8ec('0x1a')]||null:null,'limit':_0xa31918[_0xa8ec('0x17')]?_0xa31918[_0xa8ec('0x17')]['limit']||null:null,'include':_0xa31918[_0xa8ec('0x17')]?_0xa31918[_0xa8ec('0x17')]['include']?_['map'](_0xa31918[_0xa8ec('0x17')][_0xa8ec('0x1b')],function(_0x24d108){return{'model':db[_0x24d108[_0xa8ec('0x1c')]],'as':_0x24d108['as'],'attributes':_0x24d108['attributes'],'include':_0x24d108['include']?_['map'](_0x24d108['include'],function(_0x510528){return{'model':db[_0x510528['model']],'as':_0x510528['as'],'attributes':_0x510528[_0xa8ec('0x1a')],'include':_0x510528[_0xa8ec('0x1b')]?_[_0xa8ec('0x1d')](_0x510528[_0xa8ec('0x1b')],function(_0x152343){return{'model':db[_0x152343[_0xa8ec('0x1c')]],'as':_0x152343['as'],'attributes':_0x152343[_0xa8ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa8ec('0xa')](function(_0x419931){logger['info']('GetFreshdeskAccount',_0xa31918);logger[_0xa8ec('0xe')]('GetFreshdeskAccount',_0xa31918,JSON[_0xa8ec('0x10')](_0x419931));_0x4ddf5f(_0x419931);})[_0xa8ec('0x14')](function(_0x411952){logger[_0xa8ec('0x11')](_0xa8ec('0x15'),_0x411952[_0xa8ec('0x12')],_0xa31918);_0x555d79(_0x4a5286[_0xa8ec('0x11')](0x1f4,_0x411952[_0xa8ec('0x12')]));});});};exports[_0xa8ec('0x1e')]=function(_0x2e92e8){var _0x304dc1=this;return new Promise(function(_0x61d4e0,_0x9a0795){return db[_0xa8ec('0x16')][_0xa8ec('0x1f')]({'raw':_0x2e92e8[_0xa8ec('0x17')]?_0x2e92e8['options'][_0xa8ec('0x18')]===undefined?!![]:![]:!![],'where':_0x2e92e8[_0xa8ec('0x17')]?_0x2e92e8[_0xa8ec('0x17')][_0xa8ec('0x19')]||null:null,'attributes':_0x2e92e8[_0xa8ec('0x17')]?_0x2e92e8[_0xa8ec('0x17')][_0xa8ec('0x1a')]||null:null,'include':_0x2e92e8[_0xa8ec('0x17')]?_0x2e92e8['options'][_0xa8ec('0x1b')]?_[_0xa8ec('0x1d')](_0x2e92e8[_0xa8ec('0x17')]['include'],function(_0x20cdd8){return{'model':db[_0x20cdd8[_0xa8ec('0x1c')]],'as':_0x20cdd8['as'],'attributes':_0x20cdd8[_0xa8ec('0x1a')],'include':_0x20cdd8[_0xa8ec('0x1b')]?_[_0xa8ec('0x1d')](_0x20cdd8['include'],function(_0x287db4){return{'model':db[_0x287db4[_0xa8ec('0x1c')]],'as':_0x287db4['as'],'attributes':_0x287db4['attributes'],'include':_0x287db4[_0xa8ec('0x1b')]?_['map'](_0x287db4[_0xa8ec('0x1b')],function(_0x5a110b){return{'model':db[_0x5a110b['model']],'as':_0x5a110b['as'],'attributes':_0x5a110b[_0xa8ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa8ec('0xa')](function(_0x294f5d){logger[_0xa8ec('0xb')](_0xa8ec('0x1e'),_0x2e92e8);logger[_0xa8ec('0xe')](_0xa8ec('0x1e'),_0x2e92e8,JSON[_0xa8ec('0x10')](_0x294f5d));_0x61d4e0(_0x294f5d);})[_0xa8ec('0x14')](function(_0x78b019){logger[_0xa8ec('0x11')](_0xa8ec('0x1e'),_0x78b019[_0xa8ec('0x12')],_0x2e92e8);_0x9a0795(_0x304dc1[_0xa8ec('0x11')](0x1f4,_0x78b019[_0xa8ec('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 9746f65..c13b32a 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 _0x1432=['fs-extra','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','setTags','put','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x47535e,_0x520cda){var _0x360d27=function(_0x3f63ff){while(--_0x3f63ff){_0x47535e['push'](_0x47535e['shift']());}};_0x360d27(++_0x520cda);}(_0x1432,0xa4));var _0x2143=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x1432[_0x3fba9f];return _0x192cf1;};'use strict';var multer=require(_0x2143('0x0'));var util=require('util');var path=require(_0x2143('0x1'));var timeout=require('connect-timeout');var express=require(_0x2143('0x2'));var router=express[_0x2143('0x3')]();var fs_extra=require(_0x2143('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x2143('0x5')](),controller[_0x2143('0x6')]);router[_0x2143('0x7')](_0x2143('0x8'),auth['isAuthenticated'](),controller[_0x2143('0x9')]);router[_0x2143('0x7')](_0x2143('0xa'),auth[_0x2143('0x5')](),controller['getFields']);router['get'](_0x2143('0xb'),auth[_0x2143('0x5')](),controller['getSubjects']);router[_0x2143('0x7')](_0x2143('0xc'),auth['isAuthenticated'](),controller[_0x2143('0xd')]);router[_0x2143('0x7')]('/:id/tags',auth[_0x2143('0x5')](),controller['getTags']);router[_0x2143('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2143('0xe')]('/:id/tags',auth['isAuthenticated'](),controller[_0x2143('0xf')]);router[_0x2143('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2143('0x11')]);router[_0x2143('0x12')](_0x2143('0x8'),auth['isAuthenticated'](),controller[_0x2143('0x13')]);module[_0x2143('0x14')]=router; \ No newline at end of file +var _0x354c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','create','/:id/tags','setTags','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x354c,0x182));var _0xc354=function(_0x3f84f9,_0x3f5cdb){_0x3f84f9=_0x3f84f9-0x0;var _0x359080=_0x354c[_0x3f84f9];return _0x359080;};'use strict';var multer=require('multer');var util=require(_0xc354('0x0'));var path=require(_0xc354('0x1'));var timeout=require(_0xc354('0x2'));var express=require(_0xc354('0x3'));var router=express[_0xc354('0x4')]();var fs_extra=require(_0xc354('0x5'));var auth=require(_0xc354('0x6'));var interaction=require(_0xc354('0x7'));var config=require(_0xc354('0x8'));var controller=require(_0xc354('0x9'));router[_0xc354('0xa')]('/',auth[_0xc354('0xb')](),controller['index']);router[_0xc354('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc354('0xc')]);router[_0xc354('0xa')](_0xc354('0xd'),auth[_0xc354('0xb')](),controller[_0xc354('0xe')]);router['get'](_0xc354('0xf'),auth[_0xc354('0xb')](),controller[_0xc354('0x10')]);router[_0xc354('0xa')](_0xc354('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xc354('0xa')]('/:id/tags',auth[_0xc354('0xb')](),controller[_0xc354('0x12')]);router['post']('/',auth[_0xc354('0xb')](),controller[_0xc354('0x13')]);router['post'](_0xc354('0x14'),auth['isAuthenticated'](),controller[_0xc354('0x15')]);router['put'](_0xc354('0x16'),auth[_0xc354('0xb')](),controller[_0xc354('0x17')]);router['delete']('/:id',auth[_0xc354('0xb')](),controller[_0xc354('0x18')]);module[_0xc354('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 11f1c77..dc7100a 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 _0x8fdc=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fdc,0x15f));var _0xc8fd=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0x8fdc[_0x1406ae];return _0x23a076;};'use strict';var Sequelize=require(_0xc8fd('0x0'));module[_0xc8fd('0x1')]={'name':{'type':Sequelize[_0xc8fd('0x2')]},'description':{'type':Sequelize[_0xc8fd('0x2')]}}; \ No newline at end of file +var _0x320a=['sequelize','exports','STRING'];(function(_0x4a5df4,_0x407591){var _0x341917=function(_0x57e29c){while(--_0x57e29c){_0x4a5df4['push'](_0x4a5df4['shift']());}};_0x341917(++_0x407591);}(_0x320a,0x1ec));var _0xa320=function(_0x384c84,_0x216ee5){_0x384c84=_0x384c84-0x0;var _0x37b0ec=_0x320a[_0x384c84];return _0x37b0ec;};'use strict';var Sequelize=require(_0xa320('0x0'));module[_0xa320('0x1')]={'name':{'type':Sequelize[_0xa320('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ee37793..e8cca85 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 _0x528c=['stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','fields','attributes','length','model','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x1aa771,_0x525dd4){var _0x17b772=function(_0x4d1acd){while(--_0x4d1acd){_0x1aa771['push'](_0x1aa771['shift']());}};_0x17b772(++_0x525dd4);}(_0x528c,0x186));var _0xc528=function(_0x3902de,_0x44deda){_0x3902de=_0x3902de-0x0;var _0x294145=_0x528c[_0x3902de];return _0x294145;};'use strict';var emlformat=require(_0xc528('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc528('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc528('0x2'));var util=require(_0xc528('0x3'));var path=require(_0xc528('0x4'));var sox=require(_0xc528('0x5'));var csv=require(_0xc528('0x6'));var ejs=require(_0xc528('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc528('0x8'));var squel=require(_0xc528('0x9'));var crypto=require(_0xc528('0xa'));var jsforce=require(_0xc528('0xb'));var deskjs=require(_0xc528('0xc'));var toCsv=require(_0xc528('0x6'));var querystring=require(_0xc528('0xd'));var Papa=require(_0xc528('0xe'));var Redis=require(_0xc528('0xf'));var authService=require(_0xc528('0x10'));var qs=require(_0xc528('0x11'));var as=require(_0xc528('0x12'));var hardwareService=require(_0xc528('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc528('0x14'));var config=require(_0xc528('0x15'));var licenseUtil=require(_0xc528('0x16'));var db=require(_0xc528('0x17'))['db'];function respondWithStatusCode(_0x77951e,_0x958701){_0x958701=_0x958701||0xcc;return function(_0x3010a4){if(_0x3010a4){return _0x77951e[_0xc528('0x18')](_0x958701);}return _0x77951e['status'](_0x958701)[_0xc528('0x19')]();};}function respondWithResult(_0x348eaf,_0x49597d){_0x49597d=_0x49597d||0xc8;return function(_0x5c7752){if(_0x5c7752){return _0x348eaf['status'](_0x49597d)[_0xc528('0x1a')](_0x5c7752);}};}function respondWithFilteredResult(_0x5d09ad,_0x5bd2f5){return function(_0x3aa952){if(_0x3aa952){var _0x251cfe=typeof _0x5bd2f5['offset']===_0xc528('0x1b')&&typeof _0x5bd2f5['limit']===_0xc528('0x1b');var _0x53b1aa=_0x3aa952[_0xc528('0x1c')];var _0x2ae1b7=_0x251cfe?0x0:_0x5bd2f5['offset'];var _0x31af33=_0x251cfe?_0x3aa952[_0xc528('0x1c')]:_0x5bd2f5[_0xc528('0x1d')]+_0x5bd2f5[_0xc528('0x1e')];var _0x2d1e32;if(_0x31af33>=_0x53b1aa){_0x31af33=_0x53b1aa;_0x2d1e32=0xc8;}else{_0x2d1e32=0xce;}_0x5d09ad[_0xc528('0x1f')](_0x2d1e32);return _0x5d09ad[_0xc528('0x20')](_0xc528('0x21'),_0x2ae1b7+'-'+_0x31af33+'/'+_0x53b1aa)[_0xc528('0x1a')](_0x3aa952);}return null;};}function patchUpdates(_0x7f42ab){return function(_0x430d1b){try{jsonpatch[_0xc528('0x22')](_0x430d1b,_0x7f42ab,!![]);}catch(_0x2a8c3b){return BPromise[_0xc528('0x23')](_0x2a8c3b);}return _0x430d1b[_0xc528('0x24')]();};}function saveUpdates(_0x2e4023,_0x217318){return function(_0x342511){if(_0x342511){return _0x342511[_0xc528('0x25')](_0x2e4023)[_0xc528('0x26')](function(_0x5811f7){return _0x5811f7;});}return null;};}function removeEntity(_0x42276b,_0x4cf3e7){return function(_0x25d27a){if(_0x25d27a){return _0x25d27a[_0xc528('0x27')]()[_0xc528('0x26')](function(){_0x42276b[_0xc528('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x502c8d,_0x15368c){return function(_0x5b6772){if(!_0x5b6772){_0x502c8d[_0xc528('0x18')](0x194);}return _0x5b6772;};}function handleError(_0x46d238,_0x3968dd){_0x3968dd=_0x3968dd||0x1f4;return function(_0x238b2d){logger['error'](_0x238b2d[_0xc528('0x28')]);if(_0x238b2d[_0xc528('0x29')]){delete _0x238b2d['name'];}_0x46d238[_0xc528('0x1f')](_0x3968dd)[_0xc528('0x2a')](_0x238b2d);};}exports[_0xc528('0x2b')]=function(_0x2d7cef,_0x7ad84c){var _0x5bad32={},_0x2ea978={},_0x189e58={'count':0x0,'rows':[]};var _0x56caf9=_[_0xc528('0x2c')](db[_0xc528('0x2d')][_0xc528('0x2e')],function(_0x337b4b){return{'name':_0x337b4b[_0xc528('0x2f')],'type':_0x337b4b[_0xc528('0x30')]['key']};});_0x2ea978['model']=_['map'](_0x56caf9,_0xc528('0x29'));_0x2ea978[_0xc528('0x31')]=_[_0xc528('0x32')](_0x2d7cef[_0xc528('0x31')]);_0x2ea978[_0xc528('0x33')]=_['intersection'](_0x2ea978['model'],_0x2ea978[_0xc528('0x31')]);_0x5bad32['attributes']=_['intersection'](_0x2ea978['model'],qs[_0xc528('0x34')](_0x2d7cef[_0xc528('0x31')][_0xc528('0x34')]));_0x5bad32[_0xc528('0x35')]=_0x5bad32[_0xc528('0x35')][_0xc528('0x36')]?_0x5bad32['attributes']:_0x2ea978[_0xc528('0x37')];if(!_0x2d7cef['query'][_0xc528('0x38')](_0xc528('0x39'))){_0x5bad32[_0xc528('0x1e')]=qs[_0xc528('0x1e')](_0x2d7cef[_0xc528('0x31')]['limit']);_0x5bad32[_0xc528('0x1d')]=qs[_0xc528('0x1d')](_0x2d7cef[_0xc528('0x31')][_0xc528('0x1d')]);}_0x5bad32['order']=qs['sort'](_0x2d7cef['query'][_0xc528('0x3a')]);_0x5bad32['where']=qs[_0xc528('0x33')](_[_0xc528('0x3b')](_0x2d7cef['query'],_0x2ea978[_0xc528('0x33')]),_0x56caf9);if(_0x2d7cef[_0xc528('0x31')][_0xc528('0x3c')]){_0x5bad32[_0xc528('0x3d')]=_[_0xc528('0x3e')](_0x5bad32[_0xc528('0x3d')],{'$or':_[_0xc528('0x2c')](_0x56caf9,function(_0x1a7da0){if(_0x1a7da0[_0xc528('0x30')]!==_0xc528('0x3f')){var _0x3c4389={};_0x3c4389[_0x1a7da0['name']]={'$like':'%'+_0x2d7cef['query'][_0xc528('0x3c')]+'%'};return _0x3c4389;}})});}_0x5bad32=_['merge']({},_0x5bad32,_0x2d7cef[_0xc528('0x40')]);var _0x53cc5a={'where':_0x5bad32[_0xc528('0x3d')]};return db[_0xc528('0x2d')][_0xc528('0x1c')](_0x53cc5a)['then'](function(_0x21bf89){_0x189e58['count']=_0x21bf89;if(_0x2d7cef[_0xc528('0x31')][_0xc528('0x41')]){_0x5bad32[_0xc528('0x42')]=[{'all':!![]}];}return db[_0xc528('0x2d')][_0xc528('0x43')](_0x5bad32);})['then'](function(_0x2668b4){_0x189e58[_0xc528('0x44')]=_0x2668b4;return _0x189e58;})[_0xc528('0x26')](respondWithFilteredResult(_0x7ad84c,_0x5bad32))[_0xc528('0x45')](handleError(_0x7ad84c,null));};exports[_0xc528('0x46')]=function(_0x4e4226,_0x5de1b3){var _0x2bce42={'raw':![],'where':{'id':_0x4e4226[_0xc528('0x47')]['id']}},_0x12d556={};_0x12d556[_0xc528('0x37')]=_['keys'](db[_0xc528('0x2d')]['rawAttributes']);_0x12d556[_0xc528('0x31')]=_['keys'](_0x4e4226['query']);_0x12d556[_0xc528('0x33')]=_[_0xc528('0x48')](_0x12d556[_0xc528('0x37')],_0x12d556[_0xc528('0x31')]);_0x2bce42[_0xc528('0x35')]=_['intersection'](_0x12d556[_0xc528('0x37')],qs['fields'](_0x4e4226[_0xc528('0x31')]['fields']));_0x2bce42[_0xc528('0x35')]=_0x2bce42[_0xc528('0x35')][_0xc528('0x36')]?_0x2bce42['attributes']:_0x12d556[_0xc528('0x37')];if(_0x4e4226[_0xc528('0x31')]['includeAll']){_0x2bce42[_0xc528('0x42')]=[{'all':!![]}];}_0x2bce42=_[_0xc528('0x3e')]({},_0x2bce42,_0x4e4226['options']);return db[_0xc528('0x2d')][_0xc528('0x49')](_0x2bce42)[_0xc528('0x26')](handleEntityNotFound(_0x5de1b3,null))[_0xc528('0x26')](respondWithResult(_0x5de1b3,null))['catch'](handleError(_0x5de1b3,null));};exports[_0xc528('0x4a')]=function(_0x523577,_0x72716e){return db[_0xc528('0x2d')][_0xc528('0x4a')](_0x523577[_0xc528('0x4b')],{})[_0xc528('0x26')](respondWithResult(_0x72716e,0xc9))['catch'](handleError(_0x72716e,null));};exports['update']=function(_0x599ede,_0x5c487b){if(_0x599ede[_0xc528('0x4b')]['id']){delete _0x599ede['body']['id'];}return db[_0xc528('0x2d')][_0xc528('0x49')]({'where':{'id':_0x599ede[_0xc528('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c487b,null))[_0xc528('0x26')](saveUpdates(_0x599ede[_0xc528('0x4b')],null))[_0xc528('0x26')](respondWithResult(_0x5c487b,null))['catch'](handleError(_0x5c487b,null));};exports['destroy']=function(_0x1b1a79,_0x4ae503){return db[_0xc528('0x2d')]['find']({'where':{'id':_0x1b1a79['params']['id']}})[_0xc528('0x26')](handleEntityNotFound(_0x4ae503,null))['then'](removeEntity(_0x4ae503,null))['catch'](handleError(_0x4ae503,null));};exports[_0xc528('0x4c')]=function(_0x32e860,_0x3ef740,_0x362c99){var _0x2263d6={};var _0x157531={};var _0x23ded0;var _0x217e26;return db['FreshdeskConfiguration'][_0xc528('0x4d')]({'where':{'id':_0x32e860[_0xc528('0x47')]['id']}})[_0xc528('0x26')](handleEntityNotFound(_0x3ef740,null))[_0xc528('0x26')](function(_0x236769){if(_0x236769){_0x23ded0=_0x236769;_0x157531['model']=_[_0xc528('0x32')](db[_0xc528('0x4e')][_0xc528('0x2e')]);_0x157531[_0xc528('0x31')]=_['keys'](_0x32e860[_0xc528('0x31')]);_0x157531[_0xc528('0x33')]=_[_0xc528('0x48')](_0x157531[_0xc528('0x37')],_0x157531[_0xc528('0x31')]);_0x2263d6[_0xc528('0x35')]=_[_0xc528('0x48')](_0x157531[_0xc528('0x37')],qs[_0xc528('0x34')](_0x32e860[_0xc528('0x31')][_0xc528('0x34')]));_0x2263d6['attributes']=_0x2263d6[_0xc528('0x35')][_0xc528('0x36')]?_0x2263d6[_0xc528('0x35')]:_0x157531[_0xc528('0x37')];_0x2263d6[_0xc528('0x4f')]=qs[_0xc528('0x3a')](_0x32e860['query']['sort']);_0x2263d6[_0xc528('0x3d')]=qs[_0xc528('0x33')](_[_0xc528('0x3b')](_0x32e860[_0xc528('0x31')],_0x157531[_0xc528('0x33')]));if(_0x32e860[_0xc528('0x31')][_0xc528('0x3c')]){_0x2263d6[_0xc528('0x3d')]=_[_0xc528('0x3e')](_0x2263d6['where'],{'$or':_[_0xc528('0x2c')](_0x2263d6[_0xc528('0x35')],function(_0x363c6f){var _0x5bcf3b={};_0x5bcf3b[_0x363c6f]={'$like':'%'+_0x32e860['query']['filter']+'%'};return _0x5bcf3b;})});}_0x2263d6=_[_0xc528('0x3e')]({},_0x2263d6,_0x32e860[_0xc528('0x40')]);return _0x23ded0[_0xc528('0x4c')](_0x2263d6);}})['then'](function(_0xe431a2){if(_0xe431a2){_0x217e26=_0xe431a2[_0xc528('0x36')];if(!_0x32e860[_0xc528('0x31')][_0xc528('0x38')](_0xc528('0x39'))){_0x2263d6[_0xc528('0x1e')]=qs[_0xc528('0x1e')](_0x32e860['query'][_0xc528('0x1e')]);_0x2263d6[_0xc528('0x1d')]=qs[_0xc528('0x1d')](_0x32e860['query'][_0xc528('0x1d')]);}return _0x23ded0[_0xc528('0x4c')](_0x2263d6);}})[_0xc528('0x26')](function(_0x217c9e){if(_0x217c9e){return _0x217c9e?{'count':_0x217e26,'rows':_0x217c9e}:null;}})[_0xc528('0x26')](respondWithResult(_0x3ef740,null))[_0xc528('0x45')](handleError(_0x3ef740,null));};exports[_0xc528('0x50')]=function(_0x3ebc04,_0x2501c2,_0x2bf2c1){var _0x2a7bb8={};var _0x53d62f={};var _0x2bcc8b;var _0x312963;return db[_0xc528('0x2d')][_0xc528('0x4d')]({'where':{'id':_0x3ebc04[_0xc528('0x47')]['id']}})[_0xc528('0x26')](handleEntityNotFound(_0x2501c2,null))[_0xc528('0x26')](function(_0x22bd0d){if(_0x22bd0d){_0x2bcc8b=_0x22bd0d;_0x53d62f[_0xc528('0x37')]=_[_0xc528('0x32')](db['FreshdeskField']['rawAttributes']);_0x53d62f['query']=_[_0xc528('0x32')](_0x3ebc04[_0xc528('0x31')]);_0x53d62f['filters']=_[_0xc528('0x48')](_0x53d62f[_0xc528('0x37')],_0x53d62f[_0xc528('0x31')]);_0x2a7bb8[_0xc528('0x35')]=_[_0xc528('0x48')](_0x53d62f[_0xc528('0x37')],qs[_0xc528('0x34')](_0x3ebc04[_0xc528('0x31')]['fields']));_0x2a7bb8[_0xc528('0x35')]=_0x2a7bb8['attributes'][_0xc528('0x36')]?_0x2a7bb8['attributes']:_0x53d62f[_0xc528('0x37')];_0x2a7bb8[_0xc528('0x4f')]=qs[_0xc528('0x3a')](_0x3ebc04[_0xc528('0x31')][_0xc528('0x3a')]);_0x2a7bb8[_0xc528('0x3d')]=qs[_0xc528('0x33')](_[_0xc528('0x3b')](_0x3ebc04['query'],_0x53d62f[_0xc528('0x33')]));if(_0x3ebc04['query'][_0xc528('0x3c')]){_0x2a7bb8[_0xc528('0x3d')]=_['merge'](_0x2a7bb8[_0xc528('0x3d')],{'$or':_[_0xc528('0x2c')](_0x2a7bb8[_0xc528('0x35')],function(_0x1203c7){var _0x114ced={};_0x114ced[_0x1203c7]={'$like':'%'+_0x3ebc04['query']['filter']+'%'};return _0x114ced;})});}_0x2a7bb8=_['merge']({},_0x2a7bb8,_0x3ebc04[_0xc528('0x40')]);return _0x2bcc8b[_0xc528('0x50')](_0x2a7bb8);}})[_0xc528('0x26')](function(_0x1f6b35){if(_0x1f6b35){_0x312963=_0x1f6b35[_0xc528('0x36')];if(!_0x3ebc04[_0xc528('0x31')][_0xc528('0x38')]('nolimit')){_0x2a7bb8['limit']=qs[_0xc528('0x1e')](_0x3ebc04[_0xc528('0x31')][_0xc528('0x1e')]);_0x2a7bb8[_0xc528('0x1d')]=qs[_0xc528('0x1d')](_0x3ebc04[_0xc528('0x31')][_0xc528('0x1d')]);}return _0x2bcc8b[_0xc528('0x50')](_0x2a7bb8);}})[_0xc528('0x26')](function(_0x4c06f8){if(_0x4c06f8){return _0x4c06f8?{'count':_0x312963,'rows':_0x4c06f8}:null;}})[_0xc528('0x26')](respondWithResult(_0x2501c2,null))[_0xc528('0x45')](handleError(_0x2501c2,null));};exports[_0xc528('0x51')]=function(_0x1b4961,_0x2f6dd7,_0x12c164){var _0x5ea079={};var _0x2c0ab0={};var _0x28e7f0;var _0x2ec04c;return db[_0xc528('0x2d')][_0xc528('0x4d')]({'where':{'id':_0x1b4961[_0xc528('0x47')]['id']}})[_0xc528('0x26')](handleEntityNotFound(_0x2f6dd7,null))[_0xc528('0x26')](function(_0x4d491c){if(_0x4d491c){_0x28e7f0=_0x4d491c;_0x2c0ab0[_0xc528('0x37')]=_[_0xc528('0x32')](db['FreshdeskField'][_0xc528('0x2e')]);_0x2c0ab0[_0xc528('0x31')]=_[_0xc528('0x32')](_0x1b4961[_0xc528('0x31')]);_0x2c0ab0['filters']=_[_0xc528('0x48')](_0x2c0ab0['model'],_0x2c0ab0[_0xc528('0x31')]);_0x5ea079[_0xc528('0x35')]=_[_0xc528('0x48')](_0x2c0ab0['model'],qs[_0xc528('0x34')](_0x1b4961[_0xc528('0x31')]['fields']));_0x5ea079[_0xc528('0x35')]=_0x5ea079[_0xc528('0x35')][_0xc528('0x36')]?_0x5ea079['attributes']:_0x2c0ab0[_0xc528('0x37')];_0x5ea079[_0xc528('0x4f')]=qs[_0xc528('0x3a')](_0x1b4961[_0xc528('0x31')]['sort']);_0x5ea079[_0xc528('0x3d')]=qs['filters'](_[_0xc528('0x3b')](_0x1b4961[_0xc528('0x31')],_0x2c0ab0[_0xc528('0x33')]));if(_0x1b4961[_0xc528('0x31')][_0xc528('0x3c')]){_0x5ea079[_0xc528('0x3d')]=_[_0xc528('0x3e')](_0x5ea079[_0xc528('0x3d')],{'$or':_['map'](_0x5ea079[_0xc528('0x35')],function(_0x48dd05){var _0x5496d4={};_0x5496d4[_0x48dd05]={'$like':'%'+_0x1b4961[_0xc528('0x31')][_0xc528('0x3c')]+'%'};return _0x5496d4;})});}_0x5ea079=_[_0xc528('0x3e')]({},_0x5ea079,_0x1b4961[_0xc528('0x40')]);return _0x28e7f0[_0xc528('0x51')](_0x5ea079);}})[_0xc528('0x26')](function(_0x2f604b){if(_0x2f604b){_0x2ec04c=_0x2f604b[_0xc528('0x36')];if(!_0x1b4961[_0xc528('0x31')][_0xc528('0x38')](_0xc528('0x39'))){_0x5ea079['limit']=qs[_0xc528('0x1e')](_0x1b4961[_0xc528('0x31')][_0xc528('0x1e')]);_0x5ea079[_0xc528('0x1d')]=qs[_0xc528('0x1d')](_0x1b4961['query']['offset']);}return _0x28e7f0[_0xc528('0x51')](_0x5ea079);}})[_0xc528('0x26')](function(_0x5569e3){if(_0x5569e3){return _0x5569e3?{'count':_0x2ec04c,'rows':_0x5569e3}:null;}})[_0xc528('0x26')](respondWithResult(_0x2f6dd7,null))[_0xc528('0x45')](handleError(_0x2f6dd7,null));};exports[_0xc528('0x52')]=function(_0x25a8dc,_0x228535,_0x5c8b88){var _0x171c8e={};var _0x3fd8bd={};var _0x3d417f;var _0x350da1;return db['FreshdeskConfiguration'][_0xc528('0x4d')]({'where':{'id':_0x25a8dc['params']['id']}})[_0xc528('0x26')](handleEntityNotFound(_0x228535,null))[_0xc528('0x26')](function(_0x3cd8b5){if(_0x3cd8b5){_0x3d417f=_0x3cd8b5;_0x3fd8bd[_0xc528('0x37')]=_[_0xc528('0x32')](db[_0xc528('0x53')][_0xc528('0x2e')]);_0x3fd8bd['query']=_['keys'](_0x25a8dc[_0xc528('0x31')]);_0x3fd8bd['filters']=_[_0xc528('0x48')](_0x3fd8bd[_0xc528('0x37')],_0x3fd8bd[_0xc528('0x31')]);_0x171c8e['attributes']=_[_0xc528('0x48')](_0x3fd8bd[_0xc528('0x37')],qs[_0xc528('0x34')](_0x25a8dc[_0xc528('0x31')][_0xc528('0x34')]));_0x171c8e['attributes']=_0x171c8e[_0xc528('0x35')][_0xc528('0x36')]?_0x171c8e[_0xc528('0x35')]:_0x3fd8bd[_0xc528('0x37')];_0x171c8e[_0xc528('0x4f')]=qs[_0xc528('0x3a')](_0x25a8dc[_0xc528('0x31')][_0xc528('0x3a')]);_0x171c8e[_0xc528('0x3d')]=qs[_0xc528('0x33')](_[_0xc528('0x3b')](_0x25a8dc[_0xc528('0x31')],_0x3fd8bd[_0xc528('0x33')]));if(_0x25a8dc[_0xc528('0x31')]['filter']){_0x171c8e['where']=_[_0xc528('0x3e')](_0x171c8e['where'],{'$or':_['map'](_0x171c8e['attributes'],function(_0xd63b8a){var _0x387cf7={};_0x387cf7[_0xd63b8a]={'$like':'%'+_0x25a8dc[_0xc528('0x31')][_0xc528('0x3c')]+'%'};return _0x387cf7;})});}_0x171c8e=_[_0xc528('0x3e')]({},_0x171c8e,_0x25a8dc[_0xc528('0x40')]);return _0x3d417f[_0xc528('0x52')](_0x171c8e);}})['then'](function(_0x22a592){if(_0x22a592){_0x350da1=_0x22a592[_0xc528('0x36')];if(!_0x25a8dc[_0xc528('0x31')][_0xc528('0x38')]('nolimit')){_0x171c8e[_0xc528('0x1e')]=qs[_0xc528('0x1e')](_0x25a8dc['query'][_0xc528('0x1e')]);_0x171c8e[_0xc528('0x1d')]=qs[_0xc528('0x1d')](_0x25a8dc[_0xc528('0x31')][_0xc528('0x1d')]);}return _0x3d417f[_0xc528('0x52')](_0x171c8e);}})[_0xc528('0x26')](function(_0x4f1b03){if(_0x4f1b03){return _0x4f1b03?{'count':_0x350da1,'rows':_0x4f1b03}:null;}})[_0xc528('0x26')](respondWithResult(_0x228535,null))[_0xc528('0x45')](handleError(_0x228535,null));};exports['setTags']=function(_0xb3a245,_0x2c01ff,_0x14a3f2){if(_0xb3a245[_0xc528('0x4b')]['id']){delete _0xb3a245[_0xc528('0x4b')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xb3a245[_0xc528('0x47')]['id']}})[_0xc528('0x26')](handleEntityNotFound(_0x2c01ff,null))[_0xc528('0x26')](function(_0x5f31bb){if(_0x5f31bb){return _0x5f31bb[_0xc528('0x54')](_0xb3a245[_0xc528('0x4b')][_0xc528('0x55')]||[]);}return null;})[_0xc528('0x26')](respondWithResult(_0x2c01ff,null))[_0xc528('0x45')](handleError(_0x2c01ff,null));}; \ No newline at end of file +var _0x8347=['Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','count','offset','set','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','create','body','find','params','getFields','FreshdeskField','pick','filter','getSubjects','findOne','hasOwnProperty','getDescriptions','getTags'];(function(_0x2ca9f1,_0xff9bd3){var _0x73f4a7=function(_0x26d4a8){while(--_0x26d4a8){_0x2ca9f1['push'](_0x2ca9f1['shift']());}};_0x73f4a7(++_0xff9bd3);}(_0x8347,0x19d));var _0x7834=function(_0x802b9e,_0xc3a46d){_0x802b9e=_0x802b9e-0x0;var _0x34b40=_0x8347[_0x802b9e];return _0x34b40;};'use strict';var emlformat=require(_0x7834('0x0'));var rimraf=require(_0x7834('0x1'));var zipdir=require(_0x7834('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7834('0x3'));var moment=require(_0x7834('0x4'));var BPromise=require(_0x7834('0x5'));var Mustache=require(_0x7834('0x6'));var util=require(_0x7834('0x7'));var path=require(_0x7834('0x8'));var sox=require('sox');var csv=require(_0x7834('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7834('0xa'));var _=require(_0x7834('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7834('0xc'));var deskjs=require(_0x7834('0xd'));var toCsv=require(_0x7834('0x9'));var querystring=require(_0x7834('0xe'));var Papa=require(_0x7834('0xf'));var Redis=require(_0x7834('0x10'));var authService=require(_0x7834('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7834('0x12'));var hardwareService=require(_0x7834('0x13'));var logger=require('../../config/logger')(_0x7834('0x14'));var utils=require(_0x7834('0x15'));var config=require(_0x7834('0x16'));var licenseUtil=require(_0x7834('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d5ce2,_0x5a7d0d){_0x5a7d0d=_0x5a7d0d||0xcc;return function(_0x2c34dd){if(_0x2c34dd){return _0x4d5ce2[_0x7834('0x18')](_0x5a7d0d);}return _0x4d5ce2[_0x7834('0x19')](_0x5a7d0d)['end']();};}function respondWithResult(_0x42c0ab,_0x5999a1){_0x5999a1=_0x5999a1||0xc8;return function(_0x4ac447){if(_0x4ac447){return _0x42c0ab[_0x7834('0x19')](_0x5999a1)[_0x7834('0x1a')](_0x4ac447);}};}function respondWithFilteredResult(_0x40735,_0x133ffa){return function(_0x36cff7){if(_0x36cff7){var _0x4a62b7=typeof _0x133ffa['offset']==='undefined'&&typeof _0x133ffa[_0x7834('0x1b')]==='undefined';var _0x5e0898=_0x36cff7[_0x7834('0x1c')];var _0x13b31c=_0x4a62b7?0x0:_0x133ffa[_0x7834('0x1d')];var _0x527c3c=_0x4a62b7?_0x36cff7['count']:_0x133ffa['offset']+_0x133ffa['limit'];var _0x31a841;if(_0x527c3c>=_0x5e0898){_0x527c3c=_0x5e0898;_0x31a841=0xc8;}else{_0x31a841=0xce;}_0x40735[_0x7834('0x19')](_0x31a841);return _0x40735[_0x7834('0x1e')]('Content-Range',_0x13b31c+'-'+_0x527c3c+'/'+_0x5e0898)[_0x7834('0x1a')](_0x36cff7);}return null;};}function patchUpdates(_0x596c61){return function(_0x14e6ad){try{jsonpatch[_0x7834('0x1f')](_0x14e6ad,_0x596c61,!![]);}catch(_0xb079ff){return BPromise[_0x7834('0x20')](_0xb079ff);}return _0x14e6ad[_0x7834('0x21')]();};}function saveUpdates(_0x3d7935,_0x4796f7){return function(_0x24bc33){if(_0x24bc33){return _0x24bc33[_0x7834('0x22')](_0x3d7935)[_0x7834('0x23')](function(_0x1f4815){return _0x1f4815;});}return null;};}function removeEntity(_0x3fad28,_0x462bd2){return function(_0x5f0cae){if(_0x5f0cae){return _0x5f0cae[_0x7834('0x24')]()[_0x7834('0x23')](function(){_0x3fad28['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ddf5c,_0x51f1eb){return function(_0x59ae00){if(!_0x59ae00){_0x1ddf5c[_0x7834('0x18')](0x194);}return _0x59ae00;};}function handleError(_0x35a527,_0x12adb5){_0x12adb5=_0x12adb5||0x1f4;return function(_0x1e345f){logger['error'](_0x1e345f[_0x7834('0x25')]);if(_0x1e345f[_0x7834('0x26')]){delete _0x1e345f[_0x7834('0x26')];}_0x35a527[_0x7834('0x19')](_0x12adb5)[_0x7834('0x27')](_0x1e345f);};}exports['index']=function(_0x4cbe93,_0x347209){var _0x5dce97={},_0x31f23e={},_0x13f704={'count':0x0,'rows':[]};var _0x3b48c4=_[_0x7834('0x28')](db[_0x7834('0x29')][_0x7834('0x2a')],function(_0x514dae){return{'name':_0x514dae[_0x7834('0x2b')],'type':_0x514dae['type']['key']};});_0x31f23e['model']=_[_0x7834('0x28')](_0x3b48c4,_0x7834('0x26'));_0x31f23e[_0x7834('0x2c')]=_['keys'](_0x4cbe93[_0x7834('0x2c')]);_0x31f23e[_0x7834('0x2d')]=_['intersection'](_0x31f23e[_0x7834('0x2e')],_0x31f23e[_0x7834('0x2c')]);_0x5dce97[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x31f23e['model'],qs[_0x7834('0x31')](_0x4cbe93[_0x7834('0x2c')][_0x7834('0x31')]));_0x5dce97[_0x7834('0x2f')]=_0x5dce97[_0x7834('0x2f')][_0x7834('0x32')]?_0x5dce97[_0x7834('0x2f')]:_0x31f23e[_0x7834('0x2e')];if(!_0x4cbe93[_0x7834('0x2c')]['hasOwnProperty'](_0x7834('0x33'))){_0x5dce97['limit']=qs['limit'](_0x4cbe93[_0x7834('0x2c')][_0x7834('0x1b')]);_0x5dce97[_0x7834('0x1d')]=qs['offset'](_0x4cbe93['query'][_0x7834('0x1d')]);}_0x5dce97[_0x7834('0x34')]=qs[_0x7834('0x35')](_0x4cbe93[_0x7834('0x2c')][_0x7834('0x35')]);_0x5dce97[_0x7834('0x36')]=qs[_0x7834('0x2d')](_['pick'](_0x4cbe93[_0x7834('0x2c')],_0x31f23e[_0x7834('0x2d')]),_0x3b48c4);if(_0x4cbe93['query']['filter']){_0x5dce97['where']=_[_0x7834('0x37')](_0x5dce97[_0x7834('0x36')],{'$or':_[_0x7834('0x28')](_0x3b48c4,function(_0x285704){if(_0x285704[_0x7834('0x38')]!==_0x7834('0x39')){var _0x5786a3={};_0x5786a3[_0x285704[_0x7834('0x26')]]={'$like':'%'+_0x4cbe93[_0x7834('0x2c')]['filter']+'%'};return _0x5786a3;}})});}_0x5dce97=_['merge']({},_0x5dce97,_0x4cbe93[_0x7834('0x3a')]);var _0x91c2ac={'where':_0x5dce97[_0x7834('0x36')]};return db[_0x7834('0x29')][_0x7834('0x1c')](_0x91c2ac)[_0x7834('0x23')](function(_0x4d4d84){_0x13f704[_0x7834('0x1c')]=_0x4d4d84;if(_0x4cbe93[_0x7834('0x2c')][_0x7834('0x3b')]){_0x5dce97['include']=[{'all':!![]}];}return db[_0x7834('0x29')][_0x7834('0x3c')](_0x5dce97);})[_0x7834('0x23')](function(_0x2dd2ab){_0x13f704[_0x7834('0x3d')]=_0x2dd2ab;return _0x13f704;})[_0x7834('0x23')](respondWithFilteredResult(_0x347209,_0x5dce97))[_0x7834('0x3e')](handleError(_0x347209,null));};exports[_0x7834('0x3f')]=function(_0x4f47c2,_0x4e0e5b){var _0x10a9e4={'raw':![],'where':{'id':_0x4f47c2['params']['id']}},_0x243e48={};_0x243e48[_0x7834('0x2e')]=_[_0x7834('0x40')](db[_0x7834('0x29')][_0x7834('0x2a')]);_0x243e48[_0x7834('0x2c')]=_[_0x7834('0x40')](_0x4f47c2[_0x7834('0x2c')]);_0x243e48['filters']=_['intersection'](_0x243e48[_0x7834('0x2e')],_0x243e48[_0x7834('0x2c')]);_0x10a9e4[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x243e48['model'],qs['fields'](_0x4f47c2['query'][_0x7834('0x31')]));_0x10a9e4[_0x7834('0x2f')]=_0x10a9e4['attributes'][_0x7834('0x32')]?_0x10a9e4[_0x7834('0x2f')]:_0x243e48['model'];if(_0x4f47c2['query'][_0x7834('0x3b')]){_0x10a9e4[_0x7834('0x41')]=[{'all':!![]}];}_0x10a9e4=_[_0x7834('0x37')]({},_0x10a9e4,_0x4f47c2[_0x7834('0x3a')]);return db[_0x7834('0x29')]['find'](_0x10a9e4)['then'](handleEntityNotFound(_0x4e0e5b,null))['then'](respondWithResult(_0x4e0e5b,null))[_0x7834('0x3e')](handleError(_0x4e0e5b,null));};exports[_0x7834('0x42')]=function(_0x107968,_0x505775){return db[_0x7834('0x29')][_0x7834('0x42')](_0x107968[_0x7834('0x43')],{})['then'](respondWithResult(_0x505775,0xc9))[_0x7834('0x3e')](handleError(_0x505775,null));};exports[_0x7834('0x22')]=function(_0xff4998,_0x5d4e86){if(_0xff4998[_0x7834('0x43')]['id']){delete _0xff4998['body']['id'];}return db[_0x7834('0x29')][_0x7834('0x44')]({'where':{'id':_0xff4998['params']['id']}})['then'](handleEntityNotFound(_0x5d4e86,null))[_0x7834('0x23')](saveUpdates(_0xff4998[_0x7834('0x43')],null))[_0x7834('0x23')](respondWithResult(_0x5d4e86,null))['catch'](handleError(_0x5d4e86,null));};exports[_0x7834('0x24')]=function(_0x21e401,_0x1830de){return db[_0x7834('0x29')][_0x7834('0x44')]({'where':{'id':_0x21e401[_0x7834('0x45')]['id']}})['then'](handleEntityNotFound(_0x1830de,null))[_0x7834('0x23')](removeEntity(_0x1830de,null))['catch'](handleError(_0x1830de,null));};exports[_0x7834('0x46')]=function(_0x68a4a3,_0x431aa3,_0xa2250d){var _0x237525={};var _0x527821={};var _0x5575a5;var _0x3b2189;return db[_0x7834('0x29')]['findOne']({'where':{'id':_0x68a4a3[_0x7834('0x45')]['id']}})[_0x7834('0x23')](handleEntityNotFound(_0x431aa3,null))[_0x7834('0x23')](function(_0x5c5056){if(_0x5c5056){_0x5575a5=_0x5c5056;_0x527821[_0x7834('0x2e')]=_['keys'](db[_0x7834('0x47')][_0x7834('0x2a')]);_0x527821[_0x7834('0x2c')]=_[_0x7834('0x40')](_0x68a4a3[_0x7834('0x2c')]);_0x527821['filters']=_[_0x7834('0x30')](_0x527821[_0x7834('0x2e')],_0x527821[_0x7834('0x2c')]);_0x237525[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x527821[_0x7834('0x2e')],qs[_0x7834('0x31')](_0x68a4a3[_0x7834('0x2c')][_0x7834('0x31')]));_0x237525[_0x7834('0x2f')]=_0x237525[_0x7834('0x2f')][_0x7834('0x32')]?_0x237525[_0x7834('0x2f')]:_0x527821[_0x7834('0x2e')];_0x237525['order']=qs[_0x7834('0x35')](_0x68a4a3[_0x7834('0x2c')][_0x7834('0x35')]);_0x237525[_0x7834('0x36')]=qs['filters'](_[_0x7834('0x48')](_0x68a4a3[_0x7834('0x2c')],_0x527821[_0x7834('0x2d')]));if(_0x68a4a3[_0x7834('0x2c')]['filter']){_0x237525[_0x7834('0x36')]=_[_0x7834('0x37')](_0x237525['where'],{'$or':_[_0x7834('0x28')](_0x237525['attributes'],function(_0x116bf1){var _0x2eff24={};_0x2eff24[_0x116bf1]={'$like':'%'+_0x68a4a3['query'][_0x7834('0x49')]+'%'};return _0x2eff24;})});}_0x237525=_[_0x7834('0x37')]({},_0x237525,_0x68a4a3['options']);return _0x5575a5[_0x7834('0x46')](_0x237525);}})[_0x7834('0x23')](function(_0x56e508){if(_0x56e508){_0x3b2189=_0x56e508['length'];if(!_0x68a4a3[_0x7834('0x2c')]['hasOwnProperty'](_0x7834('0x33'))){_0x237525[_0x7834('0x1b')]=qs[_0x7834('0x1b')](_0x68a4a3[_0x7834('0x2c')][_0x7834('0x1b')]);_0x237525['offset']=qs[_0x7834('0x1d')](_0x68a4a3['query'][_0x7834('0x1d')]);}return _0x5575a5[_0x7834('0x46')](_0x237525);}})[_0x7834('0x23')](function(_0x100d8d){if(_0x100d8d){return _0x100d8d?{'count':_0x3b2189,'rows':_0x100d8d}:null;}})[_0x7834('0x23')](respondWithResult(_0x431aa3,null))['catch'](handleError(_0x431aa3,null));};exports[_0x7834('0x4a')]=function(_0xe0a389,_0x58e31c,_0x51917a){var _0x3d4815={};var _0x42c287={};var _0x3b45bc;var _0x209232;return db[_0x7834('0x29')][_0x7834('0x4b')]({'where':{'id':_0xe0a389[_0x7834('0x45')]['id']}})['then'](handleEntityNotFound(_0x58e31c,null))[_0x7834('0x23')](function(_0x539e27){if(_0x539e27){_0x3b45bc=_0x539e27;_0x42c287['model']=_[_0x7834('0x40')](db['FreshdeskField'][_0x7834('0x2a')]);_0x42c287['query']=_[_0x7834('0x40')](_0xe0a389[_0x7834('0x2c')]);_0x42c287[_0x7834('0x2d')]=_[_0x7834('0x30')](_0x42c287[_0x7834('0x2e')],_0x42c287['query']);_0x3d4815[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x42c287['model'],qs['fields'](_0xe0a389[_0x7834('0x2c')][_0x7834('0x31')]));_0x3d4815[_0x7834('0x2f')]=_0x3d4815[_0x7834('0x2f')][_0x7834('0x32')]?_0x3d4815[_0x7834('0x2f')]:_0x42c287['model'];_0x3d4815['order']=qs[_0x7834('0x35')](_0xe0a389[_0x7834('0x2c')]['sort']);_0x3d4815['where']=qs[_0x7834('0x2d')](_['pick'](_0xe0a389[_0x7834('0x2c')],_0x42c287[_0x7834('0x2d')]));if(_0xe0a389['query'][_0x7834('0x49')]){_0x3d4815[_0x7834('0x36')]=_[_0x7834('0x37')](_0x3d4815[_0x7834('0x36')],{'$or':_[_0x7834('0x28')](_0x3d4815[_0x7834('0x2f')],function(_0x35a763){var _0x16858d={};_0x16858d[_0x35a763]={'$like':'%'+_0xe0a389[_0x7834('0x2c')][_0x7834('0x49')]+'%'};return _0x16858d;})});}_0x3d4815=_[_0x7834('0x37')]({},_0x3d4815,_0xe0a389['options']);return _0x3b45bc[_0x7834('0x4a')](_0x3d4815);}})['then'](function(_0x3b9c72){if(_0x3b9c72){_0x209232=_0x3b9c72['length'];if(!_0xe0a389[_0x7834('0x2c')][_0x7834('0x4c')](_0x7834('0x33'))){_0x3d4815[_0x7834('0x1b')]=qs[_0x7834('0x1b')](_0xe0a389['query']['limit']);_0x3d4815[_0x7834('0x1d')]=qs[_0x7834('0x1d')](_0xe0a389[_0x7834('0x2c')][_0x7834('0x1d')]);}return _0x3b45bc[_0x7834('0x4a')](_0x3d4815);}})[_0x7834('0x23')](function(_0x58a594){if(_0x58a594){return _0x58a594?{'count':_0x209232,'rows':_0x58a594}:null;}})['then'](respondWithResult(_0x58e31c,null))[_0x7834('0x3e')](handleError(_0x58e31c,null));};exports[_0x7834('0x4d')]=function(_0x3ef4af,_0x469478,_0x47d5a1){var _0x4d57ae={};var _0x44ed5e={};var _0x5ce40e;var _0x3ac81b;return db[_0x7834('0x29')][_0x7834('0x4b')]({'where':{'id':_0x3ef4af[_0x7834('0x45')]['id']}})[_0x7834('0x23')](handleEntityNotFound(_0x469478,null))[_0x7834('0x23')](function(_0x41ceca){if(_0x41ceca){_0x5ce40e=_0x41ceca;_0x44ed5e[_0x7834('0x2e')]=_[_0x7834('0x40')](db[_0x7834('0x47')]['rawAttributes']);_0x44ed5e[_0x7834('0x2c')]=_[_0x7834('0x40')](_0x3ef4af[_0x7834('0x2c')]);_0x44ed5e[_0x7834('0x2d')]=_[_0x7834('0x30')](_0x44ed5e[_0x7834('0x2e')],_0x44ed5e['query']);_0x4d57ae[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x44ed5e[_0x7834('0x2e')],qs[_0x7834('0x31')](_0x3ef4af[_0x7834('0x2c')]['fields']));_0x4d57ae[_0x7834('0x2f')]=_0x4d57ae['attributes']['length']?_0x4d57ae[_0x7834('0x2f')]:_0x44ed5e[_0x7834('0x2e')];_0x4d57ae[_0x7834('0x34')]=qs['sort'](_0x3ef4af[_0x7834('0x2c')]['sort']);_0x4d57ae['where']=qs['filters'](_[_0x7834('0x48')](_0x3ef4af[_0x7834('0x2c')],_0x44ed5e[_0x7834('0x2d')]));if(_0x3ef4af[_0x7834('0x2c')][_0x7834('0x49')]){_0x4d57ae['where']=_['merge'](_0x4d57ae[_0x7834('0x36')],{'$or':_[_0x7834('0x28')](_0x4d57ae[_0x7834('0x2f')],function(_0x18c051){var _0x4bd547={};_0x4bd547[_0x18c051]={'$like':'%'+_0x3ef4af[_0x7834('0x2c')][_0x7834('0x49')]+'%'};return _0x4bd547;})});}_0x4d57ae=_[_0x7834('0x37')]({},_0x4d57ae,_0x3ef4af[_0x7834('0x3a')]);return _0x5ce40e[_0x7834('0x4d')](_0x4d57ae);}})[_0x7834('0x23')](function(_0x56d1e2){if(_0x56d1e2){_0x3ac81b=_0x56d1e2['length'];if(!_0x3ef4af[_0x7834('0x2c')][_0x7834('0x4c')]('nolimit')){_0x4d57ae['limit']=qs[_0x7834('0x1b')](_0x3ef4af[_0x7834('0x2c')]['limit']);_0x4d57ae[_0x7834('0x1d')]=qs[_0x7834('0x1d')](_0x3ef4af['query'][_0x7834('0x1d')]);}return _0x5ce40e[_0x7834('0x4d')](_0x4d57ae);}})['then'](function(_0x26ec1d){if(_0x26ec1d){return _0x26ec1d?{'count':_0x3ac81b,'rows':_0x26ec1d}:null;}})[_0x7834('0x23')](respondWithResult(_0x469478,null))[_0x7834('0x3e')](handleError(_0x469478,null));};exports[_0x7834('0x4e')]=function(_0xdd3dd9,_0x105512,_0x53a3fe){var _0x1dc8ee={};var _0x30ef78={};var _0x3477c7;var _0x53b50a;return db[_0x7834('0x29')][_0x7834('0x4b')]({'where':{'id':_0xdd3dd9['params']['id']}})[_0x7834('0x23')](handleEntityNotFound(_0x105512,null))[_0x7834('0x23')](function(_0x4da93a){if(_0x4da93a){_0x3477c7=_0x4da93a;_0x30ef78[_0x7834('0x2e')]=_[_0x7834('0x40')](db[_0x7834('0x4f')][_0x7834('0x2a')]);_0x30ef78['query']=_['keys'](_0xdd3dd9[_0x7834('0x2c')]);_0x30ef78[_0x7834('0x2d')]=_[_0x7834('0x30')](_0x30ef78['model'],_0x30ef78[_0x7834('0x2c')]);_0x1dc8ee[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x30ef78[_0x7834('0x2e')],qs[_0x7834('0x31')](_0xdd3dd9[_0x7834('0x2c')]['fields']));_0x1dc8ee['attributes']=_0x1dc8ee[_0x7834('0x2f')][_0x7834('0x32')]?_0x1dc8ee[_0x7834('0x2f')]:_0x30ef78[_0x7834('0x2e')];_0x1dc8ee[_0x7834('0x34')]=qs[_0x7834('0x35')](_0xdd3dd9[_0x7834('0x2c')][_0x7834('0x35')]);_0x1dc8ee[_0x7834('0x36')]=qs[_0x7834('0x2d')](_['pick'](_0xdd3dd9[_0x7834('0x2c')],_0x30ef78['filters']));if(_0xdd3dd9[_0x7834('0x2c')]['filter']){_0x1dc8ee[_0x7834('0x36')]=_[_0x7834('0x37')](_0x1dc8ee[_0x7834('0x36')],{'$or':_[_0x7834('0x28')](_0x1dc8ee['attributes'],function(_0x1d835d){var _0x2097dc={};_0x2097dc[_0x1d835d]={'$like':'%'+_0xdd3dd9['query'][_0x7834('0x49')]+'%'};return _0x2097dc;})});}_0x1dc8ee=_['merge']({},_0x1dc8ee,_0xdd3dd9[_0x7834('0x3a')]);return _0x3477c7[_0x7834('0x4e')](_0x1dc8ee);}})[_0x7834('0x23')](function(_0x47a62e){if(_0x47a62e){_0x53b50a=_0x47a62e[_0x7834('0x32')];if(!_0xdd3dd9[_0x7834('0x2c')][_0x7834('0x4c')](_0x7834('0x33'))){_0x1dc8ee[_0x7834('0x1b')]=qs[_0x7834('0x1b')](_0xdd3dd9[_0x7834('0x2c')][_0x7834('0x1b')]);_0x1dc8ee[_0x7834('0x1d')]=qs[_0x7834('0x1d')](_0xdd3dd9[_0x7834('0x2c')][_0x7834('0x1d')]);}return _0x3477c7[_0x7834('0x4e')](_0x1dc8ee);}})[_0x7834('0x23')](function(_0x549999){if(_0x549999){return _0x549999?{'count':_0x53b50a,'rows':_0x549999}:null;}})[_0x7834('0x23')](respondWithResult(_0x105512,null))[_0x7834('0x3e')](handleError(_0x105512,null));};exports[_0x7834('0x50')]=function(_0xf78bd4,_0x2e53e1,_0x42153c){if(_0xf78bd4[_0x7834('0x43')]['id']){delete _0xf78bd4[_0x7834('0x43')]['id'];}return db[_0x7834('0x29')]['findOne']({'where':{'id':_0xf78bd4[_0x7834('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e53e1,null))['then'](function(_0x260d1){if(_0x260d1){return _0x260d1[_0x7834('0x50')](_0xf78bd4[_0x7834('0x43')][_0x7834('0x51')]||[]);}return null;})[_0x7834('0x23')](respondWithResult(_0x2e53e1,null))[_0x7834('0x3e')](handleError(_0x2e53e1,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index e9472f1..2bcf6b8 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 _0x396b=['bluebird','request-promise','path','rimraf','../../config/environment','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x396b,0xe4));var _0xb396=function(_0x5b0128,_0x411925){_0x5b0128=_0x5b0128-0x0;var _0x507086=_0x396b[_0x5b0128];return _0x507086;};'use strict';var _=require(_0xb396('0x0'));var util=require('util');var logger=require(_0xb396('0x1'))('api');var moment=require(_0xb396('0x2'));var BPromise=require(_0xb396('0x3'));var rp=require(_0xb396('0x4'));var fs=require('fs');var path=require(_0xb396('0x5'));var rimraf=require(_0xb396('0x6'));var config=require(_0xb396('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x48dc29,_0x3d7407){return _0x48dc29[_0xb396('0x8')](_0xb396('0x9'),attributes,{'tableName':_0xb396('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75ec=['exports','define','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x16168a,_0x47974c){var _0x35316d=function(_0x3ad457){while(--_0x3ad457){_0x16168a['push'](_0x16168a['shift']());}};_0x35316d(++_0x47974c);}(_0x75ec,0x1a6));var _0xc75e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x75ec[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0xc75e('0x0'));var logger=require(_0xc75e('0x1'))(_0xc75e('0x2'));var moment=require('moment');var BPromise=require(_0xc75e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc75e('0x4'));var rimraf=require(_0xc75e('0x5'));var config=require(_0xc75e('0x6'));var attributes=require(_0xc75e('0x7'));module[_0xc75e('0x8')]=function(_0x1d1f36,_0x369abf){return _0x1d1f36[_0xc75e('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 42dfdb0..3cc5850 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 _0xb6d1=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x4721ff,_0x1ffdb6){var _0x126282=function(_0x51a474){while(--_0x51a474){_0x4721ff['push'](_0x4721ff['shift']());}};_0x126282(++_0x1ffdb6);}(_0xb6d1,0x125));var _0x1b6d=function(_0x1be790,_0x112549){_0x1be790=_0x1be790-0x0;var _0x7668c8=_0xb6d1[_0x1be790];return _0x7668c8;};'use strict';var _=require(_0x1b6d('0x0'));var util=require(_0x1b6d('0x1'));var moment=require(_0x1b6d('0x2'));var BPromise=require(_0x1b6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b6d('0x4'))['db'];var utils=require(_0x1b6d('0x5'));var logger=require(_0x1b6d('0x6'))(_0x1b6d('0x7'));var config=require(_0x1b6d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1b6d('0x9')][_0x1b6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20ebb7,_0x16a8b4,_0x3e6381){return new BPromise(function(_0x5fdc79,_0x496d0d){return client[_0x1b6d('0xb')](_0x20ebb7,_0x3e6381)[_0x1b6d('0xc')](function(_0x466ded){logger[_0x1b6d('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x16a8b4,_0x1b6d('0xe'));logger['debug'](_0x1b6d('0xf'),_0x16a8b4,_0x1b6d('0xe'),JSON[_0x1b6d('0x10')](_0x466ded));if(_0x466ded[_0x1b6d('0x11')]){if(_0x466ded['error'][_0x1b6d('0x12')]===0x1f4){logger[_0x1b6d('0x11')](_0x1b6d('0x13'),_0x16a8b4,_0x466ded[_0x1b6d('0x11')][_0x1b6d('0x14')]);return _0x496d0d(_0x466ded['error']['message']);}logger['error'](_0x1b6d('0x13'),_0x16a8b4,_0x466ded['error']['message']);return _0x5fdc79(_0x466ded['error']['message']);}else{logger[_0x1b6d('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x16a8b4,_0x1b6d('0xe'));_0x5fdc79(_0x466ded[_0x1b6d('0x15')]['message']);}})['catch'](function(_0x6d050b){logger[_0x1b6d('0x11')](_0x1b6d('0x13'),_0x16a8b4,_0x6d050b);_0x496d0d(_0x6d050b);});});} \ No newline at end of file +var _0x319a=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x319a,0xcd));var _0xa319=function(_0x2bcbf8,_0x5dcc40){_0x2bcbf8=_0x2bcbf8-0x0;var _0x1bfb1f=_0x319a[_0x2bcbf8];return _0x1bfb1f;};'use strict';var _=require(_0xa319('0x0'));var util=require(_0xa319('0x1'));var moment=require(_0xa319('0x2'));var BPromise=require(_0xa319('0x3'));var rs=require(_0xa319('0x4'));var fs=require('fs');var Redis=require(_0xa319('0x5'));var db=require(_0xa319('0x6'))['db'];var utils=require(_0xa319('0x7'));var logger=require('../../config/logger')(_0xa319('0x8'));var config=require(_0xa319('0x9'));var jayson=require(_0xa319('0xa'));var client=jayson[_0xa319('0xb')][_0xa319('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a25bb,_0xb32b75,_0x551a1a){return new BPromise(function(_0x5eeba3,_0x4f7c96){return client['request'](_0x5a25bb,_0x551a1a)[_0xa319('0xd')](function(_0x4989ea){logger[_0xa319('0xe')](_0xa319('0xf'),_0xb32b75,_0xa319('0x10'));logger[_0xa319('0x11')](_0xa319('0x12'),_0xb32b75,_0xa319('0x10'),JSON[_0xa319('0x13')](_0x4989ea));if(_0x4989ea['error']){if(_0x4989ea[_0xa319('0x14')][_0xa319('0x15')]===0x1f4){logger['error'](_0xa319('0xf'),_0xb32b75,_0x4989ea[_0xa319('0x14')][_0xa319('0x16')]);return _0x4f7c96(_0x4989ea['error'][_0xa319('0x16')]);}logger[_0xa319('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xb32b75,_0x4989ea[_0xa319('0x14')][_0xa319('0x16')]);return _0x5eeba3(_0x4989ea[_0xa319('0x14')][_0xa319('0x16')]);}else{logger[_0xa319('0xe')](_0xa319('0xf'),_0xb32b75,_0xa319('0x10'));_0x5eeba3(_0x4989ea[_0xa319('0x17')][_0xa319('0x16')]);}})[_0xa319('0x18')](function(_0x5610a1){logger[_0xa319('0x14')](_0xa319('0xf'),_0xb32b75,_0x5610a1);_0x4f7c96(_0x5610a1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 6ed99bb..7177700 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 _0x0103=['create','update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0xe906a5,_0x3bfd31){var _0x4fb701=function(_0x18c9f1){while(--_0x18c9f1){_0xe906a5['push'](_0xe906a5['shift']());}};_0x4fb701(++_0x3bfd31);}(_0x0103,0x194));var _0x3010=function(_0x311666,_0x17b07d){_0x311666=_0x311666-0x0;var _0x2bc692=_0x0103[_0x311666];return _0x2bc692;};'use strict';var multer=require(_0x3010('0x0'));var util=require(_0x3010('0x1'));var path=require(_0x3010('0x2'));var timeout=require(_0x3010('0x3'));var express=require(_0x3010('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3010('0x5'));var config=require('../../config/environment');var controller=require(_0x3010('0x6'));router[_0x3010('0x7')]('/',auth[_0x3010('0x8')](),controller[_0x3010('0x9')]);router['get'](_0x3010('0xa'),auth[_0x3010('0x8')](),controller[_0x3010('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3010('0xc')]);router['put'](_0x3010('0xa'),auth['isAuthenticated'](),controller[_0x3010('0xd')]);router[_0x3010('0xe')](_0x3010('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x3010('0xf')]=router; \ No newline at end of file +var _0xd291=['update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','index','/:id','show','isAuthenticated','create','put'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd291,0x1b3));var _0x1d29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd291[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1d29('0x0'));var util=require(_0x1d29('0x1'));var path=require('path');var timeout=require(_0x1d29('0x2'));var express=require('express');var router=express[_0x1d29('0x3')]();var fs_extra=require(_0x1d29('0x4'));var auth=require(_0x1d29('0x5'));var interaction=require(_0x1d29('0x6'));var config=require('../../config/environment');var controller=require(_0x1d29('0x7'));router[_0x1d29('0x8')]('/',auth['isAuthenticated'](),controller[_0x1d29('0x9')]);router[_0x1d29('0x8')](_0x1d29('0xa'),auth['isAuthenticated'](),controller[_0x1d29('0xb')]);router['post']('/',auth[_0x1d29('0xc')](),controller[_0x1d29('0xd')]);router[_0x1d29('0xe')](_0x1d29('0xa'),auth[_0x1d29('0xc')](),controller[_0x1d29('0xf')]);router[_0x1d29('0x10')](_0x1d29('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1d29('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 967d20f..81ff934 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 _0x6f0e=['keyValue','picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x6f0e,0x1e3));var _0xe6f0=function(_0x5d895c,_0x5cdab2){_0x5d895c=_0x5d895c-0x0;var _0x4ebf9a=_0x6f0e[_0x5d895c];return _0x4ebf9a;};'use strict';var Sequelize=require('sequelize');module[_0xe6f0('0x0')]={'type':{'type':Sequelize[_0xe6f0('0x1')](_0xe6f0('0x2'),_0xe6f0('0x3'),_0xe6f0('0x4'),_0xe6f0('0x5'),_0xe6f0('0x6')),'defaultValue':_0xe6f0('0x2')},'content':{'type':Sequelize[_0xe6f0('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe6f0('0x1')](_0xe6f0('0x2'),_0xe6f0('0x3'),_0xe6f0('0x4'))},'keyContent':{'type':Sequelize[_0xe6f0('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe6f0('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe6f0('0x7')]}}; \ No newline at end of file +var _0x225e=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','exports'];(function(_0xfd1170,_0x335b0c){var _0x283a66=function(_0x4b2bc6){while(--_0x4b2bc6){_0xfd1170['push'](_0xfd1170['shift']());}};_0x283a66(++_0x335b0c);}(_0x225e,0x1af));var _0xe225=function(_0x4e5906,_0x268b6f){_0x4e5906=_0x4e5906-0x0;var _0x5ebc07=_0x225e[_0x4e5906];return _0x5ebc07;};'use strict';var Sequelize=require('sequelize');module[_0xe225('0x0')]={'type':{'type':Sequelize[_0xe225('0x1')](_0xe225('0x2'),_0xe225('0x3'),_0xe225('0x4'),_0xe225('0x5'),_0xe225('0x6')),'defaultValue':_0xe225('0x2')},'content':{'type':Sequelize[_0xe225('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe225('0x1')](_0xe225('0x2'),_0xe225('0x3'),_0xe225('0x4'))},'keyContent':{'type':Sequelize[_0xe225('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe225('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 84c2eef..7eeb02a 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 _0xdb94=['intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','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','FreshdeskField','rawAttributes','type','model','query','keys'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xdb94,0xab));var _0x4db9=function(_0x2601dc,_0x3aa303){_0x2601dc=_0x2601dc-0x0;var _0xe4804e=_0xdb94[_0x2601dc];return _0xe4804e;};'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));}; \ No newline at end of file +var _0x70e0=['nolimit','order','sort','where','filters','filter','merge','options','include','rows','catch','show','rawAttributes','length','find','create','body','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','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','index','map','FreshdeskField','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty'];(function(_0x274f6f,_0x541c09){var _0x66fe2=function(_0x4aa452){while(--_0x4aa452){_0x274f6f['push'](_0x274f6f['shift']());}};_0x66fe2(++_0x541c09);}(_0x70e0,0x17b));var _0x070e=function(_0x2423c9,_0x1e095d){_0x2423c9=_0x2423c9-0x0;var _0x4db8c5=_0x70e0[_0x2423c9];return _0x4db8c5;};'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={},_0x26373b={},_0x5e8326={'count':0x0,'rows':[]};var _0x282344=_[_0x070e('0x29')](db[_0x070e('0x2a')]['rawAttributes'],function(_0x5c5f0d){return{'name':_0x5c5f0d[_0x070e('0x2b')],'type':_0x5c5f0d[_0x070e('0x2c')][_0x070e('0x2d')]};});_0x26373b['model']=_[_0x070e('0x29')](_0x282344,_0x070e('0x26'));_0x26373b[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x43dd96['query']);_0x26373b['filters']=_['intersection'](_0x26373b['model'],_0x26373b[_0x070e('0x2e')]);_0x1a1892['attributes']=_[_0x070e('0x30')](_0x26373b[_0x070e('0x31')],qs['fields'](_0x43dd96['query'][_0x070e('0x32')]));_0x1a1892[_0x070e('0x33')]=_0x1a1892['attributes']['length']?_0x1a1892[_0x070e('0x33')]:_0x26373b[_0x070e('0x31')];if(!_0x43dd96[_0x070e('0x2e')][_0x070e('0x34')](_0x070e('0x35'))){_0x1a1892['limit']=qs['limit'](_0x43dd96[_0x070e('0x2e')][_0x070e('0x1e')]);_0x1a1892[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x43dd96[_0x070e('0x2e')]['offset']);}_0x1a1892[_0x070e('0x36')]=qs[_0x070e('0x37')](_0x43dd96['query'][_0x070e('0x37')]);_0x1a1892[_0x070e('0x38')]=qs['filters'](_['pick'](_0x43dd96['query'],_0x26373b[_0x070e('0x39')]),_0x282344);if(_0x43dd96[_0x070e('0x2e')][_0x070e('0x3a')]){_0x1a1892[_0x070e('0x38')]=_[_0x070e('0x3b')](_0x1a1892['where'],{'$or':_[_0x070e('0x29')](_0x282344,function(_0xa1bb20){if(_0xa1bb20[_0x070e('0x2c')]!=='VIRTUAL'){var _0x268c5d={};_0x268c5d[_0xa1bb20[_0x070e('0x26')]]={'$like':'%'+_0x43dd96[_0x070e('0x2e')]['filter']+'%'};return _0x268c5d;}})});}_0x1a1892=_[_0x070e('0x3b')]({},_0x1a1892,_0x43dd96[_0x070e('0x3c')]);var _0x4800a9={'where':_0x1a1892[_0x070e('0x38')]};return db['FreshdeskField'][_0x070e('0x1d')](_0x4800a9)[_0x070e('0x23')](function(_0x3462d3){_0x5e8326[_0x070e('0x1d')]=_0x3462d3;if(_0x43dd96[_0x070e('0x2e')]['includeAll']){_0x1a1892[_0x070e('0x3d')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x1a1892);})[_0x070e('0x23')](function(_0x42c448){_0x5e8326[_0x070e('0x3e')]=_0x42c448;return _0x5e8326;})['then'](respondWithFilteredResult(_0x28d7f2,_0x1a1892))[_0x070e('0x3f')](handleError(_0x28d7f2,null));};exports[_0x070e('0x40')]=function(_0x556bf3,_0x7dc240){var _0x4a4ee3={'raw':!![],'where':{'id':_0x556bf3['params']['id']}},_0x13e4e0={};_0x13e4e0['model']=_['keys'](db[_0x070e('0x2a')][_0x070e('0x41')]);_0x13e4e0[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x556bf3[_0x070e('0x2e')]);_0x13e4e0['filters']=_[_0x070e('0x30')](_0x13e4e0['model'],_0x13e4e0[_0x070e('0x2e')]);_0x4a4ee3[_0x070e('0x33')]=_[_0x070e('0x30')](_0x13e4e0['model'],qs['fields'](_0x556bf3[_0x070e('0x2e')]['fields']));_0x4a4ee3[_0x070e('0x33')]=_0x4a4ee3[_0x070e('0x33')][_0x070e('0x42')]?_0x4a4ee3['attributes']:_0x13e4e0[_0x070e('0x31')];if(_0x556bf3[_0x070e('0x2e')]['includeAll']){_0x4a4ee3['include']=[{'all':!![]}];}_0x4a4ee3=_[_0x070e('0x3b')]({},_0x4a4ee3,_0x556bf3[_0x070e('0x3c')]);return db[_0x070e('0x2a')][_0x070e('0x43')](_0x4a4ee3)[_0x070e('0x23')](handleEntityNotFound(_0x7dc240,null))['then'](respondWithResult(_0x7dc240,null))[_0x070e('0x3f')](handleError(_0x7dc240,null));};exports[_0x070e('0x44')]=function(_0x427fa7,_0x391dee){return db[_0x070e('0x2a')][_0x070e('0x44')](_0x427fa7[_0x070e('0x45')],{})[_0x070e('0x23')](respondWithResult(_0x391dee,0xc9))[_0x070e('0x3f')](handleError(_0x391dee,null));};exports[_0x070e('0x22')]=function(_0x210c4d,_0x3be553){if(_0x210c4d[_0x070e('0x45')]['id']){delete _0x210c4d[_0x070e('0x45')]['id'];}return db[_0x070e('0x2a')]['find']({'where':{'id':_0x210c4d[_0x070e('0x46')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x3be553,null))[_0x070e('0x23')](saveUpdates(_0x210c4d[_0x070e('0x45')],null))[_0x070e('0x23')](respondWithResult(_0x3be553,null))[_0x070e('0x3f')](handleError(_0x3be553,null));};exports[_0x070e('0x47')]=function(_0x35dbaf,_0x1c64d2){return db['FreshdeskField'][_0x070e('0x43')]({'where':{'id':_0x35dbaf['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x1c64d2,null))[_0x070e('0x23')](removeEntity(_0x1c64d2,null))['catch'](handleError(_0x1c64d2,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 3ce878f..7e63a20 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 _0x6f5a=['define','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x4d845f,_0xef45b3){var _0x1b7443=function(_0x3571e0){while(--_0x3571e0){_0x4d845f['push'](_0x4d845f['shift']());}};_0x1b7443(++_0xef45b3);}(_0x6f5a,0x1cb));var _0xa6f5=function(_0x4ae763,_0x5e3c1f){_0x4ae763=_0x4ae763-0x0;var _0x58ffaf=_0x6f5a[_0x4ae763];return _0x58ffaf;};'use strict';var _=require(_0xa6f5('0x0'));var util=require(_0xa6f5('0x1'));var logger=require(_0xa6f5('0x2'))('api');var moment=require(_0xa6f5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6f5('0x4'));var rimraf=require(_0xa6f5('0x5'));var config=require(_0xa6f5('0x6'));var attributes=require(_0xa6f5('0x7'));module[_0xa6f5('0x8')]=function(_0x4cf735,_0x21be4d){return _0x4cf735[_0xa6f5('0x9')]('FreshdeskField',attributes,{'tableName':_0xa6f5('0xa'),'paranoid':![],'indexes':[{'name':_0xa6f5('0xb'),'fields':[_0xa6f5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4860=['define','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4860,0x197));var _0x0486=function(_0x5a801f,_0x9919f9){_0x5a801f=_0x5a801f-0x0;var _0x35720c=_0x4860[_0x5a801f];return _0x35720c;};'use strict';var _=require(_0x0486('0x0'));var util=require(_0x0486('0x1'));var logger=require(_0x0486('0x2'))('api');var moment=require(_0x0486('0x3'));var BPromise=require('bluebird');var rp=require(_0x0486('0x4'));var fs=require('fs');var path=require(_0x0486('0x5'));var rimraf=require('rimraf');var config=require(_0x0486('0x6'));var attributes=require(_0x0486('0x7'));module[_0x0486('0x8')]=function(_0x47946b,_0x355f17){return _0x47946b[_0x0486('0x9')]('FreshdeskField',attributes,{'tableName':_0x0486('0xa'),'paranoid':![],'indexes':[{'name':_0x0486('0xb'),'fields':[_0x0486('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index c0229ed..25888ae 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 _0x84a1=['info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x84a1,0x172));var _0x184a=function(_0x2db568,_0x37db76){_0x2db568=_0x2db568-0x0;var _0x3bb690=_0x84a1[_0x2db568];return _0x3bb690;};'use strict';var _=require('lodash');var util=require(_0x184a('0x0'));var moment=require('moment');var BPromise=require(_0x184a('0x1'));var rs=require(_0x184a('0x2'));var fs=require('fs');var Redis=require(_0x184a('0x3'));var db=require(_0x184a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x184a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x184a('0x6')][_0x184a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ae569,_0x3b770a,_0x4ff3fc){return new BPromise(function(_0x44b664,_0x52bcc2){return client[_0x184a('0x8')](_0x2ae569,_0x4ff3fc)[_0x184a('0x9')](function(_0x7b7f72){logger[_0x184a('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x3b770a,_0x184a('0xb'));logger[_0x184a('0xc')](_0x184a('0xd'),_0x3b770a,_0x184a('0xb'),JSON[_0x184a('0xe')](_0x7b7f72));if(_0x7b7f72[_0x184a('0xf')]){if(_0x7b7f72[_0x184a('0xf')][_0x184a('0x10')]===0x1f4){logger[_0x184a('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x3b770a,_0x7b7f72[_0x184a('0xf')]['message']);return _0x52bcc2(_0x7b7f72[_0x184a('0xf')]['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x3b770a,_0x7b7f72[_0x184a('0xf')]['message']);return _0x44b664(_0x7b7f72[_0x184a('0xf')]['message']);}else{logger['info'](_0x184a('0x11'),_0x3b770a,'request\x20sent');_0x44b664(_0x7b7f72['result'][_0x184a('0x12')]);}})[_0x184a('0x13')](function(_0x396e0f){logger[_0x184a('0xf')](_0x184a('0x11'),_0x3b770a,_0x396e0f);_0x52bcc2(_0x396e0f);});});} \ No newline at end of file +var _0xa8a7=['request','then','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshdeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x63c794,_0x14f52c){var _0x16f319=function(_0x149940){while(--_0x149940){_0x63c794['push'](_0x63c794['shift']());}};_0x16f319(++_0x14f52c);}(_0xa8a7,0x83));var _0x7a8a=function(_0x4c6d42,_0x2fa3a9){_0x4c6d42=_0x4c6d42-0x0;var _0x20e70c=_0xa8a7[_0x4c6d42];return _0x20e70c;};'use strict';var _=require(_0x7a8a('0x0'));var util=require('util');var moment=require(_0x7a8a('0x1'));var BPromise=require(_0x7a8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a8a('0x3'))['db'];var utils=require(_0x7a8a('0x4'));var logger=require('../../config/logger')(_0x7a8a('0x5'));var config=require(_0x7a8a('0x6'));var jayson=require(_0x7a8a('0x7'));var client=jayson[_0x7a8a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aa6e9,_0x3314bd,_0x8a1282){return new BPromise(function(_0x5842ad,_0x3fa08a){return client[_0x7a8a('0x9')](_0x3aa6e9,_0x8a1282)[_0x7a8a('0xa')](function(_0x558daf){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x3314bd,'request\x20sent');logger[_0x7a8a('0xb')](_0x7a8a('0xc'),_0x3314bd,_0x7a8a('0xd'),JSON['stringify'](_0x558daf));if(_0x558daf[_0x7a8a('0xe')]){if(_0x558daf[_0x7a8a('0xe')][_0x7a8a('0xf')]===0x1f4){logger['error'](_0x7a8a('0x10'),_0x3314bd,_0x558daf[_0x7a8a('0xe')][_0x7a8a('0x11')]);return _0x3fa08a(_0x558daf[_0x7a8a('0xe')][_0x7a8a('0x11')]);}logger[_0x7a8a('0xe')](_0x7a8a('0x10'),_0x3314bd,_0x558daf[_0x7a8a('0xe')][_0x7a8a('0x11')]);return _0x5842ad(_0x558daf['error'][_0x7a8a('0x11')]);}else{logger['info'](_0x7a8a('0x10'),_0x3314bd,_0x7a8a('0xd'));_0x5842ad(_0x558daf[_0x7a8a('0x12')][_0x7a8a('0x11')]);}})[_0x7a8a('0x13')](function(_0x21001d){logger['error'](_0x7a8a('0x10'),_0x3314bd,_0x21001d);_0x3fa08a(_0x21001d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d371fae..041fa18 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 _0xda3f=['/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x223b0c,_0x371c5a){var _0x4ce5ed=function(_0x528c8b){while(--_0x528c8b){_0x223b0c['push'](_0x223b0c['shift']());}};_0x4ce5ed(++_0x371c5a);}(_0xda3f,0xec));var _0xfda3=function(_0x4d5e39,_0x22f1ce){_0x4d5e39=_0x4d5e39-0x0;var _0x43cd12=_0xda3f[_0x4d5e39];return _0x43cd12;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./intFreshsalesAccount.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')]('/',auth['isAuthenticated'](),controller[_0xfda3('0xe')]);router[_0xfda3('0xd')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['put'](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfda3('0x12')]=router; \ No newline at end of file +var _0x9c00=['create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x5112ff,_0x58dedf){var _0x92adb7=function(_0x4c334e){while(--_0x4c334e){_0x5112ff['push'](_0x5112ff['shift']());}};_0x92adb7(++_0x58dedf);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5ebb4d,_0x3180ec){_0x5ebb4d=_0x5ebb4d-0x0;var _0x7e1980=_0x9c00[_0x5ebb4d];return _0x7e1980;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id/configurations',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xf')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0xf')](_0x09c0('0x11'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x12')]);router[_0x09c0('0x13')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x14')]);router[_0x09c0('0x15')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x16')]);module[_0x09c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index d92b982..fa81e26 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 _0xd943=['exports','STRING','username','remoteUri','sequelize'];(function(_0x301764,_0x5ce9e1){var _0xac6f49=function(_0x25f734){while(--_0x25f734){_0x301764['push'](_0x301764['shift']());}};_0xac6f49(++_0x5ce9e1);}(_0xd943,0x15d));var _0x3d94=function(_0x377698,_0x865115){_0x377698=_0x377698-0x0;var _0x5826e3=_0xd943[_0x377698];return _0x5826e3;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'name':{'type':Sequelize[_0x3d94('0x2')]},'description':{'type':Sequelize[_0x3d94('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3d94('0x3')},'apiKey':{'type':Sequelize[_0x3d94('0x2')]},'remoteUri':{'type':Sequelize[_0x3d94('0x2')],'unique':_0x3d94('0x4')},'serverUrl':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6a95=['exports','STRING','username','sequelize'];(function(_0x14e00a,_0x50dcc0){var _0x3f57fb=function(_0x23a236){while(--_0x23a236){_0x14e00a['push'](_0x14e00a['shift']());}};_0x3f57fb(++_0x50dcc0);}(_0x6a95,0x1db));var _0x56a9=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x6a95[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index d14846f..5c174ee 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 _0xa0e8=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','FreshsalesAccount','includeAll','rows','show','params','rawAttributes','include','options','find','catch','create','body','destroy','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','Subjects','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','name','index','fieldName','map','keys','query'];(function(_0x109ac4,_0x3c22ac){var _0x269085=function(_0x5872ad){while(--_0x5872ad){_0x109ac4['push'](_0x109ac4['shift']());}};_0x269085(++_0x3c22ac);}(_0xa0e8,0xa6));var _0x8a0e=function(_0xdf46e7,_0x5a0a46){_0xdf46e7=_0xdf46e7-0x0;var _0x7d094a=_0xa0e8[_0xdf46e7];return _0x7d094a;};'use strict';var emlformat=require(_0x8a0e('0x0'));var rimraf=require(_0x8a0e('0x1'));var zipdir=require(_0x8a0e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a0e('0x3'));var moment=require(_0x8a0e('0x4'));var BPromise=require(_0x8a0e('0x5'));var Mustache=require(_0x8a0e('0x6'));var util=require(_0x8a0e('0x7'));var path=require(_0x8a0e('0x8'));var sox=require(_0x8a0e('0x9'));var csv=require(_0x8a0e('0xa'));var ejs=require(_0x8a0e('0xb'));var fs=require('fs');var fs_extra=require(_0x8a0e('0xc'));var _=require('lodash');var squel=require(_0x8a0e('0xd'));var crypto=require(_0x8a0e('0xe'));var jsforce=require(_0x8a0e('0xf'));var deskjs=require(_0x8a0e('0x10'));var toCsv=require(_0x8a0e('0xa'));var querystring=require(_0x8a0e('0x11'));var Papa=require(_0x8a0e('0x12'));var Redis=require(_0x8a0e('0x13'));var authService=require(_0x8a0e('0x14'));var qs=require(_0x8a0e('0x15'));var as=require(_0x8a0e('0x16'));var hardwareService=require(_0x8a0e('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x8a0e('0x18'));var config=require(_0x8a0e('0x19'));var licenseUtil=require(_0x8a0e('0x1a'));var db=require(_0x8a0e('0x1b'))['db'];var integrations=require(_0x8a0e('0x1c'));function respondWithStatusCode(_0x534ae9,_0x19aee4){_0x19aee4=_0x19aee4||0xcc;return function(_0x2f0eec){if(_0x2f0eec){return _0x534ae9[_0x8a0e('0x1d')](_0x19aee4);}return _0x534ae9[_0x8a0e('0x1e')](_0x19aee4)[_0x8a0e('0x1f')]();};}function respondWithResult(_0x1156bb,_0xd60e02){_0xd60e02=_0xd60e02||0xc8;return function(_0x2e7622){if(_0x2e7622){return _0x1156bb[_0x8a0e('0x1e')](_0xd60e02)['json'](_0x2e7622);}};}function respondWithFilteredResult(_0x10b009,_0x16e665){return function(_0x16909a){if(_0x16909a){var _0x5a5dbd=typeof _0x16e665[_0x8a0e('0x20')]==='undefined'&&typeof _0x16e665[_0x8a0e('0x21')]===_0x8a0e('0x22');var _0x23e90f=_0x16909a[_0x8a0e('0x23')];var _0x3fc8bb=_0x5a5dbd?0x0:_0x16e665['offset'];var _0x5c1c68=_0x5a5dbd?_0x16909a[_0x8a0e('0x23')]:_0x16e665['offset']+_0x16e665['limit'];var _0x362243;if(_0x5c1c68>=_0x23e90f){_0x5c1c68=_0x23e90f;_0x362243=0xc8;}else{_0x362243=0xce;}_0x10b009[_0x8a0e('0x1e')](_0x362243);return _0x10b009[_0x8a0e('0x24')](_0x8a0e('0x25'),_0x3fc8bb+'-'+_0x5c1c68+'/'+_0x23e90f)[_0x8a0e('0x26')](_0x16909a);}return null;};}function patchUpdates(_0x5db074){return function(_0x310ed8){try{jsonpatch[_0x8a0e('0x27')](_0x310ed8,_0x5db074,!![]);}catch(_0x4a03a8){return BPromise[_0x8a0e('0x28')](_0x4a03a8);}return _0x310ed8[_0x8a0e('0x29')]();};}function saveUpdates(_0x4c1491,_0x4cf78c){return function(_0x5f1ed9){if(_0x5f1ed9){return _0x5f1ed9[_0x8a0e('0x2a')](_0x4c1491)[_0x8a0e('0x2b')](function(_0x496733){return _0x496733;});}return null;};}function removeEntity(_0x9fb078,_0x326a3e){return function(_0x1f8078){if(_0x1f8078){return _0x1f8078['destroy']()['then'](function(){_0x9fb078[_0x8a0e('0x1e')](0xcc)[_0x8a0e('0x1f')]();});}};}function handleEntityNotFound(_0x166a9c,_0x2602bd){return function(_0xd64f27){if(!_0xd64f27){_0x166a9c[_0x8a0e('0x1d')](0x194);}return _0xd64f27;};}function handleError(_0x56e502,_0x20409d){_0x20409d=_0x20409d||0x1f4;return function(_0x2bffb0){logger['error'](_0x2bffb0['stack']);if(_0x2bffb0[_0x8a0e('0x2c')]){delete _0x2bffb0[_0x8a0e('0x2c')];}_0x56e502[_0x8a0e('0x1e')](_0x20409d)['send'](_0x2bffb0);};}exports[_0x8a0e('0x2d')]=function(_0x50124e,_0x30152e){var _0x4c21ad={},_0x2edc5f={},_0x4048be={'count':0x0,'rows':[]};var _0x6f07c0=_['map'](db['FreshsalesAccount']['rawAttributes'],function(_0xe76aab){return{'name':_0xe76aab[_0x8a0e('0x2e')],'type':_0xe76aab['type']['key']};});_0x2edc5f['model']=_[_0x8a0e('0x2f')](_0x6f07c0,_0x8a0e('0x2c'));_0x2edc5f['query']=_[_0x8a0e('0x30')](_0x50124e[_0x8a0e('0x31')]);_0x2edc5f[_0x8a0e('0x32')]=_[_0x8a0e('0x33')](_0x2edc5f[_0x8a0e('0x34')],_0x2edc5f['query']);_0x4c21ad[_0x8a0e('0x35')]=_['intersection'](_0x2edc5f[_0x8a0e('0x34')],qs[_0x8a0e('0x36')](_0x50124e[_0x8a0e('0x31')][_0x8a0e('0x36')]));_0x4c21ad[_0x8a0e('0x35')]=_0x4c21ad[_0x8a0e('0x35')][_0x8a0e('0x37')]?_0x4c21ad[_0x8a0e('0x35')]:_0x2edc5f[_0x8a0e('0x34')];if(!_0x50124e[_0x8a0e('0x31')][_0x8a0e('0x38')](_0x8a0e('0x39'))){_0x4c21ad[_0x8a0e('0x21')]=qs[_0x8a0e('0x21')](_0x50124e[_0x8a0e('0x31')][_0x8a0e('0x21')]);_0x4c21ad[_0x8a0e('0x20')]=qs[_0x8a0e('0x20')](_0x50124e[_0x8a0e('0x31')][_0x8a0e('0x20')]);}_0x4c21ad[_0x8a0e('0x3a')]=qs[_0x8a0e('0x3b')](_0x50124e[_0x8a0e('0x31')][_0x8a0e('0x3b')]);_0x4c21ad[_0x8a0e('0x3c')]=qs[_0x8a0e('0x32')](_[_0x8a0e('0x3d')](_0x50124e[_0x8a0e('0x31')],_0x2edc5f['filters']),_0x6f07c0);if(_0x50124e[_0x8a0e('0x31')][_0x8a0e('0x3e')]){_0x4c21ad[_0x8a0e('0x3c')]=_[_0x8a0e('0x3f')](_0x4c21ad[_0x8a0e('0x3c')],{'$or':_[_0x8a0e('0x2f')](_0x6f07c0,function(_0x42d11b){if(_0x42d11b[_0x8a0e('0x40')]!==_0x8a0e('0x41')){var _0x35a7c1={};_0x35a7c1[_0x42d11b[_0x8a0e('0x2c')]]={'$like':'%'+_0x50124e[_0x8a0e('0x31')][_0x8a0e('0x3e')]+'%'};return _0x35a7c1;}})});}_0x4c21ad=_[_0x8a0e('0x3f')]({},_0x4c21ad,_0x50124e['options']);var _0x30be61={'where':_0x4c21ad[_0x8a0e('0x3c')]};return db[_0x8a0e('0x42')][_0x8a0e('0x23')](_0x30be61)[_0x8a0e('0x2b')](function(_0x91e863){_0x4048be[_0x8a0e('0x23')]=_0x91e863;if(_0x50124e[_0x8a0e('0x31')][_0x8a0e('0x43')]){_0x4c21ad['include']=[{'all':!![]}];}return db[_0x8a0e('0x42')]['findAll'](_0x4c21ad);})[_0x8a0e('0x2b')](function(_0x4a0e83){_0x4048be[_0x8a0e('0x44')]=_0x4a0e83;return _0x4048be;})[_0x8a0e('0x2b')](respondWithFilteredResult(_0x30152e,_0x4c21ad))['catch'](handleError(_0x30152e,null));};exports[_0x8a0e('0x45')]=function(_0x59cb23,_0x1b0aa1){var _0x10915a={'raw':![],'where':{'id':_0x59cb23[_0x8a0e('0x46')]['id']}},_0x50a985={};_0x50a985[_0x8a0e('0x34')]=_[_0x8a0e('0x30')](db[_0x8a0e('0x42')][_0x8a0e('0x47')]);_0x50a985['query']=_[_0x8a0e('0x30')](_0x59cb23[_0x8a0e('0x31')]);_0x50a985['filters']=_[_0x8a0e('0x33')](_0x50a985[_0x8a0e('0x34')],_0x50a985[_0x8a0e('0x31')]);_0x10915a['attributes']=_[_0x8a0e('0x33')](_0x50a985[_0x8a0e('0x34')],qs[_0x8a0e('0x36')](_0x59cb23[_0x8a0e('0x31')][_0x8a0e('0x36')]));_0x10915a[_0x8a0e('0x35')]=_0x10915a[_0x8a0e('0x35')]['length']?_0x10915a[_0x8a0e('0x35')]:_0x50a985[_0x8a0e('0x34')];if(_0x59cb23[_0x8a0e('0x31')]['includeAll']){_0x10915a[_0x8a0e('0x48')]=[{'all':!![]}];}_0x10915a=_[_0x8a0e('0x3f')]({},_0x10915a,_0x59cb23[_0x8a0e('0x49')]);return db[_0x8a0e('0x42')][_0x8a0e('0x4a')](_0x10915a)[_0x8a0e('0x2b')](handleEntityNotFound(_0x1b0aa1,null))[_0x8a0e('0x2b')](respondWithResult(_0x1b0aa1,null))[_0x8a0e('0x4b')](handleError(_0x1b0aa1,null));};exports[_0x8a0e('0x4c')]=function(_0x1cf682,_0x3ed0f8){return db['FreshsalesAccount'][_0x8a0e('0x4c')](_0x1cf682[_0x8a0e('0x4d')],{})[_0x8a0e('0x2b')](respondWithResult(_0x3ed0f8,0xc9))[_0x8a0e('0x4b')](handleError(_0x3ed0f8,null));};exports['update']=function(_0x350b09,_0xe9c5bb){if(_0x350b09[_0x8a0e('0x4d')]['id']){delete _0x350b09['body']['id'];}return db['FreshsalesAccount'][_0x8a0e('0x4a')]({'where':{'id':_0x350b09[_0x8a0e('0x46')]['id']}})[_0x8a0e('0x2b')](handleEntityNotFound(_0xe9c5bb,null))[_0x8a0e('0x2b')](saveUpdates(_0x350b09['body'],null))[_0x8a0e('0x2b')](respondWithResult(_0xe9c5bb,null))['catch'](handleError(_0xe9c5bb,null));};exports[_0x8a0e('0x4e')]=function(_0x437ed6,_0x565822){return db[_0x8a0e('0x42')]['find']({'where':{'id':_0x437ed6['params']['id']}})['then'](handleEntityNotFound(_0x565822,null))[_0x8a0e('0x2b')](removeEntity(_0x565822,null))[_0x8a0e('0x4b')](handleError(_0x565822,null));};exports[_0x8a0e('0x4f')]=function(_0x3fc46b,_0x5c4a8e,_0xaadcbc){var _0x2d5cea={};var _0x1dfadb={};var _0x36a91b;var _0x21165e;return db[_0x8a0e('0x42')]['findOne']({'where':{'id':_0x3fc46b[_0x8a0e('0x46')]['id']}})[_0x8a0e('0x2b')](handleEntityNotFound(_0x5c4a8e,null))[_0x8a0e('0x2b')](function(_0x1796fc){if(_0x1796fc){_0x36a91b=_0x1796fc;_0x1dfadb['model']=_[_0x8a0e('0x30')](db['FreshsalesConfiguration'][_0x8a0e('0x47')]);_0x1dfadb[_0x8a0e('0x31')]=_[_0x8a0e('0x30')](_0x3fc46b[_0x8a0e('0x31')]);_0x1dfadb[_0x8a0e('0x32')]=_[_0x8a0e('0x33')](_0x1dfadb[_0x8a0e('0x34')],_0x1dfadb['query']);_0x2d5cea['attributes']=_[_0x8a0e('0x33')](_0x1dfadb['model'],qs[_0x8a0e('0x36')](_0x3fc46b[_0x8a0e('0x31')][_0x8a0e('0x36')]));_0x2d5cea[_0x8a0e('0x35')]=_0x2d5cea[_0x8a0e('0x35')][_0x8a0e('0x37')]?_0x2d5cea[_0x8a0e('0x35')]:_0x1dfadb['model'];_0x2d5cea['order']=qs[_0x8a0e('0x3b')](_0x3fc46b[_0x8a0e('0x31')][_0x8a0e('0x3b')]);_0x2d5cea['where']=qs[_0x8a0e('0x32')](_[_0x8a0e('0x3d')](_0x3fc46b[_0x8a0e('0x31')],_0x1dfadb['filters']));if(_0x3fc46b[_0x8a0e('0x31')]['filter']){_0x2d5cea[_0x8a0e('0x3c')]=_[_0x8a0e('0x3f')](_0x2d5cea[_0x8a0e('0x3c')],{'$or':_[_0x8a0e('0x2f')](_0x2d5cea[_0x8a0e('0x35')],function(_0x555098){var _0x296c62={};_0x296c62[_0x555098]={'$like':'%'+_0x3fc46b[_0x8a0e('0x31')][_0x8a0e('0x3e')]+'%'};return _0x296c62;})});}_0x2d5cea=_[_0x8a0e('0x3f')]({},_0x2d5cea,_0x3fc46b[_0x8a0e('0x49')]);return _0x36a91b[_0x8a0e('0x4f')](_0x2d5cea);}})['then'](function(_0x36a4de){if(_0x36a4de){_0x21165e=_0x36a4de['length'];if(!_0x3fc46b['query']['hasOwnProperty']('nolimit')){_0x2d5cea['limit']=qs['limit'](_0x3fc46b['query']['limit']);_0x2d5cea[_0x8a0e('0x20')]=qs[_0x8a0e('0x20')](_0x3fc46b['query']['offset']);}return _0x36a91b[_0x8a0e('0x4f')](_0x2d5cea);}})[_0x8a0e('0x2b')](function(_0x12a95d){if(_0x12a95d){return _0x12a95d?{'count':_0x21165e,'rows':_0x12a95d}:null;}})[_0x8a0e('0x2b')](respondWithResult(_0x5c4a8e,null))['catch'](handleError(_0x5c4a8e,null));};exports[_0x8a0e('0x50')]=function(_0x2b6aba,_0x252f5f,_0x2c20d1){if(_0x2b6aba['body']['id']){delete _0x2b6aba['body']['id'];}return db[_0x8a0e('0x42')][_0x8a0e('0x51')]({'where':{'id':_0x2b6aba['params']['id']}})['then'](handleEntityNotFound(_0x252f5f,null))[_0x8a0e('0x2b')](function(_0x5da57d){if(_0x5da57d){_0x2b6aba[_0x8a0e('0x4d')][_0x8a0e('0x52')]=_0x5da57d['id'];_0x2b6aba['body']['Subjects']=integrations[_0x8a0e('0x53')](_0x2b6aba[_0x8a0e('0x4d')]['channel'],_0x2b6aba[_0x8a0e('0x4d')][_0x8a0e('0x40')]);_0x2b6aba[_0x8a0e('0x4d')]['Descriptions']=integrations[_0x8a0e('0x54')](_0x2b6aba[_0x8a0e('0x4d')][_0x8a0e('0x55')],_0x2b6aba[_0x8a0e('0x4d')][_0x8a0e('0x40')]);return db[_0x8a0e('0x56')][_0x8a0e('0x4c')](_0x2b6aba[_0x8a0e('0x4d')],{'include':[{'model':db[_0x8a0e('0x57')],'as':_0x8a0e('0x58')},{'model':db[_0x8a0e('0x57')],'as':_0x8a0e('0x59')}]});}return null;})[_0x8a0e('0x2b')](respondWithResult(_0x252f5f,null))['catch'](handleError(_0x252f5f,null));};exports[_0x8a0e('0x5a')]=function(_0x3ab866,_0x477b99,_0x300bbe){var _0x13dd79='';var _0x3778b7='';return db[_0x8a0e('0x42')]['findOne']({'where':{'id':_0x3ab866[_0x8a0e('0x46')]['id']},'attributes':['id',_0x8a0e('0x5b'),_0x8a0e('0x5c'),_0x8a0e('0x5d')]})['then'](handleEntityNotFound(_0x477b99,null))[_0x8a0e('0x2b')](function(_0x25ca0d){if(_0x25ca0d){_0x3778b7=_0x25ca0d[_0x8a0e('0x5b')];_0x13dd79=_0x25ca0d[_0x8a0e('0x5c')];var _0x58fcf2=_0x25ca0d['remoteUri'][_0x8a0e('0x5e')](-0x1);if(_0x58fcf2==='/'){_0x13dd79=_0x13dd79[_0x8a0e('0x5f')](0x0,_0x13dd79['lastIndexOf'](_0x58fcf2));}return rp({'method':_0x8a0e('0x60'),'uri':util['format'](_0x8a0e('0x61'),_0x13dd79,_0x8a0e('0x62')),'headers':{'Authorization':_0x8a0e('0x63')+_0x25ca0d['apiKey']},'json':!![]});}})[_0x8a0e('0x2b')](function(_0x3830b0){if(_0x3830b0){var _0x222dab=_0x3830b0[_0x8a0e('0x64')];var _0x391cb2=![];var _0xfb57aa=null;for(_0xfb57aa=0x0;_0xfb57aa<_0x222dab[_0x8a0e('0x37')];_0xfb57aa++){if(_0x222dab[_0xfb57aa][_0x8a0e('0x65')]===_0x3778b7){_0x391cb2=!![];}}if(_0x391cb2){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8a0e('0x2b')](respondWithResult(_0x477b99,null))[_0x8a0e('0x4b')](function(_0x2f10b4){var _0x337701=_0x3ab866[_0x8a0e('0x31')][_0x8a0e('0x66')]?0x1f4:_0x2f10b4[_0x8a0e('0x67')]||0x1f4;logger[_0x8a0e('0x68')](_0x8a0e('0x69'),'getFields',_0x337701,JSON['stringify'](_0x2f10b4));delete _0x2f10b4[_0x8a0e('0x2c')];if(_0x337701===0x191){_0x337701=0x190;}_0x477b99[_0x8a0e('0x1e')](_0x337701)[_0x8a0e('0x6a')](_0x3ab866[_0x8a0e('0x31')][_0x8a0e('0x66')]?{'message':_0x8a0e('0x6b'),'statusCode':_0x2f10b4['statusCode']}:_0x2f10b4);});}; \ No newline at end of file +var _0x60c2=['mustache','util','path','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','keys','includeAll','find','body','params','destroy','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','create','FreshsalesField','getFields','username','remoteUri','apiKey','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x44d968,_0x3b926d){var _0x5f50b9=function(_0x5e2ffa){while(--_0x5e2ffa){_0x44d968['push'](_0x44d968['shift']());}};_0x5f50b9(++_0x3b926d);}(_0x60c2,0xbe));var _0x260c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x60c2[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x260c('0x0'));var rimraf=require(_0x260c('0x1'));var zipdir=require(_0x260c('0x2'));var jsonpatch=require(_0x260c('0x3'));var rp=require(_0x260c('0x4'));var moment=require('moment');var BPromise=require(_0x260c('0x5'));var Mustache=require(_0x260c('0x6'));var util=require(_0x260c('0x7'));var path=require(_0x260c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x260c('0x9'));var _=require(_0x260c('0xa'));var squel=require(_0x260c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x260c('0xc'));var toCsv=require(_0x260c('0xd'));var querystring=require(_0x260c('0xe'));var Papa=require(_0x260c('0xf'));var Redis=require(_0x260c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x260c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x260c('0x12'))(_0x260c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x260c('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x260c('0x15'));function respondWithStatusCode(_0xb8dc22,_0x197b80){_0x197b80=_0x197b80||0xcc;return function(_0x42e984){if(_0x42e984){return _0xb8dc22['sendStatus'](_0x197b80);}return _0xb8dc22[_0x260c('0x16')](_0x197b80)[_0x260c('0x17')]();};}function respondWithResult(_0x3cad6a,_0x4ba264){_0x4ba264=_0x4ba264||0xc8;return function(_0x4f8bb9){if(_0x4f8bb9){return _0x3cad6a['status'](_0x4ba264)[_0x260c('0x18')](_0x4f8bb9);}};}function respondWithFilteredResult(_0x559445,_0x10c732){return function(_0x173f77){if(_0x173f77){var _0x494c14=typeof _0x10c732[_0x260c('0x19')]==='undefined'&&typeof _0x10c732['limit']===_0x260c('0x1a');var _0xa217d2=_0x173f77[_0x260c('0x1b')];var _0x3d145d=_0x494c14?0x0:_0x10c732['offset'];var _0x585055=_0x494c14?_0x173f77['count']:_0x10c732[_0x260c('0x19')]+_0x10c732[_0x260c('0x1c')];var _0x1a5910;if(_0x585055>=_0xa217d2){_0x585055=_0xa217d2;_0x1a5910=0xc8;}else{_0x1a5910=0xce;}_0x559445[_0x260c('0x16')](_0x1a5910);return _0x559445['set'](_0x260c('0x1d'),_0x3d145d+'-'+_0x585055+'/'+_0xa217d2)[_0x260c('0x18')](_0x173f77);}return null;};}function patchUpdates(_0x4588d7){return function(_0x28bf96){try{jsonpatch['apply'](_0x28bf96,_0x4588d7,!![]);}catch(_0xcffd97){return BPromise[_0x260c('0x1e')](_0xcffd97);}return _0x28bf96[_0x260c('0x1f')]();};}function saveUpdates(_0x4c9a0c,_0x32c006){return function(_0x35a3b5){if(_0x35a3b5){return _0x35a3b5['update'](_0x4c9a0c)[_0x260c('0x20')](function(_0x5a778a){return _0x5a778a;});}return null;};}function removeEntity(_0x5a14ae,_0x1aefcf){return function(_0xbf37b2){if(_0xbf37b2){return _0xbf37b2['destroy']()['then'](function(){_0x5a14ae['status'](0xcc)[_0x260c('0x17')]();});}};}function handleEntityNotFound(_0x18d6ee,_0x48d564){return function(_0x10c01d){if(!_0x10c01d){_0x18d6ee[_0x260c('0x21')](0x194);}return _0x10c01d;};}function handleError(_0x282025,_0x35506c){_0x35506c=_0x35506c||0x1f4;return function(_0x4f5e2d){logger['error'](_0x4f5e2d[_0x260c('0x22')]);if(_0x4f5e2d[_0x260c('0x23')]){delete _0x4f5e2d[_0x260c('0x23')];}_0x282025[_0x260c('0x16')](_0x35506c)[_0x260c('0x24')](_0x4f5e2d);};}exports[_0x260c('0x25')]=function(_0x523f85,_0x27d8cb){var _0x29aa37={},_0x4a1a63={},_0x5a8549={'count':0x0,'rows':[]};var _0x3e9ded=_[_0x260c('0x26')](db[_0x260c('0x27')][_0x260c('0x28')],function(_0x509a33){return{'name':_0x509a33[_0x260c('0x29')],'type':_0x509a33[_0x260c('0x2a')]['key']};});_0x4a1a63[_0x260c('0x2b')]=_[_0x260c('0x26')](_0x3e9ded,_0x260c('0x23'));_0x4a1a63[_0x260c('0x2c')]=_['keys'](_0x523f85['query']);_0x4a1a63[_0x260c('0x2d')]=_['intersection'](_0x4a1a63[_0x260c('0x2b')],_0x4a1a63[_0x260c('0x2c')]);_0x29aa37[_0x260c('0x2e')]=_[_0x260c('0x2f')](_0x4a1a63['model'],qs[_0x260c('0x30')](_0x523f85[_0x260c('0x2c')][_0x260c('0x30')]));_0x29aa37[_0x260c('0x2e')]=_0x29aa37[_0x260c('0x2e')][_0x260c('0x31')]?_0x29aa37['attributes']:_0x4a1a63['model'];if(!_0x523f85[_0x260c('0x2c')][_0x260c('0x32')](_0x260c('0x33'))){_0x29aa37[_0x260c('0x1c')]=qs[_0x260c('0x1c')](_0x523f85['query'][_0x260c('0x1c')]);_0x29aa37['offset']=qs[_0x260c('0x19')](_0x523f85[_0x260c('0x2c')][_0x260c('0x19')]);}_0x29aa37[_0x260c('0x34')]=qs['sort'](_0x523f85[_0x260c('0x2c')][_0x260c('0x35')]);_0x29aa37[_0x260c('0x36')]=qs['filters'](_[_0x260c('0x37')](_0x523f85[_0x260c('0x2c')],_0x4a1a63[_0x260c('0x2d')]),_0x3e9ded);if(_0x523f85[_0x260c('0x2c')][_0x260c('0x38')]){_0x29aa37[_0x260c('0x36')]=_['merge'](_0x29aa37['where'],{'$or':_['map'](_0x3e9ded,function(_0x4dddfd){if(_0x4dddfd[_0x260c('0x2a')]!==_0x260c('0x39')){var _0x271300={};_0x271300[_0x4dddfd['name']]={'$like':'%'+_0x523f85[_0x260c('0x2c')]['filter']+'%'};return _0x271300;}})});}_0x29aa37=_[_0x260c('0x3a')]({},_0x29aa37,_0x523f85[_0x260c('0x3b')]);var _0x1a22a7={'where':_0x29aa37[_0x260c('0x36')]};return db['FreshsalesAccount'][_0x260c('0x1b')](_0x1a22a7)[_0x260c('0x20')](function(_0x1a32e1){_0x5a8549[_0x260c('0x1b')]=_0x1a32e1;if(_0x523f85[_0x260c('0x2c')]['includeAll']){_0x29aa37['include']=[{'all':!![]}];}return db[_0x260c('0x27')][_0x260c('0x3c')](_0x29aa37);})[_0x260c('0x20')](function(_0x19d028){_0x5a8549[_0x260c('0x3d')]=_0x19d028;return _0x5a8549;})['then'](respondWithFilteredResult(_0x27d8cb,_0x29aa37))[_0x260c('0x3e')](handleError(_0x27d8cb,null));};exports[_0x260c('0x3f')]=function(_0x41b6c0,_0x1691e0){var _0x41bd5a={'raw':![],'where':{'id':_0x41b6c0['params']['id']}},_0x4e9707={};_0x4e9707['model']=_[_0x260c('0x40')](db[_0x260c('0x27')][_0x260c('0x28')]);_0x4e9707['query']=_[_0x260c('0x40')](_0x41b6c0['query']);_0x4e9707[_0x260c('0x2d')]=_['intersection'](_0x4e9707[_0x260c('0x2b')],_0x4e9707[_0x260c('0x2c')]);_0x41bd5a[_0x260c('0x2e')]=_[_0x260c('0x2f')](_0x4e9707['model'],qs[_0x260c('0x30')](_0x41b6c0[_0x260c('0x2c')]['fields']));_0x41bd5a['attributes']=_0x41bd5a[_0x260c('0x2e')][_0x260c('0x31')]?_0x41bd5a[_0x260c('0x2e')]:_0x4e9707[_0x260c('0x2b')];if(_0x41b6c0[_0x260c('0x2c')][_0x260c('0x41')]){_0x41bd5a['include']=[{'all':!![]}];}_0x41bd5a=_[_0x260c('0x3a')]({},_0x41bd5a,_0x41b6c0[_0x260c('0x3b')]);return db[_0x260c('0x27')][_0x260c('0x42')](_0x41bd5a)['then'](handleEntityNotFound(_0x1691e0,null))['then'](respondWithResult(_0x1691e0,null))['catch'](handleError(_0x1691e0,null));};exports['create']=function(_0x3a72e7,_0xa53702){return db['FreshsalesAccount']['create'](_0x3a72e7[_0x260c('0x43')],{})['then'](respondWithResult(_0xa53702,0xc9))[_0x260c('0x3e')](handleError(_0xa53702,null));};exports['update']=function(_0x56b6bc,_0xbed402){if(_0x56b6bc[_0x260c('0x43')]['id']){delete _0x56b6bc[_0x260c('0x43')]['id'];}return db['FreshsalesAccount'][_0x260c('0x42')]({'where':{'id':_0x56b6bc[_0x260c('0x44')]['id']}})[_0x260c('0x20')](handleEntityNotFound(_0xbed402,null))[_0x260c('0x20')](saveUpdates(_0x56b6bc[_0x260c('0x43')],null))[_0x260c('0x20')](respondWithResult(_0xbed402,null))[_0x260c('0x3e')](handleError(_0xbed402,null));};exports[_0x260c('0x45')]=function(_0x3f3fce,_0x2c6c50){return db[_0x260c('0x27')][_0x260c('0x42')]({'where':{'id':_0x3f3fce[_0x260c('0x44')]['id']}})[_0x260c('0x20')](handleEntityNotFound(_0x2c6c50,null))[_0x260c('0x20')](removeEntity(_0x2c6c50,null))['catch'](handleError(_0x2c6c50,null));};exports[_0x260c('0x46')]=function(_0x23abb3,_0xcaa60f,_0xfce59d){var _0x579c09={};var _0xca0f2f={};var _0x2dffa0;var _0x259f26;return db[_0x260c('0x27')][_0x260c('0x47')]({'where':{'id':_0x23abb3['params']['id']}})[_0x260c('0x20')](handleEntityNotFound(_0xcaa60f,null))[_0x260c('0x20')](function(_0x30edd8){if(_0x30edd8){_0x2dffa0=_0x30edd8;_0xca0f2f['model']=_['keys'](db[_0x260c('0x48')][_0x260c('0x28')]);_0xca0f2f[_0x260c('0x2c')]=_['keys'](_0x23abb3[_0x260c('0x2c')]);_0xca0f2f[_0x260c('0x2d')]=_['intersection'](_0xca0f2f['model'],_0xca0f2f[_0x260c('0x2c')]);_0x579c09[_0x260c('0x2e')]=_[_0x260c('0x2f')](_0xca0f2f[_0x260c('0x2b')],qs[_0x260c('0x30')](_0x23abb3['query'][_0x260c('0x30')]));_0x579c09[_0x260c('0x2e')]=_0x579c09['attributes'][_0x260c('0x31')]?_0x579c09['attributes']:_0xca0f2f[_0x260c('0x2b')];_0x579c09[_0x260c('0x34')]=qs[_0x260c('0x35')](_0x23abb3[_0x260c('0x2c')][_0x260c('0x35')]);_0x579c09['where']=qs['filters'](_[_0x260c('0x37')](_0x23abb3[_0x260c('0x2c')],_0xca0f2f['filters']));if(_0x23abb3[_0x260c('0x2c')]['filter']){_0x579c09[_0x260c('0x36')]=_['merge'](_0x579c09[_0x260c('0x36')],{'$or':_[_0x260c('0x26')](_0x579c09[_0x260c('0x2e')],function(_0x1148b9){var _0x2a6948={};_0x2a6948[_0x1148b9]={'$like':'%'+_0x23abb3[_0x260c('0x2c')][_0x260c('0x38')]+'%'};return _0x2a6948;})});}_0x579c09=_['merge']({},_0x579c09,_0x23abb3[_0x260c('0x3b')]);return _0x2dffa0['getConfigurations'](_0x579c09);}})[_0x260c('0x20')](function(_0x252a58){if(_0x252a58){_0x259f26=_0x252a58[_0x260c('0x31')];if(!_0x23abb3[_0x260c('0x2c')][_0x260c('0x32')](_0x260c('0x33'))){_0x579c09['limit']=qs[_0x260c('0x1c')](_0x23abb3['query']['limit']);_0x579c09[_0x260c('0x19')]=qs[_0x260c('0x19')](_0x23abb3[_0x260c('0x2c')]['offset']);}return _0x2dffa0[_0x260c('0x46')](_0x579c09);}})[_0x260c('0x20')](function(_0x76440c){if(_0x76440c){return _0x76440c?{'count':_0x259f26,'rows':_0x76440c}:null;}})[_0x260c('0x20')](respondWithResult(_0xcaa60f,null))[_0x260c('0x3e')](handleError(_0xcaa60f,null));};exports[_0x260c('0x49')]=function(_0x4b342e,_0x333382,_0x4a489c){if(_0x4b342e[_0x260c('0x43')]['id']){delete _0x4b342e[_0x260c('0x43')]['id'];}return db[_0x260c('0x27')][_0x260c('0x47')]({'where':{'id':_0x4b342e['params']['id']}})[_0x260c('0x20')](handleEntityNotFound(_0x333382,null))['then'](function(_0x198fb9){if(_0x198fb9){_0x4b342e[_0x260c('0x43')][_0x260c('0x4a')]=_0x198fb9['id'];_0x4b342e['body'][_0x260c('0x4b')]=integrations['getSubjects'](_0x4b342e[_0x260c('0x43')][_0x260c('0x4c')],_0x4b342e[_0x260c('0x43')]['type']);_0x4b342e['body'][_0x260c('0x4d')]=integrations['getDescriptions'](_0x4b342e[_0x260c('0x43')][_0x260c('0x4c')],_0x4b342e['body'][_0x260c('0x2a')]);return db[_0x260c('0x48')][_0x260c('0x4e')](_0x4b342e[_0x260c('0x43')],{'include':[{'model':db['FreshsalesField'],'as':_0x260c('0x4b')},{'model':db[_0x260c('0x4f')],'as':_0x260c('0x4d')}]});}return null;})[_0x260c('0x20')](respondWithResult(_0x333382,null))[_0x260c('0x3e')](handleError(_0x333382,null));};exports[_0x260c('0x50')]=function(_0x369a13,_0x142bc5,_0x3b7dd6){var _0x521f84='';var _0x2ff9d3='';return db['FreshsalesAccount'][_0x260c('0x47')]({'where':{'id':_0x369a13[_0x260c('0x44')]['id']},'attributes':['id',_0x260c('0x51'),_0x260c('0x52'),_0x260c('0x53')]})[_0x260c('0x20')](handleEntityNotFound(_0x142bc5,null))[_0x260c('0x20')](function(_0x13c876){if(_0x13c876){_0x2ff9d3=_0x13c876[_0x260c('0x51')];_0x521f84=_0x13c876[_0x260c('0x52')];var _0x21a587=_0x13c876[_0x260c('0x52')][_0x260c('0x54')](-0x1);if(_0x21a587==='/'){_0x521f84=_0x521f84['substring'](0x0,_0x521f84['lastIndexOf'](_0x21a587));}return rp({'method':_0x260c('0x55'),'uri':util[_0x260c('0x56')](_0x260c('0x57'),_0x521f84,_0x260c('0x58')),'headers':{'Authorization':_0x260c('0x59')+_0x13c876[_0x260c('0x53')]},'json':!![]});}})['then'](function(_0x6bb778){if(_0x6bb778){var _0x59e928=_0x6bb778[_0x260c('0x5a')];var _0x117f9c=![];var _0x40ecf1=null;for(_0x40ecf1=0x0;_0x40ecf1<_0x59e928[_0x260c('0x31')];_0x40ecf1++){if(_0x59e928[_0x40ecf1][_0x260c('0x5b')]===_0x2ff9d3){_0x117f9c=!![];}}if(_0x117f9c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x260c('0x5c')});}}})[_0x260c('0x20')](respondWithResult(_0x142bc5,null))[_0x260c('0x3e')](function(_0x3fdc5a){var _0x24c144=_0x369a13[_0x260c('0x2c')][_0x260c('0x5d')]?0x1f4:_0x3fdc5a['statusCode']||0x1f4;logger[_0x260c('0x5e')](_0x260c('0x5f'),_0x260c('0x50'),_0x24c144,JSON[_0x260c('0x60')](_0x3fdc5a));delete _0x3fdc5a[_0x260c('0x23')];if(_0x24c144===0x191){_0x24c144=0x190;}_0x142bc5[_0x260c('0x16')](_0x24c144)[_0x260c('0x24')](_0x369a13['query'][_0x260c('0x5d')]?{'message':'Wrong\x20credentials','statusCode':_0x3fdc5a[_0x260c('0x61')]}:_0x3fdc5a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 3ed921b..ae8757d 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 _0x53ec=['path','../../config/environment','./intFreshsalesAccount.attributes','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x53ec,0x192));var _0xc53e=function(_0x58e253,_0x30a9c3){_0x58e253=_0x58e253-0x0;var _0x2ffe75=_0x53ec[_0x58e253];return _0x2ffe75;};'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')]('FreshsalesAccount',attributes,{'tableName':_0xc53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5af=['FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x4533b4,_0x29b46a){var _0x3e2b6d=function(_0x5c7771){while(--_0x5c7771){_0x4533b4['push'](_0x4533b4['shift']());}};_0x3e2b6d(++_0x29b46a);}(_0xe5af,0x9c));var _0xfe5a=function(_0x3fcaa7,_0x308f38){_0x3fcaa7=_0x3fcaa7-0x0;var _0x3b4015=_0xe5af[_0x3fcaa7];return _0x3b4015;};'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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 011273a..e285a6e 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 _0x5fdc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','info','GetFreshsalesAccount','FreshsalesAccount','options','raw','attributes','include','map','model','ShowFreshsalesAccount','find','where','catch','lodash'];(function(_0x5a27fe,_0x43993b){var _0x121c88=function(_0x2aff1f){while(--_0x2aff1f){_0x5a27fe['push'](_0x5a27fe['shift']());}};_0x121c88(++_0x43993b);}(_0x5fdc,0x127));var _0xc5fd=function(_0x57f8a1,_0x58b8b4){_0x57f8a1=_0x57f8a1-0x0;var _0x49122a=_0x5fdc[_0x57f8a1];return _0x49122a;};'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']('FreshsalesAccount,\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']('FreshsalesAccount,\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')]['findAll']({'raw':_0x27f611[_0xc5fd('0x1b')]?_0x27f611[_0xc5fd('0x1b')][_0xc5fd('0x1c')]===undefined?!![]:![]:!![],'where':_0x27f611[_0xc5fd('0x1b')]?_0x27f611[_0xc5fd('0x1b')]['where']||null:null,'attributes':_0x27f611[_0xc5fd('0x1b')]?_0x27f611[_0xc5fd('0x1b')][_0xc5fd('0x1d')]||null:null,'limit':_0x27f611[_0xc5fd('0x1b')]?_0x27f611['options']['limit']||null:null,'include':_0x27f611[_0xc5fd('0x1b')]?_0x27f611[_0xc5fd('0x1b')][_0xc5fd('0x1e')]?_[_0xc5fd('0x1f')](_0x27f611[_0xc5fd('0x1b')][_0xc5fd('0x1e')],function(_0x56d473){return{'model':db[_0x56d473[_0xc5fd('0x20')]],'as':_0x56d473['as'],'attributes':_0x56d473[_0xc5fd('0x1d')],'include':_0x56d473[_0xc5fd('0x1e')]?_[_0xc5fd('0x1f')](_0x56d473[_0xc5fd('0x1e')],function(_0x4020af){return{'model':db[_0x4020af[_0xc5fd('0x20')]],'as':_0x4020af['as'],'attributes':_0x4020af['attributes'],'include':_0x4020af[_0xc5fd('0x1e')]?_['map'](_0x4020af[_0xc5fd('0x1e')],function(_0x231368){return{'model':db[_0x231368[_0xc5fd('0x20')]],'as':_0x231368['as'],'attributes':_0x231368[_0xc5fd('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x176313){logger[_0xc5fd('0x18')](_0xc5fd('0x19'),_0x27f611);logger[_0xc5fd('0x11')](_0xc5fd('0x19'),_0x27f611,JSON[_0xc5fd('0x13')](_0x176313));_0x2ee392(_0x176313);})['catch'](function(_0x412ef7){logger['error']('GetFreshsalesAccount',_0x412ef7[_0xc5fd('0x16')],_0x27f611);_0x3f981f(_0xd0a9f1[_0xc5fd('0x14')](0x1f4,_0x412ef7[_0xc5fd('0x16')]));});});};exports[_0xc5fd('0x21')]=function(_0x7693c4){var _0x85fa81=this;return new Promise(function(_0x2a891d,_0x321eea){return db['FreshsalesAccount'][_0xc5fd('0x22')]({'raw':_0x7693c4[_0xc5fd('0x1b')]?_0x7693c4[_0xc5fd('0x1b')][_0xc5fd('0x1c')]===undefined?!![]:![]:!![],'where':_0x7693c4[_0xc5fd('0x1b')]?_0x7693c4[_0xc5fd('0x1b')][_0xc5fd('0x23')]||null:null,'attributes':_0x7693c4[_0xc5fd('0x1b')]?_0x7693c4[_0xc5fd('0x1b')][_0xc5fd('0x1d')]||null:null,'include':_0x7693c4[_0xc5fd('0x1b')]?_0x7693c4[_0xc5fd('0x1b')]['include']?_[_0xc5fd('0x1f')](_0x7693c4[_0xc5fd('0x1b')][_0xc5fd('0x1e')],function(_0x1fa329){return{'model':db[_0x1fa329[_0xc5fd('0x20')]],'as':_0x1fa329['as'],'attributes':_0x1fa329[_0xc5fd('0x1d')],'include':_0x1fa329[_0xc5fd('0x1e')]?_[_0xc5fd('0x1f')](_0x1fa329[_0xc5fd('0x1e')],function(_0x545bfc){return{'model':db[_0x545bfc[_0xc5fd('0x20')]],'as':_0x545bfc['as'],'attributes':_0x545bfc[_0xc5fd('0x1d')],'include':_0x545bfc[_0xc5fd('0x1e')]?_[_0xc5fd('0x1f')](_0x545bfc[_0xc5fd('0x1e')],function(_0x52267e){return{'model':db[_0x52267e[_0xc5fd('0x20')]],'as':_0x52267e['as'],'attributes':_0x52267e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc5fd('0xf')](function(_0xac7c40){logger['info'](_0xc5fd('0x21'),_0x7693c4);logger['debug'](_0xc5fd('0x21'),_0x7693c4,JSON[_0xc5fd('0x13')](_0xac7c40));_0x2a891d(_0xac7c40);})[_0xc5fd('0x24')](function(_0x4cafb1){logger[_0xc5fd('0x14')](_0xc5fd('0x21'),_0x4cafb1['message'],_0x7693c4);_0x321eea(_0x85fa81[_0xc5fd('0x14')](0x1f4,_0x4cafb1[_0xc5fd('0x16')]));});});}; \ No newline at end of file +var _0x9f0e=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit','include','map','model','attributes','ShowFreshsalesAccount','find','where','lodash','util'];(function(_0x3f99c0,_0x1e8816){var _0x1d5e2e=function(_0x2ee522){while(--_0x2ee522){_0x3f99c0['push'](_0x3f99c0['shift']());}};_0x1d5e2e(++_0x1e8816);}(_0x9f0e,0x116));var _0xe9f0=function(_0x650e61,_0x40055a){_0x650e61=_0x650e61-0x0;var _0x288cfa=_0x9f0e[_0x650e61];return _0x288cfa;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});}exports[_0xe9f0('0x16')]=function(_0x2ab12b){var _0x3da237=this;return new Promise(function(_0x59bf5a,_0x15a33b){return db[_0xe9f0('0x17')][_0xe9f0('0x18')]({'raw':_0x2ab12b['options']?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')]['where']||null:null,'attributes':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')]['attributes']||null:null,'limit':_0x2ab12b['options']?_0x2ab12b['options'][_0xe9f0('0x1b')]||null:null,'include':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x2ab12b['options'][_0xe9f0('0x1c')],function(_0x38b7ee){return{'model':db[_0x38b7ee[_0xe9f0('0x1e')]],'as':_0x38b7ee['as'],'attributes':_0x38b7ee[_0xe9f0('0x1f')],'include':_0x38b7ee[_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x38b7ee[_0xe9f0('0x1c')],function(_0x1321bb){return{'model':db[_0x1321bb[_0xe9f0('0x1e')]],'as':_0x1321bb['as'],'attributes':_0x1321bb[_0xe9f0('0x1f')],'include':_0x1321bb['include']?_[_0xe9f0('0x1d')](_0x1321bb[_0xe9f0('0x1c')],function(_0x2ddfba){return{'model':db[_0x2ddfba[_0xe9f0('0x1e')]],'as':_0x2ddfba['as'],'attributes':_0x2ddfba['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9f0('0xb')](function(_0x2613fd){logger[_0xe9f0('0xc')](_0xe9f0('0x16'),_0x2ab12b);logger[_0xe9f0('0xf')]('GetFreshsalesAccount',_0x2ab12b,JSON[_0xe9f0('0x11')](_0x2613fd));_0x59bf5a(_0x2613fd);})[_0xe9f0('0x15')](function(_0x44fb5b){logger[_0xe9f0('0x12')](_0xe9f0('0x16'),_0x44fb5b[_0xe9f0('0x13')],_0x2ab12b);_0x15a33b(_0x3da237[_0xe9f0('0x12')](0x1f4,_0x44fb5b[_0xe9f0('0x13')]));});});};exports[_0xe9f0('0x20')]=function(_0x3dbe49){var _0x22806c=this;return new Promise(function(_0x617ad3,_0x445ad0){return db[_0xe9f0('0x17')][_0xe9f0('0x21')]({'raw':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x22')]||null:null,'attributes':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x1f')]||null:null,'include':_0x3dbe49['options']?_0x3dbe49['options']['include']?_[_0xe9f0('0x1d')](_0x3dbe49['options'][_0xe9f0('0x1c')],function(_0xc5fa13){return{'model':db[_0xc5fa13['model']],'as':_0xc5fa13['as'],'attributes':_0xc5fa13[_0xe9f0('0x1f')],'include':_0xc5fa13['include']?_['map'](_0xc5fa13['include'],function(_0x165440){return{'model':db[_0x165440[_0xe9f0('0x1e')]],'as':_0x165440['as'],'attributes':_0x165440['attributes'],'include':_0x165440[_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x165440[_0xe9f0('0x1c')],function(_0x4d4186){return{'model':db[_0x4d4186['model']],'as':_0x4d4186['as'],'attributes':_0x4d4186[_0xe9f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe9f0('0xb')](function(_0x1917c8){logger['info'](_0xe9f0('0x20'),_0x3dbe49);logger[_0xe9f0('0xf')](_0xe9f0('0x20'),_0x3dbe49,JSON[_0xe9f0('0x11')](_0x1917c8));_0x617ad3(_0x1917c8);})[_0xe9f0('0x15')](function(_0x552ec2){logger[_0xe9f0('0x12')](_0xe9f0('0x20'),_0x552ec2[_0xe9f0('0x13')],_0x3dbe49);_0x445ad0(_0x22806c['error'](0x1f4,_0x552ec2[_0xe9f0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 630b4a2..45e42cf 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 _0x8282=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','update','destroy','exports'];(function(_0x1ba90c,_0x471ef1){var _0x3bc5dd=function(_0x44a483){while(--_0x44a483){_0x1ba90c['push'](_0x1ba90c['shift']());}};_0x3bc5dd(++_0x471ef1);}(_0x8282,0xfc));var _0x2828=function(_0x468b92,_0x17baaf){_0x468b92=_0x468b92-0x0;var _0x191a14=_0x8282[_0x468b92];return _0x191a14;};'use strict';var multer=require(_0x2828('0x0'));var util=require('util');var path=require(_0x2828('0x1'));var timeout=require(_0x2828('0x2'));var express=require('express');var router=express[_0x2828('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2828('0x4'));var interaction=require(_0x2828('0x5'));var config=require(_0x2828('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x2828('0x7')]('/',auth[_0x2828('0x8')](),controller[_0x2828('0x9')]);router[_0x2828('0x7')](_0x2828('0xa'),auth[_0x2828('0x8')](),controller[_0x2828('0xb')]);router[_0x2828('0x7')](_0x2828('0xc'),auth[_0x2828('0x8')](),controller['getSubjects']);router[_0x2828('0x7')](_0x2828('0xd'),auth[_0x2828('0x8')](),controller[_0x2828('0xe')]);router['get'](_0x2828('0xf'),auth[_0x2828('0x8')](),controller[_0x2828('0x10')]);router[_0x2828('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2828('0xa'),auth[_0x2828('0x8')](),controller[_0x2828('0x12')]);router['delete'](_0x2828('0xa'),auth[_0x2828('0x8')](),controller[_0x2828('0x13')]);module[_0x2828('0x14')]=router; \ No newline at end of file +var _0x2df9=['express','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','/:id/subjects','getDescriptions','getFields','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2df9,0xd9));var _0x92df=function(_0xe0444c,_0x5acdf5){_0xe0444c=_0xe0444c-0x0;var _0x232b2d=_0x2df9[_0xe0444c];return _0x232b2d;};'use strict';var multer=require(_0x92df('0x0'));var util=require(_0x92df('0x1'));var path=require('path');var timeout=require(_0x92df('0x2'));var express=require(_0x92df('0x3'));var router=express['Router']();var fs_extra=require(_0x92df('0x4'));var auth=require(_0x92df('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x92df('0x6')]('/',auth[_0x92df('0x7')](),controller[_0x92df('0x8')]);router[_0x92df('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x92df('0x9')]);router['get'](_0x92df('0xa'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x92df('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x92df('0xb')]);router[_0x92df('0x6')]('/:id/fields',auth[_0x92df('0x7')](),controller[_0x92df('0xc')]);router[_0x92df('0xd')]('/',auth['isAuthenticated'](),controller[_0x92df('0xe')]);router[_0x92df('0xf')](_0x92df('0x10'),auth[_0x92df('0x7')](),controller[_0x92df('0x11')]);router['delete']('/:id',auth[_0x92df('0x7')](),controller[_0x92df('0x12')]);module[_0x92df('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 3891c48..892c2a4 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 _0x0636=['STRING','exports'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x0636,0x1d7));var _0x6063=function(_0x2e8a0c,_0x29a1e3){_0x2e8a0c=_0x2e8a0c-0x0;var _0x4aa806=_0x0636[_0x2e8a0c];return _0x4aa806;};'use strict';var Sequelize=require('sequelize');module[_0x6063('0x0')]={'name':{'type':Sequelize[_0x6063('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9bee=['STRING','sequelize','exports'];(function(_0x5dad01,_0x51ee76){var _0x596e37=function(_0x5abc73){while(--_0x5abc73){_0x5dad01['push'](_0x5dad01['shift']());}};_0x596e37(++_0x51ee76);}(_0x9bee,0x1a5));var _0xe9be=function(_0x2ffcec,_0x3c7db8){_0x2ffcec=_0x2ffcec-0x0;var _0x11d00f=_0x9bee[_0x2ffcec];return _0x11d00f;};'use strict';var Sequelize=require(_0xe9be('0x0'));module[_0xe9be('0x1')]={'name':{'type':Sequelize[_0xe9be('0x2')]},'description':{'type':Sequelize[_0xe9be('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 1aa45ec..f26a241 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 _0x9e86=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','destroy','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','then','includeAll','include','catch','show','length','options','find','create','body','update','params','findOne','FreshsalesField','getSubjects','getDescriptions','hasOwnProperty','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4b4132,_0x3ecb4e){var _0x2a89f3=function(_0xa55d58){while(--_0xa55d58){_0x4b4132['push'](_0x4b4132['shift']());}};_0x2a89f3(++_0x3ecb4e);}(_0x9e86,0x185));var _0x69e8=function(_0x3fc467,_0x2e6102){_0x3fc467=_0x3fc467-0x0;var _0x584c72=_0x9e86[_0x3fc467];return _0x584c72;};'use strict';var emlformat=require(_0x69e8('0x0'));var rimraf=require(_0x69e8('0x1'));var zipdir=require(_0x69e8('0x2'));var jsonpatch=require(_0x69e8('0x3'));var rp=require(_0x69e8('0x4'));var moment=require(_0x69e8('0x5'));var BPromise=require(_0x69e8('0x6'));var Mustache=require(_0x69e8('0x7'));var util=require(_0x69e8('0x8'));var path=require('path');var sox=require(_0x69e8('0x9'));var csv=require(_0x69e8('0xa'));var ejs=require(_0x69e8('0xb'));var fs=require('fs');var fs_extra=require(_0x69e8('0xc'));var _=require(_0x69e8('0xd'));var squel=require('squel');var crypto=require(_0x69e8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x69e8('0xf'));var toCsv=require(_0x69e8('0xa'));var querystring=require(_0x69e8('0x10'));var Papa=require('papaparse');var Redis=require(_0x69e8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x69e8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69e8('0x13'));var logger=require(_0x69e8('0x14'))(_0x69e8('0x15'));var utils=require(_0x69e8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69e8('0x17'))['db'];function respondWithStatusCode(_0x3832cc,_0x8a7e05){_0x8a7e05=_0x8a7e05||0xcc;return function(_0x109edd){if(_0x109edd){return _0x3832cc[_0x69e8('0x18')](_0x8a7e05);}return _0x3832cc[_0x69e8('0x19')](_0x8a7e05)[_0x69e8('0x1a')]();};}function respondWithResult(_0x4b6fa2,_0x4727ff){_0x4727ff=_0x4727ff||0xc8;return function(_0x467845){if(_0x467845){return _0x4b6fa2[_0x69e8('0x19')](_0x4727ff)[_0x69e8('0x1b')](_0x467845);}};}function respondWithFilteredResult(_0xb32abc,_0x85dfaf){return function(_0x44bc44){if(_0x44bc44){var _0x46c26c=typeof _0x85dfaf[_0x69e8('0x1c')]===_0x69e8('0x1d')&&typeof _0x85dfaf[_0x69e8('0x1e')]===_0x69e8('0x1d');var _0x259e83=_0x44bc44['count'];var _0xea3a87=_0x46c26c?0x0:_0x85dfaf[_0x69e8('0x1c')];var _0x3352e2=_0x46c26c?_0x44bc44['count']:_0x85dfaf[_0x69e8('0x1c')]+_0x85dfaf['limit'];var _0x25dffc;if(_0x3352e2>=_0x259e83){_0x3352e2=_0x259e83;_0x25dffc=0xc8;}else{_0x25dffc=0xce;}_0xb32abc[_0x69e8('0x19')](_0x25dffc);return _0xb32abc[_0x69e8('0x1f')](_0x69e8('0x20'),_0xea3a87+'-'+_0x3352e2+'/'+_0x259e83)[_0x69e8('0x1b')](_0x44bc44);}return null;};}function patchUpdates(_0x139a36){return function(_0x5744d4){try{jsonpatch['apply'](_0x5744d4,_0x139a36,!![]);}catch(_0x474e6f){return BPromise[_0x69e8('0x21')](_0x474e6f);}return _0x5744d4[_0x69e8('0x22')]();};}function saveUpdates(_0x2268ee,_0x5e7778){return function(_0x55bd06){if(_0x55bd06){return _0x55bd06['update'](_0x2268ee)['then'](function(_0x51f319){return _0x51f319;});}return null;};}function removeEntity(_0x56423b,_0x9dacb7){return function(_0x51e25a){if(_0x51e25a){return _0x51e25a[_0x69e8('0x23')]()['then'](function(){_0x56423b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x482140,_0x28a018){return function(_0xd6708e){if(!_0xd6708e){_0x482140['sendStatus'](0x194);}return _0xd6708e;};}function handleError(_0x2e4fee,_0x4f1531){_0x4f1531=_0x4f1531||0x1f4;return function(_0x2ab153){logger[_0x69e8('0x24')](_0x2ab153['stack']);if(_0x2ab153[_0x69e8('0x25')]){delete _0x2ab153[_0x69e8('0x25')];}_0x2e4fee[_0x69e8('0x19')](_0x4f1531)[_0x69e8('0x26')](_0x2ab153);};}exports[_0x69e8('0x27')]=function(_0x859b2b,_0x4aa077){var _0x13cea4={},_0x5591c3={},_0x1b2db4={'count':0x0,'rows':[]};var _0x1e291c=_[_0x69e8('0x28')](db[_0x69e8('0x29')][_0x69e8('0x2a')],function(_0x5dcc47){return{'name':_0x5dcc47['fieldName'],'type':_0x5dcc47[_0x69e8('0x2b')][_0x69e8('0x2c')]};});_0x5591c3[_0x69e8('0x2d')]=_[_0x69e8('0x28')](_0x1e291c,_0x69e8('0x25'));_0x5591c3[_0x69e8('0x2e')]=_[_0x69e8('0x2f')](_0x859b2b[_0x69e8('0x2e')]);_0x5591c3[_0x69e8('0x30')]=_['intersection'](_0x5591c3['model'],_0x5591c3['query']);_0x13cea4[_0x69e8('0x31')]=_[_0x69e8('0x32')](_0x5591c3[_0x69e8('0x2d')],qs['fields'](_0x859b2b[_0x69e8('0x2e')][_0x69e8('0x33')]));_0x13cea4[_0x69e8('0x31')]=_0x13cea4['attributes']['length']?_0x13cea4[_0x69e8('0x31')]:_0x5591c3[_0x69e8('0x2d')];if(!_0x859b2b[_0x69e8('0x2e')]['hasOwnProperty'](_0x69e8('0x34'))){_0x13cea4[_0x69e8('0x1e')]=qs[_0x69e8('0x1e')](_0x859b2b[_0x69e8('0x2e')]['limit']);_0x13cea4[_0x69e8('0x1c')]=qs[_0x69e8('0x1c')](_0x859b2b[_0x69e8('0x2e')][_0x69e8('0x1c')]);}_0x13cea4[_0x69e8('0x35')]=qs[_0x69e8('0x36')](_0x859b2b['query'][_0x69e8('0x36')]);_0x13cea4[_0x69e8('0x37')]=qs[_0x69e8('0x30')](_[_0x69e8('0x38')](_0x859b2b['query'],_0x5591c3['filters']),_0x1e291c);if(_0x859b2b[_0x69e8('0x2e')]['filter']){_0x13cea4[_0x69e8('0x37')]=_[_0x69e8('0x39')](_0x13cea4['where'],{'$or':_[_0x69e8('0x28')](_0x1e291c,function(_0x1ebbaa){if(_0x1ebbaa[_0x69e8('0x2b')]!==_0x69e8('0x3a')){var _0x11b151={};_0x11b151[_0x1ebbaa['name']]={'$like':'%'+_0x859b2b['query'][_0x69e8('0x3b')]+'%'};return _0x11b151;}})});}_0x13cea4=_[_0x69e8('0x39')]({},_0x13cea4,_0x859b2b['options']);var _0x52ec7a={'where':_0x13cea4[_0x69e8('0x37')]};return db[_0x69e8('0x29')][_0x69e8('0x3c')](_0x52ec7a)[_0x69e8('0x3d')](function(_0x3a36c7){_0x1b2db4['count']=_0x3a36c7;if(_0x859b2b['query'][_0x69e8('0x3e')]){_0x13cea4[_0x69e8('0x3f')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x13cea4);})['then'](function(_0x566a2b){_0x1b2db4['rows']=_0x566a2b;return _0x1b2db4;})[_0x69e8('0x3d')](respondWithFilteredResult(_0x4aa077,_0x13cea4))[_0x69e8('0x40')](handleError(_0x4aa077,null));};exports[_0x69e8('0x41')]=function(_0x24bd2d,_0x140a8a){var _0x2f3592={'raw':![],'where':{'id':_0x24bd2d['params']['id']}},_0x13e6b0={};_0x13e6b0[_0x69e8('0x2d')]=_[_0x69e8('0x2f')](db[_0x69e8('0x29')]['rawAttributes']);_0x13e6b0[_0x69e8('0x2e')]=_[_0x69e8('0x2f')](_0x24bd2d[_0x69e8('0x2e')]);_0x13e6b0[_0x69e8('0x30')]=_[_0x69e8('0x32')](_0x13e6b0[_0x69e8('0x2d')],_0x13e6b0['query']);_0x2f3592[_0x69e8('0x31')]=_['intersection'](_0x13e6b0[_0x69e8('0x2d')],qs[_0x69e8('0x33')](_0x24bd2d[_0x69e8('0x2e')][_0x69e8('0x33')]));_0x2f3592[_0x69e8('0x31')]=_0x2f3592[_0x69e8('0x31')][_0x69e8('0x42')]?_0x2f3592[_0x69e8('0x31')]:_0x13e6b0[_0x69e8('0x2d')];if(_0x24bd2d[_0x69e8('0x2e')]['includeAll']){_0x2f3592[_0x69e8('0x3f')]=[{'all':!![]}];}_0x2f3592=_[_0x69e8('0x39')]({},_0x2f3592,_0x24bd2d[_0x69e8('0x43')]);return db['FreshsalesConfiguration'][_0x69e8('0x44')](_0x2f3592)[_0x69e8('0x3d')](handleEntityNotFound(_0x140a8a,null))[_0x69e8('0x3d')](respondWithResult(_0x140a8a,null))['catch'](handleError(_0x140a8a,null));};exports[_0x69e8('0x45')]=function(_0x4ba19c,_0x301f29){return db[_0x69e8('0x29')]['create'](_0x4ba19c[_0x69e8('0x46')],{})['then'](respondWithResult(_0x301f29,0xc9))[_0x69e8('0x40')](handleError(_0x301f29,null));};exports[_0x69e8('0x47')]=function(_0x4f5050,_0x305d25){if(_0x4f5050['body']['id']){delete _0x4f5050[_0x69e8('0x46')]['id'];}return db['FreshsalesConfiguration'][_0x69e8('0x44')]({'where':{'id':_0x4f5050[_0x69e8('0x48')]['id']}})[_0x69e8('0x3d')](handleEntityNotFound(_0x305d25,null))[_0x69e8('0x3d')](saveUpdates(_0x4f5050['body'],null))['then'](respondWithResult(_0x305d25,null))[_0x69e8('0x40')](handleError(_0x305d25,null));};exports['destroy']=function(_0x334b04,_0x46dd22){return db[_0x69e8('0x29')][_0x69e8('0x44')]({'where':{'id':_0x334b04[_0x69e8('0x48')]['id']}})[_0x69e8('0x3d')](handleEntityNotFound(_0x46dd22,null))[_0x69e8('0x3d')](removeEntity(_0x46dd22,null))[_0x69e8('0x40')](handleError(_0x46dd22,null));};exports['getSubjects']=function(_0x455b2c,_0x371530,_0x1a463c){var _0x40dcff={};var _0x4d1324={};var _0x4948b1;var _0x3e0863;return db[_0x69e8('0x29')][_0x69e8('0x49')]({'where':{'id':_0x455b2c[_0x69e8('0x48')]['id']}})[_0x69e8('0x3d')](handleEntityNotFound(_0x371530,null))['then'](function(_0xfb43a3){if(_0xfb43a3){_0x4948b1=_0xfb43a3;_0x4d1324[_0x69e8('0x2d')]=_[_0x69e8('0x2f')](db[_0x69e8('0x4a')][_0x69e8('0x2a')]);_0x4d1324[_0x69e8('0x2e')]=_[_0x69e8('0x2f')](_0x455b2c[_0x69e8('0x2e')]);_0x4d1324[_0x69e8('0x30')]=_[_0x69e8('0x32')](_0x4d1324[_0x69e8('0x2d')],_0x4d1324[_0x69e8('0x2e')]);_0x40dcff['attributes']=_[_0x69e8('0x32')](_0x4d1324[_0x69e8('0x2d')],qs[_0x69e8('0x33')](_0x455b2c[_0x69e8('0x2e')][_0x69e8('0x33')]));_0x40dcff[_0x69e8('0x31')]=_0x40dcff[_0x69e8('0x31')]['length']?_0x40dcff[_0x69e8('0x31')]:_0x4d1324[_0x69e8('0x2d')];_0x40dcff[_0x69e8('0x35')]=qs[_0x69e8('0x36')](_0x455b2c[_0x69e8('0x2e')][_0x69e8('0x36')]);_0x40dcff['where']=qs[_0x69e8('0x30')](_[_0x69e8('0x38')](_0x455b2c[_0x69e8('0x2e')],_0x4d1324[_0x69e8('0x30')]));if(_0x455b2c[_0x69e8('0x2e')][_0x69e8('0x3b')]){_0x40dcff[_0x69e8('0x37')]=_[_0x69e8('0x39')](_0x40dcff[_0x69e8('0x37')],{'$or':_[_0x69e8('0x28')](_0x40dcff[_0x69e8('0x31')],function(_0x735431){var _0x4f3aa1={};_0x4f3aa1[_0x735431]={'$like':'%'+_0x455b2c['query']['filter']+'%'};return _0x4f3aa1;})});}_0x40dcff=_['merge']({},_0x40dcff,_0x455b2c[_0x69e8('0x43')]);return _0x4948b1[_0x69e8('0x4b')](_0x40dcff);}})[_0x69e8('0x3d')](function(_0x1133a2){if(_0x1133a2){_0x3e0863=_0x1133a2['length'];if(!_0x455b2c[_0x69e8('0x2e')]['hasOwnProperty'](_0x69e8('0x34'))){_0x40dcff[_0x69e8('0x1e')]=qs[_0x69e8('0x1e')](_0x455b2c[_0x69e8('0x2e')][_0x69e8('0x1e')]);_0x40dcff[_0x69e8('0x1c')]=qs[_0x69e8('0x1c')](_0x455b2c[_0x69e8('0x2e')][_0x69e8('0x1c')]);}return _0x4948b1[_0x69e8('0x4b')](_0x40dcff);}})['then'](function(_0x5a323f){if(_0x5a323f){return _0x5a323f?{'count':_0x3e0863,'rows':_0x5a323f}:null;}})[_0x69e8('0x3d')](respondWithResult(_0x371530,null))['catch'](handleError(_0x371530,null));};exports['getDescriptions']=function(_0x1329c8,_0x3b22fd,_0x1672ab){var _0x3dfeec={};var _0x3f613c={};var _0x1f8a5f;var _0x103553;return db[_0x69e8('0x29')][_0x69e8('0x49')]({'where':{'id':_0x1329c8[_0x69e8('0x48')]['id']}})[_0x69e8('0x3d')](handleEntityNotFound(_0x3b22fd,null))[_0x69e8('0x3d')](function(_0x2c952c){if(_0x2c952c){_0x1f8a5f=_0x2c952c;_0x3f613c[_0x69e8('0x2d')]=_[_0x69e8('0x2f')](db[_0x69e8('0x4a')][_0x69e8('0x2a')]);_0x3f613c[_0x69e8('0x2e')]=_[_0x69e8('0x2f')](_0x1329c8[_0x69e8('0x2e')]);_0x3f613c[_0x69e8('0x30')]=_[_0x69e8('0x32')](_0x3f613c[_0x69e8('0x2d')],_0x3f613c[_0x69e8('0x2e')]);_0x3dfeec['attributes']=_['intersection'](_0x3f613c[_0x69e8('0x2d')],qs['fields'](_0x1329c8[_0x69e8('0x2e')]['fields']));_0x3dfeec[_0x69e8('0x31')]=_0x3dfeec['attributes'][_0x69e8('0x42')]?_0x3dfeec[_0x69e8('0x31')]:_0x3f613c[_0x69e8('0x2d')];_0x3dfeec[_0x69e8('0x35')]=qs[_0x69e8('0x36')](_0x1329c8[_0x69e8('0x2e')][_0x69e8('0x36')]);_0x3dfeec[_0x69e8('0x37')]=qs[_0x69e8('0x30')](_[_0x69e8('0x38')](_0x1329c8[_0x69e8('0x2e')],_0x3f613c['filters']));if(_0x1329c8[_0x69e8('0x2e')][_0x69e8('0x3b')]){_0x3dfeec[_0x69e8('0x37')]=_[_0x69e8('0x39')](_0x3dfeec['where'],{'$or':_[_0x69e8('0x28')](_0x3dfeec[_0x69e8('0x31')],function(_0x31fe8a){var _0x102793={};_0x102793[_0x31fe8a]={'$like':'%'+_0x1329c8[_0x69e8('0x2e')]['filter']+'%'};return _0x102793;})});}_0x3dfeec=_[_0x69e8('0x39')]({},_0x3dfeec,_0x1329c8[_0x69e8('0x43')]);return _0x1f8a5f[_0x69e8('0x4c')](_0x3dfeec);}})[_0x69e8('0x3d')](function(_0x1c7b3c){if(_0x1c7b3c){_0x103553=_0x1c7b3c[_0x69e8('0x42')];if(!_0x1329c8['query'][_0x69e8('0x4d')](_0x69e8('0x34'))){_0x3dfeec['limit']=qs[_0x69e8('0x1e')](_0x1329c8[_0x69e8('0x2e')]['limit']);_0x3dfeec[_0x69e8('0x1c')]=qs['offset'](_0x1329c8[_0x69e8('0x2e')]['offset']);}return _0x1f8a5f[_0x69e8('0x4c')](_0x3dfeec);}})[_0x69e8('0x3d')](function(_0x1ac05c){if(_0x1ac05c){return _0x1ac05c?{'count':_0x103553,'rows':_0x1ac05c}:null;}})[_0x69e8('0x3d')](respondWithResult(_0x3b22fd,null))[_0x69e8('0x40')](handleError(_0x3b22fd,null));};exports['getFields']=function(_0x25d965,_0x230b5b,_0xdf661){var _0x574107={};var _0x350028={};var _0x192d4b;var _0x42d416;return db[_0x69e8('0x29')]['findOne']({'where':{'id':_0x25d965['params']['id']}})[_0x69e8('0x3d')](handleEntityNotFound(_0x230b5b,null))[_0x69e8('0x3d')](function(_0x208ca2){if(_0x208ca2){_0x192d4b=_0x208ca2;_0x350028[_0x69e8('0x2d')]=_['keys'](db['FreshsalesField'][_0x69e8('0x2a')]);_0x350028[_0x69e8('0x2e')]=_['keys'](_0x25d965[_0x69e8('0x2e')]);_0x350028[_0x69e8('0x30')]=_[_0x69e8('0x32')](_0x350028['model'],_0x350028[_0x69e8('0x2e')]);_0x574107[_0x69e8('0x31')]=_['intersection'](_0x350028['model'],qs[_0x69e8('0x33')](_0x25d965[_0x69e8('0x2e')][_0x69e8('0x33')]));_0x574107['attributes']=_0x574107[_0x69e8('0x31')]['length']?_0x574107['attributes']:_0x350028[_0x69e8('0x2d')];_0x574107[_0x69e8('0x35')]=qs[_0x69e8('0x36')](_0x25d965[_0x69e8('0x2e')][_0x69e8('0x36')]);_0x574107[_0x69e8('0x37')]=qs['filters'](_[_0x69e8('0x38')](_0x25d965[_0x69e8('0x2e')],_0x350028[_0x69e8('0x30')]));if(_0x25d965[_0x69e8('0x2e')][_0x69e8('0x3b')]){_0x574107['where']=_[_0x69e8('0x39')](_0x574107['where'],{'$or':_['map'](_0x574107[_0x69e8('0x31')],function(_0x136ff2){var _0x30bd24={};_0x30bd24[_0x136ff2]={'$like':'%'+_0x25d965[_0x69e8('0x2e')][_0x69e8('0x3b')]+'%'};return _0x30bd24;})});}_0x574107=_[_0x69e8('0x39')]({},_0x574107,_0x25d965['options']);return _0x192d4b[_0x69e8('0x4e')](_0x574107);}})[_0x69e8('0x3d')](function(_0x3d4a54){if(_0x3d4a54){_0x42d416=_0x3d4a54['length'];if(!_0x25d965[_0x69e8('0x2e')][_0x69e8('0x4d')](_0x69e8('0x34'))){_0x574107[_0x69e8('0x1e')]=qs[_0x69e8('0x1e')](_0x25d965[_0x69e8('0x2e')][_0x69e8('0x1e')]);_0x574107[_0x69e8('0x1c')]=qs['offset'](_0x25d965['query'][_0x69e8('0x1c')]);}return _0x192d4b[_0x69e8('0x4e')](_0x574107);}})[_0x69e8('0x3d')](function(_0x4e1517){if(_0x4e1517){return _0x4e1517?{'count':_0x42d416,'rows':_0x4e1517}:null;}})[_0x69e8('0x3d')](respondWithResult(_0x230b5b,null))[_0x69e8('0x40')](handleError(_0x230b5b,null));}; \ No newline at end of file +var _0x927c=['order','filter','getSubjects','getDescriptions','getFields','rimraf','moment','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','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','options','count','findAll','rows','show','params','keys','includeAll','include','find','catch','create','body','findOne','FreshsalesField'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x927c,0x190));var _0xc927=function(_0x44480d,_0x1c8b29){_0x44480d=_0x44480d-0x0;var _0x18063f=_0x927c[_0x44480d];return _0x18063f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc927('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc927('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc927('0x2'));var path=require(_0xc927('0x3'));var sox=require(_0xc927('0x4'));var csv=require(_0xc927('0x5'));var ejs=require(_0xc927('0x6'));var fs=require('fs');var fs_extra=require(_0xc927('0x7'));var _=require(_0xc927('0x8'));var squel=require(_0xc927('0x9'));var crypto=require('crypto');var jsforce=require(_0xc927('0xa'));var deskjs=require(_0xc927('0xb'));var toCsv=require(_0xc927('0x5'));var querystring=require(_0xc927('0xc'));var Papa=require(_0xc927('0xd'));var Redis=require(_0xc927('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc927('0xf'));var as=require(_0xc927('0x10'));var hardwareService=require(_0xc927('0x11'));var logger=require('../../config/logger')(_0xc927('0x12'));var utils=require('../../config/utils');var config=require(_0xc927('0x13'));var licenseUtil=require(_0xc927('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c2d7b,_0x282004){_0x282004=_0x282004||0xcc;return function(_0x18a801){if(_0x18a801){return _0x3c2d7b[_0xc927('0x15')](_0x282004);}return _0x3c2d7b[_0xc927('0x16')](_0x282004)[_0xc927('0x17')]();};}function respondWithResult(_0x577d1f,_0x4389c1){_0x4389c1=_0x4389c1||0xc8;return function(_0x21b212){if(_0x21b212){return _0x577d1f[_0xc927('0x16')](_0x4389c1)[_0xc927('0x18')](_0x21b212);}};}function respondWithFilteredResult(_0xc25525,_0x1fc930){return function(_0x3a7349){if(_0x3a7349){var _0x1a929a=typeof _0x1fc930['offset']===_0xc927('0x19')&&typeof _0x1fc930[_0xc927('0x1a')]===_0xc927('0x19');var _0x5130c9=_0x3a7349['count'];var _0x52cfc0=_0x1a929a?0x0:_0x1fc930[_0xc927('0x1b')];var _0x2caaec=_0x1a929a?_0x3a7349['count']:_0x1fc930[_0xc927('0x1b')]+_0x1fc930['limit'];var _0x1bb3a4;if(_0x2caaec>=_0x5130c9){_0x2caaec=_0x5130c9;_0x1bb3a4=0xc8;}else{_0x1bb3a4=0xce;}_0xc25525[_0xc927('0x16')](_0x1bb3a4);return _0xc25525[_0xc927('0x1c')](_0xc927('0x1d'),_0x52cfc0+'-'+_0x2caaec+'/'+_0x5130c9)[_0xc927('0x18')](_0x3a7349);}return null;};}function patchUpdates(_0x823d10){return function(_0x102441){try{jsonpatch[_0xc927('0x1e')](_0x102441,_0x823d10,!![]);}catch(_0x8a1262){return BPromise['reject'](_0x8a1262);}return _0x102441[_0xc927('0x1f')]();};}function saveUpdates(_0x49f32e,_0x2608f5){return function(_0x59390c){if(_0x59390c){return _0x59390c[_0xc927('0x20')](_0x49f32e)[_0xc927('0x21')](function(_0x5c7eed){return _0x5c7eed;});}return null;};}function removeEntity(_0x3c20b4,_0x305853){return function(_0x3bafdd){if(_0x3bafdd){return _0x3bafdd[_0xc927('0x22')]()['then'](function(){_0x3c20b4[_0xc927('0x16')](0xcc)[_0xc927('0x17')]();});}};}function handleEntityNotFound(_0x58f5cc,_0x4297e7){return function(_0x5ee123){if(!_0x5ee123){_0x58f5cc['sendStatus'](0x194);}return _0x5ee123;};}function handleError(_0x2d1f35,_0x13943e){_0x13943e=_0x13943e||0x1f4;return function(_0x49b2aa){logger[_0xc927('0x23')](_0x49b2aa[_0xc927('0x24')]);if(_0x49b2aa[_0xc927('0x25')]){delete _0x49b2aa['name'];}_0x2d1f35[_0xc927('0x16')](_0x13943e)[_0xc927('0x26')](_0x49b2aa);};}exports[_0xc927('0x27')]=function(_0x365dd4,_0x14637e){var _0x39c5cb={},_0x56e5db={},_0x72ddc8={'count':0x0,'rows':[]};var _0x3cc3b8=_[_0xc927('0x28')](db[_0xc927('0x29')][_0xc927('0x2a')],function(_0x15e848){return{'name':_0x15e848[_0xc927('0x2b')],'type':_0x15e848['type'][_0xc927('0x2c')]};});_0x56e5db[_0xc927('0x2d')]=_[_0xc927('0x28')](_0x3cc3b8,_0xc927('0x25'));_0x56e5db[_0xc927('0x2e')]=_['keys'](_0x365dd4[_0xc927('0x2e')]);_0x56e5db[_0xc927('0x2f')]=_[_0xc927('0x30')](_0x56e5db[_0xc927('0x2d')],_0x56e5db[_0xc927('0x2e')]);_0x39c5cb[_0xc927('0x31')]=_[_0xc927('0x30')](_0x56e5db[_0xc927('0x2d')],qs[_0xc927('0x32')](_0x365dd4['query']['fields']));_0x39c5cb['attributes']=_0x39c5cb[_0xc927('0x31')][_0xc927('0x33')]?_0x39c5cb[_0xc927('0x31')]:_0x56e5db[_0xc927('0x2d')];if(!_0x365dd4[_0xc927('0x2e')][_0xc927('0x34')](_0xc927('0x35'))){_0x39c5cb['limit']=qs['limit'](_0x365dd4[_0xc927('0x2e')][_0xc927('0x1a')]);_0x39c5cb[_0xc927('0x1b')]=qs[_0xc927('0x1b')](_0x365dd4[_0xc927('0x2e')][_0xc927('0x1b')]);}_0x39c5cb['order']=qs[_0xc927('0x36')](_0x365dd4[_0xc927('0x2e')][_0xc927('0x36')]);_0x39c5cb[_0xc927('0x37')]=qs[_0xc927('0x2f')](_[_0xc927('0x38')](_0x365dd4[_0xc927('0x2e')],_0x56e5db[_0xc927('0x2f')]),_0x3cc3b8);if(_0x365dd4[_0xc927('0x2e')]['filter']){_0x39c5cb[_0xc927('0x37')]=_[_0xc927('0x39')](_0x39c5cb[_0xc927('0x37')],{'$or':_['map'](_0x3cc3b8,function(_0x146340){if(_0x146340[_0xc927('0x3a')]!=='VIRTUAL'){var _0x592352={};_0x592352[_0x146340['name']]={'$like':'%'+_0x365dd4[_0xc927('0x2e')]['filter']+'%'};return _0x592352;}})});}_0x39c5cb=_[_0xc927('0x39')]({},_0x39c5cb,_0x365dd4[_0xc927('0x3b')]);var _0xfbe84b={'where':_0x39c5cb[_0xc927('0x37')]};return db['FreshsalesConfiguration'][_0xc927('0x3c')](_0xfbe84b)['then'](function(_0x4df72b){_0x72ddc8[_0xc927('0x3c')]=_0x4df72b;if(_0x365dd4['query']['includeAll']){_0x39c5cb['include']=[{'all':!![]}];}return db[_0xc927('0x29')][_0xc927('0x3d')](_0x39c5cb);})[_0xc927('0x21')](function(_0x163428){_0x72ddc8[_0xc927('0x3e')]=_0x163428;return _0x72ddc8;})['then'](respondWithFilteredResult(_0x14637e,_0x39c5cb))['catch'](handleError(_0x14637e,null));};exports[_0xc927('0x3f')]=function(_0x29a2d9,_0x4af5a9){var _0x4ebc4d={'raw':![],'where':{'id':_0x29a2d9[_0xc927('0x40')]['id']}},_0xaf2a56={};_0xaf2a56[_0xc927('0x2d')]=_[_0xc927('0x41')](db[_0xc927('0x29')][_0xc927('0x2a')]);_0xaf2a56[_0xc927('0x2e')]=_[_0xc927('0x41')](_0x29a2d9[_0xc927('0x2e')]);_0xaf2a56[_0xc927('0x2f')]=_['intersection'](_0xaf2a56[_0xc927('0x2d')],_0xaf2a56[_0xc927('0x2e')]);_0x4ebc4d['attributes']=_[_0xc927('0x30')](_0xaf2a56[_0xc927('0x2d')],qs[_0xc927('0x32')](_0x29a2d9[_0xc927('0x2e')][_0xc927('0x32')]));_0x4ebc4d[_0xc927('0x31')]=_0x4ebc4d[_0xc927('0x31')][_0xc927('0x33')]?_0x4ebc4d[_0xc927('0x31')]:_0xaf2a56[_0xc927('0x2d')];if(_0x29a2d9[_0xc927('0x2e')][_0xc927('0x42')]){_0x4ebc4d[_0xc927('0x43')]=[{'all':!![]}];}_0x4ebc4d=_[_0xc927('0x39')]({},_0x4ebc4d,_0x29a2d9[_0xc927('0x3b')]);return db[_0xc927('0x29')][_0xc927('0x44')](_0x4ebc4d)[_0xc927('0x21')](handleEntityNotFound(_0x4af5a9,null))['then'](respondWithResult(_0x4af5a9,null))[_0xc927('0x45')](handleError(_0x4af5a9,null));};exports[_0xc927('0x46')]=function(_0x4722db,_0x2b0547){return db[_0xc927('0x29')]['create'](_0x4722db[_0xc927('0x47')],{})[_0xc927('0x21')](respondWithResult(_0x2b0547,0xc9))[_0xc927('0x45')](handleError(_0x2b0547,null));};exports['update']=function(_0x5db522,_0x2cbd66){if(_0x5db522[_0xc927('0x47')]['id']){delete _0x5db522['body']['id'];}return db[_0xc927('0x29')]['find']({'where':{'id':_0x5db522[_0xc927('0x40')]['id']}})[_0xc927('0x21')](handleEntityNotFound(_0x2cbd66,null))[_0xc927('0x21')](saveUpdates(_0x5db522['body'],null))[_0xc927('0x21')](respondWithResult(_0x2cbd66,null))[_0xc927('0x45')](handleError(_0x2cbd66,null));};exports[_0xc927('0x22')]=function(_0x50b176,_0x5b3004){return db[_0xc927('0x29')][_0xc927('0x44')]({'where':{'id':_0x50b176[_0xc927('0x40')]['id']}})[_0xc927('0x21')](handleEntityNotFound(_0x5b3004,null))[_0xc927('0x21')](removeEntity(_0x5b3004,null))[_0xc927('0x45')](handleError(_0x5b3004,null));};exports['getSubjects']=function(_0x359f0c,_0x375f3e,_0x4f670b){var _0xc23311={};var _0x1b84e8={};var _0x27c274;var _0x51a2f9;return db[_0xc927('0x29')][_0xc927('0x48')]({'where':{'id':_0x359f0c[_0xc927('0x40')]['id']}})['then'](handleEntityNotFound(_0x375f3e,null))[_0xc927('0x21')](function(_0x3ef13d){if(_0x3ef13d){_0x27c274=_0x3ef13d;_0x1b84e8[_0xc927('0x2d')]=_[_0xc927('0x41')](db[_0xc927('0x49')][_0xc927('0x2a')]);_0x1b84e8[_0xc927('0x2e')]=_[_0xc927('0x41')](_0x359f0c[_0xc927('0x2e')]);_0x1b84e8[_0xc927('0x2f')]=_[_0xc927('0x30')](_0x1b84e8['model'],_0x1b84e8[_0xc927('0x2e')]);_0xc23311[_0xc927('0x31')]=_[_0xc927('0x30')](_0x1b84e8[_0xc927('0x2d')],qs['fields'](_0x359f0c[_0xc927('0x2e')][_0xc927('0x32')]));_0xc23311[_0xc927('0x31')]=_0xc23311[_0xc927('0x31')][_0xc927('0x33')]?_0xc23311[_0xc927('0x31')]:_0x1b84e8[_0xc927('0x2d')];_0xc23311[_0xc927('0x4a')]=qs[_0xc927('0x36')](_0x359f0c['query'][_0xc927('0x36')]);_0xc23311[_0xc927('0x37')]=qs['filters'](_[_0xc927('0x38')](_0x359f0c[_0xc927('0x2e')],_0x1b84e8[_0xc927('0x2f')]));if(_0x359f0c[_0xc927('0x2e')][_0xc927('0x4b')]){_0xc23311[_0xc927('0x37')]=_[_0xc927('0x39')](_0xc23311[_0xc927('0x37')],{'$or':_['map'](_0xc23311['attributes'],function(_0x17f887){var _0x1d9ef8={};_0x1d9ef8[_0x17f887]={'$like':'%'+_0x359f0c[_0xc927('0x2e')][_0xc927('0x4b')]+'%'};return _0x1d9ef8;})});}_0xc23311=_['merge']({},_0xc23311,_0x359f0c[_0xc927('0x3b')]);return _0x27c274[_0xc927('0x4c')](_0xc23311);}})[_0xc927('0x21')](function(_0x7a4f14){if(_0x7a4f14){_0x51a2f9=_0x7a4f14['length'];if(!_0x359f0c['query'][_0xc927('0x34')]('nolimit')){_0xc23311[_0xc927('0x1a')]=qs[_0xc927('0x1a')](_0x359f0c[_0xc927('0x2e')][_0xc927('0x1a')]);_0xc23311[_0xc927('0x1b')]=qs[_0xc927('0x1b')](_0x359f0c[_0xc927('0x2e')][_0xc927('0x1b')]);}return _0x27c274[_0xc927('0x4c')](_0xc23311);}})['then'](function(_0xd1518d){if(_0xd1518d){return _0xd1518d?{'count':_0x51a2f9,'rows':_0xd1518d}:null;}})[_0xc927('0x21')](respondWithResult(_0x375f3e,null))[_0xc927('0x45')](handleError(_0x375f3e,null));};exports[_0xc927('0x4d')]=function(_0x39ad5e,_0x2d6d3b,_0x11fd5c){var _0x1f7d99={};var _0x2b080e={};var _0x2398ab;var _0x229d62;return db[_0xc927('0x29')][_0xc927('0x48')]({'where':{'id':_0x39ad5e['params']['id']}})[_0xc927('0x21')](handleEntityNotFound(_0x2d6d3b,null))['then'](function(_0x1213e0){if(_0x1213e0){_0x2398ab=_0x1213e0;_0x2b080e[_0xc927('0x2d')]=_[_0xc927('0x41')](db[_0xc927('0x49')][_0xc927('0x2a')]);_0x2b080e[_0xc927('0x2e')]=_[_0xc927('0x41')](_0x39ad5e['query']);_0x2b080e[_0xc927('0x2f')]=_['intersection'](_0x2b080e[_0xc927('0x2d')],_0x2b080e[_0xc927('0x2e')]);_0x1f7d99['attributes']=_['intersection'](_0x2b080e['model'],qs['fields'](_0x39ad5e['query'][_0xc927('0x32')]));_0x1f7d99[_0xc927('0x31')]=_0x1f7d99['attributes'][_0xc927('0x33')]?_0x1f7d99[_0xc927('0x31')]:_0x2b080e['model'];_0x1f7d99[_0xc927('0x4a')]=qs[_0xc927('0x36')](_0x39ad5e[_0xc927('0x2e')]['sort']);_0x1f7d99[_0xc927('0x37')]=qs[_0xc927('0x2f')](_[_0xc927('0x38')](_0x39ad5e['query'],_0x2b080e[_0xc927('0x2f')]));if(_0x39ad5e['query'][_0xc927('0x4b')]){_0x1f7d99[_0xc927('0x37')]=_[_0xc927('0x39')](_0x1f7d99[_0xc927('0x37')],{'$or':_[_0xc927('0x28')](_0x1f7d99[_0xc927('0x31')],function(_0xc81524){var _0x17cd6e={};_0x17cd6e[_0xc81524]={'$like':'%'+_0x39ad5e[_0xc927('0x2e')]['filter']+'%'};return _0x17cd6e;})});}_0x1f7d99=_[_0xc927('0x39')]({},_0x1f7d99,_0x39ad5e[_0xc927('0x3b')]);return _0x2398ab[_0xc927('0x4d')](_0x1f7d99);}})['then'](function(_0x4af815){if(_0x4af815){_0x229d62=_0x4af815[_0xc927('0x33')];if(!_0x39ad5e['query'][_0xc927('0x34')](_0xc927('0x35'))){_0x1f7d99[_0xc927('0x1a')]=qs['limit'](_0x39ad5e[_0xc927('0x2e')][_0xc927('0x1a')]);_0x1f7d99[_0xc927('0x1b')]=qs[_0xc927('0x1b')](_0x39ad5e[_0xc927('0x2e')][_0xc927('0x1b')]);}return _0x2398ab['getDescriptions'](_0x1f7d99);}})['then'](function(_0x1e23b7){if(_0x1e23b7){return _0x1e23b7?{'count':_0x229d62,'rows':_0x1e23b7}:null;}})['then'](respondWithResult(_0x2d6d3b,null))['catch'](handleError(_0x2d6d3b,null));};exports[_0xc927('0x4e')]=function(_0x3e8c09,_0x16192b,_0x4cb91c){var _0x4f6606={};var _0x25d0cf={};var _0x29356d;var _0x242cf1;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x3e8c09[_0xc927('0x40')]['id']}})['then'](handleEntityNotFound(_0x16192b,null))['then'](function(_0xa407a7){if(_0xa407a7){_0x29356d=_0xa407a7;_0x25d0cf[_0xc927('0x2d')]=_[_0xc927('0x41')](db[_0xc927('0x49')][_0xc927('0x2a')]);_0x25d0cf[_0xc927('0x2e')]=_[_0xc927('0x41')](_0x3e8c09[_0xc927('0x2e')]);_0x25d0cf[_0xc927('0x2f')]=_[_0xc927('0x30')](_0x25d0cf['model'],_0x25d0cf[_0xc927('0x2e')]);_0x4f6606['attributes']=_[_0xc927('0x30')](_0x25d0cf[_0xc927('0x2d')],qs[_0xc927('0x32')](_0x3e8c09['query']['fields']));_0x4f6606[_0xc927('0x31')]=_0x4f6606[_0xc927('0x31')][_0xc927('0x33')]?_0x4f6606[_0xc927('0x31')]:_0x25d0cf[_0xc927('0x2d')];_0x4f6606['order']=qs[_0xc927('0x36')](_0x3e8c09[_0xc927('0x2e')][_0xc927('0x36')]);_0x4f6606[_0xc927('0x37')]=qs['filters'](_[_0xc927('0x38')](_0x3e8c09[_0xc927('0x2e')],_0x25d0cf[_0xc927('0x2f')]));if(_0x3e8c09[_0xc927('0x2e')][_0xc927('0x4b')]){_0x4f6606['where']=_['merge'](_0x4f6606['where'],{'$or':_[_0xc927('0x28')](_0x4f6606[_0xc927('0x31')],function(_0x360a85){var _0x1980b2={};_0x1980b2[_0x360a85]={'$like':'%'+_0x3e8c09[_0xc927('0x2e')][_0xc927('0x4b')]+'%'};return _0x1980b2;})});}_0x4f6606=_[_0xc927('0x39')]({},_0x4f6606,_0x3e8c09[_0xc927('0x3b')]);return _0x29356d[_0xc927('0x4e')](_0x4f6606);}})[_0xc927('0x21')](function(_0x5ed535){if(_0x5ed535){_0x242cf1=_0x5ed535[_0xc927('0x33')];if(!_0x3e8c09['query'][_0xc927('0x34')](_0xc927('0x35'))){_0x4f6606[_0xc927('0x1a')]=qs[_0xc927('0x1a')](_0x3e8c09[_0xc927('0x2e')][_0xc927('0x1a')]);_0x4f6606[_0xc927('0x1b')]=qs[_0xc927('0x1b')](_0x3e8c09[_0xc927('0x2e')][_0xc927('0x1b')]);}return _0x29356d[_0xc927('0x4e')](_0x4f6606);}})[_0xc927('0x21')](function(_0x406d3c){if(_0x406d3c){return _0x406d3c?{'count':_0x242cf1,'rows':_0x406d3c}:null;}})[_0xc927('0x21')](respondWithResult(_0x16192b,null))['catch'](handleError(_0x16192b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index a049950..9902b57 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 _0x2a9a=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1bd6d9,_0x377aad){var _0x7cadf7=function(_0x38ff81){while(--_0x38ff81){_0x1bd6d9['push'](_0x1bd6d9['shift']());}};_0x7cadf7(++_0x377aad);}(_0x2a9a,0x1a6));var _0xa2a9=function(_0x22678d,_0x14f304){_0x22678d=_0x22678d-0x0;var _0x5d47b1=_0x2a9a[_0x22678d];return _0x5d47b1;};'use strict';var _=require('lodash');var util=require(_0xa2a9('0x0'));var logger=require(_0xa2a9('0x1'))(_0xa2a9('0x2'));var moment=require(_0xa2a9('0x3'));var BPromise=require(_0xa2a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a9('0x5'));var rimraf=require(_0xa2a9('0x6'));var config=require('../../config/environment');var attributes=require(_0xa2a9('0x7'));module[_0xa2a9('0x8')]=function(_0x5ece1e,_0xf06b43){return _0x5ece1e[_0xa2a9('0x9')](_0xa2a9('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a20=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x2a20,0x15c));var _0x02a2=function(_0x1f0e39,_0x57c1bc){_0x1f0e39=_0x1f0e39-0x0;var _0x5a5362=_0x2a20[_0x1f0e39];return _0x5a5362;};'use strict';var _=require(_0x02a2('0x0'));var util=require(_0x02a2('0x1'));var logger=require(_0x02a2('0x2'))(_0x02a2('0x3'));var moment=require('moment');var BPromise=require(_0x02a2('0x4'));var rp=require(_0x02a2('0x5'));var fs=require('fs');var path=require(_0x02a2('0x6'));var rimraf=require(_0x02a2('0x7'));var config=require('../../config/environment');var attributes=require(_0x02a2('0x8'));module[_0x02a2('0x9')]=function(_0xcb776d,_0x3b7d65){return _0xcb776d[_0x02a2('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x02a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 36663d9..542916e 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 _0x44dc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x44dc,0xb5));var _0xc44d=function(_0x17e849,_0x588a88){_0x17e849=_0x17e849-0x0;var _0x35d503=_0x44dc[_0x17e849];return _0x35d503;};'use strict';var _=require(_0xc44d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc44d('0x1'));var rs=require(_0xc44d('0x2'));var fs=require('fs');var Redis=require(_0xc44d('0x3'));var db=require(_0xc44d('0x4'))['db'];var utils=require(_0xc44d('0x5'));var logger=require(_0xc44d('0x6'))(_0xc44d('0x7'));var config=require(_0xc44d('0x8'));var jayson=require(_0xc44d('0x9'));var client=jayson['client'][_0xc44d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f9773,_0x364dae,_0x3fd941){return new BPromise(function(_0x233918,_0x3c8ba2){return client[_0xc44d('0xb')](_0x1f9773,_0x3fd941)[_0xc44d('0xc')](function(_0x57ed2a){logger[_0xc44d('0xd')](_0xc44d('0xe'),_0x364dae,_0xc44d('0xf'));logger[_0xc44d('0x10')](_0xc44d('0x11'),_0x364dae,'request\x20sent',JSON[_0xc44d('0x12')](_0x57ed2a));if(_0x57ed2a[_0xc44d('0x13')]){if(_0x57ed2a['error']['code']===0x1f4){logger[_0xc44d('0x13')](_0xc44d('0xe'),_0x364dae,_0x57ed2a[_0xc44d('0x13')][_0xc44d('0x14')]);return _0x3c8ba2(_0x57ed2a[_0xc44d('0x13')]['message']);}logger[_0xc44d('0x13')](_0xc44d('0xe'),_0x364dae,_0x57ed2a[_0xc44d('0x13')]['message']);return _0x233918(_0x57ed2a[_0xc44d('0x13')][_0xc44d('0x14')]);}else{logger[_0xc44d('0xd')](_0xc44d('0xe'),_0x364dae,_0xc44d('0xf'));_0x233918(_0x57ed2a[_0xc44d('0x15')][_0xc44d('0x14')]);}})[_0xc44d('0x16')](function(_0x4f9fcd){logger['error'](_0xc44d('0xe'),_0x364dae,_0x4f9fcd);_0x3c8ba2(_0x4f9fcd);});});} \ No newline at end of file +var _0xf6ad=['message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x3a631c,_0x5a1655){var _0x27128c=function(_0x1dd6b3){while(--_0x1dd6b3){_0x3a631c['push'](_0x3a631c['shift']());}};_0x27128c(++_0x5a1655);}(_0xf6ad,0xad));var _0xdf6a=function(_0x5ad68b,_0x55228b){_0x5ad68b=_0x5ad68b-0x0;var _0x6bd1e4=_0xf6ad[_0x5ad68b];return _0x6bd1e4;};'use strict';var _=require(_0xdf6a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdf6a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf6a('0x2'));var db=require(_0xdf6a('0x3'))['db'];var utils=require(_0xdf6a('0x4'));var logger=require(_0xdf6a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf6a('0x6')][_0xdf6a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xaa70d0,_0x33650f,_0x3d1b15){return new BPromise(function(_0x208692,_0x3b4794){return client['request'](_0xaa70d0,_0x3d1b15)[_0xdf6a('0x8')](function(_0x37dff1){logger[_0xdf6a('0x9')](_0xdf6a('0xa'),_0x33650f,_0xdf6a('0xb'));logger[_0xdf6a('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x33650f,'request\x20sent',JSON['stringify'](_0x37dff1));if(_0x37dff1[_0xdf6a('0xd')]){if(_0x37dff1['error']['code']===0x1f4){logger[_0xdf6a('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x33650f,_0x37dff1[_0xdf6a('0xd')][_0xdf6a('0xe')]);return _0x3b4794(_0x37dff1[_0xdf6a('0xd')][_0xdf6a('0xe')]);}logger[_0xdf6a('0xd')](_0xdf6a('0xa'),_0x33650f,_0x37dff1[_0xdf6a('0xd')][_0xdf6a('0xe')]);return _0x208692(_0x37dff1['error'][_0xdf6a('0xe')]);}else{logger['info'](_0xdf6a('0xa'),_0x33650f,'request\x20sent');_0x208692(_0x37dff1[_0xdf6a('0xf')][_0xdf6a('0xe')]);}})[_0xdf6a('0x10')](function(_0x10a6f9){logger[_0xdf6a('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x33650f,_0x10a6f9);_0x3b4794(_0x10a6f9);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c08a61e..8f3577b 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 _0x49ac=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','get','/:id','show','put','update','delete'];(function(_0x1894be,_0x4fba20){var _0x4e146e=function(_0x321591){while(--_0x321591){_0x1894be['push'](_0x1894be['shift']());}};_0x4e146e(++_0x4fba20);}(_0x49ac,0x19e));var _0xc49a=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x49ac[_0x3a2118];return _0x1d181d;};'use strict';var multer=require(_0xc49a('0x0'));var util=require(_0xc49a('0x1'));var path=require(_0xc49a('0x2'));var timeout=require(_0xc49a('0x3'));var express=require(_0xc49a('0x4'));var router=express[_0xc49a('0x5')]();var fs_extra=require(_0xc49a('0x6'));var auth=require(_0xc49a('0x7'));var interaction=require(_0xc49a('0x8'));var config=require(_0xc49a('0x9'));var controller=require(_0xc49a('0xa'));router['get']('/',auth[_0xc49a('0xb')](),controller['index']);router[_0xc49a('0xc')](_0xc49a('0xd'),auth[_0xc49a('0xb')](),controller[_0xc49a('0xe')]);router['post']('/',auth[_0xc49a('0xb')](),controller['create']);router[_0xc49a('0xf')]('/:id',auth[_0xc49a('0xb')](),controller[_0xc49a('0x10')]);router[_0xc49a('0x11')](_0xc49a('0xd'),auth[_0xc49a('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0a34=['get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0x0a34,0x12a));var _0x40a3=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x0a34[_0x15c421];return _0x5e5ed5;};'use strict';var multer=require(_0x40a3('0x0'));var util=require(_0x40a3('0x1'));var path=require('path');var timeout=require(_0x40a3('0x2'));var express=require(_0x40a3('0x3'));var router=express[_0x40a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x40a3('0x5'));var interaction=require(_0x40a3('0x6'));var config=require(_0x40a3('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x40a3('0x8')]('/',auth[_0x40a3('0x9')](),controller[_0x40a3('0xa')]);router[_0x40a3('0x8')](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller['show']);router[_0x40a3('0xc')]('/',auth[_0x40a3('0x9')](),controller[_0x40a3('0xd')]);router[_0x40a3('0xe')](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller['update']);router[_0x40a3('0xf')](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller['destroy']);module[_0x40a3('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 846640a..5982613 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 _0x88db=['picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x59afcb,_0x561a4a){var _0x3d4c13=function(_0x20f81f){while(--_0x20f81f){_0x59afcb['push'](_0x59afcb['shift']());}};_0x3d4c13(++_0x561a4a);}(_0x88db,0x83));var _0xb88d=function(_0x536bb0,_0x208801){_0x536bb0=_0x536bb0-0x0;var _0x77feeb=_0x88db[_0x536bb0];return _0x77feeb;};'use strict';var Sequelize=require(_0xb88d('0x0'));module[_0xb88d('0x1')]={'type':{'type':Sequelize[_0xb88d('0x2')]('string',_0xb88d('0x3'),'customVariable','keyValue',_0xb88d('0x4')),'defaultValue':_0xb88d('0x5')},'content':{'type':Sequelize[_0xb88d('0x6')]},'key':{'type':Sequelize[_0xb88d('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xb88d('0x5'),'variable',_0xb88d('0x7'))},'keyContent':{'type':Sequelize[_0xb88d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb88d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb88d('0x6')]}}; \ No newline at end of file +var _0x3d0f=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x3d0f,0x15f));var _0xf3d0=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x3d0f[_0x109371];return _0x4fd858;};'use strict';var Sequelize=require(_0xf3d0('0x0'));module[_0xf3d0('0x1')]={'type':{'type':Sequelize[_0xf3d0('0x2')](_0xf3d0('0x3'),_0xf3d0('0x4'),'customVariable',_0xf3d0('0x5'),_0xf3d0('0x6')),'defaultValue':_0xf3d0('0x3')},'content':{'type':Sequelize[_0xf3d0('0x7')]},'key':{'type':Sequelize[_0xf3d0('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xf3d0('0x7')]},'idField':{'type':Sequelize[_0xf3d0('0x7')]},'nameField':{'type':Sequelize[_0xf3d0('0x7')]},'customField':{'type':Sequelize[_0xf3d0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf3d0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 452a7c0..5e56d6d 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 _0x0000=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','merge','map','VIRTUAL','filter','options','FreshsalesField','findAll','rows','catch','params','include','find','create','body','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2c4cee,_0xed54d6){var _0x4cad54=function(_0x5ee3bd){while(--_0x5ee3bd){_0x2c4cee['push'](_0x2c4cee['shift']());}};_0x4cad54(++_0xed54d6);}(_0x0000,0xc1));var _0x0000=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0000[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0000('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0000('0x1'));var rp=require(_0x0000('0x2'));var moment=require('moment');var BPromise=require(_0x0000('0x3'));var Mustache=require('mustache');var util=require(_0x0000('0x4'));var path=require(_0x0000('0x5'));var sox=require('sox');var csv=require(_0x0000('0x6'));var ejs=require(_0x0000('0x7'));var fs=require('fs');var fs_extra=require(_0x0000('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0000('0x9'));var jsforce=require(_0x0000('0xa'));var deskjs=require(_0x0000('0xb'));var toCsv=require(_0x0000('0x6'));var querystring=require(_0x0000('0xc'));var Papa=require(_0x0000('0xd'));var Redis=require('ioredis');var authService=require(_0x0000('0xe'));var qs=require(_0x0000('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0000('0x10'))(_0x0000('0x11'));var utils=require(_0x0000('0x12'));var config=require(_0x0000('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12b03f,_0x4f1521){_0x4f1521=_0x4f1521||0xcc;return function(_0x2bec3b){if(_0x2bec3b){return _0x12b03f[_0x0000('0x14')](_0x4f1521);}return _0x12b03f[_0x0000('0x15')](_0x4f1521)[_0x0000('0x16')]();};}function respondWithResult(_0x6cbe2d,_0x16fc3d){_0x16fc3d=_0x16fc3d||0xc8;return function(_0x3f3542){if(_0x3f3542){return _0x6cbe2d[_0x0000('0x15')](_0x16fc3d)[_0x0000('0x17')](_0x3f3542);}};}function respondWithFilteredResult(_0x272417,_0x5af63a){return function(_0x47d4e9){if(_0x47d4e9){var _0x3107d9=typeof _0x5af63a[_0x0000('0x18')]===_0x0000('0x19')&&typeof _0x5af63a[_0x0000('0x1a')]===_0x0000('0x19');var _0x3901ff=_0x47d4e9[_0x0000('0x1b')];var _0x249f23=_0x3107d9?0x0:_0x5af63a['offset'];var _0x6eeddd=_0x3107d9?_0x47d4e9[_0x0000('0x1b')]:_0x5af63a[_0x0000('0x18')]+_0x5af63a['limit'];var _0x459c36;if(_0x6eeddd>=_0x3901ff){_0x6eeddd=_0x3901ff;_0x459c36=0xc8;}else{_0x459c36=0xce;}_0x272417[_0x0000('0x15')](_0x459c36);return _0x272417[_0x0000('0x1c')](_0x0000('0x1d'),_0x249f23+'-'+_0x6eeddd+'/'+_0x3901ff)['json'](_0x47d4e9);}return null;};}function patchUpdates(_0x41cab2){return function(_0x1ec5d7){try{jsonpatch[_0x0000('0x1e')](_0x1ec5d7,_0x41cab2,!![]);}catch(_0x408551){return BPromise[_0x0000('0x1f')](_0x408551);}return _0x1ec5d7[_0x0000('0x20')]();};}function saveUpdates(_0x33cd64,_0xf92881){return function(_0x21daad){if(_0x21daad){return _0x21daad[_0x0000('0x21')](_0x33cd64)[_0x0000('0x22')](function(_0x14f3a9){return _0x14f3a9;});}return null;};}function removeEntity(_0xd22807,_0xd88646){return function(_0x18e794){if(_0x18e794){return _0x18e794[_0x0000('0x23')]()[_0x0000('0x22')](function(){_0xd22807[_0x0000('0x15')](0xcc)[_0x0000('0x16')]();});}};}function handleEntityNotFound(_0x4c4dac,_0x33d1cb){return function(_0x1498b3){if(!_0x1498b3){_0x4c4dac['sendStatus'](0x194);}return _0x1498b3;};}function handleError(_0x2bb425,_0x1e065d){_0x1e065d=_0x1e065d||0x1f4;return function(_0xc1aedd){logger[_0x0000('0x24')](_0xc1aedd[_0x0000('0x25')]);if(_0xc1aedd[_0x0000('0x26')]){delete _0xc1aedd['name'];}_0x2bb425[_0x0000('0x15')](_0x1e065d)[_0x0000('0x27')](_0xc1aedd);};}exports['index']=function(_0x14f4f8,_0x1c0e3e){var _0x1f9b3c={},_0x224dad={},_0x281c8a={'count':0x0,'rows':[]};var _0xe14cd9=_['map'](db['FreshsalesField'][_0x0000('0x28')],function(_0x5ca9fc){return{'name':_0x5ca9fc[_0x0000('0x29')],'type':_0x5ca9fc[_0x0000('0x2a')][_0x0000('0x2b')]};});_0x224dad['model']=_['map'](_0xe14cd9,_0x0000('0x26'));_0x224dad[_0x0000('0x2c')]=_[_0x0000('0x2d')](_0x14f4f8[_0x0000('0x2c')]);_0x224dad[_0x0000('0x2e')]=_[_0x0000('0x2f')](_0x224dad[_0x0000('0x30')],_0x224dad[_0x0000('0x2c')]);_0x1f9b3c[_0x0000('0x31')]=_['intersection'](_0x224dad[_0x0000('0x30')],qs['fields'](_0x14f4f8[_0x0000('0x2c')][_0x0000('0x32')]));_0x1f9b3c[_0x0000('0x31')]=_0x1f9b3c['attributes']['length']?_0x1f9b3c[_0x0000('0x31')]:_0x224dad[_0x0000('0x30')];if(!_0x14f4f8['query']['hasOwnProperty']('nolimit')){_0x1f9b3c[_0x0000('0x1a')]=qs[_0x0000('0x1a')](_0x14f4f8[_0x0000('0x2c')][_0x0000('0x1a')]);_0x1f9b3c[_0x0000('0x18')]=qs[_0x0000('0x18')](_0x14f4f8['query'][_0x0000('0x18')]);}_0x1f9b3c[_0x0000('0x33')]=qs[_0x0000('0x34')](_0x14f4f8[_0x0000('0x2c')][_0x0000('0x34')]);_0x1f9b3c[_0x0000('0x35')]=qs[_0x0000('0x2e')](_[_0x0000('0x36')](_0x14f4f8[_0x0000('0x2c')],_0x224dad[_0x0000('0x2e')]),_0xe14cd9);if(_0x14f4f8[_0x0000('0x2c')]['filter']){_0x1f9b3c[_0x0000('0x35')]=_[_0x0000('0x37')](_0x1f9b3c[_0x0000('0x35')],{'$or':_[_0x0000('0x38')](_0xe14cd9,function(_0x343347){if(_0x343347[_0x0000('0x2a')]!==_0x0000('0x39')){var _0x304dc0={};_0x304dc0[_0x343347['name']]={'$like':'%'+_0x14f4f8['query'][_0x0000('0x3a')]+'%'};return _0x304dc0;}})});}_0x1f9b3c=_['merge']({},_0x1f9b3c,_0x14f4f8[_0x0000('0x3b')]);var _0xcde21f={'where':_0x1f9b3c['where']};return db[_0x0000('0x3c')][_0x0000('0x1b')](_0xcde21f)[_0x0000('0x22')](function(_0x4e8cdd){_0x281c8a[_0x0000('0x1b')]=_0x4e8cdd;if(_0x14f4f8[_0x0000('0x2c')]['includeAll']){_0x1f9b3c['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x0000('0x3d')](_0x1f9b3c);})[_0x0000('0x22')](function(_0x3eeac3){_0x281c8a[_0x0000('0x3e')]=_0x3eeac3;return _0x281c8a;})[_0x0000('0x22')](respondWithFilteredResult(_0x1c0e3e,_0x1f9b3c))[_0x0000('0x3f')](handleError(_0x1c0e3e,null));};exports['show']=function(_0x2ba73d,_0x3986b7){var _0x31dc40={'raw':!![],'where':{'id':_0x2ba73d[_0x0000('0x40')]['id']}},_0x2fd968={};_0x2fd968[_0x0000('0x30')]=_[_0x0000('0x2d')](db[_0x0000('0x3c')][_0x0000('0x28')]);_0x2fd968[_0x0000('0x2c')]=_[_0x0000('0x2d')](_0x2ba73d[_0x0000('0x2c')]);_0x2fd968[_0x0000('0x2e')]=_[_0x0000('0x2f')](_0x2fd968[_0x0000('0x30')],_0x2fd968['query']);_0x31dc40['attributes']=_[_0x0000('0x2f')](_0x2fd968[_0x0000('0x30')],qs[_0x0000('0x32')](_0x2ba73d[_0x0000('0x2c')][_0x0000('0x32')]));_0x31dc40[_0x0000('0x31')]=_0x31dc40[_0x0000('0x31')]['length']?_0x31dc40[_0x0000('0x31')]:_0x2fd968[_0x0000('0x30')];if(_0x2ba73d[_0x0000('0x2c')]['includeAll']){_0x31dc40[_0x0000('0x41')]=[{'all':!![]}];}_0x31dc40=_['merge']({},_0x31dc40,_0x2ba73d[_0x0000('0x3b')]);return db[_0x0000('0x3c')][_0x0000('0x42')](_0x31dc40)[_0x0000('0x22')](handleEntityNotFound(_0x3986b7,null))[_0x0000('0x22')](respondWithResult(_0x3986b7,null))[_0x0000('0x3f')](handleError(_0x3986b7,null));};exports[_0x0000('0x43')]=function(_0x537e11,_0x3b024f){return db[_0x0000('0x3c')][_0x0000('0x43')](_0x537e11[_0x0000('0x44')],{})[_0x0000('0x22')](respondWithResult(_0x3b024f,0xc9))[_0x0000('0x3f')](handleError(_0x3b024f,null));};exports[_0x0000('0x21')]=function(_0x393332,_0x3eb414){if(_0x393332[_0x0000('0x44')]['id']){delete _0x393332[_0x0000('0x44')]['id'];}return db[_0x0000('0x3c')]['find']({'where':{'id':_0x393332[_0x0000('0x40')]['id']}})[_0x0000('0x22')](handleEntityNotFound(_0x3eb414,null))[_0x0000('0x22')](saveUpdates(_0x393332[_0x0000('0x44')],null))[_0x0000('0x22')](respondWithResult(_0x3eb414,null))[_0x0000('0x3f')](handleError(_0x3eb414,null));};exports[_0x0000('0x23')]=function(_0x37604d,_0x123cbc){return db[_0x0000('0x3c')][_0x0000('0x42')]({'where':{'id':_0x37604d['params']['id']}})[_0x0000('0x22')](handleEntityNotFound(_0x123cbc,null))[_0x0000('0x22')](removeEntity(_0x123cbc,null))['catch'](handleError(_0x123cbc,null));}; \ No newline at end of file +var _0xdde5=['moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdde5,0x1b8));var _0x5dde=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0xdde5[_0x54381d];return _0x5308a7;};'use strict';var emlformat=require(_0x5dde('0x0'));var rimraf=require(_0x5dde('0x1'));var zipdir=require(_0x5dde('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5dde('0x3'));var moment=require(_0x5dde('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5dde('0x5'));var path=require(_0x5dde('0x6'));var sox=require('sox');var csv=require(_0x5dde('0x7'));var ejs=require(_0x5dde('0x8'));var fs=require('fs');var fs_extra=require(_0x5dde('0x9'));var _=require(_0x5dde('0xa'));var squel=require('squel');var crypto=require(_0x5dde('0xb'));var jsforce=require(_0x5dde('0xc'));var deskjs=require(_0x5dde('0xd'));var toCsv=require(_0x5dde('0x7'));var querystring=require(_0x5dde('0xe'));var Papa=require(_0x5dde('0xf'));var Redis=require(_0x5dde('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5dde('0x11'));var as=require(_0x5dde('0x12'));var hardwareService=require(_0x5dde('0x13'));var logger=require(_0x5dde('0x14'))(_0x5dde('0x15'));var utils=require(_0x5dde('0x16'));var config=require(_0x5dde('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5dde('0x18'))['db'];function respondWithStatusCode(_0x216eb0,_0x56b276){_0x56b276=_0x56b276||0xcc;return function(_0x1fbb61){if(_0x1fbb61){return _0x216eb0['sendStatus'](_0x56b276);}return _0x216eb0[_0x5dde('0x19')](_0x56b276)[_0x5dde('0x1a')]();};}function respondWithResult(_0x1bbb8c,_0x1cc822){_0x1cc822=_0x1cc822||0xc8;return function(_0x4290be){if(_0x4290be){return _0x1bbb8c['status'](_0x1cc822)[_0x5dde('0x1b')](_0x4290be);}};}function respondWithFilteredResult(_0x3e71aa,_0x29252c){return function(_0x29a531){if(_0x29a531){var _0x10670f=typeof _0x29252c['offset']===_0x5dde('0x1c')&&typeof _0x29252c[_0x5dde('0x1d')]==='undefined';var _0x3dddf5=_0x29a531['count'];var _0x4d175d=_0x10670f?0x0:_0x29252c[_0x5dde('0x1e')];var _0x280a7b=_0x10670f?_0x29a531[_0x5dde('0x1f')]:_0x29252c['offset']+_0x29252c[_0x5dde('0x1d')];var _0x1e36f7;if(_0x280a7b>=_0x3dddf5){_0x280a7b=_0x3dddf5;_0x1e36f7=0xc8;}else{_0x1e36f7=0xce;}_0x3e71aa[_0x5dde('0x19')](_0x1e36f7);return _0x3e71aa[_0x5dde('0x20')](_0x5dde('0x21'),_0x4d175d+'-'+_0x280a7b+'/'+_0x3dddf5)[_0x5dde('0x1b')](_0x29a531);}return null;};}function patchUpdates(_0x1abec3){return function(_0x2243c1){try{jsonpatch['apply'](_0x2243c1,_0x1abec3,!![]);}catch(_0x424b5c){return BPromise[_0x5dde('0x22')](_0x424b5c);}return _0x2243c1[_0x5dde('0x23')]();};}function saveUpdates(_0x1f6d92,_0x56eea1){return function(_0x1477a0){if(_0x1477a0){return _0x1477a0[_0x5dde('0x24')](_0x1f6d92)[_0x5dde('0x25')](function(_0x28857f){return _0x28857f;});}return null;};}function removeEntity(_0x4a4344,_0xd68523){return function(_0x2f7b57){if(_0x2f7b57){return _0x2f7b57[_0x5dde('0x26')]()['then'](function(){_0x4a4344['status'](0xcc)[_0x5dde('0x1a')]();});}};}function handleEntityNotFound(_0x328044,_0x4b3df4){return function(_0xaedf5){if(!_0xaedf5){_0x328044[_0x5dde('0x27')](0x194);}return _0xaedf5;};}function handleError(_0x34a04f,_0x2967cd){_0x2967cd=_0x2967cd||0x1f4;return function(_0x539993){logger[_0x5dde('0x28')](_0x539993[_0x5dde('0x29')]);if(_0x539993[_0x5dde('0x2a')]){delete _0x539993[_0x5dde('0x2a')];}_0x34a04f[_0x5dde('0x19')](_0x2967cd)[_0x5dde('0x2b')](_0x539993);};}exports[_0x5dde('0x2c')]=function(_0x35b79b,_0x5e22c3){var _0x73c202={},_0x4861f8={},_0x317e62={'count':0x0,'rows':[]};var _0x3167a9=_[_0x5dde('0x2d')](db[_0x5dde('0x2e')][_0x5dde('0x2f')],function(_0x2a4d7b){return{'name':_0x2a4d7b['fieldName'],'type':_0x2a4d7b[_0x5dde('0x30')]['key']};});_0x4861f8[_0x5dde('0x31')]=_[_0x5dde('0x2d')](_0x3167a9,_0x5dde('0x2a'));_0x4861f8['query']=_[_0x5dde('0x32')](_0x35b79b[_0x5dde('0x33')]);_0x4861f8['filters']=_['intersection'](_0x4861f8['model'],_0x4861f8['query']);_0x73c202[_0x5dde('0x34')]=_[_0x5dde('0x35')](_0x4861f8[_0x5dde('0x31')],qs[_0x5dde('0x36')](_0x35b79b['query']['fields']));_0x73c202[_0x5dde('0x34')]=_0x73c202[_0x5dde('0x34')][_0x5dde('0x37')]?_0x73c202['attributes']:_0x4861f8[_0x5dde('0x31')];if(!_0x35b79b['query'][_0x5dde('0x38')]('nolimit')){_0x73c202['limit']=qs[_0x5dde('0x1d')](_0x35b79b[_0x5dde('0x33')][_0x5dde('0x1d')]);_0x73c202[_0x5dde('0x1e')]=qs[_0x5dde('0x1e')](_0x35b79b[_0x5dde('0x33')][_0x5dde('0x1e')]);}_0x73c202[_0x5dde('0x39')]=qs['sort'](_0x35b79b[_0x5dde('0x33')]['sort']);_0x73c202[_0x5dde('0x3a')]=qs[_0x5dde('0x3b')](_[_0x5dde('0x3c')](_0x35b79b[_0x5dde('0x33')],_0x4861f8['filters']),_0x3167a9);if(_0x35b79b[_0x5dde('0x33')][_0x5dde('0x3d')]){_0x73c202[_0x5dde('0x3a')]=_[_0x5dde('0x3e')](_0x73c202[_0x5dde('0x3a')],{'$or':_[_0x5dde('0x2d')](_0x3167a9,function(_0x31d17d){if(_0x31d17d[_0x5dde('0x30')]!==_0x5dde('0x3f')){var _0x33db06={};_0x33db06[_0x31d17d[_0x5dde('0x2a')]]={'$like':'%'+_0x35b79b['query'][_0x5dde('0x3d')]+'%'};return _0x33db06;}})});}_0x73c202=_[_0x5dde('0x3e')]({},_0x73c202,_0x35b79b[_0x5dde('0x40')]);var _0x116fb4={'where':_0x73c202['where']};return db[_0x5dde('0x2e')][_0x5dde('0x1f')](_0x116fb4)['then'](function(_0x4fbcf9){_0x317e62[_0x5dde('0x1f')]=_0x4fbcf9;if(_0x35b79b['query'][_0x5dde('0x41')]){_0x73c202[_0x5dde('0x42')]=[{'all':!![]}];}return db[_0x5dde('0x2e')][_0x5dde('0x43')](_0x73c202);})['then'](function(_0x46a95b){_0x317e62['rows']=_0x46a95b;return _0x317e62;})['then'](respondWithFilteredResult(_0x5e22c3,_0x73c202))[_0x5dde('0x44')](handleError(_0x5e22c3,null));};exports[_0x5dde('0x45')]=function(_0x4138a5,_0x2d72d5){var _0x58fbb0={'raw':!![],'where':{'id':_0x4138a5[_0x5dde('0x46')]['id']}},_0x32c46e={};_0x32c46e[_0x5dde('0x31')]=_[_0x5dde('0x32')](db['FreshsalesField'][_0x5dde('0x2f')]);_0x32c46e[_0x5dde('0x33')]=_[_0x5dde('0x32')](_0x4138a5[_0x5dde('0x33')]);_0x32c46e[_0x5dde('0x3b')]=_['intersection'](_0x32c46e['model'],_0x32c46e['query']);_0x58fbb0[_0x5dde('0x34')]=_[_0x5dde('0x35')](_0x32c46e['model'],qs['fields'](_0x4138a5[_0x5dde('0x33')][_0x5dde('0x36')]));_0x58fbb0['attributes']=_0x58fbb0[_0x5dde('0x34')][_0x5dde('0x37')]?_0x58fbb0['attributes']:_0x32c46e[_0x5dde('0x31')];if(_0x4138a5[_0x5dde('0x33')][_0x5dde('0x41')]){_0x58fbb0[_0x5dde('0x42')]=[{'all':!![]}];}_0x58fbb0=_[_0x5dde('0x3e')]({},_0x58fbb0,_0x4138a5[_0x5dde('0x40')]);return db[_0x5dde('0x2e')]['find'](_0x58fbb0)[_0x5dde('0x25')](handleEntityNotFound(_0x2d72d5,null))['then'](respondWithResult(_0x2d72d5,null))[_0x5dde('0x44')](handleError(_0x2d72d5,null));};exports[_0x5dde('0x47')]=function(_0x46f4a8,_0x2de177){return db[_0x5dde('0x2e')][_0x5dde('0x47')](_0x46f4a8[_0x5dde('0x48')],{})[_0x5dde('0x25')](respondWithResult(_0x2de177,0xc9))['catch'](handleError(_0x2de177,null));};exports[_0x5dde('0x24')]=function(_0x289bfd,_0x320af7){if(_0x289bfd[_0x5dde('0x48')]['id']){delete _0x289bfd[_0x5dde('0x48')]['id'];}return db[_0x5dde('0x2e')][_0x5dde('0x49')]({'where':{'id':_0x289bfd[_0x5dde('0x46')]['id']}})[_0x5dde('0x25')](handleEntityNotFound(_0x320af7,null))['then'](saveUpdates(_0x289bfd[_0x5dde('0x48')],null))[_0x5dde('0x25')](respondWithResult(_0x320af7,null))[_0x5dde('0x44')](handleError(_0x320af7,null));};exports[_0x5dde('0x26')]=function(_0x1c3588,_0x16c92a){return db[_0x5dde('0x2e')][_0x5dde('0x49')]({'where':{'id':_0x1c3588[_0x5dde('0x46')]['id']}})[_0x5dde('0x25')](handleEntityNotFound(_0x16c92a,null))[_0x5dde('0x25')](removeEntity(_0x16c92a,null))[_0x5dde('0x44')](handleError(_0x16c92a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 555dcbd..c6f8dba 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 _0x608a=['int_freshsales_fields','freshsales_unique_index','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','FreshsalesField'];(function(_0x131c73,_0x53cec3){var _0x186ff1=function(_0x46a180){while(--_0x46a180){_0x131c73['push'](_0x131c73['shift']());}};_0x186ff1(++_0x53cec3);}(_0x608a,0xff));var _0xa608=function(_0x206f00,_0xe37fa9){_0x206f00=_0x206f00-0x0;var _0x3de26b=_0x608a[_0x206f00];return _0x3de26b;};'use strict';var _=require('lodash');var util=require(_0xa608('0x0'));var logger=require(_0xa608('0x1'))('api');var moment=require(_0xa608('0x2'));var BPromise=require(_0xa608('0x3'));var rp=require(_0xa608('0x4'));var fs=require('fs');var path=require(_0xa608('0x5'));var rimraf=require('rimraf');var config=require(_0xa608('0x6'));var attributes=require(_0xa608('0x7'));module['exports']=function(_0x4e24d6,_0x3b0f4e){return _0x4e24d6['define'](_0xa608('0x8'),attributes,{'tableName':_0xa608('0x9'),'paranoid':![],'indexes':[{'name':_0xa608('0xa'),'fields':['idField',_0xa608('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c1=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','lodash'];(function(_0x5c842a,_0x28ab93){var _0xca6f3d=function(_0x37632a){while(--_0x37632a){_0x5c842a['push'](_0x5c842a['shift']());}};_0xca6f3d(++_0x28ab93);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x3ffe30,_0x44ed58){_0x3ffe30=_0x3ffe30-0x0;var _0x4747b3=_0xa5c1[_0x3ffe30];return _0x4747b3;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var logger=require(_0x1a5c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a5c('0x4'));var rimraf=require(_0x1a5c('0x5'));var config=require(_0x1a5c('0x6'));var attributes=require(_0x1a5c('0x7'));module[_0x1a5c('0x8')]=function(_0x3c3558,_0x4d7377){return _0x3c3558[_0x1a5c('0x9')]('FreshsalesField',attributes,{'tableName':_0x1a5c('0xa'),'paranoid':![],'indexes':[{'name':_0x1a5c('0xb'),'fields':[_0x1a5c('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index e4f1b9a..5e11fae 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 _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x51f6a2,_0xd320b){var _0x5ed478=function(_0x6cd399){while(--_0x6cd399){_0x51f6a2['push'](_0x51f6a2['shift']());}};_0x5ed478(++_0xd320b);}(_0x1623,0xab));var _0x3162=function(_0x2d95e4,_0x4d97b6){_0x2d95e4=_0x2d95e4-0x0;var _0x241c7b=_0x1623[_0x2d95e4];return _0x241c7b;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file +var _0xeff8=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5316f2,_0x438da0){var _0x106659=function(_0xc5cba){while(--_0xc5cba){_0x5316f2['push'](_0x5316f2['shift']());}};_0x106659(++_0x438da0);}(_0xeff8,0x186));var _0x8eff=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xeff8[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var moment=require('moment');var BPromise=require(_0x8eff('0x2'));var rs=require(_0x8eff('0x3'));var fs=require('fs');var Redis=require(_0x8eff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eff('0x5'));var logger=require(_0x8eff('0x6'))(_0x8eff('0x7'));var config=require(_0x8eff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8eff('0x9')][_0x8eff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3409bc,_0x323b2,_0x491f01){return new BPromise(function(_0x3fb9ee,_0x19557f){return client[_0x8eff('0xb')](_0x3409bc,_0x491f01)[_0x8eff('0xc')](function(_0x5bd403){logger['info'](_0x8eff('0xd'),_0x323b2,_0x8eff('0xe'));logger[_0x8eff('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x323b2,_0x8eff('0xe'),JSON[_0x8eff('0x10')](_0x5bd403));if(_0x5bd403['error']){if(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x12')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x323b2,_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);return _0x19557f(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);}logger[_0x8eff('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x323b2,_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);return _0x3fb9ee(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);}else{logger[_0x8eff('0x14')](_0x8eff('0xd'),_0x323b2,_0x8eff('0xe'));_0x3fb9ee(_0x5bd403[_0x8eff('0x15')][_0x8eff('0x13')]);}})[_0x8eff('0x16')](function(_0x137344){logger['error'](_0x8eff('0xd'),_0x323b2,_0x137344);_0x19557f(_0x137344);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 25fad82..1ad3384 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(_0x3450fa,_0x22ef9c){var _0x362f2b=function(_0x57a917){while(--_0x57a917){_0x3450fa['push'](_0x3450fa['shift']());}};_0x362f2b(++_0x22ef9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x184a02,_0x19bad1){var _0x48d884=function(_0x4a4064){while(--_0x4a4064){_0x184a02['push'](_0x184a02['shift']());}};_0x48d884(++_0x19bad1);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 81a5ce3..6bba9ec 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 _0xef7e=['integrationTab','newTab','sequelize','STRING','username','ENUM'];(function(_0x35383e,_0x501f9a){var _0x17b8cd=function(_0x2e6591){while(--_0x2e6591){_0x35383e['push'](_0x35383e['shift']());}};_0x17b8cd(++_0x501f9a);}(_0xef7e,0x194));var _0xeef7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xef7e[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xeef7('0x0'));module['exports']={'name':{'type':Sequelize[_0xeef7('0x1')]},'description':{'type':Sequelize[_0xeef7('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xeef7('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xeef7('0x1')]},'clientId':{'type':Sequelize[_0xeef7('0x1')]},'clientSecret':{'type':Sequelize[_0xeef7('0x1')]},'securityToken':{'type':Sequelize[_0xeef7('0x1')]},'serverUrl':{'type':Sequelize[_0xeef7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xeef7('0x3')](_0xeef7('0x4'),_0xeef7('0x5')),'defaultValue':_0xeef7('0x4')}}; \ No newline at end of file +var _0x5323=['newTab','sequelize','exports','STRING','ENUM'];(function(_0x137e04,_0x3c0799){var _0x4c6762=function(_0x45f489){while(--_0x45f489){_0x137e04['push'](_0x137e04['shift']());}};_0x4c6762(++_0x3c0799);}(_0x5323,0x88));var _0x3532=function(_0x243c03,_0x1b778b){_0x243c03=_0x243c03-0x0;var _0x3bdfdf=_0x5323[_0x243c03];return _0x3bdfdf;};'use strict';var Sequelize=require(_0x3532('0x0'));module[_0x3532('0x1')]={'name':{'type':Sequelize[_0x3532('0x2')]},'description':{'type':Sequelize[_0x3532('0x2')]},'username':{'type':Sequelize[_0x3532('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x3532('0x2')]},'password':{'type':Sequelize[_0x3532('0x2')]},'clientId':{'type':Sequelize[_0x3532('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x3532('0x2')]},'serverUrl':{'type':Sequelize[_0x3532('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3532('0x3')]('integrationTab',_0x3532('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a411958..89e3d5b 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 _0x9d84=['remoteUri','slice','substring','lastIndexOf','Connection','concat','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','boolean','email','includes','label','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','then','destroy','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','clientId','clientSecret','username','password','securityToken'];(function(_0x22e9c2,_0x6c7f7f){var _0x1dec3b=function(_0x1c9ceb){while(--_0x1c9ceb){_0x22e9c2['push'](_0x22e9c2['shift']());}};_0x1dec3b(++_0x6c7f7f);}(_0x9d84,0x17b));var _0x49d8=function(_0x358bde,_0xe54c17){_0x358bde=_0x358bde-0x0;var _0x346f1b=_0x9d84[_0x358bde];return _0x346f1b;};'use strict';var emlformat=require(_0x49d8('0x0'));var rimraf=require(_0x49d8('0x1'));var zipdir=require(_0x49d8('0x2'));var jsonpatch=require(_0x49d8('0x3'));var rp=require(_0x49d8('0x4'));var moment=require('moment');var BPromise=require(_0x49d8('0x5'));var Mustache=require(_0x49d8('0x6'));var util=require('util');var path=require(_0x49d8('0x7'));var sox=require('sox');var csv=require(_0x49d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49d8('0x9'));var _=require(_0x49d8('0xa'));var squel=require('squel');var crypto=require(_0x49d8('0xb'));var jsforce=require(_0x49d8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x49d8('0x8'));var querystring=require(_0x49d8('0xd'));var Papa=require(_0x49d8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49d8('0xf'));var as=require(_0x49d8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49d8('0x11'))(_0x49d8('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49d8('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x49d8('0x14'));function respondWithStatusCode(_0x560549,_0x1095ed){_0x1095ed=_0x1095ed||0xcc;return function(_0x2616a6){if(_0x2616a6){return _0x560549[_0x49d8('0x15')](_0x1095ed);}return _0x560549[_0x49d8('0x16')](_0x1095ed)[_0x49d8('0x17')]();};}function respondWithResult(_0x1be677,_0x4878e4){_0x4878e4=_0x4878e4||0xc8;return function(_0x8a14f4){if(_0x8a14f4){return _0x1be677[_0x49d8('0x16')](_0x4878e4)['json'](_0x8a14f4);}};}function respondWithFilteredResult(_0x491b5a,_0x461dd8){return function(_0x187a78){if(_0x187a78){var _0x5d4157=typeof _0x461dd8[_0x49d8('0x18')]==='undefined'&&typeof _0x461dd8[_0x49d8('0x19')]===_0x49d8('0x1a');var _0x1558cb=_0x187a78['count'];var _0x2563e4=_0x5d4157?0x0:_0x461dd8['offset'];var _0x5add74=_0x5d4157?_0x187a78[_0x49d8('0x1b')]:_0x461dd8[_0x49d8('0x18')]+_0x461dd8[_0x49d8('0x19')];var _0x521b20;if(_0x5add74>=_0x1558cb){_0x5add74=_0x1558cb;_0x521b20=0xc8;}else{_0x521b20=0xce;}_0x491b5a[_0x49d8('0x16')](_0x521b20);return _0x491b5a[_0x49d8('0x1c')]('Content-Range',_0x2563e4+'-'+_0x5add74+'/'+_0x1558cb)[_0x49d8('0x1d')](_0x187a78);}return null;};}function patchUpdates(_0x454ab1){return function(_0xf03486){try{jsonpatch[_0x49d8('0x1e')](_0xf03486,_0x454ab1,!![]);}catch(_0x4f1b85){return BPromise[_0x49d8('0x1f')](_0x4f1b85);}return _0xf03486['save']();};}function saveUpdates(_0x4c1b9c,_0x34c3bd){return function(_0x448577){if(_0x448577){return _0x448577['update'](_0x4c1b9c)[_0x49d8('0x20')](function(_0x3c31bd){return _0x3c31bd;});}return null;};}function removeEntity(_0x193c55,_0xc875d3){return function(_0x21f553){if(_0x21f553){return _0x21f553[_0x49d8('0x21')]()['then'](function(){_0x193c55[_0x49d8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4490ef,_0x23ad19){return function(_0x284464){if(!_0x284464){_0x4490ef[_0x49d8('0x15')](0x194);}return _0x284464;};}function handleError(_0x4b4208,_0x1f557a){_0x1f557a=_0x1f557a||0x1f4;return function(_0xb2a6b1){logger[_0x49d8('0x22')](_0xb2a6b1[_0x49d8('0x23')]);if(_0xb2a6b1['name']){delete _0xb2a6b1[_0x49d8('0x24')];}_0x4b4208['status'](_0x1f557a)['send'](_0xb2a6b1);};}exports[_0x49d8('0x25')]=function(_0x1cac0b,_0x13069d){var _0x465337={},_0x1b54a7={},_0x28949f={'count':0x0,'rows':[]};var _0x3235f9=_[_0x49d8('0x26')](db[_0x49d8('0x27')][_0x49d8('0x28')],function(_0x23be9c){return{'name':_0x23be9c[_0x49d8('0x29')],'type':_0x23be9c[_0x49d8('0x2a')]['key']};});_0x1b54a7['model']=_['map'](_0x3235f9,'name');_0x1b54a7['query']=_['keys'](_0x1cac0b['query']);_0x1b54a7['filters']=_['intersection'](_0x1b54a7[_0x49d8('0x2b')],_0x1b54a7[_0x49d8('0x2c')]);_0x465337[_0x49d8('0x2d')]=_[_0x49d8('0x2e')](_0x1b54a7[_0x49d8('0x2b')],qs[_0x49d8('0x2f')](_0x1cac0b[_0x49d8('0x2c')][_0x49d8('0x2f')]));_0x465337[_0x49d8('0x2d')]=_0x465337['attributes'][_0x49d8('0x30')]?_0x465337[_0x49d8('0x2d')]:_0x1b54a7[_0x49d8('0x2b')];if(!_0x1cac0b[_0x49d8('0x2c')][_0x49d8('0x31')](_0x49d8('0x32'))){_0x465337[_0x49d8('0x19')]=qs[_0x49d8('0x19')](_0x1cac0b[_0x49d8('0x2c')][_0x49d8('0x19')]);_0x465337[_0x49d8('0x18')]=qs[_0x49d8('0x18')](_0x1cac0b['query'][_0x49d8('0x18')]);}_0x465337[_0x49d8('0x33')]=qs[_0x49d8('0x34')](_0x1cac0b[_0x49d8('0x2c')]['sort']);_0x465337[_0x49d8('0x35')]=qs[_0x49d8('0x36')](_[_0x49d8('0x37')](_0x1cac0b[_0x49d8('0x2c')],_0x1b54a7[_0x49d8('0x36')]),_0x3235f9);if(_0x1cac0b[_0x49d8('0x2c')][_0x49d8('0x38')]){_0x465337[_0x49d8('0x35')]=_[_0x49d8('0x39')](_0x465337[_0x49d8('0x35')],{'$or':_['map'](_0x3235f9,function(_0x20b7f8){if(_0x20b7f8['type']!==_0x49d8('0x3a')){var _0x41108b={};_0x41108b[_0x20b7f8[_0x49d8('0x24')]]={'$like':'%'+_0x1cac0b[_0x49d8('0x2c')]['filter']+'%'};return _0x41108b;}})});}_0x465337=_[_0x49d8('0x39')]({},_0x465337,_0x1cac0b[_0x49d8('0x3b')]);var _0x3d8999={'where':_0x465337[_0x49d8('0x35')]};return db['SalesforceAccount'][_0x49d8('0x1b')](_0x3d8999)[_0x49d8('0x20')](function(_0x462474){_0x28949f[_0x49d8('0x1b')]=_0x462474;if(_0x1cac0b[_0x49d8('0x2c')][_0x49d8('0x3c')]){_0x465337[_0x49d8('0x3d')]=[{'all':!![]}];}return db[_0x49d8('0x27')][_0x49d8('0x3e')](_0x465337);})[_0x49d8('0x20')](function(_0x28b5a3){_0x28949f['rows']=_0x28b5a3;return _0x28949f;})[_0x49d8('0x20')](respondWithFilteredResult(_0x13069d,_0x465337))[_0x49d8('0x3f')](handleError(_0x13069d,null));};exports['show']=function(_0xe43d9c,_0x17cc96){var _0x16beb8={'raw':![],'where':{'id':_0xe43d9c[_0x49d8('0x40')]['id']}},_0x370669={};_0x370669['model']=_[_0x49d8('0x41')](db[_0x49d8('0x27')][_0x49d8('0x28')]);_0x370669[_0x49d8('0x2c')]=_[_0x49d8('0x41')](_0xe43d9c['query']);_0x370669[_0x49d8('0x36')]=_[_0x49d8('0x2e')](_0x370669['model'],_0x370669['query']);_0x16beb8[_0x49d8('0x2d')]=_[_0x49d8('0x2e')](_0x370669[_0x49d8('0x2b')],qs['fields'](_0xe43d9c[_0x49d8('0x2c')]['fields']));_0x16beb8['attributes']=_0x16beb8[_0x49d8('0x2d')][_0x49d8('0x30')]?_0x16beb8[_0x49d8('0x2d')]:_0x370669[_0x49d8('0x2b')];if(_0xe43d9c[_0x49d8('0x2c')][_0x49d8('0x3c')]){_0x16beb8['include']=[{'all':!![]}];}_0x16beb8=_[_0x49d8('0x39')]({},_0x16beb8,_0xe43d9c[_0x49d8('0x3b')]);return db[_0x49d8('0x27')][_0x49d8('0x42')](_0x16beb8)[_0x49d8('0x20')](handleEntityNotFound(_0x17cc96,null))[_0x49d8('0x20')](respondWithResult(_0x17cc96,null))[_0x49d8('0x3f')](handleError(_0x17cc96,null));};exports[_0x49d8('0x43')]=function(_0x3736dc,_0x1d108f){return db[_0x49d8('0x27')][_0x49d8('0x43')](_0x3736dc[_0x49d8('0x44')],{})['then'](respondWithResult(_0x1d108f,0xc9))[_0x49d8('0x3f')](handleError(_0x1d108f,null));};exports['update']=function(_0x5c3237,_0x59b683){if(_0x5c3237[_0x49d8('0x44')]['id']){delete _0x5c3237[_0x49d8('0x44')]['id'];}return db[_0x49d8('0x27')][_0x49d8('0x42')]({'where':{'id':_0x5c3237['params']['id']}})[_0x49d8('0x20')](handleEntityNotFound(_0x59b683,null))['then'](saveUpdates(_0x5c3237[_0x49d8('0x44')],null))['then'](respondWithResult(_0x59b683,null))[_0x49d8('0x3f')](handleError(_0x59b683,null));};exports[_0x49d8('0x21')]=function(_0x46fed3,_0x10b317){return db[_0x49d8('0x27')][_0x49d8('0x42')]({'where':{'id':_0x46fed3[_0x49d8('0x40')]['id']}})[_0x49d8('0x20')](handleEntityNotFound(_0x10b317,null))[_0x49d8('0x20')](removeEntity(_0x10b317,null))[_0x49d8('0x3f')](handleError(_0x10b317,null));};exports[_0x49d8('0x45')]=function(_0x4bbb70,_0x62d901,_0x5a04f0){var _0x2cce32={};var _0x10d54d={};var _0x424db8;var _0x4b8666;return db[_0x49d8('0x27')][_0x49d8('0x46')]({'where':{'id':_0x4bbb70['params']['id']}})[_0x49d8('0x20')](handleEntityNotFound(_0x62d901,null))[_0x49d8('0x20')](function(_0x364125){if(_0x364125){_0x424db8=_0x364125;_0x10d54d['model']=_[_0x49d8('0x41')](db[_0x49d8('0x47')]['rawAttributes']);_0x10d54d[_0x49d8('0x2c')]=_[_0x49d8('0x41')](_0x4bbb70[_0x49d8('0x2c')]);_0x10d54d['filters']=_[_0x49d8('0x2e')](_0x10d54d[_0x49d8('0x2b')],_0x10d54d['query']);_0x2cce32[_0x49d8('0x2d')]=_[_0x49d8('0x2e')](_0x10d54d[_0x49d8('0x2b')],qs[_0x49d8('0x2f')](_0x4bbb70['query'][_0x49d8('0x2f')]));_0x2cce32['attributes']=_0x2cce32[_0x49d8('0x2d')][_0x49d8('0x30')]?_0x2cce32['attributes']:_0x10d54d[_0x49d8('0x2b')];_0x2cce32[_0x49d8('0x33')]=qs[_0x49d8('0x34')](_0x4bbb70[_0x49d8('0x2c')][_0x49d8('0x34')]);_0x2cce32[_0x49d8('0x35')]=qs[_0x49d8('0x36')](_[_0x49d8('0x37')](_0x4bbb70[_0x49d8('0x2c')],_0x10d54d['filters']));if(_0x4bbb70['query'][_0x49d8('0x38')]){_0x2cce32[_0x49d8('0x35')]=_['merge'](_0x2cce32[_0x49d8('0x35')],{'$or':_['map'](_0x2cce32['attributes'],function(_0x1454dd){var _0x1bce0c={};_0x1bce0c[_0x1454dd]={'$like':'%'+_0x4bbb70[_0x49d8('0x2c')][_0x49d8('0x38')]+'%'};return _0x1bce0c;})});}_0x2cce32=_[_0x49d8('0x39')]({},_0x2cce32,_0x4bbb70['options']);return _0x424db8[_0x49d8('0x45')](_0x2cce32);}})[_0x49d8('0x20')](function(_0x32a484){if(_0x32a484){_0x4b8666=_0x32a484[_0x49d8('0x30')];if(!_0x4bbb70[_0x49d8('0x2c')][_0x49d8('0x31')](_0x49d8('0x32'))){_0x2cce32[_0x49d8('0x19')]=qs[_0x49d8('0x19')](_0x4bbb70['query']['limit']);_0x2cce32[_0x49d8('0x18')]=qs[_0x49d8('0x18')](_0x4bbb70[_0x49d8('0x2c')]['offset']);}return _0x424db8['getConfigurations'](_0x2cce32);}})[_0x49d8('0x20')](function(_0x26777d){if(_0x26777d){return _0x26777d?{'count':_0x4b8666,'rows':_0x26777d}:null;}})[_0x49d8('0x20')](respondWithResult(_0x62d901,null))[_0x49d8('0x3f')](handleError(_0x62d901,null));};exports[_0x49d8('0x48')]=function(_0x4fbcb8,_0x11caa5,_0x1cc8a8){if(_0x4fbcb8[_0x49d8('0x44')]['id']){delete _0x4fbcb8[_0x49d8('0x44')]['id'];}return db[_0x49d8('0x27')][_0x49d8('0x46')]({'where':{'id':_0x4fbcb8['params']['id']}})[_0x49d8('0x20')](handleEntityNotFound(_0x11caa5,null))[_0x49d8('0x20')](function(_0x59fd83){if(_0x59fd83){_0x4fbcb8[_0x49d8('0x44')][_0x49d8('0x49')]=_0x59fd83['id'];_0x4fbcb8['body']['Subjects']=integrations[_0x49d8('0x4a')](_0x4fbcb8[_0x49d8('0x44')][_0x49d8('0x4b')],_0x4fbcb8[_0x49d8('0x44')]['type']);_0x4fbcb8[_0x49d8('0x44')][_0x49d8('0x4c')]=integrations[_0x49d8('0x4d')](_0x4fbcb8[_0x49d8('0x44')]['channel'],_0x4fbcb8[_0x49d8('0x44')][_0x49d8('0x2a')]);return db[_0x49d8('0x47')][_0x49d8('0x43')](_0x4fbcb8[_0x49d8('0x44')],{'include':[{'model':db[_0x49d8('0x4e')],'as':'Subjects'},{'model':db[_0x49d8('0x4e')],'as':_0x49d8('0x4c')}]});}return null;})[_0x49d8('0x20')](respondWithResult(_0x11caa5,null))[_0x49d8('0x3f')](handleError(_0x11caa5,null));};exports['getFields']=function(_0x4cdcf6,_0x55d478,_0x449f7c){var _0x5ccc43;var _0x313fe2='';var _0xfc04c9=_0x49d8('0x4f');return db[_0x49d8('0x27')][_0x49d8('0x46')]({'where':{'id':_0x4cdcf6['params']['id']},'attributes':['id','remoteUri',_0x49d8('0x50'),_0x49d8('0x51'),_0x49d8('0x52'),_0x49d8('0x53'),_0x49d8('0x54')]})[_0x49d8('0x20')](handleEntityNotFound(_0x55d478,null))[_0x49d8('0x20')](function(_0x3f6e04){if(_0x3f6e04){_0x313fe2=_0x3f6e04[_0x49d8('0x55')];var _0x4d63ce=_0x313fe2[_0x49d8('0x56')](-0x1);if(_0x4d63ce==='/'){_0x313fe2=_0x313fe2[_0x49d8('0x57')](0x0,_0x313fe2[_0x49d8('0x58')](_0x4d63ce));}_0x5ccc43=new jsforce[(_0x49d8('0x59'))]({'oauth2':{'loginUrl':_0x313fe2,'clientId':_0x3f6e04[_0x49d8('0x50')],'clientSecret':_0x3f6e04[_0x49d8('0x51')]}});return _0x5ccc43['login'](_0x3f6e04['username'],_0x3f6e04[_0x49d8('0x53')][_0x49d8('0x5a')](_0x3f6e04['securityToken']));}})[_0x49d8('0x20')](function(_0x4cbdf9){if(_0x4cbdf9){if(!_['isNil'](_0x4cdcf6[_0x49d8('0x2c')]['ticketType'])){_0xfc04c9=_0x4cdcf6[_0x49d8('0x2c')][_0x49d8('0x5b')];}return _0x5ccc43[_0x49d8('0x5c')](_0xfc04c9)['describe']();}})[_0x49d8('0x20')](function(_0xb9f4cb){var _0x909d62=[_0x49d8('0x5d'),_0x49d8('0x5e'),_0x49d8('0x5f'),'IsRecurrence',_0x49d8('0x60'),_0x49d8('0x61')];var _0x581327=[_0x49d8('0x62'),_0x49d8('0x63'),_0x49d8('0x64'),_0x49d8('0x65'),_0x49d8('0x66'),'textarea','phone'];if(_0xb9f4cb){_['remove'](_0xb9f4cb[_0x49d8('0x2f')],function(_0x496e56){return _0x909d62[_0x49d8('0x67')](_0x496e56[_0x49d8('0x24')])||!_0x581327[_0x49d8('0x67')](_0x496e56[_0x49d8('0x2a')]);});return{'count':_0xb9f4cb[_0x49d8('0x2f')][_0x49d8('0x30')],'rows':_[_0x49d8('0x26')](_0xb9f4cb[_0x49d8('0x2f')],function(_0x489e7b){return{'id':_0x489e7b[_0x49d8('0x24')],'name':_0x489e7b[_0x49d8('0x68')],'custom':_0x489e7b['custom'],'options':_0x489e7b[_0x49d8('0x69')][_0x49d8('0x30')]>0x0?_['map'](_0x489e7b[_0x49d8('0x69')],function(_0x33a734){return{'name':_0x33a734[_0x49d8('0x68')],'value':_0x33a734[_0x49d8('0x6a')]};}):_0x489e7b[_0x49d8('0x2a')]=='boolean'?[{'name':_0x49d8('0x6b'),'value':_0x49d8('0x6c')},{'name':_0x49d8('0x6d'),'value':_0x49d8('0x6e')}]:[]};})};}})[_0x49d8('0x20')](respondWithResult(_0x55d478,null))[_0x49d8('0x3f')](function(_0x4e7dd1){var _0x3d6601=_0x4cdcf6['query'][_0x49d8('0x6f')]?0x1f4:_0x4e7dd1[_0x49d8('0x70')]||0x1f4;logger[_0x49d8('0x22')](_0x49d8('0x71'),_0x49d8('0x72'),_0x3d6601,JSON[_0x49d8('0x73')](_0x4e7dd1));delete _0x4e7dd1[_0x49d8('0x24')];if(_0x3d6601===0x191){_0x3d6601=0x190;}_0x55d478[_0x49d8('0x16')](_0x3d6601)['send'](_0x4cdcf6[_0x49d8('0x2c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4e7dd1[_0x49d8('0x70')]}:_0x4e7dd1);});}; \ No newline at end of file +var _0xb97c=['Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','clientId','clientSecret','username','securityToken','remoteUri','slice','substring','Connection','password','concat','isNil','ticketType','sobject','describe','ActivityDate','IsRecurrence','picklist','boolean','textarea','phone','remove','includes','label','picklistValues','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','getConfigurations','findOne','addConfiguration','body','AccountId','Subjects','getSubjects','channel'];(function(_0x12eb50,_0x45879d){var _0x8682f6=function(_0x127c0a){while(--_0x127c0a){_0x12eb50['push'](_0x12eb50['shift']());}};_0x8682f6(++_0x45879d);}(_0xb97c,0x19b));var _0xcb97=function(_0x5660a5,_0x2ebdd9){_0x5660a5=_0x5660a5-0x0;var _0x350864=_0xb97c[_0x5660a5];return _0x350864;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcb97('0x0'));var jsonpatch=require(_0xcb97('0x1'));var rp=require(_0xcb97('0x2'));var moment=require(_0xcb97('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcb97('0x4'));var path=require(_0xcb97('0x5'));var sox=require(_0xcb97('0x6'));var csv=require(_0xcb97('0x7'));var ejs=require(_0xcb97('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb97('0x9'));var squel=require(_0xcb97('0xa'));var crypto=require(_0xcb97('0xb'));var jsforce=require(_0xcb97('0xc'));var deskjs=require(_0xcb97('0xd'));var toCsv=require(_0xcb97('0x7'));var querystring=require(_0xcb97('0xe'));var Papa=require(_0xcb97('0xf'));var Redis=require('ioredis');var authService=require(_0xcb97('0x10'));var qs=require(_0xcb97('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb97('0x12'));var logger=require(_0xcb97('0x13'))(_0xcb97('0x14'));var utils=require(_0xcb97('0x15'));var config=require(_0xcb97('0x16'));var licenseUtil=require(_0xcb97('0x17'));var db=require(_0xcb97('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x42abe7,_0x1ea338){_0x1ea338=_0x1ea338||0xcc;return function(_0x199cd4){if(_0x199cd4){return _0x42abe7[_0xcb97('0x19')](_0x1ea338);}return _0x42abe7[_0xcb97('0x1a')](_0x1ea338)['end']();};}function respondWithResult(_0x2cde2c,_0x1a720e){_0x1a720e=_0x1a720e||0xc8;return function(_0x4b5f4a){if(_0x4b5f4a){return _0x2cde2c[_0xcb97('0x1a')](_0x1a720e)[_0xcb97('0x1b')](_0x4b5f4a);}};}function respondWithFilteredResult(_0xb59ca6,_0x323b1d){return function(_0x39aa74){if(_0x39aa74){var _0x597dff=typeof _0x323b1d[_0xcb97('0x1c')]==='undefined'&&typeof _0x323b1d[_0xcb97('0x1d')]===_0xcb97('0x1e');var _0xee193a=_0x39aa74[_0xcb97('0x1f')];var _0x55790a=_0x597dff?0x0:_0x323b1d[_0xcb97('0x1c')];var _0x38a424=_0x597dff?_0x39aa74[_0xcb97('0x1f')]:_0x323b1d[_0xcb97('0x1c')]+_0x323b1d[_0xcb97('0x1d')];var _0x21d6c4;if(_0x38a424>=_0xee193a){_0x38a424=_0xee193a;_0x21d6c4=0xc8;}else{_0x21d6c4=0xce;}_0xb59ca6[_0xcb97('0x1a')](_0x21d6c4);return _0xb59ca6['set'](_0xcb97('0x20'),_0x55790a+'-'+_0x38a424+'/'+_0xee193a)[_0xcb97('0x1b')](_0x39aa74);}return null;};}function patchUpdates(_0x2c8e62){return function(_0x1bfeec){try{jsonpatch[_0xcb97('0x21')](_0x1bfeec,_0x2c8e62,!![]);}catch(_0xdac9b2){return BPromise[_0xcb97('0x22')](_0xdac9b2);}return _0x1bfeec[_0xcb97('0x23')]();};}function saveUpdates(_0x477cb9,_0x1c368d){return function(_0x28953d){if(_0x28953d){return _0x28953d[_0xcb97('0x24')](_0x477cb9)[_0xcb97('0x25')](function(_0x55907c){return _0x55907c;});}return null;};}function removeEntity(_0x207db3,_0x45c599){return function(_0x430ea0){if(_0x430ea0){return _0x430ea0[_0xcb97('0x26')]()[_0xcb97('0x25')](function(){_0x207db3[_0xcb97('0x1a')](0xcc)[_0xcb97('0x27')]();});}};}function handleEntityNotFound(_0x5e5ad4,_0x17b21f){return function(_0x2f3ff5){if(!_0x2f3ff5){_0x5e5ad4[_0xcb97('0x19')](0x194);}return _0x2f3ff5;};}function handleError(_0x41108c,_0x32d14a){_0x32d14a=_0x32d14a||0x1f4;return function(_0x50f5cd){logger[_0xcb97('0x28')](_0x50f5cd[_0xcb97('0x29')]);if(_0x50f5cd[_0xcb97('0x2a')]){delete _0x50f5cd['name'];}_0x41108c[_0xcb97('0x1a')](_0x32d14a)[_0xcb97('0x2b')](_0x50f5cd);};}exports[_0xcb97('0x2c')]=function(_0x1017ce,_0x1d51e9){var _0x517dd8={},_0x323a03={},_0x56c201={'count':0x0,'rows':[]};var _0x4e2dd6=_[_0xcb97('0x2d')](db[_0xcb97('0x2e')][_0xcb97('0x2f')],function(_0x180a43){return{'name':_0x180a43[_0xcb97('0x30')],'type':_0x180a43['type'][_0xcb97('0x31')]};});_0x323a03[_0xcb97('0x32')]=_[_0xcb97('0x2d')](_0x4e2dd6,_0xcb97('0x2a'));_0x323a03[_0xcb97('0x33')]=_[_0xcb97('0x34')](_0x1017ce[_0xcb97('0x33')]);_0x323a03['filters']=_['intersection'](_0x323a03['model'],_0x323a03['query']);_0x517dd8['attributes']=_[_0xcb97('0x35')](_0x323a03[_0xcb97('0x32')],qs[_0xcb97('0x36')](_0x1017ce[_0xcb97('0x33')]['fields']));_0x517dd8[_0xcb97('0x37')]=_0x517dd8[_0xcb97('0x37')]['length']?_0x517dd8[_0xcb97('0x37')]:_0x323a03[_0xcb97('0x32')];if(!_0x1017ce['query'][_0xcb97('0x38')](_0xcb97('0x39'))){_0x517dd8['limit']=qs[_0xcb97('0x1d')](_0x1017ce['query']['limit']);_0x517dd8[_0xcb97('0x1c')]=qs[_0xcb97('0x1c')](_0x1017ce[_0xcb97('0x33')][_0xcb97('0x1c')]);}_0x517dd8[_0xcb97('0x3a')]=qs[_0xcb97('0x3b')](_0x1017ce[_0xcb97('0x33')][_0xcb97('0x3b')]);_0x517dd8[_0xcb97('0x3c')]=qs[_0xcb97('0x3d')](_[_0xcb97('0x3e')](_0x1017ce[_0xcb97('0x33')],_0x323a03['filters']),_0x4e2dd6);if(_0x1017ce[_0xcb97('0x33')][_0xcb97('0x3f')]){_0x517dd8[_0xcb97('0x3c')]=_['merge'](_0x517dd8['where'],{'$or':_[_0xcb97('0x2d')](_0x4e2dd6,function(_0x3f1c6c){if(_0x3f1c6c[_0xcb97('0x40')]!==_0xcb97('0x41')){var _0x294922={};_0x294922[_0x3f1c6c[_0xcb97('0x2a')]]={'$like':'%'+_0x1017ce['query'][_0xcb97('0x3f')]+'%'};return _0x294922;}})});}_0x517dd8=_[_0xcb97('0x42')]({},_0x517dd8,_0x1017ce[_0xcb97('0x43')]);var _0x3b2046={'where':_0x517dd8[_0xcb97('0x3c')]};return db[_0xcb97('0x2e')][_0xcb97('0x1f')](_0x3b2046)['then'](function(_0x47a774){_0x56c201[_0xcb97('0x1f')]=_0x47a774;if(_0x1017ce[_0xcb97('0x33')][_0xcb97('0x44')]){_0x517dd8[_0xcb97('0x45')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xcb97('0x46')](_0x517dd8);})['then'](function(_0xa055ec){_0x56c201['rows']=_0xa055ec;return _0x56c201;})[_0xcb97('0x25')](respondWithFilteredResult(_0x1d51e9,_0x517dd8))[_0xcb97('0x47')](handleError(_0x1d51e9,null));};exports[_0xcb97('0x48')]=function(_0x403c25,_0x414501){var _0x53d0fc={'raw':![],'where':{'id':_0x403c25[_0xcb97('0x49')]['id']}},_0x298362={};_0x298362[_0xcb97('0x32')]=_[_0xcb97('0x34')](db['SalesforceAccount'][_0xcb97('0x2f')]);_0x298362[_0xcb97('0x33')]=_[_0xcb97('0x34')](_0x403c25[_0xcb97('0x33')]);_0x298362[_0xcb97('0x3d')]=_['intersection'](_0x298362[_0xcb97('0x32')],_0x298362[_0xcb97('0x33')]);_0x53d0fc[_0xcb97('0x37')]=_[_0xcb97('0x35')](_0x298362[_0xcb97('0x32')],qs[_0xcb97('0x36')](_0x403c25[_0xcb97('0x33')][_0xcb97('0x36')]));_0x53d0fc[_0xcb97('0x37')]=_0x53d0fc['attributes'][_0xcb97('0x4a')]?_0x53d0fc[_0xcb97('0x37')]:_0x298362[_0xcb97('0x32')];if(_0x403c25['query']['includeAll']){_0x53d0fc[_0xcb97('0x45')]=[{'all':!![]}];}_0x53d0fc=_['merge']({},_0x53d0fc,_0x403c25['options']);return db[_0xcb97('0x2e')][_0xcb97('0x4b')](_0x53d0fc)[_0xcb97('0x25')](handleEntityNotFound(_0x414501,null))[_0xcb97('0x25')](respondWithResult(_0x414501,null))[_0xcb97('0x47')](handleError(_0x414501,null));};exports[_0xcb97('0x4c')]=function(_0x37739c,_0x4f5fcc){return db[_0xcb97('0x2e')][_0xcb97('0x4c')](_0x37739c['body'],{})[_0xcb97('0x25')](respondWithResult(_0x4f5fcc,0xc9))[_0xcb97('0x47')](handleError(_0x4f5fcc,null));};exports[_0xcb97('0x24')]=function(_0x1819fc,_0x406a8d){if(_0x1819fc['body']['id']){delete _0x1819fc['body']['id'];}return db[_0xcb97('0x2e')]['find']({'where':{'id':_0x1819fc[_0xcb97('0x49')]['id']}})['then'](handleEntityNotFound(_0x406a8d,null))['then'](saveUpdates(_0x1819fc['body'],null))[_0xcb97('0x25')](respondWithResult(_0x406a8d,null))[_0xcb97('0x47')](handleError(_0x406a8d,null));};exports[_0xcb97('0x26')]=function(_0x27fa3a,_0x288391){return db['SalesforceAccount']['find']({'where':{'id':_0x27fa3a[_0xcb97('0x49')]['id']}})[_0xcb97('0x25')](handleEntityNotFound(_0x288391,null))[_0xcb97('0x25')](removeEntity(_0x288391,null))['catch'](handleError(_0x288391,null));};exports[_0xcb97('0x4d')]=function(_0x2841ea,_0x517636,_0x4252e3){var _0x30cf39={};var _0x2bff9a={};var _0x2137be;var _0x1f0b4c;return db[_0xcb97('0x2e')][_0xcb97('0x4e')]({'where':{'id':_0x2841ea[_0xcb97('0x49')]['id']}})[_0xcb97('0x25')](handleEntityNotFound(_0x517636,null))[_0xcb97('0x25')](function(_0x46aea6){if(_0x46aea6){_0x2137be=_0x46aea6;_0x2bff9a['model']=_[_0xcb97('0x34')](db['SalesforceConfiguration'][_0xcb97('0x2f')]);_0x2bff9a[_0xcb97('0x33')]=_[_0xcb97('0x34')](_0x2841ea['query']);_0x2bff9a[_0xcb97('0x3d')]=_[_0xcb97('0x35')](_0x2bff9a['model'],_0x2bff9a[_0xcb97('0x33')]);_0x30cf39['attributes']=_[_0xcb97('0x35')](_0x2bff9a['model'],qs[_0xcb97('0x36')](_0x2841ea[_0xcb97('0x33')]['fields']));_0x30cf39[_0xcb97('0x37')]=_0x30cf39[_0xcb97('0x37')][_0xcb97('0x4a')]?_0x30cf39[_0xcb97('0x37')]:_0x2bff9a[_0xcb97('0x32')];_0x30cf39[_0xcb97('0x3a')]=qs['sort'](_0x2841ea['query']['sort']);_0x30cf39[_0xcb97('0x3c')]=qs['filters'](_[_0xcb97('0x3e')](_0x2841ea[_0xcb97('0x33')],_0x2bff9a['filters']));if(_0x2841ea[_0xcb97('0x33')][_0xcb97('0x3f')]){_0x30cf39[_0xcb97('0x3c')]=_[_0xcb97('0x42')](_0x30cf39['where'],{'$or':_[_0xcb97('0x2d')](_0x30cf39[_0xcb97('0x37')],function(_0x5d0825){var _0x2fa4f9={};_0x2fa4f9[_0x5d0825]={'$like':'%'+_0x2841ea[_0xcb97('0x33')][_0xcb97('0x3f')]+'%'};return _0x2fa4f9;})});}_0x30cf39=_[_0xcb97('0x42')]({},_0x30cf39,_0x2841ea[_0xcb97('0x43')]);return _0x2137be[_0xcb97('0x4d')](_0x30cf39);}})[_0xcb97('0x25')](function(_0x3116c1){if(_0x3116c1){_0x1f0b4c=_0x3116c1['length'];if(!_0x2841ea[_0xcb97('0x33')]['hasOwnProperty'](_0xcb97('0x39'))){_0x30cf39[_0xcb97('0x1d')]=qs[_0xcb97('0x1d')](_0x2841ea[_0xcb97('0x33')][_0xcb97('0x1d')]);_0x30cf39[_0xcb97('0x1c')]=qs['offset'](_0x2841ea['query'][_0xcb97('0x1c')]);}return _0x2137be[_0xcb97('0x4d')](_0x30cf39);}})[_0xcb97('0x25')](function(_0x21128e){if(_0x21128e){return _0x21128e?{'count':_0x1f0b4c,'rows':_0x21128e}:null;}})[_0xcb97('0x25')](respondWithResult(_0x517636,null))[_0xcb97('0x47')](handleError(_0x517636,null));};exports[_0xcb97('0x4f')]=function(_0x302115,_0x4d2cd3,_0x5e011c){if(_0x302115[_0xcb97('0x50')]['id']){delete _0x302115[_0xcb97('0x50')]['id'];}return db[_0xcb97('0x2e')][_0xcb97('0x4e')]({'where':{'id':_0x302115[_0xcb97('0x49')]['id']}})[_0xcb97('0x25')](handleEntityNotFound(_0x4d2cd3,null))[_0xcb97('0x25')](function(_0x509be7){if(_0x509be7){_0x302115[_0xcb97('0x50')][_0xcb97('0x51')]=_0x509be7['id'];_0x302115['body'][_0xcb97('0x52')]=integrations[_0xcb97('0x53')](_0x302115['body'][_0xcb97('0x54')],_0x302115[_0xcb97('0x50')][_0xcb97('0x40')]);_0x302115[_0xcb97('0x50')][_0xcb97('0x55')]=integrations[_0xcb97('0x56')](_0x302115['body'][_0xcb97('0x54')],_0x302115[_0xcb97('0x50')][_0xcb97('0x40')]);return db[_0xcb97('0x57')][_0xcb97('0x4c')](_0x302115[_0xcb97('0x50')],{'include':[{'model':db[_0xcb97('0x58')],'as':_0xcb97('0x52')},{'model':db[_0xcb97('0x58')],'as':_0xcb97('0x55')}]});}return null;})[_0xcb97('0x25')](respondWithResult(_0x4d2cd3,null))['catch'](handleError(_0x4d2cd3,null));};exports[_0xcb97('0x59')]=function(_0xc2baa6,_0x441da5,_0x369a5c){var _0x392ea0;var _0x3885cc='';var _0x583d34=_0xcb97('0x5a');return db['SalesforceAccount'][_0xcb97('0x4e')]({'where':{'id':_0xc2baa6['params']['id']},'attributes':['id','remoteUri',_0xcb97('0x5b'),_0xcb97('0x5c'),_0xcb97('0x5d'),'password',_0xcb97('0x5e')]})[_0xcb97('0x25')](handleEntityNotFound(_0x441da5,null))[_0xcb97('0x25')](function(_0x38c729){if(_0x38c729){_0x3885cc=_0x38c729[_0xcb97('0x5f')];var _0xda315d=_0x3885cc[_0xcb97('0x60')](-0x1);if(_0xda315d==='/'){_0x3885cc=_0x3885cc[_0xcb97('0x61')](0x0,_0x3885cc['lastIndexOf'](_0xda315d));}_0x392ea0=new jsforce[(_0xcb97('0x62'))]({'oauth2':{'loginUrl':_0x3885cc,'clientId':_0x38c729[_0xcb97('0x5b')],'clientSecret':_0x38c729['clientSecret']}});return _0x392ea0['login'](_0x38c729['username'],_0x38c729[_0xcb97('0x63')][_0xcb97('0x64')](_0x38c729[_0xcb97('0x5e')]));}})[_0xcb97('0x25')](function(_0x57fcb6){if(_0x57fcb6){if(!_[_0xcb97('0x65')](_0xc2baa6['query'][_0xcb97('0x66')])){_0x583d34=_0xc2baa6[_0xcb97('0x33')]['ticketType'];}return _0x392ea0[_0xcb97('0x67')](_0x583d34)[_0xcb97('0x68')]();}})[_0xcb97('0x25')](function(_0x13eb1c){var _0x13bc06=['OwnerId',_0xcb97('0x69'),'IsReminderSet',_0xcb97('0x6a'),'Subject','Description'];var _0x310330=['string','int',_0xcb97('0x6b'),_0xcb97('0x6c'),'email',_0xcb97('0x6d'),_0xcb97('0x6e')];if(_0x13eb1c){_[_0xcb97('0x6f')](_0x13eb1c['fields'],function(_0x13dac4){return _0x13bc06[_0xcb97('0x70')](_0x13dac4[_0xcb97('0x2a')])||!_0x310330[_0xcb97('0x70')](_0x13dac4[_0xcb97('0x40')]);});return{'count':_0x13eb1c[_0xcb97('0x36')][_0xcb97('0x4a')],'rows':_[_0xcb97('0x2d')](_0x13eb1c[_0xcb97('0x36')],function(_0x1392aa){return{'id':_0x1392aa[_0xcb97('0x2a')],'name':_0x1392aa[_0xcb97('0x71')],'custom':_0x1392aa['custom'],'options':_0x1392aa['picklistValues']['length']>0x0?_[_0xcb97('0x2d')](_0x1392aa[_0xcb97('0x72')],function(_0x5b7d71){return{'name':_0x5b7d71['label'],'value':_0x5b7d71[_0xcb97('0x73')]};}):_0x1392aa[_0xcb97('0x40')]=='boolean'?[{'name':_0xcb97('0x74'),'value':_0xcb97('0x75')},{'name':_0xcb97('0x76'),'value':_0xcb97('0x77')}]:[]};})};}})[_0xcb97('0x25')](respondWithResult(_0x441da5,null))['catch'](function(_0x3b556f){var _0x1c2d65=_0xc2baa6[_0xcb97('0x33')]['test']?0x1f4:_0x3b556f[_0xcb97('0x78')]||0x1f4;logger[_0xcb97('0x28')](_0xcb97('0x79'),'getFields',_0x1c2d65,JSON['stringify'](_0x3b556f));delete _0x3b556f[_0xcb97('0x2a')];if(_0x1c2d65===0x191){_0x1c2d65=0x190;}_0x441da5[_0xcb97('0x1a')](_0x1c2d65)[_0xcb97('0x2b')](_0xc2baa6[_0xcb97('0x33')][_0xcb97('0x7a')]?{'message':_0xcb97('0x7b'),'statusCode':_0x3b556f[_0xcb97('0x78')]}:_0x3b556f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 1c0eb8c..d12338c 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 _0x5d7d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts'];(function(_0x20183c,_0xfdbe61){var _0x1f2316=function(_0x52caf2){while(--_0x52caf2){_0x20183c['push'](_0x20183c['shift']());}};_0x1f2316(++_0xfdbe61);}(_0x5d7d,0x134));var _0xd5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5d7('0x0'));var util=require(_0xd5d7('0x1'));var logger=require(_0xd5d7('0x2'))(_0xd5d7('0x3'));var moment=require(_0xd5d7('0x4'));var BPromise=require(_0xd5d7('0x5'));var rp=require(_0xd5d7('0x6'));var fs=require('fs');var path=require(_0xd5d7('0x7'));var rimraf=require(_0xd5d7('0x8'));var config=require('../../config/environment');var attributes=require(_0xd5d7('0x9'));var integrations=require(_0xd5d7('0xa'));module[_0xd5d7('0xb')]=function(_0x26dc64,_0x2e13fb){return _0x26dc64[_0xd5d7('0xc')]('SalesforceAccount',attributes,{'tableName':_0xd5d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd596=['moment','bluebird','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xd596,0x14c));var _0x6d59=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xd596[_0x425716];return _0x2d39af;};'use strict';var _=require(_0x6d59('0x0'));var util=require(_0x6d59('0x1'));var logger=require(_0x6d59('0x2'))(_0x6d59('0x3'));var moment=require(_0x6d59('0x4'));var BPromise=require(_0x6d59('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d59('0x6'));var rimraf=require('rimraf');var config=require(_0x6d59('0x7'));var attributes=require(_0x6d59('0x8'));var integrations=require(_0x6d59('0x9'));module[_0x6d59('0xa')]=function(_0x51eb95,_0x4349d6){return _0x51eb95[_0x6d59('0xb')](_0x6d59('0xc'),attributes,{'tableName':_0x6d59('0xd'),'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 93dc117..d547d7d 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 _0x8165=['stringify','error','message','SalesforceAccount,\x20%s,\x20%s','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x44ce4b,_0x5ec7da){var _0x5e0872=function(_0x268e20){while(--_0x268e20){_0x44ce4b['push'](_0x44ce4b['shift']());}};_0x5e0872(++_0x5ec7da);}(_0x8165,0x96));var _0x5816=function(_0x12e698,_0x556057){_0x12e698=_0x12e698-0x0;var _0x4c750f=_0x8165[_0x12e698];return _0x4c750f;};'use strict';var _=require(_0x5816('0x0'));var util=require(_0x5816('0x1'));var moment=require(_0x5816('0x2'));var BPromise=require(_0x5816('0x3'));var rs=require(_0x5816('0x4'));var fs=require('fs');var Redis=require(_0x5816('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5816('0x6'));var logger=require(_0x5816('0x7'))(_0x5816('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d28cb,_0x47392f,_0x5a21cd){return new BPromise(function(_0x499f30,_0x5c5ae6){return client[_0x5816('0x9')](_0x2d28cb,_0x5a21cd)[_0x5816('0xa')](function(_0x45deb4){logger[_0x5816('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x47392f,_0x5816('0xc'));logger[_0x5816('0xd')](_0x5816('0xe'),_0x47392f,_0x5816('0xc'),JSON[_0x5816('0xf')](_0x45deb4));if(_0x45deb4['error']){if(_0x45deb4[_0x5816('0x10')]['code']===0x1f4){logger[_0x5816('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x47392f,_0x45deb4['error'][_0x5816('0x11')]);return _0x5c5ae6(_0x45deb4[_0x5816('0x10')]['message']);}logger[_0x5816('0x10')](_0x5816('0x12'),_0x47392f,_0x45deb4[_0x5816('0x10')][_0x5816('0x11')]);return _0x499f30(_0x45deb4[_0x5816('0x10')]['message']);}else{logger['info'](_0x5816('0x12'),_0x47392f,_0x5816('0xc'));_0x499f30(_0x45deb4['result'][_0x5816('0x11')]);}})[_0x5816('0x13')](function(_0x664b41){logger[_0x5816('0x10')](_0x5816('0x12'),_0x47392f,_0x664b41);_0x5c5ae6(_0x664b41);});});}exports[_0x5816('0x14')]=function(_0x3fff0c){var _0x48d645=this;return new Promise(function(_0x483b03,_0x82bf43){return db[_0x5816('0x15')][_0x5816('0x16')]({'raw':_0x3fff0c[_0x5816('0x17')]?_0x3fff0c[_0x5816('0x17')][_0x5816('0x18')]===undefined?!![]:![]:!![],'where':_0x3fff0c[_0x5816('0x17')]?_0x3fff0c[_0x5816('0x17')][_0x5816('0x19')]||null:null,'attributes':_0x3fff0c[_0x5816('0x17')]?_0x3fff0c['options'][_0x5816('0x1a')]||null:null,'limit':_0x3fff0c[_0x5816('0x17')]?_0x3fff0c['options'][_0x5816('0x1b')]||null:null,'include':_0x3fff0c[_0x5816('0x17')]?_0x3fff0c[_0x5816('0x17')][_0x5816('0x1c')]?_[_0x5816('0x1d')](_0x3fff0c[_0x5816('0x17')][_0x5816('0x1c')],function(_0x404cfb){return{'model':db[_0x404cfb[_0x5816('0x1e')]],'as':_0x404cfb['as'],'attributes':_0x404cfb[_0x5816('0x1a')],'include':_0x404cfb['include']?_['map'](_0x404cfb['include'],function(_0x52d892){return{'model':db[_0x52d892[_0x5816('0x1e')]],'as':_0x52d892['as'],'attributes':_0x52d892[_0x5816('0x1a')],'include':_0x52d892[_0x5816('0x1c')]?_[_0x5816('0x1d')](_0x52d892[_0x5816('0x1c')],function(_0x2cdf6f){return{'model':db[_0x2cdf6f[_0x5816('0x1e')]],'as':_0x2cdf6f['as'],'attributes':_0x2cdf6f[_0x5816('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5816('0xa')](function(_0x47f6d2){logger['info'](_0x5816('0x14'),_0x3fff0c);logger[_0x5816('0xd')](_0x5816('0x14'),_0x3fff0c,JSON[_0x5816('0xf')](_0x47f6d2));_0x483b03(_0x47f6d2);})[_0x5816('0x13')](function(_0x2783fb){logger['error'](_0x5816('0x14'),_0x2783fb[_0x5816('0x11')],_0x3fff0c);_0x82bf43(_0x48d645[_0x5816('0x10')](0x1f4,_0x2783fb['message']));});});};exports['ShowSalesforceAccount']=function(_0x2a7822){var _0x3d326d=this;return new Promise(function(_0x4af636,_0x8a9265){return db[_0x5816('0x15')][_0x5816('0x1f')]({'raw':_0x2a7822['options']?_0x2a7822[_0x5816('0x17')][_0x5816('0x18')]===undefined?!![]:![]:!![],'where':_0x2a7822['options']?_0x2a7822[_0x5816('0x17')][_0x5816('0x19')]||null:null,'attributes':_0x2a7822['options']?_0x2a7822[_0x5816('0x17')][_0x5816('0x1a')]||null:null,'include':_0x2a7822[_0x5816('0x17')]?_0x2a7822[_0x5816('0x17')][_0x5816('0x1c')]?_['map'](_0x2a7822[_0x5816('0x17')]['include'],function(_0x6376a7){return{'model':db[_0x6376a7[_0x5816('0x1e')]],'as':_0x6376a7['as'],'attributes':_0x6376a7[_0x5816('0x1a')],'include':_0x6376a7[_0x5816('0x1c')]?_['map'](_0x6376a7[_0x5816('0x1c')],function(_0x129013){return{'model':db[_0x129013[_0x5816('0x1e')]],'as':_0x129013['as'],'attributes':_0x129013[_0x5816('0x1a')],'include':_0x129013['include']?_['map'](_0x129013[_0x5816('0x1c')],function(_0x19589b){return{'model':db[_0x19589b[_0x5816('0x1e')]],'as':_0x19589b['as'],'attributes':_0x19589b[_0x5816('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5816('0xa')](function(_0xe55295){logger[_0x5816('0xb')](_0x5816('0x20'),_0x2a7822);logger['debug'](_0x5816('0x20'),_0x2a7822,JSON['stringify'](_0xe55295));_0x4af636(_0xe55295);})[_0x5816('0x13')](function(_0x54cc88){logger[_0x5816('0x10')](_0x5816('0x20'),_0x54cc88['message'],_0x2a7822);_0x8a9265(_0x3d326d[_0x5816('0x10')](0x1f4,_0x54cc88[_0x5816('0x11')]));});});}; \ No newline at end of file +var _0x7f1c=['options','raw','where','attributes','limit','include','map','model','then','stringify','catch','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','GetSalesforceAccount','SalesforceAccount','findAll'];(function(_0x290b74,_0x4186b7){var _0x2cd1b0=function(_0x168e62){while(--_0x168e62){_0x290b74['push'](_0x290b74['shift']());}};_0x2cd1b0(++_0x4186b7);}(_0x7f1c,0xdf));var _0xc7f1=function(_0x458897,_0x2175c6){_0x458897=_0x458897-0x0;var _0x1dabb9=_0x7f1c[_0x458897];return _0x1dabb9;};'use strict';var _=require('lodash');var util=require(_0xc7f1('0x0'));var moment=require(_0xc7f1('0x1'));var BPromise=require(_0xc7f1('0x2'));var rs=require(_0xc7f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc7f1('0x4'));var logger=require(_0xc7f1('0x5'))(_0xc7f1('0x6'));var config=require(_0xc7f1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc7f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25b4cf,_0xa7e8d2,_0x7db466){return new BPromise(function(_0x10abde,_0x5a5e05){return client[_0xc7f1('0x9')](_0x25b4cf,_0x7db466)['then'](function(_0x5e2c5f){logger[_0xc7f1('0xa')](_0xc7f1('0xb'),_0xa7e8d2,_0xc7f1('0xc'));logger[_0xc7f1('0xd')](_0xc7f1('0xe'),_0xa7e8d2,_0xc7f1('0xc'),JSON['stringify'](_0x5e2c5f));if(_0x5e2c5f['error']){if(_0x5e2c5f['error'][_0xc7f1('0xf')]===0x1f4){logger[_0xc7f1('0x10')](_0xc7f1('0xb'),_0xa7e8d2,_0x5e2c5f['error']['message']);return _0x5a5e05(_0x5e2c5f[_0xc7f1('0x10')][_0xc7f1('0x11')]);}logger[_0xc7f1('0x10')](_0xc7f1('0xb'),_0xa7e8d2,_0x5e2c5f['error'][_0xc7f1('0x11')]);return _0x10abde(_0x5e2c5f[_0xc7f1('0x10')][_0xc7f1('0x11')]);}else{logger[_0xc7f1('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0xa7e8d2,_0xc7f1('0xc'));_0x10abde(_0x5e2c5f[_0xc7f1('0x12')][_0xc7f1('0x11')]);}})['catch'](function(_0x406694){logger[_0xc7f1('0x10')](_0xc7f1('0xb'),_0xa7e8d2,_0x406694);_0x5a5e05(_0x406694);});});}exports[_0xc7f1('0x13')]=function(_0x226f23){var _0x29f1d3=this;return new Promise(function(_0x5e5601,_0x4906ea){return db[_0xc7f1('0x14')][_0xc7f1('0x15')]({'raw':_0x226f23[_0xc7f1('0x16')]?_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x17')]===undefined?!![]:![]:!![],'where':_0x226f23['options']?_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x18')]||null:null,'attributes':_0x226f23[_0xc7f1('0x16')]?_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x19')]||null:null,'limit':_0x226f23[_0xc7f1('0x16')]?_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x1a')]||null:null,'include':_0x226f23[_0xc7f1('0x16')]?_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x1b')]?_[_0xc7f1('0x1c')](_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x1b')],function(_0x38f970){return{'model':db[_0x38f970[_0xc7f1('0x1d')]],'as':_0x38f970['as'],'attributes':_0x38f970[_0xc7f1('0x19')],'include':_0x38f970[_0xc7f1('0x1b')]?_[_0xc7f1('0x1c')](_0x38f970[_0xc7f1('0x1b')],function(_0x25b0f4){return{'model':db[_0x25b0f4['model']],'as':_0x25b0f4['as'],'attributes':_0x25b0f4[_0xc7f1('0x19')],'include':_0x25b0f4[_0xc7f1('0x1b')]?_['map'](_0x25b0f4[_0xc7f1('0x1b')],function(_0x2e8705){return{'model':db[_0x2e8705['model']],'as':_0x2e8705['as'],'attributes':_0x2e8705['attributes']};}):[]};}):[]};}):[]:[]})[_0xc7f1('0x1e')](function(_0x10b1ab){logger[_0xc7f1('0xa')](_0xc7f1('0x13'),_0x226f23);logger[_0xc7f1('0xd')](_0xc7f1('0x13'),_0x226f23,JSON[_0xc7f1('0x1f')](_0x10b1ab));_0x5e5601(_0x10b1ab);})[_0xc7f1('0x20')](function(_0x248963){logger[_0xc7f1('0x10')](_0xc7f1('0x13'),_0x248963[_0xc7f1('0x11')],_0x226f23);_0x4906ea(_0x29f1d3[_0xc7f1('0x10')](0x1f4,_0x248963['message']));});});};exports[_0xc7f1('0x21')]=function(_0x2a28ab){var _0x311d8e=this;return new Promise(function(_0x4b2f16,_0x1a13af){return db['SalesforceAccount'][_0xc7f1('0x22')]({'raw':_0x2a28ab['options']?_0x2a28ab[_0xc7f1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2a28ab['options']?_0x2a28ab[_0xc7f1('0x16')][_0xc7f1('0x18')]||null:null,'attributes':_0x2a28ab['options']?_0x2a28ab[_0xc7f1('0x16')]['attributes']||null:null,'include':_0x2a28ab['options']?_0x2a28ab[_0xc7f1('0x16')][_0xc7f1('0x1b')]?_[_0xc7f1('0x1c')](_0x2a28ab[_0xc7f1('0x16')][_0xc7f1('0x1b')],function(_0xd47b51){return{'model':db[_0xd47b51[_0xc7f1('0x1d')]],'as':_0xd47b51['as'],'attributes':_0xd47b51[_0xc7f1('0x19')],'include':_0xd47b51[_0xc7f1('0x1b')]?_[_0xc7f1('0x1c')](_0xd47b51[_0xc7f1('0x1b')],function(_0x17a64e){return{'model':db[_0x17a64e[_0xc7f1('0x1d')]],'as':_0x17a64e['as'],'attributes':_0x17a64e[_0xc7f1('0x19')],'include':_0x17a64e[_0xc7f1('0x1b')]?_[_0xc7f1('0x1c')](_0x17a64e[_0xc7f1('0x1b')],function(_0x4fa0e8){return{'model':db[_0x4fa0e8[_0xc7f1('0x1d')]],'as':_0x4fa0e8['as'],'attributes':_0x4fa0e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xc7f1('0x1e')](function(_0x5510c4){logger[_0xc7f1('0xa')]('ShowSalesforceAccount',_0x2a28ab);logger[_0xc7f1('0xd')](_0xc7f1('0x21'),_0x2a28ab,JSON[_0xc7f1('0x1f')](_0x5510c4));_0x4b2f16(_0x5510c4);})['catch'](function(_0x301212){logger['error'](_0xc7f1('0x21'),_0x301212[_0xc7f1('0x11')],_0x2a28ab);_0x1a13af(_0x311d8e['error'](0x1f4,_0x301212['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6d8b972..ae60f20 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xdb28,0x106));var _0x8db2=function(_0x1015ad,_0x46dbcd){_0x1015ad=_0x1015ad-0x0;var _0x116fed=_0xdb28[_0x1015ad];return _0x116fed;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xdb28,0x106));var _0x8db2=function(_0x33f761,_0x272b5d){_0x33f761=_0x33f761-0x0;var _0x2d4b2a=_0xdb28[_0x33f761];return _0x2d4b2a;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 991d503..2cb69f3 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 _0xe37a=['account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Task','contact','lead'];(function(_0x2418e0,_0x7215b0){var _0x55ffbf=function(_0x4fc0ec){while(--_0x4fc0ec){_0x2418e0['push'](_0x2418e0['shift']());}};_0x55ffbf(++_0x7215b0);}(_0xe37a,0x14d));var _0xae37=function(_0x231a6e,_0x14630d){_0x231a6e=_0x231a6e-0x0;var _0x148bef=_0xe37a[_0x231a6e];return _0x148bef;};'use strict';var Sequelize=require(_0xae37('0x0'));module[_0xae37('0x1')]={'name':{'type':Sequelize[_0xae37('0x2')]},'description':{'type':Sequelize[_0xae37('0x2')]},'ticketType':{'type':Sequelize[_0xae37('0x3')](_0xae37('0x4'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xae37('0x3')]('contact_lead',_0xae37('0x5'),_0xae37('0x6'),_0xae37('0x7'),_0xae37('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xae37('0x3')](_0xae37('0x9'),_0xae37('0x5'),_0xae37('0x6'),_0xae37('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xae37('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xae37('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xae37('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd408=['account_contact_lead','nothing','account','sequelize','exports','STRING','ENUM','Case','contact_lead','contact','lead'];(function(_0xa7c5e1,_0x5aeccb){var _0x460004=function(_0x2062be){while(--_0x2062be){_0xa7c5e1['push'](_0xa7c5e1['shift']());}};_0x460004(++_0x5aeccb);}(_0xd408,0x1e7));var _0x8d40=function(_0x21695a,_0x16cc85){_0x21695a=_0x21695a-0x0;var _0x4f9ac4=_0xd408[_0x21695a];return _0x4f9ac4;};'use strict';var Sequelize=require(_0x8d40('0x0'));module[_0x8d40('0x1')]={'name':{'type':Sequelize[_0x8d40('0x2')]},'description':{'type':Sequelize[_0x8d40('0x2')]},'ticketType':{'type':Sequelize[_0x8d40('0x3')]('Task',_0x8d40('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x8d40('0x3')](_0x8d40('0x5'),_0x8d40('0x6'),_0x8d40('0x7'),_0x8d40('0x8'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x8d40('0x9'),_0x8d40('0x6'),_0x8d40('0x7'),_0x8d40('0xa')),'defaultValue':_0x8d40('0x7')},'leadId':{'type':Sequelize[_0x8d40('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x8d40('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x8d40('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index a437ca8..310f047 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 _0x0096=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','apply','reject','save','update','then','end','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','options','findAll','show','params','length','include','find','catch','create','body','destroy','findOne','SalesforceField','getFields','nolimit','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2918cb,_0x5ce880){var _0x4c5d63=function(_0x144cf4){while(--_0x144cf4){_0x2918cb['push'](_0x2918cb['shift']());}};_0x4c5d63(++_0x5ce880);}(_0x0096,0x11c));var _0x6009=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0x0096[_0x333798];return _0x389f4e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6009('0x0'));var jsonpatch=require(_0x6009('0x1'));var rp=require(_0x6009('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6009('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x6009('0x4'));var ejs=require(_0x6009('0x5'));var fs=require('fs');var fs_extra=require(_0x6009('0x6'));var _=require('lodash');var squel=require(_0x6009('0x7'));var crypto=require(_0x6009('0x8'));var jsforce=require(_0x6009('0x9'));var deskjs=require(_0x6009('0xa'));var toCsv=require(_0x6009('0x4'));var querystring=require(_0x6009('0xb'));var Papa=require(_0x6009('0xc'));var Redis=require(_0x6009('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6009('0xe'));var hardwareService=require(_0x6009('0xf'));var logger=require(_0x6009('0x10'))(_0x6009('0x11'));var utils=require('../../config/utils');var config=require(_0x6009('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x6009('0x13'))['db'];function respondWithStatusCode(_0x431f02,_0x5b9a3b){_0x5b9a3b=_0x5b9a3b||0xcc;return function(_0x5280c2){if(_0x5280c2){return _0x431f02[_0x6009('0x14')](_0x5b9a3b);}return _0x431f02[_0x6009('0x15')](_0x5b9a3b)['end']();};}function respondWithResult(_0x42c70a,_0x4597e8){_0x4597e8=_0x4597e8||0xc8;return function(_0x1c27f7){if(_0x1c27f7){return _0x42c70a[_0x6009('0x15')](_0x4597e8)[_0x6009('0x16')](_0x1c27f7);}};}function respondWithFilteredResult(_0x3076e6,_0x501915){return function(_0xf4aeac){if(_0xf4aeac){var _0x2fb965=typeof _0x501915['offset']===_0x6009('0x17')&&typeof _0x501915[_0x6009('0x18')]===_0x6009('0x17');var _0x1d0d80=_0xf4aeac['count'];var _0x1d8f22=_0x2fb965?0x0:_0x501915[_0x6009('0x19')];var _0x2aeee6=_0x2fb965?_0xf4aeac[_0x6009('0x1a')]:_0x501915[_0x6009('0x19')]+_0x501915['limit'];var _0x53dc3e;if(_0x2aeee6>=_0x1d0d80){_0x2aeee6=_0x1d0d80;_0x53dc3e=0xc8;}else{_0x53dc3e=0xce;}_0x3076e6['status'](_0x53dc3e);return _0x3076e6[_0x6009('0x1b')]('Content-Range',_0x1d8f22+'-'+_0x2aeee6+'/'+_0x1d0d80)['json'](_0xf4aeac);}return null;};}function patchUpdates(_0x3937c9){return function(_0x22c899){try{jsonpatch[_0x6009('0x1c')](_0x22c899,_0x3937c9,!![]);}catch(_0x3709f6){return BPromise[_0x6009('0x1d')](_0x3709f6);}return _0x22c899[_0x6009('0x1e')]();};}function saveUpdates(_0x4af0c4,_0x96eac3){return function(_0xb6633c){if(_0xb6633c){return _0xb6633c[_0x6009('0x1f')](_0x4af0c4)[_0x6009('0x20')](function(_0x379e2a){return _0x379e2a;});}return null;};}function removeEntity(_0xffcf06,_0x50259c){return function(_0x274bdf){if(_0x274bdf){return _0x274bdf['destroy']()[_0x6009('0x20')](function(){_0xffcf06[_0x6009('0x15')](0xcc)[_0x6009('0x21')]();});}};}function handleEntityNotFound(_0x2a0bdb,_0x13baad){return function(_0x16cb0d){if(!_0x16cb0d){_0x2a0bdb[_0x6009('0x14')](0x194);}return _0x16cb0d;};}function handleError(_0x1645e4,_0x4e2f92){_0x4e2f92=_0x4e2f92||0x1f4;return function(_0x3f7114){logger[_0x6009('0x22')](_0x3f7114[_0x6009('0x23')]);if(_0x3f7114[_0x6009('0x24')]){delete _0x3f7114[_0x6009('0x24')];}_0x1645e4[_0x6009('0x15')](_0x4e2f92)['send'](_0x3f7114);};}exports[_0x6009('0x25')]=function(_0x5cffb,_0x1f4a79){var _0x594a7d={},_0x115e90={},_0x5c5971={'count':0x0,'rows':[]};var _0x5e44ed=_[_0x6009('0x26')](db[_0x6009('0x27')][_0x6009('0x28')],function(_0x39e964){return{'name':_0x39e964['fieldName'],'type':_0x39e964[_0x6009('0x29')][_0x6009('0x2a')]};});_0x115e90[_0x6009('0x2b')]=_[_0x6009('0x26')](_0x5e44ed,_0x6009('0x24'));_0x115e90[_0x6009('0x2c')]=_[_0x6009('0x2d')](_0x5cffb['query']);_0x115e90[_0x6009('0x2e')]=_[_0x6009('0x2f')](_0x115e90[_0x6009('0x2b')],_0x115e90[_0x6009('0x2c')]);_0x594a7d['attributes']=_[_0x6009('0x2f')](_0x115e90['model'],qs['fields'](_0x5cffb[_0x6009('0x2c')][_0x6009('0x30')]));_0x594a7d[_0x6009('0x31')]=_0x594a7d[_0x6009('0x31')]['length']?_0x594a7d[_0x6009('0x31')]:_0x115e90['model'];if(!_0x5cffb[_0x6009('0x2c')][_0x6009('0x32')]('nolimit')){_0x594a7d['limit']=qs[_0x6009('0x18')](_0x5cffb[_0x6009('0x2c')]['limit']);_0x594a7d['offset']=qs['offset'](_0x5cffb[_0x6009('0x2c')][_0x6009('0x19')]);}_0x594a7d[_0x6009('0x33')]=qs['sort'](_0x5cffb[_0x6009('0x2c')][_0x6009('0x34')]);_0x594a7d['where']=qs[_0x6009('0x2e')](_[_0x6009('0x35')](_0x5cffb[_0x6009('0x2c')],_0x115e90[_0x6009('0x2e')]),_0x5e44ed);if(_0x5cffb[_0x6009('0x2c')][_0x6009('0x36')]){_0x594a7d[_0x6009('0x37')]=_[_0x6009('0x38')](_0x594a7d['where'],{'$or':_[_0x6009('0x26')](_0x5e44ed,function(_0x2c944c){if(_0x2c944c['type']!=='VIRTUAL'){var _0x3f6ae2={};_0x3f6ae2[_0x2c944c[_0x6009('0x24')]]={'$like':'%'+_0x5cffb[_0x6009('0x2c')]['filter']+'%'};return _0x3f6ae2;}})});}_0x594a7d=_['merge']({},_0x594a7d,_0x5cffb[_0x6009('0x39')]);var _0x5809f7={'where':_0x594a7d['where']};return db[_0x6009('0x27')]['count'](_0x5809f7)[_0x6009('0x20')](function(_0x3ad4f9){_0x5c5971[_0x6009('0x1a')]=_0x3ad4f9;if(_0x5cffb[_0x6009('0x2c')]['includeAll']){_0x594a7d['include']=[{'all':!![]}];}return db[_0x6009('0x27')][_0x6009('0x3a')](_0x594a7d);})[_0x6009('0x20')](function(_0x87a96){_0x5c5971['rows']=_0x87a96;return _0x5c5971;})['then'](respondWithFilteredResult(_0x1f4a79,_0x594a7d))['catch'](handleError(_0x1f4a79,null));};exports[_0x6009('0x3b')]=function(_0x4a20b0,_0x3624f1){var _0x525256={'raw':![],'where':{'id':_0x4a20b0[_0x6009('0x3c')]['id']}},_0x311171={};_0x311171['model']=_[_0x6009('0x2d')](db[_0x6009('0x27')][_0x6009('0x28')]);_0x311171[_0x6009('0x2c')]=_[_0x6009('0x2d')](_0x4a20b0['query']);_0x311171[_0x6009('0x2e')]=_[_0x6009('0x2f')](_0x311171['model'],_0x311171[_0x6009('0x2c')]);_0x525256[_0x6009('0x31')]=_[_0x6009('0x2f')](_0x311171[_0x6009('0x2b')],qs['fields'](_0x4a20b0[_0x6009('0x2c')]['fields']));_0x525256[_0x6009('0x31')]=_0x525256[_0x6009('0x31')][_0x6009('0x3d')]?_0x525256['attributes']:_0x311171[_0x6009('0x2b')];if(_0x4a20b0[_0x6009('0x2c')]['includeAll']){_0x525256[_0x6009('0x3e')]=[{'all':!![]}];}_0x525256=_[_0x6009('0x38')]({},_0x525256,_0x4a20b0[_0x6009('0x39')]);return db[_0x6009('0x27')][_0x6009('0x3f')](_0x525256)[_0x6009('0x20')](handleEntityNotFound(_0x3624f1,null))[_0x6009('0x20')](respondWithResult(_0x3624f1,null))[_0x6009('0x40')](handleError(_0x3624f1,null));};exports['create']=function(_0x40b38f,_0x49620a){return db[_0x6009('0x27')][_0x6009('0x41')](_0x40b38f['body'],{})[_0x6009('0x20')](respondWithResult(_0x49620a,0xc9))[_0x6009('0x40')](handleError(_0x49620a,null));};exports[_0x6009('0x1f')]=function(_0x9dace,_0x3c2988){if(_0x9dace['body']['id']){delete _0x9dace['body']['id'];}return db[_0x6009('0x27')][_0x6009('0x3f')]({'where':{'id':_0x9dace[_0x6009('0x3c')]['id']}})[_0x6009('0x20')](handleEntityNotFound(_0x3c2988,null))[_0x6009('0x20')](saveUpdates(_0x9dace[_0x6009('0x42')],null))['then'](respondWithResult(_0x3c2988,null))[_0x6009('0x40')](handleError(_0x3c2988,null));};exports[_0x6009('0x43')]=function(_0x5763cb,_0x1a767f){return db[_0x6009('0x27')][_0x6009('0x3f')]({'where':{'id':_0x5763cb[_0x6009('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1a767f,null))[_0x6009('0x20')](removeEntity(_0x1a767f,null))['catch'](handleError(_0x1a767f,null));};exports['getFields']=function(_0x543d3f,_0x46ae32,_0xade267){var _0x4186e8={};var _0x1e8c50={};var _0xc97787;var _0x17a511;return db[_0x6009('0x27')][_0x6009('0x44')]({'where':{'id':_0x543d3f[_0x6009('0x3c')]['id']}})['then'](handleEntityNotFound(_0x46ae32,null))[_0x6009('0x20')](function(_0x35c2b4){if(_0x35c2b4){_0xc97787=_0x35c2b4;_0x1e8c50['model']=_[_0x6009('0x2d')](db[_0x6009('0x45')]['rawAttributes']);_0x1e8c50[_0x6009('0x2c')]=_[_0x6009('0x2d')](_0x543d3f[_0x6009('0x2c')]);_0x1e8c50['filters']=_['intersection'](_0x1e8c50[_0x6009('0x2b')],_0x1e8c50['query']);_0x4186e8[_0x6009('0x31')]=_[_0x6009('0x2f')](_0x1e8c50[_0x6009('0x2b')],qs[_0x6009('0x30')](_0x543d3f[_0x6009('0x2c')]['fields']));_0x4186e8[_0x6009('0x31')]=_0x4186e8[_0x6009('0x31')][_0x6009('0x3d')]?_0x4186e8[_0x6009('0x31')]:_0x1e8c50['model'];_0x4186e8[_0x6009('0x33')]=qs[_0x6009('0x34')](_0x543d3f['query']['sort']);_0x4186e8[_0x6009('0x37')]=qs['filters'](_[_0x6009('0x35')](_0x543d3f[_0x6009('0x2c')],_0x1e8c50[_0x6009('0x2e')]));if(_0x543d3f[_0x6009('0x2c')]['filter']){_0x4186e8['where']=_[_0x6009('0x38')](_0x4186e8[_0x6009('0x37')],{'$or':_[_0x6009('0x26')](_0x4186e8['attributes'],function(_0x360d30){var _0x149cf8={};_0x149cf8[_0x360d30]={'$like':'%'+_0x543d3f[_0x6009('0x2c')][_0x6009('0x36')]+'%'};return _0x149cf8;})});}_0x4186e8=_[_0x6009('0x38')]({},_0x4186e8,_0x543d3f[_0x6009('0x39')]);return _0xc97787[_0x6009('0x46')](_0x4186e8);}})[_0x6009('0x20')](function(_0x4220b3){if(_0x4220b3){_0x17a511=_0x4220b3[_0x6009('0x3d')];if(!_0x543d3f[_0x6009('0x2c')][_0x6009('0x32')](_0x6009('0x47'))){_0x4186e8[_0x6009('0x18')]=qs[_0x6009('0x18')](_0x543d3f[_0x6009('0x2c')][_0x6009('0x18')]);_0x4186e8[_0x6009('0x19')]=qs[_0x6009('0x19')](_0x543d3f[_0x6009('0x2c')][_0x6009('0x19')]);}return _0xc97787[_0x6009('0x46')](_0x4186e8);}})[_0x6009('0x20')](function(_0x2f1d50){if(_0x2f1d50){return _0x2f1d50?{'count':_0x17a511,'rows':_0x2f1d50}:null;}})[_0x6009('0x20')](respondWithResult(_0x46ae32,null))[_0x6009('0x40')](handleError(_0x46ae32,null));};exports['getSubjects']=function(_0x57c2a3,_0x1f2de0,_0x2ada72){var _0x14d03b={};var _0xdf3719={};var _0x4facaa;var _0x22d67b;return db[_0x6009('0x27')][_0x6009('0x44')]({'where':{'id':_0x57c2a3['params']['id']}})[_0x6009('0x20')](handleEntityNotFound(_0x1f2de0,null))['then'](function(_0x3bddc9){if(_0x3bddc9){_0x4facaa=_0x3bddc9;_0xdf3719['model']=_[_0x6009('0x2d')](db[_0x6009('0x45')]['rawAttributes']);_0xdf3719[_0x6009('0x2c')]=_[_0x6009('0x2d')](_0x57c2a3[_0x6009('0x2c')]);_0xdf3719[_0x6009('0x2e')]=_[_0x6009('0x2f')](_0xdf3719[_0x6009('0x2b')],_0xdf3719['query']);_0x14d03b[_0x6009('0x31')]=_[_0x6009('0x2f')](_0xdf3719[_0x6009('0x2b')],qs[_0x6009('0x30')](_0x57c2a3[_0x6009('0x2c')][_0x6009('0x30')]));_0x14d03b[_0x6009('0x31')]=_0x14d03b[_0x6009('0x31')][_0x6009('0x3d')]?_0x14d03b[_0x6009('0x31')]:_0xdf3719[_0x6009('0x2b')];_0x14d03b[_0x6009('0x33')]=qs[_0x6009('0x34')](_0x57c2a3[_0x6009('0x2c')][_0x6009('0x34')]);_0x14d03b[_0x6009('0x37')]=qs['filters'](_[_0x6009('0x35')](_0x57c2a3[_0x6009('0x2c')],_0xdf3719['filters']));if(_0x57c2a3['query'][_0x6009('0x36')]){_0x14d03b[_0x6009('0x37')]=_[_0x6009('0x38')](_0x14d03b[_0x6009('0x37')],{'$or':_[_0x6009('0x26')](_0x14d03b[_0x6009('0x31')],function(_0x22720e){var _0x543469={};_0x543469[_0x22720e]={'$like':'%'+_0x57c2a3[_0x6009('0x2c')][_0x6009('0x36')]+'%'};return _0x543469;})});}_0x14d03b=_[_0x6009('0x38')]({},_0x14d03b,_0x57c2a3['options']);return _0x4facaa[_0x6009('0x48')](_0x14d03b);}})['then'](function(_0xabe984){if(_0xabe984){_0x22d67b=_0xabe984['length'];if(!_0x57c2a3['query'][_0x6009('0x32')]('nolimit')){_0x14d03b[_0x6009('0x18')]=qs[_0x6009('0x18')](_0x57c2a3[_0x6009('0x2c')][_0x6009('0x18')]);_0x14d03b[_0x6009('0x19')]=qs['offset'](_0x57c2a3[_0x6009('0x2c')]['offset']);}return _0x4facaa[_0x6009('0x48')](_0x14d03b);}})[_0x6009('0x20')](function(_0x44f14f){if(_0x44f14f){return _0x44f14f?{'count':_0x22d67b,'rows':_0x44f14f}:null;}})['then'](respondWithResult(_0x1f2de0,null))[_0x6009('0x40')](handleError(_0x1f2de0,null));};exports[_0x6009('0x49')]=function(_0x27ea8d,_0x3e4236,_0x21c3a9){var _0x2350b2={};var _0x1c1efc={};var _0x2e3c90;var _0x155b81;return db[_0x6009('0x27')]['findOne']({'where':{'id':_0x27ea8d['params']['id']}})[_0x6009('0x20')](handleEntityNotFound(_0x3e4236,null))[_0x6009('0x20')](function(_0x4b15f0){if(_0x4b15f0){_0x2e3c90=_0x4b15f0;_0x1c1efc['model']=_[_0x6009('0x2d')](db[_0x6009('0x45')][_0x6009('0x28')]);_0x1c1efc[_0x6009('0x2c')]=_['keys'](_0x27ea8d[_0x6009('0x2c')]);_0x1c1efc[_0x6009('0x2e')]=_[_0x6009('0x2f')](_0x1c1efc[_0x6009('0x2b')],_0x1c1efc[_0x6009('0x2c')]);_0x2350b2[_0x6009('0x31')]=_[_0x6009('0x2f')](_0x1c1efc[_0x6009('0x2b')],qs['fields'](_0x27ea8d[_0x6009('0x2c')][_0x6009('0x30')]));_0x2350b2['attributes']=_0x2350b2[_0x6009('0x31')][_0x6009('0x3d')]?_0x2350b2['attributes']:_0x1c1efc[_0x6009('0x2b')];_0x2350b2[_0x6009('0x33')]=qs[_0x6009('0x34')](_0x27ea8d[_0x6009('0x2c')]['sort']);_0x2350b2[_0x6009('0x37')]=qs[_0x6009('0x2e')](_[_0x6009('0x35')](_0x27ea8d[_0x6009('0x2c')],_0x1c1efc[_0x6009('0x2e')]));if(_0x27ea8d['query'][_0x6009('0x36')]){_0x2350b2[_0x6009('0x37')]=_[_0x6009('0x38')](_0x2350b2[_0x6009('0x37')],{'$or':_['map'](_0x2350b2['attributes'],function(_0x2c9374){var _0x37c954={};_0x37c954[_0x2c9374]={'$like':'%'+_0x27ea8d[_0x6009('0x2c')][_0x6009('0x36')]+'%'};return _0x37c954;})});}_0x2350b2=_[_0x6009('0x38')]({},_0x2350b2,_0x27ea8d['options']);return _0x2e3c90[_0x6009('0x49')](_0x2350b2);}})[_0x6009('0x20')](function(_0x3f7766){if(_0x3f7766){_0x155b81=_0x3f7766['length'];if(!_0x27ea8d[_0x6009('0x2c')]['hasOwnProperty'](_0x6009('0x47'))){_0x2350b2['limit']=qs['limit'](_0x27ea8d[_0x6009('0x2c')][_0x6009('0x18')]);_0x2350b2[_0x6009('0x19')]=qs['offset'](_0x27ea8d[_0x6009('0x2c')][_0x6009('0x19')]);}return _0x2e3c90[_0x6009('0x49')](_0x2350b2);}})['then'](function(_0x3e54ac){if(_0x3e54ac){return _0x3e54ac?{'count':_0x155b81,'rows':_0x3e54ac}:null;}})[_0x6009('0x20')](respondWithResult(_0x3e4236,null))[_0x6009('0x40')](handleError(_0x3e4236,null));}; \ No newline at end of file +var _0x88c8=['index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','update','destroy','getFields','findOne','SalesforceField','filter','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name'];(function(_0x1c8522,_0x29b58e){var _0x478fd9=function(_0x4bb05f){while(--_0x4bb05f){_0x1c8522['push'](_0x1c8522['shift']());}};_0x478fd9(++_0x29b58e);}(_0x88c8,0x117));var _0x888c=function(_0x4fd2bb,_0x172b61){_0x4fd2bb=_0x4fd2bb-0x0;var _0x10b87b=_0x88c8[_0x4fd2bb];return _0x10b87b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x888c('0x0'));var zipdir=require(_0x888c('0x1'));var jsonpatch=require(_0x888c('0x2'));var rp=require(_0x888c('0x3'));var moment=require(_0x888c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x888c('0x5'));var util=require(_0x888c('0x6'));var path=require(_0x888c('0x7'));var sox=require(_0x888c('0x8'));var csv=require('to-csv');var ejs=require(_0x888c('0x9'));var fs=require('fs');var fs_extra=require(_0x888c('0xa'));var _=require(_0x888c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x888c('0xc'));var deskjs=require(_0x888c('0xd'));var toCsv=require(_0x888c('0xe'));var querystring=require(_0x888c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x888c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x888c('0x11'))(_0x888c('0x12'));var utils=require('../../config/utils');var config=require(_0x888c('0x13'));var licenseUtil=require(_0x888c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35f2d5,_0x33a875){_0x33a875=_0x33a875||0xcc;return function(_0x56d9df){if(_0x56d9df){return _0x35f2d5[_0x888c('0x15')](_0x33a875);}return _0x35f2d5[_0x888c('0x16')](_0x33a875)[_0x888c('0x17')]();};}function respondWithResult(_0x3a9071,_0x176860){_0x176860=_0x176860||0xc8;return function(_0x119fe6){if(_0x119fe6){return _0x3a9071[_0x888c('0x16')](_0x176860)[_0x888c('0x18')](_0x119fe6);}};}function respondWithFilteredResult(_0x56263c,_0x1cde30){return function(_0xc25010){if(_0xc25010){var _0x4e0aee=typeof _0x1cde30[_0x888c('0x19')]==='undefined'&&typeof _0x1cde30[_0x888c('0x1a')]==='undefined';var _0x2e070=_0xc25010[_0x888c('0x1b')];var _0x206d17=_0x4e0aee?0x0:_0x1cde30[_0x888c('0x19')];var _0x20807e=_0x4e0aee?_0xc25010['count']:_0x1cde30[_0x888c('0x19')]+_0x1cde30[_0x888c('0x1a')];var _0xdb1277;if(_0x20807e>=_0x2e070){_0x20807e=_0x2e070;_0xdb1277=0xc8;}else{_0xdb1277=0xce;}_0x56263c[_0x888c('0x16')](_0xdb1277);return _0x56263c[_0x888c('0x1c')](_0x888c('0x1d'),_0x206d17+'-'+_0x20807e+'/'+_0x2e070)[_0x888c('0x18')](_0xc25010);}return null;};}function patchUpdates(_0x3740fc){return function(_0x3088f0){try{jsonpatch[_0x888c('0x1e')](_0x3088f0,_0x3740fc,!![]);}catch(_0x30488f){return BPromise[_0x888c('0x1f')](_0x30488f);}return _0x3088f0[_0x888c('0x20')]();};}function saveUpdates(_0x2e4482,_0x5b05d4){return function(_0x4bfb6d){if(_0x4bfb6d){return _0x4bfb6d['update'](_0x2e4482)[_0x888c('0x21')](function(_0x52221d){return _0x52221d;});}return null;};}function removeEntity(_0x4110f0,_0x27d86b){return function(_0x38ef33){if(_0x38ef33){return _0x38ef33['destroy']()[_0x888c('0x21')](function(){_0x4110f0[_0x888c('0x16')](0xcc)[_0x888c('0x17')]();});}};}function handleEntityNotFound(_0x4d992a,_0x1569d2){return function(_0x2ca60f){if(!_0x2ca60f){_0x4d992a['sendStatus'](0x194);}return _0x2ca60f;};}function handleError(_0x20c5f9,_0x431e2b){_0x431e2b=_0x431e2b||0x1f4;return function(_0x161996){logger[_0x888c('0x22')](_0x161996[_0x888c('0x23')]);if(_0x161996[_0x888c('0x24')]){delete _0x161996['name'];}_0x20c5f9[_0x888c('0x16')](_0x431e2b)['send'](_0x161996);};}exports[_0x888c('0x25')]=function(_0x1e148b,_0x29fa1e){var _0x387e45={},_0x24342b={},_0x162c93={'count':0x0,'rows':[]};var _0x1bb2ab=_[_0x888c('0x26')](db[_0x888c('0x27')][_0x888c('0x28')],function(_0x3eed38){return{'name':_0x3eed38[_0x888c('0x29')],'type':_0x3eed38[_0x888c('0x2a')][_0x888c('0x2b')]};});_0x24342b[_0x888c('0x2c')]=_['map'](_0x1bb2ab,_0x888c('0x24'));_0x24342b[_0x888c('0x2d')]=_['keys'](_0x1e148b[_0x888c('0x2d')]);_0x24342b['filters']=_[_0x888c('0x2e')](_0x24342b['model'],_0x24342b['query']);_0x387e45['attributes']=_['intersection'](_0x24342b[_0x888c('0x2c')],qs[_0x888c('0x2f')](_0x1e148b['query']['fields']));_0x387e45[_0x888c('0x30')]=_0x387e45[_0x888c('0x30')][_0x888c('0x31')]?_0x387e45[_0x888c('0x30')]:_0x24342b[_0x888c('0x2c')];if(!_0x1e148b['query'][_0x888c('0x32')](_0x888c('0x33'))){_0x387e45[_0x888c('0x1a')]=qs[_0x888c('0x1a')](_0x1e148b['query'][_0x888c('0x1a')]);_0x387e45[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x1e148b['query'][_0x888c('0x19')]);}_0x387e45[_0x888c('0x34')]=qs['sort'](_0x1e148b[_0x888c('0x2d')][_0x888c('0x35')]);_0x387e45[_0x888c('0x36')]=qs[_0x888c('0x37')](_[_0x888c('0x38')](_0x1e148b[_0x888c('0x2d')],_0x24342b[_0x888c('0x37')]),_0x1bb2ab);if(_0x1e148b[_0x888c('0x2d')]['filter']){_0x387e45[_0x888c('0x36')]=_[_0x888c('0x39')](_0x387e45[_0x888c('0x36')],{'$or':_[_0x888c('0x26')](_0x1bb2ab,function(_0x3b032a){if(_0x3b032a[_0x888c('0x2a')]!==_0x888c('0x3a')){var _0x41d0d6={};_0x41d0d6[_0x3b032a[_0x888c('0x24')]]={'$like':'%'+_0x1e148b[_0x888c('0x2d')]['filter']+'%'};return _0x41d0d6;}})});}_0x387e45=_[_0x888c('0x39')]({},_0x387e45,_0x1e148b[_0x888c('0x3b')]);var _0x37afea={'where':_0x387e45[_0x888c('0x36')]};return db[_0x888c('0x27')][_0x888c('0x1b')](_0x37afea)[_0x888c('0x21')](function(_0x4bbb3f){_0x162c93[_0x888c('0x1b')]=_0x4bbb3f;if(_0x1e148b[_0x888c('0x2d')]['includeAll']){_0x387e45[_0x888c('0x3c')]=[{'all':!![]}];}return db[_0x888c('0x27')][_0x888c('0x3d')](_0x387e45);})[_0x888c('0x21')](function(_0x4ef38b){_0x162c93[_0x888c('0x3e')]=_0x4ef38b;return _0x162c93;})[_0x888c('0x21')](respondWithFilteredResult(_0x29fa1e,_0x387e45))[_0x888c('0x3f')](handleError(_0x29fa1e,null));};exports[_0x888c('0x40')]=function(_0x43e066,_0x4a1ea2){var _0x265e9c={'raw':![],'where':{'id':_0x43e066[_0x888c('0x41')]['id']}},_0x7ff184={};_0x7ff184['model']=_[_0x888c('0x42')](db[_0x888c('0x27')][_0x888c('0x28')]);_0x7ff184[_0x888c('0x2d')]=_[_0x888c('0x42')](_0x43e066[_0x888c('0x2d')]);_0x7ff184[_0x888c('0x37')]=_[_0x888c('0x2e')](_0x7ff184['model'],_0x7ff184[_0x888c('0x2d')]);_0x265e9c[_0x888c('0x30')]=_[_0x888c('0x2e')](_0x7ff184[_0x888c('0x2c')],qs[_0x888c('0x2f')](_0x43e066[_0x888c('0x2d')][_0x888c('0x2f')]));_0x265e9c[_0x888c('0x30')]=_0x265e9c[_0x888c('0x30')][_0x888c('0x31')]?_0x265e9c[_0x888c('0x30')]:_0x7ff184[_0x888c('0x2c')];if(_0x43e066['query'][_0x888c('0x43')]){_0x265e9c[_0x888c('0x3c')]=[{'all':!![]}];}_0x265e9c=_[_0x888c('0x39')]({},_0x265e9c,_0x43e066[_0x888c('0x3b')]);return db[_0x888c('0x27')][_0x888c('0x44')](_0x265e9c)[_0x888c('0x21')](handleEntityNotFound(_0x4a1ea2,null))[_0x888c('0x21')](respondWithResult(_0x4a1ea2,null))[_0x888c('0x3f')](handleError(_0x4a1ea2,null));};exports[_0x888c('0x45')]=function(_0x2eeef0,_0x2c2950){return db['SalesforceConfiguration'][_0x888c('0x45')](_0x2eeef0[_0x888c('0x46')],{})['then'](respondWithResult(_0x2c2950,0xc9))['catch'](handleError(_0x2c2950,null));};exports[_0x888c('0x47')]=function(_0x2035e3,_0x53f5ea){if(_0x2035e3[_0x888c('0x46')]['id']){delete _0x2035e3[_0x888c('0x46')]['id'];}return db['SalesforceConfiguration'][_0x888c('0x44')]({'where':{'id':_0x2035e3['params']['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x53f5ea,null))[_0x888c('0x21')](saveUpdates(_0x2035e3[_0x888c('0x46')],null))[_0x888c('0x21')](respondWithResult(_0x53f5ea,null))['catch'](handleError(_0x53f5ea,null));};exports[_0x888c('0x48')]=function(_0x392c0b,_0x568558){return db[_0x888c('0x27')][_0x888c('0x44')]({'where':{'id':_0x392c0b[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x568558,null))[_0x888c('0x21')](removeEntity(_0x568558,null))[_0x888c('0x3f')](handleError(_0x568558,null));};exports[_0x888c('0x49')]=function(_0x352a3c,_0x27dbf4,_0x3454c5){var _0x1be8a6={};var _0xfbaade={};var _0x18d914;var _0x55f36f;return db[_0x888c('0x27')][_0x888c('0x4a')]({'where':{'id':_0x352a3c[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x27dbf4,null))[_0x888c('0x21')](function(_0x1e4c3f){if(_0x1e4c3f){_0x18d914=_0x1e4c3f;_0xfbaade[_0x888c('0x2c')]=_[_0x888c('0x42')](db[_0x888c('0x4b')][_0x888c('0x28')]);_0xfbaade[_0x888c('0x2d')]=_[_0x888c('0x42')](_0x352a3c[_0x888c('0x2d')]);_0xfbaade['filters']=_['intersection'](_0xfbaade[_0x888c('0x2c')],_0xfbaade[_0x888c('0x2d')]);_0x1be8a6[_0x888c('0x30')]=_[_0x888c('0x2e')](_0xfbaade['model'],qs[_0x888c('0x2f')](_0x352a3c['query'][_0x888c('0x2f')]));_0x1be8a6[_0x888c('0x30')]=_0x1be8a6[_0x888c('0x30')][_0x888c('0x31')]?_0x1be8a6[_0x888c('0x30')]:_0xfbaade['model'];_0x1be8a6['order']=qs[_0x888c('0x35')](_0x352a3c[_0x888c('0x2d')][_0x888c('0x35')]);_0x1be8a6[_0x888c('0x36')]=qs[_0x888c('0x37')](_[_0x888c('0x38')](_0x352a3c[_0x888c('0x2d')],_0xfbaade[_0x888c('0x37')]));if(_0x352a3c[_0x888c('0x2d')]['filter']){_0x1be8a6[_0x888c('0x36')]=_[_0x888c('0x39')](_0x1be8a6[_0x888c('0x36')],{'$or':_[_0x888c('0x26')](_0x1be8a6['attributes'],function(_0x3f264c){var _0x1d1ff5={};_0x1d1ff5[_0x3f264c]={'$like':'%'+_0x352a3c['query'][_0x888c('0x4c')]+'%'};return _0x1d1ff5;})});}_0x1be8a6=_['merge']({},_0x1be8a6,_0x352a3c[_0x888c('0x3b')]);return _0x18d914[_0x888c('0x49')](_0x1be8a6);}})['then'](function(_0x2b5a67){if(_0x2b5a67){_0x55f36f=_0x2b5a67[_0x888c('0x31')];if(!_0x352a3c['query'][_0x888c('0x32')]('nolimit')){_0x1be8a6['limit']=qs['limit'](_0x352a3c['query']['limit']);_0x1be8a6[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x352a3c[_0x888c('0x2d')][_0x888c('0x19')]);}return _0x18d914['getFields'](_0x1be8a6);}})['then'](function(_0x53c319){if(_0x53c319){return _0x53c319?{'count':_0x55f36f,'rows':_0x53c319}:null;}})['then'](respondWithResult(_0x27dbf4,null))[_0x888c('0x3f')](handleError(_0x27dbf4,null));};exports['getSubjects']=function(_0x13a999,_0x2b9dba,_0x4c74b1){var _0x357c1f={};var _0x130fb7={};var _0x232ce6;var _0x5252fc;return db[_0x888c('0x27')][_0x888c('0x4a')]({'where':{'id':_0x13a999[_0x888c('0x41')]['id']}})['then'](handleEntityNotFound(_0x2b9dba,null))[_0x888c('0x21')](function(_0x1a613d){if(_0x1a613d){_0x232ce6=_0x1a613d;_0x130fb7[_0x888c('0x2c')]=_[_0x888c('0x42')](db[_0x888c('0x4b')][_0x888c('0x28')]);_0x130fb7[_0x888c('0x2d')]=_[_0x888c('0x42')](_0x13a999[_0x888c('0x2d')]);_0x130fb7[_0x888c('0x37')]=_[_0x888c('0x2e')](_0x130fb7['model'],_0x130fb7[_0x888c('0x2d')]);_0x357c1f[_0x888c('0x30')]=_[_0x888c('0x2e')](_0x130fb7[_0x888c('0x2c')],qs[_0x888c('0x2f')](_0x13a999[_0x888c('0x2d')][_0x888c('0x2f')]));_0x357c1f[_0x888c('0x30')]=_0x357c1f['attributes'][_0x888c('0x31')]?_0x357c1f[_0x888c('0x30')]:_0x130fb7['model'];_0x357c1f['order']=qs[_0x888c('0x35')](_0x13a999['query'][_0x888c('0x35')]);_0x357c1f[_0x888c('0x36')]=qs[_0x888c('0x37')](_[_0x888c('0x38')](_0x13a999[_0x888c('0x2d')],_0x130fb7[_0x888c('0x37')]));if(_0x13a999['query'][_0x888c('0x4c')]){_0x357c1f['where']=_[_0x888c('0x39')](_0x357c1f[_0x888c('0x36')],{'$or':_[_0x888c('0x26')](_0x357c1f[_0x888c('0x30')],function(_0x301aaf){var _0x5e07dc={};_0x5e07dc[_0x301aaf]={'$like':'%'+_0x13a999[_0x888c('0x2d')][_0x888c('0x4c')]+'%'};return _0x5e07dc;})});}_0x357c1f=_['merge']({},_0x357c1f,_0x13a999['options']);return _0x232ce6['getSubjects'](_0x357c1f);}})[_0x888c('0x21')](function(_0xb24808){if(_0xb24808){_0x5252fc=_0xb24808[_0x888c('0x31')];if(!_0x13a999[_0x888c('0x2d')]['hasOwnProperty']('nolimit')){_0x357c1f[_0x888c('0x1a')]=qs[_0x888c('0x1a')](_0x13a999[_0x888c('0x2d')][_0x888c('0x1a')]);_0x357c1f[_0x888c('0x19')]=qs['offset'](_0x13a999[_0x888c('0x2d')][_0x888c('0x19')]);}return _0x232ce6[_0x888c('0x4d')](_0x357c1f);}})[_0x888c('0x21')](function(_0x1f753f){if(_0x1f753f){return _0x1f753f?{'count':_0x5252fc,'rows':_0x1f753f}:null;}})['then'](respondWithResult(_0x2b9dba,null))[_0x888c('0x3f')](handleError(_0x2b9dba,null));};exports[_0x888c('0x4e')]=function(_0x1e2982,_0x415931,_0x19ff92){var _0x4c44e4={};var _0x4445b0={};var _0x3700f6;var _0x2d5c07;return db['SalesforceConfiguration'][_0x888c('0x4a')]({'where':{'id':_0x1e2982[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x415931,null))[_0x888c('0x21')](function(_0x5f5233){if(_0x5f5233){_0x3700f6=_0x5f5233;_0x4445b0['model']=_[_0x888c('0x42')](db[_0x888c('0x4b')][_0x888c('0x28')]);_0x4445b0[_0x888c('0x2d')]=_[_0x888c('0x42')](_0x1e2982[_0x888c('0x2d')]);_0x4445b0['filters']=_[_0x888c('0x2e')](_0x4445b0[_0x888c('0x2c')],_0x4445b0[_0x888c('0x2d')]);_0x4c44e4[_0x888c('0x30')]=_[_0x888c('0x2e')](_0x4445b0[_0x888c('0x2c')],qs[_0x888c('0x2f')](_0x1e2982[_0x888c('0x2d')]['fields']));_0x4c44e4['attributes']=_0x4c44e4[_0x888c('0x30')][_0x888c('0x31')]?_0x4c44e4[_0x888c('0x30')]:_0x4445b0[_0x888c('0x2c')];_0x4c44e4[_0x888c('0x34')]=qs['sort'](_0x1e2982[_0x888c('0x2d')][_0x888c('0x35')]);_0x4c44e4['where']=qs['filters'](_[_0x888c('0x38')](_0x1e2982[_0x888c('0x2d')],_0x4445b0[_0x888c('0x37')]));if(_0x1e2982['query'][_0x888c('0x4c')]){_0x4c44e4['where']=_[_0x888c('0x39')](_0x4c44e4[_0x888c('0x36')],{'$or':_['map'](_0x4c44e4[_0x888c('0x30')],function(_0x29518b){var _0x19b603={};_0x19b603[_0x29518b]={'$like':'%'+_0x1e2982[_0x888c('0x2d')][_0x888c('0x4c')]+'%'};return _0x19b603;})});}_0x4c44e4=_[_0x888c('0x39')]({},_0x4c44e4,_0x1e2982['options']);return _0x3700f6[_0x888c('0x4e')](_0x4c44e4);}})['then'](function(_0x4468ad){if(_0x4468ad){_0x2d5c07=_0x4468ad[_0x888c('0x31')];if(!_0x1e2982['query']['hasOwnProperty']('nolimit')){_0x4c44e4[_0x888c('0x1a')]=qs['limit'](_0x1e2982['query'][_0x888c('0x1a')]);_0x4c44e4[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x1e2982[_0x888c('0x2d')][_0x888c('0x19')]);}return _0x3700f6[_0x888c('0x4e')](_0x4c44e4);}})['then'](function(_0x4455d8){if(_0x4455d8){return _0x4455d8?{'count':_0x2d5c07,'rows':_0x4455d8}:null;}})[_0x888c('0x21')](respondWithResult(_0x415931,null))[_0x888c('0x3f')](handleError(_0x415931,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e33667f..fef887c 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 _0xc609=['moment','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','define','lodash','util','../../config/logger','api'];(function(_0x235bc9,_0x56bae3){var _0x47508c=function(_0x440366){while(--_0x440366){_0x235bc9['push'](_0x235bc9['shift']());}};_0x47508c(++_0x56bae3);}(_0xc609,0x1c8));var _0x9c60=function(_0x5571e8,_0x122575){_0x5571e8=_0x5571e8-0x0;var _0x415b5b=_0xc609[_0x5571e8];return _0x415b5b;};'use strict';var _=require(_0x9c60('0x0'));var util=require(_0x9c60('0x1'));var logger=require(_0x9c60('0x2'))(_0x9c60('0x3'));var moment=require(_0x9c60('0x4'));var BPromise=require('bluebird');var rp=require(_0x9c60('0x5'));var fs=require('fs');var path=require(_0x9c60('0x6'));var rimraf=require(_0x9c60('0x7'));var config=require('../../config/environment');var attributes=require(_0x9c60('0x8'));module['exports']=function(_0x459ce7,_0x42c59b){return _0x459ce7[_0x9c60('0x9')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68a2=['int_salesforce_configurations','util','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x1a455c,_0x3e182c){var _0x5d5a35=function(_0x552acd){while(--_0x552acd){_0x1a455c['push'](_0x1a455c['shift']());}};_0x5d5a35(++_0x3e182c);}(_0x68a2,0x85));var _0x268a=function(_0x4e71c4,_0xc4d62d){_0x4e71c4=_0x4e71c4-0x0;var _0x4fb92b=_0x68a2[_0x4e71c4];return _0x4fb92b;};'use strict';var _=require('lodash');var util=require(_0x268a('0x0'));var logger=require('../../config/logger')(_0x268a('0x1'));var moment=require(_0x268a('0x2'));var BPromise=require('bluebird');var rp=require(_0x268a('0x3'));var fs=require('fs');var path=require(_0x268a('0x4'));var rimraf=require(_0x268a('0x5'));var config=require(_0x268a('0x6'));var attributes=require(_0x268a('0x7'));module[_0x268a('0x8')]=function(_0x3041df,_0x516fe1){return _0x3041df[_0x268a('0x9')](_0x268a('0xa'),attributes,{'tableName':_0x268a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 9ecdce8..fe4f37b 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 _0x1738=['../../config/environment','jayson/promise','client','http','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x174724,_0x47eba4){var _0x25901e=function(_0x1c54f7){while(--_0x1c54f7){_0x174724['push'](_0x174724['shift']());}};_0x25901e(++_0x47eba4);}(_0x1738,0xb7));var _0x8173=function(_0x475191,_0x5bce86){_0x475191=_0x475191-0x0;var _0x189e96=_0x1738[_0x475191];return _0x189e96;};'use strict';var _=require('lodash');var util=require(_0x8173('0x0'));var moment=require(_0x8173('0x1'));var BPromise=require(_0x8173('0x2'));var rs=require(_0x8173('0x3'));var fs=require('fs');var Redis=require(_0x8173('0x4'));var db=require(_0x8173('0x5'))['db'];var utils=require(_0x8173('0x6'));var logger=require(_0x8173('0x7'))(_0x8173('0x8'));var config=require(_0x8173('0x9'));var jayson=require(_0x8173('0xa'));var client=jayson[_0x8173('0xb')][_0x8173('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x452613,_0x157939,_0x19e09f){return new BPromise(function(_0x4d077c,_0x518aa3){return client['request'](_0x452613,_0x19e09f)[_0x8173('0xd')](function(_0x374236){logger[_0x8173('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x157939,'request\x20sent');logger[_0x8173('0xf')](_0x8173('0x10'),_0x157939,'request\x20sent',JSON[_0x8173('0x11')](_0x374236));if(_0x374236[_0x8173('0x12')]){if(_0x374236[_0x8173('0x12')][_0x8173('0x13')]===0x1f4){logger[_0x8173('0x12')](_0x8173('0x14'),_0x157939,_0x374236[_0x8173('0x12')][_0x8173('0x15')]);return _0x518aa3(_0x374236['error'][_0x8173('0x15')]);}logger[_0x8173('0x12')](_0x8173('0x14'),_0x157939,_0x374236[_0x8173('0x12')]['message']);return _0x4d077c(_0x374236[_0x8173('0x12')][_0x8173('0x15')]);}else{logger[_0x8173('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x157939,_0x8173('0x16'));_0x4d077c(_0x374236['result'][_0x8173('0x15')]);}})[_0x8173('0x17')](function(_0x2af0b5){logger[_0x8173('0x12')](_0x8173('0x14'),_0x157939,_0x2af0b5);_0x518aa3(_0x2af0b5);});});} \ No newline at end of file +var _0xae8a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','stringify','error','message','result','moment','bluebird','randomstring'];(function(_0x4cf834,_0x77a576){var _0x34a470=function(_0x2ecd2e){while(--_0x2ecd2e){_0x4cf834['push'](_0x4cf834['shift']());}};_0x34a470(++_0x77a576);}(_0xae8a,0x6f));var _0xaae8=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xae8a[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaae8('0x0'));var BPromise=require(_0xaae8('0x1'));var rs=require(_0xaae8('0x2'));var fs=require('fs');var Redis=require(_0xaae8('0x3'));var db=require(_0xaae8('0x4'))['db'];var utils=require(_0xaae8('0x5'));var logger=require(_0xaae8('0x6'))(_0xaae8('0x7'));var config=require('../../config/environment');var jayson=require(_0xaae8('0x8'));var client=jayson[_0xaae8('0x9')][_0xaae8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50a002,_0x3d94fc,_0x553868){return new BPromise(function(_0x5dc469,_0x211406){return client['request'](_0x50a002,_0x553868)[_0xaae8('0xb')](function(_0x275f0f){logger[_0xaae8('0xc')](_0xaae8('0xd'),_0x3d94fc,'request\x20sent');logger[_0xaae8('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3d94fc,'request\x20sent',JSON[_0xaae8('0xf')](_0x275f0f));if(_0x275f0f['error']){if(_0x275f0f[_0xaae8('0x10')]['code']===0x1f4){logger['error'](_0xaae8('0xd'),_0x3d94fc,_0x275f0f['error'][_0xaae8('0x11')]);return _0x211406(_0x275f0f['error'][_0xaae8('0x11')]);}logger[_0xaae8('0x10')](_0xaae8('0xd'),_0x3d94fc,_0x275f0f[_0xaae8('0x10')][_0xaae8('0x11')]);return _0x5dc469(_0x275f0f[_0xaae8('0x10')]['message']);}else{logger[_0xaae8('0xc')](_0xaae8('0xd'),_0x3d94fc,'request\x20sent');_0x5dc469(_0x275f0f[_0xaae8('0x12')]['message']);}})['catch'](function(_0x18c5c8){logger['error'](_0xaae8('0xd'),_0x3d94fc,_0x18c5c8);_0x211406(_0x18c5c8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 9632f51..33fbc54 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 _0x15bc=['util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy'];(function(_0x2dc94d,_0x2e89a6){var _0x3237be=function(_0x35b917){while(--_0x35b917){_0x2dc94d['push'](_0x2dc94d['shift']());}};_0x3237be(++_0x2e89a6);}(_0x15bc,0x77));var _0xc15b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15bc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc15b('0x0'));var path=require('path');var timeout=require(_0xc15b('0x1'));var express=require('express');var router=express[_0xc15b('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc15b('0x3'));var config=require(_0xc15b('0x4'));var controller=require(_0xc15b('0x5'));router[_0xc15b('0x6')]('/',auth[_0xc15b('0x7')](),controller[_0xc15b('0x8')]);router[_0xc15b('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xc15b('0x9')]);router[_0xc15b('0xa')]('/',auth[_0xc15b('0x7')](),controller[_0xc15b('0xb')]);router[_0xc15b('0xc')](_0xc15b('0xd'),auth[_0xc15b('0x7')](),controller[_0xc15b('0xe')]);router[_0xc15b('0xf')](_0xc15b('0xd'),auth[_0xc15b('0x7')](),controller[_0xc15b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2d3e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x5e5652,_0x30c64d){var _0x37a637=function(_0x64a0f6){while(--_0x64a0f6){_0x5e5652['push'](_0x5e5652['shift']());}};_0x37a637(++_0x30c64d);}(_0x2d3e,0x161));var _0xe2d3=function(_0x45dd9e,_0xad4da0){_0x45dd9e=_0x45dd9e-0x0;var _0x35a357=_0x2d3e[_0x45dd9e];return _0x35a357;};'use strict';var multer=require(_0xe2d3('0x0'));var util=require(_0xe2d3('0x1'));var path=require('path');var timeout=require(_0xe2d3('0x2'));var express=require(_0xe2d3('0x3'));var router=express[_0xe2d3('0x4')]();var fs_extra=require(_0xe2d3('0x5'));var auth=require(_0xe2d3('0x6'));var interaction=require(_0xe2d3('0x7'));var config=require(_0xe2d3('0x8'));var controller=require(_0xe2d3('0x9'));router[_0xe2d3('0xa')]('/',auth[_0xe2d3('0xb')](),controller[_0xe2d3('0xc')]);router[_0xe2d3('0xa')](_0xe2d3('0xd'),auth[_0xe2d3('0xb')](),controller[_0xe2d3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe2d3('0xf')]);router[_0xe2d3('0x10')](_0xe2d3('0xd'),auth[_0xe2d3('0xb')](),controller[_0xe2d3('0x11')]);router[_0xe2d3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe2d3('0x13')]);module[_0xe2d3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 05a2532..91de954 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 _0x05ba=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x05ba,0x111));var _0xa05b=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x05ba[_0x580b15];return _0x1adb1b;};'use strict';var Sequelize=require(_0xa05b('0x0'));module[_0xa05b('0x1')]={'type':{'type':Sequelize[_0xa05b('0x2')](_0xa05b('0x3'),_0xa05b('0x4'),_0xa05b('0x5'),_0xa05b('0x6'),_0xa05b('0x7')),'defaultValue':_0xa05b('0x3')},'content':{'type':Sequelize[_0xa05b('0x8')]},'key':{'type':Sequelize[_0xa05b('0x8')]},'keyType':{'type':Sequelize[_0xa05b('0x2')](_0xa05b('0x3'),_0xa05b('0x4'),_0xa05b('0x5'))},'keyContent':{'type':Sequelize[_0xa05b('0x8')]},'idField':{'type':Sequelize[_0xa05b('0x8')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfa63=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xfa63,0x65));var _0x3fa6=function(_0x11a8dd,_0x493433){_0x11a8dd=_0x11a8dd-0x0;var _0x3be03f=_0xfa63[_0x11a8dd];return _0x3be03f;};'use strict';var Sequelize=require(_0x3fa6('0x0'));module[_0x3fa6('0x1')]={'type':{'type':Sequelize[_0x3fa6('0x2')](_0x3fa6('0x3'),_0x3fa6('0x4'),_0x3fa6('0x5'),_0x3fa6('0x6'),_0x3fa6('0x7')),'defaultValue':_0x3fa6('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3fa6('0x8')]},'keyType':{'type':Sequelize[_0x3fa6('0x2')](_0x3fa6('0x3'),_0x3fa6('0x4'),_0x3fa6('0x5'))},'keyContent':{'type':Sequelize[_0x3fa6('0x8')]},'idField':{'type':Sequelize[_0x3fa6('0x8')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 7901dcc..245e9c2 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 _0x75f0=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceField','include','findAll','rows','catch','show','includeAll','find','create','params','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x124486,_0x545c74){var _0x28455f=function(_0x11527b){while(--_0x11527b){_0x124486['push'](_0x124486['shift']());}};_0x28455f(++_0x545c74);}(_0x75f0,0xae));var _0x075f=function(_0x2904eb,_0x4f23a1){_0x2904eb=_0x2904eb-0x0;var _0x42bd3d=_0x75f0[_0x2904eb];return _0x42bd3d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x075f('0x0'));var jsonpatch=require(_0x075f('0x1'));var rp=require(_0x075f('0x2'));var moment=require(_0x075f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x075f('0x4'));var util=require(_0x075f('0x5'));var path=require('path');var sox=require(_0x075f('0x6'));var csv=require(_0x075f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x075f('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x075f('0x9'));var toCsv=require(_0x075f('0x7'));var querystring=require(_0x075f('0xa'));var Papa=require(_0x075f('0xb'));var Redis=require(_0x075f('0xc'));var authService=require(_0x075f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x075f('0xe'));var hardwareService=require(_0x075f('0xf'));var logger=require('../../config/logger')(_0x075f('0x10'));var utils=require(_0x075f('0x11'));var config=require(_0x075f('0x12'));var licenseUtil=require(_0x075f('0x13'));var db=require(_0x075f('0x14'))['db'];function respondWithStatusCode(_0x4f4cce,_0x4aea81){_0x4aea81=_0x4aea81||0xcc;return function(_0x593574){if(_0x593574){return _0x4f4cce[_0x075f('0x15')](_0x4aea81);}return _0x4f4cce[_0x075f('0x16')](_0x4aea81)[_0x075f('0x17')]();};}function respondWithResult(_0x36162d,_0x2cc015){_0x2cc015=_0x2cc015||0xc8;return function(_0x450363){if(_0x450363){return _0x36162d['status'](_0x2cc015)[_0x075f('0x18')](_0x450363);}};}function respondWithFilteredResult(_0x40dbe3,_0x16f996){return function(_0x5d0024){if(_0x5d0024){var _0x142fe5=typeof _0x16f996[_0x075f('0x19')]===_0x075f('0x1a')&&typeof _0x16f996[_0x075f('0x1b')]===_0x075f('0x1a');var _0xac21e8=_0x5d0024[_0x075f('0x1c')];var _0x21903f=_0x142fe5?0x0:_0x16f996[_0x075f('0x19')];var _0x28174a=_0x142fe5?_0x5d0024[_0x075f('0x1c')]:_0x16f996[_0x075f('0x19')]+_0x16f996[_0x075f('0x1b')];var _0x3fb228;if(_0x28174a>=_0xac21e8){_0x28174a=_0xac21e8;_0x3fb228=0xc8;}else{_0x3fb228=0xce;}_0x40dbe3[_0x075f('0x16')](_0x3fb228);return _0x40dbe3[_0x075f('0x1d')](_0x075f('0x1e'),_0x21903f+'-'+_0x28174a+'/'+_0xac21e8)[_0x075f('0x18')](_0x5d0024);}return null;};}function patchUpdates(_0x1d6824){return function(_0xdeb455){try{jsonpatch[_0x075f('0x1f')](_0xdeb455,_0x1d6824,!![]);}catch(_0x54dd5b){return BPromise['reject'](_0x54dd5b);}return _0xdeb455[_0x075f('0x20')]();};}function saveUpdates(_0x2e4b82,_0x2a8e97){return function(_0xa506ea){if(_0xa506ea){return _0xa506ea[_0x075f('0x21')](_0x2e4b82)[_0x075f('0x22')](function(_0x52f060){return _0x52f060;});}return null;};}function removeEntity(_0xda3c03,_0x156d7d){return function(_0x345084){if(_0x345084){return _0x345084[_0x075f('0x23')]()['then'](function(){_0xda3c03[_0x075f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x400bef,_0x36833d){return function(_0x44dccf){if(!_0x44dccf){_0x400bef[_0x075f('0x15')](0x194);}return _0x44dccf;};}function handleError(_0x1bd238,_0x74630){_0x74630=_0x74630||0x1f4;return function(_0x3d8e1e){logger[_0x075f('0x24')](_0x3d8e1e[_0x075f('0x25')]);if(_0x3d8e1e[_0x075f('0x26')]){delete _0x3d8e1e[_0x075f('0x26')];}_0x1bd238[_0x075f('0x16')](_0x74630)[_0x075f('0x27')](_0x3d8e1e);};}exports[_0x075f('0x28')]=function(_0xd318fa,_0x2b5a4a){var _0x20a423={},_0x492447={},_0x141fa3={'count':0x0,'rows':[]};var _0x31ca9b=_[_0x075f('0x29')](db['SalesforceField'][_0x075f('0x2a')],function(_0x31e724){return{'name':_0x31e724[_0x075f('0x2b')],'type':_0x31e724[_0x075f('0x2c')][_0x075f('0x2d')]};});_0x492447[_0x075f('0x2e')]=_['map'](_0x31ca9b,_0x075f('0x26'));_0x492447[_0x075f('0x2f')]=_[_0x075f('0x30')](_0xd318fa[_0x075f('0x2f')]);_0x492447[_0x075f('0x31')]=_[_0x075f('0x32')](_0x492447[_0x075f('0x2e')],_0x492447[_0x075f('0x2f')]);_0x20a423['attributes']=_['intersection'](_0x492447[_0x075f('0x2e')],qs['fields'](_0xd318fa[_0x075f('0x2f')][_0x075f('0x33')]));_0x20a423[_0x075f('0x34')]=_0x20a423[_0x075f('0x34')][_0x075f('0x35')]?_0x20a423['attributes']:_0x492447[_0x075f('0x2e')];if(!_0xd318fa['query'][_0x075f('0x36')](_0x075f('0x37'))){_0x20a423['limit']=qs[_0x075f('0x1b')](_0xd318fa[_0x075f('0x2f')][_0x075f('0x1b')]);_0x20a423['offset']=qs[_0x075f('0x19')](_0xd318fa[_0x075f('0x2f')][_0x075f('0x19')]);}_0x20a423[_0x075f('0x38')]=qs[_0x075f('0x39')](_0xd318fa['query'][_0x075f('0x39')]);_0x20a423[_0x075f('0x3a')]=qs['filters'](_[_0x075f('0x3b')](_0xd318fa[_0x075f('0x2f')],_0x492447['filters']),_0x31ca9b);if(_0xd318fa['query']['filter']){_0x20a423[_0x075f('0x3a')]=_[_0x075f('0x3c')](_0x20a423['where'],{'$or':_['map'](_0x31ca9b,function(_0x2a0d56){if(_0x2a0d56[_0x075f('0x2c')]!==_0x075f('0x3d')){var _0x4b85bf={};_0x4b85bf[_0x2a0d56['name']]={'$like':'%'+_0xd318fa['query'][_0x075f('0x3e')]+'%'};return _0x4b85bf;}})});}_0x20a423=_[_0x075f('0x3c')]({},_0x20a423,_0xd318fa[_0x075f('0x3f')]);var _0x233afb={'where':_0x20a423[_0x075f('0x3a')]};return db[_0x075f('0x40')][_0x075f('0x1c')](_0x233afb)[_0x075f('0x22')](function(_0x4e5462){_0x141fa3[_0x075f('0x1c')]=_0x4e5462;if(_0xd318fa['query']['includeAll']){_0x20a423[_0x075f('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0x075f('0x42')](_0x20a423);})[_0x075f('0x22')](function(_0x3fa329){_0x141fa3[_0x075f('0x43')]=_0x3fa329;return _0x141fa3;})['then'](respondWithFilteredResult(_0x2b5a4a,_0x20a423))[_0x075f('0x44')](handleError(_0x2b5a4a,null));};exports[_0x075f('0x45')]=function(_0x5b0eca,_0xe8af62){var _0x4d9cb1={'raw':!![],'where':{'id':_0x5b0eca['params']['id']}},_0x59f267={};_0x59f267[_0x075f('0x2e')]=_[_0x075f('0x30')](db[_0x075f('0x40')][_0x075f('0x2a')]);_0x59f267['query']=_[_0x075f('0x30')](_0x5b0eca[_0x075f('0x2f')]);_0x59f267[_0x075f('0x31')]=_[_0x075f('0x32')](_0x59f267[_0x075f('0x2e')],_0x59f267[_0x075f('0x2f')]);_0x4d9cb1['attributes']=_[_0x075f('0x32')](_0x59f267[_0x075f('0x2e')],qs['fields'](_0x5b0eca[_0x075f('0x2f')][_0x075f('0x33')]));_0x4d9cb1[_0x075f('0x34')]=_0x4d9cb1[_0x075f('0x34')]['length']?_0x4d9cb1[_0x075f('0x34')]:_0x59f267[_0x075f('0x2e')];if(_0x5b0eca['query'][_0x075f('0x46')]){_0x4d9cb1[_0x075f('0x41')]=[{'all':!![]}];}_0x4d9cb1=_[_0x075f('0x3c')]({},_0x4d9cb1,_0x5b0eca[_0x075f('0x3f')]);return db[_0x075f('0x40')][_0x075f('0x47')](_0x4d9cb1)['then'](handleEntityNotFound(_0xe8af62,null))[_0x075f('0x22')](respondWithResult(_0xe8af62,null))[_0x075f('0x44')](handleError(_0xe8af62,null));};exports[_0x075f('0x48')]=function(_0x8bd21f,_0xb12961){return db['SalesforceField'][_0x075f('0x48')](_0x8bd21f['body'],{})[_0x075f('0x22')](respondWithResult(_0xb12961,0xc9))[_0x075f('0x44')](handleError(_0xb12961,null));};exports[_0x075f('0x21')]=function(_0x1dcadc,_0x3dc74d){if(_0x1dcadc['body']['id']){delete _0x1dcadc['body']['id'];}return db[_0x075f('0x40')][_0x075f('0x47')]({'where':{'id':_0x1dcadc[_0x075f('0x49')]['id']}})[_0x075f('0x22')](handleEntityNotFound(_0x3dc74d,null))['then'](saveUpdates(_0x1dcadc['body'],null))[_0x075f('0x22')](respondWithResult(_0x3dc74d,null))[_0x075f('0x44')](handleError(_0x3dc74d,null));};exports[_0x075f('0x23')]=function(_0x298f32,_0x108749){return db[_0x075f('0x40')]['find']({'where':{'id':_0x298f32[_0x075f('0x49')]['id']}})[_0x075f('0x22')](handleEntityNotFound(_0x108749,null))[_0x075f('0x22')](removeEntity(_0x108749,null))['catch'](handleError(_0x108749,null));}; \ No newline at end of file +var _0xfa80=['include','findAll','rows','catch','params','keys','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','save','update','then','destroy','name','send','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','SalesforceField','includeAll'];(function(_0x153051,_0x1f6cd4){var _0x283297=function(_0x3f9390){while(--_0x3f9390){_0x153051['push'](_0x153051['shift']());}};_0x283297(++_0x1f6cd4);}(_0xfa80,0xdb));var _0x0fa8=function(_0x51d65b,_0x1d0c18){_0x51d65b=_0x51d65b-0x0;var _0x33a059=_0xfa80[_0x51d65b];return _0x33a059;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fa8('0x0'));var zipdir=require(_0x0fa8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fa8('0x2'));var moment=require(_0x0fa8('0x3'));var BPromise=require(_0x0fa8('0x4'));var Mustache=require(_0x0fa8('0x5'));var util=require(_0x0fa8('0x6'));var path=require(_0x0fa8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0fa8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fa8('0x9'));var squel=require(_0x0fa8('0xa'));var crypto=require(_0x0fa8('0xb'));var jsforce=require(_0x0fa8('0xc'));var deskjs=require(_0x0fa8('0xd'));var toCsv=require(_0x0fa8('0xe'));var querystring=require(_0x0fa8('0xf'));var Papa=require('papaparse');var Redis=require(_0x0fa8('0x10'));var authService=require(_0x0fa8('0x11'));var qs=require(_0x0fa8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fa8('0x13'));var logger=require(_0x0fa8('0x14'))(_0x0fa8('0x15'));var utils=require(_0x0fa8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d67cb,_0x457773){_0x457773=_0x457773||0xcc;return function(_0x13b809){if(_0x13b809){return _0x5d67cb[_0x0fa8('0x17')](_0x457773);}return _0x5d67cb[_0x0fa8('0x18')](_0x457773)[_0x0fa8('0x19')]();};}function respondWithResult(_0x5df39f,_0x1e1260){_0x1e1260=_0x1e1260||0xc8;return function(_0x3486b9){if(_0x3486b9){return _0x5df39f['status'](_0x1e1260)['json'](_0x3486b9);}};}function respondWithFilteredResult(_0x4c0e4e,_0x186aa8){return function(_0x295b4f){if(_0x295b4f){var _0x4a3bfa=typeof _0x186aa8[_0x0fa8('0x1a')]==='undefined'&&typeof _0x186aa8[_0x0fa8('0x1b')]===_0x0fa8('0x1c');var _0x2e5974=_0x295b4f[_0x0fa8('0x1d')];var _0x43b9ac=_0x4a3bfa?0x0:_0x186aa8[_0x0fa8('0x1a')];var _0x583bb9=_0x4a3bfa?_0x295b4f['count']:_0x186aa8['offset']+_0x186aa8[_0x0fa8('0x1b')];var _0x2dcf07;if(_0x583bb9>=_0x2e5974){_0x583bb9=_0x2e5974;_0x2dcf07=0xc8;}else{_0x2dcf07=0xce;}_0x4c0e4e[_0x0fa8('0x18')](_0x2dcf07);return _0x4c0e4e['set'](_0x0fa8('0x1e'),_0x43b9ac+'-'+_0x583bb9+'/'+_0x2e5974)[_0x0fa8('0x1f')](_0x295b4f);}return null;};}function patchUpdates(_0x403819){return function(_0x3670dc){try{jsonpatch[_0x0fa8('0x20')](_0x3670dc,_0x403819,!![]);}catch(_0xf10cd1){return BPromise['reject'](_0xf10cd1);}return _0x3670dc[_0x0fa8('0x21')]();};}function saveUpdates(_0x4692be,_0x2edd39){return function(_0x32932b){if(_0x32932b){return _0x32932b[_0x0fa8('0x22')](_0x4692be)[_0x0fa8('0x23')](function(_0x4b0287){return _0x4b0287;});}return null;};}function removeEntity(_0x480eaa,_0x5a61c7){return function(_0x8b3741){if(_0x8b3741){return _0x8b3741[_0x0fa8('0x24')]()['then'](function(){_0x480eaa[_0x0fa8('0x18')](0xcc)[_0x0fa8('0x19')]();});}};}function handleEntityNotFound(_0x1add33,_0x162836){return function(_0x123a8b){if(!_0x123a8b){_0x1add33[_0x0fa8('0x17')](0x194);}return _0x123a8b;};}function handleError(_0x342349,_0x2e517a){_0x2e517a=_0x2e517a||0x1f4;return function(_0xbb0cd0){logger['error'](_0xbb0cd0['stack']);if(_0xbb0cd0[_0x0fa8('0x25')]){delete _0xbb0cd0[_0x0fa8('0x25')];}_0x342349[_0x0fa8('0x18')](_0x2e517a)[_0x0fa8('0x26')](_0xbb0cd0);};}exports['index']=function(_0xb65014,_0x3a0e67){var _0x1f6986={},_0x196c7a={},_0x38c563={'count':0x0,'rows':[]};var _0x232708=_[_0x0fa8('0x27')](db['SalesforceField'][_0x0fa8('0x28')],function(_0x582a3a){return{'name':_0x582a3a[_0x0fa8('0x29')],'type':_0x582a3a['type'][_0x0fa8('0x2a')]};});_0x196c7a[_0x0fa8('0x2b')]=_[_0x0fa8('0x27')](_0x232708,'name');_0x196c7a[_0x0fa8('0x2c')]=_['keys'](_0xb65014[_0x0fa8('0x2c')]);_0x196c7a['filters']=_[_0x0fa8('0x2d')](_0x196c7a[_0x0fa8('0x2b')],_0x196c7a[_0x0fa8('0x2c')]);_0x1f6986['attributes']=_[_0x0fa8('0x2d')](_0x196c7a['model'],qs[_0x0fa8('0x2e')](_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x2e')]));_0x1f6986[_0x0fa8('0x2f')]=_0x1f6986[_0x0fa8('0x2f')][_0x0fa8('0x30')]?_0x1f6986[_0x0fa8('0x2f')]:_0x196c7a[_0x0fa8('0x2b')];if(!_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x31')](_0x0fa8('0x32'))){_0x1f6986['limit']=qs['limit'](_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x1b')]);_0x1f6986[_0x0fa8('0x1a')]=qs[_0x0fa8('0x1a')](_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x1a')]);}_0x1f6986[_0x0fa8('0x33')]=qs['sort'](_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x34')]);_0x1f6986[_0x0fa8('0x35')]=qs[_0x0fa8('0x36')](_[_0x0fa8('0x37')](_0xb65014[_0x0fa8('0x2c')],_0x196c7a['filters']),_0x232708);if(_0xb65014['query'][_0x0fa8('0x38')]){_0x1f6986['where']=_['merge'](_0x1f6986[_0x0fa8('0x35')],{'$or':_[_0x0fa8('0x27')](_0x232708,function(_0x1fee8b){if(_0x1fee8b['type']!=='VIRTUAL'){var _0x180308={};_0x180308[_0x1fee8b['name']]={'$like':'%'+_0xb65014['query'][_0x0fa8('0x38')]+'%'};return _0x180308;}})});}_0x1f6986=_[_0x0fa8('0x39')]({},_0x1f6986,_0xb65014[_0x0fa8('0x3a')]);var _0x3c3516={'where':_0x1f6986[_0x0fa8('0x35')]};return db[_0x0fa8('0x3b')][_0x0fa8('0x1d')](_0x3c3516)[_0x0fa8('0x23')](function(_0x3bf66f){_0x38c563[_0x0fa8('0x1d')]=_0x3bf66f;if(_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x3c')]){_0x1f6986[_0x0fa8('0x3d')]=[{'all':!![]}];}return db[_0x0fa8('0x3b')][_0x0fa8('0x3e')](_0x1f6986);})[_0x0fa8('0x23')](function(_0x72abf){_0x38c563[_0x0fa8('0x3f')]=_0x72abf;return _0x38c563;})['then'](respondWithFilteredResult(_0x3a0e67,_0x1f6986))[_0x0fa8('0x40')](handleError(_0x3a0e67,null));};exports['show']=function(_0x33788e,_0x66913f){var _0x54bf1c={'raw':!![],'where':{'id':_0x33788e[_0x0fa8('0x41')]['id']}},_0x3776ca={};_0x3776ca[_0x0fa8('0x2b')]=_['keys'](db[_0x0fa8('0x3b')][_0x0fa8('0x28')]);_0x3776ca[_0x0fa8('0x2c')]=_[_0x0fa8('0x42')](_0x33788e[_0x0fa8('0x2c')]);_0x3776ca['filters']=_[_0x0fa8('0x2d')](_0x3776ca['model'],_0x3776ca[_0x0fa8('0x2c')]);_0x54bf1c[_0x0fa8('0x2f')]=_[_0x0fa8('0x2d')](_0x3776ca['model'],qs['fields'](_0x33788e[_0x0fa8('0x2c')][_0x0fa8('0x2e')]));_0x54bf1c[_0x0fa8('0x2f')]=_0x54bf1c[_0x0fa8('0x2f')][_0x0fa8('0x30')]?_0x54bf1c[_0x0fa8('0x2f')]:_0x3776ca[_0x0fa8('0x2b')];if(_0x33788e[_0x0fa8('0x2c')][_0x0fa8('0x3c')]){_0x54bf1c[_0x0fa8('0x3d')]=[{'all':!![]}];}_0x54bf1c=_['merge']({},_0x54bf1c,_0x33788e[_0x0fa8('0x3a')]);return db[_0x0fa8('0x3b')][_0x0fa8('0x43')](_0x54bf1c)['then'](handleEntityNotFound(_0x66913f,null))[_0x0fa8('0x23')](respondWithResult(_0x66913f,null))[_0x0fa8('0x40')](handleError(_0x66913f,null));};exports['create']=function(_0x169cba,_0x25f90d){return db[_0x0fa8('0x3b')][_0x0fa8('0x44')](_0x169cba[_0x0fa8('0x45')],{})['then'](respondWithResult(_0x25f90d,0xc9))['catch'](handleError(_0x25f90d,null));};exports[_0x0fa8('0x22')]=function(_0x26b7f7,_0x3a8e7d){if(_0x26b7f7[_0x0fa8('0x45')]['id']){delete _0x26b7f7[_0x0fa8('0x45')]['id'];}return db[_0x0fa8('0x3b')][_0x0fa8('0x43')]({'where':{'id':_0x26b7f7[_0x0fa8('0x41')]['id']}})[_0x0fa8('0x23')](handleEntityNotFound(_0x3a8e7d,null))[_0x0fa8('0x23')](saveUpdates(_0x26b7f7[_0x0fa8('0x45')],null))['then'](respondWithResult(_0x3a8e7d,null))[_0x0fa8('0x40')](handleError(_0x3a8e7d,null));};exports[_0x0fa8('0x24')]=function(_0x133bb9,_0x2bd7f){return db[_0x0fa8('0x3b')]['find']({'where':{'id':_0x133bb9[_0x0fa8('0x41')]['id']}})['then'](handleEntityNotFound(_0x2bd7f,null))[_0x0fa8('0x23')](removeEntity(_0x2bd7f,null))[_0x0fa8('0x40')](handleError(_0x2bd7f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 0241bd7..7a0e3b0 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 _0xd709=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','bluebird','request-promise','path'];(function(_0x56b4ba,_0x46fb4b){var _0x134229=function(_0xcc64b5){while(--_0xcc64b5){_0x56b4ba['push'](_0x56b4ba['shift']());}};_0x134229(++_0x46fb4b);}(_0xd709,0x81));var _0x9d70=function(_0x1be9f3,_0x5f3924){_0x1be9f3=_0x1be9f3-0x0;var _0x530593=_0xd709[_0x1be9f3];return _0x530593;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9d70('0x0'));var rp=require(_0x9d70('0x1'));var fs=require('fs');var path=require(_0x9d70('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d70('0x3'));module[_0x9d70('0x4')]=function(_0x266aff,_0x56728b){return _0x266aff[_0x9d70('0x5')](_0x9d70('0x6'),attributes,{'tableName':_0x9d70('0x7'),'paranoid':![],'indexes':[{'name':_0x9d70('0x8'),'fields':[_0x9d70('0x9'),_0x9d70('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc950=['api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x186973,_0x5bb89e){var _0x28ebab=function(_0x510aa8){while(--_0x510aa8){_0x186973['push'](_0x186973['shift']());}};_0x28ebab(++_0x5bb89e);}(_0xc950,0x177));var _0x0c95=function(_0x3f25c8,_0x5a9402){_0x3f25c8=_0x3f25c8-0x0;var _0x315c75=_0xc950[_0x3f25c8];return _0x315c75;};'use strict';var _=require(_0x0c95('0x0'));var util=require(_0x0c95('0x1'));var logger=require(_0x0c95('0x2'))(_0x0c95('0x3'));var moment=require(_0x0c95('0x4'));var BPromise=require('bluebird');var rp=require(_0x0c95('0x5'));var fs=require('fs');var path=require(_0x0c95('0x6'));var rimraf=require(_0x0c95('0x7'));var config=require(_0x0c95('0x8'));var attributes=require(_0x0c95('0x9'));module['exports']=function(_0x25513d,_0x52db7b){return _0x25513d['define'](_0x0c95('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x0c95('0xb'),'fields':[_0x0c95('0xc'),_0x0c95('0xd')],'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 098b167..7829147 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 _0xb7ba=['error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x52e128,_0x42f4d0){var _0x5436cb=function(_0x1236a9){while(--_0x1236a9){_0x52e128['push'](_0x52e128['shift']());}};_0x5436cb(++_0x42f4d0);}(_0xb7ba,0xb9));var _0xab7b=function(_0x2d04a6,_0x5bbf0a){_0x2d04a6=_0x2d04a6-0x0;var _0x3cd00e=_0xb7ba[_0x2d04a6];return _0x3cd00e;};'use strict';var _=require(_0xab7b('0x0'));var util=require('util');var moment=require(_0xab7b('0x1'));var BPromise=require('bluebird');var rs=require(_0xab7b('0x2'));var fs=require('fs');var Redis=require(_0xab7b('0x3'));var db=require(_0xab7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xab7b('0x5'))(_0xab7b('0x6'));var config=require('../../config/environment');var jayson=require(_0xab7b('0x7'));var client=jayson[_0xab7b('0x8')][_0xab7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16ba31,_0x5772a0,_0x1f3583){return new BPromise(function(_0x2532a7,_0x35b8c7){return client[_0xab7b('0xa')](_0x16ba31,_0x1f3583)['then'](function(_0x3fd34d){logger['info'](_0xab7b('0xb'),_0x5772a0,_0xab7b('0xc'));logger[_0xab7b('0xd')](_0xab7b('0xe'),_0x5772a0,_0xab7b('0xc'),JSON['stringify'](_0x3fd34d));if(_0x3fd34d[_0xab7b('0xf')]){if(_0x3fd34d[_0xab7b('0xf')]['code']===0x1f4){logger['error'](_0xab7b('0xb'),_0x5772a0,_0x3fd34d[_0xab7b('0xf')][_0xab7b('0x10')]);return _0x35b8c7(_0x3fd34d[_0xab7b('0xf')]['message']);}logger[_0xab7b('0xf')]('SalesforceField,\x20%s,\x20%s',_0x5772a0,_0x3fd34d['error'][_0xab7b('0x10')]);return _0x2532a7(_0x3fd34d[_0xab7b('0xf')][_0xab7b('0x10')]);}else{logger[_0xab7b('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5772a0,'request\x20sent');_0x2532a7(_0x3fd34d[_0xab7b('0x12')][_0xab7b('0x10')]);}})[_0xab7b('0x13')](function(_0xb3a58e){logger[_0xab7b('0xf')](_0xab7b('0xb'),_0x5772a0,_0xb3a58e);_0x35b8c7(_0xb3a58e);});});} \ No newline at end of file +var _0x4b07=['request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x4b07,0x80));var _0x74b0=function(_0x42eed7,_0x308dcc){_0x42eed7=_0x42eed7-0x0;var _0x40cef4=_0x4b07[_0x42eed7];return _0x40cef4;};'use strict';var _=require(_0x74b0('0x0'));var util=require(_0x74b0('0x1'));var moment=require(_0x74b0('0x2'));var BPromise=require(_0x74b0('0x3'));var rs=require(_0x74b0('0x4'));var fs=require('fs');var Redis=require(_0x74b0('0x5'));var db=require(_0x74b0('0x6'))['db'];var utils=require(_0x74b0('0x7'));var logger=require('../../config/logger')(_0x74b0('0x8'));var config=require(_0x74b0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x74b0('0xa')][_0x74b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b7abe,_0x56abb2,_0x240c44){return new BPromise(function(_0x4c5de4,_0x1f7c43){return client[_0x74b0('0xc')](_0x4b7abe,_0x240c44)[_0x74b0('0xd')](function(_0xf38564){logger[_0x74b0('0xe')](_0x74b0('0xf'),_0x56abb2,_0x74b0('0x10'));logger[_0x74b0('0x11')](_0x74b0('0x12'),_0x56abb2,_0x74b0('0x10'),JSON['stringify'](_0xf38564));if(_0xf38564[_0x74b0('0x13')]){if(_0xf38564[_0x74b0('0x13')][_0x74b0('0x14')]===0x1f4){logger[_0x74b0('0x13')](_0x74b0('0xf'),_0x56abb2,_0xf38564[_0x74b0('0x13')]['message']);return _0x1f7c43(_0xf38564[_0x74b0('0x13')][_0x74b0('0x15')]);}logger[_0x74b0('0x13')]('SalesforceField,\x20%s,\x20%s',_0x56abb2,_0xf38564[_0x74b0('0x13')][_0x74b0('0x15')]);return _0x4c5de4(_0xf38564[_0x74b0('0x13')][_0x74b0('0x15')]);}else{logger['info'](_0x74b0('0xf'),_0x56abb2,'request\x20sent');_0x4c5de4(_0xf38564[_0x74b0('0x16')][_0x74b0('0x15')]);}})[_0x74b0('0x17')](function(_0x43782c){logger[_0x74b0('0x13')](_0x74b0('0xf'),_0x56abb2,_0x43782c);_0x1f7c43(_0x43782c);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 286e3e8..2f1c097 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 _0x6611=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6611,0xdd));var _0x1661=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6611[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x1661('0x0'));var path=require(_0x1661('0x1'));var timeout=require(_0x1661('0x2'));var express=require(_0x1661('0x3'));var router=express[_0x1661('0x4')]();var fs_extra=require(_0x1661('0x5'));var auth=require(_0x1661('0x6'));var interaction=require(_0x1661('0x7'));var config=require(_0x1661('0x8'));var controller=require(_0x1661('0x9'));router[_0x1661('0xa')]('/',auth[_0x1661('0xb')](),controller['index']);router['get'](_0x1661('0xc'),auth[_0x1661('0xb')](),controller['show']);router['get'](_0x1661('0xd'),auth[_0x1661('0xb')](),controller[_0x1661('0xe')]);router[_0x1661('0xa')](_0x1661('0xf'),auth[_0x1661('0xb')](),controller[_0x1661('0x10')]);router[_0x1661('0x11')]('/',auth['isAuthenticated'](),controller[_0x1661('0x12')]);router[_0x1661('0x11')]('/:id/configurations',auth[_0x1661('0xb')](),controller['addConfiguration']);router[_0x1661('0x13')](_0x1661('0xc'),auth[_0x1661('0xb')](),controller[_0x1661('0x14')]);router[_0x1661('0x15')](_0x1661('0xc'),auth[_0x1661('0xb')](),controller[_0x1661('0x16')]);module[_0x1661('0x17')]=router; \ No newline at end of file +var _0xf491=['../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','/:id/configurations','isAuthenticated','/:id/fields','getFields','create','post','put','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x4d6a8c,_0x48758c){var _0x1ee549=function(_0x476312){while(--_0x476312){_0x4d6a8c['push'](_0x4d6a8c['shift']());}};_0x1ee549(++_0x48758c);}(_0xf491,0x178));var _0x1f49=function(_0x32c5f9,_0x4b6d8b){_0x32c5f9=_0x32c5f9-0x0;var _0x17d315=_0xf491[_0x32c5f9];return _0x17d315;};'use strict';var multer=require(_0x1f49('0x0'));var util=require(_0x1f49('0x1'));var path=require(_0x1f49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f49('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f49('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f49('0x5'));var controller=require(_0x1f49('0x6'));router[_0x1f49('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1f49('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1f49('0x7')](_0x1f49('0x8'),auth[_0x1f49('0x9')](),controller['getConfigurations']);router[_0x1f49('0x7')](_0x1f49('0xa'),auth[_0x1f49('0x9')](),controller[_0x1f49('0xb')]);router['post']('/',auth[_0x1f49('0x9')](),controller[_0x1f49('0xc')]);router[_0x1f49('0xd')](_0x1f49('0x8'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1f49('0xe')](_0x1f49('0xf'),auth[_0x1f49('0x9')](),controller[_0x1f49('0x10')]);router[_0x1f49('0x11')](_0x1f49('0xf'),auth[_0x1f49('0x9')](),controller[_0x1f49('0x12')]);module[_0x1f49('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 031c02d..93452d3 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 _0x1e65=['username','sequelize','exports','STRING'];(function(_0x55187e,_0x5ca602){var _0x24c013=function(_0x210827){while(--_0x210827){_0x55187e['push'](_0x55187e['shift']());}};_0x24c013(++_0x5ca602);}(_0x1e65,0xed));var _0x51e6=function(_0x25daf1,_0x4f71a7){_0x25daf1=_0x25daf1-0x0;var _0x305a58=_0x1e65[_0x25daf1];return _0x305a58;};'use strict';var Sequelize=require(_0x51e6('0x0'));module[_0x51e6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x51e6('0x2')]},'username':{'type':Sequelize[_0x51e6('0x2')],'unique':_0x51e6('0x3')},'password':{'type':Sequelize[_0x51e6('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x51e6('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe78a=['sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe78a,0x87));var _0xae78=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe78a[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xae78('0x0'));module[_0xae78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xae78('0x2')]},'username':{'type':Sequelize[_0xae78('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xae78('0x2')]},'email':{'type':Sequelize[_0xae78('0x2')]},'remoteUri':{'type':Sequelize[_0xae78('0x2')],'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 98757ec..6a83f76 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 _0x2122=['update','then','destroy','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','length','create','body','find','getConfigurations','findOne','ServicenowConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','ServicenowField','knowledge','subcategory','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','sys_updated_by','user_input','sys_created_on','state','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','close_code','correlation_display','delivery_task','work_start','assignment_group','description','calendar_duration','notify','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','format','%s/api/now/table/','incident?sysparm_display_value=all','result','log','remove','includes','forEach','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','true','False','GET','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x2122,0x91));var _0x2212=function(_0x55cc6a,_0x5dbd65){_0x55cc6a=_0x55cc6a-0x0;var _0x26e2cd=_0x2122[_0x55cc6a];return _0x26e2cd;};'use strict';var emlformat=require(_0x2212('0x0'));var rimraf=require(_0x2212('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2212('0x2'));var moment=require(_0x2212('0x3'));var BPromise=require(_0x2212('0x4'));var Mustache=require(_0x2212('0x5'));var util=require('util');var path=require(_0x2212('0x6'));var sox=require(_0x2212('0x7'));var csv=require(_0x2212('0x8'));var ejs=require(_0x2212('0x9'));var fs=require('fs');var fs_extra=require(_0x2212('0xa'));var _=require(_0x2212('0xb'));var squel=require('squel');var crypto=require(_0x2212('0xc'));var jsforce=require(_0x2212('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2212('0xe'));var Papa=require(_0x2212('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2212('0x10'));var as=require(_0x2212('0x11'));var hardwareService=require(_0x2212('0x12'));var logger=require(_0x2212('0x13'))('api');var utils=require(_0x2212('0x14'));var config=require(_0x2212('0x15'));var licenseUtil=require(_0x2212('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2212('0x17'));function respondWithStatusCode(_0x424e36,_0xf6ca58){_0xf6ca58=_0xf6ca58||0xcc;return function(_0x2434ac){if(_0x2434ac){return _0x424e36['sendStatus'](_0xf6ca58);}return _0x424e36[_0x2212('0x18')](_0xf6ca58)[_0x2212('0x19')]();};}function respondWithResult(_0x242a65,_0x3be1ac){_0x3be1ac=_0x3be1ac||0xc8;return function(_0x5785f8){if(_0x5785f8){return _0x242a65[_0x2212('0x18')](_0x3be1ac)[_0x2212('0x1a')](_0x5785f8);}};}function respondWithFilteredResult(_0x5155ea,_0x3cbf71){return function(_0x4f49c5){if(_0x4f49c5){var _0x3a54f0=typeof _0x3cbf71[_0x2212('0x1b')]===_0x2212('0x1c')&&typeof _0x3cbf71[_0x2212('0x1d')]===_0x2212('0x1c');var _0x4a14e9=_0x4f49c5[_0x2212('0x1e')];var _0x9b905d=_0x3a54f0?0x0:_0x3cbf71[_0x2212('0x1b')];var _0x56698d=_0x3a54f0?_0x4f49c5[_0x2212('0x1e')]:_0x3cbf71['offset']+_0x3cbf71['limit'];var _0x198a9c;if(_0x56698d>=_0x4a14e9){_0x56698d=_0x4a14e9;_0x198a9c=0xc8;}else{_0x198a9c=0xce;}_0x5155ea[_0x2212('0x18')](_0x198a9c);return _0x5155ea[_0x2212('0x1f')](_0x2212('0x20'),_0x9b905d+'-'+_0x56698d+'/'+_0x4a14e9)['json'](_0x4f49c5);}return null;};}function patchUpdates(_0x262025){return function(_0x169fa1){try{jsonpatch[_0x2212('0x21')](_0x169fa1,_0x262025,!![]);}catch(_0x411fd6){return BPromise[_0x2212('0x22')](_0x411fd6);}return _0x169fa1[_0x2212('0x23')]();};}function saveUpdates(_0x2ed7ea,_0x3f07b2){return function(_0x59e74f){if(_0x59e74f){return _0x59e74f[_0x2212('0x24')](_0x2ed7ea)[_0x2212('0x25')](function(_0x3ca24a){return _0x3ca24a;});}return null;};}function removeEntity(_0x357f87,_0x59aa07){return function(_0x54ea6e){if(_0x54ea6e){return _0x54ea6e[_0x2212('0x26')]()[_0x2212('0x25')](function(){_0x357f87[_0x2212('0x18')](0xcc)[_0x2212('0x19')]();});}};}function handleEntityNotFound(_0x242363,_0xb053e4){return function(_0x51f36c){if(!_0x51f36c){_0x242363['sendStatus'](0x194);}return _0x51f36c;};}function handleError(_0x590c90,_0x44e177){_0x44e177=_0x44e177||0x1f4;return function(_0xe6f5dd){logger[_0x2212('0x27')](_0xe6f5dd[_0x2212('0x28')]);if(_0xe6f5dd[_0x2212('0x29')]){delete _0xe6f5dd[_0x2212('0x29')];}_0x590c90[_0x2212('0x18')](_0x44e177)[_0x2212('0x2a')](_0xe6f5dd);};}exports[_0x2212('0x2b')]=function(_0x29d8b1,_0x17deeb){var _0x434aa6={},_0x174f77={},_0x5777e2={'count':0x0,'rows':[]};var _0x2143e7=_['map'](db[_0x2212('0x2c')][_0x2212('0x2d')],function(_0x1c9837){return{'name':_0x1c9837[_0x2212('0x2e')],'type':_0x1c9837[_0x2212('0x2f')][_0x2212('0x30')]};});_0x174f77[_0x2212('0x31')]=_[_0x2212('0x32')](_0x2143e7,_0x2212('0x29'));_0x174f77[_0x2212('0x33')]=_[_0x2212('0x34')](_0x29d8b1[_0x2212('0x33')]);_0x174f77[_0x2212('0x35')]=_[_0x2212('0x36')](_0x174f77[_0x2212('0x31')],_0x174f77[_0x2212('0x33')]);_0x434aa6[_0x2212('0x37')]=_[_0x2212('0x36')](_0x174f77['model'],qs[_0x2212('0x38')](_0x29d8b1['query'][_0x2212('0x38')]));_0x434aa6[_0x2212('0x37')]=_0x434aa6[_0x2212('0x37')]['length']?_0x434aa6['attributes']:_0x174f77[_0x2212('0x31')];if(!_0x29d8b1[_0x2212('0x33')][_0x2212('0x39')](_0x2212('0x3a'))){_0x434aa6[_0x2212('0x1d')]=qs['limit'](_0x29d8b1[_0x2212('0x33')][_0x2212('0x1d')]);_0x434aa6[_0x2212('0x1b')]=qs['offset'](_0x29d8b1[_0x2212('0x33')][_0x2212('0x1b')]);}_0x434aa6[_0x2212('0x3b')]=qs[_0x2212('0x3c')](_0x29d8b1[_0x2212('0x33')][_0x2212('0x3c')]);_0x434aa6['where']=qs[_0x2212('0x35')](_[_0x2212('0x3d')](_0x29d8b1['query'],_0x174f77[_0x2212('0x35')]),_0x2143e7);if(_0x29d8b1[_0x2212('0x33')][_0x2212('0x3e')]){_0x434aa6['where']=_[_0x2212('0x3f')](_0x434aa6['where'],{'$or':_[_0x2212('0x32')](_0x2143e7,function(_0x1f2916){if(_0x1f2916[_0x2212('0x2f')]!==_0x2212('0x40')){var _0x5e9bd5={};_0x5e9bd5[_0x1f2916['name']]={'$like':'%'+_0x29d8b1[_0x2212('0x33')][_0x2212('0x3e')]+'%'};return _0x5e9bd5;}})});}_0x434aa6=_[_0x2212('0x3f')]({},_0x434aa6,_0x29d8b1[_0x2212('0x41')]);var _0x2a2c64={'where':_0x434aa6[_0x2212('0x42')]};return db[_0x2212('0x2c')][_0x2212('0x1e')](_0x2a2c64)[_0x2212('0x25')](function(_0x3b9013){_0x5777e2[_0x2212('0x1e')]=_0x3b9013;if(_0x29d8b1[_0x2212('0x33')][_0x2212('0x43')]){_0x434aa6[_0x2212('0x44')]=[{'all':!![]}];}return db[_0x2212('0x2c')][_0x2212('0x45')](_0x434aa6);})[_0x2212('0x25')](function(_0x5da28b){_0x5777e2[_0x2212('0x46')]=_0x5da28b;return _0x5777e2;})[_0x2212('0x25')](respondWithFilteredResult(_0x17deeb,_0x434aa6))[_0x2212('0x47')](handleError(_0x17deeb,null));};exports['show']=function(_0x783b0,_0x40e780){var _0x314f4d={'raw':![],'where':{'id':_0x783b0[_0x2212('0x48')]['id']}},_0x273263={};_0x273263[_0x2212('0x31')]=_[_0x2212('0x34')](db[_0x2212('0x2c')]['rawAttributes']);_0x273263[_0x2212('0x33')]=_['keys'](_0x783b0[_0x2212('0x33')]);_0x273263[_0x2212('0x35')]=_['intersection'](_0x273263['model'],_0x273263[_0x2212('0x33')]);_0x314f4d[_0x2212('0x37')]=_[_0x2212('0x36')](_0x273263[_0x2212('0x31')],qs['fields'](_0x783b0[_0x2212('0x33')][_0x2212('0x38')]));_0x314f4d[_0x2212('0x37')]=_0x314f4d[_0x2212('0x37')][_0x2212('0x49')]?_0x314f4d[_0x2212('0x37')]:_0x273263[_0x2212('0x31')];if(_0x783b0['query'][_0x2212('0x43')]){_0x314f4d[_0x2212('0x44')]=[{'all':!![]}];}_0x314f4d=_[_0x2212('0x3f')]({},_0x314f4d,_0x783b0[_0x2212('0x41')]);return db[_0x2212('0x2c')]['find'](_0x314f4d)[_0x2212('0x25')](handleEntityNotFound(_0x40e780,null))[_0x2212('0x25')](respondWithResult(_0x40e780,null))[_0x2212('0x47')](handleError(_0x40e780,null));};exports[_0x2212('0x4a')]=function(_0x450c79,_0x27cf11){return db[_0x2212('0x2c')]['create'](_0x450c79[_0x2212('0x4b')],{})[_0x2212('0x25')](respondWithResult(_0x27cf11,0xc9))[_0x2212('0x47')](handleError(_0x27cf11,null));};exports[_0x2212('0x24')]=function(_0x100b56,_0x47025a){if(_0x100b56[_0x2212('0x4b')]['id']){delete _0x100b56[_0x2212('0x4b')]['id'];}return db[_0x2212('0x2c')][_0x2212('0x4c')]({'where':{'id':_0x100b56['params']['id']}})[_0x2212('0x25')](handleEntityNotFound(_0x47025a,null))['then'](saveUpdates(_0x100b56[_0x2212('0x4b')],null))[_0x2212('0x25')](respondWithResult(_0x47025a,null))['catch'](handleError(_0x47025a,null));};exports['destroy']=function(_0x457e88,_0xe2efbf){return db[_0x2212('0x2c')][_0x2212('0x4c')]({'where':{'id':_0x457e88['params']['id']}})['then'](handleEntityNotFound(_0xe2efbf,null))[_0x2212('0x25')](removeEntity(_0xe2efbf,null))['catch'](handleError(_0xe2efbf,null));};exports[_0x2212('0x4d')]=function(_0x5a6e24,_0x5a32e5,_0x46d3f4){var _0x135a40={};var _0x38e056={};var _0x1859a6;var _0x4ee3b2;return db[_0x2212('0x2c')][_0x2212('0x4e')]({'where':{'id':_0x5a6e24['params']['id']}})[_0x2212('0x25')](handleEntityNotFound(_0x5a32e5,null))[_0x2212('0x25')](function(_0x4876c6){if(_0x4876c6){_0x1859a6=_0x4876c6;_0x38e056[_0x2212('0x31')]=_[_0x2212('0x34')](db[_0x2212('0x4f')][_0x2212('0x2d')]);_0x38e056[_0x2212('0x33')]=_[_0x2212('0x34')](_0x5a6e24[_0x2212('0x33')]);_0x38e056[_0x2212('0x35')]=_[_0x2212('0x36')](_0x38e056[_0x2212('0x31')],_0x38e056[_0x2212('0x33')]);_0x135a40['attributes']=_[_0x2212('0x36')](_0x38e056[_0x2212('0x31')],qs[_0x2212('0x38')](_0x5a6e24['query'][_0x2212('0x38')]));_0x135a40[_0x2212('0x37')]=_0x135a40['attributes'][_0x2212('0x49')]?_0x135a40['attributes']:_0x38e056[_0x2212('0x31')];_0x135a40['order']=qs[_0x2212('0x3c')](_0x5a6e24[_0x2212('0x33')][_0x2212('0x3c')]);_0x135a40[_0x2212('0x42')]=qs[_0x2212('0x35')](_[_0x2212('0x3d')](_0x5a6e24[_0x2212('0x33')],_0x38e056[_0x2212('0x35')]));if(_0x5a6e24[_0x2212('0x33')][_0x2212('0x3e')]){_0x135a40[_0x2212('0x42')]=_[_0x2212('0x3f')](_0x135a40[_0x2212('0x42')],{'$or':_[_0x2212('0x32')](_0x135a40[_0x2212('0x37')],function(_0x174c2f){var _0x3aae61={};_0x3aae61[_0x174c2f]={'$like':'%'+_0x5a6e24['query']['filter']+'%'};return _0x3aae61;})});}_0x135a40=_[_0x2212('0x3f')]({},_0x135a40,_0x5a6e24['options']);return _0x1859a6['getConfigurations'](_0x135a40);}})[_0x2212('0x25')](function(_0x2ce1fb){if(_0x2ce1fb){_0x4ee3b2=_0x2ce1fb[_0x2212('0x49')];if(!_0x5a6e24[_0x2212('0x33')][_0x2212('0x39')](_0x2212('0x3a'))){_0x135a40[_0x2212('0x1d')]=qs[_0x2212('0x1d')](_0x5a6e24['query'][_0x2212('0x1d')]);_0x135a40[_0x2212('0x1b')]=qs[_0x2212('0x1b')](_0x5a6e24[_0x2212('0x33')][_0x2212('0x1b')]);}return _0x1859a6[_0x2212('0x4d')](_0x135a40);}})[_0x2212('0x25')](function(_0x1ceb89){if(_0x1ceb89){return _0x1ceb89?{'count':_0x4ee3b2,'rows':_0x1ceb89}:null;}})[_0x2212('0x25')](respondWithResult(_0x5a32e5,null))[_0x2212('0x47')](handleError(_0x5a32e5,null));};exports['addConfiguration']=function(_0x1206d3,_0x3304a2,_0x426f66){if(_0x1206d3[_0x2212('0x4b')]['id']){delete _0x1206d3['body']['id'];}return db['ServicenowAccount'][_0x2212('0x4e')]({'where':{'id':_0x1206d3[_0x2212('0x48')]['id']}})[_0x2212('0x25')](handleEntityNotFound(_0x3304a2,null))[_0x2212('0x25')](function(_0x4aad6a){if(_0x4aad6a){_0x1206d3['body'][_0x2212('0x50')]=_0x4aad6a['id'];_0x1206d3['body'][_0x2212('0x51')]=integrations[_0x2212('0x52')](_0x1206d3[_0x2212('0x4b')]['channel'],_0x1206d3['body']['type']);_0x1206d3[_0x2212('0x4b')][_0x2212('0x53')]=integrations[_0x2212('0x54')](_0x1206d3[_0x2212('0x4b')]['channel'],_0x1206d3[_0x2212('0x4b')][_0x2212('0x2f')]);return db['ServicenowConfiguration']['create'](_0x1206d3['body'],{'include':[{'model':db['ServicenowField'],'as':_0x2212('0x51')},{'model':db[_0x2212('0x55')],'as':_0x2212('0x53')}]});}return null;})[_0x2212('0x25')](respondWithResult(_0x3304a2,null))[_0x2212('0x47')](handleError(_0x3304a2,null));};exports['getFields']=function(_0x36cb3d,_0x173273,_0x3c460d){var _0x399498=['made_sla','hold_reason',_0x2212('0x56'),_0x2212('0x57'),'close_code','notify',_0x2212('0x58'),_0x2212('0x59'),_0x2212('0x5a')];var _0x3127f6=[_0x2212('0x5b'),_0x2212('0x5c'),_0x2212('0x5d'),_0x2212('0x5e'),_0x2212('0x5f'),_0x2212('0x60'),_0x2212('0x61'),_0x2212('0x62'),_0x2212('0x63'),'number','resolved_by',_0x2212('0x64'),'opened_by',_0x2212('0x65'),_0x2212('0x66'),'sys_domain',_0x2212('0x67'),'sys_created_by',_0x2212('0x56'),'order','calendar_stc','closed_at',_0x2212('0x68'),_0x2212('0x69'),_0x2212('0x6a'),'active',_0x2212('0x6b'),_0x2212('0x6c'),_0x2212('0x6d'),'sys_domain_path','rfc',_0x2212('0x6e'),_0x2212('0x6f'),_0x2212('0x70'),_0x2212('0x71'),_0x2212('0x72'),_0x2212('0x73'),'reopened_time',_0x2212('0x74'),_0x2212('0x75'),_0x2212('0x76'),_0x2212('0x57'),_0x2212('0x77'),'short_description',_0x2212('0x78'),_0x2212('0x79'),_0x2212('0x7a'),_0x2212('0x7b'),_0x2212('0x7c'),'business_stc','additional_assignee_list',_0x2212('0x7d'),_0x2212('0x7e'),_0x2212('0x7f'),'sys_class_name',_0x2212('0x80'),_0x2212('0x81'),_0x2212('0x82'),_0x2212('0x83'),'sys_id',_0x2212('0x84'),_0x2212('0x85'),_0x2212('0x58'),_0x2212('0x86'),'problem_id',_0x2212('0x87'),_0x2212('0x88'),'activity_due',_0x2212('0x89'),_0x2212('0x59'),_0x2212('0x8a'),_0x2212('0x8b'),_0x2212('0x8c'),'comments_and_work_notes',_0x2212('0x8d'),_0x2212('0x8e'),_0x2212('0x8f'),_0x2212('0x90'),_0x2212('0x91'),_0x2212('0x92'),_0x2212('0x93'),_0x2212('0x94'),'category'];var _0x59d82f='';var _0x1c361a='';var _0x8c0f28=[];var _0xe7cae9='';var _0x240d40='';var _0x47911e=[];var _0xd82f01='';var _0x11023d='';var _0x562867={};var _0x260f6e='';return db[_0x2212('0x2c')][_0x2212('0x4e')]({'where':{'id':_0x36cb3d[_0x2212('0x48')]['id']},'attributes':['id',_0x2212('0x95'),_0x2212('0x96'),_0x2212('0x97'),_0x2212('0x98'),'serverUrl']})[_0x2212('0x25')](handleEntityNotFound(_0x173273,null))[_0x2212('0x25')](function(_0x6ced48){if(_0x6ced48){_0x260f6e=_0x6ced48[_0x2212('0x98')];var _0x21d2fa=_0x260f6e[_0x2212('0x99')](-0x1);if(_0x21d2fa==='/'){_0x260f6e=_0x260f6e['substring'](0x0,_0x260f6e['lastIndexOf'](_0x21d2fa));}_0x11023d=util[_0x2212('0x9a')]('%s/api/now/doc/table/schema/',_0x260f6e);_0xd82f01=util[_0x2212('0x9a')](_0x2212('0x9b'),_0x260f6e);_0x562867={'user':_0x6ced48['username'],'pass':_0x6ced48[_0x2212('0x96')]};var _0x229a63={'method':'GET','uri':_0x11023d+_0x2212('0x9c'),'auth':_0x562867,'json':!![]};return rp(_0x229a63);}})['then'](function(_0x5d23f1){if(_0x5d23f1[_0x2212('0x9d')]['length']>0x0){_0x59d82f=_0x5d23f1['result'];}console[_0x2212('0x9e')]('incident\x20table\x20objects',_0x59d82f);_0x47911e=[];_0x1c361a=Object['assign']([],_0x59d82f);_[_0x2212('0x9f')](_0x1c361a,function(_0x36ab52){return!_0x399498[_0x2212('0xa0')](_0x36ab52[_0x2212('0x29')]);});_0x1c361a[_0x2212('0xa1')](function(_0x1cbc0b){var _0x4c799e=createFieldObject(_0xd82f01,_0x562867,_0x1cbc0b['internalType'],_0x1cbc0b[_0x2212('0x29')],_0x1cbc0b[_0x2212('0xa2')],![]);_0x47911e[_0x2212('0xa3')](_0x4c799e);});return Promise[_0x2212('0xa4')](_0x47911e);})['then'](function(_0x3fe5f8){_0x8c0f28=_0x3fe5f8;_0xe7cae9=Object[_0x2212('0xa5')]([],_0x59d82f);console[_0x2212('0x9e')](_0x2212('0xa6'),_0x59d82f);_['remove'](_0xe7cae9,function(_0x547a36){return _0x3127f6[_0x2212('0xa0')](_0x547a36[_0x2212('0x29')]);});console[_0x2212('0x9e')](_0x2212('0xa7'),_0xe7cae9);_0x47911e=[];_0xe7cae9[_0x2212('0xa1')](function(_0x1062de){var _0x297692=createFieldObject(_0xd82f01,_0x562867,_0x1062de[_0x2212('0xa8')],_0x1062de[_0x2212('0x29')],_0x1062de[_0x2212('0xa2')],!![]);_0x47911e[_0x2212('0xa3')](_0x297692);});return Promise[_0x2212('0xa4')](_0x47911e);})['then'](function(_0x501518){_0x240d40=_0x501518;var _0xf3e285=_0x8c0f28[_0x2212('0xa9')](_0x240d40);return{'count':_0xf3e285['length'],'rows':_0xf3e285};})[_0x2212('0x25')](respondWithResult(_0x173273,null))[_0x2212('0x47')](function(_0x47f0eb){console[_0x2212('0x9e')](_0x2212('0xaa')+_0x47f0eb);var _0x17b011=_0x36cb3d[_0x2212('0x33')][_0x2212('0xab')]?0x1f4:_0x47f0eb[_0x2212('0xac')]||0x1f4;logger[_0x2212('0x27')](_0x47f0eb['stack']);delete _0x47f0eb[_0x2212('0x29')];if(_0x17b011===0x191){_0x17b011=0x190;}_0x173273[_0x2212('0x18')](_0x17b011)[_0x2212('0x2a')](_0x36cb3d[_0x2212('0x33')][_0x2212('0xab')]?{'message':_0x2212('0xad'),'statusCode':_0x47f0eb[_0x2212('0xac')]}:_0x47f0eb);});};function createFieldObject(_0x20852f,_0xfc6884,_0x487d12,_0x38f139,_0x36f354,_0x41627a){return new Promise(function(_0x300bf0,_0x297af4){var _0x4758df={'id':_0x38f139,'name':_0x36f354,'custom':_0x41627a};if(_0x487d12===_0x2212('0xae')){_0x4758df[_0x2212('0x41')]=[{'name':'True','value':_0x2212('0xaf')},{'name':_0x2212('0xb0'),'value':'false'}];_0x300bf0(_0x4758df);}else{var _0xda20ae={'method':_0x2212('0xb1'),'uri':_0x20852f+_0x2212('0xb2')+_0x38f139,'auth':_0xfc6884,'json':!![]};return rp(_0xda20ae)[_0x2212('0x25')](function(_0x59905e){var _0xa0e230=[];if(_0x59905e[_0x2212('0x9d')][_0x2212('0x49')]>0x0){_0x59905e[_0x2212('0x9d')][_0x2212('0xa1')](function(_0x5ae2ff){if(_0x5ae2ff[_0x2212('0xb3')]===_0x2212('0xb4')){var _0x7b1bde={'name':_0x5ae2ff[_0x2212('0xa2')],'value':_0x5ae2ff['value']};_0xa0e230[_0x2212('0xa3')](_0x7b1bde);}});}_0x4758df['options']=_0xa0e230;if(_0x4758df[_0x2212('0x41')][_0x2212('0x49')]>0x0){_0x300bf0(_0x4758df);}else{if(_0x41627a==![]){_0x300bf0();}else{_0x300bf0(_0x4758df);}}});}});} \ No newline at end of file +var _0xc875=['username','password','email','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','remove','includes','forEach','internalType','label','push','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','test','statusCode','Wrong\x20credentials','true','false','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_domain','state','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','rfc','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','work_notes','short_description','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location'];(function(_0x26277c,_0x485dc3){var _0x401e71=function(_0x2d31e5){while(--_0x2d31e5){_0x26277c['push'](_0x26277c['shift']());}};_0x401e71(++_0x485dc3);}(_0xc875,0xd2));var _0x5c87=function(_0x14f8da,_0x58d9d0){_0x14f8da=_0x14f8da-0x0;var _0xcf0a98=_0xc875[_0x14f8da];return _0xcf0a98;};'use strict';var emlformat=require(_0x5c87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c87('0x1'));var jsonpatch=require(_0x5c87('0x2'));var rp=require(_0x5c87('0x3'));var moment=require('moment');var BPromise=require(_0x5c87('0x4'));var Mustache=require(_0x5c87('0x5'));var util=require(_0x5c87('0x6'));var path=require(_0x5c87('0x7'));var sox=require(_0x5c87('0x8'));var csv=require(_0x5c87('0x9'));var ejs=require(_0x5c87('0xa'));var fs=require('fs');var fs_extra=require(_0x5c87('0xb'));var _=require('lodash');var squel=require(_0x5c87('0xc'));var crypto=require(_0x5c87('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5c87('0xe'));var toCsv=require(_0x5c87('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c87('0xf'));var authService=require(_0x5c87('0x10'));var qs=require(_0x5c87('0x11'));var as=require(_0x5c87('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c87('0x13'))('api');var utils=require(_0x5c87('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5c87('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x379c65,_0x5d3336){_0x5d3336=_0x5d3336||0xcc;return function(_0x589fb3){if(_0x589fb3){return _0x379c65['sendStatus'](_0x5d3336);}return _0x379c65['status'](_0x5d3336)[_0x5c87('0x16')]();};}function respondWithResult(_0x45365f,_0x2475bf){_0x2475bf=_0x2475bf||0xc8;return function(_0x2d522f){if(_0x2d522f){return _0x45365f[_0x5c87('0x17')](_0x2475bf)[_0x5c87('0x18')](_0x2d522f);}};}function respondWithFilteredResult(_0x39c14b,_0xa9d87a){return function(_0x408a5){if(_0x408a5){var _0x5b0027=typeof _0xa9d87a['offset']===_0x5c87('0x19')&&typeof _0xa9d87a[_0x5c87('0x1a')]===_0x5c87('0x19');var _0x942310=_0x408a5[_0x5c87('0x1b')];var _0x46376c=_0x5b0027?0x0:_0xa9d87a['offset'];var _0x3e6d47=_0x5b0027?_0x408a5[_0x5c87('0x1b')]:_0xa9d87a[_0x5c87('0x1c')]+_0xa9d87a[_0x5c87('0x1a')];var _0x4e4274;if(_0x3e6d47>=_0x942310){_0x3e6d47=_0x942310;_0x4e4274=0xc8;}else{_0x4e4274=0xce;}_0x39c14b[_0x5c87('0x17')](_0x4e4274);return _0x39c14b['set'](_0x5c87('0x1d'),_0x46376c+'-'+_0x3e6d47+'/'+_0x942310)['json'](_0x408a5);}return null;};}function patchUpdates(_0x5bbbf3){return function(_0x24acf2){try{jsonpatch['apply'](_0x24acf2,_0x5bbbf3,!![]);}catch(_0x2e7545){return BPromise[_0x5c87('0x1e')](_0x2e7545);}return _0x24acf2[_0x5c87('0x1f')]();};}function saveUpdates(_0x4aba41,_0x184d5a){return function(_0x5d93e4){if(_0x5d93e4){return _0x5d93e4[_0x5c87('0x20')](_0x4aba41)[_0x5c87('0x21')](function(_0x42b47b){return _0x42b47b;});}return null;};}function removeEntity(_0x49377b,_0x47cd85){return function(_0x4a6bff){if(_0x4a6bff){return _0x4a6bff[_0x5c87('0x22')]()[_0x5c87('0x21')](function(){_0x49377b[_0x5c87('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x413998,_0x3df577){return function(_0x51bd63){if(!_0x51bd63){_0x413998[_0x5c87('0x23')](0x194);}return _0x51bd63;};}function handleError(_0x564ce3,_0x5f5390){_0x5f5390=_0x5f5390||0x1f4;return function(_0x5d7357){logger[_0x5c87('0x24')](_0x5d7357[_0x5c87('0x25')]);if(_0x5d7357['name']){delete _0x5d7357[_0x5c87('0x26')];}_0x564ce3[_0x5c87('0x17')](_0x5f5390)[_0x5c87('0x27')](_0x5d7357);};}exports['index']=function(_0x555ef2,_0x2f94c0){var _0x6ff97d={},_0x4cc666={},_0x59a673={'count':0x0,'rows':[]};var _0x5b0875=_[_0x5c87('0x28')](db[_0x5c87('0x29')][_0x5c87('0x2a')],function(_0x55973f){return{'name':_0x55973f[_0x5c87('0x2b')],'type':_0x55973f[_0x5c87('0x2c')][_0x5c87('0x2d')]};});_0x4cc666[_0x5c87('0x2e')]=_[_0x5c87('0x28')](_0x5b0875,_0x5c87('0x26'));_0x4cc666[_0x5c87('0x2f')]=_[_0x5c87('0x30')](_0x555ef2[_0x5c87('0x2f')]);_0x4cc666['filters']=_[_0x5c87('0x31')](_0x4cc666['model'],_0x4cc666[_0x5c87('0x2f')]);_0x6ff97d[_0x5c87('0x32')]=_[_0x5c87('0x31')](_0x4cc666['model'],qs[_0x5c87('0x33')](_0x555ef2[_0x5c87('0x2f')][_0x5c87('0x33')]));_0x6ff97d[_0x5c87('0x32')]=_0x6ff97d[_0x5c87('0x32')][_0x5c87('0x34')]?_0x6ff97d[_0x5c87('0x32')]:_0x4cc666[_0x5c87('0x2e')];if(!_0x555ef2[_0x5c87('0x2f')][_0x5c87('0x35')](_0x5c87('0x36'))){_0x6ff97d[_0x5c87('0x1a')]=qs[_0x5c87('0x1a')](_0x555ef2[_0x5c87('0x2f')][_0x5c87('0x1a')]);_0x6ff97d[_0x5c87('0x1c')]=qs[_0x5c87('0x1c')](_0x555ef2['query'][_0x5c87('0x1c')]);}_0x6ff97d[_0x5c87('0x37')]=qs[_0x5c87('0x38')](_0x555ef2['query']['sort']);_0x6ff97d['where']=qs[_0x5c87('0x39')](_[_0x5c87('0x3a')](_0x555ef2['query'],_0x4cc666[_0x5c87('0x39')]),_0x5b0875);if(_0x555ef2[_0x5c87('0x2f')]['filter']){_0x6ff97d[_0x5c87('0x3b')]=_[_0x5c87('0x3c')](_0x6ff97d['where'],{'$or':_[_0x5c87('0x28')](_0x5b0875,function(_0x5b80cb){if(_0x5b80cb[_0x5c87('0x2c')]!=='VIRTUAL'){var _0x3026fd={};_0x3026fd[_0x5b80cb[_0x5c87('0x26')]]={'$like':'%'+_0x555ef2[_0x5c87('0x2f')][_0x5c87('0x3d')]+'%'};return _0x3026fd;}})});}_0x6ff97d=_[_0x5c87('0x3c')]({},_0x6ff97d,_0x555ef2['options']);var _0x264f05={'where':_0x6ff97d[_0x5c87('0x3b')]};return db[_0x5c87('0x29')][_0x5c87('0x1b')](_0x264f05)[_0x5c87('0x21')](function(_0x29be24){_0x59a673[_0x5c87('0x1b')]=_0x29be24;if(_0x555ef2[_0x5c87('0x2f')][_0x5c87('0x3e')]){_0x6ff97d[_0x5c87('0x3f')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x5c87('0x40')](_0x6ff97d);})[_0x5c87('0x21')](function(_0x46813e){_0x59a673[_0x5c87('0x41')]=_0x46813e;return _0x59a673;})[_0x5c87('0x21')](respondWithFilteredResult(_0x2f94c0,_0x6ff97d))[_0x5c87('0x42')](handleError(_0x2f94c0,null));};exports[_0x5c87('0x43')]=function(_0x12720a,_0xd7d9bb){var _0x1272fb={'raw':![],'where':{'id':_0x12720a[_0x5c87('0x44')]['id']}},_0x483650={};_0x483650['model']=_[_0x5c87('0x30')](db[_0x5c87('0x29')]['rawAttributes']);_0x483650[_0x5c87('0x2f')]=_[_0x5c87('0x30')](_0x12720a['query']);_0x483650[_0x5c87('0x39')]=_['intersection'](_0x483650[_0x5c87('0x2e')],_0x483650[_0x5c87('0x2f')]);_0x1272fb['attributes']=_[_0x5c87('0x31')](_0x483650[_0x5c87('0x2e')],qs[_0x5c87('0x33')](_0x12720a['query'][_0x5c87('0x33')]));_0x1272fb[_0x5c87('0x32')]=_0x1272fb[_0x5c87('0x32')]['length']?_0x1272fb[_0x5c87('0x32')]:_0x483650[_0x5c87('0x2e')];if(_0x12720a[_0x5c87('0x2f')]['includeAll']){_0x1272fb[_0x5c87('0x3f')]=[{'all':!![]}];}_0x1272fb=_[_0x5c87('0x3c')]({},_0x1272fb,_0x12720a[_0x5c87('0x45')]);return db['ServicenowAccount'][_0x5c87('0x46')](_0x1272fb)['then'](handleEntityNotFound(_0xd7d9bb,null))[_0x5c87('0x21')](respondWithResult(_0xd7d9bb,null))[_0x5c87('0x42')](handleError(_0xd7d9bb,null));};exports[_0x5c87('0x47')]=function(_0x2f759f,_0x57ab1e){return db[_0x5c87('0x29')][_0x5c87('0x47')](_0x2f759f[_0x5c87('0x48')],{})['then'](respondWithResult(_0x57ab1e,0xc9))[_0x5c87('0x42')](handleError(_0x57ab1e,null));};exports[_0x5c87('0x20')]=function(_0x460123,_0x48e9eb){if(_0x460123[_0x5c87('0x48')]['id']){delete _0x460123[_0x5c87('0x48')]['id'];}return db[_0x5c87('0x29')][_0x5c87('0x46')]({'where':{'id':_0x460123[_0x5c87('0x44')]['id']}})['then'](handleEntityNotFound(_0x48e9eb,null))['then'](saveUpdates(_0x460123[_0x5c87('0x48')],null))[_0x5c87('0x21')](respondWithResult(_0x48e9eb,null))[_0x5c87('0x42')](handleError(_0x48e9eb,null));};exports[_0x5c87('0x22')]=function(_0x1decf4,_0x184377){return db[_0x5c87('0x29')][_0x5c87('0x46')]({'where':{'id':_0x1decf4['params']['id']}})['then'](handleEntityNotFound(_0x184377,null))[_0x5c87('0x21')](removeEntity(_0x184377,null))['catch'](handleError(_0x184377,null));};exports[_0x5c87('0x49')]=function(_0x19d3f8,_0x49834e,_0x5030d9){var _0x340a2f={};var _0x1c587f={};var _0x338049;var _0x42e3ef;return db[_0x5c87('0x29')][_0x5c87('0x4a')]({'where':{'id':_0x19d3f8[_0x5c87('0x44')]['id']}})[_0x5c87('0x21')](handleEntityNotFound(_0x49834e,null))[_0x5c87('0x21')](function(_0x242c6f){if(_0x242c6f){_0x338049=_0x242c6f;_0x1c587f[_0x5c87('0x2e')]=_[_0x5c87('0x30')](db[_0x5c87('0x4b')][_0x5c87('0x2a')]);_0x1c587f[_0x5c87('0x2f')]=_[_0x5c87('0x30')](_0x19d3f8[_0x5c87('0x2f')]);_0x1c587f[_0x5c87('0x39')]=_[_0x5c87('0x31')](_0x1c587f[_0x5c87('0x2e')],_0x1c587f[_0x5c87('0x2f')]);_0x340a2f['attributes']=_['intersection'](_0x1c587f[_0x5c87('0x2e')],qs[_0x5c87('0x33')](_0x19d3f8[_0x5c87('0x2f')]['fields']));_0x340a2f[_0x5c87('0x32')]=_0x340a2f[_0x5c87('0x32')][_0x5c87('0x34')]?_0x340a2f[_0x5c87('0x32')]:_0x1c587f[_0x5c87('0x2e')];_0x340a2f['order']=qs[_0x5c87('0x38')](_0x19d3f8[_0x5c87('0x2f')]['sort']);_0x340a2f[_0x5c87('0x3b')]=qs[_0x5c87('0x39')](_[_0x5c87('0x3a')](_0x19d3f8[_0x5c87('0x2f')],_0x1c587f['filters']));if(_0x19d3f8[_0x5c87('0x2f')][_0x5c87('0x3d')]){_0x340a2f[_0x5c87('0x3b')]=_[_0x5c87('0x3c')](_0x340a2f[_0x5c87('0x3b')],{'$or':_['map'](_0x340a2f[_0x5c87('0x32')],function(_0x171f4b){var _0x54b83c={};_0x54b83c[_0x171f4b]={'$like':'%'+_0x19d3f8['query'][_0x5c87('0x3d')]+'%'};return _0x54b83c;})});}_0x340a2f=_[_0x5c87('0x3c')]({},_0x340a2f,_0x19d3f8[_0x5c87('0x45')]);return _0x338049[_0x5c87('0x49')](_0x340a2f);}})['then'](function(_0x333a21){if(_0x333a21){_0x42e3ef=_0x333a21[_0x5c87('0x34')];if(!_0x19d3f8[_0x5c87('0x2f')][_0x5c87('0x35')](_0x5c87('0x36'))){_0x340a2f[_0x5c87('0x1a')]=qs[_0x5c87('0x1a')](_0x19d3f8[_0x5c87('0x2f')][_0x5c87('0x1a')]);_0x340a2f[_0x5c87('0x1c')]=qs[_0x5c87('0x1c')](_0x19d3f8[_0x5c87('0x2f')][_0x5c87('0x1c')]);}return _0x338049['getConfigurations'](_0x340a2f);}})[_0x5c87('0x21')](function(_0x1fb7e6){if(_0x1fb7e6){return _0x1fb7e6?{'count':_0x42e3ef,'rows':_0x1fb7e6}:null;}})['then'](respondWithResult(_0x49834e,null))[_0x5c87('0x42')](handleError(_0x49834e,null));};exports[_0x5c87('0x4c')]=function(_0x130857,_0x5addf4,_0x391b38){if(_0x130857[_0x5c87('0x48')]['id']){delete _0x130857['body']['id'];}return db[_0x5c87('0x29')][_0x5c87('0x4a')]({'where':{'id':_0x130857[_0x5c87('0x44')]['id']}})['then'](handleEntityNotFound(_0x5addf4,null))[_0x5c87('0x21')](function(_0x294c19){if(_0x294c19){_0x130857[_0x5c87('0x48')][_0x5c87('0x4d')]=_0x294c19['id'];_0x130857[_0x5c87('0x48')][_0x5c87('0x4e')]=integrations[_0x5c87('0x4f')](_0x130857[_0x5c87('0x48')][_0x5c87('0x50')],_0x130857[_0x5c87('0x48')][_0x5c87('0x2c')]);_0x130857[_0x5c87('0x48')][_0x5c87('0x51')]=integrations[_0x5c87('0x52')](_0x130857[_0x5c87('0x48')]['channel'],_0x130857[_0x5c87('0x48')][_0x5c87('0x2c')]);return db[_0x5c87('0x4b')][_0x5c87('0x47')](_0x130857['body'],{'include':[{'model':db[_0x5c87('0x53')],'as':_0x5c87('0x4e')},{'model':db[_0x5c87('0x53')],'as':_0x5c87('0x51')}]});}return null;})[_0x5c87('0x21')](respondWithResult(_0x5addf4,null))[_0x5c87('0x42')](handleError(_0x5addf4,null));};exports[_0x5c87('0x54')]=function(_0x1603dd,_0x65e4fd,_0x2bfc2e){var _0x17a0a9=[_0x5c87('0x55'),_0x5c87('0x56'),_0x5c87('0x57'),_0x5c87('0x58'),_0x5c87('0x59'),_0x5c87('0x5a'),_0x5c87('0x5b'),_0x5c87('0x5c'),_0x5c87('0x5d')];var _0xfd722f=['parent',_0x5c87('0x55'),_0x5c87('0x5e'),'watch_list',_0x5c87('0x5f'),_0x5c87('0x60'),_0x5c87('0x61'),_0x5c87('0x56'),_0x5c87('0x62'),_0x5c87('0x63'),'resolved_by',_0x5c87('0x64'),_0x5c87('0x65'),_0x5c87('0x66'),'sys_created_on',_0x5c87('0x67'),_0x5c87('0x68'),'sys_created_by',_0x5c87('0x57'),_0x5c87('0x37'),'calendar_stc',_0x5c87('0x69'),_0x5c87('0x6a'),_0x5c87('0x6b'),_0x5c87('0x6c'),_0x5c87('0x6d'),'work_notes_list',_0x5c87('0x6e'),_0x5c87('0x6f'),'sys_domain_path',_0x5c87('0x70'),'time_worked',_0x5c87('0x71'),_0x5c87('0x72'),_0x5c87('0x73'),_0x5c87('0x74'),_0x5c87('0x75'),_0x5c87('0x76'),_0x5c87('0x77'),'caller_id','approval_set',_0x5c87('0x58'),_0x5c87('0x78'),_0x5c87('0x79'),'close_code','correlation_display','delivery_task','work_start',_0x5c87('0x7a'),_0x5c87('0x7b'),_0x5c87('0x7c'),_0x5c87('0x7d'),_0x5c87('0x7e'),_0x5c87('0x5a'),_0x5c87('0x7f'),_0x5c87('0x80'),_0x5c87('0x81'),_0x5c87('0x82'),'parent_incident',_0x5c87('0x83'),_0x5c87('0x84'),_0x5c87('0x85'),_0x5c87('0x5b'),_0x5c87('0x86'),'problem_id',_0x5c87('0x87'),_0x5c87('0x88'),_0x5c87('0x89'),_0x5c87('0x8a'),_0x5c87('0x5c'),'comments',_0x5c87('0x8b'),'approval',_0x5c87('0x8c'),_0x5c87('0x8d'),_0x5c87('0x8e'),_0x5c87('0x8f'),'sys_tags',_0x5c87('0x90'),_0x5c87('0x91'),_0x5c87('0x92'),_0x5c87('0x93'),_0x5c87('0x5d')];var _0x5d2d4f='';var _0x16e0f3='';var _0x30f5d4=[];var _0x18057e='';var _0x5ae4cf='';var _0x46adfa=[];var _0x22924d='';var _0x44d101='';var _0x427706={};var _0x57729c='';return db[_0x5c87('0x29')][_0x5c87('0x4a')]({'where':{'id':_0x1603dd[_0x5c87('0x44')]['id']},'attributes':['id',_0x5c87('0x94'),_0x5c87('0x95'),_0x5c87('0x96'),'remoteUri','serverUrl']})[_0x5c87('0x21')](handleEntityNotFound(_0x65e4fd,null))[_0x5c87('0x21')](function(_0x456d32){if(_0x456d32){_0x57729c=_0x456d32['remoteUri'];var _0x52e7fc=_0x57729c[_0x5c87('0x97')](-0x1);if(_0x52e7fc==='/'){_0x57729c=_0x57729c[_0x5c87('0x98')](0x0,_0x57729c[_0x5c87('0x99')](_0x52e7fc));}_0x44d101=util[_0x5c87('0x9a')](_0x5c87('0x9b'),_0x57729c);_0x22924d=util['format'](_0x5c87('0x9c'),_0x57729c);_0x427706={'user':_0x456d32[_0x5c87('0x94')],'pass':_0x456d32[_0x5c87('0x95')]};var _0x5c657c={'method':_0x5c87('0x9d'),'uri':_0x44d101+_0x5c87('0x9e'),'auth':_0x427706,'json':!![]};return rp(_0x5c657c);}})[_0x5c87('0x21')](function(_0x76f2b5){if(_0x76f2b5[_0x5c87('0x9f')][_0x5c87('0x34')]>0x0){_0x5d2d4f=_0x76f2b5[_0x5c87('0x9f')];}console[_0x5c87('0xa0')]('incident\x20table\x20objects',_0x5d2d4f);_0x46adfa=[];_0x16e0f3=Object['assign']([],_0x5d2d4f);_[_0x5c87('0xa1')](_0x16e0f3,function(_0x363b44){return!_0x17a0a9[_0x5c87('0xa2')](_0x363b44[_0x5c87('0x26')]);});_0x16e0f3[_0x5c87('0xa3')](function(_0x57885f){var _0x23900c=createFieldObject(_0x22924d,_0x427706,_0x57885f[_0x5c87('0xa4')],_0x57885f[_0x5c87('0x26')],_0x57885f[_0x5c87('0xa5')],![]);_0x46adfa[_0x5c87('0xa6')](_0x23900c);});return Promise['all'](_0x46adfa);})['then'](function(_0x2351a8){_0x30f5d4=_0x2351a8;_0x18057e=Object[_0x5c87('0xa7')]([],_0x5d2d4f);console[_0x5c87('0xa0')](_0x5c87('0xa8'),_0x5d2d4f);_[_0x5c87('0xa1')](_0x18057e,function(_0x3d7858){return _0xfd722f[_0x5c87('0xa2')](_0x3d7858[_0x5c87('0x26')]);});console[_0x5c87('0xa0')](_0x5c87('0xa9'),_0x18057e);_0x46adfa=[];_0x18057e[_0x5c87('0xa3')](function(_0x4723dd){var _0x39488b=createFieldObject(_0x22924d,_0x427706,_0x4723dd['internalType'],_0x4723dd[_0x5c87('0x26')],_0x4723dd['label'],!![]);_0x46adfa[_0x5c87('0xa6')](_0x39488b);});return Promise[_0x5c87('0xaa')](_0x46adfa);})[_0x5c87('0x21')](function(_0x263c93){_0x5ae4cf=_0x263c93;var _0x47f2b9=_0x30f5d4[_0x5c87('0xab')](_0x5ae4cf);return{'count':_0x47f2b9[_0x5c87('0x34')],'rows':_0x47f2b9};})[_0x5c87('0x21')](respondWithResult(_0x65e4fd,null))[_0x5c87('0x42')](function(_0x43377f){console[_0x5c87('0xa0')]('ServiceNow\x20error:\x20'+_0x43377f);var _0x121aee=_0x1603dd[_0x5c87('0x2f')][_0x5c87('0xac')]?0x1f4:_0x43377f[_0x5c87('0xad')]||0x1f4;logger[_0x5c87('0x24')](_0x43377f[_0x5c87('0x25')]);delete _0x43377f[_0x5c87('0x26')];if(_0x121aee===0x191){_0x121aee=0x190;}_0x65e4fd[_0x5c87('0x17')](_0x121aee)[_0x5c87('0x27')](_0x1603dd[_0x5c87('0x2f')][_0x5c87('0xac')]?{'message':_0x5c87('0xae'),'statusCode':_0x43377f[_0x5c87('0xad')]}:_0x43377f);});};function createFieldObject(_0x3f3c8b,_0x113f30,_0x252a60,_0x33216a,_0xa46bac,_0x1a0522){return new Promise(function(_0x4c4a5b,_0x3a7d56){var _0x1b2d8e={'id':_0x33216a,'name':_0xa46bac,'custom':_0x1a0522};if(_0x252a60==='boolean'){_0x1b2d8e[_0x5c87('0x45')]=[{'name':'True','value':_0x5c87('0xaf')},{'name':'False','value':_0x5c87('0xb0')}];_0x4c4a5b(_0x1b2d8e);}else{var _0x295344={'method':_0x5c87('0x9d'),'uri':_0x3f3c8b+'sys_choice?sysparm_query=name=incident^element='+_0x33216a,'auth':_0x113f30,'json':!![]};return rp(_0x295344)['then'](function(_0x33b099){var _0x34766e=[];if(_0x33b099['result']['length']>0x0){_0x33b099[_0x5c87('0x9f')][_0x5c87('0xa3')](function(_0x460938){if(_0x460938[_0x5c87('0xb1')]===_0x5c87('0xb0')){var _0x40e09c={'name':_0x460938[_0x5c87('0xa5')],'value':_0x460938[_0x5c87('0xb2')]};_0x34766e[_0x5c87('0xa6')](_0x40e09c);}});}_0x1b2d8e[_0x5c87('0x45')]=_0x34766e;if(_0x1b2d8e[_0x5c87('0x45')][_0x5c87('0x34')]>0x0){_0x4c4a5b(_0x1b2d8e);}else{if(_0x1a0522==![]){_0x4c4a5b();}else{_0x4c4a5b(_0x1b2d8e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0672e61..562752f 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 _0x4c60=['exports','define','ServicenowAccount','lodash','util','../../config/logger','api','bluebird','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x21803e,_0x5a4782){var _0x349188=function(_0x3f5862){while(--_0x3f5862){_0x21803e['push'](_0x21803e['shift']());}};_0x349188(++_0x5a4782);}(_0x4c60,0xc1));var _0x04c6=function(_0x32e934,_0x5af9d8){_0x32e934=_0x32e934-0x0;var _0x47be44=_0x4c60[_0x32e934];return _0x47be44;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('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(_0x04c6('0x5'));var integrations=require(_0x04c6('0x6'));module[_0x04c6('0x7')]=function(_0x12bd5d,_0x2b9041){return _0x12bd5d[_0x04c6('0x8')](_0x04c6('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x242884,_0x657442){var _0x1586c2=function(_0x21dc71){while(--_0x21dc71){_0x242884['push'](_0x242884['shift']());}};_0x1586c2(++_0x657442);}(_0x8958,0x93));var _0x8895=function(_0x53f3b3,_0x2bd615){_0x53f3b3=_0x53f3b3-0x0;var _0x16c538=_0x8958[_0x53f3b3];return _0x16c538;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 3b3fb7c..e3aae37 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 _0xa938=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','ServicenowAccount'];(function(_0x2adf9b,_0xa3921d){var _0x3f7bdb=function(_0x15205e){while(--_0x15205e){_0x2adf9b['push'](_0x2adf9b['shift']());}};_0x3f7bdb(++_0xa3921d);}(_0xa938,0x1ea));var _0x8a93=function(_0x29df86,_0x4422e7){_0x29df86=_0x29df86-0x0;var _0x3cb9fe=_0xa938[_0x29df86];return _0x3cb9fe;};'use strict';var _=require(_0x8a93('0x0'));var util=require('util');var moment=require(_0x8a93('0x1'));var BPromise=require(_0x8a93('0x2'));var rs=require(_0x8a93('0x3'));var fs=require('fs');var Redis=require(_0x8a93('0x4'));var db=require(_0x8a93('0x5'))['db'];var utils=require(_0x8a93('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a93('0x7'));var jayson=require(_0x8a93('0x8'));var client=jayson[_0x8a93('0x9')][_0x8a93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56feec,_0x1b2570,_0x43d62c){return new BPromise(function(_0x3866a2,_0x17bf2a){return client[_0x8a93('0xb')](_0x56feec,_0x43d62c)[_0x8a93('0xc')](function(_0x3cc46d){logger[_0x8a93('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1b2570,'request\x20sent');logger[_0x8a93('0xe')](_0x8a93('0xf'),_0x1b2570,_0x8a93('0x10'),JSON[_0x8a93('0x11')](_0x3cc46d));if(_0x3cc46d['error']){if(_0x3cc46d[_0x8a93('0x12')][_0x8a93('0x13')]===0x1f4){logger['error'](_0x8a93('0x14'),_0x1b2570,_0x3cc46d[_0x8a93('0x12')][_0x8a93('0x15')]);return _0x17bf2a(_0x3cc46d[_0x8a93('0x12')]['message']);}logger['error'](_0x8a93('0x14'),_0x1b2570,_0x3cc46d[_0x8a93('0x12')][_0x8a93('0x15')]);return _0x3866a2(_0x3cc46d['error']['message']);}else{logger[_0x8a93('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1b2570,_0x8a93('0x10'));_0x3866a2(_0x3cc46d['result']['message']);}})[_0x8a93('0x16')](function(_0x4e5712){logger['error'](_0x8a93('0x14'),_0x1b2570,_0x4e5712);_0x17bf2a(_0x4e5712);});});}exports[_0x8a93('0x17')]=function(_0x5251d9){var _0x3edf5f=this;return new Promise(function(_0x5de4a5,_0x15444c){return db['ServicenowAccount'][_0x8a93('0x18')]({'raw':_0x5251d9['options']?_0x5251d9[_0x8a93('0x19')][_0x8a93('0x1a')]===undefined?!![]:![]:!![],'where':_0x5251d9['options']?_0x5251d9[_0x8a93('0x19')][_0x8a93('0x1b')]||null:null,'attributes':_0x5251d9[_0x8a93('0x19')]?_0x5251d9[_0x8a93('0x19')][_0x8a93('0x1c')]||null:null,'limit':_0x5251d9['options']?_0x5251d9['options'][_0x8a93('0x1d')]||null:null,'include':_0x5251d9[_0x8a93('0x19')]?_0x5251d9[_0x8a93('0x19')][_0x8a93('0x1e')]?_[_0x8a93('0x1f')](_0x5251d9[_0x8a93('0x19')][_0x8a93('0x1e')],function(_0x59c1c9){return{'model':db[_0x59c1c9['model']],'as':_0x59c1c9['as'],'attributes':_0x59c1c9[_0x8a93('0x1c')],'include':_0x59c1c9[_0x8a93('0x1e')]?_[_0x8a93('0x1f')](_0x59c1c9[_0x8a93('0x1e')],function(_0x449b19){return{'model':db[_0x449b19[_0x8a93('0x20')]],'as':_0x449b19['as'],'attributes':_0x449b19['attributes'],'include':_0x449b19[_0x8a93('0x1e')]?_[_0x8a93('0x1f')](_0x449b19[_0x8a93('0x1e')],function(_0x122396){return{'model':db[_0x122396[_0x8a93('0x20')]],'as':_0x122396['as'],'attributes':_0x122396['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a93('0xc')](function(_0x2435b1){logger[_0x8a93('0xd')](_0x8a93('0x17'),_0x5251d9);logger[_0x8a93('0xe')]('GetServicenowAccount',_0x5251d9,JSON[_0x8a93('0x11')](_0x2435b1));_0x5de4a5(_0x2435b1);})[_0x8a93('0x16')](function(_0x4eafc0){logger[_0x8a93('0x12')](_0x8a93('0x17'),_0x4eafc0[_0x8a93('0x15')],_0x5251d9);_0x15444c(_0x3edf5f[_0x8a93('0x12')](0x1f4,_0x4eafc0[_0x8a93('0x15')]));});});};exports[_0x8a93('0x21')]=function(_0x301b3e){var _0x28bedf=this;return new Promise(function(_0x112935,_0x2f0e06){return db[_0x8a93('0x22')]['find']({'raw':_0x301b3e['options']?_0x301b3e[_0x8a93('0x19')][_0x8a93('0x1a')]===undefined?!![]:![]:!![],'where':_0x301b3e[_0x8a93('0x19')]?_0x301b3e['options'][_0x8a93('0x1b')]||null:null,'attributes':_0x301b3e['options']?_0x301b3e[_0x8a93('0x19')][_0x8a93('0x1c')]||null:null,'include':_0x301b3e['options']?_0x301b3e[_0x8a93('0x19')][_0x8a93('0x1e')]?_[_0x8a93('0x1f')](_0x301b3e[_0x8a93('0x19')][_0x8a93('0x1e')],function(_0x52b42d){return{'model':db[_0x52b42d[_0x8a93('0x20')]],'as':_0x52b42d['as'],'attributes':_0x52b42d['attributes'],'include':_0x52b42d[_0x8a93('0x1e')]?_[_0x8a93('0x1f')](_0x52b42d[_0x8a93('0x1e')],function(_0x5dd775){return{'model':db[_0x5dd775[_0x8a93('0x20')]],'as':_0x5dd775['as'],'attributes':_0x5dd775[_0x8a93('0x1c')],'include':_0x5dd775[_0x8a93('0x1e')]?_[_0x8a93('0x1f')](_0x5dd775[_0x8a93('0x1e')],function(_0x305b36){return{'model':db[_0x305b36['model']],'as':_0x305b36['as'],'attributes':_0x305b36[_0x8a93('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8a93('0xc')](function(_0xddd7a){logger[_0x8a93('0xd')](_0x8a93('0x21'),_0x301b3e);logger[_0x8a93('0xe')](_0x8a93('0x21'),_0x301b3e,JSON['stringify'](_0xddd7a));_0x112935(_0xddd7a);})['catch'](function(_0x23c535){logger[_0x8a93('0x12')](_0x8a93('0x21'),_0x23c535[_0x8a93('0x15')],_0x301b3e);_0x2f0e06(_0x28bedf[_0x8a93('0x12')](0x1f4,_0x23c535[_0x8a93('0x15')]));});});}; \ No newline at end of file +var _0x1bd8=['options','where','attributes','limit','include','map','model','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetServicenowAccount','ServicenowAccount','findAll'];(function(_0x1603aa,_0x4bb864){var _0x427b41=function(_0x59aecf){while(--_0x59aecf){_0x1603aa['push'](_0x1603aa['shift']());}};_0x427b41(++_0x4bb864);}(_0x1bd8,0x1e5));var _0x81bd=function(_0x168ebf,_0x4aae5b){_0x168ebf=_0x168ebf-0x0;var _0x1d2826=_0x1bd8[_0x168ebf];return _0x1d2826;};'use strict';var _=require(_0x81bd('0x0'));var util=require('util');var moment=require(_0x81bd('0x1'));var BPromise=require(_0x81bd('0x2'));var rs=require(_0x81bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81bd('0x4'))['db'];var utils=require(_0x81bd('0x5'));var logger=require(_0x81bd('0x6'))(_0x81bd('0x7'));var config=require(_0x81bd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x81bd('0x9')][_0x81bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x465cc7,_0x277422,_0x32f85b){return new BPromise(function(_0x55e8c6,_0x5aaca3){return client[_0x81bd('0xb')](_0x465cc7,_0x32f85b)[_0x81bd('0xc')](function(_0x1d9173){logger['info'](_0x81bd('0xd'),_0x277422,_0x81bd('0xe'));logger[_0x81bd('0xf')](_0x81bd('0x10'),_0x277422,_0x81bd('0xe'),JSON[_0x81bd('0x11')](_0x1d9173));if(_0x1d9173[_0x81bd('0x12')]){if(_0x1d9173[_0x81bd('0x12')]['code']===0x1f4){logger[_0x81bd('0x12')](_0x81bd('0xd'),_0x277422,_0x1d9173[_0x81bd('0x12')][_0x81bd('0x13')]);return _0x5aaca3(_0x1d9173['error'][_0x81bd('0x13')]);}logger[_0x81bd('0x12')](_0x81bd('0xd'),_0x277422,_0x1d9173[_0x81bd('0x12')][_0x81bd('0x13')]);return _0x55e8c6(_0x1d9173[_0x81bd('0x12')][_0x81bd('0x13')]);}else{logger[_0x81bd('0x14')](_0x81bd('0xd'),_0x277422,_0x81bd('0xe'));_0x55e8c6(_0x1d9173['result'][_0x81bd('0x13')]);}})[_0x81bd('0x15')](function(_0x255428){logger[_0x81bd('0x12')](_0x81bd('0xd'),_0x277422,_0x255428);_0x5aaca3(_0x255428);});});}exports[_0x81bd('0x16')]=function(_0x54874c){var _0xb6235=this;return new Promise(function(_0x3e4cb6,_0x200386){return db[_0x81bd('0x17')][_0x81bd('0x18')]({'raw':_0x54874c[_0x81bd('0x19')]?_0x54874c['options']['raw']===undefined?!![]:![]:!![],'where':_0x54874c[_0x81bd('0x19')]?_0x54874c[_0x81bd('0x19')][_0x81bd('0x1a')]||null:null,'attributes':_0x54874c['options']?_0x54874c[_0x81bd('0x19')][_0x81bd('0x1b')]||null:null,'limit':_0x54874c[_0x81bd('0x19')]?_0x54874c[_0x81bd('0x19')][_0x81bd('0x1c')]||null:null,'include':_0x54874c[_0x81bd('0x19')]?_0x54874c['options'][_0x81bd('0x1d')]?_[_0x81bd('0x1e')](_0x54874c[_0x81bd('0x19')][_0x81bd('0x1d')],function(_0x51ea41){return{'model':db[_0x51ea41[_0x81bd('0x1f')]],'as':_0x51ea41['as'],'attributes':_0x51ea41[_0x81bd('0x1b')],'include':_0x51ea41['include']?_[_0x81bd('0x1e')](_0x51ea41[_0x81bd('0x1d')],function(_0x4d246d){return{'model':db[_0x4d246d[_0x81bd('0x1f')]],'as':_0x4d246d['as'],'attributes':_0x4d246d[_0x81bd('0x1b')],'include':_0x4d246d[_0x81bd('0x1d')]?_[_0x81bd('0x1e')](_0x4d246d['include'],function(_0x327d44){return{'model':db[_0x327d44['model']],'as':_0x327d44['as'],'attributes':_0x327d44[_0x81bd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x81bd('0xc')](function(_0x56325f){logger[_0x81bd('0x14')](_0x81bd('0x16'),_0x54874c);logger['debug'](_0x81bd('0x16'),_0x54874c,JSON[_0x81bd('0x11')](_0x56325f));_0x3e4cb6(_0x56325f);})[_0x81bd('0x15')](function(_0x4de4c4){logger[_0x81bd('0x12')](_0x81bd('0x16'),_0x4de4c4['message'],_0x54874c);_0x200386(_0xb6235[_0x81bd('0x12')](0x1f4,_0x4de4c4['message']));});});};exports[_0x81bd('0x20')]=function(_0x414c6f){var _0x345420=this;return new Promise(function(_0x4ca15e,_0x3182e8){return db[_0x81bd('0x17')][_0x81bd('0x21')]({'raw':_0x414c6f[_0x81bd('0x19')]?_0x414c6f['options']['raw']===undefined?!![]:![]:!![],'where':_0x414c6f[_0x81bd('0x19')]?_0x414c6f['options'][_0x81bd('0x1a')]||null:null,'attributes':_0x414c6f[_0x81bd('0x19')]?_0x414c6f[_0x81bd('0x19')][_0x81bd('0x1b')]||null:null,'include':_0x414c6f['options']?_0x414c6f[_0x81bd('0x19')][_0x81bd('0x1d')]?_[_0x81bd('0x1e')](_0x414c6f[_0x81bd('0x19')][_0x81bd('0x1d')],function(_0x5ad202){return{'model':db[_0x5ad202['model']],'as':_0x5ad202['as'],'attributes':_0x5ad202['attributes'],'include':_0x5ad202['include']?_['map'](_0x5ad202[_0x81bd('0x1d')],function(_0x1a01a6){return{'model':db[_0x1a01a6[_0x81bd('0x1f')]],'as':_0x1a01a6['as'],'attributes':_0x1a01a6[_0x81bd('0x1b')],'include':_0x1a01a6['include']?_[_0x81bd('0x1e')](_0x1a01a6[_0x81bd('0x1d')],function(_0xc9e76f){return{'model':db[_0xc9e76f[_0x81bd('0x1f')]],'as':_0xc9e76f['as'],'attributes':_0xc9e76f[_0x81bd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x81bd('0xc')](function(_0x4ff6e7){logger[_0x81bd('0x14')](_0x81bd('0x20'),_0x414c6f);logger['debug'](_0x81bd('0x20'),_0x414c6f,JSON[_0x81bd('0x11')](_0x4ff6e7));_0x4ca15e(_0x4ff6e7);})['catch'](function(_0x42f129){logger[_0x81bd('0x12')](_0x81bd('0x20'),_0x42f129[_0x81bd('0x13')],_0x414c6f);_0x3182e8(_0x345420[_0x81bd('0x12')](0x1f4,_0x42f129[_0x81bd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 4f7649a..45aad4b 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 _0x9422=['put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x9422,0x14f));var _0x2942=function(_0x39112a,_0xb92ce6){_0x39112a=_0x39112a-0x0;var _0x26ef70=_0x9422[_0x39112a];return _0x26ef70;};'use strict';var multer=require(_0x2942('0x0'));var util=require(_0x2942('0x1'));var path=require(_0x2942('0x2'));var timeout=require('connect-timeout');var express=require(_0x2942('0x3'));var router=express[_0x2942('0x4')]();var fs_extra=require(_0x2942('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2942('0x6'));var config=require(_0x2942('0x7'));var controller=require(_0x2942('0x8'));router[_0x2942('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2942('0x9')]('/:id',auth[_0x2942('0xa')](),controller[_0x2942('0xb')]);router[_0x2942('0x9')](_0x2942('0xc'),auth[_0x2942('0xa')](),controller[_0x2942('0xd')]);router[_0x2942('0x9')](_0x2942('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2942('0x9')]('/:id/descriptions',auth[_0x2942('0xa')](),controller[_0x2942('0xf')]);router['post']('/',auth[_0x2942('0xa')](),controller[_0x2942('0x10')]);router[_0x2942('0x11')](_0x2942('0x12'),auth[_0x2942('0xa')](),controller[_0x2942('0x13')]);router['delete'](_0x2942('0x12'),auth[_0x2942('0xa')](),controller[_0x2942('0x14')]);module[_0x2942('0x15')]=router; \ No newline at end of file +var _0x5f0a=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','update','delete','/:id'];(function(_0x4c085f,_0x2dc7c5){var _0x1f9d13=function(_0x38343b){while(--_0x38343b){_0x4c085f['push'](_0x4c085f['shift']());}};_0x1f9d13(++_0x2dc7c5);}(_0x5f0a,0xe3));var _0xa5f0=function(_0x1f153f,_0x4ddd5f){_0x1f153f=_0x1f153f-0x0;var _0x46b29e=_0x5f0a[_0x1f153f];return _0x46b29e;};'use strict';var multer=require(_0xa5f0('0x0'));var util=require(_0xa5f0('0x1'));var path=require(_0xa5f0('0x2'));var timeout=require(_0xa5f0('0x3'));var express=require('express');var router=express[_0xa5f0('0x4')]();var fs_extra=require(_0xa5f0('0x5'));var auth=require(_0xa5f0('0x6'));var interaction=require(_0xa5f0('0x7'));var config=require(_0xa5f0('0x8'));var controller=require(_0xa5f0('0x9'));router[_0xa5f0('0xa')]('/',auth[_0xa5f0('0xb')](),controller['index']);router[_0xa5f0('0xa')]('/:id',auth[_0xa5f0('0xb')](),controller[_0xa5f0('0xc')]);router['get'](_0xa5f0('0xd'),auth[_0xa5f0('0xb')](),controller[_0xa5f0('0xe')]);router[_0xa5f0('0xa')]('/:id/subjects',auth[_0xa5f0('0xb')](),controller[_0xa5f0('0xf')]);router[_0xa5f0('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xa5f0('0x10')]);router[_0xa5f0('0x11')]('/',auth['isAuthenticated'](),controller[_0xa5f0('0x12')]);router[_0xa5f0('0x13')]('/:id',auth[_0xa5f0('0xb')](),controller[_0xa5f0('0x14')]);router[_0xa5f0('0x15')](_0xa5f0('0x16'),auth[_0xa5f0('0xb')](),controller[_0xa5f0('0x17')]);module[_0xa5f0('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 8e31261..069cb27 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 _0x54f9=['sequelize','exports'];(function(_0x5695c3,_0x112429){var _0x32d3d4=function(_0x1faef9){while(--_0x1faef9){_0x5695c3['push'](_0x5695c3['shift']());}};_0x32d3d4(++_0x112429);}(_0x54f9,0xc6));var _0x954f=function(_0x27e21f,_0x3cc784){_0x27e21f=_0x27e21f-0x0;var _0x5c0967=_0x54f9[_0x27e21f];return _0x5c0967;};'use strict';var Sequelize=require(_0x954f('0x0'));module[_0x954f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2f82=['exports','STRING','sequelize'];(function(_0x4d9f4a,_0x538b36){var _0x783fde=function(_0x210e72){while(--_0x210e72){_0x4d9f4a['push'](_0x4d9f4a['shift']());}};_0x783fde(++_0x538b36);}(_0x2f82,0x1eb));var _0x22f8=function(_0x275f4a,_0x2077d4){_0x275f4a=_0x275f4a-0x0;var _0x4b4a21=_0x2f82[_0x275f4a];return _0x4b4a21;};'use strict';var Sequelize=require(_0x22f8('0x0'));module[_0x22f8('0x1')]={'name':{'type':Sequelize[_0x22f8('0x2')]},'description':{'type':Sequelize[_0x22f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index eac02cf..4fd6928 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 _0x3741=['to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','ServicenowConfiguration','fieldName','type','key','model','map','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','rows','catch','show','params','keys','rawAttributes','fields','includeAll','include','find','create','body','destroy','getFields','ServicenowField','hasOwnProperty','getSubjects','options','getDescriptions','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0x3741,0x91));var _0x1374=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0x3741[_0x1399d6];return _0x4a9db4;};'use strict';var emlformat=require(_0x1374('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1374('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1374('0x2'));var moment=require('moment');var BPromise=require(_0x1374('0x3'));var Mustache=require(_0x1374('0x4'));var util=require(_0x1374('0x5'));var path=require('path');var sox=require(_0x1374('0x6'));var csv=require('to-csv');var ejs=require(_0x1374('0x7'));var fs=require('fs');var fs_extra=require(_0x1374('0x8'));var _=require(_0x1374('0x9'));var squel=require(_0x1374('0xa'));var crypto=require(_0x1374('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1374('0xc'));var toCsv=require(_0x1374('0xd'));var querystring=require(_0x1374('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1374('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1374('0x10'));var hardwareService=require(_0x1374('0x11'));var logger=require(_0x1374('0x12'))(_0x1374('0x13'));var utils=require('../../config/utils');var config=require(_0x1374('0x14'));var licenseUtil=require(_0x1374('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x322a48,_0x5b5b0a){_0x5b5b0a=_0x5b5b0a||0xcc;return function(_0x3bae7f){if(_0x3bae7f){return _0x322a48[_0x1374('0x16')](_0x5b5b0a);}return _0x322a48[_0x1374('0x17')](_0x5b5b0a)[_0x1374('0x18')]();};}function respondWithResult(_0x43c233,_0x11ce8f){_0x11ce8f=_0x11ce8f||0xc8;return function(_0x163cd2){if(_0x163cd2){return _0x43c233[_0x1374('0x17')](_0x11ce8f)[_0x1374('0x19')](_0x163cd2);}};}function respondWithFilteredResult(_0x1f4617,_0x4271b7){return function(_0x15f42c){if(_0x15f42c){var _0x2082c7=typeof _0x4271b7['offset']===_0x1374('0x1a')&&typeof _0x4271b7[_0x1374('0x1b')]===_0x1374('0x1a');var _0x2c0a3e=_0x15f42c[_0x1374('0x1c')];var _0x19e3e8=_0x2082c7?0x0:_0x4271b7[_0x1374('0x1d')];var _0x5e99f4=_0x2082c7?_0x15f42c[_0x1374('0x1c')]:_0x4271b7[_0x1374('0x1d')]+_0x4271b7[_0x1374('0x1b')];var _0x12209c;if(_0x5e99f4>=_0x2c0a3e){_0x5e99f4=_0x2c0a3e;_0x12209c=0xc8;}else{_0x12209c=0xce;}_0x1f4617[_0x1374('0x17')](_0x12209c);return _0x1f4617[_0x1374('0x1e')](_0x1374('0x1f'),_0x19e3e8+'-'+_0x5e99f4+'/'+_0x2c0a3e)[_0x1374('0x19')](_0x15f42c);}return null;};}function patchUpdates(_0x446692){return function(_0x2a3f7f){try{jsonpatch[_0x1374('0x20')](_0x2a3f7f,_0x446692,!![]);}catch(_0x145438){return BPromise[_0x1374('0x21')](_0x145438);}return _0x2a3f7f[_0x1374('0x22')]();};}function saveUpdates(_0x23ba34,_0x274f36){return function(_0x15f1eb){if(_0x15f1eb){return _0x15f1eb[_0x1374('0x23')](_0x23ba34)['then'](function(_0x2c0776){return _0x2c0776;});}return null;};}function removeEntity(_0x1ce68c,_0x27cbf9){return function(_0x23209f){if(_0x23209f){return _0x23209f['destroy']()[_0x1374('0x24')](function(){_0x1ce68c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cdc43,_0x33d561){return function(_0x5071d6){if(!_0x5071d6){_0x3cdc43[_0x1374('0x16')](0x194);}return _0x5071d6;};}function handleError(_0x96b1e0,_0x4bd9db){_0x4bd9db=_0x4bd9db||0x1f4;return function(_0x3df630){logger[_0x1374('0x25')](_0x3df630[_0x1374('0x26')]);if(_0x3df630[_0x1374('0x27')]){delete _0x3df630[_0x1374('0x27')];}_0x96b1e0[_0x1374('0x17')](_0x4bd9db)['send'](_0x3df630);};}exports[_0x1374('0x28')]=function(_0x467c20,_0x957552){var _0xc7aac0={},_0x38b444={},_0x2e7dc2={'count':0x0,'rows':[]};var _0x14e2f6=_['map'](db[_0x1374('0x29')]['rawAttributes'],function(_0x47541f){return{'name':_0x47541f[_0x1374('0x2a')],'type':_0x47541f[_0x1374('0x2b')][_0x1374('0x2c')]};});_0x38b444[_0x1374('0x2d')]=_[_0x1374('0x2e')](_0x14e2f6,_0x1374('0x27'));_0x38b444[_0x1374('0x2f')]=_['keys'](_0x467c20['query']);_0x38b444[_0x1374('0x30')]=_[_0x1374('0x31')](_0x38b444[_0x1374('0x2d')],_0x38b444[_0x1374('0x2f')]);_0xc7aac0[_0x1374('0x32')]=_['intersection'](_0x38b444[_0x1374('0x2d')],qs['fields'](_0x467c20[_0x1374('0x2f')]['fields']));_0xc7aac0['attributes']=_0xc7aac0[_0x1374('0x32')][_0x1374('0x33')]?_0xc7aac0[_0x1374('0x32')]:_0x38b444[_0x1374('0x2d')];if(!_0x467c20[_0x1374('0x2f')]['hasOwnProperty'](_0x1374('0x34'))){_0xc7aac0['limit']=qs['limit'](_0x467c20[_0x1374('0x2f')][_0x1374('0x1b')]);_0xc7aac0['offset']=qs[_0x1374('0x1d')](_0x467c20['query'][_0x1374('0x1d')]);}_0xc7aac0[_0x1374('0x35')]=qs[_0x1374('0x36')](_0x467c20[_0x1374('0x2f')][_0x1374('0x36')]);_0xc7aac0[_0x1374('0x37')]=qs[_0x1374('0x30')](_[_0x1374('0x38')](_0x467c20[_0x1374('0x2f')],_0x38b444[_0x1374('0x30')]),_0x14e2f6);if(_0x467c20[_0x1374('0x2f')][_0x1374('0x39')]){_0xc7aac0[_0x1374('0x37')]=_[_0x1374('0x3a')](_0xc7aac0[_0x1374('0x37')],{'$or':_[_0x1374('0x2e')](_0x14e2f6,function(_0x5cdbc9){if(_0x5cdbc9[_0x1374('0x2b')]!==_0x1374('0x3b')){var _0x59e7d9={};_0x59e7d9[_0x5cdbc9[_0x1374('0x27')]]={'$like':'%'+_0x467c20[_0x1374('0x2f')][_0x1374('0x39')]+'%'};return _0x59e7d9;}})});}_0xc7aac0=_[_0x1374('0x3a')]({},_0xc7aac0,_0x467c20['options']);var _0x3e97e1={'where':_0xc7aac0[_0x1374('0x37')]};return db[_0x1374('0x29')][_0x1374('0x1c')](_0x3e97e1)[_0x1374('0x24')](function(_0x2f0efd){_0x2e7dc2[_0x1374('0x1c')]=_0x2f0efd;if(_0x467c20[_0x1374('0x2f')]['includeAll']){_0xc7aac0['include']=[{'all':!![]}];}return db[_0x1374('0x29')]['findAll'](_0xc7aac0);})[_0x1374('0x24')](function(_0x56b312){_0x2e7dc2[_0x1374('0x3c')]=_0x56b312;return _0x2e7dc2;})[_0x1374('0x24')](respondWithFilteredResult(_0x957552,_0xc7aac0))[_0x1374('0x3d')](handleError(_0x957552,null));};exports[_0x1374('0x3e')]=function(_0x5829fd,_0x446495){var _0x1ff9e0={'raw':![],'where':{'id':_0x5829fd[_0x1374('0x3f')]['id']}},_0x8e75ed={};_0x8e75ed[_0x1374('0x2d')]=_[_0x1374('0x40')](db[_0x1374('0x29')][_0x1374('0x41')]);_0x8e75ed[_0x1374('0x2f')]=_[_0x1374('0x40')](_0x5829fd[_0x1374('0x2f')]);_0x8e75ed[_0x1374('0x30')]=_[_0x1374('0x31')](_0x8e75ed[_0x1374('0x2d')],_0x8e75ed[_0x1374('0x2f')]);_0x1ff9e0[_0x1374('0x32')]=_[_0x1374('0x31')](_0x8e75ed[_0x1374('0x2d')],qs[_0x1374('0x42')](_0x5829fd['query'][_0x1374('0x42')]));_0x1ff9e0[_0x1374('0x32')]=_0x1ff9e0['attributes'][_0x1374('0x33')]?_0x1ff9e0[_0x1374('0x32')]:_0x8e75ed['model'];if(_0x5829fd[_0x1374('0x2f')][_0x1374('0x43')]){_0x1ff9e0[_0x1374('0x44')]=[{'all':!![]}];}_0x1ff9e0=_[_0x1374('0x3a')]({},_0x1ff9e0,_0x5829fd['options']);return db[_0x1374('0x29')][_0x1374('0x45')](_0x1ff9e0)[_0x1374('0x24')](handleEntityNotFound(_0x446495,null))[_0x1374('0x24')](respondWithResult(_0x446495,null))[_0x1374('0x3d')](handleError(_0x446495,null));};exports[_0x1374('0x46')]=function(_0x42877d,_0x5a83ae){return db[_0x1374('0x29')][_0x1374('0x46')](_0x42877d[_0x1374('0x47')],{})[_0x1374('0x24')](respondWithResult(_0x5a83ae,0xc9))[_0x1374('0x3d')](handleError(_0x5a83ae,null));};exports[_0x1374('0x23')]=function(_0x4a59d0,_0x4254c0){if(_0x4a59d0[_0x1374('0x47')]['id']){delete _0x4a59d0[_0x1374('0x47')]['id'];}return db['ServicenowConfiguration'][_0x1374('0x45')]({'where':{'id':_0x4a59d0[_0x1374('0x3f')]['id']}})[_0x1374('0x24')](handleEntityNotFound(_0x4254c0,null))[_0x1374('0x24')](saveUpdates(_0x4a59d0[_0x1374('0x47')],null))[_0x1374('0x24')](respondWithResult(_0x4254c0,null))[_0x1374('0x3d')](handleError(_0x4254c0,null));};exports[_0x1374('0x48')]=function(_0x99f7c9,_0x1159fe){return db[_0x1374('0x29')]['find']({'where':{'id':_0x99f7c9['params']['id']}})[_0x1374('0x24')](handleEntityNotFound(_0x1159fe,null))[_0x1374('0x24')](removeEntity(_0x1159fe,null))['catch'](handleError(_0x1159fe,null));};exports[_0x1374('0x49')]=function(_0x4e4459,_0x423771,_0x10a841){var _0x4d054c={};var _0x169981={};var _0x4a6093;var _0x18f773;return db[_0x1374('0x29')]['findOne']({'where':{'id':_0x4e4459[_0x1374('0x3f')]['id']}})['then'](handleEntityNotFound(_0x423771,null))['then'](function(_0x4cf830){if(_0x4cf830){_0x4a6093=_0x4cf830;_0x169981['model']=_[_0x1374('0x40')](db[_0x1374('0x4a')][_0x1374('0x41')]);_0x169981[_0x1374('0x2f')]=_[_0x1374('0x40')](_0x4e4459[_0x1374('0x2f')]);_0x169981['filters']=_[_0x1374('0x31')](_0x169981[_0x1374('0x2d')],_0x169981[_0x1374('0x2f')]);_0x4d054c['attributes']=_[_0x1374('0x31')](_0x169981[_0x1374('0x2d')],qs['fields'](_0x4e4459[_0x1374('0x2f')][_0x1374('0x42')]));_0x4d054c['attributes']=_0x4d054c[_0x1374('0x32')][_0x1374('0x33')]?_0x4d054c[_0x1374('0x32')]:_0x169981['model'];_0x4d054c[_0x1374('0x35')]=qs[_0x1374('0x36')](_0x4e4459['query'][_0x1374('0x36')]);_0x4d054c[_0x1374('0x37')]=qs[_0x1374('0x30')](_[_0x1374('0x38')](_0x4e4459[_0x1374('0x2f')],_0x169981[_0x1374('0x30')]));if(_0x4e4459[_0x1374('0x2f')][_0x1374('0x39')]){_0x4d054c[_0x1374('0x37')]=_[_0x1374('0x3a')](_0x4d054c['where'],{'$or':_[_0x1374('0x2e')](_0x4d054c[_0x1374('0x32')],function(_0x40f920){var _0x4b2467={};_0x4b2467[_0x40f920]={'$like':'%'+_0x4e4459['query'][_0x1374('0x39')]+'%'};return _0x4b2467;})});}_0x4d054c=_[_0x1374('0x3a')]({},_0x4d054c,_0x4e4459['options']);return _0x4a6093[_0x1374('0x49')](_0x4d054c);}})[_0x1374('0x24')](function(_0x4af3f){if(_0x4af3f){_0x18f773=_0x4af3f[_0x1374('0x33')];if(!_0x4e4459['query'][_0x1374('0x4b')](_0x1374('0x34'))){_0x4d054c[_0x1374('0x1b')]=qs[_0x1374('0x1b')](_0x4e4459[_0x1374('0x2f')][_0x1374('0x1b')]);_0x4d054c['offset']=qs['offset'](_0x4e4459['query'][_0x1374('0x1d')]);}return _0x4a6093[_0x1374('0x49')](_0x4d054c);}})['then'](function(_0x311181){if(_0x311181){return _0x311181?{'count':_0x18f773,'rows':_0x311181}:null;}})[_0x1374('0x24')](respondWithResult(_0x423771,null))['catch'](handleError(_0x423771,null));};exports[_0x1374('0x4c')]=function(_0x425744,_0xdd14e7,_0x107f8c){var _0xab7cd5={};var _0x48abf1={};var _0x394a41;var _0xf68e4c;return db[_0x1374('0x29')]['findOne']({'where':{'id':_0x425744[_0x1374('0x3f')]['id']}})['then'](handleEntityNotFound(_0xdd14e7,null))[_0x1374('0x24')](function(_0x55d109){if(_0x55d109){_0x394a41=_0x55d109;_0x48abf1[_0x1374('0x2d')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x48abf1['query']=_[_0x1374('0x40')](_0x425744[_0x1374('0x2f')]);_0x48abf1[_0x1374('0x30')]=_['intersection'](_0x48abf1[_0x1374('0x2d')],_0x48abf1[_0x1374('0x2f')]);_0xab7cd5[_0x1374('0x32')]=_['intersection'](_0x48abf1[_0x1374('0x2d')],qs['fields'](_0x425744[_0x1374('0x2f')][_0x1374('0x42')]));_0xab7cd5['attributes']=_0xab7cd5['attributes'][_0x1374('0x33')]?_0xab7cd5[_0x1374('0x32')]:_0x48abf1['model'];_0xab7cd5[_0x1374('0x35')]=qs['sort'](_0x425744[_0x1374('0x2f')][_0x1374('0x36')]);_0xab7cd5[_0x1374('0x37')]=qs[_0x1374('0x30')](_[_0x1374('0x38')](_0x425744[_0x1374('0x2f')],_0x48abf1['filters']));if(_0x425744[_0x1374('0x2f')]['filter']){_0xab7cd5[_0x1374('0x37')]=_[_0x1374('0x3a')](_0xab7cd5[_0x1374('0x37')],{'$or':_[_0x1374('0x2e')](_0xab7cd5[_0x1374('0x32')],function(_0x2f46dd){var _0x4c9394={};_0x4c9394[_0x2f46dd]={'$like':'%'+_0x425744[_0x1374('0x2f')][_0x1374('0x39')]+'%'};return _0x4c9394;})});}_0xab7cd5=_[_0x1374('0x3a')]({},_0xab7cd5,_0x425744[_0x1374('0x4d')]);return _0x394a41['getSubjects'](_0xab7cd5);}})[_0x1374('0x24')](function(_0x595594){if(_0x595594){_0xf68e4c=_0x595594[_0x1374('0x33')];if(!_0x425744[_0x1374('0x2f')]['hasOwnProperty'](_0x1374('0x34'))){_0xab7cd5[_0x1374('0x1b')]=qs[_0x1374('0x1b')](_0x425744[_0x1374('0x2f')]['limit']);_0xab7cd5[_0x1374('0x1d')]=qs[_0x1374('0x1d')](_0x425744[_0x1374('0x2f')][_0x1374('0x1d')]);}return _0x394a41[_0x1374('0x4c')](_0xab7cd5);}})[_0x1374('0x24')](function(_0x1dba3c){if(_0x1dba3c){return _0x1dba3c?{'count':_0xf68e4c,'rows':_0x1dba3c}:null;}})[_0x1374('0x24')](respondWithResult(_0xdd14e7,null))[_0x1374('0x3d')](handleError(_0xdd14e7,null));};exports[_0x1374('0x4e')]=function(_0x5be7ab,_0x4b408a,_0x30c0d2){var _0x4980f9={};var _0x182103={};var _0x585b5d;var _0x2785d0;return db[_0x1374('0x29')]['findOne']({'where':{'id':_0x5be7ab['params']['id']}})[_0x1374('0x24')](handleEntityNotFound(_0x4b408a,null))[_0x1374('0x24')](function(_0x47f53b){if(_0x47f53b){_0x585b5d=_0x47f53b;_0x182103[_0x1374('0x2d')]=_[_0x1374('0x40')](db[_0x1374('0x4a')][_0x1374('0x41')]);_0x182103['query']=_[_0x1374('0x40')](_0x5be7ab[_0x1374('0x2f')]);_0x182103[_0x1374('0x30')]=_[_0x1374('0x31')](_0x182103['model'],_0x182103[_0x1374('0x2f')]);_0x4980f9['attributes']=_[_0x1374('0x31')](_0x182103['model'],qs[_0x1374('0x42')](_0x5be7ab[_0x1374('0x2f')][_0x1374('0x42')]));_0x4980f9['attributes']=_0x4980f9['attributes'][_0x1374('0x33')]?_0x4980f9['attributes']:_0x182103[_0x1374('0x2d')];_0x4980f9[_0x1374('0x35')]=qs['sort'](_0x5be7ab['query'][_0x1374('0x36')]);_0x4980f9[_0x1374('0x37')]=qs[_0x1374('0x30')](_[_0x1374('0x38')](_0x5be7ab['query'],_0x182103['filters']));if(_0x5be7ab[_0x1374('0x2f')][_0x1374('0x39')]){_0x4980f9[_0x1374('0x37')]=_['merge'](_0x4980f9[_0x1374('0x37')],{'$or':_['map'](_0x4980f9[_0x1374('0x32')],function(_0x482b7e){var _0xb1534={};_0xb1534[_0x482b7e]={'$like':'%'+_0x5be7ab[_0x1374('0x2f')]['filter']+'%'};return _0xb1534;})});}_0x4980f9=_[_0x1374('0x3a')]({},_0x4980f9,_0x5be7ab['options']);return _0x585b5d[_0x1374('0x4e')](_0x4980f9);}})['then'](function(_0x47acac){if(_0x47acac){_0x2785d0=_0x47acac[_0x1374('0x33')];if(!_0x5be7ab[_0x1374('0x2f')][_0x1374('0x4b')](_0x1374('0x34'))){_0x4980f9[_0x1374('0x1b')]=qs[_0x1374('0x1b')](_0x5be7ab[_0x1374('0x2f')][_0x1374('0x1b')]);_0x4980f9['offset']=qs['offset'](_0x5be7ab[_0x1374('0x2f')][_0x1374('0x1d')]);}return _0x585b5d[_0x1374('0x4e')](_0x4980f9);}})[_0x1374('0x24')](function(_0x50b4b4){if(_0x50b4b4){return _0x50b4b4?{'count':_0x2785d0,'rows':_0x50b4b4}:null;}})[_0x1374('0x24')](respondWithResult(_0x4b408a,null))[_0x1374('0x3d')](handleError(_0x4b408a,null));}; \ No newline at end of file +var _0x1fca=['hasOwnProperty','getSubjects','ServicenowConfiguration','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','getFields','findOne','ServicenowField'];(function(_0x133838,_0x5f19a7){var _0x3a5239=function(_0x3e177b){while(--_0x3e177b){_0x133838['push'](_0x133838['shift']());}};_0x3a5239(++_0x5f19a7);}(_0x1fca,0x155));var _0xa1fc=function(_0x5c6f37,_0x5251e2){_0x5c6f37=_0x5c6f37-0x0;var _0x489ad2=_0x1fca[_0x5c6f37];return _0x489ad2;};'use strict';var emlformat=require(_0xa1fc('0x0'));var rimraf=require(_0xa1fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1fc('0x2'));var rp=require(_0xa1fc('0x3'));var moment=require(_0xa1fc('0x4'));var BPromise=require(_0xa1fc('0x5'));var Mustache=require(_0xa1fc('0x6'));var util=require(_0xa1fc('0x7'));var path=require(_0xa1fc('0x8'));var sox=require(_0xa1fc('0x9'));var csv=require(_0xa1fc('0xa'));var ejs=require(_0xa1fc('0xb'));var fs=require('fs');var fs_extra=require(_0xa1fc('0xc'));var _=require(_0xa1fc('0xd'));var squel=require('squel');var crypto=require(_0xa1fc('0xe'));var jsforce=require(_0xa1fc('0xf'));var deskjs=require(_0xa1fc('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1fc('0x11'));var Papa=require(_0xa1fc('0x12'));var Redis=require(_0xa1fc('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa1fc('0x14'));var as=require(_0xa1fc('0x15'));var hardwareService=require(_0xa1fc('0x16'));var logger=require(_0xa1fc('0x17'))(_0xa1fc('0x18'));var utils=require(_0xa1fc('0x19'));var config=require(_0xa1fc('0x1a'));var licenseUtil=require(_0xa1fc('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c3fa6,_0xc08ea){_0xc08ea=_0xc08ea||0xcc;return function(_0x297c06){if(_0x297c06){return _0x5c3fa6[_0xa1fc('0x1c')](_0xc08ea);}return _0x5c3fa6['status'](_0xc08ea)['end']();};}function respondWithResult(_0x48bbb8,_0x2714b4){_0x2714b4=_0x2714b4||0xc8;return function(_0x2f7f32){if(_0x2f7f32){return _0x48bbb8[_0xa1fc('0x1d')](_0x2714b4)['json'](_0x2f7f32);}};}function respondWithFilteredResult(_0x451777,_0x35bd19){return function(_0x5563f1){if(_0x5563f1){var _0x5bf4fa=typeof _0x35bd19[_0xa1fc('0x1e')]==='undefined'&&typeof _0x35bd19[_0xa1fc('0x1f')]===_0xa1fc('0x20');var _0x2a69e2=_0x5563f1[_0xa1fc('0x21')];var _0x2dfcb5=_0x5bf4fa?0x0:_0x35bd19['offset'];var _0xd347d6=_0x5bf4fa?_0x5563f1[_0xa1fc('0x21')]:_0x35bd19[_0xa1fc('0x1e')]+_0x35bd19['limit'];var _0x45e4bd;if(_0xd347d6>=_0x2a69e2){_0xd347d6=_0x2a69e2;_0x45e4bd=0xc8;}else{_0x45e4bd=0xce;}_0x451777['status'](_0x45e4bd);return _0x451777['set'](_0xa1fc('0x22'),_0x2dfcb5+'-'+_0xd347d6+'/'+_0x2a69e2)[_0xa1fc('0x23')](_0x5563f1);}return null;};}function patchUpdates(_0xedebbe){return function(_0x13d67c){try{jsonpatch[_0xa1fc('0x24')](_0x13d67c,_0xedebbe,!![]);}catch(_0x4004f4){return BPromise['reject'](_0x4004f4);}return _0x13d67c[_0xa1fc('0x25')]();};}function saveUpdates(_0x8a98c8,_0xc61330){return function(_0x244e2e){if(_0x244e2e){return _0x244e2e[_0xa1fc('0x26')](_0x8a98c8)[_0xa1fc('0x27')](function(_0x2da6f4){return _0x2da6f4;});}return null;};}function removeEntity(_0x48086f,_0x1a6152){return function(_0x17f800){if(_0x17f800){return _0x17f800[_0xa1fc('0x28')]()[_0xa1fc('0x27')](function(){_0x48086f[_0xa1fc('0x1d')](0xcc)[_0xa1fc('0x29')]();});}};}function handleEntityNotFound(_0x144cbb,_0x119b5a){return function(_0x1ca957){if(!_0x1ca957){_0x144cbb[_0xa1fc('0x1c')](0x194);}return _0x1ca957;};}function handleError(_0x366f95,_0x2df86b){_0x2df86b=_0x2df86b||0x1f4;return function(_0x5b8791){logger[_0xa1fc('0x2a')](_0x5b8791[_0xa1fc('0x2b')]);if(_0x5b8791['name']){delete _0x5b8791[_0xa1fc('0x2c')];}_0x366f95[_0xa1fc('0x1d')](_0x2df86b)['send'](_0x5b8791);};}exports[_0xa1fc('0x2d')]=function(_0x3a532f,_0x1bff9c){var _0x1535de={},_0x41989c={},_0x5e831d={'count':0x0,'rows':[]};var _0x2b0c0a=_['map'](db['ServicenowConfiguration'][_0xa1fc('0x2e')],function(_0x216083){return{'name':_0x216083[_0xa1fc('0x2f')],'type':_0x216083[_0xa1fc('0x30')][_0xa1fc('0x31')]};});_0x41989c[_0xa1fc('0x32')]=_['map'](_0x2b0c0a,_0xa1fc('0x2c'));_0x41989c['query']=_[_0xa1fc('0x33')](_0x3a532f[_0xa1fc('0x34')]);_0x41989c[_0xa1fc('0x35')]=_[_0xa1fc('0x36')](_0x41989c[_0xa1fc('0x32')],_0x41989c[_0xa1fc('0x34')]);_0x1535de[_0xa1fc('0x37')]=_[_0xa1fc('0x36')](_0x41989c[_0xa1fc('0x32')],qs[_0xa1fc('0x38')](_0x3a532f[_0xa1fc('0x34')][_0xa1fc('0x38')]));_0x1535de[_0xa1fc('0x37')]=_0x1535de[_0xa1fc('0x37')][_0xa1fc('0x39')]?_0x1535de[_0xa1fc('0x37')]:_0x41989c[_0xa1fc('0x32')];if(!_0x3a532f[_0xa1fc('0x34')]['hasOwnProperty'](_0xa1fc('0x3a'))){_0x1535de[_0xa1fc('0x1f')]=qs[_0xa1fc('0x1f')](_0x3a532f[_0xa1fc('0x34')][_0xa1fc('0x1f')]);_0x1535de[_0xa1fc('0x1e')]=qs[_0xa1fc('0x1e')](_0x3a532f[_0xa1fc('0x34')]['offset']);}_0x1535de[_0xa1fc('0x3b')]=qs[_0xa1fc('0x3c')](_0x3a532f[_0xa1fc('0x34')][_0xa1fc('0x3c')]);_0x1535de[_0xa1fc('0x3d')]=qs[_0xa1fc('0x35')](_['pick'](_0x3a532f['query'],_0x41989c['filters']),_0x2b0c0a);if(_0x3a532f['query'][_0xa1fc('0x3e')]){_0x1535de[_0xa1fc('0x3d')]=_[_0xa1fc('0x3f')](_0x1535de['where'],{'$or':_[_0xa1fc('0x40')](_0x2b0c0a,function(_0x1d6bcd){if(_0x1d6bcd[_0xa1fc('0x30')]!==_0xa1fc('0x41')){var _0x2f02fb={};_0x2f02fb[_0x1d6bcd[_0xa1fc('0x2c')]]={'$like':'%'+_0x3a532f[_0xa1fc('0x34')][_0xa1fc('0x3e')]+'%'};return _0x2f02fb;}})});}_0x1535de=_[_0xa1fc('0x3f')]({},_0x1535de,_0x3a532f[_0xa1fc('0x42')]);var _0x18f4b4={'where':_0x1535de[_0xa1fc('0x3d')]};return db['ServicenowConfiguration'][_0xa1fc('0x21')](_0x18f4b4)[_0xa1fc('0x27')](function(_0x2163bd){_0x5e831d[_0xa1fc('0x21')]=_0x2163bd;if(_0x3a532f['query']['includeAll']){_0x1535de[_0xa1fc('0x43')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xa1fc('0x44')](_0x1535de);})['then'](function(_0x31cff1){_0x5e831d['rows']=_0x31cff1;return _0x5e831d;})[_0xa1fc('0x27')](respondWithFilteredResult(_0x1bff9c,_0x1535de))[_0xa1fc('0x45')](handleError(_0x1bff9c,null));};exports[_0xa1fc('0x46')]=function(_0x560736,_0x371c40){var _0x4dde19={'raw':![],'where':{'id':_0x560736[_0xa1fc('0x47')]['id']}},_0x1d6213={};_0x1d6213[_0xa1fc('0x32')]=_[_0xa1fc('0x33')](db['ServicenowConfiguration'][_0xa1fc('0x2e')]);_0x1d6213['query']=_['keys'](_0x560736['query']);_0x1d6213[_0xa1fc('0x35')]=_[_0xa1fc('0x36')](_0x1d6213[_0xa1fc('0x32')],_0x1d6213[_0xa1fc('0x34')]);_0x4dde19['attributes']=_[_0xa1fc('0x36')](_0x1d6213[_0xa1fc('0x32')],qs[_0xa1fc('0x38')](_0x560736[_0xa1fc('0x34')][_0xa1fc('0x38')]));_0x4dde19[_0xa1fc('0x37')]=_0x4dde19[_0xa1fc('0x37')][_0xa1fc('0x39')]?_0x4dde19['attributes']:_0x1d6213[_0xa1fc('0x32')];if(_0x560736['query'][_0xa1fc('0x48')]){_0x4dde19[_0xa1fc('0x43')]=[{'all':!![]}];}_0x4dde19=_[_0xa1fc('0x3f')]({},_0x4dde19,_0x560736[_0xa1fc('0x42')]);return db['ServicenowConfiguration'][_0xa1fc('0x49')](_0x4dde19)[_0xa1fc('0x27')](handleEntityNotFound(_0x371c40,null))[_0xa1fc('0x27')](respondWithResult(_0x371c40,null))['catch'](handleError(_0x371c40,null));};exports[_0xa1fc('0x4a')]=function(_0x5adc91,_0x1bb144){return db['ServicenowConfiguration'][_0xa1fc('0x4a')](_0x5adc91[_0xa1fc('0x4b')],{})[_0xa1fc('0x27')](respondWithResult(_0x1bb144,0xc9))[_0xa1fc('0x45')](handleError(_0x1bb144,null));};exports['update']=function(_0x2e22de,_0x311df4){if(_0x2e22de[_0xa1fc('0x4b')]['id']){delete _0x2e22de[_0xa1fc('0x4b')]['id'];}return db['ServicenowConfiguration'][_0xa1fc('0x49')]({'where':{'id':_0x2e22de[_0xa1fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x311df4,null))[_0xa1fc('0x27')](saveUpdates(_0x2e22de[_0xa1fc('0x4b')],null))[_0xa1fc('0x27')](respondWithResult(_0x311df4,null))[_0xa1fc('0x45')](handleError(_0x311df4,null));};exports['destroy']=function(_0x1e920f,_0xb73c0a){return db['ServicenowConfiguration'][_0xa1fc('0x49')]({'where':{'id':_0x1e920f[_0xa1fc('0x47')]['id']}})['then'](handleEntityNotFound(_0xb73c0a,null))[_0xa1fc('0x27')](removeEntity(_0xb73c0a,null))[_0xa1fc('0x45')](handleError(_0xb73c0a,null));};exports[_0xa1fc('0x4c')]=function(_0x258b08,_0x3d05e4,_0x52f9c8){var _0x4b0594={};var _0x381ff7={};var _0x287a76;var _0x36791b;return db['ServicenowConfiguration'][_0xa1fc('0x4d')]({'where':{'id':_0x258b08['params']['id']}})['then'](handleEntityNotFound(_0x3d05e4,null))[_0xa1fc('0x27')](function(_0x75a3cf){if(_0x75a3cf){_0x287a76=_0x75a3cf;_0x381ff7[_0xa1fc('0x32')]=_[_0xa1fc('0x33')](db[_0xa1fc('0x4e')][_0xa1fc('0x2e')]);_0x381ff7[_0xa1fc('0x34')]=_[_0xa1fc('0x33')](_0x258b08[_0xa1fc('0x34')]);_0x381ff7[_0xa1fc('0x35')]=_[_0xa1fc('0x36')](_0x381ff7[_0xa1fc('0x32')],_0x381ff7['query']);_0x4b0594[_0xa1fc('0x37')]=_['intersection'](_0x381ff7['model'],qs['fields'](_0x258b08[_0xa1fc('0x34')][_0xa1fc('0x38')]));_0x4b0594[_0xa1fc('0x37')]=_0x4b0594[_0xa1fc('0x37')][_0xa1fc('0x39')]?_0x4b0594[_0xa1fc('0x37')]:_0x381ff7[_0xa1fc('0x32')];_0x4b0594[_0xa1fc('0x3b')]=qs[_0xa1fc('0x3c')](_0x258b08[_0xa1fc('0x34')][_0xa1fc('0x3c')]);_0x4b0594[_0xa1fc('0x3d')]=qs[_0xa1fc('0x35')](_['pick'](_0x258b08['query'],_0x381ff7[_0xa1fc('0x35')]));if(_0x258b08[_0xa1fc('0x34')]['filter']){_0x4b0594[_0xa1fc('0x3d')]=_[_0xa1fc('0x3f')](_0x4b0594['where'],{'$or':_['map'](_0x4b0594[_0xa1fc('0x37')],function(_0x20ddaa){var _0x43a85f={};_0x43a85f[_0x20ddaa]={'$like':'%'+_0x258b08[_0xa1fc('0x34')][_0xa1fc('0x3e')]+'%'};return _0x43a85f;})});}_0x4b0594=_[_0xa1fc('0x3f')]({},_0x4b0594,_0x258b08[_0xa1fc('0x42')]);return _0x287a76[_0xa1fc('0x4c')](_0x4b0594);}})[_0xa1fc('0x27')](function(_0x1372fe){if(_0x1372fe){_0x36791b=_0x1372fe['length'];if(!_0x258b08[_0xa1fc('0x34')][_0xa1fc('0x4f')](_0xa1fc('0x3a'))){_0x4b0594[_0xa1fc('0x1f')]=qs[_0xa1fc('0x1f')](_0x258b08['query'][_0xa1fc('0x1f')]);_0x4b0594[_0xa1fc('0x1e')]=qs[_0xa1fc('0x1e')](_0x258b08[_0xa1fc('0x34')][_0xa1fc('0x1e')]);}return _0x287a76[_0xa1fc('0x4c')](_0x4b0594);}})[_0xa1fc('0x27')](function(_0x17568c){if(_0x17568c){return _0x17568c?{'count':_0x36791b,'rows':_0x17568c}:null;}})[_0xa1fc('0x27')](respondWithResult(_0x3d05e4,null))['catch'](handleError(_0x3d05e4,null));};exports[_0xa1fc('0x50')]=function(_0x48f548,_0x37ffbd,_0x5e7fa5){var _0x15385a={};var _0x5686b5={};var _0x35b0ac;var _0x22a9c0;return db[_0xa1fc('0x51')]['findOne']({'where':{'id':_0x48f548[_0xa1fc('0x47')]['id']}})[_0xa1fc('0x27')](handleEntityNotFound(_0x37ffbd,null))[_0xa1fc('0x27')](function(_0x33483a){if(_0x33483a){_0x35b0ac=_0x33483a;_0x5686b5[_0xa1fc('0x32')]=_[_0xa1fc('0x33')](db[_0xa1fc('0x4e')][_0xa1fc('0x2e')]);_0x5686b5[_0xa1fc('0x34')]=_[_0xa1fc('0x33')](_0x48f548[_0xa1fc('0x34')]);_0x5686b5['filters']=_[_0xa1fc('0x36')](_0x5686b5[_0xa1fc('0x32')],_0x5686b5[_0xa1fc('0x34')]);_0x15385a[_0xa1fc('0x37')]=_[_0xa1fc('0x36')](_0x5686b5[_0xa1fc('0x32')],qs[_0xa1fc('0x38')](_0x48f548[_0xa1fc('0x34')]['fields']));_0x15385a['attributes']=_0x15385a['attributes']['length']?_0x15385a[_0xa1fc('0x37')]:_0x5686b5[_0xa1fc('0x32')];_0x15385a[_0xa1fc('0x3b')]=qs['sort'](_0x48f548['query']['sort']);_0x15385a[_0xa1fc('0x3d')]=qs[_0xa1fc('0x35')](_[_0xa1fc('0x52')](_0x48f548[_0xa1fc('0x34')],_0x5686b5['filters']));if(_0x48f548[_0xa1fc('0x34')][_0xa1fc('0x3e')]){_0x15385a[_0xa1fc('0x3d')]=_[_0xa1fc('0x3f')](_0x15385a[_0xa1fc('0x3d')],{'$or':_['map'](_0x15385a['attributes'],function(_0xaf6b21){var _0x463626={};_0x463626[_0xaf6b21]={'$like':'%'+_0x48f548[_0xa1fc('0x34')][_0xa1fc('0x3e')]+'%'};return _0x463626;})});}_0x15385a=_['merge']({},_0x15385a,_0x48f548[_0xa1fc('0x42')]);return _0x35b0ac[_0xa1fc('0x50')](_0x15385a);}})['then'](function(_0x267fe2){if(_0x267fe2){_0x22a9c0=_0x267fe2[_0xa1fc('0x39')];if(!_0x48f548['query'][_0xa1fc('0x4f')](_0xa1fc('0x3a'))){_0x15385a[_0xa1fc('0x1f')]=qs['limit'](_0x48f548[_0xa1fc('0x34')][_0xa1fc('0x1f')]);_0x15385a[_0xa1fc('0x1e')]=qs[_0xa1fc('0x1e')](_0x48f548['query'][_0xa1fc('0x1e')]);}return _0x35b0ac[_0xa1fc('0x50')](_0x15385a);}})[_0xa1fc('0x27')](function(_0xd42978){if(_0xd42978){return _0xd42978?{'count':_0x22a9c0,'rows':_0xd42978}:null;}})[_0xa1fc('0x27')](respondWithResult(_0x37ffbd,null))[_0xa1fc('0x45')](handleError(_0x37ffbd,null));};exports['getDescriptions']=function(_0x36c8b3,_0x4305a0,_0x353d60){var _0x34b779={};var _0x124fbf={};var _0x591f3a;var _0x195a4a;return db[_0xa1fc('0x51')]['findOne']({'where':{'id':_0x36c8b3['params']['id']}})['then'](handleEntityNotFound(_0x4305a0,null))[_0xa1fc('0x27')](function(_0x20ca64){if(_0x20ca64){_0x591f3a=_0x20ca64;_0x124fbf[_0xa1fc('0x32')]=_[_0xa1fc('0x33')](db[_0xa1fc('0x4e')]['rawAttributes']);_0x124fbf['query']=_[_0xa1fc('0x33')](_0x36c8b3['query']);_0x124fbf[_0xa1fc('0x35')]=_[_0xa1fc('0x36')](_0x124fbf['model'],_0x124fbf['query']);_0x34b779[_0xa1fc('0x37')]=_[_0xa1fc('0x36')](_0x124fbf[_0xa1fc('0x32')],qs[_0xa1fc('0x38')](_0x36c8b3[_0xa1fc('0x34')][_0xa1fc('0x38')]));_0x34b779[_0xa1fc('0x37')]=_0x34b779[_0xa1fc('0x37')][_0xa1fc('0x39')]?_0x34b779[_0xa1fc('0x37')]:_0x124fbf[_0xa1fc('0x32')];_0x34b779['order']=qs['sort'](_0x36c8b3['query']['sort']);_0x34b779[_0xa1fc('0x3d')]=qs[_0xa1fc('0x35')](_[_0xa1fc('0x52')](_0x36c8b3[_0xa1fc('0x34')],_0x124fbf[_0xa1fc('0x35')]));if(_0x36c8b3[_0xa1fc('0x34')]['filter']){_0x34b779[_0xa1fc('0x3d')]=_[_0xa1fc('0x3f')](_0x34b779[_0xa1fc('0x3d')],{'$or':_[_0xa1fc('0x40')](_0x34b779['attributes'],function(_0x253e47){var _0x4ba132={};_0x4ba132[_0x253e47]={'$like':'%'+_0x36c8b3[_0xa1fc('0x34')]['filter']+'%'};return _0x4ba132;})});}_0x34b779=_[_0xa1fc('0x3f')]({},_0x34b779,_0x36c8b3[_0xa1fc('0x42')]);return _0x591f3a[_0xa1fc('0x53')](_0x34b779);}})['then'](function(_0x1d9723){if(_0x1d9723){_0x195a4a=_0x1d9723[_0xa1fc('0x39')];if(!_0x36c8b3[_0xa1fc('0x34')][_0xa1fc('0x4f')](_0xa1fc('0x3a'))){_0x34b779['limit']=qs[_0xa1fc('0x1f')](_0x36c8b3[_0xa1fc('0x34')]['limit']);_0x34b779[_0xa1fc('0x1e')]=qs['offset'](_0x36c8b3['query'][_0xa1fc('0x1e')]);}return _0x591f3a['getDescriptions'](_0x34b779);}})[_0xa1fc('0x27')](function(_0x340f8b){if(_0x340f8b){return _0x340f8b?{'count':_0x195a4a,'rows':_0x340f8b}:null;}})[_0xa1fc('0x27')](respondWithResult(_0x4305a0,null))[_0xa1fc('0x45')](handleError(_0x4305a0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e7c52bc..944f550 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 _0x4dd2=['../../config/logger','api','bluebird','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x4dd2,0xf1));var _0x24dd=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x4dd2[_0x5e6ea3];return _0x4048b5;};'use strict';var _=require('lodash');var util=require(_0x24dd('0x0'));var logger=require(_0x24dd('0x1'))(_0x24dd('0x2'));var moment=require('moment');var BPromise=require(_0x24dd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24dd('0x4'));var rimraf=require('rimraf');var config=require(_0x24dd('0x5'));var attributes=require(_0x24dd('0x6'));module[_0x24dd('0x7')]=function(_0x5d3f24,_0x524c5b){return _0x5d3f24[_0x24dd('0x8')](_0x24dd('0x9'),attributes,{'tableName':_0x24dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb35=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','util'];(function(_0x293138,_0x1a50fb){var _0x31f9eb=function(_0x23da80){while(--_0x23da80){_0x293138['push'](_0x293138['shift']());}};_0x31f9eb(++_0x1a50fb);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x373041,_0x251f6c){_0x373041=_0x373041-0x0;var _0x1e25ef=_0xbb35[_0x373041];return _0x1e25ef;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var logger=require(_0x5bb3('0x1'))(_0x5bb3('0x2'));var moment=require(_0x5bb3('0x3'));var BPromise=require(_0x5bb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bb3('0x5'));var rimraf=require(_0x5bb3('0x6'));var config=require(_0x5bb3('0x7'));var attributes=require(_0x5bb3('0x8'));module[_0x5bb3('0x9')]=function(_0x321535,_0x46ef03){return _0x321535[_0x5bb3('0xa')](_0x5bb3('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index ff8ddd4..cceadb3 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 _0x4fd8=['then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','ioredis','../../config/environment','jayson/promise','http'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x4fd8,0x129));var _0x84fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fd8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x84fd('0x0'));var util=require(_0x84fd('0x1'));var moment=require(_0x84fd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84fd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x84fd('0x4'));var jayson=require(_0x84fd('0x5'));var client=jayson['client'][_0x84fd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x55ad56,_0x43e744,_0x2239c6){return new BPromise(function(_0xa5c924,_0x1d9113){return client['request'](_0x55ad56,_0x2239c6)[_0x84fd('0x7')](function(_0x1cd30a){logger[_0x84fd('0x8')](_0x84fd('0x9'),_0x43e744,_0x84fd('0xa'));logger[_0x84fd('0xb')](_0x84fd('0xc'),_0x43e744,_0x84fd('0xa'),JSON['stringify'](_0x1cd30a));if(_0x1cd30a[_0x84fd('0xd')]){if(_0x1cd30a[_0x84fd('0xd')]['code']===0x1f4){logger[_0x84fd('0xd')](_0x84fd('0x9'),_0x43e744,_0x1cd30a[_0x84fd('0xd')][_0x84fd('0xe')]);return _0x1d9113(_0x1cd30a[_0x84fd('0xd')][_0x84fd('0xe')]);}logger[_0x84fd('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x43e744,_0x1cd30a[_0x84fd('0xd')]['message']);return _0xa5c924(_0x1cd30a[_0x84fd('0xd')][_0x84fd('0xe')]);}else{logger[_0x84fd('0x8')](_0x84fd('0x9'),_0x43e744,'request\x20sent');_0xa5c924(_0x1cd30a[_0x84fd('0xf')][_0x84fd('0xe')]);}})['catch'](function(_0x55029c){logger[_0x84fd('0xd')](_0x84fd('0x9'),_0x43e744,_0x55029c);_0x1d9113(_0x55029c);});});} \ No newline at end of file +var _0x642a=['request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x37e5ed,_0x41cba3){var _0x53e57a=function(_0x584499){while(--_0x584499){_0x37e5ed['push'](_0x37e5ed['shift']());}};_0x53e57a(++_0x41cba3);}(_0x642a,0x18f));var _0xa642=function(_0xb7ae81,_0x28dc63){_0xb7ae81=_0xb7ae81-0x0;var _0x10726a=_0x642a[_0xb7ae81];return _0x10726a;};'use strict';var _=require(_0xa642('0x0'));var util=require(_0xa642('0x1'));var moment=require('moment');var BPromise=require(_0xa642('0x2'));var rs=require(_0xa642('0x3'));var fs=require('fs');var Redis=require(_0xa642('0x4'));var db=require(_0xa642('0x5'))['db'];var utils=require(_0xa642('0x6'));var logger=require(_0xa642('0x7'))(_0xa642('0x8'));var config=require(_0xa642('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa642('0xa')][_0xa642('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58c6ae,_0xacd69a,_0x32180d){return new BPromise(function(_0x9f1d08,_0x4b9f0e){return client['request'](_0x58c6ae,_0x32180d)['then'](function(_0x26be0f){logger[_0xa642('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0xacd69a,'request\x20sent');logger[_0xa642('0xd')](_0xa642('0xe'),_0xacd69a,_0xa642('0xf'),JSON[_0xa642('0x10')](_0x26be0f));if(_0x26be0f[_0xa642('0x11')]){if(_0x26be0f[_0xa642('0x11')][_0xa642('0x12')]===0x1f4){logger[_0xa642('0x11')](_0xa642('0x13'),_0xacd69a,_0x26be0f[_0xa642('0x11')][_0xa642('0x14')]);return _0x4b9f0e(_0x26be0f[_0xa642('0x11')][_0xa642('0x14')]);}logger[_0xa642('0x11')](_0xa642('0x13'),_0xacd69a,_0x26be0f['error'][_0xa642('0x14')]);return _0x9f1d08(_0x26be0f[_0xa642('0x11')][_0xa642('0x14')]);}else{logger[_0xa642('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0xacd69a,_0xa642('0xf'));_0x9f1d08(_0x26be0f[_0xa642('0x15')][_0xa642('0x14')]);}})[_0xa642('0x16')](function(_0x495900){logger[_0xa642('0x11')](_0xa642('0x13'),_0xacd69a,_0x495900);_0x4b9f0e(_0x495900);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 32f87fa..b4365b5 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 _0x0676=['delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','post','put','update'];(function(_0x309458,_0xba6e63){var _0x3306ee=function(_0x47e10c){while(--_0x47e10c){_0x309458['push'](_0x309458['shift']());}};_0x3306ee(++_0xba6e63);}(_0x0676,0x91));var _0x6067=function(_0x1b16d5,_0x7b1379){_0x1b16d5=_0x1b16d5-0x0;var _0x597f7f=_0x0676[_0x1b16d5];return _0x597f7f;};'use strict';var multer=require(_0x6067('0x0'));var util=require(_0x6067('0x1'));var path=require(_0x6067('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6067('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6067('0x4'));var interaction=require(_0x6067('0x5'));var config=require(_0x6067('0x6'));var controller=require(_0x6067('0x7'));router['get']('/',auth[_0x6067('0x8')](),controller[_0x6067('0x9')]);router[_0x6067('0xa')](_0x6067('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6067('0xc')]('/',auth[_0x6067('0x8')](),controller['create']);router[_0x6067('0xd')](_0x6067('0xb'),auth[_0x6067('0x8')](),controller[_0x6067('0xe')]);router[_0x6067('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5a0e=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports'];(function(_0x327ac5,_0x4ce610){var _0x229b57=function(_0x401aa4){while(--_0x401aa4){_0x327ac5['push'](_0x327ac5['shift']());}};_0x229b57(++_0x4ce610);}(_0x5a0e,0xc6));var _0xe5a0=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0x5a0e[_0xcaf223];return _0x17e00d;};'use strict';var multer=require(_0xe5a0('0x0'));var util=require(_0xe5a0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe5a0('0x2'));var router=express[_0xe5a0('0x3')]();var fs_extra=require(_0xe5a0('0x4'));var auth=require(_0xe5a0('0x5'));var interaction=require(_0xe5a0('0x6'));var config=require('../../config/environment');var controller=require(_0xe5a0('0x7'));router[_0xe5a0('0x8')]('/',auth[_0xe5a0('0x9')](),controller[_0xe5a0('0xa')]);router[_0xe5a0('0x8')](_0xe5a0('0xb'),auth['isAuthenticated'](),controller[_0xe5a0('0xc')]);router[_0xe5a0('0xd')]('/',auth[_0xe5a0('0x9')](),controller['create']);router[_0xe5a0('0xe')](_0xe5a0('0xb'),auth[_0xe5a0('0x9')](),controller[_0xe5a0('0xf')]);router['delete'](_0xe5a0('0xb'),auth[_0xe5a0('0x9')](),controller[_0xe5a0('0x10')]);module[_0xe5a0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 9a1a6c8..16cb966 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 _0x7252=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x1dd8ca,_0x5a2037){var _0x47f46b=function(_0xc13a4f){while(--_0xc13a4f){_0x1dd8ca['push'](_0x1dd8ca['shift']());}};_0x47f46b(++_0x5a2037);}(_0x7252,0x94));var _0x2725=function(_0x14dba1,_0x313893){_0x14dba1=_0x14dba1-0x0;var _0x4857d7=_0x7252[_0x14dba1];return _0x4857d7;};'use strict';var Sequelize=require(_0x2725('0x0'));module[_0x2725('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2725('0x2'),_0x2725('0x3'),_0x2725('0x4'),_0x2725('0x5'),_0x2725('0x6')),'defaultValue':_0x2725('0x2')},'content':{'type':Sequelize[_0x2725('0x7')]},'key':{'type':Sequelize[_0x2725('0x7')]},'keyType':{'type':Sequelize[_0x2725('0x8')](_0x2725('0x2'),_0x2725('0x3'),_0x2725('0x4'))},'keyContent':{'type':Sequelize[_0x2725('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2725('0x7')]},'customField':{'type':Sequelize[_0x2725('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2725('0x7')]}}; \ No newline at end of file +var _0x804a=['string','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','keyValue','picklist','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x804a,0x158));var _0xa804=function(_0x22f86f,_0x4d2253){_0x22f86f=_0x22f86f-0x0;var _0x129a28=_0x804a[_0x22f86f];return _0x129a28;};'use strict';var Sequelize=require(_0xa804('0x0'));module[_0xa804('0x1')]={'type':{'type':Sequelize[_0xa804('0x2')]('string','variable','customVariable',_0xa804('0x3'),_0xa804('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa804('0x5')]},'key':{'type':Sequelize[_0xa804('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xa804('0x6'),_0xa804('0x7'),_0xa804('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa804('0x5')]},'customField':{'type':Sequelize[_0xa804('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa804('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index c5eedd0..15ea2cd 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 _0xadd1=['zip-dir','fast-json-patch','request-promise','bluebird','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/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ServicenowField','findAll','catch','show','params','find','create','body','eml-format'];(function(_0x5de4b5,_0x20b249){var _0x2b5fa7=function(_0x1b1b80){while(--_0x1b1b80){_0x5de4b5['push'](_0x5de4b5['shift']());}};_0x2b5fa7(++_0x20b249);}(_0xadd1,0x167));var _0x1add=function(_0x4ac535,_0x3f5899){_0x4ac535=_0x4ac535-0x0;var _0x18ab19=_0xadd1[_0x4ac535];return _0x18ab19;};'use strict';var emlformat=require(_0x1add('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1add('0x1'));var jsonpatch=require(_0x1add('0x2'));var rp=require(_0x1add('0x3'));var moment=require('moment');var BPromise=require(_0x1add('0x4'));var Mustache=require(_0x1add('0x5'));var util=require('util');var path=require(_0x1add('0x6'));var sox=require(_0x1add('0x7'));var csv=require(_0x1add('0x8'));var ejs=require(_0x1add('0x9'));var fs=require('fs');var fs_extra=require(_0x1add('0xa'));var _=require(_0x1add('0xb'));var squel=require('squel');var crypto=require(_0x1add('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1add('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1add('0xe'));var Papa=require(_0x1add('0xf'));var Redis=require(_0x1add('0x10'));var authService=require(_0x1add('0x11'));var qs=require(_0x1add('0x12'));var as=require(_0x1add('0x13'));var hardwareService=require(_0x1add('0x14'));var logger=require(_0x1add('0x15'))(_0x1add('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1add('0x17'));var db=require(_0x1add('0x18'))['db'];function respondWithStatusCode(_0x11c576,_0x579393){_0x579393=_0x579393||0xcc;return function(_0x2131ab){if(_0x2131ab){return _0x11c576[_0x1add('0x19')](_0x579393);}return _0x11c576[_0x1add('0x1a')](_0x579393)[_0x1add('0x1b')]();};}function respondWithResult(_0x3f7613,_0x2f0dbd){_0x2f0dbd=_0x2f0dbd||0xc8;return function(_0x95676b){if(_0x95676b){return _0x3f7613[_0x1add('0x1a')](_0x2f0dbd)[_0x1add('0x1c')](_0x95676b);}};}function respondWithFilteredResult(_0x2af398,_0x597310){return function(_0x40aa30){if(_0x40aa30){var _0x3511bf=typeof _0x597310[_0x1add('0x1d')]===_0x1add('0x1e')&&typeof _0x597310[_0x1add('0x1f')]===_0x1add('0x1e');var _0x50ac1f=_0x40aa30[_0x1add('0x20')];var _0x2a1716=_0x3511bf?0x0:_0x597310['offset'];var _0x1a9123=_0x3511bf?_0x40aa30['count']:_0x597310[_0x1add('0x1d')]+_0x597310['limit'];var _0x140dbc;if(_0x1a9123>=_0x50ac1f){_0x1a9123=_0x50ac1f;_0x140dbc=0xc8;}else{_0x140dbc=0xce;}_0x2af398[_0x1add('0x1a')](_0x140dbc);return _0x2af398['set'](_0x1add('0x21'),_0x2a1716+'-'+_0x1a9123+'/'+_0x50ac1f)[_0x1add('0x1c')](_0x40aa30);}return null;};}function patchUpdates(_0x4d1362){return function(_0x3c67c4){try{jsonpatch['apply'](_0x3c67c4,_0x4d1362,!![]);}catch(_0x4a5579){return BPromise[_0x1add('0x22')](_0x4a5579);}return _0x3c67c4[_0x1add('0x23')]();};}function saveUpdates(_0x11326e,_0x37af20){return function(_0x428543){if(_0x428543){return _0x428543[_0x1add('0x24')](_0x11326e)[_0x1add('0x25')](function(_0x1117f7){return _0x1117f7;});}return null;};}function removeEntity(_0x549880,_0x5bf9e9){return function(_0x36f474){if(_0x36f474){return _0x36f474[_0x1add('0x26')]()[_0x1add('0x25')](function(){_0x549880[_0x1add('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519eb0,_0x139b0a){return function(_0x1cff26){if(!_0x1cff26){_0x519eb0[_0x1add('0x19')](0x194);}return _0x1cff26;};}function handleError(_0x3afd7e,_0x205888){_0x205888=_0x205888||0x1f4;return function(_0x3a410c){logger[_0x1add('0x27')](_0x3a410c[_0x1add('0x28')]);if(_0x3a410c[_0x1add('0x29')]){delete _0x3a410c[_0x1add('0x29')];}_0x3afd7e['status'](_0x205888)[_0x1add('0x2a')](_0x3a410c);};}exports['index']=function(_0x545539,_0x537baf){var _0x7027ee={},_0x325693={},_0x544673={'count':0x0,'rows':[]};var _0x4b8509=_[_0x1add('0x2b')](db['ServicenowField'][_0x1add('0x2c')],function(_0x1b024d){return{'name':_0x1b024d['fieldName'],'type':_0x1b024d[_0x1add('0x2d')][_0x1add('0x2e')]};});_0x325693[_0x1add('0x2f')]=_[_0x1add('0x2b')](_0x4b8509,_0x1add('0x29'));_0x325693[_0x1add('0x30')]=_[_0x1add('0x31')](_0x545539[_0x1add('0x30')]);_0x325693['filters']=_[_0x1add('0x32')](_0x325693[_0x1add('0x2f')],_0x325693[_0x1add('0x30')]);_0x7027ee[_0x1add('0x33')]=_[_0x1add('0x32')](_0x325693[_0x1add('0x2f')],qs[_0x1add('0x34')](_0x545539[_0x1add('0x30')][_0x1add('0x34')]));_0x7027ee[_0x1add('0x33')]=_0x7027ee[_0x1add('0x33')][_0x1add('0x35')]?_0x7027ee[_0x1add('0x33')]:_0x325693[_0x1add('0x2f')];if(!_0x545539[_0x1add('0x30')][_0x1add('0x36')]('nolimit')){_0x7027ee[_0x1add('0x1f')]=qs[_0x1add('0x1f')](_0x545539['query'][_0x1add('0x1f')]);_0x7027ee[_0x1add('0x1d')]=qs[_0x1add('0x1d')](_0x545539[_0x1add('0x30')][_0x1add('0x1d')]);}_0x7027ee[_0x1add('0x37')]=qs[_0x1add('0x38')](_0x545539[_0x1add('0x30')][_0x1add('0x38')]);_0x7027ee[_0x1add('0x39')]=qs[_0x1add('0x3a')](_[_0x1add('0x3b')](_0x545539['query'],_0x325693[_0x1add('0x3a')]),_0x4b8509);if(_0x545539[_0x1add('0x30')][_0x1add('0x3c')]){_0x7027ee['where']=_['merge'](_0x7027ee[_0x1add('0x39')],{'$or':_[_0x1add('0x2b')](_0x4b8509,function(_0x2dda8b){if(_0x2dda8b[_0x1add('0x2d')]!==_0x1add('0x3d')){var _0x2488db={};_0x2488db[_0x2dda8b[_0x1add('0x29')]]={'$like':'%'+_0x545539[_0x1add('0x30')][_0x1add('0x3c')]+'%'};return _0x2488db;}})});}_0x7027ee=_[_0x1add('0x3e')]({},_0x7027ee,_0x545539[_0x1add('0x3f')]);var _0x4dddc8={'where':_0x7027ee[_0x1add('0x39')]};return db[_0x1add('0x40')][_0x1add('0x20')](_0x4dddc8)['then'](function(_0x28b1e4){_0x544673[_0x1add('0x20')]=_0x28b1e4;if(_0x545539[_0x1add('0x30')]['includeAll']){_0x7027ee['include']=[{'all':!![]}];}return db[_0x1add('0x40')][_0x1add('0x41')](_0x7027ee);})['then'](function(_0x5ed35f){_0x544673['rows']=_0x5ed35f;return _0x544673;})[_0x1add('0x25')](respondWithFilteredResult(_0x537baf,_0x7027ee))[_0x1add('0x42')](handleError(_0x537baf,null));};exports[_0x1add('0x43')]=function(_0x332c19,_0x4fa67b){var _0x2b5a19={'raw':!![],'where':{'id':_0x332c19[_0x1add('0x44')]['id']}},_0x2629ba={};_0x2629ba['model']=_['keys'](db[_0x1add('0x40')][_0x1add('0x2c')]);_0x2629ba[_0x1add('0x30')]=_[_0x1add('0x31')](_0x332c19[_0x1add('0x30')]);_0x2629ba[_0x1add('0x3a')]=_[_0x1add('0x32')](_0x2629ba[_0x1add('0x2f')],_0x2629ba[_0x1add('0x30')]);_0x2b5a19[_0x1add('0x33')]=_[_0x1add('0x32')](_0x2629ba[_0x1add('0x2f')],qs['fields'](_0x332c19[_0x1add('0x30')]['fields']));_0x2b5a19['attributes']=_0x2b5a19[_0x1add('0x33')]['length']?_0x2b5a19['attributes']:_0x2629ba[_0x1add('0x2f')];if(_0x332c19['query']['includeAll']){_0x2b5a19['include']=[{'all':!![]}];}_0x2b5a19=_[_0x1add('0x3e')]({},_0x2b5a19,_0x332c19[_0x1add('0x3f')]);return db[_0x1add('0x40')][_0x1add('0x45')](_0x2b5a19)[_0x1add('0x25')](handleEntityNotFound(_0x4fa67b,null))[_0x1add('0x25')](respondWithResult(_0x4fa67b,null))['catch'](handleError(_0x4fa67b,null));};exports[_0x1add('0x46')]=function(_0x14b360,_0x2cb4d2){return db[_0x1add('0x40')][_0x1add('0x46')](_0x14b360['body'],{})[_0x1add('0x25')](respondWithResult(_0x2cb4d2,0xc9))[_0x1add('0x42')](handleError(_0x2cb4d2,null));};exports[_0x1add('0x24')]=function(_0x383836,_0xe1e9d9){if(_0x383836[_0x1add('0x47')]['id']){delete _0x383836[_0x1add('0x47')]['id'];}return db[_0x1add('0x40')]['find']({'where':{'id':_0x383836[_0x1add('0x44')]['id']}})[_0x1add('0x25')](handleEntityNotFound(_0xe1e9d9,null))[_0x1add('0x25')](saveUpdates(_0x383836[_0x1add('0x47')],null))[_0x1add('0x25')](respondWithResult(_0xe1e9d9,null))[_0x1add('0x42')](handleError(_0xe1e9d9,null));};exports[_0x1add('0x26')]=function(_0x5b5331,_0x32667b){return db[_0x1add('0x40')][_0x1add('0x45')]({'where':{'id':_0x5b5331['params']['id']}})['then'](handleEntityNotFound(_0x32667b,null))[_0x1add('0x25')](removeEntity(_0x32667b,null))['catch'](handleError(_0x32667b,null));}; \ No newline at end of file +var _0xbd43=['intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','ServicenowField','fieldName','type','key','model','map','query','filters'];(function(_0x3a4f02,_0x46a551){var _0x1cbcb3=function(_0x2efd1e){while(--_0x2efd1e){_0x3a4f02['push'](_0x3a4f02['shift']());}};_0x1cbcb3(++_0x46a551);}(_0xbd43,0xf7));var _0x3bd4=function(_0x1a4878,_0x26adb8){_0x1a4878=_0x1a4878-0x0;var _0x3e5350=_0xbd43[_0x1a4878];return _0x3e5350;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bd4('0x0'));var zipdir=require(_0x3bd4('0x1'));var jsonpatch=require(_0x3bd4('0x2'));var rp=require(_0x3bd4('0x3'));var moment=require('moment');var BPromise=require(_0x3bd4('0x4'));var Mustache=require('mustache');var util=require(_0x3bd4('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bd4('0x6'));var fs=require('fs');var fs_extra=require(_0x3bd4('0x7'));var _=require(_0x3bd4('0x8'));var squel=require(_0x3bd4('0x9'));var crypto=require(_0x3bd4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3bd4('0xb'));var toCsv=require(_0x3bd4('0xc'));var querystring=require(_0x3bd4('0xd'));var Papa=require(_0x3bd4('0xe'));var Redis=require('ioredis');var authService=require(_0x3bd4('0xf'));var qs=require(_0x3bd4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bd4('0x11'))(_0x3bd4('0x12'));var utils=require(_0x3bd4('0x13'));var config=require(_0x3bd4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bd4('0x15'))['db'];function respondWithStatusCode(_0x35ff4c,_0x2e137d){_0x2e137d=_0x2e137d||0xcc;return function(_0x3656eb){if(_0x3656eb){return _0x35ff4c[_0x3bd4('0x16')](_0x2e137d);}return _0x35ff4c['status'](_0x2e137d)[_0x3bd4('0x17')]();};}function respondWithResult(_0x597ab6,_0x13923f){_0x13923f=_0x13923f||0xc8;return function(_0x44bfe2){if(_0x44bfe2){return _0x597ab6['status'](_0x13923f)['json'](_0x44bfe2);}};}function respondWithFilteredResult(_0x4d0d16,_0x1b8ece){return function(_0x3f3058){if(_0x3f3058){var _0x4bbfbc=typeof _0x1b8ece['offset']===_0x3bd4('0x18')&&typeof _0x1b8ece[_0x3bd4('0x19')]===_0x3bd4('0x18');var _0xf0fe4e=_0x3f3058[_0x3bd4('0x1a')];var _0x11ab1e=_0x4bbfbc?0x0:_0x1b8ece[_0x3bd4('0x1b')];var _0xfd73a8=_0x4bbfbc?_0x3f3058['count']:_0x1b8ece[_0x3bd4('0x1b')]+_0x1b8ece[_0x3bd4('0x19')];var _0x468f69;if(_0xfd73a8>=_0xf0fe4e){_0xfd73a8=_0xf0fe4e;_0x468f69=0xc8;}else{_0x468f69=0xce;}_0x4d0d16[_0x3bd4('0x1c')](_0x468f69);return _0x4d0d16[_0x3bd4('0x1d')](_0x3bd4('0x1e'),_0x11ab1e+'-'+_0xfd73a8+'/'+_0xf0fe4e)[_0x3bd4('0x1f')](_0x3f3058);}return null;};}function patchUpdates(_0x20a620){return function(_0x9f8007){try{jsonpatch[_0x3bd4('0x20')](_0x9f8007,_0x20a620,!![]);}catch(_0xe81bb){return BPromise['reject'](_0xe81bb);}return _0x9f8007[_0x3bd4('0x21')]();};}function saveUpdates(_0x588c82,_0x157b47){return function(_0x5a7381){if(_0x5a7381){return _0x5a7381['update'](_0x588c82)[_0x3bd4('0x22')](function(_0x582784){return _0x582784;});}return null;};}function removeEntity(_0x28802e,_0x4a2e12){return function(_0x44278c){if(_0x44278c){return _0x44278c[_0x3bd4('0x23')]()[_0x3bd4('0x22')](function(){_0x28802e[_0x3bd4('0x1c')](0xcc)[_0x3bd4('0x17')]();});}};}function handleEntityNotFound(_0x4ecf68,_0x52da60){return function(_0x266654){if(!_0x266654){_0x4ecf68[_0x3bd4('0x16')](0x194);}return _0x266654;};}function handleError(_0x180978,_0xa80229){_0xa80229=_0xa80229||0x1f4;return function(_0x158ab6){logger[_0x3bd4('0x24')](_0x158ab6[_0x3bd4('0x25')]);if(_0x158ab6[_0x3bd4('0x26')]){delete _0x158ab6[_0x3bd4('0x26')];}_0x180978[_0x3bd4('0x1c')](_0xa80229)[_0x3bd4('0x27')](_0x158ab6);};}exports[_0x3bd4('0x28')]=function(_0xe3b7e6,_0x17dbde){var _0x5612bd={},_0x83a34={},_0x4ecb66={'count':0x0,'rows':[]};var _0x126258=_['map'](db[_0x3bd4('0x29')]['rawAttributes'],function(_0x469559){return{'name':_0x469559[_0x3bd4('0x2a')],'type':_0x469559[_0x3bd4('0x2b')][_0x3bd4('0x2c')]};});_0x83a34[_0x3bd4('0x2d')]=_[_0x3bd4('0x2e')](_0x126258,_0x3bd4('0x26'));_0x83a34[_0x3bd4('0x2f')]=_['keys'](_0xe3b7e6[_0x3bd4('0x2f')]);_0x83a34[_0x3bd4('0x30')]=_[_0x3bd4('0x31')](_0x83a34[_0x3bd4('0x2d')],_0x83a34[_0x3bd4('0x2f')]);_0x5612bd[_0x3bd4('0x32')]=_[_0x3bd4('0x31')](_0x83a34[_0x3bd4('0x2d')],qs['fields'](_0xe3b7e6[_0x3bd4('0x2f')][_0x3bd4('0x33')]));_0x5612bd[_0x3bd4('0x32')]=_0x5612bd['attributes'][_0x3bd4('0x34')]?_0x5612bd[_0x3bd4('0x32')]:_0x83a34[_0x3bd4('0x2d')];if(!_0xe3b7e6[_0x3bd4('0x2f')]['hasOwnProperty'](_0x3bd4('0x35'))){_0x5612bd[_0x3bd4('0x19')]=qs[_0x3bd4('0x19')](_0xe3b7e6['query']['limit']);_0x5612bd[_0x3bd4('0x1b')]=qs[_0x3bd4('0x1b')](_0xe3b7e6[_0x3bd4('0x2f')][_0x3bd4('0x1b')]);}_0x5612bd['order']=qs[_0x3bd4('0x36')](_0xe3b7e6[_0x3bd4('0x2f')][_0x3bd4('0x36')]);_0x5612bd['where']=qs[_0x3bd4('0x30')](_[_0x3bd4('0x37')](_0xe3b7e6[_0x3bd4('0x2f')],_0x83a34[_0x3bd4('0x30')]),_0x126258);if(_0xe3b7e6[_0x3bd4('0x2f')]['filter']){_0x5612bd[_0x3bd4('0x38')]=_[_0x3bd4('0x39')](_0x5612bd[_0x3bd4('0x38')],{'$or':_[_0x3bd4('0x2e')](_0x126258,function(_0x22681a){if(_0x22681a[_0x3bd4('0x2b')]!==_0x3bd4('0x3a')){var _0x549423={};_0x549423[_0x22681a['name']]={'$like':'%'+_0xe3b7e6['query'][_0x3bd4('0x3b')]+'%'};return _0x549423;}})});}_0x5612bd=_[_0x3bd4('0x39')]({},_0x5612bd,_0xe3b7e6[_0x3bd4('0x3c')]);var _0x524f5f={'where':_0x5612bd[_0x3bd4('0x38')]};return db['ServicenowField'][_0x3bd4('0x1a')](_0x524f5f)[_0x3bd4('0x22')](function(_0x3d3350){_0x4ecb66[_0x3bd4('0x1a')]=_0x3d3350;if(_0xe3b7e6[_0x3bd4('0x2f')][_0x3bd4('0x3d')]){_0x5612bd[_0x3bd4('0x3e')]=[{'all':!![]}];}return db[_0x3bd4('0x29')][_0x3bd4('0x3f')](_0x5612bd);})[_0x3bd4('0x22')](function(_0x1fa968){_0x4ecb66[_0x3bd4('0x40')]=_0x1fa968;return _0x4ecb66;})[_0x3bd4('0x22')](respondWithFilteredResult(_0x17dbde,_0x5612bd))['catch'](handleError(_0x17dbde,null));};exports[_0x3bd4('0x41')]=function(_0x3c7aa4,_0x55d361){var _0x49de78={'raw':!![],'where':{'id':_0x3c7aa4[_0x3bd4('0x42')]['id']}},_0x549bf4={};_0x549bf4['model']=_[_0x3bd4('0x43')](db['ServicenowField'][_0x3bd4('0x44')]);_0x549bf4[_0x3bd4('0x2f')]=_[_0x3bd4('0x43')](_0x3c7aa4[_0x3bd4('0x2f')]);_0x549bf4[_0x3bd4('0x30')]=_[_0x3bd4('0x31')](_0x549bf4['model'],_0x549bf4[_0x3bd4('0x2f')]);_0x49de78[_0x3bd4('0x32')]=_['intersection'](_0x549bf4[_0x3bd4('0x2d')],qs[_0x3bd4('0x33')](_0x3c7aa4[_0x3bd4('0x2f')]['fields']));_0x49de78[_0x3bd4('0x32')]=_0x49de78[_0x3bd4('0x32')][_0x3bd4('0x34')]?_0x49de78[_0x3bd4('0x32')]:_0x549bf4[_0x3bd4('0x2d')];if(_0x3c7aa4[_0x3bd4('0x2f')][_0x3bd4('0x3d')]){_0x49de78['include']=[{'all':!![]}];}_0x49de78=_['merge']({},_0x49de78,_0x3c7aa4[_0x3bd4('0x3c')]);return db['ServicenowField'][_0x3bd4('0x45')](_0x49de78)[_0x3bd4('0x22')](handleEntityNotFound(_0x55d361,null))[_0x3bd4('0x22')](respondWithResult(_0x55d361,null))[_0x3bd4('0x46')](handleError(_0x55d361,null));};exports[_0x3bd4('0x47')]=function(_0x565893,_0x1e1149){return db[_0x3bd4('0x29')]['create'](_0x565893[_0x3bd4('0x48')],{})[_0x3bd4('0x22')](respondWithResult(_0x1e1149,0xc9))[_0x3bd4('0x46')](handleError(_0x1e1149,null));};exports[_0x3bd4('0x49')]=function(_0x105c16,_0x224ae5){if(_0x105c16[_0x3bd4('0x48')]['id']){delete _0x105c16['body']['id'];}return db[_0x3bd4('0x29')][_0x3bd4('0x45')]({'where':{'id':_0x105c16[_0x3bd4('0x42')]['id']}})[_0x3bd4('0x22')](handleEntityNotFound(_0x224ae5,null))[_0x3bd4('0x22')](saveUpdates(_0x105c16[_0x3bd4('0x48')],null))[_0x3bd4('0x22')](respondWithResult(_0x224ae5,null))[_0x3bd4('0x46')](handleError(_0x224ae5,null));};exports[_0x3bd4('0x23')]=function(_0x450b2c,_0x1c8634){return db['ServicenowField'][_0x3bd4('0x45')]({'where':{'id':_0x450b2c[_0x3bd4('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c8634,null))[_0x3bd4('0x22')](removeEntity(_0x1c8634,null))[_0x3bd4('0x46')](handleError(_0x1c8634,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 0b4afe5..351d710 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 _0x2421=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash'];(function(_0x2f8a7c,_0x3f65fd){var _0x257e01=function(_0x412826){while(--_0x412826){_0x2f8a7c['push'](_0x2f8a7c['shift']());}};_0x257e01(++_0x3f65fd);}(_0x2421,0x12b));var _0x1242=function(_0xbe052d,_0x5687a9){_0xbe052d=_0xbe052d-0x0;var _0x27270c=_0x2421[_0xbe052d];return _0x27270c;};'use strict';var _=require(_0x1242('0x0'));var util=require(_0x1242('0x1'));var logger=require(_0x1242('0x2'))(_0x1242('0x3'));var moment=require(_0x1242('0x4'));var BPromise=require('bluebird');var rp=require(_0x1242('0x5'));var fs=require('fs');var path=require(_0x1242('0x6'));var rimraf=require(_0x1242('0x7'));var config=require(_0x1242('0x8'));var attributes=require(_0x1242('0x9'));module['exports']=function(_0x3c316a,_0x2eccac){return _0x3c316a[_0x1242('0xa')](_0x1242('0xb'),attributes,{'tableName':_0x1242('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1242('0xd'),_0x1242('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdff=['exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','api','bluebird','request-promise','rimraf','./intServicenowField.attributes'];(function(_0x1611be,_0x45b887){var _0x231601=function(_0x474a78){while(--_0x474a78){_0x1611be['push'](_0x1611be['shift']());}};_0x231601(++_0x45b887);}(_0xcdff,0xc9));var _0xfcdf=function(_0xf8815,_0x44292e){_0xf8815=_0xf8815-0x0;var _0x5dbe2b=_0xcdff[_0xf8815];return _0x5dbe2b;};'use strict';var _=require(_0xfcdf('0x0'));var util=require(_0xfcdf('0x1'));var logger=require('../../config/logger')(_0xfcdf('0x2'));var moment=require('moment');var BPromise=require(_0xfcdf('0x3'));var rp=require(_0xfcdf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcdf('0x5'));var config=require('../../config/environment');var attributes=require(_0xfcdf('0x6'));module[_0xfcdf('0x7')]=function(_0x448842,_0x41735c){return _0x448842[_0xfcdf('0x8')](_0xfcdf('0x9'),attributes,{'tableName':_0xfcdf('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xfcdf('0xb'),_0xfcdf('0xc')],'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 f1eda79..f7c7c66 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2dc1a0,_0x29cf94){var _0x3d7e3d=function(_0x25b5d9){while(--_0x25b5d9){_0x2dc1a0['push'](_0x2dc1a0['shift']());}};_0x3d7e3d(++_0x29cf94);}(_0xaa88,0x137));var _0x8aa8=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xaa88[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x32e9d3,_0xf8e7b6){var _0x5a57c1=function(_0x131ffd){while(--_0x131ffd){_0x32e9d3['push'](_0x32e9d3['shift']());}};_0x5a57c1(++_0xf8e7b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 07d0525..250e8ff 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x279ff1,_0x474b5){var _0x571459=function(_0x25aa80){while(--_0x25aa80){_0x279ff1['push'](_0x279ff1['shift']());}};_0x571459(++_0x474b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5b99ff,_0x3e4341){var _0x58dd63=function(_0x10fee6){while(--_0x10fee6){_0x5b99ff['push'](_0x5b99ff['shift']());}};_0x58dd63(++_0x3e4341);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index fb842d2..95387b6 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(_0x3d2be5,_0x4c86c1){var _0x175ba8=function(_0x53c053){while(--_0x53c053){_0x3d2be5['push'](_0x3d2be5['shift']());}};_0x175ba8(++_0x4c86c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x1e5829,_0xb464cd){var _0x5552ea=function(_0x11b15c){while(--_0x11b15c){_0x1e5829['push'](_0x1e5829['shift']());}};_0x5552ea(++_0xb464cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 6a42cda..eda7aef 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 _0x78f5=['key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','include','rows','includeAll','find','create','catch','body','params','nolimit','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','includes','label','endsWith','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','then','error','name','send','map','SugarcrmAccount','rawAttributes','fieldName'];(function(_0x23da4d,_0x63498c){var _0x4ae55=function(_0x323d75){while(--_0x323d75){_0x23da4d['push'](_0x23da4d['shift']());}};_0x4ae55(++_0x63498c);}(_0x78f5,0x12b));var _0x578f=function(_0xdd7a7b,_0x254b3a){_0xdd7a7b=_0xdd7a7b-0x0;var _0x40ca7d=_0x78f5[_0xdd7a7b];return _0x40ca7d;};'use strict';var emlformat=require(_0x578f('0x0'));var rimraf=require(_0x578f('0x1'));var zipdir=require(_0x578f('0x2'));var jsonpatch=require(_0x578f('0x3'));var rp=require(_0x578f('0x4'));var moment=require('moment');var BPromise=require(_0x578f('0x5'));var Mustache=require(_0x578f('0x6'));var util=require('util');var path=require(_0x578f('0x7'));var sox=require('sox');var csv=require(_0x578f('0x8'));var ejs=require(_0x578f('0x9'));var fs=require('fs');var fs_extra=require(_0x578f('0xa'));var _=require(_0x578f('0xb'));var squel=require(_0x578f('0xc'));var crypto=require('crypto');var jsforce=require(_0x578f('0xd'));var deskjs=require(_0x578f('0xe'));var toCsv=require(_0x578f('0x8'));var querystring=require(_0x578f('0xf'));var Papa=require(_0x578f('0x10'));var Redis=require(_0x578f('0x11'));var authService=require(_0x578f('0x12'));var qs=require(_0x578f('0x13'));var as=require(_0x578f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x578f('0x15'))(_0x578f('0x16'));var utils=require(_0x578f('0x17'));var config=require(_0x578f('0x18'));var licenseUtil=require(_0x578f('0x19'));var db=require(_0x578f('0x1a'))['db'];var integrations=require(_0x578f('0x1b'));function respondWithStatusCode(_0x5ddeab,_0x313265){_0x313265=_0x313265||0xcc;return function(_0x2278a9){if(_0x2278a9){return _0x5ddeab[_0x578f('0x1c')](_0x313265);}return _0x5ddeab[_0x578f('0x1d')](_0x313265)[_0x578f('0x1e')]();};}function respondWithResult(_0x2f78d2,_0x284b8b){_0x284b8b=_0x284b8b||0xc8;return function(_0x83e613){if(_0x83e613){return _0x2f78d2['status'](_0x284b8b)[_0x578f('0x1f')](_0x83e613);}};}function respondWithFilteredResult(_0x49a994,_0x467f5e){return function(_0x545f7f){if(_0x545f7f){var _0xed6ff3=typeof _0x467f5e[_0x578f('0x20')]===_0x578f('0x21')&&typeof _0x467f5e[_0x578f('0x22')]==='undefined';var _0x332be3=_0x545f7f[_0x578f('0x23')];var _0x3e92b8=_0xed6ff3?0x0:_0x467f5e[_0x578f('0x20')];var _0x3c3a3c=_0xed6ff3?_0x545f7f[_0x578f('0x23')]:_0x467f5e[_0x578f('0x20')]+_0x467f5e[_0x578f('0x22')];var _0x540da8;if(_0x3c3a3c>=_0x332be3){_0x3c3a3c=_0x332be3;_0x540da8=0xc8;}else{_0x540da8=0xce;}_0x49a994['status'](_0x540da8);return _0x49a994['set'](_0x578f('0x24'),_0x3e92b8+'-'+_0x3c3a3c+'/'+_0x332be3)[_0x578f('0x1f')](_0x545f7f);}return null;};}function patchUpdates(_0xe90a61){return function(_0x1e47e4){try{jsonpatch[_0x578f('0x25')](_0x1e47e4,_0xe90a61,!![]);}catch(_0x1f7c21){return BPromise['reject'](_0x1f7c21);}return _0x1e47e4['save']();};}function saveUpdates(_0x168ebe,_0x4ba31a){return function(_0x30e988){if(_0x30e988){return _0x30e988['update'](_0x168ebe)[_0x578f('0x26')](function(_0x3f576a){return _0x3f576a;});}return null;};}function removeEntity(_0x5008ca,_0x318b8f){return function(_0xcb77ee){if(_0xcb77ee){return _0xcb77ee['destroy']()['then'](function(){_0x5008ca['status'](0xcc)[_0x578f('0x1e')]();});}};}function handleEntityNotFound(_0x304a53,_0x37c606){return function(_0x295ef0){if(!_0x295ef0){_0x304a53[_0x578f('0x1c')](0x194);}return _0x295ef0;};}function handleError(_0x38de52,_0x2ff1f6){_0x2ff1f6=_0x2ff1f6||0x1f4;return function(_0xf3b8f3){logger[_0x578f('0x27')](_0xf3b8f3['stack']);if(_0xf3b8f3['name']){delete _0xf3b8f3[_0x578f('0x28')];}_0x38de52[_0x578f('0x1d')](_0x2ff1f6)[_0x578f('0x29')](_0xf3b8f3);};}exports['index']=function(_0x390808,_0x36b18f){var _0x1ec842={},_0x5e5d25={},_0xd7f73f={'count':0x0,'rows':[]};var _0x45c74c=_[_0x578f('0x2a')](db[_0x578f('0x2b')][_0x578f('0x2c')],function(_0x19ff68){return{'name':_0x19ff68[_0x578f('0x2d')],'type':_0x19ff68['type'][_0x578f('0x2e')]};});_0x5e5d25[_0x578f('0x2f')]=_[_0x578f('0x2a')](_0x45c74c,_0x578f('0x28'));_0x5e5d25['query']=_[_0x578f('0x30')](_0x390808[_0x578f('0x31')]);_0x5e5d25[_0x578f('0x32')]=_[_0x578f('0x33')](_0x5e5d25[_0x578f('0x2f')],_0x5e5d25[_0x578f('0x31')]);_0x1ec842['attributes']=_['intersection'](_0x5e5d25[_0x578f('0x2f')],qs[_0x578f('0x34')](_0x390808[_0x578f('0x31')][_0x578f('0x34')]));_0x1ec842[_0x578f('0x35')]=_0x1ec842[_0x578f('0x35')][_0x578f('0x36')]?_0x1ec842[_0x578f('0x35')]:_0x5e5d25['model'];if(!_0x390808[_0x578f('0x31')][_0x578f('0x37')]('nolimit')){_0x1ec842[_0x578f('0x22')]=qs[_0x578f('0x22')](_0x390808[_0x578f('0x31')][_0x578f('0x22')]);_0x1ec842['offset']=qs[_0x578f('0x20')](_0x390808[_0x578f('0x31')][_0x578f('0x20')]);}_0x1ec842[_0x578f('0x38')]=qs[_0x578f('0x39')](_0x390808[_0x578f('0x31')]['sort']);_0x1ec842[_0x578f('0x3a')]=qs[_0x578f('0x32')](_[_0x578f('0x3b')](_0x390808[_0x578f('0x31')],_0x5e5d25[_0x578f('0x32')]),_0x45c74c);if(_0x390808[_0x578f('0x31')]['filter']){_0x1ec842[_0x578f('0x3a')]=_['merge'](_0x1ec842['where'],{'$or':_[_0x578f('0x2a')](_0x45c74c,function(_0x238c62){if(_0x238c62[_0x578f('0x3c')]!==_0x578f('0x3d')){var _0x1833bd={};_0x1833bd[_0x238c62[_0x578f('0x28')]]={'$like':'%'+_0x390808['query'][_0x578f('0x3e')]+'%'};return _0x1833bd;}})});}_0x1ec842=_[_0x578f('0x3f')]({},_0x1ec842,_0x390808[_0x578f('0x40')]);var _0x56e3d6={'where':_0x1ec842[_0x578f('0x3a')]};return db[_0x578f('0x2b')][_0x578f('0x23')](_0x56e3d6)[_0x578f('0x26')](function(_0x167129){_0xd7f73f[_0x578f('0x23')]=_0x167129;if(_0x390808['query']['includeAll']){_0x1ec842[_0x578f('0x41')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x1ec842);})[_0x578f('0x26')](function(_0x3c51b0){_0xd7f73f[_0x578f('0x42')]=_0x3c51b0;return _0xd7f73f;})[_0x578f('0x26')](respondWithFilteredResult(_0x36b18f,_0x1ec842))['catch'](handleError(_0x36b18f,null));};exports['show']=function(_0x5ae397,_0x228df0){var _0x24abbe={'raw':![],'where':{'id':_0x5ae397['params']['id']}},_0x2a2161={};_0x2a2161[_0x578f('0x2f')]=_[_0x578f('0x30')](db[_0x578f('0x2b')][_0x578f('0x2c')]);_0x2a2161[_0x578f('0x31')]=_[_0x578f('0x30')](_0x5ae397[_0x578f('0x31')]);_0x2a2161[_0x578f('0x32')]=_['intersection'](_0x2a2161['model'],_0x2a2161[_0x578f('0x31')]);_0x24abbe[_0x578f('0x35')]=_[_0x578f('0x33')](_0x2a2161['model'],qs[_0x578f('0x34')](_0x5ae397[_0x578f('0x31')][_0x578f('0x34')]));_0x24abbe[_0x578f('0x35')]=_0x24abbe[_0x578f('0x35')][_0x578f('0x36')]?_0x24abbe['attributes']:_0x2a2161[_0x578f('0x2f')];if(_0x5ae397[_0x578f('0x31')][_0x578f('0x43')]){_0x24abbe['include']=[{'all':!![]}];}_0x24abbe=_[_0x578f('0x3f')]({},_0x24abbe,_0x5ae397[_0x578f('0x40')]);return db[_0x578f('0x2b')][_0x578f('0x44')](_0x24abbe)[_0x578f('0x26')](handleEntityNotFound(_0x228df0,null))[_0x578f('0x26')](respondWithResult(_0x228df0,null))['catch'](handleError(_0x228df0,null));};exports[_0x578f('0x45')]=function(_0x29efdb,_0x11267b){return db['SugarcrmAccount'][_0x578f('0x45')](_0x29efdb['body'],{})[_0x578f('0x26')](respondWithResult(_0x11267b,0xc9))[_0x578f('0x46')](handleError(_0x11267b,null));};exports['update']=function(_0x5ed825,_0x115992){if(_0x5ed825[_0x578f('0x47')]['id']){delete _0x5ed825['body']['id'];}return db[_0x578f('0x2b')][_0x578f('0x44')]({'where':{'id':_0x5ed825[_0x578f('0x48')]['id']}})[_0x578f('0x26')](handleEntityNotFound(_0x115992,null))[_0x578f('0x26')](saveUpdates(_0x5ed825[_0x578f('0x47')],null))[_0x578f('0x26')](respondWithResult(_0x115992,null))[_0x578f('0x46')](handleError(_0x115992,null));};exports['destroy']=function(_0x1cc4d0,_0x4c7606){return db['SugarcrmAccount']['find']({'where':{'id':_0x1cc4d0[_0x578f('0x48')]['id']}})[_0x578f('0x26')](handleEntityNotFound(_0x4c7606,null))['then'](removeEntity(_0x4c7606,null))[_0x578f('0x46')](handleError(_0x4c7606,null));};exports['getConfigurations']=function(_0x35884b,_0x2e8f9f,_0x58e041){var _0x42ac10={};var _0x110a10={};var _0xc750cb;var _0x1770a5;return db[_0x578f('0x2b')]['findOne']({'where':{'id':_0x35884b[_0x578f('0x48')]['id']}})[_0x578f('0x26')](handleEntityNotFound(_0x2e8f9f,null))[_0x578f('0x26')](function(_0x22de9b){if(_0x22de9b){_0xc750cb=_0x22de9b;_0x110a10[_0x578f('0x2f')]=_['keys'](db['SugarcrmConfiguration'][_0x578f('0x2c')]);_0x110a10[_0x578f('0x31')]=_[_0x578f('0x30')](_0x35884b[_0x578f('0x31')]);_0x110a10[_0x578f('0x32')]=_['intersection'](_0x110a10[_0x578f('0x2f')],_0x110a10[_0x578f('0x31')]);_0x42ac10[_0x578f('0x35')]=_[_0x578f('0x33')](_0x110a10['model'],qs[_0x578f('0x34')](_0x35884b[_0x578f('0x31')][_0x578f('0x34')]));_0x42ac10[_0x578f('0x35')]=_0x42ac10[_0x578f('0x35')][_0x578f('0x36')]?_0x42ac10['attributes']:_0x110a10[_0x578f('0x2f')];_0x42ac10[_0x578f('0x38')]=qs[_0x578f('0x39')](_0x35884b[_0x578f('0x31')][_0x578f('0x39')]);_0x42ac10[_0x578f('0x3a')]=qs[_0x578f('0x32')](_[_0x578f('0x3b')](_0x35884b[_0x578f('0x31')],_0x110a10[_0x578f('0x32')]));if(_0x35884b[_0x578f('0x31')]['filter']){_0x42ac10[_0x578f('0x3a')]=_[_0x578f('0x3f')](_0x42ac10['where'],{'$or':_['map'](_0x42ac10[_0x578f('0x35')],function(_0x2ddff4){var _0x55f1ea={};_0x55f1ea[_0x2ddff4]={'$like':'%'+_0x35884b[_0x578f('0x31')][_0x578f('0x3e')]+'%'};return _0x55f1ea;})});}_0x42ac10=_[_0x578f('0x3f')]({},_0x42ac10,_0x35884b[_0x578f('0x40')]);return _0xc750cb['getConfigurations'](_0x42ac10);}})['then'](function(_0x28ae0b){if(_0x28ae0b){_0x1770a5=_0x28ae0b['length'];if(!_0x35884b[_0x578f('0x31')][_0x578f('0x37')](_0x578f('0x49'))){_0x42ac10[_0x578f('0x22')]=qs[_0x578f('0x22')](_0x35884b[_0x578f('0x31')][_0x578f('0x22')]);_0x42ac10[_0x578f('0x20')]=qs[_0x578f('0x20')](_0x35884b[_0x578f('0x31')][_0x578f('0x20')]);}return _0xc750cb[_0x578f('0x4a')](_0x42ac10);}})[_0x578f('0x26')](function(_0x1baa6e){if(_0x1baa6e){return _0x1baa6e?{'count':_0x1770a5,'rows':_0x1baa6e}:null;}})[_0x578f('0x26')](respondWithResult(_0x2e8f9f,null))[_0x578f('0x46')](handleError(_0x2e8f9f,null));};exports[_0x578f('0x4b')]=function(_0x514e4d,_0x14f081,_0xd55a9){if(_0x514e4d[_0x578f('0x47')]['id']){delete _0x514e4d['body']['id'];}return db[_0x578f('0x2b')][_0x578f('0x4c')]({'where':{'id':_0x514e4d[_0x578f('0x48')]['id']}})[_0x578f('0x26')](handleEntityNotFound(_0x14f081,null))[_0x578f('0x26')](function(_0x7929ea){if(_0x7929ea){_0x514e4d[_0x578f('0x47')][_0x578f('0x4d')]=_0x7929ea['id'];_0x514e4d[_0x578f('0x47')][_0x578f('0x4e')]=integrations['getSubjects'](_0x514e4d[_0x578f('0x47')][_0x578f('0x4f')],_0x514e4d[_0x578f('0x47')]['type']);_0x514e4d['body'][_0x578f('0x50')]=integrations[_0x578f('0x51')](_0x514e4d[_0x578f('0x47')][_0x578f('0x4f')],_0x514e4d[_0x578f('0x47')][_0x578f('0x3c')]);return db[_0x578f('0x52')][_0x578f('0x45')](_0x514e4d[_0x578f('0x47')],{'include':[{'model':db[_0x578f('0x53')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x578f('0x50')}]});}return null;})[_0x578f('0x26')](respondWithResult(_0x14f081,null))[_0x578f('0x46')](handleError(_0x14f081,null));};exports[_0x578f('0x54')]=function(_0x4dbfda,_0x50de89,_0x1430d5){var _0x19ca66='';var _0xef0c8f=['id',_0x578f('0x28'),_0x578f('0x55'),'created_by','description',_0x578f('0x56'),_0x578f('0x57'),_0x578f('0x58'),_0x578f('0x59'),_0x578f('0x5a'),_0x578f('0x5b'),'direction'];return db['SugarcrmAccount'][_0x578f('0x4c')]({'where':{'id':_0x4dbfda['params']['id']},'attributes':['id','username',_0x578f('0x5c'),_0x578f('0x5d')]})['then'](handleEntityNotFound(_0x50de89,null))[_0x578f('0x26')](function(_0xbd5c6b){if(_0xbd5c6b){_0x19ca66=_0xbd5c6b[_0x578f('0x5d')];var _0x3b850f=_0x19ca66[_0x578f('0x5e')](-0x1);if(_0x3b850f==='/'){_0x19ca66=_0x19ca66[_0x578f('0x5f')](0x0,_0x19ca66[_0x578f('0x60')](_0x3b850f));}return rp({'method':_0x578f('0x61'),'uri':util[_0x578f('0x62')](_0x578f('0x63'),_0x19ca66,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x578f('0x64'),'input_type':_0x578f('0x65'),'response_type':_0x578f('0x65'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xbd5c6b['username'],'password':_0xbd5c6b[_0x578f('0x5c')],'encryption':_0x578f('0x66')},'application':_0x578f('0x67')})}});}})['then'](function(_0x559115){if(_0x559115&&_0x559115[_0x578f('0x28')]!==_0x578f('0x68')&&_0x559115['name']!==_0x578f('0x69')){return rp({'method':'POST','uri':util[_0x578f('0x62')](_0x578f('0x63'),_0x19ca66,_0x578f('0x6a')),'json':!![],'form':{'method':_0x578f('0x6b'),'input_type':_0x578f('0x65'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x559115['id'],'module_name':_0x578f('0x6c')})}})[_0x578f('0x26')](function(_0xe7f146){if(_0xe7f146){var _0x3317d3=_[_0x578f('0x6d')](_0xe7f146['module_fields']);_['remove'](_0x3317d3,function(_0x68482f){return _0xef0c8f[_0x578f('0x6e')](_0x68482f[_0x578f('0x28')]);});return{'count':_0x3317d3['length'],'rows':_[_0x578f('0x2a')](_0x3317d3,function(_0x45c0b1){return{'id':_0x45c0b1[_0x578f('0x28')],'name':_0x45c0b1[_0x578f('0x6f')],'custom':_[_0x578f('0x70')](_0x45c0b1[_0x578f('0x28')],'_c')?!![]:![],'options':_0x45c0b1[_0x578f('0x40')]?_[_0x578f('0x2a')](_[_0x578f('0x6d')](_0x45c0b1[_0x578f('0x40')]),function(_0x2dc828){return{'name':_0x2dc828['value'],'value':_0x2dc828[_0x578f('0x28')]};}):[]};})};}})[_0x578f('0x26')](respondWithResult(_0x50de89,null))[_0x578f('0x46')](function(_0x30b5bf){var _0x52e9b8=_0x4dbfda[_0x578f('0x31')]['test']?0x1f4:_0x30b5bf[_0x578f('0x71')]||0x1f4;logger['error'](_0x578f('0x72'),_0x578f('0x54'),_0x52e9b8,JSON['stringify'](_0x30b5bf));delete _0x30b5bf[_0x578f('0x28')];if(_0x52e9b8===0x191){_0x52e9b8=0x190;}_0x50de89[_0x578f('0x1d')](_0x52e9b8)[_0x578f('0x29')](_0x4dbfda[_0x578f('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x30b5bf['statusCode']}:_0x30b5bf);});}else{var _0x1ebbff=0x1f4;_0x50de89[_0x578f('0x1d')](_0x1ebbff)[_0x578f('0x29')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x1349=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','destroy','findOne','SugarcrmConfiguration','sort','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','get_module_fields','values','module_fields','remove','includes','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x557c1d,_0x446947){var _0x348e2a=function(_0x39299d){while(--_0x39299d){_0x557c1d['push'](_0x557c1d['shift']());}};_0x348e2a(++_0x446947);}(_0x1349,0x69));var _0x9134=function(_0x2f6685,_0x2ac7ce){_0x2f6685=_0x2f6685-0x0;var _0x3e3e52=_0x1349[_0x2f6685];return _0x3e3e52;};'use strict';var emlformat=require(_0x9134('0x0'));var rimraf=require(_0x9134('0x1'));var zipdir=require(_0x9134('0x2'));var jsonpatch=require(_0x9134('0x3'));var rp=require(_0x9134('0x4'));var moment=require(_0x9134('0x5'));var BPromise=require(_0x9134('0x6'));var Mustache=require(_0x9134('0x7'));var util=require(_0x9134('0x8'));var path=require(_0x9134('0x9'));var sox=require(_0x9134('0xa'));var csv=require(_0x9134('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9134('0xc'));var _=require(_0x9134('0xd'));var squel=require(_0x9134('0xe'));var crypto=require(_0x9134('0xf'));var jsforce=require(_0x9134('0x10'));var deskjs=require(_0x9134('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9134('0x12'));var Redis=require(_0x9134('0x13'));var authService=require(_0x9134('0x14'));var qs=require(_0x9134('0x15'));var as=require(_0x9134('0x16'));var hardwareService=require(_0x9134('0x17'));var logger=require(_0x9134('0x18'))(_0x9134('0x19'));var utils=require(_0x9134('0x1a'));var config=require(_0x9134('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9134('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3c0af4,_0x115874){_0x115874=_0x115874||0xcc;return function(_0x31f3b8){if(_0x31f3b8){return _0x3c0af4[_0x9134('0x1d')](_0x115874);}return _0x3c0af4[_0x9134('0x1e')](_0x115874)['end']();};}function respondWithResult(_0x16b7c9,_0x24e3f6){_0x24e3f6=_0x24e3f6||0xc8;return function(_0x45b75b){if(_0x45b75b){return _0x16b7c9['status'](_0x24e3f6)[_0x9134('0x1f')](_0x45b75b);}};}function respondWithFilteredResult(_0xfa98f4,_0x432d7e){return function(_0x207d60){if(_0x207d60){var _0x58f335=typeof _0x432d7e[_0x9134('0x20')]===_0x9134('0x21')&&typeof _0x432d7e[_0x9134('0x22')]===_0x9134('0x21');var _0x3d3bb2=_0x207d60[_0x9134('0x23')];var _0xb86159=_0x58f335?0x0:_0x432d7e[_0x9134('0x20')];var _0x2977ac=_0x58f335?_0x207d60[_0x9134('0x23')]:_0x432d7e[_0x9134('0x20')]+_0x432d7e[_0x9134('0x22')];var _0x52a136;if(_0x2977ac>=_0x3d3bb2){_0x2977ac=_0x3d3bb2;_0x52a136=0xc8;}else{_0x52a136=0xce;}_0xfa98f4['status'](_0x52a136);return _0xfa98f4[_0x9134('0x24')](_0x9134('0x25'),_0xb86159+'-'+_0x2977ac+'/'+_0x3d3bb2)[_0x9134('0x1f')](_0x207d60);}return null;};}function patchUpdates(_0x289026){return function(_0x2ccebb){try{jsonpatch[_0x9134('0x26')](_0x2ccebb,_0x289026,!![]);}catch(_0x53887a){return BPromise[_0x9134('0x27')](_0x53887a);}return _0x2ccebb[_0x9134('0x28')]();};}function saveUpdates(_0x18b96c,_0x1617ac){return function(_0x338f57){if(_0x338f57){return _0x338f57[_0x9134('0x29')](_0x18b96c)[_0x9134('0x2a')](function(_0x48cb95){return _0x48cb95;});}return null;};}function removeEntity(_0x2acda7,_0x10e1f7){return function(_0x1a62e5){if(_0x1a62e5){return _0x1a62e5['destroy']()[_0x9134('0x2a')](function(){_0x2acda7[_0x9134('0x1e')](0xcc)[_0x9134('0x2b')]();});}};}function handleEntityNotFound(_0xc7152f,_0x5f5279){return function(_0x3374e2){if(!_0x3374e2){_0xc7152f[_0x9134('0x1d')](0x194);}return _0x3374e2;};}function handleError(_0x4b0a4b,_0x27cb46){_0x27cb46=_0x27cb46||0x1f4;return function(_0x398750){logger[_0x9134('0x2c')](_0x398750[_0x9134('0x2d')]);if(_0x398750[_0x9134('0x2e')]){delete _0x398750['name'];}_0x4b0a4b[_0x9134('0x1e')](_0x27cb46)['send'](_0x398750);};}exports[_0x9134('0x2f')]=function(_0x4aafab,_0x19ad34){var _0x4b9ae6={},_0x4c3649={},_0x398691={'count':0x0,'rows':[]};var _0x4d991c=_[_0x9134('0x30')](db['SugarcrmAccount']['rawAttributes'],function(_0x2c3300){return{'name':_0x2c3300['fieldName'],'type':_0x2c3300[_0x9134('0x31')][_0x9134('0x32')]};});_0x4c3649[_0x9134('0x33')]=_[_0x9134('0x30')](_0x4d991c,_0x9134('0x2e'));_0x4c3649[_0x9134('0x34')]=_[_0x9134('0x35')](_0x4aafab[_0x9134('0x34')]);_0x4c3649['filters']=_['intersection'](_0x4c3649[_0x9134('0x33')],_0x4c3649['query']);_0x4b9ae6['attributes']=_[_0x9134('0x36')](_0x4c3649[_0x9134('0x33')],qs[_0x9134('0x37')](_0x4aafab[_0x9134('0x34')][_0x9134('0x37')]));_0x4b9ae6[_0x9134('0x38')]=_0x4b9ae6[_0x9134('0x38')]['length']?_0x4b9ae6[_0x9134('0x38')]:_0x4c3649[_0x9134('0x33')];if(!_0x4aafab[_0x9134('0x34')][_0x9134('0x39')](_0x9134('0x3a'))){_0x4b9ae6['limit']=qs[_0x9134('0x22')](_0x4aafab[_0x9134('0x34')]['limit']);_0x4b9ae6['offset']=qs[_0x9134('0x20')](_0x4aafab['query'][_0x9134('0x20')]);}_0x4b9ae6[_0x9134('0x3b')]=qs['sort'](_0x4aafab[_0x9134('0x34')]['sort']);_0x4b9ae6[_0x9134('0x3c')]=qs[_0x9134('0x3d')](_[_0x9134('0x3e')](_0x4aafab[_0x9134('0x34')],_0x4c3649['filters']),_0x4d991c);if(_0x4aafab[_0x9134('0x34')][_0x9134('0x3f')]){_0x4b9ae6['where']=_[_0x9134('0x40')](_0x4b9ae6['where'],{'$or':_[_0x9134('0x30')](_0x4d991c,function(_0x2e36e5){if(_0x2e36e5[_0x9134('0x31')]!==_0x9134('0x41')){var _0x433f82={};_0x433f82[_0x2e36e5['name']]={'$like':'%'+_0x4aafab[_0x9134('0x34')][_0x9134('0x3f')]+'%'};return _0x433f82;}})});}_0x4b9ae6=_['merge']({},_0x4b9ae6,_0x4aafab[_0x9134('0x42')]);var _0x3ba45e={'where':_0x4b9ae6['where']};return db[_0x9134('0x43')][_0x9134('0x23')](_0x3ba45e)[_0x9134('0x2a')](function(_0x1e672c){_0x398691[_0x9134('0x23')]=_0x1e672c;if(_0x4aafab[_0x9134('0x34')][_0x9134('0x44')]){_0x4b9ae6[_0x9134('0x45')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x9134('0x46')](_0x4b9ae6);})[_0x9134('0x2a')](function(_0x3b5ade){_0x398691[_0x9134('0x47')]=_0x3b5ade;return _0x398691;})[_0x9134('0x2a')](respondWithFilteredResult(_0x19ad34,_0x4b9ae6))['catch'](handleError(_0x19ad34,null));};exports[_0x9134('0x48')]=function(_0x3ec907,_0x3ca704){var _0x372d56={'raw':![],'where':{'id':_0x3ec907[_0x9134('0x49')]['id']}},_0x4cfd02={};_0x4cfd02['model']=_[_0x9134('0x35')](db[_0x9134('0x43')][_0x9134('0x4a')]);_0x4cfd02[_0x9134('0x34')]=_['keys'](_0x3ec907['query']);_0x4cfd02['filters']=_['intersection'](_0x4cfd02[_0x9134('0x33')],_0x4cfd02[_0x9134('0x34')]);_0x372d56[_0x9134('0x38')]=_[_0x9134('0x36')](_0x4cfd02[_0x9134('0x33')],qs[_0x9134('0x37')](_0x3ec907[_0x9134('0x34')][_0x9134('0x37')]));_0x372d56[_0x9134('0x38')]=_0x372d56[_0x9134('0x38')][_0x9134('0x4b')]?_0x372d56['attributes']:_0x4cfd02[_0x9134('0x33')];if(_0x3ec907[_0x9134('0x34')][_0x9134('0x44')]){_0x372d56[_0x9134('0x45')]=[{'all':!![]}];}_0x372d56=_[_0x9134('0x40')]({},_0x372d56,_0x3ec907[_0x9134('0x42')]);return db[_0x9134('0x43')][_0x9134('0x4c')](_0x372d56)[_0x9134('0x2a')](handleEntityNotFound(_0x3ca704,null))['then'](respondWithResult(_0x3ca704,null))[_0x9134('0x4d')](handleError(_0x3ca704,null));};exports[_0x9134('0x4e')]=function(_0x1fc744,_0x1a7369){return db[_0x9134('0x43')][_0x9134('0x4e')](_0x1fc744[_0x9134('0x4f')],{})[_0x9134('0x2a')](respondWithResult(_0x1a7369,0xc9))['catch'](handleError(_0x1a7369,null));};exports['update']=function(_0xac6bcc,_0x3ddf7b){if(_0xac6bcc['body']['id']){delete _0xac6bcc['body']['id'];}return db[_0x9134('0x43')][_0x9134('0x4c')]({'where':{'id':_0xac6bcc['params']['id']}})[_0x9134('0x2a')](handleEntityNotFound(_0x3ddf7b,null))['then'](saveUpdates(_0xac6bcc[_0x9134('0x4f')],null))[_0x9134('0x2a')](respondWithResult(_0x3ddf7b,null))[_0x9134('0x4d')](handleError(_0x3ddf7b,null));};exports[_0x9134('0x50')]=function(_0x454749,_0x5ea30c){return db[_0x9134('0x43')][_0x9134('0x4c')]({'where':{'id':_0x454749[_0x9134('0x49')]['id']}})[_0x9134('0x2a')](handleEntityNotFound(_0x5ea30c,null))[_0x9134('0x2a')](removeEntity(_0x5ea30c,null))[_0x9134('0x4d')](handleError(_0x5ea30c,null));};exports['getConfigurations']=function(_0x542a49,_0xbc6050,_0x4adc29){var _0x5da368={};var _0xe322f2={};var _0x2011b5;var _0x9bcfd1;return db['SugarcrmAccount'][_0x9134('0x51')]({'where':{'id':_0x542a49['params']['id']}})['then'](handleEntityNotFound(_0xbc6050,null))[_0x9134('0x2a')](function(_0x1ed655){if(_0x1ed655){_0x2011b5=_0x1ed655;_0xe322f2[_0x9134('0x33')]=_[_0x9134('0x35')](db[_0x9134('0x52')]['rawAttributes']);_0xe322f2[_0x9134('0x34')]=_[_0x9134('0x35')](_0x542a49[_0x9134('0x34')]);_0xe322f2['filters']=_[_0x9134('0x36')](_0xe322f2['model'],_0xe322f2['query']);_0x5da368['attributes']=_[_0x9134('0x36')](_0xe322f2[_0x9134('0x33')],qs[_0x9134('0x37')](_0x542a49['query'][_0x9134('0x37')]));_0x5da368[_0x9134('0x38')]=_0x5da368[_0x9134('0x38')][_0x9134('0x4b')]?_0x5da368[_0x9134('0x38')]:_0xe322f2[_0x9134('0x33')];_0x5da368[_0x9134('0x3b')]=qs[_0x9134('0x53')](_0x542a49[_0x9134('0x34')][_0x9134('0x53')]);_0x5da368[_0x9134('0x3c')]=qs[_0x9134('0x3d')](_[_0x9134('0x3e')](_0x542a49[_0x9134('0x34')],_0xe322f2['filters']));if(_0x542a49[_0x9134('0x34')][_0x9134('0x3f')]){_0x5da368[_0x9134('0x3c')]=_[_0x9134('0x40')](_0x5da368[_0x9134('0x3c')],{'$or':_[_0x9134('0x30')](_0x5da368['attributes'],function(_0x1f123e){var _0x58ab19={};_0x58ab19[_0x1f123e]={'$like':'%'+_0x542a49[_0x9134('0x34')][_0x9134('0x3f')]+'%'};return _0x58ab19;})});}_0x5da368=_[_0x9134('0x40')]({},_0x5da368,_0x542a49['options']);return _0x2011b5[_0x9134('0x54')](_0x5da368);}})['then'](function(_0x49c599){if(_0x49c599){_0x9bcfd1=_0x49c599[_0x9134('0x4b')];if(!_0x542a49[_0x9134('0x34')][_0x9134('0x39')](_0x9134('0x3a'))){_0x5da368[_0x9134('0x22')]=qs[_0x9134('0x22')](_0x542a49[_0x9134('0x34')][_0x9134('0x22')]);_0x5da368[_0x9134('0x20')]=qs[_0x9134('0x20')](_0x542a49[_0x9134('0x34')][_0x9134('0x20')]);}return _0x2011b5[_0x9134('0x54')](_0x5da368);}})[_0x9134('0x2a')](function(_0xfe1645){if(_0xfe1645){return _0xfe1645?{'count':_0x9bcfd1,'rows':_0xfe1645}:null;}})[_0x9134('0x2a')](respondWithResult(_0xbc6050,null))[_0x9134('0x4d')](handleError(_0xbc6050,null));};exports['addConfiguration']=function(_0x578059,_0x5f0b28,_0x23fb85){if(_0x578059[_0x9134('0x4f')]['id']){delete _0x578059[_0x9134('0x4f')]['id'];}return db[_0x9134('0x43')][_0x9134('0x51')]({'where':{'id':_0x578059[_0x9134('0x49')]['id']}})[_0x9134('0x2a')](handleEntityNotFound(_0x5f0b28,null))[_0x9134('0x2a')](function(_0x4b494d){if(_0x4b494d){_0x578059[_0x9134('0x4f')][_0x9134('0x55')]=_0x4b494d['id'];_0x578059['body'][_0x9134('0x56')]=integrations['getSubjects'](_0x578059[_0x9134('0x4f')][_0x9134('0x57')],_0x578059[_0x9134('0x4f')]['type']);_0x578059[_0x9134('0x4f')][_0x9134('0x58')]=integrations[_0x9134('0x59')](_0x578059['body'][_0x9134('0x57')],_0x578059[_0x9134('0x4f')][_0x9134('0x31')]);return db[_0x9134('0x52')]['create'](_0x578059['body'],{'include':[{'model':db[_0x9134('0x5a')],'as':_0x9134('0x56')},{'model':db['SugarcrmField'],'as':_0x9134('0x58')}]});}return null;})[_0x9134('0x2a')](respondWithResult(_0x5f0b28,null))[_0x9134('0x4d')](handleError(_0x5f0b28,null));};exports['getFields']=function(_0x609aad,_0x15af99,_0xe96604){var _0xd6978b='';var _0x125e12=['id',_0x9134('0x2e'),_0x9134('0x5b'),_0x9134('0x5c'),_0x9134('0x5d'),_0x9134('0x5e'),_0x9134('0x5f'),_0x9134('0x60'),_0x9134('0x61'),_0x9134('0x62'),'parent_name',_0x9134('0x63')];return db[_0x9134('0x43')]['findOne']({'where':{'id':_0x609aad[_0x9134('0x49')]['id']},'attributes':['id',_0x9134('0x64'),_0x9134('0x65'),_0x9134('0x66')]})[_0x9134('0x2a')](handleEntityNotFound(_0x15af99,null))[_0x9134('0x2a')](function(_0x38acf9){if(_0x38acf9){_0xd6978b=_0x38acf9[_0x9134('0x66')];var _0x2e13f=_0xd6978b[_0x9134('0x67')](-0x1);if(_0x2e13f==='/'){_0xd6978b=_0xd6978b[_0x9134('0x68')](0x0,_0xd6978b[_0x9134('0x69')](_0x2e13f));}return rp({'method':_0x9134('0x6a'),'uri':util['format'](_0x9134('0x6b'),_0xd6978b,_0x9134('0x6c')),'json':!![],'form':{'method':_0x9134('0x6d'),'input_type':'JSON','response_type':_0x9134('0x6e'),'rest_data':JSON[_0x9134('0x6f')]({'user_auth':{'user_name':_0x38acf9[_0x9134('0x64')],'password':_0x38acf9[_0x9134('0x65')],'encryption':_0x9134('0x70')},'application':_0x9134('0x71')})}});}})[_0x9134('0x2a')](function(_0x5d870c){if(_0x5d870c&&_0x5d870c['name']!==_0x9134('0x72')&&_0x5d870c['name']!=='Password\x20Expired'){return rp({'method':_0x9134('0x6a'),'uri':util[_0x9134('0x73')](_0x9134('0x6b'),_0xd6978b,_0x9134('0x6c')),'json':!![],'form':{'method':_0x9134('0x74'),'input_type':_0x9134('0x6e'),'response_type':_0x9134('0x6e'),'rest_data':JSON['stringify']({'session':_0x5d870c['id'],'module_name':'Calls'})}})['then'](function(_0xfa342a){if(_0xfa342a){var _0x59f153=_[_0x9134('0x75')](_0xfa342a[_0x9134('0x76')]);_[_0x9134('0x77')](_0x59f153,function(_0x2cf7c2){return _0x125e12[_0x9134('0x78')](_0x2cf7c2[_0x9134('0x2e')]);});return{'count':_0x59f153[_0x9134('0x4b')],'rows':_['map'](_0x59f153,function(_0x47a32e){return{'id':_0x47a32e['name'],'name':_0x47a32e['label'],'custom':_[_0x9134('0x79')](_0x47a32e['name'],'_c')?!![]:![],'options':_0x47a32e[_0x9134('0x42')]?_[_0x9134('0x30')](_[_0x9134('0x75')](_0x47a32e['options']),function(_0x123e61){return{'name':_0x123e61['value'],'value':_0x123e61[_0x9134('0x2e')]};}):[]};})};}})[_0x9134('0x2a')](respondWithResult(_0x15af99,null))[_0x9134('0x4d')](function(_0x481703){var _0x6db0c9=_0x609aad[_0x9134('0x34')][_0x9134('0x7a')]?0x1f4:_0x481703[_0x9134('0x7b')]||0x1f4;logger[_0x9134('0x2c')](_0x9134('0x7c'),'getFields',_0x6db0c9,JSON[_0x9134('0x6f')](_0x481703));delete _0x481703[_0x9134('0x2e')];if(_0x6db0c9===0x191){_0x6db0c9=0x190;}_0x15af99[_0x9134('0x1e')](_0x6db0c9)[_0x9134('0x7d')](_0x609aad[_0x9134('0x34')][_0x9134('0x7a')]?{'message':_0x9134('0x7e'),'statusCode':_0x481703[_0x9134('0x7b')]}:_0x481703);});}else{var _0x385659=0x1f4;_0x15af99[_0x9134('0x1e')](_0x385659)[_0x9134('0x7d')]({'message':_0x9134('0x7e'),'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 3e05f8e..51e0b90 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 _0x845f=['bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment'];(function(_0x231023,_0x335e88){var _0x3579ee=function(_0x241b57){while(--_0x241b57){_0x231023['push'](_0x231023['shift']());}};_0x3579ee(++_0x335e88);}(_0x845f,0x1b8));var _0xf845=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x845f[_0x1b02bb];return _0x131245;};'use strict';var _=require(_0xf845('0x0'));var util=require(_0xf845('0x1'));var logger=require(_0xf845('0x2'))('api');var moment=require(_0xf845('0x3'));var BPromise=require(_0xf845('0x4'));var rp=require(_0xf845('0x5'));var fs=require('fs');var path=require(_0xf845('0x6'));var rimraf=require(_0xf845('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xf845('0x8'));module[_0xf845('0x9')]=function(_0x1efcaa,_0x21cea){return _0x1efcaa['define'](_0xf845('0xa'),attributes,{'tableName':_0xf845('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb9e=['rimraf','../../config/environment','define','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xbb9e,0xf4));var _0xebb9=function(_0x3d1e54,_0x3b961b){_0x3d1e54=_0x3d1e54-0x0;var _0x313e75=_0xbb9e[_0x3d1e54];return _0x313e75;};'use strict';var _=require(_0xebb9('0x0'));var util=require('util');var logger=require(_0xebb9('0x1'))(_0xebb9('0x2'));var moment=require(_0xebb9('0x3'));var BPromise=require(_0xebb9('0x4'));var rp=require(_0xebb9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebb9('0x6'));var config=require(_0xebb9('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd576d4,_0x17889c){return _0xd576d4[_0xebb9('0x8')]('SugarcrmAccount',attributes,{'tableName':_0xebb9('0x9'),'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 665ade0..f18d179 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 _0x7163=['options','raw','where','include','map','attributes','model','find','ShowSugarcrmAccount','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll'];(function(_0x46e1b3,_0x3567d1){var _0x2cc460=function(_0x292a60){while(--_0x292a60){_0x46e1b3['push'](_0x46e1b3['shift']());}};_0x2cc460(++_0x3567d1);}(_0x7163,0x1a1));var _0x3716=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x7163[_0x65c50e];return _0x4573e7;};'use strict';var _=require(_0x3716('0x0'));var util=require('util');var moment=require(_0x3716('0x1'));var BPromise=require('bluebird');var rs=require(_0x3716('0x2'));var fs=require('fs');var Redis=require(_0x3716('0x3'));var db=require(_0x3716('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3716('0x5'));var config=require(_0x3716('0x6'));var jayson=require(_0x3716('0x7'));var client=jayson[_0x3716('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39fe9c,_0x4a92ed,_0x185d62){return new BPromise(function(_0x5cad5f,_0x557f51){return client[_0x3716('0x9')](_0x39fe9c,_0x185d62)[_0x3716('0xa')](function(_0x44ac7a){logger[_0x3716('0xb')](_0x3716('0xc'),_0x4a92ed,_0x3716('0xd'));logger[_0x3716('0xe')](_0x3716('0xf'),_0x4a92ed,'request\x20sent',JSON[_0x3716('0x10')](_0x44ac7a));if(_0x44ac7a[_0x3716('0x11')]){if(_0x44ac7a['error'][_0x3716('0x12')]===0x1f4){logger['error'](_0x3716('0xc'),_0x4a92ed,_0x44ac7a['error'][_0x3716('0x13')]);return _0x557f51(_0x44ac7a['error'][_0x3716('0x13')]);}logger[_0x3716('0x11')](_0x3716('0xc'),_0x4a92ed,_0x44ac7a[_0x3716('0x11')][_0x3716('0x13')]);return _0x5cad5f(_0x44ac7a[_0x3716('0x11')][_0x3716('0x13')]);}else{logger[_0x3716('0xb')](_0x3716('0xc'),_0x4a92ed,_0x3716('0xd'));_0x5cad5f(_0x44ac7a[_0x3716('0x14')][_0x3716('0x13')]);}})[_0x3716('0x15')](function(_0x484afb){logger[_0x3716('0x11')](_0x3716('0xc'),_0x4a92ed,_0x484afb);_0x557f51(_0x484afb);});});}exports[_0x3716('0x16')]=function(_0x32fff9){var _0x3210cd=this;return new Promise(function(_0x1216f0,_0x4519cc){return db[_0x3716('0x17')][_0x3716('0x18')]({'raw':_0x32fff9[_0x3716('0x19')]?_0x32fff9[_0x3716('0x19')][_0x3716('0x1a')]===undefined?!![]:![]:!![],'where':_0x32fff9['options']?_0x32fff9['options'][_0x3716('0x1b')]||null:null,'attributes':_0x32fff9[_0x3716('0x19')]?_0x32fff9['options']['attributes']||null:null,'limit':_0x32fff9[_0x3716('0x19')]?_0x32fff9[_0x3716('0x19')]['limit']||null:null,'include':_0x32fff9[_0x3716('0x19')]?_0x32fff9[_0x3716('0x19')][_0x3716('0x1c')]?_[_0x3716('0x1d')](_0x32fff9[_0x3716('0x19')][_0x3716('0x1c')],function(_0x478b9a){return{'model':db[_0x478b9a['model']],'as':_0x478b9a['as'],'attributes':_0x478b9a[_0x3716('0x1e')],'include':_0x478b9a[_0x3716('0x1c')]?_[_0x3716('0x1d')](_0x478b9a[_0x3716('0x1c')],function(_0x3a7504){return{'model':db[_0x3a7504[_0x3716('0x1f')]],'as':_0x3a7504['as'],'attributes':_0x3a7504[_0x3716('0x1e')],'include':_0x3a7504[_0x3716('0x1c')]?_['map'](_0x3a7504[_0x3716('0x1c')],function(_0x28ab17){return{'model':db[_0x28ab17[_0x3716('0x1f')]],'as':_0x28ab17['as'],'attributes':_0x28ab17['attributes']};}):[]};}):[]};}):[]:[]})[_0x3716('0xa')](function(_0x2ed958){logger['info'](_0x3716('0x16'),_0x32fff9);logger[_0x3716('0xe')](_0x3716('0x16'),_0x32fff9,JSON[_0x3716('0x10')](_0x2ed958));_0x1216f0(_0x2ed958);})[_0x3716('0x15')](function(_0x2e7260){logger[_0x3716('0x11')](_0x3716('0x16'),_0x2e7260[_0x3716('0x13')],_0x32fff9);_0x4519cc(_0x3210cd[_0x3716('0x11')](0x1f4,_0x2e7260['message']));});});};exports['ShowSugarcrmAccount']=function(_0x51100f){var _0x451400=this;return new Promise(function(_0x307a3e,_0x533980){return db[_0x3716('0x17')][_0x3716('0x20')]({'raw':_0x51100f[_0x3716('0x19')]?_0x51100f['options']['raw']===undefined?!![]:![]:!![],'where':_0x51100f[_0x3716('0x19')]?_0x51100f[_0x3716('0x19')]['where']||null:null,'attributes':_0x51100f[_0x3716('0x19')]?_0x51100f[_0x3716('0x19')][_0x3716('0x1e')]||null:null,'include':_0x51100f['options']?_0x51100f[_0x3716('0x19')][_0x3716('0x1c')]?_[_0x3716('0x1d')](_0x51100f['options'][_0x3716('0x1c')],function(_0x4902a7){return{'model':db[_0x4902a7[_0x3716('0x1f')]],'as':_0x4902a7['as'],'attributes':_0x4902a7[_0x3716('0x1e')],'include':_0x4902a7['include']?_[_0x3716('0x1d')](_0x4902a7['include'],function(_0x35bf0e){return{'model':db[_0x35bf0e['model']],'as':_0x35bf0e['as'],'attributes':_0x35bf0e['attributes'],'include':_0x35bf0e[_0x3716('0x1c')]?_[_0x3716('0x1d')](_0x35bf0e[_0x3716('0x1c')],function(_0x960d9c){return{'model':db[_0x960d9c[_0x3716('0x1f')]],'as':_0x960d9c['as'],'attributes':_0x960d9c[_0x3716('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c92ee){logger['info'](_0x3716('0x21'),_0x51100f);logger[_0x3716('0xe')]('ShowSugarcrmAccount',_0x51100f,JSON[_0x3716('0x10')](_0x3c92ee));_0x307a3e(_0x3c92ee);})['catch'](function(_0x24107c){logger[_0x3716('0x11')](_0x3716('0x21'),_0x24107c[_0x3716('0x13')],_0x51100f);_0x533980(_0x451400[_0x3716('0x11')](0x1f4,_0x24107c[_0x3716('0x13')]));});});}; \ No newline at end of file +var _0xb7b2=['debug','GetSugarcrmAccount','ShowSugarcrmAccount','find','then','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','SugarcrmAccount','findAll','raw','where','options','attributes','limit','include','map','model'];(function(_0x52672f,_0x278e34){var _0x205d5a=function(_0x51d802){while(--_0x51d802){_0x52672f['push'](_0x52672f['shift']());}};_0x205d5a(++_0x278e34);}(_0xb7b2,0xc5));var _0x2b7b=function(_0x59b4df,_0x48c7fe){_0x59b4df=_0x59b4df-0x0;var _0x561e39=_0xb7b2[_0x59b4df];return _0x561e39;};'use strict';var _=require('lodash');var util=require(_0x2b7b('0x0'));var moment=require(_0x2b7b('0x1'));var BPromise=require(_0x2b7b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b7b('0x4'));var logger=require(_0x2b7b('0x5'))('rpc');var config=require(_0x2b7b('0x6'));var jayson=require(_0x2b7b('0x7'));var client=jayson[_0x2b7b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10f282,_0x39df5e,_0x4c1fd1){return new BPromise(function(_0x4ee863,_0x350f57){return client[_0x2b7b('0x9')](_0x10f282,_0x4c1fd1)['then'](function(_0x76eaf3){logger['info'](_0x2b7b('0xa'),_0x39df5e,_0x2b7b('0xb'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x39df5e,_0x2b7b('0xb'),JSON[_0x2b7b('0xc')](_0x76eaf3));if(_0x76eaf3['error']){if(_0x76eaf3[_0x2b7b('0xd')]['code']===0x1f4){logger[_0x2b7b('0xd')](_0x2b7b('0xa'),_0x39df5e,_0x76eaf3[_0x2b7b('0xd')][_0x2b7b('0xe')]);return _0x350f57(_0x76eaf3[_0x2b7b('0xd')][_0x2b7b('0xe')]);}logger[_0x2b7b('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x39df5e,_0x76eaf3['error']['message']);return _0x4ee863(_0x76eaf3[_0x2b7b('0xd')][_0x2b7b('0xe')]);}else{logger[_0x2b7b('0xf')](_0x2b7b('0xa'),_0x39df5e,_0x2b7b('0xb'));_0x4ee863(_0x76eaf3['result'][_0x2b7b('0xe')]);}})[_0x2b7b('0x10')](function(_0x32c3c6){logger[_0x2b7b('0xd')](_0x2b7b('0xa'),_0x39df5e,_0x32c3c6);_0x350f57(_0x32c3c6);});});}exports['GetSugarcrmAccount']=function(_0x204ab2){var _0x3e4550=this;return new Promise(function(_0x3bf081,_0xb0c07f){return db[_0x2b7b('0x11')][_0x2b7b('0x12')]({'raw':_0x204ab2['options']?_0x204ab2['options'][_0x2b7b('0x13')]===undefined?!![]:![]:!![],'where':_0x204ab2['options']?_0x204ab2['options'][_0x2b7b('0x14')]||null:null,'attributes':_0x204ab2[_0x2b7b('0x15')]?_0x204ab2[_0x2b7b('0x15')][_0x2b7b('0x16')]||null:null,'limit':_0x204ab2[_0x2b7b('0x15')]?_0x204ab2['options'][_0x2b7b('0x17')]||null:null,'include':_0x204ab2[_0x2b7b('0x15')]?_0x204ab2[_0x2b7b('0x15')][_0x2b7b('0x18')]?_[_0x2b7b('0x19')](_0x204ab2[_0x2b7b('0x15')][_0x2b7b('0x18')],function(_0x56e2ef){return{'model':db[_0x56e2ef[_0x2b7b('0x1a')]],'as':_0x56e2ef['as'],'attributes':_0x56e2ef[_0x2b7b('0x16')],'include':_0x56e2ef[_0x2b7b('0x18')]?_['map'](_0x56e2ef[_0x2b7b('0x18')],function(_0x3b00e0){return{'model':db[_0x3b00e0[_0x2b7b('0x1a')]],'as':_0x3b00e0['as'],'attributes':_0x3b00e0[_0x2b7b('0x16')],'include':_0x3b00e0[_0x2b7b('0x18')]?_[_0x2b7b('0x19')](_0x3b00e0[_0x2b7b('0x18')],function(_0x472b26){return{'model':db[_0x472b26[_0x2b7b('0x1a')]],'as':_0x472b26['as'],'attributes':_0x472b26[_0x2b7b('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x335de2){logger[_0x2b7b('0xf')]('GetSugarcrmAccount',_0x204ab2);logger[_0x2b7b('0x1b')](_0x2b7b('0x1c'),_0x204ab2,JSON['stringify'](_0x335de2));_0x3bf081(_0x335de2);})[_0x2b7b('0x10')](function(_0xd4a829){logger[_0x2b7b('0xd')](_0x2b7b('0x1c'),_0xd4a829[_0x2b7b('0xe')],_0x204ab2);_0xb0c07f(_0x3e4550['error'](0x1f4,_0xd4a829[_0x2b7b('0xe')]));});});};exports[_0x2b7b('0x1d')]=function(_0x2e1ce6){var _0x504b09=this;return new Promise(function(_0x1bcef3,_0x158efd){return db[_0x2b7b('0x11')][_0x2b7b('0x1e')]({'raw':_0x2e1ce6[_0x2b7b('0x15')]?_0x2e1ce6[_0x2b7b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2e1ce6['options']?_0x2e1ce6[_0x2b7b('0x15')]['where']||null:null,'attributes':_0x2e1ce6[_0x2b7b('0x15')]?_0x2e1ce6['options']['attributes']||null:null,'include':_0x2e1ce6[_0x2b7b('0x15')]?_0x2e1ce6[_0x2b7b('0x15')]['include']?_[_0x2b7b('0x19')](_0x2e1ce6['options'][_0x2b7b('0x18')],function(_0xccf44a){return{'model':db[_0xccf44a[_0x2b7b('0x1a')]],'as':_0xccf44a['as'],'attributes':_0xccf44a[_0x2b7b('0x16')],'include':_0xccf44a[_0x2b7b('0x18')]?_[_0x2b7b('0x19')](_0xccf44a[_0x2b7b('0x18')],function(_0x5cb2a7){return{'model':db[_0x5cb2a7[_0x2b7b('0x1a')]],'as':_0x5cb2a7['as'],'attributes':_0x5cb2a7[_0x2b7b('0x16')],'include':_0x5cb2a7[_0x2b7b('0x18')]?_['map'](_0x5cb2a7[_0x2b7b('0x18')],function(_0x517eac){return{'model':db[_0x517eac[_0x2b7b('0x1a')]],'as':_0x517eac['as'],'attributes':_0x517eac[_0x2b7b('0x16')]};}):[]};}):[]};}):[]:[]})[_0x2b7b('0x1f')](function(_0x88f01a){logger[_0x2b7b('0xf')](_0x2b7b('0x1d'),_0x2e1ce6);logger[_0x2b7b('0x1b')](_0x2b7b('0x1d'),_0x2e1ce6,JSON[_0x2b7b('0xc')](_0x88f01a));_0x1bcef3(_0x88f01a);})[_0x2b7b('0x10')](function(_0x331ffe){logger[_0x2b7b('0xd')](_0x2b7b('0x1d'),_0x331ffe[_0x2b7b('0xe')],_0x2e1ce6);_0x158efd(_0x504b09[_0x2b7b('0xd')](0x1f4,_0x331ffe[_0x2b7b('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index e76e2ac..46ececa 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 _0xf7ad=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x1d3bb1,_0x6ab85f){var _0x552c35=function(_0x1b69cc){while(--_0x1b69cc){_0x1d3bb1['push'](_0x1d3bb1['shift']());}};_0x552c35(++_0x6ab85f);}(_0xf7ad,0x14f));var _0xdf7a=function(_0x2e2976,_0x4eba59){_0x2e2976=_0x2e2976-0x0;var _0x2385a4=_0xf7ad[_0x2e2976];return _0x2385a4;};'use strict';var multer=require('multer');var util=require(_0xdf7a('0x0'));var path=require(_0xdf7a('0x1'));var timeout=require(_0xdf7a('0x2'));var express=require(_0xdf7a('0x3'));var router=express[_0xdf7a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdf7a('0x5'));var config=require(_0xdf7a('0x6'));var controller=require(_0xdf7a('0x7'));router['get']('/',auth[_0xdf7a('0x8')](),controller[_0xdf7a('0x9')]);router[_0xdf7a('0xa')](_0xdf7a('0xb'),auth[_0xdf7a('0x8')](),controller[_0xdf7a('0xc')]);router[_0xdf7a('0xa')]('/:id/fields',auth[_0xdf7a('0x8')](),controller[_0xdf7a('0xd')]);router[_0xdf7a('0xa')]('/:id/subjects',auth[_0xdf7a('0x8')](),controller[_0xdf7a('0xe')]);router[_0xdf7a('0xa')](_0xdf7a('0xf'),auth[_0xdf7a('0x8')](),controller[_0xdf7a('0x10')]);router['post']('/',auth[_0xdf7a('0x8')](),controller['create']);router[_0xdf7a('0x11')]('/:id',auth[_0xdf7a('0x8')](),controller[_0xdf7a('0x12')]);router[_0xdf7a('0x13')](_0xdf7a('0xb'),auth[_0xdf7a('0x8')](),controller[_0xdf7a('0x14')]);module[_0xdf7a('0x15')]=router; \ No newline at end of file +var _0x6332=['connect-timeout','express','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','destroy','multer'];(function(_0x4b692e,_0x5331f2){var _0x180568=function(_0xc7e839){while(--_0xc7e839){_0x4b692e['push'](_0x4b692e['shift']());}};_0x180568(++_0x5331f2);}(_0x6332,0x1a3));var _0x2633=function(_0xc1fac,_0xc28588){_0xc1fac=_0xc1fac-0x0;var _0x217f6c=_0x6332[_0xc1fac];return _0x217f6c;};'use strict';var multer=require(_0x2633('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2633('0x1'));var express=require(_0x2633('0x2'));var router=express[_0x2633('0x3')]();var fs_extra=require(_0x2633('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2633('0x5'));var controller=require(_0x2633('0x6'));router[_0x2633('0x7')]('/',auth[_0x2633('0x8')](),controller['index']);router[_0x2633('0x7')](_0x2633('0x9'),auth[_0x2633('0x8')](),controller[_0x2633('0xa')]);router[_0x2633('0x7')](_0x2633('0xb'),auth[_0x2633('0x8')](),controller[_0x2633('0xc')]);router[_0x2633('0x7')](_0x2633('0xd'),auth[_0x2633('0x8')](),controller[_0x2633('0xe')]);router[_0x2633('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2633('0xf')]);router[_0x2633('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2633('0x11')](_0x2633('0x9'),auth[_0x2633('0x8')](),controller[_0x2633('0x12')]);router['delete'](_0x2633('0x9'),auth[_0x2633('0x8')](),controller[_0x2633('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 16213bb..929334e 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 _0x8f05=['STRING','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8f05,0xd1));var _0x58f0=function(_0x2b9981,_0x4f81b3){_0x2b9981=_0x2b9981-0x0;var _0x314ac1=_0x8f05[_0x2b9981];return _0x314ac1;};'use strict';var Sequelize=require('sequelize');module[_0x58f0('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x58f0('0x1')]}}; \ No newline at end of file +var _0xd7a5=['exports','STRING','sequelize'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xd7a5,0x1c7));var _0x5d7a=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0xd7a5[_0x13cab0];return _0x38804f;};'use strict';var Sequelize=require(_0x5d7a('0x0'));module[_0x5d7a('0x1')]={'name':{'type':Sequelize[_0x5d7a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 1a752d4..bb15103 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 _0x3103=['include','rows','catch','show','params','keys','find','create','body','findOne','SugarcrmField','length','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll'];(function(_0x4e3b66,_0x36e365){var _0x19a4be=function(_0x347258){while(--_0x347258){_0x4e3b66['push'](_0x4e3b66['shift']());}};_0x19a4be(++_0x36e365);}(_0x3103,0xb7));var _0x3310=function(_0xf5f512,_0x131ec0){_0xf5f512=_0xf5f512-0x0;var _0x1940c9=_0x3103[_0xf5f512];return _0x1940c9;};'use strict';var emlformat=require(_0x3310('0x0'));var rimraf=require(_0x3310('0x1'));var zipdir=require(_0x3310('0x2'));var jsonpatch=require(_0x3310('0x3'));var rp=require('request-promise');var moment=require(_0x3310('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3310('0x5'));var util=require(_0x3310('0x6'));var path=require(_0x3310('0x7'));var sox=require(_0x3310('0x8'));var csv=require(_0x3310('0x9'));var ejs=require(_0x3310('0xa'));var fs=require('fs');var fs_extra=require(_0x3310('0xb'));var _=require(_0x3310('0xc'));var squel=require(_0x3310('0xd'));var crypto=require(_0x3310('0xe'));var jsforce=require(_0x3310('0xf'));var deskjs=require(_0x3310('0x10'));var toCsv=require(_0x3310('0x9'));var querystring=require(_0x3310('0x11'));var Papa=require(_0x3310('0x12'));var Redis=require('ioredis');var authService=require(_0x3310('0x13'));var qs=require(_0x3310('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3310('0x15'));var logger=require(_0x3310('0x16'))(_0x3310('0x17'));var utils=require(_0x3310('0x18'));var config=require(_0x3310('0x19'));var licenseUtil=require(_0x3310('0x1a'));var db=require(_0x3310('0x1b'))['db'];function respondWithStatusCode(_0x3da2e2,_0x410882){_0x410882=_0x410882||0xcc;return function(_0x82361e){if(_0x82361e){return _0x3da2e2[_0x3310('0x1c')](_0x410882);}return _0x3da2e2['status'](_0x410882)[_0x3310('0x1d')]();};}function respondWithResult(_0x218eaf,_0x338ef5){_0x338ef5=_0x338ef5||0xc8;return function(_0x2f2f95){if(_0x2f2f95){return _0x218eaf[_0x3310('0x1e')](_0x338ef5)[_0x3310('0x1f')](_0x2f2f95);}};}function respondWithFilteredResult(_0x4e6733,_0x179b20){return function(_0x508a76){if(_0x508a76){var _0x41ce19=typeof _0x179b20[_0x3310('0x20')]==='undefined'&&typeof _0x179b20[_0x3310('0x21')]===_0x3310('0x22');var _0x3ce079=_0x508a76['count'];var _0x2f965f=_0x41ce19?0x0:_0x179b20['offset'];var _0x51b328=_0x41ce19?_0x508a76[_0x3310('0x23')]:_0x179b20[_0x3310('0x20')]+_0x179b20[_0x3310('0x21')];var _0x197437;if(_0x51b328>=_0x3ce079){_0x51b328=_0x3ce079;_0x197437=0xc8;}else{_0x197437=0xce;}_0x4e6733[_0x3310('0x1e')](_0x197437);return _0x4e6733[_0x3310('0x24')]('Content-Range',_0x2f965f+'-'+_0x51b328+'/'+_0x3ce079)['json'](_0x508a76);}return null;};}function patchUpdates(_0x2f7de7){return function(_0x3a6dd){try{jsonpatch[_0x3310('0x25')](_0x3a6dd,_0x2f7de7,!![]);}catch(_0x70e88e){return BPromise[_0x3310('0x26')](_0x70e88e);}return _0x3a6dd[_0x3310('0x27')]();};}function saveUpdates(_0x3e71f9,_0x1a1f8e){return function(_0x561cd7){if(_0x561cd7){return _0x561cd7[_0x3310('0x28')](_0x3e71f9)['then'](function(_0x3feaad){return _0x3feaad;});}return null;};}function removeEntity(_0x9b9ea4,_0x508651){return function(_0x51e7f4){if(_0x51e7f4){return _0x51e7f4[_0x3310('0x29')]()['then'](function(){_0x9b9ea4['status'](0xcc)[_0x3310('0x1d')]();});}};}function handleEntityNotFound(_0x9720f0,_0x3640a2){return function(_0x4f94a7){if(!_0x4f94a7){_0x9720f0[_0x3310('0x1c')](0x194);}return _0x4f94a7;};}function handleError(_0x38ff03,_0x2b21f5){_0x2b21f5=_0x2b21f5||0x1f4;return function(_0x2ed682){logger[_0x3310('0x2a')](_0x2ed682[_0x3310('0x2b')]);if(_0x2ed682[_0x3310('0x2c')]){delete _0x2ed682[_0x3310('0x2c')];}_0x38ff03['status'](_0x2b21f5)[_0x3310('0x2d')](_0x2ed682);};}exports[_0x3310('0x2e')]=function(_0x497403,_0x3990aa){var _0x54695d={},_0x4298d3={},_0x4365e2={'count':0x0,'rows':[]};var _0x5821ce=_[_0x3310('0x2f')](db[_0x3310('0x30')][_0x3310('0x31')],function(_0x19c252){return{'name':_0x19c252['fieldName'],'type':_0x19c252[_0x3310('0x32')]['key']};});_0x4298d3[_0x3310('0x33')]=_[_0x3310('0x2f')](_0x5821ce,_0x3310('0x2c'));_0x4298d3['query']=_['keys'](_0x497403[_0x3310('0x34')]);_0x4298d3['filters']=_[_0x3310('0x35')](_0x4298d3[_0x3310('0x33')],_0x4298d3[_0x3310('0x34')]);_0x54695d[_0x3310('0x36')]=_[_0x3310('0x35')](_0x4298d3[_0x3310('0x33')],qs[_0x3310('0x37')](_0x497403[_0x3310('0x34')][_0x3310('0x37')]));_0x54695d[_0x3310('0x36')]=_0x54695d[_0x3310('0x36')]['length']?_0x54695d[_0x3310('0x36')]:_0x4298d3[_0x3310('0x33')];if(!_0x497403[_0x3310('0x34')][_0x3310('0x38')](_0x3310('0x39'))){_0x54695d[_0x3310('0x21')]=qs[_0x3310('0x21')](_0x497403[_0x3310('0x34')]['limit']);_0x54695d[_0x3310('0x20')]=qs['offset'](_0x497403[_0x3310('0x34')]['offset']);}_0x54695d[_0x3310('0x3a')]=qs[_0x3310('0x3b')](_0x497403['query'][_0x3310('0x3b')]);_0x54695d[_0x3310('0x3c')]=qs[_0x3310('0x3d')](_[_0x3310('0x3e')](_0x497403[_0x3310('0x34')],_0x4298d3['filters']),_0x5821ce);if(_0x497403[_0x3310('0x34')][_0x3310('0x3f')]){_0x54695d['where']=_[_0x3310('0x40')](_0x54695d[_0x3310('0x3c')],{'$or':_[_0x3310('0x2f')](_0x5821ce,function(_0x5bcb81){if(_0x5bcb81[_0x3310('0x32')]!==_0x3310('0x41')){var _0x965b26={};_0x965b26[_0x5bcb81[_0x3310('0x2c')]]={'$like':'%'+_0x497403[_0x3310('0x34')][_0x3310('0x3f')]+'%'};return _0x965b26;}})});}_0x54695d=_[_0x3310('0x40')]({},_0x54695d,_0x497403[_0x3310('0x42')]);var _0x580532={'where':_0x54695d[_0x3310('0x3c')]};return db['SugarcrmConfiguration'][_0x3310('0x23')](_0x580532)[_0x3310('0x43')](function(_0xc6955f){_0x4365e2['count']=_0xc6955f;if(_0x497403['query'][_0x3310('0x44')]){_0x54695d[_0x3310('0x45')]=[{'all':!![]}];}return db[_0x3310('0x30')]['findAll'](_0x54695d);})[_0x3310('0x43')](function(_0x5c14f6){_0x4365e2[_0x3310('0x46')]=_0x5c14f6;return _0x4365e2;})['then'](respondWithFilteredResult(_0x3990aa,_0x54695d))[_0x3310('0x47')](handleError(_0x3990aa,null));};exports[_0x3310('0x48')]=function(_0x321da7,_0x3bb7aa){var _0x1b5576={'raw':![],'where':{'id':_0x321da7[_0x3310('0x49')]['id']}},_0x5772e4={};_0x5772e4[_0x3310('0x33')]=_['keys'](db[_0x3310('0x30')][_0x3310('0x31')]);_0x5772e4[_0x3310('0x34')]=_[_0x3310('0x4a')](_0x321da7[_0x3310('0x34')]);_0x5772e4[_0x3310('0x3d')]=_[_0x3310('0x35')](_0x5772e4[_0x3310('0x33')],_0x5772e4[_0x3310('0x34')]);_0x1b5576[_0x3310('0x36')]=_['intersection'](_0x5772e4['model'],qs[_0x3310('0x37')](_0x321da7[_0x3310('0x34')][_0x3310('0x37')]));_0x1b5576[_0x3310('0x36')]=_0x1b5576[_0x3310('0x36')]['length']?_0x1b5576[_0x3310('0x36')]:_0x5772e4[_0x3310('0x33')];if(_0x321da7[_0x3310('0x34')][_0x3310('0x44')]){_0x1b5576[_0x3310('0x45')]=[{'all':!![]}];}_0x1b5576=_[_0x3310('0x40')]({},_0x1b5576,_0x321da7[_0x3310('0x42')]);return db[_0x3310('0x30')][_0x3310('0x4b')](_0x1b5576)['then'](handleEntityNotFound(_0x3bb7aa,null))['then'](respondWithResult(_0x3bb7aa,null))[_0x3310('0x47')](handleError(_0x3bb7aa,null));};exports['create']=function(_0x40d4fe,_0x549e76){return db[_0x3310('0x30')][_0x3310('0x4c')](_0x40d4fe[_0x3310('0x4d')],{})[_0x3310('0x43')](respondWithResult(_0x549e76,0xc9))[_0x3310('0x47')](handleError(_0x549e76,null));};exports['update']=function(_0x2b8b49,_0x40a564){if(_0x2b8b49[_0x3310('0x4d')]['id']){delete _0x2b8b49['body']['id'];}return db[_0x3310('0x30')]['find']({'where':{'id':_0x2b8b49[_0x3310('0x49')]['id']}})[_0x3310('0x43')](handleEntityNotFound(_0x40a564,null))[_0x3310('0x43')](saveUpdates(_0x2b8b49[_0x3310('0x4d')],null))[_0x3310('0x43')](respondWithResult(_0x40a564,null))[_0x3310('0x47')](handleError(_0x40a564,null));};exports['destroy']=function(_0x3ffa58,_0x11c601){return db[_0x3310('0x30')][_0x3310('0x4b')]({'where':{'id':_0x3ffa58[_0x3310('0x49')]['id']}})[_0x3310('0x43')](handleEntityNotFound(_0x11c601,null))['then'](removeEntity(_0x11c601,null))[_0x3310('0x47')](handleError(_0x11c601,null));};exports['getFields']=function(_0x5f00c9,_0x34473b,_0x371198){var _0xe6c18f={};var _0x3fea1b={};var _0x380b5e;var _0x177545;return db[_0x3310('0x30')][_0x3310('0x4e')]({'where':{'id':_0x5f00c9['params']['id']}})[_0x3310('0x43')](handleEntityNotFound(_0x34473b,null))[_0x3310('0x43')](function(_0x1d9e07){if(_0x1d9e07){_0x380b5e=_0x1d9e07;_0x3fea1b[_0x3310('0x33')]=_[_0x3310('0x4a')](db[_0x3310('0x4f')]['rawAttributes']);_0x3fea1b[_0x3310('0x34')]=_[_0x3310('0x4a')](_0x5f00c9[_0x3310('0x34')]);_0x3fea1b[_0x3310('0x3d')]=_[_0x3310('0x35')](_0x3fea1b[_0x3310('0x33')],_0x3fea1b[_0x3310('0x34')]);_0xe6c18f[_0x3310('0x36')]=_[_0x3310('0x35')](_0x3fea1b[_0x3310('0x33')],qs[_0x3310('0x37')](_0x5f00c9['query'][_0x3310('0x37')]));_0xe6c18f[_0x3310('0x36')]=_0xe6c18f['attributes'][_0x3310('0x50')]?_0xe6c18f['attributes']:_0x3fea1b[_0x3310('0x33')];_0xe6c18f['order']=qs['sort'](_0x5f00c9[_0x3310('0x34')][_0x3310('0x3b')]);_0xe6c18f[_0x3310('0x3c')]=qs[_0x3310('0x3d')](_[_0x3310('0x3e')](_0x5f00c9[_0x3310('0x34')],_0x3fea1b[_0x3310('0x3d')]));if(_0x5f00c9['query'][_0x3310('0x3f')]){_0xe6c18f[_0x3310('0x3c')]=_[_0x3310('0x40')](_0xe6c18f[_0x3310('0x3c')],{'$or':_[_0x3310('0x2f')](_0xe6c18f[_0x3310('0x36')],function(_0x189af7){var _0x42c7a5={};_0x42c7a5[_0x189af7]={'$like':'%'+_0x5f00c9[_0x3310('0x34')]['filter']+'%'};return _0x42c7a5;})});}_0xe6c18f=_['merge']({},_0xe6c18f,_0x5f00c9[_0x3310('0x42')]);return _0x380b5e['getFields'](_0xe6c18f);}})['then'](function(_0x26596e){if(_0x26596e){_0x177545=_0x26596e[_0x3310('0x50')];if(!_0x5f00c9[_0x3310('0x34')]['hasOwnProperty'](_0x3310('0x39'))){_0xe6c18f[_0x3310('0x21')]=qs[_0x3310('0x21')](_0x5f00c9['query'][_0x3310('0x21')]);_0xe6c18f[_0x3310('0x20')]=qs[_0x3310('0x20')](_0x5f00c9[_0x3310('0x34')][_0x3310('0x20')]);}return _0x380b5e[_0x3310('0x51')](_0xe6c18f);}})[_0x3310('0x43')](function(_0x21464a){if(_0x21464a){return _0x21464a?{'count':_0x177545,'rows':_0x21464a}:null;}})[_0x3310('0x43')](respondWithResult(_0x34473b,null))[_0x3310('0x47')](handleError(_0x34473b,null));};exports[_0x3310('0x52')]=function(_0x5811f1,_0x38fa4c,_0x32ca3b){var _0x552bc3={};var _0x2a74f9={};var _0x119239;var _0x38f87b;return db[_0x3310('0x30')][_0x3310('0x4e')]({'where':{'id':_0x5811f1[_0x3310('0x49')]['id']}})[_0x3310('0x43')](handleEntityNotFound(_0x38fa4c,null))[_0x3310('0x43')](function(_0x278f46){if(_0x278f46){_0x119239=_0x278f46;_0x2a74f9[_0x3310('0x33')]=_[_0x3310('0x4a')](db[_0x3310('0x4f')][_0x3310('0x31')]);_0x2a74f9[_0x3310('0x34')]=_[_0x3310('0x4a')](_0x5811f1[_0x3310('0x34')]);_0x2a74f9[_0x3310('0x3d')]=_[_0x3310('0x35')](_0x2a74f9[_0x3310('0x33')],_0x2a74f9[_0x3310('0x34')]);_0x552bc3[_0x3310('0x36')]=_[_0x3310('0x35')](_0x2a74f9[_0x3310('0x33')],qs[_0x3310('0x37')](_0x5811f1[_0x3310('0x34')][_0x3310('0x37')]));_0x552bc3[_0x3310('0x36')]=_0x552bc3[_0x3310('0x36')][_0x3310('0x50')]?_0x552bc3[_0x3310('0x36')]:_0x2a74f9[_0x3310('0x33')];_0x552bc3[_0x3310('0x3a')]=qs[_0x3310('0x3b')](_0x5811f1['query'][_0x3310('0x3b')]);_0x552bc3[_0x3310('0x3c')]=qs[_0x3310('0x3d')](_[_0x3310('0x3e')](_0x5811f1[_0x3310('0x34')],_0x2a74f9[_0x3310('0x3d')]));if(_0x5811f1[_0x3310('0x34')][_0x3310('0x3f')]){_0x552bc3[_0x3310('0x3c')]=_[_0x3310('0x40')](_0x552bc3[_0x3310('0x3c')],{'$or':_[_0x3310('0x2f')](_0x552bc3[_0x3310('0x36')],function(_0x58e6d7){var _0x4c7d75={};_0x4c7d75[_0x58e6d7]={'$like':'%'+_0x5811f1[_0x3310('0x34')][_0x3310('0x3f')]+'%'};return _0x4c7d75;})});}_0x552bc3=_[_0x3310('0x40')]({},_0x552bc3,_0x5811f1[_0x3310('0x42')]);return _0x119239[_0x3310('0x52')](_0x552bc3);}})['then'](function(_0x54e7d5){if(_0x54e7d5){_0x38f87b=_0x54e7d5['length'];if(!_0x5811f1[_0x3310('0x34')][_0x3310('0x38')](_0x3310('0x39'))){_0x552bc3[_0x3310('0x21')]=qs[_0x3310('0x21')](_0x5811f1[_0x3310('0x34')][_0x3310('0x21')]);_0x552bc3[_0x3310('0x20')]=qs[_0x3310('0x20')](_0x5811f1[_0x3310('0x34')][_0x3310('0x20')]);}return _0x119239[_0x3310('0x52')](_0x552bc3);}})[_0x3310('0x43')](function(_0x29300d){if(_0x29300d){return _0x29300d?{'count':_0x38f87b,'rows':_0x29300d}:null;}})[_0x3310('0x43')](respondWithResult(_0x38fa4c,null))[_0x3310('0x47')](handleError(_0x38fa4c,null));};exports[_0x3310('0x53')]=function(_0x215f85,_0x1a4770,_0x97674e){var _0x4df34c={};var _0x26e5b0={};var _0x49e73c;var _0x554592;return db[_0x3310('0x30')]['findOne']({'where':{'id':_0x215f85['params']['id']}})['then'](handleEntityNotFound(_0x1a4770,null))[_0x3310('0x43')](function(_0x35eedd){if(_0x35eedd){_0x49e73c=_0x35eedd;_0x26e5b0[_0x3310('0x33')]=_[_0x3310('0x4a')](db['SugarcrmField']['rawAttributes']);_0x26e5b0[_0x3310('0x34')]=_[_0x3310('0x4a')](_0x215f85[_0x3310('0x34')]);_0x26e5b0['filters']=_[_0x3310('0x35')](_0x26e5b0['model'],_0x26e5b0['query']);_0x4df34c['attributes']=_[_0x3310('0x35')](_0x26e5b0[_0x3310('0x33')],qs[_0x3310('0x37')](_0x215f85[_0x3310('0x34')][_0x3310('0x37')]));_0x4df34c[_0x3310('0x36')]=_0x4df34c[_0x3310('0x36')][_0x3310('0x50')]?_0x4df34c[_0x3310('0x36')]:_0x26e5b0[_0x3310('0x33')];_0x4df34c[_0x3310('0x3a')]=qs[_0x3310('0x3b')](_0x215f85['query'][_0x3310('0x3b')]);_0x4df34c['where']=qs[_0x3310('0x3d')](_[_0x3310('0x3e')](_0x215f85[_0x3310('0x34')],_0x26e5b0[_0x3310('0x3d')]));if(_0x215f85[_0x3310('0x34')][_0x3310('0x3f')]){_0x4df34c[_0x3310('0x3c')]=_['merge'](_0x4df34c[_0x3310('0x3c')],{'$or':_['map'](_0x4df34c[_0x3310('0x36')],function(_0x535026){var _0x1af74a={};_0x1af74a[_0x535026]={'$like':'%'+_0x215f85[_0x3310('0x34')]['filter']+'%'};return _0x1af74a;})});}_0x4df34c=_[_0x3310('0x40')]({},_0x4df34c,_0x215f85['options']);return _0x49e73c[_0x3310('0x53')](_0x4df34c);}})['then'](function(_0x56902c){if(_0x56902c){_0x554592=_0x56902c[_0x3310('0x50')];if(!_0x215f85[_0x3310('0x34')]['hasOwnProperty']('nolimit')){_0x4df34c[_0x3310('0x21')]=qs[_0x3310('0x21')](_0x215f85[_0x3310('0x34')][_0x3310('0x21')]);_0x4df34c[_0x3310('0x20')]=qs['offset'](_0x215f85['query'][_0x3310('0x20')]);}return _0x49e73c[_0x3310('0x53')](_0x4df34c);}})['then'](function(_0x28078b){if(_0x28078b){return _0x28078b?{'count':_0x554592,'rows':_0x28078b}:null;}})[_0x3310('0x43')](respondWithResult(_0x1a4770,null))[_0x3310('0x47')](handleError(_0x1a4770,null));}; \ No newline at end of file +var _0xea96=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','count','includeAll','SugarcrmConfiguration','findAll','rows','catch','show','params','keys','include','create','body','update','find','getFields','findOne','SugarcrmField','pick','filter','getSubjects','getDescriptions','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x396dcd,_0x46acc8){var _0x134bdf=function(_0x2ae828){while(--_0x2ae828){_0x396dcd['push'](_0x396dcd['shift']());}};_0x134bdf(++_0x46acc8);}(_0xea96,0x77));var _0x6ea9=function(_0x3c3632,_0x3f00ff){_0x3c3632=_0x3c3632-0x0;var _0xb56ced=_0xea96[_0x3c3632];return _0xb56ced;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ea9('0x0'));var rp=require('request-promise');var moment=require(_0x6ea9('0x1'));var BPromise=require(_0x6ea9('0x2'));var Mustache=require('mustache');var util=require(_0x6ea9('0x3'));var path=require(_0x6ea9('0x4'));var sox=require(_0x6ea9('0x5'));var csv=require('to-csv');var ejs=require(_0x6ea9('0x6'));var fs=require('fs');var fs_extra=require(_0x6ea9('0x7'));var _=require(_0x6ea9('0x8'));var squel=require(_0x6ea9('0x9'));var crypto=require(_0x6ea9('0xa'));var jsforce=require(_0x6ea9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6ea9('0xc'));var querystring=require(_0x6ea9('0xd'));var Papa=require(_0x6ea9('0xe'));var Redis=require(_0x6ea9('0xf'));var authService=require(_0x6ea9('0x10'));var qs=require(_0x6ea9('0x11'));var as=require(_0x6ea9('0x12'));var hardwareService=require(_0x6ea9('0x13'));var logger=require(_0x6ea9('0x14'))(_0x6ea9('0x15'));var utils=require('../../config/utils');var config=require(_0x6ea9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ea9('0x17'))['db'];function respondWithStatusCode(_0x44f575,_0x560033){_0x560033=_0x560033||0xcc;return function(_0x55f929){if(_0x55f929){return _0x44f575[_0x6ea9('0x18')](_0x560033);}return _0x44f575[_0x6ea9('0x19')](_0x560033)[_0x6ea9('0x1a')]();};}function respondWithResult(_0x22da4c,_0x2ad773){_0x2ad773=_0x2ad773||0xc8;return function(_0x9e187f){if(_0x9e187f){return _0x22da4c[_0x6ea9('0x19')](_0x2ad773)[_0x6ea9('0x1b')](_0x9e187f);}};}function respondWithFilteredResult(_0x44a1e8,_0x55afec){return function(_0x12a93f){if(_0x12a93f){var _0x318808=typeof _0x55afec[_0x6ea9('0x1c')]===_0x6ea9('0x1d')&&typeof _0x55afec[_0x6ea9('0x1e')]==='undefined';var _0x246197=_0x12a93f['count'];var _0x4f411f=_0x318808?0x0:_0x55afec['offset'];var _0x50f616=_0x318808?_0x12a93f['count']:_0x55afec[_0x6ea9('0x1c')]+_0x55afec['limit'];var _0x2091e7;if(_0x50f616>=_0x246197){_0x50f616=_0x246197;_0x2091e7=0xc8;}else{_0x2091e7=0xce;}_0x44a1e8[_0x6ea9('0x19')](_0x2091e7);return _0x44a1e8[_0x6ea9('0x1f')]('Content-Range',_0x4f411f+'-'+_0x50f616+'/'+_0x246197)[_0x6ea9('0x1b')](_0x12a93f);}return null;};}function patchUpdates(_0x204ea4){return function(_0x53e9e6){try{jsonpatch['apply'](_0x53e9e6,_0x204ea4,!![]);}catch(_0x6dc342){return BPromise[_0x6ea9('0x20')](_0x6dc342);}return _0x53e9e6['save']();};}function saveUpdates(_0x1047da,_0x85148b){return function(_0x525142){if(_0x525142){return _0x525142['update'](_0x1047da)[_0x6ea9('0x21')](function(_0xea48a8){return _0xea48a8;});}return null;};}function removeEntity(_0x3e7037,_0x2e5be8){return function(_0x3c4a37){if(_0x3c4a37){return _0x3c4a37[_0x6ea9('0x22')]()[_0x6ea9('0x21')](function(){_0x3e7037[_0x6ea9('0x19')](0xcc)[_0x6ea9('0x1a')]();});}};}function handleEntityNotFound(_0x22381f,_0x53cfe9){return function(_0x4d5454){if(!_0x4d5454){_0x22381f[_0x6ea9('0x18')](0x194);}return _0x4d5454;};}function handleError(_0x1dfbcc,_0x53c7cb){_0x53c7cb=_0x53c7cb||0x1f4;return function(_0x3da579){logger[_0x6ea9('0x23')](_0x3da579[_0x6ea9('0x24')]);if(_0x3da579[_0x6ea9('0x25')]){delete _0x3da579['name'];}_0x1dfbcc[_0x6ea9('0x19')](_0x53c7cb)[_0x6ea9('0x26')](_0x3da579);};}exports[_0x6ea9('0x27')]=function(_0x4cd730,_0x5233ad){var _0x589aa2={},_0x56b10c={},_0xd879ff={'count':0x0,'rows':[]};var _0x73719e=_[_0x6ea9('0x28')](db['SugarcrmConfiguration'][_0x6ea9('0x29')],function(_0x3bfbdb){return{'name':_0x3bfbdb[_0x6ea9('0x2a')],'type':_0x3bfbdb['type'][_0x6ea9('0x2b')]};});_0x56b10c[_0x6ea9('0x2c')]=_[_0x6ea9('0x28')](_0x73719e,_0x6ea9('0x25'));_0x56b10c['query']=_['keys'](_0x4cd730[_0x6ea9('0x2d')]);_0x56b10c[_0x6ea9('0x2e')]=_[_0x6ea9('0x2f')](_0x56b10c['model'],_0x56b10c[_0x6ea9('0x2d')]);_0x589aa2[_0x6ea9('0x30')]=_[_0x6ea9('0x2f')](_0x56b10c[_0x6ea9('0x2c')],qs[_0x6ea9('0x31')](_0x4cd730[_0x6ea9('0x2d')]['fields']));_0x589aa2[_0x6ea9('0x30')]=_0x589aa2[_0x6ea9('0x30')][_0x6ea9('0x32')]?_0x589aa2[_0x6ea9('0x30')]:_0x56b10c['model'];if(!_0x4cd730[_0x6ea9('0x2d')][_0x6ea9('0x33')](_0x6ea9('0x34'))){_0x589aa2[_0x6ea9('0x1e')]=qs[_0x6ea9('0x1e')](_0x4cd730['query']['limit']);_0x589aa2[_0x6ea9('0x1c')]=qs['offset'](_0x4cd730['query'][_0x6ea9('0x1c')]);}_0x589aa2[_0x6ea9('0x35')]=qs[_0x6ea9('0x36')](_0x4cd730[_0x6ea9('0x2d')][_0x6ea9('0x36')]);_0x589aa2[_0x6ea9('0x37')]=qs[_0x6ea9('0x2e')](_['pick'](_0x4cd730[_0x6ea9('0x2d')],_0x56b10c[_0x6ea9('0x2e')]),_0x73719e);if(_0x4cd730[_0x6ea9('0x2d')]['filter']){_0x589aa2[_0x6ea9('0x37')]=_[_0x6ea9('0x38')](_0x589aa2[_0x6ea9('0x37')],{'$or':_['map'](_0x73719e,function(_0x256894){if(_0x256894[_0x6ea9('0x39')]!==_0x6ea9('0x3a')){var _0x555277={};_0x555277[_0x256894['name']]={'$like':'%'+_0x4cd730[_0x6ea9('0x2d')]['filter']+'%'};return _0x555277;}})});}_0x589aa2=_[_0x6ea9('0x38')]({},_0x589aa2,_0x4cd730[_0x6ea9('0x3b')]);var _0x513fa9={'where':_0x589aa2[_0x6ea9('0x37')]};return db['SugarcrmConfiguration'][_0x6ea9('0x3c')](_0x513fa9)[_0x6ea9('0x21')](function(_0x1e8752){_0xd879ff['count']=_0x1e8752;if(_0x4cd730[_0x6ea9('0x2d')][_0x6ea9('0x3d')]){_0x589aa2['include']=[{'all':!![]}];}return db[_0x6ea9('0x3e')][_0x6ea9('0x3f')](_0x589aa2);})['then'](function(_0x1e8865){_0xd879ff[_0x6ea9('0x40')]=_0x1e8865;return _0xd879ff;})[_0x6ea9('0x21')](respondWithFilteredResult(_0x5233ad,_0x589aa2))[_0x6ea9('0x41')](handleError(_0x5233ad,null));};exports[_0x6ea9('0x42')]=function(_0x5abbb8,_0x5d45e4){var _0x585265={'raw':![],'where':{'id':_0x5abbb8[_0x6ea9('0x43')]['id']}},_0x216bc1={};_0x216bc1['model']=_[_0x6ea9('0x44')](db[_0x6ea9('0x3e')][_0x6ea9('0x29')]);_0x216bc1['query']=_[_0x6ea9('0x44')](_0x5abbb8[_0x6ea9('0x2d')]);_0x216bc1[_0x6ea9('0x2e')]=_[_0x6ea9('0x2f')](_0x216bc1['model'],_0x216bc1['query']);_0x585265[_0x6ea9('0x30')]=_['intersection'](_0x216bc1[_0x6ea9('0x2c')],qs[_0x6ea9('0x31')](_0x5abbb8[_0x6ea9('0x2d')][_0x6ea9('0x31')]));_0x585265[_0x6ea9('0x30')]=_0x585265[_0x6ea9('0x30')][_0x6ea9('0x32')]?_0x585265[_0x6ea9('0x30')]:_0x216bc1['model'];if(_0x5abbb8['query'][_0x6ea9('0x3d')]){_0x585265[_0x6ea9('0x45')]=[{'all':!![]}];}_0x585265=_[_0x6ea9('0x38')]({},_0x585265,_0x5abbb8[_0x6ea9('0x3b')]);return db[_0x6ea9('0x3e')]['find'](_0x585265)['then'](handleEntityNotFound(_0x5d45e4,null))[_0x6ea9('0x21')](respondWithResult(_0x5d45e4,null))[_0x6ea9('0x41')](handleError(_0x5d45e4,null));};exports[_0x6ea9('0x46')]=function(_0xde1c00,_0x2cf4a8){return db[_0x6ea9('0x3e')][_0x6ea9('0x46')](_0xde1c00[_0x6ea9('0x47')],{})[_0x6ea9('0x21')](respondWithResult(_0x2cf4a8,0xc9))[_0x6ea9('0x41')](handleError(_0x2cf4a8,null));};exports[_0x6ea9('0x48')]=function(_0x1ab602,_0x31c419){if(_0x1ab602[_0x6ea9('0x47')]['id']){delete _0x1ab602['body']['id'];}return db[_0x6ea9('0x3e')][_0x6ea9('0x49')]({'where':{'id':_0x1ab602['params']['id']}})[_0x6ea9('0x21')](handleEntityNotFound(_0x31c419,null))[_0x6ea9('0x21')](saveUpdates(_0x1ab602[_0x6ea9('0x47')],null))[_0x6ea9('0x21')](respondWithResult(_0x31c419,null))['catch'](handleError(_0x31c419,null));};exports[_0x6ea9('0x22')]=function(_0x2ae630,_0xc0fe3c){return db[_0x6ea9('0x3e')][_0x6ea9('0x49')]({'where':{'id':_0x2ae630[_0x6ea9('0x43')]['id']}})[_0x6ea9('0x21')](handleEntityNotFound(_0xc0fe3c,null))['then'](removeEntity(_0xc0fe3c,null))[_0x6ea9('0x41')](handleError(_0xc0fe3c,null));};exports[_0x6ea9('0x4a')]=function(_0x384329,_0x5983fc,_0x5c41f5){var _0x5dbf6f={};var _0x16cc8a={};var _0x1cfc61;var _0x2490c9;return db[_0x6ea9('0x3e')][_0x6ea9('0x4b')]({'where':{'id':_0x384329[_0x6ea9('0x43')]['id']}})[_0x6ea9('0x21')](handleEntityNotFound(_0x5983fc,null))[_0x6ea9('0x21')](function(_0x8bcbb3){if(_0x8bcbb3){_0x1cfc61=_0x8bcbb3;_0x16cc8a['model']=_[_0x6ea9('0x44')](db[_0x6ea9('0x4c')]['rawAttributes']);_0x16cc8a[_0x6ea9('0x2d')]=_[_0x6ea9('0x44')](_0x384329[_0x6ea9('0x2d')]);_0x16cc8a[_0x6ea9('0x2e')]=_['intersection'](_0x16cc8a[_0x6ea9('0x2c')],_0x16cc8a[_0x6ea9('0x2d')]);_0x5dbf6f[_0x6ea9('0x30')]=_[_0x6ea9('0x2f')](_0x16cc8a[_0x6ea9('0x2c')],qs['fields'](_0x384329['query']['fields']));_0x5dbf6f[_0x6ea9('0x30')]=_0x5dbf6f[_0x6ea9('0x30')][_0x6ea9('0x32')]?_0x5dbf6f[_0x6ea9('0x30')]:_0x16cc8a[_0x6ea9('0x2c')];_0x5dbf6f['order']=qs[_0x6ea9('0x36')](_0x384329[_0x6ea9('0x2d')][_0x6ea9('0x36')]);_0x5dbf6f[_0x6ea9('0x37')]=qs[_0x6ea9('0x2e')](_[_0x6ea9('0x4d')](_0x384329[_0x6ea9('0x2d')],_0x16cc8a[_0x6ea9('0x2e')]));if(_0x384329['query'][_0x6ea9('0x4e')]){_0x5dbf6f[_0x6ea9('0x37')]=_['merge'](_0x5dbf6f['where'],{'$or':_[_0x6ea9('0x28')](_0x5dbf6f[_0x6ea9('0x30')],function(_0x1630d2){var _0x5db43e={};_0x5db43e[_0x1630d2]={'$like':'%'+_0x384329[_0x6ea9('0x2d')]['filter']+'%'};return _0x5db43e;})});}_0x5dbf6f=_[_0x6ea9('0x38')]({},_0x5dbf6f,_0x384329[_0x6ea9('0x3b')]);return _0x1cfc61['getFields'](_0x5dbf6f);}})['then'](function(_0x25c90c){if(_0x25c90c){_0x2490c9=_0x25c90c[_0x6ea9('0x32')];if(!_0x384329[_0x6ea9('0x2d')][_0x6ea9('0x33')](_0x6ea9('0x34'))){_0x5dbf6f[_0x6ea9('0x1e')]=qs['limit'](_0x384329['query'][_0x6ea9('0x1e')]);_0x5dbf6f[_0x6ea9('0x1c')]=qs[_0x6ea9('0x1c')](_0x384329[_0x6ea9('0x2d')][_0x6ea9('0x1c')]);}return _0x1cfc61[_0x6ea9('0x4a')](_0x5dbf6f);}})[_0x6ea9('0x21')](function(_0x19cacb){if(_0x19cacb){return _0x19cacb?{'count':_0x2490c9,'rows':_0x19cacb}:null;}})[_0x6ea9('0x21')](respondWithResult(_0x5983fc,null))[_0x6ea9('0x41')](handleError(_0x5983fc,null));};exports['getSubjects']=function(_0x259f44,_0xd67388,_0x1f5065){var _0x5c3318={};var _0x218d48={};var _0x4f41f6;var _0x35b6d9;return db[_0x6ea9('0x3e')]['findOne']({'where':{'id':_0x259f44[_0x6ea9('0x43')]['id']}})[_0x6ea9('0x21')](handleEntityNotFound(_0xd67388,null))[_0x6ea9('0x21')](function(_0x24709e){if(_0x24709e){_0x4f41f6=_0x24709e;_0x218d48['model']=_[_0x6ea9('0x44')](db[_0x6ea9('0x4c')][_0x6ea9('0x29')]);_0x218d48[_0x6ea9('0x2d')]=_['keys'](_0x259f44[_0x6ea9('0x2d')]);_0x218d48[_0x6ea9('0x2e')]=_[_0x6ea9('0x2f')](_0x218d48[_0x6ea9('0x2c')],_0x218d48[_0x6ea9('0x2d')]);_0x5c3318[_0x6ea9('0x30')]=_['intersection'](_0x218d48[_0x6ea9('0x2c')],qs['fields'](_0x259f44['query'][_0x6ea9('0x31')]));_0x5c3318[_0x6ea9('0x30')]=_0x5c3318[_0x6ea9('0x30')][_0x6ea9('0x32')]?_0x5c3318[_0x6ea9('0x30')]:_0x218d48[_0x6ea9('0x2c')];_0x5c3318['order']=qs['sort'](_0x259f44['query'][_0x6ea9('0x36')]);_0x5c3318[_0x6ea9('0x37')]=qs[_0x6ea9('0x2e')](_[_0x6ea9('0x4d')](_0x259f44['query'],_0x218d48[_0x6ea9('0x2e')]));if(_0x259f44[_0x6ea9('0x2d')][_0x6ea9('0x4e')]){_0x5c3318[_0x6ea9('0x37')]=_[_0x6ea9('0x38')](_0x5c3318['where'],{'$or':_['map'](_0x5c3318[_0x6ea9('0x30')],function(_0x4ca136){var _0x18a41c={};_0x18a41c[_0x4ca136]={'$like':'%'+_0x259f44[_0x6ea9('0x2d')][_0x6ea9('0x4e')]+'%'};return _0x18a41c;})});}_0x5c3318=_['merge']({},_0x5c3318,_0x259f44[_0x6ea9('0x3b')]);return _0x4f41f6[_0x6ea9('0x4f')](_0x5c3318);}})[_0x6ea9('0x21')](function(_0x27144e){if(_0x27144e){_0x35b6d9=_0x27144e['length'];if(!_0x259f44[_0x6ea9('0x2d')][_0x6ea9('0x33')]('nolimit')){_0x5c3318[_0x6ea9('0x1e')]=qs[_0x6ea9('0x1e')](_0x259f44[_0x6ea9('0x2d')][_0x6ea9('0x1e')]);_0x5c3318[_0x6ea9('0x1c')]=qs[_0x6ea9('0x1c')](_0x259f44[_0x6ea9('0x2d')][_0x6ea9('0x1c')]);}return _0x4f41f6[_0x6ea9('0x4f')](_0x5c3318);}})['then'](function(_0x197eca){if(_0x197eca){return _0x197eca?{'count':_0x35b6d9,'rows':_0x197eca}:null;}})['then'](respondWithResult(_0xd67388,null))[_0x6ea9('0x41')](handleError(_0xd67388,null));};exports['getDescriptions']=function(_0x354a2d,_0x22b49d,_0x1c6e55){var _0x57a8e5={};var _0x25a443={};var _0xce3f3;var _0xcd6b57;return db['SugarcrmConfiguration'][_0x6ea9('0x4b')]({'where':{'id':_0x354a2d[_0x6ea9('0x43')]['id']}})[_0x6ea9('0x21')](handleEntityNotFound(_0x22b49d,null))[_0x6ea9('0x21')](function(_0x440b28){if(_0x440b28){_0xce3f3=_0x440b28;_0x25a443['model']=_[_0x6ea9('0x44')](db[_0x6ea9('0x4c')]['rawAttributes']);_0x25a443[_0x6ea9('0x2d')]=_[_0x6ea9('0x44')](_0x354a2d['query']);_0x25a443[_0x6ea9('0x2e')]=_[_0x6ea9('0x2f')](_0x25a443[_0x6ea9('0x2c')],_0x25a443[_0x6ea9('0x2d')]);_0x57a8e5['attributes']=_[_0x6ea9('0x2f')](_0x25a443[_0x6ea9('0x2c')],qs['fields'](_0x354a2d[_0x6ea9('0x2d')][_0x6ea9('0x31')]));_0x57a8e5[_0x6ea9('0x30')]=_0x57a8e5['attributes']['length']?_0x57a8e5[_0x6ea9('0x30')]:_0x25a443['model'];_0x57a8e5[_0x6ea9('0x35')]=qs[_0x6ea9('0x36')](_0x354a2d[_0x6ea9('0x2d')][_0x6ea9('0x36')]);_0x57a8e5[_0x6ea9('0x37')]=qs[_0x6ea9('0x2e')](_[_0x6ea9('0x4d')](_0x354a2d[_0x6ea9('0x2d')],_0x25a443[_0x6ea9('0x2e')]));if(_0x354a2d[_0x6ea9('0x2d')][_0x6ea9('0x4e')]){_0x57a8e5['where']=_[_0x6ea9('0x38')](_0x57a8e5[_0x6ea9('0x37')],{'$or':_[_0x6ea9('0x28')](_0x57a8e5[_0x6ea9('0x30')],function(_0x239793){var _0x427b8c={};_0x427b8c[_0x239793]={'$like':'%'+_0x354a2d[_0x6ea9('0x2d')]['filter']+'%'};return _0x427b8c;})});}_0x57a8e5=_['merge']({},_0x57a8e5,_0x354a2d[_0x6ea9('0x3b')]);return _0xce3f3[_0x6ea9('0x50')](_0x57a8e5);}})[_0x6ea9('0x21')](function(_0x5481f3){if(_0x5481f3){_0xcd6b57=_0x5481f3[_0x6ea9('0x32')];if(!_0x354a2d[_0x6ea9('0x2d')][_0x6ea9('0x33')](_0x6ea9('0x34'))){_0x57a8e5[_0x6ea9('0x1e')]=qs[_0x6ea9('0x1e')](_0x354a2d[_0x6ea9('0x2d')]['limit']);_0x57a8e5[_0x6ea9('0x1c')]=qs['offset'](_0x354a2d[_0x6ea9('0x2d')][_0x6ea9('0x1c')]);}return _0xce3f3['getDescriptions'](_0x57a8e5);}})[_0x6ea9('0x21')](function(_0x1a3dc5){if(_0x1a3dc5){return _0x1a3dc5?{'count':_0xcd6b57,'rows':_0x1a3dc5}:null;}})[_0x6ea9('0x21')](respondWithResult(_0x22b49d,null))[_0x6ea9('0x41')](handleError(_0x22b49d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 21d725d..67635d6 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 _0xd268=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd268,0xf6));var _0x8d26=function(_0x31eadc,_0x28f2f5){_0x31eadc=_0x31eadc-0x0;var _0x5dca32=_0xd268[_0x31eadc];return _0x5dca32;};'use strict';var _=require('lodash');var util=require(_0x8d26('0x0'));var logger=require(_0x8d26('0x1'))(_0x8d26('0x2'));var moment=require(_0x8d26('0x3'));var BPromise=require(_0x8d26('0x4'));var rp=require(_0x8d26('0x5'));var fs=require('fs');var path=require(_0x8d26('0x6'));var rimraf=require(_0x8d26('0x7'));var config=require(_0x8d26('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x8d26('0x9')]=function(_0x18c0f4,_0x5abdd0){return _0x18c0f4[_0x8d26('0xa')](_0x8d26('0xb'),attributes,{'tableName':_0x8d26('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98a1=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5f53fc,_0x4265e0){var _0x1ae053=function(_0x47dbf1){while(--_0x47dbf1){_0x5f53fc['push'](_0x5f53fc['shift']());}};_0x1ae053(++_0x4265e0);}(_0x98a1,0x14a));var _0x198a=function(_0x55f323,_0x5cc60f){_0x55f323=_0x55f323-0x0;var _0x3e205e=_0x98a1[_0x55f323];return _0x3e205e;};'use strict';var _=require('lodash');var util=require(_0x198a('0x0'));var logger=require(_0x198a('0x1'))(_0x198a('0x2'));var moment=require(_0x198a('0x3'));var BPromise=require(_0x198a('0x4'));var rp=require(_0x198a('0x5'));var fs=require('fs');var path=require(_0x198a('0x6'));var rimraf=require(_0x198a('0x7'));var config=require(_0x198a('0x8'));var attributes=require(_0x198a('0x9'));module[_0x198a('0xa')]=function(_0x213a4b,_0x342b79){return _0x213a4b[_0x198a('0xb')]('SugarcrmConfiguration',attributes,{'tableName':_0x198a('0xc'),'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 28a0286..999cbe5 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 _0x2c7a=['request\x20sent','debug','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c7a,0xce));var _0xa2c7=function(_0x1e75b5,_0xa3f20c){_0x1e75b5=_0x1e75b5-0x0;var _0x1f6f4c=_0x2c7a[_0x1e75b5];return _0x1f6f4c;};'use strict';var _=require(_0xa2c7('0x0'));var util=require(_0xa2c7('0x1'));var moment=require(_0xa2c7('0x2'));var BPromise=require(_0xa2c7('0x3'));var rs=require(_0xa2c7('0x4'));var fs=require('fs');var Redis=require(_0xa2c7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2c7('0x6'));var logger=require(_0xa2c7('0x7'))('rpc');var config=require(_0xa2c7('0x8'));var jayson=require(_0xa2c7('0x9'));var client=jayson[_0xa2c7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ea4b5,_0x453c30,_0x5d617b){return new BPromise(function(_0x8f79b7,_0x3f1dad){return client[_0xa2c7('0xb')](_0x5ea4b5,_0x5d617b)[_0xa2c7('0xc')](function(_0x4b16a3){logger['info'](_0xa2c7('0xd'),_0x453c30,_0xa2c7('0xe'));logger[_0xa2c7('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x453c30,'request\x20sent',JSON['stringify'](_0x4b16a3));if(_0x4b16a3[_0xa2c7('0x10')]){if(_0x4b16a3[_0xa2c7('0x10')]['code']===0x1f4){logger[_0xa2c7('0x10')](_0xa2c7('0xd'),_0x453c30,_0x4b16a3[_0xa2c7('0x10')][_0xa2c7('0x11')]);return _0x3f1dad(_0x4b16a3[_0xa2c7('0x10')][_0xa2c7('0x11')]);}logger['error'](_0xa2c7('0xd'),_0x453c30,_0x4b16a3[_0xa2c7('0x10')][_0xa2c7('0x11')]);return _0x8f79b7(_0x4b16a3[_0xa2c7('0x10')][_0xa2c7('0x11')]);}else{logger[_0xa2c7('0x12')](_0xa2c7('0xd'),_0x453c30,_0xa2c7('0xe'));_0x8f79b7(_0x4b16a3[_0xa2c7('0x13')][_0xa2c7('0x11')]);}})['catch'](function(_0x449b08){logger[_0xa2c7('0x10')](_0xa2c7('0xd'),_0x453c30,_0x449b08);_0x3f1dad(_0x449b08);});});} \ No newline at end of file +var _0xa7e8=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x362454,_0x164fea){var _0x2d4798=function(_0x47f3f5){while(--_0x47f3f5){_0x362454['push'](_0x362454['shift']());}};_0x2d4798(++_0x164fea);}(_0xa7e8,0x170));var _0x8a7e=function(_0x117fc1,_0x18392f){_0x117fc1=_0x117fc1-0x0;var _0x3b6d09=_0xa7e8[_0x117fc1];return _0x3b6d09;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8a7e('0x0'));var rs=require(_0x8a7e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a7e('0x2'))['db'];var utils=require(_0x8a7e('0x3'));var logger=require('../../config/logger')(_0x8a7e('0x4'));var config=require(_0x8a7e('0x5'));var jayson=require(_0x8a7e('0x6'));var client=jayson['client'][_0x8a7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35fe19,_0x34c026,_0x6165cc){return new BPromise(function(_0x44dc7d,_0x6a5521){return client[_0x8a7e('0x8')](_0x35fe19,_0x6165cc)['then'](function(_0x2db1bb){logger[_0x8a7e('0x9')](_0x8a7e('0xa'),_0x34c026,_0x8a7e('0xb'));logger[_0x8a7e('0xc')](_0x8a7e('0xd'),_0x34c026,'request\x20sent',JSON[_0x8a7e('0xe')](_0x2db1bb));if(_0x2db1bb[_0x8a7e('0xf')]){if(_0x2db1bb['error'][_0x8a7e('0x10')]===0x1f4){logger[_0x8a7e('0xf')](_0x8a7e('0xa'),_0x34c026,_0x2db1bb[_0x8a7e('0xf')][_0x8a7e('0x11')]);return _0x6a5521(_0x2db1bb[_0x8a7e('0xf')][_0x8a7e('0x11')]);}logger[_0x8a7e('0xf')](_0x8a7e('0xa'),_0x34c026,_0x2db1bb[_0x8a7e('0xf')][_0x8a7e('0x11')]);return _0x44dc7d(_0x2db1bb[_0x8a7e('0xf')]['message']);}else{logger[_0x8a7e('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x34c026,'request\x20sent');_0x44dc7d(_0x2db1bb[_0x8a7e('0x12')][_0x8a7e('0x11')]);}})['catch'](function(_0x5a3a99){logger[_0x8a7e('0xf')](_0x8a7e('0xa'),_0x34c026,_0x5a3a99);_0x6a5521(_0x5a3a99);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index fc1fac1..ee8a518 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 _0xc82f=['express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','create','update','delete','destroy','exports','util','connect-timeout'];(function(_0x37e0a3,_0x12e4f2){var _0x5ed3ef=function(_0x2bbb7d){while(--_0x2bbb7d){_0x37e0a3['push'](_0x37e0a3['shift']());}};_0x5ed3ef(++_0x12e4f2);}(_0xc82f,0x1da));var _0xfc82=function(_0x4c6856,_0x4f377a){_0x4c6856=_0x4c6856-0x0;var _0x417437=_0xc82f[_0x4c6856];return _0x417437;};'use strict';var multer=require('multer');var util=require(_0xfc82('0x0'));var path=require('path');var timeout=require(_0xfc82('0x1'));var express=require(_0xfc82('0x2'));var router=express[_0xfc82('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfc82('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfc82('0x5'));var controller=require(_0xfc82('0x6'));router['get']('/',auth[_0xfc82('0x7')](),controller[_0xfc82('0x8')]);router[_0xfc82('0x9')](_0xfc82('0xa'),auth['isAuthenticated'](),controller[_0xfc82('0xb')]);router['post']('/',auth[_0xfc82('0x7')](),controller[_0xfc82('0xc')]);router['put']('/:id',auth[_0xfc82('0x7')](),controller[_0xfc82('0xd')]);router[_0xfc82('0xe')](_0xfc82('0xa'),auth[_0xfc82('0x7')](),controller[_0xfc82('0xf')]);module[_0xfc82('0x10')]=router; \ No newline at end of file +var _0xa8dd=['post','create','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','/:id','isAuthenticated','show'];(function(_0x7f88bd,_0x4d3638){var _0x4d926f=function(_0x7a3d8d){while(--_0x7a3d8d){_0x7f88bd['push'](_0x7f88bd['shift']());}};_0x4d926f(++_0x4d3638);}(_0xa8dd,0x102));var _0xda8d=function(_0x1ef093,_0x44e1ed){_0x1ef093=_0x1ef093-0x0;var _0x3728ca=_0xa8dd[_0x1ef093];return _0x3728ca;};'use strict';var multer=require('multer');var util=require(_0xda8d('0x0'));var path=require(_0xda8d('0x1'));var timeout=require('connect-timeout');var express=require(_0xda8d('0x2'));var router=express[_0xda8d('0x3')]();var fs_extra=require(_0xda8d('0x4'));var auth=require(_0xda8d('0x5'));var interaction=require(_0xda8d('0x6'));var config=require('../../config/environment');var controller=require(_0xda8d('0x7'));router[_0xda8d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xda8d('0x8')](_0xda8d('0x9'),auth[_0xda8d('0xa')](),controller[_0xda8d('0xb')]);router[_0xda8d('0xc')]('/',auth[_0xda8d('0xa')](),controller[_0xda8d('0xd')]);router['put']('/:id',auth[_0xda8d('0xa')](),controller[_0xda8d('0xe')]);router[_0xda8d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xda8d('0x10')]);module[_0xda8d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ee18bf1..6a7fa93 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 _0x159d=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x50b6cd,_0x428332){var _0x289d3d=function(_0x32e628){while(--_0x32e628){_0x50b6cd['push'](_0x50b6cd['shift']());}};_0x289d3d(++_0x428332);}(_0x159d,0x8e));var _0xd159=function(_0x4f7d08,_0x18f85c){_0x4f7d08=_0x4f7d08-0x0;var _0x301c97=_0x159d[_0x4f7d08];return _0x301c97;};'use strict';var Sequelize=require(_0xd159('0x0'));module[_0xd159('0x1')]={'type':{'type':Sequelize[_0xd159('0x2')](_0xd159('0x3'),'variable',_0xd159('0x4'),_0xd159('0x5'),'picklist'),'defaultValue':_0xd159('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd159('0x6')]},'keyType':{'type':Sequelize[_0xd159('0x2')](_0xd159('0x3'),_0xd159('0x7'),_0xd159('0x4'))},'keyContent':{'type':Sequelize[_0xd159('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd159('0x6')]},'customField':{'type':Sequelize[_0xd159('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd159('0x6')]}}; \ No newline at end of file +var _0x7f27=['customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue','string','STRING'];(function(_0x1071f5,_0x1cb30c){var _0x2f869c=function(_0x1bd953){while(--_0x1bd953){_0x1071f5['push'](_0x1071f5['shift']());}};_0x2f869c(++_0x1cb30c);}(_0x7f27,0xb2));var _0x77f2=function(_0x2e7e7e,_0x394c4e){_0x2e7e7e=_0x2e7e7e-0x0;var _0x1a43ee=_0x7f27[_0x2e7e7e];return _0x1a43ee;};'use strict';var Sequelize=require(_0x77f2('0x0'));module['exports']={'type':{'type':Sequelize[_0x77f2('0x1')]('string',_0x77f2('0x2'),'customVariable',_0x77f2('0x3'),'picklist'),'defaultValue':_0x77f2('0x4')},'content':{'type':Sequelize[_0x77f2('0x5')]},'key':{'type':Sequelize[_0x77f2('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x77f2('0x4'),'variable',_0x77f2('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x77f2('0x5')]},'customField':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x77f2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 8b63222..fcc9337 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 _0xa81e=['key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','filter','includeAll','include','findAll','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type'];(function(_0x4bc7e,_0x2c3c57){var _0x5bf96a=function(_0x5047e3){while(--_0x5047e3){_0x4bc7e['push'](_0x4bc7e['shift']());}};_0x5bf96a(++_0x2c3c57);}(_0xa81e,0x130));var _0xea81=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xa81e[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require(_0xea81('0x0'));var rimraf=require(_0xea81('0x1'));var zipdir=require(_0xea81('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xea81('0x3'));var Mustache=require(_0xea81('0x4'));var util=require(_0xea81('0x5'));var path=require('path');var sox=require(_0xea81('0x6'));var csv=require(_0xea81('0x7'));var ejs=require(_0xea81('0x8'));var fs=require('fs');var fs_extra=require(_0xea81('0x9'));var _=require(_0xea81('0xa'));var squel=require(_0xea81('0xb'));var crypto=require(_0xea81('0xc'));var jsforce=require(_0xea81('0xd'));var deskjs=require(_0xea81('0xe'));var toCsv=require('to-csv');var querystring=require(_0xea81('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xea81('0x10'));var qs=require(_0xea81('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea81('0x12'))(_0xea81('0x13'));var utils=require(_0xea81('0x14'));var config=require(_0xea81('0x15'));var licenseUtil=require(_0xea81('0x16'));var db=require(_0xea81('0x17'))['db'];function respondWithStatusCode(_0x495afc,_0x4686de){_0x4686de=_0x4686de||0xcc;return function(_0x144627){if(_0x144627){return _0x495afc[_0xea81('0x18')](_0x4686de);}return _0x495afc[_0xea81('0x19')](_0x4686de)[_0xea81('0x1a')]();};}function respondWithResult(_0x19d13a,_0x2e1737){_0x2e1737=_0x2e1737||0xc8;return function(_0x153f14){if(_0x153f14){return _0x19d13a[_0xea81('0x19')](_0x2e1737)[_0xea81('0x1b')](_0x153f14);}};}function respondWithFilteredResult(_0x4ba80d,_0x1b64ec){return function(_0x35d0e8){if(_0x35d0e8){var _0x1ed20a=typeof _0x1b64ec[_0xea81('0x1c')]===_0xea81('0x1d')&&typeof _0x1b64ec['limit']===_0xea81('0x1d');var _0xf0b252=_0x35d0e8[_0xea81('0x1e')];var _0x5d591b=_0x1ed20a?0x0:_0x1b64ec[_0xea81('0x1c')];var _0x35f29c=_0x1ed20a?_0x35d0e8['count']:_0x1b64ec[_0xea81('0x1c')]+_0x1b64ec[_0xea81('0x1f')];var _0x4bd7ab;if(_0x35f29c>=_0xf0b252){_0x35f29c=_0xf0b252;_0x4bd7ab=0xc8;}else{_0x4bd7ab=0xce;}_0x4ba80d[_0xea81('0x19')](_0x4bd7ab);return _0x4ba80d[_0xea81('0x20')]('Content-Range',_0x5d591b+'-'+_0x35f29c+'/'+_0xf0b252)[_0xea81('0x1b')](_0x35d0e8);}return null;};}function patchUpdates(_0x8e1df7){return function(_0x112929){try{jsonpatch[_0xea81('0x21')](_0x112929,_0x8e1df7,!![]);}catch(_0x45079c){return BPromise[_0xea81('0x22')](_0x45079c);}return _0x112929[_0xea81('0x23')]();};}function saveUpdates(_0x30fc5b,_0x2d6ecc){return function(_0x1d3526){if(_0x1d3526){return _0x1d3526[_0xea81('0x24')](_0x30fc5b)[_0xea81('0x25')](function(_0x1998c9){return _0x1998c9;});}return null;};}function removeEntity(_0x4491ea,_0x523c58){return function(_0x3a5bbb){if(_0x3a5bbb){return _0x3a5bbb['destroy']()['then'](function(){_0x4491ea[_0xea81('0x19')](0xcc)[_0xea81('0x1a')]();});}};}function handleEntityNotFound(_0x21f585,_0x1aacaa){return function(_0x173073){if(!_0x173073){_0x21f585['sendStatus'](0x194);}return _0x173073;};}function handleError(_0x18f84b,_0x26ccdf){_0x26ccdf=_0x26ccdf||0x1f4;return function(_0x480ea2){logger['error'](_0x480ea2[_0xea81('0x26')]);if(_0x480ea2[_0xea81('0x27')]){delete _0x480ea2[_0xea81('0x27')];}_0x18f84b[_0xea81('0x19')](_0x26ccdf)[_0xea81('0x28')](_0x480ea2);};}exports['index']=function(_0x55e230,_0x5dd41e){var _0x17f02c={},_0x3fac69={},_0x547ef4={'count':0x0,'rows':[]};var _0x229237=_[_0xea81('0x29')](db[_0xea81('0x2a')][_0xea81('0x2b')],function(_0x297653){return{'name':_0x297653[_0xea81('0x2c')],'type':_0x297653[_0xea81('0x2d')][_0xea81('0x2e')]};});_0x3fac69[_0xea81('0x2f')]=_[_0xea81('0x29')](_0x229237,'name');_0x3fac69['query']=_[_0xea81('0x30')](_0x55e230['query']);_0x3fac69['filters']=_[_0xea81('0x31')](_0x3fac69[_0xea81('0x2f')],_0x3fac69[_0xea81('0x32')]);_0x17f02c[_0xea81('0x33')]=_[_0xea81('0x31')](_0x3fac69['model'],qs['fields'](_0x55e230[_0xea81('0x32')][_0xea81('0x34')]));_0x17f02c[_0xea81('0x33')]=_0x17f02c['attributes'][_0xea81('0x35')]?_0x17f02c[_0xea81('0x33')]:_0x3fac69[_0xea81('0x2f')];if(!_0x55e230['query'][_0xea81('0x36')]('nolimit')){_0x17f02c[_0xea81('0x1f')]=qs[_0xea81('0x1f')](_0x55e230[_0xea81('0x32')][_0xea81('0x1f')]);_0x17f02c[_0xea81('0x1c')]=qs[_0xea81('0x1c')](_0x55e230[_0xea81('0x32')][_0xea81('0x1c')]);}_0x17f02c[_0xea81('0x37')]=qs['sort'](_0x55e230[_0xea81('0x32')][_0xea81('0x38')]);_0x17f02c[_0xea81('0x39')]=qs[_0xea81('0x3a')](_['pick'](_0x55e230[_0xea81('0x32')],_0x3fac69['filters']),_0x229237);if(_0x55e230[_0xea81('0x32')]['filter']){_0x17f02c[_0xea81('0x39')]=_[_0xea81('0x3b')](_0x17f02c[_0xea81('0x39')],{'$or':_['map'](_0x229237,function(_0x283991){if(_0x283991[_0xea81('0x2d')]!=='VIRTUAL'){var _0x55c085={};_0x55c085[_0x283991['name']]={'$like':'%'+_0x55e230[_0xea81('0x32')][_0xea81('0x3c')]+'%'};return _0x55c085;}})});}_0x17f02c=_[_0xea81('0x3b')]({},_0x17f02c,_0x55e230['options']);var _0x1240ed={'where':_0x17f02c[_0xea81('0x39')]};return db[_0xea81('0x2a')][_0xea81('0x1e')](_0x1240ed)[_0xea81('0x25')](function(_0xe7a5d2){_0x547ef4[_0xea81('0x1e')]=_0xe7a5d2;if(_0x55e230['query'][_0xea81('0x3d')]){_0x17f02c[_0xea81('0x3e')]=[{'all':!![]}];}return db[_0xea81('0x2a')][_0xea81('0x3f')](_0x17f02c);})[_0xea81('0x25')](function(_0x22ce7f){_0x547ef4['rows']=_0x22ce7f;return _0x547ef4;})['then'](respondWithFilteredResult(_0x5dd41e,_0x17f02c))[_0xea81('0x40')](handleError(_0x5dd41e,null));};exports['show']=function(_0x30a000,_0x350fab){var _0x372578={'raw':!![],'where':{'id':_0x30a000[_0xea81('0x41')]['id']}},_0x23cb39={};_0x23cb39['model']=_[_0xea81('0x30')](db['SugarcrmField'][_0xea81('0x2b')]);_0x23cb39[_0xea81('0x32')]=_['keys'](_0x30a000[_0xea81('0x32')]);_0x23cb39[_0xea81('0x3a')]=_['intersection'](_0x23cb39[_0xea81('0x2f')],_0x23cb39[_0xea81('0x32')]);_0x372578['attributes']=_[_0xea81('0x31')](_0x23cb39['model'],qs[_0xea81('0x34')](_0x30a000[_0xea81('0x32')][_0xea81('0x34')]));_0x372578[_0xea81('0x33')]=_0x372578[_0xea81('0x33')][_0xea81('0x35')]?_0x372578['attributes']:_0x23cb39[_0xea81('0x2f')];if(_0x30a000['query'][_0xea81('0x3d')]){_0x372578[_0xea81('0x3e')]=[{'all':!![]}];}_0x372578=_[_0xea81('0x3b')]({},_0x372578,_0x30a000['options']);return db['SugarcrmField'][_0xea81('0x42')](_0x372578)[_0xea81('0x25')](handleEntityNotFound(_0x350fab,null))['then'](respondWithResult(_0x350fab,null))[_0xea81('0x40')](handleError(_0x350fab,null));};exports[_0xea81('0x43')]=function(_0x1ef222,_0x4b3248){return db['SugarcrmField'][_0xea81('0x43')](_0x1ef222[_0xea81('0x44')],{})[_0xea81('0x25')](respondWithResult(_0x4b3248,0xc9))[_0xea81('0x40')](handleError(_0x4b3248,null));};exports[_0xea81('0x24')]=function(_0x3842fa,_0x16000f){if(_0x3842fa[_0xea81('0x44')]['id']){delete _0x3842fa[_0xea81('0x44')]['id'];}return db[_0xea81('0x2a')][_0xea81('0x42')]({'where':{'id':_0x3842fa[_0xea81('0x41')]['id']}})[_0xea81('0x25')](handleEntityNotFound(_0x16000f,null))[_0xea81('0x25')](saveUpdates(_0x3842fa[_0xea81('0x44')],null))[_0xea81('0x25')](respondWithResult(_0x16000f,null))['catch'](handleError(_0x16000f,null));};exports[_0xea81('0x45')]=function(_0x118832,_0x3aa0eb){return db[_0xea81('0x2a')][_0xea81('0x42')]({'where':{'id':_0x118832[_0xea81('0x41')]['id']}})[_0xea81('0x25')](handleEntityNotFound(_0x3aa0eb,null))[_0xea81('0x25')](removeEntity(_0x3aa0eb,null))[_0xea81('0x40')](handleError(_0x3aa0eb,null));}; \ No newline at end of file +var _0xc64b=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','end','sendStatus','stack','name','send','index','map','SugarcrmField','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','options','create','body','params','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xc8f8d6,_0x5e7570){var _0x511e5b=function(_0x239ee5){while(--_0x239ee5){_0xc8f8d6['push'](_0xc8f8d6['shift']());}};_0x511e5b(++_0x5e7570);}(_0xc64b,0x176));var _0xbc64=function(_0x4efd3d,_0x2b9694){_0x4efd3d=_0x4efd3d-0x0;var _0x1293f2=_0xc64b[_0x4efd3d];return _0x1293f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc64('0x0'));var zipdir=require(_0xbc64('0x1'));var jsonpatch=require(_0xbc64('0x2'));var rp=require(_0xbc64('0x3'));var moment=require(_0xbc64('0x4'));var BPromise=require(_0xbc64('0x5'));var Mustache=require(_0xbc64('0x6'));var util=require(_0xbc64('0x7'));var path=require('path');var sox=require(_0xbc64('0x8'));var csv=require(_0xbc64('0x9'));var ejs=require(_0xbc64('0xa'));var fs=require('fs');var fs_extra=require(_0xbc64('0xb'));var _=require(_0xbc64('0xc'));var squel=require(_0xbc64('0xd'));var crypto=require(_0xbc64('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbc64('0x9'));var querystring=require(_0xbc64('0xf'));var Papa=require(_0xbc64('0x10'));var Redis=require(_0xbc64('0x11'));var authService=require(_0xbc64('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbc64('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc64('0x14'))(_0xbc64('0x15'));var utils=require(_0xbc64('0x16'));var config=require(_0xbc64('0x17'));var licenseUtil=require(_0xbc64('0x18'));var db=require(_0xbc64('0x19'))['db'];function respondWithStatusCode(_0x1bfbeb,_0x33db7c){_0x33db7c=_0x33db7c||0xcc;return function(_0x424c44){if(_0x424c44){return _0x1bfbeb['sendStatus'](_0x33db7c);}return _0x1bfbeb[_0xbc64('0x1a')](_0x33db7c)['end']();};}function respondWithResult(_0x2b627a,_0x14ab2e){_0x14ab2e=_0x14ab2e||0xc8;return function(_0x8b0899){if(_0x8b0899){return _0x2b627a[_0xbc64('0x1a')](_0x14ab2e)[_0xbc64('0x1b')](_0x8b0899);}};}function respondWithFilteredResult(_0x2252d2,_0x124676){return function(_0x1433f4){if(_0x1433f4){var _0x3513cb=typeof _0x124676[_0xbc64('0x1c')]===_0xbc64('0x1d')&&typeof _0x124676[_0xbc64('0x1e')]===_0xbc64('0x1d');var _0x5a2457=_0x1433f4[_0xbc64('0x1f')];var _0x36b6b3=_0x3513cb?0x0:_0x124676[_0xbc64('0x1c')];var _0x3af9ae=_0x3513cb?_0x1433f4[_0xbc64('0x1f')]:_0x124676[_0xbc64('0x1c')]+_0x124676[_0xbc64('0x1e')];var _0x21ce93;if(_0x3af9ae>=_0x5a2457){_0x3af9ae=_0x5a2457;_0x21ce93=0xc8;}else{_0x21ce93=0xce;}_0x2252d2[_0xbc64('0x1a')](_0x21ce93);return _0x2252d2['set'](_0xbc64('0x20'),_0x36b6b3+'-'+_0x3af9ae+'/'+_0x5a2457)[_0xbc64('0x1b')](_0x1433f4);}return null;};}function patchUpdates(_0x151873){return function(_0x224f2b){try{jsonpatch[_0xbc64('0x21')](_0x224f2b,_0x151873,!![]);}catch(_0x4e63bc){return BPromise[_0xbc64('0x22')](_0x4e63bc);}return _0x224f2b[_0xbc64('0x23')]();};}function saveUpdates(_0xbf6ef4,_0x388ac7){return function(_0x40fa2c){if(_0x40fa2c){return _0x40fa2c['update'](_0xbf6ef4)[_0xbc64('0x24')](function(_0x40d34e){return _0x40d34e;});}return null;};}function removeEntity(_0x502b82,_0x1aaa8f){return function(_0x2a54c4){if(_0x2a54c4){return _0x2a54c4['destroy']()[_0xbc64('0x24')](function(){_0x502b82[_0xbc64('0x1a')](0xcc)[_0xbc64('0x25')]();});}};}function handleEntityNotFound(_0x166ecb,_0x255a26){return function(_0x474afd){if(!_0x474afd){_0x166ecb[_0xbc64('0x26')](0x194);}return _0x474afd;};}function handleError(_0x1f79fa,_0x107140){_0x107140=_0x107140||0x1f4;return function(_0x4505c6){logger['error'](_0x4505c6[_0xbc64('0x27')]);if(_0x4505c6[_0xbc64('0x28')]){delete _0x4505c6[_0xbc64('0x28')];}_0x1f79fa[_0xbc64('0x1a')](_0x107140)[_0xbc64('0x29')](_0x4505c6);};}exports[_0xbc64('0x2a')]=function(_0x38f93c,_0x2598f3){var _0x7c038={},_0x3aabe5={},_0x501d40={'count':0x0,'rows':[]};var _0x4ca188=_[_0xbc64('0x2b')](db[_0xbc64('0x2c')][_0xbc64('0x2d')],function(_0xf2560d){return{'name':_0xf2560d['fieldName'],'type':_0xf2560d['type'][_0xbc64('0x2e')]};});_0x3aabe5[_0xbc64('0x2f')]=_['map'](_0x4ca188,_0xbc64('0x28'));_0x3aabe5[_0xbc64('0x30')]=_[_0xbc64('0x31')](_0x38f93c[_0xbc64('0x30')]);_0x3aabe5[_0xbc64('0x32')]=_['intersection'](_0x3aabe5[_0xbc64('0x2f')],_0x3aabe5[_0xbc64('0x30')]);_0x7c038[_0xbc64('0x33')]=_[_0xbc64('0x34')](_0x3aabe5[_0xbc64('0x2f')],qs[_0xbc64('0x35')](_0x38f93c[_0xbc64('0x30')][_0xbc64('0x35')]));_0x7c038[_0xbc64('0x33')]=_0x7c038[_0xbc64('0x33')][_0xbc64('0x36')]?_0x7c038[_0xbc64('0x33')]:_0x3aabe5[_0xbc64('0x2f')];if(!_0x38f93c[_0xbc64('0x30')][_0xbc64('0x37')](_0xbc64('0x38'))){_0x7c038[_0xbc64('0x1e')]=qs['limit'](_0x38f93c[_0xbc64('0x30')][_0xbc64('0x1e')]);_0x7c038[_0xbc64('0x1c')]=qs[_0xbc64('0x1c')](_0x38f93c['query'][_0xbc64('0x1c')]);}_0x7c038[_0xbc64('0x39')]=qs[_0xbc64('0x3a')](_0x38f93c[_0xbc64('0x30')][_0xbc64('0x3a')]);_0x7c038['where']=qs[_0xbc64('0x32')](_[_0xbc64('0x3b')](_0x38f93c[_0xbc64('0x30')],_0x3aabe5[_0xbc64('0x32')]),_0x4ca188);if(_0x38f93c[_0xbc64('0x30')]['filter']){_0x7c038[_0xbc64('0x3c')]=_[_0xbc64('0x3d')](_0x7c038[_0xbc64('0x3c')],{'$or':_[_0xbc64('0x2b')](_0x4ca188,function(_0x5f5b5f){if(_0x5f5b5f[_0xbc64('0x3e')]!==_0xbc64('0x3f')){var _0x5d61d2={};_0x5d61d2[_0x5f5b5f[_0xbc64('0x28')]]={'$like':'%'+_0x38f93c[_0xbc64('0x30')][_0xbc64('0x40')]+'%'};return _0x5d61d2;}})});}_0x7c038=_[_0xbc64('0x3d')]({},_0x7c038,_0x38f93c['options']);var _0x339f0b={'where':_0x7c038[_0xbc64('0x3c')]};return db[_0xbc64('0x2c')][_0xbc64('0x1f')](_0x339f0b)[_0xbc64('0x24')](function(_0x513786){_0x501d40[_0xbc64('0x1f')]=_0x513786;if(_0x38f93c[_0xbc64('0x30')][_0xbc64('0x41')]){_0x7c038['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xbc64('0x42')](_0x7c038);})['then'](function(_0x155842){_0x501d40[_0xbc64('0x43')]=_0x155842;return _0x501d40;})[_0xbc64('0x24')](respondWithFilteredResult(_0x2598f3,_0x7c038))[_0xbc64('0x44')](handleError(_0x2598f3,null));};exports[_0xbc64('0x45')]=function(_0x22d757,_0x80e6cf){var _0x403111={'raw':!![],'where':{'id':_0x22d757['params']['id']}},_0xaaceb9={};_0xaaceb9[_0xbc64('0x2f')]=_[_0xbc64('0x31')](db[_0xbc64('0x2c')]['rawAttributes']);_0xaaceb9['query']=_['keys'](_0x22d757['query']);_0xaaceb9[_0xbc64('0x32')]=_['intersection'](_0xaaceb9[_0xbc64('0x2f')],_0xaaceb9[_0xbc64('0x30')]);_0x403111[_0xbc64('0x33')]=_['intersection'](_0xaaceb9['model'],qs['fields'](_0x22d757['query'][_0xbc64('0x35')]));_0x403111['attributes']=_0x403111[_0xbc64('0x33')][_0xbc64('0x36')]?_0x403111['attributes']:_0xaaceb9['model'];if(_0x22d757[_0xbc64('0x30')][_0xbc64('0x41')]){_0x403111['include']=[{'all':!![]}];}_0x403111=_[_0xbc64('0x3d')]({},_0x403111,_0x22d757[_0xbc64('0x46')]);return db[_0xbc64('0x2c')]['find'](_0x403111)['then'](handleEntityNotFound(_0x80e6cf,null))[_0xbc64('0x24')](respondWithResult(_0x80e6cf,null))[_0xbc64('0x44')](handleError(_0x80e6cf,null));};exports[_0xbc64('0x47')]=function(_0x3dc18b,_0x46f04c){return db[_0xbc64('0x2c')]['create'](_0x3dc18b[_0xbc64('0x48')],{})[_0xbc64('0x24')](respondWithResult(_0x46f04c,0xc9))[_0xbc64('0x44')](handleError(_0x46f04c,null));};exports['update']=function(_0x5682d2,_0x31ab1a){if(_0x5682d2[_0xbc64('0x48')]['id']){delete _0x5682d2[_0xbc64('0x48')]['id'];}return db[_0xbc64('0x2c')]['find']({'where':{'id':_0x5682d2[_0xbc64('0x49')]['id']}})[_0xbc64('0x24')](handleEntityNotFound(_0x31ab1a,null))[_0xbc64('0x24')](saveUpdates(_0x5682d2[_0xbc64('0x48')],null))[_0xbc64('0x24')](respondWithResult(_0x31ab1a,null))[_0xbc64('0x44')](handleError(_0x31ab1a,null));};exports[_0xbc64('0x4a')]=function(_0x2bef5d,_0x49d5e8){return db['SugarcrmField'][_0xbc64('0x4b')]({'where':{'id':_0x2bef5d[_0xbc64('0x49')]['id']}})[_0xbc64('0x24')](handleEntityNotFound(_0x49d5e8,null))[_0xbc64('0x24')](removeEntity(_0x49d5e8,null))['catch'](handleError(_0x49d5e8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c67c937..d4c6a63 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 _0x8a96=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x16c60d,_0xf81d7c){var _0x53645b=function(_0x4b9d3e){while(--_0x4b9d3e){_0x16c60d['push'](_0x16c60d['shift']());}};_0x53645b(++_0xf81d7c);}(_0x8a96,0xd2));var _0x68a9=function(_0x46d613,_0xf6aa29){_0x46d613=_0x46d613-0x0;var _0x3494e1=_0x8a96[_0x46d613];return _0x3494e1;};'use strict';var _=require(_0x68a9('0x0'));var util=require('util');var logger=require(_0x68a9('0x1'))(_0x68a9('0x2'));var moment=require(_0x68a9('0x3'));var BPromise=require(_0x68a9('0x4'));var rp=require(_0x68a9('0x5'));var fs=require('fs');var path=require(_0x68a9('0x6'));var rimraf=require(_0x68a9('0x7'));var config=require(_0x68a9('0x8'));var attributes=require(_0x68a9('0x9'));module[_0x68a9('0xa')]=function(_0x129433,_0x338a4b){return _0x129433[_0x68a9('0xb')]('SugarcrmField',attributes,{'tableName':_0x68a9('0xc'),'paranoid':![],'indexes':[{'name':_0x68a9('0xd'),'fields':[_0x68a9('0xe'),_0x68a9('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff35=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SugarcrmField'];(function(_0x1a3d8b,_0x3b8b10){var _0x437cca=function(_0x4b2fac){while(--_0x4b2fac){_0x1a3d8b['push'](_0x1a3d8b['shift']());}};_0x437cca(++_0x3b8b10);}(_0xff35,0x154));var _0x5ff3=function(_0x261675,_0x36c5e2){_0x261675=_0x261675-0x0;var _0x194b5f=_0xff35[_0x261675];return _0x194b5f;};'use strict';var _=require(_0x5ff3('0x0'));var util=require(_0x5ff3('0x1'));var logger=require(_0x5ff3('0x2'))(_0x5ff3('0x3'));var moment=require(_0x5ff3('0x4'));var BPromise=require(_0x5ff3('0x5'));var rp=require(_0x5ff3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ff3('0x7'));var config=require(_0x5ff3('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x5ff3('0x9')]=function(_0x1df27b,_0x4f5dc5){return _0x1df27b[_0x5ff3('0xa')](_0x5ff3('0xb'),attributes,{'tableName':_0x5ff3('0xc'),'paranoid':![],'indexes':[{'name':_0x5ff3('0xd'),'fields':[_0x5ff3('0xe'),_0x5ff3('0xf')],'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 3d49d92..505d755 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 _0xdd26=['http','request','then','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xdd26,0xf4));var _0x6dd2=function(_0x27b987,_0x168ecf){_0x27b987=_0x27b987-0x0;var _0x3a7f32=_0xdd26[_0x27b987];return _0x3a7f32;};'use strict';var _=require('lodash');var util=require(_0x6dd2('0x0'));var moment=require(_0x6dd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x6dd2('0x2'));var fs=require('fs');var Redis=require(_0x6dd2('0x3'));var db=require(_0x6dd2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6dd2('0x5'))('rpc');var config=require(_0x6dd2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6dd2('0x7')][_0x6dd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6063b1,_0x1534a2,_0x2b5340){return new BPromise(function(_0x2757f1,_0x3ffd23){return client[_0x6dd2('0x9')](_0x6063b1,_0x2b5340)[_0x6dd2('0xa')](function(_0x362f96){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x1534a2,_0x6dd2('0xb'));logger[_0x6dd2('0xc')](_0x6dd2('0xd'),_0x1534a2,_0x6dd2('0xb'),JSON[_0x6dd2('0xe')](_0x362f96));if(_0x362f96[_0x6dd2('0xf')]){if(_0x362f96[_0x6dd2('0xf')][_0x6dd2('0x10')]===0x1f4){logger['error'](_0x6dd2('0x11'),_0x1534a2,_0x362f96[_0x6dd2('0xf')][_0x6dd2('0x12')]);return _0x3ffd23(_0x362f96[_0x6dd2('0xf')][_0x6dd2('0x12')]);}logger[_0x6dd2('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x1534a2,_0x362f96[_0x6dd2('0xf')][_0x6dd2('0x12')]);return _0x2757f1(_0x362f96[_0x6dd2('0xf')][_0x6dd2('0x12')]);}else{logger[_0x6dd2('0x13')](_0x6dd2('0x11'),_0x1534a2,_0x6dd2('0xb'));_0x2757f1(_0x362f96['result'][_0x6dd2('0x12')]);}})[_0x6dd2('0x14')](function(_0x81a463){logger[_0x6dd2('0xf')](_0x6dd2('0x11'),_0x1534a2,_0x81a463);_0x3ffd23(_0x81a463);});});} \ No newline at end of file +var _0x5a23=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SugarcrmField,\x20%s,\x20%s','message','result','catch'];(function(_0xe1784f,_0x4a4d3e){var _0x25e8e2=function(_0x4d55ba){while(--_0x4d55ba){_0xe1784f['push'](_0xe1784f['shift']());}};_0x25e8e2(++_0x4a4d3e);}(_0x5a23,0x198));var _0x35a2=function(_0x2c7757,_0x26dda8){_0x2c7757=_0x2c7757-0x0;var _0x180111=_0x5a23[_0x2c7757];return _0x180111;};'use strict';var _=require(_0x35a2('0x0'));var util=require(_0x35a2('0x1'));var moment=require(_0x35a2('0x2'));var BPromise=require(_0x35a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35a2('0x4'));var db=require(_0x35a2('0x5'))['db'];var utils=require(_0x35a2('0x6'));var logger=require(_0x35a2('0x7'))(_0x35a2('0x8'));var config=require(_0x35a2('0x9'));var jayson=require(_0x35a2('0xa'));var client=jayson[_0x35a2('0xb')][_0x35a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x571f46,_0x556aa1,_0x5c591a){return new BPromise(function(_0x272510,_0x5ca553){return client[_0x35a2('0xd')](_0x571f46,_0x5c591a)[_0x35a2('0xe')](function(_0x207bbe){logger[_0x35a2('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x556aa1,'request\x20sent');logger['debug'](_0x35a2('0x10'),_0x556aa1,_0x35a2('0x11'),JSON[_0x35a2('0x12')](_0x207bbe));if(_0x207bbe[_0x35a2('0x13')]){if(_0x207bbe[_0x35a2('0x13')]['code']===0x1f4){logger['error'](_0x35a2('0x14'),_0x556aa1,_0x207bbe['error'][_0x35a2('0x15')]);return _0x5ca553(_0x207bbe[_0x35a2('0x13')][_0x35a2('0x15')]);}logger[_0x35a2('0x13')](_0x35a2('0x14'),_0x556aa1,_0x207bbe[_0x35a2('0x13')][_0x35a2('0x15')]);return _0x272510(_0x207bbe[_0x35a2('0x13')][_0x35a2('0x15')]);}else{logger[_0x35a2('0xf')](_0x35a2('0x14'),_0x556aa1,'request\x20sent');_0x272510(_0x207bbe[_0x35a2('0x16')]['message']);}})[_0x35a2('0x17')](function(_0x240f43){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x556aa1,_0x240f43);_0x5ca553(_0x240f43);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 786424a..5e2d713 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 _0x6453=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','delete','destroy','multer','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6453,0x88));var _0x3645=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x6453[_0x1bfe2b];return _0x1477d4;};'use strict';var multer=require(_0x3645('0x0'));var util=require(_0x3645('0x1'));var path=require('path');var timeout=require(_0x3645('0x2'));var express=require(_0x3645('0x3'));var router=express[_0x3645('0x4')]();var fs_extra=require(_0x3645('0x5'));var auth=require(_0x3645('0x6'));var interaction=require(_0x3645('0x7'));var config=require(_0x3645('0x8'));var controller=require(_0x3645('0x9'));router[_0x3645('0xa')]('/',auth[_0x3645('0xb')](),controller[_0x3645('0xc')]);router[_0x3645('0xa')](_0x3645('0xd'),auth[_0x3645('0xb')](),controller[_0x3645('0xe')]);router[_0x3645('0xa')](_0x3645('0xf'),auth[_0x3645('0xb')](),controller[_0x3645('0x10')]);router[_0x3645('0xa')](_0x3645('0x11'),auth[_0x3645('0xb')](),controller['getFields']);router[_0x3645('0x12')]('/',auth[_0x3645('0xb')](),controller[_0x3645('0x13')]);router['post'](_0x3645('0xf'),auth[_0x3645('0xb')](),controller[_0x3645('0x14')]);router['put'](_0x3645('0xd'),auth[_0x3645('0xb')](),controller['update']);router[_0x3645('0x15')](_0x3645('0xd'),auth[_0x3645('0xb')](),controller[_0x3645('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1159=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','post','create','addConfiguration','put','update','delete'];(function(_0x6fda4c,_0x10ab5f){var _0x284923=function(_0x178cdd){while(--_0x178cdd){_0x6fda4c['push'](_0x6fda4c['shift']());}};_0x284923(++_0x10ab5f);}(_0x1159,0xf3));var _0x9115=function(_0x1ad770,_0x42ad4a){_0x1ad770=_0x1ad770-0x0;var _0x30e2a3=_0x1159[_0x1ad770];return _0x30e2a3;};'use strict';var multer=require(_0x9115('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9115('0x1'));var express=require(_0x9115('0x2'));var router=express[_0x9115('0x3')]();var fs_extra=require(_0x9115('0x4'));var auth=require(_0x9115('0x5'));var interaction=require(_0x9115('0x6'));var config=require(_0x9115('0x7'));var controller=require(_0x9115('0x8'));router['get']('/',auth[_0x9115('0x9')](),controller[_0x9115('0xa')]);router[_0x9115('0xb')](_0x9115('0xc'),auth[_0x9115('0x9')](),controller[_0x9115('0xd')]);router[_0x9115('0xb')]('/:id/configurations',auth[_0x9115('0x9')](),controller[_0x9115('0xe')]);router['get']('/:id/fields',auth[_0x9115('0x9')](),controller['getFields']);router[_0x9115('0xf')]('/',auth[_0x9115('0x9')](),controller[_0x9115('0x10')]);router[_0x9115('0xf')]('/:id/configurations',auth[_0x9115('0x9')](),controller[_0x9115('0x11')]);router[_0x9115('0x12')](_0x9115('0xc'),auth[_0x9115('0x9')](),controller[_0x9115('0x13')]);router[_0x9115('0x14')](_0x9115('0xc'),auth[_0x9115('0x9')](),controller['destroy']);module[_0x9115('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index cfb5763..e2f009c 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 _0x6bb4=['STRING','sequelize'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x6bb4,0xd9));var _0x46bb=function(_0x4a0012,_0x18114f){_0x4a0012=_0x4a0012-0x0;var _0x539013=_0x6bb4[_0x4a0012];return _0x539013;};'use strict';var Sequelize=require(_0x46bb('0x0'));module['exports']={'name':{'type':Sequelize[_0x46bb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x46bb('0x1')]},'username':{'type':Sequelize[_0x46bb('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x46bb('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x46bb('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x46bb('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xdbf5=['sequelize','STRING','HelpDesk'];(function(_0xf81382,_0x3a2565){var _0x36dbfa=function(_0x3cb5d0){while(--_0x3cb5d0){_0xf81382['push'](_0xf81382['shift']());}};_0x36dbfa(++_0x3a2565);}(_0xdbf5,0x159));var _0x5dbf=function(_0x11d48e,_0x21a582){_0x11d48e=_0x11d48e-0x0;var _0x41ff1a=_0xdbf5[_0x11d48e];return _0x41ff1a;};'use strict';var Sequelize=require(_0x5dbf('0x0'));module['exports']={'name':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5dbf('0x1')]},'username':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![],'defaultValue':_0x5dbf('0x2')},'remoteUri':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 7aef935..2950b39 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 _0x4863=['includes','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','mustache','path','sox','to-csv','ejs','lodash','crypto','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','apply','reject','save','update','destroy','then','error','stack','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','find','create','body','findOne','VtigerConfiguration','options','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','sessionName','reference','owner','remove'];(function(_0x43f13b,_0x1f319e){var _0x5cc313=function(_0x2cbef2){while(--_0x2cbef2){_0x43f13b['push'](_0x43f13b['shift']());}};_0x5cc313(++_0x1f319e);}(_0x4863,0x1e7));var _0x3486=function(_0x49cbf6,_0x452dc1){_0x49cbf6=_0x49cbf6-0x0;var _0x7d90ef=_0x4863[_0x49cbf6];return _0x7d90ef;};'use strict';var emlformat=require(_0x3486('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3486('0x1'));var util=require('util');var path=require(_0x3486('0x2'));var sox=require(_0x3486('0x3'));var csv=require(_0x3486('0x4'));var ejs=require(_0x3486('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3486('0x6'));var squel=require('squel');var crypto=require(_0x3486('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3486('0x4'));var querystring=require(_0x3486('0x8'));var Papa=require(_0x3486('0x9'));var Redis=require(_0x3486('0xa'));var authService=require(_0x3486('0xb'));var qs=require(_0x3486('0xc'));var as=require(_0x3486('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3486('0xe'))(_0x3486('0xf'));var utils=require('../../config/utils');var config=require(_0x3486('0x10'));var licenseUtil=require(_0x3486('0x11'));var db=require(_0x3486('0x12'))['db'];var integrations=require(_0x3486('0x13'));function respondWithStatusCode(_0x2d5b53,_0x2e1568){_0x2e1568=_0x2e1568||0xcc;return function(_0x3639cd){if(_0x3639cd){return _0x2d5b53[_0x3486('0x14')](_0x2e1568);}return _0x2d5b53[_0x3486('0x15')](_0x2e1568)[_0x3486('0x16')]();};}function respondWithResult(_0x42064e,_0x24b2bc){_0x24b2bc=_0x24b2bc||0xc8;return function(_0x565d9f){if(_0x565d9f){return _0x42064e[_0x3486('0x15')](_0x24b2bc)[_0x3486('0x17')](_0x565d9f);}};}function respondWithFilteredResult(_0x5ed9ac,_0x4f892c){return function(_0x224caa){if(_0x224caa){var _0xfa51e8=typeof _0x4f892c[_0x3486('0x18')]===_0x3486('0x19')&&typeof _0x4f892c[_0x3486('0x1a')]===_0x3486('0x19');var _0x27ba1f=_0x224caa[_0x3486('0x1b')];var _0x59fc0b=_0xfa51e8?0x0:_0x4f892c[_0x3486('0x18')];var _0x5ee65d=_0xfa51e8?_0x224caa[_0x3486('0x1b')]:_0x4f892c[_0x3486('0x18')]+_0x4f892c[_0x3486('0x1a')];var _0x189800;if(_0x5ee65d>=_0x27ba1f){_0x5ee65d=_0x27ba1f;_0x189800=0xc8;}else{_0x189800=0xce;}_0x5ed9ac[_0x3486('0x15')](_0x189800);return _0x5ed9ac['set']('Content-Range',_0x59fc0b+'-'+_0x5ee65d+'/'+_0x27ba1f)[_0x3486('0x17')](_0x224caa);}return null;};}function patchUpdates(_0x46c910){return function(_0x5ae94b){try{jsonpatch[_0x3486('0x1c')](_0x5ae94b,_0x46c910,!![]);}catch(_0x32f4be){return BPromise[_0x3486('0x1d')](_0x32f4be);}return _0x5ae94b[_0x3486('0x1e')]();};}function saveUpdates(_0x4afe2a,_0x3d8514){return function(_0x4aaf15){if(_0x4aaf15){return _0x4aaf15[_0x3486('0x1f')](_0x4afe2a)['then'](function(_0x41a394){return _0x41a394;});}return null;};}function removeEntity(_0x5c8c77,_0x3f9618){return function(_0xc80c9e){if(_0xc80c9e){return _0xc80c9e[_0x3486('0x20')]()[_0x3486('0x21')](function(){_0x5c8c77[_0x3486('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3250e2,_0x1c8e2c){return function(_0x273f82){if(!_0x273f82){_0x3250e2[_0x3486('0x14')](0x194);}return _0x273f82;};}function handleError(_0x2db2de,_0x108b2e){_0x108b2e=_0x108b2e||0x1f4;return function(_0xe44da9){logger[_0x3486('0x22')](_0xe44da9[_0x3486('0x23')]);if(_0xe44da9['name']){delete _0xe44da9['name'];}_0x2db2de[_0x3486('0x15')](_0x108b2e)[_0x3486('0x24')](_0xe44da9);};}exports[_0x3486('0x25')]=function(_0x4286c7,_0x41cc6d){var _0x1a2217={},_0x6f3417={},_0x390990={'count':0x0,'rows':[]};var _0x3e0dc6=_[_0x3486('0x26')](db[_0x3486('0x27')][_0x3486('0x28')],function(_0x3aaa3e){return{'name':_0x3aaa3e[_0x3486('0x29')],'type':_0x3aaa3e[_0x3486('0x2a')][_0x3486('0x2b')]};});_0x6f3417[_0x3486('0x2c')]=_['map'](_0x3e0dc6,_0x3486('0x2d'));_0x6f3417[_0x3486('0x2e')]=_['keys'](_0x4286c7[_0x3486('0x2e')]);_0x6f3417[_0x3486('0x2f')]=_['intersection'](_0x6f3417[_0x3486('0x2c')],_0x6f3417[_0x3486('0x2e')]);_0x1a2217[_0x3486('0x30')]=_[_0x3486('0x31')](_0x6f3417[_0x3486('0x2c')],qs[_0x3486('0x32')](_0x4286c7[_0x3486('0x2e')][_0x3486('0x32')]));_0x1a2217[_0x3486('0x30')]=_0x1a2217['attributes'][_0x3486('0x33')]?_0x1a2217[_0x3486('0x30')]:_0x6f3417[_0x3486('0x2c')];if(!_0x4286c7['query']['hasOwnProperty'](_0x3486('0x34'))){_0x1a2217[_0x3486('0x1a')]=qs[_0x3486('0x1a')](_0x4286c7[_0x3486('0x2e')]['limit']);_0x1a2217[_0x3486('0x18')]=qs[_0x3486('0x18')](_0x4286c7[_0x3486('0x2e')][_0x3486('0x18')]);}_0x1a2217[_0x3486('0x35')]=qs[_0x3486('0x36')](_0x4286c7[_0x3486('0x2e')][_0x3486('0x36')]);_0x1a2217[_0x3486('0x37')]=qs[_0x3486('0x2f')](_[_0x3486('0x38')](_0x4286c7['query'],_0x6f3417[_0x3486('0x2f')]),_0x3e0dc6);if(_0x4286c7[_0x3486('0x2e')][_0x3486('0x39')]){_0x1a2217[_0x3486('0x37')]=_[_0x3486('0x3a')](_0x1a2217[_0x3486('0x37')],{'$or':_['map'](_0x3e0dc6,function(_0x2643aa){if(_0x2643aa[_0x3486('0x2a')]!==_0x3486('0x3b')){var _0x1db61a={};_0x1db61a[_0x2643aa[_0x3486('0x2d')]]={'$like':'%'+_0x4286c7[_0x3486('0x2e')][_0x3486('0x39')]+'%'};return _0x1db61a;}})});}_0x1a2217=_[_0x3486('0x3a')]({},_0x1a2217,_0x4286c7['options']);var _0x107a11={'where':_0x1a2217[_0x3486('0x37')]};return db['VtigerAccount'][_0x3486('0x1b')](_0x107a11)[_0x3486('0x21')](function(_0x5be9aa){_0x390990[_0x3486('0x1b')]=_0x5be9aa;if(_0x4286c7[_0x3486('0x2e')][_0x3486('0x3c')]){_0x1a2217[_0x3486('0x3d')]=[{'all':!![]}];}return db[_0x3486('0x27')]['findAll'](_0x1a2217);})['then'](function(_0x37dafd){_0x390990[_0x3486('0x3e')]=_0x37dafd;return _0x390990;})['then'](respondWithFilteredResult(_0x41cc6d,_0x1a2217))[_0x3486('0x3f')](handleError(_0x41cc6d,null));};exports[_0x3486('0x40')]=function(_0x1c62e2,_0x479f6a){var _0x1ff7cd={'raw':![],'where':{'id':_0x1c62e2[_0x3486('0x41')]['id']}},_0x396a0d={};_0x396a0d[_0x3486('0x2c')]=_[_0x3486('0x42')](db[_0x3486('0x27')]['rawAttributes']);_0x396a0d[_0x3486('0x2e')]=_[_0x3486('0x42')](_0x1c62e2[_0x3486('0x2e')]);_0x396a0d[_0x3486('0x2f')]=_[_0x3486('0x31')](_0x396a0d[_0x3486('0x2c')],_0x396a0d[_0x3486('0x2e')]);_0x1ff7cd[_0x3486('0x30')]=_[_0x3486('0x31')](_0x396a0d[_0x3486('0x2c')],qs[_0x3486('0x32')](_0x1c62e2[_0x3486('0x2e')][_0x3486('0x32')]));_0x1ff7cd[_0x3486('0x30')]=_0x1ff7cd[_0x3486('0x30')][_0x3486('0x33')]?_0x1ff7cd['attributes']:_0x396a0d['model'];if(_0x1c62e2[_0x3486('0x2e')][_0x3486('0x3c')]){_0x1ff7cd[_0x3486('0x3d')]=[{'all':!![]}];}_0x1ff7cd=_[_0x3486('0x3a')]({},_0x1ff7cd,_0x1c62e2['options']);return db['VtigerAccount'][_0x3486('0x43')](_0x1ff7cd)[_0x3486('0x21')](handleEntityNotFound(_0x479f6a,null))[_0x3486('0x21')](respondWithResult(_0x479f6a,null))['catch'](handleError(_0x479f6a,null));};exports[_0x3486('0x44')]=function(_0x401140,_0x47b3c9){return db[_0x3486('0x27')]['create'](_0x401140[_0x3486('0x45')],{})[_0x3486('0x21')](respondWithResult(_0x47b3c9,0xc9))[_0x3486('0x3f')](handleError(_0x47b3c9,null));};exports[_0x3486('0x1f')]=function(_0x300800,_0x237d1f){if(_0x300800[_0x3486('0x45')]['id']){delete _0x300800[_0x3486('0x45')]['id'];}return db[_0x3486('0x27')]['find']({'where':{'id':_0x300800[_0x3486('0x41')]['id']}})[_0x3486('0x21')](handleEntityNotFound(_0x237d1f,null))[_0x3486('0x21')](saveUpdates(_0x300800[_0x3486('0x45')],null))['then'](respondWithResult(_0x237d1f,null))['catch'](handleError(_0x237d1f,null));};exports[_0x3486('0x20')]=function(_0xc17afb,_0x1dd0fd){return db[_0x3486('0x27')]['find']({'where':{'id':_0xc17afb[_0x3486('0x41')]['id']}})[_0x3486('0x21')](handleEntityNotFound(_0x1dd0fd,null))[_0x3486('0x21')](removeEntity(_0x1dd0fd,null))[_0x3486('0x3f')](handleError(_0x1dd0fd,null));};exports['getConfigurations']=function(_0x4395b7,_0x42795d,_0x192c3d){var _0x528c17={};var _0xa4d57e={};var _0x4e89d2;var _0x33ef6e;return db[_0x3486('0x27')][_0x3486('0x46')]({'where':{'id':_0x4395b7[_0x3486('0x41')]['id']}})[_0x3486('0x21')](handleEntityNotFound(_0x42795d,null))[_0x3486('0x21')](function(_0xf7afde){if(_0xf7afde){_0x4e89d2=_0xf7afde;_0xa4d57e[_0x3486('0x2c')]=_[_0x3486('0x42')](db[_0x3486('0x47')][_0x3486('0x28')]);_0xa4d57e[_0x3486('0x2e')]=_[_0x3486('0x42')](_0x4395b7[_0x3486('0x2e')]);_0xa4d57e[_0x3486('0x2f')]=_[_0x3486('0x31')](_0xa4d57e[_0x3486('0x2c')],_0xa4d57e['query']);_0x528c17[_0x3486('0x30')]=_[_0x3486('0x31')](_0xa4d57e['model'],qs[_0x3486('0x32')](_0x4395b7['query'][_0x3486('0x32')]));_0x528c17['attributes']=_0x528c17[_0x3486('0x30')]['length']?_0x528c17[_0x3486('0x30')]:_0xa4d57e[_0x3486('0x2c')];_0x528c17[_0x3486('0x35')]=qs[_0x3486('0x36')](_0x4395b7[_0x3486('0x2e')][_0x3486('0x36')]);_0x528c17[_0x3486('0x37')]=qs['filters'](_['pick'](_0x4395b7[_0x3486('0x2e')],_0xa4d57e['filters']));if(_0x4395b7['query'][_0x3486('0x39')]){_0x528c17['where']=_[_0x3486('0x3a')](_0x528c17[_0x3486('0x37')],{'$or':_['map'](_0x528c17[_0x3486('0x30')],function(_0x15ab57){var _0x237c90={};_0x237c90[_0x15ab57]={'$like':'%'+_0x4395b7[_0x3486('0x2e')][_0x3486('0x39')]+'%'};return _0x237c90;})});}_0x528c17=_['merge']({},_0x528c17,_0x4395b7[_0x3486('0x48')]);return _0x4e89d2[_0x3486('0x49')](_0x528c17);}})['then'](function(_0x4c8ea2){if(_0x4c8ea2){_0x33ef6e=_0x4c8ea2['length'];if(!_0x4395b7['query'][_0x3486('0x4a')](_0x3486('0x34'))){_0x528c17['limit']=qs[_0x3486('0x1a')](_0x4395b7[_0x3486('0x2e')]['limit']);_0x528c17[_0x3486('0x18')]=qs[_0x3486('0x18')](_0x4395b7[_0x3486('0x2e')][_0x3486('0x18')]);}return _0x4e89d2['getConfigurations'](_0x528c17);}})[_0x3486('0x21')](function(_0x351665){if(_0x351665){return _0x351665?{'count':_0x33ef6e,'rows':_0x351665}:null;}})[_0x3486('0x21')](respondWithResult(_0x42795d,null))[_0x3486('0x3f')](handleError(_0x42795d,null));};exports[_0x3486('0x4b')]=function(_0x120d4b,_0x2bc6c9,_0x194c7d){if(_0x120d4b['body']['id']){delete _0x120d4b['body']['id'];}return db[_0x3486('0x27')][_0x3486('0x46')]({'where':{'id':_0x120d4b['params']['id']}})[_0x3486('0x21')](handleEntityNotFound(_0x2bc6c9,null))['then'](function(_0x2aa5d9){if(_0x2aa5d9){_0x120d4b[_0x3486('0x45')][_0x3486('0x4c')]=_0x2aa5d9['id'];_0x120d4b[_0x3486('0x45')][_0x3486('0x4d')]=integrations['getSubjects'](_0x120d4b[_0x3486('0x45')][_0x3486('0x4e')],_0x120d4b[_0x3486('0x45')][_0x3486('0x2a')]);_0x120d4b['body'][_0x3486('0x4f')]=integrations[_0x3486('0x50')](_0x120d4b[_0x3486('0x45')]['channel'],_0x120d4b[_0x3486('0x45')][_0x3486('0x2a')]);return db['VtigerConfiguration'][_0x3486('0x44')](_0x120d4b[_0x3486('0x45')],{'include':[{'model':db[_0x3486('0x51')],'as':_0x3486('0x4d')},{'model':db[_0x3486('0x51')],'as':_0x3486('0x4f')}]});}return null;})[_0x3486('0x21')](respondWithResult(_0x2bc6c9,null))['catch'](handleError(_0x2bc6c9,null));};var md5=require('md5');exports[_0x3486('0x52')]=function(_0x280e5d,_0x5ce9ea,_0x3d6f89){var _0x2d50a5=null;var _0xf1d41c=null;var _0x45108f=null;var _0x279ed1=null;var _0x1b1057='';return db[_0x3486('0x27')]['findOne']({'where':{'id':_0x280e5d[_0x3486('0x41')]['id']},'attributes':['id',_0x3486('0x2d'),_0x3486('0x53'),_0x3486('0x54'),_0x3486('0x55'),_0x3486('0x56'),'serverUrl','accessKey']})['then'](handleEntityNotFound(_0x5ce9ea,null))[_0x3486('0x21')](function(_0x108643){if(_0x108643){_0x2d50a5=_0x108643[_0x3486('0x53')];_0xf1d41c=_0x108643[_0x3486('0x57')];_0x45108f=_0x108643[_0x3486('0x55')];_0x1b1057=_0x108643[_0x3486('0x56')];var _0x1fa354=_0x1b1057[_0x3486('0x58')](-0x1);if(_0x1fa354==='/'){_0x1b1057=_0x1b1057[_0x3486('0x59')](0x0,_0x1b1057[_0x3486('0x5a')](_0x1fa354));}_0x279ed1=util[_0x3486('0x5b')](_0x3486('0x5c'),_0x1b1057);var _0x2ac270={'method':_0x3486('0x5d'),'uri':_0x279ed1,'qs':{'operation':_0x3486('0x5e'),'username':_0x108643[_0x3486('0x53')]},'json':!![]};return rp(_0x2ac270);}})[_0x3486('0x21')](function(_0x41794c){if(_0x41794c[_0x3486('0x5f')]){var _0x129815={'method':_0x3486('0x60'),'uri':_0x279ed1,'form':{'operation':_0x3486('0x61'),'username':_0x2d50a5,'accessKey':md5(_0x41794c[_0x3486('0x62')]['token']+_0xf1d41c)},'json':!![]};return rp(_0x129815);}})[_0x3486('0x21')](function(_0x5be23a){if(_0x5be23a[_0x3486('0x5f')]){var _0x47318e={'method':'GET','uri':_0x279ed1,'qs':{'operation':'describe','username':_0x2d50a5,'sessionName':_0x5be23a[_0x3486('0x62')][_0x3486('0x63')],'elementType':_0x45108f},'json':!![]};return rp(_0x47318e);}})[_0x3486('0x21')](function(_0x55001c){if(_0x55001c[_0x3486('0x5f')]){var _0x256735=['autogenerated',_0x3486('0x64'),_0x3486('0x65')];_[_0x3486('0x66')](_0x55001c[_0x3486('0x62')]['fields'],function(_0x2e004a){return _0x256735[_0x3486('0x67')](_0x2e004a[_0x3486('0x2a')][_0x3486('0x2d')]);});_[_0x3486('0x66')](_0x55001c[_0x3486('0x62')][_0x3486('0x32')],function(_0x150c4a){return _0x150c4a[_0x3486('0x68')]===_0x3486('0x69');});return{'count':_0x55001c[_0x3486('0x62')][_0x3486('0x32')][_0x3486('0x33')],'rows':_[_0x3486('0x26')](_0x55001c['result']['fields'],function(_0x1a020a){return{'id':_0x1a020a[_0x3486('0x2d')],'name':_0x1a020a[_0x3486('0x6a')],'custom':_[_0x3486('0x6b')](_0x1a020a[_0x3486('0x2d')],_0x3486('0x6c'))?!![]:![],'options':_0x1a020a[_0x3486('0x2a')][_0x3486('0x2d')]==='picklist'&&_0x1a020a[_0x3486('0x2a')][_0x3486('0x6d')][_0x3486('0x33')]>0x0?_[_0x3486('0x26')](_0x1a020a[_0x3486('0x2a')]['picklistValues'],function(_0x2be8a3){return{'name':_0x2be8a3[_0x3486('0x6a')],'value':_0x2be8a3[_0x3486('0x6e')]};}):[]};})};}})['then'](respondWithResult(_0x5ce9ea,null))[_0x3486('0x3f')](function(_0x2fc8f5){console[_0x3486('0x6f')](_0x3486('0x70')+_0x2fc8f5);var _0x11a607=_0x280e5d['query'][_0x3486('0x71')]?0x1f4:_0x2fc8f5[_0x3486('0x72')]||0x1f4;logger[_0x3486('0x22')](_0x3486('0x73'),_0x3486('0x52'),_0x11a607,JSON[_0x3486('0x74')](_0x2fc8f5));delete _0x2fc8f5[_0x3486('0x2d')];if(_0x11a607===0x191){_0x11a607=0x190;}_0x5ce9ea['status'](_0x11a607)[_0x3486('0x24')](_0x280e5d['query'][_0x3486('0x71')]?{'message':_0x3486('0x75'),'statusCode':_0x2fc8f5['statusCode']}:_0x2fc8f5);});}; \ No newline at end of file +var _0xffa5=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','save','update','then','end','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','sort','AccountId','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','username','description','moduleName','accessKey','remoteUri','slice','substring','%s/webservice.php','GET','getchallenge','success','result','sessionName','autogenerated','reference','owner','remove','false','label','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xffa5,0x6a));var _0x5ffa=function(_0x48df2e,_0x35e5a2){_0x48df2e=_0x48df2e-0x0;var _0x810007=_0xffa5[_0x48df2e];return _0x810007;};'use strict';var emlformat=require(_0x5ffa('0x0'));var rimraf=require(_0x5ffa('0x1'));var zipdir=require(_0x5ffa('0x2'));var jsonpatch=require(_0x5ffa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ffa('0x4'));var Mustache=require(_0x5ffa('0x5'));var util=require('util');var path=require(_0x5ffa('0x6'));var sox=require(_0x5ffa('0x7'));var csv=require('to-csv');var ejs=require(_0x5ffa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ffa('0x9'));var squel=require(_0x5ffa('0xa'));var crypto=require(_0x5ffa('0xb'));var jsforce=require(_0x5ffa('0xc'));var deskjs=require(_0x5ffa('0xd'));var toCsv=require(_0x5ffa('0xe'));var querystring=require(_0x5ffa('0xf'));var Papa=require(_0x5ffa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5ffa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ffa('0x12'))(_0x5ffa('0x13'));var utils=require(_0x5ffa('0x14'));var config=require(_0x5ffa('0x15'));var licenseUtil=require(_0x5ffa('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5ffa('0x17'));function respondWithStatusCode(_0x4a903e,_0x49467b){_0x49467b=_0x49467b||0xcc;return function(_0x8bff4e){if(_0x8bff4e){return _0x4a903e[_0x5ffa('0x18')](_0x49467b);}return _0x4a903e[_0x5ffa('0x19')](_0x49467b)['end']();};}function respondWithResult(_0x24a7de,_0x44d13f){_0x44d13f=_0x44d13f||0xc8;return function(_0x594923){if(_0x594923){return _0x24a7de[_0x5ffa('0x19')](_0x44d13f)['json'](_0x594923);}};}function respondWithFilteredResult(_0x26beb2,_0x3dc1ff){return function(_0xd2f8f0){if(_0xd2f8f0){var _0x17b83e=typeof _0x3dc1ff[_0x5ffa('0x1a')]===_0x5ffa('0x1b')&&typeof _0x3dc1ff[_0x5ffa('0x1c')]===_0x5ffa('0x1b');var _0x33ca9a=_0xd2f8f0['count'];var _0x579027=_0x17b83e?0x0:_0x3dc1ff[_0x5ffa('0x1a')];var _0x3d9625=_0x17b83e?_0xd2f8f0[_0x5ffa('0x1d')]:_0x3dc1ff[_0x5ffa('0x1a')]+_0x3dc1ff[_0x5ffa('0x1c')];var _0x514fab;if(_0x3d9625>=_0x33ca9a){_0x3d9625=_0x33ca9a;_0x514fab=0xc8;}else{_0x514fab=0xce;}_0x26beb2[_0x5ffa('0x19')](_0x514fab);return _0x26beb2[_0x5ffa('0x1e')]('Content-Range',_0x579027+'-'+_0x3d9625+'/'+_0x33ca9a)[_0x5ffa('0x1f')](_0xd2f8f0);}return null;};}function patchUpdates(_0xb33e81){return function(_0x75154e){try{jsonpatch[_0x5ffa('0x20')](_0x75154e,_0xb33e81,!![]);}catch(_0xaaab3b){return BPromise['reject'](_0xaaab3b);}return _0x75154e[_0x5ffa('0x21')]();};}function saveUpdates(_0x35a924,_0x2baa81){return function(_0x4d96dc){if(_0x4d96dc){return _0x4d96dc[_0x5ffa('0x22')](_0x35a924)[_0x5ffa('0x23')](function(_0x4067db){return _0x4067db;});}return null;};}function removeEntity(_0x4171b4,_0x326fea){return function(_0xdafbbc){if(_0xdafbbc){return _0xdafbbc['destroy']()[_0x5ffa('0x23')](function(){_0x4171b4[_0x5ffa('0x19')](0xcc)[_0x5ffa('0x24')]();});}};}function handleEntityNotFound(_0x4f2397,_0xaca77a){return function(_0x2f31b8){if(!_0x2f31b8){_0x4f2397['sendStatus'](0x194);}return _0x2f31b8;};}function handleError(_0x43e155,_0x48d77d){_0x48d77d=_0x48d77d||0x1f4;return function(_0x46af6){logger[_0x5ffa('0x25')](_0x46af6['stack']);if(_0x46af6[_0x5ffa('0x26')]){delete _0x46af6[_0x5ffa('0x26')];}_0x43e155['status'](_0x48d77d)[_0x5ffa('0x27')](_0x46af6);};}exports[_0x5ffa('0x28')]=function(_0x267db5,_0x1edcfd){var _0x2df6db={},_0x2fb658={},_0x42d5ab={'count':0x0,'rows':[]};var _0x371bf3=_[_0x5ffa('0x29')](db[_0x5ffa('0x2a')][_0x5ffa('0x2b')],function(_0x24fd6f){return{'name':_0x24fd6f[_0x5ffa('0x2c')],'type':_0x24fd6f[_0x5ffa('0x2d')][_0x5ffa('0x2e')]};});_0x2fb658['model']=_[_0x5ffa('0x29')](_0x371bf3,'name');_0x2fb658[_0x5ffa('0x2f')]=_[_0x5ffa('0x30')](_0x267db5[_0x5ffa('0x2f')]);_0x2fb658['filters']=_['intersection'](_0x2fb658['model'],_0x2fb658[_0x5ffa('0x2f')]);_0x2df6db[_0x5ffa('0x31')]=_[_0x5ffa('0x32')](_0x2fb658[_0x5ffa('0x33')],qs[_0x5ffa('0x34')](_0x267db5['query'][_0x5ffa('0x34')]));_0x2df6db[_0x5ffa('0x31')]=_0x2df6db[_0x5ffa('0x31')][_0x5ffa('0x35')]?_0x2df6db[_0x5ffa('0x31')]:_0x2fb658[_0x5ffa('0x33')];if(!_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x36')](_0x5ffa('0x37'))){_0x2df6db['limit']=qs[_0x5ffa('0x1c')](_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x1c')]);_0x2df6db['offset']=qs['offset'](_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x1a')]);}_0x2df6db[_0x5ffa('0x38')]=qs['sort'](_0x267db5[_0x5ffa('0x2f')]['sort']);_0x2df6db[_0x5ffa('0x39')]=qs['filters'](_[_0x5ffa('0x3a')](_0x267db5['query'],_0x2fb658[_0x5ffa('0x3b')]),_0x371bf3);if(_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x3c')]){_0x2df6db[_0x5ffa('0x39')]=_[_0x5ffa('0x3d')](_0x2df6db[_0x5ffa('0x39')],{'$or':_['map'](_0x371bf3,function(_0x3faae1){if(_0x3faae1[_0x5ffa('0x2d')]!==_0x5ffa('0x3e')){var _0x3d9e14={};_0x3d9e14[_0x3faae1[_0x5ffa('0x26')]]={'$like':'%'+_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x3c')]+'%'};return _0x3d9e14;}})});}_0x2df6db=_['merge']({},_0x2df6db,_0x267db5[_0x5ffa('0x3f')]);var _0x4a9e4a={'where':_0x2df6db[_0x5ffa('0x39')]};return db[_0x5ffa('0x2a')][_0x5ffa('0x1d')](_0x4a9e4a)[_0x5ffa('0x23')](function(_0x46b2d3){_0x42d5ab['count']=_0x46b2d3;if(_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x40')]){_0x2df6db[_0x5ffa('0x41')]=[{'all':!![]}];}return db[_0x5ffa('0x2a')][_0x5ffa('0x42')](_0x2df6db);})[_0x5ffa('0x23')](function(_0x22449d){_0x42d5ab[_0x5ffa('0x43')]=_0x22449d;return _0x42d5ab;})['then'](respondWithFilteredResult(_0x1edcfd,_0x2df6db))[_0x5ffa('0x44')](handleError(_0x1edcfd,null));};exports[_0x5ffa('0x45')]=function(_0x1e3cbe,_0xbded96){var _0x168848={'raw':![],'where':{'id':_0x1e3cbe[_0x5ffa('0x46')]['id']}},_0x4bbcbd={};_0x4bbcbd[_0x5ffa('0x33')]=_[_0x5ffa('0x30')](db[_0x5ffa('0x2a')][_0x5ffa('0x2b')]);_0x4bbcbd[_0x5ffa('0x2f')]=_[_0x5ffa('0x30')](_0x1e3cbe[_0x5ffa('0x2f')]);_0x4bbcbd[_0x5ffa('0x3b')]=_[_0x5ffa('0x32')](_0x4bbcbd[_0x5ffa('0x33')],_0x4bbcbd['query']);_0x168848['attributes']=_[_0x5ffa('0x32')](_0x4bbcbd[_0x5ffa('0x33')],qs[_0x5ffa('0x34')](_0x1e3cbe['query'][_0x5ffa('0x34')]));_0x168848['attributes']=_0x168848[_0x5ffa('0x31')][_0x5ffa('0x35')]?_0x168848[_0x5ffa('0x31')]:_0x4bbcbd['model'];if(_0x1e3cbe[_0x5ffa('0x2f')][_0x5ffa('0x40')]){_0x168848['include']=[{'all':!![]}];}_0x168848=_[_0x5ffa('0x3d')]({},_0x168848,_0x1e3cbe['options']);return db[_0x5ffa('0x2a')][_0x5ffa('0x47')](_0x168848)[_0x5ffa('0x23')](handleEntityNotFound(_0xbded96,null))[_0x5ffa('0x23')](respondWithResult(_0xbded96,null))['catch'](handleError(_0xbded96,null));};exports[_0x5ffa('0x48')]=function(_0x53f2b9,_0x438387){return db[_0x5ffa('0x2a')]['create'](_0x53f2b9[_0x5ffa('0x49')],{})[_0x5ffa('0x23')](respondWithResult(_0x438387,0xc9))[_0x5ffa('0x44')](handleError(_0x438387,null));};exports[_0x5ffa('0x22')]=function(_0x442ba8,_0x5389ca){if(_0x442ba8[_0x5ffa('0x49')]['id']){delete _0x442ba8['body']['id'];}return db[_0x5ffa('0x2a')][_0x5ffa('0x47')]({'where':{'id':_0x442ba8[_0x5ffa('0x46')]['id']}})[_0x5ffa('0x23')](handleEntityNotFound(_0x5389ca,null))[_0x5ffa('0x23')](saveUpdates(_0x442ba8[_0x5ffa('0x49')],null))['then'](respondWithResult(_0x5389ca,null))[_0x5ffa('0x44')](handleError(_0x5389ca,null));};exports[_0x5ffa('0x4a')]=function(_0x1653d5,_0x365c91){return db[_0x5ffa('0x2a')][_0x5ffa('0x47')]({'where':{'id':_0x1653d5[_0x5ffa('0x46')]['id']}})[_0x5ffa('0x23')](handleEntityNotFound(_0x365c91,null))[_0x5ffa('0x23')](removeEntity(_0x365c91,null))[_0x5ffa('0x44')](handleError(_0x365c91,null));};exports[_0x5ffa('0x4b')]=function(_0x368ce9,_0x1680cf,_0x464921){var _0x8fa851={};var _0x125c0d={};var _0x52c44b;var _0x25cc77;return db[_0x5ffa('0x2a')][_0x5ffa('0x4c')]({'where':{'id':_0x368ce9[_0x5ffa('0x46')]['id']}})['then'](handleEntityNotFound(_0x1680cf,null))[_0x5ffa('0x23')](function(_0x5d1ace){if(_0x5d1ace){_0x52c44b=_0x5d1ace;_0x125c0d[_0x5ffa('0x33')]=_['keys'](db['VtigerConfiguration'][_0x5ffa('0x2b')]);_0x125c0d['query']=_[_0x5ffa('0x30')](_0x368ce9[_0x5ffa('0x2f')]);_0x125c0d[_0x5ffa('0x3b')]=_['intersection'](_0x125c0d['model'],_0x125c0d[_0x5ffa('0x2f')]);_0x8fa851[_0x5ffa('0x31')]=_[_0x5ffa('0x32')](_0x125c0d['model'],qs[_0x5ffa('0x34')](_0x368ce9[_0x5ffa('0x2f')][_0x5ffa('0x34')]));_0x8fa851[_0x5ffa('0x31')]=_0x8fa851['attributes'][_0x5ffa('0x35')]?_0x8fa851['attributes']:_0x125c0d[_0x5ffa('0x33')];_0x8fa851[_0x5ffa('0x38')]=qs[_0x5ffa('0x4d')](_0x368ce9[_0x5ffa('0x2f')][_0x5ffa('0x4d')]);_0x8fa851[_0x5ffa('0x39')]=qs[_0x5ffa('0x3b')](_[_0x5ffa('0x3a')](_0x368ce9[_0x5ffa('0x2f')],_0x125c0d[_0x5ffa('0x3b')]));if(_0x368ce9['query']['filter']){_0x8fa851['where']=_[_0x5ffa('0x3d')](_0x8fa851[_0x5ffa('0x39')],{'$or':_[_0x5ffa('0x29')](_0x8fa851[_0x5ffa('0x31')],function(_0x267259){var _0x3ea38e={};_0x3ea38e[_0x267259]={'$like':'%'+_0x368ce9[_0x5ffa('0x2f')][_0x5ffa('0x3c')]+'%'};return _0x3ea38e;})});}_0x8fa851=_[_0x5ffa('0x3d')]({},_0x8fa851,_0x368ce9[_0x5ffa('0x3f')]);return _0x52c44b['getConfigurations'](_0x8fa851);}})[_0x5ffa('0x23')](function(_0x4f8474){if(_0x4f8474){_0x25cc77=_0x4f8474[_0x5ffa('0x35')];if(!_0x368ce9['query'][_0x5ffa('0x36')]('nolimit')){_0x8fa851['limit']=qs[_0x5ffa('0x1c')](_0x368ce9[_0x5ffa('0x2f')][_0x5ffa('0x1c')]);_0x8fa851[_0x5ffa('0x1a')]=qs['offset'](_0x368ce9[_0x5ffa('0x2f')][_0x5ffa('0x1a')]);}return _0x52c44b[_0x5ffa('0x4b')](_0x8fa851);}})[_0x5ffa('0x23')](function(_0x31cf9f){if(_0x31cf9f){return _0x31cf9f?{'count':_0x25cc77,'rows':_0x31cf9f}:null;}})['then'](respondWithResult(_0x1680cf,null))[_0x5ffa('0x44')](handleError(_0x1680cf,null));};exports['addConfiguration']=function(_0x16269b,_0x2bf0b5,_0x51a00f){if(_0x16269b['body']['id']){delete _0x16269b['body']['id'];}return db[_0x5ffa('0x2a')]['findOne']({'where':{'id':_0x16269b[_0x5ffa('0x46')]['id']}})[_0x5ffa('0x23')](handleEntityNotFound(_0x2bf0b5,null))[_0x5ffa('0x23')](function(_0x205389){if(_0x205389){_0x16269b['body'][_0x5ffa('0x4e')]=_0x205389['id'];_0x16269b[_0x5ffa('0x49')]['Subjects']=integrations['getSubjects'](_0x16269b[_0x5ffa('0x49')][_0x5ffa('0x4f')],_0x16269b['body']['type']);_0x16269b[_0x5ffa('0x49')][_0x5ffa('0x50')]=integrations[_0x5ffa('0x51')](_0x16269b[_0x5ffa('0x49')][_0x5ffa('0x4f')],_0x16269b['body'][_0x5ffa('0x2d')]);return db[_0x5ffa('0x52')][_0x5ffa('0x48')](_0x16269b[_0x5ffa('0x49')],{'include':[{'model':db[_0x5ffa('0x53')],'as':'Subjects'},{'model':db[_0x5ffa('0x53')],'as':_0x5ffa('0x50')}]});}return null;})['then'](respondWithResult(_0x2bf0b5,null))[_0x5ffa('0x44')](handleError(_0x2bf0b5,null));};var md5=require(_0x5ffa('0x54'));exports[_0x5ffa('0x55')]=function(_0x4908f9,_0x114642,_0x1202ac){var _0x3f1cd9=null;var _0x4f7461=null;var _0x15dd90=null;var _0x3fb419=null;var _0x2ac49c='';return db['VtigerAccount'][_0x5ffa('0x4c')]({'where':{'id':_0x4908f9['params']['id']},'attributes':['id',_0x5ffa('0x26'),_0x5ffa('0x56'),_0x5ffa('0x57'),_0x5ffa('0x58'),'remoteUri','serverUrl',_0x5ffa('0x59')]})[_0x5ffa('0x23')](handleEntityNotFound(_0x114642,null))[_0x5ffa('0x23')](function(_0x241cbf){if(_0x241cbf){_0x3f1cd9=_0x241cbf[_0x5ffa('0x56')];_0x4f7461=_0x241cbf['accessKey'];_0x15dd90=_0x241cbf[_0x5ffa('0x58')];_0x2ac49c=_0x241cbf[_0x5ffa('0x5a')];var _0x3ff3cb=_0x2ac49c[_0x5ffa('0x5b')](-0x1);if(_0x3ff3cb==='/'){_0x2ac49c=_0x2ac49c[_0x5ffa('0x5c')](0x0,_0x2ac49c['lastIndexOf'](_0x3ff3cb));}_0x3fb419=util['format'](_0x5ffa('0x5d'),_0x2ac49c);var _0x15b776={'method':_0x5ffa('0x5e'),'uri':_0x3fb419,'qs':{'operation':_0x5ffa('0x5f'),'username':_0x241cbf[_0x5ffa('0x56')]},'json':!![]};return rp(_0x15b776);}})[_0x5ffa('0x23')](function(_0x25fb02){if(_0x25fb02[_0x5ffa('0x60')]){var _0x551361={'method':'POST','uri':_0x3fb419,'form':{'operation':'login','username':_0x3f1cd9,'accessKey':md5(_0x25fb02[_0x5ffa('0x61')]['token']+_0x4f7461)},'json':!![]};return rp(_0x551361);}})['then'](function(_0x545a82){if(_0x545a82['success']){var _0x48a3bc={'method':_0x5ffa('0x5e'),'uri':_0x3fb419,'qs':{'operation':'describe','username':_0x3f1cd9,'sessionName':_0x545a82['result'][_0x5ffa('0x62')],'elementType':_0x15dd90},'json':!![]};return rp(_0x48a3bc);}})[_0x5ffa('0x23')](function(_0x34ff1f){if(_0x34ff1f[_0x5ffa('0x60')]){var _0x23c342=[_0x5ffa('0x63'),_0x5ffa('0x64'),_0x5ffa('0x65')];_[_0x5ffa('0x66')](_0x34ff1f['result'][_0x5ffa('0x34')],function(_0x1cd77c){return _0x23c342['includes'](_0x1cd77c[_0x5ffa('0x2d')][_0x5ffa('0x26')]);});_['remove'](_0x34ff1f[_0x5ffa('0x61')][_0x5ffa('0x34')],function(_0x2886df){return _0x2886df['editable']===_0x5ffa('0x67');});return{'count':_0x34ff1f[_0x5ffa('0x61')][_0x5ffa('0x34')][_0x5ffa('0x35')],'rows':_['map'](_0x34ff1f[_0x5ffa('0x61')][_0x5ffa('0x34')],function(_0x3f9ffe){return{'id':_0x3f9ffe['name'],'name':_0x3f9ffe[_0x5ffa('0x68')],'custom':_['startsWith'](_0x3f9ffe[_0x5ffa('0x26')],_0x5ffa('0x69'))?!![]:![],'options':_0x3f9ffe['type'][_0x5ffa('0x26')]===_0x5ffa('0x6a')&&_0x3f9ffe[_0x5ffa('0x2d')][_0x5ffa('0x6b')][_0x5ffa('0x35')]>0x0?_[_0x5ffa('0x29')](_0x3f9ffe[_0x5ffa('0x2d')]['picklistValues'],function(_0x15b1e3){return{'name':_0x15b1e3[_0x5ffa('0x68')],'value':_0x15b1e3[_0x5ffa('0x6c')]};}):[]};})};}})[_0x5ffa('0x23')](respondWithResult(_0x114642,null))[_0x5ffa('0x44')](function(_0x334d5f){console[_0x5ffa('0x6d')]('vTiger\x20error:\x20'+_0x334d5f);var _0x404bb8=_0x4908f9[_0x5ffa('0x2f')][_0x5ffa('0x6e')]?0x1f4:_0x334d5f[_0x5ffa('0x6f')]||0x1f4;logger[_0x5ffa('0x25')](_0x5ffa('0x70'),_0x5ffa('0x55'),_0x404bb8,JSON[_0x5ffa('0x71')](_0x334d5f));delete _0x334d5f[_0x5ffa('0x26')];if(_0x404bb8===0x191){_0x404bb8=0x190;}_0x114642['status'](_0x404bb8)[_0x5ffa('0x27')](_0x4908f9[_0x5ffa('0x2f')]['test']?{'message':_0x5ffa('0x72'),'statusCode':_0x334d5f[_0x5ffa('0x6f')]}:_0x334d5f);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index cf7c196..76f1eec 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 _0x266a=['api','moment','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x266a,0x93));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa266('0x0'));var util=require(_0xa266('0x1'));var logger=require(_0xa266('0x2'))(_0xa266('0x3'));var moment=require(_0xa266('0x4'));var BPromise=require(_0xa266('0x5'));var rp=require(_0xa266('0x6'));var fs=require('fs');var path=require(_0xa266('0x7'));var rimraf=require(_0xa266('0x8'));var config=require('../../config/environment');var attributes=require(_0xa266('0x9'));var integrations=require(_0xa266('0xa'));module[_0xa266('0xb')]=function(_0x5d8945,_0x3486a1){return _0x5d8945[_0xa266('0xc')](_0xa266('0xd'),attributes,{'tableName':_0xa266('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7889=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x1e40de,_0x32153){var _0xe135f9=function(_0x47d2c1){while(--_0x47d2c1){_0x1e40de['push'](_0x1e40de['shift']());}};_0xe135f9(++_0x32153);}(_0x7889,0xde));var _0x9788=function(_0x2c7148,_0x5c9bb6){_0x2c7148=_0x2c7148-0x0;var _0x2d68e2=_0x7889[_0x2c7148];return _0x2d68e2;};'use strict';var _=require(_0x9788('0x0'));var util=require(_0x9788('0x1'));var logger=require(_0x9788('0x2'))(_0x9788('0x3'));var moment=require('moment');var BPromise=require(_0x9788('0x4'));var rp=require(_0x9788('0x5'));var fs=require('fs');var path=require(_0x9788('0x6'));var rimraf=require(_0x9788('0x7'));var config=require(_0x9788('0x8'));var attributes=require(_0x9788('0x9'));var integrations=require(_0x9788('0xa'));module['exports']=function(_0x217cd2,_0x5910be){return _0x217cd2[_0x9788('0xb')](_0x9788('0xc'),attributes,{'tableName':_0x9788('0xd'),'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 34ded8e..72ca8dc 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 _0x96cc=['model','map','debug','ShowVtigerAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x447f6d,_0x36fc29){var _0x56a9b8=function(_0x16444e){while(--_0x16444e){_0x447f6d['push'](_0x447f6d['shift']());}};_0x56a9b8(++_0x36fc29);}(_0x96cc,0x16c));var _0xc96c=function(_0x44650b,_0x5af069){_0x44650b=_0x44650b-0x0;var _0x13b205=_0x96cc[_0x44650b];return _0x13b205;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});}exports[_0xc96c('0x17')]=function(_0x99c402){var _0x16b6ce=this;return new Promise(function(_0x2ae19a,_0x4aa6a3){return db[_0xc96c('0x18')][_0xc96c('0x19')]({'raw':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1b')]===undefined?!![]:![]:!![],'where':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1c')]||null:null,'attributes':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1d')]||null:null,'limit':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1e')]||null:null,'include':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1f')]?_['map'](_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1f')],function(_0x4456bf){return{'model':db[_0x4456bf[_0xc96c('0x20')]],'as':_0x4456bf['as'],'attributes':_0x4456bf[_0xc96c('0x1d')],'include':_0x4456bf[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x4456bf[_0xc96c('0x1f')],function(_0x1a77df){return{'model':db[_0x1a77df[_0xc96c('0x20')]],'as':_0x1a77df['as'],'attributes':_0x1a77df['attributes'],'include':_0x1a77df[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x1a77df[_0xc96c('0x1f')],function(_0x294fee){return{'model':db[_0x294fee['model']],'as':_0x294fee['as'],'attributes':_0x294fee['attributes']};}):[]};}):[]};}):[]:[]})[_0xc96c('0xc')](function(_0x12c293){logger[_0xc96c('0xd')](_0xc96c('0x17'),_0x99c402);logger[_0xc96c('0x22')](_0xc96c('0x17'),_0x99c402,JSON[_0xc96c('0x11')](_0x12c293));_0x2ae19a(_0x12c293);})[_0xc96c('0x16')](function(_0xa0efbc){logger[_0xc96c('0x12')](_0xc96c('0x17'),_0xa0efbc[_0xc96c('0x14')],_0x99c402);_0x4aa6a3(_0x16b6ce[_0xc96c('0x12')](0x1f4,_0xa0efbc[_0xc96c('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x3aa436){var _0x53c994=this;return new Promise(function(_0x3f4b0e,_0x442c7f){return db[_0xc96c('0x18')]['find']({'raw':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436['options']['where']||null:null,'attributes':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1d')]||null:null,'include':_0x3aa436['options']?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x3aa436[_0xc96c('0x1a')]['include'],function(_0x4132a9){return{'model':db[_0x4132a9[_0xc96c('0x20')]],'as':_0x4132a9['as'],'attributes':_0x4132a9['attributes'],'include':_0x4132a9[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x4132a9[_0xc96c('0x1f')],function(_0x2d2595){return{'model':db[_0x2d2595[_0xc96c('0x20')]],'as':_0x2d2595['as'],'attributes':_0x2d2595[_0xc96c('0x1d')],'include':_0x2d2595['include']?_[_0xc96c('0x21')](_0x2d2595[_0xc96c('0x1f')],function(_0x15b68b){return{'model':db[_0x15b68b[_0xc96c('0x20')]],'as':_0x15b68b['as'],'attributes':_0x15b68b[_0xc96c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc96c('0xc')](function(_0x52d4a2){logger['info'](_0xc96c('0x23'),_0x3aa436);logger[_0xc96c('0x22')]('ShowVtigerAccount',_0x3aa436,JSON['stringify'](_0x52d4a2));_0x3f4b0e(_0x52d4a2);})[_0xc96c('0x16')](function(_0x1df393){logger[_0xc96c('0x12')](_0xc96c('0x23'),_0x1df393[_0xc96c('0x14')],_0x3aa436);_0x442c7f(_0x53c994[_0xc96c('0x12')](0x1f4,_0x1df393[_0xc96c('0x14')]));});});}; \ No newline at end of file +var _0x0bb5=['VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','limit','map','include','model','attributes','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x597eb6,_0x4fbdea){var _0x58c0fb=function(_0x357767){while(--_0x357767){_0x597eb6['push'](_0x597eb6['shift']());}};_0x58c0fb(++_0x4fbdea);}(_0x0bb5,0x148));var _0x50bb=function(_0xfd9abe,_0x7dcca4){_0xfd9abe=_0xfd9abe-0x0;var _0xb8e118=_0x0bb5[_0xfd9abe];return _0xb8e118;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});}exports['GetVtigerAccount']=function(_0x24ba19){var _0x4796ec=this;return new Promise(function(_0x301f61,_0x431ed4){return db['VtigerAccount']['findAll']({'raw':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x24ba19[_0x50bb('0x16')]?_0x24ba19['options'][_0x50bb('0x18')]||null:null,'attributes':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')]['attributes']||null:null,'limit':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x19')]||null:null,'include':_0x24ba19['options']?_0x24ba19[_0x50bb('0x16')]['include']?_[_0x50bb('0x1a')](_0x24ba19[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x2ee87a){return{'model':db[_0x2ee87a[_0x50bb('0x1c')]],'as':_0x2ee87a['as'],'attributes':_0x2ee87a[_0x50bb('0x1d')],'include':_0x2ee87a['include']?_[_0x50bb('0x1a')](_0x2ee87a[_0x50bb('0x1b')],function(_0x284a76){return{'model':db[_0x284a76[_0x50bb('0x1c')]],'as':_0x284a76['as'],'attributes':_0x284a76['attributes'],'include':_0x284a76[_0x50bb('0x1b')]?_['map'](_0x284a76['include'],function(_0x2befd9){return{'model':db[_0x2befd9['model']],'as':_0x2befd9['as'],'attributes':_0x2befd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x12ee2c){logger[_0x50bb('0xb')](_0x50bb('0x1e'),_0x24ba19);logger[_0x50bb('0xd')](_0x50bb('0x1e'),_0x24ba19,JSON[_0x50bb('0x10')](_0x12ee2c));_0x301f61(_0x12ee2c);})[_0x50bb('0x15')](function(_0x4f7514){logger[_0x50bb('0x11')](_0x50bb('0x1e'),_0x4f7514[_0x50bb('0x13')],_0x24ba19);_0x431ed4(_0x4796ec[_0x50bb('0x11')](0x1f4,_0x4f7514['message']));});});};exports[_0x50bb('0x1f')]=function(_0x1a62fb){var _0xc38da5=this;return new Promise(function(_0xb3c3ba,_0x3fd5f6){return db[_0x50bb('0x20')][_0x50bb('0x21')]({'raw':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')]['where']||null:null,'attributes':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1d')]||null:null,'include':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x1cc4e2){return{'model':db[_0x1cc4e2[_0x50bb('0x1c')]],'as':_0x1cc4e2['as'],'attributes':_0x1cc4e2['attributes'],'include':_0x1cc4e2[_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1cc4e2[_0x50bb('0x1b')],function(_0x2bfb54){return{'model':db[_0x2bfb54[_0x50bb('0x1c')]],'as':_0x2bfb54['as'],'attributes':_0x2bfb54[_0x50bb('0x1d')],'include':_0x2bfb54['include']?_['map'](_0x2bfb54[_0x50bb('0x1b')],function(_0x5ed0b4){return{'model':db[_0x5ed0b4[_0x50bb('0x1c')]],'as':_0x5ed0b4['as'],'attributes':_0x5ed0b4[_0x50bb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x171c6b){logger[_0x50bb('0xb')]('ShowVtigerAccount',_0x1a62fb);logger[_0x50bb('0xd')]('ShowVtigerAccount',_0x1a62fb,JSON[_0x50bb('0x10')](_0x171c6b));_0xb3c3ba(_0x171c6b);})[_0x50bb('0x15')](function(_0x280e5a){logger['error']('ShowVtigerAccount',_0x280e5a[_0x50bb('0x13')],_0x1a62fb);_0x3fd5f6(_0xc38da5[_0x50bb('0x11')](0x1f4,_0x280e5a[_0x50bb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 0c95496..d48c1a8 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 _0x8b7e=['getDescriptions','delete','destroy','exports','multer','path','express','Router','fs-extra','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x8b7e,0x1a8));var _0xe8b7=function(_0x3ca75e,_0x3c827e){_0x3ca75e=_0x3ca75e-0x0;var _0x3ca1d1=_0x8b7e[_0x3ca75e];return _0x3ca1d1;};'use strict';var multer=require(_0xe8b7('0x0'));var util=require('util');var path=require(_0xe8b7('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8b7('0x2'));var router=express[_0xe8b7('0x3')]();var fs_extra=require(_0xe8b7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe8b7('0x5'));router[_0xe8b7('0x6')]('/',auth[_0xe8b7('0x7')](),controller[_0xe8b7('0x8')]);router[_0xe8b7('0x6')](_0xe8b7('0x9'),auth['isAuthenticated'](),controller[_0xe8b7('0xa')]);router[_0xe8b7('0x6')](_0xe8b7('0xb'),auth['isAuthenticated'](),controller[_0xe8b7('0xc')]);router[_0xe8b7('0x6')](_0xe8b7('0xd'),auth[_0xe8b7('0x7')](),controller[_0xe8b7('0xe')]);router[_0xe8b7('0x6')](_0xe8b7('0xf'),auth[_0xe8b7('0x7')](),controller[_0xe8b7('0x10')]);router['post']('/',auth[_0xe8b7('0x7')](),controller['create']);router['put']('/:id',auth[_0xe8b7('0x7')](),controller['update']);router[_0xe8b7('0x11')](_0xe8b7('0x9'),auth[_0xe8b7('0x7')](),controller[_0xe8b7('0x12')]);module[_0xe8b7('0x13')]=router; \ No newline at end of file +var _0xb57a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','exports'];(function(_0x3feab0,_0x3490ce){var _0x3eca70=function(_0xebdaa4){while(--_0xebdaa4){_0x3feab0['push'](_0x3feab0['shift']());}};_0x3eca70(++_0x3490ce);}(_0xb57a,0x69));var _0xab57=function(_0x58eee8,_0x13da33){_0x58eee8=_0x58eee8-0x0;var _0x40e81=_0xb57a[_0x58eee8];return _0x40e81;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab57('0x0'));var timeout=require(_0xab57('0x1'));var express=require(_0xab57('0x2'));var router=express[_0xab57('0x3')]();var fs_extra=require(_0xab57('0x4'));var auth=require(_0xab57('0x5'));var interaction=require(_0xab57('0x6'));var config=require(_0xab57('0x7'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xab57('0x8')](),controller[_0xab57('0x9')]);router[_0xab57('0xa')](_0xab57('0xb'),auth[_0xab57('0x8')](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xab57('0xc')]);router[_0xab57('0xa')](_0xab57('0xd'),auth[_0xab57('0x8')](),controller[_0xab57('0xe')]);router['get'](_0xab57('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xab57('0x10')]('/',auth['isAuthenticated'](),controller[_0xab57('0x11')]);router['put'](_0xab57('0xb'),auth['isAuthenticated'](),controller[_0xab57('0x12')]);router[_0xab57('0x13')]('/:id',auth[_0xab57('0x8')](),controller['destroy']);module[_0xab57('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 4738854..c4a8ef6 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 _0xbc4b=['STRING','exports'];(function(_0x227f06,_0x23e3c1){var _0x453522=function(_0x342033){while(--_0x342033){_0x227f06['push'](_0x227f06['shift']());}};_0x453522(++_0x23e3c1);}(_0xbc4b,0xcd));var _0xbbc4=function(_0x442e11,_0x47488f){_0x442e11=_0x442e11-0x0;var _0x50495d=_0xbc4b[_0x442e11];return _0x50495d;};'use strict';var Sequelize=require('sequelize');module[_0xbbc4('0x0')]={'name':{'type':Sequelize[_0xbbc4('0x1')]},'description':{'type':Sequelize[_0xbbc4('0x1')]}}; \ No newline at end of file +var _0x9a52=['STRING','sequelize','exports'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0x9a52,0x1a5));var _0x29a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x29a5('0x0'));module[_0x29a5('0x1')]={'name':{'type':Sequelize[_0x29a5('0x2')]},'description':{'type':Sequelize[_0x29a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a520a51..68e294d 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 _0xf72f=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','findAll','rows','show','params','keys','intersection','catch','create','body','find','findOne','VtigerField','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x449132,_0x5b039e){var _0x2de44e=function(_0x2204f7){while(--_0x2204f7){_0x449132['push'](_0x449132['shift']());}};_0x2de44e(++_0x5b039e);}(_0xf72f,0x171));var _0xff72=function(_0x32fecb,_0x44a585){_0x32fecb=_0x32fecb-0x0;var _0x1efbf0=_0xf72f[_0x32fecb];return _0x1efbf0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff72('0x0'));var zipdir=require(_0xff72('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff72('0x2'));var moment=require(_0xff72('0x3'));var BPromise=require(_0xff72('0x4'));var Mustache=require(_0xff72('0x5'));var util=require(_0xff72('0x6'));var path=require(_0xff72('0x7'));var sox=require(_0xff72('0x8'));var csv=require(_0xff72('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff72('0xa'));var squel=require('squel');var crypto=require(_0xff72('0xb'));var jsforce=require(_0xff72('0xc'));var deskjs=require(_0xff72('0xd'));var toCsv=require(_0xff72('0x9'));var querystring=require(_0xff72('0xe'));var Papa=require(_0xff72('0xf'));var Redis=require(_0xff72('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xff72('0x11'));var as=require(_0xff72('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xff72('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xff72('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c720a,_0x3a2744){_0x3a2744=_0x3a2744||0xcc;return function(_0x38736f){if(_0x38736f){return _0x4c720a[_0xff72('0x15')](_0x3a2744);}return _0x4c720a[_0xff72('0x16')](_0x3a2744)['end']();};}function respondWithResult(_0x22dabc,_0x50cd3f){_0x50cd3f=_0x50cd3f||0xc8;return function(_0x499456){if(_0x499456){return _0x22dabc[_0xff72('0x16')](_0x50cd3f)[_0xff72('0x17')](_0x499456);}};}function respondWithFilteredResult(_0x43ec9b,_0x30d10c){return function(_0xf7b15e){if(_0xf7b15e){var _0x2f7385=typeof _0x30d10c['offset']===_0xff72('0x18')&&typeof _0x30d10c[_0xff72('0x19')]===_0xff72('0x18');var _0x25b007=_0xf7b15e['count'];var _0x40685f=_0x2f7385?0x0:_0x30d10c[_0xff72('0x1a')];var _0x2e5240=_0x2f7385?_0xf7b15e[_0xff72('0x1b')]:_0x30d10c['offset']+_0x30d10c['limit'];var _0x2f953b;if(_0x2e5240>=_0x25b007){_0x2e5240=_0x25b007;_0x2f953b=0xc8;}else{_0x2f953b=0xce;}_0x43ec9b[_0xff72('0x16')](_0x2f953b);return _0x43ec9b['set'](_0xff72('0x1c'),_0x40685f+'-'+_0x2e5240+'/'+_0x25b007)[_0xff72('0x17')](_0xf7b15e);}return null;};}function patchUpdates(_0x12ed64){return function(_0x5dad57){try{jsonpatch[_0xff72('0x1d')](_0x5dad57,_0x12ed64,!![]);}catch(_0x54b4b5){return BPromise['reject'](_0x54b4b5);}return _0x5dad57[_0xff72('0x1e')]();};}function saveUpdates(_0x218336,_0x52bc46){return function(_0x47e647){if(_0x47e647){return _0x47e647[_0xff72('0x1f')](_0x218336)[_0xff72('0x20')](function(_0x20ffd6){return _0x20ffd6;});}return null;};}function removeEntity(_0x654882,_0x23c2ba){return function(_0x147af0){if(_0x147af0){return _0x147af0[_0xff72('0x21')]()['then'](function(){_0x654882['status'](0xcc)[_0xff72('0x22')]();});}};}function handleEntityNotFound(_0xf4d76d,_0x49bf3f){return function(_0x230f21){if(!_0x230f21){_0xf4d76d['sendStatus'](0x194);}return _0x230f21;};}function handleError(_0x94aeb3,_0x12a7bc){_0x12a7bc=_0x12a7bc||0x1f4;return function(_0xb9e565){logger[_0xff72('0x23')](_0xb9e565[_0xff72('0x24')]);if(_0xb9e565[_0xff72('0x25')]){delete _0xb9e565[_0xff72('0x25')];}_0x94aeb3[_0xff72('0x16')](_0x12a7bc)[_0xff72('0x26')](_0xb9e565);};}exports[_0xff72('0x27')]=function(_0x5e4cc4,_0x3a3b59){var _0x2c8631={},_0x2f3f98={},_0x525c48={'count':0x0,'rows':[]};var _0x74f21f=_[_0xff72('0x28')](db['VtigerConfiguration'][_0xff72('0x29')],function(_0x3bcfbb){return{'name':_0x3bcfbb[_0xff72('0x2a')],'type':_0x3bcfbb[_0xff72('0x2b')]['key']};});_0x2f3f98[_0xff72('0x2c')]=_[_0xff72('0x28')](_0x74f21f,_0xff72('0x25'));_0x2f3f98[_0xff72('0x2d')]=_['keys'](_0x5e4cc4[_0xff72('0x2d')]);_0x2f3f98[_0xff72('0x2e')]=_['intersection'](_0x2f3f98[_0xff72('0x2c')],_0x2f3f98[_0xff72('0x2d')]);_0x2c8631['attributes']=_['intersection'](_0x2f3f98[_0xff72('0x2c')],qs[_0xff72('0x2f')](_0x5e4cc4[_0xff72('0x2d')][_0xff72('0x2f')]));_0x2c8631[_0xff72('0x30')]=_0x2c8631[_0xff72('0x30')][_0xff72('0x31')]?_0x2c8631[_0xff72('0x30')]:_0x2f3f98[_0xff72('0x2c')];if(!_0x5e4cc4[_0xff72('0x2d')][_0xff72('0x32')](_0xff72('0x33'))){_0x2c8631[_0xff72('0x19')]=qs[_0xff72('0x19')](_0x5e4cc4[_0xff72('0x2d')]['limit']);_0x2c8631[_0xff72('0x1a')]=qs[_0xff72('0x1a')](_0x5e4cc4[_0xff72('0x2d')]['offset']);}_0x2c8631[_0xff72('0x34')]=qs[_0xff72('0x35')](_0x5e4cc4['query'][_0xff72('0x35')]);_0x2c8631[_0xff72('0x36')]=qs[_0xff72('0x2e')](_[_0xff72('0x37')](_0x5e4cc4['query'],_0x2f3f98['filters']),_0x74f21f);if(_0x5e4cc4[_0xff72('0x2d')][_0xff72('0x38')]){_0x2c8631[_0xff72('0x36')]=_[_0xff72('0x39')](_0x2c8631[_0xff72('0x36')],{'$or':_['map'](_0x74f21f,function(_0x1b04b7){if(_0x1b04b7['type']!==_0xff72('0x3a')){var _0x2609ec={};_0x2609ec[_0x1b04b7[_0xff72('0x25')]]={'$like':'%'+_0x5e4cc4[_0xff72('0x2d')]['filter']+'%'};return _0x2609ec;}})});}_0x2c8631=_[_0xff72('0x39')]({},_0x2c8631,_0x5e4cc4[_0xff72('0x3b')]);var _0xdce011={'where':_0x2c8631['where']};return db[_0xff72('0x3c')][_0xff72('0x1b')](_0xdce011)[_0xff72('0x20')](function(_0x36b755){_0x525c48[_0xff72('0x1b')]=_0x36b755;if(_0x5e4cc4[_0xff72('0x2d')][_0xff72('0x3d')]){_0x2c8631[_0xff72('0x3e')]=[{'all':!![]}];}return db[_0xff72('0x3c')][_0xff72('0x3f')](_0x2c8631);})[_0xff72('0x20')](function(_0x4c534e){_0x525c48[_0xff72('0x40')]=_0x4c534e;return _0x525c48;})[_0xff72('0x20')](respondWithFilteredResult(_0x3a3b59,_0x2c8631))['catch'](handleError(_0x3a3b59,null));};exports[_0xff72('0x41')]=function(_0x39355d,_0x3e46be){var _0x59e3d5={'raw':![],'where':{'id':_0x39355d[_0xff72('0x42')]['id']}},_0x124365={};_0x124365[_0xff72('0x2c')]=_[_0xff72('0x43')](db['VtigerConfiguration'][_0xff72('0x29')]);_0x124365['query']=_[_0xff72('0x43')](_0x39355d['query']);_0x124365[_0xff72('0x2e')]=_[_0xff72('0x44')](_0x124365[_0xff72('0x2c')],_0x124365[_0xff72('0x2d')]);_0x59e3d5[_0xff72('0x30')]=_[_0xff72('0x44')](_0x124365['model'],qs[_0xff72('0x2f')](_0x39355d[_0xff72('0x2d')][_0xff72('0x2f')]));_0x59e3d5['attributes']=_0x59e3d5[_0xff72('0x30')]['length']?_0x59e3d5[_0xff72('0x30')]:_0x124365['model'];if(_0x39355d['query']['includeAll']){_0x59e3d5[_0xff72('0x3e')]=[{'all':!![]}];}_0x59e3d5=_[_0xff72('0x39')]({},_0x59e3d5,_0x39355d[_0xff72('0x3b')]);return db['VtigerConfiguration']['find'](_0x59e3d5)[_0xff72('0x20')](handleEntityNotFound(_0x3e46be,null))[_0xff72('0x20')](respondWithResult(_0x3e46be,null))[_0xff72('0x45')](handleError(_0x3e46be,null));};exports[_0xff72('0x46')]=function(_0x5a39e1,_0x399683){return db['VtigerConfiguration'][_0xff72('0x46')](_0x5a39e1[_0xff72('0x47')],{})['then'](respondWithResult(_0x399683,0xc9))[_0xff72('0x45')](handleError(_0x399683,null));};exports[_0xff72('0x1f')]=function(_0x45100c,_0x5bbd86){if(_0x45100c['body']['id']){delete _0x45100c['body']['id'];}return db[_0xff72('0x3c')]['find']({'where':{'id':_0x45100c[_0xff72('0x42')]['id']}})['then'](handleEntityNotFound(_0x5bbd86,null))['then'](saveUpdates(_0x45100c[_0xff72('0x47')],null))[_0xff72('0x20')](respondWithResult(_0x5bbd86,null))['catch'](handleError(_0x5bbd86,null));};exports[_0xff72('0x21')]=function(_0x58fd1b,_0x18ae7c){return db['VtigerConfiguration'][_0xff72('0x48')]({'where':{'id':_0x58fd1b[_0xff72('0x42')]['id']}})[_0xff72('0x20')](handleEntityNotFound(_0x18ae7c,null))[_0xff72('0x20')](removeEntity(_0x18ae7c,null))[_0xff72('0x45')](handleError(_0x18ae7c,null));};exports['getFields']=function(_0x4e6a5e,_0x5bbbff,_0x3de1cb){var _0x4c1a91={};var _0x29ed6b={};var _0x1108fe;var _0x16b48e;return db[_0xff72('0x3c')][_0xff72('0x49')]({'where':{'id':_0x4e6a5e[_0xff72('0x42')]['id']}})[_0xff72('0x20')](handleEntityNotFound(_0x5bbbff,null))[_0xff72('0x20')](function(_0x28bab5){if(_0x28bab5){_0x1108fe=_0x28bab5;_0x29ed6b[_0xff72('0x2c')]=_[_0xff72('0x43')](db[_0xff72('0x4a')]['rawAttributes']);_0x29ed6b['query']=_[_0xff72('0x43')](_0x4e6a5e[_0xff72('0x2d')]);_0x29ed6b[_0xff72('0x2e')]=_[_0xff72('0x44')](_0x29ed6b[_0xff72('0x2c')],_0x29ed6b[_0xff72('0x2d')]);_0x4c1a91['attributes']=_[_0xff72('0x44')](_0x29ed6b[_0xff72('0x2c')],qs[_0xff72('0x2f')](_0x4e6a5e[_0xff72('0x2d')][_0xff72('0x2f')]));_0x4c1a91[_0xff72('0x30')]=_0x4c1a91[_0xff72('0x30')][_0xff72('0x31')]?_0x4c1a91[_0xff72('0x30')]:_0x29ed6b[_0xff72('0x2c')];_0x4c1a91['order']=qs[_0xff72('0x35')](_0x4e6a5e['query'][_0xff72('0x35')]);_0x4c1a91[_0xff72('0x36')]=qs[_0xff72('0x2e')](_['pick'](_0x4e6a5e['query'],_0x29ed6b[_0xff72('0x2e')]));if(_0x4e6a5e[_0xff72('0x2d')][_0xff72('0x38')]){_0x4c1a91[_0xff72('0x36')]=_['merge'](_0x4c1a91[_0xff72('0x36')],{'$or':_['map'](_0x4c1a91['attributes'],function(_0x1bd6cb){var _0xfb4f59={};_0xfb4f59[_0x1bd6cb]={'$like':'%'+_0x4e6a5e[_0xff72('0x2d')][_0xff72('0x38')]+'%'};return _0xfb4f59;})});}_0x4c1a91=_[_0xff72('0x39')]({},_0x4c1a91,_0x4e6a5e['options']);return _0x1108fe['getFields'](_0x4c1a91);}})[_0xff72('0x20')](function(_0x37b715){if(_0x37b715){_0x16b48e=_0x37b715[_0xff72('0x31')];if(!_0x4e6a5e[_0xff72('0x2d')][_0xff72('0x32')]('nolimit')){_0x4c1a91['limit']=qs[_0xff72('0x19')](_0x4e6a5e[_0xff72('0x2d')][_0xff72('0x19')]);_0x4c1a91[_0xff72('0x1a')]=qs[_0xff72('0x1a')](_0x4e6a5e['query'][_0xff72('0x1a')]);}return _0x1108fe['getFields'](_0x4c1a91);}})[_0xff72('0x20')](function(_0x146eac){if(_0x146eac){return _0x146eac?{'count':_0x16b48e,'rows':_0x146eac}:null;}})[_0xff72('0x20')](respondWithResult(_0x5bbbff,null))[_0xff72('0x45')](handleError(_0x5bbbff,null));};exports[_0xff72('0x4b')]=function(_0x20e126,_0x1bf499,_0x3fa3bf){var _0x18edd2={};var _0x4cf990={};var _0x53cddc;var _0x170430;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x20e126[_0xff72('0x42')]['id']}})[_0xff72('0x20')](handleEntityNotFound(_0x1bf499,null))[_0xff72('0x20')](function(_0x2a5144){if(_0x2a5144){_0x53cddc=_0x2a5144;_0x4cf990[_0xff72('0x2c')]=_[_0xff72('0x43')](db[_0xff72('0x4a')][_0xff72('0x29')]);_0x4cf990['query']=_['keys'](_0x20e126['query']);_0x4cf990['filters']=_[_0xff72('0x44')](_0x4cf990['model'],_0x4cf990['query']);_0x18edd2[_0xff72('0x30')]=_[_0xff72('0x44')](_0x4cf990['model'],qs[_0xff72('0x2f')](_0x20e126['query'][_0xff72('0x2f')]));_0x18edd2[_0xff72('0x30')]=_0x18edd2[_0xff72('0x30')][_0xff72('0x31')]?_0x18edd2[_0xff72('0x30')]:_0x4cf990['model'];_0x18edd2[_0xff72('0x34')]=qs[_0xff72('0x35')](_0x20e126[_0xff72('0x2d')]['sort']);_0x18edd2[_0xff72('0x36')]=qs[_0xff72('0x2e')](_['pick'](_0x20e126[_0xff72('0x2d')],_0x4cf990[_0xff72('0x2e')]));if(_0x20e126['query'][_0xff72('0x38')]){_0x18edd2[_0xff72('0x36')]=_[_0xff72('0x39')](_0x18edd2[_0xff72('0x36')],{'$or':_[_0xff72('0x28')](_0x18edd2[_0xff72('0x30')],function(_0x14a7e3){var _0x2adb86={};_0x2adb86[_0x14a7e3]={'$like':'%'+_0x20e126[_0xff72('0x2d')]['filter']+'%'};return _0x2adb86;})});}_0x18edd2=_['merge']({},_0x18edd2,_0x20e126[_0xff72('0x3b')]);return _0x53cddc['getSubjects'](_0x18edd2);}})['then'](function(_0x20c6c1){if(_0x20c6c1){_0x170430=_0x20c6c1[_0xff72('0x31')];if(!_0x20e126[_0xff72('0x2d')][_0xff72('0x32')](_0xff72('0x33'))){_0x18edd2[_0xff72('0x19')]=qs['limit'](_0x20e126[_0xff72('0x2d')][_0xff72('0x19')]);_0x18edd2[_0xff72('0x1a')]=qs['offset'](_0x20e126[_0xff72('0x2d')]['offset']);}return _0x53cddc[_0xff72('0x4b')](_0x18edd2);}})['then'](function(_0x13491b){if(_0x13491b){return _0x13491b?{'count':_0x170430,'rows':_0x13491b}:null;}})[_0xff72('0x20')](respondWithResult(_0x1bf499,null))[_0xff72('0x45')](handleError(_0x1bf499,null));};exports[_0xff72('0x4c')]=function(_0x5f0fe3,_0x52e3a0,_0x46f826){var _0x166fa1={};var _0x57532a={};var _0x1a188a;var _0x164fca;return db[_0xff72('0x3c')][_0xff72('0x49')]({'where':{'id':_0x5f0fe3[_0xff72('0x42')]['id']}})[_0xff72('0x20')](handleEntityNotFound(_0x52e3a0,null))[_0xff72('0x20')](function(_0x16f716){if(_0x16f716){_0x1a188a=_0x16f716;_0x57532a['model']=_[_0xff72('0x43')](db['VtigerField']['rawAttributes']);_0x57532a['query']=_['keys'](_0x5f0fe3['query']);_0x57532a[_0xff72('0x2e')]=_[_0xff72('0x44')](_0x57532a[_0xff72('0x2c')],_0x57532a[_0xff72('0x2d')]);_0x166fa1[_0xff72('0x30')]=_['intersection'](_0x57532a['model'],qs[_0xff72('0x2f')](_0x5f0fe3[_0xff72('0x2d')][_0xff72('0x2f')]));_0x166fa1[_0xff72('0x30')]=_0x166fa1[_0xff72('0x30')]['length']?_0x166fa1[_0xff72('0x30')]:_0x57532a[_0xff72('0x2c')];_0x166fa1[_0xff72('0x34')]=qs[_0xff72('0x35')](_0x5f0fe3[_0xff72('0x2d')][_0xff72('0x35')]);_0x166fa1[_0xff72('0x36')]=qs[_0xff72('0x2e')](_[_0xff72('0x37')](_0x5f0fe3[_0xff72('0x2d')],_0x57532a['filters']));if(_0x5f0fe3[_0xff72('0x2d')]['filter']){_0x166fa1[_0xff72('0x36')]=_[_0xff72('0x39')](_0x166fa1[_0xff72('0x36')],{'$or':_['map'](_0x166fa1[_0xff72('0x30')],function(_0x146a7d){var _0x1a6ae9={};_0x1a6ae9[_0x146a7d]={'$like':'%'+_0x5f0fe3['query']['filter']+'%'};return _0x1a6ae9;})});}_0x166fa1=_[_0xff72('0x39')]({},_0x166fa1,_0x5f0fe3['options']);return _0x1a188a[_0xff72('0x4c')](_0x166fa1);}})[_0xff72('0x20')](function(_0x59873a){if(_0x59873a){_0x164fca=_0x59873a[_0xff72('0x31')];if(!_0x5f0fe3[_0xff72('0x2d')][_0xff72('0x32')](_0xff72('0x33'))){_0x166fa1[_0xff72('0x19')]=qs[_0xff72('0x19')](_0x5f0fe3[_0xff72('0x2d')]['limit']);_0x166fa1['offset']=qs['offset'](_0x5f0fe3[_0xff72('0x2d')][_0xff72('0x1a')]);}return _0x1a188a[_0xff72('0x4c')](_0x166fa1);}})[_0xff72('0x20')](function(_0x191cfa){if(_0x191cfa){return _0x191cfa?{'count':_0x164fca,'rows':_0x191cfa}:null;}})['then'](respondWithResult(_0x52e3a0,null))[_0xff72('0x45')](handleError(_0x52e3a0,null));}; \ No newline at end of file +var _0x6f71=['Content-Range','save','update','then','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','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','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x6f71,0x1aa));var _0x16f7=function(_0x1a6f62,_0x13484d){_0x1a6f62=_0x1a6f62-0x0;var _0x21d721=_0x6f71[_0x1a6f62];return _0x21d721;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16f7('0x0'));var zipdir=require(_0x16f7('0x1'));var jsonpatch=require(_0x16f7('0x2'));var rp=require(_0x16f7('0x3'));var moment=require('moment');var BPromise=require(_0x16f7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x16f7('0x5'));var sox=require(_0x16f7('0x6'));var csv=require(_0x16f7('0x7'));var ejs=require(_0x16f7('0x8'));var fs=require('fs');var fs_extra=require(_0x16f7('0x9'));var _=require(_0x16f7('0xa'));var squel=require(_0x16f7('0xb'));var crypto=require(_0x16f7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x16f7('0xd'));var toCsv=require(_0x16f7('0x7'));var querystring=require('querystring');var Papa=require(_0x16f7('0xe'));var Redis=require(_0x16f7('0xf'));var authService=require(_0x16f7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16f7('0x11'));var hardwareService=require(_0x16f7('0x12'));var logger=require('../../config/logger')(_0x16f7('0x13'));var utils=require(_0x16f7('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e68c1,_0xa45457){_0xa45457=_0xa45457||0xcc;return function(_0x521faa){if(_0x521faa){return _0x1e68c1[_0x16f7('0x15')](_0xa45457);}return _0x1e68c1[_0x16f7('0x16')](_0xa45457)[_0x16f7('0x17')]();};}function respondWithResult(_0x5571f2,_0x10999b){_0x10999b=_0x10999b||0xc8;return function(_0x425f23){if(_0x425f23){return _0x5571f2[_0x16f7('0x16')](_0x10999b)[_0x16f7('0x18')](_0x425f23);}};}function respondWithFilteredResult(_0x42ce4a,_0x174976){return function(_0x2f6b5a){if(_0x2f6b5a){var _0x1b0011=typeof _0x174976[_0x16f7('0x19')]===_0x16f7('0x1a')&&typeof _0x174976[_0x16f7('0x1b')]===_0x16f7('0x1a');var _0x5be598=_0x2f6b5a[_0x16f7('0x1c')];var _0x74bd49=_0x1b0011?0x0:_0x174976[_0x16f7('0x19')];var _0x17809a=_0x1b0011?_0x2f6b5a[_0x16f7('0x1c')]:_0x174976['offset']+_0x174976[_0x16f7('0x1b')];var _0x5e88cf;if(_0x17809a>=_0x5be598){_0x17809a=_0x5be598;_0x5e88cf=0xc8;}else{_0x5e88cf=0xce;}_0x42ce4a[_0x16f7('0x16')](_0x5e88cf);return _0x42ce4a[_0x16f7('0x1d')](_0x16f7('0x1e'),_0x74bd49+'-'+_0x17809a+'/'+_0x5be598)[_0x16f7('0x18')](_0x2f6b5a);}return null;};}function patchUpdates(_0x159ee9){return function(_0x45be37){try{jsonpatch['apply'](_0x45be37,_0x159ee9,!![]);}catch(_0x24df0e){return BPromise['reject'](_0x24df0e);}return _0x45be37[_0x16f7('0x1f')]();};}function saveUpdates(_0x35e55e,_0x2076a7){return function(_0x1f9018){if(_0x1f9018){return _0x1f9018[_0x16f7('0x20')](_0x35e55e)[_0x16f7('0x21')](function(_0x1cd2a8){return _0x1cd2a8;});}return null;};}function removeEntity(_0x1d9f76,_0x15f41e){return function(_0x1bbe0c){if(_0x1bbe0c){return _0x1bbe0c[_0x16f7('0x22')]()[_0x16f7('0x21')](function(){_0x1d9f76['status'](0xcc)[_0x16f7('0x17')]();});}};}function handleEntityNotFound(_0x6203a3,_0x4692e7){return function(_0x5d0dd4){if(!_0x5d0dd4){_0x6203a3[_0x16f7('0x15')](0x194);}return _0x5d0dd4;};}function handleError(_0x573905,_0x5d907e){_0x5d907e=_0x5d907e||0x1f4;return function(_0x3d439f){logger['error'](_0x3d439f[_0x16f7('0x23')]);if(_0x3d439f[_0x16f7('0x24')]){delete _0x3d439f[_0x16f7('0x24')];}_0x573905[_0x16f7('0x16')](_0x5d907e)[_0x16f7('0x25')](_0x3d439f);};}exports[_0x16f7('0x26')]=function(_0x1a80d7,_0x4c055d){var _0x42099c={},_0x4db617={},_0xf59528={'count':0x0,'rows':[]};var _0x3fedfa=_['map'](db[_0x16f7('0x27')][_0x16f7('0x28')],function(_0x171d61){return{'name':_0x171d61[_0x16f7('0x29')],'type':_0x171d61[_0x16f7('0x2a')]['key']};});_0x4db617[_0x16f7('0x2b')]=_['map'](_0x3fedfa,_0x16f7('0x24'));_0x4db617['query']=_['keys'](_0x1a80d7[_0x16f7('0x2c')]);_0x4db617[_0x16f7('0x2d')]=_['intersection'](_0x4db617[_0x16f7('0x2b')],_0x4db617['query']);_0x42099c[_0x16f7('0x2e')]=_['intersection'](_0x4db617[_0x16f7('0x2b')],qs[_0x16f7('0x2f')](_0x1a80d7['query']['fields']));_0x42099c['attributes']=_0x42099c[_0x16f7('0x2e')]['length']?_0x42099c['attributes']:_0x4db617[_0x16f7('0x2b')];if(!_0x1a80d7['query'][_0x16f7('0x30')](_0x16f7('0x31'))){_0x42099c[_0x16f7('0x1b')]=qs[_0x16f7('0x1b')](_0x1a80d7[_0x16f7('0x2c')]['limit']);_0x42099c[_0x16f7('0x19')]=qs[_0x16f7('0x19')](_0x1a80d7['query'][_0x16f7('0x19')]);}_0x42099c[_0x16f7('0x32')]=qs[_0x16f7('0x33')](_0x1a80d7[_0x16f7('0x2c')][_0x16f7('0x33')]);_0x42099c[_0x16f7('0x34')]=qs[_0x16f7('0x2d')](_[_0x16f7('0x35')](_0x1a80d7[_0x16f7('0x2c')],_0x4db617[_0x16f7('0x2d')]),_0x3fedfa);if(_0x1a80d7[_0x16f7('0x2c')][_0x16f7('0x36')]){_0x42099c['where']=_[_0x16f7('0x37')](_0x42099c[_0x16f7('0x34')],{'$or':_[_0x16f7('0x38')](_0x3fedfa,function(_0x5a73a1){if(_0x5a73a1[_0x16f7('0x2a')]!==_0x16f7('0x39')){var _0x3d2ac6={};_0x3d2ac6[_0x5a73a1[_0x16f7('0x24')]]={'$like':'%'+_0x1a80d7[_0x16f7('0x2c')]['filter']+'%'};return _0x3d2ac6;}})});}_0x42099c=_[_0x16f7('0x37')]({},_0x42099c,_0x1a80d7[_0x16f7('0x3a')]);var _0x639eea={'where':_0x42099c['where']};return db[_0x16f7('0x27')][_0x16f7('0x1c')](_0x639eea)[_0x16f7('0x21')](function(_0x3b9dcc){_0xf59528['count']=_0x3b9dcc;if(_0x1a80d7[_0x16f7('0x2c')][_0x16f7('0x3b')]){_0x42099c[_0x16f7('0x3c')]=[{'all':!![]}];}return db[_0x16f7('0x27')][_0x16f7('0x3d')](_0x42099c);})[_0x16f7('0x21')](function(_0x19a513){_0xf59528[_0x16f7('0x3e')]=_0x19a513;return _0xf59528;})[_0x16f7('0x21')](respondWithFilteredResult(_0x4c055d,_0x42099c))[_0x16f7('0x3f')](handleError(_0x4c055d,null));};exports[_0x16f7('0x40')]=function(_0x11714f,_0x136e9a){var _0x33b791={'raw':![],'where':{'id':_0x11714f[_0x16f7('0x41')]['id']}},_0x35c61e={};_0x35c61e[_0x16f7('0x2b')]=_[_0x16f7('0x42')](db[_0x16f7('0x27')]['rawAttributes']);_0x35c61e['query']=_[_0x16f7('0x42')](_0x11714f[_0x16f7('0x2c')]);_0x35c61e[_0x16f7('0x2d')]=_['intersection'](_0x35c61e['model'],_0x35c61e['query']);_0x33b791['attributes']=_[_0x16f7('0x43')](_0x35c61e[_0x16f7('0x2b')],qs[_0x16f7('0x2f')](_0x11714f['query'][_0x16f7('0x2f')]));_0x33b791[_0x16f7('0x2e')]=_0x33b791[_0x16f7('0x2e')][_0x16f7('0x44')]?_0x33b791[_0x16f7('0x2e')]:_0x35c61e[_0x16f7('0x2b')];if(_0x11714f[_0x16f7('0x2c')][_0x16f7('0x3b')]){_0x33b791[_0x16f7('0x3c')]=[{'all':!![]}];}_0x33b791=_['merge']({},_0x33b791,_0x11714f[_0x16f7('0x3a')]);return db[_0x16f7('0x27')]['find'](_0x33b791)[_0x16f7('0x21')](handleEntityNotFound(_0x136e9a,null))[_0x16f7('0x21')](respondWithResult(_0x136e9a,null))[_0x16f7('0x3f')](handleError(_0x136e9a,null));};exports[_0x16f7('0x45')]=function(_0x25ba40,_0x142edc){return db[_0x16f7('0x27')][_0x16f7('0x45')](_0x25ba40[_0x16f7('0x46')],{})['then'](respondWithResult(_0x142edc,0xc9))['catch'](handleError(_0x142edc,null));};exports['update']=function(_0x4b092d,_0x14711a){if(_0x4b092d[_0x16f7('0x46')]['id']){delete _0x4b092d[_0x16f7('0x46')]['id'];}return db[_0x16f7('0x27')]['find']({'where':{'id':_0x4b092d[_0x16f7('0x41')]['id']}})[_0x16f7('0x21')](handleEntityNotFound(_0x14711a,null))['then'](saveUpdates(_0x4b092d[_0x16f7('0x46')],null))['then'](respondWithResult(_0x14711a,null))[_0x16f7('0x3f')](handleError(_0x14711a,null));};exports[_0x16f7('0x22')]=function(_0x2b0117,_0x3b0af8){return db[_0x16f7('0x27')]['find']({'where':{'id':_0x2b0117[_0x16f7('0x41')]['id']}})[_0x16f7('0x21')](handleEntityNotFound(_0x3b0af8,null))[_0x16f7('0x21')](removeEntity(_0x3b0af8,null))['catch'](handleError(_0x3b0af8,null));};exports[_0x16f7('0x47')]=function(_0x158a42,_0x11654c,_0x4d4293){var _0x4d07b1={};var _0xfb13eb={};var _0xac884c;var _0x407dc8;return db[_0x16f7('0x27')][_0x16f7('0x48')]({'where':{'id':_0x158a42[_0x16f7('0x41')]['id']}})['then'](handleEntityNotFound(_0x11654c,null))[_0x16f7('0x21')](function(_0x5a8149){if(_0x5a8149){_0xac884c=_0x5a8149;_0xfb13eb[_0x16f7('0x2b')]=_['keys'](db[_0x16f7('0x49')][_0x16f7('0x28')]);_0xfb13eb[_0x16f7('0x2c')]=_[_0x16f7('0x42')](_0x158a42[_0x16f7('0x2c')]);_0xfb13eb['filters']=_[_0x16f7('0x43')](_0xfb13eb[_0x16f7('0x2b')],_0xfb13eb[_0x16f7('0x2c')]);_0x4d07b1['attributes']=_[_0x16f7('0x43')](_0xfb13eb[_0x16f7('0x2b')],qs[_0x16f7('0x2f')](_0x158a42[_0x16f7('0x2c')][_0x16f7('0x2f')]));_0x4d07b1[_0x16f7('0x2e')]=_0x4d07b1[_0x16f7('0x2e')][_0x16f7('0x44')]?_0x4d07b1[_0x16f7('0x2e')]:_0xfb13eb[_0x16f7('0x2b')];_0x4d07b1[_0x16f7('0x32')]=qs['sort'](_0x158a42[_0x16f7('0x2c')]['sort']);_0x4d07b1['where']=qs[_0x16f7('0x2d')](_['pick'](_0x158a42[_0x16f7('0x2c')],_0xfb13eb['filters']));if(_0x158a42[_0x16f7('0x2c')][_0x16f7('0x36')]){_0x4d07b1[_0x16f7('0x34')]=_[_0x16f7('0x37')](_0x4d07b1['where'],{'$or':_[_0x16f7('0x38')](_0x4d07b1[_0x16f7('0x2e')],function(_0x42f57a){var _0x3419ee={};_0x3419ee[_0x42f57a]={'$like':'%'+_0x158a42[_0x16f7('0x2c')]['filter']+'%'};return _0x3419ee;})});}_0x4d07b1=_['merge']({},_0x4d07b1,_0x158a42[_0x16f7('0x3a')]);return _0xac884c['getFields'](_0x4d07b1);}})[_0x16f7('0x21')](function(_0x625cf4){if(_0x625cf4){_0x407dc8=_0x625cf4[_0x16f7('0x44')];if(!_0x158a42[_0x16f7('0x2c')][_0x16f7('0x30')]('nolimit')){_0x4d07b1[_0x16f7('0x1b')]=qs[_0x16f7('0x1b')](_0x158a42[_0x16f7('0x2c')]['limit']);_0x4d07b1[_0x16f7('0x19')]=qs['offset'](_0x158a42[_0x16f7('0x2c')]['offset']);}return _0xac884c[_0x16f7('0x47')](_0x4d07b1);}})['then'](function(_0x35224f){if(_0x35224f){return _0x35224f?{'count':_0x407dc8,'rows':_0x35224f}:null;}})[_0x16f7('0x21')](respondWithResult(_0x11654c,null))[_0x16f7('0x3f')](handleError(_0x11654c,null));};exports[_0x16f7('0x4a')]=function(_0x30eff5,_0x3dacfe,_0x25dcd0){var _0x100a18={};var _0x384f77={};var _0x1cdce4;var _0x398f22;return db['VtigerConfiguration'][_0x16f7('0x48')]({'where':{'id':_0x30eff5[_0x16f7('0x41')]['id']}})[_0x16f7('0x21')](handleEntityNotFound(_0x3dacfe,null))[_0x16f7('0x21')](function(_0x3ec6f5){if(_0x3ec6f5){_0x1cdce4=_0x3ec6f5;_0x384f77[_0x16f7('0x2b')]=_[_0x16f7('0x42')](db[_0x16f7('0x49')]['rawAttributes']);_0x384f77['query']=_[_0x16f7('0x42')](_0x30eff5[_0x16f7('0x2c')]);_0x384f77[_0x16f7('0x2d')]=_[_0x16f7('0x43')](_0x384f77[_0x16f7('0x2b')],_0x384f77[_0x16f7('0x2c')]);_0x100a18[_0x16f7('0x2e')]=_[_0x16f7('0x43')](_0x384f77[_0x16f7('0x2b')],qs[_0x16f7('0x2f')](_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x2f')]));_0x100a18[_0x16f7('0x2e')]=_0x100a18['attributes']['length']?_0x100a18['attributes']:_0x384f77[_0x16f7('0x2b')];_0x100a18[_0x16f7('0x32')]=qs[_0x16f7('0x33')](_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x33')]);_0x100a18[_0x16f7('0x34')]=qs[_0x16f7('0x2d')](_['pick'](_0x30eff5['query'],_0x384f77[_0x16f7('0x2d')]));if(_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x36')]){_0x100a18[_0x16f7('0x34')]=_[_0x16f7('0x37')](_0x100a18[_0x16f7('0x34')],{'$or':_[_0x16f7('0x38')](_0x100a18[_0x16f7('0x2e')],function(_0x3143b5){var _0x102220={};_0x102220[_0x3143b5]={'$like':'%'+_0x30eff5['query'][_0x16f7('0x36')]+'%'};return _0x102220;})});}_0x100a18=_[_0x16f7('0x37')]({},_0x100a18,_0x30eff5[_0x16f7('0x3a')]);return _0x1cdce4[_0x16f7('0x4a')](_0x100a18);}})[_0x16f7('0x21')](function(_0x586ecc){if(_0x586ecc){_0x398f22=_0x586ecc[_0x16f7('0x44')];if(!_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x30')](_0x16f7('0x31'))){_0x100a18['limit']=qs['limit'](_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x1b')]);_0x100a18['offset']=qs[_0x16f7('0x19')](_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x19')]);}return _0x1cdce4[_0x16f7('0x4a')](_0x100a18);}})[_0x16f7('0x21')](function(_0xe56300){if(_0xe56300){return _0xe56300?{'count':_0x398f22,'rows':_0xe56300}:null;}})[_0x16f7('0x21')](respondWithResult(_0x3dacfe,null))[_0x16f7('0x3f')](handleError(_0x3dacfe,null));};exports['getDescriptions']=function(_0x59d443,_0x3fe9d2,_0x3417ec){var _0x37ba74={};var _0x39809c={};var _0x524d69;var _0x22e688;return db['VtigerConfiguration'][_0x16f7('0x48')]({'where':{'id':_0x59d443[_0x16f7('0x41')]['id']}})[_0x16f7('0x21')](handleEntityNotFound(_0x3fe9d2,null))[_0x16f7('0x21')](function(_0x26887f){if(_0x26887f){_0x524d69=_0x26887f;_0x39809c[_0x16f7('0x2b')]=_[_0x16f7('0x42')](db['VtigerField'][_0x16f7('0x28')]);_0x39809c['query']=_['keys'](_0x59d443[_0x16f7('0x2c')]);_0x39809c[_0x16f7('0x2d')]=_[_0x16f7('0x43')](_0x39809c[_0x16f7('0x2b')],_0x39809c['query']);_0x37ba74[_0x16f7('0x2e')]=_['intersection'](_0x39809c['model'],qs[_0x16f7('0x2f')](_0x59d443[_0x16f7('0x2c')][_0x16f7('0x2f')]));_0x37ba74[_0x16f7('0x2e')]=_0x37ba74['attributes'][_0x16f7('0x44')]?_0x37ba74[_0x16f7('0x2e')]:_0x39809c[_0x16f7('0x2b')];_0x37ba74['order']=qs['sort'](_0x59d443[_0x16f7('0x2c')][_0x16f7('0x33')]);_0x37ba74['where']=qs['filters'](_[_0x16f7('0x35')](_0x59d443[_0x16f7('0x2c')],_0x39809c[_0x16f7('0x2d')]));if(_0x59d443[_0x16f7('0x2c')][_0x16f7('0x36')]){_0x37ba74[_0x16f7('0x34')]=_[_0x16f7('0x37')](_0x37ba74[_0x16f7('0x34')],{'$or':_[_0x16f7('0x38')](_0x37ba74[_0x16f7('0x2e')],function(_0x5d4a1c){var _0x3913bb={};_0x3913bb[_0x5d4a1c]={'$like':'%'+_0x59d443[_0x16f7('0x2c')]['filter']+'%'};return _0x3913bb;})});}_0x37ba74=_[_0x16f7('0x37')]({},_0x37ba74,_0x59d443[_0x16f7('0x3a')]);return _0x524d69[_0x16f7('0x4b')](_0x37ba74);}})[_0x16f7('0x21')](function(_0x568c37){if(_0x568c37){_0x22e688=_0x568c37[_0x16f7('0x44')];if(!_0x59d443[_0x16f7('0x2c')][_0x16f7('0x30')]('nolimit')){_0x37ba74['limit']=qs[_0x16f7('0x1b')](_0x59d443[_0x16f7('0x2c')][_0x16f7('0x1b')]);_0x37ba74[_0x16f7('0x19')]=qs[_0x16f7('0x19')](_0x59d443[_0x16f7('0x2c')][_0x16f7('0x19')]);}return _0x524d69[_0x16f7('0x4b')](_0x37ba74);}})[_0x16f7('0x21')](function(_0x3ebdc7){if(_0x3ebdc7){return _0x3ebdc7?{'count':_0x22e688,'rows':_0x3ebdc7}:null;}})[_0x16f7('0x21')](respondWithResult(_0x3fe9d2,null))[_0x16f7('0x3f')](handleError(_0x3fe9d2,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 5f3f349..1613ed6 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 _0xca67=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x7236,_0x592af3){var _0x2a352e=function(_0x104cd3){while(--_0x104cd3){_0x7236['push'](_0x7236['shift']());}};_0x2a352e(++_0x592af3);}(_0xca67,0x8e));var _0x7ca6=function(_0xfca746,_0x2425d9){_0xfca746=_0xfca746-0x0;var _0x1faa60=_0xca67[_0xfca746];return _0x1faa60;};'use strict';var _=require(_0x7ca6('0x0'));var util=require(_0x7ca6('0x1'));var logger=require(_0x7ca6('0x2'))(_0x7ca6('0x3'));var moment=require(_0x7ca6('0x4'));var BPromise=require(_0x7ca6('0x5'));var rp=require(_0x7ca6('0x6'));var fs=require('fs');var path=require(_0x7ca6('0x7'));var rimraf=require('rimraf');var config=require(_0x7ca6('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x7ca6('0x9')]=function(_0x389500,_0xb46715){return _0x389500['define'](_0x7ca6('0xa'),attributes,{'tableName':_0x7ca6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd411=['../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x362025,_0x4fac75){var _0x5e2813=function(_0x46a735){while(--_0x46a735){_0x362025['push'](_0x362025['shift']());}};_0x5e2813(++_0x4fac75);}(_0xd411,0x123));var _0x1d41=function(_0x11c8cc,_0x432c14){_0x11c8cc=_0x11c8cc-0x0;var _0x31d2e3=_0xd411[_0x11c8cc];return _0x31d2e3;};'use strict';var _=require(_0x1d41('0x0'));var util=require(_0x1d41('0x1'));var logger=require(_0x1d41('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1d41('0x3'));var rp=require(_0x1d41('0x4'));var fs=require('fs');var path=require(_0x1d41('0x5'));var rimraf=require('rimraf');var config=require(_0x1d41('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x1d41('0x7')]=function(_0x456695,_0x3055f6){return _0x456695[_0x1d41('0x8')](_0x1d41('0x9'),attributes,{'tableName':_0x1d41('0xa'),'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 3707bc0..04bcd20 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 _0x0c8b=['error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x30be97,_0x3ea719){var _0x1d3a90=function(_0x512e8a){while(--_0x512e8a){_0x30be97['push'](_0x30be97['shift']());}};_0x1d3a90(++_0x3ea719);}(_0x0c8b,0x91));var _0xb0c8=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x0c8b[_0x411add];return _0x238242;};'use strict';var _=require('lodash');var util=require(_0xb0c8('0x0'));var moment=require(_0xb0c8('0x1'));var BPromise=require('bluebird');var rs=require(_0xb0c8('0x2'));var fs=require('fs');var Redis=require(_0xb0c8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb0c8('0x4'));var logger=require(_0xb0c8('0x5'))(_0xb0c8('0x6'));var config=require('../../config/environment');var jayson=require(_0xb0c8('0x7'));var client=jayson[_0xb0c8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15b261,_0x42f769,_0x4b1b28){return new BPromise(function(_0x2df031,_0x51f9c2){return client['request'](_0x15b261,_0x4b1b28)['then'](function(_0x4b2316){logger[_0xb0c8('0x9')](_0xb0c8('0xa'),_0x42f769,_0xb0c8('0xb'));logger[_0xb0c8('0xc')](_0xb0c8('0xd'),_0x42f769,_0xb0c8('0xb'),JSON[_0xb0c8('0xe')](_0x4b2316));if(_0x4b2316['error']){if(_0x4b2316[_0xb0c8('0xf')][_0xb0c8('0x10')]===0x1f4){logger[_0xb0c8('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x42f769,_0x4b2316[_0xb0c8('0xf')][_0xb0c8('0x11')]);return _0x51f9c2(_0x4b2316[_0xb0c8('0xf')][_0xb0c8('0x11')]);}logger[_0xb0c8('0xf')](_0xb0c8('0xa'),_0x42f769,_0x4b2316[_0xb0c8('0xf')]['message']);return _0x2df031(_0x4b2316['error'][_0xb0c8('0x11')]);}else{logger[_0xb0c8('0x9')](_0xb0c8('0xa'),_0x42f769,_0xb0c8('0xb'));_0x2df031(_0x4b2316[_0xb0c8('0x12')][_0xb0c8('0x11')]);}})[_0xb0c8('0x13')](function(_0x1ac1f6){logger[_0xb0c8('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x42f769,_0x1ac1f6);_0x51f9c2(_0x1ac1f6);});});} \ No newline at end of file +var _0x8ad6=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x1ac457,_0x273b95){var _0x3c3eb9=function(_0x506243){while(--_0x506243){_0x1ac457['push'](_0x1ac457['shift']());}};_0x3c3eb9(++_0x273b95);}(_0x8ad6,0x1ba));var _0x68ad=function(_0x241729,_0x5dd277){_0x241729=_0x241729-0x0;var _0x31453f=_0x8ad6[_0x241729];return _0x31453f;};'use strict';var _=require('lodash');var util=require(_0x68ad('0x0'));var moment=require(_0x68ad('0x1'));var BPromise=require(_0x68ad('0x2'));var rs=require(_0x68ad('0x3'));var fs=require('fs');var Redis=require(_0x68ad('0x4'));var db=require(_0x68ad('0x5'))['db'];var utils=require(_0x68ad('0x6'));var logger=require(_0x68ad('0x7'))(_0x68ad('0x8'));var config=require(_0x68ad('0x9'));var jayson=require(_0x68ad('0xa'));var client=jayson[_0x68ad('0xb')][_0x68ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x529515,_0x37c0a9,_0x3e5a44){return new BPromise(function(_0x1997f7,_0x350631){return client[_0x68ad('0xd')](_0x529515,_0x3e5a44)['then'](function(_0x30d118){logger[_0x68ad('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x37c0a9,_0x68ad('0xf'));logger[_0x68ad('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x37c0a9,_0x68ad('0xf'),JSON['stringify'](_0x30d118));if(_0x30d118[_0x68ad('0x11')]){if(_0x30d118[_0x68ad('0x11')][_0x68ad('0x12')]===0x1f4){logger[_0x68ad('0x11')](_0x68ad('0x13'),_0x37c0a9,_0x30d118[_0x68ad('0x11')][_0x68ad('0x14')]);return _0x350631(_0x30d118[_0x68ad('0x11')][_0x68ad('0x14')]);}logger[_0x68ad('0x11')](_0x68ad('0x13'),_0x37c0a9,_0x30d118[_0x68ad('0x11')][_0x68ad('0x14')]);return _0x1997f7(_0x30d118[_0x68ad('0x11')][_0x68ad('0x14')]);}else{logger[_0x68ad('0xe')](_0x68ad('0x13'),_0x37c0a9,'request\x20sent');_0x1997f7(_0x30d118[_0x68ad('0x15')][_0x68ad('0x14')]);}})['catch'](function(_0x1cbd2e){logger[_0x68ad('0x11')](_0x68ad('0x13'),_0x37c0a9,_0x1cbd2e);_0x350631(_0x1cbd2e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4ca7f5e..3f45b28 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 _0x09a9=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller','index','get','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x52dce6,_0x69d474){var _0x54f92a=function(_0x10953f){while(--_0x10953f){_0x52dce6['push'](_0x52dce6['shift']());}};_0x54f92a(++_0x69d474);}(_0x09a9,0x133));var _0x909a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x09a9[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x909a('0x0'));var util=require(_0x909a('0x1'));var path=require('path');var timeout=require(_0x909a('0x2'));var express=require('express');var router=express[_0x909a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x909a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x909a('0x5'));var controller=require(_0x909a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x909a('0x7')]);router[_0x909a('0x8')](_0x909a('0x9'),auth[_0x909a('0xa')](),controller[_0x909a('0xb')]);router[_0x909a('0xc')]('/',auth[_0x909a('0xa')](),controller[_0x909a('0xd')]);router['put']('/:id',auth[_0x909a('0xa')](),controller[_0x909a('0xe')]);router[_0x909a('0xf')](_0x909a('0x9'),auth['isAuthenticated'](),controller[_0x909a('0x10')]);module[_0x909a('0x11')]=router; \ No newline at end of file +var _0x5fe4=['destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','put','/:id','update','delete'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x5fe4,0x189));var _0x45fe=function(_0x28383d,_0x4c101e){_0x28383d=_0x28383d-0x0;var _0x2e919e=_0x5fe4[_0x28383d];return _0x2e919e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x45fe('0x0'));var timeout=require(_0x45fe('0x1'));var express=require(_0x45fe('0x2'));var router=express['Router']();var fs_extra=require(_0x45fe('0x3'));var auth=require(_0x45fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x45fe('0x5'));var controller=require('./intVtigerField.controller');router[_0x45fe('0x6')]('/',auth['isAuthenticated'](),controller[_0x45fe('0x7')]);router['get']('/:id',auth[_0x45fe('0x8')](),controller[_0x45fe('0x9')]);router[_0x45fe('0xa')]('/',auth[_0x45fe('0x8')](),controller['create']);router[_0x45fe('0xb')](_0x45fe('0xc'),auth[_0x45fe('0x8')](),controller[_0x45fe('0xd')]);router[_0x45fe('0xe')](_0x45fe('0xc'),auth['isAuthenticated'](),controller[_0x45fe('0xf')]);module[_0x45fe('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 6519879..fe29959 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 _0x959f=['keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x959f,0xc4));var _0xf959=function(_0x1c883b,_0x538863){_0x1c883b=_0x1c883b-0x0;var _0x364c9b=_0x959f[_0x1c883b];return _0x364c9b;};'use strict';var Sequelize=require(_0xf959('0x0'));module[_0xf959('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xf959('0x2'),_0xf959('0x3'),_0xf959('0x4'),_0xf959('0x5')),'defaultValue':_0xf959('0x6')},'content':{'type':Sequelize[_0xf959('0x7')]},'key':{'type':Sequelize[_0xf959('0x7')]},'keyType':{'type':Sequelize[_0xf959('0x8')](_0xf959('0x6'),_0xf959('0x2'),_0xf959('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf959('0x7')]},'customField':{'type':Sequelize[_0xf959('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf959('0x7')]}}; \ No newline at end of file +var _0x8099=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0xc8c4b0,_0x240c34){var _0x21700e=function(_0x195a55){while(--_0x195a55){_0xc8c4b0['push'](_0xc8c4b0['shift']());}};_0x21700e(++_0x240c34);}(_0x8099,0x1d1));var _0x9809=function(_0x5dfb04,_0xee57d1){_0x5dfb04=_0x5dfb04-0x0;var _0x58f52a=_0x8099[_0x5dfb04];return _0x58f52a;};'use strict';var Sequelize=require(_0x9809('0x0'));module[_0x9809('0x1')]={'type':{'type':Sequelize[_0x9809('0x2')](_0x9809('0x3'),_0x9809('0x4'),_0x9809('0x5'),_0x9809('0x6'),_0x9809('0x7')),'defaultValue':_0x9809('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9809('0x2')](_0x9809('0x3'),_0x9809('0x4'),_0x9809('0x5'))},'keyContent':{'type':Sequelize[_0x9809('0x8')]},'idField':{'type':Sequelize[_0x9809('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9809('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9809('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9a0565b..e9eff05 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 _0x2d76=['save','update','then','destroy','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x4c2fe6,_0x30d325){var _0x1de23a=function(_0x527f18){while(--_0x527f18){_0x4c2fe6['push'](_0x4c2fe6['shift']());}};_0x1de23a(++_0x30d325);}(_0x2d76,0x117));var _0x62d7=function(_0x226155,_0x11670e){_0x226155=_0x226155-0x0;var _0x3056c8=_0x2d76[_0x226155];return _0x3056c8;};'use strict';var emlformat=require(_0x62d7('0x0'));var rimraf=require(_0x62d7('0x1'));var zipdir=require(_0x62d7('0x2'));var jsonpatch=require(_0x62d7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x62d7('0x4'));var Mustache=require('mustache');var util=require(_0x62d7('0x5'));var path=require(_0x62d7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x62d7('0x7'));var fs=require('fs');var fs_extra=require(_0x62d7('0x8'));var _=require(_0x62d7('0x9'));var squel=require('squel');var crypto=require(_0x62d7('0xa'));var jsforce=require(_0x62d7('0xb'));var deskjs=require(_0x62d7('0xc'));var toCsv=require(_0x62d7('0xd'));var querystring=require(_0x62d7('0xe'));var Papa=require(_0x62d7('0xf'));var Redis=require(_0x62d7('0x10'));var authService=require(_0x62d7('0x11'));var qs=require(_0x62d7('0x12'));var as=require(_0x62d7('0x13'));var hardwareService=require(_0x62d7('0x14'));var logger=require(_0x62d7('0x15'))(_0x62d7('0x16'));var utils=require(_0x62d7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x62d7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfd0231,_0x5bb82a){_0x5bb82a=_0x5bb82a||0xcc;return function(_0x2957de){if(_0x2957de){return _0xfd0231[_0x62d7('0x19')](_0x5bb82a);}return _0xfd0231[_0x62d7('0x1a')](_0x5bb82a)[_0x62d7('0x1b')]();};}function respondWithResult(_0x1d23d2,_0x317691){_0x317691=_0x317691||0xc8;return function(_0x5f15e8){if(_0x5f15e8){return _0x1d23d2['status'](_0x317691)[_0x62d7('0x1c')](_0x5f15e8);}};}function respondWithFilteredResult(_0x20b4d8,_0x13e8f2){return function(_0x1d6277){if(_0x1d6277){var _0x2cac55=typeof _0x13e8f2[_0x62d7('0x1d')]===_0x62d7('0x1e')&&typeof _0x13e8f2[_0x62d7('0x1f')]===_0x62d7('0x1e');var _0x3645b0=_0x1d6277[_0x62d7('0x20')];var _0x368360=_0x2cac55?0x0:_0x13e8f2[_0x62d7('0x1d')];var _0x558812=_0x2cac55?_0x1d6277[_0x62d7('0x20')]:_0x13e8f2[_0x62d7('0x1d')]+_0x13e8f2[_0x62d7('0x1f')];var _0x26fd4e;if(_0x558812>=_0x3645b0){_0x558812=_0x3645b0;_0x26fd4e=0xc8;}else{_0x26fd4e=0xce;}_0x20b4d8[_0x62d7('0x1a')](_0x26fd4e);return _0x20b4d8[_0x62d7('0x21')](_0x62d7('0x22'),_0x368360+'-'+_0x558812+'/'+_0x3645b0)[_0x62d7('0x1c')](_0x1d6277);}return null;};}function patchUpdates(_0x3851b2){return function(_0x3dc9ed){try{jsonpatch[_0x62d7('0x23')](_0x3dc9ed,_0x3851b2,!![]);}catch(_0x2372d2){return BPromise[_0x62d7('0x24')](_0x2372d2);}return _0x3dc9ed[_0x62d7('0x25')]();};}function saveUpdates(_0x5de7ad,_0x39b0c0){return function(_0x334f18){if(_0x334f18){return _0x334f18[_0x62d7('0x26')](_0x5de7ad)[_0x62d7('0x27')](function(_0x4980b7){return _0x4980b7;});}return null;};}function removeEntity(_0x56c6c8,_0x40380b){return function(_0x3ee0c0){if(_0x3ee0c0){return _0x3ee0c0[_0x62d7('0x28')]()[_0x62d7('0x27')](function(){_0x56c6c8[_0x62d7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d63e2,_0x815d1e){return function(_0x3acdca){if(!_0x3acdca){_0x5d63e2['sendStatus'](0x194);}return _0x3acdca;};}function handleError(_0x4a82ba,_0x3b70b6){_0x3b70b6=_0x3b70b6||0x1f4;return function(_0x1ccbc8){logger[_0x62d7('0x29')](_0x1ccbc8[_0x62d7('0x2a')]);if(_0x1ccbc8[_0x62d7('0x2b')]){delete _0x1ccbc8[_0x62d7('0x2b')];}_0x4a82ba['status'](_0x3b70b6)[_0x62d7('0x2c')](_0x1ccbc8);};}exports['index']=function(_0x480a56,_0x3408f7){var _0x587b3c={},_0x12f56a={},_0x148767={'count':0x0,'rows':[]};var _0xdddbf=_[_0x62d7('0x2d')](db[_0x62d7('0x2e')][_0x62d7('0x2f')],function(_0x4932a5){return{'name':_0x4932a5[_0x62d7('0x30')],'type':_0x4932a5[_0x62d7('0x31')][_0x62d7('0x32')]};});_0x12f56a[_0x62d7('0x33')]=_[_0x62d7('0x2d')](_0xdddbf,'name');_0x12f56a['query']=_['keys'](_0x480a56[_0x62d7('0x34')]);_0x12f56a[_0x62d7('0x35')]=_[_0x62d7('0x36')](_0x12f56a['model'],_0x12f56a['query']);_0x587b3c['attributes']=_['intersection'](_0x12f56a[_0x62d7('0x33')],qs[_0x62d7('0x37')](_0x480a56['query'][_0x62d7('0x37')]));_0x587b3c[_0x62d7('0x38')]=_0x587b3c[_0x62d7('0x38')][_0x62d7('0x39')]?_0x587b3c['attributes']:_0x12f56a['model'];if(!_0x480a56['query'][_0x62d7('0x3a')](_0x62d7('0x3b'))){_0x587b3c[_0x62d7('0x1f')]=qs[_0x62d7('0x1f')](_0x480a56[_0x62d7('0x34')]['limit']);_0x587b3c[_0x62d7('0x1d')]=qs[_0x62d7('0x1d')](_0x480a56[_0x62d7('0x34')]['offset']);}_0x587b3c[_0x62d7('0x3c')]=qs['sort'](_0x480a56[_0x62d7('0x34')][_0x62d7('0x3d')]);_0x587b3c['where']=qs[_0x62d7('0x35')](_[_0x62d7('0x3e')](_0x480a56[_0x62d7('0x34')],_0x12f56a['filters']),_0xdddbf);if(_0x480a56[_0x62d7('0x34')][_0x62d7('0x3f')]){_0x587b3c[_0x62d7('0x40')]=_[_0x62d7('0x41')](_0x587b3c[_0x62d7('0x40')],{'$or':_['map'](_0xdddbf,function(_0x1540f){if(_0x1540f['type']!==_0x62d7('0x42')){var _0x2c5db2={};_0x2c5db2[_0x1540f['name']]={'$like':'%'+_0x480a56[_0x62d7('0x34')]['filter']+'%'};return _0x2c5db2;}})});}_0x587b3c=_[_0x62d7('0x41')]({},_0x587b3c,_0x480a56[_0x62d7('0x43')]);var _0x536661={'where':_0x587b3c['where']};return db[_0x62d7('0x2e')]['count'](_0x536661)[_0x62d7('0x27')](function(_0x129a88){_0x148767[_0x62d7('0x20')]=_0x129a88;if(_0x480a56[_0x62d7('0x34')][_0x62d7('0x44')]){_0x587b3c['include']=[{'all':!![]}];}return db['VtigerField'][_0x62d7('0x45')](_0x587b3c);})[_0x62d7('0x27')](function(_0x3772a2){_0x148767[_0x62d7('0x46')]=_0x3772a2;return _0x148767;})[_0x62d7('0x27')](respondWithFilteredResult(_0x3408f7,_0x587b3c))['catch'](handleError(_0x3408f7,null));};exports[_0x62d7('0x47')]=function(_0x25f51d,_0x3572fd){var _0x3142cb={'raw':!![],'where':{'id':_0x25f51d[_0x62d7('0x48')]['id']}},_0x2b2ed3={};_0x2b2ed3[_0x62d7('0x33')]=_['keys'](db[_0x62d7('0x2e')][_0x62d7('0x2f')]);_0x2b2ed3[_0x62d7('0x34')]=_[_0x62d7('0x49')](_0x25f51d[_0x62d7('0x34')]);_0x2b2ed3['filters']=_[_0x62d7('0x36')](_0x2b2ed3[_0x62d7('0x33')],_0x2b2ed3[_0x62d7('0x34')]);_0x3142cb[_0x62d7('0x38')]=_['intersection'](_0x2b2ed3['model'],qs[_0x62d7('0x37')](_0x25f51d[_0x62d7('0x34')]['fields']));_0x3142cb['attributes']=_0x3142cb[_0x62d7('0x38')][_0x62d7('0x39')]?_0x3142cb['attributes']:_0x2b2ed3[_0x62d7('0x33')];if(_0x25f51d[_0x62d7('0x34')][_0x62d7('0x44')]){_0x3142cb[_0x62d7('0x4a')]=[{'all':!![]}];}_0x3142cb=_[_0x62d7('0x41')]({},_0x3142cb,_0x25f51d[_0x62d7('0x43')]);return db[_0x62d7('0x2e')][_0x62d7('0x4b')](_0x3142cb)[_0x62d7('0x27')](handleEntityNotFound(_0x3572fd,null))['then'](respondWithResult(_0x3572fd,null))['catch'](handleError(_0x3572fd,null));};exports[_0x62d7('0x4c')]=function(_0x3ec4e7,_0x8c1a96){return db[_0x62d7('0x2e')][_0x62d7('0x4c')](_0x3ec4e7[_0x62d7('0x4d')],{})[_0x62d7('0x27')](respondWithResult(_0x8c1a96,0xc9))[_0x62d7('0x4e')](handleError(_0x8c1a96,null));};exports[_0x62d7('0x26')]=function(_0x2fbb97,_0x92ff10){if(_0x2fbb97[_0x62d7('0x4d')]['id']){delete _0x2fbb97[_0x62d7('0x4d')]['id'];}return db['VtigerField'][_0x62d7('0x4b')]({'where':{'id':_0x2fbb97['params']['id']}})[_0x62d7('0x27')](handleEntityNotFound(_0x92ff10,null))['then'](saveUpdates(_0x2fbb97['body'],null))['then'](respondWithResult(_0x92ff10,null))[_0x62d7('0x4e')](handleError(_0x92ff10,null));};exports[_0x62d7('0x28')]=function(_0x56e8fd,_0x48f41c){return db[_0x62d7('0x2e')]['find']({'where':{'id':_0x56e8fd['params']['id']}})[_0x62d7('0x27')](handleEntityNotFound(_0x48f41c,null))[_0x62d7('0x27')](removeEntity(_0x48f41c,null))[_0x62d7('0x4e')](handleError(_0x48f41c,null));}; \ No newline at end of file +var _0x9326=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x18f3a3,_0x4470bc){var _0x1351d8=function(_0x50f113){while(--_0x50f113){_0x18f3a3['push'](_0x18f3a3['shift']());}};_0x1351d8(++_0x4470bc);}(_0x9326,0xd7));var _0x6932=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x9326[_0x5ee3d3];return _0x4b272f;};'use strict';var emlformat=require(_0x6932('0x0'));var rimraf=require(_0x6932('0x1'));var zipdir=require(_0x6932('0x2'));var jsonpatch=require(_0x6932('0x3'));var rp=require(_0x6932('0x4'));var moment=require(_0x6932('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6932('0x6'));var util=require(_0x6932('0x7'));var path=require('path');var sox=require(_0x6932('0x8'));var csv=require(_0x6932('0x9'));var ejs=require(_0x6932('0xa'));var fs=require('fs');var fs_extra=require(_0x6932('0xb'));var _=require(_0x6932('0xc'));var squel=require(_0x6932('0xd'));var crypto=require(_0x6932('0xe'));var jsforce=require(_0x6932('0xf'));var deskjs=require(_0x6932('0x10'));var toCsv=require(_0x6932('0x9'));var querystring=require(_0x6932('0x11'));var Papa=require('papaparse');var Redis=require(_0x6932('0x12'));var authService=require(_0x6932('0x13'));var qs=require(_0x6932('0x14'));var as=require(_0x6932('0x15'));var hardwareService=require(_0x6932('0x16'));var logger=require('../../config/logger')(_0x6932('0x17'));var utils=require(_0x6932('0x18'));var config=require(_0x6932('0x19'));var licenseUtil=require(_0x6932('0x1a'));var db=require(_0x6932('0x1b'))['db'];function respondWithStatusCode(_0x13ae0d,_0x5ac1fb){_0x5ac1fb=_0x5ac1fb||0xcc;return function(_0x22139c){if(_0x22139c){return _0x13ae0d[_0x6932('0x1c')](_0x5ac1fb);}return _0x13ae0d[_0x6932('0x1d')](_0x5ac1fb)['end']();};}function respondWithResult(_0xa83e22,_0x9fe7cc){_0x9fe7cc=_0x9fe7cc||0xc8;return function(_0x59b486){if(_0x59b486){return _0xa83e22[_0x6932('0x1d')](_0x9fe7cc)[_0x6932('0x1e')](_0x59b486);}};}function respondWithFilteredResult(_0x1db7aa,_0x1c1ab8){return function(_0x393309){if(_0x393309){var _0x3f4645=typeof _0x1c1ab8[_0x6932('0x1f')]==='undefined'&&typeof _0x1c1ab8[_0x6932('0x20')]==='undefined';var _0x5be8ba=_0x393309[_0x6932('0x21')];var _0x7f4e4d=_0x3f4645?0x0:_0x1c1ab8[_0x6932('0x1f')];var _0x330322=_0x3f4645?_0x393309[_0x6932('0x21')]:_0x1c1ab8[_0x6932('0x1f')]+_0x1c1ab8[_0x6932('0x20')];var _0x3c4642;if(_0x330322>=_0x5be8ba){_0x330322=_0x5be8ba;_0x3c4642=0xc8;}else{_0x3c4642=0xce;}_0x1db7aa[_0x6932('0x1d')](_0x3c4642);return _0x1db7aa['set'](_0x6932('0x22'),_0x7f4e4d+'-'+_0x330322+'/'+_0x5be8ba)[_0x6932('0x1e')](_0x393309);}return null;};}function patchUpdates(_0x4eff69){return function(_0x2e1df2){try{jsonpatch[_0x6932('0x23')](_0x2e1df2,_0x4eff69,!![]);}catch(_0x507b5b){return BPromise[_0x6932('0x24')](_0x507b5b);}return _0x2e1df2[_0x6932('0x25')]();};}function saveUpdates(_0x12c2e,_0x33ccff){return function(_0x3ab508){if(_0x3ab508){return _0x3ab508[_0x6932('0x26')](_0x12c2e)['then'](function(_0x12e4eb){return _0x12e4eb;});}return null;};}function removeEntity(_0x38f8b3,_0x274bb3){return function(_0x588cf1){if(_0x588cf1){return _0x588cf1[_0x6932('0x27')]()[_0x6932('0x28')](function(){_0x38f8b3[_0x6932('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e106,_0x471310){return function(_0x3a2dd2){if(!_0x3a2dd2){_0x34e106['sendStatus'](0x194);}return _0x3a2dd2;};}function handleError(_0x527d08,_0x4b4206){_0x4b4206=_0x4b4206||0x1f4;return function(_0x3bd6c7){logger[_0x6932('0x29')](_0x3bd6c7[_0x6932('0x2a')]);if(_0x3bd6c7[_0x6932('0x2b')]){delete _0x3bd6c7[_0x6932('0x2b')];}_0x527d08[_0x6932('0x1d')](_0x4b4206)[_0x6932('0x2c')](_0x3bd6c7);};}exports[_0x6932('0x2d')]=function(_0x1e538c,_0x207704){var _0x205162={},_0x489fa2={},_0xb86f79={'count':0x0,'rows':[]};var _0x24840d=_['map'](db[_0x6932('0x2e')][_0x6932('0x2f')],function(_0x3a48f7){return{'name':_0x3a48f7[_0x6932('0x30')],'type':_0x3a48f7[_0x6932('0x31')][_0x6932('0x32')]};});_0x489fa2[_0x6932('0x33')]=_['map'](_0x24840d,_0x6932('0x2b'));_0x489fa2['query']=_[_0x6932('0x34')](_0x1e538c[_0x6932('0x35')]);_0x489fa2[_0x6932('0x36')]=_['intersection'](_0x489fa2['model'],_0x489fa2[_0x6932('0x35')]);_0x205162[_0x6932('0x37')]=_['intersection'](_0x489fa2[_0x6932('0x33')],qs[_0x6932('0x38')](_0x1e538c[_0x6932('0x35')][_0x6932('0x38')]));_0x205162['attributes']=_0x205162[_0x6932('0x37')][_0x6932('0x39')]?_0x205162['attributes']:_0x489fa2[_0x6932('0x33')];if(!_0x1e538c[_0x6932('0x35')][_0x6932('0x3a')](_0x6932('0x3b'))){_0x205162[_0x6932('0x20')]=qs['limit'](_0x1e538c['query'][_0x6932('0x20')]);_0x205162[_0x6932('0x1f')]=qs[_0x6932('0x1f')](_0x1e538c[_0x6932('0x35')][_0x6932('0x1f')]);}_0x205162[_0x6932('0x3c')]=qs[_0x6932('0x3d')](_0x1e538c[_0x6932('0x35')]['sort']);_0x205162['where']=qs[_0x6932('0x36')](_[_0x6932('0x3e')](_0x1e538c['query'],_0x489fa2[_0x6932('0x36')]),_0x24840d);if(_0x1e538c[_0x6932('0x35')][_0x6932('0x3f')]){_0x205162[_0x6932('0x40')]=_[_0x6932('0x41')](_0x205162[_0x6932('0x40')],{'$or':_[_0x6932('0x42')](_0x24840d,function(_0x4e90d3){if(_0x4e90d3[_0x6932('0x31')]!==_0x6932('0x43')){var _0x46e1b1={};_0x46e1b1[_0x4e90d3[_0x6932('0x2b')]]={'$like':'%'+_0x1e538c[_0x6932('0x35')]['filter']+'%'};return _0x46e1b1;}})});}_0x205162=_['merge']({},_0x205162,_0x1e538c[_0x6932('0x44')]);var _0x3aba5b={'where':_0x205162[_0x6932('0x40')]};return db[_0x6932('0x2e')][_0x6932('0x21')](_0x3aba5b)['then'](function(_0xa45818){_0xb86f79['count']=_0xa45818;if(_0x1e538c['query'][_0x6932('0x45')]){_0x205162[_0x6932('0x46')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x205162);})['then'](function(_0x518f86){_0xb86f79[_0x6932('0x47')]=_0x518f86;return _0xb86f79;})[_0x6932('0x28')](respondWithFilteredResult(_0x207704,_0x205162))[_0x6932('0x48')](handleError(_0x207704,null));};exports['show']=function(_0x1150ce,_0x409a96){var _0x5055ac={'raw':!![],'where':{'id':_0x1150ce[_0x6932('0x49')]['id']}},_0x1705e={};_0x1705e['model']=_[_0x6932('0x34')](db['VtigerField'][_0x6932('0x2f')]);_0x1705e[_0x6932('0x35')]=_[_0x6932('0x34')](_0x1150ce['query']);_0x1705e[_0x6932('0x36')]=_[_0x6932('0x4a')](_0x1705e['model'],_0x1705e[_0x6932('0x35')]);_0x5055ac['attributes']=_['intersection'](_0x1705e[_0x6932('0x33')],qs[_0x6932('0x38')](_0x1150ce['query'][_0x6932('0x38')]));_0x5055ac[_0x6932('0x37')]=_0x5055ac[_0x6932('0x37')][_0x6932('0x39')]?_0x5055ac[_0x6932('0x37')]:_0x1705e[_0x6932('0x33')];if(_0x1150ce[_0x6932('0x35')][_0x6932('0x45')]){_0x5055ac[_0x6932('0x46')]=[{'all':!![]}];}_0x5055ac=_[_0x6932('0x41')]({},_0x5055ac,_0x1150ce['options']);return db[_0x6932('0x2e')][_0x6932('0x4b')](_0x5055ac)[_0x6932('0x28')](handleEntityNotFound(_0x409a96,null))[_0x6932('0x28')](respondWithResult(_0x409a96,null))[_0x6932('0x48')](handleError(_0x409a96,null));};exports[_0x6932('0x4c')]=function(_0x2dee81,_0x8c847d){return db[_0x6932('0x2e')][_0x6932('0x4c')](_0x2dee81[_0x6932('0x4d')],{})['then'](respondWithResult(_0x8c847d,0xc9))['catch'](handleError(_0x8c847d,null));};exports[_0x6932('0x26')]=function(_0x49e6f2,_0x294fcd){if(_0x49e6f2[_0x6932('0x4d')]['id']){delete _0x49e6f2[_0x6932('0x4d')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x49e6f2[_0x6932('0x49')]['id']}})[_0x6932('0x28')](handleEntityNotFound(_0x294fcd,null))[_0x6932('0x28')](saveUpdates(_0x49e6f2['body'],null))[_0x6932('0x28')](respondWithResult(_0x294fcd,null))[_0x6932('0x48')](handleError(_0x294fcd,null));};exports[_0x6932('0x27')]=function(_0x27dca6,_0x2421c2){return db[_0x6932('0x2e')][_0x6932('0x4b')]({'where':{'id':_0x27dca6[_0x6932('0x49')]['id']}})[_0x6932('0x28')](handleEntityNotFound(_0x2421c2,null))[_0x6932('0x28')](removeEntity(_0x2421c2,null))[_0x6932('0x48')](handleError(_0x2421c2,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 7ad96ab..178902d 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 _0xb97b=['path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb97b,0x1db));var _0xbb97=function(_0x4f6149,_0x19179e){_0x4f6149=_0x4f6149-0x0;var _0x34ce4d=_0xb97b[_0x4f6149];return _0x34ce4d;};'use strict';var _=require(_0xbb97('0x0'));var util=require(_0xbb97('0x1'));var logger=require(_0xbb97('0x2'))(_0xbb97('0x3'));var moment=require(_0xbb97('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb97('0x5'));var rimraf=require(_0xbb97('0x6'));var config=require(_0xbb97('0x7'));var attributes=require(_0xbb97('0x8'));module[_0xbb97('0x9')]=function(_0x3f9324,_0x27b4f1){return _0x3f9324[_0xbb97('0xa')](_0xbb97('0xb'),attributes,{'tableName':_0xbb97('0xc'),'paranoid':![],'indexes':[{'name':_0xbb97('0xd'),'fields':[_0xbb97('0xe'),_0xbb97('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5801=['moment','bluebird','request-promise','path','rimraf','exports','define','VtigerField','vtiger_unique_index','idField','lodash','../../config/logger'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x5801,0x166));var _0x1580=function(_0x6b998b,_0x4b45da){_0x6b998b=_0x6b998b-0x0;var _0x2f7f8f=_0x5801[_0x6b998b];return _0x2f7f8f;};'use strict';var _=require(_0x1580('0x0'));var util=require('util');var logger=require(_0x1580('0x1'))('api');var moment=require(_0x1580('0x2'));var BPromise=require(_0x1580('0x3'));var rp=require(_0x1580('0x4'));var fs=require('fs');var path=require(_0x1580('0x5'));var rimraf=require(_0x1580('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x1580('0x7')]=function(_0x157ea9,_0x1e29a6){return _0x157ea9[_0x1580('0x8')](_0x1580('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x1580('0xa'),'fields':[_0x1580('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 2ca573a..91a3ea9 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 _0x6797=['request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x6797,0xda));var _0x7679=function(_0x37fac8,_0x290fe0){_0x37fac8=_0x37fac8-0x0;var _0x51edea=_0x6797[_0x37fac8];return _0x51edea;};'use strict';var _=require(_0x7679('0x0'));var util=require(_0x7679('0x1'));var moment=require(_0x7679('0x2'));var BPromise=require(_0x7679('0x3'));var rs=require(_0x7679('0x4'));var fs=require('fs');var Redis=require(_0x7679('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7679('0x6'));var logger=require('../../config/logger')(_0x7679('0x7'));var config=require(_0x7679('0x8'));var jayson=require(_0x7679('0x9'));var client=jayson[_0x7679('0xa')][_0x7679('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x243fbb,_0x52fcaa,_0x1406b3){return new BPromise(function(_0x23e59a,_0x51be53){return client[_0x7679('0xc')](_0x243fbb,_0x1406b3)[_0x7679('0xd')](function(_0xf3f439){logger[_0x7679('0xe')](_0x7679('0xf'),_0x52fcaa,_0x7679('0x10'));logger[_0x7679('0x11')](_0x7679('0x12'),_0x52fcaa,_0x7679('0x10'),JSON['stringify'](_0xf3f439));if(_0xf3f439['error']){if(_0xf3f439[_0x7679('0x13')][_0x7679('0x14')]===0x1f4){logger[_0x7679('0x13')](_0x7679('0xf'),_0x52fcaa,_0xf3f439[_0x7679('0x13')]['message']);return _0x51be53(_0xf3f439[_0x7679('0x13')][_0x7679('0x15')]);}logger['error'](_0x7679('0xf'),_0x52fcaa,_0xf3f439[_0x7679('0x13')][_0x7679('0x15')]);return _0x23e59a(_0xf3f439[_0x7679('0x13')][_0x7679('0x15')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x52fcaa,_0x7679('0x10'));_0x23e59a(_0xf3f439['result'][_0x7679('0x15')]);}})[_0x7679('0x16')](function(_0x473dfb){logger[_0x7679('0x13')](_0x7679('0xf'),_0x52fcaa,_0x473dfb);_0x51be53(_0x473dfb);});});} \ No newline at end of file +var _0x2a18=['info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','message','VtigerField,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x46390e,_0x39d20f){var _0x4db91c=function(_0x2bd91e){while(--_0x2bd91e){_0x46390e['push'](_0x46390e['shift']());}};_0x4db91c(++_0x39d20f);}(_0x2a18,0x64));var _0x82a1=function(_0x7a319d,_0x235959){_0x7a319d=_0x7a319d-0x0;var _0x5c6b4e=_0x2a18[_0x7a319d];return _0x5c6b4e;};'use strict';var _=require(_0x82a1('0x0'));var util=require('util');var moment=require(_0x82a1('0x1'));var BPromise=require(_0x82a1('0x2'));var rs=require(_0x82a1('0x3'));var fs=require('fs');var Redis=require(_0x82a1('0x4'));var db=require(_0x82a1('0x5'))['db'];var utils=require(_0x82a1('0x6'));var logger=require(_0x82a1('0x7'))(_0x82a1('0x8'));var config=require(_0x82a1('0x9'));var jayson=require(_0x82a1('0xa'));var client=jayson[_0x82a1('0xb')][_0x82a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7d5964,_0x5a5f3e,_0x4cb67d){return new BPromise(function(_0x4f9c8e,_0x4d2035){return client[_0x82a1('0xd')](_0x7d5964,_0x4cb67d)[_0x82a1('0xe')](function(_0x3e93bb){logger[_0x82a1('0xf')]('VtigerField,\x20%s,\x20%s',_0x5a5f3e,_0x82a1('0x10'));logger[_0x82a1('0x11')](_0x82a1('0x12'),_0x5a5f3e,'request\x20sent',JSON['stringify'](_0x3e93bb));if(_0x3e93bb[_0x82a1('0x13')]){if(_0x3e93bb['error']['code']===0x1f4){logger[_0x82a1('0x13')]('VtigerField,\x20%s,\x20%s',_0x5a5f3e,_0x3e93bb[_0x82a1('0x13')][_0x82a1('0x14')]);return _0x4d2035(_0x3e93bb[_0x82a1('0x13')][_0x82a1('0x14')]);}logger[_0x82a1('0x13')](_0x82a1('0x15'),_0x5a5f3e,_0x3e93bb[_0x82a1('0x13')]['message']);return _0x4f9c8e(_0x3e93bb[_0x82a1('0x13')][_0x82a1('0x14')]);}else{logger[_0x82a1('0xf')](_0x82a1('0x15'),_0x5a5f3e,_0x82a1('0x10'));_0x4f9c8e(_0x3e93bb['result'][_0x82a1('0x14')]);}})[_0x82a1('0x16')](function(_0x272972){logger[_0x82a1('0x13')](_0x82a1('0x15'),_0x5a5f3e,_0x272972);_0x4d2035(_0x272972);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 1167f51..83b1d0c 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 _0xca13=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x36b021,_0x1c8cff){var _0x348e3d=function(_0x4c99ee){while(--_0x4c99ee){_0x36b021['push'](_0x36b021['shift']());}};_0x348e3d(++_0x1c8cff);}(_0xca13,0x114));var _0x3ca1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca13[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3ca1('0x0'));var util=require(_0x3ca1('0x1'));var path=require(_0x3ca1('0x2'));var timeout=require(_0x3ca1('0x3'));var express=require(_0x3ca1('0x4'));var router=express[_0x3ca1('0x5')]();var fs_extra=require(_0x3ca1('0x6'));var auth=require(_0x3ca1('0x7'));var interaction=require(_0x3ca1('0x8'));var config=require(_0x3ca1('0x9'));var controller=require('./intZendeskAccount.controller');router[_0x3ca1('0xa')]('/',auth[_0x3ca1('0xb')](),controller[_0x3ca1('0xc')]);router[_0x3ca1('0xa')](_0x3ca1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x3ca1('0xa')](_0x3ca1('0xe'),auth[_0x3ca1('0xb')](),controller[_0x3ca1('0xf')]);router['get']('/:id/fields',auth[_0x3ca1('0xb')](),controller[_0x3ca1('0x10')]);router[_0x3ca1('0x11')]('/',auth[_0x3ca1('0xb')](),controller[_0x3ca1('0x12')]);router[_0x3ca1('0x11')](_0x3ca1('0xe'),auth[_0x3ca1('0xb')](),controller[_0x3ca1('0x13')]);router[_0x3ca1('0x14')](_0x3ca1('0xd'),auth[_0x3ca1('0xb')](),controller[_0x3ca1('0x15')]);router[_0x3ca1('0x16')](_0x3ca1('0xd'),auth[_0x3ca1('0xb')](),controller[_0x3ca1('0x17')]);module[_0x3ca1('0x18')]=router; \ No newline at end of file +var _0xc3d5=['fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','/:id','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','create','addConfiguration','update','delete','util'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xc3d5,0x16f));var _0x5c3d=function(_0x13fe61,_0x257256){_0x13fe61=_0x13fe61-0x0;var _0x3c1e9f=_0xc3d5[_0x13fe61];return _0x3c1e9f;};'use strict';var multer=require('multer');var util=require(_0x5c3d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5c3d('0x1'));var auth=require(_0x5c3d('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x5c3d('0x3'));var controller=require(_0x5c3d('0x4'));router[_0x5c3d('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c3d('0x5')](_0x5c3d('0x6'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5c3d('0x7'),auth[_0x5c3d('0x8')](),controller['getConfigurations']);router['get'](_0x5c3d('0x9'),auth['isAuthenticated'](),controller[_0x5c3d('0xa')]);router[_0x5c3d('0xb')]('/',auth[_0x5c3d('0x8')](),controller[_0x5c3d('0xc')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x5c3d('0xd')]);router['put'](_0x5c3d('0x6'),auth[_0x5c3d('0x8')](),controller[_0x5c3d('0xe')]);router[_0x5c3d('0xf')](_0x5c3d('0x6'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1e0e3cc..f88f61c 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 _0x9e2e=['STRING','remoteUri','ENUM','password','token','newTab','integrationTab','sequelize','exports'];(function(_0x3d78c0,_0x4e9a93){var _0x56c03f=function(_0x13bf57){while(--_0x13bf57){_0x3d78c0['push'](_0x3d78c0['shift']());}};_0x56c03f(++_0x4e9a93);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x558b73,_0x4fc3a3){_0x558b73=_0x558b73-0x0;var _0x442948=_0x9e2e[_0x558b73];return _0x442948;};'use strict';var Sequelize=require(_0xe9e2('0x0'));module[_0xe9e2('0x1')]={'name':{'type':Sequelize[_0xe9e2('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe9e2('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe9e2('0x2')]},'remoteUri':{'type':Sequelize[_0xe9e2('0x2')],'unique':_0xe9e2('0x3')},'authType':{'type':Sequelize[_0xe9e2('0x4')](_0xe9e2('0x5'),_0xe9e2('0x6')),'defaultValue':_0xe9e2('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe9e2('0x4')]('integrationTab',_0xe9e2('0x7')),'defaultValue':_0xe9e2('0x8')}}; \ No newline at end of file +var _0x1893=['newTab','STRING','username','ENUM','password','token','integrationTab'];(function(_0x420c7b,_0x289369){var _0x5c2ca3=function(_0x249b9a){while(--_0x249b9a){_0x420c7b['push'](_0x420c7b['shift']());}};_0x5c2ca3(++_0x289369);}(_0x1893,0xa2));var _0x3189=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x1893[_0x31b5b2];return _0x364f13;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'password':{'type':Sequelize[_0x3189('0x0')]},'token':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x3189('0x2')](_0x3189('0x3'),_0x3189('0x4')),'defaultValue':_0x3189('0x3')},'serverUrl':{'type':Sequelize[_0x3189('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x3189('0x2')](_0x3189('0x5'),_0x3189('0x6')),'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 596e442..136272e 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 _0x373d=['ZendeskField','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','base64','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','position','title','system_field_options','custom_field_options','test','stringify','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','ZendeskAccount','rows','catch','show','keys','rawAttributes','find','create','body','params','findOne','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions'];(function(_0xe51920,_0x4a1092){var _0x4e4c70=function(_0x71151){while(--_0x71151){_0xe51920['push'](_0xe51920['shift']());}};_0x4e4c70(++_0x4a1092);}(_0x373d,0x1e2));var _0xd373=function(_0x1ba88a,_0x30b1d8){_0x1ba88a=_0x1ba88a-0x0;var _0x5d0fe7=_0x373d[_0x1ba88a];return _0x5d0fe7;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5ab89c,_0xcd9b8c){_0xcd9b8c=_0xcd9b8c||0xcc;return function(_0x14a0ee){if(_0x14a0ee){return _0x5ab89c['sendStatus'](_0xcd9b8c);}return _0x5ab89c[_0xd373('0x15')](_0xcd9b8c)[_0xd373('0x16')]();};}function respondWithResult(_0x27c161,_0x23ed86){_0x23ed86=_0x23ed86||0xc8;return function(_0x28b2bf){if(_0x28b2bf){return _0x27c161[_0xd373('0x15')](_0x23ed86)[_0xd373('0x17')](_0x28b2bf);}};}function respondWithFilteredResult(_0x2eacb1,_0x5a286a){return function(_0x2c5854){if(_0x2c5854){var _0x3a5316=typeof _0x5a286a[_0xd373('0x18')]===_0xd373('0x19')&&typeof _0x5a286a['limit']===_0xd373('0x19');var _0x5eab00=_0x2c5854[_0xd373('0x1a')];var _0x36d47a=_0x3a5316?0x0:_0x5a286a['offset'];var _0x1bbdbd=_0x3a5316?_0x2c5854['count']:_0x5a286a['offset']+_0x5a286a[_0xd373('0x1b')];var _0x186fdd;if(_0x1bbdbd>=_0x5eab00){_0x1bbdbd=_0x5eab00;_0x186fdd=0xc8;}else{_0x186fdd=0xce;}_0x2eacb1[_0xd373('0x15')](_0x186fdd);return _0x2eacb1[_0xd373('0x1c')](_0xd373('0x1d'),_0x36d47a+'-'+_0x1bbdbd+'/'+_0x5eab00)[_0xd373('0x17')](_0x2c5854);}return null;};}function patchUpdates(_0x4ba510){return function(_0x18b681){try{jsonpatch[_0xd373('0x1e')](_0x18b681,_0x4ba510,!![]);}catch(_0x1378a0){return BPromise[_0xd373('0x1f')](_0x1378a0);}return _0x18b681[_0xd373('0x20')]();};}function saveUpdates(_0x3aa1c5,_0x4f64bd){return function(_0x355fca){if(_0x355fca){return _0x355fca[_0xd373('0x21')](_0x3aa1c5)[_0xd373('0x22')](function(_0x209ca7){return _0x209ca7;});}return null;};}function removeEntity(_0x217ee7,_0x238ffd){return function(_0x466a03){if(_0x466a03){return _0x466a03[_0xd373('0x23')]()[_0xd373('0x22')](function(){_0x217ee7[_0xd373('0x15')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x34f05a,_0x388182){return function(_0x420a30){if(!_0x420a30){_0x34f05a[_0xd373('0x24')](0x194);}return _0x420a30;};}function handleError(_0x38ba50,_0x50b987){_0x50b987=_0x50b987||0x1f4;return function(_0x13a012){logger[_0xd373('0x25')](_0x13a012[_0xd373('0x26')]);if(_0x13a012[_0xd373('0x27')]){delete _0x13a012[_0xd373('0x27')];}_0x38ba50[_0xd373('0x15')](_0x50b987)[_0xd373('0x28')](_0x13a012);};}exports[_0xd373('0x29')]=function(_0x2869e5,_0x158825){var _0xbc420b={},_0x2ee37c={},_0x7dad3e={'count':0x0,'rows':[]};var _0x5287e7=_[_0xd373('0x2a')](db['ZendeskAccount']['rawAttributes'],function(_0xedc8f3){return{'name':_0xedc8f3[_0xd373('0x2b')],'type':_0xedc8f3[_0xd373('0x2c')][_0xd373('0x2d')]};});_0x2ee37c[_0xd373('0x2e')]=_['map'](_0x5287e7,_0xd373('0x27'));_0x2ee37c[_0xd373('0x2f')]=_['keys'](_0x2869e5[_0xd373('0x2f')]);_0x2ee37c[_0xd373('0x30')]=_[_0xd373('0x31')](_0x2ee37c[_0xd373('0x2e')],_0x2ee37c[_0xd373('0x2f')]);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x31')](_0x2ee37c[_0xd373('0x2e')],qs[_0xd373('0x33')](_0x2869e5['query'][_0xd373('0x33')]));_0xbc420b[_0xd373('0x32')]=_0xbc420b[_0xd373('0x32')][_0xd373('0x34')]?_0xbc420b[_0xd373('0x32')]:_0x2ee37c[_0xd373('0x2e')];if(!_0x2869e5[_0xd373('0x2f')][_0xd373('0x35')](_0xd373('0x36'))){_0xbc420b[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x2869e5[_0xd373('0x2f')][_0xd373('0x1b')]);_0xbc420b[_0xd373('0x18')]=qs[_0xd373('0x18')](_0x2869e5['query'][_0xd373('0x18')]);}_0xbc420b[_0xd373('0x37')]=qs[_0xd373('0x38')](_0x2869e5[_0xd373('0x2f')]['sort']);_0xbc420b[_0xd373('0x39')]=qs[_0xd373('0x30')](_[_0xd373('0x3a')](_0x2869e5[_0xd373('0x2f')],_0x2ee37c[_0xd373('0x30')]),_0x5287e7);if(_0x2869e5[_0xd373('0x2f')]['filter']){_0xbc420b['where']=_[_0xd373('0x3b')](_0xbc420b['where'],{'$or':_[_0xd373('0x2a')](_0x5287e7,function(_0xe19d5b){if(_0xe19d5b[_0xd373('0x2c')]!=='VIRTUAL'){var _0x287136={};_0x287136[_0xe19d5b[_0xd373('0x27')]]={'$like':'%'+_0x2869e5[_0xd373('0x2f')][_0xd373('0x3c')]+'%'};return _0x287136;}})});}_0xbc420b=_['merge']({},_0xbc420b,_0x2869e5['options']);var _0x5de74e={'where':_0xbc420b[_0xd373('0x39')]};return db['ZendeskAccount'][_0xd373('0x1a')](_0x5de74e)[_0xd373('0x22')](function(_0x4e5e80){_0x7dad3e['count']=_0x4e5e80;if(_0x2869e5['query'][_0xd373('0x3d')]){_0xbc420b[_0xd373('0x3e')]=[{'all':!![]}];}return db[_0xd373('0x3f')]['findAll'](_0xbc420b);})['then'](function(_0xb87e16){_0x7dad3e[_0xd373('0x40')]=_0xb87e16;return _0x7dad3e;})['then'](respondWithFilteredResult(_0x158825,_0xbc420b))[_0xd373('0x41')](handleError(_0x158825,null));};exports[_0xd373('0x42')]=function(_0x1e3de1,_0x9989e4){var _0x2d8c7d={'raw':![],'where':{'id':_0x1e3de1['params']['id']}},_0x4e8bc6={};_0x4e8bc6[_0xd373('0x2e')]=_[_0xd373('0x43')](db[_0xd373('0x3f')][_0xd373('0x44')]);_0x4e8bc6['query']=_[_0xd373('0x43')](_0x1e3de1['query']);_0x4e8bc6[_0xd373('0x30')]=_[_0xd373('0x31')](_0x4e8bc6[_0xd373('0x2e')],_0x4e8bc6[_0xd373('0x2f')]);_0x2d8c7d[_0xd373('0x32')]=_['intersection'](_0x4e8bc6[_0xd373('0x2e')],qs[_0xd373('0x33')](_0x1e3de1['query'][_0xd373('0x33')]));_0x2d8c7d[_0xd373('0x32')]=_0x2d8c7d[_0xd373('0x32')][_0xd373('0x34')]?_0x2d8c7d[_0xd373('0x32')]:_0x4e8bc6[_0xd373('0x2e')];if(_0x1e3de1[_0xd373('0x2f')][_0xd373('0x3d')]){_0x2d8c7d[_0xd373('0x3e')]=[{'all':!![]}];}_0x2d8c7d=_[_0xd373('0x3b')]({},_0x2d8c7d,_0x1e3de1['options']);return db['ZendeskAccount'][_0xd373('0x45')](_0x2d8c7d)['then'](handleEntityNotFound(_0x9989e4,null))[_0xd373('0x22')](respondWithResult(_0x9989e4,null))['catch'](handleError(_0x9989e4,null));};exports['create']=function(_0x5cbc16,_0x280598){return db[_0xd373('0x3f')][_0xd373('0x46')](_0x5cbc16[_0xd373('0x47')],{})[_0xd373('0x22')](respondWithResult(_0x280598,0xc9))[_0xd373('0x41')](handleError(_0x280598,null));};exports[_0xd373('0x21')]=function(_0x4d1088,_0x28ec3e){if(_0x4d1088['body']['id']){delete _0x4d1088[_0xd373('0x47')]['id'];}return db[_0xd373('0x3f')]['find']({'where':{'id':_0x4d1088[_0xd373('0x48')]['id']}})['then'](handleEntityNotFound(_0x28ec3e,null))[_0xd373('0x22')](saveUpdates(_0x4d1088[_0xd373('0x47')],null))[_0xd373('0x22')](respondWithResult(_0x28ec3e,null))[_0xd373('0x41')](handleError(_0x28ec3e,null));};exports[_0xd373('0x23')]=function(_0x4bc631,_0x4971a0){return db['ZendeskAccount'][_0xd373('0x45')]({'where':{'id':_0x4bc631[_0xd373('0x48')]['id']}})['then'](handleEntityNotFound(_0x4971a0,null))[_0xd373('0x22')](removeEntity(_0x4971a0,null))[_0xd373('0x41')](handleError(_0x4971a0,null));};exports['getConfigurations']=function(_0xae7067,_0xb6b583,_0x102101){var _0x473af2={};var _0x3b5e70={};var _0xa2758;var _0xc255ec;return db[_0xd373('0x3f')][_0xd373('0x49')]({'where':{'id':_0xae7067[_0xd373('0x48')]['id']}})[_0xd373('0x22')](handleEntityNotFound(_0xb6b583,null))['then'](function(_0x4b2645){if(_0x4b2645){_0xa2758=_0x4b2645;_0x3b5e70['model']=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x3b5e70[_0xd373('0x2f')]=_[_0xd373('0x43')](_0xae7067['query']);_0x3b5e70['filters']=_['intersection'](_0x3b5e70[_0xd373('0x2e')],_0x3b5e70[_0xd373('0x2f')]);_0x473af2['attributes']=_['intersection'](_0x3b5e70[_0xd373('0x2e')],qs[_0xd373('0x33')](_0xae7067[_0xd373('0x2f')][_0xd373('0x33')]));_0x473af2[_0xd373('0x32')]=_0x473af2['attributes'][_0xd373('0x34')]?_0x473af2[_0xd373('0x32')]:_0x3b5e70[_0xd373('0x2e')];_0x473af2[_0xd373('0x37')]=qs[_0xd373('0x38')](_0xae7067[_0xd373('0x2f')][_0xd373('0x38')]);_0x473af2[_0xd373('0x39')]=qs[_0xd373('0x30')](_[_0xd373('0x3a')](_0xae7067[_0xd373('0x2f')],_0x3b5e70[_0xd373('0x30')]));if(_0xae7067[_0xd373('0x2f')][_0xd373('0x3c')]){_0x473af2[_0xd373('0x39')]=_['merge'](_0x473af2[_0xd373('0x39')],{'$or':_[_0xd373('0x2a')](_0x473af2[_0xd373('0x32')],function(_0x4dba1d){var _0x2bdadf={};_0x2bdadf[_0x4dba1d]={'$like':'%'+_0xae7067['query'][_0xd373('0x3c')]+'%'};return _0x2bdadf;})});}_0x473af2=_['merge']({},_0x473af2,_0xae7067[_0xd373('0x4a')]);return _0xa2758[_0xd373('0x4b')](_0x473af2);}})[_0xd373('0x22')](function(_0x19924a){if(_0x19924a){_0xc255ec=_0x19924a[_0xd373('0x34')];if(!_0xae7067[_0xd373('0x2f')][_0xd373('0x35')](_0xd373('0x36'))){_0x473af2[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xae7067[_0xd373('0x2f')][_0xd373('0x1b')]);_0x473af2[_0xd373('0x18')]=qs[_0xd373('0x18')](_0xae7067[_0xd373('0x2f')][_0xd373('0x18')]);}return _0xa2758[_0xd373('0x4b')](_0x473af2);}})[_0xd373('0x22')](function(_0x209e76){if(_0x209e76){return _0x209e76?{'count':_0xc255ec,'rows':_0x209e76}:null;}})[_0xd373('0x22')](respondWithResult(_0xb6b583,null))[_0xd373('0x41')](handleError(_0xb6b583,null));};exports[_0xd373('0x4c')]=function(_0x296242,_0x5133,_0x2ada2f){if(_0x296242[_0xd373('0x47')]['id']){delete _0x296242['body']['id'];}return db[_0xd373('0x3f')][_0xd373('0x49')]({'where':{'id':_0x296242[_0xd373('0x48')]['id']}})['then'](handleEntityNotFound(_0x5133,null))[_0xd373('0x22')](function(_0x2d9019){if(_0x2d9019){_0x296242[_0xd373('0x47')][_0xd373('0x4d')]=_0x2d9019['id'];_0x296242[_0xd373('0x47')][_0xd373('0x4e')]=integrations[_0xd373('0x4f')](_0x296242['body'][_0xd373('0x50')],_0x296242[_0xd373('0x47')][_0xd373('0x2c')]);_0x296242[_0xd373('0x47')][_0xd373('0x51')]=integrations[_0xd373('0x52')](_0x296242[_0xd373('0x47')][_0xd373('0x50')],_0x296242['body'][_0xd373('0x2c')]);return db['ZendeskConfiguration'][_0xd373('0x46')](_0x296242[_0xd373('0x47')],{'include':[{'model':db[_0xd373('0x53')],'as':_0xd373('0x4e')},{'model':db[_0xd373('0x53')],'as':_0xd373('0x51')}]});}return null;})[_0xd373('0x22')](respondWithResult(_0x5133,null))[_0xd373('0x41')](handleError(_0x5133,null));};exports['getFields']=function(_0x237f15,_0x5c5855,_0x40f5ad){var _0x27fcbe='';return db[_0xd373('0x3f')][_0xd373('0x49')]({'where':{'id':_0x237f15[_0xd373('0x48')]['id']},'attributes':['id',_0xd373('0x54'),_0xd373('0x55'),'token',_0xd373('0x56'),_0xd373('0x57')]})[_0xd373('0x22')](handleEntityNotFound(_0x5c5855,null))['then'](function(_0x4035d4){if(_0x4035d4){_0x27fcbe=_0x4035d4[_0xd373('0x57')];var _0xaf9102=_0x27fcbe[_0xd373('0x58')](-0x1);if(_0xaf9102==='/'){_0x27fcbe=_0x27fcbe[_0xd373('0x59')](0x0,_0x27fcbe[_0xd373('0x5a')](_0xaf9102));}var _0x6c7c8d={'method':_0xd373('0x5b'),'uri':util[_0xd373('0x5c')](_0xd373('0x5d'),_0x27fcbe,_0xd373('0x5e')),'json':!![]};switch(_0x4035d4[_0xd373('0x56')]){case'password':_0x6c7c8d[_0xd373('0x5f')]={'Authorization':util[_0xd373('0x5c')](_0xd373('0x60'),new Buffer(util['format'](_0xd373('0x61'),_0x4035d4[_0xd373('0x54')],_0x4035d4[_0xd373('0x55')]))['toString'](_0xd373('0x62')))};break;case'token':_0x6c7c8d[_0xd373('0x5f')]={'Authorization':util[_0xd373('0x5c')](_0xd373('0x60'),new Buffer(util[_0xd373('0x5c')]('%s/token:%s',_0x4035d4[_0xd373('0x54')],_0x4035d4['token']))[_0xd373('0x63')](_0xd373('0x62')))};break;default:throw new db[(_0xd373('0x64'))][(_0xd373('0x65'))](_0xd373('0x66'));}return rp(_0x6c7c8d);}})[_0xd373('0x22')](function(_0x53c0a7){if(_0x53c0a7){var _0xb01a00=['subject',_0xd373('0x67'),'group','assignee'];_[_0xd373('0x68')](_0x53c0a7[_0xd373('0x5e')],function(_0x1cff58){return _0xb01a00[_0xd373('0x69')](_0x1cff58['type']);});return{'count':_0x53c0a7['ticket_fields'][_0xd373('0x34')],'rows':_[_0xd373('0x2a')](_0x53c0a7[_0xd373('0x5e')],function(_0x25bf55){return{'id':_0x25bf55['id'],'name':_0x25bf55[_0xd373('0x6a')]>0x7?_0x25bf55[_0xd373('0x6b')]:_0x25bf55[_0xd373('0x2c')],'custom':_0x25bf55[_0xd373('0x6a')]>0x7?!![]:![],'options':_0x25bf55[_0xd373('0x6c')]?_0x25bf55[_0xd373('0x6c')]:_0x25bf55['custom_field_options']?_0x25bf55[_0xd373('0x6d')]:[]};})};}})[_0xd373('0x22')](respondWithResult(_0x5c5855,null))[_0xd373('0x41')](function(_0xa77a42){var _0x9bdd39=_0x237f15[_0xd373('0x2f')][_0xd373('0x6e')]?0x1f4:_0xa77a42['statusCode']||0x1f4;logger[_0xd373('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x9bdd39,JSON[_0xd373('0x6f')](_0xa77a42));delete _0xa77a42[_0xd373('0x27')];if(_0x9bdd39===0x191){_0x9bdd39=0x190;}_0x5c5855[_0xd373('0x15')](_0x9bdd39)[_0xd373('0x28')](_0x237f15[_0xd373('0x2f')][_0xd373('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0xa77a42[_0xd373('0x70')]}:_0xa77a42);});}; \ No newline at end of file +var _0xd914=['channel','ZendeskField','username','token','authType','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','password','headers','%s:%s','Basic\x20%s','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','group','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','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','pick','map','options','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd914,0x17f));var _0x4d91=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0xd914[_0x4c80d7];return _0x3c5095;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];var integrations=require(_0x4d91('0x1b'));function respondWithStatusCode(_0x318e0c,_0x4ea591){_0x4ea591=_0x4ea591||0xcc;return function(_0x577a69){if(_0x577a69){return _0x318e0c[_0x4d91('0x1c')](_0x4ea591);}return _0x318e0c[_0x4d91('0x1d')](_0x4ea591)[_0x4d91('0x1e')]();};}function respondWithResult(_0x3c9fd6,_0x33fbd4){_0x33fbd4=_0x33fbd4||0xc8;return function(_0x25bafc){if(_0x25bafc){return _0x3c9fd6[_0x4d91('0x1d')](_0x33fbd4)['json'](_0x25bafc);}};}function respondWithFilteredResult(_0x3a8ec9,_0x42631a){return function(_0x1e2ef7){if(_0x1e2ef7){var _0xb92681=typeof _0x42631a[_0x4d91('0x1f')]==='undefined'&&typeof _0x42631a[_0x4d91('0x20')]===_0x4d91('0x21');var _0x241564=_0x1e2ef7[_0x4d91('0x22')];var _0x4cfa40=_0xb92681?0x0:_0x42631a[_0x4d91('0x1f')];var _0x3b579b=_0xb92681?_0x1e2ef7[_0x4d91('0x22')]:_0x42631a['offset']+_0x42631a[_0x4d91('0x20')];var _0x127911;if(_0x3b579b>=_0x241564){_0x3b579b=_0x241564;_0x127911=0xc8;}else{_0x127911=0xce;}_0x3a8ec9[_0x4d91('0x1d')](_0x127911);return _0x3a8ec9[_0x4d91('0x23')](_0x4d91('0x24'),_0x4cfa40+'-'+_0x3b579b+'/'+_0x241564)[_0x4d91('0x25')](_0x1e2ef7);}return null;};}function patchUpdates(_0xc1d44f){return function(_0x193ca9){try{jsonpatch[_0x4d91('0x26')](_0x193ca9,_0xc1d44f,!![]);}catch(_0x226d85){return BPromise['reject'](_0x226d85);}return _0x193ca9[_0x4d91('0x27')]();};}function saveUpdates(_0x5f5236,_0x57913e){return function(_0x74a697){if(_0x74a697){return _0x74a697[_0x4d91('0x28')](_0x5f5236)[_0x4d91('0x29')](function(_0x9cb864){return _0x9cb864;});}return null;};}function removeEntity(_0x7d8cbf,_0x12b722){return function(_0x100cd4){if(_0x100cd4){return _0x100cd4[_0x4d91('0x2a')]()['then'](function(){_0x7d8cbf['status'](0xcc)[_0x4d91('0x1e')]();});}};}function handleEntityNotFound(_0x112923,_0x3bed98){return function(_0x45fc91){if(!_0x45fc91){_0x112923[_0x4d91('0x1c')](0x194);}return _0x45fc91;};}function handleError(_0x2c7d7a,_0x14bdb4){_0x14bdb4=_0x14bdb4||0x1f4;return function(_0x560966){logger[_0x4d91('0x2b')](_0x560966[_0x4d91('0x2c')]);if(_0x560966[_0x4d91('0x2d')]){delete _0x560966['name'];}_0x2c7d7a['status'](_0x14bdb4)[_0x4d91('0x2e')](_0x560966);};}exports[_0x4d91('0x2f')]=function(_0x5ed948,_0x50fe76){var _0x42d5a0={},_0x2d6981={},_0x43371e={'count':0x0,'rows':[]};var _0x17c7bc=_['map'](db[_0x4d91('0x30')][_0x4d91('0x31')],function(_0x468e95){return{'name':_0x468e95[_0x4d91('0x32')],'type':_0x468e95[_0x4d91('0x33')][_0x4d91('0x34')]};});_0x2d6981[_0x4d91('0x35')]=_['map'](_0x17c7bc,_0x4d91('0x2d'));_0x2d6981['query']=_['keys'](_0x5ed948[_0x4d91('0x36')]);_0x2d6981[_0x4d91('0x37')]=_['intersection'](_0x2d6981[_0x4d91('0x35')],_0x2d6981[_0x4d91('0x36')]);_0x42d5a0[_0x4d91('0x38')]=_[_0x4d91('0x39')](_0x2d6981[_0x4d91('0x35')],qs['fields'](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3a')]));_0x42d5a0[_0x4d91('0x38')]=_0x42d5a0[_0x4d91('0x38')][_0x4d91('0x3b')]?_0x42d5a0[_0x4d91('0x38')]:_0x2d6981['model'];if(!_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3c')]('nolimit')){_0x42d5a0[_0x4d91('0x20')]=qs[_0x4d91('0x20')](_0x5ed948[_0x4d91('0x36')]['limit']);_0x42d5a0[_0x4d91('0x1f')]=qs[_0x4d91('0x1f')](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x1f')]);}_0x42d5a0['order']=qs[_0x4d91('0x3d')](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3d')]);_0x42d5a0[_0x4d91('0x3e')]=qs['filters'](_['pick'](_0x5ed948[_0x4d91('0x36')],_0x2d6981[_0x4d91('0x37')]),_0x17c7bc);if(_0x5ed948['query'][_0x4d91('0x3f')]){_0x42d5a0[_0x4d91('0x3e')]=_[_0x4d91('0x40')](_0x42d5a0[_0x4d91('0x3e')],{'$or':_['map'](_0x17c7bc,function(_0x2eb7c7){if(_0x2eb7c7[_0x4d91('0x33')]!=='VIRTUAL'){var _0x1ba6cd={};_0x1ba6cd[_0x2eb7c7['name']]={'$like':'%'+_0x5ed948[_0x4d91('0x36')]['filter']+'%'};return _0x1ba6cd;}})});}_0x42d5a0=_[_0x4d91('0x40')]({},_0x42d5a0,_0x5ed948['options']);var _0x24fc69={'where':_0x42d5a0[_0x4d91('0x3e')]};return db[_0x4d91('0x30')][_0x4d91('0x22')](_0x24fc69)['then'](function(_0x5bcc9b){_0x43371e[_0x4d91('0x22')]=_0x5bcc9b;if(_0x5ed948['query'][_0x4d91('0x41')]){_0x42d5a0[_0x4d91('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4d91('0x43')](_0x42d5a0);})[_0x4d91('0x29')](function(_0x14db37){_0x43371e[_0x4d91('0x44')]=_0x14db37;return _0x43371e;})[_0x4d91('0x29')](respondWithFilteredResult(_0x50fe76,_0x42d5a0))[_0x4d91('0x45')](handleError(_0x50fe76,null));};exports[_0x4d91('0x46')]=function(_0x4f6254,_0x1e4c6d){var _0x4c70af={'raw':![],'where':{'id':_0x4f6254[_0x4d91('0x47')]['id']}},_0x41c06a={};_0x41c06a[_0x4d91('0x35')]=_[_0x4d91('0x48')](db[_0x4d91('0x30')][_0x4d91('0x31')]);_0x41c06a['query']=_['keys'](_0x4f6254[_0x4d91('0x36')]);_0x41c06a[_0x4d91('0x37')]=_['intersection'](_0x41c06a[_0x4d91('0x35')],_0x41c06a[_0x4d91('0x36')]);_0x4c70af[_0x4d91('0x38')]=_[_0x4d91('0x39')](_0x41c06a[_0x4d91('0x35')],qs[_0x4d91('0x3a')](_0x4f6254[_0x4d91('0x36')][_0x4d91('0x3a')]));_0x4c70af[_0x4d91('0x38')]=_0x4c70af['attributes']['length']?_0x4c70af[_0x4d91('0x38')]:_0x41c06a['model'];if(_0x4f6254[_0x4d91('0x36')][_0x4d91('0x41')]){_0x4c70af[_0x4d91('0x42')]=[{'all':!![]}];}_0x4c70af=_[_0x4d91('0x40')]({},_0x4c70af,_0x4f6254['options']);return db[_0x4d91('0x30')]['find'](_0x4c70af)['then'](handleEntityNotFound(_0x1e4c6d,null))[_0x4d91('0x29')](respondWithResult(_0x1e4c6d,null))[_0x4d91('0x45')](handleError(_0x1e4c6d,null));};exports[_0x4d91('0x49')]=function(_0xa03d75,_0x1f91ec){return db[_0x4d91('0x30')]['create'](_0xa03d75[_0x4d91('0x4a')],{})[_0x4d91('0x29')](respondWithResult(_0x1f91ec,0xc9))[_0x4d91('0x45')](handleError(_0x1f91ec,null));};exports[_0x4d91('0x28')]=function(_0x106e5b,_0x44e9ec){if(_0x106e5b[_0x4d91('0x4a')]['id']){delete _0x106e5b[_0x4d91('0x4a')]['id'];}return db[_0x4d91('0x30')][_0x4d91('0x4b')]({'where':{'id':_0x106e5b[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x44e9ec,null))[_0x4d91('0x29')](saveUpdates(_0x106e5b['body'],null))[_0x4d91('0x29')](respondWithResult(_0x44e9ec,null))[_0x4d91('0x45')](handleError(_0x44e9ec,null));};exports[_0x4d91('0x2a')]=function(_0x386935,_0x436a3d){return db[_0x4d91('0x30')][_0x4d91('0x4b')]({'where':{'id':_0x386935[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x436a3d,null))[_0x4d91('0x29')](removeEntity(_0x436a3d,null))[_0x4d91('0x45')](handleError(_0x436a3d,null));};exports[_0x4d91('0x4c')]=function(_0x2bba43,_0x26ecd7,_0x19e57e){var _0x5765ce={};var _0x4aae23={};var _0x392cc3;var _0x2159e4;return db[_0x4d91('0x30')][_0x4d91('0x4d')]({'where':{'id':_0x2bba43[_0x4d91('0x47')]['id']}})[_0x4d91('0x29')](handleEntityNotFound(_0x26ecd7,null))[_0x4d91('0x29')](function(_0x4138c5){if(_0x4138c5){_0x392cc3=_0x4138c5;_0x4aae23[_0x4d91('0x35')]=_[_0x4d91('0x48')](db[_0x4d91('0x4e')][_0x4d91('0x31')]);_0x4aae23[_0x4d91('0x36')]=_[_0x4d91('0x48')](_0x2bba43[_0x4d91('0x36')]);_0x4aae23[_0x4d91('0x37')]=_[_0x4d91('0x39')](_0x4aae23['model'],_0x4aae23['query']);_0x5765ce['attributes']=_[_0x4d91('0x39')](_0x4aae23[_0x4d91('0x35')],qs[_0x4d91('0x3a')](_0x2bba43['query'][_0x4d91('0x3a')]));_0x5765ce[_0x4d91('0x38')]=_0x5765ce[_0x4d91('0x38')]['length']?_0x5765ce['attributes']:_0x4aae23['model'];_0x5765ce[_0x4d91('0x4f')]=qs[_0x4d91('0x3d')](_0x2bba43[_0x4d91('0x36')][_0x4d91('0x3d')]);_0x5765ce[_0x4d91('0x3e')]=qs['filters'](_[_0x4d91('0x50')](_0x2bba43[_0x4d91('0x36')],_0x4aae23['filters']));if(_0x2bba43['query'][_0x4d91('0x3f')]){_0x5765ce['where']=_[_0x4d91('0x40')](_0x5765ce[_0x4d91('0x3e')],{'$or':_[_0x4d91('0x51')](_0x5765ce['attributes'],function(_0x2e0bff){var _0x3d6c26={};_0x3d6c26[_0x2e0bff]={'$like':'%'+_0x2bba43[_0x4d91('0x36')][_0x4d91('0x3f')]+'%'};return _0x3d6c26;})});}_0x5765ce=_[_0x4d91('0x40')]({},_0x5765ce,_0x2bba43[_0x4d91('0x52')]);return _0x392cc3[_0x4d91('0x4c')](_0x5765ce);}})['then'](function(_0x533572){if(_0x533572){_0x2159e4=_0x533572['length'];if(!_0x2bba43['query'][_0x4d91('0x3c')](_0x4d91('0x53'))){_0x5765ce[_0x4d91('0x20')]=qs['limit'](_0x2bba43[_0x4d91('0x36')]['limit']);_0x5765ce[_0x4d91('0x1f')]=qs[_0x4d91('0x1f')](_0x2bba43['query']['offset']);}return _0x392cc3[_0x4d91('0x4c')](_0x5765ce);}})[_0x4d91('0x29')](function(_0x31150f){if(_0x31150f){return _0x31150f?{'count':_0x2159e4,'rows':_0x31150f}:null;}})[_0x4d91('0x29')](respondWithResult(_0x26ecd7,null))[_0x4d91('0x45')](handleError(_0x26ecd7,null));};exports[_0x4d91('0x54')]=function(_0x7a94e2,_0x42e550,_0xd384a9){if(_0x7a94e2[_0x4d91('0x4a')]['id']){delete _0x7a94e2['body']['id'];}return db['ZendeskAccount'][_0x4d91('0x4d')]({'where':{'id':_0x7a94e2[_0x4d91('0x47')]['id']}})[_0x4d91('0x29')](handleEntityNotFound(_0x42e550,null))[_0x4d91('0x29')](function(_0x16ba26){if(_0x16ba26){_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x55')]=_0x16ba26['id'];_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x56')]=integrations['getSubjects'](_0x7a94e2['body']['channel'],_0x7a94e2['body'][_0x4d91('0x33')]);_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x57')]=integrations[_0x4d91('0x58')](_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x59')],_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x33')]);return db[_0x4d91('0x4e')][_0x4d91('0x49')](_0x7a94e2[_0x4d91('0x4a')],{'include':[{'model':db[_0x4d91('0x5a')],'as':_0x4d91('0x56')},{'model':db[_0x4d91('0x5a')],'as':_0x4d91('0x57')}]});}return null;})[_0x4d91('0x29')](respondWithResult(_0x42e550,null))[_0x4d91('0x45')](handleError(_0x42e550,null));};exports['getFields']=function(_0x4062c6,_0x1be4b1,_0xc4ef10){var _0x2e2105='';return db[_0x4d91('0x30')]['findOne']({'where':{'id':_0x4062c6[_0x4d91('0x47')]['id']},'attributes':['id',_0x4d91('0x5b'),'password',_0x4d91('0x5c'),_0x4d91('0x5d'),_0x4d91('0x5e')]})[_0x4d91('0x29')](handleEntityNotFound(_0x1be4b1,null))[_0x4d91('0x29')](function(_0x4bc5a0){if(_0x4bc5a0){_0x2e2105=_0x4bc5a0[_0x4d91('0x5e')];var _0x2a5bc0=_0x2e2105['slice'](-0x1);if(_0x2a5bc0==='/'){_0x2e2105=_0x2e2105[_0x4d91('0x5f')](0x0,_0x2e2105[_0x4d91('0x60')](_0x2a5bc0));}var _0xd94b29={'method':'GET','uri':util[_0x4d91('0x61')](_0x4d91('0x62'),_0x2e2105,_0x4d91('0x63')),'json':!![]};switch(_0x4bc5a0[_0x4d91('0x5d')]){case _0x4d91('0x64'):_0xd94b29[_0x4d91('0x65')]={'Authorization':util[_0x4d91('0x61')]('Basic\x20%s',new Buffer(util[_0x4d91('0x61')](_0x4d91('0x66'),_0x4bc5a0['username'],_0x4bc5a0[_0x4d91('0x64')]))['toString']('base64'))};break;case _0x4d91('0x5c'):_0xd94b29['headers']={'Authorization':util[_0x4d91('0x61')](_0x4d91('0x67'),new Buffer(util[_0x4d91('0x61')](_0x4d91('0x68'),_0x4bc5a0[_0x4d91('0x5b')],_0x4bc5a0[_0x4d91('0x5c')]))[_0x4d91('0x69')]('base64'))};break;default:throw new db['Sequelize'][(_0x4d91('0x6a'))](_0x4d91('0x6b'));}return rp(_0xd94b29);}})[_0x4d91('0x29')](function(_0x42164f){if(_0x42164f){var _0x1e3838=['subject','description',_0x4d91('0x6c'),'assignee'];_['remove'](_0x42164f[_0x4d91('0x63')],function(_0x54fea8){return _0x1e3838['includes'](_0x54fea8[_0x4d91('0x33')]);});return{'count':_0x42164f[_0x4d91('0x63')][_0x4d91('0x3b')],'rows':_['map'](_0x42164f['ticket_fields'],function(_0x52604d){return{'id':_0x52604d['id'],'name':_0x52604d[_0x4d91('0x6d')]>0x7?_0x52604d[_0x4d91('0x6e')]:_0x52604d[_0x4d91('0x33')],'custom':_0x52604d[_0x4d91('0x6d')]>0x7?!![]:![],'options':_0x52604d[_0x4d91('0x6f')]?_0x52604d[_0x4d91('0x6f')]:_0x52604d[_0x4d91('0x70')]?_0x52604d[_0x4d91('0x70')]:[]};})};}})[_0x4d91('0x29')](respondWithResult(_0x1be4b1,null))['catch'](function(_0xb9d1ff){var _0x579a9e=_0x4062c6['query'][_0x4d91('0x71')]?0x1f4:_0xb9d1ff[_0x4d91('0x72')]||0x1f4;logger[_0x4d91('0x2b')](_0x4d91('0x73'),'getFields',_0x579a9e,JSON[_0x4d91('0x74')](_0xb9d1ff));delete _0xb9d1ff[_0x4d91('0x2d')];if(_0x579a9e===0x191){_0x579a9e=0x190;}_0x1be4b1[_0x4d91('0x1d')](_0x579a9e)[_0x4d91('0x2e')](_0x4062c6[_0x4d91('0x36')][_0x4d91('0x71')]?{'message':_0x4d91('0x75'),'statusCode':_0xb9d1ff['statusCode']}:_0xb9d1ff);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 6990544..e75255a 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 _0xaf34=['ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','exports'];(function(_0x518cbc,_0x38c63c){var _0x2a2a5f=function(_0x2e51e0){while(--_0x2e51e0){_0x518cbc['push'](_0x518cbc['shift']());}};_0x2a2a5f(++_0x38c63c);}(_0xaf34,0xce));var _0x4af3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xaf34[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x4af3('0x0'));var util=require(_0x4af3('0x1'));var logger=require(_0x4af3('0x2'))('api');var moment=require(_0x4af3('0x3'));var BPromise=require(_0x4af3('0x4'));var rp=require(_0x4af3('0x5'));var fs=require('fs');var path=require(_0x4af3('0x6'));var rimraf=require('rimraf');var config=require(_0x4af3('0x7'));var attributes=require(_0x4af3('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x4af3('0x9')]=function(_0x19e566,_0x17bfd1){return _0x19e566['define'](_0x4af3('0xa'),attributes,{'tableName':_0x4af3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdca4=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','moment','bluebird','path','rimraf'];(function(_0x5d8668,_0x4ce2d2){var _0x424a4a=function(_0x1951a8){while(--_0x1951a8){_0x5d8668['push'](_0x5d8668['shift']());}};_0x424a4a(++_0x4ce2d2);}(_0xdca4,0x19e));var _0x4dca=function(_0x2ac3ab,_0x226477){_0x2ac3ab=_0x2ac3ab-0x0;var _0x52d68c=_0xdca4[_0x2ac3ab];return _0x52d68c;};'use strict';var _=require(_0x4dca('0x0'));var util=require(_0x4dca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4dca('0x2'));var BPromise=require(_0x4dca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dca('0x4'));var rimraf=require(_0x4dca('0x5'));var config=require(_0x4dca('0x6'));var attributes=require(_0x4dca('0x7'));var integrations=require(_0x4dca('0x8'));module[_0x4dca('0x9')]=function(_0x59bdda,_0x21d674){return _0x59bdda[_0x4dca('0xa')]('ZendeskAccount',attributes,{'tableName':_0x4dca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 0924ab3..07ad9ae 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 _0x8028=['result','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','include','map','model','debug','ShowZendeskAccount','util','bluebird','ioredis','../../mysqldb','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x8028,0xcc));var _0x8802=function(_0x383939,_0x2f6e17){_0x383939=_0x383939-0x0;var _0x5b0b68=_0x8028[_0x383939];return _0x5b0b68;};'use strict';var _=require('lodash');var util=require(_0x8802('0x0'));var moment=require('moment');var BPromise=require(_0x8802('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8802('0x2'));var db=require(_0x8802('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d1f36,_0x5604c6,_0x559a1e){return new BPromise(function(_0x5ea559,_0x250b29){return client['request'](_0x4d1f36,_0x559a1e)[_0x8802('0x4')](function(_0x17cc41){logger[_0x8802('0x5')](_0x8802('0x6'),_0x5604c6,_0x8802('0x7'));logger['debug'](_0x8802('0x8'),_0x5604c6,'request\x20sent',JSON[_0x8802('0x9')](_0x17cc41));if(_0x17cc41[_0x8802('0xa')]){if(_0x17cc41['error']['code']===0x1f4){logger[_0x8802('0xa')](_0x8802('0x6'),_0x5604c6,_0x17cc41[_0x8802('0xa')][_0x8802('0xb')]);return _0x250b29(_0x17cc41['error'][_0x8802('0xb')]);}logger[_0x8802('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x5604c6,_0x17cc41['error']['message']);return _0x5ea559(_0x17cc41['error'][_0x8802('0xb')]);}else{logger[_0x8802('0x5')]('ZendeskAccount,\x20%s,\x20%s',_0x5604c6,_0x8802('0x7'));_0x5ea559(_0x17cc41[_0x8802('0xc')]['message']);}})['catch'](function(_0x132f3b){logger[_0x8802('0xa')](_0x8802('0x6'),_0x5604c6,_0x132f3b);_0x250b29(_0x132f3b);});});}exports[_0x8802('0xd')]=function(_0x2e414e){var _0x4945d2=this;return new Promise(function(_0x378b7c,_0x5bf6b6){return db[_0x8802('0xe')][_0x8802('0xf')]({'raw':_0x2e414e[_0x8802('0x10')]?_0x2e414e[_0x8802('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0x2e414e[_0x8802('0x10')]?_0x2e414e[_0x8802('0x10')][_0x8802('0x11')]||null:null,'attributes':_0x2e414e['options']?_0x2e414e[_0x8802('0x10')][_0x8802('0x12')]||null:null,'limit':_0x2e414e['options']?_0x2e414e[_0x8802('0x10')]['limit']||null:null,'include':_0x2e414e['options']?_0x2e414e[_0x8802('0x10')][_0x8802('0x13')]?_[_0x8802('0x14')](_0x2e414e['options'][_0x8802('0x13')],function(_0x220165){return{'model':db[_0x220165[_0x8802('0x15')]],'as':_0x220165['as'],'attributes':_0x220165[_0x8802('0x12')],'include':_0x220165['include']?_[_0x8802('0x14')](_0x220165[_0x8802('0x13')],function(_0x4c9120){return{'model':db[_0x4c9120['model']],'as':_0x4c9120['as'],'attributes':_0x4c9120[_0x8802('0x12')],'include':_0x4c9120[_0x8802('0x13')]?_[_0x8802('0x14')](_0x4c9120[_0x8802('0x13')],function(_0x2749b4){return{'model':db[_0x2749b4[_0x8802('0x15')]],'as':_0x2749b4['as'],'attributes':_0x2749b4[_0x8802('0x12')]};}):[]};}):[]};}):[]:[]})[_0x8802('0x4')](function(_0x109d57){logger[_0x8802('0x5')](_0x8802('0xd'),_0x2e414e);logger[_0x8802('0x16')](_0x8802('0xd'),_0x2e414e,JSON['stringify'](_0x109d57));_0x378b7c(_0x109d57);})['catch'](function(_0x466c18){logger[_0x8802('0xa')]('GetZendeskAccount',_0x466c18['message'],_0x2e414e);_0x5bf6b6(_0x4945d2['error'](0x1f4,_0x466c18['message']));});});};exports[_0x8802('0x17')]=function(_0x164619){var _0x482405=this;return new Promise(function(_0x4da803,_0x439b52){return db[_0x8802('0xe')]['find']({'raw':_0x164619[_0x8802('0x10')]?_0x164619[_0x8802('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0x164619[_0x8802('0x10')]?_0x164619['options']['where']||null:null,'attributes':_0x164619[_0x8802('0x10')]?_0x164619['options'][_0x8802('0x12')]||null:null,'include':_0x164619[_0x8802('0x10')]?_0x164619[_0x8802('0x10')][_0x8802('0x13')]?_[_0x8802('0x14')](_0x164619[_0x8802('0x10')][_0x8802('0x13')],function(_0x1098ee){return{'model':db[_0x1098ee[_0x8802('0x15')]],'as':_0x1098ee['as'],'attributes':_0x1098ee['attributes'],'include':_0x1098ee[_0x8802('0x13')]?_[_0x8802('0x14')](_0x1098ee[_0x8802('0x13')],function(_0x20a7ab){return{'model':db[_0x20a7ab[_0x8802('0x15')]],'as':_0x20a7ab['as'],'attributes':_0x20a7ab[_0x8802('0x12')],'include':_0x20a7ab['include']?_[_0x8802('0x14')](_0x20a7ab[_0x8802('0x13')],function(_0x15694f){return{'model':db[_0x15694f['model']],'as':_0x15694f['as'],'attributes':_0x15694f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8802('0x4')](function(_0x511880){logger[_0x8802('0x5')](_0x8802('0x17'),_0x164619);logger['debug'](_0x8802('0x17'),_0x164619,JSON['stringify'](_0x511880));_0x4da803(_0x511880);})['catch'](function(_0x2a5148){logger[_0x8802('0xa')]('ShowZendeskAccount',_0x2a5148['message'],_0x164619);_0x439b52(_0x482405[_0x8802('0xa')](0x1f4,_0x2a5148[_0x8802('0xb')]));});});}; \ No newline at end of file +var _0xb5f1=['include','map','model','ShowZendeskAccount','find','then','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb5f1,0x141));var _0x1b5f=function(_0x895898,_0x28a586){_0x895898=_0x895898-0x0;var _0x4758c0=_0xb5f1[_0x895898];return _0x4758c0;};'use strict';var _=require(_0x1b5f('0x0'));var util=require('util');var moment=require(_0x1b5f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b5f('0x2'));var fs=require('fs');var Redis=require(_0x1b5f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b5f('0x4'));var logger=require(_0x1b5f('0x5'))(_0x1b5f('0x6'));var config=require(_0x1b5f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x267d68,_0x111fa1,_0xc35856){return new BPromise(function(_0x37dc78,_0x242672){return client[_0x1b5f('0x9')](_0x267d68,_0xc35856)['then'](function(_0xcf1cd1){logger[_0x1b5f('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x111fa1,_0x1b5f('0xb'));logger[_0x1b5f('0xc')](_0x1b5f('0xd'),_0x111fa1,'request\x20sent',JSON[_0x1b5f('0xe')](_0xcf1cd1));if(_0xcf1cd1[_0x1b5f('0xf')]){if(_0xcf1cd1[_0x1b5f('0xf')][_0x1b5f('0x10')]===0x1f4){logger[_0x1b5f('0xf')](_0x1b5f('0x11'),_0x111fa1,_0xcf1cd1[_0x1b5f('0xf')]['message']);return _0x242672(_0xcf1cd1[_0x1b5f('0xf')][_0x1b5f('0x12')]);}logger['error'](_0x1b5f('0x11'),_0x111fa1,_0xcf1cd1[_0x1b5f('0xf')][_0x1b5f('0x12')]);return _0x37dc78(_0xcf1cd1[_0x1b5f('0xf')]['message']);}else{logger[_0x1b5f('0xa')](_0x1b5f('0x11'),_0x111fa1,_0x1b5f('0xb'));_0x37dc78(_0xcf1cd1[_0x1b5f('0x13')]['message']);}})[_0x1b5f('0x14')](function(_0x4f653b){logger[_0x1b5f('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x111fa1,_0x4f653b);_0x242672(_0x4f653b);});});}exports[_0x1b5f('0x15')]=function(_0x2beeca){var _0x14bc75=this;return new Promise(function(_0x38c3a7,_0x53d25c){return db[_0x1b5f('0x16')][_0x1b5f('0x17')]({'raw':_0x2beeca[_0x1b5f('0x18')]?_0x2beeca[_0x1b5f('0x18')][_0x1b5f('0x19')]===undefined?!![]:![]:!![],'where':_0x2beeca['options']?_0x2beeca[_0x1b5f('0x18')][_0x1b5f('0x1a')]||null:null,'attributes':_0x2beeca['options']?_0x2beeca[_0x1b5f('0x18')][_0x1b5f('0x1b')]||null:null,'limit':_0x2beeca[_0x1b5f('0x18')]?_0x2beeca[_0x1b5f('0x18')][_0x1b5f('0x1c')]||null:null,'include':_0x2beeca[_0x1b5f('0x18')]?_0x2beeca[_0x1b5f('0x18')][_0x1b5f('0x1d')]?_[_0x1b5f('0x1e')](_0x2beeca['options'][_0x1b5f('0x1d')],function(_0x13c8db){return{'model':db[_0x13c8db['model']],'as':_0x13c8db['as'],'attributes':_0x13c8db['attributes'],'include':_0x13c8db['include']?_[_0x1b5f('0x1e')](_0x13c8db[_0x1b5f('0x1d')],function(_0x467d08){return{'model':db[_0x467d08[_0x1b5f('0x1f')]],'as':_0x467d08['as'],'attributes':_0x467d08[_0x1b5f('0x1b')],'include':_0x467d08['include']?_[_0x1b5f('0x1e')](_0x467d08[_0x1b5f('0x1d')],function(_0x39ede5){return{'model':db[_0x39ede5['model']],'as':_0x39ede5['as'],'attributes':_0x39ede5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49a29d){logger[_0x1b5f('0xa')](_0x1b5f('0x15'),_0x2beeca);logger[_0x1b5f('0xc')](_0x1b5f('0x15'),_0x2beeca,JSON[_0x1b5f('0xe')](_0x49a29d));_0x38c3a7(_0x49a29d);})['catch'](function(_0x1c0ee7){logger[_0x1b5f('0xf')](_0x1b5f('0x15'),_0x1c0ee7[_0x1b5f('0x12')],_0x2beeca);_0x53d25c(_0x14bc75[_0x1b5f('0xf')](0x1f4,_0x1c0ee7['message']));});});};exports[_0x1b5f('0x20')]=function(_0x2fcdd4){var _0x560e61=this;return new Promise(function(_0x465e7c,_0x1167c3){return db[_0x1b5f('0x16')][_0x1b5f('0x21')]({'raw':_0x2fcdd4[_0x1b5f('0x18')]?_0x2fcdd4['options']['raw']===undefined?!![]:![]:!![],'where':_0x2fcdd4[_0x1b5f('0x18')]?_0x2fcdd4['options'][_0x1b5f('0x1a')]||null:null,'attributes':_0x2fcdd4[_0x1b5f('0x18')]?_0x2fcdd4['options'][_0x1b5f('0x1b')]||null:null,'include':_0x2fcdd4[_0x1b5f('0x18')]?_0x2fcdd4[_0x1b5f('0x18')][_0x1b5f('0x1d')]?_['map'](_0x2fcdd4[_0x1b5f('0x18')][_0x1b5f('0x1d')],function(_0x56b2d3){return{'model':db[_0x56b2d3[_0x1b5f('0x1f')]],'as':_0x56b2d3['as'],'attributes':_0x56b2d3[_0x1b5f('0x1b')],'include':_0x56b2d3[_0x1b5f('0x1d')]?_[_0x1b5f('0x1e')](_0x56b2d3[_0x1b5f('0x1d')],function(_0x28123b){return{'model':db[_0x28123b[_0x1b5f('0x1f')]],'as':_0x28123b['as'],'attributes':_0x28123b[_0x1b5f('0x1b')],'include':_0x28123b[_0x1b5f('0x1d')]?_['map'](_0x28123b[_0x1b5f('0x1d')],function(_0x3aea88){return{'model':db[_0x3aea88[_0x1b5f('0x1f')]],'as':_0x3aea88['as'],'attributes':_0x3aea88[_0x1b5f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1b5f('0x22')](function(_0x2a4aaf){logger[_0x1b5f('0xa')](_0x1b5f('0x20'),_0x2fcdd4);logger[_0x1b5f('0xc')]('ShowZendeskAccount',_0x2fcdd4,JSON[_0x1b5f('0xe')](_0x2a4aaf));_0x465e7c(_0x2a4aaf);})['catch'](function(_0x4fa234){logger['error'](_0x1b5f('0x20'),_0x4fa234[_0x1b5f('0x12')],_0x2fcdd4);_0x1167c3(_0x560e61[_0x1b5f('0xf')](0x1f4,_0x4fa234[_0x1b5f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f17077e..7dfe812 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(_0x135d65,_0x4f8567){var _0x48b99e=function(_0x1a587c){while(--_0x1a587c){_0x135d65['push'](_0x135d65['shift']());}};_0x48b99e(++_0x4f8567);}(_0x91a7,0xe7));var _0x791a=function(_0x5bf8de,_0x5ef5cc){_0x5bf8de=_0x5bf8de-0x0;var _0x47160c=_0x91a7[_0x5bf8de];return _0x47160c;};'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 _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(_0x5f0aa9,_0x20a53c){var _0x243d98=function(_0x352c23){while(--_0x352c23){_0x5f0aa9['push'](_0x5f0aa9['shift']());}};_0x243d98(++_0x20a53c);}(_0x91a7,0xe7));var _0x791a=function(_0x317822,_0xba3222){_0x317822=_0x317822-0x0;var _0x59e915=_0x91a7[_0x317822];return _0x59e915;};'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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b95c351..e7b63f9 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 _0xdf3c=['STRING','exports'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xdf3c,0xf9));var _0xcdf3=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xdf3c[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require('sequelize');module[_0xcdf3('0x0')]={'name':{'type':Sequelize[_0xcdf3('0x1')]},'description':{'type':Sequelize[_0xcdf3('0x1')]}}; \ No newline at end of file +var _0xbae3=['STRING','sequelize','exports'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xbae3,0xee));var _0x3bae=function(_0x25dd5e,_0x540d50){_0x25dd5e=_0x25dd5e-0x0;var _0x8e60e5=_0xbae3[_0x25dd5e];return _0x8e60e5;};'use strict';var Sequelize=require(_0x3bae('0x0'));module[_0x3bae('0x1')]={'name':{'type':Sequelize[_0x3bae('0x2')]},'description':{'type':Sequelize[_0x3bae('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 1c78d49..d06c72d 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 _0x1186=['getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','name','index','ZendeskConfiguration','rawAttributes','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','merge','find','create','body','params'];(function(_0x33ac12,_0x9ef3a){var _0x33e5ed=function(_0xa2dd7){while(--_0xa2dd7){_0x33ac12['push'](_0x33ac12['shift']());}};_0x33e5ed(++_0x9ef3a);}(_0x1186,0xa8));var _0x6118=function(_0x147cd4,_0x280d10){_0x147cd4=_0x147cd4-0x0;var _0x5b9e66=_0x1186[_0x147cd4];return _0x5b9e66;};'use strict';var emlformat=require(_0x6118('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6118('0x1'));var rp=require('request-promise');var moment=require(_0x6118('0x2'));var BPromise=require(_0x6118('0x3'));var Mustache=require(_0x6118('0x4'));var util=require(_0x6118('0x5'));var path=require('path');var sox=require(_0x6118('0x6'));var csv=require(_0x6118('0x7'));var ejs=require(_0x6118('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6118('0x9'));var squel=require(_0x6118('0xa'));var crypto=require(_0x6118('0xb'));var jsforce=require(_0x6118('0xc'));var deskjs=require(_0x6118('0xd'));var toCsv=require(_0x6118('0x7'));var querystring=require(_0x6118('0xe'));var Papa=require('papaparse');var Redis=require(_0x6118('0xf'));var authService=require(_0x6118('0x10'));var qs=require(_0x6118('0x11'));var as=require(_0x6118('0x12'));var hardwareService=require(_0x6118('0x13'));var logger=require(_0x6118('0x14'))(_0x6118('0x15'));var utils=require(_0x6118('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6118('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x550a19,_0x213570){_0x213570=_0x213570||0xcc;return function(_0x19ef47){if(_0x19ef47){return _0x550a19['sendStatus'](_0x213570);}return _0x550a19[_0x6118('0x18')](_0x213570)[_0x6118('0x19')]();};}function respondWithResult(_0x3bf1df,_0x4a1b9f){_0x4a1b9f=_0x4a1b9f||0xc8;return function(_0x44f883){if(_0x44f883){return _0x3bf1df[_0x6118('0x18')](_0x4a1b9f)[_0x6118('0x1a')](_0x44f883);}};}function respondWithFilteredResult(_0x3b7320,_0x300499){return function(_0x440da9){if(_0x440da9){var _0x2a0d16=typeof _0x300499[_0x6118('0x1b')]===_0x6118('0x1c')&&typeof _0x300499[_0x6118('0x1d')]===_0x6118('0x1c');var _0x503447=_0x440da9[_0x6118('0x1e')];var _0x3c9f41=_0x2a0d16?0x0:_0x300499[_0x6118('0x1b')];var _0x4489f4=_0x2a0d16?_0x440da9[_0x6118('0x1e')]:_0x300499[_0x6118('0x1b')]+_0x300499[_0x6118('0x1d')];var _0x379235;if(_0x4489f4>=_0x503447){_0x4489f4=_0x503447;_0x379235=0xc8;}else{_0x379235=0xce;}_0x3b7320[_0x6118('0x18')](_0x379235);return _0x3b7320[_0x6118('0x1f')]('Content-Range',_0x3c9f41+'-'+_0x4489f4+'/'+_0x503447)[_0x6118('0x1a')](_0x440da9);}return null;};}function patchUpdates(_0x5b2b93){return function(_0x1ddc6b){try{jsonpatch[_0x6118('0x20')](_0x1ddc6b,_0x5b2b93,!![]);}catch(_0x435b26){return BPromise['reject'](_0x435b26);}return _0x1ddc6b[_0x6118('0x21')]();};}function saveUpdates(_0x1d5799,_0x1d02e9){return function(_0x17aefb){if(_0x17aefb){return _0x17aefb[_0x6118('0x22')](_0x1d5799)[_0x6118('0x23')](function(_0x59eb54){return _0x59eb54;});}return null;};}function removeEntity(_0x26e151,_0x2f3f64){return function(_0x58847f){if(_0x58847f){return _0x58847f['destroy']()[_0x6118('0x23')](function(){_0x26e151[_0x6118('0x18')](0xcc)[_0x6118('0x19')]();});}};}function handleEntityNotFound(_0x140c22,_0x3e2abd){return function(_0x397286){if(!_0x397286){_0x140c22['sendStatus'](0x194);}return _0x397286;};}function handleError(_0x5c4928,_0x1a5565){_0x1a5565=_0x1a5565||0x1f4;return function(_0x5295d4){logger[_0x6118('0x24')](_0x5295d4['stack']);if(_0x5295d4[_0x6118('0x25')]){delete _0x5295d4[_0x6118('0x25')];}_0x5c4928[_0x6118('0x18')](_0x1a5565)['send'](_0x5295d4);};}exports[_0x6118('0x26')]=function(_0x371589,_0x1d8448){var _0x31fcb1={},_0x3fa371={},_0x296f04={'count':0x0,'rows':[]};var _0x44b6e4=_['map'](db[_0x6118('0x27')][_0x6118('0x28')],function(_0x4f964c){return{'name':_0x4f964c['fieldName'],'type':_0x4f964c[_0x6118('0x29')]['key']};});_0x3fa371[_0x6118('0x2a')]=_[_0x6118('0x2b')](_0x44b6e4,_0x6118('0x25'));_0x3fa371[_0x6118('0x2c')]=_[_0x6118('0x2d')](_0x371589[_0x6118('0x2c')]);_0x3fa371['filters']=_[_0x6118('0x2e')](_0x3fa371['model'],_0x3fa371[_0x6118('0x2c')]);_0x31fcb1['attributes']=_[_0x6118('0x2e')](_0x3fa371[_0x6118('0x2a')],qs[_0x6118('0x2f')](_0x371589[_0x6118('0x2c')][_0x6118('0x2f')]));_0x31fcb1[_0x6118('0x30')]=_0x31fcb1[_0x6118('0x30')][_0x6118('0x31')]?_0x31fcb1[_0x6118('0x30')]:_0x3fa371['model'];if(!_0x371589[_0x6118('0x2c')][_0x6118('0x32')](_0x6118('0x33'))){_0x31fcb1[_0x6118('0x1d')]=qs[_0x6118('0x1d')](_0x371589[_0x6118('0x2c')][_0x6118('0x1d')]);_0x31fcb1[_0x6118('0x1b')]=qs[_0x6118('0x1b')](_0x371589[_0x6118('0x2c')]['offset']);}_0x31fcb1['order']=qs['sort'](_0x371589['query'][_0x6118('0x34')]);_0x31fcb1['where']=qs[_0x6118('0x35')](_[_0x6118('0x36')](_0x371589[_0x6118('0x2c')],_0x3fa371[_0x6118('0x35')]),_0x44b6e4);if(_0x371589[_0x6118('0x2c')]['filter']){_0x31fcb1['where']=_['merge'](_0x31fcb1[_0x6118('0x37')],{'$or':_['map'](_0x44b6e4,function(_0x4fb67e){if(_0x4fb67e[_0x6118('0x29')]!==_0x6118('0x38')){var _0x3d9a4a={};_0x3d9a4a[_0x4fb67e[_0x6118('0x25')]]={'$like':'%'+_0x371589[_0x6118('0x2c')][_0x6118('0x39')]+'%'};return _0x3d9a4a;}})});}_0x31fcb1=_['merge']({},_0x31fcb1,_0x371589[_0x6118('0x3a')]);var _0x5589e0={'where':_0x31fcb1[_0x6118('0x37')]};return db['ZendeskConfiguration']['count'](_0x5589e0)[_0x6118('0x23')](function(_0x4ff50a){_0x296f04[_0x6118('0x1e')]=_0x4ff50a;if(_0x371589[_0x6118('0x2c')][_0x6118('0x3b')]){_0x31fcb1[_0x6118('0x3c')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x31fcb1);})[_0x6118('0x23')](function(_0x4ae4fa){_0x296f04[_0x6118('0x3d')]=_0x4ae4fa;return _0x296f04;})[_0x6118('0x23')](respondWithFilteredResult(_0x1d8448,_0x31fcb1))[_0x6118('0x3e')](handleError(_0x1d8448,null));};exports[_0x6118('0x3f')]=function(_0x31b03d,_0x1f82ea){var _0x101df2={'raw':![],'where':{'id':_0x31b03d['params']['id']}},_0x29da68={};_0x29da68[_0x6118('0x2a')]=_['keys'](db[_0x6118('0x27')][_0x6118('0x28')]);_0x29da68[_0x6118('0x2c')]=_[_0x6118('0x2d')](_0x31b03d[_0x6118('0x2c')]);_0x29da68['filters']=_['intersection'](_0x29da68[_0x6118('0x2a')],_0x29da68[_0x6118('0x2c')]);_0x101df2[_0x6118('0x30')]=_['intersection'](_0x29da68[_0x6118('0x2a')],qs[_0x6118('0x2f')](_0x31b03d[_0x6118('0x2c')][_0x6118('0x2f')]));_0x101df2['attributes']=_0x101df2[_0x6118('0x30')][_0x6118('0x31')]?_0x101df2['attributes']:_0x29da68['model'];if(_0x31b03d['query'][_0x6118('0x3b')]){_0x101df2['include']=[{'all':!![]}];}_0x101df2=_[_0x6118('0x40')]({},_0x101df2,_0x31b03d[_0x6118('0x3a')]);return db['ZendeskConfiguration'][_0x6118('0x41')](_0x101df2)[_0x6118('0x23')](handleEntityNotFound(_0x1f82ea,null))[_0x6118('0x23')](respondWithResult(_0x1f82ea,null))['catch'](handleError(_0x1f82ea,null));};exports[_0x6118('0x42')]=function(_0x528dff,_0x403291){return db[_0x6118('0x27')][_0x6118('0x42')](_0x528dff[_0x6118('0x43')],{})[_0x6118('0x23')](respondWithResult(_0x403291,0xc9))[_0x6118('0x3e')](handleError(_0x403291,null));};exports[_0x6118('0x22')]=function(_0x3e5e72,_0xdc6f01){if(_0x3e5e72['body']['id']){delete _0x3e5e72[_0x6118('0x43')]['id'];}return db[_0x6118('0x27')]['find']({'where':{'id':_0x3e5e72[_0x6118('0x44')]['id']}})[_0x6118('0x23')](handleEntityNotFound(_0xdc6f01,null))[_0x6118('0x23')](saveUpdates(_0x3e5e72[_0x6118('0x43')],null))[_0x6118('0x23')](respondWithResult(_0xdc6f01,null))[_0x6118('0x3e')](handleError(_0xdc6f01,null));};exports['destroy']=function(_0x485586,_0x5911ca){return db[_0x6118('0x27')][_0x6118('0x41')]({'where':{'id':_0x485586['params']['id']}})[_0x6118('0x23')](handleEntityNotFound(_0x5911ca,null))['then'](removeEntity(_0x5911ca,null))[_0x6118('0x3e')](handleError(_0x5911ca,null));};exports[_0x6118('0x45')]=function(_0x5591af,_0x55be91,_0xd41d85){var _0x238492={};var _0x237b79={};var _0x4cd6b0;var _0x2a9afc;return db[_0x6118('0x27')][_0x6118('0x46')]({'where':{'id':_0x5591af[_0x6118('0x44')]['id']}})[_0x6118('0x23')](handleEntityNotFound(_0x55be91,null))[_0x6118('0x23')](function(_0x14b305){if(_0x14b305){_0x4cd6b0=_0x14b305;_0x237b79[_0x6118('0x2a')]=_[_0x6118('0x2d')](db[_0x6118('0x47')][_0x6118('0x28')]);_0x237b79[_0x6118('0x2c')]=_[_0x6118('0x2d')](_0x5591af[_0x6118('0x2c')]);_0x237b79['filters']=_['intersection'](_0x237b79['model'],_0x237b79[_0x6118('0x2c')]);_0x238492[_0x6118('0x30')]=_['intersection'](_0x237b79[_0x6118('0x2a')],qs[_0x6118('0x2f')](_0x5591af[_0x6118('0x2c')][_0x6118('0x2f')]));_0x238492[_0x6118('0x30')]=_0x238492[_0x6118('0x30')][_0x6118('0x31')]?_0x238492[_0x6118('0x30')]:_0x237b79[_0x6118('0x2a')];_0x238492[_0x6118('0x48')]=qs[_0x6118('0x34')](_0x5591af[_0x6118('0x2c')][_0x6118('0x34')]);_0x238492[_0x6118('0x37')]=qs[_0x6118('0x35')](_[_0x6118('0x36')](_0x5591af[_0x6118('0x2c')],_0x237b79[_0x6118('0x35')]));if(_0x5591af[_0x6118('0x2c')][_0x6118('0x39')]){_0x238492['where']=_[_0x6118('0x40')](_0x238492[_0x6118('0x37')],{'$or':_[_0x6118('0x2b')](_0x238492[_0x6118('0x30')],function(_0x2458ad){var _0x2fe0c8={};_0x2fe0c8[_0x2458ad]={'$like':'%'+_0x5591af[_0x6118('0x2c')][_0x6118('0x39')]+'%'};return _0x2fe0c8;})});}_0x238492=_[_0x6118('0x40')]({},_0x238492,_0x5591af[_0x6118('0x3a')]);return _0x4cd6b0['getFields'](_0x238492);}})[_0x6118('0x23')](function(_0xb4ff37){if(_0xb4ff37){_0x2a9afc=_0xb4ff37['length'];if(!_0x5591af['query'][_0x6118('0x32')](_0x6118('0x33'))){_0x238492[_0x6118('0x1d')]=qs[_0x6118('0x1d')](_0x5591af[_0x6118('0x2c')][_0x6118('0x1d')]);_0x238492[_0x6118('0x1b')]=qs[_0x6118('0x1b')](_0x5591af[_0x6118('0x2c')]['offset']);}return _0x4cd6b0[_0x6118('0x45')](_0x238492);}})['then'](function(_0x52dace){if(_0x52dace){return _0x52dace?{'count':_0x2a9afc,'rows':_0x52dace}:null;}})[_0x6118('0x23')](respondWithResult(_0x55be91,null))[_0x6118('0x3e')](handleError(_0x55be91,null));};exports[_0x6118('0x49')]=function(_0x678a87,_0x1dd078,_0x1f0bdb){var _0x4d9616={};var _0x6ee4dd={};var _0x2b6a98;var _0x158de6;return db[_0x6118('0x27')][_0x6118('0x46')]({'where':{'id':_0x678a87[_0x6118('0x44')]['id']}})[_0x6118('0x23')](handleEntityNotFound(_0x1dd078,null))[_0x6118('0x23')](function(_0xc27df2){if(_0xc27df2){_0x2b6a98=_0xc27df2;_0x6ee4dd['model']=_[_0x6118('0x2d')](db[_0x6118('0x47')]['rawAttributes']);_0x6ee4dd['query']=_[_0x6118('0x2d')](_0x678a87[_0x6118('0x2c')]);_0x6ee4dd[_0x6118('0x35')]=_[_0x6118('0x2e')](_0x6ee4dd[_0x6118('0x2a')],_0x6ee4dd['query']);_0x4d9616[_0x6118('0x30')]=_[_0x6118('0x2e')](_0x6ee4dd[_0x6118('0x2a')],qs['fields'](_0x678a87['query'][_0x6118('0x2f')]));_0x4d9616[_0x6118('0x30')]=_0x4d9616['attributes'][_0x6118('0x31')]?_0x4d9616[_0x6118('0x30')]:_0x6ee4dd['model'];_0x4d9616['order']=qs['sort'](_0x678a87[_0x6118('0x2c')][_0x6118('0x34')]);_0x4d9616[_0x6118('0x37')]=qs[_0x6118('0x35')](_[_0x6118('0x36')](_0x678a87['query'],_0x6ee4dd[_0x6118('0x35')]));if(_0x678a87[_0x6118('0x2c')][_0x6118('0x39')]){_0x4d9616['where']=_['merge'](_0x4d9616[_0x6118('0x37')],{'$or':_[_0x6118('0x2b')](_0x4d9616[_0x6118('0x30')],function(_0x3e8afb){var _0x5cf671={};_0x5cf671[_0x3e8afb]={'$like':'%'+_0x678a87[_0x6118('0x2c')][_0x6118('0x39')]+'%'};return _0x5cf671;})});}_0x4d9616=_[_0x6118('0x40')]({},_0x4d9616,_0x678a87[_0x6118('0x3a')]);return _0x2b6a98['getSubjects'](_0x4d9616);}})['then'](function(_0x7959b9){if(_0x7959b9){_0x158de6=_0x7959b9[_0x6118('0x31')];if(!_0x678a87[_0x6118('0x2c')][_0x6118('0x32')](_0x6118('0x33'))){_0x4d9616[_0x6118('0x1d')]=qs[_0x6118('0x1d')](_0x678a87[_0x6118('0x2c')][_0x6118('0x1d')]);_0x4d9616[_0x6118('0x1b')]=qs['offset'](_0x678a87[_0x6118('0x2c')][_0x6118('0x1b')]);}return _0x2b6a98[_0x6118('0x49')](_0x4d9616);}})[_0x6118('0x23')](function(_0x5c90e7){if(_0x5c90e7){return _0x5c90e7?{'count':_0x158de6,'rows':_0x5c90e7}:null;}})[_0x6118('0x23')](respondWithResult(_0x1dd078,null))[_0x6118('0x3e')](handleError(_0x1dd078,null));};exports[_0x6118('0x4a')]=function(_0x51ffe4,_0xda6f29,_0x4304d0){var _0x551307={};var _0x39e8e3={};var _0x19ec0b;var _0x1787c8;return db[_0x6118('0x27')][_0x6118('0x46')]({'where':{'id':_0x51ffe4['params']['id']}})['then'](handleEntityNotFound(_0xda6f29,null))[_0x6118('0x23')](function(_0x436cad){if(_0x436cad){_0x19ec0b=_0x436cad;_0x39e8e3[_0x6118('0x2a')]=_[_0x6118('0x2d')](db[_0x6118('0x47')][_0x6118('0x28')]);_0x39e8e3[_0x6118('0x2c')]=_[_0x6118('0x2d')](_0x51ffe4[_0x6118('0x2c')]);_0x39e8e3[_0x6118('0x35')]=_[_0x6118('0x2e')](_0x39e8e3['model'],_0x39e8e3[_0x6118('0x2c')]);_0x551307[_0x6118('0x30')]=_[_0x6118('0x2e')](_0x39e8e3[_0x6118('0x2a')],qs['fields'](_0x51ffe4['query']['fields']));_0x551307[_0x6118('0x30')]=_0x551307[_0x6118('0x30')][_0x6118('0x31')]?_0x551307[_0x6118('0x30')]:_0x39e8e3[_0x6118('0x2a')];_0x551307['order']=qs['sort'](_0x51ffe4[_0x6118('0x2c')][_0x6118('0x34')]);_0x551307['where']=qs[_0x6118('0x35')](_[_0x6118('0x36')](_0x51ffe4['query'],_0x39e8e3[_0x6118('0x35')]));if(_0x51ffe4['query']['filter']){_0x551307[_0x6118('0x37')]=_[_0x6118('0x40')](_0x551307[_0x6118('0x37')],{'$or':_['map'](_0x551307[_0x6118('0x30')],function(_0x46a9ae){var _0x1f328c={};_0x1f328c[_0x46a9ae]={'$like':'%'+_0x51ffe4[_0x6118('0x2c')][_0x6118('0x39')]+'%'};return _0x1f328c;})});}_0x551307=_[_0x6118('0x40')]({},_0x551307,_0x51ffe4[_0x6118('0x3a')]);return _0x19ec0b[_0x6118('0x4a')](_0x551307);}})[_0x6118('0x23')](function(_0x2f7ad0){if(_0x2f7ad0){_0x1787c8=_0x2f7ad0[_0x6118('0x31')];if(!_0x51ffe4['query'][_0x6118('0x32')](_0x6118('0x33'))){_0x551307[_0x6118('0x1d')]=qs[_0x6118('0x1d')](_0x51ffe4['query'][_0x6118('0x1d')]);_0x551307[_0x6118('0x1b')]=qs[_0x6118('0x1b')](_0x51ffe4[_0x6118('0x2c')][_0x6118('0x1b')]);}return _0x19ec0b[_0x6118('0x4a')](_0x551307);}})[_0x6118('0x23')](function(_0x15f84b){if(_0x15f84b){return _0x15f84b?{'count':_0x1787c8,'rows':_0x15f84b}:null;}})['then'](respondWithResult(_0xda6f29,null))[_0x6118('0x3e')](handleError(_0xda6f29,null));};exports[_0x6118('0x4b')]=function(_0x2134fb,_0x45a2e2,_0xcbd2e7){var _0x301351={};var _0x2c66c6={};var _0x5677d3;var _0x24b3d2;return db[_0x6118('0x27')][_0x6118('0x46')]({'where':{'id':_0x2134fb[_0x6118('0x44')]['id']}})[_0x6118('0x23')](handleEntityNotFound(_0x45a2e2,null))[_0x6118('0x23')](function(_0x23500f){if(_0x23500f){_0x5677d3=_0x23500f;_0x2c66c6[_0x6118('0x2a')]=_[_0x6118('0x2d')](db[_0x6118('0x4c')][_0x6118('0x28')]);_0x2c66c6[_0x6118('0x2c')]=_['keys'](_0x2134fb['query']);_0x2c66c6[_0x6118('0x35')]=_[_0x6118('0x2e')](_0x2c66c6[_0x6118('0x2a')],_0x2c66c6[_0x6118('0x2c')]);_0x301351[_0x6118('0x30')]=_['intersection'](_0x2c66c6['model'],qs[_0x6118('0x2f')](_0x2134fb[_0x6118('0x2c')]['fields']));_0x301351[_0x6118('0x30')]=_0x301351[_0x6118('0x30')][_0x6118('0x31')]?_0x301351['attributes']:_0x2c66c6['model'];_0x301351[_0x6118('0x48')]=qs['sort'](_0x2134fb['query']['sort']);_0x301351[_0x6118('0x37')]=qs[_0x6118('0x35')](_[_0x6118('0x36')](_0x2134fb[_0x6118('0x2c')],_0x2c66c6[_0x6118('0x35')]));if(_0x2134fb[_0x6118('0x2c')][_0x6118('0x39')]){_0x301351[_0x6118('0x37')]=_[_0x6118('0x40')](_0x301351[_0x6118('0x37')],{'$or':_[_0x6118('0x2b')](_0x301351[_0x6118('0x30')],function(_0x52edfd){var _0x3f3b9b={};_0x3f3b9b[_0x52edfd]={'$like':'%'+_0x2134fb['query'][_0x6118('0x39')]+'%'};return _0x3f3b9b;})});}_0x301351=_[_0x6118('0x40')]({},_0x301351,_0x2134fb['options']);return _0x5677d3[_0x6118('0x4b')](_0x301351);}})['then'](function(_0x42a775){if(_0x42a775){_0x24b3d2=_0x42a775[_0x6118('0x31')];if(!_0x2134fb['query'][_0x6118('0x32')](_0x6118('0x33'))){_0x301351[_0x6118('0x1d')]=qs[_0x6118('0x1d')](_0x2134fb[_0x6118('0x2c')][_0x6118('0x1d')]);_0x301351[_0x6118('0x1b')]=qs['offset'](_0x2134fb[_0x6118('0x2c')]['offset']);}return _0x5677d3[_0x6118('0x4b')](_0x301351);}})[_0x6118('0x23')](function(_0x4e4779){if(_0x4e4779){return _0x4e4779?{'count':_0x24b3d2,'rows':_0x4e4779}:null;}})[_0x6118('0x23')](respondWithResult(_0x45a2e2,null))[_0x6118('0x3e')](handleError(_0x45a2e2,null));};exports[_0x6118('0x4d')]=function(_0x2d2b1e,_0x4d74aa,_0x46e901){if(_0x2d2b1e['body']['id']){delete _0x2d2b1e[_0x6118('0x43')]['id'];}return db['ZendeskConfiguration'][_0x6118('0x46')]({'where':{'id':_0x2d2b1e[_0x6118('0x44')]['id']}})[_0x6118('0x23')](handleEntityNotFound(_0x4d74aa,null))[_0x6118('0x23')](function(_0x5dc0ac){if(_0x5dc0ac){return _0x5dc0ac[_0x6118('0x4d')](_0x2d2b1e[_0x6118('0x43')][_0x6118('0x4e')]||[]);}return null;})[_0x6118('0x23')](respondWithResult(_0x4d74aa,null))[_0x6118('0x3e')](handleError(_0x4d74aa,null));}; \ No newline at end of file +var _0xc009=['getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','include','catch','show','rawAttributes','includeAll','find','create','body','params','getFields','findOne','ZendeskField','order','hasOwnProperty','getSubjects'];(function(_0x15523b,_0x388fe6){var _0x409eed=function(_0x2e79c4){while(--_0x2e79c4){_0x15523b['push'](_0x15523b['shift']());}};_0x409eed(++_0x388fe6);}(_0xc009,0x1a2));var _0x9c00=function(_0x90a5b5,_0x4229e5){_0x90a5b5=_0x90a5b5-0x0;var _0x4415e6=_0xc009[_0x90a5b5];return _0x4415e6;};'use strict';var emlformat=require(_0x9c00('0x0'));var rimraf=require(_0x9c00('0x1'));var zipdir=require(_0x9c00('0x2'));var jsonpatch=require(_0x9c00('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9c00('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9c00('0x5'));var sox=require(_0x9c00('0x6'));var csv=require(_0x9c00('0x7'));var ejs=require(_0x9c00('0x8'));var fs=require('fs');var fs_extra=require(_0x9c00('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c00('0xa'));var jsforce=require(_0x9c00('0xb'));var deskjs=require(_0x9c00('0xc'));var toCsv=require(_0x9c00('0x7'));var querystring=require(_0x9c00('0xd'));var Papa=require(_0x9c00('0xe'));var Redis=require(_0x9c00('0xf'));var authService=require(_0x9c00('0x10'));var qs=require(_0x9c00('0x11'));var as=require(_0x9c00('0x12'));var hardwareService=require(_0x9c00('0x13'));var logger=require('../../config/logger')(_0x9c00('0x14'));var utils=require(_0x9c00('0x15'));var config=require(_0x9c00('0x16'));var licenseUtil=require(_0x9c00('0x17'));var db=require(_0x9c00('0x18'))['db'];function respondWithStatusCode(_0x435cf8,_0x5d48fb){_0x5d48fb=_0x5d48fb||0xcc;return function(_0x344985){if(_0x344985){return _0x435cf8['sendStatus'](_0x5d48fb);}return _0x435cf8['status'](_0x5d48fb)['end']();};}function respondWithResult(_0x41fe69,_0x496f68){_0x496f68=_0x496f68||0xc8;return function(_0x54ad1d){if(_0x54ad1d){return _0x41fe69[_0x9c00('0x19')](_0x496f68)[_0x9c00('0x1a')](_0x54ad1d);}};}function respondWithFilteredResult(_0x2c6db3,_0x286289){return function(_0x2a89ba){if(_0x2a89ba){var _0x359bc1=typeof _0x286289['offset']===_0x9c00('0x1b')&&typeof _0x286289[_0x9c00('0x1c')]===_0x9c00('0x1b');var _0x28774f=_0x2a89ba[_0x9c00('0x1d')];var _0x214a39=_0x359bc1?0x0:_0x286289[_0x9c00('0x1e')];var _0x23ad19=_0x359bc1?_0x2a89ba[_0x9c00('0x1d')]:_0x286289[_0x9c00('0x1e')]+_0x286289[_0x9c00('0x1c')];var _0x4730dc;if(_0x23ad19>=_0x28774f){_0x23ad19=_0x28774f;_0x4730dc=0xc8;}else{_0x4730dc=0xce;}_0x2c6db3['status'](_0x4730dc);return _0x2c6db3[_0x9c00('0x1f')](_0x9c00('0x20'),_0x214a39+'-'+_0x23ad19+'/'+_0x28774f)[_0x9c00('0x1a')](_0x2a89ba);}return null;};}function patchUpdates(_0x4ad826){return function(_0x5b5c76){try{jsonpatch[_0x9c00('0x21')](_0x5b5c76,_0x4ad826,!![]);}catch(_0xdd33b7){return BPromise[_0x9c00('0x22')](_0xdd33b7);}return _0x5b5c76[_0x9c00('0x23')]();};}function saveUpdates(_0x4c2fd0,_0x5b6299){return function(_0x3197f1){if(_0x3197f1){return _0x3197f1[_0x9c00('0x24')](_0x4c2fd0)[_0x9c00('0x25')](function(_0x151985){return _0x151985;});}return null;};}function removeEntity(_0x17a809,_0x5e872b){return function(_0x51607e){if(_0x51607e){return _0x51607e[_0x9c00('0x26')]()[_0x9c00('0x25')](function(){_0x17a809['status'](0xcc)[_0x9c00('0x27')]();});}};}function handleEntityNotFound(_0x29d0c6,_0x3a80b5){return function(_0x5e337a){if(!_0x5e337a){_0x29d0c6[_0x9c00('0x28')](0x194);}return _0x5e337a;};}function handleError(_0x352bdf,_0x877b77){_0x877b77=_0x877b77||0x1f4;return function(_0x21426f){logger['error'](_0x21426f[_0x9c00('0x29')]);if(_0x21426f[_0x9c00('0x2a')]){delete _0x21426f['name'];}_0x352bdf[_0x9c00('0x19')](_0x877b77)[_0x9c00('0x2b')](_0x21426f);};}exports[_0x9c00('0x2c')]=function(_0x14f171,_0x4ac475){var _0x8bed45={},_0x5c559a={},_0x2f7c0e={'count':0x0,'rows':[]};var _0x286bf5=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x22284a){return{'name':_0x22284a[_0x9c00('0x2d')],'type':_0x22284a[_0x9c00('0x2e')]['key']};});_0x5c559a[_0x9c00('0x2f')]=_[_0x9c00('0x30')](_0x286bf5,_0x9c00('0x2a'));_0x5c559a[_0x9c00('0x31')]=_[_0x9c00('0x32')](_0x14f171['query']);_0x5c559a[_0x9c00('0x33')]=_[_0x9c00('0x34')](_0x5c559a['model'],_0x5c559a['query']);_0x8bed45[_0x9c00('0x35')]=_[_0x9c00('0x34')](_0x5c559a[_0x9c00('0x2f')],qs[_0x9c00('0x36')](_0x14f171[_0x9c00('0x31')]['fields']));_0x8bed45[_0x9c00('0x35')]=_0x8bed45['attributes'][_0x9c00('0x37')]?_0x8bed45[_0x9c00('0x35')]:_0x5c559a[_0x9c00('0x2f')];if(!_0x14f171['query']['hasOwnProperty'](_0x9c00('0x38'))){_0x8bed45['limit']=qs[_0x9c00('0x1c')](_0x14f171['query'][_0x9c00('0x1c')]);_0x8bed45['offset']=qs['offset'](_0x14f171[_0x9c00('0x31')]['offset']);}_0x8bed45['order']=qs[_0x9c00('0x39')](_0x14f171[_0x9c00('0x31')][_0x9c00('0x39')]);_0x8bed45[_0x9c00('0x3a')]=qs[_0x9c00('0x33')](_[_0x9c00('0x3b')](_0x14f171[_0x9c00('0x31')],_0x5c559a[_0x9c00('0x33')]),_0x286bf5);if(_0x14f171['query'][_0x9c00('0x3c')]){_0x8bed45[_0x9c00('0x3a')]=_[_0x9c00('0x3d')](_0x8bed45[_0x9c00('0x3a')],{'$or':_[_0x9c00('0x30')](_0x286bf5,function(_0x22aa46){if(_0x22aa46[_0x9c00('0x2e')]!==_0x9c00('0x3e')){var _0x58cfe8={};_0x58cfe8[_0x22aa46['name']]={'$like':'%'+_0x14f171['query'][_0x9c00('0x3c')]+'%'};return _0x58cfe8;}})});}_0x8bed45=_[_0x9c00('0x3d')]({},_0x8bed45,_0x14f171[_0x9c00('0x3f')]);var _0x3e237f={'where':_0x8bed45[_0x9c00('0x3a')]};return db[_0x9c00('0x40')]['count'](_0x3e237f)[_0x9c00('0x25')](function(_0x1c8c89){_0x2f7c0e[_0x9c00('0x1d')]=_0x1c8c89;if(_0x14f171[_0x9c00('0x31')]['includeAll']){_0x8bed45[_0x9c00('0x41')]=[{'all':!![]}];}return db[_0x9c00('0x40')]['findAll'](_0x8bed45);})[_0x9c00('0x25')](function(_0x36d8d8){_0x2f7c0e['rows']=_0x36d8d8;return _0x2f7c0e;})['then'](respondWithFilteredResult(_0x4ac475,_0x8bed45))[_0x9c00('0x42')](handleError(_0x4ac475,null));};exports[_0x9c00('0x43')]=function(_0xd8d48c,_0x167b20){var _0x40115e={'raw':![],'where':{'id':_0xd8d48c['params']['id']}},_0x391986={};_0x391986['model']=_[_0x9c00('0x32')](db[_0x9c00('0x40')][_0x9c00('0x44')]);_0x391986[_0x9c00('0x31')]=_[_0x9c00('0x32')](_0xd8d48c['query']);_0x391986[_0x9c00('0x33')]=_[_0x9c00('0x34')](_0x391986['model'],_0x391986[_0x9c00('0x31')]);_0x40115e[_0x9c00('0x35')]=_[_0x9c00('0x34')](_0x391986[_0x9c00('0x2f')],qs[_0x9c00('0x36')](_0xd8d48c[_0x9c00('0x31')][_0x9c00('0x36')]));_0x40115e[_0x9c00('0x35')]=_0x40115e[_0x9c00('0x35')][_0x9c00('0x37')]?_0x40115e[_0x9c00('0x35')]:_0x391986['model'];if(_0xd8d48c['query'][_0x9c00('0x45')]){_0x40115e[_0x9c00('0x41')]=[{'all':!![]}];}_0x40115e=_[_0x9c00('0x3d')]({},_0x40115e,_0xd8d48c[_0x9c00('0x3f')]);return db[_0x9c00('0x40')][_0x9c00('0x46')](_0x40115e)[_0x9c00('0x25')](handleEntityNotFound(_0x167b20,null))['then'](respondWithResult(_0x167b20,null))[_0x9c00('0x42')](handleError(_0x167b20,null));};exports['create']=function(_0x2ca1ac,_0x1de372){return db[_0x9c00('0x40')][_0x9c00('0x47')](_0x2ca1ac[_0x9c00('0x48')],{})[_0x9c00('0x25')](respondWithResult(_0x1de372,0xc9))['catch'](handleError(_0x1de372,null));};exports[_0x9c00('0x24')]=function(_0x32661b,_0xe98c97){if(_0x32661b[_0x9c00('0x48')]['id']){delete _0x32661b['body']['id'];}return db[_0x9c00('0x40')][_0x9c00('0x46')]({'where':{'id':_0x32661b[_0x9c00('0x49')]['id']}})[_0x9c00('0x25')](handleEntityNotFound(_0xe98c97,null))[_0x9c00('0x25')](saveUpdates(_0x32661b[_0x9c00('0x48')],null))[_0x9c00('0x25')](respondWithResult(_0xe98c97,null))[_0x9c00('0x42')](handleError(_0xe98c97,null));};exports['destroy']=function(_0x328afa,_0x682911){return db[_0x9c00('0x40')][_0x9c00('0x46')]({'where':{'id':_0x328afa['params']['id']}})[_0x9c00('0x25')](handleEntityNotFound(_0x682911,null))[_0x9c00('0x25')](removeEntity(_0x682911,null))['catch'](handleError(_0x682911,null));};exports[_0x9c00('0x4a')]=function(_0x482894,_0x226f41,_0x40743f){var _0x100286={};var _0x57a478={};var _0x31e1ec;var _0x3be502;return db['ZendeskConfiguration'][_0x9c00('0x4b')]({'where':{'id':_0x482894[_0x9c00('0x49')]['id']}})['then'](handleEntityNotFound(_0x226f41,null))[_0x9c00('0x25')](function(_0x1828cf){if(_0x1828cf){_0x31e1ec=_0x1828cf;_0x57a478[_0x9c00('0x2f')]=_[_0x9c00('0x32')](db[_0x9c00('0x4c')][_0x9c00('0x44')]);_0x57a478['query']=_[_0x9c00('0x32')](_0x482894[_0x9c00('0x31')]);_0x57a478[_0x9c00('0x33')]=_['intersection'](_0x57a478[_0x9c00('0x2f')],_0x57a478[_0x9c00('0x31')]);_0x100286['attributes']=_['intersection'](_0x57a478['model'],qs[_0x9c00('0x36')](_0x482894[_0x9c00('0x31')]['fields']));_0x100286[_0x9c00('0x35')]=_0x100286[_0x9c00('0x35')][_0x9c00('0x37')]?_0x100286[_0x9c00('0x35')]:_0x57a478[_0x9c00('0x2f')];_0x100286[_0x9c00('0x4d')]=qs[_0x9c00('0x39')](_0x482894['query'][_0x9c00('0x39')]);_0x100286[_0x9c00('0x3a')]=qs[_0x9c00('0x33')](_['pick'](_0x482894['query'],_0x57a478[_0x9c00('0x33')]));if(_0x482894[_0x9c00('0x31')][_0x9c00('0x3c')]){_0x100286[_0x9c00('0x3a')]=_['merge'](_0x100286[_0x9c00('0x3a')],{'$or':_[_0x9c00('0x30')](_0x100286['attributes'],function(_0x461aa5){var _0x5aefaa={};_0x5aefaa[_0x461aa5]={'$like':'%'+_0x482894[_0x9c00('0x31')][_0x9c00('0x3c')]+'%'};return _0x5aefaa;})});}_0x100286=_[_0x9c00('0x3d')]({},_0x100286,_0x482894[_0x9c00('0x3f')]);return _0x31e1ec[_0x9c00('0x4a')](_0x100286);}})[_0x9c00('0x25')](function(_0xb9afbc){if(_0xb9afbc){_0x3be502=_0xb9afbc[_0x9c00('0x37')];if(!_0x482894[_0x9c00('0x31')][_0x9c00('0x4e')](_0x9c00('0x38'))){_0x100286[_0x9c00('0x1c')]=qs['limit'](_0x482894[_0x9c00('0x31')][_0x9c00('0x1c')]);_0x100286[_0x9c00('0x1e')]=qs[_0x9c00('0x1e')](_0x482894[_0x9c00('0x31')][_0x9c00('0x1e')]);}return _0x31e1ec['getFields'](_0x100286);}})[_0x9c00('0x25')](function(_0x4dcac9){if(_0x4dcac9){return _0x4dcac9?{'count':_0x3be502,'rows':_0x4dcac9}:null;}})['then'](respondWithResult(_0x226f41,null))[_0x9c00('0x42')](handleError(_0x226f41,null));};exports['getSubjects']=function(_0x36e49b,_0x2a3146,_0x3c11cc){var _0x5d67a4={};var _0x3f494b={};var _0x4911a7;var _0x2ecb4b;return db[_0x9c00('0x40')][_0x9c00('0x4b')]({'where':{'id':_0x36e49b[_0x9c00('0x49')]['id']}})[_0x9c00('0x25')](handleEntityNotFound(_0x2a3146,null))[_0x9c00('0x25')](function(_0x315bc4){if(_0x315bc4){_0x4911a7=_0x315bc4;_0x3f494b[_0x9c00('0x2f')]=_[_0x9c00('0x32')](db['ZendeskField'][_0x9c00('0x44')]);_0x3f494b[_0x9c00('0x31')]=_[_0x9c00('0x32')](_0x36e49b[_0x9c00('0x31')]);_0x3f494b[_0x9c00('0x33')]=_[_0x9c00('0x34')](_0x3f494b[_0x9c00('0x2f')],_0x3f494b[_0x9c00('0x31')]);_0x5d67a4[_0x9c00('0x35')]=_[_0x9c00('0x34')](_0x3f494b['model'],qs['fields'](_0x36e49b[_0x9c00('0x31')][_0x9c00('0x36')]));_0x5d67a4[_0x9c00('0x35')]=_0x5d67a4[_0x9c00('0x35')][_0x9c00('0x37')]?_0x5d67a4[_0x9c00('0x35')]:_0x3f494b['model'];_0x5d67a4['order']=qs[_0x9c00('0x39')](_0x36e49b[_0x9c00('0x31')]['sort']);_0x5d67a4[_0x9c00('0x3a')]=qs['filters'](_[_0x9c00('0x3b')](_0x36e49b[_0x9c00('0x31')],_0x3f494b[_0x9c00('0x33')]));if(_0x36e49b[_0x9c00('0x31')]['filter']){_0x5d67a4['where']=_[_0x9c00('0x3d')](_0x5d67a4[_0x9c00('0x3a')],{'$or':_[_0x9c00('0x30')](_0x5d67a4[_0x9c00('0x35')],function(_0x2cc081){var _0x547376={};_0x547376[_0x2cc081]={'$like':'%'+_0x36e49b[_0x9c00('0x31')][_0x9c00('0x3c')]+'%'};return _0x547376;})});}_0x5d67a4=_[_0x9c00('0x3d')]({},_0x5d67a4,_0x36e49b[_0x9c00('0x3f')]);return _0x4911a7[_0x9c00('0x4f')](_0x5d67a4);}})[_0x9c00('0x25')](function(_0x4671fd){if(_0x4671fd){_0x2ecb4b=_0x4671fd['length'];if(!_0x36e49b[_0x9c00('0x31')]['hasOwnProperty']('nolimit')){_0x5d67a4[_0x9c00('0x1c')]=qs['limit'](_0x36e49b[_0x9c00('0x31')][_0x9c00('0x1c')]);_0x5d67a4[_0x9c00('0x1e')]=qs[_0x9c00('0x1e')](_0x36e49b[_0x9c00('0x31')][_0x9c00('0x1e')]);}return _0x4911a7[_0x9c00('0x4f')](_0x5d67a4);}})[_0x9c00('0x25')](function(_0x5b1989){if(_0x5b1989){return _0x5b1989?{'count':_0x2ecb4b,'rows':_0x5b1989}:null;}})[_0x9c00('0x25')](respondWithResult(_0x2a3146,null))[_0x9c00('0x42')](handleError(_0x2a3146,null));};exports['getDescriptions']=function(_0x15c3b2,_0x53d807,_0x265ec9){var _0xee9753={};var _0x216752={};var _0x5c4a53;var _0x272de6;return db[_0x9c00('0x40')][_0x9c00('0x4b')]({'where':{'id':_0x15c3b2[_0x9c00('0x49')]['id']}})['then'](handleEntityNotFound(_0x53d807,null))[_0x9c00('0x25')](function(_0x385ae4){if(_0x385ae4){_0x5c4a53=_0x385ae4;_0x216752['model']=_[_0x9c00('0x32')](db[_0x9c00('0x4c')][_0x9c00('0x44')]);_0x216752[_0x9c00('0x31')]=_['keys'](_0x15c3b2['query']);_0x216752['filters']=_['intersection'](_0x216752[_0x9c00('0x2f')],_0x216752[_0x9c00('0x31')]);_0xee9753['attributes']=_[_0x9c00('0x34')](_0x216752['model'],qs[_0x9c00('0x36')](_0x15c3b2['query']['fields']));_0xee9753['attributes']=_0xee9753[_0x9c00('0x35')]['length']?_0xee9753[_0x9c00('0x35')]:_0x216752[_0x9c00('0x2f')];_0xee9753[_0x9c00('0x4d')]=qs[_0x9c00('0x39')](_0x15c3b2[_0x9c00('0x31')][_0x9c00('0x39')]);_0xee9753[_0x9c00('0x3a')]=qs[_0x9c00('0x33')](_[_0x9c00('0x3b')](_0x15c3b2[_0x9c00('0x31')],_0x216752['filters']));if(_0x15c3b2[_0x9c00('0x31')][_0x9c00('0x3c')]){_0xee9753[_0x9c00('0x3a')]=_[_0x9c00('0x3d')](_0xee9753['where'],{'$or':_[_0x9c00('0x30')](_0xee9753[_0x9c00('0x35')],function(_0x2e8f56){var _0x11ee8d={};_0x11ee8d[_0x2e8f56]={'$like':'%'+_0x15c3b2[_0x9c00('0x31')]['filter']+'%'};return _0x11ee8d;})});}_0xee9753=_[_0x9c00('0x3d')]({},_0xee9753,_0x15c3b2[_0x9c00('0x3f')]);return _0x5c4a53['getDescriptions'](_0xee9753);}})[_0x9c00('0x25')](function(_0x9f0d36){if(_0x9f0d36){_0x272de6=_0x9f0d36[_0x9c00('0x37')];if(!_0x15c3b2[_0x9c00('0x31')][_0x9c00('0x4e')](_0x9c00('0x38'))){_0xee9753[_0x9c00('0x1c')]=qs[_0x9c00('0x1c')](_0x15c3b2[_0x9c00('0x31')][_0x9c00('0x1c')]);_0xee9753[_0x9c00('0x1e')]=qs[_0x9c00('0x1e')](_0x15c3b2['query'][_0x9c00('0x1e')]);}return _0x5c4a53['getDescriptions'](_0xee9753);}})[_0x9c00('0x25')](function(_0x22c1fb){if(_0x22c1fb){return _0x22c1fb?{'count':_0x272de6,'rows':_0x22c1fb}:null;}})[_0x9c00('0x25')](respondWithResult(_0x53d807,null))[_0x9c00('0x42')](handleError(_0x53d807,null));};exports[_0x9c00('0x50')]=function(_0x107b79,_0x12ba8b,_0x44977a){var _0x38b8a6={};var _0x31c2cb={};var _0x41e416;var _0xccfc81;return db['ZendeskConfiguration'][_0x9c00('0x4b')]({'where':{'id':_0x107b79['params']['id']}})[_0x9c00('0x25')](handleEntityNotFound(_0x12ba8b,null))['then'](function(_0x1c67da){if(_0x1c67da){_0x41e416=_0x1c67da;_0x31c2cb['model']=_[_0x9c00('0x32')](db[_0x9c00('0x51')][_0x9c00('0x44')]);_0x31c2cb[_0x9c00('0x31')]=_['keys'](_0x107b79[_0x9c00('0x31')]);_0x31c2cb[_0x9c00('0x33')]=_[_0x9c00('0x34')](_0x31c2cb[_0x9c00('0x2f')],_0x31c2cb[_0x9c00('0x31')]);_0x38b8a6['attributes']=_[_0x9c00('0x34')](_0x31c2cb[_0x9c00('0x2f')],qs[_0x9c00('0x36')](_0x107b79[_0x9c00('0x31')]['fields']));_0x38b8a6[_0x9c00('0x35')]=_0x38b8a6[_0x9c00('0x35')][_0x9c00('0x37')]?_0x38b8a6[_0x9c00('0x35')]:_0x31c2cb[_0x9c00('0x2f')];_0x38b8a6['order']=qs['sort'](_0x107b79[_0x9c00('0x31')]['sort']);_0x38b8a6['where']=qs['filters'](_[_0x9c00('0x3b')](_0x107b79['query'],_0x31c2cb[_0x9c00('0x33')]));if(_0x107b79[_0x9c00('0x31')][_0x9c00('0x3c')]){_0x38b8a6['where']=_[_0x9c00('0x3d')](_0x38b8a6[_0x9c00('0x3a')],{'$or':_[_0x9c00('0x30')](_0x38b8a6['attributes'],function(_0x46fc45){var _0x2bc98e={};_0x2bc98e[_0x46fc45]={'$like':'%'+_0x107b79[_0x9c00('0x31')][_0x9c00('0x3c')]+'%'};return _0x2bc98e;})});}_0x38b8a6=_[_0x9c00('0x3d')]({},_0x38b8a6,_0x107b79[_0x9c00('0x3f')]);return _0x41e416[_0x9c00('0x50')](_0x38b8a6);}})['then'](function(_0x44ffcb){if(_0x44ffcb){_0xccfc81=_0x44ffcb[_0x9c00('0x37')];if(!_0x107b79['query'][_0x9c00('0x4e')](_0x9c00('0x38'))){_0x38b8a6[_0x9c00('0x1c')]=qs['limit'](_0x107b79['query'][_0x9c00('0x1c')]);_0x38b8a6['offset']=qs[_0x9c00('0x1e')](_0x107b79[_0x9c00('0x31')][_0x9c00('0x1e')]);}return _0x41e416[_0x9c00('0x50')](_0x38b8a6);}})['then'](function(_0x413641){if(_0x413641){return _0x413641?{'count':_0xccfc81,'rows':_0x413641}:null;}})['then'](respondWithResult(_0x12ba8b,null))[_0x9c00('0x42')](handleError(_0x12ba8b,null));};exports['setTags']=function(_0x257d5a,_0x2159fc,_0x3b07e3){if(_0x257d5a[_0x9c00('0x48')]['id']){delete _0x257d5a['body']['id'];}return db[_0x9c00('0x40')][_0x9c00('0x4b')]({'where':{'id':_0x257d5a['params']['id']}})[_0x9c00('0x25')](handleEntityNotFound(_0x2159fc,null))[_0x9c00('0x25')](function(_0x341f56){if(_0x341f56){return _0x341f56[_0x9c00('0x52')](_0x257d5a['body']['ids']||[]);}return null;})[_0x9c00('0x25')](respondWithResult(_0x2159fc,null))[_0x9c00('0x42')](handleError(_0x2159fc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index cc01d51..66470d2 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 _0x69d3=['../../config/logger','moment','bluebird','rimraf','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x69d3,0xda));var _0x369d=function(_0xedca61,_0x3a55d4){_0xedca61=_0xedca61-0x0;var _0x476414=_0x69d3[_0xedca61];return _0x476414;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var logger=require(_0x369d('0x2'))('api');var moment=require(_0x369d('0x3'));var BPromise=require(_0x369d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x369d('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0x369d('0x6')]=function(_0x2f2a53,_0x18c9f1){return _0x2f2a53[_0x369d('0x7')](_0x369d('0x8'),attributes,{'tableName':_0x369d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea28=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4d8117,_0xfce801){var _0x39c3a3=function(_0x28ec19){while(--_0x28ec19){_0x4d8117['push'](_0x4d8117['shift']());}};_0x39c3a3(++_0xfce801);}(_0xea28,0x13a));var _0x8ea2=function(_0x130d3d,_0x5dfe7f){_0x130d3d=_0x130d3d-0x0;var _0x548f57=_0xea28[_0x130d3d];return _0x548f57;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'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 07714f9..41b4bdb 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 _0xf204=['request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x2e963b,_0x5e869d){var _0x1fda97=function(_0x1900ce){while(--_0x1900ce){_0x2e963b['push'](_0x2e963b['shift']());}};_0x1fda97(++_0x5e869d);}(_0xf204,0x111));var _0x4f20=function(_0x12d8c7,_0xe7f3df){_0x12d8c7=_0x12d8c7-0x0;var _0x17e75c=_0xf204[_0x12d8c7];return _0x17e75c;};'use strict';var _=require(_0x4f20('0x0'));var util=require(_0x4f20('0x1'));var moment=require(_0x4f20('0x2'));var BPromise=require(_0x4f20('0x3'));var rs=require(_0x4f20('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f20('0x5'))['db'];var utils=require(_0x4f20('0x6'));var logger=require('../../config/logger')(_0x4f20('0x7'));var config=require(_0x4f20('0x8'));var jayson=require(_0x4f20('0x9'));var client=jayson['client'][_0x4f20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b410a,_0x989ff8,_0x2dd79b){return new BPromise(function(_0x2516a1,_0x15bc83){return client[_0x4f20('0xb')](_0x1b410a,_0x2dd79b)['then'](function(_0x8d97d5){logger[_0x4f20('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x989ff8,_0x4f20('0xd'));logger[_0x4f20('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x989ff8,_0x4f20('0xd'),JSON[_0x4f20('0xf')](_0x8d97d5));if(_0x8d97d5[_0x4f20('0x10')]){if(_0x8d97d5[_0x4f20('0x10')][_0x4f20('0x11')]===0x1f4){logger[_0x4f20('0x10')](_0x4f20('0x12'),_0x989ff8,_0x8d97d5['error'][_0x4f20('0x13')]);return _0x15bc83(_0x8d97d5[_0x4f20('0x10')][_0x4f20('0x13')]);}logger[_0x4f20('0x10')](_0x4f20('0x12'),_0x989ff8,_0x8d97d5[_0x4f20('0x10')][_0x4f20('0x13')]);return _0x2516a1(_0x8d97d5[_0x4f20('0x10')][_0x4f20('0x13')]);}else{logger['info'](_0x4f20('0x12'),_0x989ff8,_0x4f20('0xd'));_0x2516a1(_0x8d97d5[_0x4f20('0x14')][_0x4f20('0x13')]);}})[_0x4f20('0x15')](function(_0x3b92f1){logger[_0x4f20('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x989ff8,_0x3b92f1);_0x15bc83(_0x3b92f1);});});} \ No newline at end of file +var _0xaae3=['../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x10d9b3,_0x312fe9){var _0x779b20=function(_0x5e3e24){while(--_0x5e3e24){_0x10d9b3['push'](_0x10d9b3['shift']());}};_0x779b20(++_0x312fe9);}(_0xaae3,0xa2));var _0x3aae=function(_0x3064e7,_0x34edba){_0x3064e7=_0x3064e7-0x0;var _0x26038e=_0xaae3[_0x3064e7];return _0x26038e;};'use strict';var _=require('lodash');var util=require(_0x3aae('0x0'));var moment=require(_0x3aae('0x1'));var BPromise=require(_0x3aae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3aae('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3aae('0x4'))(_0x3aae('0x5'));var config=require(_0x3aae('0x6'));var jayson=require(_0x3aae('0x7'));var client=jayson[_0x3aae('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54ef1f,_0x1b2ce0,_0x3f987d){return new BPromise(function(_0x25e2e6,_0x3797d8){return client[_0x3aae('0x9')](_0x54ef1f,_0x3f987d)[_0x3aae('0xa')](function(_0x20b38c){logger[_0x3aae('0xb')](_0x3aae('0xc'),_0x1b2ce0,_0x3aae('0xd'));logger[_0x3aae('0xe')](_0x3aae('0xf'),_0x1b2ce0,_0x3aae('0xd'),JSON[_0x3aae('0x10')](_0x20b38c));if(_0x20b38c[_0x3aae('0x11')]){if(_0x20b38c[_0x3aae('0x11')][_0x3aae('0x12')]===0x1f4){logger[_0x3aae('0x11')](_0x3aae('0xc'),_0x1b2ce0,_0x20b38c['error']['message']);return _0x3797d8(_0x20b38c[_0x3aae('0x11')]['message']);}logger[_0x3aae('0x11')](_0x3aae('0xc'),_0x1b2ce0,_0x20b38c[_0x3aae('0x11')][_0x3aae('0x13')]);return _0x25e2e6(_0x20b38c[_0x3aae('0x11')]['message']);}else{logger[_0x3aae('0xb')](_0x3aae('0xc'),_0x1b2ce0,_0x3aae('0xd'));_0x25e2e6(_0x20b38c[_0x3aae('0x14')][_0x3aae('0x13')]);}})['catch'](function(_0x3ba526){logger[_0x3aae('0x11')](_0x3aae('0xc'),_0x1b2ce0,_0x3ba526);_0x3797d8(_0x3ba526);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 4c18543..ce24ea7 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 _0x4cc9=['isAuthenticated','index','/:id','show','create','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x3875f1,_0x3816aa){var _0xaeebc=function(_0xb6dc84){while(--_0xb6dc84){_0x3875f1['push'](_0x3875f1['shift']());}};_0xaeebc(++_0x3816aa);}(_0x4cc9,0x117));var _0x94cc=function(_0x10ed63,_0x4b3915){_0x10ed63=_0x10ed63-0x0;var _0x4bf33c=_0x4cc9[_0x10ed63];return _0x4bf33c;};'use strict';var multer=require(_0x94cc('0x0'));var util=require(_0x94cc('0x1'));var path=require('path');var timeout=require(_0x94cc('0x2'));var express=require(_0x94cc('0x3'));var router=express[_0x94cc('0x4')]();var fs_extra=require(_0x94cc('0x5'));var auth=require(_0x94cc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x94cc('0x7'));var controller=require(_0x94cc('0x8'));router[_0x94cc('0x9')]('/',auth[_0x94cc('0xa')](),controller[_0x94cc('0xb')]);router[_0x94cc('0x9')](_0x94cc('0xc'),auth[_0x94cc('0xa')](),controller[_0x94cc('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x94cc('0xe')]);router['put'](_0x94cc('0xc'),auth[_0x94cc('0xa')](),controller[_0x94cc('0xf')]);router['delete'](_0x94cc('0xc'),auth[_0x94cc('0xa')](),controller['destroy']);module[_0x94cc('0x10')]=router; \ No newline at end of file +var _0xb693=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','index','get'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xb693,0x1c1));var _0x3b69=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0xb693[_0x40aaa4];return _0x4e21e5;};'use strict';var multer=require(_0x3b69('0x0'));var util=require(_0x3b69('0x1'));var path=require(_0x3b69('0x2'));var timeout=require(_0x3b69('0x3'));var express=require(_0x3b69('0x4'));var router=express[_0x3b69('0x5')]();var fs_extra=require(_0x3b69('0x6'));var auth=require(_0x3b69('0x7'));var interaction=require(_0x3b69('0x8'));var config=require('../../config/environment');var controller=require(_0x3b69('0x9'));router['get']('/',auth[_0x3b69('0xa')](),controller[_0x3b69('0xb')]);router[_0x3b69('0xc')](_0x3b69('0xd'),auth[_0x3b69('0xa')](),controller[_0x3b69('0xe')]);router[_0x3b69('0xf')]('/',auth[_0x3b69('0xa')](),controller[_0x3b69('0x10')]);router['put'](_0x3b69('0xd'),auth[_0x3b69('0xa')](),controller[_0x3b69('0x11')]);router[_0x3b69('0x12')](_0x3b69('0xd'),auth[_0x3b69('0xa')](),controller[_0x3b69('0x13')]);module[_0x3b69('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 5881f15..afd6dd2 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 _0x28e4=['ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN','exports'];(function(_0x1b6ab2,_0x3b6a17){var _0x591ed3=function(_0x156cb3){while(--_0x156cb3){_0x1b6ab2['push'](_0x1b6ab2['shift']());}};_0x591ed3(++_0x3b6a17);}(_0x28e4,0xf7));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x428e('0x0')]={'type':{'type':Sequelize[_0x428e('0x1')]('string',_0x428e('0x2'),_0x428e('0x3'),'keyValue',_0x428e('0x4')),'defaultValue':_0x428e('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x428e('0x6')]},'keyType':{'type':Sequelize[_0x428e('0x1')](_0x428e('0x5'),_0x428e('0x2'),_0x428e('0x3'))},'keyContent':{'type':Sequelize[_0x428e('0x6')]},'idField':{'type':Sequelize[_0x428e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x428e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x428e('0x6')]}}; \ No newline at end of file +var _0xfeb2=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x16a197,_0x17a01a){var _0x3233e1=function(_0x5b1f1d){while(--_0x5b1f1d){_0x16a197['push'](_0x16a197['shift']());}};_0x3233e1(++_0x17a01a);}(_0xfeb2,0x110));var _0x2feb=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0xfeb2[_0x30faee];return _0x3a90ab;};'use strict';var Sequelize=require(_0x2feb('0x0'));module[_0x2feb('0x1')]={'type':{'type':Sequelize[_0x2feb('0x2')](_0x2feb('0x3'),_0x2feb('0x4'),_0x2feb('0x5'),_0x2feb('0x6'),'picklist'),'defaultValue':_0x2feb('0x3')},'content':{'type':Sequelize[_0x2feb('0x7')]},'key':{'type':Sequelize[_0x2feb('0x7')]},'keyType':{'type':Sequelize[_0x2feb('0x2')]('string',_0x2feb('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x2feb('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2feb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 4fa4239..6adaa9c 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 _0x49f2=['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','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','limit','order','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash'];(function(_0x1d7213,_0x333fdc){var _0x39331b=function(_0x271190){while(--_0x271190){_0x1d7213['push'](_0x1d7213['shift']());}};_0x39331b(++_0x333fdc);}(_0x49f2,0x86));var _0x249f=function(_0x538a9d,_0x36ca1e){_0x538a9d=_0x538a9d-0x0;var _0x5c6cac=_0x49f2[_0x538a9d];return _0x5c6cac;};'use strict';var emlformat=require(_0x249f('0x0'));var rimraf=require(_0x249f('0x1'));var zipdir=require(_0x249f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x249f('0x3'));var moment=require(_0x249f('0x4'));var BPromise=require(_0x249f('0x5'));var Mustache=require('mustache');var util=require(_0x249f('0x6'));var path=require(_0x249f('0x7'));var sox=require(_0x249f('0x8'));var csv=require('to-csv');var ejs=require(_0x249f('0x9'));var fs=require('fs');var fs_extra=require(_0x249f('0xa'));var _=require(_0x249f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x249f('0xc'));var deskjs=require(_0x249f('0xd'));var toCsv=require(_0x249f('0xe'));var querystring=require(_0x249f('0xf'));var Papa=require('papaparse');var Redis=require(_0x249f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x249f('0x11'));var as=require(_0x249f('0x12'));var hardwareService=require(_0x249f('0x13'));var logger=require(_0x249f('0x14'))(_0x249f('0x15'));var utils=require(_0x249f('0x16'));var config=require(_0x249f('0x17'));var licenseUtil=require(_0x249f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x347937,_0x4df68b){_0x4df68b=_0x4df68b||0xcc;return function(_0x50d9d3){if(_0x50d9d3){return _0x347937[_0x249f('0x19')](_0x4df68b);}return _0x347937[_0x249f('0x1a')](_0x4df68b)[_0x249f('0x1b')]();};}function respondWithResult(_0x1a9316,_0x21ead8){_0x21ead8=_0x21ead8||0xc8;return function(_0xc2b518){if(_0xc2b518){return _0x1a9316[_0x249f('0x1a')](_0x21ead8)[_0x249f('0x1c')](_0xc2b518);}};}function respondWithFilteredResult(_0x29a5bf,_0x12c781){return function(_0x3031f2){if(_0x3031f2){var _0x2c9cdd=typeof _0x12c781[_0x249f('0x1d')]===_0x249f('0x1e')&&typeof _0x12c781['limit']===_0x249f('0x1e');var _0x16edb5=_0x3031f2[_0x249f('0x1f')];var _0x392ed3=_0x2c9cdd?0x0:_0x12c781['offset'];var _0x3820c5=_0x2c9cdd?_0x3031f2['count']:_0x12c781[_0x249f('0x1d')]+_0x12c781['limit'];var _0x1c3bd8;if(_0x3820c5>=_0x16edb5){_0x3820c5=_0x16edb5;_0x1c3bd8=0xc8;}else{_0x1c3bd8=0xce;}_0x29a5bf['status'](_0x1c3bd8);return _0x29a5bf[_0x249f('0x20')]('Content-Range',_0x392ed3+'-'+_0x3820c5+'/'+_0x16edb5)[_0x249f('0x1c')](_0x3031f2);}return null;};}function patchUpdates(_0x129f64){return function(_0x249e2d){try{jsonpatch[_0x249f('0x21')](_0x249e2d,_0x129f64,!![]);}catch(_0x2ea1ff){return BPromise[_0x249f('0x22')](_0x2ea1ff);}return _0x249e2d[_0x249f('0x23')]();};}function saveUpdates(_0x37fc36,_0x4dad53){return function(_0xe46095){if(_0xe46095){return _0xe46095[_0x249f('0x24')](_0x37fc36)[_0x249f('0x25')](function(_0x452188){return _0x452188;});}return null;};}function removeEntity(_0x4f0ff0,_0x5ebdd1){return function(_0x26deda){if(_0x26deda){return _0x26deda['destroy']()[_0x249f('0x25')](function(){_0x4f0ff0[_0x249f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f1ca3,_0x3a3fd6){return function(_0x33a539){if(!_0x33a539){_0x1f1ca3['sendStatus'](0x194);}return _0x33a539;};}function handleError(_0x45db7f,_0x3f4971){_0x3f4971=_0x3f4971||0x1f4;return function(_0x4f2d8a){logger[_0x249f('0x26')](_0x4f2d8a[_0x249f('0x27')]);if(_0x4f2d8a[_0x249f('0x28')]){delete _0x4f2d8a[_0x249f('0x28')];}_0x45db7f[_0x249f('0x1a')](_0x3f4971)[_0x249f('0x29')](_0x4f2d8a);};}exports[_0x249f('0x2a')]=function(_0x276017,_0x44d41a){var _0x36b383={},_0xfa7e9f={},_0x3ac548={'count':0x0,'rows':[]};var _0x35cf90=_[_0x249f('0x2b')](db[_0x249f('0x2c')][_0x249f('0x2d')],function(_0x24c21e){return{'name':_0x24c21e['fieldName'],'type':_0x24c21e[_0x249f('0x2e')][_0x249f('0x2f')]};});_0xfa7e9f[_0x249f('0x30')]=_['map'](_0x35cf90,'name');_0xfa7e9f['query']=_[_0x249f('0x31')](_0x276017[_0x249f('0x32')]);_0xfa7e9f[_0x249f('0x33')]=_['intersection'](_0xfa7e9f[_0x249f('0x30')],_0xfa7e9f[_0x249f('0x32')]);_0x36b383[_0x249f('0x34')]=_['intersection'](_0xfa7e9f[_0x249f('0x30')],qs[_0x249f('0x35')](_0x276017[_0x249f('0x32')]['fields']));_0x36b383[_0x249f('0x34')]=_0x36b383['attributes'][_0x249f('0x36')]?_0x36b383[_0x249f('0x34')]:_0xfa7e9f['model'];if(!_0x276017[_0x249f('0x32')][_0x249f('0x37')]('nolimit')){_0x36b383[_0x249f('0x38')]=qs[_0x249f('0x38')](_0x276017['query'][_0x249f('0x38')]);_0x36b383[_0x249f('0x1d')]=qs[_0x249f('0x1d')](_0x276017[_0x249f('0x32')][_0x249f('0x1d')]);}_0x36b383[_0x249f('0x39')]=qs['sort'](_0x276017[_0x249f('0x32')]['sort']);_0x36b383[_0x249f('0x3a')]=qs[_0x249f('0x33')](_[_0x249f('0x3b')](_0x276017[_0x249f('0x32')],_0xfa7e9f[_0x249f('0x33')]),_0x35cf90);if(_0x276017[_0x249f('0x32')]['filter']){_0x36b383[_0x249f('0x3a')]=_[_0x249f('0x3c')](_0x36b383[_0x249f('0x3a')],{'$or':_['map'](_0x35cf90,function(_0x3a44c5){if(_0x3a44c5[_0x249f('0x2e')]!==_0x249f('0x3d')){var _0x69bb52={};_0x69bb52[_0x3a44c5[_0x249f('0x28')]]={'$like':'%'+_0x276017['query']['filter']+'%'};return _0x69bb52;}})});}_0x36b383=_[_0x249f('0x3c')]({},_0x36b383,_0x276017[_0x249f('0x3e')]);var _0x136ead={'where':_0x36b383[_0x249f('0x3a')]};return db[_0x249f('0x2c')][_0x249f('0x1f')](_0x136ead)[_0x249f('0x25')](function(_0x4cf60a){_0x3ac548[_0x249f('0x1f')]=_0x4cf60a;if(_0x276017[_0x249f('0x32')][_0x249f('0x3f')]){_0x36b383[_0x249f('0x40')]=[{'all':!![]}];}return db[_0x249f('0x2c')]['findAll'](_0x36b383);})[_0x249f('0x25')](function(_0x3d4872){_0x3ac548[_0x249f('0x41')]=_0x3d4872;return _0x3ac548;})[_0x249f('0x25')](respondWithFilteredResult(_0x44d41a,_0x36b383))[_0x249f('0x42')](handleError(_0x44d41a,null));};exports['show']=function(_0x24da5e,_0x2b6792){var _0x1f6de7={'raw':!![],'where':{'id':_0x24da5e[_0x249f('0x43')]['id']}},_0x44152a={};_0x44152a[_0x249f('0x30')]=_[_0x249f('0x31')](db['ZendeskField']['rawAttributes']);_0x44152a['query']=_['keys'](_0x24da5e[_0x249f('0x32')]);_0x44152a[_0x249f('0x33')]=_[_0x249f('0x44')](_0x44152a['model'],_0x44152a[_0x249f('0x32')]);_0x1f6de7[_0x249f('0x34')]=_[_0x249f('0x44')](_0x44152a[_0x249f('0x30')],qs['fields'](_0x24da5e[_0x249f('0x32')][_0x249f('0x35')]));_0x1f6de7[_0x249f('0x34')]=_0x1f6de7['attributes'][_0x249f('0x36')]?_0x1f6de7['attributes']:_0x44152a['model'];if(_0x24da5e[_0x249f('0x32')]['includeAll']){_0x1f6de7['include']=[{'all':!![]}];}_0x1f6de7=_['merge']({},_0x1f6de7,_0x24da5e[_0x249f('0x3e')]);return db[_0x249f('0x2c')][_0x249f('0x45')](_0x1f6de7)['then'](handleEntityNotFound(_0x2b6792,null))[_0x249f('0x25')](respondWithResult(_0x2b6792,null))['catch'](handleError(_0x2b6792,null));};exports[_0x249f('0x46')]=function(_0x5e324c,_0x26345a){return db['ZendeskField'][_0x249f('0x46')](_0x5e324c[_0x249f('0x47')],{})[_0x249f('0x25')](respondWithResult(_0x26345a,0xc9))[_0x249f('0x42')](handleError(_0x26345a,null));};exports[_0x249f('0x24')]=function(_0x2120ad,_0x19bf54){if(_0x2120ad[_0x249f('0x47')]['id']){delete _0x2120ad[_0x249f('0x47')]['id'];}return db[_0x249f('0x2c')][_0x249f('0x45')]({'where':{'id':_0x2120ad['params']['id']}})[_0x249f('0x25')](handleEntityNotFound(_0x19bf54,null))[_0x249f('0x25')](saveUpdates(_0x2120ad[_0x249f('0x47')],null))['then'](respondWithResult(_0x19bf54,null))[_0x249f('0x42')](handleError(_0x19bf54,null));};exports[_0x249f('0x48')]=function(_0x4d8714,_0x880a40){return db[_0x249f('0x2c')]['find']({'where':{'id':_0x4d8714[_0x249f('0x43')]['id']}})['then'](handleEntityNotFound(_0x880a40,null))[_0x249f('0x25')](removeEntity(_0x880a40,null))[_0x249f('0x42')](handleError(_0x880a40,null));}; \ No newline at end of file +var _0x3889=['merge','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter'];(function(_0x30374d,_0x5782f2){var _0xc899b9=function(_0x325040){while(--_0x325040){_0x30374d['push'](_0x30374d['shift']());}};_0xc899b9(++_0x5782f2);}(_0x3889,0x1c2));var _0x9388=function(_0x505ce4,_0x4c7f7f){_0x505ce4=_0x505ce4-0x0;var _0x5e33ef=_0x3889[_0x505ce4];return _0x5e33ef;};'use strict';var emlformat=require(_0x9388('0x0'));var rimraf=require(_0x9388('0x1'));var zipdir=require(_0x9388('0x2'));var jsonpatch=require(_0x9388('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9388('0x4'));var Mustache=require(_0x9388('0x5'));var util=require(_0x9388('0x6'));var path=require(_0x9388('0x7'));var sox=require('sox');var csv=require(_0x9388('0x8'));var ejs=require(_0x9388('0x9'));var fs=require('fs');var fs_extra=require(_0x9388('0xa'));var _=require(_0x9388('0xb'));var squel=require(_0x9388('0xc'));var crypto=require(_0x9388('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9388('0xe'));var toCsv=require(_0x9388('0x8'));var querystring=require(_0x9388('0xf'));var Papa=require(_0x9388('0x10'));var Redis=require('ioredis');var authService=require(_0x9388('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9388('0x12'));var utils=require(_0x9388('0x13'));var config=require(_0x9388('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9388('0x15'))['db'];function respondWithStatusCode(_0x5cffcb,_0x38359d){_0x38359d=_0x38359d||0xcc;return function(_0x56e0c3){if(_0x56e0c3){return _0x5cffcb[_0x9388('0x16')](_0x38359d);}return _0x5cffcb[_0x9388('0x17')](_0x38359d)[_0x9388('0x18')]();};}function respondWithResult(_0x38b1ed,_0x266929){_0x266929=_0x266929||0xc8;return function(_0x3f156e){if(_0x3f156e){return _0x38b1ed[_0x9388('0x17')](_0x266929)[_0x9388('0x19')](_0x3f156e);}};}function respondWithFilteredResult(_0x5472b7,_0x28710b){return function(_0x300c5a){if(_0x300c5a){var _0x320f5c=typeof _0x28710b[_0x9388('0x1a')]===_0x9388('0x1b')&&typeof _0x28710b['limit']===_0x9388('0x1b');var _0x9b4c18=_0x300c5a[_0x9388('0x1c')];var _0x1db29b=_0x320f5c?0x0:_0x28710b['offset'];var _0x253afb=_0x320f5c?_0x300c5a[_0x9388('0x1c')]:_0x28710b[_0x9388('0x1a')]+_0x28710b[_0x9388('0x1d')];var _0x3f28e3;if(_0x253afb>=_0x9b4c18){_0x253afb=_0x9b4c18;_0x3f28e3=0xc8;}else{_0x3f28e3=0xce;}_0x5472b7['status'](_0x3f28e3);return _0x5472b7[_0x9388('0x1e')](_0x9388('0x1f'),_0x1db29b+'-'+_0x253afb+'/'+_0x9b4c18)[_0x9388('0x19')](_0x300c5a);}return null;};}function patchUpdates(_0x3193fe){return function(_0x4170c8){try{jsonpatch[_0x9388('0x20')](_0x4170c8,_0x3193fe,!![]);}catch(_0x2aa2e4){return BPromise['reject'](_0x2aa2e4);}return _0x4170c8[_0x9388('0x21')]();};}function saveUpdates(_0x4815fc,_0x2929a5){return function(_0x4a158b){if(_0x4a158b){return _0x4a158b[_0x9388('0x22')](_0x4815fc)[_0x9388('0x23')](function(_0x3ac4e0){return _0x3ac4e0;});}return null;};}function removeEntity(_0x46e8fa,_0x10eeb9){return function(_0x395132){if(_0x395132){return _0x395132[_0x9388('0x24')]()['then'](function(){_0x46e8fa[_0x9388('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36ebd8,_0x3f3f44){return function(_0x4ec68b){if(!_0x4ec68b){_0x36ebd8[_0x9388('0x16')](0x194);}return _0x4ec68b;};}function handleError(_0x374587,_0x4edebb){_0x4edebb=_0x4edebb||0x1f4;return function(_0x2ff963){logger['error'](_0x2ff963[_0x9388('0x25')]);if(_0x2ff963[_0x9388('0x26')]){delete _0x2ff963[_0x9388('0x26')];}_0x374587['status'](_0x4edebb)[_0x9388('0x27')](_0x2ff963);};}exports[_0x9388('0x28')]=function(_0x1ed685,_0x44fd65){var _0x157087={},_0x19eaab={},_0x199bd9={'count':0x0,'rows':[]};var _0x32cb2a=_[_0x9388('0x29')](db[_0x9388('0x2a')][_0x9388('0x2b')],function(_0x1123fb){return{'name':_0x1123fb[_0x9388('0x2c')],'type':_0x1123fb[_0x9388('0x2d')][_0x9388('0x2e')]};});_0x19eaab[_0x9388('0x2f')]=_['map'](_0x32cb2a,_0x9388('0x26'));_0x19eaab[_0x9388('0x30')]=_[_0x9388('0x31')](_0x1ed685['query']);_0x19eaab['filters']=_[_0x9388('0x32')](_0x19eaab[_0x9388('0x2f')],_0x19eaab[_0x9388('0x30')]);_0x157087[_0x9388('0x33')]=_['intersection'](_0x19eaab[_0x9388('0x2f')],qs['fields'](_0x1ed685[_0x9388('0x30')][_0x9388('0x34')]));_0x157087[_0x9388('0x33')]=_0x157087[_0x9388('0x33')][_0x9388('0x35')]?_0x157087['attributes']:_0x19eaab['model'];if(!_0x1ed685[_0x9388('0x30')][_0x9388('0x36')](_0x9388('0x37'))){_0x157087[_0x9388('0x1d')]=qs[_0x9388('0x1d')](_0x1ed685['query'][_0x9388('0x1d')]);_0x157087[_0x9388('0x1a')]=qs[_0x9388('0x1a')](_0x1ed685[_0x9388('0x30')][_0x9388('0x1a')]);}_0x157087[_0x9388('0x38')]=qs[_0x9388('0x39')](_0x1ed685['query']['sort']);_0x157087[_0x9388('0x3a')]=qs[_0x9388('0x3b')](_['pick'](_0x1ed685[_0x9388('0x30')],_0x19eaab[_0x9388('0x3b')]),_0x32cb2a);if(_0x1ed685[_0x9388('0x30')][_0x9388('0x3c')]){_0x157087[_0x9388('0x3a')]=_[_0x9388('0x3d')](_0x157087[_0x9388('0x3a')],{'$or':_[_0x9388('0x29')](_0x32cb2a,function(_0x2e95de){if(_0x2e95de[_0x9388('0x2d')]!==_0x9388('0x3e')){var _0x395094={};_0x395094[_0x2e95de[_0x9388('0x26')]]={'$like':'%'+_0x1ed685[_0x9388('0x30')][_0x9388('0x3c')]+'%'};return _0x395094;}})});}_0x157087=_[_0x9388('0x3d')]({},_0x157087,_0x1ed685[_0x9388('0x3f')]);var _0x3017ee={'where':_0x157087[_0x9388('0x3a')]};return db[_0x9388('0x2a')][_0x9388('0x1c')](_0x3017ee)[_0x9388('0x23')](function(_0x3d8709){_0x199bd9[_0x9388('0x1c')]=_0x3d8709;if(_0x1ed685['query'][_0x9388('0x40')]){_0x157087[_0x9388('0x41')]=[{'all':!![]}];}return db[_0x9388('0x2a')]['findAll'](_0x157087);})['then'](function(_0x2cf224){_0x199bd9[_0x9388('0x42')]=_0x2cf224;return _0x199bd9;})['then'](respondWithFilteredResult(_0x44fd65,_0x157087))['catch'](handleError(_0x44fd65,null));};exports[_0x9388('0x43')]=function(_0x5962b7,_0x5e0c7){var _0x1573cc={'raw':!![],'where':{'id':_0x5962b7['params']['id']}},_0x14ceca={};_0x14ceca[_0x9388('0x2f')]=_[_0x9388('0x31')](db[_0x9388('0x2a')][_0x9388('0x2b')]);_0x14ceca[_0x9388('0x30')]=_[_0x9388('0x31')](_0x5962b7[_0x9388('0x30')]);_0x14ceca[_0x9388('0x3b')]=_[_0x9388('0x32')](_0x14ceca[_0x9388('0x2f')],_0x14ceca[_0x9388('0x30')]);_0x1573cc[_0x9388('0x33')]=_[_0x9388('0x32')](_0x14ceca['model'],qs['fields'](_0x5962b7[_0x9388('0x30')][_0x9388('0x34')]));_0x1573cc[_0x9388('0x33')]=_0x1573cc[_0x9388('0x33')][_0x9388('0x35')]?_0x1573cc['attributes']:_0x14ceca[_0x9388('0x2f')];if(_0x5962b7[_0x9388('0x30')][_0x9388('0x40')]){_0x1573cc[_0x9388('0x41')]=[{'all':!![]}];}_0x1573cc=_['merge']({},_0x1573cc,_0x5962b7[_0x9388('0x3f')]);return db[_0x9388('0x2a')][_0x9388('0x44')](_0x1573cc)['then'](handleEntityNotFound(_0x5e0c7,null))[_0x9388('0x23')](respondWithResult(_0x5e0c7,null))[_0x9388('0x45')](handleError(_0x5e0c7,null));};exports['create']=function(_0x134d4d,_0x3b5584){return db[_0x9388('0x2a')][_0x9388('0x46')](_0x134d4d[_0x9388('0x47')],{})[_0x9388('0x23')](respondWithResult(_0x3b5584,0xc9))[_0x9388('0x45')](handleError(_0x3b5584,null));};exports[_0x9388('0x22')]=function(_0x42cf9a,_0x48be2f){if(_0x42cf9a[_0x9388('0x47')]['id']){delete _0x42cf9a[_0x9388('0x47')]['id'];}return db[_0x9388('0x2a')][_0x9388('0x44')]({'where':{'id':_0x42cf9a[_0x9388('0x48')]['id']}})['then'](handleEntityNotFound(_0x48be2f,null))[_0x9388('0x23')](saveUpdates(_0x42cf9a[_0x9388('0x47')],null))[_0x9388('0x23')](respondWithResult(_0x48be2f,null))[_0x9388('0x45')](handleError(_0x48be2f,null));};exports[_0x9388('0x24')]=function(_0x26ce89,_0x1a3fda){return db[_0x9388('0x2a')]['find']({'where':{'id':_0x26ce89[_0x9388('0x48')]['id']}})[_0x9388('0x23')](handleEntityNotFound(_0x1a3fda,null))[_0x9388('0x23')](removeEntity(_0x1a3fda,null))[_0x9388('0x45')](handleError(_0x1a3fda,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 27e2757..7d22746 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 _0x015f=['./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ba46a,_0x582fe0){var _0x5cbf4f=function(_0x22349b){while(--_0x22349b){_0x5ba46a['push'](_0x5ba46a['shift']());}};_0x5cbf4f(++_0x582fe0);}(_0x015f,0xae));var _0xf015=function(_0x1181f3,_0xf81baa){_0x1181f3=_0x1181f3-0x0;var _0x37abb6=_0x015f[_0x1181f3];return _0x37abb6;};'use strict';var _=require(_0xf015('0x0'));var util=require(_0xf015('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf015('0x2'));var BPromise=require(_0xf015('0x3'));var rp=require(_0xf015('0x4'));var fs=require('fs');var path=require(_0xf015('0x5'));var rimraf=require(_0xf015('0x6'));var config=require(_0xf015('0x7'));var attributes=require(_0xf015('0x8'));module[_0xf015('0x9')]=function(_0x24414a,_0x5bc5c5){return _0x24414a[_0xf015('0xa')](_0xf015('0xb'),attributes,{'tableName':_0xf015('0xc'),'paranoid':![],'indexes':[{'name':_0xf015('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25da=['zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x25da,0x14c));var _0xa25d=function(_0x47a3d9,_0x2b6c75){_0x47a3d9=_0x47a3d9-0x0;var _0x68d5a6=_0x25da[_0x47a3d9];return _0x68d5a6;};'use strict';var _=require(_0xa25d('0x0'));var util=require(_0xa25d('0x1'));var logger=require(_0xa25d('0x2'))(_0xa25d('0x3'));var moment=require(_0xa25d('0x4'));var BPromise=require(_0xa25d('0x5'));var rp=require(_0xa25d('0x6'));var fs=require('fs');var path=require(_0xa25d('0x7'));var rimraf=require(_0xa25d('0x8'));var config=require('../../config/environment');var attributes=require(_0xa25d('0x9'));module[_0xa25d('0xa')]=function(_0x49b86b,_0x1022ef){return _0x49b86b['define'](_0xa25d('0xb'),attributes,{'tableName':_0xa25d('0xc'),'paranoid':![],'indexes':[{'name':_0xa25d('0xd'),'fields':['idField',_0xa25d('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 5cf2caf..cfb0adb 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 _0x0ee3=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x4502a7,_0x337f60){var _0x3a42bd=function(_0x301174){while(--_0x301174){_0x4502a7['push'](_0x4502a7['shift']());}};_0x3a42bd(++_0x337f60);}(_0x0ee3,0xeb));var _0x30ee=function(_0x445ab0,_0x1a1226){_0x445ab0=_0x445ab0-0x0;var _0x36b9d6=_0x0ee3[_0x445ab0];return _0x36b9d6;};'use strict';var _=require(_0x30ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x30ee('0x1'));var rs=require(_0x30ee('0x2'));var fs=require('fs');var Redis=require(_0x30ee('0x3'));var db=require(_0x30ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30ee('0x5'))('rpc');var config=require(_0x30ee('0x6'));var jayson=require(_0x30ee('0x7'));var client=jayson[_0x30ee('0x8')][_0x30ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ff60d,_0x207320,_0x4ccdee){return new BPromise(function(_0x4ac792,_0x4e5349){return client[_0x30ee('0xa')](_0x2ff60d,_0x4ccdee)[_0x30ee('0xb')](function(_0x837c4e){logger[_0x30ee('0xc')]('ZendeskField,\x20%s,\x20%s',_0x207320,_0x30ee('0xd'));logger[_0x30ee('0xe')](_0x30ee('0xf'),_0x207320,_0x30ee('0xd'),JSON[_0x30ee('0x10')](_0x837c4e));if(_0x837c4e['error']){if(_0x837c4e[_0x30ee('0x11')][_0x30ee('0x12')]===0x1f4){logger['error'](_0x30ee('0x13'),_0x207320,_0x837c4e[_0x30ee('0x11')][_0x30ee('0x14')]);return _0x4e5349(_0x837c4e[_0x30ee('0x11')]['message']);}logger[_0x30ee('0x11')]('ZendeskField,\x20%s,\x20%s',_0x207320,_0x837c4e[_0x30ee('0x11')][_0x30ee('0x14')]);return _0x4ac792(_0x837c4e['error'][_0x30ee('0x14')]);}else{logger[_0x30ee('0xc')](_0x30ee('0x13'),_0x207320,_0x30ee('0xd'));_0x4ac792(_0x837c4e['result']['message']);}})[_0x30ee('0x15')](function(_0x169179){logger[_0x30ee('0x11')](_0x30ee('0x13'),_0x207320,_0x169179);_0x4e5349(_0x169179);});});} \ No newline at end of file +var _0xc636=['info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xc636,0x11a));var _0x6c63=function(_0x3955ec,_0x3337ea){_0x3955ec=_0x3955ec-0x0;var _0x36dc80=_0xc636[_0x3955ec];return _0x36dc80;};'use strict';var _=require(_0x6c63('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6c63('0x1'));var rs=require(_0x6c63('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c63('0x4'))(_0x6c63('0x5'));var config=require(_0x6c63('0x6'));var jayson=require(_0x6c63('0x7'));var client=jayson[_0x6c63('0x8')][_0x6c63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48fc11,_0x1275e2,_0x2d7034){return new BPromise(function(_0x3aa5c4,_0x522b96){return client[_0x6c63('0xa')](_0x48fc11,_0x2d7034)[_0x6c63('0xb')](function(_0x23806c){logger[_0x6c63('0xc')](_0x6c63('0xd'),_0x1275e2,'request\x20sent');logger[_0x6c63('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x1275e2,_0x6c63('0xf'),JSON['stringify'](_0x23806c));if(_0x23806c[_0x6c63('0x10')]){if(_0x23806c['error'][_0x6c63('0x11')]===0x1f4){logger[_0x6c63('0x10')]('ZendeskField,\x20%s,\x20%s',_0x1275e2,_0x23806c['error']['message']);return _0x522b96(_0x23806c[_0x6c63('0x10')][_0x6c63('0x12')]);}logger[_0x6c63('0x10')]('ZendeskField,\x20%s,\x20%s',_0x1275e2,_0x23806c[_0x6c63('0x10')]['message']);return _0x3aa5c4(_0x23806c[_0x6c63('0x10')][_0x6c63('0x12')]);}else{logger[_0x6c63('0xc')](_0x6c63('0xd'),_0x1275e2,_0x6c63('0xf'));_0x3aa5c4(_0x23806c[_0x6c63('0x13')]['message']);}})[_0x6c63('0x14')](function(_0x4b7688){logger[_0x6c63('0x10')](_0x6c63('0xd'),_0x1275e2,_0x4b7688);_0x522b96(_0x4b7688);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 3b0384a..099c69f 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 _0x8cf2=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getFields','create','post','put','/:id','update','destroy','exports'];(function(_0x3e20e9,_0x625fc){var _0x3b6c7f=function(_0x4ceb60){while(--_0x4ceb60){_0x3e20e9['push'](_0x3e20e9['shift']());}};_0x3b6c7f(++_0x625fc);}(_0x8cf2,0x108));var _0x28cf=function(_0xbeba91,_0x1e4f49){_0xbeba91=_0xbeba91-0x0;var _0x5daa36=_0x8cf2[_0xbeba91];return _0x5daa36;};'use strict';var multer=require('multer');var util=require(_0x28cf('0x0'));var path=require(_0x28cf('0x1'));var timeout=require(_0x28cf('0x2'));var express=require(_0x28cf('0x3'));var router=express['Router']();var fs_extra=require(_0x28cf('0x4'));var auth=require(_0x28cf('0x5'));var interaction=require(_0x28cf('0x6'));var config=require(_0x28cf('0x7'));var controller=require(_0x28cf('0x8'));router[_0x28cf('0x9')]('/',auth[_0x28cf('0xa')](),controller[_0x28cf('0xb')]);router[_0x28cf('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x28cf('0xc')]);router[_0x28cf('0x9')](_0x28cf('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x28cf('0xa')](),controller[_0x28cf('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x28cf('0xf')]);router[_0x28cf('0x10')]('/:id/configurations',auth[_0x28cf('0xa')](),controller['addConfiguration']);router[_0x28cf('0x11')](_0x28cf('0x12'),auth[_0x28cf('0xa')](),controller[_0x28cf('0x13')]);router['delete'](_0x28cf('0x12'),auth[_0x28cf('0xa')](),controller[_0x28cf('0x14')]);module[_0x28cf('0x15')]=router; \ No newline at end of file +var _0x6a92=['put','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x6a92,0x13f));var _0x26a9=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x6a92[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0x26a9('0x0'));var util=require(_0x26a9('0x1'));var path=require(_0x26a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x26a9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x26a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x26a9('0x5'));var controller=require(_0x26a9('0x6'));router['get']('/',auth[_0x26a9('0x7')](),controller[_0x26a9('0x8')]);router[_0x26a9('0x9')]('/:id',auth[_0x26a9('0x7')](),controller[_0x26a9('0xa')]);router[_0x26a9('0x9')](_0x26a9('0xb'),auth[_0x26a9('0x7')](),controller[_0x26a9('0xc')]);router['get']('/:id/fields',auth[_0x26a9('0x7')](),controller[_0x26a9('0xd')]);router[_0x26a9('0xe')]('/',auth['isAuthenticated'](),controller[_0x26a9('0xf')]);router[_0x26a9('0xe')](_0x26a9('0xb'),auth[_0x26a9('0x7')](),controller[_0x26a9('0x10')]);router[_0x26a9('0x11')](_0x26a9('0x12'),auth[_0x26a9('0x7')](),controller['update']);router['delete'](_0x26a9('0x12'),auth[_0x26a9('0x7')](),controller[_0x26a9('0x13')]);module[_0x26a9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index db46a45..babdcff 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 _0xd64b=['STRING','sequelize'];(function(_0x22da83,_0x355834){var _0x42d80d=function(_0x20a5ea){while(--_0x20a5ea){_0x22da83['push'](_0x22da83['shift']());}};_0x42d80d(++_0x355834);}(_0xd64b,0xc1));var _0xbd64=function(_0x59de5a,_0x1c31ab){_0x59de5a=_0x59de5a-0x0;var _0x1e86eb=_0xd64b[_0x59de5a];return _0x1e86eb;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd64('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd64('0x1')]},'zone':{'type':Sequelize[_0xbd64('0x1')]},'clientId':{'type':Sequelize[_0xbd64('0x1')]},'clientSecret':{'type':Sequelize[_0xbd64('0x1')]},'serverUrl':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x00bb=['STRING','sequelize','exports'];(function(_0x5f1364,_0x5b2752){var _0x2424c8=function(_0x393bc5){while(--_0x393bc5){_0x5f1364['push'](_0x5f1364['shift']());}};_0x2424c8(++_0x5b2752);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x00bb[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 905e940..29bf0ab 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 _0x4580=['query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','ZohoAccount','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','getConfigurations','findOne','pick','filter','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoConfiguration','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','serverUrl','code','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','remove','includes','system_mandatory','custom_field','data_type','picklist','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','rawAttributes','fieldName','key'];(function(_0x1d389c,_0x1e59d7){var _0x3a4548=function(_0x414912){while(--_0x414912){_0x1d389c['push'](_0x1d389c['shift']());}};_0x3a4548(++_0x1e59d7);}(_0x4580,0x14a));var _0x0458=function(_0x5cd51d,_0x20d4fa){_0x5cd51d=_0x5cd51d-0x0;var _0x444608=_0x4580[_0x5cd51d];return _0x444608;};'use strict';var emlformat=require(_0x0458('0x0'));var rimraf=require(_0x0458('0x1'));var zipdir=require(_0x0458('0x2'));var jsonpatch=require(_0x0458('0x3'));var rp=require(_0x0458('0x4'));var moment=require('moment');var BPromise=require(_0x0458('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0458('0x6'));var ejs=require(_0x0458('0x7'));var fs=require('fs');var fs_extra=require(_0x0458('0x8'));var _=require(_0x0458('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0458('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0458('0x6'));var querystring=require(_0x0458('0xb'));var Papa=require(_0x0458('0xc'));var Redis=require(_0x0458('0xd'));var authService=require(_0x0458('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0458('0xf'));var logger=require(_0x0458('0x10'))(_0x0458('0x11'));var utils=require(_0x0458('0x12'));var config=require(_0x0458('0x13'));var licenseUtil=require(_0x0458('0x14'));var db=require(_0x0458('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1fe30e,_0x4ae6d8){_0x4ae6d8=_0x4ae6d8||0xcc;return function(_0x288de9){if(_0x288de9){return _0x1fe30e['sendStatus'](_0x4ae6d8);}return _0x1fe30e['status'](_0x4ae6d8)[_0x0458('0x16')]();};}function respondWithResult(_0x2b0ad5,_0x242696){_0x242696=_0x242696||0xc8;return function(_0xac8ab3){if(_0xac8ab3){return _0x2b0ad5[_0x0458('0x17')](_0x242696)[_0x0458('0x18')](_0xac8ab3);}};}function respondWithFilteredResult(_0xe4e985,_0x80d335){return function(_0x10d02b){if(_0x10d02b){var _0x234cd7=typeof _0x80d335['offset']===_0x0458('0x19')&&typeof _0x80d335[_0x0458('0x1a')]===_0x0458('0x19');var _0x56f73a=_0x10d02b['count'];var _0x3a53af=_0x234cd7?0x0:_0x80d335[_0x0458('0x1b')];var _0x500a97=_0x234cd7?_0x10d02b[_0x0458('0x1c')]:_0x80d335[_0x0458('0x1b')]+_0x80d335[_0x0458('0x1a')];var _0x93a0c1;if(_0x500a97>=_0x56f73a){_0x500a97=_0x56f73a;_0x93a0c1=0xc8;}else{_0x93a0c1=0xce;}_0xe4e985[_0x0458('0x17')](_0x93a0c1);return _0xe4e985['set'](_0x0458('0x1d'),_0x3a53af+'-'+_0x500a97+'/'+_0x56f73a)['json'](_0x10d02b);}return null;};}function patchUpdates(_0x22fc69){return function(_0x5889e6){try{jsonpatch[_0x0458('0x1e')](_0x5889e6,_0x22fc69,!![]);}catch(_0x58bb0f){return BPromise[_0x0458('0x1f')](_0x58bb0f);}return _0x5889e6[_0x0458('0x20')]();};}function saveUpdates(_0x35a58d,_0x5557a9){return function(_0x1dcf80){if(_0x1dcf80){return _0x1dcf80['update'](_0x35a58d)[_0x0458('0x21')](function(_0x46c40d){return _0x46c40d;});}return null;};}function removeEntity(_0x175e8e,_0x4e021f){return function(_0x3c7d64){if(_0x3c7d64){return _0x3c7d64[_0x0458('0x22')]()[_0x0458('0x21')](function(){_0x175e8e[_0x0458('0x17')](0xcc)[_0x0458('0x16')]();});}};}function handleEntityNotFound(_0x2760b,_0x33447c){return function(_0x10e79c){if(!_0x10e79c){_0x2760b['sendStatus'](0x194);}return _0x10e79c;};}function handleError(_0x5e3bcc,_0x5c851){_0x5c851=_0x5c851||0x1f4;return function(_0x29d6be){logger['error'](_0x29d6be[_0x0458('0x23')]);if(_0x29d6be['name']){delete _0x29d6be[_0x0458('0x24')];}_0x5e3bcc[_0x0458('0x17')](_0x5c851)[_0x0458('0x25')](_0x29d6be);};}exports['index']=function(_0x55edaf,_0x387929){var _0x3b1cb6={},_0x36df70={},_0x574375={'count':0x0,'rows':[]};var _0x2a9cd9=_[_0x0458('0x26')](db['ZohoAccount'][_0x0458('0x27')],function(_0x28ea5b){return{'name':_0x28ea5b[_0x0458('0x28')],'type':_0x28ea5b['type'][_0x0458('0x29')]};});_0x36df70['model']=_[_0x0458('0x26')](_0x2a9cd9,'name');_0x36df70[_0x0458('0x2a')]=_['keys'](_0x55edaf[_0x0458('0x2a')]);_0x36df70['filters']=_[_0x0458('0x2b')](_0x36df70[_0x0458('0x2c')],_0x36df70[_0x0458('0x2a')]);_0x3b1cb6[_0x0458('0x2d')]=_[_0x0458('0x2b')](_0x36df70[_0x0458('0x2c')],qs[_0x0458('0x2e')](_0x55edaf[_0x0458('0x2a')]['fields']));_0x3b1cb6['attributes']=_0x3b1cb6[_0x0458('0x2d')][_0x0458('0x2f')]?_0x3b1cb6[_0x0458('0x2d')]:_0x36df70[_0x0458('0x2c')];if(!_0x55edaf[_0x0458('0x2a')][_0x0458('0x30')](_0x0458('0x31'))){_0x3b1cb6['limit']=qs[_0x0458('0x1a')](_0x55edaf['query'][_0x0458('0x1a')]);_0x3b1cb6['offset']=qs['offset'](_0x55edaf[_0x0458('0x2a')][_0x0458('0x1b')]);}_0x3b1cb6[_0x0458('0x32')]=qs['sort'](_0x55edaf[_0x0458('0x2a')][_0x0458('0x33')]);_0x3b1cb6[_0x0458('0x34')]=qs[_0x0458('0x35')](_['pick'](_0x55edaf[_0x0458('0x2a')],_0x36df70['filters']),_0x2a9cd9);if(_0x55edaf[_0x0458('0x2a')]['filter']){_0x3b1cb6[_0x0458('0x34')]=_[_0x0458('0x36')](_0x3b1cb6[_0x0458('0x34')],{'$or':_[_0x0458('0x26')](_0x2a9cd9,function(_0x4c91b5){if(_0x4c91b5[_0x0458('0x37')]!==_0x0458('0x38')){var _0x248f33={};_0x248f33[_0x4c91b5['name']]={'$like':'%'+_0x55edaf['query']['filter']+'%'};return _0x248f33;}})});}_0x3b1cb6=_[_0x0458('0x36')]({},_0x3b1cb6,_0x55edaf['options']);var _0x2e1d49={'where':_0x3b1cb6[_0x0458('0x34')]};return db[_0x0458('0x39')][_0x0458('0x1c')](_0x2e1d49)[_0x0458('0x21')](function(_0x4901f1){_0x574375['count']=_0x4901f1;if(_0x55edaf[_0x0458('0x2a')][_0x0458('0x3a')]){_0x3b1cb6[_0x0458('0x3b')]=[{'all':!![]}];}return db[_0x0458('0x39')][_0x0458('0x3c')](_0x3b1cb6);})[_0x0458('0x21')](function(_0x2fce2b){_0x574375[_0x0458('0x3d')]=_0x2fce2b;return _0x574375;})[_0x0458('0x21')](respondWithFilteredResult(_0x387929,_0x3b1cb6))[_0x0458('0x3e')](handleError(_0x387929,null));};exports[_0x0458('0x3f')]=function(_0x4f6da7,_0x4db901){var _0x3b30ac={'raw':![],'where':{'id':_0x4f6da7['params']['id']}},_0x50c436={};_0x50c436[_0x0458('0x2c')]=_['keys'](db[_0x0458('0x39')][_0x0458('0x27')]);_0x50c436[_0x0458('0x2a')]=_[_0x0458('0x40')](_0x4f6da7['query']);_0x50c436[_0x0458('0x35')]=_[_0x0458('0x2b')](_0x50c436[_0x0458('0x2c')],_0x50c436[_0x0458('0x2a')]);_0x3b30ac[_0x0458('0x2d')]=_[_0x0458('0x2b')](_0x50c436['model'],qs[_0x0458('0x2e')](_0x4f6da7[_0x0458('0x2a')][_0x0458('0x2e')]));_0x3b30ac[_0x0458('0x2d')]=_0x3b30ac['attributes'][_0x0458('0x2f')]?_0x3b30ac[_0x0458('0x2d')]:_0x50c436[_0x0458('0x2c')];if(_0x4f6da7[_0x0458('0x2a')][_0x0458('0x3a')]){_0x3b30ac[_0x0458('0x3b')]=[{'all':!![]}];}_0x3b30ac=_[_0x0458('0x36')]({},_0x3b30ac,_0x4f6da7[_0x0458('0x41')]);return db[_0x0458('0x39')][_0x0458('0x42')](_0x3b30ac)[_0x0458('0x21')](handleEntityNotFound(_0x4db901,null))[_0x0458('0x21')](respondWithResult(_0x4db901,null))[_0x0458('0x3e')](handleError(_0x4db901,null));};exports['create']=function(_0x286263,_0x46b58f){return db['ZohoAccount'][_0x0458('0x43')](_0x286263['body'],{})[_0x0458('0x21')](respondWithResult(_0x46b58f,0xc9))[_0x0458('0x3e')](handleError(_0x46b58f,null));};exports['update']=function(_0x437efb,_0x59741b){if(_0x437efb[_0x0458('0x44')]['id']){delete _0x437efb[_0x0458('0x44')]['id'];}return db[_0x0458('0x39')][_0x0458('0x42')]({'where':{'id':_0x437efb[_0x0458('0x45')]['id']}})['then'](handleEntityNotFound(_0x59741b,null))[_0x0458('0x21')](saveUpdates(_0x437efb[_0x0458('0x44')],null))[_0x0458('0x21')](respondWithResult(_0x59741b,null))[_0x0458('0x3e')](handleError(_0x59741b,null));};exports[_0x0458('0x22')]=function(_0x48d142,_0xc00b52){return db['ZohoAccount']['find']({'where':{'id':_0x48d142[_0x0458('0x45')]['id']}})[_0x0458('0x21')](handleEntityNotFound(_0xc00b52,null))[_0x0458('0x21')](removeEntity(_0xc00b52,null))[_0x0458('0x3e')](handleError(_0xc00b52,null));};exports[_0x0458('0x46')]=function(_0x2c8ff3,_0x3d8e1f,_0x3fcd98){var _0x492867={};var _0x4e4b54={};var _0xc84c84;var _0x3b42b9;return db['ZohoAccount'][_0x0458('0x47')]({'where':{'id':_0x2c8ff3[_0x0458('0x45')]['id']}})[_0x0458('0x21')](handleEntityNotFound(_0x3d8e1f,null))[_0x0458('0x21')](function(_0x103c91){if(_0x103c91){_0xc84c84=_0x103c91;_0x4e4b54[_0x0458('0x2c')]=_[_0x0458('0x40')](db['ZohoConfiguration'][_0x0458('0x27')]);_0x4e4b54[_0x0458('0x2a')]=_[_0x0458('0x40')](_0x2c8ff3[_0x0458('0x2a')]);_0x4e4b54[_0x0458('0x35')]=_[_0x0458('0x2b')](_0x4e4b54['model'],_0x4e4b54[_0x0458('0x2a')]);_0x492867[_0x0458('0x2d')]=_['intersection'](_0x4e4b54[_0x0458('0x2c')],qs[_0x0458('0x2e')](_0x2c8ff3[_0x0458('0x2a')][_0x0458('0x2e')]));_0x492867['attributes']=_0x492867[_0x0458('0x2d')][_0x0458('0x2f')]?_0x492867[_0x0458('0x2d')]:_0x4e4b54[_0x0458('0x2c')];_0x492867[_0x0458('0x32')]=qs[_0x0458('0x33')](_0x2c8ff3[_0x0458('0x2a')][_0x0458('0x33')]);_0x492867[_0x0458('0x34')]=qs['filters'](_[_0x0458('0x48')](_0x2c8ff3[_0x0458('0x2a')],_0x4e4b54['filters']));if(_0x2c8ff3[_0x0458('0x2a')]['filter']){_0x492867[_0x0458('0x34')]=_[_0x0458('0x36')](_0x492867[_0x0458('0x34')],{'$or':_[_0x0458('0x26')](_0x492867[_0x0458('0x2d')],function(_0x19c010){var _0x14a9ca={};_0x14a9ca[_0x19c010]={'$like':'%'+_0x2c8ff3[_0x0458('0x2a')][_0x0458('0x49')]+'%'};return _0x14a9ca;})});}_0x492867=_[_0x0458('0x36')]({},_0x492867,_0x2c8ff3[_0x0458('0x41')]);return _0xc84c84[_0x0458('0x46')](_0x492867);}})['then'](function(_0x5bdf07){if(_0x5bdf07){_0x3b42b9=_0x5bdf07[_0x0458('0x2f')];if(!_0x2c8ff3[_0x0458('0x2a')]['hasOwnProperty'](_0x0458('0x31'))){_0x492867[_0x0458('0x1a')]=qs[_0x0458('0x1a')](_0x2c8ff3[_0x0458('0x2a')]['limit']);_0x492867[_0x0458('0x1b')]=qs[_0x0458('0x1b')](_0x2c8ff3[_0x0458('0x2a')]['offset']);}return _0xc84c84['getConfigurations'](_0x492867);}})[_0x0458('0x21')](function(_0x1e8f72){if(_0x1e8f72){return _0x1e8f72?{'count':_0x3b42b9,'rows':_0x1e8f72}:null;}})[_0x0458('0x21')](respondWithResult(_0x3d8e1f,null))['catch'](handleError(_0x3d8e1f,null));};exports[_0x0458('0x4a')]=function(_0x47b24b,_0x33b98e,_0x4102d2){if(_0x47b24b['body']['id']){delete _0x47b24b[_0x0458('0x44')]['id'];}return db[_0x0458('0x39')]['findOne']({'where':{'id':_0x47b24b[_0x0458('0x45')]['id']}})[_0x0458('0x21')](handleEntityNotFound(_0x33b98e,null))[_0x0458('0x21')](function(_0x2fe239){if(_0x2fe239){_0x47b24b['body'][_0x0458('0x4b')]=_0x2fe239['id'];_0x47b24b['body'][_0x0458('0x4c')]=integrations[_0x0458('0x4d')](_0x47b24b[_0x0458('0x44')]['channel'],_0x47b24b[_0x0458('0x44')][_0x0458('0x37')]);_0x47b24b[_0x0458('0x44')][_0x0458('0x4e')]=integrations['getDescriptions'](_0x47b24b[_0x0458('0x44')][_0x0458('0x4f')],_0x47b24b[_0x0458('0x44')][_0x0458('0x37')]);return db[_0x0458('0x50')][_0x0458('0x43')](_0x47b24b['body'],{'include':[{'model':db[_0x0458('0x51')],'as':_0x0458('0x4c')},{'model':db[_0x0458('0x51')],'as':_0x0458('0x4e')}]});}return null;})[_0x0458('0x21')](respondWithResult(_0x33b98e,null))[_0x0458('0x3e')](handleError(_0x33b98e,null));};function getAccessToken(_0x1d7c65){return new Promise(function(_0x478336,_0x34a9d8){var _0x1bad86;switch(_0x1d7c65['zone']){case'US':_0x1bad86='https://accounts.zoho.com';break;case'AU':_0x1bad86=_0x0458('0x52');break;case'EU':_0x1bad86='https://accounts.zoho.eu';break;case'IN':_0x1bad86='https://accounts.zoho.in';break;case'CN':_0x1bad86=_0x0458('0x53');break;default:_0x1bad86=_0x0458('0x54');break;}var _0x32a123={'method':'POST','uri':_0x1bad86+_0x0458('0x55'),'qs':{'refresh_token':_0x1d7c65[_0x0458('0x56')],'client_id':_0x1d7c65[_0x0458('0x57')],'client_secret':_0x1d7c65[_0x0458('0x58')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x32a123)[_0x0458('0x21')](function(_0x548767){if(_0x548767['access_token']){_0x478336(_0x548767[_0x0458('0x59')]);}else{_0x34a9d8(_0x0458('0x5a'));}})[_0x0458('0x3e')](function(_0x4a3684){_0x34a9d8(_0x4a3684);});});}exports[_0x0458('0x5b')]=function(_0x5ca7f1,_0x200c62,_0xb8c782){var _0x1c2adb,_0x2481c6,_0x5003e9,_0x4e9235,_0x4138b0;return db[_0x0458('0x39')][_0x0458('0x47')]({'where':{'id':_0x5ca7f1[_0x0458('0x45')]['id']},'attributes':['id','host',_0x0458('0x5c'),_0x0458('0x57'),_0x0458('0x58'),_0x0458('0x5d'),_0x0458('0x5e'),_0x0458('0x56')]})[_0x0458('0x21')](handleEntityNotFound(_0x200c62,null))[_0x0458('0x21')](function(_0x3265b2){_0x4138b0=_0x3265b2;_0x1c2adb=_0x4138b0['host'];_0x2481c6=_0x1c2adb===_0x0458('0x5f')?'eu':_0x0458('0x60');_0x5003e9=_0x4138b0[_0x0458('0x5d')];var _0x1195ff=_0x5003e9['slice'](-0x1);if(_0x1195ff==='/'||_0x1195ff==='\x5c'||_0x1195ff===':'){_0x5003e9=_0x5003e9[_0x0458('0x61')](0x0,_0x5003e9[_0x0458('0x62')](_0x1195ff));}if(!_0x4138b0[_0x0458('0x56')]){throw new Error(_0x0458('0x63'));}return getAccessToken(_0x4138b0);})[_0x0458('0x21')](function(_0x10c78c){if(_0x10c78c){return rp({'method':_0x0458('0x64'),'uri':util[_0x0458('0x65')](_0x0458('0x66'),_0x2481c6),'qs':{'module':_0x0458('0x67')},'headers':{'Authorization':_0x0458('0x68')+_0x10c78c},'json':!![]});}})[_0x0458('0x21')](function(_0x19c9c6){if(_0x19c9c6){if(_0x19c9c6[_0x0458('0x69')]&&_0x19c9c6['response'][_0x0458('0x6a')]){throw new Error(_0x19c9c6[_0x0458('0x69')][_0x0458('0x6a')][_0x0458('0x6b')]);}var _0x2d75e7=[];var _0x2855a8=[];var _0xf0c756=[_0x0458('0x6c'),_0x0458('0x6d'),_0x0458('0x6e'),_0x0458('0x6f'),'Call_Duration',_0x0458('0x70'),_0x0458('0x71'),'Call_Type'];_0x2855a8=_[_0x0458('0x72')](_0x19c9c6[_0x0458('0x2e')],function(_0x3f6ebd){return _0xf0c756[_0x0458('0x73')](_0x3f6ebd['api_name']);});for(var _0x426ab3=0x0;_0x426ab3<_0x2855a8[_0x0458('0x2f')];_0x426ab3++){if(_0x2855a8[_0x426ab3][_0x0458('0x74')]===![]){_0x2d75e7['push']({'id':_0x2855a8[_0x426ab3]['id'],'name':_0x2855a8[_0x426ab3]['display_label'],'custom':_0x2855a8[_0x426ab3][_0x0458('0x75')],'options':_0x2855a8[_0x426ab3][_0x0458('0x76')]===_0x0458('0x77')&&_0x2855a8[_0x426ab3]['pick_list_values']['length']>-0x1?_[_0x0458('0x26')](_0x2855a8[_0x426ab3]['pick_list_values'],function(_0x173d4c){return{'name':_0x173d4c,'value':_0x173d4c};}):[]});}}return{'count':_0x2d75e7[_0x0458('0x2f')],'rows':_0x2d75e7};}else{return{'count':0x0,'rows':[]};}})[_0x0458('0x21')](respondWithResult(_0x200c62,null))[_0x0458('0x3e')](function(_0x903943){var _0x48bf48=_0x5ca7f1[_0x0458('0x2a')][_0x0458('0x78')]?0x1f4:_0x903943[_0x0458('0x79')]||0x1f4;logger[_0x0458('0x6a')](_0x0458('0x7a'),_0x0458('0x5b'),_0x48bf48,JSON[_0x0458('0x7b')](_0x903943));delete _0x903943[_0x0458('0x24')];if(_0x48bf48===0x191){_0x48bf48=0x190;}_0x200c62[_0x0458('0x17')](_0x48bf48)[_0x0458('0x25')](_0x5ca7f1[_0x0458('0x2a')][_0x0458('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x903943[_0x0458('0x79')]}:_0x903943);});}; \ No newline at end of file +var _0x16de=['crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','apply','reject','update','then','destroy','end','sendStatus','stack','name','index','map','ZohoAccount','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','getConfigurations','ZohoConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','refreshToken','host','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','system_mandatory','push','data_type','pick_list_values','stringify','send','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0xc84838,_0x47e144){var _0x5d14f9=function(_0xe4a36d){while(--_0xe4a36d){_0xc84838['push'](_0xc84838['shift']());}};_0x5d14f9(++_0x47e144);}(_0x16de,0xe9));var _0xe16d=function(_0x4fec59,_0x49a6bc){_0x4fec59=_0x4fec59-0x0;var _0x2605c3=_0x16de[_0x4fec59];return _0x2605c3;};'use strict';var emlformat=require(_0xe16d('0x0'));var rimraf=require(_0xe16d('0x1'));var zipdir=require(_0xe16d('0x2'));var jsonpatch=require(_0xe16d('0x3'));var rp=require(_0xe16d('0x4'));var moment=require(_0xe16d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe16d('0x6'));var util=require(_0xe16d('0x7'));var path=require(_0xe16d('0x8'));var sox=require('sox');var csv=require(_0xe16d('0x9'));var ejs=require(_0xe16d('0xa'));var fs=require('fs');var fs_extra=require(_0xe16d('0xb'));var _=require('lodash');var squel=require(_0xe16d('0xc'));var crypto=require(_0xe16d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe16d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe16d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe16d('0xf'));var as=require(_0xe16d('0x10'));var hardwareService=require(_0xe16d('0x11'));var logger=require('../../config/logger')(_0xe16d('0x12'));var utils=require(_0xe16d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe16d('0x14'));var db=require(_0xe16d('0x15'))['db'];var integrations=require(_0xe16d('0x16'));function respondWithStatusCode(_0x34e66f,_0x5318ec){_0x5318ec=_0x5318ec||0xcc;return function(_0x4d9bcc){if(_0x4d9bcc){return _0x34e66f['sendStatus'](_0x5318ec);}return _0x34e66f[_0xe16d('0x17')](_0x5318ec)['end']();};}function respondWithResult(_0x227dc0,_0x28b44c){_0x28b44c=_0x28b44c||0xc8;return function(_0x2af270){if(_0x2af270){return _0x227dc0['status'](_0x28b44c)[_0xe16d('0x18')](_0x2af270);}};}function respondWithFilteredResult(_0x210eb2,_0x26ee56){return function(_0x5eca75){if(_0x5eca75){var _0x46cdda=typeof _0x26ee56['offset']===_0xe16d('0x19')&&typeof _0x26ee56[_0xe16d('0x1a')]===_0xe16d('0x19');var _0x49cf86=_0x5eca75['count'];var _0x179d97=_0x46cdda?0x0:_0x26ee56['offset'];var _0x16e469=_0x46cdda?_0x5eca75[_0xe16d('0x1b')]:_0x26ee56[_0xe16d('0x1c')]+_0x26ee56[_0xe16d('0x1a')];var _0x53a347;if(_0x16e469>=_0x49cf86){_0x16e469=_0x49cf86;_0x53a347=0xc8;}else{_0x53a347=0xce;}_0x210eb2['status'](_0x53a347);return _0x210eb2['set']('Content-Range',_0x179d97+'-'+_0x16e469+'/'+_0x49cf86)['json'](_0x5eca75);}return null;};}function patchUpdates(_0x16ed97){return function(_0x4d803e){try{jsonpatch[_0xe16d('0x1d')](_0x4d803e,_0x16ed97,!![]);}catch(_0x2fd00b){return BPromise[_0xe16d('0x1e')](_0x2fd00b);}return _0x4d803e['save']();};}function saveUpdates(_0x953910,_0x553bf6){return function(_0x4cff32){if(_0x4cff32){return _0x4cff32[_0xe16d('0x1f')](_0x953910)[_0xe16d('0x20')](function(_0x394c70){return _0x394c70;});}return null;};}function removeEntity(_0x4a1f4c,_0x1b9e10){return function(_0x273fb6){if(_0x273fb6){return _0x273fb6[_0xe16d('0x21')]()[_0xe16d('0x20')](function(){_0x4a1f4c[_0xe16d('0x17')](0xcc)[_0xe16d('0x22')]();});}};}function handleEntityNotFound(_0x31346e,_0x36fbaa){return function(_0xb2c7e4){if(!_0xb2c7e4){_0x31346e[_0xe16d('0x23')](0x194);}return _0xb2c7e4;};}function handleError(_0x1cd336,_0x2852fb){_0x2852fb=_0x2852fb||0x1f4;return function(_0x16c2ac){logger['error'](_0x16c2ac[_0xe16d('0x24')]);if(_0x16c2ac[_0xe16d('0x25')]){delete _0x16c2ac['name'];}_0x1cd336[_0xe16d('0x17')](_0x2852fb)['send'](_0x16c2ac);};}exports[_0xe16d('0x26')]=function(_0x42ec10,_0x1ee303){var _0xbb9b1a={},_0x1bc90c={},_0x39f3eb={'count':0x0,'rows':[]};var _0x48fcdc=_[_0xe16d('0x27')](db[_0xe16d('0x28')]['rawAttributes'],function(_0x16bf50){return{'name':_0x16bf50[_0xe16d('0x29')],'type':_0x16bf50[_0xe16d('0x2a')][_0xe16d('0x2b')]};});_0x1bc90c['model']=_['map'](_0x48fcdc,_0xe16d('0x25'));_0x1bc90c[_0xe16d('0x2c')]=_['keys'](_0x42ec10[_0xe16d('0x2c')]);_0x1bc90c['filters']=_[_0xe16d('0x2d')](_0x1bc90c[_0xe16d('0x2e')],_0x1bc90c[_0xe16d('0x2c')]);_0xbb9b1a[_0xe16d('0x2f')]=_[_0xe16d('0x2d')](_0x1bc90c['model'],qs['fields'](_0x42ec10[_0xe16d('0x2c')][_0xe16d('0x30')]));_0xbb9b1a['attributes']=_0xbb9b1a['attributes'][_0xe16d('0x31')]?_0xbb9b1a['attributes']:_0x1bc90c['model'];if(!_0x42ec10['query'][_0xe16d('0x32')]('nolimit')){_0xbb9b1a['limit']=qs[_0xe16d('0x1a')](_0x42ec10['query'][_0xe16d('0x1a')]);_0xbb9b1a[_0xe16d('0x1c')]=qs[_0xe16d('0x1c')](_0x42ec10[_0xe16d('0x2c')][_0xe16d('0x1c')]);}_0xbb9b1a[_0xe16d('0x33')]=qs['sort'](_0x42ec10[_0xe16d('0x2c')][_0xe16d('0x34')]);_0xbb9b1a[_0xe16d('0x35')]=qs['filters'](_[_0xe16d('0x36')](_0x42ec10[_0xe16d('0x2c')],_0x1bc90c[_0xe16d('0x37')]),_0x48fcdc);if(_0x42ec10[_0xe16d('0x2c')][_0xe16d('0x38')]){_0xbb9b1a['where']=_[_0xe16d('0x39')](_0xbb9b1a['where'],{'$or':_[_0xe16d('0x27')](_0x48fcdc,function(_0x1d7abc){if(_0x1d7abc[_0xe16d('0x2a')]!==_0xe16d('0x3a')){var _0x52ca10={};_0x52ca10[_0x1d7abc[_0xe16d('0x25')]]={'$like':'%'+_0x42ec10['query'][_0xe16d('0x38')]+'%'};return _0x52ca10;}})});}_0xbb9b1a=_[_0xe16d('0x39')]({},_0xbb9b1a,_0x42ec10[_0xe16d('0x3b')]);var _0x33b18b={'where':_0xbb9b1a['where']};return db['ZohoAccount'][_0xe16d('0x1b')](_0x33b18b)[_0xe16d('0x20')](function(_0x28b414){_0x39f3eb[_0xe16d('0x1b')]=_0x28b414;if(_0x42ec10[_0xe16d('0x2c')][_0xe16d('0x3c')]){_0xbb9b1a[_0xe16d('0x3d')]=[{'all':!![]}];}return db[_0xe16d('0x28')][_0xe16d('0x3e')](_0xbb9b1a);})['then'](function(_0x24e29a){_0x39f3eb[_0xe16d('0x3f')]=_0x24e29a;return _0x39f3eb;})[_0xe16d('0x20')](respondWithFilteredResult(_0x1ee303,_0xbb9b1a))[_0xe16d('0x40')](handleError(_0x1ee303,null));};exports[_0xe16d('0x41')]=function(_0x3b38c2,_0xdc4a18){var _0x442938={'raw':![],'where':{'id':_0x3b38c2[_0xe16d('0x42')]['id']}},_0x1c2b3e={};_0x1c2b3e[_0xe16d('0x2e')]=_[_0xe16d('0x43')](db[_0xe16d('0x28')][_0xe16d('0x44')]);_0x1c2b3e[_0xe16d('0x2c')]=_['keys'](_0x3b38c2['query']);_0x1c2b3e[_0xe16d('0x37')]=_['intersection'](_0x1c2b3e['model'],_0x1c2b3e['query']);_0x442938[_0xe16d('0x2f')]=_[_0xe16d('0x2d')](_0x1c2b3e[_0xe16d('0x2e')],qs[_0xe16d('0x30')](_0x3b38c2[_0xe16d('0x2c')]['fields']));_0x442938[_0xe16d('0x2f')]=_0x442938[_0xe16d('0x2f')]['length']?_0x442938['attributes']:_0x1c2b3e[_0xe16d('0x2e')];if(_0x3b38c2[_0xe16d('0x2c')][_0xe16d('0x3c')]){_0x442938[_0xe16d('0x3d')]=[{'all':!![]}];}_0x442938=_['merge']({},_0x442938,_0x3b38c2[_0xe16d('0x3b')]);return db['ZohoAccount']['find'](_0x442938)[_0xe16d('0x20')](handleEntityNotFound(_0xdc4a18,null))[_0xe16d('0x20')](respondWithResult(_0xdc4a18,null))['catch'](handleError(_0xdc4a18,null));};exports[_0xe16d('0x45')]=function(_0x1dbdd9,_0xaa4a82){return db[_0xe16d('0x28')][_0xe16d('0x45')](_0x1dbdd9['body'],{})[_0xe16d('0x20')](respondWithResult(_0xaa4a82,0xc9))['catch'](handleError(_0xaa4a82,null));};exports[_0xe16d('0x1f')]=function(_0x3337f7,_0x552386){if(_0x3337f7[_0xe16d('0x46')]['id']){delete _0x3337f7[_0xe16d('0x46')]['id'];}return db[_0xe16d('0x28')]['find']({'where':{'id':_0x3337f7[_0xe16d('0x42')]['id']}})['then'](handleEntityNotFound(_0x552386,null))[_0xe16d('0x20')](saveUpdates(_0x3337f7[_0xe16d('0x46')],null))['then'](respondWithResult(_0x552386,null))[_0xe16d('0x40')](handleError(_0x552386,null));};exports[_0xe16d('0x21')]=function(_0x855405,_0x3ba038){return db[_0xe16d('0x28')]['find']({'where':{'id':_0x855405['params']['id']}})[_0xe16d('0x20')](handleEntityNotFound(_0x3ba038,null))[_0xe16d('0x20')](removeEntity(_0x3ba038,null))[_0xe16d('0x40')](handleError(_0x3ba038,null));};exports[_0xe16d('0x47')]=function(_0x4045ff,_0x5262e1,_0x15c8ba){var _0x4fd909={};var _0x412dc3={};var _0x5e6c17;var _0x223cfc;return db[_0xe16d('0x28')]['findOne']({'where':{'id':_0x4045ff[_0xe16d('0x42')]['id']}})[_0xe16d('0x20')](handleEntityNotFound(_0x5262e1,null))[_0xe16d('0x20')](function(_0x15ccd1){if(_0x15ccd1){_0x5e6c17=_0x15ccd1;_0x412dc3[_0xe16d('0x2e')]=_[_0xe16d('0x43')](db[_0xe16d('0x48')][_0xe16d('0x44')]);_0x412dc3[_0xe16d('0x2c')]=_[_0xe16d('0x43')](_0x4045ff['query']);_0x412dc3[_0xe16d('0x37')]=_[_0xe16d('0x2d')](_0x412dc3[_0xe16d('0x2e')],_0x412dc3[_0xe16d('0x2c')]);_0x4fd909[_0xe16d('0x2f')]=_[_0xe16d('0x2d')](_0x412dc3['model'],qs['fields'](_0x4045ff[_0xe16d('0x2c')][_0xe16d('0x30')]));_0x4fd909['attributes']=_0x4fd909['attributes'][_0xe16d('0x31')]?_0x4fd909['attributes']:_0x412dc3[_0xe16d('0x2e')];_0x4fd909[_0xe16d('0x33')]=qs[_0xe16d('0x34')](_0x4045ff['query'][_0xe16d('0x34')]);_0x4fd909['where']=qs['filters'](_[_0xe16d('0x36')](_0x4045ff[_0xe16d('0x2c')],_0x412dc3['filters']));if(_0x4045ff[_0xe16d('0x2c')][_0xe16d('0x38')]){_0x4fd909[_0xe16d('0x35')]=_[_0xe16d('0x39')](_0x4fd909[_0xe16d('0x35')],{'$or':_[_0xe16d('0x27')](_0x4fd909[_0xe16d('0x2f')],function(_0x4e2dd3){var _0x159912={};_0x159912[_0x4e2dd3]={'$like':'%'+_0x4045ff[_0xe16d('0x2c')][_0xe16d('0x38')]+'%'};return _0x159912;})});}_0x4fd909=_[_0xe16d('0x39')]({},_0x4fd909,_0x4045ff['options']);return _0x5e6c17[_0xe16d('0x47')](_0x4fd909);}})[_0xe16d('0x20')](function(_0x38e84a){if(_0x38e84a){_0x223cfc=_0x38e84a['length'];if(!_0x4045ff[_0xe16d('0x2c')]['hasOwnProperty'](_0xe16d('0x49'))){_0x4fd909['limit']=qs[_0xe16d('0x1a')](_0x4045ff['query'][_0xe16d('0x1a')]);_0x4fd909[_0xe16d('0x1c')]=qs['offset'](_0x4045ff['query'][_0xe16d('0x1c')]);}return _0x5e6c17[_0xe16d('0x47')](_0x4fd909);}})[_0xe16d('0x20')](function(_0x3ac632){if(_0x3ac632){return _0x3ac632?{'count':_0x223cfc,'rows':_0x3ac632}:null;}})[_0xe16d('0x20')](respondWithResult(_0x5262e1,null))[_0xe16d('0x40')](handleError(_0x5262e1,null));};exports[_0xe16d('0x4a')]=function(_0x36ad71,_0x123833,_0x22f10f){if(_0x36ad71[_0xe16d('0x46')]['id']){delete _0x36ad71['body']['id'];}return db['ZohoAccount'][_0xe16d('0x4b')]({'where':{'id':_0x36ad71[_0xe16d('0x42')]['id']}})[_0xe16d('0x20')](handleEntityNotFound(_0x123833,null))[_0xe16d('0x20')](function(_0x1f2414){if(_0x1f2414){_0x36ad71[_0xe16d('0x46')][_0xe16d('0x4c')]=_0x1f2414['id'];_0x36ad71['body'][_0xe16d('0x4d')]=integrations[_0xe16d('0x4e')](_0x36ad71[_0xe16d('0x46')][_0xe16d('0x4f')],_0x36ad71['body'][_0xe16d('0x2a')]);_0x36ad71[_0xe16d('0x46')][_0xe16d('0x50')]=integrations[_0xe16d('0x51')](_0x36ad71[_0xe16d('0x46')][_0xe16d('0x4f')],_0x36ad71['body'][_0xe16d('0x2a')]);return db[_0xe16d('0x48')][_0xe16d('0x45')](_0x36ad71[_0xe16d('0x46')],{'include':[{'model':db[_0xe16d('0x52')],'as':_0xe16d('0x4d')},{'model':db[_0xe16d('0x52')],'as':_0xe16d('0x50')}]});}return null;})[_0xe16d('0x20')](respondWithResult(_0x123833,null))[_0xe16d('0x40')](handleError(_0x123833,null));};function getAccessToken(_0x1c84a1){return new Promise(function(_0x544b50,_0x23bf1e){var _0x1db48a;switch(_0x1c84a1[_0xe16d('0x53')]){case'US':_0x1db48a=_0xe16d('0x54');break;case'AU':_0x1db48a=_0xe16d('0x55');break;case'EU':_0x1db48a='https://accounts.zoho.eu';break;case'IN':_0x1db48a=_0xe16d('0x56');break;case'CN':_0x1db48a=_0xe16d('0x57');break;default:_0x1db48a=_0xe16d('0x58');break;}var _0x398db3={'method':_0xe16d('0x59'),'uri':_0x1db48a+_0xe16d('0x5a'),'qs':{'refresh_token':_0x1c84a1['refreshToken'],'client_id':_0x1c84a1[_0xe16d('0x5b')],'client_secret':_0x1c84a1['clientSecret'],'grant_type':_0xe16d('0x5c')},'json':!![]};return rp(_0x398db3)[_0xe16d('0x20')](function(_0x57f123){if(_0x57f123[_0xe16d('0x5d')]){_0x544b50(_0x57f123['access_token']);}else{_0x23bf1e(_0xe16d('0x5e'));}})[_0xe16d('0x40')](function(_0x591b3d){_0x23bf1e(_0x591b3d);});});}exports[_0xe16d('0x5f')]=function(_0x2382ca,_0x277041,_0x26d6aa){var _0x334695,_0x2a36fb,_0x2e065d,_0x5a54e6,_0x278e78;return db[_0xe16d('0x28')][_0xe16d('0x4b')]({'where':{'id':_0x2382ca['params']['id']},'attributes':['id','host',_0xe16d('0x53'),_0xe16d('0x5b'),'clientSecret',_0xe16d('0x60'),_0xe16d('0x61'),_0xe16d('0x62')]})[_0xe16d('0x20')](handleEntityNotFound(_0x277041,null))[_0xe16d('0x20')](function(_0x22c05f){_0x278e78=_0x22c05f;_0x334695=_0x278e78[_0xe16d('0x63')];_0x2a36fb=_0x334695==='zoho.eu'?'eu':_0xe16d('0x64');_0x2e065d=_0x278e78[_0xe16d('0x60')];var _0x1c7920=_0x2e065d[_0xe16d('0x65')](-0x1);if(_0x1c7920==='/'||_0x1c7920==='\x5c'||_0x1c7920===':'){_0x2e065d=_0x2e065d['substring'](0x0,_0x2e065d[_0xe16d('0x66')](_0x1c7920));}if(!_0x278e78['refreshToken']){throw new Error(_0xe16d('0x67'));}return getAccessToken(_0x278e78);})[_0xe16d('0x20')](function(_0x52b9a1){if(_0x52b9a1){return rp({'method':'GET','uri':util['format'](_0xe16d('0x68'),_0x2a36fb),'qs':{'module':_0xe16d('0x69')},'headers':{'Authorization':_0xe16d('0x6a')+_0x52b9a1},'json':!![]});}})[_0xe16d('0x20')](function(_0x59945f){if(_0x59945f){if(_0x59945f['response']&&_0x59945f[_0xe16d('0x6b')][_0xe16d('0x6c')]){throw new Error(_0x59945f[_0xe16d('0x6b')]['error'][_0xe16d('0x6d')]);}var _0x8ec9c0=[];var _0x313d05=[];var _0x17511d=['Owner','Subject','Description',_0xe16d('0x6e'),_0xe16d('0x6f'),_0xe16d('0x70'),_0xe16d('0x71'),'Call_Type'];_0x313d05=_['remove'](_0x59945f[_0xe16d('0x30')],function(_0x27feea){return _0x17511d[_0xe16d('0x72')](_0x27feea[_0xe16d('0x73')]);});for(var _0x24d584=0x0;_0x24d584<_0x313d05[_0xe16d('0x31')];_0x24d584++){if(_0x313d05[_0x24d584][_0xe16d('0x74')]===![]){_0x8ec9c0[_0xe16d('0x75')]({'id':_0x313d05[_0x24d584]['id'],'name':_0x313d05[_0x24d584]['display_label'],'custom':_0x313d05[_0x24d584]['custom_field'],'options':_0x313d05[_0x24d584][_0xe16d('0x76')]==='picklist'&&_0x313d05[_0x24d584][_0xe16d('0x77')][_0xe16d('0x31')]>-0x1?_[_0xe16d('0x27')](_0x313d05[_0x24d584][_0xe16d('0x77')],function(_0xb31f10){return{'name':_0xb31f10,'value':_0xb31f10};}):[]});}}return{'count':_0x8ec9c0[_0xe16d('0x31')],'rows':_0x8ec9c0};}else{return{'count':0x0,'rows':[]};}})[_0xe16d('0x20')](respondWithResult(_0x277041,null))[_0xe16d('0x40')](function(_0x48069b){var _0x1e02d2=_0x2382ca['query']['test']?0x1f4:_0x48069b['statusCode']||0x1f4;logger[_0xe16d('0x6c')]('getFields,\x20%s,\x20%s,\x20%s',_0xe16d('0x5f'),_0x1e02d2,JSON[_0xe16d('0x78')](_0x48069b));delete _0x48069b[_0xe16d('0x25')];if(_0x1e02d2===0x191){_0x1e02d2=0x190;}_0x277041[_0xe16d('0x17')](_0x1e02d2)[_0xe16d('0x79')](_0x2382ca[_0xe16d('0x2c')][_0xe16d('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x48069b['statusCode']}:_0x48069b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index a55f19b..e0eb875 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 _0x74a5=['../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com.au','POST','/oauth/v2/token','authorization_code','code','then','parse','refresh_token','info','name','error','inspect','catch','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','application/x-www-form-urlencoded','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x304e0e,_0x33b054){var _0x568db1=function(_0x3db7dc){while(--_0x3db7dc){_0x304e0e['push'](_0x304e0e['shift']());}};_0x568db1(++_0x33b054);}(_0x74a5,0x77));var _0x574a=function(_0x51ce3e,_0x4a1ed5){_0x51ce3e=_0x51ce3e-0x0;var _0x175562=_0x74a5[_0x51ce3e];return _0x175562;};'use strict';var _=require(_0x574a('0x0'));var util=require(_0x574a('0x1'));var logger=require(_0x574a('0x2'))(_0x574a('0x3'));var moment=require(_0x574a('0x4'));var BPromise=require(_0x574a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x574a('0x6'));var config=require(_0x574a('0x7'));var attributes=require(_0x574a('0x8'));var integrations=require(_0x574a('0x9'));module['exports']=function(_0x4593ea,_0x11f79a){return _0x4593ea[_0x574a('0xa')](_0x574a('0xb'),attributes,{'tableName':_0x574a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x172d50,_0x442908,_0x117d3f){if(_0x172d50[_0x574a('0xd')](_0x574a('0xe'))||_0x172d50['changed'](_0x574a('0xf'))||_0x172d50[_0x574a('0xd')](_0x574a('0x10'))||_0x172d50[_0x574a('0xd')](_0x574a('0x11'))||_0x172d50[_0x574a('0xd')]('code')||_0x172d50['changed']('host')){var _0x2c5d11,_0x5eabfa;_0x2c5d11=_0x172d50[_0x574a('0xf')];var _0x5c6c50=_0x2c5d11[_0x574a('0x12')](-0x1);if(_0x5c6c50==='/'||_0x5c6c50==='\x5c'||_0x5c6c50===':'){_0x2c5d11=_0x2c5d11[_0x574a('0x13')](0x0,_0x2c5d11[_0x574a('0x14')](_0x5c6c50));}switch(_0x172d50['zone']){case'US':_0x5eabfa='https://accounts.zoho.com';break;case'AU':_0x5eabfa=_0x574a('0x15');break;case'IN':_0x5eabfa='https://accounts.zoho.in';break;case'CN':_0x5eabfa='https://accounts.zoho.com.cn';break;default:_0x5eabfa='https://accounts.zoho.eu';break;}var _0x5ce0e2={'method':_0x574a('0x16'),'uri':_0x5eabfa+_0x574a('0x17'),'form':{'grant_type':_0x574a('0x18'),'client_id':_0x172d50[_0x574a('0x10')],'client_secret':_0x172d50[_0x574a('0x11')],'redirect_uri':_0x172d50[_0x574a('0xf')],'code':_0x172d50[_0x574a('0x19')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5ce0e2)[_0x574a('0x1a')](function(_0x561fba){var _0x44bce6=JSON[_0x574a('0x1b')](_0x561fba);if(_0x44bce6[_0x574a('0x1c')]){_0x172d50['refreshToken']=_0x44bce6[_0x574a('0x1c')];logger[_0x574a('0x1d')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x172d50[_0x574a('0x1e')],_0x172d50['id']));}else{logger[_0x574a('0x1f')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x172d50['name'],_0x172d50['id']),util[_0x574a('0x20')](_0x44bce6,{'showHidden':![],'depth':null}));}return _0x117d3f(null,_0x442908);})[_0x574a('0x21')](function(_0x2d634f){logger[_0x574a('0x1f')](util[_0x574a('0x22')](_0x574a('0x23'),_0x172d50[_0x574a('0x1e')],_0x172d50['id']),util[_0x574a('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x117d3f(_0x2d634f);});}else{return _0x117d3f(null,_0x442908);}},'beforeUpdate':function(_0x213476,_0x4efcce,_0x404800){if(_0x213476[_0x574a('0xd')](_0x574a('0xe'))||_0x213476[_0x574a('0xd')]('serverUrl')||_0x213476[_0x574a('0xd')](_0x574a('0x10'))||_0x213476['changed'](_0x574a('0x11'))||_0x213476[_0x574a('0xd')](_0x574a('0x19'))||_0x213476[_0x574a('0xd')](_0x574a('0x24'))){var _0x379229,_0x58919c;_0x379229=_0x213476[_0x574a('0xf')];var _0x4cd334=_0x379229[_0x574a('0x12')](-0x1);if(_0x4cd334==='/'||_0x4cd334==='\x5c'||_0x4cd334===':'){_0x379229=_0x379229[_0x574a('0x13')](0x0,_0x379229[_0x574a('0x14')](_0x4cd334));}switch(_0x213476['zone']){case'US':_0x58919c='https://accounts.zoho.com';break;case'AU':_0x58919c=_0x574a('0x15');break;case'IN':_0x58919c=_0x574a('0x25');break;case'CN':_0x58919c=_0x574a('0x26');break;default:_0x58919c=_0x574a('0x27');break;}var _0x477eef={'method':'POST','uri':_0x58919c+_0x574a('0x17'),'form':{'grant_type':_0x574a('0x18'),'client_id':_0x213476[_0x574a('0x10')],'client_secret':_0x213476['clientSecret'],'redirect_uri':_0x213476[_0x574a('0xf')],'code':_0x213476[_0x574a('0x19')]},'headers':{'Content-Type':_0x574a('0x28')}};return rp(_0x477eef)[_0x574a('0x1a')](function(_0x26a0d3){var _0x260c5c=JSON[_0x574a('0x1b')](_0x26a0d3);if(_0x260c5c['refresh_token']){_0x213476['refreshToken']=_0x260c5c[_0x574a('0x1c')];logger[_0x574a('0x1d')](util['format'](_0x574a('0x29'),_0x213476['name'],_0x213476['id']));}else{logger[_0x574a('0x1f')](util[_0x574a('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x213476[_0x574a('0x1e')],_0x213476['id']),util['inspect'](_0x260c5c,{'showHidden':![],'depth':null}));}return _0x404800(null,_0x4efcce);})[_0x574a('0x21')](function(_0x489d3b){logger[_0x574a('0x1f')](util[_0x574a('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x213476[_0x574a('0x1e')],_0x213476['id']),util[_0x574a('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x404800(_0x489d3b);});}else{return _0x404800(null,_0x4efcce);}}}});}; \ No newline at end of file +var _0x4330=['info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','application/x-www-form-urlencoded','then','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','parse','refreshToken','refresh_token'];(function(_0x378752,_0x158b32){var _0xd5a262=function(_0x3c6f94){while(--_0x3c6f94){_0x378752['push'](_0x378752['shift']());}};_0xd5a262(++_0x158b32);}(_0x4330,0x13d));var _0x0433=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x4330[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0433('0x0'));var util=require(_0x0433('0x1'));var logger=require(_0x0433('0x2'))(_0x0433('0x3'));var moment=require(_0x0433('0x4'));var BPromise=require(_0x0433('0x5'));var rp=require(_0x0433('0x6'));var fs=require('fs');var path=require(_0x0433('0x7'));var rimraf=require(_0x0433('0x8'));var config=require(_0x0433('0x9'));var attributes=require(_0x0433('0xa'));var integrations=require(_0x0433('0xb'));module[_0x0433('0xc')]=function(_0x304eba,_0x5751fa){return _0x304eba['define'](_0x0433('0xd'),attributes,{'tableName':_0x0433('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x404a22,_0x220a36,_0x757581){if(_0x404a22['changed'](_0x0433('0xf'))||_0x404a22[_0x0433('0x10')](_0x0433('0x11'))||_0x404a22[_0x0433('0x10')](_0x0433('0x12'))||_0x404a22[_0x0433('0x10')]('clientSecret')||_0x404a22[_0x0433('0x10')](_0x0433('0x13'))||_0x404a22[_0x0433('0x10')](_0x0433('0x14'))){var _0x49a14e,_0x5a1edc;_0x49a14e=_0x404a22['serverUrl'];var _0x29e0c5=_0x49a14e[_0x0433('0x15')](-0x1);if(_0x29e0c5==='/'||_0x29e0c5==='\x5c'||_0x29e0c5===':'){_0x49a14e=_0x49a14e[_0x0433('0x16')](0x0,_0x49a14e['lastIndexOf'](_0x29e0c5));}switch(_0x404a22[_0x0433('0xf')]){case'US':_0x5a1edc=_0x0433('0x17');break;case'AU':_0x5a1edc=_0x0433('0x18');break;case'IN':_0x5a1edc=_0x0433('0x19');break;case'CN':_0x5a1edc=_0x0433('0x1a');break;default:_0x5a1edc=_0x0433('0x1b');break;}var _0x10ab77={'method':_0x0433('0x1c'),'uri':_0x5a1edc+_0x0433('0x1d'),'form':{'grant_type':_0x0433('0x1e'),'client_id':_0x404a22[_0x0433('0x12')],'client_secret':_0x404a22[_0x0433('0x1f')],'redirect_uri':_0x404a22['serverUrl'],'code':_0x404a22[_0x0433('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x10ab77)['then'](function(_0x2dccbc){var _0x2c0f11=JSON[_0x0433('0x20')](_0x2dccbc);if(_0x2c0f11['refresh_token']){_0x404a22[_0x0433('0x21')]=_0x2c0f11[_0x0433('0x22')];logger[_0x0433('0x23')](util[_0x0433('0x24')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x404a22[_0x0433('0x25')],_0x404a22['id']));}else{logger[_0x0433('0x26')](util[_0x0433('0x24')](_0x0433('0x27'),_0x404a22[_0x0433('0x25')],_0x404a22['id']),util['inspect'](_0x2c0f11,{'showHidden':![],'depth':null}));}return _0x757581(null,_0x220a36);})['catch'](function(_0x55bdba){logger[_0x0433('0x26')](util[_0x0433('0x24')](_0x0433('0x27'),_0x404a22[_0x0433('0x25')],_0x404a22['id']),util[_0x0433('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x757581(_0x55bdba);});}else{return _0x757581(null,_0x220a36);}},'beforeUpdate':function(_0x32e035,_0x36bd8b,_0x277deb){if(_0x32e035[_0x0433('0x10')](_0x0433('0xf'))||_0x32e035[_0x0433('0x10')]('serverUrl')||_0x32e035[_0x0433('0x10')](_0x0433('0x12'))||_0x32e035['changed']('clientSecret')||_0x32e035[_0x0433('0x10')](_0x0433('0x13'))||_0x32e035[_0x0433('0x10')](_0x0433('0x14'))){var _0x14cf16,_0x18b840;_0x14cf16=_0x32e035[_0x0433('0x11')];var _0x2d08cf=_0x14cf16[_0x0433('0x15')](-0x1);if(_0x2d08cf==='/'||_0x2d08cf==='\x5c'||_0x2d08cf===':'){_0x14cf16=_0x14cf16[_0x0433('0x16')](0x0,_0x14cf16['lastIndexOf'](_0x2d08cf));}switch(_0x32e035[_0x0433('0xf')]){case'US':_0x18b840=_0x0433('0x17');break;case'AU':_0x18b840=_0x0433('0x18');break;case'IN':_0x18b840='https://accounts.zoho.in';break;case'CN':_0x18b840=_0x0433('0x1a');break;default:_0x18b840=_0x0433('0x1b');break;}var _0x3df239={'method':_0x0433('0x1c'),'uri':_0x18b840+_0x0433('0x1d'),'form':{'grant_type':_0x0433('0x1e'),'client_id':_0x32e035[_0x0433('0x12')],'client_secret':_0x32e035[_0x0433('0x1f')],'redirect_uri':_0x32e035[_0x0433('0x11')],'code':_0x32e035[_0x0433('0x13')]},'headers':{'Content-Type':_0x0433('0x29')}};return rp(_0x3df239)[_0x0433('0x2a')](function(_0x24813d){var _0x1a0e3b=JSON[_0x0433('0x20')](_0x24813d);if(_0x1a0e3b[_0x0433('0x22')]){_0x32e035['refreshToken']=_0x1a0e3b[_0x0433('0x22')];logger['info'](util[_0x0433('0x24')](_0x0433('0x2b'),_0x32e035[_0x0433('0x25')],_0x32e035['id']));}else{logger['error'](util[_0x0433('0x24')](_0x0433('0x27'),_0x32e035['name'],_0x32e035['id']),util[_0x0433('0x28')](_0x1a0e3b,{'showHidden':![],'depth':null}));}return _0x277deb(null,_0x36bd8b);})['catch'](function(_0x5b6b3e){logger[_0x0433('0x26')](util[_0x0433('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x32e035['name'],_0x32e035['id']),util[_0x0433('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x277deb(_0x5b6b3e);});}else{return _0x277deb(null,_0x36bd8b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2d44c6f..2935509 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 _0x7da6=['options','attributes','include','map','model','then','GetZohoAccount','stringify','ShowZohoAccount','find','raw','where','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ZohoAccount','findAll'];(function(_0x228ade,_0x47e287){var _0x2f177a=function(_0x36fdfc){while(--_0x36fdfc){_0x228ade['push'](_0x228ade['shift']());}};_0x2f177a(++_0x47e287);}(_0x7da6,0x124));var _0x67da=function(_0x4c7149,_0x335342){_0x4c7149=_0x4c7149-0x0;var _0x200122=_0x7da6[_0x4c7149];return _0x200122;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x67da('0x0'));var BPromise=require(_0x67da('0x1'));var rs=require(_0x67da('0x2'));var fs=require('fs');var Redis=require(_0x67da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x67da('0x4'));var logger=require(_0x67da('0x5'))(_0x67da('0x6'));var config=require(_0x67da('0x7'));var jayson=require(_0x67da('0x8'));var client=jayson[_0x67da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb7f52,_0x49025f,_0x4cfe49){return new BPromise(function(_0x3d971d,_0x5ac004){return client[_0x67da('0xa')](_0xb7f52,_0x4cfe49)['then'](function(_0x1e8a4c){logger[_0x67da('0xb')](_0x67da('0xc'),_0x49025f,_0x67da('0xd'));logger[_0x67da('0xe')](_0x67da('0xf'),_0x49025f,_0x67da('0xd'),JSON['stringify'](_0x1e8a4c));if(_0x1e8a4c[_0x67da('0x10')]){if(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x11')]===0x1f4){logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0x1e8a4c[_0x67da('0x10')]['message']);return _0x5ac004(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x12')]);}logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0x1e8a4c[_0x67da('0x10')]['message']);return _0x3d971d(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x12')]);}else{logger['info'](_0x67da('0xc'),_0x49025f,_0x67da('0xd'));_0x3d971d(_0x1e8a4c[_0x67da('0x13')][_0x67da('0x12')]);}})[_0x67da('0x14')](function(_0xb3a67){logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0xb3a67);_0x5ac004(_0xb3a67);});});}exports['GetZohoAccount']=function(_0xaefe69){var _0x524819=this;return new Promise(function(_0x31454f,_0x5765d5){return db[_0x67da('0x15')][_0x67da('0x16')]({'raw':_0xaefe69[_0x67da('0x17')]?_0xaefe69[_0x67da('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xaefe69[_0x67da('0x17')]?_0xaefe69['options']['where']||null:null,'attributes':_0xaefe69[_0x67da('0x17')]?_0xaefe69[_0x67da('0x17')][_0x67da('0x18')]||null:null,'limit':_0xaefe69[_0x67da('0x17')]?_0xaefe69['options']['limit']||null:null,'include':_0xaefe69['options']?_0xaefe69[_0x67da('0x17')][_0x67da('0x19')]?_[_0x67da('0x1a')](_0xaefe69[_0x67da('0x17')][_0x67da('0x19')],function(_0x4e6cb1){return{'model':db[_0x4e6cb1['model']],'as':_0x4e6cb1['as'],'attributes':_0x4e6cb1[_0x67da('0x18')],'include':_0x4e6cb1[_0x67da('0x19')]?_['map'](_0x4e6cb1[_0x67da('0x19')],function(_0x599a9d){return{'model':db[_0x599a9d[_0x67da('0x1b')]],'as':_0x599a9d['as'],'attributes':_0x599a9d[_0x67da('0x18')],'include':_0x599a9d[_0x67da('0x19')]?_[_0x67da('0x1a')](_0x599a9d[_0x67da('0x19')],function(_0x35b1bc){return{'model':db[_0x35b1bc['model']],'as':_0x35b1bc['as'],'attributes':_0x35b1bc[_0x67da('0x18')]};}):[]};}):[]};}):[]:[]})[_0x67da('0x1c')](function(_0x5875d9){logger['info'](_0x67da('0x1d'),_0xaefe69);logger[_0x67da('0xe')](_0x67da('0x1d'),_0xaefe69,JSON[_0x67da('0x1e')](_0x5875d9));_0x31454f(_0x5875d9);})['catch'](function(_0x1cba18){logger[_0x67da('0x10')](_0x67da('0x1d'),_0x1cba18[_0x67da('0x12')],_0xaefe69);_0x5765d5(_0x524819[_0x67da('0x10')](0x1f4,_0x1cba18[_0x67da('0x12')]));});});};exports[_0x67da('0x1f')]=function(_0x1e2bd0){var _0x36d143=this;return new Promise(function(_0x91fc5c,_0x18dd99){return db[_0x67da('0x15')][_0x67da('0x20')]({'raw':_0x1e2bd0[_0x67da('0x17')]?_0x1e2bd0['options'][_0x67da('0x21')]===undefined?!![]:![]:!![],'where':_0x1e2bd0[_0x67da('0x17')]?_0x1e2bd0[_0x67da('0x17')][_0x67da('0x22')]||null:null,'attributes':_0x1e2bd0[_0x67da('0x17')]?_0x1e2bd0[_0x67da('0x17')]['attributes']||null:null,'include':_0x1e2bd0[_0x67da('0x17')]?_0x1e2bd0[_0x67da('0x17')][_0x67da('0x19')]?_['map'](_0x1e2bd0['options']['include'],function(_0x4cfcab){return{'model':db[_0x4cfcab[_0x67da('0x1b')]],'as':_0x4cfcab['as'],'attributes':_0x4cfcab['attributes'],'include':_0x4cfcab[_0x67da('0x19')]?_[_0x67da('0x1a')](_0x4cfcab[_0x67da('0x19')],function(_0x21c253){return{'model':db[_0x21c253[_0x67da('0x1b')]],'as':_0x21c253['as'],'attributes':_0x21c253[_0x67da('0x18')],'include':_0x21c253[_0x67da('0x19')]?_[_0x67da('0x1a')](_0x21c253[_0x67da('0x19')],function(_0x11ec02){return{'model':db[_0x11ec02[_0x67da('0x1b')]],'as':_0x11ec02['as'],'attributes':_0x11ec02[_0x67da('0x18')]};}):[]};}):[]};}):[]:[]})[_0x67da('0x1c')](function(_0x1348bb){logger[_0x67da('0xb')](_0x67da('0x1f'),_0x1e2bd0);logger[_0x67da('0xe')](_0x67da('0x1f'),_0x1e2bd0,JSON[_0x67da('0x1e')](_0x1348bb));_0x91fc5c(_0x1348bb);})[_0x67da('0x14')](function(_0xa96a4e){logger[_0x67da('0x10')](_0x67da('0x1f'),_0xa96a4e[_0x67da('0x12')],_0x1e2bd0);_0x18dd99(_0x36d143[_0x67da('0x10')](0x1f4,_0xa96a4e[_0x67da('0x12')]));});});}; \ No newline at end of file +var _0x84c6=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','ZohoAccount,\x20%s,\x20%s','error','message','result','catch','GetZohoAccount','ZohoAccount','options','where','limit','map','include','model','attributes','ShowZohoAccount','raw','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x24c847,_0x13102e){var _0x1d8e52=function(_0x495974){while(--_0x495974){_0x24c847['push'](_0x24c847['shift']());}};_0x1d8e52(++_0x13102e);}(_0x84c6,0xe7));var _0x684c=function(_0x4e1afa,_0xfee3e){_0x4e1afa=_0x4e1afa-0x0;var _0x367b01=_0x84c6[_0x4e1afa];return _0x367b01;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x684c('0x0'));var BPromise=require(_0x684c('0x1'));var rs=require(_0x684c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x684c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x684c('0x4'))(_0x684c('0x5'));var config=require(_0x684c('0x6'));var jayson=require(_0x684c('0x7'));var client=jayson[_0x684c('0x8')][_0x684c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x209f74,_0x2c52dd,_0x168935){return new BPromise(function(_0x2fd628,_0x5824d8){return client[_0x684c('0xa')](_0x209f74,_0x168935)[_0x684c('0xb')](function(_0x5502ad){logger[_0x684c('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x2c52dd,_0x684c('0xd'));logger[_0x684c('0xe')](_0x684c('0xf'),_0x2c52dd,_0x684c('0xd'),JSON[_0x684c('0x10')](_0x5502ad));if(_0x5502ad['error']){if(_0x5502ad['error'][_0x684c('0x11')]===0x1f4){logger['error'](_0x684c('0x12'),_0x2c52dd,_0x5502ad[_0x684c('0x13')][_0x684c('0x14')]);return _0x5824d8(_0x5502ad['error'][_0x684c('0x14')]);}logger['error'](_0x684c('0x12'),_0x2c52dd,_0x5502ad[_0x684c('0x13')][_0x684c('0x14')]);return _0x2fd628(_0x5502ad[_0x684c('0x13')][_0x684c('0x14')]);}else{logger[_0x684c('0xc')](_0x684c('0x12'),_0x2c52dd,_0x684c('0xd'));_0x2fd628(_0x5502ad[_0x684c('0x15')]['message']);}})[_0x684c('0x16')](function(_0x5dd4f1){logger['error'](_0x684c('0x12'),_0x2c52dd,_0x5dd4f1);_0x5824d8(_0x5dd4f1);});});}exports[_0x684c('0x17')]=function(_0x421404){var _0x1dc55d=this;return new Promise(function(_0x304099,_0x5d9905){return db[_0x684c('0x18')]['findAll']({'raw':_0x421404['options']?_0x421404[_0x684c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x421404[_0x684c('0x19')]?_0x421404['options'][_0x684c('0x1a')]||null:null,'attributes':_0x421404[_0x684c('0x19')]?_0x421404[_0x684c('0x19')]['attributes']||null:null,'limit':_0x421404[_0x684c('0x19')]?_0x421404[_0x684c('0x19')][_0x684c('0x1b')]||null:null,'include':_0x421404[_0x684c('0x19')]?_0x421404[_0x684c('0x19')]['include']?_[_0x684c('0x1c')](_0x421404[_0x684c('0x19')][_0x684c('0x1d')],function(_0x416912){return{'model':db[_0x416912[_0x684c('0x1e')]],'as':_0x416912['as'],'attributes':_0x416912[_0x684c('0x1f')],'include':_0x416912['include']?_[_0x684c('0x1c')](_0x416912[_0x684c('0x1d')],function(_0x1962a0){return{'model':db[_0x1962a0[_0x684c('0x1e')]],'as':_0x1962a0['as'],'attributes':_0x1962a0[_0x684c('0x1f')],'include':_0x1962a0[_0x684c('0x1d')]?_[_0x684c('0x1c')](_0x1962a0[_0x684c('0x1d')],function(_0xa2fbd9){return{'model':db[_0xa2fbd9['model']],'as':_0xa2fbd9['as'],'attributes':_0xa2fbd9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d3445){logger[_0x684c('0xc')](_0x684c('0x17'),_0x421404);logger[_0x684c('0xe')]('GetZohoAccount',_0x421404,JSON[_0x684c('0x10')](_0x1d3445));_0x304099(_0x1d3445);})['catch'](function(_0x63a41f){logger['error'](_0x684c('0x17'),_0x63a41f[_0x684c('0x14')],_0x421404);_0x5d9905(_0x1dc55d[_0x684c('0x13')](0x1f4,_0x63a41f['message']));});});};exports[_0x684c('0x20')]=function(_0x7b3900){var _0x5dedcb=this;return new Promise(function(_0xadb242,_0x1a944b){return db[_0x684c('0x18')]['find']({'raw':_0x7b3900[_0x684c('0x19')]?_0x7b3900[_0x684c('0x19')][_0x684c('0x21')]===undefined?!![]:![]:!![],'where':_0x7b3900[_0x684c('0x19')]?_0x7b3900['options'][_0x684c('0x1a')]||null:null,'attributes':_0x7b3900[_0x684c('0x19')]?_0x7b3900[_0x684c('0x19')][_0x684c('0x1f')]||null:null,'include':_0x7b3900['options']?_0x7b3900[_0x684c('0x19')]['include']?_[_0x684c('0x1c')](_0x7b3900[_0x684c('0x19')][_0x684c('0x1d')],function(_0x4d8d71){return{'model':db[_0x4d8d71[_0x684c('0x1e')]],'as':_0x4d8d71['as'],'attributes':_0x4d8d71[_0x684c('0x1f')],'include':_0x4d8d71[_0x684c('0x1d')]?_[_0x684c('0x1c')](_0x4d8d71[_0x684c('0x1d')],function(_0x2004d6){return{'model':db[_0x2004d6[_0x684c('0x1e')]],'as':_0x2004d6['as'],'attributes':_0x2004d6[_0x684c('0x1f')],'include':_0x2004d6[_0x684c('0x1d')]?_[_0x684c('0x1c')](_0x2004d6[_0x684c('0x1d')],function(_0xce6b24){return{'model':db[_0xce6b24['model']],'as':_0xce6b24['as'],'attributes':_0xce6b24[_0x684c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10c672){logger['info'](_0x684c('0x20'),_0x7b3900);logger['debug'](_0x684c('0x20'),_0x7b3900,JSON['stringify'](_0x10c672));_0xadb242(_0x10c672);})[_0x684c('0x16')](function(_0x524cf9){logger[_0x684c('0x13')](_0x684c('0x20'),_0x524cf9[_0x684c('0x14')],_0x7b3900);_0x1a944b(_0x5dedcb[_0x684c('0x13')](0x1f4,_0x524cf9[_0x684c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 76399d5..80e6638 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 _0x6211=['getDescriptions','post','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions'];(function(_0x550bc2,_0x5a5b0e){var _0x16d8dd=function(_0x158676){while(--_0x158676){_0x550bc2['push'](_0x550bc2['shift']());}};_0x16d8dd(++_0x5a5b0e);}(_0x6211,0x8a));var _0x1621=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6211[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x1621('0x0'));var util=require(_0x1621('0x1'));var path=require(_0x1621('0x2'));var timeout=require('connect-timeout');var express=require(_0x1621('0x3'));var router=express[_0x1621('0x4')]();var fs_extra=require(_0x1621('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1621('0x6'));var controller=require(_0x1621('0x7'));router[_0x1621('0x8')]('/',auth[_0x1621('0x9')](),controller[_0x1621('0xa')]);router[_0x1621('0x8')](_0x1621('0xb'),auth[_0x1621('0x9')](),controller[_0x1621('0xc')]);router[_0x1621('0x8')](_0x1621('0xd'),auth[_0x1621('0x9')](),controller['getFields']);router[_0x1621('0x8')](_0x1621('0xe'),auth[_0x1621('0x9')](),controller['getSubjects']);router[_0x1621('0x8')](_0x1621('0xf'),auth[_0x1621('0x9')](),controller[_0x1621('0x10')]);router[_0x1621('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1621('0x12')](_0x1621('0xb'),auth[_0x1621('0x9')](),controller[_0x1621('0x13')]);router[_0x1621('0x14')](_0x1621('0xb'),auth[_0x1621('0x9')](),controller['destroy']);module[_0x1621('0x15')]=router; \ No newline at end of file +var _0x0c9a=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x0c9a,0x12d));var _0xa0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa0c9('0x0'));var util=require('util');var path=require(_0xa0c9('0x1'));var timeout=require(_0xa0c9('0x2'));var express=require(_0xa0c9('0x3'));var router=express[_0xa0c9('0x4')]();var fs_extra=require(_0xa0c9('0x5'));var auth=require(_0xa0c9('0x6'));var interaction=require(_0xa0c9('0x7'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xa0c9('0x8')]('/',auth[_0xa0c9('0x9')](),controller['index']);router['get'](_0xa0c9('0xa'),auth[_0xa0c9('0x9')](),controller[_0xa0c9('0xb')]);router['get'](_0xa0c9('0xc'),auth[_0xa0c9('0x9')](),controller[_0xa0c9('0xd')]);router[_0xa0c9('0x8')](_0xa0c9('0xe'),auth[_0xa0c9('0x9')](),controller['getSubjects']);router[_0xa0c9('0x8')](_0xa0c9('0xf'),auth[_0xa0c9('0x9')](),controller[_0xa0c9('0x10')]);router[_0xa0c9('0x11')]('/',auth[_0xa0c9('0x9')](),controller['create']);router[_0xa0c9('0x12')](_0xa0c9('0xa'),auth[_0xa0c9('0x9')](),controller[_0xa0c9('0x13')]);router[_0xa0c9('0x14')](_0xa0c9('0xa'),auth[_0xa0c9('0x9')](),controller[_0xa0c9('0x15')]);module[_0xa0c9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e44be50..e8712d8 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 _0x643d=['lead','ENUM','contact_lead','exports','STRING','contact','nothing'];(function(_0x2d8434,_0x43d781){var _0x26b9e4=function(_0x54f5b8){while(--_0x54f5b8){_0x2d8434['push'](_0x2d8434['shift']());}};_0x26b9e4(++_0x43d781);}(_0x643d,0x1df));var _0xd643=function(_0x2820bf,_0x1550f5){_0x2820bf=_0x2820bf-0x0;var _0x4b2973=_0x643d[_0x2820bf];return _0x4b2973;};'use strict';var Sequelize=require('sequelize');module[_0xd643('0x0')]={'name':{'type':Sequelize[_0xd643('0x1')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0xd643('0x2'),_0xd643('0x3')),'defaultValue':_0xd643('0x4')},'moduleSearch':{'type':Sequelize[_0xd643('0x5')]('contact_lead',_0xd643('0x2'),_0xd643('0x4')),'defaultValue':_0xd643('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x568a=['contact_lead','STRING','ENUM','lead','contact'];(function(_0x298112,_0x436478){var _0x561dc7=function(_0x2f2ce5){while(--_0x2f2ce5){_0x298112['push'](_0x298112['shift']());}};_0x561dc7(++_0x436478);}(_0x568a,0x1dc));var _0xa568=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x568a[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa568('0x0')]},'moduleCreate':{'type':Sequelize[_0xa568('0x1')](_0xa568('0x2'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa568('0x1')]('contact_lead',_0xa568('0x3'),'lead'),'defaultValue':_0xa568('0x4')},'description':{'type':Sequelize[_0xa568('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 7f539af..69b3897 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 _0x36af=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','getFields','findOne','rawAttributes','pick','getSubjects','ZohoField','hasOwnProperty','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring'];(function(_0x5872bb,_0x4bc758){var _0x392d2c=function(_0xf719c6){while(--_0xf719c6){_0x5872bb['push'](_0x5872bb['shift']());}};_0x392d2c(++_0x4bc758);}(_0x36af,0xe3));var _0xf36a=function(_0x350e65,_0x9376a0){_0x350e65=_0x350e65-0x0;var _0x5d30c4=_0x36af[_0x350e65];return _0x5d30c4;};'use strict';var emlformat=require(_0xf36a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf36a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf36a('0x2'));var moment=require('moment');var BPromise=require(_0xf36a('0x3'));var Mustache=require(_0xf36a('0x4'));var util=require(_0xf36a('0x5'));var path=require(_0xf36a('0x6'));var sox=require(_0xf36a('0x7'));var csv=require(_0xf36a('0x8'));var ejs=require(_0xf36a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf36a('0xa'));var squel=require(_0xf36a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf36a('0x8'));var querystring=require(_0xf36a('0xc'));var Papa=require(_0xf36a('0xd'));var Redis=require(_0xf36a('0xe'));var authService=require(_0xf36a('0xf'));var qs=require(_0xf36a('0x10'));var as=require(_0xf36a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf36a('0x12'))(_0xf36a('0x13'));var utils=require(_0xf36a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf36a('0x15'));var db=require(_0xf36a('0x16'))['db'];function respondWithStatusCode(_0x3b3c53,_0x510a87){_0x510a87=_0x510a87||0xcc;return function(_0x4a9d1b){if(_0x4a9d1b){return _0x3b3c53[_0xf36a('0x17')](_0x510a87);}return _0x3b3c53[_0xf36a('0x18')](_0x510a87)[_0xf36a('0x19')]();};}function respondWithResult(_0x1d6bab,_0x12bd13){_0x12bd13=_0x12bd13||0xc8;return function(_0x28fb46){if(_0x28fb46){return _0x1d6bab[_0xf36a('0x18')](_0x12bd13)[_0xf36a('0x1a')](_0x28fb46);}};}function respondWithFilteredResult(_0x49ce45,_0xd6ce3d){return function(_0x2c8303){if(_0x2c8303){var _0x390aa0=typeof _0xd6ce3d['offset']===_0xf36a('0x1b')&&typeof _0xd6ce3d[_0xf36a('0x1c')]===_0xf36a('0x1b');var _0x1f6ed0=_0x2c8303[_0xf36a('0x1d')];var _0x378105=_0x390aa0?0x0:_0xd6ce3d[_0xf36a('0x1e')];var _0x816408=_0x390aa0?_0x2c8303['count']:_0xd6ce3d[_0xf36a('0x1e')]+_0xd6ce3d['limit'];var _0x2b65eb;if(_0x816408>=_0x1f6ed0){_0x816408=_0x1f6ed0;_0x2b65eb=0xc8;}else{_0x2b65eb=0xce;}_0x49ce45[_0xf36a('0x18')](_0x2b65eb);return _0x49ce45[_0xf36a('0x1f')](_0xf36a('0x20'),_0x378105+'-'+_0x816408+'/'+_0x1f6ed0)[_0xf36a('0x1a')](_0x2c8303);}return null;};}function patchUpdates(_0x1dfd1f){return function(_0x10f025){try{jsonpatch[_0xf36a('0x21')](_0x10f025,_0x1dfd1f,!![]);}catch(_0x576a30){return BPromise[_0xf36a('0x22')](_0x576a30);}return _0x10f025[_0xf36a('0x23')]();};}function saveUpdates(_0xfd1730,_0x591e4a){return function(_0x4ef26f){if(_0x4ef26f){return _0x4ef26f[_0xf36a('0x24')](_0xfd1730)[_0xf36a('0x25')](function(_0x40d988){return _0x40d988;});}return null;};}function removeEntity(_0x2aeca7,_0x44ee01){return function(_0x206d81){if(_0x206d81){return _0x206d81[_0xf36a('0x26')]()[_0xf36a('0x25')](function(){_0x2aeca7[_0xf36a('0x18')](0xcc)[_0xf36a('0x19')]();});}};}function handleEntityNotFound(_0x2712bb,_0x48c867){return function(_0x3ac19c){if(!_0x3ac19c){_0x2712bb[_0xf36a('0x17')](0x194);}return _0x3ac19c;};}function handleError(_0x609326,_0x4c7b81){_0x4c7b81=_0x4c7b81||0x1f4;return function(_0x4e7c17){logger[_0xf36a('0x27')](_0x4e7c17[_0xf36a('0x28')]);if(_0x4e7c17[_0xf36a('0x29')]){delete _0x4e7c17[_0xf36a('0x29')];}_0x609326[_0xf36a('0x18')](_0x4c7b81)[_0xf36a('0x2a')](_0x4e7c17);};}exports[_0xf36a('0x2b')]=function(_0xdf59f8,_0x4edd2b){var _0x3a0b7a={},_0x2c4ad5={},_0x22f5a1={'count':0x0,'rows':[]};var _0x4c4254=_[_0xf36a('0x2c')](db[_0xf36a('0x2d')]['rawAttributes'],function(_0x1ec1da){return{'name':_0x1ec1da[_0xf36a('0x2e')],'type':_0x1ec1da[_0xf36a('0x2f')]['key']};});_0x2c4ad5[_0xf36a('0x30')]=_[_0xf36a('0x2c')](_0x4c4254,'name');_0x2c4ad5[_0xf36a('0x31')]=_['keys'](_0xdf59f8['query']);_0x2c4ad5['filters']=_[_0xf36a('0x32')](_0x2c4ad5['model'],_0x2c4ad5['query']);_0x3a0b7a[_0xf36a('0x33')]=_[_0xf36a('0x32')](_0x2c4ad5[_0xf36a('0x30')],qs[_0xf36a('0x34')](_0xdf59f8[_0xf36a('0x31')][_0xf36a('0x34')]));_0x3a0b7a[_0xf36a('0x33')]=_0x3a0b7a['attributes'][_0xf36a('0x35')]?_0x3a0b7a[_0xf36a('0x33')]:_0x2c4ad5[_0xf36a('0x30')];if(!_0xdf59f8[_0xf36a('0x31')]['hasOwnProperty'](_0xf36a('0x36'))){_0x3a0b7a[_0xf36a('0x1c')]=qs[_0xf36a('0x1c')](_0xdf59f8['query'][_0xf36a('0x1c')]);_0x3a0b7a[_0xf36a('0x1e')]=qs[_0xf36a('0x1e')](_0xdf59f8[_0xf36a('0x31')][_0xf36a('0x1e')]);}_0x3a0b7a[_0xf36a('0x37')]=qs['sort'](_0xdf59f8[_0xf36a('0x31')][_0xf36a('0x38')]);_0x3a0b7a[_0xf36a('0x39')]=qs[_0xf36a('0x3a')](_['pick'](_0xdf59f8[_0xf36a('0x31')],_0x2c4ad5[_0xf36a('0x3a')]),_0x4c4254);if(_0xdf59f8[_0xf36a('0x31')][_0xf36a('0x3b')]){_0x3a0b7a['where']=_[_0xf36a('0x3c')](_0x3a0b7a['where'],{'$or':_[_0xf36a('0x2c')](_0x4c4254,function(_0x43c229){if(_0x43c229['type']!==_0xf36a('0x3d')){var _0x59955c={};_0x59955c[_0x43c229[_0xf36a('0x29')]]={'$like':'%'+_0xdf59f8[_0xf36a('0x31')][_0xf36a('0x3b')]+'%'};return _0x59955c;}})});}_0x3a0b7a=_[_0xf36a('0x3c')]({},_0x3a0b7a,_0xdf59f8[_0xf36a('0x3e')]);var _0x2e5747={'where':_0x3a0b7a[_0xf36a('0x39')]};return db[_0xf36a('0x2d')][_0xf36a('0x1d')](_0x2e5747)['then'](function(_0x5955ad){_0x22f5a1['count']=_0x5955ad;if(_0xdf59f8[_0xf36a('0x31')][_0xf36a('0x3f')]){_0x3a0b7a[_0xf36a('0x40')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xf36a('0x41')](_0x3a0b7a);})['then'](function(_0xf93073){_0x22f5a1[_0xf36a('0x42')]=_0xf93073;return _0x22f5a1;})[_0xf36a('0x25')](respondWithFilteredResult(_0x4edd2b,_0x3a0b7a))[_0xf36a('0x43')](handleError(_0x4edd2b,null));};exports['show']=function(_0x4f0b7f,_0x328739){var _0x5c6972={'raw':![],'where':{'id':_0x4f0b7f[_0xf36a('0x44')]['id']}},_0x14b5e0={};_0x14b5e0['model']=_[_0xf36a('0x45')](db[_0xf36a('0x2d')]['rawAttributes']);_0x14b5e0['query']=_[_0xf36a('0x45')](_0x4f0b7f[_0xf36a('0x31')]);_0x14b5e0['filters']=_[_0xf36a('0x32')](_0x14b5e0[_0xf36a('0x30')],_0x14b5e0[_0xf36a('0x31')]);_0x5c6972[_0xf36a('0x33')]=_[_0xf36a('0x32')](_0x14b5e0['model'],qs[_0xf36a('0x34')](_0x4f0b7f[_0xf36a('0x31')][_0xf36a('0x34')]));_0x5c6972[_0xf36a('0x33')]=_0x5c6972[_0xf36a('0x33')][_0xf36a('0x35')]?_0x5c6972['attributes']:_0x14b5e0[_0xf36a('0x30')];if(_0x4f0b7f[_0xf36a('0x31')][_0xf36a('0x3f')]){_0x5c6972[_0xf36a('0x40')]=[{'all':!![]}];}_0x5c6972=_[_0xf36a('0x3c')]({},_0x5c6972,_0x4f0b7f[_0xf36a('0x3e')]);return db['ZohoConfiguration'][_0xf36a('0x46')](_0x5c6972)[_0xf36a('0x25')](handleEntityNotFound(_0x328739,null))[_0xf36a('0x25')](respondWithResult(_0x328739,null))[_0xf36a('0x43')](handleError(_0x328739,null));};exports['create']=function(_0x507c21,_0x53cde8){return db[_0xf36a('0x2d')][_0xf36a('0x47')](_0x507c21[_0xf36a('0x48')],{})['then'](respondWithResult(_0x53cde8,0xc9))[_0xf36a('0x43')](handleError(_0x53cde8,null));};exports['update']=function(_0x55d99b,_0x2cc240){if(_0x55d99b['body']['id']){delete _0x55d99b[_0xf36a('0x48')]['id'];}return db[_0xf36a('0x2d')][_0xf36a('0x46')]({'where':{'id':_0x55d99b[_0xf36a('0x44')]['id']}})[_0xf36a('0x25')](handleEntityNotFound(_0x2cc240,null))['then'](saveUpdates(_0x55d99b[_0xf36a('0x48')],null))[_0xf36a('0x25')](respondWithResult(_0x2cc240,null))[_0xf36a('0x43')](handleError(_0x2cc240,null));};exports[_0xf36a('0x26')]=function(_0x20408f,_0x44e93b){return db[_0xf36a('0x2d')][_0xf36a('0x46')]({'where':{'id':_0x20408f[_0xf36a('0x44')]['id']}})[_0xf36a('0x25')](handleEntityNotFound(_0x44e93b,null))[_0xf36a('0x25')](removeEntity(_0x44e93b,null))[_0xf36a('0x43')](handleError(_0x44e93b,null));};exports[_0xf36a('0x49')]=function(_0x25f45c,_0x1afd85,_0x5b6d59){var _0x4c3f8e={};var _0x5ef938={};var _0x15d956;var _0x441545;return db[_0xf36a('0x2d')][_0xf36a('0x4a')]({'where':{'id':_0x25f45c[_0xf36a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1afd85,null))[_0xf36a('0x25')](function(_0x51a7df){if(_0x51a7df){_0x15d956=_0x51a7df;_0x5ef938[_0xf36a('0x30')]=_['keys'](db['ZohoField'][_0xf36a('0x4b')]);_0x5ef938[_0xf36a('0x31')]=_[_0xf36a('0x45')](_0x25f45c[_0xf36a('0x31')]);_0x5ef938[_0xf36a('0x3a')]=_[_0xf36a('0x32')](_0x5ef938[_0xf36a('0x30')],_0x5ef938[_0xf36a('0x31')]);_0x4c3f8e['attributes']=_[_0xf36a('0x32')](_0x5ef938[_0xf36a('0x30')],qs[_0xf36a('0x34')](_0x25f45c[_0xf36a('0x31')][_0xf36a('0x34')]));_0x4c3f8e[_0xf36a('0x33')]=_0x4c3f8e['attributes'][_0xf36a('0x35')]?_0x4c3f8e['attributes']:_0x5ef938[_0xf36a('0x30')];_0x4c3f8e[_0xf36a('0x37')]=qs[_0xf36a('0x38')](_0x25f45c[_0xf36a('0x31')][_0xf36a('0x38')]);_0x4c3f8e[_0xf36a('0x39')]=qs[_0xf36a('0x3a')](_[_0xf36a('0x4c')](_0x25f45c[_0xf36a('0x31')],_0x5ef938[_0xf36a('0x3a')]));if(_0x25f45c[_0xf36a('0x31')][_0xf36a('0x3b')]){_0x4c3f8e[_0xf36a('0x39')]=_['merge'](_0x4c3f8e[_0xf36a('0x39')],{'$or':_[_0xf36a('0x2c')](_0x4c3f8e[_0xf36a('0x33')],function(_0x29502e){var _0x570f7b={};_0x570f7b[_0x29502e]={'$like':'%'+_0x25f45c[_0xf36a('0x31')]['filter']+'%'};return _0x570f7b;})});}_0x4c3f8e=_[_0xf36a('0x3c')]({},_0x4c3f8e,_0x25f45c[_0xf36a('0x3e')]);return _0x15d956[_0xf36a('0x49')](_0x4c3f8e);}})[_0xf36a('0x25')](function(_0x146304){if(_0x146304){_0x441545=_0x146304['length'];if(!_0x25f45c['query']['hasOwnProperty'](_0xf36a('0x36'))){_0x4c3f8e['limit']=qs[_0xf36a('0x1c')](_0x25f45c[_0xf36a('0x31')][_0xf36a('0x1c')]);_0x4c3f8e[_0xf36a('0x1e')]=qs[_0xf36a('0x1e')](_0x25f45c[_0xf36a('0x31')][_0xf36a('0x1e')]);}return _0x15d956[_0xf36a('0x49')](_0x4c3f8e);}})[_0xf36a('0x25')](function(_0x25646b){if(_0x25646b){return _0x25646b?{'count':_0x441545,'rows':_0x25646b}:null;}})[_0xf36a('0x25')](respondWithResult(_0x1afd85,null))['catch'](handleError(_0x1afd85,null));};exports[_0xf36a('0x4d')]=function(_0x5838a9,_0x491944,_0x570ce7){var _0x53231a={};var _0x32943f={};var _0x4cb631;var _0x21d240;return db[_0xf36a('0x2d')]['findOne']({'where':{'id':_0x5838a9['params']['id']}})['then'](handleEntityNotFound(_0x491944,null))[_0xf36a('0x25')](function(_0x1a4478){if(_0x1a4478){_0x4cb631=_0x1a4478;_0x32943f[_0xf36a('0x30')]=_['keys'](db[_0xf36a('0x4e')]['rawAttributes']);_0x32943f[_0xf36a('0x31')]=_[_0xf36a('0x45')](_0x5838a9['query']);_0x32943f[_0xf36a('0x3a')]=_[_0xf36a('0x32')](_0x32943f[_0xf36a('0x30')],_0x32943f['query']);_0x53231a[_0xf36a('0x33')]=_[_0xf36a('0x32')](_0x32943f[_0xf36a('0x30')],qs[_0xf36a('0x34')](_0x5838a9[_0xf36a('0x31')][_0xf36a('0x34')]));_0x53231a['attributes']=_0x53231a['attributes'][_0xf36a('0x35')]?_0x53231a[_0xf36a('0x33')]:_0x32943f[_0xf36a('0x30')];_0x53231a[_0xf36a('0x37')]=qs[_0xf36a('0x38')](_0x5838a9['query'][_0xf36a('0x38')]);_0x53231a['where']=qs['filters'](_['pick'](_0x5838a9['query'],_0x32943f[_0xf36a('0x3a')]));if(_0x5838a9['query']['filter']){_0x53231a[_0xf36a('0x39')]=_[_0xf36a('0x3c')](_0x53231a[_0xf36a('0x39')],{'$or':_[_0xf36a('0x2c')](_0x53231a[_0xf36a('0x33')],function(_0x3d97eb){var _0x56de75={};_0x56de75[_0x3d97eb]={'$like':'%'+_0x5838a9[_0xf36a('0x31')]['filter']+'%'};return _0x56de75;})});}_0x53231a=_[_0xf36a('0x3c')]({},_0x53231a,_0x5838a9[_0xf36a('0x3e')]);return _0x4cb631[_0xf36a('0x4d')](_0x53231a);}})['then'](function(_0x419816){if(_0x419816){_0x21d240=_0x419816[_0xf36a('0x35')];if(!_0x5838a9[_0xf36a('0x31')][_0xf36a('0x4f')]('nolimit')){_0x53231a['limit']=qs['limit'](_0x5838a9[_0xf36a('0x31')][_0xf36a('0x1c')]);_0x53231a[_0xf36a('0x1e')]=qs[_0xf36a('0x1e')](_0x5838a9[_0xf36a('0x31')][_0xf36a('0x1e')]);}return _0x4cb631[_0xf36a('0x4d')](_0x53231a);}})['then'](function(_0x1dc065){if(_0x1dc065){return _0x1dc065?{'count':_0x21d240,'rows':_0x1dc065}:null;}})[_0xf36a('0x25')](respondWithResult(_0x491944,null))['catch'](handleError(_0x491944,null));};exports['getDescriptions']=function(_0x394267,_0x56604f,_0x164724){var _0x22221f={};var _0x558db5={};var _0x380d1f;var _0x27790e;return db[_0xf36a('0x2d')][_0xf36a('0x4a')]({'where':{'id':_0x394267['params']['id']}})[_0xf36a('0x25')](handleEntityNotFound(_0x56604f,null))['then'](function(_0x198f69){if(_0x198f69){_0x380d1f=_0x198f69;_0x558db5[_0xf36a('0x30')]=_[_0xf36a('0x45')](db['ZohoField'][_0xf36a('0x4b')]);_0x558db5['query']=_[_0xf36a('0x45')](_0x394267[_0xf36a('0x31')]);_0x558db5[_0xf36a('0x3a')]=_[_0xf36a('0x32')](_0x558db5[_0xf36a('0x30')],_0x558db5[_0xf36a('0x31')]);_0x22221f['attributes']=_[_0xf36a('0x32')](_0x558db5['model'],qs[_0xf36a('0x34')](_0x394267[_0xf36a('0x31')][_0xf36a('0x34')]));_0x22221f[_0xf36a('0x33')]=_0x22221f['attributes']['length']?_0x22221f[_0xf36a('0x33')]:_0x558db5[_0xf36a('0x30')];_0x22221f[_0xf36a('0x37')]=qs[_0xf36a('0x38')](_0x394267[_0xf36a('0x31')][_0xf36a('0x38')]);_0x22221f['where']=qs[_0xf36a('0x3a')](_[_0xf36a('0x4c')](_0x394267[_0xf36a('0x31')],_0x558db5['filters']));if(_0x394267[_0xf36a('0x31')][_0xf36a('0x3b')]){_0x22221f[_0xf36a('0x39')]=_[_0xf36a('0x3c')](_0x22221f[_0xf36a('0x39')],{'$or':_[_0xf36a('0x2c')](_0x22221f[_0xf36a('0x33')],function(_0x196d72){var _0x154b77={};_0x154b77[_0x196d72]={'$like':'%'+_0x394267[_0xf36a('0x31')][_0xf36a('0x3b')]+'%'};return _0x154b77;})});}_0x22221f=_['merge']({},_0x22221f,_0x394267[_0xf36a('0x3e')]);return _0x380d1f['getDescriptions'](_0x22221f);}})[_0xf36a('0x25')](function(_0x4134c1){if(_0x4134c1){_0x27790e=_0x4134c1['length'];if(!_0x394267[_0xf36a('0x31')][_0xf36a('0x4f')](_0xf36a('0x36'))){_0x22221f[_0xf36a('0x1c')]=qs[_0xf36a('0x1c')](_0x394267[_0xf36a('0x31')]['limit']);_0x22221f[_0xf36a('0x1e')]=qs[_0xf36a('0x1e')](_0x394267[_0xf36a('0x31')]['offset']);}return _0x380d1f['getDescriptions'](_0x22221f);}})[_0xf36a('0x25')](function(_0x22d359){if(_0x22d359){return _0x22d359?{'count':_0x27790e,'rows':_0x22d359}:null;}})[_0xf36a('0x25')](respondWithResult(_0x56604f,null))['catch'](handleError(_0x56604f,null));}; \ No newline at end of file +var _0x6daa=['end','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','index','ZohoConfiguration','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','getFields','findOne','ZohoField','map','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x4c2f48,_0x3b5a02){var _0x113d48=function(_0x1a8587){while(--_0x1a8587){_0x4c2f48['push'](_0x4c2f48['shift']());}};_0x113d48(++_0x3b5a02);}(_0x6daa,0x127));var _0xa6da=function(_0x43c6fa,_0x2744f5){_0x43c6fa=_0x43c6fa-0x0;var _0x2f08d7=_0x6daa[_0x43c6fa];return _0x2f08d7;};'use strict';var emlformat=require(_0xa6da('0x0'));var rimraf=require(_0xa6da('0x1'));var zipdir=require(_0xa6da('0x2'));var jsonpatch=require(_0xa6da('0x3'));var rp=require(_0xa6da('0x4'));var moment=require(_0xa6da('0x5'));var BPromise=require(_0xa6da('0x6'));var Mustache=require(_0xa6da('0x7'));var util=require(_0xa6da('0x8'));var path=require(_0xa6da('0x9'));var sox=require('sox');var csv=require(_0xa6da('0xa'));var ejs=require(_0xa6da('0xb'));var fs=require('fs');var fs_extra=require(_0xa6da('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa6da('0xd'));var jsforce=require(_0xa6da('0xe'));var deskjs=require(_0xa6da('0xf'));var toCsv=require(_0xa6da('0xa'));var querystring=require(_0xa6da('0x10'));var Papa=require(_0xa6da('0x11'));var Redis=require('ioredis');var authService=require(_0xa6da('0x12'));var qs=require(_0xa6da('0x13'));var as=require(_0xa6da('0x14'));var hardwareService=require(_0xa6da('0x15'));var logger=require('../../config/logger')(_0xa6da('0x16'));var utils=require(_0xa6da('0x17'));var config=require(_0xa6da('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa8a117,_0x568b77){_0x568b77=_0x568b77||0xcc;return function(_0x5a2867){if(_0x5a2867){return _0xa8a117['sendStatus'](_0x568b77);}return _0xa8a117['status'](_0x568b77)[_0xa6da('0x19')]();};}function respondWithResult(_0x45b485,_0x5832b8){_0x5832b8=_0x5832b8||0xc8;return function(_0x10c519){if(_0x10c519){return _0x45b485[_0xa6da('0x1a')](_0x5832b8)[_0xa6da('0x1b')](_0x10c519);}};}function respondWithFilteredResult(_0xf8e39,_0x2fc496){return function(_0x36541c){if(_0x36541c){var _0x4592d5=typeof _0x2fc496[_0xa6da('0x1c')]===_0xa6da('0x1d')&&typeof _0x2fc496['limit']===_0xa6da('0x1d');var _0x386043=_0x36541c[_0xa6da('0x1e')];var _0x220576=_0x4592d5?0x0:_0x2fc496[_0xa6da('0x1c')];var _0x10de8c=_0x4592d5?_0x36541c[_0xa6da('0x1e')]:_0x2fc496[_0xa6da('0x1c')]+_0x2fc496[_0xa6da('0x1f')];var _0xff03b6;if(_0x10de8c>=_0x386043){_0x10de8c=_0x386043;_0xff03b6=0xc8;}else{_0xff03b6=0xce;}_0xf8e39['status'](_0xff03b6);return _0xf8e39['set'](_0xa6da('0x20'),_0x220576+'-'+_0x10de8c+'/'+_0x386043)[_0xa6da('0x1b')](_0x36541c);}return null;};}function patchUpdates(_0x509eb2){return function(_0x5cf0f5){try{jsonpatch[_0xa6da('0x21')](_0x5cf0f5,_0x509eb2,!![]);}catch(_0x39655c){return BPromise['reject'](_0x39655c);}return _0x5cf0f5[_0xa6da('0x22')]();};}function saveUpdates(_0x51d6d9,_0x30f4da){return function(_0x3f94a3){if(_0x3f94a3){return _0x3f94a3[_0xa6da('0x23')](_0x51d6d9)[_0xa6da('0x24')](function(_0x10def0){return _0x10def0;});}return null;};}function removeEntity(_0x363437,_0x403698){return function(_0x452ead){if(_0x452ead){return _0x452ead[_0xa6da('0x25')]()['then'](function(){_0x363437['status'](0xcc)[_0xa6da('0x19')]();});}};}function handleEntityNotFound(_0x380870,_0x10a62c){return function(_0x9fd5eb){if(!_0x9fd5eb){_0x380870[_0xa6da('0x26')](0x194);}return _0x9fd5eb;};}function handleError(_0x446737,_0x43b206){_0x43b206=_0x43b206||0x1f4;return function(_0x333634){logger[_0xa6da('0x27')](_0x333634[_0xa6da('0x28')]);if(_0x333634[_0xa6da('0x29')]){delete _0x333634['name'];}_0x446737[_0xa6da('0x1a')](_0x43b206)['send'](_0x333634);};}exports[_0xa6da('0x2a')]=function(_0x1003f5,_0x354ce2){var _0x24f048={},_0x7161e2={},_0x17b361={'count':0x0,'rows':[]};var _0x33b0f8=_['map'](db[_0xa6da('0x2b')]['rawAttributes'],function(_0x31e903){return{'name':_0x31e903['fieldName'],'type':_0x31e903['type'][_0xa6da('0x2c')]};});_0x7161e2[_0xa6da('0x2d')]=_['map'](_0x33b0f8,_0xa6da('0x29'));_0x7161e2[_0xa6da('0x2e')]=_[_0xa6da('0x2f')](_0x1003f5[_0xa6da('0x2e')]);_0x7161e2[_0xa6da('0x30')]=_[_0xa6da('0x31')](_0x7161e2[_0xa6da('0x2d')],_0x7161e2[_0xa6da('0x2e')]);_0x24f048[_0xa6da('0x32')]=_[_0xa6da('0x31')](_0x7161e2[_0xa6da('0x2d')],qs[_0xa6da('0x33')](_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x33')]));_0x24f048[_0xa6da('0x32')]=_0x24f048[_0xa6da('0x32')]['length']?_0x24f048['attributes']:_0x7161e2['model'];if(!_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x34')]('nolimit')){_0x24f048[_0xa6da('0x1f')]=qs[_0xa6da('0x1f')](_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x1f')]);_0x24f048[_0xa6da('0x1c')]=qs[_0xa6da('0x1c')](_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x1c')]);}_0x24f048[_0xa6da('0x35')]=qs[_0xa6da('0x36')](_0x1003f5['query']['sort']);_0x24f048[_0xa6da('0x37')]=qs['filters'](_[_0xa6da('0x38')](_0x1003f5[_0xa6da('0x2e')],_0x7161e2[_0xa6da('0x30')]),_0x33b0f8);if(_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x39')]){_0x24f048['where']=_['merge'](_0x24f048['where'],{'$or':_['map'](_0x33b0f8,function(_0x5e9f32){if(_0x5e9f32[_0xa6da('0x3a')]!==_0xa6da('0x3b')){var _0x2f6159={};_0x2f6159[_0x5e9f32[_0xa6da('0x29')]]={'$like':'%'+_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x39')]+'%'};return _0x2f6159;}})});}_0x24f048=_[_0xa6da('0x3c')]({},_0x24f048,_0x1003f5[_0xa6da('0x3d')]);var _0x494bfd={'where':_0x24f048[_0xa6da('0x37')]};return db[_0xa6da('0x2b')][_0xa6da('0x1e')](_0x494bfd)[_0xa6da('0x24')](function(_0x6e49c3){_0x17b361[_0xa6da('0x1e')]=_0x6e49c3;if(_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x3e')]){_0x24f048[_0xa6da('0x3f')]=[{'all':!![]}];}return db[_0xa6da('0x2b')][_0xa6da('0x40')](_0x24f048);})[_0xa6da('0x24')](function(_0x399a78){_0x17b361['rows']=_0x399a78;return _0x17b361;})[_0xa6da('0x24')](respondWithFilteredResult(_0x354ce2,_0x24f048))[_0xa6da('0x41')](handleError(_0x354ce2,null));};exports[_0xa6da('0x42')]=function(_0x21c8c7,_0x463256){var _0x39e64b={'raw':![],'where':{'id':_0x21c8c7[_0xa6da('0x43')]['id']}},_0x51219e={};_0x51219e[_0xa6da('0x2d')]=_[_0xa6da('0x2f')](db[_0xa6da('0x2b')][_0xa6da('0x44')]);_0x51219e[_0xa6da('0x2e')]=_[_0xa6da('0x2f')](_0x21c8c7['query']);_0x51219e['filters']=_[_0xa6da('0x31')](_0x51219e[_0xa6da('0x2d')],_0x51219e[_0xa6da('0x2e')]);_0x39e64b['attributes']=_[_0xa6da('0x31')](_0x51219e[_0xa6da('0x2d')],qs[_0xa6da('0x33')](_0x21c8c7[_0xa6da('0x2e')][_0xa6da('0x33')]));_0x39e64b[_0xa6da('0x32')]=_0x39e64b[_0xa6da('0x32')][_0xa6da('0x45')]?_0x39e64b[_0xa6da('0x32')]:_0x51219e[_0xa6da('0x2d')];if(_0x21c8c7[_0xa6da('0x2e')][_0xa6da('0x3e')]){_0x39e64b[_0xa6da('0x3f')]=[{'all':!![]}];}_0x39e64b=_[_0xa6da('0x3c')]({},_0x39e64b,_0x21c8c7[_0xa6da('0x3d')]);return db[_0xa6da('0x2b')][_0xa6da('0x46')](_0x39e64b)[_0xa6da('0x24')](handleEntityNotFound(_0x463256,null))['then'](respondWithResult(_0x463256,null))[_0xa6da('0x41')](handleError(_0x463256,null));};exports[_0xa6da('0x47')]=function(_0x2817e0,_0x5d36fb){return db['ZohoConfiguration'][_0xa6da('0x47')](_0x2817e0[_0xa6da('0x48')],{})[_0xa6da('0x24')](respondWithResult(_0x5d36fb,0xc9))[_0xa6da('0x41')](handleError(_0x5d36fb,null));};exports['update']=function(_0x1aade4,_0x20b86c){if(_0x1aade4['body']['id']){delete _0x1aade4[_0xa6da('0x48')]['id'];}return db['ZohoConfiguration'][_0xa6da('0x46')]({'where':{'id':_0x1aade4[_0xa6da('0x43')]['id']}})[_0xa6da('0x24')](handleEntityNotFound(_0x20b86c,null))[_0xa6da('0x24')](saveUpdates(_0x1aade4['body'],null))[_0xa6da('0x24')](respondWithResult(_0x20b86c,null))[_0xa6da('0x41')](handleError(_0x20b86c,null));};exports[_0xa6da('0x25')]=function(_0x4c8c0e,_0x3f163a){return db['ZohoConfiguration'][_0xa6da('0x46')]({'where':{'id':_0x4c8c0e['params']['id']}})[_0xa6da('0x24')](handleEntityNotFound(_0x3f163a,null))[_0xa6da('0x24')](removeEntity(_0x3f163a,null))[_0xa6da('0x41')](handleError(_0x3f163a,null));};exports[_0xa6da('0x49')]=function(_0x57bd45,_0x55e8dc,_0x3aa543){var _0x459b7e={};var _0x480c65={};var _0x361f4a;var _0x15fc7c;return db[_0xa6da('0x2b')][_0xa6da('0x4a')]({'where':{'id':_0x57bd45[_0xa6da('0x43')]['id']}})[_0xa6da('0x24')](handleEntityNotFound(_0x55e8dc,null))[_0xa6da('0x24')](function(_0x1bfc64){if(_0x1bfc64){_0x361f4a=_0x1bfc64;_0x480c65[_0xa6da('0x2d')]=_[_0xa6da('0x2f')](db[_0xa6da('0x4b')][_0xa6da('0x44')]);_0x480c65[_0xa6da('0x2e')]=_[_0xa6da('0x2f')](_0x57bd45[_0xa6da('0x2e')]);_0x480c65['filters']=_['intersection'](_0x480c65[_0xa6da('0x2d')],_0x480c65['query']);_0x459b7e[_0xa6da('0x32')]=_[_0xa6da('0x31')](_0x480c65[_0xa6da('0x2d')],qs[_0xa6da('0x33')](_0x57bd45[_0xa6da('0x2e')]['fields']));_0x459b7e[_0xa6da('0x32')]=_0x459b7e[_0xa6da('0x32')][_0xa6da('0x45')]?_0x459b7e[_0xa6da('0x32')]:_0x480c65[_0xa6da('0x2d')];_0x459b7e[_0xa6da('0x35')]=qs['sort'](_0x57bd45[_0xa6da('0x2e')][_0xa6da('0x36')]);_0x459b7e[_0xa6da('0x37')]=qs[_0xa6da('0x30')](_[_0xa6da('0x38')](_0x57bd45[_0xa6da('0x2e')],_0x480c65[_0xa6da('0x30')]));if(_0x57bd45[_0xa6da('0x2e')][_0xa6da('0x39')]){_0x459b7e[_0xa6da('0x37')]=_[_0xa6da('0x3c')](_0x459b7e[_0xa6da('0x37')],{'$or':_[_0xa6da('0x4c')](_0x459b7e[_0xa6da('0x32')],function(_0x5469f6){var _0x1512dc={};_0x1512dc[_0x5469f6]={'$like':'%'+_0x57bd45[_0xa6da('0x2e')][_0xa6da('0x39')]+'%'};return _0x1512dc;})});}_0x459b7e=_[_0xa6da('0x3c')]({},_0x459b7e,_0x57bd45['options']);return _0x361f4a[_0xa6da('0x49')](_0x459b7e);}})[_0xa6da('0x24')](function(_0x2b9e78){if(_0x2b9e78){_0x15fc7c=_0x2b9e78[_0xa6da('0x45')];if(!_0x57bd45['query'][_0xa6da('0x34')](_0xa6da('0x4d'))){_0x459b7e[_0xa6da('0x1f')]=qs[_0xa6da('0x1f')](_0x57bd45[_0xa6da('0x2e')][_0xa6da('0x1f')]);_0x459b7e['offset']=qs['offset'](_0x57bd45['query']['offset']);}return _0x361f4a[_0xa6da('0x49')](_0x459b7e);}})[_0xa6da('0x24')](function(_0x526749){if(_0x526749){return _0x526749?{'count':_0x15fc7c,'rows':_0x526749}:null;}})[_0xa6da('0x24')](respondWithResult(_0x55e8dc,null))[_0xa6da('0x41')](handleError(_0x55e8dc,null));};exports[_0xa6da('0x4e')]=function(_0x45507c,_0x3abd29,_0x4a842f){var _0x35e16f={};var _0x4a7a50={};var _0x1d6814;var _0x560be5;return db['ZohoConfiguration'][_0xa6da('0x4a')]({'where':{'id':_0x45507c[_0xa6da('0x43')]['id']}})[_0xa6da('0x24')](handleEntityNotFound(_0x3abd29,null))[_0xa6da('0x24')](function(_0x38ac1c){if(_0x38ac1c){_0x1d6814=_0x38ac1c;_0x4a7a50[_0xa6da('0x2d')]=_[_0xa6da('0x2f')](db['ZohoField'][_0xa6da('0x44')]);_0x4a7a50[_0xa6da('0x2e')]=_[_0xa6da('0x2f')](_0x45507c['query']);_0x4a7a50[_0xa6da('0x30')]=_[_0xa6da('0x31')](_0x4a7a50['model'],_0x4a7a50[_0xa6da('0x2e')]);_0x35e16f[_0xa6da('0x32')]=_['intersection'](_0x4a7a50[_0xa6da('0x2d')],qs[_0xa6da('0x33')](_0x45507c['query'][_0xa6da('0x33')]));_0x35e16f[_0xa6da('0x32')]=_0x35e16f[_0xa6da('0x32')]['length']?_0x35e16f[_0xa6da('0x32')]:_0x4a7a50[_0xa6da('0x2d')];_0x35e16f[_0xa6da('0x35')]=qs[_0xa6da('0x36')](_0x45507c[_0xa6da('0x2e')]['sort']);_0x35e16f['where']=qs['filters'](_['pick'](_0x45507c[_0xa6da('0x2e')],_0x4a7a50['filters']));if(_0x45507c[_0xa6da('0x2e')]['filter']){_0x35e16f[_0xa6da('0x37')]=_['merge'](_0x35e16f[_0xa6da('0x37')],{'$or':_[_0xa6da('0x4c')](_0x35e16f[_0xa6da('0x32')],function(_0x2233fe){var _0x4b4dc7={};_0x4b4dc7[_0x2233fe]={'$like':'%'+_0x45507c[_0xa6da('0x2e')][_0xa6da('0x39')]+'%'};return _0x4b4dc7;})});}_0x35e16f=_[_0xa6da('0x3c')]({},_0x35e16f,_0x45507c[_0xa6da('0x3d')]);return _0x1d6814[_0xa6da('0x4e')](_0x35e16f);}})[_0xa6da('0x24')](function(_0x2ec0df){if(_0x2ec0df){_0x560be5=_0x2ec0df[_0xa6da('0x45')];if(!_0x45507c['query'][_0xa6da('0x34')]('nolimit')){_0x35e16f[_0xa6da('0x1f')]=qs[_0xa6da('0x1f')](_0x45507c[_0xa6da('0x2e')][_0xa6da('0x1f')]);_0x35e16f[_0xa6da('0x1c')]=qs[_0xa6da('0x1c')](_0x45507c[_0xa6da('0x2e')]['offset']);}return _0x1d6814[_0xa6da('0x4e')](_0x35e16f);}})[_0xa6da('0x24')](function(_0x718893){if(_0x718893){return _0x718893?{'count':_0x560be5,'rows':_0x718893}:null;}})[_0xa6da('0x24')](respondWithResult(_0x3abd29,null))[_0xa6da('0x41')](handleError(_0x3abd29,null));};exports['getDescriptions']=function(_0x29dfbb,_0x1900cd,_0x41bc2d){var _0x14cbb8={};var _0x56f46e={};var _0x56b588;var _0x49b15b;return db[_0xa6da('0x2b')][_0xa6da('0x4a')]({'where':{'id':_0x29dfbb[_0xa6da('0x43')]['id']}})[_0xa6da('0x24')](handleEntityNotFound(_0x1900cd,null))[_0xa6da('0x24')](function(_0x5c2d71){if(_0x5c2d71){_0x56b588=_0x5c2d71;_0x56f46e['model']=_[_0xa6da('0x2f')](db['ZohoField'][_0xa6da('0x44')]);_0x56f46e[_0xa6da('0x2e')]=_[_0xa6da('0x2f')](_0x29dfbb[_0xa6da('0x2e')]);_0x56f46e[_0xa6da('0x30')]=_[_0xa6da('0x31')](_0x56f46e[_0xa6da('0x2d')],_0x56f46e[_0xa6da('0x2e')]);_0x14cbb8[_0xa6da('0x32')]=_[_0xa6da('0x31')](_0x56f46e[_0xa6da('0x2d')],qs[_0xa6da('0x33')](_0x29dfbb[_0xa6da('0x2e')]['fields']));_0x14cbb8['attributes']=_0x14cbb8[_0xa6da('0x32')][_0xa6da('0x45')]?_0x14cbb8[_0xa6da('0x32')]:_0x56f46e[_0xa6da('0x2d')];_0x14cbb8[_0xa6da('0x35')]=qs[_0xa6da('0x36')](_0x29dfbb[_0xa6da('0x2e')][_0xa6da('0x36')]);_0x14cbb8[_0xa6da('0x37')]=qs[_0xa6da('0x30')](_[_0xa6da('0x38')](_0x29dfbb[_0xa6da('0x2e')],_0x56f46e[_0xa6da('0x30')]));if(_0x29dfbb[_0xa6da('0x2e')]['filter']){_0x14cbb8[_0xa6da('0x37')]=_['merge'](_0x14cbb8['where'],{'$or':_[_0xa6da('0x4c')](_0x14cbb8[_0xa6da('0x32')],function(_0x2fb7cf){var _0x516722={};_0x516722[_0x2fb7cf]={'$like':'%'+_0x29dfbb[_0xa6da('0x2e')][_0xa6da('0x39')]+'%'};return _0x516722;})});}_0x14cbb8=_[_0xa6da('0x3c')]({},_0x14cbb8,_0x29dfbb[_0xa6da('0x3d')]);return _0x56b588[_0xa6da('0x4f')](_0x14cbb8);}})[_0xa6da('0x24')](function(_0x24570d){if(_0x24570d){_0x49b15b=_0x24570d[_0xa6da('0x45')];if(!_0x29dfbb['query']['hasOwnProperty'](_0xa6da('0x4d'))){_0x14cbb8[_0xa6da('0x1f')]=qs[_0xa6da('0x1f')](_0x29dfbb[_0xa6da('0x2e')][_0xa6da('0x1f')]);_0x14cbb8[_0xa6da('0x1c')]=qs[_0xa6da('0x1c')](_0x29dfbb['query'][_0xa6da('0x1c')]);}return _0x56b588[_0xa6da('0x4f')](_0x14cbb8);}})[_0xa6da('0x24')](function(_0x356582){if(_0x356582){return _0x356582?{'count':_0x49b15b,'rows':_0x356582}:null;}})[_0xa6da('0x24')](respondWithResult(_0x1900cd,null))[_0xa6da('0x41')](handleError(_0x1900cd,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ef2d027..bc55a4a 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 _0xc2ab=['bluebird','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment'];(function(_0x34d311,_0x180a16){var _0x2845bb=function(_0x2cd24f){while(--_0x2cd24f){_0x34d311['push'](_0x34d311['shift']());}};_0x2845bb(++_0x180a16);}(_0xc2ab,0x11a));var _0xbc2a=function(_0x11ead2,_0x70de8a){_0x11ead2=_0x11ead2-0x0;var _0x3cac96=_0xc2ab[_0x11ead2];return _0x3cac96;};'use strict';var _=require(_0xbc2a('0x0'));var util=require('util');var logger=require(_0xbc2a('0x1'))(_0xbc2a('0x2'));var moment=require(_0xbc2a('0x3'));var BPromise=require(_0xbc2a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc2a('0x5'));var config=require('../../config/environment');var attributes=require(_0xbc2a('0x6'));module[_0xbc2a('0x7')]=function(_0x34f3f2,_0x42fb3b){return _0x34f3f2[_0xbc2a('0x8')](_0xbc2a('0x9'),attributes,{'tableName':_0xbc2a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87ac=['int_zoho_configurations','api','bluebird','path','rimraf','exports','define','ZohoConfiguration'];(function(_0x382a02,_0x3f63b4){var _0x358d3e=function(_0x903485){while(--_0x903485){_0x382a02['push'](_0x382a02['shift']());}};_0x358d3e(++_0x3f63b4);}(_0x87ac,0x111));var _0xc87a=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x87ac[_0x1e3671];return _0x48d5f5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc87a('0x0'));var moment=require('moment');var BPromise=require(_0xc87a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc87a('0x2'));var rimraf=require(_0xc87a('0x3'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xc87a('0x4')]=function(_0x599d66,_0x19c5a8){return _0x599d66[_0xc87a('0x5')](_0xc87a('0x6'),attributes,{'tableName':_0xc87a('0x7'),'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 ded9202..5dc815b 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 _0x3d7b=['../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0x3d7b,0x8d));var _0xb3d7=function(_0x13dbe4,_0x215885){_0x13dbe4=_0x13dbe4-0x0;var _0x5c41e7=_0x3d7b[_0x13dbe4];return _0x5c41e7;};'use strict';var _=require('lodash');var util=require(_0xb3d7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb3d7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3d7('0x2'))['db'];var utils=require(_0xb3d7('0x3'));var logger=require(_0xb3d7('0x4'))(_0xb3d7('0x5'));var config=require(_0xb3d7('0x6'));var jayson=require(_0xb3d7('0x7'));var client=jayson[_0xb3d7('0x8')][_0xb3d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15d42f,_0x54f9ac,_0x53e7ac){return new BPromise(function(_0x5aeec1,_0x1b768c){return client[_0xb3d7('0xa')](_0x15d42f,_0x53e7ac)[_0xb3d7('0xb')](function(_0x25ae89){logger[_0xb3d7('0xc')](_0xb3d7('0xd'),_0x54f9ac,_0xb3d7('0xe'));logger[_0xb3d7('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x54f9ac,_0xb3d7('0xe'),JSON['stringify'](_0x25ae89));if(_0x25ae89['error']){if(_0x25ae89[_0xb3d7('0x10')][_0xb3d7('0x11')]===0x1f4){logger[_0xb3d7('0x10')](_0xb3d7('0xd'),_0x54f9ac,_0x25ae89['error']['message']);return _0x1b768c(_0x25ae89[_0xb3d7('0x10')][_0xb3d7('0x12')]);}logger[_0xb3d7('0x10')](_0xb3d7('0xd'),_0x54f9ac,_0x25ae89[_0xb3d7('0x10')][_0xb3d7('0x12')]);return _0x5aeec1(_0x25ae89[_0xb3d7('0x10')][_0xb3d7('0x12')]);}else{logger[_0xb3d7('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x54f9ac,_0xb3d7('0xe'));_0x5aeec1(_0x25ae89[_0xb3d7('0x13')][_0xb3d7('0x12')]);}})[_0xb3d7('0x14')](function(_0x14ebbb){logger[_0xb3d7('0x10')](_0xb3d7('0xd'),_0x54f9ac,_0x14ebbb);_0x1b768c(_0x14ebbb);});});} \ No newline at end of file +var _0x7432=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x4f7115,_0x50a7a1){var _0x50db79=function(_0x239b9d){while(--_0x239b9d){_0x4f7115['push'](_0x4f7115['shift']());}};_0x50db79(++_0x50a7a1);}(_0x7432,0xcb));var _0x2743=function(_0x19f9dd,_0x1e4737){_0x19f9dd=_0x19f9dd-0x0;var _0x50f85d=_0x7432[_0x19f9dd];return _0x50f85d;};'use strict';var _=require(_0x2743('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2743('0x1'));var rs=require(_0x2743('0x2'));var fs=require('fs');var Redis=require(_0x2743('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2743('0x4'));var logger=require(_0x2743('0x5'))(_0x2743('0x6'));var config=require('../../config/environment');var jayson=require(_0x2743('0x7'));var client=jayson[_0x2743('0x8')][_0x2743('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a29bb,_0x170f5b,_0x19f139){return new BPromise(function(_0x167225,_0x31a174){return client[_0x2743('0xa')](_0x2a29bb,_0x19f139)[_0x2743('0xb')](function(_0x183013){logger[_0x2743('0xc')](_0x2743('0xd'),_0x170f5b,_0x2743('0xe'));logger[_0x2743('0xf')](_0x2743('0x10'),_0x170f5b,_0x2743('0xe'),JSON[_0x2743('0x11')](_0x183013));if(_0x183013[_0x2743('0x12')]){if(_0x183013[_0x2743('0x12')][_0x2743('0x13')]===0x1f4){logger[_0x2743('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x170f5b,_0x183013['error'][_0x2743('0x14')]);return _0x31a174(_0x183013['error']['message']);}logger[_0x2743('0x12')](_0x2743('0xd'),_0x170f5b,_0x183013[_0x2743('0x12')][_0x2743('0x14')]);return _0x167225(_0x183013[_0x2743('0x12')]['message']);}else{logger[_0x2743('0xc')](_0x2743('0xd'),_0x170f5b,'request\x20sent');_0x167225(_0x183013[_0x2743('0x15')]['message']);}})[_0x2743('0x16')](function(_0x57b794){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x170f5b,_0x57b794);_0x31a174(_0x57b794);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 149e0c1..cd01154 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 _0x21e5=['index','show','put','/:id','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x32d1ae,_0x575e52){var _0x49cf0b=function(_0x7dc05c){while(--_0x7dc05c){_0x32d1ae['push'](_0x32d1ae['shift']());}};_0x49cf0b(++_0x575e52);}(_0x21e5,0x16f));var _0x521e=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x21e5[_0x18afca];return _0x11603f;};'use strict';var multer=require(_0x521e('0x0'));var util=require(_0x521e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x521e('0x2'));var router=express[_0x521e('0x3')]();var fs_extra=require(_0x521e('0x4'));var auth=require(_0x521e('0x5'));var interaction=require(_0x521e('0x6'));var config=require(_0x521e('0x7'));var controller=require(_0x521e('0x8'));router[_0x521e('0x9')]('/',auth[_0x521e('0xa')](),controller[_0x521e('0xb')]);router[_0x521e('0x9')]('/:id',auth[_0x521e('0xa')](),controller[_0x521e('0xc')]);router['post']('/',auth[_0x521e('0xa')](),controller['create']);router[_0x521e('0xd')](_0x521e('0xe'),auth[_0x521e('0xa')](),controller[_0x521e('0xf')]);router[_0x521e('0x10')]('/:id',auth[_0x521e('0xa')](),controller[_0x521e('0x11')]);module['exports']=router; \ No newline at end of file +var _0xeb96=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0xeb96,0xf9));var _0x6eb9=function(_0x459207,_0x524e2c){_0x459207=_0x459207-0x0;var _0x577220=_0xeb96[_0x459207];return _0x577220;};'use strict';var multer=require(_0x6eb9('0x0'));var util=require(_0x6eb9('0x1'));var path=require(_0x6eb9('0x2'));var timeout=require(_0x6eb9('0x3'));var express=require(_0x6eb9('0x4'));var router=express[_0x6eb9('0x5')]();var fs_extra=require(_0x6eb9('0x6'));var auth=require(_0x6eb9('0x7'));var interaction=require(_0x6eb9('0x8'));var config=require('../../config/environment');var controller=require(_0x6eb9('0x9'));router['get']('/',auth[_0x6eb9('0xa')](),controller[_0x6eb9('0xb')]);router[_0x6eb9('0xc')](_0x6eb9('0xd'),auth[_0x6eb9('0xa')](),controller['show']);router[_0x6eb9('0xe')]('/',auth[_0x6eb9('0xa')](),controller[_0x6eb9('0xf')]);router[_0x6eb9('0x10')](_0x6eb9('0xd'),auth['isAuthenticated'](),controller[_0x6eb9('0x11')]);router[_0x6eb9('0x12')](_0x6eb9('0xd'),auth[_0x6eb9('0xa')](),controller[_0x6eb9('0x13')]);module[_0x6eb9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a9c2130..33778ab 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 _0x76a6=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x2346ad,_0x522019){var _0x33beed=function(_0x1c400b){while(--_0x1c400b){_0x2346ad['push'](_0x2346ad['shift']());}};_0x33beed(++_0x522019);}(_0x76a6,0x18b));var _0x676a=function(_0x3ce301,_0x858468){_0x3ce301=_0x3ce301-0x0;var _0x323499=_0x76a6[_0x3ce301];return _0x323499;};'use strict';var Sequelize=require(_0x676a('0x0'));module[_0x676a('0x1')]={'type':{'type':Sequelize[_0x676a('0x2')](_0x676a('0x3'),_0x676a('0x4'),_0x676a('0x5'),'keyValue',_0x676a('0x6')),'defaultValue':_0x676a('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x676a('0x2')](_0x676a('0x3'),'variable',_0x676a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x676a('0x7')]},'nameField':{'type':Sequelize[_0x676a('0x7')]},'customField':{'type':Sequelize[_0x676a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x676a('0x7')]}}; \ No newline at end of file +var _0x437f=['customVariable','keyValue','picklist','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x426f00,_0x4f7131){var _0x324a41=function(_0x30060c){while(--_0x30060c){_0x426f00['push'](_0x426f00['shift']());}};_0x324a41(++_0x4f7131);}(_0x437f,0x150));var _0xf437=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x437f[_0x599e60];return _0x468e19;};'use strict';var Sequelize=require(_0xf437('0x0'));module[_0xf437('0x1')]={'type':{'type':Sequelize[_0xf437('0x2')]('string',_0xf437('0x3'),_0xf437('0x4'),_0xf437('0x5'),_0xf437('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf437('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xf437('0x8'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf437('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf437('0x7')]},'customField':{'type':Sequelize[_0xf437('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf437('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4196ec6..16ef40b 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 _0xc9d7=['limit','count','offset','set','Content-Range','apply','update','then','stack','name','index','map','ZohoField','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x324277,_0xa7681f){var _0x42965e=function(_0x5689e6){while(--_0x5689e6){_0x324277['push'](_0x324277['shift']());}};_0x42965e(++_0xa7681f);}(_0xc9d7,0x149));var _0x7c9d=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0xc9d7[_0xe15270];return _0x1e813b;};'use strict';var emlformat=require(_0x7c9d('0x0'));var rimraf=require(_0x7c9d('0x1'));var zipdir=require(_0x7c9d('0x2'));var jsonpatch=require(_0x7c9d('0x3'));var rp=require(_0x7c9d('0x4'));var moment=require(_0x7c9d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7c9d('0x6'));var util=require(_0x7c9d('0x7'));var path=require(_0x7c9d('0x8'));var sox=require(_0x7c9d('0x9'));var csv=require(_0x7c9d('0xa'));var ejs=require(_0x7c9d('0xb'));var fs=require('fs');var fs_extra=require(_0x7c9d('0xc'));var _=require(_0x7c9d('0xd'));var squel=require('squel');var crypto=require(_0x7c9d('0xe'));var jsforce=require(_0x7c9d('0xf'));var deskjs=require(_0x7c9d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7c9d('0x11'));var Redis=require(_0x7c9d('0x12'));var authService=require(_0x7c9d('0x13'));var qs=require(_0x7c9d('0x14'));var as=require(_0x7c9d('0x15'));var hardwareService=require(_0x7c9d('0x16'));var logger=require(_0x7c9d('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7c9d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c9d('0x19'))['db'];function respondWithStatusCode(_0x2bdd8a,_0x12711b){_0x12711b=_0x12711b||0xcc;return function(_0x3eee04){if(_0x3eee04){return _0x2bdd8a[_0x7c9d('0x1a')](_0x12711b);}return _0x2bdd8a[_0x7c9d('0x1b')](_0x12711b)[_0x7c9d('0x1c')]();};}function respondWithResult(_0x40b5a0,_0x1650a0){_0x1650a0=_0x1650a0||0xc8;return function(_0x3f4575){if(_0x3f4575){return _0x40b5a0['status'](_0x1650a0)[_0x7c9d('0x1d')](_0x3f4575);}};}function respondWithFilteredResult(_0x3a9d4f,_0x47b317){return function(_0x2e54b3){if(_0x2e54b3){var _0x5890d0=typeof _0x47b317['offset']===_0x7c9d('0x1e')&&typeof _0x47b317[_0x7c9d('0x1f')]===_0x7c9d('0x1e');var _0x27b810=_0x2e54b3[_0x7c9d('0x20')];var _0x15a71b=_0x5890d0?0x0:_0x47b317[_0x7c9d('0x21')];var _0x5eedeb=_0x5890d0?_0x2e54b3[_0x7c9d('0x20')]:_0x47b317['offset']+_0x47b317[_0x7c9d('0x1f')];var _0x3aecc4;if(_0x5eedeb>=_0x27b810){_0x5eedeb=_0x27b810;_0x3aecc4=0xc8;}else{_0x3aecc4=0xce;}_0x3a9d4f[_0x7c9d('0x1b')](_0x3aecc4);return _0x3a9d4f[_0x7c9d('0x22')](_0x7c9d('0x23'),_0x15a71b+'-'+_0x5eedeb+'/'+_0x27b810)[_0x7c9d('0x1d')](_0x2e54b3);}return null;};}function patchUpdates(_0x5033e9){return function(_0x5b03f8){try{jsonpatch[_0x7c9d('0x24')](_0x5b03f8,_0x5033e9,!![]);}catch(_0xa70fd8){return BPromise['reject'](_0xa70fd8);}return _0x5b03f8['save']();};}function saveUpdates(_0x6b838c,_0x2f67ad){return function(_0x27e628){if(_0x27e628){return _0x27e628[_0x7c9d('0x25')](_0x6b838c)[_0x7c9d('0x26')](function(_0x1bcf0a){return _0x1bcf0a;});}return null;};}function removeEntity(_0x1930bc,_0x25dae0){return function(_0x34b9f8){if(_0x34b9f8){return _0x34b9f8['destroy']()[_0x7c9d('0x26')](function(){_0x1930bc[_0x7c9d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422436,_0x585d77){return function(_0x33cf65){if(!_0x33cf65){_0x422436[_0x7c9d('0x1a')](0x194);}return _0x33cf65;};}function handleError(_0x2e465d,_0x3b92a4){_0x3b92a4=_0x3b92a4||0x1f4;return function(_0x4bf9d4){logger['error'](_0x4bf9d4[_0x7c9d('0x27')]);if(_0x4bf9d4[_0x7c9d('0x28')]){delete _0x4bf9d4[_0x7c9d('0x28')];}_0x2e465d[_0x7c9d('0x1b')](_0x3b92a4)['send'](_0x4bf9d4);};}exports[_0x7c9d('0x29')]=function(_0xd182fd,_0x3be5ab){var _0x39c59d={},_0xa59df4={},_0x4dd61f={'count':0x0,'rows':[]};var _0x271f94=_[_0x7c9d('0x2a')](db[_0x7c9d('0x2b')][_0x7c9d('0x2c')],function(_0x5c2342){return{'name':_0x5c2342['fieldName'],'type':_0x5c2342[_0x7c9d('0x2d')][_0x7c9d('0x2e')]};});_0xa59df4['model']=_[_0x7c9d('0x2a')](_0x271f94,_0x7c9d('0x28'));_0xa59df4[_0x7c9d('0x2f')]=_[_0x7c9d('0x30')](_0xd182fd[_0x7c9d('0x2f')]);_0xa59df4[_0x7c9d('0x31')]=_[_0x7c9d('0x32')](_0xa59df4[_0x7c9d('0x33')],_0xa59df4[_0x7c9d('0x2f')]);_0x39c59d[_0x7c9d('0x34')]=_['intersection'](_0xa59df4[_0x7c9d('0x33')],qs[_0x7c9d('0x35')](_0xd182fd['query'][_0x7c9d('0x35')]));_0x39c59d['attributes']=_0x39c59d['attributes'][_0x7c9d('0x36')]?_0x39c59d[_0x7c9d('0x34')]:_0xa59df4[_0x7c9d('0x33')];if(!_0xd182fd[_0x7c9d('0x2f')][_0x7c9d('0x37')]('nolimit')){_0x39c59d[_0x7c9d('0x1f')]=qs['limit'](_0xd182fd[_0x7c9d('0x2f')][_0x7c9d('0x1f')]);_0x39c59d[_0x7c9d('0x21')]=qs[_0x7c9d('0x21')](_0xd182fd[_0x7c9d('0x2f')]['offset']);}_0x39c59d['order']=qs[_0x7c9d('0x38')](_0xd182fd['query'][_0x7c9d('0x38')]);_0x39c59d['where']=qs[_0x7c9d('0x31')](_['pick'](_0xd182fd[_0x7c9d('0x2f')],_0xa59df4[_0x7c9d('0x31')]),_0x271f94);if(_0xd182fd[_0x7c9d('0x2f')][_0x7c9d('0x39')]){_0x39c59d['where']=_[_0x7c9d('0x3a')](_0x39c59d[_0x7c9d('0x3b')],{'$or':_[_0x7c9d('0x2a')](_0x271f94,function(_0x2b15b3){if(_0x2b15b3[_0x7c9d('0x2d')]!==_0x7c9d('0x3c')){var _0xe40305={};_0xe40305[_0x2b15b3[_0x7c9d('0x28')]]={'$like':'%'+_0xd182fd[_0x7c9d('0x2f')]['filter']+'%'};return _0xe40305;}})});}_0x39c59d=_[_0x7c9d('0x3a')]({},_0x39c59d,_0xd182fd[_0x7c9d('0x3d')]);var _0x2e42d2={'where':_0x39c59d['where']};return db[_0x7c9d('0x2b')][_0x7c9d('0x20')](_0x2e42d2)[_0x7c9d('0x26')](function(_0x4daa5e){_0x4dd61f['count']=_0x4daa5e;if(_0xd182fd['query'][_0x7c9d('0x3e')]){_0x39c59d[_0x7c9d('0x3f')]=[{'all':!![]}];}return db['ZohoField'][_0x7c9d('0x40')](_0x39c59d);})[_0x7c9d('0x26')](function(_0x270f7c){_0x4dd61f[_0x7c9d('0x41')]=_0x270f7c;return _0x4dd61f;})[_0x7c9d('0x26')](respondWithFilteredResult(_0x3be5ab,_0x39c59d))[_0x7c9d('0x42')](handleError(_0x3be5ab,null));};exports['show']=function(_0x518d3e,_0x5b8bff){var _0x39a5c8={'raw':!![],'where':{'id':_0x518d3e[_0x7c9d('0x43')]['id']}},_0x3fa8de={};_0x3fa8de[_0x7c9d('0x33')]=_['keys'](db[_0x7c9d('0x2b')][_0x7c9d('0x2c')]);_0x3fa8de[_0x7c9d('0x2f')]=_['keys'](_0x518d3e['query']);_0x3fa8de[_0x7c9d('0x31')]=_[_0x7c9d('0x32')](_0x3fa8de['model'],_0x3fa8de['query']);_0x39a5c8[_0x7c9d('0x34')]=_[_0x7c9d('0x32')](_0x3fa8de['model'],qs[_0x7c9d('0x35')](_0x518d3e[_0x7c9d('0x2f')]['fields']));_0x39a5c8['attributes']=_0x39a5c8['attributes'][_0x7c9d('0x36')]?_0x39a5c8[_0x7c9d('0x34')]:_0x3fa8de[_0x7c9d('0x33')];if(_0x518d3e['query'][_0x7c9d('0x3e')]){_0x39a5c8[_0x7c9d('0x3f')]=[{'all':!![]}];}_0x39a5c8=_[_0x7c9d('0x3a')]({},_0x39a5c8,_0x518d3e['options']);return db[_0x7c9d('0x2b')][_0x7c9d('0x44')](_0x39a5c8)['then'](handleEntityNotFound(_0x5b8bff,null))[_0x7c9d('0x26')](respondWithResult(_0x5b8bff,null))['catch'](handleError(_0x5b8bff,null));};exports[_0x7c9d('0x45')]=function(_0x2e9409,_0x18fd9d){return db[_0x7c9d('0x2b')][_0x7c9d('0x45')](_0x2e9409['body'],{})[_0x7c9d('0x26')](respondWithResult(_0x18fd9d,0xc9))[_0x7c9d('0x42')](handleError(_0x18fd9d,null));};exports[_0x7c9d('0x25')]=function(_0x57e628,_0x57717d){if(_0x57e628[_0x7c9d('0x46')]['id']){delete _0x57e628['body']['id'];}return db[_0x7c9d('0x2b')][_0x7c9d('0x44')]({'where':{'id':_0x57e628[_0x7c9d('0x43')]['id']}})[_0x7c9d('0x26')](handleEntityNotFound(_0x57717d,null))[_0x7c9d('0x26')](saveUpdates(_0x57e628['body'],null))['then'](respondWithResult(_0x57717d,null))['catch'](handleError(_0x57717d,null));};exports[_0x7c9d('0x47')]=function(_0x42450d,_0x2af384){return db[_0x7c9d('0x2b')][_0x7c9d('0x44')]({'where':{'id':_0x42450d[_0x7c9d('0x43')]['id']}})[_0x7c9d('0x26')](handleEntityNotFound(_0x2af384,null))[_0x7c9d('0x26')](removeEntity(_0x2af384,null))[_0x7c9d('0x42')](handleError(_0x2af384,null));}; \ No newline at end of file +var _0x93f4=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','type','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x56ee8c,_0xa57d1b){var _0x4a30e6=function(_0xfe2bd1){while(--_0xfe2bd1){_0x56ee8c['push'](_0x56ee8c['shift']());}};_0x4a30e6(++_0xa57d1b);}(_0x93f4,0x124));var _0x493f=function(_0x44c9b6,_0x54f1ed){_0x44c9b6=_0x44c9b6-0x0;var _0x33901c=_0x93f4[_0x44c9b6];return _0x33901c;};'use strict';var emlformat=require(_0x493f('0x0'));var rimraf=require(_0x493f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x493f('0x2'));var rp=require('request-promise');var moment=require(_0x493f('0x3'));var BPromise=require(_0x493f('0x4'));var Mustache=require(_0x493f('0x5'));var util=require(_0x493f('0x6'));var path=require(_0x493f('0x7'));var sox=require(_0x493f('0x8'));var csv=require(_0x493f('0x9'));var ejs=require(_0x493f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x493f('0xb'));var squel=require(_0x493f('0xc'));var crypto=require(_0x493f('0xd'));var jsforce=require(_0x493f('0xe'));var deskjs=require(_0x493f('0xf'));var toCsv=require(_0x493f('0x9'));var querystring=require(_0x493f('0x10'));var Papa=require(_0x493f('0x11'));var Redis=require(_0x493f('0x12'));var authService=require(_0x493f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x493f('0x14'));var hardwareService=require(_0x493f('0x15'));var logger=require('../../config/logger')(_0x493f('0x16'));var utils=require(_0x493f('0x17'));var config=require(_0x493f('0x18'));var licenseUtil=require(_0x493f('0x19'));var db=require(_0x493f('0x1a'))['db'];function respondWithStatusCode(_0x643216,_0x240def){_0x240def=_0x240def||0xcc;return function(_0x4bdc5e){if(_0x4bdc5e){return _0x643216[_0x493f('0x1b')](_0x240def);}return _0x643216[_0x493f('0x1c')](_0x240def)['end']();};}function respondWithResult(_0x11f542,_0x4204f3){_0x4204f3=_0x4204f3||0xc8;return function(_0x2e83df){if(_0x2e83df){return _0x11f542[_0x493f('0x1c')](_0x4204f3)[_0x493f('0x1d')](_0x2e83df);}};}function respondWithFilteredResult(_0x475e42,_0x3cf780){return function(_0x13884f){if(_0x13884f){var _0x408fe1=typeof _0x3cf780[_0x493f('0x1e')]===_0x493f('0x1f')&&typeof _0x3cf780[_0x493f('0x20')]==='undefined';var _0x47d837=_0x13884f[_0x493f('0x21')];var _0x208568=_0x408fe1?0x0:_0x3cf780[_0x493f('0x1e')];var _0x276eaf=_0x408fe1?_0x13884f['count']:_0x3cf780['offset']+_0x3cf780[_0x493f('0x20')];var _0x553ec4;if(_0x276eaf>=_0x47d837){_0x276eaf=_0x47d837;_0x553ec4=0xc8;}else{_0x553ec4=0xce;}_0x475e42[_0x493f('0x1c')](_0x553ec4);return _0x475e42[_0x493f('0x22')](_0x493f('0x23'),_0x208568+'-'+_0x276eaf+'/'+_0x47d837)[_0x493f('0x1d')](_0x13884f);}return null;};}function patchUpdates(_0x539b40){return function(_0x4556bb){try{jsonpatch[_0x493f('0x24')](_0x4556bb,_0x539b40,!![]);}catch(_0x1913ef){return BPromise[_0x493f('0x25')](_0x1913ef);}return _0x4556bb[_0x493f('0x26')]();};}function saveUpdates(_0x5a3cb6,_0x5d3782){return function(_0x43830c){if(_0x43830c){return _0x43830c[_0x493f('0x27')](_0x5a3cb6)[_0x493f('0x28')](function(_0x590125){return _0x590125;});}return null;};}function removeEntity(_0x1df625,_0x404d47){return function(_0x3eb068){if(_0x3eb068){return _0x3eb068[_0x493f('0x29')]()[_0x493f('0x28')](function(){_0x1df625[_0x493f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eb381,_0x3cb687){return function(_0x2b7108){if(!_0x2b7108){_0x3eb381[_0x493f('0x1b')](0x194);}return _0x2b7108;};}function handleError(_0x3d1948,_0x1bf593){_0x1bf593=_0x1bf593||0x1f4;return function(_0x5066a9){logger[_0x493f('0x2a')](_0x5066a9['stack']);if(_0x5066a9[_0x493f('0x2b')]){delete _0x5066a9[_0x493f('0x2b')];}_0x3d1948[_0x493f('0x1c')](_0x1bf593)[_0x493f('0x2c')](_0x5066a9);};}exports[_0x493f('0x2d')]=function(_0xc552c,_0x24681b){var _0x1dfa3e={},_0x352d99={},_0x445fd0={'count':0x0,'rows':[]};var _0x649ace=_['map'](db['ZohoField']['rawAttributes'],function(_0x15e5c2){return{'name':_0x15e5c2['fieldName'],'type':_0x15e5c2[_0x493f('0x2e')]['key']};});_0x352d99[_0x493f('0x2f')]=_[_0x493f('0x30')](_0x649ace,'name');_0x352d99['query']=_[_0x493f('0x31')](_0xc552c[_0x493f('0x32')]);_0x352d99[_0x493f('0x33')]=_['intersection'](_0x352d99[_0x493f('0x2f')],_0x352d99[_0x493f('0x32')]);_0x1dfa3e['attributes']=_[_0x493f('0x34')](_0x352d99['model'],qs[_0x493f('0x35')](_0xc552c['query'][_0x493f('0x35')]));_0x1dfa3e['attributes']=_0x1dfa3e[_0x493f('0x36')]['length']?_0x1dfa3e['attributes']:_0x352d99['model'];if(!_0xc552c[_0x493f('0x32')][_0x493f('0x37')]('nolimit')){_0x1dfa3e[_0x493f('0x20')]=qs[_0x493f('0x20')](_0xc552c[_0x493f('0x32')][_0x493f('0x20')]);_0x1dfa3e[_0x493f('0x1e')]=qs['offset'](_0xc552c[_0x493f('0x32')][_0x493f('0x1e')]);}_0x1dfa3e[_0x493f('0x38')]=qs[_0x493f('0x39')](_0xc552c[_0x493f('0x32')]['sort']);_0x1dfa3e[_0x493f('0x3a')]=qs['filters'](_[_0x493f('0x3b')](_0xc552c[_0x493f('0x32')],_0x352d99[_0x493f('0x33')]),_0x649ace);if(_0xc552c['query'][_0x493f('0x3c')]){_0x1dfa3e[_0x493f('0x3a')]=_[_0x493f('0x3d')](_0x1dfa3e['where'],{'$or':_[_0x493f('0x30')](_0x649ace,function(_0x5e14fd){if(_0x5e14fd[_0x493f('0x2e')]!==_0x493f('0x3e')){var _0x130d75={};_0x130d75[_0x5e14fd[_0x493f('0x2b')]]={'$like':'%'+_0xc552c[_0x493f('0x32')]['filter']+'%'};return _0x130d75;}})});}_0x1dfa3e=_['merge']({},_0x1dfa3e,_0xc552c[_0x493f('0x3f')]);var _0x432b8b={'where':_0x1dfa3e['where']};return db[_0x493f('0x40')]['count'](_0x432b8b)['then'](function(_0x5c332c){_0x445fd0[_0x493f('0x21')]=_0x5c332c;if(_0xc552c[_0x493f('0x32')][_0x493f('0x41')]){_0x1dfa3e[_0x493f('0x42')]=[{'all':!![]}];}return db['ZohoField'][_0x493f('0x43')](_0x1dfa3e);})['then'](function(_0x18594b){_0x445fd0[_0x493f('0x44')]=_0x18594b;return _0x445fd0;})['then'](respondWithFilteredResult(_0x24681b,_0x1dfa3e))[_0x493f('0x45')](handleError(_0x24681b,null));};exports[_0x493f('0x46')]=function(_0xa7f670,_0x43aa73){var _0x1b3342={'raw':!![],'where':{'id':_0xa7f670[_0x493f('0x47')]['id']}},_0x658054={};_0x658054[_0x493f('0x2f')]=_[_0x493f('0x31')](db[_0x493f('0x40')][_0x493f('0x48')]);_0x658054['query']=_[_0x493f('0x31')](_0xa7f670[_0x493f('0x32')]);_0x658054[_0x493f('0x33')]=_[_0x493f('0x34')](_0x658054['model'],_0x658054['query']);_0x1b3342['attributes']=_[_0x493f('0x34')](_0x658054[_0x493f('0x2f')],qs[_0x493f('0x35')](_0xa7f670['query']['fields']));_0x1b3342[_0x493f('0x36')]=_0x1b3342['attributes'][_0x493f('0x49')]?_0x1b3342[_0x493f('0x36')]:_0x658054['model'];if(_0xa7f670[_0x493f('0x32')][_0x493f('0x41')]){_0x1b3342['include']=[{'all':!![]}];}_0x1b3342=_[_0x493f('0x3d')]({},_0x1b3342,_0xa7f670[_0x493f('0x3f')]);return db[_0x493f('0x40')][_0x493f('0x4a')](_0x1b3342)['then'](handleEntityNotFound(_0x43aa73,null))[_0x493f('0x28')](respondWithResult(_0x43aa73,null))[_0x493f('0x45')](handleError(_0x43aa73,null));};exports[_0x493f('0x4b')]=function(_0x6ecd1f,_0x1fcac5){return db[_0x493f('0x40')]['create'](_0x6ecd1f[_0x493f('0x4c')],{})[_0x493f('0x28')](respondWithResult(_0x1fcac5,0xc9))[_0x493f('0x45')](handleError(_0x1fcac5,null));};exports[_0x493f('0x27')]=function(_0x5da7cf,_0x49eef6){if(_0x5da7cf['body']['id']){delete _0x5da7cf['body']['id'];}return db[_0x493f('0x40')][_0x493f('0x4a')]({'where':{'id':_0x5da7cf[_0x493f('0x47')]['id']}})[_0x493f('0x28')](handleEntityNotFound(_0x49eef6,null))[_0x493f('0x28')](saveUpdates(_0x5da7cf[_0x493f('0x4c')],null))[_0x493f('0x28')](respondWithResult(_0x49eef6,null))[_0x493f('0x45')](handleError(_0x49eef6,null));};exports[_0x493f('0x29')]=function(_0x48daa3,_0xd677a9){return db['ZohoField'][_0x493f('0x4a')]({'where':{'id':_0x48daa3[_0x493f('0x47')]['id']}})[_0x493f('0x28')](handleEntityNotFound(_0xd677a9,null))['then'](removeEntity(_0xd677a9,null))[_0x493f('0x45')](handleError(_0xd677a9,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index c1ed641..3cd7e29 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 _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId'];(function(_0x295e87,_0xaff0b7){var _0xe4eed7=function(_0x18bc75){while(--_0x18bc75){_0x295e87['push'](_0x295e87['shift']());}};_0xe4eed7(++_0xaff0b7);}(_0x5fab,0x177));var _0xb5fa=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x5fab[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['idField',_0xb5fa('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/environment','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xa38cf2,_0x13e769){var _0x1c9a57=function(_0x3fdbd5){while(--_0x3fdbd5){_0xa38cf2['push'](_0xa38cf2['shift']());}};_0x1c9a57(++_0x13e769);}(_0xdb28,0x106));var _0x8db2=function(_0x2d5e3f,_0x4c27e0){_0x2d5e3f=_0x2d5e3f-0x0;var _0x5bf682=_0xdb28[_0x2d5e3f];return _0x5bf682;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./intZohoField.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'name':_0x8db2('0xc'),'fields':[_0x8db2('0xd'),_0x8db2('0xe')],'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 7bc38eb..3fd9efe 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 _0x3b11=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird'];(function(_0x1b17ed,_0x3a621f){var _0x12a2bd=function(_0x1e7316){while(--_0x1e7316){_0x1b17ed['push'](_0x1b17ed['shift']());}};_0x12a2bd(++_0x3a621f);}(_0x3b11,0xee));var _0x13b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b11[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x13b1('0x0'));var moment=require('moment');var BPromise=require(_0x13b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13b1('0x2'));var db=require(_0x13b1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x13b1('0x4'))('rpc');var config=require(_0x13b1('0x5'));var jayson=require(_0x13b1('0x6'));var client=jayson[_0x13b1('0x7')][_0x13b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29aed1,_0x21d1a6,_0x3e6ed6){return new BPromise(function(_0x2e9fb8,_0x222470){return client[_0x13b1('0x9')](_0x29aed1,_0x3e6ed6)[_0x13b1('0xa')](function(_0x1b0577){logger[_0x13b1('0xb')](_0x13b1('0xc'),_0x21d1a6,_0x13b1('0xd'));logger['debug'](_0x13b1('0xe'),_0x21d1a6,_0x13b1('0xd'),JSON[_0x13b1('0xf')](_0x1b0577));if(_0x1b0577[_0x13b1('0x10')]){if(_0x1b0577['error'][_0x13b1('0x11')]===0x1f4){logger[_0x13b1('0x10')](_0x13b1('0xc'),_0x21d1a6,_0x1b0577[_0x13b1('0x10')]['message']);return _0x222470(_0x1b0577[_0x13b1('0x10')][_0x13b1('0x12')]);}logger[_0x13b1('0x10')](_0x13b1('0xc'),_0x21d1a6,_0x1b0577[_0x13b1('0x10')][_0x13b1('0x12')]);return _0x2e9fb8(_0x1b0577[_0x13b1('0x10')]['message']);}else{logger[_0x13b1('0xb')](_0x13b1('0xc'),_0x21d1a6,_0x13b1('0xd'));_0x2e9fb8(_0x1b0577['result'][_0x13b1('0x12')]);}})[_0x13b1('0x13')](function(_0x3d94e3){logger['error'](_0x13b1('0xc'),_0x21d1a6,_0x3d94e3);_0x222470(_0x3d94e3);});});} \ No newline at end of file +var _0xce74=['stringify','error','code','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x5c9c31,_0x1885ed){var _0xbfcbd8=function(_0x34e04c){while(--_0x34e04c){_0x5c9c31['push'](_0x5c9c31['shift']());}};_0xbfcbd8(++_0x1885ed);}(_0xce74,0x1a9));var _0x4ce7=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xce74[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x4ce7('0x0'));var util=require('util');var moment=require(_0x4ce7('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ce7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce7('0x3'))['db'];var utils=require(_0x4ce7('0x4'));var logger=require('../../config/logger')(_0x4ce7('0x5'));var config=require(_0x4ce7('0x6'));var jayson=require(_0x4ce7('0x7'));var client=jayson[_0x4ce7('0x8')][_0x4ce7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34d9a5,_0x55b87e,_0xc32e8){return new BPromise(function(_0x537deb,_0x1ea873){return client[_0x4ce7('0xa')](_0x34d9a5,_0xc32e8)[_0x4ce7('0xb')](function(_0x4fb530){logger[_0x4ce7('0xc')](_0x4ce7('0xd'),_0x55b87e,_0x4ce7('0xe'));logger['debug'](_0x4ce7('0xf'),_0x55b87e,_0x4ce7('0xe'),JSON[_0x4ce7('0x10')](_0x4fb530));if(_0x4fb530[_0x4ce7('0x11')]){if(_0x4fb530[_0x4ce7('0x11')][_0x4ce7('0x12')]===0x1f4){logger[_0x4ce7('0x11')]('ZohoField,\x20%s,\x20%s',_0x55b87e,_0x4fb530[_0x4ce7('0x11')]['message']);return _0x1ea873(_0x4fb530[_0x4ce7('0x11')][_0x4ce7('0x13')]);}logger['error'](_0x4ce7('0xd'),_0x55b87e,_0x4fb530[_0x4ce7('0x11')]['message']);return _0x537deb(_0x4fb530[_0x4ce7('0x11')]['message']);}else{logger[_0x4ce7('0xc')](_0x4ce7('0xd'),_0x55b87e,_0x4ce7('0xe'));_0x537deb(_0x4fb530[_0x4ce7('0x14')][_0x4ce7('0x13')]);}})['catch'](function(_0x188946){logger['error'](_0x4ce7('0xd'),_0x55b87e,_0x188946);_0x1ea873(_0x188946);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 766fa06..d31dc56 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5e295c,_0x4a2c73){var _0x5899aa=function(_0x25fecf){while(--_0x25fecf){_0x5e295c['push'](_0x5e295c['shift']());}};_0x5899aa(++_0x4a2c73);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5f176a,_0x4138b6){var _0x2e9757=function(_0x2428c4){while(--_0x2428c4){_0x5f176a['push'](_0x5f176a['shift']());}};_0x2e9757(++_0x4138b6);}(_0xe706,0xa3));var _0x6e70=function(_0x5c0368,_0x423cf2){_0x5c0368=_0x5c0368-0x0;var _0x5b31b9=_0xe706[_0x5c0368];return _0x5b31b9;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5b1bae5..5069cc2 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 _0x7799=['BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x265d28,_0xe1504f){var _0x526bc8=function(_0x1aa4e4){while(--_0x1aa4e4){_0x265d28['push'](_0x265d28['shift']());}};_0x526bc8(++_0xe1504f);}(_0x7799,0xbc));var _0x9779=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0x7799[_0x241424];return _0x3da798;};'use strict';var Sequelize=require(_0x9779('0x0'));module['exports']={'name':{'type':Sequelize[_0x9779('0x1')],'allowNull':![],'unique':_0x9779('0x2')},'version':{'type':Sequelize[_0x9779('0x1')],'allowNull':![],'unique':_0x9779('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x9779('0x3')},'filename':{'type':Sequelize[_0x9779('0x1')]},'path':{'type':Sequelize[_0x9779('0x1')]},'type':{'type':Sequelize[_0x9779('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x9779('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x9779('0x5')},'description':{'type':Sequelize[_0x9779('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9779('0x1')]},'link':{'type':Sequelize[_0x9779('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x95c7=['app.js','INTEGER','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x24765c,_0x5e3421){var _0x7de795=function(_0xbb23d8){while(--_0xbb23d8){_0x24765c['push'](_0x24765c['shift']());}};_0x7de795(++_0x5e3421);}(_0x95c7,0x1a7));var _0x795c=function(_0x4219e8,_0x5b47d0){_0x4219e8=_0x4219e8-0x0;var _0x48cfef=_0x95c7[_0x4219e8];return _0x48cfef;};'use strict';var Sequelize=require(_0x795c('0x0'));module[_0x795c('0x1')]={'name':{'type':Sequelize[_0x795c('0x2')],'allowNull':![],'unique':_0x795c('0x3')},'version':{'type':Sequelize[_0x795c('0x2')],'allowNull':![],'unique':_0x795c('0x3')},'main':{'type':Sequelize[_0x795c('0x2')],'defaultValue':_0x795c('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x795c('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x795c('0x2')]},'logo':{'type':Sequelize[_0x795c('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x795c('0x6')},'description':{'type':Sequelize[_0x795c('0x2')]},'title':{'type':Sequelize[_0x795c('0x2')]},'remoteUri':{'type':Sequelize[_0x795c('0x2')]},'link':{'type':Sequelize[_0x795c('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 68175ae..41ed776 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 _0xe3da=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x56eb1e,_0x4f021e){var _0x487587=function(_0x4099fb){while(--_0x4099fb){_0x56eb1e['push'](_0x56eb1e['shift']());}};_0x487587(++_0x4f021e);}(_0xe3da,0x1cd));var _0xae3d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe3da[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21e408,_0x51cd13){_0x21e408=_0x21e408-0x0;var _0x336606=_0x5f2f[_0x21e408];return _0x336606;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6b9d5be..4ec28f3 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 _0x0fc8=['define','Integration','integrations','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./integration.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0fc8,0x1c6));var _0x80fc=function(_0x39decf,_0x10e88e){_0x39decf=_0x39decf-0x0;var _0x530b33=_0x0fc8[_0x39decf];return _0x530b33;};'use strict';var _=require(_0x80fc('0x0'));var util=require(_0x80fc('0x1'));var logger=require(_0x80fc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x80fc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80fc('0x4'));var rimraf=require(_0x80fc('0x5'));var config=require(_0x80fc('0x6'));var attributes=require(_0x80fc('0x7'));module['exports']=function(_0x499761,_0x47b970){return _0x499761[_0x80fc('0x8')](_0x80fc('0x9'),attributes,{'tableName':_0x80fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd219=['lodash','../../config/logger','api','bluebird','request-promise','path','./integration.attributes','exports','define','integrations'];(function(_0x281d22,_0x7d58e1){var _0x38279e=function(_0x1db6ab){while(--_0x1db6ab){_0x281d22['push'](_0x281d22['shift']());}};_0x38279e(++_0x7d58e1);}(_0xd219,0xa0));var _0x9d21=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xd219[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x9d21('0x0'));var util=require('util');var logger=require(_0x9d21('0x1'))(_0x9d21('0x2'));var moment=require('moment');var BPromise=require(_0x9d21('0x3'));var rp=require(_0x9d21('0x4'));var fs=require('fs');var path=require(_0x9d21('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d21('0x6'));module[_0x9d21('0x7')]=function(_0x813bd7,_0x4b369c){return _0x813bd7[_0x9d21('0x8')]('Integration',attributes,{'tableName':_0x9d21('0x9'),'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 53f8f2e..6d1b0d4 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 _0x955f=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x289bd5,_0x2f5f5f){var _0x3f28d7=function(_0x54414d){while(--_0x54414d){_0x289bd5['push'](_0x289bd5['shift']());}};_0x3f28d7(++_0x2f5f5f);}(_0x955f,0x1eb));var _0xf955=function(_0x19d835,_0xd3a0b){_0x19d835=_0x19d835-0x0;var _0x329475=_0x955f[_0x19d835];return _0x329475;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('Integration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x52b1eb,_0x5d09a4){var _0x102d00=function(_0x259ad4){while(--_0x259ad4){_0x52b1eb['push'](_0x52b1eb['shift']());}};_0x102d00(++_0x5d09a4);}(_0x0295,0x1f0));var _0x5029=function(_0x129534,_0x560a44){_0x129534=_0x129534-0x0;var _0x430eb4=_0x0295[_0x129534];return _0x430eb4;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('Integration,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 11006d9..7ddeb0f 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x40f7e3,_0x5d2c41){var _0x146e15=function(_0x3ef90e){while(--_0x3ef90e){_0x40f7e3['push'](_0x40f7e3['shift']());}};_0x146e15(++_0x5d2c41);}(_0x187d,0x93));var _0xd187=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x187d[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x432c02,_0x5c0a28){var _0x1a4544=function(_0x496d6b){while(--_0x496d6b){_0x432c02['push'](_0x432c02['shift']());}};_0x1a4544(++_0x5c0a28);}(_0x4975,0x86));var _0x5497=function(_0x3011a4,_0x41eac6){_0x3011a4=_0x3011a4-0x0;var _0x3847bd=_0x4975[_0x3011a4];return _0x3847bd;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index c230f0b..1783286 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 _0x4acd=['SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','SENT'];(function(_0xb1ac47,_0x643ac1){var _0x2d964d=function(_0x1b6188){while(--_0x1b6188){_0xb1ac47['push'](_0xb1ac47['shift']());}};_0x2d964d(++_0x643ac1);}(_0x4acd,0x18f));var _0xd4ac=function(_0x30a528,_0x1d04f2){_0x30a528=_0x30a528-0x0;var _0x3e029c=_0x4acd[_0x30a528];return _0x3e029c;};'use strict';var Sequelize=require(_0xd4ac('0x0'));module[_0xd4ac('0x1')]={'integration':{'type':Sequelize[_0xd4ac('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xd4ac('0x2')]},'uniqueid':{'type':Sequelize[_0xd4ac('0x2')]},'calleridnum':{'type':Sequelize[_0xd4ac('0x2')]},'calleridname':{'type':Sequelize[_0xd4ac('0x2')]},'queue':{'type':Sequelize[_0xd4ac('0x2')]},'interface':{'type':Sequelize[_0xd4ac('0x2')]},'membername':{'type':Sequelize[_0xd4ac('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd4ac('0x3')]},'holdtime':{'type':Sequelize[_0xd4ac('0x4')]},'agentcomplete':{'type':Sequelize[_0xd4ac('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd4ac('0x3')]},'talktime':{'type':Sequelize[_0xd4ac('0x4')]},'agentacw':{'type':Sequelize[_0xd4ac('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd4ac('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xd4ac('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd4ac('0x3')]},'agentdump':{'type':Sequelize[_0xd4ac('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd4ac('0x3')]},'lastevent':{'type':Sequelize[_0xd4ac('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd4ac('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd4ac('0x2')]},'accountcode':{'type':Sequelize[_0xd4ac('0x2')]},'context':{'type':Sequelize[_0xd4ac('0x2')]},'exten':{'type':Sequelize[_0xd4ac('0x2')]},'priority':{'type':Sequelize[_0xd4ac('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd4ac('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd4ac('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd4ac('0x2')]},'destcalleridname':{'type':Sequelize[_0xd4ac('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd4ac('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd4ac('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd4ac('0x2')]},'destcontext':{'type':Sequelize[_0xd4ac('0x2')]},'destexten':{'type':Sequelize[_0xd4ac('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd4ac('0x2')]},'messageId':{'type':Sequelize[_0xd4ac('0x2')]},'inReplyTo':{'type':Sequelize[_0xd4ac('0x2')]},'subject':{'type':Sequelize[_0xd4ac('0x2')]},'from':{'type':Sequelize[_0xd4ac('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd4ac('0x2')]},'attachment':{'type':Sequelize[_0xd4ac('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0xd4ac('0x7'),_0xd4ac('0x8'),_0xd4ac('0x9'),_0xd4ac('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xd4ac('0x2')]},'projectId':{'type':Sequelize[_0xd4ac('0x4')]}}; \ No newline at end of file +var _0xeb57=['BOOLEAN','DATE','TEXT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0xeb57,0x178));var _0x7eb5=function(_0x3efba9,_0x4c39c4){_0x3efba9=_0x3efba9-0x0;var _0x1bb06e=_0xeb57[_0x3efba9];return _0x1bb06e;};'use strict';var Sequelize=require(_0x7eb5('0x0'));module[_0x7eb5('0x1')]={'integration':{'type':Sequelize[_0x7eb5('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x7eb5('0x2')]},'ticketId':{'type':Sequelize[_0x7eb5('0x2')]},'integrationId':{'type':Sequelize[_0x7eb5('0x3')]},'contacts':{'type':Sequelize[_0x7eb5('0x2')]},'uniqueid':{'type':Sequelize[_0x7eb5('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7eb5('0x2')]},'queue':{'type':Sequelize[_0x7eb5('0x2')]},'interface':{'type':Sequelize[_0x7eb5('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7eb5('0x3')]},'agentcomplete':{'type':Sequelize[_0x7eb5('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x7eb5('0x3')]},'agentacw':{'type':Sequelize[_0x7eb5('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7eb5('0x3')]},'reason':{'type':Sequelize[_0x7eb5('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7eb5('0x5')]},'agentdump':{'type':Sequelize[_0x7eb5('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7eb5('0x5')]},'lastevent':{'type':Sequelize[_0x7eb5('0x2')]},'channel':{'type':Sequelize[_0x7eb5('0x2')]},'channelstate':{'type':Sequelize[_0x7eb5('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x7eb5('0x2')]},'connectedlinename':{'type':Sequelize[_0x7eb5('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7eb5('0x2')]},'exten':{'type':Sequelize[_0x7eb5('0x2')]},'priority':{'type':Sequelize[_0x7eb5('0x2')]},'destchannel':{'type':Sequelize[_0x7eb5('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x7eb5('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7eb5('0x2')]},'destcalleridname':{'type':Sequelize[_0x7eb5('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7eb5('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7eb5('0x2')]},'destlanguage':{'type':Sequelize[_0x7eb5('0x2')]},'destaccountcode':{'type':Sequelize[_0x7eb5('0x2')]},'destcontext':{'type':Sequelize[_0x7eb5('0x2')]},'destexten':{'type':Sequelize[_0x7eb5('0x2')]},'destpriority':{'type':Sequelize[_0x7eb5('0x2')]},'destuniqueid':{'type':Sequelize[_0x7eb5('0x2')]},'messageId':{'type':Sequelize[_0x7eb5('0x2')]},'inReplyTo':{'type':Sequelize[_0x7eb5('0x2')]},'subject':{'type':Sequelize[_0x7eb5('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x7eb5('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0x7eb5('0x7'),_0x7eb5('0x8'),_0x7eb5('0x9'))},'url':{'type':Sequelize[_0x7eb5('0x2')]},'app':{'type':Sequelize[_0x7eb5('0x2')]},'appdata':{'type':Sequelize[_0x7eb5('0x2')]},'projectId':{'type':Sequelize[_0x7eb5('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a1c405f..c8fffa1 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 _0x8f38=['stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','IntegrationReport','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus'];(function(_0x21cdd8,_0x273525){var _0x43b93e=function(_0x56ae4e){while(--_0x56ae4e){_0x21cdd8['push'](_0x21cdd8['shift']());}};_0x43b93e(++_0x273525);}(_0x8f38,0x144));var _0x88f3=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x8f38[_0x2c7b86];return _0x256735;};'use strict';var emlformat=require(_0x88f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x88f3('0x1'));var jsonpatch=require(_0x88f3('0x2'));var rp=require('request-promise');var moment=require(_0x88f3('0x3'));var BPromise=require(_0x88f3('0x4'));var Mustache=require(_0x88f3('0x5'));var util=require('util');var path=require('path');var sox=require(_0x88f3('0x6'));var csv=require(_0x88f3('0x7'));var ejs=require(_0x88f3('0x8'));var fs=require('fs');var fs_extra=require(_0x88f3('0x9'));var _=require(_0x88f3('0xa'));var squel=require('squel');var crypto=require(_0x88f3('0xb'));var jsforce=require(_0x88f3('0xc'));var deskjs=require(_0x88f3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x88f3('0xe'));var Papa=require(_0x88f3('0xf'));var Redis=require('ioredis');var authService=require(_0x88f3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88f3('0x11'));var logger=require('../../config/logger')(_0x88f3('0x12'));var utils=require(_0x88f3('0x13'));var config=require(_0x88f3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x88f3('0x15'))['db'];function respondWithStatusCode(_0x3cf290,_0xa0f463){_0xa0f463=_0xa0f463||0xcc;return function(_0x3d87fe){if(_0x3d87fe){return _0x3cf290['sendStatus'](_0xa0f463);}return _0x3cf290[_0x88f3('0x16')](_0xa0f463)[_0x88f3('0x17')]();};}function respondWithResult(_0x154e3e,_0x44028b){_0x44028b=_0x44028b||0xc8;return function(_0x379efa){if(_0x379efa){return _0x154e3e[_0x88f3('0x16')](_0x44028b)['json'](_0x379efa);}};}function respondWithFilteredResult(_0x8cbeb4,_0x5d4dfa){return function(_0x3ce39f){if(_0x3ce39f){var _0x5276bc=typeof _0x5d4dfa[_0x88f3('0x18')]===_0x88f3('0x19')&&typeof _0x5d4dfa[_0x88f3('0x1a')]===_0x88f3('0x19');var _0x1a7af9=_0x3ce39f[_0x88f3('0x1b')];var _0x267353=_0x5276bc?0x0:_0x5d4dfa['offset'];var _0x1e10a3=_0x5276bc?_0x3ce39f[_0x88f3('0x1b')]:_0x5d4dfa[_0x88f3('0x18')]+_0x5d4dfa['limit'];var _0x59be2f;if(_0x1e10a3>=_0x1a7af9){_0x1e10a3=_0x1a7af9;_0x59be2f=0xc8;}else{_0x59be2f=0xce;}_0x8cbeb4[_0x88f3('0x16')](_0x59be2f);return _0x8cbeb4[_0x88f3('0x1c')](_0x88f3('0x1d'),_0x267353+'-'+_0x1e10a3+'/'+_0x1a7af9)[_0x88f3('0x1e')](_0x3ce39f);}return null;};}function patchUpdates(_0x1c7f2e){return function(_0x29a41d){try{jsonpatch['apply'](_0x29a41d,_0x1c7f2e,!![]);}catch(_0x2707f5){return BPromise[_0x88f3('0x1f')](_0x2707f5);}return _0x29a41d[_0x88f3('0x20')]();};}function saveUpdates(_0x555ed4,_0x42c2af){return function(_0x2a89bb){if(_0x2a89bb){return _0x2a89bb['update'](_0x555ed4)[_0x88f3('0x21')](function(_0x399620){return _0x399620;});}return null;};}function removeEntity(_0x5ef8ef,_0x202bdd){return function(_0x316512){if(_0x316512){return _0x316512[_0x88f3('0x22')]()[_0x88f3('0x21')](function(){_0x5ef8ef[_0x88f3('0x16')](0xcc)[_0x88f3('0x17')]();});}};}function handleEntityNotFound(_0x5882b8,_0x3cb894){return function(_0x4452fc){if(!_0x4452fc){_0x5882b8[_0x88f3('0x23')](0x194);}return _0x4452fc;};}function handleError(_0x35389a,_0x295ea0){_0x295ea0=_0x295ea0||0x1f4;return function(_0x46ee59){logger['error'](_0x46ee59[_0x88f3('0x24')]);if(_0x46ee59[_0x88f3('0x25')]){delete _0x46ee59[_0x88f3('0x25')];}_0x35389a['status'](_0x295ea0)[_0x88f3('0x26')](_0x46ee59);};}exports[_0x88f3('0x27')]=function(_0x23f285,_0x56b8b6){var _0x748ec={},_0x3528a3={},_0x16aa47={'count':0x0,'rows':[]};var _0x355635=_[_0x88f3('0x28')](db['IntegrationReport'][_0x88f3('0x29')],function(_0x51e4ee){return{'name':_0x51e4ee[_0x88f3('0x2a')],'type':_0x51e4ee['type'][_0x88f3('0x2b')]};});_0x3528a3[_0x88f3('0x2c')]=_[_0x88f3('0x28')](_0x355635,'name');_0x3528a3[_0x88f3('0x2d')]=_[_0x88f3('0x2e')](_0x23f285[_0x88f3('0x2d')]);_0x3528a3[_0x88f3('0x2f')]=_[_0x88f3('0x30')](_0x3528a3['model'],_0x3528a3[_0x88f3('0x2d')]);_0x748ec[_0x88f3('0x31')]=_[_0x88f3('0x30')](_0x3528a3[_0x88f3('0x2c')],qs[_0x88f3('0x32')](_0x23f285[_0x88f3('0x2d')][_0x88f3('0x32')]));_0x748ec[_0x88f3('0x31')]=_0x748ec[_0x88f3('0x31')][_0x88f3('0x33')]?_0x748ec[_0x88f3('0x31')]:_0x3528a3[_0x88f3('0x2c')];if(!_0x23f285['query'][_0x88f3('0x34')](_0x88f3('0x35'))){_0x748ec['limit']=qs['limit'](_0x23f285[_0x88f3('0x2d')][_0x88f3('0x1a')]);_0x748ec[_0x88f3('0x18')]=qs[_0x88f3('0x18')](_0x23f285[_0x88f3('0x2d')][_0x88f3('0x18')]);}_0x748ec[_0x88f3('0x36')]=qs[_0x88f3('0x37')](_0x23f285[_0x88f3('0x2d')][_0x88f3('0x37')]);_0x748ec[_0x88f3('0x38')]=qs[_0x88f3('0x2f')](_['pick'](_0x23f285[_0x88f3('0x2d')],_0x3528a3['filters']),_0x355635);if(_0x23f285['query']['filter']){_0x748ec[_0x88f3('0x38')]=_[_0x88f3('0x39')](_0x748ec[_0x88f3('0x38')],{'$or':_[_0x88f3('0x28')](_0x355635,function(_0x3d1e89){if(_0x3d1e89['type']!==_0x88f3('0x3a')){var _0x455ae3={};_0x455ae3[_0x3d1e89['name']]={'$like':'%'+_0x23f285[_0x88f3('0x2d')][_0x88f3('0x3b')]+'%'};return _0x455ae3;}})});}_0x748ec=_[_0x88f3('0x39')]({},_0x748ec,_0x23f285[_0x88f3('0x3c')]);var _0xe30a1a={'where':_0x748ec['where']};return db[_0x88f3('0x3d')][_0x88f3('0x1b')](_0xe30a1a)[_0x88f3('0x21')](function(_0x3f7def){_0x16aa47[_0x88f3('0x1b')]=_0x3f7def;if(_0x23f285[_0x88f3('0x2d')][_0x88f3('0x3e')]){_0x748ec[_0x88f3('0x3f')]=[{'all':!![]}];}return db[_0x88f3('0x3d')]['findAll'](_0x748ec);})[_0x88f3('0x21')](function(_0x210e86){_0x16aa47[_0x88f3('0x40')]=_0x210e86;return _0x16aa47;})[_0x88f3('0x21')](respondWithFilteredResult(_0x56b8b6,_0x748ec))['catch'](handleError(_0x56b8b6,null));};exports[_0x88f3('0x41')]=function(_0x3871aa,_0x164f05){var _0x531bd0={'raw':![],'where':{'id':_0x3871aa[_0x88f3('0x42')]['id']}},_0x2e46e1={};_0x2e46e1[_0x88f3('0x2c')]=_[_0x88f3('0x2e')](db[_0x88f3('0x3d')][_0x88f3('0x29')]);_0x2e46e1[_0x88f3('0x2d')]=_[_0x88f3('0x2e')](_0x3871aa[_0x88f3('0x2d')]);_0x2e46e1[_0x88f3('0x2f')]=_[_0x88f3('0x30')](_0x2e46e1[_0x88f3('0x2c')],_0x2e46e1[_0x88f3('0x2d')]);_0x531bd0['attributes']=_['intersection'](_0x2e46e1['model'],qs['fields'](_0x3871aa[_0x88f3('0x2d')][_0x88f3('0x32')]));_0x531bd0[_0x88f3('0x31')]=_0x531bd0[_0x88f3('0x31')][_0x88f3('0x33')]?_0x531bd0[_0x88f3('0x31')]:_0x2e46e1['model'];if(_0x3871aa[_0x88f3('0x2d')][_0x88f3('0x3e')]){_0x531bd0['include']=[{'all':!![]}];}_0x531bd0=_[_0x88f3('0x39')]({},_0x531bd0,_0x3871aa[_0x88f3('0x3c')]);return db[_0x88f3('0x3d')][_0x88f3('0x43')](_0x531bd0)['then'](handleEntityNotFound(_0x164f05,null))[_0x88f3('0x21')](respondWithResult(_0x164f05,null))[_0x88f3('0x44')](handleError(_0x164f05,null));};exports['create']=function(_0x55c507,_0x1eb0f6){return db[_0x88f3('0x3d')][_0x88f3('0x45')](_0x55c507[_0x88f3('0x46')],{})[_0x88f3('0x21')](respondWithResult(_0x1eb0f6,0xc9))[_0x88f3('0x44')](handleError(_0x1eb0f6,null));};exports['update']=function(_0x434981,_0x34ceaa){if(_0x434981['body']['id']){delete _0x434981['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x434981['params']['id']}})[_0x88f3('0x21')](handleEntityNotFound(_0x34ceaa,null))[_0x88f3('0x21')](saveUpdates(_0x434981[_0x88f3('0x46')],null))['then'](respondWithResult(_0x34ceaa,null))[_0x88f3('0x44')](handleError(_0x34ceaa,null));};exports[_0x88f3('0x22')]=function(_0x39f183,_0x1baf23){return db[_0x88f3('0x3d')][_0x88f3('0x43')]({'where':{'id':_0x39f183[_0x88f3('0x42')]['id']}})['then'](handleEntityNotFound(_0x1baf23,null))[_0x88f3('0x21')](removeEntity(_0x1baf23,null))[_0x88f3('0x44')](handleError(_0x1baf23,null));};exports[_0x88f3('0x47')]=function(_0x2a3957,_0x18d20a){return db[_0x88f3('0x3d')]['describe']()[_0x88f3('0x21')](respondWithResult(_0x18d20a,null))['catch'](handleError(_0x18d20a,null));}; \ No newline at end of file +var _0x0a61=['end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','name','send','map','IntegrationReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x305ab4,_0x1e71ef){var _0x128ef2=function(_0x1c685e){while(--_0x1c685e){_0x305ab4['push'](_0x305ab4['shift']());}};_0x128ef2(++_0x1e71ef);}(_0x0a61,0xbd));var _0x10a6=function(_0x263faf,_0x4d1b79){_0x263faf=_0x263faf-0x0;var _0x3e3537=_0x0a61[_0x263faf];return _0x3e3537;};'use strict';var emlformat=require(_0x10a6('0x0'));var rimraf=require(_0x10a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x10a6('0x2'));var moment=require(_0x10a6('0x3'));var BPromise=require(_0x10a6('0x4'));var Mustache=require(_0x10a6('0x5'));var util=require(_0x10a6('0x6'));var path=require(_0x10a6('0x7'));var sox=require(_0x10a6('0x8'));var csv=require(_0x10a6('0x9'));var ejs=require(_0x10a6('0xa'));var fs=require('fs');var fs_extra=require(_0x10a6('0xb'));var _=require(_0x10a6('0xc'));var squel=require(_0x10a6('0xd'));var crypto=require('crypto');var jsforce=require(_0x10a6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x10a6('0x9'));var querystring=require(_0x10a6('0xf'));var Papa=require(_0x10a6('0x10'));var Redis=require(_0x10a6('0x11'));var authService=require(_0x10a6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x10a6('0x13'));var hardwareService=require(_0x10a6('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x10a6('0x15'));var db=require(_0x10a6('0x16'))['db'];function respondWithStatusCode(_0xfe63da,_0x4c4137){_0x4c4137=_0x4c4137||0xcc;return function(_0x375e81){if(_0x375e81){return _0xfe63da[_0x10a6('0x17')](_0x4c4137);}return _0xfe63da['status'](_0x4c4137)[_0x10a6('0x18')]();};}function respondWithResult(_0x532bf7,_0x214ab9){_0x214ab9=_0x214ab9||0xc8;return function(_0x29affd){if(_0x29affd){return _0x532bf7[_0x10a6('0x19')](_0x214ab9)[_0x10a6('0x1a')](_0x29affd);}};}function respondWithFilteredResult(_0x30fce1,_0x51846c){return function(_0x24475e){if(_0x24475e){var _0xa34766=typeof _0x51846c[_0x10a6('0x1b')]===_0x10a6('0x1c')&&typeof _0x51846c[_0x10a6('0x1d')]===_0x10a6('0x1c');var _0x238093=_0x24475e['count'];var _0x416737=_0xa34766?0x0:_0x51846c[_0x10a6('0x1b')];var _0x1f7def=_0xa34766?_0x24475e[_0x10a6('0x1e')]:_0x51846c[_0x10a6('0x1b')]+_0x51846c[_0x10a6('0x1d')];var _0xdd87f1;if(_0x1f7def>=_0x238093){_0x1f7def=_0x238093;_0xdd87f1=0xc8;}else{_0xdd87f1=0xce;}_0x30fce1[_0x10a6('0x19')](_0xdd87f1);return _0x30fce1[_0x10a6('0x1f')]('Content-Range',_0x416737+'-'+_0x1f7def+'/'+_0x238093)[_0x10a6('0x1a')](_0x24475e);}return null;};}function patchUpdates(_0x1b377b){return function(_0x399544){try{jsonpatch[_0x10a6('0x20')](_0x399544,_0x1b377b,!![]);}catch(_0x6368e0){return BPromise[_0x10a6('0x21')](_0x6368e0);}return _0x399544[_0x10a6('0x22')]();};}function saveUpdates(_0x4c40f0,_0x2b3d67){return function(_0xbfc209){if(_0xbfc209){return _0xbfc209['update'](_0x4c40f0)[_0x10a6('0x23')](function(_0xdf704a){return _0xdf704a;});}return null;};}function removeEntity(_0x2a173c,_0x5797a8){return function(_0x1475e6){if(_0x1475e6){return _0x1475e6[_0x10a6('0x24')]()[_0x10a6('0x23')](function(){_0x2a173c[_0x10a6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5688fc,_0x342143){return function(_0x4f07d2){if(!_0x4f07d2){_0x5688fc[_0x10a6('0x17')](0x194);}return _0x4f07d2;};}function handleError(_0x444dd4,_0x39e167){_0x39e167=_0x39e167||0x1f4;return function(_0x2b77cb){logger['error'](_0x2b77cb['stack']);if(_0x2b77cb[_0x10a6('0x25')]){delete _0x2b77cb[_0x10a6('0x25')];}_0x444dd4[_0x10a6('0x19')](_0x39e167)[_0x10a6('0x26')](_0x2b77cb);};}exports['index']=function(_0x2a9831,_0x4a544b){var _0x258166={},_0x4a7cd7={},_0x5ece8e={'count':0x0,'rows':[]};var _0x403a28=_[_0x10a6('0x27')](db[_0x10a6('0x28')]['rawAttributes'],function(_0x10170d){return{'name':_0x10170d[_0x10a6('0x29')],'type':_0x10170d[_0x10a6('0x2a')][_0x10a6('0x2b')]};});_0x4a7cd7[_0x10a6('0x2c')]=_[_0x10a6('0x27')](_0x403a28,_0x10a6('0x25'));_0x4a7cd7[_0x10a6('0x2d')]=_[_0x10a6('0x2e')](_0x2a9831[_0x10a6('0x2d')]);_0x4a7cd7[_0x10a6('0x2f')]=_[_0x10a6('0x30')](_0x4a7cd7[_0x10a6('0x2c')],_0x4a7cd7[_0x10a6('0x2d')]);_0x258166[_0x10a6('0x31')]=_['intersection'](_0x4a7cd7[_0x10a6('0x2c')],qs[_0x10a6('0x32')](_0x2a9831[_0x10a6('0x2d')]['fields']));_0x258166['attributes']=_0x258166['attributes'][_0x10a6('0x33')]?_0x258166[_0x10a6('0x31')]:_0x4a7cd7[_0x10a6('0x2c')];if(!_0x2a9831['query'][_0x10a6('0x34')]('nolimit')){_0x258166[_0x10a6('0x1d')]=qs['limit'](_0x2a9831[_0x10a6('0x2d')][_0x10a6('0x1d')]);_0x258166[_0x10a6('0x1b')]=qs[_0x10a6('0x1b')](_0x2a9831[_0x10a6('0x2d')]['offset']);}_0x258166[_0x10a6('0x35')]=qs['sort'](_0x2a9831[_0x10a6('0x2d')][_0x10a6('0x36')]);_0x258166[_0x10a6('0x37')]=qs[_0x10a6('0x2f')](_[_0x10a6('0x38')](_0x2a9831[_0x10a6('0x2d')],_0x4a7cd7[_0x10a6('0x2f')]),_0x403a28);if(_0x2a9831[_0x10a6('0x2d')][_0x10a6('0x39')]){_0x258166['where']=_[_0x10a6('0x3a')](_0x258166[_0x10a6('0x37')],{'$or':_[_0x10a6('0x27')](_0x403a28,function(_0x42b0e0){if(_0x42b0e0['type']!==_0x10a6('0x3b')){var _0x104c3b={};_0x104c3b[_0x42b0e0[_0x10a6('0x25')]]={'$like':'%'+_0x2a9831['query'][_0x10a6('0x39')]+'%'};return _0x104c3b;}})});}_0x258166=_[_0x10a6('0x3a')]({},_0x258166,_0x2a9831['options']);var _0x298610={'where':_0x258166['where']};return db[_0x10a6('0x28')][_0x10a6('0x1e')](_0x298610)[_0x10a6('0x23')](function(_0x3ea011){_0x5ece8e[_0x10a6('0x1e')]=_0x3ea011;if(_0x2a9831[_0x10a6('0x2d')]['includeAll']){_0x258166[_0x10a6('0x3c')]=[{'all':!![]}];}return db[_0x10a6('0x28')][_0x10a6('0x3d')](_0x258166);})['then'](function(_0x4c346f){_0x5ece8e[_0x10a6('0x3e')]=_0x4c346f;return _0x5ece8e;})['then'](respondWithFilteredResult(_0x4a544b,_0x258166))[_0x10a6('0x3f')](handleError(_0x4a544b,null));};exports[_0x10a6('0x40')]=function(_0x23d784,_0x496656){var _0x8c6f1e={'raw':![],'where':{'id':_0x23d784[_0x10a6('0x41')]['id']}},_0x34d432={};_0x34d432[_0x10a6('0x2c')]=_[_0x10a6('0x2e')](db[_0x10a6('0x28')]['rawAttributes']);_0x34d432['query']=_[_0x10a6('0x2e')](_0x23d784['query']);_0x34d432[_0x10a6('0x2f')]=_[_0x10a6('0x30')](_0x34d432[_0x10a6('0x2c')],_0x34d432[_0x10a6('0x2d')]);_0x8c6f1e['attributes']=_[_0x10a6('0x30')](_0x34d432['model'],qs[_0x10a6('0x32')](_0x23d784[_0x10a6('0x2d')][_0x10a6('0x32')]));_0x8c6f1e[_0x10a6('0x31')]=_0x8c6f1e['attributes']['length']?_0x8c6f1e[_0x10a6('0x31')]:_0x34d432[_0x10a6('0x2c')];if(_0x23d784[_0x10a6('0x2d')][_0x10a6('0x42')]){_0x8c6f1e['include']=[{'all':!![]}];}_0x8c6f1e=_[_0x10a6('0x3a')]({},_0x8c6f1e,_0x23d784['options']);return db[_0x10a6('0x28')][_0x10a6('0x43')](_0x8c6f1e)[_0x10a6('0x23')](handleEntityNotFound(_0x496656,null))[_0x10a6('0x23')](respondWithResult(_0x496656,null))[_0x10a6('0x3f')](handleError(_0x496656,null));};exports[_0x10a6('0x44')]=function(_0x1243fa,_0x4285f4){return db[_0x10a6('0x28')][_0x10a6('0x44')](_0x1243fa[_0x10a6('0x45')],{})[_0x10a6('0x23')](respondWithResult(_0x4285f4,0xc9))[_0x10a6('0x3f')](handleError(_0x4285f4,null));};exports['update']=function(_0x31734b,_0x2f268d){if(_0x31734b[_0x10a6('0x45')]['id']){delete _0x31734b[_0x10a6('0x45')]['id'];}return db[_0x10a6('0x28')][_0x10a6('0x43')]({'where':{'id':_0x31734b[_0x10a6('0x41')]['id']}})[_0x10a6('0x23')](handleEntityNotFound(_0x2f268d,null))['then'](saveUpdates(_0x31734b[_0x10a6('0x45')],null))[_0x10a6('0x23')](respondWithResult(_0x2f268d,null))[_0x10a6('0x3f')](handleError(_0x2f268d,null));};exports['destroy']=function(_0x28f815,_0x26d2e1){return db[_0x10a6('0x28')][_0x10a6('0x43')]({'where':{'id':_0x28f815[_0x10a6('0x41')]['id']}})[_0x10a6('0x23')](handleEntityNotFound(_0x26d2e1,null))[_0x10a6('0x23')](removeEntity(_0x26d2e1,null))[_0x10a6('0x3f')](handleError(_0x26d2e1,null));};exports[_0x10a6('0x46')]=function(_0x295132,_0x199509){return db['IntegrationReport']['describe']()[_0x10a6('0x23')](respondWithResult(_0x199509,null))[_0x10a6('0x3f')](handleError(_0x199509,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 2bddc0a..0bd32ae 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 _0xc28d=['moment','bluebird','request-promise','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc28d,0x1ca));var _0xdc28=function(_0x5aa0a1,_0x58d7d4){_0x5aa0a1=_0x5aa0a1-0x0;var _0x38934b=_0xc28d[_0x5aa0a1];return _0x38934b;};'use strict';var _=require('lodash');var util=require(_0xdc28('0x0'));var logger=require('../../config/logger')(_0xdc28('0x1'));var moment=require(_0xdc28('0x2'));var BPromise=require(_0xdc28('0x3'));var rp=require(_0xdc28('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdc28('0x5'));module[_0xdc28('0x6')]=function(_0x51730f,_0x1181f){return _0x51730f[_0xdc28('0x7')](_0xdc28('0x8'),attributes,{'tableName':_0xdc28('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3224=['moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash'];(function(_0x544e79,_0x1c0953){var _0x2270b2=function(_0x4a9d3a){while(--_0x4a9d3a){_0x544e79['push'](_0x544e79['shift']());}};_0x2270b2(++_0x1c0953);}(_0x3224,0x77));var _0x4322=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x3224[_0x4cbf20];return _0x582ae4;};'use strict';var _=require(_0x4322('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4322('0x1'));var BPromise=require('bluebird');var rp=require(_0x4322('0x2'));var fs=require('fs');var path=require(_0x4322('0x3'));var rimraf=require(_0x4322('0x4'));var config=require(_0x4322('0x5'));var attributes=require(_0x4322('0x6'));module[_0x4322('0x7')]=function(_0x4c9215,_0x3d80f3){return _0x4c9215[_0x4322('0x8')](_0x4322('0x9'),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 2a7c3df..10e72e3 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 _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x52ce49,_0x18c8d3){var _0x2ba30c=function(_0x5e5fb1){while(--_0x5e5fb1){_0x52ce49['push'](_0x52ce49['shift']());}};_0x2ba30c(++_0x18c8d3);}(_0x2675,0x75));var _0x5267=function(_0x1a6c24,_0x850253){_0x1a6c24=_0x1a6c24-0x0;var _0x57c210=_0x2675[_0x1a6c24];return _0x57c210;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1ce002,_0x4e05fa){var _0x3aaf77=function(_0xd7ad73){while(--_0xd7ad73){_0x1ce002['push'](_0x1ce002['shift']());}};_0x3aaf77(++_0x4e05fa);}(_0xdb28,0x106));var _0x8db2=function(_0x1df1e7,_0x38573b){_0x1df1e7=_0x1df1e7-0x0;var _0x4aaf73=_0xdb28[_0x1df1e7];return _0x4aaf73;};'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')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index ca48ddd..ae7527a 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 _0xdab6=['show','/:id/sub_intervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2b5cf7,_0x32e2b2){var _0x3ac03f=function(_0x2d0dd9){while(--_0x2d0dd9){_0x2b5cf7['push'](_0x2b5cf7['shift']());}};_0x3ac03f(++_0x32e2b2);}(_0xdab6,0x9a));var _0x6dab=function(_0x2cc96b,_0x309e29){_0x2cc96b=_0x2cc96b-0x0;var _0xd7a4aa=_0xdab6[_0x2cc96b];return _0xd7a4aa;};'use strict';var multer=require(_0x6dab('0x0'));var util=require(_0x6dab('0x1'));var path=require(_0x6dab('0x2'));var timeout=require(_0x6dab('0x3'));var express=require(_0x6dab('0x4'));var router=express[_0x6dab('0x5')]();var fs_extra=require(_0x6dab('0x6'));var auth=require(_0x6dab('0x7'));var interaction=require(_0x6dab('0x8'));var config=require(_0x6dab('0x9'));var controller=require('./interval.controller');router[_0x6dab('0xa')]('/',auth[_0x6dab('0xb')](),controller[_0x6dab('0xc')]);router[_0x6dab('0xa')](_0x6dab('0xd'),auth[_0x6dab('0xb')](),controller[_0x6dab('0xe')]);router[_0x6dab('0xa')](_0x6dab('0xf'),auth[_0x6dab('0xb')](),controller['getIntervals']);router[_0x6dab('0x10')]('/',auth[_0x6dab('0xb')](),controller[_0x6dab('0x11')]);router['post'](_0x6dab('0xf'),auth['isAuthenticated'](),controller['addInterval']);router[_0x6dab('0x10')](_0x6dab('0x12'),auth[_0x6dab('0xb')](),controller[_0x6dab('0x13')]);router[_0x6dab('0x14')]('/:id',auth[_0x6dab('0xb')](),controller[_0x6dab('0x15')]);router['delete'](_0x6dab('0xd'),auth[_0x6dab('0xb')](),controller[_0x6dab('0x16')]);module[_0x6dab('0x17')]=router; \ No newline at end of file +var _0x6317=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete'];(function(_0x3e07ab,_0x2530c9){var _0x3e1f5b=function(_0x58a635){while(--_0x58a635){_0x3e07ab['push'](_0x3e07ab['shift']());}};_0x3e1f5b(++_0x2530c9);}(_0x6317,0x11a));var _0x7631=function(_0x55b3bd,_0x1197d2){_0x55b3bd=_0x55b3bd-0x0;var _0x44cd44=_0x6317[_0x55b3bd];return _0x44cd44;};'use strict';var multer=require(_0x7631('0x0'));var util=require(_0x7631('0x1'));var path=require(_0x7631('0x2'));var timeout=require(_0x7631('0x3'));var express=require(_0x7631('0x4'));var router=express[_0x7631('0x5')]();var fs_extra=require(_0x7631('0x6'));var auth=require(_0x7631('0x7'));var interaction=require(_0x7631('0x8'));var config=require(_0x7631('0x9'));var controller=require(_0x7631('0xa'));router[_0x7631('0xb')]('/',auth['isAuthenticated'](),controller[_0x7631('0xc')]);router[_0x7631('0xb')](_0x7631('0xd'),auth[_0x7631('0xe')](),controller[_0x7631('0xf')]);router[_0x7631('0xb')](_0x7631('0x10'),auth[_0x7631('0xe')](),controller[_0x7631('0x11')]);router[_0x7631('0x12')]('/',auth[_0x7631('0xe')](),controller[_0x7631('0x13')]);router[_0x7631('0x12')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x7631('0x14')]);router[_0x7631('0x12')](_0x7631('0x15'),auth['isAuthenticated'](),controller[_0x7631('0x16')]);router[_0x7631('0x17')](_0x7631('0xd'),auth['isAuthenticated'](),controller[_0x7631('0x18')]);router[_0x7631('0x19')](_0x7631('0xd'),auth['isAuthenticated'](),controller[_0x7631('0x1a')]);module[_0x7631('0x1b')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d212856..b484b53 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 _0x2997=['STRING','sequelize'];(function(_0x516643,_0x6a2a8c){var _0x4904de=function(_0x5c9784){while(--_0x5c9784){_0x516643['push'](_0x516643['shift']());}};_0x4904de(++_0x6a2a8c);}(_0x2997,0x171));var _0x7299=function(_0x133e05,_0x28eb8d){_0x133e05=_0x133e05-0x0;var _0x30d761=_0x2997[_0x133e05];return _0x30d761;};'use strict';var Sequelize=require(_0x7299('0x0'));module['exports']={'name':{'type':Sequelize[_0x7299('0x1')]},'description':{'type':Sequelize[_0x7299('0x1')]},'interval':{'type':Sequelize[_0x7299('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xc946=['sequelize','exports','STRING'];(function(_0x62a56f,_0x4cedeb){var _0x156be0=function(_0x1bd40f){while(--_0x1bd40f){_0x62a56f['push'](_0x62a56f['shift']());}};_0x156be0(++_0x4cedeb);}(_0xc946,0xf6));var _0x6c94=function(_0x37e329,_0x2e483d){_0x37e329=_0x37e329-0x0;var _0x5c12f7=_0xc946[_0x37e329];return _0x5c12f7;};'use strict';var Sequelize=require(_0x6c94('0x0'));module[_0x6c94('0x1')]={'name':{'type':Sequelize[_0x6c94('0x2')]},'description':{'type':Sequelize[_0x6c94('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f9d4bc9..80804b5 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 _0xb5e6=['role','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','sequelize','transaction','IntervalId','bulkCreate','findAll','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Intervals','destroy','error','stack','name','send','Interval','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3ca8d4,_0x3c1d5a){var _0xf702c1=function(_0x11a277){while(--_0x11a277){_0x3ca8d4['push'](_0x3ca8d4['shift']());}};_0xf702c1(++_0x3c1d5a);}(_0xb5e6,0x116));var _0x6b5e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb5e6[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6b5e('0x0'));var rp=require(_0x6b5e('0x1'));var moment=require(_0x6b5e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b5e('0x3'));var path=require(_0x6b5e('0x4'));var sox=require(_0x6b5e('0x5'));var csv=require(_0x6b5e('0x6'));var ejs=require(_0x6b5e('0x7'));var fs=require('fs');var fs_extra=require(_0x6b5e('0x8'));var _=require(_0x6b5e('0x9'));var squel=require(_0x6b5e('0xa'));var crypto=require(_0x6b5e('0xb'));var jsforce=require(_0x6b5e('0xc'));var deskjs=require(_0x6b5e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6b5e('0xe'));var Redis=require(_0x6b5e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b5e('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x6b5e('0x11'));var licenseUtil=require(_0x6b5e('0x12'));var db=require(_0x6b5e('0x13'))['db'];var extensions=require(_0x6b5e('0x14'));function respondWithStatusCode(_0x5a169b,_0x52cffa){_0x52cffa=_0x52cffa||0xcc;return function(_0x9cb7f5){if(_0x9cb7f5){return _0x5a169b['sendStatus'](_0x52cffa);}return _0x5a169b[_0x6b5e('0x15')](_0x52cffa)[_0x6b5e('0x16')]();};}function respondWithResult(_0x2f302f,_0x96a8d4){_0x96a8d4=_0x96a8d4||0xc8;return function(_0x20acaf){if(_0x20acaf){return _0x2f302f[_0x6b5e('0x15')](_0x96a8d4)[_0x6b5e('0x17')](_0x20acaf);}};}function respondWithFilteredResult(_0x39a67d,_0x36aa3f){return function(_0x54eddf){if(_0x54eddf){var _0x252044=typeof _0x36aa3f[_0x6b5e('0x18')]===_0x6b5e('0x19')&&typeof _0x36aa3f[_0x6b5e('0x1a')]===_0x6b5e('0x19');var _0x3ab229=_0x54eddf[_0x6b5e('0x1b')];var _0x40fcbb=_0x252044?0x0:_0x36aa3f[_0x6b5e('0x18')];var _0x40bbee=_0x252044?_0x54eddf[_0x6b5e('0x1b')]:_0x36aa3f[_0x6b5e('0x18')]+_0x36aa3f['limit'];var _0x5a0c4c;if(_0x40bbee>=_0x3ab229){_0x40bbee=_0x3ab229;_0x5a0c4c=0xc8;}else{_0x5a0c4c=0xce;}_0x39a67d[_0x6b5e('0x15')](_0x5a0c4c);return _0x39a67d[_0x6b5e('0x1c')](_0x6b5e('0x1d'),_0x40fcbb+'-'+_0x40bbee+'/'+_0x3ab229)[_0x6b5e('0x17')](_0x54eddf);}return null;};}function patchUpdates(_0x26683b){return function(_0x119ee8){try{jsonpatch[_0x6b5e('0x1e')](_0x119ee8,_0x26683b,!![]);}catch(_0x1bf28c){return BPromise[_0x6b5e('0x1f')](_0x1bf28c);}return _0x119ee8[_0x6b5e('0x20')]();};}function saveUpdates(_0x16a5db,_0x278873){return function(_0x350fb6){if(_0x350fb6){return _0x350fb6[_0x6b5e('0x21')](_0x16a5db)[_0x6b5e('0x22')](function(_0x36526d){return _0x36526d;});}return null;};}function removeEntity(_0x4deb8c,_0x4ed1d7){return function(_0x28307d){if(_0x28307d){return _0x28307d['destroy']()[_0x6b5e('0x22')](function(){var _0x34379c=_0x28307d[_0x6b5e('0x23')]({'plain':!![]});var _0x1c7cdc=_0x6b5e('0x24');return db['UserProfileResource'][_0x6b5e('0x25')]({'where':{'type':_0x1c7cdc,'resourceId':_0x34379c['id']}})[_0x6b5e('0x22')](function(){return _0x28307d;});})[_0x6b5e('0x22')](function(){_0x4deb8c['status'](0xcc)[_0x6b5e('0x16')]();});}};}function handleEntityNotFound(_0xa8a130,_0x1e64d7){return function(_0x20b430){if(!_0x20b430){_0xa8a130['sendStatus'](0x194);}return _0x20b430;};}function handleError(_0x4d7465,_0x3a1f28){_0x3a1f28=_0x3a1f28||0x1f4;return function(_0xff20f9){logger[_0x6b5e('0x26')](_0xff20f9[_0x6b5e('0x27')]);if(_0xff20f9[_0x6b5e('0x28')]){delete _0xff20f9[_0x6b5e('0x28')];}_0x4d7465[_0x6b5e('0x15')](_0x3a1f28)[_0x6b5e('0x29')](_0xff20f9);};}exports['index']=function(_0x17b8b3,_0x4554ce){var _0x102a31={},_0x2855a8={},_0x51d5c4={'count':0x0,'rows':[]};var _0x55a408=_['map'](db[_0x6b5e('0x2a')]['rawAttributes'],function(_0xf25ca6){return{'name':_0xf25ca6['fieldName'],'type':_0xf25ca6[_0x6b5e('0x2b')][_0x6b5e('0x2c')]};});_0x2855a8[_0x6b5e('0x2d')]=_[_0x6b5e('0x2e')](_0x55a408,'name');_0x2855a8['query']=_[_0x6b5e('0x2f')](_0x17b8b3['query']);_0x2855a8[_0x6b5e('0x30')]=_[_0x6b5e('0x31')](_0x2855a8['model'],_0x2855a8[_0x6b5e('0x32')]);_0x102a31[_0x6b5e('0x33')]=_[_0x6b5e('0x31')](_0x2855a8[_0x6b5e('0x2d')],qs[_0x6b5e('0x34')](_0x17b8b3[_0x6b5e('0x32')][_0x6b5e('0x34')]));_0x102a31[_0x6b5e('0x33')]=_0x102a31[_0x6b5e('0x33')][_0x6b5e('0x35')]?_0x102a31['attributes']:_0x2855a8[_0x6b5e('0x2d')];if(!_0x17b8b3['query'][_0x6b5e('0x36')](_0x6b5e('0x37'))){_0x102a31[_0x6b5e('0x1a')]=qs[_0x6b5e('0x1a')](_0x17b8b3['query'][_0x6b5e('0x1a')]);_0x102a31['offset']=qs['offset'](_0x17b8b3[_0x6b5e('0x32')]['offset']);}_0x102a31[_0x6b5e('0x38')]=qs[_0x6b5e('0x39')](_0x17b8b3['query'][_0x6b5e('0x39')]);_0x102a31[_0x6b5e('0x3a')]=qs[_0x6b5e('0x30')](_[_0x6b5e('0x3b')](_0x17b8b3[_0x6b5e('0x32')],_0x2855a8[_0x6b5e('0x30')]),_0x55a408);if(_0x17b8b3[_0x6b5e('0x32')][_0x6b5e('0x3c')]){_0x102a31[_0x6b5e('0x3a')]=_[_0x6b5e('0x3d')](_0x102a31[_0x6b5e('0x3a')],{'$or':_['map'](_0x55a408,function(_0x10312e){if(_0x10312e[_0x6b5e('0x2b')]!==_0x6b5e('0x3e')){var _0x5e8528={};_0x5e8528[_0x10312e[_0x6b5e('0x28')]]={'$like':'%'+_0x17b8b3[_0x6b5e('0x32')][_0x6b5e('0x3c')]+'%'};return _0x5e8528;}})});}_0x102a31=_[_0x6b5e('0x3d')]({},_0x102a31,_0x17b8b3[_0x6b5e('0x3f')]);var _0x53c01d={'where':_0x102a31[_0x6b5e('0x3a')]};return db[_0x6b5e('0x2a')][_0x6b5e('0x1b')](_0x53c01d)[_0x6b5e('0x22')](function(_0x328fc8){_0x51d5c4[_0x6b5e('0x1b')]=_0x328fc8;if(_0x17b8b3[_0x6b5e('0x32')][_0x6b5e('0x40')]){_0x102a31['include']=[{'all':!![]}];}return db['Interval']['findAll'](_0x102a31);})['then'](function(_0xa21ab4){_0x51d5c4[_0x6b5e('0x41')]=_0xa21ab4;return _0x51d5c4;})[_0x6b5e('0x22')](respondWithFilteredResult(_0x4554ce,_0x102a31))[_0x6b5e('0x42')](handleError(_0x4554ce,null));};exports[_0x6b5e('0x43')]=function(_0x4a7b03,_0x4edc47){var _0x4a7195={'raw':!![],'where':{'id':_0x4a7b03[_0x6b5e('0x44')]['id']}},_0x1189af={};_0x1189af[_0x6b5e('0x2d')]=_[_0x6b5e('0x2f')](db[_0x6b5e('0x2a')][_0x6b5e('0x45')]);_0x1189af[_0x6b5e('0x32')]=_[_0x6b5e('0x2f')](_0x4a7b03['query']);_0x1189af['filters']=_[_0x6b5e('0x31')](_0x1189af[_0x6b5e('0x2d')],_0x1189af['query']);_0x4a7195['attributes']=_[_0x6b5e('0x31')](_0x1189af['model'],qs[_0x6b5e('0x34')](_0x4a7b03[_0x6b5e('0x32')][_0x6b5e('0x34')]));_0x4a7195[_0x6b5e('0x33')]=_0x4a7195[_0x6b5e('0x33')]['length']?_0x4a7195[_0x6b5e('0x33')]:_0x1189af[_0x6b5e('0x2d')];if(_0x4a7b03[_0x6b5e('0x32')][_0x6b5e('0x40')]){_0x4a7195[_0x6b5e('0x46')]=[{'all':!![]}];}_0x4a7195=_['merge']({},_0x4a7195,_0x4a7b03['options']);return db[_0x6b5e('0x2a')]['find'](_0x4a7195)[_0x6b5e('0x22')](handleEntityNotFound(_0x4edc47,null))['then'](respondWithResult(_0x4edc47,null))['catch'](handleError(_0x4edc47,null));};exports[_0x6b5e('0x47')]=function(_0x2a0ce5,_0x3b24f8){return db[_0x6b5e('0x2a')][_0x6b5e('0x47')](_0x2a0ce5[_0x6b5e('0x48')],{})[_0x6b5e('0x22')](function(_0x33398e){var _0x31c885=_0x2a0ce5['user'][_0x6b5e('0x23')]({'plain':!![]});if(!_0x31c885)throw new Error(_0x6b5e('0x49'));if(_0x31c885[_0x6b5e('0x4a')]===_0x6b5e('0x4b')){var _0x511cc9=_0x33398e[_0x6b5e('0x23')]({'plain':!![]});var _0x3687d6=_0x6b5e('0x24');return db[_0x6b5e('0x4c')][_0x6b5e('0x4d')]({'where':{'name':_0x3687d6,'userProfileId':_0x31c885[_0x6b5e('0x4e')]},'raw':!![]})[_0x6b5e('0x22')](function(_0x508ab6){if(_0x508ab6&&_0x508ab6['autoAssociation']===0x0){return db[_0x6b5e('0x4f')][_0x6b5e('0x47')]({'name':_0x511cc9['name'],'resourceId':_0x511cc9['id'],'type':_0x508ab6[_0x6b5e('0x28')],'sectionId':_0x508ab6['id']},{})[_0x6b5e('0x22')](function(){return _0x33398e;});}else{return _0x33398e;}})['catch'](function(_0x4fe5d9){logger[_0x6b5e('0x26')](_0x6b5e('0x50'),_0x4fe5d9);throw _0x4fe5d9;});}return _0x33398e;})['then'](respondWithResult(_0x3b24f8,0xc9))['catch'](handleError(_0x3b24f8,null));};exports[_0x6b5e('0x21')]=function(_0x253488,_0x113e35){if(_0x253488[_0x6b5e('0x48')]['id']){delete _0x253488[_0x6b5e('0x48')]['id'];}return db[_0x6b5e('0x2a')][_0x6b5e('0x4d')]({'where':{'id':_0x253488['params']['id']}})[_0x6b5e('0x22')](handleEntityNotFound(_0x113e35,null))['then'](saveUpdates(_0x253488[_0x6b5e('0x48')],null))['then'](respondWithResult(_0x113e35,null))[_0x6b5e('0x42')](handleError(_0x113e35,null));};exports[_0x6b5e('0x25')]=function(_0x51cbaf,_0x4414f2){return db[_0x6b5e('0x2a')][_0x6b5e('0x4d')]({'where':{'id':_0x51cbaf[_0x6b5e('0x44')]['id']}})[_0x6b5e('0x22')](handleEntityNotFound(_0x4414f2,null))[_0x6b5e('0x22')](removeEntity(_0x4414f2,null))[_0x6b5e('0x42')](handleError(_0x4414f2,null));};exports[_0x6b5e('0x51')]=function(_0xf8c19a,_0x3a70e3,_0x171404){if(_0xf8c19a['body']['id']){delete _0xf8c19a['body']['id'];}return db[_0x6b5e('0x2a')][_0x6b5e('0x4d')]({'where':{'id':_0xf8c19a[_0x6b5e('0x44')]['id']}})[_0x6b5e('0x22')](handleEntityNotFound(_0x3a70e3,null))[_0x6b5e('0x22')](function(_0x42f0c2){if(_0x42f0c2){_0xf8c19a[_0x6b5e('0x48')]['IntervalId']=_0x42f0c2['id'];return db[_0x6b5e('0x2a')][_0x6b5e('0x47')](_0xf8c19a[_0x6b5e('0x48')]);}})[_0x6b5e('0x22')](respondWithResult(_0x3a70e3,null))[_0x6b5e('0x42')](handleError(_0x3a70e3,null));};exports[_0x6b5e('0x52')]=function(_0x4e087b,_0x430427,_0xae6168){var _0x3e8877={};var _0x4020b9={};var _0x7558b9;var _0x82e6f6;return db[_0x6b5e('0x2a')]['findOne']({'where':{'id':_0x4e087b[_0x6b5e('0x44')]['id']}})['then'](handleEntityNotFound(_0x430427,null))['then'](function(_0x5f3bf6){if(_0x5f3bf6){_0x7558b9=_0x5f3bf6;_0x4020b9['model']=_[_0x6b5e('0x2f')](db['Interval'][_0x6b5e('0x45')]);_0x4020b9[_0x6b5e('0x32')]=_[_0x6b5e('0x2f')](_0x4e087b[_0x6b5e('0x32')]);_0x4020b9[_0x6b5e('0x30')]=_[_0x6b5e('0x31')](_0x4020b9['model'],_0x4020b9[_0x6b5e('0x32')]);_0x3e8877['attributes']=_[_0x6b5e('0x31')](_0x4020b9[_0x6b5e('0x2d')],qs[_0x6b5e('0x34')](_0x4e087b[_0x6b5e('0x32')][_0x6b5e('0x34')]));_0x3e8877[_0x6b5e('0x33')]=_0x3e8877[_0x6b5e('0x33')][_0x6b5e('0x35')]?_0x3e8877['attributes']:_0x4020b9[_0x6b5e('0x2d')];_0x3e8877['order']=qs[_0x6b5e('0x39')](_0x4e087b[_0x6b5e('0x32')]['sort']);_0x3e8877[_0x6b5e('0x3a')]=qs[_0x6b5e('0x30')](_['pick'](_0x4e087b[_0x6b5e('0x32')],_0x4020b9[_0x6b5e('0x30')]));if(_0x4e087b[_0x6b5e('0x32')][_0x6b5e('0x3c')]){_0x3e8877[_0x6b5e('0x3a')]=_[_0x6b5e('0x3d')](_0x3e8877[_0x6b5e('0x3a')],{'$or':_[_0x6b5e('0x2e')](_0x3e8877[_0x6b5e('0x33')],function(_0x19b5d6){var _0xc74a8e={};_0xc74a8e[_0x19b5d6]={'$like':'%'+_0x4e087b['query'][_0x6b5e('0x3c')]+'%'};return _0xc74a8e;})});}_0x3e8877=_['merge']({},_0x3e8877,_0x4e087b['options']);return _0x7558b9['getIntervals'](_0x3e8877);}})[_0x6b5e('0x22')](function(_0x59b309){if(_0x59b309){_0x82e6f6=_0x59b309['length'];if(!_0x4e087b[_0x6b5e('0x32')][_0x6b5e('0x36')](_0x6b5e('0x37'))){_0x3e8877[_0x6b5e('0x1a')]=qs[_0x6b5e('0x1a')](_0x4e087b[_0x6b5e('0x32')][_0x6b5e('0x1a')]);_0x3e8877[_0x6b5e('0x18')]=qs[_0x6b5e('0x18')](_0x4e087b['query'][_0x6b5e('0x18')]);}return _0x7558b9['getIntervals'](_0x3e8877);}})[_0x6b5e('0x22')](function(_0x35d267){if(_0x35d267){return _0x35d267?{'count':_0x82e6f6,'rows':_0x35d267}:null;}})[_0x6b5e('0x22')](respondWithResult(_0x430427,null))['catch'](handleError(_0x430427,null));};exports['addIntervals']=function(_0x22ed76,_0x5af225,_0x55f2f5){return db[_0x6b5e('0x2a')]['findOne']({'where':{'id':_0x22ed76['params']['id']}})[_0x6b5e('0x22')](handleEntityNotFound(_0x5af225,null))[_0x6b5e('0x22')](function(_0x5895b1){if(_0x5895b1){return db[_0x6b5e('0x53')][_0x6b5e('0x54')](function(_0x1f3f5d){return db[_0x6b5e('0x2a')][_0x6b5e('0x25')]({'where':{'IntervalId':_0x22ed76[_0x6b5e('0x44')]['id']},'transaction':_0x1f3f5d})[_0x6b5e('0x22')](function(_0x4df879){var _0x5b2a23=_[_0x6b5e('0x2e')](_0x22ed76[_0x6b5e('0x48')],function(_0x5d5b53){delete _0x5d5b53['id'];_0x5d5b53[_0x6b5e('0x55')]=_0x22ed76[_0x6b5e('0x44')]['id'];return _0x5d5b53;});return db['Interval'][_0x6b5e('0x56')](_0x5b2a23,{'transaction':_0x1f3f5d});});})['then'](function(){return db['Interval'][_0x6b5e('0x57')]({'where':{'IntervalId':_0x22ed76[_0x6b5e('0x44')]['id']}});});}})[_0x6b5e('0x22')](respondWithResult(_0x5af225,null))[_0x6b5e('0x42')](handleError(_0x5af225,null));}; \ No newline at end of file +var _0xe456=['find','create','body','user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','pick','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','destroy','Intervals','UserProfileResource','then','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','include','options'];(function(_0x3e5abf,_0x2d745c){var _0x24851c=function(_0x422a94){while(--_0x422a94){_0x3e5abf['push'](_0x3e5abf['shift']());}};_0x24851c(++_0x2d745c);}(_0xe456,0x1dd));var _0x6e45=function(_0x125e32,_0x5b4cda){_0x125e32=_0x125e32-0x0;var _0x52d904=_0xe456[_0x125e32];return _0x52d904;};'use strict';var emlformat=require(_0x6e45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e45('0x1'));var jsonpatch=require(_0x6e45('0x2'));var rp=require(_0x6e45('0x3'));var moment=require(_0x6e45('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6e45('0x5'));var util=require(_0x6e45('0x6'));var path=require(_0x6e45('0x7'));var sox=require(_0x6e45('0x8'));var csv=require(_0x6e45('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e45('0xa'));var _=require(_0x6e45('0xb'));var squel=require(_0x6e45('0xc'));var crypto=require('crypto');var jsforce=require(_0x6e45('0xd'));var deskjs=require(_0x6e45('0xe'));var toCsv=require(_0x6e45('0x9'));var querystring=require(_0x6e45('0xf'));var Papa=require(_0x6e45('0x10'));var Redis=require(_0x6e45('0x11'));var authService=require(_0x6e45('0x12'));var qs=require(_0x6e45('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e45('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6e45('0x15'));var config=require(_0x6e45('0x16'));var licenseUtil=require(_0x6e45('0x17'));var db=require(_0x6e45('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3fe023,_0x929583){_0x929583=_0x929583||0xcc;return function(_0xdb5f66){if(_0xdb5f66){return _0x3fe023[_0x6e45('0x19')](_0x929583);}return _0x3fe023[_0x6e45('0x1a')](_0x929583)[_0x6e45('0x1b')]();};}function respondWithResult(_0x364b89,_0x4c0658){_0x4c0658=_0x4c0658||0xc8;return function(_0x37086c){if(_0x37086c){return _0x364b89[_0x6e45('0x1a')](_0x4c0658)['json'](_0x37086c);}};}function respondWithFilteredResult(_0x20e055,_0x3eea4c){return function(_0x586251){if(_0x586251){var _0xfcbfb8=typeof _0x3eea4c['offset']===_0x6e45('0x1c')&&typeof _0x3eea4c[_0x6e45('0x1d')]===_0x6e45('0x1c');var _0x43f1db=_0x586251[_0x6e45('0x1e')];var _0x2df5dc=_0xfcbfb8?0x0:_0x3eea4c[_0x6e45('0x1f')];var _0x1529f8=_0xfcbfb8?_0x586251['count']:_0x3eea4c[_0x6e45('0x1f')]+_0x3eea4c[_0x6e45('0x1d')];var _0x1e1d26;if(_0x1529f8>=_0x43f1db){_0x1529f8=_0x43f1db;_0x1e1d26=0xc8;}else{_0x1e1d26=0xce;}_0x20e055[_0x6e45('0x1a')](_0x1e1d26);return _0x20e055[_0x6e45('0x20')]('Content-Range',_0x2df5dc+'-'+_0x1529f8+'/'+_0x43f1db)[_0x6e45('0x21')](_0x586251);}return null;};}function patchUpdates(_0x44814f){return function(_0x45d331){try{jsonpatch[_0x6e45('0x22')](_0x45d331,_0x44814f,!![]);}catch(_0xfa8ea7){return BPromise[_0x6e45('0x23')](_0xfa8ea7);}return _0x45d331[_0x6e45('0x24')]();};}function saveUpdates(_0x148a78,_0x24b6a2){return function(_0xa10e2a){if(_0xa10e2a){return _0xa10e2a[_0x6e45('0x25')](_0x148a78)['then'](function(_0x52ee12){return _0x52ee12;});}return null;};}function removeEntity(_0x3b9b8b,_0x4f6319){return function(_0x22b0ac){if(_0x22b0ac){return _0x22b0ac[_0x6e45('0x26')]()['then'](function(){var _0x31803f=_0x22b0ac['get']({'plain':!![]});var _0x15319c=_0x6e45('0x27');return db[_0x6e45('0x28')][_0x6e45('0x26')]({'where':{'type':_0x15319c,'resourceId':_0x31803f['id']}})[_0x6e45('0x29')](function(){return _0x22b0ac;});})[_0x6e45('0x29')](function(){_0x3b9b8b[_0x6e45('0x1a')](0xcc)[_0x6e45('0x1b')]();});}};}function handleEntityNotFound(_0x5d0d64,_0x38941c){return function(_0x13361e){if(!_0x13361e){_0x5d0d64[_0x6e45('0x19')](0x194);}return _0x13361e;};}function handleError(_0x17678b,_0x46a596){_0x46a596=_0x46a596||0x1f4;return function(_0x5ed964){logger[_0x6e45('0x2a')](_0x5ed964[_0x6e45('0x2b')]);if(_0x5ed964[_0x6e45('0x2c')]){delete _0x5ed964[_0x6e45('0x2c')];}_0x17678b['status'](_0x46a596)[_0x6e45('0x2d')](_0x5ed964);};}exports[_0x6e45('0x2e')]=function(_0x6cf819,_0x1e76de){var _0x3e665e={},_0x41dbf8={},_0x166d3={'count':0x0,'rows':[]};var _0x34031d=_[_0x6e45('0x2f')](db[_0x6e45('0x30')][_0x6e45('0x31')],function(_0x5e9d7c){return{'name':_0x5e9d7c[_0x6e45('0x32')],'type':_0x5e9d7c[_0x6e45('0x33')][_0x6e45('0x34')]};});_0x41dbf8[_0x6e45('0x35')]=_[_0x6e45('0x2f')](_0x34031d,'name');_0x41dbf8[_0x6e45('0x36')]=_[_0x6e45('0x37')](_0x6cf819[_0x6e45('0x36')]);_0x41dbf8[_0x6e45('0x38')]=_[_0x6e45('0x39')](_0x41dbf8[_0x6e45('0x35')],_0x41dbf8[_0x6e45('0x36')]);_0x3e665e['attributes']=_[_0x6e45('0x39')](_0x41dbf8[_0x6e45('0x35')],qs['fields'](_0x6cf819[_0x6e45('0x36')][_0x6e45('0x3a')]));_0x3e665e['attributes']=_0x3e665e['attributes'][_0x6e45('0x3b')]?_0x3e665e[_0x6e45('0x3c')]:_0x41dbf8['model'];if(!_0x6cf819['query'][_0x6e45('0x3d')]('nolimit')){_0x3e665e[_0x6e45('0x1d')]=qs[_0x6e45('0x1d')](_0x6cf819[_0x6e45('0x36')][_0x6e45('0x1d')]);_0x3e665e[_0x6e45('0x1f')]=qs['offset'](_0x6cf819[_0x6e45('0x36')][_0x6e45('0x1f')]);}_0x3e665e[_0x6e45('0x3e')]=qs[_0x6e45('0x3f')](_0x6cf819['query'][_0x6e45('0x3f')]);_0x3e665e[_0x6e45('0x40')]=qs[_0x6e45('0x38')](_['pick'](_0x6cf819[_0x6e45('0x36')],_0x41dbf8[_0x6e45('0x38')]),_0x34031d);if(_0x6cf819[_0x6e45('0x36')][_0x6e45('0x41')]){_0x3e665e[_0x6e45('0x40')]=_[_0x6e45('0x42')](_0x3e665e[_0x6e45('0x40')],{'$or':_[_0x6e45('0x2f')](_0x34031d,function(_0x387a52){if(_0x387a52[_0x6e45('0x33')]!=='VIRTUAL'){var _0x308231={};_0x308231[_0x387a52['name']]={'$like':'%'+_0x6cf819['query']['filter']+'%'};return _0x308231;}})});}_0x3e665e=_[_0x6e45('0x42')]({},_0x3e665e,_0x6cf819['options']);var _0x30188f={'where':_0x3e665e['where']};return db['Interval']['count'](_0x30188f)[_0x6e45('0x29')](function(_0x5d38f8){_0x166d3['count']=_0x5d38f8;if(_0x6cf819['query'][_0x6e45('0x43')]){_0x3e665e['include']=[{'all':!![]}];}return db[_0x6e45('0x30')][_0x6e45('0x44')](_0x3e665e);})['then'](function(_0x1e9147){_0x166d3[_0x6e45('0x45')]=_0x1e9147;return _0x166d3;})[_0x6e45('0x29')](respondWithFilteredResult(_0x1e76de,_0x3e665e))[_0x6e45('0x46')](handleError(_0x1e76de,null));};exports[_0x6e45('0x47')]=function(_0x4e39a5,_0x23ef55){var _0x19bc7f={'raw':!![],'where':{'id':_0x4e39a5[_0x6e45('0x48')]['id']}},_0x290a0f={};_0x290a0f[_0x6e45('0x35')]=_[_0x6e45('0x37')](db[_0x6e45('0x30')]['rawAttributes']);_0x290a0f[_0x6e45('0x36')]=_[_0x6e45('0x37')](_0x4e39a5[_0x6e45('0x36')]);_0x290a0f[_0x6e45('0x38')]=_[_0x6e45('0x39')](_0x290a0f['model'],_0x290a0f[_0x6e45('0x36')]);_0x19bc7f[_0x6e45('0x3c')]=_[_0x6e45('0x39')](_0x290a0f[_0x6e45('0x35')],qs[_0x6e45('0x3a')](_0x4e39a5[_0x6e45('0x36')][_0x6e45('0x3a')]));_0x19bc7f[_0x6e45('0x3c')]=_0x19bc7f[_0x6e45('0x3c')][_0x6e45('0x3b')]?_0x19bc7f[_0x6e45('0x3c')]:_0x290a0f[_0x6e45('0x35')];if(_0x4e39a5[_0x6e45('0x36')][_0x6e45('0x43')]){_0x19bc7f[_0x6e45('0x49')]=[{'all':!![]}];}_0x19bc7f=_[_0x6e45('0x42')]({},_0x19bc7f,_0x4e39a5[_0x6e45('0x4a')]);return db['Interval'][_0x6e45('0x4b')](_0x19bc7f)[_0x6e45('0x29')](handleEntityNotFound(_0x23ef55,null))['then'](respondWithResult(_0x23ef55,null))[_0x6e45('0x46')](handleError(_0x23ef55,null));};exports['create']=function(_0x2db36e,_0x2d4cc6){return db[_0x6e45('0x30')][_0x6e45('0x4c')](_0x2db36e[_0x6e45('0x4d')],{})[_0x6e45('0x29')](function(_0x24e63){var _0x279713=_0x2db36e[_0x6e45('0x4e')]['get']({'plain':!![]});if(!_0x279713)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x279713[_0x6e45('0x4f')]===_0x6e45('0x4e')){var _0x3493ad=_0x24e63[_0x6e45('0x50')]({'plain':!![]});var _0x3e6574='Intervals';return db[_0x6e45('0x51')][_0x6e45('0x4b')]({'where':{'name':_0x3e6574,'userProfileId':_0x279713['userProfileId']},'raw':!![]})[_0x6e45('0x29')](function(_0x2b1348){if(_0x2b1348&&_0x2b1348['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3493ad[_0x6e45('0x2c')],'resourceId':_0x3493ad['id'],'type':_0x2b1348[_0x6e45('0x2c')],'sectionId':_0x2b1348['id']},{})[_0x6e45('0x29')](function(){return _0x24e63;});}else{return _0x24e63;}})[_0x6e45('0x46')](function(_0x243978){logger[_0x6e45('0x2a')](_0x6e45('0x52'),_0x243978);throw _0x243978;});}return _0x24e63;})[_0x6e45('0x29')](respondWithResult(_0x2d4cc6,0xc9))['catch'](handleError(_0x2d4cc6,null));};exports['update']=function(_0x20a0e9,_0x129be2){if(_0x20a0e9['body']['id']){delete _0x20a0e9[_0x6e45('0x4d')]['id'];}return db[_0x6e45('0x30')][_0x6e45('0x4b')]({'where':{'id':_0x20a0e9['params']['id']}})[_0x6e45('0x29')](handleEntityNotFound(_0x129be2,null))[_0x6e45('0x29')](saveUpdates(_0x20a0e9['body'],null))[_0x6e45('0x29')](respondWithResult(_0x129be2,null))[_0x6e45('0x46')](handleError(_0x129be2,null));};exports[_0x6e45('0x26')]=function(_0x9307a3,_0x504cc9){return db[_0x6e45('0x30')][_0x6e45('0x4b')]({'where':{'id':_0x9307a3[_0x6e45('0x48')]['id']}})[_0x6e45('0x29')](handleEntityNotFound(_0x504cc9,null))[_0x6e45('0x29')](removeEntity(_0x504cc9,null))[_0x6e45('0x46')](handleError(_0x504cc9,null));};exports[_0x6e45('0x53')]=function(_0x325a16,_0x2185b4,_0x240835){if(_0x325a16[_0x6e45('0x4d')]['id']){delete _0x325a16[_0x6e45('0x4d')]['id'];}return db['Interval'][_0x6e45('0x4b')]({'where':{'id':_0x325a16[_0x6e45('0x48')]['id']}})[_0x6e45('0x29')](handleEntityNotFound(_0x2185b4,null))['then'](function(_0x541779){if(_0x541779){_0x325a16[_0x6e45('0x4d')]['IntervalId']=_0x541779['id'];return db[_0x6e45('0x30')][_0x6e45('0x4c')](_0x325a16[_0x6e45('0x4d')]);}})[_0x6e45('0x29')](respondWithResult(_0x2185b4,null))[_0x6e45('0x46')](handleError(_0x2185b4,null));};exports[_0x6e45('0x54')]=function(_0x39f7c7,_0x541105,_0x230382){var _0x2dcf71={};var _0x7f220f={};var _0xf16570;var _0x1b2263;return db[_0x6e45('0x30')][_0x6e45('0x55')]({'where':{'id':_0x39f7c7[_0x6e45('0x48')]['id']}})[_0x6e45('0x29')](handleEntityNotFound(_0x541105,null))['then'](function(_0x19ab09){if(_0x19ab09){_0xf16570=_0x19ab09;_0x7f220f[_0x6e45('0x35')]=_['keys'](db[_0x6e45('0x30')]['rawAttributes']);_0x7f220f['query']=_[_0x6e45('0x37')](_0x39f7c7['query']);_0x7f220f[_0x6e45('0x38')]=_[_0x6e45('0x39')](_0x7f220f[_0x6e45('0x35')],_0x7f220f[_0x6e45('0x36')]);_0x2dcf71[_0x6e45('0x3c')]=_[_0x6e45('0x39')](_0x7f220f['model'],qs[_0x6e45('0x3a')](_0x39f7c7[_0x6e45('0x36')][_0x6e45('0x3a')]));_0x2dcf71[_0x6e45('0x3c')]=_0x2dcf71[_0x6e45('0x3c')]['length']?_0x2dcf71['attributes']:_0x7f220f[_0x6e45('0x35')];_0x2dcf71[_0x6e45('0x3e')]=qs[_0x6e45('0x3f')](_0x39f7c7[_0x6e45('0x36')][_0x6e45('0x3f')]);_0x2dcf71[_0x6e45('0x40')]=qs[_0x6e45('0x38')](_[_0x6e45('0x56')](_0x39f7c7[_0x6e45('0x36')],_0x7f220f[_0x6e45('0x38')]));if(_0x39f7c7[_0x6e45('0x36')]['filter']){_0x2dcf71[_0x6e45('0x40')]=_[_0x6e45('0x42')](_0x2dcf71[_0x6e45('0x40')],{'$or':_['map'](_0x2dcf71[_0x6e45('0x3c')],function(_0x25e4d9){var _0x2536a1={};_0x2536a1[_0x25e4d9]={'$like':'%'+_0x39f7c7[_0x6e45('0x36')]['filter']+'%'};return _0x2536a1;})});}_0x2dcf71=_[_0x6e45('0x42')]({},_0x2dcf71,_0x39f7c7[_0x6e45('0x4a')]);return _0xf16570[_0x6e45('0x54')](_0x2dcf71);}})[_0x6e45('0x29')](function(_0x465caf){if(_0x465caf){_0x1b2263=_0x465caf['length'];if(!_0x39f7c7[_0x6e45('0x36')]['hasOwnProperty']('nolimit')){_0x2dcf71['limit']=qs['limit'](_0x39f7c7[_0x6e45('0x36')]['limit']);_0x2dcf71[_0x6e45('0x1f')]=qs[_0x6e45('0x1f')](_0x39f7c7['query']['offset']);}return _0xf16570[_0x6e45('0x54')](_0x2dcf71);}})[_0x6e45('0x29')](function(_0x47bed5){if(_0x47bed5){return _0x47bed5?{'count':_0x1b2263,'rows':_0x47bed5}:null;}})[_0x6e45('0x29')](respondWithResult(_0x541105,null))['catch'](handleError(_0x541105,null));};exports[_0x6e45('0x57')]=function(_0x18ee54,_0x4e1161,_0x39385f){return db[_0x6e45('0x30')][_0x6e45('0x55')]({'where':{'id':_0x18ee54[_0x6e45('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e1161,null))[_0x6e45('0x29')](function(_0xdf7e65){if(_0xdf7e65){return db[_0x6e45('0x58')][_0x6e45('0x59')](function(_0x5e78e1){return db[_0x6e45('0x30')][_0x6e45('0x26')]({'where':{'IntervalId':_0x18ee54['params']['id']},'transaction':_0x5e78e1})[_0x6e45('0x29')](function(_0x5b219e){var _0x582cc9=_[_0x6e45('0x2f')](_0x18ee54[_0x6e45('0x4d')],function(_0x325c90){delete _0x325c90['id'];_0x325c90[_0x6e45('0x5a')]=_0x18ee54[_0x6e45('0x48')]['id'];return _0x325c90;});return db[_0x6e45('0x30')][_0x6e45('0x5b')](_0x582cc9,{'transaction':_0x5e78e1});});})['then'](function(){return db[_0x6e45('0x30')][_0x6e45('0x44')]({'where':{'IntervalId':_0x18ee54[_0x6e45('0x48')]['id']}});});}})[_0x6e45('0x29')](respondWithResult(_0x4e1161,null))[_0x6e45('0x46')](handleError(_0x4e1161,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index eea5329..798800f 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 _0x496a=['all','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','string','then'];(function(_0xdf2ac,_0x3746d2){var _0x18b658=function(_0x40f3a9){while(--_0x40f3a9){_0xdf2ac['push'](_0xdf2ac['shift']());}};_0x18b658(++_0x3746d2);}(_0x496a,0xf1));var _0xa496=function(_0x1f5a26,_0x488e5e){_0x1f5a26=_0x1f5a26-0x0;var _0x2002c9=_0x496a[_0x1f5a26];return _0x2002c9;};'use strict';var attributes=require(_0xa496('0x0'));var extensions=require(_0xa496('0x1'));var iftime=require(_0xa496('0x2'))[_0xa496('0x3')];module[_0xa496('0x4')]=function(_0x24b552){return _0x24b552[_0xa496('0x5')](_0xa496('0x6'),attributes,{'tableName':_0xa496('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x247e34){extensions[_0xa496('0x8')](_0x24b552,_0x247e34);},'afterBulkCreate':function(_0x2e4b4f,_0x687d28,_0x53d008){_0x53d008();extensions['rewrite'](_0x24b552,_0x2e4b4f[0x0]);},'afterUpdate':function(_0x3abb6e){extensions[_0xa496('0x8')](_0x24b552,_0x3abb6e);},'afterDestroy':function(_0x4a799a){extensions[_0xa496('0x8')](_0x24b552,_0x4a799a);}},'instanceMethods':{'ifTime':function(_0x5ae662=undefined,_0x4e0b61=new Date()){if(typeof this['interval']===_0xa496('0x9')){return iftime(this['interval'],_0x5ae662,_0x4e0b61);}else{return this['getIntervals']()[_0xa496('0xa')](function(_0x158cbe){return Promise[_0xa496('0xb')](_0x158cbe['map'](function(_0x4ab4cd){return _0x4ab4cd[_0xa496('0xc')](_0x5ae662,_0x4e0b61);}));})[_0xa496('0xa')](function(_0x24ba24){return _0x24ba24[_0xa496('0xd')](function(_0x50adb3,_0x49359b){return _0x50adb3||_0x49359b;},![]);});}}}});}; \ No newline at end of file +var _0x9e46=['exports','define','Interval','tools_intervals','rewrite','interval','getIntervals','then','all','map','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime'];(function(_0x2075ed,_0xf386af){var _0xd47cc0=function(_0x468c89){while(--_0x468c89){_0x2075ed['push'](_0x2075ed['shift']());}};_0xd47cc0(++_0xf386af);}(_0x9e46,0x13e));var _0x69e4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9e46[_0x1ac595];return _0x455fff;};'use strict';var attributes=require(_0x69e4('0x0'));var extensions=require(_0x69e4('0x1'));var iftime=require(_0x69e4('0x2'))[_0x69e4('0x3')];module[_0x69e4('0x4')]=function(_0x12f537){return _0x12f537[_0x69e4('0x5')](_0x69e4('0x6'),attributes,{'tableName':_0x69e4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cdeb0){extensions[_0x69e4('0x8')](_0x12f537,_0x1cdeb0);},'afterBulkCreate':function(_0x5983c1,_0x5bb9a3,_0x51fd2e){_0x51fd2e();extensions[_0x69e4('0x8')](_0x12f537,_0x5983c1[0x0]);},'afterUpdate':function(_0x2c574a){extensions[_0x69e4('0x8')](_0x12f537,_0x2c574a);},'afterDestroy':function(_0x5b7d04){extensions[_0x69e4('0x8')](_0x12f537,_0x5b7d04);}},'instanceMethods':{'ifTime':function(_0x3a6e30=undefined,_0xfd40f4=new Date()){if(typeof this[_0x69e4('0x9')]==='string'){return iftime(this[_0x69e4('0x9')],_0x3a6e30,_0xfd40f4);}else{return this[_0x69e4('0xa')]()[_0x69e4('0xb')](function(_0xe640bb){return Promise[_0x69e4('0xc')](_0xe640bb[_0x69e4('0xd')](function(_0x3b5fb5){return _0x3b5fb5['ifTime'](_0x3a6e30,_0xfd40f4);}));})[_0x69e4('0xb')](function(_0x123a68){return _0x123a68['reduce'](function(_0x2d3325,_0x42428e){return _0x2d3325||_0x42428e;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 880731f..e9d05e9 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 _0x23c1=['message','ShowInterval','Interval','find','info','debug','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','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','catch','lodash','util','../../mysqldb','../../utils/iftime','iftime','GetInterval','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','error'];(function(_0x9400f4,_0x8fccda){var _0x3f7863=function(_0x2bee02){while(--_0x2bee02){_0x9400f4['push'](_0x9400f4['shift']());}};_0x3f7863(++_0x8fccda);}(_0x23c1,0x1dd));var _0x123c=function(_0x30358b,_0x726597){_0x30358b=_0x30358b-0x0;var _0x1b4825=_0x23c1[_0x30358b];return _0x1b4825;};'use strict';var _=require(_0x123c('0x0'));var util=require(_0x123c('0x1'));var db=require(_0x123c('0x2'))['db'];var iftime=require(_0x123c('0x3'))[_0x123c('0x4')];var logger=require('../../config/logger')('rpc');exports[_0x123c('0x5')]=function(_0x40d0a8){var _0x28a3a3=this;return new Promise(function(_0x23987b,_0xc1f581){return db['Interval'][_0x123c('0x6')]({'raw':_0x40d0a8[_0x123c('0x7')]?_0x40d0a8[_0x123c('0x7')][_0x123c('0x8')]===undefined?!![]:![]:!![],'where':_0x40d0a8[_0x123c('0x7')]?_0x40d0a8[_0x123c('0x7')][_0x123c('0x9')]||null:null,'attributes':_0x40d0a8[_0x123c('0x7')]?_0x40d0a8[_0x123c('0x7')][_0x123c('0xa')]||null:null,'limit':_0x40d0a8[_0x123c('0x7')]?_0x40d0a8[_0x123c('0x7')][_0x123c('0xb')]||null:null,'include':_0x40d0a8['options']?_0x40d0a8[_0x123c('0x7')]['include']?_[_0x123c('0xc')](_0x40d0a8['options']['include'],function(_0xedc05){return{'model':db[_0xedc05['model']],'as':_0xedc05['as'],'attributes':_0xedc05[_0x123c('0xa')],'include':_0xedc05['include']?_['map'](_0xedc05[_0x123c('0xd')],function(_0x4b6884){return{'model':db[_0x4b6884[_0x123c('0xe')]],'as':_0x4b6884['as'],'attributes':_0x4b6884[_0x123c('0xa')],'include':_0x4b6884[_0x123c('0xd')]?_[_0x123c('0xc')](_0x4b6884[_0x123c('0xd')],function(_0x3ff696){return{'model':db[_0x3ff696['model']],'as':_0x3ff696['as'],'attributes':_0x3ff696[_0x123c('0xa')]};}):[]};}):[]};}):[]:[]})[_0x123c('0xf')](function(_0x55ff53){logger['info'](_0x123c('0x5'),_0x40d0a8);logger['debug'](_0x123c('0x5'),_0x40d0a8,JSON[_0x123c('0x10')](_0x55ff53));_0x23987b(_0x55ff53);})['catch'](function(_0x23b51b){logger[_0x123c('0x11')](_0x123c('0x5'),_0x23b51b['message'],_0x40d0a8);_0xc1f581(_0x28a3a3[_0x123c('0x11')](0x1f4,_0x23b51b[_0x123c('0x12')]));});});};exports[_0x123c('0x13')]=function(_0x271eab){var _0x1960e1=this;return new Promise(function(_0x328e9d,_0x1dcf5e){return db[_0x123c('0x14')][_0x123c('0x15')]({'raw':_0x271eab[_0x123c('0x7')]?_0x271eab[_0x123c('0x7')][_0x123c('0x8')]===undefined?!![]:![]:!![],'where':_0x271eab['options']?_0x271eab[_0x123c('0x7')][_0x123c('0x9')]||null:null,'attributes':_0x271eab['options']?_0x271eab[_0x123c('0x7')][_0x123c('0xa')]||null:null,'include':_0x271eab[_0x123c('0x7')]?_0x271eab[_0x123c('0x7')]['include']?_['map'](_0x271eab[_0x123c('0x7')][_0x123c('0xd')],function(_0x5537b1){return{'model':db[_0x5537b1[_0x123c('0xe')]],'as':_0x5537b1['as'],'attributes':_0x5537b1['attributes'],'include':_0x5537b1['include']?_[_0x123c('0xc')](_0x5537b1[_0x123c('0xd')],function(_0xf94025){return{'model':db[_0xf94025[_0x123c('0xe')]],'as':_0xf94025['as'],'attributes':_0xf94025[_0x123c('0xa')],'include':_0xf94025['include']?_[_0x123c('0xc')](_0xf94025[_0x123c('0xd')],function(_0x1cf539){return{'model':db[_0x1cf539[_0x123c('0xe')]],'as':_0x1cf539['as'],'attributes':_0x1cf539[_0x123c('0xa')]};}):[]};}):[]};}):[]:[]})[_0x123c('0xf')](function(_0x12672b){logger[_0x123c('0x16')](_0x123c('0x13'),_0x271eab);logger[_0x123c('0x17')](_0x123c('0x13'),_0x271eab,JSON[_0x123c('0x10')](_0x12672b));_0x328e9d(_0x12672b);})['catch'](function(_0x5eef6b){logger[_0x123c('0x11')](_0x123c('0x13'),_0x5eef6b['message'],_0x271eab);_0x1dcf5e(_0x1960e1[_0x123c('0x11')](0x1f4,_0x5eef6b[_0x123c('0x12')]));});});};function checkArrayOfIntervals(_0x5e4ffb,_0x20b7f8){var _0x492477=[];return db[_0x123c('0x14')][_0x123c('0x6')]({'where':{'id':_0x5e4ffb}})[_0x123c('0xf')](function(_0x57c501){_0x492477=_0x57c501;return Promise[_0x123c('0x18')](_0x492477[_0x123c('0xc')](function(_0x455b4c){return _0x455b4c[_0x123c('0x19')](_0x20b7f8);}));})['then'](function(_0x10397c){var _0x445fd3=_0x10397c[_0x123c('0x1a')](function(_0x4cf26b,_0x2df975){return _0x4cf26b||_0x2df975;},![]);logger['info'](util[_0x123c('0x1b')](_0x123c('0x1c'),_0x492477[_0x123c('0xc')](function(_0x3b621f){return _0x3b621f[_0x123c('0x1d')];})[_0x123c('0x1e')](',\x20'),_0x492477[_0x123c('0xc')](function(_0x4248ed){return _0x4248ed['id'];})[_0x123c('0x1e')](',\x20')));return _0x445fd3;});}function checkSingleInterval(_0x5029d0,_0x49342b){return db[_0x123c('0x14')]['findById'](_0x5029d0)[_0x123c('0xf')](function(_0x2cca73){if(_0x2cca73){logger[_0x123c('0x16')](util[_0x123c('0x1b')](_0x123c('0x1f'),_0x2cca73[_0x123c('0x1d')],_0x2cca73['id']));return _0x2cca73[_0x123c('0x19')](_0x49342b);}});}exports[_0x123c('0x20')]=function(_0x3fb132){var _0x3e2848=_0x3fb132[_0x123c('0x21')];var _0x57f429=Array[_0x123c('0x22')](_0x3fb132[_0x123c('0x23')])?_0x3fb132['intervals']:typeof _0x3fb132['intervals']===_0x123c('0x24')?[_0x3fb132['intervals']]:[];var _0x206c11=_0x3fb132[_0x123c('0x25')]||undefined;var _0x3e7558=![];if(_0x57f429[_0x123c('0x26')]){logger['info'](util[_0x123c('0x1b')](_0x123c('0x27'),_0x57f429[_0x123c('0x1e')](';\x20')));}if(_0x206c11){logger[_0x123c('0x16')](util[_0x123c('0x1b')](_0x123c('0x28'),_0x206c11));}logger[_0x123c('0x17')](_0x123c('0x29'),_0x3e7558);logger[_0x123c('0x2a')](_0x123c('0x20'),_0x3fb132);return Promise[_0x123c('0x2b')]()['then'](function(){if(Array['isArray'](_0x3e2848)){return checkArrayOfIntervals(_0x3e2848,_0x206c11);}else if(_0x3e2848){return checkSingleInterval(_0x3e2848,_0x206c11);}})[_0x123c('0xf')](function(_0xf700b4){var _0x4b8cf1=_0x57f429['reduce'](function(_0x56e40a,_0x5ddc1d){return _0x56e40a||iftime(_0x5ddc1d,_0x206c11);},![]);_0x3e7558=_0xf700b4||_0x4b8cf1;return _0x3e7558;})[_0x123c('0x2c')](function(_0x1e9089){logger[_0x123c('0x11')](_0x123c('0x20'),_0x3fb132,_0x1e9089);throw this[_0x123c('0x11')](0x1f4,_0x1e9089[_0x123c('0x12')]);});}; \ No newline at end of file +var _0x3cba=['string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../config/logger','rpc','Interval','findAll','options','raw','limit','include','map','model','attributes','then','info','GetInterval','catch','message','error','ShowInterval','find','where','debug','stringify','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervals'];(function(_0x2669b6,_0x282b1e){var _0x25d188=function(_0x5f2b61){while(--_0x5f2b61){_0x2669b6['push'](_0x2669b6['shift']());}};_0x25d188(++_0x282b1e);}(_0x3cba,0x161));var _0xa3cb=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0x3cba[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require(_0xa3cb('0x0'));var util=require(_0xa3cb('0x1'));var db=require(_0xa3cb('0x2'))['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0xa3cb('0x3'))(_0xa3cb('0x4'));exports['GetInterval']=function(_0x2a1557){var _0x18d5ae=this;return new Promise(function(_0x124fc9,_0x513e3a){return db[_0xa3cb('0x5')][_0xa3cb('0x6')]({'raw':_0x2a1557[_0xa3cb('0x7')]?_0x2a1557['options'][_0xa3cb('0x8')]===undefined?!![]:![]:!![],'where':_0x2a1557['options']?_0x2a1557[_0xa3cb('0x7')]['where']||null:null,'attributes':_0x2a1557['options']?_0x2a1557['options']['attributes']||null:null,'limit':_0x2a1557['options']?_0x2a1557[_0xa3cb('0x7')][_0xa3cb('0x9')]||null:null,'include':_0x2a1557[_0xa3cb('0x7')]?_0x2a1557[_0xa3cb('0x7')][_0xa3cb('0xa')]?_[_0xa3cb('0xb')](_0x2a1557[_0xa3cb('0x7')][_0xa3cb('0xa')],function(_0x2e7a87){return{'model':db[_0x2e7a87[_0xa3cb('0xc')]],'as':_0x2e7a87['as'],'attributes':_0x2e7a87[_0xa3cb('0xd')],'include':_0x2e7a87[_0xa3cb('0xa')]?_[_0xa3cb('0xb')](_0x2e7a87[_0xa3cb('0xa')],function(_0x48856a){return{'model':db[_0x48856a[_0xa3cb('0xc')]],'as':_0x48856a['as'],'attributes':_0x48856a[_0xa3cb('0xd')],'include':_0x48856a[_0xa3cb('0xa')]?_['map'](_0x48856a[_0xa3cb('0xa')],function(_0x208056){return{'model':db[_0x208056[_0xa3cb('0xc')]],'as':_0x208056['as'],'attributes':_0x208056[_0xa3cb('0xd')]};}):[]};}):[]};}):[]:[]})[_0xa3cb('0xe')](function(_0x28c2b5){logger[_0xa3cb('0xf')](_0xa3cb('0x10'),_0x2a1557);logger['debug'](_0xa3cb('0x10'),_0x2a1557,JSON['stringify'](_0x28c2b5));_0x124fc9(_0x28c2b5);})[_0xa3cb('0x11')](function(_0x39f50d){logger['error'](_0xa3cb('0x10'),_0x39f50d[_0xa3cb('0x12')],_0x2a1557);_0x513e3a(_0x18d5ae[_0xa3cb('0x13')](0x1f4,_0x39f50d[_0xa3cb('0x12')]));});});};exports[_0xa3cb('0x14')]=function(_0x20199d){var _0x28f0d9=this;return new Promise(function(_0x5d8c33,_0x27a95c){return db['Interval'][_0xa3cb('0x15')]({'raw':_0x20199d['options']?_0x20199d[_0xa3cb('0x7')][_0xa3cb('0x8')]===undefined?!![]:![]:!![],'where':_0x20199d['options']?_0x20199d[_0xa3cb('0x7')][_0xa3cb('0x16')]||null:null,'attributes':_0x20199d[_0xa3cb('0x7')]?_0x20199d[_0xa3cb('0x7')][_0xa3cb('0xd')]||null:null,'include':_0x20199d[_0xa3cb('0x7')]?_0x20199d[_0xa3cb('0x7')][_0xa3cb('0xa')]?_[_0xa3cb('0xb')](_0x20199d[_0xa3cb('0x7')][_0xa3cb('0xa')],function(_0x27eb01){return{'model':db[_0x27eb01[_0xa3cb('0xc')]],'as':_0x27eb01['as'],'attributes':_0x27eb01['attributes'],'include':_0x27eb01[_0xa3cb('0xa')]?_[_0xa3cb('0xb')](_0x27eb01[_0xa3cb('0xa')],function(_0x365da7){return{'model':db[_0x365da7[_0xa3cb('0xc')]],'as':_0x365da7['as'],'attributes':_0x365da7[_0xa3cb('0xd')],'include':_0x365da7[_0xa3cb('0xa')]?_['map'](_0x365da7[_0xa3cb('0xa')],function(_0x579b8d){return{'model':db[_0x579b8d[_0xa3cb('0xc')]],'as':_0x579b8d['as'],'attributes':_0x579b8d[_0xa3cb('0xd')]};}):[]};}):[]};}):[]:[]})[_0xa3cb('0xe')](function(_0x16fd1e){logger['info']('ShowInterval',_0x20199d);logger[_0xa3cb('0x17')](_0xa3cb('0x14'),_0x20199d,JSON[_0xa3cb('0x18')](_0x16fd1e));_0x5d8c33(_0x16fd1e);})[_0xa3cb('0x11')](function(_0x2ee36a){logger[_0xa3cb('0x13')](_0xa3cb('0x14'),_0x2ee36a['message'],_0x20199d);_0x27a95c(_0x28f0d9[_0xa3cb('0x13')](0x1f4,_0x2ee36a[_0xa3cb('0x12')]));});});};function checkArrayOfIntervals(_0x4922e6,_0x47fa33){var _0x15e17c=[];return db['Interval'][_0xa3cb('0x6')]({'where':{'id':_0x4922e6}})[_0xa3cb('0xe')](function(_0x2e0825){_0x15e17c=_0x2e0825;return Promise['all'](_0x15e17c[_0xa3cb('0xb')](function(_0x484190){return _0x484190[_0xa3cb('0x19')](_0x47fa33);}));})['then'](function(_0xa103e2){var _0x1e291d=_0xa103e2[_0xa3cb('0x1a')](function(_0x276215,_0x5ba727){return _0x276215||_0x5ba727;},![]);logger[_0xa3cb('0xf')](util[_0xa3cb('0x1b')](_0xa3cb('0x1c'),_0x15e17c[_0xa3cb('0xb')](function(_0x4fdc8d){return _0x4fdc8d['name'];})[_0xa3cb('0x1d')](',\x20'),_0x15e17c[_0xa3cb('0xb')](function(_0x465c7b){return _0x465c7b['id'];})[_0xa3cb('0x1d')](',\x20')));return _0x1e291d;});}function checkSingleInterval(_0x1b6dc7,_0x68f7af){return db[_0xa3cb('0x5')][_0xa3cb('0x1e')](_0x1b6dc7)[_0xa3cb('0xe')](function(_0x7bbd62){if(_0x7bbd62){logger['info'](util['format'](_0xa3cb('0x1f'),_0x7bbd62[_0xa3cb('0x20')],_0x7bbd62['id']));return _0x7bbd62[_0xa3cb('0x19')](_0x68f7af);}});}exports['IntervalIftime']=function(_0x4abfa0){var _0xb1b0ae=_0x4abfa0['intervalIds'];var _0x47b0a0=Array['isArray'](_0x4abfa0[_0xa3cb('0x21')])?_0x4abfa0[_0xa3cb('0x21')]:typeof _0x4abfa0['intervals']===_0xa3cb('0x22')?[_0x4abfa0[_0xa3cb('0x21')]]:[];var _0x3ebe39=_0x4abfa0[_0xa3cb('0x23')]||undefined;var _0x27b5c4=![];if(_0x47b0a0[_0xa3cb('0x24')]){logger[_0xa3cb('0xf')](util['format'](_0xa3cb('0x25'),_0x47b0a0[_0xa3cb('0x1d')](';\x20')));}if(_0x3ebe39){logger['info'](util[_0xa3cb('0x1b')](_0xa3cb('0x26'),_0x3ebe39));}logger[_0xa3cb('0x17')](_0xa3cb('0x27'),_0x27b5c4);logger[_0xa3cb('0x28')](_0xa3cb('0x29'),_0x4abfa0);return Promise[_0xa3cb('0x2a')]()[_0xa3cb('0xe')](function(){if(Array['isArray'](_0xb1b0ae)){return checkArrayOfIntervals(_0xb1b0ae,_0x3ebe39);}else if(_0xb1b0ae){return checkSingleInterval(_0xb1b0ae,_0x3ebe39);}})[_0xa3cb('0xe')](function(_0x1b9a53){var _0x3a9982=_0x47b0a0['reduce'](function(_0x1ffbbd,_0x3cf71b){return _0x1ffbbd||iftime(_0x3cf71b,_0x3ebe39);},![]);_0x27b5c4=_0x1b9a53||_0x3a9982;return _0x27b5c4;})[_0xa3cb('0x11')](function(_0xa4e819){logger[_0xa3cb('0x13')](_0xa3cb('0x29'),_0x4abfa0,_0xa4e819);throw this[_0xa3cb('0x13')](0x1f4,_0xa4e819[_0xa3cb('0x12')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index ff1434c..9ecc318 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x32d02f,_0x26af2f){var _0x734fd=function(_0x3438d0){while(--_0x3438d0){_0x32d02f['push'](_0x32d02f['shift']());}};_0x734fd(++_0x26af2f);}(_0xdb28,0x106));var _0x8db2=function(_0x335885,_0x3a310c){_0x335885=_0x335885-0x0;var _0x5ab66f=_0xdb28[_0x335885];return _0x5ab66f;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x27a848,_0x2dfc9a){var _0x57dbb0=function(_0x403443){while(--_0x403443){_0x27a848['push'](_0x27a848['shift']());}};_0x57dbb0(++_0x2dfc9a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2feacb,_0x2ccc7c){_0x2feacb=_0x2feacb-0x0;var _0x35feb2=_0x5f2f[_0x2feacb];return _0x35feb2;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 4695de4..b26c3ee 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 _0xe02f=['oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','end','openIssue','send','body','headers','remoteAddress','socket','connection','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','Report','stringify','issuetype','Bug','customfield_11500','fields','customfield_11501'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xe02f,0x176));var _0xfe02=function(_0x1ee2ae,_0x17c0eb){_0x1ee2ae=_0x1ee2ae-0x0;var _0x1780e5=_0xe02f[_0x1ee2ae];return _0x1780e5;};'use strict';var BPromise=require(_0xfe02('0x0'));var https=require('https');var logger=require(_0xfe02('0x1'))(_0xfe02('0x2'));var USERNAME=_0xfe02('0x3');var PASSWORD=_0xfe02('0x4');function openIssue(_0x4447e3,_0x5f5326){var _0x43af3b={'fields':{'project':{'key':_0x4447e3[_0xfe02('0x5')]||'MOTGUI'},'summary':(_0x4447e3['summary']||_0xfe02('0x6'))+'\x20from\x20'+_0x4447e3['ip'],'description':_0x4447e3['description']||JSON[_0xfe02('0x7')](_0x4447e3),'issuetype':{'name':_0x4447e3[_0xfe02('0x8')]||_0xfe02('0x9')}}};_0x43af3b['fields'][_0xfe02('0xa')]=_0x4447e3['email'];_0x43af3b[_0xfe02('0xb')][_0xfe02('0xc')]=_0x4447e3[_0xfe02('0xd')];_0x43af3b[_0xfe02('0xb')][_0xfe02('0xe')]=_0x4447e3[_0xfe02('0xf')];_0x43af3b[_0xfe02('0xb')][_0xfe02('0x10')]=_0x4447e3[_0xfe02('0x11')];_0x43af3b[_0xfe02('0xb')][_0xfe02('0x12')]=_0x4447e3[_0xfe02('0x13')];_0x43af3b[_0xfe02('0xb')][_0xfe02('0x14')]=_0x4447e3['ip'];var _0x3a91b5={'host':_0xfe02('0x15'),'port':0x1bb,'path':_0xfe02('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xfe02('0x17'),'Authorization':_0xfe02('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xfe02('0x19'))}};var _0x5742a3=JSON[_0xfe02('0x7')](_0x43af3b);var _0x2bb6cc=https['request'](_0x3a91b5,function(_0x50afcc){_0x50afcc['setEncoding'](_0xfe02('0x1a'));var _0x1465f9='';_0x50afcc['on'](_0xfe02('0x1b'),function(_0x2e8a6a){_0x1465f9+=_0x2e8a6a;});_0x50afcc['on']('end',function(){if(_0x5f5326){return _0x5f5326[_0xfe02('0x1c')](_0x50afcc[_0xfe02('0x1d')])[_0xfe02('0x1e')](JSON[_0xfe02('0x1f')](_0x1465f9));}});});_0x2bb6cc['on'](_0xfe02('0x20'),function(_0x48f495){if(_0x5f5326){return _0x5f5326['status'](0x1f4)[_0xfe02('0x1e')]({'errors':[{'message':_0xfe02('0x21'),'type':_0xfe02('0x22')}]});}});_0x2bb6cc['write'](_0x5742a3);_0x2bb6cc[_0xfe02('0x23')]();}exports[_0xfe02('0x24')]=openIssue;exports[_0xfe02('0x25')]=function(_0x53a029,_0x92cea6){_0x53a029[_0xfe02('0x26')]['ip']=_0x53a029[_0xfe02('0x27')]['x-forwarded-for']||_0x53a029['connection'][_0xfe02('0x28')]||_0x53a029[_0xfe02('0x29')][_0xfe02('0x28')]||_0x53a029[_0xfe02('0x2a')]['socket']['remoteAddress'];return openIssue(_0x53a029[_0xfe02('0x26')],_0x92cea6);}; \ No newline at end of file +var _0x8c31=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','body','socket','remoteAddress','connection','https','../../config/logger','key','Report','\x20from\x20','description','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','toString','base64','stringify','request','utf8','status','statusCode','json'];(function(_0x3ee77f,_0x5c2dba){var _0x52697b=function(_0x131dc8){while(--_0x131dc8){_0x3ee77f['push'](_0x3ee77f['shift']());}};_0x52697b(++_0x5c2dba);}(_0x8c31,0x17c));var _0x18c3=function(_0x38e656,_0x21bcb0){_0x38e656=_0x38e656-0x0;var _0x411375=_0x8c31[_0x38e656];return _0x411375;};'use strict';var BPromise=require('bluebird');var https=require(_0x18c3('0x0'));var logger=require(_0x18c3('0x1'))('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x5bb5c6,_0x1af668){var _0x5f1efe={'fields':{'project':{'key':_0x5bb5c6[_0x18c3('0x2')]||'MOTGUI'},'summary':(_0x5bb5c6['summary']||_0x18c3('0x3'))+_0x18c3('0x4')+_0x5bb5c6['ip'],'description':_0x5bb5c6[_0x18c3('0x5')]||JSON['stringify'](_0x5bb5c6),'issuetype':{'name':_0x5bb5c6['issuetype']||'Bug'}}};_0x5f1efe[_0x18c3('0x6')][_0x18c3('0x7')]=_0x5bb5c6[_0x18c3('0x8')];_0x5f1efe['fields'][_0x18c3('0x9')]=_0x5bb5c6['oldToken'];_0x5f1efe[_0x18c3('0x6')][_0x18c3('0xa')]=_0x5bb5c6[_0x18c3('0xb')];_0x5f1efe[_0x18c3('0x6')][_0x18c3('0xc')]=_0x5bb5c6[_0x18c3('0xd')];_0x5f1efe[_0x18c3('0x6')][_0x18c3('0xe')]=_0x5bb5c6[_0x18c3('0xf')];_0x5f1efe[_0x18c3('0x6')][_0x18c3('0x10')]=_0x5bb5c6['ip'];var _0x152d7c={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x18c3('0x11'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x18c3('0x12'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x18c3('0x13')](_0x18c3('0x14'))}};var _0x4cde3b=JSON[_0x18c3('0x15')](_0x5f1efe);var _0x54ea9e=https[_0x18c3('0x16')](_0x152d7c,function(_0x4c196c){_0x4c196c['setEncoding'](_0x18c3('0x17'));var _0x4e8812='';_0x4c196c['on']('data',function(_0x297f22){_0x4e8812+=_0x297f22;});_0x4c196c['on']('end',function(){if(_0x1af668){return _0x1af668[_0x18c3('0x18')](_0x4c196c[_0x18c3('0x19')])[_0x18c3('0x1a')](JSON['parse'](_0x4e8812));}});});_0x54ea9e['on'](_0x18c3('0x1b'),function(_0x4d4d2f){if(_0x1af668){return _0x1af668[_0x18c3('0x18')](0x1f4)['json']({'errors':[{'message':_0x18c3('0x1c'),'type':'api.jira'}]});}});_0x54ea9e[_0x18c3('0x1d')](_0x4cde3b);_0x54ea9e[_0x18c3('0x1e')]();}exports[_0x18c3('0x1f')]=openIssue;exports[_0x18c3('0x20')]=function(_0x2143fe,_0x17916b){_0x2143fe[_0x18c3('0x21')]['ip']=_0x2143fe['headers']['x-forwarded-for']||_0x2143fe['connection']['remoteAddress']||_0x2143fe[_0x18c3('0x22')][_0x18c3('0x23')]||_0x2143fe[_0x18c3('0x24')][_0x18c3('0x22')]['remoteAddress'];return openIssue(_0x2143fe['body'],_0x17916b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e63c309..03e35bc 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 _0xaa88=['/describe','isAuthenticated','describe','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xaa88,0x137));var _0x8aa8=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0xaa88[_0x3f3bad];return _0x4f0801;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa8('0x11')]);router[_0x8aa8('0x12')](_0x8aa8('0x13'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x13'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);module[_0x8aa8('0x16')]=router; \ No newline at end of file +var _0x2dae=['show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2dae,0xc3));var _0xe2da=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x2dae[_0x3da612];return _0x1a9d1d;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x12')]);router[_0xe2da('0x13')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 518b4ea..3a99f9c 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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x3bc3b4,_0x5d36b3){_0x3bc3b4=_0x3bc3b4-0x0;var _0x468d1d=_0x7a54[_0x3bc3b4];return _0x468d1d;};'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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x57085b,_0x5e2d8d){_0x57085b=_0x57085b-0x0;var _0x139a64=_0x7a54[_0x57085b];return _0x139a64;};'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 db6658d..31a2ea6 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 _0xe181=['keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','findAll','rows','catch','show','params','fields','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x182fff,_0x568aee){var _0x1b4171=function(_0x212d46){while(--_0x212d46){_0x182fff['push'](_0x182fff['shift']());}};_0x1b4171(++_0x568aee);}(_0xe181,0x68));var _0x1e18=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0xe181[_0xc40b9f];return _0x535b9c;};'use strict';var emlformat=require(_0x1e18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e18('0x1'));var jsonpatch=require(_0x1e18('0x2'));var rp=require(_0x1e18('0x3'));var moment=require(_0x1e18('0x4'));var BPromise=require(_0x1e18('0x5'));var Mustache=require(_0x1e18('0x6'));var util=require(_0x1e18('0x7'));var path=require('path');var sox=require(_0x1e18('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e18('0x9'));var _=require(_0x1e18('0xa'));var squel=require(_0x1e18('0xb'));var crypto=require(_0x1e18('0xc'));var jsforce=require(_0x1e18('0xd'));var deskjs=require(_0x1e18('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1e18('0xf'));var Papa=require(_0x1e18('0x10'));var Redis=require(_0x1e18('0x11'));var authService=require(_0x1e18('0x12'));var qs=require(_0x1e18('0x13'));var as=require(_0x1e18('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e18('0x15'))(_0x1e18('0x16'));var utils=require(_0x1e18('0x17'));var config=require(_0x1e18('0x18'));var licenseUtil=require(_0x1e18('0x19'));var db=require(_0x1e18('0x1a'))['db'];function respondWithStatusCode(_0x1743c3,_0x33a98d){_0x33a98d=_0x33a98d||0xcc;return function(_0x531e1b){if(_0x531e1b){return _0x1743c3[_0x1e18('0x1b')](_0x33a98d);}return _0x1743c3['status'](_0x33a98d)[_0x1e18('0x1c')]();};}function respondWithResult(_0x563eff,_0x404b7f){_0x404b7f=_0x404b7f||0xc8;return function(_0x36b583){if(_0x36b583){return _0x563eff[_0x1e18('0x1d')](_0x404b7f)[_0x1e18('0x1e')](_0x36b583);}};}function respondWithFilteredResult(_0x1687ba,_0x1e1ce6){return function(_0x39bc56){if(_0x39bc56){var _0x33fea1=typeof _0x1e1ce6[_0x1e18('0x1f')]===_0x1e18('0x20')&&typeof _0x1e1ce6[_0x1e18('0x21')]===_0x1e18('0x20');var _0x349f3c=_0x39bc56[_0x1e18('0x22')];var _0x21b851=_0x33fea1?0x0:_0x1e1ce6['offset'];var _0x1c91d2=_0x33fea1?_0x39bc56[_0x1e18('0x22')]:_0x1e1ce6[_0x1e18('0x1f')]+_0x1e1ce6[_0x1e18('0x21')];var _0x2834ee;if(_0x1c91d2>=_0x349f3c){_0x1c91d2=_0x349f3c;_0x2834ee=0xc8;}else{_0x2834ee=0xce;}_0x1687ba[_0x1e18('0x1d')](_0x2834ee);return _0x1687ba[_0x1e18('0x23')](_0x1e18('0x24'),_0x21b851+'-'+_0x1c91d2+'/'+_0x349f3c)[_0x1e18('0x1e')](_0x39bc56);}return null;};}function patchUpdates(_0x22baca){return function(_0x2489c3){try{jsonpatch[_0x1e18('0x25')](_0x2489c3,_0x22baca,!![]);}catch(_0x3c4fdf){return BPromise[_0x1e18('0x26')](_0x3c4fdf);}return _0x2489c3[_0x1e18('0x27')]();};}function saveUpdates(_0x975df0,_0x3fd0a7){return function(_0x5eb6b4){if(_0x5eb6b4){return _0x5eb6b4[_0x1e18('0x28')](_0x975df0)[_0x1e18('0x29')](function(_0x3e9b2c){return _0x3e9b2c;});}return null;};}function removeEntity(_0x52d5e2,_0xf74622){return function(_0xdda2ce){if(_0xdda2ce){return _0xdda2ce[_0x1e18('0x2a')]()[_0x1e18('0x29')](function(){_0x52d5e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6fa4db,_0x53f9d7){return function(_0x5bb03c){if(!_0x5bb03c){_0x6fa4db['sendStatus'](0x194);}return _0x5bb03c;};}function handleError(_0x32a196,_0x29cac0){_0x29cac0=_0x29cac0||0x1f4;return function(_0x41b67d){logger[_0x1e18('0x2b')](_0x41b67d[_0x1e18('0x2c')]);if(_0x41b67d[_0x1e18('0x2d')]){delete _0x41b67d[_0x1e18('0x2d')];}_0x32a196[_0x1e18('0x1d')](_0x29cac0)[_0x1e18('0x2e')](_0x41b67d);};}exports[_0x1e18('0x2f')]=function(_0x1015a3,_0x42c638){var _0x40d0af={},_0x1be225={},_0x558d01={'count':0x0,'rows':[]};var _0x57000b=_['map'](db[_0x1e18('0x30')][_0x1e18('0x31')],function(_0x1f75cd){return{'name':_0x1f75cd[_0x1e18('0x32')],'type':_0x1f75cd[_0x1e18('0x33')][_0x1e18('0x34')]};});_0x1be225[_0x1e18('0x35')]=_[_0x1e18('0x36')](_0x57000b,'name');_0x1be225[_0x1e18('0x37')]=_[_0x1e18('0x38')](_0x1015a3['query']);_0x1be225[_0x1e18('0x39')]=_[_0x1e18('0x3a')](_0x1be225[_0x1e18('0x35')],_0x1be225['query']);_0x40d0af[_0x1e18('0x3b')]=_['intersection'](_0x1be225['model'],qs['fields'](_0x1015a3[_0x1e18('0x37')]['fields']));_0x40d0af[_0x1e18('0x3b')]=_0x40d0af[_0x1e18('0x3b')][_0x1e18('0x3c')]?_0x40d0af['attributes']:_0x1be225['model'];if(!_0x1015a3[_0x1e18('0x37')][_0x1e18('0x3d')](_0x1e18('0x3e'))){_0x40d0af[_0x1e18('0x21')]=qs[_0x1e18('0x21')](_0x1015a3[_0x1e18('0x37')][_0x1e18('0x21')]);_0x40d0af[_0x1e18('0x1f')]=qs[_0x1e18('0x1f')](_0x1015a3[_0x1e18('0x37')][_0x1e18('0x1f')]);}_0x40d0af[_0x1e18('0x3f')]=qs['sort'](_0x1015a3['query'][_0x1e18('0x40')]);_0x40d0af[_0x1e18('0x41')]=qs[_0x1e18('0x39')](_['pick'](_0x1015a3[_0x1e18('0x37')],_0x1be225['filters']),_0x57000b);if(_0x1015a3[_0x1e18('0x37')]['filter']){_0x40d0af['where']=_[_0x1e18('0x42')](_0x40d0af[_0x1e18('0x41')],{'$or':_[_0x1e18('0x36')](_0x57000b,function(_0x206b44){if(_0x206b44[_0x1e18('0x33')]!==_0x1e18('0x43')){var _0x4e2ca3={};_0x4e2ca3[_0x206b44[_0x1e18('0x2d')]]={'$like':'%'+_0x1015a3[_0x1e18('0x37')][_0x1e18('0x44')]+'%'};return _0x4e2ca3;}})});}_0x40d0af=_[_0x1e18('0x42')]({},_0x40d0af,_0x1015a3['options']);var _0x11f839={'where':_0x40d0af['where']};return db[_0x1e18('0x30')][_0x1e18('0x22')](_0x11f839)['then'](function(_0x41c2bd){_0x558d01[_0x1e18('0x22')]=_0x41c2bd;if(_0x1015a3['query']['includeAll']){_0x40d0af['include']=[{'all':!![]}];}return db[_0x1e18('0x30')][_0x1e18('0x45')](_0x40d0af);})[_0x1e18('0x29')](function(_0x602a85){_0x558d01[_0x1e18('0x46')]=_0x602a85;return _0x558d01;})[_0x1e18('0x29')](respondWithFilteredResult(_0x42c638,_0x40d0af))[_0x1e18('0x47')](handleError(_0x42c638,null));};exports[_0x1e18('0x48')]=function(_0x1cae7e,_0x354832){var _0x16ee40={'raw':!![],'where':{'id':_0x1cae7e[_0x1e18('0x49')]['id']}},_0x4821f9={};_0x4821f9['model']=_[_0x1e18('0x38')](db[_0x1e18('0x30')]['rawAttributes']);_0x4821f9['query']=_['keys'](_0x1cae7e[_0x1e18('0x37')]);_0x4821f9[_0x1e18('0x39')]=_['intersection'](_0x4821f9[_0x1e18('0x35')],_0x4821f9[_0x1e18('0x37')]);_0x16ee40['attributes']=_['intersection'](_0x4821f9[_0x1e18('0x35')],qs[_0x1e18('0x4a')](_0x1cae7e[_0x1e18('0x37')][_0x1e18('0x4a')]));_0x16ee40[_0x1e18('0x3b')]=_0x16ee40[_0x1e18('0x3b')][_0x1e18('0x3c')]?_0x16ee40[_0x1e18('0x3b')]:_0x4821f9[_0x1e18('0x35')];if(_0x1cae7e[_0x1e18('0x37')]['includeAll']){_0x16ee40['include']=[{'all':!![]}];}_0x16ee40=_[_0x1e18('0x42')]({},_0x16ee40,_0x1cae7e[_0x1e18('0x4b')]);return db[_0x1e18('0x30')][_0x1e18('0x4c')](_0x16ee40)[_0x1e18('0x29')](handleEntityNotFound(_0x354832,null))[_0x1e18('0x29')](respondWithResult(_0x354832,null))[_0x1e18('0x47')](handleError(_0x354832,null));};exports['create']=function(_0x54f69b,_0x54cd71){return db[_0x1e18('0x30')][_0x1e18('0x4d')](_0x54f69b[_0x1e18('0x4e')],{})[_0x1e18('0x29')](respondWithResult(_0x54cd71,0xc9))[_0x1e18('0x47')](handleError(_0x54cd71,null));};exports[_0x1e18('0x28')]=function(_0x191c18,_0x190af4){if(_0x191c18[_0x1e18('0x4e')]['id']){delete _0x191c18[_0x1e18('0x4e')]['id'];}return db[_0x1e18('0x30')][_0x1e18('0x4c')]({'where':{'id':_0x191c18[_0x1e18('0x49')]['id']}})[_0x1e18('0x29')](handleEntityNotFound(_0x190af4,null))[_0x1e18('0x29')](saveUpdates(_0x191c18[_0x1e18('0x4e')],null))[_0x1e18('0x29')](respondWithResult(_0x190af4,null))[_0x1e18('0x47')](handleError(_0x190af4,null));};exports[_0x1e18('0x2a')]=function(_0x11d573,_0x5d4cbb){return db[_0x1e18('0x30')][_0x1e18('0x4c')]({'where':{'id':_0x11d573[_0x1e18('0x49')]['id']}})[_0x1e18('0x29')](handleEntityNotFound(_0x5d4cbb,null))[_0x1e18('0x29')](removeEntity(_0x5d4cbb,null))['catch'](handleError(_0x5d4cbb,null));};exports['describe']=function(_0x16b51a,_0x30dc06){return db['JscriptyAnswerReport'][_0x1e18('0x4f')]()[_0x1e18('0x29')](respondWithResult(_0x30dc06,null))[_0x1e18('0x47')](handleError(_0x30dc06,null));}; \ No newline at end of file +var _0x102b=['find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','then','destroy','sendStatus','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x102b,0x1be));var _0xb102=function(_0xa469b0,_0x4147c5){_0xa469b0=_0xa469b0-0x0;var _0x89bacc=_0x102b[_0xa469b0];return _0x89bacc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb102('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb102('0x1'));var rp=require(_0xb102('0x2'));var moment=require(_0xb102('0x3'));var BPromise=require(_0xb102('0x4'));var Mustache=require(_0xb102('0x5'));var util=require(_0xb102('0x6'));var path=require(_0xb102('0x7'));var sox=require(_0xb102('0x8'));var csv=require('to-csv');var ejs=require(_0xb102('0x9'));var fs=require('fs');var fs_extra=require(_0xb102('0xa'));var _=require(_0xb102('0xb'));var squel=require(_0xb102('0xc'));var crypto=require(_0xb102('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb102('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb102('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb102('0x10'));var as=require(_0xb102('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb102('0x12'))(_0xb102('0x13'));var utils=require(_0xb102('0x14'));var config=require(_0xb102('0x15'));var licenseUtil=require(_0xb102('0x16'));var db=require(_0xb102('0x17'))['db'];function respondWithStatusCode(_0x3d6aef,_0x5675f8){_0x5675f8=_0x5675f8||0xcc;return function(_0x122f05){if(_0x122f05){return _0x3d6aef['sendStatus'](_0x5675f8);}return _0x3d6aef[_0xb102('0x18')](_0x5675f8)[_0xb102('0x19')]();};}function respondWithResult(_0x5ca3f2,_0x1e19ab){_0x1e19ab=_0x1e19ab||0xc8;return function(_0x38db8c){if(_0x38db8c){return _0x5ca3f2['status'](_0x1e19ab)[_0xb102('0x1a')](_0x38db8c);}};}function respondWithFilteredResult(_0x2925fb,_0x2733c7){return function(_0x49a44c){if(_0x49a44c){var _0x4fd30d=typeof _0x2733c7['offset']===_0xb102('0x1b')&&typeof _0x2733c7[_0xb102('0x1c')]===_0xb102('0x1b');var _0xc80615=_0x49a44c['count'];var _0x58d1e4=_0x4fd30d?0x0:_0x2733c7[_0xb102('0x1d')];var _0x365c54=_0x4fd30d?_0x49a44c[_0xb102('0x1e')]:_0x2733c7[_0xb102('0x1d')]+_0x2733c7['limit'];var _0x57dc37;if(_0x365c54>=_0xc80615){_0x365c54=_0xc80615;_0x57dc37=0xc8;}else{_0x57dc37=0xce;}_0x2925fb[_0xb102('0x18')](_0x57dc37);return _0x2925fb[_0xb102('0x1f')](_0xb102('0x20'),_0x58d1e4+'-'+_0x365c54+'/'+_0xc80615)[_0xb102('0x1a')](_0x49a44c);}return null;};}function patchUpdates(_0x503001){return function(_0xd2206b){try{jsonpatch[_0xb102('0x21')](_0xd2206b,_0x503001,!![]);}catch(_0xd81b8d){return BPromise[_0xb102('0x22')](_0xd81b8d);}return _0xd2206b['save']();};}function saveUpdates(_0x4964e9,_0x26571d){return function(_0x404373){if(_0x404373){return _0x404373['update'](_0x4964e9)[_0xb102('0x23')](function(_0x53f5a5){return _0x53f5a5;});}return null;};}function removeEntity(_0x2d88f0,_0x18c147){return function(_0x30cbb0){if(_0x30cbb0){return _0x30cbb0[_0xb102('0x24')]()['then'](function(){_0x2d88f0['status'](0xcc)[_0xb102('0x19')]();});}};}function handleEntityNotFound(_0x40179e,_0x39c0f3){return function(_0x428ffb){if(!_0x428ffb){_0x40179e[_0xb102('0x25')](0x194);}return _0x428ffb;};}function handleError(_0x1d0f11,_0x14c7cd){_0x14c7cd=_0x14c7cd||0x1f4;return function(_0x40f33c){logger['error'](_0x40f33c['stack']);if(_0x40f33c[_0xb102('0x26')]){delete _0x40f33c[_0xb102('0x26')];}_0x1d0f11[_0xb102('0x18')](_0x14c7cd)[_0xb102('0x27')](_0x40f33c);};}exports['index']=function(_0xebba06,_0x4d4c17){var _0x8ab193={},_0x18633e={},_0x530195={'count':0x0,'rows':[]};var _0x37d4a2=_[_0xb102('0x28')](db[_0xb102('0x29')][_0xb102('0x2a')],function(_0x28c2ea){return{'name':_0x28c2ea[_0xb102('0x2b')],'type':_0x28c2ea[_0xb102('0x2c')][_0xb102('0x2d')]};});_0x18633e[_0xb102('0x2e')]=_['map'](_0x37d4a2,_0xb102('0x26'));_0x18633e[_0xb102('0x2f')]=_[_0xb102('0x30')](_0xebba06['query']);_0x18633e[_0xb102('0x31')]=_[_0xb102('0x32')](_0x18633e[_0xb102('0x2e')],_0x18633e[_0xb102('0x2f')]);_0x8ab193['attributes']=_['intersection'](_0x18633e['model'],qs['fields'](_0xebba06[_0xb102('0x2f')][_0xb102('0x33')]));_0x8ab193['attributes']=_0x8ab193[_0xb102('0x34')][_0xb102('0x35')]?_0x8ab193[_0xb102('0x34')]:_0x18633e[_0xb102('0x2e')];if(!_0xebba06[_0xb102('0x2f')][_0xb102('0x36')](_0xb102('0x37'))){_0x8ab193[_0xb102('0x1c')]=qs[_0xb102('0x1c')](_0xebba06[_0xb102('0x2f')][_0xb102('0x1c')]);_0x8ab193[_0xb102('0x1d')]=qs[_0xb102('0x1d')](_0xebba06[_0xb102('0x2f')][_0xb102('0x1d')]);}_0x8ab193[_0xb102('0x38')]=qs['sort'](_0xebba06[_0xb102('0x2f')][_0xb102('0x39')]);_0x8ab193['where']=qs[_0xb102('0x31')](_[_0xb102('0x3a')](_0xebba06[_0xb102('0x2f')],_0x18633e[_0xb102('0x31')]),_0x37d4a2);if(_0xebba06['query'][_0xb102('0x3b')]){_0x8ab193[_0xb102('0x3c')]=_[_0xb102('0x3d')](_0x8ab193[_0xb102('0x3c')],{'$or':_[_0xb102('0x28')](_0x37d4a2,function(_0x279334){if(_0x279334[_0xb102('0x2c')]!=='VIRTUAL'){var _0x1444d9={};_0x1444d9[_0x279334[_0xb102('0x26')]]={'$like':'%'+_0xebba06['query'][_0xb102('0x3b')]+'%'};return _0x1444d9;}})});}_0x8ab193=_[_0xb102('0x3d')]({},_0x8ab193,_0xebba06[_0xb102('0x3e')]);var _0x519bb0={'where':_0x8ab193[_0xb102('0x3c')]};return db[_0xb102('0x29')]['count'](_0x519bb0)[_0xb102('0x23')](function(_0x5de7a7){_0x530195['count']=_0x5de7a7;if(_0xebba06['query'][_0xb102('0x3f')]){_0x8ab193[_0xb102('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xb102('0x41')](_0x8ab193);})[_0xb102('0x23')](function(_0x7dc750){_0x530195[_0xb102('0x42')]=_0x7dc750;return _0x530195;})[_0xb102('0x23')](respondWithFilteredResult(_0x4d4c17,_0x8ab193))[_0xb102('0x43')](handleError(_0x4d4c17,null));};exports[_0xb102('0x44')]=function(_0xbba70a,_0x131474){var _0x56d89d={'raw':!![],'where':{'id':_0xbba70a[_0xb102('0x45')]['id']}},_0x3b0fb1={};_0x3b0fb1[_0xb102('0x2e')]=_[_0xb102('0x30')](db[_0xb102('0x29')][_0xb102('0x2a')]);_0x3b0fb1['query']=_['keys'](_0xbba70a[_0xb102('0x2f')]);_0x3b0fb1[_0xb102('0x31')]=_[_0xb102('0x32')](_0x3b0fb1[_0xb102('0x2e')],_0x3b0fb1['query']);_0x56d89d['attributes']=_[_0xb102('0x32')](_0x3b0fb1[_0xb102('0x2e')],qs[_0xb102('0x33')](_0xbba70a[_0xb102('0x2f')][_0xb102('0x33')]));_0x56d89d['attributes']=_0x56d89d['attributes'][_0xb102('0x35')]?_0x56d89d[_0xb102('0x34')]:_0x3b0fb1['model'];if(_0xbba70a[_0xb102('0x2f')][_0xb102('0x3f')]){_0x56d89d['include']=[{'all':!![]}];}_0x56d89d=_['merge']({},_0x56d89d,_0xbba70a['options']);return db['JscriptyAnswerReport']['find'](_0x56d89d)[_0xb102('0x23')](handleEntityNotFound(_0x131474,null))[_0xb102('0x23')](respondWithResult(_0x131474,null))[_0xb102('0x43')](handleError(_0x131474,null));};exports['create']=function(_0x43538a,_0x1fd676){return db['JscriptyAnswerReport'][_0xb102('0x46')](_0x43538a[_0xb102('0x47')],{})['then'](respondWithResult(_0x1fd676,0xc9))[_0xb102('0x43')](handleError(_0x1fd676,null));};exports['update']=function(_0x5853c7,_0x272165){if(_0x5853c7['body']['id']){delete _0x5853c7[_0xb102('0x47')]['id'];}return db[_0xb102('0x29')][_0xb102('0x48')]({'where':{'id':_0x5853c7['params']['id']}})[_0xb102('0x23')](handleEntityNotFound(_0x272165,null))['then'](saveUpdates(_0x5853c7[_0xb102('0x47')],null))[_0xb102('0x23')](respondWithResult(_0x272165,null))[_0xb102('0x43')](handleError(_0x272165,null));};exports[_0xb102('0x24')]=function(_0x27b0c0,_0x1dc374){return db[_0xb102('0x29')][_0xb102('0x48')]({'where':{'id':_0x27b0c0['params']['id']}})[_0xb102('0x23')](handleEntityNotFound(_0x1dc374,null))[_0xb102('0x23')](removeEntity(_0x1dc374,null))['catch'](handleError(_0x1dc374,null));};exports[_0xb102('0x49')]=function(_0x574079,_0x57a04e){return db[_0xb102('0x29')]['describe']()[_0xb102('0x23')](respondWithResult(_0x57a04e,null))[_0xb102('0x43')](handleError(_0x57a04e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 51eebc5..c0d9e3c 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 _0x8ce0=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise'];(function(_0x13b556,_0x43477d){var _0x3e3df8=function(_0x29bd96){while(--_0x29bd96){_0x13b556['push'](_0x13b556['shift']());}};_0x3e3df8(++_0x43477d);}(_0x8ce0,0x18d));var _0x08ce=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x8ce0[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x08ce('0x0'));var util=require(_0x08ce('0x1'));var logger=require('../../config/logger')(_0x08ce('0x2'));var moment=require(_0x08ce('0x3'));var BPromise=require(_0x08ce('0x4'));var rp=require(_0x08ce('0x5'));var fs=require('fs');var path=require(_0x08ce('0x6'));var rimraf=require(_0x08ce('0x7'));var config=require(_0x08ce('0x8'));var attributes=require(_0x08ce('0x9'));module[_0x08ce('0xa')]=function(_0x474649,_0x46722a){return _0x474649[_0x08ce('0xb')]('JscriptyAnswerReport',attributes,{'tableName':_0x08ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e3c=['JscriptyAnswerReport','report_jscripty_answers','api','moment','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0x4e3c,0x112));var _0xc4e3=function(_0x1caf3f,_0x1b4800){_0x1caf3f=_0x1caf3f-0x0;var _0x1905f0=_0x4e3c[_0x1caf3f];return _0x1905f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc4e3('0x0'));var moment=require(_0xc4e3('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc4e3('0x2'));var attributes=require(_0xc4e3('0x3'));module[_0xc4e3('0x4')]=function(_0xb8af41,_0x20e7f7){return _0xb8af41[_0xc4e3('0x5')](_0xc4e3('0x6'),attributes,{'tableName':_0xc4e3('0x7'),'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 c525a36..0c130f5 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 _0x3481=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x3481,0xa5));var _0x1348=function(_0x456ad0,_0x36e9e1){_0x456ad0=_0x456ad0-0x0;var _0x5194f0=_0x3481[_0x456ad0];return _0x5194f0;};'use strict';var _=require(_0x1348('0x0'));var util=require(_0x1348('0x1'));var moment=require(_0x1348('0x2'));var BPromise=require(_0x1348('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1348('0x4'));var db=require(_0x1348('0x5'))['db'];var utils=require(_0x1348('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1348('0x7'));var jayson=require(_0x1348('0x8'));var client=jayson[_0x1348('0x9')][_0x1348('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xed9aad,_0x178014,_0x2349c6){return new BPromise(function(_0x5c5b08,_0x3599b7){return client[_0x1348('0xb')](_0xed9aad,_0x2349c6)['then'](function(_0x57a406){logger[_0x1348('0xc')](_0x1348('0xd'),_0x178014,_0x1348('0xe'));logger[_0x1348('0xf')](_0x1348('0x10'),_0x178014,_0x1348('0xe'),JSON[_0x1348('0x11')](_0x57a406));if(_0x57a406[_0x1348('0x12')]){if(_0x57a406[_0x1348('0x12')][_0x1348('0x13')]===0x1f4){logger[_0x1348('0x12')](_0x1348('0xd'),_0x178014,_0x57a406[_0x1348('0x12')]['message']);return _0x3599b7(_0x57a406['error']['message']);}logger[_0x1348('0x12')](_0x1348('0xd'),_0x178014,_0x57a406['error'][_0x1348('0x14')]);return _0x5c5b08(_0x57a406[_0x1348('0x12')][_0x1348('0x14')]);}else{logger['info'](_0x1348('0xd'),_0x178014,'request\x20sent');_0x5c5b08(_0x57a406[_0x1348('0x15')]['message']);}})[_0x1348('0x16')](function(_0x3f10c3){logger[_0x1348('0x12')](_0x1348('0xd'),_0x178014,_0x3f10c3);_0x3599b7(_0x3f10c3);});});} \ No newline at end of file +var _0xd4ae=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b05e4,_0x26e478){var _0x463942=function(_0x4892b5){while(--_0x4892b5){_0x5b05e4['push'](_0x5b05e4['shift']());}};_0x463942(++_0x26e478);}(_0xd4ae,0x90));var _0xed4a=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xd4ae[_0x349367];return _0x14179b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed4a('0x0'));var BPromise=require(_0xed4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xed4a('0x3'));var logger=require(_0xed4a('0x4'))(_0xed4a('0x5'));var config=require(_0xed4a('0x6'));var jayson=require(_0xed4a('0x7'));var client=jayson[_0xed4a('0x8')][_0xed4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42fc7d,_0x51fa3a,_0x10d5fd){return new BPromise(function(_0x48410c,_0x3ef449){return client[_0xed4a('0xa')](_0x42fc7d,_0x10d5fd)[_0xed4a('0xb')](function(_0x53c520){logger[_0xed4a('0xc')](_0xed4a('0xd'),_0x51fa3a,'request\x20sent');logger[_0xed4a('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x51fa3a,_0xed4a('0xf'),JSON[_0xed4a('0x10')](_0x53c520));if(_0x53c520[_0xed4a('0x11')]){if(_0x53c520[_0xed4a('0x11')][_0xed4a('0x12')]===0x1f4){logger['error'](_0xed4a('0xd'),_0x51fa3a,_0x53c520[_0xed4a('0x11')][_0xed4a('0x13')]);return _0x3ef449(_0x53c520['error']['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x51fa3a,_0x53c520[_0xed4a('0x11')][_0xed4a('0x13')]);return _0x48410c(_0x53c520[_0xed4a('0x11')]['message']);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x51fa3a,_0xed4a('0xf'));_0x48410c(_0x53c520[_0xed4a('0x14')][_0xed4a('0x13')]);}})[_0xed4a('0x15')](function(_0x580f5b){logger['error'](_0xed4a('0xd'),_0x51fa3a,_0x580f5b);_0x3ef449(_0x580f5b);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 474edaf..71af311 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 _0xa5b3=['get','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0xa5b3,0xb0));var _0x3a5b=function(_0x4d3fdc,_0x270cd6){_0x4d3fdc=_0x4d3fdc-0x0;var _0xcfe81f=_0xa5b3[_0x4d3fdc];return _0xcfe81f;};'use strict';var multer=require(_0x3a5b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3a5b('0x1'));var express=require(_0x3a5b('0x2'));var router=express['Router']();var fs_extra=require(_0x3a5b('0x3'));var auth=require(_0x3a5b('0x4'));var interaction=require(_0x3a5b('0x5'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x3a5b('0x6')](),controller[_0x3a5b('0x7')]);router[_0x3a5b('0x8')](_0x3a5b('0x9'),auth[_0x3a5b('0x6')](),controller[_0x3a5b('0xa')]);router[_0x3a5b('0x8')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x3a5b('0xb')]);router[_0x3a5b('0x8')](_0x3a5b('0xc'),auth[_0x3a5b('0x6')](),controller[_0x3a5b('0xd')]);router[_0x3a5b('0x8')](_0x3a5b('0xe'),auth[_0x3a5b('0x6')](),timeout(_0x3a5b('0xf')),controller['getSummary']);router[_0x3a5b('0x10')]('/',auth[_0x3a5b('0x6')](),controller[_0x3a5b('0x11')]);router[_0x3a5b('0x10')](_0x3a5b('0x12'),auth[_0x3a5b('0x6')](),controller[_0x3a5b('0x13')]);router['put'](_0x3a5b('0x9'),auth[_0x3a5b('0x6')](),controller[_0x3a5b('0x14')]);router[_0x3a5b('0x15')](_0x3a5b('0x9'),auth[_0x3a5b('0x6')](),controller['destroy']);module[_0x3a5b('0x16')]=router; \ No newline at end of file +var _0xa068=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','update'];(function(_0x92761d,_0xf63614){var _0x460dc5=function(_0x16a6fb){while(--_0x16a6fb){_0x92761d['push'](_0x92761d['shift']());}};_0x460dc5(++_0xf63614);}(_0xa068,0x189));var _0x8a06=function(_0x310e6a,_0x560852){_0x310e6a=_0x310e6a-0x0;var _0x52d780=_0xa068[_0x310e6a];return _0x52d780;};'use strict';var multer=require(_0x8a06('0x0'));var util=require(_0x8a06('0x1'));var path=require('path');var timeout=require(_0x8a06('0x2'));var express=require(_0x8a06('0x3'));var router=express[_0x8a06('0x4')]();var fs_extra=require(_0x8a06('0x5'));var auth=require(_0x8a06('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8a06('0x7'));var controller=require('./jscriptyProject.controller');router[_0x8a06('0x8')]('/',auth[_0x8a06('0x9')](),controller[_0x8a06('0xa')]);router[_0x8a06('0x8')](_0x8a06('0xb'),auth[_0x8a06('0x9')](),controller[_0x8a06('0xc')]);router[_0x8a06('0x8')]('/:id/sessions',auth[_0x8a06('0x9')](),controller[_0x8a06('0xd')]);router[_0x8a06('0x8')](_0x8a06('0xe'),auth[_0x8a06('0x9')](),controller[_0x8a06('0xf')]);router['get'](_0x8a06('0x10'),auth[_0x8a06('0x9')](),timeout(_0x8a06('0x11')),controller[_0x8a06('0x12')]);router[_0x8a06('0x13')]('/',auth[_0x8a06('0x9')](),controller[_0x8a06('0x14')]);router['post'](_0x8a06('0x15'),auth[_0x8a06('0x9')](),controller['clone']);router['put'](_0x8a06('0xb'),auth[_0x8a06('0x9')](),controller[_0x8a06('0x16')]);router[_0x8a06('0x17')]('/:id',auth[_0x8a06('0x9')](),controller[_0x8a06('0x18')]);module[_0x8a06('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index c9f447c..911e1fc 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 _0xcca3=['name','TEXT','long','isObjectLike','stringify','isString','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','exports','STRING'];(function(_0x19f0af,_0x53dbe2){var _0x3717c8=function(_0x3cf428){while(--_0x3cf428){_0x19f0af['push'](_0x19f0af['shift']());}};_0x3717c8(++_0x53dbe2);}(_0xcca3,0xb1));var _0x3cca=function(_0x449235,_0x567736){_0x449235=_0x449235-0x0;var _0x2446ad=_0xcca3[_0x449235];return _0x2446ad;};'use strict';var Sequelize=require(_0x3cca('0x0'));var _=require('lodash');var util=require('util');module[_0x3cca('0x1')]={'name':{'type':Sequelize[_0x3cca('0x2')],'unique':_0x3cca('0x3')},'description':{'type':Sequelize[_0x3cca('0x2')]},'formData':{'type':Sequelize[_0x3cca('0x4')](_0x3cca('0x5')),'set':function(_0x269a12){if(_[_0x3cca('0x6')](_0x269a12)){this['setDataValue']('formData',JSON[_0x3cca('0x7')](_0x269a12));}else if(_[_0x3cca('0x8')](_0x269a12)){this[_0x3cca('0x9')]('formData',_0x269a12);}else{this['setDataValue'](_0x3cca('0xa'),util[_0x3cca('0xb')](_0x3cca('0xc'),this[_0x3cca('0xd')](_0x3cca('0x3'))||'',this[_0x3cca('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3cca('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3cca('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xc11e=['long','isObjectLike','setDataValue','formData','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','exports','STRING'];(function(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0xc11e,0x110));var _0xec11=function(_0x50d16c,_0x5a452f){_0x50d16c=_0x50d16c-0x0;var _0x19bf9c=_0xc11e[_0x50d16c];return _0x19bf9c;};'use strict';var Sequelize=require(_0xec11('0x0'));var _=require('lodash');var util=require('util');module[_0xec11('0x1')]={'name':{'type':Sequelize[_0xec11('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xec11('0x2')]},'formData':{'type':Sequelize['TEXT'](_0xec11('0x3')),'set':function(_0x226a4d){if(_[_0xec11('0x4')](_0x226a4d)){this[_0xec11('0x5')](_0xec11('0x6'),JSON['stringify'](_0x226a4d));}else if(_[_0xec11('0x7')](_0x226a4d)){this[_0xec11('0x5')](_0xec11('0x6'),_0x226a4d);}else{this[_0xec11('0x5')](_0xec11('0x6'),util['format'](_0xec11('0x8'),this[_0xec11('0x9')]('name')||'',this['getDataValue'](_0xec11('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 780d243..8996f07 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 _0x6bc4=['now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','stack','name','index','JscriptyProject','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','ProjectId','JscriptySessionReport','findAll','rows','getAnswers','JscriptyAnswerReport','number','toString','indexOf','getSummary','parse','startTime','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty'];(function(_0x5b6103,_0x4e4021){var _0x172960=function(_0xfd3a97){while(--_0xfd3a97){_0x5b6103['push'](_0x5b6103['shift']());}};_0x172960(++_0x4e4021);}(_0x6bc4,0x164));var _0x46bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6bc4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46bc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46bc('0x1'));var rp=require(_0x46bc('0x2'));var moment=require(_0x46bc('0x3'));var BPromise=require(_0x46bc('0x4'));var Mustache=require(_0x46bc('0x5'));var util=require(_0x46bc('0x6'));var path=require('path');var sox=require(_0x46bc('0x7'));var csv=require(_0x46bc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46bc('0x9'));var _=require(_0x46bc('0xa'));var squel=require(_0x46bc('0xb'));var crypto=require(_0x46bc('0xc'));var jsforce=require(_0x46bc('0xd'));var deskjs=require(_0x46bc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x46bc('0xf'));var Papa=require(_0x46bc('0x10'));var Redis=require('ioredis');var authService=require(_0x46bc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x46bc('0x12'));var hardwareService=require(_0x46bc('0x13'));var logger=require('../../config/logger')(_0x46bc('0x14'));var utils=require(_0x46bc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x46bc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16daad,_0x21f3d1){_0x21f3d1=_0x21f3d1||0xcc;return function(_0x873a1a){if(_0x873a1a){return _0x16daad['sendStatus'](_0x21f3d1);}return _0x16daad[_0x46bc('0x17')](_0x21f3d1)[_0x46bc('0x18')]();};}function respondWithResult(_0x4234bd,_0x127f4b){_0x127f4b=_0x127f4b||0xc8;return function(_0x4ef996){if(_0x4ef996){return _0x4234bd[_0x46bc('0x17')](_0x127f4b)[_0x46bc('0x19')](_0x4ef996);}};}function respondWithFilteredResult(_0x442713,_0x55707a){return function(_0x3059fe){if(_0x3059fe){var _0x4f9d8b=typeof _0x55707a[_0x46bc('0x1a')]===_0x46bc('0x1b')&&typeof _0x55707a[_0x46bc('0x1c')]===_0x46bc('0x1b');var _0x42db36=_0x3059fe[_0x46bc('0x1d')];var _0x1da0ce=_0x4f9d8b?0x0:_0x55707a[_0x46bc('0x1a')];var _0x4e931f=_0x4f9d8b?_0x3059fe[_0x46bc('0x1d')]:_0x55707a[_0x46bc('0x1a')]+_0x55707a[_0x46bc('0x1c')];var _0x40942b;if(_0x4e931f>=_0x42db36){_0x4e931f=_0x42db36;_0x40942b=0xc8;}else{_0x40942b=0xce;}_0x442713['status'](_0x40942b);return _0x442713[_0x46bc('0x1e')](_0x46bc('0x1f'),_0x1da0ce+'-'+_0x4e931f+'/'+_0x42db36)[_0x46bc('0x19')](_0x3059fe);}return null;};}function patchUpdates(_0x1b89bc){return function(_0x4b5cdc){try{jsonpatch[_0x46bc('0x20')](_0x4b5cdc,_0x1b89bc,!![]);}catch(_0x18a638){return BPromise[_0x46bc('0x21')](_0x18a638);}return _0x4b5cdc[_0x46bc('0x22')]();};}function saveUpdates(_0x5b167c,_0x36ddf4){return function(_0x3dfb9e){if(_0x3dfb9e){return _0x3dfb9e[_0x46bc('0x23')](_0x5b167c)[_0x46bc('0x24')](function(_0x49d96c){return _0x49d96c;});}return null;};}function removeEntity(_0x3716d4,_0x4ba53b){return function(_0x13d7be){if(_0x13d7be){return _0x13d7be[_0x46bc('0x25')]()['then'](function(){var _0x23872b=_0x13d7be[_0x46bc('0x26')]({'plain':!![]});var _0x1fe9b5=_0x46bc('0x27');return db[_0x46bc('0x28')][_0x46bc('0x25')]({'where':{'type':_0x1fe9b5,'resourceId':_0x23872b['id']}})[_0x46bc('0x24')](function(){return _0x13d7be;});})[_0x46bc('0x24')](function(){_0x3716d4['status'](0xcc)[_0x46bc('0x18')]();});}};}function handleEntityNotFound(_0x1c5407,_0x27c1cd){return function(_0x4550a9){if(!_0x4550a9){_0x1c5407[_0x46bc('0x29')](0x194);}return _0x4550a9;};}function handleError(_0x1b91a8,_0x607ed){_0x607ed=_0x607ed||0x1f4;return function(_0x48d3c9){logger['error'](_0x48d3c9[_0x46bc('0x2a')]);if(_0x48d3c9[_0x46bc('0x2b')]){delete _0x48d3c9[_0x46bc('0x2b')];}_0x1b91a8['status'](_0x607ed)['send'](_0x48d3c9);};}exports[_0x46bc('0x2c')]=function(_0x5c0a06,_0x852d55){var _0x46d2e2={},_0x723c2b={},_0x242a11={'count':0x0,'rows':[]};var _0x51963e=_['map'](db[_0x46bc('0x2d')][_0x46bc('0x2e')],function(_0x489d35){return{'name':_0x489d35[_0x46bc('0x2f')],'type':_0x489d35[_0x46bc('0x30')]['key']};});_0x723c2b[_0x46bc('0x31')]=_[_0x46bc('0x32')](_0x51963e,_0x46bc('0x2b'));_0x723c2b[_0x46bc('0x33')]=_[_0x46bc('0x34')](_0x5c0a06[_0x46bc('0x33')]);_0x723c2b[_0x46bc('0x35')]=_[_0x46bc('0x36')](_0x723c2b['model'],_0x723c2b[_0x46bc('0x33')]);_0x46d2e2[_0x46bc('0x37')]=_['intersection'](_0x723c2b[_0x46bc('0x31')],qs[_0x46bc('0x38')](_0x5c0a06[_0x46bc('0x33')][_0x46bc('0x38')]));_0x46d2e2[_0x46bc('0x37')]=_0x46d2e2[_0x46bc('0x37')][_0x46bc('0x39')]?_0x46d2e2[_0x46bc('0x37')]:_0x723c2b[_0x46bc('0x31')];if(!_0x5c0a06[_0x46bc('0x33')][_0x46bc('0x3a')]('nolimit')){_0x46d2e2[_0x46bc('0x1c')]=qs[_0x46bc('0x1c')](_0x5c0a06['query']['limit']);_0x46d2e2['offset']=qs[_0x46bc('0x1a')](_0x5c0a06[_0x46bc('0x33')][_0x46bc('0x1a')]);}_0x46d2e2[_0x46bc('0x3b')]=qs['sort'](_0x5c0a06['query'][_0x46bc('0x3c')]);_0x46d2e2[_0x46bc('0x3d')]=qs[_0x46bc('0x35')](_[_0x46bc('0x3e')](_0x5c0a06[_0x46bc('0x33')],_0x723c2b[_0x46bc('0x35')]),_0x51963e);if(_0x5c0a06[_0x46bc('0x33')][_0x46bc('0x3f')]){_0x46d2e2[_0x46bc('0x3d')]=_[_0x46bc('0x40')](_0x46d2e2[_0x46bc('0x3d')],{'$or':_[_0x46bc('0x32')](_0x51963e,function(_0x4c40c3){if(_0x4c40c3['type']!==_0x46bc('0x41')){var _0x3c16a6={};_0x3c16a6[_0x4c40c3[_0x46bc('0x2b')]]={'$like':'%'+_0x5c0a06[_0x46bc('0x33')][_0x46bc('0x3f')]+'%'};return _0x3c16a6;}})});}_0x46d2e2=_[_0x46bc('0x40')]({},_0x46d2e2,_0x5c0a06[_0x46bc('0x42')]);var _0xcd6500={'where':_0x46d2e2[_0x46bc('0x3d')]};return db[_0x46bc('0x2d')][_0x46bc('0x1d')](_0xcd6500)[_0x46bc('0x24')](function(_0x1494f2){_0x242a11[_0x46bc('0x1d')]=_0x1494f2;if(_0x5c0a06[_0x46bc('0x33')][_0x46bc('0x43')]){_0x46d2e2[_0x46bc('0x44')]=[{'all':!![]}];}return db[_0x46bc('0x2d')]['findAll'](_0x46d2e2);})[_0x46bc('0x24')](function(_0x21c24d){_0x242a11['rows']=_0x21c24d;return _0x242a11;})[_0x46bc('0x24')](respondWithFilteredResult(_0x852d55,_0x46d2e2))[_0x46bc('0x45')](handleError(_0x852d55,null));};exports[_0x46bc('0x46')]=function(_0x4c1e8b,_0x1e8685){var _0xc8ae19={'raw':![],'where':{'id':_0x4c1e8b[_0x46bc('0x47')]['id']}},_0x58b2b2={};_0x58b2b2[_0x46bc('0x31')]=_['keys'](db['JscriptyProject'][_0x46bc('0x2e')]);_0x58b2b2[_0x46bc('0x33')]=_['keys'](_0x4c1e8b['query']);_0x58b2b2[_0x46bc('0x35')]=_[_0x46bc('0x36')](_0x58b2b2[_0x46bc('0x31')],_0x58b2b2[_0x46bc('0x33')]);_0xc8ae19[_0x46bc('0x37')]=_[_0x46bc('0x36')](_0x58b2b2['model'],qs['fields'](_0x4c1e8b[_0x46bc('0x33')][_0x46bc('0x38')]));_0xc8ae19[_0x46bc('0x37')]=_0xc8ae19[_0x46bc('0x37')][_0x46bc('0x39')]?_0xc8ae19[_0x46bc('0x37')]:_0x58b2b2[_0x46bc('0x31')];if(_0x4c1e8b[_0x46bc('0x33')][_0x46bc('0x43')]){_0xc8ae19['include']=[{'all':!![]}];}_0xc8ae19=_[_0x46bc('0x40')]({},_0xc8ae19,_0x4c1e8b[_0x46bc('0x42')]);return db[_0x46bc('0x2d')]['find'](_0xc8ae19)[_0x46bc('0x24')](handleEntityNotFound(_0x1e8685,null))[_0x46bc('0x24')](respondWithResult(_0x1e8685,null))[_0x46bc('0x45')](handleError(_0x1e8685,null));};exports[_0x46bc('0x48')]=function(_0x3f7fbb,_0x5b9c92){return db['JscriptyProject']['create'](_0x3f7fbb[_0x46bc('0x49')],{})[_0x46bc('0x24')](function(_0x31af37){var _0x216a73=_0x3f7fbb[_0x46bc('0x4a')]['get']({'plain':!![]});if(!_0x216a73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x216a73[_0x46bc('0x4b')]===_0x46bc('0x4a')){var _0x2b275f=_0x31af37['get']({'plain':!![]});var _0x4853d3=_0x46bc('0x27');return db[_0x46bc('0x4c')][_0x46bc('0x4d')]({'where':{'name':_0x4853d3,'userProfileId':_0x216a73[_0x46bc('0x4e')]},'raw':!![]})[_0x46bc('0x24')](function(_0x4ad406){if(_0x4ad406&&_0x4ad406[_0x46bc('0x4f')]===0x0){return db[_0x46bc('0x28')][_0x46bc('0x48')]({'name':_0x2b275f[_0x46bc('0x2b')],'resourceId':_0x2b275f['id'],'type':_0x4ad406[_0x46bc('0x2b')],'sectionId':_0x4ad406['id']},{})[_0x46bc('0x24')](function(){return _0x31af37;});}else{return _0x31af37;}})[_0x46bc('0x45')](function(_0x2bc2ee){logger[_0x46bc('0x50')](_0x46bc('0x51'),_0x2bc2ee);throw _0x2bc2ee;});}return _0x31af37;})[_0x46bc('0x24')](respondWithResult(_0x5b9c92,0xc9))[_0x46bc('0x45')](handleError(_0x5b9c92,null));};exports[_0x46bc('0x52')]=function(_0x4192e3,_0x104382){var _0x587439={'where':{'id':_0x4192e3[_0x46bc('0x47')]['id']}},_0x44cca3={};_0x44cca3[_0x46bc('0x31')]=_[_0x46bc('0x34')](db['JscriptyProject'][_0x46bc('0x2e')]);_0x587439[_0x46bc('0x37')]=_[_0x46bc('0x36')](_0x44cca3[_0x46bc('0x31')],qs[_0x46bc('0x38')](_0x4192e3['query'][_0x46bc('0x38')]));_0x587439['attributes']=_0x587439[_0x46bc('0x37')][_0x46bc('0x39')]?_0x587439[_0x46bc('0x37')]:_0x44cca3['model'];if(_0x4192e3[_0x46bc('0x33')][_0x46bc('0x43')]){_0x587439[_0x46bc('0x44')]=[{'all':!![]}];}_0x587439=_[_0x46bc('0x40')]({},_0x587439,_0x4192e3[_0x46bc('0x42')]);return db[_0x46bc('0x2d')]['find'](_0x587439)[_0x46bc('0x24')](handleEntityNotFound(_0x104382,null))[_0x46bc('0x24')](function(_0x284e76){if(_0x284e76){var _0x35aabf=_0x284e76[_0x46bc('0x26')]({'plain':!![]});_0x35aabf=qs[_0x46bc('0x53')](_0x35aabf,['id','createdAt',_0x46bc('0x54')]);_0x4192e3['body']=_[_0x46bc('0x53')](_0x4192e3[_0x46bc('0x49')],['id',_0x46bc('0x55'),_0x46bc('0x54')]);return db['JscriptyProject'][_0x46bc('0x48')](_['merge'](_0x35aabf,_0x4192e3[_0x46bc('0x49')]),{'include':_0x4192e3[_0x46bc('0x33')][_0x46bc('0x43')]?[{'all':!![]}]:undefined})[_0x46bc('0x24')](function(_0x1fbd56){var _0x2c565b=_0x4192e3[_0x46bc('0x4a')][_0x46bc('0x26')]({'plain':!![]});if(!_0x2c565b)throw new Error(_0x46bc('0x56'));if(_0x2c565b['role']===_0x46bc('0x4a')){var _0x258aec=_0x1fbd56[_0x46bc('0x26')]({'plain':!![]});var _0x1cb492='Projects';return db[_0x46bc('0x4c')]['find']({'where':{'name':_0x1cb492,'userProfileId':_0x2c565b[_0x46bc('0x4e')]},'raw':!![]})['then'](function(_0x40fee4){if(_0x40fee4&&_0x40fee4[_0x46bc('0x4f')]===0x0){return db['UserProfileResource'][_0x46bc('0x48')]({'name':_0x258aec[_0x46bc('0x2b')],'resourceId':_0x258aec['id'],'type':_0x40fee4[_0x46bc('0x2b')],'sectionId':_0x40fee4['id']},{})[_0x46bc('0x24')](function(){return _0x1fbd56;});}else{return _0x1fbd56;}})[_0x46bc('0x45')](function(_0x15bb4a){logger[_0x46bc('0x50')](_0x46bc('0x51'),_0x15bb4a);throw _0x15bb4a;});}return _0x1fbd56;});}})[_0x46bc('0x24')](respondWithResult(_0x104382,0xc9))[_0x46bc('0x45')](handleError(_0x104382,null));};exports[_0x46bc('0x23')]=function(_0x1a93f0,_0x21e56b){if(_0x1a93f0['body']['id']){delete _0x1a93f0[_0x46bc('0x49')]['id'];}return db[_0x46bc('0x2d')][_0x46bc('0x4d')]({'where':{'id':_0x1a93f0[_0x46bc('0x47')]['id']}})[_0x46bc('0x24')](handleEntityNotFound(_0x21e56b,null))[_0x46bc('0x24')](saveUpdates(_0x1a93f0[_0x46bc('0x49')],null))[_0x46bc('0x24')](respondWithResult(_0x21e56b,null))[_0x46bc('0x45')](handleError(_0x21e56b,null));};exports[_0x46bc('0x25')]=function(_0x215526,_0x558736){return db[_0x46bc('0x2d')][_0x46bc('0x4d')]({'where':{'id':_0x215526[_0x46bc('0x47')]['id']}})[_0x46bc('0x24')](handleEntityNotFound(_0x558736,null))['then'](removeEntity(_0x558736,null))[_0x46bc('0x45')](handleError(_0x558736,null));};exports[_0x46bc('0x57')]=function(_0x379697,_0xa6eda4,_0x4149aa){var _0x38661c={'raw':!![],'where':{}};var _0x1aa90d={};var _0x2dca0e={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x46bc('0x58')]({'where':{'id':_0x379697['params']['id']}})[_0x46bc('0x24')](handleEntityNotFound(_0xa6eda4,null))['then'](function(_0x36378f){if(_0x36378f){_0x1aa90d['model']=_[_0x46bc('0x34')](db['JscriptySessionReport'][_0x46bc('0x2e')]);_0x1aa90d[_0x46bc('0x33')]=_['keys'](_0x379697[_0x46bc('0x33')]);_0x1aa90d[_0x46bc('0x35')]=_[_0x46bc('0x36')](_0x1aa90d['model'],_0x1aa90d[_0x46bc('0x33')]);_0x38661c[_0x46bc('0x37')]=_[_0x46bc('0x36')](_0x1aa90d[_0x46bc('0x31')],qs[_0x46bc('0x38')](_0x379697[_0x46bc('0x33')][_0x46bc('0x38')]));_0x38661c[_0x46bc('0x37')]=_0x38661c['attributes']['length']?_0x38661c['attributes']:_0x1aa90d[_0x46bc('0x31')];if(!_0x379697[_0x46bc('0x33')]['hasOwnProperty']('nolimit')){_0x38661c['limit']=qs[_0x46bc('0x1c')](_0x379697[_0x46bc('0x33')][_0x46bc('0x1c')]);_0x38661c[_0x46bc('0x1a')]=qs[_0x46bc('0x1a')](_0x379697[_0x46bc('0x33')][_0x46bc('0x1a')]);}_0x38661c[_0x46bc('0x3b')]=qs[_0x46bc('0x3c')](_0x379697['query'][_0x46bc('0x3c')]);_0x38661c['where']=qs[_0x46bc('0x35')](_['pick'](_0x379697[_0x46bc('0x33')],_0x1aa90d[_0x46bc('0x35')]));_0x38661c[_0x46bc('0x3d')][_0x46bc('0x59')]=_0x36378f['id'];if(_0x379697['query'][_0x46bc('0x3f')]){_0x38661c[_0x46bc('0x3d')]=_[_0x46bc('0x40')](_0x38661c[_0x46bc('0x3d')],{'$or':_['map'](_0x38661c[_0x46bc('0x37')],function(_0x5ddfa4){var _0x52e534={};_0x52e534[_0x5ddfa4]={'$like':'%'+_0x379697[_0x46bc('0x33')][_0x46bc('0x3f')]+'%'};return _0x52e534;})});}_0x38661c=_[_0x46bc('0x40')]({},_0x38661c,_0x379697[_0x46bc('0x42')]);return db[_0x46bc('0x5a')]['count']({'where':_0x38661c[_0x46bc('0x3d')]})['then'](function(_0x534e12){_0x2dca0e['count']=_0x534e12;if(_0x379697[_0x46bc('0x33')][_0x46bc('0x43')]){_0x38661c[_0x46bc('0x44')]=[{'all':!![]}];}return db[_0x46bc('0x5a')][_0x46bc('0x5b')](_0x38661c);})['then'](function(_0x408d9a){_0x2dca0e[_0x46bc('0x5c')]=_0x408d9a;return _0x2dca0e;});}})[_0x46bc('0x24')](respondWithFilteredResult(_0xa6eda4,_0x38661c))[_0x46bc('0x45')](handleError(_0xa6eda4,null));};exports[_0x46bc('0x5d')]=function(_0xa8ace4,_0x4e5d4a,_0x5f5623){var _0x5d0bdb={'raw':!![],'where':{}};var _0x407a14={};var _0x358dfb={'count':0x0,'rows':[]};return db[_0x46bc('0x2d')][_0x46bc('0x58')]({'where':{'id':_0xa8ace4['params']['id']}})[_0x46bc('0x24')](handleEntityNotFound(_0x4e5d4a,null))[_0x46bc('0x24')](function(_0x5b3d49){if(_0x5b3d49){_0x407a14[_0x46bc('0x31')]=_[_0x46bc('0x34')](db[_0x46bc('0x5e')][_0x46bc('0x2e')]);_0x407a14[_0x46bc('0x33')]=_[_0x46bc('0x34')](_0xa8ace4['query']);_0x407a14[_0x46bc('0x35')]=_[_0x46bc('0x36')](_0x407a14['model'],_0x407a14[_0x46bc('0x33')]);_0x5d0bdb[_0x46bc('0x37')]=_[_0x46bc('0x36')](_0x407a14['model'],qs[_0x46bc('0x38')](_0xa8ace4[_0x46bc('0x33')][_0x46bc('0x38')]));_0x5d0bdb[_0x46bc('0x37')]=_0x5d0bdb['attributes'][_0x46bc('0x39')]?_0x5d0bdb[_0x46bc('0x37')]:_0x407a14['model'];if(!_0xa8ace4[_0x46bc('0x33')]['hasOwnProperty']('nolimit')){_0x5d0bdb[_0x46bc('0x1c')]=qs[_0x46bc('0x1c')](_0xa8ace4[_0x46bc('0x33')][_0x46bc('0x1c')]);_0x5d0bdb[_0x46bc('0x1a')]=qs['offset'](_0xa8ace4[_0x46bc('0x33')][_0x46bc('0x1a')]);}_0x5d0bdb[_0x46bc('0x3b')]=qs[_0x46bc('0x3c')](_0xa8ace4[_0x46bc('0x33')][_0x46bc('0x3c')]);_0x5d0bdb['where']=qs[_0x46bc('0x35')](_[_0x46bc('0x3e')](_0xa8ace4[_0x46bc('0x33')],_0x407a14[_0x46bc('0x35')]));_0x5d0bdb[_0x46bc('0x3d')][_0x46bc('0x59')]=_0x5b3d49['id'];if(_0xa8ace4['query'][_0x46bc('0x3f')]){_0x5d0bdb[_0x46bc('0x3d')]=_['merge'](_0x5d0bdb[_0x46bc('0x3d')],{'$or':_[_0x46bc('0x32')](_0x5d0bdb['attributes'],function(_0x26704c){var _0xb09e75={};_0xb09e75[_0x26704c]={'$like':'%'+_0xa8ace4[_0x46bc('0x33')][_0x46bc('0x3f')]+'%'};return _0xb09e75;})});}_0x5d0bdb=_[_0x46bc('0x40')]({},_0x5d0bdb,_0xa8ace4['options']);return db['JscriptyAnswerReport'][_0x46bc('0x1d')]({'where':_0x5d0bdb[_0x46bc('0x3d')]})['then'](function(_0x377768){_0x358dfb['count']=_0x377768;if(_0xa8ace4['query'][_0x46bc('0x43')]){_0x5d0bdb[_0x46bc('0x44')]=[{'all':!![]}];}return db[_0x46bc('0x5e')][_0x46bc('0x5b')](_0x5d0bdb);})[_0x46bc('0x24')](function(_0x41f429){_0x358dfb[_0x46bc('0x5c')]=_0x41f429;return _0x358dfb;});}})['then'](respondWithFilteredResult(_0x4e5d4a,_0x5d0bdb))[_0x46bc('0x45')](handleError(_0x4e5d4a,null));};function char(_0x1ec55c){return _0x46bc('0x5f')===typeof _0x1ec55c?String['fromCharCode'][_0x46bc('0x20')](null,arguments):_0x1ec55c;}function needsEncapsulation(_0x1e512b){return!!_0x1e512b&&(_0x1e512b[_0x46bc('0x60')]()[_0x46bc('0x61')](char(0xd))>=0x0||_0x1e512b['toString']()[_0x46bc('0x61')](char(0xa))>=0x0||_0x1e512b[_0x46bc('0x60')]()['indexOf'](char(0x2c))>=0x0||_0x1e512b[_0x46bc('0x60')]()[_0x46bc('0x61')](char(0x22))>=0x0);}function encapsulate(_0x332b10){var _0x5065df=char(0x22),_0x4e0fa8='\x5c'+char(0x22),_0x45f05b=_0x332b10[_0x46bc('0x60')]()['replace'](new RegExp(_0x5065df,'g'),_0x4e0fa8);return _0x5065df+_0x45f05b+_0x5065df;}exports[_0x46bc('0x62')]=function(_0x20caf5,_0x4caee0,_0x3a8d7d){var _0x1afb62,_0xab433c;var _0x59532c={'where':{'ProjectId':_0x20caf5[_0x46bc('0x47')]['id']}};if(_0x20caf5[_0x46bc('0x33')]['startTime']){_0x59532c[_0x46bc('0x3d')]['starttime']=JSON[_0x46bc('0x63')](_0x20caf5[_0x46bc('0x33')][_0x46bc('0x64')]);}return db[_0x46bc('0x5a')][_0x46bc('0x5b')](_0x59532c)['then'](handleEntityNotFound(_0x4caee0,null))[_0x46bc('0x24')](function(_0xdf2ba1){if(_0xdf2ba1){_0x1afb62=_0xdf2ba1;return db['JscriptyQuestionReport'][_0x46bc('0x5b')]({'where':{'SessionId':{'$in':_[_0x46bc('0x32')](_0x1afb62,'id')},'ProjectId':_0x20caf5['params']['id']},'order':_0x46bc('0x65')});}})[_0x46bc('0x24')](handleEntityNotFound(_0x4caee0,null))['then'](function(_0x5d7779){if(_0x5d7779){_0xab433c=_0x5d7779;var _0x1e8b21={};for(var _0xf1d608=0x0,_0x2ffc6b=_0xab433c[_0x46bc('0x39')];_0xf1d608<_0x2ffc6b;_0xf1d608++){if(!_0x1e8b21[_0x46bc('0x3a')](_0xab433c[_0xf1d608][_0x46bc('0x66')])){_0x1e8b21[_0xab433c[_0xf1d608][_0x46bc('0x66')]]=needsEncapsulation(_0xab433c[_0xf1d608]['question'])?encapsulate(_0xab433c[_0xf1d608][_0x46bc('0x67')]):_0xab433c[_0xf1d608][_0x46bc('0x67')];}}var _0x33fdaf=[],_0x24c8cd={};for(var _0x38d0c1=0x0,_0x1ebf4f=_0x1afb62[_0x46bc('0x39')];_0x38d0c1<_0x1ebf4f;_0x38d0c1++){_0x24c8cd={'ProjectId':_0x20caf5[_0x46bc('0x47')]['id'],'SessionId':_0x1afb62[_0x38d0c1]['id'],'StartTime':moment(_0x1afb62[_0x38d0c1]['starttime'])['format'](_0x46bc('0x68'))};for(var _0x45125b=0x0,_0x502fdc=_0xab433c[_0x46bc('0x39')];_0x45125b<_0x502fdc;_0x45125b++){if(_0xab433c[_0x45125b][_0x46bc('0x69')]==_0x1afb62[_0x38d0c1]['id']&&_0x1e8b21[_0x46bc('0x3a')](_0xab433c[_0x45125b]['questionId'])){_0x24c8cd[_0x1e8b21[_0xab433c[_0x45125b][_0x46bc('0x66')]]]=_0xab433c[_0x45125b][_0x46bc('0x6a')];}}for(var _0x35b27c in _0x1e8b21){if(!_0x24c8cd[_0x46bc('0x3a')](_0x1e8b21[_0x35b27c])){_0x24c8cd[_0x1e8b21[_0x35b27c]]=null;}}_0x33fdaf['push'](_0x24c8cd);}return _0x33fdaf;}})[_0x46bc('0x24')](function(_0x40996b){if(!_[_0x46bc('0x6b')](_0x40996b)){var _0x5577a9=toCsv(_0x40996b);var _0x4d0787=Date[_0x46bc('0x6c')]();fs['writeFileSync'](util[_0x46bc('0x6d')](_0x46bc('0x6e'),_0x20caf5[_0x46bc('0x47')]['id'],_0x4d0787),_0x5577a9);_0x4caee0[_0x46bc('0x6f')](_0x46bc('0x70'),_0x46bc('0x71')+util[_0x46bc('0x6d')](_0x46bc('0x72'),_0x20caf5[_0x46bc('0x47')]['id'],_0x4d0787));_0x4caee0[_0x46bc('0x6f')]('Content-type',_0x46bc('0x73'));return _0x4caee0['download'](util[_0x46bc('0x6d')](_0x46bc('0x6e'),_0x20caf5[_0x46bc('0x47')]['id'],_0x4d0787));}else{return _0x4caee0[_0x46bc('0x29')](0xcc);}})[_0x46bc('0x45')](handleError(_0x4caee0,null));}; \ No newline at end of file +var _0xb0d4=['text/csv','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','Projects','UserProfileResource','destroy','stack','name','index','JscriptyProject','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','merge','omit','createdAt','updatedAt','autoAssociation','error','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type'];(function(_0x49b48a,_0x22b01f){var _0x738495=function(_0x189c8f){while(--_0x189c8f){_0x49b48a['push'](_0x49b48a['shift']());}};_0x738495(++_0x22b01f);}(_0xb0d4,0x1e1));var _0x4b0d=function(_0x3599f0,_0x3000e0){_0x3599f0=_0x3599f0-0x0;var _0xa9a4f5=_0xb0d4[_0x3599f0];return _0xa9a4f5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4b0d('0x0'));var jsonpatch=require(_0x4b0d('0x1'));var rp=require(_0x4b0d('0x2'));var moment=require(_0x4b0d('0x3'));var BPromise=require(_0x4b0d('0x4'));var Mustache=require(_0x4b0d('0x5'));var util=require(_0x4b0d('0x6'));var path=require('path');var sox=require(_0x4b0d('0x7'));var csv=require(_0x4b0d('0x8'));var ejs=require(_0x4b0d('0x9'));var fs=require('fs');var fs_extra=require(_0x4b0d('0xa'));var _=require(_0x4b0d('0xb'));var squel=require(_0x4b0d('0xc'));var crypto=require(_0x4b0d('0xd'));var jsforce=require(_0x4b0d('0xe'));var deskjs=require(_0x4b0d('0xf'));var toCsv=require(_0x4b0d('0x8'));var querystring=require('querystring');var Papa=require(_0x4b0d('0x10'));var Redis=require('ioredis');var authService=require(_0x4b0d('0x11'));var qs=require(_0x4b0d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b0d('0x13'));var logger=require(_0x4b0d('0x14'))('api');var utils=require(_0x4b0d('0x15'));var config=require(_0x4b0d('0x16'));var licenseUtil=require(_0x4b0d('0x17'));var db=require(_0x4b0d('0x18'))['db'];function respondWithStatusCode(_0x3fd0be,_0x3f8efb){_0x3f8efb=_0x3f8efb||0xcc;return function(_0x5990b8){if(_0x5990b8){return _0x3fd0be[_0x4b0d('0x19')](_0x3f8efb);}return _0x3fd0be[_0x4b0d('0x1a')](_0x3f8efb)['end']();};}function respondWithResult(_0x377a08,_0x3865ed){_0x3865ed=_0x3865ed||0xc8;return function(_0x1919a3){if(_0x1919a3){return _0x377a08[_0x4b0d('0x1a')](_0x3865ed)[_0x4b0d('0x1b')](_0x1919a3);}};}function respondWithFilteredResult(_0x526700,_0x494844){return function(_0x4b008b){if(_0x4b008b){var _0x2aec2f=typeof _0x494844['offset']===_0x4b0d('0x1c')&&typeof _0x494844[_0x4b0d('0x1d')]===_0x4b0d('0x1c');var _0x50a0b2=_0x4b008b['count'];var _0x3f14c9=_0x2aec2f?0x0:_0x494844[_0x4b0d('0x1e')];var _0x4aa1df=_0x2aec2f?_0x4b008b[_0x4b0d('0x1f')]:_0x494844['offset']+_0x494844[_0x4b0d('0x1d')];var _0x140f13;if(_0x4aa1df>=_0x50a0b2){_0x4aa1df=_0x50a0b2;_0x140f13=0xc8;}else{_0x140f13=0xce;}_0x526700[_0x4b0d('0x1a')](_0x140f13);return _0x526700[_0x4b0d('0x20')](_0x4b0d('0x21'),_0x3f14c9+'-'+_0x4aa1df+'/'+_0x50a0b2)[_0x4b0d('0x1b')](_0x4b008b);}return null;};}function patchUpdates(_0x227c25){return function(_0x369072){try{jsonpatch[_0x4b0d('0x22')](_0x369072,_0x227c25,!![]);}catch(_0x3b2786){return BPromise[_0x4b0d('0x23')](_0x3b2786);}return _0x369072[_0x4b0d('0x24')]();};}function saveUpdates(_0x5b3a8a,_0x515c1b){return function(_0x48e28b){if(_0x48e28b){return _0x48e28b[_0x4b0d('0x25')](_0x5b3a8a)[_0x4b0d('0x26')](function(_0x301ca5){return _0x301ca5;});}return null;};}function removeEntity(_0x2be178,_0x3ccc22){return function(_0x57d1be){if(_0x57d1be){return _0x57d1be['destroy']()[_0x4b0d('0x26')](function(){var _0x13008b=_0x57d1be['get']({'plain':!![]});var _0x227e5e=_0x4b0d('0x27');return db[_0x4b0d('0x28')][_0x4b0d('0x29')]({'where':{'type':_0x227e5e,'resourceId':_0x13008b['id']}})['then'](function(){return _0x57d1be;});})[_0x4b0d('0x26')](function(){_0x2be178[_0x4b0d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8ffc,_0x421f50){return function(_0x15def5){if(!_0x15def5){_0x3a8ffc[_0x4b0d('0x19')](0x194);}return _0x15def5;};}function handleError(_0x248f16,_0x65d675){_0x65d675=_0x65d675||0x1f4;return function(_0x1a4ca4){logger['error'](_0x1a4ca4[_0x4b0d('0x2a')]);if(_0x1a4ca4['name']){delete _0x1a4ca4[_0x4b0d('0x2b')];}_0x248f16[_0x4b0d('0x1a')](_0x65d675)['send'](_0x1a4ca4);};}exports[_0x4b0d('0x2c')]=function(_0x5d3c0d,_0x27f657){var _0x1de93e={},_0x33d94b={},_0x1356d7={'count':0x0,'rows':[]};var _0x1074f4=_['map'](db[_0x4b0d('0x2d')][_0x4b0d('0x2e')],function(_0x319956){return{'name':_0x319956[_0x4b0d('0x2f')],'type':_0x319956[_0x4b0d('0x30')][_0x4b0d('0x31')]};});_0x33d94b['model']=_[_0x4b0d('0x32')](_0x1074f4,_0x4b0d('0x2b'));_0x33d94b[_0x4b0d('0x33')]=_['keys'](_0x5d3c0d[_0x4b0d('0x33')]);_0x33d94b[_0x4b0d('0x34')]=_['intersection'](_0x33d94b[_0x4b0d('0x35')],_0x33d94b[_0x4b0d('0x33')]);_0x1de93e[_0x4b0d('0x36')]=_[_0x4b0d('0x37')](_0x33d94b['model'],qs[_0x4b0d('0x38')](_0x5d3c0d[_0x4b0d('0x33')][_0x4b0d('0x38')]));_0x1de93e['attributes']=_0x1de93e[_0x4b0d('0x36')]['length']?_0x1de93e[_0x4b0d('0x36')]:_0x33d94b[_0x4b0d('0x35')];if(!_0x5d3c0d[_0x4b0d('0x33')][_0x4b0d('0x39')](_0x4b0d('0x3a'))){_0x1de93e['limit']=qs[_0x4b0d('0x1d')](_0x5d3c0d[_0x4b0d('0x33')][_0x4b0d('0x1d')]);_0x1de93e[_0x4b0d('0x1e')]=qs[_0x4b0d('0x1e')](_0x5d3c0d[_0x4b0d('0x33')][_0x4b0d('0x1e')]);}_0x1de93e[_0x4b0d('0x3b')]=qs[_0x4b0d('0x3c')](_0x5d3c0d[_0x4b0d('0x33')]['sort']);_0x1de93e[_0x4b0d('0x3d')]=qs[_0x4b0d('0x34')](_[_0x4b0d('0x3e')](_0x5d3c0d['query'],_0x33d94b[_0x4b0d('0x34')]),_0x1074f4);if(_0x5d3c0d['query'][_0x4b0d('0x3f')]){_0x1de93e[_0x4b0d('0x3d')]=_['merge'](_0x1de93e[_0x4b0d('0x3d')],{'$or':_['map'](_0x1074f4,function(_0x9c962){if(_0x9c962['type']!=='VIRTUAL'){var _0x2bffae={};_0x2bffae[_0x9c962[_0x4b0d('0x2b')]]={'$like':'%'+_0x5d3c0d[_0x4b0d('0x33')]['filter']+'%'};return _0x2bffae;}})});}_0x1de93e=_['merge']({},_0x1de93e,_0x5d3c0d[_0x4b0d('0x40')]);var _0x160878={'where':_0x1de93e[_0x4b0d('0x3d')]};return db[_0x4b0d('0x2d')]['count'](_0x160878)['then'](function(_0x2548a8){_0x1356d7[_0x4b0d('0x1f')]=_0x2548a8;if(_0x5d3c0d[_0x4b0d('0x33')][_0x4b0d('0x41')]){_0x1de93e[_0x4b0d('0x42')]=[{'all':!![]}];}return db[_0x4b0d('0x2d')][_0x4b0d('0x43')](_0x1de93e);})[_0x4b0d('0x26')](function(_0x26942e){_0x1356d7[_0x4b0d('0x44')]=_0x26942e;return _0x1356d7;})['then'](respondWithFilteredResult(_0x27f657,_0x1de93e))['catch'](handleError(_0x27f657,null));};exports[_0x4b0d('0x45')]=function(_0x2d1f5a,_0x2dc08f){var _0x4440ec={'raw':![],'where':{'id':_0x2d1f5a[_0x4b0d('0x46')]['id']}},_0x1e7221={};_0x1e7221['model']=_['keys'](db[_0x4b0d('0x2d')][_0x4b0d('0x2e')]);_0x1e7221['query']=_[_0x4b0d('0x47')](_0x2d1f5a[_0x4b0d('0x33')]);_0x1e7221[_0x4b0d('0x34')]=_[_0x4b0d('0x37')](_0x1e7221[_0x4b0d('0x35')],_0x1e7221[_0x4b0d('0x33')]);_0x4440ec[_0x4b0d('0x36')]=_[_0x4b0d('0x37')](_0x1e7221[_0x4b0d('0x35')],qs[_0x4b0d('0x38')](_0x2d1f5a[_0x4b0d('0x33')][_0x4b0d('0x38')]));_0x4440ec[_0x4b0d('0x36')]=_0x4440ec[_0x4b0d('0x36')][_0x4b0d('0x48')]?_0x4440ec[_0x4b0d('0x36')]:_0x1e7221[_0x4b0d('0x35')];if(_0x2d1f5a['query']['includeAll']){_0x4440ec[_0x4b0d('0x42')]=[{'all':!![]}];}_0x4440ec=_['merge']({},_0x4440ec,_0x2d1f5a[_0x4b0d('0x40')]);return db[_0x4b0d('0x2d')][_0x4b0d('0x49')](_0x4440ec)['then'](handleEntityNotFound(_0x2dc08f,null))[_0x4b0d('0x26')](respondWithResult(_0x2dc08f,null))[_0x4b0d('0x4a')](handleError(_0x2dc08f,null));};exports[_0x4b0d('0x4b')]=function(_0x30757a,_0x148380){return db[_0x4b0d('0x2d')][_0x4b0d('0x4b')](_0x30757a[_0x4b0d('0x4c')],{})[_0x4b0d('0x26')](function(_0x209af1){var _0x1a84d2=_0x30757a[_0x4b0d('0x4d')][_0x4b0d('0x4e')]({'plain':!![]});if(!_0x1a84d2)throw new Error(_0x4b0d('0x4f'));if(_0x1a84d2[_0x4b0d('0x50')]==='user'){var _0x7ffa4a=_0x209af1[_0x4b0d('0x4e')]({'plain':!![]});var _0x41b2f6=_0x4b0d('0x27');return db[_0x4b0d('0x51')][_0x4b0d('0x49')]({'where':{'name':_0x41b2f6,'userProfileId':_0x1a84d2[_0x4b0d('0x52')]},'raw':!![]})[_0x4b0d('0x26')](function(_0x2443ad){if(_0x2443ad&&_0x2443ad['autoAssociation']===0x0){return db[_0x4b0d('0x28')]['create']({'name':_0x7ffa4a['name'],'resourceId':_0x7ffa4a['id'],'type':_0x2443ad[_0x4b0d('0x2b')],'sectionId':_0x2443ad['id']},{})[_0x4b0d('0x26')](function(){return _0x209af1;});}else{return _0x209af1;}})[_0x4b0d('0x4a')](function(_0x54df1e){logger['error'](_0x4b0d('0x53'),_0x54df1e);throw _0x54df1e;});}return _0x209af1;})[_0x4b0d('0x26')](respondWithResult(_0x148380,0xc9))[_0x4b0d('0x4a')](handleError(_0x148380,null));};exports['clone']=function(_0x2d40bc,_0x5427e6){var _0x4044e4={'where':{'id':_0x2d40bc[_0x4b0d('0x46')]['id']}},_0x40a9f1={};_0x40a9f1[_0x4b0d('0x35')]=_['keys'](db['JscriptyProject'][_0x4b0d('0x2e')]);_0x4044e4[_0x4b0d('0x36')]=_[_0x4b0d('0x37')](_0x40a9f1[_0x4b0d('0x35')],qs[_0x4b0d('0x38')](_0x2d40bc[_0x4b0d('0x33')][_0x4b0d('0x38')]));_0x4044e4[_0x4b0d('0x36')]=_0x4044e4[_0x4b0d('0x36')]['length']?_0x4044e4[_0x4b0d('0x36')]:_0x40a9f1[_0x4b0d('0x35')];if(_0x2d40bc['query'][_0x4b0d('0x41')]){_0x4044e4[_0x4b0d('0x42')]=[{'all':!![]}];}_0x4044e4=_[_0x4b0d('0x54')]({},_0x4044e4,_0x2d40bc['options']);return db['JscriptyProject'][_0x4b0d('0x49')](_0x4044e4)[_0x4b0d('0x26')](handleEntityNotFound(_0x5427e6,null))['then'](function(_0x42e0c8){if(_0x42e0c8){var _0x14bb49=_0x42e0c8[_0x4b0d('0x4e')]({'plain':!![]});_0x14bb49=qs[_0x4b0d('0x55')](_0x14bb49,['id',_0x4b0d('0x56'),_0x4b0d('0x57')]);_0x2d40bc[_0x4b0d('0x4c')]=_[_0x4b0d('0x55')](_0x2d40bc[_0x4b0d('0x4c')],['id','createdAt','updatedAt']);return db[_0x4b0d('0x2d')][_0x4b0d('0x4b')](_[_0x4b0d('0x54')](_0x14bb49,_0x2d40bc[_0x4b0d('0x4c')]),{'include':_0x2d40bc[_0x4b0d('0x33')][_0x4b0d('0x41')]?[{'all':!![]}]:undefined})[_0x4b0d('0x26')](function(_0x89f177){var _0x16fb50=_0x2d40bc[_0x4b0d('0x4d')][_0x4b0d('0x4e')]({'plain':!![]});if(!_0x16fb50)throw new Error(_0x4b0d('0x4f'));if(_0x16fb50[_0x4b0d('0x50')]==='user'){var _0x251161=_0x89f177[_0x4b0d('0x4e')]({'plain':!![]});var _0x35c09d=_0x4b0d('0x27');return db[_0x4b0d('0x51')]['find']({'where':{'name':_0x35c09d,'userProfileId':_0x16fb50[_0x4b0d('0x52')]},'raw':!![]})[_0x4b0d('0x26')](function(_0x32a7de){if(_0x32a7de&&_0x32a7de[_0x4b0d('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x251161['name'],'resourceId':_0x251161['id'],'type':_0x32a7de[_0x4b0d('0x2b')],'sectionId':_0x32a7de['id']},{})['then'](function(){return _0x89f177;});}else{return _0x89f177;}})[_0x4b0d('0x4a')](function(_0x358ad7){logger[_0x4b0d('0x59')](_0x4b0d('0x53'),_0x358ad7);throw _0x358ad7;});}return _0x89f177;});}})[_0x4b0d('0x26')](respondWithResult(_0x5427e6,0xc9))[_0x4b0d('0x4a')](handleError(_0x5427e6,null));};exports[_0x4b0d('0x25')]=function(_0x3d1dbe,_0x424046){if(_0x3d1dbe[_0x4b0d('0x4c')]['id']){delete _0x3d1dbe[_0x4b0d('0x4c')]['id'];}return db[_0x4b0d('0x2d')][_0x4b0d('0x49')]({'where':{'id':_0x3d1dbe[_0x4b0d('0x46')]['id']}})[_0x4b0d('0x26')](handleEntityNotFound(_0x424046,null))[_0x4b0d('0x26')](saveUpdates(_0x3d1dbe[_0x4b0d('0x4c')],null))['then'](respondWithResult(_0x424046,null))[_0x4b0d('0x4a')](handleError(_0x424046,null));};exports[_0x4b0d('0x29')]=function(_0xf748a7,_0x36a955){return db[_0x4b0d('0x2d')][_0x4b0d('0x49')]({'where':{'id':_0xf748a7['params']['id']}})[_0x4b0d('0x26')](handleEntityNotFound(_0x36a955,null))[_0x4b0d('0x26')](removeEntity(_0x36a955,null))[_0x4b0d('0x4a')](handleError(_0x36a955,null));};exports[_0x4b0d('0x5a')]=function(_0x4a82e2,_0x10b7e6,_0x5bd277){var _0x2c894a={'raw':!![],'where':{}};var _0x227c1e={};var _0x510c5f={'count':0x0,'rows':[]};return db[_0x4b0d('0x2d')][_0x4b0d('0x5b')]({'where':{'id':_0x4a82e2[_0x4b0d('0x46')]['id']}})[_0x4b0d('0x26')](handleEntityNotFound(_0x10b7e6,null))[_0x4b0d('0x26')](function(_0x350d02){if(_0x350d02){_0x227c1e[_0x4b0d('0x35')]=_[_0x4b0d('0x47')](db['JscriptySessionReport'][_0x4b0d('0x2e')]);_0x227c1e['query']=_[_0x4b0d('0x47')](_0x4a82e2[_0x4b0d('0x33')]);_0x227c1e['filters']=_['intersection'](_0x227c1e[_0x4b0d('0x35')],_0x227c1e['query']);_0x2c894a[_0x4b0d('0x36')]=_['intersection'](_0x227c1e[_0x4b0d('0x35')],qs['fields'](_0x4a82e2[_0x4b0d('0x33')][_0x4b0d('0x38')]));_0x2c894a[_0x4b0d('0x36')]=_0x2c894a[_0x4b0d('0x36')][_0x4b0d('0x48')]?_0x2c894a['attributes']:_0x227c1e[_0x4b0d('0x35')];if(!_0x4a82e2[_0x4b0d('0x33')][_0x4b0d('0x39')](_0x4b0d('0x3a'))){_0x2c894a['limit']=qs[_0x4b0d('0x1d')](_0x4a82e2[_0x4b0d('0x33')][_0x4b0d('0x1d')]);_0x2c894a[_0x4b0d('0x1e')]=qs[_0x4b0d('0x1e')](_0x4a82e2['query'][_0x4b0d('0x1e')]);}_0x2c894a[_0x4b0d('0x3b')]=qs[_0x4b0d('0x3c')](_0x4a82e2[_0x4b0d('0x33')][_0x4b0d('0x3c')]);_0x2c894a['where']=qs[_0x4b0d('0x34')](_[_0x4b0d('0x3e')](_0x4a82e2[_0x4b0d('0x33')],_0x227c1e[_0x4b0d('0x34')]));_0x2c894a['where']['ProjectId']=_0x350d02['id'];if(_0x4a82e2[_0x4b0d('0x33')][_0x4b0d('0x3f')]){_0x2c894a[_0x4b0d('0x3d')]=_[_0x4b0d('0x54')](_0x2c894a['where'],{'$or':_[_0x4b0d('0x32')](_0x2c894a[_0x4b0d('0x36')],function(_0x5b09c5){var _0x5d3a6e={};_0x5d3a6e[_0x5b09c5]={'$like':'%'+_0x4a82e2[_0x4b0d('0x33')]['filter']+'%'};return _0x5d3a6e;})});}_0x2c894a=_['merge']({},_0x2c894a,_0x4a82e2['options']);return db[_0x4b0d('0x5c')][_0x4b0d('0x1f')]({'where':_0x2c894a[_0x4b0d('0x3d')]})[_0x4b0d('0x26')](function(_0x14e0d7){_0x510c5f[_0x4b0d('0x1f')]=_0x14e0d7;if(_0x4a82e2[_0x4b0d('0x33')]['includeAll']){_0x2c894a[_0x4b0d('0x42')]=[{'all':!![]}];}return db[_0x4b0d('0x5c')][_0x4b0d('0x43')](_0x2c894a);})[_0x4b0d('0x26')](function(_0x4451d9){_0x510c5f[_0x4b0d('0x44')]=_0x4451d9;return _0x510c5f;});}})[_0x4b0d('0x26')](respondWithFilteredResult(_0x10b7e6,_0x2c894a))[_0x4b0d('0x4a')](handleError(_0x10b7e6,null));};exports[_0x4b0d('0x5d')]=function(_0x265354,_0x321d00,_0x3dbc65){var _0x2d3bac={'raw':!![],'where':{}};var _0x5bd6b9={};var _0x486660={'count':0x0,'rows':[]};return db[_0x4b0d('0x2d')][_0x4b0d('0x5b')]({'where':{'id':_0x265354[_0x4b0d('0x46')]['id']}})['then'](handleEntityNotFound(_0x321d00,null))[_0x4b0d('0x26')](function(_0x52058d){if(_0x52058d){_0x5bd6b9['model']=_['keys'](db[_0x4b0d('0x5e')][_0x4b0d('0x2e')]);_0x5bd6b9['query']=_[_0x4b0d('0x47')](_0x265354[_0x4b0d('0x33')]);_0x5bd6b9[_0x4b0d('0x34')]=_[_0x4b0d('0x37')](_0x5bd6b9[_0x4b0d('0x35')],_0x5bd6b9[_0x4b0d('0x33')]);_0x2d3bac['attributes']=_['intersection'](_0x5bd6b9[_0x4b0d('0x35')],qs[_0x4b0d('0x38')](_0x265354['query'][_0x4b0d('0x38')]));_0x2d3bac[_0x4b0d('0x36')]=_0x2d3bac['attributes']['length']?_0x2d3bac[_0x4b0d('0x36')]:_0x5bd6b9[_0x4b0d('0x35')];if(!_0x265354[_0x4b0d('0x33')]['hasOwnProperty'](_0x4b0d('0x3a'))){_0x2d3bac[_0x4b0d('0x1d')]=qs[_0x4b0d('0x1d')](_0x265354[_0x4b0d('0x33')]['limit']);_0x2d3bac['offset']=qs['offset'](_0x265354['query'][_0x4b0d('0x1e')]);}_0x2d3bac[_0x4b0d('0x3b')]=qs[_0x4b0d('0x3c')](_0x265354['query'][_0x4b0d('0x3c')]);_0x2d3bac[_0x4b0d('0x3d')]=qs[_0x4b0d('0x34')](_[_0x4b0d('0x3e')](_0x265354['query'],_0x5bd6b9['filters']));_0x2d3bac['where'][_0x4b0d('0x5f')]=_0x52058d['id'];if(_0x265354[_0x4b0d('0x33')][_0x4b0d('0x3f')]){_0x2d3bac[_0x4b0d('0x3d')]=_[_0x4b0d('0x54')](_0x2d3bac[_0x4b0d('0x3d')],{'$or':_[_0x4b0d('0x32')](_0x2d3bac[_0x4b0d('0x36')],function(_0x294f00){var _0x31bad8={};_0x31bad8[_0x294f00]={'$like':'%'+_0x265354[_0x4b0d('0x33')][_0x4b0d('0x3f')]+'%'};return _0x31bad8;})});}_0x2d3bac=_['merge']({},_0x2d3bac,_0x265354['options']);return db[_0x4b0d('0x5e')][_0x4b0d('0x1f')]({'where':_0x2d3bac[_0x4b0d('0x3d')]})[_0x4b0d('0x26')](function(_0x5e0291){_0x486660[_0x4b0d('0x1f')]=_0x5e0291;if(_0x265354[_0x4b0d('0x33')]['includeAll']){_0x2d3bac[_0x4b0d('0x42')]=[{'all':!![]}];}return db[_0x4b0d('0x5e')]['findAll'](_0x2d3bac);})['then'](function(_0x47a27b){_0x486660['rows']=_0x47a27b;return _0x486660;});}})[_0x4b0d('0x26')](respondWithFilteredResult(_0x321d00,_0x2d3bac))[_0x4b0d('0x4a')](handleError(_0x321d00,null));};function char(_0x3382cc){return _0x4b0d('0x60')===typeof _0x3382cc?String['fromCharCode']['apply'](null,arguments):_0x3382cc;}function needsEncapsulation(_0x492a73){return!!_0x492a73&&(_0x492a73['toString']()['indexOf'](char(0xd))>=0x0||_0x492a73['toString']()[_0x4b0d('0x61')](char(0xa))>=0x0||_0x492a73[_0x4b0d('0x62')]()[_0x4b0d('0x61')](char(0x2c))>=0x0||_0x492a73[_0x4b0d('0x62')]()[_0x4b0d('0x61')](char(0x22))>=0x0);}function encapsulate(_0x501023){var _0x2b5ba5=char(0x22),_0x24b09d='\x5c'+char(0x22),_0x4dbf80=_0x501023[_0x4b0d('0x62')]()[_0x4b0d('0x63')](new RegExp(_0x2b5ba5,'g'),_0x24b09d);return _0x2b5ba5+_0x4dbf80+_0x2b5ba5;}exports[_0x4b0d('0x64')]=function(_0x3c2784,_0x56942b,_0x1e8002){var _0x1732d2,_0xa42db0;var _0x259a0d={'where':{'ProjectId':_0x3c2784[_0x4b0d('0x46')]['id']}};if(_0x3c2784[_0x4b0d('0x33')][_0x4b0d('0x65')]){_0x259a0d[_0x4b0d('0x3d')][_0x4b0d('0x66')]=JSON[_0x4b0d('0x67')](_0x3c2784[_0x4b0d('0x33')][_0x4b0d('0x65')]);}return db[_0x4b0d('0x5c')][_0x4b0d('0x43')](_0x259a0d)['then'](handleEntityNotFound(_0x56942b,null))[_0x4b0d('0x26')](function(_0x2cc436){if(_0x2cc436){_0x1732d2=_0x2cc436;return db[_0x4b0d('0x68')]['findAll']({'where':{'SessionId':{'$in':_[_0x4b0d('0x32')](_0x1732d2,'id')},'ProjectId':_0x3c2784['params']['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x56942b,null))[_0x4b0d('0x26')](function(_0x568ddd){if(_0x568ddd){_0xa42db0=_0x568ddd;var _0x20d9c9={};for(var _0x58c034=0x0,_0x567f5c=_0xa42db0['length'];_0x58c034<_0x567f5c;_0x58c034++){if(!_0x20d9c9['hasOwnProperty'](_0xa42db0[_0x58c034]['questionId'])){_0x20d9c9[_0xa42db0[_0x58c034]['questionId']]=needsEncapsulation(_0xa42db0[_0x58c034][_0x4b0d('0x69')])?encapsulate(_0xa42db0[_0x58c034][_0x4b0d('0x69')]):_0xa42db0[_0x58c034]['question'];}}var _0x3d9636=[],_0x355596={};for(var _0x31cc54=0x0,_0x2087b7=_0x1732d2['length'];_0x31cc54<_0x2087b7;_0x31cc54++){_0x355596={'ProjectId':_0x3c2784['params']['id'],'SessionId':_0x1732d2[_0x31cc54]['id'],'StartTime':moment(_0x1732d2[_0x31cc54][_0x4b0d('0x66')])[_0x4b0d('0x6a')](_0x4b0d('0x6b'))};for(var _0x44443a=0x0,_0xdc734b=_0xa42db0[_0x4b0d('0x48')];_0x44443a<_0xdc734b;_0x44443a++){if(_0xa42db0[_0x44443a][_0x4b0d('0x6c')]==_0x1732d2[_0x31cc54]['id']&&_0x20d9c9[_0x4b0d('0x39')](_0xa42db0[_0x44443a][_0x4b0d('0x6d')])){_0x355596[_0x20d9c9[_0xa42db0[_0x44443a][_0x4b0d('0x6d')]]]=_0xa42db0[_0x44443a][_0x4b0d('0x6e')];}}for(var _0x28e4e8 in _0x20d9c9){if(!_0x355596['hasOwnProperty'](_0x20d9c9[_0x28e4e8])){_0x355596[_0x20d9c9[_0x28e4e8]]=null;}}_0x3d9636[_0x4b0d('0x6f')](_0x355596);}return _0x3d9636;}})['then'](function(_0x40d2bd){if(!_[_0x4b0d('0x70')](_0x40d2bd)){var _0x510570=toCsv(_0x40d2bd);var _0xd56d90=Date[_0x4b0d('0x71')]();fs['writeFileSync'](util['format'](_0x4b0d('0x72'),_0x3c2784['params']['id'],_0xd56d90),_0x510570);_0x56942b[_0x4b0d('0x73')](_0x4b0d('0x74'),'attachment;\x20filename='+util['format'](_0x4b0d('0x75'),_0x3c2784['params']['id'],_0xd56d90));_0x56942b[_0x4b0d('0x73')](_0x4b0d('0x76'),_0x4b0d('0x77'));return _0x56942b['download'](util[_0x4b0d('0x6a')](_0x4b0d('0x72'),_0x3c2784[_0x4b0d('0x46')]['id'],_0xd56d90));}else{return _0x56942b['sendStatus'](0xcc);}})[_0x4b0d('0x4a')](handleError(_0x56942b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 2963c45..dd2eb42 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 _0xb2f1=['path','./jscriptyProject.attributes','exports','jscripty_projects','lodash','util','api','moment','request-promise'];(function(_0x1c7c27,_0x151cab){var _0x146593=function(_0x2d03da){while(--_0x2d03da){_0x1c7c27['push'](_0x1c7c27['shift']());}};_0x146593(++_0x151cab);}(_0xb2f1,0xee));var _0x1b2f=function(_0x5ec89c,_0x3549e7){_0x5ec89c=_0x5ec89c-0x0;var _0xdcfe=_0xb2f1[_0x5ec89c];return _0xdcfe;};'use strict';var _=require(_0x1b2f('0x0'));var util=require(_0x1b2f('0x1'));var logger=require('../../config/logger')(_0x1b2f('0x2'));var moment=require(_0x1b2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b2f('0x4'));var fs=require('fs');var path=require(_0x1b2f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1b2f('0x6'));module[_0x1b2f('0x7')]=function(_0xad728b,_0x4326ba){return _0xad728b['define']('JscriptyProject',attributes,{'tableName':_0x1b2f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96f1=['./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5db9ae,_0x2c8c69){var _0x2c88af=function(_0x3f112d){while(--_0x3f112d){_0x5db9ae['push'](_0x5db9ae['shift']());}};_0x2c88af(++_0x2c8c69);}(_0x96f1,0x19c));var _0x196f=function(_0x5dac6d,_0x14bd95){_0x5dac6d=_0x5dac6d-0x0;var _0x519a13=_0x96f1[_0x5dac6d];return _0x519a13;};'use strict';var _=require(_0x196f('0x0'));var util=require(_0x196f('0x1'));var logger=require(_0x196f('0x2'))(_0x196f('0x3'));var moment=require(_0x196f('0x4'));var BPromise=require(_0x196f('0x5'));var rp=require(_0x196f('0x6'));var fs=require('fs');var path=require(_0x196f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x196f('0x8'));module[_0x196f('0x9')]=function(_0x267906,_0x1f401c){return _0x267906[_0x196f('0xa')]('JscriptyProject',attributes,{'tableName':_0x196f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 90c590d..71cd1b4 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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x1530d4,_0x4857d1){var _0x1478c7=function(_0x5aca3e){while(--_0x5aca3e){_0x1530d4['push'](_0x1530d4['shift']());}};_0x1478c7(++_0x4857d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4a9302,_0x3b4093){var _0x905595=function(_0x335489){while(--_0x335489){_0x4a9302['push'](_0x4a9302['shift']());}};_0x905595(++_0x3b4093);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f9865e8..f4a6c80 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 _0x238f=['destroy','multer','util','path','express','fs-extra','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete'];(function(_0x324cc9,_0x1738b9){var _0x1edff4=function(_0x21a124){while(--_0x21a124){_0x324cc9['push'](_0x324cc9['shift']());}};_0x1edff4(++_0x1738b9);}(_0x238f,0x6d));var _0xf238=function(_0x2c2bc9,_0x23b9a5){_0x2c2bc9=_0x2c2bc9-0x0;var _0x59c7d8=_0x238f[_0x2c2bc9];return _0x59c7d8;};'use strict';var multer=require(_0xf238('0x0'));var util=require(_0xf238('0x1'));var path=require(_0xf238('0x2'));var timeout=require('connect-timeout');var express=require(_0xf238('0x3'));var router=express['Router']();var fs_extra=require(_0xf238('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf238('0x5'));var controller=require(_0xf238('0x6'));router[_0xf238('0x7')]('/',auth[_0xf238('0x8')](),controller[_0xf238('0x9')]);router[_0xf238('0x7')](_0xf238('0xa'),auth['isAuthenticated'](),controller[_0xf238('0xb')]);router[_0xf238('0x7')](_0xf238('0xc'),auth['isAuthenticated'](),controller[_0xf238('0xd')]);router[_0xf238('0xe')]('/',auth[_0xf238('0x8')](),controller['create']);router[_0xf238('0xf')](_0xf238('0xc'),auth[_0xf238('0x8')](),controller['update']);router[_0xf238('0x10')](_0xf238('0xc'),auth[_0xf238('0x8')](),controller[_0xf238('0x11')]);module['exports']=router; \ No newline at end of file +var _0x031d=['isAuthenticated','describe','/:id','show','create','put','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe'];(function(_0x544baa,_0x1b17fe){var _0x5e8cc1=function(_0x1b55dc){while(--_0x1b55dc){_0x544baa['push'](_0x544baa['shift']());}};_0x5e8cc1(++_0x1b17fe);}(_0x031d,0x135));var _0xd031=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x031d[_0x1e4150];return _0x1ce3ee;};'use strict';var multer=require(_0xd031('0x0'));var util=require(_0xd031('0x1'));var path=require(_0xd031('0x2'));var timeout=require('connect-timeout');var express=require(_0xd031('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd031('0x4'));var interaction=require(_0xd031('0x5'));var config=require(_0xd031('0x6'));var controller=require(_0xd031('0x7'));router[_0xd031('0x8')]('/',auth['isAuthenticated'](),controller[_0xd031('0x9')]);router[_0xd031('0x8')](_0xd031('0xa'),auth[_0xd031('0xb')](),controller[_0xd031('0xc')]);router['get'](_0xd031('0xd'),auth['isAuthenticated'](),controller[_0xd031('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd031('0xf')]);router[_0xd031('0x10')](_0xd031('0xd'),auth[_0xd031('0xb')](),controller[_0xd031('0x11')]);router[_0xd031('0x12')](_0xd031('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd031('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 4cbf718..95bb558 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(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7a54,0x106));var _0x47a5=function(_0x4b349f,_0x5aea66){_0x4b349f=_0x4b349f-0x0;var _0x55fa25=_0x7a54[_0x4b349f];return _0x55fa25;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x8c6eec,_0x45529d){_0x8c6eec=_0x8c6eec-0x0;var _0x52b0a5=_0x7a54[_0x8c6eec];return _0x52b0a5;};'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 d557095..1e7f88e 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 _0xfcde=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','order','where','pick','map','filter','merge','options','includeAll','include','rows','params','attributes','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x413c5b,_0x3aca15){var _0x3a7424=function(_0x8a349c){while(--_0x8a349c){_0x413c5b['push'](_0x413c5b['shift']());}};_0x3a7424(++_0x3aca15);}(_0xfcde,0x1dd));var _0xefcd=function(_0x323ff1,_0xbeac83){_0x323ff1=_0x323ff1-0x0;var _0x3d6931=_0xfcde[_0x323ff1];return _0x3d6931;};'use strict';var emlformat=require(_0xefcd('0x0'));var rimraf=require(_0xefcd('0x1'));var zipdir=require(_0xefcd('0x2'));var jsonpatch=require(_0xefcd('0x3'));var rp=require(_0xefcd('0x4'));var moment=require(_0xefcd('0x5'));var BPromise=require(_0xefcd('0x6'));var Mustache=require(_0xefcd('0x7'));var util=require(_0xefcd('0x8'));var path=require(_0xefcd('0x9'));var sox=require(_0xefcd('0xa'));var csv=require('to-csv');var ejs=require(_0xefcd('0xb'));var fs=require('fs');var fs_extra=require(_0xefcd('0xc'));var _=require('lodash');var squel=require(_0xefcd('0xd'));var crypto=require(_0xefcd('0xe'));var jsforce=require(_0xefcd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xefcd('0x10'));var querystring=require(_0xefcd('0x11'));var Papa=require('papaparse');var Redis=require(_0xefcd('0x12'));var authService=require(_0xefcd('0x13'));var qs=require(_0xefcd('0x14'));var as=require(_0xefcd('0x15'));var hardwareService=require(_0xefcd('0x16'));var logger=require(_0xefcd('0x17'))('api');var utils=require(_0xefcd('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314e02,_0x197a49){_0x197a49=_0x197a49||0xcc;return function(_0x514200){if(_0x514200){return _0x314e02[_0xefcd('0x19')](_0x197a49);}return _0x314e02['status'](_0x197a49)['end']();};}function respondWithResult(_0x59b2a7,_0x376c1d){_0x376c1d=_0x376c1d||0xc8;return function(_0x29e1a0){if(_0x29e1a0){return _0x59b2a7[_0xefcd('0x1a')](_0x376c1d)[_0xefcd('0x1b')](_0x29e1a0);}};}function respondWithFilteredResult(_0x776860,_0xd0466d){return function(_0x18711e){if(_0x18711e){var _0x2d28f9=typeof _0xd0466d[_0xefcd('0x1c')]===_0xefcd('0x1d')&&typeof _0xd0466d[_0xefcd('0x1e')]===_0xefcd('0x1d');var _0x4eb6e8=_0x18711e[_0xefcd('0x1f')];var _0x6e623c=_0x2d28f9?0x0:_0xd0466d[_0xefcd('0x1c')];var _0x4b9649=_0x2d28f9?_0x18711e[_0xefcd('0x1f')]:_0xd0466d[_0xefcd('0x1c')]+_0xd0466d[_0xefcd('0x1e')];var _0x22752d;if(_0x4b9649>=_0x4eb6e8){_0x4b9649=_0x4eb6e8;_0x22752d=0xc8;}else{_0x22752d=0xce;}_0x776860[_0xefcd('0x1a')](_0x22752d);return _0x776860['set'](_0xefcd('0x20'),_0x6e623c+'-'+_0x4b9649+'/'+_0x4eb6e8)[_0xefcd('0x1b')](_0x18711e);}return null;};}function patchUpdates(_0xc7ce7e){return function(_0x414450){try{jsonpatch[_0xefcd('0x21')](_0x414450,_0xc7ce7e,!![]);}catch(_0x15be0d){return BPromise[_0xefcd('0x22')](_0x15be0d);}return _0x414450['save']();};}function saveUpdates(_0x41a61a,_0x2771fb){return function(_0x27d560){if(_0x27d560){return _0x27d560['update'](_0x41a61a)['then'](function(_0x5b09ef){return _0x5b09ef;});}return null;};}function removeEntity(_0x35c0f6,_0x3740cc){return function(_0x56c975){if(_0x56c975){return _0x56c975[_0xefcd('0x23')]()[_0xefcd('0x24')](function(){_0x35c0f6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b02e5,_0x162a27){return function(_0x12f4c1){if(!_0x12f4c1){_0x5b02e5[_0xefcd('0x19')](0x194);}return _0x12f4c1;};}function handleError(_0x1d8908,_0x2a1cdc){_0x2a1cdc=_0x2a1cdc||0x1f4;return function(_0xbdda31){logger[_0xefcd('0x25')](_0xbdda31[_0xefcd('0x26')]);if(_0xbdda31['name']){delete _0xbdda31[_0xefcd('0x27')];}_0x1d8908['status'](_0x2a1cdc)[_0xefcd('0x28')](_0xbdda31);};}exports[_0xefcd('0x29')]=function(_0x20bd5d,_0x48d7c3){var _0x3b7a34={},_0x5b1e80={},_0x44ead0={'count':0x0,'rows':[]};var _0x1101e9=_['map'](db[_0xefcd('0x2a')][_0xefcd('0x2b')],function(_0x421efc){return{'name':_0x421efc[_0xefcd('0x2c')],'type':_0x421efc[_0xefcd('0x2d')]['key']};});_0x5b1e80[_0xefcd('0x2e')]=_['map'](_0x1101e9,_0xefcd('0x27'));_0x5b1e80[_0xefcd('0x2f')]=_[_0xefcd('0x30')](_0x20bd5d[_0xefcd('0x2f')]);_0x5b1e80[_0xefcd('0x31')]=_[_0xefcd('0x32')](_0x5b1e80[_0xefcd('0x2e')],_0x5b1e80['query']);_0x3b7a34['attributes']=_[_0xefcd('0x32')](_0x5b1e80['model'],qs[_0xefcd('0x33')](_0x20bd5d['query'][_0xefcd('0x33')]));_0x3b7a34['attributes']=_0x3b7a34['attributes'][_0xefcd('0x34')]?_0x3b7a34['attributes']:_0x5b1e80['model'];if(!_0x20bd5d[_0xefcd('0x2f')]['hasOwnProperty']('nolimit')){_0x3b7a34[_0xefcd('0x1e')]=qs[_0xefcd('0x1e')](_0x20bd5d[_0xefcd('0x2f')]['limit']);_0x3b7a34[_0xefcd('0x1c')]=qs[_0xefcd('0x1c')](_0x20bd5d[_0xefcd('0x2f')]['offset']);}_0x3b7a34[_0xefcd('0x35')]=qs['sort'](_0x20bd5d[_0xefcd('0x2f')]['sort']);_0x3b7a34[_0xefcd('0x36')]=qs[_0xefcd('0x31')](_[_0xefcd('0x37')](_0x20bd5d[_0xefcd('0x2f')],_0x5b1e80['filters']),_0x1101e9);if(_0x20bd5d[_0xefcd('0x2f')]['filter']){_0x3b7a34['where']=_['merge'](_0x3b7a34['where'],{'$or':_[_0xefcd('0x38')](_0x1101e9,function(_0x10c0b7){if(_0x10c0b7[_0xefcd('0x2d')]!=='VIRTUAL'){var _0x30ab1e={};_0x30ab1e[_0x10c0b7[_0xefcd('0x27')]]={'$like':'%'+_0x20bd5d['query'][_0xefcd('0x39')]+'%'};return _0x30ab1e;}})});}_0x3b7a34=_[_0xefcd('0x3a')]({},_0x3b7a34,_0x20bd5d[_0xefcd('0x3b')]);var _0x38eaf2={'where':_0x3b7a34[_0xefcd('0x36')]};return db[_0xefcd('0x2a')]['count'](_0x38eaf2)['then'](function(_0x25aeac){_0x44ead0['count']=_0x25aeac;if(_0x20bd5d['query'][_0xefcd('0x3c')]){_0x3b7a34[_0xefcd('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x3b7a34);})[_0xefcd('0x24')](function(_0xc1e0fb){_0x44ead0[_0xefcd('0x3e')]=_0xc1e0fb;return _0x44ead0;})[_0xefcd('0x24')](respondWithFilteredResult(_0x48d7c3,_0x3b7a34))['catch'](handleError(_0x48d7c3,null));};exports['show']=function(_0x428dee,_0x276946){var _0x120892={'raw':!![],'where':{'id':_0x428dee[_0xefcd('0x3f')]['id']}},_0x29de71={};_0x29de71[_0xefcd('0x2e')]=_[_0xefcd('0x30')](db[_0xefcd('0x2a')][_0xefcd('0x2b')]);_0x29de71[_0xefcd('0x2f')]=_[_0xefcd('0x30')](_0x428dee['query']);_0x29de71['filters']=_[_0xefcd('0x32')](_0x29de71['model'],_0x29de71[_0xefcd('0x2f')]);_0x120892[_0xefcd('0x40')]=_[_0xefcd('0x32')](_0x29de71['model'],qs[_0xefcd('0x33')](_0x428dee[_0xefcd('0x2f')][_0xefcd('0x33')]));_0x120892[_0xefcd('0x40')]=_0x120892[_0xefcd('0x40')][_0xefcd('0x34')]?_0x120892[_0xefcd('0x40')]:_0x29de71[_0xefcd('0x2e')];if(_0x428dee[_0xefcd('0x2f')][_0xefcd('0x3c')]){_0x120892[_0xefcd('0x3d')]=[{'all':!![]}];}_0x120892=_[_0xefcd('0x3a')]({},_0x120892,_0x428dee['options']);return db[_0xefcd('0x2a')][_0xefcd('0x41')](_0x120892)['then'](handleEntityNotFound(_0x276946,null))[_0xefcd('0x24')](respondWithResult(_0x276946,null))[_0xefcd('0x42')](handleError(_0x276946,null));};exports[_0xefcd('0x43')]=function(_0x430de8,_0x2fbabd){return db['JscriptyQuestionReport']['create'](_0x430de8['body'],{})['then'](respondWithResult(_0x2fbabd,0xc9))[_0xefcd('0x42')](handleError(_0x2fbabd,null));};exports[_0xefcd('0x44')]=function(_0x30819f,_0x3943a3){if(_0x30819f[_0xefcd('0x45')]['id']){delete _0x30819f['body']['id'];}return db[_0xefcd('0x2a')][_0xefcd('0x41')]({'where':{'id':_0x30819f['params']['id']}})['then'](handleEntityNotFound(_0x3943a3,null))[_0xefcd('0x24')](saveUpdates(_0x30819f[_0xefcd('0x45')],null))[_0xefcd('0x24')](respondWithResult(_0x3943a3,null))[_0xefcd('0x42')](handleError(_0x3943a3,null));};exports[_0xefcd('0x23')]=function(_0x3f51e9,_0x5ef4d3){return db[_0xefcd('0x2a')][_0xefcd('0x41')]({'where':{'id':_0x3f51e9[_0xefcd('0x3f')]['id']}})[_0xefcd('0x24')](handleEntityNotFound(_0x5ef4d3,null))[_0xefcd('0x24')](removeEntity(_0x5ef4d3,null))[_0xefcd('0x42')](handleError(_0x5ef4d3,null));};exports['describe']=function(_0x40ef13,_0x3307eb){return db[_0xefcd('0x2a')][_0xefcd('0x46')]()[_0xefcd('0x24')](respondWithResult(_0x3307eb,null))[_0xefcd('0x42')](handleError(_0x3307eb,null));}; \ No newline at end of file +var _0x8832=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','describe','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','apply','reject','save','then','sendStatus','error','name','send','map','fieldName','type','key','model','query'];(function(_0x3ac136,_0x2b1f66){var _0x6f5d91=function(_0x2c8738){while(--_0x2c8738){_0x3ac136['push'](_0x3ac136['shift']());}};_0x6f5d91(++_0x2b1f66);}(_0x8832,0x18a));var _0x2883=function(_0x2eeb73,_0x413219){_0x2eeb73=_0x2eeb73-0x0;var _0x421024=_0x8832[_0x2eeb73];return _0x421024;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2883('0x0'));var jsonpatch=require(_0x2883('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2883('0x2'));var Mustache=require('mustache');var util=require(_0x2883('0x3'));var path=require(_0x2883('0x4'));var sox=require(_0x2883('0x5'));var csv=require(_0x2883('0x6'));var ejs=require(_0x2883('0x7'));var fs=require('fs');var fs_extra=require(_0x2883('0x8'));var _=require('lodash');var squel=require(_0x2883('0x9'));var crypto=require(_0x2883('0xa'));var jsforce=require(_0x2883('0xb'));var deskjs=require(_0x2883('0xc'));var toCsv=require(_0x2883('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2883('0xd'));var authService=require(_0x2883('0xe'));var qs=require(_0x2883('0xf'));var as=require(_0x2883('0x10'));var hardwareService=require(_0x2883('0x11'));var logger=require(_0x2883('0x12'))('api');var utils=require(_0x2883('0x13'));var config=require(_0x2883('0x14'));var licenseUtil=require(_0x2883('0x15'));var db=require(_0x2883('0x16'))['db'];function respondWithStatusCode(_0x39e41b,_0x5b48b6){_0x5b48b6=_0x5b48b6||0xcc;return function(_0x1ac959){if(_0x1ac959){return _0x39e41b['sendStatus'](_0x5b48b6);}return _0x39e41b[_0x2883('0x17')](_0x5b48b6)[_0x2883('0x18')]();};}function respondWithResult(_0x3060a3,_0x37aa51){_0x37aa51=_0x37aa51||0xc8;return function(_0x1fef81){if(_0x1fef81){return _0x3060a3[_0x2883('0x17')](_0x37aa51)[_0x2883('0x19')](_0x1fef81);}};}function respondWithFilteredResult(_0x343cf5,_0x422d14){return function(_0x289602){if(_0x289602){var _0x24eb73=typeof _0x422d14['offset']===_0x2883('0x1a')&&typeof _0x422d14[_0x2883('0x1b')]===_0x2883('0x1a');var _0x13a09e=_0x289602[_0x2883('0x1c')];var _0x2732cf=_0x24eb73?0x0:_0x422d14[_0x2883('0x1d')];var _0x56e978=_0x24eb73?_0x289602['count']:_0x422d14['offset']+_0x422d14[_0x2883('0x1b')];var _0x79cd97;if(_0x56e978>=_0x13a09e){_0x56e978=_0x13a09e;_0x79cd97=0xc8;}else{_0x79cd97=0xce;}_0x343cf5[_0x2883('0x17')](_0x79cd97);return _0x343cf5['set']('Content-Range',_0x2732cf+'-'+_0x56e978+'/'+_0x13a09e)[_0x2883('0x19')](_0x289602);}return null;};}function patchUpdates(_0x574f00){return function(_0x43a328){try{jsonpatch[_0x2883('0x1e')](_0x43a328,_0x574f00,!![]);}catch(_0x26261b){return BPromise[_0x2883('0x1f')](_0x26261b);}return _0x43a328[_0x2883('0x20')]();};}function saveUpdates(_0x58c6b3,_0x12559f){return function(_0x2a1b14){if(_0x2a1b14){return _0x2a1b14['update'](_0x58c6b3)['then'](function(_0x5c0247){return _0x5c0247;});}return null;};}function removeEntity(_0x45abed,_0x53ed7e){return function(_0x33569f){if(_0x33569f){return _0x33569f['destroy']()[_0x2883('0x21')](function(){_0x45abed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x367b69,_0x320f3e){return function(_0x5f560e){if(!_0x5f560e){_0x367b69[_0x2883('0x22')](0x194);}return _0x5f560e;};}function handleError(_0x56b7c3,_0x1f13df){_0x1f13df=_0x1f13df||0x1f4;return function(_0x1f9324){logger[_0x2883('0x23')](_0x1f9324['stack']);if(_0x1f9324[_0x2883('0x24')]){delete _0x1f9324['name'];}_0x56b7c3['status'](_0x1f13df)[_0x2883('0x25')](_0x1f9324);};}exports['index']=function(_0x41b594,_0x9f2df4){var _0x5e2114={},_0x275efa={},_0x58164f={'count':0x0,'rows':[]};var _0x21952f=_[_0x2883('0x26')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x59a9d5){return{'name':_0x59a9d5[_0x2883('0x27')],'type':_0x59a9d5[_0x2883('0x28')][_0x2883('0x29')]};});_0x275efa[_0x2883('0x2a')]=_['map'](_0x21952f,_0x2883('0x24'));_0x275efa[_0x2883('0x2b')]=_[_0x2883('0x2c')](_0x41b594['query']);_0x275efa[_0x2883('0x2d')]=_[_0x2883('0x2e')](_0x275efa[_0x2883('0x2a')],_0x275efa[_0x2883('0x2b')]);_0x5e2114[_0x2883('0x2f')]=_[_0x2883('0x2e')](_0x275efa[_0x2883('0x2a')],qs[_0x2883('0x30')](_0x41b594[_0x2883('0x2b')][_0x2883('0x30')]));_0x5e2114[_0x2883('0x2f')]=_0x5e2114[_0x2883('0x2f')][_0x2883('0x31')]?_0x5e2114[_0x2883('0x2f')]:_0x275efa[_0x2883('0x2a')];if(!_0x41b594['query'][_0x2883('0x32')](_0x2883('0x33'))){_0x5e2114['limit']=qs[_0x2883('0x1b')](_0x41b594[_0x2883('0x2b')]['limit']);_0x5e2114['offset']=qs[_0x2883('0x1d')](_0x41b594['query']['offset']);}_0x5e2114[_0x2883('0x34')]=qs[_0x2883('0x35')](_0x41b594['query'][_0x2883('0x35')]);_0x5e2114[_0x2883('0x36')]=qs[_0x2883('0x2d')](_[_0x2883('0x37')](_0x41b594[_0x2883('0x2b')],_0x275efa[_0x2883('0x2d')]),_0x21952f);if(_0x41b594['query'][_0x2883('0x38')]){_0x5e2114[_0x2883('0x36')]=_[_0x2883('0x39')](_0x5e2114[_0x2883('0x36')],{'$or':_[_0x2883('0x26')](_0x21952f,function(_0x363011){if(_0x363011[_0x2883('0x28')]!=='VIRTUAL'){var _0x352ab2={};_0x352ab2[_0x363011['name']]={'$like':'%'+_0x41b594['query'][_0x2883('0x38')]+'%'};return _0x352ab2;}})});}_0x5e2114=_[_0x2883('0x39')]({},_0x5e2114,_0x41b594['options']);var _0x52402d={'where':_0x5e2114[_0x2883('0x36')]};return db[_0x2883('0x3a')][_0x2883('0x1c')](_0x52402d)[_0x2883('0x21')](function(_0x1721a5){_0x58164f['count']=_0x1721a5;if(_0x41b594[_0x2883('0x2b')][_0x2883('0x3b')]){_0x5e2114[_0x2883('0x3c')]=[{'all':!![]}];}return db[_0x2883('0x3a')][_0x2883('0x3d')](_0x5e2114);})[_0x2883('0x21')](function(_0x990340){_0x58164f[_0x2883('0x3e')]=_0x990340;return _0x58164f;})[_0x2883('0x21')](respondWithFilteredResult(_0x9f2df4,_0x5e2114))[_0x2883('0x3f')](handleError(_0x9f2df4,null));};exports[_0x2883('0x40')]=function(_0x928acb,_0x5aef93){var _0x465290={'raw':!![],'where':{'id':_0x928acb[_0x2883('0x41')]['id']}},_0x63a24e={};_0x63a24e[_0x2883('0x2a')]=_[_0x2883('0x2c')](db[_0x2883('0x3a')][_0x2883('0x42')]);_0x63a24e[_0x2883('0x2b')]=_[_0x2883('0x2c')](_0x928acb[_0x2883('0x2b')]);_0x63a24e['filters']=_[_0x2883('0x2e')](_0x63a24e[_0x2883('0x2a')],_0x63a24e[_0x2883('0x2b')]);_0x465290['attributes']=_[_0x2883('0x2e')](_0x63a24e[_0x2883('0x2a')],qs[_0x2883('0x30')](_0x928acb[_0x2883('0x2b')][_0x2883('0x30')]));_0x465290[_0x2883('0x2f')]=_0x465290[_0x2883('0x2f')][_0x2883('0x31')]?_0x465290[_0x2883('0x2f')]:_0x63a24e[_0x2883('0x2a')];if(_0x928acb['query'][_0x2883('0x3b')]){_0x465290[_0x2883('0x3c')]=[{'all':!![]}];}_0x465290=_[_0x2883('0x39')]({},_0x465290,_0x928acb['options']);return db[_0x2883('0x3a')][_0x2883('0x43')](_0x465290)[_0x2883('0x21')](handleEntityNotFound(_0x5aef93,null))[_0x2883('0x21')](respondWithResult(_0x5aef93,null))[_0x2883('0x3f')](handleError(_0x5aef93,null));};exports[_0x2883('0x44')]=function(_0x441c92,_0x40488e){return db[_0x2883('0x3a')]['create'](_0x441c92[_0x2883('0x45')],{})[_0x2883('0x21')](respondWithResult(_0x40488e,0xc9))[_0x2883('0x3f')](handleError(_0x40488e,null));};exports[_0x2883('0x46')]=function(_0x5424fc,_0x1d7155){if(_0x5424fc['body']['id']){delete _0x5424fc['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x5424fc[_0x2883('0x41')]['id']}})[_0x2883('0x21')](handleEntityNotFound(_0x1d7155,null))[_0x2883('0x21')](saveUpdates(_0x5424fc[_0x2883('0x45')],null))['then'](respondWithResult(_0x1d7155,null))['catch'](handleError(_0x1d7155,null));};exports[_0x2883('0x47')]=function(_0x360912,_0x28e630){return db[_0x2883('0x3a')][_0x2883('0x43')]({'where':{'id':_0x360912[_0x2883('0x41')]['id']}})['then'](handleEntityNotFound(_0x28e630,null))[_0x2883('0x21')](removeEntity(_0x28e630,null))[_0x2883('0x3f')](handleError(_0x28e630,null));};exports[_0x2883('0x48')]=function(_0x144e2b,_0x2d8f6d){return db[_0x2883('0x3a')][_0x2883('0x48')]()['then'](respondWithResult(_0x2d8f6d,null))['catch'](handleError(_0x2d8f6d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d3d0c2c..c647631 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 _0x8430=['path','../../config/environment','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','request-promise'];(function(_0x3d0c0a,_0x569519){var _0x338e0e=function(_0x50f9aa){while(--_0x50f9aa){_0x3d0c0a['push'](_0x3d0c0a['shift']());}};_0x338e0e(++_0x569519);}(_0x8430,0x1db));var _0x0843=function(_0x1c7b33,_0x381cc5){_0x1c7b33=_0x1c7b33-0x0;var _0x154be0=_0x8430[_0x1c7b33];return _0x154be0;};'use strict';var _=require(_0x0843('0x0'));var util=require(_0x0843('0x1'));var logger=require(_0x0843('0x2'))(_0x0843('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0843('0x4'));var fs=require('fs');var path=require(_0x0843('0x5'));var rimraf=require('rimraf');var config=require(_0x0843('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x0843('0x7')]=function(_0x3c9715,_0x735520){return _0x3c9715['define'](_0x0843('0x8'),attributes,{'tableName':_0x0843('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ed8=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','../../config/logger','api'];(function(_0x166bc4,_0xb45bc){var _0x96630f=function(_0x57ca6f){while(--_0x57ca6f){_0x166bc4['push'](_0x166bc4['shift']());}};_0x96630f(++_0xb45bc);}(_0x3ed8,0x110));var _0x83ed=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x3ed8[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x83ed('0x0'));var util=require('util');var logger=require(_0x83ed('0x1'))(_0x83ed('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x83ed('0x3'));var fs=require('fs');var path=require(_0x83ed('0x4'));var rimraf=require(_0x83ed('0x5'));var config=require(_0x83ed('0x6'));var attributes=require(_0x83ed('0x7'));module[_0x83ed('0x8')]=function(_0x3253cf,_0x5a8bb8){return _0x3253cf[_0x83ed('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x83ed('0xa'),'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 4fd21a7..19347d8 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 _0xaba7=['catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info'];(function(_0x5d8800,_0xf61eeb){var _0x4a8f53=function(_0x1f7a82){while(--_0x1f7a82){_0x5d8800['push'](_0x5d8800['shift']());}};_0x4a8f53(++_0xf61eeb);}(_0xaba7,0xe8));var _0x7aba=function(_0x319891,_0x9b28dc){_0x319891=_0x319891-0x0;var _0x8df70c=_0xaba7[_0x319891];return _0x8df70c;};'use strict';var _=require(_0x7aba('0x0'));var util=require('util');var moment=require(_0x7aba('0x1'));var BPromise=require('bluebird');var rs=require(_0x7aba('0x2'));var fs=require('fs');var Redis=require(_0x7aba('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7aba('0x4'))(_0x7aba('0x5'));var config=require('../../config/environment');var jayson=require(_0x7aba('0x6'));var client=jayson[_0x7aba('0x7')][_0x7aba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x376ceb,_0x53df04,_0x5931fd){return new BPromise(function(_0x3cd0ec,_0x256161){return client[_0x7aba('0x9')](_0x376ceb,_0x5931fd)[_0x7aba('0xa')](function(_0x2244a5){logger['info'](_0x7aba('0xb'),_0x53df04,_0x7aba('0xc'));logger[_0x7aba('0xd')](_0x7aba('0xe'),_0x53df04,_0x7aba('0xc'),JSON[_0x7aba('0xf')](_0x2244a5));if(_0x2244a5['error']){if(_0x2244a5['error'][_0x7aba('0x10')]===0x1f4){logger[_0x7aba('0x11')](_0x7aba('0xb'),_0x53df04,_0x2244a5[_0x7aba('0x11')][_0x7aba('0x12')]);return _0x256161(_0x2244a5[_0x7aba('0x11')][_0x7aba('0x12')]);}logger[_0x7aba('0x11')](_0x7aba('0xb'),_0x53df04,_0x2244a5[_0x7aba('0x11')][_0x7aba('0x12')]);return _0x3cd0ec(_0x2244a5[_0x7aba('0x11')][_0x7aba('0x12')]);}else{logger[_0x7aba('0x13')](_0x7aba('0xb'),_0x53df04,_0x7aba('0xc'));_0x3cd0ec(_0x2244a5['result'][_0x7aba('0x12')]);}})[_0x7aba('0x14')](function(_0x5b4fb1){logger[_0x7aba('0x11')](_0x7aba('0xb'),_0x53df04,_0x5b4fb1);_0x256161(_0x5b4fb1);});});} \ No newline at end of file +var _0xade4=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x521711,_0x2d3851){var _0x43e92c=function(_0x183104){while(--_0x183104){_0x521711['push'](_0x521711['shift']());}};_0x43e92c(++_0x2d3851);}(_0xade4,0x136));var _0x4ade=function(_0x407f44,_0x3d0acc){_0x407f44=_0x407f44-0x0;var _0x509d0d=_0xade4[_0x407f44];return _0x509d0d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ade('0x0'));var BPromise=require(_0x4ade('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ade('0x2'))['db'];var utils=require(_0x4ade('0x3'));var logger=require(_0x4ade('0x4'))(_0x4ade('0x5'));var config=require(_0x4ade('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4ade('0x7')][_0x4ade('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33be6e,_0x366dd1,_0x2edf1b){return new BPromise(function(_0x29a5f5,_0x44ceb4){return client['request'](_0x33be6e,_0x2edf1b)[_0x4ade('0x9')](function(_0x4ee815){logger[_0x4ade('0xa')](_0x4ade('0xb'),_0x366dd1,_0x4ade('0xc'));logger[_0x4ade('0xd')](_0x4ade('0xe'),_0x366dd1,_0x4ade('0xc'),JSON[_0x4ade('0xf')](_0x4ee815));if(_0x4ee815[_0x4ade('0x10')]){if(_0x4ee815[_0x4ade('0x10')][_0x4ade('0x11')]===0x1f4){logger['error'](_0x4ade('0xb'),_0x366dd1,_0x4ee815[_0x4ade('0x10')][_0x4ade('0x12')]);return _0x44ceb4(_0x4ee815['error'][_0x4ade('0x12')]);}logger[_0x4ade('0x10')](_0x4ade('0xb'),_0x366dd1,_0x4ee815[_0x4ade('0x10')][_0x4ade('0x12')]);return _0x29a5f5(_0x4ee815[_0x4ade('0x10')][_0x4ade('0x12')]);}else{logger['info'](_0x4ade('0xb'),_0x366dd1,_0x4ade('0xc'));_0x29a5f5(_0x4ee815[_0x4ade('0x13')][_0x4ade('0x12')]);}})['catch'](function(_0xca70ef){logger['error'](_0x4ade('0xb'),_0x366dd1,_0xca70ef);_0x44ceb4(_0xca70ef);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index c6a60b0..f227a7a 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 _0x9f2d=['getQuestions','create','update','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/questions'];(function(_0x32ee8f,_0x26da8a){var _0x2fc956=function(_0x5bf3ac){while(--_0x5bf3ac){_0x32ee8f['push'](_0x32ee8f['shift']());}};_0x2fc956(++_0x26da8a);}(_0x9f2d,0x11c));var _0xd9f2=function(_0x33620f,_0x36f2db){_0x33620f=_0x33620f-0x0;var _0x58faff=_0x9f2d[_0x33620f];return _0x58faff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd9f2('0x0'));var timeout=require('connect-timeout');var express=require(_0xd9f2('0x1'));var router=express[_0xd9f2('0x2')]();var fs_extra=require(_0xd9f2('0x3'));var auth=require(_0xd9f2('0x4'));var interaction=require(_0xd9f2('0x5'));var config=require(_0xd9f2('0x6'));var controller=require(_0xd9f2('0x7'));router[_0xd9f2('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9f2('0x9')]);router['get'](_0xd9f2('0xa'),auth[_0xd9f2('0xb')](),controller[_0xd9f2('0xc')]);router[_0xd9f2('0x8')](_0xd9f2('0xd'),auth[_0xd9f2('0xb')](),controller[_0xd9f2('0xe')]);router['get'](_0xd9f2('0xf'),auth[_0xd9f2('0xb')](),controller[_0xd9f2('0x10')]);router['post']('/',auth[_0xd9f2('0xb')](),controller[_0xd9f2('0x11')]);router['put'](_0xd9f2('0xd'),auth[_0xd9f2('0xb')](),controller[_0xd9f2('0x12')]);router['delete'](_0xd9f2('0xd'),auth[_0xd9f2('0xb')](),controller[_0xd9f2('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc086=['describe','/:id','show','/:id/questions','getQuestions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x7a9727,_0x306522){var _0x5c6430=function(_0x2d5a42){while(--_0x2d5a42){_0x7a9727['push'](_0x7a9727['shift']());}};_0x5c6430(++_0x306522);}(_0xc086,0x11f));var _0x6c08=function(_0x5383d4,_0x59338b){_0x5383d4=_0x5383d4-0x0;var _0x5919e0=_0xc086[_0x5383d4];return _0x5919e0;};'use strict';var multer=require(_0x6c08('0x0'));var util=require(_0x6c08('0x1'));var path=require(_0x6c08('0x2'));var timeout=require(_0x6c08('0x3'));var express=require(_0x6c08('0x4'));var router=express[_0x6c08('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6c08('0x6'));var interaction=require(_0x6c08('0x7'));var config=require(_0x6c08('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0x6c08('0x9')]('/',auth[_0x6c08('0xa')](),controller['index']);router[_0x6c08('0x9')](_0x6c08('0xb'),auth['isAuthenticated'](),controller[_0x6c08('0xc')]);router[_0x6c08('0x9')](_0x6c08('0xd'),auth[_0x6c08('0xa')](),controller[_0x6c08('0xe')]);router[_0x6c08('0x9')](_0x6c08('0xf'),auth[_0x6c08('0xa')](),controller[_0x6c08('0x10')]);router[_0x6c08('0x11')]('/',auth[_0x6c08('0xa')](),controller['create']);router[_0x6c08('0x12')](_0x6c08('0xd'),auth['isAuthenticated'](),controller[_0x6c08('0x13')]);router[_0x6c08('0x14')](_0x6c08('0xd'),auth[_0x6c08('0xa')](),controller[_0x6c08('0x15')]);module[_0x6c08('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 115b74f..978f210 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 _0xb955=['STRING','moment','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x467ea1,_0x18fd97){var _0x1c9fc7=function(_0x57cfbb){while(--_0x57cfbb){_0x467ea1['push'](_0x467ea1['shift']());}};_0x1c9fc7(++_0x18fd97);}(_0xb955,0x123));var _0x5b95=function(_0x58c705,_0x23b527){_0x58c705=_0x58c705-0x0;var _0x8e6cff=_0xb955[_0x58c705];return _0x8e6cff;};'use strict';var moment=require(_0x5b95('0x0'));var Sequelize=require(_0x5b95('0x1'));module[_0x5b95('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x51f9e5){this[_0x5b95('0x3')](_0x5b95('0x4'),_0x51f9e5);this[_0x5b95('0x3')](_0x5b95('0x5'),moment()[_0x5b95('0x6')](_0x5b95('0x7')));}},'endtime':{'type':Sequelize[_0x5b95('0x8')]},'membername':{'type':Sequelize[_0x5b95('0x9')]},'projectname':{'type':Sequelize[_0x5b95('0x9')]},'queue':{'type':Sequelize[_0x5b95('0x9')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5b95('0x9')]},'calleridnum':{'type':Sequelize[_0x5b95('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5557=['STRING','BOOLEAN','moment','exports','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x2570fe,_0x19a948){var _0x12bcf7=function(_0x2adde7){while(--_0x2adde7){_0x2570fe['push'](_0x2570fe['shift']());}};_0x12bcf7(++_0x19a948);}(_0x5557,0x1ba));var _0x7555=function(_0x117701,_0xce7013){_0x117701=_0x117701-0x0;var _0x3fca2d=_0x5557[_0x117701];return _0x3fca2d;};'use strict';var moment=require(_0x7555('0x0'));var Sequelize=require('sequelize');module[_0x7555('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x398591){this[_0x7555('0x2')]('starttime',_0x398591);this[_0x7555('0x2')]('endtime',moment()[_0x7555('0x3')](_0x7555('0x4')));}},'endtime':{'type':Sequelize[_0x7555('0x5')]},'membername':{'type':Sequelize[_0x7555('0x6')]},'projectname':{'type':Sequelize[_0x7555('0x6')]},'queue':{'type':Sequelize[_0x7555('0x6')]},'uniqueid':{'type':Sequelize[_0x7555('0x6')]},'calleridname':{'type':Sequelize[_0x7555('0x6')]},'calleridnum':{'type':Sequelize[_0x7555('0x6')]},'completed':{'type':Sequelize[_0x7555('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 58add9a..50a0e2b 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 _0xc3c2=['rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','options','JscriptySessionReport','includeAll','findAll','show','params','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','sort','SessionId','rows','eml-format','fast-json-patch','moment','bluebird','util','to-csv','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','count','limit','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','index','map'];(function(_0x3438d4,_0x4296e7){var _0x332e06=function(_0x1297e3){while(--_0x1297e3){_0x3438d4['push'](_0x3438d4['shift']());}};_0x332e06(++_0x4296e7);}(_0xc3c2,0x6d));var _0x2c3c=function(_0x52c062,_0x449490){_0x52c062=_0x52c062-0x0;var _0x5a1a03=_0xc3c2[_0x52c062];return _0x5a1a03;};'use strict';var emlformat=require(_0x2c3c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2c3c('0x1'));var rp=require('request-promise');var moment=require(_0x2c3c('0x2'));var BPromise=require(_0x2c3c('0x3'));var Mustache=require('mustache');var util=require(_0x2c3c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x2c3c('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c3c('0x6'));var squel=require(_0x2c3c('0x7'));var crypto=require(_0x2c3c('0x8'));var jsforce=require(_0x2c3c('0x9'));var deskjs=require(_0x2c3c('0xa'));var toCsv=require(_0x2c3c('0x5'));var querystring=require(_0x2c3c('0xb'));var Papa=require(_0x2c3c('0xc'));var Redis=require(_0x2c3c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2c3c('0xe'));var as=require(_0x2c3c('0xf'));var hardwareService=require(_0x2c3c('0x10'));var logger=require(_0x2c3c('0x11'))(_0x2c3c('0x12'));var utils=require(_0x2c3c('0x13'));var config=require(_0x2c3c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c3c('0x15'))['db'];function respondWithStatusCode(_0x203242,_0xbea04c){_0xbea04c=_0xbea04c||0xcc;return function(_0x79e244){if(_0x79e244){return _0x203242[_0x2c3c('0x16')](_0xbea04c);}return _0x203242[_0x2c3c('0x17')](_0xbea04c)[_0x2c3c('0x18')]();};}function respondWithResult(_0x30231e,_0x3cccae){_0x3cccae=_0x3cccae||0xc8;return function(_0x459eba){if(_0x459eba){return _0x30231e['status'](_0x3cccae)['json'](_0x459eba);}};}function respondWithFilteredResult(_0x2ab7ab,_0x3ee1a5){return function(_0x981a6e){if(_0x981a6e){var _0x4a83fc=typeof _0x3ee1a5[_0x2c3c('0x19')]===_0x2c3c('0x1a')&&typeof _0x3ee1a5['limit']==='undefined';var _0x50c09e=_0x981a6e[_0x2c3c('0x1b')];var _0x5e8b0f=_0x4a83fc?0x0:_0x3ee1a5[_0x2c3c('0x19')];var _0x3ce0bd=_0x4a83fc?_0x981a6e['count']:_0x3ee1a5[_0x2c3c('0x19')]+_0x3ee1a5[_0x2c3c('0x1c')];var _0x32d9c9;if(_0x3ce0bd>=_0x50c09e){_0x3ce0bd=_0x50c09e;_0x32d9c9=0xc8;}else{_0x32d9c9=0xce;}_0x2ab7ab['status'](_0x32d9c9);return _0x2ab7ab[_0x2c3c('0x1d')](_0x2c3c('0x1e'),_0x5e8b0f+'-'+_0x3ce0bd+'/'+_0x50c09e)[_0x2c3c('0x1f')](_0x981a6e);}return null;};}function patchUpdates(_0x48aaf1){return function(_0x34aa69){try{jsonpatch['apply'](_0x34aa69,_0x48aaf1,!![]);}catch(_0x18945b){return BPromise[_0x2c3c('0x20')](_0x18945b);}return _0x34aa69[_0x2c3c('0x21')]();};}function saveUpdates(_0x3b8a57,_0x5e11f1){return function(_0xc3d5f6){if(_0xc3d5f6){return _0xc3d5f6[_0x2c3c('0x22')](_0x3b8a57)['then'](function(_0x2f3ef8){return _0x2f3ef8;});}return null;};}function removeEntity(_0x506611,_0x2eaa26){return function(_0x627220){if(_0x627220){return _0x627220[_0x2c3c('0x23')]()[_0x2c3c('0x24')](function(){_0x506611[_0x2c3c('0x17')](0xcc)[_0x2c3c('0x18')]();});}};}function handleEntityNotFound(_0x425279,_0x94b7cb){return function(_0x430ff5){if(!_0x430ff5){_0x425279[_0x2c3c('0x16')](0x194);}return _0x430ff5;};}function handleError(_0x2666c7,_0x5c4486){_0x5c4486=_0x5c4486||0x1f4;return function(_0x1973d0){logger[_0x2c3c('0x25')](_0x1973d0[_0x2c3c('0x26')]);if(_0x1973d0[_0x2c3c('0x27')]){delete _0x1973d0['name'];}_0x2666c7[_0x2c3c('0x17')](_0x5c4486)[_0x2c3c('0x28')](_0x1973d0);};}exports[_0x2c3c('0x29')]=function(_0x445e25,_0xc01bd2){var _0x501da0={},_0x4833f7={},_0x102a58={'count':0x0,'rows':[]};var _0x28b59c=_[_0x2c3c('0x2a')](db['JscriptySessionReport'][_0x2c3c('0x2b')],function(_0x5bd6ed){return{'name':_0x5bd6ed['fieldName'],'type':_0x5bd6ed[_0x2c3c('0x2c')]['key']};});_0x4833f7[_0x2c3c('0x2d')]=_['map'](_0x28b59c,_0x2c3c('0x27'));_0x4833f7[_0x2c3c('0x2e')]=_[_0x2c3c('0x2f')](_0x445e25[_0x2c3c('0x2e')]);_0x4833f7['filters']=_[_0x2c3c('0x30')](_0x4833f7[_0x2c3c('0x2d')],_0x4833f7[_0x2c3c('0x2e')]);_0x501da0[_0x2c3c('0x31')]=_[_0x2c3c('0x30')](_0x4833f7[_0x2c3c('0x2d')],qs[_0x2c3c('0x32')](_0x445e25[_0x2c3c('0x2e')][_0x2c3c('0x32')]));_0x501da0[_0x2c3c('0x31')]=_0x501da0[_0x2c3c('0x31')][_0x2c3c('0x33')]?_0x501da0[_0x2c3c('0x31')]:_0x4833f7['model'];if(!_0x445e25[_0x2c3c('0x2e')]['hasOwnProperty'](_0x2c3c('0x34'))){_0x501da0[_0x2c3c('0x1c')]=qs[_0x2c3c('0x1c')](_0x445e25[_0x2c3c('0x2e')]['limit']);_0x501da0['offset']=qs[_0x2c3c('0x19')](_0x445e25[_0x2c3c('0x2e')][_0x2c3c('0x19')]);}_0x501da0[_0x2c3c('0x35')]=qs['sort'](_0x445e25[_0x2c3c('0x2e')]['sort']);_0x501da0[_0x2c3c('0x36')]=qs[_0x2c3c('0x37')](_[_0x2c3c('0x38')](_0x445e25[_0x2c3c('0x2e')],_0x4833f7['filters']),_0x28b59c);if(_0x445e25[_0x2c3c('0x2e')][_0x2c3c('0x39')]){_0x501da0[_0x2c3c('0x36')]=_[_0x2c3c('0x3a')](_0x501da0[_0x2c3c('0x36')],{'$or':_[_0x2c3c('0x2a')](_0x28b59c,function(_0x3ca2f4){if(_0x3ca2f4[_0x2c3c('0x2c')]!=='VIRTUAL'){var _0x4df45b={};_0x4df45b[_0x3ca2f4['name']]={'$like':'%'+_0x445e25['query'][_0x2c3c('0x39')]+'%'};return _0x4df45b;}})});}_0x501da0=_['merge']({},_0x501da0,_0x445e25[_0x2c3c('0x3b')]);var _0x2926ad={'where':_0x501da0[_0x2c3c('0x36')]};return db[_0x2c3c('0x3c')][_0x2c3c('0x1b')](_0x2926ad)[_0x2c3c('0x24')](function(_0x2b5261){_0x102a58['count']=_0x2b5261;if(_0x445e25[_0x2c3c('0x2e')][_0x2c3c('0x3d')]){_0x501da0['include']=[{'all':!![]}];}return db[_0x2c3c('0x3c')][_0x2c3c('0x3e')](_0x501da0);})['then'](function(_0x57d642){_0x102a58['rows']=_0x57d642;return _0x102a58;})[_0x2c3c('0x24')](respondWithFilteredResult(_0xc01bd2,_0x501da0))['catch'](handleError(_0xc01bd2,null));};exports[_0x2c3c('0x3f')]=function(_0x5bed73,_0x5f38c5){var _0x3a01d6={'raw':!![],'where':{'id':_0x5bed73[_0x2c3c('0x40')]['id']}},_0x145447={};_0x145447[_0x2c3c('0x2d')]=_[_0x2c3c('0x2f')](db[_0x2c3c('0x3c')]['rawAttributes']);_0x145447[_0x2c3c('0x2e')]=_[_0x2c3c('0x2f')](_0x5bed73['query']);_0x145447['filters']=_['intersection'](_0x145447[_0x2c3c('0x2d')],_0x145447[_0x2c3c('0x2e')]);_0x3a01d6[_0x2c3c('0x31')]=_[_0x2c3c('0x30')](_0x145447[_0x2c3c('0x2d')],qs['fields'](_0x5bed73['query'][_0x2c3c('0x32')]));_0x3a01d6['attributes']=_0x3a01d6['attributes']['length']?_0x3a01d6[_0x2c3c('0x31')]:_0x145447['model'];if(_0x5bed73[_0x2c3c('0x2e')][_0x2c3c('0x3d')]){_0x3a01d6['include']=[{'all':!![]}];}_0x3a01d6=_['merge']({},_0x3a01d6,_0x5bed73['options']);return db['JscriptySessionReport'][_0x2c3c('0x41')](_0x3a01d6)[_0x2c3c('0x24')](handleEntityNotFound(_0x5f38c5,null))[_0x2c3c('0x24')](respondWithResult(_0x5f38c5,null))[_0x2c3c('0x42')](handleError(_0x5f38c5,null));};exports[_0x2c3c('0x43')]=function(_0x543ab5,_0x4e0abb){return db['JscriptySessionReport'][_0x2c3c('0x43')](_0x543ab5[_0x2c3c('0x44')],{})[_0x2c3c('0x24')](respondWithResult(_0x4e0abb,0xc9))[_0x2c3c('0x42')](handleError(_0x4e0abb,null));};exports[_0x2c3c('0x22')]=function(_0x365ea9,_0x1cd986){if(_0x365ea9[_0x2c3c('0x44')]['id']){delete _0x365ea9[_0x2c3c('0x44')]['id'];}return db['JscriptySessionReport'][_0x2c3c('0x41')]({'where':{'id':_0x365ea9[_0x2c3c('0x40')]['id']}})[_0x2c3c('0x24')](handleEntityNotFound(_0x1cd986,null))[_0x2c3c('0x24')](saveUpdates(_0x365ea9['body'],null))['then'](respondWithResult(_0x1cd986,null))[_0x2c3c('0x42')](handleError(_0x1cd986,null));};exports[_0x2c3c('0x23')]=function(_0x1093e2,_0x272e92){return db[_0x2c3c('0x3c')]['find']({'where':{'id':_0x1093e2[_0x2c3c('0x40')]['id']}})[_0x2c3c('0x24')](handleEntityNotFound(_0x272e92,null))[_0x2c3c('0x24')](removeEntity(_0x272e92,null))['catch'](handleError(_0x272e92,null));};exports[_0x2c3c('0x45')]=function(_0x1b0050,_0x1f573a){return db[_0x2c3c('0x3c')][_0x2c3c('0x45')]()[_0x2c3c('0x24')](respondWithResult(_0x1f573a,null))[_0x2c3c('0x42')](handleError(_0x1f573a,null));};exports[_0x2c3c('0x46')]=function(_0x332fd2,_0x34a0b1,_0xde9458){var _0x224870={'raw':!![],'where':{}};var _0x1fa1bc={};var _0x30862f={'count':0x0,'rows':[]};return db[_0x2c3c('0x3c')][_0x2c3c('0x47')]({'where':{'id':_0x332fd2[_0x2c3c('0x40')]['id']}})[_0x2c3c('0x24')](handleEntityNotFound(_0x34a0b1,null))[_0x2c3c('0x24')](function(_0x4ec854){if(_0x4ec854){_0x1fa1bc[_0x2c3c('0x2d')]=_[_0x2c3c('0x2f')](db[_0x2c3c('0x48')][_0x2c3c('0x2b')]);_0x1fa1bc['query']=_['keys'](_0x332fd2[_0x2c3c('0x2e')]);_0x1fa1bc['filters']=_[_0x2c3c('0x30')](_0x1fa1bc[_0x2c3c('0x2d')],_0x1fa1bc['query']);_0x224870[_0x2c3c('0x31')]=_[_0x2c3c('0x30')](_0x1fa1bc[_0x2c3c('0x2d')],qs[_0x2c3c('0x32')](_0x332fd2[_0x2c3c('0x2e')]['fields']));_0x224870[_0x2c3c('0x31')]=_0x224870[_0x2c3c('0x31')][_0x2c3c('0x33')]?_0x224870[_0x2c3c('0x31')]:_0x1fa1bc[_0x2c3c('0x2d')];if(!_0x332fd2['query']['hasOwnProperty'](_0x2c3c('0x34'))){_0x224870[_0x2c3c('0x1c')]=qs[_0x2c3c('0x1c')](_0x332fd2[_0x2c3c('0x2e')][_0x2c3c('0x1c')]);_0x224870[_0x2c3c('0x19')]=qs[_0x2c3c('0x19')](_0x332fd2[_0x2c3c('0x2e')][_0x2c3c('0x19')]);}_0x224870[_0x2c3c('0x35')]=qs[_0x2c3c('0x49')](_0x332fd2['query'][_0x2c3c('0x49')]);_0x224870['where']=qs['filters'](_['pick'](_0x332fd2['query'],_0x1fa1bc[_0x2c3c('0x37')]));_0x224870[_0x2c3c('0x36')][_0x2c3c('0x4a')]=_0x4ec854['id'];if(_0x332fd2['query'][_0x2c3c('0x39')]){_0x224870[_0x2c3c('0x36')]=_['merge'](_0x224870['where'],{'$or':_[_0x2c3c('0x2a')](_0x224870['attributes'],function(_0x3b8fe6){var _0x18acde={};_0x18acde[_0x3b8fe6]={'$like':'%'+_0x332fd2[_0x2c3c('0x2e')]['filter']+'%'};return _0x18acde;})});}_0x224870=_['merge']({},_0x224870,_0x332fd2['options']);return db['JscriptyQuestionReport']['count']({'where':_0x224870[_0x2c3c('0x36')]})[_0x2c3c('0x24')](function(_0x4a2849){_0x30862f[_0x2c3c('0x1b')]=_0x4a2849;if(_0x332fd2[_0x2c3c('0x2e')][_0x2c3c('0x3d')]){_0x224870['include']=[{'all':!![]}];}return db[_0x2c3c('0x48')][_0x2c3c('0x3e')](_0x224870);})[_0x2c3c('0x24')](function(_0x9a20e){_0x30862f[_0x2c3c('0x4b')]=_0x9a20e;return _0x30862f;});}})[_0x2c3c('0x24')](respondWithFilteredResult(_0x34a0b1,_0x224870))[_0x2c3c('0x42')](handleError(_0x34a0b1,null));}; \ No newline at end of file +var _0xdde0=['then','destroy','sendStatus','stack','name','send','index','JscriptySessionReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','undefined','count','Content-Range','apply','update'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xdde0,0x1bc));var _0x0dde=function(_0xd476a8,_0x35c4bb){_0xd476a8=_0xd476a8-0x0;var _0x210b04=_0xdde0[_0xd476a8];return _0x210b04;};'use strict';var emlformat=require(_0x0dde('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0dde('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0dde('0x2'));var moment=require(_0x0dde('0x3'));var BPromise=require(_0x0dde('0x4'));var Mustache=require(_0x0dde('0x5'));var util=require(_0x0dde('0x6'));var path=require(_0x0dde('0x7'));var sox=require(_0x0dde('0x8'));var csv=require(_0x0dde('0x9'));var ejs=require(_0x0dde('0xa'));var fs=require('fs');var fs_extra=require(_0x0dde('0xb'));var _=require(_0x0dde('0xc'));var squel=require(_0x0dde('0xd'));var crypto=require(_0x0dde('0xe'));var jsforce=require(_0x0dde('0xf'));var deskjs=require(_0x0dde('0x10'));var toCsv=require(_0x0dde('0x9'));var querystring=require('querystring');var Papa=require(_0x0dde('0x11'));var Redis=require(_0x0dde('0x12'));var authService=require(_0x0dde('0x13'));var qs=require(_0x0dde('0x14'));var as=require(_0x0dde('0x15'));var hardwareService=require(_0x0dde('0x16'));var logger=require(_0x0dde('0x17'))(_0x0dde('0x18'));var utils=require(_0x0dde('0x19'));var config=require(_0x0dde('0x1a'));var licenseUtil=require(_0x0dde('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fe653,_0x5f0fd3){_0x5f0fd3=_0x5f0fd3||0xcc;return function(_0x1acc50){if(_0x1acc50){return _0x2fe653['sendStatus'](_0x5f0fd3);}return _0x2fe653[_0x0dde('0x1c')](_0x5f0fd3)['end']();};}function respondWithResult(_0xb1064b,_0x3c377b){_0x3c377b=_0x3c377b||0xc8;return function(_0x4c66d4){if(_0x4c66d4){return _0xb1064b[_0x0dde('0x1c')](_0x3c377b)['json'](_0x4c66d4);}};}function respondWithFilteredResult(_0x3dfa66,_0x2e9298){return function(_0x336ae0){if(_0x336ae0){var _0x3c20ee=typeof _0x2e9298[_0x0dde('0x1d')]==='undefined'&&typeof _0x2e9298[_0x0dde('0x1e')]===_0x0dde('0x1f');var _0x84fb73=_0x336ae0['count'];var _0x13f32d=_0x3c20ee?0x0:_0x2e9298['offset'];var _0x1ec66f=_0x3c20ee?_0x336ae0[_0x0dde('0x20')]:_0x2e9298[_0x0dde('0x1d')]+_0x2e9298[_0x0dde('0x1e')];var _0x59a4fb;if(_0x1ec66f>=_0x84fb73){_0x1ec66f=_0x84fb73;_0x59a4fb=0xc8;}else{_0x59a4fb=0xce;}_0x3dfa66[_0x0dde('0x1c')](_0x59a4fb);return _0x3dfa66['set'](_0x0dde('0x21'),_0x13f32d+'-'+_0x1ec66f+'/'+_0x84fb73)['json'](_0x336ae0);}return null;};}function patchUpdates(_0x3a2927){return function(_0x5f3ccd){try{jsonpatch[_0x0dde('0x22')](_0x5f3ccd,_0x3a2927,!![]);}catch(_0x4255af){return BPromise['reject'](_0x4255af);}return _0x5f3ccd['save']();};}function saveUpdates(_0x1f2017,_0x4acdfe){return function(_0x213f0b){if(_0x213f0b){return _0x213f0b[_0x0dde('0x23')](_0x1f2017)[_0x0dde('0x24')](function(_0x4234f4){return _0x4234f4;});}return null;};}function removeEntity(_0xb0b9a9,_0x40fe59){return function(_0x4170f6){if(_0x4170f6){return _0x4170f6[_0x0dde('0x25')]()['then'](function(){_0xb0b9a9[_0x0dde('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5512bd,_0x2c6b91){return function(_0x3319a1){if(!_0x3319a1){_0x5512bd[_0x0dde('0x26')](0x194);}return _0x3319a1;};}function handleError(_0x55825e,_0x16d949){_0x16d949=_0x16d949||0x1f4;return function(_0x5e1d87){logger['error'](_0x5e1d87[_0x0dde('0x27')]);if(_0x5e1d87[_0x0dde('0x28')]){delete _0x5e1d87[_0x0dde('0x28')];}_0x55825e[_0x0dde('0x1c')](_0x16d949)[_0x0dde('0x29')](_0x5e1d87);};}exports[_0x0dde('0x2a')]=function(_0x1546b7,_0x34f5ec){var _0x4c0875={},_0x33394f={},_0x52248c={'count':0x0,'rows':[]};var _0x514ab3=_['map'](db[_0x0dde('0x2b')]['rawAttributes'],function(_0x1b4f66){return{'name':_0x1b4f66[_0x0dde('0x2c')],'type':_0x1b4f66[_0x0dde('0x2d')][_0x0dde('0x2e')]};});_0x33394f[_0x0dde('0x2f')]=_[_0x0dde('0x30')](_0x514ab3,_0x0dde('0x28'));_0x33394f[_0x0dde('0x31')]=_[_0x0dde('0x32')](_0x1546b7[_0x0dde('0x31')]);_0x33394f[_0x0dde('0x33')]=_[_0x0dde('0x34')](_0x33394f[_0x0dde('0x2f')],_0x33394f[_0x0dde('0x31')]);_0x4c0875[_0x0dde('0x35')]=_[_0x0dde('0x34')](_0x33394f[_0x0dde('0x2f')],qs[_0x0dde('0x36')](_0x1546b7[_0x0dde('0x31')][_0x0dde('0x36')]));_0x4c0875[_0x0dde('0x35')]=_0x4c0875[_0x0dde('0x35')][_0x0dde('0x37')]?_0x4c0875[_0x0dde('0x35')]:_0x33394f['model'];if(!_0x1546b7[_0x0dde('0x31')]['hasOwnProperty'](_0x0dde('0x38'))){_0x4c0875['limit']=qs[_0x0dde('0x1e')](_0x1546b7[_0x0dde('0x31')][_0x0dde('0x1e')]);_0x4c0875[_0x0dde('0x1d')]=qs[_0x0dde('0x1d')](_0x1546b7[_0x0dde('0x31')][_0x0dde('0x1d')]);}_0x4c0875[_0x0dde('0x39')]=qs['sort'](_0x1546b7[_0x0dde('0x31')][_0x0dde('0x3a')]);_0x4c0875[_0x0dde('0x3b')]=qs[_0x0dde('0x33')](_[_0x0dde('0x3c')](_0x1546b7[_0x0dde('0x31')],_0x33394f[_0x0dde('0x33')]),_0x514ab3);if(_0x1546b7[_0x0dde('0x31')][_0x0dde('0x3d')]){_0x4c0875[_0x0dde('0x3b')]=_[_0x0dde('0x3e')](_0x4c0875[_0x0dde('0x3b')],{'$or':_[_0x0dde('0x30')](_0x514ab3,function(_0x1da9ed){if(_0x1da9ed[_0x0dde('0x2d')]!==_0x0dde('0x3f')){var _0x13a2de={};_0x13a2de[_0x1da9ed[_0x0dde('0x28')]]={'$like':'%'+_0x1546b7[_0x0dde('0x31')][_0x0dde('0x3d')]+'%'};return _0x13a2de;}})});}_0x4c0875=_['merge']({},_0x4c0875,_0x1546b7['options']);var _0x1a4c5f={'where':_0x4c0875['where']};return db['JscriptySessionReport'][_0x0dde('0x20')](_0x1a4c5f)[_0x0dde('0x24')](function(_0x54c08c){_0x52248c[_0x0dde('0x20')]=_0x54c08c;if(_0x1546b7[_0x0dde('0x31')]['includeAll']){_0x4c0875[_0x0dde('0x40')]=[{'all':!![]}];}return db[_0x0dde('0x2b')][_0x0dde('0x41')](_0x4c0875);})['then'](function(_0x57f31f){_0x52248c[_0x0dde('0x42')]=_0x57f31f;return _0x52248c;})[_0x0dde('0x24')](respondWithFilteredResult(_0x34f5ec,_0x4c0875))[_0x0dde('0x43')](handleError(_0x34f5ec,null));};exports[_0x0dde('0x44')]=function(_0x45f943,_0x19e1e0){var _0x1e638a={'raw':!![],'where':{'id':_0x45f943[_0x0dde('0x45')]['id']}},_0x5c35b4={};_0x5c35b4[_0x0dde('0x2f')]=_[_0x0dde('0x32')](db[_0x0dde('0x2b')][_0x0dde('0x46')]);_0x5c35b4[_0x0dde('0x31')]=_[_0x0dde('0x32')](_0x45f943[_0x0dde('0x31')]);_0x5c35b4[_0x0dde('0x33')]=_[_0x0dde('0x34')](_0x5c35b4[_0x0dde('0x2f')],_0x5c35b4['query']);_0x1e638a[_0x0dde('0x35')]=_['intersection'](_0x5c35b4[_0x0dde('0x2f')],qs['fields'](_0x45f943['query'][_0x0dde('0x36')]));_0x1e638a[_0x0dde('0x35')]=_0x1e638a['attributes']['length']?_0x1e638a[_0x0dde('0x35')]:_0x5c35b4['model'];if(_0x45f943[_0x0dde('0x31')][_0x0dde('0x47')]){_0x1e638a[_0x0dde('0x40')]=[{'all':!![]}];}_0x1e638a=_[_0x0dde('0x3e')]({},_0x1e638a,_0x45f943[_0x0dde('0x48')]);return db[_0x0dde('0x2b')][_0x0dde('0x49')](_0x1e638a)['then'](handleEntityNotFound(_0x19e1e0,null))[_0x0dde('0x24')](respondWithResult(_0x19e1e0,null))[_0x0dde('0x43')](handleError(_0x19e1e0,null));};exports[_0x0dde('0x4a')]=function(_0x43abd0,_0x2a91f1){return db[_0x0dde('0x2b')][_0x0dde('0x4a')](_0x43abd0[_0x0dde('0x4b')],{})['then'](respondWithResult(_0x2a91f1,0xc9))[_0x0dde('0x43')](handleError(_0x2a91f1,null));};exports[_0x0dde('0x23')]=function(_0x8fb6fb,_0x18215c){if(_0x8fb6fb[_0x0dde('0x4b')]['id']){delete _0x8fb6fb[_0x0dde('0x4b')]['id'];}return db[_0x0dde('0x2b')][_0x0dde('0x49')]({'where':{'id':_0x8fb6fb[_0x0dde('0x45')]['id']}})[_0x0dde('0x24')](handleEntityNotFound(_0x18215c,null))[_0x0dde('0x24')](saveUpdates(_0x8fb6fb['body'],null))['then'](respondWithResult(_0x18215c,null))[_0x0dde('0x43')](handleError(_0x18215c,null));};exports[_0x0dde('0x25')]=function(_0x1b2e5c,_0x1061f5){return db[_0x0dde('0x2b')][_0x0dde('0x49')]({'where':{'id':_0x1b2e5c[_0x0dde('0x45')]['id']}})[_0x0dde('0x24')](handleEntityNotFound(_0x1061f5,null))[_0x0dde('0x24')](removeEntity(_0x1061f5,null))[_0x0dde('0x43')](handleError(_0x1061f5,null));};exports['describe']=function(_0xfa9aab,_0x3114db){return db[_0x0dde('0x2b')]['describe']()['then'](respondWithResult(_0x3114db,null))['catch'](handleError(_0x3114db,null));};exports[_0x0dde('0x4c')]=function(_0xc0f6a4,_0x2bb382,_0x584fc5){var _0x5dc02e={'raw':!![],'where':{}};var _0x3774c9={};var _0x253f06={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x0dde('0x4d')]({'where':{'id':_0xc0f6a4[_0x0dde('0x45')]['id']}})[_0x0dde('0x24')](handleEntityNotFound(_0x2bb382,null))['then'](function(_0x3e061d){if(_0x3e061d){_0x3774c9['model']=_[_0x0dde('0x32')](db[_0x0dde('0x4e')][_0x0dde('0x46')]);_0x3774c9[_0x0dde('0x31')]=_[_0x0dde('0x32')](_0xc0f6a4[_0x0dde('0x31')]);_0x3774c9[_0x0dde('0x33')]=_['intersection'](_0x3774c9[_0x0dde('0x2f')],_0x3774c9[_0x0dde('0x31')]);_0x5dc02e[_0x0dde('0x35')]=_[_0x0dde('0x34')](_0x3774c9[_0x0dde('0x2f')],qs['fields'](_0xc0f6a4['query']['fields']));_0x5dc02e['attributes']=_0x5dc02e['attributes'][_0x0dde('0x37')]?_0x5dc02e['attributes']:_0x3774c9[_0x0dde('0x2f')];if(!_0xc0f6a4[_0x0dde('0x31')][_0x0dde('0x4f')]('nolimit')){_0x5dc02e[_0x0dde('0x1e')]=qs[_0x0dde('0x1e')](_0xc0f6a4[_0x0dde('0x31')][_0x0dde('0x1e')]);_0x5dc02e[_0x0dde('0x1d')]=qs[_0x0dde('0x1d')](_0xc0f6a4[_0x0dde('0x31')][_0x0dde('0x1d')]);}_0x5dc02e[_0x0dde('0x39')]=qs['sort'](_0xc0f6a4[_0x0dde('0x31')][_0x0dde('0x3a')]);_0x5dc02e[_0x0dde('0x3b')]=qs[_0x0dde('0x33')](_[_0x0dde('0x3c')](_0xc0f6a4[_0x0dde('0x31')],_0x3774c9[_0x0dde('0x33')]));_0x5dc02e['where']['SessionId']=_0x3e061d['id'];if(_0xc0f6a4[_0x0dde('0x31')][_0x0dde('0x3d')]){_0x5dc02e[_0x0dde('0x3b')]=_[_0x0dde('0x3e')](_0x5dc02e[_0x0dde('0x3b')],{'$or':_[_0x0dde('0x30')](_0x5dc02e[_0x0dde('0x35')],function(_0x44456c){var _0x6cd7bd={};_0x6cd7bd[_0x44456c]={'$like':'%'+_0xc0f6a4['query'][_0x0dde('0x3d')]+'%'};return _0x6cd7bd;})});}_0x5dc02e=_[_0x0dde('0x3e')]({},_0x5dc02e,_0xc0f6a4['options']);return db['JscriptyQuestionReport'][_0x0dde('0x20')]({'where':_0x5dc02e[_0x0dde('0x3b')]})['then'](function(_0x2ef9ea){_0x253f06[_0x0dde('0x20')]=_0x2ef9ea;if(_0xc0f6a4[_0x0dde('0x31')]['includeAll']){_0x5dc02e[_0x0dde('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x0dde('0x41')](_0x5dc02e);})[_0x0dde('0x24')](function(_0x189a9b){_0x253f06[_0x0dde('0x42')]=_0x189a9b;return _0x253f06;});}})['then'](respondWithFilteredResult(_0x2bb382,_0x5dc02e))[_0x0dde('0x43')](handleError(_0x2bb382,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 19b82d9..2014f55 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 _0x038b=['report_jscripty_sessions','util','../../config/logger','api','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x4f30d7,_0x5d9c70){var _0x4910c2=function(_0x7006ad){while(--_0x7006ad){_0x4f30d7['push'](_0x4f30d7['shift']());}};_0x4910c2(++_0x5d9c70);}(_0x038b,0x114));var _0xb038=function(_0xdc78bf,_0x157280){_0xdc78bf=_0xdc78bf-0x0;var _0xc6791d=_0x038b[_0xdc78bf];return _0xc6791d;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b8f=['exports','define','JscriptySessionReport','report_jscripty_sessions','util','api','request-promise','path','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x3a9b37,_0x4ab4e0){var _0xefd566=function(_0x19e246){while(--_0x19e246){_0x3a9b37['push'](_0x3a9b37['shift']());}};_0xefd566(++_0x4ab4e0);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x2afca7,_0xa1a787){_0x2afca7=_0x2afca7-0x0;var _0xa02f01=_0x6b8f[_0x2afca7];return _0xa02f01;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'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 184634a..d38c73c 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 _0x0424=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x0424,0x159));var _0x4042=function(_0x3238ea,_0x91809d){_0x3238ea=_0x3238ea-0x0;var _0x4aaac2=_0x0424[_0x3238ea];return _0x4aaac2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});} \ No newline at end of file +var _0xd046=['ioredis','../../config/logger','../../config/environment','http','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xd046,0x129));var _0x6d04=function(_0x58b955,_0x19aae5){_0x58b955=_0x58b955-0x0;var _0x4f7953=_0xd046[_0x58b955];return _0x4f7953;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7b0db43..79f36c8 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 _0x4aca=['get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x4aca,0x195));var _0xa4ac=function(_0x2a1e03,_0x12c122){_0x2a1e03=_0x2a1e03-0x0;var _0x5b94b6=_0x4aca[_0x2a1e03];return _0x5b94b6;};'use strict';var multer=require('multer');var util=require(_0xa4ac('0x0'));var path=require(_0xa4ac('0x1'));var timeout=require(_0xa4ac('0x2'));var express=require(_0xa4ac('0x3'));var router=express['Router']();var fs_extra=require(_0xa4ac('0x4'));var auth=require(_0xa4ac('0x5'));var interaction=require(_0xa4ac('0x6'));var config=require(_0xa4ac('0x7'));var controller=require(_0xa4ac('0x8'));router[_0xa4ac('0x9')]('/',controller[_0xa4ac('0xa')]);router[_0xa4ac('0xb')](_0xa4ac('0xc'),auth[_0xa4ac('0xd')](),controller[_0xa4ac('0xe')]);router[_0xa4ac('0x9')](_0xa4ac('0xf'),auth[_0xa4ac('0xd')](),controller[_0xa4ac('0x10')]);module[_0xa4ac('0x11')]=router; \ No newline at end of file +var _0x305a=['./license.controller','index','put','/:id','update','get','/download_log_file','isAuthenticated','downloadLogFile','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4ad878,_0x5d6b8f){var _0x1a562a=function(_0x252a18){while(--_0x252a18){_0x4ad878['push'](_0x4ad878['shift']());}};_0x1a562a(++_0x5d6b8f);}(_0x305a,0x89));var _0xa305=function(_0x1ffa39,_0x2e0533){_0x1ffa39=_0x1ffa39-0x0;var _0x1011de=_0x305a[_0x1ffa39];return _0x1011de;};'use strict';var multer=require(_0xa305('0x0'));var util=require(_0xa305('0x1'));var path=require(_0xa305('0x2'));var timeout=require(_0xa305('0x3'));var express=require(_0xa305('0x4'));var router=express[_0xa305('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa305('0x6'));var config=require('../../config/environment');var controller=require(_0xa305('0x7'));router['get']('/',controller[_0xa305('0x8')]);router[_0xa305('0x9')](_0xa305('0xa'),auth['isAuthenticated'](),controller[_0xa305('0xb')]);router[_0xa305('0xc')](_0xa305('0xd'),auth[_0xa305('0xe')](),controller[_0xa305('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 537a32c..a3cd469 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 _0x21a1=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x3c1312,_0x45bfdb){var _0x5b4831=function(_0x53706f){while(--_0x53706f){_0x3c1312['push'](_0x3c1312['shift']());}};_0x5b4831(++_0x45bfdb);}(_0x21a1,0x1b1));var _0x121a=function(_0x4aeff0,_0x52546b){_0x4aeff0=_0x4aeff0-0x0;var _0x39d4c5=_0x21a1[_0x4aeff0];return _0x39d4c5;};'use strict';var Sequelize=require(_0x121a('0x0'));module[_0x121a('0x1')]={'license':{'type':Sequelize[_0x121a('0x2')]},'data1':{'type':Sequelize[_0x121a('0x3')]},'data2':{'type':Sequelize[_0x121a('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x121a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3427=['STRING','TEXT'];(function(_0x5f4668,_0x3ccba7){var _0x265a7b=function(_0x4e6bed){while(--_0x4e6bed){_0x5f4668['push'](_0x5f4668['shift']());}};_0x265a7b(++_0x3ccba7);}(_0x3427,0x133));var _0x7342=function(_0x24c523,_0x5f4a6c){_0x24c523=_0x24c523-0x0;var _0x3d135e=_0x3427[_0x24c523];return _0x3d135e;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x7342('0x0')]},'data1':{'type':Sequelize[_0x7342('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 3ad5052..e496a4f 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 _0x1f4b=['reject','save','then','destroy','error','name','index','rawAttributes','keys','query','intersection','model','fields','attributes','merge','getLicense','catch','update','body','License','find','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','/var','log','xcally','setHeader','attachment;\x20filename=','Content-Type','download','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x32554e,_0x2e45fa){var _0x398088=function(_0x4da197){while(--_0x4da197){_0x32554e['push'](_0x32554e['shift']());}};_0x398088(++_0x2e45fa);}(_0x1f4b,0x16d));var _0xb1f4=function(_0x6b3f9c,_0x433d66){_0x6b3f9c=_0x6b3f9c-0x0;var _0x4178e3=_0x1f4b[_0x6b3f9c];return _0x4178e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1f4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1f4('0x1'));var rp=require(_0xb1f4('0x2'));var moment=require(_0xb1f4('0x3'));var BPromise=require(_0xb1f4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb1f4('0x5'));var csv=require(_0xb1f4('0x6'));var ejs=require(_0xb1f4('0x7'));var fs=require('fs');var fs_extra=require(_0xb1f4('0x8'));var _=require(_0xb1f4('0x9'));var squel=require(_0xb1f4('0xa'));var crypto=require(_0xb1f4('0xb'));var jsforce=require(_0xb1f4('0xc'));var deskjs=require(_0xb1f4('0xd'));var toCsv=require(_0xb1f4('0x6'));var querystring=require('querystring');var Papa=require(_0xb1f4('0xe'));var Redis=require('ioredis');var authService=require(_0xb1f4('0xf'));var qs=require(_0xb1f4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1f4('0x11'))(_0xb1f4('0x12'));var utils=require(_0xb1f4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb1f4('0x14'))['db'];function respondWithStatusCode(_0x1815c3,_0x857dd6){_0x857dd6=_0x857dd6||0xcc;return function(_0x51b336){if(_0x51b336){return _0x1815c3[_0xb1f4('0x15')](_0x857dd6);}return _0x1815c3[_0xb1f4('0x16')](_0x857dd6)[_0xb1f4('0x17')]();};}function respondWithResult(_0x54f6dd,_0x1236e2){_0x1236e2=_0x1236e2||0xc8;return function(_0x3d565f){if(_0x3d565f){return _0x54f6dd[_0xb1f4('0x16')](_0x1236e2)['json'](_0x3d565f);}};}function respondWithFilteredResult(_0x296d80,_0x1fba88){return function(_0x132163){if(_0x132163){var _0x521897=typeof _0x1fba88[_0xb1f4('0x18')]==='undefined'&&typeof _0x1fba88[_0xb1f4('0x19')]===_0xb1f4('0x1a');var _0x3bc98b=_0x132163[_0xb1f4('0x1b')];var _0x886ca9=_0x521897?0x0:_0x1fba88[_0xb1f4('0x18')];var _0x97218f=_0x521897?_0x132163[_0xb1f4('0x1b')]:_0x1fba88[_0xb1f4('0x18')]+_0x1fba88['limit'];var _0x51c714;if(_0x97218f>=_0x3bc98b){_0x97218f=_0x3bc98b;_0x51c714=0xc8;}else{_0x51c714=0xce;}_0x296d80[_0xb1f4('0x16')](_0x51c714);return _0x296d80[_0xb1f4('0x1c')](_0xb1f4('0x1d'),_0x886ca9+'-'+_0x97218f+'/'+_0x3bc98b)['json'](_0x132163);}return null;};}function patchUpdates(_0x5ce13e){return function(_0x48ba69){try{jsonpatch[_0xb1f4('0x1e')](_0x48ba69,_0x5ce13e,!![]);}catch(_0xb9544){return BPromise[_0xb1f4('0x1f')](_0xb9544);}return _0x48ba69[_0xb1f4('0x20')]();};}function saveUpdates(_0x3e2dc3,_0x19d107){return function(_0x3b5109){if(_0x3b5109){return _0x3b5109['update'](_0x3e2dc3)[_0xb1f4('0x21')](function(_0x9bcba5){return _0x9bcba5;});}return null;};}function removeEntity(_0x3d1d2d,_0x19eaf5){return function(_0x5db651){if(_0x5db651){return _0x5db651[_0xb1f4('0x22')]()['then'](function(){_0x3d1d2d['status'](0xcc)[_0xb1f4('0x17')]();});}};}function handleEntityNotFound(_0x1dfd69,_0x303554){return function(_0x171e50){if(!_0x171e50){_0x1dfd69[_0xb1f4('0x15')](0x194);}return _0x171e50;};}function handleError(_0x317253,_0x40d8f7){_0x40d8f7=_0x40d8f7||0x1f4;return function(_0x526f79){logger[_0xb1f4('0x23')](_0x526f79['stack']);if(_0x526f79[_0xb1f4('0x24')]){delete _0x526f79[_0xb1f4('0x24')];}_0x317253[_0xb1f4('0x16')](_0x40d8f7)['send'](_0x526f79);};}var utilLicense=require('../../config/license/util');exports[_0xb1f4('0x25')]=function(_0x2bd38f,_0x544136){var _0x500ee2={'raw':!![],'where':{'id':0x1}},_0x1c4260={};_0x1c4260['model']=_['keys'](db['License'][_0xb1f4('0x26')]);_0x1c4260['query']=_[_0xb1f4('0x27')](_0x2bd38f[_0xb1f4('0x28')]);_0x1c4260['filters']=_[_0xb1f4('0x29')](_0x1c4260[_0xb1f4('0x2a')],_0x1c4260[_0xb1f4('0x28')]);_0x500ee2['attributes']=_[_0xb1f4('0x29')](_0x1c4260[_0xb1f4('0x2a')],qs[_0xb1f4('0x2b')](_0x2bd38f[_0xb1f4('0x28')][_0xb1f4('0x2b')]));_0x500ee2[_0xb1f4('0x2c')]=_0x500ee2['attributes']['length']?_0x500ee2[_0xb1f4('0x2c')]:_0x1c4260[_0xb1f4('0x2a')];_0x500ee2=_[_0xb1f4('0x2d')]({},_0x500ee2,_0x2bd38f['options']);return utilLicense[_0xb1f4('0x2e')](_0x500ee2)[_0xb1f4('0x21')](respondWithResult(_0x544136,null))[_0xb1f4('0x2f')](handleError(_0x544136,null));};exports[_0xb1f4('0x30')]=function(_0x2a9e98,_0xa9364a){if(_0x2a9e98['body']['id']){delete _0x2a9e98[_0xb1f4('0x31')]['id'];}return db[_0xb1f4('0x32')][_0xb1f4('0x33')]({'where':{'id':_0x2a9e98[_0xb1f4('0x34')]['id']}})[_0xb1f4('0x21')](handleEntityNotFound(_0xa9364a,null))[_0xb1f4('0x21')](function(_0x3acc40){var _0x130c45=_0x3acc40[_0xb1f4('0x35')]({'plain':!![]});return utilLicense[_0xb1f4('0x36')](_0x130c45,_0x2a9e98[_0xb1f4('0x31')][_0xb1f4('0x37')]);})[_0xb1f4('0x21')](function(_0x57f0ba){if(!_0x57f0ba[_0xb1f4('0x38')]){return saveUpdates(_0x2a9e98[_0xb1f4('0x31')],null);}return _0x57f0ba;})[_0xb1f4('0x21')](respondWithResult(_0xa9364a,null))[_0xb1f4('0x2f')](handleError(_0xa9364a,null));};exports[_0xb1f4('0x39')]=function(_0x4d9d23,_0x376432){var _0x31f801=_0xb1f4('0x3a');var _0x291ee4=path['join'](_0xb1f4('0x3b'),_0xb1f4('0x3c'),_0xb1f4('0x3d'),_0x31f801);_0x376432[_0xb1f4('0x3e')]('Content-disposition',_0xb1f4('0x3f')+_0x31f801);_0x376432[_0xb1f4('0x1c')](_0xb1f4('0x40'),'text/plain');_0x376432[_0xb1f4('0x41')](_0x291ee4);}; \ No newline at end of file +var _0xd47d=['text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','License','rawAttributes','query','filters','intersection','attributes','model','fields','length','options','getLicense','catch','body','params','get','checkLicense','key','demo','license-info.log','join','log','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type'];(function(_0x25cdb9,_0x4d338f){var _0x2ce804=function(_0xd1eb7e){while(--_0xd1eb7e){_0x25cdb9['push'](_0x25cdb9['shift']());}};_0x2ce804(++_0x4d338f);}(_0xd47d,0xd7));var _0xdd47=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0xd47d[_0x764874];return _0x29f9d5;};'use strict';var emlformat=require(_0xdd47('0x0'));var rimraf=require(_0xdd47('0x1'));var zipdir=require(_0xdd47('0x2'));var jsonpatch=require(_0xdd47('0x3'));var rp=require('request-promise');var moment=require(_0xdd47('0x4'));var BPromise=require(_0xdd47('0x5'));var Mustache=require(_0xdd47('0x6'));var util=require(_0xdd47('0x7'));var path=require('path');var sox=require(_0xdd47('0x8'));var csv=require(_0xdd47('0x9'));var ejs=require(_0xdd47('0xa'));var fs=require('fs');var fs_extra=require(_0xdd47('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdd47('0xc'));var jsforce=require(_0xdd47('0xd'));var deskjs=require(_0xdd47('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdd47('0xf'));var Papa=require(_0xdd47('0x10'));var Redis=require('ioredis');var authService=require(_0xdd47('0x11'));var qs=require(_0xdd47('0x12'));var as=require(_0xdd47('0x13'));var hardwareService=require(_0xdd47('0x14'));var logger=require(_0xdd47('0x15'))(_0xdd47('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdd47('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9f12b6,_0x2894cc){_0x2894cc=_0x2894cc||0xcc;return function(_0x52a44c){if(_0x52a44c){return _0x9f12b6['sendStatus'](_0x2894cc);}return _0x9f12b6['status'](_0x2894cc)['end']();};}function respondWithResult(_0x20b89e,_0x25b133){_0x25b133=_0x25b133||0xc8;return function(_0x5b3332){if(_0x5b3332){return _0x20b89e[_0xdd47('0x18')](_0x25b133)[_0xdd47('0x19')](_0x5b3332);}};}function respondWithFilteredResult(_0x56da2e,_0x34782a){return function(_0x199142){if(_0x199142){var _0xc9c8f5=typeof _0x34782a[_0xdd47('0x1a')]==='undefined'&&typeof _0x34782a[_0xdd47('0x1b')]===_0xdd47('0x1c');var _0x3385e6=_0x199142[_0xdd47('0x1d')];var _0x41eed8=_0xc9c8f5?0x0:_0x34782a[_0xdd47('0x1a')];var _0x4f72fe=_0xc9c8f5?_0x199142[_0xdd47('0x1d')]:_0x34782a['offset']+_0x34782a['limit'];var _0xe3072a;if(_0x4f72fe>=_0x3385e6){_0x4f72fe=_0x3385e6;_0xe3072a=0xc8;}else{_0xe3072a=0xce;}_0x56da2e[_0xdd47('0x18')](_0xe3072a);return _0x56da2e['set'](_0xdd47('0x1e'),_0x41eed8+'-'+_0x4f72fe+'/'+_0x3385e6)[_0xdd47('0x19')](_0x199142);}return null;};}function patchUpdates(_0x23716f){return function(_0x677d5e){try{jsonpatch[_0xdd47('0x1f')](_0x677d5e,_0x23716f,!![]);}catch(_0x2d9cd7){return BPromise[_0xdd47('0x20')](_0x2d9cd7);}return _0x677d5e[_0xdd47('0x21')]();};}function saveUpdates(_0x2e3cb2,_0x8af625){return function(_0x3a6de4){if(_0x3a6de4){return _0x3a6de4[_0xdd47('0x22')](_0x2e3cb2)[_0xdd47('0x23')](function(_0x2ba237){return _0x2ba237;});}return null;};}function removeEntity(_0x293016,_0x54fa80){return function(_0x13d9b9){if(_0x13d9b9){return _0x13d9b9['destroy']()[_0xdd47('0x23')](function(){_0x293016[_0xdd47('0x18')](0xcc)[_0xdd47('0x24')]();});}};}function handleEntityNotFound(_0x5425f4,_0xfd389f){return function(_0xd77d25){if(!_0xd77d25){_0x5425f4[_0xdd47('0x25')](0x194);}return _0xd77d25;};}function handleError(_0x1a76e4,_0x347a0e){_0x347a0e=_0x347a0e||0x1f4;return function(_0x3b0af8){logger[_0xdd47('0x26')](_0x3b0af8[_0xdd47('0x27')]);if(_0x3b0af8[_0xdd47('0x28')]){delete _0x3b0af8['name'];}_0x1a76e4[_0xdd47('0x18')](_0x347a0e)[_0xdd47('0x29')](_0x3b0af8);};}var utilLicense=require('../../config/license/util');exports[_0xdd47('0x2a')]=function(_0x335d77,_0x12ba9f){var _0x4ea48e={'raw':!![],'where':{'id':0x1}},_0x121659={};_0x121659['model']=_['keys'](db[_0xdd47('0x2b')][_0xdd47('0x2c')]);_0x121659['query']=_['keys'](_0x335d77[_0xdd47('0x2d')]);_0x121659[_0xdd47('0x2e')]=_[_0xdd47('0x2f')](_0x121659['model'],_0x121659[_0xdd47('0x2d')]);_0x4ea48e[_0xdd47('0x30')]=_[_0xdd47('0x2f')](_0x121659[_0xdd47('0x31')],qs[_0xdd47('0x32')](_0x335d77[_0xdd47('0x2d')][_0xdd47('0x32')]));_0x4ea48e['attributes']=_0x4ea48e[_0xdd47('0x30')][_0xdd47('0x33')]?_0x4ea48e[_0xdd47('0x30')]:_0x121659[_0xdd47('0x31')];_0x4ea48e=_['merge']({},_0x4ea48e,_0x335d77[_0xdd47('0x34')]);return utilLicense[_0xdd47('0x35')](_0x4ea48e)['then'](respondWithResult(_0x12ba9f,null))[_0xdd47('0x36')](handleError(_0x12ba9f,null));};exports['update']=function(_0x4e2eb8,_0x3b63e2){if(_0x4e2eb8[_0xdd47('0x37')]['id']){delete _0x4e2eb8[_0xdd47('0x37')]['id'];}return db[_0xdd47('0x2b')]['find']({'where':{'id':_0x4e2eb8[_0xdd47('0x38')]['id']}})[_0xdd47('0x23')](handleEntityNotFound(_0x3b63e2,null))['then'](function(_0x5dad22){var _0x4da0ec=_0x5dad22[_0xdd47('0x39')]({'plain':!![]});return utilLicense[_0xdd47('0x3a')](_0x4da0ec,_0x4e2eb8[_0xdd47('0x37')][_0xdd47('0x3b')]);})[_0xdd47('0x23')](function(_0x14e359){if(!_0x14e359[_0xdd47('0x3c')]){return saveUpdates(_0x4e2eb8[_0xdd47('0x37')],null);}return _0x14e359;})[_0xdd47('0x23')](respondWithResult(_0x3b63e2,null))['catch'](handleError(_0x3b63e2,null));};exports['downloadLogFile']=function(_0x19e626,_0xedf42b){var _0x4efaca=_0xdd47('0x3d');var _0x48afc4=path[_0xdd47('0x3e')]('/var',_0xdd47('0x3f'),_0xdd47('0x40'),_0x4efaca);_0xedf42b['setHeader'](_0xdd47('0x41'),_0xdd47('0x42')+_0x4efaca);_0xedf42b[_0xdd47('0x43')](_0xdd47('0x44'),_0xdd47('0x45'));_0xedf42b[_0xdd47('0x46')](_0x48afc4);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 175915b..6cdbcf9 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 _0x9245=['license','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./license.attributes','define'];(function(_0x1e6278,_0x4e4342){var _0x259fa2=function(_0x35e99e){while(--_0x35e99e){_0x1e6278['push'](_0x1e6278['shift']());}};_0x259fa2(++_0x4e4342);}(_0x9245,0x12d));var _0x5924=function(_0x51ebf7,_0x5aed3e){_0x51ebf7=_0x51ebf7-0x0;var _0x3c64f2=_0x9245[_0x51ebf7];return _0x3c64f2;};'use strict';var _=require(_0x5924('0x0'));var util=require('util');var logger=require(_0x5924('0x1'))(_0x5924('0x2'));var moment=require(_0x5924('0x3'));var BPromise=require(_0x5924('0x4'));var rp=require(_0x5924('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5924('0x6'));var attributes=require(_0x5924('0x7'));module['exports']=function(_0xe92a5b,_0x54f313){return _0xe92a5b[_0x5924('0x8')]('License',attributes,{'tableName':_0x5924('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5476=['path','./license.attributes','define','License','lodash','util','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5476,0x13f));var _0x6547=function(_0x3d70c7,_0x4801a1){_0x3d70c7=_0x3d70c7-0x0;var _0x2450e4=_0x5476[_0x3d70c7];return _0x2450e4;};'use strict';var _=require(_0x6547('0x0'));var util=require(_0x6547('0x1'));var logger=require('../../config/logger')(_0x6547('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6547('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6547('0x4'));module['exports']=function(_0xcfc5,_0xe9e0cd){return _0xcfc5[_0x6547('0x5')](_0x6547('0x6'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 0f84a23..0b99fc6 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 _0xcaed=['request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4a721e,_0x5550c6){var _0x51e78e=function(_0x12197f){while(--_0x12197f){_0x4a721e['push'](_0x4a721e['shift']());}};_0x51e78e(++_0x5550c6);}(_0xcaed,0x170));var _0xdcae=function(_0x306ac7,_0x2b3e46){_0x306ac7=_0x306ac7-0x0;var _0x1cd36d=_0xcaed[_0x306ac7];return _0x1cd36d;};'use strict';var _=require(_0xdcae('0x0'));var util=require('util');var moment=require(_0xdcae('0x1'));var BPromise=require('bluebird');var rs=require(_0xdcae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcae('0x3'))['db'];var utils=require(_0xdcae('0x4'));var logger=require('../../config/logger')(_0xdcae('0x5'));var config=require(_0xdcae('0x6'));var jayson=require(_0xdcae('0x7'));var client=jayson[_0xdcae('0x8')][_0xdcae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x480567,_0x83fd03,_0x150220){return new BPromise(function(_0x54eb10,_0x42c4dc){return client[_0xdcae('0xa')](_0x480567,_0x150220)[_0xdcae('0xb')](function(_0x58d4b6){logger[_0xdcae('0xc')](_0xdcae('0xd'),_0x83fd03,_0xdcae('0xe'));logger[_0xdcae('0xf')](_0xdcae('0x10'),_0x83fd03,_0xdcae('0xe'),JSON[_0xdcae('0x11')](_0x58d4b6));if(_0x58d4b6[_0xdcae('0x12')]){if(_0x58d4b6[_0xdcae('0x12')][_0xdcae('0x13')]===0x1f4){logger[_0xdcae('0x12')]('License,\x20%s,\x20%s',_0x83fd03,_0x58d4b6[_0xdcae('0x12')][_0xdcae('0x14')]);return _0x42c4dc(_0x58d4b6[_0xdcae('0x12')][_0xdcae('0x14')]);}logger[_0xdcae('0x12')](_0xdcae('0xd'),_0x83fd03,_0x58d4b6[_0xdcae('0x12')][_0xdcae('0x14')]);return _0x54eb10(_0x58d4b6[_0xdcae('0x12')]['message']);}else{logger[_0xdcae('0xc')](_0xdcae('0xd'),_0x83fd03,_0xdcae('0xe'));_0x54eb10(_0x58d4b6['result']['message']);}})['catch'](function(_0x4faf53){logger[_0xdcae('0x12')](_0xdcae('0xd'),_0x83fd03,_0x4faf53);_0x42c4dc(_0x4faf53);});});} \ No newline at end of file +var _0x12dc=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s'];(function(_0x2fdfb3,_0x1c8352){var _0x440d77=function(_0x3a8ab2){while(--_0x3a8ab2){_0x2fdfb3['push'](_0x2fdfb3['shift']());}};_0x440d77(++_0x1c8352);}(_0x12dc,0x140));var _0xc12d=function(_0x557450,_0x4f0819){_0x557450=_0x557450-0x0;var _0x3e137f=_0x12dc[_0x557450];return _0x3e137f;};'use strict';var _=require(_0xc12d('0x0'));var util=require(_0xc12d('0x1'));var moment=require('moment');var BPromise=require(_0xc12d('0x2'));var rs=require(_0xc12d('0x3'));var fs=require('fs');var Redis=require(_0xc12d('0x4'));var db=require(_0xc12d('0x5'))['db'];var utils=require(_0xc12d('0x6'));var logger=require(_0xc12d('0x7'))(_0xc12d('0x8'));var config=require(_0xc12d('0x9'));var jayson=require(_0xc12d('0xa'));var client=jayson[_0xc12d('0xb')][_0xc12d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38ad98,_0xa3f17b,_0x3457bb){return new BPromise(function(_0x5787bd,_0x36ee0c){return client['request'](_0x38ad98,_0x3457bb)[_0xc12d('0xd')](function(_0x18ac0e){logger[_0xc12d('0xe')](_0xc12d('0xf'),_0xa3f17b,'request\x20sent');logger[_0xc12d('0x10')]('License,\x20%s,\x20%s,\x20%s',_0xa3f17b,_0xc12d('0x11'),JSON[_0xc12d('0x12')](_0x18ac0e));if(_0x18ac0e[_0xc12d('0x13')]){if(_0x18ac0e[_0xc12d('0x13')][_0xc12d('0x14')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0xa3f17b,_0x18ac0e[_0xc12d('0x13')][_0xc12d('0x15')]);return _0x36ee0c(_0x18ac0e[_0xc12d('0x13')][_0xc12d('0x15')]);}logger[_0xc12d('0x13')]('License,\x20%s,\x20%s',_0xa3f17b,_0x18ac0e['error'][_0xc12d('0x15')]);return _0x5787bd(_0x18ac0e[_0xc12d('0x13')][_0xc12d('0x15')]);}else{logger[_0xc12d('0xe')](_0xc12d('0xf'),_0xa3f17b,_0xc12d('0x11'));_0x5787bd(_0x18ac0e[_0xc12d('0x16')][_0xc12d('0x15')]);}})[_0xc12d('0x17')](function(_0x3b6329){logger[_0xc12d('0x13')](_0xc12d('0xf'),_0xa3f17b,_0x3b6329);_0x36ee0c(_0x3b6329);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 08d6a61..c85a691 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 _0x39fc=['/:id/interactions','getInteractions','/:id/applications','getApplications','verifySmtp','/:id/users','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','addAgents','put','removeDispositions','delete','removeImap','removeSmtp','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getAnswers','getImap','getSmtp'];(function(_0x54298d,_0x3aeda7){var _0x51acbc=function(_0x10a4b8){while(--_0x10a4b8){_0x54298d['push'](_0x54298d['shift']());}};_0x51acbc(++_0x3aeda7);}(_0x39fc,0xc8));var _0xc39f=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x39fc[_0xa990b7];return _0x52c99c;};'use strict';var multer=require(_0xc39f('0x0'));var util=require(_0xc39f('0x1'));var path=require(_0xc39f('0x2'));var timeout=require(_0xc39f('0x3'));var express=require(_0xc39f('0x4'));var router=express[_0xc39f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc39f('0x6'));var interaction=require(_0xc39f('0x7'));var config=require(_0xc39f('0x8'));var controller=require(_0xc39f('0x9'));router[_0xc39f('0xa')]('/',auth[_0xc39f('0xb')](),controller[_0xc39f('0xc')]);router[_0xc39f('0xa')](_0xc39f('0xd'),auth[_0xc39f('0xb')](),controller[_0xc39f('0xe')]);router[_0xc39f('0xa')](_0xc39f('0xf'),auth[_0xc39f('0xb')](),controller[_0xc39f('0x10')]);router[_0xc39f('0xa')]('/:id/dispositions',auth[_0xc39f('0xb')](),controller['getDispositions']);router[_0xc39f('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc39f('0x11')]);router[_0xc39f('0xa')]('/:id/in_servers',auth[_0xc39f('0xb')](),controller[_0xc39f('0x12')]);router['get']('/:id/out_servers',auth[_0xc39f('0xb')](),controller[_0xc39f('0x13')]);router[_0xc39f('0xa')](_0xc39f('0x14'),auth['isAuthenticated'](),controller[_0xc39f('0x15')]);router['get'](_0xc39f('0x16'),auth['isAuthenticated'](),controller[_0xc39f('0x17')]);router['get']('/:id/messages',auth[_0xc39f('0xb')](),controller['getMessages']);router[_0xc39f('0xa')]('/:id/verify',auth[_0xc39f('0xb')](),controller[_0xc39f('0x18')]);router[_0xc39f('0xa')](_0xc39f('0x19'),auth[_0xc39f('0xb')](),controller['getAgents']);router[_0xc39f('0x1a')](_0xc39f('0x1b'),auth['isAuthenticated'](),controller[_0xc39f('0x1c')]);router[_0xc39f('0x1a')](_0xc39f('0x1d'),auth[_0xc39f('0xb')](),controller[_0xc39f('0x1e')]);router[_0xc39f('0x1a')]('/',auth[_0xc39f('0xb')](),controller[_0xc39f('0x1f')]);router[_0xc39f('0x1a')](_0xc39f('0x20'),auth[_0xc39f('0xb')](),controller[_0xc39f('0x21')]);router[_0xc39f('0x1a')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xc39f('0x22')]);router[_0xc39f('0x1a')](_0xc39f('0x14'),auth[_0xc39f('0xb')](),controller[_0xc39f('0x23')]);router[_0xc39f('0x1a')](_0xc39f('0x16'),auth[_0xc39f('0xb')](),controller[_0xc39f('0x24')]);router[_0xc39f('0x1a')]('/:id/send',auth[_0xc39f('0xb')](),controller['send']);router[_0xc39f('0x1a')](_0xc39f('0x19'),auth['isAuthenticated'](),controller[_0xc39f('0x25')]);router[_0xc39f('0x26')](_0xc39f('0xf'),auth[_0xc39f('0xb')](),controller['update']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc39f('0x27')]);router[_0xc39f('0x28')](_0xc39f('0x1d'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0xc39f('0x20'),auth[_0xc39f('0xb')](),controller[_0xc39f('0x29')]);router[_0xc39f('0x28')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xc39f('0x2a')]);router[_0xc39f('0x28')](_0xc39f('0xf'),auth['isAuthenticated'](),controller[_0xc39f('0x2b')]);router[_0xc39f('0x28')](_0xc39f('0x19'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xcc76=['index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addApplications','/:id/send','addAgents','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x180b13,_0x48319d){var _0x3e9503=function(_0x438a31){while(--_0x438a31){_0x180b13['push'](_0x180b13['shift']());}};_0x3e9503(++_0x48319d);}(_0xcc76,0x7c));var _0x6cc7=function(_0x18fc76,_0x1737ca){_0x18fc76=_0x18fc76-0x0;var _0x335075=_0xcc76[_0x18fc76];return _0x335075;};'use strict';var multer=require(_0x6cc7('0x0'));var util=require(_0x6cc7('0x1'));var path=require(_0x6cc7('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cc7('0x3'));var router=express[_0x6cc7('0x4')]();var fs_extra=require(_0x6cc7('0x5'));var auth=require(_0x6cc7('0x6'));var interaction=require(_0x6cc7('0x7'));var config=require(_0x6cc7('0x8'));var controller=require('./mailAccount.controller');router[_0x6cc7('0x9')]('/',auth[_0x6cc7('0xa')](),controller[_0x6cc7('0xb')]);router[_0x6cc7('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6cc7('0xc')]);router['get'](_0x6cc7('0xd'),auth['isAuthenticated'](),controller[_0x6cc7('0xe')]);router[_0x6cc7('0x9')](_0x6cc7('0xf'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x10')]);router[_0x6cc7('0x9')](_0x6cc7('0x11'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x12')]);router[_0x6cc7('0x9')](_0x6cc7('0x13'),auth['isAuthenticated'](),controller[_0x6cc7('0x14')]);router[_0x6cc7('0x9')](_0x6cc7('0x15'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x16')]);router[_0x6cc7('0x9')](_0x6cc7('0x17'),auth[_0x6cc7('0xa')](),controller['getInteractions']);router['get'](_0x6cc7('0x18'),auth[_0x6cc7('0xa')](),controller['getApplications']);router[_0x6cc7('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6cc7('0x19')]);router[_0x6cc7('0x9')](_0x6cc7('0x1a'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x1b')]);router[_0x6cc7('0x9')](_0x6cc7('0x1c'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x1d')]);router[_0x6cc7('0x1e')](_0x6cc7('0xf'),auth['isAuthenticated'](),controller[_0x6cc7('0x1f')]);router[_0x6cc7('0x1e')](_0x6cc7('0x11'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x20')]);router['post']('/',auth[_0x6cc7('0xa')](),controller['create']);router[_0x6cc7('0x1e')](_0x6cc7('0x13'),auth['isAuthenticated'](),controller[_0x6cc7('0x21')]);router[_0x6cc7('0x1e')](_0x6cc7('0x15'),auth[_0x6cc7('0xa')](),controller['addSmtp']);router[_0x6cc7('0x1e')](_0x6cc7('0x17'),auth[_0x6cc7('0xa')](),controller['addInteraction']);router[_0x6cc7('0x1e')]('/:id/applications',auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x22')]);router[_0x6cc7('0x1e')](_0x6cc7('0x23'),auth[_0x6cc7('0xa')](),controller['send']);router[_0x6cc7('0x1e')]('/:id/users',auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x24')]);router['put'](_0x6cc7('0xd'),auth['isAuthenticated'](),controller[_0x6cc7('0x25')]);router[_0x6cc7('0x26')](_0x6cc7('0xf'),auth[_0x6cc7('0xa')](),controller['removeDispositions']);router[_0x6cc7('0x26')]('/:id/canned_answers',auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x27')]);router['delete'](_0x6cc7('0x13'),auth['isAuthenticated'](),controller[_0x6cc7('0x28')]);router[_0x6cc7('0x26')](_0x6cc7('0x15'),auth['isAuthenticated'](),controller[_0x6cc7('0x29')]);router[_0x6cc7('0x26')](_0x6cc7('0xd'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x2a')]);router[_0x6cc7('0x26')](_0x6cc7('0x1c'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x2b')]);module[_0x6cc7('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 050da3f..8f3b50d 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 _0xca49=['setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xca49,0x14c));var _0x9ca4=function(_0x3794a0,_0x1a9cfc){_0x3794a0=_0x3794a0-0x0;var _0x5bdaba=_0xca49[_0x3794a0];return _0x5bdaba;};'use strict';var Sequelize=require(_0x9ca4('0x0'));module[_0x9ca4('0x1')]={'description':{'type':Sequelize[_0x9ca4('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x9ca4('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9ca4('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9ca4('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9ca4('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x9ca4('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x9ca4('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9ca4('0x5');}},'notificationSound':{'type':Sequelize[_0x9ca4('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9ca4('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9ca4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9ca4('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ca4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9ca4('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9ca4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9ca4('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9ca4('0x7'),'set':function(_0x4af8d6){if(!_0x4af8d6)this[_0x9ca4('0x8')](_0x9ca4('0x9'),null);this[_0x9ca4('0x8')]('mandatoryDisposition',_0x4af8d6);}},'provider':{'type':Sequelize[_0x9ca4('0xa')](_0x9ca4('0xb'),_0x9ca4('0xc'),'yahoo',_0x9ca4('0xd')),'defaultValue':null,'get':function(){if(!this[_0x9ca4('0xe')](_0x9ca4('0xf')))return'custom';return this[_0x9ca4('0xe')]('provider');},'set':function(_0x2ff78b){if(_0x2ff78b===_0x9ca4('0x10'))_0x2ff78b=null;return this[_0x9ca4('0x8')]('provider',_0x2ff78b);}}}; \ No newline at end of file +var _0x9fd5=['STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','provider','custom','getDataValue','sequelize','exports'];(function(_0x3c6539,_0x56cc1e){var _0x53a22b=function(_0x4d178c){while(--_0x4d178c){_0x3c6539['push'](_0x3c6539['shift']());}};_0x53a22b(++_0x56cc1e);}(_0x9fd5,0xae));var _0x59fd=function(_0xf9fc05,_0x6f36c){_0xf9fc05=_0xf9fc05-0x0;var _0x2140ad=_0x9fd5[_0xf9fc05];return _0x2140ad;};'use strict';var Sequelize=require(_0x59fd('0x0'));module[_0x59fd('0x1')]={'description':{'type':Sequelize[_0x59fd('0x2')]},'name':{'type':Sequelize[_0x59fd('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x59fd('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x59fd('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x59fd('0x4')},'fontSize':{'type':Sequelize[_0x59fd('0x5')](0x2)[_0x59fd('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x59fd('0x7');}},'notificationSound':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x59fd('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x59fd('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x59fd('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x59fd('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':![],'comment':_0x59fd('0x9'),'set':function(_0x578c63){if(!_0x578c63)this[_0x59fd('0xa')]('mandatoryDispositionPauseId',null);this[_0x59fd('0xa')](_0x59fd('0xb'),_0x578c63);}},'provider':{'type':Sequelize[_0x59fd('0xc')]('gmail','hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x59fd('0xd')))return _0x59fd('0xe');return this[_0x59fd('0xf')]('provider');},'set':function(_0x34f69e){if(_0x34f69e===_0x59fd('0xe'))_0x34f69e=null;return this['setDataValue'](_0x59fd('0xd'),_0x34f69e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 12128b8..1c5c79c 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 _0x2cbb=['Smtp','index','MailServerIn','MailServerOut','Pause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','provider','custom','modernAuthentication','Mail\x20Account\x20not\x20found','update','describe','addDisposition','MailAccountId','Disposition','create','findOne','nolimit','order','sort','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','List','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','get','MailAccounts','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.mail.yahoo.com','smtp.office365.com','user','password','pass','CloudProviderId','port','secure','service','authentication','Imap','host'];(function(_0x5016d8,_0x4dadd7){var _0x1c5abc=function(_0x9cfd28){while(--_0x9cfd28){_0x5016d8['push'](_0x5016d8['shift']());}};_0x1c5abc(++_0x4dadd7);}(_0x2cbb,0x84));var _0xb2cb=function(_0x43cba5,_0x4a2f83){_0x43cba5=_0x43cba5-0x0;var _0x359d1a=_0x2cbb[_0x43cba5];return _0x359d1a;};'use strict';var moment=require('moment');var BPromise=require(_0xb2cb('0x0'));var util=require(_0xb2cb('0x1'));var path=require(_0xb2cb('0x2'));var _=require(_0xb2cb('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xb2cb('0x4'));var logger=require(_0xb2cb('0x5'))(_0xb2cb('0x6'));var config=require(_0xb2cb('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb2cb('0x8')](config[_0xb2cb('0x9')],{'host':_0xb2cb('0xa'),'port':0x18eb});var socket=require(_0xb2cb('0xb'))(new Redis(config[_0xb2cb('0x9')]));require(_0xb2cb('0xc'))[_0xb2cb('0xd')](socket);var jayson=require(_0xb2cb('0xe'));var client=jayson[_0xb2cb('0xf')][_0xb2cb('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x44e8f8,_0x4fef8d,_0x31a6b6,_0x58211d){return new BPromise(function(_0x28404e,_0x3ec701){var _0x34aeb4=_0x58211d||client;return _0x34aeb4['request'](_0x44e8f8,_0x31a6b6)[_0xb2cb('0x11')](function(_0x793fbe){logger[_0xb2cb('0x12')](_0xb2cb('0x13'),_0x4fef8d,_0xb2cb('0x14'));logger[_0xb2cb('0x15')](_0xb2cb('0x16'),_0x4fef8d,_0xb2cb('0x14'),JSON[_0xb2cb('0x17')](_0x793fbe));if(_0x793fbe[_0xb2cb('0x18')]){if(_0x793fbe[_0xb2cb('0x18')][_0xb2cb('0x19')]===0x1f4){logger[_0xb2cb('0x18')]('MailAccount,\x20%s,\x20%s',_0x4fef8d,_0x793fbe[_0xb2cb('0x18')][_0xb2cb('0x1a')]);return _0x3ec701(_0x793fbe[_0xb2cb('0x18')][_0xb2cb('0x1a')]);}logger[_0xb2cb('0x18')]('MailAccount,\x20%s,\x20%s',_0x4fef8d,_0x793fbe[_0xb2cb('0x18')][_0xb2cb('0x1a')]);return _0x28404e(_0x793fbe[_0xb2cb('0x18')][_0xb2cb('0x1a')]);}else{logger[_0xb2cb('0x12')](_0xb2cb('0x13'),_0x4fef8d,'request\x20sent');_0x28404e(_0x793fbe['result'][_0xb2cb('0x1a')]);}})['catch'](function(_0x2d6e67){logger[_0xb2cb('0x18')](_0xb2cb('0x13'),_0x4fef8d,_0x2d6e67);_0x3ec701(_0x2d6e67);});});}function respondWithStatusCode(_0x1dc4b0,_0x4b6d2c){_0x4b6d2c=_0x4b6d2c||0xcc;return function(_0x22cdad){if(_0x22cdad){return _0x1dc4b0[_0xb2cb('0x1b')](_0x4b6d2c);}return _0x1dc4b0[_0xb2cb('0x1c')](_0x4b6d2c)[_0xb2cb('0x1d')]();};}function respondWithResult(_0x1297f1,_0x5ab3ae){_0x5ab3ae=_0x5ab3ae||0xc8;return function(_0x5b08e2){if(_0x5b08e2){return _0x1297f1['status'](_0x5ab3ae)[_0xb2cb('0x1e')](_0x5b08e2);}};}function respondWithFilteredResult(_0x1e69be,_0x53d1c9){return function(_0x110322){if(_0x110322){var _0x562869=typeof _0x53d1c9['offset']===_0xb2cb('0x1f')&&typeof _0x53d1c9[_0xb2cb('0x20')]===_0xb2cb('0x1f');var _0x42c867=_0x110322[_0xb2cb('0x21')];var _0x44ce98=_0x562869?0x0:_0x53d1c9['offset'];var _0x4c43d4=_0x562869?_0x110322['count']:_0x53d1c9[_0xb2cb('0x22')]+_0x53d1c9[_0xb2cb('0x20')];var _0x25f9ab;if(_0x4c43d4>=_0x42c867){_0x4c43d4=_0x42c867;_0x25f9ab=0xc8;}else{_0x25f9ab=0xce;}_0x1e69be[_0xb2cb('0x1c')](_0x25f9ab);return _0x1e69be[_0xb2cb('0x23')](_0xb2cb('0x24'),_0x44ce98+'-'+_0x4c43d4+'/'+_0x42c867)[_0xb2cb('0x1e')](_0x110322);}return null;};}function saveUpdates(_0x1c05d0){return function(_0x1a96f9){if(_0x1a96f9){return _0x1a96f9['update'](_0x1c05d0)[_0xb2cb('0x11')](function(_0x4e2f8c){return _0x4e2f8c;});}return null;};}function removeEntity(_0x2d9891){return function(_0x581b69){if(_0x581b69){return _0x581b69[_0xb2cb('0x25')]()[_0xb2cb('0x11')](function(){var _0x19b984=_0x581b69[_0xb2cb('0x26')]({'plain':!![]});var _0x2f19e7=_0xb2cb('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f19e7,'resourceId':_0x19b984['id']}})['then'](function(){return _0x581b69;});})['then'](function(){_0x2d9891['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b62ac){return function(_0x4757ed){if(!_0x4757ed){_0x3b62ac[_0xb2cb('0x1b')](0x194);}return _0x4757ed;};}function handleError(_0x29d8b1,_0x4bc28d){_0x4bc28d=_0x4bc28d||0x1f4;return function(_0x3d8e38){logger[_0xb2cb('0x18')](_0x3d8e38[_0xb2cb('0x28')]);if(_0x3d8e38[_0xb2cb('0x29')]){delete _0x3d8e38[_0xb2cb('0x29')];}_0x29d8b1['status'](_0x4bc28d)[_0xb2cb('0x2a')](_0x3d8e38);};}function getImapHost(_0x48e875){switch(_0x48e875){case'gmail':return _0xb2cb('0x2b');case _0xb2cb('0x2c'):return _0xb2cb('0x2d');case _0xb2cb('0x2e'):return _0xb2cb('0x2f');case _0xb2cb('0x30'):return _0xb2cb('0x31');}throw new Error(_0xb2cb('0x32'),_0x48e875);}function getSmtpHost(_0x522bc5){switch(_0x522bc5){case _0xb2cb('0x33'):return'smtp.gmail.com';case'yahoo':return _0xb2cb('0x34');case _0xb2cb('0x2e'):return'smtp-mail.outlook.com';case _0xb2cb('0x30'):return _0xb2cb('0x35');}throw new Error(_0xb2cb('0x32'),_0x522bc5);}function getAuthenticationOptions(_0x499b4c,_0x1d75d9){var _0x447352={};var _0x44c87d={};if(_0x499b4c){_0x447352[_0xb2cb('0x36')]=_0x44c87d['user']=_0x1d75d9['username'];_0x447352[_0xb2cb('0x37')]=_0x44c87d[_0xb2cb('0x38')]=_0x1d75d9[_0xb2cb('0x37')];if(_0x1d75d9['modernAuthentication']){_0x447352['modernAuthentication']=_0x44c87d['modernAuthentication']=!![];_0x447352['CloudProviderId']=_0x44c87d['CloudProviderId']=_0x1d75d9[_0xb2cb('0x39')];_0x447352[_0xb2cb('0x37')]=_0x44c87d['pass']=null;}else{_0x447352[_0xb2cb('0x39')]=_0x44c87d[_0xb2cb('0x39')]=null;}_0x447352['host']=getImapHost(_0x499b4c);_0x447352[_0xb2cb('0x3a')]=0x3e1;_0x44c87d['host']=getSmtpHost(_0x499b4c);_0x44c87d['port']=0x24b;_0x44c87d[_0xb2cb('0x3b')]=![];_0x447352[_0xb2cb('0x3c')]=_0x44c87d[_0xb2cb('0x3c')]=null;}else{if(_0x1d75d9[_0xb2cb('0x3d')]){_0x447352['user']=_0x44c87d[_0xb2cb('0x36')]=_0x1d75d9['username'];_0x447352[_0xb2cb('0x37')]=_0x44c87d[_0xb2cb('0x38')]=_0x1d75d9[_0xb2cb('0x37')];}else{_0x447352[_0xb2cb('0x3d')]=_0x44c87d[_0xb2cb('0x3d')]=![];_0x447352['user']=_0x44c87d[_0xb2cb('0x36')]=null;_0x447352[_0xb2cb('0x37')]=_0x44c87d[_0xb2cb('0x38')]=null;}_0x447352['host']=_0x1d75d9[_0xb2cb('0x3e')][_0xb2cb('0x3f')];_0x447352[_0xb2cb('0x3a')]=_0x1d75d9['Imap'][_0xb2cb('0x3a')];_0x44c87d['host']=_0x1d75d9[_0xb2cb('0x40')][_0xb2cb('0x3f')];_0x44c87d[_0xb2cb('0x3a')]=_0x1d75d9[_0xb2cb('0x40')][_0xb2cb('0x3a')];}return{'Imap':_0x447352,'Smtp':_0x44c87d};}exports[_0xb2cb('0x41')]=function(_0x5e7b34,_0x2dbdad){var _0x380116={'include':[{'model':db[_0xb2cb('0x42')],'as':_0xb2cb('0x3e')},{'model':db[_0xb2cb('0x43')],'as':_0xb2cb('0x40')},{'model':db[_0xb2cb('0x44')],'as':'mandatoryDispositionPause'}]},_0x2eaf18={},_0x5f358d={'count':0x0,'rows':[]};var _0x17a699=_[_0xb2cb('0x45')](db[_0xb2cb('0x46')][_0xb2cb('0x47')],function(_0x39eaae){return{'name':_0x39eaae[_0xb2cb('0x48')],'type':_0x39eaae[_0xb2cb('0x49')][_0xb2cb('0x4a')]};});_0x2eaf18['model']=_[_0xb2cb('0x45')](_0x17a699,_0xb2cb('0x29'));_0x2eaf18[_0xb2cb('0x4b')]=_[_0xb2cb('0x4c')](_0x5e7b34[_0xb2cb('0x4b')]);_0x2eaf18['filters']=_['intersection'](_0x2eaf18[_0xb2cb('0x4d')],_0x2eaf18[_0xb2cb('0x4b')]);_0x380116[_0xb2cb('0x4e')]=_[_0xb2cb('0x4f')](_0x2eaf18[_0xb2cb('0x4d')],qs[_0xb2cb('0x50')](_0x5e7b34['query'][_0xb2cb('0x50')]));_0x380116[_0xb2cb('0x4e')]=_0x380116[_0xb2cb('0x4e')][_0xb2cb('0x51')]?_0x380116[_0xb2cb('0x4e')]:_0x2eaf18[_0xb2cb('0x4d')];if(!_0x5e7b34[_0xb2cb('0x4b')][_0xb2cb('0x52')]('nolimit')){_0x380116[_0xb2cb('0x20')]=qs[_0xb2cb('0x20')](_0x5e7b34[_0xb2cb('0x4b')][_0xb2cb('0x20')]);_0x380116[_0xb2cb('0x22')]=qs['offset'](_0x5e7b34[_0xb2cb('0x4b')][_0xb2cb('0x22')]);}_0x380116['order']=qs['sort'](_0x5e7b34[_0xb2cb('0x4b')]['sort']);_0x380116[_0xb2cb('0x53')]=qs[_0xb2cb('0x54')](_[_0xb2cb('0x55')](_0x5e7b34['query'],_0x2eaf18[_0xb2cb('0x54')]),_0x17a699);if(_0x5e7b34['query'][_0xb2cb('0x56')]){_0x380116[_0xb2cb('0x53')]=_[_0xb2cb('0x57')](_0x380116[_0xb2cb('0x53')],{'$or':_[_0xb2cb('0x45')](_0x17a699,function(_0x116407){if(_0x116407[_0xb2cb('0x49')]!==_0xb2cb('0x58')){var _0x4bc110={};_0x4bc110[_0x116407[_0xb2cb('0x29')]]={'$like':'%'+_0x5e7b34[_0xb2cb('0x4b')][_0xb2cb('0x56')]+'%'};return _0x4bc110;}})});}_0x380116=_[_0xb2cb('0x57')]({},_0x380116,_0x5e7b34[_0xb2cb('0x59')]);var _0x320d85={'where':_0x380116[_0xb2cb('0x53')]};return db['MailAccount'][_0xb2cb('0x21')](_0x320d85)['then'](function(_0x2e2d91){_0x5f358d[_0xb2cb('0x21')]=_0x2e2d91;if(_0x5e7b34[_0xb2cb('0x4b')][_0xb2cb('0x5a')]){_0x380116[_0xb2cb('0x5b')]=[{'all':!![]}];}return db[_0xb2cb('0x46')][_0xb2cb('0x5c')](_0x380116);})[_0xb2cb('0x11')](function(_0x12d8b3){_0x5f358d[_0xb2cb('0x5d')]=_0x12d8b3;return _0x5f358d;})[_0xb2cb('0x11')](respondWithFilteredResult(_0x2dbdad,_0x380116))[_0xb2cb('0x5e')](handleError(_0x2dbdad,null));};exports['show']=function(_0x2f944c,_0x23d3e8){var _0x407034={'raw':![],'where':{'id':_0x2f944c[_0xb2cb('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xb2cb('0x3e')},{'model':db[_0xb2cb('0x43')],'as':_0xb2cb('0x40')},{'model':db[_0xb2cb('0x44')],'as':'mandatoryDispositionPause'}]},_0x50838c={};_0x50838c[_0xb2cb('0x4d')]=_[_0xb2cb('0x4c')](db['MailAccount'][_0xb2cb('0x47')]);_0x50838c[_0xb2cb('0x4b')]=_[_0xb2cb('0x4c')](_0x2f944c[_0xb2cb('0x4b')]);_0x50838c[_0xb2cb('0x54')]=_['intersection'](_0x50838c[_0xb2cb('0x4d')],_0x50838c[_0xb2cb('0x4b')]);_0x407034[_0xb2cb('0x4e')]=_[_0xb2cb('0x4f')](_0x50838c[_0xb2cb('0x4d')],qs[_0xb2cb('0x50')](_0x2f944c['query']['fields']));_0x407034[_0xb2cb('0x4e')]=_0x407034[_0xb2cb('0x4e')][_0xb2cb('0x51')]?_0x407034[_0xb2cb('0x4e')]:_0x50838c[_0xb2cb('0x4d')];if(_0x2f944c[_0xb2cb('0x4b')][_0xb2cb('0x5a')]){_0x407034['include']=[{'all':!![]}];}_0x407034=_['merge']({},_0x407034,_0x2f944c[_0xb2cb('0x59')]);return db[_0xb2cb('0x46')][_0xb2cb('0x60')](_0x407034)[_0xb2cb('0x11')](handleEntityNotFound(_0x23d3e8,null))[_0xb2cb('0x11')](respondWithResult(_0x23d3e8,null))[_0xb2cb('0x5e')](handleError(_0x23d3e8,null));};exports['update']=function(_0x4213e5,_0x3c2988){if(_0x4213e5[_0xb2cb('0x61')]['id']){delete _0x4213e5[_0xb2cb('0x61')]['id'];}var _0x465729=_0x4213e5[_0xb2cb('0x61')][_0xb2cb('0x62')]===_0xb2cb('0x63')?null:_0x4213e5[_0xb2cb('0x61')]['provider'];var _0x4b5bfb=_0x4213e5[_0xb2cb('0x61')][_0xb2cb('0x3e')]||{};var _0xf23d65=_0x4213e5[_0xb2cb('0x61')][_0xb2cb('0x40')]||{};if(_0x465729){_0x4b5bfb[_0xb2cb('0x3f')]=getImapHost(_0x465729);_0x4b5bfb[_0xb2cb('0x3a')]=0x3e1;_0xf23d65[_0xb2cb('0x3f')]=getSmtpHost(_0x465729);_0xf23d65[_0xb2cb('0x3a')]=0x24b;_0xf23d65['secure']=![];}if(_0xf23d65[_0xb2cb('0x64')]){_0xf23d65['secure']=![];}else{_0xf23d65['CloudProviderId']=null;}if(!_0x4b5bfb['modernAuthentication'])_0x4b5bfb[_0xb2cb('0x39')]=null;_0x4213e5[_0xb2cb('0x61')]['Imap']=_0x4b5bfb;_0x4213e5['body'][_0xb2cb('0x40')]=_0xf23d65;return db['MailAccount'][_0xb2cb('0x60')]({'where':{'id':_0x4213e5[_0xb2cb('0x5f')]['id']},'include':[{'model':db[_0xb2cb('0x42')],'as':_0xb2cb('0x3e')},{'model':db[_0xb2cb('0x43')],'as':'Smtp'},{'model':db[_0xb2cb('0x44')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3c2988,null))[_0xb2cb('0x11')](function(_0x2d24ae){if(!_0x2d24ae)throw new Error(_0xb2cb('0x65'));if(_0x2d24ae[_0xb2cb('0x3c')])delete _0x4213e5['body'][_0xb2cb('0x3e')];return _0x2d24ae;})['then'](saveUpdates(_0x4213e5['body'],null))[_0xb2cb('0x11')](function(_0x4c9844){if(!_0x4213e5['body']['Imap'])return _0x4c9844;return db[_0xb2cb('0x42')][_0xb2cb('0x66')](_0x4213e5['body'][_0xb2cb('0x3e')],{'where':{'MailAccountId':_0x4c9844['id']}})[_0xb2cb('0x11')](function(){return _0x4c9844;});})[_0xb2cb('0x11')](function(_0x8211f1){if(!_0x4213e5['body'][_0xb2cb('0x40')])return _0x8211f1;return db[_0xb2cb('0x43')][_0xb2cb('0x66')](_0x4213e5['body'][_0xb2cb('0x40')],{'where':{'MailAccountId':_0x8211f1['id']}})[_0xb2cb('0x11')](function(){return _0x8211f1;});})[_0xb2cb('0x11')](respondWithResult(_0x3c2988,null))[_0xb2cb('0x5e')](handleError(_0x3c2988,null));};exports[_0xb2cb('0x67')]=function(_0x50ce1b,_0x75f53e){return db[_0xb2cb('0x46')][_0xb2cb('0x67')]()[_0xb2cb('0x11')](respondWithResult(_0x75f53e,null))[_0xb2cb('0x5e')](handleError(_0x75f53e,null));};exports[_0xb2cb('0x68')]=function(_0x42c2bb,_0x4b92cc){if(_0x42c2bb[_0xb2cb('0x61')]['id']){delete _0x42c2bb['body']['id'];}return db['MailAccount'][_0xb2cb('0x60')]({'where':{'id':_0x42c2bb['params']['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x4b92cc,null))[_0xb2cb('0x11')](function(_0x1ffd1b){if(_0x1ffd1b){_0x42c2bb[_0xb2cb('0x61')][_0xb2cb('0x69')]=_0x1ffd1b['id'];return db[_0xb2cb('0x6a')][_0xb2cb('0x6b')](_0x42c2bb[_0xb2cb('0x61')]);}})[_0xb2cb('0x11')](respondWithResult(_0x4b92cc,null))['catch'](handleError(_0x4b92cc,null));};exports['getDispositions']=function(_0x612c91,_0x56681f){var _0x22818d={'raw':![],'where':{}};var _0x5c7987={};var _0x35c354={'count':0x0,'rows':[]};return db[_0xb2cb('0x46')][_0xb2cb('0x6c')]({'where':{'id':_0x612c91[_0xb2cb('0x5f')]['id']}})['then'](handleEntityNotFound(_0x56681f,null))[_0xb2cb('0x11')](function(_0x45a2af){if(_0x45a2af){_0x5c7987['model']=_['keys'](db[_0xb2cb('0x6a')][_0xb2cb('0x47')]);_0x5c7987[_0xb2cb('0x4b')]=_['keys'](_0x612c91['query']);_0x5c7987['filters']=_[_0xb2cb('0x4f')](_0x5c7987[_0xb2cb('0x4d')],_0x5c7987[_0xb2cb('0x4b')]);_0x22818d[_0xb2cb('0x4e')]=_[_0xb2cb('0x4f')](_0x5c7987['model'],qs[_0xb2cb('0x50')](_0x612c91[_0xb2cb('0x4b')][_0xb2cb('0x50')]));_0x22818d['attributes']=_0x22818d['attributes']['length']?_0x22818d['attributes']:_0x5c7987[_0xb2cb('0x4d')];if(!_0x612c91[_0xb2cb('0x4b')]['hasOwnProperty'](_0xb2cb('0x6d'))){_0x22818d[_0xb2cb('0x20')]=qs[_0xb2cb('0x20')](_0x612c91[_0xb2cb('0x4b')][_0xb2cb('0x20')]);_0x22818d[_0xb2cb('0x22')]=qs['offset'](_0x612c91['query'][_0xb2cb('0x22')]);}_0x22818d[_0xb2cb('0x6e')]=qs[_0xb2cb('0x6f')](_0x612c91['query'][_0xb2cb('0x6f')]);_0x22818d[_0xb2cb('0x53')]=qs[_0xb2cb('0x54')](_[_0xb2cb('0x55')](_0x612c91[_0xb2cb('0x4b')],_0x5c7987['filters']));_0x22818d[_0xb2cb('0x53')]['MailAccountId']=_0x45a2af['id'];if(_0x612c91['query'][_0xb2cb('0x56')]){_0x22818d['where']=_[_0xb2cb('0x57')](_0x22818d[_0xb2cb('0x53')],{'$or':_[_0xb2cb('0x45')](_0x22818d[_0xb2cb('0x4e')],function(_0x2c2b62){var _0x145bf9={};_0x145bf9[_0x2c2b62]={'$like':'%'+_0x612c91[_0xb2cb('0x4b')]['filter']+'%'};return _0x145bf9;})});}_0x22818d=_[_0xb2cb('0x57')]({},_0x22818d,_0x612c91[_0xb2cb('0x59')]);return db[_0xb2cb('0x6a')][_0xb2cb('0x21')]({'where':_0x22818d[_0xb2cb('0x53')]})[_0xb2cb('0x11')](function(_0x130dd9){_0x35c354[_0xb2cb('0x21')]=_0x130dd9;if(_0x612c91[_0xb2cb('0x4b')]['includeAll']){_0x22818d['include']=[{'all':!![]}];}return db['Disposition'][_0xb2cb('0x5c')](_0x22818d);})['then'](function(_0xa087a9){_0x35c354[_0xb2cb('0x5d')]=_0xa087a9;return _0x35c354;});}})[_0xb2cb('0x11')](respondWithFilteredResult(_0x56681f,_0x22818d))[_0xb2cb('0x5e')](handleError(_0x56681f,null));};exports[_0xb2cb('0x70')]=function(_0x46bd8c,_0x2fdccd){return db[_0xb2cb('0x46')][_0xb2cb('0x60')]({'where':{'id':_0x46bd8c[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x2fdccd,null))[_0xb2cb('0x11')](function(_0x4d384d){if(_0x4d384d){return _0x4d384d['removeDispositions'](_0x46bd8c[_0xb2cb('0x4b')][_0xb2cb('0x71')]);}})['then'](respondWithStatusCode(_0x2fdccd,null))[_0xb2cb('0x5e')](handleError(_0x2fdccd,null));};exports['addAnswer']=function(_0x1a5c72,_0x4fb6dd){if(_0x1a5c72['body']['id']){delete _0x1a5c72[_0xb2cb('0x61')]['id'];}return db[_0xb2cb('0x46')][_0xb2cb('0x60')]({'where':{'id':_0x1a5c72[_0xb2cb('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4fb6dd,null))[_0xb2cb('0x11')](function(_0x517599){if(_0x517599){_0x1a5c72[_0xb2cb('0x61')][_0xb2cb('0x69')]=_0x517599['id'];return db[_0xb2cb('0x72')][_0xb2cb('0x6b')](_0x1a5c72['body']);}})['then'](respondWithResult(_0x4fb6dd,null))[_0xb2cb('0x5e')](handleError(_0x4fb6dd,null));};exports[_0xb2cb('0x73')]=function(_0x76d04b,_0x54ee51){var _0x1e01d3={'raw':![],'where':{}};var _0x59b829={};var _0x32c9aa={'count':0x0,'rows':[]};return db[_0xb2cb('0x46')][_0xb2cb('0x6c')]({'where':{'id':_0x76d04b[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x54ee51,null))[_0xb2cb('0x11')](function(_0x211e0d){if(_0x211e0d){_0x59b829[_0xb2cb('0x4d')]=_['keys'](db[_0xb2cb('0x72')][_0xb2cb('0x47')]);_0x59b829[_0xb2cb('0x4b')]=_[_0xb2cb('0x4c')](_0x76d04b['query']);_0x59b829[_0xb2cb('0x54')]=_[_0xb2cb('0x4f')](_0x59b829['model'],_0x59b829['query']);_0x1e01d3[_0xb2cb('0x4e')]=_[_0xb2cb('0x4f')](_0x59b829['model'],qs[_0xb2cb('0x50')](_0x76d04b[_0xb2cb('0x4b')][_0xb2cb('0x50')]));_0x1e01d3[_0xb2cb('0x4e')]=_0x1e01d3[_0xb2cb('0x4e')]['length']?_0x1e01d3[_0xb2cb('0x4e')]:_0x59b829[_0xb2cb('0x4d')];if(!_0x76d04b[_0xb2cb('0x4b')][_0xb2cb('0x52')](_0xb2cb('0x6d'))){_0x1e01d3[_0xb2cb('0x20')]=qs[_0xb2cb('0x20')](_0x76d04b[_0xb2cb('0x4b')][_0xb2cb('0x20')]);_0x1e01d3['offset']=qs[_0xb2cb('0x22')](_0x76d04b['query']['offset']);}_0x1e01d3[_0xb2cb('0x6e')]=qs[_0xb2cb('0x6f')](_0x76d04b[_0xb2cb('0x4b')][_0xb2cb('0x6f')]);_0x1e01d3[_0xb2cb('0x53')]=qs['filters'](_[_0xb2cb('0x55')](_0x76d04b[_0xb2cb('0x4b')],_0x59b829[_0xb2cb('0x54')]));_0x1e01d3[_0xb2cb('0x53')][_0xb2cb('0x69')]=_0x211e0d['id'];if(_0x76d04b['query']['filter']){_0x1e01d3[_0xb2cb('0x53')]=_[_0xb2cb('0x57')](_0x1e01d3['where'],{'$or':_[_0xb2cb('0x45')](_0x1e01d3[_0xb2cb('0x4e')],function(_0x3d29d1){var _0x1af8ab={};_0x1af8ab[_0x3d29d1]={'$like':'%'+_0x76d04b[_0xb2cb('0x4b')][_0xb2cb('0x56')]+'%'};return _0x1af8ab;})});}_0x1e01d3=_[_0xb2cb('0x57')]({},_0x1e01d3,_0x76d04b[_0xb2cb('0x59')]);return db[_0xb2cb('0x72')][_0xb2cb('0x21')]({'where':_0x1e01d3['where']})[_0xb2cb('0x11')](function(_0x4e52eb){_0x32c9aa[_0xb2cb('0x21')]=_0x4e52eb;if(_0x76d04b[_0xb2cb('0x4b')][_0xb2cb('0x5a')]){_0x1e01d3[_0xb2cb('0x5b')]=[{'all':!![]}];}return db[_0xb2cb('0x72')][_0xb2cb('0x5c')](_0x1e01d3);})[_0xb2cb('0x11')](function(_0x5ba927){_0x32c9aa[_0xb2cb('0x5d')]=_0x5ba927;return _0x32c9aa;});}})[_0xb2cb('0x11')](respondWithFilteredResult(_0x54ee51,_0x1e01d3))[_0xb2cb('0x5e')](handleError(_0x54ee51,null));};exports[_0xb2cb('0x74')]=function(_0x18a355,_0x4cf8da){return db[_0xb2cb('0x46')][_0xb2cb('0x60')]({'where':{'id':_0x18a355[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x4cf8da,null))[_0xb2cb('0x11')](function(_0x5400bb){if(_0x5400bb){return _0x5400bb[_0xb2cb('0x74')](_0x18a355[_0xb2cb('0x4b')]['ids']);}})[_0xb2cb('0x11')](respondWithStatusCode(_0x4cf8da,null))[_0xb2cb('0x5e')](handleError(_0x4cf8da,null));};exports[_0xb2cb('0x6b')]=function(_0x2796cb,_0x3826a8){var _0x4779ba={'name':_0x2796cb[_0xb2cb('0x61')][_0xb2cb('0x29')],'key':_0x2796cb['body']['key'],'provider':_0x2796cb['body'][_0xb2cb('0x62')]===_0xb2cb('0x63')?null:_0x2796cb['body'][_0xb2cb('0x62')],'email':_0x2796cb['body'][_0xb2cb('0x75')],'ListId':_0x2796cb[_0xb2cb('0x61')][_0xb2cb('0x76')],'active':!_[_0xb2cb('0x77')](_0x2796cb[_0xb2cb('0x61')][_0xb2cb('0x78')])?_0x2796cb['body'][_0xb2cb('0x78')]:!![],'description':_0x2796cb['body'][_0xb2cb('0x79')]||null};var _0x59673c=getAuthenticationOptions(_0x4779ba[_0xb2cb('0x62')],_0x2796cb[_0xb2cb('0x61')]);_0x4779ba[_0xb2cb('0x3e')]=_0x59673c[_0xb2cb('0x3e')];_0x4779ba[_0xb2cb('0x40')]=_0x59673c['Smtp'];return db[_0xb2cb('0x46')][_0xb2cb('0x6b')](_0x4779ba,{'include':[{'model':db[_0xb2cb('0x43')],'as':_0xb2cb('0x40')},{'model':db[_0xb2cb('0x42')],'as':_0xb2cb('0x3e')}]})[_0xb2cb('0x11')](function(_0x5ad971){var _0x2e94f3=_0x2796cb[_0xb2cb('0x36')][_0xb2cb('0x26')]({'plain':!![]});if(!_0x2e94f3)throw new Error(_0xb2cb('0x7a'));if(_0x2e94f3[_0xb2cb('0x7b')]==='user'){var _0x4873e3=_0x5ad971['get']({'plain':!![]});return db[_0xb2cb('0x7c')][_0xb2cb('0x60')]({'where':{'name':_0xb2cb('0x27'),'userProfileId':_0x2e94f3[_0xb2cb('0x7d')]},'raw':!![]})[_0xb2cb('0x11')](function(_0x37d4fc){if(_0x37d4fc&&_0x37d4fc[_0xb2cb('0x7e')]===0x0){return db[_0xb2cb('0x7f')][_0xb2cb('0x6b')]({'name':_0x4873e3['name'],'resourceId':_0x4873e3['id'],'type':_0x37d4fc[_0xb2cb('0x29')],'sectionId':_0x37d4fc['id']},{})[_0xb2cb('0x11')](function(){return _0x5ad971;});}else{return _0x5ad971;}})[_0xb2cb('0x5e')](function(_0x53395a){logger[_0xb2cb('0x18')](_0xb2cb('0x80'),_0x53395a);throw _0x53395a;});}return _0x5ad971;})[_0xb2cb('0x11')](respondWithResult(_0x3826a8,0xc9))[_0xb2cb('0x5e')](handleError(_0x3826a8,null));};exports[_0xb2cb('0x81')]=function(_0x1b22c5,_0x5f47b3){return db['MailAccount']['findOne']({'where':{'id':_0x1b22c5[_0xb2cb('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5f47b3,null))[_0xb2cb('0x11')](function(_0x962ecb){if(_0x962ecb){return _0x962ecb['getImap']();}return null;})['then'](respondWithResult(_0x5f47b3,null))[_0xb2cb('0x5e')](handleError(_0x5f47b3,null));};exports[_0xb2cb('0x82')]=function(_0x8e334c,_0x205442){if(_0x8e334c[_0xb2cb('0x61')]['id']){delete _0x8e334c['body']['id'];}return db[_0xb2cb('0x46')][_0xb2cb('0x60')]({'where':{'id':_0x8e334c['params']['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x205442,null))[_0xb2cb('0x11')](function(_0x53f10a){if(_0x53f10a){_0x8e334c[_0xb2cb('0x61')][_0xb2cb('0x69')]=_0x53f10a['id'];return db[_0xb2cb('0x42')][_0xb2cb('0x6b')](_0x8e334c[_0xb2cb('0x61')]);}})[_0xb2cb('0x11')](respondWithResult(_0x205442,null))['catch'](handleError(_0x205442,null));};exports[_0xb2cb('0x83')]=function(_0x4ae5e7,_0x17f0d3){return db['MailAccount'][_0xb2cb('0x6c')]({'where':{'id':_0x4ae5e7[_0xb2cb('0x5f')]['id']}})['then'](handleEntityNotFound(_0x17f0d3,null))[_0xb2cb('0x11')](function(_0x338e6f){if(_0x338e6f){return _0x338e6f[_0xb2cb('0x84')](null);}return null;})[_0xb2cb('0x11')](respondWithStatusCode(_0x17f0d3,null))[_0xb2cb('0x5e')](handleError(_0x17f0d3,null));};exports[_0xb2cb('0x85')]=function(_0x4cbfec,_0x1b1a32){return db[_0xb2cb('0x46')][_0xb2cb('0x6c')]({'where':{'id':_0x4cbfec[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x1b1a32,null))[_0xb2cb('0x11')](function(_0x4e91d6){if(_0x4e91d6){return _0x4e91d6[_0xb2cb('0x85')]();}return null;})[_0xb2cb('0x11')](respondWithResult(_0x1b1a32,null))[_0xb2cb('0x5e')](handleError(_0x1b1a32,null));};exports[_0xb2cb('0x86')]=function(_0x2d889a,_0x295846){if(_0x2d889a[_0xb2cb('0x61')]['id']){delete _0x2d889a[_0xb2cb('0x61')]['id'];}return db[_0xb2cb('0x46')][_0xb2cb('0x60')]({'where':{'id':_0x2d889a[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x295846,null))['then'](function(_0x505f00){if(_0x505f00){_0x2d889a['body'][_0xb2cb('0x69')]=_0x505f00['id'];return db[_0xb2cb('0x43')][_0xb2cb('0x6b')](_0x2d889a[_0xb2cb('0x61')]);}})['then'](respondWithResult(_0x295846,null))[_0xb2cb('0x5e')](handleError(_0x295846,null));};exports[_0xb2cb('0x87')]=function(_0x49521c,_0x32d7f9){return db[_0xb2cb('0x46')][_0xb2cb('0x6c')]({'where':{'id':_0x49521c[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x32d7f9,null))[_0xb2cb('0x11')](function(_0x4f08c9){if(_0x4f08c9){return _0x4f08c9['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x32d7f9,null))[_0xb2cb('0x5e')](handleError(_0x32d7f9,null));};exports[_0xb2cb('0x88')]=function(_0x45eaa2,_0x541d9b){return db['MailInteraction'][_0xb2cb('0x60')]({'where':{'id':_0x45eaa2[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x541d9b,null))[_0xb2cb('0x11')](function(_0x4fe10d){if(_0x4fe10d){return _0x4fe10d[_0xb2cb('0x88')](_0x45eaa2[_0xb2cb('0x61')][_0xb2cb('0x71')],_[_0xb2cb('0x89')](_0x45eaa2[_0xb2cb('0x61')],['ids','id'])||{});}})[_0xb2cb('0x11')](respondWithResult(_0x541d9b,null))[_0xb2cb('0x5e')](handleError(_0x541d9b,null));};exports[_0xb2cb('0x8a')]=function(_0x41e3c2,_0x7728a5){var _0x387316={'raw':![],'where':{}};var _0x27764a={};var _0x88e7cf={'count':0x0,'rows':[]};return db[_0xb2cb('0x46')][_0xb2cb('0x6c')]({'where':{'id':_0x41e3c2['params']['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x7728a5,null))[_0xb2cb('0x11')](function(_0x4f1bd1){if(_0x4f1bd1){_0x27764a['model']=_[_0xb2cb('0x4c')](db[_0xb2cb('0x8b')][_0xb2cb('0x47')]);_0x27764a[_0xb2cb('0x4b')]=_[_0xb2cb('0x4c')](_0x41e3c2[_0xb2cb('0x4b')]);_0x27764a[_0xb2cb('0x54')]=_[_0xb2cb('0x4f')](_0x27764a[_0xb2cb('0x4d')],_0x27764a[_0xb2cb('0x4b')]);_0x387316['attributes']=_[_0xb2cb('0x4f')](_0x27764a[_0xb2cb('0x4d')],qs[_0xb2cb('0x50')](_0x41e3c2[_0xb2cb('0x4b')][_0xb2cb('0x50')]));_0x387316['attributes']=_0x387316['attributes']['length']?_0x387316[_0xb2cb('0x4e')]:_0x27764a[_0xb2cb('0x4d')];if(!_0x41e3c2['query'][_0xb2cb('0x52')](_0xb2cb('0x6d'))){_0x387316['limit']=qs[_0xb2cb('0x20')](_0x41e3c2[_0xb2cb('0x4b')][_0xb2cb('0x20')]);_0x387316[_0xb2cb('0x22')]=qs[_0xb2cb('0x22')](_0x41e3c2['query']['offset']);}_0x387316[_0xb2cb('0x6e')]=qs[_0xb2cb('0x6f')](_0x41e3c2['query'][_0xb2cb('0x6f')]);_0x387316['where']=qs[_0xb2cb('0x54')](_[_0xb2cb('0x55')](_0x41e3c2[_0xb2cb('0x4b')],_0x27764a[_0xb2cb('0x54')]));_0x387316[_0xb2cb('0x53')][_0xb2cb('0x69')]=_0x4f1bd1['id'];if(_0x41e3c2[_0xb2cb('0x4b')]['filter']){_0x387316[_0xb2cb('0x53')]=_[_0xb2cb('0x57')](_0x387316[_0xb2cb('0x53')],{'$or':_[_0xb2cb('0x45')](_0x387316[_0xb2cb('0x4e')],function(_0x580ef3){var _0x3a1a7c={};_0x3a1a7c[_0x580ef3]={'$like':'%'+_0x41e3c2['query'][_0xb2cb('0x56')]+'%'};return _0x3a1a7c;})});}_0x387316=_[_0xb2cb('0x57')]({},_0x387316,_0x41e3c2[_0xb2cb('0x59')]);return db['MailInteraction']['count']({'where':_0x387316[_0xb2cb('0x53')]})[_0xb2cb('0x11')](function(_0x2a8818){_0x88e7cf[_0xb2cb('0x21')]=_0x2a8818;if(_0x41e3c2[_0xb2cb('0x4b')][_0xb2cb('0x5a')]){_0x387316['include']=[{'model':db[_0xb2cb('0x8c')],'as':'Contact','required':![]},{'model':db[_0xb2cb('0x8d')],'as':_0xb2cb('0x8e'),'attributes':[_0xb2cb('0x29'),_0xb2cb('0x8f'),_0xb2cb('0x90')],'required':![]},{'model':db[_0xb2cb('0x91')],'as':_0xb2cb('0x92'),'attributes':['id','name','color'],'where':_0x41e3c2['query']['tag']?{'id':_0x41e3c2['query'][_0xb2cb('0x93')]}:undefined,'required':_0x41e3c2[_0xb2cb('0x4b')]['tag']?!![]:![]}];}return db[_0xb2cb('0x8b')]['findAll'](_0x387316);})[_0xb2cb('0x11')](function(_0x485273){_0x88e7cf[_0xb2cb('0x5d')]=_0x485273;return _0x88e7cf;});}})[_0xb2cb('0x11')](respondWithFilteredResult(_0x7728a5,_0x387316))['catch'](handleError(_0x7728a5,null));};exports['addApplications']=function addApplications(_0x512f4f,_0x568ab1){var _0x2a335a=_0x512f4f[_0xb2cb('0x5f')]['id'];var _0x32805c=_0x512f4f['body'];var _0x3fe6ac=0xc8;var _0x300b4e=null;return db[_0xb2cb('0x94')]['transaction']({'isolationLevel':db['sequelize'][_0xb2cb('0x95')][_0xb2cb('0x96')][_0xb2cb('0x97')]},function(_0x5e4ed7){return db['MailAccount'][_0xb2cb('0x6c')]({'where':{'id':_0x2a335a},'transaction':_0x5e4ed7})[_0xb2cb('0x11')](function(_0x5089d2){if(_0x5089d2){return db[_0xb2cb('0x98')]['destroy']({'where':{'MailAccountId':_0x2a335a},'transaction':_0x5e4ed7})[_0xb2cb('0x11')](function(){var _0x1e2af6=_['map'](_0x32805c,function(_0x16bf8d){_0x16bf8d['MailAccountId']=_0x2a335a;return _0x16bf8d;});return db[_0xb2cb('0x98')][_0xb2cb('0x99')](_0x1e2af6,{'transaction':_0x5e4ed7});});}else{_0x3fe6ac=0x194;_0x300b4e=[];}});})['then'](function(){if(_0x3fe6ac!==0x194){return db[_0xb2cb('0x98')][_0xb2cb('0x9a')]({'where':{'MailAccountId':_0x2a335a},'order':_0xb2cb('0x9b')})[_0xb2cb('0x11')](function(_0x1e8718){_0x300b4e=_0x1e8718;});}})['catch'](function(_0x1f87ae){_0x3fe6ac=0x1f4;logger['error'](_0x1f87ae[_0xb2cb('0x28')]);if(_0x1f87ae[_0xb2cb('0x29')]){delete _0x1f87ae[_0xb2cb('0x29')];}_0x300b4e=_0x1f87ae;})[_0xb2cb('0x9c')](function(){if(_0x300b4e===null){_0x568ab1['sendStatus'](_0x3fe6ac);}else{if(_0x3fe6ac===0x1f4){_0x568ab1[_0xb2cb('0x1c')](_0x3fe6ac)[_0xb2cb('0x2a')](_0x300b4e);}else{_0x568ab1[_0xb2cb('0x1c')](_0x3fe6ac)[_0xb2cb('0x1e')](_0x300b4e);}}});};exports[_0xb2cb('0x9d')]=function(_0x5e0feb,_0x551787){var _0x366e23={};var _0x40e0e1={};var _0x87ab92;var _0x30088e;return db[_0xb2cb('0x46')][_0xb2cb('0x6c')]({'where':{'id':_0x5e0feb[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x551787,null))['then'](function(_0x26dae7){if(_0x26dae7){_0x87ab92=_0x26dae7;_0x40e0e1[_0xb2cb('0x4d')]=_[_0xb2cb('0x4c')](db[_0xb2cb('0x98')][_0xb2cb('0x47')]);_0x40e0e1[_0xb2cb('0x4b')]=_[_0xb2cb('0x4c')](_0x5e0feb[_0xb2cb('0x4b')]);_0x40e0e1[_0xb2cb('0x54')]=_[_0xb2cb('0x4f')](_0x40e0e1[_0xb2cb('0x4d')],_0x40e0e1[_0xb2cb('0x4b')]);_0x366e23['attributes']=_[_0xb2cb('0x4f')](_0x40e0e1[_0xb2cb('0x4d')],qs[_0xb2cb('0x50')](_0x5e0feb[_0xb2cb('0x4b')][_0xb2cb('0x50')]));_0x366e23['attributes']=_0x366e23['attributes'][_0xb2cb('0x51')]?_0x366e23[_0xb2cb('0x4e')]:_0x40e0e1['model'];_0x366e23[_0xb2cb('0x6e')]=qs['sort'](_0x5e0feb[_0xb2cb('0x4b')][_0xb2cb('0x6f')]);_0x366e23[_0xb2cb('0x53')]=qs[_0xb2cb('0x54')](_[_0xb2cb('0x55')](_0x5e0feb[_0xb2cb('0x4b')],_0x40e0e1[_0xb2cb('0x54')]));if(_0x5e0feb[_0xb2cb('0x4b')][_0xb2cb('0x56')]){_0x366e23[_0xb2cb('0x53')]=_['merge'](_0x366e23['where'],{'$or':_['map'](_0x366e23['attributes'],function(_0x4622b3){var _0x5952e9={};_0x5952e9[_0x4622b3]={'$like':'%'+_0x5e0feb[_0xb2cb('0x4b')][_0xb2cb('0x56')]+'%'};return _0x5952e9;})});}_0x366e23=_[_0xb2cb('0x57')]({},_0x366e23,_0x5e0feb[_0xb2cb('0x59')]);return _0x87ab92[_0xb2cb('0x9d')](_0x366e23);}})[_0xb2cb('0x11')](function(_0x323f15){if(_0x323f15){_0x30088e=_0x323f15['length'];if(!_0x5e0feb[_0xb2cb('0x4b')][_0xb2cb('0x52')](_0xb2cb('0x6d'))){_0x366e23[_0xb2cb('0x20')]=qs[_0xb2cb('0x20')](_0x5e0feb['query']['limit']);_0x366e23['offset']=qs[_0xb2cb('0x22')](_0x5e0feb[_0xb2cb('0x4b')][_0xb2cb('0x22')]);}return _0x87ab92[_0xb2cb('0x9d')](_0x366e23);}})[_0xb2cb('0x11')](function(_0x5c79fa){if(_0x5c79fa){return _0x5c79fa?{'count':_0x30088e,'rows':_0x5c79fa}:null;}})[_0xb2cb('0x11')](respondWithResult(_0x551787,null))[_0xb2cb('0x5e')](handleError(_0x551787,null));};exports[_0xb2cb('0x9e')]=function(_0x4e42da,_0x5ad621){var _0x440bc3={'raw':!![],'where':{}};var _0x21560b={};var _0x44f3d8={'count':0x0,'rows':[]};return db[_0xb2cb('0x46')][_0xb2cb('0x6c')]({'where':{'id':_0x4e42da[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x5ad621,null))[_0xb2cb('0x11')](function(_0x592067){if(_0x592067){_0x21560b['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x21560b[_0xb2cb('0x4b')]=_[_0xb2cb('0x4c')](_0x4e42da['query']);_0x21560b[_0xb2cb('0x54')]=_[_0xb2cb('0x4f')](_0x21560b[_0xb2cb('0x4d')],_0x21560b[_0xb2cb('0x4b')]);_0x440bc3['attributes']=_['intersection'](_0x21560b[_0xb2cb('0x4d')],qs['fields'](_0x4e42da['query'][_0xb2cb('0x50')]));_0x440bc3[_0xb2cb('0x4e')]=_0x440bc3[_0xb2cb('0x4e')][_0xb2cb('0x51')]?_0x440bc3['attributes']:_0x21560b[_0xb2cb('0x4d')];if(!_0x4e42da['query']['hasOwnProperty'](_0xb2cb('0x6d'))){_0x440bc3['limit']=qs[_0xb2cb('0x20')](_0x4e42da[_0xb2cb('0x4b')][_0xb2cb('0x20')]);_0x440bc3['offset']=qs['offset'](_0x4e42da[_0xb2cb('0x4b')]['offset']);}_0x440bc3['order']=qs[_0xb2cb('0x6f')](_0x4e42da[_0xb2cb('0x4b')]['sort']);_0x440bc3['where']=qs[_0xb2cb('0x54')](_[_0xb2cb('0x55')](_0x4e42da[_0xb2cb('0x4b')],_0x21560b[_0xb2cb('0x54')]));_0x440bc3[_0xb2cb('0x53')][_0xb2cb('0x69')]=_0x592067['id'];if(_0x4e42da['query'][_0xb2cb('0x56')]){_0x440bc3[_0xb2cb('0x53')]=_[_0xb2cb('0x57')](_0x440bc3[_0xb2cb('0x53')],{'$or':_[_0xb2cb('0x45')](_0x440bc3[_0xb2cb('0x4e')],function(_0x4ec0cb){var _0x3b0322={};_0x3b0322[_0x4ec0cb]={'$like':'%'+_0x4e42da[_0xb2cb('0x4b')][_0xb2cb('0x56')]+'%'};return _0x3b0322;})});}if(_0x4e42da['query'][_0xb2cb('0x9f')]){var _0x3bea2e=_0x4e42da['query'][_0xb2cb('0x9f')][_0xb2cb('0xa0')](',');var _0x2f5b76={};_0x2f5b76[_0x3bea2e[0x0]]={'$gte':moment(_0x3bea2e[0x1])['format'](_0xb2cb('0xa1'))};_0x440bc3[_0xb2cb('0x53')]=_['merge'](_0x440bc3[_0xb2cb('0x53')],_0x2f5b76);}_0x440bc3=_[_0xb2cb('0x57')]({},_0x440bc3,_0x4e42da[_0xb2cb('0x59')]);return db['MailMessage'][_0xb2cb('0x21')]({'where':_0x440bc3['where']})['then'](function(_0x590c5b){_0x44f3d8[_0xb2cb('0x21')]=_0x590c5b;if(_0x4e42da[_0xb2cb('0x4b')][_0xb2cb('0x5a')]){_0x440bc3[_0xb2cb('0x5b')]=[{'all':!![]}];}return db[_0xb2cb('0xa2')]['findAll'](_0x440bc3);})[_0xb2cb('0x11')](function(_0x5154b7){if(_0x4e42da['query']['inlineCss']===_0xb2cb('0xa3')){for(var _0xbff135=0x0;_0xbff135<_0x5154b7[_0xb2cb('0x51')];_0xbff135++){_0x5154b7[_0xbff135][_0xb2cb('0x61')]=juice(_0x5154b7[_0xbff135]['body']);}}_0x44f3d8[_0xb2cb('0x5d')]=_0x5154b7;return _0x44f3d8;});}})[_0xb2cb('0x11')](respondWithFilteredResult(_0x5ad621,_0x440bc3))[_0xb2cb('0x5e')](handleError(_0x5ad621,null));};exports[_0xb2cb('0x2a')]=function(_0x48507b,_0x3de27b){var _0x405f6b,_0x28aa66={},_0x29aabe;if(_0x48507b['body']['to']){_0x29aabe=_0x48507b['body']['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x48507b[_0xb2cb('0x5f')]['id']},'include':[{'model':db[_0xb2cb('0xa4')],'as':_0xb2cb('0xa5'),'include':[{'model':db[_0xb2cb('0x8c')],'as':'Contacts','where':{'email':_0x29aabe},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xb2cb('0x43')],'as':_0xb2cb('0x40'),'raw':!![],'include':[{'model':db[_0xb2cb('0xa6')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x3de27b,null))[_0xb2cb('0x11')](function(_0x280431){if(!_0x280431)return;_0x405f6b=_0x280431;if(!_0x280431[_0xb2cb('0x40')])throw new Error(_0xb2cb('0xa7'));if(_[_0xb2cb('0x77')](_0x48507b[_0xb2cb('0x61')][_0xb2cb('0xa8')])){_0x48507b[_0xb2cb('0x61')][_0xb2cb('0xa8')]=util[_0xb2cb('0xa9')]('%s\x20<%s>',_0x280431[_0xb2cb('0x29')],_0x280431[_0xb2cb('0x75')]||_0x280431['Smtp'][_0xb2cb('0x36')]);}if(_0x48507b['body']['attachments']&&_0x48507b[_0xb2cb('0x61')][_0xb2cb('0xaa')][_0xb2cb('0x51')]){for(var _0x5ef02c=0x0;_0x5ef02c<_0x48507b[_0xb2cb('0x61')][_0xb2cb('0xaa')][_0xb2cb('0x51')];_0x5ef02c+=0x1){_0x48507b['body'][_0xb2cb('0xaa')][_0x5ef02c]={'filename':_0x48507b[_0xb2cb('0x61')][_0xb2cb('0xaa')][_0x5ef02c][_0xb2cb('0x29')],'path':path[_0xb2cb('0xab')](config[_0xb2cb('0xac')],_0xb2cb('0xad'),_0x48507b['body'][_0xb2cb('0xaa')][_0x5ef02c]['basename'])};}}var _0x174338=_0x280431[_0xb2cb('0xae')]();return respondWithRpcPromise(_0xb2cb('0xaf'),_0xb2cb('0xb0'),{'account':_0x174338,'message':_0x48507b[_0xb2cb('0x61')]});})[_0xb2cb('0x11')](function(_0x28002f){if(!_0x28002f)return;_0x28aa66=_0x28002f;if(!_0x405f6b[_0xb2cb('0xa5')])throw new Error(_0xb2cb('0xb1'));if(_0x405f6b[_0xb2cb('0xa5')]['Contacts'][_0xb2cb('0x51')])return _0x405f6b[_0xb2cb('0xa5')][_0xb2cb('0xb2')][0x0];return db[_0xb2cb('0x8c')][_0xb2cb('0x6b')](_[_0xb2cb('0x8')](_0x48507b[_0xb2cb('0x61')],{'firstName':_0x48507b[_0xb2cb('0x61')]['to'],'email':_0x48507b[_0xb2cb('0x61')]['to'],'phone':_0x48507b[_0xb2cb('0x61')]['to'],'ListId':_0x405f6b[_0xb2cb('0x76')]}));})['then'](function(_0x404ce6){if(!_0x404ce6)return;var _0x13d212={'UserId':_0x48507b[_0xb2cb('0x36')]['id'],'ContactId':_0x404ce6['id'],'MailAccountId':_0x405f6b['id'],'inReplyTo':_0x28aa66[_0xb2cb('0xb3')],'to':_0x48507b[_0xb2cb('0x61')][_0xb2cb('0xa8')],'cc':_0x48507b['body']['cc'],'subject':_0x48507b[_0xb2cb('0x61')][_0xb2cb('0xb4')],'attach':_0x48507b[_0xb2cb('0x61')][_0xb2cb('0xb5')],'firstMsgDirection':_0xb2cb('0xb6'),'lastMsgAt':moment()['format'](_0xb2cb('0xa1')),'lastMsgDirection':_0xb2cb('0xb6'),'Messages':[_[_0xb2cb('0x57')](_0x48507b[_0xb2cb('0x61')],{'messageId':_0x28aa66[_0xb2cb('0xb3')],'sentAt':moment()[_0xb2cb('0xa9')](_0xb2cb('0xa1')),'read':!![],'MailAccountId':_0x405f6b['id'],'UserId':_0x48507b[_0xb2cb('0x36')]['id'],'ContactId':_0x404ce6['id']})]};if(_0x48507b['body']['Interaction']){_0x13d212=_[_0xb2cb('0x57')](_0x13d212,_0x48507b[_0xb2cb('0x61')][_0xb2cb('0xb7')]);}return db[_0xb2cb('0x8b')][_0xb2cb('0x6b')](_0x13d212,{'include':[{'model':db[_0xb2cb('0xa2')],'as':_0xb2cb('0xb8')}]});})[_0xb2cb('0x11')](respondWithResult(_0x3de27b,null))[_0xb2cb('0x5e')](handleError(_0x3de27b,null));};exports[_0xb2cb('0xb9')]=function(_0x2e39eb,_0x178894){return db[_0xb2cb('0x46')]['find']({'where':{'id':_0x2e39eb[_0xb2cb('0x5f')]['id']},'include':[{'model':db[_0xb2cb('0x43')],'as':_0xb2cb('0x40'),'raw':!![],'include':[{'model':db[_0xb2cb('0xa6')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x178894,null))['then'](function(_0x218f2d){if(!_0x218f2d[_0xb2cb('0x40')])return;var _0x556eb1=_0x218f2d['getSmtpOptions']();return respondWithRpcPromise(_0xb2cb('0xba'),_0xb2cb('0xb9'),{'account':_0x556eb1});})[_0xb2cb('0x11')](respondWithResult(_0x178894,null))['catch'](handleError(_0x178894,null));};exports['destroy']=function(_0x15f80b,_0x28cb18){return db['MailAccount'][_0xb2cb('0x60')]({'where':{'id':_0x15f80b[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x28cb18,null))[_0xb2cb('0x11')](function(_0x2c506b){if(_0x2c506b&&_0x2c506b[_0xb2cb('0x3c')]){throw new db[(_0xb2cb('0xbb'))][(_0xb2cb('0xbc'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2c506b;})[_0xb2cb('0x11')](removeEntity(_0x28cb18,null))[_0xb2cb('0x5e')](handleError(_0x28cb18,null));};exports[_0xb2cb('0xbd')]=function(_0x652dee,_0x21e09b){return db[_0xb2cb('0x46')]['find']({'where':{'id':_0x652dee['params']['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x21e09b,null))['then'](function(_0xa627b5){if(_0xa627b5){return _0xa627b5[_0xb2cb('0xbd')](_0x652dee[_0xb2cb('0x61')][_0xb2cb('0x71')],_[_0xb2cb('0x89')](_0x652dee[_0xb2cb('0x61')],[_0xb2cb('0x71'),'id'])||{})['spread'](function(_0x14c816){for(var _0x342bae=0x0;_0x342bae<_0x652dee[_0xb2cb('0x61')][_0xb2cb('0x71')][_0xb2cb('0x51')];_0x342bae+=0x1){socket['emit'](_0xb2cb('0xbe'),{'UserId':Number(_0x652dee[_0xb2cb('0x61')][_0xb2cb('0x71')][_0x342bae]),'MailAccountId':Number(_0x652dee[_0xb2cb('0x5f')]['id'])});}return _0x14c816;});}})[_0xb2cb('0x11')](respondWithResult(_0x21e09b,null))['catch'](handleError(_0x21e09b,null));};exports[_0xb2cb('0xbf')]=function(_0x5a7123,_0x3eace3){return db['MailAccount'][_0xb2cb('0x60')]({'where':{'id':_0x5a7123[_0xb2cb('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3eace3,null))[_0xb2cb('0x11')](function(_0xdb6f00){if(_0xdb6f00){return _0xdb6f00['removeAgents'](_0x5a7123[_0xb2cb('0x4b')]['ids'])[_0xb2cb('0x11')](function(){if(_[_0xb2cb('0xc0')](_0x5a7123[_0xb2cb('0x4b')]['ids'])){for(var _0xb003a8=0x0;_0xb003a8<_0x5a7123[_0xb2cb('0x4b')]['ids'][_0xb2cb('0x51')];_0xb003a8+=0x1){socket[_0xb2cb('0xc1')](_0xb2cb('0xc2'),{'UserId':Number(_0x5a7123[_0xb2cb('0x4b')][_0xb2cb('0x71')][_0xb003a8]),'MailAccountId':Number(_0x5a7123[_0xb2cb('0x5f')]['id'])});}}else{socket[_0xb2cb('0xc1')](_0xb2cb('0xc2'),{'UserId':Number(_0x5a7123[_0xb2cb('0x4b')]['ids']),'MailAccountId':Number(_0x5a7123[_0xb2cb('0x5f')]['id'])});}});}})[_0xb2cb('0x11')](respondWithStatusCode(_0x3eace3,null))[_0xb2cb('0x5e')](handleError(_0x3eace3,null));};exports[_0xb2cb('0xc3')]=function(_0x17def2,_0x26a7a5){var _0x4cc3ed={};var _0x415433={};var _0xc5655a;var _0x3e5073;return db[_0xb2cb('0x46')][_0xb2cb('0x6c')]({'where':{'id':_0x17def2[_0xb2cb('0x5f')]['id']}})[_0xb2cb('0x11')](handleEntityNotFound(_0x26a7a5,null))[_0xb2cb('0x11')](function(_0x2b10db){if(_0x2b10db){_0xc5655a=_0x2b10db;_0x415433[_0xb2cb('0x4d')]=_[_0xb2cb('0x4c')](db[_0xb2cb('0x8d')]['rawAttributes']);_0x415433[_0xb2cb('0x4b')]=_[_0xb2cb('0x4c')](_0x17def2['query']);_0x415433['filters']=_[_0xb2cb('0x4f')](_0x415433[_0xb2cb('0x4d')],_0x415433[_0xb2cb('0x4b')]);_0x4cc3ed[_0xb2cb('0x4e')]=_[_0xb2cb('0x4f')](_0x415433[_0xb2cb('0x4d')],qs[_0xb2cb('0x50')](_0x17def2[_0xb2cb('0x4b')][_0xb2cb('0x50')]));_0x4cc3ed[_0xb2cb('0x4e')]=_0x4cc3ed[_0xb2cb('0x4e')][_0xb2cb('0x51')]?_0x4cc3ed[_0xb2cb('0x4e')]:_0x415433[_0xb2cb('0x4d')];_0x4cc3ed['order']=qs[_0xb2cb('0x6f')](_0x17def2[_0xb2cb('0x4b')]['sort']);_0x4cc3ed['where']=qs[_0xb2cb('0x54')](_[_0xb2cb('0x55')](_0x17def2['query'],_0x415433[_0xb2cb('0x54')]));if(_0x17def2[_0xb2cb('0x4b')]['filter']){_0x4cc3ed['where']=_[_0xb2cb('0x57')](_0x4cc3ed[_0xb2cb('0x53')],{'$or':_[_0xb2cb('0x45')](_0x4cc3ed[_0xb2cb('0x4e')],function(_0x5e67e5){var _0x20442f={};_0x20442f[_0x5e67e5]={'$like':'%'+_0x17def2['query'][_0xb2cb('0x56')]+'%'};return _0x20442f;})});}_0x4cc3ed=_[_0xb2cb('0x57')]({},_0x4cc3ed,_0x17def2[_0xb2cb('0x59')]);return _0xc5655a[_0xb2cb('0xc3')](_0x4cc3ed);}})[_0xb2cb('0x11')](function(_0x45ae1b){if(_0x45ae1b){_0x3e5073=_0x45ae1b['length'];if(!_0x17def2['query'][_0xb2cb('0x52')](_0xb2cb('0x6d'))){_0x4cc3ed[_0xb2cb('0x20')]=qs[_0xb2cb('0x20')](_0x17def2[_0xb2cb('0x4b')][_0xb2cb('0x20')]);_0x4cc3ed[_0xb2cb('0x22')]=qs['offset'](_0x17def2[_0xb2cb('0x4b')][_0xb2cb('0x22')]);}return _0xc5655a[_0xb2cb('0xc3')](_0x4cc3ed);}})['then'](function(_0x4fe86e){if(_0x4fe86e){return _0x4fe86e?{'count':_0x3e5073,'rows':_0x4fe86e}:null;}})[_0xb2cb('0x11')](respondWithResult(_0x26a7a5,null))[_0xb2cb('0x5e')](handleError(_0x26a7a5,null));}; \ No newline at end of file +var _0xbc29=['removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','filter','removeAnswers','custom','email','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','User','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','ListId','subject','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','then','stack','send','gmail','imap.gmail.com','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','password','modernAuthentication','CloudProviderId','host','port','secure','service','pass','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','name','options','MailAccount','includeAll','include','rows','catch','mandatoryDispositionPause','keys','length','body','provider','find','params','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','findAll'];(function(_0x85666,_0x403be2){var _0x233527=function(_0x31d496){while(--_0x31d496){_0x85666['push'](_0x85666['shift']());}};_0x233527(++_0x403be2);}(_0xbc29,0x1de));var _0x9bc2=function(_0x2ff205,_0x413c68){_0x2ff205=_0x2ff205-0x0;var _0x591903=_0xbc29[_0x2ff205];return _0x591903;};'use strict';var moment=require('moment');var BPromise=require(_0x9bc2('0x0'));var util=require(_0x9bc2('0x1'));var path=require(_0x9bc2('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require(_0x9bc2('0x3'));var qs=require(_0x9bc2('0x4'));var logger=require(_0x9bc2('0x5'))(_0x9bc2('0x6'));var config=require(_0x9bc2('0x7'));var db=require(_0x9bc2('0x8'))['db'];config[_0x9bc2('0x9')]=_[_0x9bc2('0xa')](config[_0x9bc2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9bc2('0xb'))(new Redis(config[_0x9bc2('0x9')]));require('./mailAccount.socket')[_0x9bc2('0xc')](socket);var jayson=require(_0x9bc2('0xd'));var client=jayson[_0x9bc2('0xe')][_0x9bc2('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x4d56ec,_0x574a4a,_0x23d1a5,_0x52e3a1){return new BPromise(function(_0x3c89d5,_0x55482c){var _0x5891a8=_0x52e3a1||client;return _0x5891a8[_0x9bc2('0x10')](_0x4d56ec,_0x23d1a5)['then'](function(_0xdfe809){logger[_0x9bc2('0x11')](_0x9bc2('0x12'),_0x574a4a,_0x9bc2('0x13'));logger[_0x9bc2('0x14')](_0x9bc2('0x15'),_0x574a4a,'request\x20sent',JSON[_0x9bc2('0x16')](_0xdfe809));if(_0xdfe809['error']){if(_0xdfe809[_0x9bc2('0x17')][_0x9bc2('0x18')]===0x1f4){logger[_0x9bc2('0x17')](_0x9bc2('0x12'),_0x574a4a,_0xdfe809[_0x9bc2('0x17')][_0x9bc2('0x19')]);return _0x55482c(_0xdfe809[_0x9bc2('0x17')][_0x9bc2('0x19')]);}logger[_0x9bc2('0x17')](_0x9bc2('0x12'),_0x574a4a,_0xdfe809[_0x9bc2('0x17')][_0x9bc2('0x19')]);return _0x3c89d5(_0xdfe809[_0x9bc2('0x17')][_0x9bc2('0x19')]);}else{logger[_0x9bc2('0x11')](_0x9bc2('0x12'),_0x574a4a,_0x9bc2('0x13'));_0x3c89d5(_0xdfe809[_0x9bc2('0x1a')][_0x9bc2('0x19')]);}})['catch'](function(_0x2bec21){logger['error']('MailAccount,\x20%s,\x20%s',_0x574a4a,_0x2bec21);_0x55482c(_0x2bec21);});});}function respondWithStatusCode(_0x644233,_0x5bfb8f){_0x5bfb8f=_0x5bfb8f||0xcc;return function(_0x5d3238){if(_0x5d3238){return _0x644233[_0x9bc2('0x1b')](_0x5bfb8f);}return _0x644233[_0x9bc2('0x1c')](_0x5bfb8f)['end']();};}function respondWithResult(_0x405b7a,_0x4f3a50){_0x4f3a50=_0x4f3a50||0xc8;return function(_0x4e2f0f){if(_0x4e2f0f){return _0x405b7a[_0x9bc2('0x1c')](_0x4f3a50)[_0x9bc2('0x1d')](_0x4e2f0f);}};}function respondWithFilteredResult(_0x2ddffc,_0x4abe49){return function(_0x597b7c){if(_0x597b7c){var _0x5b72e5=typeof _0x4abe49[_0x9bc2('0x1e')]===_0x9bc2('0x1f')&&typeof _0x4abe49['limit']===_0x9bc2('0x1f');var _0x12ccd1=_0x597b7c[_0x9bc2('0x20')];var _0x184a04=_0x5b72e5?0x0:_0x4abe49['offset'];var _0x5aaa64=_0x5b72e5?_0x597b7c[_0x9bc2('0x20')]:_0x4abe49[_0x9bc2('0x1e')]+_0x4abe49[_0x9bc2('0x21')];var _0x383c52;if(_0x5aaa64>=_0x12ccd1){_0x5aaa64=_0x12ccd1;_0x383c52=0xc8;}else{_0x383c52=0xce;}_0x2ddffc[_0x9bc2('0x1c')](_0x383c52);return _0x2ddffc[_0x9bc2('0x22')](_0x9bc2('0x23'),_0x184a04+'-'+_0x5aaa64+'/'+_0x12ccd1)[_0x9bc2('0x1d')](_0x597b7c);}return null;};}function saveUpdates(_0x3a355f){return function(_0x362b4c){if(_0x362b4c){return _0x362b4c[_0x9bc2('0x24')](_0x3a355f)['then'](function(_0x51f001){return _0x51f001;});}return null;};}function removeEntity(_0xafc37d){return function(_0x9fab3a){if(_0x9fab3a){return _0x9fab3a[_0x9bc2('0x25')]()['then'](function(){var _0x507cee=_0x9fab3a[_0x9bc2('0x26')]({'plain':!![]});var _0x4bb80e=_0x9bc2('0x27');return db[_0x9bc2('0x28')][_0x9bc2('0x25')]({'where':{'type':_0x4bb80e,'resourceId':_0x507cee['id']}})[_0x9bc2('0x29')](function(){return _0x9fab3a;});})[_0x9bc2('0x29')](function(){_0xafc37d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43a82c){return function(_0x432881){if(!_0x432881){_0x43a82c['sendStatus'](0x194);}return _0x432881;};}function handleError(_0x477000,_0x1dba00){_0x1dba00=_0x1dba00||0x1f4;return function(_0x283d64){logger[_0x9bc2('0x17')](_0x283d64[_0x9bc2('0x2a')]);if(_0x283d64['name']){delete _0x283d64['name'];}_0x477000[_0x9bc2('0x1c')](_0x1dba00)[_0x9bc2('0x2b')](_0x283d64);};}function getImapHost(_0x431559){switch(_0x431559){case _0x9bc2('0x2c'):return _0x9bc2('0x2d');case'yahoo':return _0x9bc2('0x2e');case _0x9bc2('0x2f'):return _0x9bc2('0x30');case _0x9bc2('0x31'):return _0x9bc2('0x32');}throw new Error(_0x9bc2('0x33'),_0x431559);}function getSmtpHost(_0x5c023c){switch(_0x5c023c){case _0x9bc2('0x2c'):return _0x9bc2('0x34');case'yahoo':return _0x9bc2('0x35');case _0x9bc2('0x2f'):return _0x9bc2('0x36');case _0x9bc2('0x31'):return _0x9bc2('0x37');}throw new Error(_0x9bc2('0x33'),_0x5c023c);}function getAuthenticationOptions(_0x21e53c,_0x1691cc){var _0x118a95={};var _0x53f560={};if(_0x21e53c){_0x118a95[_0x9bc2('0x38')]=_0x53f560[_0x9bc2('0x38')]=_0x1691cc[_0x9bc2('0x39')];_0x118a95[_0x9bc2('0x3a')]=_0x53f560['pass']=_0x1691cc[_0x9bc2('0x3a')];if(_0x1691cc[_0x9bc2('0x3b')]){_0x118a95['modernAuthentication']=_0x53f560[_0x9bc2('0x3b')]=!![];_0x118a95[_0x9bc2('0x3c')]=_0x53f560['CloudProviderId']=_0x1691cc[_0x9bc2('0x3c')];_0x118a95['password']=_0x53f560['pass']=null;}else{_0x118a95[_0x9bc2('0x3c')]=_0x53f560[_0x9bc2('0x3c')]=null;}_0x118a95[_0x9bc2('0x3d')]=getImapHost(_0x21e53c);_0x118a95[_0x9bc2('0x3e')]=0x3e1;_0x53f560[_0x9bc2('0x3d')]=getSmtpHost(_0x21e53c);_0x53f560['port']=0x24b;_0x53f560[_0x9bc2('0x3f')]=![];_0x118a95[_0x9bc2('0x40')]=_0x53f560[_0x9bc2('0x40')]=null;}else{if(_0x1691cc['authentication']){_0x118a95[_0x9bc2('0x38')]=_0x53f560[_0x9bc2('0x38')]=_0x1691cc['username'];_0x118a95['password']=_0x53f560[_0x9bc2('0x41')]=_0x1691cc['password'];}else{_0x118a95[_0x9bc2('0x42')]=_0x53f560[_0x9bc2('0x42')]=![];_0x118a95[_0x9bc2('0x38')]=_0x53f560[_0x9bc2('0x38')]=null;_0x118a95[_0x9bc2('0x3a')]=_0x53f560[_0x9bc2('0x41')]=null;}_0x118a95[_0x9bc2('0x3d')]=_0x1691cc[_0x9bc2('0x43')][_0x9bc2('0x3d')];_0x118a95[_0x9bc2('0x3e')]=_0x1691cc[_0x9bc2('0x43')][_0x9bc2('0x3e')];_0x53f560[_0x9bc2('0x3d')]=_0x1691cc['Smtp'][_0x9bc2('0x3d')];_0x53f560[_0x9bc2('0x3e')]=_0x1691cc[_0x9bc2('0x44')][_0x9bc2('0x3e')];}return{'Imap':_0x118a95,'Smtp':_0x53f560};}exports[_0x9bc2('0x45')]=function(_0x12fb66,_0x52d641){var _0x1ef5f7={'include':[{'model':db[_0x9bc2('0x46')],'as':_0x9bc2('0x43')},{'model':db[_0x9bc2('0x47')],'as':_0x9bc2('0x44')},{'model':db[_0x9bc2('0x48')],'as':'mandatoryDispositionPause'}]},_0x26a994={},_0x1ee048={'count':0x0,'rows':[]};var _0x1c655f=_[_0x9bc2('0x49')](db['MailAccount'][_0x9bc2('0x4a')],function(_0x2fabf5){return{'name':_0x2fabf5['fieldName'],'type':_0x2fabf5[_0x9bc2('0x4b')][_0x9bc2('0x4c')]};});_0x26a994[_0x9bc2('0x4d')]=_[_0x9bc2('0x49')](_0x1c655f,'name');_0x26a994['query']=_['keys'](_0x12fb66[_0x9bc2('0x4e')]);_0x26a994[_0x9bc2('0x4f')]=_[_0x9bc2('0x50')](_0x26a994[_0x9bc2('0x4d')],_0x26a994[_0x9bc2('0x4e')]);_0x1ef5f7[_0x9bc2('0x51')]=_['intersection'](_0x26a994[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x12fb66[_0x9bc2('0x4e')][_0x9bc2('0x52')]));_0x1ef5f7[_0x9bc2('0x51')]=_0x1ef5f7[_0x9bc2('0x51')]['length']?_0x1ef5f7[_0x9bc2('0x51')]:_0x26a994[_0x9bc2('0x4d')];if(!_0x12fb66[_0x9bc2('0x4e')][_0x9bc2('0x53')](_0x9bc2('0x54'))){_0x1ef5f7[_0x9bc2('0x21')]=qs['limit'](_0x12fb66[_0x9bc2('0x4e')][_0x9bc2('0x21')]);_0x1ef5f7[_0x9bc2('0x1e')]=qs[_0x9bc2('0x1e')](_0x12fb66[_0x9bc2('0x4e')]['offset']);}_0x1ef5f7[_0x9bc2('0x55')]=qs[_0x9bc2('0x56')](_0x12fb66[_0x9bc2('0x4e')][_0x9bc2('0x56')]);_0x1ef5f7['where']=qs['filters'](_[_0x9bc2('0x57')](_0x12fb66[_0x9bc2('0x4e')],_0x26a994[_0x9bc2('0x4f')]),_0x1c655f);if(_0x12fb66[_0x9bc2('0x4e')]['filter']){_0x1ef5f7[_0x9bc2('0x58')]=_[_0x9bc2('0x59')](_0x1ef5f7['where'],{'$or':_[_0x9bc2('0x49')](_0x1c655f,function(_0x1806ea){if(_0x1806ea[_0x9bc2('0x4b')]!==_0x9bc2('0x5a')){var _0x4711c2={};_0x4711c2[_0x1806ea[_0x9bc2('0x5b')]]={'$like':'%'+_0x12fb66['query']['filter']+'%'};return _0x4711c2;}})});}_0x1ef5f7=_[_0x9bc2('0x59')]({},_0x1ef5f7,_0x12fb66[_0x9bc2('0x5c')]);var _0x3aff1d={'where':_0x1ef5f7[_0x9bc2('0x58')]};return db[_0x9bc2('0x5d')][_0x9bc2('0x20')](_0x3aff1d)[_0x9bc2('0x29')](function(_0x76d087){_0x1ee048[_0x9bc2('0x20')]=_0x76d087;if(_0x12fb66['query'][_0x9bc2('0x5e')]){_0x1ef5f7[_0x9bc2('0x5f')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x1ef5f7);})['then'](function(_0x587a90){_0x1ee048[_0x9bc2('0x60')]=_0x587a90;return _0x1ee048;})[_0x9bc2('0x29')](respondWithFilteredResult(_0x52d641,_0x1ef5f7))[_0x9bc2('0x61')](handleError(_0x52d641,null));};exports['show']=function(_0x5d5606,_0x48d6bd){var _0x266d48={'raw':![],'where':{'id':_0x5d5606['params']['id']},'include':[{'model':db[_0x9bc2('0x46')],'as':_0x9bc2('0x43')},{'model':db[_0x9bc2('0x47')],'as':'Smtp'},{'model':db[_0x9bc2('0x48')],'as':_0x9bc2('0x62')}]},_0x5d3140={};_0x5d3140[_0x9bc2('0x4d')]=_[_0x9bc2('0x63')](db[_0x9bc2('0x5d')][_0x9bc2('0x4a')]);_0x5d3140[_0x9bc2('0x4e')]=_['keys'](_0x5d5606[_0x9bc2('0x4e')]);_0x5d3140[_0x9bc2('0x4f')]=_[_0x9bc2('0x50')](_0x5d3140['model'],_0x5d3140['query']);_0x266d48[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x5d3140[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x5d5606[_0x9bc2('0x4e')][_0x9bc2('0x52')]));_0x266d48[_0x9bc2('0x51')]=_0x266d48[_0x9bc2('0x51')][_0x9bc2('0x64')]?_0x266d48[_0x9bc2('0x51')]:_0x5d3140['model'];if(_0x5d5606[_0x9bc2('0x4e')][_0x9bc2('0x5e')]){_0x266d48[_0x9bc2('0x5f')]=[{'all':!![]}];}_0x266d48=_[_0x9bc2('0x59')]({},_0x266d48,_0x5d5606[_0x9bc2('0x5c')]);return db[_0x9bc2('0x5d')]['find'](_0x266d48)['then'](handleEntityNotFound(_0x48d6bd,null))[_0x9bc2('0x29')](respondWithResult(_0x48d6bd,null))[_0x9bc2('0x61')](handleError(_0x48d6bd,null));};exports[_0x9bc2('0x24')]=function(_0x2e4c89,_0x2cf8ae){if(_0x2e4c89[_0x9bc2('0x65')]['id']){delete _0x2e4c89['body']['id'];}var _0xbd61e=_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x66')]==='custom'?null:_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x66')];var _0x3fd4ad=_0x2e4c89['body']['Imap']||{};var _0x5929d9=_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x44')]||{};if(_0xbd61e){_0x3fd4ad[_0x9bc2('0x3d')]=getImapHost(_0xbd61e);_0x3fd4ad[_0x9bc2('0x3e')]=0x3e1;_0x5929d9['host']=getSmtpHost(_0xbd61e);_0x5929d9[_0x9bc2('0x3e')]=0x24b;_0x5929d9['secure']=![];}if(_0x5929d9[_0x9bc2('0x3b')]){_0x5929d9[_0x9bc2('0x3f')]=![];}else{_0x5929d9[_0x9bc2('0x3c')]=null;}if(!_0x3fd4ad[_0x9bc2('0x3b')])_0x3fd4ad[_0x9bc2('0x3c')]=null;_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x43')]=_0x3fd4ad;_0x2e4c89[_0x9bc2('0x65')]['Smtp']=_0x5929d9;return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x2e4c89[_0x9bc2('0x68')]['id']},'include':[{'model':db[_0x9bc2('0x46')],'as':'Imap'},{'model':db[_0x9bc2('0x47')],'as':'Smtp'},{'model':db[_0x9bc2('0x48')],'as':_0x9bc2('0x62')}]})['then'](handleEntityNotFound(_0x2cf8ae,null))[_0x9bc2('0x29')](function(_0xb78536){if(!_0xb78536)throw new Error('Mail\x20Account\x20not\x20found');if(_0xb78536[_0x9bc2('0x40')])delete _0x2e4c89['body'][_0x9bc2('0x43')];return _0xb78536;})['then'](saveUpdates(_0x2e4c89[_0x9bc2('0x65')],null))[_0x9bc2('0x29')](function(_0x1d35a9){if(!_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x43')])return _0x1d35a9;return db[_0x9bc2('0x46')][_0x9bc2('0x24')](_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x43')],{'where':{'MailAccountId':_0x1d35a9['id']}})[_0x9bc2('0x29')](function(){return _0x1d35a9;});})[_0x9bc2('0x29')](function(_0x30b927){if(!_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x44')])return _0x30b927;return db[_0x9bc2('0x47')][_0x9bc2('0x24')](_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x44')],{'where':{'MailAccountId':_0x30b927['id']}})[_0x9bc2('0x29')](function(){return _0x30b927;});})[_0x9bc2('0x29')](respondWithResult(_0x2cf8ae,null))[_0x9bc2('0x61')](handleError(_0x2cf8ae,null));};exports[_0x9bc2('0x69')]=function(_0x58d79d,_0x45fe99){return db[_0x9bc2('0x5d')][_0x9bc2('0x69')]()['then'](respondWithResult(_0x45fe99,null))['catch'](handleError(_0x45fe99,null));};exports[_0x9bc2('0x6a')]=function(_0x403c3f,_0x1a709b){if(_0x403c3f['body']['id']){delete _0x403c3f['body']['id'];}return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x403c3f['params']['id']}})['then'](handleEntityNotFound(_0x1a709b,null))[_0x9bc2('0x29')](function(_0x4c1070){if(_0x4c1070){_0x403c3f[_0x9bc2('0x65')][_0x9bc2('0x6b')]=_0x4c1070['id'];return db[_0x9bc2('0x6c')][_0x9bc2('0x6d')](_0x403c3f[_0x9bc2('0x65')]);}})[_0x9bc2('0x29')](respondWithResult(_0x1a709b,null))[_0x9bc2('0x61')](handleError(_0x1a709b,null));};exports[_0x9bc2('0x6e')]=function(_0x46ce84,_0x415043){var _0x2560b1={'raw':![],'where':{}};var _0x76959b={};var _0x488cb6={'count':0x0,'rows':[]};return db[_0x9bc2('0x5d')][_0x9bc2('0x6f')]({'where':{'id':_0x46ce84[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x415043,null))[_0x9bc2('0x29')](function(_0x409173){if(_0x409173){_0x76959b[_0x9bc2('0x4d')]=_[_0x9bc2('0x63')](db[_0x9bc2('0x6c')][_0x9bc2('0x4a')]);_0x76959b[_0x9bc2('0x4e')]=_['keys'](_0x46ce84['query']);_0x76959b[_0x9bc2('0x4f')]=_[_0x9bc2('0x50')](_0x76959b[_0x9bc2('0x4d')],_0x76959b[_0x9bc2('0x4e')]);_0x2560b1[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x76959b[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x46ce84[_0x9bc2('0x4e')]['fields']));_0x2560b1[_0x9bc2('0x51')]=_0x2560b1[_0x9bc2('0x51')][_0x9bc2('0x64')]?_0x2560b1[_0x9bc2('0x51')]:_0x76959b[_0x9bc2('0x4d')];if(!_0x46ce84['query']['hasOwnProperty']('nolimit')){_0x2560b1['limit']=qs['limit'](_0x46ce84['query'][_0x9bc2('0x21')]);_0x2560b1['offset']=qs['offset'](_0x46ce84[_0x9bc2('0x4e')]['offset']);}_0x2560b1[_0x9bc2('0x55')]=qs[_0x9bc2('0x56')](_0x46ce84[_0x9bc2('0x4e')][_0x9bc2('0x56')]);_0x2560b1[_0x9bc2('0x58')]=qs['filters'](_['pick'](_0x46ce84[_0x9bc2('0x4e')],_0x76959b[_0x9bc2('0x4f')]));_0x2560b1[_0x9bc2('0x58')]['MailAccountId']=_0x409173['id'];if(_0x46ce84[_0x9bc2('0x4e')]['filter']){_0x2560b1[_0x9bc2('0x58')]=_['merge'](_0x2560b1[_0x9bc2('0x58')],{'$or':_[_0x9bc2('0x49')](_0x2560b1[_0x9bc2('0x51')],function(_0x4317a3){var _0x47c3bb={};_0x47c3bb[_0x4317a3]={'$like':'%'+_0x46ce84[_0x9bc2('0x4e')]['filter']+'%'};return _0x47c3bb;})});}_0x2560b1=_['merge']({},_0x2560b1,_0x46ce84[_0x9bc2('0x5c')]);return db[_0x9bc2('0x6c')][_0x9bc2('0x20')]({'where':_0x2560b1[_0x9bc2('0x58')]})[_0x9bc2('0x29')](function(_0x4c0738){_0x488cb6[_0x9bc2('0x20')]=_0x4c0738;if(_0x46ce84[_0x9bc2('0x4e')]['includeAll']){_0x2560b1[_0x9bc2('0x5f')]=[{'all':!![]}];}return db[_0x9bc2('0x6c')][_0x9bc2('0x70')](_0x2560b1);})['then'](function(_0x118c7e){_0x488cb6[_0x9bc2('0x60')]=_0x118c7e;return _0x488cb6;});}})[_0x9bc2('0x29')](respondWithFilteredResult(_0x415043,_0x2560b1))[_0x9bc2('0x61')](handleError(_0x415043,null));};exports[_0x9bc2('0x71')]=function(_0x546d5f,_0x5268d2){return db[_0x9bc2('0x5d')]['find']({'where':{'id':_0x546d5f[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x5268d2,null))[_0x9bc2('0x29')](function(_0x591650){if(_0x591650){return _0x591650[_0x9bc2('0x71')](_0x546d5f[_0x9bc2('0x4e')][_0x9bc2('0x72')]);}})[_0x9bc2('0x29')](respondWithStatusCode(_0x5268d2,null))[_0x9bc2('0x61')](handleError(_0x5268d2,null));};exports[_0x9bc2('0x73')]=function(_0x500369,_0x4afeca){if(_0x500369[_0x9bc2('0x65')]['id']){delete _0x500369[_0x9bc2('0x65')]['id'];}return db[_0x9bc2('0x5d')]['find']({'where':{'id':_0x500369[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x4afeca,null))['then'](function(_0x13c880){if(_0x13c880){_0x500369['body'][_0x9bc2('0x6b')]=_0x13c880['id'];return db[_0x9bc2('0x74')][_0x9bc2('0x6d')](_0x500369['body']);}})['then'](respondWithResult(_0x4afeca,null))[_0x9bc2('0x61')](handleError(_0x4afeca,null));};exports[_0x9bc2('0x75')]=function(_0x929822,_0x4a3650){var _0x2eaec7={'raw':![],'where':{}};var _0x4625cb={};var _0x4bdeb5={'count':0x0,'rows':[]};return db[_0x9bc2('0x5d')]['findOne']({'where':{'id':_0x929822[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x4a3650,null))[_0x9bc2('0x29')](function(_0x5c75d0){if(_0x5c75d0){_0x4625cb[_0x9bc2('0x4d')]=_[_0x9bc2('0x63')](db[_0x9bc2('0x74')][_0x9bc2('0x4a')]);_0x4625cb['query']=_['keys'](_0x929822[_0x9bc2('0x4e')]);_0x4625cb['filters']=_['intersection'](_0x4625cb[_0x9bc2('0x4d')],_0x4625cb['query']);_0x2eaec7[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x4625cb[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x52')]));_0x2eaec7[_0x9bc2('0x51')]=_0x2eaec7[_0x9bc2('0x51')][_0x9bc2('0x64')]?_0x2eaec7['attributes']:_0x4625cb[_0x9bc2('0x4d')];if(!_0x929822[_0x9bc2('0x4e')]['hasOwnProperty'](_0x9bc2('0x54'))){_0x2eaec7[_0x9bc2('0x21')]=qs[_0x9bc2('0x21')](_0x929822['query'][_0x9bc2('0x21')]);_0x2eaec7[_0x9bc2('0x1e')]=qs[_0x9bc2('0x1e')](_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x1e')]);}_0x2eaec7[_0x9bc2('0x55')]=qs['sort'](_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x56')]);_0x2eaec7[_0x9bc2('0x58')]=qs[_0x9bc2('0x4f')](_[_0x9bc2('0x57')](_0x929822[_0x9bc2('0x4e')],_0x4625cb[_0x9bc2('0x4f')]));_0x2eaec7[_0x9bc2('0x58')][_0x9bc2('0x6b')]=_0x5c75d0['id'];if(_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x76')]){_0x2eaec7[_0x9bc2('0x58')]=_['merge'](_0x2eaec7[_0x9bc2('0x58')],{'$or':_[_0x9bc2('0x49')](_0x2eaec7['attributes'],function(_0x5a7c6b){var _0x144926={};_0x144926[_0x5a7c6b]={'$like':'%'+_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x76')]+'%'};return _0x144926;})});}_0x2eaec7=_[_0x9bc2('0x59')]({},_0x2eaec7,_0x929822[_0x9bc2('0x5c')]);return db[_0x9bc2('0x74')][_0x9bc2('0x20')]({'where':_0x2eaec7['where']})[_0x9bc2('0x29')](function(_0x2181df){_0x4bdeb5[_0x9bc2('0x20')]=_0x2181df;if(_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x5e')]){_0x2eaec7[_0x9bc2('0x5f')]=[{'all':!![]}];}return db[_0x9bc2('0x74')][_0x9bc2('0x70')](_0x2eaec7);})['then'](function(_0x3b8b7c){_0x4bdeb5[_0x9bc2('0x60')]=_0x3b8b7c;return _0x4bdeb5;});}})[_0x9bc2('0x29')](respondWithFilteredResult(_0x4a3650,_0x2eaec7))['catch'](handleError(_0x4a3650,null));};exports['removeAnswers']=function(_0x137316,_0x564224){return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x137316[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x564224,null))[_0x9bc2('0x29')](function(_0xdebe00){if(_0xdebe00){return _0xdebe00[_0x9bc2('0x77')](_0x137316[_0x9bc2('0x4e')][_0x9bc2('0x72')]);}})[_0x9bc2('0x29')](respondWithStatusCode(_0x564224,null))[_0x9bc2('0x61')](handleError(_0x564224,null));};exports[_0x9bc2('0x6d')]=function(_0x126c13,_0x49ef53){var _0x2b5577={'name':_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x5b')],'key':_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x4c')],'provider':_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x66')]===_0x9bc2('0x78')?null:_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x66')],'email':_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x79')],'ListId':_0x126c13[_0x9bc2('0x65')]['ListId'],'active':!_['isNil'](_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x7a')])?_0x126c13['body'][_0x9bc2('0x7a')]:!![],'description':_0x126c13['body'][_0x9bc2('0x7b')]||null};var _0x24cae8=getAuthenticationOptions(_0x2b5577[_0x9bc2('0x66')],_0x126c13[_0x9bc2('0x65')]);_0x2b5577['Imap']=_0x24cae8['Imap'];_0x2b5577[_0x9bc2('0x44')]=_0x24cae8['Smtp'];return db[_0x9bc2('0x5d')][_0x9bc2('0x6d')](_0x2b5577,{'include':[{'model':db[_0x9bc2('0x47')],'as':_0x9bc2('0x44')},{'model':db[_0x9bc2('0x46')],'as':_0x9bc2('0x43')}]})[_0x9bc2('0x29')](function(_0x65f36){var _0x591fd3=_0x126c13[_0x9bc2('0x38')][_0x9bc2('0x26')]({'plain':!![]});if(!_0x591fd3)throw new Error(_0x9bc2('0x7c'));if(_0x591fd3[_0x9bc2('0x7d')]===_0x9bc2('0x38')){var _0x2f6a0c=_0x65f36[_0x9bc2('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x9bc2('0x67')]({'where':{'name':'MailAccounts','userProfileId':_0x591fd3['userProfileId']},'raw':!![]})[_0x9bc2('0x29')](function(_0x5e2855){if(_0x5e2855&&_0x5e2855[_0x9bc2('0x7e')]===0x0){return db[_0x9bc2('0x28')][_0x9bc2('0x6d')]({'name':_0x2f6a0c['name'],'resourceId':_0x2f6a0c['id'],'type':_0x5e2855[_0x9bc2('0x5b')],'sectionId':_0x5e2855['id']},{})[_0x9bc2('0x29')](function(){return _0x65f36;});}else{return _0x65f36;}})['catch'](function(_0x27472f){logger[_0x9bc2('0x17')](_0x9bc2('0x7f'),_0x27472f);throw _0x27472f;});}return _0x65f36;})['then'](respondWithResult(_0x49ef53,0xc9))['catch'](handleError(_0x49ef53,null));};exports[_0x9bc2('0x80')]=function(_0x42ce50,_0x38822c){return db['MailAccount']['findOne']({'where':{'id':_0x42ce50['params']['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x38822c,null))[_0x9bc2('0x29')](function(_0x14734b){if(_0x14734b){return _0x14734b[_0x9bc2('0x80')]();}return null;})[_0x9bc2('0x29')](respondWithResult(_0x38822c,null))[_0x9bc2('0x61')](handleError(_0x38822c,null));};exports['addImap']=function(_0x51e4f8,_0x1a9160){if(_0x51e4f8[_0x9bc2('0x65')]['id']){delete _0x51e4f8[_0x9bc2('0x65')]['id'];}return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x51e4f8[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x1a9160,null))[_0x9bc2('0x29')](function(_0x51a84e){if(_0x51a84e){_0x51e4f8[_0x9bc2('0x65')]['MailAccountId']=_0x51a84e['id'];return db[_0x9bc2('0x46')][_0x9bc2('0x6d')](_0x51e4f8[_0x9bc2('0x65')]);}})[_0x9bc2('0x29')](respondWithResult(_0x1a9160,null))['catch'](handleError(_0x1a9160,null));};exports[_0x9bc2('0x81')]=function(_0x3e5cb6,_0x5386fe){return db['MailAccount'][_0x9bc2('0x6f')]({'where':{'id':_0x3e5cb6[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x5386fe,null))[_0x9bc2('0x29')](function(_0x2c00d4){if(_0x2c00d4){return _0x2c00d4['setImap'](null);}return null;})[_0x9bc2('0x29')](respondWithStatusCode(_0x5386fe,null))[_0x9bc2('0x61')](handleError(_0x5386fe,null));};exports[_0x9bc2('0x82')]=function(_0x120c39,_0xfed0b3){return db[_0x9bc2('0x5d')]['findOne']({'where':{'id':_0x120c39[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0xfed0b3,null))[_0x9bc2('0x29')](function(_0x46b731){if(_0x46b731){return _0x46b731[_0x9bc2('0x82')]();}return null;})[_0x9bc2('0x29')](respondWithResult(_0xfed0b3,null))[_0x9bc2('0x61')](handleError(_0xfed0b3,null));};exports[_0x9bc2('0x83')]=function(_0x243fef,_0x1f23e4){if(_0x243fef[_0x9bc2('0x65')]['id']){delete _0x243fef[_0x9bc2('0x65')]['id'];}return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x243fef['params']['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x1f23e4,null))[_0x9bc2('0x29')](function(_0x5acf35){if(_0x5acf35){_0x243fef['body']['MailAccountId']=_0x5acf35['id'];return db[_0x9bc2('0x47')][_0x9bc2('0x6d')](_0x243fef[_0x9bc2('0x65')]);}})[_0x9bc2('0x29')](respondWithResult(_0x1f23e4,null))[_0x9bc2('0x61')](handleError(_0x1f23e4,null));};exports[_0x9bc2('0x84')]=function(_0x289fbf,_0x3a2f5b){return db[_0x9bc2('0x5d')][_0x9bc2('0x6f')]({'where':{'id':_0x289fbf[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x3a2f5b,null))[_0x9bc2('0x29')](function(_0x148aa){if(_0x148aa){return _0x148aa[_0x9bc2('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x3a2f5b,null))[_0x9bc2('0x61')](handleError(_0x3a2f5b,null));};exports[_0x9bc2('0x86')]=function(_0x11ebfd,_0x972250){return db[_0x9bc2('0x87')][_0x9bc2('0x67')]({'where':{'id':_0x11ebfd[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x972250,null))[_0x9bc2('0x29')](function(_0x47310a){if(_0x47310a){return _0x47310a[_0x9bc2('0x86')](_0x11ebfd[_0x9bc2('0x65')][_0x9bc2('0x72')],_[_0x9bc2('0x88')](_0x11ebfd[_0x9bc2('0x65')],[_0x9bc2('0x72'),'id'])||{});}})['then'](respondWithResult(_0x972250,null))['catch'](handleError(_0x972250,null));};exports['getInteractions']=function(_0x1eb5d2,_0x32975b){var _0x1022a0={'raw':![],'where':{}};var _0x1acad2={};var _0x1e5371={'count':0x0,'rows':[]};return db[_0x9bc2('0x5d')][_0x9bc2('0x6f')]({'where':{'id':_0x1eb5d2['params']['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x32975b,null))['then'](function(_0x4005a8){if(_0x4005a8){_0x1acad2[_0x9bc2('0x4d')]=_[_0x9bc2('0x63')](db['MailInteraction'][_0x9bc2('0x4a')]);_0x1acad2['query']=_[_0x9bc2('0x63')](_0x1eb5d2[_0x9bc2('0x4e')]);_0x1acad2[_0x9bc2('0x4f')]=_[_0x9bc2('0x50')](_0x1acad2[_0x9bc2('0x4d')],_0x1acad2[_0x9bc2('0x4e')]);_0x1022a0[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x1acad2[_0x9bc2('0x4d')],qs['fields'](_0x1eb5d2[_0x9bc2('0x4e')]['fields']));_0x1022a0[_0x9bc2('0x51')]=_0x1022a0[_0x9bc2('0x51')]['length']?_0x1022a0[_0x9bc2('0x51')]:_0x1acad2[_0x9bc2('0x4d')];if(!_0x1eb5d2[_0x9bc2('0x4e')]['hasOwnProperty'](_0x9bc2('0x54'))){_0x1022a0['limit']=qs[_0x9bc2('0x21')](_0x1eb5d2['query'][_0x9bc2('0x21')]);_0x1022a0['offset']=qs[_0x9bc2('0x1e')](_0x1eb5d2[_0x9bc2('0x4e')][_0x9bc2('0x1e')]);}_0x1022a0[_0x9bc2('0x55')]=qs[_0x9bc2('0x56')](_0x1eb5d2[_0x9bc2('0x4e')]['sort']);_0x1022a0[_0x9bc2('0x58')]=qs[_0x9bc2('0x4f')](_[_0x9bc2('0x57')](_0x1eb5d2[_0x9bc2('0x4e')],_0x1acad2[_0x9bc2('0x4f')]));_0x1022a0[_0x9bc2('0x58')][_0x9bc2('0x6b')]=_0x4005a8['id'];if(_0x1eb5d2[_0x9bc2('0x4e')][_0x9bc2('0x76')]){_0x1022a0[_0x9bc2('0x58')]=_['merge'](_0x1022a0[_0x9bc2('0x58')],{'$or':_[_0x9bc2('0x49')](_0x1022a0[_0x9bc2('0x51')],function(_0x31b51a){var _0x18e1c7={};_0x18e1c7[_0x31b51a]={'$like':'%'+_0x1eb5d2['query'][_0x9bc2('0x76')]+'%'};return _0x18e1c7;})});}_0x1022a0=_[_0x9bc2('0x59')]({},_0x1022a0,_0x1eb5d2[_0x9bc2('0x5c')]);return db[_0x9bc2('0x87')][_0x9bc2('0x20')]({'where':_0x1022a0[_0x9bc2('0x58')]})[_0x9bc2('0x29')](function(_0x37b6eb){_0x1e5371[_0x9bc2('0x20')]=_0x37b6eb;if(_0x1eb5d2['query'][_0x9bc2('0x5e')]){_0x1022a0[_0x9bc2('0x5f')]=[{'model':db[_0x9bc2('0x89')],'as':'Contact','required':![]},{'model':db[_0x9bc2('0x8a')],'as':'Owner','attributes':[_0x9bc2('0x5b'),_0x9bc2('0x8b'),_0x9bc2('0x8c')],'required':![]},{'model':db[_0x9bc2('0x8d')],'as':_0x9bc2('0x8e'),'attributes':['id',_0x9bc2('0x5b'),_0x9bc2('0x8f')],'where':_0x1eb5d2['query'][_0x9bc2('0x90')]?{'id':_0x1eb5d2[_0x9bc2('0x4e')]['tag']}:undefined,'required':_0x1eb5d2[_0x9bc2('0x4e')][_0x9bc2('0x90')]?!![]:![]}];}return db[_0x9bc2('0x87')]['findAll'](_0x1022a0);})[_0x9bc2('0x29')](function(_0x43ffe3){_0x1e5371['rows']=_0x43ffe3;return _0x1e5371;});}})[_0x9bc2('0x29')](respondWithFilteredResult(_0x32975b,_0x1022a0))['catch'](handleError(_0x32975b,null));};exports['addApplications']=function addApplications(_0x2a4aa2,_0x1856c4){var _0x142bc9=_0x2a4aa2[_0x9bc2('0x68')]['id'];var _0x12190e=_0x2a4aa2['body'];var _0x119201=0xc8;var _0x31e21d=null;return db[_0x9bc2('0x91')][_0x9bc2('0x92')]({'isolationLevel':db[_0x9bc2('0x91')][_0x9bc2('0x93')]['ISOLATION_LEVELS'][_0x9bc2('0x94')]},function(_0x2b2d5b){return db[_0x9bc2('0x5d')][_0x9bc2('0x6f')]({'where':{'id':_0x142bc9},'transaction':_0x2b2d5b})[_0x9bc2('0x29')](function(_0x43936a){if(_0x43936a){return db[_0x9bc2('0x95')][_0x9bc2('0x25')]({'where':{'MailAccountId':_0x142bc9},'transaction':_0x2b2d5b})[_0x9bc2('0x29')](function(){var _0x2cf766=_[_0x9bc2('0x49')](_0x12190e,function(_0x4146b4){_0x4146b4['MailAccountId']=_0x142bc9;return _0x4146b4;});return db[_0x9bc2('0x95')][_0x9bc2('0x96')](_0x2cf766,{'transaction':_0x2b2d5b});});}else{_0x119201=0x194;_0x31e21d=[];}});})[_0x9bc2('0x29')](function(){if(_0x119201!==0x194){return db[_0x9bc2('0x95')][_0x9bc2('0x97')]({'where':{'MailAccountId':_0x142bc9},'order':_0x9bc2('0x98')})[_0x9bc2('0x29')](function(_0x39d500){_0x31e21d=_0x39d500;});}})[_0x9bc2('0x61')](function(_0xa05297){_0x119201=0x1f4;logger[_0x9bc2('0x17')](_0xa05297[_0x9bc2('0x2a')]);if(_0xa05297[_0x9bc2('0x5b')]){delete _0xa05297['name'];}_0x31e21d=_0xa05297;})[_0x9bc2('0x99')](function(){if(_0x31e21d===null){_0x1856c4[_0x9bc2('0x1b')](_0x119201);}else{if(_0x119201===0x1f4){_0x1856c4[_0x9bc2('0x1c')](_0x119201)[_0x9bc2('0x2b')](_0x31e21d);}else{_0x1856c4[_0x9bc2('0x1c')](_0x119201)[_0x9bc2('0x1d')](_0x31e21d);}}});};exports[_0x9bc2('0x9a')]=function(_0x30ad78,_0x3626f8){var _0x183e92={};var _0x1fb452={};var _0x366237;var _0x39f238;return db[_0x9bc2('0x5d')][_0x9bc2('0x6f')]({'where':{'id':_0x30ad78[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x3626f8,null))[_0x9bc2('0x29')](function(_0x217dde){if(_0x217dde){_0x366237=_0x217dde;_0x1fb452[_0x9bc2('0x4d')]=_['keys'](db[_0x9bc2('0x95')][_0x9bc2('0x4a')]);_0x1fb452['query']=_[_0x9bc2('0x63')](_0x30ad78[_0x9bc2('0x4e')]);_0x1fb452[_0x9bc2('0x4f')]=_['intersection'](_0x1fb452[_0x9bc2('0x4d')],_0x1fb452[_0x9bc2('0x4e')]);_0x183e92[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x1fb452['model'],qs['fields'](_0x30ad78['query'][_0x9bc2('0x52')]));_0x183e92[_0x9bc2('0x51')]=_0x183e92[_0x9bc2('0x51')][_0x9bc2('0x64')]?_0x183e92['attributes']:_0x1fb452[_0x9bc2('0x4d')];_0x183e92['order']=qs['sort'](_0x30ad78[_0x9bc2('0x4e')][_0x9bc2('0x56')]);_0x183e92[_0x9bc2('0x58')]=qs[_0x9bc2('0x4f')](_[_0x9bc2('0x57')](_0x30ad78[_0x9bc2('0x4e')],_0x1fb452[_0x9bc2('0x4f')]));if(_0x30ad78[_0x9bc2('0x4e')][_0x9bc2('0x76')]){_0x183e92[_0x9bc2('0x58')]=_[_0x9bc2('0x59')](_0x183e92[_0x9bc2('0x58')],{'$or':_['map'](_0x183e92[_0x9bc2('0x51')],function(_0x4113b4){var _0x400adc={};_0x400adc[_0x4113b4]={'$like':'%'+_0x30ad78[_0x9bc2('0x4e')][_0x9bc2('0x76')]+'%'};return _0x400adc;})});}_0x183e92=_[_0x9bc2('0x59')]({},_0x183e92,_0x30ad78[_0x9bc2('0x5c')]);return _0x366237[_0x9bc2('0x9a')](_0x183e92);}})[_0x9bc2('0x29')](function(_0x37724e){if(_0x37724e){_0x39f238=_0x37724e[_0x9bc2('0x64')];if(!_0x30ad78['query'][_0x9bc2('0x53')]('nolimit')){_0x183e92['limit']=qs[_0x9bc2('0x21')](_0x30ad78[_0x9bc2('0x4e')][_0x9bc2('0x21')]);_0x183e92['offset']=qs['offset'](_0x30ad78[_0x9bc2('0x4e')][_0x9bc2('0x1e')]);}return _0x366237['getApplications'](_0x183e92);}})['then'](function(_0x5c6327){if(_0x5c6327){return _0x5c6327?{'count':_0x39f238,'rows':_0x5c6327}:null;}})[_0x9bc2('0x29')](respondWithResult(_0x3626f8,null))[_0x9bc2('0x61')](handleError(_0x3626f8,null));};exports[_0x9bc2('0x9b')]=function(_0x230cd2,_0x20cea3){var _0x2b96b0={'raw':!![],'where':{}};var _0x2e503d={};var _0x50d173={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x230cd2[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x20cea3,null))['then'](function(_0x347edc){if(_0x347edc){_0x2e503d['model']=_['keys'](db['MailMessage'][_0x9bc2('0x4a')]);_0x2e503d[_0x9bc2('0x4e')]=_['keys'](_0x230cd2[_0x9bc2('0x4e')]);_0x2e503d[_0x9bc2('0x4f')]=_[_0x9bc2('0x50')](_0x2e503d[_0x9bc2('0x4d')],_0x2e503d[_0x9bc2('0x4e')]);_0x2b96b0['attributes']=_[_0x9bc2('0x50')](_0x2e503d[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x52')]));_0x2b96b0[_0x9bc2('0x51')]=_0x2b96b0['attributes'][_0x9bc2('0x64')]?_0x2b96b0[_0x9bc2('0x51')]:_0x2e503d[_0x9bc2('0x4d')];if(!_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x53')](_0x9bc2('0x54'))){_0x2b96b0['limit']=qs[_0x9bc2('0x21')](_0x230cd2[_0x9bc2('0x4e')]['limit']);_0x2b96b0[_0x9bc2('0x1e')]=qs[_0x9bc2('0x1e')](_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x1e')]);}_0x2b96b0[_0x9bc2('0x55')]=qs['sort'](_0x230cd2[_0x9bc2('0x4e')]['sort']);_0x2b96b0[_0x9bc2('0x58')]=qs[_0x9bc2('0x4f')](_[_0x9bc2('0x57')](_0x230cd2[_0x9bc2('0x4e')],_0x2e503d[_0x9bc2('0x4f')]));_0x2b96b0['where'][_0x9bc2('0x6b')]=_0x347edc['id'];if(_0x230cd2[_0x9bc2('0x4e')]['filter']){_0x2b96b0[_0x9bc2('0x58')]=_[_0x9bc2('0x59')](_0x2b96b0['where'],{'$or':_[_0x9bc2('0x49')](_0x2b96b0['attributes'],function(_0x1a17c7){var _0x18adf4={};_0x18adf4[_0x1a17c7]={'$like':'%'+_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x76')]+'%'};return _0x18adf4;})});}if(_0x230cd2[_0x9bc2('0x4e')]['$gte']){var _0x45b50f=_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x9c')][_0x9bc2('0x9d')](',');var _0xbd0b7b={};_0xbd0b7b[_0x45b50f[0x0]]={'$gte':moment(_0x45b50f[0x1])[_0x9bc2('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2b96b0['where']=_[_0x9bc2('0x59')](_0x2b96b0[_0x9bc2('0x58')],_0xbd0b7b);}_0x2b96b0=_['merge']({},_0x2b96b0,_0x230cd2[_0x9bc2('0x5c')]);return db[_0x9bc2('0x9f')][_0x9bc2('0x20')]({'where':_0x2b96b0[_0x9bc2('0x58')]})[_0x9bc2('0x29')](function(_0x19829b){_0x50d173[_0x9bc2('0x20')]=_0x19829b;if(_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x5e')]){_0x2b96b0[_0x9bc2('0x5f')]=[{'all':!![]}];}return db[_0x9bc2('0x9f')][_0x9bc2('0x70')](_0x2b96b0);})[_0x9bc2('0x29')](function(_0x237781){if(_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0xa0')]===_0x9bc2('0xa1')){for(var _0x52a27a=0x0;_0x52a27a<_0x237781[_0x9bc2('0x64')];_0x52a27a++){_0x237781[_0x52a27a][_0x9bc2('0x65')]=juice(_0x237781[_0x52a27a]['body']);}}_0x50d173[_0x9bc2('0x60')]=_0x237781;return _0x50d173;});}})[_0x9bc2('0x29')](respondWithFilteredResult(_0x20cea3,_0x2b96b0))['catch'](handleError(_0x20cea3,null));};exports['send']=function(_0x28288c,_0x3e4768){var _0x3efe91,_0x541a90={},_0x316787;if(_0x28288c['body']['to']){_0x316787=_0x28288c['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x9bc2('0x67')]({'where':{'id':_0x28288c[_0x9bc2('0x68')]['id']},'include':[{'model':db[_0x9bc2('0xa2')],'as':_0x9bc2('0xa3'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x316787},'limit':0x1,'order':[[_0x9bc2('0xa4'),_0x9bc2('0xa5')]]}]},{'model':db[_0x9bc2('0x47')],'as':_0x9bc2('0x44'),'raw':!![],'include':[{'model':db[_0x9bc2('0xa6')],'as':_0x9bc2('0xa6'),'raw':!![]}]}]})[_0x9bc2('0x29')](handleEntityNotFound(_0x3e4768,null))[_0x9bc2('0x29')](function(_0x4cb5be){if(!_0x4cb5be)return;_0x3efe91=_0x4cb5be;if(!_0x4cb5be[_0x9bc2('0x44')])throw new Error(_0x9bc2('0xa7'));if(_[_0x9bc2('0xa8')](_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xa9')])){_0x28288c['body'][_0x9bc2('0xa9')]=util[_0x9bc2('0x9e')](_0x9bc2('0xaa'),_0x4cb5be[_0x9bc2('0x5b')],_0x4cb5be[_0x9bc2('0x79')]||_0x4cb5be[_0x9bc2('0x44')][_0x9bc2('0x38')]);}if(_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xab')]&&_0x28288c['body'][_0x9bc2('0xab')][_0x9bc2('0x64')]){for(var _0x5d799c=0x0;_0x5d799c<_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xab')][_0x9bc2('0x64')];_0x5d799c+=0x1){_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xab')][_0x5d799c]={'filename':_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xab')][_0x5d799c]['name'],'path':path[_0x9bc2('0xac')](config[_0x9bc2('0xad')],'server/files/attachments',_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xab')][_0x5d799c][_0x9bc2('0xae')])};}}var _0x1b69d7=_0x4cb5be[_0x9bc2('0xaf')]();return respondWithRpcPromise(_0x9bc2('0xb0'),_0x9bc2('0xb1'),{'account':_0x1b69d7,'message':_0x28288c[_0x9bc2('0x65')]});})[_0x9bc2('0x29')](function(_0x1021e7){if(!_0x1021e7)return;_0x541a90=_0x1021e7;if(!_0x3efe91[_0x9bc2('0xa3')])throw new Error(_0x9bc2('0xb2'));if(_0x3efe91[_0x9bc2('0xa3')][_0x9bc2('0xb3')][_0x9bc2('0x64')])return _0x3efe91[_0x9bc2('0xa3')]['Contacts'][0x0];return db[_0x9bc2('0x89')][_0x9bc2('0x6d')](_[_0x9bc2('0xa')](_0x28288c[_0x9bc2('0x65')],{'firstName':_0x28288c[_0x9bc2('0x65')]['to'],'email':_0x28288c[_0x9bc2('0x65')]['to'],'phone':_0x28288c[_0x9bc2('0x65')]['to'],'ListId':_0x3efe91[_0x9bc2('0xb4')]}));})[_0x9bc2('0x29')](function(_0x872c7e){if(!_0x872c7e)return;var _0x5cd338={'UserId':_0x28288c['user']['id'],'ContactId':_0x872c7e['id'],'MailAccountId':_0x3efe91['id'],'inReplyTo':_0x541a90['messageId'],'to':_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xa9')],'cc':_0x28288c['body']['cc'],'subject':_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xb5')],'attach':_0x28288c[_0x9bc2('0x65')]['attach'],'firstMsgDirection':_0x9bc2('0xb6'),'lastMsgAt':moment()['format'](_0x9bc2('0xb7')),'lastMsgDirection':_0x9bc2('0xb6'),'Messages':[_['merge'](_0x28288c['body'],{'messageId':_0x541a90[_0x9bc2('0xb8')],'sentAt':moment()[_0x9bc2('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3efe91['id'],'UserId':_0x28288c['user']['id'],'ContactId':_0x872c7e['id']})]};if(_0x28288c['body'][_0x9bc2('0xb9')]){_0x5cd338=_['merge'](_0x5cd338,_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xb9')]);}return db[_0x9bc2('0x87')]['create'](_0x5cd338,{'include':[{'model':db[_0x9bc2('0x9f')],'as':'Messages'}]});})['then'](respondWithResult(_0x3e4768,null))[_0x9bc2('0x61')](handleError(_0x3e4768,null));};exports[_0x9bc2('0xba')]=function(_0x51b189,_0x29ed82){return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x51b189[_0x9bc2('0x68')]['id']},'include':[{'model':db[_0x9bc2('0x47')],'as':_0x9bc2('0x44'),'raw':!![],'include':[{'model':db[_0x9bc2('0xa6')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x29ed82,null))[_0x9bc2('0x29')](function(_0x3fdc07){if(!_0x3fdc07[_0x9bc2('0x44')])return;var _0x5b939a=_0x3fdc07[_0x9bc2('0xaf')]();return respondWithRpcPromise(_0x9bc2('0xbb'),_0x9bc2('0xba'),{'account':_0x5b939a});})[_0x9bc2('0x29')](respondWithResult(_0x29ed82,null))[_0x9bc2('0x61')](handleError(_0x29ed82,null));};exports['destroy']=function(_0x3b5f51,_0x2ba1c9){return db['MailAccount'][_0x9bc2('0x67')]({'where':{'id':_0x3b5f51[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x2ba1c9,null))[_0x9bc2('0x29')](function(_0xc6642d){if(_0xc6642d&&_0xc6642d[_0x9bc2('0x40')]){throw new db[(_0x9bc2('0xbc'))][(_0x9bc2('0xbd'))](_0x9bc2('0xbe'));}return _0xc6642d;})['then'](removeEntity(_0x2ba1c9,null))[_0x9bc2('0x61')](handleError(_0x2ba1c9,null));};exports['addAgents']=function(_0x135cfe,_0x205aed){return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x135cfe[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x205aed,null))[_0x9bc2('0x29')](function(_0x2df765){if(_0x2df765){return _0x2df765['addAgents'](_0x135cfe[_0x9bc2('0x65')]['ids'],_['omit'](_0x135cfe[_0x9bc2('0x65')],[_0x9bc2('0x72'),'id'])||{})[_0x9bc2('0xbf')](function(_0x106ac2){for(var _0xd355d0=0x0;_0xd355d0<_0x135cfe[_0x9bc2('0x65')]['ids'][_0x9bc2('0x64')];_0xd355d0+=0x1){socket[_0x9bc2('0xc0')](_0x9bc2('0xc1'),{'UserId':Number(_0x135cfe['body'][_0x9bc2('0x72')][_0xd355d0]),'MailAccountId':Number(_0x135cfe['params']['id'])});}return _0x106ac2;});}})[_0x9bc2('0x29')](respondWithResult(_0x205aed,null))[_0x9bc2('0x61')](handleError(_0x205aed,null));};exports[_0x9bc2('0xc2')]=function(_0x2d8d56,_0x49d031){return db[_0x9bc2('0x5d')]['find']({'where':{'id':_0x2d8d56[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x49d031,null))[_0x9bc2('0x29')](function(_0x1a325b){if(_0x1a325b){return _0x1a325b[_0x9bc2('0xc2')](_0x2d8d56[_0x9bc2('0x4e')][_0x9bc2('0x72')])[_0x9bc2('0x29')](function(){if(_[_0x9bc2('0xc3')](_0x2d8d56[_0x9bc2('0x4e')][_0x9bc2('0x72')])){for(var _0x2fc6c1=0x0;_0x2fc6c1<_0x2d8d56[_0x9bc2('0x4e')]['ids'][_0x9bc2('0x64')];_0x2fc6c1+=0x1){socket[_0x9bc2('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x2d8d56[_0x9bc2('0x4e')][_0x9bc2('0x72')][_0x2fc6c1]),'MailAccountId':Number(_0x2d8d56['params']['id'])});}}else{socket[_0x9bc2('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x2d8d56[_0x9bc2('0x4e')][_0x9bc2('0x72')]),'MailAccountId':Number(_0x2d8d56[_0x9bc2('0x68')]['id'])});}});}})[_0x9bc2('0x29')](respondWithStatusCode(_0x49d031,null))['catch'](handleError(_0x49d031,null));};exports['getAgents']=function(_0x40199a,_0x26457a){var _0x28a074={};var _0x3a7282={};var _0x3b0684;var _0x2269bd;return db[_0x9bc2('0x5d')]['findOne']({'where':{'id':_0x40199a['params']['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x26457a,null))[_0x9bc2('0x29')](function(_0x300068){if(_0x300068){_0x3b0684=_0x300068;_0x3a7282[_0x9bc2('0x4d')]=_[_0x9bc2('0x63')](db[_0x9bc2('0x8a')]['rawAttributes']);_0x3a7282[_0x9bc2('0x4e')]=_[_0x9bc2('0x63')](_0x40199a['query']);_0x3a7282['filters']=_['intersection'](_0x3a7282['model'],_0x3a7282['query']);_0x28a074[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x3a7282[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x40199a[_0x9bc2('0x4e')][_0x9bc2('0x52')]));_0x28a074[_0x9bc2('0x51')]=_0x28a074[_0x9bc2('0x51')]['length']?_0x28a074[_0x9bc2('0x51')]:_0x3a7282[_0x9bc2('0x4d')];_0x28a074[_0x9bc2('0x55')]=qs[_0x9bc2('0x56')](_0x40199a['query']['sort']);_0x28a074[_0x9bc2('0x58')]=qs['filters'](_[_0x9bc2('0x57')](_0x40199a[_0x9bc2('0x4e')],_0x3a7282[_0x9bc2('0x4f')]));if(_0x40199a[_0x9bc2('0x4e')][_0x9bc2('0x76')]){_0x28a074[_0x9bc2('0x58')]=_[_0x9bc2('0x59')](_0x28a074[_0x9bc2('0x58')],{'$or':_[_0x9bc2('0x49')](_0x28a074[_0x9bc2('0x51')],function(_0x3d070e){var _0x4cd275={};_0x4cd275[_0x3d070e]={'$like':'%'+_0x40199a[_0x9bc2('0x4e')][_0x9bc2('0x76')]+'%'};return _0x4cd275;})});}_0x28a074=_[_0x9bc2('0x59')]({},_0x28a074,_0x40199a[_0x9bc2('0x5c')]);return _0x3b0684[_0x9bc2('0xc4')](_0x28a074);}})['then'](function(_0x47aac1){if(_0x47aac1){_0x2269bd=_0x47aac1[_0x9bc2('0x64')];if(!_0x40199a[_0x9bc2('0x4e')]['hasOwnProperty'](_0x9bc2('0x54'))){_0x28a074[_0x9bc2('0x21')]=qs['limit'](_0x40199a[_0x9bc2('0x4e')][_0x9bc2('0x21')]);_0x28a074[_0x9bc2('0x1e')]=qs[_0x9bc2('0x1e')](_0x40199a[_0x9bc2('0x4e')][_0x9bc2('0x1e')]);}return _0x3b0684[_0x9bc2('0xc4')](_0x28a074);}})['then'](function(_0x12faf0){if(_0x12faf0){return _0x12faf0?{'count':_0x2269bd,'rows':_0x12faf0}:null;}})['then'](respondWithResult(_0x26457a,null))[_0x9bc2('0x61')](handleError(_0x26457a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3a9ebb6..a8ea9ee 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 _0x57ca=['hasOwnProperty','hook','exports','../../mysqldb','MailAccount','save','update','remove','emit'];(function(_0x206e2a,_0x4f1370){var _0x542326=function(_0x552789){while(--_0x552789){_0x206e2a['push'](_0x206e2a['shift']());}};_0x542326(++_0x4f1370);}(_0x57ca,0x108));var _0xa57c=function(_0x285027,_0x58d608){_0x285027=_0x285027-0x0;var _0x41a0a6=_0x57ca[_0x285027];return _0x41a0a6;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xa57c('0x0'))['db'][_0xa57c('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa57c('0x2'),'afterUpdate':_0xa57c('0x3'),'afterDestroy':_0xa57c('0x4')};function emitEvent(_0x15e330){return function(_0x1da469,_0x48be2d,_0x40ba22){MailAccountEvents[_0xa57c('0x5')](_0x15e330+':'+_0x1da469['id'],_0x1da469);MailAccountEvents[_0xa57c('0x5')](_0x15e330,_0x1da469);_0x40ba22(null);};}for(var e in events){if(events[_0xa57c('0x6')](e)){var event=events[e];MailAccount[_0xa57c('0x7')](e,emitEvent(event));}}module[_0xa57c('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xac41=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x327455,_0x12e7fa){var _0x38885d=function(_0x523445){while(--_0x523445){_0x327455['push'](_0x327455['shift']());}};_0x38885d(++_0x12e7fa);}(_0xac41,0xdd));var _0x1ac4=function(_0x39ef42,_0x2741e4){_0x39ef42=_0x39ef42-0x0;var _0x20cad9=_0xac41[_0x39ef42];return _0x20cad9;};'use strict';var EventEmitter=require(_0x1ac4('0x0'));var MailAccount=require(_0x1ac4('0x1'))['db'][_0x1ac4('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1ac4('0x3')](0x0);var events={'afterCreate':_0x1ac4('0x4'),'afterUpdate':_0x1ac4('0x5'),'afterDestroy':_0x1ac4('0x6')};function emitEvent(_0x3a1763){return function(_0x54386c,_0x2c33d6,_0x216c0d){MailAccountEvents[_0x1ac4('0x7')](_0x3a1763+':'+_0x54386c['id'],_0x54386c);MailAccountEvents[_0x1ac4('0x7')](_0x3a1763,_0x54386c);_0x216c0d(null);};}for(var e in events){if(events[_0x1ac4('0x8')](e)){var event=events[e];MailAccount[_0x1ac4('0x9')](e,emitEvent(event));}}module[_0x1ac4('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 84328ea..17d260f 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 _0xd98f=['custom','service','host','Smtp','port','secure','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider'];(function(_0x250b26,_0x132e93){var _0xd731de=function(_0x20e93e){while(--_0x20e93e){_0x250b26['push'](_0x250b26['shift']());}};_0xd731de(++_0x132e93);}(_0xd98f,0x13d));var _0xfd98=function(_0x4a07ac,_0x35c7cb){_0x4a07ac=_0x4a07ac-0x0;var _0x29a4ad=_0xd98f[_0x4a07ac];return _0x29a4ad;};'use strict';var attributes=require(_0xfd98('0x0'));module[_0xfd98('0x1')]=function(_0x2c9689){return _0x2c9689[_0xfd98('0x2')](_0xfd98('0x3'),attributes,{'tableName':_0xfd98('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x40793f=this;var _0x45d528={'id':_0x40793f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x40793f[_0xfd98('0x5')]!==_0xfd98('0x6')){_0x45d528[_0xfd98('0x7')]=_0x40793f[_0xfd98('0x5')];}else{_0x45d528[_0xfd98('0x8')]=_0x40793f[_0xfd98('0x9')]['host'];_0x45d528[_0xfd98('0xa')]=_0x40793f[_0xfd98('0x9')][_0xfd98('0xa')];_0x45d528['secure']=_0x40793f[_0xfd98('0x9')][_0xfd98('0xb')];}if(_0x40793f[_0xfd98('0x9')]['authentication']){if(_0x40793f[_0xfd98('0x9')]['modernAuthentication']){if(!_0x40793f[_0xfd98('0x9')][_0xfd98('0xc')])throw new Error(_0xfd98('0xd'));_0x45d528[_0xfd98('0xe')]={'type':_0xfd98('0xf'),'user':_0x40793f[_0xfd98('0x9')][_0xfd98('0x10')],'accessToken':_0x40793f['Smtp'][_0xfd98('0xc')][_0xfd98('0x11')]};}else{_0x45d528[_0xfd98('0xe')]={'user':_0x40793f[_0xfd98('0x9')][_0xfd98('0x10')],'pass':_0x40793f[_0xfd98('0x9')][_0xfd98('0x12')]};}}return _0x45d528;}}});}; \ No newline at end of file +var _0x4e67=['define','MailAccount','provider','service','host','port','Smtp','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','CloudProvider','data5','auth','./mailAccount.attributes','exports'];(function(_0x228da4,_0x545ae8){var _0x86a145=function(_0x4dbc48){while(--_0x4dbc48){_0x228da4['push'](_0x228da4['shift']());}};_0x86a145(++_0x545ae8);}(_0x4e67,0x6a));var _0x74e6=function(_0x196e1b,_0x55fa06){_0x196e1b=_0x196e1b-0x0;var _0x5e1f18=_0x4e67[_0x196e1b];return _0x5e1f18;};'use strict';var attributes=require(_0x74e6('0x0'));module[_0x74e6('0x1')]=function(_0x34ba36){return _0x34ba36[_0x74e6('0x2')](_0x74e6('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1fafb3=this;var _0x23c686={'id':_0x1fafb3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1fafb3[_0x74e6('0x4')]!=='custom'){_0x23c686[_0x74e6('0x5')]=_0x1fafb3[_0x74e6('0x4')];}else{_0x23c686[_0x74e6('0x6')]=_0x1fafb3['Smtp'][_0x74e6('0x6')];_0x23c686[_0x74e6('0x7')]=_0x1fafb3[_0x74e6('0x8')]['port'];_0x23c686[_0x74e6('0x9')]=_0x1fafb3[_0x74e6('0x8')][_0x74e6('0x9')];}if(_0x1fafb3['Smtp'][_0x74e6('0xa')]){if(_0x1fafb3['Smtp'][_0x74e6('0xb')]){if(!_0x1fafb3[_0x74e6('0x8')]['CloudProvider'])throw new Error(_0x74e6('0xc'));_0x23c686['auth']={'type':_0x74e6('0xd'),'user':_0x1fafb3[_0x74e6('0x8')][_0x74e6('0xe')],'accessToken':_0x1fafb3[_0x74e6('0x8')][_0x74e6('0xf')][_0x74e6('0x10')]};}else{_0x23c686[_0x74e6('0x11')]={'user':_0x1fafb3[_0x74e6('0x8')][_0x74e6('0xe')],'pass':_0x1fafb3[_0x74e6('0x8')]['pass']};}}return _0x23c686;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f130c66..4548b4f 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 _0x2ef3=['result','catch','MailAccount','findAll','options','attributes','limit','model','include','map','GetMailAccount','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','generate','attach','MailInteraction','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x15953e,_0x537be1){var _0x2117fc=function(_0x1718f1){while(--_0x1718f1){_0x15953e['push'](_0x15953e['shift']());}};_0x2117fc(++_0x537be1);}(_0x2ef3,0xba));var _0x32ef=function(_0x27b29e,_0x2b4d31){_0x27b29e=_0x27b29e-0x0;var _0x1c45ab=_0x2ef3[_0x27b29e];return _0x1c45ab;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var rs=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var db=require(_0x32ef('0x5'))['db'];var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x8')][_0x32ef('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x32ef('0xa')],{'host':_0x32ef('0xb'),'port':0x18eb});var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xd'))[_0x32ef('0xe')](socket);function respondWithRpcPromise(_0x2484a0,_0x2bbb50,_0x28275c){return new BPromise(function(_0x77df79,_0x56eb42){return client['request'](_0x2484a0,_0x28275c)[_0x32ef('0xf')](function(_0x33281d){logger[_0x32ef('0x10')](_0x32ef('0x11'),_0x2bbb50,'request\x20sent');logger[_0x32ef('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2bbb50,_0x32ef('0x13'),JSON['stringify'](_0x33281d));if(_0x33281d[_0x32ef('0x14')]){if(_0x33281d[_0x32ef('0x14')]['code']===0x1f4){logger['error'](_0x32ef('0x11'),_0x2bbb50,_0x33281d['error'][_0x32ef('0x15')]);return _0x56eb42(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}logger[_0x32ef('0x14')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,_0x33281d['error']['message']);return _0x77df79(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}else{logger[_0x32ef('0x10')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,'request\x20sent');_0x77df79(_0x33281d[_0x32ef('0x16')][_0x32ef('0x15')]);}})[_0x32ef('0x17')](function(_0x57863c){logger[_0x32ef('0x14')](_0x32ef('0x11'),_0x2bbb50,_0x57863c);_0x56eb42(_0x57863c);});});}exports['GetMailAccount']=function(_0x304505){var _0x314ef1=this;return new Promise(function(_0x26aff3,_0x251084){return db[_0x32ef('0x18')][_0x32ef('0x19')]({'raw':_0x304505['options']?_0x304505[_0x32ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['where']||null:null,'attributes':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')][_0x32ef('0x1b')]||null:null,'limit':_0x304505['options']?_0x304505['options'][_0x32ef('0x1c')]||null:null,'include':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['include']?_['map'](_0x304505[_0x32ef('0x1a')]['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1d')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1b')],'include':_0x51a412[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x51a412[_0x32ef('0x1e')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1d')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1b')],'include':_0x234175[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x234175[_0x32ef('0x1e')],function(_0xba4b3f){return{'model':db[_0xba4b3f['model']],'as':_0xba4b3f['as'],'attributes':_0xba4b3f[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x5a04cd){logger[_0x32ef('0x10')](_0x32ef('0x20'),_0x304505);logger[_0x32ef('0x12')](_0x32ef('0x20'),_0x304505,JSON['stringify'](_0x5a04cd));_0x26aff3(_0x5a04cd);})[_0x32ef('0x17')](function(_0x22bf86){logger[_0x32ef('0x14')](_0x32ef('0x20'),_0x22bf86[_0x32ef('0x15')],_0x304505);_0x251084(_0x314ef1[_0x32ef('0x14')](0x1f4,_0x22bf86[_0x32ef('0x15')]));});});};exports['ShowMailAccount']=function(_0x36ac37){var _0x537214=this;return new Promise(function(_0x38bf73,_0x2b6c6a){return db['MailAccount'][_0x32ef('0x21')]({'raw':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x22')]===undefined?!![]:![]:!![],'where':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options']['where']||null:null,'attributes':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options'][_0x32ef('0x1b')]||null:null,'include':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x36ac37[_0x32ef('0x1a')]['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1b')],'include':_0x482d3a[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1d')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1b')],'include':_0x4fb402[_0x32ef('0x1e')]?_['map'](_0x4fb402['include'],function(_0xcbdec8){return{'model':db[_0xcbdec8[_0x32ef('0x1d')]],'as':_0xcbdec8['as'],'attributes':_0xcbdec8[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x3a7c49){if(_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x23')]===!![])_0x3a7c49[_0x32ef('0x24')](_0x32ef('0x25'),_0x3a7c49['getSmtpOptions']());logger[_0x32ef('0x10')](_0x32ef('0x26'),_0x36ac37);logger[_0x32ef('0x12')]('ShowMailAccount',_0x36ac37,JSON[_0x32ef('0x27')](_0x3a7c49));_0x38bf73(_0x3a7c49);})[_0x32ef('0x17')](function(_0x879e33){logger[_0x32ef('0x14')](_0x32ef('0x26'),_0x879e33[_0x32ef('0x15')],_0x36ac37);_0x2b6c6a(_0x537214[_0x32ef('0x14')](0x1f4,_0x879e33[_0x32ef('0x15')]));});});};exports[_0x32ef('0x28')]=function(_0x57a3c0){var _0xb4db74=this;return new Promise(function(_0x4615b4,_0x48e071){var _0x3cac2e={'body':_0x57a3c0[_0x32ef('0x29')],'channel':_0x32ef('0x2a')};var _0x1733e3=_[_0x32ef('0x2b')](_[_0x32ef('0x2c')](db[_0x32ef('0x2d')]['rawAttributes']),['createdAt',_0x32ef('0x2e'),_0x32ef('0x2f'),_0x32ef('0x30')]);var _0x765c63=![];if(_0x57a3c0['body']['id']){delete _0x57a3c0[_0x32ef('0x29')]['id'];}if(_[_0x32ef('0x31')](_0x57a3c0['body'][_0x32ef('0x32')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x33')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')])||_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')]===''){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x32ef('0x34')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')]['mapKey'])){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1733e3));}if(!_[_0x32ef('0x35')](_0x1733e3,_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x37')+_0x1733e3));}var _0x230ac9={};_0x230ac9[_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')]]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x18')]['find']({'where':{'id':_0x57a3c0['account']['id']},'include':[{'model':db[_0x32ef('0x38')],'as':_0x32ef('0x39'),'include':[{'model':db[_0x32ef('0x2d')],'as':_0x32ef('0x3a'),'where':_0x230ac9,'limit':0x1,'order':[[_0x32ef('0x2e'),_0x32ef('0x3b')]]}]},{'model':db[_0x32ef('0x3c')],'as':_0x32ef('0x3d')},{'model':db[_0x32ef('0x3e')],'as':_0x32ef('0x3f'),'include':[{'model':db[_0x32ef('0x40')],'as':_0x32ef('0x40')}]}]})[_0x32ef('0xf')](function(_0x4c2534){if(_0x4c2534&&_0x4c2534[_0x32ef('0x39')]){var _0x12fbd7=_0x4c2534[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x42')]=_[_0x32ef('0x43')](_0x12fbd7,[_0x32ef('0x3d'),_0x32ef('0x39')]);_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x25')]=_0x4c2534[_0x32ef('0x44')]();_0x3cac2e[_0x32ef('0x45')]=_0x12fbd7[_0x32ef('0x3d')];_0x3cac2e[_0x32ef('0x46')]=_0x12fbd7[_0x32ef('0x39')];_0x3cac2e[_0x32ef('0x45')]=_[_0x32ef('0x47')](_0x3cac2e[_0x32ef('0x45')],[_0x32ef('0x48')],['asc']);if(_0x3cac2e['account']&&_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x49')]){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4a')]({'id':0x0,'priority':_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4b')]+0x1,'app':_0x32ef('0x4c'),'appdata':_0x32ef('0x49'),'interval':_0x32ef('0x4d')});}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x3d')]){delete _0x3cac2e['account'][_0x32ef('0x3d')];}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')]){delete _0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')];}if(_0x12fbd7[_0x32ef('0x39')]['Contacts'][_0x32ef('0x4b')]){return _0x12fbd7[_0x32ef('0x39')][_0x32ef('0x3a')][0x0];}var _0x56b7ce=_[_0x32ef('0x4e')](_0x57a3c0['body'],{'firstName':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')],'ListId':_0x12fbd7['ListId']});_0x56b7ce[_0x57a3c0[_0x32ef('0x29')]['mapKey']]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x2d')][_0x32ef('0x4f')](_0x56b7ce);}else{throw new Error(_0x32ef('0x50'));}})[_0x32ef('0xf')](function(_0x42c7f4){_0x3cac2e['contact']=_0x42c7f4;if(_0x42c7f4){if(!_0x57a3c0['body'][_0x32ef('0x15')]['messageId']){_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')]=rs[_0x32ef('0x52')]()+'\x20'+_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x32')];}var _0x316547={'ContactId':_0x42c7f4['id'],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['messageId'],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0['body'][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['subject'],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x32ef('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x32ef('0x51')],'where':{'messageId':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['inReplyTo']}}]})[_0x32ef('0xf')](function(_0x222b24){if(_0x222b24){return[_0x222b24,![]];}return db[_0x32ef('0x54')]['create'](_0x316547)[_0x32ef('0xf')](function(_0x12b7f8){return[_0x12b7f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2e20dc,_0x3a6697){if(_0x2e20dc){_0x765c63=_0x3a6697;if(!_0x3a6697){return _0x2e20dc[_0x32ef('0x55')]({'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x51')],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x2e20dc[_0x32ef('0x53')]?_0x2e20dc[_0x32ef('0x53')]:_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x53')],'substatus':null,'substatusAt':moment()[_0x32ef('0x57')](_0x32ef('0x58')),'lastMsgAt':moment()[_0x32ef('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2e20dc;}}})['then'](function(_0x2125de){_0x3cac2e[_0x32ef('0x59')]=_0x2125de[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x59')][_0x32ef('0x5a')]=_0x765c63;return db['MailMessage'][_0x32ef('0x4f')]({'body':_0x57a3c0['body'][_0x32ef('0x29')],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'MailInteractionId':_0x2125de['id'],'direction':'in','ContactId':_0x3cac2e['contact']['id'],'messageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')],'from':_0x57a3c0[_0x32ef('0x29')]['message']['from'],'to':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['to'],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'Attachments':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5b')],'originTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5c')],'originCc':_0x57a3c0[_0x32ef('0x29')]['message']['originCc'],'bcc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['bcc'],'ChatWebsiteId':_0x57a3c0[_0x32ef('0x29')]['message'][_0x32ef('0x5d')]||null,'originChannel':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['originChannel']||_0x32ef('0x5e'),'ChatOfflineMessageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32ef('0xf')](function(_0x5970db){_0x3cac2e[_0x32ef('0x15')]=_0x5970db;if(_0x3cac2e['interaction'][_0x32ef('0x60')]){return db[_0x32ef('0x61')][_0x32ef('0x21')]({'attributes':['id','name'],'where':{'id':_0x3cac2e['interaction']['UserId']}})[_0x32ef('0xf')](function(_0x5e5766){if(_0x5e5766){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x62')]({'id':0x0,'priority':0x0,'app':_0x32ef('0x63'),'appdata':_0x5e5766[_0x32ef('0x64')]+','+(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ef('0x66'),'startRouting',_0x3cac2e);});}return respondWithRpcPromise('Start',_0x32ef('0x67'),_0x3cac2e);})['then'](function(_0x145e27){_0x4615b4(_0x145e27);})[_0x32ef('0x17')](function(_0x4d64ec){_0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x4d64ec[_0x32ef('0x15')]));});});}; \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','find','smtp','setDataValue','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','CloudProvider','get','account','omit','smtpOptions','applications','list','orderBy','asc','autoclose','push','length','close','create','List\x20not\x20found','contact','messageId','generate','subject','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originTo','originCc','originChannel','Email','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash'];(function(_0x3ae57e,_0x3ef6e9){var _0x4c3f3e=function(_0x548451){while(--_0x548451){_0x3ae57e['push'](_0x3ae57e['shift']());}};_0x4c3f3e(++_0x3ef6e9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xac4a('0x0'));var moment=require(_0xac4a('0x1'));var BPromise=require(_0xac4a('0x2'));var rs=require(_0xac4a('0x3'));var Redis=require(_0xac4a('0x4'));var db=require(_0xac4a('0x5'))['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xac4a('0x6'));var client=jayson[_0xac4a('0x7')][_0xac4a('0x8')]({'port':0x232c});config[_0xac4a('0x9')]=_[_0xac4a('0xa')](config[_0xac4a('0x9')],{'host':_0xac4a('0xb'),'port':0x18eb});var socket=require(_0xac4a('0xc'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xac4a('0xd')](socket);function respondWithRpcPromise(_0x2a4d53,_0x26ec84,_0x4f4146){return new BPromise(function(_0x1d182e,_0x3a82de){return client[_0xac4a('0xe')](_0x2a4d53,_0x4f4146)['then'](function(_0x30135d){logger['info'](_0xac4a('0xf'),_0x26ec84,'request\x20sent');logger[_0xac4a('0x10')](_0xac4a('0x11'),_0x26ec84,_0xac4a('0x12'),JSON['stringify'](_0x30135d));if(_0x30135d[_0xac4a('0x13')]){if(_0x30135d[_0xac4a('0x13')][_0xac4a('0x14')]===0x1f4){logger[_0xac4a('0x13')](_0xac4a('0xf'),_0x26ec84,_0x30135d[_0xac4a('0x13')][_0xac4a('0x15')]);return _0x3a82de(_0x30135d[_0xac4a('0x13')][_0xac4a('0x15')]);}logger[_0xac4a('0x13')](_0xac4a('0xf'),_0x26ec84,_0x30135d[_0xac4a('0x13')]['message']);return _0x1d182e(_0x30135d[_0xac4a('0x13')][_0xac4a('0x15')]);}else{logger[_0xac4a('0x16')](_0xac4a('0xf'),_0x26ec84,_0xac4a('0x12'));_0x1d182e(_0x30135d[_0xac4a('0x17')][_0xac4a('0x15')]);}})[_0xac4a('0x18')](function(_0x546c5d){logger['error'](_0xac4a('0xf'),_0x26ec84,_0x546c5d);_0x3a82de(_0x546c5d);});});}exports[_0xac4a('0x19')]=function(_0x39b691){var _0x4d837c=this;return new Promise(function(_0x39e83e,_0x15c223){return db[_0xac4a('0x1a')][_0xac4a('0x1b')]({'raw':_0x39b691[_0xac4a('0x1c')]?_0x39b691[_0xac4a('0x1c')][_0xac4a('0x1d')]===undefined?!![]:![]:!![],'where':_0x39b691[_0xac4a('0x1c')]?_0x39b691['options'][_0xac4a('0x1e')]||null:null,'attributes':_0x39b691[_0xac4a('0x1c')]?_0x39b691['options'][_0xac4a('0x1f')]||null:null,'limit':_0x39b691[_0xac4a('0x1c')]?_0x39b691[_0xac4a('0x1c')][_0xac4a('0x20')]||null:null,'include':_0x39b691['options']?_0x39b691[_0xac4a('0x1c')][_0xac4a('0x21')]?_[_0xac4a('0x22')](_0x39b691[_0xac4a('0x1c')][_0xac4a('0x21')],function(_0x2b0dc2){return{'model':db[_0x2b0dc2[_0xac4a('0x23')]],'as':_0x2b0dc2['as'],'attributes':_0x2b0dc2[_0xac4a('0x1f')],'include':_0x2b0dc2[_0xac4a('0x21')]?_[_0xac4a('0x22')](_0x2b0dc2[_0xac4a('0x21')],function(_0x215a31){return{'model':db[_0x215a31[_0xac4a('0x23')]],'as':_0x215a31['as'],'attributes':_0x215a31[_0xac4a('0x1f')],'include':_0x215a31[_0xac4a('0x21')]?_[_0xac4a('0x22')](_0x215a31['include'],function(_0x23b061){return{'model':db[_0x23b061[_0xac4a('0x23')]],'as':_0x23b061['as'],'attributes':_0x23b061[_0xac4a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xac4a('0x24')](function(_0x116700){logger['info']('GetMailAccount',_0x39b691);logger[_0xac4a('0x10')](_0xac4a('0x19'),_0x39b691,JSON[_0xac4a('0x25')](_0x116700));_0x39e83e(_0x116700);})['catch'](function(_0x4bda1f){logger[_0xac4a('0x13')](_0xac4a('0x19'),_0x4bda1f[_0xac4a('0x15')],_0x39b691);_0x15c223(_0x4d837c[_0xac4a('0x13')](0x1f4,_0x4bda1f[_0xac4a('0x15')]));});});};exports['ShowMailAccount']=function(_0x6dcc7f){var _0x482afc=this;return new Promise(function(_0x30364b,_0x57adcf){return db[_0xac4a('0x1a')][_0xac4a('0x26')]({'raw':_0x6dcc7f[_0xac4a('0x1c')]?_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x1d')]===undefined?!![]:![]:!![],'where':_0x6dcc7f[_0xac4a('0x1c')]?_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x1e')]||null:null,'attributes':_0x6dcc7f[_0xac4a('0x1c')]?_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x1f')]||null:null,'include':_0x6dcc7f[_0xac4a('0x1c')]?_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x21')]?_['map'](_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x21')],function(_0x5a4e2b){return{'model':db[_0x5a4e2b[_0xac4a('0x23')]],'as':_0x5a4e2b['as'],'attributes':_0x5a4e2b[_0xac4a('0x1f')],'include':_0x5a4e2b['include']?_['map'](_0x5a4e2b[_0xac4a('0x21')],function(_0x1ba096){return{'model':db[_0x1ba096[_0xac4a('0x23')]],'as':_0x1ba096['as'],'attributes':_0x1ba096[_0xac4a('0x1f')],'include':_0x1ba096['include']?_[_0xac4a('0x22')](_0x1ba096[_0xac4a('0x21')],function(_0x4e7630){return{'model':db[_0x4e7630[_0xac4a('0x23')]],'as':_0x4e7630['as'],'attributes':_0x4e7630[_0xac4a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xac4a('0x24')](function(_0x5f0eb8){if(_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x27')]===!![])_0x5f0eb8[_0xac4a('0x28')]('smtpOptions',_0x5f0eb8[_0xac4a('0x29')]());logger[_0xac4a('0x16')]('ShowMailAccount',_0x6dcc7f);logger['debug'](_0xac4a('0x2a'),_0x6dcc7f,JSON['stringify'](_0x5f0eb8));_0x30364b(_0x5f0eb8);})['catch'](function(_0x5f0af0){logger['error'](_0xac4a('0x2a'),_0x5f0af0[_0xac4a('0x15')],_0x6dcc7f);_0x57adcf(_0x482afc[_0xac4a('0x13')](0x1f4,_0x5f0af0[_0xac4a('0x15')]));});});};exports[_0xac4a('0x2b')]=function(_0x415f31){var _0x4220e2=this;return new Promise(function(_0x2b16f0,_0x28292c){var _0x1f7721={'body':_0x415f31[_0xac4a('0x2c')],'channel':_0xac4a('0x2d')};var _0x4e4994=_['difference'](_['keys'](db[_0xac4a('0x2e')][_0xac4a('0x2f')]),[_0xac4a('0x30'),_0xac4a('0x31'),_0xac4a('0x32'),_0xac4a('0x33')]);var _0x8febf0=![];if(_0x415f31[_0xac4a('0x2c')]['id']){delete _0x415f31[_0xac4a('0x2c')]['id'];}if(_[_0xac4a('0x34')](_0x415f31['body'][_0xac4a('0x35')])){return _0x28292c(_0x4220e2[_0xac4a('0x13')](0x1f4,_0xac4a('0x36')));}if(_[_0xac4a('0x34')](_0x415f31[_0xac4a('0x2c')]['body'])||_0x415f31[_0xac4a('0x2c')][_0xac4a('0x2c')]===''){return _0x28292c(_0x4220e2['error'](0x1f4,_0xac4a('0x37')));}if(_['isNil'](_0x415f31[_0xac4a('0x2c')][_0xac4a('0x38')])){return _0x28292c(_0x4220e2[_0xac4a('0x13')](0x1f4,_0xac4a('0x39')+_0x4e4994));}if(!_[_0xac4a('0x3a')](_0x4e4994,_0x415f31[_0xac4a('0x2c')][_0xac4a('0x38')])){return _0x28292c(_0x4220e2[_0xac4a('0x13')](0x1f4,_0xac4a('0x3b')+_0x4e4994));}var _0xcb002b={};_0xcb002b[_0x415f31[_0xac4a('0x2c')][_0xac4a('0x38')]]=_0x415f31['body'][_0xac4a('0x35')];return db[_0xac4a('0x1a')][_0xac4a('0x26')]({'where':{'id':_0x415f31['account']['id']},'include':[{'model':db[_0xac4a('0x3c')],'as':_0xac4a('0x3d'),'include':[{'model':db['CmContact'],'as':_0xac4a('0x3e'),'where':_0xcb002b,'limit':0x1,'order':[['updatedAt',_0xac4a('0x3f')]]}]},{'model':db[_0xac4a('0x40')],'as':_0xac4a('0x41')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xac4a('0x42')],'as':'CloudProvider'}]}]})[_0xac4a('0x24')](function(_0x566258){if(_0x566258&&_0x566258[_0xac4a('0x3d')]){var _0x530bbb=_0x566258[_0xac4a('0x43')]({'plain':!![]});_0x1f7721[_0xac4a('0x44')]=_[_0xac4a('0x45')](_0x530bbb,[_0xac4a('0x41'),'List']);_0x1f7721[_0xac4a('0x44')][_0xac4a('0x46')]=_0x566258[_0xac4a('0x29')]();_0x1f7721[_0xac4a('0x47')]=_0x530bbb[_0xac4a('0x41')];_0x1f7721[_0xac4a('0x48')]=_0x530bbb[_0xac4a('0x3d')];_0x1f7721['applications']=_[_0xac4a('0x49')](_0x1f7721[_0xac4a('0x47')],['priority'],[_0xac4a('0x4a')]);if(_0x1f7721[_0xac4a('0x44')]&&_0x1f7721[_0xac4a('0x44')][_0xac4a('0x4b')]){_0x1f7721['applications'][_0xac4a('0x4c')]({'id':0x0,'priority':_0x1f7721[_0xac4a('0x47')][_0xac4a('0x4d')]+0x1,'app':_0xac4a('0x4e'),'appdata':_0xac4a('0x4b'),'interval':'*,*,*,*'});}if(_0x1f7721[_0xac4a('0x44')]['Applications']){delete _0x1f7721[_0xac4a('0x44')][_0xac4a('0x41')];}if(_0x1f7721['account']['List']){delete _0x1f7721[_0xac4a('0x44')][_0xac4a('0x3d')];}if(_0x530bbb['List'][_0xac4a('0x3e')][_0xac4a('0x4d')]){return _0x530bbb[_0xac4a('0x3d')][_0xac4a('0x3e')][0x0];}var _0x48900f=_[_0xac4a('0xa')](_0x415f31[_0xac4a('0x2c')],{'firstName':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x35')],'ListId':_0x530bbb[_0xac4a('0x33')]});_0x48900f[_0x415f31[_0xac4a('0x2c')][_0xac4a('0x38')]]=_0x415f31['body'][_0xac4a('0x35')];return db[_0xac4a('0x2e')][_0xac4a('0x4f')](_0x48900f);}else{throw new Error(_0xac4a('0x50'));}})[_0xac4a('0x24')](function(_0x2ac1e9){_0x1f7721[_0xac4a('0x51')]=_0x2ac1e9;if(_0x2ac1e9){if(!_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x52')]){_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x52')]=rs[_0xac4a('0x53')]()+'\x20'+_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['from'];}var _0x13a577={'ContactId':_0x2ac1e9['id'],'MailAccountId':_0x415f31['account']['id'],'inReplyTo':_0x415f31[_0xac4a('0x2c')]['message'][_0xac4a('0x52')],'to':_0x415f31['body'][_0xac4a('0x15')]['from'],'cc':_0x415f31['body'][_0xac4a('0x15')]['cc'],'subject':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x54')],'attach':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['attach'],'lastMsgAt':moment()[_0xac4a('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xac4a('0x56')]['find']({'where':{'closed':![],'MailAccountId':_0x415f31[_0xac4a('0x44')]['id']},'include':[{'model':db[_0xac4a('0x57')],'as':_0xac4a('0x58'),'attributes':[_0xac4a('0x52')],'where':{'messageId':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x59')]}}]})[_0xac4a('0x24')](function(_0x2ff07a){if(_0x2ff07a){return[_0x2ff07a,![]];}return db[_0xac4a('0x56')][_0xac4a('0x4f')](_0x13a577)[_0xac4a('0x24')](function(_0x1fe05a){return[_0x1fe05a,!![]];});});}else{throw new Error(_0xac4a('0x5a'));}})[_0xac4a('0x5b')](function(_0xf07212,_0x38cb4f){if(_0xf07212){_0x8febf0=_0x38cb4f;if(!_0x38cb4f){return _0xf07212['update']({'inReplyTo':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['messageId'],'to':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x35')],'cc':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['cc'],'subject':_0x415f31['body']['message'][_0xac4a('0x54')],'attach':_0xf07212[_0xac4a('0x5c')]?_0xf07212[_0xac4a('0x5c')]:_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x5c')],'substatus':null,'substatusAt':moment()[_0xac4a('0x55')](_0xac4a('0x5d')),'lastMsgAt':moment()[_0xac4a('0x55')](_0xac4a('0x5d')),'lastMsgDirection':'in'});}else{return _0xf07212;}}})[_0xac4a('0x24')](function(_0x49e5f5){_0x1f7721['interaction']=_0x49e5f5[_0xac4a('0x43')]({'plain':!![]});_0x1f7721[_0xac4a('0x5e')][_0xac4a('0x5f')]=_0x8febf0;return db[_0xac4a('0x57')][_0xac4a('0x4f')]({'body':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x2c')],'MailAccountId':_0x415f31[_0xac4a('0x44')]['id'],'MailInteractionId':_0x49e5f5['id'],'direction':'in','ContactId':_0x1f7721[_0xac4a('0x51')]['id'],'messageId':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x52')],'from':_0x415f31['body'][_0xac4a('0x15')][_0xac4a('0x35')],'to':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['to'],'cc':_0x415f31['body'][_0xac4a('0x15')]['cc'],'subject':_0x415f31['body'][_0xac4a('0x15')][_0xac4a('0x54')],'attach':_0x415f31['body']['message'][_0xac4a('0x5c')],'Attachments':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['attachments'],'originTo':_0x415f31[_0xac4a('0x2c')]['message'][_0xac4a('0x60')],'originCc':_0x415f31['body']['message'][_0xac4a('0x61')],'bcc':_0x415f31['body'][_0xac4a('0x15')]['bcc'],'ChatWebsiteId':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['ChatWebsiteId']||null,'originChannel':_0x415f31[_0xac4a('0x2c')]['message'][_0xac4a('0x62')]||_0xac4a('0x63'),'ChatOfflineMessageId':_0x415f31['body'][_0xac4a('0x15')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0xac4a('0x64')}]});})['then'](function(_0x26b962){_0x1f7721['message']=_0x26b962;if(_0x1f7721['interaction'][_0xac4a('0x65')]){return db[_0xac4a('0x66')][_0xac4a('0x26')]({'attributes':['id','name'],'where':{'id':_0x1f7721['interaction'][_0xac4a('0x65')]}})[_0xac4a('0x24')](function(_0x5ac8cc){if(_0x5ac8cc){_0x1f7721['applications'][_0xac4a('0x67')]({'id':0x0,'priority':0x0,'app':_0xac4a('0x68'),'appdata':_0x5ac8cc[_0xac4a('0x69')]+','+(_0x1f7721[_0xac4a('0x44')][_0xac4a('0x6a')]||0xa),'interval':_0xac4a('0x6b')});}return respondWithRpcPromise(_0xac4a('0x6c'),_0xac4a('0x6d'),_0x1f7721);});}return respondWithRpcPromise(_0xac4a('0x6c'),'startRouting',_0x1f7721);})[_0xac4a('0x24')](function(_0x440dc4){_0x2b16f0(_0x440dc4);})[_0xac4a('0x18')](function(_0x582e1e){_0x28292c(_0x4220e2[_0xac4a('0x13')](0x1f4,_0x582e1e[_0xac4a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f5dd9cf..366c27b 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 _0x268c=['removeListener','register','length','mailAccount:','./mailAccount.events','remove','emit'];(function(_0x54f0ec,_0x2fef4d){var _0x2111ac=function(_0xd2b88b){while(--_0xd2b88b){_0x54f0ec['push'](_0x54f0ec['shift']());}};_0x2111ac(++_0x2fef4d);}(_0x268c,0xb3));var _0xc268=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0x268c[_0x55d911];return _0x3104c2;};'use strict';var MailAccountEvents=require(_0xc268('0x0'));var events=['save',_0xc268('0x1'),'update'];function createListener(_0x12d634,_0x498234){return function(_0x4f78a7){_0x498234[_0xc268('0x2')](_0x12d634,_0x4f78a7);};}function removeListener(_0x55edc9,_0x19f84f){return function(){MailAccountEvents[_0xc268('0x3')](_0x55edc9,_0x19f84f);};}exports[_0xc268('0x4')]=function(_0x3d0ecf){for(var _0x4e2a03=0x0,_0x4b843c=events[_0xc268('0x5')];_0x4e2a03<_0x4b843c;_0x4e2a03++){var _0x2f7f1b=events[_0x4e2a03];var _0x596f88=createListener(_0xc268('0x6')+_0x2f7f1b,_0x3d0ecf);MailAccountEvents['on'](_0x2f7f1b,_0x596f88);}}; \ No newline at end of file +var _0xe06f=['removeListener','register','length','mailAccount:','save','remove','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe06f,0x104));var _0xfe06=function(_0x4c01db,_0x5d8e62){_0x4c01db=_0x4c01db-0x0;var _0x9951f9=_0xe06f[_0x4c01db];return _0x9951f9;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xfe06('0x0'),_0xfe06('0x1'),_0xfe06('0x2')];function createListener(_0x5031b6,_0x493c5b){return function(_0x515368){_0x493c5b[_0xfe06('0x3')](_0x5031b6,_0x515368);};}function removeListener(_0x317628,_0x3e20fe){return function(){MailAccountEvents[_0xfe06('0x4')](_0x317628,_0x3e20fe);};}exports[_0xfe06('0x5')]=function(_0x10a093){for(var _0x15d18e=0x0,_0x132a8c=events[_0xfe06('0x6')];_0x15d18e<_0x132a8c;_0x15d18e++){var _0x462aae=events[_0x15d18e];var _0x4b6566=createListener(_0xfe06('0x7')+_0x462aae,_0x10a093);MailAccountEvents['on'](_0x462aae,_0x4b6566);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index cd9b595..9f1b394 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 _0x4ff2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ff2,0x66));var _0x24ff=function(_0xfd1fcd,_0x3182b7){_0xfd1fcd=_0xfd1fcd-0x0;var _0x1e0646=_0x4ff2[_0xfd1fcd];return _0x1e0646;};'use strict';var multer=require(_0x24ff('0x0'));var util=require(_0x24ff('0x1'));var path=require(_0x24ff('0x2'));var timeout=require(_0x24ff('0x3'));var express=require(_0x24ff('0x4'));var router=express[_0x24ff('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x24ff('0x6'));var interaction=require(_0x24ff('0x7'));var config=require('../../config/environment');var controller=require(_0x24ff('0x8'));router[_0x24ff('0x9')](_0x24ff('0xa'),auth[_0x24ff('0xb')](),controller[_0x24ff('0xc')]);router[_0x24ff('0xd')](_0x24ff('0xa'),auth[_0x24ff('0xb')](),controller[_0x24ff('0xe')]);router['delete']('/:id',auth[_0x24ff('0xb')](),controller[_0x24ff('0xf')]);module[_0x24ff('0x10')]=router; \ No newline at end of file +var _0xc552=['../../components/auth/service','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x45f0e2,_0x12026e){var _0x5c2103=function(_0x2eb050){while(--_0x2eb050){_0x45f0e2['push'](_0x45f0e2['shift']());}};_0x5c2103(++_0x12026e);}(_0xc552,0x181));var _0x2c55=function(_0x5207d3,_0x1b67d4){_0x5207d3=_0x5207d3-0x0;var _0x36785c=_0xc552[_0x5207d3];return _0x36785c;};'use strict';var multer=require(_0x2c55('0x0'));var util=require('util');var path=require(_0x2c55('0x1'));var timeout=require(_0x2c55('0x2'));var express=require(_0x2c55('0x3'));var router=express[_0x2c55('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2c55('0x5'));var interaction=require(_0x2c55('0x6'));var config=require('../../config/environment');var controller=require(_0x2c55('0x7'));router['get'](_0x2c55('0x8'),auth[_0x2c55('0x9')](),controller['show']);router[_0x2c55('0xa')](_0x2c55('0x8'),auth['isAuthenticated'](),controller[_0x2c55('0xb')]);router[_0x2c55('0xc')](_0x2c55('0x8'),auth[_0x2c55('0x9')](),controller[_0x2c55('0xd')]);module[_0x2c55('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index fddf986..51e461c 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 _0xd8b9=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x171fb7,_0x10ea75){var _0x25fda5=function(_0x212e03){while(--_0x212e03){_0x171fb7['push'](_0x171fb7['shift']());}};_0x25fda5(++_0x10ea75);}(_0xd8b9,0x15e));var _0x9d8b=function(_0x3d2e03,_0x33f13c){_0x3d2e03=_0x3d2e03-0x0;var _0x1a20bf=_0xd8b9[_0x3d2e03];return _0x1a20bf;};'use strict';var Sequelize=require(_0x9d8b('0x0'));module[_0x9d8b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9d8b('0x2')],'allowNull':![],'defaultValue':_0x9d8b('0x3')},'appdata':{'type':Sequelize[_0x9d8b('0x4')]()},'description':{'type':Sequelize[_0x9d8b('0x2')]},'interval':{'type':Sequelize[_0x9d8b('0x2')],'defaultValue':_0x9d8b('0x5')}}; \ No newline at end of file +var _0xeb6c=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0xeb6c,0xda));var _0xceb6=function(_0x4c181a,_0x58548d){_0x4c181a=_0x4c181a-0x0;var _0x4a67d7=_0xeb6c[_0x4c181a];return _0x4a67d7;};'use strict';var Sequelize=require('sequelize');module[_0xceb6('0x0')]={'priority':{'type':Sequelize[_0xceb6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xceb6('0x2')],'allowNull':![],'defaultValue':_0xceb6('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xceb6('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xceb6('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e5ace97..e831231 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 _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3882e8,_0x578a08){var _0x18a490=function(_0x1aa40a){while(--_0x1aa40a){_0x3882e8['push'](_0x3882e8['shift']());}};_0x18a490(++_0x578a08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x14d99c,_0xa1b029){var _0x2a8f65=function(_0xc51369){while(--_0xc51369){_0x14d99c['push'](_0x14d99c['shift']());}};_0x2a8f65(++_0xa1b029);}(_0xe706,0xa3));var _0x6e70=function(_0x3403d5,_0x3d99fc){_0x3403d5=_0x3403d5-0x0;var _0xf9df4f=_0xe706[_0x3403d5];return _0xf9df4f;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 475c594..a576bea 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 _0x4493=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0xb399f1,_0x4f1c17){var _0x4765ef=function(_0x2dc8dc){while(--_0x2dc8dc){_0xb399f1['push'](_0xb399f1['shift']());}};_0x4765ef(++_0x4f1c17);}(_0x4493,0x8c));var _0x3449=function(_0x52951f,_0x53cce8){_0x52951f=_0x52951f-0x0;var _0x36f951=_0x4493[_0x52951f];return _0x36f951;};'use strict';var _=require(_0x3449('0x0'));var util=require(_0x3449('0x1'));var logger=require(_0x3449('0x2'))(_0x3449('0x3'));var moment=require(_0x3449('0x4'));var BPromise=require('bluebird');var rp=require(_0x3449('0x5'));var fs=require('fs');var path=require(_0x3449('0x6'));var rimraf=require(_0x3449('0x7'));var config=require(_0x3449('0x8'));var attributes=require(_0x3449('0x9'));module['exports']=function(_0x125f59,_0xaddb30){return _0x125f59[_0x3449('0xa')]('MailApplication',attributes,{'tableName':_0x3449('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3449('0xc'),'collate':_0x3449('0xd')});}; \ No newline at end of file +var _0xd987=['bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x30e5b8,_0x915bbe){var _0x228816=function(_0x5ae735){while(--_0x5ae735){_0x30e5b8['push'](_0x30e5b8['shift']());}};_0x228816(++_0x915bbe);}(_0xd987,0x171));var _0x7d98=function(_0x3a8492,_0x2fb44e){_0x3a8492=_0x3a8492-0x0;var _0xadfa1a=_0xd987[_0x3a8492];return _0xadfa1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d98('0x0'))(_0x7d98('0x1'));var moment=require(_0x7d98('0x2'));var BPromise=require(_0x7d98('0x3'));var rp=require(_0x7d98('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d98('0x5'));var config=require(_0x7d98('0x6'));var attributes=require(_0x7d98('0x7'));module[_0x7d98('0x8')]=function(_0x5b9ab9,_0x16f6f6){return _0x5b9ab9[_0x7d98('0x9')](_0x7d98('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7d98('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 454b32a..05f7c5c 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 _0x2df2=['error','code','message','result','catch','UpdateMailApplication','update','options','raw','where','attributes','limit','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0x2df2,0xe6));var _0x22df=function(_0x15decc,_0xab69b){_0x15decc=_0x15decc-0x0;var _0x536f23=_0x2df2[_0x15decc];return _0x536f23;};'use strict';var _=require(_0x22df('0x0'));var util=require(_0x22df('0x1'));var moment=require(_0x22df('0x2'));var BPromise=require('bluebird');var rs=require(_0x22df('0x3'));var fs=require('fs');var Redis=require(_0x22df('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x22df('0x5'));var logger=require(_0x22df('0x6'))(_0x22df('0x7'));var config=require(_0x22df('0x8'));var jayson=require(_0x22df('0x9'));var client=jayson[_0x22df('0xa')][_0x22df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ec491,_0xa8609d,_0x31a998){return new BPromise(function(_0x714530,_0x55db63){return client[_0x22df('0xc')](_0x3ec491,_0x31a998)[_0x22df('0xd')](function(_0x38074b){logger[_0x22df('0xe')](_0x22df('0xf'),_0xa8609d,_0x22df('0x10'));logger[_0x22df('0x11')]('MailApplication,\x20%s,\x20%s,\x20%s',_0xa8609d,_0x22df('0x10'),JSON['stringify'](_0x38074b));if(_0x38074b[_0x22df('0x12')]){if(_0x38074b[_0x22df('0x12')][_0x22df('0x13')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0xa8609d,_0x38074b[_0x22df('0x12')][_0x22df('0x14')]);return _0x55db63(_0x38074b[_0x22df('0x12')][_0x22df('0x14')]);}logger[_0x22df('0x12')](_0x22df('0xf'),_0xa8609d,_0x38074b[_0x22df('0x12')][_0x22df('0x14')]);return _0x714530(_0x38074b[_0x22df('0x12')][_0x22df('0x14')]);}else{logger[_0x22df('0xe')](_0x22df('0xf'),_0xa8609d,_0x22df('0x10'));_0x714530(_0x38074b[_0x22df('0x15')]['message']);}})[_0x22df('0x16')](function(_0x48fac9){logger[_0x22df('0x12')]('MailApplication,\x20%s,\x20%s',_0xa8609d,_0x48fac9);_0x55db63(_0x48fac9);});});}exports[_0x22df('0x17')]=function(_0x42109e){var _0x10cf54=this;return new Promise(function(_0x1d8954,_0x581b50){return db['MailApplication'][_0x22df('0x18')](_0x42109e['body'],{'raw':_0x42109e[_0x22df('0x19')]?_0x42109e[_0x22df('0x19')][_0x22df('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42109e[_0x22df('0x19')]?_0x42109e[_0x22df('0x19')][_0x22df('0x1b')]||null:null,'attributes':_0x42109e[_0x22df('0x19')]?_0x42109e[_0x22df('0x19')][_0x22df('0x1c')]||null:null,'limit':_0x42109e[_0x22df('0x19')]?_0x42109e[_0x22df('0x19')][_0x22df('0x1d')]||null:null})[_0x22df('0xd')](function(_0x589cac){logger[_0x22df('0xe')]('UpdateMailApplication',_0x42109e);logger['debug'](_0x22df('0x17'),_0x42109e,JSON[_0x22df('0x1e')](_0x589cac));_0x1d8954(_0x589cac);})[_0x22df('0x16')](function(_0x54621a){logger['error']('UpdateMailApplication',_0x54621a[_0x22df('0x14')],_0x42109e);_0x581b50(_0x10cf54[_0x22df('0x12')](0x1f4,_0x54621a[_0x22df('0x14')]));});});}; \ No newline at end of file +var _0xfaea=['../../config/utils','../../config/logger','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','debug','catch','lodash','util','moment','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfaea,0x1a0));var _0xafae=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xfaea[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xafae('0x0'));var util=require(_0xafae('0x1'));var moment=require(_0xafae('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xafae('0x4'));var logger=require(_0xafae('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xafae('0x6'));var client=jayson[_0xafae('0x7')][_0xafae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x571121,_0x14f0ee,_0x287a67){return new BPromise(function(_0x2a27ce,_0x22e545){return client['request'](_0x571121,_0x287a67)[_0xafae('0x9')](function(_0x5d2b2d){logger[_0xafae('0xa')](_0xafae('0xb'),_0x14f0ee,_0xafae('0xc'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x14f0ee,_0xafae('0xc'),JSON[_0xafae('0xd')](_0x5d2b2d));if(_0x5d2b2d[_0xafae('0xe')]){if(_0x5d2b2d[_0xafae('0xe')][_0xafae('0xf')]===0x1f4){logger[_0xafae('0xe')](_0xafae('0xb'),_0x14f0ee,_0x5d2b2d[_0xafae('0xe')][_0xafae('0x10')]);return _0x22e545(_0x5d2b2d[_0xafae('0xe')]['message']);}logger[_0xafae('0xe')](_0xafae('0xb'),_0x14f0ee,_0x5d2b2d[_0xafae('0xe')]['message']);return _0x2a27ce(_0x5d2b2d[_0xafae('0xe')][_0xafae('0x10')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x14f0ee,_0xafae('0xc'));_0x2a27ce(_0x5d2b2d[_0xafae('0x11')]['message']);}})['catch'](function(_0x258e33){logger['error'](_0xafae('0xb'),_0x14f0ee,_0x258e33);_0x22e545(_0x258e33);});});}exports[_0xafae('0x12')]=function(_0x34d1df){var _0x551855=this;return new Promise(function(_0xdd88ae,_0xa94575){return db[_0xafae('0x13')]['update'](_0x34d1df[_0xafae('0x14')],{'raw':_0x34d1df[_0xafae('0x15')]?_0x34d1df[_0xafae('0x15')][_0xafae('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d1df['options']?_0x34d1df[_0xafae('0x15')][_0xafae('0x17')]||null:null,'attributes':_0x34d1df[_0xafae('0x15')]?_0x34d1df[_0xafae('0x15')][_0xafae('0x18')]||null:null,'limit':_0x34d1df[_0xafae('0x15')]?_0x34d1df[_0xafae('0x15')][_0xafae('0x19')]||null:null})[_0xafae('0x9')](function(_0x1e73c0){logger['info'](_0xafae('0x12'),_0x34d1df);logger[_0xafae('0x1a')](_0xafae('0x12'),_0x34d1df,JSON[_0xafae('0xd')](_0x1e73c0));_0xdd88ae(_0x1e73c0);})[_0xafae('0x1b')](function(_0x1996db){logger['error']('UpdateMailApplication',_0x1996db[_0xafae('0x10')],_0x34d1df);_0xa94575(_0x551855[_0xafae('0xe')](0x1f4,_0x1996db[_0xafae('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 804ddd3..788e2d1 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 _0xd94c=['show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','destroy','removeTags','express','Router','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id'];(function(_0x40f6a3,_0x52c0b7){var _0x4f3511=function(_0x166649){while(--_0x166649){_0x40f6a3['push'](_0x40f6a3['shift']());}};_0x4f3511(++_0x52c0b7);}(_0xd94c,0xe2));var _0xcd94=function(_0x4c3f05,_0x3ac33a){_0x4c3f05=_0x4c3f05-0x0;var _0x57b7b4=_0xd94c[_0x4c3f05];return _0x57b7b4;};'use strict';var express=require(_0xcd94('0x0'));var router=express[_0xcd94('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xcd94('0x2'));var controller=require('./mailInteraction.controller');router[_0xcd94('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcd94('0x3')](_0xcd94('0x4'),auth[_0xcd94('0x5')](),controller[_0xcd94('0x6')]);router[_0xcd94('0x3')](_0xcd94('0x7'),auth[_0xcd94('0x5')](),controller[_0xcd94('0x8')]);router[_0xcd94('0x3')](_0xcd94('0x9'),auth[_0xcd94('0x5')](),controller[_0xcd94('0xa')]);router[_0xcd94('0x3')]('/:id/download',auth[_0xcd94('0x5')](),controller[_0xcd94('0xb')]);router[_0xcd94('0xc')]('/',auth[_0xcd94('0x5')](),controller[_0xcd94('0xd')]);router[_0xcd94('0xc')](_0xcd94('0x9'),auth[_0xcd94('0x5')](),controller[_0xcd94('0xe')]);router[_0xcd94('0xc')](_0xcd94('0xf'),auth[_0xcd94('0x5')](),interaction['tracked'](_0xcd94('0x10'),_0xcd94('0x11')),controller[_0xcd94('0x12')]);router[_0xcd94('0x13')](_0xcd94('0x7'),auth[_0xcd94('0x5')](),interaction[_0xcd94('0x14')](_0xcd94('0x10'),_0xcd94('0x15')),controller[_0xcd94('0x16')]);router[_0xcd94('0x17')](_0xcd94('0x7'),auth[_0xcd94('0x5')](),interaction[_0xcd94('0x14')]('mail','mailinteraction:destroy'),controller[_0xcd94('0x18')]);router[_0xcd94('0x17')](_0xcd94('0xf'),auth[_0xcd94('0x5')](),controller[_0xcd94('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa405=['../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','/:id/messages','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router'];(function(_0x58b7a4,_0x3cf180){var _0x5aef32=function(_0x3d0e3){while(--_0x3d0e3){_0x58b7a4['push'](_0x58b7a4['shift']());}};_0x5aef32(++_0x3cf180);}(_0xa405,0x186));var _0x5a40=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa405[_0x4b369d];return _0x571a98;};'use strict';var express=require(_0x5a40('0x0'));var router=express[_0x5a40('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x5a40('0x2'));var controller=require(_0x5a40('0x3'));router[_0x5a40('0x4')]('/',auth[_0x5a40('0x5')](),controller[_0x5a40('0x6')]);router[_0x5a40('0x4')](_0x5a40('0x7'),auth[_0x5a40('0x5')](),controller[_0x5a40('0x8')]);router['get'](_0x5a40('0x9'),auth['isAuthenticated'](),controller[_0x5a40('0xa')]);router[_0x5a40('0x4')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5a40('0xb')]);router[_0x5a40('0x4')]('/:id/download',auth[_0x5a40('0x5')](),controller[_0x5a40('0xc')]);router[_0x5a40('0xd')]('/',auth[_0x5a40('0x5')](),controller['create']);router[_0x5a40('0xd')](_0x5a40('0xe'),auth[_0x5a40('0x5')](),controller[_0x5a40('0xf')]);router[_0x5a40('0xd')](_0x5a40('0x10'),auth[_0x5a40('0x5')](),interaction[_0x5a40('0x11')]('mail',_0x5a40('0x12')),controller[_0x5a40('0x13')]);router[_0x5a40('0x14')](_0x5a40('0x9'),auth[_0x5a40('0x5')](),interaction['tracked'](_0x5a40('0x15'),_0x5a40('0x16')),controller['update']);router[_0x5a40('0x17')](_0x5a40('0x9'),auth[_0x5a40('0x5')](),interaction[_0x5a40('0x11')](_0x5a40('0x15'),_0x5a40('0x18')),controller[_0x5a40('0x19')]);router[_0x5a40('0x17')](_0x5a40('0x10'),auth[_0x5a40('0x5')](),controller[_0x5a40('0x1a')]);module[_0x5a40('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ca6395c..9f3d179 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 _0x5733=['ENUM','out','sequelize','iconv','DATE','STRING','TEXT','long'];(function(_0x5edb20,_0x2fa491){var _0x53b891=function(_0x4ac134){while(--_0x4ac134){_0x5edb20['push'](_0x5edb20['shift']());}};_0x53b891(++_0x2fa491);}(_0x5733,0x1b2));var _0x3573=function(_0x102c45,_0x2490d0){_0x102c45=_0x102c45-0x0;var _0x2f0b5d=_0x5733[_0x102c45];return _0x2f0b5d;};'use strict';var Sequelize=require(_0x3573('0x0'));var iconv=require(_0x3573('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3573('0x2')]},'disposition':{'type':Sequelize[_0x3573('0x3')]},'secondDisposition':{'type':Sequelize[_0x3573('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3573('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x3573('0x3')](0x1fe)},'to':{'type':Sequelize[_0x3573('0x3')]},'cc':{'type':Sequelize[_0x3573('0x4')](_0x3573('0x5'))},'subject':{'type':Sequelize[_0x3573('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3573('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x3573('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3573('0x6')]('in',_0x3573('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3573('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3573('0x6')]('in',_0x3573('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xfc1a=['exports','DATE','STRING','TEXT','ENUM','out','BOOLEAN','sequelize','iconv'];(function(_0x153963,_0x5bc770){var _0x20c800=function(_0x2fdc87){while(--_0x2fdc87){_0x153963['push'](_0x153963['shift']());}};_0x20c800(++_0x5bc770);}(_0xfc1a,0x1c0));var _0xafc1=function(_0x187341,_0x400dc2){_0x187341=_0x187341-0x0;var _0x561252=_0xfc1a[_0x187341];return _0x561252;};'use strict';var Sequelize=require(_0xafc1('0x0'));var iconv=require(_0xafc1('0x1'));module[_0xafc1('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xafc1('0x3')]},'disposition':{'type':Sequelize[_0xafc1('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xafc1('0x4')]},'note':{'type':Sequelize[_0xafc1('0x4')]},'inReplyTo':{'type':Sequelize[_0xafc1('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xafc1('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xafc1('0x3')]},'substatus':{'type':Sequelize[_0xafc1('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xafc1('0x6')]('in',_0xafc1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xafc1('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xafc1('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xafc1('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3871f8c..b5dd982 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 _0xe4d7=['addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','createdAt','get','mkdirSync','each','from','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','push','readFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','html-entities','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','MailInteraction','rawAttributes','type','key','getOptions','mail','catch','show','params','model','query','keys','filters','intersection','fields','attributes','includeAll','include','options','find','create','body','describe','MailMessage','addMessage','ids','omit','getMessages','length','nolimit','order','sort','where','pick','MailInteractionId','merge','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows'];(function(_0x346b7f,_0xefad2f){var _0x6561b=function(_0x440ad4){while(--_0x440ad4){_0x346b7f['push'](_0x346b7f['shift']());}};_0x6561b(++_0xefad2f);}(_0xe4d7,0x93));var _0x7e4d=function(_0x180237,_0xfd4959){_0x180237=_0x180237-0x0;var _0x56fa74=_0xe4d7[_0x180237];return _0x56fa74;};'use strict';var emlformat=require(_0x7e4d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e4d('0x1'));var moment=require(_0x7e4d('0x2'));var BPromise=require(_0x7e4d('0x3'));var util=require(_0x7e4d('0x4'));var path=require(_0x7e4d('0x5'));var fs=require('fs');var _=require(_0x7e4d('0x6'));var juice=require('juice');var Redis=require(_0x7e4d('0x7'));var interaction=require(_0x7e4d('0x8'));var qs=require(_0x7e4d('0x9'));var logger=require(_0x7e4d('0xa'))('api');var config=require('../../config/environment');var db=require(_0x7e4d('0xb'))['db'];var htmlEntities=require(_0x7e4d('0xc'));config[_0x7e4d('0xd')]=_['defaults'](config[_0x7e4d('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e4d('0xe'))(new Redis(config[_0x7e4d('0xd')]));require(_0x7e4d('0xf'))[_0x7e4d('0x10')](socket);function respondWithStatusCode(_0x47ac6a,_0x595b2e){_0x595b2e=_0x595b2e||0xcc;return function(_0x4ce02b){if(_0x4ce02b){return _0x47ac6a[_0x7e4d('0x11')](_0x595b2e);}return _0x47ac6a[_0x7e4d('0x12')](_0x595b2e)[_0x7e4d('0x13')]();};}function respondWithResult(_0x1c9693,_0x8b181e){_0x8b181e=_0x8b181e||0xc8;return function(_0x4b1de5){if(_0x4b1de5){return _0x1c9693['status'](_0x8b181e)[_0x7e4d('0x14')](_0x4b1de5);}};}function respondWithFilteredResult(_0x2f41da,_0x1fc154){return function(_0xaea138){if(_0xaea138){var _0xa3735b=typeof _0x1fc154[_0x7e4d('0x15')]==='undefined'&&typeof _0x1fc154[_0x7e4d('0x16')]==='undefined';var _0x25227b=_0xaea138[_0x7e4d('0x17')];var _0x194d41=_0xa3735b?0x0:_0x1fc154[_0x7e4d('0x15')];var _0x73ae04=_0xa3735b?_0xaea138[_0x7e4d('0x17')]:_0x1fc154[_0x7e4d('0x15')]+_0x1fc154[_0x7e4d('0x16')];var _0x6411c;if(_0x73ae04>=_0x25227b){_0x73ae04=_0x25227b;_0x6411c=0xc8;}else{_0x6411c=0xce;}_0x2f41da['status'](_0x6411c);return _0x2f41da[_0x7e4d('0x18')](_0x7e4d('0x19'),_0x194d41+'-'+_0x73ae04+'/'+_0x25227b)[_0x7e4d('0x14')](_0xaea138);}return null;};}function saveUpdates(_0x56e5ef){return function(_0x3bde60){if(_0x3bde60){return _0x3bde60[_0x7e4d('0x1a')](_0x56e5ef)[_0x7e4d('0x1b')](function(_0x577a94){return _0x577a94;});}return null;};}function removeEntity(_0x1d3197){return function(_0x3b1f27){if(_0x3b1f27){return _0x3b1f27[_0x7e4d('0x1c')]()[_0x7e4d('0x1b')](function(){_0x1d3197['status'](0xcc)[_0x7e4d('0x13')]();});}};}function handleEntityNotFound(_0x29f278){return function(_0x59f331){if(!_0x59f331){_0x29f278[_0x7e4d('0x11')](0x194);}return _0x59f331;};}function handleError(_0x4925ae,_0x1a2dc2){_0x1a2dc2=_0x1a2dc2||0x1f4;return function(_0x193cfe){logger[_0x7e4d('0x1d')](_0x193cfe[_0x7e4d('0x1e')]);if(_0x193cfe[_0x7e4d('0x1f')]){delete _0x193cfe[_0x7e4d('0x1f')];}_0x4925ae[_0x7e4d('0x12')](_0x1a2dc2)[_0x7e4d('0x20')](_0x193cfe);};}exports[_0x7e4d('0x21')]=function(_0x1495a1,_0x1a160e){var _0x39b1a6={};var _0x1e5e90=_[_0x7e4d('0x22')](db[_0x7e4d('0x23')][_0x7e4d('0x24')],function(_0x138422){return{'name':_0x138422['fieldName'],'type':_0x138422[_0x7e4d('0x25')][_0x7e4d('0x26')]};});_0x39b1a6=qs[_0x7e4d('0x27')](_0x1e5e90,_0x1495a1);return interaction['findAll'](_0x7e4d('0x28'),_0x1495a1['query'],_0x1495a1['user'],_0x39b1a6,_0x1e5e90)['then'](respondWithFilteredResult(_0x1a160e,_0x39b1a6))[_0x7e4d('0x29')](handleError(_0x1a160e,null));};exports[_0x7e4d('0x2a')]=function(_0x52c280,_0x23ae03){var _0x3747be={'raw':![],'where':{'id':_0x52c280[_0x7e4d('0x2b')]['id']}},_0x4ea411={};_0x4ea411[_0x7e4d('0x2c')]=_['keys'](db[_0x7e4d('0x23')][_0x7e4d('0x24')]);_0x4ea411[_0x7e4d('0x2d')]=_[_0x7e4d('0x2e')](_0x52c280[_0x7e4d('0x2d')]);_0x4ea411[_0x7e4d('0x2f')]=_[_0x7e4d('0x30')](_0x4ea411['model'],_0x4ea411['query']);_0x3747be['attributes']=_['intersection'](_0x4ea411[_0x7e4d('0x2c')],qs[_0x7e4d('0x31')](_0x52c280[_0x7e4d('0x2d')][_0x7e4d('0x31')]));_0x3747be[_0x7e4d('0x32')]=_0x3747be[_0x7e4d('0x32')]['length']?_0x3747be[_0x7e4d('0x32')]:_0x4ea411[_0x7e4d('0x2c')];if(_0x52c280[_0x7e4d('0x2d')][_0x7e4d('0x33')]){_0x3747be[_0x7e4d('0x34')]=[{'all':!![]}];}_0x3747be=_['merge']({},_0x3747be,_0x52c280[_0x7e4d('0x35')]);return db[_0x7e4d('0x23')][_0x7e4d('0x36')](_0x3747be)[_0x7e4d('0x1b')](handleEntityNotFound(_0x23ae03,null))[_0x7e4d('0x1b')](respondWithResult(_0x23ae03,null))['catch'](handleError(_0x23ae03,null));};exports[_0x7e4d('0x37')]=function(_0x295496,_0x5ed5c1){return db['MailInteraction'][_0x7e4d('0x37')](_0x295496[_0x7e4d('0x38')],{})[_0x7e4d('0x1b')](respondWithResult(_0x5ed5c1,0xc9))[_0x7e4d('0x29')](handleError(_0x5ed5c1,null));};exports[_0x7e4d('0x1a')]=function(_0x46ed96,_0x7e9a1){if(_0x46ed96[_0x7e4d('0x38')]['id']){delete _0x46ed96[_0x7e4d('0x38')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x46ed96['params']['id']}})['then'](handleEntityNotFound(_0x7e9a1,null))['then'](saveUpdates(_0x46ed96[_0x7e4d('0x38')],null))[_0x7e4d('0x1b')](respondWithResult(_0x7e9a1,null))[_0x7e4d('0x29')](handleError(_0x7e9a1,null));};exports[_0x7e4d('0x1c')]=function(_0x3e1b00,_0x1cc4cf){return db[_0x7e4d('0x23')][_0x7e4d('0x36')]({'where':{'id':_0x3e1b00[_0x7e4d('0x2b')]['id']}})[_0x7e4d('0x1b')](handleEntityNotFound(_0x1cc4cf,null))[_0x7e4d('0x1b')](removeEntity(_0x1cc4cf,null))[_0x7e4d('0x29')](handleError(_0x1cc4cf,null));};exports['describe']=function(_0x444b00,_0x2c6633){return db[_0x7e4d('0x23')][_0x7e4d('0x39')]()[_0x7e4d('0x1b')](respondWithResult(_0x2c6633,null))[_0x7e4d('0x29')](handleError(_0x2c6633,null));};exports['addMessage']=function(_0x8c60fb,_0x6214dd){return db[_0x7e4d('0x3a')][_0x7e4d('0x36')]({'where':{'id':_0x8c60fb[_0x7e4d('0x2b')]['id']}})[_0x7e4d('0x1b')](handleEntityNotFound(_0x6214dd,null))[_0x7e4d('0x1b')](function(_0x370d75){if(_0x370d75){return _0x370d75[_0x7e4d('0x3b')](_0x8c60fb['body'][_0x7e4d('0x3c')],_[_0x7e4d('0x3d')](_0x8c60fb['body'],[_0x7e4d('0x3c'),'id'])||{});}})[_0x7e4d('0x1b')](respondWithResult(_0x6214dd,null))['catch'](handleError(_0x6214dd,null));};exports[_0x7e4d('0x3e')]=function(_0x3ff1ca,_0x94d26a){var _0x3e508e={'raw':![],'where':{}};var _0x47f292={};var _0x585a0a={'count':0x0,'rows':[]};return db[_0x7e4d('0x23')]['findOne']({'where':{'id':_0x3ff1ca['params']['id']}})[_0x7e4d('0x1b')](handleEntityNotFound(_0x94d26a,null))[_0x7e4d('0x1b')](function(_0x3ad3be){if(_0x3ad3be){_0x47f292[_0x7e4d('0x2c')]=_['keys'](db[_0x7e4d('0x3a')][_0x7e4d('0x24')]);_0x47f292[_0x7e4d('0x2d')]=_[_0x7e4d('0x2e')](_0x3ff1ca['query']);_0x47f292[_0x7e4d('0x2f')]=_[_0x7e4d('0x30')](_0x47f292[_0x7e4d('0x2c')],_0x47f292[_0x7e4d('0x2d')]);_0x3e508e[_0x7e4d('0x32')]=_[_0x7e4d('0x30')](_0x47f292[_0x7e4d('0x2c')],qs[_0x7e4d('0x31')](_0x3ff1ca[_0x7e4d('0x2d')][_0x7e4d('0x31')]));_0x3e508e[_0x7e4d('0x32')]=_0x3e508e['attributes'][_0x7e4d('0x3f')]?_0x3e508e[_0x7e4d('0x32')]:_0x47f292[_0x7e4d('0x2c')];if(!_0x3ff1ca[_0x7e4d('0x2d')]['hasOwnProperty'](_0x7e4d('0x40'))){_0x3e508e[_0x7e4d('0x16')]=qs[_0x7e4d('0x16')](_0x3ff1ca[_0x7e4d('0x2d')][_0x7e4d('0x16')]);_0x3e508e['offset']=qs['offset'](_0x3ff1ca['query']['offset']);}_0x3e508e[_0x7e4d('0x41')]=qs[_0x7e4d('0x42')](_0x3ff1ca[_0x7e4d('0x2d')][_0x7e4d('0x42')]);_0x3e508e[_0x7e4d('0x43')]=qs[_0x7e4d('0x2f')](_[_0x7e4d('0x44')](_0x3ff1ca[_0x7e4d('0x2d')],_0x47f292[_0x7e4d('0x2f')]));_0x3e508e['where'][_0x7e4d('0x45')]=_0x3ad3be['id'];if(_0x3ff1ca[_0x7e4d('0x2d')]['filter']){_0x3e508e[_0x7e4d('0x43')]=_[_0x7e4d('0x46')](_0x3e508e[_0x7e4d('0x43')],{'$or':_[_0x7e4d('0x22')](_0x3e508e[_0x7e4d('0x32')],function(_0x35b28b){var _0x487212={};_0x487212[_0x35b28b]={'$like':'%'+_0x3ff1ca[_0x7e4d('0x2d')][_0x7e4d('0x47')]+'%'};return _0x487212;})});}if(_0x3ff1ca[_0x7e4d('0x2d')][_0x7e4d('0x48')]){var _0x20c53d=_0x3ff1ca['query'][_0x7e4d('0x48')][_0x7e4d('0x49')](',');var _0x1d34b7={};_0x1d34b7[_0x20c53d[0x0]]={'$gte':moment(_0x20c53d[0x1])['format'](_0x7e4d('0x4a'))};_0x3e508e['where']=_[_0x7e4d('0x46')](_0x3e508e[_0x7e4d('0x43')],_0x1d34b7);}_0x3e508e=_['merge']({},_0x3e508e,_0x3ff1ca[_0x7e4d('0x35')]);return db[_0x7e4d('0x3a')][_0x7e4d('0x17')]({'where':_0x3e508e[_0x7e4d('0x43')]})[_0x7e4d('0x1b')](function(_0x3b184e){_0x585a0a[_0x7e4d('0x17')]=_0x3b184e;if(_0x3ff1ca[_0x7e4d('0x2d')][_0x7e4d('0x33')]){_0x3e508e['include']=[{'all':!![]}];}return db[_0x7e4d('0x3a')][_0x7e4d('0x4b')](_0x3e508e);})['then'](function(_0x565982){if(_0x3ff1ca['query']['inlineCss']==='true'){for(var _0x2d90c2=0x0;_0x2d90c2<_0x565982[_0x7e4d('0x3f')];_0x2d90c2++){_0x565982[_0x2d90c2][_0x7e4d('0x38')]=juice(_0x565982[_0x2d90c2][_0x7e4d('0x38')]);}}_0x585a0a[_0x7e4d('0x4c')]=_0x565982;return _0x585a0a;});}})[_0x7e4d('0x1b')](respondWithFilteredResult(_0x94d26a,_0x3e508e))['catch'](handleError(_0x94d26a,null));};exports[_0x7e4d('0x4d')]=function(_0x4657e5,_0x354d1e){return db[_0x7e4d('0x23')][_0x7e4d('0x36')]({'where':{'id':_0x4657e5['params']['id']}})[_0x7e4d('0x1b')](handleEntityNotFound(_0x354d1e,null))[_0x7e4d('0x1b')](function(_0x5e51a){if(_0x5e51a){return _0x5e51a[_0x7e4d('0x4e')](_0x4657e5[_0x7e4d('0x38')][_0x7e4d('0x3c')],_[_0x7e4d('0x3d')](_0x4657e5[_0x7e4d('0x38')],['ids','id'])||{})[_0x7e4d('0x4f')](function(){return db[_0x7e4d('0x50')][_0x7e4d('0x4b')]({'attributes':['id',_0x7e4d('0x1f'),_0x7e4d('0x51')],'where':{'id':_0x4657e5[_0x7e4d('0x38')][_0x7e4d('0x3c')]}});})['then'](function(_0x678e1e){socket[_0x7e4d('0x52')](_0x7e4d('0x53'),{'id':Number(_0x4657e5[_0x7e4d('0x2b')]['id']),'tags':_0x678e1e||[]});return{'id':Number(_0x4657e5[_0x7e4d('0x2b')]['id']),'tags':_0x678e1e||[]};});}})[_0x7e4d('0x1b')](respondWithResult(_0x354d1e,null))[_0x7e4d('0x29')](handleError(_0x354d1e,null));};exports[_0x7e4d('0x54')]=function(_0x31146b,_0x3d3b3c){return db[_0x7e4d('0x23')][_0x7e4d('0x36')]({'where':{'id':_0x31146b[_0x7e4d('0x2b')]['id']}})[_0x7e4d('0x1b')](handleEntityNotFound(_0x3d3b3c,null))[_0x7e4d('0x1b')](function(_0x10e50e){if(_0x10e50e){return _0x10e50e[_0x7e4d('0x54')](_0x31146b[_0x7e4d('0x2d')]['ids']);}})['then'](respondWithStatusCode(_0x3d3b3c,null))[_0x7e4d('0x29')](handleError(_0x3d3b3c,null));};exports[_0x7e4d('0x55')]=function(_0x32ab96,_0x311f96){var _0x123329=moment()[_0x7e4d('0x56')]()[_0x7e4d('0x57')]();var _0x3bf5d3=path[_0x7e4d('0x58')](config[_0x7e4d('0x59')],_0x7e4d('0x5a'),'files','tmp');var _0x54701a=path[_0x7e4d('0x58')](config[_0x7e4d('0x59')],_0x7e4d('0x5a'),_0x7e4d('0x5b'),_0x7e4d('0x5c'));var _0x6b487c=path['join'](_0x3bf5d3,_0x123329);var _0x597aa4=util['format'](_0x7e4d('0x5d'),_0x32ab96['params']['id'],_0x123329);var _0x4e5992=path[_0x7e4d('0x58')](_0x3bf5d3,_0x597aa4);var _0x3d85cc=[];if(_0x32ab96[_0x7e4d('0x2d')]['attachments']){_0x3d85cc['push']({'model':db[_0x7e4d('0x5e')],'as':_0x7e4d('0x5f'),'raw':!![]});}var _0x32352b=[{'model':db[_0x7e4d('0x3a')],'as':_0x7e4d('0x60'),'attributes':['id','body','from','to','cc','bcc',_0x7e4d('0x61'),_0x7e4d('0x62')],'where':{'secret':![]},'order':qs[_0x7e4d('0x42')]('id'),'include':_0x3d85cc}];return db[_0x7e4d('0x23')][_0x7e4d('0x36')]({'where':{'id':_0x32ab96['params']['id']},'include':_0x32352b})[_0x7e4d('0x1b')](handleEntityNotFound(_0x311f96,null))[_0x7e4d('0x1b')](function(_0x2c3fed){if(_0x2c3fed&&_0x2c3fed[_0x7e4d('0x60')]){var _0x129694=_0x2c3fed[_0x7e4d('0x63')]({'plain':!![]});fs[_0x7e4d('0x64')](_0x6b487c);return BPromise[_0x7e4d('0x65')](_0x129694[_0x7e4d('0x60')],function(_0x18aea5,_0x34c0c3){var _0x86ce2a={'from':_0x18aea5[_0x7e4d('0x66')],'to':_0x18aea5['to']||'missing.recipient@your.company.com','subject':_0x18aea5[_0x7e4d('0x61')],'html':htmlEntities['decode'](_0x18aea5[_0x7e4d('0x38')]),'headers':{'Date':moment(_0x18aea5[_0x7e4d('0x62')])[_0x7e4d('0x67')](_0x7e4d('0x68'))},'attachments':[]};if(_0x18aea5['cc']){_0x86ce2a[_0x7e4d('0x69')]['Cc']=_0x18aea5['cc'];}if(_0x18aea5[_0x7e4d('0x6a')]){_0x86ce2a[_0x7e4d('0x69')]['Bcc']=_0x18aea5[_0x7e4d('0x6a')];}return new BPromise(function(_0x5e94f7,_0x2562b2){if(_0x18aea5[_0x7e4d('0x5f')]){for(var _0x2f81d9=0x0;_0x2f81d9<_0x18aea5['Attachments'][_0x7e4d('0x3f')];_0x2f81d9++){var _0x476b30=_0x18aea5[_0x7e4d('0x5f')][_0x2f81d9];var _0x5bbd85=path['join'](_0x54701a,_0x476b30[_0x7e4d('0x6b')]);if(fs['existsSync'](_0x5bbd85)){_0x86ce2a[_0x7e4d('0x5c')][_0x7e4d('0x6c')]({'name':_0x476b30[_0x7e4d('0x1f')],'contentType':_0x476b30[_0x7e4d('0x25')],'data':fs[_0x7e4d('0x6d')](_0x5bbd85)});}}}emlformat['build'](_0x86ce2a,function(_0x3320a4,_0x523926){if(_0x3320a4)return _0x2562b2(_0x3320a4);fs['writeFileSync'](path[_0x7e4d('0x58')](_0x6b487c,util['format'](_0x7e4d('0x6e'),_0x34c0c3)),_0x523926);return _0x5e94f7(_0x523926);});});})[_0x7e4d('0x1b')](function(){return new BPromise(function(_0xf58e01,_0x3720d4){zipdir(_0x6b487c,{'saveTo':_0x4e5992},function(_0x139304,_0x12c462){if(_0x139304)return _0x3720d4(_0x139304);return _0xf58e01(_0x12c462);});})['then'](function(){return new BPromise(function(_0x2c8cf7,_0x153d81){rimraf(_0x6b487c,function(_0x2bd368){if(_0x2bd368)_0x153d81(_0x2bd368);return _0x2c8cf7();});});})[_0x7e4d('0x1b')](function(){return _0x311f96[_0x7e4d('0x55')](_0x4e5992,_0x597aa4,function(_0x5aade2){if(!_0x5aade2)fs[_0x7e4d('0x6f')](_0x4e5992);});});});}else{return _0x311f96[_0x7e4d('0x11')](0xc8);}})[_0x7e4d('0x29')](handleError(_0x311f96,null));}; \ No newline at end of file +var _0xb4b0=['join','format','transcript-%d-%s.zip','push','from','bcc','subject','createdAt','Messages','get','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','type','readFileSync','build','writeFileSync','message%d.eml','rimraf','zip-dir','bluebird','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','status','end','limit','offset','Content-Range','json','update','then','sendStatus','error','stack','name','MailInteraction','fieldName','findAll','mail','query','show','rawAttributes','keys','filters','intersection','model','attributes','fields','includeAll','include','merge','options','find','catch','create','body','destroy','params','describe','ids','getMessages','MailMessage','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','inlineCss','true','length','rows','addTags','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','toString','root','server','files','tmp','attachments'];(function(_0x4da566,_0x3778f8){var _0x1da163=function(_0x1e6759){while(--_0x1e6759){_0x4da566['push'](_0x4da566['shift']());}};_0x1da163(++_0x3778f8);}(_0xb4b0,0x89));var _0x0b4b=function(_0x46492d,_0x7296f4){_0x46492d=_0x46492d-0x0;var _0x113bb5=_0xb4b0[_0x46492d];return _0x113bb5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b4b('0x0'));var zipdir=require(_0x0b4b('0x1'));var moment=require('moment');var BPromise=require(_0x0b4b('0x2'));var util=require(_0x0b4b('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0b4b('0x4'));var juice=require(_0x0b4b('0x5'));var Redis=require(_0x0b4b('0x6'));var interaction=require(_0x0b4b('0x7'));var qs=require(_0x0b4b('0x8'));var logger=require(_0x0b4b('0x9'))(_0x0b4b('0xa'));var config=require(_0x0b4b('0xb'));var db=require(_0x0b4b('0xc'))['db'];var htmlEntities=require(_0x0b4b('0xd'));config[_0x0b4b('0xe')]=_[_0x0b4b('0xf')](config[_0x0b4b('0xe')],{'host':_0x0b4b('0x10'),'port':0x18eb});var socket=require(_0x0b4b('0x11'))(new Redis(config[_0x0b4b('0xe')]));require('./mailInteraction.socket')[_0x0b4b('0x12')](socket);function respondWithStatusCode(_0x26be05,_0x82f5a8){_0x82f5a8=_0x82f5a8||0xcc;return function(_0x27f80f){if(_0x27f80f){return _0x26be05['sendStatus'](_0x82f5a8);}return _0x26be05[_0x0b4b('0x13')](_0x82f5a8)[_0x0b4b('0x14')]();};}function respondWithResult(_0x1f6106,_0x36e372){_0x36e372=_0x36e372||0xc8;return function(_0x2c4da8){if(_0x2c4da8){return _0x1f6106[_0x0b4b('0x13')](_0x36e372)['json'](_0x2c4da8);}};}function respondWithFilteredResult(_0x449a6c,_0x217817){return function(_0x562144){if(_0x562144){var _0xef8427=typeof _0x217817['offset']==='undefined'&&typeof _0x217817[_0x0b4b('0x15')]==='undefined';var _0x475fb2=_0x562144['count'];var _0x27302e=_0xef8427?0x0:_0x217817['offset'];var _0x1737ce=_0xef8427?_0x562144['count']:_0x217817[_0x0b4b('0x16')]+_0x217817[_0x0b4b('0x15')];var _0x400901;if(_0x1737ce>=_0x475fb2){_0x1737ce=_0x475fb2;_0x400901=0xc8;}else{_0x400901=0xce;}_0x449a6c[_0x0b4b('0x13')](_0x400901);return _0x449a6c['set'](_0x0b4b('0x17'),_0x27302e+'-'+_0x1737ce+'/'+_0x475fb2)[_0x0b4b('0x18')](_0x562144);}return null;};}function saveUpdates(_0x369803){return function(_0x43c786){if(_0x43c786){return _0x43c786[_0x0b4b('0x19')](_0x369803)[_0x0b4b('0x1a')](function(_0xaca216){return _0xaca216;});}return null;};}function removeEntity(_0xe6c02f){return function(_0x11bd2e){if(_0x11bd2e){return _0x11bd2e['destroy']()[_0x0b4b('0x1a')](function(){_0xe6c02f[_0x0b4b('0x13')](0xcc)[_0x0b4b('0x14')]();});}};}function handleEntityNotFound(_0xa74937){return function(_0xc3a990){if(!_0xc3a990){_0xa74937[_0x0b4b('0x1b')](0x194);}return _0xc3a990;};}function handleError(_0x262856,_0x2bc345){_0x2bc345=_0x2bc345||0x1f4;return function(_0x2d5d98){logger[_0x0b4b('0x1c')](_0x2d5d98[_0x0b4b('0x1d')]);if(_0x2d5d98[_0x0b4b('0x1e')]){delete _0x2d5d98[_0x0b4b('0x1e')];}_0x262856[_0x0b4b('0x13')](_0x2bc345)['send'](_0x2d5d98);};}exports['index']=function(_0x119eb8,_0xb4e8b4){var _0x1fa174={};var _0x344d8e=_['map'](db[_0x0b4b('0x1f')]['rawAttributes'],function(_0x4d3c12){return{'name':_0x4d3c12[_0x0b4b('0x20')],'type':_0x4d3c12['type']['key']};});_0x1fa174=qs['getOptions'](_0x344d8e,_0x119eb8);return interaction[_0x0b4b('0x21')](_0x0b4b('0x22'),_0x119eb8[_0x0b4b('0x23')],_0x119eb8['user'],_0x1fa174,_0x344d8e)['then'](respondWithFilteredResult(_0xb4e8b4,_0x1fa174))['catch'](handleError(_0xb4e8b4,null));};exports[_0x0b4b('0x24')]=function(_0x33358e,_0x25668a){var _0x128548={'raw':![],'where':{'id':_0x33358e['params']['id']}},_0x2668d5={};_0x2668d5['model']=_['keys'](db[_0x0b4b('0x1f')][_0x0b4b('0x25')]);_0x2668d5['query']=_[_0x0b4b('0x26')](_0x33358e[_0x0b4b('0x23')]);_0x2668d5[_0x0b4b('0x27')]=_[_0x0b4b('0x28')](_0x2668d5[_0x0b4b('0x29')],_0x2668d5[_0x0b4b('0x23')]);_0x128548[_0x0b4b('0x2a')]=_[_0x0b4b('0x28')](_0x2668d5[_0x0b4b('0x29')],qs[_0x0b4b('0x2b')](_0x33358e[_0x0b4b('0x23')]['fields']));_0x128548['attributes']=_0x128548[_0x0b4b('0x2a')]['length']?_0x128548[_0x0b4b('0x2a')]:_0x2668d5[_0x0b4b('0x29')];if(_0x33358e['query'][_0x0b4b('0x2c')]){_0x128548[_0x0b4b('0x2d')]=[{'all':!![]}];}_0x128548=_[_0x0b4b('0x2e')]({},_0x128548,_0x33358e[_0x0b4b('0x2f')]);return db[_0x0b4b('0x1f')][_0x0b4b('0x30')](_0x128548)[_0x0b4b('0x1a')](handleEntityNotFound(_0x25668a,null))[_0x0b4b('0x1a')](respondWithResult(_0x25668a,null))[_0x0b4b('0x31')](handleError(_0x25668a,null));};exports[_0x0b4b('0x32')]=function(_0x11edcf,_0x3abc4b){return db['MailInteraction'][_0x0b4b('0x32')](_0x11edcf['body'],{})[_0x0b4b('0x1a')](respondWithResult(_0x3abc4b,0xc9))[_0x0b4b('0x31')](handleError(_0x3abc4b,null));};exports[_0x0b4b('0x19')]=function(_0x5e3273,_0x1a1f16){if(_0x5e3273['body']['id']){delete _0x5e3273['body']['id'];}return db[_0x0b4b('0x1f')][_0x0b4b('0x30')]({'where':{'id':_0x5e3273['params']['id']}})[_0x0b4b('0x1a')](handleEntityNotFound(_0x1a1f16,null))[_0x0b4b('0x1a')](saveUpdates(_0x5e3273[_0x0b4b('0x33')],null))['then'](respondWithResult(_0x1a1f16,null))[_0x0b4b('0x31')](handleError(_0x1a1f16,null));};exports[_0x0b4b('0x34')]=function(_0x22143c,_0xd3f859){return db['MailInteraction'][_0x0b4b('0x30')]({'where':{'id':_0x22143c[_0x0b4b('0x35')]['id']}})[_0x0b4b('0x1a')](handleEntityNotFound(_0xd3f859,null))[_0x0b4b('0x1a')](removeEntity(_0xd3f859,null))[_0x0b4b('0x31')](handleError(_0xd3f859,null));};exports[_0x0b4b('0x36')]=function(_0x551486,_0x30381c){return db[_0x0b4b('0x1f')][_0x0b4b('0x36')]()[_0x0b4b('0x1a')](respondWithResult(_0x30381c,null))[_0x0b4b('0x31')](handleError(_0x30381c,null));};exports['addMessage']=function(_0x4b5349,_0x8b4314){return db['MailMessage']['find']({'where':{'id':_0x4b5349[_0x0b4b('0x35')]['id']}})[_0x0b4b('0x1a')](handleEntityNotFound(_0x8b4314,null))[_0x0b4b('0x1a')](function(_0x26e565){if(_0x26e565){return _0x26e565['addMessage'](_0x4b5349[_0x0b4b('0x33')][_0x0b4b('0x37')],_['omit'](_0x4b5349[_0x0b4b('0x33')],[_0x0b4b('0x37'),'id'])||{});}})[_0x0b4b('0x1a')](respondWithResult(_0x8b4314,null))[_0x0b4b('0x31')](handleError(_0x8b4314,null));};exports[_0x0b4b('0x38')]=function(_0x430bc6,_0x2809e2){var _0x30433a={'raw':![],'where':{}};var _0x485a33={};var _0x39c342={'count':0x0,'rows':[]};return db[_0x0b4b('0x1f')]['findOne']({'where':{'id':_0x430bc6[_0x0b4b('0x35')]['id']}})[_0x0b4b('0x1a')](handleEntityNotFound(_0x2809e2,null))[_0x0b4b('0x1a')](function(_0x49ed1b){if(_0x49ed1b){_0x485a33[_0x0b4b('0x29')]=_[_0x0b4b('0x26')](db[_0x0b4b('0x39')][_0x0b4b('0x25')]);_0x485a33['query']=_[_0x0b4b('0x26')](_0x430bc6[_0x0b4b('0x23')]);_0x485a33['filters']=_[_0x0b4b('0x28')](_0x485a33[_0x0b4b('0x29')],_0x485a33[_0x0b4b('0x23')]);_0x30433a[_0x0b4b('0x2a')]=_[_0x0b4b('0x28')](_0x485a33['model'],qs['fields'](_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x2b')]));_0x30433a[_0x0b4b('0x2a')]=_0x30433a[_0x0b4b('0x2a')]['length']?_0x30433a['attributes']:_0x485a33[_0x0b4b('0x29')];if(!_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x3a')](_0x0b4b('0x3b'))){_0x30433a[_0x0b4b('0x15')]=qs['limit'](_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x15')]);_0x30433a[_0x0b4b('0x16')]=qs[_0x0b4b('0x16')](_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x16')]);}_0x30433a[_0x0b4b('0x3c')]=qs['sort'](_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x3d')]);_0x30433a[_0x0b4b('0x3e')]=qs[_0x0b4b('0x27')](_[_0x0b4b('0x3f')](_0x430bc6[_0x0b4b('0x23')],_0x485a33[_0x0b4b('0x27')]));_0x30433a[_0x0b4b('0x3e')][_0x0b4b('0x40')]=_0x49ed1b['id'];if(_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x41')]){_0x30433a[_0x0b4b('0x3e')]=_[_0x0b4b('0x2e')](_0x30433a[_0x0b4b('0x3e')],{'$or':_[_0x0b4b('0x42')](_0x30433a['attributes'],function(_0x4c0aeb){var _0x180758={};_0x180758[_0x4c0aeb]={'$like':'%'+_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x41')]+'%'};return _0x180758;})});}if(_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x43')]){var _0x10d773=_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x43')][_0x0b4b('0x44')](',');var _0x1b7936={};_0x1b7936[_0x10d773[0x0]]={'$gte':moment(_0x10d773[0x1])['format'](_0x0b4b('0x45'))};_0x30433a[_0x0b4b('0x3e')]=_[_0x0b4b('0x2e')](_0x30433a['where'],_0x1b7936);}_0x30433a=_[_0x0b4b('0x2e')]({},_0x30433a,_0x430bc6['options']);return db[_0x0b4b('0x39')][_0x0b4b('0x46')]({'where':_0x30433a[_0x0b4b('0x3e')]})[_0x0b4b('0x1a')](function(_0xe47cb8){_0x39c342['count']=_0xe47cb8;if(_0x430bc6['query'][_0x0b4b('0x2c')]){_0x30433a[_0x0b4b('0x2d')]=[{'all':!![]}];}return db[_0x0b4b('0x39')][_0x0b4b('0x21')](_0x30433a);})[_0x0b4b('0x1a')](function(_0x480fb7){if(_0x430bc6['query'][_0x0b4b('0x47')]===_0x0b4b('0x48')){for(var _0x5d24f0=0x0;_0x5d24f0<_0x480fb7[_0x0b4b('0x49')];_0x5d24f0++){_0x480fb7[_0x5d24f0][_0x0b4b('0x33')]=juice(_0x480fb7[_0x5d24f0]['body']);}}_0x39c342[_0x0b4b('0x4a')]=_0x480fb7;return _0x39c342;});}})[_0x0b4b('0x1a')](respondWithFilteredResult(_0x2809e2,_0x30433a))['catch'](handleError(_0x2809e2,null));};exports[_0x0b4b('0x4b')]=function(_0xaa965d,_0x1fbdaa){return db['MailInteraction'][_0x0b4b('0x30')]({'where':{'id':_0xaa965d[_0x0b4b('0x35')]['id']}})['then'](handleEntityNotFound(_0x1fbdaa,null))[_0x0b4b('0x1a')](function(_0xc415e1){if(_0xc415e1){return _0xc415e1[_0x0b4b('0x4c')](_0xaa965d[_0x0b4b('0x33')][_0x0b4b('0x37')],_[_0x0b4b('0x4d')](_0xaa965d[_0x0b4b('0x33')],[_0x0b4b('0x37'),'id'])||{})[_0x0b4b('0x4e')](function(){return db[_0x0b4b('0x4f')]['findAll']({'attributes':['id',_0x0b4b('0x1e'),_0x0b4b('0x50')],'where':{'id':_0xaa965d['body']['ids']}});})[_0x0b4b('0x1a')](function(_0x41769d){socket[_0x0b4b('0x51')](_0x0b4b('0x52'),{'id':Number(_0xaa965d[_0x0b4b('0x35')]['id']),'tags':_0x41769d||[]});return{'id':Number(_0xaa965d['params']['id']),'tags':_0x41769d||[]};});}})[_0x0b4b('0x1a')](respondWithResult(_0x1fbdaa,null))[_0x0b4b('0x31')](handleError(_0x1fbdaa,null));};exports[_0x0b4b('0x53')]=function(_0x3de3ab,_0x5a00fb){return db[_0x0b4b('0x1f')][_0x0b4b('0x30')]({'where':{'id':_0x3de3ab[_0x0b4b('0x35')]['id']}})[_0x0b4b('0x1a')](handleEntityNotFound(_0x5a00fb,null))['then'](function(_0x478551){if(_0x478551){return _0x478551['removeTags'](_0x3de3ab[_0x0b4b('0x23')][_0x0b4b('0x37')]);}})[_0x0b4b('0x1a')](respondWithStatusCode(_0x5a00fb,null))[_0x0b4b('0x31')](handleError(_0x5a00fb,null));};exports[_0x0b4b('0x54')]=function(_0x1f65c2,_0x153fef){var _0xfe515c=moment()['unix']()[_0x0b4b('0x55')]();var _0x33e25e=path['join'](config[_0x0b4b('0x56')],_0x0b4b('0x57'),_0x0b4b('0x58'),_0x0b4b('0x59'));var _0x358270=path['join'](config[_0x0b4b('0x56')],'server',_0x0b4b('0x58'),_0x0b4b('0x5a'));var _0x38f0d2=path[_0x0b4b('0x5b')](_0x33e25e,_0xfe515c);var _0x518e85=util[_0x0b4b('0x5c')](_0x0b4b('0x5d'),_0x1f65c2[_0x0b4b('0x35')]['id'],_0xfe515c);var _0x5e2cba=path[_0x0b4b('0x5b')](_0x33e25e,_0x518e85);var _0x59859d=[];if(_0x1f65c2[_0x0b4b('0x23')][_0x0b4b('0x5a')]){_0x59859d[_0x0b4b('0x5e')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0xbb1057=[{'model':db[_0x0b4b('0x39')],'as':'Messages','attributes':['id',_0x0b4b('0x33'),_0x0b4b('0x5f'),'to','cc',_0x0b4b('0x60'),_0x0b4b('0x61'),_0x0b4b('0x62')],'where':{'secret':![]},'order':qs[_0x0b4b('0x3d')]('id'),'include':_0x59859d}];return db[_0x0b4b('0x1f')][_0x0b4b('0x30')]({'where':{'id':_0x1f65c2[_0x0b4b('0x35')]['id']},'include':_0xbb1057})[_0x0b4b('0x1a')](handleEntityNotFound(_0x153fef,null))[_0x0b4b('0x1a')](function(_0x4bd088){if(_0x4bd088&&_0x4bd088[_0x0b4b('0x63')]){var _0x4da14b=_0x4bd088[_0x0b4b('0x64')]({'plain':!![]});fs[_0x0b4b('0x65')](_0x38f0d2);return BPromise[_0x0b4b('0x66')](_0x4da14b['Messages'],function(_0x52249c,_0x12dcdd){var _0x54771b={'from':_0x52249c[_0x0b4b('0x5f')],'to':_0x52249c['to']||_0x0b4b('0x67'),'subject':_0x52249c['subject'],'html':htmlEntities['decode'](_0x52249c[_0x0b4b('0x33')]),'headers':{'Date':moment(_0x52249c[_0x0b4b('0x62')])['format'](_0x0b4b('0x68'))},'attachments':[]};if(_0x52249c['cc']){_0x54771b[_0x0b4b('0x69')]['Cc']=_0x52249c['cc'];}if(_0x52249c[_0x0b4b('0x60')]){_0x54771b[_0x0b4b('0x69')]['Bcc']=_0x52249c[_0x0b4b('0x60')];}return new BPromise(function(_0x2c8b5e,_0x319da5){if(_0x52249c[_0x0b4b('0x6a')]){for(var _0x3c55f3=0x0;_0x3c55f3<_0x52249c[_0x0b4b('0x6a')][_0x0b4b('0x49')];_0x3c55f3++){var _0x1c6db3=_0x52249c[_0x0b4b('0x6a')][_0x3c55f3];var _0x15addb=path[_0x0b4b('0x5b')](_0x358270,_0x1c6db3[_0x0b4b('0x6b')]);if(fs[_0x0b4b('0x6c')](_0x15addb)){_0x54771b[_0x0b4b('0x5a')][_0x0b4b('0x5e')]({'name':_0x1c6db3['name'],'contentType':_0x1c6db3[_0x0b4b('0x6d')],'data':fs[_0x0b4b('0x6e')](_0x15addb)});}}}emlformat[_0x0b4b('0x6f')](_0x54771b,function(_0x33f346,_0x8fe309){if(_0x33f346)return _0x319da5(_0x33f346);fs[_0x0b4b('0x70')](path[_0x0b4b('0x5b')](_0x38f0d2,util['format'](_0x0b4b('0x71'),_0x12dcdd)),_0x8fe309);return _0x2c8b5e(_0x8fe309);});});})[_0x0b4b('0x1a')](function(){return new BPromise(function(_0x391c4c,_0x2a7cc0){zipdir(_0x38f0d2,{'saveTo':_0x5e2cba},function(_0x1d5341,_0xe6c9f2){if(_0x1d5341)return _0x2a7cc0(_0x1d5341);return _0x391c4c(_0xe6c9f2);});})[_0x0b4b('0x1a')](function(){return new BPromise(function(_0x2e3734,_0xc2422b){rimraf(_0x38f0d2,function(_0x61c44){if(_0x61c44)_0xc2422b(_0x61c44);return _0x2e3734();});});})['then'](function(){return _0x153fef[_0x0b4b('0x54')](_0x5e2cba,_0x518e85,function(_0x48da63){if(!_0x48da63)fs['unlinkSync'](_0x5e2cba);});});});}else{return _0x153fef[_0x0b4b('0x1b')](0xc8);}})['catch'](handleError(_0x153fef,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a07cdb0..17bb1b8 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 _0xd251=['../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','then','setDataValue','Users','map','length','hasOwnProperty','hook'];(function(_0x132720,_0x3b86d1){var _0xc66e45=function(_0x44b071){while(--_0x44b071){_0x132720['push'](_0x132720['shift']());}};_0xc66e45(++_0x3b86d1);}(_0xd251,0xfc));var _0x1d25=function(_0x565c57,_0x1805ff){_0x565c57=_0x565c57-0x0;var _0x583c5b=_0xd251[_0x565c57];return _0x583c5b;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x1d25('0x0'))['db'][_0x1d25('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x1d25('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1d25('0x3'),'afterUpdate':_0x1d25('0x4'),'afterDestroy':_0x1d25('0x5')};function emitEvent(_0x238e67){return function(_0x3f746f,_0x2a9eb5,_0x21b8d2){_0x3f746f[_0x1d25('0x6')]({'attributes':['id'],'raw':!![]})[_0x1d25('0x7')](function(_0x3a734e){_0x3f746f[_0x1d25('0x8')](_0x1d25('0x9'),_0x3a734e[_0x1d25('0xa')](function(_0x306037){return{'id':_0x306037['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3f746f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x24a5fc){_0x3f746f[_0x1d25('0x8')]('unreadMessages',_0x24a5fc[_0x1d25('0xb')]);MailInteractionEvents['emit'](_0x238e67+':'+_0x3f746f['id'],_0x3f746f);MailInteractionEvents['emit'](_0x238e67,_0x3f746f);_0x21b8d2(null);})['catch'](_0x21b8d2(null));};}for(var e in events){if(events[_0x1d25('0xc')](e)){var event=events[e];MailInteraction[_0x1d25('0xd')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x347a=['../../mysqldb','MailMessage','update','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','length','catch','hook','exports','events','MailInteraction'];(function(_0x407236,_0x4e45db){var _0x1c823e=function(_0x32cd8b){while(--_0x32cd8b){_0x407236['push'](_0x407236['shift']());}};_0x1c823e(++_0x4e45db);}(_0x347a,0x16e));var _0xa347=function(_0x1bfd25,_0x349005){_0x1bfd25=_0x1bfd25-0x0;var _0x11804d=_0x347a[_0x1bfd25];return _0x11804d;};'use strict';var EventEmitter=require(_0xa347('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xa347('0x1')];var MailMessage=require(_0xa347('0x2'))['db'][_0xa347('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa347('0x4'),'afterDestroy':_0xa347('0x5')};function emitEvent(_0x4d146a){return function(_0x240727,_0x9e8f1e,_0x7d35aa){_0x240727[_0xa347('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x14b381){_0x240727[_0xa347('0x7')](_0xa347('0x8'),_0x14b381[_0xa347('0x9')](function(_0x5c9674){return{'id':_0x5c9674['id']};}));return MailMessage[_0xa347('0xa')]({'where':{'MailInteractionId':_0x240727['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x29567a){_0x240727[_0xa347('0x7')](_0xa347('0xb'),_0x29567a[_0xa347('0xc')]);MailInteractionEvents['emit'](_0x4d146a+':'+_0x240727['id'],_0x240727);MailInteractionEvents['emit'](_0x4d146a,_0x240727);_0x7d35aa(null);})[_0xa347('0xd')](_0x7d35aa(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xa347('0xe')](e,emitEvent(event));}}module[_0xa347('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 815053a..486c825 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 _0x86bb=['get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','mail_interactions','fti_mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models'];(function(_0x58ba5a,_0x5cd3b2){var _0x4d711f=function(_0x9c28d6){while(--_0x9c28d6){_0x58ba5a['push'](_0x58ba5a['shift']());}};_0x4d711f(++_0x5cd3b2);}(_0x86bb,0x156));var _0xb86b=function(_0x35cb03,_0x578e9d){_0x35cb03=_0x35cb03-0x0;var _0x696377=_0x86bb[_0x35cb03];return _0x696377;};'use strict';var _=require(_0xb86b('0x0'));var util=require(_0xb86b('0x1'));var logger=require(_0xb86b('0x2'))(_0xb86b('0x3'));var moment=require(_0xb86b('0x4'));var BPromise=require(_0xb86b('0x5'));var rp=require(_0xb86b('0x6'));var fs=require('fs');var path=require(_0xb86b('0x7'));var rimraf=require(_0xb86b('0x8'));var config=require(_0xb86b('0x9'));var attributes=require(_0xb86b('0xa'));module[_0xb86b('0xb')]=function(_0x449a83,_0x9d7c94){return _0x449a83['define']('MailInteraction',attributes,{'tableName':_0xb86b('0xc'),'paranoid':![],'indexes':[{'name':_0xb86b('0xd'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2169ab,_0x1de27f,_0x5c1390){if(_0x2169ab[_0xb86b('0xe')]){_0x2169ab[_0xb86b('0xf')]=moment()[_0xb86b('0x10')](_0xb86b('0x11'));}if(_0x2169ab[_0xb86b('0x12')]){_0x2169ab[_0xb86b('0x13')]=moment()[_0xb86b('0x10')](_0xb86b('0x11'));}_0x5c1390(null,_0x1de27f);},'beforeUpdate':function(_0x5bc55c,_0x59e91d,_0x19bf3a){if(_0x5bc55c[_0xb86b('0x14')](_0xb86b('0xe'))){_0x5bc55c[_0xb86b('0xf')]=_0x5bc55c['substatus']?moment()[_0xb86b('0x10')](_0xb86b('0x11')):null;}if(_0x5bc55c[_0xb86b('0x14')]('closed')){_0x5bc55c[_0xb86b('0x13')]=moment()['format'](_0xb86b('0x11'));_0x5bc55c['substatus']=null;_0x5bc55c[_0xb86b('0xf')]=null;}_0x19bf3a(null,_0x5bc55c);},'afterUpdate':function(_0x18e1c5,_0x516af9,_0x250dc0){var _0x39718b=_0x449a83[_0xb86b('0x15')];var _0x3a0f68=_0x18e1c5[_0xb86b('0x16')]({'plain':!![]});if(_0x3a0f68[_0xb86b('0x12')]){return _0x39718b[_0xb86b('0x17')][_0xb86b('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x3a0f68['id']}})['then'](function(){_0x250dc0();})[_0xb86b('0x19')](function(_0x284541){_0x250dc0(_0x284541);});}else{_0x250dc0();}}},'charset':_0xb86b('0x1a'),'collate':_0xb86b('0x1b')});}; \ No newline at end of file +var _0xa73b=['./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','closed','models','get','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0xb73ab5,_0x57f8a6){var _0xa60755=function(_0x49b8dd){while(--_0x49b8dd){_0xb73ab5['push'](_0xb73ab5['shift']());}};_0xa60755(++_0x57f8a6);}(_0xa73b,0x173));var _0xba73=function(_0x1a1514,_0xf55b89){_0x1a1514=_0x1a1514-0x0;var _0x4a78f1=_0xa73b[_0x1a1514];return _0x4a78f1;};'use strict';var _=require(_0xba73('0x0'));var util=require(_0xba73('0x1'));var logger=require(_0xba73('0x2'))('api');var moment=require(_0xba73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xba73('0x4'));var rimraf=require(_0xba73('0x5'));var config=require(_0xba73('0x6'));var attributes=require(_0xba73('0x7'));module[_0xba73('0x8')]=function(_0x512b84,_0x14cbf8){return _0x512b84[_0xba73('0x9')](_0xba73('0xa'),attributes,{'tableName':_0xba73('0xb'),'paranoid':![],'indexes':[{'name':_0xba73('0xc'),'fields':[_0xba73('0xd'),'to'],'type':_0xba73('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d1280,_0xfdaadd,_0x5ebfc5){if(_0x4d1280[_0xba73('0xf')]){_0x4d1280['substatusAt']=moment()['format'](_0xba73('0x10'));}if(_0x4d1280['closed']){_0x4d1280[_0xba73('0x11')]=moment()[_0xba73('0x12')](_0xba73('0x10'));}_0x5ebfc5(null,_0xfdaadd);},'beforeUpdate':function(_0x1bac08,_0x37826d,_0x2b9e70){if(_0x1bac08['changed'](_0xba73('0xf'))){_0x1bac08['substatusAt']=_0x1bac08[_0xba73('0xf')]?moment()[_0xba73('0x12')](_0xba73('0x10')):null;}if(_0x1bac08[_0xba73('0x13')](_0xba73('0x14'))){_0x1bac08[_0xba73('0x11')]=moment()[_0xba73('0x12')](_0xba73('0x10'));_0x1bac08[_0xba73('0xf')]=null;_0x1bac08['substatusAt']=null;}_0x2b9e70(null,_0x1bac08);},'afterUpdate':function(_0xb4f575,_0x2c683d,_0x51b1f7){var _0x467f06=_0x512b84[_0xba73('0x15')];var _0x4d161c=_0xb4f575[_0xba73('0x16')]({'plain':!![]});if(_0x4d161c['closed']){return _0x467f06['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x4d161c['id']}})[_0xba73('0x17')](function(){_0x51b1f7();})[_0xba73('0x18')](function(_0x5e49e1){_0x51b1f7(_0x5e49e1);});}else{_0x51b1f7();}}},'charset':_0xba73('0x19'),'collate':_0xba73('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 8788762..077f4d9 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 _0xb067=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','redis','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','find','ids','omit','AddTags','stringify','util','moment'];(function(_0x35760b,_0x223d79){var _0x1c80c9=function(_0x147755){while(--_0x147755){_0x35760b['push'](_0x35760b['shift']());}};_0x1c80c9(++_0x223d79);}(_0xb067,0xc1));var _0x7b06=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb067[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x7b06('0x0'));var moment=require(_0x7b06('0x1'));var BPromise=require(_0x7b06('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b06('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b06('0x4'));var logger=require(_0x7b06('0x5'))(_0x7b06('0x6'));var config=require(_0x7b06('0x7'));var jayson=require(_0x7b06('0x8'));var client=jayson[_0x7b06('0x9')][_0x7b06('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7b06('0xb'))(new Redis(config[_0x7b06('0xc')]));require(_0x7b06('0xd'))[_0x7b06('0xe')](socket);function respondWithRpcPromise(_0x57f959,_0x54d12f,_0x13d5b1){return new BPromise(function(_0xea7f2c,_0x6ea271){return client[_0x7b06('0xf')](_0x57f959,_0x13d5b1)[_0x7b06('0x10')](function(_0x3d88c8){logger[_0x7b06('0x11')](_0x7b06('0x12'),_0x54d12f,'request\x20sent');logger[_0x7b06('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x54d12f,_0x7b06('0x14'),JSON['stringify'](_0x3d88c8));if(_0x3d88c8[_0x7b06('0x15')]){if(_0x3d88c8[_0x7b06('0x15')]['code']===0x1f4){logger[_0x7b06('0x15')](_0x7b06('0x12'),_0x54d12f,_0x3d88c8['error'][_0x7b06('0x16')]);return _0x6ea271(_0x3d88c8[_0x7b06('0x15')][_0x7b06('0x16')]);}logger[_0x7b06('0x15')]('MailInteraction,\x20%s,\x20%s',_0x54d12f,_0x3d88c8['error']['message']);return _0xea7f2c(_0x3d88c8['error'][_0x7b06('0x16')]);}else{logger[_0x7b06('0x11')](_0x7b06('0x12'),_0x54d12f,'request\x20sent');_0xea7f2c(_0x3d88c8[_0x7b06('0x17')][_0x7b06('0x16')]);}})[_0x7b06('0x18')](function(_0x248cff){logger[_0x7b06('0x15')](_0x7b06('0x12'),_0x54d12f,_0x248cff);_0x6ea271(_0x248cff);});});}exports[_0x7b06('0x19')]=function(_0x212399){var _0xcfb188=this;return new Promise(function(_0x40cbd8,_0x2cdb46){return db[_0x7b06('0x1a')][_0x7b06('0x1b')](_0x212399[_0x7b06('0x1c')],{'raw':_0x212399[_0x7b06('0x1d')]?_0x212399[_0x7b06('0x1d')][_0x7b06('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x212399[_0x7b06('0x1d')]?_0x212399[_0x7b06('0x1d')][_0x7b06('0x1f')]||null:null,'attributes':_0x212399[_0x7b06('0x1d')]?_0x212399['options'][_0x7b06('0x20')]||null:null,'limit':_0x212399[_0x7b06('0x1d')]?_0x212399[_0x7b06('0x1d')][_0x7b06('0x21')]||null:null})[_0x7b06('0x10')](function(_0x36f912){logger[_0x7b06('0x11')](_0x7b06('0x19'),_0x212399);logger[_0x7b06('0x13')]('UpdateMailInteraction',_0x212399,JSON['stringify'](_0x36f912));_0x40cbd8(_0x36f912);})[_0x7b06('0x18')](function(_0xde2909){logger[_0x7b06('0x15')](_0x7b06('0x19'),_0xde2909['message'],_0x212399);_0x2cdb46(_0xcfb188[_0x7b06('0x15')](0x1f4,_0xde2909['message']));});});};exports['AddTagsToMailInteraction']=function(_0x51441f){return new Promise(function(_0x3fe7e7,_0x25b619){return db[_0x7b06('0x1a')][_0x7b06('0x22')]({'where':_0x51441f['options']?_0x51441f[_0x7b06('0x1d')][_0x7b06('0x1f')]||null:null})['then'](function(_0x1a1311){if(_0x1a1311){return _0x1a1311['addTags'](_0x51441f[_0x7b06('0x1c')][_0x7b06('0x23')],_[_0x7b06('0x24')](_0x51441f[_0x7b06('0x1c')],[_0x7b06('0x23'),'id'])||{});}})['spread'](function(_0x250ee8){logger[_0x7b06('0x11')](_0x7b06('0x25'),_0x51441f);logger[_0x7b06('0x13')](_0x7b06('0x25'),_0x51441f,JSON[_0x7b06('0x26')](_0x250ee8));_0x3fe7e7(_0x250ee8);})[_0x7b06('0x18')](function(_0xc9b0a){logger['error']('AddTags',_0xc9b0a[_0x7b06('0x16')],_0x51441f);_0x25b619(_this[_0x7b06('0x15')](0x1f4,_0xc9b0a[_0x7b06('0x16')]));});});}; \ No newline at end of file +var _0x95eb=['redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','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','body','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x95eb,0x1cc));var _0xb95e=function(_0x5dbe1e,_0x544d98){_0x5dbe1e=_0x5dbe1e-0x0;var _0x278f00=_0x95eb[_0x5dbe1e];return _0x278f00;};'use strict';var _=require(_0xb95e('0x0'));var util=require(_0xb95e('0x1'));var moment=require(_0xb95e('0x2'));var BPromise=require(_0xb95e('0x3'));var rs=require(_0xb95e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb95e('0x5'))['db'];var utils=require(_0xb95e('0x6'));var logger=require(_0xb95e('0x7'))(_0xb95e('0x8'));var config=require(_0xb95e('0x9'));var jayson=require(_0xb95e('0xa'));var client=jayson[_0xb95e('0xb')][_0xb95e('0xc')]({'port':0x232a});config[_0xb95e('0xd')]=_[_0xb95e('0xe')](config[_0xb95e('0xd')],{'host':_0xb95e('0xf'),'port':0x18eb});var socket=require(_0xb95e('0x10'))(new Redis(config['redis']));require(_0xb95e('0x11'))['register'](socket);function respondWithRpcPromise(_0x1b2b3c,_0x224db2,_0x3800a2){return new BPromise(function(_0x432fb4,_0x410df2){return client['request'](_0x1b2b3c,_0x3800a2)[_0xb95e('0x12')](function(_0x292285){logger[_0xb95e('0x13')](_0xb95e('0x14'),_0x224db2,_0xb95e('0x15'));logger[_0xb95e('0x16')](_0xb95e('0x17'),_0x224db2,_0xb95e('0x15'),JSON[_0xb95e('0x18')](_0x292285));if(_0x292285[_0xb95e('0x19')]){if(_0x292285['error'][_0xb95e('0x1a')]===0x1f4){logger[_0xb95e('0x19')](_0xb95e('0x14'),_0x224db2,_0x292285[_0xb95e('0x19')]['message']);return _0x410df2(_0x292285[_0xb95e('0x19')]['message']);}logger[_0xb95e('0x19')](_0xb95e('0x14'),_0x224db2,_0x292285[_0xb95e('0x19')]['message']);return _0x432fb4(_0x292285['error'][_0xb95e('0x1b')]);}else{logger[_0xb95e('0x13')]('MailInteraction,\x20%s,\x20%s',_0x224db2,_0xb95e('0x15'));_0x432fb4(_0x292285[_0xb95e('0x1c')]['message']);}})[_0xb95e('0x1d')](function(_0x360d37){logger[_0xb95e('0x19')](_0xb95e('0x14'),_0x224db2,_0x360d37);_0x410df2(_0x360d37);});});}exports[_0xb95e('0x1e')]=function(_0x5eed71){var _0x31b605=this;return new Promise(function(_0x43af71,_0x53f8b9){return db[_0xb95e('0x1f')]['update'](_0x5eed71[_0xb95e('0x20')],{'raw':_0x5eed71[_0xb95e('0x21')]?_0x5eed71[_0xb95e('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eed71[_0xb95e('0x21')]?_0x5eed71[_0xb95e('0x21')][_0xb95e('0x22')]||null:null,'attributes':_0x5eed71[_0xb95e('0x21')]?_0x5eed71[_0xb95e('0x21')][_0xb95e('0x23')]||null:null,'limit':_0x5eed71[_0xb95e('0x21')]?_0x5eed71['options'][_0xb95e('0x24')]||null:null})[_0xb95e('0x12')](function(_0x1b962c){logger[_0xb95e('0x13')](_0xb95e('0x1e'),_0x5eed71);logger[_0xb95e('0x16')](_0xb95e('0x1e'),_0x5eed71,JSON[_0xb95e('0x18')](_0x1b962c));_0x43af71(_0x1b962c);})[_0xb95e('0x1d')](function(_0x2d067f){logger['error'](_0xb95e('0x1e'),_0x2d067f[_0xb95e('0x1b')],_0x5eed71);_0x53f8b9(_0x31b605[_0xb95e('0x19')](0x1f4,_0x2d067f[_0xb95e('0x1b')]));});});};exports[_0xb95e('0x25')]=function(_0x464859){return new Promise(function(_0x1d422c,_0x76e601){return db[_0xb95e('0x1f')][_0xb95e('0x26')]({'where':_0x464859['options']?_0x464859[_0xb95e('0x21')]['where']||null:null})[_0xb95e('0x12')](function(_0x4f8793){if(_0x4f8793){return _0x4f8793[_0xb95e('0x27')](_0x464859[_0xb95e('0x20')]['ids'],_[_0xb95e('0x28')](_0x464859[_0xb95e('0x20')],[_0xb95e('0x29'),'id'])||{});}})['spread'](function(_0xd1e738){logger[_0xb95e('0x13')](_0xb95e('0x2a'),_0x464859);logger[_0xb95e('0x16')](_0xb95e('0x2a'),_0x464859,JSON['stringify'](_0xd1e738));_0x1d422c(_0xd1e738);})[_0xb95e('0x1d')](function(_0x50651d){logger['error']('AddTags',_0x50651d['message'],_0x464859);_0x76e601(_this[_0xb95e('0x19')](0x1f4,_0x50651d[_0xb95e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 9cb0960..55e188a 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 _0x041c=['save','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x25af3a,_0x4b9989){var _0x1d012b=function(_0x2b8d14){while(--_0x2b8d14){_0x25af3a['push'](_0x25af3a['shift']());}};_0x1d012b(++_0x4b9989);}(_0x041c,0x188));var _0xc041=function(_0x5397e,_0x514a17){_0x5397e=_0x5397e-0x0;var _0x5a4805=_0x041c[_0x5397e];return _0x5a4805;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xc041('0x0'),'remove',_0xc041('0x1')];function createListener(_0x36d482,_0x3da57a){return function(_0x17e838){_0x3da57a[_0xc041('0x2')](_0x36d482,_0x17e838);};}function removeListener(_0x18b7b6,_0x2a7b0f){return function(){MailInteractionEvents[_0xc041('0x3')](_0x18b7b6,_0x2a7b0f);};}exports[_0xc041('0x4')]=function(_0x3d68c6){for(var _0x1a29bf=0x0,_0x27dd84=events[_0xc041('0x5')];_0x1a29bf<_0x27dd84;_0x1a29bf++){var _0x276336=events[_0x1a29bf];var _0x4c4137=createListener(_0xc041('0x6')+_0x276336,_0x3d68c6);MailInteractionEvents['on'](_0x276336,_0x4c4137);}}; \ No newline at end of file +var _0x875a=['save','update','emit','removeListener','register','mailInteraction:','./mailInteraction.events'];(function(_0x29737d,_0x34506a){var _0x465eed=function(_0x4c7393){while(--_0x4c7393){_0x29737d['push'](_0x29737d['shift']());}};_0x465eed(++_0x34506a);}(_0x875a,0x187));var _0xa875=function(_0x4f1b76,_0x3b75d2){_0x4f1b76=_0x4f1b76-0x0;var _0x3c68a7=_0x875a[_0x4f1b76];return _0x3c68a7;};'use strict';var MailInteractionEvents=require(_0xa875('0x0'));var events=[_0xa875('0x1'),'remove',_0xa875('0x2')];function createListener(_0x1222d3,_0x15ac80){return function(_0x3c93ac){_0x15ac80[_0xa875('0x3')](_0x1222d3,_0x3c93ac);};}function removeListener(_0xbd3d7,_0x158b91){return function(){MailInteractionEvents[_0xa875('0x4')](_0xbd3d7,_0x158b91);};}exports[_0xa875('0x5')]=function(_0x4d9c7b){for(var _0x61ddc9=0x0,_0x4ac4d1=events['length'];_0x61ddc9<_0x4ac4d1;_0x61ddc9++){var _0x576d81=events[_0x61ddc9];var _0x105b31=createListener(_0xa875('0x6')+_0x576d81,_0x4d9c7b);MailInteractionEvents['on'](_0x576d81,_0x105b31);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c881066..05ac87a 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 _0x3526=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','util'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x3526,0x1db));var _0x6352=function(_0x3c403f,_0xba44a9){_0x3c403f=_0x3c403f-0x0;var _0x1c4515=_0x3526[_0x3c403f];return _0x1c4515;};'use strict';var multer=require('multer');var util=require(_0x6352('0x0'));var path=require(_0x6352('0x1'));var timeout=require(_0x6352('0x2'));var express=require(_0x6352('0x3'));var router=express[_0x6352('0x4')]();var fs_extra=require(_0x6352('0x5'));var auth=require(_0x6352('0x6'));var interaction=require(_0x6352('0x7'));var config=require(_0x6352('0x8'));var controller=require(_0x6352('0x9'));router[_0x6352('0xa')]('/',auth[_0x6352('0xb')](),controller[_0x6352('0xc')]);router[_0x6352('0xa')](_0x6352('0xd'),auth[_0x6352('0xb')](),controller[_0x6352('0xe')]);router[_0x6352('0xa')](_0x6352('0xf'),auth[_0x6352('0xb')](),controller['show']);router[_0x6352('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x6352('0xb')](),interaction[_0x6352('0x10')](_0x6352('0x11'),_0x6352('0x12')),controller[_0x6352('0x13')]);router[_0x6352('0x14')]('/:id',auth[_0x6352('0xb')](),controller[_0x6352('0x15')]);router[_0x6352('0x14')](_0x6352('0x16'),auth[_0x6352('0xb')](),controller[_0x6352('0x17')]);router['put']('/:id/reject',auth[_0x6352('0xb')](),controller[_0x6352('0x18')]);router[_0x6352('0x19')]('/:id',auth[_0x6352('0xb')](),controller[_0x6352('0x1a')]);module[_0x6352('0x1b')]=router; \ No newline at end of file +var _0x7980=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','get','/describe','/:id','show','/:id/download','download','post','tracked','mailmessage:create','create','update','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path'];(function(_0x44a7c1,_0x2500e9){var _0x1966de=function(_0x2e6916){while(--_0x2e6916){_0x44a7c1['push'](_0x44a7c1['shift']());}};_0x1966de(++_0x2500e9);}(_0x7980,0xab));var _0x0798=function(_0x12bd92,_0x8c41ba){_0x12bd92=_0x12bd92-0x0;var _0x521cf7=_0x7980[_0x12bd92];return _0x521cf7;};'use strict';var multer=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var path=require(_0x0798('0x2'));var timeout=require(_0x0798('0x3'));var express=require(_0x0798('0x4'));var router=express['Router']();var fs_extra=require(_0x0798('0x5'));var auth=require(_0x0798('0x6'));var interaction=require(_0x0798('0x7'));var config=require(_0x0798('0x8'));var controller=require(_0x0798('0x9'));router['get']('/',auth[_0x0798('0xa')](),controller['index']);router[_0x0798('0xb')](_0x0798('0xc'),auth[_0x0798('0xa')](),controller['describe']);router['get'](_0x0798('0xd'),auth[_0x0798('0xa')](),controller[_0x0798('0xe')]);router[_0x0798('0xb')](_0x0798('0xf'),auth[_0x0798('0xa')](),controller[_0x0798('0x10')]);router[_0x0798('0x11')]('/',auth[_0x0798('0xa')](),interaction[_0x0798('0x12')]('mail',_0x0798('0x13')),controller[_0x0798('0x14')]);router['put']('/:id',auth[_0x0798('0xa')](),controller[_0x0798('0x15')]);router[_0x0798('0x16')](_0x0798('0x17'),auth[_0x0798('0xa')](),controller[_0x0798('0x18')]);router[_0x0798('0x16')]('/:id/reject',auth['isAuthenticated'](),controller[_0x0798('0x19')]);router[_0x0798('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x0798('0x1b')]);module[_0x0798('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 35a5791..93fdd20 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 _0x07ba=['Email','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE'];(function(_0x121dad,_0x483afc){var _0x4f030a=function(_0x4356f5){while(--_0x4356f5){_0x121dad['push'](_0x121dad['shift']());}};_0x4f030a(++_0x483afc);}(_0x07ba,0x1ba));var _0xa07b=function(_0x5c4f0c,_0x44ed75){_0x5c4f0c=_0x5c4f0c-0x0;var _0x21a349=_0x07ba[_0x5c4f0c];return _0x21a349;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xa07b('0x0')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xa07b('0x1'))},'read':{'type':Sequelize[_0xa07b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa07b('0x3')]('in','out'),'defaultValue':_0xa07b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa07b('0x5')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0xa07b('0x6'))},'cc':{'type':Sequelize[_0xa07b('0x0')](_0xa07b('0x6'))},'bcc':{'type':Sequelize['TEXT'](_0xa07b('0x6'))},'subject':{'type':Sequelize[_0xa07b('0x0')]},'sentAt':{'type':Sequelize[_0xa07b('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xa07b('0x0')](_0xa07b('0x6'))},'originCc':{'type':Sequelize['TEXT'](_0xa07b('0x6'))},'originChannel':{'type':Sequelize[_0xa07b('0x3')](_0xa07b('0x8'),'Chat'),'defaultValue':_0xa07b('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0xc9d4=['INTEGER','Email','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc9d4,0x183));var _0x4c9d=function(_0x5856c1,_0x2d02e2){_0x5856c1=_0x5856c1-0x0;var _0x174d4b=_0xc9d4[_0x5856c1];return _0x174d4b;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4c9d('0x0'));module[_0x4c9d('0x1')]={'body':{'type':Sequelize[_0x4c9d('0x2')](_0x4c9d('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4c9d('0x2')](_0x4c9d('0x4'))},'read':{'type':Sequelize[_0x4c9d('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4c9d('0x6')]('in',_0x4c9d('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x4c9d('0x3'))},'cc':{'type':Sequelize[_0x4c9d('0x2')](_0x4c9d('0x3'))},'bcc':{'type':Sequelize[_0x4c9d('0x2')]('long')},'subject':{'type':Sequelize[_0x4c9d('0x2')]},'sentAt':{'type':Sequelize[_0x4c9d('0x8')]},'attach':{'type':Sequelize[_0x4c9d('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4c9d('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x4c9d('0x2')](_0x4c9d('0x3'))},'originCc':{'type':Sequelize[_0x4c9d('0x2')]('long')},'originChannel':{'type':Sequelize[_0x4c9d('0x6')](_0x4c9d('0xa'),'Chat'),'defaultValue':_0x4c9d('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e4040ab..6b139e7 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 _0xfe44=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','find','body','destroy','describe','create','out','secret','split','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','CmContact','ListId','List\x20not\x20found','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','readAt','format','UserId','user','agent','get','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','User','fullname','email','manual','interface','channel','motionChannel','event','fromString','EventManager','mail','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','Sequelize','QueryTypes','internal','reject','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','unlinkSync','eml-format','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailMessage.socket','register','client','http','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','json','offset','limit','count','set','Content-Range','update','end','sendStatus','stack','name','index','map','MailMessage'];(function(_0x3ec4d9,_0x1090e3){var _0x34df0f=function(_0x3e5444){while(--_0x3e5444){_0x3ec4d9['push'](_0x3ec4d9['shift']());}};_0x34df0f(++_0x1090e3);}(_0xfe44,0x105));var _0x4fe4=function(_0x3f618b,_0x33e91a){_0x3f618b=_0x3f618b-0x0;var _0x752c51=_0xfe44[_0x3f618b];return _0x752c51;};'use strict';var emlformat=require(_0x4fe4('0x0'));var moment=require('moment');var BPromise=require(_0x4fe4('0x1'));var util=require(_0x4fe4('0x2'));var path=require(_0x4fe4('0x3'));var fs=require('fs');var _=require(_0x4fe4('0x4'));var Redis=require(_0x4fe4('0x5'));var htmlToText=require(_0x4fe4('0x6'));var qs=require(_0x4fe4('0x7'));var logger=require(_0x4fe4('0x8'))('api');var interaction_log=require(_0x4fe4('0x8'))(_0x4fe4('0x9'));var config=require(_0x4fe4('0xa'));var db=require(_0x4fe4('0xb'))['db'];config['redis']=_[_0x4fe4('0xc')](config[_0x4fe4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fe4('0xe'))(new Redis(config[_0x4fe4('0xd')]));var htmlEntities=require('html-entities');require(_0x4fe4('0xf'))[_0x4fe4('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4fe4('0x11')][_0x4fe4('0x12')]({'port':0x232c});var client9003=jayson['client'][_0x4fe4('0x12')]({'port':0x232b});var client9002=jayson['client'][_0x4fe4('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x4ce298,_0x48087e,_0xc17f98,_0x440570){return new BPromise(function(_0x35eafe,_0x386cfb){var _0x3c4a8e=_0x440570||client;return _0x3c4a8e['request'](_0x4ce298,_0xc17f98)[_0x4fe4('0x13')](function(_0xbcd9f6){logger['info'](_0x4fe4('0x14'),_0x48087e,'request\x20sent');logger[_0x4fe4('0x15')](_0x4fe4('0x16'),_0x48087e,_0x4fe4('0x17'),JSON[_0x4fe4('0x18')](_0xbcd9f6));if(_0xbcd9f6[_0x4fe4('0x19')]){if(_0xbcd9f6[_0x4fe4('0x19')]['code']===0x1f4){logger[_0x4fe4('0x19')](_0x4fe4('0x14'),_0x48087e,_0xbcd9f6[_0x4fe4('0x19')][_0x4fe4('0x1a')]);return _0x386cfb(_0xbcd9f6[_0x4fe4('0x19')]['message']);}logger[_0x4fe4('0x19')](_0x4fe4('0x14'),_0x48087e,_0xbcd9f6[_0x4fe4('0x19')][_0x4fe4('0x1a')]);return _0x35eafe(_0xbcd9f6[_0x4fe4('0x19')]['message']);}else{logger[_0x4fe4('0x1b')](_0x4fe4('0x14'),_0x48087e,_0x4fe4('0x17'));_0x35eafe(_0xbcd9f6[_0x4fe4('0x1c')][_0x4fe4('0x1a')]);}})[_0x4fe4('0x1d')](function(_0x3c54de){logger[_0x4fe4('0x19')](_0x4fe4('0x14'),_0x48087e,_0x3c54de);_0x386cfb(_0x3c54de);});});}function respondWithResult(_0x57eb12,_0x3041f2){_0x3041f2=_0x3041f2||0xc8;return function(_0x57ce8c){if(_0x57ce8c){return _0x57eb12[_0x4fe4('0x1e')](_0x3041f2)[_0x4fe4('0x1f')](_0x57ce8c);}};}function respondWithFilteredResult(_0x15e627,_0x4acdb7){return function(_0x515486){if(_0x515486){var _0x108e85=typeof _0x4acdb7[_0x4fe4('0x20')]==='undefined'&&typeof _0x4acdb7[_0x4fe4('0x21')]==='undefined';var _0x20446c=_0x515486[_0x4fe4('0x22')];var _0x4ae0ab=_0x108e85?0x0:_0x4acdb7['offset'];var _0x170369=_0x108e85?_0x515486[_0x4fe4('0x22')]:_0x4acdb7[_0x4fe4('0x20')]+_0x4acdb7[_0x4fe4('0x21')];var _0x585673;if(_0x170369>=_0x20446c){_0x170369=_0x20446c;_0x585673=0xc8;}else{_0x585673=0xce;}_0x15e627[_0x4fe4('0x1e')](_0x585673);return _0x15e627[_0x4fe4('0x23')](_0x4fe4('0x24'),_0x4ae0ab+'-'+_0x170369+'/'+_0x20446c)[_0x4fe4('0x1f')](_0x515486);}return null;};}function saveUpdates(_0x4d2129){return function(_0x57bc36){if(_0x57bc36){return _0x57bc36[_0x4fe4('0x25')](_0x4d2129)[_0x4fe4('0x13')](function(_0x5ec63f){return _0x5ec63f;});}return null;};}function removeEntity(_0xbb4cd7){return function(_0x43c14b){if(_0x43c14b){return _0x43c14b['destroy']()[_0x4fe4('0x13')](function(){_0xbb4cd7[_0x4fe4('0x1e')](0xcc)[_0x4fe4('0x26')]();});}};}function handleEntityNotFound(_0x5a9fcc){return function(_0x450c24){if(!_0x450c24){_0x5a9fcc[_0x4fe4('0x27')](0x194);}return _0x450c24;};}function handleError(_0x3dd744,_0x45fea5){_0x45fea5=_0x45fea5||0x1f4;return function(_0x49411d){logger[_0x4fe4('0x19')](_0x49411d[_0x4fe4('0x28')]);if(_0x49411d[_0x4fe4('0x29')]){delete _0x49411d[_0x4fe4('0x29')];}_0x3dd744[_0x4fe4('0x1e')](_0x45fea5)['send'](_0x49411d);};}exports[_0x4fe4('0x2a')]=function(_0x12aa43,_0x3fe484){var _0x1b3c68={},_0x1c824c={},_0x101d54={'count':0x0,'rows':[]};var _0x52793c=_[_0x4fe4('0x2b')](db[_0x4fe4('0x2c')]['rawAttributes'],function(_0x594ab3){return{'name':_0x594ab3[_0x4fe4('0x2d')],'type':_0x594ab3[_0x4fe4('0x2e')][_0x4fe4('0x2f')]};});_0x1c824c[_0x4fe4('0x30')]=_['map'](_0x52793c,_0x4fe4('0x29'));_0x1c824c[_0x4fe4('0x31')]=_[_0x4fe4('0x32')](_0x12aa43['query']);_0x1c824c[_0x4fe4('0x33')]=_['intersection'](_0x1c824c['model'],_0x1c824c[_0x4fe4('0x31')]);_0x1b3c68['attributes']=_[_0x4fe4('0x34')](_0x1c824c['model'],qs[_0x4fe4('0x35')](_0x12aa43[_0x4fe4('0x31')][_0x4fe4('0x35')]));_0x1b3c68[_0x4fe4('0x36')]=_0x1b3c68[_0x4fe4('0x36')][_0x4fe4('0x37')]?_0x1b3c68[_0x4fe4('0x36')]:_0x1c824c[_0x4fe4('0x30')];if(!_0x12aa43[_0x4fe4('0x31')][_0x4fe4('0x38')](_0x4fe4('0x39'))){_0x1b3c68[_0x4fe4('0x21')]=qs['limit'](_0x12aa43[_0x4fe4('0x31')][_0x4fe4('0x21')]);_0x1b3c68[_0x4fe4('0x20')]=qs['offset'](_0x12aa43[_0x4fe4('0x31')][_0x4fe4('0x20')]);}_0x1b3c68[_0x4fe4('0x3a')]=qs['sort'](_0x12aa43[_0x4fe4('0x31')][_0x4fe4('0x3b')]);_0x1b3c68['where']=qs[_0x4fe4('0x33')](_['pick'](_0x12aa43[_0x4fe4('0x31')],_0x1c824c[_0x4fe4('0x33')]),_0x52793c);if(_0x12aa43[_0x4fe4('0x31')][_0x4fe4('0x3c')]){_0x1b3c68[_0x4fe4('0x3d')]=_[_0x4fe4('0x3e')](_0x1b3c68[_0x4fe4('0x3d')],{'$or':_['map'](_0x52793c,function(_0x2bcd78){if(_0x2bcd78[_0x4fe4('0x2e')]!==_0x4fe4('0x3f')){var _0x438978={};_0x438978[_0x2bcd78[_0x4fe4('0x29')]]={'$like':'%'+_0x12aa43[_0x4fe4('0x31')]['filter']+'%'};return _0x438978;}})});}_0x1b3c68=_['merge']({},_0x1b3c68,_0x12aa43[_0x4fe4('0x40')]);var _0x122d75={'where':_0x1b3c68[_0x4fe4('0x3d')]};return db['MailMessage'][_0x4fe4('0x22')](_0x122d75)[_0x4fe4('0x13')](function(_0x19da98){_0x101d54[_0x4fe4('0x22')]=_0x19da98;if(_0x12aa43[_0x4fe4('0x31')][_0x4fe4('0x41')]){_0x1b3c68['include']=[{'all':!![]}];}return db['MailMessage'][_0x4fe4('0x42')](_0x1b3c68);})[_0x4fe4('0x13')](function(_0x309b8b){_0x101d54[_0x4fe4('0x43')]=_0x309b8b;return _0x101d54;})[_0x4fe4('0x13')](respondWithFilteredResult(_0x3fe484,_0x1b3c68))[_0x4fe4('0x1d')](handleError(_0x3fe484,null));};exports[_0x4fe4('0x44')]=function(_0x3f9385,_0x2ae0ce){var _0x4707b3={'raw':!![],'where':{'id':_0x3f9385[_0x4fe4('0x45')]['id']}},_0x36b3df={};_0x36b3df[_0x4fe4('0x30')]=_[_0x4fe4('0x32')](db[_0x4fe4('0x2c')][_0x4fe4('0x46')]);_0x36b3df['query']=_[_0x4fe4('0x32')](_0x3f9385[_0x4fe4('0x31')]);_0x36b3df[_0x4fe4('0x33')]=_[_0x4fe4('0x34')](_0x36b3df[_0x4fe4('0x30')],_0x36b3df[_0x4fe4('0x31')]);_0x4707b3[_0x4fe4('0x36')]=_['intersection'](_0x36b3df[_0x4fe4('0x30')],qs[_0x4fe4('0x35')](_0x3f9385[_0x4fe4('0x31')][_0x4fe4('0x35')]));_0x4707b3[_0x4fe4('0x36')]=_0x4707b3[_0x4fe4('0x36')]['length']?_0x4707b3[_0x4fe4('0x36')]:_0x36b3df[_0x4fe4('0x30')];if(_0x3f9385[_0x4fe4('0x31')][_0x4fe4('0x41')]){_0x4707b3['include']=[{'all':!![]}];}_0x4707b3=_[_0x4fe4('0x3e')]({},_0x4707b3,_0x3f9385[_0x4fe4('0x40')]);return db[_0x4fe4('0x2c')][_0x4fe4('0x47')](_0x4707b3)[_0x4fe4('0x13')](handleEntityNotFound(_0x2ae0ce,null))['then'](respondWithResult(_0x2ae0ce,null))[_0x4fe4('0x1d')](handleError(_0x2ae0ce,null));};exports['update']=function(_0x480a5c,_0x20a857){if(_0x480a5c[_0x4fe4('0x48')]['id']){delete _0x480a5c[_0x4fe4('0x48')]['id'];}return db['MailMessage'][_0x4fe4('0x47')]({'where':{'id':_0x480a5c[_0x4fe4('0x45')]['id']}})['then'](handleEntityNotFound(_0x20a857,null))[_0x4fe4('0x13')](saveUpdates(_0x480a5c[_0x4fe4('0x48')],null))[_0x4fe4('0x13')](respondWithResult(_0x20a857,null))['catch'](handleError(_0x20a857,null));};exports[_0x4fe4('0x49')]=function(_0x573254,_0x178625){return db[_0x4fe4('0x2c')][_0x4fe4('0x47')]({'where':{'id':_0x573254[_0x4fe4('0x45')]['id']}})[_0x4fe4('0x13')](handleEntityNotFound(_0x178625,null))[_0x4fe4('0x13')](removeEntity(_0x178625,null))[_0x4fe4('0x1d')](handleError(_0x178625,null));};exports[_0x4fe4('0x4a')]=function(_0x287a01,_0x23b8d6){return db[_0x4fe4('0x2c')][_0x4fe4('0x4a')]()[_0x4fe4('0x13')](respondWithResult(_0x23b8d6,null))[_0x4fe4('0x1d')](handleError(_0x23b8d6,null));};exports[_0x4fe4('0x4b')]=function(_0x3da9d8,_0xd2c113){return db[_0x4fe4('0x2c')][_0x4fe4('0x4b')](_0x3da9d8[_0x4fe4('0x48')])['then'](function(_0x48f04d){if(_0x48f04d){if(_0x48f04d['direction']===_0x4fe4('0x4c')&&!_0x48f04d[_0x4fe4('0x4d')]){var _0x64082c,_0x189a74,_0x313f8f;if(_0x3da9d8[_0x4fe4('0x48')]['to']){_0x189a74=_0x3da9d8[_0x4fe4('0x48')]['to'][_0x4fe4('0x4e')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x48f04d[_0x4fe4('0x4f')]},'include':[{'model':db[_0x4fe4('0x50')],'as':_0x4fe4('0x51'),'include':[{'model':db['CmContact'],'as':_0x4fe4('0x52'),'where':{'email':_0x189a74},'limit':0x1,'order':[[_0x4fe4('0x53'),_0x4fe4('0x54')]]}]},{'model':db[_0x4fe4('0x55')],'as':_0x4fe4('0x56'),'raw':!![],'include':[{'model':db[_0x4fe4('0x57')],'as':_0x4fe4('0x57'),'raw':!![]}]}]})['then'](function(_0x2f7204){_0x64082c=_0x2f7204;if(!_0x64082c||!_0x64082c['Smtp'])return;var _0x4d1fb3=_0x64082c[_0x4fe4('0x58')]();if(_0x3da9d8[_0x4fe4('0x48')][_0x4fe4('0x59')]&&_0x3da9d8[_0x4fe4('0x48')]['attachments'][_0x4fe4('0x37')]){for(var _0xcc46e6=0x0;_0xcc46e6<_0x3da9d8['body'][_0x4fe4('0x59')][_0x4fe4('0x37')];_0xcc46e6+=0x1){_0x3da9d8['body'][_0x4fe4('0x59')][_0xcc46e6]={'filename':_0x3da9d8['body']['attachments'][_0xcc46e6][_0x4fe4('0x29')],'path':path[_0x4fe4('0x5a')](config['root'],_0x4fe4('0x5b'),_0x3da9d8[_0x4fe4('0x48')]['attachments'][_0xcc46e6][_0x4fe4('0x5c')])};}}_0x313f8f={'account':_0x4d1fb3,'message':_0x3da9d8[_0x4fe4('0x48')]};return;})[_0x4fe4('0x13')](function(){if(_0x64082c[_0x4fe4('0x51')]){if(_0x64082c['List']['Contacts'][_0x4fe4('0x37')]){return _0x64082c[_0x4fe4('0x51')][_0x4fe4('0x52')][0x0];}else{return db[_0x4fe4('0x5d')][_0x4fe4('0x4b')](_['defaults'](_0x3da9d8[_0x4fe4('0x48')],{'firstName':_0x3da9d8[_0x4fe4('0x48')]['to'],'email':_0x3da9d8[_0x4fe4('0x48')]['to'],'phone':_0x3da9d8[_0x4fe4('0x48')]['to'],'ListId':_0x64082c[_0x4fe4('0x5e')]}));}}else{throw new Error(_0x4fe4('0x5f'));}})[_0x4fe4('0x13')](function(){if(_0x313f8f){return respondWithRpcPromise('SendMail',_0x4fe4('0x60'),_0x313f8f,client9003)[_0x4fe4('0x13')](function(_0x4cb95c){return _0x48f04d[_0x4fe4('0x25')]({'read':!![],'messageId':_0x4cb95c[_0x4fe4('0x61')],'sentAt':moment()['format'](_0x4fe4('0x62'))});})[_0x4fe4('0x1d')](function(_0x223367){logger[_0x4fe4('0x19')]('%s',JSON['stringify'](_0x223367));return _0x48f04d;});}return _0x48f04d;});}return _0x48f04d;}})[_0x4fe4('0x13')](respondWithResult(_0xd2c113,0xc9))['catch'](handleError(_0xd2c113,null));};exports['accept']=function(_0x378c01,_0x40e707){var _0x399725={'agent':{},'channel':'mail'};if(_0x378c01[_0x4fe4('0x48')]['id']){delete _0x378c01[_0x4fe4('0x48')]['id'];}_0x378c01[_0x4fe4('0x48')]['read']=!![];_0x378c01[_0x4fe4('0x48')][_0x4fe4('0x63')]=moment()[_0x4fe4('0x64')](_0x4fe4('0x62'));_0x378c01[_0x4fe4('0x48')]['UserId']=_0x378c01[_0x4fe4('0x48')][_0x4fe4('0x65')]||_0x378c01[_0x4fe4('0x66')]['id'];_0x399725[_0x4fe4('0x67')]['id']=_0x378c01[_0x4fe4('0x48')][_0x4fe4('0x65')];return db[_0x4fe4('0x2c')][_0x4fe4('0x47')]({'where':{'id':_0x378c01[_0x4fe4('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40e707,null))['then'](saveUpdates(_0x378c01[_0x4fe4('0x48')],null))['then'](function(_0x176609){if(_0x176609){_0x399725[_0x4fe4('0x1a')]=_0x176609[_0x4fe4('0x68')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x176609['MailInteractionId']}});}return null;})[_0x4fe4('0x13')](handleEntityNotFound(_0x40e707,null))[_0x4fe4('0x13')](function(_0x3febf2){if(_0x3febf2){return _0x3febf2[_0x4fe4('0x25')]({'UserId':_0x378c01[_0x4fe4('0x48')][_0x4fe4('0x65')],'read1stAt':_[_0x4fe4('0x69')](_0x3febf2['read1stAt'])?moment()[_0x4fe4('0x64')](_0x4fe4('0x62')):undefined});}return null;})[_0x4fe4('0x13')](function(_0x3a9ab5){if(_0x3a9ab5){_0x399725[_0x4fe4('0x6a')]=_0x3a9ab5['get']({'plain':!![]});interaction_log['info'](_0x4fe4('0x6b'),_0x378c01['user']['id'],_0x378c01[_0x4fe4('0x66')][_0x4fe4('0x29')],_0x378c01['user']['role'],_0x399725[_0x4fe4('0x6a')]['id'],_0x378c01[_0x4fe4('0x48')]?JSON[_0x4fe4('0x18')](_0x378c01[_0x4fe4('0x48')]):'null');return respondWithRpcPromise(_0x4fe4('0x6c'),_0x4fe4('0x6d'),_0x399725);}return null;})[_0x4fe4('0x13')](function(_0x4d1dab){var _0x5be269=_0x4fe4('0x6e')+_0x4d1dab[_0x4fe4('0x1a')]['ContactId'];return db[_0x4fe4('0x6f')][_0x4fe4('0x31')](_0x5be269,{'type':db['Sequelize']['QueryTypes'][_0x4fe4('0x70')],'raw':!![]})[_0x4fe4('0x13')](function(_0x470d29){return _0x470d29;});})['then'](function(_0x1a8d24){if(_0x1a8d24){_0x399725['message']['contact']=_0x1a8d24[0x0];if(!_0x378c01['body'][_0x4fe4('0x65')])return;return db[_0x4fe4('0x71')][_0x4fe4('0x47')]({'where':{'id':_0x378c01['body']['UserId'],'role':_0x4fe4('0x67')},'attributes':['id','name',_0x4fe4('0x72'),_0x4fe4('0x73'),'internal'],'raw':!![]});}return null;})[_0x4fe4('0x13')](function(_0x5c1278){if(!_0x5c1278)return null;_0x399725[_0x4fe4('0x1a')][_0x4fe4('0x67')]=_0x5c1278;return _0x399725;})[_0x4fe4('0x13')](function(_0x415d65){if(_0x415d65){if(_0x378c01[_0x4fe4('0x48')][_0x4fe4('0x74')]){_0x399725[_0x4fe4('0x1a')][_0x4fe4('0x75')]=util[_0x4fe4('0x64')]('SIP/%s',_0x378c01['user'][_0x4fe4('0x29')]);_0x399725[_0x4fe4('0x1a')][_0x4fe4('0x76')]=_0x399725[_0x4fe4('0x76')];_0x399725[_0x4fe4('0x1a')][_0x4fe4('0x77')]=_0x399725[_0x4fe4('0x76')];_0x399725['message'][_0x4fe4('0x78')]='accept';_0x399725[_0x4fe4('0x1a')][_0x4fe4('0x48')]=htmlToText[_0x4fe4('0x79')](_0x399725[_0x4fe4('0x1a')][_0x4fe4('0x48')]);return respondWithRpcPromise(_0x4fe4('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x399725[_0x4fe4('0x1a')]},client9002)[_0x4fe4('0x13')](function(){return _0x399725;});}return _0x399725;}return null;})[_0x4fe4('0x13')](respondWithResult(_0x40e707,null))[_0x4fe4('0x1d')](handleError(_0x40e707,null));};exports['reject']=function(_0x3e77c1,_0x5681de){var _0x523cc5={'agent':{},'channel':_0x4fe4('0x7b')};if(_0x3e77c1[_0x4fe4('0x48')]['id']){delete _0x3e77c1[_0x4fe4('0x48')]['id'];}_0x3e77c1['body'][_0x4fe4('0x65')]=_0x3e77c1['body'][_0x4fe4('0x65')]||_0x3e77c1[_0x4fe4('0x66')]['id'];_0x523cc5[_0x4fe4('0x67')]['id']=_0x3e77c1[_0x4fe4('0x48')][_0x4fe4('0x65')];return db[_0x4fe4('0x2c')][_0x4fe4('0x47')]({'where':{'id':_0x3e77c1[_0x4fe4('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5681de,null))['then'](function(_0x3914a9){if(_0x3914a9){_0x523cc5['message']=_0x3914a9[_0x4fe4('0x68')]({'plain':!![]});return db[_0x4fe4('0x7c')][_0x4fe4('0x47')]({'where':{'id':_0x3914a9['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5681de,null))[_0x4fe4('0x13')](function(_0x3fcbdc){if(_0x3fcbdc){_0x523cc5[_0x4fe4('0x6a')]=_0x3fcbdc[_0x4fe4('0x68')]({'plain':!![]});interaction_log['info'](_0x4fe4('0x7d'),_0x3e77c1['user']['id'],_0x3e77c1[_0x4fe4('0x66')][_0x4fe4('0x29')],_0x3e77c1['user'][_0x4fe4('0x7e')],_0x523cc5[_0x4fe4('0x6a')]['id'],_0x3e77c1[_0x4fe4('0x48')]?JSON[_0x4fe4('0x18')](_0x3e77c1[_0x4fe4('0x48')]):'null');return respondWithRpcPromise(_0x4fe4('0x7f'),'rejectMessage',_0x523cc5);}return null;})['then'](function(_0x42bc51){var _0x2ce86c=_0x4fe4('0x6e')+_0x42bc51[_0x4fe4('0x1a')]['ContactId'];return db[_0x4fe4('0x6f')][_0x4fe4('0x31')](_0x2ce86c,{'type':db[_0x4fe4('0x80')][_0x4fe4('0x81')][_0x4fe4('0x70')],'raw':!![]})[_0x4fe4('0x13')](function(_0x16c558){return _0x16c558;});})[_0x4fe4('0x13')](function(_0x4bec45){if(_0x4bec45){_0x523cc5[_0x4fe4('0x1a')]['contact']=_0x4bec45[0x0];if(!_0x3e77c1[_0x4fe4('0x48')][_0x4fe4('0x65')])return;return db[_0x4fe4('0x71')]['find']({'where':{'id':_0x3e77c1[_0x4fe4('0x48')][_0x4fe4('0x65')],'role':_0x4fe4('0x67')},'attributes':['id','name',_0x4fe4('0x72'),_0x4fe4('0x73'),_0x4fe4('0x82')],'raw':!![]});}return null;})[_0x4fe4('0x13')](function(_0x41aa8e){if(!_0x41aa8e)return null;_0x523cc5['message'][_0x4fe4('0x67')]=_0x41aa8e;return _0x523cc5;})['then'](function(_0x2489e0){if(_0x2489e0){_0x2489e0[_0x4fe4('0x1a')][_0x4fe4('0x75')]=util['format']('SIP/%s',_0x3e77c1[_0x4fe4('0x66')]['name']);_0x2489e0[_0x4fe4('0x1a')][_0x4fe4('0x76')]=_0x523cc5['channel'];_0x2489e0[_0x4fe4('0x1a')][_0x4fe4('0x77')]=_0x523cc5[_0x4fe4('0x76')];_0x2489e0['message'][_0x4fe4('0x78')]=_0x4fe4('0x83');_0x2489e0['message'][_0x4fe4('0x48')]=htmlToText['fromString'](_0x523cc5['message']['body']);respondWithRpcPromise(_0x4fe4('0x7a'),_0x4fe4('0x7a'),{'event':_0x4fe4('0x84'),'message':_0x2489e0[_0x4fe4('0x1a')]},client9002);return _0x523cc5;}return null;})[_0x4fe4('0x13')](respondWithResult(_0x5681de,null))[_0x4fe4('0x1d')](handleError(_0x5681de,null));};exports[_0x4fe4('0x85')]=function(_0x11d936,_0x4dbc34){var _0x2c440e=moment()[_0x4fe4('0x86')]()[_0x4fe4('0x87')]();var _0x12fdfc=path['join'](config[_0x4fe4('0x88')],_0x4fe4('0x89'),_0x4fe4('0x8a'),_0x4fe4('0x8b'));var _0x26e571=path[_0x4fe4('0x5a')](config[_0x4fe4('0x88')],'server',_0x4fe4('0x8a'),'attachments');var _0x56c90b=util[_0x4fe4('0x64')](_0x4fe4('0x8c'),_0x2c440e);return db[_0x4fe4('0x2c')][_0x4fe4('0x47')]({'where':{'id':_0x11d936[_0x4fe4('0x45')]['id']},'attributes':['id',_0x4fe4('0x48'),_0x4fe4('0x8d'),'to','cc',_0x4fe4('0x8e'),_0x4fe4('0x8f'),_0x4fe4('0x90')],'include':_0x11d936[_0x4fe4('0x31')][_0x4fe4('0x59')]?[{'model':db[_0x4fe4('0x91')],'as':_0x4fe4('0x92')}]:undefined})['then'](handleEntityNotFound(_0x4dbc34,null))['then'](function(_0x261502){if(_0x261502){var _0x382a20=_0x261502;var _0x48815c={'from':_0x382a20[_0x4fe4('0x8d')],'to':_0x382a20['to'],'subject':_0x382a20['subject'],'html':htmlEntities['decode'](_0x382a20[_0x4fe4('0x48')]),'headers':{'Date':moment(_0x382a20['createdAt'])['format'](_0x4fe4('0x93'))},'attachments':[]};if(_0x261502['cc']){_0x48815c[_0x4fe4('0x94')]['Cc']=_0x261502['cc'];}if(_0x261502[_0x4fe4('0x8e')]){_0x48815c[_0x4fe4('0x94')]['Bcc']=_0x261502[_0x4fe4('0x8e')];}return new BPromise(function(_0xb7888f,_0x4d8867){if(_0x261502[_0x4fe4('0x92')]){for(var _0x5e96af=0x0;_0x5e96af<_0x261502['Attachments']['length'];_0x5e96af++){var _0x19d945=_0x261502['Attachments'][_0x5e96af];var _0x4e1269=path[_0x4fe4('0x5a')](_0x26e571,_0x19d945[_0x4fe4('0x5c')]);if(fs[_0x4fe4('0x95')](_0x4e1269)){_0x48815c[_0x4fe4('0x59')][_0x4fe4('0x96')]({'name':_0x19d945['name'],'contentType':_0x19d945['type'],'data':fs[_0x4fe4('0x97')](_0x4e1269)});}}}emlformat['build'](_0x48815c,function(_0x205875,_0x1c35a0){if(_0x205875)return _0x4d8867(_0x205875);fs['writeFileSync'](path[_0x4fe4('0x5a')](_0x12fdfc,_0x56c90b),_0x1c35a0);return _0xb7888f(_0x1c35a0);});});}})[_0x4fe4('0x13')](function(_0x18b060){if(_0x18b060){return _0x4dbc34[_0x4fe4('0x85')](path[_0x4fe4('0x5a')](_0x12fdfc,_0x56c90b),_0x56c90b,function(_0x329df6){if(!_0x329df6)fs[_0x4fe4('0x98')](path['join'](_0x12fdfc,_0x56c90b));});}})[_0x4fe4('0x1d')](handleError(_0x4dbc34,null));}; \ No newline at end of file +var _0x126d=['message-%s.eml','bcc','Attachment','Attachments','from','subject','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','end','stack','name','MailMessage','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','map','filter','options','includeAll','include','findAll','rows','show','rawAttributes','find','body','destroy','params','describe','create','out','secret','MailAccount','MailAccountId','CmList','List','CmContact','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','Contacts','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','user','agent','MailInteraction','MailInteractionId','isNil','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','email','rejectmessage','download','unix','files','tmp','server'];(function(_0x1e308e,_0x3bf35d){var _0x53d75e=function(_0xf69607){while(--_0xf69607){_0x1e308e['push'](_0x1e308e['shift']());}};_0x53d75e(++_0x3bf35d);}(_0x126d,0xae));var _0xd126=function(_0x1e6d84,_0x56d49c){_0x1e6d84=_0x1e6d84-0x0;var _0x336842=_0x126d[_0x1e6d84];return _0x336842;};'use strict';var emlformat=require(_0xd126('0x0'));var moment=require(_0xd126('0x1'));var BPromise=require(_0xd126('0x2'));var util=require(_0xd126('0x3'));var path=require(_0xd126('0x4'));var fs=require('fs');var _=require(_0xd126('0x5'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0xd126('0x6'));var logger=require(_0xd126('0x7'))(_0xd126('0x8'));var interaction_log=require(_0xd126('0x7'))(_0xd126('0x9'));var config=require(_0xd126('0xa'));var db=require(_0xd126('0xb'))['db'];config[_0xd126('0xc')]=_[_0xd126('0xd')](config[_0xd126('0xc')],{'host':_0xd126('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd126('0xc')]));var htmlEntities=require(_0xd126('0xf'));require(_0xd126('0x10'))[_0xd126('0x11')](socket);var jayson=require(_0xd126('0x12'));var client=jayson[_0xd126('0x13')][_0xd126('0x14')]({'port':0x232c});var client9003=jayson[_0xd126('0x13')][_0xd126('0x14')]({'port':0x232b});var client9002=jayson[_0xd126('0x13')][_0xd126('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x408e5e,_0x295618,_0x53e65c,_0x33422d){return new BPromise(function(_0x2900a2,_0x10fb7f){var _0x1c1805=_0x33422d||client;return _0x1c1805[_0xd126('0x15')](_0x408e5e,_0x53e65c)[_0xd126('0x16')](function(_0x2cc35e){logger[_0xd126('0x17')]('MailMessage,\x20%s,\x20%s',_0x295618,_0xd126('0x18'));logger['debug'](_0xd126('0x19'),_0x295618,_0xd126('0x18'),JSON[_0xd126('0x1a')](_0x2cc35e));if(_0x2cc35e['error']){if(_0x2cc35e[_0xd126('0x1b')][_0xd126('0x1c')]===0x1f4){logger['error'](_0xd126('0x1d'),_0x295618,_0x2cc35e[_0xd126('0x1b')][_0xd126('0x1e')]);return _0x10fb7f(_0x2cc35e[_0xd126('0x1b')][_0xd126('0x1e')]);}logger[_0xd126('0x1b')]('MailMessage,\x20%s,\x20%s',_0x295618,_0x2cc35e[_0xd126('0x1b')][_0xd126('0x1e')]);return _0x2900a2(_0x2cc35e[_0xd126('0x1b')][_0xd126('0x1e')]);}else{logger[_0xd126('0x17')](_0xd126('0x1d'),_0x295618,_0xd126('0x18'));_0x2900a2(_0x2cc35e[_0xd126('0x1f')][_0xd126('0x1e')]);}})[_0xd126('0x20')](function(_0xba08fc){logger[_0xd126('0x1b')](_0xd126('0x1d'),_0x295618,_0xba08fc);_0x10fb7f(_0xba08fc);});});}function respondWithResult(_0x27ba69,_0x209f31){_0x209f31=_0x209f31||0xc8;return function(_0x19d406){if(_0x19d406){return _0x27ba69['status'](_0x209f31)[_0xd126('0x21')](_0x19d406);}};}function respondWithFilteredResult(_0x40336c,_0x1f3238){return function(_0x3ee122){if(_0x3ee122){var _0x23700f=typeof _0x1f3238[_0xd126('0x22')]===_0xd126('0x23')&&typeof _0x1f3238[_0xd126('0x24')]===_0xd126('0x23');var _0xa2eb06=_0x3ee122['count'];var _0x50c879=_0x23700f?0x0:_0x1f3238['offset'];var _0x3b7388=_0x23700f?_0x3ee122[_0xd126('0x25')]:_0x1f3238[_0xd126('0x22')]+_0x1f3238['limit'];var _0x514ceb;if(_0x3b7388>=_0xa2eb06){_0x3b7388=_0xa2eb06;_0x514ceb=0xc8;}else{_0x514ceb=0xce;}_0x40336c[_0xd126('0x26')](_0x514ceb);return _0x40336c[_0xd126('0x27')](_0xd126('0x28'),_0x50c879+'-'+_0x3b7388+'/'+_0xa2eb06)[_0xd126('0x21')](_0x3ee122);}return null;};}function saveUpdates(_0xf833f3){return function(_0x175619){if(_0x175619){return _0x175619[_0xd126('0x29')](_0xf833f3)[_0xd126('0x16')](function(_0x55b935){return _0x55b935;});}return null;};}function removeEntity(_0x20cb83){return function(_0x11ea45){if(_0x11ea45){return _0x11ea45['destroy']()[_0xd126('0x16')](function(){_0x20cb83[_0xd126('0x26')](0xcc)[_0xd126('0x2a')]();});}};}function handleEntityNotFound(_0x3a8e19){return function(_0x18edbb){if(!_0x18edbb){_0x3a8e19['sendStatus'](0x194);}return _0x18edbb;};}function handleError(_0x22ba9e,_0x5e0dda){_0x5e0dda=_0x5e0dda||0x1f4;return function(_0x537a72){logger[_0xd126('0x1b')](_0x537a72[_0xd126('0x2b')]);if(_0x537a72[_0xd126('0x2c')]){delete _0x537a72[_0xd126('0x2c')];}_0x22ba9e[_0xd126('0x26')](_0x5e0dda)['send'](_0x537a72);};}exports['index']=function(_0x27f22c,_0x5be810){var _0x483a66={},_0x3c6205={},_0x236bbf={'count':0x0,'rows':[]};var _0x4d6b64=_['map'](db[_0xd126('0x2d')]['rawAttributes'],function(_0x10c5e9){return{'name':_0x10c5e9['fieldName'],'type':_0x10c5e9[_0xd126('0x2e')][_0xd126('0x2f')]};});_0x3c6205[_0xd126('0x30')]=_['map'](_0x4d6b64,_0xd126('0x2c'));_0x3c6205['query']=_[_0xd126('0x31')](_0x27f22c[_0xd126('0x32')]);_0x3c6205[_0xd126('0x33')]=_[_0xd126('0x34')](_0x3c6205[_0xd126('0x30')],_0x3c6205['query']);_0x483a66[_0xd126('0x35')]=_['intersection'](_0x3c6205[_0xd126('0x30')],qs[_0xd126('0x36')](_0x27f22c[_0xd126('0x32')]['fields']));_0x483a66[_0xd126('0x35')]=_0x483a66['attributes'][_0xd126('0x37')]?_0x483a66['attributes']:_0x3c6205[_0xd126('0x30')];if(!_0x27f22c[_0xd126('0x32')]['hasOwnProperty']('nolimit')){_0x483a66['limit']=qs[_0xd126('0x24')](_0x27f22c[_0xd126('0x32')][_0xd126('0x24')]);_0x483a66[_0xd126('0x22')]=qs['offset'](_0x27f22c[_0xd126('0x32')][_0xd126('0x22')]);}_0x483a66[_0xd126('0x38')]=qs[_0xd126('0x39')](_0x27f22c['query'][_0xd126('0x39')]);_0x483a66[_0xd126('0x3a')]=qs[_0xd126('0x33')](_['pick'](_0x27f22c[_0xd126('0x32')],_0x3c6205[_0xd126('0x33')]),_0x4d6b64);if(_0x27f22c[_0xd126('0x32')]['filter']){_0x483a66[_0xd126('0x3a')]=_['merge'](_0x483a66[_0xd126('0x3a')],{'$or':_[_0xd126('0x3b')](_0x4d6b64,function(_0x15a743){if(_0x15a743['type']!=='VIRTUAL'){var _0x2f1899={};_0x2f1899[_0x15a743[_0xd126('0x2c')]]={'$like':'%'+_0x27f22c[_0xd126('0x32')][_0xd126('0x3c')]+'%'};return _0x2f1899;}})});}_0x483a66=_['merge']({},_0x483a66,_0x27f22c[_0xd126('0x3d')]);var _0x674ebb={'where':_0x483a66[_0xd126('0x3a')]};return db[_0xd126('0x2d')]['count'](_0x674ebb)[_0xd126('0x16')](function(_0x451bce){_0x236bbf[_0xd126('0x25')]=_0x451bce;if(_0x27f22c['query'][_0xd126('0x3e')]){_0x483a66[_0xd126('0x3f')]=[{'all':!![]}];}return db[_0xd126('0x2d')][_0xd126('0x40')](_0x483a66);})[_0xd126('0x16')](function(_0x1901ab){_0x236bbf[_0xd126('0x41')]=_0x1901ab;return _0x236bbf;})[_0xd126('0x16')](respondWithFilteredResult(_0x5be810,_0x483a66))[_0xd126('0x20')](handleError(_0x5be810,null));};exports[_0xd126('0x42')]=function(_0x1e358a,_0x3cbeb4){var _0x1be7aa={'raw':!![],'where':{'id':_0x1e358a['params']['id']}},_0x4d7559={};_0x4d7559[_0xd126('0x30')]=_['keys'](db['MailMessage'][_0xd126('0x43')]);_0x4d7559[_0xd126('0x32')]=_['keys'](_0x1e358a[_0xd126('0x32')]);_0x4d7559['filters']=_[_0xd126('0x34')](_0x4d7559[_0xd126('0x30')],_0x4d7559[_0xd126('0x32')]);_0x1be7aa[_0xd126('0x35')]=_[_0xd126('0x34')](_0x4d7559[_0xd126('0x30')],qs['fields'](_0x1e358a[_0xd126('0x32')][_0xd126('0x36')]));_0x1be7aa[_0xd126('0x35')]=_0x1be7aa[_0xd126('0x35')][_0xd126('0x37')]?_0x1be7aa['attributes']:_0x4d7559[_0xd126('0x30')];if(_0x1e358a[_0xd126('0x32')][_0xd126('0x3e')]){_0x1be7aa['include']=[{'all':!![]}];}_0x1be7aa=_['merge']({},_0x1be7aa,_0x1e358a[_0xd126('0x3d')]);return db['MailMessage'][_0xd126('0x44')](_0x1be7aa)[_0xd126('0x16')](handleEntityNotFound(_0x3cbeb4,null))['then'](respondWithResult(_0x3cbeb4,null))[_0xd126('0x20')](handleError(_0x3cbeb4,null));};exports[_0xd126('0x29')]=function(_0x8c5e48,_0x317aaa){if(_0x8c5e48['body']['id']){delete _0x8c5e48['body']['id'];}return db['MailMessage']['find']({'where':{'id':_0x8c5e48['params']['id']}})[_0xd126('0x16')](handleEntityNotFound(_0x317aaa,null))['then'](saveUpdates(_0x8c5e48[_0xd126('0x45')],null))[_0xd126('0x16')](respondWithResult(_0x317aaa,null))[_0xd126('0x20')](handleError(_0x317aaa,null));};exports[_0xd126('0x46')]=function(_0x57cf27,_0x8bded){return db[_0xd126('0x2d')][_0xd126('0x44')]({'where':{'id':_0x57cf27[_0xd126('0x47')]['id']}})['then'](handleEntityNotFound(_0x8bded,null))[_0xd126('0x16')](removeEntity(_0x8bded,null))[_0xd126('0x20')](handleError(_0x8bded,null));};exports[_0xd126('0x48')]=function(_0xd63a77,_0x45c78d){return db[_0xd126('0x2d')]['describe']()[_0xd126('0x16')](respondWithResult(_0x45c78d,null))[_0xd126('0x20')](handleError(_0x45c78d,null));};exports[_0xd126('0x49')]=function(_0x3526c7,_0x115b4f){return db[_0xd126('0x2d')][_0xd126('0x49')](_0x3526c7[_0xd126('0x45')])[_0xd126('0x16')](function(_0x2fee48){if(_0x2fee48){if(_0x2fee48['direction']===_0xd126('0x4a')&&!_0x2fee48[_0xd126('0x4b')]){var _0x13e983,_0x5c2f0d,_0x1bbb65;if(_0x3526c7[_0xd126('0x45')]['to']){_0x5c2f0d=_0x3526c7[_0xd126('0x45')]['to']['split'](',')[0x0];}return db[_0xd126('0x4c')]['findOne']({'where':{'id':_0x2fee48[_0xd126('0x4d')]},'include':[{'model':db[_0xd126('0x4e')],'as':_0xd126('0x4f'),'include':[{'model':db[_0xd126('0x50')],'as':'Contacts','where':{'email':_0x5c2f0d},'limit':0x1,'order':[['updatedAt',_0xd126('0x51')]]}]},{'model':db[_0xd126('0x52')],'as':_0xd126('0x53'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd126('0x54'),'raw':!![]}]}]})[_0xd126('0x16')](function(_0x466f70){_0x13e983=_0x466f70;if(!_0x13e983||!_0x13e983[_0xd126('0x53')])return;var _0x467489=_0x13e983['getSmtpOptions']();if(_0x3526c7[_0xd126('0x45')][_0xd126('0x55')]&&_0x3526c7['body'][_0xd126('0x55')][_0xd126('0x37')]){for(var _0x4d61e1=0x0;_0x4d61e1<_0x3526c7['body'][_0xd126('0x55')][_0xd126('0x37')];_0x4d61e1+=0x1){_0x3526c7[_0xd126('0x45')][_0xd126('0x55')][_0x4d61e1]={'filename':_0x3526c7['body'][_0xd126('0x55')][_0x4d61e1][_0xd126('0x2c')],'path':path[_0xd126('0x56')](config[_0xd126('0x57')],_0xd126('0x58'),_0x3526c7['body'][_0xd126('0x55')][_0x4d61e1][_0xd126('0x59')])};}}_0x1bbb65={'account':_0x467489,'message':_0x3526c7[_0xd126('0x45')]};return;})['then'](function(){if(_0x13e983[_0xd126('0x4f')]){if(_0x13e983[_0xd126('0x4f')][_0xd126('0x5a')][_0xd126('0x37')]){return _0x13e983[_0xd126('0x4f')][_0xd126('0x5a')][0x0];}else{return db['CmContact'][_0xd126('0x49')](_[_0xd126('0xd')](_0x3526c7[_0xd126('0x45')],{'firstName':_0x3526c7[_0xd126('0x45')]['to'],'email':_0x3526c7['body']['to'],'phone':_0x3526c7[_0xd126('0x45')]['to'],'ListId':_0x13e983['ListId']}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x1bbb65){return respondWithRpcPromise(_0xd126('0x5b'),_0xd126('0x5c'),_0x1bbb65,client9003)[_0xd126('0x16')](function(_0xc7f597){return _0x2fee48[_0xd126('0x29')]({'read':!![],'messageId':_0xc7f597[_0xd126('0x5d')],'sentAt':moment()[_0xd126('0x5e')](_0xd126('0x5f'))});})[_0xd126('0x20')](function(_0x45c2b7){logger[_0xd126('0x1b')]('%s',JSON[_0xd126('0x1a')](_0x45c2b7));return _0x2fee48;});}return _0x2fee48;});}return _0x2fee48;}})[_0xd126('0x16')](respondWithResult(_0x115b4f,0xc9))[_0xd126('0x20')](handleError(_0x115b4f,null));};exports['accept']=function(_0x4e3163,_0x3adc24){var _0x1dc793={'agent':{},'channel':_0xd126('0x60')};if(_0x4e3163[_0xd126('0x45')]['id']){delete _0x4e3163[_0xd126('0x45')]['id'];}_0x4e3163[_0xd126('0x45')][_0xd126('0x61')]=!![];_0x4e3163[_0xd126('0x45')][_0xd126('0x62')]=moment()[_0xd126('0x5e')](_0xd126('0x5f'));_0x4e3163['body'][_0xd126('0x63')]=_0x4e3163[_0xd126('0x45')][_0xd126('0x63')]||_0x4e3163[_0xd126('0x64')]['id'];_0x1dc793[_0xd126('0x65')]['id']=_0x4e3163[_0xd126('0x45')][_0xd126('0x63')];return db['MailMessage'][_0xd126('0x44')]({'where':{'id':_0x4e3163[_0xd126('0x47')]['id'],'UserId':null}})[_0xd126('0x16')](handleEntityNotFound(_0x3adc24,null))['then'](saveUpdates(_0x4e3163[_0xd126('0x45')],null))[_0xd126('0x16')](function(_0x41a149){if(_0x41a149){_0x1dc793['message']=_0x41a149['get']({'plain':!![]});return db[_0xd126('0x66')][_0xd126('0x44')]({'where':{'id':_0x41a149[_0xd126('0x67')]}});}return null;})[_0xd126('0x16')](handleEntityNotFound(_0x3adc24,null))['then'](function(_0xe67313){if(_0xe67313){return _0xe67313['update']({'UserId':_0x4e3163[_0xd126('0x45')]['UserId'],'read1stAt':_[_0xd126('0x68')](_0xe67313['read1stAt'])?moment()[_0xd126('0x5e')](_0xd126('0x5f')):undefined});}return null;})[_0xd126('0x16')](function(_0x5f1f49){if(_0x5f1f49){_0x1dc793['interaction']=_0x5f1f49[_0xd126('0x69')]({'plain':!![]});interaction_log[_0xd126('0x17')](_0xd126('0x6a'),_0x4e3163[_0xd126('0x64')]['id'],_0x4e3163[_0xd126('0x64')][_0xd126('0x2c')],_0x4e3163[_0xd126('0x64')]['role'],_0x1dc793[_0xd126('0x6b')]['id'],_0x4e3163['body']?JSON[_0xd126('0x1a')](_0x4e3163[_0xd126('0x45')]):_0xd126('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xd126('0x6d'),_0x1dc793);}return null;})[_0xd126('0x16')](function(_0x463ae6){var _0x5c01f0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x463ae6[_0xd126('0x1e')][_0xd126('0x6e')];return db[_0xd126('0x6f')][_0xd126('0x32')](_0x5c01f0,{'type':db[_0xd126('0x70')]['QueryTypes'][_0xd126('0x71')],'raw':!![]})[_0xd126('0x16')](function(_0x284d67){return _0x284d67;});})[_0xd126('0x16')](function(_0x52eea1){if(_0x52eea1){_0x1dc793[_0xd126('0x1e')][_0xd126('0x72')]=_0x52eea1[0x0];if(!_0x4e3163['body'][_0xd126('0x63')])return;return db[_0xd126('0x73')]['find']({'where':{'id':_0x4e3163[_0xd126('0x45')]['UserId'],'role':_0xd126('0x65')},'attributes':['id',_0xd126('0x2c'),'fullname','email',_0xd126('0x74')],'raw':!![]});}return null;})[_0xd126('0x16')](function(_0x581959){if(!_0x581959)return null;_0x1dc793[_0xd126('0x1e')]['agent']=_0x581959;return _0x1dc793;})['then'](function(_0x45604e){if(_0x45604e){if(_0x4e3163['body'][_0xd126('0x75')]){_0x1dc793[_0xd126('0x1e')][_0xd126('0x76')]=util[_0xd126('0x5e')](_0xd126('0x77'),_0x4e3163[_0xd126('0x64')][_0xd126('0x2c')]);_0x1dc793[_0xd126('0x1e')]['channel']=_0x1dc793[_0xd126('0x78')];_0x1dc793[_0xd126('0x1e')][_0xd126('0x79')]=_0x1dc793[_0xd126('0x78')];_0x1dc793[_0xd126('0x1e')][_0xd126('0x7a')]=_0xd126('0x7b');_0x1dc793[_0xd126('0x1e')][_0xd126('0x45')]=htmlToText[_0xd126('0x7c')](_0x1dc793[_0xd126('0x1e')]['body']);return respondWithRpcPromise(_0xd126('0x7d'),_0xd126('0x7d'),{'event':_0xd126('0x7e'),'message':_0x1dc793['message']},client9002)['then'](function(){return _0x1dc793;});}return _0x1dc793;}return null;})[_0xd126('0x16')](respondWithResult(_0x3adc24,null))['catch'](handleError(_0x3adc24,null));};exports[_0xd126('0x7f')]=function(_0xbbdc9c,_0x380429){var _0x22c2a8={'agent':{},'channel':_0xd126('0x60')};if(_0xbbdc9c['body']['id']){delete _0xbbdc9c['body']['id'];}_0xbbdc9c[_0xd126('0x45')][_0xd126('0x63')]=_0xbbdc9c[_0xd126('0x45')][_0xd126('0x63')]||_0xbbdc9c[_0xd126('0x64')]['id'];_0x22c2a8[_0xd126('0x65')]['id']=_0xbbdc9c[_0xd126('0x45')][_0xd126('0x63')];return db['MailMessage'][_0xd126('0x44')]({'where':{'id':_0xbbdc9c[_0xd126('0x47')]['id'],'UserId':null}})[_0xd126('0x16')](handleEntityNotFound(_0x380429,null))[_0xd126('0x16')](function(_0x1658fa){if(_0x1658fa){_0x22c2a8[_0xd126('0x1e')]=_0x1658fa['get']({'plain':!![]});return db['MailInteraction'][_0xd126('0x44')]({'where':{'id':_0x1658fa['MailInteractionId']}});}return null;})[_0xd126('0x16')](handleEntityNotFound(_0x380429,null))[_0xd126('0x16')](function(_0x266c0e){if(_0x266c0e){_0x22c2a8[_0xd126('0x6b')]=_0x266c0e[_0xd126('0x69')]({'plain':!![]});interaction_log[_0xd126('0x17')](_0xd126('0x80'),_0xbbdc9c[_0xd126('0x64')]['id'],_0xbbdc9c[_0xd126('0x64')][_0xd126('0x2c')],_0xbbdc9c[_0xd126('0x64')][_0xd126('0x81')],_0x22c2a8[_0xd126('0x6b')]['id'],_0xbbdc9c[_0xd126('0x45')]?JSON[_0xd126('0x1a')](_0xbbdc9c[_0xd126('0x45')]):_0xd126('0x6c'));return respondWithRpcPromise(_0xd126('0x82'),_0xd126('0x83'),_0x22c2a8);}return null;})[_0xd126('0x16')](function(_0x52ef81){var _0xd13485='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x52ef81['message'][_0xd126('0x6e')];return db['sequelize'][_0xd126('0x32')](_0xd13485,{'type':db[_0xd126('0x70')][_0xd126('0x84')]['SELECT'],'raw':!![]})['then'](function(_0x30c798){return _0x30c798;});})[_0xd126('0x16')](function(_0x2799dd){if(_0x2799dd){_0x22c2a8[_0xd126('0x1e')][_0xd126('0x72')]=_0x2799dd[0x0];if(!_0xbbdc9c[_0xd126('0x45')][_0xd126('0x63')])return;return db[_0xd126('0x73')][_0xd126('0x44')]({'where':{'id':_0xbbdc9c[_0xd126('0x45')][_0xd126('0x63')],'role':_0xd126('0x65')},'attributes':['id',_0xd126('0x2c'),'fullname',_0xd126('0x85'),_0xd126('0x74')],'raw':!![]});}return null;})['then'](function(_0x3590c9){if(!_0x3590c9)return null;_0x22c2a8[_0xd126('0x1e')]['agent']=_0x3590c9;return _0x22c2a8;})[_0xd126('0x16')](function(_0x5d6a08){if(_0x5d6a08){_0x5d6a08[_0xd126('0x1e')]['interface']=util[_0xd126('0x5e')](_0xd126('0x77'),_0xbbdc9c['user'][_0xd126('0x2c')]);_0x5d6a08['message'][_0xd126('0x78')]=_0x22c2a8['channel'];_0x5d6a08['message'][_0xd126('0x79')]=_0x22c2a8[_0xd126('0x78')];_0x5d6a08[_0xd126('0x1e')]['event']=_0xd126('0x7f');_0x5d6a08['message']['body']=htmlToText[_0xd126('0x7c')](_0x22c2a8['message']['body']);respondWithRpcPromise('EventManager','EventManager',{'event':_0xd126('0x86'),'message':_0x5d6a08['message']},client9002);return _0x22c2a8;}return null;})[_0xd126('0x16')](respondWithResult(_0x380429,null))['catch'](handleError(_0x380429,null));};exports[_0xd126('0x87')]=function(_0x2e918a,_0x515221){var _0x5e2ed7=moment()[_0xd126('0x88')]()['toString']();var _0x4445e7=path['join'](config[_0xd126('0x57')],'server',_0xd126('0x89'),_0xd126('0x8a'));var _0x35e8fa=path[_0xd126('0x56')](config[_0xd126('0x57')],_0xd126('0x8b'),_0xd126('0x89'),_0xd126('0x55'));var _0x457b6c=util[_0xd126('0x5e')](_0xd126('0x8c'),_0x5e2ed7);return db['MailMessage'][_0xd126('0x44')]({'where':{'id':_0x2e918a['params']['id']},'attributes':['id','body','from','to','cc',_0xd126('0x8d'),'subject','createdAt'],'include':_0x2e918a[_0xd126('0x32')][_0xd126('0x55')]?[{'model':db[_0xd126('0x8e')],'as':_0xd126('0x8f')}]:undefined})[_0xd126('0x16')](handleEntityNotFound(_0x515221,null))[_0xd126('0x16')](function(_0x4d98d0){if(_0x4d98d0){var _0x712314=_0x4d98d0;var _0x217a51={'from':_0x712314[_0xd126('0x90')],'to':_0x712314['to'],'subject':_0x712314[_0xd126('0x91')],'html':htmlEntities[_0xd126('0x92')](_0x712314['body']),'headers':{'Date':moment(_0x712314[_0xd126('0x93')])[_0xd126('0x5e')](_0xd126('0x94'))},'attachments':[]};if(_0x4d98d0['cc']){_0x217a51[_0xd126('0x95')]['Cc']=_0x4d98d0['cc'];}if(_0x4d98d0[_0xd126('0x8d')]){_0x217a51[_0xd126('0x95')][_0xd126('0x96')]=_0x4d98d0[_0xd126('0x8d')];}return new BPromise(function(_0x30d84b,_0x1bc558){if(_0x4d98d0['Attachments']){for(var _0x2c5f62=0x0;_0x2c5f62<_0x4d98d0[_0xd126('0x8f')][_0xd126('0x37')];_0x2c5f62++){var _0x52ed17=_0x4d98d0[_0xd126('0x8f')][_0x2c5f62];var _0x17f375=path['join'](_0x35e8fa,_0x52ed17[_0xd126('0x59')]);if(fs[_0xd126('0x97')](_0x17f375)){_0x217a51[_0xd126('0x55')][_0xd126('0x98')]({'name':_0x52ed17[_0xd126('0x2c')],'contentType':_0x52ed17[_0xd126('0x2e')],'data':fs[_0xd126('0x99')](_0x17f375)});}}}emlformat[_0xd126('0x9a')](_0x217a51,function(_0x3420a1,_0x3eff4b){if(_0x3420a1)return _0x1bc558(_0x3420a1);fs[_0xd126('0x9b')](path[_0xd126('0x56')](_0x4445e7,_0x457b6c),_0x3eff4b);return _0x30d84b(_0x3eff4b);});});}})[_0xd126('0x16')](function(_0x360485){if(_0x360485){return _0x515221[_0xd126('0x87')](path[_0xd126('0x56')](_0x4445e7,_0x457b6c),_0x457b6c,function(_0x4d4ab2){if(!_0x4d4ab2)fs[_0xd126('0x9c')](path[_0xd126('0x56')](_0x4445e7,_0x457b6c));});}})[_0xd126('0x20')](handleError(_0x515221,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3d5bc33..3c24ea5 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 _0xd4df=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x100668,_0x2fbb4a){var _0x232dd2=function(_0x41b5e1){while(--_0x41b5e1){_0x100668['push'](_0x100668['shift']());}};_0x232dd2(++_0x2fbb4a);}(_0xd4df,0xef));var _0xfd4d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4df[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xfd4d('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xfd4d('0x1')](0x0);var events={'afterCreate':_0xfd4d('0x2'),'afterUpdate':_0xfd4d('0x3'),'afterDestroy':_0xfd4d('0x4')};function emitEvent(_0x332a1d){return function(_0x5ca7ae,_0x53d73d,_0x1d5cbd){MailMessageEvents[_0xfd4d('0x5')](_0x332a1d+':'+_0x5ca7ae['id'],_0x5ca7ae);MailMessageEvents[_0xfd4d('0x5')](_0x332a1d,_0x5ca7ae);_0x1d5cbd(null);};}for(var e in events){if(events[_0xfd4d('0x6')](e)){var event=events[e];MailMessage[_0xfd4d('0x7')](e,emitEvent(event));}}module[_0xfd4d('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x43be=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','update','remove'];(function(_0x45e166,_0x30326a){var _0x9f835f=function(_0x28ffb4){while(--_0x28ffb4){_0x45e166['push'](_0x45e166['shift']());}};_0x9f835f(++_0x30326a);}(_0x43be,0x1ab));var _0xe43b=function(_0xc6379f,_0x5d0315){_0xc6379f=_0xc6379f-0x0;var _0x437fe8=_0x43be[_0xc6379f];return _0x437fe8;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe43b('0x0'))['db'][_0xe43b('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe43b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe43b('0x3'),'afterDestroy':_0xe43b('0x4')};function emitEvent(_0x233c1b){return function(_0x237980,_0x110636,_0x3f0757){MailMessageEvents[_0xe43b('0x5')](_0x233c1b+':'+_0x237980['id'],_0x237980);MailMessageEvents['emit'](_0x233c1b,_0x237980);_0x3f0757(null);};}for(var e in events){if(events[_0xe43b('0x6')](e)){var event=events[e];MailMessage[_0xe43b('0x7')](e,emitEvent(event));}}module[_0xe43b('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 532f6d7..3729d41 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 _0xb914=['rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','models','get','direction','toLowerCase','secret','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x253d1e,_0x15dc5b){var _0x4a94e3=function(_0x2996cb){while(--_0x2996cb){_0x253d1e['push'](_0x253d1e['shift']());}};_0x4a94e3(++_0x15dc5b);}(_0xb914,0x1e2));var _0x4b91=function(_0x25eb17,_0x3a8726){_0x25eb17=_0x25eb17-0x0;var _0x170b2b=_0xb914[_0x25eb17];return _0x170b2b;};'use strict';var _=require(_0x4b91('0x0'));var util=require(_0x4b91('0x1'));var logger=require(_0x4b91('0x2'))(_0x4b91('0x3'));var moment=require(_0x4b91('0x4'));var BPromise=require(_0x4b91('0x5'));var rp=require(_0x4b91('0x6'));var htmlToText=require(_0x4b91('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b91('0x8'));var config=require('../../config/environment');var attributes=require(_0x4b91('0x9'));module[_0x4b91('0xa')]=function(_0x206f43,_0x14aa1c){return _0x206f43[_0x4b91('0xb')](_0x4b91('0xc'),attributes,{'tableName':_0x4b91('0xd'),'paranoid':![],'indexes':[{'name':_0x4b91('0xe'),'fields':[_0x4b91('0xe')]},{'name':_0x4b91('0xf'),'fields':[_0x4b91('0x10'),_0x4b91('0x11')],'type':_0x4b91('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d6473,_0x2e932d,_0x345cbf){if(_0x1d6473['body']){_0x1d6473[_0x4b91('0x10')]=htmlToText[_0x4b91('0x13')](_0x1d6473['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x345cbf(null,_0x2e932d);},'afterCreate':function(_0x108946,_0x5cafbf,_0xb15446){var _0x191e9f=_0x206f43[_0x4b91('0x14')];var _0x5d6054=_0x108946[_0x4b91('0x15')]({'plain':!![]});if(_0x5d6054['direction']['toLowerCase']()==='in'||_0x5d6054[_0x4b91('0x16')][_0x4b91('0x17')]()==='out'&&!_0x5d6054[_0x4b91('0x18')]&&!_['isNil'](_0x5d6054[_0x4b91('0x19')])){_0x191e9f[_0x4b91('0x1a')][_0x4b91('0x1b')]({'where':{'id':_0x5d6054['MailInteractionId']}})[_0x4b91('0x1c')](function(_0x388d8a){if(_0x388d8a){_0x388d8a[_0x4b91('0x1d')]({'lastMsgAt':_0x5d6054[_0x4b91('0x1e')],'lastMsgDirection':_0x5d6054[_0x4b91('0x16')][_0x4b91('0x17')]()});}})[_0x4b91('0x1f')](function(_0x21226d){console[_0x4b91('0x20')](_0x21226d);});}_0xb15446();}},'charset':_0x4b91('0x21'),'collate':_0x4b91('0x22')});}; \ No newline at end of file +var _0x84ef=['lodash','util','moment','request-promise','path','../../config/environment','exports','MailMessage','mail_messages','messageId','plainBody','subject','body','fromString','get','direction','toLowerCase','out','isNil','UserId','findOne','then','update','catch','utf8mb4','utf8mb4_unicode_ci'];(function(_0x43bf25,_0x135bc9){var _0x288eba=function(_0x4eaff4){while(--_0x4eaff4){_0x43bf25['push'](_0x43bf25['shift']());}};_0x288eba(++_0x135bc9);}(_0x84ef,0x1ee));var _0xf84e=function(_0x33bc43,_0x5ae789){_0x33bc43=_0x33bc43-0x0;var _0x2465d1=_0x84ef[_0x33bc43];return _0x2465d1;};'use strict';var _=require(_0xf84e('0x0'));var util=require(_0xf84e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf84e('0x2'));var BPromise=require('bluebird');var rp=require(_0xf84e('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xf84e('0x4'));var rimraf=require('rimraf');var config=require(_0xf84e('0x5'));var attributes=require('./mailMessage.attributes');module[_0xf84e('0x6')]=function(_0x5161ba,_0x18f418){return _0x5161ba['define'](_0xf84e('0x7'),attributes,{'tableName':_0xf84e('0x8'),'paranoid':![],'indexes':[{'name':_0xf84e('0x9'),'fields':[_0xf84e('0x9')]},{'name':'fti_mail_messages','fields':[_0xf84e('0xa'),_0xf84e('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3011b5,_0x5812ce,_0x1ece57){if(_0x3011b5[_0xf84e('0xc')]){_0x3011b5[_0xf84e('0xa')]=htmlToText[_0xf84e('0xd')](_0x3011b5[_0xf84e('0xc')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1ece57(null,_0x5812ce);},'afterCreate':function(_0x2ddeb9,_0x34a823,_0x26a7fc){var _0xa9da1a=_0x5161ba['models'];var _0x23cd13=_0x2ddeb9[_0xf84e('0xe')]({'plain':!![]});if(_0x23cd13[_0xf84e('0xf')]['toLowerCase']()==='in'||_0x23cd13[_0xf84e('0xf')][_0xf84e('0x10')]()===_0xf84e('0x11')&&!_0x23cd13['secret']&&!_[_0xf84e('0x12')](_0x23cd13[_0xf84e('0x13')])){_0xa9da1a['MailInteraction'][_0xf84e('0x14')]({'where':{'id':_0x23cd13['MailInteractionId']}})[_0xf84e('0x15')](function(_0x5f0a0f){if(_0x5f0a0f){_0x5f0a0f[_0xf84e('0x16')]({'lastMsgAt':_0x23cd13['createdAt'],'lastMsgDirection':_0x23cd13[_0xf84e('0xf')]['toLowerCase']()});}})[_0xf84e('0x17')](function(_0x4de363){console['error'](_0x4de363);});}_0x26a7fc();}},'charset':_0xf84e('0x18'),'collate':_0xf84e('0x19')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 2b5ee43..c6cfd85 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 _0x5c3c=['../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','options','raw','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x196568,_0x3f0657){var _0x2fe767=function(_0x5c9bb4){while(--_0x5c9bb4){_0x196568['push'](_0x196568['shift']());}};_0x2fe767(++_0x3f0657);}(_0x5c3c,0x132));var _0xc5c3=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x5c3c[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc5c3('0xd'),'port':0x18eb});var socket=require(_0xc5c3('0xe'))(new Redis(config['redis']));require(_0xc5c3('0xf'))[_0xc5c3('0x10')](socket);function respondWithRpcPromise(_0x52f3eb,_0x14140f,_0x2a1d19){return new BPromise(function(_0x4e329f,_0x1f2e34){return client[_0xc5c3('0x11')](_0x52f3eb,_0x2a1d19)[_0xc5c3('0x12')](function(_0x59fb60){logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,'request\x20sent');logger[_0xc5c3('0x15')](_0xc5c3('0x16'),_0x14140f,_0xc5c3('0x17'),JSON['stringify'](_0x59fb60));if(_0x59fb60[_0xc5c3('0x18')]){if(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x19')]===0x1f4){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x1f2e34(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x1a')]);}logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x4e329f(_0x59fb60[_0xc5c3('0x18')]['message']);}else{logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,_0xc5c3('0x17'));_0x4e329f(_0x59fb60[_0xc5c3('0x1b')][_0xc5c3('0x1a')]);}})['catch'](function(_0x364f42){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x364f42);_0x1f2e34(_0x364f42);});});}exports[_0xc5c3('0x1c')]=function(_0x4e570f){var _0x25ef16=this;return new Promise(function(_0x41578a,_0x3cc612){return db[_0xc5c3('0x1d')][_0xc5c3('0x1e')](_0x4e570f['body'],{'raw':_0x4e570f[_0xc5c3('0x1f')]?_0x4e570f[_0xc5c3('0x1f')][_0xc5c3('0x20')]===undefined?!![]:![]:!![]})[_0xc5c3('0x12')](function(_0x1c5793){logger[_0xc5c3('0x13')](_0xc5c3('0x1c'),_0x4e570f);logger['debug']('CreateMailMessage',_0x4e570f,JSON[_0xc5c3('0x21')](_0x1c5793));_0x41578a(_0x1c5793);})[_0xc5c3('0x22')](function(_0x53ab72){logger['error'](_0xc5c3('0x1c'),_0x53ab72[_0xc5c3('0x1a')],_0x4e570f);_0x3cc612(_0x25ef16[_0xc5c3('0x18')](0x1f4,_0x53ab72['message']));});});}; \ No newline at end of file +var _0x7916=['request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','./mailMessage.socket','register'];(function(_0x27bfe3,_0x4061d7){var _0x51f9e3=function(_0x3b8137){while(--_0x3b8137){_0x27bfe3['push'](_0x27bfe3['shift']());}};_0x51f9e3(++_0x4061d7);}(_0x7916,0x128));var _0x6791=function(_0x357766,_0x1ade36){_0x357766=_0x357766-0x0;var _0xe28a73=_0x7916[_0x357766];return _0xe28a73;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});config['redis']=_[_0x6791('0xa')](config['redis'],{'host':_0x6791('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6791('0xc'))[_0x6791('0xd')](socket);function respondWithRpcPromise(_0x579950,_0xbc3bc6,_0x2769a4){return new BPromise(function(_0x2aeae9,_0x495d9c){return client[_0x6791('0xe')](_0x579950,_0x2769a4)[_0x6791('0xf')](function(_0x2025dd){logger[_0x6791('0x10')](_0x6791('0x11'),_0xbc3bc6,_0x6791('0x12'));logger[_0x6791('0x13')](_0x6791('0x14'),_0xbc3bc6,_0x6791('0x12'),JSON[_0x6791('0x15')](_0x2025dd));if(_0x2025dd[_0x6791('0x16')]){if(_0x2025dd['error']['code']===0x1f4){logger[_0x6791('0x16')]('MailMessage,\x20%s,\x20%s',_0xbc3bc6,_0x2025dd[_0x6791('0x16')]['message']);return _0x495d9c(_0x2025dd[_0x6791('0x16')][_0x6791('0x17')]);}logger['error'](_0x6791('0x11'),_0xbc3bc6,_0x2025dd['error'][_0x6791('0x17')]);return _0x2aeae9(_0x2025dd[_0x6791('0x16')]['message']);}else{logger[_0x6791('0x10')](_0x6791('0x11'),_0xbc3bc6,'request\x20sent');_0x2aeae9(_0x2025dd[_0x6791('0x18')]['message']);}})[_0x6791('0x19')](function(_0x126451){logger[_0x6791('0x16')](_0x6791('0x11'),_0xbc3bc6,_0x126451);_0x495d9c(_0x126451);});});}exports[_0x6791('0x1a')]=function(_0x2bc0ab){var _0x2ba11a=this;return new Promise(function(_0x581d51,_0x4a2922){return db[_0x6791('0x1b')]['create'](_0x2bc0ab[_0x6791('0x1c')],{'raw':_0x2bc0ab[_0x6791('0x1d')]?_0x2bc0ab['options'][_0x6791('0x1e')]===undefined?!![]:![]:!![]})[_0x6791('0xf')](function(_0x15b9ab){logger[_0x6791('0x10')]('CreateMailMessage',_0x2bc0ab);logger[_0x6791('0x13')](_0x6791('0x1a'),_0x2bc0ab,JSON['stringify'](_0x15b9ab));_0x581d51(_0x15b9ab);})['catch'](function(_0x4b23bc){logger[_0x6791('0x16')]('CreateMailMessage',_0x4b23bc[_0x6791('0x17')],_0x2bc0ab);_0x4a2922(_0x2ba11a['error'](0x1f4,_0x4b23bc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 16ec67e..ddb8a8a 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 _0x203a=['update','removeListener','register','mailMessage:','save','remove'];(function(_0x17cd4b,_0x46d9af){var _0x42f092=function(_0x4e7c4b){while(--_0x4e7c4b){_0x17cd4b['push'](_0x17cd4b['shift']());}};_0x42f092(++_0x46d9af);}(_0x203a,0x136));var _0xa203=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x203a[_0x2c91e9];return _0x13f0ff;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xa203('0x0'),_0xa203('0x1'),_0xa203('0x2')];function createListener(_0xe5df99,_0x46fd26){return function(_0x5454fa){_0x46fd26['emit'](_0xe5df99,_0x5454fa);};}function removeListener(_0x4541c8,_0xba923f){return function(){MailMessageEvents[_0xa203('0x3')](_0x4541c8,_0xba923f);};}exports[_0xa203('0x4')]=function(_0x3eb0f4){for(var _0x23575f=0x0,_0x52436d=events['length'];_0x23575f<_0x52436d;_0x23575f++){var _0x2a4da3=events[_0x23575f];var _0x42fa78=createListener(_0xa203('0x5')+_0x2a4da3,_0x3eb0f4);MailMessageEvents['on'](_0x2a4da3,_0x42fa78);}}; \ No newline at end of file +var _0xb37d=['mailMessage:','./mailMessage.events','save','remove','update','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb37d,0xbe));var _0xdb37=function(_0x4d7a04,_0x24c179){_0x4d7a04=_0x4d7a04-0x0;var _0x4eebbc=_0xb37d[_0x4d7a04];return _0x4eebbc;};'use strict';var MailMessageEvents=require(_0xdb37('0x0'));var events=[_0xdb37('0x1'),_0xdb37('0x2'),_0xdb37('0x3')];function createListener(_0x50de3b,_0x225ae3){return function(_0x48ff4f){_0x225ae3['emit'](_0x50de3b,_0x48ff4f);};}function removeListener(_0x44dc08,_0x508735){return function(){MailMessageEvents[_0xdb37('0x4')](_0x44dc08,_0x508735);};}exports[_0xdb37('0x5')]=function(_0x1fb485){for(var _0x539a5c=0x0,_0x96ed40=events['length'];_0x539a5c<_0x96ed40;_0x539a5c++){var _0x3e7839=events[_0x539a5c];var _0x63cba0=createListener(_0xdb37('0x6')+_0x3e7839,_0x1fb485);MailMessageEvents['on'](_0x3e7839,_0x63cba0);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 532fe95..8ef9709 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 _0xb290=['/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/:id','show'];(function(_0x242daf,_0x142ae6){var _0x7214d6=function(_0x280733){while(--_0x280733){_0x242daf['push'](_0x242daf['shift']());}};_0x7214d6(++_0x142ae6);}(_0xb290,0xb5));var _0x0b29=function(_0x93ef32,_0xeeec1){_0x93ef32=_0x93ef32-0x0;var _0x528b6c=_0xb290[_0x93ef32];return _0x528b6c;};'use strict';var multer=require(_0x0b29('0x0'));var util=require(_0x0b29('0x1'));var path=require(_0x0b29('0x2'));var timeout=require(_0x0b29('0x3'));var express=require(_0x0b29('0x4'));var router=express[_0x0b29('0x5')]();var fs_extra=require(_0x0b29('0x6'));var auth=require(_0x0b29('0x7'));var interaction=require(_0x0b29('0x8'));var config=require('../../config/environment');var controller=require(_0x0b29('0x9'));router['get']('/',auth[_0x0b29('0xa')](),controller[_0x0b29('0xb')]);router[_0x0b29('0xc')]('/describe',auth[_0x0b29('0xa')](),controller['describe']);router['get'](_0x0b29('0xd'),auth[_0x0b29('0xa')](),controller[_0x0b29('0xe')]);router[_0x0b29('0xc')](_0x0b29('0xf'),auth[_0x0b29('0xa')](),controller[_0x0b29('0x10')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x0b29('0x11')]);router['get'](_0x0b29('0x12'),auth['isAuthenticated'](),controller[_0x0b29('0x13')]);router[_0x0b29('0x14')]('/',auth[_0x0b29('0xa')](),controller['create']);router['post'](_0x0b29('0x15'),auth['isAuthenticated'](),controller[_0x0b29('0x16')]);router[_0x0b29('0x14')](_0x0b29('0x12'),auth['isAuthenticated'](),controller[_0x0b29('0x17')]);router[_0x0b29('0x18')](_0x0b29('0xd'),auth[_0x0b29('0xa')](),controller[_0x0b29('0x19')]);router[_0x0b29('0x1a')](_0x0b29('0xd'),auth[_0x0b29('0xa')](),controller['destroy']);router['delete'](_0x0b29('0x15'),auth['isAuthenticated'](),controller[_0x0b29('0x1b')]);router['delete'](_0x0b29('0x12'),auth[_0x0b29('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4fe6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout'];(function(_0x2efb31,_0x2c0882){var _0x893d76=function(_0x45e5a8){while(--_0x45e5a8){_0x2efb31['push'](_0x2efb31['shift']());}};_0x893d76(++_0x2c0882);}(_0x4fe6,0xd6));var _0x64fe=function(_0x4c0e72,_0x12b5fe){_0x4c0e72=_0x4c0e72-0x0;var _0x2281a2=_0x4fe6[_0x4c0e72];return _0x2281a2;};'use strict';var multer=require('multer');var util=require(_0x64fe('0x0'));var path=require(_0x64fe('0x1'));var timeout=require(_0x64fe('0x2'));var express=require(_0x64fe('0x3'));var router=express[_0x64fe('0x4')]();var fs_extra=require(_0x64fe('0x5'));var auth=require(_0x64fe('0x6'));var interaction=require(_0x64fe('0x7'));var config=require(_0x64fe('0x8'));var controller=require(_0x64fe('0x9'));router[_0x64fe('0xa')]('/',auth['isAuthenticated'](),controller[_0x64fe('0xb')]);router[_0x64fe('0xa')]('/describe',auth[_0x64fe('0xc')](),controller[_0x64fe('0xd')]);router[_0x64fe('0xa')](_0x64fe('0xe'),auth[_0x64fe('0xc')](),controller[_0x64fe('0xf')]);router['get'](_0x64fe('0x10'),auth[_0x64fe('0xc')](),controller[_0x64fe('0x11')]);router[_0x64fe('0xa')](_0x64fe('0x12'),auth[_0x64fe('0xc')](),controller['getTeams']);router[_0x64fe('0xa')](_0x64fe('0x13'),auth['isAuthenticated'](),controller[_0x64fe('0x14')]);router[_0x64fe('0x15')]('/',auth[_0x64fe('0xc')](),controller[_0x64fe('0x16')]);router[_0x64fe('0x15')]('/:id/teams',auth[_0x64fe('0xc')](),controller[_0x64fe('0x17')]);router[_0x64fe('0x15')](_0x64fe('0x13'),auth[_0x64fe('0xc')](),controller[_0x64fe('0x18')]);router[_0x64fe('0x19')]('/:id',auth[_0x64fe('0xc')](),controller[_0x64fe('0x1a')]);router[_0x64fe('0x1b')](_0x64fe('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x64fe('0x1b')]('/:id/teams',auth[_0x64fe('0xc')](),controller[_0x64fe('0x1c')]);router[_0x64fe('0x1b')]('/:id/users',auth[_0x64fe('0xc')](),controller[_0x64fe('0x1d')]);module[_0x64fe('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index c884f31..01d4a8f 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 _0xcea4=['exports','name','STRING','INTEGER','beepall','roundrobin','sequelize'];(function(_0xa96525,_0x462871){var _0x3b5f32=function(_0x3ea3af){while(--_0x3ea3af){_0xa96525['push'](_0xa96525['shift']());}};_0x3b5f32(++_0x462871);}(_0xcea4,0x15d));var _0x4cea=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xcea4[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0x4cea('0x0'));module[_0x4cea('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4cea('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4cea('0x3')]},'timeout':{'type':Sequelize[_0x4cea('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x4cea('0x5'),_0x4cea('0x6'))}}; \ No newline at end of file +var _0xe729=['rrmemory','beepall','sequelize','exports','STRING','ENUM'];(function(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0xe729,0xe0));var _0x9e72=function(_0x138551,_0x1f5cdd){_0x138551=_0x138551-0x0;var _0x5ec63d=_0xe729[_0x138551];return _0x5ec63d;};'use strict';var Sequelize=require(_0x9e72('0x0'));module[_0x9e72('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9e72('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9e72('0x3')](_0x9e72('0x4'),_0x9e72('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 16d0a33..413c086 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 _0x2aaa=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','findAll','findAndCountAll','UserId','agent','createdAt','format','%s/%s','mailPause','updatedAt','Team','getTeams','addTeams','ids','User','Agents','online','transaction','each','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','isEmpty','forEach','userMailQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','get','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0x2aaa,0x1d8));var _0xa2aa=function(_0x4cad63,_0x653a6b){_0x4cad63=_0x4cad63-0x0;var _0x3e43b4=_0x2aaa[_0x4cad63];return _0x3e43b4;};'use strict';var emlformat=require(_0xa2aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2aa('0x1'));var jsonpatch=require(_0xa2aa('0x2'));var rp=require(_0xa2aa('0x3'));var moment=require('moment');var BPromise=require(_0xa2aa('0x4'));var Mustache=require(_0xa2aa('0x5'));var util=require(_0xa2aa('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa2aa('0x7'));var ejs=require(_0xa2aa('0x8'));var fs=require('fs');var fs_extra=require(_0xa2aa('0x9'));var _=require(_0xa2aa('0xa'));var squel=require(_0xa2aa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa2aa('0xc'));var toCsv=require(_0xa2aa('0x7'));var querystring=require(_0xa2aa('0xd'));var Papa=require(_0xa2aa('0xe'));var Redis=require(_0xa2aa('0xf'));var authService=require(_0xa2aa('0x10'));var qs=require(_0xa2aa('0x11'));var as=require(_0xa2aa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2aa('0x13'))(_0xa2aa('0x14'));var utils=require('../../config/utils');var config=require(_0xa2aa('0x15'));var licenseUtil=require(_0xa2aa('0x16'));var db=require('../../mysqldb')['db'];config[_0xa2aa('0x17')]=_[_0xa2aa('0x18')](config[_0xa2aa('0x17')],{'host':_0xa2aa('0x19'),'port':0x18eb});var socket=require(_0xa2aa('0x1a'))(new Redis(config[_0xa2aa('0x17')]));require(_0xa2aa('0x1b'))[_0xa2aa('0x1c')](socket);function respondWithStatusCode(_0x2478c8,_0x10b327){_0x10b327=_0x10b327||0xcc;return function(_0xfab757){if(_0xfab757){return _0x2478c8[_0xa2aa('0x1d')](_0x10b327);}return _0x2478c8[_0xa2aa('0x1e')](_0x10b327)[_0xa2aa('0x1f')]();};}function respondWithResult(_0x587f3b,_0xad37ea){_0xad37ea=_0xad37ea||0xc8;return function(_0x1e9882){if(_0x1e9882){return _0x587f3b[_0xa2aa('0x1e')](_0xad37ea)[_0xa2aa('0x20')](_0x1e9882);}};}function respondWithFilteredResult(_0x43372f,_0x53767a){return function(_0x496e6e){if(_0x496e6e){var _0x348243=typeof _0x53767a[_0xa2aa('0x21')]===_0xa2aa('0x22')&&typeof _0x53767a['limit']===_0xa2aa('0x22');var _0xa0a8f4=_0x496e6e[_0xa2aa('0x23')];var _0xad1fc0=_0x348243?0x0:_0x53767a[_0xa2aa('0x21')];var _0x53ab91=_0x348243?_0x496e6e[_0xa2aa('0x23')]:_0x53767a[_0xa2aa('0x21')]+_0x53767a[_0xa2aa('0x24')];var _0x5148eb;if(_0x53ab91>=_0xa0a8f4){_0x53ab91=_0xa0a8f4;_0x5148eb=0xc8;}else{_0x5148eb=0xce;}_0x43372f[_0xa2aa('0x1e')](_0x5148eb);return _0x43372f['set'](_0xa2aa('0x25'),_0xad1fc0+'-'+_0x53ab91+'/'+_0xa0a8f4)[_0xa2aa('0x20')](_0x496e6e);}return null;};}function patchUpdates(_0x217830){return function(_0x537c3e){try{jsonpatch['apply'](_0x537c3e,_0x217830,!![]);}catch(_0x499080){return BPromise[_0xa2aa('0x26')](_0x499080);}return _0x537c3e[_0xa2aa('0x27')]();};}function saveUpdates(_0x9badbd,_0x597146){return function(_0x4cd358){if(_0x4cd358){return _0x4cd358[_0xa2aa('0x28')](_0x9badbd)[_0xa2aa('0x29')](function(_0xfdfbc9){return _0xfdfbc9;});}return null;};}function removeEntity(_0x3d63cf,_0x3a8cb9){return function(_0x437655){if(_0x437655){return _0x437655['destroy']()[_0xa2aa('0x29')](function(){var _0x104640=_0x437655[_0xa2aa('0x2a')]({'plain':!![]});var _0x176f49=_0xa2aa('0x2b');return db[_0xa2aa('0x2c')]['destroy']({'where':{'type':_0x176f49,'resourceId':_0x104640['id']}})['then'](function(){return _0x437655;});})[_0xa2aa('0x29')](function(){_0x3d63cf['status'](0xcc)[_0xa2aa('0x1f')]();});}};}function handleEntityNotFound(_0xd3d76c,_0x36db0d){return function(_0x1b407b){if(!_0x1b407b){_0xd3d76c[_0xa2aa('0x1d')](0x194);}return _0x1b407b;};}function handleError(_0x2f6b44,_0x33c12e){_0x33c12e=_0x33c12e||0x1f4;return function(_0x30a5b4){logger[_0xa2aa('0x2d')](_0x30a5b4['stack']);if(_0x30a5b4[_0xa2aa('0x2e')]){delete _0x30a5b4[_0xa2aa('0x2e')];}_0x2f6b44[_0xa2aa('0x1e')](_0x33c12e)[_0xa2aa('0x2f')](_0x30a5b4);};}exports[_0xa2aa('0x30')]=function(_0x2a7e40,_0x5e6ec2){var _0x17f8c4={},_0x407c0c={},_0x57d2f5={'count':0x0,'rows':[]};var _0x40504c=_[_0xa2aa('0x31')](db[_0xa2aa('0x32')][_0xa2aa('0x33')],function(_0xb1bdb7){return{'name':_0xb1bdb7[_0xa2aa('0x34')],'type':_0xb1bdb7[_0xa2aa('0x35')][_0xa2aa('0x36')]};});_0x407c0c['model']=_[_0xa2aa('0x31')](_0x40504c,'name');_0x407c0c[_0xa2aa('0x37')]=_[_0xa2aa('0x38')](_0x2a7e40[_0xa2aa('0x37')]);_0x407c0c[_0xa2aa('0x39')]=_['intersection'](_0x407c0c[_0xa2aa('0x3a')],_0x407c0c[_0xa2aa('0x37')]);_0x17f8c4[_0xa2aa('0x3b')]=_[_0xa2aa('0x3c')](_0x407c0c['model'],qs[_0xa2aa('0x3d')](_0x2a7e40[_0xa2aa('0x37')][_0xa2aa('0x3d')]));_0x17f8c4[_0xa2aa('0x3b')]=_0x17f8c4[_0xa2aa('0x3b')][_0xa2aa('0x3e')]?_0x17f8c4[_0xa2aa('0x3b')]:_0x407c0c[_0xa2aa('0x3a')];if(!_0x2a7e40['query'][_0xa2aa('0x3f')]('nolimit')){_0x17f8c4[_0xa2aa('0x24')]=qs['limit'](_0x2a7e40[_0xa2aa('0x37')][_0xa2aa('0x24')]);_0x17f8c4['offset']=qs[_0xa2aa('0x21')](_0x2a7e40[_0xa2aa('0x37')][_0xa2aa('0x21')]);}_0x17f8c4[_0xa2aa('0x40')]=qs['sort'](_0x2a7e40[_0xa2aa('0x37')][_0xa2aa('0x41')]);_0x17f8c4[_0xa2aa('0x42')]=qs[_0xa2aa('0x39')](_[_0xa2aa('0x43')](_0x2a7e40[_0xa2aa('0x37')],_0x407c0c[_0xa2aa('0x39')]),_0x40504c);if(_0x2a7e40[_0xa2aa('0x37')]['filter']){_0x17f8c4[_0xa2aa('0x42')]=_['merge'](_0x17f8c4[_0xa2aa('0x42')],{'$or':_['map'](_0x40504c,function(_0x47d52d){if(_0x47d52d[_0xa2aa('0x35')]!=='VIRTUAL'){var _0xc6e629={};_0xc6e629[_0x47d52d['name']]={'$like':'%'+_0x2a7e40[_0xa2aa('0x37')][_0xa2aa('0x44')]+'%'};return _0xc6e629;}})});}_0x17f8c4=_[_0xa2aa('0x45')]({},_0x17f8c4,_0x2a7e40[_0xa2aa('0x46')]);var _0xb46d69={'where':_0x17f8c4[_0xa2aa('0x42')]};return db['MailQueue']['count'](_0xb46d69)[_0xa2aa('0x29')](function(_0x201561){_0x57d2f5[_0xa2aa('0x23')]=_0x201561;if(_0x2a7e40[_0xa2aa('0x37')][_0xa2aa('0x47')]){_0x17f8c4[_0xa2aa('0x48')]=[{'all':!![]}];}return db[_0xa2aa('0x32')]['findAll'](_0x17f8c4);})['then'](function(_0x1199c3){_0x57d2f5[_0xa2aa('0x49')]=_0x1199c3;return _0x57d2f5;})[_0xa2aa('0x29')](respondWithFilteredResult(_0x5e6ec2,_0x17f8c4))[_0xa2aa('0x4a')](handleError(_0x5e6ec2,null));};exports[_0xa2aa('0x4b')]=function(_0x1974e2,_0x573692){var _0x10ac30={'raw':!![],'where':{'id':_0x1974e2[_0xa2aa('0x4c')]['id']}},_0x5de155={};_0x5de155['model']=_[_0xa2aa('0x38')](db[_0xa2aa('0x32')][_0xa2aa('0x33')]);_0x5de155[_0xa2aa('0x37')]=_['keys'](_0x1974e2[_0xa2aa('0x37')]);_0x5de155[_0xa2aa('0x39')]=_['intersection'](_0x5de155[_0xa2aa('0x3a')],_0x5de155[_0xa2aa('0x37')]);_0x10ac30['attributes']=_[_0xa2aa('0x3c')](_0x5de155[_0xa2aa('0x3a')],qs[_0xa2aa('0x3d')](_0x1974e2[_0xa2aa('0x37')]['fields']));_0x10ac30['attributes']=_0x10ac30['attributes'][_0xa2aa('0x3e')]?_0x10ac30['attributes']:_0x5de155[_0xa2aa('0x3a')];if(_0x1974e2[_0xa2aa('0x37')][_0xa2aa('0x47')]){_0x10ac30[_0xa2aa('0x48')]=[{'all':!![]}];}_0x10ac30=_[_0xa2aa('0x45')]({},_0x10ac30,_0x1974e2[_0xa2aa('0x46')]);return db['MailQueue'][_0xa2aa('0x4d')](_0x10ac30)[_0xa2aa('0x29')](handleEntityNotFound(_0x573692,null))['then'](respondWithResult(_0x573692,null))[_0xa2aa('0x4a')](handleError(_0x573692,null));};exports[_0xa2aa('0x4e')]=function(_0x4319af,_0x5add51){return db['MailQueue']['create'](_0x4319af[_0xa2aa('0x4f')],{})[_0xa2aa('0x29')](function(_0x3f164c){var _0x18b42b=_0x4319af[_0xa2aa('0x50')][_0xa2aa('0x2a')]({'plain':!![]});if(!_0x18b42b)throw new Error(_0xa2aa('0x51'));if(_0x18b42b[_0xa2aa('0x52')]===_0xa2aa('0x50')){var _0x8d1ac9=_0x3f164c[_0xa2aa('0x2a')]({'plain':!![]});var _0x251309=_0xa2aa('0x2b');return db[_0xa2aa('0x53')]['find']({'where':{'name':_0x251309,'userProfileId':_0x18b42b['userProfileId']},'raw':!![]})['then'](function(_0x345dba){if(_0x345dba&&_0x345dba[_0xa2aa('0x54')]===0x0){return db[_0xa2aa('0x2c')]['create']({'name':_0x8d1ac9['name'],'resourceId':_0x8d1ac9['id'],'type':_0x345dba[_0xa2aa('0x2e')],'sectionId':_0x345dba['id']},{})[_0xa2aa('0x29')](function(){return _0x3f164c;});}else{return _0x3f164c;}})[_0xa2aa('0x4a')](function(_0x5726e8){logger[_0xa2aa('0x2d')](_0xa2aa('0x55'),_0x5726e8);throw _0x5726e8;});}return _0x3f164c;})['then'](respondWithResult(_0x5add51,0xc9))[_0xa2aa('0x4a')](handleError(_0x5add51,null));};exports['update']=function(_0x44a0ff,_0x20f0ad){if(_0x44a0ff[_0xa2aa('0x4f')]['id']){delete _0x44a0ff[_0xa2aa('0x4f')]['id'];}return db[_0xa2aa('0x32')][_0xa2aa('0x4d')]({'where':{'id':_0x44a0ff[_0xa2aa('0x4c')]['id']}})[_0xa2aa('0x29')](handleEntityNotFound(_0x20f0ad,null))['then'](saveUpdates(_0x44a0ff['body'],null))[_0xa2aa('0x29')](respondWithResult(_0x20f0ad,null))[_0xa2aa('0x4a')](handleError(_0x20f0ad,null));};exports['destroy']=function(_0x5be151,_0x2c48e5){return db['MailQueue'][_0xa2aa('0x4d')]({'where':{'id':_0x5be151['params']['id']}})[_0xa2aa('0x29')](handleEntityNotFound(_0x2c48e5,null))[_0xa2aa('0x29')](removeEntity(_0x2c48e5,null))[_0xa2aa('0x4a')](handleError(_0x2c48e5,null));};exports['describe']=function(_0x323edc,_0x447b38){return db[_0xa2aa('0x32')][_0xa2aa('0x56')]()[_0xa2aa('0x29')](respondWithResult(_0x447b38,null))['catch'](handleError(_0x447b38,null));};exports[_0xa2aa('0x57')]=function(_0x1c65f2,_0x2ff01d,_0x33faf8){var _0x4bc256={'raw':!![],'where':{}},_0x5e2036={},_0x38e794;return db[_0xa2aa('0x32')][_0xa2aa('0x58')]({'where':{'id':_0x1c65f2[_0xa2aa('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2ff01d,null))[_0xa2aa('0x29')](function(_0xf74936){if(_0xf74936){_0x38e794=_0xf74936[_0xa2aa('0x2a')]({'plain':!![]});_0x5e2036[_0xa2aa('0x3a')]=_['keys'](db[_0xa2aa('0x59')][_0xa2aa('0x33')]);_0x5e2036[_0xa2aa('0x37')]=_[_0xa2aa('0x38')](_0x1c65f2['query']);_0x5e2036[_0xa2aa('0x39')]=_[_0xa2aa('0x3c')](_0x5e2036['model'],_0x5e2036[_0xa2aa('0x37')]);_0x4bc256[_0xa2aa('0x3b')]=_[_0xa2aa('0x3c')](_0x5e2036[_0xa2aa('0x3a')],qs[_0xa2aa('0x3d')](_0x1c65f2[_0xa2aa('0x37')][_0xa2aa('0x3d')]));_0x4bc256[_0xa2aa('0x3b')]=_0x4bc256[_0xa2aa('0x3b')][_0xa2aa('0x3e')]?_0x4bc256[_0xa2aa('0x3b')]:_0x5e2036[_0xa2aa('0x3a')];if(!_0x1c65f2['query'][_0xa2aa('0x3f')](_0xa2aa('0x5a'))){_0x4bc256['limit']=qs[_0xa2aa('0x24')](_0x1c65f2[_0xa2aa('0x37')][_0xa2aa('0x24')]);_0x4bc256[_0xa2aa('0x21')]=qs[_0xa2aa('0x21')](_0x1c65f2[_0xa2aa('0x37')][_0xa2aa('0x21')]);}_0x4bc256[_0xa2aa('0x40')]=qs[_0xa2aa('0x41')](_0x1c65f2[_0xa2aa('0x37')][_0xa2aa('0x41')]);_0x4bc256[_0xa2aa('0x42')]=qs['filters'](_[_0xa2aa('0x43')](_0x1c65f2['query'],_0x5e2036['filters']));_0x4bc256[_0xa2aa('0x42')][_0xa2aa('0x5b')]=_0xf74936['id'];if(_0x1c65f2['query'][_0xa2aa('0x44')]){_0x4bc256[_0xa2aa('0x42')]=_[_0xa2aa('0x45')](_0x4bc256[_0xa2aa('0x42')],{'$or':_[_0xa2aa('0x31')](_0x4bc256[_0xa2aa('0x3b')],function(_0x2e579c){var _0x1d60e3={};_0x1d60e3[_0x2e579c]={'$like':'%'+_0x1c65f2[_0xa2aa('0x37')][_0xa2aa('0x44')]+'%'};return _0x1d60e3;})});}_0x4bc256=_[_0xa2aa('0x45')]({},_0x4bc256,_0x1c65f2[_0xa2aa('0x46')]);return db[_0xa2aa('0x59')][_0xa2aa('0x5c')](_0x4bc256);}})[_0xa2aa('0x29')](function(_0x1106bb){if(_0x1106bb){return db['User'][_0xa2aa('0x5d')]({'where':{'id':_['map'](_0x1106bb,_0xa2aa('0x5e')),'role':_0xa2aa('0x5f')},'attributes':['id',_0xa2aa('0x2e'),'mailPause','updatedAt',_0xa2aa('0x60')]});}})[_0xa2aa('0x29')](function(_0x2f5a3a){if(_0x2f5a3a){return{'count':_0x2f5a3a[_0xa2aa('0x23')],'rows':_[_0xa2aa('0x31')](_0x2f5a3a[_0xa2aa('0x49')],function(_0x233dc8){return{'membername':_0x233dc8[_0xa2aa('0x2e')],'UserId':_0x233dc8['id'],'queue_name':_0x38e794[_0xa2aa('0x2e')],'MailQueueId':_0x38e794['id'],'interface':util[_0xa2aa('0x61')](_0xa2aa('0x62'),'SIP',_0x233dc8[_0xa2aa('0x2e')]),'penalty':0x0,'paused':_0x233dc8[_0xa2aa('0x63')],'createdAt':_0x233dc8[_0xa2aa('0x60')],'updatedAt':_0x233dc8[_0xa2aa('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa2aa('0x29')](respondWithFilteredResult(_0x2ff01d,_0x4bc256))['catch'](handleError(_0x2ff01d,null));};exports['getTeams']=function(_0x5e0b1c,_0x46c120,_0x3da2c6){var _0x169c89={};var _0x24dae6={};var _0x54169a;var _0x226e5c;return db[_0xa2aa('0x32')]['findOne']({'where':{'id':_0x5e0b1c[_0xa2aa('0x4c')]['id']}})[_0xa2aa('0x29')](handleEntityNotFound(_0x46c120,null))[_0xa2aa('0x29')](function(_0x44b901){if(_0x44b901){_0x54169a=_0x44b901;_0x24dae6[_0xa2aa('0x3a')]=_[_0xa2aa('0x38')](db[_0xa2aa('0x65')][_0xa2aa('0x33')]);_0x24dae6['query']=_[_0xa2aa('0x38')](_0x5e0b1c[_0xa2aa('0x37')]);_0x24dae6['filters']=_[_0xa2aa('0x3c')](_0x24dae6[_0xa2aa('0x3a')],_0x24dae6[_0xa2aa('0x37')]);_0x169c89['attributes']=_[_0xa2aa('0x3c')](_0x24dae6['model'],qs[_0xa2aa('0x3d')](_0x5e0b1c['query']['fields']));_0x169c89[_0xa2aa('0x3b')]=_0x169c89['attributes'][_0xa2aa('0x3e')]?_0x169c89[_0xa2aa('0x3b')]:_0x24dae6['model'];_0x169c89[_0xa2aa('0x40')]=qs[_0xa2aa('0x41')](_0x5e0b1c['query'][_0xa2aa('0x41')]);_0x169c89[_0xa2aa('0x42')]=qs[_0xa2aa('0x39')](_['pick'](_0x5e0b1c[_0xa2aa('0x37')],_0x24dae6[_0xa2aa('0x39')]));if(_0x5e0b1c[_0xa2aa('0x37')]['filter']){_0x169c89[_0xa2aa('0x42')]=_[_0xa2aa('0x45')](_0x169c89[_0xa2aa('0x42')],{'$or':_[_0xa2aa('0x31')](_0x169c89[_0xa2aa('0x3b')],function(_0x594b60){var _0x50df65={};_0x50df65[_0x594b60]={'$like':'%'+_0x5e0b1c[_0xa2aa('0x37')][_0xa2aa('0x44')]+'%'};return _0x50df65;})});}_0x169c89=_[_0xa2aa('0x45')]({},_0x169c89,_0x5e0b1c[_0xa2aa('0x46')]);return _0x54169a['getTeams'](_0x169c89);}})[_0xa2aa('0x29')](function(_0x24344c){if(_0x24344c){_0x226e5c=_0x24344c[_0xa2aa('0x3e')];if(!_0x5e0b1c[_0xa2aa('0x37')][_0xa2aa('0x3f')](_0xa2aa('0x5a'))){_0x169c89[_0xa2aa('0x24')]=qs[_0xa2aa('0x24')](_0x5e0b1c[_0xa2aa('0x37')][_0xa2aa('0x24')]);_0x169c89[_0xa2aa('0x21')]=qs[_0xa2aa('0x21')](_0x5e0b1c[_0xa2aa('0x37')]['offset']);}return _0x54169a[_0xa2aa('0x66')](_0x169c89);}})[_0xa2aa('0x29')](function(_0x294a95){if(_0x294a95){return _0x294a95?{'count':_0x226e5c,'rows':_0x294a95}:null;}})['then'](respondWithResult(_0x46c120,null))[_0xa2aa('0x4a')](handleError(_0x46c120,null));};exports[_0xa2aa('0x67')]=function(_0xd4edb1,_0xf1353b,_0x2f1c81){var _0x13b3df=_0xd4edb1[_0xa2aa('0x4f')][_0xa2aa('0x68')];return db['Team']['findAll']({'where':{'id':_0x13b3df},'attributes':['id'],'include':[{'model':db[_0xa2aa('0x69')],'as':_0xa2aa('0x6a'),'attributes':['id','name',_0xa2aa('0x6b'),'voicePause','interface'],'raw':!![]}]})[_0xa2aa('0x29')](function(_0x5a2f73){if(_0x5a2f73){var _0x4274ec=_['flatMap'](_0x5a2f73,function(_0x4f4810){var _0x5e7cf6=_0x4f4810['get']({'plain':!![]});return _0x5e7cf6['Agents'];});return db['MailQueue']['find']({'where':{'id':_0xd4edb1['params']['id']}})[_0xa2aa('0x29')](function(_0x4ba030){return db['sequelize'][_0xa2aa('0x6c')](function(_0x112023){return _0x4ba030[_0xa2aa('0x67')](_0x13b3df,{'transaction':_0x112023})[_0xa2aa('0x29')](function(){return BPromise[_0xa2aa('0x6d')](_0x4274ec,function(_0x4cc150){return db[_0xa2aa('0x59')]['findOrCreate']({'where':{'UserId':_0x4cc150['id'],'MailQueueId':_0xd4edb1[_0xa2aa('0x4c')]['id']},'transaction':_0x112023});});})[_0xa2aa('0x29')](function(){_0x4274ec['forEach'](function(_0x1c8fda){socket[_0xa2aa('0x6e')](_0xa2aa('0x6f'),{'UserId':_0x1c8fda['id'],'MailQueueId':_0x4ba030['id']});});});});});}})[_0xa2aa('0x29')](respondWithStatusCode(_0xf1353b,null))['catch'](handleError(_0xf1353b,null));};exports[_0xa2aa('0x70')]=function(_0x1d2f0d,_0x3fe5d8,_0xf85419){return db[_0xa2aa('0x65')][_0xa2aa('0x5c')]({'where':{'id':_0x1d2f0d[_0xa2aa('0x37')][_0xa2aa('0x68')]},'attributes':['id'],'include':[{'model':db[_0xa2aa('0x69')],'as':_0xa2aa('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xa2aa('0x29')](handleEntityNotFound(_0x3fe5d8,null))['then'](function(_0x3b820c){var _0x6f708b=_[_0xa2aa('0x31')](_0x3b820c,'id');var _0x561066=[];var _0x16160d=[];var _0x6568e7=squel[_0xa2aa('0x71')]();_0x6568e7[_0xa2aa('0x72')](_0xa2aa('0x73'))[_0xa2aa('0x74')](_0xa2aa('0x75'),'tq')['join'](_0xa2aa('0x76'),'ut',_0xa2aa('0x77'))['where'](_0xa2aa('0x78'),_0x1d2f0d[_0xa2aa('0x4c')]['id']);for(var _0x2d2bd4=0x0;_0x2d2bd4<_0x3b820c[_0xa2aa('0x3e')];_0x2d2bd4+=0x1){let _0x3c3747=_0x3b820c[_0x2d2bd4];for(var _0x2484a8=0x0;_0x2484a8<_0x3c3747[_0xa2aa('0x6a')]['length'];_0x2484a8+=0x1){let _0x102dae=_0x3c3747[_0xa2aa('0x6a')][_0x2484a8];var _0x43b5af=_0x6568e7['clone']();_0x43b5af[_0xa2aa('0x42')]('ut.UserId\x20=\x20?',_0x102dae['id']);_0x16160d[_0xa2aa('0x79')](db[_0xa2aa('0x7a')][_0xa2aa('0x37')](_0x43b5af[_0xa2aa('0x7b')](),{'type':db[_0xa2aa('0x7a')][_0xa2aa('0x7c')][_0xa2aa('0x7d')]})[_0xa2aa('0x29')](function(_0x599039){if(_0x599039[_0xa2aa('0x3e')]===0x1){return _0x102dae['id'];}else{var _0x5449a2=_[_0xa2aa('0x7e')](_['map'](_0x599039,_0xa2aa('0x7f')),function(_0x2ac0e8){return _[_0xa2aa('0x80')](_0x6f708b,_0x2ac0e8);});if(_0x5449a2){return _0x102dae['id'];}}}));}}return BPromise['all'](_0x16160d)['then'](function(_0x419af5){_0x561066=_(_0x561066)[_0xa2aa('0x81')](_0x419af5)['compact']()[_0xa2aa('0x82')]();return db[_0xa2aa('0x32')][_0xa2aa('0x4d')]({'where':{'id':_0x1d2f0d[_0xa2aa('0x4c')]['id']}})[_0xa2aa('0x29')](function(_0x303dbe){return db[_0xa2aa('0x7a')]['transaction'](function(_0x141cc0){return _0x303dbe['removeTeams'](_0x1d2f0d[_0xa2aa('0x37')][_0xa2aa('0x68')],{'transaction':_0x141cc0})[_0xa2aa('0x29')](function(){if(!_[_0xa2aa('0x83')](_0x561066)){return _0x303dbe['removeAgents'](_0x561066,{'transaction':_0x141cc0});}})['then'](function(){_0x561066[_0xa2aa('0x84')](function(_0x50457d){socket[_0xa2aa('0x6e')](_0xa2aa('0x85'),{'UserId':_0x50457d,'MailQueueId':_0x303dbe['id']});});});});});});})[_0xa2aa('0x29')](respondWithStatusCode(_0x3fe5d8,null))[_0xa2aa('0x4a')](handleError(_0x3fe5d8,null));};exports['addAgents']=function(_0x1e9683,_0x3c8317,_0xceca9d){return db[_0xa2aa('0x32')][_0xa2aa('0x4d')]({'where':{'id':_0x1e9683['params']['id']}})['then'](handleEntityNotFound(_0x3c8317,null))[_0xa2aa('0x29')](function(_0x137415){if(_0x137415){return _0x137415[_0xa2aa('0x86')](_0x1e9683['body'][_0xa2aa('0x68')],_['omit'](_0x1e9683['body'],['ids','id'])||{})[_0xa2aa('0x87')](function(_0x14f901){for(var _0x1d4f9a=0x0;_0x1d4f9a<_0x1e9683[_0xa2aa('0x4f')]['ids'][_0xa2aa('0x3e')];_0x1d4f9a+=0x1){socket[_0xa2aa('0x6e')](_0xa2aa('0x6f'),{'UserId':Number(_0x1e9683[_0xa2aa('0x4f')][_0xa2aa('0x68')][_0x1d4f9a]),'MailQueueId':Number(_0x1e9683['params']['id'])});}return _0x14f901;});}})[_0xa2aa('0x29')](respondWithResult(_0x3c8317,null))[_0xa2aa('0x4a')](handleError(_0x3c8317,null));};exports[_0xa2aa('0x88')]=function(_0x3ce465,_0xf2bb14,_0x381bb7){return db['MailQueue']['find']({'where':{'id':_0x3ce465['params']['id']}})[_0xa2aa('0x29')](handleEntityNotFound(_0xf2bb14,null))['then'](function(_0x48e9e){if(_0x48e9e){return _0x48e9e[_0xa2aa('0x88')](_0x3ce465[_0xa2aa('0x37')][_0xa2aa('0x68')])['then'](function(){if(_[_0xa2aa('0x89')](_0x3ce465[_0xa2aa('0x37')][_0xa2aa('0x68')])){for(var _0x1c9767=0x0;_0x1c9767<_0x3ce465['query']['ids'][_0xa2aa('0x3e')];_0x1c9767+=0x1){socket[_0xa2aa('0x6e')](_0xa2aa('0x85'),{'UserId':Number(_0x3ce465[_0xa2aa('0x37')]['ids'][_0x1c9767]),'MailQueueId':Number(_0x3ce465[_0xa2aa('0x4c')]['id'])});}}else{socket[_0xa2aa('0x6e')](_0xa2aa('0x85'),{'UserId':Number(_0x3ce465[_0xa2aa('0x37')][_0xa2aa('0x68')]),'MailQueueId':Number(_0x3ce465[_0xa2aa('0x4c')]['id'])});}});}})[_0xa2aa('0x29')](respondWithStatusCode(_0xf2bb14,null))['catch'](handleError(_0xf2bb14,null));};exports[_0xa2aa('0x8a')]=function(_0x18999f,_0x26e6e8,_0x450a28){var _0x14d304={};var _0x19edd8={};var _0x52e58c;var _0x4193ca;return db[_0xa2aa('0x32')][_0xa2aa('0x58')]({'where':{'id':_0x18999f['params']['id']}})[_0xa2aa('0x29')](handleEntityNotFound(_0x26e6e8,null))['then'](function(_0x153019){if(_0x153019){_0x52e58c=_0x153019;_0x19edd8[_0xa2aa('0x3a')]=_[_0xa2aa('0x38')](db['User'][_0xa2aa('0x33')]);_0x19edd8[_0xa2aa('0x37')]=_[_0xa2aa('0x38')](_0x18999f[_0xa2aa('0x37')]);_0x19edd8[_0xa2aa('0x39')]=_['intersection'](_0x19edd8[_0xa2aa('0x3a')],_0x19edd8[_0xa2aa('0x37')]);_0x14d304[_0xa2aa('0x3b')]=_[_0xa2aa('0x3c')](_0x19edd8[_0xa2aa('0x3a')],qs[_0xa2aa('0x3d')](_0x18999f[_0xa2aa('0x37')][_0xa2aa('0x3d')]));_0x14d304['attributes']=_0x14d304[_0xa2aa('0x3b')][_0xa2aa('0x3e')]?_0x14d304[_0xa2aa('0x3b')]:_0x19edd8[_0xa2aa('0x3a')];_0x14d304[_0xa2aa('0x40')]=qs[_0xa2aa('0x41')](_0x18999f[_0xa2aa('0x37')][_0xa2aa('0x41')]);_0x14d304['where']=qs[_0xa2aa('0x39')](_['pick'](_0x18999f[_0xa2aa('0x37')],_0x19edd8[_0xa2aa('0x39')]));if(_0x18999f[_0xa2aa('0x37')]['filter']){_0x14d304[_0xa2aa('0x42')]=_['merge'](_0x14d304[_0xa2aa('0x42')],{'$or':_[_0xa2aa('0x31')](_0x14d304[_0xa2aa('0x3b')],function(_0x416900){var _0x159501={};_0x159501[_0x416900]={'$like':'%'+_0x18999f[_0xa2aa('0x37')]['filter']+'%'};return _0x159501;})});}_0x14d304=_[_0xa2aa('0x45')]({},_0x14d304,_0x18999f[_0xa2aa('0x46')]);return _0x52e58c['getAgents'](_0x14d304);}})[_0xa2aa('0x29')](function(_0x503e38){if(_0x503e38){_0x4193ca=_0x503e38[_0xa2aa('0x3e')];if(!_0x18999f[_0xa2aa('0x37')][_0xa2aa('0x3f')](_0xa2aa('0x5a'))){_0x14d304[_0xa2aa('0x24')]=qs[_0xa2aa('0x24')](_0x18999f[_0xa2aa('0x37')][_0xa2aa('0x24')]);_0x14d304[_0xa2aa('0x21')]=qs['offset'](_0x18999f[_0xa2aa('0x37')][_0xa2aa('0x21')]);}return _0x52e58c[_0xa2aa('0x8a')](_0x14d304);}})[_0xa2aa('0x29')](function(_0x40c62a){if(_0x40c62a){return _0x40c62a?{'count':_0x4193ca,'rows':_0x40c62a}:null;}})['then'](respondWithResult(_0x26e6e8,null))['catch'](handleError(_0x26e6e8,null));}; \ No newline at end of file +var _0xdf71=['each','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','ids','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','MailQueues','UserProfileResource','stack','name','index','map','MailQueue','rawAttributes','fieldName','key','query','keys','model','attributes','hasOwnProperty','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','intersection','fields','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','get','UserMailQueue','order','MailQueueId','User','mailPause','createdAt','format','SIP','updatedAt','getTeams','Team','nolimit','addTeams','Agents','voicePause','flatMap','sequelize','transaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf71,0x1d2));var _0x1df7=function(_0x31edbe,_0x34d231){_0x31edbe=_0x31edbe-0x0;var _0x37fcee=_0xdf71[_0x31edbe];return _0x37fcee;};'use strict';var emlformat=require(_0x1df7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1df7('0x1'));var jsonpatch=require(_0x1df7('0x2'));var rp=require(_0x1df7('0x3'));var moment=require(_0x1df7('0x4'));var BPromise=require(_0x1df7('0x5'));var Mustache=require(_0x1df7('0x6'));var util=require(_0x1df7('0x7'));var path=require('path');var sox=require(_0x1df7('0x8'));var csv=require(_0x1df7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1df7('0xa'));var squel=require(_0x1df7('0xb'));var crypto=require('crypto');var jsforce=require(_0x1df7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1df7('0x9'));var querystring=require(_0x1df7('0xd'));var Papa=require(_0x1df7('0xe'));var Redis=require(_0x1df7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1df7('0x10'));var as=require(_0x1df7('0x11'));var hardwareService=require(_0x1df7('0x12'));var logger=require(_0x1df7('0x13'))(_0x1df7('0x14'));var utils=require(_0x1df7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1df7('0x16'));var db=require('../../mysqldb')['db'];config[_0x1df7('0x17')]=_[_0x1df7('0x18')](config[_0x1df7('0x17')],{'host':_0x1df7('0x19'),'port':0x18eb});var socket=require(_0x1df7('0x1a'))(new Redis(config['redis']));require(_0x1df7('0x1b'))[_0x1df7('0x1c')](socket);function respondWithStatusCode(_0xff1e2d,_0x57f931){_0x57f931=_0x57f931||0xcc;return function(_0x5b21f5){if(_0x5b21f5){return _0xff1e2d[_0x1df7('0x1d')](_0x57f931);}return _0xff1e2d['status'](_0x57f931)[_0x1df7('0x1e')]();};}function respondWithResult(_0x543af6,_0x191046){_0x191046=_0x191046||0xc8;return function(_0x3ef3b5){if(_0x3ef3b5){return _0x543af6[_0x1df7('0x1f')](_0x191046)[_0x1df7('0x20')](_0x3ef3b5);}};}function respondWithFilteredResult(_0x308522,_0x4ed830){return function(_0x3a3428){if(_0x3a3428){var _0x3535d6=typeof _0x4ed830[_0x1df7('0x21')]===_0x1df7('0x22')&&typeof _0x4ed830[_0x1df7('0x23')]===_0x1df7('0x22');var _0x5cc02f=_0x3a3428['count'];var _0x290abe=_0x3535d6?0x0:_0x4ed830[_0x1df7('0x21')];var _0x195ec2=_0x3535d6?_0x3a3428[_0x1df7('0x24')]:_0x4ed830[_0x1df7('0x21')]+_0x4ed830[_0x1df7('0x23')];var _0x56c6ce;if(_0x195ec2>=_0x5cc02f){_0x195ec2=_0x5cc02f;_0x56c6ce=0xc8;}else{_0x56c6ce=0xce;}_0x308522[_0x1df7('0x1f')](_0x56c6ce);return _0x308522[_0x1df7('0x25')](_0x1df7('0x26'),_0x290abe+'-'+_0x195ec2+'/'+_0x5cc02f)[_0x1df7('0x20')](_0x3a3428);}return null;};}function patchUpdates(_0x3b4fc2){return function(_0x2d06f4){try{jsonpatch['apply'](_0x2d06f4,_0x3b4fc2,!![]);}catch(_0x5c48ae){return BPromise[_0x1df7('0x27')](_0x5c48ae);}return _0x2d06f4[_0x1df7('0x28')]();};}function saveUpdates(_0x46b80e,_0x104952){return function(_0x1d3618){if(_0x1d3618){return _0x1d3618[_0x1df7('0x29')](_0x46b80e)['then'](function(_0x63cbb8){return _0x63cbb8;});}return null;};}function removeEntity(_0x254901,_0x15874f){return function(_0x25b739){if(_0x25b739){return _0x25b739[_0x1df7('0x2a')]()[_0x1df7('0x2b')](function(){var _0xce818f=_0x25b739['get']({'plain':!![]});var _0x3fda08=_0x1df7('0x2c');return db[_0x1df7('0x2d')][_0x1df7('0x2a')]({'where':{'type':_0x3fda08,'resourceId':_0xce818f['id']}})[_0x1df7('0x2b')](function(){return _0x25b739;});})[_0x1df7('0x2b')](function(){_0x254901['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3130cf,_0x595cbb){return function(_0x343452){if(!_0x343452){_0x3130cf[_0x1df7('0x1d')](0x194);}return _0x343452;};}function handleError(_0x22d567,_0x4ba0da){_0x4ba0da=_0x4ba0da||0x1f4;return function(_0x14009a){logger['error'](_0x14009a[_0x1df7('0x2e')]);if(_0x14009a[_0x1df7('0x2f')]){delete _0x14009a['name'];}_0x22d567[_0x1df7('0x1f')](_0x4ba0da)['send'](_0x14009a);};}exports[_0x1df7('0x30')]=function(_0x4965fa,_0x319304){var _0x665592={},_0x308873={},_0x1d1c19={'count':0x0,'rows':[]};var _0x53112d=_[_0x1df7('0x31')](db[_0x1df7('0x32')][_0x1df7('0x33')],function(_0x27c9f8){return{'name':_0x27c9f8[_0x1df7('0x34')],'type':_0x27c9f8['type'][_0x1df7('0x35')]};});_0x308873['model']=_['map'](_0x53112d,_0x1df7('0x2f'));_0x308873[_0x1df7('0x36')]=_[_0x1df7('0x37')](_0x4965fa[_0x1df7('0x36')]);_0x308873['filters']=_['intersection'](_0x308873[_0x1df7('0x38')],_0x308873[_0x1df7('0x36')]);_0x665592['attributes']=_['intersection'](_0x308873[_0x1df7('0x38')],qs['fields'](_0x4965fa[_0x1df7('0x36')]['fields']));_0x665592[_0x1df7('0x39')]=_0x665592[_0x1df7('0x39')]['length']?_0x665592[_0x1df7('0x39')]:_0x308873[_0x1df7('0x38')];if(!_0x4965fa[_0x1df7('0x36')][_0x1df7('0x3a')]('nolimit')){_0x665592[_0x1df7('0x23')]=qs['limit'](_0x4965fa['query']['limit']);_0x665592[_0x1df7('0x21')]=qs['offset'](_0x4965fa[_0x1df7('0x36')][_0x1df7('0x21')]);}_0x665592['order']=qs[_0x1df7('0x3b')](_0x4965fa['query'][_0x1df7('0x3b')]);_0x665592[_0x1df7('0x3c')]=qs[_0x1df7('0x3d')](_[_0x1df7('0x3e')](_0x4965fa[_0x1df7('0x36')],_0x308873['filters']),_0x53112d);if(_0x4965fa['query'][_0x1df7('0x3f')]){_0x665592[_0x1df7('0x3c')]=_['merge'](_0x665592[_0x1df7('0x3c')],{'$or':_[_0x1df7('0x31')](_0x53112d,function(_0x124c7a){if(_0x124c7a[_0x1df7('0x40')]!==_0x1df7('0x41')){var _0x434d6e={};_0x434d6e[_0x124c7a[_0x1df7('0x2f')]]={'$like':'%'+_0x4965fa[_0x1df7('0x36')][_0x1df7('0x3f')]+'%'};return _0x434d6e;}})});}_0x665592=_[_0x1df7('0x42')]({},_0x665592,_0x4965fa[_0x1df7('0x43')]);var _0x1f3c25={'where':_0x665592['where']};return db['MailQueue']['count'](_0x1f3c25)[_0x1df7('0x2b')](function(_0xf5b398){_0x1d1c19[_0x1df7('0x24')]=_0xf5b398;if(_0x4965fa[_0x1df7('0x36')][_0x1df7('0x44')]){_0x665592['include']=[{'all':!![]}];}return db['MailQueue'][_0x1df7('0x45')](_0x665592);})[_0x1df7('0x2b')](function(_0x3b8eae){_0x1d1c19[_0x1df7('0x46')]=_0x3b8eae;return _0x1d1c19;})['then'](respondWithFilteredResult(_0x319304,_0x665592))[_0x1df7('0x47')](handleError(_0x319304,null));};exports[_0x1df7('0x48')]=function(_0x18ae0e,_0x5403bb){var _0x108eae={'raw':!![],'where':{'id':_0x18ae0e['params']['id']}},_0x3a4bfc={};_0x3a4bfc['model']=_[_0x1df7('0x37')](db['MailQueue'][_0x1df7('0x33')]);_0x3a4bfc[_0x1df7('0x36')]=_['keys'](_0x18ae0e[_0x1df7('0x36')]);_0x3a4bfc['filters']=_[_0x1df7('0x49')](_0x3a4bfc[_0x1df7('0x38')],_0x3a4bfc['query']);_0x108eae[_0x1df7('0x39')]=_[_0x1df7('0x49')](_0x3a4bfc[_0x1df7('0x38')],qs[_0x1df7('0x4a')](_0x18ae0e[_0x1df7('0x36')][_0x1df7('0x4a')]));_0x108eae[_0x1df7('0x39')]=_0x108eae[_0x1df7('0x39')][_0x1df7('0x4b')]?_0x108eae[_0x1df7('0x39')]:_0x3a4bfc[_0x1df7('0x38')];if(_0x18ae0e[_0x1df7('0x36')][_0x1df7('0x44')]){_0x108eae[_0x1df7('0x4c')]=[{'all':!![]}];}_0x108eae=_[_0x1df7('0x42')]({},_0x108eae,_0x18ae0e[_0x1df7('0x43')]);return db[_0x1df7('0x32')][_0x1df7('0x4d')](_0x108eae)[_0x1df7('0x2b')](handleEntityNotFound(_0x5403bb,null))['then'](respondWithResult(_0x5403bb,null))['catch'](handleError(_0x5403bb,null));};exports[_0x1df7('0x4e')]=function(_0x133099,_0x1be253){return db[_0x1df7('0x32')][_0x1df7('0x4e')](_0x133099[_0x1df7('0x4f')],{})[_0x1df7('0x2b')](function(_0x10bf3d){var _0x4e4a6f=_0x133099[_0x1df7('0x50')]['get']({'plain':!![]});if(!_0x4e4a6f)throw new Error(_0x1df7('0x51'));if(_0x4e4a6f[_0x1df7('0x52')]===_0x1df7('0x50')){var _0x38b83c=_0x10bf3d['get']({'plain':!![]});var _0x527067=_0x1df7('0x2c');return db[_0x1df7('0x53')]['find']({'where':{'name':_0x527067,'userProfileId':_0x4e4a6f['userProfileId']},'raw':!![]})['then'](function(_0x1079b8){if(_0x1079b8&&_0x1079b8[_0x1df7('0x54')]===0x0){return db['UserProfileResource'][_0x1df7('0x4e')]({'name':_0x38b83c[_0x1df7('0x2f')],'resourceId':_0x38b83c['id'],'type':_0x1079b8[_0x1df7('0x2f')],'sectionId':_0x1079b8['id']},{})['then'](function(){return _0x10bf3d;});}else{return _0x10bf3d;}})[_0x1df7('0x47')](function(_0x1938ee){logger[_0x1df7('0x55')](_0x1df7('0x56'),_0x1938ee);throw _0x1938ee;});}return _0x10bf3d;})[_0x1df7('0x2b')](respondWithResult(_0x1be253,0xc9))[_0x1df7('0x47')](handleError(_0x1be253,null));};exports['update']=function(_0x393441,_0x4ad91b){if(_0x393441[_0x1df7('0x4f')]['id']){delete _0x393441[_0x1df7('0x4f')]['id'];}return db[_0x1df7('0x32')][_0x1df7('0x4d')]({'where':{'id':_0x393441[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x4ad91b,null))[_0x1df7('0x2b')](saveUpdates(_0x393441[_0x1df7('0x4f')],null))['then'](respondWithResult(_0x4ad91b,null))[_0x1df7('0x47')](handleError(_0x4ad91b,null));};exports[_0x1df7('0x2a')]=function(_0x84ebe,_0x4fa712){return db[_0x1df7('0x32')][_0x1df7('0x4d')]({'where':{'id':_0x84ebe[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x4fa712,null))['then'](removeEntity(_0x4fa712,null))['catch'](handleError(_0x4fa712,null));};exports[_0x1df7('0x58')]=function(_0x2921ed,_0x1726e0){return db[_0x1df7('0x32')][_0x1df7('0x58')]()[_0x1df7('0x2b')](respondWithResult(_0x1726e0,null))[_0x1df7('0x47')](handleError(_0x1726e0,null));};exports[_0x1df7('0x59')]=function(_0x119a7f,_0x483704,_0x3a7ec5){var _0xb13d10={'raw':!![],'where':{}},_0x1a9a10={},_0x4189c8;return db[_0x1df7('0x32')][_0x1df7('0x5a')]({'where':{'id':_0x119a7f[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x483704,null))[_0x1df7('0x2b')](function(_0x2c7ccf){if(_0x2c7ccf){_0x4189c8=_0x2c7ccf[_0x1df7('0x5b')]({'plain':!![]});_0x1a9a10[_0x1df7('0x38')]=_[_0x1df7('0x37')](db[_0x1df7('0x5c')][_0x1df7('0x33')]);_0x1a9a10[_0x1df7('0x36')]=_[_0x1df7('0x37')](_0x119a7f[_0x1df7('0x36')]);_0x1a9a10[_0x1df7('0x3d')]=_['intersection'](_0x1a9a10['model'],_0x1a9a10[_0x1df7('0x36')]);_0xb13d10[_0x1df7('0x39')]=_['intersection'](_0x1a9a10[_0x1df7('0x38')],qs[_0x1df7('0x4a')](_0x119a7f[_0x1df7('0x36')][_0x1df7('0x4a')]));_0xb13d10[_0x1df7('0x39')]=_0xb13d10[_0x1df7('0x39')][_0x1df7('0x4b')]?_0xb13d10[_0x1df7('0x39')]:_0x1a9a10[_0x1df7('0x38')];if(!_0x119a7f[_0x1df7('0x36')][_0x1df7('0x3a')]('nolimit')){_0xb13d10[_0x1df7('0x23')]=qs[_0x1df7('0x23')](_0x119a7f[_0x1df7('0x36')][_0x1df7('0x23')]);_0xb13d10['offset']=qs[_0x1df7('0x21')](_0x119a7f[_0x1df7('0x36')][_0x1df7('0x21')]);}_0xb13d10[_0x1df7('0x5d')]=qs['sort'](_0x119a7f[_0x1df7('0x36')][_0x1df7('0x3b')]);_0xb13d10[_0x1df7('0x3c')]=qs[_0x1df7('0x3d')](_[_0x1df7('0x3e')](_0x119a7f['query'],_0x1a9a10[_0x1df7('0x3d')]));_0xb13d10[_0x1df7('0x3c')][_0x1df7('0x5e')]=_0x2c7ccf['id'];if(_0x119a7f[_0x1df7('0x36')][_0x1df7('0x3f')]){_0xb13d10[_0x1df7('0x3c')]=_[_0x1df7('0x42')](_0xb13d10[_0x1df7('0x3c')],{'$or':_['map'](_0xb13d10[_0x1df7('0x39')],function(_0x435b4e){var _0x27ce5b={};_0x27ce5b[_0x435b4e]={'$like':'%'+_0x119a7f[_0x1df7('0x36')][_0x1df7('0x3f')]+'%'};return _0x27ce5b;})});}_0xb13d10=_[_0x1df7('0x42')]({},_0xb13d10,_0x119a7f[_0x1df7('0x43')]);return db[_0x1df7('0x5c')]['findAll'](_0xb13d10);}})['then'](function(_0x389243){if(_0x389243){return db[_0x1df7('0x5f')]['findAndCountAll']({'where':{'id':_[_0x1df7('0x31')](_0x389243,'UserId'),'role':'agent'},'attributes':['id',_0x1df7('0x2f'),_0x1df7('0x60'),'updatedAt',_0x1df7('0x61')]});}})[_0x1df7('0x2b')](function(_0x531fba){if(_0x531fba){return{'count':_0x531fba[_0x1df7('0x24')],'rows':_['map'](_0x531fba[_0x1df7('0x46')],function(_0x24024f){return{'membername':_0x24024f[_0x1df7('0x2f')],'UserId':_0x24024f['id'],'queue_name':_0x4189c8[_0x1df7('0x2f')],'MailQueueId':_0x4189c8['id'],'interface':util[_0x1df7('0x62')]('%s/%s',_0x1df7('0x63'),_0x24024f[_0x1df7('0x2f')]),'penalty':0x0,'paused':_0x24024f[_0x1df7('0x60')],'createdAt':_0x24024f['createdAt'],'updatedAt':_0x24024f[_0x1df7('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x483704,_0xb13d10))['catch'](handleError(_0x483704,null));};exports[_0x1df7('0x65')]=function(_0x5b8cbe,_0x3b4b9b,_0x49c722){var _0x22b3f1={};var _0x5d8291={};var _0x256bde;var _0x58d74e;return db[_0x1df7('0x32')][_0x1df7('0x5a')]({'where':{'id':_0x5b8cbe[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x3b4b9b,null))[_0x1df7('0x2b')](function(_0x29393b){if(_0x29393b){_0x256bde=_0x29393b;_0x5d8291[_0x1df7('0x38')]=_[_0x1df7('0x37')](db[_0x1df7('0x66')][_0x1df7('0x33')]);_0x5d8291[_0x1df7('0x36')]=_['keys'](_0x5b8cbe[_0x1df7('0x36')]);_0x5d8291['filters']=_[_0x1df7('0x49')](_0x5d8291['model'],_0x5d8291['query']);_0x22b3f1[_0x1df7('0x39')]=_[_0x1df7('0x49')](_0x5d8291[_0x1df7('0x38')],qs[_0x1df7('0x4a')](_0x5b8cbe['query'][_0x1df7('0x4a')]));_0x22b3f1[_0x1df7('0x39')]=_0x22b3f1['attributes'][_0x1df7('0x4b')]?_0x22b3f1[_0x1df7('0x39')]:_0x5d8291['model'];_0x22b3f1['order']=qs[_0x1df7('0x3b')](_0x5b8cbe[_0x1df7('0x36')][_0x1df7('0x3b')]);_0x22b3f1[_0x1df7('0x3c')]=qs[_0x1df7('0x3d')](_[_0x1df7('0x3e')](_0x5b8cbe['query'],_0x5d8291[_0x1df7('0x3d')]));if(_0x5b8cbe[_0x1df7('0x36')][_0x1df7('0x3f')]){_0x22b3f1['where']=_[_0x1df7('0x42')](_0x22b3f1[_0x1df7('0x3c')],{'$or':_[_0x1df7('0x31')](_0x22b3f1[_0x1df7('0x39')],function(_0x10b30f){var _0x2f1f02={};_0x2f1f02[_0x10b30f]={'$like':'%'+_0x5b8cbe['query'][_0x1df7('0x3f')]+'%'};return _0x2f1f02;})});}_0x22b3f1=_['merge']({},_0x22b3f1,_0x5b8cbe[_0x1df7('0x43')]);return _0x256bde[_0x1df7('0x65')](_0x22b3f1);}})[_0x1df7('0x2b')](function(_0x13878){if(_0x13878){_0x58d74e=_0x13878[_0x1df7('0x4b')];if(!_0x5b8cbe[_0x1df7('0x36')][_0x1df7('0x3a')](_0x1df7('0x67'))){_0x22b3f1[_0x1df7('0x23')]=qs[_0x1df7('0x23')](_0x5b8cbe[_0x1df7('0x36')]['limit']);_0x22b3f1[_0x1df7('0x21')]=qs[_0x1df7('0x21')](_0x5b8cbe[_0x1df7('0x36')]['offset']);}return _0x256bde[_0x1df7('0x65')](_0x22b3f1);}})[_0x1df7('0x2b')](function(_0x1bfb93){if(_0x1bfb93){return _0x1bfb93?{'count':_0x58d74e,'rows':_0x1bfb93}:null;}})['then'](respondWithResult(_0x3b4b9b,null))[_0x1df7('0x47')](handleError(_0x3b4b9b,null));};exports[_0x1df7('0x68')]=function(_0x23ce52,_0x1a496a,_0x3da51b){var _0x32f5bc=_0x23ce52[_0x1df7('0x4f')]['ids'];return db[_0x1df7('0x66')][_0x1df7('0x45')]({'where':{'id':_0x32f5bc},'attributes':['id'],'include':[{'model':db[_0x1df7('0x5f')],'as':_0x1df7('0x69'),'attributes':['id',_0x1df7('0x2f'),'online',_0x1df7('0x6a'),'interface'],'raw':!![]}]})[_0x1df7('0x2b')](function(_0x396980){if(_0x396980){var _0x4aa9f0=_[_0x1df7('0x6b')](_0x396980,function(_0x26a02c){var _0x46d7d5=_0x26a02c['get']({'plain':!![]});return _0x46d7d5[_0x1df7('0x69')];});return db[_0x1df7('0x32')][_0x1df7('0x4d')]({'where':{'id':_0x23ce52['params']['id']}})['then'](function(_0x4d116b){return db[_0x1df7('0x6c')][_0x1df7('0x6d')](function(_0xb8176){return _0x4d116b[_0x1df7('0x68')](_0x32f5bc,{'transaction':_0xb8176})[_0x1df7('0x2b')](function(){return BPromise[_0x1df7('0x6e')](_0x4aa9f0,function(_0x59bbf7){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x59bbf7['id'],'MailQueueId':_0x23ce52['params']['id']},'transaction':_0xb8176});});})[_0x1df7('0x2b')](function(){_0x4aa9f0[_0x1df7('0x6f')](function(_0x26b80d){socket['emit'](_0x1df7('0x70'),{'UserId':_0x26b80d['id'],'MailQueueId':_0x4d116b['id']});});});});});}})['then'](respondWithStatusCode(_0x1a496a,null))[_0x1df7('0x47')](handleError(_0x1a496a,null));};exports[_0x1df7('0x71')]=function(_0x3be875,_0x1cfd22,_0x28c87e){return db[_0x1df7('0x66')][_0x1df7('0x45')]({'where':{'id':_0x3be875[_0x1df7('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1df7('0x5f')],'as':_0x1df7('0x69'),'attributes':['id'],'raw':!![]}]})[_0x1df7('0x2b')](handleEntityNotFound(_0x1cfd22,null))[_0x1df7('0x2b')](function(_0x9b9234){var _0xcdd54a=_['map'](_0x9b9234,'id');var _0xa7ef57=[];var _0x2eaaa2=[];var _0x5e45b9=squel[_0x1df7('0x72')]();_0x5e45b9[_0x1df7('0x73')](_0x1df7('0x74'))[_0x1df7('0x75')]('team_has_mail_queues','tq')[_0x1df7('0x76')](_0x1df7('0x77'),'ut',_0x1df7('0x78'))[_0x1df7('0x3c')](_0x1df7('0x79'),_0x3be875[_0x1df7('0x57')]['id']);for(var _0x150d0d=0x0;_0x150d0d<_0x9b9234[_0x1df7('0x4b')];_0x150d0d+=0x1){let _0x441bc4=_0x9b9234[_0x150d0d];for(var _0x23ac30=0x0;_0x23ac30<_0x441bc4[_0x1df7('0x69')][_0x1df7('0x4b')];_0x23ac30+=0x1){let _0x4c6e69=_0x441bc4[_0x1df7('0x69')][_0x23ac30];var _0x5634eb=_0x5e45b9[_0x1df7('0x7a')]();_0x5634eb['where'](_0x1df7('0x7b'),_0x4c6e69['id']);_0x2eaaa2[_0x1df7('0x7c')](db['sequelize'][_0x1df7('0x36')](_0x5634eb[_0x1df7('0x7d')](),{'type':db['sequelize'][_0x1df7('0x7e')][_0x1df7('0x7f')]})['then'](function(_0x2dc803){if(_0x2dc803[_0x1df7('0x4b')]===0x1){return _0x4c6e69['id'];}else{var _0x5ab875=_[_0x1df7('0x80')](_[_0x1df7('0x31')](_0x2dc803,_0x1df7('0x81')),function(_0x3bacf6){return _[_0x1df7('0x82')](_0xcdd54a,_0x3bacf6);});if(_0x5ab875){return _0x4c6e69['id'];}}}));}}return BPromise[_0x1df7('0x83')](_0x2eaaa2)[_0x1df7('0x2b')](function(_0x5ee7cb){_0xa7ef57=_(_0xa7ef57)[_0x1df7('0x84')](_0x5ee7cb)['compact']()[_0x1df7('0x85')]();return db[_0x1df7('0x32')][_0x1df7('0x4d')]({'where':{'id':_0x3be875[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](function(_0x4b316c){return db[_0x1df7('0x6c')][_0x1df7('0x6d')](function(_0xffc3a8){return _0x4b316c[_0x1df7('0x71')](_0x3be875['query']['ids'],{'transaction':_0xffc3a8})['then'](function(){if(!_[_0x1df7('0x86')](_0xa7ef57)){return _0x4b316c[_0x1df7('0x87')](_0xa7ef57,{'transaction':_0xffc3a8});}})[_0x1df7('0x2b')](function(){_0xa7ef57[_0x1df7('0x6f')](function(_0x584798){socket[_0x1df7('0x88')](_0x1df7('0x89'),{'UserId':_0x584798,'MailQueueId':_0x4b316c['id']});});});});});});})[_0x1df7('0x2b')](respondWithStatusCode(_0x1cfd22,null))[_0x1df7('0x47')](handleError(_0x1cfd22,null));};exports[_0x1df7('0x8a')]=function(_0x4134ac,_0x56c5f8,_0x3fd9c6){return db[_0x1df7('0x32')]['find']({'where':{'id':_0x4134ac[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x56c5f8,null))['then'](function(_0x496055){if(_0x496055){return _0x496055[_0x1df7('0x8a')](_0x4134ac[_0x1df7('0x4f')][_0x1df7('0x8b')],_[_0x1df7('0x8c')](_0x4134ac[_0x1df7('0x4f')],[_0x1df7('0x8b'),'id'])||{})[_0x1df7('0x8d')](function(_0x1bdd8e){for(var _0x4880de=0x0;_0x4880de<_0x4134ac[_0x1df7('0x4f')][_0x1df7('0x8b')][_0x1df7('0x4b')];_0x4880de+=0x1){socket[_0x1df7('0x88')]('userMailQueue:save',{'UserId':Number(_0x4134ac[_0x1df7('0x4f')]['ids'][_0x4880de]),'MailQueueId':Number(_0x4134ac[_0x1df7('0x57')]['id'])});}return _0x1bdd8e;});}})[_0x1df7('0x2b')](respondWithResult(_0x56c5f8,null))['catch'](handleError(_0x56c5f8,null));};exports['removeAgents']=function(_0x3ff897,_0x23a57d,_0x2c0647){return db[_0x1df7('0x32')][_0x1df7('0x4d')]({'where':{'id':_0x3ff897[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x23a57d,null))[_0x1df7('0x2b')](function(_0x16d19a){if(_0x16d19a){return _0x16d19a[_0x1df7('0x87')](_0x3ff897['query'][_0x1df7('0x8b')])[_0x1df7('0x2b')](function(){if(_[_0x1df7('0x8e')](_0x3ff897['query']['ids'])){for(var _0x5ad330=0x0;_0x5ad330<_0x3ff897[_0x1df7('0x36')]['ids']['length'];_0x5ad330+=0x1){socket[_0x1df7('0x88')](_0x1df7('0x89'),{'UserId':Number(_0x3ff897[_0x1df7('0x36')][_0x1df7('0x8b')][_0x5ad330]),'MailQueueId':Number(_0x3ff897[_0x1df7('0x57')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x3ff897['query']['ids']),'MailQueueId':Number(_0x3ff897[_0x1df7('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x23a57d,null))['catch'](handleError(_0x23a57d,null));};exports[_0x1df7('0x8f')]=function(_0x328ceb,_0x50c74d,_0x2adf51){var _0xe25a34={};var _0x1fe304={};var _0x5ddea1;var _0x14a336;return db[_0x1df7('0x32')]['findOne']({'where':{'id':_0x328ceb[_0x1df7('0x57')]['id']}})['then'](handleEntityNotFound(_0x50c74d,null))['then'](function(_0x4a7d30){if(_0x4a7d30){_0x5ddea1=_0x4a7d30;_0x1fe304['model']=_[_0x1df7('0x37')](db[_0x1df7('0x5f')]['rawAttributes']);_0x1fe304[_0x1df7('0x36')]=_[_0x1df7('0x37')](_0x328ceb[_0x1df7('0x36')]);_0x1fe304['filters']=_[_0x1df7('0x49')](_0x1fe304[_0x1df7('0x38')],_0x1fe304[_0x1df7('0x36')]);_0xe25a34[_0x1df7('0x39')]=_[_0x1df7('0x49')](_0x1fe304['model'],qs[_0x1df7('0x4a')](_0x328ceb[_0x1df7('0x36')][_0x1df7('0x4a')]));_0xe25a34[_0x1df7('0x39')]=_0xe25a34[_0x1df7('0x39')][_0x1df7('0x4b')]?_0xe25a34[_0x1df7('0x39')]:_0x1fe304[_0x1df7('0x38')];_0xe25a34[_0x1df7('0x5d')]=qs['sort'](_0x328ceb[_0x1df7('0x36')][_0x1df7('0x3b')]);_0xe25a34[_0x1df7('0x3c')]=qs[_0x1df7('0x3d')](_[_0x1df7('0x3e')](_0x328ceb['query'],_0x1fe304[_0x1df7('0x3d')]));if(_0x328ceb[_0x1df7('0x36')][_0x1df7('0x3f')]){_0xe25a34[_0x1df7('0x3c')]=_[_0x1df7('0x42')](_0xe25a34[_0x1df7('0x3c')],{'$or':_['map'](_0xe25a34[_0x1df7('0x39')],function(_0x573a14){var _0x5037d8={};_0x5037d8[_0x573a14]={'$like':'%'+_0x328ceb[_0x1df7('0x36')]['filter']+'%'};return _0x5037d8;})});}_0xe25a34=_[_0x1df7('0x42')]({},_0xe25a34,_0x328ceb[_0x1df7('0x43')]);return _0x5ddea1['getAgents'](_0xe25a34);}})[_0x1df7('0x2b')](function(_0x2f42eb){if(_0x2f42eb){_0x14a336=_0x2f42eb[_0x1df7('0x4b')];if(!_0x328ceb[_0x1df7('0x36')]['hasOwnProperty'](_0x1df7('0x67'))){_0xe25a34[_0x1df7('0x23')]=qs['limit'](_0x328ceb['query'][_0x1df7('0x23')]);_0xe25a34[_0x1df7('0x21')]=qs[_0x1df7('0x21')](_0x328ceb['query'][_0x1df7('0x21')]);}return _0x5ddea1[_0x1df7('0x8f')](_0xe25a34);}})[_0x1df7('0x2b')](function(_0x4a68d4){if(_0x4a68d4){return _0x4a68d4?{'count':_0x14a336,'rows':_0x4a68d4}:null;}})[_0x1df7('0x2b')](respondWithResult(_0x50c74d,null))[_0x1df7('0x47')](handleError(_0x50c74d,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 4db4545..98f45c8 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 _0xcfae=['hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x236c12,_0x38cfec){var _0x3bc65d=function(_0x4b4d04){while(--_0x4b4d04){_0x236c12['push'](_0x236c12['shift']());}};_0x3bc65d(++_0x38cfec);}(_0xcfae,0x1c4));var _0xecfa=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xcfae[_0xc6be3a];return _0x56a310;};'use strict';var EventEmitter=require(_0xecfa('0x0'));var MailQueue=require(_0xecfa('0x1'))['db'][_0xecfa('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xecfa('0x3')](0x0);var events={'afterCreate':_0xecfa('0x4'),'afterUpdate':_0xecfa('0x5'),'afterDestroy':_0xecfa('0x6')};function emitEvent(_0x57b823){return function(_0x401e83,_0x3c586a,_0xe58a0){MailQueueEvents[_0xecfa('0x7')](_0x57b823+':'+_0x401e83['id'],_0x401e83);MailQueueEvents[_0xecfa('0x7')](_0x57b823,_0x401e83);_0xe58a0(null);};}for(var e in events){if(events[_0xecfa('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xecfa('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x81d1=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x384a78,_0x5ba914){var _0xf4933b=function(_0x550e1c){while(--_0x550e1c){_0x384a78['push'](_0x384a78['shift']());}};_0xf4933b(++_0x5ba914);}(_0x81d1,0xee));var _0x181d=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x81d1[_0x11f5ff];return _0x46eefb;};'use strict';var EventEmitter=require(_0x181d('0x0'));var MailQueue=require(_0x181d('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x181d('0x2'),'afterUpdate':_0x181d('0x3'),'afterDestroy':_0x181d('0x4')};function emitEvent(_0x10add3){return function(_0x299acc,_0x514ba4,_0x28f11b){MailQueueEvents[_0x181d('0x5')](_0x10add3+':'+_0x299acc['id'],_0x299acc);MailQueueEvents[_0x181d('0x5')](_0x10add3,_0x299acc);_0x28f11b(null);};}for(var e in events){if(events[_0x181d('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x181d('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 5748876..d1fbf6e 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 _0xcc04=['MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./mailQueue.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc04,0xb6));var _0x4cc0=function(_0x13ec8f,_0x540a3f){_0x13ec8f=_0x13ec8f-0x0;var _0x3e6c13=_0xcc04[_0x13ec8f];return _0x3e6c13;};'use strict';var _=require(_0x4cc0('0x0'));var util=require(_0x4cc0('0x1'));var logger=require(_0x4cc0('0x2'))(_0x4cc0('0x3'));var moment=require(_0x4cc0('0x4'));var BPromise=require(_0x4cc0('0x5'));var rp=require(_0x4cc0('0x6'));var fs=require('fs');var path=require(_0x4cc0('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4cc0('0x8'));module[_0x4cc0('0x9')]=function(_0x387456,_0x16e5ee){return _0x387456['define'](_0x4cc0('0xa'),attributes,{'tableName':_0x4cc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf21e=['MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x23a82e,_0x2d8bb9){var _0x3e8d19=function(_0x177f73){while(--_0x177f73){_0x23a82e['push'](_0x23a82e['shift']());}};_0x3e8d19(++_0x2d8bb9);}(_0xf21e,0x116));var _0xef21=function(_0x54fba0,_0x35decc){_0x54fba0=_0x54fba0-0x0;var _0x527d11=_0xf21e[_0x54fba0];return _0x527d11;};'use strict';var _=require(_0xef21('0x0'));var util=require(_0xef21('0x1'));var logger=require(_0xef21('0x2'))(_0xef21('0x3'));var moment=require(_0xef21('0x4'));var BPromise=require(_0xef21('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef21('0x6'));var rimraf=require('rimraf');var config=require(_0xef21('0x7'));var attributes=require('./mailQueue.attributes');module[_0xef21('0x8')]=function(_0x2d670f,_0x4995e9){return _0x2d670f[_0xef21('0x9')](_0xef21('0xa'),attributes,{'tableName':_0xef21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index cdaca42..e1c9e1c 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 _0x67be=['ShowMailQueue','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','MailQueue','findAll','options','raw','limit','include','model','attributes','map','GetMailQueue'];(function(_0x435df9,_0x31ac27){var _0x4cc30b=function(_0x362503){while(--_0x362503){_0x435df9['push'](_0x435df9['shift']());}};_0x4cc30b(++_0x31ac27);}(_0x67be,0x105));var _0xe67b=function(_0x49d4dc,_0xcb20b2){_0x49d4dc=_0x49d4dc-0x0;var _0x9d6c26=_0x67be[_0x49d4dc];return _0x9d6c26;};'use strict';var _=require(_0xe67b('0x0'));var util=require(_0xe67b('0x1'));var moment=require(_0xe67b('0x2'));var BPromise=require(_0xe67b('0x3'));var rs=require(_0xe67b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe67b('0x5'))['db'];var utils=require(_0xe67b('0x6'));var logger=require(_0xe67b('0x7'))(_0xe67b('0x8'));var config=require('../../config/environment');var jayson=require(_0xe67b('0x9'));var client=jayson[_0xe67b('0xa')][_0xe67b('0xb')]({'port':0x232a});config['redis']=_[_0xe67b('0xc')](config['redis'],{'host':_0xe67b('0xd'),'port':0x18eb});var socket=require(_0xe67b('0xe'))(new Redis(config[_0xe67b('0xf')]));require(_0xe67b('0x10'))[_0xe67b('0x11')](socket);function respondWithRpcPromise(_0x338ecc,_0x2dfd8a,_0x5139cd){return new BPromise(function(_0x2ed69f,_0xf18ad0){return client[_0xe67b('0x12')](_0x338ecc,_0x5139cd)[_0xe67b('0x13')](function(_0x3d5903){logger[_0xe67b('0x14')]('MailQueue,\x20%s,\x20%s',_0x2dfd8a,'request\x20sent');logger[_0xe67b('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2dfd8a,_0xe67b('0x16'),JSON[_0xe67b('0x17')](_0x3d5903));if(_0x3d5903[_0xe67b('0x18')]){if(_0x3d5903[_0xe67b('0x18')][_0xe67b('0x19')]===0x1f4){logger[_0xe67b('0x18')](_0xe67b('0x1a'),_0x2dfd8a,_0x3d5903[_0xe67b('0x18')][_0xe67b('0x1b')]);return _0xf18ad0(_0x3d5903[_0xe67b('0x18')][_0xe67b('0x1b')]);}logger[_0xe67b('0x18')](_0xe67b('0x1a'),_0x2dfd8a,_0x3d5903['error']['message']);return _0x2ed69f(_0x3d5903['error'][_0xe67b('0x1b')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x2dfd8a,_0xe67b('0x16'));_0x2ed69f(_0x3d5903[_0xe67b('0x1c')]['message']);}})[_0xe67b('0x1d')](function(_0x284eb3){logger['error'](_0xe67b('0x1a'),_0x2dfd8a,_0x284eb3);_0xf18ad0(_0x284eb3);});});}exports['GetMailQueue']=function(_0x2e2c80){var _0x1898cf=this;return new Promise(function(_0x859836,_0x46b08b){return db[_0xe67b('0x1e')][_0xe67b('0x1f')]({'raw':_0x2e2c80[_0xe67b('0x20')]?_0x2e2c80[_0xe67b('0x20')][_0xe67b('0x21')]===undefined?!![]:![]:!![],'where':_0x2e2c80[_0xe67b('0x20')]?_0x2e2c80[_0xe67b('0x20')]['where']||null:null,'attributes':_0x2e2c80[_0xe67b('0x20')]?_0x2e2c80[_0xe67b('0x20')]['attributes']||null:null,'limit':_0x2e2c80[_0xe67b('0x20')]?_0x2e2c80[_0xe67b('0x20')][_0xe67b('0x22')]||null:null,'include':_0x2e2c80[_0xe67b('0x20')]?_0x2e2c80[_0xe67b('0x20')][_0xe67b('0x23')]?_['map'](_0x2e2c80[_0xe67b('0x20')][_0xe67b('0x23')],function(_0x2c907a){return{'model':db[_0x2c907a[_0xe67b('0x24')]],'as':_0x2c907a['as'],'attributes':_0x2c907a[_0xe67b('0x25')],'include':_0x2c907a[_0xe67b('0x23')]?_['map'](_0x2c907a[_0xe67b('0x23')],function(_0x176307){return{'model':db[_0x176307[_0xe67b('0x24')]],'as':_0x176307['as'],'attributes':_0x176307[_0xe67b('0x25')],'include':_0x176307[_0xe67b('0x23')]?_[_0xe67b('0x26')](_0x176307[_0xe67b('0x23')],function(_0x54f99e){return{'model':db[_0x54f99e[_0xe67b('0x24')]],'as':_0x54f99e['as'],'attributes':_0x54f99e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe67b('0x13')](function(_0x235627){logger[_0xe67b('0x14')](_0xe67b('0x27'),_0x2e2c80);logger[_0xe67b('0x15')](_0xe67b('0x27'),_0x2e2c80,JSON[_0xe67b('0x17')](_0x235627));_0x859836(_0x235627);})['catch'](function(_0x302b84){logger[_0xe67b('0x18')](_0xe67b('0x27'),_0x302b84['message'],_0x2e2c80);_0x46b08b(_0x1898cf[_0xe67b('0x18')](0x1f4,_0x302b84['message']));});});};exports[_0xe67b('0x28')]=function(_0x5bacc){var _0x331693=this;return new Promise(function(_0x80d907,_0x480dfe){return db[_0xe67b('0x1e')][_0xe67b('0x29')]({'raw':_0x5bacc['options']?_0x5bacc[_0xe67b('0x20')][_0xe67b('0x21')]===undefined?!![]:![]:!![],'where':_0x5bacc['options']?_0x5bacc['options'][_0xe67b('0x2a')]||null:null,'attributes':_0x5bacc['options']?_0x5bacc[_0xe67b('0x20')][_0xe67b('0x25')]||null:null,'include':_0x5bacc[_0xe67b('0x20')]?_0x5bacc['options'][_0xe67b('0x23')]?_['map'](_0x5bacc[_0xe67b('0x20')][_0xe67b('0x23')],function(_0x215847){return{'model':db[_0x215847[_0xe67b('0x24')]],'as':_0x215847['as'],'attributes':_0x215847['attributes'],'include':_0x215847[_0xe67b('0x23')]?_[_0xe67b('0x26')](_0x215847['include'],function(_0x2f5fd6){return{'model':db[_0x2f5fd6['model']],'as':_0x2f5fd6['as'],'attributes':_0x2f5fd6[_0xe67b('0x25')],'include':_0x2f5fd6[_0xe67b('0x23')]?_[_0xe67b('0x26')](_0x2f5fd6['include'],function(_0x4406b3){return{'model':db[_0x4406b3[_0xe67b('0x24')]],'as':_0x4406b3['as'],'attributes':_0x4406b3[_0xe67b('0x25')]};}):[]};}):[]};}):[]:[]})[_0xe67b('0x13')](function(_0x4459f6){logger[_0xe67b('0x14')](_0xe67b('0x28'),_0x5bacc);logger['debug'](_0xe67b('0x28'),_0x5bacc,JSON[_0xe67b('0x17')](_0x4459f6));_0x80d907(_0x4459f6);})['catch'](function(_0x1ac94d){logger[_0xe67b('0x18')]('ShowMailQueue',_0x1ac94d['message'],_0x5bacc);_0x480dfe(_0x331693['error'](0x1f4,_0x1ac94d[_0xe67b('0x1b')]));});});}; \ No newline at end of file +var _0xdcb9=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','MailQueue','findAll','options','raw','limit','map','include','model','attributes','GetMailQueue','ShowMailQueue','find','where','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','then','info'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xdcb9,0xa7));var _0x9dcb=function(_0x260c94,_0x173070){_0x260c94=_0x260c94-0x0;var _0x5b909a=_0xdcb9[_0x260c94];return _0x5b909a;};'use strict';var _=require(_0x9dcb('0x0'));var util=require('util');var moment=require(_0x9dcb('0x1'));var BPromise=require(_0x9dcb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dcb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9dcb('0x4'));var config=require(_0x9dcb('0x5'));var jayson=require(_0x9dcb('0x6'));var client=jayson[_0x9dcb('0x7')]['http']({'port':0x232a});config[_0x9dcb('0x8')]=_['defaults'](config[_0x9dcb('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9dcb('0x9'))(new Redis(config[_0x9dcb('0x8')]));require('./mailQueue.socket')[_0x9dcb('0xa')](socket);function respondWithRpcPromise(_0x53d700,_0x58b979,_0x130f04){return new BPromise(function(_0x46bd0a,_0x23773d){return client['request'](_0x53d700,_0x130f04)[_0x9dcb('0xb')](function(_0x4619c2){logger[_0x9dcb('0xc')]('MailQueue,\x20%s,\x20%s',_0x58b979,_0x9dcb('0xd'));logger[_0x9dcb('0xe')](_0x9dcb('0xf'),_0x58b979,_0x9dcb('0xd'),JSON[_0x9dcb('0x10')](_0x4619c2));if(_0x4619c2[_0x9dcb('0x11')]){if(_0x4619c2[_0x9dcb('0x11')][_0x9dcb('0x12')]===0x1f4){logger[_0x9dcb('0x11')]('MailQueue,\x20%s,\x20%s',_0x58b979,_0x4619c2[_0x9dcb('0x11')]['message']);return _0x23773d(_0x4619c2[_0x9dcb('0x11')]['message']);}logger[_0x9dcb('0x11')](_0x9dcb('0x13'),_0x58b979,_0x4619c2[_0x9dcb('0x11')][_0x9dcb('0x14')]);return _0x46bd0a(_0x4619c2[_0x9dcb('0x11')][_0x9dcb('0x14')]);}else{logger['info'](_0x9dcb('0x13'),_0x58b979,_0x9dcb('0xd'));_0x46bd0a(_0x4619c2[_0x9dcb('0x15')][_0x9dcb('0x14')]);}})[_0x9dcb('0x16')](function(_0x2559c4){logger[_0x9dcb('0x11')](_0x9dcb('0x13'),_0x58b979,_0x2559c4);_0x23773d(_0x2559c4);});});}exports['GetMailQueue']=function(_0xf52196){var _0x32e5ba=this;return new Promise(function(_0x41b93c,_0x33d6a5){return db[_0x9dcb('0x17')][_0x9dcb('0x18')]({'raw':_0xf52196[_0x9dcb('0x19')]?_0xf52196[_0x9dcb('0x19')][_0x9dcb('0x1a')]===undefined?!![]:![]:!![],'where':_0xf52196[_0x9dcb('0x19')]?_0xf52196['options']['where']||null:null,'attributes':_0xf52196[_0x9dcb('0x19')]?_0xf52196[_0x9dcb('0x19')]['attributes']||null:null,'limit':_0xf52196[_0x9dcb('0x19')]?_0xf52196[_0x9dcb('0x19')][_0x9dcb('0x1b')]||null:null,'include':_0xf52196[_0x9dcb('0x19')]?_0xf52196['options']['include']?_[_0x9dcb('0x1c')](_0xf52196[_0x9dcb('0x19')][_0x9dcb('0x1d')],function(_0x577cbe){return{'model':db[_0x577cbe[_0x9dcb('0x1e')]],'as':_0x577cbe['as'],'attributes':_0x577cbe[_0x9dcb('0x1f')],'include':_0x577cbe[_0x9dcb('0x1d')]?_['map'](_0x577cbe[_0x9dcb('0x1d')],function(_0x3c0f81){return{'model':db[_0x3c0f81[_0x9dcb('0x1e')]],'as':_0x3c0f81['as'],'attributes':_0x3c0f81['attributes'],'include':_0x3c0f81['include']?_[_0x9dcb('0x1c')](_0x3c0f81[_0x9dcb('0x1d')],function(_0x451092){return{'model':db[_0x451092[_0x9dcb('0x1e')]],'as':_0x451092['as'],'attributes':_0x451092[_0x9dcb('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9dcb('0xb')](function(_0x2ac638){logger[_0x9dcb('0xc')](_0x9dcb('0x20'),_0xf52196);logger[_0x9dcb('0xe')](_0x9dcb('0x20'),_0xf52196,JSON[_0x9dcb('0x10')](_0x2ac638));_0x41b93c(_0x2ac638);})['catch'](function(_0x1bcde0){logger[_0x9dcb('0x11')](_0x9dcb('0x20'),_0x1bcde0[_0x9dcb('0x14')],_0xf52196);_0x33d6a5(_0x32e5ba[_0x9dcb('0x11')](0x1f4,_0x1bcde0[_0x9dcb('0x14')]));});});};exports[_0x9dcb('0x21')]=function(_0x242800){var _0x2017dd=this;return new Promise(function(_0x2c00db,_0x494f61){return db['MailQueue'][_0x9dcb('0x22')]({'raw':_0x242800[_0x9dcb('0x19')]?_0x242800[_0x9dcb('0x19')][_0x9dcb('0x1a')]===undefined?!![]:![]:!![],'where':_0x242800[_0x9dcb('0x19')]?_0x242800[_0x9dcb('0x19')][_0x9dcb('0x23')]||null:null,'attributes':_0x242800[_0x9dcb('0x19')]?_0x242800[_0x9dcb('0x19')][_0x9dcb('0x1f')]||null:null,'include':_0x242800[_0x9dcb('0x19')]?_0x242800[_0x9dcb('0x19')][_0x9dcb('0x1d')]?_[_0x9dcb('0x1c')](_0x242800[_0x9dcb('0x19')][_0x9dcb('0x1d')],function(_0x121dbd){return{'model':db[_0x121dbd['model']],'as':_0x121dbd['as'],'attributes':_0x121dbd[_0x9dcb('0x1f')],'include':_0x121dbd['include']?_[_0x9dcb('0x1c')](_0x121dbd[_0x9dcb('0x1d')],function(_0x4da290){return{'model':db[_0x4da290[_0x9dcb('0x1e')]],'as':_0x4da290['as'],'attributes':_0x4da290[_0x9dcb('0x1f')],'include':_0x4da290['include']?_[_0x9dcb('0x1c')](_0x4da290[_0x9dcb('0x1d')],function(_0x3e4363){return{'model':db[_0x3e4363['model']],'as':_0x3e4363['as'],'attributes':_0x3e4363[_0x9dcb('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9dcb('0xb')](function(_0x353e75){logger[_0x9dcb('0xc')](_0x9dcb('0x21'),_0x242800);logger['debug'](_0x9dcb('0x21'),_0x242800,JSON[_0x9dcb('0x10')](_0x353e75));_0x2c00db(_0x353e75);})[_0x9dcb('0x16')](function(_0x3d948e){logger[_0x9dcb('0x11')]('ShowMailQueue',_0x3d948e[_0x9dcb('0x14')],_0x242800);_0x494f61(_0x2017dd['error'](0x1f4,_0x3d948e[_0x9dcb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index bb51eba..f991e9e 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 _0x59d8=['update','emit','register','length','./mailQueue.events'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x59d8,0x95));var _0x859d=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x59d8[_0x24061a];return _0x82054e;};'use strict';var MailQueueEvents=require(_0x859d('0x0'));var events=['save','remove',_0x859d('0x1')];function createListener(_0x2ea34e,_0x2e8a4a){return function(_0x2e3cbb){_0x2e8a4a[_0x859d('0x2')](_0x2ea34e,_0x2e3cbb);};}function removeListener(_0x4fbe3a,_0x4d248a){return function(){MailQueueEvents['removeListener'](_0x4fbe3a,_0x4d248a);};}exports[_0x859d('0x3')]=function(_0x41d5d0){for(var _0xeb8264=0x0,_0x3107df=events[_0x859d('0x4')];_0xeb8264<_0x3107df;_0xeb8264++){var _0x3113a0=events[_0xeb8264];var _0x403f55=createListener('mailQueue:'+_0x3113a0,_0x41d5d0);MailQueueEvents['on'](_0x3113a0,_0x403f55);}}; \ No newline at end of file +var _0xa643=['register','mailQueue:','./mailQueue.events','save','update','emit'];(function(_0x4826c2,_0x4112d8){var _0x250a64=function(_0x36f6e8){while(--_0x36f6e8){_0x4826c2['push'](_0x4826c2['shift']());}};_0x250a64(++_0x4112d8);}(_0xa643,0x11c));var _0x3a64=function(_0x44027c,_0x249879){_0x44027c=_0x44027c-0x0;var _0x3c01c3=_0xa643[_0x44027c];return _0x3c01c3;};'use strict';var MailQueueEvents=require(_0x3a64('0x0'));var events=[_0x3a64('0x1'),'remove',_0x3a64('0x2')];function createListener(_0x1639f2,_0x4dd79b){return function(_0x2c13fb){_0x4dd79b[_0x3a64('0x3')](_0x1639f2,_0x2c13fb);};}function removeListener(_0x21d5a8,_0x147eb0){return function(){MailQueueEvents['removeListener'](_0x21d5a8,_0x147eb0);};}exports[_0x3a64('0x4')]=function(_0x14e51b){for(var _0x207bec=0x0,_0x389fda=events['length'];_0x207bec<_0x389fda;_0x207bec++){var _0x313eda=events[_0x207bec];var _0x49dd47=createListener(_0x3a64('0x5')+_0x313eda,_0x14e51b);MailQueueEvents['on'](_0x313eda,_0x49dd47);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8429870..6a97a01 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 _0x4559=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2a2f7e,_0x27df25){var _0x18c674=function(_0x484fb0){while(--_0x484fb0){_0x2a2f7e['push'](_0x2a2f7e['shift']());}};_0x18c674(++_0x27df25);}(_0x4559,0x15f));var _0x9455=function(_0x4ddc7a,_0x5b6cb8){_0x4ddc7a=_0x4ddc7a-0x0;var _0x4547c1=_0x4559[_0x4ddc7a];return _0x4547c1;};'use strict';var multer=require('multer');var util=require(_0x9455('0x0'));var path=require(_0x9455('0x1'));var timeout=require(_0x9455('0x2'));var express=require(_0x9455('0x3'));var router=express[_0x9455('0x4')]();var fs_extra=require(_0x9455('0x5'));var auth=require(_0x9455('0x6'));var interaction=require(_0x9455('0x7'));var config=require(_0x9455('0x8'));var controller=require('./mailQueueReport.controller');router[_0x9455('0x9')]('/',auth[_0x9455('0xa')](),controller[_0x9455('0xb')]);router['get'](_0x9455('0xc'),auth[_0x9455('0xa')](),controller[_0x9455('0xd')]);router[_0x9455('0x9')](_0x9455('0xe'),auth[_0x9455('0xa')](),controller[_0x9455('0xf')]);router['post']('/',auth[_0x9455('0xa')](),controller[_0x9455('0x10')]);router[_0x9455('0x11')]('/:id',auth[_0x9455('0xa')](),controller['update']);router[_0x9455('0x12')](_0x9455('0xe'),auth[_0x9455('0xa')](),controller[_0x9455('0x13')]);module[_0x9455('0x14')]=router; \ No newline at end of file +var _0xf2c5=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x501c08,_0x5ba05c){var _0x499871=function(_0x34cf74){while(--_0x34cf74){_0x501c08['push'](_0x501c08['shift']());}};_0x499871(++_0x5ba05c);}(_0xf2c5,0x108));var _0x5f2c=function(_0x31de60,_0x3ef28e){_0x31de60=_0x31de60-0x0;var _0x99a68b=_0xf2c5[_0x31de60];return _0x99a68b;};'use strict';var multer=require(_0x5f2c('0x0'));var util=require(_0x5f2c('0x1'));var path=require(_0x5f2c('0x2'));var timeout=require(_0x5f2c('0x3'));var express=require(_0x5f2c('0x4'));var router=express[_0x5f2c('0x5')]();var fs_extra=require(_0x5f2c('0x6'));var auth=require(_0x5f2c('0x7'));var interaction=require(_0x5f2c('0x8'));var config=require(_0x5f2c('0x9'));var controller=require(_0x5f2c('0xa'));router[_0x5f2c('0xb')]('/',auth[_0x5f2c('0xc')](),controller['index']);router['get']('/describe',auth[_0x5f2c('0xc')](),controller[_0x5f2c('0xd')]);router[_0x5f2c('0xb')](_0x5f2c('0xe'),auth[_0x5f2c('0xc')](),controller[_0x5f2c('0xf')]);router[_0x5f2c('0x10')]('/',auth[_0x5f2c('0xc')](),controller['create']);router[_0x5f2c('0x11')](_0x5f2c('0xe'),auth['isAuthenticated'](),controller[_0x5f2c('0x12')]);router[_0x5f2c('0x13')](_0x5f2c('0xe'),auth[_0x5f2c('0xc')](),controller[_0x5f2c('0x14')]);module[_0x5f2c('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index cf60674..edb6c08 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 _0xe801=['moment','sequelize','exports','STRING','DATE'];(function(_0x2bbb47,_0x1838d9){var _0x2192b6=function(_0x58779b){while(--_0x58779b){_0x2bbb47['push'](_0x2bbb47['shift']());}};_0x2192b6(++_0x1838d9);}(_0xe801,0x69));var _0x1e80=function(_0x39a2cc,_0x367537){_0x39a2cc=_0x39a2cc-0x0;var _0x2ecf87=_0xe801[_0x39a2cc];return _0x2ecf87;};'use strict';var moment=require(_0x1e80('0x0'));var Sequelize=require(_0x1e80('0x1'));module[_0x1e80('0x2')]={'uniqueid':{'type':Sequelize[_0x1e80('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1e80('0x4')]},'acceptAt':{'type':Sequelize[_0x1e80('0x4')]},'exitAt':{'type':Sequelize[_0x1e80('0x4')]},'reason':{'type':Sequelize[_0x1e80('0x3')]}}; \ No newline at end of file +var _0xd7ba=['sequelize','exports','STRING','DATE','moment'];(function(_0x4c378e,_0x286afb){var _0xf41ce7=function(_0x48d22e){while(--_0x48d22e){_0x4c378e['push'](_0x4c378e['shift']());}};_0xf41ce7(++_0x286afb);}(_0xd7ba,0xef));var _0xad7b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd7ba[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require(_0xad7b('0x0'));var Sequelize=require(_0xad7b('0x1'));module[_0xad7b('0x2')]={'uniqueid':{'type':Sequelize[_0xad7b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xad7b('0x3')]},'joinAt':{'type':Sequelize[_0xad7b('0x4')]},'leaveAt':{'type':Sequelize[_0xad7b('0x4')]},'acceptAt':{'type':Sequelize[_0xad7b('0x4')]},'exitAt':{'type':Sequelize[_0xad7b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 7681c23..8afbafe 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 _0x1893=['query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','includeAll','include','catch','keys','merge','find','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','count','limit','set','Content-Range','reject','save','update','then','error','send','index','MailQueueReport','rawAttributes','type','key','model','name'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x1893,0xa2));var _0x3189=function(_0x44a518,_0x413a2d){_0x44a518=_0x44a518-0x0;var _0x4a3cdf=_0x1893[_0x44a518];return _0x4a3cdf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];function respondWithStatusCode(_0x5d9fff,_0x22b11e){_0x22b11e=_0x22b11e||0xcc;return function(_0x353b17){if(_0x353b17){return _0x5d9fff[_0x3189('0x19')](_0x22b11e);}return _0x5d9fff[_0x3189('0x1a')](_0x22b11e)[_0x3189('0x1b')]();};}function respondWithResult(_0x20dcc2,_0xef438){_0xef438=_0xef438||0xc8;return function(_0x25a917){if(_0x25a917){return _0x20dcc2['status'](_0xef438)[_0x3189('0x1c')](_0x25a917);}};}function respondWithFilteredResult(_0xb3e4c2,_0x1c209b){return function(_0x2fb62b){if(_0x2fb62b){var _0x486dd2=typeof _0x1c209b[_0x3189('0x1d')]==='undefined'&&typeof _0x1c209b['limit']===_0x3189('0x1e');var _0x49b1bc=_0x2fb62b[_0x3189('0x1f')];var _0xf8aed7=_0x486dd2?0x0:_0x1c209b[_0x3189('0x1d')];var _0x9905c4=_0x486dd2?_0x2fb62b['count']:_0x1c209b[_0x3189('0x1d')]+_0x1c209b[_0x3189('0x20')];var _0x16edd7;if(_0x9905c4>=_0x49b1bc){_0x9905c4=_0x49b1bc;_0x16edd7=0xc8;}else{_0x16edd7=0xce;}_0xb3e4c2['status'](_0x16edd7);return _0xb3e4c2[_0x3189('0x21')](_0x3189('0x22'),_0xf8aed7+'-'+_0x9905c4+'/'+_0x49b1bc)[_0x3189('0x1c')](_0x2fb62b);}return null;};}function patchUpdates(_0x2c1e59){return function(_0x29b275){try{jsonpatch['apply'](_0x29b275,_0x2c1e59,!![]);}catch(_0x1771a8){return BPromise[_0x3189('0x23')](_0x1771a8);}return _0x29b275[_0x3189('0x24')]();};}function saveUpdates(_0x539e12,_0x309c6e){return function(_0x47abb4){if(_0x47abb4){return _0x47abb4[_0x3189('0x25')](_0x539e12)[_0x3189('0x26')](function(_0x200f16){return _0x200f16;});}return null;};}function removeEntity(_0x38e56a,_0x1cbe33){return function(_0x393fcb){if(_0x393fcb){return _0x393fcb['destroy']()['then'](function(){_0x38e56a[_0x3189('0x1a')](0xcc)[_0x3189('0x1b')]();});}};}function handleEntityNotFound(_0x1dc1c8,_0x3cc1e5){return function(_0x103de4){if(!_0x103de4){_0x1dc1c8[_0x3189('0x19')](0x194);}return _0x103de4;};}function handleError(_0xdda38b,_0x379a48){_0x379a48=_0x379a48||0x1f4;return function(_0x17b540){logger[_0x3189('0x27')](_0x17b540['stack']);if(_0x17b540['name']){delete _0x17b540['name'];}_0xdda38b[_0x3189('0x1a')](_0x379a48)[_0x3189('0x28')](_0x17b540);};}exports[_0x3189('0x29')]=function(_0x90c31,_0x36b258){var _0x2f7504={},_0x4d453a={},_0x1ab94b={'count':0x0,'rows':[]};var _0x37b9ec=_['map'](db[_0x3189('0x2a')][_0x3189('0x2b')],function(_0x39c5e4){return{'name':_0x39c5e4['fieldName'],'type':_0x39c5e4[_0x3189('0x2c')][_0x3189('0x2d')]};});_0x4d453a[_0x3189('0x2e')]=_['map'](_0x37b9ec,_0x3189('0x2f'));_0x4d453a[_0x3189('0x30')]=_['keys'](_0x90c31[_0x3189('0x30')]);_0x4d453a[_0x3189('0x31')]=_[_0x3189('0x32')](_0x4d453a[_0x3189('0x2e')],_0x4d453a[_0x3189('0x30')]);_0x2f7504['attributes']=_['intersection'](_0x4d453a[_0x3189('0x2e')],qs['fields'](_0x90c31[_0x3189('0x30')][_0x3189('0x33')]));_0x2f7504[_0x3189('0x34')]=_0x2f7504[_0x3189('0x34')][_0x3189('0x35')]?_0x2f7504[_0x3189('0x34')]:_0x4d453a[_0x3189('0x2e')];if(!_0x90c31[_0x3189('0x30')][_0x3189('0x36')]('nolimit')){_0x2f7504[_0x3189('0x20')]=qs[_0x3189('0x20')](_0x90c31[_0x3189('0x30')][_0x3189('0x20')]);_0x2f7504[_0x3189('0x1d')]=qs[_0x3189('0x1d')](_0x90c31[_0x3189('0x30')]['offset']);}_0x2f7504['order']=qs[_0x3189('0x37')](_0x90c31['query'][_0x3189('0x37')]);_0x2f7504[_0x3189('0x38')]=qs['filters'](_[_0x3189('0x39')](_0x90c31[_0x3189('0x30')],_0x4d453a[_0x3189('0x31')]),_0x37b9ec);if(_0x90c31[_0x3189('0x30')]['filter']){_0x2f7504[_0x3189('0x38')]=_['merge'](_0x2f7504['where'],{'$or':_[_0x3189('0x3a')](_0x37b9ec,function(_0xed3041){if(_0xed3041[_0x3189('0x2c')]!==_0x3189('0x3b')){var _0x12dee0={};_0x12dee0[_0xed3041[_0x3189('0x2f')]]={'$like':'%'+_0x90c31[_0x3189('0x30')][_0x3189('0x3c')]+'%'};return _0x12dee0;}})});}_0x2f7504=_['merge']({},_0x2f7504,_0x90c31['options']);var _0x407e0a={'where':_0x2f7504[_0x3189('0x38')]};return db[_0x3189('0x2a')][_0x3189('0x1f')](_0x407e0a)[_0x3189('0x26')](function(_0xb52c70){_0x1ab94b['count']=_0xb52c70;if(_0x90c31[_0x3189('0x30')][_0x3189('0x3d')]){_0x2f7504[_0x3189('0x3e')]=[{'all':!![]}];}return db[_0x3189('0x2a')]['findAll'](_0x2f7504);})[_0x3189('0x26')](function(_0x2f0d49){_0x1ab94b['rows']=_0x2f0d49;return _0x1ab94b;})['then'](respondWithFilteredResult(_0x36b258,_0x2f7504))[_0x3189('0x3f')](handleError(_0x36b258,null));};exports['show']=function(_0x376787,_0x3074b9){var _0x38bf83={'raw':!![],'where':{'id':_0x376787['params']['id']}},_0x9593f3={};_0x9593f3[_0x3189('0x2e')]=_[_0x3189('0x40')](db['MailQueueReport'][_0x3189('0x2b')]);_0x9593f3[_0x3189('0x30')]=_[_0x3189('0x40')](_0x376787[_0x3189('0x30')]);_0x9593f3[_0x3189('0x31')]=_['intersection'](_0x9593f3['model'],_0x9593f3[_0x3189('0x30')]);_0x38bf83['attributes']=_[_0x3189('0x32')](_0x9593f3[_0x3189('0x2e')],qs[_0x3189('0x33')](_0x376787['query'][_0x3189('0x33')]));_0x38bf83[_0x3189('0x34')]=_0x38bf83[_0x3189('0x34')]['length']?_0x38bf83[_0x3189('0x34')]:_0x9593f3[_0x3189('0x2e')];if(_0x376787[_0x3189('0x30')][_0x3189('0x3d')]){_0x38bf83[_0x3189('0x3e')]=[{'all':!![]}];}_0x38bf83=_[_0x3189('0x41')]({},_0x38bf83,_0x376787['options']);return db['MailQueueReport'][_0x3189('0x42')](_0x38bf83)['then'](handleEntityNotFound(_0x3074b9,null))['then'](respondWithResult(_0x3074b9,null))[_0x3189('0x3f')](handleError(_0x3074b9,null));};exports['create']=function(_0x2d58fd,_0x1b6f09){return db[_0x3189('0x2a')]['create'](_0x2d58fd[_0x3189('0x43')],{})['then'](respondWithResult(_0x1b6f09,0xc9))[_0x3189('0x3f')](handleError(_0x1b6f09,null));};exports['update']=function(_0x49c4a8,_0x244166){if(_0x49c4a8['body']['id']){delete _0x49c4a8[_0x3189('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x49c4a8[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x244166,null))[_0x3189('0x26')](saveUpdates(_0x49c4a8[_0x3189('0x43')],null))[_0x3189('0x26')](respondWithResult(_0x244166,null))[_0x3189('0x3f')](handleError(_0x244166,null));};exports['destroy']=function(_0x21d446,_0x549bc7){return db['MailQueueReport'][_0x3189('0x42')]({'where':{'id':_0x21d446[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x549bc7,null))[_0x3189('0x26')](removeEntity(_0x549bc7,null))[_0x3189('0x3f')](handleError(_0x549bc7,null));};exports[_0x3189('0x45')]=function(_0x556ee5,_0x5117fb){return db['MailQueueReport'][_0x3189('0x45')]()[_0x3189('0x26')](respondWithResult(_0x5117fb,null))[_0x3189('0x3f')](handleError(_0x5117fb,null));}; \ No newline at end of file +var _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','MailQueueReport','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','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','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x41d6e6,_0x4b6344){var _0x3ee029=function(_0x5275f0){while(--_0x5275f0){_0x41d6e6['push'](_0x41d6e6['shift']());}};_0x3ee029(++_0x4b6344);}(_0xef0f,0x168));var _0xfef0=function(_0x8afda5,_0x2e17be){_0x8afda5=_0x8afda5-0x0;var _0x3c6203=_0xef0f[_0x8afda5];return _0x3c6203;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['MailQueueReport']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':!![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 461daa8..954657f 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 _0x0a3c=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x17c676,_0x10affa){var _0xa46e88=function(_0x47c468){while(--_0x47c468){_0x17c676['push'](_0x17c676['shift']());}};_0xa46e88(++_0x10affa);}(_0x0a3c,0x1f4));var _0xc0a3=function(_0x361405,_0xc2b4f){_0x361405=_0x361405-0x0;var _0x595276=_0x0a3c[_0x361405];return _0x595276;};'use strict';var _=require(_0xc0a3('0x0'));var util=require(_0xc0a3('0x1'));var logger=require(_0xc0a3('0x2'))(_0xc0a3('0x3'));var moment=require(_0xc0a3('0x4'));var BPromise=require(_0xc0a3('0x5'));var rp=require(_0xc0a3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0a3('0x7'));var config=require(_0xc0a3('0x8'));var attributes=require(_0xc0a3('0x9'));module[_0xc0a3('0xa')]=function(_0x142873,_0xd463b9){return _0x142873[_0xc0a3('0xb')](_0xc0a3('0xc'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xc0a3('0xd'),'fields':[_0xc0a3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3051=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash'];(function(_0x5e3850,_0x5c24a6){var _0x256103=function(_0x5d5316){while(--_0x5d5316){_0x5e3850['push'](_0x5e3850['shift']());}};_0x256103(++_0x5c24a6);}(_0x3051,0x179));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1305('0x0'));var util=require(_0x1305('0x1'));var logger=require(_0x1305('0x2'))(_0x1305('0x3'));var moment=require(_0x1305('0x4'));var BPromise=require(_0x1305('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1305('0x6'));var rimraf=require(_0x1305('0x7'));var config=require(_0x1305('0x8'));var attributes=require(_0x1305('0x9'));module[_0x1305('0xa')]=function(_0x2b8772,_0x33f08f){return _0x2b8772[_0x1305('0xb')]('MailQueueReport',attributes,{'tableName':_0x1305('0xc'),'paranoid':![],'indexes':[{'name':_0x1305('0xd'),'fields':[_0x1305('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3e7de56..c9e3fc8 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x26cb1e,_0x2f7e4d){var _0x7a5f40=function(_0xfae629){while(--_0xfae629){_0x26cb1e['push'](_0x26cb1e['shift']());}};_0x7a5f40(++_0x2f7e4d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x3ce3aa,_0x5d431a){var _0x183fdb=function(_0x521fa5){while(--_0x521fa5){_0x3ce3aa['push'](_0x3ce3aa['shift']());}};_0x183fdb(++_0x5d431a);}(_0x7a54,0x106));var _0x47a5=function(_0x35db58,_0x5a8266){_0x35db58=_0x35db58-0x0;var _0x185809=_0x7a54[_0x35db58];return _0x185809;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d673a0a..9289485 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x147a44,_0x2d9343){var _0x18b2f9=function(_0x1c075d){while(--_0x1c075d){_0x147a44['push'](_0x147a44['shift']());}};_0x18b2f9(++_0x2d9343);}(_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(_0x1c2364,_0x2ed7e7){var _0x377217=function(_0x5b6aeb){while(--_0x5b6aeb){_0x1c2364['push'](_0x1c2364['shift']());}};_0x377217(++_0x2ed7e7);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 894869d..305fd02 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 _0x142a=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x34f689,_0x362847){var _0xe23b2e=function(_0x378458){while(--_0x378458){_0x34f689['push'](_0x34f689['shift']());}};_0xe23b2e(++_0x362847);}(_0x142a,0x18b));var _0xa142=function(_0x2df4d7,_0x57da82){_0x2df4d7=_0x2df4d7-0x0;var _0x40787a=_0x142a[_0x2df4d7];return _0x40787a;};'use strict';var Sequelize=require(_0xa142('0x0'));module[_0xa142('0x1')]={'description':{'type':Sequelize[_0xa142('0x2')]},'host':{'type':Sequelize[_0xa142('0x2')]},'authentication':{'type':Sequelize[_0xa142('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa142('0x2')]},'port':{'type':Sequelize[_0xa142('0x4')]},'tls':{'type':Sequelize[_0xa142('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xa142('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xa142('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x32f7=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x24f5b1,_0x350007){var _0x451a13=function(_0x30d668){while(--_0x30d668){_0x24f5b1['push'](_0x24f5b1['shift']());}};_0x451a13(++_0x350007);}(_0x32f7,0x16e));var _0x732f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x732f('0x0'));module[_0x732f('0x1')]={'description':{'type':Sequelize[_0x732f('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x732f('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x732f('0x2')]},'password':{'type':Sequelize[_0x732f('0x2')]},'port':{'type':Sequelize[_0x732f('0x4')]},'tls':{'type':Sequelize[_0x732f('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x732f('0x2')],'defaultValue':_0x732f('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x732f('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x732f('0x2')]},'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 0f9ddb7..8379141 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 _0x1c47=['../../config/logger','api','moment','bluebird','request-promise','path','./mailServerIn.attributes','exports','MailServerIn','lodash'];(function(_0x3abb39,_0x14b33d){var _0x38cdcd=function(_0x1aa151){while(--_0x1aa151){_0x3abb39['push'](_0x3abb39['shift']());}};_0x38cdcd(++_0x14b33d);}(_0x1c47,0x149));var _0x71c4=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x1c47[_0x5416db];return _0x243e35;};'use strict';var _=require(_0x71c4('0x0'));var util=require('util');var logger=require(_0x71c4('0x1'))(_0x71c4('0x2'));var moment=require(_0x71c4('0x3'));var BPromise=require(_0x71c4('0x4'));var rp=require(_0x71c4('0x5'));var fs=require('fs');var path=require(_0x71c4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x71c4('0x7'));module[_0x71c4('0x8')]=function(_0x5db625,_0x207165){return _0x5db625['define'](_0x71c4('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4303=['MailServerIn','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x20cae2,_0x378d30){var _0x32229b=function(_0x2eac7a){while(--_0x2eac7a){_0x20cae2['push'](_0x20cae2['shift']());}};_0x32229b(++_0x378d30);}(_0x4303,0x181));var _0x3430=function(_0x3e959d,_0xf99412){_0x3e959d=_0x3e959d-0x0;var _0x3ba243=_0x4303[_0x3e959d];return _0x3ba243;};'use strict';var _=require(_0x3430('0x0'));var util=require(_0x3430('0x1'));var logger=require('../../config/logger')(_0x3430('0x2'));var moment=require(_0x3430('0x3'));var BPromise=require(_0x3430('0x4'));var rp=require(_0x3430('0x5'));var fs=require('fs');var path=require(_0x3430('0x6'));var rimraf=require('rimraf');var config=require(_0x3430('0x7'));var attributes=require(_0x3430('0x8'));module[_0x3430('0x9')]=function(_0x3785ec,_0x2ad315){return _0x3785ec[_0x3430('0xa')](_0x3430('0xb'),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 e7efb9a..19f500a 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 _0xab26=['then','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetMailServerIn','MailServerIn','options','raw','where','map','include','model','attributes','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xab26,0x196));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6ab2('0x0'));var util=require(_0x6ab2('0x1'));var moment=require(_0x6ab2('0x2'));var BPromise=require(_0x6ab2('0x3'));var rs=require(_0x6ab2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ab2('0x5'))['db'];var utils=require(_0x6ab2('0x6'));var logger=require(_0x6ab2('0x7'))(_0x6ab2('0x8'));var config=require(_0x6ab2('0x9'));var jayson=require(_0x6ab2('0xa'));var client=jayson[_0x6ab2('0xb')][_0x6ab2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c1f14,_0x2f66af,_0x4ed98b){return new BPromise(function(_0x522099,_0x502d6d){return client[_0x6ab2('0xd')](_0x5c1f14,_0x4ed98b)[_0x6ab2('0xe')](function(_0xf3fbf1){logger[_0x6ab2('0xf')](_0x6ab2('0x10'),_0x2f66af,'request\x20sent');logger['debug'](_0x6ab2('0x11'),_0x2f66af,'request\x20sent',JSON[_0x6ab2('0x12')](_0xf3fbf1));if(_0xf3fbf1['error']){if(_0xf3fbf1[_0x6ab2('0x13')][_0x6ab2('0x14')]===0x1f4){logger[_0x6ab2('0x13')](_0x6ab2('0x10'),_0x2f66af,_0xf3fbf1[_0x6ab2('0x13')][_0x6ab2('0x15')]);return _0x502d6d(_0xf3fbf1[_0x6ab2('0x13')][_0x6ab2('0x15')]);}logger[_0x6ab2('0x13')]('MailServerIn,\x20%s,\x20%s',_0x2f66af,_0xf3fbf1['error'][_0x6ab2('0x15')]);return _0x522099(_0xf3fbf1[_0x6ab2('0x13')][_0x6ab2('0x15')]);}else{logger['info'](_0x6ab2('0x10'),_0x2f66af,_0x6ab2('0x16'));_0x522099(_0xf3fbf1[_0x6ab2('0x17')][_0x6ab2('0x15')]);}})['catch'](function(_0x365de9){logger[_0x6ab2('0x13')]('MailServerIn,\x20%s,\x20%s',_0x2f66af,_0x365de9);_0x502d6d(_0x365de9);});});}exports[_0x6ab2('0x18')]=function(_0x11e316){var _0x571512=this;return new Promise(function(_0x1ae9cc,_0x17ec78){return db[_0x6ab2('0x19')]['findAll']({'raw':_0x11e316[_0x6ab2('0x1a')]?_0x11e316['options'][_0x6ab2('0x1b')]===undefined?!![]:![]:!![],'where':_0x11e316[_0x6ab2('0x1a')]?_0x11e316[_0x6ab2('0x1a')][_0x6ab2('0x1c')]||null:null,'attributes':_0x11e316[_0x6ab2('0x1a')]?_0x11e316['options']['attributes']||null:null,'limit':_0x11e316[_0x6ab2('0x1a')]?_0x11e316[_0x6ab2('0x1a')]['limit']||null:null,'include':_0x11e316[_0x6ab2('0x1a')]?_0x11e316[_0x6ab2('0x1a')]['include']?_[_0x6ab2('0x1d')](_0x11e316[_0x6ab2('0x1a')][_0x6ab2('0x1e')],function(_0x472f61){return{'model':db[_0x472f61[_0x6ab2('0x1f')]],'as':_0x472f61['as'],'attributes':_0x472f61[_0x6ab2('0x20')],'include':_0x472f61[_0x6ab2('0x1e')]?_[_0x6ab2('0x1d')](_0x472f61[_0x6ab2('0x1e')],function(_0x5b4266){return{'model':db[_0x5b4266[_0x6ab2('0x1f')]],'as':_0x5b4266['as'],'attributes':_0x5b4266['attributes'],'include':_0x5b4266[_0x6ab2('0x1e')]?_[_0x6ab2('0x1d')](_0x5b4266['include'],function(_0x3cdc0d){return{'model':db[_0x3cdc0d['model']],'as':_0x3cdc0d['as'],'attributes':_0x3cdc0d[_0x6ab2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6ab2('0xe')](function(_0x352fc4){logger['info'](_0x6ab2('0x18'),_0x11e316);logger[_0x6ab2('0x21')](_0x6ab2('0x18'),_0x11e316,JSON[_0x6ab2('0x12')](_0x352fc4));_0x1ae9cc(_0x352fc4);})[_0x6ab2('0x22')](function(_0x5cdb4d){logger['error'](_0x6ab2('0x18'),_0x5cdb4d['message'],_0x11e316);_0x17ec78(_0x571512[_0x6ab2('0x13')](0x1f4,_0x5cdb4d['message']));});});}; \ No newline at end of file +var _0x5712=['findAll','options','raw','limit','map','include','attributes','model','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','info','GetMailServerIn'];(function(_0x5ef2db,_0x21cb97){var _0x47eb89=function(_0x43340b){while(--_0x43340b){_0x5ef2db['push'](_0x5ef2db['shift']());}};_0x47eb89(++_0x21cb97);}(_0x5712,0x140));var _0x2571=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5712[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var moment=require(_0x2571('0x2'));var BPromise=require(_0x2571('0x3'));var rs=require(_0x2571('0x4'));var fs=require('fs');var Redis=require(_0x2571('0x5'));var db=require(_0x2571('0x6'))['db'];var utils=require(_0x2571('0x7'));var logger=require(_0x2571('0x8'))(_0x2571('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2571('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e19b2,_0x251ee6,_0x3ca885){return new BPromise(function(_0x204ecc,_0xda659a){return client[_0x2571('0xb')](_0x3e19b2,_0x3ca885)['then'](function(_0x1f0c98){logger['info'](_0x2571('0xc'),_0x251ee6,_0x2571('0xd'));logger[_0x2571('0xe')](_0x2571('0xf'),_0x251ee6,_0x2571('0xd'),JSON[_0x2571('0x10')](_0x1f0c98));if(_0x1f0c98[_0x2571('0x11')]){if(_0x1f0c98[_0x2571('0x11')]['code']===0x1f4){logger['error'](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0xda659a(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0x204ecc(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}else{logger[_0x2571('0x13')]('MailServerIn,\x20%s,\x20%s',_0x251ee6,_0x2571('0xd'));_0x204ecc(_0x1f0c98['result']['message']);}})['catch'](function(_0x4c3e11){logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x4c3e11);_0xda659a(_0x4c3e11);});});}exports[_0x2571('0x14')]=function(_0x75af2a){var _0x576222=this;return new Promise(function(_0x7707,_0x3f2e5f){return db['MailServerIn'][_0x2571('0x15')]({'raw':_0x75af2a[_0x2571('0x16')]?_0x75af2a[_0x2571('0x16')][_0x2571('0x17')]===undefined?!![]:![]:!![],'where':_0x75af2a[_0x2571('0x16')]?_0x75af2a['options']['where']||null:null,'attributes':_0x75af2a[_0x2571('0x16')]?_0x75af2a[_0x2571('0x16')]['attributes']||null:null,'limit':_0x75af2a['options']?_0x75af2a[_0x2571('0x16')][_0x2571('0x18')]||null:null,'include':_0x75af2a[_0x2571('0x16')]?_0x75af2a[_0x2571('0x16')]['include']?_[_0x2571('0x19')](_0x75af2a['options'][_0x2571('0x1a')],function(_0x4316b1){return{'model':db[_0x4316b1['model']],'as':_0x4316b1['as'],'attributes':_0x4316b1[_0x2571('0x1b')],'include':_0x4316b1[_0x2571('0x1a')]?_[_0x2571('0x19')](_0x4316b1['include'],function(_0x5d455d){return{'model':db[_0x5d455d[_0x2571('0x1c')]],'as':_0x5d455d['as'],'attributes':_0x5d455d[_0x2571('0x1b')],'include':_0x5d455d[_0x2571('0x1a')]?_[_0x2571('0x19')](_0x5d455d[_0x2571('0x1a')],function(_0x246bbd){return{'model':db[_0x246bbd['model']],'as':_0x246bbd['as'],'attributes':_0x246bbd['attributes']};}):[]};}):[]};}):[]:[]})[_0x2571('0x1d')](function(_0x426615){logger[_0x2571('0x13')](_0x2571('0x14'),_0x75af2a);logger[_0x2571('0xe')](_0x2571('0x14'),_0x75af2a,JSON[_0x2571('0x10')](_0x426615));_0x7707(_0x426615);})[_0x2571('0x1e')](function(_0x1f7562){logger[_0x2571('0x11')]('GetMailServerIn',_0x1f7562[_0x2571('0x12')],_0x75af2a);_0x3f2e5f(_0x576222[_0x2571('0x11')](0x1f4,_0x1f7562[_0x2571('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 97d58ce..09aa8b6 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 2ccde02..2616c82 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 _0xab40=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xab40,0xcd));var _0x0ab4=function(_0x3abe3e,_0x506e04){_0x3abe3e=_0x3abe3e-0x0;var _0x414b0e=_0xab40[_0x3abe3e];return _0x414b0e;};'use strict';var Sequelize=require(_0x0ab4('0x0'));module[_0x0ab4('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x0ab4('0x2')]},'port':{'type':Sequelize[_0x0ab4('0x3')]},'secure':{'type':Sequelize[_0x0ab4('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x0ab4('0x2')]},'authentication':{'type':Sequelize[_0x0ab4('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbfcc=['sequelize','STRING','INTEGER'];(function(_0x2cc3fe,_0xa7db29){var _0x27c340=function(_0x38fefa){while(--_0x38fefa){_0x2cc3fe['push'](_0x2cc3fe['shift']());}};_0x27c340(++_0xa7db29);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xbfcc[_0x4d8dc3];return _0x9b03d9;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcbfc('0x1')]},'user':{'type':Sequelize[_0xcbfc('0x1')]},'pass':{'type':Sequelize[_0xcbfc('0x1')]},'port':{'type':Sequelize[_0xcbfc('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index b6a973b..04b0958 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 _0xcb18=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','error','stack','name','send','map','MailServerOut','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring'];(function(_0xfc5b47,_0x2ec02d){var _0x17b3c0=function(_0x49b956){while(--_0x49b956){_0xfc5b47['push'](_0xfc5b47['shift']());}};_0x17b3c0(++_0x2ec02d);}(_0xcb18,0x1ab));var _0x8cb1=function(_0xad1486,_0x307e5f){_0xad1486=_0xad1486-0x0;var _0x3ad5e2=_0xcb18[_0xad1486];return _0x3ad5e2;};'use strict';var emlformat=require(_0x8cb1('0x0'));var rimraf=require(_0x8cb1('0x1'));var zipdir=require(_0x8cb1('0x2'));var jsonpatch=require(_0x8cb1('0x3'));var rp=require(_0x8cb1('0x4'));var moment=require(_0x8cb1('0x5'));var BPromise=require(_0x8cb1('0x6'));var Mustache=require(_0x8cb1('0x7'));var util=require('util');var path=require(_0x8cb1('0x8'));var sox=require(_0x8cb1('0x9'));var csv=require(_0x8cb1('0xa'));var ejs=require(_0x8cb1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cb1('0xc'));var squel=require(_0x8cb1('0xd'));var crypto=require(_0x8cb1('0xe'));var jsforce=require(_0x8cb1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8cb1('0xa'));var querystring=require(_0x8cb1('0x10'));var Papa=require(_0x8cb1('0x11'));var Redis=require('ioredis');var authService=require(_0x8cb1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8cb1('0x13'));var hardwareService=require(_0x8cb1('0x14'));var logger=require(_0x8cb1('0x15'))(_0x8cb1('0x16'));var utils=require('../../config/utils');var config=require(_0x8cb1('0x17'));var licenseUtil=require(_0x8cb1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57d7ab,_0x4641fc){_0x4641fc=_0x4641fc||0xcc;return function(_0x5c9ebf){if(_0x5c9ebf){return _0x57d7ab[_0x8cb1('0x19')](_0x4641fc);}return _0x57d7ab[_0x8cb1('0x1a')](_0x4641fc)['end']();};}function respondWithResult(_0x7c904c,_0x55a348){_0x55a348=_0x55a348||0xc8;return function(_0x450a6a){if(_0x450a6a){return _0x7c904c[_0x8cb1('0x1a')](_0x55a348)['json'](_0x450a6a);}};}function respondWithFilteredResult(_0x5a932b,_0x305b76){return function(_0x5ec932){if(_0x5ec932){var _0x341a73=typeof _0x305b76[_0x8cb1('0x1b')]===_0x8cb1('0x1c')&&typeof _0x305b76[_0x8cb1('0x1d')]===_0x8cb1('0x1c');var _0x495023=_0x5ec932[_0x8cb1('0x1e')];var _0x364d85=_0x341a73?0x0:_0x305b76[_0x8cb1('0x1b')];var _0x2e79f7=_0x341a73?_0x5ec932[_0x8cb1('0x1e')]:_0x305b76['offset']+_0x305b76['limit'];var _0x359feb;if(_0x2e79f7>=_0x495023){_0x2e79f7=_0x495023;_0x359feb=0xc8;}else{_0x359feb=0xce;}_0x5a932b[_0x8cb1('0x1a')](_0x359feb);return _0x5a932b[_0x8cb1('0x1f')](_0x8cb1('0x20'),_0x364d85+'-'+_0x2e79f7+'/'+_0x495023)[_0x8cb1('0x21')](_0x5ec932);}return null;};}function patchUpdates(_0x49caab){return function(_0x29d509){try{jsonpatch['apply'](_0x29d509,_0x49caab,!![]);}catch(_0x49e0a9){return BPromise[_0x8cb1('0x22')](_0x49e0a9);}return _0x29d509[_0x8cb1('0x23')]();};}function saveUpdates(_0xd859fb,_0x551168){return function(_0x4e2e04){if(_0x4e2e04){return _0x4e2e04['update'](_0xd859fb)[_0x8cb1('0x24')](function(_0x306110){return _0x306110;});}return null;};}function removeEntity(_0x2afc74,_0x4b7475){return function(_0x2ed179){if(_0x2ed179){return _0x2ed179['destroy']()[_0x8cb1('0x24')](function(){_0x2afc74[_0x8cb1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b1eec,_0x50e6a0){return function(_0x2646b0){if(!_0x2646b0){_0x1b1eec[_0x8cb1('0x19')](0x194);}return _0x2646b0;};}function handleError(_0x4bfbc9,_0x555e87){_0x555e87=_0x555e87||0x1f4;return function(_0x3a7b2a){logger[_0x8cb1('0x25')](_0x3a7b2a[_0x8cb1('0x26')]);if(_0x3a7b2a[_0x8cb1('0x27')]){delete _0x3a7b2a['name'];}_0x4bfbc9[_0x8cb1('0x1a')](_0x555e87)[_0x8cb1('0x28')](_0x3a7b2a);};}exports['index']=function(_0x438bc5,_0xcfa47c){var _0x33ff40={},_0x5444a0={},_0x364e27={'count':0x0,'rows':[]};var _0x237f55=_[_0x8cb1('0x29')](db[_0x8cb1('0x2a')][_0x8cb1('0x2b')],function(_0x268101){return{'name':_0x268101[_0x8cb1('0x2c')],'type':_0x268101['type']['key']};});_0x5444a0[_0x8cb1('0x2d')]=_[_0x8cb1('0x29')](_0x237f55,'name');_0x5444a0['query']=_[_0x8cb1('0x2e')](_0x438bc5[_0x8cb1('0x2f')]);_0x5444a0[_0x8cb1('0x30')]=_[_0x8cb1('0x31')](_0x5444a0[_0x8cb1('0x2d')],_0x5444a0[_0x8cb1('0x2f')]);_0x33ff40[_0x8cb1('0x32')]=_[_0x8cb1('0x31')](_0x5444a0[_0x8cb1('0x2d')],qs[_0x8cb1('0x33')](_0x438bc5[_0x8cb1('0x2f')]['fields']));_0x33ff40[_0x8cb1('0x32')]=_0x33ff40[_0x8cb1('0x32')][_0x8cb1('0x34')]?_0x33ff40[_0x8cb1('0x32')]:_0x5444a0['model'];if(!_0x438bc5[_0x8cb1('0x2f')]['hasOwnProperty'](_0x8cb1('0x35'))){_0x33ff40[_0x8cb1('0x1d')]=qs[_0x8cb1('0x1d')](_0x438bc5['query'][_0x8cb1('0x1d')]);_0x33ff40[_0x8cb1('0x1b')]=qs[_0x8cb1('0x1b')](_0x438bc5[_0x8cb1('0x2f')][_0x8cb1('0x1b')]);}_0x33ff40[_0x8cb1('0x36')]=qs[_0x8cb1('0x37')](_0x438bc5['query'][_0x8cb1('0x37')]);_0x33ff40[_0x8cb1('0x38')]=qs[_0x8cb1('0x30')](_['pick'](_0x438bc5[_0x8cb1('0x2f')],_0x5444a0[_0x8cb1('0x30')]),_0x237f55);if(_0x438bc5[_0x8cb1('0x2f')][_0x8cb1('0x39')]){_0x33ff40[_0x8cb1('0x38')]=_[_0x8cb1('0x3a')](_0x33ff40[_0x8cb1('0x38')],{'$or':_[_0x8cb1('0x29')](_0x237f55,function(_0x19c68e){if(_0x19c68e[_0x8cb1('0x3b')]!==_0x8cb1('0x3c')){var _0x49bb88={};_0x49bb88[_0x19c68e[_0x8cb1('0x27')]]={'$like':'%'+_0x438bc5[_0x8cb1('0x2f')][_0x8cb1('0x39')]+'%'};return _0x49bb88;}})});}_0x33ff40=_[_0x8cb1('0x3a')]({},_0x33ff40,_0x438bc5[_0x8cb1('0x3d')]);var _0x206842={'where':_0x33ff40[_0x8cb1('0x38')]};return db[_0x8cb1('0x2a')][_0x8cb1('0x1e')](_0x206842)['then'](function(_0x201b0a){_0x364e27['count']=_0x201b0a;if(_0x438bc5['query'][_0x8cb1('0x3e')]){_0x33ff40[_0x8cb1('0x3f')]=[{'all':!![]}];}return db[_0x8cb1('0x2a')][_0x8cb1('0x40')](_0x33ff40);})[_0x8cb1('0x24')](function(_0x51d5bd){_0x364e27[_0x8cb1('0x41')]=_0x51d5bd;return _0x364e27;})['then'](respondWithFilteredResult(_0xcfa47c,_0x33ff40))['catch'](handleError(_0xcfa47c,null));};exports[_0x8cb1('0x42')]=function(_0x5f3495,_0x1fc934){var _0x321f2f={'raw':!![],'where':{'id':_0x5f3495[_0x8cb1('0x43')]['id']}},_0x9fd0f8={};_0x9fd0f8[_0x8cb1('0x2d')]=_[_0x8cb1('0x2e')](db['MailServerOut'][_0x8cb1('0x2b')]);_0x9fd0f8[_0x8cb1('0x2f')]=_[_0x8cb1('0x2e')](_0x5f3495[_0x8cb1('0x2f')]);_0x9fd0f8[_0x8cb1('0x30')]=_[_0x8cb1('0x31')](_0x9fd0f8[_0x8cb1('0x2d')],_0x9fd0f8[_0x8cb1('0x2f')]);_0x321f2f[_0x8cb1('0x32')]=_[_0x8cb1('0x31')](_0x9fd0f8['model'],qs[_0x8cb1('0x33')](_0x5f3495[_0x8cb1('0x2f')][_0x8cb1('0x33')]));_0x321f2f[_0x8cb1('0x32')]=_0x321f2f[_0x8cb1('0x32')][_0x8cb1('0x34')]?_0x321f2f[_0x8cb1('0x32')]:_0x9fd0f8['model'];if(_0x5f3495['query'][_0x8cb1('0x3e')]){_0x321f2f[_0x8cb1('0x3f')]=[{'all':!![]}];}_0x321f2f=_[_0x8cb1('0x3a')]({},_0x321f2f,_0x5f3495[_0x8cb1('0x3d')]);return db[_0x8cb1('0x2a')][_0x8cb1('0x44')](_0x321f2f)[_0x8cb1('0x24')](handleEntityNotFound(_0x1fc934,null))[_0x8cb1('0x24')](respondWithResult(_0x1fc934,null))[_0x8cb1('0x45')](handleError(_0x1fc934,null));};exports[_0x8cb1('0x46')]=function(_0x1ca3d7,_0x17a82a){return db[_0x8cb1('0x2a')]['create'](_0x1ca3d7[_0x8cb1('0x47')],{})[_0x8cb1('0x24')](respondWithResult(_0x17a82a,0xc9))[_0x8cb1('0x45')](handleError(_0x17a82a,null));};exports[_0x8cb1('0x48')]=function(_0x218b45,_0x4a18b4){if(_0x218b45[_0x8cb1('0x47')]['id']){delete _0x218b45[_0x8cb1('0x47')]['id'];}return db[_0x8cb1('0x2a')][_0x8cb1('0x44')]({'where':{'id':_0x218b45['params']['id']}})[_0x8cb1('0x24')](handleEntityNotFound(_0x4a18b4,null))['then'](saveUpdates(_0x218b45[_0x8cb1('0x47')],null))[_0x8cb1('0x24')](respondWithResult(_0x4a18b4,null))[_0x8cb1('0x45')](handleError(_0x4a18b4,null));};exports[_0x8cb1('0x49')]=function(_0x1a4bac,_0x670594){return db[_0x8cb1('0x2a')][_0x8cb1('0x44')]({'where':{'id':_0x1a4bac[_0x8cb1('0x43')]['id']}})[_0x8cb1('0x24')](handleEntityNotFound(_0x670594,null))[_0x8cb1('0x24')](removeEntity(_0x670594,null))[_0x8cb1('0x45')](handleError(_0x670594,null));}; \ No newline at end of file +var _0xa16e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa16e,0x178));var _0xea16=function(_0x555615,_0x5125de){_0x555615=_0x555615-0x0;var _0x52461a=_0xa16e[_0x555615];return _0x52461a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xea16('0x0'));var jsonpatch=require(_0xea16('0x1'));var rp=require(_0xea16('0x2'));var moment=require(_0xea16('0x3'));var BPromise=require(_0xea16('0x4'));var Mustache=require('mustache');var util=require(_0xea16('0x5'));var path=require(_0xea16('0x6'));var sox=require(_0xea16('0x7'));var csv=require(_0xea16('0x8'));var ejs=require(_0xea16('0x9'));var fs=require('fs');var fs_extra=require(_0xea16('0xa'));var _=require(_0xea16('0xb'));var squel=require(_0xea16('0xc'));var crypto=require(_0xea16('0xd'));var jsforce=require(_0xea16('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xea16('0x8'));var querystring=require(_0xea16('0xf'));var Papa=require(_0xea16('0x10'));var Redis=require(_0xea16('0x11'));var authService=require(_0xea16('0x12'));var qs=require(_0xea16('0x13'));var as=require(_0xea16('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea16('0x15'))(_0xea16('0x16'));var utils=require('../../config/utils');var config=require(_0xea16('0x17'));var licenseUtil=require(_0xea16('0x18'));var db=require(_0xea16('0x19'))['db'];function respondWithStatusCode(_0x4654b6,_0x2855ee){_0x2855ee=_0x2855ee||0xcc;return function(_0x4bad30){if(_0x4bad30){return _0x4654b6['sendStatus'](_0x2855ee);}return _0x4654b6[_0xea16('0x1a')](_0x2855ee)['end']();};}function respondWithResult(_0x40803,_0x527e4a){_0x527e4a=_0x527e4a||0xc8;return function(_0x2f3fe9){if(_0x2f3fe9){return _0x40803['status'](_0x527e4a)[_0xea16('0x1b')](_0x2f3fe9);}};}function respondWithFilteredResult(_0x395973,_0x5f0787){return function(_0x3ec7bc){if(_0x3ec7bc){var _0x130fd2=typeof _0x5f0787[_0xea16('0x1c')]===_0xea16('0x1d')&&typeof _0x5f0787[_0xea16('0x1e')]==='undefined';var _0x14f2b8=_0x3ec7bc['count'];var _0x3cf84e=_0x130fd2?0x0:_0x5f0787[_0xea16('0x1c')];var _0x4dfb1b=_0x130fd2?_0x3ec7bc[_0xea16('0x1f')]:_0x5f0787[_0xea16('0x1c')]+_0x5f0787[_0xea16('0x1e')];var _0x41eda9;if(_0x4dfb1b>=_0x14f2b8){_0x4dfb1b=_0x14f2b8;_0x41eda9=0xc8;}else{_0x41eda9=0xce;}_0x395973['status'](_0x41eda9);return _0x395973['set'](_0xea16('0x20'),_0x3cf84e+'-'+_0x4dfb1b+'/'+_0x14f2b8)['json'](_0x3ec7bc);}return null;};}function patchUpdates(_0x201072){return function(_0x10b05e){try{jsonpatch[_0xea16('0x21')](_0x10b05e,_0x201072,!![]);}catch(_0x3ba1ba){return BPromise[_0xea16('0x22')](_0x3ba1ba);}return _0x10b05e[_0xea16('0x23')]();};}function saveUpdates(_0x93f51c,_0x5ba752){return function(_0x491337){if(_0x491337){return _0x491337['update'](_0x93f51c)[_0xea16('0x24')](function(_0x103862){return _0x103862;});}return null;};}function removeEntity(_0x4d70e0,_0xc2dca7){return function(_0x45ddb8){if(_0x45ddb8){return _0x45ddb8[_0xea16('0x25')]()[_0xea16('0x24')](function(){_0x4d70e0[_0xea16('0x1a')](0xcc)[_0xea16('0x26')]();});}};}function handleEntityNotFound(_0x326a08,_0x1c024c){return function(_0x52e591){if(!_0x52e591){_0x326a08[_0xea16('0x27')](0x194);}return _0x52e591;};}function handleError(_0x2c2ff9,_0x55bbb5){_0x55bbb5=_0x55bbb5||0x1f4;return function(_0x10934c){logger[_0xea16('0x28')](_0x10934c[_0xea16('0x29')]);if(_0x10934c[_0xea16('0x2a')]){delete _0x10934c[_0xea16('0x2a')];}_0x2c2ff9[_0xea16('0x1a')](_0x55bbb5)[_0xea16('0x2b')](_0x10934c);};}exports[_0xea16('0x2c')]=function(_0x573f4d,_0x4047a4){var _0x28ee47={},_0x55ef3f={},_0x4a7c0e={'count':0x0,'rows':[]};var _0x2fef22=_[_0xea16('0x2d')](db[_0xea16('0x2e')][_0xea16('0x2f')],function(_0x3449de){return{'name':_0x3449de[_0xea16('0x30')],'type':_0x3449de[_0xea16('0x31')][_0xea16('0x32')]};});_0x55ef3f[_0xea16('0x33')]=_['map'](_0x2fef22,_0xea16('0x2a'));_0x55ef3f[_0xea16('0x34')]=_[_0xea16('0x35')](_0x573f4d['query']);_0x55ef3f[_0xea16('0x36')]=_[_0xea16('0x37')](_0x55ef3f['model'],_0x55ef3f[_0xea16('0x34')]);_0x28ee47[_0xea16('0x38')]=_[_0xea16('0x37')](_0x55ef3f['model'],qs[_0xea16('0x39')](_0x573f4d[_0xea16('0x34')][_0xea16('0x39')]));_0x28ee47[_0xea16('0x38')]=_0x28ee47[_0xea16('0x38')]['length']?_0x28ee47[_0xea16('0x38')]:_0x55ef3f[_0xea16('0x33')];if(!_0x573f4d[_0xea16('0x34')][_0xea16('0x3a')](_0xea16('0x3b'))){_0x28ee47[_0xea16('0x1e')]=qs[_0xea16('0x1e')](_0x573f4d['query'][_0xea16('0x1e')]);_0x28ee47[_0xea16('0x1c')]=qs[_0xea16('0x1c')](_0x573f4d[_0xea16('0x34')]['offset']);}_0x28ee47[_0xea16('0x3c')]=qs[_0xea16('0x3d')](_0x573f4d[_0xea16('0x34')][_0xea16('0x3d')]);_0x28ee47[_0xea16('0x3e')]=qs[_0xea16('0x36')](_[_0xea16('0x3f')](_0x573f4d[_0xea16('0x34')],_0x55ef3f[_0xea16('0x36')]),_0x2fef22);if(_0x573f4d['query']['filter']){_0x28ee47[_0xea16('0x3e')]=_['merge'](_0x28ee47[_0xea16('0x3e')],{'$or':_[_0xea16('0x2d')](_0x2fef22,function(_0x14b2fb){if(_0x14b2fb[_0xea16('0x31')]!==_0xea16('0x40')){var _0x12550b={};_0x12550b[_0x14b2fb['name']]={'$like':'%'+_0x573f4d[_0xea16('0x34')][_0xea16('0x41')]+'%'};return _0x12550b;}})});}_0x28ee47=_['merge']({},_0x28ee47,_0x573f4d[_0xea16('0x42')]);var _0x329b74={'where':_0x28ee47[_0xea16('0x3e')]};return db['MailServerOut'][_0xea16('0x1f')](_0x329b74)['then'](function(_0x4ccd46){_0x4a7c0e[_0xea16('0x1f')]=_0x4ccd46;if(_0x573f4d['query'][_0xea16('0x43')]){_0x28ee47[_0xea16('0x44')]=[{'all':!![]}];}return db['MailServerOut'][_0xea16('0x45')](_0x28ee47);})[_0xea16('0x24')](function(_0x3b3547){_0x4a7c0e[_0xea16('0x46')]=_0x3b3547;return _0x4a7c0e;})[_0xea16('0x24')](respondWithFilteredResult(_0x4047a4,_0x28ee47))[_0xea16('0x47')](handleError(_0x4047a4,null));};exports[_0xea16('0x48')]=function(_0x4f445e,_0x410b44){var _0x2187a1={'raw':!![],'where':{'id':_0x4f445e[_0xea16('0x49')]['id']}},_0x7c04c8={};_0x7c04c8[_0xea16('0x33')]=_[_0xea16('0x35')](db[_0xea16('0x2e')][_0xea16('0x2f')]);_0x7c04c8[_0xea16('0x34')]=_['keys'](_0x4f445e[_0xea16('0x34')]);_0x7c04c8[_0xea16('0x36')]=_['intersection'](_0x7c04c8[_0xea16('0x33')],_0x7c04c8[_0xea16('0x34')]);_0x2187a1[_0xea16('0x38')]=_['intersection'](_0x7c04c8[_0xea16('0x33')],qs['fields'](_0x4f445e[_0xea16('0x34')][_0xea16('0x39')]));_0x2187a1[_0xea16('0x38')]=_0x2187a1[_0xea16('0x38')]['length']?_0x2187a1[_0xea16('0x38')]:_0x7c04c8['model'];if(_0x4f445e[_0xea16('0x34')]['includeAll']){_0x2187a1[_0xea16('0x44')]=[{'all':!![]}];}_0x2187a1=_[_0xea16('0x4a')]({},_0x2187a1,_0x4f445e[_0xea16('0x42')]);return db[_0xea16('0x2e')][_0xea16('0x4b')](_0x2187a1)[_0xea16('0x24')](handleEntityNotFound(_0x410b44,null))['then'](respondWithResult(_0x410b44,null))['catch'](handleError(_0x410b44,null));};exports['create']=function(_0x23159c,_0x150d35){return db['MailServerOut'][_0xea16('0x4c')](_0x23159c[_0xea16('0x4d')],{})['then'](respondWithResult(_0x150d35,0xc9))[_0xea16('0x47')](handleError(_0x150d35,null));};exports[_0xea16('0x4e')]=function(_0x399fd2,_0x3f74a5){if(_0x399fd2[_0xea16('0x4d')]['id']){delete _0x399fd2[_0xea16('0x4d')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x399fd2[_0xea16('0x49')]['id']}})[_0xea16('0x24')](handleEntityNotFound(_0x3f74a5,null))[_0xea16('0x24')](saveUpdates(_0x399fd2[_0xea16('0x4d')],null))[_0xea16('0x24')](respondWithResult(_0x3f74a5,null))[_0xea16('0x47')](handleError(_0x3f74a5,null));};exports['destroy']=function(_0x792752,_0x74fa31){return db[_0xea16('0x2e')][_0xea16('0x4b')]({'where':{'id':_0x792752[_0xea16('0x49')]['id']}})[_0xea16('0x24')](handleEntityNotFound(_0x74fa31,null))[_0xea16('0x24')](removeEntity(_0x74fa31,null))[_0xea16('0x47')](handleError(_0x74fa31,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index ba6d838..d3cbd3d 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 _0xfb74=['define','MailServerOut','mail_servers_out','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports'];(function(_0x32f845,_0x335cb9){var _0x3c0de4=function(_0x44c308){while(--_0x44c308){_0x32f845['push'](_0x32f845['shift']());}};_0x3c0de4(++_0x335cb9);}(_0xfb74,0x177));var _0x4fb7=function(_0x3c79d1,_0x1e55d4){_0x3c79d1=_0x3c79d1-0x0;var _0x1646e8=_0xfb74[_0x3c79d1];return _0x1646e8;};'use strict';var _=require('lodash');var util=require(_0x4fb7('0x0'));var logger=require(_0x4fb7('0x1'))('api');var moment=require(_0x4fb7('0x2'));var BPromise=require(_0x4fb7('0x3'));var rp=require(_0x4fb7('0x4'));var fs=require('fs');var path=require(_0x4fb7('0x5'));var rimraf=require(_0x4fb7('0x6'));var config=require('../../config/environment');var attributes=require(_0x4fb7('0x7'));module[_0x4fb7('0x8')]=function(_0xf739b3,_0x830b2c){return _0xf739b3[_0x4fb7('0x9')](_0x4fb7('0xa'),attributes,{'tableName':_0x4fb7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5796=['MailServerOut','mail_servers_out','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0x5796,0xa7));var _0x6579=function(_0x207187,_0x435f9d){_0x207187=_0x207187-0x0;var _0x1ce87f=_0x5796[_0x207187];return _0x1ce87f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6579('0x0'))(_0x6579('0x1'));var moment=require(_0x6579('0x2'));var BPromise=require(_0x6579('0x3'));var rp=require(_0x6579('0x4'));var fs=require('fs');var path=require(_0x6579('0x5'));var rimraf=require(_0x6579('0x6'));var config=require(_0x6579('0x7'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x381fa9,_0x2832bf){return _0x381fa9[_0x6579('0x8')](_0x6579('0x9'),attributes,{'tableName':_0x6579('0xa'),'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 8ba5af4..71e3323 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x31dab2,_0x2e988a){var _0x967a94=function(_0x587d3c){while(--_0x587d3c){_0x31dab2['push'](_0x31dab2['shift']());}};_0x967a94(++_0x2e988a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +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(_0x2fb3b1,_0x2f2a38){var _0x35ea87=function(_0x425b12){while(--_0x425b12){_0x2fb3b1['push'](_0x2fb3b1['shift']());}};_0x35ea87(++_0x2f2a38);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc4aa[_0x19950b];return _0x3c6b41;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b0ba5f6..ca3d7cd 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 _0x2064=['create','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','index','/describe','isAuthenticated','/:id','post'];(function(_0x382d8e,_0x2a5761){var _0x23993d=function(_0x1f491c){while(--_0x1f491c){_0x382d8e['push'](_0x382d8e['shift']());}};_0x23993d(++_0x2a5761);}(_0x2064,0xee));var _0x4206=function(_0x34ed48,_0x2cc995){_0x34ed48=_0x34ed48-0x0;var _0x37da5c=_0x2064[_0x34ed48];return _0x37da5c;};'use strict';var multer=require(_0x4206('0x0'));var util=require(_0x4206('0x1'));var path=require(_0x4206('0x2'));var timeout=require('connect-timeout');var express=require(_0x4206('0x3'));var router=express[_0x4206('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4206('0x5'));var interaction=require(_0x4206('0x6'));var config=require('../../config/environment');var controller=require(_0x4206('0x7'));router[_0x4206('0x8')]('/',auth['isAuthenticated'](),controller[_0x4206('0x9')]);router[_0x4206('0x8')](_0x4206('0xa'),auth[_0x4206('0xb')](),controller['describe']);router[_0x4206('0x8')](_0x4206('0xc'),auth[_0x4206('0xb')](),controller['show']);router[_0x4206('0xd')]('/',auth[_0x4206('0xb')](),controller[_0x4206('0xe')]);router[_0x4206('0xf')](_0x4206('0xc'),auth[_0x4206('0xb')](),controller[_0x4206('0x10')]);router['delete'](_0x4206('0xc'),auth[_0x4206('0xb')](),controller['destroy']);module[_0x4206('0x11')]=router; \ No newline at end of file +var _0xc67f=['delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','/:id','show','create','put','update'];(function(_0x589a64,_0x3016a4){var _0x485164=function(_0x347a11){while(--_0x347a11){_0x589a64['push'](_0x589a64['shift']());}};_0x485164(++_0x3016a4);}(_0xc67f,0x6d));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfc67('0x0'));var util=require(_0xfc67('0x1'));var path=require('path');var timeout=require(_0xfc67('0x2'));var express=require(_0xfc67('0x3'));var router=express[_0xfc67('0x4')]();var fs_extra=require(_0xfc67('0x5'));var auth=require(_0xfc67('0x6'));var interaction=require(_0xfc67('0x7'));var config=require('../../config/environment');var controller=require(_0xfc67('0x8'));router['get']('/',auth[_0xfc67('0x9')](),controller[_0xfc67('0xa')]);router[_0xfc67('0xb')]('/describe',auth[_0xfc67('0x9')](),controller['describe']);router['get'](_0xfc67('0xc'),auth[_0xfc67('0x9')](),controller[_0xfc67('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfc67('0xe')]);router[_0xfc67('0xf')](_0xfc67('0xc'),auth['isAuthenticated'](),controller[_0xfc67('0x10')]);router[_0xfc67('0x11')](_0xfc67('0xc'),auth[_0xfc67('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e4d23f6..5e45157 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 _0x0a6b=['sequelize','STRING'];(function(_0x1664ad,_0x1bf6d3){var _0xd64515=function(_0x5382f5){while(--_0x5382f5){_0x1664ad['push'](_0x1664ad['shift']());}};_0xd64515(++_0x1bf6d3);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x555f58,_0x449260){_0x555f58=_0x555f58-0x0;var _0x38a126=_0x0a6b[_0x555f58];return _0x38a126;};'use strict';var Sequelize=require(_0xb0a6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb0a6('0x1')]}}; \ No newline at end of file +var _0xae30=['exports','STRING','sequelize'];(function(_0x4f081b,_0x3ee9cb){var _0x151075=function(_0x28803a){while(--_0x28803a){_0x4f081b['push'](_0x4f081b['shift']());}};_0x151075(++_0x3ee9cb);}(_0xae30,0x10a));var _0x0ae3=function(_0x501d0d,_0x38b758){_0x501d0d=_0x501d0d-0x0;var _0x37a8b8=_0xae30[_0x501d0d];return _0x37a8b8;};'use strict';var Sequelize=require(_0x0ae3('0x0'));module[_0x0ae3('0x1')]={'name':{'type':Sequelize[_0x0ae3('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0ae3('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a008230..2a9ef56 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 _0xb850=['body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','create'];(function(_0x51fd16,_0x197719){var _0x46f2ed=function(_0x420451){while(--_0x420451){_0x51fd16['push'](_0x51fd16['shift']());}};_0x46f2ed(++_0x197719);}(_0xb850,0x144));var _0x0b85=function(_0x58f363,_0x135c64){_0x58f363=_0x58f363-0x0;var _0xcb2c83=_0xb850[_0x58f363];return _0xcb2c83;};'use strict';var emlformat=require(_0x0b85('0x0'));var rimraf=require(_0x0b85('0x1'));var zipdir=require(_0x0b85('0x2'));var jsonpatch=require(_0x0b85('0x3'));var rp=require(_0x0b85('0x4'));var moment=require(_0x0b85('0x5'));var BPromise=require(_0x0b85('0x6'));var Mustache=require('mustache');var util=require(_0x0b85('0x7'));var path=require('path');var sox=require(_0x0b85('0x8'));var csv=require(_0x0b85('0x9'));var ejs=require(_0x0b85('0xa'));var fs=require('fs');var fs_extra=require(_0x0b85('0xb'));var _=require(_0x0b85('0xc'));var squel=require(_0x0b85('0xd'));var crypto=require(_0x0b85('0xe'));var jsforce=require(_0x0b85('0xf'));var deskjs=require(_0x0b85('0x10'));var toCsv=require(_0x0b85('0x9'));var querystring=require(_0x0b85('0x11'));var Papa=require(_0x0b85('0x12'));var Redis=require(_0x0b85('0x13'));var authService=require(_0x0b85('0x14'));var qs=require(_0x0b85('0x15'));var as=require(_0x0b85('0x16'));var hardwareService=require(_0x0b85('0x17'));var logger=require(_0x0b85('0x18'))(_0x0b85('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0b85('0x1a'));var db=require(_0x0b85('0x1b'))['db'];function respondWithStatusCode(_0x47dde3,_0xfbd4ac){_0xfbd4ac=_0xfbd4ac||0xcc;return function(_0x46cee7){if(_0x46cee7){return _0x47dde3['sendStatus'](_0xfbd4ac);}return _0x47dde3['status'](_0xfbd4ac)[_0x0b85('0x1c')]();};}function respondWithResult(_0x4749fa,_0x17170e){_0x17170e=_0x17170e||0xc8;return function(_0x2d590c){if(_0x2d590c){return _0x4749fa[_0x0b85('0x1d')](_0x17170e)[_0x0b85('0x1e')](_0x2d590c);}};}function respondWithFilteredResult(_0x9aae63,_0x289e5e){return function(_0x29cd57){if(_0x29cd57){var _0x2a19b5=typeof _0x289e5e[_0x0b85('0x1f')]===_0x0b85('0x20')&&typeof _0x289e5e[_0x0b85('0x21')]===_0x0b85('0x20');var _0x130a03=_0x29cd57[_0x0b85('0x22')];var _0x2fc83c=_0x2a19b5?0x0:_0x289e5e[_0x0b85('0x1f')];var _0x4a01ca=_0x2a19b5?_0x29cd57[_0x0b85('0x22')]:_0x289e5e['offset']+_0x289e5e['limit'];var _0x3352fc;if(_0x4a01ca>=_0x130a03){_0x4a01ca=_0x130a03;_0x3352fc=0xc8;}else{_0x3352fc=0xce;}_0x9aae63[_0x0b85('0x1d')](_0x3352fc);return _0x9aae63[_0x0b85('0x23')](_0x0b85('0x24'),_0x2fc83c+'-'+_0x4a01ca+'/'+_0x130a03)[_0x0b85('0x1e')](_0x29cd57);}return null;};}function patchUpdates(_0x41013f){return function(_0x4d553b){try{jsonpatch[_0x0b85('0x25')](_0x4d553b,_0x41013f,!![]);}catch(_0x25e486){return BPromise[_0x0b85('0x26')](_0x25e486);}return _0x4d553b[_0x0b85('0x27')]();};}function saveUpdates(_0x2668a6,_0x11b89b){return function(_0x43888d){if(_0x43888d){return _0x43888d[_0x0b85('0x28')](_0x2668a6)['then'](function(_0x3dd09a){return _0x3dd09a;});}return null;};}function removeEntity(_0x37b6df,_0xe2f6){return function(_0x4a4c25){if(_0x4a4c25){return _0x4a4c25['destroy']()[_0x0b85('0x29')](function(){_0x37b6df[_0x0b85('0x1d')](0xcc)[_0x0b85('0x1c')]();});}};}function handleEntityNotFound(_0x43b53d,_0xc5a1d9){return function(_0x23c28b){if(!_0x23c28b){_0x43b53d[_0x0b85('0x2a')](0x194);}return _0x23c28b;};}function handleError(_0x456f54,_0x21a4b9){_0x21a4b9=_0x21a4b9||0x1f4;return function(_0x35f0e7){logger[_0x0b85('0x2b')](_0x35f0e7[_0x0b85('0x2c')]);if(_0x35f0e7[_0x0b85('0x2d')]){delete _0x35f0e7['name'];}_0x456f54[_0x0b85('0x1d')](_0x21a4b9)['send'](_0x35f0e7);};}exports['index']=function(_0x4da0ab,_0x23579b){var _0xc956a2={},_0x2f4f81={},_0x1e5c62={'count':0x0,'rows':[]};var _0x2a251e=_[_0x0b85('0x2e')](db[_0x0b85('0x2f')][_0x0b85('0x30')],function(_0x1497e8){return{'name':_0x1497e8[_0x0b85('0x31')],'type':_0x1497e8[_0x0b85('0x32')][_0x0b85('0x33')]};});_0x2f4f81[_0x0b85('0x34')]=_[_0x0b85('0x2e')](_0x2a251e,_0x0b85('0x2d'));_0x2f4f81[_0x0b85('0x35')]=_['keys'](_0x4da0ab['query']);_0x2f4f81['filters']=_[_0x0b85('0x36')](_0x2f4f81[_0x0b85('0x34')],_0x2f4f81['query']);_0xc956a2[_0x0b85('0x37')]=_[_0x0b85('0x36')](_0x2f4f81['model'],qs[_0x0b85('0x38')](_0x4da0ab[_0x0b85('0x35')][_0x0b85('0x38')]));_0xc956a2['attributes']=_0xc956a2[_0x0b85('0x37')][_0x0b85('0x39')]?_0xc956a2['attributes']:_0x2f4f81[_0x0b85('0x34')];if(!_0x4da0ab[_0x0b85('0x35')][_0x0b85('0x3a')](_0x0b85('0x3b'))){_0xc956a2[_0x0b85('0x21')]=qs[_0x0b85('0x21')](_0x4da0ab[_0x0b85('0x35')][_0x0b85('0x21')]);_0xc956a2[_0x0b85('0x1f')]=qs[_0x0b85('0x1f')](_0x4da0ab[_0x0b85('0x35')][_0x0b85('0x1f')]);}_0xc956a2[_0x0b85('0x3c')]=qs['sort'](_0x4da0ab[_0x0b85('0x35')][_0x0b85('0x3d')]);_0xc956a2[_0x0b85('0x3e')]=qs[_0x0b85('0x3f')](_[_0x0b85('0x40')](_0x4da0ab[_0x0b85('0x35')],_0x2f4f81[_0x0b85('0x3f')]),_0x2a251e);if(_0x4da0ab[_0x0b85('0x35')][_0x0b85('0x41')]){_0xc956a2[_0x0b85('0x3e')]=_[_0x0b85('0x42')](_0xc956a2['where'],{'$or':_[_0x0b85('0x2e')](_0x2a251e,function(_0x4c9ea9){if(_0x4c9ea9[_0x0b85('0x32')]!=='VIRTUAL'){var _0x5bd71f={};_0x5bd71f[_0x4c9ea9[_0x0b85('0x2d')]]={'$like':'%'+_0x4da0ab[_0x0b85('0x35')][_0x0b85('0x41')]+'%'};return _0x5bd71f;}})});}_0xc956a2=_[_0x0b85('0x42')]({},_0xc956a2,_0x4da0ab[_0x0b85('0x43')]);var _0x43f042={'where':_0xc956a2[_0x0b85('0x3e')]};return db[_0x0b85('0x2f')]['count'](_0x43f042)[_0x0b85('0x29')](function(_0x3f99d7){_0x1e5c62[_0x0b85('0x22')]=_0x3f99d7;if(_0x4da0ab[_0x0b85('0x35')][_0x0b85('0x44')]){_0xc956a2[_0x0b85('0x45')]=[{'all':!![]}];}return db[_0x0b85('0x2f')][_0x0b85('0x46')](_0xc956a2);})[_0x0b85('0x29')](function(_0x343b4d){_0x1e5c62[_0x0b85('0x47')]=_0x343b4d;return _0x1e5c62;})['then'](respondWithFilteredResult(_0x23579b,_0xc956a2))[_0x0b85('0x48')](handleError(_0x23579b,null));};exports[_0x0b85('0x49')]=function(_0x50dedb,_0x3ead3f){var _0x4555ab={'raw':!![],'where':{'id':_0x50dedb['params']['id']}},_0x59b564={};_0x59b564[_0x0b85('0x34')]=_[_0x0b85('0x4a')](db[_0x0b85('0x2f')][_0x0b85('0x30')]);_0x59b564[_0x0b85('0x35')]=_['keys'](_0x50dedb[_0x0b85('0x35')]);_0x59b564[_0x0b85('0x3f')]=_[_0x0b85('0x36')](_0x59b564['model'],_0x59b564['query']);_0x4555ab[_0x0b85('0x37')]=_['intersection'](_0x59b564[_0x0b85('0x34')],qs[_0x0b85('0x38')](_0x50dedb[_0x0b85('0x35')]['fields']));_0x4555ab[_0x0b85('0x37')]=_0x4555ab[_0x0b85('0x37')][_0x0b85('0x39')]?_0x4555ab['attributes']:_0x59b564['model'];if(_0x50dedb[_0x0b85('0x35')]['includeAll']){_0x4555ab['include']=[{'all':!![]}];}_0x4555ab=_[_0x0b85('0x42')]({},_0x4555ab,_0x50dedb[_0x0b85('0x43')]);return db['MailSubstatus']['find'](_0x4555ab)[_0x0b85('0x29')](handleEntityNotFound(_0x3ead3f,null))[_0x0b85('0x29')](respondWithResult(_0x3ead3f,null))['catch'](handleError(_0x3ead3f,null));};exports[_0x0b85('0x4b')]=function(_0x52d2e1,_0xcec6eb){return db[_0x0b85('0x2f')][_0x0b85('0x4b')](_0x52d2e1[_0x0b85('0x4c')],{})[_0x0b85('0x29')](respondWithResult(_0xcec6eb,0xc9))[_0x0b85('0x48')](handleError(_0xcec6eb,null));};exports[_0x0b85('0x28')]=function(_0xd9ad0d,_0x59f383){if(_0xd9ad0d[_0x0b85('0x4c')]['id']){delete _0xd9ad0d['body']['id'];}return db['MailSubstatus'][_0x0b85('0x4d')]({'where':{'id':_0xd9ad0d['params']['id']}})[_0x0b85('0x29')](handleEntityNotFound(_0x59f383,null))[_0x0b85('0x29')](saveUpdates(_0xd9ad0d[_0x0b85('0x4c')],null))['then'](respondWithResult(_0x59f383,null))[_0x0b85('0x48')](handleError(_0x59f383,null));};exports[_0x0b85('0x4e')]=function(_0x4e9fa6,_0x665818){return db[_0x0b85('0x2f')][_0x0b85('0x4d')]({'where':{'id':_0x4e9fa6['params']['id']}})[_0x0b85('0x29')](handleEntityNotFound(_0x665818,null))[_0x0b85('0x29')](removeEntity(_0x665818,null))['catch'](handleError(_0x665818,null));};exports[_0x0b85('0x4f')]=function(_0x5847da,_0x19c9db){return db[_0x0b85('0x2f')]['describe']()['then'](respondWithResult(_0x19c9db,null))[_0x0b85('0x48')](handleError(_0x19c9db,null));}; \ No newline at end of file +var _0xd5f9=['map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','include','MailSubstatus','rows','catch','show','params','includeAll','find','body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','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','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','fieldName','type','key','model'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd5f9,0x13b));var _0x9d5f=function(_0x1ff329,_0x33e086){_0x1ff329=_0x1ff329-0x0;var _0x28501d=_0xd5f9[_0x1ff329];return _0x28501d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d5f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d5f('0x1'));var rp=require(_0x9d5f('0x2'));var moment=require(_0x9d5f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9d5f('0x4'));var path=require(_0x9d5f('0x5'));var sox=require('sox');var csv=require(_0x9d5f('0x6'));var ejs=require(_0x9d5f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d5f('0x8'));var squel=require('squel');var crypto=require(_0x9d5f('0x9'));var jsforce=require(_0x9d5f('0xa'));var deskjs=require(_0x9d5f('0xb'));var toCsv=require(_0x9d5f('0x6'));var querystring=require(_0x9d5f('0xc'));var Papa=require(_0x9d5f('0xd'));var Redis=require(_0x9d5f('0xe'));var authService=require(_0x9d5f('0xf'));var qs=require(_0x9d5f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d5f('0x11'));var logger=require(_0x9d5f('0x12'))(_0x9d5f('0x13'));var utils=require(_0x9d5f('0x14'));var config=require(_0x9d5f('0x15'));var licenseUtil=require(_0x9d5f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dea97,_0x430c07){_0x430c07=_0x430c07||0xcc;return function(_0x305d6e){if(_0x305d6e){return _0x5dea97[_0x9d5f('0x17')](_0x430c07);}return _0x5dea97[_0x9d5f('0x18')](_0x430c07)[_0x9d5f('0x19')]();};}function respondWithResult(_0x3270ee,_0x86df82){_0x86df82=_0x86df82||0xc8;return function(_0x574e97){if(_0x574e97){return _0x3270ee[_0x9d5f('0x18')](_0x86df82)[_0x9d5f('0x1a')](_0x574e97);}};}function respondWithFilteredResult(_0x4cfc95,_0x2b5b15){return function(_0x46164b){if(_0x46164b){var _0x29f6ec=typeof _0x2b5b15[_0x9d5f('0x1b')]===_0x9d5f('0x1c')&&typeof _0x2b5b15['limit']===_0x9d5f('0x1c');var _0x3ddba1=_0x46164b[_0x9d5f('0x1d')];var _0x4b042d=_0x29f6ec?0x0:_0x2b5b15[_0x9d5f('0x1b')];var _0xc5dcce=_0x29f6ec?_0x46164b['count']:_0x2b5b15[_0x9d5f('0x1b')]+_0x2b5b15[_0x9d5f('0x1e')];var _0x12a0fc;if(_0xc5dcce>=_0x3ddba1){_0xc5dcce=_0x3ddba1;_0x12a0fc=0xc8;}else{_0x12a0fc=0xce;}_0x4cfc95[_0x9d5f('0x18')](_0x12a0fc);return _0x4cfc95[_0x9d5f('0x1f')](_0x9d5f('0x20'),_0x4b042d+'-'+_0xc5dcce+'/'+_0x3ddba1)[_0x9d5f('0x1a')](_0x46164b);}return null;};}function patchUpdates(_0x24a1f4){return function(_0x405c27){try{jsonpatch[_0x9d5f('0x21')](_0x405c27,_0x24a1f4,!![]);}catch(_0x55ea7e){return BPromise[_0x9d5f('0x22')](_0x55ea7e);}return _0x405c27['save']();};}function saveUpdates(_0x12e1ef,_0x55c59f){return function(_0x5d9a71){if(_0x5d9a71){return _0x5d9a71[_0x9d5f('0x23')](_0x12e1ef)[_0x9d5f('0x24')](function(_0x2ac9b9){return _0x2ac9b9;});}return null;};}function removeEntity(_0x2da20c,_0x23cd4a){return function(_0x543349){if(_0x543349){return _0x543349['destroy']()[_0x9d5f('0x24')](function(){_0x2da20c[_0x9d5f('0x18')](0xcc)[_0x9d5f('0x19')]();});}};}function handleEntityNotFound(_0x20b873,_0x4db063){return function(_0x136379){if(!_0x136379){_0x20b873['sendStatus'](0x194);}return _0x136379;};}function handleError(_0x5e25d1,_0x50f59d){_0x50f59d=_0x50f59d||0x1f4;return function(_0x5a8287){logger['error'](_0x5a8287[_0x9d5f('0x25')]);if(_0x5a8287[_0x9d5f('0x26')]){delete _0x5a8287['name'];}_0x5e25d1['status'](_0x50f59d)[_0x9d5f('0x27')](_0x5a8287);};}exports[_0x9d5f('0x28')]=function(_0xa98831,_0x314937){var _0x10db3a={},_0x516b90={},_0x208a3f={'count':0x0,'rows':[]};var _0x4577ef=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x3182c9){return{'name':_0x3182c9[_0x9d5f('0x29')],'type':_0x3182c9[_0x9d5f('0x2a')][_0x9d5f('0x2b')]};});_0x516b90[_0x9d5f('0x2c')]=_[_0x9d5f('0x2d')](_0x4577ef,_0x9d5f('0x26'));_0x516b90[_0x9d5f('0x2e')]=_[_0x9d5f('0x2f')](_0xa98831[_0x9d5f('0x2e')]);_0x516b90['filters']=_[_0x9d5f('0x30')](_0x516b90[_0x9d5f('0x2c')],_0x516b90[_0x9d5f('0x2e')]);_0x10db3a[_0x9d5f('0x31')]=_[_0x9d5f('0x30')](_0x516b90['model'],qs[_0x9d5f('0x32')](_0xa98831[_0x9d5f('0x2e')][_0x9d5f('0x32')]));_0x10db3a[_0x9d5f('0x31')]=_0x10db3a[_0x9d5f('0x31')][_0x9d5f('0x33')]?_0x10db3a[_0x9d5f('0x31')]:_0x516b90[_0x9d5f('0x2c')];if(!_0xa98831[_0x9d5f('0x2e')]['hasOwnProperty'](_0x9d5f('0x34'))){_0x10db3a[_0x9d5f('0x1e')]=qs['limit'](_0xa98831['query'][_0x9d5f('0x1e')]);_0x10db3a[_0x9d5f('0x1b')]=qs['offset'](_0xa98831['query']['offset']);}_0x10db3a[_0x9d5f('0x35')]=qs['sort'](_0xa98831[_0x9d5f('0x2e')][_0x9d5f('0x36')]);_0x10db3a['where']=qs[_0x9d5f('0x37')](_[_0x9d5f('0x38')](_0xa98831[_0x9d5f('0x2e')],_0x516b90[_0x9d5f('0x37')]),_0x4577ef);if(_0xa98831[_0x9d5f('0x2e')][_0x9d5f('0x39')]){_0x10db3a[_0x9d5f('0x3a')]=_[_0x9d5f('0x3b')](_0x10db3a[_0x9d5f('0x3a')],{'$or':_['map'](_0x4577ef,function(_0x5d55a6){if(_0x5d55a6[_0x9d5f('0x2a')]!=='VIRTUAL'){var _0x1777b3={};_0x1777b3[_0x5d55a6['name']]={'$like':'%'+_0xa98831['query'][_0x9d5f('0x39')]+'%'};return _0x1777b3;}})});}_0x10db3a=_[_0x9d5f('0x3b')]({},_0x10db3a,_0xa98831[_0x9d5f('0x3c')]);var _0x7d3126={'where':_0x10db3a[_0x9d5f('0x3a')]};return db['MailSubstatus'][_0x9d5f('0x1d')](_0x7d3126)[_0x9d5f('0x24')](function(_0x43edeb){_0x208a3f[_0x9d5f('0x1d')]=_0x43edeb;if(_0xa98831[_0x9d5f('0x2e')]['includeAll']){_0x10db3a[_0x9d5f('0x3d')]=[{'all':!![]}];}return db[_0x9d5f('0x3e')]['findAll'](_0x10db3a);})[_0x9d5f('0x24')](function(_0x114007){_0x208a3f[_0x9d5f('0x3f')]=_0x114007;return _0x208a3f;})[_0x9d5f('0x24')](respondWithFilteredResult(_0x314937,_0x10db3a))[_0x9d5f('0x40')](handleError(_0x314937,null));};exports[_0x9d5f('0x41')]=function(_0x595922,_0x5f2342){var _0x1df87d={'raw':!![],'where':{'id':_0x595922[_0x9d5f('0x42')]['id']}},_0x12bb22={};_0x12bb22[_0x9d5f('0x2c')]=_[_0x9d5f('0x2f')](db[_0x9d5f('0x3e')]['rawAttributes']);_0x12bb22[_0x9d5f('0x2e')]=_[_0x9d5f('0x2f')](_0x595922[_0x9d5f('0x2e')]);_0x12bb22['filters']=_[_0x9d5f('0x30')](_0x12bb22['model'],_0x12bb22[_0x9d5f('0x2e')]);_0x1df87d[_0x9d5f('0x31')]=_[_0x9d5f('0x30')](_0x12bb22['model'],qs['fields'](_0x595922[_0x9d5f('0x2e')]['fields']));_0x1df87d[_0x9d5f('0x31')]=_0x1df87d[_0x9d5f('0x31')][_0x9d5f('0x33')]?_0x1df87d[_0x9d5f('0x31')]:_0x12bb22[_0x9d5f('0x2c')];if(_0x595922[_0x9d5f('0x2e')][_0x9d5f('0x43')]){_0x1df87d['include']=[{'all':!![]}];}_0x1df87d=_[_0x9d5f('0x3b')]({},_0x1df87d,_0x595922[_0x9d5f('0x3c')]);return db[_0x9d5f('0x3e')][_0x9d5f('0x44')](_0x1df87d)[_0x9d5f('0x24')](handleEntityNotFound(_0x5f2342,null))['then'](respondWithResult(_0x5f2342,null))[_0x9d5f('0x40')](handleError(_0x5f2342,null));};exports['create']=function(_0x100174,_0x83c76c){return db['MailSubstatus']['create'](_0x100174['body'],{})[_0x9d5f('0x24')](respondWithResult(_0x83c76c,0xc9))[_0x9d5f('0x40')](handleError(_0x83c76c,null));};exports[_0x9d5f('0x23')]=function(_0x1503c4,_0x358fed){if(_0x1503c4[_0x9d5f('0x45')]['id']){delete _0x1503c4['body']['id'];}return db['MailSubstatus'][_0x9d5f('0x44')]({'where':{'id':_0x1503c4['params']['id']}})[_0x9d5f('0x24')](handleEntityNotFound(_0x358fed,null))[_0x9d5f('0x24')](saveUpdates(_0x1503c4[_0x9d5f('0x45')],null))['then'](respondWithResult(_0x358fed,null))[_0x9d5f('0x40')](handleError(_0x358fed,null));};exports[_0x9d5f('0x46')]=function(_0x58195d,_0x277ce6){return db[_0x9d5f('0x3e')][_0x9d5f('0x44')]({'where':{'id':_0x58195d[_0x9d5f('0x42')]['id']}})['then'](handleEntityNotFound(_0x277ce6,null))[_0x9d5f('0x24')](removeEntity(_0x277ce6,null))['catch'](handleError(_0x277ce6,null));};exports['describe']=function(_0x2fdf26,_0x3c8a8c){return db[_0x9d5f('0x3e')][_0x9d5f('0x47')]()['then'](respondWithResult(_0x3c8a8c,null))['catch'](handleError(_0x3c8a8c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index a13dfc1..15f70f5 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 _0x2430=['events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hook'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x2430,0x17a));var _0x0243=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0x2430[_0x56b138];return _0x3df878;};'use strict';var EventEmitter=require(_0x0243('0x0'));var MailSubstatus=require(_0x0243('0x1'))['db'][_0x0243('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0243('0x3')](0x0);var events={'afterUpdate':_0x0243('0x4')};function emitEvent(_0x5184b7){return function(_0x56b085,_0x44bea5,_0x32bb55){MailSubstatusEvents['emit'](_0x5184b7+':'+_0x56b085['id'],_0x56b085);MailSubstatusEvents[_0x0243('0x5')](_0x5184b7,_0x56b085);_0x32bb55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x0243('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x1060=['emit','hasOwnProperty','hook','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x392512,_0x24c175){var _0x240ea3=function(_0x2ea057){while(--_0x2ea057){_0x392512['push'](_0x392512['shift']());}};_0x240ea3(++_0x24c175);}(_0x1060,0x123));var _0x0106=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x1060[_0x5d2803];return _0xdcad2c;};'use strict';var EventEmitter=require(_0x0106('0x0'));var MailSubstatus=require(_0x0106('0x1'))['db'][_0x0106('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0106('0x3')](0x0);var events={'afterUpdate':_0x0106('0x4')};function emitEvent(_0xa25e7a){return function(_0x159ab5,_0x5c81d4,_0xaad245){MailSubstatusEvents[_0x0106('0x5')](_0xa25e7a+':'+_0x159ab5['id'],_0x159ab5);MailSubstatusEvents['emit'](_0xa25e7a,_0x159ab5);_0xaad245(null);};}for(var e in events){if(events[_0x0106('0x6')](e)){var event=events[e];MailSubstatus[_0x0106('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d655a02..05ec266 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 _0x95f1=['update','name','then','./mailSubstatus.attributes','exports','models','define','MailSubstatus','Condition'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x95f1,0x1b3));var _0x195f=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x95f1[_0x710815];return _0x5b3b89;};'use strict';var attributes=require(_0x195f('0x0'));module[_0x195f('0x1')]=function(_0x34109c){var _0x28844a=_0x34109c[_0x195f('0x2')];return _0x34109c[_0x195f('0x3')](_0x195f('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4906a2,_0x1f8fbe,_0x3bf15a){return _0x28844a[_0x195f('0x5')][_0x195f('0x6')]({'value':_0x4906a2[_0x195f('0x7')]},{'where':{'field':'mailSubstatus','value':_0x4906a2['_previousDataValues'][_0x195f('0x7')]}})[_0x195f('0x8')](function(){_0x3bf15a();})['catch'](function(_0x19a532){_0x3bf15a(_0x19a532);});}}});}; \ No newline at end of file +var _0xc35d=['./mailSubstatus.attributes','models','define','mail_substatuses','Condition','update','name','then'];(function(_0x3f2111,_0x345028){var _0x3258f7=function(_0x21178b){while(--_0x21178b){_0x3f2111['push'](_0x3f2111['shift']());}};_0x3258f7(++_0x345028);}(_0xc35d,0xd0));var _0xdc35=function(_0x2085b4,_0x3368a7){_0x2085b4=_0x2085b4-0x0;var _0x130563=_0xc35d[_0x2085b4];return _0x130563;};'use strict';var attributes=require(_0xdc35('0x0'));module['exports']=function(_0x1fd70e){var _0x4c21ca=_0x1fd70e[_0xdc35('0x1')];return _0x1fd70e[_0xdc35('0x2')]('MailSubstatus',attributes,{'tableName':_0xdc35('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4abfdd,_0xd687d6,_0x43745c){return _0x4c21ca[_0xdc35('0x4')][_0xdc35('0x5')]({'value':_0x4abfdd['name']},{'where':{'field':'mailSubstatus','value':_0x4abfdd['_previousDataValues'][_0xdc35('0x6')]}})[_0xdc35('0x7')](function(){_0x43745c();})['catch'](function(_0x3409fc){_0x43745c(_0x3409fc);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4e4986f..99b1a66 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 _0x7596=['catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3682af,_0x4d7012){var _0x3fbe49=function(_0x5d558f){while(--_0x5d558f){_0x3682af['push'](_0x3682af['shift']());}};_0x3fbe49(++_0x4d7012);}(_0x7596,0xa2));var _0x6759=function(_0x1be584,_0xcb595){_0x1be584=_0x1be584-0x0;var _0x5c60d2=_0x7596[_0x1be584];return _0x5c60d2;};'use strict';var _=require(_0x6759('0x0'));var util=require(_0x6759('0x1'));var moment=require(_0x6759('0x2'));var BPromise=require(_0x6759('0x3'));var rs=require(_0x6759('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6759('0x5'));var logger=require(_0x6759('0x6'))(_0x6759('0x7'));var config=require(_0x6759('0x8'));var jayson=require(_0x6759('0x9'));var client=jayson[_0x6759('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b51f4,_0x1f48d7,_0x5780ee){return new BPromise(function(_0x1d7e85,_0x4a789c){return client[_0x6759('0xb')](_0x4b51f4,_0x5780ee)[_0x6759('0xc')](function(_0x248531){logger[_0x6759('0xd')](_0x6759('0xe'),_0x1f48d7,'request\x20sent');logger[_0x6759('0xf')](_0x6759('0x10'),_0x1f48d7,_0x6759('0x11'),JSON[_0x6759('0x12')](_0x248531));if(_0x248531[_0x6759('0x13')]){if(_0x248531[_0x6759('0x13')][_0x6759('0x14')]===0x1f4){logger[_0x6759('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x1f48d7,_0x248531[_0x6759('0x13')][_0x6759('0x15')]);return _0x4a789c(_0x248531[_0x6759('0x13')][_0x6759('0x15')]);}logger[_0x6759('0x13')](_0x6759('0xe'),_0x1f48d7,_0x248531[_0x6759('0x13')][_0x6759('0x15')]);return _0x1d7e85(_0x248531[_0x6759('0x13')][_0x6759('0x15')]);}else{logger[_0x6759('0xd')](_0x6759('0xe'),_0x1f48d7,_0x6759('0x11'));_0x1d7e85(_0x248531['result'][_0x6759('0x15')]);}})[_0x6759('0x16')](function(_0xc5e7db){logger[_0x6759('0x13')](_0x6759('0xe'),_0x1f48d7,_0xc5e7db);_0x4a789c(_0xc5e7db);});});} \ No newline at end of file +var _0xd252=['request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3d15c3,_0x4e2751){var _0xb65746=function(_0x2c7f95){while(--_0x2c7f95){_0x3d15c3['push'](_0x3d15c3['shift']());}};_0xb65746(++_0x4e2751);}(_0xd252,0xb3));var _0x2d25=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xd252[_0x427352];return _0x23e0e6;};'use strict';var _=require(_0x2d25('0x0'));var util=require(_0x2d25('0x1'));var moment=require(_0x2d25('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d25('0x3'));var fs=require('fs');var Redis=require(_0x2d25('0x4'));var db=require(_0x2d25('0x5'))['db'];var utils=require(_0x2d25('0x6'));var logger=require(_0x2d25('0x7'))(_0x2d25('0x8'));var config=require(_0x2d25('0x9'));var jayson=require(_0x2d25('0xa'));var client=jayson[_0x2d25('0xb')][_0x2d25('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ef7e0,_0xe47e7,_0x78f4e8){return new BPromise(function(_0xb91137,_0x1c49c4){return client[_0x2d25('0xd')](_0x4ef7e0,_0x78f4e8)[_0x2d25('0xe')](function(_0x10852b){logger[_0x2d25('0xf')](_0x2d25('0x10'),_0xe47e7,_0x2d25('0x11'));logger[_0x2d25('0x12')](_0x2d25('0x13'),_0xe47e7,_0x2d25('0x11'),JSON['stringify'](_0x10852b));if(_0x10852b[_0x2d25('0x14')]){if(_0x10852b[_0x2d25('0x14')]['code']===0x1f4){logger[_0x2d25('0x14')]('MailSubstatus,\x20%s,\x20%s',_0xe47e7,_0x10852b['error'][_0x2d25('0x15')]);return _0x1c49c4(_0x10852b[_0x2d25('0x14')][_0x2d25('0x15')]);}logger[_0x2d25('0x14')](_0x2d25('0x10'),_0xe47e7,_0x10852b['error'][_0x2d25('0x15')]);return _0xb91137(_0x10852b[_0x2d25('0x14')][_0x2d25('0x15')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0xe47e7,_0x2d25('0x11'));_0xb91137(_0x10852b[_0x2d25('0x16')][_0x2d25('0x15')]);}})[_0x2d25('0x17')](function(_0x20ff3a){logger['error'](_0x2d25('0x10'),_0xe47e7,_0x20ff3a);_0x1c49c4(_0x20ff3a);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 5f8077c..0d09f87 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 _0x0c26=['Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0x0c26,0x64));var _0x60c2=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x0c26[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x60c2('0x0'));var util=require(_0x60c2('0x1'));var path=require(_0x60c2('0x2'));var timeout=require(_0x60c2('0x3'));var express=require(_0x60c2('0x4'));var router=express[_0x60c2('0x5')]();var fs_extra=require(_0x60c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x60c2('0x7'));var config=require(_0x60c2('0x8'));var controller=require(_0x60c2('0x9'));router[_0x60c2('0xa')]('/',auth[_0x60c2('0xb')](),controller[_0x60c2('0xc')]);router['get']('/describe',auth[_0x60c2('0xb')](),controller[_0x60c2('0xd')]);router[_0x60c2('0xa')](_0x60c2('0xe'),auth['isAuthenticated'](),controller[_0x60c2('0xf')]);router['post']('/',auth[_0x60c2('0xb')](),controller[_0x60c2('0x10')]);router[_0x60c2('0x11')](_0x60c2('0xe'),auth[_0x60c2('0xb')](),controller[_0x60c2('0x12')]);router[_0x60c2('0x13')](_0x60c2('0xe'),auth[_0x60c2('0xb')](),controller[_0x60c2('0x14')]);module['exports']=router; \ No newline at end of file +var _0x785d=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','describe','isAuthenticated','show','post','create','put'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x785d,0x1e4));var _0xd785=function(_0x43fa71,_0x3d0802){_0x43fa71=_0x43fa71-0x0;var _0x85379f=_0x785d[_0x43fa71];return _0x85379f;};'use strict';var multer=require(_0xd785('0x0'));var util=require('util');var path=require(_0xd785('0x1'));var timeout=require(_0xd785('0x2'));var express=require(_0xd785('0x3'));var router=express[_0xd785('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd785('0x5'));var interaction=require(_0xd785('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xd785('0x7')]('/',auth['isAuthenticated'](),controller[_0xd785('0x8')]);router[_0xd785('0x7')](_0xd785('0x9'),auth['isAuthenticated'](),controller[_0xd785('0xa')]);router[_0xd785('0x7')]('/:id',auth[_0xd785('0xb')](),controller[_0xd785('0xc')]);router[_0xd785('0xd')]('/',auth[_0xd785('0xb')](),controller[_0xd785('0xe')]);router[_0xd785('0xf')]('/:id',auth[_0xd785('0xb')](),controller[_0xd785('0x10')]);router[_0xd785('0x11')]('/:id',auth[_0xd785('0xb')](),controller[_0xd785('0x12')]);module[_0xd785('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 3e75eb6..c09bf96 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xb43b,0x1b2));var _0xbb43=function(_0x12df67,_0x1fd19f){_0x12df67=_0x12df67-0x0;var _0x40cd6a=_0xb43b[_0x12df67];return _0x40cd6a;};'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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x25a016,_0x32ebeb){var _0x26a6e0=function(_0x4d54e2){while(--_0x4d54e2){_0x25a016['push'](_0x25a016['shift']());}};_0x26a6e0(++_0x32ebeb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0xcb91[_0x1f27df];return _0x286ee2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 53c3240..618c526 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 _0x167f=['filter','merge','VIRTUAL','include','MailTransferReport','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','status','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','sort','where','pick'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0x167f,0x1ec));var _0xf167=function(_0x586c70,_0x4a8cb3){_0x586c70=_0x586c70-0x0;var _0x26db79=_0x167f[_0x586c70];return _0x26db79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf167('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf167('0x1'));var rp=require(_0xf167('0x2'));var moment=require(_0xf167('0x3'));var BPromise=require(_0xf167('0x4'));var Mustache=require(_0xf167('0x5'));var util=require(_0xf167('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf167('0x7'));var ejs=require(_0xf167('0x8'));var fs=require('fs');var fs_extra=require(_0xf167('0x9'));var _=require(_0xf167('0xa'));var squel=require(_0xf167('0xb'));var crypto=require(_0xf167('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf167('0xd'));var toCsv=require(_0xf167('0x7'));var querystring=require(_0xf167('0xe'));var Papa=require(_0xf167('0xf'));var Redis=require(_0xf167('0x10'));var authService=require(_0xf167('0x11'));var qs=require(_0xf167('0x12'));var as=require(_0xf167('0x13'));var hardwareService=require(_0xf167('0x14'));var logger=require(_0xf167('0x15'))(_0xf167('0x16'));var utils=require(_0xf167('0x17'));var config=require(_0xf167('0x18'));var licenseUtil=require(_0xf167('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa4b02c,_0x4ec570){_0x4ec570=_0x4ec570||0xcc;return function(_0x8aa697){if(_0x8aa697){return _0xa4b02c[_0xf167('0x1a')](_0x4ec570);}return _0xa4b02c['status'](_0x4ec570)[_0xf167('0x1b')]();};}function respondWithResult(_0x2b6e0b,_0x40ad6c){_0x40ad6c=_0x40ad6c||0xc8;return function(_0x44b464){if(_0x44b464){return _0x2b6e0b['status'](_0x40ad6c)[_0xf167('0x1c')](_0x44b464);}};}function respondWithFilteredResult(_0x64e95e,_0x3c8eea){return function(_0xf67b5){if(_0xf67b5){var _0x11bcea=typeof _0x3c8eea[_0xf167('0x1d')]===_0xf167('0x1e')&&typeof _0x3c8eea[_0xf167('0x1f')]==='undefined';var _0x1d8c7e=_0xf67b5[_0xf167('0x20')];var _0x199e2c=_0x11bcea?0x0:_0x3c8eea[_0xf167('0x1d')];var _0x4a62e6=_0x11bcea?_0xf67b5[_0xf167('0x20')]:_0x3c8eea[_0xf167('0x1d')]+_0x3c8eea['limit'];var _0x1e1c96;if(_0x4a62e6>=_0x1d8c7e){_0x4a62e6=_0x1d8c7e;_0x1e1c96=0xc8;}else{_0x1e1c96=0xce;}_0x64e95e['status'](_0x1e1c96);return _0x64e95e[_0xf167('0x21')](_0xf167('0x22'),_0x199e2c+'-'+_0x4a62e6+'/'+_0x1d8c7e)[_0xf167('0x1c')](_0xf67b5);}return null;};}function patchUpdates(_0x18a5bb){return function(_0x4511c2){try{jsonpatch[_0xf167('0x23')](_0x4511c2,_0x18a5bb,!![]);}catch(_0x39c17f){return BPromise[_0xf167('0x24')](_0x39c17f);}return _0x4511c2[_0xf167('0x25')]();};}function saveUpdates(_0x5b5f8c,_0x13508c){return function(_0x51a0c6){if(_0x51a0c6){return _0x51a0c6['update'](_0x5b5f8c)[_0xf167('0x26')](function(_0x51663b){return _0x51663b;});}return null;};}function removeEntity(_0x4ecbc3,_0x44029b){return function(_0x16133e){if(_0x16133e){return _0x16133e['destroy']()[_0xf167('0x26')](function(){_0x4ecbc3[_0xf167('0x27')](0xcc)[_0xf167('0x1b')]();});}};}function handleEntityNotFound(_0x2fc321,_0x55c97f){return function(_0x4c1b8d){if(!_0x4c1b8d){_0x2fc321[_0xf167('0x1a')](0x194);}return _0x4c1b8d;};}function handleError(_0x50a48a,_0x2dedf0){_0x2dedf0=_0x2dedf0||0x1f4;return function(_0x24eba5){logger[_0xf167('0x28')](_0x24eba5[_0xf167('0x29')]);if(_0x24eba5[_0xf167('0x2a')]){delete _0x24eba5['name'];}_0x50a48a[_0xf167('0x27')](_0x2dedf0)[_0xf167('0x2b')](_0x24eba5);};}exports[_0xf167('0x2c')]=function(_0x130f80,_0x581e02){var _0x56d633={},_0x10bbea={},_0x3f1410={'count':0x0,'rows':[]};var _0x46f1a1=_[_0xf167('0x2d')](db['MailTransferReport'][_0xf167('0x2e')],function(_0x1ae833){return{'name':_0x1ae833[_0xf167('0x2f')],'type':_0x1ae833[_0xf167('0x30')][_0xf167('0x31')]};});_0x10bbea['model']=_[_0xf167('0x2d')](_0x46f1a1,_0xf167('0x2a'));_0x10bbea[_0xf167('0x32')]=_[_0xf167('0x33')](_0x130f80[_0xf167('0x32')]);_0x10bbea[_0xf167('0x34')]=_[_0xf167('0x35')](_0x10bbea['model'],_0x10bbea[_0xf167('0x32')]);_0x56d633[_0xf167('0x36')]=_['intersection'](_0x10bbea[_0xf167('0x37')],qs[_0xf167('0x38')](_0x130f80[_0xf167('0x32')][_0xf167('0x38')]));_0x56d633[_0xf167('0x36')]=_0x56d633[_0xf167('0x36')][_0xf167('0x39')]?_0x56d633[_0xf167('0x36')]:_0x10bbea[_0xf167('0x37')];if(!_0x130f80[_0xf167('0x32')]['hasOwnProperty']('nolimit')){_0x56d633[_0xf167('0x1f')]=qs[_0xf167('0x1f')](_0x130f80['query'][_0xf167('0x1f')]);_0x56d633[_0xf167('0x1d')]=qs['offset'](_0x130f80[_0xf167('0x32')][_0xf167('0x1d')]);}_0x56d633['order']=qs[_0xf167('0x3a')](_0x130f80[_0xf167('0x32')][_0xf167('0x3a')]);_0x56d633[_0xf167('0x3b')]=qs[_0xf167('0x34')](_[_0xf167('0x3c')](_0x130f80['query'],_0x10bbea[_0xf167('0x34')]),_0x46f1a1);if(_0x130f80['query'][_0xf167('0x3d')]){_0x56d633['where']=_[_0xf167('0x3e')](_0x56d633[_0xf167('0x3b')],{'$or':_[_0xf167('0x2d')](_0x46f1a1,function(_0x345550){if(_0x345550[_0xf167('0x30')]!==_0xf167('0x3f')){var _0x4acb11={};_0x4acb11[_0x345550[_0xf167('0x2a')]]={'$like':'%'+_0x130f80[_0xf167('0x32')][_0xf167('0x3d')]+'%'};return _0x4acb11;}})});}_0x56d633=_[_0xf167('0x3e')]({},_0x56d633,_0x130f80['options']);var _0x4719b5={'where':_0x56d633[_0xf167('0x3b')]};return db['MailTransferReport'][_0xf167('0x20')](_0x4719b5)[_0xf167('0x26')](function(_0x460863){_0x3f1410[_0xf167('0x20')]=_0x460863;if(_0x130f80[_0xf167('0x32')]['includeAll']){_0x56d633[_0xf167('0x40')]=[{'all':!![]}];}return db[_0xf167('0x41')][_0xf167('0x42')](_0x56d633);})['then'](function(_0x57b021){_0x3f1410[_0xf167('0x43')]=_0x57b021;return _0x3f1410;})[_0xf167('0x26')](respondWithFilteredResult(_0x581e02,_0x56d633))[_0xf167('0x44')](handleError(_0x581e02,null));};exports[_0xf167('0x45')]=function(_0xd6bb46,_0x2b3315){var _0x554e85={'raw':!![],'where':{'id':_0xd6bb46[_0xf167('0x46')]['id']}},_0x464c62={};_0x464c62[_0xf167('0x37')]=_['keys'](db[_0xf167('0x41')][_0xf167('0x2e')]);_0x464c62['query']=_['keys'](_0xd6bb46['query']);_0x464c62[_0xf167('0x34')]=_[_0xf167('0x35')](_0x464c62[_0xf167('0x37')],_0x464c62[_0xf167('0x32')]);_0x554e85[_0xf167('0x36')]=_['intersection'](_0x464c62[_0xf167('0x37')],qs[_0xf167('0x38')](_0xd6bb46[_0xf167('0x32')]['fields']));_0x554e85['attributes']=_0x554e85[_0xf167('0x36')]['length']?_0x554e85[_0xf167('0x36')]:_0x464c62['model'];if(_0xd6bb46[_0xf167('0x32')][_0xf167('0x47')]){_0x554e85[_0xf167('0x40')]=[{'all':!![]}];}_0x554e85=_[_0xf167('0x3e')]({},_0x554e85,_0xd6bb46[_0xf167('0x48')]);return db['MailTransferReport'][_0xf167('0x49')](_0x554e85)[_0xf167('0x26')](handleEntityNotFound(_0x2b3315,null))['then'](respondWithResult(_0x2b3315,null))[_0xf167('0x44')](handleError(_0x2b3315,null));};exports[_0xf167('0x4a')]=function(_0x36f2af,_0x95de1f){return db[_0xf167('0x41')][_0xf167('0x4a')](_0x36f2af[_0xf167('0x4b')],{})[_0xf167('0x26')](respondWithResult(_0x95de1f,0xc9))[_0xf167('0x44')](handleError(_0x95de1f,null));};exports[_0xf167('0x4c')]=function(_0x391723,_0x160df1){if(_0x391723[_0xf167('0x4b')]['id']){delete _0x391723['body']['id'];}return db[_0xf167('0x41')][_0xf167('0x49')]({'where':{'id':_0x391723['params']['id']}})[_0xf167('0x26')](handleEntityNotFound(_0x160df1,null))[_0xf167('0x26')](saveUpdates(_0x391723[_0xf167('0x4b')],null))['then'](respondWithResult(_0x160df1,null))['catch'](handleError(_0x160df1,null));};exports[_0xf167('0x4d')]=function(_0x39b7d2,_0x2ab94a){return db[_0xf167('0x41')][_0xf167('0x49')]({'where':{'id':_0x39b7d2[_0xf167('0x46')]['id']}})[_0xf167('0x26')](handleEntityNotFound(_0x2ab94a,null))['then'](removeEntity(_0x2ab94a,null))[_0xf167('0x44')](handleError(_0x2ab94a,null));};exports['describe']=function(_0x68cd3b,_0x1e1f5c){return db[_0xf167('0x41')][_0xf167('0x4e')]()[_0xf167('0x26')](respondWithResult(_0x1e1f5c,null))['catch'](handleError(_0x1e1f5c,null));}; \ No newline at end of file +var _0x7790=['body','params','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','rows','find','catch','create','update'];(function(_0x299ff4,_0x1fe2f7){var _0x5564b5=function(_0x441381){while(--_0x441381){_0x299ff4['push'](_0x299ff4['shift']());}};_0x5564b5(++_0x1fe2f7);}(_0x7790,0xa4));var _0x0779=function(_0x24171e,_0x55421d){_0x24171e=_0x24171e-0x0;var _0x139d54=_0x7790[_0x24171e];return _0x139d54;};'use strict';var emlformat=require(_0x0779('0x0'));var rimraf=require(_0x0779('0x1'));var zipdir=require(_0x0779('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0779('0x3'));var BPromise=require(_0x0779('0x4'));var Mustache=require(_0x0779('0x5'));var util=require(_0x0779('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0779('0x7'));var ejs=require(_0x0779('0x8'));var fs=require('fs');var fs_extra=require(_0x0779('0x9'));var _=require(_0x0779('0xa'));var squel=require(_0x0779('0xb'));var crypto=require(_0x0779('0xc'));var jsforce=require(_0x0779('0xd'));var deskjs=require(_0x0779('0xe'));var toCsv=require(_0x0779('0x7'));var querystring=require(_0x0779('0xf'));var Papa=require(_0x0779('0x10'));var Redis=require(_0x0779('0x11'));var authService=require(_0x0779('0x12'));var qs=require(_0x0779('0x13'));var as=require(_0x0779('0x14'));var hardwareService=require(_0x0779('0x15'));var logger=require(_0x0779('0x16'))(_0x0779('0x17'));var utils=require('../../config/utils');var config=require(_0x0779('0x18'));var licenseUtil=require(_0x0779('0x19'));var db=require(_0x0779('0x1a'))['db'];function respondWithStatusCode(_0x5d0743,_0x3afafc){_0x3afafc=_0x3afafc||0xcc;return function(_0x178088){if(_0x178088){return _0x5d0743['sendStatus'](_0x3afafc);}return _0x5d0743[_0x0779('0x1b')](_0x3afafc)[_0x0779('0x1c')]();};}function respondWithResult(_0x23095f,_0x375b5a){_0x375b5a=_0x375b5a||0xc8;return function(_0x33d50b){if(_0x33d50b){return _0x23095f[_0x0779('0x1b')](_0x375b5a)['json'](_0x33d50b);}};}function respondWithFilteredResult(_0x2fcbab,_0x179e0b){return function(_0x394872){if(_0x394872){var _0x2b1c83=typeof _0x179e0b[_0x0779('0x1d')]===_0x0779('0x1e')&&typeof _0x179e0b[_0x0779('0x1f')]===_0x0779('0x1e');var _0x37de2a=_0x394872[_0x0779('0x20')];var _0x59eb39=_0x2b1c83?0x0:_0x179e0b[_0x0779('0x1d')];var _0x3ecdb0=_0x2b1c83?_0x394872[_0x0779('0x20')]:_0x179e0b[_0x0779('0x1d')]+_0x179e0b[_0x0779('0x1f')];var _0x39c137;if(_0x3ecdb0>=_0x37de2a){_0x3ecdb0=_0x37de2a;_0x39c137=0xc8;}else{_0x39c137=0xce;}_0x2fcbab[_0x0779('0x1b')](_0x39c137);return _0x2fcbab[_0x0779('0x21')](_0x0779('0x22'),_0x59eb39+'-'+_0x3ecdb0+'/'+_0x37de2a)[_0x0779('0x23')](_0x394872);}return null;};}function patchUpdates(_0x495f4f){return function(_0x3385ce){try{jsonpatch[_0x0779('0x24')](_0x3385ce,_0x495f4f,!![]);}catch(_0x176ca8){return BPromise[_0x0779('0x25')](_0x176ca8);}return _0x3385ce[_0x0779('0x26')]();};}function saveUpdates(_0x2f9341,_0x917f34){return function(_0x1e5615){if(_0x1e5615){return _0x1e5615['update'](_0x2f9341)[_0x0779('0x27')](function(_0x53863c){return _0x53863c;});}return null;};}function removeEntity(_0x218288,_0x2a0a8a){return function(_0x51fe56){if(_0x51fe56){return _0x51fe56['destroy']()[_0x0779('0x27')](function(){_0x218288['status'](0xcc)[_0x0779('0x1c')]();});}};}function handleEntityNotFound(_0x178fd3,_0x112215){return function(_0xa157f){if(!_0xa157f){_0x178fd3[_0x0779('0x28')](0x194);}return _0xa157f;};}function handleError(_0x5b55eb,_0x4d1ee8){_0x4d1ee8=_0x4d1ee8||0x1f4;return function(_0x189162){logger[_0x0779('0x29')](_0x189162[_0x0779('0x2a')]);if(_0x189162['name']){delete _0x189162[_0x0779('0x2b')];}_0x5b55eb[_0x0779('0x1b')](_0x4d1ee8)['send'](_0x189162);};}exports[_0x0779('0x2c')]=function(_0x4fda1c,_0x55b0e7){var _0x240cb1={},_0x4c585={},_0x5ebf08={'count':0x0,'rows':[]};var _0x2ed307=_[_0x0779('0x2d')](db['MailTransferReport'][_0x0779('0x2e')],function(_0x29c4e9){return{'name':_0x29c4e9[_0x0779('0x2f')],'type':_0x29c4e9['type'][_0x0779('0x30')]};});_0x4c585[_0x0779('0x31')]=_[_0x0779('0x2d')](_0x2ed307,_0x0779('0x2b'));_0x4c585[_0x0779('0x32')]=_[_0x0779('0x33')](_0x4fda1c[_0x0779('0x32')]);_0x4c585[_0x0779('0x34')]=_[_0x0779('0x35')](_0x4c585[_0x0779('0x31')],_0x4c585[_0x0779('0x32')]);_0x240cb1[_0x0779('0x36')]=_[_0x0779('0x35')](_0x4c585[_0x0779('0x31')],qs[_0x0779('0x37')](_0x4fda1c[_0x0779('0x32')][_0x0779('0x37')]));_0x240cb1[_0x0779('0x36')]=_0x240cb1[_0x0779('0x36')][_0x0779('0x38')]?_0x240cb1[_0x0779('0x36')]:_0x4c585[_0x0779('0x31')];if(!_0x4fda1c[_0x0779('0x32')][_0x0779('0x39')](_0x0779('0x3a'))){_0x240cb1[_0x0779('0x1f')]=qs[_0x0779('0x1f')](_0x4fda1c[_0x0779('0x32')][_0x0779('0x1f')]);_0x240cb1[_0x0779('0x1d')]=qs['offset'](_0x4fda1c[_0x0779('0x32')][_0x0779('0x1d')]);}_0x240cb1[_0x0779('0x3b')]=qs['sort'](_0x4fda1c[_0x0779('0x32')][_0x0779('0x3c')]);_0x240cb1[_0x0779('0x3d')]=qs[_0x0779('0x34')](_['pick'](_0x4fda1c[_0x0779('0x32')],_0x4c585['filters']),_0x2ed307);if(_0x4fda1c[_0x0779('0x32')][_0x0779('0x3e')]){_0x240cb1[_0x0779('0x3d')]=_[_0x0779('0x3f')](_0x240cb1[_0x0779('0x3d')],{'$or':_[_0x0779('0x2d')](_0x2ed307,function(_0xfc5812){if(_0xfc5812[_0x0779('0x40')]!==_0x0779('0x41')){var _0x3858aa={};_0x3858aa[_0xfc5812[_0x0779('0x2b')]]={'$like':'%'+_0x4fda1c[_0x0779('0x32')][_0x0779('0x3e')]+'%'};return _0x3858aa;}})});}_0x240cb1=_[_0x0779('0x3f')]({},_0x240cb1,_0x4fda1c[_0x0779('0x42')]);var _0x5b9bdb={'where':_0x240cb1[_0x0779('0x3d')]};return db['MailTransferReport']['count'](_0x5b9bdb)[_0x0779('0x27')](function(_0xd39f2b){_0x5ebf08[_0x0779('0x20')]=_0xd39f2b;if(_0x4fda1c['query'][_0x0779('0x43')]){_0x240cb1[_0x0779('0x44')]=[{'all':!![]}];}return db[_0x0779('0x45')][_0x0779('0x46')](_0x240cb1);})[_0x0779('0x27')](function(_0x45c3e6){_0x5ebf08[_0x0779('0x47')]=_0x45c3e6;return _0x5ebf08;})[_0x0779('0x27')](respondWithFilteredResult(_0x55b0e7,_0x240cb1))['catch'](handleError(_0x55b0e7,null));};exports['show']=function(_0x540874,_0x4db133){var _0x3527b0={'raw':!![],'where':{'id':_0x540874['params']['id']}},_0x161723={};_0x161723[_0x0779('0x31')]=_['keys'](db[_0x0779('0x45')][_0x0779('0x2e')]);_0x161723[_0x0779('0x32')]=_[_0x0779('0x33')](_0x540874['query']);_0x161723[_0x0779('0x34')]=_['intersection'](_0x161723[_0x0779('0x31')],_0x161723['query']);_0x3527b0['attributes']=_[_0x0779('0x35')](_0x161723[_0x0779('0x31')],qs['fields'](_0x540874[_0x0779('0x32')]['fields']));_0x3527b0[_0x0779('0x36')]=_0x3527b0['attributes'][_0x0779('0x38')]?_0x3527b0['attributes']:_0x161723['model'];if(_0x540874['query'][_0x0779('0x43')]){_0x3527b0[_0x0779('0x44')]=[{'all':!![]}];}_0x3527b0=_['merge']({},_0x3527b0,_0x540874[_0x0779('0x42')]);return db[_0x0779('0x45')][_0x0779('0x48')](_0x3527b0)[_0x0779('0x27')](handleEntityNotFound(_0x4db133,null))[_0x0779('0x27')](respondWithResult(_0x4db133,null))[_0x0779('0x49')](handleError(_0x4db133,null));};exports[_0x0779('0x4a')]=function(_0x2eb9f4,_0x404f73){return db[_0x0779('0x45')][_0x0779('0x4a')](_0x2eb9f4['body'],{})[_0x0779('0x27')](respondWithResult(_0x404f73,0xc9))['catch'](handleError(_0x404f73,null));};exports[_0x0779('0x4b')]=function(_0x31ff54,_0x594865){if(_0x31ff54[_0x0779('0x4c')]['id']){delete _0x31ff54[_0x0779('0x4c')]['id'];}return db[_0x0779('0x45')][_0x0779('0x48')]({'where':{'id':_0x31ff54[_0x0779('0x4d')]['id']}})[_0x0779('0x27')](handleEntityNotFound(_0x594865,null))['then'](saveUpdates(_0x31ff54['body'],null))['then'](respondWithResult(_0x594865,null))[_0x0779('0x49')](handleError(_0x594865,null));};exports[_0x0779('0x4e')]=function(_0xdc7c6b,_0x1f7276){return db[_0x0779('0x45')]['find']({'where':{'id':_0xdc7c6b[_0x0779('0x4d')]['id']}})[_0x0779('0x27')](handleEntityNotFound(_0x1f7276,null))[_0x0779('0x27')](removeEntity(_0x1f7276,null))[_0x0779('0x49')](handleError(_0x1f7276,null));};exports[_0x0779('0x4f')]=function(_0x2ffa7e,_0x362e02){return db[_0x0779('0x45')][_0x0779('0x4f')]()[_0x0779('0x27')](respondWithResult(_0x362e02,null))[_0x0779('0x49')](handleError(_0x362e02,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 999290e..9fcd2df 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 _0xc1f1=['util','../../config/logger','moment','request-promise','rimraf','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x23f4d2,_0x448ace){var _0x1e9e36=function(_0x1010a1){while(--_0x1010a1){_0x23f4d2['push'](_0x23f4d2['shift']());}};_0x1e9e36(++_0x448ace);}(_0xc1f1,0x122));var _0x1c1f=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0xc1f1[_0x5a1a51];return _0x47edd7;};'use strict';var _=require('lodash');var util=require(_0x1c1f('0x0'));var logger=require(_0x1c1f('0x1'))('api');var moment=require(_0x1c1f('0x2'));var BPromise=require('bluebird');var rp=require(_0x1c1f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c1f('0x4'));var config=require('../../config/environment');var attributes=require(_0x1c1f('0x5'));module['exports']=function(_0x1940d7,_0x2d91a5){return _0x1940d7[_0x1c1f('0x6')](_0x1c1f('0x7'),attributes,{'tableName':_0x1c1f('0x8'),'paranoid':![],'indexes':[{'name':_0x1c1f('0x9'),'fields':[_0x1c1f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c96=['../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x6c96,0x1c1));var _0x66c9=function(_0x120856,_0x2b0c42){_0x120856=_0x120856-0x0;var _0xa3ab9f=_0x6c96[_0x120856];return _0xa3ab9f;};'use strict';var _=require(_0x66c9('0x0'));var util=require('util');var logger=require(_0x66c9('0x1'))(_0x66c9('0x2'));var moment=require('moment');var BPromise=require(_0x66c9('0x3'));var rp=require(_0x66c9('0x4'));var fs=require('fs');var path=require(_0x66c9('0x5'));var rimraf=require(_0x66c9('0x6'));var config=require(_0x66c9('0x7'));var attributes=require(_0x66c9('0x8'));module[_0x66c9('0x9')]=function(_0x55b24d,_0x1c8b59){return _0x55b24d['define'](_0x66c9('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x66c9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 90a751c..4d8776d 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 _0x9160=['bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util'];(function(_0x568ae7,_0x2b5fa3){var _0x257050=function(_0x43e8df){while(--_0x43e8df){_0x568ae7['push'](_0x568ae7['shift']());}};_0x257050(++_0x2b5fa3);}(_0x9160,0x18e));var _0x0916=function(_0x352bc4,_0xb2f793){_0x352bc4=_0x352bc4-0x0;var _0x24cf6c=_0x9160[_0x352bc4];return _0x24cf6c;};'use strict';var _=require(_0x0916('0x0'));var util=require(_0x0916('0x1'));var moment=require('moment');var BPromise=require(_0x0916('0x2'));var rs=require(_0x0916('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0916('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0916('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0916('0x6'));var client=jayson[_0x0916('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37e452,_0x1c43ec,_0x16098c){return new BPromise(function(_0x33a8cf,_0x87aeb1){return client[_0x0916('0x8')](_0x37e452,_0x16098c)[_0x0916('0x9')](function(_0x1b6f6a){logger['info'](_0x0916('0xa'),_0x1c43ec,_0x0916('0xb'));logger[_0x0916('0xc')](_0x0916('0xd'),_0x1c43ec,_0x0916('0xb'),JSON['stringify'](_0x1b6f6a));if(_0x1b6f6a[_0x0916('0xe')]){if(_0x1b6f6a[_0x0916('0xe')][_0x0916('0xf')]===0x1f4){logger[_0x0916('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1c43ec,_0x1b6f6a[_0x0916('0xe')]['message']);return _0x87aeb1(_0x1b6f6a['error'][_0x0916('0x10')]);}logger[_0x0916('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1c43ec,_0x1b6f6a['error'][_0x0916('0x10')]);return _0x33a8cf(_0x1b6f6a[_0x0916('0xe')][_0x0916('0x10')]);}else{logger[_0x0916('0x11')](_0x0916('0xa'),_0x1c43ec,_0x0916('0xb'));_0x33a8cf(_0x1b6f6a[_0x0916('0x12')][_0x0916('0x10')]);}})[_0x0916('0x13')](function(_0x59ec5f){logger[_0x0916('0xe')](_0x0916('0xa'),_0x1c43ec,_0x59ec5f);_0x87aeb1(_0x59ec5f);});});} \ No newline at end of file +var _0x50d1=['request\x20sent','debug','stringify','error','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','MailTransferReport,\x20%s,\x20%s'];(function(_0x50de90,_0x158e9f){var _0x141e90=function(_0x1ef6e7){while(--_0x1ef6e7){_0x50de90['push'](_0x50de90['shift']());}};_0x141e90(++_0x158e9f);}(_0x50d1,0x71));var _0x150d=function(_0x535581,_0x15d9cf){_0x535581=_0x535581-0x0;var _0x2bc1f0=_0x50d1[_0x535581];return _0x2bc1f0;};'use strict';var _=require(_0x150d('0x0'));var util=require('util');var moment=require(_0x150d('0x1'));var BPromise=require(_0x150d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x150d('0x3'));var db=require(_0x150d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x150d('0x5'))(_0x150d('0x6'));var config=require(_0x150d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x150d('0x8')][_0x150d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29fab1,_0x4619b2,_0x3c66d2){return new BPromise(function(_0x1fd0a0,_0x4ebc25){return client[_0x150d('0xa')](_0x29fab1,_0x3c66d2)[_0x150d('0xb')](function(_0x3dba8c){logger['info'](_0x150d('0xc'),_0x4619b2,_0x150d('0xd'));logger[_0x150d('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4619b2,_0x150d('0xd'),JSON[_0x150d('0xf')](_0x3dba8c));if(_0x3dba8c[_0x150d('0x10')]){if(_0x3dba8c[_0x150d('0x10')]['code']===0x1f4){logger[_0x150d('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x4619b2,_0x3dba8c[_0x150d('0x10')][_0x150d('0x11')]);return _0x4ebc25(_0x3dba8c['error'][_0x150d('0x11')]);}logger['error'](_0x150d('0xc'),_0x4619b2,_0x3dba8c['error'][_0x150d('0x11')]);return _0x1fd0a0(_0x3dba8c[_0x150d('0x10')][_0x150d('0x11')]);}else{logger[_0x150d('0x12')](_0x150d('0xc'),_0x4619b2,_0x150d('0xd'));_0x1fd0a0(_0x3dba8c[_0x150d('0x13')][_0x150d('0x11')]);}})[_0x150d('0x14')](function(_0x46ec71){logger[_0x150d('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x4619b2,_0x46ec71);_0x4ebc25(_0x46ec71);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 43a13d1..8955f54 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 _0xe7d1=['show','create','update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x541dcf,_0x4f77f9){var _0x47ada2=function(_0x3100ff){while(--_0x3100ff){_0x541dcf['push'](_0x541dcf['shift']());}};_0x47ada2(++_0x4f77f9);}(_0xe7d1,0x17f));var _0x1e7d=function(_0x2416e5,_0x50bb6f){_0x2416e5=_0x2416e5-0x0;var _0xcb802=_0xe7d1[_0x2416e5];return _0xcb802;};'use strict';var multer=require(_0x1e7d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e7d('0x1'));var router=express[_0x1e7d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1e7d('0x3'));var interaction=require(_0x1e7d('0x4'));var config=require(_0x1e7d('0x5'));var controller=require(_0x1e7d('0x6'));router[_0x1e7d('0x7')]('/',auth[_0x1e7d('0x8')](),controller[_0x1e7d('0x9')]);router['get'](_0x1e7d('0xa'),auth[_0x1e7d('0x8')](),controller[_0x1e7d('0xb')]);router['get'](_0x1e7d('0xc'),auth[_0x1e7d('0x8')](),controller[_0x1e7d('0xd')]);router['post']('/',auth[_0x1e7d('0x8')](),controller[_0x1e7d('0xe')]);router['put'](_0x1e7d('0xc'),auth[_0x1e7d('0x8')](),controller[_0x1e7d('0xf')]);router[_0x1e7d('0x10')](_0x1e7d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1e7d('0x11')]=router; \ No newline at end of file +var _0x40d1=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x107e01,_0xe901a9){var _0x43d6ca=function(_0x17abfe){while(--_0x17abfe){_0x107e01['push'](_0x107e01['shift']());}};_0x43d6ca(++_0xe901a9);}(_0x40d1,0xfe));var _0x140d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x40d1[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x140d('0x0'));var util=require(_0x140d('0x1'));var path=require('path');var timeout=require(_0x140d('0x2'));var express=require(_0x140d('0x3'));var router=express[_0x140d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x140d('0x5'));var config=require(_0x140d('0x6'));var controller=require(_0x140d('0x7'));router[_0x140d('0x8')]('/',auth[_0x140d('0x9')](),controller[_0x140d('0xa')]);router[_0x140d('0x8')]('/describe',auth[_0x140d('0x9')](),controller[_0x140d('0xb')]);router[_0x140d('0x8')](_0x140d('0xc'),auth[_0x140d('0x9')](),controller[_0x140d('0xd')]);router[_0x140d('0xe')]('/',auth[_0x140d('0x9')](),controller[_0x140d('0xf')]);router[_0x140d('0x10')](_0x140d('0xc'),auth['isAuthenticated'](),controller[_0x140d('0x11')]);router[_0x140d('0x12')](_0x140d('0xc'),auth['isAuthenticated'](),controller[_0x140d('0x13')]);module[_0x140d('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 2f42edd..b791a0e 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 _0x4a1b=['moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','talk:[destination]','talk:[dial\x20string]','talk:[queue]'];(function(_0x1eef14,_0x6521a5){var _0x447837=function(_0x3ffeb2){while(--_0x3ffeb2){_0x1eef14['push'](_0x1eef14['shift']());}};_0x447837(++_0x6521a5);}(_0x4a1b,0x68));var _0xb4a1=function(_0x1b2cf0,_0x3e1559){_0x1b2cf0=_0x1b2cf0-0x0;var _0x566935=_0x4a1b[_0x1b2cf0];return _0x566935;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb4a1('0x0'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb4a1('0x1')]},'interface':{'type':Sequelize[_0xb4a1('0x1')]},'type':{'type':Sequelize[_0xb4a1('0x1')],'defaultValue':_0xb4a1('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xb4a1('0x3')]},'enterAt':{'type':Sequelize[_0xb4a1('0x4')]},'exitAt':{'type':Sequelize[_0xb4a1('0x4')],'set':function(_0x315a73){var _0x4f7f9b=moment(_0x315a73);var _0x33a460=moment(this[_0xb4a1('0x5')]('enterAt'));var _0x2270bf=_0x4f7f9b[_0xb4a1('0x6')](_0x33a460,_0xb4a1('0x7'));this[_0xb4a1('0x8')](_0xb4a1('0x9'),_0x315a73);this['setDataValue']('duration',_0x2270bf>=0x0?_0x2270bf:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xb4a1('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xb4a1('0x1')],'comment':_0xb4a1('0xa')},'data4':{'type':Sequelize[_0xb4a1('0x1')],'comment':_0xb4a1('0xb')},'data5':{'type':Sequelize[_0xb4a1('0x1')],'comment':_0xb4a1('0xc')},'role':{'type':Sequelize[_0xb4a1('0x1')]},'internal':{'type':Sequelize[_0xb4a1('0x3')]},'uniqueid':{'type':Sequelize[_0xb4a1('0x1')]}}; \ No newline at end of file +var _0xbb6c=['getDataValue','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0xbb6c,0x1c8));var _0xcbb6=function(_0x18c6cd,_0x3d50d2){_0x18c6cd=_0x18c6cd-0x0;var _0x450f8b=_0xbb6c[_0x18c6cd];return _0x450f8b;};'use strict';var Sequelize=require(_0xcbb6('0x0'));var moment=require('moment');module[_0xcbb6('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xcbb6('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xcbb6('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xcbb6('0x4')]},'enterAt':{'type':Sequelize[_0xcbb6('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x56dcdc){var _0x1d8403=moment(_0x56dcdc);var _0xe33ba7=moment(this[_0xcbb6('0x6')]('enterAt'));var _0x437a86=_0x1d8403['diff'](_0xe33ba7,'seconds');this[_0xcbb6('0x7')](_0xcbb6('0x8'),_0x56dcdc);this['setDataValue'](_0xcbb6('0x9'),_0x437a86>=0x0?_0x437a86:null);}},'data1':{'type':Sequelize[_0xcbb6('0x2')],'comment':_0xcbb6('0xa')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xcbb6('0x2')],'comment':_0xcbb6('0xb')},'data4':{'type':Sequelize[_0xcbb6('0x2')],'comment':_0xcbb6('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0xcbb6('0xd')},'role':{'type':Sequelize[_0xcbb6('0x2')]},'internal':{'type':Sequelize[_0xcbb6('0x4')]},'uniqueid':{'type':Sequelize[_0xcbb6('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d23f877..1777120 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x28c8dc,_0x2c0ce4){var _0x30bc65=function(_0xbdbc8d){while(--_0xbdbc8d){_0x28c8dc['push'](_0x28c8dc['shift']());}};_0x30bc65(++_0x2c0ce4);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _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(_0x66325a,_0x424442){var _0x5cc9d2=function(_0x392ccf){while(--_0x392ccf){_0x66325a['push'](_0x66325a['shift']());}};_0x5cc9d2(++_0x424442);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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 cf6c81c..e8d0b1a 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 _0xdcd6=['membername_interface','interface','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0xdcd6,0x92));var _0x6dcd=function(_0x799277,_0x574d5f){_0x799277=_0x799277-0x0;var _0x56d41f=_0xdcd6[_0x799277];return _0x56d41f;};'use strict';var _=require(_0x6dcd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6dcd('0x1'));var moment=require(_0x6dcd('0x2'));var BPromise=require('bluebird');var rp=require(_0x6dcd('0x3'));var fs=require('fs');var path=require(_0x6dcd('0x4'));var rimraf=require(_0x6dcd('0x5'));var config=require(_0x6dcd('0x6'));var attributes=require(_0x6dcd('0x7'));module[_0x6dcd('0x8')]=function(_0x496e2e,_0x5d7423){return _0x496e2e[_0x6dcd('0x9')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x6dcd('0xa'),'fields':['membername',_0x6dcd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef96=['rimraf','exports','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38bca2,_0x1c9bf2){var _0x82b6=function(_0x4fbb3f){while(--_0x4fbb3f){_0x38bca2['push'](_0x38bca2['shift']());}};_0x82b6(++_0x1c9bf2);}(_0xef96,0x162));var _0x6ef9=function(_0x1799e9,_0x43f13d){_0x1799e9=_0x1799e9-0x0;var _0x1f6923=_0xef96[_0x1799e9];return _0x1f6923;};'use strict';var _=require(_0x6ef9('0x0'));var util=require(_0x6ef9('0x1'));var logger=require(_0x6ef9('0x2'))(_0x6ef9('0x3'));var moment=require(_0x6ef9('0x4'));var BPromise=require(_0x6ef9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6ef9('0x6'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x6ef9('0x7')]=function(_0x1983df,_0x34ba12){return _0x1983df['define'](_0x6ef9('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x6ef9('0x9'),'fields':[_0x6ef9('0xa'),_0x6ef9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b25f7a0..f016d82 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 _0x195f=['attributes','GetMemberReport','stringify','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','MemberReport','options','where','limit','include','map','model'];(function(_0x8a6f8d,_0x17098a){var _0x4fbbee=function(_0x527f61){while(--_0x527f61){_0x8a6f8d['push'](_0x8a6f8d['shift']());}};_0x4fbbee(++_0x17098a);}(_0x195f,0x113));var _0xf195=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0x195f[_0x2166a3];return _0x260035;};'use strict';var _=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var moment=require('moment');var BPromise=require(_0xf195('0x2'));var rs=require(_0xf195('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf195('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf195('0x5'))(_0xf195('0x6'));var config=require(_0xf195('0x7'));var jayson=require(_0xf195('0x8'));var client=jayson[_0xf195('0x9')][_0xf195('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2770db,_0x59d783,_0x5eac33){return new BPromise(function(_0x327cc3,_0x15d465){return client[_0xf195('0xb')](_0x2770db,_0x5eac33)[_0xf195('0xc')](function(_0x7b3e6f){logger[_0xf195('0xd')](_0xf195('0xe'),_0x59d783,'request\x20sent');logger[_0xf195('0xf')](_0xf195('0x10'),_0x59d783,_0xf195('0x11'),JSON['stringify'](_0x7b3e6f));if(_0x7b3e6f[_0xf195('0x12')]){if(_0x7b3e6f[_0xf195('0x12')][_0xf195('0x13')]===0x1f4){logger[_0xf195('0x12')]('MemberReport,\x20%s,\x20%s',_0x59d783,_0x7b3e6f[_0xf195('0x12')][_0xf195('0x14')]);return _0x15d465(_0x7b3e6f['error'][_0xf195('0x14')]);}logger['error'](_0xf195('0xe'),_0x59d783,_0x7b3e6f[_0xf195('0x12')][_0xf195('0x14')]);return _0x327cc3(_0x7b3e6f[_0xf195('0x12')][_0xf195('0x14')]);}else{logger[_0xf195('0xd')](_0xf195('0xe'),_0x59d783,_0xf195('0x11'));_0x327cc3(_0x7b3e6f['result']['message']);}})[_0xf195('0x15')](function(_0x3ad05f){logger[_0xf195('0x12')](_0xf195('0xe'),_0x59d783,_0x3ad05f);_0x15d465(_0x3ad05f);});});}exports['GetMemberReport']=function(_0x374fc6){var _0x1ae33e=this;return new Promise(function(_0x5cf7dc,_0x452931){return db[_0xf195('0x16')]['findAll']({'raw':_0x374fc6[_0xf195('0x17')]?_0x374fc6[_0xf195('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x374fc6[_0xf195('0x17')]?_0x374fc6[_0xf195('0x17')][_0xf195('0x18')]||null:null,'attributes':_0x374fc6[_0xf195('0x17')]?_0x374fc6['options']['attributes']||null:null,'limit':_0x374fc6['options']?_0x374fc6[_0xf195('0x17')][_0xf195('0x19')]||null:null,'include':_0x374fc6[_0xf195('0x17')]?_0x374fc6[_0xf195('0x17')][_0xf195('0x1a')]?_[_0xf195('0x1b')](_0x374fc6[_0xf195('0x17')][_0xf195('0x1a')],function(_0x45cfa4){return{'model':db[_0x45cfa4[_0xf195('0x1c')]],'as':_0x45cfa4['as'],'attributes':_0x45cfa4[_0xf195('0x1d')],'include':_0x45cfa4[_0xf195('0x1a')]?_['map'](_0x45cfa4[_0xf195('0x1a')],function(_0x246750){return{'model':db[_0x246750[_0xf195('0x1c')]],'as':_0x246750['as'],'attributes':_0x246750[_0xf195('0x1d')],'include':_0x246750[_0xf195('0x1a')]?_[_0xf195('0x1b')](_0x246750[_0xf195('0x1a')],function(_0x3c1371){return{'model':db[_0x3c1371['model']],'as':_0x3c1371['as'],'attributes':_0x3c1371['attributes']};}):[]};}):[]};}):[]:[]})[_0xf195('0xc')](function(_0x37d9e9){logger[_0xf195('0xd')](_0xf195('0x1e'),_0x374fc6);logger[_0xf195('0xf')](_0xf195('0x1e'),_0x374fc6,JSON[_0xf195('0x1f')](_0x37d9e9));_0x5cf7dc(_0x37d9e9);})[_0xf195('0x15')](function(_0x5dbca){logger[_0xf195('0x12')](_0xf195('0x1e'),_0x5dbca[_0xf195('0x14')],_0x374fc6);_0x452931(_0x1ae33e[_0xf195('0x12')](0x1f4,_0x5dbca[_0xf195('0x14')]));});});};exports[_0xf195('0x20')]=function(_0x245a06){var _0x20e0e3=this;return new Promise(function(_0x26f511,_0xdd63ec){return db['MemberReport'][_0xf195('0x21')](_0x245a06[_0xf195('0x22')],{'raw':_0x245a06[_0xf195('0x17')]?_0x245a06[_0xf195('0x17')][_0xf195('0x23')]===undefined?!![]:![]:!![]})[_0xf195('0xc')](function(_0x12b169){logger[_0xf195('0xd')](_0xf195('0x20'),_0x245a06);logger[_0xf195('0xf')](_0xf195('0x20'),_0x245a06,JSON[_0xf195('0x1f')](_0x12b169));_0x26f511(_0x12b169);})[_0xf195('0x15')](function(_0x9eff93){logger[_0xf195('0x12')](_0xf195('0x20'),_0x9eff93[_0xf195('0x14')],_0x245a06);_0xdd63ec(_0x20e0e3['error'](0x1f4,_0x9eff93[_0xf195('0x14')]));});});};exports[_0xf195('0x24')]=function(_0x2d0ef1){var _0xc0a617=this;return new Promise(function(_0x32e5ee,_0x58a1a9){return db[_0xf195('0x16')][_0xf195('0x25')](_0x2d0ef1[_0xf195('0x22')],{'raw':_0x2d0ef1['options']?_0x2d0ef1['options'][_0xf195('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0ef1[_0xf195('0x17')]?_0x2d0ef1[_0xf195('0x17')][_0xf195('0x18')]||null:null,'attributes':_0x2d0ef1[_0xf195('0x17')]?_0x2d0ef1[_0xf195('0x17')][_0xf195('0x1d')]||null:null,'limit':_0x2d0ef1[_0xf195('0x17')]?_0x2d0ef1[_0xf195('0x17')][_0xf195('0x19')]||null:null})['then'](function(_0x4eaa8c){logger[_0xf195('0xd')](_0xf195('0x24'),_0x2d0ef1);logger[_0xf195('0xf')](_0xf195('0x24'),_0x2d0ef1,JSON[_0xf195('0x1f')](_0x4eaa8c));_0x32e5ee(_0x4eaa8c);})[_0xf195('0x15')](function(_0x11958c){logger[_0xf195('0x12')]('UpdateMemberReport',_0x11958c[_0xf195('0x14')],_0x2d0ef1);_0x58a1a9(_0xc0a617['error'](0x1f4,_0x11958c['message']));});});}; \ No newline at end of file +var _0xc03e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0xc03e,0x15a));var _0xec03=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xc03e[_0x4b91c4];return _0x25cb80;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xec03('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec03('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xec03('0x3'));var logger=require(_0xec03('0x4'))(_0xec03('0x5'));var config=require(_0xec03('0x6'));var jayson=require(_0xec03('0x7'));var client=jayson[_0xec03('0x8')][_0xec03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcaaf03,_0x278f90,_0x529ebd){return new BPromise(function(_0x4205e9,_0xb0638e){return client[_0xec03('0xa')](_0xcaaf03,_0x529ebd)[_0xec03('0xb')](function(_0x4d7e09){logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));logger[_0xec03('0xf')](_0xec03('0x10'),_0x278f90,_0xec03('0xe'),JSON[_0xec03('0x11')](_0x4d7e09));if(_0x4d7e09[_0xec03('0x12')]){if(_0x4d7e09['error'][_0xec03('0x13')]===0x1f4){logger[_0xec03('0x12')](_0xec03('0xd'),_0x278f90,_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);return _0xb0638e(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}logger[_0xec03('0x12')]('MemberReport,\x20%s,\x20%s',_0x278f90,_0x4d7e09['error']['message']);return _0x4205e9(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}else{logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));_0x4205e9(_0x4d7e09[_0xec03('0x15')][_0xec03('0x14')]);}})[_0xec03('0x16')](function(_0x5c2f1a){logger[_0xec03('0x12')]('MemberReport,\x20%s,\x20%s',_0x278f90,_0x5c2f1a);_0xb0638e(_0x5c2f1a);});});}exports[_0xec03('0x17')]=function(_0x5e8ae2){var _0x25292d=this;return new Promise(function(_0x5b3e04,_0x57dc2d){return db[_0xec03('0x18')][_0xec03('0x19')]({'raw':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2['options'][_0xec03('0x1b')]||null:null,'attributes':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1c')]||null:null,'limit':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1d')]||null:null,'include':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2['options'][_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1e')],function(_0x33de1e){return{'model':db[_0x33de1e[_0xec03('0x20')]],'as':_0x33de1e['as'],'attributes':_0x33de1e['attributes'],'include':_0x33de1e[_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x33de1e['include'],function(_0x2bfcf6){return{'model':db[_0x2bfcf6[_0xec03('0x20')]],'as':_0x2bfcf6['as'],'attributes':_0x2bfcf6[_0xec03('0x1c')],'include':_0x2bfcf6[_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x2bfcf6['include'],function(_0x73cc4f){return{'model':db[_0x73cc4f[_0xec03('0x20')]],'as':_0x73cc4f['as'],'attributes':_0x73cc4f[_0xec03('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xec03('0xb')](function(_0x29e904){logger['info'](_0xec03('0x17'),_0x5e8ae2);logger[_0xec03('0xf')]('GetMemberReport',_0x5e8ae2,JSON['stringify'](_0x29e904));_0x5b3e04(_0x29e904);})[_0xec03('0x16')](function(_0x12b5c9){logger[_0xec03('0x12')](_0xec03('0x17'),_0x12b5c9[_0xec03('0x14')],_0x5e8ae2);_0x57dc2d(_0x25292d[_0xec03('0x12')](0x1f4,_0x12b5c9[_0xec03('0x14')]));});});};exports[_0xec03('0x21')]=function(_0x51fad6){var _0x28f60c=this;return new Promise(function(_0x31c08d,_0x2bd889){return db[_0xec03('0x18')][_0xec03('0x22')](_0x51fad6[_0xec03('0x23')],{'raw':_0x51fad6[_0xec03('0x1a')]?_0x51fad6[_0xec03('0x1a')][_0xec03('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x5d441b){logger['info'](_0xec03('0x21'),_0x51fad6);logger[_0xec03('0xf')](_0xec03('0x21'),_0x51fad6,JSON[_0xec03('0x11')](_0x5d441b));_0x31c08d(_0x5d441b);})['catch'](function(_0x576d5e){logger['error']('CreateMemberReport',_0x576d5e[_0xec03('0x14')],_0x51fad6);_0x2bd889(_0x28f60c[_0xec03('0x12')](0x1f4,_0x576d5e[_0xec03('0x14')]));});});};exports[_0xec03('0x25')]=function(_0x11c75b){var _0x3d7d98=this;return new Promise(function(_0x23a26b,_0x1cee38){return db[_0xec03('0x18')][_0xec03('0x26')](_0x11c75b[_0xec03('0x23')],{'raw':_0x11c75b[_0xec03('0x1a')]?_0x11c75b['options'][_0xec03('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')]['where']||null:null,'attributes':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')][_0xec03('0x1c')]||null:null,'limit':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')][_0xec03('0x1d')]||null:null})[_0xec03('0xb')](function(_0x3c55b7){logger[_0xec03('0xc')](_0xec03('0x25'),_0x11c75b);logger[_0xec03('0xf')]('UpdateMemberReport',_0x11c75b,JSON[_0xec03('0x11')](_0x3c55b7));_0x23a26b(_0x3c55b7);})[_0xec03('0x16')](function(_0x37819a){logger[_0xec03('0x12')](_0xec03('0x25'),_0x37819a[_0xec03('0x14')],_0x11c75b);_0x1cee38(_0x3d7d98[_0xec03('0x12')](0x1f4,_0x37819a[_0xec03('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 0217567..371f5bc 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 _0xcc34=['../../config/environment','./migration.controller','get','index','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcc34,0x7e));var _0x4cc3=function(_0x272ca9,_0x42c145){_0x272ca9=_0x272ca9-0x0;var _0x55ae78=_0xcc34[_0x272ca9];return _0x55ae78;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4cc3('0x0'));var timeout=require('connect-timeout');var express=require(_0x4cc3('0x1'));var router=express[_0x4cc3('0x2')]();var fs_extra=require(_0x4cc3('0x3'));var auth=require(_0x4cc3('0x4'));var interaction=require(_0x4cc3('0x5'));var config=require(_0x4cc3('0x6'));var controller=require(_0x4cc3('0x7'));router[_0x4cc3('0x8')]('/',controller[_0x4cc3('0x9')]);module[_0x4cc3('0xa')]=router; \ No newline at end of file +var _0xc95f=['get','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x150aa3,_0x2d7de7){var _0x40347d=function(_0xda87be){while(--_0xda87be){_0x150aa3['push'](_0x150aa3['shift']());}};_0x40347d(++_0x2d7de7);}(_0xc95f,0xe2));var _0xfc95=function(_0x2ef16b,_0x4b612a){_0x2ef16b=_0x2ef16b-0x0;var _0x53a7eb=_0xc95f[_0x2ef16b];return _0x53a7eb;};'use strict';var multer=require(_0xfc95('0x0'));var util=require(_0xfc95('0x1'));var path=require(_0xfc95('0x2'));var timeout=require(_0xfc95('0x3'));var express=require(_0xfc95('0x4'));var router=express[_0xfc95('0x5')]();var fs_extra=require(_0xfc95('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfc95('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xfc95('0x8')]('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index b1a4bd3..56363bb 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 _0x2291=['sequelize','exports','STRING','version'];(function(_0x46dadc,_0x27724b){var _0x214ead=function(_0x4a14cc){while(--_0x4a14cc){_0x46dadc['push'](_0x46dadc['shift']());}};_0x214ead(++_0x27724b);}(_0x2291,0x130));var _0x1229=function(_0x168edb,_0x33dd54){_0x168edb=_0x168edb-0x0;var _0x413600=_0x2291[_0x168edb];return _0x413600;};'use strict';var Sequelize=require(_0x1229('0x0'));module[_0x1229('0x1')]={'version':{'type':Sequelize[_0x1229('0x2')],'unique':_0x1229('0x3')}}; \ No newline at end of file +var _0x1f5f=['sequelize','STRING','version'];(function(_0x5485a2,_0x486c99){var _0x3cd67a=function(_0x522b4e){while(--_0x522b4e){_0x5485a2['push'](_0x5485a2['shift']());}};_0x3cd67a(++_0x486c99);}(_0x1f5f,0x1c5));var _0xf1f5=function(_0x2af3fb,_0x732372){_0x2af3fb=_0x2af3fb-0x0;var _0x237c02=_0x1f5f[_0x2af3fb];return _0x237c02;};'use strict';var Sequelize=require(_0xf1f5('0x0'));module['exports']={'version':{'type':Sequelize[_0xf1f5('0x1')],'unique':_0xf1f5('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 20d9ce2..b3f9c85 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 _0xe19c=['filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','include','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','model','query'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe19c,0x1a3));var _0xce19=function(_0x469348,_0x39af3d){_0x469348=_0x469348-0x0;var _0x5a13a1=_0xe19c[_0x469348];return _0x5a13a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce19('0x0'));var zipdir=require(_0xce19('0x1'));var jsonpatch=require(_0xce19('0x2'));var rp=require(_0xce19('0x3'));var moment=require(_0xce19('0x4'));var BPromise=require(_0xce19('0x5'));var Mustache=require(_0xce19('0x6'));var util=require('util');var path=require(_0xce19('0x7'));var sox=require(_0xce19('0x8'));var csv=require(_0xce19('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce19('0xa'));var _=require(_0xce19('0xb'));var squel=require(_0xce19('0xc'));var crypto=require('crypto');var jsforce=require(_0xce19('0xd'));var deskjs=require(_0xce19('0xe'));var toCsv=require(_0xce19('0x9'));var querystring=require(_0xce19('0xf'));var Papa=require(_0xce19('0x10'));var Redis=require('ioredis');var authService=require(_0xce19('0x11'));var qs=require(_0xce19('0x12'));var as=require(_0xce19('0x13'));var hardwareService=require(_0xce19('0x14'));var logger=require('../../config/logger')(_0xce19('0x15'));var utils=require(_0xce19('0x16'));var config=require(_0xce19('0x17'));var licenseUtil=require(_0xce19('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ced8d,_0x3ddeb0){_0x3ddeb0=_0x3ddeb0||0xcc;return function(_0x43a3ef){if(_0x43a3ef){return _0x4ced8d[_0xce19('0x19')](_0x3ddeb0);}return _0x4ced8d[_0xce19('0x1a')](_0x3ddeb0)['end']();};}function respondWithResult(_0x562457,_0x5aa05a){_0x5aa05a=_0x5aa05a||0xc8;return function(_0x4ace3c){if(_0x4ace3c){return _0x562457['status'](_0x5aa05a)[_0xce19('0x1b')](_0x4ace3c);}};}function respondWithFilteredResult(_0x4f104f,_0x1bc37a){return function(_0xa63ea7){if(_0xa63ea7){var _0x59be49=typeof _0x1bc37a[_0xce19('0x1c')]==='undefined'&&typeof _0x1bc37a['limit']===_0xce19('0x1d');var _0x42383f=_0xa63ea7[_0xce19('0x1e')];var _0x1297de=_0x59be49?0x0:_0x1bc37a['offset'];var _0x119691=_0x59be49?_0xa63ea7['count']:_0x1bc37a[_0xce19('0x1c')]+_0x1bc37a['limit'];var _0x4c5bac;if(_0x119691>=_0x42383f){_0x119691=_0x42383f;_0x4c5bac=0xc8;}else{_0x4c5bac=0xce;}_0x4f104f[_0xce19('0x1a')](_0x4c5bac);return _0x4f104f[_0xce19('0x1f')](_0xce19('0x20'),_0x1297de+'-'+_0x119691+'/'+_0x42383f)[_0xce19('0x1b')](_0xa63ea7);}return null;};}function patchUpdates(_0x3438e5){return function(_0x76ade8){try{jsonpatch['apply'](_0x76ade8,_0x3438e5,!![]);}catch(_0x4dfbae){return BPromise[_0xce19('0x21')](_0x4dfbae);}return _0x76ade8[_0xce19('0x22')]();};}function saveUpdates(_0x3ab4da,_0x4a2b6a){return function(_0xea5429){if(_0xea5429){return _0xea5429[_0xce19('0x23')](_0x3ab4da)[_0xce19('0x24')](function(_0x4b82ed){return _0x4b82ed;});}return null;};}function removeEntity(_0x1b3928,_0x3bc393){return function(_0x3fb1bc){if(_0x3fb1bc){return _0x3fb1bc[_0xce19('0x25')]()[_0xce19('0x24')](function(){_0x1b3928[_0xce19('0x1a')](0xcc)[_0xce19('0x26')]();});}};}function handleEntityNotFound(_0x5199fd,_0x4abbe0){return function(_0x2401f8){if(!_0x2401f8){_0x5199fd[_0xce19('0x19')](0x194);}return _0x2401f8;};}function handleError(_0x1535f5,_0x5dfeed){_0x5dfeed=_0x5dfeed||0x1f4;return function(_0x33f728){logger['error'](_0x33f728[_0xce19('0x27')]);if(_0x33f728[_0xce19('0x28')]){delete _0x33f728[_0xce19('0x28')];}_0x1535f5[_0xce19('0x1a')](_0x5dfeed)[_0xce19('0x29')](_0x33f728);};}exports[_0xce19('0x2a')]=function(_0x43a898,_0x3da9c9){var _0x918fd7={},_0x38a1ee={},_0x120d84={'count':0x0,'rows':[]};var _0x52a677=_[_0xce19('0x2b')](db[_0xce19('0x2c')][_0xce19('0x2d')],function(_0x151af9){return{'name':_0x151af9[_0xce19('0x2e')],'type':_0x151af9[_0xce19('0x2f')]['key']};});_0x38a1ee[_0xce19('0x30')]=_[_0xce19('0x2b')](_0x52a677,_0xce19('0x28'));_0x38a1ee[_0xce19('0x31')]=_['keys'](_0x43a898[_0xce19('0x31')]);_0x38a1ee[_0xce19('0x32')]=_['intersection'](_0x38a1ee['model'],_0x38a1ee[_0xce19('0x31')]);_0x918fd7[_0xce19('0x33')]=_['intersection'](_0x38a1ee[_0xce19('0x30')],qs[_0xce19('0x34')](_0x43a898[_0xce19('0x31')][_0xce19('0x34')]));_0x918fd7[_0xce19('0x33')]=_0x918fd7[_0xce19('0x33')][_0xce19('0x35')]?_0x918fd7[_0xce19('0x33')]:_0x38a1ee[_0xce19('0x30')];if(!_0x43a898[_0xce19('0x31')][_0xce19('0x36')](_0xce19('0x37'))){_0x918fd7['limit']=qs[_0xce19('0x38')](_0x43a898[_0xce19('0x31')]['limit']);_0x918fd7['offset']=qs[_0xce19('0x1c')](_0x43a898[_0xce19('0x31')][_0xce19('0x1c')]);}_0x918fd7[_0xce19('0x39')]=qs[_0xce19('0x3a')](_0x43a898[_0xce19('0x31')][_0xce19('0x3a')]);_0x918fd7[_0xce19('0x3b')]=qs[_0xce19('0x32')](_['pick'](_0x43a898[_0xce19('0x31')],_0x38a1ee['filters']),_0x52a677);if(_0x43a898['query'][_0xce19('0x3c')]){_0x918fd7[_0xce19('0x3b')]=_[_0xce19('0x3d')](_0x918fd7[_0xce19('0x3b')],{'$or':_[_0xce19('0x2b')](_0x52a677,function(_0x5209aa){if(_0x5209aa[_0xce19('0x2f')]!=='VIRTUAL'){var _0x503bf1={};_0x503bf1[_0x5209aa[_0xce19('0x28')]]={'$like':'%'+_0x43a898[_0xce19('0x31')][_0xce19('0x3c')]+'%'};return _0x503bf1;}})});}_0x918fd7=_['merge']({},_0x918fd7,_0x43a898[_0xce19('0x3e')]);var _0x50aefa={'where':_0x918fd7[_0xce19('0x3b')]};return db[_0xce19('0x2c')][_0xce19('0x1e')](_0x50aefa)[_0xce19('0x24')](function(_0xe7940d){_0x120d84[_0xce19('0x1e')]=_0xe7940d;if(_0x43a898['query']['includeAll']){_0x918fd7[_0xce19('0x3f')]=[{'all':!![]}];}return db[_0xce19('0x2c')][_0xce19('0x40')](_0x918fd7);})[_0xce19('0x24')](function(_0x1c0554){_0x120d84[_0xce19('0x41')]=_0x1c0554;return _0x120d84;})['then'](respondWithFilteredResult(_0x3da9c9,_0x918fd7))[_0xce19('0x42')](handleError(_0x3da9c9,null));}; \ No newline at end of file +var _0xe963=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Migration','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xe963,0xfa));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e96('0x0'));var zipdir=require(_0x3e96('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3e96('0x2'));var BPromise=require(_0x3e96('0x3'));var Mustache=require(_0x3e96('0x4'));var util=require(_0x3e96('0x5'));var path=require(_0x3e96('0x6'));var sox=require(_0x3e96('0x7'));var csv=require('to-csv');var ejs=require(_0x3e96('0x8'));var fs=require('fs');var fs_extra=require(_0x3e96('0x9'));var _=require(_0x3e96('0xa'));var squel=require(_0x3e96('0xb'));var crypto=require(_0x3e96('0xc'));var jsforce=require(_0x3e96('0xd'));var deskjs=require(_0x3e96('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3e96('0xf'));var Papa=require(_0x3e96('0x10'));var Redis=require(_0x3e96('0x11'));var authService=require(_0x3e96('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3e96('0x13'));var hardwareService=require(_0x3e96('0x14'));var logger=require('../../config/logger')(_0x3e96('0x15'));var utils=require(_0x3e96('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3e96('0x17'));var db=require(_0x3e96('0x18'))['db'];function respondWithStatusCode(_0x6f4cba,_0x2b3f35){_0x2b3f35=_0x2b3f35||0xcc;return function(_0x1dbc8b){if(_0x1dbc8b){return _0x6f4cba['sendStatus'](_0x2b3f35);}return _0x6f4cba[_0x3e96('0x19')](_0x2b3f35)[_0x3e96('0x1a')]();};}function respondWithResult(_0x400b53,_0x2fd6ec){_0x2fd6ec=_0x2fd6ec||0xc8;return function(_0x2a8e36){if(_0x2a8e36){return _0x400b53[_0x3e96('0x19')](_0x2fd6ec)[_0x3e96('0x1b')](_0x2a8e36);}};}function respondWithFilteredResult(_0xfac72b,_0x2807d3){return function(_0x598b7c){if(_0x598b7c){var _0x118dd5=typeof _0x2807d3[_0x3e96('0x1c')]===_0x3e96('0x1d')&&typeof _0x2807d3[_0x3e96('0x1e')]==='undefined';var _0x5dd971=_0x598b7c[_0x3e96('0x1f')];var _0x2bcf71=_0x118dd5?0x0:_0x2807d3[_0x3e96('0x1c')];var _0x591c59=_0x118dd5?_0x598b7c['count']:_0x2807d3[_0x3e96('0x1c')]+_0x2807d3[_0x3e96('0x1e')];var _0x5069ce;if(_0x591c59>=_0x5dd971){_0x591c59=_0x5dd971;_0x5069ce=0xc8;}else{_0x5069ce=0xce;}_0xfac72b['status'](_0x5069ce);return _0xfac72b['set'](_0x3e96('0x20'),_0x2bcf71+'-'+_0x591c59+'/'+_0x5dd971)['json'](_0x598b7c);}return null;};}function patchUpdates(_0x2474c1){return function(_0x596e68){try{jsonpatch['apply'](_0x596e68,_0x2474c1,!![]);}catch(_0x3c3f59){return BPromise[_0x3e96('0x21')](_0x3c3f59);}return _0x596e68[_0x3e96('0x22')]();};}function saveUpdates(_0x20e447,_0x42fcac){return function(_0x3ec1f2){if(_0x3ec1f2){return _0x3ec1f2[_0x3e96('0x23')](_0x20e447)[_0x3e96('0x24')](function(_0x1dbf8a){return _0x1dbf8a;});}return null;};}function removeEntity(_0x4abe64,_0x2d283a){return function(_0xc68b74){if(_0xc68b74){return _0xc68b74[_0x3e96('0x25')]()[_0x3e96('0x24')](function(){_0x4abe64[_0x3e96('0x19')](0xcc)[_0x3e96('0x1a')]();});}};}function handleEntityNotFound(_0x2657fc,_0x53a19b){return function(_0x272739){if(!_0x272739){_0x2657fc[_0x3e96('0x26')](0x194);}return _0x272739;};}function handleError(_0x3fa33b,_0x104bd2){_0x104bd2=_0x104bd2||0x1f4;return function(_0x3c1fcd){logger[_0x3e96('0x27')](_0x3c1fcd[_0x3e96('0x28')]);if(_0x3c1fcd[_0x3e96('0x29')]){delete _0x3c1fcd[_0x3e96('0x29')];}_0x3fa33b[_0x3e96('0x19')](_0x104bd2)[_0x3e96('0x2a')](_0x3c1fcd);};}exports[_0x3e96('0x2b')]=function(_0x2e5a10,_0x4cfd25){var _0xcab454={},_0x5317a7={},_0x8649aa={'count':0x0,'rows':[]};var _0xf3ab59=_[_0x3e96('0x2c')](db[_0x3e96('0x2d')]['rawAttributes'],function(_0x4ed91d){return{'name':_0x4ed91d['fieldName'],'type':_0x4ed91d['type'][_0x3e96('0x2e')]};});_0x5317a7['model']=_[_0x3e96('0x2c')](_0xf3ab59,_0x3e96('0x29'));_0x5317a7[_0x3e96('0x2f')]=_['keys'](_0x2e5a10[_0x3e96('0x2f')]);_0x5317a7[_0x3e96('0x30')]=_[_0x3e96('0x31')](_0x5317a7['model'],_0x5317a7[_0x3e96('0x2f')]);_0xcab454['attributes']=_[_0x3e96('0x31')](_0x5317a7[_0x3e96('0x32')],qs[_0x3e96('0x33')](_0x2e5a10[_0x3e96('0x2f')][_0x3e96('0x33')]));_0xcab454[_0x3e96('0x34')]=_0xcab454[_0x3e96('0x34')][_0x3e96('0x35')]?_0xcab454[_0x3e96('0x34')]:_0x5317a7[_0x3e96('0x32')];if(!_0x2e5a10[_0x3e96('0x2f')][_0x3e96('0x36')](_0x3e96('0x37'))){_0xcab454[_0x3e96('0x1e')]=qs[_0x3e96('0x1e')](_0x2e5a10[_0x3e96('0x2f')][_0x3e96('0x1e')]);_0xcab454['offset']=qs[_0x3e96('0x1c')](_0x2e5a10['query'][_0x3e96('0x1c')]);}_0xcab454[_0x3e96('0x38')]=qs[_0x3e96('0x39')](_0x2e5a10[_0x3e96('0x2f')]['sort']);_0xcab454[_0x3e96('0x3a')]=qs[_0x3e96('0x30')](_[_0x3e96('0x3b')](_0x2e5a10[_0x3e96('0x2f')],_0x5317a7['filters']),_0xf3ab59);if(_0x2e5a10[_0x3e96('0x2f')][_0x3e96('0x3c')]){_0xcab454['where']=_[_0x3e96('0x3d')](_0xcab454['where'],{'$or':_[_0x3e96('0x2c')](_0xf3ab59,function(_0xb5dc21){if(_0xb5dc21[_0x3e96('0x3e')]!==_0x3e96('0x3f')){var _0x14e748={};_0x14e748[_0xb5dc21['name']]={'$like':'%'+_0x2e5a10['query'][_0x3e96('0x3c')]+'%'};return _0x14e748;}})});}_0xcab454=_[_0x3e96('0x3d')]({},_0xcab454,_0x2e5a10[_0x3e96('0x40')]);var _0x8983b0={'where':_0xcab454[_0x3e96('0x3a')]};return db[_0x3e96('0x2d')][_0x3e96('0x1f')](_0x8983b0)['then'](function(_0x23c65e){_0x8649aa['count']=_0x23c65e;if(_0x2e5a10[_0x3e96('0x2f')]['includeAll']){_0xcab454[_0x3e96('0x41')]=[{'all':!![]}];}return db[_0x3e96('0x2d')][_0x3e96('0x42')](_0xcab454);})[_0x3e96('0x24')](function(_0x254b4d){_0x8649aa['rows']=_0x254b4d;return _0x8649aa;})[_0x3e96('0x24')](respondWithFilteredResult(_0x4cfd25,_0xcab454))['catch'](handleError(_0x4cfd25,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 4f57506..7b8ae0c 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 _0x9c00=['request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3f5ed4,_0x433b00){var _0x3c8208=function(_0x151fb0){while(--_0x151fb0){_0x3f5ed4['push'](_0x3f5ed4['shift']());}};_0x3c8208(++_0x433b00);}(_0x9c00,0x19b));var _0x09c0=function(_0x27ac32,_0x42771f){_0x27ac32=_0x27ac32-0x0;var _0x20c811=_0x9c00[_0x27ac32];return _0x20c811;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require(_0x09c0('0x2'))('api');var moment=require(_0x09c0('0x3'));var BPromise=require(_0x09c0('0x4'));var rp=require(_0x09c0('0x5'));var fs=require('fs');var path=require(_0x09c0('0x6'));var rimraf=require(_0x09c0('0x7'));var config=require(_0x09c0('0x8'));var attributes=require(_0x09c0('0x9'));module[_0x09c0('0xa')]=function(_0x1255e2,_0xca7a96){return _0x1255e2['define'](_0x09c0('0xb'),attributes,{'tableName':_0x09c0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x078e=['path','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x14e3cf,_0x4c2a07){var _0x2db962=function(_0x39bc2d){while(--_0x39bc2d){_0x14e3cf['push'](_0x14e3cf['shift']());}};_0x2db962(++_0x4c2a07);}(_0x078e,0x19a));var _0xe078=function(_0x87bce7,_0x39b032){_0x87bce7=_0x87bce7-0x0;var _0x118f8e=_0x078e[_0x87bce7];return _0x118f8e;};'use strict';var _=require(_0xe078('0x0'));var util=require('util');var logger=require(_0xe078('0x1'))(_0xe078('0x2'));var moment=require(_0xe078('0x3'));var BPromise=require(_0xe078('0x4'));var rp=require(_0xe078('0x5'));var fs=require('fs');var path=require(_0xe078('0x6'));var rimraf=require(_0xe078('0x7'));var config=require('../../config/environment');var attributes=require(_0xe078('0x8'));module[_0xe078('0x9')]=function(_0x1a253e,_0x33b0aa){return _0x1a253e[_0xe078('0xa')](_0xe078('0xb'),attributes,{'tableName':_0xe078('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index c1a2f88..76690a0 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 _0xf958=['then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x103ef6,_0x46ba39){var _0x73d766=function(_0x162726){while(--_0x162726){_0x103ef6['push'](_0x103ef6['shift']());}};_0x73d766(++_0x46ba39);}(_0xf958,0xe6));var _0x8f95=function(_0x3a9488,_0x53f62d){_0x3a9488=_0x3a9488-0x0;var _0x3941e5=_0xf958[_0x3a9488];return _0x3941e5;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var moment=require(_0x8f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f95('0x3'))['db'];var utils=require(_0x8f95('0x4'));var logger=require(_0x8f95('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f95('0x6'));var client=jayson[_0x8f95('0x7')][_0x8f95('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c2af8,_0x5cfc04,_0x1ae9c4){return new BPromise(function(_0x109bed,_0x435b5b){return client[_0x8f95('0x9')](_0x5c2af8,_0x1ae9c4)[_0x8f95('0xa')](function(_0x585025){logger[_0x8f95('0xb')](_0x8f95('0xc'),_0x5cfc04,'request\x20sent');logger[_0x8f95('0xd')](_0x8f95('0xe'),_0x5cfc04,_0x8f95('0xf'),JSON['stringify'](_0x585025));if(_0x585025[_0x8f95('0x10')]){if(_0x585025[_0x8f95('0x10')][_0x8f95('0x11')]===0x1f4){logger['error'](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x435b5b(_0x585025['error'][_0x8f95('0x12')]);}logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x109bed(_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x5cfc04,'request\x20sent');_0x109bed(_0x585025['result']['message']);}})[_0x8f95('0x13')](function(_0x2f01cd){logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x2f01cd);_0x435b5b(_0x2f01cd);});});} \ No newline at end of file +var _0xa45b=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','info','request\x20sent','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','debug'];(function(_0x34ed48,_0x2cc995){var _0x37da5c=function(_0x5b6e16){while(--_0x5b6e16){_0x34ed48['push'](_0x34ed48['shift']());}};_0x37da5c(++_0x2cc995);}(_0xa45b,0x199));var _0xba45=function(_0x39aa24,_0x14048f){_0x39aa24=_0x39aa24-0x0;var _0x501e38=_0xa45b[_0x39aa24];return _0x501e38;};'use strict';var _=require('lodash');var util=require(_0xba45('0x0'));var moment=require(_0xba45('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba45('0x2'))['db'];var utils=require(_0xba45('0x3'));var logger=require(_0xba45('0x4'))(_0xba45('0x5'));var config=require('../../config/environment');var jayson=require(_0xba45('0x6'));var client=jayson[_0xba45('0x7')][_0xba45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x298bfc,_0x404229,_0x20905f){return new BPromise(function(_0x1a7a40,_0x374412){return client['request'](_0x298bfc,_0x20905f)[_0xba45('0x9')](function(_0x495a41){logger['info']('Migration,\x20%s,\x20%s',_0x404229,'request\x20sent');logger[_0xba45('0xa')](_0xba45('0xb'),_0x404229,'request\x20sent',JSON[_0xba45('0xc')](_0x495a41));if(_0x495a41[_0xba45('0xd')]){if(_0x495a41[_0xba45('0xd')][_0xba45('0xe')]===0x1f4){logger[_0xba45('0xd')]('Migration,\x20%s,\x20%s',_0x404229,_0x495a41[_0xba45('0xd')][_0xba45('0xf')]);return _0x374412(_0x495a41[_0xba45('0xd')][_0xba45('0xf')]);}logger['error'](_0xba45('0x10'),_0x404229,_0x495a41['error'][_0xba45('0xf')]);return _0x1a7a40(_0x495a41[_0xba45('0xd')][_0xba45('0xf')]);}else{logger[_0xba45('0x11')](_0xba45('0x10'),_0x404229,_0xba45('0x12'));_0x1a7a40(_0x495a41[_0xba45('0x13')][_0xba45('0xf')]);}})[_0xba45('0x14')](function(_0xe9a683){logger['error'](_0xba45('0x10'),_0x404229,_0xe9a683);_0x374412(_0xe9a683);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index bba4157..2fed6c4 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 _0x644f=['create','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x644f,0xc2));var _0xf644=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x644f[_0x381379];return _0x3e1063;};'use strict';var multer=require(_0xf644('0x0'));var util=require(_0xf644('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf644('0x2'));var router=express[_0xf644('0x3')]();var fs_extra=require(_0xf644('0x4'));var auth=require(_0xf644('0x5'));var interaction=require(_0xf644('0x6'));var config=require(_0xf644('0x7'));var controller=require(_0xf644('0x8'));router[_0xf644('0x9')]('/',auth[_0xf644('0xa')](),controller[_0xf644('0xb')]);router[_0xf644('0x9')](_0xf644('0xc'),auth['isAuthenticated'](),controller[_0xf644('0xd')]);router[_0xf644('0xe')]('/',auth['isAuthenticated'](),controller[_0xf644('0xf')]);router['put']('/:id',auth[_0xf644('0xa')](),controller['update']);router[_0xf644('0x10')](_0xf644('0xc'),auth['isAuthenticated'](),controller[_0xf644('0x11')]);module[_0xf644('0x12')]=router; \ No newline at end of file +var _0xdccd=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','show','create'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0xdccd,0x102));var _0xddcc=function(_0x59a289,_0x24d42d){_0x59a289=_0x59a289-0x0;var _0x14e766=_0xdccd[_0x59a289];return _0x14e766;};'use strict';var multer=require(_0xddcc('0x0'));var util=require(_0xddcc('0x1'));var path=require(_0xddcc('0x2'));var timeout=require(_0xddcc('0x3'));var express=require(_0xddcc('0x4'));var router=express['Router']();var fs_extra=require(_0xddcc('0x5'));var auth=require(_0xddcc('0x6'));var interaction=require(_0xddcc('0x7'));var config=require(_0xddcc('0x8'));var controller=require(_0xddcc('0x9'));router['get']('/',auth[_0xddcc('0xa')](),controller[_0xddcc('0xb')]);router[_0xddcc('0xc')]('/:id',auth[_0xddcc('0xa')](),controller[_0xddcc('0xd')]);router['post']('/',auth[_0xddcc('0xa')](),controller[_0xddcc('0xe')]);router[_0xddcc('0xf')](_0xddcc('0x10'),auth[_0xddcc('0xa')](),controller[_0xddcc('0x11')]);router[_0xddcc('0x12')]('/:id',auth[_0xddcc('0xa')](),controller[_0xddcc('0x13')]);module[_0xddcc('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 374ab87..99f7fcf 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 _0x21f0=['turn','STRING','exports','localnet','externip'];(function(_0xe7d07d,_0x52e4e3){var _0x229e46=function(_0x376839){while(--_0x376839){_0xe7d07d['push'](_0xe7d07d['shift']());}};_0x229e46(++_0x52e4e3);}(_0x21f0,0xe8));var _0x021f=function(_0x4d6b35,_0x5c3298){_0x4d6b35=_0x4d6b35-0x0;var _0x2fe76a=_0x21f0[_0x4d6b35];return _0x2fe76a;};'use strict';var Sequelize=require('sequelize');module[_0x021f('0x0')]={'type':{'type':Sequelize['ENUM'](_0x021f('0x1'),_0x021f('0x2'),'stun',_0x021f('0x3'))},'value':{'type':Sequelize[_0x021f('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x021f('0x4')]}}; \ No newline at end of file +var _0x37a8=['stun','turn','exports','ENUM','externip'];(function(_0x1b0452,_0x3c69a5){var _0x140bb1=function(_0x3a0e1d){while(--_0x3a0e1d){_0x1b0452['push'](_0x1b0452['shift']());}};_0x140bb1(++_0x3c69a5);}(_0x37a8,0x174));var _0x837a=function(_0x3dda00,_0x392dca){_0x3dda00=_0x3dda00-0x0;var _0x2a6b26=_0x37a8[_0x3dda00];return _0x2a6b26;};'use strict';var Sequelize=require('sequelize');module[_0x837a('0x0')]={'type':{'type':Sequelize[_0x837a('0x1')]('localnet',_0x837a('0x2'),_0x837a('0x3'),_0x837a('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'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 2fcf0d8..dc21a8d 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 _0xdad9=['find','create','findAll','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','destroy','path','ejs','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','count','set','Content-Range','update','then','stack','name','send','map','Network','rawAttributes','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params'];(function(_0x22f48d,_0x51b8e1){var _0x26ba9a=function(_0x5ee718){while(--_0x5ee718){_0x22f48d['push'](_0x22f48d['shift']());}};_0x26ba9a(++_0x51b8e1);}(_0xdad9,0x1a4));var _0x9dad=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdad9[_0x4565bf];return _0x5610ba;};'use strict';var util=require('util');var path=require(_0x9dad('0x0'));var ejs=require(_0x9dad('0x1'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x9dad('0x2'))('api');var config=require(_0x9dad('0x3'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x9dad('0x4')][_0x9dad('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x145e66,_0x2f88e2,_0x5e26ce,_0x31b842){return new Promise(function(_0x3867b3,_0x33025d){var _0x4b2506=_0x31b842||client;return _0x4b2506[_0x9dad('0x6')](_0x145e66,_0x5e26ce)['then'](function(_0x402ebf){logger[_0x9dad('0x7')]('Network,\x20%s,\x20%s',_0x2f88e2,_0x9dad('0x8'));logger[_0x9dad('0x9')](_0x9dad('0xa'),_0x2f88e2,_0x9dad('0x8'),JSON['stringify'](_0x402ebf));if(_0x402ebf[_0x9dad('0xb')]){if(_0x402ebf['error'][_0x9dad('0xc')]===0x1f4){logger[_0x9dad('0xb')](_0x9dad('0xd'),_0x2f88e2,_0x402ebf[_0x9dad('0xb')][_0x9dad('0xe')]);return _0x33025d(_0x402ebf['error'][_0x9dad('0xe')]);}logger[_0x9dad('0xb')]('Network,\x20%s,\x20%s',_0x2f88e2,_0x402ebf[_0x9dad('0xb')]['message']);return _0x3867b3(_0x402ebf[_0x9dad('0xb')]['message']);}else{logger[_0x9dad('0x7')](_0x9dad('0xd'),_0x2f88e2,_0x9dad('0x8'));_0x3867b3(_0x402ebf[_0x9dad('0xf')]['message']);}})[_0x9dad('0x10')](function(_0x1d7292){logger['error'](_0x9dad('0xd'),_0x2f88e2,_0x1d7292);_0x33025d(_0x1d7292);});});}function respondWithResult(_0x2471b5,_0x43e024){_0x43e024=_0x43e024||0xc8;return function(_0x1a03f0){if(_0x1a03f0){return _0x2471b5[_0x9dad('0x11')](_0x43e024)[_0x9dad('0x12')](_0x1a03f0);}};}function respondWithFilteredResult(_0x358bdd,_0x118599){return function(_0x1c8cdb){if(_0x1c8cdb){var _0x204aad=typeof _0x118599[_0x9dad('0x13')]==='undefined'&&typeof _0x118599[_0x9dad('0x14')]==='undefined';var _0x562cbd=_0x1c8cdb[_0x9dad('0x15')];var _0x539e0e=_0x204aad?0x0:_0x118599[_0x9dad('0x13')];var _0x4eeea9=_0x204aad?_0x1c8cdb['count']:_0x118599[_0x9dad('0x13')]+_0x118599['limit'];var _0x500930;if(_0x4eeea9>=_0x562cbd){_0x4eeea9=_0x562cbd;_0x500930=0xc8;}else{_0x500930=0xce;}_0x358bdd['status'](_0x500930);return _0x358bdd[_0x9dad('0x16')](_0x9dad('0x17'),_0x539e0e+'-'+_0x4eeea9+'/'+_0x562cbd)[_0x9dad('0x12')](_0x1c8cdb);}return null;};}function saveUpdates(_0x5ad3ba){return function(_0x429e4e){if(_0x429e4e){return _0x429e4e[_0x9dad('0x18')](_0x5ad3ba)[_0x9dad('0x19')](function(_0x2e43f4){return _0x2e43f4;});}return null;};}function removeEntity(_0xe09f64){return function(_0x5ac02a){if(_0x5ac02a){return _0x5ac02a['destroy']()[_0x9dad('0x19')](function(){_0xe09f64[_0x9dad('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x536ffa){return function(_0x5e93d6){if(!_0x5e93d6){_0x536ffa['sendStatus'](0x194);}return _0x5e93d6;};}function handleError(_0xec10ef,_0x930205){_0x930205=_0x930205||0x1f4;return function(_0x5c6d74){logger[_0x9dad('0xb')](_0x5c6d74[_0x9dad('0x1a')]);if(_0x5c6d74['name']){delete _0x5c6d74[_0x9dad('0x1b')];}_0xec10ef[_0x9dad('0x11')](_0x930205)[_0x9dad('0x1c')](_0x5c6d74);};}exports['index']=function(_0x5d16ef,_0x11b0fb){var _0x2fbfe5={},_0x39285f={},_0x425283={'count':0x0,'rows':[]};var _0x4cc43b=_[_0x9dad('0x1d')](db[_0x9dad('0x1e')][_0x9dad('0x1f')],function(_0x4bbd76){return{'name':_0x4bbd76['fieldName'],'type':_0x4bbd76[_0x9dad('0x20')]['key']};});_0x39285f[_0x9dad('0x21')]=_[_0x9dad('0x1d')](_0x4cc43b,'name');_0x39285f['query']=_['keys'](_0x5d16ef[_0x9dad('0x22')]);_0x39285f['filters']=_['intersection'](_0x39285f[_0x9dad('0x21')],_0x39285f[_0x9dad('0x22')]);_0x2fbfe5[_0x9dad('0x23')]=_[_0x9dad('0x24')](_0x39285f[_0x9dad('0x21')],qs[_0x9dad('0x25')](_0x5d16ef[_0x9dad('0x22')][_0x9dad('0x25')]));_0x2fbfe5['attributes']=_0x2fbfe5[_0x9dad('0x23')][_0x9dad('0x26')]?_0x2fbfe5[_0x9dad('0x23')]:_0x39285f[_0x9dad('0x21')];if(!_0x5d16ef[_0x9dad('0x22')][_0x9dad('0x27')](_0x9dad('0x28'))){_0x2fbfe5['limit']=qs['limit'](_0x5d16ef[_0x9dad('0x22')][_0x9dad('0x14')]);_0x2fbfe5[_0x9dad('0x13')]=qs[_0x9dad('0x13')](_0x5d16ef[_0x9dad('0x22')][_0x9dad('0x13')]);}_0x2fbfe5[_0x9dad('0x29')]=qs[_0x9dad('0x2a')](_0x5d16ef['query'][_0x9dad('0x2a')]);_0x2fbfe5[_0x9dad('0x2b')]=qs[_0x9dad('0x2c')](_[_0x9dad('0x2d')](_0x5d16ef[_0x9dad('0x22')],_0x39285f['filters']),_0x4cc43b);if(_0x5d16ef[_0x9dad('0x22')][_0x9dad('0x2e')]){_0x2fbfe5[_0x9dad('0x2b')]=_[_0x9dad('0x2f')](_0x2fbfe5[_0x9dad('0x2b')],{'$or':_[_0x9dad('0x1d')](_0x4cc43b,function(_0x16d0b5){if(_0x16d0b5[_0x9dad('0x20')]!==_0x9dad('0x30')){var _0x18d3c9={};_0x18d3c9[_0x16d0b5['name']]={'$like':'%'+_0x5d16ef['query'][_0x9dad('0x2e')]+'%'};return _0x18d3c9;}})});}_0x2fbfe5=_[_0x9dad('0x2f')]({},_0x2fbfe5,_0x5d16ef['options']);var _0x189333={'where':_0x2fbfe5[_0x9dad('0x2b')]};return db[_0x9dad('0x1e')][_0x9dad('0x15')](_0x189333)['then'](function(_0x22d28a){_0x425283[_0x9dad('0x15')]=_0x22d28a;if(_0x5d16ef[_0x9dad('0x22')][_0x9dad('0x31')]){_0x2fbfe5[_0x9dad('0x32')]=[{'all':!![]}];}return db[_0x9dad('0x1e')]['findAll'](_0x2fbfe5);})[_0x9dad('0x19')](function(_0x25dbed){_0x425283[_0x9dad('0x33')]=_0x25dbed;return _0x425283;})[_0x9dad('0x19')](respondWithFilteredResult(_0x11b0fb,_0x2fbfe5))[_0x9dad('0x10')](handleError(_0x11b0fb,null));};exports[_0x9dad('0x34')]=function(_0x118d22,_0x1d4929){var _0x185215={'raw':!![],'where':{'id':_0x118d22[_0x9dad('0x35')]['id']}},_0x51a910={};_0x51a910[_0x9dad('0x21')]=_['keys'](db[_0x9dad('0x1e')]['rawAttributes']);_0x51a910[_0x9dad('0x22')]=_['keys'](_0x118d22['query']);_0x51a910[_0x9dad('0x2c')]=_[_0x9dad('0x24')](_0x51a910[_0x9dad('0x21')],_0x51a910['query']);_0x185215[_0x9dad('0x23')]=_[_0x9dad('0x24')](_0x51a910['model'],qs[_0x9dad('0x25')](_0x118d22[_0x9dad('0x22')][_0x9dad('0x25')]));_0x185215[_0x9dad('0x23')]=_0x185215[_0x9dad('0x23')][_0x9dad('0x26')]?_0x185215[_0x9dad('0x23')]:_0x51a910['model'];if(_0x118d22[_0x9dad('0x22')][_0x9dad('0x31')]){_0x185215[_0x9dad('0x32')]=[{'all':!![]}];}_0x185215=_[_0x9dad('0x2f')]({},_0x185215,_0x118d22['options']);return db[_0x9dad('0x1e')][_0x9dad('0x36')](_0x185215)[_0x9dad('0x19')](handleEntityNotFound(_0x1d4929,null))[_0x9dad('0x19')](respondWithResult(_0x1d4929,null))[_0x9dad('0x10')](handleError(_0x1d4929,null));};exports[_0x9dad('0x37')]=function(_0x5d5770,_0x5505d3){var _0x291dad;return db[_0x9dad('0x1e')][_0x9dad('0x37')](_0x5d5770['body'],{'raw':!![]})[_0x9dad('0x19')](function(_0x12790c){_0x291dad=_0x12790c;return db['Network'][_0x9dad('0x38')]({'where':{'type':_0x5d5770[_0x9dad('0x39')][_0x9dad('0x20')]},'raw':!![]});})['then'](function(_0x3c042b){if(_0x291dad[_0x9dad('0x20')][_0x9dad('0x3a')]()==_0x9dad('0x3b')){var _0x18b041=fs[_0x9dad('0x3c')](path['join'](config[_0x9dad('0x3d')],_0x9dad('0x3e')),_0x9dad('0x3f'));var _0x3658a7=ejs[_0x9dad('0x40')](_0x18b041,{'networks':_0x3c042b||[]});fs['writeFileSync'](_0x9dad('0x41'),_0x3658a7);return respondWithRpcPromise('Reload','create',{'module':_0x9dad('0x42')});}else if(_0x291dad[_0x9dad('0x20')][_0x9dad('0x3a')]()==_0x9dad('0x43')){var _0x37aafb=fs[_0x9dad('0x3c')](path[_0x9dad('0x44')](config[_0x9dad('0x3d')],_0x9dad('0x45')),'utf8');var _0x4cc346=ejs[_0x9dad('0x40')](_0x37aafb,{'networks':_0x3c042b||[]});fs[_0x9dad('0x46')](_0x9dad('0x47'),_0x4cc346);return respondWithRpcPromise(_0x9dad('0x48'),_0x9dad('0x37'),{'module':_0x9dad('0x42')});}else{var _0x2f31cc=fs[_0x9dad('0x3c')](path[_0x9dad('0x44')](config[_0x9dad('0x3d')],_0x9dad('0x49')),_0x9dad('0x3f'));var _0xd13f3b=ejs[_0x9dad('0x40')](_0x2f31cc,{'networks':_0x3c042b||[]});fs['writeFileSync'](util[_0x9dad('0x4a')]('/etc/asterisk/sip_xcally_%s.conf',_0x5d5770[_0x9dad('0x39')][_0x9dad('0x20')][_0x9dad('0x4b')]()),_0xd13f3b);return respondWithRpcPromise(_0x9dad('0x48'),'create',{'module':_0x9dad('0x4c')});}})[_0x9dad('0x19')](function(){return _0x291dad;})[_0x9dad('0x19')](respondWithResult(_0x5505d3,0xc9))['catch'](handleError(_0x5505d3,null));};exports[_0x9dad('0x18')]=function(_0xa35cfd,_0x482a63){var _0x15b8b2;return db[_0x9dad('0x1e')][_0x9dad('0x36')]({'where':{'id':_0xa35cfd['params']['id']}})[_0x9dad('0x19')](handleEntityNotFound(_0x482a63,null))[_0x9dad('0x19')](saveUpdates(_0xa35cfd[_0x9dad('0x39')],null))['then'](function(_0x1c1bae){if(_0x1c1bae){_0x15b8b2=_0x1c1bae;return db[_0x9dad('0x1e')]['findAll']({'where':{'type':_0x15b8b2[_0x9dad('0x20')]},'raw':!![]});}return null;})[_0x9dad('0x19')](function(_0x423629){if(_0x15b8b2[_0x9dad('0x20')][_0x9dad('0x3a')]()==_0x9dad('0x3b')){var _0x31f5f6=fs[_0x9dad('0x3c')](path[_0x9dad('0x44')](config[_0x9dad('0x3d')],_0x9dad('0x3e')),_0x9dad('0x3f'));var _0x1dcae6=ejs[_0x9dad('0x40')](_0x31f5f6,{'networks':_0x423629||[]});fs[_0x9dad('0x46')](_0x9dad('0x41'),_0x1dcae6);return respondWithRpcPromise('Reload',_0x9dad('0x18'),{'module':_0x9dad('0x42')});}else if(_0x15b8b2[_0x9dad('0x20')]['toUpperCase']()==_0x9dad('0x43')){var _0x4d8c15=fs[_0x9dad('0x3c')](path[_0x9dad('0x44')](config['root'],_0x9dad('0x45')),'utf8');var _0x240fb7=ejs[_0x9dad('0x40')](_0x4d8c15,{'networks':_0x423629||[]});fs['writeFileSync'](_0x9dad('0x47'),_0x240fb7);return respondWithRpcPromise(_0x9dad('0x48'),_0x9dad('0x18'),{'module':_0x9dad('0x42')});}else{var _0x10f7c6=fs['readFileSync'](path[_0x9dad('0x44')](config['root'],'server/files/templates/network.ejs'),_0x9dad('0x3f'));var _0x30dacf=ejs[_0x9dad('0x40')](_0x10f7c6,{'networks':_0x423629||[]});fs[_0x9dad('0x46')](util[_0x9dad('0x4a')](_0x9dad('0x4d'),_0xa35cfd[_0x9dad('0x39')][_0x9dad('0x20')][_0x9dad('0x4b')]()),_0x30dacf);return respondWithRpcPromise(_0x9dad('0x48'),'update',{'module':_0x9dad('0x4c')});}})[_0x9dad('0x19')](function(_0x39e9c2){if(_0x39e9c2){return _0x15b8b2;}return null;})[_0x9dad('0x19')](respondWithResult(_0x482a63,null))[_0x9dad('0x10')](handleError(_0x482a63,null));};exports[_0x9dad('0x4e')]=function(_0x38058b,_0x21365c){var _0x1e0c14;return db['Network'][_0x9dad('0x36')]({'where':{'id':_0x38058b[_0x9dad('0x35')]['id']}})[_0x9dad('0x19')](function(_0x5ce58){_0x1e0c14=_0x5ce58;return _0x5ce58;})[_0x9dad('0x19')](handleEntityNotFound(_0x21365c,null))[_0x9dad('0x19')](removeEntity(_0x21365c,null))['then'](function(){if(_0x1e0c14){return db['Network'][_0x9dad('0x38')]({'where':{'type':_0x1e0c14[_0x9dad('0x20')]},'raw':!![]});}})[_0x9dad('0x19')](function(_0x2d2072){if(_0x1e0c14[_0x9dad('0x20')][_0x9dad('0x3a')]()=='STUN'){var _0x3ae2d1=fs['readFileSync'](path[_0x9dad('0x44')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x9dad('0x3f'));var _0x170022=ejs[_0x9dad('0x40')](_0x3ae2d1,{'networks':_0x2d2072||[]});fs['writeFileSync'](_0x9dad('0x41'),_0x170022);return respondWithRpcPromise(_0x9dad('0x48'),_0x9dad('0x4e'),{'module':_0x9dad('0x42')});}else if(_0x1e0c14['type'][_0x9dad('0x3a')]()==_0x9dad('0x43')){var _0x311fe5=fs[_0x9dad('0x3c')](path[_0x9dad('0x44')](config[_0x9dad('0x3d')],_0x9dad('0x45')),_0x9dad('0x3f'));var _0x94db7=ejs[_0x9dad('0x40')](_0x311fe5,{'networks':_0x2d2072||[]});fs[_0x9dad('0x46')](_0x9dad('0x47'),_0x94db7);return respondWithRpcPromise(_0x9dad('0x48'),_0x9dad('0x4e'),{'module':_0x9dad('0x42')});}else{var _0x222340=fs['readFileSync'](path[_0x9dad('0x44')](config['root'],_0x9dad('0x49')),_0x9dad('0x3f'));var _0x59e5c4=ejs[_0x9dad('0x40')](_0x222340,{'networks':_0x2d2072||[]});fs[_0x9dad('0x46')](util[_0x9dad('0x4a')](_0x9dad('0x4d'),_0x1e0c14[_0x9dad('0x20')][_0x9dad('0x4b')]()),_0x59e5c4);return respondWithRpcPromise(_0x9dad('0x48'),_0x9dad('0x4e'),{'module':_0x9dad('0x4c')});}})[_0x9dad('0x10')](handleError(_0x21365c,null));}; \ No newline at end of file +var _0x4206=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','rows','catch','show','includeAll','find','create','findAll','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','readFileSync','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','chan_sip.so','params','format','/etc/asterisk/sip_xcally_%s.conf','TURN','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','offset','undefined','count','status','set','Content-Range','json','update','destroy','sendStatus','stack','name','index','map','Network'];(function(_0x19fa24,_0x249b23){var _0x5decaf=function(_0x359ded){while(--_0x359ded){_0x19fa24['push'](_0x19fa24['shift']());}};_0x5decaf(++_0x249b23);}(_0x4206,0x132));var _0x6420=function(_0x49b775,_0x37f97f){_0x49b775=_0x49b775-0x0;var _0xe31ed5=_0x4206[_0x49b775];return _0xe31ed5;};'use strict';var util=require(_0x6420('0x0'));var path=require(_0x6420('0x1'));var ejs=require(_0x6420('0x2'));var fs=require('fs');var _=require(_0x6420('0x3'));var qs=require(_0x6420('0x4'));var logger=require(_0x6420('0x5'))(_0x6420('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x6420('0x7'));var client=jayson[_0x6420('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7d57ac,_0x1fc988,_0x51d217,_0xd36cf4){return new Promise(function(_0x1fac52,_0x2db75d){var _0x30b754=_0xd36cf4||client;return _0x30b754[_0x6420('0x9')](_0x7d57ac,_0x51d217)[_0x6420('0xa')](function(_0x40ca2b){logger['info']('Network,\x20%s,\x20%s',_0x1fc988,_0x6420('0xb'));logger[_0x6420('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x1fc988,_0x6420('0xb'),JSON[_0x6420('0xd')](_0x40ca2b));if(_0x40ca2b[_0x6420('0xe')]){if(_0x40ca2b[_0x6420('0xe')][_0x6420('0xf')]===0x1f4){logger[_0x6420('0xe')](_0x6420('0x10'),_0x1fc988,_0x40ca2b[_0x6420('0xe')][_0x6420('0x11')]);return _0x2db75d(_0x40ca2b[_0x6420('0xe')][_0x6420('0x11')]);}logger[_0x6420('0xe')](_0x6420('0x10'),_0x1fc988,_0x40ca2b[_0x6420('0xe')]['message']);return _0x1fac52(_0x40ca2b['error']['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x1fc988,_0x6420('0xb'));_0x1fac52(_0x40ca2b[_0x6420('0x12')][_0x6420('0x11')]);}})['catch'](function(_0x3acad9){logger[_0x6420('0xe')]('Network,\x20%s,\x20%s',_0x1fc988,_0x3acad9);_0x2db75d(_0x3acad9);});});}function respondWithResult(_0x3abd07,_0x179ac0){_0x179ac0=_0x179ac0||0xc8;return function(_0x2eebac){if(_0x2eebac){return _0x3abd07['status'](_0x179ac0)['json'](_0x2eebac);}};}function respondWithFilteredResult(_0x1cf5dd,_0x26c421){return function(_0xa0ded4){if(_0xa0ded4){var _0x6edbca=typeof _0x26c421[_0x6420('0x13')]===_0x6420('0x14')&&typeof _0x26c421['limit']===_0x6420('0x14');var _0x10f8f6=_0xa0ded4['count'];var _0x5e3681=_0x6edbca?0x0:_0x26c421[_0x6420('0x13')];var _0x332aab=_0x6edbca?_0xa0ded4[_0x6420('0x15')]:_0x26c421[_0x6420('0x13')]+_0x26c421['limit'];var _0x5d0bcb;if(_0x332aab>=_0x10f8f6){_0x332aab=_0x10f8f6;_0x5d0bcb=0xc8;}else{_0x5d0bcb=0xce;}_0x1cf5dd[_0x6420('0x16')](_0x5d0bcb);return _0x1cf5dd[_0x6420('0x17')](_0x6420('0x18'),_0x5e3681+'-'+_0x332aab+'/'+_0x10f8f6)[_0x6420('0x19')](_0xa0ded4);}return null;};}function saveUpdates(_0xeec86){return function(_0x13e460){if(_0x13e460){return _0x13e460[_0x6420('0x1a')](_0xeec86)[_0x6420('0xa')](function(_0xe17a2){return _0xe17a2;});}return null;};}function removeEntity(_0x233362){return function(_0xc60685){if(_0xc60685){return _0xc60685[_0x6420('0x1b')]()[_0x6420('0xa')](function(){_0x233362[_0x6420('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x841a3f){return function(_0x1a0445){if(!_0x1a0445){_0x841a3f[_0x6420('0x1c')](0x194);}return _0x1a0445;};}function handleError(_0x3d83ff,_0x573971){_0x573971=_0x573971||0x1f4;return function(_0x1c3fb0){logger[_0x6420('0xe')](_0x1c3fb0[_0x6420('0x1d')]);if(_0x1c3fb0[_0x6420('0x1e')]){delete _0x1c3fb0[_0x6420('0x1e')];}_0x3d83ff['status'](_0x573971)['send'](_0x1c3fb0);};}exports[_0x6420('0x1f')]=function(_0x5260b8,_0x17c4db){var _0xa38094={},_0x4dbb9d={},_0x3abf29={'count':0x0,'rows':[]};var _0x39c428=_[_0x6420('0x20')](db[_0x6420('0x21')][_0x6420('0x22')],function(_0x2617be){return{'name':_0x2617be[_0x6420('0x23')],'type':_0x2617be[_0x6420('0x24')][_0x6420('0x25')]};});_0x4dbb9d[_0x6420('0x26')]=_['map'](_0x39c428,_0x6420('0x1e'));_0x4dbb9d[_0x6420('0x27')]=_[_0x6420('0x28')](_0x5260b8[_0x6420('0x27')]);_0x4dbb9d['filters']=_[_0x6420('0x29')](_0x4dbb9d[_0x6420('0x26')],_0x4dbb9d[_0x6420('0x27')]);_0xa38094[_0x6420('0x2a')]=_[_0x6420('0x29')](_0x4dbb9d[_0x6420('0x26')],qs[_0x6420('0x2b')](_0x5260b8[_0x6420('0x27')][_0x6420('0x2b')]));_0xa38094[_0x6420('0x2a')]=_0xa38094['attributes'][_0x6420('0x2c')]?_0xa38094[_0x6420('0x2a')]:_0x4dbb9d[_0x6420('0x26')];if(!_0x5260b8[_0x6420('0x27')][_0x6420('0x2d')]('nolimit')){_0xa38094[_0x6420('0x2e')]=qs[_0x6420('0x2e')](_0x5260b8[_0x6420('0x27')]['limit']);_0xa38094[_0x6420('0x13')]=qs[_0x6420('0x13')](_0x5260b8[_0x6420('0x27')][_0x6420('0x13')]);}_0xa38094[_0x6420('0x2f')]=qs[_0x6420('0x30')](_0x5260b8[_0x6420('0x27')][_0x6420('0x30')]);_0xa38094[_0x6420('0x31')]=qs[_0x6420('0x32')](_['pick'](_0x5260b8[_0x6420('0x27')],_0x4dbb9d['filters']),_0x39c428);if(_0x5260b8[_0x6420('0x27')][_0x6420('0x33')]){_0xa38094['where']=_['merge'](_0xa38094[_0x6420('0x31')],{'$or':_[_0x6420('0x20')](_0x39c428,function(_0x4e16e3){if(_0x4e16e3[_0x6420('0x24')]!==_0x6420('0x34')){var _0x17f23f={};_0x17f23f[_0x4e16e3['name']]={'$like':'%'+_0x5260b8[_0x6420('0x27')][_0x6420('0x33')]+'%'};return _0x17f23f;}})});}_0xa38094=_[_0x6420('0x35')]({},_0xa38094,_0x5260b8[_0x6420('0x36')]);var _0x14c15b={'where':_0xa38094[_0x6420('0x31')]};return db[_0x6420('0x21')][_0x6420('0x15')](_0x14c15b)[_0x6420('0xa')](function(_0x43c6bb){_0x3abf29[_0x6420('0x15')]=_0x43c6bb;if(_0x5260b8['query']['includeAll']){_0xa38094[_0x6420('0x37')]=[{'all':!![]}];}return db[_0x6420('0x21')]['findAll'](_0xa38094);})[_0x6420('0xa')](function(_0x2c88f5){_0x3abf29[_0x6420('0x38')]=_0x2c88f5;return _0x3abf29;})[_0x6420('0xa')](respondWithFilteredResult(_0x17c4db,_0xa38094))[_0x6420('0x39')](handleError(_0x17c4db,null));};exports[_0x6420('0x3a')]=function(_0x4cf3ee,_0x1cac82){var _0x2a3d41={'raw':!![],'where':{'id':_0x4cf3ee['params']['id']}},_0x4bf18a={};_0x4bf18a['model']=_['keys'](db[_0x6420('0x21')][_0x6420('0x22')]);_0x4bf18a[_0x6420('0x27')]=_[_0x6420('0x28')](_0x4cf3ee[_0x6420('0x27')]);_0x4bf18a['filters']=_[_0x6420('0x29')](_0x4bf18a[_0x6420('0x26')],_0x4bf18a[_0x6420('0x27')]);_0x2a3d41[_0x6420('0x2a')]=_[_0x6420('0x29')](_0x4bf18a[_0x6420('0x26')],qs[_0x6420('0x2b')](_0x4cf3ee[_0x6420('0x27')][_0x6420('0x2b')]));_0x2a3d41[_0x6420('0x2a')]=_0x2a3d41[_0x6420('0x2a')][_0x6420('0x2c')]?_0x2a3d41[_0x6420('0x2a')]:_0x4bf18a[_0x6420('0x26')];if(_0x4cf3ee[_0x6420('0x27')][_0x6420('0x3b')]){_0x2a3d41[_0x6420('0x37')]=[{'all':!![]}];}_0x2a3d41=_['merge']({},_0x2a3d41,_0x4cf3ee[_0x6420('0x36')]);return db[_0x6420('0x21')][_0x6420('0x3c')](_0x2a3d41)[_0x6420('0xa')](handleEntityNotFound(_0x1cac82,null))[_0x6420('0xa')](respondWithResult(_0x1cac82,null))[_0x6420('0x39')](handleError(_0x1cac82,null));};exports[_0x6420('0x3d')]=function(_0x911c94,_0x42d312){var _0x13fbc6;return db['Network'][_0x6420('0x3d')](_0x911c94['body'],{'raw':!![]})[_0x6420('0xa')](function(_0xf488d5){_0x13fbc6=_0xf488d5;return db[_0x6420('0x21')][_0x6420('0x3e')]({'where':{'type':_0x911c94[_0x6420('0x3f')]['type']},'raw':!![]});})['then'](function(_0x17ed76){if(_0x13fbc6['type'][_0x6420('0x40')]()==_0x6420('0x41')){var _0x385168=fs['readFileSync'](path[_0x6420('0x42')](config[_0x6420('0x43')],_0x6420('0x44')),_0x6420('0x45'));var _0x514cb6=ejs['render'](_0x385168,{'networks':_0x17ed76||[]});fs[_0x6420('0x46')](_0x6420('0x47'),_0x514cb6);return respondWithRpcPromise(_0x6420('0x48'),'create',{'module':'res_stun_monitor.so'});}else if(_0x13fbc6['type'][_0x6420('0x40')]()=='TURN'){var _0x58156a=fs[_0x6420('0x49')](path['join'](config[_0x6420('0x43')],_0x6420('0x4a')),_0x6420('0x45'));var _0x11e6a7=ejs[_0x6420('0x4b')](_0x58156a,{'networks':_0x17ed76||[]});fs['writeFileSync'](_0x6420('0x4c'),_0x11e6a7);return respondWithRpcPromise(_0x6420('0x48'),_0x6420('0x3d'),{'module':_0x6420('0x4d')});}else{var _0x5e1fa1=fs[_0x6420('0x49')](path[_0x6420('0x42')](config[_0x6420('0x43')],_0x6420('0x4e')),_0x6420('0x45'));var _0x405021=ejs[_0x6420('0x4b')](_0x5e1fa1,{'networks':_0x17ed76||[]});fs[_0x6420('0x46')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x911c94[_0x6420('0x3f')][_0x6420('0x24')]['toLowerCase']()),_0x405021);return respondWithRpcPromise(_0x6420('0x48'),'create',{'module':_0x6420('0x4f')});}})[_0x6420('0xa')](function(){return _0x13fbc6;})[_0x6420('0xa')](respondWithResult(_0x42d312,0xc9))[_0x6420('0x39')](handleError(_0x42d312,null));};exports[_0x6420('0x1a')]=function(_0x56d73f,_0x410620){var _0x526a9a;return db[_0x6420('0x21')][_0x6420('0x3c')]({'where':{'id':_0x56d73f[_0x6420('0x50')]['id']}})[_0x6420('0xa')](handleEntityNotFound(_0x410620,null))[_0x6420('0xa')](saveUpdates(_0x56d73f[_0x6420('0x3f')],null))[_0x6420('0xa')](function(_0xda5e68){if(_0xda5e68){_0x526a9a=_0xda5e68;return db[_0x6420('0x21')][_0x6420('0x3e')]({'where':{'type':_0x526a9a[_0x6420('0x24')]},'raw':!![]});}return null;})[_0x6420('0xa')](function(_0x3d71c4){if(_0x526a9a[_0x6420('0x24')]['toUpperCase']()==_0x6420('0x41')){var _0x3074f4=fs[_0x6420('0x49')](path[_0x6420('0x42')](config[_0x6420('0x43')],_0x6420('0x44')),_0x6420('0x45'));var _0x3fb2e6=ejs[_0x6420('0x4b')](_0x3074f4,{'networks':_0x3d71c4||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x3fb2e6);return respondWithRpcPromise(_0x6420('0x48'),_0x6420('0x1a'),{'module':_0x6420('0x4d')});}else if(_0x526a9a[_0x6420('0x24')][_0x6420('0x40')]()=='TURN'){var _0x512e05=fs[_0x6420('0x49')](path[_0x6420('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x6420('0x45'));var _0x5b631c=ejs[_0x6420('0x4b')](_0x512e05,{'networks':_0x3d71c4||[]});fs[_0x6420('0x46')]('/etc/asterisk/turn_xcally.conf',_0x5b631c);return respondWithRpcPromise(_0x6420('0x48'),_0x6420('0x1a'),{'module':_0x6420('0x4d')});}else{var _0x1dfb65=fs[_0x6420('0x49')](path[_0x6420('0x42')](config[_0x6420('0x43')],_0x6420('0x4e')),_0x6420('0x45'));var _0x5977c7=ejs[_0x6420('0x4b')](_0x1dfb65,{'networks':_0x3d71c4||[]});fs[_0x6420('0x46')](util[_0x6420('0x51')](_0x6420('0x52'),_0x56d73f['body'][_0x6420('0x24')]['toLowerCase']()),_0x5977c7);return respondWithRpcPromise('Reload',_0x6420('0x1a'),{'module':'chan_sip.so'});}})['then'](function(_0xb7b9c6){if(_0xb7b9c6){return _0x526a9a;}return null;})[_0x6420('0xa')](respondWithResult(_0x410620,null))[_0x6420('0x39')](handleError(_0x410620,null));};exports['destroy']=function(_0x11b22b,_0x5ad885){var _0x685225;return db['Network'][_0x6420('0x3c')]({'where':{'id':_0x11b22b[_0x6420('0x50')]['id']}})['then'](function(_0x346d4a){_0x685225=_0x346d4a;return _0x346d4a;})[_0x6420('0xa')](handleEntityNotFound(_0x5ad885,null))['then'](removeEntity(_0x5ad885,null))[_0x6420('0xa')](function(){if(_0x685225){return db[_0x6420('0x21')]['findAll']({'where':{'type':_0x685225[_0x6420('0x24')]},'raw':!![]});}})[_0x6420('0xa')](function(_0x41efa4){if(_0x685225[_0x6420('0x24')][_0x6420('0x40')]()==_0x6420('0x41')){var _0x276e53=fs['readFileSync'](path['join'](config[_0x6420('0x43')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x4b108b=ejs['render'](_0x276e53,{'networks':_0x41efa4||[]});fs['writeFileSync'](_0x6420('0x47'),_0x4b108b);return respondWithRpcPromise(_0x6420('0x48'),'destroy',{'module':_0x6420('0x4d')});}else if(_0x685225[_0x6420('0x24')][_0x6420('0x40')]()==_0x6420('0x53')){var _0x16bafc=fs[_0x6420('0x49')](path[_0x6420('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x530832=ejs[_0x6420('0x4b')](_0x16bafc,{'networks':_0x41efa4||[]});fs[_0x6420('0x46')](_0x6420('0x4c'),_0x530832);return respondWithRpcPromise('Reload',_0x6420('0x1b'),{'module':_0x6420('0x4d')});}else{var _0x70f892=fs[_0x6420('0x49')](path[_0x6420('0x42')](config[_0x6420('0x43')],_0x6420('0x4e')),_0x6420('0x45'));var _0x5a942f=ejs[_0x6420('0x4b')](_0x70f892,{'networks':_0x41efa4||[]});fs['writeFileSync'](util[_0x6420('0x51')](_0x6420('0x52'),_0x685225[_0x6420('0x24')][_0x6420('0x54')]()),_0x5a942f);return respondWithRpcPromise(_0x6420('0x48'),_0x6420('0x1b'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x5ad885,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 71f05f9..b26fc94 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 _0xf72b=['./network.attributes','exports','define','Network','network','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2ff0f7,_0x57969a){var _0x5cff8a=function(_0x3ec104){while(--_0x3ec104){_0x2ff0f7['push'](_0x2ff0f7['shift']());}};_0x5cff8a(++_0x57969a);}(_0xf72b,0x1d9));var _0xbf72=function(_0x2d113e,_0x3589f0){_0x2d113e=_0x2d113e-0x0;var _0x3e8082=_0xf72b[_0x2d113e];return _0x3e8082;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var logger=require(_0xbf72('0x1'))('api');var moment=require(_0xbf72('0x2'));var BPromise=require(_0xbf72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf72('0x4'));var rimraf=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var attributes=require(_0xbf72('0x7'));module[_0xbf72('0x8')]=function(_0x2b8440,_0x5ee060){return _0x2b8440[_0xbf72('0x9')](_0xbf72('0xa'),attributes,{'tableName':_0xbf72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e9f=['moment','path','./network.attributes','exports','Network','network','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0e9f,0x116));var _0xf0e9=function(_0x4563b2,_0x30a2bb){_0x4563b2=_0x4563b2-0x0;var _0x972995=_0x0e9f[_0x4563b2];return _0x972995;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf0e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0e9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0e9('0x4'));module[_0xf0e9('0x5')]=function(_0x59ac7e,_0x2322dc){return _0x59ac7e['define'](_0xf0e9('0x6'),attributes,{'tableName':_0xf0e9('0x7'),'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 85a46ae..8e2f08d 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x2222bd,_0x4a5465){_0x2222bd=_0x2222bd-0x0;var _0x52cffa=_0x7a54[_0x2222bd];return _0x52cffa;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x418b2e,_0x2604a4){var _0x48d9d6=function(_0x37fa66){while(--_0x37fa66){_0x418b2e['push'](_0x418b2e['shift']());}};_0x48d9d6(++_0x2604a4);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('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 30d238f..f05c65a 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 _0xa701=['addDisposition','addAnswer','/:id/notify','addAgents','/:id/send','send','put','destroy','removeDispositions','removeAnswers','delete','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/dispositions'];(function(_0x36c072,_0x413a2c){var _0x40c93e=function(_0x3e5e1f){while(--_0x3e5e1f){_0x36c072['push'](_0x36c072['shift']());}};_0x40c93e(++_0x413a2c);}(_0xa701,0x17f));var _0x1a70=function(_0x2027a5,_0x24d744){_0x2027a5=_0x2027a5-0x0;var _0x537ee2=_0xa701[_0x2027a5];return _0x537ee2;};'use strict';var multer=require(_0x1a70('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1a70('0x1'));var express=require(_0x1a70('0x2'));var router=express[_0x1a70('0x3')]();var fs_extra=require(_0x1a70('0x4'));var auth=require(_0x1a70('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a70('0x6'));var controller=require(_0x1a70('0x7'));router[_0x1a70('0x8')]('/',auth[_0x1a70('0x9')](),controller['index']);router[_0x1a70('0x8')](_0x1a70('0xa'),auth[_0x1a70('0x9')](),controller[_0x1a70('0xb')]);router['get'](_0x1a70('0xc'),auth[_0x1a70('0x9')](),controller[_0x1a70('0xd')]);router[_0x1a70('0x8')]('/:id/dispositions',auth[_0x1a70('0x9')](),controller['getDispositions']);router[_0x1a70('0x8')](_0x1a70('0xe'),auth[_0x1a70('0x9')](),controller[_0x1a70('0xf')]);router[_0x1a70('0x8')](_0x1a70('0x10'),auth['isAuthenticated'](),controller[_0x1a70('0x11')]);router[_0x1a70('0x8')](_0x1a70('0x12'),auth['isAuthenticated'](),controller[_0x1a70('0x13')]);router[_0x1a70('0x8')](_0x1a70('0x14'),auth[_0x1a70('0x9')](),controller[_0x1a70('0x15')]);router[_0x1a70('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a70('0x16')](_0x1a70('0x17'),auth[_0x1a70('0x9')](),controller[_0x1a70('0x18')]);router[_0x1a70('0x16')](_0x1a70('0xe'),auth['isAuthenticated'](),controller[_0x1a70('0x19')]);router[_0x1a70('0x16')](_0x1a70('0x1a'),controller['notify']);router[_0x1a70('0x16')](_0x1a70('0x10'),auth[_0x1a70('0x9')](),controller['addApplications']);router[_0x1a70('0x16')](_0x1a70('0x14'),auth[_0x1a70('0x9')](),controller[_0x1a70('0x1b')]);router[_0x1a70('0x16')](_0x1a70('0x1c'),auth[_0x1a70('0x9')](),controller[_0x1a70('0x1d')]);router[_0x1a70('0x1e')](_0x1a70('0xc'),auth[_0x1a70('0x9')](),controller['update']);router['delete'](_0x1a70('0xc'),auth['isAuthenticated'](),controller[_0x1a70('0x1f')]);router['delete'](_0x1a70('0x17'),auth[_0x1a70('0x9')](),controller[_0x1a70('0x20')]);router['delete']('/:id/canned_answers',auth[_0x1a70('0x9')](),controller[_0x1a70('0x21')]);router[_0x1a70('0x22')](_0x1a70('0x14'),auth[_0x1a70('0x9')](),controller[_0x1a70('0x23')]);module[_0x1a70('0x24')]=router; \ No newline at end of file +var _0x0aef=['../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x173269,_0x1c28da){var _0x3b411d=function(_0x43a298){while(--_0x43a298){_0x173269['push'](_0x173269['shift']());}};_0x3b411d(++_0x1c28da);}(_0x0aef,0x16c));var _0xf0ae=function(_0x304f83,_0x918b71){_0x304f83=_0x304f83-0x0;var _0x39d25b=_0x0aef[_0x304f83];return _0x39d25b;};'use strict';var multer=require('multer');var util=require(_0xf0ae('0x0'));var path=require(_0xf0ae('0x1'));var timeout=require(_0xf0ae('0x2'));var express=require(_0xf0ae('0x3'));var router=express[_0xf0ae('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf0ae('0x5'));var interaction=require(_0xf0ae('0x6'));var config=require('../../config/environment');var controller=require(_0xf0ae('0x7'));router[_0xf0ae('0x8')]('/',auth[_0xf0ae('0x9')](),controller[_0xf0ae('0xa')]);router[_0xf0ae('0x8')](_0xf0ae('0xb'),auth[_0xf0ae('0x9')](),controller['describe']);router[_0xf0ae('0x8')](_0xf0ae('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf0ae('0x8')](_0xf0ae('0xd'),auth[_0xf0ae('0x9')](),controller['getDispositions']);router[_0xf0ae('0x8')](_0xf0ae('0xe'),auth['isAuthenticated'](),controller[_0xf0ae('0xf')]);router[_0xf0ae('0x8')](_0xf0ae('0x10'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x11')]);router[_0xf0ae('0x8')](_0xf0ae('0x12'),auth[_0xf0ae('0x9')](),controller['getInteractions']);router[_0xf0ae('0x8')](_0xf0ae('0x13'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x14')]);router[_0xf0ae('0x15')]('/',auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x16')]);router[_0xf0ae('0x15')](_0xf0ae('0xd'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x17')]);router['post']('/:id/canned_answers',auth[_0xf0ae('0x9')](),controller['addAnswer']);router['post'](_0xf0ae('0x18'),controller[_0xf0ae('0x19')]);router[_0xf0ae('0x15')](_0xf0ae('0x10'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x1a')]);router[_0xf0ae('0x15')](_0xf0ae('0x13'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x1b')]);router['post'](_0xf0ae('0x1c'),auth['isAuthenticated'](),controller['send']);router[_0xf0ae('0x1d')](_0xf0ae('0xc'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x1e')]);router['delete']('/:id',auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x1f')]);router[_0xf0ae('0x20')](_0xf0ae('0xd'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x21')]);router[_0xf0ae('0x20')](_0xf0ae('0xe'),auth['isAuthenticated'](),controller[_0xf0ae('0x22')]);router[_0xf0ae('0x20')](_0xf0ae('0x13'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x23')]);module[_0xf0ae('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 1e32efd..73c1a2c 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 _0x9a0b=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x6f6f7b,_0x2a216d){var _0x53ad2e=function(_0x20796a){while(--_0x20796a){_0x6f6f7b['push'](_0x6f6f7b['shift']());}};_0x53ad2e(++_0x2a216d);}(_0x9a0b,0x1f2));var _0xb9a0=function(_0xa60c7c,_0xc70f6b){_0xa60c7c=_0xa60c7c-0x0;var _0x409313=_0x9a0b[_0xa60c7c];return _0x409313;};'use strict';var Sequelize=require(_0xb9a0('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xb9a0('0x1')],'unique':_0xb9a0('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb9a0('0x1')]},'token':{'type':Sequelize[_0xb9a0('0x1')],'defaultValue':function(){return rs[_0xb9a0('0x3')]();}},'replyUri':{'type':Sequelize[_0xb9a0('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb9a0('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb9a0('0x4')],'defaultValue':function(){return _0xb9a0('0x5');}},'notificationSound':{'type':Sequelize[_0xb9a0('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb9a0('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb9a0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb9a0('0x1')]},'queueTransfer':{'type':Sequelize[_0xb9a0('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb9a0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb9a0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb9a0('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xb9a0('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xb9a0('0x6')],'defaultValue':![],'comment':_0xb9a0('0x9'),'set':function(_0x2c6a5e){if(!_0x2c6a5e)this['setDataValue'](_0xb9a0('0xa'),null);this[_0xb9a0('0xb')](_0xb9a0('0xc'),_0x2c6a5e);}}}; \ No newline at end of file +var _0xd9db=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x450aeb,_0x599bf6){var _0x2126ce=function(_0x52b4f2){while(--_0x52b4f2){_0x450aeb['push'](_0x450aeb['shift']());}};_0x2126ce(++_0x599bf6);}(_0xd9db,0x147));var _0xbd9d=function(_0x1cb26e,_0x2be57a){_0x1cb26e=_0x1cb26e-0x0;var _0x5ce8b2=_0xd9db[_0x1cb26e];return _0x5ce8b2;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xbd9d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xbd9d('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xbd9d('0x2')]},'token':{'type':Sequelize[_0xbd9d('0x2')],'defaultValue':function(){return rs[_0xbd9d('0x3')]();}},'replyUri':{'type':Sequelize[_0xbd9d('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbd9d('0x4')],'defaultValue':function(){return _0xbd9d('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbd9d('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbd9d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbd9d('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbd9d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbd9d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xbd9d('0x7')],'defaultValue':![],'comment':_0xbd9d('0x9'),'set':function(_0x78c461){if(!_0x78c461)this['setDataValue'](_0xbd9d('0xa'),null);this['setDataValue'](_0xbd9d('0xb'),_0x78c461);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d5422dc..e0aef6e 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 _0xf9fd=['CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','account','applications','Applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','send','getApplications','Contact','Owner','fullname','internal','Tag','tag','addAgents','omit','userOpenchannelAccount:save','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','dataValues','Messages','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','findAll','show','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','order','rows','removeDispositions','ids','addAnswer'];(function(_0x24b043,_0x1bc6be){var _0x360404=function(_0xa19182){while(--_0xa19182){_0x24b043['push'](_0x24b043['shift']());}};_0x360404(++_0x1bc6be);}(_0xf9fd,0x118));var _0xdf9f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf9fd[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xdf9f('0x0'));var rimraf=require(_0xdf9f('0x1'));var zipdir=require(_0xdf9f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf9f('0x3'));var moment=require(_0xdf9f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdf9f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdf9f('0x6'));var csv=require('to-csv');var ejs=require(_0xdf9f('0x7'));var fs=require('fs');var fs_extra=require(_0xdf9f('0x8'));var _=require('lodash');var squel=require(_0xdf9f('0x9'));var crypto=require(_0xdf9f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdf9f('0xb'));var toCsv=require(_0xdf9f('0xc'));var querystring=require('querystring');var Papa=require(_0xdf9f('0xd'));var Redis=require(_0xdf9f('0xe'));var authService=require(_0xdf9f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdf9f('0x10'));var hardwareService=require(_0xdf9f('0x11'));var logger=require(_0xdf9f('0x12'))(_0xdf9f('0x13'));var utils=require(_0xdf9f('0x14'));var config=require(_0xdf9f('0x15'));var licenseUtil=require(_0xdf9f('0x16'));var db=require(_0xdf9f('0x17'))['db'];config['redis']=_[_0xdf9f('0x18')](config['redis'],{'host':_0xdf9f('0x19'),'port':0x18eb});var socket=require(_0xdf9f('0x1a'))(new Redis(config[_0xdf9f('0x1b')]));require(_0xdf9f('0x1c'))[_0xdf9f('0x1d')](socket);var jayson=require(_0xdf9f('0x1e'));var client=jayson[_0xdf9f('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xdf9f('0x1f')][_0xdf9f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x180627,_0x6fb173,_0x4bac62,_0x33e541){return new BPromise(function(_0x4885d4,_0x387d15){var _0x1205c2=_0x33e541||client;return _0x1205c2[_0xdf9f('0x21')](_0x180627,_0x4bac62)[_0xdf9f('0x22')](function(_0x552b3b){logger[_0xdf9f('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x6fb173,_0xdf9f('0x24'));logger[_0xdf9f('0x25')](_0xdf9f('0x26'),_0x6fb173,_0xdf9f('0x24'),JSON[_0xdf9f('0x27')](_0x552b3b));if(_0x552b3b[_0xdf9f('0x28')]){if(_0x552b3b[_0xdf9f('0x28')]['code']===0x1f4){logger[_0xdf9f('0x28')](_0xdf9f('0x29'),_0x6fb173,_0x552b3b['error'][_0xdf9f('0x2a')]);return _0x387d15(_0x552b3b['error'][_0xdf9f('0x2a')]);}logger[_0xdf9f('0x28')](_0xdf9f('0x29'),_0x6fb173,_0x552b3b[_0xdf9f('0x28')][_0xdf9f('0x2a')]);return _0x4885d4(_0x552b3b[_0xdf9f('0x28')]['message']);}else{logger['info'](_0xdf9f('0x29'),_0x6fb173,_0xdf9f('0x24'));_0x4885d4(_0x552b3b[_0xdf9f('0x2b')][_0xdf9f('0x2a')]);}})[_0xdf9f('0x2c')](function(_0x2ce75d){logger[_0xdf9f('0x28')](_0xdf9f('0x29'),_0x6fb173,_0x2ce75d);_0x387d15(_0x2ce75d);});});}function respondWithStatusCode(_0x4c96bc,_0x3a3e74){_0x3a3e74=_0x3a3e74||0xcc;return function(_0x5b82b1){if(_0x5b82b1){return _0x4c96bc[_0xdf9f('0x2d')](_0x3a3e74);}return _0x4c96bc[_0xdf9f('0x2e')](_0x3a3e74)[_0xdf9f('0x2f')]();};}function respondWithResult(_0x2955b5,_0x57b516){_0x57b516=_0x57b516||0xc8;return function(_0x495c0b){if(_0x495c0b){return _0x2955b5[_0xdf9f('0x2e')](_0x57b516)[_0xdf9f('0x30')](_0x495c0b);}};}function respondWithFilteredResult(_0x37ad46,_0x498805){return function(_0x3dc6f0){if(_0x3dc6f0){var _0x1d1867=typeof _0x498805[_0xdf9f('0x31')]==='undefined'&&typeof _0x498805[_0xdf9f('0x32')]==='undefined';var _0x3fad42=_0x3dc6f0[_0xdf9f('0x33')];var _0x2793c6=_0x1d1867?0x0:_0x498805[_0xdf9f('0x31')];var _0x549cba=_0x1d1867?_0x3dc6f0[_0xdf9f('0x33')]:_0x498805['offset']+_0x498805[_0xdf9f('0x32')];var _0x29846c;if(_0x549cba>=_0x3fad42){_0x549cba=_0x3fad42;_0x29846c=0xc8;}else{_0x29846c=0xce;}_0x37ad46['status'](_0x29846c);return _0x37ad46[_0xdf9f('0x34')](_0xdf9f('0x35'),_0x2793c6+'-'+_0x549cba+'/'+_0x3fad42)[_0xdf9f('0x30')](_0x3dc6f0);}return null;};}function patchUpdates(_0x2068f8){return function(_0x47b955){try{jsonpatch[_0xdf9f('0x36')](_0x47b955,_0x2068f8,!![]);}catch(_0x4e9d2a){return BPromise['reject'](_0x4e9d2a);}return _0x47b955[_0xdf9f('0x37')]();};}function saveUpdates(_0x174347,_0x3f6e0f){return function(_0x5998ce){if(_0x5998ce){return _0x5998ce[_0xdf9f('0x38')](_0x174347)['then'](function(_0x867d49){return _0x867d49;});}return null;};}function removeEntity(_0x2c2d1a,_0x510c8a){return function(_0x26001a){if(_0x26001a){return _0x26001a[_0xdf9f('0x39')]()[_0xdf9f('0x22')](function(){var _0x47665e=_0x26001a[_0xdf9f('0x3a')]({'plain':!![]});var _0x26d799='OpenchannelAccounts';return db[_0xdf9f('0x3b')][_0xdf9f('0x39')]({'where':{'type':_0x26d799,'resourceId':_0x47665e['id']}})[_0xdf9f('0x22')](function(){return _0x26001a;});})[_0xdf9f('0x22')](function(){_0x2c2d1a[_0xdf9f('0x2e')](0xcc)[_0xdf9f('0x2f')]();});}};}function handleEntityNotFound(_0x480a79,_0x169408){return function(_0x438e9d){if(!_0x438e9d){_0x480a79['sendStatus'](0x194);}return _0x438e9d;};}function handleError(_0x597c8a,_0x4c17f3){_0x4c17f3=_0x4c17f3||0x1f4;return function(_0x17cc2b){logger[_0xdf9f('0x28')](_0x17cc2b['stack']);if(_0x17cc2b[_0xdf9f('0x3c')]){delete _0x17cc2b[_0xdf9f('0x3c')];}_0x597c8a[_0xdf9f('0x2e')](_0x4c17f3)['send'](_0x17cc2b);};}exports[_0xdf9f('0x3d')]=function(_0x24f6e,_0x142f10){var _0x1e0fc7={'include':[{'model':db[_0xdf9f('0x3e')],'as':_0xdf9f('0x3f')}]},_0x484389={},_0x517c50={'count':0x0,'rows':[]};var _0x1fa305=_[_0xdf9f('0x40')](db[_0xdf9f('0x41')][_0xdf9f('0x42')],function(_0xea03d7){return{'name':_0xea03d7[_0xdf9f('0x43')],'type':_0xea03d7[_0xdf9f('0x44')][_0xdf9f('0x45')]};});_0x484389[_0xdf9f('0x46')]=_[_0xdf9f('0x40')](_0x1fa305,'name');_0x484389[_0xdf9f('0x47')]=_[_0xdf9f('0x48')](_0x24f6e[_0xdf9f('0x47')]);_0x484389[_0xdf9f('0x49')]=_['intersection'](_0x484389[_0xdf9f('0x46')],_0x484389[_0xdf9f('0x47')]);_0x1e0fc7[_0xdf9f('0x4a')]=_[_0xdf9f('0x4b')](_0x484389[_0xdf9f('0x46')],qs[_0xdf9f('0x4c')](_0x24f6e['query']['fields']));_0x1e0fc7[_0xdf9f('0x4a')]=_0x1e0fc7[_0xdf9f('0x4a')][_0xdf9f('0x4d')]?_0x1e0fc7[_0xdf9f('0x4a')]:_0x484389[_0xdf9f('0x46')];if(!_0x24f6e[_0xdf9f('0x47')][_0xdf9f('0x4e')](_0xdf9f('0x4f'))){_0x1e0fc7[_0xdf9f('0x32')]=qs[_0xdf9f('0x32')](_0x24f6e['query'][_0xdf9f('0x32')]);_0x1e0fc7[_0xdf9f('0x31')]=qs[_0xdf9f('0x31')](_0x24f6e[_0xdf9f('0x47')][_0xdf9f('0x31')]);}_0x1e0fc7['order']=qs[_0xdf9f('0x50')](_0x24f6e['query'][_0xdf9f('0x50')]);_0x1e0fc7[_0xdf9f('0x51')]=qs[_0xdf9f('0x49')](_[_0xdf9f('0x52')](_0x24f6e['query'],_0x484389[_0xdf9f('0x49')]),_0x1fa305);if(_0x24f6e[_0xdf9f('0x47')][_0xdf9f('0x53')]){_0x1e0fc7['where']=_[_0xdf9f('0x54')](_0x1e0fc7[_0xdf9f('0x51')],{'$or':_[_0xdf9f('0x40')](_0x1fa305,function(_0x3a9612){if(_0x3a9612['type']!=='VIRTUAL'){var _0x4aa0ad={};_0x4aa0ad[_0x3a9612[_0xdf9f('0x3c')]]={'$like':'%'+_0x24f6e['query']['filter']+'%'};return _0x4aa0ad;}})});}_0x1e0fc7=_['merge']({},_0x1e0fc7,_0x24f6e[_0xdf9f('0x55')]);var _0x2d409b={'where':_0x1e0fc7[_0xdf9f('0x51')]};return db['OpenchannelAccount'][_0xdf9f('0x33')](_0x2d409b)[_0xdf9f('0x22')](function(_0x2ece72){_0x517c50[_0xdf9f('0x33')]=_0x2ece72;if(_0x24f6e['query']['includeAll']){_0x1e0fc7['include']=[{'all':!![]}];}return db[_0xdf9f('0x41')][_0xdf9f('0x56')](_0x1e0fc7);})['then'](function(_0x3dacba){_0x517c50['rows']=_0x3dacba;return _0x517c50;})[_0xdf9f('0x22')](respondWithFilteredResult(_0x142f10,_0x1e0fc7))[_0xdf9f('0x2c')](handleError(_0x142f10,null));};exports[_0xdf9f('0x57')]=function(_0x37a443,_0x3bf34f){var _0x402893={'raw':![],'where':{'id':_0x37a443['params']['id']},'include':[{'model':db[_0xdf9f('0x3e')],'as':_0xdf9f('0x3f')}]},_0x324f3f={};_0x324f3f['model']=_[_0xdf9f('0x48')](db['OpenchannelAccount'][_0xdf9f('0x42')]);_0x324f3f['query']=_['keys'](_0x37a443[_0xdf9f('0x47')]);_0x324f3f[_0xdf9f('0x49')]=_[_0xdf9f('0x4b')](_0x324f3f[_0xdf9f('0x46')],_0x324f3f[_0xdf9f('0x47')]);_0x402893[_0xdf9f('0x4a')]=_['intersection'](_0x324f3f[_0xdf9f('0x46')],qs[_0xdf9f('0x4c')](_0x37a443[_0xdf9f('0x47')]['fields']));_0x402893[_0xdf9f('0x4a')]=_0x402893[_0xdf9f('0x4a')][_0xdf9f('0x4d')]?_0x402893[_0xdf9f('0x4a')]:_0x324f3f[_0xdf9f('0x46')];if(_0x37a443[_0xdf9f('0x47')][_0xdf9f('0x58')]){_0x402893[_0xdf9f('0x59')]=[{'all':!![]}];}_0x402893=_[_0xdf9f('0x54')]({},_0x402893,_0x37a443[_0xdf9f('0x55')]);return db[_0xdf9f('0x41')][_0xdf9f('0x5a')](_0x402893)[_0xdf9f('0x22')](handleEntityNotFound(_0x3bf34f,null))[_0xdf9f('0x22')](respondWithResult(_0x3bf34f,null))[_0xdf9f('0x2c')](handleError(_0x3bf34f,null));};exports['create']=function(_0x268298,_0x4fac22){return db[_0xdf9f('0x41')][_0xdf9f('0x5b')](_0x268298[_0xdf9f('0x5c')],{})['then'](function(_0x21768f){var _0xc2197d=_0x268298[_0xdf9f('0x5d')][_0xdf9f('0x3a')]({'plain':!![]});if(!_0xc2197d)throw new Error(_0xdf9f('0x5e'));if(_0xc2197d[_0xdf9f('0x5f')]===_0xdf9f('0x5d')){var _0x5431a3=_0x21768f[_0xdf9f('0x3a')]({'plain':!![]});var _0x1fe439=_0xdf9f('0x60');return db[_0xdf9f('0x61')]['find']({'where':{'name':_0x1fe439,'userProfileId':_0xc2197d[_0xdf9f('0x62')]},'raw':!![]})[_0xdf9f('0x22')](function(_0x5e7f1a){if(_0x5e7f1a&&_0x5e7f1a[_0xdf9f('0x63')]===0x0){return db['UserProfileResource'][_0xdf9f('0x5b')]({'name':_0x5431a3[_0xdf9f('0x3c')],'resourceId':_0x5431a3['id'],'type':_0x5e7f1a[_0xdf9f('0x3c')],'sectionId':_0x5e7f1a['id']},{})[_0xdf9f('0x22')](function(){return _0x21768f;});}else{return _0x21768f;}})[_0xdf9f('0x2c')](function(_0x4ef2b6){logger['error'](_0xdf9f('0x64'),_0x4ef2b6);throw _0x4ef2b6;});}return _0x21768f;})[_0xdf9f('0x22')](respondWithResult(_0x4fac22,0xc9))[_0xdf9f('0x2c')](handleError(_0x4fac22,null));};exports[_0xdf9f('0x38')]=function(_0x3dcf84,_0x38f257){if(_0x3dcf84['body']['id']){delete _0x3dcf84[_0xdf9f('0x5c')]['id'];}return db[_0xdf9f('0x41')]['find']({'where':{'id':_0x3dcf84[_0xdf9f('0x65')]['id']},'include':[{'model':db[_0xdf9f('0x3e')],'as':_0xdf9f('0x3f')}]})[_0xdf9f('0x22')](handleEntityNotFound(_0x38f257,null))['then'](saveUpdates(_0x3dcf84[_0xdf9f('0x5c')],null))[_0xdf9f('0x22')](respondWithResult(_0x38f257,null))[_0xdf9f('0x2c')](handleError(_0x38f257,null));};exports[_0xdf9f('0x39')]=function(_0x3c2435,_0x4366ae){return db[_0xdf9f('0x41')][_0xdf9f('0x5a')]({'where':{'id':_0x3c2435[_0xdf9f('0x65')]['id']}})[_0xdf9f('0x22')](handleEntityNotFound(_0x4366ae,null))[_0xdf9f('0x22')](removeEntity(_0x4366ae,null))[_0xdf9f('0x2c')](handleError(_0x4366ae,null));};exports[_0xdf9f('0x66')]=function(_0x37b903,_0x17ae57){return db[_0xdf9f('0x41')][_0xdf9f('0x66')]()[_0xdf9f('0x22')](respondWithResult(_0x17ae57,null))['catch'](handleError(_0x17ae57,null));};exports['addDisposition']=function(_0x468616,_0xc0984,_0x2e8835){if(_0x468616[_0xdf9f('0x5c')]['id']){delete _0x468616[_0xdf9f('0x5c')]['id'];}return db[_0xdf9f('0x41')][_0xdf9f('0x5a')]({'where':{'id':_0x468616[_0xdf9f('0x65')]['id']}})['then'](handleEntityNotFound(_0xc0984,null))['then'](function(_0xae050f){if(_0xae050f){_0x468616[_0xdf9f('0x5c')][_0xdf9f('0x67')]=_0xae050f['id'];return db[_0xdf9f('0x68')][_0xdf9f('0x5b')](_0x468616[_0xdf9f('0x5c')]);}})['then'](respondWithResult(_0xc0984,null))['catch'](handleError(_0xc0984,null));};exports[_0xdf9f('0x69')]=function(_0x372528,_0x101a37,_0x2c19ea){var _0x43503d={'raw':![],'where':{}};var _0x592d75={};var _0x4ead8d={'count':0x0,'rows':[]};return db[_0xdf9f('0x41')][_0xdf9f('0x6a')]({'where':{'id':_0x372528[_0xdf9f('0x65')]['id']}})['then'](handleEntityNotFound(_0x101a37,null))[_0xdf9f('0x22')](function(_0x312358){if(_0x312358){_0x592d75[_0xdf9f('0x46')]=_['keys'](db['Disposition'][_0xdf9f('0x42')]);_0x592d75[_0xdf9f('0x47')]=_[_0xdf9f('0x48')](_0x372528[_0xdf9f('0x47')]);_0x592d75[_0xdf9f('0x49')]=_[_0xdf9f('0x4b')](_0x592d75['model'],_0x592d75['query']);_0x43503d[_0xdf9f('0x4a')]=_[_0xdf9f('0x4b')](_0x592d75[_0xdf9f('0x46')],qs['fields'](_0x372528['query']['fields']));_0x43503d[_0xdf9f('0x4a')]=_0x43503d[_0xdf9f('0x4a')]['length']?_0x43503d[_0xdf9f('0x4a')]:_0x592d75[_0xdf9f('0x46')];if(!_0x372528[_0xdf9f('0x47')]['hasOwnProperty'](_0xdf9f('0x4f'))){_0x43503d['limit']=qs[_0xdf9f('0x32')](_0x372528[_0xdf9f('0x47')]['limit']);_0x43503d['offset']=qs[_0xdf9f('0x31')](_0x372528[_0xdf9f('0x47')][_0xdf9f('0x31')]);}_0x43503d[_0xdf9f('0x6b')]=qs['sort'](_0x372528[_0xdf9f('0x47')][_0xdf9f('0x50')]);_0x43503d[_0xdf9f('0x51')]=qs['filters'](_[_0xdf9f('0x52')](_0x372528[_0xdf9f('0x47')],_0x592d75[_0xdf9f('0x49')]));_0x43503d[_0xdf9f('0x51')][_0xdf9f('0x67')]=_0x312358['id'];if(_0x372528[_0xdf9f('0x47')]['filter']){_0x43503d[_0xdf9f('0x51')]=_[_0xdf9f('0x54')](_0x43503d['where'],{'$or':_['map'](_0x43503d['attributes'],function(_0x136732){var _0x5c276f={};_0x5c276f[_0x136732]={'$like':'%'+_0x372528['query'][_0xdf9f('0x53')]+'%'};return _0x5c276f;})});}_0x43503d=_['merge']({},_0x43503d,_0x372528['options']);return db[_0xdf9f('0x68')][_0xdf9f('0x33')]({'where':_0x43503d[_0xdf9f('0x51')]})['then'](function(_0xe8125f){_0x4ead8d[_0xdf9f('0x33')]=_0xe8125f;if(_0x372528[_0xdf9f('0x47')][_0xdf9f('0x58')]){_0x43503d['include']=[{'all':!![]}];}return db[_0xdf9f('0x68')][_0xdf9f('0x56')](_0x43503d);})['then'](function(_0x1aa808){_0x4ead8d[_0xdf9f('0x6c')]=_0x1aa808;return _0x4ead8d;});}})[_0xdf9f('0x22')](respondWithFilteredResult(_0x101a37,_0x43503d))['catch'](handleError(_0x101a37,null));};exports['removeDispositions']=function(_0x2b7f85,_0x227274,_0x90aa8f){return db['OpenchannelAccount'][_0xdf9f('0x5a')]({'where':{'id':_0x2b7f85[_0xdf9f('0x65')]['id']}})[_0xdf9f('0x22')](handleEntityNotFound(_0x227274,null))['then'](function(_0x49c8f4){if(_0x49c8f4){return _0x49c8f4[_0xdf9f('0x6d')](_0x2b7f85[_0xdf9f('0x47')][_0xdf9f('0x6e')]);}})[_0xdf9f('0x22')](respondWithStatusCode(_0x227274,null))[_0xdf9f('0x2c')](handleError(_0x227274,null));};exports[_0xdf9f('0x6f')]=function(_0x2ec50a,_0x13d585,_0x464b34){if(_0x2ec50a[_0xdf9f('0x5c')]['id']){delete _0x2ec50a['body']['id'];}return db[_0xdf9f('0x41')]['find']({'where':{'id':_0x2ec50a[_0xdf9f('0x65')]['id']}})[_0xdf9f('0x22')](handleEntityNotFound(_0x13d585,null))[_0xdf9f('0x22')](function(_0x146f77){if(_0x146f77){_0x2ec50a[_0xdf9f('0x5c')][_0xdf9f('0x67')]=_0x146f77['id'];return db[_0xdf9f('0x70')][_0xdf9f('0x5b')](_0x2ec50a[_0xdf9f('0x5c')]);}})[_0xdf9f('0x22')](respondWithResult(_0x13d585,null))['catch'](handleError(_0x13d585,null));};exports['getAnswers']=function(_0x12be67,_0x5b278c,_0x3024e6){var _0x34c9b9={'raw':![],'where':{}};var _0x5b341c={};var _0xcaf49d={'count':0x0,'rows':[]};return db[_0xdf9f('0x41')][_0xdf9f('0x6a')]({'where':{'id':_0x12be67[_0xdf9f('0x65')]['id']}})[_0xdf9f('0x22')](handleEntityNotFound(_0x5b278c,null))['then'](function(_0x237891){if(_0x237891){_0x5b341c[_0xdf9f('0x46')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x5b341c[_0xdf9f('0x47')]=_['keys'](_0x12be67[_0xdf9f('0x47')]);_0x5b341c[_0xdf9f('0x49')]=_[_0xdf9f('0x4b')](_0x5b341c['model'],_0x5b341c[_0xdf9f('0x47')]);_0x34c9b9[_0xdf9f('0x4a')]=_[_0xdf9f('0x4b')](_0x5b341c[_0xdf9f('0x46')],qs[_0xdf9f('0x4c')](_0x12be67[_0xdf9f('0x47')][_0xdf9f('0x4c')]));_0x34c9b9['attributes']=_0x34c9b9[_0xdf9f('0x4a')][_0xdf9f('0x4d')]?_0x34c9b9[_0xdf9f('0x4a')]:_0x5b341c[_0xdf9f('0x46')];if(!_0x12be67['query']['hasOwnProperty'](_0xdf9f('0x4f'))){_0x34c9b9[_0xdf9f('0x32')]=qs[_0xdf9f('0x32')](_0x12be67[_0xdf9f('0x47')][_0xdf9f('0x32')]);_0x34c9b9[_0xdf9f('0x31')]=qs[_0xdf9f('0x31')](_0x12be67[_0xdf9f('0x47')][_0xdf9f('0x31')]);}_0x34c9b9[_0xdf9f('0x6b')]=qs['sort'](_0x12be67['query']['sort']);_0x34c9b9[_0xdf9f('0x51')]=qs[_0xdf9f('0x49')](_[_0xdf9f('0x52')](_0x12be67[_0xdf9f('0x47')],_0x5b341c['filters']));_0x34c9b9[_0xdf9f('0x51')][_0xdf9f('0x67')]=_0x237891['id'];if(_0x12be67[_0xdf9f('0x47')]['filter']){_0x34c9b9[_0xdf9f('0x51')]=_['merge'](_0x34c9b9[_0xdf9f('0x51')],{'$or':_[_0xdf9f('0x40')](_0x34c9b9[_0xdf9f('0x4a')],function(_0x1ef8c6){var _0x2fa197={};_0x2fa197[_0x1ef8c6]={'$like':'%'+_0x12be67[_0xdf9f('0x47')][_0xdf9f('0x53')]+'%'};return _0x2fa197;})});}_0x34c9b9=_[_0xdf9f('0x54')]({},_0x34c9b9,_0x12be67[_0xdf9f('0x55')]);return db[_0xdf9f('0x70')][_0xdf9f('0x33')]({'where':_0x34c9b9[_0xdf9f('0x51')]})['then'](function(_0x5e1035){_0xcaf49d[_0xdf9f('0x33')]=_0x5e1035;if(_0x12be67[_0xdf9f('0x47')][_0xdf9f('0x58')]){_0x34c9b9[_0xdf9f('0x59')]=[{'all':!![]}];}return db[_0xdf9f('0x70')][_0xdf9f('0x56')](_0x34c9b9);})[_0xdf9f('0x22')](function(_0x59a86a){_0xcaf49d[_0xdf9f('0x6c')]=_0x59a86a;return _0xcaf49d;});}})['then'](respondWithFilteredResult(_0x5b278c,_0x34c9b9))[_0xdf9f('0x2c')](handleError(_0x5b278c,null));};exports[_0xdf9f('0x71')]=function(_0x18525c,_0x25d173,_0x27a50d){return db[_0xdf9f('0x41')][_0xdf9f('0x5a')]({'where':{'id':_0x18525c[_0xdf9f('0x65')]['id']}})[_0xdf9f('0x22')](handleEntityNotFound(_0x25d173,null))[_0xdf9f('0x22')](function(_0x1aef6f){if(_0x1aef6f){return _0x1aef6f['removeAnswers'](_0x18525c[_0xdf9f('0x47')][_0xdf9f('0x6e')]);}})['then'](respondWithStatusCode(_0x25d173,null))[_0xdf9f('0x2c')](handleError(_0x25d173,null));};exports[_0xdf9f('0x72')]=function(_0x1763d9,_0x443734,_0xd91c99){var _0xe3de4f={'body':_0x1763d9[_0xdf9f('0x5c')],'channel':_0xdf9f('0x73')};var _0x2fed59=[];var _0x5b2bb8=[];var _0x33d423={};var _0x6fda8b=![];return db[_0xdf9f('0x74')][_0xdf9f('0x66')]()[_0xdf9f('0x22')](function(_0x175628){if(!_0x175628){throw new db[(_0xdf9f('0x75'))][(_0xdf9f('0x76'))](_0xdf9f('0x77'));}_0x2fed59=_['difference'](_[_0xdf9f('0x48')](_0x175628),[_0xdf9f('0x78'),_0xdf9f('0x79')]);_0x5b2bb8=_[_0xdf9f('0x7a')](_[_0xdf9f('0x48')](_0x175628),['createdAt',_0xdf9f('0x79'),_0xdf9f('0x7b'),_0xdf9f('0x7c')]);if(_0x1763d9[_0xdf9f('0x5c')]['id']){delete _0x1763d9[_0xdf9f('0x5c')]['id'];}if(_['isNil'](_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x7d')])){throw new db[(_0xdf9f('0x75'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xdf9f('0x7e')](_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x5c')])||_0x1763d9['body'][_0xdf9f('0x5c')]===''){throw new db[(_0xdf9f('0x75'))][(_0xdf9f('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdf9f('0x7e')](_0x1763d9[_0xdf9f('0x5c')]['mapKey'])){throw new db[(_0xdf9f('0x75'))][(_0xdf9f('0x76'))](_0xdf9f('0x7f')+_0x5b2bb8);}if(!_[_0xdf9f('0x80')](_0x5b2bb8,_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x81')])){throw new db['Sequelize']['ValidationError'](_0xdf9f('0x82')+_0x5b2bb8);}_0x33d423[_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x81')]]=_0x1763d9['body'][_0xdf9f('0x7d')];})['then'](function(){return db[_0xdf9f('0x41')][_0xdf9f('0x5a')]({'where':{'id':_0x1763d9['params']['id']},'include':[{'model':db[_0xdf9f('0x83')],'as':_0xdf9f('0x84'),'include':[{'model':db[_0xdf9f('0x74')],'as':_0xdf9f('0x85'),'where':_0x33d423,'limit':0x1,'order':[[_0xdf9f('0x79'),'DESC']]}]},{'model':db[_0xdf9f('0x86')],'as':'Applications'}]});})[_0xdf9f('0x22')](handleEntityNotFound(_0x443734,null))[_0xdf9f('0x22')](function(_0x5253f5){if(_0x5253f5&&_0x5253f5[_0xdf9f('0x84')]){_0xe3de4f[_0xdf9f('0x87')]=_0x5253f5;_0xe3de4f[_0xdf9f('0x88')]=_0x5253f5[_0xdf9f('0x89')];_0xe3de4f[_0xdf9f('0x8a')]=_0x5253f5[_0xdf9f('0x84')];_0xe3de4f[_0xdf9f('0x88')]=_[_0xdf9f('0x8b')](_0xe3de4f[_0xdf9f('0x88')],[_0xdf9f('0x8c')],[_0xdf9f('0x8d')]);if(_0xe3de4f[_0xdf9f('0x87')][_0xdf9f('0x89')]){delete _0xe3de4f['account'][_0xdf9f('0x89')];}if(_0xe3de4f[_0xdf9f('0x87')]['List']&&_0xe3de4f[_0xdf9f('0x87')][_0xdf9f('0x84')][_0xdf9f('0x85')][_0xdf9f('0x4d')]){return _0xe3de4f[_0xdf9f('0x87')][_0xdf9f('0x84')]['Contacts'][0x0];}var _0x225a69=_[_0xdf9f('0x18')](_0x1763d9[_0xdf9f('0x5c')],{'firstName':_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x7d')],'ListId':_0x5253f5[_0xdf9f('0x7c')]});_0x225a69[_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x81')]]=_0x1763d9['body']['from'];return db[_0xdf9f('0x74')][_0xdf9f('0x5b')](_0x225a69,{'fields':_0x2fed59,'raw':!![]});}})[_0xdf9f('0x22')](handleEntityNotFound(_0x443734,null))[_0xdf9f('0x22')](function(_0x46f9cc){_0xe3de4f[_0xdf9f('0x8e')]=_0x46f9cc;if(_0x46f9cc){var _0x405060={'ContactId':_0x46f9cc['id'],'OpenchannelAccountId':_0x1763d9[_0xdf9f('0x65')]['id'],'from':(_0x46f9cc[_0xdf9f('0x8f')]||'')+'\x20'+(_0x46f9cc[_0xdf9f('0x90')]||'')};var _0x755289={'OpenchannelAccountId':_0x1763d9[_0xdf9f('0x65')]['id'],'closed':![]};if(_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x91')]){_0x755289[_0xdf9f('0x91')]=_0x1763d9['body']['threadId'];return db[_0xdf9f('0x92')]['find']({'where':_0x755289})[_0xdf9f('0x22')](function(_0x4f5a2d){if(_0x4f5a2d){return[_0x4f5a2d,![]];}_0x405060[_0xdf9f('0x91')]=_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x91')];_0x405060['externalUrl']=_0x1763d9[_0xdf9f('0x5c')]['externalUrl'];return db['OpenchannelInteraction'][_0xdf9f('0x5b')](_0x405060)[_0xdf9f('0x22')](function(_0x994837){return[_0x994837,!![]];});});}else{_0x755289[_0xdf9f('0x91')]=null;}_0x755289[_0xdf9f('0x93')]=_0x46f9cc['id'];return db['OpenchannelInteraction']['find']({'where':_0x755289})[_0xdf9f('0x22')](function(_0x4f74d0){if(_0x4f74d0){return[_0x4f74d0,![]];}return db[_0xdf9f('0x92')][_0xdf9f('0x5b')](_0x405060)[_0xdf9f('0x22')](function(_0x583cc0){return[_0x583cc0,!![]];});});}})[_0xdf9f('0x94')](function(_0x825312,_0x145181){if(_0x825312){_0x6fda8b=_0x145181;if(!_0x145181){var _0x3c6848={'from':(_0xe3de4f[_0xdf9f('0x8e')][_0xdf9f('0x8f')]||'')+'\x20'+(_0xe3de4f[_0xdf9f('0x8e')][_0xdf9f('0x90')]||'')};if(_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x91')]&&_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x95')]&&_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x91')]!=_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x95')]){_0x3c6848[_0xdf9f('0x91')]=_0x1763d9[_0xdf9f('0x5c')]['messageId'];}return _0x825312[_0xdf9f('0x38')](_0x3c6848);}else{return _0x825312;}}})[_0xdf9f('0x22')](function(_0x24cda2){_0xe3de4f[_0xdf9f('0x96')]=_0x24cda2[_0xdf9f('0x3a')]({'plain':!![]});_0xe3de4f['interaction'][_0xdf9f('0x97')]=_0x6fda8b;if(_0xe3de4f[_0xdf9f('0x96')][_0xdf9f('0x97')]){if(_0xe3de4f['account'][_0xdf9f('0x98')]){_0xe3de4f[_0xdf9f('0x88')][_0xdf9f('0x99')]({'id':0x0,'priority':_0xe3de4f['applications'][_0xdf9f('0x4d')]+0x1,'app':_0xdf9f('0x9a'),'appdata':'unmanaged','interval':_0xdf9f('0x9b')});}}return db[_0xdf9f('0x9c')][_0xdf9f('0x5b')]({'body':_0x1763d9['body']['body'],'OpenchannelAccountId':_0x1763d9[_0xdf9f('0x65')]['id'],'OpenchannelInteractionId':_0x24cda2['id'],'direction':'in','ContactId':_0xe3de4f['contact']['id'],'AttachmentId':_0x1763d9[_0xdf9f('0x5c')][_0xdf9f('0x9d')]});})[_0xdf9f('0x22')](function(_0x1dc2cc){_0xe3de4f[_0xdf9f('0x2a')]=_0x1dc2cc;if(_0xe3de4f[_0xdf9f('0x96')]['UserId']){return db[_0xdf9f('0x9e')][_0xdf9f('0x5a')]({'attributes':['id',_0xdf9f('0x3c')],'where':{'id':_0xe3de4f[_0xdf9f('0x96')][_0xdf9f('0x9f')]}})['then'](function(_0x50bdb7){if(_0x50bdb7){_0xe3de4f[_0xdf9f('0x88')][_0xdf9f('0xa0')]({'id':0x0,'priority':0x0,'app':_0xdf9f('0xa1'),'appdata':_0x50bdb7[_0xdf9f('0x3c')]+','+(_0xe3de4f[_0xdf9f('0x87')][_0xdf9f('0xa2')]||0xa),'interval':_0xdf9f('0x9b')});_0xe3de4f[_0xdf9f('0xa3')]=![];}return respondWithRpcPromise(_0xdf9f('0xa4'),_0xdf9f('0xa5'),_0xe3de4f);});}return respondWithRpcPromise(_0xdf9f('0xa4'),'startRouting',_0xe3de4f);})['then'](function(_0x289d6d){respondWithRpcPromise(_0xdf9f('0xa6'),'EventManager',{'event':_0xdf9f('0x72'),'message':_0x289d6d},client9002);return _0x289d6d;})[_0xdf9f('0x22')](respondWithResult(_0x443734,null))['catch'](handleError(_0x443734,null));};exports[_0xdf9f('0xa7')]=function(_0x55ca23,_0x33b2e9){var _0x533681=_0x55ca23[_0xdf9f('0x65')]['id'];var _0x1a830f=_0x55ca23[_0xdf9f('0x5c')];var _0x5c4cab=0xc8;var _0x5b6be4=null;return db[_0xdf9f('0xa8')][_0xdf9f('0xa9')]({'isolationLevel':db['sequelize'][_0xdf9f('0xaa')][_0xdf9f('0xab')][_0xdf9f('0xac')]},function(_0x2ef79c){return db[_0xdf9f('0x41')][_0xdf9f('0x6a')]({'where':{'id':_0x533681},'transaction':_0x2ef79c})[_0xdf9f('0x22')](function(_0x36f07b){if(_0x36f07b){return db[_0xdf9f('0x86')][_0xdf9f('0x39')]({'where':{'OpenchannelAccountId':_0x533681},'transaction':_0x2ef79c})[_0xdf9f('0x22')](function(){var _0x3bd57b=_[_0xdf9f('0x40')](_0x1a830f,function(_0x3e8ada){_0x3e8ada[_0xdf9f('0x67')]=_0x533681;return _0x3e8ada;});return db[_0xdf9f('0x86')][_0xdf9f('0xad')](_0x3bd57b,{'transaction':_0x2ef79c});});}else{_0x5c4cab=0x194;_0x5b6be4=[];}});})[_0xdf9f('0x22')](function(){if(_0x5c4cab!==0x194){return db[_0xdf9f('0x86')][_0xdf9f('0xae')]({'where':{'OpenchannelAccountId':_0x533681},'order':_0xdf9f('0x8c')})[_0xdf9f('0x22')](function(_0x4cfa69){_0x5b6be4=_0x4cfa69;});}})[_0xdf9f('0x2c')](function(_0x205d19){_0x5c4cab=0x1f4;logger[_0xdf9f('0x28')](_0x205d19[_0xdf9f('0xaf')]);if(_0x205d19[_0xdf9f('0x3c')]){delete _0x205d19['name'];}_0x5b6be4=_0x205d19;})[_0xdf9f('0xb0')](function(){if(_0x5b6be4===null){_0x33b2e9[_0xdf9f('0x2d')](_0x5c4cab);}else{if(_0x5c4cab===0x1f4){_0x33b2e9[_0xdf9f('0x2e')](_0x5c4cab)[_0xdf9f('0xb1')](_0x5b6be4);}else{_0x33b2e9[_0xdf9f('0x2e')](_0x5c4cab)['json'](_0x5b6be4);}}});};exports[_0xdf9f('0xb2')]=function(_0x54941d,_0x940f8d,_0x3bee4b){var _0x1a4480={};var _0x43ee35={};var _0x53dd40;var _0x382849;return db[_0xdf9f('0x41')][_0xdf9f('0x6a')]({'where':{'id':_0x54941d['params']['id']}})[_0xdf9f('0x22')](handleEntityNotFound(_0x940f8d,null))[_0xdf9f('0x22')](function(_0x7c7496){if(_0x7c7496){_0x53dd40=_0x7c7496;_0x43ee35[_0xdf9f('0x46')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x43ee35[_0xdf9f('0x47')]=_[_0xdf9f('0x48')](_0x54941d[_0xdf9f('0x47')]);_0x43ee35[_0xdf9f('0x49')]=_[_0xdf9f('0x4b')](_0x43ee35[_0xdf9f('0x46')],_0x43ee35[_0xdf9f('0x47')]);_0x1a4480[_0xdf9f('0x4a')]=_[_0xdf9f('0x4b')](_0x43ee35[_0xdf9f('0x46')],qs[_0xdf9f('0x4c')](_0x54941d['query'][_0xdf9f('0x4c')]));_0x1a4480['attributes']=_0x1a4480[_0xdf9f('0x4a')][_0xdf9f('0x4d')]?_0x1a4480[_0xdf9f('0x4a')]:_0x43ee35['model'];_0x1a4480[_0xdf9f('0x6b')]=qs['sort'](_0x54941d['query'][_0xdf9f('0x50')]);_0x1a4480['where']=qs[_0xdf9f('0x49')](_[_0xdf9f('0x52')](_0x54941d['query'],_0x43ee35[_0xdf9f('0x49')]));if(_0x54941d['query'][_0xdf9f('0x53')]){_0x1a4480['where']=_[_0xdf9f('0x54')](_0x1a4480['where'],{'$or':_[_0xdf9f('0x40')](_0x1a4480[_0xdf9f('0x4a')],function(_0x3af7cb){var _0x547e37={};_0x547e37[_0x3af7cb]={'$like':'%'+_0x54941d['query'][_0xdf9f('0x53')]+'%'};return _0x547e37;})});}_0x1a4480=_[_0xdf9f('0x54')]({},_0x1a4480,_0x54941d['options']);return _0x53dd40[_0xdf9f('0xb2')](_0x1a4480);}})[_0xdf9f('0x22')](function(_0x474f52){if(_0x474f52){_0x382849=_0x474f52[_0xdf9f('0x4d')];if(!_0x54941d['query'][_0xdf9f('0x4e')]('nolimit')){_0x1a4480[_0xdf9f('0x32')]=qs[_0xdf9f('0x32')](_0x54941d[_0xdf9f('0x47')][_0xdf9f('0x32')]);_0x1a4480['offset']=qs[_0xdf9f('0x31')](_0x54941d['query'][_0xdf9f('0x31')]);}return _0x53dd40[_0xdf9f('0xb2')](_0x1a4480);}})[_0xdf9f('0x22')](function(_0x19cc03){if(_0x19cc03){return _0x19cc03?{'count':_0x382849,'rows':_0x19cc03}:null;}})['then'](respondWithResult(_0x940f8d,null))[_0xdf9f('0x2c')](handleError(_0x940f8d,null));};exports['getInteractions']=function(_0x401b53,_0x1ec46d,_0x424dc){var _0x4fec8c={'raw':![],'where':{}};var _0x2d7e19={};var _0x4b3319={'count':0x0,'rows':[]};return db[_0xdf9f('0x41')][_0xdf9f('0x6a')]({'where':{'id':_0x401b53[_0xdf9f('0x65')]['id']}})['then'](handleEntityNotFound(_0x1ec46d,null))[_0xdf9f('0x22')](function(_0x3d61f6){if(_0x3d61f6){_0x2d7e19[_0xdf9f('0x46')]=_['keys'](db[_0xdf9f('0x92')][_0xdf9f('0x42')]);_0x2d7e19[_0xdf9f('0x47')]=_['keys'](_0x401b53[_0xdf9f('0x47')]);_0x2d7e19[_0xdf9f('0x49')]=_[_0xdf9f('0x4b')](_0x2d7e19[_0xdf9f('0x46')],_0x2d7e19['query']);_0x4fec8c[_0xdf9f('0x4a')]=_[_0xdf9f('0x4b')](_0x2d7e19[_0xdf9f('0x46')],qs[_0xdf9f('0x4c')](_0x401b53[_0xdf9f('0x47')][_0xdf9f('0x4c')]));_0x4fec8c[_0xdf9f('0x4a')]=_0x4fec8c['attributes'][_0xdf9f('0x4d')]?_0x4fec8c[_0xdf9f('0x4a')]:_0x2d7e19[_0xdf9f('0x46')];if(!_0x401b53[_0xdf9f('0x47')][_0xdf9f('0x4e')](_0xdf9f('0x4f'))){_0x4fec8c[_0xdf9f('0x32')]=qs['limit'](_0x401b53[_0xdf9f('0x47')][_0xdf9f('0x32')]);_0x4fec8c[_0xdf9f('0x31')]=qs['offset'](_0x401b53['query']['offset']);}_0x4fec8c[_0xdf9f('0x6b')]=qs[_0xdf9f('0x50')](_0x401b53['query']['sort']);_0x4fec8c['where']=qs[_0xdf9f('0x49')](_['pick'](_0x401b53[_0xdf9f('0x47')],_0x2d7e19[_0xdf9f('0x49')]));_0x4fec8c['where']['OpenchannelAccountId']=_0x3d61f6['id'];if(_0x401b53[_0xdf9f('0x47')][_0xdf9f('0x53')]){_0x4fec8c[_0xdf9f('0x51')]=_['merge'](_0x4fec8c['where'],{'$or':_[_0xdf9f('0x40')](_0x4fec8c[_0xdf9f('0x4a')],function(_0x3a34f1){var _0x1712c5={};_0x1712c5[_0x3a34f1]={'$like':'%'+_0x401b53[_0xdf9f('0x47')][_0xdf9f('0x53')]+'%'};return _0x1712c5;})});}_0x4fec8c=_['merge']({},_0x4fec8c,_0x401b53[_0xdf9f('0x55')]);return db['OpenchannelInteraction']['count']({'where':_0x4fec8c['where']})['then'](function(_0x4c301d){_0x4b3319[_0xdf9f('0x33')]=_0x4c301d;if(_0x401b53['query'][_0xdf9f('0x58')]){_0x4fec8c[_0xdf9f('0x59')]=[{'model':db['CmContact'],'as':_0xdf9f('0xb3'),'required':![]},{'model':db[_0xdf9f('0x9e')],'as':_0xdf9f('0xb4'),'attributes':[_0xdf9f('0x3c'),_0xdf9f('0xb5'),_0xdf9f('0xb6')],'required':![]},{'model':db[_0xdf9f('0xb7')],'as':'Tags','attributes':['id',_0xdf9f('0x3c'),'color'],'where':_0x401b53[_0xdf9f('0x47')]['tag']?{'id':_0x401b53[_0xdf9f('0x47')][_0xdf9f('0xb8')]}:undefined,'required':_0x401b53[_0xdf9f('0x47')][_0xdf9f('0xb8')]?!![]:![]}];}return db[_0xdf9f('0x92')][_0xdf9f('0x56')](_0x4fec8c);})[_0xdf9f('0x22')](function(_0x56f06a){_0x4b3319[_0xdf9f('0x6c')]=_0x56f06a;return _0x4b3319;});}})['then'](respondWithFilteredResult(_0x1ec46d,_0x4fec8c))[_0xdf9f('0x2c')](handleError(_0x1ec46d,null));};exports[_0xdf9f('0xb9')]=function(_0x5d4b11,_0x457c27,_0x1a04ce){return db['OpenchannelAccount'][_0xdf9f('0x5a')]({'where':{'id':_0x5d4b11[_0xdf9f('0x65')]['id']}})[_0xdf9f('0x22')](handleEntityNotFound(_0x457c27,null))[_0xdf9f('0x22')](function(_0x60553a){if(_0x60553a){return _0x60553a[_0xdf9f('0xb9')](_0x5d4b11['body']['ids'],_[_0xdf9f('0xba')](_0x5d4b11['body'],[_0xdf9f('0x6e'),'id'])||{})[_0xdf9f('0x94')](function(_0x2916bb){for(var _0x37b4e1=0x0;_0x37b4e1<_0x5d4b11[_0xdf9f('0x5c')][_0xdf9f('0x6e')][_0xdf9f('0x4d')];_0x37b4e1+=0x1){socket['emit'](_0xdf9f('0xbb'),{'UserId':Number(_0x5d4b11[_0xdf9f('0x5c')][_0xdf9f('0x6e')][_0x37b4e1]),'OpenchannelAccountId':Number(_0x5d4b11['params']['id'])});}return _0x2916bb;});}})['then'](respondWithResult(_0x457c27,null))['catch'](handleError(_0x457c27,null));};exports['removeAgents']=function(_0x384f79,_0xf32ddc,_0x32f190){return db[_0xdf9f('0x41')]['find']({'where':{'id':_0x384f79[_0xdf9f('0x65')]['id']}})[_0xdf9f('0x22')](handleEntityNotFound(_0xf32ddc,null))['then'](function(_0x407b87){if(_0x407b87){return _0x407b87['removeAgents'](_0x384f79[_0xdf9f('0x47')][_0xdf9f('0x6e')])[_0xdf9f('0x22')](function(){if(_['isArray'](_0x384f79[_0xdf9f('0x47')][_0xdf9f('0x6e')])){for(var _0x1f0f2d=0x0;_0x1f0f2d<_0x384f79[_0xdf9f('0x47')][_0xdf9f('0x6e')]['length'];_0x1f0f2d+=0x1){socket[_0xdf9f('0xbc')](_0xdf9f('0xbd'),{'UserId':Number(_0x384f79[_0xdf9f('0x47')][_0xdf9f('0x6e')][_0x1f0f2d]),'OpenchannelAccountId':Number(_0x384f79[_0xdf9f('0x65')]['id'])});}}else{socket[_0xdf9f('0xbc')](_0xdf9f('0xbd'),{'UserId':Number(_0x384f79['query'][_0xdf9f('0x6e')]),'OpenchannelAccountId':Number(_0x384f79['params']['id'])});}});}})[_0xdf9f('0x22')](respondWithStatusCode(_0xf32ddc,null))['catch'](handleError(_0xf32ddc,null));};exports[_0xdf9f('0xbe')]=function(_0x478394,_0xa53052,_0x314b4c){var _0x1f82b5={};var _0x3f31cf={};var _0x257b0b;var _0x238edc;return db[_0xdf9f('0x41')][_0xdf9f('0x6a')]({'where':{'id':_0x478394[_0xdf9f('0x65')]['id']}})['then'](handleEntityNotFound(_0xa53052,null))['then'](function(_0x1dde7e){if(_0x1dde7e){_0x257b0b=_0x1dde7e;_0x3f31cf[_0xdf9f('0x46')]=_['keys'](db['User'][_0xdf9f('0x42')]);_0x3f31cf[_0xdf9f('0x47')]=_['keys'](_0x478394[_0xdf9f('0x47')]);_0x3f31cf[_0xdf9f('0x49')]=_[_0xdf9f('0x4b')](_0x3f31cf[_0xdf9f('0x46')],_0x3f31cf['query']);_0x1f82b5[_0xdf9f('0x4a')]=_[_0xdf9f('0x4b')](_0x3f31cf[_0xdf9f('0x46')],qs['fields'](_0x478394['query'][_0xdf9f('0x4c')]));_0x1f82b5[_0xdf9f('0x4a')]=_0x1f82b5[_0xdf9f('0x4a')][_0xdf9f('0x4d')]?_0x1f82b5[_0xdf9f('0x4a')]:_0x3f31cf['model'];_0x1f82b5['order']=qs['sort'](_0x478394[_0xdf9f('0x47')][_0xdf9f('0x50')]);_0x1f82b5[_0xdf9f('0x51')]=qs[_0xdf9f('0x49')](_[_0xdf9f('0x52')](_0x478394[_0xdf9f('0x47')],_0x3f31cf['filters']));if(_0x478394['query'][_0xdf9f('0x53')]){_0x1f82b5[_0xdf9f('0x51')]=_[_0xdf9f('0x54')](_0x1f82b5[_0xdf9f('0x51')],{'$or':_[_0xdf9f('0x40')](_0x1f82b5[_0xdf9f('0x4a')],function(_0x27b2c9){var _0x1c2780={};_0x1c2780[_0x27b2c9]={'$like':'%'+_0x478394[_0xdf9f('0x47')][_0xdf9f('0x53')]+'%'};return _0x1c2780;})});}_0x1f82b5=_[_0xdf9f('0x54')]({},_0x1f82b5,_0x478394['options']);return _0x257b0b[_0xdf9f('0xbe')](_0x1f82b5);}})[_0xdf9f('0x22')](function(_0x3ed359){if(_0x3ed359){_0x238edc=_0x3ed359['length'];if(!_0x478394[_0xdf9f('0x47')][_0xdf9f('0x4e')](_0xdf9f('0x4f'))){_0x1f82b5[_0xdf9f('0x32')]=qs[_0xdf9f('0x32')](_0x478394['query'][_0xdf9f('0x32')]);_0x1f82b5[_0xdf9f('0x31')]=qs[_0xdf9f('0x31')](_0x478394[_0xdf9f('0x47')]['offset']);}return _0x257b0b[_0xdf9f('0xbe')](_0x1f82b5);}})['then'](function(_0x5c762d){if(_0x5c762d){return _0x5c762d?{'count':_0x238edc,'rows':_0x5c762d}:null;}})['then'](respondWithResult(_0xa53052,null))[_0xdf9f('0x2c')](handleError(_0xa53052,null));};exports['send']=function(_0x35bb2f,_0x5db9c1,_0x45b1cb){var _0x122780,_0x3bb9f6,_0x1829d4;if(_[_0xdf9f('0x7e')](_0x35bb2f['body'][_0xdf9f('0x5c')])||_0x35bb2f[_0xdf9f('0x5c')]['body']===''){throw new db[(_0xdf9f('0x75'))]['ValidationError'](_0xdf9f('0xbf'));}if(_[_0xdf9f('0x7e')](_0x35bb2f[_0xdf9f('0x5c')]['to'])){}_0x122780=_0x35bb2f[_0xdf9f('0x5c')]['to'];return db[_0xdf9f('0x41')]['findOne']({'where':{'id':_0x35bb2f[_0xdf9f('0x65')]['id']}})[_0xdf9f('0x22')](handleEntityNotFound(_0x5db9c1,null))[_0xdf9f('0x22')](function(_0x58960d){if(_0x58960d){return db[_0xdf9f('0x41')][_0xdf9f('0x5a')]({'where':{'id':_0x58960d['id']},'include':[{'model':db[_0xdf9f('0x83')],'as':_0xdf9f('0x84'),'include':[{'model':db[_0xdf9f('0x74')],'as':_0xdf9f('0x85'),'where':{[_0x58960d[_0xdf9f('0x81')]]:_0x122780},'limit':0x1,'order':[['updatedAt',_0xdf9f('0xc0')]]}]}]})[_0xdf9f('0x22')](handleEntityNotFound(_0x5db9c1,null))[_0xdf9f('0x22')](function(_0x2aaf20){if(_0x2aaf20&&_0x2aaf20[_0xdf9f('0x84')]){_0x3bb9f6=_0x2aaf20[_0xdf9f('0x3a')]({'plain':!![]});if(_0x3bb9f6[_0xdf9f('0x84')]&&_0x3bb9f6['List'][_0xdf9f('0x85')][_0xdf9f('0x4d')]){return _0x3bb9f6[_0xdf9f('0x84')][_0xdf9f('0x85')][0x0];}return db[_0xdf9f('0x74')][_0xdf9f('0x5b')](_[_0xdf9f('0x18')](_0x35bb2f[_0xdf9f('0x5c')],{'firstName':_0x122780,[_0x2aaf20[_0xdf9f('0x81')]]:_0x122780,'phone':_0x122780,'ListId':_0x3bb9f6[_0xdf9f('0x7c')]}));}})['then'](handleEntityNotFound(_0x5db9c1,null))[_0xdf9f('0x22')](function(_0x3d4192){if(_0x3d4192){_0x1829d4=_0x3d4192;return db[_0xdf9f('0x92')][_0xdf9f('0x5a')]({'where':{'ContactId':_0x1829d4['id'],'closed':![],'OpenchannelAccountId':_0x3bb9f6['id']}})[_0xdf9f('0x22')](function(_0x52a1a9){if(_0x52a1a9){return[_0x52a1a9,![]];}return db[_0xdf9f('0x92')]['create']({'UserId':_0x35bb2f[_0xdf9f('0x5d')]['id'],'ContactId':_0x1829d4['id'],'OpenchannelAccountId':_0x3bb9f6['id'],'lastMsgDirection':_0xdf9f('0xc1'),'firstMsgDirection':'out','Messages':[_['merge'](_0x35bb2f['body'],{'read':![],'body':_0x35bb2f[_0xdf9f('0x5c')]['body'],'OpenchannelAccountId':_0x3bb9f6['id'],'UserId':_0x35bb2f[_0xdf9f('0x5d')]['id'],'ContactId':_0x1829d4['id']})]},{'include':[{'model':db[_0xdf9f('0x9c')],'as':'Messages'}]})[_0xdf9f('0x22')](function(_0x5aca20){return[_0x5aca20,!![]];});});}})[_0xdf9f('0x94')](function(_0x169262,_0x86bafd){if(_0x86bafd){return _0x169262;}return db['OpenchannelMessage'][_0xdf9f('0x5b')](_[_0xdf9f('0x54')](_0x35bb2f['body'],{'read':![],'body':_0x35bb2f['body'][_0xdf9f('0x5c')],'OpenchannelAccountId':_0x3bb9f6['id'],'OpenchannelInteractionId':_0x169262['id'],'UserId':_0x35bb2f[_0xdf9f('0x5d')]['id'],'ContactId':_0x1829d4['id']}))[_0xdf9f('0x22')](function(_0x2b6373){_0x169262[_0xdf9f('0xc2')][_0xdf9f('0xc3')]=[];_0x169262[_0xdf9f('0xc2')]['Messages']['push'](_0x2b6373['dataValues']);return _0x169262;});});}})[_0xdf9f('0x22')](respondWithResult(_0x5db9c1,null))[_0xdf9f('0x2c')](handleError(_0x5db9c1,null));}; \ No newline at end of file +var _0x861c=['Tag','Tags','color','tag','addAgents','omit','ids','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./openchannelAccount.socket','jayson/promise','client','http','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','end','sendStatus','stack','name','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelAccount','findAll','rows','catch','show','Pause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','params','describe','addDisposition','Disposition','getDispositions','hasOwnProperty','nolimit','OpenchannelAccountId','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','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','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','contact','lastName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner'];(function(_0x5b60d2,_0x3ad129){var _0x4a7449=function(_0x1e08d7){while(--_0x1e08d7){_0x5b60d2['push'](_0x5b60d2['shift']());}};_0x4a7449(++_0x3ad129);}(_0x861c,0xdb));var _0xc861=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x861c[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xc861('0x0'));var rimraf=require(_0xc861('0x1'));var zipdir=require(_0xc861('0x2'));var jsonpatch=require(_0xc861('0x3'));var rp=require(_0xc861('0x4'));var moment=require(_0xc861('0x5'));var BPromise=require(_0xc861('0x6'));var Mustache=require(_0xc861('0x7'));var util=require(_0xc861('0x8'));var path=require(_0xc861('0x9'));var sox=require(_0xc861('0xa'));var csv=require(_0xc861('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc861('0xc'));var _=require(_0xc861('0xd'));var squel=require(_0xc861('0xe'));var crypto=require(_0xc861('0xf'));var jsforce=require(_0xc861('0x10'));var deskjs=require(_0xc861('0x11'));var toCsv=require(_0xc861('0xb'));var querystring=require(_0xc861('0x12'));var Papa=require(_0xc861('0x13'));var Redis=require(_0xc861('0x14'));var authService=require(_0xc861('0x15'));var qs=require(_0xc861('0x16'));var as=require(_0xc861('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc861('0x18'))(_0xc861('0x19'));var utils=require(_0xc861('0x1a'));var config=require(_0xc861('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xc861('0x1c'))['db'];config[_0xc861('0x1d')]=_[_0xc861('0x1e')](config[_0xc861('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc861('0x1d')]));require(_0xc861('0x1f'))['register'](socket);var jayson=require(_0xc861('0x20'));var client=jayson[_0xc861('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xc861('0x21')][_0xc861('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2e2b94,_0xd8e34a,_0x3af352,_0x8766eb){return new BPromise(function(_0x5d6040,_0x5f0883){var _0x44a1fb=_0x8766eb||client;return _0x44a1fb['request'](_0x2e2b94,_0x3af352)[_0xc861('0x23')](function(_0x3296c1){logger[_0xc861('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0xd8e34a,_0xc861('0x25'));logger['debug'](_0xc861('0x26'),_0xd8e34a,_0xc861('0x25'),JSON[_0xc861('0x27')](_0x3296c1));if(_0x3296c1[_0xc861('0x28')]){if(_0x3296c1[_0xc861('0x28')][_0xc861('0x29')]===0x1f4){logger[_0xc861('0x28')](_0xc861('0x2a'),_0xd8e34a,_0x3296c1[_0xc861('0x28')][_0xc861('0x2b')]);return _0x5f0883(_0x3296c1[_0xc861('0x28')][_0xc861('0x2b')]);}logger[_0xc861('0x28')](_0xc861('0x2a'),_0xd8e34a,_0x3296c1[_0xc861('0x28')][_0xc861('0x2b')]);return _0x5d6040(_0x3296c1['error'][_0xc861('0x2b')]);}else{logger[_0xc861('0x24')](_0xc861('0x2a'),_0xd8e34a,_0xc861('0x25'));_0x5d6040(_0x3296c1[_0xc861('0x2c')][_0xc861('0x2b')]);}})['catch'](function(_0x11abae){logger[_0xc861('0x28')](_0xc861('0x2a'),_0xd8e34a,_0x11abae);_0x5f0883(_0x11abae);});});}function respondWithStatusCode(_0x11884d,_0x38a737){_0x38a737=_0x38a737||0xcc;return function(_0x1cefa7){if(_0x1cefa7){return _0x11884d['sendStatus'](_0x38a737);}return _0x11884d[_0xc861('0x2d')](_0x38a737)['end']();};}function respondWithResult(_0x5af598,_0x546dbb){_0x546dbb=_0x546dbb||0xc8;return function(_0x13e4e2){if(_0x13e4e2){return _0x5af598[_0xc861('0x2d')](_0x546dbb)[_0xc861('0x2e')](_0x13e4e2);}};}function respondWithFilteredResult(_0x30b9f4,_0x2f3790){return function(_0xff9c32){if(_0xff9c32){var _0x431695=typeof _0x2f3790[_0xc861('0x2f')]==='undefined'&&typeof _0x2f3790[_0xc861('0x30')]===_0xc861('0x31');var _0x62317e=_0xff9c32['count'];var _0x3089dd=_0x431695?0x0:_0x2f3790['offset'];var _0x26da6e=_0x431695?_0xff9c32[_0xc861('0x32')]:_0x2f3790[_0xc861('0x2f')]+_0x2f3790[_0xc861('0x30')];var _0x509243;if(_0x26da6e>=_0x62317e){_0x26da6e=_0x62317e;_0x509243=0xc8;}else{_0x509243=0xce;}_0x30b9f4[_0xc861('0x2d')](_0x509243);return _0x30b9f4[_0xc861('0x33')](_0xc861('0x34'),_0x3089dd+'-'+_0x26da6e+'/'+_0x62317e)[_0xc861('0x2e')](_0xff9c32);}return null;};}function patchUpdates(_0x373193){return function(_0x2b9ee9){try{jsonpatch[_0xc861('0x35')](_0x2b9ee9,_0x373193,!![]);}catch(_0x1d5689){return BPromise[_0xc861('0x36')](_0x1d5689);}return _0x2b9ee9['save']();};}function saveUpdates(_0x10d61c,_0x514f54){return function(_0x285f84){if(_0x285f84){return _0x285f84[_0xc861('0x37')](_0x10d61c)[_0xc861('0x23')](function(_0x2061d5){return _0x2061d5;});}return null;};}function removeEntity(_0x14e16e,_0x2dbef7){return function(_0x11f57c){if(_0x11f57c){return _0x11f57c[_0xc861('0x38')]()[_0xc861('0x23')](function(){var _0xae9e69=_0x11f57c[_0xc861('0x39')]({'plain':!![]});var _0x3f967f='OpenchannelAccounts';return db[_0xc861('0x3a')][_0xc861('0x38')]({'where':{'type':_0x3f967f,'resourceId':_0xae9e69['id']}})[_0xc861('0x23')](function(){return _0x11f57c;});})[_0xc861('0x23')](function(){_0x14e16e[_0xc861('0x2d')](0xcc)[_0xc861('0x3b')]();});}};}function handleEntityNotFound(_0x3a80dd,_0x31a3e6){return function(_0x3934d7){if(!_0x3934d7){_0x3a80dd[_0xc861('0x3c')](0x194);}return _0x3934d7;};}function handleError(_0x568c47,_0x39555a){_0x39555a=_0x39555a||0x1f4;return function(_0x5b12e6){logger[_0xc861('0x28')](_0x5b12e6[_0xc861('0x3d')]);if(_0x5b12e6[_0xc861('0x3e')]){delete _0x5b12e6[_0xc861('0x3e')];}_0x568c47['status'](_0x39555a)['send'](_0x5b12e6);};}exports[_0xc861('0x3f')]=function(_0x480fd0,_0x6e3707){var _0x334e7f={'include':[{'model':db['Pause'],'as':_0xc861('0x40')}]},_0x420877={},_0x59626f={'count':0x0,'rows':[]};var _0x53783e=_[_0xc861('0x41')](db['OpenchannelAccount'][_0xc861('0x42')],function(_0x2b2d0f){return{'name':_0x2b2d0f[_0xc861('0x43')],'type':_0x2b2d0f[_0xc861('0x44')][_0xc861('0x45')]};});_0x420877[_0xc861('0x46')]=_[_0xc861('0x41')](_0x53783e,_0xc861('0x3e'));_0x420877[_0xc861('0x47')]=_[_0xc861('0x48')](_0x480fd0[_0xc861('0x47')]);_0x420877[_0xc861('0x49')]=_['intersection'](_0x420877[_0xc861('0x46')],_0x420877[_0xc861('0x47')]);_0x334e7f['attributes']=_[_0xc861('0x4a')](_0x420877[_0xc861('0x46')],qs[_0xc861('0x4b')](_0x480fd0[_0xc861('0x47')][_0xc861('0x4b')]));_0x334e7f['attributes']=_0x334e7f['attributes']['length']?_0x334e7f[_0xc861('0x4c')]:_0x420877[_0xc861('0x46')];if(!_0x480fd0[_0xc861('0x47')]['hasOwnProperty']('nolimit')){_0x334e7f[_0xc861('0x30')]=qs[_0xc861('0x30')](_0x480fd0[_0xc861('0x47')][_0xc861('0x30')]);_0x334e7f[_0xc861('0x2f')]=qs[_0xc861('0x2f')](_0x480fd0[_0xc861('0x47')]['offset']);}_0x334e7f[_0xc861('0x4d')]=qs[_0xc861('0x4e')](_0x480fd0[_0xc861('0x47')]['sort']);_0x334e7f[_0xc861('0x4f')]=qs['filters'](_[_0xc861('0x50')](_0x480fd0[_0xc861('0x47')],_0x420877['filters']),_0x53783e);if(_0x480fd0[_0xc861('0x47')][_0xc861('0x51')]){_0x334e7f[_0xc861('0x4f')]=_[_0xc861('0x52')](_0x334e7f[_0xc861('0x4f')],{'$or':_[_0xc861('0x41')](_0x53783e,function(_0x5aeb2f){if(_0x5aeb2f[_0xc861('0x44')]!==_0xc861('0x53')){var _0x58d060={};_0x58d060[_0x5aeb2f[_0xc861('0x3e')]]={'$like':'%'+_0x480fd0['query'][_0xc861('0x51')]+'%'};return _0x58d060;}})});}_0x334e7f=_[_0xc861('0x52')]({},_0x334e7f,_0x480fd0[_0xc861('0x54')]);var _0x3f846e={'where':_0x334e7f['where']};return db['OpenchannelAccount'][_0xc861('0x32')](_0x3f846e)[_0xc861('0x23')](function(_0x9e01f4){_0x59626f[_0xc861('0x32')]=_0x9e01f4;if(_0x480fd0[_0xc861('0x47')][_0xc861('0x55')]){_0x334e7f[_0xc861('0x56')]=[{'all':!![]}];}return db[_0xc861('0x57')][_0xc861('0x58')](_0x334e7f);})[_0xc861('0x23')](function(_0x2db99a){_0x59626f[_0xc861('0x59')]=_0x2db99a;return _0x59626f;})[_0xc861('0x23')](respondWithFilteredResult(_0x6e3707,_0x334e7f))[_0xc861('0x5a')](handleError(_0x6e3707,null));};exports[_0xc861('0x5b')]=function(_0x106b56,_0x58b1e5){var _0x401f0e={'raw':![],'where':{'id':_0x106b56['params']['id']},'include':[{'model':db[_0xc861('0x5c')],'as':_0xc861('0x40')}]},_0x5e4cf9={};_0x5e4cf9[_0xc861('0x46')]=_[_0xc861('0x48')](db[_0xc861('0x57')][_0xc861('0x42')]);_0x5e4cf9[_0xc861('0x47')]=_[_0xc861('0x48')](_0x106b56[_0xc861('0x47')]);_0x5e4cf9[_0xc861('0x49')]=_[_0xc861('0x4a')](_0x5e4cf9['model'],_0x5e4cf9[_0xc861('0x47')]);_0x401f0e[_0xc861('0x4c')]=_[_0xc861('0x4a')](_0x5e4cf9[_0xc861('0x46')],qs['fields'](_0x106b56[_0xc861('0x47')]['fields']));_0x401f0e[_0xc861('0x4c')]=_0x401f0e[_0xc861('0x4c')][_0xc861('0x5d')]?_0x401f0e[_0xc861('0x4c')]:_0x5e4cf9[_0xc861('0x46')];if(_0x106b56[_0xc861('0x47')][_0xc861('0x55')]){_0x401f0e['include']=[{'all':!![]}];}_0x401f0e=_[_0xc861('0x52')]({},_0x401f0e,_0x106b56[_0xc861('0x54')]);return db[_0xc861('0x57')][_0xc861('0x5e')](_0x401f0e)[_0xc861('0x23')](handleEntityNotFound(_0x58b1e5,null))[_0xc861('0x23')](respondWithResult(_0x58b1e5,null))[_0xc861('0x5a')](handleError(_0x58b1e5,null));};exports[_0xc861('0x5f')]=function(_0x1be63d,_0x5e6d4e){return db[_0xc861('0x57')]['create'](_0x1be63d[_0xc861('0x60')],{})['then'](function(_0x239339){var _0x543926=_0x1be63d[_0xc861('0x61')]['get']({'plain':!![]});if(!_0x543926)throw new Error(_0xc861('0x62'));if(_0x543926[_0xc861('0x63')]===_0xc861('0x61')){var _0x776a07=_0x239339['get']({'plain':!![]});var _0x44b3b2=_0xc861('0x64');return db['UserProfileSection']['find']({'where':{'name':_0x44b3b2,'userProfileId':_0x543926[_0xc861('0x65')]},'raw':!![]})[_0xc861('0x23')](function(_0x3c1569){if(_0x3c1569&&_0x3c1569['autoAssociation']===0x0){return db[_0xc861('0x3a')][_0xc861('0x5f')]({'name':_0x776a07[_0xc861('0x3e')],'resourceId':_0x776a07['id'],'type':_0x3c1569[_0xc861('0x3e')],'sectionId':_0x3c1569['id']},{})['then'](function(){return _0x239339;});}else{return _0x239339;}})[_0xc861('0x5a')](function(_0x203c80){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x203c80);throw _0x203c80;});}return _0x239339;})[_0xc861('0x23')](respondWithResult(_0x5e6d4e,0xc9))['catch'](handleError(_0x5e6d4e,null));};exports[_0xc861('0x37')]=function(_0x3b19b0,_0x97faa4){if(_0x3b19b0[_0xc861('0x60')]['id']){delete _0x3b19b0['body']['id'];}return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x3b19b0[_0xc861('0x66')]['id']},'include':[{'model':db[_0xc861('0x5c')],'as':_0xc861('0x40')}]})[_0xc861('0x23')](handleEntityNotFound(_0x97faa4,null))[_0xc861('0x23')](saveUpdates(_0x3b19b0[_0xc861('0x60')],null))[_0xc861('0x23')](respondWithResult(_0x97faa4,null))[_0xc861('0x5a')](handleError(_0x97faa4,null));};exports['destroy']=function(_0x4c2360,_0x3526b8){return db[_0xc861('0x57')]['find']({'where':{'id':_0x4c2360['params']['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x3526b8,null))[_0xc861('0x23')](removeEntity(_0x3526b8,null))[_0xc861('0x5a')](handleError(_0x3526b8,null));};exports[_0xc861('0x67')]=function(_0x5baa46,_0x3f959d){return db[_0xc861('0x57')][_0xc861('0x67')]()[_0xc861('0x23')](respondWithResult(_0x3f959d,null))[_0xc861('0x5a')](handleError(_0x3f959d,null));};exports[_0xc861('0x68')]=function(_0x51638f,_0x14ba0f,_0x1226be){if(_0x51638f[_0xc861('0x60')]['id']){delete _0x51638f[_0xc861('0x60')]['id'];}return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x51638f[_0xc861('0x66')]['id']}})['then'](handleEntityNotFound(_0x14ba0f,null))[_0xc861('0x23')](function(_0x349eb6){if(_0x349eb6){_0x51638f[_0xc861('0x60')]['OpenchannelAccountId']=_0x349eb6['id'];return db[_0xc861('0x69')][_0xc861('0x5f')](_0x51638f[_0xc861('0x60')]);}})[_0xc861('0x23')](respondWithResult(_0x14ba0f,null))[_0xc861('0x5a')](handleError(_0x14ba0f,null));};exports[_0xc861('0x6a')]=function(_0x4eff62,_0x575961,_0xe36feb){var _0xde2f63={'raw':![],'where':{}};var _0x521300={};var _0x2fc059={'count':0x0,'rows':[]};return db[_0xc861('0x57')]['findOne']({'where':{'id':_0x4eff62[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x575961,null))['then'](function(_0x1b26ec){if(_0x1b26ec){_0x521300[_0xc861('0x46')]=_[_0xc861('0x48')](db[_0xc861('0x69')][_0xc861('0x42')]);_0x521300['query']=_[_0xc861('0x48')](_0x4eff62[_0xc861('0x47')]);_0x521300[_0xc861('0x49')]=_['intersection'](_0x521300['model'],_0x521300['query']);_0xde2f63[_0xc861('0x4c')]=_[_0xc861('0x4a')](_0x521300['model'],qs[_0xc861('0x4b')](_0x4eff62[_0xc861('0x47')][_0xc861('0x4b')]));_0xde2f63['attributes']=_0xde2f63[_0xc861('0x4c')][_0xc861('0x5d')]?_0xde2f63[_0xc861('0x4c')]:_0x521300[_0xc861('0x46')];if(!_0x4eff62['query'][_0xc861('0x6b')](_0xc861('0x6c'))){_0xde2f63['limit']=qs[_0xc861('0x30')](_0x4eff62[_0xc861('0x47')][_0xc861('0x30')]);_0xde2f63['offset']=qs['offset'](_0x4eff62['query'][_0xc861('0x2f')]);}_0xde2f63['order']=qs['sort'](_0x4eff62[_0xc861('0x47')][_0xc861('0x4e')]);_0xde2f63[_0xc861('0x4f')]=qs[_0xc861('0x49')](_['pick'](_0x4eff62[_0xc861('0x47')],_0x521300['filters']));_0xde2f63[_0xc861('0x4f')][_0xc861('0x6d')]=_0x1b26ec['id'];if(_0x4eff62[_0xc861('0x47')][_0xc861('0x51')]){_0xde2f63[_0xc861('0x4f')]=_['merge'](_0xde2f63[_0xc861('0x4f')],{'$or':_[_0xc861('0x41')](_0xde2f63[_0xc861('0x4c')],function(_0x1e2321){var _0x6562a3={};_0x6562a3[_0x1e2321]={'$like':'%'+_0x4eff62[_0xc861('0x47')]['filter']+'%'};return _0x6562a3;})});}_0xde2f63=_[_0xc861('0x52')]({},_0xde2f63,_0x4eff62[_0xc861('0x54')]);return db[_0xc861('0x69')][_0xc861('0x32')]({'where':_0xde2f63[_0xc861('0x4f')]})[_0xc861('0x23')](function(_0x470041){_0x2fc059['count']=_0x470041;if(_0x4eff62[_0xc861('0x47')][_0xc861('0x55')]){_0xde2f63[_0xc861('0x56')]=[{'all':!![]}];}return db[_0xc861('0x69')][_0xc861('0x58')](_0xde2f63);})[_0xc861('0x23')](function(_0x2d5ff){_0x2fc059[_0xc861('0x59')]=_0x2d5ff;return _0x2fc059;});}})['then'](respondWithFilteredResult(_0x575961,_0xde2f63))['catch'](handleError(_0x575961,null));};exports[_0xc861('0x6e')]=function(_0x2debbe,_0x4bf852,_0x16899a){return db[_0xc861('0x57')]['find']({'where':{'id':_0x2debbe[_0xc861('0x66')]['id']}})['then'](handleEntityNotFound(_0x4bf852,null))[_0xc861('0x23')](function(_0x5b4269){if(_0x5b4269){return _0x5b4269[_0xc861('0x6e')](_0x2debbe[_0xc861('0x47')]['ids']);}})[_0xc861('0x23')](respondWithStatusCode(_0x4bf852,null))[_0xc861('0x5a')](handleError(_0x4bf852,null));};exports[_0xc861('0x6f')]=function(_0x23b709,_0x41a222,_0x512969){if(_0x23b709['body']['id']){delete _0x23b709[_0xc861('0x60')]['id'];}return db[_0xc861('0x57')]['find']({'where':{'id':_0x23b709[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x41a222,null))['then'](function(_0x5f0152){if(_0x5f0152){_0x23b709[_0xc861('0x60')][_0xc861('0x6d')]=_0x5f0152['id'];return db['CannedAnswer'][_0xc861('0x5f')](_0x23b709[_0xc861('0x60')]);}})[_0xc861('0x23')](respondWithResult(_0x41a222,null))[_0xc861('0x5a')](handleError(_0x41a222,null));};exports[_0xc861('0x70')]=function(_0x4b1ebd,_0x2c0715,_0x272cee){var _0x5b4791={'raw':![],'where':{}};var _0x1fa681={};var _0x69ca04={'count':0x0,'rows':[]};return db[_0xc861('0x57')]['findOne']({'where':{'id':_0x4b1ebd['params']['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x2c0715,null))['then'](function(_0x44e077){if(_0x44e077){_0x1fa681[_0xc861('0x46')]=_['keys'](db[_0xc861('0x71')][_0xc861('0x42')]);_0x1fa681[_0xc861('0x47')]=_[_0xc861('0x48')](_0x4b1ebd['query']);_0x1fa681['filters']=_[_0xc861('0x4a')](_0x1fa681[_0xc861('0x46')],_0x1fa681[_0xc861('0x47')]);_0x5b4791[_0xc861('0x4c')]=_['intersection'](_0x1fa681[_0xc861('0x46')],qs['fields'](_0x4b1ebd[_0xc861('0x47')][_0xc861('0x4b')]));_0x5b4791[_0xc861('0x4c')]=_0x5b4791[_0xc861('0x4c')][_0xc861('0x5d')]?_0x5b4791[_0xc861('0x4c')]:_0x1fa681[_0xc861('0x46')];if(!_0x4b1ebd['query'][_0xc861('0x6b')](_0xc861('0x6c'))){_0x5b4791[_0xc861('0x30')]=qs['limit'](_0x4b1ebd[_0xc861('0x47')]['limit']);_0x5b4791[_0xc861('0x2f')]=qs[_0xc861('0x2f')](_0x4b1ebd[_0xc861('0x47')][_0xc861('0x2f')]);}_0x5b4791['order']=qs['sort'](_0x4b1ebd[_0xc861('0x47')][_0xc861('0x4e')]);_0x5b4791[_0xc861('0x4f')]=qs['filters'](_[_0xc861('0x50')](_0x4b1ebd['query'],_0x1fa681[_0xc861('0x49')]));_0x5b4791[_0xc861('0x4f')][_0xc861('0x6d')]=_0x44e077['id'];if(_0x4b1ebd[_0xc861('0x47')][_0xc861('0x51')]){_0x5b4791[_0xc861('0x4f')]=_['merge'](_0x5b4791[_0xc861('0x4f')],{'$or':_[_0xc861('0x41')](_0x5b4791['attributes'],function(_0x1d090e){var _0x24f7ae={};_0x24f7ae[_0x1d090e]={'$like':'%'+_0x4b1ebd[_0xc861('0x47')][_0xc861('0x51')]+'%'};return _0x24f7ae;})});}_0x5b4791=_[_0xc861('0x52')]({},_0x5b4791,_0x4b1ebd['options']);return db[_0xc861('0x71')][_0xc861('0x32')]({'where':_0x5b4791['where']})['then'](function(_0x1b3a94){_0x69ca04[_0xc861('0x32')]=_0x1b3a94;if(_0x4b1ebd[_0xc861('0x47')][_0xc861('0x55')]){_0x5b4791[_0xc861('0x56')]=[{'all':!![]}];}return db[_0xc861('0x71')]['findAll'](_0x5b4791);})['then'](function(_0x1ebdc2){_0x69ca04[_0xc861('0x59')]=_0x1ebdc2;return _0x69ca04;});}})[_0xc861('0x23')](respondWithFilteredResult(_0x2c0715,_0x5b4791))['catch'](handleError(_0x2c0715,null));};exports[_0xc861('0x72')]=function(_0xbb952,_0xeda883,_0xdd7568){return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0xbb952[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0xeda883,null))[_0xc861('0x23')](function(_0x1faf2a){if(_0x1faf2a){return _0x1faf2a[_0xc861('0x72')](_0xbb952['query']['ids']);}})[_0xc861('0x23')](respondWithStatusCode(_0xeda883,null))[_0xc861('0x5a')](handleError(_0xeda883,null));};exports[_0xc861('0x73')]=function(_0x5a5790,_0x54bf9c,_0x5b3b9b){var _0x580135={'body':_0x5a5790['body'],'channel':_0xc861('0x74')};var _0x1362cc=[];var _0x595117=[];var _0x3d2ce8={};var _0x3f2cdb=![];return db[_0xc861('0x75')][_0xc861('0x67')]()[_0xc861('0x23')](function(_0x931112){if(!_0x931112){throw new db['Sequelize']['ValidationError'](_0xc861('0x76'));}_0x1362cc=_[_0xc861('0x77')](_[_0xc861('0x48')](_0x931112),[_0xc861('0x78'),_0xc861('0x79')]);_0x595117=_[_0xc861('0x77')](_['keys'](_0x931112),['createdAt',_0xc861('0x79'),'CompanyId',_0xc861('0x7a')]);if(_0x5a5790[_0xc861('0x60')]['id']){delete _0x5a5790['body']['id'];}if(_[_0xc861('0x7b')](_0x5a5790[_0xc861('0x60')][_0xc861('0x7c')])){throw new db[(_0xc861('0x7d'))][(_0xc861('0x7e'))](_0xc861('0x7f'));}if(_[_0xc861('0x7b')](_0x5a5790[_0xc861('0x60')][_0xc861('0x60')])||_0x5a5790[_0xc861('0x60')]['body']===''){throw new db['Sequelize'][(_0xc861('0x7e'))](_0xc861('0x80'));}if(_[_0xc861('0x7b')](_0x5a5790[_0xc861('0x60')][_0xc861('0x81')])){throw new db[(_0xc861('0x7d'))]['ValidationError'](_0xc861('0x82')+_0x595117);}if(!_[_0xc861('0x83')](_0x595117,_0x5a5790[_0xc861('0x60')][_0xc861('0x81')])){throw new db['Sequelize'][(_0xc861('0x7e'))](_0xc861('0x84')+_0x595117);}_0x3d2ce8[_0x5a5790['body']['mapKey']]=_0x5a5790[_0xc861('0x60')]['from'];})[_0xc861('0x23')](function(){return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x5a5790['params']['id']},'include':[{'model':db[_0xc861('0x85')],'as':_0xc861('0x86'),'include':[{'model':db[_0xc861('0x75')],'as':_0xc861('0x87'),'where':_0x3d2ce8,'limit':0x1,'order':[[_0xc861('0x79'),_0xc861('0x88')]]}]},{'model':db[_0xc861('0x89')],'as':_0xc861('0x8a')}]});})['then'](handleEntityNotFound(_0x54bf9c,null))[_0xc861('0x23')](function(_0x4c07cf){if(_0x4c07cf&&_0x4c07cf[_0xc861('0x86')]){_0x580135[_0xc861('0x8b')]=_0x4c07cf;_0x580135[_0xc861('0x8c')]=_0x4c07cf[_0xc861('0x8a')];_0x580135[_0xc861('0x8d')]=_0x4c07cf[_0xc861('0x86')];_0x580135['applications']=_[_0xc861('0x8e')](_0x580135[_0xc861('0x8c')],[_0xc861('0x8f')],[_0xc861('0x90')]);if(_0x580135[_0xc861('0x8b')][_0xc861('0x8a')]){delete _0x580135[_0xc861('0x8b')][_0xc861('0x8a')];}if(_0x580135['account'][_0xc861('0x86')]&&_0x580135[_0xc861('0x8b')][_0xc861('0x86')]['Contacts']['length']){return _0x580135[_0xc861('0x8b')]['List'][_0xc861('0x87')][0x0];}var _0x20afba=_[_0xc861('0x1e')](_0x5a5790[_0xc861('0x60')],{'firstName':_0x5a5790[_0xc861('0x60')][_0xc861('0x7c')],'ListId':_0x4c07cf['ListId']});_0x20afba[_0x5a5790['body']['mapKey']]=_0x5a5790[_0xc861('0x60')][_0xc861('0x7c')];return db[_0xc861('0x75')][_0xc861('0x5f')](_0x20afba,{'fields':_0x1362cc,'raw':!![]});}})[_0xc861('0x23')](handleEntityNotFound(_0x54bf9c,null))[_0xc861('0x23')](function(_0x495462){_0x580135['contact']=_0x495462;if(_0x495462){var _0x3ca1bd={'ContactId':_0x495462['id'],'OpenchannelAccountId':_0x5a5790[_0xc861('0x66')]['id'],'from':(_0x495462['firstName']||'')+'\x20'+(_0x495462['lastName']||'')};var _0x37f75a={'OpenchannelAccountId':_0x5a5790[_0xc861('0x66')]['id'],'closed':![]};if(_0x5a5790[_0xc861('0x60')][_0xc861('0x91')]){_0x37f75a[_0xc861('0x91')]=_0x5a5790[_0xc861('0x60')][_0xc861('0x91')];return db[_0xc861('0x92')][_0xc861('0x5e')]({'where':_0x37f75a})[_0xc861('0x23')](function(_0x33618e){if(_0x33618e){return[_0x33618e,![]];}_0x3ca1bd[_0xc861('0x91')]=_0x5a5790['body'][_0xc861('0x91')];_0x3ca1bd[_0xc861('0x93')]=_0x5a5790['body'][_0xc861('0x93')];return db[_0xc861('0x92')]['create'](_0x3ca1bd)['then'](function(_0x1a92a7){return[_0x1a92a7,!![]];});});}else{_0x37f75a['threadId']=null;}_0x37f75a[_0xc861('0x94')]=_0x495462['id'];return db[_0xc861('0x92')][_0xc861('0x5e')]({'where':_0x37f75a})[_0xc861('0x23')](function(_0x2a9bef){if(_0x2a9bef){return[_0x2a9bef,![]];}return db[_0xc861('0x92')][_0xc861('0x5f')](_0x3ca1bd)[_0xc861('0x23')](function(_0xa8adc1){return[_0xa8adc1,!![]];});});}})[_0xc861('0x95')](function(_0x546099,_0x238266){if(_0x546099){_0x3f2cdb=_0x238266;if(!_0x238266){var _0x268c25={'from':(_0x580135['contact'][_0xc861('0x96')]||'')+'\x20'+(_0x580135[_0xc861('0x97')][_0xc861('0x98')]||'')};if(_0x5a5790[_0xc861('0x60')][_0xc861('0x91')]&&_0x5a5790[_0xc861('0x60')][_0xc861('0x99')]&&_0x5a5790[_0xc861('0x60')][_0xc861('0x91')]!=_0x5a5790[_0xc861('0x60')][_0xc861('0x99')]){_0x268c25[_0xc861('0x91')]=_0x5a5790[_0xc861('0x60')][_0xc861('0x99')];}return _0x546099[_0xc861('0x37')](_0x268c25);}else{return _0x546099;}}})[_0xc861('0x23')](function(_0x4cb999){_0x580135[_0xc861('0x9a')]=_0x4cb999['get']({'plain':!![]});_0x580135[_0xc861('0x9a')][_0xc861('0x9b')]=_0x3f2cdb;if(_0x580135[_0xc861('0x9a')][_0xc861('0x9b')]){if(_0x580135['account'][_0xc861('0x9c')]){_0x580135['applications']['push']({'id':0x0,'priority':_0x580135[_0xc861('0x8c')][_0xc861('0x5d')]+0x1,'app':_0xc861('0x9d'),'appdata':_0xc861('0x9e'),'interval':_0xc861('0x9f')});}}return db[_0xc861('0xa0')]['create']({'body':_0x5a5790[_0xc861('0x60')][_0xc861('0x60')],'OpenchannelAccountId':_0x5a5790[_0xc861('0x66')]['id'],'OpenchannelInteractionId':_0x4cb999['id'],'direction':'in','ContactId':_0x580135[_0xc861('0x97')]['id'],'AttachmentId':_0x5a5790[_0xc861('0x60')][_0xc861('0xa1')]});})[_0xc861('0x23')](function(_0x5a8c20){_0x580135[_0xc861('0x2b')]=_0x5a8c20;if(_0x580135[_0xc861('0x9a')][_0xc861('0xa2')]){return db[_0xc861('0xa3')][_0xc861('0x5e')]({'attributes':['id',_0xc861('0x3e')],'where':{'id':_0x580135[_0xc861('0x9a')][_0xc861('0xa2')]}})[_0xc861('0x23')](function(_0x2f920e){if(_0x2f920e){_0x580135[_0xc861('0x8c')][_0xc861('0xa4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2f920e[_0xc861('0x3e')]+','+(_0x580135['account'][_0xc861('0xa5')]||0xa),'interval':'*,*,*,*'});_0x580135[_0xc861('0xa6')]=![];}return respondWithRpcPromise(_0xc861('0xa7'),_0xc861('0xa8'),_0x580135);});}return respondWithRpcPromise(_0xc861('0xa7'),_0xc861('0xa8'),_0x580135);})['then'](function(_0x119153){respondWithRpcPromise(_0xc861('0xa9'),_0xc861('0xa9'),{'event':_0xc861('0x73'),'message':_0x119153},client9002);return _0x119153;})['then'](respondWithResult(_0x54bf9c,null))[_0xc861('0x5a')](handleError(_0x54bf9c,null));};exports[_0xc861('0xaa')]=function(_0x3baeba,_0x50258a){var _0x3e05dd=_0x3baeba[_0xc861('0x66')]['id'];var _0x3fd37e=_0x3baeba[_0xc861('0x60')];var _0x4aed2b=0xc8;var _0x478bd3=null;return db[_0xc861('0xab')][_0xc861('0xac')]({'isolationLevel':db[_0xc861('0xab')][_0xc861('0xad')][_0xc861('0xae')][_0xc861('0xaf')]},function(_0x4f4217){return db[_0xc861('0x57')][_0xc861('0xb0')]({'where':{'id':_0x3e05dd},'transaction':_0x4f4217})[_0xc861('0x23')](function(_0xc2202d){if(_0xc2202d){return db[_0xc861('0x89')][_0xc861('0x38')]({'where':{'OpenchannelAccountId':_0x3e05dd},'transaction':_0x4f4217})[_0xc861('0x23')](function(){var _0x1e3a40=_[_0xc861('0x41')](_0x3fd37e,function(_0x56278d){_0x56278d[_0xc861('0x6d')]=_0x3e05dd;return _0x56278d;});return db[_0xc861('0x89')][_0xc861('0xb1')](_0x1e3a40,{'transaction':_0x4f4217});});}else{_0x4aed2b=0x194;_0x478bd3=[];}});})[_0xc861('0x23')](function(){if(_0x4aed2b!==0x194){return db['OpenchannelApplication'][_0xc861('0xb2')]({'where':{'OpenchannelAccountId':_0x3e05dd},'order':_0xc861('0x8f')})['then'](function(_0x18fcc6){_0x478bd3=_0x18fcc6;});}})[_0xc861('0x5a')](function(_0x12b0fb){_0x4aed2b=0x1f4;logger[_0xc861('0x28')](_0x12b0fb[_0xc861('0x3d')]);if(_0x12b0fb['name']){delete _0x12b0fb[_0xc861('0x3e')];}_0x478bd3=_0x12b0fb;})[_0xc861('0xb3')](function(){if(_0x478bd3===null){_0x50258a[_0xc861('0x3c')](_0x4aed2b);}else{if(_0x4aed2b===0x1f4){_0x50258a[_0xc861('0x2d')](_0x4aed2b)[_0xc861('0xb4')](_0x478bd3);}else{_0x50258a[_0xc861('0x2d')](_0x4aed2b)[_0xc861('0x2e')](_0x478bd3);}}});};exports[_0xc861('0xb5')]=function(_0x293329,_0x12a9b9,_0x316fb2){var _0x406431={};var _0x13708b={};var _0x4a270b;var _0x5585a8;return db[_0xc861('0x57')][_0xc861('0xb0')]({'where':{'id':_0x293329[_0xc861('0x66')]['id']}})['then'](handleEntityNotFound(_0x12a9b9,null))[_0xc861('0x23')](function(_0x3f5cd5){if(_0x3f5cd5){_0x4a270b=_0x3f5cd5;_0x13708b[_0xc861('0x46')]=_[_0xc861('0x48')](db['OpenchannelApplication'][_0xc861('0x42')]);_0x13708b[_0xc861('0x47')]=_[_0xc861('0x48')](_0x293329[_0xc861('0x47')]);_0x13708b[_0xc861('0x49')]=_['intersection'](_0x13708b['model'],_0x13708b[_0xc861('0x47')]);_0x406431['attributes']=_[_0xc861('0x4a')](_0x13708b[_0xc861('0x46')],qs[_0xc861('0x4b')](_0x293329[_0xc861('0x47')]['fields']));_0x406431[_0xc861('0x4c')]=_0x406431[_0xc861('0x4c')][_0xc861('0x5d')]?_0x406431[_0xc861('0x4c')]:_0x13708b[_0xc861('0x46')];_0x406431[_0xc861('0x4d')]=qs['sort'](_0x293329[_0xc861('0x47')][_0xc861('0x4e')]);_0x406431[_0xc861('0x4f')]=qs[_0xc861('0x49')](_[_0xc861('0x50')](_0x293329[_0xc861('0x47')],_0x13708b[_0xc861('0x49')]));if(_0x293329['query'][_0xc861('0x51')]){_0x406431['where']=_['merge'](_0x406431[_0xc861('0x4f')],{'$or':_['map'](_0x406431['attributes'],function(_0x30ea27){var _0x5c053c={};_0x5c053c[_0x30ea27]={'$like':'%'+_0x293329['query']['filter']+'%'};return _0x5c053c;})});}_0x406431=_[_0xc861('0x52')]({},_0x406431,_0x293329['options']);return _0x4a270b[_0xc861('0xb5')](_0x406431);}})['then'](function(_0x261bd0){if(_0x261bd0){_0x5585a8=_0x261bd0['length'];if(!_0x293329['query']['hasOwnProperty']('nolimit')){_0x406431[_0xc861('0x30')]=qs['limit'](_0x293329[_0xc861('0x47')][_0xc861('0x30')]);_0x406431[_0xc861('0x2f')]=qs[_0xc861('0x2f')](_0x293329[_0xc861('0x47')][_0xc861('0x2f')]);}return _0x4a270b[_0xc861('0xb5')](_0x406431);}})[_0xc861('0x23')](function(_0x4f70c5){if(_0x4f70c5){return _0x4f70c5?{'count':_0x5585a8,'rows':_0x4f70c5}:null;}})[_0xc861('0x23')](respondWithResult(_0x12a9b9,null))['catch'](handleError(_0x12a9b9,null));};exports[_0xc861('0xb6')]=function(_0x5242ec,_0x48630d,_0x1662d7){var _0x117694={'raw':![],'where':{}};var _0x27a044={};var _0x5ea04e={'count':0x0,'rows':[]};return db[_0xc861('0x57')][_0xc861('0xb0')]({'where':{'id':_0x5242ec[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x48630d,null))[_0xc861('0x23')](function(_0x4fffe3){if(_0x4fffe3){_0x27a044[_0xc861('0x46')]=_[_0xc861('0x48')](db['OpenchannelInteraction'][_0xc861('0x42')]);_0x27a044[_0xc861('0x47')]=_[_0xc861('0x48')](_0x5242ec[_0xc861('0x47')]);_0x27a044[_0xc861('0x49')]=_[_0xc861('0x4a')](_0x27a044[_0xc861('0x46')],_0x27a044[_0xc861('0x47')]);_0x117694[_0xc861('0x4c')]=_[_0xc861('0x4a')](_0x27a044['model'],qs[_0xc861('0x4b')](_0x5242ec[_0xc861('0x47')]['fields']));_0x117694[_0xc861('0x4c')]=_0x117694[_0xc861('0x4c')][_0xc861('0x5d')]?_0x117694[_0xc861('0x4c')]:_0x27a044[_0xc861('0x46')];if(!_0x5242ec[_0xc861('0x47')][_0xc861('0x6b')]('nolimit')){_0x117694['limit']=qs[_0xc861('0x30')](_0x5242ec[_0xc861('0x47')][_0xc861('0x30')]);_0x117694[_0xc861('0x2f')]=qs[_0xc861('0x2f')](_0x5242ec[_0xc861('0x47')][_0xc861('0x2f')]);}_0x117694[_0xc861('0x4d')]=qs['sort'](_0x5242ec[_0xc861('0x47')][_0xc861('0x4e')]);_0x117694[_0xc861('0x4f')]=qs['filters'](_['pick'](_0x5242ec[_0xc861('0x47')],_0x27a044['filters']));_0x117694[_0xc861('0x4f')][_0xc861('0x6d')]=_0x4fffe3['id'];if(_0x5242ec[_0xc861('0x47')][_0xc861('0x51')]){_0x117694['where']=_[_0xc861('0x52')](_0x117694[_0xc861('0x4f')],{'$or':_[_0xc861('0x41')](_0x117694['attributes'],function(_0x1dccad){var _0x34e57e={};_0x34e57e[_0x1dccad]={'$like':'%'+_0x5242ec['query'][_0xc861('0x51')]+'%'};return _0x34e57e;})});}_0x117694=_['merge']({},_0x117694,_0x5242ec[_0xc861('0x54')]);return db[_0xc861('0x92')]['count']({'where':_0x117694[_0xc861('0x4f')]})[_0xc861('0x23')](function(_0xe2d7b0){_0x5ea04e[_0xc861('0x32')]=_0xe2d7b0;if(_0x5242ec[_0xc861('0x47')][_0xc861('0x55')]){_0x117694[_0xc861('0x56')]=[{'model':db[_0xc861('0x75')],'as':_0xc861('0xb7'),'required':![]},{'model':db[_0xc861('0xa3')],'as':_0xc861('0xb8'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xc861('0xb9')],'as':_0xc861('0xba'),'attributes':['id',_0xc861('0x3e'),_0xc861('0xbb')],'where':_0x5242ec[_0xc861('0x47')]['tag']?{'id':_0x5242ec[_0xc861('0x47')]['tag']}:undefined,'required':_0x5242ec[_0xc861('0x47')][_0xc861('0xbc')]?!![]:![]}];}return db[_0xc861('0x92')][_0xc861('0x58')](_0x117694);})[_0xc861('0x23')](function(_0x2183cc){_0x5ea04e[_0xc861('0x59')]=_0x2183cc;return _0x5ea04e;});}})[_0xc861('0x23')](respondWithFilteredResult(_0x48630d,_0x117694))[_0xc861('0x5a')](handleError(_0x48630d,null));};exports[_0xc861('0xbd')]=function(_0x31896b,_0x44f994,_0xb42cea){return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x31896b[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x44f994,null))[_0xc861('0x23')](function(_0x34e87d){if(_0x34e87d){return _0x34e87d['addAgents'](_0x31896b[_0xc861('0x60')]['ids'],_[_0xc861('0xbe')](_0x31896b['body'],[_0xc861('0xbf'),'id'])||{})[_0xc861('0x95')](function(_0x4a6851){for(var _0x109218=0x0;_0x109218<_0x31896b['body']['ids'][_0xc861('0x5d')];_0x109218+=0x1){socket[_0xc861('0xc0')](_0xc861('0xc1'),{'UserId':Number(_0x31896b[_0xc861('0x60')][_0xc861('0xbf')][_0x109218]),'OpenchannelAccountId':Number(_0x31896b[_0xc861('0x66')]['id'])});}return _0x4a6851;});}})[_0xc861('0x23')](respondWithResult(_0x44f994,null))[_0xc861('0x5a')](handleError(_0x44f994,null));};exports[_0xc861('0xc2')]=function(_0x50be39,_0x285651,_0x3947e1){return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x50be39[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x285651,null))[_0xc861('0x23')](function(_0x279e68){if(_0x279e68){return _0x279e68[_0xc861('0xc2')](_0x50be39[_0xc861('0x47')][_0xc861('0xbf')])[_0xc861('0x23')](function(){if(_[_0xc861('0xc3')](_0x50be39[_0xc861('0x47')][_0xc861('0xbf')])){for(var _0xa11a49=0x0;_0xa11a49<_0x50be39[_0xc861('0x47')][_0xc861('0xbf')][_0xc861('0x5d')];_0xa11a49+=0x1){socket[_0xc861('0xc0')](_0xc861('0xc4'),{'UserId':Number(_0x50be39['query'][_0xc861('0xbf')][_0xa11a49]),'OpenchannelAccountId':Number(_0x50be39[_0xc861('0x66')]['id'])});}}else{socket[_0xc861('0xc0')](_0xc861('0xc4'),{'UserId':Number(_0x50be39[_0xc861('0x47')][_0xc861('0xbf')]),'OpenchannelAccountId':Number(_0x50be39[_0xc861('0x66')]['id'])});}});}})[_0xc861('0x23')](respondWithStatusCode(_0x285651,null))[_0xc861('0x5a')](handleError(_0x285651,null));};exports[_0xc861('0xc5')]=function(_0x22dee0,_0x3833c0,_0xbbeedd){var _0xa13d89={};var _0x4e78c7={};var _0x15e02e;var _0x24e9c8;return db[_0xc861('0x57')][_0xc861('0xb0')]({'where':{'id':_0x22dee0['params']['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x3833c0,null))[_0xc861('0x23')](function(_0x1a8df2){if(_0x1a8df2){_0x15e02e=_0x1a8df2;_0x4e78c7[_0xc861('0x46')]=_[_0xc861('0x48')](db[_0xc861('0xa3')][_0xc861('0x42')]);_0x4e78c7[_0xc861('0x47')]=_[_0xc861('0x48')](_0x22dee0[_0xc861('0x47')]);_0x4e78c7[_0xc861('0x49')]=_[_0xc861('0x4a')](_0x4e78c7[_0xc861('0x46')],_0x4e78c7['query']);_0xa13d89[_0xc861('0x4c')]=_['intersection'](_0x4e78c7[_0xc861('0x46')],qs[_0xc861('0x4b')](_0x22dee0[_0xc861('0x47')]['fields']));_0xa13d89[_0xc861('0x4c')]=_0xa13d89['attributes'][_0xc861('0x5d')]?_0xa13d89['attributes']:_0x4e78c7[_0xc861('0x46')];_0xa13d89[_0xc861('0x4d')]=qs['sort'](_0x22dee0['query'][_0xc861('0x4e')]);_0xa13d89[_0xc861('0x4f')]=qs['filters'](_[_0xc861('0x50')](_0x22dee0[_0xc861('0x47')],_0x4e78c7[_0xc861('0x49')]));if(_0x22dee0[_0xc861('0x47')]['filter']){_0xa13d89[_0xc861('0x4f')]=_[_0xc861('0x52')](_0xa13d89[_0xc861('0x4f')],{'$or':_[_0xc861('0x41')](_0xa13d89[_0xc861('0x4c')],function(_0x513d34){var _0x5a1e11={};_0x5a1e11[_0x513d34]={'$like':'%'+_0x22dee0[_0xc861('0x47')][_0xc861('0x51')]+'%'};return _0x5a1e11;})});}_0xa13d89=_['merge']({},_0xa13d89,_0x22dee0[_0xc861('0x54')]);return _0x15e02e[_0xc861('0xc5')](_0xa13d89);}})[_0xc861('0x23')](function(_0x2ef9c3){if(_0x2ef9c3){_0x24e9c8=_0x2ef9c3['length'];if(!_0x22dee0[_0xc861('0x47')]['hasOwnProperty']('nolimit')){_0xa13d89[_0xc861('0x30')]=qs[_0xc861('0x30')](_0x22dee0[_0xc861('0x47')][_0xc861('0x30')]);_0xa13d89[_0xc861('0x2f')]=qs['offset'](_0x22dee0[_0xc861('0x47')]['offset']);}return _0x15e02e[_0xc861('0xc5')](_0xa13d89);}})[_0xc861('0x23')](function(_0x5cb569){if(_0x5cb569){return _0x5cb569?{'count':_0x24e9c8,'rows':_0x5cb569}:null;}})[_0xc861('0x23')](respondWithResult(_0x3833c0,null))[_0xc861('0x5a')](handleError(_0x3833c0,null));};exports[_0xc861('0xb4')]=function(_0x349171,_0x4afead,_0x11b1a0){var _0x553b43,_0x39a370,_0xb1125a;if(_['isNil'](_0x349171[_0xc861('0x60')][_0xc861('0x60')])||_0x349171[_0xc861('0x60')][_0xc861('0x60')]===''){throw new db['Sequelize'][(_0xc861('0x7e'))](_0xc861('0x80'));}if(_[_0xc861('0x7b')](_0x349171[_0xc861('0x60')]['to'])){}_0x553b43=_0x349171['body']['to'];return db[_0xc861('0x57')][_0xc861('0xb0')]({'where':{'id':_0x349171['params']['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x4afead,null))[_0xc861('0x23')](function(_0x13cf60){if(_0x13cf60){return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x13cf60['id']},'include':[{'model':db[_0xc861('0x85')],'as':_0xc861('0x86'),'include':[{'model':db[_0xc861('0x75')],'as':'Contacts','where':{[_0x13cf60[_0xc861('0x81')]]:_0x553b43},'limit':0x1,'order':[['updatedAt',_0xc861('0x88')]]}]}]})['then'](handleEntityNotFound(_0x4afead,null))[_0xc861('0x23')](function(_0x1a7a5c){if(_0x1a7a5c&&_0x1a7a5c['List']){_0x39a370=_0x1a7a5c[_0xc861('0x39')]({'plain':!![]});if(_0x39a370[_0xc861('0x86')]&&_0x39a370[_0xc861('0x86')][_0xc861('0x87')][_0xc861('0x5d')]){return _0x39a370['List']['Contacts'][0x0];}return db[_0xc861('0x75')][_0xc861('0x5f')](_['defaults'](_0x349171['body'],{'firstName':_0x553b43,[_0x1a7a5c['mapKey']]:_0x553b43,'phone':_0x553b43,'ListId':_0x39a370[_0xc861('0x7a')]}));}})['then'](handleEntityNotFound(_0x4afead,null))[_0xc861('0x23')](function(_0x7e7bf0){if(_0x7e7bf0){_0xb1125a=_0x7e7bf0;return db['OpenchannelInteraction'][_0xc861('0x5e')]({'where':{'ContactId':_0xb1125a['id'],'closed':![],'OpenchannelAccountId':_0x39a370['id']}})[_0xc861('0x23')](function(_0x4f086f){if(_0x4f086f){return[_0x4f086f,![]];}return db[_0xc861('0x92')][_0xc861('0x5f')]({'UserId':_0x349171[_0xc861('0x61')]['id'],'ContactId':_0xb1125a['id'],'OpenchannelAccountId':_0x39a370['id'],'lastMsgDirection':_0xc861('0xc6'),'firstMsgDirection':_0xc861('0xc6'),'Messages':[_[_0xc861('0x52')](_0x349171[_0xc861('0x60')],{'read':![],'body':_0x349171[_0xc861('0x60')]['body'],'OpenchannelAccountId':_0x39a370['id'],'UserId':_0x349171['user']['id'],'ContactId':_0xb1125a['id']})]},{'include':[{'model':db[_0xc861('0xa0')],'as':_0xc861('0xc7')}]})[_0xc861('0x23')](function(_0x35c853){return[_0x35c853,!![]];});});}})['spread'](function(_0x2b9d9d,_0x3ca740){if(_0x3ca740){return _0x2b9d9d;}return db[_0xc861('0xa0')]['create'](_[_0xc861('0x52')](_0x349171[_0xc861('0x60')],{'read':![],'body':_0x349171[_0xc861('0x60')][_0xc861('0x60')],'OpenchannelAccountId':_0x39a370['id'],'OpenchannelInteractionId':_0x2b9d9d['id'],'UserId':_0x349171[_0xc861('0x61')]['id'],'ContactId':_0xb1125a['id']}))['then'](function(_0x17104d){_0x2b9d9d[_0xc861('0xc8')][_0xc861('0xc7')]=[];_0x2b9d9d[_0xc861('0xc8')][_0xc861('0xc7')][_0xc861('0xc9')](_0x17104d[_0xc861('0xc8')]);return _0x2b9d9d;});});}})[_0xc861('0x23')](respondWithResult(_0x4afead,null))[_0xc861('0x5a')](handleError(_0x4afead,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 288ec46..964034e 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 _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0x309388,_0x1cc585){var _0x4d290f=function(_0x407ffc){while(--_0x407ffc){_0x309388['push'](_0x309388['shift']());}};_0x4d290f(++_0x1cc585);}(_0xe706,0xa3));var _0x6e70=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xe706[_0x454165];return _0x56db53;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x153f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount'];(function(_0x4b893c,_0x505a01){var _0x25e85a=function(_0x40c23e){while(--_0x40c23e){_0x4b893c['push'](_0x4b893c['shift']());}};_0x25e85a(++_0x505a01);}(_0x153f,0x15b));var _0xf153=function(_0x38ef88,_0x12d9fe){_0x38ef88=_0x38ef88-0x0;var _0x5dd001=_0x153f[_0x38ef88];return _0x5dd001;};'use strict';var EventEmitter=require(_0xf153('0x0'));var OpenchannelAccount=require(_0xf153('0x1'))['db'][_0xf153('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf153('0x3')](0x0);var events={'afterCreate':_0xf153('0x4'),'afterUpdate':_0xf153('0x5'),'afterDestroy':_0xf153('0x6')};function emitEvent(_0x59757c){return function(_0x364e65,_0x5c49c7,_0x1f9ead){OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c+':'+_0x364e65['id'],_0x364e65);OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c,_0x364e65);_0x1f9ead(null);};}for(var e in events){if(events[_0xf153('0x8')](e)){var event=events[e];OpenchannelAccount[_0xf153('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e09d9a3..f5eea3b 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(_0x302c8f,_0xa979d4){var _0x1894c=function(_0x180f56){while(--_0x180f56){_0x302c8f['push'](_0x302c8f['shift']());}};_0x1894c(++_0xa979d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x33e7e4,_0x223b3a){var _0x3e04d3=function(_0x2a4d33){while(--_0x2a4d33){_0x33e7e4['push'](_0x33e7e4['shift']());}};_0x3e04d3(++_0x223b3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 69aa3af..e01d2b3 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 _0x9e6b=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb'];(function(_0x2c4842,_0x4b09fe){var _0x4b6b7f=function(_0x8627e0){while(--_0x8627e0){_0x2c4842['push'](_0x2c4842['shift']());}};_0x4b6b7f(++_0x4b09fe);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9e6b[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var moment=require('moment');var BPromise=require(_0xb9e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9e6('0x3'))['db'];var utils=require(_0xb9e6('0x4'));var logger=require(_0xb9e6('0x5'))(_0xb9e6('0x6'));var config=require('../../config/environment');var jayson=require(_0xb9e6('0x7'));var client=jayson[_0xb9e6('0x8')][_0xb9e6('0x9')]({'port':0x232a});config['redis']=_[_0xb9e6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9e6('0xb')]));require('./openchannelAccount.socket')[_0xb9e6('0xc')](socket);function respondWithRpcPromise(_0x216b1a,_0x477b52,_0x3e18bf){return new BPromise(function(_0x40d57b,_0x43e8c8){return client[_0xb9e6('0xd')](_0x216b1a,_0x3e18bf)[_0xb9e6('0xe')](function(_0x165903){logger[_0xb9e6('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x477b52,_0xb9e6('0x10'));logger[_0xb9e6('0x11')](_0xb9e6('0x12'),_0x477b52,_0xb9e6('0x10'),JSON['stringify'](_0x165903));if(_0x165903[_0xb9e6('0x13')]){if(_0x165903[_0xb9e6('0x13')]['code']===0x1f4){logger['error'](_0xb9e6('0x14'),_0x477b52,_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);return _0x43e8c8(_0x165903[_0xb9e6('0x13')]['message']);}logger[_0xb9e6('0x13')](_0xb9e6('0x14'),_0x477b52,_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);return _0x40d57b(_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);}else{logger[_0xb9e6('0xf')](_0xb9e6('0x14'),_0x477b52,_0xb9e6('0x10'));_0x40d57b(_0x165903[_0xb9e6('0x16')]['message']);}})[_0xb9e6('0x17')](function(_0x53a357){logger[_0xb9e6('0x13')](_0xb9e6('0x14'),_0x477b52,_0x53a357);_0x43e8c8(_0x53a357);});});} \ No newline at end of file +var _0x0713=['socket.io-emitter','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x601573,_0x324781){var _0x1d25c6=function(_0x82d149){while(--_0x82d149){_0x601573['push'](_0x601573['shift']());}};_0x1d25c6(++_0x324781);}(_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});config[_0x3071('0xb')]=_[_0x3071('0xc')](config[_0x3071('0xb')],{'host':_0x3071('0xd'),'port':0x18eb});var socket=require(_0x3071('0xe'))(new Redis(config[_0x3071('0xb')]));require(_0x3071('0xf'))['register'](socket);function respondWithRpcPromise(_0x3457cd,_0x2610b4,_0x937259){return new BPromise(function(_0xff9a29,_0x1ce844){return client['request'](_0x3457cd,_0x937259)[_0x3071('0x10')](function(_0x11a7ee){logger[_0x3071('0x11')](_0x3071('0x12'),_0x2610b4,_0x3071('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2610b4,_0x3071('0x13'),JSON['stringify'](_0x11a7ee));if(_0x11a7ee[_0x3071('0x14')]){if(_0x11a7ee[_0x3071('0x14')]['code']===0x1f4){logger[_0x3071('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x2610b4,_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);return _0x1ce844(_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);}logger[_0x3071('0x14')](_0x3071('0x12'),_0x2610b4,_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);return _0xff9a29(_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);}else{logger['info'](_0x3071('0x12'),_0x2610b4,_0x3071('0x13'));_0xff9a29(_0x11a7ee[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x17aee2){logger[_0x3071('0x14')](_0x3071('0x12'),_0x2610b4,_0x17aee2);_0x1ce844(_0x17aee2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8dbc030..0f976b3 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 _0x4058=['emit','length','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4058,0x129));var _0x8405=function(_0x23b275,_0x4e8a16){_0x23b275=_0x23b275-0x0;var _0x244151=_0x4058[_0x23b275];return _0x244151;};'use strict';var OpenchannelAccountEvents=require(_0x8405('0x0'));var events=[_0x8405('0x1'),_0x8405('0x2'),_0x8405('0x3')];function createListener(_0x46c215,_0x22f2ce){return function(_0x70944b){_0x22f2ce[_0x8405('0x4')](_0x46c215,_0x70944b);};}function removeListener(_0xf8c24c,_0x4948b2){return function(){OpenchannelAccountEvents['removeListener'](_0xf8c24c,_0x4948b2);};}exports['register']=function(_0x1db7ea){for(var _0x257d43=0x0,_0x3d9bf6=events[_0x8405('0x5')];_0x257d43<_0x3d9bf6;_0x257d43++){var _0x1cb061=events[_0x257d43];var _0x479c97=createListener(_0x8405('0x6')+_0x1cb061,_0x1db7ea);OpenchannelAccountEvents['on'](_0x1cb061,_0x479c97);}}; \ No newline at end of file +var _0xa1b9=['openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa1b9,0x71));var _0x9a1b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa1b9[_0xbb091];return _0x467a04;};'use strict';var OpenchannelAccountEvents=require(_0x9a1b('0x0'));var events=['save',_0x9a1b('0x1'),_0x9a1b('0x2')];function createListener(_0x52aa17,_0x3515cf){return function(_0x353bb4){_0x3515cf[_0x9a1b('0x3')](_0x52aa17,_0x353bb4);};}function removeListener(_0x226928,_0x59f846){return function(){OpenchannelAccountEvents[_0x9a1b('0x4')](_0x226928,_0x59f846);};}exports[_0x9a1b('0x5')]=function(_0x36712b){for(var _0x16ad8e=0x0,_0x47cb95=events[_0x9a1b('0x6')];_0x16ad8e<_0x47cb95;_0x16ad8e++){var _0x534151=events[_0x16ad8e];var _0x17b671=createListener(_0x9a1b('0x7')+_0x534151,_0x36712b);OpenchannelAccountEvents['on'](_0x534151,_0x17b671);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 88816e8..a41fd43 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 _0xa2c4=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','path','express','Router','fs-extra'];(function(_0x284268,_0x338286){var _0x2c043b=function(_0x186db7){while(--_0x186db7){_0x284268['push'](_0x284268['shift']());}};_0x2c043b(++_0x338286);}(_0xa2c4,0x7c));var _0x4a2c=function(_0x4f5731,_0x45747a){_0x4f5731=_0x4f5731-0x0;var _0x24af31=_0xa2c4[_0x4f5731];return _0x24af31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4a2c('0x0'));var timeout=require('connect-timeout');var express=require(_0x4a2c('0x1'));var router=express[_0x4a2c('0x2')]();var fs_extra=require(_0x4a2c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4a2c('0x4'));var config=require(_0x4a2c('0x5'));var controller=require(_0x4a2c('0x6'));router[_0x4a2c('0x7')]('/',auth['isAuthenticated'](),controller[_0x4a2c('0x8')]);router[_0x4a2c('0x7')](_0x4a2c('0x9'),auth[_0x4a2c('0xa')](),controller['show']);router[_0x4a2c('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4a2c('0xc')]('/:id',auth[_0x4a2c('0xa')](),controller[_0x4a2c('0xd')]);router[_0x4a2c('0xe')](_0x4a2c('0x9'),auth[_0x4a2c('0xa')](),controller[_0x4a2c('0xf')]);module['exports']=router; \ No newline at end of file +var _0xaf34=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','update','delete','multer','path','express','Router','fs-extra'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0xaf34,0x163));var _0x4af3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xaf34[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x4af3('0x0'));var util=require('util');var path=require(_0x4af3('0x1'));var timeout=require('connect-timeout');var express=require(_0x4af3('0x2'));var router=express[_0x4af3('0x3')]();var fs_extra=require(_0x4af3('0x4'));var auth=require(_0x4af3('0x5'));var interaction=require(_0x4af3('0x6'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x4af3('0x7')](),controller[_0x4af3('0x8')]);router[_0x4af3('0x9')](_0x4af3('0xa'),auth['isAuthenticated'](),controller[_0x4af3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4af3('0xc')]);router['put'](_0x4af3('0xa'),auth[_0x4af3('0x7')](),controller[_0x4af3('0xd')]);router[_0x4af3('0xe')](_0x4af3('0xa'),auth[_0x4af3('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index c1f2d16..0f10a33 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 _0xc744=['INTEGER','STRING','exports'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xc744,0x1bb));var _0x4c74=function(_0x65298a,_0x4e7672){_0x65298a=_0x65298a-0x0;var _0x1a9cce=_0xc744[_0x65298a];return _0x1a9cce;};'use strict';var Sequelize=require('sequelize');module[_0x4c74('0x0')]={'priority':{'type':Sequelize[_0x4c74('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4c74('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4c74('0x2')]},'interval':{'type':Sequelize[_0x4c74('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9eea=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x9eea,0x18e));var _0xa9ee=function(_0x1c7377,_0x8a8698){_0x1c7377=_0x1c7377-0x0;var _0x5d03e3=_0x9eea[_0x1c7377];return _0x5d03e3;};'use strict';var Sequelize=require(_0xa9ee('0x0'));module[_0xa9ee('0x1')]={'priority':{'type':Sequelize[_0xa9ee('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa9ee('0x3')],'allowNull':![],'defaultValue':_0xa9ee('0x4')},'appdata':{'type':Sequelize[_0xa9ee('0x5')]()},'description':{'type':Sequelize[_0xa9ee('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa9ee('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 93c61a3..b2f2c5a 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 _0x576d=['find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','merge','options','OpenchannelApplication','include','findAll','rows','catch','show','length','includeAll'];(function(_0x2cf714,_0x4c03d1){var _0x135a2a=function(_0x41a1aa){while(--_0x41a1aa){_0x2cf714['push'](_0x2cf714['shift']());}};_0x135a2a(++_0x4c03d1);}(_0x576d,0x149));var _0xd576=function(_0x371710,_0xca9370){_0x371710=_0x371710-0x0;var _0xdf90e2=_0x576d[_0x371710];return _0xdf90e2;};'use strict';var emlformat=require(_0xd576('0x0'));var rimraf=require(_0xd576('0x1'));var zipdir=require(_0xd576('0x2'));var jsonpatch=require(_0xd576('0x3'));var rp=require(_0xd576('0x4'));var moment=require(_0xd576('0x5'));var BPromise=require(_0xd576('0x6'));var Mustache=require('mustache');var util=require(_0xd576('0x7'));var path=require(_0xd576('0x8'));var sox=require(_0xd576('0x9'));var csv=require(_0xd576('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd576('0xb'));var squel=require(_0xd576('0xc'));var crypto=require(_0xd576('0xd'));var jsforce=require(_0xd576('0xe'));var deskjs=require(_0xd576('0xf'));var toCsv=require(_0xd576('0xa'));var querystring=require(_0xd576('0x10'));var Papa=require(_0xd576('0x11'));var Redis=require(_0xd576('0x12'));var authService=require(_0xd576('0x13'));var qs=require(_0xd576('0x14'));var as=require(_0xd576('0x15'));var hardwareService=require(_0xd576('0x16'));var logger=require(_0xd576('0x17'))(_0xd576('0x18'));var utils=require(_0xd576('0x19'));var config=require(_0xd576('0x1a'));var licenseUtil=require(_0xd576('0x1b'));var db=require(_0xd576('0x1c'))['db'];function respondWithStatusCode(_0x3c0dbf,_0x56a23a){_0x56a23a=_0x56a23a||0xcc;return function(_0x33edb7){if(_0x33edb7){return _0x3c0dbf[_0xd576('0x1d')](_0x56a23a);}return _0x3c0dbf[_0xd576('0x1e')](_0x56a23a)[_0xd576('0x1f')]();};}function respondWithResult(_0x2ea98f,_0x677394){_0x677394=_0x677394||0xc8;return function(_0x57b7ba){if(_0x57b7ba){return _0x2ea98f[_0xd576('0x1e')](_0x677394)[_0xd576('0x20')](_0x57b7ba);}};}function respondWithFilteredResult(_0x47df2d,_0x4841fc){return function(_0x4036f0){if(_0x4036f0){var _0x5137c7=typeof _0x4841fc[_0xd576('0x21')]===_0xd576('0x22')&&typeof _0x4841fc['limit']===_0xd576('0x22');var _0x1ce768=_0x4036f0['count'];var _0x3fbc72=_0x5137c7?0x0:_0x4841fc[_0xd576('0x21')];var _0x11c9eb=_0x5137c7?_0x4036f0[_0xd576('0x23')]:_0x4841fc[_0xd576('0x21')]+_0x4841fc[_0xd576('0x24')];var _0x3911e2;if(_0x11c9eb>=_0x1ce768){_0x11c9eb=_0x1ce768;_0x3911e2=0xc8;}else{_0x3911e2=0xce;}_0x47df2d[_0xd576('0x1e')](_0x3911e2);return _0x47df2d[_0xd576('0x25')](_0xd576('0x26'),_0x3fbc72+'-'+_0x11c9eb+'/'+_0x1ce768)[_0xd576('0x20')](_0x4036f0);}return null;};}function patchUpdates(_0x400e64){return function(_0x4b1031){try{jsonpatch[_0xd576('0x27')](_0x4b1031,_0x400e64,!![]);}catch(_0x7684e2){return BPromise[_0xd576('0x28')](_0x7684e2);}return _0x4b1031[_0xd576('0x29')]();};}function saveUpdates(_0xfeafc0,_0x3f1565){return function(_0x448060){if(_0x448060){return _0x448060['update'](_0xfeafc0)['then'](function(_0xa5cb6f){return _0xa5cb6f;});}return null;};}function removeEntity(_0x12808c,_0x9984f9){return function(_0x198458){if(_0x198458){return _0x198458[_0xd576('0x2a')]()[_0xd576('0x2b')](function(){_0x12808c[_0xd576('0x1e')](0xcc)[_0xd576('0x1f')]();});}};}function handleEntityNotFound(_0x1ccc78,_0x14402e){return function(_0x207ecd){if(!_0x207ecd){_0x1ccc78[_0xd576('0x1d')](0x194);}return _0x207ecd;};}function handleError(_0x419327,_0x33fda8){_0x33fda8=_0x33fda8||0x1f4;return function(_0x520dd2){logger[_0xd576('0x2c')](_0x520dd2[_0xd576('0x2d')]);if(_0x520dd2[_0xd576('0x2e')]){delete _0x520dd2[_0xd576('0x2e')];}_0x419327['status'](_0x33fda8)[_0xd576('0x2f')](_0x520dd2);};}exports[_0xd576('0x30')]=function(_0x18f655,_0x5070f4){var _0x226e8f={},_0x47201b={},_0x596842={'count':0x0,'rows':[]};var _0x2b8069=_[_0xd576('0x31')](db['OpenchannelApplication'][_0xd576('0x32')],function(_0x1e6bec){return{'name':_0x1e6bec[_0xd576('0x33')],'type':_0x1e6bec[_0xd576('0x34')]['key']};});_0x47201b['model']=_[_0xd576('0x31')](_0x2b8069,_0xd576('0x2e'));_0x47201b[_0xd576('0x35')]=_[_0xd576('0x36')](_0x18f655[_0xd576('0x35')]);_0x47201b[_0xd576('0x37')]=_[_0xd576('0x38')](_0x47201b['model'],_0x47201b[_0xd576('0x35')]);_0x226e8f[_0xd576('0x39')]=_[_0xd576('0x38')](_0x47201b[_0xd576('0x3a')],qs[_0xd576('0x3b')](_0x18f655[_0xd576('0x35')][_0xd576('0x3b')]));_0x226e8f[_0xd576('0x39')]=_0x226e8f[_0xd576('0x39')]['length']?_0x226e8f[_0xd576('0x39')]:_0x47201b[_0xd576('0x3a')];if(!_0x18f655[_0xd576('0x35')][_0xd576('0x3c')](_0xd576('0x3d'))){_0x226e8f[_0xd576('0x24')]=qs['limit'](_0x18f655[_0xd576('0x35')][_0xd576('0x24')]);_0x226e8f['offset']=qs[_0xd576('0x21')](_0x18f655[_0xd576('0x35')][_0xd576('0x21')]);}_0x226e8f['order']=qs['sort'](_0x18f655[_0xd576('0x35')]['sort']);_0x226e8f[_0xd576('0x3e')]=qs[_0xd576('0x37')](_[_0xd576('0x3f')](_0x18f655[_0xd576('0x35')],_0x47201b[_0xd576('0x37')]),_0x2b8069);if(_0x18f655[_0xd576('0x35')]['filter']){_0x226e8f[_0xd576('0x3e')]=_['merge'](_0x226e8f[_0xd576('0x3e')],{'$or':_[_0xd576('0x31')](_0x2b8069,function(_0x14f7ea){if(_0x14f7ea['type']!==_0xd576('0x40')){var _0x3136c6={};_0x3136c6[_0x14f7ea[_0xd576('0x2e')]]={'$like':'%'+_0x18f655['query'][_0xd576('0x41')]+'%'};return _0x3136c6;}})});}_0x226e8f=_[_0xd576('0x42')]({},_0x226e8f,_0x18f655[_0xd576('0x43')]);var _0x271c5f={'where':_0x226e8f[_0xd576('0x3e')]};return db[_0xd576('0x44')][_0xd576('0x23')](_0x271c5f)['then'](function(_0x31ce11){_0x596842['count']=_0x31ce11;if(_0x18f655[_0xd576('0x35')]['includeAll']){_0x226e8f[_0xd576('0x45')]=[{'all':!![]}];}return db[_0xd576('0x44')][_0xd576('0x46')](_0x226e8f);})['then'](function(_0x3dda31){_0x596842[_0xd576('0x47')]=_0x3dda31;return _0x596842;})[_0xd576('0x2b')](respondWithFilteredResult(_0x5070f4,_0x226e8f))[_0xd576('0x48')](handleError(_0x5070f4,null));};exports[_0xd576('0x49')]=function(_0x254bc6,_0x239f50){var _0x34ab69={'raw':!![],'where':{'id':_0x254bc6['params']['id']}},_0x25b931={};_0x25b931[_0xd576('0x3a')]=_['keys'](db[_0xd576('0x44')][_0xd576('0x32')]);_0x25b931['query']=_['keys'](_0x254bc6[_0xd576('0x35')]);_0x25b931[_0xd576('0x37')]=_[_0xd576('0x38')](_0x25b931[_0xd576('0x3a')],_0x25b931[_0xd576('0x35')]);_0x34ab69['attributes']=_[_0xd576('0x38')](_0x25b931[_0xd576('0x3a')],qs[_0xd576('0x3b')](_0x254bc6[_0xd576('0x35')][_0xd576('0x3b')]));_0x34ab69[_0xd576('0x39')]=_0x34ab69[_0xd576('0x39')][_0xd576('0x4a')]?_0x34ab69[_0xd576('0x39')]:_0x25b931[_0xd576('0x3a')];if(_0x254bc6['query'][_0xd576('0x4b')]){_0x34ab69[_0xd576('0x45')]=[{'all':!![]}];}_0x34ab69=_[_0xd576('0x42')]({},_0x34ab69,_0x254bc6[_0xd576('0x43')]);return db[_0xd576('0x44')][_0xd576('0x4c')](_0x34ab69)[_0xd576('0x2b')](handleEntityNotFound(_0x239f50,null))[_0xd576('0x2b')](respondWithResult(_0x239f50,null))[_0xd576('0x48')](handleError(_0x239f50,null));};exports[_0xd576('0x4d')]=function(_0x414d0a,_0x437ac8){return db[_0xd576('0x44')][_0xd576('0x4d')](_0x414d0a[_0xd576('0x4e')],{})[_0xd576('0x2b')](respondWithResult(_0x437ac8,0xc9))[_0xd576('0x48')](handleError(_0x437ac8,null));};exports[_0xd576('0x4f')]=function(_0x2bde23,_0x5c049b){if(_0x2bde23[_0xd576('0x4e')]['id']){delete _0x2bde23['body']['id'];}return db[_0xd576('0x44')][_0xd576('0x4c')]({'where':{'id':_0x2bde23['params']['id']}})[_0xd576('0x2b')](handleEntityNotFound(_0x5c049b,null))['then'](saveUpdates(_0x2bde23['body'],null))[_0xd576('0x2b')](respondWithResult(_0x5c049b,null))[_0xd576('0x48')](handleError(_0x5c049b,null));};exports[_0xd576('0x2a')]=function(_0x434ce0,_0x1b8001){return db['OpenchannelApplication'][_0xd576('0x4c')]({'where':{'id':_0x434ce0[_0xd576('0x50')]['id']}})[_0xd576('0x2b')](handleEntityNotFound(_0x1b8001,null))[_0xd576('0x2b')](removeEntity(_0x1b8001,null))['catch'](handleError(_0x1b8001,null));}; \ No newline at end of file +var _0xdf99=['fieldName','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelApplication','findAll','rows','catch','show','params','rawAttributes','filters','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x1f64d9,_0x178b0d){var _0x5e868c=function(_0x2ced53){while(--_0x2ced53){_0x1f64d9['push'](_0x1f64d9['shift']());}};_0x5e868c(++_0x178b0d);}(_0xdf99,0x150));var _0x9df9=function(_0x2393c0,_0x5d5d61){_0x2393c0=_0x2393c0-0x0;var _0x188aa9=_0xdf99[_0x2393c0];return _0x188aa9;};'use strict';var emlformat=require(_0x9df9('0x0'));var rimraf=require(_0x9df9('0x1'));var zipdir=require(_0x9df9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9df9('0x3'));var moment=require('moment');var BPromise=require(_0x9df9('0x4'));var Mustache=require(_0x9df9('0x5'));var util=require(_0x9df9('0x6'));var path=require('path');var sox=require(_0x9df9('0x7'));var csv=require(_0x9df9('0x8'));var ejs=require(_0x9df9('0x9'));var fs=require('fs');var fs_extra=require(_0x9df9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9df9('0xb'));var jsforce=require(_0x9df9('0xc'));var deskjs=require(_0x9df9('0xd'));var toCsv=require(_0x9df9('0x8'));var querystring=require(_0x9df9('0xe'));var Papa=require(_0x9df9('0xf'));var Redis=require('ioredis');var authService=require(_0x9df9('0x10'));var qs=require(_0x9df9('0x11'));var as=require(_0x9df9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9df9('0x13'));var utils=require(_0x9df9('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9df9('0x15'))['db'];function respondWithStatusCode(_0x2c31d6,_0x3d10c4){_0x3d10c4=_0x3d10c4||0xcc;return function(_0x44f527){if(_0x44f527){return _0x2c31d6[_0x9df9('0x16')](_0x3d10c4);}return _0x2c31d6[_0x9df9('0x17')](_0x3d10c4)[_0x9df9('0x18')]();};}function respondWithResult(_0x5886de,_0x1f7b23){_0x1f7b23=_0x1f7b23||0xc8;return function(_0x4a52a9){if(_0x4a52a9){return _0x5886de[_0x9df9('0x17')](_0x1f7b23)['json'](_0x4a52a9);}};}function respondWithFilteredResult(_0x53391e,_0x3054b7){return function(_0x22c308){if(_0x22c308){var _0x543978=typeof _0x3054b7[_0x9df9('0x19')]==='undefined'&&typeof _0x3054b7[_0x9df9('0x1a')]===_0x9df9('0x1b');var _0x2c8513=_0x22c308[_0x9df9('0x1c')];var _0x2dbfae=_0x543978?0x0:_0x3054b7[_0x9df9('0x19')];var _0x2bc001=_0x543978?_0x22c308[_0x9df9('0x1c')]:_0x3054b7['offset']+_0x3054b7[_0x9df9('0x1a')];var _0x57f9e7;if(_0x2bc001>=_0x2c8513){_0x2bc001=_0x2c8513;_0x57f9e7=0xc8;}else{_0x57f9e7=0xce;}_0x53391e[_0x9df9('0x17')](_0x57f9e7);return _0x53391e[_0x9df9('0x1d')](_0x9df9('0x1e'),_0x2dbfae+'-'+_0x2bc001+'/'+_0x2c8513)[_0x9df9('0x1f')](_0x22c308);}return null;};}function patchUpdates(_0x3bf7bc){return function(_0x12d388){try{jsonpatch[_0x9df9('0x20')](_0x12d388,_0x3bf7bc,!![]);}catch(_0x4cce7e){return BPromise[_0x9df9('0x21')](_0x4cce7e);}return _0x12d388[_0x9df9('0x22')]();};}function saveUpdates(_0x1ad73c,_0x5bef38){return function(_0xcf3f47){if(_0xcf3f47){return _0xcf3f47[_0x9df9('0x23')](_0x1ad73c)[_0x9df9('0x24')](function(_0x4364f8){return _0x4364f8;});}return null;};}function removeEntity(_0x45936e,_0x2cbdac){return function(_0x1ecee8){if(_0x1ecee8){return _0x1ecee8[_0x9df9('0x25')]()[_0x9df9('0x24')](function(){_0x45936e['status'](0xcc)[_0x9df9('0x18')]();});}};}function handleEntityNotFound(_0x470974,_0x402f25){return function(_0x3795ea){if(!_0x3795ea){_0x470974[_0x9df9('0x16')](0x194);}return _0x3795ea;};}function handleError(_0x4aac8d,_0x5b76a0){_0x5b76a0=_0x5b76a0||0x1f4;return function(_0x3b1c45){logger[_0x9df9('0x26')](_0x3b1c45[_0x9df9('0x27')]);if(_0x3b1c45[_0x9df9('0x28')]){delete _0x3b1c45[_0x9df9('0x28')];}_0x4aac8d[_0x9df9('0x17')](_0x5b76a0)[_0x9df9('0x29')](_0x3b1c45);};}exports[_0x9df9('0x2a')]=function(_0x59dcd3,_0x143c0b){var _0x5bb769={},_0x6f1c7f={},_0xda81cf={'count':0x0,'rows':[]};var _0x596e8c=_[_0x9df9('0x2b')](db['OpenchannelApplication']['rawAttributes'],function(_0x5f454f){return{'name':_0x5f454f[_0x9df9('0x2c')],'type':_0x5f454f['type']['key']};});_0x6f1c7f[_0x9df9('0x2d')]=_[_0x9df9('0x2b')](_0x596e8c,_0x9df9('0x28'));_0x6f1c7f[_0x9df9('0x2e')]=_[_0x9df9('0x2f')](_0x59dcd3[_0x9df9('0x2e')]);_0x6f1c7f['filters']=_['intersection'](_0x6f1c7f[_0x9df9('0x2d')],_0x6f1c7f['query']);_0x5bb769['attributes']=_[_0x9df9('0x30')](_0x6f1c7f[_0x9df9('0x2d')],qs[_0x9df9('0x31')](_0x59dcd3[_0x9df9('0x2e')]['fields']));_0x5bb769['attributes']=_0x5bb769['attributes'][_0x9df9('0x32')]?_0x5bb769[_0x9df9('0x33')]:_0x6f1c7f[_0x9df9('0x2d')];if(!_0x59dcd3[_0x9df9('0x2e')][_0x9df9('0x34')](_0x9df9('0x35'))){_0x5bb769['limit']=qs[_0x9df9('0x1a')](_0x59dcd3['query'][_0x9df9('0x1a')]);_0x5bb769['offset']=qs[_0x9df9('0x19')](_0x59dcd3[_0x9df9('0x2e')]['offset']);}_0x5bb769[_0x9df9('0x36')]=qs[_0x9df9('0x37')](_0x59dcd3[_0x9df9('0x2e')][_0x9df9('0x37')]);_0x5bb769[_0x9df9('0x38')]=qs['filters'](_[_0x9df9('0x39')](_0x59dcd3[_0x9df9('0x2e')],_0x6f1c7f['filters']),_0x596e8c);if(_0x59dcd3[_0x9df9('0x2e')][_0x9df9('0x3a')]){_0x5bb769[_0x9df9('0x38')]=_[_0x9df9('0x3b')](_0x5bb769['where'],{'$or':_[_0x9df9('0x2b')](_0x596e8c,function(_0x6c3a2f){if(_0x6c3a2f[_0x9df9('0x3c')]!==_0x9df9('0x3d')){var _0x303761={};_0x303761[_0x6c3a2f[_0x9df9('0x28')]]={'$like':'%'+_0x59dcd3['query'][_0x9df9('0x3a')]+'%'};return _0x303761;}})});}_0x5bb769=_[_0x9df9('0x3b')]({},_0x5bb769,_0x59dcd3[_0x9df9('0x3e')]);var _0x497664={'where':_0x5bb769[_0x9df9('0x38')]};return db[_0x9df9('0x3f')][_0x9df9('0x1c')](_0x497664)[_0x9df9('0x24')](function(_0x4fc9c4){_0xda81cf['count']=_0x4fc9c4;if(_0x59dcd3[_0x9df9('0x2e')]['includeAll']){_0x5bb769['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x9df9('0x40')](_0x5bb769);})[_0x9df9('0x24')](function(_0x532e98){_0xda81cf[_0x9df9('0x41')]=_0x532e98;return _0xda81cf;})[_0x9df9('0x24')](respondWithFilteredResult(_0x143c0b,_0x5bb769))[_0x9df9('0x42')](handleError(_0x143c0b,null));};exports[_0x9df9('0x43')]=function(_0x2d2115,_0x21cfe6){var _0x133f2e={'raw':!![],'where':{'id':_0x2d2115[_0x9df9('0x44')]['id']}},_0x2a7c8e={};_0x2a7c8e[_0x9df9('0x2d')]=_['keys'](db[_0x9df9('0x3f')][_0x9df9('0x45')]);_0x2a7c8e['query']=_[_0x9df9('0x2f')](_0x2d2115[_0x9df9('0x2e')]);_0x2a7c8e[_0x9df9('0x46')]=_['intersection'](_0x2a7c8e['model'],_0x2a7c8e['query']);_0x133f2e[_0x9df9('0x33')]=_['intersection'](_0x2a7c8e[_0x9df9('0x2d')],qs[_0x9df9('0x31')](_0x2d2115[_0x9df9('0x2e')]['fields']));_0x133f2e[_0x9df9('0x33')]=_0x133f2e[_0x9df9('0x33')][_0x9df9('0x32')]?_0x133f2e['attributes']:_0x2a7c8e['model'];if(_0x2d2115[_0x9df9('0x2e')][_0x9df9('0x47')]){_0x133f2e[_0x9df9('0x48')]=[{'all':!![]}];}_0x133f2e=_[_0x9df9('0x3b')]({},_0x133f2e,_0x2d2115[_0x9df9('0x3e')]);return db[_0x9df9('0x3f')][_0x9df9('0x49')](_0x133f2e)[_0x9df9('0x24')](handleEntityNotFound(_0x21cfe6,null))[_0x9df9('0x24')](respondWithResult(_0x21cfe6,null))[_0x9df9('0x42')](handleError(_0x21cfe6,null));};exports[_0x9df9('0x4a')]=function(_0x24c927,_0x32494){return db['OpenchannelApplication']['create'](_0x24c927['body'],{})['then'](respondWithResult(_0x32494,0xc9))['catch'](handleError(_0x32494,null));};exports[_0x9df9('0x23')]=function(_0x19b894,_0x3bc1f4){if(_0x19b894[_0x9df9('0x4b')]['id']){delete _0x19b894[_0x9df9('0x4b')]['id'];}return db[_0x9df9('0x3f')][_0x9df9('0x49')]({'where':{'id':_0x19b894['params']['id']}})[_0x9df9('0x24')](handleEntityNotFound(_0x3bc1f4,null))[_0x9df9('0x24')](saveUpdates(_0x19b894[_0x9df9('0x4b')],null))[_0x9df9('0x24')](respondWithResult(_0x3bc1f4,null))[_0x9df9('0x42')](handleError(_0x3bc1f4,null));};exports['destroy']=function(_0x13df22,_0x3bf630){return db['OpenchannelApplication'][_0x9df9('0x49')]({'where':{'id':_0x13df22['params']['id']}})['then'](handleEntityNotFound(_0x3bf630,null))[_0x9df9('0x24')](removeEntity(_0x3bf630,null))[_0x9df9('0x42')](handleError(_0x3bf630,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 7eb4239..19791fa 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 _0x8e53=['moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x503cdb,_0x49e7c3){var _0x26c512=function(_0x1cb990){while(--_0x1cb990){_0x503cdb['push'](_0x503cdb['shift']());}};_0x26c512(++_0x49e7c3);}(_0x8e53,0x1ca));var _0x38e5=function(_0x2f346f,_0x1f61d5){_0x2f346f=_0x2f346f-0x0;var _0x209307=_0x8e53[_0x2f346f];return _0x209307;};'use strict';var _=require(_0x38e5('0x0'));var util=require(_0x38e5('0x1'));var logger=require(_0x38e5('0x2'))(_0x38e5('0x3'));var moment=require(_0x38e5('0x4'));var BPromise=require(_0x38e5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38e5('0x6'));var rimraf=require(_0x38e5('0x7'));var config=require(_0x38e5('0x8'));var attributes=require(_0x38e5('0x9'));module[_0x38e5('0xa')]=function(_0x23d542,_0x182f94){return _0x23d542['define'](_0x38e5('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x38e5('0xc'),'collate':_0x38e5('0xd')});}; \ No newline at end of file +var _0xd85d=['../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xd85d,0x193));var _0xdd85=function(_0x5f1a03,_0x4e886e){_0x5f1a03=_0x5f1a03-0x0;var _0x2ecb87=_0xd85d[_0x5f1a03];return _0x2ecb87;};'use strict';var _=require('lodash');var util=require(_0xdd85('0x0'));var logger=require(_0xdd85('0x1'))(_0xdd85('0x2'));var moment=require('moment');var BPromise=require(_0xdd85('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd85('0x4'));var rimraf=require('rimraf');var config=require(_0xdd85('0x5'));var attributes=require(_0xdd85('0x6'));module[_0xdd85('0x7')]=function(_0x43dcde,_0x250355){return _0x43dcde['define'](_0xdd85('0x8'),attributes,{'tableName':_0xdd85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd85('0xa'),'collate':_0xdd85('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index e69e979..0e405d3 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 _0x3105=['update','body','options','raw','where','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x3105,0xd2));var _0x5310=function(_0x5342b4,_0x51d3a7){_0x5342b4=_0x5342b4-0x0;var _0x3c8182=_0x3105[_0x5342b4];return _0x3c8182;};'use strict';var _=require(_0x5310('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5310('0x1'));var fs=require('fs');var Redis=require(_0x5310('0x2'));var db=require(_0x5310('0x3'))['db'];var utils=require(_0x5310('0x4'));var logger=require('../../config/logger')(_0x5310('0x5'));var config=require('../../config/environment');var jayson=require(_0x5310('0x6'));var client=jayson['client'][_0x5310('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x417a7c,_0x45901a,_0x42d84d){return new BPromise(function(_0x4db027,_0x4d36bc){return client[_0x5310('0x8')](_0x417a7c,_0x42d84d)[_0x5310('0x9')](function(_0x3caf7c){logger[_0x5310('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x45901a,_0x5310('0xb'));logger[_0x5310('0xc')](_0x5310('0xd'),_0x45901a,'request\x20sent',JSON[_0x5310('0xe')](_0x3caf7c));if(_0x3caf7c[_0x5310('0xf')]){if(_0x3caf7c[_0x5310('0xf')]['code']===0x1f4){logger['error'](_0x5310('0x10'),_0x45901a,_0x3caf7c['error'][_0x5310('0x11')]);return _0x4d36bc(_0x3caf7c[_0x5310('0xf')][_0x5310('0x11')]);}logger['error'](_0x5310('0x10'),_0x45901a,_0x3caf7c[_0x5310('0xf')][_0x5310('0x11')]);return _0x4db027(_0x3caf7c[_0x5310('0xf')]['message']);}else{logger[_0x5310('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x45901a,_0x5310('0xb'));_0x4db027(_0x3caf7c[_0x5310('0x12')][_0x5310('0x11')]);}})[_0x5310('0x13')](function(_0x4b6e14){logger[_0x5310('0xf')](_0x5310('0x10'),_0x45901a,_0x4b6e14);_0x4d36bc(_0x4b6e14);});});}exports[_0x5310('0x14')]=function(_0x12c882){var _0x4a0cc2=this;return new Promise(function(_0x5d9e1b,_0x3ca451){return db[_0x5310('0x15')][_0x5310('0x16')](_0x12c882[_0x5310('0x17')],{'raw':_0x12c882[_0x5310('0x18')]?_0x12c882[_0x5310('0x18')][_0x5310('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12c882['options']?_0x12c882[_0x5310('0x18')][_0x5310('0x1a')]||null:null,'attributes':_0x12c882[_0x5310('0x18')]?_0x12c882[_0x5310('0x18')][_0x5310('0x1b')]||null:null,'limit':_0x12c882['options']?_0x12c882[_0x5310('0x18')][_0x5310('0x1c')]||null:null})[_0x5310('0x9')](function(_0x325c08){logger['info'](_0x5310('0x14'),_0x12c882);logger[_0x5310('0xc')]('UpdateOpenchannelApplication',_0x12c882,JSON[_0x5310('0xe')](_0x325c08));_0x5d9e1b(_0x325c08);})[_0x5310('0x13')](function(_0x3e4c83){logger[_0x5310('0xf')](_0x5310('0x14'),_0x3e4c83[_0x5310('0x11')],_0x12c882);_0x3ca451(_0x4a0cc2[_0x5310('0xf')](0x1f4,_0x3e4c83[_0x5310('0x11')]));});});}; \ No newline at end of file +var _0xd382=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x2eb9dc,_0xd46ecb){var _0x2332ac=function(_0x4784b2){while(--_0x4784b2){_0x2eb9dc['push'](_0x2eb9dc['shift']());}};_0x2332ac(++_0xd46ecb);}(_0xd382,0x84));var _0x2d38=function(_0x4af4a5,_0x4e18da){_0x4af4a5=_0x4af4a5-0x0;var _0xafb643=_0xd382[_0x4af4a5];return _0xafb643;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var moment=require(_0x2d38('0x2'));var BPromise=require(_0x2d38('0x3'));var rs=require(_0x2d38('0x4'));var fs=require('fs');var Redis=require(_0x2d38('0x5'));var db=require(_0x2d38('0x6'))['db'];var utils=require(_0x2d38('0x7'));var logger=require(_0x2d38('0x8'))(_0x2d38('0x9'));var config=require(_0x2d38('0xa'));var jayson=require(_0x2d38('0xb'));var client=jayson[_0x2d38('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x359fc0,_0x1edc71,_0x477e70){return new BPromise(function(_0x179b23,_0x3d5eb7){return client[_0x2d38('0xd')](_0x359fc0,_0x477e70)[_0x2d38('0xe')](function(_0x532916){logger[_0x2d38('0xf')](_0x2d38('0x10'),_0x1edc71,_0x2d38('0x11'));logger[_0x2d38('0x12')](_0x2d38('0x13'),_0x1edc71,_0x2d38('0x11'),JSON[_0x2d38('0x14')](_0x532916));if(_0x532916[_0x2d38('0x15')]){if(_0x532916[_0x2d38('0x15')][_0x2d38('0x16')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1edc71,_0x532916['error'][_0x2d38('0x17')]);return _0x3d5eb7(_0x532916[_0x2d38('0x15')][_0x2d38('0x17')]);}logger[_0x2d38('0x15')](_0x2d38('0x10'),_0x1edc71,_0x532916[_0x2d38('0x15')]['message']);return _0x179b23(_0x532916['error'][_0x2d38('0x17')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x1edc71,_0x2d38('0x11'));_0x179b23(_0x532916[_0x2d38('0x18')][_0x2d38('0x17')]);}})[_0x2d38('0x19')](function(_0x42893b){logger[_0x2d38('0x15')](_0x2d38('0x10'),_0x1edc71,_0x42893b);_0x3d5eb7(_0x42893b);});});}exports[_0x2d38('0x1a')]=function(_0x1e6176){var _0x4fe17e=this;return new Promise(function(_0x5c0b83,_0x523581){return db[_0x2d38('0x1b')]['update'](_0x1e6176[_0x2d38('0x1c')],{'raw':_0x1e6176[_0x2d38('0x1d')]?_0x1e6176[_0x2d38('0x1d')][_0x2d38('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e6176[_0x2d38('0x1d')]?_0x1e6176[_0x2d38('0x1d')][_0x2d38('0x1f')]||null:null,'attributes':_0x1e6176[_0x2d38('0x1d')]?_0x1e6176[_0x2d38('0x1d')][_0x2d38('0x20')]||null:null,'limit':_0x1e6176[_0x2d38('0x1d')]?_0x1e6176[_0x2d38('0x1d')][_0x2d38('0x21')]||null:null})['then'](function(_0x34ad9c){logger[_0x2d38('0xf')](_0x2d38('0x1a'),_0x1e6176);logger[_0x2d38('0x12')](_0x2d38('0x1a'),_0x1e6176,JSON[_0x2d38('0x14')](_0x34ad9c));_0x5c0b83(_0x34ad9c);})[_0x2d38('0x19')](function(_0x1e5548){logger['error'](_0x2d38('0x1a'),_0x1e5548[_0x2d38('0x17')],_0x1e6176);_0x523581(_0x4fe17e[_0x2d38('0x15')](0x1f4,_0x1e5548['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c8a1267..7a1d75b 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 _0x7196=['./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','/:id','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x335391,_0x1984f8){var _0x4fadee=function(_0x5930cd){while(--_0x5930cd){_0x335391['push'](_0x335391['shift']());}};_0x4fadee(++_0x1984f8);}(_0x7196,0x18d));var _0x6719=function(_0x38c1b1,_0x1382c2){_0x38c1b1=_0x38c1b1-0x0;var _0x34983c=_0x7196[_0x38c1b1];return _0x34983c;};'use strict';var multer=require(_0x6719('0x0'));var util=require(_0x6719('0x1'));var path=require(_0x6719('0x2'));var timeout=require(_0x6719('0x3'));var express=require(_0x6719('0x4'));var router=express[_0x6719('0x5')]();var fs_extra=require(_0x6719('0x6'));var auth=require(_0x6719('0x7'));var interaction=require(_0x6719('0x8'));var config=require('../../config/environment');var controller=require(_0x6719('0x9'));router[_0x6719('0xa')]('/',auth[_0x6719('0xb')](),controller[_0x6719('0xc')]);router['get']('/describe',auth[_0x6719('0xb')](),controller[_0x6719('0xd')]);router['get']('/:id',auth[_0x6719('0xb')](),controller['show']);router[_0x6719('0xa')](_0x6719('0xe'),auth[_0x6719('0xb')](),controller['getMessages']);router['get'](_0x6719('0xf'),auth[_0x6719('0xb')](),controller[_0x6719('0x10')]);router[_0x6719('0x11')]('/',auth[_0x6719('0xb')](),controller['create']);router[_0x6719('0x11')]('/:id/messages',auth[_0x6719('0xb')](),controller[_0x6719('0x12')]);router[_0x6719('0x11')](_0x6719('0x13'),auth[_0x6719('0xb')](),interaction[_0x6719('0x14')](_0x6719('0x15'),_0x6719('0x16')),controller['addTags']);router['put'](_0x6719('0x17'),auth[_0x6719('0xb')](),interaction[_0x6719('0x14')](_0x6719('0x15'),'openchannelinteraction:update'),controller[_0x6719('0x18')]);router[_0x6719('0x19')](_0x6719('0x17'),auth['isAuthenticated'](),interaction[_0x6719('0x14')](_0x6719('0x15'),_0x6719('0x1a')),controller['destroy']);router['delete'](_0x6719('0x13'),auth[_0x6719('0xb')](),controller[_0x6719('0x1b')]);module[_0x6719('0x1c')]=router; \ No newline at end of file +var _0xd0b2=['destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','openchannelinteraction:addtags','put','delete','openchannel','openchannelinteraction:destroy'];(function(_0x2a7bdc,_0x2bdd21){var _0x461816=function(_0x1d93ca){while(--_0x1d93ca){_0x2a7bdc['push'](_0x2a7bdc['shift']());}};_0x461816(++_0x2bdd21);}(_0xd0b2,0x17a));var _0x2d0b=function(_0x4769ea,_0x39386c){_0x4769ea=_0x4769ea-0x0;var _0x39ca7e=_0xd0b2[_0x4769ea];return _0x39ca7e;};'use strict';var multer=require('multer');var util=require(_0x2d0b('0x0'));var path=require(_0x2d0b('0x1'));var timeout=require(_0x2d0b('0x2'));var express=require(_0x2d0b('0x3'));var router=express[_0x2d0b('0x4')]();var fs_extra=require(_0x2d0b('0x5'));var auth=require(_0x2d0b('0x6'));var interaction=require(_0x2d0b('0x7'));var config=require(_0x2d0b('0x8'));var controller=require(_0x2d0b('0x9'));router[_0x2d0b('0xa')]('/',auth[_0x2d0b('0xb')](),controller[_0x2d0b('0xc')]);router[_0x2d0b('0xa')](_0x2d0b('0xd'),auth[_0x2d0b('0xb')](),controller[_0x2d0b('0xe')]);router['get'](_0x2d0b('0xf'),auth[_0x2d0b('0xb')](),controller[_0x2d0b('0x10')]);router['get'](_0x2d0b('0x11'),auth[_0x2d0b('0xb')](),controller[_0x2d0b('0x12')]);router[_0x2d0b('0xa')](_0x2d0b('0x13'),auth[_0x2d0b('0xb')](),controller[_0x2d0b('0x14')]);router[_0x2d0b('0x15')]('/',auth[_0x2d0b('0xb')](),controller[_0x2d0b('0x16')]);router[_0x2d0b('0x15')](_0x2d0b('0x11'),auth['isAuthenticated'](),controller[_0x2d0b('0x17')]);router[_0x2d0b('0x15')]('/:id/tags',auth[_0x2d0b('0xb')](),interaction[_0x2d0b('0x18')]('openchannel',_0x2d0b('0x19')),controller['addTags']);router[_0x2d0b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x2d0b('0x18')]('openchannel','openchannelinteraction:update'),controller['update']);router[_0x2d0b('0x1b')](_0x2d0b('0xf'),auth[_0x2d0b('0xb')](),interaction[_0x2d0b('0x18')](_0x2d0b('0x1c'),_0x2d0b('0x1d')),controller[_0x2d0b('0x1e')]);router[_0x2d0b('0x1b')](_0x2d0b('0x1f'),auth[_0x2d0b('0xb')](),controller[_0x2d0b('0x20')]);module[_0x2d0b('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4c8b86b..dd34048 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 _0x652b=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x652b,0x68));var _0xb652=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x652b[_0x450bf9];return _0x268350;};'use strict';var Sequelize=require(_0xb652('0x0'));module[_0xb652('0x1')]={'closed':{'type':Sequelize[_0xb652('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb652('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb652('0x3')]},'read1stAt':{'type':Sequelize[_0xb652('0x4')]},'threadId':{'type':Sequelize[_0xb652('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb652('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb652('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xb652('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8c38=['DATE','STRING','ENUM','out','BOOLEAN','sequelize','exports'];(function(_0x354f9b,_0x19817d){var _0x49dbe4=function(_0x553ceb){while(--_0x553ceb){_0x354f9b['push'](_0x354f9b['shift']());}};_0x49dbe4(++_0x19817d);}(_0x8c38,0x83));var _0x88c3=function(_0x108b1e,_0x32cccd){_0x108b1e=_0x108b1e-0x0;var _0x334a72=_0x8c38[_0x108b1e];return _0x334a72;};'use strict';var Sequelize=require(_0x88c3('0x0'));module[_0x88c3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x88c3('0x2')]},'disposition':{'type':Sequelize[_0x88c3('0x3')]},'secondDisposition':{'type':Sequelize[_0x88c3('0x3')]},'thirdDisposition':{'type':Sequelize[_0x88c3('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x88c3('0x2')]},'threadId':{'type':Sequelize[_0x88c3('0x3')]},'externalUrl':{'type':Sequelize[_0x88c3('0x3')]},'lastMsgAt':{'type':Sequelize[_0x88c3('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x88c3('0x4')]('in',_0x88c3('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x88c3('0x4')]('in',_0x88c3('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x88c3('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6099abb..d7b2a0a 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 _0xff60=['openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','push','User','fullname','CmContact','Contact','Attachment','Messages','direction','secret','read','Account','Owner','get','Openchannel','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','error','name','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','create','body','describe','OpenchannelMessage','find','addMessage','ids','omit','getMessages','sort','where','OpenchannelInteractionId','merge','map','filter','$gte','split','format','include','rows','spread','color','emit'];(function(_0x30b93e,_0x469575){var _0x37ad85=function(_0x55c568){while(--_0x55c568){_0x30b93e['push'](_0x30b93e['shift']());}};_0x37ad85(++_0x469575);}(_0xff60,0x132));var _0x0ff6=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xff60[_0x37bd26];return _0xe83dc4;};'use strict';var rimraf=require(_0x0ff6('0x0'));var zipdir=require(_0x0ff6('0x1'));var moment=require(_0x0ff6('0x2'));var util=require('util');var path=require(_0x0ff6('0x3'));var ejs=require(_0x0ff6('0x4'));var fs=require('fs');var _=require(_0x0ff6('0x5'));var Redis=require('ioredis');var interaction=require(_0x0ff6('0x6'));var qs=require(_0x0ff6('0x7'));var pdf=require(_0x0ff6('0x8'));var logger=require(_0x0ff6('0x9'))(_0x0ff6('0xa'));var config=require(_0x0ff6('0xb'));var db=require(_0x0ff6('0xc'))['db'];config[_0x0ff6('0xd')]=_[_0x0ff6('0xe')](config['redis'],{'host':_0x0ff6('0xf'),'port':0x18eb});var socket=require(_0x0ff6('0x10'))(new Redis(config[_0x0ff6('0xd')]));require(_0x0ff6('0x11'))[_0x0ff6('0x12')](socket);function respondWithStatusCode(_0x199355,_0x35dfcb){_0x35dfcb=_0x35dfcb||0xcc;return function(_0x5c81a7){if(_0x5c81a7){return _0x199355[_0x0ff6('0x13')](_0x35dfcb);}return _0x199355[_0x0ff6('0x14')](_0x35dfcb)[_0x0ff6('0x15')]();};}function respondWithResult(_0x5db213,_0x5ece19){_0x5ece19=_0x5ece19||0xc8;return function(_0x4955d2){if(_0x4955d2){return _0x5db213[_0x0ff6('0x14')](_0x5ece19)[_0x0ff6('0x16')](_0x4955d2);}};}function respondWithFilteredResult(_0x20d0fb,_0x2b8d58){return function(_0x348f9f){if(_0x348f9f){var _0x53fa32=typeof _0x2b8d58[_0x0ff6('0x17')]===_0x0ff6('0x18')&&typeof _0x2b8d58['limit']==='undefined';var _0x2565a2=_0x348f9f['count'];var _0x6674b6=_0x53fa32?0x0:_0x2b8d58['offset'];var _0x4caa87=_0x53fa32?_0x348f9f[_0x0ff6('0x19')]:_0x2b8d58['offset']+_0x2b8d58[_0x0ff6('0x1a')];var _0x58c92c;if(_0x4caa87>=_0x2565a2){_0x4caa87=_0x2565a2;_0x58c92c=0xc8;}else{_0x58c92c=0xce;}_0x20d0fb[_0x0ff6('0x14')](_0x58c92c);return _0x20d0fb[_0x0ff6('0x1b')](_0x0ff6('0x1c'),_0x6674b6+'-'+_0x4caa87+'/'+_0x2565a2)[_0x0ff6('0x16')](_0x348f9f);}return null;};}function saveUpdates(_0xb8e7fc){return function(_0x148841){if(_0x148841){return _0x148841[_0x0ff6('0x1d')](_0xb8e7fc)['then'](function(_0x554179){return _0x554179;});}return null;};}function removeEntity(_0x204fbb){return function(_0x4f023a){if(_0x4f023a){return _0x4f023a[_0x0ff6('0x1e')]()[_0x0ff6('0x1f')](function(){_0x204fbb[_0x0ff6('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0190){return function(_0x5c9fa7){if(!_0x5c9fa7){_0x5a0190[_0x0ff6('0x13')](0x194);}return _0x5c9fa7;};}function handleError(_0x26ad31,_0x1bb5e8){_0x1bb5e8=_0x1bb5e8||0x1f4;return function(_0x192214){logger[_0x0ff6('0x20')](_0x192214['stack']);if(_0x192214[_0x0ff6('0x21')]){delete _0x192214[_0x0ff6('0x21')];}_0x26ad31['status'](_0x1bb5e8)['send'](_0x192214);};}exports[_0x0ff6('0x22')]=function(_0xda6dbc,_0x366df6){var _0x8f0f40={};var _0x1b9679=_['map'](db[_0x0ff6('0x23')][_0x0ff6('0x24')],function(_0x44e639){return{'name':_0x44e639[_0x0ff6('0x25')],'type':_0x44e639[_0x0ff6('0x26')][_0x0ff6('0x27')]};});_0x8f0f40=qs[_0x0ff6('0x28')](_0x1b9679,_0xda6dbc);return interaction[_0x0ff6('0x29')](_0x0ff6('0x2a'),_0xda6dbc[_0x0ff6('0x2b')],_0xda6dbc[_0x0ff6('0x2c')],_0x8f0f40,_0x1b9679)[_0x0ff6('0x1f')](respondWithFilteredResult(_0x366df6,_0x8f0f40))[_0x0ff6('0x2d')](handleError(_0x366df6,null));};exports[_0x0ff6('0x2e')]=function(_0x1bca7a,_0x465a68){var _0x186398={};if(_0x1bca7a['query'][_0x0ff6('0x26')]&&_0x1bca7a[_0x0ff6('0x2b')][_0x0ff6('0x26')]===_0x0ff6('0x2f')){_0x186398[_0x0ff6('0x2f')]=_0x1bca7a[_0x0ff6('0x30')]['id'];}else{_0x186398['id']=_0x1bca7a['params']['id'];}var _0x1bfbd6={'raw':![],'where':_0x186398},_0x1d918f={};_0x1d918f[_0x0ff6('0x31')]=_[_0x0ff6('0x32')](db[_0x0ff6('0x23')][_0x0ff6('0x24')]);_0x1d918f['query']=_[_0x0ff6('0x32')](_0x1bca7a[_0x0ff6('0x2b')]);_0x1d918f[_0x0ff6('0x33')]=_[_0x0ff6('0x34')](_0x1d918f[_0x0ff6('0x31')],_0x1d918f[_0x0ff6('0x2b')]);_0x1bfbd6[_0x0ff6('0x35')]=_['intersection'](_0x1d918f['model'],qs[_0x0ff6('0x36')](_0x1bca7a[_0x0ff6('0x2b')][_0x0ff6('0x36')]));_0x1bfbd6['attributes']=_0x1bfbd6['attributes'][_0x0ff6('0x37')]?_0x1bfbd6['attributes']:_0x1d918f[_0x0ff6('0x31')];if(_0x1bca7a['query'][_0x0ff6('0x38')]){_0x1bfbd6['include']=[{'all':!![]}];}_0x1bfbd6=_['merge']({},_0x1bfbd6,_0x1bca7a[_0x0ff6('0x39')]);return db['OpenchannelInteraction']['find'](_0x1bfbd6)[_0x0ff6('0x1f')](handleEntityNotFound(_0x465a68,null))['then'](respondWithResult(_0x465a68,null))[_0x0ff6('0x2d')](handleError(_0x465a68,null));};exports[_0x0ff6('0x3a')]=function(_0x526a35,_0x214ab6){return db['OpenchannelInteraction']['create'](_0x526a35[_0x0ff6('0x3b')],{})[_0x0ff6('0x1f')](respondWithResult(_0x214ab6,0xc9))['catch'](handleError(_0x214ab6,null));};exports[_0x0ff6('0x1d')]=function(_0x5592ef,_0xfdd618){if(_0x5592ef[_0x0ff6('0x3b')]['id']){delete _0x5592ef[_0x0ff6('0x3b')]['id'];}return db[_0x0ff6('0x23')]['find']({'where':{'id':_0x5592ef[_0x0ff6('0x30')]['id']}})[_0x0ff6('0x1f')](handleEntityNotFound(_0xfdd618,null))[_0x0ff6('0x1f')](saveUpdates(_0x5592ef[_0x0ff6('0x3b')],null))[_0x0ff6('0x1f')](respondWithResult(_0xfdd618,null))['catch'](handleError(_0xfdd618,null));};exports['destroy']=function(_0x56c984,_0x27984d){return db[_0x0ff6('0x23')]['find']({'where':{'id':_0x56c984[_0x0ff6('0x30')]['id']}})[_0x0ff6('0x1f')](handleEntityNotFound(_0x27984d,null))['then'](removeEntity(_0x27984d,null))[_0x0ff6('0x2d')](handleError(_0x27984d,null));};exports['describe']=function(_0xe30370,_0x5629db){return db['OpenchannelInteraction'][_0x0ff6('0x3c')]()[_0x0ff6('0x1f')](respondWithResult(_0x5629db,null))[_0x0ff6('0x2d')](handleError(_0x5629db,null));};exports['addMessage']=function(_0x2d5460,_0x1d72db){return db[_0x0ff6('0x3d')][_0x0ff6('0x3e')]({'where':{'id':_0x2d5460[_0x0ff6('0x30')]['id']}})[_0x0ff6('0x1f')](handleEntityNotFound(_0x1d72db,null))[_0x0ff6('0x1f')](function(_0x35c282){if(_0x35c282){return _0x35c282[_0x0ff6('0x3f')](_0x2d5460[_0x0ff6('0x3b')][_0x0ff6('0x40')],_[_0x0ff6('0x41')](_0x2d5460[_0x0ff6('0x3b')],[_0x0ff6('0x40'),'id'])||{});}})[_0x0ff6('0x1f')](respondWithResult(_0x1d72db,null))[_0x0ff6('0x2d')](handleError(_0x1d72db,null));};exports[_0x0ff6('0x42')]=function(_0x31aba6,_0x284545){var _0x58dcba={'raw':![],'where':{}};var _0x42a4f6={};var _0x455e6b={'count':0x0,'rows':[]};return db[_0x0ff6('0x23')]['findOne']({'where':{'id':_0x31aba6[_0x0ff6('0x30')]['id']}})['then'](handleEntityNotFound(_0x284545,null))[_0x0ff6('0x1f')](function(_0x3c0581){if(_0x3c0581){_0x42a4f6['model']=_[_0x0ff6('0x32')](db[_0x0ff6('0x3d')]['rawAttributes']);_0x42a4f6[_0x0ff6('0x2b')]=_[_0x0ff6('0x32')](_0x31aba6[_0x0ff6('0x2b')]);_0x42a4f6[_0x0ff6('0x33')]=_[_0x0ff6('0x34')](_0x42a4f6['model'],_0x42a4f6['query']);_0x58dcba['attributes']=_[_0x0ff6('0x34')](_0x42a4f6['model'],qs[_0x0ff6('0x36')](_0x31aba6[_0x0ff6('0x2b')]['fields']));_0x58dcba[_0x0ff6('0x35')]=_0x58dcba['attributes'][_0x0ff6('0x37')]?_0x58dcba[_0x0ff6('0x35')]:_0x42a4f6[_0x0ff6('0x31')];if(!_0x31aba6['query']['hasOwnProperty']('nolimit')){_0x58dcba[_0x0ff6('0x1a')]=qs['limit'](_0x31aba6['query']['limit']);_0x58dcba[_0x0ff6('0x17')]=qs[_0x0ff6('0x17')](_0x31aba6[_0x0ff6('0x2b')][_0x0ff6('0x17')]);}_0x58dcba['order']=qs[_0x0ff6('0x43')](_0x31aba6[_0x0ff6('0x2b')]['sort']);_0x58dcba[_0x0ff6('0x44')]=qs['filters'](_['pick'](_0x31aba6['query'],_0x42a4f6[_0x0ff6('0x33')]));_0x58dcba['where'][_0x0ff6('0x45')]=_0x3c0581['id'];if(_0x31aba6[_0x0ff6('0x2b')]['filter']){_0x58dcba[_0x0ff6('0x44')]=_[_0x0ff6('0x46')](_0x58dcba['where'],{'$or':_[_0x0ff6('0x47')](_0x58dcba[_0x0ff6('0x35')],function(_0x544dfe){var _0xe758c5={};_0xe758c5[_0x544dfe]={'$like':'%'+_0x31aba6['query'][_0x0ff6('0x48')]+'%'};return _0xe758c5;})});}if(_0x31aba6[_0x0ff6('0x2b')]['$gte']){var _0x590a8b=_0x31aba6[_0x0ff6('0x2b')][_0x0ff6('0x49')][_0x0ff6('0x4a')](',');var _0x14dfef={};_0x14dfef[_0x590a8b[0x0]]={'$gte':moment(_0x590a8b[0x1])[_0x0ff6('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x58dcba[_0x0ff6('0x44')]=_[_0x0ff6('0x46')](_0x58dcba[_0x0ff6('0x44')],_0x14dfef);}_0x58dcba=_['merge']({},_0x58dcba,_0x31aba6[_0x0ff6('0x39')]);return db[_0x0ff6('0x3d')][_0x0ff6('0x19')]({'where':_0x58dcba[_0x0ff6('0x44')]})[_0x0ff6('0x1f')](function(_0x568873){_0x455e6b['count']=_0x568873;if(_0x31aba6[_0x0ff6('0x2b')][_0x0ff6('0x38')]){_0x58dcba[_0x0ff6('0x4c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0ff6('0x29')](_0x58dcba);})['then'](function(_0x1ecb09){_0x455e6b[_0x0ff6('0x4d')]=_0x1ecb09;return _0x455e6b;});}})[_0x0ff6('0x1f')](respondWithFilteredResult(_0x284545,_0x58dcba))['catch'](handleError(_0x284545,null));};exports['addTags']=function(_0x1998ab,_0x2cb2e8){return db[_0x0ff6('0x23')][_0x0ff6('0x3e')]({'where':{'id':_0x1998ab[_0x0ff6('0x30')]['id']}})[_0x0ff6('0x1f')](handleEntityNotFound(_0x2cb2e8,null))[_0x0ff6('0x1f')](function(_0x28cb02){if(_0x28cb02){return _0x28cb02['setTags'](_0x1998ab[_0x0ff6('0x3b')]['ids'],_[_0x0ff6('0x41')](_0x1998ab['body'],[_0x0ff6('0x40'),'id'])||{})[_0x0ff6('0x4e')](function(){return db['Tag'][_0x0ff6('0x29')]({'attributes':['id',_0x0ff6('0x21'),_0x0ff6('0x4f')],'where':{'id':_0x1998ab[_0x0ff6('0x3b')]['ids']}});})[_0x0ff6('0x1f')](function(_0x2dd6d3){socket[_0x0ff6('0x50')](_0x0ff6('0x51'),{'id':Number(_0x1998ab[_0x0ff6('0x30')]['id']),'tags':_0x2dd6d3||[]});return{'id':Number(_0x1998ab[_0x0ff6('0x30')]['id']),'tags':_0x2dd6d3||[]};});}})[_0x0ff6('0x1f')](respondWithResult(_0x2cb2e8,null))[_0x0ff6('0x2d')](handleError(_0x2cb2e8,null));};exports[_0x0ff6('0x52')]=function(_0x20cce4,_0x33e1e5){return db[_0x0ff6('0x23')][_0x0ff6('0x3e')]({'where':{'id':_0x20cce4['params']['id']}})[_0x0ff6('0x1f')](handleEntityNotFound(_0x33e1e5,null))[_0x0ff6('0x1f')](function(_0x1c1414){if(_0x1c1414){return _0x1c1414[_0x0ff6('0x52')](_0x20cce4[_0x0ff6('0x2b')][_0x0ff6('0x40')]);}})[_0x0ff6('0x1f')](respondWithStatusCode(_0x33e1e5,null))['catch'](handleError(_0x33e1e5,null));};exports[_0x0ff6('0x53')]=function(_0x2f7679,_0x18d253){var _0x37938d=moment()[_0x0ff6('0x54')]()[_0x0ff6('0x55')]();var _0x40e58f=path[_0x0ff6('0x56')](config[_0x0ff6('0x57')],_0x0ff6('0x58'),_0x0ff6('0x59'),'tmp');var _0x44f9ae=path[_0x0ff6('0x56')](config['root'],'server',_0x0ff6('0x59'),_0x0ff6('0x5a'));var _0x140779=path['join'](_0x40e58f,_0x37938d);var _0x102abf=util[_0x0ff6('0x4b')]('transcript-%d-%s.zip',_0x2f7679[_0x0ff6('0x30')]['id'],_0x37938d);var _0x14987b=path[_0x0ff6('0x56')](_0x40e58f,_0x102abf);var _0x4e130=[];_0x4e130[_0x0ff6('0x5b')]({'model':db['User'],'as':_0x0ff6('0x5c'),'attributes':['id',_0x0ff6('0x5d')],'raw':!![]});_0x4e130[_0x0ff6('0x5b')]({'model':db[_0x0ff6('0x5e')],'as':_0x0ff6('0x5f'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x2f7679[_0x0ff6('0x2b')][_0x0ff6('0x5a')]){_0x4e130[_0x0ff6('0x5b')]({'model':db['Attachment'],'as':_0x0ff6('0x60'),'raw':!![]});}var _0x553b35=[{'model':db['OpenchannelMessage'],'as':_0x0ff6('0x61'),'attributes':['id',_0x0ff6('0x3b'),'createdAt',_0x0ff6('0x62'),_0x0ff6('0x63'),_0x0ff6('0x64')],'include':_0x4e130}];_0x553b35[_0x0ff6('0x5b')]({'model':db['OpenchannelAccount'],'as':_0x0ff6('0x65'),'attributes':['id',_0x0ff6('0x21')]});_0x553b35[_0x0ff6('0x5b')]({'model':db[_0x0ff6('0x5c')],'as':_0x0ff6('0x66'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x0ff6('0x3e')]({'where':{'id':_0x2f7679['params']['id']},'include':_0x553b35})[_0x0ff6('0x1f')](handleEntityNotFound(_0x18d253,null))['then'](function(_0x392639){if(_0x392639){var _0x186b5f=_0x392639[_0x0ff6('0x67')]({'plain':!![]});fs['mkdirSync'](_0x140779);var _0x42e0fd={'channel':_0x0ff6('0x68'),'account':_0x186b5f[_0x0ff6('0x65')][_0x0ff6('0x21')],'agent':_0x186b5f[_0x0ff6('0x66')]?_0x186b5f['Owner']['fullname']:_0x0ff6('0x69'),'createdAt':moment(_0x186b5f[_0x0ff6('0x6a')])[_0x0ff6('0x4b')](_0x0ff6('0x6b'))[_0x0ff6('0x55')](),'closedAt':_0x186b5f[_0x0ff6('0x6c')]?moment(_0x186b5f['closedAt'])[_0x0ff6('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x186b5f[_0x0ff6('0x6d')],'visibility':_0x186b5f[_0x0ff6('0x6e')]?_0x0ff6('0x6f'):_0x0ff6('0x70'),'messages':_(_0x186b5f[_0x0ff6('0x61')])['filter']({'secret':![]})[_0x0ff6('0x47')](function(_0x50566f){if(_0x50566f[_0x0ff6('0x60')]){var _0x4d41da=path['join'](_0x44f9ae,_0x50566f[_0x0ff6('0x60')]['basename']);if(fs[_0x0ff6('0x71')](_0x4d41da)){fs[_0x0ff6('0x72')](_0x4d41da)[_0x0ff6('0x73')](fs[_0x0ff6('0x74')](path[_0x0ff6('0x56')](_0x140779,_0x50566f[_0x0ff6('0x60')][_0x0ff6('0x75')])));}}return{'date':moment(_0x50566f[_0x0ff6('0x6a')])['format'](_0x0ff6('0x6b'))[_0x0ff6('0x55')](),'sender':_0x50566f[_0x0ff6('0x62')]===_0x0ff6('0x76')?_0x50566f[_0x0ff6('0x5c')]?_0x50566f[_0x0ff6('0x5c')][_0x0ff6('0x5d')]:_0x0ff6('0x77'):_0x50566f[_0x0ff6('0x5f')]['firstName']+(_0x50566f[_0x0ff6('0x5f')]['lastName']?'\x20'+_0x50566f[_0x0ff6('0x5f')]['lastName']:''),'body':_0x50566f[_0x0ff6('0x60')]?_0x50566f['Attachment'][_0x0ff6('0x75')]:_0x50566f['body'],'direction':_0x50566f['direction']==='out'?'A':'C','secret':_0x50566f['secret'],'read':_0x50566f[_0x0ff6('0x64')],'attachment':_0x50566f[_0x0ff6('0x60')]};})[_0x0ff6('0x78')]()};return ejs[_0x0ff6('0x79')](path['join'](config['root'],_0x0ff6('0x58'),_0x0ff6('0x7a'),_0x0ff6('0x7b')),{'interaction':_0x42e0fd})[_0x0ff6('0x1f')](function(_0x1e1f64){var _0x4c68ea=path[_0x0ff6('0x56')](_0x140779,_0x0ff6('0x7c')+_0x186b5f['id']+'-'+_0x37938d+_0x0ff6('0x7d'));var _0x5e10f3={'path':_0x4c68ea,'channel':_0x0ff6('0x68'),'interactionId':_0x186b5f['id']};return pdf[_0x0ff6('0x7e')](_0x1e1f64,_0x5e10f3);})[_0x0ff6('0x1f')](function(){return new Promise(function(_0x49cec1,_0x266dbb){zipdir(_0x140779,{'saveTo':_0x14987b},function(_0x49a494,_0x1821f8){if(_0x49a494)return _0x266dbb(_0x49a494);return _0x49cec1(_0x1821f8);});})[_0x0ff6('0x1f')](function(){return new Promise(function(_0xf16425,_0x152dff){rimraf(_0x140779,function(_0x2c61ef){if(_0x2c61ef)_0x152dff(_0x2c61ef);return _0xf16425();});});})[_0x0ff6('0x1f')](function(){return _0x18d253[_0x0ff6('0x53')](_0x14987b,_0x102abf,function(_0x4c997d){if(_0x4c997d){logger['error'](_0x0ff6('0x7f'),_0x4c997d);}else{fs[_0x0ff6('0x80')](_0x14987b);}});});});}else{return _0x18d253[_0x0ff6('0x13')](0xc8);}})['catch'](handleError(_0x18d253,null));}; \ No newline at end of file +var _0xc54a=['send','map','fieldName','type','findAll','openchannel','user','then','catch','show','query','from','params','model','keys','rawAttributes','attributes','intersection','fields','length','include','merge','options','OpenchannelInteraction','create','body','find','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','filters','hasOwnProperty','limit','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','omit','spread','Tag','color','openchannelInteractionTags:save','removeTags','toString','join','root','server','tmp','files','push','User','CmContact','Contact','firstName','lastName','attachments','Attachment','secret','read','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','Openchannel','N.A.','createdAt','format','closed','closedAt','disposition','Public','Private','Messages','basename','existsSync','createReadStream','createWriteStream','out','System','direction','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','update','destroy','name'];(function(_0x34929a,_0x457ed4){var _0x10d8ad=function(_0x570930){while(--_0x570930){_0x34929a['push'](_0x34929a['shift']());}};_0x10d8ad(++_0x457ed4);}(_0xc54a,0x64));var _0xac54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc54a[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xac54('0x0'));var zipdir=require(_0xac54('0x1'));var moment=require(_0xac54('0x2'));var util=require(_0xac54('0x3'));var path=require('path');var ejs=require(_0xac54('0x4'));var fs=require('fs');var _=require(_0xac54('0x5'));var Redis=require(_0xac54('0x6'));var interaction=require(_0xac54('0x7'));var qs=require(_0xac54('0x8'));var pdf=require(_0xac54('0x9'));var logger=require(_0xac54('0xa'))(_0xac54('0xb'));var config=require(_0xac54('0xc'));var db=require('../../mysqldb')['db'];config[_0xac54('0xd')]=_[_0xac54('0xe')](config['redis'],{'host':_0xac54('0xf'),'port':0x18eb});var socket=require(_0xac54('0x10'))(new Redis(config[_0xac54('0xd')]));require(_0xac54('0x11'))[_0xac54('0x12')](socket);function respondWithStatusCode(_0x1f94f4,_0x4fe46f){_0x4fe46f=_0x4fe46f||0xcc;return function(_0x2da09b){if(_0x2da09b){return _0x1f94f4[_0xac54('0x13')](_0x4fe46f);}return _0x1f94f4['status'](_0x4fe46f)[_0xac54('0x14')]();};}function respondWithResult(_0x10d85d,_0x111bee){_0x111bee=_0x111bee||0xc8;return function(_0x16992e){if(_0x16992e){return _0x10d85d[_0xac54('0x15')](_0x111bee)[_0xac54('0x16')](_0x16992e);}};}function respondWithFilteredResult(_0x198dc4,_0x3e117a){return function(_0x4ee5dd){if(_0x4ee5dd){var _0x29d565=typeof _0x3e117a[_0xac54('0x17')]==='undefined'&&typeof _0x3e117a['limit']===_0xac54('0x18');var _0x5eeec0=_0x4ee5dd[_0xac54('0x19')];var _0x14e72b=_0x29d565?0x0:_0x3e117a[_0xac54('0x17')];var _0x297178=_0x29d565?_0x4ee5dd['count']:_0x3e117a['offset']+_0x3e117a['limit'];var _0x144688;if(_0x297178>=_0x5eeec0){_0x297178=_0x5eeec0;_0x144688=0xc8;}else{_0x144688=0xce;}_0x198dc4[_0xac54('0x15')](_0x144688);return _0x198dc4[_0xac54('0x1a')](_0xac54('0x1b'),_0x14e72b+'-'+_0x297178+'/'+_0x5eeec0)[_0xac54('0x16')](_0x4ee5dd);}return null;};}function saveUpdates(_0x470923){return function(_0x39580e){if(_0x39580e){return _0x39580e[_0xac54('0x1c')](_0x470923)['then'](function(_0x36e7b1){return _0x36e7b1;});}return null;};}function removeEntity(_0x5dccc4){return function(_0x5f05a4){if(_0x5f05a4){return _0x5f05a4[_0xac54('0x1d')]()['then'](function(){_0x5dccc4[_0xac54('0x15')](0xcc)[_0xac54('0x14')]();});}};}function handleEntityNotFound(_0x3cae72){return function(_0x22afd5){if(!_0x22afd5){_0x3cae72[_0xac54('0x13')](0x194);}return _0x22afd5;};}function handleError(_0x39ff9d,_0x553413){_0x553413=_0x553413||0x1f4;return function(_0x394567){logger['error'](_0x394567['stack']);if(_0x394567[_0xac54('0x1e')]){delete _0x394567['name'];}_0x39ff9d['status'](_0x553413)[_0xac54('0x1f')](_0x394567);};}exports['index']=function(_0x3e0bbf,_0x485536){var _0x5d3c2f={};var _0x5a2569=_[_0xac54('0x20')](db['OpenchannelInteraction']['rawAttributes'],function(_0x54f259){return{'name':_0x54f259[_0xac54('0x21')],'type':_0x54f259[_0xac54('0x22')]['key']};});_0x5d3c2f=qs['getOptions'](_0x5a2569,_0x3e0bbf);return interaction[_0xac54('0x23')](_0xac54('0x24'),_0x3e0bbf['query'],_0x3e0bbf[_0xac54('0x25')],_0x5d3c2f,_0x5a2569)[_0xac54('0x26')](respondWithFilteredResult(_0x485536,_0x5d3c2f))[_0xac54('0x27')](handleError(_0x485536,null));};exports[_0xac54('0x28')]=function(_0x1b245f,_0x46048e){var _0x3896d9={};if(_0x1b245f['query'][_0xac54('0x22')]&&_0x1b245f[_0xac54('0x29')][_0xac54('0x22')]===_0xac54('0x2a')){_0x3896d9[_0xac54('0x2a')]=_0x1b245f[_0xac54('0x2b')]['id'];}else{_0x3896d9['id']=_0x1b245f[_0xac54('0x2b')]['id'];}var _0x4e81b3={'raw':![],'where':_0x3896d9},_0x19367c={};_0x19367c[_0xac54('0x2c')]=_[_0xac54('0x2d')](db['OpenchannelInteraction'][_0xac54('0x2e')]);_0x19367c[_0xac54('0x29')]=_[_0xac54('0x2d')](_0x1b245f['query']);_0x19367c['filters']=_['intersection'](_0x19367c[_0xac54('0x2c')],_0x19367c[_0xac54('0x29')]);_0x4e81b3[_0xac54('0x2f')]=_[_0xac54('0x30')](_0x19367c[_0xac54('0x2c')],qs['fields'](_0x1b245f[_0xac54('0x29')][_0xac54('0x31')]));_0x4e81b3[_0xac54('0x2f')]=_0x4e81b3[_0xac54('0x2f')][_0xac54('0x32')]?_0x4e81b3[_0xac54('0x2f')]:_0x19367c[_0xac54('0x2c')];if(_0x1b245f[_0xac54('0x29')]['includeAll']){_0x4e81b3[_0xac54('0x33')]=[{'all':!![]}];}_0x4e81b3=_[_0xac54('0x34')]({},_0x4e81b3,_0x1b245f[_0xac54('0x35')]);return db[_0xac54('0x36')]['find'](_0x4e81b3)[_0xac54('0x26')](handleEntityNotFound(_0x46048e,null))[_0xac54('0x26')](respondWithResult(_0x46048e,null))[_0xac54('0x27')](handleError(_0x46048e,null));};exports[_0xac54('0x37')]=function(_0x5695b1,_0x355272){return db['OpenchannelInteraction'][_0xac54('0x37')](_0x5695b1[_0xac54('0x38')],{})[_0xac54('0x26')](respondWithResult(_0x355272,0xc9))[_0xac54('0x27')](handleError(_0x355272,null));};exports['update']=function(_0x4c0506,_0x158b5e){if(_0x4c0506['body']['id']){delete _0x4c0506['body']['id'];}return db[_0xac54('0x36')][_0xac54('0x39')]({'where':{'id':_0x4c0506[_0xac54('0x2b')]['id']}})[_0xac54('0x26')](handleEntityNotFound(_0x158b5e,null))[_0xac54('0x26')](saveUpdates(_0x4c0506[_0xac54('0x38')],null))[_0xac54('0x26')](respondWithResult(_0x158b5e,null))[_0xac54('0x27')](handleError(_0x158b5e,null));};exports[_0xac54('0x1d')]=function(_0x9828c9,_0x52b852){return db['OpenchannelInteraction'][_0xac54('0x39')]({'where':{'id':_0x9828c9[_0xac54('0x2b')]['id']}})[_0xac54('0x26')](handleEntityNotFound(_0x52b852,null))['then'](removeEntity(_0x52b852,null))[_0xac54('0x27')](handleError(_0x52b852,null));};exports[_0xac54('0x3a')]=function(_0x3a4b7b,_0x324591){return db[_0xac54('0x36')][_0xac54('0x3a')]()['then'](respondWithResult(_0x324591,null))[_0xac54('0x27')](handleError(_0x324591,null));};exports[_0xac54('0x3b')]=function(_0x1e300a,_0x2d6f27){return db['OpenchannelMessage'][_0xac54('0x39')]({'where':{'id':_0x1e300a['params']['id']}})['then'](handleEntityNotFound(_0x2d6f27,null))['then'](function(_0xb7c44b){if(_0xb7c44b){return _0xb7c44b['addMessage'](_0x1e300a[_0xac54('0x38')][_0xac54('0x3c')],_['omit'](_0x1e300a['body'],[_0xac54('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x2d6f27,null))[_0xac54('0x27')](handleError(_0x2d6f27,null));};exports[_0xac54('0x3d')]=function(_0x21d713,_0x39a210){var _0x39a620={'raw':![],'where':{}};var _0x4ea24f={};var _0x4ccd4b={'count':0x0,'rows':[]};return db[_0xac54('0x36')][_0xac54('0x3e')]({'where':{'id':_0x21d713[_0xac54('0x2b')]['id']}})[_0xac54('0x26')](handleEntityNotFound(_0x39a210,null))['then'](function(_0x3a7fe0){if(_0x3a7fe0){_0x4ea24f[_0xac54('0x2c')]=_[_0xac54('0x2d')](db[_0xac54('0x3f')][_0xac54('0x2e')]);_0x4ea24f[_0xac54('0x29')]=_['keys'](_0x21d713['query']);_0x4ea24f[_0xac54('0x40')]=_[_0xac54('0x30')](_0x4ea24f[_0xac54('0x2c')],_0x4ea24f['query']);_0x39a620[_0xac54('0x2f')]=_[_0xac54('0x30')](_0x4ea24f['model'],qs[_0xac54('0x31')](_0x21d713[_0xac54('0x29')][_0xac54('0x31')]));_0x39a620['attributes']=_0x39a620['attributes'][_0xac54('0x32')]?_0x39a620[_0xac54('0x2f')]:_0x4ea24f[_0xac54('0x2c')];if(!_0x21d713['query'][_0xac54('0x41')]('nolimit')){_0x39a620[_0xac54('0x42')]=qs[_0xac54('0x42')](_0x21d713[_0xac54('0x29')]['limit']);_0x39a620[_0xac54('0x17')]=qs['offset'](_0x21d713[_0xac54('0x29')][_0xac54('0x17')]);}_0x39a620['order']=qs['sort'](_0x21d713[_0xac54('0x29')]['sort']);_0x39a620[_0xac54('0x43')]=qs['filters'](_[_0xac54('0x44')](_0x21d713['query'],_0x4ea24f['filters']));_0x39a620[_0xac54('0x43')]['OpenchannelInteractionId']=_0x3a7fe0['id'];if(_0x21d713['query'][_0xac54('0x45')]){_0x39a620[_0xac54('0x43')]=_[_0xac54('0x34')](_0x39a620['where'],{'$or':_[_0xac54('0x20')](_0x39a620['attributes'],function(_0x3657d3){var _0x36323e={};_0x36323e[_0x3657d3]={'$like':'%'+_0x21d713['query'][_0xac54('0x45')]+'%'};return _0x36323e;})});}if(_0x21d713['query']['$gte']){var _0x28497e=_0x21d713['query'][_0xac54('0x46')][_0xac54('0x47')](',');var _0x362ce0={};_0x362ce0[_0x28497e[0x0]]={'$gte':moment(_0x28497e[0x1])['format'](_0xac54('0x48'))};_0x39a620[_0xac54('0x43')]=_[_0xac54('0x34')](_0x39a620[_0xac54('0x43')],_0x362ce0);}_0x39a620=_[_0xac54('0x34')]({},_0x39a620,_0x21d713[_0xac54('0x35')]);return db[_0xac54('0x3f')][_0xac54('0x19')]({'where':_0x39a620[_0xac54('0x43')]})['then'](function(_0x4a583f){_0x4ccd4b[_0xac54('0x19')]=_0x4a583f;if(_0x21d713[_0xac54('0x29')][_0xac54('0x49')]){_0x39a620[_0xac54('0x33')]=[{'all':!![]}];}return db[_0xac54('0x3f')][_0xac54('0x23')](_0x39a620);})[_0xac54('0x26')](function(_0x5b7767){_0x4ccd4b['rows']=_0x5b7767;return _0x4ccd4b;});}})[_0xac54('0x26')](respondWithFilteredResult(_0x39a210,_0x39a620))[_0xac54('0x27')](handleError(_0x39a210,null));};exports[_0xac54('0x4a')]=function(_0x31fe92,_0x512933){return db['OpenchannelInteraction'][_0xac54('0x39')]({'where':{'id':_0x31fe92['params']['id']}})[_0xac54('0x26')](handleEntityNotFound(_0x512933,null))[_0xac54('0x26')](function(_0x1a7013){if(_0x1a7013){return _0x1a7013['setTags'](_0x31fe92[_0xac54('0x38')][_0xac54('0x3c')],_[_0xac54('0x4b')](_0x31fe92[_0xac54('0x38')],[_0xac54('0x3c'),'id'])||{})[_0xac54('0x4c')](function(){return db[_0xac54('0x4d')][_0xac54('0x23')]({'attributes':['id',_0xac54('0x1e'),_0xac54('0x4e')],'where':{'id':_0x31fe92['body']['ids']}});})['then'](function(_0x4460de){socket['emit'](_0xac54('0x4f'),{'id':Number(_0x31fe92[_0xac54('0x2b')]['id']),'tags':_0x4460de||[]});return{'id':Number(_0x31fe92['params']['id']),'tags':_0x4460de||[]};});}})[_0xac54('0x26')](respondWithResult(_0x512933,null))[_0xac54('0x27')](handleError(_0x512933,null));};exports[_0xac54('0x50')]=function(_0x333cce,_0x18e407){return db[_0xac54('0x36')][_0xac54('0x39')]({'where':{'id':_0x333cce[_0xac54('0x2b')]['id']}})[_0xac54('0x26')](handleEntityNotFound(_0x18e407,null))[_0xac54('0x26')](function(_0x5506e2){if(_0x5506e2){return _0x5506e2[_0xac54('0x50')](_0x333cce[_0xac54('0x29')][_0xac54('0x3c')]);}})[_0xac54('0x26')](respondWithStatusCode(_0x18e407,null))[_0xac54('0x27')](handleError(_0x18e407,null));};exports['download']=function(_0x4bbacc,_0x449f35){var _0x11ef59=moment()['unix']()[_0xac54('0x51')]();var _0x19a345=path[_0xac54('0x52')](config[_0xac54('0x53')],_0xac54('0x54'),'files',_0xac54('0x55'));var _0x5ca967=path[_0xac54('0x52')](config[_0xac54('0x53')],_0xac54('0x54'),_0xac54('0x56'),'attachments');var _0x2ff27f=path[_0xac54('0x52')](_0x19a345,_0x11ef59);var _0x34ba06=util['format']('transcript-%d-%s.zip',_0x4bbacc['params']['id'],_0x11ef59);var _0x2b090c=path[_0xac54('0x52')](_0x19a345,_0x34ba06);var _0xac9741=[];_0xac9741[_0xac54('0x57')]({'model':db[_0xac54('0x58')],'as':_0xac54('0x58'),'attributes':['id','fullname'],'raw':!![]});_0xac9741[_0xac54('0x57')]({'model':db[_0xac54('0x59')],'as':_0xac54('0x5a'),'attributes':['id',_0xac54('0x5b'),_0xac54('0x5c')],'raw':!![]});if(_0x4bbacc['query'][_0xac54('0x5d')]){_0xac9741['push']({'model':db['Attachment'],'as':_0xac54('0x5e'),'raw':!![]});}var _0xf345d5=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0xac54('0x38'),'createdAt','direction',_0xac54('0x5f'),_0xac54('0x60')],'include':_0xac9741}];_0xf345d5[_0xac54('0x57')]({'model':db[_0xac54('0x61')],'as':_0xac54('0x62'),'attributes':['id',_0xac54('0x1e')]});_0xf345d5[_0xac54('0x57')]({'model':db[_0xac54('0x58')],'as':_0xac54('0x63'),'attributes':['id',_0xac54('0x64')]});return db['OpenchannelInteraction'][_0xac54('0x39')]({'where':{'id':_0x4bbacc[_0xac54('0x2b')]['id']},'include':_0xf345d5})['then'](handleEntityNotFound(_0x449f35,null))[_0xac54('0x26')](function(_0x3eb246){if(_0x3eb246){var _0x8bac73=_0x3eb246[_0xac54('0x65')]({'plain':!![]});fs[_0xac54('0x66')](_0x2ff27f);var _0x185a19={'channel':_0xac54('0x67'),'account':_0x8bac73['Account']['name'],'agent':_0x8bac73[_0xac54('0x63')]?_0x8bac73['Owner'][_0xac54('0x64')]:_0xac54('0x68'),'createdAt':moment(_0x8bac73[_0xac54('0x69')])[_0xac54('0x6a')](_0xac54('0x48'))[_0xac54('0x51')](),'closedAt':_0x8bac73[_0xac54('0x6b')]?moment(_0x8bac73[_0xac54('0x6c')])[_0xac54('0x6a')](_0xac54('0x48'))['toString']():'','disposition':_0x8bac73[_0xac54('0x6d')],'visibility':_0x8bac73['threadId']?_0xac54('0x6e'):_0xac54('0x6f'),'messages':_(_0x8bac73[_0xac54('0x70')])[_0xac54('0x45')]({'secret':![]})[_0xac54('0x20')](function(_0x1e47f7){if(_0x1e47f7[_0xac54('0x5e')]){var _0x5c8b35=path['join'](_0x5ca967,_0x1e47f7[_0xac54('0x5e')][_0xac54('0x71')]);if(fs[_0xac54('0x72')](_0x5c8b35)){fs[_0xac54('0x73')](_0x5c8b35)['pipe'](fs[_0xac54('0x74')](path[_0xac54('0x52')](_0x2ff27f,_0x1e47f7[_0xac54('0x5e')][_0xac54('0x71')])));}}return{'date':moment(_0x1e47f7[_0xac54('0x69')])[_0xac54('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xac54('0x51')](),'sender':_0x1e47f7['direction']===_0xac54('0x75')?_0x1e47f7[_0xac54('0x58')]?_0x1e47f7['User'][_0xac54('0x64')]:_0xac54('0x76'):_0x1e47f7['Contact'][_0xac54('0x5b')]+(_0x1e47f7['Contact'][_0xac54('0x5c')]?'\x20'+_0x1e47f7[_0xac54('0x5a')][_0xac54('0x5c')]:''),'body':_0x1e47f7[_0xac54('0x5e')]?_0x1e47f7['Attachment'][_0xac54('0x71')]:_0x1e47f7[_0xac54('0x38')],'direction':_0x1e47f7[_0xac54('0x77')]===_0xac54('0x75')?'A':'C','secret':_0x1e47f7[_0xac54('0x5f')],'read':_0x1e47f7[_0xac54('0x60')],'attachment':_0x1e47f7[_0xac54('0x5e')]};})[_0xac54('0x78')]()};return ejs[_0xac54('0x79')](path[_0xac54('0x52')](config[_0xac54('0x53')],_0xac54('0x54'),_0xac54('0x7a'),_0xac54('0x7b')),{'interaction':_0x185a19})['then'](function(_0x2bde04){var _0x1725d2=path[_0xac54('0x52')](_0x2ff27f,_0xac54('0x7c')+_0x8bac73['id']+'-'+_0x11ef59+_0xac54('0x7d'));var _0x13dfe0={'path':_0x1725d2,'channel':_0xac54('0x67'),'interactionId':_0x8bac73['id']};return pdf[_0xac54('0x7e')](_0x2bde04,_0x13dfe0);})[_0xac54('0x26')](function(){return new Promise(function(_0x4d3d33,_0x1da5bf){zipdir(_0x2ff27f,{'saveTo':_0x2b090c},function(_0x2c097d,_0xcc3015){if(_0x2c097d)return _0x1da5bf(_0x2c097d);return _0x4d3d33(_0xcc3015);});})[_0xac54('0x26')](function(){return new Promise(function(_0x10fb1c,_0x160eeb){rimraf(_0x2ff27f,function(_0x29d060){if(_0x29d060)_0x160eeb(_0x29d060);return _0x10fb1c();});});})[_0xac54('0x26')](function(){return _0x449f35[_0xac54('0x7f')](_0x2b090c,_0x34ba06,function(_0x25070a){if(_0x25070a){logger[_0xac54('0x80')](_0xac54('0x81'),_0x25070a);}else{fs[_0xac54('0x82')](_0x2b090c);}});});});}else{return _0x449f35[_0xac54('0x13')](0xc8);}})[_0xac54('0x27')](handleError(_0x449f35,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 48b9f72..fa0a62f 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 _0x670b=['events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x5d8631,_0x44944b){var _0x34c15e=function(_0x4448f8){while(--_0x4448f8){_0x5d8631['push'](_0x5d8631['shift']());}};_0x34c15e(++_0x44944b);}(_0x670b,0xbb));var _0xb670=function(_0x298917,_0x33e4ff){_0x298917=_0x298917-0x0;var _0x857d91=_0x670b[_0x298917];return _0x857d91;};'use strict';var EventEmitter=require(_0xb670('0x0'));var OpenchannelInteraction=require(_0xb670('0x1'))['db'][_0xb670('0x2')];var OpenchannelMessage=require(_0xb670('0x1'))['db'][_0xb670('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb670('0x4')](0x0);var events={'afterCreate':_0xb670('0x5'),'afterUpdate':'update','afterDestroy':_0xb670('0x6')};function emitEvent(_0x372f30){return function(_0x5d37d2,_0x22f814,_0x396af6){_0x5d37d2[_0xb670('0x7')]({'attributes':['id'],'raw':!![]})[_0xb670('0x8')](function(_0x10eda4){_0x5d37d2[_0xb670('0x9')](_0xb670('0xa'),_0x10eda4['map'](function(_0x2b649c){return{'id':_0x2b649c['id']};}));return OpenchannelMessage[_0xb670('0xb')]({'where':{'OpenchannelInteractionId':_0x5d37d2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x24fb0e){_0x5d37d2[_0xb670('0x9')](_0xb670('0xc'),_0x24fb0e[_0xb670('0xd')]);OpenchannelInteractionEvents[_0xb670('0xe')](_0x372f30+':'+_0x5d37d2['id'],_0x5d37d2);OpenchannelInteractionEvents[_0xb670('0xe')](_0x372f30,_0x5d37d2);_0x396af6(null);})['catch'](_0x396af6(null));};}for(var e in events){if(events[_0xb670('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xb670('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4384=['getUsers','setDataValue','Users','then','unreadMessages','length','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove'];(function(_0x4ec1a5,_0x580a0d){var _0x240044=function(_0x32b550){while(--_0x32b550){_0x4ec1a5['push'](_0x4ec1a5['shift']());}};_0x240044(++_0x580a0d);}(_0x4384,0x1d9));var _0x4438=function(_0x5f0ae8,_0x294815){_0x5f0ae8=_0x5f0ae8-0x0;var _0x3cbd29=_0x4384[_0x5f0ae8];return _0x3cbd29;};'use strict';var EventEmitter=require(_0x4438('0x0'));var OpenchannelInteraction=require(_0x4438('0x1'))['db'][_0x4438('0x2')];var OpenchannelMessage=require(_0x4438('0x1'))['db'][_0x4438('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4438('0x4')](0x0);var events={'afterCreate':_0x4438('0x5'),'afterUpdate':'update','afterDestroy':_0x4438('0x6')};function emitEvent(_0xae0a7f){return function(_0x4df9c3,_0x3660cf,_0x118705){_0x4df9c3[_0x4438('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1e735d){_0x4df9c3[_0x4438('0x8')](_0x4438('0x9'),_0x1e735d['map'](function(_0xc10c27){return{'id':_0xc10c27['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4df9c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4438('0xa')](function(_0x333ff3){_0x4df9c3['setDataValue'](_0x4438('0xb'),_0x333ff3[_0x4438('0xc')]);OpenchannelInteractionEvents['emit'](_0xae0a7f+':'+_0x4df9c3['id'],_0x4df9c3);OpenchannelInteractionEvents['emit'](_0xae0a7f,_0x4df9c3);_0x118705(null);})['catch'](_0x118705(null));};}for(var e in events){if(events[_0x4438('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x4438('0xe')](e,emitEvent(event));}}module[_0x4438('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 644bbcb..5f6b089 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 _0x890b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelInteraction','utf8mb4_unicode_ci','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x890b,0x168));var _0xb890=function(_0x297485,_0x222646){_0x297485=_0x297485-0x0;var _0x44c7d1=_0x890b[_0x297485];return _0x44c7d1;};'use strict';var _=require(_0xb890('0x0'));var util=require('util');var logger=require(_0xb890('0x1'))(_0xb890('0x2'));var moment=require(_0xb890('0x3'));var BPromise=require(_0xb890('0x4'));var rp=require(_0xb890('0x5'));var fs=require('fs');var path=require(_0xb890('0x6'));var rimraf=require(_0xb890('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xb890('0x8')]=function(_0x51d3a8,_0x28e19c){return _0x51d3a8[_0xb890('0x9')](_0xb890('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb890('0xb'),'hooks':{'beforeUpdate':function(_0x23a816,_0xab9e2b,_0x2a84ce){if(_0x23a816['changed'](_0xb890('0xc'))){_0x23a816['closedAt']=moment()[_0xb890('0xd')](_0xb890('0xe'));}_0x2a84ce(null,_0x23a816);}}});}; \ No newline at end of file +var _0x1cb9=['rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x56baac,_0x3de33a){var _0x5b1c1f=function(_0x504359){while(--_0x504359){_0x56baac['push'](_0x56baac['shift']());}};_0x5b1c1f(++_0x3de33a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x13095f,_0x26a744){_0x13095f=_0x13095f-0x0;var _0x31670f=_0x1cb9[_0x13095f];return _0x31670f;};'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':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x91cb('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x2fdfce,_0x4cf9ed,_0xa43e7a){if(_0x2fdfce[_0x91cb('0xc')](_0x91cb('0xd'))){_0x2fdfce[_0x91cb('0xe')]=moment()[_0x91cb('0xf')](_0x91cb('0x10'));}_0xa43e7a(null,_0x2fdfce);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index f5751f4..0765673 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 _0x5c97=['info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','limit','then','AddTagsToOpenchannelInteraction','find','body','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','localhost','./openchannelInteraction.socket','register'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x5c97,0x11b));var _0x75c9=function(_0x11731f,_0x2271b5){_0x11731f=_0x11731f-0x0;var _0x14587c=_0x5c97[_0x11731f];return _0x14587c;};'use strict';var _=require('lodash');var util=require(_0x75c9('0x0'));var moment=require(_0x75c9('0x1'));var BPromise=require(_0x75c9('0x2'));var rs=require(_0x75c9('0x3'));var fs=require('fs');var Redis=require(_0x75c9('0x4'));var db=require(_0x75c9('0x5'))['db'];var utils=require(_0x75c9('0x6'));var logger=require('../../config/logger')(_0x75c9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x75c9('0x8')]({'port':0x232a});config[_0x75c9('0x9')]=_['defaults'](config[_0x75c9('0x9')],{'host':_0x75c9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75c9('0x9')]));require(_0x75c9('0xb'))[_0x75c9('0xc')](socket);function respondWithRpcPromise(_0x1585b2,_0x429014,_0x425ebd){return new BPromise(function(_0x4f3a43,_0x3af249){return client['request'](_0x1585b2,_0x425ebd)['then'](function(_0x2be1f0){logger[_0x75c9('0xd')](_0x75c9('0xe'),_0x429014,_0x75c9('0xf'));logger[_0x75c9('0x10')](_0x75c9('0x11'),_0x429014,_0x75c9('0xf'),JSON[_0x75c9('0x12')](_0x2be1f0));if(_0x2be1f0[_0x75c9('0x13')]){if(_0x2be1f0[_0x75c9('0x13')][_0x75c9('0x14')]===0x1f4){logger['error'](_0x75c9('0xe'),_0x429014,_0x2be1f0[_0x75c9('0x13')][_0x75c9('0x15')]);return _0x3af249(_0x2be1f0['error'][_0x75c9('0x15')]);}logger['error'](_0x75c9('0xe'),_0x429014,_0x2be1f0[_0x75c9('0x13')]['message']);return _0x4f3a43(_0x2be1f0[_0x75c9('0x13')][_0x75c9('0x15')]);}else{logger[_0x75c9('0xd')]('OpenchannelInteraction,\x20%s,\x20%s',_0x429014,_0x75c9('0xf'));_0x4f3a43(_0x2be1f0['result']['message']);}})[_0x75c9('0x16')](function(_0x40b67a){logger['error'](_0x75c9('0xe'),_0x429014,_0x40b67a);_0x3af249(_0x40b67a);});});}exports[_0x75c9('0x17')]=function(_0x49749c){var _0x52fb85=this;return new Promise(function(_0x2c2d33,_0x3ecaa9){return db[_0x75c9('0x18')]['update'](_0x49749c['body'],{'raw':_0x49749c[_0x75c9('0x19')]?_0x49749c[_0x75c9('0x19')][_0x75c9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49749c[_0x75c9('0x19')]?_0x49749c[_0x75c9('0x19')][_0x75c9('0x1b')]||null:null,'attributes':_0x49749c[_0x75c9('0x19')]?_0x49749c['options']['attributes']||null:null,'limit':_0x49749c[_0x75c9('0x19')]?_0x49749c['options'][_0x75c9('0x1c')]||null:null})[_0x75c9('0x1d')](function(_0x483ecf){logger['info'](_0x75c9('0x17'),_0x49749c);logger['debug'](_0x75c9('0x17'),_0x49749c,JSON[_0x75c9('0x12')](_0x483ecf));_0x2c2d33(_0x483ecf);})[_0x75c9('0x16')](function(_0x4a2e5c){logger['error'](_0x75c9('0x17'),_0x4a2e5c[_0x75c9('0x15')],_0x49749c);_0x3ecaa9(_0x52fb85[_0x75c9('0x13')](0x1f4,_0x4a2e5c['message']));});});};exports[_0x75c9('0x1e')]=function(_0x516c58){return new Promise(function(_0x43208f,_0x1ecc8b){return db[_0x75c9('0x18')][_0x75c9('0x1f')]({'where':_0x516c58[_0x75c9('0x19')]?_0x516c58['options'][_0x75c9('0x1b')]||null:null})[_0x75c9('0x1d')](function(_0x54a9c2){if(_0x54a9c2){return _0x54a9c2['addTags'](_0x516c58[_0x75c9('0x20')]['ids'],_[_0x75c9('0x21')](_0x516c58[_0x75c9('0x20')],[_0x75c9('0x22'),'id'])||{});}})[_0x75c9('0x23')](function(_0x2c592b){logger[_0x75c9('0xd')](_0x75c9('0x24'),_0x516c58);logger['debug'](_0x75c9('0x24'),_0x516c58,JSON[_0x75c9('0x12')](_0x2c592b));_0x43208f(_0x2c592b);})[_0x75c9('0x16')](function(_0x5b8313){logger[_0x75c9('0x13')](_0x75c9('0x24'),_0x5b8313['message'],_0x516c58);_0x1ecc8b(_this[_0x75c9('0x13')](0x1f4,_0x5b8313[_0x75c9('0x15')]));});});}; \ No newline at end of file +var _0x5b63=['AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit'];(function(_0x58f61a,_0xc49331){var _0x37e947=function(_0x1c38c8){while(--_0x1c38c8){_0x58f61a['push'](_0x58f61a['shift']());}};_0x37e947(++_0xc49331);}(_0x5b63,0x135));var _0x35b6=function(_0x2f2a81,_0x1cdfbe){_0x2f2a81=_0x2f2a81-0x0;var _0xecefe8=_0x5b63[_0x2f2a81];return _0xecefe8;};'use strict';var _=require(_0x35b6('0x0'));var util=require(_0x35b6('0x1'));var moment=require(_0x35b6('0x2'));var BPromise=require(_0x35b6('0x3'));var rs=require(_0x35b6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x35b6('0x6'))(_0x35b6('0x7'));var config=require(_0x35b6('0x8'));var jayson=require(_0x35b6('0x9'));var client=jayson['client'][_0x35b6('0xa')]({'port':0x232a});config[_0x35b6('0xb')]=_[_0x35b6('0xc')](config[_0x35b6('0xb')],{'host':_0x35b6('0xd'),'port':0x18eb});var socket=require(_0x35b6('0xe'))(new Redis(config[_0x35b6('0xb')]));require(_0x35b6('0xf'))['register'](socket);function respondWithRpcPromise(_0x4ac87f,_0x4c955d,_0x105a66){return new BPromise(function(_0x23d665,_0x30c3df){return client['request'](_0x4ac87f,_0x105a66)[_0x35b6('0x10')](function(_0x35b767){logger[_0x35b6('0x11')](_0x35b6('0x12'),_0x4c955d,_0x35b6('0x13'));logger['debug'](_0x35b6('0x14'),_0x4c955d,_0x35b6('0x13'),JSON[_0x35b6('0x15')](_0x35b767));if(_0x35b767['error']){if(_0x35b767[_0x35b6('0x16')][_0x35b6('0x17')]===0x1f4){logger[_0x35b6('0x16')](_0x35b6('0x12'),_0x4c955d,_0x35b767['error']['message']);return _0x30c3df(_0x35b767['error']['message']);}logger[_0x35b6('0x16')](_0x35b6('0x12'),_0x4c955d,_0x35b767[_0x35b6('0x16')]['message']);return _0x23d665(_0x35b767[_0x35b6('0x16')]['message']);}else{logger[_0x35b6('0x11')](_0x35b6('0x12'),_0x4c955d,_0x35b6('0x13'));_0x23d665(_0x35b767[_0x35b6('0x18')][_0x35b6('0x19')]);}})[_0x35b6('0x1a')](function(_0x227b86){logger[_0x35b6('0x16')](_0x35b6('0x12'),_0x4c955d,_0x227b86);_0x30c3df(_0x227b86);});});}exports[_0x35b6('0x1b')]=function(_0x3f6911){var _0x14e3aa=this;return new Promise(function(_0xec5edc,_0x1dfee1){return db[_0x35b6('0x1c')][_0x35b6('0x1d')](_0x3f6911[_0x35b6('0x1e')],{'raw':_0x3f6911[_0x35b6('0x1f')]?_0x3f6911[_0x35b6('0x1f')][_0x35b6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f6911[_0x35b6('0x1f')]?_0x3f6911[_0x35b6('0x1f')][_0x35b6('0x21')]||null:null,'attributes':_0x3f6911[_0x35b6('0x1f')]?_0x3f6911['options']['attributes']||null:null,'limit':_0x3f6911[_0x35b6('0x1f')]?_0x3f6911[_0x35b6('0x1f')][_0x35b6('0x22')]||null:null})['then'](function(_0x97d774){logger[_0x35b6('0x11')](_0x35b6('0x1b'),_0x3f6911);logger['debug'](_0x35b6('0x1b'),_0x3f6911,JSON[_0x35b6('0x15')](_0x97d774));_0xec5edc(_0x97d774);})[_0x35b6('0x1a')](function(_0x45a13a){logger[_0x35b6('0x16')](_0x35b6('0x1b'),_0x45a13a[_0x35b6('0x19')],_0x3f6911);_0x1dfee1(_0x14e3aa[_0x35b6('0x16')](0x1f4,_0x45a13a['message']));});});};exports[_0x35b6('0x23')]=function(_0x2c4e33){return new Promise(function(_0x25d037,_0x38a574){return db[_0x35b6('0x1c')][_0x35b6('0x24')]({'where':_0x2c4e33[_0x35b6('0x1f')]?_0x2c4e33[_0x35b6('0x1f')]['where']||null:null})[_0x35b6('0x10')](function(_0x226a11){if(_0x226a11){return _0x226a11[_0x35b6('0x25')](_0x2c4e33['body'][_0x35b6('0x26')],_[_0x35b6('0x27')](_0x2c4e33[_0x35b6('0x1e')],['ids','id'])||{});}})[_0x35b6('0x28')](function(_0x59c1bd){logger[_0x35b6('0x11')](_0x35b6('0x29'),_0x2c4e33);logger[_0x35b6('0x2a')]('AddTags',_0x2c4e33,JSON[_0x35b6('0x15')](_0x59c1bd));_0x25d037(_0x59c1bd);})[_0x35b6('0x1a')](function(_0x5532a3){logger[_0x35b6('0x16')]('AddTags',_0x5532a3[_0x35b6('0x19')],_0x2c4e33);_0x38a574(_this[_0x35b6('0x16')](0x1f4,_0x5532a3[_0x35b6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index c172414..bfdfdd0 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 _0x34d4=['openchannelInteraction:','save','remove','update','removeListener'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x34d4,0x1d2));var _0x434d=function(_0x22618c,_0x11baec){_0x22618c=_0x22618c-0x0;var _0x13ad67=_0x34d4[_0x22618c];return _0x13ad67;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x434d('0x0'),_0x434d('0x1'),_0x434d('0x2')];function createListener(_0x4c3c4b,_0x44afae){return function(_0x4c6784){_0x44afae['emit'](_0x4c3c4b,_0x4c6784);};}function removeListener(_0x4f911f,_0x1d14d2){return function(){OpenchannelInteractionEvents[_0x434d('0x3')](_0x4f911f,_0x1d14d2);};}exports['register']=function(_0x105f13){for(var _0x2efe6c=0x0,_0x5534cc=events['length'];_0x2efe6c<_0x5534cc;_0x2efe6c++){var _0x10c4b3=events[_0x2efe6c];var _0x446fa0=createListener(_0x434d('0x4')+_0x10c4b3,_0x105f13);OpenchannelInteractionEvents['on'](_0x10c4b3,_0x446fa0);}}; \ No newline at end of file +var _0xa6f4=['save','remove','update','removeListener','register','openchannelInteraction:'];(function(_0x1f52ea,_0x1dd436){var _0x2d4b16=function(_0x3cee20){while(--_0x3cee20){_0x1f52ea['push'](_0x1f52ea['shift']());}};_0x2d4b16(++_0x1dd436);}(_0xa6f4,0xf6));var _0x4a6f=function(_0x22907f,_0x4d4987){_0x22907f=_0x22907f-0x0;var _0x43b8f4=_0xa6f4[_0x22907f];return _0x43b8f4;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x4a6f('0x0'),_0x4a6f('0x1'),_0x4a6f('0x2')];function createListener(_0x5c1ad9,_0x5de6ed){return function(_0xe7617b){_0x5de6ed['emit'](_0x5c1ad9,_0xe7617b);};}function removeListener(_0x241248,_0x560cb3){return function(){OpenchannelInteractionEvents[_0x4a6f('0x3')](_0x241248,_0x560cb3);};}exports[_0x4a6f('0x4')]=function(_0x210c59){for(var _0x43821b=0x0,_0x25a618=events['length'];_0x43821b<_0x25a618;_0x43821b++){var _0x59d73f=events[_0x43821b];var _0x35a8e6=createListener(_0x4a6f('0x5')+_0x59d73f,_0x210c59);OpenchannelInteractionEvents['on'](_0x59d73f,_0x35a8e6);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 1205355..d514efb 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x33ec0b,_0x13ab74){var _0x411c05=function(_0x3f29eb){while(--_0x3f29eb){_0x33ec0b['push'](_0x33ec0b['shift']());}};_0x411c05(++_0x13ab74);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x762d25,_0x2a0f34){var _0x15d568=function(_0x2ad0f9){while(--_0x2ad0f9){_0x762d25['push'](_0x762d25['shift']());}};_0x15d568(++_0x2a0f34);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('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 93f1b12..50abda9 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 _0x693f=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x460f8c,_0x308ee5){var _0x146540=function(_0x369304){while(--_0x369304){_0x460f8c['push'](_0x460f8c['shift']());}};_0x146540(++_0x308ee5);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf693('0x0'));module[_0xf693('0x1')]={'body':{'type':Sequelize[_0xf693('0x2')](_0xf693('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xf693('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf693('0x5')]('in',_0xf693('0x6')),'defaultValue':_0xf693('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf693('0x7')]},'providerName':{'type':Sequelize[_0xf693('0x8')]},'providerResponse':{'type':Sequelize[_0xf693('0x2')]}}; \ No newline at end of file +var _0x117c=['ENUM','out','DATE','STRING','TEXT','medium'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x117c,0x71));var _0xc117=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x117c[_0x3a7a9c];return _0x59156e;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xc117('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc117('0x1')]('in',_0xc117('0x2')),'defaultValue':_0xc117('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc117('0x3')]},'providerName':{'type':Sequelize[_0xc117('0x4')]},'providerResponse':{'type':Sequelize[_0xc117('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4e1969c..146071f 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 _0x51ba=['filters','model','attributes','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','intersection','fields','create','body','find','describe','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','interface','SIP/%s','channel','EventManager','acceptmessage','openchannel-interactions','openchannel','OpenchannelInteractionId','role','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','contact','internal','motionChannel','event','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51ba,0xc1));var _0xa51b=function(_0x10c864,_0x30f475){_0x10c864=_0x10c864-0x0;var _0x4eed47=_0x51ba[_0x10c864];return _0x4eed47;};'use strict';var emlformat=require(_0xa51b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa51b('0x1'));var jsonpatch=require(_0xa51b('0x2'));var rp=require('request-promise');var moment=require(_0xa51b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa51b('0x4'));var util=require('util');var path=require(_0xa51b('0x5'));var sox=require(_0xa51b('0x6'));var csv=require('to-csv');var ejs=require(_0xa51b('0x7'));var fs=require('fs');var fs_extra=require(_0xa51b('0x8'));var _=require('lodash');var squel=require(_0xa51b('0x9'));var crypto=require(_0xa51b('0xa'));var jsforce=require(_0xa51b('0xb'));var deskjs=require(_0xa51b('0xc'));var toCsv=require(_0xa51b('0xd'));var querystring=require(_0xa51b('0xe'));var Papa=require(_0xa51b('0xf'));var Redis=require('ioredis');var authService=require(_0xa51b('0x10'));var qs=require(_0xa51b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa51b('0x12'));var logger=require(_0xa51b('0x13'))('api');var utils=require(_0xa51b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa51b('0x15'));var db=require(_0xa51b('0x16'))['db'];config[_0xa51b('0x17')]=_[_0xa51b('0x18')](config[_0xa51b('0x17')],{'host':_0xa51b('0x19'),'port':0x18eb});var socket=require(_0xa51b('0x1a'))(new Redis(config['redis']));require(_0xa51b('0x1b'))[_0xa51b('0x1c')](socket);var jayson=require(_0xa51b('0x1d'));var client=jayson['client'][_0xa51b('0x1e')]({'port':0x232c});var client9002=jayson[_0xa51b('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20055d,_0x17c1ef,_0x1c8a7b,_0x56fa10){return new BPromise(function(_0x4c567c,_0x4de478){var _0x1f6d91=_0x56fa10||client;return _0x1f6d91['request'](_0x20055d,_0x1c8a7b)[_0xa51b('0x20')](function(_0x2d0e3e){logger['info'](_0xa51b('0x21'),_0x17c1ef,_0xa51b('0x22'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x17c1ef,_0xa51b('0x22'),JSON[_0xa51b('0x23')](_0x2d0e3e));if(_0x2d0e3e['error']){if(_0x2d0e3e[_0xa51b('0x24')][_0xa51b('0x25')]===0x1f4){logger[_0xa51b('0x24')](_0xa51b('0x21'),_0x17c1ef,_0x2d0e3e['error'][_0xa51b('0x26')]);return _0x4de478(_0x2d0e3e[_0xa51b('0x24')]['message']);}logger[_0xa51b('0x24')](_0xa51b('0x21'),_0x17c1ef,_0x2d0e3e[_0xa51b('0x24')][_0xa51b('0x26')]);return _0x4c567c(_0x2d0e3e['error'][_0xa51b('0x26')]);}else{logger[_0xa51b('0x27')](_0xa51b('0x21'),_0x17c1ef,'request\x20sent');_0x4c567c(_0x2d0e3e[_0xa51b('0x28')][_0xa51b('0x26')]);}})[_0xa51b('0x29')](function(_0x3472ab){logger[_0xa51b('0x24')](_0xa51b('0x21'),_0x17c1ef,_0x3472ab);_0x4de478(_0x3472ab);});});}function respondWithStatusCode(_0x11f97c,_0x5d272b){_0x5d272b=_0x5d272b||0xcc;return function(_0x1ff9b8){if(_0x1ff9b8){return _0x11f97c[_0xa51b('0x2a')](_0x5d272b);}return _0x11f97c['status'](_0x5d272b)[_0xa51b('0x2b')]();};}function respondWithResult(_0x22ba42,_0x14a565){_0x14a565=_0x14a565||0xc8;return function(_0x1a0d19){if(_0x1a0d19){return _0x22ba42[_0xa51b('0x2c')](_0x14a565)[_0xa51b('0x2d')](_0x1a0d19);}};}function respondWithFilteredResult(_0x5887b1,_0x53aac0){return function(_0x1d5acc){if(_0x1d5acc){var _0x25a166=typeof _0x53aac0['offset']===_0xa51b('0x2e')&&typeof _0x53aac0[_0xa51b('0x2f')]===_0xa51b('0x2e');var _0x959714=_0x1d5acc[_0xa51b('0x30')];var _0x45b287=_0x25a166?0x0:_0x53aac0[_0xa51b('0x31')];var _0x5b75c1=_0x25a166?_0x1d5acc[_0xa51b('0x30')]:_0x53aac0[_0xa51b('0x31')]+_0x53aac0['limit'];var _0x411b20;if(_0x5b75c1>=_0x959714){_0x5b75c1=_0x959714;_0x411b20=0xc8;}else{_0x411b20=0xce;}_0x5887b1[_0xa51b('0x2c')](_0x411b20);return _0x5887b1['set'](_0xa51b('0x32'),_0x45b287+'-'+_0x5b75c1+'/'+_0x959714)['json'](_0x1d5acc);}return null;};}function patchUpdates(_0x3f3169){return function(_0xe149d){try{jsonpatch[_0xa51b('0x33')](_0xe149d,_0x3f3169,!![]);}catch(_0x2392b1){return BPromise[_0xa51b('0x34')](_0x2392b1);}return _0xe149d[_0xa51b('0x35')]();};}function saveUpdates(_0x524e89,_0x5e2e25){return function(_0x4fc455){if(_0x4fc455){return _0x4fc455[_0xa51b('0x36')](_0x524e89)[_0xa51b('0x20')](function(_0x1619e1){return _0x1619e1;});}return null;};}function removeEntity(_0x173999,_0x457027){return function(_0x2777ae){if(_0x2777ae){return _0x2777ae[_0xa51b('0x37')]()[_0xa51b('0x20')](function(){_0x173999[_0xa51b('0x2c')](0xcc)[_0xa51b('0x2b')]();});}};}function handleEntityNotFound(_0x18151f,_0x58aa86){return function(_0x4d3d8b){if(!_0x4d3d8b){_0x18151f['sendStatus'](0x194);}return _0x4d3d8b;};}function handleError(_0x5d88ab,_0x1fbd89){_0x1fbd89=_0x1fbd89||0x1f4;return function(_0x4b61f3){logger[_0xa51b('0x24')](_0x4b61f3[_0xa51b('0x38')]);if(_0x4b61f3[_0xa51b('0x39')]){delete _0x4b61f3[_0xa51b('0x39')];}_0x5d88ab[_0xa51b('0x2c')](_0x1fbd89)[_0xa51b('0x3a')](_0x4b61f3);};}exports[_0xa51b('0x3b')]=function(_0x2f2fac,_0x30e518){var _0x5aa802={},_0x50bc5e={},_0x35f663={'count':0x0,'rows':[]};var _0x577db2=_['map'](db[_0xa51b('0x3c')][_0xa51b('0x3d')],function(_0x4f5cc3){return{'name':_0x4f5cc3[_0xa51b('0x3e')],'type':_0x4f5cc3[_0xa51b('0x3f')][_0xa51b('0x40')]};});_0x50bc5e['model']=_['map'](_0x577db2,_0xa51b('0x39'));_0x50bc5e[_0xa51b('0x41')]=_[_0xa51b('0x42')](_0x2f2fac[_0xa51b('0x41')]);_0x50bc5e[_0xa51b('0x43')]=_['intersection'](_0x50bc5e[_0xa51b('0x44')],_0x50bc5e['query']);_0x5aa802['attributes']=_['intersection'](_0x50bc5e[_0xa51b('0x44')],qs['fields'](_0x2f2fac[_0xa51b('0x41')]['fields']));_0x5aa802[_0xa51b('0x45')]=_0x5aa802[_0xa51b('0x45')][_0xa51b('0x46')]?_0x5aa802[_0xa51b('0x45')]:_0x50bc5e[_0xa51b('0x44')];if(!_0x2f2fac['query'][_0xa51b('0x47')]('nolimit')){_0x5aa802[_0xa51b('0x2f')]=qs[_0xa51b('0x2f')](_0x2f2fac[_0xa51b('0x41')][_0xa51b('0x2f')]);_0x5aa802[_0xa51b('0x31')]=qs[_0xa51b('0x31')](_0x2f2fac[_0xa51b('0x41')][_0xa51b('0x31')]);}_0x5aa802[_0xa51b('0x48')]=qs[_0xa51b('0x49')](_0x2f2fac['query'][_0xa51b('0x49')]);_0x5aa802[_0xa51b('0x4a')]=qs[_0xa51b('0x43')](_[_0xa51b('0x4b')](_0x2f2fac['query'],_0x50bc5e[_0xa51b('0x43')]),_0x577db2);if(_0x2f2fac[_0xa51b('0x41')]['filter']){_0x5aa802[_0xa51b('0x4a')]=_[_0xa51b('0x4c')](_0x5aa802['where'],{'$or':_[_0xa51b('0x4d')](_0x577db2,function(_0x1b7d58){if(_0x1b7d58[_0xa51b('0x3f')]!==_0xa51b('0x4e')){var _0x375a2d={};_0x375a2d[_0x1b7d58['name']]={'$like':'%'+_0x2f2fac['query'][_0xa51b('0x4f')]+'%'};return _0x375a2d;}})});}_0x5aa802=_[_0xa51b('0x4c')]({},_0x5aa802,_0x2f2fac[_0xa51b('0x50')]);var _0x563aca={'where':_0x5aa802[_0xa51b('0x4a')]};return db[_0xa51b('0x3c')]['count'](_0x563aca)['then'](function(_0x1e4e3e){_0x35f663[_0xa51b('0x30')]=_0x1e4e3e;if(_0x2f2fac[_0xa51b('0x41')][_0xa51b('0x51')]){_0x5aa802[_0xa51b('0x52')]=[{'all':!![]}];}return db[_0xa51b('0x3c')][_0xa51b('0x53')](_0x5aa802);})[_0xa51b('0x20')](function(_0x98107d){_0x35f663[_0xa51b('0x54')]=_0x98107d;return _0x35f663;})[_0xa51b('0x20')](respondWithFilteredResult(_0x30e518,_0x5aa802))['catch'](handleError(_0x30e518,null));};exports[_0xa51b('0x55')]=function(_0x44fb09,_0x565445){var _0x22ba13={'raw':!![],'where':{'id':_0x44fb09[_0xa51b('0x56')]['id']}},_0x312140={};_0x312140[_0xa51b('0x44')]=_['keys'](db[_0xa51b('0x3c')][_0xa51b('0x3d')]);_0x312140['query']=_[_0xa51b('0x42')](_0x44fb09[_0xa51b('0x41')]);_0x312140[_0xa51b('0x43')]=_[_0xa51b('0x57')](_0x312140[_0xa51b('0x44')],_0x312140['query']);_0x22ba13[_0xa51b('0x45')]=_[_0xa51b('0x57')](_0x312140['model'],qs[_0xa51b('0x58')](_0x44fb09[_0xa51b('0x41')]['fields']));_0x22ba13[_0xa51b('0x45')]=_0x22ba13[_0xa51b('0x45')][_0xa51b('0x46')]?_0x22ba13['attributes']:_0x312140[_0xa51b('0x44')];if(_0x44fb09[_0xa51b('0x41')][_0xa51b('0x51')]){_0x22ba13[_0xa51b('0x52')]=[{'all':!![]}];}_0x22ba13=_['merge']({},_0x22ba13,_0x44fb09[_0xa51b('0x50')]);return db['OpenchannelMessage']['find'](_0x22ba13)[_0xa51b('0x20')](handleEntityNotFound(_0x565445,null))[_0xa51b('0x20')](respondWithResult(_0x565445,null))['catch'](handleError(_0x565445,null));};exports[_0xa51b('0x59')]=function(_0x398881,_0x39484e){return db[_0xa51b('0x3c')][_0xa51b('0x59')](_0x398881[_0xa51b('0x5a')],{})[_0xa51b('0x20')](respondWithResult(_0x39484e,0xc9))[_0xa51b('0x29')](handleError(_0x39484e,null));};exports[_0xa51b('0x36')]=function(_0x25490b,_0x50c52e){if(_0x25490b[_0xa51b('0x5a')]['id']){delete _0x25490b['body']['id'];}return db[_0xa51b('0x3c')][_0xa51b('0x5b')]({'where':{'id':_0x25490b[_0xa51b('0x56')]['id']}})['then'](handleEntityNotFound(_0x50c52e,null))['then'](saveUpdates(_0x25490b['body'],null))[_0xa51b('0x20')](respondWithResult(_0x50c52e,null))[_0xa51b('0x29')](handleError(_0x50c52e,null));};exports[_0xa51b('0x37')]=function(_0xfe9133,_0x1325d7){return db[_0xa51b('0x3c')][_0xa51b('0x5b')]({'where':{'id':_0xfe9133[_0xa51b('0x56')]['id']}})[_0xa51b('0x20')](handleEntityNotFound(_0x1325d7,null))[_0xa51b('0x20')](removeEntity(_0x1325d7,null))[_0xa51b('0x29')](handleError(_0x1325d7,null));};exports[_0xa51b('0x5c')]=function(_0x385e30,_0xe749d4){return db[_0xa51b('0x3c')][_0xa51b('0x5c')]()['then'](respondWithResult(_0xe749d4,null))[_0xa51b('0x29')](handleError(_0xe749d4,null));};var interaction_log=require(_0xa51b('0x13'))('openchannel-interactions');exports[_0xa51b('0x5d')]=function(_0x42990f,_0x6572b,_0x4796d4){var _0x5ed8b2={'agent':{},'channel':'openchannel'};if(_0x42990f['body']['id']){delete _0x42990f['body']['id'];}_0x42990f[_0xa51b('0x5a')][_0xa51b('0x5e')]=!![];_0x42990f['body']['readAt']=moment()[_0xa51b('0x5f')](_0xa51b('0x60'));_0x42990f[_0xa51b('0x5a')][_0xa51b('0x61')]=_0x42990f[_0xa51b('0x5a')][_0xa51b('0x61')]||_0x42990f['user']['id'];_0x5ed8b2[_0xa51b('0x62')]['id']=_0x42990f['body'][_0xa51b('0x61')];return db[_0xa51b('0x3c')][_0xa51b('0x5b')]({'where':{'id':_0x42990f[_0xa51b('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x6572b,null))['then'](saveUpdates(_0x42990f[_0xa51b('0x5a')],null))['then'](function(_0x4beb7a){if(_0x4beb7a){_0x5ed8b2[_0xa51b('0x26')]=_0x4beb7a[_0xa51b('0x63')]({'plain':!![]});return db[_0xa51b('0x64')][_0xa51b('0x5b')]({'where':{'id':_0x4beb7a['OpenchannelInteractionId']}});}return null;})[_0xa51b('0x20')](handleEntityNotFound(_0x6572b,null))[_0xa51b('0x20')](function(_0x2d1e5b){if(_0x2d1e5b){return _0x2d1e5b[_0xa51b('0x36')]({'UserId':_0x42990f[_0xa51b('0x5a')][_0xa51b('0x61')],'read1stAt':_['isNil'](_0x2d1e5b[_0xa51b('0x65')])?moment()[_0xa51b('0x5f')](_0xa51b('0x60')):undefined});}return null;})[_0xa51b('0x20')](function(_0x257c60){if(_0x257c60){_0x5ed8b2[_0xa51b('0x66')]=_0x257c60[_0xa51b('0x63')]({'plain':!![]});interaction_log[_0xa51b('0x27')](_0xa51b('0x67'),_0x42990f[_0xa51b('0x68')]['id'],_0x42990f[_0xa51b('0x68')][_0xa51b('0x39')],_0x42990f['user']['role'],_0x5ed8b2['interaction']['id'],_0x42990f['body']?JSON[_0xa51b('0x23')](_0x42990f['body']):_0xa51b('0x69'));return respondWithRpcPromise(_0xa51b('0x6a'),'acceptMessage',_0x5ed8b2);}return null;})['then'](function(_0x4c95b7){var _0x47588f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c95b7[_0xa51b('0x26')][_0xa51b('0x6b')];return db[_0xa51b('0x6c')][_0xa51b('0x41')](_0x47588f,{'type':db[_0xa51b('0x6d')][_0xa51b('0x6e')]['SELECT'],'raw':!![]})[_0xa51b('0x20')](function(_0x1f06c0){return _0x1f06c0;});})['then'](function(_0x4f3bbc){if(_0x4f3bbc){_0x5ed8b2['message']['contact']=_0x4f3bbc[0x0];if(!_0x42990f['body'][_0xa51b('0x61')])return;return db[_0xa51b('0x6f')][_0xa51b('0x5b')]({'where':{'id':_0x42990f[_0xa51b('0x5a')][_0xa51b('0x61')],'role':_0xa51b('0x62')},'attributes':['id','name',_0xa51b('0x70'),_0xa51b('0x71'),'internal'],'raw':!![]});}return null;})[_0xa51b('0x20')](function(_0xa3e2de){if(!_0xa3e2de)return null;_0x5ed8b2[_0xa51b('0x26')][_0xa51b('0x62')]=_0xa3e2de;return _0x5ed8b2;})[_0xa51b('0x20')](function(_0x39f442){if(_0x39f442){if(_0x42990f[_0xa51b('0x5a')]['manual']){_0x5ed8b2['message'][_0xa51b('0x72')]=util[_0xa51b('0x5f')](_0xa51b('0x73'),_0x42990f[_0xa51b('0x68')][_0xa51b('0x39')]);_0x5ed8b2[_0xa51b('0x26')]['channel']=_0x5ed8b2['channel'];_0x5ed8b2['message']['motionChannel']=_0x5ed8b2[_0xa51b('0x74')];_0x5ed8b2['message']['event']=_0xa51b('0x5d');return respondWithRpcPromise(_0xa51b('0x75'),_0xa51b('0x75'),{'event':_0xa51b('0x76'),'message':_0x5ed8b2[_0xa51b('0x26')]},client9002)[_0xa51b('0x20')](function(){return _0x5ed8b2;});}return _0x5ed8b2;}return null;})['then'](respondWithResult(_0x6572b,null))['catch'](handleError(_0x6572b,null));};var interaction_log=require('../../config/logger')(_0xa51b('0x77'));exports[_0xa51b('0x34')]=function(_0x4b525b,_0x492588,_0x1ababd){var _0x5d6322={'agent':{},'channel':_0xa51b('0x78')};if(_0x4b525b[_0xa51b('0x5a')]['id']){delete _0x4b525b[_0xa51b('0x5a')]['id'];}_0x4b525b[_0xa51b('0x5a')][_0xa51b('0x61')]=_0x4b525b['body'][_0xa51b('0x61')]||_0x4b525b[_0xa51b('0x68')]['id'];_0x5d6322[_0xa51b('0x62')]['id']=_0x4b525b[_0xa51b('0x5a')]['UserId'];return db[_0xa51b('0x3c')][_0xa51b('0x5b')]({'where':{'id':_0x4b525b['params']['id'],'UserId':null}})[_0xa51b('0x20')](handleEntityNotFound(_0x492588,null))[_0xa51b('0x20')](function(_0x1e4511){if(_0x1e4511){_0x5d6322[_0xa51b('0x26')]=_0x1e4511[_0xa51b('0x63')]({'plain':!![]});return db[_0xa51b('0x64')][_0xa51b('0x5b')]({'where':{'id':_0x1e4511[_0xa51b('0x79')]}});}return null;})[_0xa51b('0x20')](handleEntityNotFound(_0x492588,null))[_0xa51b('0x20')](function(_0x396578){if(_0x396578){_0x5d6322[_0xa51b('0x66')]=_0x396578[_0xa51b('0x63')]({'plain':!![]});interaction_log[_0xa51b('0x27')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b525b[_0xa51b('0x68')]['id'],_0x4b525b[_0xa51b('0x68')][_0xa51b('0x39')],_0x4b525b[_0xa51b('0x68')][_0xa51b('0x7a')],_0x5d6322['interaction']['id'],_0x4b525b[_0xa51b('0x5a')]?JSON['stringify'](_0x4b525b[_0xa51b('0x5a')]):_0xa51b('0x69'));return respondWithRpcPromise(_0xa51b('0x7b'),'rejectMessage',_0x5d6322);}return null;})[_0xa51b('0x20')](function(_0x25331c){var _0x229eb2=_0xa51b('0x7c')+_0x25331c[_0xa51b('0x26')][_0xa51b('0x6b')];return db[_0xa51b('0x6c')][_0xa51b('0x41')](_0x229eb2,{'type':db[_0xa51b('0x6d')]['QueryTypes'][_0xa51b('0x7d')],'raw':!![]})[_0xa51b('0x20')](function(_0x4b69d6){return _0x4b69d6;});})['then'](function(_0x105dea){if(_0x105dea){_0x5d6322[_0xa51b('0x26')][_0xa51b('0x7e')]=_0x105dea[0x0];if(!_0x4b525b[_0xa51b('0x5a')][_0xa51b('0x61')])return;return db[_0xa51b('0x6f')][_0xa51b('0x5b')]({'where':{'id':_0x4b525b['body'][_0xa51b('0x61')],'role':_0xa51b('0x62')},'attributes':['id',_0xa51b('0x39'),_0xa51b('0x70'),_0xa51b('0x71'),_0xa51b('0x7f')],'raw':!![]});}return null;})[_0xa51b('0x20')](function(_0x2da0f6){if(!_0x2da0f6)return null;_0x5d6322['message'][_0xa51b('0x62')]=_0x2da0f6;return _0x5d6322;})[_0xa51b('0x20')](function(_0x3d30fd){if(_0x3d30fd){_0x3d30fd[_0xa51b('0x26')][_0xa51b('0x72')]=util[_0xa51b('0x5f')](_0xa51b('0x73'),_0x4b525b[_0xa51b('0x68')][_0xa51b('0x39')]);_0x3d30fd[_0xa51b('0x26')][_0xa51b('0x74')]=_0x5d6322[_0xa51b('0x74')];_0x3d30fd[_0xa51b('0x26')][_0xa51b('0x80')]=_0x5d6322[_0xa51b('0x74')];_0x3d30fd['message'][_0xa51b('0x81')]=_0xa51b('0x34');respondWithRpcPromise(_0xa51b('0x75'),_0xa51b('0x75'),{'event':'rejectmessage','message':_0x3d30fd[_0xa51b('0x26')]},client9002);return _0x5d6322;}return null;})[_0xa51b('0x20')](respondWithResult(_0x492588,null))[_0xa51b('0x29')](handleError(_0x492588,null));}; \ No newline at end of file +var _0xc6aa=['bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','./openchannelMessage.socket','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','save','update','destroy','sendStatus','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','OpenchannelMessage','includeAll','findAll','show','params','include','create','body','find','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','User','internal','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x202174,_0x3b10d8){var _0x55cc42=function(_0x4e86f9){while(--_0x4e86f9){_0x202174['push'](_0x202174['shift']());}};_0x55cc42(++_0x3b10d8);}(_0xc6aa,0x1f4));var _0xac6a=function(_0x4deb0c,_0x2c2ef2){_0x4deb0c=_0x4deb0c-0x0;var _0x515a0b=_0xc6aa[_0x4deb0c];return _0x515a0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xac6a('0x0'));var jsonpatch=require(_0xac6a('0x1'));var rp=require(_0xac6a('0x2'));var moment=require(_0xac6a('0x3'));var BPromise=require(_0xac6a('0x4'));var Mustache=require(_0xac6a('0x5'));var util=require('util');var path=require(_0xac6a('0x6'));var sox=require('sox');var csv=require(_0xac6a('0x7'));var ejs=require(_0xac6a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xac6a('0x9'));var crypto=require(_0xac6a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xac6a('0xb'));var toCsv=require(_0xac6a('0x7'));var querystring=require(_0xac6a('0xc'));var Papa=require(_0xac6a('0xd'));var Redis=require(_0xac6a('0xe'));var authService=require(_0xac6a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xac6a('0x10'))(_0xac6a('0x11'));var utils=require(_0xac6a('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac6a('0x13'))['db'];config['redis']=_[_0xac6a('0x14')](config[_0xac6a('0x15')],{'host':_0xac6a('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac6a('0x15')]));require(_0xac6a('0x17'))[_0xac6a('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xac6a('0x19')][_0xac6a('0x1a')]({'port':0x232c});var client9002=jayson[_0xac6a('0x19')][_0xac6a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x57ebd2,_0x3b3354,_0x90c4d4,_0x3c99fc){return new BPromise(function(_0x4f923d,_0x4b7669){var _0x9a8158=_0x3c99fc||client;return _0x9a8158[_0xac6a('0x1b')](_0x57ebd2,_0x90c4d4)[_0xac6a('0x1c')](function(_0x134c94){logger[_0xac6a('0x1d')](_0xac6a('0x1e'),_0x3b3354,_0xac6a('0x1f'));logger[_0xac6a('0x20')](_0xac6a('0x21'),_0x3b3354,'request\x20sent',JSON[_0xac6a('0x22')](_0x134c94));if(_0x134c94[_0xac6a('0x23')]){if(_0x134c94['error'][_0xac6a('0x24')]===0x1f4){logger[_0xac6a('0x23')](_0xac6a('0x1e'),_0x3b3354,_0x134c94['error'][_0xac6a('0x25')]);return _0x4b7669(_0x134c94[_0xac6a('0x23')][_0xac6a('0x25')]);}logger[_0xac6a('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x3b3354,_0x134c94[_0xac6a('0x23')][_0xac6a('0x25')]);return _0x4f923d(_0x134c94[_0xac6a('0x23')][_0xac6a('0x25')]);}else{logger[_0xac6a('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x3b3354,_0xac6a('0x1f'));_0x4f923d(_0x134c94[_0xac6a('0x26')][_0xac6a('0x25')]);}})[_0xac6a('0x27')](function(_0x566362){logger[_0xac6a('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x3b3354,_0x566362);_0x4b7669(_0x566362);});});}function respondWithStatusCode(_0x53813b,_0x55e0bb){_0x55e0bb=_0x55e0bb||0xcc;return function(_0x3a0af5){if(_0x3a0af5){return _0x53813b['sendStatus'](_0x55e0bb);}return _0x53813b[_0xac6a('0x28')](_0x55e0bb)['end']();};}function respondWithResult(_0x27dd64,_0x3d9854){_0x3d9854=_0x3d9854||0xc8;return function(_0x5a2fcc){if(_0x5a2fcc){return _0x27dd64[_0xac6a('0x28')](_0x3d9854)['json'](_0x5a2fcc);}};}function respondWithFilteredResult(_0x2b4527,_0x159171){return function(_0x524336){if(_0x524336){var _0x4eeae0=typeof _0x159171[_0xac6a('0x29')]===_0xac6a('0x2a')&&typeof _0x159171[_0xac6a('0x2b')]==='undefined';var _0x4cb71e=_0x524336[_0xac6a('0x2c')];var _0x11e528=_0x4eeae0?0x0:_0x159171[_0xac6a('0x29')];var _0x242442=_0x4eeae0?_0x524336[_0xac6a('0x2c')]:_0x159171[_0xac6a('0x29')]+_0x159171[_0xac6a('0x2b')];var _0x39f0c6;if(_0x242442>=_0x4cb71e){_0x242442=_0x4cb71e;_0x39f0c6=0xc8;}else{_0x39f0c6=0xce;}_0x2b4527['status'](_0x39f0c6);return _0x2b4527['set']('Content-Range',_0x11e528+'-'+_0x242442+'/'+_0x4cb71e)['json'](_0x524336);}return null;};}function patchUpdates(_0x2e8010){return function(_0x556364){try{jsonpatch['apply'](_0x556364,_0x2e8010,!![]);}catch(_0x484f6d){return BPromise['reject'](_0x484f6d);}return _0x556364[_0xac6a('0x2d')]();};}function saveUpdates(_0x242566,_0x5d579c){return function(_0xf37edc){if(_0xf37edc){return _0xf37edc[_0xac6a('0x2e')](_0x242566)[_0xac6a('0x1c')](function(_0x38ccf5){return _0x38ccf5;});}return null;};}function removeEntity(_0x4b112f,_0x14d66a){return function(_0x5e39f3){if(_0x5e39f3){return _0x5e39f3[_0xac6a('0x2f')]()[_0xac6a('0x1c')](function(){_0x4b112f[_0xac6a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c0f68,_0x584ba2){return function(_0x1cf812){if(!_0x1cf812){_0x4c0f68[_0xac6a('0x30')](0x194);}return _0x1cf812;};}function handleError(_0x4a5de0,_0x36aa0a){_0x36aa0a=_0x36aa0a||0x1f4;return function(_0x4c7e10){logger[_0xac6a('0x23')](_0x4c7e10[_0xac6a('0x31')]);if(_0x4c7e10['name']){delete _0x4c7e10[_0xac6a('0x32')];}_0x4a5de0[_0xac6a('0x28')](_0x36aa0a)[_0xac6a('0x33')](_0x4c7e10);};}exports['index']=function(_0x3b1b7c,_0x2cb2a1){var _0x88bb0a={},_0x1a4bcd={},_0x514ccd={'count':0x0,'rows':[]};var _0x218e96=_[_0xac6a('0x34')](db['OpenchannelMessage'][_0xac6a('0x35')],function(_0x2b1fa5){return{'name':_0x2b1fa5['fieldName'],'type':_0x2b1fa5['type'][_0xac6a('0x36')]};});_0x1a4bcd[_0xac6a('0x37')]=_[_0xac6a('0x34')](_0x218e96,'name');_0x1a4bcd[_0xac6a('0x38')]=_[_0xac6a('0x39')](_0x3b1b7c[_0xac6a('0x38')]);_0x1a4bcd[_0xac6a('0x3a')]=_[_0xac6a('0x3b')](_0x1a4bcd['model'],_0x1a4bcd[_0xac6a('0x38')]);_0x88bb0a['attributes']=_[_0xac6a('0x3b')](_0x1a4bcd[_0xac6a('0x37')],qs[_0xac6a('0x3c')](_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x3c')]));_0x88bb0a[_0xac6a('0x3d')]=_0x88bb0a[_0xac6a('0x3d')][_0xac6a('0x3e')]?_0x88bb0a[_0xac6a('0x3d')]:_0x1a4bcd['model'];if(!_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x3f')](_0xac6a('0x40'))){_0x88bb0a['limit']=qs[_0xac6a('0x2b')](_0x3b1b7c[_0xac6a('0x38')]['limit']);_0x88bb0a[_0xac6a('0x29')]=qs['offset'](_0x3b1b7c['query'][_0xac6a('0x29')]);}_0x88bb0a[_0xac6a('0x41')]=qs[_0xac6a('0x42')](_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x42')]);_0x88bb0a[_0xac6a('0x43')]=qs['filters'](_['pick'](_0x3b1b7c[_0xac6a('0x38')],_0x1a4bcd[_0xac6a('0x3a')]),_0x218e96);if(_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x44')]){_0x88bb0a[_0xac6a('0x43')]=_['merge'](_0x88bb0a[_0xac6a('0x43')],{'$or':_[_0xac6a('0x34')](_0x218e96,function(_0x4df8c6){if(_0x4df8c6['type']!==_0xac6a('0x45')){var _0x4bbe01={};_0x4bbe01[_0x4df8c6[_0xac6a('0x32')]]={'$like':'%'+_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x44')]+'%'};return _0x4bbe01;}})});}_0x88bb0a=_[_0xac6a('0x46')]({},_0x88bb0a,_0x3b1b7c[_0xac6a('0x47')]);var _0xcec744={'where':_0x88bb0a[_0xac6a('0x43')]};return db[_0xac6a('0x48')][_0xac6a('0x2c')](_0xcec744)[_0xac6a('0x1c')](function(_0x1b0c51){_0x514ccd[_0xac6a('0x2c')]=_0x1b0c51;if(_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x49')]){_0x88bb0a['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xac6a('0x4a')](_0x88bb0a);})['then'](function(_0x46c61f){_0x514ccd['rows']=_0x46c61f;return _0x514ccd;})['then'](respondWithFilteredResult(_0x2cb2a1,_0x88bb0a))[_0xac6a('0x27')](handleError(_0x2cb2a1,null));};exports[_0xac6a('0x4b')]=function(_0x3fb683,_0x3d309e){var _0x1358fe={'raw':!![],'where':{'id':_0x3fb683[_0xac6a('0x4c')]['id']}},_0x47804a={};_0x47804a[_0xac6a('0x37')]=_[_0xac6a('0x39')](db[_0xac6a('0x48')][_0xac6a('0x35')]);_0x47804a[_0xac6a('0x38')]=_[_0xac6a('0x39')](_0x3fb683[_0xac6a('0x38')]);_0x47804a[_0xac6a('0x3a')]=_['intersection'](_0x47804a[_0xac6a('0x37')],_0x47804a[_0xac6a('0x38')]);_0x1358fe[_0xac6a('0x3d')]=_['intersection'](_0x47804a[_0xac6a('0x37')],qs[_0xac6a('0x3c')](_0x3fb683[_0xac6a('0x38')][_0xac6a('0x3c')]));_0x1358fe[_0xac6a('0x3d')]=_0x1358fe[_0xac6a('0x3d')][_0xac6a('0x3e')]?_0x1358fe[_0xac6a('0x3d')]:_0x47804a['model'];if(_0x3fb683[_0xac6a('0x38')][_0xac6a('0x49')]){_0x1358fe[_0xac6a('0x4d')]=[{'all':!![]}];}_0x1358fe=_[_0xac6a('0x46')]({},_0x1358fe,_0x3fb683[_0xac6a('0x47')]);return db[_0xac6a('0x48')]['find'](_0x1358fe)[_0xac6a('0x1c')](handleEntityNotFound(_0x3d309e,null))[_0xac6a('0x1c')](respondWithResult(_0x3d309e,null))[_0xac6a('0x27')](handleError(_0x3d309e,null));};exports[_0xac6a('0x4e')]=function(_0x49bc51,_0x120b8c){return db[_0xac6a('0x48')][_0xac6a('0x4e')](_0x49bc51[_0xac6a('0x4f')],{})['then'](respondWithResult(_0x120b8c,0xc9))[_0xac6a('0x27')](handleError(_0x120b8c,null));};exports[_0xac6a('0x2e')]=function(_0x54bfb0,_0x1f9c69){if(_0x54bfb0[_0xac6a('0x4f')]['id']){delete _0x54bfb0[_0xac6a('0x4f')]['id'];}return db[_0xac6a('0x48')][_0xac6a('0x50')]({'where':{'id':_0x54bfb0[_0xac6a('0x4c')]['id']}})[_0xac6a('0x1c')](handleEntityNotFound(_0x1f9c69,null))[_0xac6a('0x1c')](saveUpdates(_0x54bfb0[_0xac6a('0x4f')],null))[_0xac6a('0x1c')](respondWithResult(_0x1f9c69,null))['catch'](handleError(_0x1f9c69,null));};exports[_0xac6a('0x2f')]=function(_0x5ec7af,_0x1999e2){return db[_0xac6a('0x48')]['find']({'where':{'id':_0x5ec7af[_0xac6a('0x4c')]['id']}})[_0xac6a('0x1c')](handleEntityNotFound(_0x1999e2,null))[_0xac6a('0x1c')](removeEntity(_0x1999e2,null))[_0xac6a('0x27')](handleError(_0x1999e2,null));};exports[_0xac6a('0x51')]=function(_0xeff2a1,_0x509146){return db[_0xac6a('0x48')]['describe']()[_0xac6a('0x1c')](respondWithResult(_0x509146,null))['catch'](handleError(_0x509146,null));};var interaction_log=require('../../config/logger')(_0xac6a('0x52'));exports[_0xac6a('0x53')]=function(_0x29b686,_0x587262,_0x49f8de){var _0x1b9305={'agent':{},'channel':_0xac6a('0x54')};if(_0x29b686[_0xac6a('0x4f')]['id']){delete _0x29b686['body']['id'];}_0x29b686[_0xac6a('0x4f')][_0xac6a('0x55')]=!![];_0x29b686['body'][_0xac6a('0x56')]=moment()[_0xac6a('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x29b686[_0xac6a('0x4f')][_0xac6a('0x58')]=_0x29b686[_0xac6a('0x4f')][_0xac6a('0x58')]||_0x29b686[_0xac6a('0x59')]['id'];_0x1b9305[_0xac6a('0x5a')]['id']=_0x29b686[_0xac6a('0x4f')][_0xac6a('0x58')];return db[_0xac6a('0x48')][_0xac6a('0x50')]({'where':{'id':_0x29b686[_0xac6a('0x4c')]['id'],'UserId':null}})[_0xac6a('0x1c')](handleEntityNotFound(_0x587262,null))[_0xac6a('0x1c')](saveUpdates(_0x29b686[_0xac6a('0x4f')],null))[_0xac6a('0x1c')](function(_0x561ac5){if(_0x561ac5){_0x1b9305[_0xac6a('0x25')]=_0x561ac5['get']({'plain':!![]});return db[_0xac6a('0x5b')]['find']({'where':{'id':_0x561ac5[_0xac6a('0x5c')]}});}return null;})[_0xac6a('0x1c')](handleEntityNotFound(_0x587262,null))[_0xac6a('0x1c')](function(_0x231743){if(_0x231743){return _0x231743[_0xac6a('0x2e')]({'UserId':_0x29b686[_0xac6a('0x4f')]['UserId'],'read1stAt':_[_0xac6a('0x5d')](_0x231743[_0xac6a('0x5e')])?moment()['format'](_0xac6a('0x5f')):undefined});}return null;})[_0xac6a('0x1c')](function(_0x18cda){if(_0x18cda){_0x1b9305[_0xac6a('0x60')]=_0x18cda['get']({'plain':!![]});interaction_log[_0xac6a('0x1d')](_0xac6a('0x61'),_0x29b686[_0xac6a('0x59')]['id'],_0x29b686['user'][_0xac6a('0x32')],_0x29b686[_0xac6a('0x59')][_0xac6a('0x62')],_0x1b9305[_0xac6a('0x60')]['id'],_0x29b686[_0xac6a('0x4f')]?JSON['stringify'](_0x29b686[_0xac6a('0x4f')]):_0xac6a('0x63'));return respondWithRpcPromise(_0xac6a('0x64'),_0xac6a('0x65'),_0x1b9305);}return null;})[_0xac6a('0x1c')](function(_0x199c3b){var _0x562d49=_0xac6a('0x66')+_0x199c3b[_0xac6a('0x25')][_0xac6a('0x67')];return db[_0xac6a('0x68')][_0xac6a('0x38')](_0x562d49,{'type':db[_0xac6a('0x69')]['QueryTypes'][_0xac6a('0x6a')],'raw':!![]})['then'](function(_0x4c57ec){return _0x4c57ec;});})['then'](function(_0x5b7c44){if(_0x5b7c44){_0x1b9305['message'][_0xac6a('0x6b')]=_0x5b7c44[0x0];if(!_0x29b686[_0xac6a('0x4f')][_0xac6a('0x58')])return;return db['User'][_0xac6a('0x50')]({'where':{'id':_0x29b686[_0xac6a('0x4f')][_0xac6a('0x58')],'role':_0xac6a('0x5a')},'attributes':['id',_0xac6a('0x32'),_0xac6a('0x6c'),_0xac6a('0x6d'),'internal'],'raw':!![]});}return null;})[_0xac6a('0x1c')](function(_0x7798ec){if(!_0x7798ec)return null;_0x1b9305['message'][_0xac6a('0x5a')]=_0x7798ec;return _0x1b9305;})[_0xac6a('0x1c')](function(_0x58f659){if(_0x58f659){if(_0x29b686[_0xac6a('0x4f')][_0xac6a('0x6e')]){_0x1b9305[_0xac6a('0x25')][_0xac6a('0x6f')]=util[_0xac6a('0x57')](_0xac6a('0x70'),_0x29b686['user'][_0xac6a('0x32')]);_0x1b9305[_0xac6a('0x25')][_0xac6a('0x71')]=_0x1b9305[_0xac6a('0x71')];_0x1b9305[_0xac6a('0x25')][_0xac6a('0x72')]=_0x1b9305[_0xac6a('0x71')];_0x1b9305['message'][_0xac6a('0x73')]=_0xac6a('0x53');return respondWithRpcPromise(_0xac6a('0x74'),_0xac6a('0x74'),{'event':_0xac6a('0x75'),'message':_0x1b9305['message']},client9002)[_0xac6a('0x1c')](function(){return _0x1b9305;});}return _0x1b9305;}return null;})[_0xac6a('0x1c')](respondWithResult(_0x587262,null))[_0xac6a('0x27')](handleError(_0x587262,null));};var interaction_log=require(_0xac6a('0x10'))('openchannel-interactions');exports[_0xac6a('0x76')]=function(_0x24f735,_0x327adc,_0x107a7f){var _0x55f4f1={'agent':{},'channel':_0xac6a('0x54')};if(_0x24f735[_0xac6a('0x4f')]['id']){delete _0x24f735[_0xac6a('0x4f')]['id'];}_0x24f735[_0xac6a('0x4f')][_0xac6a('0x58')]=_0x24f735[_0xac6a('0x4f')][_0xac6a('0x58')]||_0x24f735[_0xac6a('0x59')]['id'];_0x55f4f1[_0xac6a('0x5a')]['id']=_0x24f735[_0xac6a('0x4f')][_0xac6a('0x58')];return db[_0xac6a('0x48')]['find']({'where':{'id':_0x24f735[_0xac6a('0x4c')]['id'],'UserId':null}})[_0xac6a('0x1c')](handleEntityNotFound(_0x327adc,null))['then'](function(_0x1308d1){if(_0x1308d1){_0x55f4f1['message']=_0x1308d1[_0xac6a('0x77')]({'plain':!![]});return db['OpenchannelInteraction'][_0xac6a('0x50')]({'where':{'id':_0x1308d1[_0xac6a('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0x327adc,null))['then'](function(_0x232379){if(_0x232379){_0x55f4f1[_0xac6a('0x60')]=_0x232379[_0xac6a('0x77')]({'plain':!![]});interaction_log['info'](_0xac6a('0x78'),_0x24f735[_0xac6a('0x59')]['id'],_0x24f735[_0xac6a('0x59')]['name'],_0x24f735[_0xac6a('0x59')][_0xac6a('0x62')],_0x55f4f1[_0xac6a('0x60')]['id'],_0x24f735[_0xac6a('0x4f')]?JSON[_0xac6a('0x22')](_0x24f735['body']):_0xac6a('0x63'));return respondWithRpcPromise(_0xac6a('0x79'),_0xac6a('0x7a'),_0x55f4f1);}return null;})[_0xac6a('0x1c')](function(_0x212d05){var _0xf60c2b=_0xac6a('0x66')+_0x212d05[_0xac6a('0x25')]['ContactId'];return db['sequelize'][_0xac6a('0x38')](_0xf60c2b,{'type':db['Sequelize'][_0xac6a('0x7b')][_0xac6a('0x6a')],'raw':!![]})['then'](function(_0x50690a){return _0x50690a;});})[_0xac6a('0x1c')](function(_0x184df2){if(_0x184df2){_0x55f4f1[_0xac6a('0x25')][_0xac6a('0x6b')]=_0x184df2[0x0];if(!_0x24f735[_0xac6a('0x4f')][_0xac6a('0x58')])return;return db[_0xac6a('0x7c')][_0xac6a('0x50')]({'where':{'id':_0x24f735[_0xac6a('0x4f')][_0xac6a('0x58')],'role':_0xac6a('0x5a')},'attributes':['id','name',_0xac6a('0x6c'),_0xac6a('0x6d'),_0xac6a('0x7d')],'raw':!![]});}return null;})['then'](function(_0x1151fc){if(!_0x1151fc)return null;_0x55f4f1['message'][_0xac6a('0x5a')]=_0x1151fc;return _0x55f4f1;})[_0xac6a('0x1c')](function(_0x17e723){if(_0x17e723){_0x17e723[_0xac6a('0x25')][_0xac6a('0x6f')]=util[_0xac6a('0x57')](_0xac6a('0x70'),_0x24f735[_0xac6a('0x59')]['name']);_0x17e723['message']['channel']=_0x55f4f1[_0xac6a('0x71')];_0x17e723['message'][_0xac6a('0x72')]=_0x55f4f1['channel'];_0x17e723[_0xac6a('0x25')]['event']=_0xac6a('0x76');respondWithRpcPromise(_0xac6a('0x74'),'EventManager',{'event':'rejectmessage','message':_0x17e723[_0xac6a('0x25')]},client9002);return _0x55f4f1;}return null;})[_0xac6a('0x1c')](respondWithResult(_0x327adc,null))[_0xac6a('0x27')](handleError(_0x327adc,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index da12d82..a76926e 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 _0x5fdf=['save','remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x5fdf,0x1a3));var _0xf5fd=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x5fdf[_0x5a7f64];return _0x3d30f1;};'use strict';var EventEmitter=require(_0xf5fd('0x0'));var OpenchannelMessage=require(_0xf5fd('0x1'))['db'][_0xf5fd('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf5fd('0x3')](0x0);var events={'afterCreate':_0xf5fd('0x4'),'afterUpdate':'update','afterDestroy':_0xf5fd('0x5')};function emitEvent(_0x27eda0){return function(_0x2f9556,_0x3d97d6,_0x2c660c){OpenchannelMessageEvents[_0xf5fd('0x6')](_0x27eda0+':'+_0x2f9556['id'],_0x2f9556);OpenchannelMessageEvents[_0xf5fd('0x6')](_0x27eda0,_0x2f9556);_0x2c660c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xf5fd('0x7')](e,emitEvent(event));}}module[_0xf5fd('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x5358=['save','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x43c812,_0x5da4f7){var _0x309567=function(_0x9327af){while(--_0x9327af){_0x43c812['push'](_0x43c812['shift']());}};_0x309567(++_0x5da4f7);}(_0x5358,0x1ac));var _0x8535=function(_0x37492a,_0x46ff54){_0x37492a=_0x37492a-0x0;var _0x2c3693=_0x5358[_0x37492a];return _0x2c3693;};'use strict';var EventEmitter=require(_0x8535('0x0'));var OpenchannelMessage=require(_0x8535('0x1'))['db'][_0x8535('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8535('0x3')](0x0);var events={'afterCreate':_0x8535('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1a5071){return function(_0x1adcc3,_0x78ca60,_0x5834bc){OpenchannelMessageEvents[_0x8535('0x5')](_0x1a5071+':'+_0x1adcc3['id'],_0x1adcc3);OpenchannelMessageEvents[_0x8535('0x5')](_0x1a5071,_0x1adcc3);_0x5834bc(null);};}for(var e in events){if(events[_0x8535('0x6')](e)){var event=events[e];OpenchannelMessage[_0x8535('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index b680fd6..f463737 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 _0x58c2=['secret','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','finally','utf8mb4','lodash','util','../../config/logger','api','moment','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','then','update','direction','catch','error'];(function(_0x137d7f,_0x549478){var _0x5acc7d=function(_0x4e1615){while(--_0x4e1615){_0x137d7f['push'](_0x137d7f['shift']());}};_0x5acc7d(++_0x549478);}(_0x58c2,0x142));var _0x258c=function(_0x3ed9ed,_0x5841b0){_0x3ed9ed=_0x3ed9ed-0x0;var _0x4e9106=_0x58c2[_0x3ed9ed];return _0x4e9106;};'use strict';var _=require(_0x258c('0x0'));var util=require(_0x258c('0x1'));var logger=require(_0x258c('0x2'))(_0x258c('0x3'));var moment=require(_0x258c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x258c('0x5'));var rimraf=require('rimraf');var config=require(_0x258c('0x6'));var attributes=require(_0x258c('0x7'));module[_0x258c('0x8')]=function(_0x145bd1,_0x32ab56){return _0x145bd1[_0x258c('0x9')](_0x258c('0xa'),attributes,{'tableName':_0x258c('0xb'),'paranoid':![],'indexes':[{'name':_0x258c('0xc'),'fields':[_0x258c('0xd')],'type':_0x258c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49f795,_0x29e358,_0x1d7b06){var _0x4acc54=_0x145bd1[_0x258c('0xf')];var _0x2f6cb5=_0x49f795[_0x258c('0x10')]({'plain':!![]});if(_0x2f6cb5['direction'][_0x258c('0x11')]()==='in'||_0x2f6cb5['direction'][_0x258c('0x11')]()===_0x258c('0x12')&&!_0x2f6cb5['secret']&&!_[_0x258c('0x13')](_0x2f6cb5[_0x258c('0x14')])){_0x4acc54[_0x258c('0x15')][_0x258c('0x16')]({'where':{'id':_0x2f6cb5['OpenchannelInteractionId']}})[_0x258c('0x17')](function(_0x1e0780){if(_0x1e0780){_0x1e0780[_0x258c('0x18')]({'lastMsgAt':_0x2f6cb5['createdAt'],'lastMsgDirection':_0x2f6cb5[_0x258c('0x19')][_0x258c('0x11')]()});}})[_0x258c('0x1a')](function(_0x192e95){console[_0x258c('0x1b')](_0x192e95);});}if(_0x2f6cb5[_0x258c('0x19')]===_0x258c('0x12')&&!_0x2f6cb5[_0x258c('0x1c')]){var _0x3c0f07;_0x4acc54[_0x258c('0x1d')][_0x258c('0x1e')]()[_0x258c('0x17')](function(_0x2ef52e){return _0x4acc54['OpenchannelAccount'][_0x258c('0x1f')]({'where':{'id':_0x2f6cb5[_0x258c('0x20')]},'include':[{'model':_0x4acc54[_0x258c('0x15')],'as':_0x258c('0x21'),'where':{'id':_0x2f6cb5['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x4acc54['CmContact'],'as':_0x258c('0x22'),'attributes':_[_0x258c('0x23')](_0x2ef52e)}]}]});})['then'](function(_0x14eccd){_0x3c0f07=_0x14eccd[_0x258c('0x10')]({'plain':!![]});if(_0x3c0f07&&_0x3c0f07[_0x258c('0x24')]){logger['info'](_0x258c('0x25'),_0x258c('0x26'),util[_0x258c('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x2f6cb5['id'],_0x3c0f07['replyUri']));if(_0x3c0f07[_0x258c('0x21')]&&_0x3c0f07[_0x258c('0x21')][_0x258c('0x28')]){_0x2f6cb5['Interaction']=_['omit'](_0x3c0f07['Interactions'][0x0],'Contact');_0x2f6cb5[_0x258c('0x22')]=_0x3c0f07[_0x258c('0x21')][0x0][_0x258c('0x22')];}var _0x29e358={'method':_0x258c('0x29'),'uri':encodeURI(_0x3c0f07[_0x258c('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x29e358[_0x258c('0x2a')]){case _0x258c('0x2b'):_0x29e358['qs']=_0x2f6cb5;break;case _0x258c('0x29'):_0x29e358[_0x258c('0xd')]=_0x2f6cb5;break;}return rp(_0x29e358)[_0x258c('0x17')](function(_0x2e55bb){logger[_0x258c('0x2c')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0x258c('0x2d'),_0x2f6cb5['id'],_0x3c0f07['replyUri']));if(_0x2e55bb[_0x258c('0xd')]['threadId']&&_0x2e55bb['body'][_0x258c('0x2e')]!=_0x2f6cb5['Interaction'][_0x258c('0x2e')]){return _0x4acc54[_0x258c('0x15')][_0x258c('0x18')]({'threadId':_0x2e55bb[_0x258c('0xd')][_0x258c('0x2e')]},{'where':{'id':_0x2f6cb5[_0x258c('0x2f')]['id']}});}else{return;}})[_0x258c('0x17')](function(){return _0x49f795['update']({'read':!![]});})[_0x258c('0x1a')](function(_0x59fce4){logger[_0x258c('0x1b')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['inspect'](_0x59fce4,{'showHidden':![],'depth':null}));_0x1d7b06();});}else{_0x1d7b06();}})[_0x258c('0x30')](function(){_0x1d7b06();});}else{_0x1d7b06();}}},'charset':_0x258c('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x16f3=['get','direction','toLowerCase','out','secret','UserId','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelInteraction','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models'];(function(_0x14a8c4,_0x3ff392){var _0x3e3a53=function(_0x5a8efb){while(--_0x5a8efb){_0x14a8c4['push'](_0x14a8c4['shift']());}};_0x3e3a53(++_0x3ff392);}(_0x16f3,0xef));var _0x316f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16f3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x316f('0x0'));var util=require('util');var logger=require(_0x316f('0x1'))(_0x316f('0x2'));var moment=require(_0x316f('0x3'));var BPromise=require(_0x316f('0x4'));var rp=require(_0x316f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x316f('0x6'));var config=require(_0x316f('0x7'));var attributes=require(_0x316f('0x8'));module[_0x316f('0x9')]=function(_0x1a8f77,_0x1ca308){return _0x1a8f77[_0x316f('0xa')]('OpenchannelMessage',attributes,{'tableName':_0x316f('0xb'),'paranoid':![],'indexes':[{'name':_0x316f('0xc'),'fields':[_0x316f('0xd')],'type':_0x316f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a50c2,_0x481992,_0x3d09d7){var _0x58eeb3=_0x1a8f77[_0x316f('0xf')];var _0x35f5dc=_0x5a50c2[_0x316f('0x10')]({'plain':!![]});if(_0x35f5dc[_0x316f('0x11')][_0x316f('0x12')]()==='in'||_0x35f5dc[_0x316f('0x11')][_0x316f('0x12')]()===_0x316f('0x13')&&!_0x35f5dc[_0x316f('0x14')]&&!_['isNil'](_0x35f5dc[_0x316f('0x15')])){_0x58eeb3['OpenchannelInteraction']['findOne']({'where':{'id':_0x35f5dc[_0x316f('0x16')]}})[_0x316f('0x17')](function(_0x35abdb){if(_0x35abdb){_0x35abdb[_0x316f('0x18')]({'lastMsgAt':_0x35f5dc[_0x316f('0x19')],'lastMsgDirection':_0x35f5dc[_0x316f('0x11')][_0x316f('0x12')]()});}})[_0x316f('0x1a')](function(_0x24b901){console['error'](_0x24b901);});}if(_0x35f5dc[_0x316f('0x11')]===_0x316f('0x13')&&!_0x35f5dc[_0x316f('0x14')]){var _0x393510;_0x58eeb3[_0x316f('0x1b')][_0x316f('0x1c')]()[_0x316f('0x17')](function(_0x1a598a){return _0x58eeb3[_0x316f('0x1d')][_0x316f('0x1e')]({'where':{'id':_0x35f5dc['OpenchannelAccountId']},'include':[{'model':_0x58eeb3[_0x316f('0x1f')],'as':'Interactions','where':{'id':_0x35f5dc[_0x316f('0x16')]},'limit':0x1,'include':[{'model':_0x58eeb3['CmContact'],'as':_0x316f('0x20'),'attributes':_[_0x316f('0x21')](_0x1a598a)}]}]});})['then'](function(_0x47abc7){_0x393510=_0x47abc7['get']({'plain':!![]});if(_0x393510&&_0x393510[_0x316f('0x22')]){logger[_0x316f('0x23')](_0x316f('0x24'),_0x316f('0x25'),util[_0x316f('0x26')](_0x316f('0x27'),_0x35f5dc['id'],_0x393510[_0x316f('0x22')]));if(_0x393510[_0x316f('0x28')]&&_0x393510[_0x316f('0x28')][_0x316f('0x29')]){_0x35f5dc[_0x316f('0x2a')]=_[_0x316f('0x2b')](_0x393510[_0x316f('0x28')][0x0],_0x316f('0x20'));_0x35f5dc[_0x316f('0x20')]=_0x393510[_0x316f('0x28')][0x0][_0x316f('0x20')];}var _0x481992={'method':'POST','uri':encodeURI(_0x393510[_0x316f('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x481992[_0x316f('0x2c')]){case _0x316f('0x2d'):_0x481992['qs']=_0x35f5dc;break;case'POST':_0x481992[_0x316f('0xd')]=_0x35f5dc;break;}return rp(_0x481992)[_0x316f('0x17')](function(_0x429ed1){logger['info'](_0x316f('0x24'),_0x316f('0x25'),util['format'](_0x316f('0x2e'),_0x35f5dc['id'],_0x393510['replyUri']));if(_0x429ed1['body'][_0x316f('0x2f')]&&_0x429ed1[_0x316f('0xd')][_0x316f('0x2f')]!=_0x35f5dc[_0x316f('0x2a')][_0x316f('0x2f')]){return _0x58eeb3[_0x316f('0x1f')][_0x316f('0x18')]({'threadId':_0x429ed1[_0x316f('0xd')][_0x316f('0x2f')]},{'where':{'id':_0x35f5dc['Interaction']['id']}});}else{return;}})[_0x316f('0x17')](function(){return _0x5a50c2[_0x316f('0x18')]({'read':!![]});})[_0x316f('0x1a')](function(_0xf4cb2d){logger[_0x316f('0x30')](_0x316f('0x24'),_0x316f('0x25'),util[_0x316f('0x31')](_0xf4cb2d,{'showHidden':![],'depth':null}));_0x3d09d7();});}else{_0x3d09d7();}})['finally'](function(){_0x3d09d7();});}else{_0x3d09d7();}}},'charset':_0x316f('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 9001ff7..6388146 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3c93d9,_0x500378){var _0x22dbb8=function(_0x1a7a57){while(--_0x1a7a57){_0x3c93d9['push'](_0x3c93d9['shift']());}};_0x22dbb8(++_0x500378);}(_0xadb5,0xad));var _0x5adb=function(_0x227980,_0x55ed6f){_0x227980=_0x227980-0x0;var _0x45d194=_0xadb5[_0x227980];return _0x45d194;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _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(_0x22ba48,_0x20d547){var _0x2f5bcf=function(_0x54785c){while(--_0x54785c){_0x22ba48['push'](_0x22ba48['shift']());}};_0x2f5bcf(++_0x20d547);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});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 f87b9dd..eaf544b 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 _0xfa12=['removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x348d0b,_0x4ab1d9){var _0x270395=function(_0x422f08){while(--_0x422f08){_0x348d0b['push'](_0x348d0b['shift']());}};_0x270395(++_0x4ab1d9);}(_0xfa12,0x1bd));var _0x2fa1=function(_0x363063,_0x863a4c){_0x363063=_0x363063-0x0;var _0x27f875=_0xfa12[_0x363063];return _0x27f875;};'use strict';var OpenchannelMessageEvents=require(_0x2fa1('0x0'));var events=[_0x2fa1('0x1'),_0x2fa1('0x2'),'update'];function createListener(_0x577931,_0x3555d0){return function(_0x1a08dc){_0x3555d0['emit'](_0x577931,_0x1a08dc);};}function removeListener(_0x4ec644,_0x41eaf6){return function(){OpenchannelMessageEvents[_0x2fa1('0x3')](_0x4ec644,_0x41eaf6);};}exports[_0x2fa1('0x4')]=function(_0x4dfb6e){for(var _0x19a57a=0x0,_0x5d5fb4=events[_0x2fa1('0x5')];_0x19a57a<_0x5d5fb4;_0x19a57a++){var _0x1adece=events[_0x19a57a];var _0x3ee801=createListener(_0x2fa1('0x6')+_0x1adece,_0x4dfb6e);OpenchannelMessageEvents['on'](_0x1adece,_0x3ee801);}}; \ No newline at end of file +var _0x54ba=['save','remove','update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x54ba,0x170));var _0xa54b=function(_0x4a9c80,_0x2f0cd2){_0x4a9c80=_0x4a9c80-0x0;var _0x2a2494=_0x54ba[_0x4a9c80];return _0x2a2494;};'use strict';var OpenchannelMessageEvents=require(_0xa54b('0x0'));var events=[_0xa54b('0x1'),_0xa54b('0x2'),_0xa54b('0x3')];function createListener(_0x19e323,_0xea7291){return function(_0x53e1f3){_0xea7291[_0xa54b('0x4')](_0x19e323,_0x53e1f3);};}function removeListener(_0x4af786,_0x3e1157){return function(){OpenchannelMessageEvents[_0xa54b('0x5')](_0x4af786,_0x3e1157);};}exports[_0xa54b('0x6')]=function(_0x3ca5d5){for(var _0x574edb=0x0,_0x4e3dc1=events[_0xa54b('0x7')];_0x574edb<_0x4e3dc1;_0x574edb++){var _0xbd9471=events[_0x574edb];var _0x471566=createListener(_0xa54b('0x8')+_0xbd9471,_0x3ca5d5);OpenchannelMessageEvents['on'](_0xbd9471,_0x471566);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 7116262..ab7d010 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 _0x6c38=['index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','removeAgents','exports','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x4215a2,_0x466895){var _0x3d72db=function(_0x47ee78){while(--_0x47ee78){_0x4215a2['push'](_0x4215a2['shift']());}};_0x3d72db(++_0x466895);}(_0x6c38,0x89));var _0x86c3=function(_0x55ffee,_0x1862c1){_0x55ffee=_0x55ffee-0x0;var _0x27992d=_0x6c38[_0x55ffee];return _0x27992d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x86c3('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x86c3('0x1'));var interaction=require(_0x86c3('0x2'));var config=require(_0x86c3('0x3'));var controller=require(_0x86c3('0x4'));router[_0x86c3('0x5')]('/',auth[_0x86c3('0x6')](),controller[_0x86c3('0x7')]);router[_0x86c3('0x5')]('/describe',auth[_0x86c3('0x6')](),controller['describe']);router['get'](_0x86c3('0x8'),auth[_0x86c3('0x6')](),controller[_0x86c3('0x9')]);router[_0x86c3('0x5')](_0x86c3('0xa'),auth[_0x86c3('0x6')](),controller[_0x86c3('0xb')]);router[_0x86c3('0x5')](_0x86c3('0xc'),auth['isAuthenticated'](),controller[_0x86c3('0xd')]);router['get'](_0x86c3('0xe'),auth[_0x86c3('0x6')](),controller[_0x86c3('0xf')]);router[_0x86c3('0x10')]('/',auth[_0x86c3('0x6')](),controller['create']);router[_0x86c3('0x10')]('/:id/teams',auth[_0x86c3('0x6')](),controller[_0x86c3('0x11')]);router[_0x86c3('0x10')](_0x86c3('0xe'),auth[_0x86c3('0x6')](),controller[_0x86c3('0x12')]);router[_0x86c3('0x13')](_0x86c3('0x8'),auth['isAuthenticated'](),controller[_0x86c3('0x14')]);router[_0x86c3('0x15')](_0x86c3('0x8'),auth[_0x86c3('0x6')](),controller['destroy']);router[_0x86c3('0x15')](_0x86c3('0xc'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x86c3('0x6')](),controller[_0x86c3('0x16')]);module[_0x86c3('0x17')]=router; \ No newline at end of file +var _0x0fd4=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members'];(function(_0x47a9a9,_0x302893){var _0x9f92d3=function(_0x4a56fa){while(--_0x4a56fa){_0x47a9a9['push'](_0x47a9a9['shift']());}};_0x9f92d3(++_0x302893);}(_0x0fd4,0xfd));var _0x40fd=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0x0fd4[_0x228ac9];return _0x69fe02;};'use strict';var multer=require(_0x40fd('0x0'));var util=require(_0x40fd('0x1'));var path=require(_0x40fd('0x2'));var timeout=require(_0x40fd('0x3'));var express=require(_0x40fd('0x4'));var router=express[_0x40fd('0x5')]();var fs_extra=require(_0x40fd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x40fd('0x7'));var config=require('../../config/environment');var controller=require(_0x40fd('0x8'));router[_0x40fd('0x9')]('/',auth['isAuthenticated'](),controller[_0x40fd('0xa')]);router['get'](_0x40fd('0xb'),auth[_0x40fd('0xc')](),controller[_0x40fd('0xd')]);router[_0x40fd('0x9')](_0x40fd('0xe'),auth[_0x40fd('0xc')](),controller[_0x40fd('0xf')]);router[_0x40fd('0x9')](_0x40fd('0x10'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x11')]);router[_0x40fd('0x9')](_0x40fd('0x12'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x13')]);router[_0x40fd('0x9')](_0x40fd('0x14'),auth['isAuthenticated'](),controller[_0x40fd('0x15')]);router[_0x40fd('0x16')]('/',auth[_0x40fd('0xc')](),controller[_0x40fd('0x17')]);router['post'](_0x40fd('0x12'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x18')]);router[_0x40fd('0x16')](_0x40fd('0x14'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x19')]);router['put']('/:id',auth[_0x40fd('0xc')](),controller['update']);router[_0x40fd('0x1a')](_0x40fd('0xe'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x1b')]);router['delete'](_0x40fd('0x12'),auth[_0x40fd('0xc')](),controller['removeTeams']);router['delete'](_0x40fd('0x14'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x1c')]);module[_0x40fd('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index d794c3b..330a1da 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 _0xb34a=['STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x360aef,_0x18ce3a){var _0x1fe8fd=function(_0x357ea0){while(--_0x357ea0){_0x360aef['push'](_0x360aef['shift']());}};_0x1fe8fd(++_0x18ce3a);}(_0xb34a,0xf5));var _0xab34=function(_0x225f53,_0x2d7b05){_0x225f53=_0x225f53-0x0;var _0x665a9a=_0xb34a[_0x225f53];return _0x665a9a;};'use strict';var Sequelize=require(_0xab34('0x0'));module['exports']={'name':{'type':Sequelize[_0xab34('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab34('0x1')]},'timeout':{'type':Sequelize[_0xab34('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xab34('0x3'),_0xab34('0x4'),_0xab34('0x5'))}}; \ No newline at end of file +var _0xa2c6=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa2c6,0x1a4));var _0x6a2c=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xa2c6[_0x35da42];return _0x370035;};'use strict';var Sequelize=require(_0x6a2c('0x0'));module[_0x6a2c('0x1')]={'name':{'type':Sequelize[_0x6a2c('0x2')],'unique':_0x6a2c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6a2c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6a2c('0x5'),_0x6a2c('0x6'),_0x6a2c('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index def1c57..513fb5c 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 _0xb3e7=['UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','OpenchannelQueueId','options','findAll','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','SELECT','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','get','OpenchannelQueues','UserProfileResource','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','order','where','pick','filter','merge','VIRTUAL','name','OpenchannelQueue','includeAll','catch','params','keys','fields','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xb3e7,0xd1));var _0x7b3e=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xb3e7[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require(_0x7b3e('0x0'));var rimraf=require(_0x7b3e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b3e('0x2'));var rp=require(_0x7b3e('0x3'));var moment=require(_0x7b3e('0x4'));var BPromise=require(_0x7b3e('0x5'));var Mustache=require(_0x7b3e('0x6'));var util=require(_0x7b3e('0x7'));var path=require(_0x7b3e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b3e('0x9'));var fs=require('fs');var fs_extra=require(_0x7b3e('0xa'));var _=require(_0x7b3e('0xb'));var squel=require(_0x7b3e('0xc'));var crypto=require('crypto');var jsforce=require(_0x7b3e('0xd'));var deskjs=require(_0x7b3e('0xe'));var toCsv=require(_0x7b3e('0xf'));var querystring=require('querystring');var Papa=require(_0x7b3e('0x10'));var Redis=require(_0x7b3e('0x11'));var authService=require(_0x7b3e('0x12'));var qs=require(_0x7b3e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b3e('0x14'));var logger=require(_0x7b3e('0x15'))('api');var utils=require(_0x7b3e('0x16'));var config=require(_0x7b3e('0x17'));var licenseUtil=require(_0x7b3e('0x18'));var db=require(_0x7b3e('0x19'))['db'];config[_0x7b3e('0x1a')]=_['defaults'](config[_0x7b3e('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b3e('0x1b'))(new Redis(config[_0x7b3e('0x1a')]));require('./openchannelQueue.socket')[_0x7b3e('0x1c')](socket);function respondWithStatusCode(_0x2e6293,_0x383cc7){_0x383cc7=_0x383cc7||0xcc;return function(_0xd35d0c){if(_0xd35d0c){return _0x2e6293[_0x7b3e('0x1d')](_0x383cc7);}return _0x2e6293[_0x7b3e('0x1e')](_0x383cc7)[_0x7b3e('0x1f')]();};}function respondWithResult(_0x10193e,_0x2e3870){_0x2e3870=_0x2e3870||0xc8;return function(_0x2f8272){if(_0x2f8272){return _0x10193e['status'](_0x2e3870)[_0x7b3e('0x20')](_0x2f8272);}};}function respondWithFilteredResult(_0x42f1d6,_0x5af97c){return function(_0x218636){if(_0x218636){var _0xc238eb=typeof _0x5af97c[_0x7b3e('0x21')]===_0x7b3e('0x22')&&typeof _0x5af97c['limit']===_0x7b3e('0x22');var _0x354565=_0x218636[_0x7b3e('0x23')];var _0x4eeacd=_0xc238eb?0x0:_0x5af97c[_0x7b3e('0x21')];var _0x37d5ba=_0xc238eb?_0x218636[_0x7b3e('0x23')]:_0x5af97c[_0x7b3e('0x21')]+_0x5af97c[_0x7b3e('0x24')];var _0x520fb7;if(_0x37d5ba>=_0x354565){_0x37d5ba=_0x354565;_0x520fb7=0xc8;}else{_0x520fb7=0xce;}_0x42f1d6[_0x7b3e('0x1e')](_0x520fb7);return _0x42f1d6[_0x7b3e('0x25')](_0x7b3e('0x26'),_0x4eeacd+'-'+_0x37d5ba+'/'+_0x354565)[_0x7b3e('0x20')](_0x218636);}return null;};}function patchUpdates(_0x9e45a4){return function(_0x1089b8){try{jsonpatch['apply'](_0x1089b8,_0x9e45a4,!![]);}catch(_0x431dca){return BPromise['reject'](_0x431dca);}return _0x1089b8[_0x7b3e('0x27')]();};}function saveUpdates(_0x85385d,_0x3fb3f9){return function(_0x400c81){if(_0x400c81){return _0x400c81[_0x7b3e('0x28')](_0x85385d)['then'](function(_0x4720b2){return _0x4720b2;});}return null;};}function removeEntity(_0x24765c,_0x12fea6){return function(_0x55a3fc){if(_0x55a3fc){return _0x55a3fc['destroy']()['then'](function(){var _0x38d8b9=_0x55a3fc[_0x7b3e('0x29')]({'plain':!![]});var _0x3e649c=_0x7b3e('0x2a');return db[_0x7b3e('0x2b')]['destroy']({'where':{'type':_0x3e649c,'resourceId':_0x38d8b9['id']}})[_0x7b3e('0x2c')](function(){return _0x55a3fc;});})['then'](function(){_0x24765c['status'](0xcc)[_0x7b3e('0x1f')]();});}};}function handleEntityNotFound(_0x1d81cb,_0x3ca116){return function(_0x2473e9){if(!_0x2473e9){_0x1d81cb['sendStatus'](0x194);}return _0x2473e9;};}function handleError(_0x475bbe,_0x1a82c1){_0x1a82c1=_0x1a82c1||0x1f4;return function(_0x4e3a32){logger[_0x7b3e('0x2d')](_0x4e3a32[_0x7b3e('0x2e')]);if(_0x4e3a32['name']){delete _0x4e3a32['name'];}_0x475bbe['status'](_0x1a82c1)[_0x7b3e('0x2f')](_0x4e3a32);};}exports[_0x7b3e('0x30')]=function(_0xe7e70a,_0x1acdf1){var _0x4b27ff={},_0x95b7ce={},_0x56ec92={'count':0x0,'rows':[]};var _0x24e86c=_[_0x7b3e('0x31')](db['OpenchannelQueue'][_0x7b3e('0x32')],function(_0x1dad86){return{'name':_0x1dad86[_0x7b3e('0x33')],'type':_0x1dad86[_0x7b3e('0x34')][_0x7b3e('0x35')]};});_0x95b7ce['model']=_[_0x7b3e('0x31')](_0x24e86c,'name');_0x95b7ce[_0x7b3e('0x36')]=_['keys'](_0xe7e70a[_0x7b3e('0x36')]);_0x95b7ce[_0x7b3e('0x37')]=_[_0x7b3e('0x38')](_0x95b7ce[_0x7b3e('0x39')],_0x95b7ce[_0x7b3e('0x36')]);_0x4b27ff[_0x7b3e('0x3a')]=_[_0x7b3e('0x38')](_0x95b7ce[_0x7b3e('0x39')],qs['fields'](_0xe7e70a[_0x7b3e('0x36')]['fields']));_0x4b27ff[_0x7b3e('0x3a')]=_0x4b27ff[_0x7b3e('0x3a')]['length']?_0x4b27ff[_0x7b3e('0x3a')]:_0x95b7ce['model'];if(!_0xe7e70a[_0x7b3e('0x36')]['hasOwnProperty']('nolimit')){_0x4b27ff[_0x7b3e('0x24')]=qs['limit'](_0xe7e70a[_0x7b3e('0x36')][_0x7b3e('0x24')]);_0x4b27ff['offset']=qs[_0x7b3e('0x21')](_0xe7e70a[_0x7b3e('0x36')][_0x7b3e('0x21')]);}_0x4b27ff[_0x7b3e('0x3b')]=qs['sort'](_0xe7e70a[_0x7b3e('0x36')]['sort']);_0x4b27ff[_0x7b3e('0x3c')]=qs[_0x7b3e('0x37')](_[_0x7b3e('0x3d')](_0xe7e70a[_0x7b3e('0x36')],_0x95b7ce[_0x7b3e('0x37')]),_0x24e86c);if(_0xe7e70a['query'][_0x7b3e('0x3e')]){_0x4b27ff[_0x7b3e('0x3c')]=_[_0x7b3e('0x3f')](_0x4b27ff[_0x7b3e('0x3c')],{'$or':_['map'](_0x24e86c,function(_0x166248){if(_0x166248[_0x7b3e('0x34')]!==_0x7b3e('0x40')){var _0x99fdc2={};_0x99fdc2[_0x166248[_0x7b3e('0x41')]]={'$like':'%'+_0xe7e70a[_0x7b3e('0x36')][_0x7b3e('0x3e')]+'%'};return _0x99fdc2;}})});}_0x4b27ff=_['merge']({},_0x4b27ff,_0xe7e70a['options']);var _0x443828={'where':_0x4b27ff[_0x7b3e('0x3c')]};return db[_0x7b3e('0x42')][_0x7b3e('0x23')](_0x443828)[_0x7b3e('0x2c')](function(_0x220a2e){_0x56ec92['count']=_0x220a2e;if(_0xe7e70a[_0x7b3e('0x36')][_0x7b3e('0x43')]){_0x4b27ff['include']=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x4b27ff);})[_0x7b3e('0x2c')](function(_0x5e1003){_0x56ec92['rows']=_0x5e1003;return _0x56ec92;})['then'](respondWithFilteredResult(_0x1acdf1,_0x4b27ff))[_0x7b3e('0x44')](handleError(_0x1acdf1,null));};exports['show']=function(_0x5693c4,_0x263ac2){var _0x552c00={'raw':!![],'where':{'id':_0x5693c4[_0x7b3e('0x45')]['id']}},_0x349c8c={};_0x349c8c['model']=_[_0x7b3e('0x46')](db['OpenchannelQueue']['rawAttributes']);_0x349c8c['query']=_[_0x7b3e('0x46')](_0x5693c4[_0x7b3e('0x36')]);_0x349c8c['filters']=_[_0x7b3e('0x38')](_0x349c8c[_0x7b3e('0x39')],_0x349c8c[_0x7b3e('0x36')]);_0x552c00[_0x7b3e('0x3a')]=_[_0x7b3e('0x38')](_0x349c8c[_0x7b3e('0x39')],qs[_0x7b3e('0x47')](_0x5693c4[_0x7b3e('0x36')]['fields']));_0x552c00[_0x7b3e('0x3a')]=_0x552c00[_0x7b3e('0x3a')][_0x7b3e('0x48')]?_0x552c00['attributes']:_0x349c8c[_0x7b3e('0x39')];if(_0x5693c4[_0x7b3e('0x36')][_0x7b3e('0x43')]){_0x552c00['include']=[{'all':!![]}];}_0x552c00=_[_0x7b3e('0x3f')]({},_0x552c00,_0x5693c4['options']);return db[_0x7b3e('0x42')]['find'](_0x552c00)['then'](handleEntityNotFound(_0x263ac2,null))[_0x7b3e('0x2c')](respondWithResult(_0x263ac2,null))[_0x7b3e('0x44')](handleError(_0x263ac2,null));};exports[_0x7b3e('0x49')]=function(_0x3f4780,_0x3de2d6){return db['OpenchannelQueue']['create'](_0x3f4780['body'],{})['then'](function(_0x22fbbf){var _0x421651=_0x3f4780['user']['get']({'plain':!![]});if(!_0x421651)throw new Error(_0x7b3e('0x4a'));if(_0x421651[_0x7b3e('0x4b')]===_0x7b3e('0x4c')){var _0x131cd5=_0x22fbbf[_0x7b3e('0x29')]({'plain':!![]});var _0x2e5259=_0x7b3e('0x2a');return db[_0x7b3e('0x4d')][_0x7b3e('0x4e')]({'where':{'name':_0x2e5259,'userProfileId':_0x421651[_0x7b3e('0x4f')]},'raw':!![]})[_0x7b3e('0x2c')](function(_0x3e4aea){if(_0x3e4aea&&_0x3e4aea['autoAssociation']===0x0){return db[_0x7b3e('0x2b')][_0x7b3e('0x49')]({'name':_0x131cd5[_0x7b3e('0x41')],'resourceId':_0x131cd5['id'],'type':_0x3e4aea[_0x7b3e('0x41')],'sectionId':_0x3e4aea['id']},{})['then'](function(){return _0x22fbbf;});}else{return _0x22fbbf;}})[_0x7b3e('0x44')](function(_0x12515e){logger[_0x7b3e('0x2d')](_0x7b3e('0x50'),_0x12515e);throw _0x12515e;});}return _0x22fbbf;})['then'](respondWithResult(_0x3de2d6,0xc9))[_0x7b3e('0x44')](handleError(_0x3de2d6,null));};exports[_0x7b3e('0x28')]=function(_0xde9ee3,_0x21ad52){if(_0xde9ee3['body']['id']){delete _0xde9ee3[_0x7b3e('0x51')]['id'];}return db[_0x7b3e('0x42')][_0x7b3e('0x4e')]({'where':{'id':_0xde9ee3[_0x7b3e('0x45')]['id']}})['then'](handleEntityNotFound(_0x21ad52,null))[_0x7b3e('0x2c')](saveUpdates(_0xde9ee3[_0x7b3e('0x51')],null))['then'](respondWithResult(_0x21ad52,null))['catch'](handleError(_0x21ad52,null));};exports[_0x7b3e('0x52')]=function(_0x292e2d,_0x56cadf){return db['OpenchannelQueue'][_0x7b3e('0x4e')]({'where':{'id':_0x292e2d['params']['id']}})[_0x7b3e('0x2c')](handleEntityNotFound(_0x56cadf,null))['then'](removeEntity(_0x56cadf,null))[_0x7b3e('0x44')](handleError(_0x56cadf,null));};exports[_0x7b3e('0x53')]=function(_0x16b678,_0x2f8bb8){return db[_0x7b3e('0x42')][_0x7b3e('0x53')]()[_0x7b3e('0x2c')](respondWithResult(_0x2f8bb8,null))[_0x7b3e('0x44')](handleError(_0x2f8bb8,null));};exports[_0x7b3e('0x54')]=function(_0x55c0b5,_0x205715,_0xab6ce6){var _0x2e6ed4={'raw':!![],'where':{}},_0x31ebc3={},_0x2a3f5d;return db[_0x7b3e('0x42')][_0x7b3e('0x55')]({'where':{'id':_0x55c0b5['params']['id']}})[_0x7b3e('0x2c')](handleEntityNotFound(_0x205715,null))[_0x7b3e('0x2c')](function(_0x17296a){if(_0x17296a){_0x2a3f5d=_0x17296a[_0x7b3e('0x29')]({'plain':!![]});_0x31ebc3[_0x7b3e('0x39')]=_[_0x7b3e('0x46')](db[_0x7b3e('0x56')][_0x7b3e('0x32')]);_0x31ebc3[_0x7b3e('0x36')]=_[_0x7b3e('0x46')](_0x55c0b5[_0x7b3e('0x36')]);_0x31ebc3[_0x7b3e('0x37')]=_[_0x7b3e('0x38')](_0x31ebc3['model'],_0x31ebc3[_0x7b3e('0x36')]);_0x2e6ed4[_0x7b3e('0x3a')]=_[_0x7b3e('0x38')](_0x31ebc3[_0x7b3e('0x39')],qs[_0x7b3e('0x47')](_0x55c0b5[_0x7b3e('0x36')][_0x7b3e('0x47')]));_0x2e6ed4['attributes']=_0x2e6ed4['attributes'][_0x7b3e('0x48')]?_0x2e6ed4['attributes']:_0x31ebc3[_0x7b3e('0x39')];if(!_0x55c0b5['query'][_0x7b3e('0x57')](_0x7b3e('0x58'))){_0x2e6ed4[_0x7b3e('0x24')]=qs[_0x7b3e('0x24')](_0x55c0b5[_0x7b3e('0x36')][_0x7b3e('0x24')]);_0x2e6ed4['offset']=qs[_0x7b3e('0x21')](_0x55c0b5['query'][_0x7b3e('0x21')]);}_0x2e6ed4[_0x7b3e('0x3b')]=qs[_0x7b3e('0x59')](_0x55c0b5[_0x7b3e('0x36')][_0x7b3e('0x59')]);_0x2e6ed4[_0x7b3e('0x3c')]=qs[_0x7b3e('0x37')](_['pick'](_0x55c0b5['query'],_0x31ebc3[_0x7b3e('0x37')]));_0x2e6ed4[_0x7b3e('0x3c')][_0x7b3e('0x5a')]=_0x17296a['id'];if(_0x55c0b5[_0x7b3e('0x36')][_0x7b3e('0x3e')]){_0x2e6ed4[_0x7b3e('0x3c')]=_[_0x7b3e('0x3f')](_0x2e6ed4['where'],{'$or':_['map'](_0x2e6ed4['attributes'],function(_0x4d35f){var _0x411069={};_0x411069[_0x4d35f]={'$like':'%'+_0x55c0b5[_0x7b3e('0x36')][_0x7b3e('0x3e')]+'%'};return _0x411069;})});}_0x2e6ed4=_[_0x7b3e('0x3f')]({},_0x2e6ed4,_0x55c0b5[_0x7b3e('0x5b')]);return db[_0x7b3e('0x56')][_0x7b3e('0x5c')](_0x2e6ed4);}})['then'](function(_0x2491af){if(_0x2491af){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x2491af,_0x7b3e('0x5d')),'role':_0x7b3e('0x5e')},'attributes':['id',_0x7b3e('0x41'),_0x7b3e('0x5f'),_0x7b3e('0x60'),'createdAt']});}})['then'](function(_0x30403f){if(_0x30403f){return{'count':_0x30403f[_0x7b3e('0x23')],'rows':_['map'](_0x30403f['rows'],function(_0x332d90){return{'membername':_0x332d90[_0x7b3e('0x41')],'UserId':_0x332d90['id'],'queue_name':_0x2a3f5d['name'],'OpenchannelQueueId':_0x2a3f5d['id'],'interface':util[_0x7b3e('0x61')](_0x7b3e('0x62'),_0x7b3e('0x63'),_0x332d90[_0x7b3e('0x41')]),'penalty':0x0,'paused':_0x332d90[_0x7b3e('0x5f')],'createdAt':_0x332d90[_0x7b3e('0x64')],'updatedAt':_0x332d90[_0x7b3e('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7b3e('0x2c')](respondWithFilteredResult(_0x205715,_0x2e6ed4))[_0x7b3e('0x44')](handleError(_0x205715,null));};exports['getTeams']=function(_0x24ec54,_0x3487e7,_0x117bb0){var _0x2a3c5a={};var _0x4d0f08={};var _0x488a38;var _0x8289e5;return db[_0x7b3e('0x42')][_0x7b3e('0x55')]({'where':{'id':_0x24ec54['params']['id']}})[_0x7b3e('0x2c')](handleEntityNotFound(_0x3487e7,null))[_0x7b3e('0x2c')](function(_0x451af8){if(_0x451af8){_0x488a38=_0x451af8;_0x4d0f08[_0x7b3e('0x39')]=_[_0x7b3e('0x46')](db['Team'][_0x7b3e('0x32')]);_0x4d0f08[_0x7b3e('0x36')]=_[_0x7b3e('0x46')](_0x24ec54[_0x7b3e('0x36')]);_0x4d0f08[_0x7b3e('0x37')]=_[_0x7b3e('0x38')](_0x4d0f08['model'],_0x4d0f08['query']);_0x2a3c5a[_0x7b3e('0x3a')]=_['intersection'](_0x4d0f08[_0x7b3e('0x39')],qs['fields'](_0x24ec54[_0x7b3e('0x36')][_0x7b3e('0x47')]));_0x2a3c5a[_0x7b3e('0x3a')]=_0x2a3c5a[_0x7b3e('0x3a')][_0x7b3e('0x48')]?_0x2a3c5a[_0x7b3e('0x3a')]:_0x4d0f08[_0x7b3e('0x39')];_0x2a3c5a['order']=qs[_0x7b3e('0x59')](_0x24ec54[_0x7b3e('0x36')][_0x7b3e('0x59')]);_0x2a3c5a[_0x7b3e('0x3c')]=qs[_0x7b3e('0x37')](_[_0x7b3e('0x3d')](_0x24ec54['query'],_0x4d0f08[_0x7b3e('0x37')]));if(_0x24ec54[_0x7b3e('0x36')][_0x7b3e('0x3e')]){_0x2a3c5a[_0x7b3e('0x3c')]=_[_0x7b3e('0x3f')](_0x2a3c5a[_0x7b3e('0x3c')],{'$or':_[_0x7b3e('0x31')](_0x2a3c5a[_0x7b3e('0x3a')],function(_0x53196d){var _0x1c1360={};_0x1c1360[_0x53196d]={'$like':'%'+_0x24ec54['query'][_0x7b3e('0x3e')]+'%'};return _0x1c1360;})});}_0x2a3c5a=_[_0x7b3e('0x3f')]({},_0x2a3c5a,_0x24ec54[_0x7b3e('0x5b')]);return _0x488a38['getTeams'](_0x2a3c5a);}})['then'](function(_0x5a585a){if(_0x5a585a){_0x8289e5=_0x5a585a[_0x7b3e('0x48')];if(!_0x24ec54[_0x7b3e('0x36')]['hasOwnProperty'](_0x7b3e('0x58'))){_0x2a3c5a[_0x7b3e('0x24')]=qs[_0x7b3e('0x24')](_0x24ec54['query'][_0x7b3e('0x24')]);_0x2a3c5a[_0x7b3e('0x21')]=qs[_0x7b3e('0x21')](_0x24ec54[_0x7b3e('0x36')][_0x7b3e('0x21')]);}return _0x488a38[_0x7b3e('0x65')](_0x2a3c5a);}})[_0x7b3e('0x2c')](function(_0x5b3950){if(_0x5b3950){return _0x5b3950?{'count':_0x8289e5,'rows':_0x5b3950}:null;}})['then'](respondWithResult(_0x3487e7,null))[_0x7b3e('0x44')](handleError(_0x3487e7,null));};exports[_0x7b3e('0x66')]=function(_0xe7804a,_0x42c4da,_0x596e58){var _0x393d43=_0xe7804a[_0x7b3e('0x51')][_0x7b3e('0x67')];return db[_0x7b3e('0x68')][_0x7b3e('0x5c')]({'where':{'id':_0x393d43},'attributes':['id'],'include':[{'model':db[_0x7b3e('0x69')],'as':_0x7b3e('0x6a'),'attributes':['id',_0x7b3e('0x41'),_0x7b3e('0x6b'),_0x7b3e('0x6c'),_0x7b3e('0x6d')],'raw':!![]}]})[_0x7b3e('0x2c')](function(_0x41abf1){if(_0x41abf1){var _0x99bf6e=_[_0x7b3e('0x6e')](_0x41abf1,function(_0x13a8fd){var _0x2566f7=_0x13a8fd[_0x7b3e('0x29')]({'plain':!![]});return _0x2566f7[_0x7b3e('0x6a')];});return db[_0x7b3e('0x42')]['find']({'where':{'id':_0xe7804a[_0x7b3e('0x45')]['id']}})[_0x7b3e('0x2c')](function(_0x2c0a53){return db['sequelize']['transaction'](function(_0x24e4ad){return _0x2c0a53['addTeams'](_0x393d43,{'transaction':_0x24e4ad})[_0x7b3e('0x2c')](function(){return BPromise['each'](_0x99bf6e,function(_0x224ab8){return db[_0x7b3e('0x56')][_0x7b3e('0x6f')]({'where':{'UserId':_0x224ab8['id'],'OpenchannelQueueId':_0xe7804a[_0x7b3e('0x45')]['id']},'transaction':_0x24e4ad});});})[_0x7b3e('0x2c')](function(){_0x99bf6e[_0x7b3e('0x70')](function(_0x2524c7){socket[_0x7b3e('0x71')](_0x7b3e('0x72'),{'UserId':_0x2524c7['id'],'OpenchannelQueueId':_0x2c0a53['id']});});});});});}})[_0x7b3e('0x2c')](respondWithStatusCode(_0x42c4da,null))[_0x7b3e('0x44')](handleError(_0x42c4da,null));};exports[_0x7b3e('0x73')]=function(_0x4cbedd,_0x24d990,_0x3b5a1b){return db[_0x7b3e('0x68')][_0x7b3e('0x5c')]({'where':{'id':_0x4cbedd['query'][_0x7b3e('0x67')]},'attributes':['id'],'include':[{'model':db[_0x7b3e('0x69')],'as':_0x7b3e('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x7b3e('0x2c')](handleEntityNotFound(_0x24d990,null))[_0x7b3e('0x2c')](function(_0x2f9797){var _0x578340=_['map'](_0x2f9797,'id');var _0x5c4613=[];var _0x1d2ea=[];var _0x14b445=squel[_0x7b3e('0x74')]();_0x14b445[_0x7b3e('0x75')](_0x7b3e('0x76'))[_0x7b3e('0x77')]('team_has_openchannel_queues','tq')[_0x7b3e('0x78')](_0x7b3e('0x79'),'ut',_0x7b3e('0x7a'))[_0x7b3e('0x3c')]('OpenchannelQueueId\x20=\x20?',_0x4cbedd['params']['id']);for(var _0x1f3018=0x0;_0x1f3018<_0x2f9797['length'];_0x1f3018+=0x1){let _0x282102=_0x2f9797[_0x1f3018];for(var _0x9720ac=0x0;_0x9720ac<_0x282102[_0x7b3e('0x6a')][_0x7b3e('0x48')];_0x9720ac+=0x1){let _0x3858e6=_0x282102[_0x7b3e('0x6a')][_0x9720ac];var _0x3574a2=_0x14b445[_0x7b3e('0x7b')]();_0x3574a2[_0x7b3e('0x3c')]('ut.UserId\x20=\x20?',_0x3858e6['id']);_0x1d2ea[_0x7b3e('0x7c')](db[_0x7b3e('0x7d')]['query'](_0x3574a2[_0x7b3e('0x7e')](),{'type':db[_0x7b3e('0x7d')]['QueryTypes'][_0x7b3e('0x7f')]})[_0x7b3e('0x2c')](function(_0x399363){if(_0x399363['length']===0x1){return _0x3858e6['id'];}else{var _0x1baaf5=_['every'](_['map'](_0x399363,_0x7b3e('0x80')),function(_0x3b2d8d){return _[_0x7b3e('0x81')](_0x578340,_0x3b2d8d);});if(_0x1baaf5){return _0x3858e6['id'];}}}));}}return BPromise[_0x7b3e('0x82')](_0x1d2ea)[_0x7b3e('0x2c')](function(_0x1b17d3){_0x5c4613=_(_0x5c4613)[_0x7b3e('0x83')](_0x1b17d3)[_0x7b3e('0x84')]()[_0x7b3e('0x85')]();return db[_0x7b3e('0x42')][_0x7b3e('0x4e')]({'where':{'id':_0x4cbedd[_0x7b3e('0x45')]['id']}})[_0x7b3e('0x2c')](function(_0x26d6e2){return db['sequelize'][_0x7b3e('0x86')](function(_0x54c7aa){return _0x26d6e2['removeTeams'](_0x4cbedd[_0x7b3e('0x36')][_0x7b3e('0x67')],{'transaction':_0x54c7aa})[_0x7b3e('0x2c')](function(){if(!_[_0x7b3e('0x87')](_0x5c4613)){return _0x26d6e2[_0x7b3e('0x88')](_0x5c4613,{'transaction':_0x54c7aa});}})[_0x7b3e('0x2c')](function(){_0x5c4613[_0x7b3e('0x70')](function(_0x51b6ad){socket[_0x7b3e('0x71')](_0x7b3e('0x89'),{'UserId':_0x51b6ad,'OpenchannelQueueId':_0x26d6e2['id']});});});});});});})['then'](respondWithStatusCode(_0x24d990,null))['catch'](handleError(_0x24d990,null));};exports[_0x7b3e('0x8a')]=function(_0x3058b,_0x19ee44,_0x187d59){return db[_0x7b3e('0x42')]['find']({'where':{'id':_0x3058b[_0x7b3e('0x45')]['id']}})['then'](handleEntityNotFound(_0x19ee44,null))[_0x7b3e('0x2c')](function(_0x267c2a){if(_0x267c2a){return _0x267c2a['addAgents'](_0x3058b[_0x7b3e('0x51')][_0x7b3e('0x67')],_[_0x7b3e('0x8b')](_0x3058b[_0x7b3e('0x51')],[_0x7b3e('0x67'),'id'])||{})[_0x7b3e('0x8c')](function(_0x595e73){for(var _0x30abfb=0x0;_0x30abfb<_0x3058b[_0x7b3e('0x51')]['ids'][_0x7b3e('0x48')];_0x30abfb+=0x1){socket[_0x7b3e('0x71')](_0x7b3e('0x72'),{'UserId':Number(_0x3058b['body'][_0x7b3e('0x67')][_0x30abfb]),'OpenchannelQueueId':Number(_0x3058b['params']['id'])});}return _0x595e73;});}})[_0x7b3e('0x2c')](respondWithResult(_0x19ee44,null))[_0x7b3e('0x44')](handleError(_0x19ee44,null));};exports[_0x7b3e('0x88')]=function(_0x4edef3,_0x7b81a6,_0x5d59f5){return db[_0x7b3e('0x42')][_0x7b3e('0x4e')]({'where':{'id':_0x4edef3[_0x7b3e('0x45')]['id']}})[_0x7b3e('0x2c')](handleEntityNotFound(_0x7b81a6,null))['then'](function(_0x3fd7d6){if(_0x3fd7d6){return _0x3fd7d6['removeAgents'](_0x4edef3[_0x7b3e('0x36')][_0x7b3e('0x67')])['then'](function(){if(_[_0x7b3e('0x8d')](_0x4edef3[_0x7b3e('0x36')][_0x7b3e('0x67')])){for(var _0xdd4afe=0x0;_0xdd4afe<_0x4edef3[_0x7b3e('0x36')][_0x7b3e('0x67')][_0x7b3e('0x48')];_0xdd4afe+=0x1){socket[_0x7b3e('0x71')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4edef3[_0x7b3e('0x36')]['ids'][_0xdd4afe]),'OpenchannelQueueId':Number(_0x4edef3[_0x7b3e('0x45')]['id'])});}}else{socket[_0x7b3e('0x71')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4edef3[_0x7b3e('0x36')][_0x7b3e('0x67')]),'OpenchannelQueueId':Number(_0x4edef3['params']['id'])});}});}})[_0x7b3e('0x2c')](respondWithStatusCode(_0x7b81a6,null))[_0x7b3e('0x44')](handleError(_0x7b81a6,null));};exports[_0x7b3e('0x8e')]=function(_0x40f970,_0x3bb740,_0x423a0c){var _0x7c0715={};var _0x482714={};var _0x235c64;var _0x49c5b5;return db[_0x7b3e('0x42')][_0x7b3e('0x55')]({'where':{'id':_0x40f970[_0x7b3e('0x45')]['id']}})[_0x7b3e('0x2c')](handleEntityNotFound(_0x3bb740,null))[_0x7b3e('0x2c')](function(_0xe58e50){if(_0xe58e50){_0x235c64=_0xe58e50;_0x482714[_0x7b3e('0x39')]=_[_0x7b3e('0x46')](db[_0x7b3e('0x69')][_0x7b3e('0x32')]);_0x482714[_0x7b3e('0x36')]=_[_0x7b3e('0x46')](_0x40f970[_0x7b3e('0x36')]);_0x482714['filters']=_[_0x7b3e('0x38')](_0x482714[_0x7b3e('0x39')],_0x482714[_0x7b3e('0x36')]);_0x7c0715['attributes']=_[_0x7b3e('0x38')](_0x482714[_0x7b3e('0x39')],qs['fields'](_0x40f970['query'][_0x7b3e('0x47')]));_0x7c0715[_0x7b3e('0x3a')]=_0x7c0715[_0x7b3e('0x3a')][_0x7b3e('0x48')]?_0x7c0715[_0x7b3e('0x3a')]:_0x482714[_0x7b3e('0x39')];_0x7c0715[_0x7b3e('0x3b')]=qs['sort'](_0x40f970['query'][_0x7b3e('0x59')]);_0x7c0715[_0x7b3e('0x3c')]=qs[_0x7b3e('0x37')](_[_0x7b3e('0x3d')](_0x40f970[_0x7b3e('0x36')],_0x482714[_0x7b3e('0x37')]));if(_0x40f970[_0x7b3e('0x36')][_0x7b3e('0x3e')]){_0x7c0715['where']=_[_0x7b3e('0x3f')](_0x7c0715[_0x7b3e('0x3c')],{'$or':_[_0x7b3e('0x31')](_0x7c0715[_0x7b3e('0x3a')],function(_0x18cc85){var _0x3106e3={};_0x3106e3[_0x18cc85]={'$like':'%'+_0x40f970['query']['filter']+'%'};return _0x3106e3;})});}_0x7c0715=_[_0x7b3e('0x3f')]({},_0x7c0715,_0x40f970[_0x7b3e('0x5b')]);return _0x235c64[_0x7b3e('0x8e')](_0x7c0715);}})[_0x7b3e('0x2c')](function(_0x33d717){if(_0x33d717){_0x49c5b5=_0x33d717[_0x7b3e('0x48')];if(!_0x40f970[_0x7b3e('0x36')][_0x7b3e('0x57')]('nolimit')){_0x7c0715[_0x7b3e('0x24')]=qs[_0x7b3e('0x24')](_0x40f970[_0x7b3e('0x36')][_0x7b3e('0x24')]);_0x7c0715[_0x7b3e('0x21')]=qs[_0x7b3e('0x21')](_0x40f970['query'][_0x7b3e('0x21')]);}return _0x235c64['getAgents'](_0x7c0715);}})['then'](function(_0x206135){if(_0x206135){return _0x206135?{'count':_0x49c5b5,'rows':_0x206135}:null;}})['then'](respondWithResult(_0x3bb740,null))[_0x7b3e('0x44')](handleError(_0x3bb740,null));}; \ No newline at end of file +var _0x2f6d=['UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','hasOwnProperty','sort','pick','OpenchannelQueueId','findAndCountAll','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','User','interface','Agents','sequelize','transaction','each','findOrCreate','emit','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','OpenchannelQueues','error','name','send','index','map','OpenchannelQueue','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x57b3df,_0x445081){var _0x206656=function(_0x16aeb3){while(--_0x16aeb3){_0x57b3df['push'](_0x57b3df['shift']());}};_0x206656(++_0x445081);}(_0x2f6d,0xd3));var _0xd2f6=function(_0x340332,_0x5f02ac){_0x340332=_0x340332-0x0;var _0x4334fc=_0x2f6d[_0x340332];return _0x4334fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2f6('0x0'));var zipdir=require(_0xd2f6('0x1'));var jsonpatch=require(_0xd2f6('0x2'));var rp=require(_0xd2f6('0x3'));var moment=require(_0xd2f6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd2f6('0x5'));var path=require(_0xd2f6('0x6'));var sox=require(_0xd2f6('0x7'));var csv=require(_0xd2f6('0x8'));var ejs=require(_0xd2f6('0x9'));var fs=require('fs');var fs_extra=require(_0xd2f6('0xa'));var _=require('lodash');var squel=require(_0xd2f6('0xb'));var crypto=require(_0xd2f6('0xc'));var jsforce=require(_0xd2f6('0xd'));var deskjs=require(_0xd2f6('0xe'));var toCsv=require(_0xd2f6('0x8'));var querystring=require(_0xd2f6('0xf'));var Papa=require('papaparse');var Redis=require(_0xd2f6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd2f6('0x11'));var as=require(_0xd2f6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2f6('0x13'))(_0xd2f6('0x14'));var utils=require('../../config/utils');var config=require(_0xd2f6('0x15'));var licenseUtil=require(_0xd2f6('0x16'));var db=require(_0xd2f6('0x17'))['db'];config[_0xd2f6('0x18')]=_[_0xd2f6('0x19')](config[_0xd2f6('0x18')],{'host':_0xd2f6('0x1a'),'port':0x18eb});var socket=require(_0xd2f6('0x1b'))(new Redis(config['redis']));require(_0xd2f6('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d7a16,_0x27b4a9){_0x27b4a9=_0x27b4a9||0xcc;return function(_0x5d7d16){if(_0x5d7d16){return _0x5d7a16[_0xd2f6('0x1d')](_0x27b4a9);}return _0x5d7a16[_0xd2f6('0x1e')](_0x27b4a9)[_0xd2f6('0x1f')]();};}function respondWithResult(_0x2b6838,_0x2e4330){_0x2e4330=_0x2e4330||0xc8;return function(_0x16cbb4){if(_0x16cbb4){return _0x2b6838['status'](_0x2e4330)[_0xd2f6('0x20')](_0x16cbb4);}};}function respondWithFilteredResult(_0x4efcf5,_0x59fe15){return function(_0xdf7d0a){if(_0xdf7d0a){var _0x3010d0=typeof _0x59fe15[_0xd2f6('0x21')]===_0xd2f6('0x22')&&typeof _0x59fe15[_0xd2f6('0x23')]===_0xd2f6('0x22');var _0x396ef5=_0xdf7d0a[_0xd2f6('0x24')];var _0x47219c=_0x3010d0?0x0:_0x59fe15['offset'];var _0x52d6d5=_0x3010d0?_0xdf7d0a[_0xd2f6('0x24')]:_0x59fe15['offset']+_0x59fe15['limit'];var _0x351d9a;if(_0x52d6d5>=_0x396ef5){_0x52d6d5=_0x396ef5;_0x351d9a=0xc8;}else{_0x351d9a=0xce;}_0x4efcf5[_0xd2f6('0x1e')](_0x351d9a);return _0x4efcf5[_0xd2f6('0x25')](_0xd2f6('0x26'),_0x47219c+'-'+_0x52d6d5+'/'+_0x396ef5)[_0xd2f6('0x20')](_0xdf7d0a);}return null;};}function patchUpdates(_0x440de0){return function(_0x119d22){try{jsonpatch[_0xd2f6('0x27')](_0x119d22,_0x440de0,!![]);}catch(_0x2917a3){return BPromise[_0xd2f6('0x28')](_0x2917a3);}return _0x119d22[_0xd2f6('0x29')]();};}function saveUpdates(_0x32b86f,_0xa9a267){return function(_0x20a132){if(_0x20a132){return _0x20a132[_0xd2f6('0x2a')](_0x32b86f)['then'](function(_0x54280a){return _0x54280a;});}return null;};}function removeEntity(_0x1d5d4d,_0x289e9a){return function(_0x177281){if(_0x177281){return _0x177281[_0xd2f6('0x2b')]()[_0xd2f6('0x2c')](function(){var _0x4ed1d9=_0x177281[_0xd2f6('0x2d')]({'plain':!![]});var _0x239537=_0xd2f6('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x239537,'resourceId':_0x4ed1d9['id']}})[_0xd2f6('0x2c')](function(){return _0x177281;});})[_0xd2f6('0x2c')](function(){_0x1d5d4d[_0xd2f6('0x1e')](0xcc)[_0xd2f6('0x1f')]();});}};}function handleEntityNotFound(_0x22c356,_0x1fd87a){return function(_0x5b81b4){if(!_0x5b81b4){_0x22c356['sendStatus'](0x194);}return _0x5b81b4;};}function handleError(_0x36a504,_0x3104d2){_0x3104d2=_0x3104d2||0x1f4;return function(_0x4ba66f){logger[_0xd2f6('0x2f')](_0x4ba66f['stack']);if(_0x4ba66f[_0xd2f6('0x30')]){delete _0x4ba66f[_0xd2f6('0x30')];}_0x36a504['status'](_0x3104d2)[_0xd2f6('0x31')](_0x4ba66f);};}exports[_0xd2f6('0x32')]=function(_0x4cd36b,_0x2d6b88){var _0x110554={},_0x31943d={},_0x4aaf6d={'count':0x0,'rows':[]};var _0x20d557=_[_0xd2f6('0x33')](db[_0xd2f6('0x34')]['rawAttributes'],function(_0xaecc2b){return{'name':_0xaecc2b[_0xd2f6('0x35')],'type':_0xaecc2b['type'][_0xd2f6('0x36')]};});_0x31943d['model']=_[_0xd2f6('0x33')](_0x20d557,_0xd2f6('0x30'));_0x31943d[_0xd2f6('0x37')]=_[_0xd2f6('0x38')](_0x4cd36b[_0xd2f6('0x37')]);_0x31943d[_0xd2f6('0x39')]=_[_0xd2f6('0x3a')](_0x31943d['model'],_0x31943d[_0xd2f6('0x37')]);_0x110554[_0xd2f6('0x3b')]=_[_0xd2f6('0x3a')](_0x31943d[_0xd2f6('0x3c')],qs[_0xd2f6('0x3d')](_0x4cd36b[_0xd2f6('0x37')][_0xd2f6('0x3d')]));_0x110554[_0xd2f6('0x3b')]=_0x110554[_0xd2f6('0x3b')][_0xd2f6('0x3e')]?_0x110554[_0xd2f6('0x3b')]:_0x31943d[_0xd2f6('0x3c')];if(!_0x4cd36b[_0xd2f6('0x37')]['hasOwnProperty'](_0xd2f6('0x3f'))){_0x110554[_0xd2f6('0x23')]=qs[_0xd2f6('0x23')](_0x4cd36b[_0xd2f6('0x37')][_0xd2f6('0x23')]);_0x110554[_0xd2f6('0x21')]=qs[_0xd2f6('0x21')](_0x4cd36b[_0xd2f6('0x37')][_0xd2f6('0x21')]);}_0x110554[_0xd2f6('0x40')]=qs['sort'](_0x4cd36b[_0xd2f6('0x37')]['sort']);_0x110554[_0xd2f6('0x41')]=qs[_0xd2f6('0x39')](_['pick'](_0x4cd36b[_0xd2f6('0x37')],_0x31943d[_0xd2f6('0x39')]),_0x20d557);if(_0x4cd36b['query'][_0xd2f6('0x42')]){_0x110554[_0xd2f6('0x41')]=_['merge'](_0x110554[_0xd2f6('0x41')],{'$or':_[_0xd2f6('0x33')](_0x20d557,function(_0x46246d){if(_0x46246d[_0xd2f6('0x43')]!==_0xd2f6('0x44')){var _0x125ec6={};_0x125ec6[_0x46246d[_0xd2f6('0x30')]]={'$like':'%'+_0x4cd36b[_0xd2f6('0x37')][_0xd2f6('0x42')]+'%'};return _0x125ec6;}})});}_0x110554=_['merge']({},_0x110554,_0x4cd36b[_0xd2f6('0x45')]);var _0x532114={'where':_0x110554[_0xd2f6('0x41')]};return db[_0xd2f6('0x34')][_0xd2f6('0x24')](_0x532114)[_0xd2f6('0x2c')](function(_0x24d80a){_0x4aaf6d[_0xd2f6('0x24')]=_0x24d80a;if(_0x4cd36b[_0xd2f6('0x37')][_0xd2f6('0x46')]){_0x110554[_0xd2f6('0x47')]=[{'all':!![]}];}return db[_0xd2f6('0x34')][_0xd2f6('0x48')](_0x110554);})[_0xd2f6('0x2c')](function(_0x595d84){_0x4aaf6d[_0xd2f6('0x49')]=_0x595d84;return _0x4aaf6d;})[_0xd2f6('0x2c')](respondWithFilteredResult(_0x2d6b88,_0x110554))['catch'](handleError(_0x2d6b88,null));};exports[_0xd2f6('0x4a')]=function(_0x33c430,_0x55e3ed){var _0x34444a={'raw':!![],'where':{'id':_0x33c430[_0xd2f6('0x4b')]['id']}},_0xfc17a9={};_0xfc17a9[_0xd2f6('0x3c')]=_[_0xd2f6('0x38')](db[_0xd2f6('0x34')]['rawAttributes']);_0xfc17a9[_0xd2f6('0x37')]=_['keys'](_0x33c430[_0xd2f6('0x37')]);_0xfc17a9[_0xd2f6('0x39')]=_[_0xd2f6('0x3a')](_0xfc17a9[_0xd2f6('0x3c')],_0xfc17a9[_0xd2f6('0x37')]);_0x34444a[_0xd2f6('0x3b')]=_[_0xd2f6('0x3a')](_0xfc17a9[_0xd2f6('0x3c')],qs[_0xd2f6('0x3d')](_0x33c430[_0xd2f6('0x37')][_0xd2f6('0x3d')]));_0x34444a[_0xd2f6('0x3b')]=_0x34444a['attributes']['length']?_0x34444a[_0xd2f6('0x3b')]:_0xfc17a9['model'];if(_0x33c430[_0xd2f6('0x37')][_0xd2f6('0x46')]){_0x34444a[_0xd2f6('0x47')]=[{'all':!![]}];}_0x34444a=_[_0xd2f6('0x4c')]({},_0x34444a,_0x33c430[_0xd2f6('0x45')]);return db[_0xd2f6('0x34')][_0xd2f6('0x4d')](_0x34444a)['then'](handleEntityNotFound(_0x55e3ed,null))[_0xd2f6('0x2c')](respondWithResult(_0x55e3ed,null))['catch'](handleError(_0x55e3ed,null));};exports[_0xd2f6('0x4e')]=function(_0x410032,_0x5d66eb){return db[_0xd2f6('0x34')][_0xd2f6('0x4e')](_0x410032[_0xd2f6('0x4f')],{})[_0xd2f6('0x2c')](function(_0x3eeef5){var _0x21fcc9=_0x410032[_0xd2f6('0x50')][_0xd2f6('0x2d')]({'plain':!![]});if(!_0x21fcc9)throw new Error(_0xd2f6('0x51'));if(_0x21fcc9[_0xd2f6('0x52')]===_0xd2f6('0x50')){var _0x4d83e4=_0x3eeef5[_0xd2f6('0x2d')]({'plain':!![]});var _0x2fa235='OpenchannelQueues';return db[_0xd2f6('0x53')][_0xd2f6('0x4d')]({'where':{'name':_0x2fa235,'userProfileId':_0x21fcc9[_0xd2f6('0x54')]},'raw':!![]})['then'](function(_0xed4ebb){if(_0xed4ebb&&_0xed4ebb[_0xd2f6('0x55')]===0x0){return db[_0xd2f6('0x56')][_0xd2f6('0x4e')]({'name':_0x4d83e4[_0xd2f6('0x30')],'resourceId':_0x4d83e4['id'],'type':_0xed4ebb['name'],'sectionId':_0xed4ebb['id']},{})[_0xd2f6('0x2c')](function(){return _0x3eeef5;});}else{return _0x3eeef5;}})[_0xd2f6('0x57')](function(_0x4a4ea3){logger[_0xd2f6('0x2f')](_0xd2f6('0x58'),_0x4a4ea3);throw _0x4a4ea3;});}return _0x3eeef5;})[_0xd2f6('0x2c')](respondWithResult(_0x5d66eb,0xc9))[_0xd2f6('0x57')](handleError(_0x5d66eb,null));};exports[_0xd2f6('0x2a')]=function(_0x2b5656,_0x49d613){if(_0x2b5656['body']['id']){delete _0x2b5656[_0xd2f6('0x4f')]['id'];}return db['OpenchannelQueue'][_0xd2f6('0x4d')]({'where':{'id':_0x2b5656[_0xd2f6('0x4b')]['id']}})[_0xd2f6('0x2c')](handleEntityNotFound(_0x49d613,null))[_0xd2f6('0x2c')](saveUpdates(_0x2b5656[_0xd2f6('0x4f')],null))['then'](respondWithResult(_0x49d613,null))[_0xd2f6('0x57')](handleError(_0x49d613,null));};exports['destroy']=function(_0xd5fedf,_0x4f1525){return db[_0xd2f6('0x34')][_0xd2f6('0x4d')]({'where':{'id':_0xd5fedf['params']['id']}})['then'](handleEntityNotFound(_0x4f1525,null))[_0xd2f6('0x2c')](removeEntity(_0x4f1525,null))['catch'](handleError(_0x4f1525,null));};exports[_0xd2f6('0x59')]=function(_0x48f871,_0x251773){return db['OpenchannelQueue'][_0xd2f6('0x59')]()[_0xd2f6('0x2c')](respondWithResult(_0x251773,null))[_0xd2f6('0x57')](handleError(_0x251773,null));};exports[_0xd2f6('0x5a')]=function(_0x1955e2,_0x1282a9,_0x5382ed){var _0x20b7cb={'raw':!![],'where':{}},_0x4c0574={},_0x301a86;return db[_0xd2f6('0x34')][_0xd2f6('0x5b')]({'where':{'id':_0x1955e2[_0xd2f6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1282a9,null))[_0xd2f6('0x2c')](function(_0x4ab836){if(_0x4ab836){_0x301a86=_0x4ab836[_0xd2f6('0x2d')]({'plain':!![]});_0x4c0574[_0xd2f6('0x3c')]=_[_0xd2f6('0x38')](db[_0xd2f6('0x5c')][_0xd2f6('0x5d')]);_0x4c0574['query']=_[_0xd2f6('0x38')](_0x1955e2['query']);_0x4c0574['filters']=_[_0xd2f6('0x3a')](_0x4c0574[_0xd2f6('0x3c')],_0x4c0574[_0xd2f6('0x37')]);_0x20b7cb[_0xd2f6('0x3b')]=_[_0xd2f6('0x3a')](_0x4c0574[_0xd2f6('0x3c')],qs[_0xd2f6('0x3d')](_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x3d')]));_0x20b7cb[_0xd2f6('0x3b')]=_0x20b7cb[_0xd2f6('0x3b')][_0xd2f6('0x3e')]?_0x20b7cb[_0xd2f6('0x3b')]:_0x4c0574[_0xd2f6('0x3c')];if(!_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x5e')](_0xd2f6('0x3f'))){_0x20b7cb[_0xd2f6('0x23')]=qs[_0xd2f6('0x23')](_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x23')]);_0x20b7cb[_0xd2f6('0x21')]=qs[_0xd2f6('0x21')](_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x21')]);}_0x20b7cb[_0xd2f6('0x40')]=qs[_0xd2f6('0x5f')](_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x5f')]);_0x20b7cb[_0xd2f6('0x41')]=qs[_0xd2f6('0x39')](_[_0xd2f6('0x60')](_0x1955e2[_0xd2f6('0x37')],_0x4c0574[_0xd2f6('0x39')]));_0x20b7cb['where'][_0xd2f6('0x61')]=_0x4ab836['id'];if(_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x42')]){_0x20b7cb[_0xd2f6('0x41')]=_['merge'](_0x20b7cb[_0xd2f6('0x41')],{'$or':_[_0xd2f6('0x33')](_0x20b7cb['attributes'],function(_0x808200){var _0x2fe61a={};_0x2fe61a[_0x808200]={'$like':'%'+_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x42')]+'%'};return _0x2fe61a;})});}_0x20b7cb=_['merge']({},_0x20b7cb,_0x1955e2[_0xd2f6('0x45')]);return db[_0xd2f6('0x5c')][_0xd2f6('0x48')](_0x20b7cb);}})[_0xd2f6('0x2c')](function(_0x968c76){if(_0x968c76){return db['User'][_0xd2f6('0x62')]({'where':{'id':_[_0xd2f6('0x33')](_0x968c76,'UserId'),'role':'agent'},'attributes':['id',_0xd2f6('0x30'),_0xd2f6('0x63'),_0xd2f6('0x64'),_0xd2f6('0x65')]});}})[_0xd2f6('0x2c')](function(_0x3c9e77){if(_0x3c9e77){return{'count':_0x3c9e77[_0xd2f6('0x24')],'rows':_['map'](_0x3c9e77[_0xd2f6('0x49')],function(_0x5d9809){return{'membername':_0x5d9809[_0xd2f6('0x30')],'UserId':_0x5d9809['id'],'queue_name':_0x301a86['name'],'OpenchannelQueueId':_0x301a86['id'],'interface':util['format'](_0xd2f6('0x66'),_0xd2f6('0x67'),_0x5d9809['name']),'penalty':0x0,'paused':_0x5d9809[_0xd2f6('0x63')],'createdAt':_0x5d9809[_0xd2f6('0x65')],'updatedAt':_0x5d9809[_0xd2f6('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1282a9,_0x20b7cb))[_0xd2f6('0x57')](handleError(_0x1282a9,null));};exports['getTeams']=function(_0x30544f,_0x147caf,_0xd33384){var _0xcd9c64={};var _0x2da2a7={};var _0x1197bf;var _0x167d11;return db['OpenchannelQueue'][_0xd2f6('0x5b')]({'where':{'id':_0x30544f['params']['id']}})[_0xd2f6('0x2c')](handleEntityNotFound(_0x147caf,null))['then'](function(_0xbf152){if(_0xbf152){_0x1197bf=_0xbf152;_0x2da2a7[_0xd2f6('0x3c')]=_[_0xd2f6('0x38')](db['Team'][_0xd2f6('0x5d')]);_0x2da2a7['query']=_['keys'](_0x30544f[_0xd2f6('0x37')]);_0x2da2a7[_0xd2f6('0x39')]=_[_0xd2f6('0x3a')](_0x2da2a7[_0xd2f6('0x3c')],_0x2da2a7['query']);_0xcd9c64[_0xd2f6('0x3b')]=_['intersection'](_0x2da2a7['model'],qs[_0xd2f6('0x3d')](_0x30544f['query']['fields']));_0xcd9c64['attributes']=_0xcd9c64['attributes'][_0xd2f6('0x3e')]?_0xcd9c64[_0xd2f6('0x3b')]:_0x2da2a7['model'];_0xcd9c64[_0xd2f6('0x40')]=qs[_0xd2f6('0x5f')](_0x30544f[_0xd2f6('0x37')][_0xd2f6('0x5f')]);_0xcd9c64[_0xd2f6('0x41')]=qs[_0xd2f6('0x39')](_[_0xd2f6('0x60')](_0x30544f[_0xd2f6('0x37')],_0x2da2a7[_0xd2f6('0x39')]));if(_0x30544f[_0xd2f6('0x37')][_0xd2f6('0x42')]){_0xcd9c64[_0xd2f6('0x41')]=_['merge'](_0xcd9c64[_0xd2f6('0x41')],{'$or':_['map'](_0xcd9c64[_0xd2f6('0x3b')],function(_0x49b123){var _0x13c194={};_0x13c194[_0x49b123]={'$like':'%'+_0x30544f[_0xd2f6('0x37')][_0xd2f6('0x42')]+'%'};return _0x13c194;})});}_0xcd9c64=_[_0xd2f6('0x4c')]({},_0xcd9c64,_0x30544f[_0xd2f6('0x45')]);return _0x1197bf[_0xd2f6('0x68')](_0xcd9c64);}})[_0xd2f6('0x2c')](function(_0x2e77fb){if(_0x2e77fb){_0x167d11=_0x2e77fb[_0xd2f6('0x3e')];if(!_0x30544f[_0xd2f6('0x37')][_0xd2f6('0x5e')]('nolimit')){_0xcd9c64[_0xd2f6('0x23')]=qs[_0xd2f6('0x23')](_0x30544f[_0xd2f6('0x37')][_0xd2f6('0x23')]);_0xcd9c64[_0xd2f6('0x21')]=qs['offset'](_0x30544f[_0xd2f6('0x37')]['offset']);}return _0x1197bf[_0xd2f6('0x68')](_0xcd9c64);}})[_0xd2f6('0x2c')](function(_0x308261){if(_0x308261){return _0x308261?{'count':_0x167d11,'rows':_0x308261}:null;}})[_0xd2f6('0x2c')](respondWithResult(_0x147caf,null))[_0xd2f6('0x57')](handleError(_0x147caf,null));};exports[_0xd2f6('0x69')]=function(_0x4cd640,_0x3cd651,_0x2506a7){var _0x382dee=_0x4cd640[_0xd2f6('0x4f')][_0xd2f6('0x6a')];return db[_0xd2f6('0x6b')]['findAll']({'where':{'id':_0x382dee},'attributes':['id'],'include':[{'model':db[_0xd2f6('0x6c')],'as':'Agents','attributes':['id',_0xd2f6('0x30'),'online','voicePause',_0xd2f6('0x6d')],'raw':!![]}]})['then'](function(_0x4e34ce){if(_0x4e34ce){var _0x502c23=_['flatMap'](_0x4e34ce,function(_0x413b2d){var _0x1dc987=_0x413b2d[_0xd2f6('0x2d')]({'plain':!![]});return _0x1dc987[_0xd2f6('0x6e')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x4cd640[_0xd2f6('0x4b')]['id']}})[_0xd2f6('0x2c')](function(_0x41f34a){return db[_0xd2f6('0x6f')][_0xd2f6('0x70')](function(_0x4d14ba){return _0x41f34a[_0xd2f6('0x69')](_0x382dee,{'transaction':_0x4d14ba})['then'](function(){return BPromise[_0xd2f6('0x71')](_0x502c23,function(_0x2c3c8b){return db['UserOpenchannelQueue'][_0xd2f6('0x72')]({'where':{'UserId':_0x2c3c8b['id'],'OpenchannelQueueId':_0x4cd640[_0xd2f6('0x4b')]['id']},'transaction':_0x4d14ba});});})['then'](function(){_0x502c23['forEach'](function(_0x2ee0b6){socket[_0xd2f6('0x73')]('userOpenchannelQueue:save',{'UserId':_0x2ee0b6['id'],'OpenchannelQueueId':_0x41f34a['id']});});});});});}})['then'](respondWithStatusCode(_0x3cd651,null))[_0xd2f6('0x57')](handleError(_0x3cd651,null));};exports['removeTeams']=function(_0x56a0bc,_0x3aa1b3,_0x1c873f){return db['Team']['findAll']({'where':{'id':_0x56a0bc[_0xd2f6('0x37')][_0xd2f6('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xd2f6('0x6c')],'as':_0xd2f6('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xd2f6('0x2c')](handleEntityNotFound(_0x3aa1b3,null))[_0xd2f6('0x2c')](function(_0x18e82d){var _0x2cf125=_[_0xd2f6('0x33')](_0x18e82d,'id');var _0x30f1ea=[];var _0x32b209=[];var _0x5308b8=squel[_0xd2f6('0x74')]();_0x5308b8[_0xd2f6('0x75')](_0xd2f6('0x76'))[_0xd2f6('0x77')](_0xd2f6('0x78'),'tq')[_0xd2f6('0x79')](_0xd2f6('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('OpenchannelQueueId\x20=\x20?',_0x56a0bc[_0xd2f6('0x4b')]['id']);for(var _0xf422d=0x0;_0xf422d<_0x18e82d[_0xd2f6('0x3e')];_0xf422d+=0x1){let _0x591814=_0x18e82d[_0xf422d];for(var _0x43f1a8=0x0;_0x43f1a8<_0x591814[_0xd2f6('0x6e')][_0xd2f6('0x3e')];_0x43f1a8+=0x1){let _0x18973b=_0x591814[_0xd2f6('0x6e')][_0x43f1a8];var _0x23e34c=_0x5308b8[_0xd2f6('0x7b')]();_0x23e34c['where'](_0xd2f6('0x7c'),_0x18973b['id']);_0x32b209[_0xd2f6('0x7d')](db[_0xd2f6('0x6f')][_0xd2f6('0x37')](_0x23e34c[_0xd2f6('0x7e')](),{'type':db[_0xd2f6('0x6f')][_0xd2f6('0x7f')][_0xd2f6('0x80')]})[_0xd2f6('0x2c')](function(_0x442c39){if(_0x442c39['length']===0x1){return _0x18973b['id'];}else{var _0xf7b596=_[_0xd2f6('0x81')](_[_0xd2f6('0x33')](_0x442c39,_0xd2f6('0x82')),function(_0x1389f0){return _[_0xd2f6('0x83')](_0x2cf125,_0x1389f0);});if(_0xf7b596){return _0x18973b['id'];}}}));}}return BPromise[_0xd2f6('0x84')](_0x32b209)['then'](function(_0x55caac){_0x30f1ea=_(_0x30f1ea)[_0xd2f6('0x85')](_0x55caac)[_0xd2f6('0x86')]()[_0xd2f6('0x87')]();return db[_0xd2f6('0x34')]['find']({'where':{'id':_0x56a0bc[_0xd2f6('0x4b')]['id']}})[_0xd2f6('0x2c')](function(_0x43db79){return db[_0xd2f6('0x6f')][_0xd2f6('0x70')](function(_0x350324){return _0x43db79[_0xd2f6('0x88')](_0x56a0bc['query'][_0xd2f6('0x6a')],{'transaction':_0x350324})['then'](function(){if(!_[_0xd2f6('0x89')](_0x30f1ea)){return _0x43db79[_0xd2f6('0x8a')](_0x30f1ea,{'transaction':_0x350324});}})[_0xd2f6('0x2c')](function(){_0x30f1ea[_0xd2f6('0x8b')](function(_0x481095){socket[_0xd2f6('0x73')](_0xd2f6('0x8c'),{'UserId':_0x481095,'OpenchannelQueueId':_0x43db79['id']});});});});});});})[_0xd2f6('0x2c')](respondWithStatusCode(_0x3aa1b3,null))[_0xd2f6('0x57')](handleError(_0x3aa1b3,null));};exports[_0xd2f6('0x8d')]=function(_0xe49071,_0x3d9877,_0x5bb7d3){return db[_0xd2f6('0x34')][_0xd2f6('0x4d')]({'where':{'id':_0xe49071[_0xd2f6('0x4b')]['id']}})[_0xd2f6('0x2c')](handleEntityNotFound(_0x3d9877,null))['then'](function(_0x49faa9){if(_0x49faa9){return _0x49faa9[_0xd2f6('0x8d')](_0xe49071[_0xd2f6('0x4f')][_0xd2f6('0x6a')],_[_0xd2f6('0x8e')](_0xe49071[_0xd2f6('0x4f')],[_0xd2f6('0x6a'),'id'])||{})[_0xd2f6('0x8f')](function(_0x4ea554){for(var _0x6ce338=0x0;_0x6ce338<_0xe49071[_0xd2f6('0x4f')][_0xd2f6('0x6a')]['length'];_0x6ce338+=0x1){socket['emit'](_0xd2f6('0x90'),{'UserId':Number(_0xe49071['body'][_0xd2f6('0x6a')][_0x6ce338]),'OpenchannelQueueId':Number(_0xe49071[_0xd2f6('0x4b')]['id'])});}return _0x4ea554;});}})[_0xd2f6('0x2c')](respondWithResult(_0x3d9877,null))[_0xd2f6('0x57')](handleError(_0x3d9877,null));};exports[_0xd2f6('0x8a')]=function(_0x3d9d7f,_0x5f1517,_0x137c6e){return db[_0xd2f6('0x34')][_0xd2f6('0x4d')]({'where':{'id':_0x3d9d7f['params']['id']}})[_0xd2f6('0x2c')](handleEntityNotFound(_0x5f1517,null))['then'](function(_0x3f2cf1){if(_0x3f2cf1){return _0x3f2cf1[_0xd2f6('0x8a')](_0x3d9d7f[_0xd2f6('0x37')][_0xd2f6('0x6a')])['then'](function(){if(_[_0xd2f6('0x91')](_0x3d9d7f[_0xd2f6('0x37')]['ids'])){for(var _0x56308e=0x0;_0x56308e<_0x3d9d7f[_0xd2f6('0x37')][_0xd2f6('0x6a')][_0xd2f6('0x3e')];_0x56308e+=0x1){socket[_0xd2f6('0x73')](_0xd2f6('0x8c'),{'UserId':Number(_0x3d9d7f[_0xd2f6('0x37')]['ids'][_0x56308e]),'OpenchannelQueueId':Number(_0x3d9d7f[_0xd2f6('0x4b')]['id'])});}}else{socket['emit'](_0xd2f6('0x8c'),{'UserId':Number(_0x3d9d7f['query']['ids']),'OpenchannelQueueId':Number(_0x3d9d7f[_0xd2f6('0x4b')]['id'])});}});}})[_0xd2f6('0x2c')](respondWithStatusCode(_0x5f1517,null))[_0xd2f6('0x57')](handleError(_0x5f1517,null));};exports[_0xd2f6('0x92')]=function(_0x1c65a5,_0x1968ea,_0x50828f){var _0x2ed7d6={};var _0x55803a={};var _0x51d491;var _0x71ed16;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x1c65a5[_0xd2f6('0x4b')]['id']}})[_0xd2f6('0x2c')](handleEntityNotFound(_0x1968ea,null))[_0xd2f6('0x2c')](function(_0x2ec09a){if(_0x2ec09a){_0x51d491=_0x2ec09a;_0x55803a[_0xd2f6('0x3c')]=_[_0xd2f6('0x38')](db['User']['rawAttributes']);_0x55803a[_0xd2f6('0x37')]=_['keys'](_0x1c65a5[_0xd2f6('0x37')]);_0x55803a['filters']=_['intersection'](_0x55803a['model'],_0x55803a[_0xd2f6('0x37')]);_0x2ed7d6[_0xd2f6('0x3b')]=_[_0xd2f6('0x3a')](_0x55803a['model'],qs[_0xd2f6('0x3d')](_0x1c65a5[_0xd2f6('0x37')]['fields']));_0x2ed7d6[_0xd2f6('0x3b')]=_0x2ed7d6['attributes'][_0xd2f6('0x3e')]?_0x2ed7d6['attributes']:_0x55803a[_0xd2f6('0x3c')];_0x2ed7d6[_0xd2f6('0x40')]=qs[_0xd2f6('0x5f')](_0x1c65a5[_0xd2f6('0x37')][_0xd2f6('0x5f')]);_0x2ed7d6[_0xd2f6('0x41')]=qs[_0xd2f6('0x39')](_[_0xd2f6('0x60')](_0x1c65a5['query'],_0x55803a[_0xd2f6('0x39')]));if(_0x1c65a5['query'][_0xd2f6('0x42')]){_0x2ed7d6[_0xd2f6('0x41')]=_[_0xd2f6('0x4c')](_0x2ed7d6['where'],{'$or':_['map'](_0x2ed7d6['attributes'],function(_0x565e3e){var _0x5b7c92={};_0x5b7c92[_0x565e3e]={'$like':'%'+_0x1c65a5[_0xd2f6('0x37')][_0xd2f6('0x42')]+'%'};return _0x5b7c92;})});}_0x2ed7d6=_['merge']({},_0x2ed7d6,_0x1c65a5[_0xd2f6('0x45')]);return _0x51d491[_0xd2f6('0x92')](_0x2ed7d6);}})[_0xd2f6('0x2c')](function(_0x2488a7){if(_0x2488a7){_0x71ed16=_0x2488a7[_0xd2f6('0x3e')];if(!_0x1c65a5['query'][_0xd2f6('0x5e')](_0xd2f6('0x3f'))){_0x2ed7d6['limit']=qs[_0xd2f6('0x23')](_0x1c65a5[_0xd2f6('0x37')][_0xd2f6('0x23')]);_0x2ed7d6[_0xd2f6('0x21')]=qs['offset'](_0x1c65a5[_0xd2f6('0x37')][_0xd2f6('0x21')]);}return _0x51d491['getAgents'](_0x2ed7d6);}})[_0xd2f6('0x2c')](function(_0x266776){if(_0x266776){return _0x266776?{'count':_0x71ed16,'rows':_0x266776}:null;}})['then'](respondWithResult(_0x1968ea,null))['catch'](handleError(_0x1968ea,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 2197cea..200b927 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 _0x1879=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x2d9adf,_0x2fff47){var _0x3aa401=function(_0xdb465f){while(--_0xdb465f){_0x2d9adf['push'](_0x2d9adf['shift']());}};_0x3aa401(++_0x2fff47);}(_0x1879,0xe0));var _0x9187=function(_0x106214,_0x454b8d){_0x106214=_0x106214-0x0;var _0x5f5cea=_0x1879[_0x106214];return _0x5f5cea;};'use strict';var EventEmitter=require(_0x9187('0x0'));var OpenchannelQueue=require(_0x9187('0x1'))['db'][_0x9187('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9187('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x23c9c7){return function(_0x5b6bd3,_0x30e16d,_0x7fc839){OpenchannelQueueEvents['emit'](_0x23c9c7+':'+_0x5b6bd3['id'],_0x5b6bd3);OpenchannelQueueEvents[_0x9187('0x4')](_0x23c9c7,_0x5b6bd3);_0x7fc839(null);};}for(var e in events){if(events[_0x9187('0x5')](e)){var event=events[e];OpenchannelQueue[_0x9187('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x796b=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3ffda4,_0x282865){var _0x4b1eed=function(_0x48a3f9){while(--_0x48a3f9){_0x3ffda4['push'](_0x3ffda4['shift']());}};_0x4b1eed(++_0x282865);}(_0x796b,0x1b2));var _0xb796=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x796b[_0x47a7d0];return _0xb9bd08;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xb796('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb796('0x1')](0x0);var events={'afterCreate':_0xb796('0x2'),'afterUpdate':_0xb796('0x3'),'afterDestroy':_0xb796('0x4')};function emitEvent(_0x417e41){return function(_0x10828a,_0x1f082c,_0x2d6cca){OpenchannelQueueEvents[_0xb796('0x5')](_0x417e41+':'+_0x10828a['id'],_0x10828a);OpenchannelQueueEvents[_0xb796('0x5')](_0x417e41,_0x10828a);_0x2d6cca(null);};}for(var e in events){if(events[_0xb796('0x6')](e)){var event=events[e];OpenchannelQueue[_0xb796('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 95ae131..8a9f431 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 _0x8990=['request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','moment','bluebird'];(function(_0x1fd3e2,_0x1a6772){var _0x5a9210=function(_0x37e9c3){while(--_0x37e9c3){_0x1fd3e2['push'](_0x1fd3e2['shift']());}};_0x5a9210(++_0x1a6772);}(_0x8990,0xec));var _0x0899=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x8990[_0x4d21ff];return _0x22b554;};'use strict';var _=require(_0x0899('0x0'));var util=require('util');var logger=require(_0x0899('0x1'))('api');var moment=require(_0x0899('0x2'));var BPromise=require(_0x0899('0x3'));var rp=require(_0x0899('0x4'));var fs=require('fs');var path=require(_0x0899('0x5'));var rimraf=require('rimraf');var config=require(_0x0899('0x6'));var attributes=require(_0x0899('0x7'));module[_0x0899('0x8')]=function(_0x3cd391,_0x445557){return _0x3cd391[_0x0899('0x9')](_0x0899('0xa'),attributes,{'tableName':_0x0899('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdca5=['OpenchannelQueue','openchannel_queues','lodash','../../config/logger','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x67f123,_0x261bd3){var _0x36b061=function(_0x1c8ec4){while(--_0x1c8ec4){_0x67f123['push'](_0x67f123['shift']());}};_0x36b061(++_0x261bd3);}(_0xdca5,0xa2));var _0x5dca=function(_0x2f2ce8,_0x496926){_0x2f2ce8=_0x2f2ce8-0x0;var _0xdf72df=_0xdca5[_0x2f2ce8];return _0xdf72df;};'use strict';var _=require(_0x5dca('0x0'));var util=require('util');var logger=require(_0x5dca('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5dca('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dca('0x3'));var config=require(_0x5dca('0x4'));var attributes=require(_0x5dca('0x5'));module[_0x5dca('0x6')]=function(_0xf1d8d8,_0xa20b8e){return _0xf1d8d8[_0x5dca('0x7')](_0x5dca('0x8'),attributes,{'tableName':_0x5dca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 5a50d63..6dade2e 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 _0x6934=['../../config/environment','jayson/promise','client','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','OpenchannelQueue','options','where','attributes','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','raw','util','moment','../../mysqldb','../../config/utils','rpc'];(function(_0x753026,_0x34dc5c){var _0x443ddf=function(_0x499149){while(--_0x499149){_0x753026['push'](_0x753026['shift']());}};_0x443ddf(++_0x34dc5c);}(_0x6934,0xc7));var _0x4693=function(_0x4e5c43,_0x3f42c6){_0x4e5c43=_0x4e5c43-0x0;var _0x5a2d85=_0x6934[_0x4e5c43];return _0x5a2d85;};'use strict';var _=require('lodash');var util=require(_0x4693('0x0'));var moment=require(_0x4693('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4693('0x2'))['db'];var utils=require(_0x4693('0x3'));var logger=require('../../config/logger')(_0x4693('0x4'));var config=require(_0x4693('0x5'));var jayson=require(_0x4693('0x6'));var client=jayson[_0x4693('0x7')]['http']({'port':0x232a});config[_0x4693('0x8')]=_[_0x4693('0x9')](config[_0x4693('0x8')],{'host':_0x4693('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4693('0x8')]));require(_0x4693('0xb'))[_0x4693('0xc')](socket);function respondWithRpcPromise(_0x47c990,_0x2bf7b7,_0x1a486a){return new BPromise(function(_0x15b7e4,_0x288b50){return client[_0x4693('0xd')](_0x47c990,_0x1a486a)[_0x4693('0xe')](function(_0x71028b){logger[_0x4693('0xf')](_0x4693('0x10'),_0x2bf7b7,'request\x20sent');logger[_0x4693('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2bf7b7,_0x4693('0x12'),JSON[_0x4693('0x13')](_0x71028b));if(_0x71028b[_0x4693('0x14')]){if(_0x71028b[_0x4693('0x14')]['code']===0x1f4){logger['error'](_0x4693('0x10'),_0x2bf7b7,_0x71028b[_0x4693('0x14')][_0x4693('0x15')]);return _0x288b50(_0x71028b[_0x4693('0x14')][_0x4693('0x15')]);}logger[_0x4693('0x14')](_0x4693('0x10'),_0x2bf7b7,_0x71028b[_0x4693('0x14')][_0x4693('0x15')]);return _0x15b7e4(_0x71028b[_0x4693('0x14')][_0x4693('0x15')]);}else{logger[_0x4693('0xf')](_0x4693('0x10'),_0x2bf7b7,'request\x20sent');_0x15b7e4(_0x71028b[_0x4693('0x16')]['message']);}})[_0x4693('0x17')](function(_0x27630c){logger['error'](_0x4693('0x10'),_0x2bf7b7,_0x27630c);_0x288b50(_0x27630c);});});}exports['GetOpenchannelQueue']=function(_0xa52254){var _0x14be55=this;return new Promise(function(_0x123ff7,_0x53b291){return db[_0x4693('0x18')]['findAll']({'raw':_0xa52254[_0x4693('0x19')]?_0xa52254['options']['raw']===undefined?!![]:![]:!![],'where':_0xa52254[_0x4693('0x19')]?_0xa52254[_0x4693('0x19')][_0x4693('0x1a')]||null:null,'attributes':_0xa52254[_0x4693('0x19')]?_0xa52254['options'][_0x4693('0x1b')]||null:null,'limit':_0xa52254[_0x4693('0x19')]?_0xa52254['options']['limit']||null:null,'include':_0xa52254[_0x4693('0x19')]?_0xa52254['options'][_0x4693('0x1c')]?_[_0x4693('0x1d')](_0xa52254['options'][_0x4693('0x1c')],function(_0x4ac372){return{'model':db[_0x4ac372[_0x4693('0x1e')]],'as':_0x4ac372['as'],'attributes':_0x4ac372[_0x4693('0x1b')],'include':_0x4ac372[_0x4693('0x1c')]?_[_0x4693('0x1d')](_0x4ac372['include'],function(_0x2f9574){return{'model':db[_0x2f9574[_0x4693('0x1e')]],'as':_0x2f9574['as'],'attributes':_0x2f9574[_0x4693('0x1b')],'include':_0x2f9574['include']?_[_0x4693('0x1d')](_0x2f9574[_0x4693('0x1c')],function(_0x3c28cf){return{'model':db[_0x3c28cf[_0x4693('0x1e')]],'as':_0x3c28cf['as'],'attributes':_0x3c28cf[_0x4693('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4693('0xe')](function(_0x299e31){logger[_0x4693('0xf')](_0x4693('0x1f'),_0xa52254);logger['debug'](_0x4693('0x1f'),_0xa52254,JSON[_0x4693('0x13')](_0x299e31));_0x123ff7(_0x299e31);})[_0x4693('0x17')](function(_0x3c6203){logger[_0x4693('0x14')]('GetOpenchannelQueue',_0x3c6203[_0x4693('0x15')],_0xa52254);_0x53b291(_0x14be55['error'](0x1f4,_0x3c6203[_0x4693('0x15')]));});});};exports[_0x4693('0x20')]=function(_0x3277cd){var _0x259b76=this;return new Promise(function(_0x106331,_0x436a3c){return db[_0x4693('0x18')]['find']({'raw':_0x3277cd['options']?_0x3277cd[_0x4693('0x19')][_0x4693('0x21')]===undefined?!![]:![]:!![],'where':_0x3277cd[_0x4693('0x19')]?_0x3277cd[_0x4693('0x19')]['where']||null:null,'attributes':_0x3277cd[_0x4693('0x19')]?_0x3277cd['options'][_0x4693('0x1b')]||null:null,'include':_0x3277cd['options']?_0x3277cd[_0x4693('0x19')]['include']?_['map'](_0x3277cd[_0x4693('0x19')][_0x4693('0x1c')],function(_0x37e649){return{'model':db[_0x37e649[_0x4693('0x1e')]],'as':_0x37e649['as'],'attributes':_0x37e649[_0x4693('0x1b')],'include':_0x37e649[_0x4693('0x1c')]?_[_0x4693('0x1d')](_0x37e649['include'],function(_0x8d4e7e){return{'model':db[_0x8d4e7e[_0x4693('0x1e')]],'as':_0x8d4e7e['as'],'attributes':_0x8d4e7e[_0x4693('0x1b')],'include':_0x8d4e7e[_0x4693('0x1c')]?_['map'](_0x8d4e7e['include'],function(_0x134356){return{'model':db[_0x134356['model']],'as':_0x134356['as'],'attributes':_0x134356[_0x4693('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4693('0xe')](function(_0x4ada6f){logger[_0x4693('0xf')](_0x4693('0x20'),_0x3277cd);logger['debug']('ShowOpenchannelQueue',_0x3277cd,JSON['stringify'](_0x4ada6f));_0x106331(_0x4ada6f);})[_0x4693('0x17')](function(_0x4b70ca){logger['error'](_0x4693('0x20'),_0x4b70ca[_0x4693('0x15')],_0x3277cd);_0x436a3c(_0x259b76[_0x4693('0x14')](0x1f4,_0x4b70ca['message']));});});}; \ No newline at end of file +var _0x8137=['request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','map','include','model','catch','ShowOpenchannelQueue','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x8137,0xaf));var _0x7813=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x8137[_0x1deb03];return _0x189fe7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7813('0x0'));var rs=require(_0x7813('0x1'));var fs=require('fs');var Redis=require(_0x7813('0x2'));var db=require(_0x7813('0x3'))['db'];var utils=require(_0x7813('0x4'));var logger=require('../../config/logger')(_0x7813('0x5'));var config=require(_0x7813('0x6'));var jayson=require(_0x7813('0x7'));var client=jayson[_0x7813('0x8')][_0x7813('0x9')]({'port':0x232a});config[_0x7813('0xa')]=_[_0x7813('0xb')](config[_0x7813('0xa')],{'host':_0x7813('0xc'),'port':0x18eb});var socket=require(_0x7813('0xd'))(new Redis(config[_0x7813('0xa')]));require('./openchannelQueue.socket')[_0x7813('0xe')](socket);function respondWithRpcPromise(_0x32967c,_0x4ffcfa,_0x44262e){return new BPromise(function(_0x584ccd,_0x3c4202){return client[_0x7813('0xf')](_0x32967c,_0x44262e)[_0x7813('0x10')](function(_0x515e94){logger[_0x7813('0x11')](_0x7813('0x12'),_0x4ffcfa,_0x7813('0x13'));logger[_0x7813('0x14')](_0x7813('0x15'),_0x4ffcfa,'request\x20sent',JSON[_0x7813('0x16')](_0x515e94));if(_0x515e94['error']){if(_0x515e94[_0x7813('0x17')][_0x7813('0x18')]===0x1f4){logger[_0x7813('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ffcfa,_0x515e94['error'][_0x7813('0x19')]);return _0x3c4202(_0x515e94['error'][_0x7813('0x19')]);}logger[_0x7813('0x17')](_0x7813('0x12'),_0x4ffcfa,_0x515e94[_0x7813('0x17')]['message']);return _0x584ccd(_0x515e94[_0x7813('0x17')]['message']);}else{logger[_0x7813('0x11')](_0x7813('0x12'),_0x4ffcfa,'request\x20sent');_0x584ccd(_0x515e94['result'][_0x7813('0x19')]);}})['catch'](function(_0xecab14){logger[_0x7813('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ffcfa,_0xecab14);_0x3c4202(_0xecab14);});});}exports[_0x7813('0x1a')]=function(_0x18dd5a){var _0x21677c=this;return new Promise(function(_0x30c122,_0x5542dd){return db[_0x7813('0x1b')]['findAll']({'raw':_0x18dd5a[_0x7813('0x1c')]?_0x18dd5a[_0x7813('0x1c')][_0x7813('0x1d')]===undefined?!![]:![]:!![],'where':_0x18dd5a['options']?_0x18dd5a[_0x7813('0x1c')][_0x7813('0x1e')]||null:null,'attributes':_0x18dd5a[_0x7813('0x1c')]?_0x18dd5a['options'][_0x7813('0x1f')]||null:null,'limit':_0x18dd5a[_0x7813('0x1c')]?_0x18dd5a[_0x7813('0x1c')][_0x7813('0x20')]||null:null,'include':_0x18dd5a['options']?_0x18dd5a['options']['include']?_[_0x7813('0x21')](_0x18dd5a['options'][_0x7813('0x22')],function(_0x43cc37){return{'model':db[_0x43cc37[_0x7813('0x23')]],'as':_0x43cc37['as'],'attributes':_0x43cc37[_0x7813('0x1f')],'include':_0x43cc37[_0x7813('0x22')]?_[_0x7813('0x21')](_0x43cc37[_0x7813('0x22')],function(_0x5a42a6){return{'model':db[_0x5a42a6['model']],'as':_0x5a42a6['as'],'attributes':_0x5a42a6['attributes'],'include':_0x5a42a6[_0x7813('0x22')]?_['map'](_0x5a42a6[_0x7813('0x22')],function(_0x252a3b){return{'model':db[_0x252a3b['model']],'as':_0x252a3b['as'],'attributes':_0x252a3b[_0x7813('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6a2765){logger[_0x7813('0x11')](_0x7813('0x1a'),_0x18dd5a);logger[_0x7813('0x14')](_0x7813('0x1a'),_0x18dd5a,JSON['stringify'](_0x6a2765));_0x30c122(_0x6a2765);})[_0x7813('0x24')](function(_0x3fd59c){logger[_0x7813('0x17')](_0x7813('0x1a'),_0x3fd59c[_0x7813('0x19')],_0x18dd5a);_0x5542dd(_0x21677c[_0x7813('0x17')](0x1f4,_0x3fd59c[_0x7813('0x19')]));});});};exports[_0x7813('0x25')]=function(_0x515ac4){var _0x886b62=this;return new Promise(function(_0x44b5b5,_0xe362c4){return db['OpenchannelQueue']['find']({'raw':_0x515ac4[_0x7813('0x1c')]?_0x515ac4[_0x7813('0x1c')][_0x7813('0x1d')]===undefined?!![]:![]:!![],'where':_0x515ac4[_0x7813('0x1c')]?_0x515ac4[_0x7813('0x1c')][_0x7813('0x1e')]||null:null,'attributes':_0x515ac4[_0x7813('0x1c')]?_0x515ac4[_0x7813('0x1c')]['attributes']||null:null,'include':_0x515ac4[_0x7813('0x1c')]?_0x515ac4[_0x7813('0x1c')][_0x7813('0x22')]?_[_0x7813('0x21')](_0x515ac4[_0x7813('0x1c')][_0x7813('0x22')],function(_0x433102){return{'model':db[_0x433102[_0x7813('0x23')]],'as':_0x433102['as'],'attributes':_0x433102['attributes'],'include':_0x433102[_0x7813('0x22')]?_[_0x7813('0x21')](_0x433102[_0x7813('0x22')],function(_0x2c6f2f){return{'model':db[_0x2c6f2f['model']],'as':_0x2c6f2f['as'],'attributes':_0x2c6f2f[_0x7813('0x1f')],'include':_0x2c6f2f[_0x7813('0x22')]?_[_0x7813('0x21')](_0x2c6f2f[_0x7813('0x22')],function(_0x18629b){return{'model':db[_0x18629b[_0x7813('0x23')]],'as':_0x18629b['as'],'attributes':_0x18629b['attributes']};}):[]};}):[]};}):[]:[]})[_0x7813('0x10')](function(_0x30077f){logger['info']('ShowOpenchannelQueue',_0x515ac4);logger[_0x7813('0x14')]('ShowOpenchannelQueue',_0x515ac4,JSON[_0x7813('0x16')](_0x30077f));_0x44b5b5(_0x30077f);})[_0x7813('0x24')](function(_0x1e255d){logger[_0x7813('0x17')](_0x7813('0x25'),_0x1e255d['message'],_0x515ac4);_0xe362c4(_0x886b62[_0x7813('0x17')](0x1f4,_0x1e255d[_0x7813('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0b21de3..9deb8cc 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 _0x9200=['length','openchannelQueue:','remove','emit'];(function(_0x246422,_0x4367e5){var _0xe86ae7=function(_0x5750b1){while(--_0x5750b1){_0x246422['push'](_0x246422['shift']());}};_0xe86ae7(++_0x4367e5);}(_0x9200,0x6e));var _0x0920=function(_0x50aa29,_0x514228){_0x50aa29=_0x50aa29-0x0;var _0x45c679=_0x9200[_0x50aa29];return _0x45c679;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x0920('0x0'),'update'];function createListener(_0x3c1875,_0x44c85f){return function(_0x263fd3){_0x44c85f[_0x0920('0x1')](_0x3c1875,_0x263fd3);};}function removeListener(_0x24ecd5,_0x19cdf5){return function(){OpenchannelQueueEvents['removeListener'](_0x24ecd5,_0x19cdf5);};}exports['register']=function(_0x38bcac){for(var _0x10ece6=0x0,_0x2b4a77=events[_0x0920('0x2')];_0x10ece6<_0x2b4a77;_0x10ece6++){var _0x59d387=events[_0x10ece6];var _0xe54e59=createListener(_0x0920('0x3')+_0x59d387,_0x38bcac);OpenchannelQueueEvents['on'](_0x59d387,_0xe54e59);}}; \ No newline at end of file +var _0x23da=['removeListener','register','length','openchannelQueue:','remove','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x23da,0xb2));var _0xa23d=function(_0x52c5d7,_0x16312c){_0x52c5d7=_0x52c5d7-0x0;var _0xf3b893=_0x23da[_0x52c5d7];return _0xf3b893;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0xa23d('0x0'),'update'];function createListener(_0x1df079,_0x4f976c){return function(_0x3cff01){_0x4f976c[_0xa23d('0x1')](_0x1df079,_0x3cff01);};}function removeListener(_0x390a63,_0x10ed52){return function(){OpenchannelQueueEvents[_0xa23d('0x2')](_0x390a63,_0x10ed52);};}exports[_0xa23d('0x3')]=function(_0x153419){for(var _0x13c2f8=0x0,_0x1a75d3=events[_0xa23d('0x4')];_0x13c2f8<_0x1a75d3;_0x13c2f8++){var _0x437722=events[_0x13c2f8];var _0x3053e4=createListener(_0xa23d('0x5')+_0x437722,_0x153419);OpenchannelQueueEvents['on'](_0x437722,_0x3053e4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 5429b1f..365a1d3 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 _0x3a9e=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a9e,0x84));var _0xe3a9=function(_0x310eb9,_0x1aed15){_0x310eb9=_0x310eb9-0x0;var _0x28915c=_0x3a9e[_0x310eb9];return _0x28915c;};'use strict';var multer=require(_0xe3a9('0x0'));var util=require('util');var path=require(_0xe3a9('0x1'));var timeout=require('connect-timeout');var express=require(_0xe3a9('0x2'));var router=express['Router']();var fs_extra=require(_0xe3a9('0x3'));var auth=require(_0xe3a9('0x4'));var interaction=require(_0xe3a9('0x5'));var config=require(_0xe3a9('0x6'));var controller=require(_0xe3a9('0x7'));router[_0xe3a9('0x8')]('/',auth[_0xe3a9('0x9')](),controller['index']);router['get'](_0xe3a9('0xa'),auth[_0xe3a9('0x9')](),controller[_0xe3a9('0xb')]);router[_0xe3a9('0x8')](_0xe3a9('0xc'),auth[_0xe3a9('0x9')](),controller[_0xe3a9('0xd')]);router[_0xe3a9('0xe')]('/',auth[_0xe3a9('0x9')](),controller[_0xe3a9('0xf')]);router[_0xe3a9('0x10')]('/:id',auth[_0xe3a9('0x9')](),controller[_0xe3a9('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe3a9('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbadd=['../../config/environment','get','isAuthenticated','index','describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x55bd38,_0x48eacf){var _0x444323=function(_0x22c59c){while(--_0x22c59c){_0x55bd38['push'](_0x55bd38['shift']());}};_0x444323(++_0x48eacf);}(_0xbadd,0x1c5));var _0xdbad=function(_0x3b660f,_0x45c3db){_0x3b660f=_0x3b660f-0x0;var _0x187a29=_0xbadd[_0x3b660f];return _0x187a29;};'use strict';var multer=require(_0xdbad('0x0'));var util=require(_0xdbad('0x1'));var path=require(_0xdbad('0x2'));var timeout=require(_0xdbad('0x3'));var express=require(_0xdbad('0x4'));var router=express[_0xdbad('0x5')]();var fs_extra=require(_0xdbad('0x6'));var auth=require(_0xdbad('0x7'));var interaction=require(_0xdbad('0x8'));var config=require(_0xdbad('0x9'));var controller=require('./openchannelQueueReport.controller');router[_0xdbad('0xa')]('/',auth[_0xdbad('0xb')](),controller[_0xdbad('0xc')]);router['get']('/describe',auth[_0xdbad('0xb')](),controller[_0xdbad('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdbad('0xe')]);router[_0xdbad('0xf')]('/',auth[_0xdbad('0xb')](),controller[_0xdbad('0x10')]);router['put'](_0xdbad('0x11'),auth[_0xdbad('0xb')](),controller[_0xdbad('0x12')]);router[_0xdbad('0x13')](_0xdbad('0x11'),auth['isAuthenticated'](),controller[_0xdbad('0x14')]);module[_0xdbad('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 27678fe..b4beb03 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 _0xdd05=['sequelize','STRING','DATE','moment'];(function(_0x5dfaa2,_0x387b71){var _0x4685d3=function(_0x733b78){while(--_0x733b78){_0x5dfaa2['push'](_0x5dfaa2['shift']());}};_0x4685d3(++_0x387b71);}(_0xdd05,0xfb));var _0x5dd0=function(_0x4a0b15,_0x54818b){_0x4a0b15=_0x4a0b15-0x0;var _0x54f515=_0xdd05[_0x4a0b15];return _0x54f515;};'use strict';var moment=require(_0x5dd0('0x0'));var Sequelize=require(_0x5dd0('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5dd0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5dd0('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5dd0('0x3')]},'acceptAt':{'type':Sequelize[_0x5dd0('0x3')]},'exitAt':{'type':Sequelize[_0x5dd0('0x3')]},'reason':{'type':Sequelize[_0x5dd0('0x2')]}}; \ No newline at end of file +var _0x321f=['DATE','moment','exports','STRING'];(function(_0xe4663b,_0x48ac30){var _0x203678=function(_0x637b25){while(--_0x637b25){_0xe4663b['push'](_0xe4663b['shift']());}};_0x203678(++_0x48ac30);}(_0x321f,0x91));var _0xf321=function(_0x59197b,_0x35ec49){_0x59197b=_0x59197b-0x0;var _0x2c5edf=_0x321f[_0x59197b];return _0x2c5edf;};'use strict';var moment=require(_0xf321('0x0'));var Sequelize=require('sequelize');module[_0xf321('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf321('0x2')]},'joinAt':{'type':Sequelize[_0xf321('0x3')]},'leaveAt':{'type':Sequelize[_0xf321('0x3')]},'acceptAt':{'type':Sequelize[_0xf321('0x3')]},'exitAt':{'type':Sequelize[_0xf321('0x3')]},'reason':{'type':Sequelize[_0xf321('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 3f770fb..3c58b9e 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 _0xf1a1=['type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','stack','send','OpenchannelQueueReport','rawAttributes'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xf1a1,0x69));var _0x1f1a=function(_0x5debab,_0x2abef8){_0x5debab=_0x5debab-0x0;var _0x20333e=_0xf1a1[_0x5debab];return _0x20333e;};'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('moment');var BPromise=require(_0x1f1a('0x0'));var Mustache=require(_0x1f1a('0x1'));var util=require(_0x1f1a('0x2'));var path=require(_0x1f1a('0x3'));var sox=require(_0x1f1a('0x4'));var csv=require(_0x1f1a('0x5'));var ejs=require(_0x1f1a('0x6'));var fs=require('fs');var fs_extra=require(_0x1f1a('0x7'));var _=require(_0x1f1a('0x8'));var squel=require(_0x1f1a('0x9'));var crypto=require(_0x1f1a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1f1a('0x5'));var querystring=require(_0x1f1a('0xb'));var Papa=require(_0x1f1a('0xc'));var Redis=require(_0x1f1a('0xd'));var authService=require(_0x1f1a('0xe'));var qs=require(_0x1f1a('0xf'));var as=require(_0x1f1a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f1a('0x11'))(_0x1f1a('0x12'));var utils=require(_0x1f1a('0x13'));var config=require(_0x1f1a('0x14'));var licenseUtil=require(_0x1f1a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d1044,_0x355d1b){_0x355d1b=_0x355d1b||0xcc;return function(_0x3f4c59){if(_0x3f4c59){return _0x4d1044[_0x1f1a('0x16')](_0x355d1b);}return _0x4d1044[_0x1f1a('0x17')](_0x355d1b)[_0x1f1a('0x18')]();};}function respondWithResult(_0x351d38,_0x5580ec){_0x5580ec=_0x5580ec||0xc8;return function(_0x139b3a){if(_0x139b3a){return _0x351d38[_0x1f1a('0x17')](_0x5580ec)[_0x1f1a('0x19')](_0x139b3a);}};}function respondWithFilteredResult(_0x49e8e4,_0x456673){return function(_0x2db0cb){if(_0x2db0cb){var _0x5bd5e4=typeof _0x456673[_0x1f1a('0x1a')]==='undefined'&&typeof _0x456673[_0x1f1a('0x1b')]===_0x1f1a('0x1c');var _0x369ccc=_0x2db0cb['count'];var _0x17b433=_0x5bd5e4?0x0:_0x456673['offset'];var _0x45801f=_0x5bd5e4?_0x2db0cb[_0x1f1a('0x1d')]:_0x456673[_0x1f1a('0x1a')]+_0x456673[_0x1f1a('0x1b')];var _0x256548;if(_0x45801f>=_0x369ccc){_0x45801f=_0x369ccc;_0x256548=0xc8;}else{_0x256548=0xce;}_0x49e8e4[_0x1f1a('0x17')](_0x256548);return _0x49e8e4['set'](_0x1f1a('0x1e'),_0x17b433+'-'+_0x45801f+'/'+_0x369ccc)[_0x1f1a('0x19')](_0x2db0cb);}return null;};}function patchUpdates(_0x398a39){return function(_0x23de83){try{jsonpatch[_0x1f1a('0x1f')](_0x23de83,_0x398a39,!![]);}catch(_0x150671){return BPromise[_0x1f1a('0x20')](_0x150671);}return _0x23de83['save']();};}function saveUpdates(_0x2b51ab,_0x33cc4b){return function(_0x5eac8b){if(_0x5eac8b){return _0x5eac8b[_0x1f1a('0x21')](_0x2b51ab)[_0x1f1a('0x22')](function(_0x29915f){return _0x29915f;});}return null;};}function removeEntity(_0x2f77b5,_0x1cf232){return function(_0x22b734){if(_0x22b734){return _0x22b734['destroy']()[_0x1f1a('0x22')](function(){_0x2f77b5[_0x1f1a('0x17')](0xcc)[_0x1f1a('0x18')]();});}};}function handleEntityNotFound(_0x2a8f5a,_0x344430){return function(_0x190066){if(!_0x190066){_0x2a8f5a['sendStatus'](0x194);}return _0x190066;};}function handleError(_0x1e006b,_0x37e436){_0x37e436=_0x37e436||0x1f4;return function(_0x21a8d0){logger['error'](_0x21a8d0[_0x1f1a('0x23')]);if(_0x21a8d0['name']){delete _0x21a8d0['name'];}_0x1e006b[_0x1f1a('0x17')](_0x37e436)[_0x1f1a('0x24')](_0x21a8d0);};}exports['index']=function(_0x382701,_0x3942a2){var _0xdd6aa0={},_0x17e93a={},_0x43a28b={'count':0x0,'rows':[]};var _0x4b2b1c=_['map'](db[_0x1f1a('0x25')][_0x1f1a('0x26')],function(_0x276414){return{'name':_0x276414['fieldName'],'type':_0x276414[_0x1f1a('0x27')]['key']};});_0x17e93a[_0x1f1a('0x28')]=_[_0x1f1a('0x29')](_0x4b2b1c,'name');_0x17e93a['query']=_[_0x1f1a('0x2a')](_0x382701[_0x1f1a('0x2b')]);_0x17e93a[_0x1f1a('0x2c')]=_[_0x1f1a('0x2d')](_0x17e93a[_0x1f1a('0x28')],_0x17e93a[_0x1f1a('0x2b')]);_0xdd6aa0['attributes']=_['intersection'](_0x17e93a[_0x1f1a('0x28')],qs[_0x1f1a('0x2e')](_0x382701[_0x1f1a('0x2b')][_0x1f1a('0x2e')]));_0xdd6aa0['attributes']=_0xdd6aa0[_0x1f1a('0x2f')][_0x1f1a('0x30')]?_0xdd6aa0[_0x1f1a('0x2f')]:_0x17e93a['model'];if(!_0x382701[_0x1f1a('0x2b')][_0x1f1a('0x31')](_0x1f1a('0x32'))){_0xdd6aa0[_0x1f1a('0x1b')]=qs[_0x1f1a('0x1b')](_0x382701[_0x1f1a('0x2b')][_0x1f1a('0x1b')]);_0xdd6aa0[_0x1f1a('0x1a')]=qs['offset'](_0x382701[_0x1f1a('0x2b')][_0x1f1a('0x1a')]);}_0xdd6aa0[_0x1f1a('0x33')]=qs['sort'](_0x382701['query'][_0x1f1a('0x34')]);_0xdd6aa0[_0x1f1a('0x35')]=qs[_0x1f1a('0x2c')](_[_0x1f1a('0x36')](_0x382701[_0x1f1a('0x2b')],_0x17e93a[_0x1f1a('0x2c')]),_0x4b2b1c);if(_0x382701[_0x1f1a('0x2b')][_0x1f1a('0x37')]){_0xdd6aa0[_0x1f1a('0x35')]=_[_0x1f1a('0x38')](_0xdd6aa0['where'],{'$or':_[_0x1f1a('0x29')](_0x4b2b1c,function(_0x9596a4){if(_0x9596a4[_0x1f1a('0x27')]!==_0x1f1a('0x39')){var _0x5cb215={};_0x5cb215[_0x9596a4[_0x1f1a('0x3a')]]={'$like':'%'+_0x382701[_0x1f1a('0x2b')][_0x1f1a('0x37')]+'%'};return _0x5cb215;}})});}_0xdd6aa0=_[_0x1f1a('0x38')]({},_0xdd6aa0,_0x382701['options']);var _0x119007={'where':_0xdd6aa0['where']};return db[_0x1f1a('0x25')][_0x1f1a('0x1d')](_0x119007)[_0x1f1a('0x22')](function(_0x3de535){_0x43a28b['count']=_0x3de535;if(_0x382701[_0x1f1a('0x2b')][_0x1f1a('0x3b')]){_0xdd6aa0[_0x1f1a('0x3c')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x1f1a('0x3d')](_0xdd6aa0);})[_0x1f1a('0x22')](function(_0x4c59aa){_0x43a28b[_0x1f1a('0x3e')]=_0x4c59aa;return _0x43a28b;})[_0x1f1a('0x22')](respondWithFilteredResult(_0x3942a2,_0xdd6aa0))[_0x1f1a('0x3f')](handleError(_0x3942a2,null));};exports[_0x1f1a('0x40')]=function(_0x4035ab,_0x5deb90){var _0x1b70f9={'raw':!![],'where':{'id':_0x4035ab[_0x1f1a('0x41')]['id']}},_0x4b9d62={};_0x4b9d62[_0x1f1a('0x28')]=_[_0x1f1a('0x2a')](db[_0x1f1a('0x25')][_0x1f1a('0x26')]);_0x4b9d62[_0x1f1a('0x2b')]=_['keys'](_0x4035ab['query']);_0x4b9d62[_0x1f1a('0x2c')]=_['intersection'](_0x4b9d62['model'],_0x4b9d62[_0x1f1a('0x2b')]);_0x1b70f9[_0x1f1a('0x2f')]=_[_0x1f1a('0x2d')](_0x4b9d62[_0x1f1a('0x28')],qs[_0x1f1a('0x2e')](_0x4035ab[_0x1f1a('0x2b')][_0x1f1a('0x2e')]));_0x1b70f9['attributes']=_0x1b70f9[_0x1f1a('0x2f')][_0x1f1a('0x30')]?_0x1b70f9[_0x1f1a('0x2f')]:_0x4b9d62[_0x1f1a('0x28')];if(_0x4035ab[_0x1f1a('0x2b')][_0x1f1a('0x3b')]){_0x1b70f9[_0x1f1a('0x3c')]=[{'all':!![]}];}_0x1b70f9=_['merge']({},_0x1b70f9,_0x4035ab[_0x1f1a('0x42')]);return db[_0x1f1a('0x25')][_0x1f1a('0x43')](_0x1b70f9)[_0x1f1a('0x22')](handleEntityNotFound(_0x5deb90,null))[_0x1f1a('0x22')](respondWithResult(_0x5deb90,null))[_0x1f1a('0x3f')](handleError(_0x5deb90,null));};exports['create']=function(_0x23d070,_0x5baae3){return db[_0x1f1a('0x25')][_0x1f1a('0x44')](_0x23d070['body'],{})[_0x1f1a('0x22')](respondWithResult(_0x5baae3,0xc9))[_0x1f1a('0x3f')](handleError(_0x5baae3,null));};exports[_0x1f1a('0x21')]=function(_0x331281,_0x3c0806){if(_0x331281[_0x1f1a('0x45')]['id']){delete _0x331281[_0x1f1a('0x45')]['id'];}return db[_0x1f1a('0x25')]['find']({'where':{'id':_0x331281['params']['id']}})[_0x1f1a('0x22')](handleEntityNotFound(_0x3c0806,null))[_0x1f1a('0x22')](saveUpdates(_0x331281['body'],null))[_0x1f1a('0x22')](respondWithResult(_0x3c0806,null))[_0x1f1a('0x3f')](handleError(_0x3c0806,null));};exports[_0x1f1a('0x46')]=function(_0x21009d,_0xa34c62){return db[_0x1f1a('0x25')][_0x1f1a('0x43')]({'where':{'id':_0x21009d['params']['id']}})[_0x1f1a('0x22')](handleEntityNotFound(_0xa34c62,null))[_0x1f1a('0x22')](removeEntity(_0xa34c62,null))['catch'](handleError(_0xa34c62,null));};exports[_0x1f1a('0x47')]=function(_0xdf23ba,_0x5d7a6a){return db['OpenchannelQueueReport'][_0x1f1a('0x47')]()[_0x1f1a('0x22')](respondWithResult(_0x5d7a6a,null))[_0x1f1a('0x3f')](handleError(_0x5d7a6a,null));}; \ No newline at end of file +var _0xef81=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','end','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x592125,_0x3c3e4a){var _0x536040=function(_0x2325d1){while(--_0x2325d1){_0x592125['push'](_0x592125['shift']());}};_0x536040(++_0x3c3e4a);}(_0xef81,0x67));var _0x1ef8=function(_0x3b8718,_0x3395d7){_0x3b8718=_0x3b8718-0x0;var _0x5bbce6=_0xef81[_0x3b8718];return _0x5bbce6;};'use strict';var emlformat=require(_0x1ef8('0x0'));var rimraf=require(_0x1ef8('0x1'));var zipdir=require(_0x1ef8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1ef8('0x3'));var BPromise=require(_0x1ef8('0x4'));var Mustache=require(_0x1ef8('0x5'));var util=require(_0x1ef8('0x6'));var path=require(_0x1ef8('0x7'));var sox=require(_0x1ef8('0x8'));var csv=require(_0x1ef8('0x9'));var ejs=require(_0x1ef8('0xa'));var fs=require('fs');var fs_extra=require(_0x1ef8('0xb'));var _=require(_0x1ef8('0xc'));var squel=require('squel');var crypto=require(_0x1ef8('0xd'));var jsforce=require(_0x1ef8('0xe'));var deskjs=require(_0x1ef8('0xf'));var toCsv=require(_0x1ef8('0x9'));var querystring=require(_0x1ef8('0x10'));var Papa=require(_0x1ef8('0x11'));var Redis=require('ioredis');var authService=require(_0x1ef8('0x12'));var qs=require(_0x1ef8('0x13'));var as=require(_0x1ef8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ef8('0x15'))(_0x1ef8('0x16'));var utils=require(_0x1ef8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1ef8('0x18'));var db=require(_0x1ef8('0x19'))['db'];function respondWithStatusCode(_0x5467ff,_0x6981ac){_0x6981ac=_0x6981ac||0xcc;return function(_0x3781f2){if(_0x3781f2){return _0x5467ff['sendStatus'](_0x6981ac);}return _0x5467ff[_0x1ef8('0x1a')](_0x6981ac)['end']();};}function respondWithResult(_0x305cd5,_0x145b35){_0x145b35=_0x145b35||0xc8;return function(_0x2bb649){if(_0x2bb649){return _0x305cd5[_0x1ef8('0x1a')](_0x145b35)[_0x1ef8('0x1b')](_0x2bb649);}};}function respondWithFilteredResult(_0x1540b3,_0x4be83c){return function(_0x6d38e){if(_0x6d38e){var _0x46c322=typeof _0x4be83c[_0x1ef8('0x1c')]===_0x1ef8('0x1d')&&typeof _0x4be83c['limit']===_0x1ef8('0x1d');var _0x422103=_0x6d38e[_0x1ef8('0x1e')];var _0x56c094=_0x46c322?0x0:_0x4be83c[_0x1ef8('0x1c')];var _0x12c45d=_0x46c322?_0x6d38e[_0x1ef8('0x1e')]:_0x4be83c['offset']+_0x4be83c[_0x1ef8('0x1f')];var _0x2cba33;if(_0x12c45d>=_0x422103){_0x12c45d=_0x422103;_0x2cba33=0xc8;}else{_0x2cba33=0xce;}_0x1540b3[_0x1ef8('0x1a')](_0x2cba33);return _0x1540b3[_0x1ef8('0x20')](_0x1ef8('0x21'),_0x56c094+'-'+_0x12c45d+'/'+_0x422103)[_0x1ef8('0x1b')](_0x6d38e);}return null;};}function patchUpdates(_0x52eda3){return function(_0x2c2bb0){try{jsonpatch[_0x1ef8('0x22')](_0x2c2bb0,_0x52eda3,!![]);}catch(_0x475939){return BPromise['reject'](_0x475939);}return _0x2c2bb0[_0x1ef8('0x23')]();};}function saveUpdates(_0x3bce33,_0x2e0115){return function(_0x57e45a){if(_0x57e45a){return _0x57e45a[_0x1ef8('0x24')](_0x3bce33)['then'](function(_0x22a4de){return _0x22a4de;});}return null;};}function removeEntity(_0x449f17,_0x481bfb){return function(_0x39efce){if(_0x39efce){return _0x39efce[_0x1ef8('0x25')]()['then'](function(){_0x449f17[_0x1ef8('0x1a')](0xcc)[_0x1ef8('0x26')]();});}};}function handleEntityNotFound(_0x5a0cab,_0x3d7107){return function(_0xa9f682){if(!_0xa9f682){_0x5a0cab[_0x1ef8('0x27')](0x194);}return _0xa9f682;};}function handleError(_0x3fc93d,_0x5e59ee){_0x5e59ee=_0x5e59ee||0x1f4;return function(_0x4cc550){logger[_0x1ef8('0x28')](_0x4cc550[_0x1ef8('0x29')]);if(_0x4cc550[_0x1ef8('0x2a')]){delete _0x4cc550[_0x1ef8('0x2a')];}_0x3fc93d[_0x1ef8('0x1a')](_0x5e59ee)[_0x1ef8('0x2b')](_0x4cc550);};}exports[_0x1ef8('0x2c')]=function(_0x2ab607,_0x474e58){var _0x4149e9={},_0x4bb81e={},_0x24583c={'count':0x0,'rows':[]};var _0x314a85=_[_0x1ef8('0x2d')](db[_0x1ef8('0x2e')][_0x1ef8('0x2f')],function(_0x3d7c5c){return{'name':_0x3d7c5c[_0x1ef8('0x30')],'type':_0x3d7c5c[_0x1ef8('0x31')]['key']};});_0x4bb81e[_0x1ef8('0x32')]=_[_0x1ef8('0x2d')](_0x314a85,_0x1ef8('0x2a'));_0x4bb81e[_0x1ef8('0x33')]=_[_0x1ef8('0x34')](_0x2ab607[_0x1ef8('0x33')]);_0x4bb81e[_0x1ef8('0x35')]=_[_0x1ef8('0x36')](_0x4bb81e[_0x1ef8('0x32')],_0x4bb81e['query']);_0x4149e9[_0x1ef8('0x37')]=_[_0x1ef8('0x36')](_0x4bb81e[_0x1ef8('0x32')],qs[_0x1ef8('0x38')](_0x2ab607['query'][_0x1ef8('0x38')]));_0x4149e9[_0x1ef8('0x37')]=_0x4149e9[_0x1ef8('0x37')]['length']?_0x4149e9[_0x1ef8('0x37')]:_0x4bb81e[_0x1ef8('0x32')];if(!_0x2ab607[_0x1ef8('0x33')][_0x1ef8('0x39')](_0x1ef8('0x3a'))){_0x4149e9[_0x1ef8('0x1f')]=qs['limit'](_0x2ab607[_0x1ef8('0x33')]['limit']);_0x4149e9[_0x1ef8('0x1c')]=qs['offset'](_0x2ab607[_0x1ef8('0x33')]['offset']);}_0x4149e9[_0x1ef8('0x3b')]=qs[_0x1ef8('0x3c')](_0x2ab607[_0x1ef8('0x33')][_0x1ef8('0x3c')]);_0x4149e9[_0x1ef8('0x3d')]=qs[_0x1ef8('0x35')](_[_0x1ef8('0x3e')](_0x2ab607[_0x1ef8('0x33')],_0x4bb81e[_0x1ef8('0x35')]),_0x314a85);if(_0x2ab607[_0x1ef8('0x33')][_0x1ef8('0x3f')]){_0x4149e9[_0x1ef8('0x3d')]=_[_0x1ef8('0x40')](_0x4149e9[_0x1ef8('0x3d')],{'$or':_[_0x1ef8('0x2d')](_0x314a85,function(_0x439353){if(_0x439353['type']!==_0x1ef8('0x41')){var _0x266657={};_0x266657[_0x439353['name']]={'$like':'%'+_0x2ab607[_0x1ef8('0x33')][_0x1ef8('0x3f')]+'%'};return _0x266657;}})});}_0x4149e9=_[_0x1ef8('0x40')]({},_0x4149e9,_0x2ab607[_0x1ef8('0x42')]);var _0x565d37={'where':_0x4149e9[_0x1ef8('0x3d')]};return db[_0x1ef8('0x2e')][_0x1ef8('0x1e')](_0x565d37)[_0x1ef8('0x43')](function(_0x2c0ad8){_0x24583c[_0x1ef8('0x1e')]=_0x2c0ad8;if(_0x2ab607[_0x1ef8('0x33')][_0x1ef8('0x44')]){_0x4149e9[_0x1ef8('0x45')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x1ef8('0x46')](_0x4149e9);})['then'](function(_0xcca809){_0x24583c[_0x1ef8('0x47')]=_0xcca809;return _0x24583c;})['then'](respondWithFilteredResult(_0x474e58,_0x4149e9))[_0x1ef8('0x48')](handleError(_0x474e58,null));};exports['show']=function(_0x2cda55,_0x2a5e96){var _0x46f426={'raw':!![],'where':{'id':_0x2cda55[_0x1ef8('0x49')]['id']}},_0x12d9c8={};_0x12d9c8[_0x1ef8('0x32')]=_['keys'](db[_0x1ef8('0x2e')][_0x1ef8('0x2f')]);_0x12d9c8[_0x1ef8('0x33')]=_[_0x1ef8('0x34')](_0x2cda55[_0x1ef8('0x33')]);_0x12d9c8['filters']=_['intersection'](_0x12d9c8[_0x1ef8('0x32')],_0x12d9c8[_0x1ef8('0x33')]);_0x46f426['attributes']=_['intersection'](_0x12d9c8[_0x1ef8('0x32')],qs['fields'](_0x2cda55[_0x1ef8('0x33')][_0x1ef8('0x38')]));_0x46f426[_0x1ef8('0x37')]=_0x46f426['attributes'][_0x1ef8('0x4a')]?_0x46f426[_0x1ef8('0x37')]:_0x12d9c8[_0x1ef8('0x32')];if(_0x2cda55[_0x1ef8('0x33')][_0x1ef8('0x44')]){_0x46f426[_0x1ef8('0x45')]=[{'all':!![]}];}_0x46f426=_['merge']({},_0x46f426,_0x2cda55[_0x1ef8('0x42')]);return db[_0x1ef8('0x2e')][_0x1ef8('0x4b')](_0x46f426)[_0x1ef8('0x43')](handleEntityNotFound(_0x2a5e96,null))[_0x1ef8('0x43')](respondWithResult(_0x2a5e96,null))[_0x1ef8('0x48')](handleError(_0x2a5e96,null));};exports[_0x1ef8('0x4c')]=function(_0x2ce6f6,_0x21e6ce){return db[_0x1ef8('0x2e')][_0x1ef8('0x4c')](_0x2ce6f6[_0x1ef8('0x4d')],{})[_0x1ef8('0x43')](respondWithResult(_0x21e6ce,0xc9))['catch'](handleError(_0x21e6ce,null));};exports['update']=function(_0x5e2b6d,_0xc3e652){if(_0x5e2b6d['body']['id']){delete _0x5e2b6d[_0x1ef8('0x4d')]['id'];}return db[_0x1ef8('0x2e')][_0x1ef8('0x4b')]({'where':{'id':_0x5e2b6d[_0x1ef8('0x49')]['id']}})[_0x1ef8('0x43')](handleEntityNotFound(_0xc3e652,null))[_0x1ef8('0x43')](saveUpdates(_0x5e2b6d['body'],null))['then'](respondWithResult(_0xc3e652,null))['catch'](handleError(_0xc3e652,null));};exports[_0x1ef8('0x25')]=function(_0x629b4,_0x42338c){return db[_0x1ef8('0x2e')][_0x1ef8('0x4b')]({'where':{'id':_0x629b4[_0x1ef8('0x49')]['id']}})[_0x1ef8('0x43')](handleEntityNotFound(_0x42338c,null))['then'](removeEntity(_0x42338c,null))[_0x1ef8('0x48')](handleError(_0x42338c,null));};exports[_0x1ef8('0x4e')]=function(_0x1764f1,_0x3a1c17){return db[_0x1ef8('0x2e')][_0x1ef8('0x4e')]()[_0x1ef8('0x43')](respondWithResult(_0x3a1c17,null))[_0x1ef8('0x48')](handleError(_0x3a1c17,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4571fff..933f2ac 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(_0x573203,_0x2f2246){var _0x3b7167=function(_0x4716e9){while(--_0x4716e9){_0x573203['push'](_0x573203['shift']());}};_0x3b7167(++_0x2f2246);}(_0x7a54,0x106));var _0x47a5=function(_0x3b44b2,_0x5690){_0x3b44b2=_0x3b44b2-0x0;var _0xfa21dc=_0x7a54[_0x3b44b2];return _0xfa21dc;};'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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x3007da,_0x5b363c){var _0x20e187=function(_0x1118d5){while(--_0x1118d5){_0x3007da['push'](_0x3007da['shift']());}};_0x20e187(++_0x5b363c);}(_0x326f,0xd1));var _0xf326=function(_0x321ace,_0x306589){_0x321ace=_0x321ace-0x0;var _0x4cec9f=_0x326f[_0x321ace];return _0x4cec9f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 21525c3..ea05659 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 _0xd4f4=['options','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelQueueReport','create','body'];(function(_0x548ebc,_0x8395d0){var _0x228ab5=function(_0x532213){while(--_0x532213){_0x548ebc['push'](_0x548ebc['shift']());}};_0x228ab5(++_0x8395d0);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x32ba0a,_0x313b51){_0x32ba0a=_0x32ba0a-0x0;var _0x4cabfb=_0xd4f4[_0x32ba0a];return _0x4cabfb;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});}exports[_0x4d4f('0x17')]=function(_0x51dcf1){var _0x5dbbeb=this;return new Promise(function(_0x519501,_0x5a58af){return db['OpenchannelQueueReport'][_0x4d4f('0x18')](_0x51dcf1[_0x4d4f('0x19')],{'raw':_0x51dcf1[_0x4d4f('0x1a')]?_0x51dcf1[_0x4d4f('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e1ae2){logger['info'](_0x4d4f('0x17'),_0x51dcf1);logger[_0x4d4f('0x10')](_0x4d4f('0x17'),_0x51dcf1,JSON[_0x4d4f('0x12')](_0x1e1ae2));_0x519501(_0x1e1ae2);})[_0x4d4f('0x16')](function(_0x5beab4){logger['error'](_0x4d4f('0x17'),_0x5beab4['message'],_0x51dcf1);_0x5a58af(_0x5dbbeb[_0x4d4f('0x13')](0x1f4,_0x5beab4[_0x4d4f('0x15')]));});});};exports[_0x4d4f('0x1b')]=function(_0x3f4a55){var _0xf3f7a4=this;return new Promise(function(_0x497cec,_0x44bd2f){return db[_0x4d4f('0x1c')][_0x4d4f('0x1d')](_0x3f4a55[_0x4d4f('0x19')],{'raw':_0x3f4a55['options']?_0x3f4a55['options'][_0x4d4f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4a55[_0x4d4f('0x1a')]?_0x3f4a55[_0x4d4f('0x1a')][_0x4d4f('0x1f')]||null:null,'attributes':_0x3f4a55['options']?_0x3f4a55[_0x4d4f('0x1a')][_0x4d4f('0x20')]||null:null,'limit':_0x3f4a55[_0x4d4f('0x1a')]?_0x3f4a55[_0x4d4f('0x1a')]['limit']||null:null})[_0x4d4f('0xc')](function(_0x51cb3d){logger[_0x4d4f('0xd')](_0x4d4f('0x1b'),_0x3f4a55);logger['debug'](_0x4d4f('0x1b'),_0x3f4a55,JSON[_0x4d4f('0x12')](_0x51cb3d));_0x497cec(_0x51cb3d);})[_0x4d4f('0x16')](function(_0x3d7f14){logger[_0x4d4f('0x13')](_0x4d4f('0x1b'),_0x3d7f14['message'],_0x3f4a55);_0x44bd2f(_0xf3f7a4[_0x4d4f('0x13')](0x1f4,_0x3d7f14[_0x4d4f('0x15')]));});});}; \ No newline at end of file +var _0x4b0f=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','body','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5d9449,_0x5382b7){var _0x583cf7=function(_0x30464f){while(--_0x30464f){_0x5d9449['push'](_0x5d9449['shift']());}};_0x583cf7(++_0x5382b7);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x4e6fc7,_0x6b9a5d){_0x4e6fc7=_0x4e6fc7-0x0;var _0x3c2ef6=_0x4b0f[_0x4e6fc7];return _0x3c2ef6;};'use strict';var _=require('lodash');var util=require(_0xf4b0('0x0'));var moment=require(_0xf4b0('0x1'));var BPromise=require(_0xf4b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4b0('0x3'));var db=require(_0xf4b0('0x4'))['db'];var utils=require(_0xf4b0('0x5'));var logger=require(_0xf4b0('0x6'))(_0xf4b0('0x7'));var config=require(_0xf4b0('0x8'));var jayson=require(_0xf4b0('0x9'));var client=jayson[_0xf4b0('0xa')][_0xf4b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x373042,_0x300b64,_0x35160f){return new BPromise(function(_0x3a2236,_0xd132d8){return client[_0xf4b0('0xc')](_0x373042,_0x35160f)[_0xf4b0('0xd')](function(_0x4906e9){logger[_0xf4b0('0xe')](_0xf4b0('0xf'),_0x300b64,_0xf4b0('0x10'));logger[_0xf4b0('0x11')](_0xf4b0('0x12'),_0x300b64,_0xf4b0('0x10'),JSON[_0xf4b0('0x13')](_0x4906e9));if(_0x4906e9[_0xf4b0('0x14')]){if(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x15')]===0x1f4){logger[_0xf4b0('0x14')](_0xf4b0('0xf'),_0x300b64,_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);return _0xd132d8(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);}logger[_0xf4b0('0x14')](_0xf4b0('0xf'),_0x300b64,_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);return _0x3a2236(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);}else{logger['info'](_0xf4b0('0xf'),_0x300b64,_0xf4b0('0x10'));_0x3a2236(_0x4906e9[_0xf4b0('0x17')]['message']);}})[_0xf4b0('0x18')](function(_0x1f2d74){logger[_0xf4b0('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x300b64,_0x1f2d74);_0xd132d8(_0x1f2d74);});});}exports[_0xf4b0('0x19')]=function(_0x390dbd){var _0x3e8ade=this;return new Promise(function(_0x543c88,_0x4cffc2){return db[_0xf4b0('0x1a')][_0xf4b0('0x1b')](_0x390dbd['body'],{'raw':_0x390dbd['options']?_0x390dbd[_0xf4b0('0x1c')][_0xf4b0('0x1d')]===undefined?!![]:![]:!![]})[_0xf4b0('0xd')](function(_0x4e65cd){logger[_0xf4b0('0xe')](_0xf4b0('0x19'),_0x390dbd);logger[_0xf4b0('0x11')](_0xf4b0('0x19'),_0x390dbd,JSON[_0xf4b0('0x13')](_0x4e65cd));_0x543c88(_0x4e65cd);})[_0xf4b0('0x18')](function(_0x221b1d){logger['error'](_0xf4b0('0x19'),_0x221b1d[_0xf4b0('0x16')],_0x390dbd);_0x4cffc2(_0x3e8ade[_0xf4b0('0x14')](0x1f4,_0x221b1d[_0xf4b0('0x16')]));});});};exports[_0xf4b0('0x1e')]=function(_0x338975){var _0x28ecb0=this;return new Promise(function(_0x3d054e,_0x4a0da1){return db[_0xf4b0('0x1a')]['update'](_0x338975[_0xf4b0('0x1f')],{'raw':_0x338975[_0xf4b0('0x1c')]?_0x338975[_0xf4b0('0x1c')][_0xf4b0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x338975[_0xf4b0('0x1c')]?_0x338975[_0xf4b0('0x1c')]['where']||null:null,'attributes':_0x338975[_0xf4b0('0x1c')]?_0x338975[_0xf4b0('0x1c')][_0xf4b0('0x20')]||null:null,'limit':_0x338975['options']?_0x338975[_0xf4b0('0x1c')][_0xf4b0('0x21')]||null:null})[_0xf4b0('0xd')](function(_0x55bdc8){logger[_0xf4b0('0xe')](_0xf4b0('0x1e'),_0x338975);logger[_0xf4b0('0x11')](_0xf4b0('0x1e'),_0x338975,JSON[_0xf4b0('0x13')](_0x55bdc8));_0x3d054e(_0x55bdc8);})[_0xf4b0('0x18')](function(_0xd94c81){logger[_0xf4b0('0x14')]('UpdateOpenchannelQueueReport',_0xd94c81[_0xf4b0('0x16')],_0x338975);_0x4a0da1(_0x28ecb0[_0xf4b0('0x14')](0x1f4,_0xd94c81[_0xf4b0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8581fdd..7904bc9 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 _0x91e5=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91e5,0x18d));var _0x591e=function(_0x1ed75d,_0x164214){_0x1ed75d=_0x1ed75d-0x0;var _0x12fdfc=_0x91e5[_0x1ed75d];return _0x12fdfc;};'use strict';var multer=require(_0x591e('0x0'));var util=require(_0x591e('0x1'));var path=require(_0x591e('0x2'));var timeout=require(_0x591e('0x3'));var express=require('express');var router=express[_0x591e('0x4')]();var fs_extra=require(_0x591e('0x5'));var auth=require(_0x591e('0x6'));var interaction=require(_0x591e('0x7'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0x591e('0x8')]('/',auth[_0x591e('0x9')](),controller['index']);router['get'](_0x591e('0xa'),auth['isAuthenticated'](),controller[_0x591e('0xb')]);router['get'](_0x591e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x591e('0xd')]('/',auth['isAuthenticated'](),controller[_0x591e('0xe')]);router[_0x591e('0xf')](_0x591e('0xc'),auth[_0x591e('0x9')](),controller['update']);router[_0x591e('0x10')](_0x591e('0xc'),auth[_0x591e('0x9')](),controller[_0x591e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x29d4=['../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x273033,_0x24f181){var _0x1e6b54=function(_0x48750e){while(--_0x48750e){_0x273033['push'](_0x273033['shift']());}};_0x1e6b54(++_0x24f181);}(_0x29d4,0x1c7));var _0x429d=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x29d4[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x429d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x429d('0x5'));var controller=require(_0x429d('0x6'));router[_0x429d('0x7')]('/',auth[_0x429d('0x8')](),controller[_0x429d('0x9')]);router[_0x429d('0x7')](_0x429d('0xa'),auth[_0x429d('0x8')](),controller[_0x429d('0xb')]);router[_0x429d('0x7')](_0x429d('0xc'),auth[_0x429d('0x8')](),controller['show']);router[_0x429d('0xd')]('/',auth[_0x429d('0x8')](),controller[_0x429d('0xe')]);router[_0x429d('0xf')](_0x429d('0xc'),auth['isAuthenticated'](),controller[_0x429d('0x10')]);router[_0x429d('0x11')](_0x429d('0xc'),auth[_0x429d('0x8')](),controller[_0x429d('0x12')]);module[_0x429d('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 6bb3a9f..0b69f6e 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3fea13,_0x5ed39c){_0x3fea13=_0x3fea13-0x0;var _0x3e76dc=_0x9bde[_0x3fea13];return _0x3e76dc;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xc9fa38,_0x428f2d){var _0x3fd420=function(_0xd51986){while(--_0xd51986){_0xc9fa38['push'](_0xc9fa38['shift']());}};_0x3fd420(++_0x428f2d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x00bb[_0x37bd26];return _0xe83dc4;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 04964b5..8089c56 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 _0xb262=['name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','filter','includeAll','include','findAll','then','rows','catch','show','length','options','find','create','body','params','describe','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','error','stack'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xb262,0xfe));var _0x2b26=function(_0x27c27c,_0x53a14c){_0x27c27c=_0x27c27c-0x0;var _0x5ef7b1=_0xb262[_0x27c27c];return _0x5ef7b1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b26('0x0'));var rp=require(_0x2b26('0x1'));var moment=require(_0x2b26('0x2'));var BPromise=require(_0x2b26('0x3'));var Mustache=require(_0x2b26('0x4'));var util=require('util');var path=require(_0x2b26('0x5'));var sox=require(_0x2b26('0x6'));var csv=require(_0x2b26('0x7'));var ejs=require(_0x2b26('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b26('0x9'));var squel=require(_0x2b26('0xa'));var crypto=require(_0x2b26('0xb'));var jsforce=require(_0x2b26('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2b26('0x7'));var querystring=require(_0x2b26('0xd'));var Papa=require(_0x2b26('0xe'));var Redis=require(_0x2b26('0xf'));var authService=require(_0x2b26('0x10'));var qs=require(_0x2b26('0x11'));var as=require(_0x2b26('0x12'));var hardwareService=require(_0x2b26('0x13'));var logger=require('../../config/logger')(_0x2b26('0x14'));var utils=require('../../config/utils');var config=require(_0x2b26('0x15'));var licenseUtil=require(_0x2b26('0x16'));var db=require(_0x2b26('0x17'))['db'];function respondWithStatusCode(_0x4c066a,_0x5e1500){_0x5e1500=_0x5e1500||0xcc;return function(_0xe0c27e){if(_0xe0c27e){return _0x4c066a['sendStatus'](_0x5e1500);}return _0x4c066a[_0x2b26('0x18')](_0x5e1500)[_0x2b26('0x19')]();};}function respondWithResult(_0x3ee388,_0x372b2f){_0x372b2f=_0x372b2f||0xc8;return function(_0x3d11a1){if(_0x3d11a1){return _0x3ee388[_0x2b26('0x18')](_0x372b2f)['json'](_0x3d11a1);}};}function respondWithFilteredResult(_0x50e572,_0xea9306){return function(_0x42b289){if(_0x42b289){var _0x1ec2e1=typeof _0xea9306[_0x2b26('0x1a')]===_0x2b26('0x1b')&&typeof _0xea9306[_0x2b26('0x1c')]===_0x2b26('0x1b');var _0x50e4ed=_0x42b289[_0x2b26('0x1d')];var _0x9b7196=_0x1ec2e1?0x0:_0xea9306[_0x2b26('0x1a')];var _0xda6019=_0x1ec2e1?_0x42b289['count']:_0xea9306['offset']+_0xea9306[_0x2b26('0x1c')];var _0x5b61ae;if(_0xda6019>=_0x50e4ed){_0xda6019=_0x50e4ed;_0x5b61ae=0xc8;}else{_0x5b61ae=0xce;}_0x50e572[_0x2b26('0x18')](_0x5b61ae);return _0x50e572[_0x2b26('0x1e')](_0x2b26('0x1f'),_0x9b7196+'-'+_0xda6019+'/'+_0x50e4ed)['json'](_0x42b289);}return null;};}function patchUpdates(_0x4ba56e){return function(_0x2e5122){try{jsonpatch[_0x2b26('0x20')](_0x2e5122,_0x4ba56e,!![]);}catch(_0x5482d0){return BPromise[_0x2b26('0x21')](_0x5482d0);}return _0x2e5122[_0x2b26('0x22')]();};}function saveUpdates(_0x392797,_0x413ab4){return function(_0x455ec4){if(_0x455ec4){return _0x455ec4['update'](_0x392797)['then'](function(_0x1658c8){return _0x1658c8;});}return null;};}function removeEntity(_0x2153bf,_0x581234){return function(_0x121ffe){if(_0x121ffe){return _0x121ffe[_0x2b26('0x23')]()['then'](function(){_0x2153bf['status'](0xcc)[_0x2b26('0x19')]();});}};}function handleEntityNotFound(_0x5810bd,_0x250ef4){return function(_0x43fa64){if(!_0x43fa64){_0x5810bd['sendStatus'](0x194);}return _0x43fa64;};}function handleError(_0x4966fa,_0x30a8ba){_0x30a8ba=_0x30a8ba||0x1f4;return function(_0x176e50){logger[_0x2b26('0x24')](_0x176e50[_0x2b26('0x25')]);if(_0x176e50[_0x2b26('0x26')]){delete _0x176e50[_0x2b26('0x26')];}_0x4966fa[_0x2b26('0x18')](_0x30a8ba)[_0x2b26('0x27')](_0x176e50);};}exports[_0x2b26('0x28')]=function(_0x3d6c33,_0xe11763){var _0x26aad1={},_0x384f7f={},_0x31c291={'count':0x0,'rows':[]};var _0x115bbe=_[_0x2b26('0x29')](db[_0x2b26('0x2a')][_0x2b26('0x2b')],function(_0x3926aa){return{'name':_0x3926aa[_0x2b26('0x2c')],'type':_0x3926aa[_0x2b26('0x2d')]['key']};});_0x384f7f[_0x2b26('0x2e')]=_[_0x2b26('0x29')](_0x115bbe,'name');_0x384f7f[_0x2b26('0x2f')]=_[_0x2b26('0x30')](_0x3d6c33[_0x2b26('0x2f')]);_0x384f7f[_0x2b26('0x31')]=_[_0x2b26('0x32')](_0x384f7f[_0x2b26('0x2e')],_0x384f7f[_0x2b26('0x2f')]);_0x26aad1[_0x2b26('0x33')]=_[_0x2b26('0x32')](_0x384f7f[_0x2b26('0x2e')],qs[_0x2b26('0x34')](_0x3d6c33['query'][_0x2b26('0x34')]));_0x26aad1[_0x2b26('0x33')]=_0x26aad1[_0x2b26('0x33')]['length']?_0x26aad1[_0x2b26('0x33')]:_0x384f7f[_0x2b26('0x2e')];if(!_0x3d6c33[_0x2b26('0x2f')]['hasOwnProperty'](_0x2b26('0x35'))){_0x26aad1['limit']=qs['limit'](_0x3d6c33[_0x2b26('0x2f')][_0x2b26('0x1c')]);_0x26aad1['offset']=qs[_0x2b26('0x1a')](_0x3d6c33[_0x2b26('0x2f')]['offset']);}_0x26aad1[_0x2b26('0x36')]=qs['sort'](_0x3d6c33[_0x2b26('0x2f')][_0x2b26('0x37')]);_0x26aad1[_0x2b26('0x38')]=qs[_0x2b26('0x31')](_['pick'](_0x3d6c33[_0x2b26('0x2f')],_0x384f7f[_0x2b26('0x31')]),_0x115bbe);if(_0x3d6c33['query']['filter']){_0x26aad1['where']=_[_0x2b26('0x39')](_0x26aad1[_0x2b26('0x38')],{'$or':_[_0x2b26('0x29')](_0x115bbe,function(_0x49db6d){if(_0x49db6d[_0x2b26('0x2d')]!=='VIRTUAL'){var _0x46844d={};_0x46844d[_0x49db6d[_0x2b26('0x26')]]={'$like':'%'+_0x3d6c33[_0x2b26('0x2f')][_0x2b26('0x3a')]+'%'};return _0x46844d;}})});}_0x26aad1=_[_0x2b26('0x39')]({},_0x26aad1,_0x3d6c33['options']);var _0x354239={'where':_0x26aad1[_0x2b26('0x38')]};return db[_0x2b26('0x2a')][_0x2b26('0x1d')](_0x354239)['then'](function(_0x2ac68c){_0x31c291[_0x2b26('0x1d')]=_0x2ac68c;if(_0x3d6c33[_0x2b26('0x2f')][_0x2b26('0x3b')]){_0x26aad1[_0x2b26('0x3c')]=[{'all':!![]}];}return db[_0x2b26('0x2a')][_0x2b26('0x3d')](_0x26aad1);})[_0x2b26('0x3e')](function(_0x5d174f){_0x31c291[_0x2b26('0x3f')]=_0x5d174f;return _0x31c291;})[_0x2b26('0x3e')](respondWithFilteredResult(_0xe11763,_0x26aad1))[_0x2b26('0x40')](handleError(_0xe11763,null));};exports[_0x2b26('0x41')]=function(_0x7124c7,_0x46a484){var _0x28f25b={'raw':!![],'where':{'id':_0x7124c7['params']['id']}},_0x21b2a4={};_0x21b2a4['model']=_['keys'](db[_0x2b26('0x2a')][_0x2b26('0x2b')]);_0x21b2a4[_0x2b26('0x2f')]=_[_0x2b26('0x30')](_0x7124c7[_0x2b26('0x2f')]);_0x21b2a4[_0x2b26('0x31')]=_[_0x2b26('0x32')](_0x21b2a4['model'],_0x21b2a4[_0x2b26('0x2f')]);_0x28f25b['attributes']=_[_0x2b26('0x32')](_0x21b2a4[_0x2b26('0x2e')],qs[_0x2b26('0x34')](_0x7124c7[_0x2b26('0x2f')][_0x2b26('0x34')]));_0x28f25b[_0x2b26('0x33')]=_0x28f25b[_0x2b26('0x33')][_0x2b26('0x42')]?_0x28f25b['attributes']:_0x21b2a4[_0x2b26('0x2e')];if(_0x7124c7[_0x2b26('0x2f')][_0x2b26('0x3b')]){_0x28f25b[_0x2b26('0x3c')]=[{'all':!![]}];}_0x28f25b=_[_0x2b26('0x39')]({},_0x28f25b,_0x7124c7[_0x2b26('0x43')]);return db[_0x2b26('0x2a')][_0x2b26('0x44')](_0x28f25b)[_0x2b26('0x3e')](handleEntityNotFound(_0x46a484,null))[_0x2b26('0x3e')](respondWithResult(_0x46a484,null))[_0x2b26('0x40')](handleError(_0x46a484,null));};exports[_0x2b26('0x45')]=function(_0x312ab5,_0x453d4a){return db[_0x2b26('0x2a')]['create'](_0x312ab5['body'],{})[_0x2b26('0x3e')](respondWithResult(_0x453d4a,0xc9))[_0x2b26('0x40')](handleError(_0x453d4a,null));};exports['update']=function(_0x193f45,_0x434902){if(_0x193f45[_0x2b26('0x46')]['id']){delete _0x193f45[_0x2b26('0x46')]['id'];}return db[_0x2b26('0x2a')][_0x2b26('0x44')]({'where':{'id':_0x193f45[_0x2b26('0x47')]['id']}})['then'](handleEntityNotFound(_0x434902,null))[_0x2b26('0x3e')](saveUpdates(_0x193f45[_0x2b26('0x46')],null))[_0x2b26('0x3e')](respondWithResult(_0x434902,null))[_0x2b26('0x40')](handleError(_0x434902,null));};exports[_0x2b26('0x23')]=function(_0xa332a5,_0x59c27c){return db[_0x2b26('0x2a')]['find']({'where':{'id':_0xa332a5[_0x2b26('0x47')]['id']}})[_0x2b26('0x3e')](handleEntityNotFound(_0x59c27c,null))[_0x2b26('0x3e')](removeEntity(_0x59c27c,null))['catch'](handleError(_0x59c27c,null));};exports[_0x2b26('0x48')]=function(_0x12e8da,_0x5b3b2a){return db['OpenchannelTransferReport'][_0x2b26('0x48')]()['then'](respondWithResult(_0x5b3b2a,null))[_0x2b26('0x40')](handleError(_0x5b3b2a,null));}; \ No newline at end of file +var _0x4a6f=['zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','describe','eml-format'];(function(_0x28e68d,_0x29eb88){var _0x504faf=function(_0x412920){while(--_0x412920){_0x28e68d['push'](_0x28e68d['shift']());}};_0x504faf(++_0x29eb88);}(_0x4a6f,0xdd));var _0xf4a6=function(_0xd50b7f,_0x53c16c){_0xd50b7f=_0xd50b7f-0x0;var _0x380972=_0x4a6f[_0xd50b7f];return _0x380972;};'use strict';var emlformat=require(_0xf4a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf4a6('0x1'));var jsonpatch=require(_0xf4a6('0x2'));var rp=require('request-promise');var moment=require(_0xf4a6('0x3'));var BPromise=require(_0xf4a6('0x4'));var Mustache=require(_0xf4a6('0x5'));var util=require('util');var path=require(_0xf4a6('0x6'));var sox=require('sox');var csv=require(_0xf4a6('0x7'));var ejs=require(_0xf4a6('0x8'));var fs=require('fs');var fs_extra=require(_0xf4a6('0x9'));var _=require(_0xf4a6('0xa'));var squel=require('squel');var crypto=require(_0xf4a6('0xb'));var jsforce=require(_0xf4a6('0xc'));var deskjs=require(_0xf4a6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf4a6('0xe'));var Papa=require(_0xf4a6('0xf'));var Redis=require(_0xf4a6('0x10'));var authService=require(_0xf4a6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf4a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4a6('0x13'))(_0xf4a6('0x14'));var utils=require(_0xf4a6('0x15'));var config=require(_0xf4a6('0x16'));var licenseUtil=require(_0xf4a6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f0d5d,_0x349f72){_0x349f72=_0x349f72||0xcc;return function(_0x377917){if(_0x377917){return _0x2f0d5d[_0xf4a6('0x18')](_0x349f72);}return _0x2f0d5d[_0xf4a6('0x19')](_0x349f72)[_0xf4a6('0x1a')]();};}function respondWithResult(_0x2a17e4,_0x3b1e4e){_0x3b1e4e=_0x3b1e4e||0xc8;return function(_0x446d8a){if(_0x446d8a){return _0x2a17e4[_0xf4a6('0x19')](_0x3b1e4e)['json'](_0x446d8a);}};}function respondWithFilteredResult(_0x1b56e7,_0x568b26){return function(_0x3b8999){if(_0x3b8999){var _0x58a280=typeof _0x568b26[_0xf4a6('0x1b')]===_0xf4a6('0x1c')&&typeof _0x568b26[_0xf4a6('0x1d')]==='undefined';var _0x10f5cc=_0x3b8999[_0xf4a6('0x1e')];var _0x54ea3e=_0x58a280?0x0:_0x568b26[_0xf4a6('0x1b')];var _0xaf4287=_0x58a280?_0x3b8999['count']:_0x568b26[_0xf4a6('0x1b')]+_0x568b26[_0xf4a6('0x1d')];var _0x3dac1e;if(_0xaf4287>=_0x10f5cc){_0xaf4287=_0x10f5cc;_0x3dac1e=0xc8;}else{_0x3dac1e=0xce;}_0x1b56e7[_0xf4a6('0x19')](_0x3dac1e);return _0x1b56e7[_0xf4a6('0x1f')](_0xf4a6('0x20'),_0x54ea3e+'-'+_0xaf4287+'/'+_0x10f5cc)[_0xf4a6('0x21')](_0x3b8999);}return null;};}function patchUpdates(_0x3fa8f9){return function(_0x1323f6){try{jsonpatch['apply'](_0x1323f6,_0x3fa8f9,!![]);}catch(_0x31d7a9){return BPromise['reject'](_0x31d7a9);}return _0x1323f6[_0xf4a6('0x22')]();};}function saveUpdates(_0x3b931b,_0x1364ed){return function(_0x21f62d){if(_0x21f62d){return _0x21f62d[_0xf4a6('0x23')](_0x3b931b)[_0xf4a6('0x24')](function(_0x55ba5d){return _0x55ba5d;});}return null;};}function removeEntity(_0x553115,_0x53b1b2){return function(_0x23c7d0){if(_0x23c7d0){return _0x23c7d0[_0xf4a6('0x25')]()[_0xf4a6('0x24')](function(){_0x553115['status'](0xcc)[_0xf4a6('0x1a')]();});}};}function handleEntityNotFound(_0x452f5b,_0x17f63d){return function(_0xecf6e5){if(!_0xecf6e5){_0x452f5b[_0xf4a6('0x18')](0x194);}return _0xecf6e5;};}function handleError(_0x52895d,_0xf30676){_0xf30676=_0xf30676||0x1f4;return function(_0x4bd97d){logger[_0xf4a6('0x26')](_0x4bd97d[_0xf4a6('0x27')]);if(_0x4bd97d[_0xf4a6('0x28')]){delete _0x4bd97d[_0xf4a6('0x28')];}_0x52895d[_0xf4a6('0x19')](_0xf30676)[_0xf4a6('0x29')](_0x4bd97d);};}exports[_0xf4a6('0x2a')]=function(_0x2b7d6d,_0x6d018a){var _0x526e7c={},_0x550bf0={},_0x321a8f={'count':0x0,'rows':[]};var _0x2c597e=_[_0xf4a6('0x2b')](db[_0xf4a6('0x2c')][_0xf4a6('0x2d')],function(_0x17ac08){return{'name':_0x17ac08['fieldName'],'type':_0x17ac08[_0xf4a6('0x2e')][_0xf4a6('0x2f')]};});_0x550bf0[_0xf4a6('0x30')]=_[_0xf4a6('0x2b')](_0x2c597e,_0xf4a6('0x28'));_0x550bf0[_0xf4a6('0x31')]=_['keys'](_0x2b7d6d[_0xf4a6('0x31')]);_0x550bf0[_0xf4a6('0x32')]=_[_0xf4a6('0x33')](_0x550bf0[_0xf4a6('0x30')],_0x550bf0[_0xf4a6('0x31')]);_0x526e7c[_0xf4a6('0x34')]=_[_0xf4a6('0x33')](_0x550bf0[_0xf4a6('0x30')],qs['fields'](_0x2b7d6d[_0xf4a6('0x31')][_0xf4a6('0x35')]));_0x526e7c[_0xf4a6('0x34')]=_0x526e7c[_0xf4a6('0x34')]['length']?_0x526e7c['attributes']:_0x550bf0[_0xf4a6('0x30')];if(!_0x2b7d6d[_0xf4a6('0x31')]['hasOwnProperty']('nolimit')){_0x526e7c[_0xf4a6('0x1d')]=qs[_0xf4a6('0x1d')](_0x2b7d6d['query'][_0xf4a6('0x1d')]);_0x526e7c[_0xf4a6('0x1b')]=qs['offset'](_0x2b7d6d[_0xf4a6('0x31')][_0xf4a6('0x1b')]);}_0x526e7c[_0xf4a6('0x36')]=qs[_0xf4a6('0x37')](_0x2b7d6d[_0xf4a6('0x31')]['sort']);_0x526e7c[_0xf4a6('0x38')]=qs[_0xf4a6('0x32')](_[_0xf4a6('0x39')](_0x2b7d6d[_0xf4a6('0x31')],_0x550bf0[_0xf4a6('0x32')]),_0x2c597e);if(_0x2b7d6d['query'][_0xf4a6('0x3a')]){_0x526e7c['where']=_[_0xf4a6('0x3b')](_0x526e7c[_0xf4a6('0x38')],{'$or':_['map'](_0x2c597e,function(_0x2da280){if(_0x2da280[_0xf4a6('0x2e')]!=='VIRTUAL'){var _0x1a373c={};_0x1a373c[_0x2da280[_0xf4a6('0x28')]]={'$like':'%'+_0x2b7d6d[_0xf4a6('0x31')][_0xf4a6('0x3a')]+'%'};return _0x1a373c;}})});}_0x526e7c=_['merge']({},_0x526e7c,_0x2b7d6d[_0xf4a6('0x3c')]);var _0x4c7c1f={'where':_0x526e7c[_0xf4a6('0x38')]};return db[_0xf4a6('0x2c')][_0xf4a6('0x1e')](_0x4c7c1f)[_0xf4a6('0x24')](function(_0x3d506d){_0x321a8f['count']=_0x3d506d;if(_0x2b7d6d[_0xf4a6('0x31')][_0xf4a6('0x3d')]){_0x526e7c[_0xf4a6('0x3e')]=[{'all':!![]}];}return db[_0xf4a6('0x2c')][_0xf4a6('0x3f')](_0x526e7c);})[_0xf4a6('0x24')](function(_0x457bd7){_0x321a8f[_0xf4a6('0x40')]=_0x457bd7;return _0x321a8f;})[_0xf4a6('0x24')](respondWithFilteredResult(_0x6d018a,_0x526e7c))[_0xf4a6('0x41')](handleError(_0x6d018a,null));};exports[_0xf4a6('0x42')]=function(_0x5807e7,_0x42fd53){var _0x560725={'raw':!![],'where':{'id':_0x5807e7[_0xf4a6('0x43')]['id']}},_0x252c1a={};_0x252c1a[_0xf4a6('0x30')]=_[_0xf4a6('0x44')](db[_0xf4a6('0x2c')][_0xf4a6('0x2d')]);_0x252c1a[_0xf4a6('0x31')]=_[_0xf4a6('0x44')](_0x5807e7[_0xf4a6('0x31')]);_0x252c1a[_0xf4a6('0x32')]=_[_0xf4a6('0x33')](_0x252c1a[_0xf4a6('0x30')],_0x252c1a['query']);_0x560725['attributes']=_['intersection'](_0x252c1a[_0xf4a6('0x30')],qs[_0xf4a6('0x35')](_0x5807e7[_0xf4a6('0x31')]['fields']));_0x560725[_0xf4a6('0x34')]=_0x560725[_0xf4a6('0x34')][_0xf4a6('0x45')]?_0x560725[_0xf4a6('0x34')]:_0x252c1a[_0xf4a6('0x30')];if(_0x5807e7['query'][_0xf4a6('0x3d')]){_0x560725[_0xf4a6('0x3e')]=[{'all':!![]}];}_0x560725=_[_0xf4a6('0x3b')]({},_0x560725,_0x5807e7[_0xf4a6('0x3c')]);return db[_0xf4a6('0x2c')]['find'](_0x560725)['then'](handleEntityNotFound(_0x42fd53,null))[_0xf4a6('0x24')](respondWithResult(_0x42fd53,null))['catch'](handleError(_0x42fd53,null));};exports[_0xf4a6('0x46')]=function(_0x5296b8,_0x557788){return db[_0xf4a6('0x2c')]['create'](_0x5296b8[_0xf4a6('0x47')],{})[_0xf4a6('0x24')](respondWithResult(_0x557788,0xc9))[_0xf4a6('0x41')](handleError(_0x557788,null));};exports[_0xf4a6('0x23')]=function(_0x4117b2,_0x25e4ae){if(_0x4117b2[_0xf4a6('0x47')]['id']){delete _0x4117b2[_0xf4a6('0x47')]['id'];}return db[_0xf4a6('0x2c')]['find']({'where':{'id':_0x4117b2['params']['id']}})[_0xf4a6('0x24')](handleEntityNotFound(_0x25e4ae,null))['then'](saveUpdates(_0x4117b2[_0xf4a6('0x47')],null))['then'](respondWithResult(_0x25e4ae,null))[_0xf4a6('0x41')](handleError(_0x25e4ae,null));};exports['destroy']=function(_0x28adaf,_0x177273){return db['OpenchannelTransferReport'][_0xf4a6('0x48')]({'where':{'id':_0x28adaf[_0xf4a6('0x43')]['id']}})[_0xf4a6('0x24')](handleEntityNotFound(_0x177273,null))[_0xf4a6('0x24')](removeEntity(_0x177273,null))[_0xf4a6('0x41')](handleError(_0x177273,null));};exports[_0xf4a6('0x49')]=function(_0x2afade,_0x456861){return db[_0xf4a6('0x2c')]['describe']()[_0xf4a6('0x24')](respondWithResult(_0x456861,null))[_0xf4a6('0x41')](handleError(_0x456861,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 273e8e4..1eb5246 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 _0x52c3=['bluebird','rimraf','../../config/environment','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x4b541d,_0x55bf69){var _0xf1e5d3=function(_0x8a1f6d){while(--_0x8a1f6d){_0x4b541d['push'](_0x4b541d['shift']());}};_0xf1e5d3(++_0x55bf69);}(_0x52c3,0x180));var _0x352c=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x52c3[_0x67f95e];return _0x538f5a;};'use strict';var _=require(_0x352c('0x0'));var util=require(_0x352c('0x1'));var logger=require(_0x352c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x352c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x352c('0x4'));var config=require(_0x352c('0x5'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x7c0735,_0xebfb9a){return _0x7c0735[_0x352c('0x6')]('OpenchannelTransferReport',attributes,{'tableName':_0x352c('0x7'),'paranoid':![],'indexes':[{'name':_0x352c('0x8'),'fields':[_0x352c('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd0a=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0xbd0a,0xd8));var _0xabd0=function(_0x3d7edc,_0x2ebe98){_0x3d7edc=_0x3d7edc-0x0;var _0x286193=_0xbd0a[_0x3d7edc];return _0x286193;};'use strict';var _=require(_0xabd0('0x0'));var util=require(_0xabd0('0x1'));var logger=require(_0xabd0('0x2'))(_0xabd0('0x3'));var moment=require(_0xabd0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xabd0('0x5'));var rimraf=require(_0xabd0('0x6'));var config=require(_0xabd0('0x7'));var attributes=require(_0xabd0('0x8'));module['exports']=function(_0x2a5605,_0x329603){return _0x2a5605[_0xabd0('0x9')](_0xabd0('0xa'),attributes,{'tableName':_0xabd0('0xb'),'paranoid':![],'indexes':[{'name':_0xabd0('0xc'),'fields':[_0xabd0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index f70dbbe..04a74e1 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 _0x28e3=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x28e3,0x106));var _0x328e=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x28e3[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0x328e('0x0'));var util=require(_0x328e('0x1'));var moment=require(_0x328e('0x2'));var BPromise=require(_0x328e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x328e('0x4'));var db=require(_0x328e('0x5'))['db'];var utils=require(_0x328e('0x6'));var logger=require(_0x328e('0x7'))(_0x328e('0x8'));var config=require(_0x328e('0x9'));var jayson=require(_0x328e('0xa'));var client=jayson[_0x328e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5c91,_0x58885f,_0x2bddaa){return new BPromise(function(_0x3696b6,_0x3467ee){return client[_0x328e('0xc')](_0x4b5c91,_0x2bddaa)[_0x328e('0xd')](function(_0x4a4f53){logger[_0x328e('0xe')](_0x328e('0xf'),_0x58885f,_0x328e('0x10'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x58885f,'request\x20sent',JSON[_0x328e('0x11')](_0x4a4f53));if(_0x4a4f53[_0x328e('0x12')]){if(_0x4a4f53[_0x328e('0x12')][_0x328e('0x13')]===0x1f4){logger[_0x328e('0x12')](_0x328e('0xf'),_0x58885f,_0x4a4f53[_0x328e('0x12')][_0x328e('0x14')]);return _0x3467ee(_0x4a4f53[_0x328e('0x12')][_0x328e('0x14')]);}logger[_0x328e('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x58885f,_0x4a4f53[_0x328e('0x12')][_0x328e('0x14')]);return _0x3696b6(_0x4a4f53[_0x328e('0x12')][_0x328e('0x14')]);}else{logger[_0x328e('0xe')](_0x328e('0xf'),_0x58885f,_0x328e('0x10'));_0x3696b6(_0x4a4f53[_0x328e('0x15')][_0x328e('0x14')]);}})['catch'](function(_0x1fdb79){logger[_0x328e('0x12')](_0x328e('0xf'),_0x58885f,_0x1fdb79);_0x3467ee(_0x1fdb79);});});} \ No newline at end of file +var _0xa566=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','info'];(function(_0x2a7df0,_0x5fee0b){var _0x2a91c8=function(_0x244ec1){while(--_0x244ec1){_0x2a7df0['push'](_0x2a7df0['shift']());}};_0x2a91c8(++_0x5fee0b);}(_0xa566,0x1c1));var _0x6a56=function(_0xd67753,_0x99eac1){_0xd67753=_0xd67753-0x0;var _0x2e56c4=_0xa566[_0xd67753];return _0x2e56c4;};'use strict';var _=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var moment=require(_0x6a56('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a56('0x3'));var fs=require('fs');var Redis=require(_0x6a56('0x4'));var db=require(_0x6a56('0x5'))['db'];var utils=require(_0x6a56('0x6'));var logger=require('../../config/logger')(_0x6a56('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3712ee,_0x50ae34,_0x472c60){return new BPromise(function(_0x4947a9,_0x33240c){return client[_0x6a56('0x8')](_0x3712ee,_0x472c60)['then'](function(_0x2f49ab){logger[_0x6a56('0x9')](_0x6a56('0xa'),_0x50ae34,_0x6a56('0xb'));logger['debug'](_0x6a56('0xc'),_0x50ae34,_0x6a56('0xb'),JSON['stringify'](_0x2f49ab));if(_0x2f49ab['error']){if(_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xe')]===0x1f4){logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xf')]);return _0x33240c(_0x2f49ab[_0x6a56('0xd')]['message']);}logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xf')]);return _0x4947a9(_0x2f49ab[_0x6a56('0xd')]['message']);}else{logger[_0x6a56('0x9')](_0x6a56('0xa'),_0x50ae34,_0x6a56('0xb'));_0x4947a9(_0x2f49ab[_0x6a56('0x10')][_0x6a56('0xf')]);}})['catch'](function(_0x5e9895){logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x5e9895);_0x33240c(_0x5e9895);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index bdb111f..5fdf11f 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 _0xaaf8=['delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','index','show','isAuthenticated','create','put','/:id'];(function(_0x2fe621,_0x51ed95){var _0xa93d83=function(_0x12325b){while(--_0x12325b){_0x2fe621['push'](_0x2fe621['shift']());}};_0xa93d83(++_0x51ed95);}(_0xaaf8,0x1ab));var _0x8aaf=function(_0x2f4d41,_0x525047){_0x2f4d41=_0x2f4d41-0x0;var _0x3b0bb2=_0xaaf8[_0x2f4d41];return _0x3b0bb2;};'use strict';var multer=require('multer');var util=require(_0x8aaf('0x0'));var path=require('path');var timeout=require(_0x8aaf('0x1'));var express=require(_0x8aaf('0x2'));var router=express[_0x8aaf('0x3')]();var fs_extra=require(_0x8aaf('0x4'));var auth=require(_0x8aaf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8aaf('0x6'));var controller=require(_0x8aaf('0x7'));router[_0x8aaf('0x8')]('/',auth['isAuthenticated'](),controller[_0x8aaf('0x9')]);router[_0x8aaf('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8aaf('0xa')]);router['post']('/',auth[_0x8aaf('0xb')](),controller[_0x8aaf('0xc')]);router[_0x8aaf('0xd')](_0x8aaf('0xe'),auth[_0x8aaf('0xb')](),controller['update']);router[_0x8aaf('0xf')](_0x8aaf('0xe'),auth[_0x8aaf('0xb')](),controller[_0x8aaf('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe584=['/:id','show','post','create','put','delete','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index'];(function(_0x1beb62,_0x5cdc6f){var _0x3eed3a=function(_0x1bfa41){while(--_0x1bfa41){_0x1beb62['push'](_0x1beb62['shift']());}};_0x3eed3a(++_0x5cdc6f);}(_0xe584,0x14c));var _0x4e58=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xe584[_0x2df507];return _0x1f7167;};'use strict';var multer=require(_0x4e58('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4e58('0x1'));var router=express[_0x4e58('0x2')]();var fs_extra=require(_0x4e58('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4e58('0x4'));var config=require(_0x4e58('0x5'));var controller=require(_0x4e58('0x6'));router[_0x4e58('0x7')]('/',auth[_0x4e58('0x8')](),controller[_0x4e58('0x9')]);router[_0x4e58('0x7')](_0x4e58('0xa'),auth['isAuthenticated'](),controller[_0x4e58('0xb')]);router[_0x4e58('0xc')]('/',auth[_0x4e58('0x8')](),controller[_0x4e58('0xd')]);router[_0x4e58('0xe')](_0x4e58('0xa'),auth[_0x4e58('0x8')](),controller['update']);router[_0x4e58('0xf')](_0x4e58('0xa'),auth[_0x4e58('0x8')](),controller[_0x4e58('0x10')]);module[_0x4e58('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 31a4a45..9fb2e5a 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 _0xe67d=['STRING','sequelize','name'];(function(_0xd9c141,_0x4d7246){var _0x365d19=function(_0x50cfa3){while(--_0x50cfa3){_0xd9c141['push'](_0xd9c141['shift']());}};_0x365d19(++_0x4d7246);}(_0xe67d,0x9d));var _0xde67=function(_0x2f6629,_0x1b013c){_0x2f6629=_0x2f6629-0x0;var _0x317739=_0xe67d[_0x2f6629];return _0x317739;};'use strict';var Sequelize=require(_0xde67('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xde67('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xde67('0x2')]}}; \ No newline at end of file +var _0xf73c=['name','exports'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0xf73c,0x79));var _0xcf73=function(_0x92fd77,_0x5a1e8a){_0x92fd77=_0x92fd77-0x0;var _0x492476=_0xf73c[_0x92fd77];return _0x492476;};'use strict';var Sequelize=require('sequelize');module[_0xcf73('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xcf73('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7eea424..7c4a522 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 _0x25d1=['moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','Pauses','UserProfileResource','then','stack','name','send','index','Pause','fieldName','type','key','map','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','sort','filter','where','options','include','findAll','params','rawAttributes','includeAll','merge','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','update','eml-format','fast-json-patch'];(function(_0x21e034,_0x59fc14){var _0x1faab3=function(_0x2bd3ba){while(--_0x2bd3ba){_0x21e034['push'](_0x21e034['shift']());}};_0x1faab3(++_0x59fc14);}(_0x25d1,0xa8));var _0x125d=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x25d1[_0x4bb66f];return _0xf2772f;};'use strict';var emlformat=require(_0x125d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x125d('0x1'));var rp=require('request-promise');var moment=require(_0x125d('0x2'));var BPromise=require(_0x125d('0x3'));var Mustache=require('mustache');var util=require(_0x125d('0x4'));var path=require(_0x125d('0x5'));var sox=require(_0x125d('0x6'));var csv=require(_0x125d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x125d('0x8'));var _=require(_0x125d('0x9'));var squel=require(_0x125d('0xa'));var crypto=require(_0x125d('0xb'));var jsforce=require(_0x125d('0xc'));var deskjs=require(_0x125d('0xd'));var toCsv=require(_0x125d('0x7'));var querystring=require(_0x125d('0xe'));var Papa=require(_0x125d('0xf'));var Redis=require(_0x125d('0x10'));var authService=require(_0x125d('0x11'));var qs=require(_0x125d('0x12'));var as=require(_0x125d('0x13'));var hardwareService=require(_0x125d('0x14'));var logger=require(_0x125d('0x15'))(_0x125d('0x16'));var utils=require('../../config/utils');var config=require(_0x125d('0x17'));var licenseUtil=require(_0x125d('0x18'));var db=require(_0x125d('0x19'))['db'];function respondWithStatusCode(_0x4678e2,_0x37f9f8){_0x37f9f8=_0x37f9f8||0xcc;return function(_0x255aef){if(_0x255aef){return _0x4678e2[_0x125d('0x1a')](_0x37f9f8);}return _0x4678e2[_0x125d('0x1b')](_0x37f9f8)[_0x125d('0x1c')]();};}function respondWithResult(_0x2526ef,_0x43660a){_0x43660a=_0x43660a||0xc8;return function(_0x4e0382){if(_0x4e0382){return _0x2526ef['status'](_0x43660a)[_0x125d('0x1d')](_0x4e0382);}};}function respondWithFilteredResult(_0x3fda2b,_0x4199ac){return function(_0x45048a){if(_0x45048a){var _0x3db1ca=typeof _0x4199ac[_0x125d('0x1e')]===_0x125d('0x1f')&&typeof _0x4199ac[_0x125d('0x20')]===_0x125d('0x1f');var _0x4d7a3d=_0x45048a[_0x125d('0x21')];var _0x8c0646=_0x3db1ca?0x0:_0x4199ac['offset'];var _0x5660ca=_0x3db1ca?_0x45048a['count']:_0x4199ac[_0x125d('0x1e')]+_0x4199ac['limit'];var _0x30c95c;if(_0x5660ca>=_0x4d7a3d){_0x5660ca=_0x4d7a3d;_0x30c95c=0xc8;}else{_0x30c95c=0xce;}_0x3fda2b[_0x125d('0x1b')](_0x30c95c);return _0x3fda2b[_0x125d('0x22')](_0x125d('0x23'),_0x8c0646+'-'+_0x5660ca+'/'+_0x4d7a3d)[_0x125d('0x1d')](_0x45048a);}return null;};}function patchUpdates(_0x38d457){return function(_0x47e5f0){try{jsonpatch[_0x125d('0x24')](_0x47e5f0,_0x38d457,!![]);}catch(_0x30a70d){return BPromise[_0x125d('0x25')](_0x30a70d);}return _0x47e5f0[_0x125d('0x26')]();};}function saveUpdates(_0x51ad36,_0x349a75){return function(_0x3a1e1b){if(_0x3a1e1b){return _0x3a1e1b['update'](_0x51ad36)['then'](function(_0x3a157f){return _0x3a157f;});}return null;};}function removeEntity(_0x4f8108,_0xf50e22){return function(_0x459070){if(_0x459070){return _0x459070[_0x125d('0x27')]()['then'](function(){var _0x23ba87=_0x459070[_0x125d('0x28')]({'plain':!![]});var _0x5dcde1=_0x125d('0x29');return db[_0x125d('0x2a')][_0x125d('0x27')]({'where':{'type':_0x5dcde1,'resourceId':_0x23ba87['id']}})[_0x125d('0x2b')](function(){return _0x459070;});})['then'](function(){_0x4f8108[_0x125d('0x1b')](0xcc)[_0x125d('0x1c')]();});}};}function handleEntityNotFound(_0x12ce1a,_0x40bd3d){return function(_0x252056){if(!_0x252056){_0x12ce1a[_0x125d('0x1a')](0x194);}return _0x252056;};}function handleError(_0x38e641,_0x26537e){_0x26537e=_0x26537e||0x1f4;return function(_0x53d0f3){logger['error'](_0x53d0f3[_0x125d('0x2c')]);if(_0x53d0f3['name']){delete _0x53d0f3[_0x125d('0x2d')];}_0x38e641[_0x125d('0x1b')](_0x26537e)[_0x125d('0x2e')](_0x53d0f3);};}exports[_0x125d('0x2f')]=function(_0x8486d,_0x417ad1){var _0x31a69={},_0x60057a={},_0x298f30={'count':0x0,'rows':[]};var _0x2cca85=_['map'](db[_0x125d('0x30')]['rawAttributes'],function(_0x55c2e1){return{'name':_0x55c2e1[_0x125d('0x31')],'type':_0x55c2e1[_0x125d('0x32')][_0x125d('0x33')]};});_0x60057a['model']=_[_0x125d('0x34')](_0x2cca85,_0x125d('0x2d'));_0x60057a['query']=_[_0x125d('0x35')](_0x8486d['query']);_0x60057a[_0x125d('0x36')]=_[_0x125d('0x37')](_0x60057a[_0x125d('0x38')],_0x60057a['query']);_0x31a69[_0x125d('0x39')]=_[_0x125d('0x37')](_0x60057a['model'],qs[_0x125d('0x3a')](_0x8486d['query']['fields']));_0x31a69[_0x125d('0x39')]=_0x31a69[_0x125d('0x39')][_0x125d('0x3b')]?_0x31a69[_0x125d('0x39')]:_0x60057a[_0x125d('0x38')];if(!_0x8486d[_0x125d('0x3c')][_0x125d('0x3d')](_0x125d('0x3e'))){_0x31a69['limit']=qs[_0x125d('0x20')](_0x8486d[_0x125d('0x3c')][_0x125d('0x20')]);_0x31a69[_0x125d('0x1e')]=qs[_0x125d('0x1e')](_0x8486d[_0x125d('0x3c')][_0x125d('0x1e')]);}_0x31a69['order']=qs[_0x125d('0x3f')](_0x8486d[_0x125d('0x3c')][_0x125d('0x3f')]);_0x31a69['where']=qs[_0x125d('0x36')](_['pick'](_0x8486d[_0x125d('0x3c')],_0x60057a['filters']),_0x2cca85);if(_0x8486d[_0x125d('0x3c')][_0x125d('0x40')]){_0x31a69['where']=_['merge'](_0x31a69[_0x125d('0x41')],{'$or':_[_0x125d('0x34')](_0x2cca85,function(_0x1db632){if(_0x1db632[_0x125d('0x32')]!=='VIRTUAL'){var _0x460bc5={};_0x460bc5[_0x1db632['name']]={'$like':'%'+_0x8486d[_0x125d('0x3c')][_0x125d('0x40')]+'%'};return _0x460bc5;}})});}_0x31a69=_['merge']({},_0x31a69,_0x8486d[_0x125d('0x42')]);var _0x5efa6f={'where':_0x31a69['where']};return db[_0x125d('0x30')][_0x125d('0x21')](_0x5efa6f)[_0x125d('0x2b')](function(_0xcd36b4){_0x298f30[_0x125d('0x21')]=_0xcd36b4;if(_0x8486d['query']['includeAll']){_0x31a69[_0x125d('0x43')]=[{'all':!![]}];}return db['Pause'][_0x125d('0x44')](_0x31a69);})['then'](function(_0x41b90d){_0x298f30['rows']=_0x41b90d;return _0x298f30;})[_0x125d('0x2b')](respondWithFilteredResult(_0x417ad1,_0x31a69))['catch'](handleError(_0x417ad1,null));};exports['show']=function(_0x36078f,_0x3e7d85){var _0x3404fb={'raw':!![],'where':{'id':_0x36078f[_0x125d('0x45')]['id']}},_0x3df659={};_0x3df659[_0x125d('0x38')]=_[_0x125d('0x35')](db[_0x125d('0x30')][_0x125d('0x46')]);_0x3df659[_0x125d('0x3c')]=_[_0x125d('0x35')](_0x36078f[_0x125d('0x3c')]);_0x3df659[_0x125d('0x36')]=_[_0x125d('0x37')](_0x3df659[_0x125d('0x38')],_0x3df659[_0x125d('0x3c')]);_0x3404fb['attributes']=_[_0x125d('0x37')](_0x3df659['model'],qs[_0x125d('0x3a')](_0x36078f[_0x125d('0x3c')][_0x125d('0x3a')]));_0x3404fb[_0x125d('0x39')]=_0x3404fb['attributes'][_0x125d('0x3b')]?_0x3404fb[_0x125d('0x39')]:_0x3df659[_0x125d('0x38')];if(_0x36078f[_0x125d('0x3c')][_0x125d('0x47')]){_0x3404fb['include']=[{'all':!![]}];}_0x3404fb=_[_0x125d('0x48')]({},_0x3404fb,_0x36078f[_0x125d('0x42')]);return db[_0x125d('0x30')][_0x125d('0x49')](_0x3404fb)[_0x125d('0x2b')](handleEntityNotFound(_0x3e7d85,null))[_0x125d('0x2b')](respondWithResult(_0x3e7d85,null))[_0x125d('0x4a')](handleError(_0x3e7d85,null));};exports[_0x125d('0x4b')]=function(_0x2bd051,_0x13f1ac){return db[_0x125d('0x30')]['create'](_0x2bd051[_0x125d('0x4c')],{})['then'](function(_0x4635ff){var _0x33f6eb=_0x2bd051[_0x125d('0x4d')][_0x125d('0x28')]({'plain':!![]});if(!_0x33f6eb)throw new Error(_0x125d('0x4e'));if(_0x33f6eb[_0x125d('0x4f')]===_0x125d('0x4d')){var _0x275aa5=_0x4635ff['get']({'plain':!![]});var _0x2dc8b3=_0x125d('0x29');return db[_0x125d('0x50')][_0x125d('0x49')]({'where':{'name':_0x2dc8b3,'userProfileId':_0x33f6eb['userProfileId']},'raw':!![]})[_0x125d('0x2b')](function(_0x58aa2a){if(_0x58aa2a&&_0x58aa2a[_0x125d('0x51')]===0x0){return db[_0x125d('0x2a')]['create']({'name':_0x275aa5[_0x125d('0x2d')],'resourceId':_0x275aa5['id'],'type':_0x58aa2a[_0x125d('0x2d')],'sectionId':_0x58aa2a['id']},{})[_0x125d('0x2b')](function(){return _0x4635ff;});}else{return _0x4635ff;}})[_0x125d('0x4a')](function(_0x111c59){logger[_0x125d('0x52')](_0x125d('0x53'),_0x111c59);throw _0x111c59;});}return _0x4635ff;})[_0x125d('0x2b')](respondWithResult(_0x13f1ac,0xc9))['catch'](handleError(_0x13f1ac,null));};exports[_0x125d('0x54')]=function(_0x86e265,_0x53f488){if(_0x86e265[_0x125d('0x4c')]['id']){delete _0x86e265[_0x125d('0x4c')]['id'];}return db[_0x125d('0x30')][_0x125d('0x49')]({'where':{'id':_0x86e265['params']['id']}})[_0x125d('0x2b')](handleEntityNotFound(_0x53f488,null))['then'](saveUpdates(_0x86e265['body'],null))[_0x125d('0x2b')](respondWithResult(_0x53f488,null))['catch'](handleError(_0x53f488,null));};exports[_0x125d('0x27')]=function(_0x3656be,_0x302ad6){return db['Pause']['find']({'where':{'id':_0x3656be[_0x125d('0x45')]['id']}})['then'](handleEntityNotFound(_0x302ad6,null))[_0x125d('0x2b')](removeEntity(_0x302ad6,null))['catch'](handleError(_0x302ad6,null));}; \ No newline at end of file +var _0x6d77=['fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','util','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','name','send','index','map','Pause','fieldName','key','model','keys','query','filters','intersection','attributes'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x6d77,0x160));var _0x76d7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6d77[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76d7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76d7('0x1'));var rp=require(_0x76d7('0x2'));var moment=require(_0x76d7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x76d7('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x76d7('0x5'));var ejs=require(_0x76d7('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x76d7('0x7'));var crypto=require(_0x76d7('0x8'));var jsforce=require(_0x76d7('0x9'));var deskjs=require(_0x76d7('0xa'));var toCsv=require(_0x76d7('0x5'));var querystring=require(_0x76d7('0xb'));var Papa=require(_0x76d7('0xc'));var Redis=require(_0x76d7('0xd'));var authService=require(_0x76d7('0xe'));var qs=require(_0x76d7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76d7('0x10'));var logger=require(_0x76d7('0x11'))(_0x76d7('0x12'));var utils=require(_0x76d7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x76d7('0x14'));var db=require(_0x76d7('0x15'))['db'];function respondWithStatusCode(_0x5d9b52,_0x260454){_0x260454=_0x260454||0xcc;return function(_0x1c5723){if(_0x1c5723){return _0x5d9b52[_0x76d7('0x16')](_0x260454);}return _0x5d9b52[_0x76d7('0x17')](_0x260454)[_0x76d7('0x18')]();};}function respondWithResult(_0x9efe40,_0x4e2864){_0x4e2864=_0x4e2864||0xc8;return function(_0x535be0){if(_0x535be0){return _0x9efe40[_0x76d7('0x17')](_0x4e2864)[_0x76d7('0x19')](_0x535be0);}};}function respondWithFilteredResult(_0x328f83,_0xa2cbd7){return function(_0x129127){if(_0x129127){var _0x2f1223=typeof _0xa2cbd7[_0x76d7('0x1a')]==='undefined'&&typeof _0xa2cbd7[_0x76d7('0x1b')]===_0x76d7('0x1c');var _0x4dc8e2=_0x129127[_0x76d7('0x1d')];var _0xceb036=_0x2f1223?0x0:_0xa2cbd7[_0x76d7('0x1a')];var _0x5e7c2b=_0x2f1223?_0x129127['count']:_0xa2cbd7[_0x76d7('0x1a')]+_0xa2cbd7[_0x76d7('0x1b')];var _0x28768d;if(_0x5e7c2b>=_0x4dc8e2){_0x5e7c2b=_0x4dc8e2;_0x28768d=0xc8;}else{_0x28768d=0xce;}_0x328f83[_0x76d7('0x17')](_0x28768d);return _0x328f83[_0x76d7('0x1e')](_0x76d7('0x1f'),_0xceb036+'-'+_0x5e7c2b+'/'+_0x4dc8e2)[_0x76d7('0x19')](_0x129127);}return null;};}function patchUpdates(_0x54c686){return function(_0xbba942){try{jsonpatch[_0x76d7('0x20')](_0xbba942,_0x54c686,!![]);}catch(_0x4337aa){return BPromise[_0x76d7('0x21')](_0x4337aa);}return _0xbba942[_0x76d7('0x22')]();};}function saveUpdates(_0x30b6a3,_0x267b8c){return function(_0x130f6f){if(_0x130f6f){return _0x130f6f[_0x76d7('0x23')](_0x30b6a3)[_0x76d7('0x24')](function(_0x481647){return _0x481647;});}return null;};}function removeEntity(_0x4c5c37,_0x670582){return function(_0x16f54f){if(_0x16f54f){return _0x16f54f[_0x76d7('0x25')]()[_0x76d7('0x24')](function(){var _0x101943=_0x16f54f[_0x76d7('0x26')]({'plain':!![]});var _0x138e6c=_0x76d7('0x27');return db['UserProfileResource'][_0x76d7('0x25')]({'where':{'type':_0x138e6c,'resourceId':_0x101943['id']}})['then'](function(){return _0x16f54f;});})[_0x76d7('0x24')](function(){_0x4c5c37[_0x76d7('0x17')](0xcc)[_0x76d7('0x18')]();});}};}function handleEntityNotFound(_0x2cfbae,_0x35e9bd){return function(_0x2283f4){if(!_0x2283f4){_0x2cfbae['sendStatus'](0x194);}return _0x2283f4;};}function handleError(_0x427705,_0x19f36a){_0x19f36a=_0x19f36a||0x1f4;return function(_0x22da97){logger['error'](_0x22da97['stack']);if(_0x22da97[_0x76d7('0x28')]){delete _0x22da97[_0x76d7('0x28')];}_0x427705['status'](_0x19f36a)[_0x76d7('0x29')](_0x22da97);};}exports[_0x76d7('0x2a')]=function(_0x5d7825,_0x334030){var _0x435a91={},_0x85c2a4={},_0x47b219={'count':0x0,'rows':[]};var _0x52cb10=_[_0x76d7('0x2b')](db[_0x76d7('0x2c')]['rawAttributes'],function(_0x36d828){return{'name':_0x36d828[_0x76d7('0x2d')],'type':_0x36d828['type'][_0x76d7('0x2e')]};});_0x85c2a4[_0x76d7('0x2f')]=_['map'](_0x52cb10,_0x76d7('0x28'));_0x85c2a4['query']=_[_0x76d7('0x30')](_0x5d7825[_0x76d7('0x31')]);_0x85c2a4[_0x76d7('0x32')]=_[_0x76d7('0x33')](_0x85c2a4[_0x76d7('0x2f')],_0x85c2a4['query']);_0x435a91[_0x76d7('0x34')]=_[_0x76d7('0x33')](_0x85c2a4[_0x76d7('0x2f')],qs[_0x76d7('0x35')](_0x5d7825['query']['fields']));_0x435a91[_0x76d7('0x34')]=_0x435a91[_0x76d7('0x34')][_0x76d7('0x36')]?_0x435a91[_0x76d7('0x34')]:_0x85c2a4['model'];if(!_0x5d7825[_0x76d7('0x31')][_0x76d7('0x37')](_0x76d7('0x38'))){_0x435a91[_0x76d7('0x1b')]=qs['limit'](_0x5d7825['query'][_0x76d7('0x1b')]);_0x435a91[_0x76d7('0x1a')]=qs[_0x76d7('0x1a')](_0x5d7825['query'][_0x76d7('0x1a')]);}_0x435a91['order']=qs[_0x76d7('0x39')](_0x5d7825['query'][_0x76d7('0x39')]);_0x435a91['where']=qs[_0x76d7('0x32')](_[_0x76d7('0x3a')](_0x5d7825[_0x76d7('0x31')],_0x85c2a4['filters']),_0x52cb10);if(_0x5d7825[_0x76d7('0x31')][_0x76d7('0x3b')]){_0x435a91['where']=_[_0x76d7('0x3c')](_0x435a91[_0x76d7('0x3d')],{'$or':_[_0x76d7('0x2b')](_0x52cb10,function(_0x2b5baf){if(_0x2b5baf[_0x76d7('0x3e')]!==_0x76d7('0x3f')){var _0x5a2832={};_0x5a2832[_0x2b5baf[_0x76d7('0x28')]]={'$like':'%'+_0x5d7825['query'][_0x76d7('0x3b')]+'%'};return _0x5a2832;}})});}_0x435a91=_[_0x76d7('0x3c')]({},_0x435a91,_0x5d7825[_0x76d7('0x40')]);var _0x38961b={'where':_0x435a91[_0x76d7('0x3d')]};return db[_0x76d7('0x2c')][_0x76d7('0x1d')](_0x38961b)[_0x76d7('0x24')](function(_0xacfc83){_0x47b219['count']=_0xacfc83;if(_0x5d7825['query'][_0x76d7('0x41')]){_0x435a91[_0x76d7('0x42')]=[{'all':!![]}];}return db[_0x76d7('0x2c')][_0x76d7('0x43')](_0x435a91);})[_0x76d7('0x24')](function(_0x194cbc){_0x47b219['rows']=_0x194cbc;return _0x47b219;})[_0x76d7('0x24')](respondWithFilteredResult(_0x334030,_0x435a91))[_0x76d7('0x44')](handleError(_0x334030,null));};exports['show']=function(_0x9b68de,_0x37ef2c){var _0x4abe7d={'raw':!![],'where':{'id':_0x9b68de[_0x76d7('0x45')]['id']}},_0x2abe04={};_0x2abe04[_0x76d7('0x2f')]=_['keys'](db[_0x76d7('0x2c')]['rawAttributes']);_0x2abe04[_0x76d7('0x31')]=_[_0x76d7('0x30')](_0x9b68de['query']);_0x2abe04[_0x76d7('0x32')]=_[_0x76d7('0x33')](_0x2abe04[_0x76d7('0x2f')],_0x2abe04[_0x76d7('0x31')]);_0x4abe7d[_0x76d7('0x34')]=_['intersection'](_0x2abe04['model'],qs[_0x76d7('0x35')](_0x9b68de[_0x76d7('0x31')][_0x76d7('0x35')]));_0x4abe7d['attributes']=_0x4abe7d[_0x76d7('0x34')][_0x76d7('0x36')]?_0x4abe7d[_0x76d7('0x34')]:_0x2abe04[_0x76d7('0x2f')];if(_0x9b68de[_0x76d7('0x31')][_0x76d7('0x41')]){_0x4abe7d[_0x76d7('0x42')]=[{'all':!![]}];}_0x4abe7d=_[_0x76d7('0x3c')]({},_0x4abe7d,_0x9b68de[_0x76d7('0x40')]);return db['Pause'][_0x76d7('0x46')](_0x4abe7d)[_0x76d7('0x24')](handleEntityNotFound(_0x37ef2c,null))['then'](respondWithResult(_0x37ef2c,null))['catch'](handleError(_0x37ef2c,null));};exports[_0x76d7('0x47')]=function(_0xe1075c,_0x1ab54a){return db[_0x76d7('0x2c')][_0x76d7('0x47')](_0xe1075c[_0x76d7('0x48')],{})[_0x76d7('0x24')](function(_0x2a5c81){var _0x8d44f0=_0xe1075c[_0x76d7('0x49')][_0x76d7('0x26')]({'plain':!![]});if(!_0x8d44f0)throw new Error(_0x76d7('0x4a'));if(_0x8d44f0[_0x76d7('0x4b')]===_0x76d7('0x49')){var _0xfbf575=_0x2a5c81[_0x76d7('0x26')]({'plain':!![]});var _0x5a6ea2=_0x76d7('0x27');return db['UserProfileSection'][_0x76d7('0x46')]({'where':{'name':_0x5a6ea2,'userProfileId':_0x8d44f0[_0x76d7('0x4c')]},'raw':!![]})[_0x76d7('0x24')](function(_0x6ed545){if(_0x6ed545&&_0x6ed545[_0x76d7('0x4d')]===0x0){return db[_0x76d7('0x4e')]['create']({'name':_0xfbf575[_0x76d7('0x28')],'resourceId':_0xfbf575['id'],'type':_0x6ed545[_0x76d7('0x28')],'sectionId':_0x6ed545['id']},{})[_0x76d7('0x24')](function(){return _0x2a5c81;});}else{return _0x2a5c81;}})[_0x76d7('0x44')](function(_0x54fd7f){logger[_0x76d7('0x4f')](_0x76d7('0x50'),_0x54fd7f);throw _0x54fd7f;});}return _0x2a5c81;})[_0x76d7('0x24')](respondWithResult(_0x1ab54a,0xc9))[_0x76d7('0x44')](handleError(_0x1ab54a,null));};exports[_0x76d7('0x23')]=function(_0x329e2c,_0x4f3cb5){if(_0x329e2c[_0x76d7('0x48')]['id']){delete _0x329e2c[_0x76d7('0x48')]['id'];}return db[_0x76d7('0x2c')]['find']({'where':{'id':_0x329e2c[_0x76d7('0x45')]['id']}})[_0x76d7('0x24')](handleEntityNotFound(_0x4f3cb5,null))[_0x76d7('0x24')](saveUpdates(_0x329e2c[_0x76d7('0x48')],null))[_0x76d7('0x24')](respondWithResult(_0x4f3cb5,null))[_0x76d7('0x44')](handleError(_0x4f3cb5,null));};exports[_0x76d7('0x25')]=function(_0x4dd706,_0x1d3e28){return db[_0x76d7('0x2c')]['find']({'where':{'id':_0x4dd706['params']['id']}})[_0x76d7('0x24')](handleEntityNotFound(_0x1d3e28,null))['then'](removeEntity(_0x1d3e28,null))['catch'](handleError(_0x1d3e28,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ce96d99..273ad18 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 _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4098ed,_0x21e1eb){var _0x5622e7=function(_0x1d0b95){while(--_0x1d0b95){_0x4098ed['push'](_0x4098ed['shift']());}};_0x5622e7(++_0x21e1eb);}(_0x326f,0xd1));var _0xf326=function(_0x4026e6,_0x14c98b){_0x4026e6=_0x4026e6-0x0;var _0x41d5ec=_0x326f[_0x4026e6];return _0x41d5ec;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x177fc0,_0x5924d9){var _0x1319c6=function(_0x40ad4c){while(--_0x40ad4c){_0x177fc0['push'](_0x177fc0['shift']());}};_0x1319c6(++_0x5924d9);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3f28d9,_0x36e68c){_0x3f28d9=_0x3f28d9-0x0;var _0x46e11b=_0x1cb9[_0x3f28d9];return _0x46e11b;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 78befcb..c510506 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(_0x27226,_0x193920){var _0x565b0a=function(_0x39f6a5){while(--_0x39f6a5){_0x27226['push'](_0x27226['shift']());}};_0x565b0a(++_0x193920);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e0c31,_0x208e9f){_0x4e0c31=_0x4e0c31-0x0;var _0x3fd7df=_0xb10b[_0x4e0c31];return _0x3fd7df;};'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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xd638af,_0x435907){var _0x5c4d93=function(_0x1f1357){while(--_0x1f1357){_0xd638af['push'](_0xd638af['shift']());}};_0x5c4d93(++_0x435907);}(_0x7a54,0x106));var _0x47a5=function(_0x4ba2f3,_0x22777c){_0x4ba2f3=_0x4ba2f3-0x0;var _0x1c5c08=_0x7a54[_0x4ba2f3];return _0x1c5c08;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 64d5088..9879c84 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 _0x4d9e=['upload','webhookPost','put','delete','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','%s-%s%s','basename','originalname','now','extname','single','file'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x1b1acd,_0x506a0a){_0x1b1acd=_0x1b1acd-0x0;var _0x5ed4c2=_0x4d9e[_0x1b1acd];return _0x5ed4c2;};'use strict';var multer=require(_0xe4d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe4d9('0x1'));var express=require('express');var router=express[_0xe4d9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe4d9('0x3'));var interaction=require(_0xe4d9('0x4'));var config=require('../../config/environment');var controller=require(_0xe4d9('0x5'));router[_0xe4d9('0x6')]('/',auth[_0xe4d9('0x7')](),controller[_0xe4d9('0x8')]);router[_0xe4d9('0x6')](_0xe4d9('0x9'),controller['webhookGet']);router[_0xe4d9('0x6')](_0xe4d9('0xa'),auth[_0xe4d9('0x7')](),controller[_0xe4d9('0xb')]);router[_0xe4d9('0x6')](_0xe4d9('0xc'),auth['isAuthenticated'](),controller[_0xe4d9('0xd')]);var upload=multer({'storage':multer[_0xe4d9('0xe')]({'destination':function(_0x32eb8a,_0x3575ac,_0xddd1fb){_0xddd1fb(null,path[_0xe4d9('0xf')](config[_0xe4d9('0x10')],'server/files/plugins'));},'filename':function(_0x5ee099,_0x580c50,_0x4e0d15){_0x580c50['originalname']=_0x580c50['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4e0d15(null,util['format'](_0xe4d9('0x11'),path[_0xe4d9('0x12')](_0x580c50[_0xe4d9('0x13')],path['extname'](_0x580c50[_0xe4d9('0x13')])),Date[_0xe4d9('0x14')](),path[_0xe4d9('0x15')](_0x580c50[_0xe4d9('0x13')])));}})});router['post']('/',upload[_0xe4d9('0x16')](_0xe4d9('0x17')),controller[_0xe4d9('0x18')]);router['post']('/webhook',controller[_0xe4d9('0x19')]);router[_0xe4d9('0x1a')]('/:id',auth[_0xe4d9('0x7')](),controller['update']);router[_0xe4d9('0x1b')](_0xe4d9('0xa'),auth[_0xe4d9('0x7')](),controller[_0xe4d9('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xed1f=['basename','originalname','now','extname','single','upload','post','webhookPost','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','diskStorage','server/files/plugins','replace','format'];(function(_0x5d58c5,_0x5490d1){var _0x1650bd=function(_0x535cb2){while(--_0x535cb2){_0x5d58c5['push'](_0x5d58c5['shift']());}};_0x1650bd(++_0x5490d1);}(_0xed1f,0x6a));var _0xfed1=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xed1f[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')]('/',auth[_0xfed1('0xc')](),controller[_0xfed1('0xd')]);router[_0xfed1('0xb')](_0xfed1('0xe'),controller[_0xfed1('0xf')]);router[_0xfed1('0xb')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x10')]);router['get'](_0xfed1('0x11'),auth[_0xfed1('0xc')](),controller['download']);var upload=multer({'storage':multer[_0xfed1('0x12')]({'destination':function(_0x48c338,_0x1c3f40,_0x234f4e){_0x234f4e(null,path['join'](config['root'],_0xfed1('0x13')));},'filename':function(_0xe84ba6,_0x569a6e,_0x17f4fe){_0x569a6e['originalname']=_0x569a6e['originalname'][_0xfed1('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17f4fe(null,util[_0xfed1('0x15')]('%s-%s%s',path[_0xfed1('0x16')](_0x569a6e['originalname'],path['extname'](_0x569a6e[_0xfed1('0x17')])),Date[_0xfed1('0x18')](),path[_0xfed1('0x19')](_0x569a6e[_0xfed1('0x17')])));}})});router['post']('/',upload[_0xfed1('0x1a')]('file'),controller[_0xfed1('0x1b')]);router[_0xfed1('0x1c')]('/webhook',controller[_0xfed1('0x1d')]);router[_0xfed1('0x1e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfed1('0x1f')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index bfa9a6a..8edbbb0 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 _0x2282=['STRING','ENUM','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x38c869,_0x2248d1){var _0x1a90e9=function(_0x280f3e){while(--_0x280f3e){_0x38c869['push'](_0x38c869['shift']());}};_0x1a90e9(++_0x2248d1);}(_0x2282,0xa7));var _0x2228=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0x2282[_0x59145a];return _0xf04d7;};'use strict';var Sequelize=require(_0x2228('0x0'));module[_0x2228('0x1')]={'name':{'type':Sequelize[_0x2228('0x2')]},'type':{'type':Sequelize[_0x2228('0x3')](_0x2228('0x4'),_0x2228('0x5'))},'description':{'type':Sequelize[_0x2228('0x6')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x2228('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x2228('0x7')],'defaultValue':0x0,'comment':_0x2228('0x8')},'sidebar':{'type':Sequelize[_0x2228('0x3')](_0x2228('0x9'),_0x2228('0xa'),'always','never'),'defaultValue':_0x2228('0xb'),'comment':_0x2228('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x2228('0x2')]},'agentUrl':{'type':Sequelize[_0x2228('0x2')]},'scriptName':{'type':Sequelize[_0x2228('0x2')]},'scriptPath':{'type':Sequelize[_0x2228('0x2')]}}; \ No newline at end of file +var _0x8dbd=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x1f7377,_0x57f371){var _0x70b51f=function(_0x1d0200){while(--_0x1d0200){_0x1f7377['push'](_0x1f7377['shift']());}};_0x70b51f(++_0x57f371);}(_0x8dbd,0x165));var _0xd8db=function(_0x1bc8d0,_0x5194bd){_0x1bc8d0=_0x1bc8d0-0x0;var _0x10ec49=_0x8dbd[_0x1bc8d0];return _0x10ec49;};'use strict';var Sequelize=require('sequelize');module[_0xd8db('0x0')]={'name':{'type':Sequelize[_0xd8db('0x1')]},'type':{'type':Sequelize[_0xd8db('0x2')](_0xd8db('0x3'),_0xd8db('0x4'))},'description':{'type':Sequelize[_0xd8db('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xd8db('0x1')],'comment':_0xd8db('0x6')},'active':{'type':Sequelize[_0xd8db('0x7')],'defaultValue':0x0,'comment':_0xd8db('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0xd8db('0x9'),_0xd8db('0xa'),_0xd8db('0xb'),_0xd8db('0xc')),'defaultValue':_0xd8db('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xd8db('0x1')]},'adminUrl':{'type':Sequelize[_0xd8db('0x1')]},'agentUrl':{'type':Sequelize[_0xd8db('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 64d764d..efbb006 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 _0x5693=['lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','set','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','port','%s%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','update','destroy','get','Plugins','then','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','catch','show','keys','length','includeAll','download','find','params','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','finalize','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','root','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure'];(function(_0x4fa47e,_0x15b71e){var _0x3dd3c0=function(_0x56d69f){while(--_0x56d69f){_0x4fa47e['push'](_0x4fa47e['shift']());}};_0x3dd3c0(++_0x15b71e);}(_0x5693,0x18c));var _0x3569=function(_0x9c0852,_0x54a062){_0x9c0852=_0x9c0852-0x0;var _0x707adb=_0x5693[_0x9c0852];return _0x707adb;};'use strict';var emlformat=require(_0x3569('0x0'));var rimraf=require(_0x3569('0x1'));var zipdir=require(_0x3569('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3569('0x3'));var moment=require(_0x3569('0x4'));var BPromise=require(_0x3569('0x5'));var Mustache=require(_0x3569('0x6'));var util=require(_0x3569('0x7'));var path=require(_0x3569('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3569('0x9'));var fs=require('fs');var fs_extra=require(_0x3569('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3569('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3569('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3569('0xd'));var extract=require(_0x3569('0xe'));var rimraf=require(_0x3569('0x1'));var archiver=require(_0x3569('0xf'));var Redis=require(_0x3569('0x10'));var authService=require(_0x3569('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3569('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3569('0x13'))(_0x3569('0x14'));var utils=require(_0x3569('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3569('0x16'));var db=require('../../mysqldb')['db'];config[_0x3569('0x17')]=_[_0x3569('0x18')](config[_0x3569('0x17')],{'host':_0x3569('0x19'),'port':0x18eb});var socket=require(_0x3569('0x1a'))(new Redis(config[_0x3569('0x17')]));require(_0x3569('0x1b'))[_0x3569('0x1c')](socket);function respondWithStatusCode(_0x1ab18e,_0x224964){_0x224964=_0x224964||0xcc;return function(_0xffe20c){if(_0xffe20c){return _0x1ab18e[_0x3569('0x1d')](_0x224964);}return _0x1ab18e[_0x3569('0x1e')](_0x224964)['end']();};}function respondWithResult(_0xbf8237,_0xabf5a2){_0xabf5a2=_0xabf5a2||0xc8;return function(_0xeaf655){if(_0xeaf655){return _0xbf8237[_0x3569('0x1e')](_0xabf5a2)[_0x3569('0x1f')](_0xeaf655);}};}function respondWithFilteredResult(_0x2e0b06,_0x4b5926){return function(_0x30285d){if(_0x30285d){var _0x53f81e=typeof _0x4b5926[_0x3569('0x20')]===_0x3569('0x21')&&typeof _0x4b5926['limit']==='undefined';var _0x4739e4=_0x30285d[_0x3569('0x22')];var _0x55d212=_0x53f81e?0x0:_0x4b5926[_0x3569('0x20')];var _0x474d9d=_0x53f81e?_0x30285d[_0x3569('0x22')]:_0x4b5926['offset']+_0x4b5926[_0x3569('0x23')];var _0x132e14;if(_0x474d9d>=_0x4739e4){_0x474d9d=_0x4739e4;_0x132e14=0xc8;}else{_0x132e14=0xce;}_0x2e0b06[_0x3569('0x1e')](_0x132e14);return _0x2e0b06['set'](_0x3569('0x24'),_0x55d212+'-'+_0x474d9d+'/'+_0x4739e4)[_0x3569('0x1f')](_0x30285d);}return null;};}function patchUpdates(_0x576fe1){return function(_0x36544a){try{jsonpatch['apply'](_0x36544a,_0x576fe1,!![]);}catch(_0x1b1f9e){return BPromise[_0x3569('0x25')](_0x1b1f9e);}return _0x36544a['save']();};}function saveUpdates(_0x124316,_0x4f470f){return function(_0x3b91af){if(_0x3b91af){return _0x3b91af[_0x3569('0x26')](_0x124316)['then'](function(_0x2c6199){return _0x2c6199;});}return null;};}function removeEntity(_0x214336,_0x280637){return function(_0x427971){if(_0x427971){return _0x427971[_0x3569('0x27')]()['then'](function(){var _0x372c0a=_0x427971[_0x3569('0x28')]({'plain':!![]});var _0x16a55e=_0x3569('0x29');return db['UserProfileResource'][_0x3569('0x27')]({'where':{'type':_0x16a55e,'resourceId':_0x372c0a['id']}})[_0x3569('0x2a')](function(){return _0x427971;});})['then'](function(){_0x214336[_0x3569('0x1e')](0xcc)[_0x3569('0x2b')]();});}};}function handleEntityNotFound(_0x29f578,_0x5533d5){return function(_0x2eef07){if(!_0x2eef07){_0x29f578[_0x3569('0x1d')](0x194);}return _0x2eef07;};}function handleError(_0x5044a4,_0x5260d5){_0x5260d5=_0x5260d5||0x1f4;return function(_0xc8392a){logger[_0x3569('0x2c')](_0xc8392a[_0x3569('0x2d')]);if(_0xc8392a[_0x3569('0x2e')]){delete _0xc8392a[_0x3569('0x2e')];}_0x5044a4[_0x3569('0x1e')](_0x5260d5)[_0x3569('0x2f')](_0xc8392a);};}exports[_0x3569('0x30')]=function(_0x3d3c04,_0x2f9daf){var _0x4df9e0={},_0x44bfa8={},_0x7c30e0={'count':0x0,'rows':[]};var _0x5cd27b=_[_0x3569('0x31')](db[_0x3569('0x32')][_0x3569('0x33')],function(_0x1da181){return{'name':_0x1da181[_0x3569('0x34')],'type':_0x1da181[_0x3569('0x35')][_0x3569('0x36')]};});_0x44bfa8['model']=_[_0x3569('0x31')](_0x5cd27b,_0x3569('0x2e'));_0x44bfa8[_0x3569('0x37')]=_['keys'](_0x3d3c04[_0x3569('0x37')]);_0x44bfa8[_0x3569('0x38')]=_[_0x3569('0x39')](_0x44bfa8[_0x3569('0x3a')],_0x44bfa8[_0x3569('0x37')]);_0x4df9e0[_0x3569('0x3b')]=_[_0x3569('0x39')](_0x44bfa8[_0x3569('0x3a')],qs[_0x3569('0x3c')](_0x3d3c04['query'][_0x3569('0x3c')]));_0x4df9e0[_0x3569('0x3b')]=_0x4df9e0[_0x3569('0x3b')]['length']?_0x4df9e0[_0x3569('0x3b')]:_0x44bfa8[_0x3569('0x3a')];if(!_0x3d3c04['query'][_0x3569('0x3d')](_0x3569('0x3e'))){_0x4df9e0[_0x3569('0x23')]=qs['limit'](_0x3d3c04[_0x3569('0x37')][_0x3569('0x23')]);_0x4df9e0['offset']=qs[_0x3569('0x20')](_0x3d3c04[_0x3569('0x37')]['offset']);}_0x4df9e0[_0x3569('0x3f')]=qs['sort'](_0x3d3c04[_0x3569('0x37')][_0x3569('0x40')]);_0x4df9e0['where']=qs['filters'](_[_0x3569('0x41')](_0x3d3c04[_0x3569('0x37')],_0x44bfa8[_0x3569('0x38')]),_0x5cd27b);if(_0x3d3c04[_0x3569('0x37')][_0x3569('0x42')]){_0x4df9e0[_0x3569('0x43')]=_[_0x3569('0x44')](_0x4df9e0[_0x3569('0x43')],{'$or':_[_0x3569('0x31')](_0x5cd27b,function(_0x24d6a0){if(_0x24d6a0[_0x3569('0x35')]!==_0x3569('0x45')){var _0x533a6b={};_0x533a6b[_0x24d6a0[_0x3569('0x2e')]]={'$like':'%'+_0x3d3c04[_0x3569('0x37')][_0x3569('0x42')]+'%'};return _0x533a6b;}})});}_0x4df9e0=_[_0x3569('0x44')]({},_0x4df9e0,_0x3d3c04[_0x3569('0x46')]);var _0xbe6648={'where':_0x4df9e0[_0x3569('0x43')]};return db[_0x3569('0x32')][_0x3569('0x22')](_0xbe6648)[_0x3569('0x2a')](function(_0x1c15c9){_0x7c30e0['count']=_0x1c15c9;if(_0x3d3c04[_0x3569('0x37')]['includeAll']){_0x4df9e0[_0x3569('0x47')]=[{'all':!![]}];}return db[_0x3569('0x32')]['findAll'](_0x4df9e0);})[_0x3569('0x2a')](function(_0xf76e30){_0x7c30e0['rows']=_0xf76e30;return _0x7c30e0;})['then'](respondWithFilteredResult(_0x2f9daf,_0x4df9e0))[_0x3569('0x48')](handleError(_0x2f9daf,null));};exports[_0x3569('0x49')]=function(_0x2b755b,_0x588a9a){var _0x3cb825={'raw':!![],'where':{'id':_0x2b755b['params']['id']}},_0x44f7b6={};_0x44f7b6['model']=_[_0x3569('0x4a')](db[_0x3569('0x32')][_0x3569('0x33')]);_0x44f7b6[_0x3569('0x37')]=_[_0x3569('0x4a')](_0x2b755b[_0x3569('0x37')]);_0x44f7b6[_0x3569('0x38')]=_['intersection'](_0x44f7b6[_0x3569('0x3a')],_0x44f7b6[_0x3569('0x37')]);_0x3cb825[_0x3569('0x3b')]=_[_0x3569('0x39')](_0x44f7b6['model'],qs['fields'](_0x2b755b[_0x3569('0x37')]['fields']));_0x3cb825['attributes']=_0x3cb825[_0x3569('0x3b')][_0x3569('0x4b')]?_0x3cb825[_0x3569('0x3b')]:_0x44f7b6[_0x3569('0x3a')];if(_0x2b755b[_0x3569('0x37')][_0x3569('0x4c')]){_0x3cb825[_0x3569('0x47')]=[{'all':!![]}];}_0x3cb825=_[_0x3569('0x44')]({},_0x3cb825,_0x2b755b[_0x3569('0x46')]);return db[_0x3569('0x32')]['find'](_0x3cb825)['then'](handleEntityNotFound(_0x588a9a,null))['then'](respondWithResult(_0x588a9a,null))[_0x3569('0x48')](handleError(_0x588a9a,null));};exports[_0x3569('0x4d')]=function(_0x54d5de,_0x13f194,_0x667841){return db[_0x3569('0x32')][_0x3569('0x4e')]({'where':{'id':_0x54d5de[_0x3569('0x4f')]['id']},'attributes':['name',_0x3569('0x8')],'raw':!![]})[_0x3569('0x2a')](handleEntityNotFound(_0x13f194,null))['then'](function(_0x46bf69){if(_0x46bf69){var _0x5dd9c0=path[_0x3569('0x50')](config['root'],_0x3569('0x51'),util[_0x3569('0x52')](_0x3569('0x53'),path[_0x3569('0x54')](_0x46bf69['path'])));var _0x132296=fs[_0x3569('0x55')](_0x5dd9c0);var _0x2bccae=archiver(_0x3569('0x56'),{'zlib':{'level':0x9}});_0x2bccae['on'](_0x3569('0x57'),function(_0x3d3726){if(_0x3d3726['code']==='ENOENT'){logger[_0x3569('0x2c')](_0x3d3726);}else{throw new db['Sequelize'][(_0x3569('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x2bccae['on'](_0x3569('0x2c'),function(_0x3faf0c){throw new db[(_0x3569('0x59'))]['Error'](_0x3569('0x5a'));});_0x2bccae[_0x3569('0x5b')](_0x132296);_0x2bccae[_0x3569('0x5c')](_0x3569('0x5d'),{'cwd':path['join'](config['root'],_0x3569('0x51'),path[_0x3569('0x5e')](_0x46bf69[_0x3569('0x8')])),'ignore':[path[_0x3569('0x50')](path['basename'](_0x46bf69['path']),_0x3569('0x5f')),path[_0x3569('0x50')](path['basename'](_0x46bf69[_0x3569('0x8')]),'attachments/**/*')],'nodir':!![]})[_0x3569('0x60')]();_0x132296['on']('close',function(){if(!fs['existsSync'](_0x5dd9c0)){throw new db[(_0x3569('0x59'))][(_0x3569('0x58'))](_0x3569('0x61'));}return _0x13f194['download'](_0x5dd9c0,util[_0x3569('0x52')](_0x3569('0x53'),path[_0x3569('0x54')](_0x46bf69[_0x3569('0x8')])),function(_0x168d32){if(_0x168d32){throw new db['Sequelize'][(_0x3569('0x58'))](_0x3569('0x62'));}fs[_0x3569('0x63')](_0x5dd9c0);logger[_0x3569('0x64')](_0x3569('0x65'));logger[_0x3569('0x64')](_0x3569('0x66'));});});}return null;})[_0x3569('0x48')](handleError(_0x13f194,null));};exports[_0x3569('0x67')]=function(_0x167683,_0x417748,_0x991e06){var _0x40faba=path[_0x3569('0x54')](_0x167683[_0x3569('0x68')][_0x3569('0x69')],path['extname'](_0x167683[_0x3569('0x68')][_0x3569('0x69')]));var _0x33a73c=path[_0x3569('0x50')](config[_0x3569('0x6a')],'server/files/plugins',_0x167683[_0x3569('0x68')][_0x3569('0x69')]);var _0x16633a=path[_0x3569('0x50')](config['root'],_0x3569('0x51'),_0x40faba);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x33a73c);logger[_0x3569('0x64')](_0x3569('0x6b'),_0x16633a);try{fs[_0x3569('0x6c')](_0x33a73c,parseInt(_0x3569('0x6d'),0x8));extract(_0x33a73c,{'dir':_0x16633a},function(_0x445f70){if(_0x445f70){logger[_0x3569('0x2c')](_0x445f70);handleError(_0x445f70,!![]);};var _0xe1318a=fs['readdirSync'](_0x16633a);if(_0xe1318a['length']>0x1){removeReferences(_0x33a73c,_0x16633a);logger['error'](_0x3569('0x6e'));return _0x991e06(new Error('Invalid\x20plugin\x20structure'));}var _0x1caf28=fs[_0x3569('0x6f')](path[_0x3569('0x50')](_0x16633a,_0xe1318a[0x0]));if(_0x1caf28[_0x3569('0x70')]()){removeReferences(_0x33a73c,_0x16633a);logger[_0x3569('0x2c')]('Invalid\x20plugin\x20structure');return _0x991e06(new Error('Invalid\x20plugin\x20structure'));}if(_0x1caf28['isDirectory']()){var _0x1e4ffd=fs['readdirSync'](path[_0x3569('0x50')](_0x16633a,_0xe1318a[0x0]));if(_0x1e4ffd[_0x3569('0x4b')]===0x0){removeReferences(_0x33a73c,_0x16633a);logger[_0x3569('0x2c')](_0x3569('0x6e'));return _0x991e06(new Error('Invalid\x20plugin\x20structure'));}var _0x4aba4f=_0x1e4ffd[_0x3569('0x71')](function(_0xd5fc44){return _0xd5fc44===_0x3569('0x72');});if(!_0x4aba4f){return _0x991e06(new Error(_0x3569('0x73')));}var _0x1c141d=fs[_0x3569('0x74')](path[_0x3569('0x50')](_0x16633a,_0xe1318a[0x0],_0x3569('0x72')));var _0x49fe05=JSON['parse'](_0x1c141d);if(_0x3569('0x21')==typeof _0x49fe05[_0x3569('0x2e')]){return _0x991e06(new Error(_0x3569('0x75')));}if(_0x3569('0x21')==typeof _0x49fe05[_0x3569('0x35')]){return _0x991e06(new Error(_0x3569('0x76')));}if(_0x3569('0x21')==typeof _0x49fe05[_0x3569('0x77')]){return _0x991e06(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x3569('0x21')==typeof _0x49fe05[_0x3569('0x78')]){return _0x991e06(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x49fe05[_0x3569('0x35')]===_0x3569('0x79')){if(_0x3569('0x21')==typeof _0x49fe05[_0x3569('0x78')][_0x3569('0x7a')]){return _0x991e06(new Error(_0x3569('0x7b')));}if(_0x3569('0x21')==typeof _0x49fe05[_0x3569('0x78')][_0x3569('0x7a')][_0x3569('0x7c')]&&_0x3569('0x21')==typeof _0x49fe05[_0x3569('0x78')][_0x3569('0x7a')][_0x3569('0x7d')]){return _0x991e06(new Error(_0x3569('0x7e')));}}else if(_0x49fe05['type']===_0x3569('0x7f')){if(_0x3569('0x21')==typeof _0x49fe05[_0x3569('0x78')][_0x3569('0x80')]){return _0x991e06(new Error(_0x3569('0x81')));}if('undefined'==typeof _0x49fe05[_0x3569('0x78')][_0x3569('0x82')]){return _0x991e06(new Error(_0x3569('0x83')));}}else{return _0x991e06(new Error(_0x3569('0x84')));}var _0x11cca8=_0x49fe05[_0x3569('0x2e')];var _0x1a51a6=_0x49fe05[_0x3569('0x85')];var _0x31ff68=_0x49fe05[_0x3569('0x35')];var _0x5171b1=_0x49fe05['sidebar']?_0x49fe05[_0x3569('0x86')]:_0x3569('0x87');var _0x5eb0bc=_0x49fe05[_0x3569('0x88')]?_0x49fe05[_0x3569('0x88')]:_0x3569('0x89');var _0x5a825a='';var _0x784d3e='';var _0x465f53='';var _0xf4917b='';var _0x349cb3=_0x49fe05[_0x3569('0x77')];if(_0x31ff68===_0x3569('0x79')){if(_0x3569('0x21')!=typeof _0x49fe05[_0x3569('0x78')][_0x3569('0x7a')][_0x3569('0x7c')]){var _0x8bb8e8=_0x49fe05[_0x3569('0x78')][_0x3569('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x8bb8e8)){_0x5a825a=path[_0x3569('0x50')](_0x3569('0x8a'),_0x40faba,_0xe1318a[0x0],_0x8bb8e8);}else{_0x5a825a=_0x8bb8e8;}}else{logger[_0x3569('0x64')](_0x3569('0x8b'));}if('undefined'!=typeof _0x49fe05[_0x3569('0x78')][_0x3569('0x7a')][_0x3569('0x7d')]){var _0x550884=_0x49fe05[_0x3569('0x78')][_0x3569('0x7a')][_0x3569('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x3569('0x8c')](_0x550884)){_0x784d3e=path[_0x3569('0x50')](_0x3569('0x8a'),_0x40faba,_0xe1318a[0x0],_0x550884);}else{_0x784d3e=_0x550884;}}else{logger[_0x3569('0x64')](_0x3569('0x8d'));}}else if(_0x31ff68===_0x3569('0x7f')){_0x465f53=_0x49fe05['parameters'][_0x3569('0x80')];_0xf4917b=_0x49fe05[_0x3569('0x78')][_0x3569('0x82')];if(_0x3569('0x21')!=typeof _0x49fe05[_0x3569('0x78')][_0x3569('0x7a')]){if(_0x3569('0x21')!=typeof _0x49fe05[_0x3569('0x78')][_0x3569('0x7a')][_0x3569('0x7c')]){var _0x8bb8e8=_0x49fe05[_0x3569('0x78')][_0x3569('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x8bb8e8)){_0x5a825a=path[_0x3569('0x50')](_0x3569('0x8a'),_0x40faba,_0xe1318a[0x0],_0x8bb8e8);}else{_0x5a825a=_0x8bb8e8;}}if(_0x3569('0x21')!=typeof _0x49fe05[_0x3569('0x78')][_0x3569('0x7a')][_0x3569('0x7d')]){var _0x550884=_0x49fe05[_0x3569('0x78')]['views'][_0x3569('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x3569('0x8c')](_0x550884)){_0x784d3e=path[_0x3569('0x50')](_0x3569('0x8a'),_0x40faba,_0xe1318a[0x0],_0x550884);}else{_0x784d3e=_0x550884;}}}}var _0x5859cf={'name':_0x11cca8,'description':_0x1a51a6,'path':path[_0x3569('0x50')](_0x40faba,_0xe1318a[0x0]),'type':_0x31ff68,'sidebar':_0x5171b1,'icon':_0x5eb0bc,'adminUrl':_0x5a825a,'agentUrl':_0x784d3e,'scriptName':_0x465f53,'scriptPath':_0xf4917b,'version':_0x349cb3};removeReferences(_0x33a73c,null);return db['Plugin'][_0x3569('0x8e')](_0x5859cf)['then'](function(_0x480dac){var _0x15010a={'role':_0x167683[_0x3569('0x8f')][_0x3569('0x90')],'userProfileId':_0x167683[_0x3569('0x8f')]['userProfileId']};if(!_0x15010a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15010a['role']===_0x3569('0x91')){var _0x1ac503=_0x480dac[_0x3569('0x28')]({'plain':!![]});return db[_0x3569('0x92')][_0x3569('0x4e')]({'where':{'name':'Plugins','userProfileId':_0x15010a['userProfileId']},'raw':!![]})[_0x3569('0x2a')](function(_0x2da457){if(_0x2da457&&_0x2da457[_0x3569('0x93')]===0x0){return db[_0x3569('0x94')][_0x3569('0x8e')]({'name':_0x1ac503['name'],'resourceId':_0x1ac503['id'],'type':_0x2da457['name'],'sectionId':_0x2da457['id']},{})[_0x3569('0x2a')](function(){return _0x480dac;});}else{return _0x480dac;}})[_0x3569('0x48')](function(_0x473ad1){logger[_0x3569('0x2c')](_0x3569('0x95'),_0x473ad1);throw _0x473ad1;});}return _0x480dac;})['then'](respondWithResult(_0x417748,null))[_0x3569('0x48')](handleError(_0x417748,null));}});}catch(_0x1bd804){_0x417748[_0x3569('0x1e')](0x1f4)['send'](_0x1bd804);}};function removeReferences(_0x1cca4b,_0x3e6ceb){try{if(_0x1cca4b){fs['unlinkSync'](_0x1cca4b);logger[_0x3569('0x64')](_0x3569('0x96'));}if(_0x3e6ceb){rimraf(_0x3e6ceb,function(){});logger[_0x3569('0x64')](_0x3569('0x97'));}}catch(_0x107c5b){logger[_0x3569('0x2c')](_0x107c5b);}}exports[_0x3569('0x26')]=function(_0xbe24e4,_0x44d115,_0x84b4fb){return db[_0x3569('0x32')][_0x3569('0x4e')]({'where':{'id':_0xbe24e4[_0x3569('0x4f')]['id']}})[_0x3569('0x2a')](handleEntityNotFound(_0x44d115,null))['then'](saveUpdates(_0xbe24e4['body'],null))[_0x3569('0x2a')](respondWithResult(_0x44d115,null))[_0x3569('0x48')](handleError(_0x44d115,null));};exports[_0x3569('0x98')]=function(_0x3a9e17,_0x397d20,_0x324461){return db[_0x3569('0x32')][_0x3569('0x4e')]({'where':{'id':_0x3a9e17[_0x3569('0x4f')]['id']}})[_0x3569('0x2a')](function(_0x11a177){if(_0x11a177){return _0x11a177[_0x3569('0x27')]();}})[_0x3569('0x2a')](function(_0x4cbfce){rimraf(path[_0x3569('0x50')](config['root'],_0x3569('0x51'),path[_0x3569('0x5e')](_0x4cbfce[_0x3569('0x8')])),function(){});return _0x4cbfce;})['then'](handleEntityNotFound(_0x397d20,null))[_0x3569('0x2a')](respondWithStatusCode(_0x397d20,null))[_0x3569('0x48')](handleError(_0x397d20,null));};exports[_0x3569('0x99')]=function(_0x5e46d7,_0x47db88,_0x42bfab){return BPromise[_0x3569('0x9a')]()[_0x3569('0x2a')](function(){if(!_0x5e46d7['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5e46d7[_0x3569('0x37')]['port']){throw new Error(_0x3569('0x9b'));}var _0x8583=_0x5e46d7['query'][_0x3569('0x9c')]?_0x5e46d7['query'][_0x3569('0x9c')]+':'+_0x5e46d7[_0x3569('0x37')]['port']:_0x3569('0x9d')+_0x5e46d7[_0x3569('0x37')]['port'];var _0x342393=_0x5e46d7[_0x3569('0x37')][_0x3569('0x1f')]?_0x5e46d7[_0x3569('0x37')][_0x3569('0x1f')]:!![];var _0x2909fd=_0x5e46d7['query'][_0x3569('0x9e')]?_0x5e46d7['query'][_0x3569('0x9e')]:null;var _0x36a43a={'method':_0x5e46d7[_0x3569('0x9f')],'uri':util['format']('%s%s',_0x8583,_0x5e46d7[_0x3569('0x37')][_0x3569('0x8')]),'json':_0x342393,'resolveWithFullResponse':!![],'encoding':_0x2909fd,'qs':_0x5e46d7[_0x3569('0x37')]};if(_0x5e46d7[_0x3569('0xa0')]){_0x36a43a[_0x3569('0xa0')]=_0x5e46d7[_0x3569('0xa0')];if(_0x36a43a[_0x3569('0xa0')][_0x3569('0xa1')]){delete _0x36a43a[_0x3569('0xa0')][_0x3569('0xa1')];}}if(_0x36a43a[_0x3569('0xa0')]['content-type']){delete _0x36a43a['headers'][_0x3569('0xa2')];}return rp(_0x36a43a);})[_0x3569('0x2a')](function(_0x20c727){if(_0x20c727){_0x47db88[_0x3569('0xa3')](_0x20c727[_0x3569('0xa0')]);logger[_0x3569('0x64')](_0x20c727[_0x3569('0x8f')]);if(_['endsWith'](_0x5e46d7[_0x3569('0x37')][_0x3569('0x8')],_0x3569('0x4d'))&&_0x20c727[_0x3569('0xa4')]==0x1f4){return _0x47db88[_0x3569('0x1d')](_0x20c727['statusCode']);}else{return _0x47db88[_0x3569('0x1e')](_0x20c727[_0x3569('0xa4')])[_0x3569('0x2f')](_0x20c727[_0x3569('0x8f')]);}}else{return _0x47db88[_0x3569('0x1d')](0xc8);}})['catch'](handleError(_0x47db88,null));};exports[_0x3569('0xa5')]=function(_0x30785e,_0x1775bd,_0x5cfbc3){return BPromise[_0x3569('0x9a')]()[_0x3569('0x2a')](function(){if(!_0x30785e[_0x3569('0x37')][_0x3569('0x8')]){throw new Error(_0x3569('0xa6'));}if(!_0x30785e[_0x3569('0x37')][_0x3569('0xa7')]){throw new Error(_0x3569('0x9b'));}var _0x1702b3=_0x30785e[_0x3569('0x37')][_0x3569('0x9c')]?_0x30785e[_0x3569('0x37')][_0x3569('0x9c')]+':'+_0x30785e['query']['port']:_0x3569('0x9d')+_0x30785e[_0x3569('0x37')]['port'];var _0x3f882a=_0x30785e['query']['json']?_0x30785e[_0x3569('0x37')][_0x3569('0x1f')]:!![];var _0x13fb77=_0x30785e[_0x3569('0x37')][_0x3569('0x9e')]?_0x30785e[_0x3569('0x37')][_0x3569('0x9e')]:null;var _0x46ea0c={'method':_0x30785e[_0x3569('0x9f')],'uri':util[_0x3569('0x52')](_0x3569('0xa8'),_0x1702b3,_0x30785e[_0x3569('0x37')]['path']),'json':_0x3f882a,'resolveWithFullResponse':!![],'encoding':_0x13fb77,'body':_0x30785e[_0x3569('0x8f')]};if(_0x30785e[_0x3569('0xa0')]){_0x46ea0c['headers']=_0x30785e[_0x3569('0xa0')];if(_0x46ea0c[_0x3569('0xa0')][_0x3569('0xa1')]){delete _0x46ea0c[_0x3569('0xa0')][_0x3569('0xa1')];}}if(_0x46ea0c['headers'][_0x3569('0xa2')]){delete _0x46ea0c[_0x3569('0xa0')][_0x3569('0xa2')];}return rp(_0x46ea0c);})['then'](function(_0x12e40b){if(_0x12e40b){_0x1775bd[_0x3569('0xa3')](_0x12e40b['headers']);logger['info'](_0x12e40b[_0x3569('0x8f')]);return _0x1775bd['status'](_0x12e40b['statusCode'])['send'](_0x12e40b[_0x3569('0x8f')]);}else{return _0x1775bd[_0x3569('0x1d')](0xc8);}})[_0x3569('0x48')](handleError(_0x1775bd,null));}; \ No newline at end of file +var _0xe5fa=['icon','icon-apps','version','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','agent','create','body','userProfileId','role','user','UserProfileSection','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','statusCode','webhookPost','content-type','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','papaparse','extract-zip','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','download','join','root','server/files/plugins','format','%s.zip','basename','zip','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','description','sidebar','always'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xe5fa,0x186));var _0xae5f=function(_0x82fa7e,_0xd127a){_0x82fa7e=_0x82fa7e-0x0;var _0x226def=_0xe5fa[_0x82fa7e];return _0x226def;};'use strict';var emlformat=require(_0xae5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae5f('0x1'));var jsonpatch=require(_0xae5f('0x2'));var rp=require(_0xae5f('0x3'));var moment=require(_0xae5f('0x4'));var BPromise=require(_0xae5f('0x5'));var Mustache=require(_0xae5f('0x6'));var util=require(_0xae5f('0x7'));var path=require(_0xae5f('0x8'));var sox=require(_0xae5f('0x9'));var csv=require(_0xae5f('0xa'));var ejs=require(_0xae5f('0xb'));var fs=require('fs');var fs_extra=require(_0xae5f('0xc'));var _=require(_0xae5f('0xd'));var squel=require(_0xae5f('0xe'));var crypto=require(_0xae5f('0xf'));var jsforce=require(_0xae5f('0x10'));var deskjs=require(_0xae5f('0x11'));var toCsv=require(_0xae5f('0xa'));var querystring=require('querystring');var Papa=require(_0xae5f('0x12'));var extract=require(_0xae5f('0x13'));var rimraf=require(_0xae5f('0x14'));var archiver=require('archiver');var Redis=require(_0xae5f('0x15'));var authService=require(_0xae5f('0x16'));var qs=require(_0xae5f('0x17'));var as=require(_0xae5f('0x18'));var hardwareService=require(_0xae5f('0x19'));var logger=require(_0xae5f('0x1a'))(_0xae5f('0x1b'));var utils=require('../../config/utils');var config=require(_0xae5f('0x1c'));var licenseUtil=require(_0xae5f('0x1d'));var db=require(_0xae5f('0x1e'))['db'];config[_0xae5f('0x1f')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xae5f('0x20'))(new Redis(config[_0xae5f('0x1f')]));require(_0xae5f('0x21'))[_0xae5f('0x22')](socket);function respondWithStatusCode(_0x5c2534,_0x5224b2){_0x5224b2=_0x5224b2||0xcc;return function(_0x567900){if(_0x567900){return _0x5c2534[_0xae5f('0x23')](_0x5224b2);}return _0x5c2534[_0xae5f('0x24')](_0x5224b2)[_0xae5f('0x25')]();};}function respondWithResult(_0x38da87,_0x17495a){_0x17495a=_0x17495a||0xc8;return function(_0x191e9b){if(_0x191e9b){return _0x38da87[_0xae5f('0x24')](_0x17495a)[_0xae5f('0x26')](_0x191e9b);}};}function respondWithFilteredResult(_0xe949ff,_0x23b54e){return function(_0x1a238c){if(_0x1a238c){var _0x31a669=typeof _0x23b54e[_0xae5f('0x27')]===_0xae5f('0x28')&&typeof _0x23b54e['limit']===_0xae5f('0x28');var _0x4173e9=_0x1a238c[_0xae5f('0x29')];var _0x57e0fc=_0x31a669?0x0:_0x23b54e[_0xae5f('0x27')];var _0x1993dd=_0x31a669?_0x1a238c[_0xae5f('0x29')]:_0x23b54e[_0xae5f('0x27')]+_0x23b54e['limit'];var _0x55bd7c;if(_0x1993dd>=_0x4173e9){_0x1993dd=_0x4173e9;_0x55bd7c=0xc8;}else{_0x55bd7c=0xce;}_0xe949ff[_0xae5f('0x24')](_0x55bd7c);return _0xe949ff[_0xae5f('0x2a')]('Content-Range',_0x57e0fc+'-'+_0x1993dd+'/'+_0x4173e9)['json'](_0x1a238c);}return null;};}function patchUpdates(_0x7cd086){return function(_0x4c28b8){try{jsonpatch[_0xae5f('0x2b')](_0x4c28b8,_0x7cd086,!![]);}catch(_0x1db556){return BPromise[_0xae5f('0x2c')](_0x1db556);}return _0x4c28b8[_0xae5f('0x2d')]();};}function saveUpdates(_0x213a20,_0x4f4b68){return function(_0x260ea6){if(_0x260ea6){return _0x260ea6[_0xae5f('0x2e')](_0x213a20)[_0xae5f('0x2f')](function(_0x3c0053){return _0x3c0053;});}return null;};}function removeEntity(_0x537020,_0x5a500b){return function(_0x3181e0){if(_0x3181e0){return _0x3181e0[_0xae5f('0x30')]()['then'](function(){var _0x1f2ab8=_0x3181e0[_0xae5f('0x31')]({'plain':!![]});var _0x154034='Plugins';return db[_0xae5f('0x32')][_0xae5f('0x30')]({'where':{'type':_0x154034,'resourceId':_0x1f2ab8['id']}})[_0xae5f('0x2f')](function(){return _0x3181e0;});})[_0xae5f('0x2f')](function(){_0x537020[_0xae5f('0x24')](0xcc)[_0xae5f('0x25')]();});}};}function handleEntityNotFound(_0xdfb95a,_0x1feb10){return function(_0x3a4449){if(!_0x3a4449){_0xdfb95a['sendStatus'](0x194);}return _0x3a4449;};}function handleError(_0x7bca3e,_0x5d914a){_0x5d914a=_0x5d914a||0x1f4;return function(_0x20dba0){logger[_0xae5f('0x33')](_0x20dba0[_0xae5f('0x34')]);if(_0x20dba0[_0xae5f('0x35')]){delete _0x20dba0[_0xae5f('0x35')];}_0x7bca3e[_0xae5f('0x24')](_0x5d914a)[_0xae5f('0x36')](_0x20dba0);};}exports[_0xae5f('0x37')]=function(_0x52d3b5,_0x14b0e2){var _0x229b21={},_0x162854={},_0x19e6b2={'count':0x0,'rows':[]};var _0x48768d=_[_0xae5f('0x38')](db[_0xae5f('0x39')][_0xae5f('0x3a')],function(_0x388b24){return{'name':_0x388b24[_0xae5f('0x3b')],'type':_0x388b24[_0xae5f('0x3c')][_0xae5f('0x3d')]};});_0x162854[_0xae5f('0x3e')]=_[_0xae5f('0x38')](_0x48768d,'name');_0x162854[_0xae5f('0x3f')]=_[_0xae5f('0x40')](_0x52d3b5['query']);_0x162854['filters']=_['intersection'](_0x162854[_0xae5f('0x3e')],_0x162854[_0xae5f('0x3f')]);_0x229b21[_0xae5f('0x41')]=_[_0xae5f('0x42')](_0x162854[_0xae5f('0x3e')],qs[_0xae5f('0x43')](_0x52d3b5['query'][_0xae5f('0x43')]));_0x229b21['attributes']=_0x229b21[_0xae5f('0x41')]['length']?_0x229b21['attributes']:_0x162854['model'];if(!_0x52d3b5[_0xae5f('0x3f')]['hasOwnProperty'](_0xae5f('0x44'))){_0x229b21[_0xae5f('0x45')]=qs[_0xae5f('0x45')](_0x52d3b5[_0xae5f('0x3f')][_0xae5f('0x45')]);_0x229b21['offset']=qs[_0xae5f('0x27')](_0x52d3b5[_0xae5f('0x3f')][_0xae5f('0x27')]);}_0x229b21['order']=qs[_0xae5f('0x46')](_0x52d3b5[_0xae5f('0x3f')][_0xae5f('0x46')]);_0x229b21[_0xae5f('0x47')]=qs[_0xae5f('0x48')](_[_0xae5f('0x49')](_0x52d3b5[_0xae5f('0x3f')],_0x162854[_0xae5f('0x48')]),_0x48768d);if(_0x52d3b5['query'][_0xae5f('0x4a')]){_0x229b21[_0xae5f('0x47')]=_[_0xae5f('0x4b')](_0x229b21[_0xae5f('0x47')],{'$or':_[_0xae5f('0x38')](_0x48768d,function(_0x111dcf){if(_0x111dcf['type']!==_0xae5f('0x4c')){var _0x204b5e={};_0x204b5e[_0x111dcf['name']]={'$like':'%'+_0x52d3b5['query'][_0xae5f('0x4a')]+'%'};return _0x204b5e;}})});}_0x229b21=_[_0xae5f('0x4b')]({},_0x229b21,_0x52d3b5['options']);var _0x5e8220={'where':_0x229b21[_0xae5f('0x47')]};return db[_0xae5f('0x39')][_0xae5f('0x29')](_0x5e8220)[_0xae5f('0x2f')](function(_0xb9daa){_0x19e6b2[_0xae5f('0x29')]=_0xb9daa;if(_0x52d3b5['query'][_0xae5f('0x4d')]){_0x229b21[_0xae5f('0x4e')]=[{'all':!![]}];}return db[_0xae5f('0x39')][_0xae5f('0x4f')](_0x229b21);})[_0xae5f('0x2f')](function(_0x512ddb){_0x19e6b2[_0xae5f('0x50')]=_0x512ddb;return _0x19e6b2;})[_0xae5f('0x2f')](respondWithFilteredResult(_0x14b0e2,_0x229b21))[_0xae5f('0x51')](handleError(_0x14b0e2,null));};exports[_0xae5f('0x52')]=function(_0x3d8083,_0x3d1471){var _0x5a3108={'raw':!![],'where':{'id':_0x3d8083[_0xae5f('0x53')]['id']}},_0xd0e2e8={};_0xd0e2e8['model']=_[_0xae5f('0x40')](db[_0xae5f('0x39')]['rawAttributes']);_0xd0e2e8[_0xae5f('0x3f')]=_[_0xae5f('0x40')](_0x3d8083[_0xae5f('0x3f')]);_0xd0e2e8[_0xae5f('0x48')]=_[_0xae5f('0x42')](_0xd0e2e8[_0xae5f('0x3e')],_0xd0e2e8[_0xae5f('0x3f')]);_0x5a3108[_0xae5f('0x41')]=_['intersection'](_0xd0e2e8[_0xae5f('0x3e')],qs[_0xae5f('0x43')](_0x3d8083[_0xae5f('0x3f')]['fields']));_0x5a3108[_0xae5f('0x41')]=_0x5a3108[_0xae5f('0x41')][_0xae5f('0x54')]?_0x5a3108[_0xae5f('0x41')]:_0xd0e2e8[_0xae5f('0x3e')];if(_0x3d8083[_0xae5f('0x3f')][_0xae5f('0x4d')]){_0x5a3108[_0xae5f('0x4e')]=[{'all':!![]}];}_0x5a3108=_['merge']({},_0x5a3108,_0x3d8083[_0xae5f('0x55')]);return db[_0xae5f('0x39')][_0xae5f('0x56')](_0x5a3108)[_0xae5f('0x2f')](handleEntityNotFound(_0x3d1471,null))[_0xae5f('0x2f')](respondWithResult(_0x3d1471,null))['catch'](handleError(_0x3d1471,null));};exports[_0xae5f('0x57')]=function(_0x10829e,_0x2c62bf,_0x2a44cc){return db[_0xae5f('0x39')][_0xae5f('0x56')]({'where':{'id':_0x10829e[_0xae5f('0x53')]['id']},'attributes':[_0xae5f('0x35'),_0xae5f('0x8')],'raw':!![]})[_0xae5f('0x2f')](handleEntityNotFound(_0x2c62bf,null))[_0xae5f('0x2f')](function(_0x49cd11){if(_0x49cd11){var _0x236fce=path[_0xae5f('0x58')](config[_0xae5f('0x59')],_0xae5f('0x5a'),util[_0xae5f('0x5b')](_0xae5f('0x5c'),path[_0xae5f('0x5d')](_0x49cd11[_0xae5f('0x8')])));var _0x138bd7=fs['createWriteStream'](_0x236fce);var _0x2c1907=archiver(_0xae5f('0x5e'),{'zlib':{'level':0x9}});_0x2c1907['on']('warning',function(_0x33e90f){if(_0x33e90f['code']==='ENOENT'){logger[_0xae5f('0x33')](_0x33e90f);}else{throw new db[(_0xae5f('0x5f'))][(_0xae5f('0x60'))](_0xae5f('0x61'));}});_0x2c1907['on'](_0xae5f('0x33'),function(_0x1be7df){throw new db[(_0xae5f('0x5f'))][(_0xae5f('0x60'))](_0xae5f('0x61'));});_0x2c1907[_0xae5f('0x62')](_0x138bd7);_0x2c1907[_0xae5f('0x63')](_0xae5f('0x64'),{'cwd':path[_0xae5f('0x58')](config[_0xae5f('0x59')],_0xae5f('0x5a'),path[_0xae5f('0x65')](_0x49cd11[_0xae5f('0x8')])),'ignore':[path[_0xae5f('0x58')](path['basename'](_0x49cd11[_0xae5f('0x8')]),_0xae5f('0x66')),path[_0xae5f('0x58')](path[_0xae5f('0x5d')](_0x49cd11['path']),_0xae5f('0x67'))],'nodir':!![]})[_0xae5f('0x68')]();_0x138bd7['on']('close',function(){if(!fs[_0xae5f('0x69')](_0x236fce)){throw new db['Sequelize'][(_0xae5f('0x60'))](_0xae5f('0x6a'));}return _0x2c62bf[_0xae5f('0x57')](_0x236fce,util[_0xae5f('0x5b')](_0xae5f('0x5c'),path['basename'](_0x49cd11[_0xae5f('0x8')])),function(_0x592547){if(_0x592547){throw new db[(_0xae5f('0x5f'))][(_0xae5f('0x60'))](_0xae5f('0x6b'));}fs[_0xae5f('0x6c')](_0x236fce);logger[_0xae5f('0x6d')](_0xae5f('0x6e'));logger['info'](_0xae5f('0x6f'));});});}return null;})[_0xae5f('0x51')](handleError(_0x2c62bf,null));};exports[_0xae5f('0x70')]=function(_0x4ed85d,_0x3da1e5,_0x4de929){var _0x148793=path['basename'](_0x4ed85d['file'][_0xae5f('0x71')],path[_0xae5f('0x72')](_0x4ed85d[_0xae5f('0x73')]['filename']));var _0x32a0a5=path[_0xae5f('0x58')](config['root'],_0xae5f('0x5a'),_0x4ed85d[_0xae5f('0x73')][_0xae5f('0x71')]);var _0x1de721=path[_0xae5f('0x58')](config['root'],_0xae5f('0x5a'),_0x148793);logger[_0xae5f('0x6d')](_0xae5f('0x74'),_0x32a0a5);logger[_0xae5f('0x6d')]('Plugin\x20upload\x20destination:\x20%s',_0x1de721);try{fs[_0xae5f('0x75')](_0x32a0a5,parseInt(_0xae5f('0x76'),0x8));extract(_0x32a0a5,{'dir':_0x1de721},function(_0x37c89a){if(_0x37c89a){logger[_0xae5f('0x33')](_0x37c89a);handleError(_0x37c89a,!![]);};var _0x5ac0b9=fs['readdirSync'](_0x1de721);if(_0x5ac0b9[_0xae5f('0x54')]>0x1){removeReferences(_0x32a0a5,_0x1de721);logger[_0xae5f('0x33')](_0xae5f('0x77'));return _0x4de929(new Error(_0xae5f('0x77')));}var _0x401352=fs[_0xae5f('0x78')](path[_0xae5f('0x58')](_0x1de721,_0x5ac0b9[0x0]));if(_0x401352[_0xae5f('0x79')]()){removeReferences(_0x32a0a5,_0x1de721);logger[_0xae5f('0x33')]('Invalid\x20plugin\x20structure');return _0x4de929(new Error('Invalid\x20plugin\x20structure'));}if(_0x401352[_0xae5f('0x7a')]()){var _0x1e7b23=fs[_0xae5f('0x7b')](path[_0xae5f('0x58')](_0x1de721,_0x5ac0b9[0x0]));if(_0x1e7b23[_0xae5f('0x54')]===0x0){removeReferences(_0x32a0a5,_0x1de721);logger['error'](_0xae5f('0x77'));return _0x4de929(new Error(_0xae5f('0x77')));}var _0x5b2380=_0x1e7b23[_0xae5f('0x7c')](function(_0x423f6e){return _0x423f6e===_0xae5f('0x7d');});if(!_0x5b2380){return _0x4de929(new Error(_0xae5f('0x7e')));}var _0x55497f=fs[_0xae5f('0x7f')](path[_0xae5f('0x58')](_0x1de721,_0x5ac0b9[0x0],_0xae5f('0x7d')));var _0x187ada=JSON[_0xae5f('0x80')](_0x55497f);if(_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x35')]){return _0x4de929(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x187ada[_0xae5f('0x3c')]){return _0x4de929(new Error(_0xae5f('0x81')));}if(_0xae5f('0x28')==typeof _0x187ada['version']){return _0x4de929(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x82')]){return _0x4de929(new Error(_0xae5f('0x83')));}if(_0x187ada[_0xae5f('0x3c')]===_0xae5f('0x84')){if(_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]){return _0x4de929(new Error(_0xae5f('0x86')));}if(_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')][_0xae5f('0x87')]&&_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]['agent']){return _0x4de929(new Error(_0xae5f('0x88')));}}else if(_0x187ada['type']===_0xae5f('0x89')){if(_0xae5f('0x28')==typeof _0x187ada['parameters'][_0xae5f('0x8a')]){return _0x4de929(new Error(_0xae5f('0x8b')));}if(_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x8c')]){return _0x4de929(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4de929(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4ec848=_0x187ada[_0xae5f('0x35')];var _0x20518d=_0x187ada[_0xae5f('0x8d')];var _0x55e0d2=_0x187ada[_0xae5f('0x3c')];var _0x4bcec0=_0x187ada[_0xae5f('0x8e')]?_0x187ada[_0xae5f('0x8e')]:_0xae5f('0x8f');var _0x3959c5=_0x187ada[_0xae5f('0x90')]?_0x187ada['icon']:_0xae5f('0x91');var _0xee8b72='';var _0x6267b1='';var _0x5e6d90='';var _0x5c8232='';var _0x3f69dd=_0x187ada[_0xae5f('0x92')];if(_0x55e0d2===_0xae5f('0x84')){if(_0xae5f('0x28')!=typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')][_0xae5f('0x87')]){var _0x34d1af=_0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x34d1af)){_0xee8b72=path[_0xae5f('0x58')]('plugins',_0x148793,_0x5ac0b9[0x0],_0x34d1af);}else{_0xee8b72=_0x34d1af;}}else{logger[_0xae5f('0x6d')](_0xae5f('0x93'));}if(_0xae5f('0x28')!=typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]['agent']){var _0x4f08c4=_0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xae5f('0x94')](_0x4f08c4)){_0x6267b1=path[_0xae5f('0x58')](_0xae5f('0x95'),_0x148793,_0x5ac0b9[0x0],_0x4f08c4);}else{_0x6267b1=_0x4f08c4;}}else{logger[_0xae5f('0x6d')](_0xae5f('0x96'));}}else if(_0x55e0d2===_0xae5f('0x89')){_0x5e6d90=_0x187ada[_0xae5f('0x82')][_0xae5f('0x8a')];_0x5c8232=_0x187ada[_0xae5f('0x82')][_0xae5f('0x8c')];if('undefined'!=typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]){if(_0xae5f('0x28')!=typeof _0x187ada['parameters'][_0xae5f('0x85')][_0xae5f('0x87')]){var _0x34d1af=_0x187ada['parameters'][_0xae5f('0x85')][_0xae5f('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x34d1af)){_0xee8b72=path[_0xae5f('0x58')]('plugins',_0x148793,_0x5ac0b9[0x0],_0x34d1af);}else{_0xee8b72=_0x34d1af;}}if(_0xae5f('0x28')!=typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')][_0xae5f('0x97')]){var _0x4f08c4=_0x187ada[_0xae5f('0x82')][_0xae5f('0x85')][_0xae5f('0x97')];if(!/^(f|ht)tps?:\/\//i[_0xae5f('0x94')](_0x4f08c4)){_0x6267b1=path[_0xae5f('0x58')](_0xae5f('0x95'),_0x148793,_0x5ac0b9[0x0],_0x4f08c4);}else{_0x6267b1=_0x4f08c4;}}}}var _0x2ec1c4={'name':_0x4ec848,'description':_0x20518d,'path':path[_0xae5f('0x58')](_0x148793,_0x5ac0b9[0x0]),'type':_0x55e0d2,'sidebar':_0x4bcec0,'icon':_0x3959c5,'adminUrl':_0xee8b72,'agentUrl':_0x6267b1,'scriptName':_0x5e6d90,'scriptPath':_0x5c8232,'version':_0x3f69dd};removeReferences(_0x32a0a5,null);return db['Plugin'][_0xae5f('0x98')](_0x2ec1c4)[_0xae5f('0x2f')](function(_0x7a94f6){var _0x8ab6c8={'role':_0x4ed85d['body']['role'],'userProfileId':_0x4ed85d[_0xae5f('0x99')][_0xae5f('0x9a')]};if(!_0x8ab6c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8ab6c8[_0xae5f('0x9b')]===_0xae5f('0x9c')){var _0x5e5b19=_0x7a94f6['get']({'plain':!![]});return db[_0xae5f('0x9d')][_0xae5f('0x56')]({'where':{'name':_0xae5f('0x9e'),'userProfileId':_0x8ab6c8[_0xae5f('0x9a')]},'raw':!![]})[_0xae5f('0x2f')](function(_0x47b694){if(_0x47b694&&_0x47b694['autoAssociation']===0x0){return db[_0xae5f('0x32')][_0xae5f('0x98')]({'name':_0x5e5b19[_0xae5f('0x35')],'resourceId':_0x5e5b19['id'],'type':_0x47b694[_0xae5f('0x35')],'sectionId':_0x47b694['id']},{})[_0xae5f('0x2f')](function(){return _0x7a94f6;});}else{return _0x7a94f6;}})[_0xae5f('0x51')](function(_0x3e9396){logger[_0xae5f('0x33')](_0xae5f('0x9f'),_0x3e9396);throw _0x3e9396;});}return _0x7a94f6;})[_0xae5f('0x2f')](respondWithResult(_0x3da1e5,null))['catch'](handleError(_0x3da1e5,null));}});}catch(_0x2a086b){_0x3da1e5['status'](0x1f4)[_0xae5f('0x36')](_0x2a086b);}};function removeReferences(_0x500b56,_0xc1fc7b){try{if(_0x500b56){fs[_0xae5f('0x6c')](_0x500b56);logger[_0xae5f('0x6d')](_0xae5f('0xa0'));}if(_0xc1fc7b){rimraf(_0xc1fc7b,function(){});logger[_0xae5f('0x6d')](_0xae5f('0xa1'));}}catch(_0x5e4b8e){logger[_0xae5f('0x33')](_0x5e4b8e);}}exports[_0xae5f('0x2e')]=function(_0x4c1400,_0x174d3c,_0x3af222){return db[_0xae5f('0x39')][_0xae5f('0x56')]({'where':{'id':_0x4c1400['params']['id']}})[_0xae5f('0x2f')](handleEntityNotFound(_0x174d3c,null))['then'](saveUpdates(_0x4c1400[_0xae5f('0x99')],null))[_0xae5f('0x2f')](respondWithResult(_0x174d3c,null))[_0xae5f('0x51')](handleError(_0x174d3c,null));};exports[_0xae5f('0xa2')]=function(_0x3542b9,_0x54d38e,_0x385bc7){return db[_0xae5f('0x39')]['find']({'where':{'id':_0x3542b9[_0xae5f('0x53')]['id']}})[_0xae5f('0x2f')](function(_0x35e3cd){if(_0x35e3cd){return _0x35e3cd[_0xae5f('0x30')]();}})['then'](function(_0x5c424e){rimraf(path[_0xae5f('0x58')](config[_0xae5f('0x59')],_0xae5f('0x5a'),path[_0xae5f('0x65')](_0x5c424e[_0xae5f('0x8')])),function(){});return _0x5c424e;})[_0xae5f('0x2f')](handleEntityNotFound(_0x54d38e,null))[_0xae5f('0x2f')](respondWithStatusCode(_0x54d38e,null))[_0xae5f('0x51')](handleError(_0x54d38e,null));};exports[_0xae5f('0xa3')]=function(_0x50bcfa,_0x721cf3,_0x5d59ef){return BPromise[_0xae5f('0xa4')]()['then'](function(){if(!_0x50bcfa[_0xae5f('0x3f')][_0xae5f('0x8')]){throw new Error(_0xae5f('0xa5'));}if(!_0x50bcfa[_0xae5f('0x3f')][_0xae5f('0xa6')]){throw new Error(_0xae5f('0xa7'));}var _0x1feba7=_0x50bcfa['query'][_0xae5f('0xa8')]?_0x50bcfa['query'][_0xae5f('0xa8')]+':'+_0x50bcfa[_0xae5f('0x3f')][_0xae5f('0xa6')]:_0xae5f('0xa9')+_0x50bcfa['query']['port'];var _0x5636ac=_0x50bcfa['query'][_0xae5f('0x26')]?_0x50bcfa[_0xae5f('0x3f')]['json']:!![];var _0x522d65=_0x50bcfa['query'][_0xae5f('0xaa')]?_0x50bcfa[_0xae5f('0x3f')][_0xae5f('0xaa')]:null;var _0x1e857c={'method':_0x50bcfa[_0xae5f('0xab')],'uri':util[_0xae5f('0x5b')](_0xae5f('0xac'),_0x1feba7,_0x50bcfa['query']['path']),'json':_0x5636ac,'resolveWithFullResponse':!![],'encoding':_0x522d65,'qs':_0x50bcfa[_0xae5f('0x3f')]};if(_0x50bcfa[_0xae5f('0xad')]){_0x1e857c[_0xae5f('0xad')]=_0x50bcfa[_0xae5f('0xad')];if(_0x1e857c[_0xae5f('0xad')]['content-length']){delete _0x1e857c[_0xae5f('0xad')][_0xae5f('0xae')];}}if(_0x1e857c['headers']['content-type']){delete _0x1e857c[_0xae5f('0xad')]['content-type'];}return rp(_0x1e857c);})['then'](function(_0x31b818){if(_0x31b818){_0x721cf3[_0xae5f('0x2a')](_0x31b818[_0xae5f('0xad')]);logger[_0xae5f('0x6d')](_0x31b818['body']);if(_['endsWith'](_0x50bcfa['query']['path'],_0xae5f('0x57'))&&_0x31b818['statusCode']==0x1f4){return _0x721cf3[_0xae5f('0x23')](_0x31b818[_0xae5f('0xaf')]);}else{return _0x721cf3['status'](_0x31b818[_0xae5f('0xaf')])['send'](_0x31b818[_0xae5f('0x99')]);}}else{return _0x721cf3['sendStatus'](0xc8);}})[_0xae5f('0x51')](handleError(_0x721cf3,null));};exports[_0xae5f('0xb0')]=function(_0x4c2290,_0xd17a9,_0x3f52f0){return BPromise[_0xae5f('0xa4')]()['then'](function(){if(!_0x4c2290['query'][_0xae5f('0x8')]){throw new Error(_0xae5f('0xa5'));}if(!_0x4c2290[_0xae5f('0x3f')][_0xae5f('0xa6')]){throw new Error(_0xae5f('0xa7'));}var _0x21c045=_0x4c2290[_0xae5f('0x3f')][_0xae5f('0xa8')]?_0x4c2290[_0xae5f('0x3f')]['hostname']+':'+_0x4c2290[_0xae5f('0x3f')][_0xae5f('0xa6')]:_0xae5f('0xa9')+_0x4c2290['query'][_0xae5f('0xa6')];var _0x56c273=_0x4c2290[_0xae5f('0x3f')][_0xae5f('0x26')]?_0x4c2290[_0xae5f('0x3f')][_0xae5f('0x26')]:!![];var _0x39c80d=_0x4c2290[_0xae5f('0x3f')][_0xae5f('0xaa')]?_0x4c2290['query'][_0xae5f('0xaa')]:null;var _0x3f86d8={'method':_0x4c2290[_0xae5f('0xab')],'uri':util['format'](_0xae5f('0xac'),_0x21c045,_0x4c2290[_0xae5f('0x3f')]['path']),'json':_0x56c273,'resolveWithFullResponse':!![],'encoding':_0x39c80d,'body':_0x4c2290[_0xae5f('0x99')]};if(_0x4c2290['headers']){_0x3f86d8[_0xae5f('0xad')]=_0x4c2290[_0xae5f('0xad')];if(_0x3f86d8[_0xae5f('0xad')][_0xae5f('0xae')]){delete _0x3f86d8[_0xae5f('0xad')][_0xae5f('0xae')];}}if(_0x3f86d8[_0xae5f('0xad')][_0xae5f('0xb1')]){delete _0x3f86d8[_0xae5f('0xad')]['content-type'];}return rp(_0x3f86d8);})[_0xae5f('0x2f')](function(_0x6b19da){if(_0x6b19da){_0xd17a9[_0xae5f('0x2a')](_0x6b19da['headers']);logger['info'](_0x6b19da[_0xae5f('0x99')]);return _0xd17a9['status'](_0x6b19da[_0xae5f('0xaf')])['send'](_0x6b19da[_0xae5f('0x99')]);}else{return _0xd17a9[_0xae5f('0x23')](0xc8);}})['catch'](handleError(_0xd17a9,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 6233ece..7dec845 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 _0x1b9b=['exports','events','Plugin','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x9ae292,_0x130cef){var _0xadefdd=function(_0x4506a0){while(--_0x4506a0){_0x9ae292['push'](_0x9ae292['shift']());}};_0xadefdd(++_0x130cef);}(_0x1b9b,0x89));var _0xb1b9=function(_0x93a500,_0x1878a6){_0x93a500=_0x93a500-0x0;var _0x3abec1=_0x1b9b[_0x93a500];return _0x3abec1;};'use strict';var EventEmitter=require(_0xb1b9('0x0'));var Plugin=require('../../mysqldb')['db'][_0xb1b9('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xb1b9('0x2')](0x0);var events={'afterCreate':_0xb1b9('0x3'),'afterUpdate':_0xb1b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38f77a){return function(_0x411464,_0x597f8f,_0x5c24be){PluginEvents['emit'](_0x38f77a+':'+_0x411464['id'],_0x411464);PluginEvents[_0xb1b9('0x5')](_0x38f77a,_0x411464);_0x5c24be(null);};}for(var e in events){if(events[_0xb1b9('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xb1b9('0x7')]=PluginEvents; \ No newline at end of file +var _0xb89c=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','update','remove'];(function(_0x16bfc5,_0x4f9dc3){var _0x43b820=function(_0x363ced){while(--_0x363ced){_0x16bfc5['push'](_0x16bfc5['shift']());}};_0x43b820(++_0x4f9dc3);}(_0xb89c,0x198));var _0xcb89=function(_0x1e0464,_0x5d01cc){_0x1e0464=_0x1e0464-0x0;var _0x16a278=_0xb89c[_0x1e0464];return _0x16a278;};'use strict';var EventEmitter=require(_0xcb89('0x0'));var Plugin=require(_0xcb89('0x1'))['db'][_0xcb89('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xcb89('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb89('0x4'),'afterDestroy':_0xcb89('0x5')};function emitEvent(_0x57c08c){return function(_0x387b27,_0x777f33,_0x49bdbe){PluginEvents['emit'](_0x57c08c+':'+_0x387b27['id'],_0x387b27);PluginEvents['emit'](_0x57c08c,_0x387b27);_0x49bdbe(null);};}for(var e in events){if(events[_0xcb89('0x6')](e)){var event=events[e];Plugin[_0xcb89('0x7')](e,emitEvent(event));}}module[_0xcb89('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index c02a203..8f3186f 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 _0x3297=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash'];(function(_0x2d4857,_0x320bb4){var _0x10db5c=function(_0x4ad53b){while(--_0x4ad53b){_0x2d4857['push'](_0x2d4857['shift']());}};_0x10db5c(++_0x320bb4);}(_0x3297,0x19f));var _0x7329=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x3297[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x7329('0x0'));var util=require(_0x7329('0x1'));var logger=require(_0x7329('0x2'))('api');var moment=require(_0x7329('0x3'));var BPromise=require(_0x7329('0x4'));var rp=require(_0x7329('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7329('0x6'));var config=require(_0x7329('0x7'));var attributes=require(_0x7329('0x8'));module[_0x7329('0x9')]=function(_0x2167b3,_0x2f593b){return _0x2167b3[_0x7329('0xa')](_0x7329('0xb'),attributes,{'tableName':_0x7329('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb607=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x43f53d,_0x361cd2){var _0xe7eb42=function(_0x484ddd){while(--_0x484ddd){_0x43f53d['push'](_0x43f53d['shift']());}};_0xe7eb42(++_0x361cd2);}(_0xb607,0x1bc));var _0x7b60=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb607[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7b60('0x0'));var util=require(_0x7b60('0x1'));var logger=require(_0x7b60('0x2'))(_0x7b60('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b60('0x4'));var rimraf=require(_0x7b60('0x5'));var config=require(_0x7b60('0x6'));var attributes=require(_0x7b60('0x7'));module[_0x7b60('0x8')]=function(_0x45e0c4,_0x34328d){return _0x45e0c4[_0x7b60('0x9')](_0x7b60('0xa'),attributes,{'tableName':_0x7b60('0xb'),'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 5f46721..7a11de2 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 _0x1cf6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreatePlugin','Plugin','create','options','stringify'];(function(_0x1c136b,_0x16dfac){var _0x4c190a=function(_0x3fd220){while(--_0x3fd220){_0x1c136b['push'](_0x1c136b['shift']());}};_0x4c190a(++_0x16dfac);}(_0x1cf6,0x1a4));var _0x61cf=function(_0x365c80,_0xee0c87){_0x365c80=_0x365c80-0x0;var _0x200358=_0x1cf6[_0x365c80];return _0x200358;};'use strict';var _=require('lodash');var util=require(_0x61cf('0x0'));var moment=require(_0x61cf('0x1'));var BPromise=require(_0x61cf('0x2'));var rs=require(_0x61cf('0x3'));var fs=require('fs');var Redis=require(_0x61cf('0x4'));var db=require(_0x61cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x61cf('0x6'))(_0x61cf('0x7'));var config=require(_0x61cf('0x8'));var jayson=require(_0x61cf('0x9'));var client=jayson[_0x61cf('0xa')][_0x61cf('0xb')]({'port':0x232a});config[_0x61cf('0xc')]=_[_0x61cf('0xd')](config[_0x61cf('0xc')],{'host':_0x61cf('0xe'),'port':0x18eb});var socket=require(_0x61cf('0xf'))(new Redis(config[_0x61cf('0xc')]));require(_0x61cf('0x10'))[_0x61cf('0x11')](socket);function respondWithRpcPromise(_0x1aab6b,_0x43681d,_0x4b6ea4){return new BPromise(function(_0x24b82f,_0x4f6914){return client[_0x61cf('0x12')](_0x1aab6b,_0x4b6ea4)[_0x61cf('0x13')](function(_0x4b849d){logger[_0x61cf('0x14')](_0x61cf('0x15'),_0x43681d,_0x61cf('0x16'));logger[_0x61cf('0x17')](_0x61cf('0x18'),_0x43681d,'request\x20sent',JSON['stringify'](_0x4b849d));if(_0x4b849d[_0x61cf('0x19')]){if(_0x4b849d[_0x61cf('0x19')][_0x61cf('0x1a')]===0x1f4){logger[_0x61cf('0x19')](_0x61cf('0x15'),_0x43681d,_0x4b849d[_0x61cf('0x19')][_0x61cf('0x1b')]);return _0x4f6914(_0x4b849d['error'][_0x61cf('0x1b')]);}logger[_0x61cf('0x19')](_0x61cf('0x15'),_0x43681d,_0x4b849d[_0x61cf('0x19')][_0x61cf('0x1b')]);return _0x24b82f(_0x4b849d['error'][_0x61cf('0x1b')]);}else{logger[_0x61cf('0x14')](_0x61cf('0x15'),_0x43681d,_0x61cf('0x16'));_0x24b82f(_0x4b849d[_0x61cf('0x1c')][_0x61cf('0x1b')]);}})[_0x61cf('0x1d')](function(_0x5e203c){logger['error'](_0x61cf('0x15'),_0x43681d,_0x5e203c);_0x4f6914(_0x5e203c);});});}exports[_0x61cf('0x1e')]=function(_0x52cabf){var _0x15f8c1=this;return new Promise(function(_0x5bb38d,_0x508617){return db[_0x61cf('0x1f')][_0x61cf('0x20')](_0x52cabf['body'],{'raw':_0x52cabf['options']?_0x52cabf[_0x61cf('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x61cf('0x13')](function(_0x58b6f5){logger['info'](_0x61cf('0x1e'),_0x52cabf);logger[_0x61cf('0x17')](_0x61cf('0x1e'),_0x52cabf,JSON[_0x61cf('0x22')](_0x58b6f5));_0x5bb38d(_0x58b6f5);})[_0x61cf('0x1d')](function(_0x147892){logger['error']('CreatePlugin',_0x147892[_0x61cf('0x1b')],_0x52cabf);_0x508617(_0x15f8c1[_0x61cf('0x19')](0x1f4,_0x147892[_0x61cf('0x1b')]));});});}; \ No newline at end of file +var _0xb87d=['CreatePlugin','Plugin','create','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','info','request\x20sent','catch'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xb87d,0x8d));var _0xdb87=function(_0x383379,_0x27448a){_0x383379=_0x383379-0x0;var _0xb78982=_0xb87d[_0x383379];return _0xb78982;};'use strict';var _=require(_0xdb87('0x0'));var util=require(_0xdb87('0x1'));var moment=require(_0xdb87('0x2'));var BPromise=require(_0xdb87('0x3'));var rs=require(_0xdb87('0x4'));var fs=require('fs');var Redis=require(_0xdb87('0x5'));var db=require(_0xdb87('0x6'))['db'];var utils=require(_0xdb87('0x7'));var logger=require(_0xdb87('0x8'))(_0xdb87('0x9'));var config=require('../../config/environment');var jayson=require(_0xdb87('0xa'));var client=jayson[_0xdb87('0xb')][_0xdb87('0xc')]({'port':0x232a});config[_0xdb87('0xd')]=_[_0xdb87('0xe')](config[_0xdb87('0xd')],{'host':_0xdb87('0xf'),'port':0x18eb});var socket=require(_0xdb87('0x10'))(new Redis(config[_0xdb87('0xd')]));require(_0xdb87('0x11'))[_0xdb87('0x12')](socket);function respondWithRpcPromise(_0x5808f9,_0x25ccf5,_0x37fc46){return new BPromise(function(_0x12bad0,_0x4401bc){return client[_0xdb87('0x13')](_0x5808f9,_0x37fc46)[_0xdb87('0x14')](function(_0x143fca){logger['info']('Plugin,\x20%s,\x20%s',_0x25ccf5,'request\x20sent');logger['debug'](_0xdb87('0x15'),_0x25ccf5,'request\x20sent',JSON[_0xdb87('0x16')](_0x143fca));if(_0x143fca[_0xdb87('0x17')]){if(_0x143fca[_0xdb87('0x17')]['code']===0x1f4){logger['error'](_0xdb87('0x18'),_0x25ccf5,_0x143fca[_0xdb87('0x17')][_0xdb87('0x19')]);return _0x4401bc(_0x143fca['error'][_0xdb87('0x19')]);}logger[_0xdb87('0x17')]('Plugin,\x20%s,\x20%s',_0x25ccf5,_0x143fca[_0xdb87('0x17')][_0xdb87('0x19')]);return _0x12bad0(_0x143fca[_0xdb87('0x17')][_0xdb87('0x19')]);}else{logger[_0xdb87('0x1a')]('Plugin,\x20%s,\x20%s',_0x25ccf5,_0xdb87('0x1b'));_0x12bad0(_0x143fca['result']['message']);}})[_0xdb87('0x1c')](function(_0x33652c){logger['error']('Plugin,\x20%s,\x20%s',_0x25ccf5,_0x33652c);_0x4401bc(_0x33652c);});});}exports[_0xdb87('0x1d')]=function(_0xd28977){var _0xa58fa4=this;return new Promise(function(_0x15823a,_0x20a07b){return db[_0xdb87('0x1e')][_0xdb87('0x1f')](_0xd28977['body'],{'raw':_0xd28977[_0xdb87('0x20')]?_0xd28977[_0xdb87('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xdb87('0x14')](function(_0x1e6ca0){logger[_0xdb87('0x1a')](_0xdb87('0x1d'),_0xd28977);logger[_0xdb87('0x21')]('CreatePlugin',_0xd28977,JSON[_0xdb87('0x16')](_0x1e6ca0));_0x15823a(_0x1e6ca0);})['catch'](function(_0x3e0a3c){logger[_0xdb87('0x17')](_0xdb87('0x1d'),_0x3e0a3c[_0xdb87('0x19')],_0xd28977);_0x20a07b(_0xa58fa4[_0xdb87('0x17')](0x1f4,_0x3e0a3c[_0xdb87('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index a9c7a06..c8f6938 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 _0x2c4c=['./plugin.events','remove','emit','plugin:'];(function(_0x99f50a,_0x4fd49f){var _0xd82349=function(_0x2ba122){while(--_0x2ba122){_0x99f50a['push'](_0x99f50a['shift']());}};_0xd82349(++_0x4fd49f);}(_0x2c4c,0x134));var _0xc2c4=function(_0xb51463,_0x1c7959){_0xb51463=_0xb51463-0x0;var _0x15f379=_0x2c4c[_0xb51463];return _0x15f379;};'use strict';var PluginEvents=require(_0xc2c4('0x0'));var events=['save',_0xc2c4('0x1'),'update'];function createListener(_0x468bcb,_0x4c1706){return function(_0x497d36){_0x4c1706[_0xc2c4('0x2')](_0x468bcb,_0x497d36);};}function removeListener(_0x3fb6f0,_0x3d0460){return function(){PluginEvents['removeListener'](_0x3fb6f0,_0x3d0460);};}exports['register']=function(_0x4e663c){for(var _0x1e90a7=0x0,_0x48d5c4=events['length'];_0x1e90a7<_0x48d5c4;_0x1e90a7++){var _0x3291aa=events[_0x1e90a7];var _0x7c54ec=createListener(_0xc2c4('0x3')+_0x3291aa,_0x4e663c);PluginEvents['on'](_0x3291aa,_0x7c54ec);}}; \ No newline at end of file +var _0x1010=['save','remove','update','emit','removeListener','length','./plugin.events'];(function(_0x42c75f,_0x1571b5){var _0x22ce48=function(_0x317534){while(--_0x317534){_0x42c75f['push'](_0x42c75f['shift']());}};_0x22ce48(++_0x1571b5);}(_0x1010,0x172));var _0x0101=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x1010[_0xdd0313];return _0x2bd7e8;};'use strict';var PluginEvents=require(_0x0101('0x0'));var events=[_0x0101('0x1'),_0x0101('0x2'),_0x0101('0x3')];function createListener(_0x40be4d,_0x5ea56f){return function(_0x412b94){_0x5ea56f[_0x0101('0x4')](_0x40be4d,_0x412b94);};}function removeListener(_0x7415b9,_0x34d3b7){return function(){PluginEvents[_0x0101('0x5')](_0x7415b9,_0x34d3b7);};}exports['register']=function(_0x65d064){for(var _0x3ff68e=0x0,_0x3d1cc2=events[_0x0101('0x6')];_0x3ff68e<_0x3d1cc2;_0x3ff68e++){var _0x444f1c=events[_0x3ff68e];var _0x8a27bf=createListener('plugin:'+_0x444f1c,_0x65d064);PluginEvents['on'](_0x444f1c,_0x8a27bf);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 00955b4..c604299 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(_0x11f6ce,_0x381e81){var _0x354883=function(_0x50a056){while(--_0x50a056){_0x11f6ce['push'](_0x11f6ce['shift']());}};_0x354883(++_0x381e81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x875b3b,_0x172523){var _0x233370=function(_0x58177e){while(--_0x58177e){_0x875b3b['push'](_0x875b3b['shift']());}};_0x233370(++_0x172523);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 c75239e..228070c 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 _0xb7c8=['start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','reject','express','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname'];(function(_0x542c56,_0x53b4c7){var _0x36c023=function(_0x49e53a){while(--_0x49e53a){_0x542c56['push'](_0x542c56['shift']());}};_0x36c023(++_0x53b4c7);}(_0xb7c8,0x119));var _0x8b7c=function(_0x910329,_0x5e184b){_0x910329=_0x910329-0x0;var _0x377fcd=_0xb7c8[_0x910329];return _0x377fcd;};'use strict';var _=require('lodash');var pm2=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var path=require(_0x8b7c('0x3'));var exec=require(_0x8b7c('0x4'))[_0x8b7c('0x5')];var BPromise=require(_0x8b7c('0x6'));function handleEntityNotFound(_0x50113e,_0x38672b){return function(_0x412f93){if(!_0x412f93){_0x50113e[_0x8b7c('0x7')](0x194);;}return _0x412f93;};}function respondWithResult(_0x440900,_0x107428){_0x107428=_0x107428||0xc8;return function(_0x12665c){if(_0x12665c){return _0x440900[_0x8b7c('0x8')](_0x107428)[_0x8b7c('0x9')](_0x12665c);}return null;};}function handleError(_0x6afb55,_0x30a924){_0x30a924=_0x30a924||0x1f4;return function(_0x187046){logger[_0x8b7c('0xa')](_0x187046['stack']);if(_0x187046[_0x8b7c('0xb')]){delete _0x187046['name'];}_0x6afb55[_0x8b7c('0x8')](_0x30a924)[_0x8b7c('0xc')](_0x187046);};}function execChildProcess(){return new BPromise(function(_0x5868ec,_0x189a25){exec(_0x8b7c('0xd'),function(_0x3594b1,_0x586826,_0x4adbe2){logger[_0x8b7c('0xe')](_0x586826);logger[_0x8b7c('0xe')](_0x4adbe2);if(_0x3594b1){logger[_0x8b7c('0xa')](_0x3594b1);return _0x189a25(_0x3594b1);}return _0x5868ec(_0x586826);});});}exports[_0x8b7c('0xf')]=function(_0x3e3e58,_0x247e3a){return pm2[_0x8b7c('0x10')]()['then'](function(_0x2b60a7){if(_0x2b60a7){var _0x19c63e=_[_0x8b7c('0x11')](_0x2b60a7,function(_0x52cfe7){return _0x52cfe7[_0x8b7c('0xb')]===_0x8b7c('0x12')||_0x52cfe7['name']===_0x8b7c('0x13');});return{'rows':_0x19c63e,'count':_0x19c63e[_0x8b7c('0x14')]};}return null;})[_0x8b7c('0x15')](respondWithResult(_0x247e3a,null))[_0x8b7c('0x16')](handleError(_0x247e3a,null));};exports[_0x8b7c('0x17')]=function(_0x4cc809,_0x402448){return pm2[_0x8b7c('0x18')](_0x4cc809[_0x8b7c('0x19')]['id'])[_0x8b7c('0x15')](respondWithResult(_0x402448,null))[_0x8b7c('0x15')](handleEntityNotFound(_0x402448,null))['catch'](handleError(_0x402448,null));};exports[_0x8b7c('0x1a')]=function(_0x2b0874,_0x450ab7){if(_0x2b0874[_0x8b7c('0x1b')][_0x8b7c('0xb')]&&_0x2b0874[_0x8b7c('0x1b')][_0x8b7c('0x1c')]){var _0xd0c3e6=path[_0x8b7c('0x1d')](__dirname,_0x8b7c('0x1e'),_0x2b0874[_0x8b7c('0x1b')][_0x8b7c('0x1c')]);var _0x53451d=process[_0x8b7c('0x1f')]();process[_0x8b7c('0x20')](path[_0x8b7c('0x21')](_0xd0c3e6));return execChildProcess()[_0x8b7c('0x15')](function(_0x9365e3){process[_0x8b7c('0x20')](_0x53451d);return pm2[_0x8b7c('0x22')]({'name':_0x2b0874[_0x8b7c('0x1b')][_0x8b7c('0xb')],'script':_0xd0c3e6});})[_0x8b7c('0x15')](function(_0x5e131c){pm2['dump']();return _0x5e131c[0x0];})[_0x8b7c('0x15')](respondWithResult(_0x450ab7,0xc9))['catch'](handleError(_0x450ab7,null));}else{return _0x450ab7[_0x8b7c('0x8')](0x1f4)[_0x8b7c('0xc')]({'message':_0x8b7c('0x23')});}};exports[_0x8b7c('0x24')]=function(_0x3e35b8,_0x3d2dfa){if(_0x3e35b8['body']['id']){delete _0x3e35b8[_0x8b7c('0x1b')]['id'];}var _0x31390d={'online':_0x8b7c('0x25'),'stopped':_0x8b7c('0x26')};if(_0x31390d[_0x8b7c('0x27')](_0x3e35b8[_0x8b7c('0x1b')][_0x8b7c('0x8')])){return pm2[_0x31390d[_0x3e35b8[_0x8b7c('0x1b')][_0x8b7c('0x8')]]](_0x3e35b8[_0x8b7c('0x19')]['id'])['then'](respondWithResult(_0x3d2dfa,0xc8))['catch'](handleError(_0x3d2dfa,null));}else{return _0x3d2dfa[_0x8b7c('0x8')](0x1f4)[_0x8b7c('0xc')]({'message':_0x8b7c('0x28')});}};exports[_0x8b7c('0x29')]=function(_0x3bfe78,_0x1f373f){if(_0x3bfe78[_0x8b7c('0x1b')]['id']){delete _0x3bfe78[_0x8b7c('0x1b')]['id'];}if(_0x3bfe78[_0x8b7c('0x19')]['id']){return pm2[_0x8b7c('0x2a')](_0x3bfe78['params']['id'])[_0x8b7c('0x15')](function(_0x5906bd){pm2[_0x8b7c('0x2b')]();return _0x5906bd[0x0];})[_0x8b7c('0x15')](respondWithResult(_0x1f373f,null))['catch'](handleError(_0x1f373f,null));}else{return _0x1f373f[_0x8b7c('0x8')](0x1f4)['send']({'message':_0x8b7c('0x2c')});}}; \ No newline at end of file +var _0x34e5=['info','error','list','then','reject','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','name','npm\x20install'];(function(_0x2b93bb,_0x51002a){var _0x2bedc9=function(_0x3ba914){while(--_0x3ba914){_0x2b93bb['push'](_0x2b93bb['shift']());}};_0x2bedc9(++_0x51002a);}(_0x34e5,0x172));var _0x534e=function(_0x5d492b,_0x38fad7){_0x5d492b=_0x5d492b-0x0;var _0x46650=_0x34e5[_0x5d492b];return _0x46650;};'use strict';var _=require('lodash');var pm2=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var path=require(_0x534e('0x2'));var exec=require(_0x534e('0x3'))[_0x534e('0x4')];var BPromise=require(_0x534e('0x5'));function handleEntityNotFound(_0x50b790,_0x11a158){return function(_0x3d8287){if(!_0x3d8287){_0x50b790[_0x534e('0x6')](0x194);;}return _0x3d8287;};}function respondWithResult(_0x117f0c,_0x436a92){_0x436a92=_0x436a92||0xc8;return function(_0x2d0370){if(_0x2d0370){return _0x117f0c[_0x534e('0x7')](_0x436a92)['json'](_0x2d0370);}return null;};}function handleError(_0x24d562,_0x929597){_0x929597=_0x929597||0x1f4;return function(_0xa836bb){logger['error'](_0xa836bb['stack']);if(_0xa836bb[_0x534e('0x8')]){delete _0xa836bb['name'];}_0x24d562[_0x534e('0x7')](_0x929597)['send'](_0xa836bb);};}function execChildProcess(){return new BPromise(function(_0xb30dd6,_0x310b6d){exec(_0x534e('0x9'),function(_0x529726,_0x1b7a5a,_0x229352){logger[_0x534e('0xa')](_0x1b7a5a);logger[_0x534e('0xa')](_0x229352);if(_0x529726){logger[_0x534e('0xb')](_0x529726);return _0x310b6d(_0x529726);}return _0xb30dd6(_0x1b7a5a);});});}exports['index']=function(_0x31d764,_0x23c11c){return pm2[_0x534e('0xc')]()[_0x534e('0xd')](function(_0x359565){if(_0x359565){var _0x478027=_[_0x534e('0xe')](_0x359565,function(_0x17c068){return _0x17c068[_0x534e('0x8')]==='express'||_0x17c068[_0x534e('0x8')]===_0x534e('0xf');});return{'rows':_0x478027,'count':_0x478027['length']};}return null;})['then'](respondWithResult(_0x23c11c,null))[_0x534e('0x10')](handleError(_0x23c11c,null));};exports[_0x534e('0x11')]=function(_0x9297b6,_0x16ad40){return pm2[_0x534e('0x12')](_0x9297b6[_0x534e('0x13')]['id'])[_0x534e('0xd')](respondWithResult(_0x16ad40,null))['then'](handleEntityNotFound(_0x16ad40,null))[_0x534e('0x10')](handleError(_0x16ad40,null));};exports[_0x534e('0x14')]=function(_0x466d74,_0x1bef0a){if(_0x466d74[_0x534e('0x15')]['name']&&_0x466d74[_0x534e('0x15')][_0x534e('0x16')]){var _0x5f9ae9=path[_0x534e('0x17')](__dirname,_0x534e('0x18'),_0x466d74[_0x534e('0x15')][_0x534e('0x16')]);var _0x85188b=process[_0x534e('0x19')]();process['chdir'](path[_0x534e('0x1a')](_0x5f9ae9));return execChildProcess()[_0x534e('0xd')](function(_0x39466c){process[_0x534e('0x1b')](_0x85188b);return pm2[_0x534e('0x1c')]({'name':_0x466d74[_0x534e('0x15')][_0x534e('0x8')],'script':_0x5f9ae9});})[_0x534e('0xd')](function(_0x53a6ef){pm2[_0x534e('0x1d')]();return _0x53a6ef[0x0];})['then'](respondWithResult(_0x1bef0a,0xc9))[_0x534e('0x10')](handleError(_0x1bef0a,null));}else{return _0x1bef0a[_0x534e('0x7')](0x1f4)[_0x534e('0x1e')]({'message':_0x534e('0x1f')});}};exports[_0x534e('0x20')]=function(_0x57b216,_0x743974){if(_0x57b216[_0x534e('0x15')]['id']){delete _0x57b216['body']['id'];}var _0x4bd073={'online':_0x534e('0x21'),'stopped':'stop'};if(_0x4bd073[_0x534e('0x22')](_0x57b216[_0x534e('0x15')][_0x534e('0x7')])){return pm2[_0x4bd073[_0x57b216[_0x534e('0x15')][_0x534e('0x7')]]](_0x57b216[_0x534e('0x13')]['id'])[_0x534e('0xd')](respondWithResult(_0x743974,0xc8))['catch'](handleError(_0x743974,null));}else{return _0x743974['status'](0x1f4)[_0x534e('0x1e')]({'message':_0x534e('0x23')});}};exports[_0x534e('0x24')]=function(_0x2f1c49,_0x423502){if(_0x2f1c49[_0x534e('0x15')]['id']){delete _0x2f1c49[_0x534e('0x15')]['id'];}if(_0x2f1c49[_0x534e('0x13')]['id']){return pm2[_0x534e('0x25')](_0x2f1c49[_0x534e('0x13')]['id'])[_0x534e('0xd')](function(_0x1d6fb1){pm2['dump']();return _0x1d6fb1[0x0];})[_0x534e('0xd')](respondWithResult(_0x423502,null))[_0x534e('0x10')](handleError(_0x423502,null));}else{return _0x423502['status'](0x1f4)[_0x534e('0x1e')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 722278d..6167db1 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 _0xd161=['getQueues','exports','express','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x5c71b6,_0x48ef51){var _0x2626a3=function(_0x40dbc0){while(--_0x40dbc0){_0x5c71b6['push'](_0x5c71b6['shift']());}};_0x2626a3(++_0x48ef51);}(_0xd161,0x102));var _0x1d16=function(_0x2c9dcc,_0x2bf089){_0x2c9dcc=_0x2c9dcc-0x0;var _0x23e250=_0xd161[_0x2c9dcc];return _0x23e250;};'use strict';var express=require(_0x1d16('0x0'));var router=express['Router']();var auth=require(_0x1d16('0x1'));var controller=require(_0x1d16('0x2'));router[_0x1d16('0x3')](_0x1d16('0x4'),auth[_0x1d16('0x5')](),controller['getAgents']);router[_0x1d16('0x3')]('/queues',auth[_0x1d16('0x5')](),controller[_0x1d16('0x6')]);module[_0x1d16('0x7')]=router; \ No newline at end of file +var _0x724e=['isAuthenticated','getAgents','/queues','getQueues','exports','express','../../components/auth/service','./realtime.controller','/agents'];(function(_0x325216,_0x5d9ca7){var _0x470f64=function(_0x3589f1){while(--_0x3589f1){_0x325216['push'](_0x325216['shift']());}};_0x470f64(++_0x5d9ca7);}(_0x724e,0xc2));var _0xe724=function(_0xa09260,_0x4d9ca9){_0xa09260=_0xa09260-0x0;var _0x10f4c3=_0x724e[_0xa09260];return _0x10f4c3;};'use strict';var express=require(_0xe724('0x0'));var router=express['Router']();var auth=require(_0xe724('0x1'));var controller=require(_0xe724('0x2'));router['get'](_0xe724('0x3'),auth[_0xe724('0x4')](),controller[_0xe724('0x5')]);router['get'](_0xe724('0x6'),auth[_0xe724('0x4')](),controller[_0xe724('0x7')]);module[_0xe724('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index f3a8d73..c5d1f41 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 _0x98a1=['APIBadRequestError','handleError','offset','undefined','count','status','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','*pause','then','isValidChannel','channel','sort','includes','globalStatus','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','type','role','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','Agents','agent','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','Status','split','catch','getQueues','resolve','format','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','key','name','voice','outbound','dialActive','QueueCampaigns','Queues','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api'];(function(_0x4d78bf,_0x178316){var _0x2d40dd=function(_0x29601e){while(--_0x29601e){_0x4d78bf['push'](_0x4d78bf['shift']());}};_0x2d40dd(++_0x178316);}(_0x98a1,0x198));var _0x198a=function(_0x5105e9,_0x423661){_0x5105e9=_0x5105e9-0x0;var _0x4d7b74=_0x98a1[_0x5105e9];return _0x4d7b74;};'use strict';var _=require(_0x198a('0x0'));var util=require(_0x198a('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x198a('0x2'));var qs=require(_0x198a('0x3'));var utils=require(_0x198a('0x4'));var db=require(_0x198a('0x5'))['db'];var APIBadRequestError=require(_0x198a('0x6'))[_0x198a('0x7')];var APIHandleError=require('../../errors/api')[_0x198a('0x8')];function respondWithFilteredResult(_0x548b5b,_0x51f9b7){return function(_0x149f3d){if(_0x149f3d){var _0x17a619=typeof _0x51f9b7[_0x198a('0x9')]===_0x198a('0xa')&&typeof _0x51f9b7['limit']===_0x198a('0xa');var _0x2de173=_0x149f3d[_0x198a('0xb')];var _0x5c6109=_0x17a619?0x0:_0x51f9b7['offset'];var _0x59b197=_0x17a619?_0x149f3d[_0x198a('0xb')]:_0x51f9b7[_0x198a('0x9')]+_0x51f9b7['limit'];var _0xc60530;if(_0x59b197>=_0x2de173){_0x59b197=_0x2de173;_0xc60530=0xc8;}else{_0xc60530=0xce;}_0x548b5b[_0x198a('0xc')](_0xc60530);return _0x548b5b['set'](_0x198a('0xd'),_0x5c6109+'-'+_0x59b197+'/'+_0x2de173)[_0x198a('0xe')](_0x149f3d);}return null;};}exports[_0x198a('0xf')]=function(_0x37b430,_0x2c3095){var _0x187a70={'count':0x0,'rows':[]};var _0x246cff={};var _0x5beb35;var _0x32e06c=utils[_0x198a('0x10')]();var _0x45de0b;var _0xcdaf72;var _0x5f1fb9=_0x37b430['query'][_0x198a('0x11')];var _0x12eb0d=_0x37b430[_0x198a('0x12')][_0x198a('0x13')];var _0x3029a2=_0x37b430[_0x198a('0x12')][_0x198a('0x14')];var _0x2df320=_0x12eb0d===_0x198a('0x15')||_0x12eb0d===_0x198a('0x16')?!![]:![];var _0x247462=[];var _0x3156f3;var _0x12e494;Promise['resolve']()[_0x198a('0x17')](function(){if(_0x37b430['query']['channel']){if(!utils[_0x198a('0x18')](_0x37b430['query'][_0x198a('0x19')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x37b430[_0x198a('0x12')][_0x198a('0x19')]));}_0x5beb35=_0x37b430[_0x198a('0x12')][_0x198a('0x19')]['toLowerCase']();}if(!_0x37b430['query'][_0x198a('0x1a')]||!_0x37b430['query']['sort'][_0x198a('0x1b')](_0x198a('0x1c'))){_0x37b430[_0x198a('0x12')][_0x198a('0x1a')]=rta['validateSortParameter'](_0x37b430[_0x198a('0x12')][_0x198a('0x1a')]);return;}var _0x27402f=rta[_0x198a('0x1d')](_0x37b430[_0x198a('0x12')][_0x198a('0x1a')]);_0x37b430[_0x198a('0x12')]['sort']=_0x27402f[_0x198a('0x1e')][_0x198a('0x1f')](',');_0x3156f3=_0x27402f[_0x198a('0x20')];})[_0x198a('0x17')](function(){if(!_0x5f1fb9){return[];}return rta['getAgentIdsByQueues'](_0x5f1fb9,_0x5beb35);})[_0x198a('0x17')](function(_0xac51f){_0x247462=_0xac51f;return rta[_0x198a('0x21')]();})['then'](function(_0x5b44ba){_0xcdaf72=_0x5b44ba['rows'];if((!_0x12eb0d||_0x2df320)&&!_0x3156f3){return _0x247462;}if(_0x3156f3&&!_0x12eb0d){return rta[_0x198a('0x22')](_0xcdaf72,_0x247462,_0x3156f3);}else{return rta[_0x198a('0x23')](_0xcdaf72,_0x247462,_0x12eb0d);}})[_0x198a('0x17')](function(_0x177713){_0x247462=_0x177713;var _0x2bf4ba=![];if(_0x247462[_0x198a('0x24')]===0x0){if(_0x5f1fb9||_0x12eb0d){_0x2bf4ba=!![];}if(_0x2df320){_0x2bf4ba=![];}}if(_0x2bf4ba){return _0x187a70;}var _0x419a84=_[_0x198a('0x25')](db[_0x198a('0x26')][_0x198a('0x27')],function(_0x1cb441){return{'name':_0x1cb441['fieldName'],'type':_0x1cb441[_0x198a('0x28')]['key']};});_0x37b430[_0x198a('0x12')][_0x198a('0x29')]='agent';_0x37b430[_0x198a('0x12')]['online']=!![];_0x246cff=qs[_0x198a('0x2a')](_0x419a84,_0x37b430);_0x246cff[_0x198a('0x2b')]=!![];var _0x387399=[];if(_0x247462[_0x198a('0x24')]>0x0){_0x387399[_0x198a('0x2c')]({'id':{'$in':_0x247462}});if(_0x3156f3&&!_0x12eb0d){_0x12e494=[db[_0x198a('0x2d')][_0x198a('0x2e')](_0x198a('0x2f')+_0x247462+')')];_0x246cff[_0x198a('0x20')]=_0x12e494;}}if(_0x2df320){_0x32e06c[_0x198a('0x30')](function(_0x12d2b7){var _0x5f02c6=!![];if(_0x12eb0d===_0x198a('0x16')&&_0x5beb35!==_0x12d2b7){_0x5f02c6=![];}_0x387399[_0x198a('0x2c')]({[_0x12d2b7+'Pause']:_0x5f02c6});});if(_0x3029a2){_0x387399[_0x198a('0x2c')]({'pauseType':_0x3029a2});}}else if(_0x12eb0d){_0x32e06c[_0x198a('0x30')](function(_0x1b81ef){_0x387399[_0x198a('0x2c')]({[_0x1b81ef+_0x198a('0x31')]:![]});});}_0x246cff[_0x198a('0x32')]=_[_0x198a('0x33')](_0x246cff[_0x198a('0x32')],{'$and':_0x387399});if(_0x37b430[_0x198a('0x34')][_0x198a('0x29')]===_0x198a('0x34')){var _0x24bf3b={'params':{'id':_0x37b430[_0x198a('0x34')][_0x198a('0x35')]},'query':{'section':_0x198a('0x36'),'role':_0x198a('0x37'),'online':!![],'raw':!![],'ids':_0x247462,'customSorting':_0x12e494}};if(_0x2df320){_0x24bf3b[_0x198a('0x12')][_0x198a('0x38')]=_0x387399;}_0x24bf3b[_0x198a('0x12')]=Object[_0x198a('0x39')](_0x24bf3b[_0x198a('0x12')],_0x37b430['query']);delete _0x24bf3b[_0x198a('0x12')]['id'];return db[_0x198a('0x3a')][_0x198a('0x3b')](_0x24bf3b);}return db['User'][_0x198a('0x3c')](_0x246cff);})[_0x198a('0x17')](function(_0x5b2300){_0x187a70['count']=_0x5b2300[_0x198a('0xb')];_0x45de0b=_0x5b2300[_0x198a('0x3d')];return _0x45de0b[_0x198a('0x25')](function(_0x32b32f){var _0x5aac38=_[_0x198a('0x3e')](_0xcdaf72,['id',_0x32b32f['id']]);if(_0x5aac38){var _0x408693=rta[_0x198a('0x3f')](_0x5aac38);_[_0x198a('0x33')](_0x32b32f,_0x408693);}_0x32b32f[_0x198a('0x1c')]=rta[_0x198a('0x40')](_0x32b32f);if(_0x32b32f[_0x198a('0x1c')][_0x198a('0x1b')]('pause')){_0x32e06c['forEach'](function(_0x443f85){if(_0x32b32f[_0x443f85+_0x198a('0x31')]){_0x32b32f[_0x443f85+_0x198a('0x41')]=_0x198a('0x15');}});}return _0x32b32f;});})[_0x198a('0x17')](function(_0x185355){if(!_0x3156f3||_0x12e494){return _0x185355;}return rta['sortAgentsByStatus'](_0x185355,_0x3156f3);})['then'](function(_0x4a0cbb){var _0x7fd15f=null;if(_0x37b430[_0x198a('0x12')][_0x198a('0x1e')]){var _0x152587=_0x37b430[_0x198a('0x12')][_0x198a('0x1e')][_0x198a('0x42')](',');_0x7fd15f=_0x4a0cbb[_0x198a('0x25')](function(_0xa6f7fc){return _['pick'](_0xa6f7fc,_0x152587);});}_0x187a70[_0x198a('0x3d')]=_0x7fd15f||_0x4a0cbb;return _0x187a70;})[_0x198a('0x17')](respondWithFilteredResult(_0x2c3095,_0x246cff))[_0x198a('0x43')](APIHandleError(_0x2c3095));};exports[_0x198a('0x44')]=function(_0x3b2786,_0x24e13d){var _0x328607={'count':0x0,'rows':[]};var _0x1385a2={};var _0xcc6009;var _0x47d1f7;var _0x4eaf96;Promise[_0x198a('0x45')]()[_0x198a('0x17')](function(){if(_0x3b2786['query'][_0x198a('0x19')]){if(!utils[_0x198a('0x18')](_0x3b2786[_0x198a('0x12')][_0x198a('0x19')])){throw new APIBadRequestError(util[_0x198a('0x46')](_0x198a('0x47'),_0x3b2786[_0x198a('0x12')][_0x198a('0x19')]));}_0xcc6009=_0x3b2786[_0x198a('0x12')][_0x198a('0x19')]['toLowerCase']();}var _0x586333=_[_0x198a('0x48')](_0xcc6009)+_0x198a('0x49');var _0x27d1c3=_[_0x198a('0x25')](db[_0x586333][_0x198a('0x27')],function(_0x4085df){return{'name':_0x4085df['fieldName'],'type':_0x4085df[_0x198a('0x28')][_0x198a('0x4a')]};});if(!_0x3b2786[_0x198a('0x12')][_0x198a('0x1e')]){var _0x3d9522=['id',_0x198a('0x4b')];if(_0xcc6009===_0x198a('0x4c')){_0x3d9522[_0x198a('0x2c')](_0x198a('0x28'));if(_0x3b2786['query'][_0x198a('0x28')]===_0x198a('0x4d')){_0x3d9522[_0x198a('0x2c')]([_0x198a('0x4e'),'dialMethod']);}}_0x3b2786[_0x198a('0x12')][_0x198a('0x1e')]=_0x3d9522[_0x198a('0x1f')](',');}_0x1385a2=qs[_0x198a('0x2a')](_0x27d1c3,_0x3b2786);if(_0x3b2786[_0x198a('0x34')][_0x198a('0x29')]===_0x198a('0x34')){var _0x12d3c7={'params':{'id':_0x3b2786['user'][_0x198a('0x35')]},'query':{'section':_0xcc6009==='voice'&&_0x3b2786['query'][_0x198a('0x28')]===_0x198a('0x4d')?_0x198a('0x4f'):_[_0x198a('0x48')](_0xcc6009)+_0x198a('0x50'),'type':_0x3b2786['query'][_0x198a('0x28')],'nolimit':!![],'sort':_0x198a('0x4b'),'filter':_0x3b2786[_0x198a('0x12')]['filter']}};return db[_0x198a('0x3a')]['getResources'](_0x12d3c7);}return db[_0x586333][_0x198a('0x3c')](_0x1385a2);})[_0x198a('0x17')](function(_0x123555){_0x328607['count']=_0x123555[_0x198a('0xb')];_0x47d1f7=_0x123555[_0x198a('0x3d')];return rtq[_0x198a('0x51')](_0x3b2786,_0xcc6009);})[_0x198a('0x17')](function(_0xe9157f){_0x4eaf96=_0xe9157f[_0x198a('0x3d')];return rtq[_0x198a('0x52')](_0x47d1f7,_0x4eaf96,_0xcc6009,_0x3b2786[_0x198a('0x12')][_0x198a('0x28')]);})[_0x198a('0x17')](function(_0x4b0f38){_0x328607[_0x198a('0x3d')]=_0x4b0f38;return _0x328607;})[_0x198a('0x17')](respondWithFilteredResult(_0x24e13d,_0x1385a2))[_0x198a('0x43')](APIHandleError(_0x24e13d));}; \ No newline at end of file +var _0x4e40=['*pause','Pause','where','merge','role','user','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','pause','forEach','sortAgentsByStatus','pick','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','rawAttributes','name','outbound','dialMethod','getOptions','userProfileId','voice','QueueCampaigns','startCase','Queues','initializeQueues','catch','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','resolve','then','channel','isValidChannel','format','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','key','agent','raw','push','literal'];(function(_0x151e3e,_0x32b18b){var _0x4f1640=function(_0x123c44){while(--_0x123c44){_0x151e3e['push'](_0x151e3e['shift']());}};_0x4f1640(++_0x32b18b);}(_0x4e40,0xba));var _0x04e4=function(_0x38fea1,_0x14ac08){_0x38fea1=_0x38fea1-0x0;var _0x57ca5e=_0x4e40[_0x38fea1];return _0x57ca5e;};'use strict';var _=require(_0x04e4('0x0'));var util=require(_0x04e4('0x1'));var rta=require(_0x04e4('0x2'));var rtq=require(_0x04e4('0x3'));var qs=require(_0x04e4('0x4'));var utils=require(_0x04e4('0x5'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x04e4('0x6'))[_0x04e4('0x7')];var APIHandleError=require(_0x04e4('0x6'))[_0x04e4('0x8')];function respondWithFilteredResult(_0x644b3a,_0x395edc){return function(_0x5d2c8b){if(_0x5d2c8b){var _0x288a14=typeof _0x395edc[_0x04e4('0x9')]===_0x04e4('0xa')&&typeof _0x395edc['limit']==='undefined';var _0x197d20=_0x5d2c8b[_0x04e4('0xb')];var _0x2198e3=_0x288a14?0x0:_0x395edc[_0x04e4('0x9')];var _0x214874=_0x288a14?_0x5d2c8b[_0x04e4('0xb')]:_0x395edc[_0x04e4('0x9')]+_0x395edc[_0x04e4('0xc')];var _0x17e2e4;if(_0x214874>=_0x197d20){_0x214874=_0x197d20;_0x17e2e4=0xc8;}else{_0x17e2e4=0xce;}_0x644b3a['status'](_0x17e2e4);return _0x644b3a['set'](_0x04e4('0xd'),_0x2198e3+'-'+_0x214874+'/'+_0x197d20)[_0x04e4('0xe')](_0x5d2c8b);}return null;};}exports[_0x04e4('0xf')]=function(_0x84a66b,_0x10264e){var _0x202c9c={'count':0x0,'rows':[]};var _0x9a7435={};var _0x408dc3;var _0x371069=utils[_0x04e4('0x10')]();var _0x11e367;var _0x2fbdca;var _0x5cb218=_0x84a66b[_0x04e4('0x11')][_0x04e4('0x12')];var _0x44af52=_0x84a66b[_0x04e4('0x11')][_0x04e4('0x13')];var _0x2f1f30=_0x84a66b['query']['pauseTypeFilter'];var _0x58caf4=_0x44af52==='pause'||_0x44af52==='*pause'?!![]:![];var _0x3be0a9=[];var _0x5db21f;var _0x29f685;Promise[_0x04e4('0x14')]()[_0x04e4('0x15')](function(){if(_0x84a66b[_0x04e4('0x11')][_0x04e4('0x16')]){if(!utils[_0x04e4('0x17')](_0x84a66b['query'][_0x04e4('0x16')])){throw new APIBadRequestError(util[_0x04e4('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x84a66b[_0x04e4('0x11')]['channel']));}_0x408dc3=_0x84a66b[_0x04e4('0x11')][_0x04e4('0x16')]['toLowerCase']();}if(!_0x84a66b[_0x04e4('0x11')][_0x04e4('0x19')]||!_0x84a66b[_0x04e4('0x11')][_0x04e4('0x19')][_0x04e4('0x1a')](_0x04e4('0x1b'))){_0x84a66b['query'][_0x04e4('0x19')]=rta[_0x04e4('0x1c')](_0x84a66b[_0x04e4('0x11')][_0x04e4('0x19')]);return;}var _0x1d7629=rta[_0x04e4('0x1d')](_0x84a66b['query']['sort']);_0x84a66b['query']['sort']=_0x1d7629[_0x04e4('0x1e')][_0x04e4('0x1f')](',');_0x5db21f=_0x1d7629[_0x04e4('0x20')];})[_0x04e4('0x15')](function(){if(!_0x5cb218){return[];}return rta[_0x04e4('0x21')](_0x5cb218,_0x408dc3);})[_0x04e4('0x15')](function(_0x3e2a06){_0x3be0a9=_0x3e2a06;return rta[_0x04e4('0x22')]();})[_0x04e4('0x15')](function(_0x18a72d){_0x2fbdca=_0x18a72d[_0x04e4('0x23')];if((!_0x44af52||_0x58caf4)&&!_0x5db21f){return _0x3be0a9;}if(_0x5db21f&&!_0x44af52){return rta[_0x04e4('0x24')](_0x2fbdca,_0x3be0a9,_0x5db21f);}else{return rta[_0x04e4('0x25')](_0x2fbdca,_0x3be0a9,_0x44af52);}})[_0x04e4('0x15')](function(_0x2ddbf8){_0x3be0a9=_0x2ddbf8;var _0x42db0a=![];if(_0x3be0a9[_0x04e4('0x26')]===0x0){if(_0x5cb218||_0x44af52){_0x42db0a=!![];}if(_0x58caf4){_0x42db0a=![];}}if(_0x42db0a){return _0x202c9c;}var _0x46b6a4=_[_0x04e4('0x27')](db[_0x04e4('0x28')]['rawAttributes'],function(_0x41871e){return{'name':_0x41871e[_0x04e4('0x29')],'type':_0x41871e[_0x04e4('0x2a')][_0x04e4('0x2b')]};});_0x84a66b[_0x04e4('0x11')]['role']=_0x04e4('0x2c');_0x84a66b['query']['online']=!![];_0x9a7435=qs['getOptions'](_0x46b6a4,_0x84a66b);_0x9a7435[_0x04e4('0x2d')]=!![];var _0x2707f5=[];if(_0x3be0a9[_0x04e4('0x26')]>0x0){_0x2707f5[_0x04e4('0x2e')]({'id':{'$in':_0x3be0a9}});if(_0x5db21f&&!_0x44af52){_0x29f685=[db['sequelize'][_0x04e4('0x2f')]('FIELD(id,'+_0x3be0a9+')')];_0x9a7435['order']=_0x29f685;}}if(_0x58caf4){_0x371069['forEach'](function(_0x6832b3){var _0x6eb7d6=!![];if(_0x44af52===_0x04e4('0x30')&&_0x408dc3!==_0x6832b3){_0x6eb7d6=![];}_0x2707f5[_0x04e4('0x2e')]({[_0x6832b3+_0x04e4('0x31')]:_0x6eb7d6});});if(_0x2f1f30){_0x2707f5['push']({'pauseType':_0x2f1f30});}}else if(_0x44af52){_0x371069['forEach'](function(_0x419a6f){_0x2707f5[_0x04e4('0x2e')]({[_0x419a6f+_0x04e4('0x31')]:![]});});}_0x9a7435[_0x04e4('0x32')]=_[_0x04e4('0x33')](_0x9a7435[_0x04e4('0x32')],{'$and':_0x2707f5});if(_0x84a66b['user'][_0x04e4('0x34')]===_0x04e4('0x35')){var _0x393bdc={'params':{'id':_0x84a66b[_0x04e4('0x35')]['userProfileId']},'query':{'section':'Agents','role':_0x04e4('0x2c'),'online':!![],'raw':!![],'ids':_0x3be0a9,'customSorting':_0x29f685}};if(_0x58caf4){_0x393bdc[_0x04e4('0x11')][_0x04e4('0x36')]=_0x2707f5;}_0x393bdc[_0x04e4('0x11')]=Object[_0x04e4('0x37')](_0x393bdc[_0x04e4('0x11')],_0x84a66b[_0x04e4('0x11')]);delete _0x393bdc[_0x04e4('0x11')]['id'];return db[_0x04e4('0x38')][_0x04e4('0x39')](_0x393bdc);}return db[_0x04e4('0x28')][_0x04e4('0x3a')](_0x9a7435);})['then'](function(_0xd5b145){_0x202c9c[_0x04e4('0xb')]=_0xd5b145[_0x04e4('0xb')];_0x11e367=_0xd5b145[_0x04e4('0x23')];return _0x11e367[_0x04e4('0x27')](function(_0x533b3a){var _0x5a5925=_['find'](_0x2fbdca,['id',_0x533b3a['id']]);if(_0x5a5925){var _0x409be8=rta[_0x04e4('0x3b')](_0x5a5925);_[_0x04e4('0x33')](_0x533b3a,_0x409be8);}_0x533b3a['globalStatus']=rta['getAgentStatus'](_0x533b3a);if(_0x533b3a[_0x04e4('0x1b')][_0x04e4('0x1a')](_0x04e4('0x3c'))){_0x371069[_0x04e4('0x3d')](function(_0x368c14){if(_0x533b3a[_0x368c14+_0x04e4('0x31')]){_0x533b3a[_0x368c14+'Status']=_0x04e4('0x3c');}});}return _0x533b3a;});})['then'](function(_0xeaba78){if(!_0x5db21f||_0x29f685){return _0xeaba78;}return rta[_0x04e4('0x3e')](_0xeaba78,_0x5db21f);})['then'](function(_0x25e439){var _0x10b800=null;if(_0x84a66b[_0x04e4('0x11')][_0x04e4('0x1e')]){var _0x2bd383=_0x84a66b[_0x04e4('0x11')][_0x04e4('0x1e')]['split'](',');_0x10b800=_0x25e439[_0x04e4('0x27')](function(_0x22860c){return _[_0x04e4('0x3f')](_0x22860c,_0x2bd383);});}_0x202c9c[_0x04e4('0x23')]=_0x10b800||_0x25e439;return _0x202c9c;})[_0x04e4('0x15')](respondWithFilteredResult(_0x10264e,_0x9a7435))['catch'](APIHandleError(_0x10264e));};exports['getQueues']=function(_0x1ebdc8,_0x523ee2){var _0x2963f4={'count':0x0,'rows':[]};var _0xebc8fe={};var _0x408bf3;var _0xe9a47f;var _0x5b39bb;Promise['resolve']()[_0x04e4('0x15')](function(){if(_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x16')]){if(!utils[_0x04e4('0x17')](_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x16')])){throw new APIBadRequestError(util[_0x04e4('0x18')](_0x04e4('0x40'),_0x1ebdc8[_0x04e4('0x11')]['channel']));}_0x408bf3=_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x16')][_0x04e4('0x41')]();}var _0x6b2b03=_['startCase'](_0x408bf3)+'Queue';var _0x2afd55=_[_0x04e4('0x27')](db[_0x6b2b03][_0x04e4('0x42')],function(_0x375b1d){return{'name':_0x375b1d[_0x04e4('0x29')],'type':_0x375b1d[_0x04e4('0x2a')][_0x04e4('0x2b')]};});if(!_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x1e')]){var _0x129e86=['id',_0x04e4('0x43')];if(_0x408bf3==='voice'){_0x129e86[_0x04e4('0x2e')](_0x04e4('0x2a'));if(_0x1ebdc8[_0x04e4('0x11')]['type']===_0x04e4('0x44')){_0x129e86['push'](['dialActive',_0x04e4('0x45')]);}}_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x1e')]=_0x129e86[_0x04e4('0x1f')](',');}_0xebc8fe=qs[_0x04e4('0x46')](_0x2afd55,_0x1ebdc8);if(_0x1ebdc8[_0x04e4('0x35')][_0x04e4('0x34')]===_0x04e4('0x35')){var _0x5d0807={'params':{'id':_0x1ebdc8['user'][_0x04e4('0x47')]},'query':{'section':_0x408bf3===_0x04e4('0x48')&&_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x2a')]===_0x04e4('0x44')?_0x04e4('0x49'):_[_0x04e4('0x4a')](_0x408bf3)+_0x04e4('0x4b'),'type':_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x2a')],'nolimit':!![],'sort':'name','filter':_0x1ebdc8[_0x04e4('0x11')]['filter']}};return db[_0x04e4('0x38')][_0x04e4('0x39')](_0x5d0807);}return db[_0x6b2b03][_0x04e4('0x3a')](_0xebc8fe);})[_0x04e4('0x15')](function(_0x50d31d){_0x2963f4[_0x04e4('0xb')]=_0x50d31d[_0x04e4('0xb')];_0xe9a47f=_0x50d31d[_0x04e4('0x23')];return rtq['getRealtimeQueues'](_0x1ebdc8,_0x408bf3);})[_0x04e4('0x15')](function(_0x51cd67){_0x5b39bb=_0x51cd67[_0x04e4('0x23')];return rtq[_0x04e4('0x4c')](_0xe9a47f,_0x5b39bb,_0x408bf3,_0x1ebdc8[_0x04e4('0x11')]['type']);})[_0x04e4('0x15')](function(_0x280fb1){_0x2963f4[_0x04e4('0x23')]=_0x280fb1;return _0x2963f4;})[_0x04e4('0x15')](respondWithFilteredResult(_0x523ee2,_0xebc8fe))[_0x04e4('0x4d')](APIHandleError(_0x523ee2));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index bf8f99a..374ff57 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2e11ba,_0x4376cb){var _0x3ba5f4=function(_0x3055b1){while(--_0x3055b1){_0x2e11ba['push'](_0x2e11ba['shift']());}};_0x3ba5f4(++_0x4376cb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xcb91[_0x3e6d5d];return _0x238923;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x388fa6,_0x31a305){var _0x38608b=function(_0x350604){while(--_0x350604){_0x388fa6['push'](_0x388fa6['shift']());}};_0x38608b(++_0x31a305);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index a363de2..86f687e 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 _0x2f74=['INTEGER','STRING','DATE','sequelize'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0x2f74,0x7b));var _0x42f7=function(_0x171a8a,_0x2c6407){_0x171a8a=_0x171a8a-0x0;var _0x178cbc=_0x2f74[_0x171a8a];return _0x178cbc;};'use strict';var Sequelize=require(_0x42f7('0x0'));module['exports']={'state':{'type':Sequelize[_0x42f7('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x42f7('0x2')]},'scheduledat':{'type':Sequelize[_0x42f7('0x3')]},'uniqueid':{'type':Sequelize[_0x42f7('0x2')]},'starttime':{'type':Sequelize[_0x42f7('0x3')]},'responsetime':{'type':Sequelize[_0x42f7('0x3')]},'ringtime':{'type':Sequelize[_0x42f7('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x42f7('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7d10=['DATE','STRING','exports','INTEGER'];(function(_0xa1dd6e,_0x240caa){var _0x5463da=function(_0x5f2834){while(--_0x5f2834){_0xa1dd6e['push'](_0xa1dd6e['shift']());}};_0x5463da(++_0x240caa);}(_0x7d10,0x1ce));var _0x07d1=function(_0x292e26,_0x5884a2){_0x292e26=_0x292e26-0x0;var _0x55e14f=_0x7d10[_0x292e26];return _0x55e14f;};'use strict';var Sequelize=require('sequelize');module[_0x07d1('0x0')]={'state':{'type':Sequelize[_0x07d1('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x07d1('0x2')]},'uniqueid':{'type':Sequelize[_0x07d1('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x07d1('0x2')]},'ringtime':{'type':Sequelize[_0x07d1('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x07d1('0x3')]},'membername':{'type':Sequelize[_0x07d1('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index f431420..1b5eae7 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 _0x4bfb=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','ReportAgentPreview','report_agent_preview'];(function(_0x2e1ba4,_0x59c821){var _0x9d462=function(_0x2fe03f){while(--_0x2fe03f){_0x2e1ba4['push'](_0x2e1ba4['shift']());}};_0x9d462(++_0x59c821);}(_0x4bfb,0x1e0));var _0xb4bf=function(_0x224dda,_0x16d0f9){_0x224dda=_0x224dda-0x0;var _0x2987ac=_0x4bfb[_0x224dda];return _0x2987ac;};'use strict';var _=require(_0xb4bf('0x0'));var util=require(_0xb4bf('0x1'));var logger=require(_0xb4bf('0x2'))(_0xb4bf('0x3'));var moment=require('moment');var BPromise=require(_0xb4bf('0x4'));var rp=require(_0xb4bf('0x5'));var fs=require('fs');var path=require(_0xb4bf('0x6'));var rimraf=require(_0xb4bf('0x7'));var config=require(_0xb4bf('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0xb4bf('0x9')]=function(_0x1632d2,_0x3ab006){return _0x1632d2['define'](_0xb4bf('0xa'),attributes,{'tableName':_0xb4bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17fb=['report_agent_preview','util','api','moment','bluebird','request-promise','path','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x1a07bb,_0x4fb447){var _0x5af6e1=function(_0x2d8ceb){while(--_0x2d8ceb){_0x1a07bb['push'](_0x1a07bb['shift']());}};_0x5af6e1(++_0x4fb447);}(_0x17fb,0x18d));var _0xb17f=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x17fb[_0x420d8d];return _0x4865d7;};'use strict';var _=require('lodash');var util=require(_0xb17f('0x0'));var logger=require('../../config/logger')(_0xb17f('0x1'));var moment=require(_0xb17f('0x2'));var BPromise=require(_0xb17f('0x3'));var rp=require(_0xb17f('0x4'));var fs=require('fs');var path=require(_0xb17f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb17f('0x6'));module[_0xb17f('0x7')]=function(_0x3594dd,_0x2725f1){return _0x3594dd[_0xb17f('0x8')](_0xb17f('0x9'),attributes,{'tableName':_0xb17f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 1b2dce4..6198aa6 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 _0xed58=['CreateReportAgentPreview','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','stringify','error','message','ReportAgentPreview,\x20%s,\x20%s','result','catch'];(function(_0xc7adcc,_0x14eb6a){var _0x20a7bf=function(_0x260d95){while(--_0x260d95){_0xc7adcc['push'](_0xc7adcc['shift']());}};_0x20a7bf(++_0x14eb6a);}(_0xed58,0x1e7));var _0x8ed5=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xed58[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x8ed5('0x0'));var moment=require(_0x8ed5('0x1'));var BPromise=require('bluebird');var rs=require(_0x8ed5('0x2'));var fs=require('fs');var Redis=require(_0x8ed5('0x3'));var db=require(_0x8ed5('0x4'))['db'];var utils=require(_0x8ed5('0x5'));var logger=require('../../config/logger')(_0x8ed5('0x6'));var config=require(_0x8ed5('0x7'));var jayson=require(_0x8ed5('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x357e26,_0x21632f,_0x5c806d){return new BPromise(function(_0x4e46c8,_0xcaf0d){return client['request'](_0x357e26,_0x5c806d)[_0x8ed5('0x9')](function(_0x3d4417){logger[_0x8ed5('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x21632f,_0x8ed5('0xb'));logger[_0x8ed5('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x21632f,'request\x20sent',JSON[_0x8ed5('0xd')](_0x3d4417));if(_0x3d4417[_0x8ed5('0xe')]){if(_0x3d4417[_0x8ed5('0xe')]['code']===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x21632f,_0x3d4417[_0x8ed5('0xe')][_0x8ed5('0xf')]);return _0xcaf0d(_0x3d4417[_0x8ed5('0xe')][_0x8ed5('0xf')]);}logger[_0x8ed5('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x21632f,_0x3d4417[_0x8ed5('0xe')][_0x8ed5('0xf')]);return _0x4e46c8(_0x3d4417['error']['message']);}else{logger[_0x8ed5('0xa')](_0x8ed5('0x10'),_0x21632f,_0x8ed5('0xb'));_0x4e46c8(_0x3d4417[_0x8ed5('0x11')][_0x8ed5('0xf')]);}})[_0x8ed5('0x12')](function(_0x42b657){logger['error'](_0x8ed5('0x10'),_0x21632f,_0x42b657);_0xcaf0d(_0x42b657);});});}exports[_0x8ed5('0x13')]=function(_0x25afbb){var _0x732766=this;return new Promise(function(_0x526cd1,_0x17cfcc){return db['ReportAgentPreview']['create'](_0x25afbb[_0x8ed5('0x14')],{'raw':_0x25afbb[_0x8ed5('0x15')]?_0x25afbb[_0x8ed5('0x15')][_0x8ed5('0x16')]===undefined?!![]:![]:!![]})[_0x8ed5('0x9')](function(_0x593f7a){logger[_0x8ed5('0xa')](_0x8ed5('0x13'),_0x25afbb);logger[_0x8ed5('0xc')](_0x8ed5('0x13'),_0x25afbb,JSON[_0x8ed5('0xd')](_0x593f7a));_0x526cd1(_0x593f7a);})[_0x8ed5('0x12')](function(_0x7dbf9c){logger[_0x8ed5('0xe')]('CreateReportAgentPreview',_0x7dbf9c[_0x8ed5('0xf')],_0x25afbb);_0x17cfcc(_0x732766[_0x8ed5('0xe')](0x1f4,_0x7dbf9c[_0x8ed5('0xf')]));});});}; \ No newline at end of file +var _0x5ad9=['result','catch','create','options','info','CreateReportAgentPreview','debug','lodash','util','moment','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x32f80d,_0x4e5317){var _0x1d2111=function(_0x49eecd){while(--_0x49eecd){_0x32f80d['push'](_0x32f80d['shift']());}};_0x1d2111(++_0x4e5317);}(_0x5ad9,0x91));var _0x95ad=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5ad9[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x95ad('0x0'));var util=require(_0x95ad('0x1'));var moment=require(_0x95ad('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95ad('0x3'));var logger=require('../../config/logger')(_0x95ad('0x4'));var config=require(_0x95ad('0x5'));var jayson=require(_0x95ad('0x6'));var client=jayson[_0x95ad('0x7')][_0x95ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f0f40,_0x4ff18a,_0x5e715e){return new BPromise(function(_0x157d51,_0x2a6bf4){return client['request'](_0x5f0f40,_0x5e715e)[_0x95ad('0x9')](function(_0x227cb4){logger['info'](_0x95ad('0xa'),_0x4ff18a,'request\x20sent');logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x4ff18a,'request\x20sent',JSON[_0x95ad('0xb')](_0x227cb4));if(_0x227cb4['error']){if(_0x227cb4[_0x95ad('0xc')][_0x95ad('0xd')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x4ff18a,_0x227cb4[_0x95ad('0xc')][_0x95ad('0xe')]);return _0x2a6bf4(_0x227cb4[_0x95ad('0xc')][_0x95ad('0xe')]);}logger['error'](_0x95ad('0xa'),_0x4ff18a,_0x227cb4[_0x95ad('0xc')][_0x95ad('0xe')]);return _0x157d51(_0x227cb4[_0x95ad('0xc')][_0x95ad('0xe')]);}else{logger['info'](_0x95ad('0xa'),_0x4ff18a,_0x95ad('0xf'));_0x157d51(_0x227cb4[_0x95ad('0x10')][_0x95ad('0xe')]);}})[_0x95ad('0x11')](function(_0x384924){logger[_0x95ad('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x4ff18a,_0x384924);_0x2a6bf4(_0x384924);});});}exports['CreateReportAgentPreview']=function(_0xf9a6c2){var _0x119c5d=this;return new Promise(function(_0x414350,_0x2e9f38){return db['ReportAgentPreview'][_0x95ad('0x12')](_0xf9a6c2['body'],{'raw':_0xf9a6c2[_0x95ad('0x13')]?_0xf9a6c2['options']['raw']===undefined?!![]:![]:!![]})[_0x95ad('0x9')](function(_0x2f3a7b){logger[_0x95ad('0x14')](_0x95ad('0x15'),_0xf9a6c2);logger[_0x95ad('0x16')]('CreateReportAgentPreview',_0xf9a6c2,JSON[_0x95ad('0xb')](_0x2f3a7b));_0x414350(_0x2f3a7b);})[_0x95ad('0x11')](function(_0x1d6839){logger[_0x95ad('0xc')](_0x95ad('0x15'),_0x1d6839[_0x95ad('0xe')],_0xf9a6c2);_0x2e9f38(_0x119c5d[_0x95ad('0xc')](0x1f4,_0x1d6839[_0x95ad('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b541497..291c9a6 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 _0x8abb=['post','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id','openchannel','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','util','path','express','Router','../../components/auth/service','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','outbound','/outbound/channels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues'];(function(_0x45d20b,_0x2dc142){var _0x57f468=function(_0x440500){while(--_0x440500){_0x45d20b['push'](_0x45d20b['shift']());}};_0x57f468(++_0x2dc142);}(_0x8abb,0x195));var _0xb8ab=function(_0x48d052,_0x4312b3){_0x48d052=_0x48d052-0x0;var _0x321fbf=_0x8abb[_0x48d052];return _0x321fbf;};'use strict';var multer=require('multer');var util=require(_0xb8ab('0x0'));var path=require(_0xb8ab('0x1'));var express=require(_0xb8ab('0x2'));var router=express[_0xb8ab('0x3')]();var auth=require(_0xb8ab('0x4'));var controller=require('./rpc.controller');router['get']('/voice/channels',auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x6')]);router[_0xb8ab('0x7')](_0xb8ab('0x8'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x9')]);router['get'](_0xb8ab('0xa'),auth['isAuthenticated'](),controller[_0xb8ab('0xb')]);router[_0xb8ab('0x7')](_0xb8ab('0xc'),auth['isAuthenticated'](),controller[_0xb8ab('0xd')]);router['get'](_0xb8ab('0xe'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0xf')]);router[_0xb8ab('0x7')](_0xb8ab('0x10'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x11')]);router['get'](_0xb8ab('0x12'),auth[_0xb8ab('0x5')](),controller['mailAccounts']);router['get'](_0xb8ab('0x13'),auth[_0xb8ab('0x5')](),controller['openchannelQueues']);router['get'](_0xb8ab('0x14'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x15')]);router['get'](_0xb8ab('0x16'),auth['isAuthenticated'](),controller[_0xb8ab('0x17')]);router[_0xb8ab('0x7')](_0xb8ab('0x18'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x19')]);router[_0xb8ab('0x7')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0xb8ab('0x1a')]);router['get'](_0xb8ab('0x1b'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x1c')]);router[_0xb8ab('0x7')](_0xb8ab('0x1d'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x1e')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xb8ab('0x5')](),controller['voiceQueuesChannelHangup']);router[_0xb8ab('0x7')](_0xb8ab('0x1f'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x20')]);router[_0xb8ab('0x7')](_0xb8ab('0x21'),auth[_0xb8ab('0x5')](),controller['showVoiceQueues']);router[_0xb8ab('0x22')](_0xb8ab('0x21'),auth[_0xb8ab('0x5')](),controller['updateVoiceQueue']);router['get']('/outbound',auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x23')]);router[_0xb8ab('0x7')](_0xb8ab('0x24'),auth[_0xb8ab('0x5')](),controller['outboundChannels']);router[_0xb8ab('0x7')]('/agents',auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x25')]);router[_0xb8ab('0x22')](_0xb8ab('0x26'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x27')]);router[_0xb8ab('0x7')](_0xb8ab('0x28'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x29')]);router[_0xb8ab('0x7')](_0xb8ab('0x2a'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x2b')]);router[_0xb8ab('0x7')]('/campaigns',auth[_0xb8ab('0x5')](),controller['campaigns']);router['get'](_0xb8ab('0x2c'),auth[_0xb8ab('0x5')](),controller['faxAccounts']);router[_0xb8ab('0x7')](_0xb8ab('0x2d'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x2e')]);router[_0xb8ab('0x7')](_0xb8ab('0x2f'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x30')]);router[_0xb8ab('0x7')](_0xb8ab('0x31'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x32')]);router[_0xb8ab('0x7')](_0xb8ab('0x33'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x34')]);router[_0xb8ab('0x7')]('/sms/queues/waitinginteractions',auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x35')]);router['get'](_0xb8ab('0x36'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x37')]);router[_0xb8ab('0x7')](_0xb8ab('0x38'),auth['isAuthenticated'](),controller[_0xb8ab('0x39')]);router['post'](_0xb8ab('0x3a'),auth['isAuthenticated'](),controller[_0xb8ab('0x3b')](_0xb8ab('0x3c')));router[_0xb8ab('0x7')](_0xb8ab('0x3d'),auth['isAuthenticated'](),controller[_0xb8ab('0x3e')]);router[_0xb8ab('0x3f')](_0xb8ab('0x40'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x3b')](_0xb8ab('0x41')));router[_0xb8ab('0x7')](_0xb8ab('0x42'),auth[_0xb8ab('0x5')](),controller['showChatQueues']);router[_0xb8ab('0x3f')]('/fax/queues/:id/notify',auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x3b')]('fax'));router[_0xb8ab('0x7')](_0xb8ab('0x43'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0xb8ab('0x3f')]('/openchannel/queues/:id/notify',auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x3b')](_0xb8ab('0x44')));router['get']('/openchannel/queues/:id',auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x45')]);router['post']('/sms/queues/:id/notify',auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x3b')](_0xb8ab('0x46')));router['post'](_0xb8ab('0x47'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x3b')](_0xb8ab('0x48')));router[_0xb8ab('0x7')](_0xb8ab('0x49'),auth[_0xb8ab('0x5')](),controller[_0xb8ab('0x4a')]);router['get'](_0xb8ab('0x4b'),auth['isAuthenticated'](),controller[_0xb8ab('0x4c')]);router[_0xb8ab('0x3f')](_0xb8ab('0x4d'),auth[_0xb8ab('0x5')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0xb503=['/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','post','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','/agents','agents','telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xb503,0x161));var _0x3b50=function(_0x3aa1f5,_0x118a87){_0x3aa1f5=_0x3aa1f5-0x0;var _0x13b0af=_0xb503[_0x3aa1f5];return _0x13b0af;};'use strict';var multer=require(_0x3b50('0x0'));var util=require(_0x3b50('0x1'));var path=require(_0x3b50('0x2'));var express=require(_0x3b50('0x3'));var router=express[_0x3b50('0x4')]();var auth=require(_0x3b50('0x5'));var controller=require('./rpc.controller');router['get'](_0x3b50('0x6'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x8')]);router[_0x3b50('0x9')](_0x3b50('0xa'),auth[_0x3b50('0x7')](),controller[_0x3b50('0xb')]);router['get'](_0x3b50('0xc'),auth['isAuthenticated'](),controller[_0x3b50('0xd')]);router[_0x3b50('0x9')](_0x3b50('0xe'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x3b50('0x9')](_0x3b50('0xf'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x10')]);router[_0x3b50('0x9')](_0x3b50('0x11'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x12')]);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0x3b50('0x13')]);router[_0x3b50('0x9')](_0x3b50('0x14'),auth[_0x3b50('0x7')](),controller['openchannelQueues']);router[_0x3b50('0x9')]('/sms/queues',auth[_0x3b50('0x7')](),controller[_0x3b50('0x15')]);router[_0x3b50('0x9')](_0x3b50('0x16'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x17')]);router['get'](_0x3b50('0x18'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x19')]);router[_0x3b50('0x9')](_0x3b50('0x1a'),auth['isAuthenticated'](),controller[_0x3b50('0x1b')]);router['get'](_0x3b50('0x1c'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x1d')]);router[_0x3b50('0x9')](_0x3b50('0x1e'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x1f')]);router[_0x3b50('0x9')](_0x3b50('0x20'),auth['isAuthenticated'](),controller[_0x3b50('0x21')]);router[_0x3b50('0x9')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x3b50('0x22')]);router[_0x3b50('0x9')](_0x3b50('0x23'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x24')]);router[_0x3b50('0x25')](_0x3b50('0x23'),auth[_0x3b50('0x7')](),controller['updateVoiceQueue']);router[_0x3b50('0x9')](_0x3b50('0x26'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x27')]);router[_0x3b50('0x9')](_0x3b50('0x28'),auth[_0x3b50('0x7')](),controller['outboundChannels']);router[_0x3b50('0x9')](_0x3b50('0x29'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x2a')]);router[_0x3b50('0x25')]('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router[_0x3b50('0x9')]('/telephones',auth[_0x3b50('0x7')](),controller[_0x3b50('0x2b')]);router['get'](_0x3b50('0x2c'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x2d')]);router['get'](_0x3b50('0x2e'),auth[_0x3b50('0x7')](),controller['campaigns']);router['get']('/fax/accounts',auth[_0x3b50('0x7')](),controller[_0x3b50('0x2f')]);router[_0x3b50('0x9')](_0x3b50('0x30'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x31')]);router[_0x3b50('0x9')](_0x3b50('0x32'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x33')]);router[_0x3b50('0x9')](_0x3b50('0x34'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x35')]);router[_0x3b50('0x9')](_0x3b50('0x36'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x37')]);router[_0x3b50('0x9')]('/sms/queues/waitinginteractions',auth[_0x3b50('0x7')](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x3b50('0x7')](),controller[_0x3b50('0x38')]);router[_0x3b50('0x9')](_0x3b50('0x39'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x3a')]);router['post']('/mail/queues/:id/notify',auth[_0x3b50('0x7')](),controller[_0x3b50('0x3b')](_0x3b50('0x3c')));router[_0x3b50('0x9')](_0x3b50('0x3d'),auth[_0x3b50('0x7')](),controller['showMailQueues']);router[_0x3b50('0x3e')]('/chat/queues/:id/notify',auth[_0x3b50('0x7')](),controller[_0x3b50('0x3b')](_0x3b50('0x3f')));router[_0x3b50('0x9')](_0x3b50('0x40'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x41')]);router['post'](_0x3b50('0x42'),auth['isAuthenticated'](),controller[_0x3b50('0x3b')](_0x3b50('0x43')));router[_0x3b50('0x9')](_0x3b50('0x44'),auth['isAuthenticated'](),controller[_0x3b50('0x45')]);router['post'](_0x3b50('0x46'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x3b')]('openchannel'));router['get']('/openchannel/queues/:id',auth[_0x3b50('0x7')](),controller[_0x3b50('0x47')]);router[_0x3b50('0x3e')](_0x3b50('0x48'),auth['isAuthenticated'](),controller[_0x3b50('0x3b')](_0x3b50('0x49')));router[_0x3b50('0x3e')]('/whatsapp/queues/:id/notify',auth[_0x3b50('0x7')](),controller[_0x3b50('0x3b')](_0x3b50('0x4a')));router[_0x3b50('0x9')](_0x3b50('0x4b'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x4c')]);router[_0x3b50('0x9')](_0x3b50('0x4d'),auth['isAuthenticated'](),controller[_0x3b50('0x4e')]);router['post'](_0x3b50('0x4f'),auth[_0x3b50('0x7')](),controller['agentNotify']);module[_0x3b50('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 96c4612..304283b 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 _0xa630=['user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','agent','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','MailQueues','showMailQueues','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','Account','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','update','agentTransferTimeout','bluebird','moment','../../mysqldb','api','client','http','then','error','code','message','result','json','stack','name','status','isNil','rows','find','voiceChannels','VoiceChannels','catch','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','agentCapacity'];(function(_0x58b6a8,_0x307021){var _0xc566dc=function(_0x59bd76){while(--_0x59bd76){_0x58b6a8['push'](_0x58b6a8['shift']());}};_0xc566dc(++_0x307021);}(_0xa630,0xbe));var _0x0a63=function(_0x1022a9,_0x50de38){_0x1022a9=_0x1022a9-0x0;var _0xffc0d0=_0xa630[_0x1022a9];return _0xffc0d0;};'use strict';var BPromise=require(_0x0a63('0x0'));var moment=require(_0x0a63('0x1'));var _=require('lodash');var util=require('util');var db=require(_0x0a63('0x2'))['db'];var logger=require('../../config/logger')(_0x0a63('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0a63('0x4')][_0x0a63('0x5')]({'port':0x232a});var mailClient=jayson[_0x0a63('0x4')][_0x0a63('0x5')]({'port':0x232b});var routingClient=jayson[_0x0a63('0x4')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2760b0,_0x3d5f0b,_0xc2dcd7){return new BPromise(function(_0x41d21d,_0x12a7df){var _0x2a1bd7=_0xc2dcd7?_0xc2dcd7:amiClient;return _0x2a1bd7['request'](_0x2760b0,_0x3d5f0b)[_0x0a63('0x6')](function(_0xb714c7){if(_0xb714c7[_0x0a63('0x7')]){if(_0xb714c7[_0x0a63('0x7')][_0x0a63('0x8')]===0x1f4){return _0x12a7df(_0xb714c7[_0x0a63('0x7')][_0x0a63('0x9')]);}return _0x41d21d(_0xb714c7[_0x0a63('0x7')][_0x0a63('0x9')]);}else{_0x41d21d(_0xb714c7[_0x0a63('0xa')]);}})['catch'](function(_0x345f56){_0x12a7df(_0x345f56);});});}function respondWithResult(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xc8;return function(_0x3d6323){if(_0x3d6323){return _0x420043['status'](_0x2fce86)[_0x0a63('0xb')](_0x3d6323);}return _0x420043['sendStatus'](0x194);};}function handleError(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0x1f4;return function(_0x26b2bc){logger[_0x0a63('0x7')](_0x26b2bc[_0x0a63('0xc')]);if(_0x26b2bc[_0x0a63('0xd')]){delete _0x26b2bc[_0x0a63('0xd')];}_0x331e99[_0x0a63('0xe')](_0x19e922)['send'](_0x26b2bc);};}function findById(_0x47788e){return function(_0x56b314){if(!_[_0x0a63('0xf')](_0x47788e)&&!_[_0x0a63('0xf')](_0x56b314)&&!_[_0x0a63('0xf')](_0x56b314[_0x0a63('0x10')])){return _[_0x0a63('0x11')](_0x56b314[_0x0a63('0x10')],function(_0x30f292){return _0x30f292['id']==_0x47788e;});}return null;};}exports[_0x0a63('0x12')]=function(_0x2fd06c,_0x3cc74d){return respondWithRpcPromise(_0x0a63('0x13'),_0x2fd06c['query'])['then'](respondWithResult(_0x3cc74d,null))[_0x0a63('0x14')](handleError(_0x3cc74d,null));};exports['voiceChannelMixMonitor']=function(_0x2fc87c,_0x5937df){return respondWithRpcPromise(_0x0a63('0x15'),_[_0x0a63('0x16')](_0x2fc87c[_0x0a63('0x17')],_0x2fc87c[_0x0a63('0x18')]))['then'](respondWithResult(_0x5937df,null))[_0x0a63('0x14')](handleError(_0x5937df,null));};exports['voiceChannelStopMixMonitor']=function(_0x3a7f9d,_0x11fe64){return respondWithRpcPromise(_0x0a63('0x19'),_[_0x0a63('0x16')](_0x3a7f9d[_0x0a63('0x17')],_0x3a7f9d[_0x0a63('0x18')]))[_0x0a63('0x6')](respondWithResult(_0x11fe64,null))[_0x0a63('0x14')](handleError(_0x11fe64,null));};exports['voiceQueues']=function(_0x5e5987,_0x55fb70){return respondWithRpcPromise('VoiceQueues',_0x5e5987[_0x0a63('0x17')])['then'](respondWithResult(_0x55fb70,null))['catch'](handleError(_0x55fb70,null));};exports[_0x0a63('0x1a')]=function(_0x1d5448,_0x362d6a){return respondWithRpcPromise(_0x0a63('0x1b'),_0x1d5448['query'])[_0x0a63('0x6')](findById(_0x1d5448[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x362d6a,null))['catch'](handleError(_0x362d6a,null));};exports[_0x0a63('0x1c')]=function(_0xcf409,_0x1b7bdb){return respondWithRpcPromise(_0x0a63('0x1d'),_[_0x0a63('0x16')](_0xcf409[_0x0a63('0x1e')],_0xcf409[_0x0a63('0x18')]))[_0x0a63('0x6')](respondWithResult(_0x1b7bdb,null))['catch'](handleError(_0x1b7bdb,null));};exports[_0x0a63('0x1f')]=function(_0x574c06,_0x151cb6){return respondWithRpcPromise(_0x0a63('0x20'),_[_0x0a63('0x16')](_0x574c06[_0x0a63('0x17')],_0x574c06[_0x0a63('0x18')]))['then'](respondWithResult(_0x151cb6,null))[_0x0a63('0x14')](handleError(_0x151cb6,null));};exports[_0x0a63('0x21')]=function(_0x33a717,_0x46fb40){return respondWithRpcPromise('VoiceQueuesChannels',_0x33a717[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x46fb40,null))['catch'](handleError(_0x46fb40,null));};exports['voiceQueuesChannel']=function(_0x34a170,_0x51d959){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0a63('0x16')](_0x34a170[_0x0a63('0x17')],_0x34a170['params']))[_0x0a63('0x6')](respondWithResult(_0x51d959,null))[_0x0a63('0x14')](handleError(_0x51d959,null));};exports[_0x0a63('0x22')]=function(_0x333130,_0x395cce){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x333130[_0x0a63('0x17')],_0x333130[_0x0a63('0x18')]))[_0x0a63('0x6')](respondWithResult(_0x395cce,null))[_0x0a63('0x14')](handleError(_0x395cce,null));};exports[_0x0a63('0x23')]=function(_0x273bcf,_0x59912d){return respondWithRpcPromise(_0x0a63('0x24'),_[_0x0a63('0x16')](_0x273bcf['query'],_0x273bcf[_0x0a63('0x18')]))['then'](respondWithResult(_0x59912d,null))['catch'](handleError(_0x59912d,null));};exports[_0x0a63('0x25')]=function(_0x232388,_0xdc602c){return respondWithRpcPromise('Outbound',_0x232388[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0xdc602c,null))[_0x0a63('0x14')](handleError(_0xdc602c,null));};exports[_0x0a63('0x26')]=function(_0x3f88a1,_0x876bc6){return respondWithRpcPromise(_0x0a63('0x27'),_0x3f88a1['query'])[_0x0a63('0x6')](respondWithResult(_0x876bc6,null))[_0x0a63('0x14')](handleError(_0x876bc6,null));};exports[_0x0a63('0x28')]=function(_0x53d034,_0x5d9952){var _0x28f904;return respondWithRpcPromise('Agents',_0x53d034[_0x0a63('0x17')])[_0x0a63('0x6')](function(_0x128e9e){_0x28f904=_0x128e9e;return respondWithRpcPromise('Agents',_0x53d034[_0x0a63('0x17')],routingClient);})[_0x0a63('0x6')](function(_0x46b6ee){return _[_0x0a63('0x16')]({},_0x46b6ee,_0x28f904);})['then'](respondWithResult(_0x5d9952,null))[_0x0a63('0x14')](handleError(_0x5d9952,null));};exports[_0x0a63('0x29')]=function(_0x4234cd,_0x2ccd99){if(_0x4234cd[_0x0a63('0x1e')]&&_0x4234cd[_0x0a63('0x1e')]['interaction']&&_0x4234cd[_0x0a63('0x2a')]&&_0x4234cd[_0x0a63('0x2a')][_0x0a63('0xd')]){for(var _0x793502 in _0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')]){if(_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x0a63('0x2c')](_0x793502)){db[_0x0a63('0x2d')][_0x0a63('0x2e')]({'where':{'channel':_0x793502,'membername':_0x4234cd[_0x0a63('0x2a')][_0x0a63('0xd')],'type':_0x0a63('0x2f'),'exitAt':null,'uniqueid':_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502]&&_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502]['length']?{'$notIn':_0x4234cd[_0x0a63('0x1e')]['interaction'][_0x793502]}:{'$ne':null}}})['then'](function(_0xd9eddc){var _0x223ecf=moment()[_0x0a63('0x30')](_0x0a63('0x31'));for(var _0xd9149d=0x0,_0x9c89ed=_0xd9eddc[_0x0a63('0x32')];_0xd9149d<_0x9c89ed;_0xd9149d+=0x1){_0xd9eddc[_0xd9149d][_0x0a63('0x33')]({'exitAt':_0x223ecf});}});for(var _0x3d0667=0x0;_0x3d0667<_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502][_0x0a63('0x32')];_0x3d0667+=0x1){db[_0x0a63('0x2d')][_0x0a63('0x34')]({'where':{'channel':_0x793502,'membername':_0x4234cd[_0x0a63('0x2a')][_0x0a63('0xd')],'type':_0x0a63('0x2f'),'uniqueid':_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502][_0x3d0667],'exitAt':null},'defaults':{'channel':_0x793502,'membername':_0x4234cd[_0x0a63('0x2a')]['name'],'interface':_[_0x0a63('0xf')](_0x4234cd[_0x0a63('0x2a')]['interface'])?util['format']('SIP/%s',_0x4234cd['user'][_0x0a63('0xd')]):_0x4234cd[_0x0a63('0x2a')]['interface'],'type':_0x0a63('0x2f'),'enterAt':moment()['format'](_0x0a63('0x31')),'role':_0x0a63('0x35'),'internal':_0x4234cd['user']['internal'],'uniqueid':_0x4234cd['body'][_0x0a63('0x2b')][_0x793502][_0x3d0667]}});}}}}return respondWithRpcPromise(_0x0a63('0x36'),{'id':_0x4234cd[_0x0a63('0x18')]['id'],'capacity':_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x37')]},routingClient)['then'](respondWithResult(_0x2ccd99,null))[_0x0a63('0x14')](handleError(_0x2ccd99,null));};exports[_0x0a63('0x38')]=function(_0x22b3ea,_0x10adf1){return respondWithRpcPromise(_0x0a63('0x39'),_0x22b3ea['query'])[_0x0a63('0x6')](respondWithResult(_0x10adf1,null))[_0x0a63('0x14')](handleError(_0x10adf1,null));};exports[_0x0a63('0x3a')]=function(_0x1fbd2b,_0x4f3414){return respondWithRpcPromise(_0x0a63('0x3b'),_0x1fbd2b[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x4f3414,null))[_0x0a63('0x14')](handleError(_0x4f3414,null));};exports[_0x0a63('0x3c')]=function(_0x258ed3,_0x4d4e20){return respondWithRpcPromise(_0x0a63('0x3d'),_0x258ed3[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x4d4e20,null))[_0x0a63('0x14')](handleError(_0x4d4e20,null));};exports['chatQueues']=function(_0x4c1e34,_0x2ac98b){return respondWithRpcPromise(_0x0a63('0x3e'),_0x4c1e34[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x2ac98b,null))[_0x0a63('0x14')](handleError(_0x2ac98b,null));};exports['showChatQueues']=function(_0x5e6aae,_0x58b3a8){return respondWithRpcPromise(_0x0a63('0x3e'),_0x5e6aae['query'],routingClient)[_0x0a63('0x6')](findById(_0x5e6aae[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x58b3a8,null))['catch'](handleError(_0x58b3a8,null));};exports['mailQueues']=function(_0x2d63c6,_0x226279){return respondWithRpcPromise(_0x0a63('0x3f'),_0x2d63c6[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x226279,null))[_0x0a63('0x14')](handleError(_0x226279,null));};exports[_0x0a63('0x40')]=function(_0xc3415c,_0xe454ef){return respondWithRpcPromise(_0x0a63('0x3f'),_0xc3415c[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0xc3415c[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0xe454ef,null))['catch'](handleError(_0xe454ef,null));};exports['mailAccounts']=function(_0x1adea6,_0x24c9e0){return respondWithRpcPromise('MailAccounts',_0x1adea6[_0x0a63('0x17')],mailClient)[_0x0a63('0x6')](respondWithResult(_0x24c9e0,null))['catch'](handleError(_0x24c9e0,null));};exports[_0x0a63('0x41')]=function(_0x3053e4,_0x5e5495){return respondWithRpcPromise('OpenchannelQueues',_0x3053e4[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x5e5495,null))[_0x0a63('0x14')](handleError(_0x5e5495,null));};exports['showOpenchannelQueues']=function(_0x116e05,_0x375acd){return respondWithRpcPromise(_0x0a63('0x42'),_0x116e05[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x116e05['params']['id']))[_0x0a63('0x6')](respondWithResult(_0x375acd,null))[_0x0a63('0x14')](handleError(_0x375acd,null));};exports[_0x0a63('0x43')]=function(_0x1fa9cd,_0x295c06){return respondWithRpcPromise(_0x0a63('0x44'),_0x1fa9cd[_0x0a63('0x17')],routingClient)['then'](respondWithResult(_0x295c06,null))[_0x0a63('0x14')](handleError(_0x295c06,null));};exports[_0x0a63('0x45')]=function(_0x252f70,_0x1155f1){return respondWithRpcPromise(_0x0a63('0x44'),_0x252f70[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x252f70[_0x0a63('0x18')]['id']))['then'](respondWithResult(_0x1155f1,null))['catch'](handleError(_0x1155f1,null));};exports[_0x0a63('0x46')]=function(_0x30e5f0,_0x4137bc){return respondWithRpcPromise(_0x0a63('0x47'),_0x30e5f0[_0x0a63('0x17')],routingClient)['then'](respondWithResult(_0x4137bc,null))[_0x0a63('0x14')](handleError(_0x4137bc,null));};exports[_0x0a63('0x48')]=function(_0x1aefc4,_0x2a2f1b){return respondWithRpcPromise(_0x0a63('0x47'),_0x1aefc4[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x1aefc4[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x2a2f1b,null))[_0x0a63('0x14')](handleError(_0x2a2f1b,null));};exports[_0x0a63('0x49')]=function(_0x485969,_0x25276f){return respondWithRpcPromise('FaxQueues',_0x485969[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x25276f,null))['catch'](handleError(_0x25276f,null));};exports['showFaxQueues']=function(_0x480acb,_0x31481f){return respondWithRpcPromise(_0x0a63('0x4a'),_0x480acb[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x480acb[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x31481f,null))['catch'](handleError(_0x31481f,null));};exports['faxAccounts']=function(_0x5cb325,_0x1213a5){return respondWithRpcPromise(_0x0a63('0x4b'),_0x5cb325[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x1213a5,null))['catch'](handleError(_0x1213a5,null));};exports[_0x0a63('0x4c')]=function(_0x5ed2db,_0x5de3de){return respondWithRpcPromise(_0x0a63('0x4d'),_0x5ed2db['query'],routingClient)[_0x0a63('0x6')](respondWithResult(_0x5de3de,null))[_0x0a63('0x14')](handleError(_0x5de3de,null));};exports['mailQueuesWaitingInteractions']=function(_0x267583,_0x4d1e35){return respondWithRpcPromise(_0x0a63('0x4e'),_0x267583['query'],routingClient)[_0x0a63('0x6')](respondWithResult(_0x4d1e35,null))[_0x0a63('0x14')](handleError(_0x4d1e35,null));};exports[_0x0a63('0x4f')]=function(_0x4fba49,_0x3b8442){return respondWithRpcPromise(_0x0a63('0x50'),_0x4fba49[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x3b8442,null))[_0x0a63('0x14')](handleError(_0x3b8442,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x55174c,_0x550dbb){return respondWithRpcPromise(_0x0a63('0x50'),_0x55174c['query'],routingClient)[_0x0a63('0x6')](function(_0xa27da4){if(_0x55174c[_0x0a63('0x17')][_0x0a63('0x51')]!==undefined){var _0x5540c6=_(_0xa27da4[_0x0a63('0x10')])[_0x0a63('0x52')]([_0x55174c['query'][_0x0a63('0x51')],_0x55174c[_0x0a63('0x18')]['id']])[_0x0a63('0x53')](_0x0a63('0x54'))[_0x0a63('0x55')]()['value']();return _0xa27da4[_0x0a63('0x10')][_0x0a63('0x52')](function(_0x3941f6){return _0x5540c6['indexOf'](_0x3941f6['queue_id'])>-0x1;});}else{return _0xa27da4['rows'][_0x0a63('0x52')](function(_0x3b94ae){return _0x3b94ae[_0x0a63('0x54')]===parseInt(_0x55174c[_0x0a63('0x18')]['id']);});}})[_0x0a63('0x6')](respondWithResult(_0x550dbb,null))[_0x0a63('0x14')](handleError(_0x550dbb,null));};exports[_0x0a63('0x56')]=function(_0x37255d,_0x1dc593){return respondWithRpcPromise(_0x0a63('0x57'),_0x37255d['query'],routingClient)[_0x0a63('0x6')](respondWithResult(_0x1dc593,null))[_0x0a63('0x14')](handleError(_0x1dc593,null));};exports[_0x0a63('0x58')]=function(_0x229954,_0x3d62ca){return respondWithRpcPromise(_0x0a63('0x59'),_0x229954['query'],routingClient)['then'](respondWithResult(_0x3d62ca,null))[_0x0a63('0x14')](handleError(_0x3d62ca,null));};exports[_0x0a63('0x5a')]=function(_0x425c8c,_0x3caea6){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x425c8c[_0x0a63('0x17')],routingClient)['then'](respondWithResult(_0x3caea6,null))[_0x0a63('0x14')](handleError(_0x3caea6,null));};exports[_0x0a63('0x5b')]=function(_0x1e256e){return function(_0xee586,_0x486ffc){var _0x3710fa,_0x2173ee;var _0x430065=_[_0x0a63('0x5c')](_0x1e256e);var _0x540953=_0x1e256e==='chat'?_0x0a63('0x5d'):'Account';return db[_0x430065+_0x0a63('0x5e')][_0x0a63('0x5f')]({'raw':!![],'where':{'id':_0xee586[_0x0a63('0x18')]['id']}})[_0x0a63('0x6')](function(_0x65a390){if(_['isNil'](_0x65a390)){throw new Error(_0x430065+_0x0a63('0x60'));}_0x3710fa=_0x65a390;return db[_0x430065+_0x0a63('0x61')][_0x0a63('0x5f')]({'where':{'id':_0xee586[_0x0a63('0x1e')][_0x0a63('0x62')]},'include':[{'model':db[_0x430065+_0x0a63('0x63')],'as':_0x0a63('0x63')},{'model':db[_0x430065+_0x540953],'as':'Account'}]});})[_0x0a63('0x6')](function(_0x1a329c){if(_[_0x0a63('0xf')](_0x1a329c)){throw new Error(_0x430065+_0x0a63('0x64'));}_0x2173ee=_0x1a329c;return _0x1a329c['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x0a63('0x6')](function(){var _0x148bbd={'uniqueid':_0x1e256e+'.'+_0x2173ee['id']+'.'+_0x2173ee[_0x0a63('0x63')]['id'],'FromUserId':_0xee586['user']['id'],'type':_0x0a63('0x65')};_0x148bbd[_0x430065+_0x0a63('0x66')]=_0x2173ee['id'];_0x148bbd[_0x430065+_0x0a63('0x67')]=_0x2173ee['Interaction']['id'];_0x148bbd[_0x0a63('0x68')+_0x430065+_0x540953+'Id']=_0x2173ee[_0x0a63('0x69')]['id'];_0x148bbd['To'+_0x430065+_0x0a63('0x6a')]=_0x3710fa['id'];return db[_0x430065+_0x0a63('0x6b')][_0x0a63('0x6c')](_0x148bbd);})[_0x0a63('0x6')](function(){return respondWithRpcPromise(_0x0a63('0x6d'),{'channel':_0x1e256e,'interaction':_0x2173ee[_0x0a63('0x63')],'message':_0x2173ee,'account':_0x2173ee[_0x0a63('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a63('0x65'),'appdata':_0x3710fa[_0x0a63('0xd')]+','+(_0x2173ee[_0x0a63('0x69')][_0x0a63('0x6e')]||0x12c),'interval':_0x0a63('0x6f')}]},routingClient);})[_0x0a63('0x6')](respondWithResult(_0x486ffc,null))[_0x0a63('0x14')](handleError(_0x486ffc,null));};};exports['agentNotify']=function(_0x3ddf5e,_0x5f0510){var _0x19a46f,_0x36fd48;if(_['isNil'](_0x3ddf5e[_0x0a63('0x1e')][_0x0a63('0x70')])){throw new Error(_0x0a63('0x71'));}var _0x2e1dc6=_0x3ddf5e[_0x0a63('0x1e')][_0x0a63('0x70')];var _0x1030f7=_[_0x0a63('0x5c')](_0x2e1dc6);var _0x393399=_0x2e1dc6==='chat'?_0x0a63('0x5d'):'Account';return db['User'][_0x0a63('0x5f')]({'raw':!![],'where':{'id':_0x3ddf5e[_0x0a63('0x18')]['id'],'role':_0x0a63('0x35')}})[_0x0a63('0x6')](function(_0x5e1f76){if(_[_0x0a63('0xf')](_0x5e1f76)){throw new Error('Agent\x20not\x20found');}_0x19a46f=_0x5e1f76;return db[_0x1030f7+'Message'][_0x0a63('0x5f')]({'where':{'id':_0x3ddf5e['body']['messageId']},'include':[{'model':db[_0x1030f7+_0x0a63('0x63')],'as':_0x0a63('0x63')},{'model':db[_0x1030f7+_0x393399],'as':_0x0a63('0x69')}]});})[_0x0a63('0x6')](function(_0x52488a){if(_[_0x0a63('0xf')](_0x52488a)){throw new Error(_0x1030f7+'\x20Message\x20not\x20found');}_0x36fd48=_0x52488a;return _0x52488a[_0x0a63('0x72')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x11dd21={'uniqueid':_0x2e1dc6+'.'+_0x36fd48['id']+'.'+_0x36fd48['Interaction']['id'],'FromUserId':_0x3ddf5e[_0x0a63('0x2a')]['id'],'type':_0x0a63('0x65'),'ToUserId':_0x19a46f['id']};_0x11dd21[_0x1030f7+_0x0a63('0x66')]=_0x36fd48['id'];_0x11dd21[_0x1030f7+_0x0a63('0x67')]=_0x36fd48[_0x0a63('0x63')]['id'];_0x11dd21[_0x0a63('0x68')+_0x1030f7+_0x393399+'Id']=_0x36fd48[_0x0a63('0x69')]['id'];return db[_0x1030f7+_0x0a63('0x6b')][_0x0a63('0x6c')](_0x11dd21);})['then'](function(){return respondWithRpcPromise(_0x0a63('0x6d'),{'channel':_0x2e1dc6,'interaction':_0x36fd48['Interaction'],'message':_0x36fd48,'account':_0x36fd48[_0x0a63('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a63('0x35'),'appdata':_0x19a46f[_0x0a63('0xd')]+','+(_0x36fd48[_0x0a63('0x69')][_0x0a63('0x73')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x0a63('0x6')](respondWithResult(_0x5f0510,null))[_0x0a63('0x14')](handleError(_0x5f0510,null));}; \ No newline at end of file +var _0x032e=['MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','uniq','value','filter','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','Interaction','update','queue','MessageId','InteractionId','From','TransferReport','agentNotify','Channel\x20field\x20is\x20mandatory','channel','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','create','Start','bluebird','lodash','util','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','params','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x032e,0x124));var _0xe032=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x032e[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0xe032('0x0'));var moment=require('moment');var _=require(_0xe032('0x1'));var util=require(_0xe032('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xe032('0x3'));var jayson=require(_0xe032('0x4'));var amiClient=jayson[_0xe032('0x5')][_0xe032('0x6')]({'port':0x232a});var mailClient=jayson[_0xe032('0x5')][_0xe032('0x6')]({'port':0x232b});var routingClient=jayson[_0xe032('0x5')][_0xe032('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){var _0x3b0ef8=_0x3289b0?_0x3289b0:amiClient;return _0x3b0ef8[_0xe032('0x7')](_0x37432f,_0x1576c8)[_0xe032('0x8')](function(_0x2dc9e5){if(_0x2dc9e5[_0xe032('0x9')]){if(_0x2dc9e5['error'][_0xe032('0xa')]===0x1f4){return _0xaf3907(_0x2dc9e5[_0xe032('0x9')][_0xe032('0xb')]);}return _0xd84027(_0x2dc9e5[_0xe032('0x9')][_0xe032('0xb')]);}else{_0xd84027(_0x2dc9e5[_0xe032('0xc')]);}})[_0xe032('0xd')](function(_0x5bcb5b){_0xaf3907(_0x5bcb5b);});});}function respondWithResult(_0x646979,_0x266d71){_0x266d71=_0x266d71||0xc8;return function(_0x28c2b6){if(_0x28c2b6){return _0x646979[_0xe032('0xe')](_0x266d71)['json'](_0x28c2b6);}return _0x646979[_0xe032('0xf')](0x194);};}function handleError(_0x2e267b,_0x176547){_0x176547=_0x176547||0x1f4;return function(_0x422e96){logger[_0xe032('0x9')](_0x422e96[_0xe032('0x10')]);if(_0x422e96[_0xe032('0x11')]){delete _0x422e96['name'];}_0x2e267b[_0xe032('0xe')](_0x176547)[_0xe032('0x12')](_0x422e96);};}function findById(_0x36fb7c){return function(_0x3b57d3){if(!_[_0xe032('0x13')](_0x36fb7c)&&!_[_0xe032('0x13')](_0x3b57d3)&&!_['isNil'](_0x3b57d3[_0xe032('0x14')])){return _[_0xe032('0x15')](_0x3b57d3[_0xe032('0x14')],function(_0x41d2a5){return _0x41d2a5['id']==_0x36fb7c;});}return null;};}exports[_0xe032('0x16')]=function(_0x5721ce,_0x4b644b){return respondWithRpcPromise('VoiceChannels',_0x5721ce[_0xe032('0x17')])['then'](respondWithResult(_0x4b644b,null))[_0xe032('0xd')](handleError(_0x4b644b,null));};exports[_0xe032('0x18')]=function(_0x3f0257,_0x2aa342){return respondWithRpcPromise(_0xe032('0x19'),_[_0xe032('0x1a')](_0x3f0257[_0xe032('0x17')],_0x3f0257['params']))[_0xe032('0x8')](respondWithResult(_0x2aa342,null))[_0xe032('0xd')](handleError(_0x2aa342,null));};exports[_0xe032('0x1b')]=function(_0x2be433,_0x2ca592){return respondWithRpcPromise(_0xe032('0x1c'),_[_0xe032('0x1a')](_0x2be433[_0xe032('0x17')],_0x2be433['params']))['then'](respondWithResult(_0x2ca592,null))['catch'](handleError(_0x2ca592,null));};exports[_0xe032('0x1d')]=function(_0x2568ce,_0x302559){return respondWithRpcPromise(_0xe032('0x1e'),_0x2568ce[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x302559,null))[_0xe032('0xd')](handleError(_0x302559,null));};exports[_0xe032('0x1f')]=function(_0x4dcbf1,_0x1ac20b){return respondWithRpcPromise('VoiceQueues',_0x4dcbf1[_0xe032('0x17')])[_0xe032('0x8')](findById(_0x4dcbf1[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x1ac20b,null))['catch'](handleError(_0x1ac20b,null));};exports['updateVoiceQueue']=function(_0x3e2575,_0x38e7ea){return respondWithRpcPromise(_0xe032('0x21'),_[_0xe032('0x1a')](_0x3e2575['body'],_0x3e2575['params']))['then'](respondWithResult(_0x38e7ea,null))[_0xe032('0xd')](handleError(_0x38e7ea,null));};exports[_0xe032('0x22')]=function(_0x5518ac,_0x707b){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xe032('0x1a')](_0x5518ac[_0xe032('0x17')],_0x5518ac[_0xe032('0x20')]))[_0xe032('0x8')](respondWithResult(_0x707b,null))[_0xe032('0xd')](handleError(_0x707b,null));};exports['voiceQueuesChannels']=function(_0xd90bd5,_0x33634c){return respondWithRpcPromise(_0xe032('0x23'),_0xd90bd5[_0xe032('0x17')])['then'](respondWithResult(_0x33634c,null))[_0xe032('0xd')](handleError(_0x33634c,null));};exports['voiceQueuesChannel']=function(_0x2f3e59,_0x53df28){return respondWithRpcPromise(_0xe032('0x24'),_['merge'](_0x2f3e59[_0xe032('0x17')],_0x2f3e59['params']))[_0xe032('0x8')](respondWithResult(_0x53df28,null))[_0xe032('0xd')](handleError(_0x53df28,null));};exports['voiceQueuesChannelHangup']=function(_0x3e3598,_0x2fdf41){return respondWithRpcPromise(_0xe032('0x25'),_[_0xe032('0x1a')](_0x3e3598['query'],_0x3e3598[_0xe032('0x20')]))['then'](respondWithResult(_0x2fdf41,null))[_0xe032('0xd')](handleError(_0x2fdf41,null));};exports[_0xe032('0x26')]=function(_0x5d02c1,_0x450ba4){return respondWithRpcPromise(_0xe032('0x27'),_['merge'](_0x5d02c1[_0xe032('0x17')],_0x5d02c1[_0xe032('0x20')]))[_0xe032('0x8')](respondWithResult(_0x450ba4,null))[_0xe032('0xd')](handleError(_0x450ba4,null));};exports[_0xe032('0x28')]=function(_0x42f58a,_0x19ee0a){return respondWithRpcPromise(_0xe032('0x29'),_0x42f58a[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x19ee0a,null))[_0xe032('0xd')](handleError(_0x19ee0a,null));};exports[_0xe032('0x2a')]=function(_0x30571c,_0x28ba5d){return respondWithRpcPromise(_0xe032('0x2b'),_0x30571c[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x28ba5d,null))['catch'](handleError(_0x28ba5d,null));};exports[_0xe032('0x2c')]=function(_0x536c76,_0x3d02c1){var _0x2bcfb4;return respondWithRpcPromise(_0xe032('0x2d'),_0x536c76[_0xe032('0x17')])[_0xe032('0x8')](function(_0x5eccad){_0x2bcfb4=_0x5eccad;return respondWithRpcPromise(_0xe032('0x2d'),_0x536c76['query'],routingClient);})[_0xe032('0x8')](function(_0x590be2){return _[_0xe032('0x1a')]({},_0x590be2,_0x2bcfb4);})[_0xe032('0x8')](respondWithResult(_0x3d02c1,null))[_0xe032('0xd')](handleError(_0x3d02c1,null));};exports[_0xe032('0x2e')]=function(_0x4dc836,_0x477360){if(_0x4dc836['body']&&_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')]&&_0x4dc836[_0xe032('0x31')]&&_0x4dc836[_0xe032('0x31')]['name']){for(var _0x513b0c in _0x4dc836[_0xe032('0x2f')][_0xe032('0x30')]){if(_0x4dc836['body'][_0xe032('0x30')][_0xe032('0x32')](_0x513b0c)){db[_0xe032('0x33')][_0xe032('0x34')]({'where':{'channel':_0x513b0c,'membername':_0x4dc836[_0xe032('0x31')]['name'],'type':_0xe032('0x35'),'exitAt':null,'uniqueid':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c]&&_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0xe032('0x36')]?{'$notIn':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c]}:{'$ne':null}}})['then'](function(_0x535f34){var _0x1b0e28=moment()['format'](_0xe032('0x37'));for(var _0x277207=0x0,_0x1873a6=_0x535f34[_0xe032('0x36')];_0x277207<_0x1873a6;_0x277207+=0x1){_0x535f34[_0x277207][_0xe032('0x38')]({'exitAt':_0x1b0e28});}});for(var _0x3dfb51=0x0;_0x3dfb51<_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0xe032('0x36')];_0x3dfb51+=0x1){db['MemberReport'][_0xe032('0x39')]({'where':{'channel':_0x513b0c,'membername':_0x4dc836['user']['name'],'type':_0xe032('0x35'),'uniqueid':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0x3dfb51],'exitAt':null},'defaults':{'channel':_0x513b0c,'membername':_0x4dc836[_0xe032('0x31')]['name'],'interface':_[_0xe032('0x13')](_0x4dc836[_0xe032('0x31')][_0xe032('0x3a')])?util[_0xe032('0x3b')](_0xe032('0x3c'),_0x4dc836[_0xe032('0x31')][_0xe032('0x11')]):_0x4dc836['user'][_0xe032('0x3a')],'type':_0xe032('0x35'),'enterAt':moment()['format'](_0xe032('0x37')),'role':_0xe032('0x3d'),'internal':_0x4dc836[_0xe032('0x31')][_0xe032('0x3e')],'uniqueid':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0x3dfb51]}});}}}}return respondWithRpcPromise(_0xe032('0x3f'),{'id':_0x4dc836[_0xe032('0x20')]['id'],'capacity':_0x4dc836[_0xe032('0x2f')][_0xe032('0x40')]},routingClient)[_0xe032('0x8')](respondWithResult(_0x477360,null))[_0xe032('0xd')](handleError(_0x477360,null));};exports[_0xe032('0x41')]=function(_0x2f8114,_0x4eabfc){return respondWithRpcPromise(_0xe032('0x42'),_0x2f8114['query'])[_0xe032('0x8')](respondWithResult(_0x4eabfc,null))[_0xe032('0xd')](handleError(_0x4eabfc,null));};exports[_0xe032('0x43')]=function(_0x11ae58,_0x41289d){return respondWithRpcPromise(_0xe032('0x44'),_0x11ae58[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x41289d,null))[_0xe032('0xd')](handleError(_0x41289d,null));};exports[_0xe032('0x45')]=function(_0x1b9012,_0x564fe0){return respondWithRpcPromise(_0xe032('0x46'),_0x1b9012[_0xe032('0x17')])['then'](respondWithResult(_0x564fe0,null))[_0xe032('0xd')](handleError(_0x564fe0,null));};exports['chatQueues']=function(_0x39b878,_0x1f2422){return respondWithRpcPromise(_0xe032('0x47'),_0x39b878[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x1f2422,null))['catch'](handleError(_0x1f2422,null));};exports[_0xe032('0x48')]=function(_0x2dbc33,_0x1e1277){return respondWithRpcPromise(_0xe032('0x47'),_0x2dbc33[_0xe032('0x17')],routingClient)[_0xe032('0x8')](findById(_0x2dbc33[_0xe032('0x20')]['id']))['then'](respondWithResult(_0x1e1277,null))[_0xe032('0xd')](handleError(_0x1e1277,null));};exports[_0xe032('0x49')]=function(_0x454b29,_0x15325e){return respondWithRpcPromise(_0xe032('0x4a'),_0x454b29[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x15325e,null))[_0xe032('0xd')](handleError(_0x15325e,null));};exports[_0xe032('0x4b')]=function(_0x54c0b0,_0x795a58){return respondWithRpcPromise(_0xe032('0x4a'),_0x54c0b0[_0xe032('0x17')],routingClient)['then'](findById(_0x54c0b0[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x795a58,null))['catch'](handleError(_0x795a58,null));};exports[_0xe032('0x4c')]=function(_0x29dfa7,_0x43ad0d){return respondWithRpcPromise(_0xe032('0x4d'),_0x29dfa7[_0xe032('0x17')],mailClient)[_0xe032('0x8')](respondWithResult(_0x43ad0d,null))[_0xe032('0xd')](handleError(_0x43ad0d,null));};exports[_0xe032('0x4e')]=function(_0x1aa18e,_0x19ce2b){return respondWithRpcPromise(_0xe032('0x4f'),_0x1aa18e['query'],routingClient)[_0xe032('0x8')](respondWithResult(_0x19ce2b,null))[_0xe032('0xd')](handleError(_0x19ce2b,null));};exports[_0xe032('0x50')]=function(_0xd5cf55,_0x3d7a3f){return respondWithRpcPromise('OpenchannelQueues',_0xd5cf55[_0xe032('0x17')],routingClient)['then'](findById(_0xd5cf55[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x3d7a3f,null))[_0xe032('0xd')](handleError(_0x3d7a3f,null));};exports[_0xe032('0x51')]=function(_0x3c5eb8,_0x1ddb11){return respondWithRpcPromise(_0xe032('0x52'),_0x3c5eb8[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x1ddb11,null))['catch'](handleError(_0x1ddb11,null));};exports['showSmsQueues']=function(_0x5c516a,_0x221473){return respondWithRpcPromise(_0xe032('0x52'),_0x5c516a[_0xe032('0x17')],routingClient)[_0xe032('0x8')](findById(_0x5c516a[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x221473,null))['catch'](handleError(_0x221473,null));};exports[_0xe032('0x53')]=function(_0x1d66c3,_0x1018d4){return respondWithRpcPromise('WhatsappQueues',_0x1d66c3[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x1018d4,null))[_0xe032('0xd')](handleError(_0x1018d4,null));};exports[_0xe032('0x54')]=function(_0x48063d,_0x590905){return respondWithRpcPromise('WhatsappQueues',_0x48063d[_0xe032('0x17')],routingClient)['then'](findById(_0x48063d['params']['id']))[_0xe032('0x8')](respondWithResult(_0x590905,null))[_0xe032('0xd')](handleError(_0x590905,null));};exports[_0xe032('0x55')]=function(_0x4ed078,_0x193a0f){return respondWithRpcPromise('FaxQueues',_0x4ed078[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x193a0f,null))[_0xe032('0xd')](handleError(_0x193a0f,null));};exports[_0xe032('0x56')]=function(_0x1f24ec,_0x2b987b){return respondWithRpcPromise(_0xe032('0x57'),_0x1f24ec[_0xe032('0x17')],routingClient)[_0xe032('0x8')](findById(_0x1f24ec[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x2b987b,null))['catch'](handleError(_0x2b987b,null));};exports[_0xe032('0x58')]=function(_0x338ef2,_0x5aa7a6){return respondWithRpcPromise('FaxAccounts',_0x338ef2[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x5aa7a6,null))[_0xe032('0xd')](handleError(_0x5aa7a6,null));};exports[_0xe032('0x59')]=function(_0x1e38bd,_0x23922e){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x1e38bd[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x23922e,null))['catch'](handleError(_0x23922e,null));};exports[_0xe032('0x5a')]=function(_0x2ea4a5,_0x1c3601){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2ea4a5[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x1c3601,null))[_0xe032('0xd')](handleError(_0x1c3601,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x52dfa0,_0xdd691c){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x52dfa0[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0xdd691c,null))[_0xe032('0xd')](handleError(_0xdd691c,null));};exports[_0xe032('0x5b')]=function(_0x37af62,_0x443fcc){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x37af62[_0xe032('0x17')],routingClient)[_0xe032('0x8')](function(_0x33e7c3){if(_0x37af62['query'][_0xe032('0x5c')]!==undefined){var _0x48e9c9=_(_0x33e7c3[_0xe032('0x14')])['filter']([_0x37af62[_0xe032('0x17')][_0xe032('0x5c')],_0x37af62[_0xe032('0x20')]['id']])['map'](_0xe032('0x5d'))[_0xe032('0x5e')]()[_0xe032('0x5f')]();return _0x33e7c3[_0xe032('0x14')][_0xe032('0x60')](function(_0x2a2c98){return _0x48e9c9['indexOf'](_0x2a2c98[_0xe032('0x5d')])>-0x1;});}else{return _0x33e7c3[_0xe032('0x14')]['filter'](function(_0x50fd01){return _0x50fd01[_0xe032('0x5d')]===parseInt(_0x37af62[_0xe032('0x20')]['id']);});}})[_0xe032('0x8')](respondWithResult(_0x443fcc,null))[_0xe032('0xd')](handleError(_0x443fcc,null));};exports[_0xe032('0x61')]=function(_0x54803e,_0x3a04b9){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x54803e[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x3a04b9,null))[_0xe032('0xd')](handleError(_0x3a04b9,null));};exports[_0xe032('0x62')]=function(_0x36137b,_0x2ecdc7){return respondWithRpcPromise(_0xe032('0x63'),_0x36137b[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x2ecdc7,null))[_0xe032('0xd')](handleError(_0x2ecdc7,null));};exports['faxQueuesWaitingInteractions']=function(_0x4ee54a,_0x485458){return respondWithRpcPromise(_0xe032('0x64'),_0x4ee54a[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x485458,null))[_0xe032('0xd')](handleError(_0x485458,null));};exports['queueNotify']=function(_0x5f42b1){return function(_0x2f2b74,_0x10873b){var _0x577f56,_0x4ab179;var _0x45e28d=_[_0xe032('0x65')](_0x5f42b1);var _0x51d89a=_0x5f42b1===_0xe032('0x66')?_0xe032('0x67'):_0xe032('0x68');return db[_0x45e28d+_0xe032('0x69')]['findOne']({'raw':!![],'where':{'id':_0x2f2b74[_0xe032('0x20')]['id']}})['then'](function(_0x1caebf){if(_[_0xe032('0x13')](_0x1caebf)){throw new Error(_0x45e28d+_0xe032('0x6a'));}_0x577f56=_0x1caebf;return db[_0x45e28d+'Message'][_0xe032('0x6b')]({'where':{'id':_0x2f2b74[_0xe032('0x2f')]['messageId']},'include':[{'model':db[_0x45e28d+_0xe032('0x6c')],'as':_0xe032('0x6c')},{'model':db[_0x45e28d+_0x51d89a],'as':_0xe032('0x68')}]});})[_0xe032('0x8')](function(_0x3c1b08){if(_[_0xe032('0x13')](_0x3c1b08)){throw new Error(_0x45e28d+'\x20Message\x20not\x20found');}_0x4ab179=_0x3c1b08;return _0x3c1b08[_0xe032('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe032('0x8')](function(){var _0x27eb0c={'uniqueid':_0x5f42b1+'.'+_0x4ab179['id']+'.'+_0x4ab179[_0xe032('0x6c')]['id'],'FromUserId':_0x2f2b74[_0xe032('0x31')]['id'],'type':_0xe032('0x6e')};_0x27eb0c[_0x45e28d+_0xe032('0x6f')]=_0x4ab179['id'];_0x27eb0c[_0x45e28d+_0xe032('0x70')]=_0x4ab179[_0xe032('0x6c')]['id'];_0x27eb0c[_0xe032('0x71')+_0x45e28d+_0x51d89a+'Id']=_0x4ab179[_0xe032('0x68')]['id'];_0x27eb0c['To'+_0x45e28d+'QueueId']=_0x577f56['id'];return db[_0x45e28d+_0xe032('0x72')]['create'](_0x27eb0c);})[_0xe032('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x5f42b1,'interaction':_0x4ab179[_0xe032('0x6c')],'message':_0x4ab179,'account':_0x4ab179[_0xe032('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x577f56[_0xe032('0x11')]+','+(_0x4ab179['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe032('0x8')](respondWithResult(_0x10873b,null))[_0xe032('0xd')](handleError(_0x10873b,null));};};exports[_0xe032('0x73')]=function(_0x4e9f83,_0x210e7a){var _0x2e6dad,_0x2d68aa;if(_['isNil'](_0x4e9f83[_0xe032('0x2f')]['channel'])){throw new Error(_0xe032('0x74'));}var _0x868fad=_0x4e9f83[_0xe032('0x2f')][_0xe032('0x75')];var _0x3ee725=_[_0xe032('0x65')](_0x868fad);var _0x205058=_0x868fad===_0xe032('0x66')?_0xe032('0x67'):_0xe032('0x68');return db['User']['findOne']({'raw':!![],'where':{'id':_0x4e9f83[_0xe032('0x20')]['id'],'role':_0xe032('0x3d')}})[_0xe032('0x8')](function(_0x1d9498){if(_['isNil'](_0x1d9498)){throw new Error(_0xe032('0x76'));}_0x2e6dad=_0x1d9498;return db[_0x3ee725+_0xe032('0x77')][_0xe032('0x6b')]({'where':{'id':_0x4e9f83[_0xe032('0x2f')]['messageId']},'include':[{'model':db[_0x3ee725+_0xe032('0x6c')],'as':_0xe032('0x6c')},{'model':db[_0x3ee725+_0x205058],'as':_0xe032('0x68')}]});})[_0xe032('0x8')](function(_0x3cf0bc){if(_[_0xe032('0x13')](_0x3cf0bc)){throw new Error(_0x3ee725+_0xe032('0x78'));}_0x2d68aa=_0x3cf0bc;return _0x3cf0bc['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x56523f={'uniqueid':_0x868fad+'.'+_0x2d68aa['id']+'.'+_0x2d68aa['Interaction']['id'],'FromUserId':_0x4e9f83['user']['id'],'type':_0xe032('0x6e'),'ToUserId':_0x2e6dad['id']};_0x56523f[_0x3ee725+_0xe032('0x6f')]=_0x2d68aa['id'];_0x56523f[_0x3ee725+_0xe032('0x70')]=_0x2d68aa[_0xe032('0x6c')]['id'];_0x56523f[_0xe032('0x71')+_0x3ee725+_0x205058+'Id']=_0x2d68aa['Account']['id'];return db[_0x3ee725+_0xe032('0x72')][_0xe032('0x79')](_0x56523f);})[_0xe032('0x8')](function(){return respondWithRpcPromise(_0xe032('0x7a'),{'channel':_0x868fad,'interaction':_0x2d68aa[_0xe032('0x6c')],'message':_0x2d68aa,'account':_0x2d68aa[_0xe032('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe032('0x3d'),'appdata':_0x2e6dad[_0xe032('0x11')]+','+(_0x2d68aa[_0xe032('0x68')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x210e7a,null))[_0xe032('0xd')](handleError(_0x210e7a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a186887..bcdf31c 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 _0xa940=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','/:id/run','run','create','exports','multer'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa940,0x1d0));var _0x0a94=function(_0x4cb312,_0x4c28cd){_0x4cb312=_0x4cb312-0x0;var _0x2d48d9=_0xa940[_0x4cb312];return _0x2d48d9;};'use strict';var multer=require(_0x0a94('0x0'));var util=require('util');var path=require(_0x0a94('0x1'));var timeout=require(_0x0a94('0x2'));var express=require(_0x0a94('0x3'));var router=express['Router']();var fs_extra=require(_0x0a94('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a94('0x5'));var config=require(_0x0a94('0x6'));var controller=require(_0x0a94('0x7'));router[_0x0a94('0x8')]('/',auth[_0x0a94('0x9')](),controller['index']);router[_0x0a94('0x8')](_0x0a94('0xa'),auth[_0x0a94('0x9')](),controller['show']);router[_0x0a94('0x8')](_0x0a94('0xb'),auth[_0x0a94('0x9')](),controller[_0x0a94('0xc')]);router['post']('/',auth[_0x0a94('0x9')](),controller[_0x0a94('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0a94('0xe')]=router; \ No newline at end of file +var _0xde4f=['/:id/run','post','create','put','update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x34179f,_0x2def62){var _0xa31230=function(_0x2c4aee){while(--_0x2c4aee){_0x34179f['push'](_0x34179f['shift']());}};_0xa31230(++_0x2def62);}(_0xde4f,0xbb));var _0xfde4=function(_0x5e00d8,_0x5c5e9e){_0x5e00d8=_0x5e00d8-0x0;var _0x4ceaf7=_0xde4f[_0x5e00d8];return _0x4ceaf7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfde4('0x0'));var timeout=require('connect-timeout');var express=require(_0xfde4('0x1'));var router=express[_0xfde4('0x2')]();var fs_extra=require(_0xfde4('0x3'));var auth=require(_0xfde4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfde4('0x5'));var controller=require('./schedule.controller');router[_0xfde4('0x6')]('/',auth[_0xfde4('0x7')](),controller[_0xfde4('0x8')]);router[_0xfde4('0x6')](_0xfde4('0x9'),auth['isAuthenticated'](),controller[_0xfde4('0xa')]);router[_0xfde4('0x6')](_0xfde4('0xb'),auth[_0xfde4('0x7')](),controller['run']);router[_0xfde4('0xc')]('/',auth[_0xfde4('0x7')](),controller[_0xfde4('0xd')]);router[_0xfde4('0xe')]('/:id',auth[_0xfde4('0x7')](),controller[_0xfde4('0xf')]);router['delete'](_0xfde4('0x9'),auth[_0xfde4('0x7')](),controller[_0xfde4('0x10')]);module[_0xfde4('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e6807f4..18f5a2d 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 _0xed52=['days','csv','xlsx','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours'];(function(_0x54aa90,_0x34d0db){var _0x39cc24=function(_0x1a50db){while(--_0x1a50db){_0x54aa90['push'](_0x54aa90['shift']());}};_0x39cc24(++_0x34d0db);}(_0xed52,0x15b));var _0x2ed5=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xed52[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require(_0x2ed5('0x0'));module[_0x2ed5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2ed5('0x2')]},'active':{'type':Sequelize[_0x2ed5('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2ed5('0x2')],'allowNull':![],'defaultValue':_0x2ed5('0x4')},'startAt':{'type':Sequelize[_0x2ed5('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2ed5('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2ed5('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2ed5('0x7')](_0x2ed5('0x8'),_0x2ed5('0x9'),_0x2ed5('0xa'),_0x2ed5('0xb'),'days',_0x2ed5('0xc'),'minutes'),'allowNull':![],'defaultValue':_0x2ed5('0xd')},'output':{'type':Sequelize[_0x2ed5('0x7')](_0x2ed5('0xe'),'pdf',_0x2ed5('0xf')),'allowNull':![],'defaultValue':_0x2ed5('0xe')},'type':{'type':Sequelize[_0x2ed5('0x7')]('custom',_0x2ed5('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x2ed5('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2ed5('0x2')]},'cc':{'type':Sequelize[_0x2ed5('0x11')]},'bcc':{'type':Sequelize[_0x2ed5('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x2ed5('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x95d6=['hours','pdf','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','quarters','months'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x95d6,0xe6));var _0x695d=function(_0x2f7892,_0x1c26c5){_0x2f7892=_0x2f7892-0x0;var _0x2f9e9c=_0x95d6[_0x2f7892];return _0x2f9e9c;};'use strict';var Sequelize=require(_0x695d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x695d('0x1')]},'active':{'type':Sequelize[_0x695d('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x695d('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x695d('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x695d('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x695d('0x5')]('years',_0x695d('0x6'),_0x695d('0x7'),'weeks','days',_0x695d('0x8'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x695d('0x5')]('csv',_0x695d('0x9'),_0x695d('0xa')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x695d('0x5')](_0x695d('0xb'),_0x695d('0xc')),'allowNull':![],'defaultValue':_0x695d('0xb')},'sendMail':{'type':Sequelize[_0x695d('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x695d('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x695d('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x695d('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index fde3365..9ef08cc 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 _0x6730=['body','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','keys','find','catch','create'];(function(_0x5769e3,_0x4410ee){var _0x3b5026=function(_0x3ee7ff){while(--_0x3ee7ff){_0x5769e3['push'](_0x5769e3['shift']());}};_0x3b5026(++_0x4410ee);}(_0x6730,0x106));var _0x0673=function(_0x2bef19,_0x40b26b){_0x2bef19=_0x2bef19-0x0;var _0x1521e7=_0x6730[_0x2bef19];return _0x1521e7;};'use strict';var emlformat=require(_0x0673('0x0'));var rimraf=require(_0x0673('0x1'));var zipdir=require(_0x0673('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0673('0x3'));var BPromise=require(_0x0673('0x4'));var Mustache=require('mustache');var util=require(_0x0673('0x5'));var path=require(_0x0673('0x6'));var sox=require(_0x0673('0x7'));var csv=require(_0x0673('0x8'));var ejs=require(_0x0673('0x9'));var fs=require('fs');var fs_extra=require(_0x0673('0xa'));var _=require('lodash');var squel=require(_0x0673('0xb'));var crypto=require(_0x0673('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0673('0xd'));var toCsv=require(_0x0673('0x8'));var querystring=require(_0x0673('0xe'));var Papa=require(_0x0673('0xf'));var Redis=require(_0x0673('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0673('0x11'));var as=require(_0x0673('0x12'));var hardwareService=require(_0x0673('0x13'));var logger=require('../../config/logger')(_0x0673('0x14'));var utils=require(_0x0673('0x15'));var config=require(_0x0673('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0673('0x17'))['db'];function respondWithStatusCode(_0x1ce639,_0x46e909){_0x46e909=_0x46e909||0xcc;return function(_0xe824e4){if(_0xe824e4){return _0x1ce639[_0x0673('0x18')](_0x46e909);}return _0x1ce639['status'](_0x46e909)[_0x0673('0x19')]();};}function respondWithResult(_0x3ea410,_0x324443){_0x324443=_0x324443||0xc8;return function(_0x5886d7){if(_0x5886d7){return _0x3ea410[_0x0673('0x1a')](_0x324443)[_0x0673('0x1b')](_0x5886d7);}};}function respondWithFilteredResult(_0x5776cc,_0x573df7){return function(_0x17b48c){if(_0x17b48c){var _0x4c42ca=typeof _0x573df7[_0x0673('0x1c')]===_0x0673('0x1d')&&typeof _0x573df7['limit']===_0x0673('0x1d');var _0x1f84ad=_0x17b48c[_0x0673('0x1e')];var _0x59fd7a=_0x4c42ca?0x0:_0x573df7['offset'];var _0x4de8da=_0x4c42ca?_0x17b48c[_0x0673('0x1e')]:_0x573df7[_0x0673('0x1c')]+_0x573df7[_0x0673('0x1f')];var _0x4f17e6;if(_0x4de8da>=_0x1f84ad){_0x4de8da=_0x1f84ad;_0x4f17e6=0xc8;}else{_0x4f17e6=0xce;}_0x5776cc[_0x0673('0x1a')](_0x4f17e6);return _0x5776cc['set'](_0x0673('0x20'),_0x59fd7a+'-'+_0x4de8da+'/'+_0x1f84ad)['json'](_0x17b48c);}return null;};}function patchUpdates(_0x5876c6){return function(_0x531ab2){try{jsonpatch[_0x0673('0x21')](_0x531ab2,_0x5876c6,!![]);}catch(_0x288e3d){return BPromise[_0x0673('0x22')](_0x288e3d);}return _0x531ab2['save']();};}function saveUpdates(_0x4cebda,_0x11d99f){return function(_0x4cb9d5){if(_0x4cb9d5){return _0x4cb9d5[_0x0673('0x23')](_0x4cebda)[_0x0673('0x24')](function(_0x58b311){return _0x58b311;});}return null;};}function removeEntity(_0xc4b2b4,_0x407e73){return function(_0x5ac3fd){if(_0x5ac3fd){return _0x5ac3fd[_0x0673('0x25')]()[_0x0673('0x24')](function(){var _0x18b8f3=_0x5ac3fd[_0x0673('0x26')]({'plain':!![]});var _0x199ae1='Scheduler';return db[_0x0673('0x27')]['destroy']({'where':{'type':_0x199ae1,'resourceId':_0x18b8f3['id']}})['then'](function(){return _0x5ac3fd;});})[_0x0673('0x24')](function(){_0xc4b2b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8a6c89,_0x2b309e){return function(_0x52abda){if(!_0x52abda){_0x8a6c89['sendStatus'](0x194);}return _0x52abda;};}function handleError(_0x36c669,_0x424e8f){_0x424e8f=_0x424e8f||0x1f4;return function(_0x1e2145){logger['error'](_0x1e2145[_0x0673('0x28')]);if(_0x1e2145[_0x0673('0x29')]){delete _0x1e2145['name'];}_0x36c669['status'](_0x424e8f)[_0x0673('0x2a')](_0x1e2145);};}exports[_0x0673('0x2b')]=function(_0x102c59,_0x271b77){var _0x1506de={},_0x5715a5={},_0x57f0c9={'count':0x0,'rows':[]};var _0x278a7f=_[_0x0673('0x2c')](db[_0x0673('0x2d')][_0x0673('0x2e')],function(_0x4e9d50){return{'name':_0x4e9d50[_0x0673('0x2f')],'type':_0x4e9d50[_0x0673('0x30')][_0x0673('0x31')]};});_0x5715a5[_0x0673('0x32')]=_['map'](_0x278a7f,_0x0673('0x29'));_0x5715a5[_0x0673('0x33')]=_['keys'](_0x102c59[_0x0673('0x33')]);_0x5715a5[_0x0673('0x34')]=_['intersection'](_0x5715a5[_0x0673('0x32')],_0x5715a5[_0x0673('0x33')]);_0x1506de['attributes']=_[_0x0673('0x35')](_0x5715a5[_0x0673('0x32')],qs['fields'](_0x102c59[_0x0673('0x33')][_0x0673('0x36')]));_0x1506de[_0x0673('0x37')]=_0x1506de[_0x0673('0x37')][_0x0673('0x38')]?_0x1506de[_0x0673('0x37')]:_0x5715a5['model'];if(!_0x102c59[_0x0673('0x33')][_0x0673('0x39')](_0x0673('0x3a'))){_0x1506de[_0x0673('0x1f')]=qs[_0x0673('0x1f')](_0x102c59[_0x0673('0x33')][_0x0673('0x1f')]);_0x1506de[_0x0673('0x1c')]=qs[_0x0673('0x1c')](_0x102c59[_0x0673('0x33')][_0x0673('0x1c')]);}_0x1506de[_0x0673('0x3b')]=qs['sort'](_0x102c59[_0x0673('0x33')][_0x0673('0x3c')]);_0x1506de[_0x0673('0x3d')]=qs['filters'](_['pick'](_0x102c59[_0x0673('0x33')],_0x5715a5[_0x0673('0x34')]),_0x278a7f);if(_0x102c59[_0x0673('0x33')][_0x0673('0x3e')]){_0x1506de[_0x0673('0x3d')]=_[_0x0673('0x3f')](_0x1506de['where'],{'$or':_['map'](_0x278a7f,function(_0x50e734){if(_0x50e734[_0x0673('0x30')]!=='VIRTUAL'){var _0x280afd={};_0x280afd[_0x50e734['name']]={'$like':'%'+_0x102c59[_0x0673('0x33')][_0x0673('0x3e')]+'%'};return _0x280afd;}})});}_0x1506de=_[_0x0673('0x3f')]({},_0x1506de,_0x102c59[_0x0673('0x40')]);var _0x3bc4f9={'where':_0x1506de[_0x0673('0x3d')]};return db[_0x0673('0x2d')][_0x0673('0x1e')](_0x3bc4f9)['then'](function(_0x14aa35){_0x57f0c9[_0x0673('0x1e')]=_0x14aa35;if(_0x102c59['query'][_0x0673('0x41')]){_0x1506de[_0x0673('0x42')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x1506de);})[_0x0673('0x24')](function(_0x1a1ee2){_0x57f0c9[_0x0673('0x43')]=_0x1a1ee2;return _0x57f0c9;})[_0x0673('0x24')](respondWithFilteredResult(_0x271b77,_0x1506de))['catch'](handleError(_0x271b77,null));};exports[_0x0673('0x44')]=function(_0x2191f8,_0x394792){var _0xb31fef={'raw':![],'where':{'id':_0x2191f8[_0x0673('0x45')]['id']}},_0x24c78c={};_0x24c78c['model']=_['keys'](db[_0x0673('0x2d')][_0x0673('0x2e')]);_0x24c78c[_0x0673('0x33')]=_[_0x0673('0x46')](_0x2191f8[_0x0673('0x33')]);_0x24c78c[_0x0673('0x34')]=_[_0x0673('0x35')](_0x24c78c[_0x0673('0x32')],_0x24c78c[_0x0673('0x33')]);_0xb31fef[_0x0673('0x37')]=_[_0x0673('0x35')](_0x24c78c[_0x0673('0x32')],qs['fields'](_0x2191f8[_0x0673('0x33')][_0x0673('0x36')]));_0xb31fef['attributes']=_0xb31fef[_0x0673('0x37')]['length']?_0xb31fef['attributes']:_0x24c78c[_0x0673('0x32')];if(_0x2191f8[_0x0673('0x33')][_0x0673('0x41')]){_0xb31fef[_0x0673('0x42')]=[{'all':!![]}];}_0xb31fef=_[_0x0673('0x3f')]({},_0xb31fef,_0x2191f8[_0x0673('0x40')]);return db[_0x0673('0x2d')][_0x0673('0x47')](_0xb31fef)[_0x0673('0x24')](handleEntityNotFound(_0x394792,null))[_0x0673('0x24')](respondWithResult(_0x394792,null))[_0x0673('0x48')](handleError(_0x394792,null));};exports['create']=function(_0x4ffa73,_0x3d4612){return db[_0x0673('0x2d')][_0x0673('0x49')](_0x4ffa73[_0x0673('0x4a')],{})['then'](function(_0x5cdea3){var _0x4ed599=_0x4ffa73['user'][_0x0673('0x26')]({'plain':!![]});if(!_0x4ed599)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ed599[_0x0673('0x4b')]===_0x0673('0x4c')){var _0x1c538d=_0x5cdea3[_0x0673('0x26')]({'plain':!![]});var _0x2a3f1b='Scheduler';return db[_0x0673('0x4d')][_0x0673('0x47')]({'where':{'name':_0x2a3f1b,'userProfileId':_0x4ed599[_0x0673('0x4e')]},'raw':!![]})[_0x0673('0x24')](function(_0x13cdbf){if(_0x13cdbf&&_0x13cdbf[_0x0673('0x4f')]===0x0){return db['UserProfileResource'][_0x0673('0x49')]({'name':_0x1c538d[_0x0673('0x29')],'resourceId':_0x1c538d['id'],'type':_0x13cdbf[_0x0673('0x29')],'sectionId':_0x13cdbf['id']},{})[_0x0673('0x24')](function(){return _0x5cdea3;});}else{return _0x5cdea3;}})[_0x0673('0x48')](function(_0x4df224){logger[_0x0673('0x50')](_0x0673('0x51'),_0x4df224);throw _0x4df224;});}return _0x5cdea3;})[_0x0673('0x24')](respondWithResult(_0x3d4612,0xc9))[_0x0673('0x48')](handleError(_0x3d4612,null));};exports[_0x0673('0x23')]=function(_0x397da5,_0x414692){if(_0x397da5[_0x0673('0x4a')]['id']){delete _0x397da5[_0x0673('0x4a')]['id'];}return db[_0x0673('0x2d')][_0x0673('0x47')]({'where':{'id':_0x397da5[_0x0673('0x45')]['id']}})[_0x0673('0x24')](handleEntityNotFound(_0x414692,null))[_0x0673('0x24')](saveUpdates(_0x397da5[_0x0673('0x4a')],null))[_0x0673('0x24')](respondWithResult(_0x414692,null))[_0x0673('0x48')](handleError(_0x414692,null));};exports[_0x0673('0x25')]=function(_0x4782c8,_0x2e4a61){return db[_0x0673('0x2d')]['find']({'where':{'id':_0x4782c8[_0x0673('0x45')]['id']}})[_0x0673('0x24')](handleEntityNotFound(_0x2e4a61,null))[_0x0673('0x24')](removeEntity(_0x2e4a61,null))['catch'](handleError(_0x2e4a61,null));};exports['run']=function(_0x11f328,_0xefab52,_0x37bbfc){var _0x2d230b=require(_0x0673('0x52'));return db[_0x0673('0x2d')]['find']({'where':{'id':_0x11f328[_0x0673('0x45')]['id']},'raw':!![]})[_0x0673('0x24')](handleEntityNotFound(_0xefab52,null))[_0x0673('0x24')](function(){_0x2d230b[_0x0673('0x53')](_0x11f328['params']['id']);})[_0x0673('0x24')](respondWithStatusCode(_0xefab52,null))['catch'](handleError(_0xefab52,null));}; \ No newline at end of file +var _0x0bce=['offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Scheduler','UserProfileResource','sendStatus','stack','name','index','map','Schedule','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x0bce,0x1f4));var _0xe0bc=function(_0x1f8da0,_0xbb56b0){_0x1f8da0=_0x1f8da0-0x0;var _0x3c779c=_0x0bce[_0x1f8da0];return _0x3c779c;};'use strict';var emlformat=require(_0xe0bc('0x0'));var rimraf=require(_0xe0bc('0x1'));var zipdir=require(_0xe0bc('0x2'));var jsonpatch=require(_0xe0bc('0x3'));var rp=require(_0xe0bc('0x4'));var moment=require('moment');var BPromise=require(_0xe0bc('0x5'));var Mustache=require('mustache');var util=require(_0xe0bc('0x6'));var path=require(_0xe0bc('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(_0xe0bc('0x8'));var squel=require(_0xe0bc('0x9'));var crypto=require(_0xe0bc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe0bc('0xb'));var toCsv=require(_0xe0bc('0xc'));var querystring=require(_0xe0bc('0xd'));var Papa=require(_0xe0bc('0xe'));var Redis=require(_0xe0bc('0xf'));var authService=require(_0xe0bc('0x10'));var qs=require(_0xe0bc('0x11'));var as=require(_0xe0bc('0x12'));var hardwareService=require(_0xe0bc('0x13'));var logger=require(_0xe0bc('0x14'))(_0xe0bc('0x15'));var utils=require('../../config/utils');var config=require(_0xe0bc('0x16'));var licenseUtil=require(_0xe0bc('0x17'));var db=require(_0xe0bc('0x18'))['db'];function respondWithStatusCode(_0x4acd64,_0x40e384){_0x40e384=_0x40e384||0xcc;return function(_0x503abc){if(_0x503abc){return _0x4acd64['sendStatus'](_0x40e384);}return _0x4acd64['status'](_0x40e384)[_0xe0bc('0x19')]();};}function respondWithResult(_0x139069,_0x38ef73){_0x38ef73=_0x38ef73||0xc8;return function(_0x4494ab){if(_0x4494ab){return _0x139069[_0xe0bc('0x1a')](_0x38ef73)[_0xe0bc('0x1b')](_0x4494ab);}};}function respondWithFilteredResult(_0xefe1e0,_0x32b57e){return function(_0x20013a){if(_0x20013a){var _0x4e1cb4=typeof _0x32b57e[_0xe0bc('0x1c')]===_0xe0bc('0x1d')&&typeof _0x32b57e[_0xe0bc('0x1e')]==='undefined';var _0x3e6d13=_0x20013a[_0xe0bc('0x1f')];var _0x3c8ee2=_0x4e1cb4?0x0:_0x32b57e['offset'];var _0x25084c=_0x4e1cb4?_0x20013a[_0xe0bc('0x1f')]:_0x32b57e[_0xe0bc('0x1c')]+_0x32b57e[_0xe0bc('0x1e')];var _0x15fd42;if(_0x25084c>=_0x3e6d13){_0x25084c=_0x3e6d13;_0x15fd42=0xc8;}else{_0x15fd42=0xce;}_0xefe1e0['status'](_0x15fd42);return _0xefe1e0[_0xe0bc('0x20')](_0xe0bc('0x21'),_0x3c8ee2+'-'+_0x25084c+'/'+_0x3e6d13)['json'](_0x20013a);}return null;};}function patchUpdates(_0x38bbf0){return function(_0xbb98ca){try{jsonpatch[_0xe0bc('0x22')](_0xbb98ca,_0x38bbf0,!![]);}catch(_0x4218cd){return BPromise['reject'](_0x4218cd);}return _0xbb98ca[_0xe0bc('0x23')]();};}function saveUpdates(_0x436196,_0x308f6d){return function(_0x2185f0){if(_0x2185f0){return _0x2185f0[_0xe0bc('0x24')](_0x436196)[_0xe0bc('0x25')](function(_0x165eb9){return _0x165eb9;});}return null;};}function removeEntity(_0x2d61c8,_0x1f2454){return function(_0xc9b322){if(_0xc9b322){return _0xc9b322[_0xe0bc('0x26')]()[_0xe0bc('0x25')](function(){var _0x5dcc4e=_0xc9b322['get']({'plain':!![]});var _0x1f244e=_0xe0bc('0x27');return db[_0xe0bc('0x28')][_0xe0bc('0x26')]({'where':{'type':_0x1f244e,'resourceId':_0x5dcc4e['id']}})['then'](function(){return _0xc9b322;});})[_0xe0bc('0x25')](function(){_0x2d61c8[_0xe0bc('0x1a')](0xcc)[_0xe0bc('0x19')]();});}};}function handleEntityNotFound(_0x41fcc1,_0x39794c){return function(_0x411534){if(!_0x411534){_0x41fcc1[_0xe0bc('0x29')](0x194);}return _0x411534;};}function handleError(_0x290402,_0x2b8bf6){_0x2b8bf6=_0x2b8bf6||0x1f4;return function(_0x1655af){logger['error'](_0x1655af[_0xe0bc('0x2a')]);if(_0x1655af['name']){delete _0x1655af[_0xe0bc('0x2b')];}_0x290402[_0xe0bc('0x1a')](_0x2b8bf6)['send'](_0x1655af);};}exports[_0xe0bc('0x2c')]=function(_0x279df5,_0x388832){var _0x5f166b={},_0x4a8c3b={},_0x50eb70={'count':0x0,'rows':[]};var _0x2d2364=_[_0xe0bc('0x2d')](db[_0xe0bc('0x2e')][_0xe0bc('0x2f')],function(_0xd8eff6){return{'name':_0xd8eff6['fieldName'],'type':_0xd8eff6['type'][_0xe0bc('0x30')]};});_0x4a8c3b[_0xe0bc('0x31')]=_['map'](_0x2d2364,_0xe0bc('0x2b'));_0x4a8c3b[_0xe0bc('0x32')]=_[_0xe0bc('0x33')](_0x279df5[_0xe0bc('0x32')]);_0x4a8c3b['filters']=_[_0xe0bc('0x34')](_0x4a8c3b[_0xe0bc('0x31')],_0x4a8c3b[_0xe0bc('0x32')]);_0x5f166b[_0xe0bc('0x35')]=_[_0xe0bc('0x34')](_0x4a8c3b[_0xe0bc('0x31')],qs[_0xe0bc('0x36')](_0x279df5[_0xe0bc('0x32')]['fields']));_0x5f166b[_0xe0bc('0x35')]=_0x5f166b[_0xe0bc('0x35')][_0xe0bc('0x37')]?_0x5f166b[_0xe0bc('0x35')]:_0x4a8c3b[_0xe0bc('0x31')];if(!_0x279df5['query'][_0xe0bc('0x38')](_0xe0bc('0x39'))){_0x5f166b[_0xe0bc('0x1e')]=qs['limit'](_0x279df5[_0xe0bc('0x32')][_0xe0bc('0x1e')]);_0x5f166b[_0xe0bc('0x1c')]=qs['offset'](_0x279df5['query'][_0xe0bc('0x1c')]);}_0x5f166b[_0xe0bc('0x3a')]=qs[_0xe0bc('0x3b')](_0x279df5[_0xe0bc('0x32')][_0xe0bc('0x3b')]);_0x5f166b[_0xe0bc('0x3c')]=qs[_0xe0bc('0x3d')](_[_0xe0bc('0x3e')](_0x279df5['query'],_0x4a8c3b[_0xe0bc('0x3d')]),_0x2d2364);if(_0x279df5[_0xe0bc('0x32')][_0xe0bc('0x3f')]){_0x5f166b[_0xe0bc('0x3c')]=_[_0xe0bc('0x40')](_0x5f166b[_0xe0bc('0x3c')],{'$or':_['map'](_0x2d2364,function(_0x23bd27){if(_0x23bd27[_0xe0bc('0x41')]!==_0xe0bc('0x42')){var _0x38c4cf={};_0x38c4cf[_0x23bd27['name']]={'$like':'%'+_0x279df5[_0xe0bc('0x32')]['filter']+'%'};return _0x38c4cf;}})});}_0x5f166b=_[_0xe0bc('0x40')]({},_0x5f166b,_0x279df5[_0xe0bc('0x43')]);var _0x1d7a09={'where':_0x5f166b[_0xe0bc('0x3c')]};return db['Schedule'][_0xe0bc('0x1f')](_0x1d7a09)[_0xe0bc('0x25')](function(_0x11e199){_0x50eb70['count']=_0x11e199;if(_0x279df5[_0xe0bc('0x32')]['includeAll']){_0x5f166b[_0xe0bc('0x44')]=[{'all':!![]}];}return db[_0xe0bc('0x2e')][_0xe0bc('0x45')](_0x5f166b);})[_0xe0bc('0x25')](function(_0x5859ec){_0x50eb70[_0xe0bc('0x46')]=_0x5859ec;return _0x50eb70;})[_0xe0bc('0x25')](respondWithFilteredResult(_0x388832,_0x5f166b))[_0xe0bc('0x47')](handleError(_0x388832,null));};exports[_0xe0bc('0x48')]=function(_0x4741b5,_0x4a1c23){var _0xd97995={'raw':![],'where':{'id':_0x4741b5[_0xe0bc('0x49')]['id']}},_0x4ed99c={};_0x4ed99c[_0xe0bc('0x31')]=_[_0xe0bc('0x33')](db['Schedule']['rawAttributes']);_0x4ed99c[_0xe0bc('0x32')]=_['keys'](_0x4741b5[_0xe0bc('0x32')]);_0x4ed99c[_0xe0bc('0x3d')]=_[_0xe0bc('0x34')](_0x4ed99c['model'],_0x4ed99c[_0xe0bc('0x32')]);_0xd97995[_0xe0bc('0x35')]=_['intersection'](_0x4ed99c['model'],qs[_0xe0bc('0x36')](_0x4741b5[_0xe0bc('0x32')][_0xe0bc('0x36')]));_0xd97995[_0xe0bc('0x35')]=_0xd97995['attributes'][_0xe0bc('0x37')]?_0xd97995[_0xe0bc('0x35')]:_0x4ed99c[_0xe0bc('0x31')];if(_0x4741b5[_0xe0bc('0x32')][_0xe0bc('0x4a')]){_0xd97995[_0xe0bc('0x44')]=[{'all':!![]}];}_0xd97995=_[_0xe0bc('0x40')]({},_0xd97995,_0x4741b5[_0xe0bc('0x43')]);return db[_0xe0bc('0x2e')][_0xe0bc('0x4b')](_0xd97995)['then'](handleEntityNotFound(_0x4a1c23,null))[_0xe0bc('0x25')](respondWithResult(_0x4a1c23,null))['catch'](handleError(_0x4a1c23,null));};exports[_0xe0bc('0x4c')]=function(_0x442992,_0x47f937){return db[_0xe0bc('0x2e')]['create'](_0x442992[_0xe0bc('0x4d')],{})[_0xe0bc('0x25')](function(_0x175744){var _0x223a67=_0x442992[_0xe0bc('0x4e')][_0xe0bc('0x4f')]({'plain':!![]});if(!_0x223a67)throw new Error(_0xe0bc('0x50'));if(_0x223a67[_0xe0bc('0x51')]===_0xe0bc('0x4e')){var _0x2adc76=_0x175744[_0xe0bc('0x4f')]({'plain':!![]});var _0x2b4da9=_0xe0bc('0x27');return db[_0xe0bc('0x52')][_0xe0bc('0x4b')]({'where':{'name':_0x2b4da9,'userProfileId':_0x223a67[_0xe0bc('0x53')]},'raw':!![]})[_0xe0bc('0x25')](function(_0x48d477){if(_0x48d477&&_0x48d477[_0xe0bc('0x54')]===0x0){return db[_0xe0bc('0x28')][_0xe0bc('0x4c')]({'name':_0x2adc76[_0xe0bc('0x2b')],'resourceId':_0x2adc76['id'],'type':_0x48d477[_0xe0bc('0x2b')],'sectionId':_0x48d477['id']},{})['then'](function(){return _0x175744;});}else{return _0x175744;}})[_0xe0bc('0x47')](function(_0x22ab8a){logger[_0xe0bc('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22ab8a);throw _0x22ab8a;});}return _0x175744;})[_0xe0bc('0x25')](respondWithResult(_0x47f937,0xc9))[_0xe0bc('0x47')](handleError(_0x47f937,null));};exports[_0xe0bc('0x24')]=function(_0x3515dd,_0x1a800){if(_0x3515dd['body']['id']){delete _0x3515dd[_0xe0bc('0x4d')]['id'];}return db['Schedule'][_0xe0bc('0x4b')]({'where':{'id':_0x3515dd[_0xe0bc('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a800,null))[_0xe0bc('0x25')](saveUpdates(_0x3515dd[_0xe0bc('0x4d')],null))[_0xe0bc('0x25')](respondWithResult(_0x1a800,null))[_0xe0bc('0x47')](handleError(_0x1a800,null));};exports[_0xe0bc('0x26')]=function(_0x4698ac,_0x106820){return db[_0xe0bc('0x2e')][_0xe0bc('0x4b')]({'where':{'id':_0x4698ac[_0xe0bc('0x49')]['id']}})[_0xe0bc('0x25')](handleEntityNotFound(_0x106820,null))[_0xe0bc('0x25')](removeEntity(_0x106820,null))[_0xe0bc('0x47')](handleError(_0x106820,null));};exports[_0xe0bc('0x56')]=function(_0x55792f,_0x3d06ee,_0x21e852){var _0xbfb165=require(_0xe0bc('0x57'));return db['Schedule'][_0xe0bc('0x4b')]({'where':{'id':_0x55792f['params']['id']},'raw':!![]})[_0xe0bc('0x25')](handleEntityNotFound(_0x3d06ee,null))[_0xe0bc('0x25')](function(){_0xbfb165[_0xe0bc('0x56')](_0x55792f[_0xe0bc('0x49')]['id']);})[_0xe0bc('0x25')](respondWithStatusCode(_0x3d06ee,null))[_0xe0bc('0x47')](handleError(_0x3d06ee,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index f8e9c40..9a39511 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 _0x1ab4=['exports','tools_schedules','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x5e6fca,_0x540568){var _0x505941=function(_0x4c1d36){while(--_0x4c1d36){_0x5e6fca['push'](_0x5e6fca['shift']());}};_0x505941(++_0x540568);}(_0x1ab4,0x14c));var _0x41ab=function(_0x32506f,_0x373192){_0x32506f=_0x32506f-0x0;var _0x1e6b33=_0x1ab4[_0x32506f];return _0x1e6b33;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x41ab('0x0'))('api');var moment=require(_0x41ab('0x1'));var BPromise=require(_0x41ab('0x2'));var rp=require(_0x41ab('0x3'));var fs=require('fs');var path=require(_0x41ab('0x4'));var rimraf=require(_0x41ab('0x5'));var config=require(_0x41ab('0x6'));var attributes=require(_0x41ab('0x7'));module[_0x41ab('0x8')]=function(_0x16aa43,_0x2eff03){return _0x16aa43['define']('Schedule',attributes,{'tableName':_0x41ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89e6=['util','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','tools_schedules','lodash'];(function(_0x19b8b3,_0x17b4e5){var _0x136051=function(_0x1b52e0){while(--_0x1b52e0){_0x19b8b3['push'](_0x19b8b3['shift']());}};_0x136051(++_0x17b4e5);}(_0x89e6,0xdb));var _0x689e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x89e6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x689e('0x0'));var util=require(_0x689e('0x1'));var logger=require('../../config/logger')(_0x689e('0x2'));var moment=require(_0x689e('0x3'));var BPromise=require(_0x689e('0x4'));var rp=require(_0x689e('0x5'));var fs=require('fs');var path=require(_0x689e('0x6'));var rimraf=require(_0x689e('0x7'));var config=require('../../config/environment');var attributes=require(_0x689e('0x8'));module['exports']=function(_0xd73728,_0x11c703){return _0xd73728['define']('Schedule',attributes,{'tableName':_0x689e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 9425b1d..2a2b2fa 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 _0x6a79=['request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x437841,_0x587e32){var _0x3254b3=function(_0x299b12){while(--_0x299b12){_0x437841['push'](_0x437841['shift']());}};_0x3254b3(++_0x587e32);}(_0x6a79,0xa0));var _0x96a7=function(_0x2fff52,_0x1580ac){_0x2fff52=_0x2fff52-0x0;var _0x4fef52=_0x6a79[_0x2fff52];return _0x4fef52;};'use strict';var _=require(_0x96a7('0x0'));var util=require('util');var moment=require(_0x96a7('0x1'));var BPromise=require(_0x96a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96a7('0x3'));var db=require(_0x96a7('0x4'))['db'];var utils=require(_0x96a7('0x5'));var logger=require(_0x96a7('0x6'))(_0x96a7('0x7'));var config=require(_0x96a7('0x8'));var jayson=require(_0x96a7('0x9'));var client=jayson[_0x96a7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x178041,_0x52408e,_0x1259aa){return new BPromise(function(_0x4b2d95,_0x5f1c18){return client[_0x96a7('0xb')](_0x178041,_0x1259aa)[_0x96a7('0xc')](function(_0x1b17be){logger[_0x96a7('0xd')](_0x96a7('0xe'),_0x52408e,'request\x20sent');logger['debug'](_0x96a7('0xf'),_0x52408e,_0x96a7('0x10'),JSON[_0x96a7('0x11')](_0x1b17be));if(_0x1b17be['error']){if(_0x1b17be[_0x96a7('0x12')][_0x96a7('0x13')]===0x1f4){logger['error'](_0x96a7('0xe'),_0x52408e,_0x1b17be[_0x96a7('0x12')][_0x96a7('0x14')]);return _0x5f1c18(_0x1b17be['error'][_0x96a7('0x14')]);}logger[_0x96a7('0x12')]('Schedule,\x20%s,\x20%s',_0x52408e,_0x1b17be['error']['message']);return _0x4b2d95(_0x1b17be[_0x96a7('0x12')]['message']);}else{logger[_0x96a7('0xd')]('Schedule,\x20%s,\x20%s',_0x52408e,'request\x20sent');_0x4b2d95(_0x1b17be[_0x96a7('0x15')][_0x96a7('0x14')]);}})['catch'](function(_0x16dbb9){logger[_0x96a7('0x12')](_0x96a7('0xe'),_0x52408e,_0x16dbb9);_0x5f1c18(_0x16dbb9);});});} \ No newline at end of file +var _0x9b91=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1af7c3,_0x5cd4b5){var _0x302dd3=function(_0x279865){while(--_0x279865){_0x1af7c3['push'](_0x1af7c3['shift']());}};_0x302dd3(++_0x5cd4b5);}(_0x9b91,0x117));var _0x19b9=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0x9b91[_0x2067e9];return _0x280ce4;};'use strict';var _=require('lodash');var util=require(_0x19b9('0x0'));var moment=require(_0x19b9('0x1'));var BPromise=require(_0x19b9('0x2'));var rs=require(_0x19b9('0x3'));var fs=require('fs');var Redis=require(_0x19b9('0x4'));var db=require(_0x19b9('0x5'))['db'];var utils=require(_0x19b9('0x6'));var logger=require(_0x19b9('0x7'))(_0x19b9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x19b9('0x9')][_0x19b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44c6d2,_0x59e045,_0x22c647){return new BPromise(function(_0x5f509f,_0x26d3ec){return client[_0x19b9('0xb')](_0x44c6d2,_0x22c647)[_0x19b9('0xc')](function(_0x5b2d88){logger[_0x19b9('0xd')](_0x19b9('0xe'),_0x59e045,_0x19b9('0xf'));logger[_0x19b9('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x59e045,'request\x20sent',JSON[_0x19b9('0x11')](_0x5b2d88));if(_0x5b2d88[_0x19b9('0x12')]){if(_0x5b2d88[_0x19b9('0x12')][_0x19b9('0x13')]===0x1f4){logger[_0x19b9('0x12')](_0x19b9('0xe'),_0x59e045,_0x5b2d88[_0x19b9('0x12')][_0x19b9('0x14')]);return _0x26d3ec(_0x5b2d88[_0x19b9('0x12')][_0x19b9('0x14')]);}logger[_0x19b9('0x12')]('Schedule,\x20%s,\x20%s',_0x59e045,_0x5b2d88[_0x19b9('0x12')]['message']);return _0x5f509f(_0x5b2d88[_0x19b9('0x12')][_0x19b9('0x14')]);}else{logger['info'](_0x19b9('0xe'),_0x59e045,_0x19b9('0xf'));_0x5f509f(_0x5b2d88[_0x19b9('0x15')]['message']);}})[_0x19b9('0x16')](function(_0x14b39d){logger[_0x19b9('0x12')](_0x19b9('0xe'),_0x59e045,_0x14b39d);_0x26d3ec(_0x14b39d);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 5ff3d2c..9af2e91 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 _0x4628=['/describe','describe','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated'];(function(_0x5b3946,_0x23053c){var _0x2bd577=function(_0x406e40){while(--_0x406e40){_0x5b3946['push'](_0x5b3946['shift']());}};_0x2bd577(++_0x23053c);}(_0x4628,0x156));var _0x8462=function(_0x463454,_0x10857f){_0x463454=_0x463454-0x0;var _0x192b6a=_0x4628[_0x463454];return _0x192b6a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8462('0x0'));var timeout=require(_0x8462('0x1'));var express=require(_0x8462('0x2'));var router=express['Router']();var fs_extra=require(_0x8462('0x3'));var auth=require(_0x8462('0x4'));var interaction=require(_0x8462('0x5'));var config=require(_0x8462('0x6'));var controller=require(_0x8462('0x7'));router[_0x8462('0x8')]('/',auth[_0x8462('0x9')](),controller['index']);router[_0x8462('0x8')](_0x8462('0xa'),auth[_0x8462('0x9')](),controller[_0x8462('0xb')]);router[_0x8462('0x8')](_0x8462('0xc'),auth[_0x8462('0x9')](),controller[_0x8462('0xd')]);router[_0x8462('0x8')](_0x8462('0xe'),auth[_0x8462('0x9')](),controller[_0x8462('0xf')]);router['post']('/',auth[_0x8462('0x9')](),controller[_0x8462('0x10')]);router[_0x8462('0x11')](_0x8462('0xc'),auth[_0x8462('0x9')](),controller[_0x8462('0x12')]);router[_0x8462('0x13')](_0x8462('0xc'),auth['isAuthenticated'](),controller[_0x8462('0x14')]);module[_0x8462('0x15')]=router; \ No newline at end of file +var _0xf444=['post','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./screenRecording.controller','get','/describe','/:id','show','/:id/download','isAuthenticated'];(function(_0x11dbb9,_0x21f0fc){var _0x40fecc=function(_0x33f896){while(--_0x33f896){_0x11dbb9['push'](_0x11dbb9['shift']());}};_0x40fecc(++_0x21f0fc);}(_0xf444,0x15a));var _0x4f44=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0xf444[_0x6dd5c];return _0x5a87fa;};'use strict';var multer=require(_0x4f44('0x0'));var util=require(_0x4f44('0x1'));var path=require(_0x4f44('0x2'));var timeout=require(_0x4f44('0x3'));var express=require(_0x4f44('0x4'));var router=express[_0x4f44('0x5')]();var fs_extra=require(_0x4f44('0x6'));var auth=require(_0x4f44('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4f44('0x8'));router[_0x4f44('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4f44('0x9')](_0x4f44('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4f44('0xb'),auth['isAuthenticated'](),controller[_0x4f44('0xc')]);router[_0x4f44('0x9')](_0x4f44('0xd'),auth[_0x4f44('0xe')](),controller['download']);router[_0x4f44('0xf')]('/',auth[_0x4f44('0xe')](),controller['create']);router[_0x4f44('0x10')](_0x4f44('0xb'),auth[_0x4f44('0xe')](),controller[_0x4f44('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x4f44('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index a697c28..336ed25 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 _0x6b47=['createdAt','updatedAt','moment','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x25fff3,_0x57a414){var _0x510446=function(_0x5d3907){while(--_0x5d3907){_0x25fff3['push'](_0x25fff3['shift']());}};_0x510446(++_0x57a414);}(_0x6b47,0xe9));var _0x76b4=function(_0x4becb8,_0x4ad3d3){_0x4becb8=_0x4becb8-0x0;var _0x5c8a37=_0x6b47[_0x4becb8];return _0x5c8a37;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x76b4('0x0'));var path=require('path');var config=require(_0x76b4('0x1'));module[_0x76b4('0x2')]={'format':{'type':Sequelize[_0x76b4('0x3')],'get':function(){return this[_0x76b4('0x4')]('value')?path[_0x76b4('0x5')](this[_0x76b4('0x4')](_0x76b4('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x76b4('0x7')]},'channel':{'type':Sequelize[_0x76b4('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x461190){var _0x2a0690=_0x461190[_0x76b4('0x8')](/\\/g,'/');this[_0x76b4('0x9')](_0x76b4('0x6'),_0x2a0690);}},'rating':{'type':Sequelize[_0x76b4('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x76b4('0xa')],'set':function(_0x127be2){this[_0x76b4('0x9')](_0x76b4('0xb'),moment()[_0x76b4('0xc')](_0x127be2,'ms'));this[_0x76b4('0x9')](_0x76b4('0xd'),moment());this['setDataValue'](_0x76b4('0xe'),_0x127be2);}},'startedAt':{'type':Sequelize[_0x76b4('0xf')],'get':function(){return moment(this['getDataValue'](_0x76b4('0xb')))[_0x76b4('0x10')](_0x76b4('0x11'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x76b4('0x4')](_0x76b4('0xd')))[_0x76b4('0x10')](_0x76b4('0x11'))[_0x76b4('0x12')]();}},'createdAt':{'type':Sequelize[_0x76b4('0xf')],'get':function(){return moment(this[_0x76b4('0x4')](_0x76b4('0x13')))[_0x76b4('0x10')](_0x76b4('0x11'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x76b4('0x4')](_0x76b4('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0x76b4('0x12')]();}}}; \ No newline at end of file +var _0x672a=['exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','closedAt','sequelize','moment','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x672a,0x122));var _0xa672=function(_0x33d208,_0x280e78){_0x33d208=_0x33d208-0x0;var _0x41ad6a=_0x672a[_0x33d208];return _0x41ad6a;};'use strict';var Sequelize=require(_0xa672('0x0'));var moment=require(_0xa672('0x1'));var path=require(_0xa672('0x2'));var config=require(_0xa672('0x3'));module[_0xa672('0x4')]={'format':{'type':Sequelize[_0xa672('0x5')],'get':function(){return this[_0xa672('0x6')](_0xa672('0x7'))?path[_0xa672('0x8')](this[_0xa672('0x6')](_0xa672('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa672('0x9')]},'value':{'type':Sequelize[_0xa672('0x9')],'set':function(_0x3a4797){var _0x33dd0c=_0x3a4797[_0xa672('0xa')](/\\/g,'/');this[_0xa672('0xb')](_0xa672('0x7'),_0x33dd0c);}},'rating':{'type':Sequelize[_0xa672('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa672('0xc')],'set':function(_0x370f20){this[_0xa672('0xb')](_0xa672('0xd'),moment()[_0xa672('0xe')](_0x370f20,'ms'));this[_0xa672('0xb')]('closedAt',moment());this[_0xa672('0xb')](_0xa672('0xf'),_0x370f20);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa672('0x6')](_0xa672('0xd')))[_0xa672('0x10')](_0xa672('0x11'))[_0xa672('0x12')]();}},'closedAt':{'type':Sequelize[_0xa672('0x13')],'get':function(){return moment(this[_0xa672('0x6')](_0xa672('0x14')))[_0xa672('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xa672('0x12')]();}},'createdAt':{'type':Sequelize[_0xa672('0x13')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xa672('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa672('0x6')]('updatedAt'))['format'](_0xa672('0x11'))[_0xa672('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3432347..15fe699 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 _0xa41a=['unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','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','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','index','map','rawAttributes','type','key','differenceBy','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','params','include','find','catch','create','body','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','secrets','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname'];(function(_0x2aec1b,_0x50b92b){var _0x1def7b=function(_0x4303d3){while(--_0x4303d3){_0x2aec1b['push'](_0x2aec1b['shift']());}};_0x1def7b(++_0x50b92b);}(_0xa41a,0x6b));var _0xaa41=function(_0x3475b1,_0xdc1269){_0x3475b1=_0x3475b1-0x0;var _0x34b828=_0xa41a[_0x3475b1];return _0x34b828;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){_0x43a85c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16aec5,_0x527cac){return function(_0x493a10){if(!_0x493a10){_0x16aec5[_0xaa41('0x19')](0x194);}return _0x493a10;};}function handleError(_0x59707f,_0x536bed){_0x536bed=_0x536bed||0x1f4;return function(_0x2d0ac0){logger[_0xaa41('0x26')](_0x2d0ac0[_0xaa41('0x27')]);if(_0x2d0ac0[_0xaa41('0x28')]){delete _0x2d0ac0[_0xaa41('0x28')];}_0x59707f[_0xaa41('0x1a')](_0x536bed)['send'](_0x2d0ac0);};}exports[_0xaa41('0x29')]=function(_0x1f0275,_0x63c18c){var _0x9a16e3={},_0x1d8c2b={},_0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x2a')](db['ScreenRecording'][_0xaa41('0x2b')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x1d8c2b['model']=_[_0xaa41('0x2e')](_[_0xaa41('0x2a')](_0x30f88e,'name'),['format']);_0x1d8c2b['query']=_[_0xaa41('0x2f')](_0x1f0275[_0xaa41('0x30')]);_0x1d8c2b[_0xaa41('0x31')]=_[_0xaa41('0x32')](_0x1d8c2b['model'],_0x1d8c2b[_0xaa41('0x30')]);_0x9a16e3[_0xaa41('0x33')]=_[_0xaa41('0x32')](_0x1d8c2b['model'],qs[_0xaa41('0x34')](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x34')]));_0x9a16e3['attributes']=_0x9a16e3[_0xaa41('0x33')][_0xaa41('0x35')]?_0x9a16e3['attributes']:_0x1d8c2b[_0xaa41('0x36')];if(!_0x1f0275[_0xaa41('0x30')][_0xaa41('0x37')]('nolimit')){_0x9a16e3[_0xaa41('0x1e')]=qs['limit'](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x1e')]);_0x9a16e3[_0xaa41('0x20')]=qs['offset'](_0x1f0275['query']['offset']);}_0x9a16e3[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x39')]);_0x9a16e3['where']=qs['filters'](_[_0xaa41('0x3a')](_0x1f0275[_0xaa41('0x30')],_0x1d8c2b[_0xaa41('0x31')]),_0x30f88e);if(_0x1f0275[_0xaa41('0x30')][_0xaa41('0x3b')]){_0x9a16e3[_0xaa41('0x3c')]=_[_0xaa41('0x3d')](_0x9a16e3['where'],{'$or':_[_0xaa41('0x2a')](_0x30f88e,function(_0x5cf689){if(_0x5cf689[_0xaa41('0x2c')]!==_0xaa41('0x3e')){var _0x57f1bf={};_0x57f1bf[_0x5cf689['name']]={'$like':'%'+_0x1f0275[_0xaa41('0x30')][_0xaa41('0x3b')]+'%'};return _0x57f1bf;}})});}_0x9a16e3=_['merge']({},_0x9a16e3,_0x1f0275[_0xaa41('0x3f')]);var _0x563687={'where':_0x9a16e3[_0xaa41('0x3c')]};return db[_0xaa41('0x40')][_0xaa41('0x1f')](_0x563687)[_0xaa41('0x25')](function(_0x3e6cac){_0x4466a3[_0xaa41('0x1f')]=_0x3e6cac;if(_0x1f0275[_0xaa41('0x30')][_0xaa41('0x41')]){_0x9a16e3['include']=[{'all':!![]}];}return db[_0xaa41('0x40')][_0xaa41('0x42')](_0x9a16e3);})[_0xaa41('0x25')](function(_0x398c35){_0x4466a3[_0xaa41('0x43')]=_0x398c35;return _0x4466a3;})[_0xaa41('0x25')](respondWithFilteredResult(_0x63c18c,_0x9a16e3))['catch'](handleError(_0x63c18c,null));};exports['show']=function(_0x87e2f4,_0x4f9086){var _0x1ed366={'raw':![],'where':{'id':_0x87e2f4[_0xaa41('0x44')]['id']}},_0x215896={};_0x215896[_0xaa41('0x36')]=_[_0xaa41('0x2f')](db[_0xaa41('0x40')][_0xaa41('0x2b')]);_0x215896['query']=_[_0xaa41('0x2f')](_0x87e2f4['query']);_0x215896['filters']=_[_0xaa41('0x32')](_0x215896['model'],_0x215896['query']);_0x1ed366['attributes']=_[_0xaa41('0x32')](_0x215896['model'],qs[_0xaa41('0x34')](_0x87e2f4[_0xaa41('0x30')]['fields']));_0x1ed366['attributes']=_0x1ed366[_0xaa41('0x33')][_0xaa41('0x35')]?_0x1ed366[_0xaa41('0x33')]:_0x215896[_0xaa41('0x36')];if(_0x87e2f4[_0xaa41('0x30')][_0xaa41('0x41')]){_0x1ed366[_0xaa41('0x45')]=[{'all':!![]}];}_0x1ed366=_[_0xaa41('0x3d')]({},_0x1ed366,_0x87e2f4[_0xaa41('0x3f')]);return db['ScreenRecording'][_0xaa41('0x46')](_0x1ed366)[_0xaa41('0x25')](handleEntityNotFound(_0x4f9086,null))[_0xaa41('0x25')](respondWithResult(_0x4f9086,null))[_0xaa41('0x47')](handleError(_0x4f9086,null));};exports[_0xaa41('0x48')]=function(_0x1d6112,_0x538b12){return db[_0xaa41('0x40')][_0xaa41('0x48')](_0x1d6112[_0xaa41('0x49')],{})[_0xaa41('0x25')](respondWithResult(_0x538b12,0xc9))['catch'](handleError(_0x538b12,null));};exports[_0xaa41('0x23')]=function(_0x5787f3,_0x49fedd){if(_0x5787f3[_0xaa41('0x49')]['id']){delete _0x5787f3[_0xaa41('0x49')]['id'];}delete _0x5787f3[_0xaa41('0x49')]['duration'];delete _0x5787f3[_0xaa41('0x49')][_0xaa41('0x4a')];delete _0x5787f3[_0xaa41('0x49')]['closedAt'];delete _0x5787f3[_0xaa41('0x49')][_0xaa41('0x4b')];return db[_0xaa41('0x40')][_0xaa41('0x46')]({'where':{'id':_0x5787f3[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x49fedd,null))[_0xaa41('0x25')](saveUpdates(_0x5787f3[_0xaa41('0x49')],null))['then'](respondWithResult(_0x49fedd,null))[_0xaa41('0x47')](handleError(_0x49fedd,null));};exports['describe']=function(_0x5ae65e,_0x1bdcd6){return db[_0xaa41('0x40')][_0xaa41('0x4c')]()[_0xaa41('0x25')](respondWithResult(_0x1bdcd6,null))[_0xaa41('0x47')](handleError(_0x1bdcd6,null));};exports[_0xaa41('0x4d')]=function(_0x48c4c7,_0x3c5082,_0x519e39){var _0xecb54=require(_0xaa41('0x4e'));var _0x1d518f=![];var _0x4f9e92={};if(_0x48c4c7[_0xaa41('0x30')][_0xaa41('0x2c')]&&_0x48c4c7['query'][_0xaa41('0x2c')]===_0xaa41('0x4f')){_0x4f9e92[_0xaa41('0x4f')]=_0x48c4c7['params']['id'];}else{_0x4f9e92['id']=_0x48c4c7[_0xaa41('0x44')]['id'];}return db[_0xaa41('0x40')]['find']({'where':_0x4f9e92,'attributes':['id','value'],'raw':!![]})[_0xaa41('0x25')](handleEntityNotFound(_0x3c5082,null))[_0xaa41('0x25')](function(_0x3a29d2){if(_0x3a29d2){var _0x4d20c6=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x3a29d2[_0xaa41('0x4b')]);var _0x2abb78=util['format'](_0xaa41('0x53'),_0x4d20c6);if(fs['existsSync'](_0x2abb78)){_0x1d518f=!![];return _0xecb54['decryptFile'](_0x2abb78,_0x4d20c6,config[_0xaa41('0x54')]['recording'])[_0xaa41('0x25')](function(){return _0x3a29d2;});}return _0x3a29d2;}})[_0xaa41('0x25')](function(_0x169ddf){if(_0x169ddf){var _0x5e83e1=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x169ddf[_0xaa41('0x4b')]);if(!fs[_0xaa41('0x55')](_0x5e83e1)){throw new db[(_0xaa41('0x56'))][(_0xaa41('0x57'))](_0xaa41('0x58'));}if(_0x169ddf[_0xaa41('0x59')]){return _0x3c5082['download'](_0x5e83e1,_0x169ddf[_0xaa41('0x59')]+path[_0xaa41('0x5a')](_0x5e83e1),function(){if(_0x1d518f){fs[_0xaa41('0x5b')](_0x5e83e1);}});}else{return _0x3c5082['download'](_0x5e83e1,function(_0x3fe47a){if(_0x1d518f){fs[_0xaa41('0x5b')](_0x5e83e1);}});}}})[_0xaa41('0x47')](function(_0x134579){if(_0x134579[_0xaa41('0x5c')]===_0xaa41('0x58')){_0x3c5082[_0xaa41('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x3c5082,null);}});};exports['destroy']=function(_0x540325,_0x4ec357){return db['ScreenRecording'][_0xaa41('0x46')]({'where':{'id':_0x540325['params']['id']}})['then'](function(_0x24c6f3){if(_[_0xaa41('0x5d')](_0x24c6f3)){throw new ReferenceError(_0xaa41('0x5e'));}return _0x24c6f3;})[_0xaa41('0x25')](function(_0x5cabc4){var _0x244d41=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x5cabc4[_0xaa41('0x4b')]);logger[_0xaa41('0x5f')](_0xaa41('0x60'),_0x244d41);if(!_[_0xaa41('0x5d')](_0x5cabc4[_0xaa41('0x4b')])&&fs['existsSync'](_0x244d41)){logger[_0xaa41('0x5f')](_0xaa41('0x61')+_0x244d41+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x244d41);}_0x244d41=_0x244d41+'.cypher';if(!_[_0xaa41('0x5d')](_0x5cabc4['value'])&&fs[_0xaa41('0x55')](_0x244d41)){logger['info'](_0xaa41('0x61')+_0x244d41+_0xaa41('0x62'));fs['unlinkSync'](_0x244d41);}return _0x5cabc4;})[_0xaa41('0x25')](function(_0x33efc5){if(!_0x33efc5)throw new InternalError();return _0x33efc5[_0xaa41('0x24')]();})[_0xaa41('0x25')](function(){_0x4ec357['status'](0xcc)['end']();})[_0xaa41('0x47')](handleError(_0x4ec357,null));}; \ No newline at end of file +var _0x7dfd=['../../components/encryptor','uniqueid','join','%s.cypher','existsSync','decryptFile','secrets','root','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','index','ScreenRecording','fieldName','key','model','map','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','catch','create','body','duration','createdAt','closedAt','value','find','describe','download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd7df('0x0'));var rimraf=require(_0xd7df('0x1'));var zipdir=require(_0xd7df('0x2'));var jsonpatch=require(_0xd7df('0x3'));var rp=require(_0xd7df('0x4'));var moment=require(_0xd7df('0x5'));var BPromise=require(_0xd7df('0x6'));var Mustache=require(_0xd7df('0x7'));var util=require(_0xd7df('0x8'));var path=require(_0xd7df('0x9'));var sox=require(_0xd7df('0xa'));var csv=require(_0xd7df('0xb'));var ejs=require(_0xd7df('0xc'));var fs=require('fs');var fs_extra=require(_0xd7df('0xd'));var _=require(_0xd7df('0xe'));var squel=require(_0xd7df('0xf'));var crypto=require(_0xd7df('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd7df('0x11'));var toCsv=require(_0xd7df('0xb'));var querystring=require(_0xd7df('0x12'));var Papa=require(_0xd7df('0x13'));var Redis=require('ioredis');var authService=require(_0xd7df('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd7df('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7df('0x16'))(_0xd7df('0x17'));var utils=require(_0xd7df('0x18'));var config=require(_0xd7df('0x19'));var licenseUtil=require(_0xd7df('0x1a'));var db=require(_0xd7df('0x1b'))['db'];function respondWithStatusCode(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xcc;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x1c')](_0x3da618);}return _0x2e8187[_0xd7df('0x1d')](_0x3da618)[_0xd7df('0x1e')]();};}function respondWithResult(_0xe1595f,_0x196632){_0x196632=_0x196632||0xc8;return function(_0x3b2559){if(_0x3b2559){return _0xe1595f[_0xd7df('0x1d')](_0x196632)[_0xd7df('0x1f')](_0x3b2559);}};}function respondWithFilteredResult(_0x57b8be,_0x4c5cf){return function(_0x23cdbc){if(_0x23cdbc){var _0x513b13=typeof _0x4c5cf[_0xd7df('0x20')]===_0xd7df('0x21')&&typeof _0x4c5cf['limit']===_0xd7df('0x21');var _0x30ee65=_0x23cdbc[_0xd7df('0x22')];var _0x5210e5=_0x513b13?0x0:_0x4c5cf[_0xd7df('0x20')];var _0x471621=_0x513b13?_0x23cdbc[_0xd7df('0x22')]:_0x4c5cf['offset']+_0x4c5cf[_0xd7df('0x23')];var _0x20dc3e;if(_0x471621>=_0x30ee65){_0x471621=_0x30ee65;_0x20dc3e=0xc8;}else{_0x20dc3e=0xce;}_0x57b8be[_0xd7df('0x1d')](_0x20dc3e);return _0x57b8be['set'](_0xd7df('0x24'),_0x5210e5+'-'+_0x471621+'/'+_0x30ee65)['json'](_0x23cdbc);}return null;};}function patchUpdates(_0x225e33){return function(_0x5ab737){try{jsonpatch[_0xd7df('0x25')](_0x5ab737,_0x225e33,!![]);}catch(_0x342b54){return BPromise[_0xd7df('0x26')](_0x342b54);}return _0x5ab737['save']();};}function saveUpdates(_0xc50077,_0x502ae8){return function(_0x44079b){if(_0x44079b){return _0x44079b[_0xd7df('0x27')](_0xc50077)[_0xd7df('0x28')](function(_0x29f354){return _0x29f354;});}return null;};}function removeEntity(_0x1c774b,_0xa80cbf){return function(_0x1e3bf3){if(_0x1e3bf3){return _0x1e3bf3['destroy']()['then'](function(){_0x1c774b[_0xd7df('0x1d')](0xcc)[_0xd7df('0x1e')]();});}};}function handleEntityNotFound(_0x26047f,_0x459f11){return function(_0x13f190){if(!_0x13f190){_0x26047f[_0xd7df('0x1c')](0x194);}return _0x13f190;};}function handleError(_0x373359,_0x2b6fde){_0x2b6fde=_0x2b6fde||0x1f4;return function(_0x163904){logger['error'](_0x163904[_0xd7df('0x29')]);if(_0x163904[_0xd7df('0x2a')]){delete _0x163904[_0xd7df('0x2a')];}_0x373359[_0xd7df('0x1d')](_0x2b6fde)[_0xd7df('0x2b')](_0x163904);};}exports[_0xd7df('0x2c')]=function(_0x3f78fa,_0x36de76){var _0x5195cf={},_0x4ba779={},_0x52b56a={'count':0x0,'rows':[]};var _0x58584d=_['map'](db[_0xd7df('0x2d')]['rawAttributes'],function(_0xd366b){return{'name':_0xd366b[_0xd7df('0x2e')],'type':_0xd366b['type'][_0xd7df('0x2f')]};});_0x4ba779[_0xd7df('0x30')]=_['differenceBy'](_[_0xd7df('0x31')](_0x58584d,_0xd7df('0x2a')),[_0xd7df('0x32')]);_0x4ba779[_0xd7df('0x33')]=_[_0xd7df('0x34')](_0x3f78fa[_0xd7df('0x33')]);_0x4ba779['filters']=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],_0x4ba779[_0xd7df('0x33')]);_0x5195cf[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5195cf[_0xd7df('0x36')]=_0x5195cf[_0xd7df('0x36')]['length']?_0x5195cf['attributes']:_0x4ba779[_0xd7df('0x30')];if(!_0x3f78fa['query'][_0xd7df('0x38')](_0xd7df('0x39'))){_0x5195cf[_0xd7df('0x23')]=qs[_0xd7df('0x23')](_0x3f78fa['query']['limit']);_0x5195cf['offset']=qs[_0xd7df('0x20')](_0x3f78fa[_0xd7df('0x33')]['offset']);}_0x5195cf[_0xd7df('0x3a')]=qs[_0xd7df('0x3b')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3b')]);_0x5195cf['where']=qs[_0xd7df('0x3c')](_[_0xd7df('0x3d')](_0x3f78fa['query'],_0x4ba779[_0xd7df('0x3c')]),_0x58584d);if(_0x3f78fa['query'][_0xd7df('0x3e')]){_0x5195cf[_0xd7df('0x3f')]=_[_0xd7df('0x40')](_0x5195cf['where'],{'$or':_[_0xd7df('0x31')](_0x58584d,function(_0x2a7252){if(_0x2a7252[_0xd7df('0x41')]!==_0xd7df('0x42')){var _0x54ea42={};_0x54ea42[_0x2a7252[_0xd7df('0x2a')]]={'$like':'%'+_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3e')]+'%'};return _0x54ea42;}})});}_0x5195cf=_['merge']({},_0x5195cf,_0x3f78fa[_0xd7df('0x43')]);var _0x207852={'where':_0x5195cf[_0xd7df('0x3f')]};return db['ScreenRecording'][_0xd7df('0x22')](_0x207852)[_0xd7df('0x28')](function(_0x4910cb){_0x52b56a['count']=_0x4910cb;if(_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5195cf[_0xd7df('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x5195cf);})[_0xd7df('0x28')](function(_0x4ebdbe){_0x52b56a[_0xd7df('0x46')]=_0x4ebdbe;return _0x52b56a;})['then'](respondWithFilteredResult(_0x36de76,_0x5195cf))['catch'](handleError(_0x36de76,null));};exports[_0xd7df('0x47')]=function(_0x579d0f,_0x18ef10){var _0x5302f4={'raw':![],'where':{'id':_0x579d0f[_0xd7df('0x48')]['id']}},_0xad2d69={};_0xad2d69[_0xd7df('0x30')]=_[_0xd7df('0x34')](db[_0xd7df('0x2d')][_0xd7df('0x49')]);_0xad2d69[_0xd7df('0x33')]=_['keys'](_0x579d0f[_0xd7df('0x33')]);_0xad2d69['filters']=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],_0xad2d69[_0xd7df('0x33')]);_0x5302f4[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x579d0f[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5302f4['attributes']=_0x5302f4[_0xd7df('0x36')][_0xd7df('0x4a')]?_0x5302f4['attributes']:_0xad2d69['model'];if(_0x579d0f[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5302f4[_0xd7df('0x45')]=[{'all':!![]}];}_0x5302f4=_['merge']({},_0x5302f4,_0x579d0f['options']);return db[_0xd7df('0x2d')]['find'](_0x5302f4)[_0xd7df('0x28')](handleEntityNotFound(_0x18ef10,null))[_0xd7df('0x28')](respondWithResult(_0x18ef10,null))[_0xd7df('0x4b')](handleError(_0x18ef10,null));};exports[_0xd7df('0x4c')]=function(_0x1838aa,_0x28c13f){return db[_0xd7df('0x2d')][_0xd7df('0x4c')](_0x1838aa[_0xd7df('0x4d')],{})[_0xd7df('0x28')](respondWithResult(_0x28c13f,0xc9))[_0xd7df('0x4b')](handleError(_0x28c13f,null));};exports[_0xd7df('0x27')]=function(_0x54222c,_0x1f2f99){if(_0x54222c[_0xd7df('0x4d')]['id']){delete _0x54222c[_0xd7df('0x4d')]['id'];}delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x4e')];delete _0x54222c['body'][_0xd7df('0x4f')];delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x50')];delete _0x54222c['body'][_0xd7df('0x51')];return db['ScreenRecording'][_0xd7df('0x52')]({'where':{'id':_0x54222c[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](handleEntityNotFound(_0x1f2f99,null))[_0xd7df('0x28')](saveUpdates(_0x54222c[_0xd7df('0x4d')],null))['then'](respondWithResult(_0x1f2f99,null))['catch'](handleError(_0x1f2f99,null));};exports['describe']=function(_0xe4b221,_0x4a6cf5){return db[_0xd7df('0x2d')][_0xd7df('0x53')]()[_0xd7df('0x28')](respondWithResult(_0x4a6cf5,null))[_0xd7df('0x4b')](handleError(_0x4a6cf5,null));};exports[_0xd7df('0x54')]=function(_0x418da,_0xf72803,_0xb054d7){var _0x453876=require(_0xd7df('0x55'));var _0x382d11=![];var _0x327365={};if(_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]&&_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]==='uniqueid'){_0x327365[_0xd7df('0x56')]=_0x418da[_0xd7df('0x48')]['id'];}else{_0x327365['id']=_0x418da['params']['id'];}return db['ScreenRecording'][_0xd7df('0x52')]({'where':_0x327365,'attributes':['id','value'],'raw':!![]})[_0xd7df('0x28')](handleEntityNotFound(_0xf72803,null))['then'](function(_0x1f34c2){if(_0x1f34c2){var _0x28151a=path[_0xd7df('0x57')](config['root'],'server/files/screen_recordings',_0x1f34c2['value']);var _0x3666ba=util[_0xd7df('0x32')](_0xd7df('0x58'),_0x28151a);if(fs[_0xd7df('0x59')](_0x3666ba)){_0x382d11=!![];return _0x453876[_0xd7df('0x5a')](_0x3666ba,_0x28151a,config[_0xd7df('0x5b')]['recording'])[_0xd7df('0x28')](function(){return _0x1f34c2;});}return _0x1f34c2;}})[_0xd7df('0x28')](function(_0x35204f){if(_0x35204f){var _0x25d187=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x35204f[_0xd7df('0x51')]);if(!fs[_0xd7df('0x59')](_0x25d187)){throw new db[(_0xd7df('0x5e'))][(_0xd7df('0x5f'))](_0xd7df('0x60'));}if(_0x35204f[_0xd7df('0x61')]){return _0xf72803[_0xd7df('0x54')](_0x25d187,_0x35204f[_0xd7df('0x61')]+path[_0xd7df('0x62')](_0x25d187),function(){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}else{return _0xf72803[_0xd7df('0x54')](_0x25d187,function(_0x3f2775){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}}})[_0xd7df('0x4b')](function(_0x393a3a){if(_0x393a3a[_0xd7df('0x64')]===_0xd7df('0x60')){_0xf72803[_0xd7df('0x1d')](0x194)[_0xd7df('0x2b')]('Not\x20found');}else{return handleError(_0xf72803,null);}});};exports['destroy']=function(_0x327402,_0x28f550){return db[_0xd7df('0x2d')]['find']({'where':{'id':_0x327402[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](function(_0x1e87aa){if(_[_0xd7df('0x65')](_0x1e87aa)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1e87aa;})[_0xd7df('0x28')](function(_0x20ad50){var _0xb06a56=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x20ad50[_0xd7df('0x51')]);logger[_0xd7df('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0xb06a56);if(!_[_0xd7df('0x65')](_0x20ad50[_0xd7df('0x51')])&&fs['existsSync'](_0xb06a56)){logger['info']('File:\x20\x22'+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}_0xb06a56=_0xb06a56+_0xd7df('0x69');if(!_[_0xd7df('0x65')](_0x20ad50['value'])&&fs[_0xd7df('0x59')](_0xb06a56)){logger[_0xd7df('0x66')](_0xd7df('0x6a')+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}return _0x20ad50;})[_0xd7df('0x28')](function(_0x4124b8){if(!_0x4124b8)throw new InternalError();return _0x4124b8['destroy']();})['then'](function(){_0x28f550[_0xd7df('0x1d')](0xcc)['end']();})[_0xd7df('0x4b')](handleError(_0x28f550,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 57bd09c..82d5d64 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 _0x1bc1=['../../config/logger','api','bluebird','rimraf','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x5b1a2e,_0x150cba){var _0x13260d=function(_0x15537e){while(--_0x15537e){_0x5b1a2e['push'](_0x5b1a2e['shift']());}};_0x13260d(++_0x150cba);}(_0x1bc1,0x112));var _0x11bc=function(_0xefebd8,_0x1d95b9){_0xefebd8=_0xefebd8-0x0;var _0x1b08e3=_0x1bc1[_0xefebd8];return _0x1b08e3;};'use strict';var _=require(_0x11bc('0x0'));var util=require(_0x11bc('0x1'));var logger=require(_0x11bc('0x2'))(_0x11bc('0x3'));var moment=require('moment');var BPromise=require(_0x11bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x11bc('0x5'));var config=require('../../config/environment');var attributes=require(_0x11bc('0x6'));module[_0x11bc('0x7')]=function(_0x5d1466,_0x414706){return _0x5d1466[_0x11bc('0x8')](_0x11bc('0x9'),attributes,{'tableName':_0x11bc('0xa'),'paranoid':![],'indexes':[{'name':_0x11bc('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe44c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','interactionid','util','../../config/logger','api'];(function(_0x163268,_0x24c75d){var _0x5dda3b=function(_0x196d81){while(--_0x196d81){_0x163268['push'](_0x163268['shift']());}};_0x5dda3b(++_0x24c75d);}(_0xe44c,0x10e));var _0xce44=function(_0x1ca8d8,_0x17aa35){_0x1ca8d8=_0x1ca8d8-0x0;var _0x1161d8=_0xe44c[_0x1ca8d8];return _0x1161d8;};'use strict';var _=require('lodash');var util=require(_0xce44('0x0'));var logger=require(_0xce44('0x1'))(_0xce44('0x2'));var moment=require(_0xce44('0x3'));var BPromise=require(_0xce44('0x4'));var rp=require(_0xce44('0x5'));var fs=require('fs');var path=require(_0xce44('0x6'));var rimraf=require(_0xce44('0x7'));var config=require(_0xce44('0x8'));var attributes=require('./screenRecording.attributes');module[_0xce44('0x9')]=function(_0x300911,_0x4d93ff){return _0x300911[_0xce44('0xa')](_0xce44('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xce44('0xc'),'fields':[_0xce44('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index df3bfd9..8b4cab5 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 _0x630a=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','request\x20sent','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x630a,0x6a));var _0xa630=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0x630a[_0x25d2fb];return _0x1ded53;};'use strict';var _=require(_0xa630('0x0'));var util=require(_0xa630('0x1'));var moment=require(_0xa630('0x2'));var BPromise=require('bluebird');var rs=require(_0xa630('0x3'));var fs=require('fs');var Redis=require(_0xa630('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa630('0x5'));var logger=require(_0xa630('0x6'))(_0xa630('0x7'));var config=require(_0xa630('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa630('0x9')][_0xa630('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcc41fd,_0x58a27e,_0x7beab2){return new BPromise(function(_0x4a377c,_0x4ee241){return client[_0xa630('0xb')](_0xcc41fd,_0x7beab2)[_0xa630('0xc')](function(_0xfd3d1d){logger[_0xa630('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x58a27e,'request\x20sent');logger[_0xa630('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x58a27e,_0xa630('0xf'),JSON['stringify'](_0xfd3d1d));if(_0xfd3d1d[_0xa630('0x10')]){if(_0xfd3d1d[_0xa630('0x10')][_0xa630('0x11')]===0x1f4){logger[_0xa630('0x10')](_0xa630('0x12'),_0x58a27e,_0xfd3d1d[_0xa630('0x10')][_0xa630('0x13')]);return _0x4ee241(_0xfd3d1d[_0xa630('0x10')][_0xa630('0x13')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x58a27e,_0xfd3d1d[_0xa630('0x10')][_0xa630('0x13')]);return _0x4a377c(_0xfd3d1d['error']['message']);}else{logger[_0xa630('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x58a27e,'request\x20sent');_0x4a377c(_0xfd3d1d[_0xa630('0x14')][_0xa630('0x13')]);}})[_0xa630('0x15')](function(_0x91d968){logger[_0xa630('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x58a27e,_0x91d968);_0x4ee241(_0x91d968);});});} \ No newline at end of file +var _0x95e7=['error','code','ScreenRecording,\x20%s,\x20%s','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5f164a,_0x1bcf3a){var _0x2f73fb=function(_0x2cf315){while(--_0x2cf315){_0x5f164a['push'](_0x5f164a['shift']());}};_0x2f73fb(++_0x1bcf3a);}(_0x95e7,0x1bd));var _0x795e=function(_0x544ec7,_0x2d94bb){_0x544ec7=_0x544ec7-0x0;var _0xd9f1ce=_0x95e7[_0x544ec7];return _0xd9f1ce;};'use strict';var _=require(_0x795e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x795e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x795e('0x2'));var db=require(_0x795e('0x3'))['db'];var utils=require(_0x795e('0x4'));var logger=require(_0x795e('0x5'))(_0x795e('0x6'));var config=require(_0x795e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x795e('0x8')][_0x795e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cd8c2,_0x1608bb,_0xb964f2){return new BPromise(function(_0x37ba11,_0x503d21){return client[_0x795e('0xa')](_0x3cd8c2,_0xb964f2)[_0x795e('0xb')](function(_0x4e7f44){logger[_0x795e('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x1608bb,_0x795e('0xd'));logger[_0x795e('0xe')](_0x795e('0xf'),_0x1608bb,_0x795e('0xd'),JSON[_0x795e('0x10')](_0x4e7f44));if(_0x4e7f44[_0x795e('0x11')]){if(_0x4e7f44[_0x795e('0x11')][_0x795e('0x12')]===0x1f4){logger[_0x795e('0x11')](_0x795e('0x13'),_0x1608bb,_0x4e7f44[_0x795e('0x11')][_0x795e('0x14')]);return _0x503d21(_0x4e7f44[_0x795e('0x11')][_0x795e('0x14')]);}logger['error'](_0x795e('0x13'),_0x1608bb,_0x4e7f44[_0x795e('0x11')][_0x795e('0x14')]);return _0x37ba11(_0x4e7f44[_0x795e('0x11')][_0x795e('0x14')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x1608bb,_0x795e('0xd'));_0x37ba11(_0x4e7f44[_0x795e('0x15')][_0x795e('0x14')]);}})['catch'](function(_0x228695){logger[_0x795e('0x11')](_0x795e('0x13'),_0x1608bb,_0x228695);_0x503d21(_0x228695);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index a7fb439..4dca379 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 _0x5730=['root','originalname','post','file','addLogoLogin','diskStorage','preferred','extname','addFavicon','put','update','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','join','server/files/images/logos/','format','%s%s','logo','single'];(function(_0x395a99,_0x200efe){var _0x193b64=function(_0x5dbd84){while(--_0x5dbd84){_0x395a99['push'](_0x395a99['shift']());}};_0x193b64(++_0x200efe);}(_0x5730,0x19c));var _0x0573=function(_0x24eaf9,_0xe9a8c9){_0x24eaf9=_0x24eaf9-0x0;var _0x39e6fe=_0x5730[_0x24eaf9];return _0x39e6fe;};'use strict';var multer=require('multer');var util=require(_0x0573('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0573('0x1'));var router=express[_0x0573('0x2')]();var fs_extra=require(_0x0573('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0573('0x4'));var config=require(_0x0573('0x5'));var controller=require('./setting.controller');router[_0x0573('0x6')]('/',auth[_0x0573('0x7')](),controller[_0x0573('0x8')]);router[_0x0573('0x6')](_0x0573('0x9'),controller[_0x0573('0xa')]);router[_0x0573('0x6')](_0x0573('0xb'),controller[_0x0573('0xc')]);router['get'](_0x0573('0xd'),controller[_0x0573('0xe')]);router['get'](_0x0573('0xf'),controller[_0x0573('0x10')]);router[_0x0573('0x6')](_0x0573('0x11'),controller[_0x0573('0x12')]);router[_0x0573('0x6')](_0x0573('0x13'),controller['getPreferred']);router[_0x0573('0x6')](_0x0573('0x14'),controller[_0x0573('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x311c45,_0x58c3ec,_0xde1cf7){_0xde1cf7(null,path[_0x0573('0x16')](config['root'],_0x0573('0x17')));},'filename':function(_0x164b93,_0x5c952c,_0x22c0a3){_0x22c0a3(null,util[_0x0573('0x18')](_0x0573('0x19'),_0x0573('0x1a'),path['extname'](_0x5c952c['originalname'])));}})});router['post'](_0x0573('0xd'),upload[_0x0573('0x1b')]('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2745d4,_0x592b07,_0x23e835){_0x23e835(null,path[_0x0573('0x16')](config[_0x0573('0x1c')],_0x0573('0x17')));},'filename':function(_0x3f337f,_0x1a20cf,_0x16867b){_0x16867b(null,util[_0x0573('0x18')](_0x0573('0x19'),'logologin',path['extname'](_0x1a20cf[_0x0573('0x1d')])));}})});router[_0x0573('0x1e')](_0x0573('0xf'),upload['single'](_0x0573('0x1f')),controller[_0x0573('0x20')]);var upload=multer({'storage':multer[_0x0573('0x21')]({'destination':function(_0x3ade8a,_0x12d21e,_0x4f9d1b){_0x4f9d1b(null,path[_0x0573('0x16')](config[_0x0573('0x1c')],_0x0573('0x17')));},'filename':function(_0x2c5f46,_0x2570ac,_0x2847a2){_0x2847a2(null,util['format'](_0x0573('0x19'),_0x0573('0x22'),path[_0x0573('0x23')](_0x2570ac['originalname'])));}})});router[_0x0573('0x1e')](_0x0573('0x13'),upload[_0x0573('0x1b')](_0x0573('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cec54,_0x1eca9a,_0x4dc849){_0x4dc849(null,path[_0x0573('0x16')](config[_0x0573('0x1c')],_0x0573('0x17')));},'filename':function(_0x4b7110,_0xa46b3e,_0x515e9a){_0x515e9a(null,util[_0x0573('0x18')](_0x0573('0x19'),'favicon',path[_0x0573('0x23')](_0xa46b3e['originalname'])));}})});router['post']('/:id/favicon',upload[_0x0573('0x1b')](_0x0573('0x1f')),controller[_0x0573('0x24')]);router[_0x0573('0x25')](_0x0573('0xb'),auth[_0x0573('0x7')](),controller[_0x0573('0x26')]);module[_0x0573('0x27')]=router; \ No newline at end of file +var _0x6606=['isAuthenticated','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','index','/now','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','originalname','post','/:id/logo','single','file','logologin','addLogoLogin','preferred','addFavicon','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6606,0x1ba));var _0x6660=function(_0x5e3959,_0x56d974){_0x5e3959=_0x5e3959-0x0;var _0x4ca4fd=_0x6606[_0x5e3959];return _0x4ca4fd;};'use strict';var multer=require(_0x6660('0x0'));var util=require(_0x6660('0x1'));var path=require(_0x6660('0x2'));var timeout=require(_0x6660('0x3'));var express=require('express');var router=express[_0x6660('0x4')]();var fs_extra=require(_0x6660('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6660('0x6'));var controller=require('./setting.controller');router[_0x6660('0x7')]('/',auth['isAuthenticated'](),controller[_0x6660('0x8')]);router[_0x6660('0x7')](_0x6660('0x9'),controller['getDate']);router[_0x6660('0x7')](_0x6660('0xa'),controller[_0x6660('0xb')]);router[_0x6660('0x7')]('/:id/logo',controller[_0x6660('0xc')]);router['get'](_0x6660('0xd'),controller[_0x6660('0xe')]);router[_0x6660('0x7')](_0x6660('0xf'),controller[_0x6660('0x10')]);router['get'](_0x6660('0x11'),controller[_0x6660('0x12')]);router[_0x6660('0x7')](_0x6660('0x13'),controller[_0x6660('0x14')]);var upload=multer({'storage':multer[_0x6660('0x15')]({'destination':function(_0x4070f7,_0x413749,_0x55c50f){_0x55c50f(null,path[_0x6660('0x16')](config[_0x6660('0x17')],_0x6660('0x18')));},'filename':function(_0x963b07,_0x24933c,_0x1f4413){_0x1f4413(null,util[_0x6660('0x19')](_0x6660('0x1a'),_0x6660('0x1b'),path['extname'](_0x24933c[_0x6660('0x1c')])));}})});router[_0x6660('0x1d')](_0x6660('0x1e'),upload[_0x6660('0x1f')](_0x6660('0x20')),controller['addLogo']);var upload=multer({'storage':multer[_0x6660('0x15')]({'destination':function(_0x3fb1c4,_0x5dabeb,_0x8186f){_0x8186f(null,path[_0x6660('0x16')](config[_0x6660('0x17')],_0x6660('0x18')));},'filename':function(_0x4c4e75,_0x3504da,_0x41d049){_0x41d049(null,util[_0x6660('0x19')](_0x6660('0x1a'),_0x6660('0x21'),path['extname'](_0x3504da[_0x6660('0x1c')])));}})});router['post']('/:id/logo_login',upload[_0x6660('0x1f')](_0x6660('0x20')),controller[_0x6660('0x22')]);var upload=multer({'storage':multer[_0x6660('0x15')]({'destination':function(_0x58aa74,_0x350b6e,_0x16f4c0){_0x16f4c0(null,path[_0x6660('0x16')](config[_0x6660('0x17')],_0x6660('0x18')));},'filename':function(_0x31b42e,_0x54b5b8,_0x2bab15){_0x2bab15(null,util[_0x6660('0x19')](_0x6660('0x1a'),_0x6660('0x23'),path['extname'](_0x54b5b8[_0x6660('0x1c')])));}})});router[_0x6660('0x1d')]('/:id/preferred',upload[_0x6660('0x1f')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x6660('0x15')]({'destination':function(_0x25dcdc,_0x399326,_0x1eef7c){_0x1eef7c(null,path[_0x6660('0x16')](config['root'],_0x6660('0x18')));},'filename':function(_0x1ea0a2,_0x3fb510,_0xcfba25){_0xcfba25(null,util[_0x6660('0x19')](_0x6660('0x1a'),'favicon',path['extname'](_0x3fb510[_0x6660('0x1c')])));}})});router[_0x6660('0x1d')](_0x6660('0x13'),upload[_0x6660('0x1f')](_0x6660('0x20')),controller[_0x6660('0x24')]);router[_0x6660('0x25')](_0x6660('0xa'),auth[_0x6660('0x26')](),controller['update']);module[_0x6660('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8b2a52e..0f26745 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x144128,_0x5164a1){var _0x3e39d7=function(_0x1eec7f){while(--_0x1eec7f){_0x144128['push'](_0x144128['shift']());}};_0x3e39d7(++_0x5164a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x2d1f7b,_0xf88bac){var _0x4bf52a=function(_0x1b15a3){while(--_0x1b15a3){_0x2d1f7b['push'](_0x2d1f7b['shift']());}};_0x4bf52a(++_0xf88bac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index fe55400..d339c90 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 _0xaaea=['gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','defaultLogo','default_favicon.ico','getDate','now','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Setting','include','findAll','rows','show','params','keys','includeAll','find','body','file','logo','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','defaultLoginLogo','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','preferred','favicon','defaultPreferred','default_loginLogo.svg','download'];(function(_0x54b34a,_0x2d34c3){var _0x1633cc=function(_0x580da2){while(--_0x580da2){_0x54b34a['push'](_0x54b34a['shift']());}};_0x1633cc(++_0x2d34c3);}(_0xaaea,0x183));var _0xaaae=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xaaea[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaaae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaaae('0x1'));var rp=require(_0xaaae('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaaae('0x3'));var util=require(_0xaaae('0x4'));var path=require(_0xaaae('0x5'));var sox=require(_0xaaae('0x6'));var csv=require('to-csv');var ejs=require(_0xaaae('0x7'));var fs=require('fs');var fs_extra=require(_0xaaae('0x8'));var _=require(_0xaaae('0x9'));var squel=require(_0xaaae('0xa'));var crypto=require('crypto');var jsforce=require(_0xaaae('0xb'));var deskjs=require(_0xaaae('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaaae('0xd'));var Papa=require(_0xaaae('0xe'));var Redis=require('ioredis');var authService=require(_0xaaae('0xf'));var qs=require(_0xaaae('0x10'));var as=require(_0xaaae('0x11'));var hardwareService=require(_0xaaae('0x12'));var logger=require(_0xaaae('0x13'))(_0xaaae('0x14'));var utils=require(_0xaaae('0x15'));var config=require(_0xaaae('0x16'));var licenseUtil=require(_0xaaae('0x17'));var db=require(_0xaaae('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xaaae('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33be02,_0x1e2938,_0x422da2,_0x199db9){return new BPromise(function(_0xdc69e3,_0x498e85){var _0x4fc6aa=_0x199db9||client;return _0x4fc6aa['request'](_0x33be02,_0x422da2)['then'](function(_0x389218){logger[_0xaaae('0x1a')](_0xaaae('0x1b'),_0x1e2938,_0xaaae('0x1c'));logger[_0xaaae('0x1d')](_0xaaae('0x1e'),_0x1e2938,_0xaaae('0x1c'),JSON[_0xaaae('0x1f')](_0x389218));if(_0x389218['error']){if(_0x389218[_0xaaae('0x20')][_0xaaae('0x21')]===0x1f4){logger['error'](_0xaaae('0x1b'),_0x1e2938,_0x389218[_0xaaae('0x20')][_0xaaae('0x22')]);return _0x498e85(_0x389218[_0xaaae('0x20')][_0xaaae('0x22')]);}logger['error'](_0xaaae('0x1b'),_0x1e2938,_0x389218['error'][_0xaaae('0x22')]);return _0xdc69e3(_0x389218['error'][_0xaaae('0x22')]);}else{logger[_0xaaae('0x1a')]('Setting,\x20%s,\x20%s',_0x1e2938,'request\x20sent');_0xdc69e3(_0x389218[_0xaaae('0x23')]['message']);}})[_0xaaae('0x24')](function(_0x37ab2e){logger[_0xaaae('0x20')](_0xaaae('0x1b'),_0x1e2938,_0x37ab2e);_0x498e85(_0x37ab2e);});});}function respondWithStatusCode(_0x12c86f,_0x10b126){_0x10b126=_0x10b126||0xcc;return function(_0x2f1360){if(_0x2f1360){return _0x12c86f[_0xaaae('0x25')](_0x10b126);}return _0x12c86f['status'](_0x10b126)[_0xaaae('0x26')]();};}function respondWithResult(_0x476f8c,_0x3fcf65){_0x3fcf65=_0x3fcf65||0xc8;return function(_0x24a448){if(_0x24a448){return _0x476f8c[_0xaaae('0x27')](_0x3fcf65)[_0xaaae('0x28')](_0x24a448);}};}function respondWithFilteredResult(_0x3e266d,_0x407de8){return function(_0x11ff12){if(_0x11ff12){var _0xbe3e28=typeof _0x407de8[_0xaaae('0x29')]===_0xaaae('0x2a')&&typeof _0x407de8[_0xaaae('0x2b')]===_0xaaae('0x2a');var _0x526bff=_0x11ff12[_0xaaae('0x2c')];var _0x3c9da1=_0xbe3e28?0x0:_0x407de8[_0xaaae('0x29')];var _0x43776a=_0xbe3e28?_0x11ff12['count']:_0x407de8[_0xaaae('0x29')]+_0x407de8['limit'];var _0x3e94e8;if(_0x43776a>=_0x526bff){_0x43776a=_0x526bff;_0x3e94e8=0xc8;}else{_0x3e94e8=0xce;}_0x3e266d['status'](_0x3e94e8);return _0x3e266d[_0xaaae('0x2d')]('Content-Range',_0x3c9da1+'-'+_0x43776a+'/'+_0x526bff)[_0xaaae('0x28')](_0x11ff12);}return null;};}function patchUpdates(_0x1a2e04){return function(_0x39ab24){try{jsonpatch[_0xaaae('0x2e')](_0x39ab24,_0x1a2e04,!![]);}catch(_0xfd473){return BPromise[_0xaaae('0x2f')](_0xfd473);}return _0x39ab24[_0xaaae('0x30')]();};}function saveUpdates(_0x30f9da,_0x4c9717){return function(_0x19d568){if(_0x19d568){return _0x19d568[_0xaaae('0x31')](_0x30f9da)[_0xaaae('0x32')](function(_0x5da746){return _0x5da746;});}return null;};}function removeEntity(_0x317f1d,_0x171d17){return function(_0x238f01){if(_0x238f01){return _0x238f01['destroy']()[_0xaaae('0x32')](function(){_0x317f1d['status'](0xcc)[_0xaaae('0x26')]();});}};}function handleEntityNotFound(_0x5f4b61,_0x3e0ae9){return function(_0x565500){if(!_0x565500){_0x5f4b61[_0xaaae('0x25')](0x194);}return _0x565500;};}function handleError(_0x550889,_0x46dc27){_0x46dc27=_0x46dc27||0x1f4;return function(_0x71c1a6){logger[_0xaaae('0x20')](_0x71c1a6[_0xaaae('0x33')]);if(_0x71c1a6[_0xaaae('0x34')]){delete _0x71c1a6[_0xaaae('0x34')];}_0x550889['status'](_0x46dc27)[_0xaaae('0x35')](_0x71c1a6);};}exports[_0xaaae('0x36')]=function(_0x24cfb8,_0x5dfe3f){var _0x1789c7={},_0x372efc={},_0xeb8b={'count':0x0,'rows':[]};var _0x39c6f6=_[_0xaaae('0x37')](db['Setting'][_0xaaae('0x38')],function(_0x4b0e0f){return{'name':_0x4b0e0f[_0xaaae('0x39')],'type':_0x4b0e0f[_0xaaae('0x3a')][_0xaaae('0x3b')]};});_0x372efc[_0xaaae('0x3c')]=_[_0xaaae('0x37')](_0x39c6f6,_0xaaae('0x34'));_0x372efc['query']=_['keys'](_0x24cfb8[_0xaaae('0x3d')]);_0x372efc[_0xaaae('0x3e')]=_[_0xaaae('0x3f')](_0x372efc[_0xaaae('0x3c')],_0x372efc['query']);_0x1789c7['attributes']=_['intersection'](_0x372efc['model'],qs[_0xaaae('0x40')](_0x24cfb8[_0xaaae('0x3d')][_0xaaae('0x40')]));_0x1789c7['attributes']=_0x1789c7['attributes'][_0xaaae('0x41')]?_0x1789c7[_0xaaae('0x42')]:_0x372efc[_0xaaae('0x3c')];if(!_0x24cfb8['query'][_0xaaae('0x43')](_0xaaae('0x44'))){_0x1789c7[_0xaaae('0x2b')]=qs[_0xaaae('0x2b')](_0x24cfb8[_0xaaae('0x3d')][_0xaaae('0x2b')]);_0x1789c7[_0xaaae('0x29')]=qs[_0xaaae('0x29')](_0x24cfb8[_0xaaae('0x3d')][_0xaaae('0x29')]);}_0x1789c7[_0xaaae('0x45')]=qs['sort'](_0x24cfb8['query'][_0xaaae('0x46')]);_0x1789c7[_0xaaae('0x47')]=qs[_0xaaae('0x3e')](_['pick'](_0x24cfb8[_0xaaae('0x3d')],_0x372efc[_0xaaae('0x3e')]),_0x39c6f6);if(_0x24cfb8['query'][_0xaaae('0x48')]){_0x1789c7[_0xaaae('0x47')]=_[_0xaaae('0x49')](_0x1789c7[_0xaaae('0x47')],{'$or':_['map'](_0x39c6f6,function(_0x5cb7e2){if(_0x5cb7e2['type']!==_0xaaae('0x4a')){var _0x1b9c8a={};_0x1b9c8a[_0x5cb7e2['name']]={'$like':'%'+_0x24cfb8[_0xaaae('0x3d')][_0xaaae('0x48')]+'%'};return _0x1b9c8a;}})});}_0x1789c7=_[_0xaaae('0x49')]({},_0x1789c7,_0x24cfb8[_0xaaae('0x4b')]);var _0x492fb3={'where':_0x1789c7[_0xaaae('0x47')]};return db[_0xaaae('0x4c')][_0xaaae('0x2c')](_0x492fb3)[_0xaaae('0x32')](function(_0x468b4d){_0xeb8b[_0xaaae('0x2c')]=_0x468b4d;if(_0x24cfb8['query']['includeAll']){_0x1789c7[_0xaaae('0x4d')]=[{'all':!![]}];}return db[_0xaaae('0x4c')][_0xaaae('0x4e')](_0x1789c7);})[_0xaaae('0x32')](function(_0x54fcb4){_0xeb8b[_0xaaae('0x4f')]=_0x54fcb4;return _0xeb8b;})[_0xaaae('0x32')](respondWithFilteredResult(_0x5dfe3f,_0x1789c7))[_0xaaae('0x24')](handleError(_0x5dfe3f,null));};exports[_0xaaae('0x50')]=function(_0x3e21aa,_0x336d72){var _0x38ad6d={'raw':![],'where':{'id':_0x3e21aa[_0xaaae('0x51')]['id']}},_0x1d2c5f={};_0x1d2c5f[_0xaaae('0x3c')]=_[_0xaaae('0x52')](db[_0xaaae('0x4c')][_0xaaae('0x38')]);_0x1d2c5f[_0xaaae('0x3d')]=_[_0xaaae('0x52')](_0x3e21aa['query']);_0x1d2c5f['filters']=_[_0xaaae('0x3f')](_0x1d2c5f[_0xaaae('0x3c')],_0x1d2c5f[_0xaaae('0x3d')]);_0x38ad6d[_0xaaae('0x42')]=_[_0xaaae('0x3f')](_0x1d2c5f[_0xaaae('0x3c')],qs[_0xaaae('0x40')](_0x3e21aa[_0xaaae('0x3d')][_0xaaae('0x40')]));_0x38ad6d['attributes']=_0x38ad6d[_0xaaae('0x42')][_0xaaae('0x41')]?_0x38ad6d[_0xaaae('0x42')]:_0x1d2c5f[_0xaaae('0x3c')];if(_0x3e21aa[_0xaaae('0x3d')][_0xaaae('0x53')]){_0x38ad6d[_0xaaae('0x4d')]=[{'all':!![]}];}_0x38ad6d=_[_0xaaae('0x49')]({},_0x38ad6d,_0x3e21aa['options']);return db[_0xaaae('0x4c')][_0xaaae('0x54')](_0x38ad6d)['then'](handleEntityNotFound(_0x336d72,null))[_0xaaae('0x32')](respondWithResult(_0x336d72,null))[_0xaaae('0x24')](handleError(_0x336d72,null));};exports['update']=function(_0x43267a,_0x20dee5){if(_0x43267a['body']['id']){delete _0x43267a['body']['id'];}return db[_0xaaae('0x4c')][_0xaaae('0x54')]({'where':{'id':_0x43267a[_0xaaae('0x51')]['id']}})[_0xaaae('0x32')](handleEntityNotFound(_0x20dee5,null))[_0xaaae('0x32')](saveUpdates(_0x43267a[_0xaaae('0x55')],null))[_0xaaae('0x32')](respondWithResult(_0x20dee5,null))[_0xaaae('0x24')](handleError(_0x20dee5,null));};exports['addLogo']=function(_0x177313,_0x49f3b3,_0x10e76b){if(_0x177313[_0xaaae('0x56')]&&_0x177313[_0xaaae('0x56')]['filename']){_0x177313[_0xaaae('0x55')][_0xaaae('0x57')]=_0x177313[_0xaaae('0x56')][_0xaaae('0x58')];}return db[_0xaaae('0x4c')][_0xaaae('0x54')]({'where':{'id':_0x177313[_0xaaae('0x51')]['id']}})['then'](handleEntityNotFound(_0x49f3b3,null))[_0xaaae('0x32')](saveUpdates(_0x177313[_0xaaae('0x55')],null))[_0xaaae('0x32')](respondWithResult(_0x49f3b3,null))[_0xaaae('0x24')](handleError(_0x49f3b3,null));};exports[_0xaaae('0x59')]=function(_0x28918a,_0x8571f4,_0x5d777b){if(_0x28918a[_0xaaae('0x56')]&&_0x28918a['file'][_0xaaae('0x58')]){_0x28918a['body']['loginLogo']=_0x28918a[_0xaaae('0x56')][_0xaaae('0x58')];}return db['Setting']['find']({'where':{'id':_0x28918a['params']['id']}})[_0xaaae('0x32')](handleEntityNotFound(_0x8571f4,null))[_0xaaae('0x32')](saveUpdates(_0x28918a[_0xaaae('0x55')],null))[_0xaaae('0x32')](respondWithResult(_0x8571f4,null))[_0xaaae('0x24')](handleError(_0x8571f4,null));};var utilLicense=require('../../config/license/util');exports[_0xaaae('0x5a')]=function(_0x21ca60,_0x3ce1bc,_0xce1f97){var _0x393d63=_0xaaae('0x5b');var _0x35a9ab={'custom':![]};return utilLicense[_0xaaae('0x5c')]()['then'](function(_0x50b555){if(_0x50b555){_0x35a9ab=_0x50b555;}return db[_0xaaae('0x4c')]['find']({'where':{'id':_0x21ca60[_0xaaae('0x51')]['id']},'attributes':[_0xaaae('0x57'),_0xaaae('0x5d'),'preferred','favicon','defaultLogo',_0xaaae('0x5e'),'defaultPreferred',_0xaaae('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x3ce1bc,null))['then'](function(_0x5cf9fa){if(_0x5cf9fa){var _0x1bb71e=_0x5cf9fa[_0xaaae('0x57')]&&fs[_0xaaae('0x60')](path[_0xaaae('0x61')](config['root'],_0x393d63,_[_0xaaae('0x62')](_0x5cf9fa['logo'])))?path[_0xaaae('0x61')](config[_0xaaae('0x63')],_0x393d63,_[_0xaaae('0x62')](_0x5cf9fa['logo'])):path['join'](config[_0xaaae('0x63')],_0x393d63,_[_0xaaae('0x62')](_0xaaae('0x64')));var _0x27d28c=_0xaaae('0x65')+_[_0xaaae('0x66')](_0xaaae('0x57'));if(_0x5cf9fa[_0x27d28c]||!_0x35a9ab[_0xaaae('0x67')]){_0x1bb71e=path[_0xaaae('0x61')](config[_0xaaae('0x63')],_0x393d63,_['toLower'](_0xaaae('0x64')));}if(!fs[_0xaaae('0x60')](_0x1bb71e)){throw new db[(_0xaaae('0x68'))][(_0xaaae('0x69'))](_[_0xaaae('0x66')]('logo')+_0xaaae('0x6a'));}return _0x3ce1bc['download'](_0x1bb71e);}})[_0xaaae('0x24')](handleError(_0x3ce1bc,null));};var utilLicense=require(_0xaaae('0x17'));exports[_0xaaae('0x6b')]=function(_0x33e0c6,_0x238859,_0x41bef1){var _0x277ecb=_0xaaae('0x5b');var _0x16ca51={'custom':![]};return utilLicense[_0xaaae('0x5c')]()['then'](function(_0x3acd04){if(_0x3acd04){_0x16ca51=_0x3acd04;}return db[_0xaaae('0x4c')]['find']({'where':{'id':_0x33e0c6[_0xaaae('0x51')]['id']},'attributes':[_0xaaae('0x57'),_0xaaae('0x5d'),_0xaaae('0x6c'),_0xaaae('0x6d'),'defaultLogo','defaultLoginLogo',_0xaaae('0x6e'),_0xaaae('0x5f')],'raw':!![]});})[_0xaaae('0x32')](handleEntityNotFound(_0x238859,null))['then'](function(_0x20b027){if(_0x20b027){var _0x4721ec=_0x20b027[_0xaaae('0x5d')]&&fs[_0xaaae('0x60')](path[_0xaaae('0x61')](config[_0xaaae('0x63')],_0x277ecb,_[_0xaaae('0x62')](_0x20b027[_0xaaae('0x5d')])))?path[_0xaaae('0x61')](config[_0xaaae('0x63')],_0x277ecb,_[_0xaaae('0x62')](_0x20b027[_0xaaae('0x5d')])):path[_0xaaae('0x61')](config[_0xaaae('0x63')],_0x277ecb,_['toLower'](_0xaaae('0x6f')));var _0xd7fa02=_0xaaae('0x65')+_['upperFirst'](_0xaaae('0x5d'));if(_0x20b027[_0xd7fa02]||!_0x16ca51[_0xaaae('0x67')]){_0x4721ec=path[_0xaaae('0x61')](config[_0xaaae('0x63')],_0x277ecb,_[_0xaaae('0x62')](_0xaaae('0x6f')));}if(!fs[_0xaaae('0x60')](_0x4721ec)){throw new db[(_0xaaae('0x68'))][(_0xaaae('0x69'))](_[_0xaaae('0x66')](_0xaaae('0x5d'))+_0xaaae('0x6a'));}return _0x238859[_0xaaae('0x70')](_0x4721ec);}})['catch'](handleError(_0x238859,null));};exports[_0xaaae('0x71')]=function(_0x1d99e9,_0x47a684){return db[_0xaaae('0x4c')][_0xaaae('0x54')]({'where':{'id':_0x1d99e9[_0xaaae('0x51')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x47a684,null))[_0xaaae('0x24')](handleError(_0x47a684,null));};exports[_0xaaae('0x72')]=function(_0x2efab4,_0x4bd14b,_0x2f7fcb){if(_0x2efab4[_0xaaae('0x56')]&&_0x2efab4[_0xaaae('0x56')][_0xaaae('0x58')]){_0x2efab4['body'][_0xaaae('0x6c')]=_0x2efab4[_0xaaae('0x56')][_0xaaae('0x58')];}return db[_0xaaae('0x4c')][_0xaaae('0x54')]({'where':{'id':_0x2efab4[_0xaaae('0x51')]['id']}})['then'](handleEntityNotFound(_0x4bd14b,null))['then'](saveUpdates(_0x2efab4[_0xaaae('0x55')],null))['then'](respondWithResult(_0x4bd14b,null))[_0xaaae('0x24')](handleError(_0x4bd14b,null));};var utilLicense=require(_0xaaae('0x17'));exports[_0xaaae('0x73')]=function(_0x41ba44,_0x39d07c,_0x196b36){var _0x1517f2='server/files/images/logos';var _0x32f7f0={'custom':![]};return utilLicense[_0xaaae('0x5c')]()[_0xaaae('0x32')](function(_0x24afd3){if(_0x24afd3){_0x32f7f0=_0x24afd3;}return db[_0xaaae('0x4c')][_0xaaae('0x54')]({'where':{'id':_0x41ba44[_0xaaae('0x51')]['id']},'attributes':[_0xaaae('0x57'),_0xaaae('0x5d'),_0xaaae('0x6c'),'favicon','defaultLogo',_0xaaae('0x5e'),_0xaaae('0x6e'),_0xaaae('0x5f')],'raw':!![]});})[_0xaaae('0x32')](handleEntityNotFound(_0x39d07c,null))[_0xaaae('0x32')](function(_0xea492){if(_0xea492){var _0x15da00=_0xea492[_0xaaae('0x6c')]&&fs[_0xaaae('0x60')](path['join'](config['root'],_0x1517f2,_[_0xaaae('0x62')](_0xea492[_0xaaae('0x6c')])))?path['join'](config[_0xaaae('0x63')],_0x1517f2,_[_0xaaae('0x62')](_0xea492['preferred'])):path[_0xaaae('0x61')](config['root'],_0x1517f2,_[_0xaaae('0x62')](_0xaaae('0x74')));var _0x2a3b2c=_0xaaae('0x65')+_[_0xaaae('0x66')](_0xaaae('0x6c'));if(_0xea492[_0x2a3b2c]||!_0x32f7f0[_0xaaae('0x67')]||!_0x32f7f0[_0xaaae('0x6c')]){_0x15da00=path['join'](config['root'],_0x1517f2,_[_0xaaae('0x62')]('default_preferred.png'));}if(!fs[_0xaaae('0x60')](_0x15da00)){throw new db[(_0xaaae('0x68'))][(_0xaaae('0x69'))](_[_0xaaae('0x66')]('preferred')+_0xaaae('0x6a'));}return _0x39d07c[_0xaaae('0x70')](_0x15da00);}})[_0xaaae('0x24')](handleError(_0x39d07c,null));};exports[_0xaaae('0x75')]=function(_0x5c4684,_0x315182,_0x14b5fc){if(_0x5c4684[_0xaaae('0x56')]&&_0x5c4684[_0xaaae('0x56')][_0xaaae('0x58')]){_0x5c4684[_0xaaae('0x55')][_0xaaae('0x6d')]=_0x5c4684['file'][_0xaaae('0x58')];}return db[_0xaaae('0x4c')][_0xaaae('0x54')]({'where':{'id':_0x5c4684[_0xaaae('0x51')]['id']}})[_0xaaae('0x32')](handleEntityNotFound(_0x315182,null))[_0xaaae('0x32')](saveUpdates(_0x5c4684[_0xaaae('0x55')],null))[_0xaaae('0x32')](respondWithResult(_0x315182,null))['catch'](handleError(_0x315182,null));};var utilLicense=require('../../config/license/util');exports[_0xaaae('0x76')]=function(_0x396204,_0x966338,_0x489388){var _0x3ba047=_0xaaae('0x5b');var _0x6dc4ee={'custom':![]};return utilLicense[_0xaaae('0x5c')]()['then'](function(_0x5ad99c){if(_0x5ad99c){_0x6dc4ee=_0x5ad99c;}return db['Setting'][_0xaaae('0x54')]({'where':{'id':_0x396204[_0xaaae('0x51')]['id']},'attributes':['logo',_0xaaae('0x5d'),_0xaaae('0x6c'),_0xaaae('0x6d'),_0xaaae('0x77'),_0xaaae('0x5e'),_0xaaae('0x6e'),_0xaaae('0x5f')],'raw':!![]});})[_0xaaae('0x32')](handleEntityNotFound(_0x966338,null))['then'](function(_0xd21d03){if(_0xd21d03){var _0x2ff5f4=_0xd21d03[_0xaaae('0x6d')]&&fs[_0xaaae('0x60')](path[_0xaaae('0x61')](config[_0xaaae('0x63')],_0x3ba047,_['toLower'](_0xd21d03[_0xaaae('0x6d')])))?path[_0xaaae('0x61')](config[_0xaaae('0x63')],_0x3ba047,_[_0xaaae('0x62')](_0xd21d03[_0xaaae('0x6d')])):path[_0xaaae('0x61')](config[_0xaaae('0x63')],_0x3ba047,_[_0xaaae('0x62')](_0xaaae('0x78')));var _0x3f5a50='default'+_[_0xaaae('0x66')](_0xaaae('0x6d'));if(_0xd21d03[_0x3f5a50]||!_0x6dc4ee[_0xaaae('0x67')]){_0x2ff5f4=path['join'](config['root'],_0x3ba047,_['toLower'](_0xaaae('0x78')));}if(!fs['existsSync'](_0x2ff5f4)){throw new db[(_0xaaae('0x68'))][(_0xaaae('0x69'))](_[_0xaaae('0x66')]('favicon')+_0xaaae('0x6a'));}return _0x966338[_0xaaae('0x70')](_0x2ff5f4);}})[_0xaaae('0x24')](handleError(_0x966338,null));};exports[_0xaaae('0x79')]=function(_0x2bf55a,_0xf96e76){var _0x18dd08={'offset':moment()['utcOffset']()};_0x18dd08[_0xaaae('0x7a')]=moment()[_0xaaae('0x7b')](_0x18dd08['offset'])['format'](_0xaaae('0x7c'));return _0xf96e76[_0xaaae('0x27')](0xc8)[_0xaaae('0x35')](_0x18dd08);}; \ No newline at end of file +var _0xf9a6=['code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','stack','name','index','map','Setting','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','keys','rawAttributes','length','include','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','upperFirst','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c2c8f,_0x2812fc){var _0x1e1a39=function(_0x45babd){while(--_0x45babd){_0x1c2c8f['push'](_0x1c2c8f['shift']());}};_0x1e1a39(++_0x2812fc);}(_0xf9a6,0xd8));var _0x6f9a=function(_0x466f86,_0x3fa609){_0x466f86=_0x466f86-0x0;var _0x371d6a=_0xf9a6[_0x466f86];return _0x371d6a;};'use strict';var emlformat=require(_0x6f9a('0x0'));var rimraf=require(_0x6f9a('0x1'));var zipdir=require(_0x6f9a('0x2'));var jsonpatch=require(_0x6f9a('0x3'));var rp=require(_0x6f9a('0x4'));var moment=require('moment');var BPromise=require(_0x6f9a('0x5'));var Mustache=require(_0x6f9a('0x6'));var util=require('util');var path=require(_0x6f9a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6f9a('0x8'));var fs=require('fs');var fs_extra=require(_0x6f9a('0x9'));var _=require(_0x6f9a('0xa'));var squel=require(_0x6f9a('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f9a('0xc'));var deskjs=require(_0x6f9a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f9a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6f9a('0xf'));var as=require(_0x6f9a('0x10'));var hardwareService=require(_0x6f9a('0x11'));var logger=require(_0x6f9a('0x12'))(_0x6f9a('0x13'));var utils=require('../../config/utils');var config=require(_0x6f9a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f9a('0x15'))['db'];var jayson=require(_0x6f9a('0x16'));var client=jayson[_0x6f9a('0x17')][_0x6f9a('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4d98d7,_0x109ff5,_0x286cde,_0x13295a){return new BPromise(function(_0xc6ee81,_0x377646){var _0x4d811f=_0x13295a||client;return _0x4d811f[_0x6f9a('0x19')](_0x4d98d7,_0x286cde)[_0x6f9a('0x1a')](function(_0x1bf480){logger[_0x6f9a('0x1b')](_0x6f9a('0x1c'),_0x109ff5,_0x6f9a('0x1d'));logger[_0x6f9a('0x1e')](_0x6f9a('0x1f'),_0x109ff5,_0x6f9a('0x1d'),JSON[_0x6f9a('0x20')](_0x1bf480));if(_0x1bf480[_0x6f9a('0x21')]){if(_0x1bf480['error'][_0x6f9a('0x22')]===0x1f4){logger[_0x6f9a('0x21')]('Setting,\x20%s,\x20%s',_0x109ff5,_0x1bf480['error'][_0x6f9a('0x23')]);return _0x377646(_0x1bf480[_0x6f9a('0x21')][_0x6f9a('0x23')]);}logger[_0x6f9a('0x21')](_0x6f9a('0x1c'),_0x109ff5,_0x1bf480[_0x6f9a('0x21')]['message']);return _0xc6ee81(_0x1bf480[_0x6f9a('0x21')][_0x6f9a('0x23')]);}else{logger['info'](_0x6f9a('0x1c'),_0x109ff5,_0x6f9a('0x1d'));_0xc6ee81(_0x1bf480['result']['message']);}})[_0x6f9a('0x24')](function(_0x3687fd){logger[_0x6f9a('0x21')](_0x6f9a('0x1c'),_0x109ff5,_0x3687fd);_0x377646(_0x3687fd);});});}function respondWithStatusCode(_0x264fcb,_0x3e9363){_0x3e9363=_0x3e9363||0xcc;return function(_0x40a075){if(_0x40a075){return _0x264fcb[_0x6f9a('0x25')](_0x3e9363);}return _0x264fcb[_0x6f9a('0x26')](_0x3e9363)[_0x6f9a('0x27')]();};}function respondWithResult(_0x6ca0aa,_0x22aa95){_0x22aa95=_0x22aa95||0xc8;return function(_0x60e863){if(_0x60e863){return _0x6ca0aa[_0x6f9a('0x26')](_0x22aa95)[_0x6f9a('0x28')](_0x60e863);}};}function respondWithFilteredResult(_0x452cc2,_0x1cfcc0){return function(_0x568ef6){if(_0x568ef6){var _0x47f7b3=typeof _0x1cfcc0[_0x6f9a('0x29')]===_0x6f9a('0x2a')&&typeof _0x1cfcc0[_0x6f9a('0x2b')]==='undefined';var _0x4e91de=_0x568ef6[_0x6f9a('0x2c')];var _0x579a36=_0x47f7b3?0x0:_0x1cfcc0[_0x6f9a('0x29')];var _0x169f7a=_0x47f7b3?_0x568ef6[_0x6f9a('0x2c')]:_0x1cfcc0[_0x6f9a('0x29')]+_0x1cfcc0['limit'];var _0x5758c4;if(_0x169f7a>=_0x4e91de){_0x169f7a=_0x4e91de;_0x5758c4=0xc8;}else{_0x5758c4=0xce;}_0x452cc2['status'](_0x5758c4);return _0x452cc2['set'](_0x6f9a('0x2d'),_0x579a36+'-'+_0x169f7a+'/'+_0x4e91de)['json'](_0x568ef6);}return null;};}function patchUpdates(_0x171587){return function(_0x41cb42){try{jsonpatch[_0x6f9a('0x2e')](_0x41cb42,_0x171587,!![]);}catch(_0x4f179a){return BPromise[_0x6f9a('0x2f')](_0x4f179a);}return _0x41cb42['save']();};}function saveUpdates(_0x813ff0,_0x585c19){return function(_0x578dd5){if(_0x578dd5){return _0x578dd5[_0x6f9a('0x30')](_0x813ff0)['then'](function(_0x384cab){return _0x384cab;});}return null;};}function removeEntity(_0x1c4ae4,_0x3199d1){return function(_0x506453){if(_0x506453){return _0x506453[_0x6f9a('0x31')]()['then'](function(){_0x1c4ae4[_0x6f9a('0x26')](0xcc)[_0x6f9a('0x27')]();});}};}function handleEntityNotFound(_0x1c2115,_0x38ce6d){return function(_0x3002b8){if(!_0x3002b8){_0x1c2115['sendStatus'](0x194);}return _0x3002b8;};}function handleError(_0x3a695f,_0x133157){_0x133157=_0x133157||0x1f4;return function(_0x3abe21){logger[_0x6f9a('0x21')](_0x3abe21[_0x6f9a('0x32')]);if(_0x3abe21[_0x6f9a('0x33')]){delete _0x3abe21['name'];}_0x3a695f['status'](_0x133157)['send'](_0x3abe21);};}exports[_0x6f9a('0x34')]=function(_0x4b552d,_0x7c637c){var _0x407b1f={},_0x3c2eee={},_0x4862ec={'count':0x0,'rows':[]};var _0x83682f=_[_0x6f9a('0x35')](db[_0x6f9a('0x36')]['rawAttributes'],function(_0x50d731){return{'name':_0x50d731[_0x6f9a('0x37')],'type':_0x50d731[_0x6f9a('0x38')][_0x6f9a('0x39')]};});_0x3c2eee[_0x6f9a('0x3a')]=_[_0x6f9a('0x35')](_0x83682f,_0x6f9a('0x33'));_0x3c2eee[_0x6f9a('0x3b')]=_['keys'](_0x4b552d[_0x6f9a('0x3b')]);_0x3c2eee[_0x6f9a('0x3c')]=_['intersection'](_0x3c2eee['model'],_0x3c2eee[_0x6f9a('0x3b')]);_0x407b1f['attributes']=_[_0x6f9a('0x3d')](_0x3c2eee[_0x6f9a('0x3a')],qs[_0x6f9a('0x3e')](_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x3e')]));_0x407b1f[_0x6f9a('0x3f')]=_0x407b1f[_0x6f9a('0x3f')]['length']?_0x407b1f[_0x6f9a('0x3f')]:_0x3c2eee[_0x6f9a('0x3a')];if(!_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x40')](_0x6f9a('0x41'))){_0x407b1f[_0x6f9a('0x2b')]=qs['limit'](_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x2b')]);_0x407b1f['offset']=qs[_0x6f9a('0x29')](_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x29')]);}_0x407b1f[_0x6f9a('0x42')]=qs[_0x6f9a('0x43')](_0x4b552d[_0x6f9a('0x3b')]['sort']);_0x407b1f[_0x6f9a('0x44')]=qs['filters'](_[_0x6f9a('0x45')](_0x4b552d[_0x6f9a('0x3b')],_0x3c2eee[_0x6f9a('0x3c')]),_0x83682f);if(_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x46')]){_0x407b1f[_0x6f9a('0x44')]=_[_0x6f9a('0x47')](_0x407b1f[_0x6f9a('0x44')],{'$or':_['map'](_0x83682f,function(_0x388d3a){if(_0x388d3a['type']!==_0x6f9a('0x48')){var _0x2fee1c={};_0x2fee1c[_0x388d3a[_0x6f9a('0x33')]]={'$like':'%'+_0x4b552d['query']['filter']+'%'};return _0x2fee1c;}})});}_0x407b1f=_[_0x6f9a('0x47')]({},_0x407b1f,_0x4b552d['options']);var _0x588da9={'where':_0x407b1f['where']};return db['Setting']['count'](_0x588da9)[_0x6f9a('0x1a')](function(_0x4e01f0){_0x4862ec[_0x6f9a('0x2c')]=_0x4e01f0;if(_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x49')]){_0x407b1f['include']=[{'all':!![]}];}return db['Setting'][_0x6f9a('0x4a')](_0x407b1f);})[_0x6f9a('0x1a')](function(_0x73f6d5){_0x4862ec[_0x6f9a('0x4b')]=_0x73f6d5;return _0x4862ec;})['then'](respondWithFilteredResult(_0x7c637c,_0x407b1f))[_0x6f9a('0x24')](handleError(_0x7c637c,null));};exports['show']=function(_0x7aa81e,_0x3e6e5c){var _0x1c5c34={'raw':![],'where':{'id':_0x7aa81e[_0x6f9a('0x4c')]['id']}},_0x5ae309={};_0x5ae309[_0x6f9a('0x3a')]=_[_0x6f9a('0x4d')](db[_0x6f9a('0x36')][_0x6f9a('0x4e')]);_0x5ae309[_0x6f9a('0x3b')]=_['keys'](_0x7aa81e[_0x6f9a('0x3b')]);_0x5ae309['filters']=_['intersection'](_0x5ae309[_0x6f9a('0x3a')],_0x5ae309['query']);_0x1c5c34[_0x6f9a('0x3f')]=_['intersection'](_0x5ae309[_0x6f9a('0x3a')],qs[_0x6f9a('0x3e')](_0x7aa81e[_0x6f9a('0x3b')][_0x6f9a('0x3e')]));_0x1c5c34[_0x6f9a('0x3f')]=_0x1c5c34[_0x6f9a('0x3f')][_0x6f9a('0x4f')]?_0x1c5c34[_0x6f9a('0x3f')]:_0x5ae309['model'];if(_0x7aa81e[_0x6f9a('0x3b')][_0x6f9a('0x49')]){_0x1c5c34[_0x6f9a('0x50')]=[{'all':!![]}];}_0x1c5c34=_[_0x6f9a('0x47')]({},_0x1c5c34,_0x7aa81e[_0x6f9a('0x51')]);return db[_0x6f9a('0x36')][_0x6f9a('0x52')](_0x1c5c34)['then'](handleEntityNotFound(_0x3e6e5c,null))[_0x6f9a('0x1a')](respondWithResult(_0x3e6e5c,null))[_0x6f9a('0x24')](handleError(_0x3e6e5c,null));};exports['update']=function(_0x37fd1a,_0x47e122){if(_0x37fd1a[_0x6f9a('0x53')]['id']){delete _0x37fd1a[_0x6f9a('0x53')]['id'];}return db[_0x6f9a('0x36')]['find']({'where':{'id':_0x37fd1a[_0x6f9a('0x4c')]['id']}})[_0x6f9a('0x1a')](handleEntityNotFound(_0x47e122,null))[_0x6f9a('0x1a')](saveUpdates(_0x37fd1a[_0x6f9a('0x53')],null))[_0x6f9a('0x1a')](respondWithResult(_0x47e122,null))[_0x6f9a('0x24')](handleError(_0x47e122,null));};exports[_0x6f9a('0x54')]=function(_0x1605ef,_0x9ca14e,_0x578ea4){if(_0x1605ef[_0x6f9a('0x55')]&&_0x1605ef['file'][_0x6f9a('0x56')]){_0x1605ef[_0x6f9a('0x53')][_0x6f9a('0x57')]=_0x1605ef[_0x6f9a('0x55')]['filename'];}return db[_0x6f9a('0x36')]['find']({'where':{'id':_0x1605ef[_0x6f9a('0x4c')]['id']}})[_0x6f9a('0x1a')](handleEntityNotFound(_0x9ca14e,null))[_0x6f9a('0x1a')](saveUpdates(_0x1605ef[_0x6f9a('0x53')],null))[_0x6f9a('0x1a')](respondWithResult(_0x9ca14e,null))[_0x6f9a('0x24')](handleError(_0x9ca14e,null));};exports[_0x6f9a('0x58')]=function(_0x3b44cf,_0x4d3784,_0x3fbd18){if(_0x3b44cf[_0x6f9a('0x55')]&&_0x3b44cf[_0x6f9a('0x55')][_0x6f9a('0x56')]){_0x3b44cf[_0x6f9a('0x53')][_0x6f9a('0x59')]=_0x3b44cf[_0x6f9a('0x55')]['filename'];}return db[_0x6f9a('0x36')][_0x6f9a('0x52')]({'where':{'id':_0x3b44cf[_0x6f9a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d3784,null))['then'](saveUpdates(_0x3b44cf[_0x6f9a('0x53')],null))['then'](respondWithResult(_0x4d3784,null))[_0x6f9a('0x24')](handleError(_0x4d3784,null));};var utilLicense=require(_0x6f9a('0x5a'));exports['getLogo']=function(_0x2b1c22,_0x33c3f0,_0x171c2f){var _0xa57da3=_0x6f9a('0x5b');var _0x1ca292={'custom':![]};return utilLicense[_0x6f9a('0x5c')]()[_0x6f9a('0x1a')](function(_0x3d7a0d){if(_0x3d7a0d){_0x1ca292=_0x3d7a0d;}return db[_0x6f9a('0x36')][_0x6f9a('0x52')]({'where':{'id':_0x2b1c22[_0x6f9a('0x4c')]['id']},'attributes':['logo',_0x6f9a('0x59'),_0x6f9a('0x5d'),_0x6f9a('0x5e'),_0x6f9a('0x5f'),_0x6f9a('0x60'),_0x6f9a('0x61'),_0x6f9a('0x62')],'raw':!![]});})[_0x6f9a('0x1a')](handleEntityNotFound(_0x33c3f0,null))[_0x6f9a('0x1a')](function(_0x125929){if(_0x125929){var _0xa84a9b=_0x125929[_0x6f9a('0x57')]&&fs[_0x6f9a('0x63')](path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xa57da3,_['toLower'](_0x125929['logo'])))?path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xa57da3,_[_0x6f9a('0x66')](_0x125929[_0x6f9a('0x57')])):path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xa57da3,_[_0x6f9a('0x66')](_0x6f9a('0x67')));var _0x20ef7f=_0x6f9a('0x68')+_['upperFirst']('logo');if(_0x125929[_0x20ef7f]||!_0x1ca292[_0x6f9a('0x69')]){_0xa84a9b=path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xa57da3,_[_0x6f9a('0x66')]('default_logo.svg'));}if(!fs[_0x6f9a('0x63')](_0xa84a9b)){throw new db[(_0x6f9a('0x6a'))][(_0x6f9a('0x6b'))](_['upperFirst'](_0x6f9a('0x57'))+_0x6f9a('0x6c'));}return _0x33c3f0[_0x6f9a('0x6d')](_0xa84a9b);}})[_0x6f9a('0x24')](handleError(_0x33c3f0,null));};var utilLicense=require(_0x6f9a('0x5a'));exports[_0x6f9a('0x6e')]=function(_0x3586d4,_0x5eeff8,_0x5649d5){var _0x1c9fc3=_0x6f9a('0x5b');var _0x5ae2f6={'custom':![]};return utilLicense['getLicense']()[_0x6f9a('0x1a')](function(_0xfa28f0){if(_0xfa28f0){_0x5ae2f6=_0xfa28f0;}return db[_0x6f9a('0x36')][_0x6f9a('0x52')]({'where':{'id':_0x3586d4[_0x6f9a('0x4c')]['id']},'attributes':[_0x6f9a('0x57'),_0x6f9a('0x59'),_0x6f9a('0x5d'),_0x6f9a('0x5e'),_0x6f9a('0x5f'),'defaultLoginLogo',_0x6f9a('0x61'),_0x6f9a('0x62')],'raw':!![]});})[_0x6f9a('0x1a')](handleEntityNotFound(_0x5eeff8,null))['then'](function(_0x2dece4){if(_0x2dece4){var _0x5ccd5d=_0x2dece4[_0x6f9a('0x59')]&&fs[_0x6f9a('0x63')](path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x1c9fc3,_[_0x6f9a('0x66')](_0x2dece4[_0x6f9a('0x59')])))?path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x1c9fc3,_['toLower'](_0x2dece4[_0x6f9a('0x59')])):path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x1c9fc3,_[_0x6f9a('0x66')](_0x6f9a('0x6f')));var _0x52b1c0=_0x6f9a('0x68')+_[_0x6f9a('0x70')](_0x6f9a('0x59'));if(_0x2dece4[_0x52b1c0]||!_0x5ae2f6[_0x6f9a('0x69')]){_0x5ccd5d=path[_0x6f9a('0x64')](config['root'],_0x1c9fc3,_[_0x6f9a('0x66')](_0x6f9a('0x6f')));}if(!fs[_0x6f9a('0x63')](_0x5ccd5d)){throw new db[(_0x6f9a('0x6a'))][(_0x6f9a('0x6b'))](_['upperFirst'](_0x6f9a('0x59'))+'\x20not\x20found');}return _0x5eeff8['download'](_0x5ccd5d);}})[_0x6f9a('0x24')](handleError(_0x5eeff8,null));};exports[_0x6f9a('0x71')]=function(_0x3ae946,_0x4c0a00){return db['Setting']['find']({'where':{'id':_0x3ae946['params']['id']},'attributes':[_0x6f9a('0x72')]})[_0x6f9a('0x1a')](respondWithResult(_0x4c0a00,null))[_0x6f9a('0x24')](handleError(_0x4c0a00,null));};exports['addPreferred']=function(_0x173b6a,_0x51475a,_0x5a507c){if(_0x173b6a[_0x6f9a('0x55')]&&_0x173b6a[_0x6f9a('0x55')]['filename']){_0x173b6a['body'][_0x6f9a('0x5d')]=_0x173b6a['file'][_0x6f9a('0x56')];}return db['Setting'][_0x6f9a('0x52')]({'where':{'id':_0x173b6a[_0x6f9a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51475a,null))[_0x6f9a('0x1a')](saveUpdates(_0x173b6a['body'],null))[_0x6f9a('0x1a')](respondWithResult(_0x51475a,null))[_0x6f9a('0x24')](handleError(_0x51475a,null));};var utilLicense=require(_0x6f9a('0x5a'));exports['getPreferred']=function(_0x18d5c1,_0x487bda,_0x11da7b){var _0x72cc98=_0x6f9a('0x5b');var _0x17a64c={'custom':![]};return utilLicense[_0x6f9a('0x5c')]()[_0x6f9a('0x1a')](function(_0x54d88f){if(_0x54d88f){_0x17a64c=_0x54d88f;}return db['Setting'][_0x6f9a('0x52')]({'where':{'id':_0x18d5c1[_0x6f9a('0x4c')]['id']},'attributes':['logo',_0x6f9a('0x59'),'preferred',_0x6f9a('0x5e'),_0x6f9a('0x5f'),_0x6f9a('0x60'),_0x6f9a('0x61'),_0x6f9a('0x62')],'raw':!![]});})[_0x6f9a('0x1a')](handleEntityNotFound(_0x487bda,null))[_0x6f9a('0x1a')](function(_0x1715c6){if(_0x1715c6){var _0x471da0=_0x1715c6[_0x6f9a('0x5d')]&&fs[_0x6f9a('0x63')](path['join'](config['root'],_0x72cc98,_[_0x6f9a('0x66')](_0x1715c6[_0x6f9a('0x5d')])))?path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x72cc98,_[_0x6f9a('0x66')](_0x1715c6['preferred'])):path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x72cc98,_['toLower'](_0x6f9a('0x73')));var _0x959f17=_0x6f9a('0x68')+_[_0x6f9a('0x70')](_0x6f9a('0x5d'));if(_0x1715c6[_0x959f17]||!_0x17a64c[_0x6f9a('0x69')]||!_0x17a64c[_0x6f9a('0x5d')]){_0x471da0=path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x72cc98,_[_0x6f9a('0x66')](_0x6f9a('0x73')));}if(!fs['existsSync'](_0x471da0)){throw new db[(_0x6f9a('0x6a'))][(_0x6f9a('0x6b'))](_[_0x6f9a('0x70')]('preferred')+_0x6f9a('0x6c'));}return _0x487bda[_0x6f9a('0x6d')](_0x471da0);}})['catch'](handleError(_0x487bda,null));};exports[_0x6f9a('0x74')]=function(_0xc60dfd,_0x4f034e,_0x5ef4d7){if(_0xc60dfd[_0x6f9a('0x55')]&&_0xc60dfd['file'][_0x6f9a('0x56')]){_0xc60dfd[_0x6f9a('0x53')][_0x6f9a('0x5e')]=_0xc60dfd[_0x6f9a('0x55')]['filename'];}return db[_0x6f9a('0x36')][_0x6f9a('0x52')]({'where':{'id':_0xc60dfd[_0x6f9a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4f034e,null))[_0x6f9a('0x1a')](saveUpdates(_0xc60dfd[_0x6f9a('0x53')],null))[_0x6f9a('0x1a')](respondWithResult(_0x4f034e,null))[_0x6f9a('0x24')](handleError(_0x4f034e,null));};var utilLicense=require('../../config/license/util');exports[_0x6f9a('0x75')]=function(_0x335c6b,_0x298134,_0x50f91a){var _0xc82ce2='server/files/images/logos';var _0x2d77a6={'custom':![]};return utilLicense[_0x6f9a('0x5c')]()['then'](function(_0x262781){if(_0x262781){_0x2d77a6=_0x262781;}return db[_0x6f9a('0x36')]['find']({'where':{'id':_0x335c6b[_0x6f9a('0x4c')]['id']},'attributes':[_0x6f9a('0x57'),_0x6f9a('0x59'),_0x6f9a('0x5d'),_0x6f9a('0x5e'),_0x6f9a('0x5f'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x6f9a('0x1a')](handleEntityNotFound(_0x298134,null))[_0x6f9a('0x1a')](function(_0x302b70){if(_0x302b70){var _0x5c916e=_0x302b70[_0x6f9a('0x5e')]&&fs['existsSync'](path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xc82ce2,_[_0x6f9a('0x66')](_0x302b70['favicon'])))?path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xc82ce2,_['toLower'](_0x302b70['favicon'])):path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xc82ce2,_[_0x6f9a('0x66')](_0x6f9a('0x76')));var _0x3584c8='default'+_[_0x6f9a('0x70')](_0x6f9a('0x5e'));if(_0x302b70[_0x3584c8]||!_0x2d77a6['custom']){_0x5c916e=path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xc82ce2,_[_0x6f9a('0x66')](_0x6f9a('0x76')));}if(!fs[_0x6f9a('0x63')](_0x5c916e)){throw new db['Sequelize'][(_0x6f9a('0x6b'))](_[_0x6f9a('0x70')]('favicon')+_0x6f9a('0x6c'));}return _0x298134[_0x6f9a('0x6d')](_0x5c916e);}})['catch'](handleError(_0x298134,null));};exports[_0x6f9a('0x77')]=function(_0x5f415d,_0x1e2baf){var _0x2fa4d9={'offset':moment()['utcOffset']()};_0x2fa4d9[_0x6f9a('0x78')]=moment()[_0x6f9a('0x79')](_0x2fa4d9['offset'])[_0x6f9a('0x7a')](_0x6f9a('0x7b'));return _0x1e2baf['status'](0xc8)[_0x6f9a('0x7c')](_0x2fa4d9);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 24ed540..b6687bb 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x55ca,0x126));var _0xa55c=function(_0x52a2be,_0x4bd252){_0x52a2be=_0x52a2be-0x0;var _0x246f1d=_0x55ca[_0x52a2be];return _0x246f1d;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x55ca,0x126));var _0xa55c=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0x55ca[_0x4cd846];return _0x2f2a7d;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 5996960..76fc131 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 _0x7f3d=['raw','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSetting','find','options'];(function(_0x43d701,_0x50e7a0){var _0x3d5b45=function(_0x51324e){while(--_0x51324e){_0x43d701['push'](_0x43d701['shift']());}};_0x3d5b45(++_0x50e7a0);}(_0x7f3d,0x7e));var _0xd7f3=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0x7f3d[_0x680821];return _0x3f132c;};'use strict';var _=require(_0xd7f3('0x0'));var util=require(_0xd7f3('0x1'));var moment=require(_0xd7f3('0x2'));var BPromise=require(_0xd7f3('0x3'));var rs=require(_0xd7f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7f3('0x5'))['db'];var utils=require(_0xd7f3('0x6'));var logger=require(_0xd7f3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd7f3('0x8'));var client=jayson[_0xd7f3('0x9')][_0xd7f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359c9f,_0x15e5dd,_0x3afd06){return new BPromise(function(_0xad69da,_0x25e43b){return client['request'](_0x359c9f,_0x3afd06)[_0xd7f3('0xb')](function(_0x1e2605){logger[_0xd7f3('0xc')](_0xd7f3('0xd'),_0x15e5dd,_0xd7f3('0xe'));logger[_0xd7f3('0xf')](_0xd7f3('0x10'),_0x15e5dd,'request\x20sent',JSON[_0xd7f3('0x11')](_0x1e2605));if(_0x1e2605[_0xd7f3('0x12')]){if(_0x1e2605['error'][_0xd7f3('0x13')]===0x1f4){logger[_0xd7f3('0x12')](_0xd7f3('0xd'),_0x15e5dd,_0x1e2605[_0xd7f3('0x12')]['message']);return _0x25e43b(_0x1e2605[_0xd7f3('0x12')][_0xd7f3('0x14')]);}logger[_0xd7f3('0x12')](_0xd7f3('0xd'),_0x15e5dd,_0x1e2605[_0xd7f3('0x12')]['message']);return _0xad69da(_0x1e2605[_0xd7f3('0x12')][_0xd7f3('0x14')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x15e5dd,_0xd7f3('0xe'));_0xad69da(_0x1e2605['result'][_0xd7f3('0x14')]);}})['catch'](function(_0x2ec6b5){logger['error'](_0xd7f3('0xd'),_0x15e5dd,_0x2ec6b5);_0x25e43b(_0x2ec6b5);});});}exports[_0xd7f3('0x15')]=function(_0xc67717){var _0x2a78f2=this;return new Promise(function(_0x5cc7f2,_0x581bc6){return db['Setting'][_0xd7f3('0x16')]({'raw':_0xc67717['options']?_0xc67717[_0xd7f3('0x17')][_0xd7f3('0x18')]===undefined?!![]:![]:!![],'where':_0xc67717[_0xd7f3('0x17')]?_0xc67717[_0xd7f3('0x17')][_0xd7f3('0x19')]||null:null,'attributes':_0xc67717[_0xd7f3('0x17')]?_0xc67717['options'][_0xd7f3('0x1a')]||null:null,'include':_0xc67717[_0xd7f3('0x17')]?_0xc67717[_0xd7f3('0x17')][_0xd7f3('0x1b')]?_['map'](_0xc67717[_0xd7f3('0x17')][_0xd7f3('0x1b')],function(_0x218a24){return{'model':db[_0x218a24[_0xd7f3('0x1c')]],'as':_0x218a24['as'],'attributes':_0x218a24[_0xd7f3('0x1a')],'include':_0x218a24[_0xd7f3('0x1b')]?_[_0xd7f3('0x1d')](_0x218a24[_0xd7f3('0x1b')],function(_0x29a2e7){return{'model':db[_0x29a2e7['model']],'as':_0x29a2e7['as'],'attributes':_0x29a2e7[_0xd7f3('0x1a')],'include':_0x29a2e7['include']?_['map'](_0x29a2e7[_0xd7f3('0x1b')],function(_0x3dca23){return{'model':db[_0x3dca23[_0xd7f3('0x1c')]],'as':_0x3dca23['as'],'attributes':_0x3dca23[_0xd7f3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd7f3('0xb')](function(_0x46214b){logger[_0xd7f3('0xc')](_0xd7f3('0x15'),_0xc67717);logger['debug'](_0xd7f3('0x15'),_0xc67717,JSON[_0xd7f3('0x11')](_0x46214b));_0x5cc7f2(_0x46214b);})['catch'](function(_0x17154d){logger[_0xd7f3('0x12')]('ShowSetting',_0x17154d[_0xd7f3('0x14')],_0xc67717);_0x581bc6(_0x2a78f2[_0xd7f3('0x12')](0x1f4,_0x17154d[_0xd7f3('0x14')]));});});}; \ No newline at end of file +var _0xa9ad=['jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','where','attributes','include','model','map','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x206137,_0x2a56c7){var _0x96c5f7=function(_0x3f72d7){while(--_0x3f72d7){_0x206137['push'](_0x206137['shift']());}};_0x96c5f7(++_0x2a56c7);}(_0xa9ad,0x1ca));var _0xda9a=function(_0x48102,_0x4e5030){_0x48102=_0x48102-0x0;var _0xbcbafa=_0xa9ad[_0x48102];return _0xbcbafa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda9a('0x0'));var BPromise=require(_0xda9a('0x1'));var rs=require(_0xda9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xda9a('0x4'))(_0xda9a('0x5'));var config=require(_0xda9a('0x6'));var jayson=require(_0xda9a('0x7'));var client=jayson[_0xda9a('0x8')][_0xda9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x251836,_0x55bbb6,_0x2dad19){return new BPromise(function(_0x4d29fa,_0x1785c4){return client['request'](_0x251836,_0x2dad19)[_0xda9a('0xa')](function(_0xcfd9fd){logger[_0xda9a('0xb')](_0xda9a('0xc'),_0x55bbb6,_0xda9a('0xd'));logger[_0xda9a('0xe')](_0xda9a('0xf'),_0x55bbb6,_0xda9a('0xd'),JSON[_0xda9a('0x10')](_0xcfd9fd));if(_0xcfd9fd[_0xda9a('0x11')]){if(_0xcfd9fd[_0xda9a('0x11')][_0xda9a('0x12')]===0x1f4){logger[_0xda9a('0x11')](_0xda9a('0xc'),_0x55bbb6,_0xcfd9fd[_0xda9a('0x11')][_0xda9a('0x13')]);return _0x1785c4(_0xcfd9fd['error'][_0xda9a('0x13')]);}logger[_0xda9a('0x11')]('Setting,\x20%s,\x20%s',_0x55bbb6,_0xcfd9fd['error'][_0xda9a('0x13')]);return _0x4d29fa(_0xcfd9fd['error'][_0xda9a('0x13')]);}else{logger[_0xda9a('0xb')](_0xda9a('0xc'),_0x55bbb6,_0xda9a('0xd'));_0x4d29fa(_0xcfd9fd[_0xda9a('0x14')][_0xda9a('0x13')]);}})[_0xda9a('0x15')](function(_0x249d4f){logger['error'](_0xda9a('0xc'),_0x55bbb6,_0x249d4f);_0x1785c4(_0x249d4f);});});}exports[_0xda9a('0x16')]=function(_0x45e83a){var _0x19fa32=this;return new Promise(function(_0x1e3dc7,_0x5cebb1){return db[_0xda9a('0x17')][_0xda9a('0x18')]({'raw':_0x45e83a[_0xda9a('0x19')]?_0x45e83a[_0xda9a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x45e83a[_0xda9a('0x19')]?_0x45e83a[_0xda9a('0x19')][_0xda9a('0x1a')]||null:null,'attributes':_0x45e83a[_0xda9a('0x19')]?_0x45e83a[_0xda9a('0x19')][_0xda9a('0x1b')]||null:null,'include':_0x45e83a['options']?_0x45e83a[_0xda9a('0x19')][_0xda9a('0x1c')]?_['map'](_0x45e83a[_0xda9a('0x19')]['include'],function(_0x5434c9){return{'model':db[_0x5434c9[_0xda9a('0x1d')]],'as':_0x5434c9['as'],'attributes':_0x5434c9[_0xda9a('0x1b')],'include':_0x5434c9[_0xda9a('0x1c')]?_[_0xda9a('0x1e')](_0x5434c9[_0xda9a('0x1c')],function(_0x262078){return{'model':db[_0x262078[_0xda9a('0x1d')]],'as':_0x262078['as'],'attributes':_0x262078['attributes'],'include':_0x262078[_0xda9a('0x1c')]?_[_0xda9a('0x1e')](_0x262078[_0xda9a('0x1c')],function(_0x20784d){return{'model':db[_0x20784d[_0xda9a('0x1d')]],'as':_0x20784d['as'],'attributes':_0x20784d[_0xda9a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xda9a('0xa')](function(_0x230193){logger['info'](_0xda9a('0x16'),_0x45e83a);logger[_0xda9a('0xe')](_0xda9a('0x16'),_0x45e83a,JSON[_0xda9a('0x10')](_0x230193));_0x1e3dc7(_0x230193);})['catch'](function(_0x416474){logger[_0xda9a('0x11')](_0xda9a('0x16'),_0x416474['message'],_0x45e83a);_0x5cebb1(_0x19fa32['error'](0x1f4,_0x416474['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 96b3200..9993e2f 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 _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x3e35e9,_0x343705){var _0x5a9829=function(_0x590aa6){while(--_0x590aa6){_0x3e35e9['push'](_0x3e35e9['shift']());}};_0x5a9829(++_0x343705);}(_0x326f,0xd1));var _0xf326=function(_0x328583,_0x8db747){_0x328583=_0x328583-0x0;var _0x32c8eb=_0x326f[_0x328583];return _0x32c8eb;};'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')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file +var _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x1d5b02,_0x41d9a5){var _0x442dd8=function(_0x2859dc){while(--_0x2859dc){_0x1d5b02['push'](_0x1d5b02['shift']());}};_0x442dd8(++_0x41d9a5);}(_0x53ec,0x192));var _0xc53e=function(_0x22d7e6,_0xa620e7){_0x22d7e6=_0x22d7e6-0x0;var _0x72bc58=_0x53ec[_0x22d7e6];return _0x72bc58;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index aec2a2f..39f280a 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 _0x5c40=['intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','skebby','plivo','clickatell','bandwidth','csc','infobip'];(function(_0x587bf2,_0x198c02){var _0x113268=function(_0x2af791){while(--_0x2af791){_0x587bf2['push'](_0x587bf2['shift']());}};_0x113268(++_0x198c02);}(_0x5c40,0x1bf));var _0x05c4=function(_0x4a5fda,_0x49433c){_0x4a5fda=_0x4a5fda-0x0;var _0x2d8ccd=_0x5c40[_0x4a5fda];return _0x2d8ccd;};'use strict';var Sequelize=require(_0x05c4('0x0'));var rs=require(_0x05c4('0x1'));module[_0x05c4('0x2')]={'name':{'type':Sequelize[_0x05c4('0x3')],'unique':_0x05c4('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x05c4('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x05c4('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x05c4('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x05c4('0x5')](_0x05c4('0x6'),_0x05c4('0x7'),'connectel','clicksend',_0x05c4('0x8'),_0x05c4('0x9'),_0x05c4('0xa'),_0x05c4('0xb'),_0x05c4('0xc'),_0x05c4('0xd'))},'accountSid':{'type':Sequelize[_0x05c4('0x3')]},'authId':{'type':Sequelize[_0x05c4('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x05c4('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x05c4('0x3')]},'password':{'type':Sequelize[_0x05c4('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x05c4('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x05c4('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x05c4('0x3')]},'notificationTemplate':{'type':Sequelize[_0x05c4('0xf')],'defaultValue':function(){return _0x05c4('0x10');}},'notificationSound':{'type':Sequelize[_0x05c4('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x05c4('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x05c4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x05c4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x05c4('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x05c4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x05c4('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x05c4('0x11')],'comment':_0x05c4('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x05c4('0xe')],'defaultValue':![],'comment':_0x05c4('0x13'),'set':function(_0x5d4e86){if(!_0x5d4e86)this[_0x05c4('0x14')](_0x05c4('0x15'),null);this[_0x05c4('0x14')](_0x05c4('0x16'),_0x5d4e86);}}}; \ No newline at end of file +var _0xd3fe=['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','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xd3fe,0x1d3));var _0xed3f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd3fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xed3f('0x0'));var rs=require(_0xed3f('0x1'));module[_0xed3f('0x2')]={'name':{'type':Sequelize[_0xed3f('0x3')],'unique':_0xed3f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xed3f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xed3f('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xed3f('0x3')],'defaultValue':function(){return rs[_0xed3f('0x5')]();}},'phone':{'type':Sequelize[_0xed3f('0x3')]},'type':{'type':Sequelize[_0xed3f('0x6')](_0xed3f('0x7'),_0xed3f('0x8'),_0xed3f('0x9'),_0xed3f('0xa'),_0xed3f('0xb'),_0xed3f('0xc'),'bandwidth',_0xed3f('0xd'),_0xed3f('0xe'),_0xed3f('0xf'))},'accountSid':{'type':Sequelize[_0xed3f('0x3')]},'authId':{'type':Sequelize[_0xed3f('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xed3f('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xed3f('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xed3f('0x3')]},'applicationId':{'type':Sequelize[_0xed3f('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xed3f('0x3')]},'deliveryReport':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0xed3f('0x3')]},'notificationTemplate':{'type':Sequelize[_0xed3f('0x11')],'defaultValue':function(){return _0xed3f('0x12');}},'notificationSound':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xed3f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed3f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xed3f('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed3f('0x13')],'comment':_0xed3f('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':![],'comment':_0xed3f('0x15'),'set':function(_0x57f577){if(!_0x57f577)this[_0xed3f('0x16')](_0xed3f('0x17'),null);this[_0xed3f('0x16')]('mandatoryDisposition',_0x57f577);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 02de8ab..2143715 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 _0xf4c6=['removeAnswers','notify','SmsApplication','account','applications','Applications','priority','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','From','MessageSid','skebby','from','sender','text','connectel','clicksend','messageId','message_id','plivo','infobip','results','csc','originatingAddress','segmentedMessage','bandwidth','refid','isNil','from\x20is\x20mandatory','mapKey','CmList','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','SmsMessage','dataValues','inspect','statusInt','requestid','status_code','groupName','DELIVERED','clickatell','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','include','rows','show','includeAll','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','SmsAccountId','getDispositions','findOne','Disposition','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers'];(function(_0x20a726,_0x1af270){var _0x3ee0b6=function(_0x353c54){while(--_0x353c54){_0x20a726['push'](_0x20a726['shift']());}};_0x3ee0b6(++_0x1af270);}(_0xf4c6,0x6d));var _0x6f4c=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0xf4c6[_0x210718];return _0x541bfc;};'use strict';var emlformat=require(_0x6f4c('0x0'));var rimraf=require(_0x6f4c('0x1'));var zipdir=require(_0x6f4c('0x2'));var jsonpatch=require(_0x6f4c('0x3'));var rp=require('request-promise');var moment=require(_0x6f4c('0x4'));var BPromise=require(_0x6f4c('0x5'));var Mustache=require(_0x6f4c('0x6'));var util=require(_0x6f4c('0x7'));var path=require(_0x6f4c('0x8'));var sox=require(_0x6f4c('0x9'));var csv=require(_0x6f4c('0xa'));var ejs=require(_0x6f4c('0xb'));var fs=require('fs');var fs_extra=require(_0x6f4c('0xc'));var _=require(_0x6f4c('0xd'));var squel=require(_0x6f4c('0xe'));var crypto=require(_0x6f4c('0xf'));var jsforce=require(_0x6f4c('0x10'));var deskjs=require(_0x6f4c('0x11'));var toCsv=require(_0x6f4c('0xa'));var querystring=require('querystring');var Papa=require(_0x6f4c('0x12'));var Redis=require(_0x6f4c('0x13'));var authService=require(_0x6f4c('0x14'));var qs=require(_0x6f4c('0x15'));var as=require(_0x6f4c('0x16'));var hardwareService=require(_0x6f4c('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x6f4c('0x18'));var config=require(_0x6f4c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f4c('0x1a'))['db'];config[_0x6f4c('0x1b')]=_[_0x6f4c('0x1c')](config['redis'],{'host':_0x6f4c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f4c('0x1b')]));require(_0x6f4c('0x1e'))['register'](socket);var jayson=require(_0x6f4c('0x1f'));var client=jayson[_0x6f4c('0x20')][_0x6f4c('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x222075,_0x28f26d,_0x13aed1,_0x373acf){return new BPromise(function(_0xe20fe3,_0x209b5b){var _0x16b66e=_0x373acf||client;return _0x16b66e[_0x6f4c('0x22')](_0x222075,_0x13aed1)[_0x6f4c('0x23')](function(_0x4a1f5e){logger[_0x6f4c('0x24')](_0x6f4c('0x25'),_0x28f26d,_0x6f4c('0x26'));logger[_0x6f4c('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x28f26d,_0x6f4c('0x26'),JSON[_0x6f4c('0x28')](_0x4a1f5e));if(_0x4a1f5e['error']){if(_0x4a1f5e[_0x6f4c('0x29')][_0x6f4c('0x2a')]===0x1f4){logger[_0x6f4c('0x29')]('SmsAccount,\x20%s,\x20%s',_0x28f26d,_0x4a1f5e[_0x6f4c('0x29')]['message']);return _0x209b5b(_0x4a1f5e[_0x6f4c('0x29')][_0x6f4c('0x2b')]);}logger[_0x6f4c('0x29')](_0x6f4c('0x25'),_0x28f26d,_0x4a1f5e[_0x6f4c('0x29')][_0x6f4c('0x2b')]);return _0xe20fe3(_0x4a1f5e[_0x6f4c('0x29')]['message']);}else{logger['info'](_0x6f4c('0x25'),_0x28f26d,_0x6f4c('0x26'));_0xe20fe3(_0x4a1f5e[_0x6f4c('0x2c')][_0x6f4c('0x2b')]);}})[_0x6f4c('0x2d')](function(_0x320caa){logger['error'](_0x6f4c('0x25'),_0x28f26d,_0x320caa);_0x209b5b(_0x320caa);});});}function respondWithStatusCode(_0x1c9bd3,_0x3fe03d){_0x3fe03d=_0x3fe03d||0xcc;return function(_0x138f3b){if(_0x138f3b){return _0x1c9bd3[_0x6f4c('0x2e')](_0x3fe03d);}return _0x1c9bd3[_0x6f4c('0x2f')](_0x3fe03d)[_0x6f4c('0x30')]();};}function respondWithResult(_0x4e4be2,_0x19813e){_0x19813e=_0x19813e||0xc8;return function(_0xe70f4c){if(_0xe70f4c){return _0x4e4be2[_0x6f4c('0x2f')](_0x19813e)[_0x6f4c('0x31')](_0xe70f4c);}};}function respondWithFilteredResult(_0x44c7ec,_0x4450b1){return function(_0x463116){if(_0x463116){var _0x30dfaf=typeof _0x4450b1[_0x6f4c('0x32')]==='undefined'&&typeof _0x4450b1[_0x6f4c('0x33')]===_0x6f4c('0x34');var _0x4bfb4f=_0x463116[_0x6f4c('0x35')];var _0x352ada=_0x30dfaf?0x0:_0x4450b1[_0x6f4c('0x32')];var _0x49261e=_0x30dfaf?_0x463116[_0x6f4c('0x35')]:_0x4450b1['offset']+_0x4450b1['limit'];var _0x298952;if(_0x49261e>=_0x4bfb4f){_0x49261e=_0x4bfb4f;_0x298952=0xc8;}else{_0x298952=0xce;}_0x44c7ec[_0x6f4c('0x2f')](_0x298952);return _0x44c7ec[_0x6f4c('0x36')]('Content-Range',_0x352ada+'-'+_0x49261e+'/'+_0x4bfb4f)[_0x6f4c('0x31')](_0x463116);}return null;};}function patchUpdates(_0x4f00b6){return function(_0x3bdd41){try{jsonpatch[_0x6f4c('0x37')](_0x3bdd41,_0x4f00b6,!![]);}catch(_0x120546){return BPromise['reject'](_0x120546);}return _0x3bdd41[_0x6f4c('0x38')]();};}function saveUpdates(_0xf03f2d,_0x431fb9){return function(_0x55c2dc){if(_0x55c2dc){return _0x55c2dc[_0x6f4c('0x39')](_0xf03f2d)[_0x6f4c('0x23')](function(_0x57a37b){return _0x57a37b;});}return null;};}function removeEntity(_0x13fb0d,_0x31ac15){return function(_0x30970b){if(_0x30970b){return _0x30970b[_0x6f4c('0x3a')]()[_0x6f4c('0x23')](function(){var _0x4e0d95=_0x30970b[_0x6f4c('0x3b')]({'plain':!![]});var _0x8ef858=_0x6f4c('0x3c');return db[_0x6f4c('0x3d')]['destroy']({'where':{'type':_0x8ef858,'resourceId':_0x4e0d95['id']}})[_0x6f4c('0x23')](function(){return _0x30970b;});})[_0x6f4c('0x23')](function(){_0x13fb0d[_0x6f4c('0x2f')](0xcc)[_0x6f4c('0x30')]();});}};}function handleEntityNotFound(_0xb89002,_0x24ce26){return function(_0x2580b4){if(!_0x2580b4){_0xb89002[_0x6f4c('0x2e')](0x194);}return _0x2580b4;};}function handleError(_0x1296fd,_0x1ca574){_0x1ca574=_0x1ca574||0x1f4;return function(_0x5a4624){logger[_0x6f4c('0x29')](_0x5a4624['stack']);if(_0x5a4624['name']){delete _0x5a4624[_0x6f4c('0x3e')];}_0x1296fd[_0x6f4c('0x2f')](_0x1ca574)[_0x6f4c('0x3f')](_0x5a4624);};}exports['index']=function(_0x5817ba,_0x58e2e5){var _0x11e5e7={'include':[{'model':db[_0x6f4c('0x40')],'as':_0x6f4c('0x41')}]},_0x30c000={},_0x4a16b2={'count':0x0,'rows':[]};var _0x3e2362=_[_0x6f4c('0x42')](db[_0x6f4c('0x43')][_0x6f4c('0x44')],function(_0x1d326a){return{'name':_0x1d326a[_0x6f4c('0x45')],'type':_0x1d326a['type'][_0x6f4c('0x46')]};});_0x30c000['model']=_[_0x6f4c('0x42')](_0x3e2362,_0x6f4c('0x3e'));_0x30c000[_0x6f4c('0x47')]=_[_0x6f4c('0x48')](_0x5817ba['query']);_0x30c000[_0x6f4c('0x49')]=_[_0x6f4c('0x4a')](_0x30c000[_0x6f4c('0x4b')],_0x30c000[_0x6f4c('0x47')]);_0x11e5e7[_0x6f4c('0x4c')]=_[_0x6f4c('0x4a')](_0x30c000[_0x6f4c('0x4b')],qs[_0x6f4c('0x4d')](_0x5817ba[_0x6f4c('0x47')]['fields']));_0x11e5e7['attributes']=_0x11e5e7[_0x6f4c('0x4c')][_0x6f4c('0x4e')]?_0x11e5e7[_0x6f4c('0x4c')]:_0x30c000[_0x6f4c('0x4b')];if(!_0x5817ba[_0x6f4c('0x47')][_0x6f4c('0x4f')](_0x6f4c('0x50'))){_0x11e5e7[_0x6f4c('0x33')]=qs[_0x6f4c('0x33')](_0x5817ba[_0x6f4c('0x47')][_0x6f4c('0x33')]);_0x11e5e7['offset']=qs[_0x6f4c('0x32')](_0x5817ba[_0x6f4c('0x47')][_0x6f4c('0x32')]);}_0x11e5e7[_0x6f4c('0x51')]=qs[_0x6f4c('0x52')](_0x5817ba['query'][_0x6f4c('0x52')]);_0x11e5e7[_0x6f4c('0x53')]=qs[_0x6f4c('0x49')](_['pick'](_0x5817ba[_0x6f4c('0x47')],_0x30c000[_0x6f4c('0x49')]),_0x3e2362);if(_0x5817ba['query'][_0x6f4c('0x54')]){_0x11e5e7[_0x6f4c('0x53')]=_['merge'](_0x11e5e7[_0x6f4c('0x53')],{'$or':_[_0x6f4c('0x42')](_0x3e2362,function(_0x6ee231){if(_0x6ee231[_0x6f4c('0x55')]!==_0x6f4c('0x56')){var _0x2fd923={};_0x2fd923[_0x6ee231[_0x6f4c('0x3e')]]={'$like':'%'+_0x5817ba['query'][_0x6f4c('0x54')]+'%'};return _0x2fd923;}})});}_0x11e5e7=_[_0x6f4c('0x57')]({},_0x11e5e7,_0x5817ba[_0x6f4c('0x58')]);var _0x37c34c={'where':_0x11e5e7[_0x6f4c('0x53')]};return db['SmsAccount']['count'](_0x37c34c)[_0x6f4c('0x23')](function(_0x512132){_0x4a16b2[_0x6f4c('0x35')]=_0x512132;if(_0x5817ba[_0x6f4c('0x47')]['includeAll']){_0x11e5e7[_0x6f4c('0x59')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x11e5e7);})[_0x6f4c('0x23')](function(_0x3e29ce){_0x4a16b2[_0x6f4c('0x5a')]=_0x3e29ce;return _0x4a16b2;})[_0x6f4c('0x23')](respondWithFilteredResult(_0x58e2e5,_0x11e5e7))[_0x6f4c('0x2d')](handleError(_0x58e2e5,null));};exports[_0x6f4c('0x5b')]=function(_0x4358db,_0x5f44ce){var _0x23d71d={'raw':![],'where':{'id':_0x4358db['params']['id']},'include':[{'model':db['Pause'],'as':_0x6f4c('0x41')}]},_0x20fc52={};_0x20fc52['model']=_['keys'](db['SmsAccount'][_0x6f4c('0x44')]);_0x20fc52['query']=_[_0x6f4c('0x48')](_0x4358db[_0x6f4c('0x47')]);_0x20fc52[_0x6f4c('0x49')]=_['intersection'](_0x20fc52[_0x6f4c('0x4b')],_0x20fc52['query']);_0x23d71d[_0x6f4c('0x4c')]=_[_0x6f4c('0x4a')](_0x20fc52[_0x6f4c('0x4b')],qs[_0x6f4c('0x4d')](_0x4358db['query'][_0x6f4c('0x4d')]));_0x23d71d['attributes']=_0x23d71d[_0x6f4c('0x4c')][_0x6f4c('0x4e')]?_0x23d71d[_0x6f4c('0x4c')]:_0x20fc52['model'];if(_0x4358db[_0x6f4c('0x47')][_0x6f4c('0x5c')]){_0x23d71d[_0x6f4c('0x59')]=[{'all':!![]}];}_0x23d71d=_[_0x6f4c('0x57')]({},_0x23d71d,_0x4358db['options']);return db['SmsAccount'][_0x6f4c('0x5d')](_0x23d71d)[_0x6f4c('0x23')](handleEntityNotFound(_0x5f44ce,null))['then'](respondWithResult(_0x5f44ce,null))[_0x6f4c('0x2d')](handleError(_0x5f44ce,null));};exports[_0x6f4c('0x5e')]=function(_0x333840,_0x5d1c1e){return db[_0x6f4c('0x43')]['create'](_0x333840[_0x6f4c('0x5f')],{})[_0x6f4c('0x23')](function(_0x411e1b){var _0x2ba3eb=_0x333840[_0x6f4c('0x60')]['get']({'plain':!![]});if(!_0x2ba3eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ba3eb[_0x6f4c('0x61')]===_0x6f4c('0x60')){var _0x31380b=_0x411e1b[_0x6f4c('0x3b')]({'plain':!![]});var _0x7f474=_0x6f4c('0x3c');return db['UserProfileSection'][_0x6f4c('0x5d')]({'where':{'name':_0x7f474,'userProfileId':_0x2ba3eb[_0x6f4c('0x62')]},'raw':!![]})['then'](function(_0x1bc3f9){if(_0x1bc3f9&&_0x1bc3f9['autoAssociation']===0x0){return db[_0x6f4c('0x3d')]['create']({'name':_0x31380b[_0x6f4c('0x3e')],'resourceId':_0x31380b['id'],'type':_0x1bc3f9[_0x6f4c('0x3e')],'sectionId':_0x1bc3f9['id']},{})[_0x6f4c('0x23')](function(){return _0x411e1b;});}else{return _0x411e1b;}})[_0x6f4c('0x2d')](function(_0x1d74f1){logger[_0x6f4c('0x29')](_0x6f4c('0x63'),_0x1d74f1);throw _0x1d74f1;});}return _0x411e1b;})['then'](respondWithResult(_0x5d1c1e,0xc9))[_0x6f4c('0x2d')](handleError(_0x5d1c1e,null));};exports[_0x6f4c('0x39')]=function(_0x31c57c,_0xbc7840){if(_0x31c57c[_0x6f4c('0x5f')]['id']){delete _0x31c57c['body']['id'];}return db[_0x6f4c('0x43')]['find']({'where':{'id':_0x31c57c['params']['id']},'include':[{'model':db[_0x6f4c('0x40')],'as':_0x6f4c('0x41')}]})[_0x6f4c('0x23')](handleEntityNotFound(_0xbc7840,null))[_0x6f4c('0x23')](saveUpdates(_0x31c57c[_0x6f4c('0x5f')],null))[_0x6f4c('0x23')](respondWithResult(_0xbc7840,null))[_0x6f4c('0x2d')](handleError(_0xbc7840,null));};exports[_0x6f4c('0x3a')]=function(_0x3f6b1e,_0x172f6d){return db[_0x6f4c('0x43')][_0x6f4c('0x5d')]({'where':{'id':_0x3f6b1e['params']['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x172f6d,null))['then'](removeEntity(_0x172f6d,null))[_0x6f4c('0x2d')](handleError(_0x172f6d,null));};exports['describe']=function(_0x25e6ff,_0x4d51bc){return db['SmsAccount']['describe']()[_0x6f4c('0x23')](respondWithResult(_0x4d51bc,null))[_0x6f4c('0x2d')](handleError(_0x4d51bc,null));};exports['addDisposition']=function(_0x149d4d,_0x53f385,_0x1d10ce){if(_0x149d4d['body']['id']){delete _0x149d4d['body']['id'];}return db[_0x6f4c('0x43')][_0x6f4c('0x5d')]({'where':{'id':_0x149d4d[_0x6f4c('0x64')]['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x53f385,null))['then'](function(_0x119651){if(_0x119651){_0x149d4d[_0x6f4c('0x5f')][_0x6f4c('0x65')]=_0x119651['id'];return db['Disposition'][_0x6f4c('0x5e')](_0x149d4d[_0x6f4c('0x5f')]);}})[_0x6f4c('0x23')](respondWithResult(_0x53f385,null))[_0x6f4c('0x2d')](handleError(_0x53f385,null));};exports[_0x6f4c('0x66')]=function(_0x94ef0b,_0xc39b80,_0x67c9ef){var _0x838def={'raw':![],'where':{}};var _0x37e825={};var _0x38fde7={'count':0x0,'rows':[]};return db[_0x6f4c('0x43')][_0x6f4c('0x67')]({'where':{'id':_0x94ef0b[_0x6f4c('0x64')]['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0xc39b80,null))[_0x6f4c('0x23')](function(_0x5cd1a5){if(_0x5cd1a5){_0x37e825['model']=_['keys'](db[_0x6f4c('0x68')][_0x6f4c('0x44')]);_0x37e825[_0x6f4c('0x47')]=_['keys'](_0x94ef0b[_0x6f4c('0x47')]);_0x37e825['filters']=_[_0x6f4c('0x4a')](_0x37e825[_0x6f4c('0x4b')],_0x37e825[_0x6f4c('0x47')]);_0x838def[_0x6f4c('0x4c')]=_['intersection'](_0x37e825[_0x6f4c('0x4b')],qs[_0x6f4c('0x4d')](_0x94ef0b[_0x6f4c('0x47')]['fields']));_0x838def[_0x6f4c('0x4c')]=_0x838def['attributes'][_0x6f4c('0x4e')]?_0x838def[_0x6f4c('0x4c')]:_0x37e825[_0x6f4c('0x4b')];if(!_0x94ef0b[_0x6f4c('0x47')]['hasOwnProperty'](_0x6f4c('0x50'))){_0x838def[_0x6f4c('0x33')]=qs[_0x6f4c('0x33')](_0x94ef0b[_0x6f4c('0x47')][_0x6f4c('0x33')]);_0x838def['offset']=qs[_0x6f4c('0x32')](_0x94ef0b['query'][_0x6f4c('0x32')]);}_0x838def[_0x6f4c('0x51')]=qs['sort'](_0x94ef0b[_0x6f4c('0x47')][_0x6f4c('0x52')]);_0x838def['where']=qs['filters'](_[_0x6f4c('0x69')](_0x94ef0b[_0x6f4c('0x47')],_0x37e825['filters']));_0x838def['where'][_0x6f4c('0x65')]=_0x5cd1a5['id'];if(_0x94ef0b[_0x6f4c('0x47')][_0x6f4c('0x54')]){_0x838def[_0x6f4c('0x53')]=_[_0x6f4c('0x57')](_0x838def[_0x6f4c('0x53')],{'$or':_['map'](_0x838def[_0x6f4c('0x4c')],function(_0x93427e){var _0x12c87e={};_0x12c87e[_0x93427e]={'$like':'%'+_0x94ef0b[_0x6f4c('0x47')][_0x6f4c('0x54')]+'%'};return _0x12c87e;})});}_0x838def=_['merge']({},_0x838def,_0x94ef0b[_0x6f4c('0x58')]);return db[_0x6f4c('0x68')][_0x6f4c('0x35')]({'where':_0x838def[_0x6f4c('0x53')]})[_0x6f4c('0x23')](function(_0x41986f){_0x38fde7[_0x6f4c('0x35')]=_0x41986f;if(_0x94ef0b['query'][_0x6f4c('0x5c')]){_0x838def[_0x6f4c('0x59')]=[{'all':!![]}];}return db[_0x6f4c('0x68')][_0x6f4c('0x6a')](_0x838def);})['then'](function(_0x345643){_0x38fde7[_0x6f4c('0x5a')]=_0x345643;return _0x38fde7;});}})[_0x6f4c('0x23')](respondWithFilteredResult(_0xc39b80,_0x838def))[_0x6f4c('0x2d')](handleError(_0xc39b80,null));};exports[_0x6f4c('0x6b')]=function(_0x1a0f36,_0xdeb439,_0x598c24){return db[_0x6f4c('0x43')][_0x6f4c('0x5d')]({'where':{'id':_0x1a0f36[_0x6f4c('0x64')]['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0xdeb439,null))['then'](function(_0x5154c5){if(_0x5154c5){return _0x5154c5[_0x6f4c('0x6b')](_0x1a0f36[_0x6f4c('0x47')][_0x6f4c('0x6c')]);}})[_0x6f4c('0x23')](respondWithStatusCode(_0xdeb439,null))['catch'](handleError(_0xdeb439,null));};exports[_0x6f4c('0x6d')]=function(_0x17c63b,_0x3c3033,_0x25f9ff){if(_0x17c63b['body']['id']){delete _0x17c63b[_0x6f4c('0x5f')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x17c63b[_0x6f4c('0x64')]['id']}})['then'](handleEntityNotFound(_0x3c3033,null))[_0x6f4c('0x23')](function(_0x1e3afd){if(_0x1e3afd){_0x17c63b[_0x6f4c('0x5f')][_0x6f4c('0x65')]=_0x1e3afd['id'];return db[_0x6f4c('0x6e')][_0x6f4c('0x5e')](_0x17c63b[_0x6f4c('0x5f')]);}})[_0x6f4c('0x23')](respondWithResult(_0x3c3033,null))[_0x6f4c('0x2d')](handleError(_0x3c3033,null));};exports[_0x6f4c('0x6f')]=function(_0x12f688,_0x559db3,_0x159f7e){var _0x3aaa61={'raw':![],'where':{}};var _0x4b48de={};var _0x48b3f0={'count':0x0,'rows':[]};return db['SmsAccount'][_0x6f4c('0x67')]({'where':{'id':_0x12f688[_0x6f4c('0x64')]['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x559db3,null))[_0x6f4c('0x23')](function(_0x3633c6){if(_0x3633c6){_0x4b48de[_0x6f4c('0x4b')]=_[_0x6f4c('0x48')](db[_0x6f4c('0x6e')][_0x6f4c('0x44')]);_0x4b48de[_0x6f4c('0x47')]=_[_0x6f4c('0x48')](_0x12f688['query']);_0x4b48de['filters']=_[_0x6f4c('0x4a')](_0x4b48de[_0x6f4c('0x4b')],_0x4b48de[_0x6f4c('0x47')]);_0x3aaa61[_0x6f4c('0x4c')]=_[_0x6f4c('0x4a')](_0x4b48de['model'],qs[_0x6f4c('0x4d')](_0x12f688[_0x6f4c('0x47')][_0x6f4c('0x4d')]));_0x3aaa61[_0x6f4c('0x4c')]=_0x3aaa61[_0x6f4c('0x4c')][_0x6f4c('0x4e')]?_0x3aaa61[_0x6f4c('0x4c')]:_0x4b48de[_0x6f4c('0x4b')];if(!_0x12f688['query']['hasOwnProperty']('nolimit')){_0x3aaa61['limit']=qs[_0x6f4c('0x33')](_0x12f688[_0x6f4c('0x47')][_0x6f4c('0x33')]);_0x3aaa61[_0x6f4c('0x32')]=qs['offset'](_0x12f688[_0x6f4c('0x47')]['offset']);}_0x3aaa61[_0x6f4c('0x51')]=qs[_0x6f4c('0x52')](_0x12f688[_0x6f4c('0x47')][_0x6f4c('0x52')]);_0x3aaa61[_0x6f4c('0x53')]=qs[_0x6f4c('0x49')](_[_0x6f4c('0x69')](_0x12f688[_0x6f4c('0x47')],_0x4b48de[_0x6f4c('0x49')]));_0x3aaa61[_0x6f4c('0x53')][_0x6f4c('0x65')]=_0x3633c6['id'];if(_0x12f688[_0x6f4c('0x47')][_0x6f4c('0x54')]){_0x3aaa61[_0x6f4c('0x53')]=_[_0x6f4c('0x57')](_0x3aaa61[_0x6f4c('0x53')],{'$or':_[_0x6f4c('0x42')](_0x3aaa61[_0x6f4c('0x4c')],function(_0x1591b4){var _0x43bd4e={};_0x43bd4e[_0x1591b4]={'$like':'%'+_0x12f688[_0x6f4c('0x47')][_0x6f4c('0x54')]+'%'};return _0x43bd4e;})});}_0x3aaa61=_[_0x6f4c('0x57')]({},_0x3aaa61,_0x12f688[_0x6f4c('0x58')]);return db['CannedAnswer'][_0x6f4c('0x35')]({'where':_0x3aaa61[_0x6f4c('0x53')]})['then'](function(_0x27550d){_0x48b3f0[_0x6f4c('0x35')]=_0x27550d;if(_0x12f688['query'][_0x6f4c('0x5c')]){_0x3aaa61[_0x6f4c('0x59')]=[{'all':!![]}];}return db[_0x6f4c('0x6e')][_0x6f4c('0x6a')](_0x3aaa61);})[_0x6f4c('0x23')](function(_0x51d194){_0x48b3f0[_0x6f4c('0x5a')]=_0x51d194;return _0x48b3f0;});}})[_0x6f4c('0x23')](respondWithFilteredResult(_0x559db3,_0x3aaa61))[_0x6f4c('0x2d')](handleError(_0x559db3,null));};exports[_0x6f4c('0x70')]=function(_0x1dbe9e,_0x1b9ffa,_0x1c8e1c){return db['SmsAccount'][_0x6f4c('0x5d')]({'where':{'id':_0x1dbe9e[_0x6f4c('0x64')]['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x1b9ffa,null))[_0x6f4c('0x23')](function(_0x1b5bd2){if(_0x1b5bd2){return _0x1b5bd2['removeAnswers'](_0x1dbe9e[_0x6f4c('0x47')][_0x6f4c('0x6c')]);}})[_0x6f4c('0x23')](respondWithStatusCode(_0x1b9ffa,null))[_0x6f4c('0x2d')](handleError(_0x1b9ffa,null));};exports[_0x6f4c('0x71')]=function(_0x347a6f,_0x1c0a71,_0x1e1052){var _0xb09074={'channel':'sms'};var _0x26e800=[];var _0x48a7d0=[];var _0x38a3ab={};return db['SmsAccount'][_0x6f4c('0x5d')]({'where':{'id':_0x347a6f[_0x6f4c('0x64')]['id']},'include':[{'model':db[_0x6f4c('0x72')],'as':'Applications'}]})[_0x6f4c('0x23')](handleEntityNotFound(_0x1c0a71,null))[_0x6f4c('0x23')](function(_0x10cb85){_0xb09074[_0x6f4c('0x73')]=_0x10cb85;_0xb09074[_0x6f4c('0x74')]=_['orderBy'](_0x10cb85[_0x6f4c('0x75')],[_0x6f4c('0x76')],['asc']);if(_0xb09074[_0x6f4c('0x73')]['Applications']){delete _0xb09074[_0x6f4c('0x73')][_0x6f4c('0x75')];}return db[_0x6f4c('0x77')][_0x6f4c('0x78')]();})[_0x6f4c('0x23')](function(_0x590009){if(!_0x590009){throw new db[(_0x6f4c('0x79'))][(_0x6f4c('0x7a'))](_0x6f4c('0x7b'));}_0x26e800=_[_0x6f4c('0x7c')](_[_0x6f4c('0x48')](_0x590009),[_0x6f4c('0x7d'),'updatedAt']);_0x48a7d0=_['difference'](_[_0x6f4c('0x48')](_0x590009),[_0x6f4c('0x7d'),_0x6f4c('0x7e'),'CompanyId',_0x6f4c('0x7f')]);_0xb09074[_0x6f4c('0x5f')]={'mapKey':_0x6f4c('0x80')};if(_0xb09074[_0x6f4c('0x73')][_0x6f4c('0x55')]){switch(_0xb09074[_0x6f4c('0x73')][_0x6f4c('0x55')]){case _0x6f4c('0x81'):_0xb09074[_0x6f4c('0x5f')]['from']=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x82')];_0xb09074['body'][_0x6f4c('0x5f')]=_0x347a6f[_0x6f4c('0x5f')]['Body'];_0xb09074[_0x6f4c('0x5f')]['messageId']=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x83')];break;case _0x6f4c('0x84'):_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')]='+'+_0x347a6f['body'][_0x6f4c('0x86')];_0xb09074['body'][_0x6f4c('0x5f')]=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x87')];break;case _0x6f4c('0x88'):_0xb09074[_0x6f4c('0x5f')]['from']=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x85')];_0xb09074['body'][_0x6f4c('0x5f')]=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x2b')];break;case _0x6f4c('0x89'):_0xb09074['body'][_0x6f4c('0x85')]=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x85')];_0xb09074['body'][_0x6f4c('0x5f')]=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x5f')];_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x8a')]=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x8b')];break;case _0x6f4c('0x8c'):_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')]=_0x347a6f['body'][_0x6f4c('0x82')];_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x5f')]=_0x347a6f[_0x6f4c('0x5f')]['Text'];_0xb09074['body']['messageId']=_0x347a6f[_0x6f4c('0x5f')]['MessageUUID'];break;case _0x6f4c('0x8d'):_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')]='+'+_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x8e')][0x0][_0x6f4c('0x85')];_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x5f')]=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x8e')][0x0]['text'];_0xb09074[_0x6f4c('0x5f')]['messageId']=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x8e')][0x0][_0x6f4c('0x8a')];break;case _0x6f4c('0x8f'):_0xb09074['body']['from']=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x90')];_0xb09074['body'][_0x6f4c('0x5f')]=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x91')][_0x6f4c('0x2b')];break;case'clickatell':_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')]=_0x347a6f[_0x6f4c('0x5f')]['fromNumber'];_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x5f')]=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x87')];_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x8a')]=_0x347a6f['body']['replyMessageId'];break;case _0x6f4c('0x92'):_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x8a')]=_0x347a6f[_0x6f4c('0x5f')][0x0]['message']['id'];_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')]=_0x347a6f[_0x6f4c('0x5f')][0x0][_0x6f4c('0x2b')][_0x6f4c('0x85')];_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x5f')]=_0x347a6f[_0x6f4c('0x5f')][0x0]['message'][_0x6f4c('0x87')];break;case'intelepeer':_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')]=_0x347a6f['body'][_0x6f4c('0x85')];_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x5f')]=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x2b')];_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x8a')]=_0x347a6f[_0x6f4c('0x5f')][_0x6f4c('0x93')];break;}}if(_0xb09074[_0x6f4c('0x5f')]['id']){delete _0xb09074[_0x6f4c('0x5f')]['id'];}if(_[_0x6f4c('0x94')](_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')])){throw new db[(_0x6f4c('0x79'))][(_0x6f4c('0x7a'))](_0x6f4c('0x95'));}if(_['isNil'](_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x5f')])||_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x5f')]===''){throw new db[(_0x6f4c('0x79'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6f4c('0x94')](_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x96')])){throw new db[(_0x6f4c('0x79'))][(_0x6f4c('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x48a7d0);}if(!_['includes'](_0x48a7d0,_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x96')])){throw new db[(_0x6f4c('0x79'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x48a7d0);}_0x38a3ab[_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x96')]]=_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')];return db[_0x6f4c('0x97')][_0x6f4c('0x5d')]({'where':{'id':_0xb09074[_0x6f4c('0x73')][_0x6f4c('0x7f')]},'include':[{'model':db['CmContact'],'as':_0x6f4c('0x98'),'where':_0x38a3ab,'limit':0x1,'order':[['updatedAt',_0x6f4c('0x99')]]}]});})[_0x6f4c('0x23')](handleEntityNotFound(_0x1c0a71,null))['then'](function(_0x2bae3e){if(_0x2bae3e){_0xb09074['list']=_[_0x6f4c('0x9a')](_0x2bae3e,['Contacts']);if(_0x2bae3e[_0x6f4c('0x98')][_0x6f4c('0x4e')]){return _0x2bae3e[_0x6f4c('0x98')][0x0];}var _0x51776=_[_0x6f4c('0x1c')](_0xb09074[_0x6f4c('0x5f')],{'firstName':_0xb09074[_0x6f4c('0x5f')]['from'],'ListId':_0x2bae3e['id']});_0x51776[_0xb09074[_0x6f4c('0x5f')]['mapKey']]=_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')];return db[_0x6f4c('0x77')]['create'](_0x51776,{'fields':_0x26e800,'raw':!![]});}})['then'](handleEntityNotFound(_0x1c0a71,null))[_0x6f4c('0x23')](function(_0x5e1372){if(_0x5e1372){_0xb09074[_0x6f4c('0x9b')]=_0x5e1372;var _0x5a4ce5={'ContactId':_0x5e1372['id'],'phone':_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')],'SmsAccountId':_0x347a6f[_0x6f4c('0x64')]['id']};var _0x3c8f4a={'ContactId':_0x5e1372['id'],'SmsAccountId':_0x347a6f[_0x6f4c('0x64')]['id'],'closed':![]};return db[_0x6f4c('0x9c')]['find']({'where':_0x3c8f4a})[_0x6f4c('0x23')](function(_0x2b00b8){if(_0x2b00b8){return[_0x2b00b8,![]];}return db[_0x6f4c('0x9c')][_0x6f4c('0x5e')](_0x5a4ce5)[_0x6f4c('0x23')](function(_0x1d90da){return[_0x1d90da,!![]];});});}})[_0x6f4c('0x9d')](function(_0x414993,_0x3713c0){_0xb09074[_0x6f4c('0x9e')]=_0x414993[_0x6f4c('0x3b')]({'plain':!![]});_0xb09074[_0x6f4c('0x9e')][_0x6f4c('0x9f')]=![];if(_0x3713c0){if(_0xb09074['account'][_0x6f4c('0xa0')]){_0xb09074[_0x6f4c('0x74')][_0x6f4c('0xa1')]({'id':0x0,'priority':_0xb09074['applications'][_0x6f4c('0x4e')]+0x1,'app':'close','appdata':_0x6f4c('0xa2'),'interval':_0x6f4c('0xa3')});}_0xb09074['interaction'][_0x6f4c('0x9f')]=!![];}return db['SmsMessage']['create']({'phone':_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0x85')],'messageId':_0xb09074['body']['messageId'],'body':_0xb09074['body']['body'],'SmsAccountId':_0x347a6f[_0x6f4c('0x64')]['id'],'SmsInteractionId':_0x414993['id'],'direction':'in','ContactId':_0x414993['ContactId'],'AttachmentId':_0xb09074[_0x6f4c('0x5f')][_0x6f4c('0xa4')]});})[_0x6f4c('0x23')](function(_0x276847){_0xb09074[_0x6f4c('0x2b')]=_0x276847;if(_0xb09074[_0x6f4c('0x9e')][_0x6f4c('0xa5')]){return db[_0x6f4c('0xa6')]['find']({'attributes':['id',_0x6f4c('0x3e')],'where':{'id':_0xb09074['interaction']['UserId']}})[_0x6f4c('0x23')](function(_0x311acc){if(_0x311acc){_0xb09074[_0x6f4c('0x74')][_0x6f4c('0xa7')]({'id':0x0,'priority':0x0,'app':_0x6f4c('0xa8'),'appdata':_0x311acc[_0x6f4c('0x3e')]+','+(_0xb09074[_0x6f4c('0x73')][_0x6f4c('0xa9')]||0xa),'interval':_0x6f4c('0xa3')});}return respondWithRpcPromise('Start',_0x6f4c('0xaa'),_0xb09074);});}return respondWithRpcPromise(_0x6f4c('0xab'),_0x6f4c('0xaa'),_0xb09074);})['then'](function(_0x1ac603){if(_0x1ac603){var _0x2c03e4=0xc8;var _0x3479f2=_0x6f4c('0xac');logger[_0x6f4c('0x24')](_0x6f4c('0xad'),_0x3479f2,_0x2c03e4,_0x6f4c('0xae'));logger[_0x6f4c('0x27')](_0x6f4c('0xaf'),_0x3479f2,_0x2c03e4,_0x6f4c('0xae'),JSON[_0x6f4c('0x28')](_0x1ac603));if(_0xb09074['account']['type']==='twilio'){return _0x1c0a71[_0x6f4c('0x2f')](_0x2c03e4)['set']('Content-Type','text/xml')[_0x6f4c('0x3f')]('\x0a');}else{return _0x1c0a71['status'](_0x2c03e4)[_0x6f4c('0x31')](_0x1ac603);}}})[_0x6f4c('0x2d')](handleError(_0x1c0a71,null));};exports[_0x6f4c('0xb0')]=function(_0x3088d1,_0x23565f){var _0x4d31c8=_0x3088d1[_0x6f4c('0x64')]['id'];var _0x2d381a=_0x3088d1[_0x6f4c('0x5f')];var _0x113fb0=0xc8;var _0x3920c9=null;return db['sequelize'][_0x6f4c('0xb1')]({'isolationLevel':db[_0x6f4c('0xb2')][_0x6f4c('0xb3')][_0x6f4c('0xb4')][_0x6f4c('0xb5')]},function(_0x483227){return db[_0x6f4c('0x43')][_0x6f4c('0x67')]({'where':{'id':_0x4d31c8},'transaction':_0x483227})[_0x6f4c('0x23')](function(_0x5a235b){if(_0x5a235b){return db[_0x6f4c('0x72')][_0x6f4c('0x3a')]({'where':{'SmsAccountId':_0x4d31c8},'transaction':_0x483227})[_0x6f4c('0x23')](function(){var _0x5b94df=_[_0x6f4c('0x42')](_0x2d381a,function(_0xfbe539){_0xfbe539['SmsAccountId']=_0x4d31c8;return _0xfbe539;});return db['SmsApplication'][_0x6f4c('0xb6')](_0x5b94df,{'transaction':_0x483227});});}else{_0x113fb0=0x194;_0x3920c9=[];}});})['then'](function(){if(_0x113fb0!==0x194){return db[_0x6f4c('0x72')][_0x6f4c('0xb7')]({'where':{'SmsAccountId':_0x4d31c8},'order':'priority'})[_0x6f4c('0x23')](function(_0x11f1f7){_0x3920c9=_0x11f1f7;});}})[_0x6f4c('0x2d')](function(_0x3898bb){_0x113fb0=0x1f4;logger[_0x6f4c('0x29')](_0x3898bb['stack']);if(_0x3898bb['name']){delete _0x3898bb[_0x6f4c('0x3e')];}_0x3920c9=_0x3898bb;})[_0x6f4c('0xb8')](function(){if(_0x3920c9===null){_0x23565f[_0x6f4c('0x2e')](_0x113fb0);}else{if(_0x113fb0===0x1f4){_0x23565f['status'](_0x113fb0)[_0x6f4c('0x3f')](_0x3920c9);}else{_0x23565f['status'](_0x113fb0)[_0x6f4c('0x31')](_0x3920c9);}}});};exports[_0x6f4c('0xb9')]=function(_0x3a9512,_0x13edf4,_0x1180f8){var _0x4303b5={};var _0xc9666c={};var _0x1a3f5a;var _0x54ab88;return db[_0x6f4c('0x43')]['findOne']({'where':{'id':_0x3a9512['params']['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x13edf4,null))[_0x6f4c('0x23')](function(_0x53671f){if(_0x53671f){_0x1a3f5a=_0x53671f;_0xc9666c['model']=_[_0x6f4c('0x48')](db[_0x6f4c('0x72')]['rawAttributes']);_0xc9666c[_0x6f4c('0x47')]=_[_0x6f4c('0x48')](_0x3a9512['query']);_0xc9666c[_0x6f4c('0x49')]=_['intersection'](_0xc9666c[_0x6f4c('0x4b')],_0xc9666c[_0x6f4c('0x47')]);_0x4303b5['attributes']=_[_0x6f4c('0x4a')](_0xc9666c['model'],qs[_0x6f4c('0x4d')](_0x3a9512[_0x6f4c('0x47')][_0x6f4c('0x4d')]));_0x4303b5[_0x6f4c('0x4c')]=_0x4303b5[_0x6f4c('0x4c')][_0x6f4c('0x4e')]?_0x4303b5[_0x6f4c('0x4c')]:_0xc9666c['model'];_0x4303b5[_0x6f4c('0x51')]=qs[_0x6f4c('0x52')](_0x3a9512[_0x6f4c('0x47')][_0x6f4c('0x52')]);_0x4303b5[_0x6f4c('0x53')]=qs[_0x6f4c('0x49')](_[_0x6f4c('0x69')](_0x3a9512[_0x6f4c('0x47')],_0xc9666c['filters']));if(_0x3a9512[_0x6f4c('0x47')]['filter']){_0x4303b5[_0x6f4c('0x53')]=_[_0x6f4c('0x57')](_0x4303b5[_0x6f4c('0x53')],{'$or':_[_0x6f4c('0x42')](_0x4303b5[_0x6f4c('0x4c')],function(_0x4dbe3c){var _0x3babb6={};_0x3babb6[_0x4dbe3c]={'$like':'%'+_0x3a9512[_0x6f4c('0x47')][_0x6f4c('0x54')]+'%'};return _0x3babb6;})});}_0x4303b5=_['merge']({},_0x4303b5,_0x3a9512['options']);return _0x1a3f5a['getApplications'](_0x4303b5);}})[_0x6f4c('0x23')](function(_0x1816d7){if(_0x1816d7){_0x54ab88=_0x1816d7['length'];if(!_0x3a9512[_0x6f4c('0x47')][_0x6f4c('0x4f')](_0x6f4c('0x50'))){_0x4303b5[_0x6f4c('0x33')]=qs[_0x6f4c('0x33')](_0x3a9512['query'][_0x6f4c('0x33')]);_0x4303b5[_0x6f4c('0x32')]=qs[_0x6f4c('0x32')](_0x3a9512['query'][_0x6f4c('0x32')]);}return _0x1a3f5a[_0x6f4c('0xb9')](_0x4303b5);}})[_0x6f4c('0x23')](function(_0x1f37bf){if(_0x1f37bf){return _0x1f37bf?{'count':_0x54ab88,'rows':_0x1f37bf}:null;}})[_0x6f4c('0x23')](respondWithResult(_0x13edf4,null))[_0x6f4c('0x2d')](handleError(_0x13edf4,null));};exports['getInteractions']=function(_0x508657,_0x28687a,_0x179bc5){var _0x19e70b={'raw':![],'where':{}};var _0x3ec299={};var _0x54abb5={'count':0x0,'rows':[]};return db[_0x6f4c('0x43')][_0x6f4c('0x67')]({'where':{'id':_0x508657['params']['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x28687a,null))['then'](function(_0x29557c){if(_0x29557c){_0x3ec299[_0x6f4c('0x4b')]=_[_0x6f4c('0x48')](db[_0x6f4c('0x9c')]['rawAttributes']);_0x3ec299[_0x6f4c('0x47')]=_[_0x6f4c('0x48')](_0x508657[_0x6f4c('0x47')]);_0x3ec299['filters']=_[_0x6f4c('0x4a')](_0x3ec299[_0x6f4c('0x4b')],_0x3ec299[_0x6f4c('0x47')]);_0x19e70b['attributes']=_[_0x6f4c('0x4a')](_0x3ec299[_0x6f4c('0x4b')],qs[_0x6f4c('0x4d')](_0x508657[_0x6f4c('0x47')]['fields']));_0x19e70b[_0x6f4c('0x4c')]=_0x19e70b['attributes']['length']?_0x19e70b['attributes']:_0x3ec299[_0x6f4c('0x4b')];if(!_0x508657[_0x6f4c('0x47')][_0x6f4c('0x4f')]('nolimit')){_0x19e70b[_0x6f4c('0x33')]=qs['limit'](_0x508657[_0x6f4c('0x47')]['limit']);_0x19e70b[_0x6f4c('0x32')]=qs[_0x6f4c('0x32')](_0x508657[_0x6f4c('0x47')]['offset']);}_0x19e70b[_0x6f4c('0x51')]=qs[_0x6f4c('0x52')](_0x508657['query'][_0x6f4c('0x52')]);_0x19e70b[_0x6f4c('0x53')]=qs[_0x6f4c('0x49')](_[_0x6f4c('0x69')](_0x508657[_0x6f4c('0x47')],_0x3ec299[_0x6f4c('0x49')]));_0x19e70b['where'][_0x6f4c('0x65')]=_0x29557c['id'];if(_0x508657[_0x6f4c('0x47')]['filter']){_0x19e70b[_0x6f4c('0x53')]=_['merge'](_0x19e70b[_0x6f4c('0x53')],{'$or':_[_0x6f4c('0x42')](_0x19e70b['attributes'],function(_0x4d31c1){var _0x59d627={};_0x59d627[_0x4d31c1]={'$like':'%'+_0x508657['query']['filter']+'%'};return _0x59d627;})});}_0x19e70b=_[_0x6f4c('0x57')]({},_0x19e70b,_0x508657[_0x6f4c('0x58')]);return db[_0x6f4c('0x9c')][_0x6f4c('0x35')]({'where':_0x19e70b[_0x6f4c('0x53')]})['then'](function(_0x5a0966){_0x54abb5['count']=_0x5a0966;if(_0x508657[_0x6f4c('0x47')]['includeAll']){_0x19e70b['include']=[{'model':db[_0x6f4c('0x77')],'as':_0x6f4c('0xba'),'required':![]},{'model':db[_0x6f4c('0xa6')],'as':'Owner','attributes':[_0x6f4c('0x3e'),_0x6f4c('0xbb'),'internal'],'required':![]},{'model':db[_0x6f4c('0xbc')],'as':_0x6f4c('0xbd'),'attributes':['id',_0x6f4c('0x3e'),_0x6f4c('0xbe')],'where':_0x508657[_0x6f4c('0x47')][_0x6f4c('0xbf')]?{'id':_0x508657['query']['tag']}:undefined,'required':_0x508657['query']['tag']?!![]:![]}];}return db[_0x6f4c('0x9c')][_0x6f4c('0x6a')](_0x19e70b);})[_0x6f4c('0x23')](function(_0xa901b){_0x54abb5[_0x6f4c('0x5a')]=_0xa901b;return _0x54abb5;});}})[_0x6f4c('0x23')](respondWithFilteredResult(_0x28687a,_0x19e70b))[_0x6f4c('0x2d')](handleError(_0x28687a,null));};exports[_0x6f4c('0x3f')]=function(_0x4e52e2,_0x1ef0a3,_0x222a92){var _0x38ecc0,_0x233130,_0x288eb1;if(_[_0x6f4c('0x94')](_0x4e52e2[_0x6f4c('0x5f')][_0x6f4c('0x5f')])||_0x4e52e2[_0x6f4c('0x5f')][_0x6f4c('0x5f')]===''){throw new db[(_0x6f4c('0x79'))][(_0x6f4c('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6f4c('0x94')](_0x4e52e2['body']['to'])){throw new db['Sequelize'][(_0x6f4c('0x7a'))](_0x6f4c('0xc0'));}_0x38ecc0=_0x4e52e2[_0x6f4c('0x5f')]['to'];return db[_0x6f4c('0x43')][_0x6f4c('0x5d')]({'where':{'id':_0x4e52e2[_0x6f4c('0x64')]['id']},'include':[{'model':db[_0x6f4c('0x97')],'as':_0x6f4c('0xc1'),'include':[{'model':db[_0x6f4c('0x77')],'as':_0x6f4c('0x98'),'where':{'mobile':_0x38ecc0},'limit':0x1,'order':[['updatedAt',_0x6f4c('0x99')]]}]}]})['then'](handleEntityNotFound(_0x1ef0a3,null))[_0x6f4c('0x23')](function(_0x28783d){if(_0x28783d&&_0x28783d[_0x6f4c('0xc1')]){_0x233130=_0x28783d['get']({'plain':!![]});if(_0x233130[_0x6f4c('0xc1')]&&_0x233130[_0x6f4c('0xc1')]['Contacts'][_0x6f4c('0x4e')]){return _0x233130[_0x6f4c('0xc1')][_0x6f4c('0x98')][0x0];}return db[_0x6f4c('0x77')]['create'](_['defaults'](_0x4e52e2[_0x6f4c('0x5f')],{'firstName':_0x38ecc0,'mobile':_0x38ecc0,'phone':_0x38ecc0,'ListId':_0x233130[_0x6f4c('0x7f')]}));}})[_0x6f4c('0x23')](handleEntityNotFound(_0x1ef0a3,null))[_0x6f4c('0x23')](function(_0x1dc1d8){if(_0x1dc1d8){_0x288eb1=_0x1dc1d8;return db['SmsInteraction'][_0x6f4c('0x5d')]({'where':{'ContactId':_0x288eb1['id'],'closed':![],'SmsAccountId':_0x233130['id']}})['then'](function(_0x2b35bb){if(_0x2b35bb){return[_0x2b35bb,![]];}return db[_0x6f4c('0x9c')][_0x6f4c('0x5e')]({'UserId':_0x4e52e2[_0x6f4c('0x60')]['id'],'ContactId':_0x288eb1['id'],'SmsAccountId':_0x233130['id'],'phone':_0x38ecc0,'firstMsgDirection':_0x6f4c('0xc2'),'Messages':[_['merge'](_0x4e52e2[_0x6f4c('0x5f')],{'read':![],'body':_0x4e52e2['body'][_0x6f4c('0x5f')],'phone':_0x38ecc0,'SmsAccountId':_0x233130['id'],'UserId':_0x4e52e2[_0x6f4c('0x60')]['id'],'ContactId':_0x288eb1['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x6f4c('0xc3')}]})[_0x6f4c('0x23')](function(_0x1b3cf0){return[_0x1b3cf0,!![]];});});}})['spread'](function(_0x1d271a,_0x2fdd47){if(_0x2fdd47){return _0x1d271a;}return db[_0x6f4c('0xc4')][_0x6f4c('0x5e')](_[_0x6f4c('0x57')](_0x4e52e2[_0x6f4c('0x5f')],{'read':![],'body':_0x4e52e2[_0x6f4c('0x5f')]['body'],'phone':_0x38ecc0,'SmsAccountId':_0x233130['id'],'SmsInteractionId':_0x1d271a['id'],'UserId':_0x4e52e2[_0x6f4c('0x60')]['id'],'ContactId':_0x288eb1['id']}))[_0x6f4c('0x23')](function(_0x3603b4){_0x1d271a[_0x6f4c('0xc5')][_0x6f4c('0xc3')]=[];_0x1d271a[_0x6f4c('0xc5')][_0x6f4c('0xc3')][_0x6f4c('0xa1')](_0x3603b4[_0x6f4c('0xc5')]);return _0x1d271a;});})[_0x6f4c('0x23')](respondWithResult(_0x1ef0a3,null))[_0x6f4c('0x2d')](handleError(_0x1ef0a3,null));};exports[_0x6f4c('0x2f')]=function(_0x1943bf,_0x5ab716,_0x5a01da){if(_0x1943bf[_0x6f4c('0x5f')]['id']){delete _0x1943bf['body']['id'];}var _0x1ba911,_0x506b57,_0x4ba404;return db['SmsAccount'][_0x6f4c('0x5d')]({'where':{'id':_0x1943bf[_0x6f4c('0x64')]['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x5ab716,null))[_0x6f4c('0x23')](function(_0x5a5745){if(_0x5a5745){_0x4ba404=_0x5a5745;logger[_0x6f4c('0x27')](_0x6f4c('0xad'),_0x6f4c('0x2f'),'received\x20delivery\x20report\x20from',_0x5a5745[_0x6f4c('0x55')],util[_0x6f4c('0xc6')](_0x1943bf[_0x6f4c('0x5f')],{'showHidden':![],'depth':null}));switch(_0x5a5745['type']){case _0x6f4c('0x84'):if(_0x1943bf[_0x6f4c('0x5f')]['skebby_dispatch_id']&&_0x1943bf['body'][_0x6f4c('0x2f')]){_0x506b57=_0x1943bf[_0x6f4c('0x5f')][_0x6f4c('0x2f')];return db[_0x6f4c('0xc4')][_0x6f4c('0x5d')]({'where':{'messageId':_0x1943bf[_0x6f4c('0x5f')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x1943bf[_0x6f4c('0x5f')]['requestid']&&_0x1943bf['body'][_0x6f4c('0xc7')]){_0x506b57=_0x1943bf[_0x6f4c('0x5f')]['statusInt'];return db[_0x6f4c('0xc4')][_0x6f4c('0x5d')]({'where':{'messageId':_0x1943bf[_0x6f4c('0x5f')][_0x6f4c('0xc8')]}});}break;case _0x6f4c('0x89'):if(_0x1943bf[_0x6f4c('0x5f')][_0x6f4c('0x8b')]&&_0x1943bf[_0x6f4c('0x5f')][_0x6f4c('0xc9')]){_0x506b57=_0x1943bf[_0x6f4c('0x5f')][_0x6f4c('0xc9')];return db['SmsMessage'][_0x6f4c('0x5d')]({'where':{'messageId':_0x1943bf[_0x6f4c('0x5f')][_0x6f4c('0x8b')]}});}break;case _0x6f4c('0x8d'):var _0x42dc66=_0x1943bf['body'][_0x6f4c('0x8e')][0x0];if(_0x42dc66[_0x6f4c('0x8a')]&&_0x42dc66[_0x6f4c('0x2f')][_0x6f4c('0xca')]===_0x6f4c('0xcb')){_0x506b57=_0x42dc66[_0x6f4c('0x2f')]['groupName'];return db[_0x6f4c('0xc4')][_0x6f4c('0x5d')]({'where':{'messageId':_0x42dc66[_0x6f4c('0x8a')]}});}break;case _0x6f4c('0xcc'):if(_0x1943bf[_0x6f4c('0x5f')][_0x6f4c('0x8a')]&&_0x1943bf['body'][_0x6f4c('0x2f')]){_0x506b57=_0x1943bf['body'][_0x6f4c('0x2f')];return db[_0x6f4c('0xc4')][_0x6f4c('0x5d')]({'where':{'messageId':_0x1943bf[_0x6f4c('0x5f')][_0x6f4c('0x8a')]}});}break;case'bandwidth':if(_0x1943bf[_0x6f4c('0x5f')][0x0][_0x6f4c('0x2b')]['id']){_0x506b57=_0x1943bf['body'][0x0]['type'];return db[_0x6f4c('0xc4')][_0x6f4c('0x5d')]({'where':{'messageId':_0x1943bf[_0x6f4c('0x5f')][0x0][_0x6f4c('0x2b')]['id']}});}break;case _0x6f4c('0xcd'):if(_0x1943bf[_0x6f4c('0x5f')][_0x6f4c('0xce')]&&_0x1943bf['body'][_0x6f4c('0x2f')]){_0x506b57=_0x1943bf['body']['status'];return db['SmsMessage'][_0x6f4c('0x5d')]({'where':{'messageId':_0x1943bf['body']['redif']}});}break;}}})['then'](handleEntityNotFound(_0x5ab716,null))[_0x6f4c('0x23')](function(_0x122af1){if(_0x122af1){_0x1ba911=_0x122af1;switch(_0x4ba404[_0x6f4c('0x55')]){case _0x6f4c('0x84'):if(_0x506b57===_0x6f4c('0xcb')){return _0x1ba911[_0x6f4c('0x39')]({'read':!![]});}else{logger[_0x6f4c('0x29')](_0x6f4c('0xad'),_0x6f4c('0x2f'),'skebby',util[_0x6f4c('0xc6')](_0x1943bf[_0x6f4c('0x5f')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x506b57==='1'){return _0x1ba911[_0x6f4c('0x39')]({'read':!![]});}else{logger[_0x6f4c('0x29')](_0x6f4c('0xad'),_0x6f4c('0x2f'),_0x6f4c('0x84'),util['inspect'](_0x1943bf['body'],{'showHidden':![],'depth':null}));}break;case _0x6f4c('0x89'):if(!_0x1943bf[_0x6f4c('0x5f')][_0x6f4c('0xcf')]&&_0x506b57>=0xc8&&_0x506b57<=0xce){return _0x1ba911[_0x6f4c('0x39')]({'read':!![]});}else{logger[_0x6f4c('0x29')](_0x6f4c('0xad'),_0x6f4c('0x2f'),_0x6f4c('0x89'),util['inspect'](_0x1943bf[_0x6f4c('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x6f4c('0x8d'):var _0x5c7396=_0x1943bf[_0x6f4c('0x5f')]['results'][0x0];if(_0x5c7396['status'][_0x6f4c('0xca')]===_0x6f4c('0xcb')){return _0x1ba911[_0x6f4c('0x39')]({'read':!![]});}else{logger[_0x6f4c('0x29')](_0x6f4c('0xad'),_0x6f4c('0x2f'),'infobip',util[_0x6f4c('0xc6')](_0x1943bf[_0x6f4c('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x6f4c('0xcc'):if(_0x506b57==_0x6f4c('0xd0')||_0x506b57==_0x6f4c('0xd1')){return _0x1ba911[_0x6f4c('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6f4c('0x2f'),_0x6f4c('0xcc'),util[_0x6f4c('0xc6')](_0x1943bf[_0x6f4c('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x6f4c('0x92'):if(_0x506b57=='message-delivered'){return _0x1ba911[_0x6f4c('0x39')]({'read':!![]});}else{logger[_0x6f4c('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6f4c('0x2f'),_0x6f4c('0x92'),util['inspect'](_0x1943bf[_0x6f4c('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x6f4c('0xcd'):if(_0x506b57===_0x6f4c('0xd2')||_0x506b57===_0x6f4c('0xd3')){return _0x1ba911[_0x6f4c('0x39')]({'read':!![]});}else{logger[_0x6f4c('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6f4c('0x2f'),_0x6f4c('0xcd'),util[_0x6f4c('0xc6')](_0x1943bf[_0x6f4c('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x1ba911;}})['then'](respondWithResult(_0x5ab716,null))[_0x6f4c('0x2d')](handleError(_0x5ab716,null));};exports[_0x6f4c('0xd4')]=function(_0x447fcf,_0x48f216,_0x48bebb){var _0x2c64fc,_0x3eb396,_0x3e77f6;return db['SmsAccount'][_0x6f4c('0x5d')]({'where':{'id':_0x447fcf[_0x6f4c('0x64')]['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x48f216,null))[_0x6f4c('0x23')](function(_0x4cb28c){if(_0x4cb28c){_0x3e77f6=_0x4cb28c;logger[_0x6f4c('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6f4c('0x2f'),'received\x20delivery\x20report\x20from',_0x4cb28c['type'],util[_0x6f4c('0xc6')](_0x447fcf[_0x6f4c('0x47')],{'showHidden':![],'depth':null}));switch(_0x4cb28c[_0x6f4c('0x55')]){case'csc':if(_0x447fcf['query']['message-id']&&_0x447fcf[_0x6f4c('0x47')][_0x6f4c('0xd5')]){_0x3eb396=_0x447fcf['query']['state'];return db[_0x6f4c('0xc4')][_0x6f4c('0x5d')]({'where':{'messageId':_0x447fcf['query']['message-id']}});}break;}}})[_0x6f4c('0x23')](handleEntityNotFound(_0x48f216,null))[_0x6f4c('0x23')](function(_0x1f87ce){if(_0x1f87ce){_0x2c64fc=_0x1f87ce;switch(_0x3e77f6[_0x6f4c('0x55')]){case _0x6f4c('0x8f'):if(_0x3eb396==='2'||_0x3eb396==='6'){return _0x2c64fc['update']({'read':!![]});}else{logger[_0x6f4c('0x29')](_0x6f4c('0xad'),_0x6f4c('0x2f'),_0x6f4c('0x8f'),util[_0x6f4c('0xc6')](_0x447fcf[_0x6f4c('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x2c64fc;}})[_0x6f4c('0x23')](respondWithResult(_0x48f216,null))[_0x6f4c('0x2d')](handleError(_0x48f216,null));};exports[_0x6f4c('0xd6')]=function(_0x47f1f9,_0x5de303,_0x2773ce){return db[_0x6f4c('0x43')][_0x6f4c('0x5d')]({'where':{'id':_0x47f1f9[_0x6f4c('0x64')]['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x5de303,null))[_0x6f4c('0x23')](function(_0x2d93b4){if(_0x2d93b4){return _0x2d93b4[_0x6f4c('0xd6')](_0x47f1f9[_0x6f4c('0x5f')]['ids'],_[_0x6f4c('0x9a')](_0x47f1f9['body'],[_0x6f4c('0x6c'),'id'])||{})[_0x6f4c('0x9d')](function(_0xb3e9dc){for(var _0x4b60ed=0x0;_0x4b60ed<_0x47f1f9['body'][_0x6f4c('0x6c')][_0x6f4c('0x4e')];_0x4b60ed+=0x1){socket[_0x6f4c('0xd7')](_0x6f4c('0xd8'),{'UserId':Number(_0x47f1f9[_0x6f4c('0x5f')][_0x6f4c('0x6c')][_0x4b60ed]),'SmsAccountId':Number(_0x47f1f9[_0x6f4c('0x64')]['id'])});}return _0xb3e9dc;});}})['then'](respondWithResult(_0x5de303,null))['catch'](handleError(_0x5de303,null));};exports[_0x6f4c('0xd9')]=function(_0x3c15cd,_0x5893a0,_0x3dff7a){return db[_0x6f4c('0x43')]['find']({'where':{'id':_0x3c15cd[_0x6f4c('0x64')]['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x5893a0,null))[_0x6f4c('0x23')](function(_0x3f9083){if(_0x3f9083){return _0x3f9083[_0x6f4c('0xd9')](_0x3c15cd['query']['ids'])[_0x6f4c('0x23')](function(){if(_[_0x6f4c('0xda')](_0x3c15cd['query'][_0x6f4c('0x6c')])){for(var _0x440a64=0x0;_0x440a64<_0x3c15cd['query']['ids'][_0x6f4c('0x4e')];_0x440a64+=0x1){socket[_0x6f4c('0xd7')](_0x6f4c('0xdb'),{'UserId':Number(_0x3c15cd[_0x6f4c('0x47')][_0x6f4c('0x6c')][_0x440a64]),'SmsAccountId':Number(_0x3c15cd[_0x6f4c('0x64')]['id'])});}}else{socket[_0x6f4c('0xd7')](_0x6f4c('0xdb'),{'UserId':Number(_0x3c15cd[_0x6f4c('0x47')][_0x6f4c('0x6c')]),'SmsAccountId':Number(_0x3c15cd[_0x6f4c('0x64')]['id'])});}});}})['then'](respondWithStatusCode(_0x5893a0,null))[_0x6f4c('0x2d')](handleError(_0x5893a0,null));};exports['getAgents']=function(_0x5e31e4,_0x3f9b15,_0x553ecc){var _0x328734={};var _0x52abef={};var _0x1d3d47;var _0xe73d22;return db[_0x6f4c('0x43')][_0x6f4c('0x67')]({'where':{'id':_0x5e31e4['params']['id']}})[_0x6f4c('0x23')](handleEntityNotFound(_0x3f9b15,null))[_0x6f4c('0x23')](function(_0x1a0594){if(_0x1a0594){_0x1d3d47=_0x1a0594;_0x52abef['model']=_[_0x6f4c('0x48')](db[_0x6f4c('0xa6')][_0x6f4c('0x44')]);_0x52abef[_0x6f4c('0x47')]=_[_0x6f4c('0x48')](_0x5e31e4[_0x6f4c('0x47')]);_0x52abef[_0x6f4c('0x49')]=_[_0x6f4c('0x4a')](_0x52abef['model'],_0x52abef[_0x6f4c('0x47')]);_0x328734[_0x6f4c('0x4c')]=_[_0x6f4c('0x4a')](_0x52abef[_0x6f4c('0x4b')],qs[_0x6f4c('0x4d')](_0x5e31e4[_0x6f4c('0x47')]['fields']));_0x328734[_0x6f4c('0x4c')]=_0x328734['attributes'][_0x6f4c('0x4e')]?_0x328734[_0x6f4c('0x4c')]:_0x52abef[_0x6f4c('0x4b')];_0x328734[_0x6f4c('0x51')]=qs[_0x6f4c('0x52')](_0x5e31e4['query'][_0x6f4c('0x52')]);_0x328734[_0x6f4c('0x53')]=qs[_0x6f4c('0x49')](_[_0x6f4c('0x69')](_0x5e31e4['query'],_0x52abef[_0x6f4c('0x49')]));if(_0x5e31e4[_0x6f4c('0x47')]['filter']){_0x328734[_0x6f4c('0x53')]=_[_0x6f4c('0x57')](_0x328734[_0x6f4c('0x53')],{'$or':_['map'](_0x328734['attributes'],function(_0x224eca){var _0x533945={};_0x533945[_0x224eca]={'$like':'%'+_0x5e31e4[_0x6f4c('0x47')]['filter']+'%'};return _0x533945;})});}_0x328734=_[_0x6f4c('0x57')]({},_0x328734,_0x5e31e4[_0x6f4c('0x58')]);return _0x1d3d47['getAgents'](_0x328734);}})[_0x6f4c('0x23')](function(_0x29f5a0){if(_0x29f5a0){_0xe73d22=_0x29f5a0['length'];if(!_0x5e31e4['query'][_0x6f4c('0x4f')](_0x6f4c('0x50'))){_0x328734[_0x6f4c('0x33')]=qs[_0x6f4c('0x33')](_0x5e31e4[_0x6f4c('0x47')][_0x6f4c('0x33')]);_0x328734['offset']=qs[_0x6f4c('0x32')](_0x5e31e4[_0x6f4c('0x47')][_0x6f4c('0x32')]);}return _0x1d3d47[_0x6f4c('0xdc')](_0x328734);}})[_0x6f4c('0x23')](function(_0x2819e2){if(_0x2819e2){return _0x2819e2?{'count':_0xe73d22,'rows':_0x2819e2}:null;}})['then'](respondWithResult(_0x3f9b15,null))['catch'](handleError(_0x3f9b15,null));}; \ No newline at end of file +var _0x8d5b=['localhost','register','client','http','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsAccount,\x20%s,\x20%s','message','catch','status','end','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','intersection','fields','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','Disposition','findOne','hasOwnProperty','SmsAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sms','Applications','account','applications','priority','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','Body','messageId','skebby','from','sender','text','connectel','clicksend','Text','results','csc','segmentedMessage','clickatell','replyMessageId','intelepeer','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','created','close','unmanaged','*,*,*,*','ContactId','AttachmentId','interaction','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','SmsApplication','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','bandwidth','redif','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x64d7f,_0x43ed82){var _0x177546=function(_0x4891d4){while(--_0x4891d4){_0x64d7f['push'](_0x64d7f['shift']());}};_0x177546(++_0x43ed82);}(_0x8d5b,0xc8));var _0xb8d5=function(_0x41094d,_0x4ca21d){_0x41094d=_0x41094d-0x0;var _0x503ee1=_0x8d5b[_0x41094d];return _0x503ee1;};'use strict';var emlformat=require(_0xb8d5('0x0'));var rimraf=require(_0xb8d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8d5('0x2'));var rp=require(_0xb8d5('0x3'));var moment=require(_0xb8d5('0x4'));var BPromise=require(_0xb8d5('0x5'));var Mustache=require(_0xb8d5('0x6'));var util=require('util');var path=require(_0xb8d5('0x7'));var sox=require(_0xb8d5('0x8'));var csv=require(_0xb8d5('0x9'));var ejs=require(_0xb8d5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8d5('0xb'));var squel=require(_0xb8d5('0xc'));var crypto=require(_0xb8d5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb8d5('0xe'));var toCsv=require(_0xb8d5('0x9'));var querystring=require(_0xb8d5('0xf'));var Papa=require(_0xb8d5('0x10'));var Redis=require(_0xb8d5('0x11'));var authService=require(_0xb8d5('0x12'));var qs=require(_0xb8d5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8d5('0x14'));var logger=require('../../config/logger')(_0xb8d5('0x15'));var utils=require(_0xb8d5('0x16'));var config=require(_0xb8d5('0x17'));var licenseUtil=require(_0xb8d5('0x18'));var db=require(_0xb8d5('0x19'))['db'];config[_0xb8d5('0x1a')]=_['defaults'](config[_0xb8d5('0x1a')],{'host':_0xb8d5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0xb8d5('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb8d5('0x1d')][_0xb8d5('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x595ddb,_0x7f3ebd,_0x5313c5,_0x4de236){return new BPromise(function(_0x56bacf,_0x367feb){var _0x3ad837=_0x4de236||client;return _0x3ad837[_0xb8d5('0x1f')](_0x595ddb,_0x5313c5)[_0xb8d5('0x20')](function(_0x55892e){logger[_0xb8d5('0x21')]('SmsAccount,\x20%s,\x20%s',_0x7f3ebd,'request\x20sent');logger[_0xb8d5('0x22')](_0xb8d5('0x23'),_0x7f3ebd,_0xb8d5('0x24'),JSON[_0xb8d5('0x25')](_0x55892e));if(_0x55892e[_0xb8d5('0x26')]){if(_0x55892e[_0xb8d5('0x26')]['code']===0x1f4){logger[_0xb8d5('0x26')](_0xb8d5('0x27'),_0x7f3ebd,_0x55892e['error']['message']);return _0x367feb(_0x55892e['error']['message']);}logger['error'](_0xb8d5('0x27'),_0x7f3ebd,_0x55892e[_0xb8d5('0x26')][_0xb8d5('0x28')]);return _0x56bacf(_0x55892e['error']['message']);}else{logger[_0xb8d5('0x21')](_0xb8d5('0x27'),_0x7f3ebd,_0xb8d5('0x24'));_0x56bacf(_0x55892e['result'][_0xb8d5('0x28')]);}})[_0xb8d5('0x29')](function(_0x57e6d2){logger[_0xb8d5('0x26')]('SmsAccount,\x20%s,\x20%s',_0x7f3ebd,_0x57e6d2);_0x367feb(_0x57e6d2);});});}function respondWithStatusCode(_0x297ebe,_0x42cb11){_0x42cb11=_0x42cb11||0xcc;return function(_0x10ef6f){if(_0x10ef6f){return _0x297ebe['sendStatus'](_0x42cb11);}return _0x297ebe[_0xb8d5('0x2a')](_0x42cb11)[_0xb8d5('0x2b')]();};}function respondWithResult(_0x5b1a27,_0xc05d7b){_0xc05d7b=_0xc05d7b||0xc8;return function(_0x35a071){if(_0x35a071){return _0x5b1a27[_0xb8d5('0x2a')](_0xc05d7b)['json'](_0x35a071);}};}function respondWithFilteredResult(_0x473fd6,_0xba06c1){return function(_0x585c70){if(_0x585c70){var _0x5f0362=typeof _0xba06c1[_0xb8d5('0x2c')]==='undefined'&&typeof _0xba06c1[_0xb8d5('0x2d')]===_0xb8d5('0x2e');var _0x2df16a=_0x585c70['count'];var _0x4c56cb=_0x5f0362?0x0:_0xba06c1[_0xb8d5('0x2c')];var _0x4fd235=_0x5f0362?_0x585c70['count']:_0xba06c1[_0xb8d5('0x2c')]+_0xba06c1[_0xb8d5('0x2d')];var _0x1a55af;if(_0x4fd235>=_0x2df16a){_0x4fd235=_0x2df16a;_0x1a55af=0xc8;}else{_0x1a55af=0xce;}_0x473fd6[_0xb8d5('0x2a')](_0x1a55af);return _0x473fd6[_0xb8d5('0x2f')](_0xb8d5('0x30'),_0x4c56cb+'-'+_0x4fd235+'/'+_0x2df16a)[_0xb8d5('0x31')](_0x585c70);}return null;};}function patchUpdates(_0x420fd1){return function(_0x2e52e9){try{jsonpatch[_0xb8d5('0x32')](_0x2e52e9,_0x420fd1,!![]);}catch(_0x2d88ee){return BPromise[_0xb8d5('0x33')](_0x2d88ee);}return _0x2e52e9[_0xb8d5('0x34')]();};}function saveUpdates(_0x5665a3,_0xbbe0de){return function(_0x567dde){if(_0x567dde){return _0x567dde[_0xb8d5('0x35')](_0x5665a3)[_0xb8d5('0x20')](function(_0x574014){return _0x574014;});}return null;};}function removeEntity(_0x4154d3,_0x4594c6){return function(_0x111a84){if(_0x111a84){return _0x111a84[_0xb8d5('0x36')]()[_0xb8d5('0x20')](function(){var _0x4dcebd=_0x111a84[_0xb8d5('0x37')]({'plain':!![]});var _0x5b17aa='SmsAccounts';return db[_0xb8d5('0x38')][_0xb8d5('0x36')]({'where':{'type':_0x5b17aa,'resourceId':_0x4dcebd['id']}})[_0xb8d5('0x20')](function(){return _0x111a84;});})[_0xb8d5('0x20')](function(){_0x4154d3[_0xb8d5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dbcff,_0x2a60de){return function(_0x5d4a35){if(!_0x5d4a35){_0x5dbcff[_0xb8d5('0x39')](0x194);}return _0x5d4a35;};}function handleError(_0x55a219,_0x2e6040){_0x2e6040=_0x2e6040||0x1f4;return function(_0x1166b4){logger[_0xb8d5('0x26')](_0x1166b4['stack']);if(_0x1166b4[_0xb8d5('0x3a')]){delete _0x1166b4[_0xb8d5('0x3a')];}_0x55a219['status'](_0x2e6040)[_0xb8d5('0x3b')](_0x1166b4);};}exports[_0xb8d5('0x3c')]=function(_0x29ff0d,_0x19e443){var _0x5ba0c3={'include':[{'model':db[_0xb8d5('0x3d')],'as':_0xb8d5('0x3e')}]},_0x4dea7d={},_0x52914b={'count':0x0,'rows':[]};var _0x4fb852=_[_0xb8d5('0x3f')](db[_0xb8d5('0x40')][_0xb8d5('0x41')],function(_0x33bf51){return{'name':_0x33bf51['fieldName'],'type':_0x33bf51[_0xb8d5('0x42')][_0xb8d5('0x43')]};});_0x4dea7d[_0xb8d5('0x44')]=_[_0xb8d5('0x3f')](_0x4fb852,_0xb8d5('0x3a'));_0x4dea7d[_0xb8d5('0x45')]=_[_0xb8d5('0x46')](_0x29ff0d[_0xb8d5('0x45')]);_0x4dea7d[_0xb8d5('0x47')]=_['intersection'](_0x4dea7d[_0xb8d5('0x44')],_0x4dea7d[_0xb8d5('0x45')]);_0x5ba0c3['attributes']=_['intersection'](_0x4dea7d[_0xb8d5('0x44')],qs['fields'](_0x29ff0d['query']['fields']));_0x5ba0c3[_0xb8d5('0x48')]=_0x5ba0c3[_0xb8d5('0x48')]['length']?_0x5ba0c3[_0xb8d5('0x48')]:_0x4dea7d[_0xb8d5('0x44')];if(!_0x29ff0d[_0xb8d5('0x45')]['hasOwnProperty'](_0xb8d5('0x49'))){_0x5ba0c3[_0xb8d5('0x2d')]=qs[_0xb8d5('0x2d')](_0x29ff0d['query'][_0xb8d5('0x2d')]);_0x5ba0c3[_0xb8d5('0x2c')]=qs[_0xb8d5('0x2c')](_0x29ff0d[_0xb8d5('0x45')][_0xb8d5('0x2c')]);}_0x5ba0c3[_0xb8d5('0x4a')]=qs[_0xb8d5('0x4b')](_0x29ff0d[_0xb8d5('0x45')][_0xb8d5('0x4b')]);_0x5ba0c3[_0xb8d5('0x4c')]=qs[_0xb8d5('0x47')](_[_0xb8d5('0x4d')](_0x29ff0d[_0xb8d5('0x45')],_0x4dea7d[_0xb8d5('0x47')]),_0x4fb852);if(_0x29ff0d['query'][_0xb8d5('0x4e')]){_0x5ba0c3[_0xb8d5('0x4c')]=_[_0xb8d5('0x4f')](_0x5ba0c3[_0xb8d5('0x4c')],{'$or':_[_0xb8d5('0x3f')](_0x4fb852,function(_0x9b48a4){if(_0x9b48a4[_0xb8d5('0x42')]!==_0xb8d5('0x50')){var _0x353dc2={};_0x353dc2[_0x9b48a4['name']]={'$like':'%'+_0x29ff0d[_0xb8d5('0x45')][_0xb8d5('0x4e')]+'%'};return _0x353dc2;}})});}_0x5ba0c3=_[_0xb8d5('0x4f')]({},_0x5ba0c3,_0x29ff0d[_0xb8d5('0x51')]);var _0xbecf26={'where':_0x5ba0c3[_0xb8d5('0x4c')]};return db[_0xb8d5('0x40')][_0xb8d5('0x52')](_0xbecf26)[_0xb8d5('0x20')](function(_0x1172ce){_0x52914b[_0xb8d5('0x52')]=_0x1172ce;if(_0x29ff0d[_0xb8d5('0x45')][_0xb8d5('0x53')]){_0x5ba0c3[_0xb8d5('0x54')]=[{'all':!![]}];}return db[_0xb8d5('0x40')][_0xb8d5('0x55')](_0x5ba0c3);})[_0xb8d5('0x20')](function(_0x2128a6){_0x52914b[_0xb8d5('0x56')]=_0x2128a6;return _0x52914b;})[_0xb8d5('0x20')](respondWithFilteredResult(_0x19e443,_0x5ba0c3))[_0xb8d5('0x29')](handleError(_0x19e443,null));};exports[_0xb8d5('0x57')]=function(_0x154278,_0x2e307e){var _0x4a4ee9={'raw':![],'where':{'id':_0x154278['params']['id']},'include':[{'model':db[_0xb8d5('0x3d')],'as':_0xb8d5('0x3e')}]},_0x274fb7={};_0x274fb7[_0xb8d5('0x44')]=_['keys'](db[_0xb8d5('0x40')][_0xb8d5('0x41')]);_0x274fb7['query']=_[_0xb8d5('0x46')](_0x154278[_0xb8d5('0x45')]);_0x274fb7[_0xb8d5('0x47')]=_[_0xb8d5('0x58')](_0x274fb7['model'],_0x274fb7[_0xb8d5('0x45')]);_0x4a4ee9[_0xb8d5('0x48')]=_[_0xb8d5('0x58')](_0x274fb7[_0xb8d5('0x44')],qs['fields'](_0x154278[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x4a4ee9[_0xb8d5('0x48')]=_0x4a4ee9[_0xb8d5('0x48')][_0xb8d5('0x5a')]?_0x4a4ee9[_0xb8d5('0x48')]:_0x274fb7[_0xb8d5('0x44')];if(_0x154278[_0xb8d5('0x45')]['includeAll']){_0x4a4ee9[_0xb8d5('0x54')]=[{'all':!![]}];}_0x4a4ee9=_[_0xb8d5('0x4f')]({},_0x4a4ee9,_0x154278[_0xb8d5('0x51')]);return db['SmsAccount'][_0xb8d5('0x5b')](_0x4a4ee9)['then'](handleEntityNotFound(_0x2e307e,null))['then'](respondWithResult(_0x2e307e,null))[_0xb8d5('0x29')](handleError(_0x2e307e,null));};exports[_0xb8d5('0x5c')]=function(_0x16d0f0,_0x1ff294){return db[_0xb8d5('0x40')][_0xb8d5('0x5c')](_0x16d0f0['body'],{})['then'](function(_0x5337e5){var _0x35c778=_0x16d0f0[_0xb8d5('0x5d')][_0xb8d5('0x37')]({'plain':!![]});if(!_0x35c778)throw new Error(_0xb8d5('0x5e'));if(_0x35c778['role']===_0xb8d5('0x5d')){var _0x3d8fd3=_0x5337e5['get']({'plain':!![]});var _0x13937a=_0xb8d5('0x5f');return db[_0xb8d5('0x60')][_0xb8d5('0x5b')]({'where':{'name':_0x13937a,'userProfileId':_0x35c778[_0xb8d5('0x61')]},'raw':!![]})[_0xb8d5('0x20')](function(_0x53de31){if(_0x53de31&&_0x53de31[_0xb8d5('0x62')]===0x0){return db[_0xb8d5('0x38')][_0xb8d5('0x5c')]({'name':_0x3d8fd3[_0xb8d5('0x3a')],'resourceId':_0x3d8fd3['id'],'type':_0x53de31[_0xb8d5('0x3a')],'sectionId':_0x53de31['id']},{})[_0xb8d5('0x20')](function(){return _0x5337e5;});}else{return _0x5337e5;}})['catch'](function(_0x48da15){logger['error'](_0xb8d5('0x63'),_0x48da15);throw _0x48da15;});}return _0x5337e5;})[_0xb8d5('0x20')](respondWithResult(_0x1ff294,0xc9))[_0xb8d5('0x29')](handleError(_0x1ff294,null));};exports[_0xb8d5('0x35')]=function(_0x31d1d4,_0x39a316){if(_0x31d1d4['body']['id']){delete _0x31d1d4[_0xb8d5('0x64')]['id'];}return db['SmsAccount'][_0xb8d5('0x5b')]({'where':{'id':_0x31d1d4[_0xb8d5('0x65')]['id']},'include':[{'model':db[_0xb8d5('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xb8d5('0x20')](handleEntityNotFound(_0x39a316,null))[_0xb8d5('0x20')](saveUpdates(_0x31d1d4[_0xb8d5('0x64')],null))[_0xb8d5('0x20')](respondWithResult(_0x39a316,null))[_0xb8d5('0x29')](handleError(_0x39a316,null));};exports[_0xb8d5('0x36')]=function(_0xb45488,_0x2313ec){return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0xb45488['params']['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x2313ec,null))[_0xb8d5('0x20')](removeEntity(_0x2313ec,null))[_0xb8d5('0x29')](handleError(_0x2313ec,null));};exports[_0xb8d5('0x66')]=function(_0x424594,_0x5dddc1){return db[_0xb8d5('0x40')][_0xb8d5('0x66')]()['then'](respondWithResult(_0x5dddc1,null))[_0xb8d5('0x29')](handleError(_0x5dddc1,null));};exports[_0xb8d5('0x67')]=function(_0x562fe9,_0x341bc1,_0x3f7f28){if(_0x562fe9[_0xb8d5('0x64')]['id']){delete _0x562fe9[_0xb8d5('0x64')]['id'];}return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x562fe9[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x341bc1,null))[_0xb8d5('0x20')](function(_0x12a27d){if(_0x12a27d){_0x562fe9['body']['SmsAccountId']=_0x12a27d['id'];return db[_0xb8d5('0x68')][_0xb8d5('0x5c')](_0x562fe9['body']);}})[_0xb8d5('0x20')](respondWithResult(_0x341bc1,null))[_0xb8d5('0x29')](handleError(_0x341bc1,null));};exports['getDispositions']=function(_0x37f7f4,_0x2ebcbc,_0x7c6df0){var _0x4165f1={'raw':![],'where':{}};var _0x5abb39={};var _0x46b939={'count':0x0,'rows':[]};return db[_0xb8d5('0x40')][_0xb8d5('0x69')]({'where':{'id':_0x37f7f4['params']['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x2ebcbc,null))[_0xb8d5('0x20')](function(_0x9af3d6){if(_0x9af3d6){_0x5abb39[_0xb8d5('0x44')]=_[_0xb8d5('0x46')](db['Disposition']['rawAttributes']);_0x5abb39['query']=_[_0xb8d5('0x46')](_0x37f7f4[_0xb8d5('0x45')]);_0x5abb39['filters']=_[_0xb8d5('0x58')](_0x5abb39['model'],_0x5abb39[_0xb8d5('0x45')]);_0x4165f1[_0xb8d5('0x48')]=_[_0xb8d5('0x58')](_0x5abb39[_0xb8d5('0x44')],qs[_0xb8d5('0x59')](_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x4165f1[_0xb8d5('0x48')]=_0x4165f1['attributes'][_0xb8d5('0x5a')]?_0x4165f1[_0xb8d5('0x48')]:_0x5abb39[_0xb8d5('0x44')];if(!_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x6a')]('nolimit')){_0x4165f1['limit']=qs['limit'](_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x2d')]);_0x4165f1['offset']=qs[_0xb8d5('0x2c')](_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x2c')]);}_0x4165f1['order']=qs[_0xb8d5('0x4b')](_0x37f7f4[_0xb8d5('0x45')]['sort']);_0x4165f1[_0xb8d5('0x4c')]=qs[_0xb8d5('0x47')](_[_0xb8d5('0x4d')](_0x37f7f4[_0xb8d5('0x45')],_0x5abb39[_0xb8d5('0x47')]));_0x4165f1[_0xb8d5('0x4c')][_0xb8d5('0x6b')]=_0x9af3d6['id'];if(_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x4e')]){_0x4165f1[_0xb8d5('0x4c')]=_['merge'](_0x4165f1[_0xb8d5('0x4c')],{'$or':_[_0xb8d5('0x3f')](_0x4165f1[_0xb8d5('0x48')],function(_0x2cb9ee){var _0x1cc337={};_0x1cc337[_0x2cb9ee]={'$like':'%'+_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x4e')]+'%'};return _0x1cc337;})});}_0x4165f1=_[_0xb8d5('0x4f')]({},_0x4165f1,_0x37f7f4[_0xb8d5('0x51')]);return db['Disposition'][_0xb8d5('0x52')]({'where':_0x4165f1[_0xb8d5('0x4c')]})['then'](function(_0x4670ab){_0x46b939[_0xb8d5('0x52')]=_0x4670ab;if(_0x37f7f4[_0xb8d5('0x45')]['includeAll']){_0x4165f1[_0xb8d5('0x54')]=[{'all':!![]}];}return db[_0xb8d5('0x68')][_0xb8d5('0x55')](_0x4165f1);})[_0xb8d5('0x20')](function(_0x4de435){_0x46b939[_0xb8d5('0x56')]=_0x4de435;return _0x46b939;});}})[_0xb8d5('0x20')](respondWithFilteredResult(_0x2ebcbc,_0x4165f1))[_0xb8d5('0x29')](handleError(_0x2ebcbc,null));};exports[_0xb8d5('0x6c')]=function(_0x4d42d0,_0x287880,_0x4000a3){return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x4d42d0[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x287880,null))[_0xb8d5('0x20')](function(_0x25f71f){if(_0x25f71f){return _0x25f71f['removeDispositions'](_0x4d42d0['query'][_0xb8d5('0x6d')]);}})[_0xb8d5('0x20')](respondWithStatusCode(_0x287880,null))['catch'](handleError(_0x287880,null));};exports[_0xb8d5('0x6e')]=function(_0xda372b,_0x51e35d,_0x3851a1){if(_0xda372b[_0xb8d5('0x64')]['id']){delete _0xda372b[_0xb8d5('0x64')]['id'];}return db[_0xb8d5('0x40')]['find']({'where':{'id':_0xda372b[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x51e35d,null))[_0xb8d5('0x20')](function(_0x39c023){if(_0x39c023){_0xda372b[_0xb8d5('0x64')][_0xb8d5('0x6b')]=_0x39c023['id'];return db['CannedAnswer'][_0xb8d5('0x5c')](_0xda372b[_0xb8d5('0x64')]);}})[_0xb8d5('0x20')](respondWithResult(_0x51e35d,null))[_0xb8d5('0x29')](handleError(_0x51e35d,null));};exports[_0xb8d5('0x6f')]=function(_0x4ba1ee,_0x4af0bb,_0x4881d8){var _0x469cf7={'raw':![],'where':{}};var _0x3f5b04={};var _0x274207={'count':0x0,'rows':[]};return db[_0xb8d5('0x40')][_0xb8d5('0x69')]({'where':{'id':_0x4ba1ee['params']['id']}})['then'](handleEntityNotFound(_0x4af0bb,null))[_0xb8d5('0x20')](function(_0x28d344){if(_0x28d344){_0x3f5b04[_0xb8d5('0x44')]=_[_0xb8d5('0x46')](db[_0xb8d5('0x70')]['rawAttributes']);_0x3f5b04[_0xb8d5('0x45')]=_[_0xb8d5('0x46')](_0x4ba1ee[_0xb8d5('0x45')]);_0x3f5b04[_0xb8d5('0x47')]=_['intersection'](_0x3f5b04[_0xb8d5('0x44')],_0x3f5b04[_0xb8d5('0x45')]);_0x469cf7[_0xb8d5('0x48')]=_[_0xb8d5('0x58')](_0x3f5b04[_0xb8d5('0x44')],qs['fields'](_0x4ba1ee[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x469cf7['attributes']=_0x469cf7['attributes'][_0xb8d5('0x5a')]?_0x469cf7['attributes']:_0x3f5b04[_0xb8d5('0x44')];if(!_0x4ba1ee['query'][_0xb8d5('0x6a')](_0xb8d5('0x49'))){_0x469cf7['limit']=qs[_0xb8d5('0x2d')](_0x4ba1ee[_0xb8d5('0x45')][_0xb8d5('0x2d')]);_0x469cf7[_0xb8d5('0x2c')]=qs[_0xb8d5('0x2c')](_0x4ba1ee['query'][_0xb8d5('0x2c')]);}_0x469cf7[_0xb8d5('0x4a')]=qs[_0xb8d5('0x4b')](_0x4ba1ee['query'][_0xb8d5('0x4b')]);_0x469cf7[_0xb8d5('0x4c')]=qs['filters'](_[_0xb8d5('0x4d')](_0x4ba1ee[_0xb8d5('0x45')],_0x3f5b04[_0xb8d5('0x47')]));_0x469cf7['where'][_0xb8d5('0x6b')]=_0x28d344['id'];if(_0x4ba1ee[_0xb8d5('0x45')]['filter']){_0x469cf7[_0xb8d5('0x4c')]=_[_0xb8d5('0x4f')](_0x469cf7[_0xb8d5('0x4c')],{'$or':_['map'](_0x469cf7[_0xb8d5('0x48')],function(_0x405e6e){var _0x176863={};_0x176863[_0x405e6e]={'$like':'%'+_0x4ba1ee[_0xb8d5('0x45')]['filter']+'%'};return _0x176863;})});}_0x469cf7=_[_0xb8d5('0x4f')]({},_0x469cf7,_0x4ba1ee['options']);return db[_0xb8d5('0x70')][_0xb8d5('0x52')]({'where':_0x469cf7[_0xb8d5('0x4c')]})['then'](function(_0x212b57){_0x274207[_0xb8d5('0x52')]=_0x212b57;if(_0x4ba1ee[_0xb8d5('0x45')][_0xb8d5('0x53')]){_0x469cf7[_0xb8d5('0x54')]=[{'all':!![]}];}return db[_0xb8d5('0x70')][_0xb8d5('0x55')](_0x469cf7);})[_0xb8d5('0x20')](function(_0x2d9339){_0x274207[_0xb8d5('0x56')]=_0x2d9339;return _0x274207;});}})[_0xb8d5('0x20')](respondWithFilteredResult(_0x4af0bb,_0x469cf7))[_0xb8d5('0x29')](handleError(_0x4af0bb,null));};exports[_0xb8d5('0x71')]=function(_0x489b82,_0x1d6ee1,_0x46a65a){return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x489b82['params']['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x1d6ee1,null))[_0xb8d5('0x20')](function(_0x260966){if(_0x260966){return _0x260966[_0xb8d5('0x71')](_0x489b82[_0xb8d5('0x45')][_0xb8d5('0x6d')]);}})[_0xb8d5('0x20')](respondWithStatusCode(_0x1d6ee1,null))['catch'](handleError(_0x1d6ee1,null));};exports['notify']=function(_0x2de832,_0x2c9770,_0xd0d4e6){var _0x2cf829={'channel':_0xb8d5('0x72')};var _0x327d42=[];var _0x64b63a=[];var _0x522043={};return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x2de832[_0xb8d5('0x65')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xb8d5('0x73')}]})[_0xb8d5('0x20')](handleEntityNotFound(_0x2c9770,null))['then'](function(_0x345e60){_0x2cf829[_0xb8d5('0x74')]=_0x345e60;_0x2cf829[_0xb8d5('0x75')]=_['orderBy'](_0x345e60[_0xb8d5('0x73')],[_0xb8d5('0x76')],['asc']);if(_0x2cf829[_0xb8d5('0x74')][_0xb8d5('0x73')]){delete _0x2cf829[_0xb8d5('0x74')][_0xb8d5('0x73')];}return db['CmContact'][_0xb8d5('0x66')]();})[_0xb8d5('0x20')](function(_0x516021){if(!_0x516021){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))](_0xb8d5('0x79'));}_0x327d42=_[_0xb8d5('0x7a')](_[_0xb8d5('0x46')](_0x516021),[_0xb8d5('0x7b'),_0xb8d5('0x7c')]);_0x64b63a=_['difference'](_[_0xb8d5('0x46')](_0x516021),[_0xb8d5('0x7b'),_0xb8d5('0x7c'),_0xb8d5('0x7d'),_0xb8d5('0x7e')]);_0x2cf829[_0xb8d5('0x64')]={'mapKey':_0xb8d5('0x7f')};if(_0x2cf829[_0xb8d5('0x74')][_0xb8d5('0x42')]){switch(_0x2cf829['account'][_0xb8d5('0x42')]){case'twilio':_0x2cf829[_0xb8d5('0x64')]['from']=_0x2de832[_0xb8d5('0x64')]['From'];_0x2cf829['body']['body']=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x80')];_0x2cf829['body'][_0xb8d5('0x81')]=_0x2de832[_0xb8d5('0x64')]['MessageSid'];break;case _0xb8d5('0x82'):_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]='+'+_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x84')];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x85')];break;case _0xb8d5('0x86'):_0x2cf829['body'][_0xb8d5('0x83')]=_0x2de832['body']['from'];_0x2cf829['body'][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x28')];break;case _0xb8d5('0x87'):_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x83')];_0x2cf829[_0xb8d5('0x64')]['body']=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x64')];_0x2cf829['body']['messageId']=_0x2de832[_0xb8d5('0x64')]['message_id'];break;case'plivo':_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')]['From'];_0x2cf829['body'][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x88')];_0x2cf829['body']['messageId']=_0x2de832[_0xb8d5('0x64')]['MessageUUID'];break;case'infobip':_0x2cf829['body'][_0xb8d5('0x83')]='+'+_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x89')][0x0][_0xb8d5('0x83')];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x89')][0x0][_0xb8d5('0x85')];_0x2cf829[_0xb8d5('0x64')]['messageId']=_0x2de832['body'][_0xb8d5('0x89')][0x0][_0xb8d5('0x81')];break;case _0xb8d5('0x8a'):_0x2cf829['body'][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')]['originatingAddress'];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]=_0x2de832['body'][_0xb8d5('0x8b')][_0xb8d5('0x28')];break;case _0xb8d5('0x8c'):_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')]['fromNumber'];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')]['text'];_0x2cf829[_0xb8d5('0x64')]['messageId']=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x8d')];break;case'bandwidth':_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x81')]=_0x2de832[_0xb8d5('0x64')][0x0][_0xb8d5('0x28')]['id'];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')][0x0][_0xb8d5('0x28')]['from'];_0x2cf829[_0xb8d5('0x64')]['body']=_0x2de832[_0xb8d5('0x64')][0x0]['message']['text'];break;case _0xb8d5('0x8e'):_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x83')];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x28')];_0x2cf829['body'][_0xb8d5('0x81')]=_0x2de832['body']['refid'];break;}}if(_0x2cf829[_0xb8d5('0x64')]['id']){delete _0x2cf829[_0xb8d5('0x64')]['id'];}if(_[_0xb8d5('0x8f')](_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')])){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))](_0xb8d5('0x90'));}if(_['isNil'](_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')])||_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]===''){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb8d5('0x8f')](_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x91')])){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))](_0xb8d5('0x92')+_0x64b63a);}if(!_[_0xb8d5('0x93')](_0x64b63a,_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x91')])){throw new db[(_0xb8d5('0x77'))]['ValidationError'](_0xb8d5('0x94')+_0x64b63a);}_0x522043[_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x91')]]=_0x2cf829[_0xb8d5('0x64')]['from'];return db[_0xb8d5('0x95')][_0xb8d5('0x5b')]({'where':{'id':_0x2cf829[_0xb8d5('0x74')][_0xb8d5('0x7e')]},'include':[{'model':db[_0xb8d5('0x96')],'as':_0xb8d5('0x97'),'where':_0x522043,'limit':0x1,'order':[['updatedAt',_0xb8d5('0x98')]]}]});})[_0xb8d5('0x20')](handleEntityNotFound(_0x2c9770,null))[_0xb8d5('0x20')](function(_0x1646dd){if(_0x1646dd){_0x2cf829[_0xb8d5('0x99')]=_[_0xb8d5('0x9a')](_0x1646dd,[_0xb8d5('0x97')]);if(_0x1646dd[_0xb8d5('0x97')]['length']){return _0x1646dd[_0xb8d5('0x97')][0x0];}var _0x4f10f8=_[_0xb8d5('0x9b')](_0x2cf829[_0xb8d5('0x64')],{'firstName':_0x2cf829['body'][_0xb8d5('0x83')],'ListId':_0x1646dd['id']});_0x4f10f8[_0x2cf829[_0xb8d5('0x64')]['mapKey']]=_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')];return db[_0xb8d5('0x96')][_0xb8d5('0x5c')](_0x4f10f8,{'fields':_0x327d42,'raw':!![]});}})[_0xb8d5('0x20')](handleEntityNotFound(_0x2c9770,null))['then'](function(_0x471460){if(_0x471460){_0x2cf829[_0xb8d5('0x9c')]=_0x471460;var _0x5b7d93={'ContactId':_0x471460['id'],'phone':_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')],'SmsAccountId':_0x2de832['params']['id']};var _0xf5ba5={'ContactId':_0x471460['id'],'SmsAccountId':_0x2de832[_0xb8d5('0x65')]['id'],'closed':![]};return db[_0xb8d5('0x9d')][_0xb8d5('0x5b')]({'where':_0xf5ba5})['then'](function(_0x42dfaf){if(_0x42dfaf){return[_0x42dfaf,![]];}return db[_0xb8d5('0x9d')]['create'](_0x5b7d93)[_0xb8d5('0x20')](function(_0x37d9a5){return[_0x37d9a5,!![]];});});}})[_0xb8d5('0x9e')](function(_0x19986b,_0x2dfd41){_0x2cf829['interaction']=_0x19986b[_0xb8d5('0x37')]({'plain':!![]});_0x2cf829['interaction'][_0xb8d5('0x9f')]=![];if(_0x2dfd41){if(_0x2cf829['account']['autoclose']){_0x2cf829[_0xb8d5('0x75')]['push']({'id':0x0,'priority':_0x2cf829[_0xb8d5('0x75')]['length']+0x1,'app':_0xb8d5('0xa0'),'appdata':_0xb8d5('0xa1'),'interval':_0xb8d5('0xa2')});}_0x2cf829['interaction']['created']=!![];}return db['SmsMessage'][_0xb8d5('0x5c')]({'phone':_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')],'messageId':_0x2cf829[_0xb8d5('0x64')]['messageId'],'body':_0x2cf829[_0xb8d5('0x64')]['body'],'SmsAccountId':_0x2de832[_0xb8d5('0x65')]['id'],'SmsInteractionId':_0x19986b['id'],'direction':'in','ContactId':_0x19986b[_0xb8d5('0xa3')],'AttachmentId':_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0xa4')]});})[_0xb8d5('0x20')](function(_0x2aaa13){_0x2cf829['message']=_0x2aaa13;if(_0x2cf829[_0xb8d5('0xa5')][_0xb8d5('0xa6')]){return db[_0xb8d5('0xa7')][_0xb8d5('0x5b')]({'attributes':['id',_0xb8d5('0x3a')],'where':{'id':_0x2cf829[_0xb8d5('0xa5')]['UserId']}})['then'](function(_0x1bd5b5){if(_0x1bd5b5){_0x2cf829['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xb8d5('0xa8'),'appdata':_0x1bd5b5[_0xb8d5('0x3a')]+','+(_0x2cf829[_0xb8d5('0x74')][_0xb8d5('0xa9')]||0xa),'interval':_0xb8d5('0xa2')});}return respondWithRpcPromise(_0xb8d5('0xaa'),_0xb8d5('0xab'),_0x2cf829);});}return respondWithRpcPromise(_0xb8d5('0xaa'),'startRouting',_0x2cf829);})[_0xb8d5('0x20')](function(_0x528418){if(_0x528418){var _0x252c34=0xc8;var _0x557a22=_0xb8d5('0xac');logger[_0xb8d5('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x557a22,_0x252c34,_0xb8d5('0xad'));logger[_0xb8d5('0x22')](_0xb8d5('0xae'),_0x557a22,_0x252c34,'entity\x20found',JSON['stringify'](_0x528418));if(_0x2cf829[_0xb8d5('0x74')][_0xb8d5('0x42')]===_0xb8d5('0xaf')){return _0x2c9770[_0xb8d5('0x2a')](_0x252c34)[_0xb8d5('0x2f')](_0xb8d5('0xb0'),_0xb8d5('0xb1'))['send'](_0xb8d5('0xb2'));}else{return _0x2c9770[_0xb8d5('0x2a')](_0x252c34)['json'](_0x528418);}}})[_0xb8d5('0x29')](handleError(_0x2c9770,null));};exports[_0xb8d5('0xb3')]=function(_0x201e48,_0x3b6d30){var _0x23aed7=_0x201e48[_0xb8d5('0x65')]['id'];var _0x4f2591=_0x201e48[_0xb8d5('0x64')];var _0x5c04f8=0xc8;var _0x56e868=null;return db['sequelize'][_0xb8d5('0xb4')]({'isolationLevel':db[_0xb8d5('0xb5')][_0xb8d5('0xb6')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1b40b2){return db[_0xb8d5('0x40')][_0xb8d5('0x69')]({'where':{'id':_0x23aed7},'transaction':_0x1b40b2})[_0xb8d5('0x20')](function(_0x96fbc0){if(_0x96fbc0){return db[_0xb8d5('0xb7')][_0xb8d5('0x36')]({'where':{'SmsAccountId':_0x23aed7},'transaction':_0x1b40b2})[_0xb8d5('0x20')](function(){var _0x4ffd73=_[_0xb8d5('0x3f')](_0x4f2591,function(_0x2f772f){_0x2f772f[_0xb8d5('0x6b')]=_0x23aed7;return _0x2f772f;});return db[_0xb8d5('0xb7')]['bulkCreate'](_0x4ffd73,{'transaction':_0x1b40b2});});}else{_0x5c04f8=0x194;_0x56e868=[];}});})[_0xb8d5('0x20')](function(){if(_0x5c04f8!==0x194){return db[_0xb8d5('0xb7')][_0xb8d5('0xb8')]({'where':{'SmsAccountId':_0x23aed7},'order':_0xb8d5('0x76')})[_0xb8d5('0x20')](function(_0xc8a20b){_0x56e868=_0xc8a20b;});}})[_0xb8d5('0x29')](function(_0x325b28){_0x5c04f8=0x1f4;logger[_0xb8d5('0x26')](_0x325b28[_0xb8d5('0xb9')]);if(_0x325b28[_0xb8d5('0x3a')]){delete _0x325b28['name'];}_0x56e868=_0x325b28;})[_0xb8d5('0xba')](function(){if(_0x56e868===null){_0x3b6d30['sendStatus'](_0x5c04f8);}else{if(_0x5c04f8===0x1f4){_0x3b6d30['status'](_0x5c04f8)[_0xb8d5('0x3b')](_0x56e868);}else{_0x3b6d30[_0xb8d5('0x2a')](_0x5c04f8)[_0xb8d5('0x31')](_0x56e868);}}});};exports[_0xb8d5('0xbb')]=function(_0x37f876,_0x4d3dff,_0x301702){var _0x100181={};var _0x145b0d={};var _0x3ab086;var _0x32863c;return db[_0xb8d5('0x40')][_0xb8d5('0x69')]({'where':{'id':_0x37f876[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x4d3dff,null))['then'](function(_0x18ff02){if(_0x18ff02){_0x3ab086=_0x18ff02;_0x145b0d[_0xb8d5('0x44')]=_['keys'](db[_0xb8d5('0xb7')][_0xb8d5('0x41')]);_0x145b0d[_0xb8d5('0x45')]=_[_0xb8d5('0x46')](_0x37f876[_0xb8d5('0x45')]);_0x145b0d[_0xb8d5('0x47')]=_[_0xb8d5('0x58')](_0x145b0d['model'],_0x145b0d['query']);_0x100181[_0xb8d5('0x48')]=_[_0xb8d5('0x58')](_0x145b0d['model'],qs[_0xb8d5('0x59')](_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x100181[_0xb8d5('0x48')]=_0x100181[_0xb8d5('0x48')][_0xb8d5('0x5a')]?_0x100181[_0xb8d5('0x48')]:_0x145b0d[_0xb8d5('0x44')];_0x100181[_0xb8d5('0x4a')]=qs['sort'](_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x4b')]);_0x100181['where']=qs[_0xb8d5('0x47')](_[_0xb8d5('0x4d')](_0x37f876[_0xb8d5('0x45')],_0x145b0d[_0xb8d5('0x47')]));if(_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x4e')]){_0x100181[_0xb8d5('0x4c')]=_[_0xb8d5('0x4f')](_0x100181['where'],{'$or':_['map'](_0x100181[_0xb8d5('0x48')],function(_0x3af0a7){var _0x22bec2={};_0x22bec2[_0x3af0a7]={'$like':'%'+_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x4e')]+'%'};return _0x22bec2;})});}_0x100181=_[_0xb8d5('0x4f')]({},_0x100181,_0x37f876[_0xb8d5('0x51')]);return _0x3ab086[_0xb8d5('0xbb')](_0x100181);}})[_0xb8d5('0x20')](function(_0x15511e){if(_0x15511e){_0x32863c=_0x15511e[_0xb8d5('0x5a')];if(!_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x6a')](_0xb8d5('0x49'))){_0x100181[_0xb8d5('0x2d')]=qs[_0xb8d5('0x2d')](_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x2d')]);_0x100181[_0xb8d5('0x2c')]=qs[_0xb8d5('0x2c')](_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x2c')]);}return _0x3ab086[_0xb8d5('0xbb')](_0x100181);}})[_0xb8d5('0x20')](function(_0x2ee35d){if(_0x2ee35d){return _0x2ee35d?{'count':_0x32863c,'rows':_0x2ee35d}:null;}})[_0xb8d5('0x20')](respondWithResult(_0x4d3dff,null))[_0xb8d5('0x29')](handleError(_0x4d3dff,null));};exports[_0xb8d5('0xbc')]=function(_0x38b2aa,_0x84bc79,_0x16b523){var _0x3fa765={'raw':![],'where':{}};var _0x3449bf={};var _0x3a0120={'count':0x0,'rows':[]};return db['SmsAccount'][_0xb8d5('0x69')]({'where':{'id':_0x38b2aa[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x84bc79,null))[_0xb8d5('0x20')](function(_0x34a6be){if(_0x34a6be){_0x3449bf[_0xb8d5('0x44')]=_['keys'](db[_0xb8d5('0x9d')][_0xb8d5('0x41')]);_0x3449bf[_0xb8d5('0x45')]=_[_0xb8d5('0x46')](_0x38b2aa[_0xb8d5('0x45')]);_0x3449bf[_0xb8d5('0x47')]=_['intersection'](_0x3449bf[_0xb8d5('0x44')],_0x3449bf[_0xb8d5('0x45')]);_0x3fa765['attributes']=_[_0xb8d5('0x58')](_0x3449bf[_0xb8d5('0x44')],qs[_0xb8d5('0x59')](_0x38b2aa[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x3fa765[_0xb8d5('0x48')]=_0x3fa765[_0xb8d5('0x48')][_0xb8d5('0x5a')]?_0x3fa765[_0xb8d5('0x48')]:_0x3449bf['model'];if(!_0x38b2aa[_0xb8d5('0x45')][_0xb8d5('0x6a')]('nolimit')){_0x3fa765[_0xb8d5('0x2d')]=qs[_0xb8d5('0x2d')](_0x38b2aa[_0xb8d5('0x45')][_0xb8d5('0x2d')]);_0x3fa765[_0xb8d5('0x2c')]=qs[_0xb8d5('0x2c')](_0x38b2aa['query'][_0xb8d5('0x2c')]);}_0x3fa765['order']=qs[_0xb8d5('0x4b')](_0x38b2aa[_0xb8d5('0x45')]['sort']);_0x3fa765[_0xb8d5('0x4c')]=qs[_0xb8d5('0x47')](_[_0xb8d5('0x4d')](_0x38b2aa[_0xb8d5('0x45')],_0x3449bf[_0xb8d5('0x47')]));_0x3fa765[_0xb8d5('0x4c')][_0xb8d5('0x6b')]=_0x34a6be['id'];if(_0x38b2aa['query'][_0xb8d5('0x4e')]){_0x3fa765[_0xb8d5('0x4c')]=_[_0xb8d5('0x4f')](_0x3fa765[_0xb8d5('0x4c')],{'$or':_[_0xb8d5('0x3f')](_0x3fa765[_0xb8d5('0x48')],function(_0x3a3226){var _0x448e9c={};_0x448e9c[_0x3a3226]={'$like':'%'+_0x38b2aa[_0xb8d5('0x45')]['filter']+'%'};return _0x448e9c;})});}_0x3fa765=_['merge']({},_0x3fa765,_0x38b2aa['options']);return db['SmsInteraction']['count']({'where':_0x3fa765[_0xb8d5('0x4c')]})[_0xb8d5('0x20')](function(_0x3032bd){_0x3a0120['count']=_0x3032bd;if(_0x38b2aa[_0xb8d5('0x45')]['includeAll']){_0x3fa765['include']=[{'model':db[_0xb8d5('0x96')],'as':_0xb8d5('0xbd'),'required':![]},{'model':db[_0xb8d5('0xa7')],'as':_0xb8d5('0xbe'),'attributes':[_0xb8d5('0x3a'),_0xb8d5('0xbf'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xb8d5('0xc0'),'attributes':['id','name',_0xb8d5('0xc1')],'where':_0x38b2aa['query'][_0xb8d5('0xc2')]?{'id':_0x38b2aa[_0xb8d5('0x45')][_0xb8d5('0xc2')]}:undefined,'required':_0x38b2aa[_0xb8d5('0x45')][_0xb8d5('0xc2')]?!![]:![]}];}return db[_0xb8d5('0x9d')]['findAll'](_0x3fa765);})['then'](function(_0x2a3593){_0x3a0120[_0xb8d5('0x56')]=_0x2a3593;return _0x3a0120;});}})['then'](respondWithFilteredResult(_0x84bc79,_0x3fa765))['catch'](handleError(_0x84bc79,null));};exports[_0xb8d5('0x3b')]=function(_0x4429ba,_0x1250f9,_0x25eb65){var _0x319f28,_0x4edbb9,_0x27e429;if(_[_0xb8d5('0x8f')](_0x4429ba[_0xb8d5('0x64')]['body'])||_0x4429ba[_0xb8d5('0x64')][_0xb8d5('0x64')]===''){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))](_0xb8d5('0xc3'));}if(_[_0xb8d5('0x8f')](_0x4429ba[_0xb8d5('0x64')]['to'])){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))](_0xb8d5('0xc4'));}_0x319f28=_0x4429ba['body']['to'];return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x4429ba[_0xb8d5('0x65')]['id']},'include':[{'model':db[_0xb8d5('0x95')],'as':_0xb8d5('0xc5'),'include':[{'model':db[_0xb8d5('0x96')],'as':_0xb8d5('0x97'),'where':{'mobile':_0x319f28},'limit':0x1,'order':[[_0xb8d5('0x7c'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1250f9,null))[_0xb8d5('0x20')](function(_0x676207){if(_0x676207&&_0x676207[_0xb8d5('0xc5')]){_0x4edbb9=_0x676207[_0xb8d5('0x37')]({'plain':!![]});if(_0x4edbb9[_0xb8d5('0xc5')]&&_0x4edbb9['List'][_0xb8d5('0x97')]['length']){return _0x4edbb9[_0xb8d5('0xc5')]['Contacts'][0x0];}return db['CmContact'][_0xb8d5('0x5c')](_['defaults'](_0x4429ba[_0xb8d5('0x64')],{'firstName':_0x319f28,'mobile':_0x319f28,'phone':_0x319f28,'ListId':_0x4edbb9[_0xb8d5('0x7e')]}));}})[_0xb8d5('0x20')](handleEntityNotFound(_0x1250f9,null))['then'](function(_0x1f0da0){if(_0x1f0da0){_0x27e429=_0x1f0da0;return db[_0xb8d5('0x9d')][_0xb8d5('0x5b')]({'where':{'ContactId':_0x27e429['id'],'closed':![],'SmsAccountId':_0x4edbb9['id']}})[_0xb8d5('0x20')](function(_0xb676f5){if(_0xb676f5){return[_0xb676f5,![]];}return db[_0xb8d5('0x9d')][_0xb8d5('0x5c')]({'UserId':_0x4429ba[_0xb8d5('0x5d')]['id'],'ContactId':_0x27e429['id'],'SmsAccountId':_0x4edbb9['id'],'phone':_0x319f28,'firstMsgDirection':_0xb8d5('0xc6'),'Messages':[_[_0xb8d5('0x4f')](_0x4429ba[_0xb8d5('0x64')],{'read':![],'body':_0x4429ba[_0xb8d5('0x64')]['body'],'phone':_0x319f28,'SmsAccountId':_0x4edbb9['id'],'UserId':_0x4429ba[_0xb8d5('0x5d')]['id'],'ContactId':_0x27e429['id']})]},{'include':[{'model':db[_0xb8d5('0xc7')],'as':_0xb8d5('0xc8')}]})['then'](function(_0x1e84f9){return[_0x1e84f9,!![]];});});}})[_0xb8d5('0x9e')](function(_0x5ec1f1,_0x148b15){if(_0x148b15){return _0x5ec1f1;}return db[_0xb8d5('0xc7')][_0xb8d5('0x5c')](_[_0xb8d5('0x4f')](_0x4429ba[_0xb8d5('0x64')],{'read':![],'body':_0x4429ba['body'][_0xb8d5('0x64')],'phone':_0x319f28,'SmsAccountId':_0x4edbb9['id'],'SmsInteractionId':_0x5ec1f1['id'],'UserId':_0x4429ba[_0xb8d5('0x5d')]['id'],'ContactId':_0x27e429['id']}))[_0xb8d5('0x20')](function(_0x16d337){_0x5ec1f1[_0xb8d5('0xc9')][_0xb8d5('0xc8')]=[];_0x5ec1f1[_0xb8d5('0xc9')][_0xb8d5('0xc8')]['push'](_0x16d337[_0xb8d5('0xc9')]);return _0x5ec1f1;});})[_0xb8d5('0x20')](respondWithResult(_0x1250f9,null))['catch'](handleError(_0x1250f9,null));};exports['status']=function(_0x2da472,_0x35605d,_0x1647a8){if(_0x2da472['body']['id']){delete _0x2da472[_0xb8d5('0x64')]['id'];}var _0x462a40,_0xd4c22f,_0x261323;return db[_0xb8d5('0x40')]['find']({'where':{'id':_0x2da472[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x35605d,null))['then'](function(_0x36d510){if(_0x36d510){_0x261323=_0x36d510;logger[_0xb8d5('0x22')](_0xb8d5('0x23'),_0xb8d5('0x2a'),_0xb8d5('0xca'),_0x36d510[_0xb8d5('0x42')],util[_0xb8d5('0xcb')](_0x2da472[_0xb8d5('0x64')],{'showHidden':![],'depth':null}));switch(_0x36d510[_0xb8d5('0x42')]){case _0xb8d5('0x82'):if(_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcc')]&&_0x2da472[_0xb8d5('0x64')][_0xb8d5('0x2a')]){_0xd4c22f=_0x2da472[_0xb8d5('0x64')]['status'];return db[_0xb8d5('0xc7')][_0xb8d5('0x5b')]({'where':{'messageId':_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcc')]}});}break;case'connectel':if(_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcd')]&&_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xce')]){_0xd4c22f=_0x2da472[_0xb8d5('0x64')]['statusInt'];return db[_0xb8d5('0xc7')][_0xb8d5('0x5b')]({'where':{'messageId':_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcd')]}});}break;case _0xb8d5('0x87'):if(_0x2da472[_0xb8d5('0x64')]['message_id']&&_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcf')]){_0xd4c22f=_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcf')];return db[_0xb8d5('0xc7')]['find']({'where':{'messageId':_0x2da472[_0xb8d5('0x64')]['message_id']}});}break;case _0xb8d5('0xd0'):var _0x3a5c23=_0x2da472['body'][_0xb8d5('0x89')][0x0];if(_0x3a5c23['messageId']&&_0x3a5c23[_0xb8d5('0x2a')][_0xb8d5('0xd1')]===_0xb8d5('0xd2')){_0xd4c22f=_0x3a5c23[_0xb8d5('0x2a')][_0xb8d5('0xd1')];return db['SmsMessage'][_0xb8d5('0x5b')]({'where':{'messageId':_0x3a5c23[_0xb8d5('0x81')]}});}break;case'clickatell':if(_0x2da472[_0xb8d5('0x64')]['messageId']&&_0x2da472[_0xb8d5('0x64')][_0xb8d5('0x2a')]){_0xd4c22f=_0x2da472[_0xb8d5('0x64')]['status'];return db[_0xb8d5('0xc7')][_0xb8d5('0x5b')]({'where':{'messageId':_0x2da472[_0xb8d5('0x64')]['messageId']}});}break;case _0xb8d5('0xd3'):if(_0x2da472[_0xb8d5('0x64')][0x0]['message']['id']){_0xd4c22f=_0x2da472[_0xb8d5('0x64')][0x0][_0xb8d5('0x42')];return db[_0xb8d5('0xc7')]['find']({'where':{'messageId':_0x2da472[_0xb8d5('0x64')][0x0][_0xb8d5('0x28')]['id']}});}break;case _0xb8d5('0x8e'):if(_0x2da472[_0xb8d5('0x64')]['redif']&&_0x2da472['body']['status']){_0xd4c22f=_0x2da472[_0xb8d5('0x64')]['status'];return db[_0xb8d5('0xc7')][_0xb8d5('0x5b')]({'where':{'messageId':_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xd4')]}});}break;}}})[_0xb8d5('0x20')](handleEntityNotFound(_0x35605d,null))[_0xb8d5('0x20')](function(_0x15269b){if(_0x15269b){_0x462a40=_0x15269b;switch(_0x261323[_0xb8d5('0x42')]){case _0xb8d5('0x82'):if(_0xd4c22f===_0xb8d5('0xd2')){return _0x462a40['update']({'read':!![]});}else{logger[_0xb8d5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d5('0x2a'),'skebby',util[_0xb8d5('0xcb')](_0x2da472[_0xb8d5('0x64')],{'showHidden':![],'depth':null}));}break;case _0xb8d5('0x86'):if(_0xd4c22f==='1'){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger[_0xb8d5('0x26')](_0xb8d5('0x23'),_0xb8d5('0x2a'),_0xb8d5('0x82'),util[_0xb8d5('0xcb')](_0x2da472[_0xb8d5('0x64')],{'showHidden':![],'depth':null}));}break;case _0xb8d5('0x87'):if(!_0x2da472['body']['error_code']&&_0xd4c22f>=0xc8&&_0xd4c22f<=0xce){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger[_0xb8d5('0x26')](_0xb8d5('0x23'),'status',_0xb8d5('0x87'),util[_0xb8d5('0xcb')](_0x2da472['body'],{'showHidden':![],'depth':null}));}break;case _0xb8d5('0xd0'):var _0x552434=_0x2da472['body'][_0xb8d5('0x89')][0x0];if(_0x552434['status'][_0xb8d5('0xd1')]===_0xb8d5('0xd2')){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger[_0xb8d5('0x26')](_0xb8d5('0x23'),_0xb8d5('0x2a'),'infobip',util[_0xb8d5('0xcb')](_0x2da472[_0xb8d5('0x64')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0xd4c22f==_0xb8d5('0xd5')||_0xd4c22f=='RECEIVED_BY_RECIPIENT'){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger['error'](_0xb8d5('0x23'),_0xb8d5('0x2a'),_0xb8d5('0x8c'),util[_0xb8d5('0xcb')](_0x2da472['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0xd4c22f==_0xb8d5('0xd6')){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger['error'](_0xb8d5('0x23'),_0xb8d5('0x2a'),_0xb8d5('0xd3'),util[_0xb8d5('0xcb')](_0x2da472['body'],{'showHidden':![],'depth':null}));}break;case _0xb8d5('0x8e'):if(_0xd4c22f===_0xb8d5('0xd7')||_0xd4c22f===_0xb8d5('0xd8')){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger[_0xb8d5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d5('0x2a'),'intelepeer',util[_0xb8d5('0xcb')](_0x2da472[_0xb8d5('0x64')],{'showHidden':![],'depth':null}));}break;}return _0x462a40;}})['then'](respondWithResult(_0x35605d,null))[_0xb8d5('0x29')](handleError(_0x35605d,null));};exports[_0xb8d5('0xd9')]=function(_0x23d3c5,_0xb965bf,_0x3912c6){var _0x37cae4,_0x3a698b,_0x5f256f;return db[_0xb8d5('0x40')]['find']({'where':{'id':_0x23d3c5[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0xb965bf,null))[_0xb8d5('0x20')](function(_0x1ac545){if(_0x1ac545){_0x5f256f=_0x1ac545;logger[_0xb8d5('0x22')](_0xb8d5('0x23'),_0xb8d5('0x2a'),_0xb8d5('0xca'),_0x1ac545['type'],util[_0xb8d5('0xcb')](_0x23d3c5[_0xb8d5('0x45')],{'showHidden':![],'depth':null}));switch(_0x1ac545[_0xb8d5('0x42')]){case _0xb8d5('0x8a'):if(_0x23d3c5['query'][_0xb8d5('0xda')]&&_0x23d3c5[_0xb8d5('0x45')][_0xb8d5('0xdb')]){_0x3a698b=_0x23d3c5[_0xb8d5('0x45')][_0xb8d5('0xdb')];return db[_0xb8d5('0xc7')][_0xb8d5('0x5b')]({'where':{'messageId':_0x23d3c5[_0xb8d5('0x45')][_0xb8d5('0xda')]}});}break;}}})[_0xb8d5('0x20')](handleEntityNotFound(_0xb965bf,null))['then'](function(_0x427f94){if(_0x427f94){_0x37cae4=_0x427f94;switch(_0x5f256f[_0xb8d5('0x42')]){case _0xb8d5('0x8a'):if(_0x3a698b==='2'||_0x3a698b==='6'){return _0x37cae4[_0xb8d5('0x35')]({'read':!![]});}else{logger[_0xb8d5('0x26')](_0xb8d5('0x23'),_0xb8d5('0x2a'),'csc',util['inspect'](_0x23d3c5['query'],{'showHidden':![],'depth':null}));};break;}return _0x37cae4;}})[_0xb8d5('0x20')](respondWithResult(_0xb965bf,null))[_0xb8d5('0x29')](handleError(_0xb965bf,null));};exports[_0xb8d5('0xdc')]=function(_0x8ef2,_0x48705,_0x2fa941){return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x8ef2['params']['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x48705,null))['then'](function(_0x2c6321){if(_0x2c6321){return _0x2c6321[_0xb8d5('0xdc')](_0x8ef2[_0xb8d5('0x64')]['ids'],_[_0xb8d5('0x9a')](_0x8ef2[_0xb8d5('0x64')],[_0xb8d5('0x6d'),'id'])||{})[_0xb8d5('0x9e')](function(_0xf39d72){for(var _0x12ace3=0x0;_0x12ace3<_0x8ef2['body'][_0xb8d5('0x6d')][_0xb8d5('0x5a')];_0x12ace3+=0x1){socket[_0xb8d5('0xdd')](_0xb8d5('0xde'),{'UserId':Number(_0x8ef2[_0xb8d5('0x64')]['ids'][_0x12ace3]),'SmsAccountId':Number(_0x8ef2[_0xb8d5('0x65')]['id'])});}return _0xf39d72;});}})['then'](respondWithResult(_0x48705,null))[_0xb8d5('0x29')](handleError(_0x48705,null));};exports[_0xb8d5('0xdf')]=function(_0xdeaae9,_0x479673,_0x527ff3){return db['SmsAccount'][_0xb8d5('0x5b')]({'where':{'id':_0xdeaae9['params']['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x479673,null))['then'](function(_0x52a053){if(_0x52a053){return _0x52a053[_0xb8d5('0xdf')](_0xdeaae9['query']['ids'])['then'](function(){if(_[_0xb8d5('0xe0')](_0xdeaae9['query']['ids'])){for(var _0x4dc519=0x0;_0x4dc519<_0xdeaae9['query']['ids'][_0xb8d5('0x5a')];_0x4dc519+=0x1){socket[_0xb8d5('0xdd')](_0xb8d5('0xe1'),{'UserId':Number(_0xdeaae9[_0xb8d5('0x45')][_0xb8d5('0x6d')][_0x4dc519]),'SmsAccountId':Number(_0xdeaae9[_0xb8d5('0x65')]['id'])});}}else{socket[_0xb8d5('0xdd')]('userSmsAccount:remove',{'UserId':Number(_0xdeaae9[_0xb8d5('0x45')][_0xb8d5('0x6d')]),'SmsAccountId':Number(_0xdeaae9[_0xb8d5('0x65')]['id'])});}});}})[_0xb8d5('0x20')](respondWithStatusCode(_0x479673,null))[_0xb8d5('0x29')](handleError(_0x479673,null));};exports[_0xb8d5('0xe2')]=function(_0x36fd3a,_0x42f918,_0x212cb8){var _0x39bd5b={};var _0x3be7de={};var _0x49215d;var _0x127661;return db['SmsAccount'][_0xb8d5('0x69')]({'where':{'id':_0x36fd3a[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x42f918,null))[_0xb8d5('0x20')](function(_0x5cf6a7){if(_0x5cf6a7){_0x49215d=_0x5cf6a7;_0x3be7de[_0xb8d5('0x44')]=_[_0xb8d5('0x46')](db[_0xb8d5('0xa7')][_0xb8d5('0x41')]);_0x3be7de[_0xb8d5('0x45')]=_[_0xb8d5('0x46')](_0x36fd3a[_0xb8d5('0x45')]);_0x3be7de['filters']=_[_0xb8d5('0x58')](_0x3be7de[_0xb8d5('0x44')],_0x3be7de[_0xb8d5('0x45')]);_0x39bd5b[_0xb8d5('0x48')]=_[_0xb8d5('0x58')](_0x3be7de[_0xb8d5('0x44')],qs['fields'](_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x39bd5b[_0xb8d5('0x48')]=_0x39bd5b[_0xb8d5('0x48')][_0xb8d5('0x5a')]?_0x39bd5b[_0xb8d5('0x48')]:_0x3be7de[_0xb8d5('0x44')];_0x39bd5b['order']=qs['sort'](_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x4b')]);_0x39bd5b[_0xb8d5('0x4c')]=qs[_0xb8d5('0x47')](_[_0xb8d5('0x4d')](_0x36fd3a[_0xb8d5('0x45')],_0x3be7de[_0xb8d5('0x47')]));if(_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x4e')]){_0x39bd5b[_0xb8d5('0x4c')]=_['merge'](_0x39bd5b['where'],{'$or':_['map'](_0x39bd5b[_0xb8d5('0x48')],function(_0x229d5a){var _0x5e5157={};_0x5e5157[_0x229d5a]={'$like':'%'+_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x4e')]+'%'};return _0x5e5157;})});}_0x39bd5b=_[_0xb8d5('0x4f')]({},_0x39bd5b,_0x36fd3a[_0xb8d5('0x51')]);return _0x49215d['getAgents'](_0x39bd5b);}})[_0xb8d5('0x20')](function(_0x5df5f5){if(_0x5df5f5){_0x127661=_0x5df5f5[_0xb8d5('0x5a')];if(!_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x6a')](_0xb8d5('0x49'))){_0x39bd5b[_0xb8d5('0x2d')]=qs[_0xb8d5('0x2d')](_0x36fd3a['query'][_0xb8d5('0x2d')]);_0x39bd5b[_0xb8d5('0x2c')]=qs['offset'](_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x2c')]);}return _0x49215d['getAgents'](_0x39bd5b);}})[_0xb8d5('0x20')](function(_0xce0604){if(_0xce0604){return _0xce0604?{'count':_0x127661,'rows':_0xce0604}:null;}})[_0xb8d5('0x20')](respondWithResult(_0x42f918,null))[_0xb8d5('0x29')](handleError(_0x42f918,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 7907bca..3767ae3 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 _0x5de8=['update','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3f4b38,_0x2afa50){var _0x3b0a60=function(_0x5c6057){while(--_0x5c6057){_0x3f4b38['push'](_0x3f4b38['shift']());}};_0x3b0a60(++_0x2afa50);}(_0x5de8,0xee));var _0x85de=function(_0x1b5b8a,_0xefa937){_0x1b5b8a=_0x1b5b8a-0x0;var _0x44ef21=_0x5de8[_0x1b5b8a];return _0x44ef21;};'use strict';var EventEmitter=require(_0x85de('0x0'));var SmsAccount=require(_0x85de('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x85de('0x2'),'afterDestroy':'remove'};function emitEvent(_0x470d37){return function(_0x7325ea,_0x31a867,_0x1ecad7){SmsAccountEvents['emit'](_0x470d37+':'+_0x7325ea['id'],_0x7325ea);SmsAccountEvents['emit'](_0x470d37,_0x7325ea);_0x1ecad7(null);};}for(var e in events){if(events[_0x85de('0x3')](e)){var event=events[e];SmsAccount[_0x85de('0x4')](e,emitEvent(event));}}module[_0x85de('0x5')]=SmsAccountEvents; \ No newline at end of file +var _0xf62a=['remove','emit','hasOwnProperty','hook','exports','SmsAccount','save'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0xf62a,0x116));var _0xaf62=function(_0x11fa6d,_0x2aba36){_0x11fa6d=_0x11fa6d-0x0;var _0x503048=_0xf62a[_0x11fa6d];return _0x503048;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0xaf62('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf62('0x1'),'afterUpdate':'update','afterDestroy':_0xaf62('0x2')};function emitEvent(_0x1f749b){return function(_0x5c7450,_0x4681ac,_0x46b9c3){SmsAccountEvents[_0xaf62('0x3')](_0x1f749b+':'+_0x5c7450['id'],_0x5c7450);SmsAccountEvents[_0xaf62('0x3')](_0x1f749b,_0x5c7450);_0x46b9c3(null);};}for(var e in events){if(events[_0xaf62('0x4')](e)){var event=events[e];SmsAccount[_0xaf62('0x5')](e,emitEvent(event));}}module[_0xaf62('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 6a1db27..713f08c 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 _0xfb89=['define','SmsAccount','sms_accounts','lodash','util','path','../../config/environment','exports'];(function(_0x17a815,_0x22704e){var _0x1908ed=function(_0x504bf8){while(--_0x504bf8){_0x17a815['push'](_0x17a815['shift']());}};_0x1908ed(++_0x22704e);}(_0xfb89,0x73));var _0x9fb8=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0xfb89[_0x15d18f];return _0xd12bf7;};'use strict';var _=require(_0x9fb8('0x0'));var util=require(_0x9fb8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fb8('0x2'));var rimraf=require('rimraf');var config=require(_0x9fb8('0x3'));var attributes=require('./smsAccount.attributes');module[_0x9fb8('0x4')]=function(_0x2f8294,_0x22053c){return _0x2f8294[_0x9fb8('0x5')](_0x9fb8('0x6'),attributes,{'tableName':_0x9fb8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x606b=['define','SmsAccount','sms_accounts','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x606b,0xc3));var _0xb606=function(_0x1d2986,_0x40f595){_0x1d2986=_0x1d2986-0x0;var _0x5a272b=_0x606b[_0x1d2986];return _0x5a272b;};'use strict';var _=require(_0xb606('0x0'));var util=require('util');var logger=require(_0xb606('0x1'))('api');var moment=require(_0xb606('0x2'));var BPromise=require(_0xb606('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb606('0x4'));var rimraf=require(_0xb606('0x5'));var config=require(_0xb606('0x6'));var attributes=require(_0xb606('0x7'));module[_0xb606('0x8')]=function(_0x2062f0,_0x135730){return _0x2062f0[_0xb606('0x9')](_0xb606('0xa'),attributes,{'tableName':_0xb606('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 6a296fc..5944872 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 _0x332f=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4f822e,_0x338550){var _0x494fdd=function(_0xea30b2){while(--_0xea30b2){_0x4f822e['push'](_0x4f822e['shift']());}};_0x494fdd(++_0x338550);}(_0x332f,0x12e));var _0xf332=function(_0x108f1f,_0x49b607){_0x108f1f=_0x108f1f-0x0;var _0x2d91da=_0x332f[_0x108f1f];return _0x2d91da;};'use strict';var _=require(_0xf332('0x0'));var util=require(_0xf332('0x1'));var moment=require(_0xf332('0x2'));var BPromise=require(_0xf332('0x3'));var rs=require(_0xf332('0x4'));var fs=require('fs');var Redis=require(_0xf332('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf332('0x6'));var logger=require(_0xf332('0x7'))(_0xf332('0x8'));var config=require(_0xf332('0x9'));var jayson=require(_0xf332('0xa'));var client=jayson[_0xf332('0xb')]['http']({'port':0x232a});config[_0xf332('0xc')]=_[_0xf332('0xd')](config[_0xf332('0xc')],{'host':_0xf332('0xe'),'port':0x18eb});var socket=require(_0xf332('0xf'))(new Redis(config['redis']));require(_0xf332('0x10'))['register'](socket);function respondWithRpcPromise(_0x83ee52,_0x492df9,_0x242da3){return new BPromise(function(_0x508cd5,_0x5f410e){return client[_0xf332('0x11')](_0x83ee52,_0x242da3)[_0xf332('0x12')](function(_0xfa6c6){logger[_0xf332('0x13')](_0xf332('0x14'),_0x492df9,_0xf332('0x15'));logger[_0xf332('0x16')](_0xf332('0x17'),_0x492df9,'request\x20sent',JSON[_0xf332('0x18')](_0xfa6c6));if(_0xfa6c6['error']){if(_0xfa6c6[_0xf332('0x19')]['code']===0x1f4){logger[_0xf332('0x19')]('SmsAccount,\x20%s,\x20%s',_0x492df9,_0xfa6c6[_0xf332('0x19')][_0xf332('0x1a')]);return _0x5f410e(_0xfa6c6[_0xf332('0x19')][_0xf332('0x1a')]);}logger[_0xf332('0x19')](_0xf332('0x14'),_0x492df9,_0xfa6c6[_0xf332('0x19')][_0xf332('0x1a')]);return _0x508cd5(_0xfa6c6[_0xf332('0x19')][_0xf332('0x1a')]);}else{logger['info'](_0xf332('0x14'),_0x492df9,'request\x20sent');_0x508cd5(_0xfa6c6[_0xf332('0x1b')][_0xf332('0x1a')]);}})['catch'](function(_0x14742d){logger['error'](_0xf332('0x14'),_0x492df9,_0x14742d);_0x5f410e(_0x14742d);});});}exports[_0xf332('0x1c')]=function(_0x393e59){var _0x2a5a22=this;return new Promise(function(_0x1a0250,_0x396af9){return db[_0xf332('0x1d')][_0xf332('0x1e')]({'raw':_0x393e59[_0xf332('0x1f')]?_0x393e59[_0xf332('0x1f')][_0xf332('0x20')]===undefined?!![]:![]:!![],'where':_0x393e59['options']?_0x393e59[_0xf332('0x1f')][_0xf332('0x21')]||null:null,'attributes':_0x393e59['options']?_0x393e59[_0xf332('0x1f')][_0xf332('0x22')]||null:null,'include':_0x393e59[_0xf332('0x1f')]?_0x393e59['options'][_0xf332('0x23')]?_['map'](_0x393e59[_0xf332('0x1f')][_0xf332('0x23')],function(_0x54e5bd){return{'model':db[_0x54e5bd[_0xf332('0x24')]],'as':_0x54e5bd['as'],'attributes':_0x54e5bd['attributes'],'include':_0x54e5bd[_0xf332('0x23')]?_[_0xf332('0x25')](_0x54e5bd[_0xf332('0x23')],function(_0x29410e){return{'model':db[_0x29410e[_0xf332('0x24')]],'as':_0x29410e['as'],'attributes':_0x29410e[_0xf332('0x22')],'include':_0x29410e[_0xf332('0x23')]?_[_0xf332('0x25')](_0x29410e['include'],function(_0x37905e){return{'model':db[_0x37905e[_0xf332('0x24')]],'as':_0x37905e['as'],'attributes':_0x37905e[_0xf332('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf332('0x12')](function(_0x208d52){logger[_0xf332('0x13')]('ShowSmsAccount',_0x393e59);logger['debug'](_0xf332('0x1c'),_0x393e59,JSON[_0xf332('0x18')](_0x208d52));_0x1a0250(_0x208d52);})[_0xf332('0x26')](function(_0x308309){logger['error'](_0xf332('0x1c'),_0x308309[_0xf332('0x1a')],_0x393e59);_0x396af9(_0x2a5a22[_0xf332('0x19')](0x1f4,_0x308309['message']));});});}; \ No newline at end of file +var _0x1f68=['map','model','attributes','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./smsAccount.socket','register','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsAccount,\x20%s,\x20%s','catch','ShowSmsAccount','SmsAccount','find','options','where','include'];(function(_0x3849e6,_0x540408){var _0x42f017=function(_0x4972c5){while(--_0x4972c5){_0x3849e6['push'](_0x3849e6['shift']());}};_0x42f017(++_0x540408);}(_0x1f68,0xf2));var _0x81f6=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1f68[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x81f6('0x0'));var util=require(_0x81f6('0x1'));var moment=require('moment');var BPromise=require(_0x81f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81f6('0x3'));var db=require(_0x81f6('0x4'))['db'];var utils=require(_0x81f6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x81f6('0x6'));var jayson=require(_0x81f6('0x7'));var client=jayson[_0x81f6('0x8')][_0x81f6('0x9')]({'port':0x232a});config[_0x81f6('0xa')]=_[_0x81f6('0xb')](config[_0x81f6('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x81f6('0xa')]));require(_0x81f6('0xc'))[_0x81f6('0xd')](socket);function respondWithRpcPromise(_0x5ecd8e,_0x12caa4,_0x171f2c){return new BPromise(function(_0x247b87,_0x32ed2c){return client[_0x81f6('0xe')](_0x5ecd8e,_0x171f2c)[_0x81f6('0xf')](function(_0x3a11e6){logger[_0x81f6('0x10')]('SmsAccount,\x20%s,\x20%s',_0x12caa4,_0x81f6('0x11'));logger['debug'](_0x81f6('0x12'),_0x12caa4,_0x81f6('0x11'),JSON[_0x81f6('0x13')](_0x3a11e6));if(_0x3a11e6[_0x81f6('0x14')]){if(_0x3a11e6['error']['code']===0x1f4){logger[_0x81f6('0x14')]('SmsAccount,\x20%s,\x20%s',_0x12caa4,_0x3a11e6['error'][_0x81f6('0x15')]);return _0x32ed2c(_0x3a11e6[_0x81f6('0x14')]['message']);}logger['error'](_0x81f6('0x16'),_0x12caa4,_0x3a11e6['error'][_0x81f6('0x15')]);return _0x247b87(_0x3a11e6[_0x81f6('0x14')][_0x81f6('0x15')]);}else{logger[_0x81f6('0x10')](_0x81f6('0x16'),_0x12caa4,'request\x20sent');_0x247b87(_0x3a11e6['result'][_0x81f6('0x15')]);}})[_0x81f6('0x17')](function(_0x428b56){logger[_0x81f6('0x14')](_0x81f6('0x16'),_0x12caa4,_0x428b56);_0x32ed2c(_0x428b56);});});}exports[_0x81f6('0x18')]=function(_0x1f4bfa){var _0x8177a7=this;return new Promise(function(_0xa3cc06,_0x2ee334){return db[_0x81f6('0x19')][_0x81f6('0x1a')]({'raw':_0x1f4bfa[_0x81f6('0x1b')]?_0x1f4bfa['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f4bfa[_0x81f6('0x1b')]?_0x1f4bfa['options'][_0x81f6('0x1c')]||null:null,'attributes':_0x1f4bfa[_0x81f6('0x1b')]?_0x1f4bfa[_0x81f6('0x1b')]['attributes']||null:null,'include':_0x1f4bfa[_0x81f6('0x1b')]?_0x1f4bfa[_0x81f6('0x1b')][_0x81f6('0x1d')]?_[_0x81f6('0x1e')](_0x1f4bfa[_0x81f6('0x1b')]['include'],function(_0x11a998){return{'model':db[_0x11a998[_0x81f6('0x1f')]],'as':_0x11a998['as'],'attributes':_0x11a998['attributes'],'include':_0x11a998['include']?_['map'](_0x11a998[_0x81f6('0x1d')],function(_0x3fd797){return{'model':db[_0x3fd797['model']],'as':_0x3fd797['as'],'attributes':_0x3fd797['attributes'],'include':_0x3fd797[_0x81f6('0x1d')]?_[_0x81f6('0x1e')](_0x3fd797[_0x81f6('0x1d')],function(_0x727907){return{'model':db[_0x727907[_0x81f6('0x1f')]],'as':_0x727907['as'],'attributes':_0x727907[_0x81f6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x81f6('0xf')](function(_0x49f5ac){logger[_0x81f6('0x10')](_0x81f6('0x18'),_0x1f4bfa);logger[_0x81f6('0x21')](_0x81f6('0x18'),_0x1f4bfa,JSON[_0x81f6('0x13')](_0x49f5ac));_0xa3cc06(_0x49f5ac);})[_0x81f6('0x17')](function(_0x4ca60b){logger[_0x81f6('0x14')]('ShowSmsAccount',_0x4ca60b[_0x81f6('0x15')],_0x1f4bfa);_0x2ee334(_0x8177a7['error'](0x1f4,_0x4ca60b[_0x81f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index f28fa3b..1ef3741 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 5c821a1..bd4c179 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(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x5bb341,_0x4bf271){var _0x26f3e5=function(_0x1b35ed){while(--_0x1b35ed){_0x5bb341['push'](_0x5bb341['shift']());}};_0x26f3e5(++_0x4bf271);}(_0x008c,0x188));var _0xc008=function(_0x1165ff,_0x375a85){_0x1165ff=_0x1165ff-0x0;var _0x169b79=_0x008c[_0x1165ff];return _0x169b79;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 5301fdd..b103aed 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 _0x1d20=['STRING','noop','*,*,*,*','sequelize','INTEGER'];(function(_0x1f7097,_0xfcd44a){var _0x1502aa=function(_0x1fe7d5){while(--_0x1fe7d5){_0x1f7097['push'](_0x1f7097['shift']());}};_0x1502aa(++_0xfcd44a);}(_0x1d20,0xb2));var _0x01d2=function(_0x4b427c,_0x5c3124){_0x4b427c=_0x4b427c-0x0;var _0x4bd79d=_0x1d20[_0x4b427c];return _0x4bd79d;};'use strict';var Sequelize=require(_0x01d2('0x0'));module['exports']={'priority':{'type':Sequelize[_0x01d2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x01d2('0x2')],'allowNull':![],'defaultValue':_0x01d2('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x01d2('0x2')],'defaultValue':_0x01d2('0x4')}}; \ No newline at end of file +var _0x595d=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1aa3fe,_0x27c5fa){var _0x163cee=function(_0x2a1505){while(--_0x2a1505){_0x1aa3fe['push'](_0x1aa3fe['shift']());}};_0x163cee(++_0x27c5fa);}(_0x595d,0x1a8));var _0xd595=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x595d[_0x30faee];return _0x3a90ab;};'use strict';var Sequelize=require(_0xd595('0x0'));module[_0xd595('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd595('0x2')],'allowNull':![],'defaultValue':_0xd595('0x3')},'appdata':{'type':Sequelize[_0xd595('0x4')]()},'description':{'type':Sequelize[_0xd595('0x2')]},'interval':{'type':Sequelize[_0xd595('0x2')],'defaultValue':_0xd595('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b5f6510..caeeec6 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 _0xc59b=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','map','SmsApplication','type','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js'];(function(_0x208d83,_0x214b5f){var _0x15d0f9=function(_0x32a57c){while(--_0x32a57c){_0x208d83['push'](_0x208d83['shift']());}};_0x15d0f9(++_0x214b5f);}(_0xc59b,0x18b));var _0xbc59=function(_0x415fd9,_0x899e1e){_0x415fd9=_0x415fd9-0x0;var _0x2ad505=_0xc59b[_0x415fd9];return _0x2ad505;};'use strict';var emlformat=require(_0xbc59('0x0'));var rimraf=require(_0xbc59('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc59('0x2'));var rp=require(_0xbc59('0x3'));var moment=require(_0xbc59('0x4'));var BPromise=require(_0xbc59('0x5'));var Mustache=require('mustache');var util=require(_0xbc59('0x6'));var path=require(_0xbc59('0x7'));var sox=require('sox');var csv=require(_0xbc59('0x8'));var ejs=require(_0xbc59('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc59('0xa'));var squel=require('squel');var crypto=require(_0xbc59('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbc59('0xc'));var toCsv=require(_0xbc59('0x8'));var querystring=require(_0xbc59('0xd'));var Papa=require(_0xbc59('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbc59('0xf'));var as=require(_0xbc59('0x10'));var hardwareService=require(_0xbc59('0x11'));var logger=require('../../config/logger')(_0xbc59('0x12'));var utils=require(_0xbc59('0x13'));var config=require(_0xbc59('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc59('0x15'))['db'];function respondWithStatusCode(_0x40ca70,_0x3c64f0){_0x3c64f0=_0x3c64f0||0xcc;return function(_0x2512d5){if(_0x2512d5){return _0x40ca70[_0xbc59('0x16')](_0x3c64f0);}return _0x40ca70[_0xbc59('0x17')](_0x3c64f0)['end']();};}function respondWithResult(_0x37ac24,_0x46fcf4){_0x46fcf4=_0x46fcf4||0xc8;return function(_0x4b77c7){if(_0x4b77c7){return _0x37ac24[_0xbc59('0x17')](_0x46fcf4)[_0xbc59('0x18')](_0x4b77c7);}};}function respondWithFilteredResult(_0x4c4e23,_0x1b712e){return function(_0x598687){if(_0x598687){var _0xe575bc=typeof _0x1b712e[_0xbc59('0x19')]===_0xbc59('0x1a')&&typeof _0x1b712e[_0xbc59('0x1b')]==='undefined';var _0x4a28b3=_0x598687[_0xbc59('0x1c')];var _0x479df7=_0xe575bc?0x0:_0x1b712e[_0xbc59('0x19')];var _0xc3cbd6=_0xe575bc?_0x598687[_0xbc59('0x1c')]:_0x1b712e['offset']+_0x1b712e[_0xbc59('0x1b')];var _0x48a78c;if(_0xc3cbd6>=_0x4a28b3){_0xc3cbd6=_0x4a28b3;_0x48a78c=0xc8;}else{_0x48a78c=0xce;}_0x4c4e23['status'](_0x48a78c);return _0x4c4e23[_0xbc59('0x1d')](_0xbc59('0x1e'),_0x479df7+'-'+_0xc3cbd6+'/'+_0x4a28b3)['json'](_0x598687);}return null;};}function patchUpdates(_0x55762a){return function(_0x5eeaba){try{jsonpatch[_0xbc59('0x1f')](_0x5eeaba,_0x55762a,!![]);}catch(_0x1e196a){return BPromise[_0xbc59('0x20')](_0x1e196a);}return _0x5eeaba['save']();};}function saveUpdates(_0x3e2f1b,_0x4d586c){return function(_0x361b5c){if(_0x361b5c){return _0x361b5c[_0xbc59('0x21')](_0x3e2f1b)[_0xbc59('0x22')](function(_0x224319){return _0x224319;});}return null;};}function removeEntity(_0x38723e,_0x3f5eba){return function(_0x4e9828){if(_0x4e9828){return _0x4e9828[_0xbc59('0x23')]()[_0xbc59('0x22')](function(){_0x38723e[_0xbc59('0x17')](0xcc)[_0xbc59('0x24')]();});}};}function handleEntityNotFound(_0x3b702f,_0x397a81){return function(_0x5c076f){if(!_0x5c076f){_0x3b702f[_0xbc59('0x16')](0x194);}return _0x5c076f;};}function handleError(_0x45c336,_0x421718){_0x421718=_0x421718||0x1f4;return function(_0x55c07e){logger[_0xbc59('0x25')](_0x55c07e['stack']);if(_0x55c07e['name']){delete _0x55c07e[_0xbc59('0x26')];}_0x45c336[_0xbc59('0x17')](_0x421718)[_0xbc59('0x27')](_0x55c07e);};}exports['index']=function(_0x20d551,_0x3f4503){var _0x56ce61={},_0x1ff1fd={},_0x50fb5d={'count':0x0,'rows':[]};var _0x1b8786=_[_0xbc59('0x28')](db[_0xbc59('0x29')]['rawAttributes'],function(_0x1ff984){return{'name':_0x1ff984['fieldName'],'type':_0x1ff984[_0xbc59('0x2a')]['key']};});_0x1ff1fd[_0xbc59('0x2b')]=_[_0xbc59('0x28')](_0x1b8786,_0xbc59('0x26'));_0x1ff1fd['query']=_[_0xbc59('0x2c')](_0x20d551[_0xbc59('0x2d')]);_0x1ff1fd['filters']=_[_0xbc59('0x2e')](_0x1ff1fd[_0xbc59('0x2b')],_0x1ff1fd['query']);_0x56ce61['attributes']=_[_0xbc59('0x2e')](_0x1ff1fd[_0xbc59('0x2b')],qs[_0xbc59('0x2f')](_0x20d551['query'][_0xbc59('0x2f')]));_0x56ce61[_0xbc59('0x30')]=_0x56ce61[_0xbc59('0x30')][_0xbc59('0x31')]?_0x56ce61[_0xbc59('0x30')]:_0x1ff1fd[_0xbc59('0x2b')];if(!_0x20d551[_0xbc59('0x2d')]['hasOwnProperty'](_0xbc59('0x32'))){_0x56ce61[_0xbc59('0x1b')]=qs['limit'](_0x20d551[_0xbc59('0x2d')][_0xbc59('0x1b')]);_0x56ce61[_0xbc59('0x19')]=qs[_0xbc59('0x19')](_0x20d551['query'][_0xbc59('0x19')]);}_0x56ce61[_0xbc59('0x33')]=qs[_0xbc59('0x34')](_0x20d551[_0xbc59('0x2d')][_0xbc59('0x34')]);_0x56ce61[_0xbc59('0x35')]=qs[_0xbc59('0x36')](_[_0xbc59('0x37')](_0x20d551[_0xbc59('0x2d')],_0x1ff1fd[_0xbc59('0x36')]),_0x1b8786);if(_0x20d551[_0xbc59('0x2d')][_0xbc59('0x38')]){_0x56ce61[_0xbc59('0x35')]=_['merge'](_0x56ce61[_0xbc59('0x35')],{'$or':_[_0xbc59('0x28')](_0x1b8786,function(_0x28d320){if(_0x28d320['type']!==_0xbc59('0x39')){var _0x48f9a6={};_0x48f9a6[_0x28d320[_0xbc59('0x26')]]={'$like':'%'+_0x20d551[_0xbc59('0x2d')][_0xbc59('0x38')]+'%'};return _0x48f9a6;}})});}_0x56ce61=_[_0xbc59('0x3a')]({},_0x56ce61,_0x20d551['options']);var _0x8440a0={'where':_0x56ce61['where']};return db[_0xbc59('0x29')][_0xbc59('0x1c')](_0x8440a0)[_0xbc59('0x22')](function(_0x2d7949){_0x50fb5d['count']=_0x2d7949;if(_0x20d551['query']['includeAll']){_0x56ce61['include']=[{'all':!![]}];}return db['SmsApplication'][_0xbc59('0x3b')](_0x56ce61);})[_0xbc59('0x22')](function(_0x11f5e7){_0x50fb5d[_0xbc59('0x3c')]=_0x11f5e7;return _0x50fb5d;})[_0xbc59('0x22')](respondWithFilteredResult(_0x3f4503,_0x56ce61))[_0xbc59('0x3d')](handleError(_0x3f4503,null));};exports[_0xbc59('0x3e')]=function(_0xcd6cd,_0x2a4e8a){var _0xe6495d={'raw':!![],'where':{'id':_0xcd6cd[_0xbc59('0x3f')]['id']}},_0x12cd5d={};_0x12cd5d[_0xbc59('0x2b')]=_[_0xbc59('0x2c')](db['SmsApplication'][_0xbc59('0x40')]);_0x12cd5d[_0xbc59('0x2d')]=_['keys'](_0xcd6cd['query']);_0x12cd5d[_0xbc59('0x36')]=_[_0xbc59('0x2e')](_0x12cd5d['model'],_0x12cd5d['query']);_0xe6495d['attributes']=_[_0xbc59('0x2e')](_0x12cd5d['model'],qs['fields'](_0xcd6cd['query']['fields']));_0xe6495d[_0xbc59('0x30')]=_0xe6495d[_0xbc59('0x30')][_0xbc59('0x31')]?_0xe6495d[_0xbc59('0x30')]:_0x12cd5d[_0xbc59('0x2b')];if(_0xcd6cd[_0xbc59('0x2d')]['includeAll']){_0xe6495d['include']=[{'all':!![]}];}_0xe6495d=_['merge']({},_0xe6495d,_0xcd6cd['options']);return db[_0xbc59('0x29')][_0xbc59('0x41')](_0xe6495d)[_0xbc59('0x22')](handleEntityNotFound(_0x2a4e8a,null))[_0xbc59('0x22')](respondWithResult(_0x2a4e8a,null))[_0xbc59('0x3d')](handleError(_0x2a4e8a,null));};exports[_0xbc59('0x42')]=function(_0x350858,_0x3736a8){return db['SmsApplication'][_0xbc59('0x42')](_0x350858['body'],{})[_0xbc59('0x22')](respondWithResult(_0x3736a8,0xc9))[_0xbc59('0x3d')](handleError(_0x3736a8,null));};exports[_0xbc59('0x21')]=function(_0x42d8fe,_0x26ce78){if(_0x42d8fe['body']['id']){delete _0x42d8fe[_0xbc59('0x43')]['id'];}return db[_0xbc59('0x29')][_0xbc59('0x41')]({'where':{'id':_0x42d8fe[_0xbc59('0x3f')]['id']}})[_0xbc59('0x22')](handleEntityNotFound(_0x26ce78,null))[_0xbc59('0x22')](saveUpdates(_0x42d8fe[_0xbc59('0x43')],null))[_0xbc59('0x22')](respondWithResult(_0x26ce78,null))[_0xbc59('0x3d')](handleError(_0x26ce78,null));};exports[_0xbc59('0x23')]=function(_0x570790,_0x590e02){return db[_0xbc59('0x29')][_0xbc59('0x41')]({'where':{'id':_0x570790[_0xbc59('0x3f')]['id']}})[_0xbc59('0x22')](handleEntityNotFound(_0x590e02,null))[_0xbc59('0x22')](removeEntity(_0x590e02,null))['catch'](handleError(_0x590e02,null));}; \ No newline at end of file +var _0x8dc8=['mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','type','options','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x8dc8,0x8e));var _0x88dc=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8dc8[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x88dc('0x0'));var rimraf=require(_0x88dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88dc('0x2'));var rp=require(_0x88dc('0x3'));var moment=require(_0x88dc('0x4'));var BPromise=require(_0x88dc('0x5'));var Mustache=require(_0x88dc('0x6'));var util=require(_0x88dc('0x7'));var path=require(_0x88dc('0x8'));var sox=require(_0x88dc('0x9'));var csv=require(_0x88dc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88dc('0xb'));var _=require(_0x88dc('0xc'));var squel=require(_0x88dc('0xd'));var crypto=require('crypto');var jsforce=require(_0x88dc('0xe'));var deskjs=require(_0x88dc('0xf'));var toCsv=require(_0x88dc('0xa'));var querystring=require(_0x88dc('0x10'));var Papa=require(_0x88dc('0x11'));var Redis=require(_0x88dc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x88dc('0x13'));var as=require(_0x88dc('0x14'));var hardwareService=require(_0x88dc('0x15'));var logger=require(_0x88dc('0x16'))(_0x88dc('0x17'));var utils=require(_0x88dc('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x88dc('0x19'))['db'];function respondWithStatusCode(_0x1a7192,_0x5b0ad3){_0x5b0ad3=_0x5b0ad3||0xcc;return function(_0x4f0913){if(_0x4f0913){return _0x1a7192[_0x88dc('0x1a')](_0x5b0ad3);}return _0x1a7192['status'](_0x5b0ad3)[_0x88dc('0x1b')]();};}function respondWithResult(_0x3e5c23,_0x250674){_0x250674=_0x250674||0xc8;return function(_0x5d1e62){if(_0x5d1e62){return _0x3e5c23[_0x88dc('0x1c')](_0x250674)['json'](_0x5d1e62);}};}function respondWithFilteredResult(_0x14037b,_0x218206){return function(_0x19aa0c){if(_0x19aa0c){var _0x3880ea=typeof _0x218206[_0x88dc('0x1d')]===_0x88dc('0x1e')&&typeof _0x218206[_0x88dc('0x1f')]==='undefined';var _0x559f38=_0x19aa0c[_0x88dc('0x20')];var _0x341f5c=_0x3880ea?0x0:_0x218206[_0x88dc('0x1d')];var _0xbc43ba=_0x3880ea?_0x19aa0c[_0x88dc('0x20')]:_0x218206[_0x88dc('0x1d')]+_0x218206['limit'];var _0x35167b;if(_0xbc43ba>=_0x559f38){_0xbc43ba=_0x559f38;_0x35167b=0xc8;}else{_0x35167b=0xce;}_0x14037b[_0x88dc('0x1c')](_0x35167b);return _0x14037b['set'](_0x88dc('0x21'),_0x341f5c+'-'+_0xbc43ba+'/'+_0x559f38)[_0x88dc('0x22')](_0x19aa0c);}return null;};}function patchUpdates(_0x796ca0){return function(_0x3ef567){try{jsonpatch[_0x88dc('0x23')](_0x3ef567,_0x796ca0,!![]);}catch(_0x74f37c){return BPromise[_0x88dc('0x24')](_0x74f37c);}return _0x3ef567[_0x88dc('0x25')]();};}function saveUpdates(_0xb76f65,_0x4e3525){return function(_0x39b935){if(_0x39b935){return _0x39b935[_0x88dc('0x26')](_0xb76f65)[_0x88dc('0x27')](function(_0x58c963){return _0x58c963;});}return null;};}function removeEntity(_0x72edb,_0x14f8bf){return function(_0x13fd7c){if(_0x13fd7c){return _0x13fd7c[_0x88dc('0x28')]()[_0x88dc('0x27')](function(){_0x72edb[_0x88dc('0x1c')](0xcc)[_0x88dc('0x1b')]();});}};}function handleEntityNotFound(_0x4ec523,_0x3b9adb){return function(_0x967158){if(!_0x967158){_0x4ec523[_0x88dc('0x1a')](0x194);}return _0x967158;};}function handleError(_0x3867e2,_0x4517af){_0x4517af=_0x4517af||0x1f4;return function(_0x38e47c){logger[_0x88dc('0x29')](_0x38e47c[_0x88dc('0x2a')]);if(_0x38e47c[_0x88dc('0x2b')]){delete _0x38e47c['name'];}_0x3867e2['status'](_0x4517af)[_0x88dc('0x2c')](_0x38e47c);};}exports['index']=function(_0x22e25b,_0x5fde8c){var _0xbf06f6={},_0x3cbca5={},_0x583bb9={'count':0x0,'rows':[]};var _0x51011f=_[_0x88dc('0x2d')](db[_0x88dc('0x2e')][_0x88dc('0x2f')],function(_0x7d0e7c){return{'name':_0x7d0e7c[_0x88dc('0x30')],'type':_0x7d0e7c['type'][_0x88dc('0x31')]};});_0x3cbca5[_0x88dc('0x32')]=_[_0x88dc('0x2d')](_0x51011f,_0x88dc('0x2b'));_0x3cbca5[_0x88dc('0x33')]=_[_0x88dc('0x34')](_0x22e25b[_0x88dc('0x33')]);_0x3cbca5[_0x88dc('0x35')]=_[_0x88dc('0x36')](_0x3cbca5[_0x88dc('0x32')],_0x3cbca5[_0x88dc('0x33')]);_0xbf06f6[_0x88dc('0x37')]=_[_0x88dc('0x36')](_0x3cbca5[_0x88dc('0x32')],qs[_0x88dc('0x38')](_0x22e25b[_0x88dc('0x33')][_0x88dc('0x38')]));_0xbf06f6[_0x88dc('0x37')]=_0xbf06f6[_0x88dc('0x37')][_0x88dc('0x39')]?_0xbf06f6[_0x88dc('0x37')]:_0x3cbca5['model'];if(!_0x22e25b[_0x88dc('0x33')]['hasOwnProperty'](_0x88dc('0x3a'))){_0xbf06f6[_0x88dc('0x1f')]=qs[_0x88dc('0x1f')](_0x22e25b['query']['limit']);_0xbf06f6['offset']=qs[_0x88dc('0x1d')](_0x22e25b[_0x88dc('0x33')][_0x88dc('0x1d')]);}_0xbf06f6['order']=qs['sort'](_0x22e25b[_0x88dc('0x33')][_0x88dc('0x3b')]);_0xbf06f6[_0x88dc('0x3c')]=qs['filters'](_[_0x88dc('0x3d')](_0x22e25b[_0x88dc('0x33')],_0x3cbca5[_0x88dc('0x35')]),_0x51011f);if(_0x22e25b[_0x88dc('0x33')][_0x88dc('0x3e')]){_0xbf06f6['where']=_['merge'](_0xbf06f6[_0x88dc('0x3c')],{'$or':_[_0x88dc('0x2d')](_0x51011f,function(_0x3db8fa){if(_0x3db8fa[_0x88dc('0x3f')]!=='VIRTUAL'){var _0x55c442={};_0x55c442[_0x3db8fa[_0x88dc('0x2b')]]={'$like':'%'+_0x22e25b[_0x88dc('0x33')][_0x88dc('0x3e')]+'%'};return _0x55c442;}})});}_0xbf06f6=_['merge']({},_0xbf06f6,_0x22e25b[_0x88dc('0x40')]);var _0x538b83={'where':_0xbf06f6['where']};return db[_0x88dc('0x2e')]['count'](_0x538b83)[_0x88dc('0x27')](function(_0x2d3d7a){_0x583bb9['count']=_0x2d3d7a;if(_0x22e25b['query'][_0x88dc('0x41')]){_0xbf06f6['include']=[{'all':!![]}];}return db[_0x88dc('0x2e')][_0x88dc('0x42')](_0xbf06f6);})[_0x88dc('0x27')](function(_0x56a14a){_0x583bb9[_0x88dc('0x43')]=_0x56a14a;return _0x583bb9;})[_0x88dc('0x27')](respondWithFilteredResult(_0x5fde8c,_0xbf06f6))[_0x88dc('0x44')](handleError(_0x5fde8c,null));};exports[_0x88dc('0x45')]=function(_0x3be2d5,_0x191e3a){var _0x33b40f={'raw':!![],'where':{'id':_0x3be2d5[_0x88dc('0x46')]['id']}},_0x582fae={};_0x582fae['model']=_[_0x88dc('0x34')](db[_0x88dc('0x2e')][_0x88dc('0x2f')]);_0x582fae[_0x88dc('0x33')]=_[_0x88dc('0x34')](_0x3be2d5['query']);_0x582fae[_0x88dc('0x35')]=_[_0x88dc('0x36')](_0x582fae[_0x88dc('0x32')],_0x582fae[_0x88dc('0x33')]);_0x33b40f[_0x88dc('0x37')]=_['intersection'](_0x582fae['model'],qs[_0x88dc('0x38')](_0x3be2d5['query']['fields']));_0x33b40f[_0x88dc('0x37')]=_0x33b40f['attributes'][_0x88dc('0x39')]?_0x33b40f[_0x88dc('0x37')]:_0x582fae[_0x88dc('0x32')];if(_0x3be2d5[_0x88dc('0x33')]['includeAll']){_0x33b40f['include']=[{'all':!![]}];}_0x33b40f=_['merge']({},_0x33b40f,_0x3be2d5['options']);return db[_0x88dc('0x2e')][_0x88dc('0x47')](_0x33b40f)['then'](handleEntityNotFound(_0x191e3a,null))[_0x88dc('0x27')](respondWithResult(_0x191e3a,null))['catch'](handleError(_0x191e3a,null));};exports[_0x88dc('0x48')]=function(_0x34fa3e,_0x1e76f7){return db[_0x88dc('0x2e')]['create'](_0x34fa3e[_0x88dc('0x49')],{})['then'](respondWithResult(_0x1e76f7,0xc9))[_0x88dc('0x44')](handleError(_0x1e76f7,null));};exports['update']=function(_0x4f3f32,_0x114896){if(_0x4f3f32['body']['id']){delete _0x4f3f32['body']['id'];}return db[_0x88dc('0x2e')][_0x88dc('0x47')]({'where':{'id':_0x4f3f32[_0x88dc('0x46')]['id']}})[_0x88dc('0x27')](handleEntityNotFound(_0x114896,null))[_0x88dc('0x27')](saveUpdates(_0x4f3f32['body'],null))[_0x88dc('0x27')](respondWithResult(_0x114896,null))[_0x88dc('0x44')](handleError(_0x114896,null));};exports[_0x88dc('0x28')]=function(_0x4b10d2,_0xc5c2f8){return db[_0x88dc('0x2e')][_0x88dc('0x47')]({'where':{'id':_0x4b10d2['params']['id']}})[_0x88dc('0x27')](handleEntityNotFound(_0xc5c2f8,null))[_0x88dc('0x27')](removeEntity(_0xc5c2f8,null))[_0x88dc('0x44')](handleError(_0xc5c2f8,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 9a29c70..0f29f84 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 _0x6cd3=['path','rimraf','./smsApplication.attributes','exports','SmsApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird'];(function(_0x1b374e,_0x5d5c92){var _0x5ab52b=function(_0x5c5dec){while(--_0x5c5dec){_0x1b374e['push'](_0x1b374e['shift']());}};_0x5ab52b(++_0x5d5c92);}(_0x6cd3,0x1a1));var _0x36cd=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x6cd3[_0x1db481];return _0x3db95b;};'use strict';var _=require('lodash');var util=require(_0x36cd('0x0'));var logger=require(_0x36cd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x36cd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36cd('0x3'));var rimraf=require(_0x36cd('0x4'));var config=require('../../config/environment');var attributes=require(_0x36cd('0x5'));module[_0x36cd('0x6')]=function(_0xd97977,_0x3ac55d){return _0xd97977['define'](_0x36cd('0x7'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x36cd('0x8'),'collate':_0x36cd('0x9')});}; \ No newline at end of file +var _0xb733=['sms_applications','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x669d6d,_0x5a5a02){var _0x3cb975=function(_0x7f00ea){while(--_0x7f00ea){_0x669d6d['push'](_0x669d6d['shift']());}};_0x3cb975(++_0x5a5a02);}(_0xb733,0xab));var _0x3b73=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb733[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x3b73('0x0'));var util=require('util');var logger=require(_0x3b73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3b73('0x2'));var rp=require(_0x3b73('0x3'));var fs=require('fs');var path=require(_0x3b73('0x4'));var rimraf=require(_0x3b73('0x5'));var config=require(_0x3b73('0x6'));var attributes=require(_0x3b73('0x7'));module[_0x3b73('0x8')]=function(_0x4e445a,_0x26bfa8){return _0x4e445a[_0x3b73('0x9')](_0x3b73('0xa'),attributes,{'tableName':_0x3b73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3b73('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index e687904..8fa6107 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 _0x11c8=['jayson/promise','client','request\x20sent','debug','stringify','error','code','message','info','SmsApplication,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x11c8,0x19a));var _0x811c=function(_0x50d7c7,_0x3cef1d){_0x50d7c7=_0x50d7c7-0x0;var _0x5cb0f5=_0x11c8[_0x50d7c7];return _0x5cb0f5;};'use strict';var _=require('lodash');var util=require(_0x811c('0x0'));var moment=require(_0x811c('0x1'));var BPromise=require('bluebird');var rs=require(_0x811c('0x2'));var fs=require('fs');var Redis=require(_0x811c('0x3'));var db=require(_0x811c('0x4'))['db'];var utils=require(_0x811c('0x5'));var logger=require(_0x811c('0x6'))(_0x811c('0x7'));var config=require('../../config/environment');var jayson=require(_0x811c('0x8'));var client=jayson[_0x811c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126cc2,_0x8af784,_0x13a95a){return new BPromise(function(_0x3e81ac,_0x57a92d){return client['request'](_0x126cc2,_0x13a95a)['then'](function(_0x5be7fc){logger['info']('SmsApplication,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'));logger[_0x811c('0xb')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'),JSON[_0x811c('0xc')](_0x5be7fc));if(_0x5be7fc[_0x811c('0xd')]){if(_0x5be7fc[_0x811c('0xd')][_0x811c('0xe')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')]['message']);return _0x57a92d(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);return _0x3e81ac(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}else{logger[_0x811c('0x10')](_0x811c('0x11'),_0x8af784,'request\x20sent');_0x3e81ac(_0x5be7fc['result'][_0x811c('0xf')]);}})[_0x811c('0x12')](function(_0x3b0895){logger[_0x811c('0xd')](_0x811c('0x11'),_0x8af784,_0x3b0895);_0x57a92d(_0x3b0895);});});} \ No newline at end of file +var _0xf0f4=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4b0ebb,_0x39009a){var _0x31f3c0=function(_0x349ec4){while(--_0x349ec4){_0x4b0ebb['push'](_0x4b0ebb['shift']());}};_0x31f3c0(++_0x39009a);}(_0xf0f4,0x182));var _0x4f0f=function(_0x19dffc,_0x4d9a91){_0x19dffc=_0x19dffc-0x0;var _0x21294c=_0xf0f4[_0x19dffc];return _0x21294c;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f0f('0x1'));var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f0f('0x3'));var logger=require(_0x4f0f('0x4'))(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var jayson=require(_0x4f0f('0x7'));var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47faf5,_0x39ad76,_0x1dd6bd){return new BPromise(function(_0x95b1cf,_0x5da92f){return client[_0x4f0f('0xa')](_0x47faf5,_0x1dd6bd)[_0x4f0f('0xb')](function(_0x19cecb){logger[_0x4f0f('0xc')](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));logger[_0x4f0f('0xf')](_0x4f0f('0x10'),_0x39ad76,'request\x20sent',JSON[_0x4f0f('0x11')](_0x19cecb));if(_0x19cecb[_0x4f0f('0x12')]){if(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x13')]===0x1f4){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x5da92f(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}logger[_0x4f0f('0x12')]('SmsApplication,\x20%s,\x20%s',_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x95b1cf(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}else{logger['info'](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));_0x95b1cf(_0x19cecb[_0x4f0f('0x15')][_0x4f0f('0x14')]);}})[_0x4f0f('0x16')](function(_0x5f171b){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x5f171b);_0x5da92f(_0x5f171b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index d843e30..b71e008 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 _0x5c00=['smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5c00,0x17e));var _0x05c0=function(_0x18c44d,_0x33976d){_0x18c44d=_0x18c44d-0x0;var _0x71abcf=_0x5c00[_0x18c44d];return _0x71abcf;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./smsInteraction.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/describe',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/download',auth[_0x05c0('0x9')](),controller['download']);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router['post'](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0xf')](_0x05c0('0x12'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x15')),controller[_0x05c0('0x16')]);router['put'](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x18')),controller[_0x05c0('0x19')]);router[_0x05c0('0x1a')](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction['tracked'](_0x05c0('0x14'),_0x05c0('0x1b')),controller[_0x05c0('0x1c')]);router['delete'](_0x05c0('0x12'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x1d')]);module[_0x05c0('0x1e')]=router; \ No newline at end of file +var _0xed3c=['sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage'];(function(_0x32a449,_0x19b59d){var _0x16860b=function(_0x1510cd){while(--_0x1510cd){_0x32a449['push'](_0x32a449['shift']());}};_0x16860b(++_0x19b59d);}(_0xed3c,0x1a6));var _0xced3=function(_0x85666,_0x403be2){_0x85666=_0x85666-0x0;var _0x233527=_0xed3c[_0x85666];return _0x233527;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xc')]);router[_0xced3('0x8')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router['get'](_0xced3('0xf'),auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);router['post']('/',auth[_0xced3('0x9')](),controller[_0xced3('0x11')]);router[_0xced3('0x12')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0x13')]);router[_0xced3('0x12')]('/:id/tags',auth[_0xced3('0x9')](),interaction['tracked'](_0xced3('0x14'),_0xced3('0x15')),controller[_0xced3('0x16')]);router[_0xced3('0x17')]('/:id',auth[_0xced3('0x9')](),interaction[_0xced3('0x18')]('sms',_0xced3('0x19')),controller[_0xced3('0x1a')]);router[_0xced3('0x1b')](_0xced3('0x1c'),auth['isAuthenticated'](),interaction[_0xced3('0x18')]('sms',_0xced3('0x1d')),controller[_0xced3('0x1e')]);router[_0xced3('0x1b')](_0xced3('0x1f'),auth[_0xced3('0x9')](),controller[_0xced3('0x20')]);module[_0xced3('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 4e8d3ba..685b814 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 _0xe5e0=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0xe3b862,_0x23f099){var _0x129092=function(_0x1552a5){while(--_0x1552a5){_0xe3b862['push'](_0xe3b862['shift']());}};_0x129092(++_0x23f099);}(_0xe5e0,0x123));var _0x0e5e=function(_0x2f3ac6,_0x183857){_0x2f3ac6=_0x2f3ac6-0x0;var _0x6b9e3=_0xe5e0[_0x2f3ac6];return _0x6b9e3;};'use strict';var Sequelize=require(_0x0e5e('0x0'));var moment=require(_0x0e5e('0x1'));module[_0x0e5e('0x2')]={'closed':{'type':Sequelize[_0x0e5e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0e5e('0x4')]},'disposition':{'type':Sequelize[_0x0e5e('0x5')]},'secondDisposition':{'type':Sequelize[_0x0e5e('0x5')]},'thirdDisposition':{'type':Sequelize[_0x0e5e('0x5')]},'note':{'type':Sequelize[_0x0e5e('0x5')]},'phone':{'type':Sequelize[_0x0e5e('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0e5e('0x6')]('in',_0x0e5e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0e5e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0e5e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2d17=['BOOLEAN','DATE','STRING','ENUM','sequelize','moment'];(function(_0x5d1525,_0x22e410){var _0xef73f0=function(_0x122761){while(--_0x122761){_0x5d1525['push'](_0x5d1525['shift']());}};_0xef73f0(++_0x22e410);}(_0x2d17,0x17e));var _0x72d1=function(_0x1ff52b,_0x12906d){_0x1ff52b=_0x1ff52b-0x0;var _0x32c990=_0x2d17[_0x1ff52b];return _0x32c990;};'use strict';var Sequelize=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));module['exports']={'closed':{'type':Sequelize[_0x72d1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x72d1('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x72d1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x72d1('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x72d1('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x72d1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x72d1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x72d1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x72d1('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 4a8dfa9..dd8cd00 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 _0xa87e=['rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','params','model','keys','SmsInteraction','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','count','addTags','spread','Tag','emit','smsInteractionTags:save','removeTags','unix','toString','join','root','server','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','createdAt','direction','secret','read','SmsAccount','Account','mkdirSync','Sms','Owner','N.A.','closed','closedAt','Messages','out','lastName','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','update','then','destroy','error','name','send','index','map'];(function(_0x1a944e,_0x4b94f8){var _0x52cf88=function(_0x36df76){while(--_0x36df76){_0x1a944e['push'](_0x1a944e['shift']());}};_0x52cf88(++_0x4b94f8);}(_0xa87e,0x1c2));var _0xea87=function(_0x38fa6e,_0x3e4d74){_0x38fa6e=_0x38fa6e-0x0;var _0x2fc1f6=_0xa87e[_0x38fa6e];return _0x2fc1f6;};'use strict';var rimraf=require(_0xea87('0x0'));var zipdir=require(_0xea87('0x1'));var moment=require(_0xea87('0x2'));var BPromise=require(_0xea87('0x3'));var util=require('util');var path=require(_0xea87('0x4'));var ejs=require(_0xea87('0x5'));var fs=require('fs');var _=require(_0xea87('0x6'));var Redis=require('ioredis');var interaction=require(_0xea87('0x7'));var qs=require(_0xea87('0x8'));var pdf=require(_0xea87('0x9'));var logger=require(_0xea87('0xa'))('api');var config=require(_0xea87('0xb'));var db=require(_0xea87('0xc'))['db'];config[_0xea87('0xd')]=_[_0xea87('0xe')](config[_0xea87('0xd')],{'host':_0xea87('0xf'),'port':0x18eb});var socket=require(_0xea87('0x10'))(new Redis(config[_0xea87('0xd')]));require(_0xea87('0x11'))[_0xea87('0x12')](socket);function respondWithStatusCode(_0x269540,_0x3f287c){_0x3f287c=_0x3f287c||0xcc;return function(_0x558ea3){if(_0x558ea3){return _0x269540[_0xea87('0x13')](_0x3f287c);}return _0x269540[_0xea87('0x14')](_0x3f287c)[_0xea87('0x15')]();};}function respondWithResult(_0x5d4731,_0x140800){_0x140800=_0x140800||0xc8;return function(_0x47dc78){if(_0x47dc78){return _0x5d4731[_0xea87('0x14')](_0x140800)[_0xea87('0x16')](_0x47dc78);}};}function respondWithFilteredResult(_0x15c163,_0x5dd556){return function(_0x33cf42){if(_0x33cf42){var _0xc259cf=typeof _0x5dd556[_0xea87('0x17')]===_0xea87('0x18')&&typeof _0x5dd556[_0xea87('0x19')]===_0xea87('0x18');var _0x36998c=_0x33cf42['count'];var _0x2f170f=_0xc259cf?0x0:_0x5dd556['offset'];var _0x58622e=_0xc259cf?_0x33cf42['count']:_0x5dd556['offset']+_0x5dd556[_0xea87('0x19')];var _0x5c92a9;if(_0x58622e>=_0x36998c){_0x58622e=_0x36998c;_0x5c92a9=0xc8;}else{_0x5c92a9=0xce;}_0x15c163[_0xea87('0x14')](_0x5c92a9);return _0x15c163['set']('Content-Range',_0x2f170f+'-'+_0x58622e+'/'+_0x36998c)['json'](_0x33cf42);}return null;};}function saveUpdates(_0x1ef58e){return function(_0x303c65){if(_0x303c65){return _0x303c65[_0xea87('0x1a')](_0x1ef58e)[_0xea87('0x1b')](function(_0x4b42a1){return _0x4b42a1;});}return null;};}function removeEntity(_0x15f94b){return function(_0x1e9767){if(_0x1e9767){return _0x1e9767[_0xea87('0x1c')]()['then'](function(){_0x15f94b['status'](0xcc)[_0xea87('0x15')]();});}};}function handleEntityNotFound(_0x472455){return function(_0x1f449f){if(!_0x1f449f){_0x472455[_0xea87('0x13')](0x194);}return _0x1f449f;};}function handleError(_0x282a07,_0x41cf0c){_0x41cf0c=_0x41cf0c||0x1f4;return function(_0x2280f8){logger[_0xea87('0x1d')](_0x2280f8['stack']);if(_0x2280f8[_0xea87('0x1e')]){delete _0x2280f8[_0xea87('0x1e')];}_0x282a07['status'](_0x41cf0c)[_0xea87('0x1f')](_0x2280f8);};}exports[_0xea87('0x20')]=function(_0x246652,_0x356267){var _0x5edc4f={};var _0x22c150=_[_0xea87('0x21')](db['SmsInteraction'][_0xea87('0x22')],function(_0x4b22a4){return{'name':_0x4b22a4[_0xea87('0x23')],'type':_0x4b22a4[_0xea87('0x24')][_0xea87('0x25')]};});_0x5edc4f=qs[_0xea87('0x26')](_0x22c150,_0x246652);return interaction[_0xea87('0x27')](_0xea87('0x28'),_0x246652[_0xea87('0x29')],_0x246652[_0xea87('0x2a')],_0x5edc4f,_0x22c150)[_0xea87('0x1b')](respondWithFilteredResult(_0x356267,_0x5edc4f))['catch'](handleError(_0x356267,null));};exports['show']=function(_0x475734,_0x453bc3){var _0x97db5c={'raw':![],'where':{'id':_0x475734[_0xea87('0x2b')]['id']}},_0x155ee1={};_0x155ee1[_0xea87('0x2c')]=_[_0xea87('0x2d')](db[_0xea87('0x2e')]['rawAttributes']);_0x155ee1['query']=_[_0xea87('0x2d')](_0x475734[_0xea87('0x29')]);_0x155ee1['filters']=_[_0xea87('0x2f')](_0x155ee1[_0xea87('0x2c')],_0x155ee1[_0xea87('0x29')]);_0x97db5c[_0xea87('0x30')]=_['intersection'](_0x155ee1[_0xea87('0x2c')],qs[_0xea87('0x31')](_0x475734[_0xea87('0x29')]['fields']));_0x97db5c['attributes']=_0x97db5c[_0xea87('0x30')][_0xea87('0x32')]?_0x97db5c[_0xea87('0x30')]:_0x155ee1['model'];if(_0x475734[_0xea87('0x29')][_0xea87('0x33')]){_0x97db5c[_0xea87('0x34')]=[{'all':!![]}];}_0x97db5c=_[_0xea87('0x35')]({},_0x97db5c,_0x475734[_0xea87('0x36')]);return db[_0xea87('0x2e')][_0xea87('0x37')](_0x97db5c)['then'](handleEntityNotFound(_0x453bc3,null))[_0xea87('0x1b')](respondWithResult(_0x453bc3,null))[_0xea87('0x38')](handleError(_0x453bc3,null));};exports[_0xea87('0x39')]=function(_0x1b9daf,_0x1b3151){return db[_0xea87('0x2e')][_0xea87('0x39')](_0x1b9daf[_0xea87('0x3a')],{})[_0xea87('0x1b')](respondWithResult(_0x1b3151,0xc9))['catch'](handleError(_0x1b3151,null));};exports[_0xea87('0x1a')]=function(_0x494c53,_0x3c5aaa){if(_0x494c53[_0xea87('0x3a')]['id']){delete _0x494c53['body']['id'];}return db['SmsInteraction'][_0xea87('0x37')]({'where':{'id':_0x494c53[_0xea87('0x2b')]['id']}})[_0xea87('0x1b')](handleEntityNotFound(_0x3c5aaa,null))[_0xea87('0x1b')](saveUpdates(_0x494c53[_0xea87('0x3a')],null))[_0xea87('0x1b')](respondWithResult(_0x3c5aaa,null))['catch'](handleError(_0x3c5aaa,null));};exports['destroy']=function(_0x533869,_0x4eda02){return db['SmsInteraction']['find']({'where':{'id':_0x533869['params']['id']}})[_0xea87('0x1b')](handleEntityNotFound(_0x4eda02,null))['then'](removeEntity(_0x4eda02,null))[_0xea87('0x38')](handleError(_0x4eda02,null));};exports[_0xea87('0x3b')]=function(_0x4071dd,_0x1271a4){return db['SmsInteraction'][_0xea87('0x3b')]()[_0xea87('0x1b')](respondWithResult(_0x1271a4,null))['catch'](handleError(_0x1271a4,null));};exports['addMessage']=function(_0x59e7f0,_0x3f8a01){return db[_0xea87('0x3c')]['find']({'where':{'id':_0x59e7f0['params']['id']}})['then'](handleEntityNotFound(_0x3f8a01,null))[_0xea87('0x1b')](function(_0x491f00){if(_0x491f00){return _0x491f00[_0xea87('0x3d')](_0x59e7f0['body'][_0xea87('0x3e')],_[_0xea87('0x3f')](_0x59e7f0[_0xea87('0x3a')],[_0xea87('0x3e'),'id'])||{});}})[_0xea87('0x1b')](respondWithResult(_0x3f8a01,null))[_0xea87('0x38')](handleError(_0x3f8a01,null));};exports[_0xea87('0x40')]=function(_0x5a7552,_0x7e8145){var _0x1738c5={'raw':![],'where':{}};var _0x2eb6f3={};var _0x2cd028={'count':0x0,'rows':[]};return db[_0xea87('0x2e')][_0xea87('0x41')]({'where':{'id':_0x5a7552[_0xea87('0x2b')]['id']}})[_0xea87('0x1b')](handleEntityNotFound(_0x7e8145,null))[_0xea87('0x1b')](function(_0x2f291e){if(_0x2f291e){_0x2eb6f3[_0xea87('0x2c')]=_['keys'](db[_0xea87('0x3c')][_0xea87('0x22')]);_0x2eb6f3[_0xea87('0x29')]=_[_0xea87('0x2d')](_0x5a7552['query']);_0x2eb6f3[_0xea87('0x42')]=_[_0xea87('0x2f')](_0x2eb6f3[_0xea87('0x2c')],_0x2eb6f3[_0xea87('0x29')]);_0x1738c5[_0xea87('0x30')]=_[_0xea87('0x2f')](_0x2eb6f3[_0xea87('0x2c')],qs[_0xea87('0x31')](_0x5a7552[_0xea87('0x29')][_0xea87('0x31')]));_0x1738c5[_0xea87('0x30')]=_0x1738c5[_0xea87('0x30')][_0xea87('0x32')]?_0x1738c5[_0xea87('0x30')]:_0x2eb6f3[_0xea87('0x2c')];if(!_0x5a7552['query'][_0xea87('0x43')](_0xea87('0x44'))){_0x1738c5[_0xea87('0x19')]=qs[_0xea87('0x19')](_0x5a7552[_0xea87('0x29')][_0xea87('0x19')]);_0x1738c5[_0xea87('0x17')]=qs['offset'](_0x5a7552[_0xea87('0x29')][_0xea87('0x17')]);}_0x1738c5[_0xea87('0x45')]=qs['sort'](_0x5a7552[_0xea87('0x29')][_0xea87('0x46')]);_0x1738c5[_0xea87('0x47')]=qs[_0xea87('0x42')](_['pick'](_0x5a7552['query'],_0x2eb6f3[_0xea87('0x42')]));_0x1738c5[_0xea87('0x47')]['SmsInteractionId']=_0x2f291e['id'];if(_0x5a7552[_0xea87('0x29')][_0xea87('0x48')]){_0x1738c5[_0xea87('0x47')]=_['merge'](_0x1738c5['where'],{'$or':_[_0xea87('0x21')](_0x1738c5[_0xea87('0x30')],function(_0x72766a){var _0x9011be={};_0x9011be[_0x72766a]={'$like':'%'+_0x5a7552[_0xea87('0x29')][_0xea87('0x48')]+'%'};return _0x9011be;})});}if(_0x5a7552[_0xea87('0x29')][_0xea87('0x49')]){var _0x2f5444=_0x5a7552[_0xea87('0x29')][_0xea87('0x49')]['split'](',');var _0x26b30b={};_0x26b30b[_0x2f5444[0x0]]={'$gte':moment(_0x2f5444[0x1])[_0xea87('0x4a')](_0xea87('0x4b'))};_0x1738c5[_0xea87('0x47')]=_[_0xea87('0x35')](_0x1738c5[_0xea87('0x47')],_0x26b30b);}_0x1738c5=_[_0xea87('0x35')]({},_0x1738c5,_0x5a7552[_0xea87('0x36')]);return db['SmsMessage']['count']({'where':_0x1738c5[_0xea87('0x47')]})[_0xea87('0x1b')](function(_0x12f59f){_0x2cd028[_0xea87('0x4c')]=_0x12f59f;if(_0x5a7552[_0xea87('0x29')][_0xea87('0x33')]){_0x1738c5[_0xea87('0x34')]=[{'all':!![]}];}return db[_0xea87('0x3c')][_0xea87('0x27')](_0x1738c5);})[_0xea87('0x1b')](function(_0x4f5226){_0x2cd028['rows']=_0x4f5226;return _0x2cd028;});}})[_0xea87('0x1b')](respondWithFilteredResult(_0x7e8145,_0x1738c5))[_0xea87('0x38')](handleError(_0x7e8145,null));};exports[_0xea87('0x4d')]=function(_0x56bc73,_0x2ed2df){return db[_0xea87('0x2e')]['find']({'where':{'id':_0x56bc73[_0xea87('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2ed2df,null))[_0xea87('0x1b')](function(_0x4d631b){if(_0x4d631b){return _0x4d631b['setTags'](_0x56bc73['body'][_0xea87('0x3e')],_['omit'](_0x56bc73[_0xea87('0x3a')],[_0xea87('0x3e'),'id'])||{})[_0xea87('0x4e')](function(){return db[_0xea87('0x4f')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x56bc73[_0xea87('0x3a')]['ids']}});})[_0xea87('0x1b')](function(_0x19da1a){socket[_0xea87('0x50')](_0xea87('0x51'),{'id':Number(_0x56bc73[_0xea87('0x2b')]['id']),'tags':_0x19da1a||[]});return{'id':Number(_0x56bc73['params']['id']),'tags':_0x19da1a||[]};});}})['then'](respondWithResult(_0x2ed2df,null))['catch'](handleError(_0x2ed2df,null));};exports[_0xea87('0x52')]=function(_0x5c381f,_0x3afa4){return db['SmsInteraction'][_0xea87('0x37')]({'where':{'id':_0x5c381f['params']['id']}})[_0xea87('0x1b')](handleEntityNotFound(_0x3afa4,null))['then'](function(_0x52ceba){if(_0x52ceba){return _0x52ceba[_0xea87('0x52')](_0x5c381f['query'][_0xea87('0x3e')]);}})[_0xea87('0x1b')](respondWithStatusCode(_0x3afa4,null))[_0xea87('0x38')](handleError(_0x3afa4,null));};exports['download']=function(_0x464bb8,_0x445f6b){var _0xf3f89a=moment()[_0xea87('0x53')]()[_0xea87('0x54')]();var _0x42081f=path[_0xea87('0x55')](config[_0xea87('0x56')],_0xea87('0x57'),'files',_0xea87('0x58'));var _0x365b61=path[_0xea87('0x55')](_0x42081f,_0xf3f89a);var _0x1da72e=util[_0xea87('0x4a')](_0xea87('0x59'),_0x464bb8['params']['id'],_0xf3f89a);var _0x27c06c=path[_0xea87('0x55')](_0x42081f,_0x1da72e);var _0x550c28=[];_0x550c28[_0xea87('0x5a')]({'model':db[_0xea87('0x5b')],'as':_0xea87('0x5b'),'attributes':['id',_0xea87('0x5c')],'raw':!![]});_0x550c28[_0xea87('0x5a')]({'model':db[_0xea87('0x5d')],'as':_0xea87('0x5e'),'attributes':['id',_0xea87('0x5f'),'lastName'],'raw':!![]});var _0x264071=[{'model':db[_0xea87('0x3c')],'as':'Messages','attributes':['id','body',_0xea87('0x60'),_0xea87('0x61'),_0xea87('0x62'),_0xea87('0x63')],'include':_0x550c28}];_0x264071[_0xea87('0x5a')]({'model':db[_0xea87('0x64')],'as':_0xea87('0x65'),'attributes':['id',_0xea87('0x1e')]});_0x264071[_0xea87('0x5a')]({'model':db[_0xea87('0x5b')],'as':'Owner','attributes':['id',_0xea87('0x5c')]});return db[_0xea87('0x2e')]['find']({'where':{'id':_0x464bb8[_0xea87('0x2b')]['id']},'include':_0x264071})[_0xea87('0x1b')](handleEntityNotFound(_0x445f6b,null))[_0xea87('0x1b')](function(_0x10f9eb){if(_0x10f9eb){var _0x3ca469=_0x10f9eb['get']({'plain':!![]});fs[_0xea87('0x66')](_0x365b61);var _0xc44a8f={'channel':_0xea87('0x67'),'account':_0x3ca469[_0xea87('0x65')][_0xea87('0x1e')],'agent':_0x3ca469[_0xea87('0x68')]?_0x3ca469[_0xea87('0x68')][_0xea87('0x5c')]:_0xea87('0x69'),'createdAt':moment(_0x3ca469[_0xea87('0x60')])[_0xea87('0x4a')](_0xea87('0x4b'))[_0xea87('0x54')](),'closedAt':_0x3ca469[_0xea87('0x6a')]?moment(_0x3ca469[_0xea87('0x6b')])[_0xea87('0x4a')](_0xea87('0x4b'))['toString']():'','disposition':_0x3ca469['disposition'],'messages':_(_0x3ca469[_0xea87('0x6c')])[_0xea87('0x48')]({'secret':![]})[_0xea87('0x21')](function(_0x12bea1){return{'date':moment(_0x12bea1['createdAt'])[_0xea87('0x4a')](_0xea87('0x4b'))[_0xea87('0x54')](),'sender':_0x12bea1[_0xea87('0x61')]===_0xea87('0x6d')?_0x12bea1['User']?_0x12bea1[_0xea87('0x5b')][_0xea87('0x5c')]:'System':_0x12bea1['Contact'][_0xea87('0x5f')]+(_0x12bea1[_0xea87('0x5e')][_0xea87('0x6e')]?'\x20'+_0x12bea1[_0xea87('0x5e')][_0xea87('0x6e')]:''),'body':_0x12bea1['body'],'direction':_0x12bea1[_0xea87('0x61')]===_0xea87('0x6d')?'A':'C','secret':_0x12bea1[_0xea87('0x62')],'read':_0x12bea1['read']};})[_0xea87('0x6f')]()};return ejs['renderFile'](path[_0xea87('0x55')](config[_0xea87('0x56')],_0xea87('0x57'),_0xea87('0x70'),_0xea87('0x71')),{'interaction':_0xc44a8f})[_0xea87('0x1b')](function(_0x59977f){var _0x2e2ff3=path['join'](_0x365b61,_0xea87('0x72')+_0x3ca469['id']+'-'+_0xf3f89a+_0xea87('0x73'));var _0x4a2d54={'path':_0x2e2ff3,'channel':'Sms','interactionId':_0x3ca469['id']};return pdf[_0xea87('0x74')](_0x59977f,_0x4a2d54);})[_0xea87('0x1b')](function(){return new BPromise(function(_0x31b400,_0x53a4aa){zipdir(_0x365b61,{'saveTo':_0x27c06c},function(_0x57c750,_0x319baa){if(_0x57c750)return _0x53a4aa(_0x57c750);return _0x31b400(_0x319baa);});})['then'](function(){return new BPromise(function(_0x39c1b1,_0x38c127){rimraf(_0x365b61,function(_0x5f1c07){if(_0x5f1c07)_0x38c127(_0x5f1c07);return _0x39c1b1();});});})[_0xea87('0x1b')](function(){return _0x445f6b[_0xea87('0x75')](_0x27c06c,_0x1da72e,function(_0x3af003){if(_0x3af003){console[_0xea87('0x76')](_0xea87('0x77'),_0x3af003);}else{fs[_0xea87('0x78')](_0x27c06c);}});});});}else{return _0x445f6b[_0xea87('0x13')](0xc8);}})[_0xea87('0x38')](handleError(_0x445f6b,null));}; \ No newline at end of file +var _0xe59a=['SmsInteractionId','merge','filter','$gte','format','addTags','setTags','spread','Tag','color','smsInteractionTags:save','removeTags','unix','toString','join','server','files','tmp','User','fullname','push','CmContact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','get','mkdirSync','Sms','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','Contact','value','root','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','set','update','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where'];(function(_0x4d1c7e,_0x12abcd){var _0x2c77b3=function(_0x549bb0){while(--_0x549bb0){_0x4d1c7e['push'](_0x4d1c7e['shift']());}};_0x2c77b3(++_0x12abcd);}(_0xe59a,0x19f));var _0xae59=function(_0x841ff6,_0xb59a97){_0x841ff6=_0x841ff6-0x0;var _0x1be58a=_0xe59a[_0x841ff6];return _0x1be58a;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xae59('0x0'));var BPromise=require('bluebird');var util=require(_0xae59('0x1'));var path=require(_0xae59('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xae59('0x3'));var Redis=require(_0xae59('0x4'));var interaction=require(_0xae59('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0xae59('0x6'));var logger=require(_0xae59('0x7'))('api');var config=require(_0xae59('0x8'));var db=require(_0xae59('0x9'))['db'];config[_0xae59('0xa')]=_[_0xae59('0xb')](config[_0xae59('0xa')],{'host':_0xae59('0xc'),'port':0x18eb});var socket=require(_0xae59('0xd'))(new Redis(config[_0xae59('0xa')]));require(_0xae59('0xe'))[_0xae59('0xf')](socket);function respondWithStatusCode(_0x1bdcdd,_0x4f70bc){_0x4f70bc=_0x4f70bc||0xcc;return function(_0x3f102d){if(_0x3f102d){return _0x1bdcdd[_0xae59('0x10')](_0x4f70bc);}return _0x1bdcdd['status'](_0x4f70bc)[_0xae59('0x11')]();};}function respondWithResult(_0x2d0cd7,_0x5d7464){_0x5d7464=_0x5d7464||0xc8;return function(_0x35b6ab){if(_0x35b6ab){return _0x2d0cd7['status'](_0x5d7464)[_0xae59('0x12')](_0x35b6ab);}};}function respondWithFilteredResult(_0x175e9e,_0x353206){return function(_0x20627e){if(_0x20627e){var _0x379478=typeof _0x353206['offset']===_0xae59('0x13')&&typeof _0x353206[_0xae59('0x14')]==='undefined';var _0x3d6c4c=_0x20627e[_0xae59('0x15')];var _0x340447=_0x379478?0x0:_0x353206[_0xae59('0x16')];var _0x4f9cde=_0x379478?_0x20627e['count']:_0x353206[_0xae59('0x16')]+_0x353206[_0xae59('0x14')];var _0xd3414;if(_0x4f9cde>=_0x3d6c4c){_0x4f9cde=_0x3d6c4c;_0xd3414=0xc8;}else{_0xd3414=0xce;}_0x175e9e[_0xae59('0x17')](_0xd3414);return _0x175e9e[_0xae59('0x18')]('Content-Range',_0x340447+'-'+_0x4f9cde+'/'+_0x3d6c4c)[_0xae59('0x12')](_0x20627e);}return null;};}function saveUpdates(_0x1afb13){return function(_0x1a3190){if(_0x1a3190){return _0x1a3190[_0xae59('0x19')](_0x1afb13)[_0xae59('0x1a')](function(_0x247fc7){return _0x247fc7;});}return null;};}function removeEntity(_0xe9fa2a){return function(_0x553a49){if(_0x553a49){return _0x553a49[_0xae59('0x1b')]()[_0xae59('0x1a')](function(){_0xe9fa2a[_0xae59('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x401e8d){return function(_0x43617a){if(!_0x43617a){_0x401e8d[_0xae59('0x10')](0x194);}return _0x43617a;};}function handleError(_0x562ea7,_0x395f00){_0x395f00=_0x395f00||0x1f4;return function(_0x2e9a3d){logger[_0xae59('0x1c')](_0x2e9a3d[_0xae59('0x1d')]);if(_0x2e9a3d[_0xae59('0x1e')]){delete _0x2e9a3d[_0xae59('0x1e')];}_0x562ea7[_0xae59('0x17')](_0x395f00)[_0xae59('0x1f')](_0x2e9a3d);};}exports[_0xae59('0x20')]=function(_0x1bf448,_0x45ff31){var _0xcfb97a={};var _0x5501e7=_[_0xae59('0x21')](db[_0xae59('0x22')][_0xae59('0x23')],function(_0x438ba2){return{'name':_0x438ba2[_0xae59('0x24')],'type':_0x438ba2[_0xae59('0x25')]['key']};});_0xcfb97a=qs[_0xae59('0x26')](_0x5501e7,_0x1bf448);return interaction[_0xae59('0x27')](_0xae59('0x28'),_0x1bf448[_0xae59('0x29')],_0x1bf448['user'],_0xcfb97a,_0x5501e7)[_0xae59('0x1a')](respondWithFilteredResult(_0x45ff31,_0xcfb97a))[_0xae59('0x2a')](handleError(_0x45ff31,null));};exports[_0xae59('0x2b')]=function(_0x3127cb,_0xddc205){var _0x32d78b={'raw':![],'where':{'id':_0x3127cb[_0xae59('0x2c')]['id']}},_0x2b56b1={};_0x2b56b1[_0xae59('0x2d')]=_[_0xae59('0x2e')](db[_0xae59('0x22')][_0xae59('0x23')]);_0x2b56b1[_0xae59('0x29')]=_['keys'](_0x3127cb[_0xae59('0x29')]);_0x2b56b1[_0xae59('0x2f')]=_[_0xae59('0x30')](_0x2b56b1[_0xae59('0x2d')],_0x2b56b1[_0xae59('0x29')]);_0x32d78b[_0xae59('0x31')]=_[_0xae59('0x30')](_0x2b56b1[_0xae59('0x2d')],qs[_0xae59('0x32')](_0x3127cb[_0xae59('0x29')]['fields']));_0x32d78b['attributes']=_0x32d78b[_0xae59('0x31')][_0xae59('0x33')]?_0x32d78b[_0xae59('0x31')]:_0x2b56b1['model'];if(_0x3127cb[_0xae59('0x29')][_0xae59('0x34')]){_0x32d78b[_0xae59('0x35')]=[{'all':!![]}];}_0x32d78b=_['merge']({},_0x32d78b,_0x3127cb[_0xae59('0x36')]);return db['SmsInteraction'][_0xae59('0x37')](_0x32d78b)[_0xae59('0x1a')](handleEntityNotFound(_0xddc205,null))[_0xae59('0x1a')](respondWithResult(_0xddc205,null))[_0xae59('0x2a')](handleError(_0xddc205,null));};exports[_0xae59('0x38')]=function(_0x4ce40e,_0x3eea54){return db[_0xae59('0x22')]['create'](_0x4ce40e[_0xae59('0x39')],{})['then'](respondWithResult(_0x3eea54,0xc9))['catch'](handleError(_0x3eea54,null));};exports[_0xae59('0x19')]=function(_0x45eef7,_0x30ddb9){if(_0x45eef7['body']['id']){delete _0x45eef7[_0xae59('0x39')]['id'];}return db[_0xae59('0x22')][_0xae59('0x37')]({'where':{'id':_0x45eef7[_0xae59('0x2c')]['id']}})[_0xae59('0x1a')](handleEntityNotFound(_0x30ddb9,null))[_0xae59('0x1a')](saveUpdates(_0x45eef7[_0xae59('0x39')],null))[_0xae59('0x1a')](respondWithResult(_0x30ddb9,null))[_0xae59('0x2a')](handleError(_0x30ddb9,null));};exports[_0xae59('0x1b')]=function(_0x57a068,_0x3f1e2c){return db[_0xae59('0x22')][_0xae59('0x37')]({'where':{'id':_0x57a068[_0xae59('0x2c')]['id']}})[_0xae59('0x1a')](handleEntityNotFound(_0x3f1e2c,null))['then'](removeEntity(_0x3f1e2c,null))[_0xae59('0x2a')](handleError(_0x3f1e2c,null));};exports[_0xae59('0x3a')]=function(_0x4a997e,_0x5e0640){return db['SmsInteraction'][_0xae59('0x3a')]()[_0xae59('0x1a')](respondWithResult(_0x5e0640,null))[_0xae59('0x2a')](handleError(_0x5e0640,null));};exports[_0xae59('0x3b')]=function(_0x202076,_0x1be213){return db[_0xae59('0x3c')][_0xae59('0x37')]({'where':{'id':_0x202076[_0xae59('0x2c')]['id']}})[_0xae59('0x1a')](handleEntityNotFound(_0x1be213,null))[_0xae59('0x1a')](function(_0xe85616){if(_0xe85616){return _0xe85616[_0xae59('0x3b')](_0x202076['body'][_0xae59('0x3d')],_[_0xae59('0x3e')](_0x202076['body'],[_0xae59('0x3d'),'id'])||{});}})[_0xae59('0x1a')](respondWithResult(_0x1be213,null))[_0xae59('0x2a')](handleError(_0x1be213,null));};exports[_0xae59('0x3f')]=function(_0x3c9c15,_0x396b37){var _0xcda9b3={'raw':![],'where':{}};var _0x47200e={};var _0xd6d2b2={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xae59('0x40')]({'where':{'id':_0x3c9c15['params']['id']}})['then'](handleEntityNotFound(_0x396b37,null))[_0xae59('0x1a')](function(_0x447a30){if(_0x447a30){_0x47200e[_0xae59('0x2d')]=_[_0xae59('0x2e')](db[_0xae59('0x3c')]['rawAttributes']);_0x47200e['query']=_[_0xae59('0x2e')](_0x3c9c15[_0xae59('0x29')]);_0x47200e[_0xae59('0x2f')]=_[_0xae59('0x30')](_0x47200e[_0xae59('0x2d')],_0x47200e['query']);_0xcda9b3[_0xae59('0x31')]=_[_0xae59('0x30')](_0x47200e['model'],qs[_0xae59('0x32')](_0x3c9c15[_0xae59('0x29')]['fields']));_0xcda9b3[_0xae59('0x31')]=_0xcda9b3['attributes'][_0xae59('0x33')]?_0xcda9b3[_0xae59('0x31')]:_0x47200e[_0xae59('0x2d')];if(!_0x3c9c15['query'][_0xae59('0x41')]('nolimit')){_0xcda9b3[_0xae59('0x14')]=qs['limit'](_0x3c9c15[_0xae59('0x29')]['limit']);_0xcda9b3[_0xae59('0x16')]=qs[_0xae59('0x16')](_0x3c9c15[_0xae59('0x29')][_0xae59('0x16')]);}_0xcda9b3[_0xae59('0x42')]=qs[_0xae59('0x43')](_0x3c9c15[_0xae59('0x29')]['sort']);_0xcda9b3[_0xae59('0x44')]=qs[_0xae59('0x2f')](_['pick'](_0x3c9c15['query'],_0x47200e[_0xae59('0x2f')]));_0xcda9b3[_0xae59('0x44')][_0xae59('0x45')]=_0x447a30['id'];if(_0x3c9c15[_0xae59('0x29')]['filter']){_0xcda9b3['where']=_[_0xae59('0x46')](_0xcda9b3[_0xae59('0x44')],{'$or':_[_0xae59('0x21')](_0xcda9b3[_0xae59('0x31')],function(_0x4f61c4){var _0x4e8912={};_0x4e8912[_0x4f61c4]={'$like':'%'+_0x3c9c15['query'][_0xae59('0x47')]+'%'};return _0x4e8912;})});}if(_0x3c9c15[_0xae59('0x29')]['$gte']){var _0x1b7a7f=_0x3c9c15[_0xae59('0x29')][_0xae59('0x48')]['split'](',');var _0x58976e={};_0x58976e[_0x1b7a7f[0x0]]={'$gte':moment(_0x1b7a7f[0x1])[_0xae59('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0xcda9b3['where']=_['merge'](_0xcda9b3[_0xae59('0x44')],_0x58976e);}_0xcda9b3=_[_0xae59('0x46')]({},_0xcda9b3,_0x3c9c15['options']);return db['SmsMessage'][_0xae59('0x15')]({'where':_0xcda9b3[_0xae59('0x44')]})['then'](function(_0x1ab276){_0xd6d2b2[_0xae59('0x15')]=_0x1ab276;if(_0x3c9c15['query'][_0xae59('0x34')]){_0xcda9b3[_0xae59('0x35')]=[{'all':!![]}];}return db[_0xae59('0x3c')][_0xae59('0x27')](_0xcda9b3);})[_0xae59('0x1a')](function(_0x10e941){_0xd6d2b2['rows']=_0x10e941;return _0xd6d2b2;});}})['then'](respondWithFilteredResult(_0x396b37,_0xcda9b3))[_0xae59('0x2a')](handleError(_0x396b37,null));};exports[_0xae59('0x4a')]=function(_0x264ecd,_0x6e7586){return db['SmsInteraction'][_0xae59('0x37')]({'where':{'id':_0x264ecd[_0xae59('0x2c')]['id']}})[_0xae59('0x1a')](handleEntityNotFound(_0x6e7586,null))['then'](function(_0xe690e3){if(_0xe690e3){return _0xe690e3[_0xae59('0x4b')](_0x264ecd['body']['ids'],_['omit'](_0x264ecd[_0xae59('0x39')],['ids','id'])||{})[_0xae59('0x4c')](function(){return db[_0xae59('0x4d')][_0xae59('0x27')]({'attributes':['id',_0xae59('0x1e'),_0xae59('0x4e')],'where':{'id':_0x264ecd[_0xae59('0x39')][_0xae59('0x3d')]}});})[_0xae59('0x1a')](function(_0x37e245){socket['emit'](_0xae59('0x4f'),{'id':Number(_0x264ecd['params']['id']),'tags':_0x37e245||[]});return{'id':Number(_0x264ecd[_0xae59('0x2c')]['id']),'tags':_0x37e245||[]};});}})[_0xae59('0x1a')](respondWithResult(_0x6e7586,null))[_0xae59('0x2a')](handleError(_0x6e7586,null));};exports[_0xae59('0x50')]=function(_0x45bdb2,_0x441cdb){return db[_0xae59('0x22')][_0xae59('0x37')]({'where':{'id':_0x45bdb2[_0xae59('0x2c')]['id']}})['then'](handleEntityNotFound(_0x441cdb,null))[_0xae59('0x1a')](function(_0x91e887){if(_0x91e887){return _0x91e887['removeTags'](_0x45bdb2['query'][_0xae59('0x3d')]);}})[_0xae59('0x1a')](respondWithStatusCode(_0x441cdb,null))[_0xae59('0x2a')](handleError(_0x441cdb,null));};exports['download']=function(_0x20115d,_0x3bc127){var _0x4b64db=moment()[_0xae59('0x51')]()[_0xae59('0x52')]();var _0x367d91=path[_0xae59('0x53')](config['root'],_0xae59('0x54'),_0xae59('0x55'),_0xae59('0x56'));var _0x7e3dde=path[_0xae59('0x53')](_0x367d91,_0x4b64db);var _0x4af976=util[_0xae59('0x49')]('transcript-%d-%s.zip',_0x20115d[_0xae59('0x2c')]['id'],_0x4b64db);var _0x45af0c=path[_0xae59('0x53')](_0x367d91,_0x4af976);var _0x3483b1=[];_0x3483b1['push']({'model':db[_0xae59('0x57')],'as':_0xae59('0x57'),'attributes':['id',_0xae59('0x58')],'raw':!![]});_0x3483b1[_0xae59('0x59')]({'model':db[_0xae59('0x5a')],'as':'Contact','attributes':['id',_0xae59('0x5b'),_0xae59('0x5c')],'raw':!![]});var _0x5e6991=[{'model':db[_0xae59('0x3c')],'as':_0xae59('0x5d'),'attributes':['id',_0xae59('0x39'),_0xae59('0x5e'),_0xae59('0x5f'),_0xae59('0x60'),_0xae59('0x61')],'include':_0x3483b1}];_0x5e6991[_0xae59('0x59')]({'model':db[_0xae59('0x62')],'as':'Account','attributes':['id',_0xae59('0x1e')]});_0x5e6991[_0xae59('0x59')]({'model':db[_0xae59('0x57')],'as':'Owner','attributes':['id','fullname']});return db[_0xae59('0x22')][_0xae59('0x37')]({'where':{'id':_0x20115d[_0xae59('0x2c')]['id']},'include':_0x5e6991})[_0xae59('0x1a')](handleEntityNotFound(_0x3bc127,null))[_0xae59('0x1a')](function(_0x1b8499){if(_0x1b8499){var _0x409581=_0x1b8499[_0xae59('0x63')]({'plain':!![]});fs[_0xae59('0x64')](_0x7e3dde);var _0x32eb66={'channel':_0xae59('0x65'),'account':_0x409581[_0xae59('0x66')]['name'],'agent':_0x409581[_0xae59('0x67')]?_0x409581[_0xae59('0x67')][_0xae59('0x58')]:_0xae59('0x68'),'createdAt':moment(_0x409581[_0xae59('0x5e')])['format'](_0xae59('0x69'))[_0xae59('0x52')](),'closedAt':_0x409581[_0xae59('0x6a')]?moment(_0x409581[_0xae59('0x6b')])[_0xae59('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae59('0x52')]():'','disposition':_0x409581[_0xae59('0x6c')],'messages':_(_0x409581['Messages'])[_0xae59('0x47')]({'secret':![]})[_0xae59('0x21')](function(_0x54bdc1){return{'date':moment(_0x54bdc1[_0xae59('0x5e')])[_0xae59('0x49')](_0xae59('0x69'))[_0xae59('0x52')](),'sender':_0x54bdc1[_0xae59('0x5f')]===_0xae59('0x6d')?_0x54bdc1[_0xae59('0x57')]?_0x54bdc1[_0xae59('0x57')][_0xae59('0x58')]:_0xae59('0x6e'):_0x54bdc1[_0xae59('0x6f')][_0xae59('0x5b')]+(_0x54bdc1[_0xae59('0x6f')][_0xae59('0x5c')]?'\x20'+_0x54bdc1['Contact'][_0xae59('0x5c')]:''),'body':_0x54bdc1[_0xae59('0x39')],'direction':_0x54bdc1[_0xae59('0x5f')]===_0xae59('0x6d')?'A':'C','secret':_0x54bdc1[_0xae59('0x60')],'read':_0x54bdc1['read']};})[_0xae59('0x70')]()};return ejs['renderFile'](path[_0xae59('0x53')](config[_0xae59('0x71')],_0xae59('0x54'),_0xae59('0x72'),_0xae59('0x73')),{'interaction':_0x32eb66})[_0xae59('0x1a')](function(_0x6a7f2c){var _0x43133a=path[_0xae59('0x53')](_0x7e3dde,_0xae59('0x74')+_0x409581['id']+'-'+_0x4b64db+_0xae59('0x75'));var _0x5ed0cd={'path':_0x43133a,'channel':_0xae59('0x65'),'interactionId':_0x409581['id']};return pdf['createPdfFromHTML'](_0x6a7f2c,_0x5ed0cd);})[_0xae59('0x1a')](function(){return new BPromise(function(_0x3ab68d,_0x36dc36){zipdir(_0x7e3dde,{'saveTo':_0x45af0c},function(_0x178fc4,_0xd8aa04){if(_0x178fc4)return _0x36dc36(_0x178fc4);return _0x3ab68d(_0xd8aa04);});})['then'](function(){return new BPromise(function(_0x391bd8,_0xa98ccf){rimraf(_0x7e3dde,function(_0x47e51e){if(_0x47e51e)_0xa98ccf(_0x47e51e);return _0x391bd8();});});})[_0xae59('0x1a')](function(){return _0x3bc127['download'](_0x45af0c,_0x4af976,function(_0x5240e3){if(_0x5240e3){console[_0xae59('0x76')](_0xae59('0x77'),_0x5240e3);}else{fs[_0xae59('0x78')](_0x45af0c);}});});});}else{return _0x3bc127[_0xae59('0x10')](0xc8);}})[_0xae59('0x2a')](handleError(_0x3bc127,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 75d900e..a531992 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1775=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x196edc,_0x24a173){var _0x681650=function(_0x5aa6bf){while(--_0x5aa6bf){_0x196edc['push'](_0x196edc['shift']());}};_0x681650(++_0x24a173);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5177('0x0'))['db'][_0x5177('0x1')];var SmsMessage=require(_0x5177('0x0'))['db'][_0x5177('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5177('0x3')](0x0);var events={'afterCreate':_0x5177('0x4'),'afterUpdate':_0x5177('0x5'),'afterDestroy':_0x5177('0x6')};function emitEvent(_0x359401){return function(_0x51275f,_0x159a20,_0x2c5c42){_0x51275f[_0x5177('0x7')]({'attributes':['id'],'raw':!![]})[_0x5177('0x8')](function(_0x300b43){_0x51275f[_0x5177('0x9')](_0x5177('0xa'),_0x300b43[_0x5177('0xb')](function(_0x16e7a7){return{'id':_0x16e7a7['id']};}));return SmsMessage[_0x5177('0xc')]({'where':{'SmsInteractionId':_0x51275f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5177('0x8')](function(_0x206035){_0x51275f['setDataValue']('unreadMessages',_0x206035[_0x5177('0xd')]);SmsInteractionEvents[_0x5177('0xe')](_0x359401+':'+_0x51275f['id'],_0x51275f);SmsInteractionEvents[_0x5177('0xe')](_0x359401,_0x51275f);_0x2c5c42(null);})[_0x5177('0xf')](_0x2c5c42(null));};}for(var e in events){if(events[_0x5177('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5177('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xdd4f=['setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x4e4774,_0x2eff7a){var _0x1a990a=function(_0x36a8a6){while(--_0x36a8a6){_0x4e4774['push'](_0x4e4774['shift']());}};_0x1a990a(++_0x2eff7a);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x42aef4,_0x27af05){_0x42aef4=_0x42aef4-0x0;var _0x45eae2=_0xdd4f[_0x42aef4];return _0x45eae2;};'use strict';var EventEmitter=require(_0xfdd4('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xfdd4('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfdd4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd4('0x3'),'afterDestroy':_0xfdd4('0x4')};function emitEvent(_0x6b2b0d){return function(_0x554e44,_0x398015,_0x43cbcf){_0x554e44[_0xfdd4('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdd4('0x6')](function(_0x3c72d4){_0x554e44['setDataValue'](_0xfdd4('0x7'),_0x3c72d4['map'](function(_0x4181d6){return{'id':_0x4181d6['id']};}));return SmsMessage[_0xfdd4('0x8')]({'where':{'SmsInteractionId':_0x554e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdd4('0x6')](function(_0x4ee02f){_0x554e44[_0xfdd4('0x9')]('unreadMessages',_0x4ee02f[_0xfdd4('0xa')]);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d+':'+_0x554e44['id'],_0x554e44);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d,_0x554e44);_0x43cbcf(null);})[_0xfdd4('0xc')](_0x43cbcf(null));};}for(var e in events){if(events[_0xfdd4('0xd')](e)){var event=events[e];SmsInteraction[_0xfdd4('0xe')](e,emitEvent(event));}}module[_0xfdd4('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0648882..c46432f 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 _0x39fa=['moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','changed','closed','closedAt','format','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x39fa,0xa8));var _0xa39f=function(_0x47e7a2,_0x1ffe44){_0x47e7a2=_0x47e7a2-0x0;var _0x73c23f=_0x39fa[_0x47e7a2];return _0x73c23f;};'use strict';var _=require('lodash');var util=require(_0xa39f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa39f('0x1'));var BPromise=require('bluebird');var rp=require(_0xa39f('0x2'));var fs=require('fs');var path=require(_0xa39f('0x3'));var rimraf=require(_0xa39f('0x4'));var config=require(_0xa39f('0x5'));var attributes=require(_0xa39f('0x6'));module['exports']=function(_0x159c4e,_0x4180cd){return _0x159c4e[_0xa39f('0x7')](_0xa39f('0x8'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd591d8,_0x3c4169,_0x53f94e){if(_0xd591d8[_0xa39f('0x9')](_0xa39f('0xa'))){_0xd591d8[_0xa39f('0xb')]=moment()[_0xa39f('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x53f94e(null,_0xd591d8);}}});}; \ No newline at end of file +var _0xb46e=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb46e,0x1ca));var _0xeb46=function(_0x2cb1bd,_0x42b64c){_0x2cb1bd=_0x2cb1bd-0x0;var _0x393fdf=_0xb46e[_0x2cb1bd];return _0x393fdf;};'use strict';var _=require(_0xeb46('0x0'));var util=require(_0xeb46('0x1'));var logger=require('../../config/logger')(_0xeb46('0x2'));var moment=require('moment');var BPromise=require(_0xeb46('0x3'));var rp=require(_0xeb46('0x4'));var fs=require('fs');var path=require(_0xeb46('0x5'));var rimraf=require(_0xeb46('0x6'));var config=require(_0xeb46('0x7'));var attributes=require(_0xeb46('0x8'));module[_0xeb46('0x9')]=function(_0x59bca1,_0x3ac2d8){return _0x59bca1[_0xeb46('0xa')](_0xeb46('0xb'),attributes,{'tableName':_0xeb46('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b868d,_0x1f345a,_0x4ebde4){if(_0x4b868d['changed'](_0xeb46('0xd'))){_0x4b868d[_0xeb46('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4ebde4(null,_0x4b868d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 06cbe05..174f555 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 _0xff28=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SmsInteraction','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','lodash'];(function(_0x4d7708,_0x13cf18){var _0x409575=function(_0x2f38a1){while(--_0x2f38a1){_0x4d7708['push'](_0x4d7708['shift']());}};_0x409575(++_0x13cf18);}(_0xff28,0x107));var _0x8ff2=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0xff28[_0x456a4b];return _0x42957c;};'use strict';var _=require(_0x8ff2('0x0'));var util=require(_0x8ff2('0x1'));var moment=require(_0x8ff2('0x2'));var BPromise=require(_0x8ff2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ff2('0x4'));var db=require(_0x8ff2('0x5'))['db'];var utils=require(_0x8ff2('0x6'));var logger=require(_0x8ff2('0x7'))(_0x8ff2('0x8'));var config=require(_0x8ff2('0x9'));var jayson=require(_0x8ff2('0xa'));var client=jayson[_0x8ff2('0xb')][_0x8ff2('0xc')]({'port':0x232a});config[_0x8ff2('0xd')]=_[_0x8ff2('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8ff2('0xd')]));require(_0x8ff2('0xf'))[_0x8ff2('0x10')](socket);function respondWithRpcPromise(_0x54c107,_0x3e58fa,_0x396e88){return new BPromise(function(_0x53a55f,_0x1afbda){return client[_0x8ff2('0x11')](_0x54c107,_0x396e88)[_0x8ff2('0x12')](function(_0xe92be4){logger[_0x8ff2('0x13')](_0x8ff2('0x14'),_0x3e58fa,'request\x20sent');logger[_0x8ff2('0x15')](_0x8ff2('0x16'),_0x3e58fa,_0x8ff2('0x17'),JSON[_0x8ff2('0x18')](_0xe92be4));if(_0xe92be4['error']){if(_0xe92be4[_0x8ff2('0x19')][_0x8ff2('0x1a')]===0x1f4){logger[_0x8ff2('0x19')](_0x8ff2('0x14'),_0x3e58fa,_0xe92be4[_0x8ff2('0x19')][_0x8ff2('0x1b')]);return _0x1afbda(_0xe92be4['error'][_0x8ff2('0x1b')]);}logger[_0x8ff2('0x19')](_0x8ff2('0x14'),_0x3e58fa,_0xe92be4[_0x8ff2('0x19')][_0x8ff2('0x1b')]);return _0x53a55f(_0xe92be4['error']['message']);}else{logger['info'](_0x8ff2('0x14'),_0x3e58fa,_0x8ff2('0x17'));_0x53a55f(_0xe92be4[_0x8ff2('0x1c')][_0x8ff2('0x1b')]);}})[_0x8ff2('0x1d')](function(_0x4635ed){logger[_0x8ff2('0x19')](_0x8ff2('0x14'),_0x3e58fa,_0x4635ed);_0x1afbda(_0x4635ed);});});}exports['UpdateSmsInteraction']=function(_0x15f3f){var _0x286365=this;return new Promise(function(_0x10fa65,_0x36a95c){return db[_0x8ff2('0x1e')]['update'](_0x15f3f[_0x8ff2('0x1f')],{'raw':_0x15f3f[_0x8ff2('0x20')]?_0x15f3f['options'][_0x8ff2('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15f3f['options']?_0x15f3f[_0x8ff2('0x20')][_0x8ff2('0x22')]||null:null,'attributes':_0x15f3f['options']?_0x15f3f[_0x8ff2('0x20')][_0x8ff2('0x23')]||null:null,'limit':_0x15f3f['options']?_0x15f3f['options'][_0x8ff2('0x24')]||null:null})['then'](function(_0x199dd9){logger[_0x8ff2('0x13')](_0x8ff2('0x25'),_0x15f3f);logger['debug'](_0x8ff2('0x25'),_0x15f3f,JSON[_0x8ff2('0x18')](_0x199dd9));_0x10fa65(_0x199dd9);})['catch'](function(_0x2219d2){logger[_0x8ff2('0x19')](_0x8ff2('0x25'),_0x2219d2[_0x8ff2('0x1b')],_0x15f3f);_0x36a95c(_0x286365[_0x8ff2('0x19')](0x1f4,_0x2219d2[_0x8ff2('0x1b')]));});});};exports[_0x8ff2('0x26')]=function(_0x39eff6){return new Promise(function(_0x3e28d7,_0xa7bf77){return db[_0x8ff2('0x1e')]['find']({'where':_0x39eff6['options']?_0x39eff6[_0x8ff2('0x20')][_0x8ff2('0x22')]||null:null})['then'](function(_0x235af5){if(_0x235af5){return _0x235af5[_0x8ff2('0x27')](_0x39eff6[_0x8ff2('0x1f')][_0x8ff2('0x28')],_[_0x8ff2('0x29')](_0x39eff6[_0x8ff2('0x1f')],['ids','id'])||{});}})[_0x8ff2('0x2a')](function(_0x4b4e7e){logger['info']('AddTags',_0x39eff6);logger[_0x8ff2('0x15')](_0x8ff2('0x2b'),_0x39eff6,JSON['stringify'](_0x4b4e7e));_0x3e28d7(_0x4b4e7e);})['catch'](function(_0x120a57){logger[_0x8ff2('0x19')]('AddTags',_0x120a57[_0x8ff2('0x1b')],_0x39eff6);_0xa7bf77(_this['error'](0x1f4,_0x120a57['message']));});});}; \ No newline at end of file +var _0xc3ba=['catch','SmsInteraction','update','body','options','raw','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','where','then','addTags','ids','omit','spread','AddTags','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xc3ba,0xf5));var _0xac3b=function(_0xb4b9a5,_0x14f810){_0xb4b9a5=_0xb4b9a5-0x0;var _0x3673f2=_0xc3ba[_0xb4b9a5];return _0x3673f2;};'use strict';var _=require(_0xac3b('0x0'));var util=require('util');var moment=require(_0xac3b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac3b('0x2'))['db'];var utils=require(_0xac3b('0x3'));var logger=require(_0xac3b('0x4'))(_0xac3b('0x5'));var config=require('../../config/environment');var jayson=require(_0xac3b('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xac3b('0x7')]=_[_0xac3b('0x8')](config[_0xac3b('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xac3b('0x9'))(new Redis(config[_0xac3b('0x7')]));require(_0xac3b('0xa'))[_0xac3b('0xb')](socket);function respondWithRpcPromise(_0x56a138,_0x26e9fd,_0x47ff60){return new BPromise(function(_0x579151,_0x300c78){return client[_0xac3b('0xc')](_0x56a138,_0x47ff60)['then'](function(_0x3ecfd2){logger[_0xac3b('0xd')](_0xac3b('0xe'),_0x26e9fd,'request\x20sent');logger[_0xac3b('0xf')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x26e9fd,'request\x20sent',JSON['stringify'](_0x3ecfd2));if(_0x3ecfd2[_0xac3b('0x10')]){if(_0x3ecfd2[_0xac3b('0x10')][_0xac3b('0x11')]===0x1f4){logger[_0xac3b('0x10')](_0xac3b('0xe'),_0x26e9fd,_0x3ecfd2['error'][_0xac3b('0x12')]);return _0x300c78(_0x3ecfd2[_0xac3b('0x10')][_0xac3b('0x12')]);}logger[_0xac3b('0x10')](_0xac3b('0xe'),_0x26e9fd,_0x3ecfd2['error'][_0xac3b('0x12')]);return _0x579151(_0x3ecfd2[_0xac3b('0x10')][_0xac3b('0x12')]);}else{logger[_0xac3b('0xd')](_0xac3b('0xe'),_0x26e9fd,_0xac3b('0x13'));_0x579151(_0x3ecfd2[_0xac3b('0x14')][_0xac3b('0x12')]);}})[_0xac3b('0x15')](function(_0x4f6929){logger[_0xac3b('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x26e9fd,_0x4f6929);_0x300c78(_0x4f6929);});});}exports['UpdateSmsInteraction']=function(_0x59edb2){var _0x4cc5c5=this;return new Promise(function(_0x306be2,_0x5c49af){return db[_0xac3b('0x16')][_0xac3b('0x17')](_0x59edb2[_0xac3b('0x18')],{'raw':_0x59edb2[_0xac3b('0x19')]?_0x59edb2[_0xac3b('0x19')][_0xac3b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59edb2[_0xac3b('0x19')]?_0x59edb2[_0xac3b('0x19')]['where']||null:null,'attributes':_0x59edb2['options']?_0x59edb2[_0xac3b('0x19')]['attributes']||null:null,'limit':_0x59edb2['options']?_0x59edb2[_0xac3b('0x19')]['limit']||null:null})['then'](function(_0x2562fb){logger[_0xac3b('0xd')](_0xac3b('0x1b'),_0x59edb2);logger[_0xac3b('0xf')]('UpdateSmsInteraction',_0x59edb2,JSON[_0xac3b('0x1c')](_0x2562fb));_0x306be2(_0x2562fb);})['catch'](function(_0x5add7e){logger[_0xac3b('0x10')](_0xac3b('0x1b'),_0x5add7e[_0xac3b('0x12')],_0x59edb2);_0x5c49af(_0x4cc5c5[_0xac3b('0x10')](0x1f4,_0x5add7e['message']));});});};exports[_0xac3b('0x1d')]=function(_0x31e506){return new Promise(function(_0x3b0959,_0x11acef){return db[_0xac3b('0x16')][_0xac3b('0x1e')]({'where':_0x31e506['options']?_0x31e506[_0xac3b('0x19')][_0xac3b('0x1f')]||null:null})[_0xac3b('0x20')](function(_0x55d2f2){if(_0x55d2f2){return _0x55d2f2[_0xac3b('0x21')](_0x31e506[_0xac3b('0x18')][_0xac3b('0x22')],_[_0xac3b('0x23')](_0x31e506[_0xac3b('0x18')],['ids','id'])||{});}})[_0xac3b('0x24')](function(_0x1138fb){logger[_0xac3b('0xd')](_0xac3b('0x25'),_0x31e506);logger[_0xac3b('0xf')](_0xac3b('0x25'),_0x31e506,JSON['stringify'](_0x1138fb));_0x3b0959(_0x1138fb);})[_0xac3b('0x15')](function(_0x108fee){logger[_0xac3b('0x10')](_0xac3b('0x25'),_0x108fee['message'],_0x31e506);_0x11acef(_this['error'](0x1f4,_0x108fee[_0xac3b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 23108c3..2b5ed88 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 _0x8255=['register','remove','update','removeListener'];(function(_0x568835,_0x2eb3f8){var _0x13cf7c=function(_0x46cf8e){while(--_0x46cf8e){_0x568835['push'](_0x568835['shift']());}};_0x13cf7c(++_0x2eb3f8);}(_0x8255,0xa9));var _0x5825=function(_0x18223d,_0x150660){_0x18223d=_0x18223d-0x0;var _0x35dd2f=_0x8255[_0x18223d];return _0x35dd2f;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0x5825('0x0'),_0x5825('0x1')];function createListener(_0xb88167,_0x155e57){return function(_0x1f5782){_0x155e57['emit'](_0xb88167,_0x1f5782);};}function removeListener(_0x52650c,_0xa01971){return function(){SmsInteractionEvents[_0x5825('0x2')](_0x52650c,_0xa01971);};}exports[_0x5825('0x3')]=function(_0x3ec69b){for(var _0x293d7f=0x0,_0x11b353=events['length'];_0x293d7f<_0x11b353;_0x293d7f++){var _0x2858f0=events[_0x293d7f];var _0x4ba964=createListener('smsInteraction:'+_0x2858f0,_0x3ec69b);SmsInteractionEvents['on'](_0x2858f0,_0x4ba964);}}; \ No newline at end of file +var _0x18db=['length','smsInteraction:','./smsInteraction.events','save','remove','emit','register'];(function(_0x10fe02,_0x6cae7b){var _0x33a915=function(_0x448ef7){while(--_0x448ef7){_0x10fe02['push'](_0x10fe02['shift']());}};_0x33a915(++_0x6cae7b);}(_0x18db,0x1ad));var _0xb18d=function(_0x39059e,_0x4f3f20){_0x39059e=_0x39059e-0x0;var _0x473ec5=_0x18db[_0x39059e];return _0x473ec5;};'use strict';var SmsInteractionEvents=require(_0xb18d('0x0'));var events=[_0xb18d('0x1'),_0xb18d('0x2'),'update'];function createListener(_0x488787,_0x59ac2d){return function(_0x1d5eed){_0x59ac2d[_0xb18d('0x3')](_0x488787,_0x1d5eed);};}function removeListener(_0x315a91,_0x57c47f){return function(){SmsInteractionEvents['removeListener'](_0x315a91,_0x57c47f);};}exports[_0xb18d('0x4')]=function(_0x328568){for(var _0x287907=0x0,_0x37a70c=events[_0xb18d('0x5')];_0x287907<_0x37a70c;_0x287907++){var _0xb15783=events[_0x287907];var _0x5b9c43=createListener(_0xb18d('0x6')+_0xb15783,_0x328568);SmsInteractionEvents['on'](_0xb15783,_0x5b9c43);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4f4c78d..2a521fb 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 _0x7509=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','tracked','sms','create','post','/:id/status','put','/:id/accept'];(function(_0x47a491,_0x45e171){var _0x3b176b=function(_0x8c826){while(--_0x8c826){_0x47a491['push'](_0x47a491['shift']());}};_0x3b176b(++_0x45e171);}(_0x7509,0xf0));var _0x9750=function(_0x3c8ca1,_0x1698b4){_0x3c8ca1=_0x3c8ca1-0x0;var _0x1be0dc=_0x7509[_0x3c8ca1];return _0x1be0dc;};'use strict';var multer=require(_0x9750('0x0'));var util=require(_0x9750('0x1'));var path=require(_0x9750('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9750('0x3'));var auth=require(_0x9750('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9750('0x5'));var controller=require(_0x9750('0x6'));router[_0x9750('0x7')]('/',auth[_0x9750('0x8')](),controller['index']);router[_0x9750('0x7')](_0x9750('0x9'),auth[_0x9750('0x8')](),controller[_0x9750('0xa')]);router[_0x9750('0x7')](_0x9750('0xb'),auth[_0x9750('0x8')](),controller[_0x9750('0xc')]);router['post']('/',auth[_0x9750('0x8')](),interaction[_0x9750('0xd')](_0x9750('0xe'),'smsmessage:create'),controller[_0x9750('0xf')]);router[_0x9750('0x10')](_0x9750('0x11'),controller['status']);router[_0x9750('0x12')](_0x9750('0xb'),auth[_0x9750('0x8')](),controller['update']);router['put'](_0x9750('0x13'),auth['isAuthenticated'](),controller[_0x9750('0x14')]);router[_0x9750('0x12')](_0x9750('0x15'),auth[_0x9750('0x8')](),controller[_0x9750('0x16')]);router[_0x9750('0x17')](_0x9750('0xb'),auth[_0x9750('0x8')](),controller[_0x9750('0x18')]);module[_0x9750('0x19')]=router; \ No newline at end of file +var _0x4a0e=['post','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create'];(function(_0x154980,_0x2710e5){var _0x55a463=function(_0x4c0389){while(--_0x4c0389){_0x154980['push'](_0x154980['shift']());}};_0x55a463(++_0x2710e5);}(_0x4a0e,0xab));var _0xe4a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4a0e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe4a0('0x0'));var util=require(_0xe4a0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe4a0('0x2'));var router=express[_0xe4a0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe4a0('0x4'));var interaction=require(_0xe4a0('0x5'));var config=require(_0xe4a0('0x6'));var controller=require('./smsMessage.controller');router[_0xe4a0('0x7')]('/',auth[_0xe4a0('0x8')](),controller[_0xe4a0('0x9')]);router['get'](_0xe4a0('0xa'),auth[_0xe4a0('0x8')](),controller[_0xe4a0('0xb')]);router[_0xe4a0('0x7')](_0xe4a0('0xc'),auth[_0xe4a0('0x8')](),controller[_0xe4a0('0xd')]);router['post']('/',auth[_0xe4a0('0x8')](),interaction[_0xe4a0('0xe')](_0xe4a0('0xf'),_0xe4a0('0x10')),controller[_0xe4a0('0x11')]);router[_0xe4a0('0x12')](_0xe4a0('0x13'),controller[_0xe4a0('0x14')]);router[_0xe4a0('0x15')](_0xe4a0('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe4a0('0x15')](_0xe4a0('0x16'),auth['isAuthenticated'](),controller[_0xe4a0('0x17')]);router[_0xe4a0('0x15')](_0xe4a0('0x18'),auth['isAuthenticated'](),controller[_0xe4a0('0x19')]);router['delete']('/:id',auth[_0xe4a0('0x8')](),controller['destroy']);module[_0xe4a0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 1b3f198..d7fb14d 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 _0xcc20=['STRING','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x481ff0,_0xa84ac1){var _0x5f3b6c=function(_0x3ec758){while(--_0x3ec758){_0x481ff0['push'](_0x481ff0['shift']());}};_0x5f3b6c(++_0xa84ac1);}(_0xcc20,0x108));var _0x0cc2=function(_0x2f3d05,_0x3564f4){_0x2f3d05=_0x2f3d05-0x0;var _0x240658=_0xcc20[_0x2f3d05];return _0x240658;};'use strict';var Sequelize=require(_0x0cc2('0x0'));module[_0x0cc2('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0cc2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0cc2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0cc2('0x4')]('in','out'),'defaultValue':_0x0cc2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0cc2('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0cc2('0x6')]},'readAt':{'type':Sequelize[_0x0cc2('0x7')]},'secret':{'type':Sequelize[_0x0cc2('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0cc2('0x8')]}}; \ No newline at end of file +var _0x52ad=['out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x1233d2,_0x5416f4){var _0x22759e=function(_0xb516aa){while(--_0xb516aa){_0x1233d2['push'](_0x1233d2['shift']());}};_0x22759e(++_0x5416f4);}(_0x52ad,0x1d8));var _0xd52a=function(_0x134ee1,_0x1b726f){_0x134ee1=_0x134ee1-0x0;var _0x391f03=_0x52ad[_0x134ee1];return _0x391f03;};'use strict';var Sequelize=require(_0xd52a('0x0'));module[_0xd52a('0x1')]={'body':{'type':Sequelize[_0xd52a('0x2')](_0xd52a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd52a('0x4')]('in',_0xd52a('0x5')),'defaultValue':_0xd52a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd52a('0x6')](0xbe)},'phone':{'type':Sequelize[_0xd52a('0x6')]},'readAt':{'type':Sequelize[_0xd52a('0x7')]},'secret':{'type':Sequelize[_0xd52a('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd52a('0x6')]},'providerResponse':{'type':Sequelize[_0xd52a('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 023d5e6..f7786e9 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 _0x9416=['keys','model','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','includeAll','findAll','params','rawAttributes','filters','length','include','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','find','SmsInteractionId','isNil','read1stAt','interaction','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','interface','SIP/%s','channel','motionChannel','event','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','EventManager','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','end','json','limit','undefined','count','offset','status','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','SmsMessage','fieldName','key','query'];(function(_0x2e9bd2,_0x3d5ae0){var _0x453345=function(_0x496818){while(--_0x496818){_0x2e9bd2['push'](_0x2e9bd2['shift']());}};_0x453345(++_0x3d5ae0);}(_0x9416,0xde));var _0x6941=function(_0x4247a4,_0x8c1a71){_0x4247a4=_0x4247a4-0x0;var _0xf62f3d=_0x9416[_0x4247a4];return _0xf62f3d;};'use strict';var emlformat=require(_0x6941('0x0'));var rimraf=require(_0x6941('0x1'));var zipdir=require(_0x6941('0x2'));var jsonpatch=require(_0x6941('0x3'));var rp=require(_0x6941('0x4'));var moment=require(_0x6941('0x5'));var BPromise=require(_0x6941('0x6'));var Mustache=require(_0x6941('0x7'));var util=require(_0x6941('0x8'));var path=require(_0x6941('0x9'));var sox=require(_0x6941('0xa'));var csv=require(_0x6941('0xb'));var ejs=require(_0x6941('0xc'));var fs=require('fs');var fs_extra=require(_0x6941('0xd'));var _=require(_0x6941('0xe'));var squel=require(_0x6941('0xf'));var crypto=require(_0x6941('0x10'));var jsforce=require(_0x6941('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x6941('0xb'));var querystring=require(_0x6941('0x12'));var Papa=require(_0x6941('0x13'));var Redis=require(_0x6941('0x14'));var authService=require(_0x6941('0x15'));var qs=require(_0x6941('0x16'));var as=require(_0x6941('0x17'));var hardwareService=require(_0x6941('0x18'));var logger=require(_0x6941('0x19'))('api');var utils=require(_0x6941('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6941('0x1b')]=_[_0x6941('0x1c')](config[_0x6941('0x1b')],{'host':_0x6941('0x1d'),'port':0x18eb});var socket=require(_0x6941('0x1e'))(new Redis(config[_0x6941('0x1b')]));require(_0x6941('0x1f'))[_0x6941('0x20')](socket);var jayson=require(_0x6941('0x21'));var client=jayson[_0x6941('0x22')][_0x6941('0x23')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37bc45,_0x116e04,_0x20ec9c,_0x3cb288){return new BPromise(function(_0x9d5c38,_0x41f8d0){var _0xf9784e=_0x3cb288||client;return _0xf9784e['request'](_0x37bc45,_0x20ec9c)[_0x6941('0x24')](function(_0x159985){logger[_0x6941('0x25')](_0x6941('0x26'),_0x116e04,'request\x20sent');logger[_0x6941('0x27')](_0x6941('0x28'),_0x116e04,_0x6941('0x29'),JSON[_0x6941('0x2a')](_0x159985));if(_0x159985[_0x6941('0x2b')]){if(_0x159985[_0x6941('0x2b')]['code']===0x1f4){logger[_0x6941('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x116e04,_0x159985['error'][_0x6941('0x2c')]);return _0x41f8d0(_0x159985[_0x6941('0x2b')]['message']);}logger[_0x6941('0x2b')](_0x6941('0x26'),_0x116e04,_0x159985['error']['message']);return _0x9d5c38(_0x159985[_0x6941('0x2b')]['message']);}else{logger[_0x6941('0x25')](_0x6941('0x26'),_0x116e04,_0x6941('0x29'));_0x9d5c38(_0x159985[_0x6941('0x2d')][_0x6941('0x2c')]);}})[_0x6941('0x2e')](function(_0x1370f4){logger['error'](_0x6941('0x26'),_0x116e04,_0x1370f4);_0x41f8d0(_0x1370f4);});});}function respondWithStatusCode(_0xf66a50,_0x352a3f){_0x352a3f=_0x352a3f||0xcc;return function(_0x3750f5){if(_0x3750f5){return _0xf66a50['sendStatus'](_0x352a3f);}return _0xf66a50['status'](_0x352a3f)[_0x6941('0x2f')]();};}function respondWithResult(_0x4727c0,_0x11a85a){_0x11a85a=_0x11a85a||0xc8;return function(_0x3059bc){if(_0x3059bc){return _0x4727c0['status'](_0x11a85a)[_0x6941('0x30')](_0x3059bc);}};}function respondWithFilteredResult(_0xfa39c4,_0x2895d6){return function(_0x60e67){if(_0x60e67){var _0x5a1a15=typeof _0x2895d6['offset']==='undefined'&&typeof _0x2895d6[_0x6941('0x31')]===_0x6941('0x32');var _0x43e88a=_0x60e67[_0x6941('0x33')];var _0x4780b5=_0x5a1a15?0x0:_0x2895d6[_0x6941('0x34')];var _0x46a14d=_0x5a1a15?_0x60e67[_0x6941('0x33')]:_0x2895d6[_0x6941('0x34')]+_0x2895d6['limit'];var _0x18ed8c;if(_0x46a14d>=_0x43e88a){_0x46a14d=_0x43e88a;_0x18ed8c=0xc8;}else{_0x18ed8c=0xce;}_0xfa39c4[_0x6941('0x35')](_0x18ed8c);return _0xfa39c4[_0x6941('0x36')]('Content-Range',_0x4780b5+'-'+_0x46a14d+'/'+_0x43e88a)[_0x6941('0x30')](_0x60e67);}return null;};}function patchUpdates(_0xa1abfc){return function(_0x2685ea){try{jsonpatch[_0x6941('0x37')](_0x2685ea,_0xa1abfc,!![]);}catch(_0x1b1fd9){return BPromise[_0x6941('0x38')](_0x1b1fd9);}return _0x2685ea[_0x6941('0x39')]();};}function saveUpdates(_0x3b4c55,_0x2badf4){return function(_0x107e04){if(_0x107e04){return _0x107e04[_0x6941('0x3a')](_0x3b4c55)[_0x6941('0x24')](function(_0x2890bc){return _0x2890bc;});}return null;};}function removeEntity(_0x264300,_0x4fd3f3){return function(_0xb8f9e4){if(_0xb8f9e4){return _0xb8f9e4[_0x6941('0x3b')]()[_0x6941('0x24')](function(){_0x264300[_0x6941('0x35')](0xcc)[_0x6941('0x2f')]();});}};}function handleEntityNotFound(_0x2be2b1,_0x4b61ba){return function(_0x5ebcc5){if(!_0x5ebcc5){_0x2be2b1[_0x6941('0x3c')](0x194);}return _0x5ebcc5;};}function handleError(_0x22d56b,_0xfb2918){_0xfb2918=_0xfb2918||0x1f4;return function(_0x69e137){logger[_0x6941('0x2b')](_0x69e137[_0x6941('0x3d')]);if(_0x69e137[_0x6941('0x3e')]){delete _0x69e137[_0x6941('0x3e')];}_0x22d56b[_0x6941('0x35')](_0xfb2918)[_0x6941('0x3f')](_0x69e137);};}exports[_0x6941('0x40')]=function(_0x131c74,_0x1d029a){var _0x4dceab={},_0xd4eb6a={},_0x5dc128={'count':0x0,'rows':[]};var _0x1e6827=_[_0x6941('0x41')](db[_0x6941('0x42')]['rawAttributes'],function(_0x39d859){return{'name':_0x39d859[_0x6941('0x43')],'type':_0x39d859['type'][_0x6941('0x44')]};});_0xd4eb6a['model']=_['map'](_0x1e6827,'name');_0xd4eb6a[_0x6941('0x45')]=_[_0x6941('0x46')](_0x131c74[_0x6941('0x45')]);_0xd4eb6a['filters']=_['intersection'](_0xd4eb6a[_0x6941('0x47')],_0xd4eb6a[_0x6941('0x45')]);_0x4dceab['attributes']=_[_0x6941('0x48')](_0xd4eb6a[_0x6941('0x47')],qs[_0x6941('0x49')](_0x131c74['query'][_0x6941('0x49')]));_0x4dceab['attributes']=_0x4dceab[_0x6941('0x4a')]['length']?_0x4dceab[_0x6941('0x4a')]:_0xd4eb6a[_0x6941('0x47')];if(!_0x131c74[_0x6941('0x45')]['hasOwnProperty'](_0x6941('0x4b'))){_0x4dceab['limit']=qs['limit'](_0x131c74[_0x6941('0x45')]['limit']);_0x4dceab['offset']=qs[_0x6941('0x34')](_0x131c74[_0x6941('0x45')][_0x6941('0x34')]);}_0x4dceab[_0x6941('0x4c')]=qs['sort'](_0x131c74[_0x6941('0x45')][_0x6941('0x4d')]);_0x4dceab[_0x6941('0x4e')]=qs['filters'](_[_0x6941('0x4f')](_0x131c74['query'],_0xd4eb6a['filters']),_0x1e6827);if(_0x131c74[_0x6941('0x45')][_0x6941('0x50')]){_0x4dceab[_0x6941('0x4e')]=_[_0x6941('0x51')](_0x4dceab[_0x6941('0x4e')],{'$or':_['map'](_0x1e6827,function(_0x1e86b1){if(_0x1e86b1[_0x6941('0x52')]!=='VIRTUAL'){var _0x4c79a5={};_0x4c79a5[_0x1e86b1[_0x6941('0x3e')]]={'$like':'%'+_0x131c74[_0x6941('0x45')][_0x6941('0x50')]+'%'};return _0x4c79a5;}})});}_0x4dceab=_[_0x6941('0x51')]({},_0x4dceab,_0x131c74['options']);var _0x3fe693={'where':_0x4dceab[_0x6941('0x4e')]};return db[_0x6941('0x42')][_0x6941('0x33')](_0x3fe693)['then'](function(_0x1beb1e){_0x5dc128['count']=_0x1beb1e;if(_0x131c74[_0x6941('0x45')][_0x6941('0x53')]){_0x4dceab['include']=[{'all':!![]}];}return db[_0x6941('0x42')][_0x6941('0x54')](_0x4dceab);})[_0x6941('0x24')](function(_0x3b8394){_0x5dc128['rows']=_0x3b8394;return _0x5dc128;})[_0x6941('0x24')](respondWithFilteredResult(_0x1d029a,_0x4dceab))[_0x6941('0x2e')](handleError(_0x1d029a,null));};exports['show']=function(_0x982db8,_0x4cfc7e){var _0x530547={'raw':!![],'where':{'id':_0x982db8[_0x6941('0x55')]['id']}},_0x3526ec={};_0x3526ec[_0x6941('0x47')]=_[_0x6941('0x46')](db[_0x6941('0x42')][_0x6941('0x56')]);_0x3526ec['query']=_[_0x6941('0x46')](_0x982db8[_0x6941('0x45')]);_0x3526ec[_0x6941('0x57')]=_[_0x6941('0x48')](_0x3526ec[_0x6941('0x47')],_0x3526ec[_0x6941('0x45')]);_0x530547[_0x6941('0x4a')]=_[_0x6941('0x48')](_0x3526ec['model'],qs[_0x6941('0x49')](_0x982db8[_0x6941('0x45')][_0x6941('0x49')]));_0x530547['attributes']=_0x530547[_0x6941('0x4a')][_0x6941('0x58')]?_0x530547['attributes']:_0x3526ec[_0x6941('0x47')];if(_0x982db8[_0x6941('0x45')][_0x6941('0x53')]){_0x530547[_0x6941('0x59')]=[{'all':!![]}];}_0x530547=_[_0x6941('0x51')]({},_0x530547,_0x982db8['options']);return db[_0x6941('0x42')]['find'](_0x530547)[_0x6941('0x24')](handleEntityNotFound(_0x4cfc7e,null))[_0x6941('0x24')](respondWithResult(_0x4cfc7e,null))[_0x6941('0x2e')](handleError(_0x4cfc7e,null));};exports['create']=function(_0xf3c198,_0x4f33dc){return db[_0x6941('0x42')]['create'](_0xf3c198[_0x6941('0x5a')],{})[_0x6941('0x24')](respondWithResult(_0x4f33dc,0xc9))['catch'](handleError(_0x4f33dc,null));};exports[_0x6941('0x3a')]=function(_0x2fd495,_0x406aa1){if(_0x2fd495[_0x6941('0x5a')]['id']){delete _0x2fd495[_0x6941('0x5a')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x2fd495[_0x6941('0x55')]['id']}})['then'](handleEntityNotFound(_0x406aa1,null))[_0x6941('0x24')](saveUpdates(_0x2fd495[_0x6941('0x5a')],null))[_0x6941('0x24')](respondWithResult(_0x406aa1,null))[_0x6941('0x2e')](handleError(_0x406aa1,null));};exports['destroy']=function(_0x211126,_0x2cb62c){return db[_0x6941('0x42')]['find']({'where':{'id':_0x211126[_0x6941('0x55')]['id']}})[_0x6941('0x24')](handleEntityNotFound(_0x2cb62c,null))[_0x6941('0x24')](removeEntity(_0x2cb62c,null))['catch'](handleError(_0x2cb62c,null));};exports[_0x6941('0x5b')]=function(_0x31a9a0,_0x1e7fec){return db['SmsMessage'][_0x6941('0x5b')]()['then'](respondWithResult(_0x1e7fec,null))['catch'](handleError(_0x1e7fec,null));};var interaction_log=require(_0x6941('0x19'))(_0x6941('0x5c'));exports[_0x6941('0x5d')]=function(_0x1822b8,_0x30b6ad,_0x2348a9){var _0x1eea76={'agent':{},'channel':_0x6941('0x5e')};if(_0x1822b8['body']['id']){delete _0x1822b8[_0x6941('0x5a')]['id'];}_0x1822b8[_0x6941('0x5a')][_0x6941('0x5f')]=!![];_0x1822b8[_0x6941('0x5a')][_0x6941('0x60')]=moment()[_0x6941('0x61')](_0x6941('0x62'));_0x1822b8[_0x6941('0x5a')]['UserId']=_0x1822b8['body'][_0x6941('0x63')]||_0x1822b8[_0x6941('0x64')]['id'];_0x1eea76[_0x6941('0x65')]['id']=_0x1822b8[_0x6941('0x5a')]['UserId'];return db[_0x6941('0x42')]['find']({'where':{'id':_0x1822b8[_0x6941('0x55')]['id'],'UserId':null}})[_0x6941('0x24')](handleEntityNotFound(_0x30b6ad,null))[_0x6941('0x24')](saveUpdates(_0x1822b8[_0x6941('0x5a')],null))['then'](function(_0xd0088){if(_0xd0088){_0x1eea76[_0x6941('0x2c')]=_0xd0088[_0x6941('0x66')]({'plain':!![]});return db[_0x6941('0x67')][_0x6941('0x68')]({'where':{'id':_0xd0088[_0x6941('0x69')]}});}return null;})[_0x6941('0x24')](handleEntityNotFound(_0x30b6ad,null))[_0x6941('0x24')](function(_0xc81afb){if(_0xc81afb){return _0xc81afb['update']({'UserId':_0x1822b8[_0x6941('0x5a')][_0x6941('0x63')],'read1stAt':_[_0x6941('0x6a')](_0xc81afb[_0x6941('0x6b')])?moment()[_0x6941('0x61')](_0x6941('0x62')):undefined});}return null;})[_0x6941('0x24')](function(_0x51e89d){if(_0x51e89d){_0x1eea76[_0x6941('0x6c')]=_0x51e89d[_0x6941('0x66')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1822b8[_0x6941('0x64')]['id'],_0x1822b8['user'][_0x6941('0x3e')],_0x1822b8['user'][_0x6941('0x6d')],_0x1eea76[_0x6941('0x6c')]['id'],_0x1822b8[_0x6941('0x5a')]?JSON[_0x6941('0x2a')](_0x1822b8[_0x6941('0x5a')]):_0x6941('0x6e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x1eea76);}return null;})[_0x6941('0x24')](function(_0x3a674d){var _0x483c5d=_0x6941('0x6f')+_0x3a674d['message'][_0x6941('0x70')];return db[_0x6941('0x71')]['query'](_0x483c5d,{'type':db[_0x6941('0x72')][_0x6941('0x73')]['SELECT'],'raw':!![]})[_0x6941('0x24')](function(_0x409a81){return _0x409a81;});})['then'](function(_0x185977){if(_0x185977){_0x1eea76[_0x6941('0x2c')][_0x6941('0x74')]=_0x185977[0x0];if(!_0x1822b8[_0x6941('0x5a')][_0x6941('0x63')])return;return db[_0x6941('0x75')][_0x6941('0x68')]({'where':{'id':_0x1822b8[_0x6941('0x5a')][_0x6941('0x63')],'role':_0x6941('0x65')},'attributes':['id','name',_0x6941('0x76'),_0x6941('0x77'),'internal'],'raw':!![]});}return null;})[_0x6941('0x24')](function(_0x346714){if(!_0x346714)return null;_0x1eea76['message'][_0x6941('0x65')]=_0x346714;return _0x1eea76;})[_0x6941('0x24')](function(_0x360203){if(_0x360203){if(_0x1822b8[_0x6941('0x5a')]['manual']){_0x1eea76[_0x6941('0x2c')][_0x6941('0x78')]=util['format'](_0x6941('0x79'),_0x1822b8[_0x6941('0x64')]['name']);_0x1eea76['message'][_0x6941('0x7a')]=_0x1eea76[_0x6941('0x7a')];_0x1eea76[_0x6941('0x2c')][_0x6941('0x7b')]=_0x1eea76[_0x6941('0x7a')];_0x1eea76[_0x6941('0x2c')][_0x6941('0x7c')]=_0x6941('0x5d');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x6941('0x7d'),'message':_0x1eea76['message']},client9002)['then'](function(){return _0x1eea76;});}return _0x1eea76;}return null;})['then'](respondWithResult(_0x30b6ad,null))[_0x6941('0x2e')](handleError(_0x30b6ad,null));};var interaction_log=require(_0x6941('0x19'))(_0x6941('0x5c'));exports['reject']=function(_0x532513,_0x364f49,_0x304d43){var _0x13b3e4={'agent':{},'channel':'sms'};if(_0x532513['body']['id']){delete _0x532513[_0x6941('0x5a')]['id'];}_0x532513[_0x6941('0x5a')][_0x6941('0x63')]=_0x532513['body'][_0x6941('0x63')]||_0x532513[_0x6941('0x64')]['id'];_0x13b3e4[_0x6941('0x65')]['id']=_0x532513[_0x6941('0x5a')][_0x6941('0x63')];return db[_0x6941('0x42')][_0x6941('0x68')]({'where':{'id':_0x532513[_0x6941('0x55')]['id'],'UserId':null}})[_0x6941('0x24')](handleEntityNotFound(_0x364f49,null))[_0x6941('0x24')](function(_0x37ea6b){if(_0x37ea6b){_0x13b3e4[_0x6941('0x2c')]=_0x37ea6b[_0x6941('0x66')]({'plain':!![]});return db[_0x6941('0x67')][_0x6941('0x68')]({'where':{'id':_0x37ea6b[_0x6941('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x364f49,null))[_0x6941('0x24')](function(_0x417ed2){if(_0x417ed2){_0x13b3e4['interaction']=_0x417ed2[_0x6941('0x66')]({'plain':!![]});interaction_log[_0x6941('0x25')](_0x6941('0x7e'),_0x532513[_0x6941('0x64')]['id'],_0x532513['user'][_0x6941('0x3e')],_0x532513['user'][_0x6941('0x6d')],_0x13b3e4[_0x6941('0x6c')]['id'],_0x532513[_0x6941('0x5a')]?JSON[_0x6941('0x2a')](_0x532513[_0x6941('0x5a')]):_0x6941('0x6e'));return respondWithRpcPromise(_0x6941('0x7f'),_0x6941('0x80'),_0x13b3e4);}return null;})[_0x6941('0x24')](function(_0x27c73f){var _0x535b01=_0x6941('0x6f')+_0x27c73f[_0x6941('0x2c')]['ContactId'];return db[_0x6941('0x71')][_0x6941('0x45')](_0x535b01,{'type':db[_0x6941('0x72')][_0x6941('0x73')][_0x6941('0x81')],'raw':!![]})[_0x6941('0x24')](function(_0x5f07f7){return _0x5f07f7;});})[_0x6941('0x24')](function(_0xf07f21){if(_0xf07f21){_0x13b3e4[_0x6941('0x2c')][_0x6941('0x74')]=_0xf07f21[0x0];if(!_0x532513['body'][_0x6941('0x63')])return;return db['User']['find']({'where':{'id':_0x532513['body']['UserId'],'role':'agent'},'attributes':['id',_0x6941('0x3e'),_0x6941('0x76'),'email','internal'],'raw':!![]});}return null;})[_0x6941('0x24')](function(_0x1f3a50){if(!_0x1f3a50)return null;_0x13b3e4[_0x6941('0x2c')][_0x6941('0x65')]=_0x1f3a50;return _0x13b3e4;})['then'](function(_0xa3f093){if(_0xa3f093){_0xa3f093[_0x6941('0x2c')][_0x6941('0x78')]=util[_0x6941('0x61')](_0x6941('0x79'),_0x532513[_0x6941('0x64')][_0x6941('0x3e')]);_0xa3f093[_0x6941('0x2c')]['channel']=_0x13b3e4[_0x6941('0x7a')];_0xa3f093[_0x6941('0x2c')][_0x6941('0x7b')]=_0x13b3e4[_0x6941('0x7a')];_0xa3f093['message'][_0x6941('0x7c')]=_0x6941('0x38');respondWithRpcPromise(_0x6941('0x82'),_0x6941('0x82'),{'event':_0x6941('0x83'),'message':_0xa3f093['message']},client9002);return _0x13b3e4;}return null;})[_0x6941('0x24')](respondWithResult(_0x364f49,null))[_0x6941('0x2e')](handleError(_0x364f49,null));};exports[_0x6941('0x35')]=function(_0x39a7a7,_0xd45c25,_0x4cd687){if(_0x39a7a7[_0x6941('0x5a')]['id']){delete _0x39a7a7[_0x6941('0x5a')]['id'];}var _0xeece2b;return db[_0x6941('0x42')][_0x6941('0x68')]({'where':{'id':_0x39a7a7[_0x6941('0x55')]['id']}})['then'](handleEntityNotFound(_0xd45c25,null))[_0x6941('0x24')](function(_0x44d92e){if(_0x44d92e){_0xeece2b=_0x44d92e;return db['SmsAccount'][_0x6941('0x68')]({'where':{'id':_0x44d92e[_0x6941('0x84')]}});}})[_0x6941('0x24')](handleEntityNotFound(_0xd45c25,null))[_0x6941('0x24')](function(_0x4de038){if(_0x4de038){logger[_0x6941('0x27')](_0x6941('0x28'),_0x6941('0x35'),'received\x20delivery\x20report\x20from',_0x4de038[_0x6941('0x52')],util[_0x6941('0x85')](_0x39a7a7['body'],{'showHidden':![],'depth':null}));switch(_0x4de038[_0x6941('0x52')]){case _0x6941('0x86'):if(_0x39a7a7['body']['MessageSid']&&_0x39a7a7[_0x6941('0x5a')][_0x6941('0x87')]===_0xeece2b[_0x6941('0x88')]){return _0xeece2b['update']({'read':!![]});}else{logger['error'](_0x6941('0x89'),_0x6941('0x35'),_0x6941('0x86'),util[_0x6941('0x85')](_0x39a7a7[_0x6941('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6941('0x8a'):if(_0x39a7a7['body'][_0x6941('0x8b')]&&_0x39a7a7[_0x6941('0x5a')][_0x6941('0x8b')]===_0xeece2b[_0x6941('0x88')]&&_[_0x6941('0x8c')]([_0x6941('0x8d'),'delivered'],_0x39a7a7[_0x6941('0x5a')]['Status'])>=0x0){return _0xeece2b[_0x6941('0x3a')]({'read':!![]});}else{logger['error'](_0x6941('0x89'),'status','plivio',util['inspect'](_0x39a7a7[_0x6941('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6941('0x8e'):var _0x2c57b7=_0x39a7a7[_0x6941('0x5a')][_0x6941('0x8f')][0x0];if(_0x2c57b7[_0x6941('0x35')][_0x6941('0x90')]===_0x6941('0x91')){return _0xeece2b[_0x6941('0x3a')]({'read':!![]});}else{logger[_0x6941('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x6941('0x8e'),util[_0x6941('0x85')](_0x39a7a7[_0x6941('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0xeece2b;}})[_0x6941('0x24')](respondWithResult(_0xd45c25,null))['catch'](handleError(_0xd45c25,null));}; \ No newline at end of file +var _0xa742=['create','body','destroy','describe','../../config/logger','sms-interactions','accept','readAt','format','UserId','user','get','SmsInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','manual','interface','channel','event','EventManager','acceptmessage','sms','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','internal','SIP/%s','motionChannel','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','MessageUUID','indexOf','sent','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','DELIVERED','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','SmsMessage','includeAll','include','rows','catch','params','rawAttributes','find'];(function(_0x1487f4,_0x1c2765){var _0x2a98d9=function(_0x143bbe){while(--_0x143bbe){_0x1487f4['push'](_0x1487f4['shift']());}};_0x2a98d9(++_0x1c2765);}(_0xa742,0xc7));var _0x2a74=function(_0x556d13,_0x48317d){_0x556d13=_0x556d13-0x0;var _0x311eff=_0xa742[_0x556d13];return _0x311eff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2a74('0x0'));var rp=require(_0x2a74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2a74('0x2'));var util=require('util');var path=require(_0x2a74('0x3'));var sox=require(_0x2a74('0x4'));var csv=require(_0x2a74('0x5'));var ejs=require(_0x2a74('0x6'));var fs=require('fs');var fs_extra=require(_0x2a74('0x7'));var _=require(_0x2a74('0x8'));var squel=require(_0x2a74('0x9'));var crypto=require(_0x2a74('0xa'));var jsforce=require(_0x2a74('0xb'));var deskjs=require(_0x2a74('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2a74('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2a74('0xe'));var qs=require(_0x2a74('0xf'));var as=require(_0x2a74('0x10'));var hardwareService=require(_0x2a74('0x11'));var logger=require('../../config/logger')(_0x2a74('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2a74('0x13')]=_['defaults'](config['redis'],{'host':_0x2a74('0x14'),'port':0x18eb});var socket=require(_0x2a74('0x15'))(new Redis(config[_0x2a74('0x13')]));require(_0x2a74('0x16'))[_0x2a74('0x17')](socket);var jayson=require(_0x2a74('0x18'));var client=jayson[_0x2a74('0x19')][_0x2a74('0x1a')]({'port':0x232c});var client9002=jayson[_0x2a74('0x19')][_0x2a74('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x39788d,_0x27a446,_0x396fd0,_0x57004c){return new BPromise(function(_0x1f9fd6,_0x5760d6){var _0x695e54=_0x57004c||client;return _0x695e54[_0x2a74('0x1b')](_0x39788d,_0x396fd0)[_0x2a74('0x1c')](function(_0x115064){logger[_0x2a74('0x1d')](_0x2a74('0x1e'),_0x27a446,_0x2a74('0x1f'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27a446,_0x2a74('0x1f'),JSON['stringify'](_0x115064));if(_0x115064[_0x2a74('0x20')]){if(_0x115064[_0x2a74('0x20')][_0x2a74('0x21')]===0x1f4){logger[_0x2a74('0x20')](_0x2a74('0x1e'),_0x27a446,_0x115064[_0x2a74('0x20')][_0x2a74('0x22')]);return _0x5760d6(_0x115064[_0x2a74('0x20')][_0x2a74('0x22')]);}logger[_0x2a74('0x20')]('SmsMessage,\x20%s,\x20%s',_0x27a446,_0x115064['error'][_0x2a74('0x22')]);return _0x1f9fd6(_0x115064[_0x2a74('0x20')][_0x2a74('0x22')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x27a446,_0x2a74('0x1f'));_0x1f9fd6(_0x115064[_0x2a74('0x23')][_0x2a74('0x22')]);}})['catch'](function(_0xd4201){logger[_0x2a74('0x20')](_0x2a74('0x1e'),_0x27a446,_0xd4201);_0x5760d6(_0xd4201);});});}function respondWithStatusCode(_0x151b26,_0x2149e9){_0x2149e9=_0x2149e9||0xcc;return function(_0x49d068){if(_0x49d068){return _0x151b26['sendStatus'](_0x2149e9);}return _0x151b26[_0x2a74('0x24')](_0x2149e9)[_0x2a74('0x25')]();};}function respondWithResult(_0x4c04b1,_0x156b12){_0x156b12=_0x156b12||0xc8;return function(_0x86e836){if(_0x86e836){return _0x4c04b1[_0x2a74('0x24')](_0x156b12)[_0x2a74('0x26')](_0x86e836);}};}function respondWithFilteredResult(_0x59fbcf,_0x221179){return function(_0x191e15){if(_0x191e15){var _0x3087eb=typeof _0x221179[_0x2a74('0x27')]===_0x2a74('0x28')&&typeof _0x221179[_0x2a74('0x29')]===_0x2a74('0x28');var _0xf78e97=_0x191e15[_0x2a74('0x2a')];var _0x34d08e=_0x3087eb?0x0:_0x221179['offset'];var _0x772f30=_0x3087eb?_0x191e15[_0x2a74('0x2a')]:_0x221179[_0x2a74('0x27')]+_0x221179[_0x2a74('0x29')];var _0x5d3877;if(_0x772f30>=_0xf78e97){_0x772f30=_0xf78e97;_0x5d3877=0xc8;}else{_0x5d3877=0xce;}_0x59fbcf['status'](_0x5d3877);return _0x59fbcf[_0x2a74('0x2b')]('Content-Range',_0x34d08e+'-'+_0x772f30+'/'+_0xf78e97)[_0x2a74('0x26')](_0x191e15);}return null;};}function patchUpdates(_0x5ca94d){return function(_0x17c7ff){try{jsonpatch[_0x2a74('0x2c')](_0x17c7ff,_0x5ca94d,!![]);}catch(_0x5bbe7f){return BPromise[_0x2a74('0x2d')](_0x5bbe7f);}return _0x17c7ff[_0x2a74('0x2e')]();};}function saveUpdates(_0x228d1b,_0x4a8856){return function(_0xd2e0c9){if(_0xd2e0c9){return _0xd2e0c9[_0x2a74('0x2f')](_0x228d1b)[_0x2a74('0x1c')](function(_0x2ad323){return _0x2ad323;});}return null;};}function removeEntity(_0x5d0e24,_0x58b33f){return function(_0x257a49){if(_0x257a49){return _0x257a49['destroy']()[_0x2a74('0x1c')](function(){_0x5d0e24['status'](0xcc)[_0x2a74('0x25')]();});}};}function handleEntityNotFound(_0x200f9,_0x36d3ce){return function(_0x455f85){if(!_0x455f85){_0x200f9[_0x2a74('0x30')](0x194);}return _0x455f85;};}function handleError(_0x3e70c8,_0x3d8612){_0x3d8612=_0x3d8612||0x1f4;return function(_0x5e3d7e){logger[_0x2a74('0x20')](_0x5e3d7e[_0x2a74('0x31')]);if(_0x5e3d7e[_0x2a74('0x32')]){delete _0x5e3d7e['name'];}_0x3e70c8[_0x2a74('0x24')](_0x3d8612)[_0x2a74('0x33')](_0x5e3d7e);};}exports[_0x2a74('0x34')]=function(_0x522df6,_0x47c41f){var _0x2cef59={},_0x3fd012={},_0x5cb0a2={'count':0x0,'rows':[]};var _0x5f0faf=_[_0x2a74('0x35')](db['SmsMessage']['rawAttributes'],function(_0x3ef60a){return{'name':_0x3ef60a[_0x2a74('0x36')],'type':_0x3ef60a[_0x2a74('0x37')][_0x2a74('0x38')]};});_0x3fd012[_0x2a74('0x39')]=_['map'](_0x5f0faf,_0x2a74('0x32'));_0x3fd012[_0x2a74('0x3a')]=_[_0x2a74('0x3b')](_0x522df6[_0x2a74('0x3a')]);_0x3fd012['filters']=_[_0x2a74('0x3c')](_0x3fd012[_0x2a74('0x39')],_0x3fd012['query']);_0x2cef59[_0x2a74('0x3d')]=_[_0x2a74('0x3c')](_0x3fd012[_0x2a74('0x39')],qs['fields'](_0x522df6[_0x2a74('0x3a')][_0x2a74('0x3e')]));_0x2cef59[_0x2a74('0x3d')]=_0x2cef59[_0x2a74('0x3d')][_0x2a74('0x3f')]?_0x2cef59['attributes']:_0x3fd012['model'];if(!_0x522df6['query'][_0x2a74('0x40')](_0x2a74('0x41'))){_0x2cef59[_0x2a74('0x29')]=qs[_0x2a74('0x29')](_0x522df6[_0x2a74('0x3a')][_0x2a74('0x29')]);_0x2cef59[_0x2a74('0x27')]=qs[_0x2a74('0x27')](_0x522df6['query'][_0x2a74('0x27')]);}_0x2cef59[_0x2a74('0x42')]=qs['sort'](_0x522df6['query'][_0x2a74('0x43')]);_0x2cef59[_0x2a74('0x44')]=qs[_0x2a74('0x45')](_['pick'](_0x522df6['query'],_0x3fd012['filters']),_0x5f0faf);if(_0x522df6[_0x2a74('0x3a')]['filter']){_0x2cef59[_0x2a74('0x44')]=_[_0x2a74('0x46')](_0x2cef59[_0x2a74('0x44')],{'$or':_['map'](_0x5f0faf,function(_0x346f0d){if(_0x346f0d['type']!==_0x2a74('0x47')){var _0x5d69b7={};_0x5d69b7[_0x346f0d['name']]={'$like':'%'+_0x522df6['query']['filter']+'%'};return _0x5d69b7;}})});}_0x2cef59=_[_0x2a74('0x46')]({},_0x2cef59,_0x522df6[_0x2a74('0x48')]);var _0x110636={'where':_0x2cef59[_0x2a74('0x44')]};return db[_0x2a74('0x49')][_0x2a74('0x2a')](_0x110636)['then'](function(_0x3fb3a9){_0x5cb0a2['count']=_0x3fb3a9;if(_0x522df6[_0x2a74('0x3a')][_0x2a74('0x4a')]){_0x2cef59[_0x2a74('0x4b')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x2cef59);})['then'](function(_0x33412f){_0x5cb0a2[_0x2a74('0x4c')]=_0x33412f;return _0x5cb0a2;})[_0x2a74('0x1c')](respondWithFilteredResult(_0x47c41f,_0x2cef59))[_0x2a74('0x4d')](handleError(_0x47c41f,null));};exports['show']=function(_0xb0c50e,_0x577196){var _0x180bc6={'raw':!![],'where':{'id':_0xb0c50e[_0x2a74('0x4e')]['id']}},_0x164297={};_0x164297[_0x2a74('0x39')]=_['keys'](db[_0x2a74('0x49')][_0x2a74('0x4f')]);_0x164297[_0x2a74('0x3a')]=_['keys'](_0xb0c50e[_0x2a74('0x3a')]);_0x164297[_0x2a74('0x45')]=_[_0x2a74('0x3c')](_0x164297[_0x2a74('0x39')],_0x164297[_0x2a74('0x3a')]);_0x180bc6[_0x2a74('0x3d')]=_[_0x2a74('0x3c')](_0x164297['model'],qs[_0x2a74('0x3e')](_0xb0c50e[_0x2a74('0x3a')][_0x2a74('0x3e')]));_0x180bc6['attributes']=_0x180bc6[_0x2a74('0x3d')][_0x2a74('0x3f')]?_0x180bc6['attributes']:_0x164297[_0x2a74('0x39')];if(_0xb0c50e[_0x2a74('0x3a')][_0x2a74('0x4a')]){_0x180bc6['include']=[{'all':!![]}];}_0x180bc6=_[_0x2a74('0x46')]({},_0x180bc6,_0xb0c50e['options']);return db[_0x2a74('0x49')][_0x2a74('0x50')](_0x180bc6)[_0x2a74('0x1c')](handleEntityNotFound(_0x577196,null))[_0x2a74('0x1c')](respondWithResult(_0x577196,null))[_0x2a74('0x4d')](handleError(_0x577196,null));};exports['create']=function(_0x3dea41,_0xbc11c2){return db[_0x2a74('0x49')][_0x2a74('0x51')](_0x3dea41['body'],{})[_0x2a74('0x1c')](respondWithResult(_0xbc11c2,0xc9))['catch'](handleError(_0xbc11c2,null));};exports[_0x2a74('0x2f')]=function(_0x4c724e,_0x3db512){if(_0x4c724e[_0x2a74('0x52')]['id']){delete _0x4c724e[_0x2a74('0x52')]['id'];}return db['SmsMessage'][_0x2a74('0x50')]({'where':{'id':_0x4c724e[_0x2a74('0x4e')]['id']}})[_0x2a74('0x1c')](handleEntityNotFound(_0x3db512,null))[_0x2a74('0x1c')](saveUpdates(_0x4c724e[_0x2a74('0x52')],null))[_0x2a74('0x1c')](respondWithResult(_0x3db512,null))[_0x2a74('0x4d')](handleError(_0x3db512,null));};exports[_0x2a74('0x53')]=function(_0x257b89,_0x16fd6e){return db['SmsMessage'][_0x2a74('0x50')]({'where':{'id':_0x257b89[_0x2a74('0x4e')]['id']}})[_0x2a74('0x1c')](handleEntityNotFound(_0x16fd6e,null))[_0x2a74('0x1c')](removeEntity(_0x16fd6e,null))[_0x2a74('0x4d')](handleError(_0x16fd6e,null));};exports['describe']=function(_0x260e4d,_0x4b0c2e){return db[_0x2a74('0x49')][_0x2a74('0x54')]()[_0x2a74('0x1c')](respondWithResult(_0x4b0c2e,null))[_0x2a74('0x4d')](handleError(_0x4b0c2e,null));};var interaction_log=require(_0x2a74('0x55'))(_0x2a74('0x56'));exports[_0x2a74('0x57')]=function(_0x34e586,_0x2d2ac8,_0x4d5fd3){var _0x146540={'agent':{},'channel':'sms'};if(_0x34e586[_0x2a74('0x52')]['id']){delete _0x34e586[_0x2a74('0x52')]['id'];}_0x34e586[_0x2a74('0x52')]['read']=!![];_0x34e586[_0x2a74('0x52')][_0x2a74('0x58')]=moment()[_0x2a74('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x34e586[_0x2a74('0x52')][_0x2a74('0x5a')]=_0x34e586[_0x2a74('0x52')][_0x2a74('0x5a')]||_0x34e586[_0x2a74('0x5b')]['id'];_0x146540['agent']['id']=_0x34e586[_0x2a74('0x52')][_0x2a74('0x5a')];return db['SmsMessage']['find']({'where':{'id':_0x34e586[_0x2a74('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d2ac8,null))['then'](saveUpdates(_0x34e586['body'],null))[_0x2a74('0x1c')](function(_0x3b3f6d){if(_0x3b3f6d){_0x146540[_0x2a74('0x22')]=_0x3b3f6d[_0x2a74('0x5c')]({'plain':!![]});return db[_0x2a74('0x5d')][_0x2a74('0x50')]({'where':{'id':_0x3b3f6d['SmsInteractionId']}});}return null;})[_0x2a74('0x1c')](handleEntityNotFound(_0x2d2ac8,null))[_0x2a74('0x1c')](function(_0x390812){if(_0x390812){return _0x390812[_0x2a74('0x2f')]({'UserId':_0x34e586[_0x2a74('0x52')][_0x2a74('0x5a')],'read1stAt':_[_0x2a74('0x5e')](_0x390812['read1stAt'])?moment()[_0x2a74('0x59')](_0x2a74('0x5f')):undefined});}return null;})[_0x2a74('0x1c')](function(_0x28baf3){if(_0x28baf3){_0x146540['interaction']=_0x28baf3[_0x2a74('0x5c')]({'plain':!![]});interaction_log[_0x2a74('0x1d')](_0x2a74('0x60'),_0x34e586['user']['id'],_0x34e586[_0x2a74('0x5b')][_0x2a74('0x32')],_0x34e586[_0x2a74('0x5b')][_0x2a74('0x61')],_0x146540['interaction']['id'],_0x34e586[_0x2a74('0x52')]?JSON['stringify'](_0x34e586['body']):_0x2a74('0x62'));return respondWithRpcPromise(_0x2a74('0x63'),'acceptMessage',_0x146540);}return null;})['then'](function(_0x14427f){var _0x511e18=_0x2a74('0x64')+_0x14427f[_0x2a74('0x22')]['ContactId'];return db[_0x2a74('0x65')][_0x2a74('0x3a')](_0x511e18,{'type':db[_0x2a74('0x66')][_0x2a74('0x67')]['SELECT'],'raw':!![]})[_0x2a74('0x1c')](function(_0x3dec02){return _0x3dec02;});})[_0x2a74('0x1c')](function(_0x474cf4){if(_0x474cf4){_0x146540['message'][_0x2a74('0x68')]=_0x474cf4[0x0];if(!_0x34e586[_0x2a74('0x52')][_0x2a74('0x5a')])return;return db[_0x2a74('0x69')]['find']({'where':{'id':_0x34e586['body']['UserId'],'role':_0x2a74('0x6a')},'attributes':['id',_0x2a74('0x32'),_0x2a74('0x6b'),_0x2a74('0x6c'),'internal'],'raw':!![]});}return null;})[_0x2a74('0x1c')](function(_0x4fbd8f){if(!_0x4fbd8f)return null;_0x146540['message']['agent']=_0x4fbd8f;return _0x146540;})['then'](function(_0x2bf81f){if(_0x2bf81f){if(_0x34e586[_0x2a74('0x52')][_0x2a74('0x6d')]){_0x146540[_0x2a74('0x22')][_0x2a74('0x6e')]=util[_0x2a74('0x59')]('SIP/%s',_0x34e586[_0x2a74('0x5b')][_0x2a74('0x32')]);_0x146540[_0x2a74('0x22')][_0x2a74('0x6f')]=_0x146540[_0x2a74('0x6f')];_0x146540['message']['motionChannel']=_0x146540[_0x2a74('0x6f')];_0x146540['message'][_0x2a74('0x70')]=_0x2a74('0x57');return respondWithRpcPromise(_0x2a74('0x71'),_0x2a74('0x71'),{'event':_0x2a74('0x72'),'message':_0x146540[_0x2a74('0x22')]},client9002)[_0x2a74('0x1c')](function(){return _0x146540;});}return _0x146540;}return null;})[_0x2a74('0x1c')](respondWithResult(_0x2d2ac8,null))[_0x2a74('0x4d')](handleError(_0x2d2ac8,null));};var interaction_log=require('../../config/logger')(_0x2a74('0x56'));exports[_0x2a74('0x2d')]=function(_0x1fefb0,_0x59497f,_0x202d16){var _0x3efa32={'agent':{},'channel':_0x2a74('0x73')};if(_0x1fefb0['body']['id']){delete _0x1fefb0[_0x2a74('0x52')]['id'];}_0x1fefb0[_0x2a74('0x52')]['UserId']=_0x1fefb0['body']['UserId']||_0x1fefb0['user']['id'];_0x3efa32[_0x2a74('0x6a')]['id']=_0x1fefb0[_0x2a74('0x52')]['UserId'];return db[_0x2a74('0x49')][_0x2a74('0x50')]({'where':{'id':_0x1fefb0[_0x2a74('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x59497f,null))[_0x2a74('0x1c')](function(_0x2f6818){if(_0x2f6818){_0x3efa32['message']=_0x2f6818[_0x2a74('0x5c')]({'plain':!![]});return db[_0x2a74('0x5d')][_0x2a74('0x50')]({'where':{'id':_0x2f6818[_0x2a74('0x74')]}});}return null;})[_0x2a74('0x1c')](handleEntityNotFound(_0x59497f,null))[_0x2a74('0x1c')](function(_0x385d14){if(_0x385d14){_0x3efa32[_0x2a74('0x75')]=_0x385d14[_0x2a74('0x5c')]({'plain':!![]});interaction_log[_0x2a74('0x1d')](_0x2a74('0x76'),_0x1fefb0[_0x2a74('0x5b')]['id'],_0x1fefb0['user'][_0x2a74('0x32')],_0x1fefb0['user']['role'],_0x3efa32['interaction']['id'],_0x1fefb0['body']?JSON['stringify'](_0x1fefb0[_0x2a74('0x52')]):_0x2a74('0x62'));return respondWithRpcPromise(_0x2a74('0x77'),'rejectMessage',_0x3efa32);}return null;})[_0x2a74('0x1c')](function(_0x509315){var _0x4f603b=_0x2a74('0x64')+_0x509315[_0x2a74('0x22')]['ContactId'];return db[_0x2a74('0x65')]['query'](_0x4f603b,{'type':db['Sequelize'][_0x2a74('0x67')][_0x2a74('0x78')],'raw':!![]})[_0x2a74('0x1c')](function(_0x5cd1ea){return _0x5cd1ea;});})[_0x2a74('0x1c')](function(_0xeb8ab9){if(_0xeb8ab9){_0x3efa32[_0x2a74('0x22')]['contact']=_0xeb8ab9[0x0];if(!_0x1fefb0[_0x2a74('0x52')][_0x2a74('0x5a')])return;return db[_0x2a74('0x69')]['find']({'where':{'id':_0x1fefb0[_0x2a74('0x52')][_0x2a74('0x5a')],'role':_0x2a74('0x6a')},'attributes':['id',_0x2a74('0x32'),_0x2a74('0x6b'),_0x2a74('0x6c'),_0x2a74('0x79')],'raw':!![]});}return null;})[_0x2a74('0x1c')](function(_0x5f518d){if(!_0x5f518d)return null;_0x3efa32['message'][_0x2a74('0x6a')]=_0x5f518d;return _0x3efa32;})['then'](function(_0x593f58){if(_0x593f58){_0x593f58[_0x2a74('0x22')]['interface']=util[_0x2a74('0x59')](_0x2a74('0x7a'),_0x1fefb0[_0x2a74('0x5b')][_0x2a74('0x32')]);_0x593f58[_0x2a74('0x22')]['channel']=_0x3efa32[_0x2a74('0x6f')];_0x593f58[_0x2a74('0x22')][_0x2a74('0x7b')]=_0x3efa32[_0x2a74('0x6f')];_0x593f58['message'][_0x2a74('0x70')]=_0x2a74('0x2d');respondWithRpcPromise(_0x2a74('0x71'),_0x2a74('0x71'),{'event':'rejectmessage','message':_0x593f58[_0x2a74('0x22')]},client9002);return _0x3efa32;}return null;})['then'](respondWithResult(_0x59497f,null))[_0x2a74('0x4d')](handleError(_0x59497f,null));};exports[_0x2a74('0x24')]=function(_0x5ac2fd,_0x311424,_0x593bf5){if(_0x5ac2fd[_0x2a74('0x52')]['id']){delete _0x5ac2fd['body']['id'];}var _0x44d3d4;return db[_0x2a74('0x49')][_0x2a74('0x50')]({'where':{'id':_0x5ac2fd[_0x2a74('0x4e')]['id']}})[_0x2a74('0x1c')](handleEntityNotFound(_0x311424,null))['then'](function(_0x1604e7){if(_0x1604e7){_0x44d3d4=_0x1604e7;return db[_0x2a74('0x7c')][_0x2a74('0x50')]({'where':{'id':_0x1604e7[_0x2a74('0x7d')]}});}})[_0x2a74('0x1c')](handleEntityNotFound(_0x311424,null))[_0x2a74('0x1c')](function(_0x8b7c59){if(_0x8b7c59){logger[_0x2a74('0x7e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2a74('0x24'),_0x2a74('0x7f'),_0x8b7c59[_0x2a74('0x37')],util[_0x2a74('0x80')](_0x5ac2fd['body'],{'showHidden':![],'depth':null}));switch(_0x8b7c59[_0x2a74('0x37')]){case'twilio':if(_0x5ac2fd['body'][_0x2a74('0x81')]&&_0x5ac2fd[_0x2a74('0x52')][_0x2a74('0x81')]===_0x44d3d4[_0x2a74('0x82')]){return _0x44d3d4[_0x2a74('0x2f')]({'read':!![]});}else{logger[_0x2a74('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a74('0x24'),_0x2a74('0x83'),util[_0x2a74('0x80')](_0x5ac2fd[_0x2a74('0x52')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5ac2fd['body']['MessageUUID']&&_0x5ac2fd[_0x2a74('0x52')][_0x2a74('0x84')]===_0x44d3d4['messageId']&&_[_0x2a74('0x85')]([_0x2a74('0x86'),'delivered'],_0x5ac2fd['body']['Status'])>=0x0){return _0x44d3d4[_0x2a74('0x2f')]({'read':!![]});}else{logger[_0x2a74('0x20')](_0x2a74('0x87'),'status',_0x2a74('0x88'),util[_0x2a74('0x80')](_0x5ac2fd[_0x2a74('0x52')],{'showHidden':![],'depth':null}));}break;case _0x2a74('0x89'):var _0x41cdf7=_0x5ac2fd[_0x2a74('0x52')]['results'][0x0];if(_0x41cdf7['status'][_0x2a74('0x8a')]===_0x2a74('0x8b')){return _0x44d3d4[_0x2a74('0x2f')]({'read':!![]});}else{logger[_0x2a74('0x20')](_0x2a74('0x87'),_0x2a74('0x24'),_0x2a74('0x89'),util[_0x2a74('0x80')](_0x5ac2fd[_0x2a74('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x44d3d4;}})['then'](respondWithResult(_0x311424,null))[_0x2a74('0x4d')](handleError(_0x311424,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index cd621f2..1f33b00 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 _0x13ff=['remove','emit','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x5cb467,_0x25cf26){var _0x4f6f66=function(_0x1b31d9){while(--_0x1b31d9){_0x5cb467['push'](_0x5cb467['shift']());}};_0x4f6f66(++_0x25cf26);}(_0x13ff,0xab));var _0xf13f=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x13ff[_0xd09668];return _0x68726;};'use strict';var EventEmitter=require(_0xf13f('0x0'));var SmsMessage=require(_0xf13f('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xf13f('0x2')](0x0);var events={'afterCreate':_0xf13f('0x3'),'afterUpdate':_0xf13f('0x4'),'afterDestroy':_0xf13f('0x5')};function emitEvent(_0x104abf){return function(_0x24449d,_0x5b1d43,_0x230e52){SmsMessageEvents[_0xf13f('0x6')](_0x104abf+':'+_0x24449d['id'],_0x24449d);SmsMessageEvents[_0xf13f('0x6')](_0x104abf,_0x24449d);_0x230e52(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xf13f('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xa7b2=['hook','events','../../mysqldb','save','remove','emit'];(function(_0x257841,_0x389b4d){var _0x1b87ed=function(_0xceb19e){while(--_0xceb19e){_0x257841['push'](_0x257841['shift']());}};_0x1b87ed(++_0x389b4d);}(_0xa7b2,0x151));var _0x2a7b=function(_0x392a95,_0x1e4fbf){_0x392a95=_0x392a95-0x0;var _0x148306=_0xa7b2[_0x392a95];return _0x148306;};'use strict';var EventEmitter=require(_0x2a7b('0x0'));var SmsMessage=require(_0x2a7b('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a7b('0x2'),'afterUpdate':'update','afterDestroy':_0x2a7b('0x3')};function emitEvent(_0x3c5d34){return function(_0x571adf,_0x4c2869,_0x4d38d3){SmsMessageEvents[_0x2a7b('0x4')](_0x3c5d34+':'+_0x571adf['id'],_0x571adf);SmsMessageEvents[_0x2a7b('0x4')](_0x3c5d34,_0x571adf);_0x4d38d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x2a7b('0x5')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a96a820..7c1f1b6 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 _0x27a8=['phone','/status?token=','token','update','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','&password=','password','GET','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','POST','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','clickSend','plivo','authId','remote','/api/sms/messages/','format','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','application/json','IBSSO\x20','infobip','apiKey','login','text','timestamp','keys','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','sms_messages','messageId','body','models','get','direction','toLowerCase','secret','UserId','isNil','SmsInteraction','findOne','SmsInteractionId','then','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','accountSid','authToken','messages','create'];(function(_0x1f8f9a,_0x291e2d){var _0x1ca216=function(_0x328199){while(--_0x328199){_0x1f8f9a['push'](_0x1f8f9a['shift']());}};_0x1ca216(++_0x291e2d);}(_0x27a8,0x1bd));var _0x827a=function(_0x601f4c,_0xb2bcd8){_0x601f4c=_0x601f4c-0x0;var _0x3cd1f4=_0x27a8[_0x601f4c];return _0x3cd1f4;};'use strict';var _=require(_0x827a('0x0'));var util=require('util');var logger=require(_0x827a('0x1'))(_0x827a('0x2'));var moment=require(_0x827a('0x3'));var BPromise=require(_0x827a('0x4'));var rp=require(_0x827a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x827a('0x6'));var config=require(_0x827a('0x7'));var attributes=require(_0x827a('0x8'));module[_0x827a('0x9')]=function(_0x42e079,_0x229c27){return _0x42e079['define']('SmsMessage',attributes,{'tableName':_0x827a('0xa'),'paranoid':![],'indexes':[{'name':_0x827a('0xb'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x827a('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b6cf9,_0x1a76a6,_0xf70ae9){var _0x46fcc5=_0x42e079[_0x827a('0xd')];var _0x9918f=_0x3b6cf9[_0x827a('0xe')]({'plain':!![]});if(_0x9918f[_0x827a('0xf')]['toLowerCase']()==='in'||_0x9918f[_0x827a('0xf')][_0x827a('0x10')]()==='out'&&!_0x9918f[_0x827a('0x11')]&&!_['isNil'](_0x9918f[_0x827a('0x12')])&&!_[_0x827a('0x13')](_0x9918f['SmsInteractionId'])){_0x46fcc5[_0x827a('0x14')][_0x827a('0x15')]({'where':{'id':_0x9918f[_0x827a('0x16')]}})[_0x827a('0x17')](function(_0x588c9d){if(_0x588c9d){_0x588c9d['update']({'lastMsgAt':_0x9918f[_0x827a('0x18')],'lastMsgDirection':_0x9918f[_0x827a('0xf')][_0x827a('0x10')]()});}})[_0x827a('0x19')](function(_0x287576){console[_0x827a('0x1a')](_0x287576);});}if(_0x9918f[_0x827a('0xf')]==='out'&&!_0x9918f[_0x827a('0x11')]){var _0x31b4a0;_0x46fcc5[_0x827a('0x1b')][_0x827a('0x1c')]({'where':{'id':_0x9918f[_0x827a('0x1d')]},'raw':!![]})[_0x827a('0x17')](function(_0xc1d3f0){_0x31b4a0=_0xc1d3f0;if(_0x31b4a0&&_0x31b4a0[_0x827a('0x1e')]){switch(_0x31b4a0['type']){case'twilio':var _0x1d5acd=require('twilio');if(_0x31b4a0[_0x827a('0x1f')]&&_0x31b4a0[_0x827a('0x20')]&&_0x31b4a0['phone']){var _0x3cb53a=new _0x1d5acd(_0x31b4a0[_0x827a('0x1f')],_0x31b4a0[_0x827a('0x20')]);_0x3cb53a[_0x827a('0x21')][_0x827a('0x22')]({'body':_0x9918f[_0x827a('0xc')],'to':_0x9918f[_0x827a('0x23')],'from':_0x31b4a0['phone'],'statusCallback':_0x31b4a0['remote']+'/api/sms/messages/'+_0x9918f['id']+_0x827a('0x24')+_0x31b4a0[_0x827a('0x25')]})['then'](function(_0x50f1f9){if(_0x50f1f9['sid']){return _0x3b6cf9[_0x827a('0x26')]({'messageId':_0x50f1f9[_0x827a('0x27')]});}})[_0x827a('0x19')](function(_0x1b43c5){logger[_0x827a('0x1a')](_0x827a('0x28'),'afterCreate','twilio',util['inspect'](_0x1b43c5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x2a'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x827a('0x2b'):var _0x341b68=_0x827a('0x2c');if(_0x31b4a0[_0x827a('0x2d')]&&_0x31b4a0['password']){var _0x5930ae={'recipient':[_0x9918f[_0x827a('0x23')]],'message':_0x9918f[_0x827a('0xc')],'message_type':_0x31b4a0['smsMethod']};if(_0x31b4a0[_0x827a('0x2e')]&&_0x31b4a0[_0x827a('0x2e')]!=='SI'){_0x5930ae['sender']=_0x31b4a0[_0x827a('0x23')];}var _0x1c972e={'url':_0x341b68+_0x827a('0x2f')+_0x31b4a0[_0x827a('0x2d')]+_0x827a('0x30')+_0x31b4a0[_0x827a('0x31')],'method':_0x827a('0x32')};rp(_0x1c972e)[_0x827a('0x17')](function(_0x1c7179){var _0xd9e213=_0x1c7179[_0x827a('0x33')](';');var _0x319305={'user_key':_0xd9e213[0x0],'session_key':_0xd9e213[0x1]};_0x1c972e={'url':_0x341b68+_0x827a('0x34'),'method':'POST','headers':{'user_key':_0x319305[_0x827a('0x35')],'Session_key':_0x319305[_0x827a('0x36')]},'json':!![],'body':_0x5930ae};return rp(_0x1c972e);})[_0x827a('0x17')](function(_0x231d43){if(_0x231d43[_0x827a('0x37')]>=0x1){var _0x37b0f0={'messageId':_0x231d43[_0x827a('0x38')]};if(_0x31b4a0[_0x827a('0x2e')]!=='GP'||!_0x31b4a0[_0x827a('0x39')]){_0x37b0f0[_0x827a('0x3a')]=!![];}return _0x3b6cf9[_0x827a('0x26')](_0x37b0f0);}else{return logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),'skebby',util[_0x827a('0x3b')](_0x231d43,{'showHidden':![],'depth':null}));}})['catch'](function(_0x395f57){return logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x2b'),util[_0x827a('0x3b')](_0x395f57,{'showHidden':![],'depth':null}));});}else{logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),'skebby',_0x827a('0x3c'));}break;case'connectel':if(_0x31b4a0[_0x827a('0x20')]){var _0x36d509={'recipient':_0x9918f[_0x827a('0x23')],'message':_0x9918f['body'],'sender':_0x31b4a0['senderString']||_0x31b4a0[_0x827a('0x23')],'authorization':_0x31b4a0['authToken']};var _0x1a76a6={'method':_0x827a('0x3d'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x36d509,'json':!![]};rp(_0x1a76a6)[_0x827a('0x17')](function(_0x3d2e52){var _0x2988dc={'messageId':_0x3d2e52[_0x827a('0x3e')]};if(!_0x31b4a0['deliveryReport']){_0x2988dc[_0x827a('0x3a')]=!![];}return _0x3b6cf9['update'](_0x2988dc);})[_0x827a('0x19')](function(_0x2cbbbe){logger[_0x827a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x827a('0x3f'),util['inspect'](_0x2cbbbe,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x827a('0x28'),_0x827a('0x29'),'connectel',_0x827a('0x40'));}break;case _0x827a('0x41'):if(_0x31b4a0[_0x827a('0x2d')]&&_0x31b4a0[_0x827a('0x31')]){var _0x36d509={'messages':[{'source':_0x827a('0x42'),'to':_0x9918f[_0x827a('0x23')],'body':_0x9918f[_0x827a('0xc')],'from':_0x31b4a0[_0x827a('0x43')]||_0x31b4a0[_0x827a('0x23')]}]};var _0x2bf276=util['format'](_0x827a('0x44'),_0x31b4a0[_0x827a('0x2d')],_0x31b4a0['password']);var _0x1a76a6={'method':_0x827a('0x3d'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x36d509,'headers':{'Authorization':util['format'](_0x827a('0x45'),new Buffer(_0x2bf276)[_0x827a('0x46')](_0x827a('0x47')))},'json':!![]};rp(_0x1a76a6)[_0x827a('0x17')](function(_0x551364){if(_0x551364['http_code']>=0xc8&&_0x551364[_0x827a('0x48')]<=0xce){if(_0x551364[_0x827a('0x49')]&&_0x551364[_0x827a('0x49')][_0x827a('0x4a')]>0x0){var _0x384185=_['head'](_0x551364[_0x827a('0x49')][_0x827a('0x21')]);var _0x1ddbd2={'messageId':_0x384185['message_id']};if(!_0x31b4a0[_0x827a('0x39')]){_0x1ddbd2[_0x827a('0x3a')]=!![];}return _0x3b6cf9['update'](_0x1ddbd2);}else{logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),'clickSend',util['inspect'](_0x551364,{'showHidden':![],'depth':null}));}}else{logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),'clickSend',util[_0x827a('0x3b')](_0x551364,{'showHidden':![],'depth':null}));}})[_0x827a('0x19')](function(_0x5a2df8){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x827a('0x4b'),util['inspect'](_0x5a2df8,{'showHidden':![],'depth':null}));});}else{logger[_0x827a('0x1a')](_0x827a('0x28'),'afterCreate','clickSend',_0x827a('0x3c'));}break;case _0x827a('0x4c'):if(_0x31b4a0[_0x827a('0x4d')]&&_0x31b4a0[_0x827a('0x20')]){var _0x36d509={'dst':_0x9918f[_0x827a('0x23')],'text':_0x9918f[_0x827a('0xc')],'src':_0x31b4a0[_0x827a('0x43')]||_0x31b4a0['phone'],'url':_0x31b4a0[_0x827a('0x4e')]+_0x827a('0x4f')+_0x9918f['id']+_0x827a('0x24')+_0x31b4a0[_0x827a('0x25')]};var _0x2bf276=util[_0x827a('0x50')]('%s:%s',_0x31b4a0['authId'],_0x31b4a0['authToken']);var _0x1a76a6={'method':_0x827a('0x3d'),'uri':util[_0x827a('0x50')](_0x827a('0x51'),_0x31b4a0[_0x827a('0x4d')]),'body':_0x36d509,'headers':{'Authorization':util[_0x827a('0x50')](_0x827a('0x45'),new Buffer(_0x2bf276)[_0x827a('0x46')](_0x827a('0x47')))},'json':!![]};rp(_0x1a76a6)[_0x827a('0x17')](function(_0x5e39c6){var _0x3c15e9={'messageId':_0x5e39c6['message_uuid'][0x0]};return _0x3b6cf9[_0x827a('0x26')](_0x3c15e9);})['catch'](function(_0x22a21f){logger['error'](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x4c'),util[_0x827a('0x3b')](_0x22a21f,{'showHidden':![],'depth':null}));});}else{logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x4c'),_0x827a('0x52'));}break;case'infobip':if(_0x31b4a0[_0x827a('0x2d')]&&_0x31b4a0[_0x827a('0x31')]){if(_0x31b4a0[_0x827a('0x53')]){var _0x5eb9bb={'method':'POST','uri':_0x31b4a0[_0x827a('0x53')]+'/auth/1/session','body':{'username':_0x31b4a0[_0x827a('0x2d')],'password':_0x31b4a0[_0x827a('0x31')]},'json':!![]};return rp(_0x5eb9bb)['then'](function(_0x203693){var _0x343fb4={'method':_0x827a('0x3d'),'uri':_0x31b4a0[_0x827a('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x31b4a0[_0x827a('0x23')],'destinations':[{'to':_0x9918f[_0x827a('0x23')]}],'text':_0x9918f[_0x827a('0xc')],'notifyUrl':_0x31b4a0[_0x827a('0x4e')]+'/api/sms/messages/'+_0x9918f['id']+_0x827a('0x24')+_0x31b4a0[_0x827a('0x25')],'notifyContentType':_0x827a('0x54'),'callbackData':_0x31b4a0[_0x827a('0x23')]+';'+_0x9918f[_0x827a('0xc')]}]},'headers':{'Authorization':_0x827a('0x55')+_0x203693[_0x827a('0x25')]},'json':!![]};return rp(_0x343fb4)['then'](function(_0x57fa9a){if(_0x57fa9a[_0x827a('0x21')]){var _0x26dc0c={'messageId':_0x57fa9a[_0x827a('0x21')][0x0][_0x827a('0xb')]};if(!_0x31b4a0[_0x827a('0x39')]){_0x26dc0c['read']=!![];}return _0x3b6cf9['update'](_0x26dc0c);}else{return logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),'infobip',util[_0x827a('0x3b')](_0x57fa9a,{'showHidden':![],'depth':null}));}});})[_0x827a('0x19')](function(_0x359546){return logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x56'),util[_0x827a('0x3b')](_0x359546,{'showHidden':![],'depth':null}));});}else{logger[_0x827a('0x1a')](_0x827a('0x28'),'afterCreate',_0x827a('0x56'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x426da4=require('crypto');if(_0x31b4a0[_0x827a('0x57')]){var _0x535f29={};_0x535f29[_0x827a('0x58')]=_0x31b4a0[_0x827a('0x2d')];_0x535f29[_0x827a('0x23')]=_0x9918f[_0x827a('0x23')];_0x535f29['sender']=_0x31b4a0[_0x827a('0x23')];_0x535f29[_0x827a('0x59')]=_0x9918f[_0x827a('0xc')];_0x535f29[_0x827a('0x5a')]=+new Date();var _0x1d4037='';var _0x1206ea='';var _0x3a6f52=Object[_0x827a('0x5b')](_0x535f29);_0x3a6f52['sort']();for(var _0x296084=0x0;_0x296084<_0x3a6f52[_0x827a('0x5c')];_0x296084++){if(_0x1d4037!=''){_0x1d4037+='&';}_0x1d4037+=_0x3a6f52[_0x296084]+'='+encodeURIComponent(_0x535f29[_0x3a6f52[_0x296084]]);_0x1206ea+=_0x535f29[_0x3a6f52[_0x296084]];}_0x1206ea+=_0x31b4a0[_0x827a('0x57')];_0x1206ea=_0x426da4[_0x827a('0x5d')](_0x827a('0x5e'))[_0x827a('0x26')](_0x1206ea)[_0x827a('0x5f')](_0x827a('0x60'));if(_0x1d4037!==''){_0x1d4037+='&';}_0x1d4037+=_0x827a('0x61')+_0x1206ea;var _0x1c972e={'method':_0x827a('0x32'),'uri':_0x31b4a0['baseUrl']+_0x827a('0x62')+_0x1d4037,'json':!![]};return rp(_0x1c972e)['then'](function(_0xf1c357){var _0x3ab5ad=Object['keys'](_0xf1c357);if(_0xf1c357[_0x3ab5ad[0x0]]['error']&&parseInt(_0xf1c357[_0x3ab5ad[0x0]][_0x827a('0x1a')])===0x0){var _0x71866c={'messageId':_0xf1c357[_0x3ab5ad[0x0]]['id_sms']};if(!_0x31b4a0['deliveryReport']){_0x71866c[_0x827a('0x3a')]=!![];}return _0x3b6cf9[_0x827a('0x26')](_0x71866c);}else{return logger['error'](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x63'),util[_0x827a('0x3b')](_0xf1c357[_0x827a('0x1a')],{'showHidden':![],'depth':null}));}})[_0x827a('0x19')](function(_0x3bbade){return logger['error'](_0x827a('0x28'),_0x827a('0x29'),'csc',util[_0x827a('0x3b')](_0x3bbade,{'showHidden':![],'depth':null}));});}else{logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x63'),_0x827a('0x64'));}break;case _0x827a('0x65'):if(_0x31b4a0['apiKey']){var _0x4fe0de={'method':_0x827a('0x3d'),'uri':_0x827a('0x66'),'headers':{'Authorization':_0x31b4a0['apiKey']},'body':{'content':_0x9918f[_0x827a('0xc')],'to':[_0x9918f['phone']],'from':_0x31b4a0[_0x827a('0x23')],'binary':![],'clientMessageId':_0x827a('0x67'),'charset':_0x827a('0x68')},'json':!![]};rp(_0x4fe0de)[_0x827a('0x17')](function(_0x283f77){if(!_0x283f77[_0x827a('0x1a')]){var _0x172d46={'messageId':_0x283f77[_0x827a('0x21')][0x0][_0x827a('0x69')]};if(!_0x31b4a0['deliveryReport']){_0x172d46[_0x827a('0x3a')]=!![];}return _0x3b6cf9[_0x827a('0x26')](_0x172d46);}else{return logger[_0x827a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x827a('0x65'),util[_0x827a('0x3b')](_0x283f77[_0x827a('0x1a')],{'showHidden':![],'depth':null}));}})[_0x827a('0x19')](function(_0x47991){return logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),'clickatell',util[_0x827a('0x3b')](_0x47991,{'showHidden':![],'depth':null}));});}else{logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x65'),_0x827a('0x64'));}break;case _0x827a('0x6a'):if(_0x31b4a0[_0x827a('0x2d')]&&_0x31b4a0[_0x827a('0x31')]){var _0x2bf276=util[_0x827a('0x50')](_0x827a('0x44'),_0x31b4a0[_0x827a('0x2d')],_0x31b4a0[_0x827a('0x31')]);var _0x1a76a6={'method':_0x827a('0x3d'),'uri':_0x827a('0x6b')+_0x31b4a0[_0x827a('0x6c')]+'/messages','body':{'to':[_0x9918f['phone']],'text':_0x9918f[_0x827a('0xc')],'from':_0x31b4a0[_0x827a('0x23')],'applicationId':_0x31b4a0[_0x827a('0x6d')]},'headers':{'Authorization':util[_0x827a('0x50')](_0x827a('0x45'),new Buffer(_0x2bf276)[_0x827a('0x46')](_0x827a('0x47')))},'json':!![]};rp(_0x1a76a6)[_0x827a('0x17')](function(_0x5bd621){if(_0x5bd621['id']){var _0x500194={'messageId':_0x5bd621['id']};return _0x3b6cf9[_0x827a('0x26')](_0x500194);}else{logger[_0x827a('0x1a')](_0x827a('0x28'),'afterCreate',_0x827a('0x6a'),util[_0x827a('0x3b')](_0x5bd621,{'showHidden':![],'depth':null}));}})[_0x827a('0x19')](function(_0x1678b0){logger[_0x827a('0x1a')](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x6a'),util[_0x827a('0x3b')](_0x1678b0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x6a'),_0x827a('0x3c'));}break;case'intelepeer':if(_0x31b4a0[_0x827a('0x57')]){var _0x102dd2={};var _0x1c972e={'method':_0x827a('0x3d'),'uri':_0x827a('0x6e'),'headers':{'Authorization':_0x827a('0x6f')+_0x31b4a0[_0x827a('0x57')],'Content-Type':_0x827a('0x54')},'body':{'from':_0x31b4a0['phone'],'to':_0x9918f[_0x827a('0x23')],'text':_0x9918f[_0x827a('0xc')]},'json':!![]};return rp(_0x1c972e)[_0x827a('0x17')](function(_0x430534){if(_0x430534[_0x827a('0x70')]==0xca){_0x102dd2[_0x827a('0x71')]=_0x430534;var _0x4ac749={'method':_0x827a('0x3d'),'uri':_0x827a('0x72'),'headers':{'Authorization':_0x827a('0x6f')+_0x31b4a0[_0x827a('0x57')],'Content-Type':'application/json'},'body':{'refid':_0x102dd2[_0x827a('0x71')][_0x827a('0x73')]},'json':!![]};return rp(_0x4ac749)['then'](function(_0x3360eb){_0x102dd2['status']=_0x3360eb;var _0x5326e1={'messageId':_0x102dd2[_0x827a('0x71')][_0x827a('0x73')],'read':!![]};return _0x3b6cf9['update'](_0x5326e1);});}else{return logger['error'](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x74'),util[_0x827a('0x3b')](_0x430534,{'showHidden':![],'depth':null}));}})[_0x827a('0x19')](function(_0x3c6ec4){return logger[_0x827a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x827a('0x29'),_0x827a('0x74'),util['inspect'](_0x3c6ec4,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x827a('0x28'),_0x827a('0x29'),_0x827a('0x74'),_0x827a('0x75'));}break;}}})[_0x827a('0x76')](function(){_0xf70ae9();});}else{_0xf70ae9();}}},'charset':'utf8mb4','collate':_0x827a('0x77')});}; \ No newline at end of file +var _0x3afd=['accountSid','authToken','messages','phone','remote','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','smsMethod','login?username=','username','&password=','password','GET','split','sms','POST','user_key','total_sent','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','%s:%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','text','timestamp','keys','length','apiKey','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','SmsMessage','sms_messages','messageId','body','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','findOne','then','createdAt','SmsAccount','SmsAccountId','type','twilio'];(function(_0x520e33,_0x3d40d4){var _0x426cd3=function(_0x3fe952){while(--_0x3fe952){_0x520e33['push'](_0x520e33['shift']());}};_0x426cd3(++_0x3d40d4);}(_0x3afd,0x1c8));var _0xd3af=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x3afd[_0x1aeda2];return _0x32dc6d;};'use strict';var _=require(_0xd3af('0x0'));var util=require('util');var logger=require(_0xd3af('0x1'))(_0xd3af('0x2'));var moment=require(_0xd3af('0x3'));var BPromise=require('bluebird');var rp=require(_0xd3af('0x4'));var fs=require('fs');var path=require(_0xd3af('0x5'));var rimraf=require(_0xd3af('0x6'));var config=require(_0xd3af('0x7'));var attributes=require(_0xd3af('0x8'));module['exports']=function(_0x592592,_0x23f7d3){return _0x592592['define'](_0xd3af('0x9'),attributes,{'tableName':_0xd3af('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd3af('0xb')]},{'name':'fti_sms_messages','fields':[_0xd3af('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2232b3,_0xc121ae,_0x6e3b1b){var _0x426ecc=_0x592592[_0xd3af('0xd')];var _0x14fb5e=_0x2232b3['get']({'plain':!![]});if(_0x14fb5e[_0xd3af('0xe')][_0xd3af('0xf')]()==='in'||_0x14fb5e[_0xd3af('0xe')][_0xd3af('0xf')]()===_0xd3af('0x10')&&!_0x14fb5e[_0xd3af('0x11')]&&!_[_0xd3af('0x12')](_0x14fb5e[_0xd3af('0x13')])&&!_['isNil'](_0x14fb5e[_0xd3af('0x14')])){_0x426ecc['SmsInteraction'][_0xd3af('0x15')]({'where':{'id':_0x14fb5e[_0xd3af('0x14')]}})[_0xd3af('0x16')](function(_0x237ac7){if(_0x237ac7){_0x237ac7['update']({'lastMsgAt':_0x14fb5e[_0xd3af('0x17')],'lastMsgDirection':_0x14fb5e[_0xd3af('0xe')][_0xd3af('0xf')]()});}})['catch'](function(_0x48490c){console['error'](_0x48490c);});}if(_0x14fb5e[_0xd3af('0xe')]===_0xd3af('0x10')&&!_0x14fb5e[_0xd3af('0x11')]){var _0x39eac1;_0x426ecc[_0xd3af('0x18')]['find']({'where':{'id':_0x14fb5e[_0xd3af('0x19')]},'raw':!![]})['then'](function(_0x4f7004){_0x39eac1=_0x4f7004;if(_0x39eac1&&_0x39eac1[_0xd3af('0x1a')]){switch(_0x39eac1[_0xd3af('0x1a')]){case'twilio':var _0x45b796=require(_0xd3af('0x1b'));if(_0x39eac1[_0xd3af('0x1c')]&&_0x39eac1['authToken']&&_0x39eac1['phone']){var _0xf232d=new _0x45b796(_0x39eac1[_0xd3af('0x1c')],_0x39eac1[_0xd3af('0x1d')]);_0xf232d[_0xd3af('0x1e')]['create']({'body':_0x14fb5e[_0xd3af('0xc')],'to':_0x14fb5e[_0xd3af('0x1f')],'from':_0x39eac1[_0xd3af('0x1f')],'statusCallback':_0x39eac1[_0xd3af('0x20')]+'/api/sms/messages/'+_0x14fb5e['id']+_0xd3af('0x21')+_0x39eac1[_0xd3af('0x22')]})[_0xd3af('0x16')](function(_0x2acee8){if(_0x2acee8[_0xd3af('0x23')]){return _0x2232b3['update']({'messageId':_0x2acee8[_0xd3af('0x23')]});}})[_0xd3af('0x24')](function(_0x1f0e8c){logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x1b'),util[_0xd3af('0x28')](_0x1f0e8c,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),'afterCreate',_0xd3af('0x1b'),_0xd3af('0x29'));}break;case _0xd3af('0x2a'):var _0x29025b='https://api.skebby.it/API/v1.0/REST/';if(_0x39eac1['username']&&_0x39eac1['password']){var _0x320ec2={'recipient':[_0x14fb5e[_0xd3af('0x1f')]],'message':_0x14fb5e[_0xd3af('0xc')],'message_type':_0x39eac1[_0xd3af('0x2b')]};if(_0x39eac1['smsMethod']&&_0x39eac1[_0xd3af('0x2b')]!=='SI'){_0x320ec2['sender']=_0x39eac1[_0xd3af('0x1f')];}var _0x2d4cf3={'url':_0x29025b+_0xd3af('0x2c')+_0x39eac1[_0xd3af('0x2d')]+_0xd3af('0x2e')+_0x39eac1[_0xd3af('0x2f')],'method':_0xd3af('0x30')};rp(_0x2d4cf3)[_0xd3af('0x16')](function(_0x3e7219){var _0x5aa70d=_0x3e7219[_0xd3af('0x31')](';');var _0x5e8f1b={'user_key':_0x5aa70d[0x0],'session_key':_0x5aa70d[0x1]};_0x2d4cf3={'url':_0x29025b+_0xd3af('0x32'),'method':_0xd3af('0x33'),'headers':{'user_key':_0x5e8f1b[_0xd3af('0x34')],'Session_key':_0x5e8f1b['session_key']},'json':!![],'body':_0x320ec2};return rp(_0x2d4cf3);})[_0xd3af('0x16')](function(_0x1ec8be){if(_0x1ec8be[_0xd3af('0x35')]>=0x1){var _0x43598c={'messageId':_0x1ec8be['internal_order_id']};if(_0x39eac1['smsMethod']!=='GP'||!_0x39eac1[_0xd3af('0x36')]){_0x43598c[_0xd3af('0x37')]=!![];}return _0x2232b3[_0xd3af('0x38')](_0x43598c);}else{return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x2a'),util[_0xd3af('0x28')](_0x1ec8be,{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x471ead){return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x2a'),util[_0xd3af('0x28')](_0x471ead,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x2a'),_0xd3af('0x39'));}break;case _0xd3af('0x3a'):if(_0x39eac1['authToken']){var _0x2f9470={'recipient':_0x14fb5e[_0xd3af('0x1f')],'message':_0x14fb5e[_0xd3af('0xc')],'sender':_0x39eac1[_0xd3af('0x3b')]||_0x39eac1['phone'],'authorization':_0x39eac1['authToken']};var _0xc121ae={'method':_0xd3af('0x33'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x2f9470,'json':!![]};rp(_0xc121ae)[_0xd3af('0x16')](function(_0x3c56fe){var _0x23265d={'messageId':_0x3c56fe[_0xd3af('0x3c')]};if(!_0x39eac1[_0xd3af('0x36')]){_0x23265d[_0xd3af('0x37')]=!![];}return _0x2232b3[_0xd3af('0x38')](_0x23265d);})[_0xd3af('0x24')](function(_0x2d46bb){logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),'connectel',util[_0xd3af('0x28')](_0x2d46bb,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3af('0x27'),'connectel',_0xd3af('0x3d'));}break;case _0xd3af('0x3e'):if(_0x39eac1[_0xd3af('0x2d')]&&_0x39eac1[_0xd3af('0x2f')]){var _0x2f9470={'messages':[{'source':_0xd3af('0x3f'),'to':_0x14fb5e[_0xd3af('0x1f')],'body':_0x14fb5e[_0xd3af('0xc')],'from':_0x39eac1[_0xd3af('0x3b')]||_0x39eac1[_0xd3af('0x1f')]}]};var _0x1e6314=util[_0xd3af('0x40')]('%s:%s',_0x39eac1[_0xd3af('0x2d')],_0x39eac1['password']);var _0xc121ae={'method':_0xd3af('0x33'),'uri':_0xd3af('0x41'),'body':_0x2f9470,'headers':{'Authorization':util['format'](_0xd3af('0x42'),new Buffer(_0x1e6314)[_0xd3af('0x43')](_0xd3af('0x44')))},'json':!![]};rp(_0xc121ae)[_0xd3af('0x16')](function(_0x3ddb07){if(_0x3ddb07[_0xd3af('0x45')]>=0xc8&&_0x3ddb07[_0xd3af('0x45')]<=0xce){if(_0x3ddb07[_0xd3af('0x46')]&&_0x3ddb07[_0xd3af('0x46')][_0xd3af('0x47')]>0x0){var _0x4efbda=_[_0xd3af('0x48')](_0x3ddb07[_0xd3af('0x46')][_0xd3af('0x1e')]);var _0x4f89c5={'messageId':_0x4efbda[_0xd3af('0x49')]};if(!_0x39eac1[_0xd3af('0x36')]){_0x4f89c5[_0xd3af('0x37')]=!![];}return _0x2232b3['update'](_0x4f89c5);}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x4a'),util['inspect'](_0x3ddb07,{'showHidden':![],'depth':null}));}}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),'afterCreate',_0xd3af('0x4a'),util['inspect'](_0x3ddb07,{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x2beb78){logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),'clickSend',util[_0xd3af('0x28')](_0x2beb78,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x4a'),_0xd3af('0x39'));}break;case _0xd3af('0x4b'):if(_0x39eac1[_0xd3af('0x4c')]&&_0x39eac1[_0xd3af('0x1d')]){var _0x2f9470={'dst':_0x14fb5e['phone'],'text':_0x14fb5e[_0xd3af('0xc')],'src':_0x39eac1[_0xd3af('0x3b')]||_0x39eac1[_0xd3af('0x1f')],'url':_0x39eac1[_0xd3af('0x20')]+_0xd3af('0x4d')+_0x14fb5e['id']+_0xd3af('0x21')+_0x39eac1['token']};var _0x1e6314=util[_0xd3af('0x40')](_0xd3af('0x4e'),_0x39eac1[_0xd3af('0x4c')],_0x39eac1[_0xd3af('0x1d')]);var _0xc121ae={'method':_0xd3af('0x33'),'uri':util[_0xd3af('0x40')]('https://api.plivo.com/v1/Account/%s/Message/',_0x39eac1[_0xd3af('0x4c')]),'body':_0x2f9470,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x1e6314)[_0xd3af('0x43')](_0xd3af('0x44')))},'json':!![]};rp(_0xc121ae)[_0xd3af('0x16')](function(_0x4fff8c){var _0x11f4f8={'messageId':_0x4fff8c[_0xd3af('0x4f')][0x0]};return _0x2232b3[_0xd3af('0x38')](_0x11f4f8);})[_0xd3af('0x24')](function(_0x5820e2){logger[_0xd3af('0x25')](_0xd3af('0x26'),'afterCreate',_0xd3af('0x4b'),util[_0xd3af('0x28')](_0x5820e2,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3af('0x27'),'plivo',_0xd3af('0x50'));}break;case _0xd3af('0x51'):if(_0x39eac1[_0xd3af('0x2d')]&&_0x39eac1[_0xd3af('0x2f')]){if(_0x39eac1[_0xd3af('0x52')]){var _0x59430a={'method':_0xd3af('0x33'),'uri':_0x39eac1[_0xd3af('0x52')]+'/auth/1/session','body':{'username':_0x39eac1[_0xd3af('0x2d')],'password':_0x39eac1[_0xd3af('0x2f')]},'json':!![]};return rp(_0x59430a)[_0xd3af('0x16')](function(_0x2658d1){var _0x2c6a38={'method':_0xd3af('0x33'),'uri':_0x39eac1[_0xd3af('0x52')]+_0xd3af('0x53'),'body':{'messages':[{'from':_0x39eac1['phone'],'destinations':[{'to':_0x14fb5e[_0xd3af('0x1f')]}],'text':_0x14fb5e[_0xd3af('0xc')],'notifyUrl':_0x39eac1['remote']+_0xd3af('0x4d')+_0x14fb5e['id']+_0xd3af('0x21')+_0x39eac1['token'],'notifyContentType':_0xd3af('0x54'),'callbackData':_0x39eac1['phone']+';'+_0x14fb5e[_0xd3af('0xc')]}]},'headers':{'Authorization':_0xd3af('0x55')+_0x2658d1[_0xd3af('0x22')]},'json':!![]};return rp(_0x2c6a38)[_0xd3af('0x16')](function(_0x32db5e){if(_0x32db5e['messages']){var _0x243cd2={'messageId':_0x32db5e[_0xd3af('0x1e')][0x0][_0xd3af('0xb')]};if(!_0x39eac1[_0xd3af('0x36')]){_0x243cd2[_0xd3af('0x37')]=!![];}return _0x2232b3[_0xd3af('0x38')](_0x243cd2);}else{return logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd3af('0x51'),util[_0xd3af('0x28')](_0x32db5e,{'showHidden':![],'depth':null}));}});})[_0xd3af('0x24')](function(_0x209b1a){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3af('0x27'),_0xd3af('0x51'),util[_0xd3af('0x28')](_0x209b1a,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),'afterCreate',_0xd3af('0x51'),_0xd3af('0x56'));}}else{logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3af('0x27'),_0xd3af('0x51'),_0xd3af('0x39'));}break;case _0xd3af('0x57'):var _0x3ea47a=require('crypto');if(_0x39eac1['apiKey']){var _0x542cfe={};_0x542cfe['login']=_0x39eac1['username'];_0x542cfe[_0xd3af('0x1f')]=_0x14fb5e[_0xd3af('0x1f')];_0x542cfe['sender']=_0x39eac1[_0xd3af('0x1f')];_0x542cfe[_0xd3af('0x58')]=_0x14fb5e[_0xd3af('0xc')];_0x542cfe[_0xd3af('0x59')]=+new Date();var _0x1efa34='';var _0x3c1eda='';var _0x40e501=Object[_0xd3af('0x5a')](_0x542cfe);_0x40e501['sort']();for(var _0x31f938=0x0;_0x31f938<_0x40e501[_0xd3af('0x5b')];_0x31f938++){if(_0x1efa34!=''){_0x1efa34+='&';}_0x1efa34+=_0x40e501[_0x31f938]+'='+encodeURIComponent(_0x542cfe[_0x40e501[_0x31f938]]);_0x3c1eda+=_0x542cfe[_0x40e501[_0x31f938]];}_0x3c1eda+=_0x39eac1[_0xd3af('0x5c')];_0x3c1eda=_0x3ea47a[_0xd3af('0x5d')](_0xd3af('0x5e'))['update'](_0x3c1eda)[_0xd3af('0x5f')]('hex');if(_0x1efa34!==''){_0x1efa34+='&';}_0x1efa34+=_0xd3af('0x60')+_0x3c1eda;var _0x2d4cf3={'method':_0xd3af('0x30'),'uri':_0x39eac1['baseUrl']+_0xd3af('0x61')+_0x1efa34,'json':!![]};return rp(_0x2d4cf3)['then'](function(_0x4878ac){var _0x4a259e=Object[_0xd3af('0x5a')](_0x4878ac);if(_0x4878ac[_0x4a259e[0x0]]['error']&&parseInt(_0x4878ac[_0x4a259e[0x0]][_0xd3af('0x25')])===0x0){var _0x509387={'messageId':_0x4878ac[_0x4a259e[0x0]][_0xd3af('0x62')]};if(!_0x39eac1['deliveryReport']){_0x509387['read']=!![];}return _0x2232b3[_0xd3af('0x38')](_0x509387);}else{return logger['error'](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x57'),util[_0xd3af('0x28')](_0x4878ac['error'],{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x118876){return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x57'),util['inspect'](_0x118876,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd3af('0x57'),_0xd3af('0x63'));}break;case _0xd3af('0x64'):if(_0x39eac1[_0xd3af('0x5c')]){var _0x4f2c34={'method':_0xd3af('0x33'),'uri':_0xd3af('0x65'),'headers':{'Authorization':_0x39eac1['apiKey']},'body':{'content':_0x14fb5e[_0xd3af('0xc')],'to':[_0x14fb5e[_0xd3af('0x1f')]],'from':_0x39eac1[_0xd3af('0x1f')],'binary':![],'clientMessageId':'uuid','charset':_0xd3af('0x66')},'json':!![]};rp(_0x4f2c34)[_0xd3af('0x16')](function(_0x3b8897){if(!_0x3b8897['error']){var _0x319864={'messageId':_0x3b8897[_0xd3af('0x1e')][0x0][_0xd3af('0x67')]};if(!_0x39eac1[_0xd3af('0x36')]){_0x319864[_0xd3af('0x37')]=!![];}return _0x2232b3[_0xd3af('0x38')](_0x319864);}else{return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x64'),util[_0xd3af('0x28')](_0x3b8897[_0xd3af('0x25')],{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x4e6a28){return logger[_0xd3af('0x25')](_0xd3af('0x26'),'afterCreate','clickatell',util[_0xd3af('0x28')](_0x4e6a28,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x64'),_0xd3af('0x63'));}break;case _0xd3af('0x68'):if(_0x39eac1['username']&&_0x39eac1[_0xd3af('0x2f')]){var _0x1e6314=util['format']('%s:%s',_0x39eac1[_0xd3af('0x2d')],_0x39eac1[_0xd3af('0x2f')]);var _0xc121ae={'method':_0xd3af('0x33'),'uri':_0xd3af('0x69')+_0x39eac1[_0xd3af('0x6a')]+_0xd3af('0x6b'),'body':{'to':[_0x14fb5e[_0xd3af('0x1f')]],'text':_0x14fb5e[_0xd3af('0xc')],'from':_0x39eac1[_0xd3af('0x1f')],'applicationId':_0x39eac1[_0xd3af('0x6c')]},'headers':{'Authorization':util[_0xd3af('0x40')](_0xd3af('0x42'),new Buffer(_0x1e6314)[_0xd3af('0x43')](_0xd3af('0x44')))},'json':!![]};rp(_0xc121ae)[_0xd3af('0x16')](function(_0x301c8e){if(_0x301c8e['id']){var _0x501726={'messageId':_0x301c8e['id']};return _0x2232b3[_0xd3af('0x38')](_0x501726);}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x68'),util[_0xd3af('0x28')](_0x301c8e,{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x50cfb1){logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3af('0x27'),_0xd3af('0x68'),util[_0xd3af('0x28')](_0x50cfb1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x68'),_0xd3af('0x39'));}break;case _0xd3af('0x6d'):if(_0x39eac1['apiKey']){var _0x3709d4={};var _0x2d4cf3={'method':_0xd3af('0x33'),'uri':_0xd3af('0x6e'),'headers':{'Authorization':_0xd3af('0x6f')+_0x39eac1[_0xd3af('0x5c')],'Content-Type':_0xd3af('0x54')},'body':{'from':_0x39eac1['phone'],'to':_0x14fb5e[_0xd3af('0x1f')],'text':_0x14fb5e[_0xd3af('0xc')]},'json':!![]};return rp(_0x2d4cf3)[_0xd3af('0x16')](function(_0x54d66d){if(_0x54d66d[_0xd3af('0x70')]==0xca){_0x3709d4[_0xd3af('0x71')]=_0x54d66d;var _0x39e4ca={'method':_0xd3af('0x33'),'uri':_0xd3af('0x72'),'headers':{'Authorization':_0xd3af('0x6f')+_0x39eac1[_0xd3af('0x5c')],'Content-Type':_0xd3af('0x54')},'body':{'refid':_0x3709d4[_0xd3af('0x71')][_0xd3af('0x73')]},'json':!![]};return rp(_0x39e4ca)[_0xd3af('0x16')](function(_0x1b431d){_0x3709d4[_0xd3af('0x74')]=_0x1b431d;var _0x40d8fd={'messageId':_0x3709d4['message'][_0xd3af('0x73')],'read':!![]};return _0x2232b3[_0xd3af('0x38')](_0x40d8fd);});}else{return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),'intelepeer',util[_0xd3af('0x28')](_0x54d66d,{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x1dccd9){return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x6d'),util[_0xd3af('0x28')](_0x1dccd9,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd3af('0x6d'),_0xd3af('0x75'));}break;}}})[_0xd3af('0x76')](function(){_0x6e3b1b();});}else{_0x6e3b1b();}}},'charset':_0xd3af('0x77'),'collate':_0xd3af('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 0aaea5d..a435530 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 _0x8f9d=['then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x100688,_0x1b8750){var _0x943c2d=function(_0x2206f5){while(--_0x2206f5){_0x100688['push'](_0x100688['shift']());}};_0x943c2d(++_0x1b8750);}(_0x8f9d,0x70));var _0xd8f9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8f9d[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xd8f9('0x0'));var util=require(_0xd8f9('0x1'));var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8f9('0x4'));var db=require(_0xd8f9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8f9('0x6'))(_0xd8f9('0x7'));var config=require('../../config/environment');var jayson=require(_0xd8f9('0x8'));var client=jayson[_0xd8f9('0x9')][_0xd8f9('0xa')]({'port':0x232a});config[_0xd8f9('0xb')]=_[_0xd8f9('0xc')](config[_0xd8f9('0xb')],{'host':_0xd8f9('0xd'),'port':0x18eb});var socket=require(_0xd8f9('0xe'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xd8f9('0xf')](socket);function respondWithRpcPromise(_0x2e0d72,_0xd7662b,_0x3e6dc0){return new BPromise(function(_0x260840,_0x22a744){return client['request'](_0x2e0d72,_0x3e6dc0)[_0xd8f9('0x10')](function(_0x5b972c){logger['info'](_0xd8f9('0x11'),_0xd7662b,_0xd8f9('0x12'));logger[_0xd8f9('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd7662b,'request\x20sent',JSON[_0xd8f9('0x14')](_0x5b972c));if(_0x5b972c[_0xd8f9('0x15')]){if(_0x5b972c['error'][_0xd8f9('0x16')]===0x1f4){logger['error'](_0xd8f9('0x11'),_0xd7662b,_0x5b972c[_0xd8f9('0x15')][_0xd8f9('0x17')]);return _0x22a744(_0x5b972c['error']['message']);}logger[_0xd8f9('0x15')](_0xd8f9('0x11'),_0xd7662b,_0x5b972c[_0xd8f9('0x15')][_0xd8f9('0x17')]);return _0x260840(_0x5b972c[_0xd8f9('0x15')][_0xd8f9('0x17')]);}else{logger[_0xd8f9('0x18')](_0xd8f9('0x11'),_0xd7662b,_0xd8f9('0x12'));_0x260840(_0x5b972c['result']['message']);}})[_0xd8f9('0x19')](function(_0x200319){logger[_0xd8f9('0x15')]('SmsMessage,\x20%s,\x20%s',_0xd7662b,_0x200319);_0x22a744(_0x200319);});});}exports[_0xd8f9('0x1a')]=function(_0x5dad9b){var _0x48881b=this;return new Promise(function(_0x23aa6f,_0x5a9476){return db[_0xd8f9('0x1b')][_0xd8f9('0x1c')](_0x5dad9b[_0xd8f9('0x1d')],{'raw':_0x5dad9b[_0xd8f9('0x1e')]?_0x5dad9b[_0xd8f9('0x1e')][_0xd8f9('0x1f')]===undefined?!![]:![]:!![]})[_0xd8f9('0x10')](function(_0x5abb72){logger[_0xd8f9('0x18')](_0xd8f9('0x1a'),_0x5dad9b);logger[_0xd8f9('0x13')](_0xd8f9('0x1a'),_0x5dad9b,JSON[_0xd8f9('0x14')](_0x5abb72));_0x23aa6f(_0x5abb72);})['catch'](function(_0x424d1d){logger['error'](_0xd8f9('0x1a'),_0x424d1d[_0xd8f9('0x17')],_0x5dad9b);_0x5a9476(_0x48881b[_0xd8f9('0x15')](0x1f4,_0x424d1d['message']));});});}; \ No newline at end of file +var _0x747e=['redis','localhost','socket.io-emitter','./smsMessage.socket','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x2c0cb6,_0x58d6b2){var _0x43f396=function(_0x15a7aa){while(--_0x15a7aa){_0x2c0cb6['push'](_0x2c0cb6['shift']());}};_0x43f396(++_0x58d6b2);}(_0x747e,0x19c));var _0xe747=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x747e[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0xe747('0x0'));var util=require(_0xe747('0x1'));var moment=require('moment');var BPromise=require(_0xe747('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe747('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe747('0x4'))(_0xe747('0x5'));var config=require(_0xe747('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe747('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe747('0x8')],{'host':_0xe747('0x9'),'port':0x18eb});var socket=require(_0xe747('0xa'))(new Redis(config[_0xe747('0x8')]));require(_0xe747('0xb'))['register'](socket);function respondWithRpcPromise(_0x49f75a,_0x558452,_0x2104ea){return new BPromise(function(_0x1e59d9,_0x506c68){return client['request'](_0x49f75a,_0x2104ea)['then'](function(_0x579713){logger[_0xe747('0xc')](_0xe747('0xd'),_0x558452,'request\x20sent');logger['debug'](_0xe747('0xe'),_0x558452,_0xe747('0xf'),JSON[_0xe747('0x10')](_0x579713));if(_0x579713[_0xe747('0x11')]){if(_0x579713[_0xe747('0x11')][_0xe747('0x12')]===0x1f4){logger[_0xe747('0x11')](_0xe747('0xd'),_0x558452,_0x579713[_0xe747('0x11')]['message']);return _0x506c68(_0x579713[_0xe747('0x11')][_0xe747('0x13')]);}logger['error'](_0xe747('0xd'),_0x558452,_0x579713[_0xe747('0x11')][_0xe747('0x13')]);return _0x1e59d9(_0x579713[_0xe747('0x11')]['message']);}else{logger[_0xe747('0xc')](_0xe747('0xd'),_0x558452,_0xe747('0xf'));_0x1e59d9(_0x579713['result'][_0xe747('0x13')]);}})[_0xe747('0x14')](function(_0x95435){logger['error'](_0xe747('0xd'),_0x558452,_0x95435);_0x506c68(_0x95435);});});}exports[_0xe747('0x15')]=function(_0x35460a){var _0x33cd26=this;return new Promise(function(_0x5c4286,_0x40bb27){return db[_0xe747('0x16')][_0xe747('0x17')](_0x35460a[_0xe747('0x18')],{'raw':_0x35460a[_0xe747('0x19')]?_0x35460a[_0xe747('0x19')][_0xe747('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1721a7){logger[_0xe747('0xc')](_0xe747('0x15'),_0x35460a);logger[_0xe747('0x1b')](_0xe747('0x15'),_0x35460a,JSON[_0xe747('0x10')](_0x1721a7));_0x5c4286(_0x1721a7);})['catch'](function(_0x3eb036){logger[_0xe747('0x11')]('CreateSmsMessage',_0x3eb036[_0xe747('0x13')],_0x35460a);_0x40bb27(_0x33cd26[_0xe747('0x11')](0x1f4,_0x3eb036['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ce66eb5..906733a 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 _0x7212=['update','emit','removeListener','smsMessage:','save','remove'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x7212,0x160));var _0x2721=function(_0x3173c0,_0x5d4d5d){_0x3173c0=_0x3173c0-0x0;var _0x3d6402=_0x7212[_0x3173c0];return _0x3d6402;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x2721('0x0'),_0x2721('0x1'),_0x2721('0x2')];function createListener(_0x2b8fcd,_0x41b314){return function(_0x342a06){_0x41b314[_0x2721('0x3')](_0x2b8fcd,_0x342a06);};}function removeListener(_0x4a2d1c,_0x461022){return function(){SmsMessageEvents[_0x2721('0x4')](_0x4a2d1c,_0x461022);};}exports['register']=function(_0x2781be){for(var _0x3b7022=0x0,_0x21131d=events['length'];_0x3b7022<_0x21131d;_0x3b7022++){var _0x43ce6d=events[_0x3b7022];var _0x3ef21d=createListener(_0x2721('0x5')+_0x43ce6d,_0x2781be);SmsMessageEvents['on'](_0x43ce6d,_0x3ef21d);}}; \ No newline at end of file +var _0x4e4e=['removeListener','register','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x563190,_0x248c05){var _0x5213dc=function(_0xc3d5f4){while(--_0xc3d5f4){_0x563190['push'](_0x563190['shift']());}};_0x5213dc(++_0x248c05);}(_0x4e4e,0x115));var _0xe4e4=function(_0x184111,_0x225454){_0x184111=_0x184111-0x0;var _0x2df0a6=_0x4e4e[_0x184111];return _0x2df0a6;};'use strict';var SmsMessageEvents=require(_0xe4e4('0x0'));var events=['save',_0xe4e4('0x1'),_0xe4e4('0x2')];function createListener(_0xd533e3,_0x168fd3){return function(_0x5a50f5){_0x168fd3['emit'](_0xd533e3,_0x5a50f5);};}function removeListener(_0x490fe0,_0x536cb6){return function(){SmsMessageEvents[_0xe4e4('0x3')](_0x490fe0,_0x536cb6);};}exports[_0xe4e4('0x4')]=function(_0x18dbe7){for(var _0x5bcc58=0x0,_0x4f240d=events[_0xe4e4('0x5')];_0x5bcc58<_0x4f240d;_0x5bcc58++){var _0x5d892f=events[_0x5bcc58];var _0x4f00f0=createListener(_0xe4e4('0x6')+_0x5d892f,_0x18dbe7);SmsMessageEvents['on'](_0x5d892f,_0x4f00f0);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7f2f2f4..814f2f1 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 _0xa975=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xa975,0x13a));var _0x5a97=function(_0x144da7,_0xad1e22){_0x144da7=_0x144da7-0x0;var _0x3dcfdd=_0xa975[_0x144da7];return _0x3dcfdd;};'use strict';var multer=require(_0x5a97('0x0'));var util=require(_0x5a97('0x1'));var path=require(_0x5a97('0x2'));var timeout=require(_0x5a97('0x3'));var express=require(_0x5a97('0x4'));var router=express[_0x5a97('0x5')]();var fs_extra=require(_0x5a97('0x6'));var auth=require(_0x5a97('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5a97('0x8'));var controller=require(_0x5a97('0x9'));router[_0x5a97('0xa')]('/',auth[_0x5a97('0xb')](),controller[_0x5a97('0xc')]);router[_0x5a97('0xa')](_0x5a97('0xd'),auth[_0x5a97('0xb')](),controller[_0x5a97('0xe')]);router[_0x5a97('0xa')]('/:id',auth[_0x5a97('0xb')](),controller[_0x5a97('0xf')]);router[_0x5a97('0xa')](_0x5a97('0x10'),auth[_0x5a97('0xb')](),controller[_0x5a97('0x11')]);router[_0x5a97('0xa')](_0x5a97('0x12'),auth[_0x5a97('0xb')](),controller[_0x5a97('0x13')]);router[_0x5a97('0xa')](_0x5a97('0x14'),auth[_0x5a97('0xb')](),controller['getAgents']);router[_0x5a97('0x15')]('/',auth[_0x5a97('0xb')](),controller['create']);router[_0x5a97('0x15')]('/:id/teams',auth[_0x5a97('0xb')](),controller[_0x5a97('0x16')]);router[_0x5a97('0x15')]('/:id/users',auth[_0x5a97('0xb')](),controller[_0x5a97('0x17')]);router['put'](_0x5a97('0x18'),auth[_0x5a97('0xb')](),controller[_0x5a97('0x19')]);router[_0x5a97('0x1a')](_0x5a97('0x18'),auth[_0x5a97('0xb')](),controller['destroy']);router[_0x5a97('0x1a')](_0x5a97('0x12'),auth[_0x5a97('0xb')](),controller[_0x5a97('0x1b')]);router['delete'](_0x5a97('0x14'),auth[_0x5a97('0xb')](),controller[_0x5a97('0x1c')]);module[_0x5a97('0x1d')]=router; \ No newline at end of file +var _0xe240=['addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','getAgents','create','post'];(function(_0x1179c5,_0x47e895){var _0x331854=function(_0x2b1c33){while(--_0x2b1c33){_0x1179c5['push'](_0x1179c5['shift']());}};_0x331854(++_0x47e895);}(_0xe240,0x14d));var _0x0e24=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xe240[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require(_0x0e24('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e24('0x1'));var router=express['Router']();var fs_extra=require(_0x0e24('0x2'));var auth=require(_0x0e24('0x3'));var interaction=require(_0x0e24('0x4'));var config=require('../../config/environment');var controller=require(_0x0e24('0x5'));router[_0x0e24('0x6')]('/',auth[_0x0e24('0x7')](),controller[_0x0e24('0x8')]);router[_0x0e24('0x6')](_0x0e24('0x9'),auth[_0x0e24('0x7')](),controller[_0x0e24('0xa')]);router[_0x0e24('0x6')](_0x0e24('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0e24('0xc'),auth['isAuthenticated'](),controller[_0x0e24('0xd')]);router['get']('/:id/teams',auth[_0x0e24('0x7')](),controller[_0x0e24('0xe')]);router[_0x0e24('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x0e24('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e24('0x10')]);router[_0x0e24('0x11')]('/:id/teams',auth[_0x0e24('0x7')](),controller[_0x0e24('0x12')]);router[_0x0e24('0x11')]('/:id/users',auth[_0x0e24('0x7')](),controller[_0x0e24('0x13')]);router[_0x0e24('0x14')](_0x0e24('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0e24('0x15')](_0x0e24('0xb'),auth[_0x0e24('0x7')](),controller[_0x0e24('0x16')]);router[_0x0e24('0x15')](_0x0e24('0x17'),auth['isAuthenticated'](),controller[_0x0e24('0x18')]);router[_0x0e24('0x15')]('/:id/users',auth[_0x0e24('0x7')](),controller[_0x0e24('0x19')]);module[_0x0e24('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7fd0a4a..75ec6c8 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 _0x830d=['beepall','roundrobin','sequelize','exports','INTEGER','rrmemory'];(function(_0x2c7e12,_0x1cea74){var _0x16bffa=function(_0x473692){while(--_0x473692){_0x2c7e12['push'](_0x2c7e12['shift']());}};_0x16bffa(++_0x1cea74);}(_0x830d,0x134));var _0xd830=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x830d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd830('0x0'));module[_0xd830('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd830('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd830('0x3'),_0xd830('0x4'),_0xd830('0x5'))}}; \ No newline at end of file +var _0xc68b=['roundrobin','exports','STRING','name','ENUM','rrmemory'];(function(_0x1a93a5,_0x13f256){var _0x4893a2=function(_0x4a176c){while(--_0x4a176c){_0x1a93a5['push'](_0x1a93a5['shift']());}};_0x4893a2(++_0x13f256);}(_0xc68b,0x7f));var _0xbc68=function(_0x118e05,_0x29a45f){_0x118e05=_0x118e05-0x0;var _0x5be5c7=_0xc68b[_0x118e05];return _0x5be5c7;};'use strict';var Sequelize=require('sequelize');module[_0xbc68('0x0')]={'name':{'type':Sequelize[_0xbc68('0x1')],'unique':_0xbc68('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbc68('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbc68('0x3')](_0xbc68('0x4'),'beepall',_0xbc68('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 3b2e408..9772344 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 _0x9f8d=['SIP','Team','getTeams','ids','Agents','voicePause','sequelize','transaction','each','UserSmsQueue','findOrCreate','forEach','emit','userSmsQueue:save','select','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','every','TeamId','includes','union','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','set','Content-Range','reject','save','update','then','destroy','SmsQueues','UserProfileResource','sendStatus','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','SmsQueueId','User','findAndCountAll','smsPause','updatedAt','createdAt','format','%s/%s'];(function(_0x429c0c,_0x560f5b){var _0x45c8a5=function(_0xf23261){while(--_0xf23261){_0x429c0c['push'](_0x429c0c['shift']());}};_0x45c8a5(++_0x560f5b);}(_0x9f8d,0xb0));var _0xd9f8=function(_0x7d0f6c,_0x506122){_0x7d0f6c=_0x7d0f6c-0x0;var _0x872f75=_0x9f8d[_0x7d0f6c];return _0x872f75;};'use strict';var emlformat=require(_0xd9f8('0x0'));var rimraf=require(_0xd9f8('0x1'));var zipdir=require(_0xd9f8('0x2'));var jsonpatch=require(_0xd9f8('0x3'));var rp=require(_0xd9f8('0x4'));var moment=require(_0xd9f8('0x5'));var BPromise=require(_0xd9f8('0x6'));var Mustache=require(_0xd9f8('0x7'));var util=require(_0xd9f8('0x8'));var path=require(_0xd9f8('0x9'));var sox=require(_0xd9f8('0xa'));var csv=require(_0xd9f8('0xb'));var ejs=require(_0xd9f8('0xc'));var fs=require('fs');var fs_extra=require(_0xd9f8('0xd'));var _=require(_0xd9f8('0xe'));var squel=require(_0xd9f8('0xf'));var crypto=require(_0xd9f8('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd9f8('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd9f8('0x12'));var Papa=require(_0xd9f8('0x13'));var Redis=require(_0xd9f8('0x14'));var authService=require(_0xd9f8('0x15'));var qs=require(_0xd9f8('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9f8('0x17'));var logger=require('../../config/logger')(_0xd9f8('0x18'));var utils=require(_0xd9f8('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd9f8('0x1a'))['db'];config[_0xd9f8('0x1b')]=_['defaults'](config[_0xd9f8('0x1b')],{'host':_0xd9f8('0x1c'),'port':0x18eb});var socket=require(_0xd9f8('0x1d'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xd9f8('0x1e')](socket);function respondWithStatusCode(_0x16d094,_0x50d9c4){_0x50d9c4=_0x50d9c4||0xcc;return function(_0x549eae){if(_0x549eae){return _0x16d094['sendStatus'](_0x50d9c4);}return _0x16d094[_0xd9f8('0x1f')](_0x50d9c4)[_0xd9f8('0x20')]();};}function respondWithResult(_0x57f884,_0x5a5f84){_0x5a5f84=_0x5a5f84||0xc8;return function(_0x41773b){if(_0x41773b){return _0x57f884[_0xd9f8('0x1f')](_0x5a5f84)[_0xd9f8('0x21')](_0x41773b);}};}function respondWithFilteredResult(_0x12f90f,_0x54cd93){return function(_0x2ac64a){if(_0x2ac64a){var _0x284a3a=typeof _0x54cd93[_0xd9f8('0x22')]==='undefined'&&typeof _0x54cd93[_0xd9f8('0x23')]===_0xd9f8('0x24');var _0xbedfb3=_0x2ac64a['count'];var _0x17827f=_0x284a3a?0x0:_0x54cd93['offset'];var _0x28dcb5=_0x284a3a?_0x2ac64a['count']:_0x54cd93[_0xd9f8('0x22')]+_0x54cd93[_0xd9f8('0x23')];var _0x2e7858;if(_0x28dcb5>=_0xbedfb3){_0x28dcb5=_0xbedfb3;_0x2e7858=0xc8;}else{_0x2e7858=0xce;}_0x12f90f[_0xd9f8('0x1f')](_0x2e7858);return _0x12f90f[_0xd9f8('0x25')](_0xd9f8('0x26'),_0x17827f+'-'+_0x28dcb5+'/'+_0xbedfb3)[_0xd9f8('0x21')](_0x2ac64a);}return null;};}function patchUpdates(_0x4d42cf){return function(_0x25bd5b){try{jsonpatch['apply'](_0x25bd5b,_0x4d42cf,!![]);}catch(_0x50896e){return BPromise[_0xd9f8('0x27')](_0x50896e);}return _0x25bd5b[_0xd9f8('0x28')]();};}function saveUpdates(_0x6df611,_0x24f9ff){return function(_0xdf2ed5){if(_0xdf2ed5){return _0xdf2ed5[_0xd9f8('0x29')](_0x6df611)[_0xd9f8('0x2a')](function(_0x27b134){return _0x27b134;});}return null;};}function removeEntity(_0x41e4a2,_0x11b7de){return function(_0x59b4b0){if(_0x59b4b0){return _0x59b4b0[_0xd9f8('0x2b')]()[_0xd9f8('0x2a')](function(){var _0x198922=_0x59b4b0['get']({'plain':!![]});var _0x2c402b=_0xd9f8('0x2c');return db[_0xd9f8('0x2d')][_0xd9f8('0x2b')]({'where':{'type':_0x2c402b,'resourceId':_0x198922['id']}})['then'](function(){return _0x59b4b0;});})['then'](function(){_0x41e4a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x379d68,_0x237cd8){return function(_0xfbccb5){if(!_0xfbccb5){_0x379d68[_0xd9f8('0x2e')](0x194);}return _0xfbccb5;};}function handleError(_0x43bdba,_0xc39e70){_0xc39e70=_0xc39e70||0x1f4;return function(_0x4f980f){logger[_0xd9f8('0x2f')](_0x4f980f[_0xd9f8('0x30')]);if(_0x4f980f['name']){delete _0x4f980f[_0xd9f8('0x31')];}_0x43bdba[_0xd9f8('0x1f')](_0xc39e70)[_0xd9f8('0x32')](_0x4f980f);};}exports[_0xd9f8('0x33')]=function(_0x9f26ee,_0x1484be){var _0x4b0329={},_0x3bc7ff={},_0x5ee077={'count':0x0,'rows':[]};var _0x112740=_['map'](db[_0xd9f8('0x34')][_0xd9f8('0x35')],function(_0x72221){return{'name':_0x72221[_0xd9f8('0x36')],'type':_0x72221[_0xd9f8('0x37')][_0xd9f8('0x38')]};});_0x3bc7ff[_0xd9f8('0x39')]=_['map'](_0x112740,_0xd9f8('0x31'));_0x3bc7ff[_0xd9f8('0x3a')]=_[_0xd9f8('0x3b')](_0x9f26ee[_0xd9f8('0x3a')]);_0x3bc7ff[_0xd9f8('0x3c')]=_['intersection'](_0x3bc7ff[_0xd9f8('0x39')],_0x3bc7ff[_0xd9f8('0x3a')]);_0x4b0329['attributes']=_[_0xd9f8('0x3d')](_0x3bc7ff[_0xd9f8('0x39')],qs[_0xd9f8('0x3e')](_0x9f26ee[_0xd9f8('0x3a')][_0xd9f8('0x3e')]));_0x4b0329[_0xd9f8('0x3f')]=_0x4b0329['attributes'][_0xd9f8('0x40')]?_0x4b0329[_0xd9f8('0x3f')]:_0x3bc7ff[_0xd9f8('0x39')];if(!_0x9f26ee[_0xd9f8('0x3a')][_0xd9f8('0x41')]('nolimit')){_0x4b0329[_0xd9f8('0x23')]=qs[_0xd9f8('0x23')](_0x9f26ee[_0xd9f8('0x3a')][_0xd9f8('0x23')]);_0x4b0329[_0xd9f8('0x22')]=qs['offset'](_0x9f26ee[_0xd9f8('0x3a')][_0xd9f8('0x22')]);}_0x4b0329[_0xd9f8('0x42')]=qs[_0xd9f8('0x43')](_0x9f26ee[_0xd9f8('0x3a')][_0xd9f8('0x43')]);_0x4b0329['where']=qs[_0xd9f8('0x3c')](_[_0xd9f8('0x44')](_0x9f26ee[_0xd9f8('0x3a')],_0x3bc7ff[_0xd9f8('0x3c')]),_0x112740);if(_0x9f26ee[_0xd9f8('0x3a')][_0xd9f8('0x45')]){_0x4b0329[_0xd9f8('0x46')]=_[_0xd9f8('0x47')](_0x4b0329['where'],{'$or':_[_0xd9f8('0x48')](_0x112740,function(_0x12a3ef){if(_0x12a3ef['type']!=='VIRTUAL'){var _0x243efa={};_0x243efa[_0x12a3ef[_0xd9f8('0x31')]]={'$like':'%'+_0x9f26ee['query'][_0xd9f8('0x45')]+'%'};return _0x243efa;}})});}_0x4b0329=_[_0xd9f8('0x47')]({},_0x4b0329,_0x9f26ee[_0xd9f8('0x49')]);var _0x5ab611={'where':_0x4b0329[_0xd9f8('0x46')]};return db[_0xd9f8('0x34')][_0xd9f8('0x4a')](_0x5ab611)['then'](function(_0xf7f1b2){_0x5ee077[_0xd9f8('0x4a')]=_0xf7f1b2;if(_0x9f26ee[_0xd9f8('0x3a')][_0xd9f8('0x4b')]){_0x4b0329[_0xd9f8('0x4c')]=[{'all':!![]}];}return db[_0xd9f8('0x34')][_0xd9f8('0x4d')](_0x4b0329);})[_0xd9f8('0x2a')](function(_0x1c9d87){_0x5ee077[_0xd9f8('0x4e')]=_0x1c9d87;return _0x5ee077;})[_0xd9f8('0x2a')](respondWithFilteredResult(_0x1484be,_0x4b0329))[_0xd9f8('0x4f')](handleError(_0x1484be,null));};exports[_0xd9f8('0x50')]=function(_0x23684b,_0x548b39){var _0x1b24c9={'raw':!![],'where':{'id':_0x23684b[_0xd9f8('0x51')]['id']}},_0x20f023={};_0x20f023['model']=_[_0xd9f8('0x3b')](db[_0xd9f8('0x34')][_0xd9f8('0x35')]);_0x20f023[_0xd9f8('0x3a')]=_[_0xd9f8('0x3b')](_0x23684b[_0xd9f8('0x3a')]);_0x20f023[_0xd9f8('0x3c')]=_[_0xd9f8('0x3d')](_0x20f023[_0xd9f8('0x39')],_0x20f023[_0xd9f8('0x3a')]);_0x1b24c9[_0xd9f8('0x3f')]=_[_0xd9f8('0x3d')](_0x20f023[_0xd9f8('0x39')],qs[_0xd9f8('0x3e')](_0x23684b[_0xd9f8('0x3a')][_0xd9f8('0x3e')]));_0x1b24c9['attributes']=_0x1b24c9[_0xd9f8('0x3f')][_0xd9f8('0x40')]?_0x1b24c9['attributes']:_0x20f023['model'];if(_0x23684b['query'][_0xd9f8('0x4b')]){_0x1b24c9['include']=[{'all':!![]}];}_0x1b24c9=_[_0xd9f8('0x47')]({},_0x1b24c9,_0x23684b[_0xd9f8('0x49')]);return db[_0xd9f8('0x34')][_0xd9f8('0x52')](_0x1b24c9)[_0xd9f8('0x2a')](handleEntityNotFound(_0x548b39,null))['then'](respondWithResult(_0x548b39,null))[_0xd9f8('0x4f')](handleError(_0x548b39,null));};exports[_0xd9f8('0x53')]=function(_0x58e39a,_0x18569c){return db[_0xd9f8('0x34')]['create'](_0x58e39a[_0xd9f8('0x54')],{})['then'](function(_0x3f5df1){var _0x5b2468=_0x58e39a[_0xd9f8('0x55')]['get']({'plain':!![]});if(!_0x5b2468)throw new Error(_0xd9f8('0x56'));if(_0x5b2468[_0xd9f8('0x57')]===_0xd9f8('0x55')){var _0x364d73=_0x3f5df1[_0xd9f8('0x58')]({'plain':!![]});var _0x1cfcce=_0xd9f8('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x1cfcce,'userProfileId':_0x5b2468[_0xd9f8('0x59')]},'raw':!![]})['then'](function(_0x9d81e7){if(_0x9d81e7&&_0x9d81e7[_0xd9f8('0x5a')]===0x0){return db[_0xd9f8('0x2d')][_0xd9f8('0x53')]({'name':_0x364d73[_0xd9f8('0x31')],'resourceId':_0x364d73['id'],'type':_0x9d81e7[_0xd9f8('0x31')],'sectionId':_0x9d81e7['id']},{})[_0xd9f8('0x2a')](function(){return _0x3f5df1;});}else{return _0x3f5df1;}})[_0xd9f8('0x4f')](function(_0x316d46){logger['error'](_0xd9f8('0x5b'),_0x316d46);throw _0x316d46;});}return _0x3f5df1;})[_0xd9f8('0x2a')](respondWithResult(_0x18569c,0xc9))[_0xd9f8('0x4f')](handleError(_0x18569c,null));};exports[_0xd9f8('0x29')]=function(_0x4d63f8,_0x3c235c){if(_0x4d63f8[_0xd9f8('0x54')]['id']){delete _0x4d63f8['body']['id'];}return db[_0xd9f8('0x34')][_0xd9f8('0x52')]({'where':{'id':_0x4d63f8[_0xd9f8('0x51')]['id']}})[_0xd9f8('0x2a')](handleEntityNotFound(_0x3c235c,null))['then'](saveUpdates(_0x4d63f8[_0xd9f8('0x54')],null))['then'](respondWithResult(_0x3c235c,null))['catch'](handleError(_0x3c235c,null));};exports['destroy']=function(_0x424a0b,_0x4cdc40){return db[_0xd9f8('0x34')]['find']({'where':{'id':_0x424a0b[_0xd9f8('0x51')]['id']}})[_0xd9f8('0x2a')](handleEntityNotFound(_0x4cdc40,null))['then'](removeEntity(_0x4cdc40,null))[_0xd9f8('0x4f')](handleError(_0x4cdc40,null));};exports[_0xd9f8('0x5c')]=function(_0x49ff1e,_0x3e6da8){return db[_0xd9f8('0x34')][_0xd9f8('0x5c')]()[_0xd9f8('0x2a')](respondWithResult(_0x3e6da8,null))[_0xd9f8('0x4f')](handleError(_0x3e6da8,null));};exports[_0xd9f8('0x5d')]=function(_0x1d3bb3,_0x452b03,_0xc6d700){var _0x566692={'raw':!![],'where':{}},_0x56e119={},_0x1b6bfc;return db[_0xd9f8('0x34')][_0xd9f8('0x5e')]({'where':{'id':_0x1d3bb3[_0xd9f8('0x51')]['id']}})[_0xd9f8('0x2a')](handleEntityNotFound(_0x452b03,null))[_0xd9f8('0x2a')](function(_0xb94796){if(_0xb94796){_0x1b6bfc=_0xb94796[_0xd9f8('0x58')]({'plain':!![]});_0x56e119[_0xd9f8('0x39')]=_['keys'](db['UserSmsQueue'][_0xd9f8('0x35')]);_0x56e119[_0xd9f8('0x3a')]=_['keys'](_0x1d3bb3[_0xd9f8('0x3a')]);_0x56e119[_0xd9f8('0x3c')]=_['intersection'](_0x56e119[_0xd9f8('0x39')],_0x56e119[_0xd9f8('0x3a')]);_0x566692[_0xd9f8('0x3f')]=_[_0xd9f8('0x3d')](_0x56e119[_0xd9f8('0x39')],qs[_0xd9f8('0x3e')](_0x1d3bb3[_0xd9f8('0x3a')][_0xd9f8('0x3e')]));_0x566692[_0xd9f8('0x3f')]=_0x566692[_0xd9f8('0x3f')][_0xd9f8('0x40')]?_0x566692['attributes']:_0x56e119[_0xd9f8('0x39')];if(!_0x1d3bb3[_0xd9f8('0x3a')][_0xd9f8('0x41')](_0xd9f8('0x5f'))){_0x566692[_0xd9f8('0x23')]=qs[_0xd9f8('0x23')](_0x1d3bb3[_0xd9f8('0x3a')][_0xd9f8('0x23')]);_0x566692[_0xd9f8('0x22')]=qs[_0xd9f8('0x22')](_0x1d3bb3['query'][_0xd9f8('0x22')]);}_0x566692['order']=qs[_0xd9f8('0x43')](_0x1d3bb3[_0xd9f8('0x3a')][_0xd9f8('0x43')]);_0x566692[_0xd9f8('0x46')]=qs[_0xd9f8('0x3c')](_[_0xd9f8('0x44')](_0x1d3bb3[_0xd9f8('0x3a')],_0x56e119['filters']));_0x566692[_0xd9f8('0x46')][_0xd9f8('0x60')]=_0xb94796['id'];if(_0x1d3bb3[_0xd9f8('0x3a')][_0xd9f8('0x45')]){_0x566692[_0xd9f8('0x46')]=_[_0xd9f8('0x47')](_0x566692[_0xd9f8('0x46')],{'$or':_['map'](_0x566692[_0xd9f8('0x3f')],function(_0x506574){var _0xdeddd8={};_0xdeddd8[_0x506574]={'$like':'%'+_0x1d3bb3[_0xd9f8('0x3a')][_0xd9f8('0x45')]+'%'};return _0xdeddd8;})});}_0x566692=_[_0xd9f8('0x47')]({},_0x566692,_0x1d3bb3[_0xd9f8('0x49')]);return db['UserSmsQueue']['findAll'](_0x566692);}})[_0xd9f8('0x2a')](function(_0x7eec70){if(_0x7eec70){return db[_0xd9f8('0x61')][_0xd9f8('0x62')]({'where':{'id':_['map'](_0x7eec70,'UserId'),'role':'agent'},'attributes':['id',_0xd9f8('0x31'),_0xd9f8('0x63'),_0xd9f8('0x64'),_0xd9f8('0x65')]});}})[_0xd9f8('0x2a')](function(_0x533a8b){if(_0x533a8b){return{'count':_0x533a8b[_0xd9f8('0x4a')],'rows':_['map'](_0x533a8b[_0xd9f8('0x4e')],function(_0x843e2b){return{'membername':_0x843e2b[_0xd9f8('0x31')],'UserId':_0x843e2b['id'],'queue_name':_0x1b6bfc[_0xd9f8('0x31')],'SmsQueueId':_0x1b6bfc['id'],'interface':util[_0xd9f8('0x66')](_0xd9f8('0x67'),_0xd9f8('0x68'),_0x843e2b[_0xd9f8('0x31')]),'penalty':0x0,'paused':_0x843e2b[_0xd9f8('0x63')],'createdAt':_0x843e2b['createdAt'],'updatedAt':_0x843e2b[_0xd9f8('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9f8('0x2a')](respondWithFilteredResult(_0x452b03,_0x566692))['catch'](handleError(_0x452b03,null));};exports['getTeams']=function(_0x15bffc,_0x50f357,_0x2dcea4){var _0x315e1f={};var _0x1d81c6={};var _0x198ddd;var _0x4fe01d;return db['SmsQueue'][_0xd9f8('0x5e')]({'where':{'id':_0x15bffc[_0xd9f8('0x51')]['id']}})[_0xd9f8('0x2a')](handleEntityNotFound(_0x50f357,null))[_0xd9f8('0x2a')](function(_0x33ef5a){if(_0x33ef5a){_0x198ddd=_0x33ef5a;_0x1d81c6[_0xd9f8('0x39')]=_[_0xd9f8('0x3b')](db[_0xd9f8('0x69')][_0xd9f8('0x35')]);_0x1d81c6[_0xd9f8('0x3a')]=_[_0xd9f8('0x3b')](_0x15bffc[_0xd9f8('0x3a')]);_0x1d81c6[_0xd9f8('0x3c')]=_[_0xd9f8('0x3d')](_0x1d81c6['model'],_0x1d81c6['query']);_0x315e1f[_0xd9f8('0x3f')]=_['intersection'](_0x1d81c6[_0xd9f8('0x39')],qs['fields'](_0x15bffc[_0xd9f8('0x3a')]['fields']));_0x315e1f[_0xd9f8('0x3f')]=_0x315e1f[_0xd9f8('0x3f')][_0xd9f8('0x40')]?_0x315e1f[_0xd9f8('0x3f')]:_0x1d81c6[_0xd9f8('0x39')];_0x315e1f['order']=qs['sort'](_0x15bffc[_0xd9f8('0x3a')][_0xd9f8('0x43')]);_0x315e1f['where']=qs[_0xd9f8('0x3c')](_['pick'](_0x15bffc['query'],_0x1d81c6[_0xd9f8('0x3c')]));if(_0x15bffc[_0xd9f8('0x3a')]['filter']){_0x315e1f[_0xd9f8('0x46')]=_['merge'](_0x315e1f[_0xd9f8('0x46')],{'$or':_[_0xd9f8('0x48')](_0x315e1f[_0xd9f8('0x3f')],function(_0x151614){var _0xb8e342={};_0xb8e342[_0x151614]={'$like':'%'+_0x15bffc['query'][_0xd9f8('0x45')]+'%'};return _0xb8e342;})});}_0x315e1f=_[_0xd9f8('0x47')]({},_0x315e1f,_0x15bffc['options']);return _0x198ddd[_0xd9f8('0x6a')](_0x315e1f);}})[_0xd9f8('0x2a')](function(_0x4f6a44){if(_0x4f6a44){_0x4fe01d=_0x4f6a44[_0xd9f8('0x40')];if(!_0x15bffc[_0xd9f8('0x3a')][_0xd9f8('0x41')](_0xd9f8('0x5f'))){_0x315e1f[_0xd9f8('0x23')]=qs['limit'](_0x15bffc['query'][_0xd9f8('0x23')]);_0x315e1f[_0xd9f8('0x22')]=qs['offset'](_0x15bffc[_0xd9f8('0x3a')][_0xd9f8('0x22')]);}return _0x198ddd[_0xd9f8('0x6a')](_0x315e1f);}})[_0xd9f8('0x2a')](function(_0xca4a1c){if(_0xca4a1c){return _0xca4a1c?{'count':_0x4fe01d,'rows':_0xca4a1c}:null;}})['then'](respondWithResult(_0x50f357,null))[_0xd9f8('0x4f')](handleError(_0x50f357,null));};exports['addTeams']=function(_0x43b7f7,_0x2fc42e,_0x5d337d){var _0x241448=_0x43b7f7[_0xd9f8('0x54')][_0xd9f8('0x6b')];return db[_0xd9f8('0x69')][_0xd9f8('0x4d')]({'where':{'id':_0x241448},'attributes':['id'],'include':[{'model':db[_0xd9f8('0x61')],'as':_0xd9f8('0x6c'),'attributes':['id',_0xd9f8('0x31'),'online',_0xd9f8('0x6d'),'interface'],'raw':!![]}]})[_0xd9f8('0x2a')](function(_0x1344a4){if(_0x1344a4){var _0x543293=_['flatMap'](_0x1344a4,function(_0x3e0058){var _0x3c4bef=_0x3e0058['get']({'plain':!![]});return _0x3c4bef['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x43b7f7[_0xd9f8('0x51')]['id']}})[_0xd9f8('0x2a')](function(_0x3e3e92){return db[_0xd9f8('0x6e')][_0xd9f8('0x6f')](function(_0xdcae8f){return _0x3e3e92['addTeams'](_0x241448,{'transaction':_0xdcae8f})['then'](function(){return BPromise[_0xd9f8('0x70')](_0x543293,function(_0x1453e6){return db[_0xd9f8('0x71')][_0xd9f8('0x72')]({'where':{'UserId':_0x1453e6['id'],'SmsQueueId':_0x43b7f7[_0xd9f8('0x51')]['id']},'transaction':_0xdcae8f});});})[_0xd9f8('0x2a')](function(){_0x543293[_0xd9f8('0x73')](function(_0x18d5d9){socket[_0xd9f8('0x74')](_0xd9f8('0x75'),{'UserId':_0x18d5d9['id'],'SmsQueueId':_0x3e3e92['id']});});});});});}})[_0xd9f8('0x2a')](respondWithStatusCode(_0x2fc42e,null))[_0xd9f8('0x4f')](handleError(_0x2fc42e,null));};exports['removeTeams']=function(_0x1da24a,_0x36934f,_0x616ff1){return db[_0xd9f8('0x69')][_0xd9f8('0x4d')]({'where':{'id':_0x1da24a[_0xd9f8('0x3a')][_0xd9f8('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xd9f8('0x61')],'as':_0xd9f8('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xd9f8('0x2a')](handleEntityNotFound(_0x36934f,null))[_0xd9f8('0x2a')](function(_0x5d0f49){var _0x445ede=_['map'](_0x5d0f49,'id');var _0x31ecbb=[];var _0x5437be=[];var _0x2e5e38=squel[_0xd9f8('0x76')]();_0x2e5e38[_0xd9f8('0x77')]('tq.TeamId')['from']('team_has_sms_queues','tq')[_0xd9f8('0x78')](_0xd9f8('0x79'),'ut',_0xd9f8('0x7a'))[_0xd9f8('0x46')](_0xd9f8('0x7b'),_0x1da24a[_0xd9f8('0x51')]['id']);for(var _0x211e0c=0x0;_0x211e0c<_0x5d0f49[_0xd9f8('0x40')];_0x211e0c+=0x1){let _0x4c059e=_0x5d0f49[_0x211e0c];for(var _0x1d5514=0x0;_0x1d5514<_0x4c059e[_0xd9f8('0x6c')][_0xd9f8('0x40')];_0x1d5514+=0x1){let _0x23cc46=_0x4c059e[_0xd9f8('0x6c')][_0x1d5514];var _0x1a8197=_0x2e5e38[_0xd9f8('0x7c')]();_0x1a8197[_0xd9f8('0x46')]('ut.UserId\x20=\x20?',_0x23cc46['id']);_0x5437be[_0xd9f8('0x7d')](db[_0xd9f8('0x6e')][_0xd9f8('0x3a')](_0x1a8197[_0xd9f8('0x7e')](),{'type':db[_0xd9f8('0x6e')]['QueryTypes']['SELECT']})[_0xd9f8('0x2a')](function(_0x3f5115){if(_0x3f5115['length']===0x1){return _0x23cc46['id'];}else{var _0x461408=_[_0xd9f8('0x7f')](_[_0xd9f8('0x48')](_0x3f5115,_0xd9f8('0x80')),function(_0x596bfd){return _[_0xd9f8('0x81')](_0x445ede,_0x596bfd);});if(_0x461408){return _0x23cc46['id'];}}}));}}return BPromise['all'](_0x5437be)['then'](function(_0xfba07b){_0x31ecbb=_(_0x31ecbb)[_0xd9f8('0x82')](_0xfba07b)['compact']()[_0xd9f8('0x83')]();return db[_0xd9f8('0x34')][_0xd9f8('0x52')]({'where':{'id':_0x1da24a['params']['id']}})[_0xd9f8('0x2a')](function(_0x3afd85){return db[_0xd9f8('0x6e')]['transaction'](function(_0x20e0fa){return _0x3afd85['removeTeams'](_0x1da24a['query'][_0xd9f8('0x6b')],{'transaction':_0x20e0fa})['then'](function(){if(!_[_0xd9f8('0x84')](_0x31ecbb)){return _0x3afd85[_0xd9f8('0x85')](_0x31ecbb,{'transaction':_0x20e0fa});}})[_0xd9f8('0x2a')](function(){_0x31ecbb[_0xd9f8('0x73')](function(_0x1af43a){socket[_0xd9f8('0x74')](_0xd9f8('0x86'),{'UserId':_0x1af43a,'SmsQueueId':_0x3afd85['id']});});});});});});})[_0xd9f8('0x2a')](respondWithStatusCode(_0x36934f,null))[_0xd9f8('0x4f')](handleError(_0x36934f,null));};exports[_0xd9f8('0x87')]=function(_0x2ce730,_0x22b25e,_0x427f53){return db['SmsQueue']['find']({'where':{'id':_0x2ce730[_0xd9f8('0x51')]['id']}})[_0xd9f8('0x2a')](handleEntityNotFound(_0x22b25e,null))[_0xd9f8('0x2a')](function(_0x43b12d){if(_0x43b12d){return _0x43b12d[_0xd9f8('0x87')](_0x2ce730[_0xd9f8('0x54')][_0xd9f8('0x6b')],_[_0xd9f8('0x88')](_0x2ce730[_0xd9f8('0x54')],[_0xd9f8('0x6b'),'id'])||{})[_0xd9f8('0x89')](function(_0xa23389){for(var _0x4545f6=0x0;_0x4545f6<_0x2ce730['body'][_0xd9f8('0x6b')][_0xd9f8('0x40')];_0x4545f6+=0x1){socket[_0xd9f8('0x74')]('userSmsQueue:save',{'UserId':Number(_0x2ce730[_0xd9f8('0x54')]['ids'][_0x4545f6]),'SmsQueueId':Number(_0x2ce730['params']['id'])});}return _0xa23389;});}})[_0xd9f8('0x2a')](respondWithResult(_0x22b25e,null))['catch'](handleError(_0x22b25e,null));};exports[_0xd9f8('0x85')]=function(_0x39470d,_0x405e6b,_0x34546){return db[_0xd9f8('0x34')][_0xd9f8('0x52')]({'where':{'id':_0x39470d[_0xd9f8('0x51')]['id']}})[_0xd9f8('0x2a')](handleEntityNotFound(_0x405e6b,null))['then'](function(_0x1d230e){if(_0x1d230e){return _0x1d230e[_0xd9f8('0x85')](_0x39470d['query'][_0xd9f8('0x6b')])['then'](function(){if(_[_0xd9f8('0x8a')](_0x39470d[_0xd9f8('0x3a')]['ids'])){for(var _0x3b6d64=0x0;_0x3b6d64<_0x39470d[_0xd9f8('0x3a')][_0xd9f8('0x6b')][_0xd9f8('0x40')];_0x3b6d64+=0x1){socket[_0xd9f8('0x74')](_0xd9f8('0x86'),{'UserId':Number(_0x39470d[_0xd9f8('0x3a')]['ids'][_0x3b6d64]),'SmsQueueId':Number(_0x39470d[_0xd9f8('0x51')]['id'])});}}else{socket[_0xd9f8('0x74')](_0xd9f8('0x86'),{'UserId':Number(_0x39470d[_0xd9f8('0x3a')][_0xd9f8('0x6b')]),'SmsQueueId':Number(_0x39470d[_0xd9f8('0x51')]['id'])});}});}})[_0xd9f8('0x2a')](respondWithStatusCode(_0x405e6b,null))[_0xd9f8('0x4f')](handleError(_0x405e6b,null));};exports[_0xd9f8('0x8b')]=function(_0x3a55d0,_0x158ecd,_0x302ca7){var _0x51a022={};var _0x40f5fa={};var _0x5677db;var _0x1a6540;return db[_0xd9f8('0x34')][_0xd9f8('0x5e')]({'where':{'id':_0x3a55d0[_0xd9f8('0x51')]['id']}})['then'](handleEntityNotFound(_0x158ecd,null))['then'](function(_0x2eb38b){if(_0x2eb38b){_0x5677db=_0x2eb38b;_0x40f5fa[_0xd9f8('0x39')]=_[_0xd9f8('0x3b')](db[_0xd9f8('0x61')][_0xd9f8('0x35')]);_0x40f5fa[_0xd9f8('0x3a')]=_[_0xd9f8('0x3b')](_0x3a55d0[_0xd9f8('0x3a')]);_0x40f5fa[_0xd9f8('0x3c')]=_['intersection'](_0x40f5fa['model'],_0x40f5fa[_0xd9f8('0x3a')]);_0x51a022[_0xd9f8('0x3f')]=_[_0xd9f8('0x3d')](_0x40f5fa[_0xd9f8('0x39')],qs[_0xd9f8('0x3e')](_0x3a55d0[_0xd9f8('0x3a')][_0xd9f8('0x3e')]));_0x51a022[_0xd9f8('0x3f')]=_0x51a022[_0xd9f8('0x3f')]['length']?_0x51a022[_0xd9f8('0x3f')]:_0x40f5fa['model'];_0x51a022[_0xd9f8('0x42')]=qs[_0xd9f8('0x43')](_0x3a55d0['query'][_0xd9f8('0x43')]);_0x51a022[_0xd9f8('0x46')]=qs[_0xd9f8('0x3c')](_[_0xd9f8('0x44')](_0x3a55d0[_0xd9f8('0x3a')],_0x40f5fa[_0xd9f8('0x3c')]));if(_0x3a55d0['query'][_0xd9f8('0x45')]){_0x51a022[_0xd9f8('0x46')]=_[_0xd9f8('0x47')](_0x51a022[_0xd9f8('0x46')],{'$or':_[_0xd9f8('0x48')](_0x51a022[_0xd9f8('0x3f')],function(_0x120412){var _0x5e850b={};_0x5e850b[_0x120412]={'$like':'%'+_0x3a55d0[_0xd9f8('0x3a')][_0xd9f8('0x45')]+'%'};return _0x5e850b;})});}_0x51a022=_[_0xd9f8('0x47')]({},_0x51a022,_0x3a55d0[_0xd9f8('0x49')]);return _0x5677db[_0xd9f8('0x8b')](_0x51a022);}})[_0xd9f8('0x2a')](function(_0x1f852a){if(_0x1f852a){_0x1a6540=_0x1f852a[_0xd9f8('0x40')];if(!_0x3a55d0[_0xd9f8('0x3a')][_0xd9f8('0x41')](_0xd9f8('0x5f'))){_0x51a022[_0xd9f8('0x23')]=qs[_0xd9f8('0x23')](_0x3a55d0[_0xd9f8('0x3a')]['limit']);_0x51a022['offset']=qs['offset'](_0x3a55d0[_0xd9f8('0x3a')][_0xd9f8('0x22')]);}return _0x5677db[_0xd9f8('0x8b')](_0x51a022);}})['then'](function(_0x2efc7c){if(_0x2efc7c){return _0x2efc7c?{'count':_0x1a6540,'rows':_0x2efc7c}:null;}})['then'](respondWithResult(_0x158ecd,null))[_0xd9f8('0x4f')](handleError(_0x158ecd,null));}; \ No newline at end of file +var _0x85f4=['pick','UserSmsQueue','findAll','findAndCountAll','agent','smsPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','ids','Team','User','Agents','online','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','userSmsQueue:remove','addAgents','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','SmsQueues','stack','name','send','index','map','rawAttributes','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include','SmsQueue','show','params','keys','intersection','includeAll','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne'];(function(_0x2f8bc4,_0x4f40a1){var _0x2315fa=function(_0x486d12){while(--_0x486d12){_0x2f8bc4['push'](_0x2f8bc4['shift']());}};_0x2315fa(++_0x4f40a1);}(_0x85f4,0xc3));var _0x485f=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x85f4[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require(_0x485f('0x0'));var rimraf=require(_0x485f('0x1'));var zipdir=require(_0x485f('0x2'));var jsonpatch=require(_0x485f('0x3'));var rp=require(_0x485f('0x4'));var moment=require(_0x485f('0x5'));var BPromise=require(_0x485f('0x6'));var Mustache=require(_0x485f('0x7'));var util=require(_0x485f('0x8'));var path=require(_0x485f('0x9'));var sox=require('sox');var csv=require(_0x485f('0xa'));var ejs=require(_0x485f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x485f('0xc'));var squel=require(_0x485f('0xd'));var crypto=require('crypto');var jsforce=require(_0x485f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x485f('0xa'));var querystring=require(_0x485f('0xf'));var Papa=require(_0x485f('0x10'));var Redis=require(_0x485f('0x11'));var authService=require(_0x485f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x485f('0x13'));var hardwareService=require(_0x485f('0x14'));var logger=require(_0x485f('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x485f('0x16'))['db'];config[_0x485f('0x17')]=_[_0x485f('0x18')](config[_0x485f('0x17')],{'host':_0x485f('0x19'),'port':0x18eb});var socket=require(_0x485f('0x1a'))(new Redis(config[_0x485f('0x17')]));require('./smsQueue.socket')[_0x485f('0x1b')](socket);function respondWithStatusCode(_0x33c98d,_0x55b1ae){_0x55b1ae=_0x55b1ae||0xcc;return function(_0x2c88b8){if(_0x2c88b8){return _0x33c98d[_0x485f('0x1c')](_0x55b1ae);}return _0x33c98d[_0x485f('0x1d')](_0x55b1ae)[_0x485f('0x1e')]();};}function respondWithResult(_0x286646,_0x3870a5){_0x3870a5=_0x3870a5||0xc8;return function(_0x15f7f5){if(_0x15f7f5){return _0x286646['status'](_0x3870a5)['json'](_0x15f7f5);}};}function respondWithFilteredResult(_0x57bbc3,_0x9fa32){return function(_0xc19b4c){if(_0xc19b4c){var _0x57c1a4=typeof _0x9fa32[_0x485f('0x1f')]===_0x485f('0x20')&&typeof _0x9fa32[_0x485f('0x21')]==='undefined';var _0x2dbde3=_0xc19b4c[_0x485f('0x22')];var _0x1de5fa=_0x57c1a4?0x0:_0x9fa32['offset'];var _0x383d44=_0x57c1a4?_0xc19b4c[_0x485f('0x22')]:_0x9fa32['offset']+_0x9fa32[_0x485f('0x21')];var _0x41c155;if(_0x383d44>=_0x2dbde3){_0x383d44=_0x2dbde3;_0x41c155=0xc8;}else{_0x41c155=0xce;}_0x57bbc3[_0x485f('0x1d')](_0x41c155);return _0x57bbc3[_0x485f('0x23')]('Content-Range',_0x1de5fa+'-'+_0x383d44+'/'+_0x2dbde3)['json'](_0xc19b4c);}return null;};}function patchUpdates(_0x4821b1){return function(_0x155968){try{jsonpatch[_0x485f('0x24')](_0x155968,_0x4821b1,!![]);}catch(_0x1e39a4){return BPromise[_0x485f('0x25')](_0x1e39a4);}return _0x155968[_0x485f('0x26')]();};}function saveUpdates(_0x41ca17,_0x261702){return function(_0x2a89fc){if(_0x2a89fc){return _0x2a89fc[_0x485f('0x27')](_0x41ca17)[_0x485f('0x28')](function(_0x212341){return _0x212341;});}return null;};}function removeEntity(_0x33c48a,_0x51d094){return function(_0x33ede4){if(_0x33ede4){return _0x33ede4[_0x485f('0x29')]()[_0x485f('0x28')](function(){var _0x22c5b3=_0x33ede4[_0x485f('0x2a')]({'plain':!![]});var _0x43855f=_0x485f('0x2b');return db['UserProfileResource'][_0x485f('0x29')]({'where':{'type':_0x43855f,'resourceId':_0x22c5b3['id']}})[_0x485f('0x28')](function(){return _0x33ede4;});})['then'](function(){_0x33c48a['status'](0xcc)[_0x485f('0x1e')]();});}};}function handleEntityNotFound(_0x2e51c7,_0x2c3e95){return function(_0x42e92a){if(!_0x42e92a){_0x2e51c7[_0x485f('0x1c')](0x194);}return _0x42e92a;};}function handleError(_0x3847a7,_0x3155e6){_0x3155e6=_0x3155e6||0x1f4;return function(_0x3fe70a){logger['error'](_0x3fe70a[_0x485f('0x2c')]);if(_0x3fe70a[_0x485f('0x2d')]){delete _0x3fe70a[_0x485f('0x2d')];}_0x3847a7['status'](_0x3155e6)[_0x485f('0x2e')](_0x3fe70a);};}exports[_0x485f('0x2f')]=function(_0x4c2007,_0x18986b){var _0x5490d5={},_0x5524b1={},_0x39f422={'count':0x0,'rows':[]};var _0x1c04b4=_[_0x485f('0x30')](db['SmsQueue'][_0x485f('0x31')],function(_0x5adf22){return{'name':_0x5adf22['fieldName'],'type':_0x5adf22['type'][_0x485f('0x32')]};});_0x5524b1[_0x485f('0x33')]=_[_0x485f('0x30')](_0x1c04b4,_0x485f('0x2d'));_0x5524b1[_0x485f('0x34')]=_['keys'](_0x4c2007['query']);_0x5524b1[_0x485f('0x35')]=_['intersection'](_0x5524b1[_0x485f('0x33')],_0x5524b1[_0x485f('0x34')]);_0x5490d5[_0x485f('0x36')]=_['intersection'](_0x5524b1[_0x485f('0x33')],qs[_0x485f('0x37')](_0x4c2007[_0x485f('0x34')]['fields']));_0x5490d5[_0x485f('0x36')]=_0x5490d5[_0x485f('0x36')][_0x485f('0x38')]?_0x5490d5[_0x485f('0x36')]:_0x5524b1[_0x485f('0x33')];if(!_0x4c2007[_0x485f('0x34')][_0x485f('0x39')](_0x485f('0x3a'))){_0x5490d5[_0x485f('0x21')]=qs[_0x485f('0x21')](_0x4c2007[_0x485f('0x34')]['limit']);_0x5490d5[_0x485f('0x1f')]=qs[_0x485f('0x1f')](_0x4c2007[_0x485f('0x34')][_0x485f('0x1f')]);}_0x5490d5[_0x485f('0x3b')]=qs[_0x485f('0x3c')](_0x4c2007[_0x485f('0x34')][_0x485f('0x3c')]);_0x5490d5[_0x485f('0x3d')]=qs[_0x485f('0x35')](_['pick'](_0x4c2007[_0x485f('0x34')],_0x5524b1[_0x485f('0x35')]),_0x1c04b4);if(_0x4c2007[_0x485f('0x34')][_0x485f('0x3e')]){_0x5490d5['where']=_[_0x485f('0x3f')](_0x5490d5[_0x485f('0x3d')],{'$or':_['map'](_0x1c04b4,function(_0x772362){if(_0x772362[_0x485f('0x40')]!==_0x485f('0x41')){var _0x54da58={};_0x54da58[_0x772362[_0x485f('0x2d')]]={'$like':'%'+_0x4c2007[_0x485f('0x34')][_0x485f('0x3e')]+'%'};return _0x54da58;}})});}_0x5490d5=_[_0x485f('0x3f')]({},_0x5490d5,_0x4c2007['options']);var _0x3fffc3={'where':_0x5490d5['where']};return db['SmsQueue'][_0x485f('0x22')](_0x3fffc3)[_0x485f('0x28')](function(_0x4e5e08){_0x39f422[_0x485f('0x22')]=_0x4e5e08;if(_0x4c2007['query']['includeAll']){_0x5490d5[_0x485f('0x42')]=[{'all':!![]}];}return db[_0x485f('0x43')]['findAll'](_0x5490d5);})['then'](function(_0x4663a0){_0x39f422['rows']=_0x4663a0;return _0x39f422;})[_0x485f('0x28')](respondWithFilteredResult(_0x18986b,_0x5490d5))['catch'](handleError(_0x18986b,null));};exports[_0x485f('0x44')]=function(_0xdc3043,_0x1abf1e){var _0x447765={'raw':!![],'where':{'id':_0xdc3043[_0x485f('0x45')]['id']}},_0x25f328={};_0x25f328['model']=_[_0x485f('0x46')](db[_0x485f('0x43')][_0x485f('0x31')]);_0x25f328[_0x485f('0x34')]=_[_0x485f('0x46')](_0xdc3043[_0x485f('0x34')]);_0x25f328['filters']=_[_0x485f('0x47')](_0x25f328[_0x485f('0x33')],_0x25f328[_0x485f('0x34')]);_0x447765[_0x485f('0x36')]=_['intersection'](_0x25f328['model'],qs['fields'](_0xdc3043[_0x485f('0x34')]['fields']));_0x447765['attributes']=_0x447765['attributes']['length']?_0x447765['attributes']:_0x25f328['model'];if(_0xdc3043[_0x485f('0x34')][_0x485f('0x48')]){_0x447765['include']=[{'all':!![]}];}_0x447765=_[_0x485f('0x3f')]({},_0x447765,_0xdc3043[_0x485f('0x49')]);return db[_0x485f('0x43')][_0x485f('0x4a')](_0x447765)[_0x485f('0x28')](handleEntityNotFound(_0x1abf1e,null))[_0x485f('0x28')](respondWithResult(_0x1abf1e,null))[_0x485f('0x4b')](handleError(_0x1abf1e,null));};exports[_0x485f('0x4c')]=function(_0x6a9a54,_0x285af9){return db['SmsQueue'][_0x485f('0x4c')](_0x6a9a54['body'],{})[_0x485f('0x28')](function(_0x56bee8){var _0x227071=_0x6a9a54['user'][_0x485f('0x2a')]({'plain':!![]});if(!_0x227071)throw new Error(_0x485f('0x4d'));if(_0x227071[_0x485f('0x4e')]===_0x485f('0x4f')){var _0x38c87f=_0x56bee8[_0x485f('0x2a')]({'plain':!![]});var _0x2bc90f='SmsQueues';return db[_0x485f('0x50')][_0x485f('0x4a')]({'where':{'name':_0x2bc90f,'userProfileId':_0x227071[_0x485f('0x51')]},'raw':!![]})['then'](function(_0x126fd6){if(_0x126fd6&&_0x126fd6[_0x485f('0x52')]===0x0){return db[_0x485f('0x53')][_0x485f('0x4c')]({'name':_0x38c87f[_0x485f('0x2d')],'resourceId':_0x38c87f['id'],'type':_0x126fd6[_0x485f('0x2d')],'sectionId':_0x126fd6['id']},{})[_0x485f('0x28')](function(){return _0x56bee8;});}else{return _0x56bee8;}})['catch'](function(_0x36cace){logger[_0x485f('0x54')](_0x485f('0x55'),_0x36cace);throw _0x36cace;});}return _0x56bee8;})[_0x485f('0x28')](respondWithResult(_0x285af9,0xc9))[_0x485f('0x4b')](handleError(_0x285af9,null));};exports[_0x485f('0x27')]=function(_0xe692ca,_0x4d0baf){if(_0xe692ca[_0x485f('0x56')]['id']){delete _0xe692ca[_0x485f('0x56')]['id'];}return db[_0x485f('0x43')]['find']({'where':{'id':_0xe692ca[_0x485f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d0baf,null))['then'](saveUpdates(_0xe692ca[_0x485f('0x56')],null))[_0x485f('0x28')](respondWithResult(_0x4d0baf,null))['catch'](handleError(_0x4d0baf,null));};exports[_0x485f('0x29')]=function(_0xb814f2,_0x7737a4){return db['SmsQueue'][_0x485f('0x4a')]({'where':{'id':_0xb814f2[_0x485f('0x45')]['id']}})[_0x485f('0x28')](handleEntityNotFound(_0x7737a4,null))[_0x485f('0x28')](removeEntity(_0x7737a4,null))[_0x485f('0x4b')](handleError(_0x7737a4,null));};exports[_0x485f('0x57')]=function(_0x2c5f40,_0x1182dd){return db['SmsQueue'][_0x485f('0x57')]()[_0x485f('0x28')](respondWithResult(_0x1182dd,null))[_0x485f('0x4b')](handleError(_0x1182dd,null));};exports['getMembers']=function(_0x186e29,_0x14d2e5,_0x2f7008){var _0x475b6d={'raw':!![],'where':{}},_0x5886f7={},_0x45d061;return db[_0x485f('0x43')][_0x485f('0x58')]({'where':{'id':_0x186e29[_0x485f('0x45')]['id']}})[_0x485f('0x28')](handleEntityNotFound(_0x14d2e5,null))[_0x485f('0x28')](function(_0x2d0d09){if(_0x2d0d09){_0x45d061=_0x2d0d09[_0x485f('0x2a')]({'plain':!![]});_0x5886f7['model']=_['keys'](db['UserSmsQueue'][_0x485f('0x31')]);_0x5886f7['query']=_['keys'](_0x186e29[_0x485f('0x34')]);_0x5886f7[_0x485f('0x35')]=_['intersection'](_0x5886f7[_0x485f('0x33')],_0x5886f7[_0x485f('0x34')]);_0x475b6d[_0x485f('0x36')]=_['intersection'](_0x5886f7[_0x485f('0x33')],qs[_0x485f('0x37')](_0x186e29[_0x485f('0x34')]['fields']));_0x475b6d[_0x485f('0x36')]=_0x475b6d['attributes']['length']?_0x475b6d[_0x485f('0x36')]:_0x5886f7[_0x485f('0x33')];if(!_0x186e29[_0x485f('0x34')][_0x485f('0x39')](_0x485f('0x3a'))){_0x475b6d[_0x485f('0x21')]=qs['limit'](_0x186e29[_0x485f('0x34')][_0x485f('0x21')]);_0x475b6d[_0x485f('0x1f')]=qs['offset'](_0x186e29[_0x485f('0x34')][_0x485f('0x1f')]);}_0x475b6d[_0x485f('0x3b')]=qs[_0x485f('0x3c')](_0x186e29[_0x485f('0x34')][_0x485f('0x3c')]);_0x475b6d['where']=qs[_0x485f('0x35')](_[_0x485f('0x59')](_0x186e29['query'],_0x5886f7[_0x485f('0x35')]));_0x475b6d[_0x485f('0x3d')]['SmsQueueId']=_0x2d0d09['id'];if(_0x186e29[_0x485f('0x34')]['filter']){_0x475b6d[_0x485f('0x3d')]=_['merge'](_0x475b6d[_0x485f('0x3d')],{'$or':_[_0x485f('0x30')](_0x475b6d['attributes'],function(_0x15942f){var _0x4e1b12={};_0x4e1b12[_0x15942f]={'$like':'%'+_0x186e29[_0x485f('0x34')]['filter']+'%'};return _0x4e1b12;})});}_0x475b6d=_[_0x485f('0x3f')]({},_0x475b6d,_0x186e29[_0x485f('0x49')]);return db[_0x485f('0x5a')][_0x485f('0x5b')](_0x475b6d);}})[_0x485f('0x28')](function(_0x3298c0){if(_0x3298c0){return db['User'][_0x485f('0x5c')]({'where':{'id':_[_0x485f('0x30')](_0x3298c0,'UserId'),'role':_0x485f('0x5d')},'attributes':['id',_0x485f('0x2d'),_0x485f('0x5e'),_0x485f('0x5f'),_0x485f('0x60')]});}})['then'](function(_0x4aebd4){if(_0x4aebd4){return{'count':_0x4aebd4[_0x485f('0x22')],'rows':_['map'](_0x4aebd4[_0x485f('0x61')],function(_0x333390){return{'membername':_0x333390[_0x485f('0x2d')],'UserId':_0x333390['id'],'queue_name':_0x45d061['name'],'SmsQueueId':_0x45d061['id'],'interface':util['format'](_0x485f('0x62'),_0x485f('0x63'),_0x333390[_0x485f('0x2d')]),'penalty':0x0,'paused':_0x333390['smsPause'],'createdAt':_0x333390[_0x485f('0x60')],'updatedAt':_0x333390[_0x485f('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x485f('0x28')](respondWithFilteredResult(_0x14d2e5,_0x475b6d))[_0x485f('0x4b')](handleError(_0x14d2e5,null));};exports[_0x485f('0x64')]=function(_0x4efd7e,_0x29f53d,_0x32fc7d){var _0x1117ba={};var _0x416749={};var _0x1910f5;var _0xfc5cd1;return db[_0x485f('0x43')][_0x485f('0x58')]({'where':{'id':_0x4efd7e[_0x485f('0x45')]['id']}})[_0x485f('0x28')](handleEntityNotFound(_0x29f53d,null))[_0x485f('0x28')](function(_0x4b5caf){if(_0x4b5caf){_0x1910f5=_0x4b5caf;_0x416749[_0x485f('0x33')]=_[_0x485f('0x46')](db['Team'][_0x485f('0x31')]);_0x416749['query']=_[_0x485f('0x46')](_0x4efd7e[_0x485f('0x34')]);_0x416749[_0x485f('0x35')]=_[_0x485f('0x47')](_0x416749['model'],_0x416749[_0x485f('0x34')]);_0x1117ba[_0x485f('0x36')]=_[_0x485f('0x47')](_0x416749[_0x485f('0x33')],qs['fields'](_0x4efd7e[_0x485f('0x34')]['fields']));_0x1117ba[_0x485f('0x36')]=_0x1117ba[_0x485f('0x36')]['length']?_0x1117ba[_0x485f('0x36')]:_0x416749[_0x485f('0x33')];_0x1117ba[_0x485f('0x3b')]=qs[_0x485f('0x3c')](_0x4efd7e[_0x485f('0x34')][_0x485f('0x3c')]);_0x1117ba['where']=qs[_0x485f('0x35')](_[_0x485f('0x59')](_0x4efd7e[_0x485f('0x34')],_0x416749['filters']));if(_0x4efd7e['query'][_0x485f('0x3e')]){_0x1117ba[_0x485f('0x3d')]=_[_0x485f('0x3f')](_0x1117ba[_0x485f('0x3d')],{'$or':_[_0x485f('0x30')](_0x1117ba[_0x485f('0x36')],function(_0x1f47a8){var _0x2c3511={};_0x2c3511[_0x1f47a8]={'$like':'%'+_0x4efd7e[_0x485f('0x34')][_0x485f('0x3e')]+'%'};return _0x2c3511;})});}_0x1117ba=_[_0x485f('0x3f')]({},_0x1117ba,_0x4efd7e[_0x485f('0x49')]);return _0x1910f5[_0x485f('0x64')](_0x1117ba);}})[_0x485f('0x28')](function(_0x4f1558){if(_0x4f1558){_0xfc5cd1=_0x4f1558['length'];if(!_0x4efd7e[_0x485f('0x34')][_0x485f('0x39')](_0x485f('0x3a'))){_0x1117ba[_0x485f('0x21')]=qs[_0x485f('0x21')](_0x4efd7e[_0x485f('0x34')][_0x485f('0x21')]);_0x1117ba['offset']=qs[_0x485f('0x1f')](_0x4efd7e[_0x485f('0x34')]['offset']);}return _0x1910f5[_0x485f('0x64')](_0x1117ba);}})['then'](function(_0x59406a){if(_0x59406a){return _0x59406a?{'count':_0xfc5cd1,'rows':_0x59406a}:null;}})[_0x485f('0x28')](respondWithResult(_0x29f53d,null))['catch'](handleError(_0x29f53d,null));};exports['addTeams']=function(_0x76ed10,_0x2b13d5,_0x1eafe2){var _0x3ac664=_0x76ed10[_0x485f('0x56')][_0x485f('0x65')];return db[_0x485f('0x66')][_0x485f('0x5b')]({'where':{'id':_0x3ac664},'attributes':['id'],'include':[{'model':db[_0x485f('0x67')],'as':_0x485f('0x68'),'attributes':['id','name',_0x485f('0x69'),'voicePause',_0x485f('0x6a')],'raw':!![]}]})[_0x485f('0x28')](function(_0x43a728){if(_0x43a728){var _0x38e823=_[_0x485f('0x6b')](_0x43a728,function(_0x23e8b1){var _0x48f600=_0x23e8b1[_0x485f('0x2a')]({'plain':!![]});return _0x48f600[_0x485f('0x68')];});return db[_0x485f('0x43')][_0x485f('0x4a')]({'where':{'id':_0x76ed10[_0x485f('0x45')]['id']}})['then'](function(_0x4c2c18){return db['sequelize'][_0x485f('0x6c')](function(_0x45eeb1){return _0x4c2c18[_0x485f('0x6d')](_0x3ac664,{'transaction':_0x45eeb1})[_0x485f('0x28')](function(){return BPromise[_0x485f('0x6e')](_0x38e823,function(_0x54531f){return db[_0x485f('0x5a')][_0x485f('0x6f')]({'where':{'UserId':_0x54531f['id'],'SmsQueueId':_0x76ed10['params']['id']},'transaction':_0x45eeb1});});})[_0x485f('0x28')](function(){_0x38e823[_0x485f('0x70')](function(_0x2c15b6){socket[_0x485f('0x71')](_0x485f('0x72'),{'UserId':_0x2c15b6['id'],'SmsQueueId':_0x4c2c18['id']});});});});});}})[_0x485f('0x28')](respondWithStatusCode(_0x2b13d5,null))[_0x485f('0x4b')](handleError(_0x2b13d5,null));};exports[_0x485f('0x73')]=function(_0x30df6c,_0x58dc85,_0xdc1d14){return db[_0x485f('0x66')][_0x485f('0x5b')]({'where':{'id':_0x30df6c[_0x485f('0x34')][_0x485f('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x485f('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x58dc85,null))[_0x485f('0x28')](function(_0x20ef2a){var _0x49d2be=_[_0x485f('0x30')](_0x20ef2a,'id');var _0xbb79cb=[];var _0x14e537=[];var _0x2fb5e5=squel[_0x485f('0x74')]();_0x2fb5e5[_0x485f('0x75')](_0x485f('0x76'))[_0x485f('0x77')](_0x485f('0x78'),'tq')[_0x485f('0x79')](_0x485f('0x7a'),'ut',_0x485f('0x7b'))[_0x485f('0x3d')](_0x485f('0x7c'),_0x30df6c[_0x485f('0x45')]['id']);for(var _0xfa5009=0x0;_0xfa5009<_0x20ef2a[_0x485f('0x38')];_0xfa5009+=0x1){let _0x172cb8=_0x20ef2a[_0xfa5009];for(var _0xb31e2=0x0;_0xb31e2<_0x172cb8[_0x485f('0x68')][_0x485f('0x38')];_0xb31e2+=0x1){let _0x4a3862=_0x172cb8[_0x485f('0x68')][_0xb31e2];var _0x47b8c9=_0x2fb5e5['clone']();_0x47b8c9[_0x485f('0x3d')]('ut.UserId\x20=\x20?',_0x4a3862['id']);_0x14e537[_0x485f('0x7d')](db['sequelize'][_0x485f('0x34')](_0x47b8c9[_0x485f('0x7e')](),{'type':db[_0x485f('0x7f')][_0x485f('0x80')][_0x485f('0x81')]})[_0x485f('0x28')](function(_0x2b39c7){if(_0x2b39c7['length']===0x1){return _0x4a3862['id'];}else{var _0x3b2b68=_[_0x485f('0x82')](_[_0x485f('0x30')](_0x2b39c7,_0x485f('0x83')),function(_0x54a23b){return _[_0x485f('0x84')](_0x49d2be,_0x54a23b);});if(_0x3b2b68){return _0x4a3862['id'];}}}));}}return BPromise['all'](_0x14e537)['then'](function(_0xd7b1dd){_0xbb79cb=_(_0xbb79cb)[_0x485f('0x85')](_0xd7b1dd)[_0x485f('0x86')]()[_0x485f('0x87')]();return db[_0x485f('0x43')][_0x485f('0x4a')]({'where':{'id':_0x30df6c[_0x485f('0x45')]['id']}})[_0x485f('0x28')](function(_0x4f1411){return db[_0x485f('0x7f')][_0x485f('0x6c')](function(_0x50bf96){return _0x4f1411[_0x485f('0x73')](_0x30df6c[_0x485f('0x34')][_0x485f('0x65')],{'transaction':_0x50bf96})[_0x485f('0x28')](function(){if(!_[_0x485f('0x88')](_0xbb79cb)){return _0x4f1411['removeAgents'](_0xbb79cb,{'transaction':_0x50bf96});}})[_0x485f('0x28')](function(){_0xbb79cb[_0x485f('0x70')](function(_0x48fb96){socket[_0x485f('0x71')](_0x485f('0x89'),{'UserId':_0x48fb96,'SmsQueueId':_0x4f1411['id']});});});});});});})[_0x485f('0x28')](respondWithStatusCode(_0x58dc85,null))[_0x485f('0x4b')](handleError(_0x58dc85,null));};exports[_0x485f('0x8a')]=function(_0xe01620,_0x191aee,_0x1518bb){return db[_0x485f('0x43')][_0x485f('0x4a')]({'where':{'id':_0xe01620[_0x485f('0x45')]['id']}})[_0x485f('0x28')](handleEntityNotFound(_0x191aee,null))[_0x485f('0x28')](function(_0x3b0ac9){if(_0x3b0ac9){return _0x3b0ac9[_0x485f('0x8a')](_0xe01620[_0x485f('0x56')]['ids'],_['omit'](_0xe01620[_0x485f('0x56')],['ids','id'])||{})['spread'](function(_0xed7658){for(var _0x3a32a1=0x0;_0x3a32a1<_0xe01620[_0x485f('0x56')]['ids'][_0x485f('0x38')];_0x3a32a1+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0xe01620[_0x485f('0x56')]['ids'][_0x3a32a1]),'SmsQueueId':Number(_0xe01620['params']['id'])});}return _0xed7658;});}})[_0x485f('0x28')](respondWithResult(_0x191aee,null))[_0x485f('0x4b')](handleError(_0x191aee,null));};exports['removeAgents']=function(_0x396f89,_0x38b3ba,_0x3f7a8e){return db[_0x485f('0x43')][_0x485f('0x4a')]({'where':{'id':_0x396f89[_0x485f('0x45')]['id']}})[_0x485f('0x28')](handleEntityNotFound(_0x38b3ba,null))[_0x485f('0x28')](function(_0x281e56){if(_0x281e56){return _0x281e56[_0x485f('0x8b')](_0x396f89['query'][_0x485f('0x65')])[_0x485f('0x28')](function(){if(_[_0x485f('0x8c')](_0x396f89[_0x485f('0x34')][_0x485f('0x65')])){for(var _0x9caa0e=0x0;_0x9caa0e<_0x396f89[_0x485f('0x34')][_0x485f('0x65')]['length'];_0x9caa0e+=0x1){socket['emit'](_0x485f('0x89'),{'UserId':Number(_0x396f89[_0x485f('0x34')]['ids'][_0x9caa0e]),'SmsQueueId':Number(_0x396f89['params']['id'])});}}else{socket[_0x485f('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x396f89[_0x485f('0x34')][_0x485f('0x65')]),'SmsQueueId':Number(_0x396f89['params']['id'])});}});}})[_0x485f('0x28')](respondWithStatusCode(_0x38b3ba,null))[_0x485f('0x4b')](handleError(_0x38b3ba,null));};exports['getAgents']=function(_0x5a9091,_0xf51887,_0x258330){var _0x1229ea={};var _0x310fec={};var _0x5ec3b7;var _0x13d553;return db[_0x485f('0x43')][_0x485f('0x58')]({'where':{'id':_0x5a9091['params']['id']}})[_0x485f('0x28')](handleEntityNotFound(_0xf51887,null))[_0x485f('0x28')](function(_0x19845c){if(_0x19845c){_0x5ec3b7=_0x19845c;_0x310fec['model']=_[_0x485f('0x46')](db['User'][_0x485f('0x31')]);_0x310fec[_0x485f('0x34')]=_[_0x485f('0x46')](_0x5a9091[_0x485f('0x34')]);_0x310fec[_0x485f('0x35')]=_[_0x485f('0x47')](_0x310fec['model'],_0x310fec['query']);_0x1229ea[_0x485f('0x36')]=_[_0x485f('0x47')](_0x310fec['model'],qs[_0x485f('0x37')](_0x5a9091[_0x485f('0x34')]['fields']));_0x1229ea[_0x485f('0x36')]=_0x1229ea[_0x485f('0x36')][_0x485f('0x38')]?_0x1229ea['attributes']:_0x310fec[_0x485f('0x33')];_0x1229ea[_0x485f('0x3b')]=qs[_0x485f('0x3c')](_0x5a9091[_0x485f('0x34')][_0x485f('0x3c')]);_0x1229ea[_0x485f('0x3d')]=qs[_0x485f('0x35')](_[_0x485f('0x59')](_0x5a9091[_0x485f('0x34')],_0x310fec[_0x485f('0x35')]));if(_0x5a9091['query'][_0x485f('0x3e')]){_0x1229ea[_0x485f('0x3d')]=_[_0x485f('0x3f')](_0x1229ea[_0x485f('0x3d')],{'$or':_[_0x485f('0x30')](_0x1229ea[_0x485f('0x36')],function(_0x2f44fd){var _0x5d0fc3={};_0x5d0fc3[_0x2f44fd]={'$like':'%'+_0x5a9091['query'][_0x485f('0x3e')]+'%'};return _0x5d0fc3;})});}_0x1229ea=_[_0x485f('0x3f')]({},_0x1229ea,_0x5a9091[_0x485f('0x49')]);return _0x5ec3b7[_0x485f('0x8d')](_0x1229ea);}})[_0x485f('0x28')](function(_0x4142db){if(_0x4142db){_0x13d553=_0x4142db[_0x485f('0x38')];if(!_0x5a9091['query'][_0x485f('0x39')](_0x485f('0x3a'))){_0x1229ea['limit']=qs[_0x485f('0x21')](_0x5a9091[_0x485f('0x34')][_0x485f('0x21')]);_0x1229ea[_0x485f('0x1f')]=qs['offset'](_0x5a9091[_0x485f('0x34')][_0x485f('0x1f')]);}return _0x5ec3b7[_0x485f('0x8d')](_0x1229ea);}})[_0x485f('0x28')](function(_0x552b41){if(_0x552b41){return _0x552b41?{'count':_0x13d553,'rows':_0x552b41}:null;}})[_0x485f('0x28')](respondWithResult(_0xf51887,null))['catch'](handleError(_0xf51887,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9c8a081..050ec46 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 _0x0dbb=['emit','hasOwnProperty','hook','exports','setMaxListeners','update','remove'];(function(_0x58c2ee,_0x1b14f6){var _0x31f125=function(_0x57778b){while(--_0x57778b){_0x58c2ee['push'](_0x58c2ee['shift']());}};_0x31f125(++_0x1b14f6);}(_0x0dbb,0x1a1));var _0xb0db=function(_0x27bf44,_0x1155bb){_0x27bf44=_0x27bf44-0x0;var _0x13437b=_0x0dbb[_0x27bf44];return _0x13437b;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb0db('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb0db('0x1'),'afterDestroy':_0xb0db('0x2')};function emitEvent(_0x4ef48c){return function(_0x36567f,_0x5ba1e5,_0x2f96e6){SmsQueueEvents[_0xb0db('0x3')](_0x4ef48c+':'+_0x36567f['id'],_0x36567f);SmsQueueEvents[_0xb0db('0x3')](_0x4ef48c,_0x36567f);_0x2f96e6(null);};}for(var e in events){if(events[_0xb0db('0x4')](e)){var event=events[e];SmsQueue[_0xb0db('0x5')](e,emitEvent(event));}}module[_0xb0db('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x54c4=['exports','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x4271af,_0x3e029a){var _0xd7968b=function(_0x281889){while(--_0x281889){_0x4271af['push'](_0x4271af['shift']());}};_0xd7968b(++_0x3e029a);}(_0x54c4,0xeb));var _0x454c=function(_0x4381f6,_0x2ce6a9){_0x4381f6=_0x4381f6-0x0;var _0x400b46=_0x54c4[_0x4381f6];return _0x400b46;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x454c('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x454c('0x1')](0x0);var events={'afterCreate':_0x454c('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4702d8){return function(_0x19c1b0,_0x14a661,_0x5c586d){SmsQueueEvents[_0x454c('0x3')](_0x4702d8+':'+_0x19c1b0['id'],_0x19c1b0);SmsQueueEvents['emit'](_0x4702d8,_0x19c1b0);_0x5c586d(null);};}for(var e in events){if(events[_0x454c('0x4')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x454c('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 06517d4..cdc048f 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 _0x500b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','sms_queues','util'];(function(_0x1382dc,_0x2d3b80){var _0x50fbe9=function(_0x44c23b){while(--_0x44c23b){_0x1382dc['push'](_0x1382dc['shift']());}};_0x50fbe9(++_0x2d3b80);}(_0x500b,0x18b));var _0xb500=function(_0x681ca3,_0x19e409){_0x681ca3=_0x681ca3-0x0;var _0x42435d=_0x500b[_0x681ca3];return _0x42435d;};'use strict';var _=require('lodash');var util=require(_0xb500('0x0'));var logger=require(_0xb500('0x1'))(_0xb500('0x2'));var moment=require(_0xb500('0x3'));var BPromise=require(_0xb500('0x4'));var rp=require(_0xb500('0x5'));var fs=require('fs');var path=require(_0xb500('0x6'));var rimraf=require(_0xb500('0x7'));var config=require(_0xb500('0x8'));var attributes=require('./smsQueue.attributes');module[_0xb500('0x9')]=function(_0x4f352e,_0x7d0e2b){return _0x4f352e[_0xb500('0xa')]('SmsQueue',attributes,{'tableName':_0xb500('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf989=['../../config/environment','SmsQueue','util','../../config/logger','api','moment','bluebird','path'];(function(_0x54daa6,_0x20bd95){var _0x5eea2e=function(_0x508973){while(--_0x508973){_0x54daa6['push'](_0x54daa6['shift']());}};_0x5eea2e(++_0x20bd95);}(_0xf989,0x19a));var _0x9f98=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xf989[_0x5e9a69];return _0x5979c8;};'use strict';var _=require('lodash');var util=require(_0x9f98('0x0'));var logger=require(_0x9f98('0x1'))(_0x9f98('0x2'));var moment=require(_0x9f98('0x3'));var BPromise=require(_0x9f98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f98('0x5'));var rimraf=require('rimraf');var config=require(_0x9f98('0x6'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x4a8108,_0x43a45e){return _0x4a8108['define'](_0x9f98('0x7'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 842cb67..8c487f6 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 _0x22f9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','model','map','debug','catch','ShowSmsQueue','find'];(function(_0x2fc230,_0x1e89d8){var _0x2b2936=function(_0x3b0745){while(--_0x3b0745){_0x2fc230['push'](_0x2fc230['shift']());}};_0x2b2936(++_0x1e89d8);}(_0x22f9,0x1e0));var _0x922f=function(_0x1f64b5,_0x547255){_0x1f64b5=_0x1f64b5-0x0;var _0x1fd769=_0x22f9[_0x1f64b5];return _0x1fd769;};'use strict';var _=require(_0x922f('0x0'));var util=require(_0x922f('0x1'));var moment=require(_0x922f('0x2'));var BPromise=require(_0x922f('0x3'));var rs=require(_0x922f('0x4'));var fs=require('fs');var Redis=require(_0x922f('0x5'));var db=require(_0x922f('0x6'))['db'];var utils=require(_0x922f('0x7'));var logger=require('../../config/logger')(_0x922f('0x8'));var config=require(_0x922f('0x9'));var jayson=require(_0x922f('0xa'));var client=jayson[_0x922f('0xb')][_0x922f('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x922f('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x922f('0xd')]));require(_0x922f('0xe'))[_0x922f('0xf')](socket);function respondWithRpcPromise(_0x33ddb5,_0x20356a,_0x3df6cc){return new BPromise(function(_0x320782,_0x3de89b){return client[_0x922f('0x10')](_0x33ddb5,_0x3df6cc)[_0x922f('0x11')](function(_0x439bbd){logger['info'](_0x922f('0x12'),_0x20356a,_0x922f('0x13'));logger['debug'](_0x922f('0x14'),_0x20356a,'request\x20sent',JSON[_0x922f('0x15')](_0x439bbd));if(_0x439bbd[_0x922f('0x16')]){if(_0x439bbd[_0x922f('0x16')][_0x922f('0x17')]===0x1f4){logger['error'](_0x922f('0x12'),_0x20356a,_0x439bbd[_0x922f('0x16')][_0x922f('0x18')]);return _0x3de89b(_0x439bbd[_0x922f('0x16')][_0x922f('0x18')]);}logger[_0x922f('0x16')](_0x922f('0x12'),_0x20356a,_0x439bbd[_0x922f('0x16')][_0x922f('0x18')]);return _0x320782(_0x439bbd[_0x922f('0x16')][_0x922f('0x18')]);}else{logger[_0x922f('0x19')](_0x922f('0x12'),_0x20356a,_0x922f('0x13'));_0x320782(_0x439bbd['result']['message']);}})['catch'](function(_0x3d7cc2){logger[_0x922f('0x16')](_0x922f('0x12'),_0x20356a,_0x3d7cc2);_0x3de89b(_0x3d7cc2);});});}exports[_0x922f('0x1a')]=function(_0x55fa09){var _0x59bae1=this;return new Promise(function(_0x51960e,_0x5c3e09){return db[_0x922f('0x1b')]['findAll']({'raw':_0x55fa09[_0x922f('0x1c')]?_0x55fa09['options'][_0x922f('0x1d')]===undefined?!![]:![]:!![],'where':_0x55fa09[_0x922f('0x1c')]?_0x55fa09[_0x922f('0x1c')][_0x922f('0x1e')]||null:null,'attributes':_0x55fa09[_0x922f('0x1c')]?_0x55fa09['options'][_0x922f('0x1f')]||null:null,'limit':_0x55fa09[_0x922f('0x1c')]?_0x55fa09[_0x922f('0x1c')][_0x922f('0x20')]||null:null,'include':_0x55fa09[_0x922f('0x1c')]?_0x55fa09[_0x922f('0x1c')]['include']?_['map'](_0x55fa09[_0x922f('0x1c')][_0x922f('0x21')],function(_0x5ca0a8){return{'model':db[_0x5ca0a8[_0x922f('0x22')]],'as':_0x5ca0a8['as'],'attributes':_0x5ca0a8[_0x922f('0x1f')],'include':_0x5ca0a8[_0x922f('0x21')]?_[_0x922f('0x23')](_0x5ca0a8['include'],function(_0x359cfb){return{'model':db[_0x359cfb[_0x922f('0x22')]],'as':_0x359cfb['as'],'attributes':_0x359cfb[_0x922f('0x1f')],'include':_0x359cfb[_0x922f('0x21')]?_[_0x922f('0x23')](_0x359cfb[_0x922f('0x21')],function(_0x5cad47){return{'model':db[_0x5cad47[_0x922f('0x22')]],'as':_0x5cad47['as'],'attributes':_0x5cad47[_0x922f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x922f('0x11')](function(_0x11f738){logger[_0x922f('0x19')](_0x922f('0x1a'),_0x55fa09);logger[_0x922f('0x24')](_0x922f('0x1a'),_0x55fa09,JSON['stringify'](_0x11f738));_0x51960e(_0x11f738);})[_0x922f('0x25')](function(_0x361163){logger['error'](_0x922f('0x1a'),_0x361163[_0x922f('0x18')],_0x55fa09);_0x5c3e09(_0x59bae1[_0x922f('0x16')](0x1f4,_0x361163['message']));});});};exports[_0x922f('0x26')]=function(_0x267137){var _0x44bda6=this;return new Promise(function(_0x3c196f,_0x345cf3){return db['SmsQueue'][_0x922f('0x27')]({'raw':_0x267137[_0x922f('0x1c')]?_0x267137[_0x922f('0x1c')][_0x922f('0x1d')]===undefined?!![]:![]:!![],'where':_0x267137[_0x922f('0x1c')]?_0x267137[_0x922f('0x1c')]['where']||null:null,'attributes':_0x267137[_0x922f('0x1c')]?_0x267137[_0x922f('0x1c')][_0x922f('0x1f')]||null:null,'include':_0x267137[_0x922f('0x1c')]?_0x267137[_0x922f('0x1c')][_0x922f('0x21')]?_[_0x922f('0x23')](_0x267137[_0x922f('0x1c')][_0x922f('0x21')],function(_0x3cf790){return{'model':db[_0x3cf790[_0x922f('0x22')]],'as':_0x3cf790['as'],'attributes':_0x3cf790[_0x922f('0x1f')],'include':_0x3cf790[_0x922f('0x21')]?_[_0x922f('0x23')](_0x3cf790[_0x922f('0x21')],function(_0x185c40){return{'model':db[_0x185c40[_0x922f('0x22')]],'as':_0x185c40['as'],'attributes':_0x185c40[_0x922f('0x1f')],'include':_0x185c40[_0x922f('0x21')]?_['map'](_0x185c40[_0x922f('0x21')],function(_0x546f48){return{'model':db[_0x546f48[_0x922f('0x22')]],'as':_0x546f48['as'],'attributes':_0x546f48[_0x922f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4da006){logger['info'](_0x922f('0x26'),_0x267137);logger[_0x922f('0x24')](_0x922f('0x26'),_0x267137,JSON[_0x922f('0x15')](_0x4da006));_0x3c196f(_0x4da006);})[_0x922f('0x25')](function(_0x381bba){logger[_0x922f('0x16')](_0x922f('0x26'),_0x381bba[_0x922f('0x18')],_0x267137);_0x345cf3(_0x44bda6[_0x922f('0x16')](0x1f4,_0x381bba[_0x922f('0x18')]));});});}; \ No newline at end of file +var _0xb50f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','SmsQueue','findAll','options','where','attributes','map','include','model','GetSmsQueue','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring'];(function(_0xf0ab7c,_0x23bbc2){var _0x198144=function(_0x1c3a40){while(--_0x1c3a40){_0xf0ab7c['push'](_0xf0ab7c['shift']());}};_0x198144(++_0x23bbc2);}(_0xb50f,0xf7));var _0xfb50=function(_0x9d39e9,_0x3aebc9){_0x9d39e9=_0x9d39e9-0x0;var _0x4ac75b=_0xb50f[_0x9d39e9];return _0x4ac75b;};'use strict';var _=require(_0xfb50('0x0'));var util=require(_0xfb50('0x1'));var moment=require(_0xfb50('0x2'));var BPromise=require(_0xfb50('0x3'));var rs=require(_0xfb50('0x4'));var fs=require('fs');var Redis=require(_0xfb50('0x5'));var db=require(_0xfb50('0x6'))['db'];var utils=require(_0xfb50('0x7'));var logger=require(_0xfb50('0x8'))(_0xfb50('0x9'));var config=require('../../config/environment');var jayson=require(_0xfb50('0xa'));var client=jayson[_0xfb50('0xb')][_0xfb50('0xc')]({'port':0x232a});config[_0xfb50('0xd')]=_[_0xfb50('0xe')](config[_0xfb50('0xd')],{'host':_0xfb50('0xf'),'port':0x18eb});var socket=require(_0xfb50('0x10'))(new Redis(config[_0xfb50('0xd')]));require(_0xfb50('0x11'))[_0xfb50('0x12')](socket);function respondWithRpcPromise(_0x554238,_0x56a3d3,_0x43e560){return new BPromise(function(_0x40d03d,_0x154a6a){return client[_0xfb50('0x13')](_0x554238,_0x43e560)[_0xfb50('0x14')](function(_0x126667){logger['info'](_0xfb50('0x15'),_0x56a3d3,'request\x20sent');logger[_0xfb50('0x16')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x56a3d3,_0xfb50('0x17'),JSON[_0xfb50('0x18')](_0x126667));if(_0x126667['error']){if(_0x126667[_0xfb50('0x19')]['code']===0x1f4){logger[_0xfb50('0x19')](_0xfb50('0x15'),_0x56a3d3,_0x126667[_0xfb50('0x19')][_0xfb50('0x1a')]);return _0x154a6a(_0x126667[_0xfb50('0x19')][_0xfb50('0x1a')]);}logger[_0xfb50('0x19')](_0xfb50('0x15'),_0x56a3d3,_0x126667[_0xfb50('0x19')][_0xfb50('0x1a')]);return _0x40d03d(_0x126667[_0xfb50('0x19')][_0xfb50('0x1a')]);}else{logger[_0xfb50('0x1b')](_0xfb50('0x15'),_0x56a3d3,_0xfb50('0x17'));_0x40d03d(_0x126667[_0xfb50('0x1c')][_0xfb50('0x1a')]);}})[_0xfb50('0x1d')](function(_0x5080a0){logger['error'](_0xfb50('0x15'),_0x56a3d3,_0x5080a0);_0x154a6a(_0x5080a0);});});}exports['GetSmsQueue']=function(_0x297460){var _0x51f5ad=this;return new Promise(function(_0x15e28c,_0x384858){return db[_0xfb50('0x1e')][_0xfb50('0x1f')]({'raw':_0x297460['options']?_0x297460['options']['raw']===undefined?!![]:![]:!![],'where':_0x297460[_0xfb50('0x20')]?_0x297460[_0xfb50('0x20')][_0xfb50('0x21')]||null:null,'attributes':_0x297460[_0xfb50('0x20')]?_0x297460[_0xfb50('0x20')][_0xfb50('0x22')]||null:null,'limit':_0x297460[_0xfb50('0x20')]?_0x297460[_0xfb50('0x20')]['limit']||null:null,'include':_0x297460[_0xfb50('0x20')]?_0x297460[_0xfb50('0x20')]['include']?_[_0xfb50('0x23')](_0x297460[_0xfb50('0x20')][_0xfb50('0x24')],function(_0x424f3b){return{'model':db[_0x424f3b['model']],'as':_0x424f3b['as'],'attributes':_0x424f3b['attributes'],'include':_0x424f3b['include']?_[_0xfb50('0x23')](_0x424f3b[_0xfb50('0x24')],function(_0x4aa5cc){return{'model':db[_0x4aa5cc[_0xfb50('0x25')]],'as':_0x4aa5cc['as'],'attributes':_0x4aa5cc[_0xfb50('0x22')],'include':_0x4aa5cc[_0xfb50('0x24')]?_[_0xfb50('0x23')](_0x4aa5cc[_0xfb50('0x24')],function(_0x5e9810){return{'model':db[_0x5e9810[_0xfb50('0x25')]],'as':_0x5e9810['as'],'attributes':_0x5e9810[_0xfb50('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfb50('0x14')](function(_0x1bcf3c){logger[_0xfb50('0x1b')]('GetSmsQueue',_0x297460);logger['debug'](_0xfb50('0x26'),_0x297460,JSON['stringify'](_0x1bcf3c));_0x15e28c(_0x1bcf3c);})[_0xfb50('0x1d')](function(_0x184f38){logger[_0xfb50('0x19')](_0xfb50('0x26'),_0x184f38[_0xfb50('0x1a')],_0x297460);_0x384858(_0x51f5ad[_0xfb50('0x19')](0x1f4,_0x184f38[_0xfb50('0x1a')]));});});};exports[_0xfb50('0x27')]=function(_0x592fe3){var _0x4e5e41=this;return new Promise(function(_0x3d052c,_0x13e588){return db[_0xfb50('0x1e')][_0xfb50('0x28')]({'raw':_0x592fe3['options']?_0x592fe3[_0xfb50('0x20')][_0xfb50('0x29')]===undefined?!![]:![]:!![],'where':_0x592fe3[_0xfb50('0x20')]?_0x592fe3['options'][_0xfb50('0x21')]||null:null,'attributes':_0x592fe3[_0xfb50('0x20')]?_0x592fe3[_0xfb50('0x20')][_0xfb50('0x22')]||null:null,'include':_0x592fe3[_0xfb50('0x20')]?_0x592fe3['options'][_0xfb50('0x24')]?_[_0xfb50('0x23')](_0x592fe3[_0xfb50('0x20')][_0xfb50('0x24')],function(_0x27341b){return{'model':db[_0x27341b[_0xfb50('0x25')]],'as':_0x27341b['as'],'attributes':_0x27341b[_0xfb50('0x22')],'include':_0x27341b[_0xfb50('0x24')]?_[_0xfb50('0x23')](_0x27341b[_0xfb50('0x24')],function(_0x4f29c5){return{'model':db[_0x4f29c5[_0xfb50('0x25')]],'as':_0x4f29c5['as'],'attributes':_0x4f29c5[_0xfb50('0x22')],'include':_0x4f29c5[_0xfb50('0x24')]?_['map'](_0x4f29c5[_0xfb50('0x24')],function(_0x34b6e1){return{'model':db[_0x34b6e1[_0xfb50('0x25')]],'as':_0x34b6e1['as'],'attributes':_0x34b6e1[_0xfb50('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb82579){logger[_0xfb50('0x1b')]('ShowSmsQueue',_0x592fe3);logger[_0xfb50('0x16')]('ShowSmsQueue',_0x592fe3,JSON[_0xfb50('0x18')](_0xb82579));_0x3d052c(_0xb82579);})[_0xfb50('0x1d')](function(_0x6829f4){logger[_0xfb50('0x19')](_0xfb50('0x27'),_0x6829f4[_0xfb50('0x1a')],_0x592fe3);_0x13e588(_0x4e5e41[_0xfb50('0x19')](0x1f4,_0x6829f4[_0xfb50('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 3a9e7ed..60d57a1 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 _0xea9f=['remove','update','removeListener','register','length','smsQueue:','save'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xea9f,0x1b1));var _0xfea9=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xea9f[_0xa148b7];return _0x51efd3;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xfea9('0x0'),_0xfea9('0x1'),_0xfea9('0x2')];function createListener(_0x22248c,_0x419e07){return function(_0x4313fa){_0x419e07['emit'](_0x22248c,_0x4313fa);};}function removeListener(_0x1e0988,_0x134c57){return function(){SmsQueueEvents[_0xfea9('0x3')](_0x1e0988,_0x134c57);};}exports[_0xfea9('0x4')]=function(_0x5da101){for(var _0x5468d8=0x0,_0x220a23=events[_0xfea9('0x5')];_0x5468d8<_0x220a23;_0x5468d8++){var _0x59002e=events[_0x5468d8];var _0x3f0fad=createListener(_0xfea9('0x6')+_0x59002e,_0x5da101);SmsQueueEvents['on'](_0x59002e,_0x3f0fad);}}; \ No newline at end of file +var _0x67c7=['emit','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x1334fd,_0x32c3cf){var _0x95cbc3=function(_0x4d8871){while(--_0x4d8871){_0x1334fd['push'](_0x1334fd['shift']());}};_0x95cbc3(++_0x32c3cf);}(_0x67c7,0xd6));var _0x767c=function(_0x18b931,_0x2cad1d){_0x18b931=_0x18b931-0x0;var _0x114958=_0x67c7[_0x18b931];return _0x114958;};'use strict';var SmsQueueEvents=require(_0x767c('0x0'));var events=[_0x767c('0x1'),_0x767c('0x2'),'update'];function createListener(_0x4ce604,_0x58981f){return function(_0x1b8483){_0x58981f[_0x767c('0x3')](_0x4ce604,_0x1b8483);};}function removeListener(_0x4491e0,_0x59c58c){return function(){SmsQueueEvents['removeListener'](_0x4491e0,_0x59c58c);};}exports[_0x767c('0x4')]=function(_0x27d04f){for(var _0x19a6cf=0x0,_0x12b68f=events[_0x767c('0x5')];_0x19a6cf<_0x12b68f;_0x19a6cf++){var _0x274a9d=events[_0x19a6cf];var _0x1b2802=createListener(_0x767c('0x6')+_0x274a9d,_0x27d04f);SmsQueueEvents['on'](_0x274a9d,_0x1b2802);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f3d2cdd..23af7db 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 _0x1e6c=['describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x962edb,_0x5dd356){var _0x359dcf=function(_0x978f40){while(--_0x978f40){_0x962edb['push'](_0x962edb['shift']());}};_0x359dcf(++_0x5dd356);}(_0x1e6c,0x11a));var _0xc1e6=function(_0x158ab3,_0x4b5908){_0x158ab3=_0x158ab3-0x0;var _0x302830=_0x1e6c[_0x158ab3];return _0x302830;};'use strict';var multer=require(_0xc1e6('0x0'));var util=require('util');var path=require(_0xc1e6('0x1'));var timeout=require(_0xc1e6('0x2'));var express=require(_0xc1e6('0x3'));var router=express[_0xc1e6('0x4')]();var fs_extra=require(_0xc1e6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc1e6('0x6'));var controller=require(_0xc1e6('0x7'));router[_0xc1e6('0x8')]('/',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0xa')]);router[_0xc1e6('0x8')](_0xc1e6('0xb'),auth['isAuthenticated'](),controller[_0xc1e6('0xc')]);router['get'](_0xc1e6('0xd'),auth['isAuthenticated'](),controller[_0xc1e6('0xe')]);router[_0xc1e6('0xf')]('/',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0x10')]);router['put']('/:id',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0x11')]);router[_0xc1e6('0x12')]('/:id',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0x13')]);module[_0xc1e6('0x14')]=router; \ No newline at end of file +var _0x59ec=['/describe','/:id','show','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index'];(function(_0x127c99,_0x21a74c){var _0xde5427=function(_0x5f0123){while(--_0x5f0123){_0x127c99['push'](_0x127c99['shift']());}};_0xde5427(++_0x21a74c);}(_0x59ec,0x102));var _0xc59e=function(_0x306ba5,_0x100287){_0x306ba5=_0x306ba5-0x0;var _0xe2e6db=_0x59ec[_0x306ba5];return _0xe2e6db;};'use strict';var multer=require(_0xc59e('0x0'));var util=require(_0xc59e('0x1'));var path=require('path');var timeout=require(_0xc59e('0x2'));var express=require(_0xc59e('0x3'));var router=express['Router']();var fs_extra=require(_0xc59e('0x4'));var auth=require(_0xc59e('0x5'));var interaction=require(_0xc59e('0x6'));var config=require(_0xc59e('0x7'));var controller=require(_0xc59e('0x8'));router[_0xc59e('0x9')]('/',auth[_0xc59e('0xa')](),controller[_0xc59e('0xb')]);router[_0xc59e('0x9')](_0xc59e('0xc'),auth[_0xc59e('0xa')](),controller['describe']);router[_0xc59e('0x9')](_0xc59e('0xd'),auth['isAuthenticated'](),controller[_0xc59e('0xe')]);router['post']('/',auth[_0xc59e('0xa')](),controller['create']);router['put'](_0xc59e('0xd'),auth[_0xc59e('0xa')](),controller[_0xc59e('0xf')]);router[_0xc59e('0x10')]('/:id',auth[_0xc59e('0xa')](),controller['destroy']);module[_0xc59e('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index cdf430f..d3012fe 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 _0xa0dd=['moment','sequelize','STRING','DATE'];(function(_0xc0b7f7,_0x3eb5e5){var _0x48ab14=function(_0x51d6a0){while(--_0x51d6a0){_0xc0b7f7['push'](_0xc0b7f7['shift']());}};_0x48ab14(++_0x3eb5e5);}(_0xa0dd,0xc0));var _0xda0d=function(_0x332193,_0x13605a){_0x332193=_0x332193-0x0;var _0x16b8ab=_0xa0dd[_0x332193];return _0x16b8ab;};'use strict';var moment=require(_0xda0d('0x0'));var Sequelize=require(_0xda0d('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xda0d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xda0d('0x2')]},'joinAt':{'type':Sequelize[_0xda0d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xda0d('0x3')]},'reason':{'type':Sequelize[_0xda0d('0x2')]}}; \ No newline at end of file +var _0xd9d6=['moment','exports','STRING','DATE'];(function(_0x504910,_0x4b33a0){var _0x24da1d=function(_0x2eece3){while(--_0x2eece3){_0x504910['push'](_0x504910['shift']());}};_0x24da1d(++_0x4b33a0);}(_0xd9d6,0x184));var _0x6d9d=function(_0x151ff0,_0x58f275){_0x151ff0=_0x151ff0-0x0;var _0x43075b=_0xd9d6[_0x151ff0];return _0x43075b;};'use strict';var moment=require(_0x6d9d('0x0'));var Sequelize=require('sequelize');module[_0x6d9d('0x1')]={'uniqueid':{'type':Sequelize[_0x6d9d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6d9d('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6d9d('0x3')]},'exitAt':{'type':Sequelize[_0x6d9d('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index e08a710..0e84ee1 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 _0x825e=['query','filters','attributes','fields','length','nolimit','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','intersection','find','create','body','catch','describe','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','index','map','SmsQueueReport','model','keys'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x825e,0xa6));var _0xe825=function(_0x3768fc,_0x382fe6){_0x3768fc=_0x3768fc-0x0;var _0x175a45=_0x825e[_0x3768fc];return _0x175a45;};'use strict';var emlformat=require(_0xe825('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe825('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe825('0x2'));var BPromise=require(_0xe825('0x3'));var Mustache=require(_0xe825('0x4'));var util=require(_0xe825('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe825('0x6'));var ejs=require(_0xe825('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe825('0x8'));var squel=require(_0xe825('0x9'));var crypto=require(_0xe825('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe825('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe825('0xc'));var Redis=require(_0xe825('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe825('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe825('0xf'));var logger=require(_0xe825('0x10'))(_0xe825('0x11'));var utils=require(_0xe825('0x12'));var config=require(_0xe825('0x13'));var licenseUtil=require(_0xe825('0x14'));var db=require(_0xe825('0x15'))['db'];function respondWithStatusCode(_0x1540e4,_0x2be5be){_0x2be5be=_0x2be5be||0xcc;return function(_0x255e61){if(_0x255e61){return _0x1540e4[_0xe825('0x16')](_0x2be5be);}return _0x1540e4['status'](_0x2be5be)[_0xe825('0x17')]();};}function respondWithResult(_0x4940f4,_0x672b01){_0x672b01=_0x672b01||0xc8;return function(_0x7b205c){if(_0x7b205c){return _0x4940f4[_0xe825('0x18')](_0x672b01)[_0xe825('0x19')](_0x7b205c);}};}function respondWithFilteredResult(_0x9e402b,_0x10124d){return function(_0x96d0ee){if(_0x96d0ee){var _0x245a29=typeof _0x10124d[_0xe825('0x1a')]===_0xe825('0x1b')&&typeof _0x10124d['limit']===_0xe825('0x1b');var _0x2e0097=_0x96d0ee[_0xe825('0x1c')];var _0x2a86a1=_0x245a29?0x0:_0x10124d[_0xe825('0x1a')];var _0x3aa272=_0x245a29?_0x96d0ee[_0xe825('0x1c')]:_0x10124d[_0xe825('0x1a')]+_0x10124d[_0xe825('0x1d')];var _0x78fe67;if(_0x3aa272>=_0x2e0097){_0x3aa272=_0x2e0097;_0x78fe67=0xc8;}else{_0x78fe67=0xce;}_0x9e402b[_0xe825('0x18')](_0x78fe67);return _0x9e402b[_0xe825('0x1e')]('Content-Range',_0x2a86a1+'-'+_0x3aa272+'/'+_0x2e0097)[_0xe825('0x19')](_0x96d0ee);}return null;};}function patchUpdates(_0x5745ce){return function(_0xf8175f){try{jsonpatch['apply'](_0xf8175f,_0x5745ce,!![]);}catch(_0x1a2116){return BPromise[_0xe825('0x1f')](_0x1a2116);}return _0xf8175f[_0xe825('0x20')]();};}function saveUpdates(_0x5d0d02,_0x8ab494){return function(_0x316063){if(_0x316063){return _0x316063[_0xe825('0x21')](_0x5d0d02)[_0xe825('0x22')](function(_0x5513a7){return _0x5513a7;});}return null;};}function removeEntity(_0x19728c,_0x3f7384){return function(_0x2b25db){if(_0x2b25db){return _0x2b25db[_0xe825('0x23')]()['then'](function(){_0x19728c[_0xe825('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3088cb,_0x5d30f8){return function(_0x36aad1){if(!_0x36aad1){_0x3088cb[_0xe825('0x16')](0x194);}return _0x36aad1;};}function handleError(_0x4e0066,_0x209361){_0x209361=_0x209361||0x1f4;return function(_0x9cec3b){logger[_0xe825('0x24')](_0x9cec3b[_0xe825('0x25')]);if(_0x9cec3b[_0xe825('0x26')]){delete _0x9cec3b[_0xe825('0x26')];}_0x4e0066['status'](_0x209361)['send'](_0x9cec3b);};}exports[_0xe825('0x27')]=function(_0x5d493d,_0x263a02){var _0x43f4bd={},_0x135045={},_0x33bed3={'count':0x0,'rows':[]};var _0x8abc4f=_[_0xe825('0x28')](db[_0xe825('0x29')]['rawAttributes'],function(_0x11c6a1){return{'name':_0x11c6a1['fieldName'],'type':_0x11c6a1['type']['key']};});_0x135045[_0xe825('0x2a')]=_[_0xe825('0x28')](_0x8abc4f,'name');_0x135045['query']=_[_0xe825('0x2b')](_0x5d493d[_0xe825('0x2c')]);_0x135045[_0xe825('0x2d')]=_['intersection'](_0x135045['model'],_0x135045[_0xe825('0x2c')]);_0x43f4bd[_0xe825('0x2e')]=_['intersection'](_0x135045[_0xe825('0x2a')],qs[_0xe825('0x2f')](_0x5d493d['query'][_0xe825('0x2f')]));_0x43f4bd[_0xe825('0x2e')]=_0x43f4bd[_0xe825('0x2e')][_0xe825('0x30')]?_0x43f4bd['attributes']:_0x135045[_0xe825('0x2a')];if(!_0x5d493d['query']['hasOwnProperty'](_0xe825('0x31'))){_0x43f4bd['limit']=qs['limit'](_0x5d493d[_0xe825('0x2c')][_0xe825('0x1d')]);_0x43f4bd[_0xe825('0x1a')]=qs['offset'](_0x5d493d[_0xe825('0x2c')][_0xe825('0x1a')]);}_0x43f4bd[_0xe825('0x32')]=qs[_0xe825('0x33')](_0x5d493d[_0xe825('0x2c')][_0xe825('0x33')]);_0x43f4bd[_0xe825('0x34')]=qs[_0xe825('0x2d')](_[_0xe825('0x35')](_0x5d493d[_0xe825('0x2c')],_0x135045[_0xe825('0x2d')]),_0x8abc4f);if(_0x5d493d[_0xe825('0x2c')]['filter']){_0x43f4bd[_0xe825('0x34')]=_['merge'](_0x43f4bd[_0xe825('0x34')],{'$or':_[_0xe825('0x28')](_0x8abc4f,function(_0x71ee79){if(_0x71ee79[_0xe825('0x36')]!=='VIRTUAL'){var _0x2e0559={};_0x2e0559[_0x71ee79['name']]={'$like':'%'+_0x5d493d[_0xe825('0x2c')][_0xe825('0x37')]+'%'};return _0x2e0559;}})});}_0x43f4bd=_[_0xe825('0x38')]({},_0x43f4bd,_0x5d493d[_0xe825('0x39')]);var _0x5cf615={'where':_0x43f4bd[_0xe825('0x34')]};return db[_0xe825('0x29')][_0xe825('0x1c')](_0x5cf615)['then'](function(_0x52ea81){_0x33bed3[_0xe825('0x1c')]=_0x52ea81;if(_0x5d493d[_0xe825('0x2c')][_0xe825('0x3a')]){_0x43f4bd[_0xe825('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xe825('0x3c')](_0x43f4bd);})[_0xe825('0x22')](function(_0x2cbad4){_0x33bed3['rows']=_0x2cbad4;return _0x33bed3;})[_0xe825('0x22')](respondWithFilteredResult(_0x263a02,_0x43f4bd))['catch'](handleError(_0x263a02,null));};exports[_0xe825('0x3d')]=function(_0x101397,_0x268232){var _0x1a7c90={'raw':!![],'where':{'id':_0x101397[_0xe825('0x3e')]['id']}},_0x5293b7={};_0x5293b7[_0xe825('0x2a')]=_[_0xe825('0x2b')](db[_0xe825('0x29')][_0xe825('0x3f')]);_0x5293b7[_0xe825('0x2c')]=_[_0xe825('0x2b')](_0x101397[_0xe825('0x2c')]);_0x5293b7[_0xe825('0x2d')]=_[_0xe825('0x40')](_0x5293b7[_0xe825('0x2a')],_0x5293b7['query']);_0x1a7c90[_0xe825('0x2e')]=_[_0xe825('0x40')](_0x5293b7[_0xe825('0x2a')],qs['fields'](_0x101397[_0xe825('0x2c')][_0xe825('0x2f')]));_0x1a7c90[_0xe825('0x2e')]=_0x1a7c90['attributes'][_0xe825('0x30')]?_0x1a7c90[_0xe825('0x2e')]:_0x5293b7[_0xe825('0x2a')];if(_0x101397[_0xe825('0x2c')][_0xe825('0x3a')]){_0x1a7c90[_0xe825('0x3b')]=[{'all':!![]}];}_0x1a7c90=_[_0xe825('0x38')]({},_0x1a7c90,_0x101397[_0xe825('0x39')]);return db[_0xe825('0x29')][_0xe825('0x41')](_0x1a7c90)[_0xe825('0x22')](handleEntityNotFound(_0x268232,null))[_0xe825('0x22')](respondWithResult(_0x268232,null))['catch'](handleError(_0x268232,null));};exports[_0xe825('0x42')]=function(_0x4f5b1e,_0x2d4ccc){return db['SmsQueueReport'][_0xe825('0x42')](_0x4f5b1e[_0xe825('0x43')],{})[_0xe825('0x22')](respondWithResult(_0x2d4ccc,0xc9))['catch'](handleError(_0x2d4ccc,null));};exports[_0xe825('0x21')]=function(_0x49355e,_0x1a6a05){if(_0x49355e[_0xe825('0x43')]['id']){delete _0x49355e[_0xe825('0x43')]['id'];}return db[_0xe825('0x29')]['find']({'where':{'id':_0x49355e[_0xe825('0x3e')]['id']}})[_0xe825('0x22')](handleEntityNotFound(_0x1a6a05,null))[_0xe825('0x22')](saveUpdates(_0x49355e[_0xe825('0x43')],null))[_0xe825('0x22')](respondWithResult(_0x1a6a05,null))[_0xe825('0x44')](handleError(_0x1a6a05,null));};exports[_0xe825('0x23')]=function(_0x2b2799,_0x29f358){return db[_0xe825('0x29')][_0xe825('0x41')]({'where':{'id':_0x2b2799[_0xe825('0x3e')]['id']}})[_0xe825('0x22')](handleEntityNotFound(_0x29f358,null))['then'](removeEntity(_0x29f358,null))[_0xe825('0x44')](handleError(_0x29f358,null));};exports[_0xe825('0x45')]=function(_0x557835,_0x1a8f36){return db[_0xe825('0x29')][_0xe825('0x45')]()[_0xe825('0x22')](respondWithResult(_0x1a8f36,null))[_0xe825('0x44')](handleError(_0x1a8f36,null));}; \ No newline at end of file +var _0xfea5=['hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','include','findAll','catch','params','rawAttributes','length','includeAll','options','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SmsQueueReport','type','key','model','query','keys','attributes','intersection','fields'];(function(_0x522a93,_0x25147d){var _0x2ea295=function(_0x5b32e9){while(--_0x5b32e9){_0x522a93['push'](_0x522a93['shift']());}};_0x2ea295(++_0x25147d);}(_0xfea5,0x1d1));var _0x5fea=function(_0x2c8d58,_0x5706d1){_0x2c8d58=_0x2c8d58-0x0;var _0x1b00c9=_0xfea5[_0x2c8d58];return _0x1b00c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5fea('0x0'));var jsonpatch=require(_0x5fea('0x1'));var rp=require(_0x5fea('0x2'));var moment=require(_0x5fea('0x3'));var BPromise=require(_0x5fea('0x4'));var Mustache=require(_0x5fea('0x5'));var util=require(_0x5fea('0x6'));var path=require(_0x5fea('0x7'));var sox=require('sox');var csv=require(_0x5fea('0x8'));var ejs=require(_0x5fea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5fea('0xa'));var crypto=require(_0x5fea('0xb'));var jsforce=require(_0x5fea('0xc'));var deskjs=require(_0x5fea('0xd'));var toCsv=require(_0x5fea('0x8'));var querystring=require(_0x5fea('0xe'));var Papa=require(_0x5fea('0xf'));var Redis=require('ioredis');var authService=require(_0x5fea('0x10'));var qs=require(_0x5fea('0x11'));var as=require(_0x5fea('0x12'));var hardwareService=require(_0x5fea('0x13'));var logger=require(_0x5fea('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5fea('0x15'));var licenseUtil=require(_0x5fea('0x16'));var db=require(_0x5fea('0x17'))['db'];function respondWithStatusCode(_0x30cb11,_0xd172ed){_0xd172ed=_0xd172ed||0xcc;return function(_0xc1fe4){if(_0xc1fe4){return _0x30cb11['sendStatus'](_0xd172ed);}return _0x30cb11[_0x5fea('0x18')](_0xd172ed)[_0x5fea('0x19')]();};}function respondWithResult(_0xe07167,_0x2840d5){_0x2840d5=_0x2840d5||0xc8;return function(_0x4bdd86){if(_0x4bdd86){return _0xe07167[_0x5fea('0x18')](_0x2840d5)[_0x5fea('0x1a')](_0x4bdd86);}};}function respondWithFilteredResult(_0x29bd90,_0xb1f85){return function(_0x5d7e5a){if(_0x5d7e5a){var _0x58c128=typeof _0xb1f85[_0x5fea('0x1b')]==='undefined'&&typeof _0xb1f85[_0x5fea('0x1c')]===_0x5fea('0x1d');var _0x1bc80c=_0x5d7e5a[_0x5fea('0x1e')];var _0x4ca8e1=_0x58c128?0x0:_0xb1f85['offset'];var _0x2d890b=_0x58c128?_0x5d7e5a['count']:_0xb1f85[_0x5fea('0x1b')]+_0xb1f85[_0x5fea('0x1c')];var _0x3d6673;if(_0x2d890b>=_0x1bc80c){_0x2d890b=_0x1bc80c;_0x3d6673=0xc8;}else{_0x3d6673=0xce;}_0x29bd90[_0x5fea('0x18')](_0x3d6673);return _0x29bd90['set'](_0x5fea('0x1f'),_0x4ca8e1+'-'+_0x2d890b+'/'+_0x1bc80c)['json'](_0x5d7e5a);}return null;};}function patchUpdates(_0x358104){return function(_0xb22f32){try{jsonpatch[_0x5fea('0x20')](_0xb22f32,_0x358104,!![]);}catch(_0x53f0af){return BPromise[_0x5fea('0x21')](_0x53f0af);}return _0xb22f32[_0x5fea('0x22')]();};}function saveUpdates(_0x5662d1,_0x3a4d2f){return function(_0x4607e9){if(_0x4607e9){return _0x4607e9[_0x5fea('0x23')](_0x5662d1)[_0x5fea('0x24')](function(_0x4bc6c6){return _0x4bc6c6;});}return null;};}function removeEntity(_0x54d2b0,_0x3fb871){return function(_0x3174ea){if(_0x3174ea){return _0x3174ea[_0x5fea('0x25')]()[_0x5fea('0x24')](function(){_0x54d2b0[_0x5fea('0x18')](0xcc)[_0x5fea('0x19')]();});}};}function handleEntityNotFound(_0x1845d7,_0x1aa471){return function(_0x509543){if(!_0x509543){_0x1845d7[_0x5fea('0x26')](0x194);}return _0x509543;};}function handleError(_0x39bcc2,_0x2dab5b){_0x2dab5b=_0x2dab5b||0x1f4;return function(_0x26c0a1){logger[_0x5fea('0x27')](_0x26c0a1[_0x5fea('0x28')]);if(_0x26c0a1[_0x5fea('0x29')]){delete _0x26c0a1[_0x5fea('0x29')];}_0x39bcc2[_0x5fea('0x18')](_0x2dab5b)['send'](_0x26c0a1);};}exports[_0x5fea('0x2a')]=function(_0x11ccde,_0x4d2c17){var _0x3438a9={},_0x36ab92={},_0x3ca83b={'count':0x0,'rows':[]};var _0x1da973=_[_0x5fea('0x2b')](db[_0x5fea('0x2c')]['rawAttributes'],function(_0x412d74){return{'name':_0x412d74['fieldName'],'type':_0x412d74[_0x5fea('0x2d')][_0x5fea('0x2e')]};});_0x36ab92[_0x5fea('0x2f')]=_['map'](_0x1da973,'name');_0x36ab92[_0x5fea('0x30')]=_[_0x5fea('0x31')](_0x11ccde[_0x5fea('0x30')]);_0x36ab92['filters']=_['intersection'](_0x36ab92[_0x5fea('0x2f')],_0x36ab92[_0x5fea('0x30')]);_0x3438a9[_0x5fea('0x32')]=_[_0x5fea('0x33')](_0x36ab92[_0x5fea('0x2f')],qs[_0x5fea('0x34')](_0x11ccde['query'][_0x5fea('0x34')]));_0x3438a9[_0x5fea('0x32')]=_0x3438a9['attributes']['length']?_0x3438a9[_0x5fea('0x32')]:_0x36ab92[_0x5fea('0x2f')];if(!_0x11ccde[_0x5fea('0x30')][_0x5fea('0x35')](_0x5fea('0x36'))){_0x3438a9[_0x5fea('0x1c')]=qs[_0x5fea('0x1c')](_0x11ccde[_0x5fea('0x30')][_0x5fea('0x1c')]);_0x3438a9[_0x5fea('0x1b')]=qs['offset'](_0x11ccde[_0x5fea('0x30')][_0x5fea('0x1b')]);}_0x3438a9[_0x5fea('0x37')]=qs[_0x5fea('0x38')](_0x11ccde['query'][_0x5fea('0x38')]);_0x3438a9['where']=qs[_0x5fea('0x39')](_[_0x5fea('0x3a')](_0x11ccde['query'],_0x36ab92['filters']),_0x1da973);if(_0x11ccde[_0x5fea('0x30')][_0x5fea('0x3b')]){_0x3438a9[_0x5fea('0x3c')]=_['merge'](_0x3438a9[_0x5fea('0x3c')],{'$or':_[_0x5fea('0x2b')](_0x1da973,function(_0x393d23){if(_0x393d23['type']!=='VIRTUAL'){var _0x19165a={};_0x19165a[_0x393d23[_0x5fea('0x29')]]={'$like':'%'+_0x11ccde[_0x5fea('0x30')]['filter']+'%'};return _0x19165a;}})});}_0x3438a9=_[_0x5fea('0x3d')]({},_0x3438a9,_0x11ccde['options']);var _0x563f6c={'where':_0x3438a9['where']};return db[_0x5fea('0x2c')][_0x5fea('0x1e')](_0x563f6c)[_0x5fea('0x24')](function(_0x2cef98){_0x3ca83b[_0x5fea('0x1e')]=_0x2cef98;if(_0x11ccde[_0x5fea('0x30')]['includeAll']){_0x3438a9[_0x5fea('0x3e')]=[{'all':!![]}];}return db[_0x5fea('0x2c')][_0x5fea('0x3f')](_0x3438a9);})[_0x5fea('0x24')](function(_0x24ed7e){_0x3ca83b['rows']=_0x24ed7e;return _0x3ca83b;})[_0x5fea('0x24')](respondWithFilteredResult(_0x4d2c17,_0x3438a9))[_0x5fea('0x40')](handleError(_0x4d2c17,null));};exports['show']=function(_0x48d8ee,_0x2f4035){var _0x2b1a0c={'raw':!![],'where':{'id':_0x48d8ee[_0x5fea('0x41')]['id']}},_0x9a87b={};_0x9a87b[_0x5fea('0x2f')]=_['keys'](db[_0x5fea('0x2c')][_0x5fea('0x42')]);_0x9a87b['query']=_['keys'](_0x48d8ee[_0x5fea('0x30')]);_0x9a87b[_0x5fea('0x39')]=_['intersection'](_0x9a87b[_0x5fea('0x2f')],_0x9a87b[_0x5fea('0x30')]);_0x2b1a0c['attributes']=_[_0x5fea('0x33')](_0x9a87b[_0x5fea('0x2f')],qs[_0x5fea('0x34')](_0x48d8ee[_0x5fea('0x30')]['fields']));_0x2b1a0c['attributes']=_0x2b1a0c[_0x5fea('0x32')][_0x5fea('0x43')]?_0x2b1a0c[_0x5fea('0x32')]:_0x9a87b[_0x5fea('0x2f')];if(_0x48d8ee[_0x5fea('0x30')][_0x5fea('0x44')]){_0x2b1a0c[_0x5fea('0x3e')]=[{'all':!![]}];}_0x2b1a0c=_[_0x5fea('0x3d')]({},_0x2b1a0c,_0x48d8ee[_0x5fea('0x45')]);return db[_0x5fea('0x2c')]['find'](_0x2b1a0c)[_0x5fea('0x24')](handleEntityNotFound(_0x2f4035,null))[_0x5fea('0x24')](respondWithResult(_0x2f4035,null))['catch'](handleError(_0x2f4035,null));};exports[_0x5fea('0x46')]=function(_0x421705,_0x5525da){return db[_0x5fea('0x2c')]['create'](_0x421705[_0x5fea('0x47')],{})[_0x5fea('0x24')](respondWithResult(_0x5525da,0xc9))[_0x5fea('0x40')](handleError(_0x5525da,null));};exports[_0x5fea('0x23')]=function(_0x730148,_0x45abf5){if(_0x730148[_0x5fea('0x47')]['id']){delete _0x730148['body']['id'];}return db[_0x5fea('0x2c')][_0x5fea('0x48')]({'where':{'id':_0x730148[_0x5fea('0x41')]['id']}})[_0x5fea('0x24')](handleEntityNotFound(_0x45abf5,null))[_0x5fea('0x24')](saveUpdates(_0x730148['body'],null))['then'](respondWithResult(_0x45abf5,null))[_0x5fea('0x40')](handleError(_0x45abf5,null));};exports[_0x5fea('0x25')]=function(_0x509639,_0x25f95d){return db[_0x5fea('0x2c')][_0x5fea('0x48')]({'where':{'id':_0x509639['params']['id']}})[_0x5fea('0x24')](handleEntityNotFound(_0x25f95d,null))[_0x5fea('0x24')](removeEntity(_0x25f95d,null))['catch'](handleError(_0x25f95d,null));};exports[_0x5fea('0x49')]=function(_0xdaa384,_0x440505){return db[_0x5fea('0x2c')][_0x5fea('0x49')]()[_0x5fea('0x24')](respondWithResult(_0x440505,null))[_0x5fea('0x40')](handleError(_0x440505,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 03ae962..4b25ae4 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x4b418f,_0x3b6a96){var _0x2ed208=function(_0x5bb29b){while(--_0x5bb29b){_0x4b418f['push'](_0x4b418f['shift']());}};_0x2ed208(++_0x3b6a96);}(_0xe706,0xa3));var _0x6e70=function(_0x23dda5,_0x221860){_0x23dda5=_0x23dda5-0x0;var _0x32c24e=_0xe706[_0x23dda5];return _0x32c24e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x3cb445,_0x12497f){var _0x18ee80=function(_0x3ccb9e){while(--_0x3ccb9e){_0x3cb445['push'](_0x3cb445['shift']());}};_0x18ee80(++_0x12497f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 96ce733..0122821 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 _0x8b9e=['SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','options','raw','catch','update','body','where','attributes','limit','UpdateSmsQueueReport','debug','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x5a7d16,_0x3f2515){var _0x59f66c=function(_0xe001b6){while(--_0xe001b6){_0x5a7d16['push'](_0x5a7d16['shift']());}};_0x59f66c(++_0x3f2515);}(_0x8b9e,0x1a0));var _0xe8b9=function(_0xd58e21,_0x36311f){_0xd58e21=_0xd58e21-0x0;var _0x2c4a40=_0x8b9e[_0xd58e21];return _0x2c4a40;};'use strict';var _=require(_0xe8b9('0x0'));var util=require('util');var moment=require(_0xe8b9('0x1'));var BPromise=require('bluebird');var rs=require(_0xe8b9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8b9('0x3'))['db'];var utils=require(_0xe8b9('0x4'));var logger=require(_0xe8b9('0x5'))(_0xe8b9('0x6'));var config=require('../../config/environment');var jayson=require(_0xe8b9('0x7'));var client=jayson[_0xe8b9('0x8')][_0xe8b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2356cf,_0x31307e,_0x1329f9){return new BPromise(function(_0x576f2c,_0xa40cdb){return client[_0xe8b9('0xa')](_0x2356cf,_0x1329f9)[_0xe8b9('0xb')](function(_0x470717){logger[_0xe8b9('0xc')](_0xe8b9('0xd'),_0x31307e,_0xe8b9('0xe'));logger['debug'](_0xe8b9('0xf'),_0x31307e,_0xe8b9('0xe'),JSON[_0xe8b9('0x10')](_0x470717));if(_0x470717['error']){if(_0x470717[_0xe8b9('0x11')][_0xe8b9('0x12')]===0x1f4){logger[_0xe8b9('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x31307e,_0x470717[_0xe8b9('0x11')]['message']);return _0xa40cdb(_0x470717[_0xe8b9('0x11')][_0xe8b9('0x13')]);}logger[_0xe8b9('0x11')](_0xe8b9('0xd'),_0x31307e,_0x470717[_0xe8b9('0x11')]['message']);return _0x576f2c(_0x470717['error'][_0xe8b9('0x13')]);}else{logger['info'](_0xe8b9('0xd'),_0x31307e,'request\x20sent');_0x576f2c(_0x470717['result']['message']);}})['catch'](function(_0x374e3b){logger[_0xe8b9('0x11')](_0xe8b9('0xd'),_0x31307e,_0x374e3b);_0xa40cdb(_0x374e3b);});});}exports[_0xe8b9('0x14')]=function(_0xf7862d){var _0xd216b5=this;return new Promise(function(_0x31454b,_0x27545e){return db[_0xe8b9('0x15')][_0xe8b9('0x16')](_0xf7862d['body'],{'raw':_0xf7862d[_0xe8b9('0x17')]?_0xf7862d[_0xe8b9('0x17')][_0xe8b9('0x18')]===undefined?!![]:![]:!![]})[_0xe8b9('0xb')](function(_0x111127){logger[_0xe8b9('0xc')]('CreateSmsQueueReport',_0xf7862d);logger['debug']('CreateSmsQueueReport',_0xf7862d,JSON['stringify'](_0x111127));_0x31454b(_0x111127);})[_0xe8b9('0x19')](function(_0x8a06e2){logger['error'](_0xe8b9('0x14'),_0x8a06e2[_0xe8b9('0x13')],_0xf7862d);_0x27545e(_0xd216b5[_0xe8b9('0x11')](0x1f4,_0x8a06e2[_0xe8b9('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x43f4d9){var _0x9f6f7e=this;return new Promise(function(_0x55edac,_0x5c931a){return db['SmsQueueReport'][_0xe8b9('0x1a')](_0x43f4d9[_0xe8b9('0x1b')],{'raw':_0x43f4d9[_0xe8b9('0x17')]?_0x43f4d9[_0xe8b9('0x17')][_0xe8b9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43f4d9[_0xe8b9('0x17')]?_0x43f4d9[_0xe8b9('0x17')][_0xe8b9('0x1c')]||null:null,'attributes':_0x43f4d9[_0xe8b9('0x17')]?_0x43f4d9[_0xe8b9('0x17')][_0xe8b9('0x1d')]||null:null,'limit':_0x43f4d9[_0xe8b9('0x17')]?_0x43f4d9[_0xe8b9('0x17')][_0xe8b9('0x1e')]||null:null})[_0xe8b9('0xb')](function(_0x391bb1){logger[_0xe8b9('0xc')](_0xe8b9('0x1f'),_0x43f4d9);logger[_0xe8b9('0x20')](_0xe8b9('0x1f'),_0x43f4d9,JSON[_0xe8b9('0x10')](_0x391bb1));_0x55edac(_0x391bb1);})[_0xe8b9('0x19')](function(_0x3ffac2){logger[_0xe8b9('0x11')](_0xe8b9('0x1f'),_0x3ffac2[_0xe8b9('0x13')],_0x43f4d9);_0x5c931a(_0x9f6f7e['error'](0x1f4,_0x3ffac2[_0xe8b9('0x13')]));});});}; \ No newline at end of file +var _0xc08a=['limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','SmsQueueReport','body','options','raw','CreateSmsQueueReport','where','attributes'];(function(_0x22d2a8,_0x34224b){var _0x4c6392=function(_0x3ddcc5){while(--_0x3ddcc5){_0x22d2a8['push'](_0x22d2a8['shift']());}};_0x4c6392(++_0x34224b);}(_0xc08a,0xbc));var _0xac08=function(_0x42c165,_0x18a3e1){_0x42c165=_0x42c165-0x0;var _0x232268=_0xc08a[_0x42c165];return _0x232268;};'use strict';var _=require(_0xac08('0x0'));var util=require(_0xac08('0x1'));var moment=require(_0xac08('0x2'));var BPromise=require(_0xac08('0x3'));var rs=require(_0xac08('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac08('0x5'));var logger=require(_0xac08('0x6'))(_0xac08('0x7'));var config=require('../../config/environment');var jayson=require(_0xac08('0x8'));var client=jayson['client'][_0xac08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8a5ec7,_0x179c3e,_0x29e15b){return new BPromise(function(_0x1609f9,_0x30f84e){return client[_0xac08('0xa')](_0x8a5ec7,_0x29e15b)[_0xac08('0xb')](function(_0x59a162){logger[_0xac08('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x179c3e,_0xac08('0xd'));logger[_0xac08('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x179c3e,'request\x20sent',JSON[_0xac08('0xf')](_0x59a162));if(_0x59a162[_0xac08('0x10')]){if(_0x59a162[_0xac08('0x10')][_0xac08('0x11')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x179c3e,_0x59a162[_0xac08('0x10')]['message']);return _0x30f84e(_0x59a162['error'][_0xac08('0x12')]);}logger[_0xac08('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x179c3e,_0x59a162[_0xac08('0x10')]['message']);return _0x1609f9(_0x59a162[_0xac08('0x10')][_0xac08('0x12')]);}else{logger['info'](_0xac08('0x13'),_0x179c3e,_0xac08('0xd'));_0x1609f9(_0x59a162[_0xac08('0x14')][_0xac08('0x12')]);}})[_0xac08('0x15')](function(_0x38a5b9){logger[_0xac08('0x10')](_0xac08('0x13'),_0x179c3e,_0x38a5b9);_0x30f84e(_0x38a5b9);});});}exports['CreateSmsQueueReport']=function(_0x2c6d4d){var _0x365bbe=this;return new Promise(function(_0x5836ea,_0x3483ef){return db[_0xac08('0x16')]['create'](_0x2c6d4d[_0xac08('0x17')],{'raw':_0x2c6d4d['options']?_0x2c6d4d[_0xac08('0x18')][_0xac08('0x19')]===undefined?!![]:![]:!![]})[_0xac08('0xb')](function(_0x41634a){logger['info'](_0xac08('0x1a'),_0x2c6d4d);logger[_0xac08('0xe')]('CreateSmsQueueReport',_0x2c6d4d,JSON[_0xac08('0xf')](_0x41634a));_0x5836ea(_0x41634a);})[_0xac08('0x15')](function(_0x596345){logger[_0xac08('0x10')](_0xac08('0x1a'),_0x596345['message'],_0x2c6d4d);_0x3483ef(_0x365bbe[_0xac08('0x10')](0x1f4,_0x596345[_0xac08('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x507fc0){var _0x188b50=this;return new Promise(function(_0x27e3bb,_0x36c0b8){return db[_0xac08('0x16')]['update'](_0x507fc0[_0xac08('0x17')],{'raw':_0x507fc0['options']?_0x507fc0[_0xac08('0x18')][_0xac08('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x507fc0[_0xac08('0x18')]?_0x507fc0[_0xac08('0x18')][_0xac08('0x1b')]||null:null,'attributes':_0x507fc0['options']?_0x507fc0[_0xac08('0x18')][_0xac08('0x1c')]||null:null,'limit':_0x507fc0[_0xac08('0x18')]?_0x507fc0[_0xac08('0x18')][_0xac08('0x1d')]||null:null})['then'](function(_0x298b93){logger[_0xac08('0xc')]('UpdateSmsQueueReport',_0x507fc0);logger[_0xac08('0xe')](_0xac08('0x1e'),_0x507fc0,JSON[_0xac08('0xf')](_0x298b93));_0x27e3bb(_0x298b93);})[_0xac08('0x15')](function(_0x5d48b0){logger[_0xac08('0x10')](_0xac08('0x1e'),_0x5d48b0[_0xac08('0x12')],_0x507fc0);_0x36c0b8(_0x188b50[_0xac08('0x10')](0x1f4,_0x5d48b0[_0xac08('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 5f71dc4..1c6d9db 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 _0x90b5=['/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x26be24,_0xed90c7){var _0x5a1ae5=function(_0x50843c){while(--_0x50843c){_0x26be24['push'](_0x26be24['shift']());}};_0x5a1ae5(++_0xed90c7);}(_0x90b5,0x139));var _0x590b=function(_0x1d4321,_0x4b6283){_0x1d4321=_0x1d4321-0x0;var _0x46d033=_0x90b5[_0x1d4321];return _0x46d033;};'use strict';var multer=require(_0x590b('0x0'));var util=require('util');var path=require(_0x590b('0x1'));var timeout=require(_0x590b('0x2'));var express=require(_0x590b('0x3'));var router=express[_0x590b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var controller=require('./smsTransferReport.controller');router[_0x590b('0x7')]('/',auth[_0x590b('0x8')](),controller[_0x590b('0x9')]);router['get'](_0x590b('0xa'),auth[_0x590b('0x8')](),controller[_0x590b('0xb')]);router[_0x590b('0x7')](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0xd')]);router[_0x590b('0xe')]('/',auth[_0x590b('0x8')](),controller['create']);router[_0x590b('0xf')](_0x590b('0xc'),auth['isAuthenticated'](),controller[_0x590b('0x10')]);router['delete'](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0x11')]);module[_0x590b('0x12')]=router; \ No newline at end of file +var _0x3e74=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x1beb72,_0x5ab126){var _0x4d2049=function(_0x14c38f){while(--_0x14c38f){_0x1beb72['push'](_0x1beb72['shift']());}};_0x4d2049(++_0x5ab126);}(_0x3e74,0x175));var _0x43e7=function(_0x6092cb,_0x5095db){_0x6092cb=_0x6092cb-0x0;var _0x22822f=_0x3e74[_0x6092cb];return _0x22822f;};'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['post']('/',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 5e59032..f1d49aa 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x23495e,_0x5417e1){var _0xd18e58=function(_0x9e298c){while(--_0x9e298c){_0x23495e['push'](_0x23495e['shift']());}};_0xd18e58(++_0x5417e1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x557757,_0x3bd68e){_0x557757=_0x557757-0x0;var _0x25e4ec=_0xf4eb[_0x557757];return _0x25e4ec;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x169dff,_0x57be0){var _0x91cf22=function(_0x527498){while(--_0x527498){_0x169dff['push'](_0x169dff['shift']());}};_0x91cf22(++_0x57be0);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 7bb740e..fbdee3b 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 _0x27f0=['../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','merge','options','SmsTransferReport','includeAll','include','rows','catch','show','params','keys','create','body','update','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5b6ffe,_0x280e9a){var _0x5f2d56=function(_0x534a6e){while(--_0x534a6e){_0x5b6ffe['push'](_0x5b6ffe['shift']());}};_0x5f2d56(++_0x280e9a);}(_0x27f0,0xc6));var _0x027f=function(_0x2d8c90,_0xebac28){_0x2d8c90=_0x2d8c90-0x0;var _0x118c87=_0x27f0[_0x2d8c90];return _0x118c87;};'use strict';var emlformat=require(_0x027f('0x0'));var rimraf=require(_0x027f('0x1'));var zipdir=require(_0x027f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x027f('0x3'));var Mustache=require(_0x027f('0x4'));var util=require(_0x027f('0x5'));var path=require(_0x027f('0x6'));var sox=require('sox');var csv=require(_0x027f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x027f('0x8'));var _=require(_0x027f('0x9'));var squel=require(_0x027f('0xa'));var crypto=require(_0x027f('0xb'));var jsforce=require(_0x027f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x027f('0x7'));var querystring=require(_0x027f('0xd'));var Papa=require(_0x027f('0xe'));var Redis=require('ioredis');var authService=require(_0x027f('0xf'));var qs=require(_0x027f('0x10'));var as=require(_0x027f('0x11'));var hardwareService=require(_0x027f('0x12'));var logger=require(_0x027f('0x13'))(_0x027f('0x14'));var utils=require(_0x027f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x248b9c,_0x5e1189){_0x5e1189=_0x5e1189||0xcc;return function(_0x51c10f){if(_0x51c10f){return _0x248b9c[_0x027f('0x16')](_0x5e1189);}return _0x248b9c['status'](_0x5e1189)[_0x027f('0x17')]();};}function respondWithResult(_0x11a7e7,_0x483d5b){_0x483d5b=_0x483d5b||0xc8;return function(_0x46809f){if(_0x46809f){return _0x11a7e7[_0x027f('0x18')](_0x483d5b)[_0x027f('0x19')](_0x46809f);}};}function respondWithFilteredResult(_0x13b641,_0xfd4a38){return function(_0x175e80){if(_0x175e80){var _0x867b9c=typeof _0xfd4a38[_0x027f('0x1a')]==='undefined'&&typeof _0xfd4a38[_0x027f('0x1b')]==='undefined';var _0x5d3aa6=_0x175e80[_0x027f('0x1c')];var _0x3fbf5d=_0x867b9c?0x0:_0xfd4a38[_0x027f('0x1a')];var _0x2e85be=_0x867b9c?_0x175e80[_0x027f('0x1c')]:_0xfd4a38[_0x027f('0x1a')]+_0xfd4a38['limit'];var _0x2b15fe;if(_0x2e85be>=_0x5d3aa6){_0x2e85be=_0x5d3aa6;_0x2b15fe=0xc8;}else{_0x2b15fe=0xce;}_0x13b641[_0x027f('0x18')](_0x2b15fe);return _0x13b641[_0x027f('0x1d')](_0x027f('0x1e'),_0x3fbf5d+'-'+_0x2e85be+'/'+_0x5d3aa6)[_0x027f('0x19')](_0x175e80);}return null;};}function patchUpdates(_0x51fed3){return function(_0x5b2b13){try{jsonpatch[_0x027f('0x1f')](_0x5b2b13,_0x51fed3,!![]);}catch(_0x3830cb){return BPromise[_0x027f('0x20')](_0x3830cb);}return _0x5b2b13[_0x027f('0x21')]();};}function saveUpdates(_0x2763ac,_0x4ad33d){return function(_0x31ff5c){if(_0x31ff5c){return _0x31ff5c['update'](_0x2763ac)[_0x027f('0x22')](function(_0x5f089c){return _0x5f089c;});}return null;};}function removeEntity(_0x5dc34a,_0x598502){return function(_0x2b8309){if(_0x2b8309){return _0x2b8309[_0x027f('0x23')]()['then'](function(){_0x5dc34a['status'](0xcc)[_0x027f('0x17')]();});}};}function handleEntityNotFound(_0x341230,_0x5be295){return function(_0x3089d2){if(!_0x3089d2){_0x341230[_0x027f('0x16')](0x194);}return _0x3089d2;};}function handleError(_0x4f22a9,_0xe0e810){_0xe0e810=_0xe0e810||0x1f4;return function(_0x30b8e2){logger[_0x027f('0x24')](_0x30b8e2[_0x027f('0x25')]);if(_0x30b8e2[_0x027f('0x26')]){delete _0x30b8e2[_0x027f('0x26')];}_0x4f22a9[_0x027f('0x18')](_0xe0e810)[_0x027f('0x27')](_0x30b8e2);};}exports[_0x027f('0x28')]=function(_0x255bd0,_0x4ac6a2){var _0x71d920={},_0x5a4238={},_0x5a1df0={'count':0x0,'rows':[]};var _0x48f555=_[_0x027f('0x29')](db['SmsTransferReport'][_0x027f('0x2a')],function(_0x2be0df){return{'name':_0x2be0df['fieldName'],'type':_0x2be0df[_0x027f('0x2b')][_0x027f('0x2c')]};});_0x5a4238[_0x027f('0x2d')]=_['map'](_0x48f555,_0x027f('0x26'));_0x5a4238[_0x027f('0x2e')]=_['keys'](_0x255bd0[_0x027f('0x2e')]);_0x5a4238['filters']=_['intersection'](_0x5a4238[_0x027f('0x2d')],_0x5a4238[_0x027f('0x2e')]);_0x71d920['attributes']=_[_0x027f('0x2f')](_0x5a4238[_0x027f('0x2d')],qs[_0x027f('0x30')](_0x255bd0[_0x027f('0x2e')][_0x027f('0x30')]));_0x71d920[_0x027f('0x31')]=_0x71d920[_0x027f('0x31')][_0x027f('0x32')]?_0x71d920[_0x027f('0x31')]:_0x5a4238[_0x027f('0x2d')];if(!_0x255bd0[_0x027f('0x2e')][_0x027f('0x33')]('nolimit')){_0x71d920[_0x027f('0x1b')]=qs[_0x027f('0x1b')](_0x255bd0[_0x027f('0x2e')]['limit']);_0x71d920[_0x027f('0x1a')]=qs['offset'](_0x255bd0[_0x027f('0x2e')][_0x027f('0x1a')]);}_0x71d920[_0x027f('0x34')]=qs['sort'](_0x255bd0['query'][_0x027f('0x35')]);_0x71d920[_0x027f('0x36')]=qs[_0x027f('0x37')](_[_0x027f('0x38')](_0x255bd0[_0x027f('0x2e')],_0x5a4238['filters']),_0x48f555);if(_0x255bd0[_0x027f('0x2e')]['filter']){_0x71d920[_0x027f('0x36')]=_['merge'](_0x71d920['where'],{'$or':_[_0x027f('0x29')](_0x48f555,function(_0x367b73){if(_0x367b73[_0x027f('0x2b')]!==_0x027f('0x39')){var _0x27f6ea={};_0x27f6ea[_0x367b73['name']]={'$like':'%'+_0x255bd0['query']['filter']+'%'};return _0x27f6ea;}})});}_0x71d920=_[_0x027f('0x3a')]({},_0x71d920,_0x255bd0[_0x027f('0x3b')]);var _0x3f2756={'where':_0x71d920[_0x027f('0x36')]};return db[_0x027f('0x3c')][_0x027f('0x1c')](_0x3f2756)['then'](function(_0x2145a4){_0x5a1df0[_0x027f('0x1c')]=_0x2145a4;if(_0x255bd0[_0x027f('0x2e')][_0x027f('0x3d')]){_0x71d920[_0x027f('0x3e')]=[{'all':!![]}];}return db[_0x027f('0x3c')]['findAll'](_0x71d920);})['then'](function(_0x469928){_0x5a1df0[_0x027f('0x3f')]=_0x469928;return _0x5a1df0;})[_0x027f('0x22')](respondWithFilteredResult(_0x4ac6a2,_0x71d920))[_0x027f('0x40')](handleError(_0x4ac6a2,null));};exports[_0x027f('0x41')]=function(_0x3f8d2d,_0x45782c){var _0x3cf54e={'raw':!![],'where':{'id':_0x3f8d2d[_0x027f('0x42')]['id']}},_0x2a7de3={};_0x2a7de3[_0x027f('0x2d')]=_[_0x027f('0x43')](db[_0x027f('0x3c')][_0x027f('0x2a')]);_0x2a7de3[_0x027f('0x2e')]=_['keys'](_0x3f8d2d[_0x027f('0x2e')]);_0x2a7de3['filters']=_[_0x027f('0x2f')](_0x2a7de3[_0x027f('0x2d')],_0x2a7de3[_0x027f('0x2e')]);_0x3cf54e[_0x027f('0x31')]=_[_0x027f('0x2f')](_0x2a7de3['model'],qs['fields'](_0x3f8d2d['query'][_0x027f('0x30')]));_0x3cf54e[_0x027f('0x31')]=_0x3cf54e[_0x027f('0x31')]['length']?_0x3cf54e[_0x027f('0x31')]:_0x2a7de3[_0x027f('0x2d')];if(_0x3f8d2d[_0x027f('0x2e')]['includeAll']){_0x3cf54e[_0x027f('0x3e')]=[{'all':!![]}];}_0x3cf54e=_['merge']({},_0x3cf54e,_0x3f8d2d[_0x027f('0x3b')]);return db['SmsTransferReport']['find'](_0x3cf54e)[_0x027f('0x22')](handleEntityNotFound(_0x45782c,null))[_0x027f('0x22')](respondWithResult(_0x45782c,null))[_0x027f('0x40')](handleError(_0x45782c,null));};exports[_0x027f('0x44')]=function(_0x3e7158,_0x4ff4b9){return db['SmsTransferReport'][_0x027f('0x44')](_0x3e7158[_0x027f('0x45')],{})['then'](respondWithResult(_0x4ff4b9,0xc9))['catch'](handleError(_0x4ff4b9,null));};exports[_0x027f('0x46')]=function(_0x12db93,_0x192845){if(_0x12db93['body']['id']){delete _0x12db93[_0x027f('0x45')]['id'];}return db[_0x027f('0x3c')]['find']({'where':{'id':_0x12db93['params']['id']}})[_0x027f('0x22')](handleEntityNotFound(_0x192845,null))['then'](saveUpdates(_0x12db93['body'],null))[_0x027f('0x22')](respondWithResult(_0x192845,null))[_0x027f('0x40')](handleError(_0x192845,null));};exports[_0x027f('0x23')]=function(_0x30e134,_0x4fca02){return db[_0x027f('0x3c')]['find']({'where':{'id':_0x30e134[_0x027f('0x42')]['id']}})[_0x027f('0x22')](handleEntityNotFound(_0x4fca02,null))[_0x027f('0x22')](removeEntity(_0x4fca02,null))['catch'](handleError(_0x4fca02,null));};exports[_0x027f('0x47')]=function(_0x3983da,_0x243bc2){return db[_0x027f('0x3c')][_0x027f('0x47')]()[_0x027f('0x22')](respondWithResult(_0x243bc2,null))[_0x027f('0x40')](handleError(_0x243bc2,null));}; \ No newline at end of file +var _0xe4f1=['reject','update','then','sendStatus','error','stack','index','map','rawAttributes','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SmsTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x21df69,_0x587407){var _0x15ad23=function(_0x192add){while(--_0x192add){_0x21df69['push'](_0x21df69['shift']());}};_0x15ad23(++_0x587407);}(_0xe4f1,0x102));var _0x1e4f=function(_0x414b65,_0x15871f){_0x414b65=_0x414b65-0x0;var _0xd85ffa=_0xe4f1[_0x414b65];return _0xd85ffa;};'use strict';var emlformat=require(_0x1e4f('0x0'));var rimraf=require(_0x1e4f('0x1'));var zipdir=require(_0x1e4f('0x2'));var jsonpatch=require(_0x1e4f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1e4f('0x4'));var util=require(_0x1e4f('0x5'));var path=require(_0x1e4f('0x6'));var sox=require('sox');var csv=require(_0x1e4f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e4f('0x8'));var _=require('lodash');var squel=require(_0x1e4f('0x9'));var crypto=require(_0x1e4f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1e4f('0xb'));var toCsv=require(_0x1e4f('0x7'));var querystring=require(_0x1e4f('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1e4f('0xd'));var qs=require(_0x1e4f('0xe'));var as=require(_0x1e4f('0xf'));var hardwareService=require(_0x1e4f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x1e4f('0x11'));var config=require(_0x1e4f('0x12'));var licenseUtil=require(_0x1e4f('0x13'));var db=require(_0x1e4f('0x14'))['db'];function respondWithStatusCode(_0x5157f3,_0x1a643b){_0x1a643b=_0x1a643b||0xcc;return function(_0x168a08){if(_0x168a08){return _0x5157f3['sendStatus'](_0x1a643b);}return _0x5157f3['status'](_0x1a643b)[_0x1e4f('0x15')]();};}function respondWithResult(_0x472b89,_0x36f467){_0x36f467=_0x36f467||0xc8;return function(_0x281799){if(_0x281799){return _0x472b89[_0x1e4f('0x16')](_0x36f467)[_0x1e4f('0x17')](_0x281799);}};}function respondWithFilteredResult(_0x150e12,_0x39482c){return function(_0x458db8){if(_0x458db8){var _0x577aab=typeof _0x39482c[_0x1e4f('0x18')]===_0x1e4f('0x19')&&typeof _0x39482c[_0x1e4f('0x1a')]===_0x1e4f('0x19');var _0x388771=_0x458db8[_0x1e4f('0x1b')];var _0x551d9a=_0x577aab?0x0:_0x39482c['offset'];var _0xff651d=_0x577aab?_0x458db8[_0x1e4f('0x1b')]:_0x39482c[_0x1e4f('0x18')]+_0x39482c[_0x1e4f('0x1a')];var _0x467430;if(_0xff651d>=_0x388771){_0xff651d=_0x388771;_0x467430=0xc8;}else{_0x467430=0xce;}_0x150e12['status'](_0x467430);return _0x150e12['set'](_0x1e4f('0x1c'),_0x551d9a+'-'+_0xff651d+'/'+_0x388771)['json'](_0x458db8);}return null;};}function patchUpdates(_0x3fb5d8){return function(_0x272ecc){try{jsonpatch[_0x1e4f('0x1d')](_0x272ecc,_0x3fb5d8,!![]);}catch(_0x3a1f74){return BPromise[_0x1e4f('0x1e')](_0x3a1f74);}return _0x272ecc['save']();};}function saveUpdates(_0x3b1772,_0x339a86){return function(_0x1779b6){if(_0x1779b6){return _0x1779b6[_0x1e4f('0x1f')](_0x3b1772)['then'](function(_0x175757){return _0x175757;});}return null;};}function removeEntity(_0x16236e,_0x25ec1b){return function(_0x464b90){if(_0x464b90){return _0x464b90['destroy']()[_0x1e4f('0x20')](function(){_0x16236e[_0x1e4f('0x16')](0xcc)[_0x1e4f('0x15')]();});}};}function handleEntityNotFound(_0x13aea5,_0x31269a){return function(_0x31fc7f){if(!_0x31fc7f){_0x13aea5[_0x1e4f('0x21')](0x194);}return _0x31fc7f;};}function handleError(_0xb2a79c,_0x2fd016){_0x2fd016=_0x2fd016||0x1f4;return function(_0x21f92d){logger[_0x1e4f('0x22')](_0x21f92d[_0x1e4f('0x23')]);if(_0x21f92d['name']){delete _0x21f92d['name'];}_0xb2a79c[_0x1e4f('0x16')](_0x2fd016)['send'](_0x21f92d);};}exports[_0x1e4f('0x24')]=function(_0x4d0ffb,_0x247f8e){var _0x30e3f0={},_0x4227bc={},_0x1dbf1d={'count':0x0,'rows':[]};var _0x4615f5=_[_0x1e4f('0x25')](db['SmsTransferReport'][_0x1e4f('0x26')],function(_0x3ff4ef){return{'name':_0x3ff4ef['fieldName'],'type':_0x3ff4ef[_0x1e4f('0x27')]['key']};});_0x4227bc[_0x1e4f('0x28')]=_[_0x1e4f('0x25')](_0x4615f5,_0x1e4f('0x29'));_0x4227bc[_0x1e4f('0x2a')]=_[_0x1e4f('0x2b')](_0x4d0ffb[_0x1e4f('0x2a')]);_0x4227bc[_0x1e4f('0x2c')]=_[_0x1e4f('0x2d')](_0x4227bc['model'],_0x4227bc['query']);_0x30e3f0['attributes']=_[_0x1e4f('0x2d')](_0x4227bc[_0x1e4f('0x28')],qs[_0x1e4f('0x2e')](_0x4d0ffb[_0x1e4f('0x2a')]['fields']));_0x30e3f0['attributes']=_0x30e3f0[_0x1e4f('0x2f')][_0x1e4f('0x30')]?_0x30e3f0['attributes']:_0x4227bc[_0x1e4f('0x28')];if(!_0x4d0ffb['query'][_0x1e4f('0x31')](_0x1e4f('0x32'))){_0x30e3f0[_0x1e4f('0x1a')]=qs[_0x1e4f('0x1a')](_0x4d0ffb[_0x1e4f('0x2a')][_0x1e4f('0x1a')]);_0x30e3f0[_0x1e4f('0x18')]=qs[_0x1e4f('0x18')](_0x4d0ffb['query'][_0x1e4f('0x18')]);}_0x30e3f0[_0x1e4f('0x33')]=qs[_0x1e4f('0x34')](_0x4d0ffb[_0x1e4f('0x2a')][_0x1e4f('0x34')]);_0x30e3f0['where']=qs[_0x1e4f('0x2c')](_[_0x1e4f('0x35')](_0x4d0ffb[_0x1e4f('0x2a')],_0x4227bc[_0x1e4f('0x2c')]),_0x4615f5);if(_0x4d0ffb['query']['filter']){_0x30e3f0[_0x1e4f('0x36')]=_[_0x1e4f('0x37')](_0x30e3f0[_0x1e4f('0x36')],{'$or':_[_0x1e4f('0x25')](_0x4615f5,function(_0x1ee43f){if(_0x1ee43f[_0x1e4f('0x27')]!==_0x1e4f('0x38')){var _0x59e614={};_0x59e614[_0x1ee43f['name']]={'$like':'%'+_0x4d0ffb[_0x1e4f('0x2a')][_0x1e4f('0x39')]+'%'};return _0x59e614;}})});}_0x30e3f0=_[_0x1e4f('0x37')]({},_0x30e3f0,_0x4d0ffb[_0x1e4f('0x3a')]);var _0x3a8f2a={'where':_0x30e3f0['where']};return db[_0x1e4f('0x3b')][_0x1e4f('0x1b')](_0x3a8f2a)[_0x1e4f('0x20')](function(_0x1afe82){_0x1dbf1d[_0x1e4f('0x1b')]=_0x1afe82;if(_0x4d0ffb['query'][_0x1e4f('0x3c')]){_0x30e3f0[_0x1e4f('0x3d')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x1e4f('0x3e')](_0x30e3f0);})[_0x1e4f('0x20')](function(_0xa98485){_0x1dbf1d[_0x1e4f('0x3f')]=_0xa98485;return _0x1dbf1d;})[_0x1e4f('0x20')](respondWithFilteredResult(_0x247f8e,_0x30e3f0))[_0x1e4f('0x40')](handleError(_0x247f8e,null));};exports[_0x1e4f('0x41')]=function(_0x1b5f4e,_0x5d0c04){var _0x372faf={'raw':!![],'where':{'id':_0x1b5f4e[_0x1e4f('0x42')]['id']}},_0x1d2497={};_0x1d2497['model']=_['keys'](db[_0x1e4f('0x3b')]['rawAttributes']);_0x1d2497['query']=_[_0x1e4f('0x2b')](_0x1b5f4e[_0x1e4f('0x2a')]);_0x1d2497['filters']=_[_0x1e4f('0x2d')](_0x1d2497['model'],_0x1d2497[_0x1e4f('0x2a')]);_0x372faf[_0x1e4f('0x2f')]=_[_0x1e4f('0x2d')](_0x1d2497['model'],qs[_0x1e4f('0x2e')](_0x1b5f4e['query'][_0x1e4f('0x2e')]));_0x372faf[_0x1e4f('0x2f')]=_0x372faf[_0x1e4f('0x2f')][_0x1e4f('0x30')]?_0x372faf['attributes']:_0x1d2497[_0x1e4f('0x28')];if(_0x1b5f4e['query'][_0x1e4f('0x3c')]){_0x372faf['include']=[{'all':!![]}];}_0x372faf=_[_0x1e4f('0x37')]({},_0x372faf,_0x1b5f4e['options']);return db[_0x1e4f('0x3b')][_0x1e4f('0x43')](_0x372faf)[_0x1e4f('0x20')](handleEntityNotFound(_0x5d0c04,null))[_0x1e4f('0x20')](respondWithResult(_0x5d0c04,null))[_0x1e4f('0x40')](handleError(_0x5d0c04,null));};exports[_0x1e4f('0x44')]=function(_0x14a37b,_0x5305b9){return db['SmsTransferReport'][_0x1e4f('0x44')](_0x14a37b[_0x1e4f('0x45')],{})[_0x1e4f('0x20')](respondWithResult(_0x5305b9,0xc9))[_0x1e4f('0x40')](handleError(_0x5305b9,null));};exports[_0x1e4f('0x1f')]=function(_0x29eb1f,_0xad2d25){if(_0x29eb1f[_0x1e4f('0x45')]['id']){delete _0x29eb1f['body']['id'];}return db['SmsTransferReport'][_0x1e4f('0x43')]({'where':{'id':_0x29eb1f[_0x1e4f('0x42')]['id']}})[_0x1e4f('0x20')](handleEntityNotFound(_0xad2d25,null))[_0x1e4f('0x20')](saveUpdates(_0x29eb1f[_0x1e4f('0x45')],null))[_0x1e4f('0x20')](respondWithResult(_0xad2d25,null))[_0x1e4f('0x40')](handleError(_0xad2d25,null));};exports[_0x1e4f('0x46')]=function(_0x3d3060,_0x42a075){return db['SmsTransferReport'][_0x1e4f('0x43')]({'where':{'id':_0x3d3060[_0x1e4f('0x42')]['id']}})[_0x1e4f('0x20')](handleEntityNotFound(_0x42a075,null))[_0x1e4f('0x20')](removeEntity(_0x42a075,null))[_0x1e4f('0x40')](handleError(_0x42a075,null));};exports[_0x1e4f('0x47')]=function(_0x603af2,_0x543567){return db['SmsTransferReport']['describe']()[_0x1e4f('0x20')](respondWithResult(_0x543567,null))[_0x1e4f('0x40')](handleError(_0x543567,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index c0d6a06..188fc92 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 _0x77f2=['../../config/environment','exports','SmsTransferReport','report_sms_transfer','uniqueid','util','api','moment','rimraf'];(function(_0xc14fd2,_0x303b9b){var _0x34a077=function(_0x3d6600){while(--_0x3d6600){_0xc14fd2['push'](_0xc14fd2['shift']());}};_0x34a077(++_0x303b9b);}(_0x77f2,0x188));var _0x277f=function(_0x3f4a8e,_0x507c39){_0x3f4a8e=_0x3f4a8e-0x0;var _0x7f68fd=_0x77f2[_0x3f4a8e];return _0x7f68fd;};'use strict';var _=require('lodash');var util=require(_0x277f('0x0'));var logger=require('../../config/logger')(_0x277f('0x1'));var moment=require(_0x277f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x277f('0x3'));var config=require(_0x277f('0x4'));var attributes=require('./smsTransferReport.attributes');module[_0x277f('0x5')]=function(_0x4e3fa5,_0x498f51){return _0x4e3fa5['define'](_0x277f('0x6'),attributes,{'tableName':_0x277f('0x7'),'paranoid':![],'indexes':[{'name':_0x277f('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf531=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0xf531,0x7d));var _0x1f53=function(_0x5322e3,_0x20d04c){_0x5322e3=_0x5322e3-0x0;var _0x31b51b=_0xf531[_0x5322e3];return _0x31b51b;};'use strict';var _=require(_0x1f53('0x0'));var util=require('util');var logger=require(_0x1f53('0x1'))(_0x1f53('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1f53('0x3'));var config=require(_0x1f53('0x4'));var attributes=require(_0x1f53('0x5'));module[_0x1f53('0x6')]=function(_0x1d1ada,_0x5711b8){return _0x1d1ada[_0x1f53('0x7')](_0x1f53('0x8'),attributes,{'tableName':_0x1f53('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1f53('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 071c63c..86fb401 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 _0xfb8f=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x15ac8a,_0x35cdd9){var _0x3b9c61=function(_0x4028ac){while(--_0x4028ac){_0x15ac8a['push'](_0x15ac8a['shift']());}};_0x3b9c61(++_0x35cdd9);}(_0xfb8f,0x18c));var _0xffb8=function(_0x2c3db7,_0x5e803b){_0x2c3db7=_0x2c3db7-0x0;var _0x461116=_0xfb8f[_0x2c3db7];return _0x461116;};'use strict';var _=require('lodash');var util=require(_0xffb8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xffb8('0x1'));var fs=require('fs');var Redis=require(_0xffb8('0x2'));var db=require(_0xffb8('0x3'))['db'];var utils=require(_0xffb8('0x4'));var logger=require(_0xffb8('0x5'))('rpc');var config=require(_0xffb8('0x6'));var jayson=require(_0xffb8('0x7'));var client=jayson[_0xffb8('0x8')][_0xffb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a70ab,_0x57a38f,_0x33495b){return new BPromise(function(_0xb71c21,_0x2b892a){return client[_0xffb8('0xa')](_0x5a70ab,_0x33495b)[_0xffb8('0xb')](function(_0x487759){logger['info'](_0xffb8('0xc'),_0x57a38f,_0xffb8('0xd'));logger[_0xffb8('0xe')](_0xffb8('0xf'),_0x57a38f,_0xffb8('0xd'),JSON['stringify'](_0x487759));if(_0x487759[_0xffb8('0x10')]){if(_0x487759[_0xffb8('0x10')][_0xffb8('0x11')]===0x1f4){logger[_0xffb8('0x10')](_0xffb8('0xc'),_0x57a38f,_0x487759['error'][_0xffb8('0x12')]);return _0x2b892a(_0x487759[_0xffb8('0x10')][_0xffb8('0x12')]);}logger['error'](_0xffb8('0xc'),_0x57a38f,_0x487759['error']['message']);return _0xb71c21(_0x487759[_0xffb8('0x10')][_0xffb8('0x12')]);}else{logger[_0xffb8('0x13')](_0xffb8('0xc'),_0x57a38f,_0xffb8('0xd'));_0xb71c21(_0x487759[_0xffb8('0x14')][_0xffb8('0x12')]);}})[_0xffb8('0x15')](function(_0x1a310e){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x57a38f,_0x1a310e);_0x2b892a(_0x1a310e);});});} \ No newline at end of file +var _0x0be3=['catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x4e5065,_0x2745ff){var _0x1c1f30=function(_0x171eef){while(--_0x171eef){_0x4e5065['push'](_0x4e5065['shift']());}};_0x1c1f30(++_0x2745ff);}(_0x0be3,0x9a));var _0x30be=function(_0x2a2ef3,_0x25cbea){_0x2a2ef3=_0x2a2ef3-0x0;var _0x50c9e4=_0x0be3[_0x2a2ef3];return _0x50c9e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x30be('0x0'));var BPromise=require(_0x30be('0x1'));var rs=require(_0x30be('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30be('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x30be('0x4'))(_0x30be('0x5'));var config=require(_0x30be('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x30be('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xdc3ff5,_0x4b45a7,_0x124baf){return new BPromise(function(_0x4207d3,_0x403e5c){return client['request'](_0xdc3ff5,_0x124baf)[_0x30be('0x8')](function(_0x3cc6e7){logger[_0x30be('0x9')](_0x30be('0xa'),_0x4b45a7,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x4b45a7,_0x30be('0xb'),JSON['stringify'](_0x3cc6e7));if(_0x3cc6e7[_0x30be('0xc')]){if(_0x3cc6e7[_0x30be('0xc')][_0x30be('0xd')]===0x1f4){logger[_0x30be('0xc')](_0x30be('0xa'),_0x4b45a7,_0x3cc6e7[_0x30be('0xc')][_0x30be('0xe')]);return _0x403e5c(_0x3cc6e7[_0x30be('0xc')][_0x30be('0xe')]);}logger['error'](_0x30be('0xa'),_0x4b45a7,_0x3cc6e7['error'][_0x30be('0xe')]);return _0x4207d3(_0x3cc6e7[_0x30be('0xc')]['message']);}else{logger[_0x30be('0x9')](_0x30be('0xa'),_0x4b45a7,'request\x20sent');_0x4207d3(_0x3cc6e7[_0x30be('0xf')][_0x30be('0xe')]);}})[_0x30be('0x10')](function(_0x40a4c7){logger[_0x30be('0xc')](_0x30be('0xa'),_0x4b45a7,_0x40a4c7);_0x403e5c(_0x40a4c7);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 074f598..8e491ed 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 _0xde2a=['delete','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./sound.controller','index','get','/:id','isAuthenticated','show','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','post','single','file','create','put','update'];(function(_0x299453,_0x3a554e){var _0x20bbd4=function(_0x5d86ab){while(--_0x5d86ab){_0x299453['push'](_0x299453['shift']());}};_0x20bbd4(++_0x3a554e);}(_0xde2a,0xd9));var _0xade2=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xde2a[_0x164af1];return _0x5d81a2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xade2('0x0'));var timeout=require(_0xade2('0x1'));var express=require(_0xade2('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xade2('0x3'));var config=require(_0xade2('0x4'));var controller=require(_0xade2('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xade2('0x6')]);router[_0xade2('0x7')](_0xade2('0x8'),auth[_0xade2('0x9')](),controller[_0xade2('0xa')]);router[_0xade2('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xade2('0xb')]({'destination':function(_0x281074,_0x383211,_0x552ab0){_0x552ab0(null,path[_0xade2('0xc')](config[_0xade2('0xd')],_0xade2('0xe')));},'filename':function(_0x3b1619,_0xbe6f5e,_0x404cbb){_0xbe6f5e[_0xade2('0xf')]=_0xbe6f5e[_0xade2('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x404cbb(null,util[_0xade2('0x10')](_0xade2('0x11'),path[_0xade2('0x12')](_0xbe6f5e['originalname'],path[_0xade2('0x13')](_0xbe6f5e[_0xade2('0xf')])),Date['now'](),path[_0xade2('0x13')](_0xbe6f5e[_0xade2('0xf')])));}})});router[_0xade2('0x14')]('/',upload[_0xade2('0x15')](_0xade2('0x16')),controller[_0xade2('0x17')]);router[_0xade2('0x18')](_0xade2('0x8'),auth[_0xade2('0x9')](),controller[_0xade2('0x19')]);router[_0xade2('0x1a')](_0xade2('0x8'),auth[_0xade2('0x9')](),controller[_0xade2('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x46ae=['show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','post','single','file','create','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x46ae,0x163));var _0xe46a=function(_0x2def5b,_0x526837){_0x2def5b=_0x2def5b-0x0;var _0x41b2aa=_0x46ae[_0x2def5b];return _0x41b2aa;};'use strict';var multer=require('multer');var util=require(_0xe46a('0x0'));var path=require('path');var timeout=require(_0xe46a('0x1'));var express=require(_0xe46a('0x2'));var router=express['Router']();var fs_extra=require(_0xe46a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe46a('0x4'));var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth[_0xe46a('0x5')](),controller[_0xe46a('0x6')]);router[_0xe46a('0x7')](_0xe46a('0x8'),auth[_0xe46a('0x5')](),controller[_0xe46a('0x9')]);router[_0xe46a('0x7')](_0xe46a('0xa'),auth[_0xe46a('0x5')](),controller[_0xe46a('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ecb60,_0x2004d,_0x45e7d3){_0x45e7d3(null,path[_0xe46a('0xc')](config[_0xe46a('0xd')],_0xe46a('0xe')));},'filename':function(_0x2bc9b2,_0x540c14,_0xf13f9){_0x540c14[_0xe46a('0xf')]=_0x540c14['originalname'][_0xe46a('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf13f9(null,util[_0xe46a('0x11')]('%s-%s%s',path[_0xe46a('0x12')](_0x540c14['originalname'],path[_0xe46a('0x13')](_0x540c14[_0xe46a('0xf')])),Date['now'](),path['extname'](_0x540c14['originalname'])));}})});router[_0xe46a('0x14')]('/',upload[_0xe46a('0x15')](_0xe46a('0x16')),controller[_0xe46a('0x17')]);router[_0xe46a('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xe46a('0x19')]);router['delete'](_0xe46a('0x8'),auth[_0xe46a('0x5')](),controller[_0xe46a('0x1a')]);module[_0xe46a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a0169f0..1a0f222 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 _0x2812=['exports','STRING','BIGINT','INTEGER','FLOAT','sequelize'];(function(_0x57298d,_0x4a3161){var _0x267111=function(_0x247c2a){while(--_0x247c2a){_0x57298d['push'](_0x57298d['shift']());}};_0x267111(++_0x4a3161);}(_0x2812,0x167));var _0x2281=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0x2812[_0x38c652];return _0x218a37;};'use strict';var Sequelize=require(_0x2281('0x0'));module[_0x2281('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x2281('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x2281('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x2281('0x3')]},'original_channelCount':{'type':Sequelize[_0x2281('0x4')]},'original_bitRate':{'type':Sequelize[_0x2281('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x2281('0x2')]},'converted_duration':{'type':Sequelize[_0x2281('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x2281('0x4')]},'converted_bitRate':{'type':Sequelize[_0x2281('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x2281('0x4')]}}; \ No newline at end of file +var _0x007b=['FLOAT','STRING','name','BIGINT','INTEGER'];(function(_0x595b9b,_0xa58ff){var _0x3be4c6=function(_0x324f94){while(--_0x324f94){_0x595b9b['push'](_0x595b9b['shift']());}};_0x3be4c6(++_0xa58ff);}(_0x007b,0x164));var _0xb007=function(_0x3bbf37,_0x1bcef5){_0x3bbf37=_0x3bbf37-0x0;var _0x368eb3=_0x007b[_0x3bbf37];return _0x368eb3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb007('0x0')],'unique':_0xb007('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb007('0x0')]},'display_name':{'type':Sequelize[_0xb007('0x0')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xb007('0x0')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xb007('0x2')]},'original_channelCount':{'type':Sequelize[_0xb007('0x3')]},'original_bitRate':{'type':Sequelize[_0xb007('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xb007('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xb007('0x2')]},'converted_channelCount':{'type':Sequelize[_0xb007('0x3')]},'converted_bitRate':{'type':Sequelize[_0xb007('0x2')]},'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 de14962..8ce8647 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 _0x73a4=['sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_bitRate','bitRate','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','start','description','delete','original_format','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','end','error','stack','name','send','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','catch','params','rawAttributes','options','find','download','save_name','converted_format','existsSync','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','extname','originalname','file','substring','wav','join','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x73a4,0x191));var _0x473a=function(_0x35b0e4,_0x44054b){_0x35b0e4=_0x35b0e4-0x0;var _0xc26e26=_0x73a4[_0x35b0e4];return _0xc26e26;};'use strict';var emlformat=require(_0x473a('0x0'));var rimraf=require(_0x473a('0x1'));var zipdir=require(_0x473a('0x2'));var jsonpatch=require(_0x473a('0x3'));var rp=require(_0x473a('0x4'));var moment=require(_0x473a('0x5'));var BPromise=require(_0x473a('0x6'));var Mustache=require(_0x473a('0x7'));var util=require(_0x473a('0x8'));var path=require(_0x473a('0x9'));var sox=require('sox');var csv=require(_0x473a('0xa'));var ejs=require(_0x473a('0xb'));var fs=require('fs');var fs_extra=require(_0x473a('0xc'));var _=require(_0x473a('0xd'));var squel=require(_0x473a('0xe'));var crypto=require(_0x473a('0xf'));var jsforce=require(_0x473a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x473a('0xa'));var querystring=require(_0x473a('0x11'));var Papa=require(_0x473a('0x12'));var Redis=require('ioredis');var authService=require(_0x473a('0x13'));var qs=require(_0x473a('0x14'));var as=require(_0x473a('0x15'));var hardwareService=require(_0x473a('0x16'));var logger=require(_0x473a('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x473a('0x18'));var licenseUtil=require(_0x473a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10c4da,_0x21424d){_0x21424d=_0x21424d||0xcc;return function(_0x23ba51){if(_0x23ba51){return _0x10c4da[_0x473a('0x1a')](_0x21424d);}return _0x10c4da[_0x473a('0x1b')](_0x21424d)['end']();};}function respondWithResult(_0x428bb7,_0x7b77c3){_0x7b77c3=_0x7b77c3||0xc8;return function(_0x106fab){if(_0x106fab){return _0x428bb7[_0x473a('0x1b')](_0x7b77c3)['json'](_0x106fab);}};}function respondWithFilteredResult(_0x10ab5c,_0x256bb7){return function(_0x24bd9b){if(_0x24bd9b){var _0x5764e4=typeof _0x256bb7[_0x473a('0x1c')]==='undefined'&&typeof _0x256bb7[_0x473a('0x1d')]===_0x473a('0x1e');var _0x1d3e9e=_0x24bd9b[_0x473a('0x1f')];var _0x572398=_0x5764e4?0x0:_0x256bb7[_0x473a('0x1c')];var _0x3cc9d9=_0x5764e4?_0x24bd9b[_0x473a('0x1f')]:_0x256bb7[_0x473a('0x1c')]+_0x256bb7[_0x473a('0x1d')];var _0x15bc19;if(_0x3cc9d9>=_0x1d3e9e){_0x3cc9d9=_0x1d3e9e;_0x15bc19=0xc8;}else{_0x15bc19=0xce;}_0x10ab5c[_0x473a('0x1b')](_0x15bc19);return _0x10ab5c[_0x473a('0x20')](_0x473a('0x21'),_0x572398+'-'+_0x3cc9d9+'/'+_0x1d3e9e)[_0x473a('0x22')](_0x24bd9b);}return null;};}function patchUpdates(_0x235459){return function(_0x3f7d8b){try{jsonpatch[_0x473a('0x23')](_0x3f7d8b,_0x235459,!![]);}catch(_0x3418c9){return BPromise[_0x473a('0x24')](_0x3418c9);}return _0x3f7d8b[_0x473a('0x25')]();};}function saveUpdates(_0x5f52e5,_0xececeb){return function(_0x41d982){if(_0x41d982){return _0x41d982[_0x473a('0x26')](_0x5f52e5)[_0x473a('0x27')](function(_0x597fda){return _0x597fda;});}return null;};}function removeEntity(_0x429467,_0x3110e4){return function(_0x9aadc5){if(_0x9aadc5){return _0x9aadc5['destroy']()[_0x473a('0x27')](function(){var _0x283a02=_0x9aadc5[_0x473a('0x28')]({'plain':!![]});var _0x50c02e=_0x473a('0x29');return db[_0x473a('0x2a')][_0x473a('0x2b')]({'where':{'type':_0x50c02e,'resourceId':_0x283a02['id']}})[_0x473a('0x27')](function(){return _0x9aadc5;});})[_0x473a('0x27')](function(){_0x429467['status'](0xcc)[_0x473a('0x2c')]();});}};}function handleEntityNotFound(_0xcff90,_0x2c1342){return function(_0x53dd79){if(!_0x53dd79){_0xcff90['sendStatus'](0x194);}return _0x53dd79;};}function handleError(_0x37ad82,_0x1f79d1){_0x1f79d1=_0x1f79d1||0x1f4;return function(_0x15b517){logger[_0x473a('0x2d')](_0x15b517[_0x473a('0x2e')]);if(_0x15b517[_0x473a('0x2f')]){delete _0x15b517['name'];}_0x37ad82['status'](_0x1f79d1)[_0x473a('0x30')](_0x15b517);};}exports['index']=function(_0x427154,_0x4641c6){var _0x51d35b={},_0x481683={},_0x15960a={'count':0x0,'rows':[]};var _0x528f20=_[_0x473a('0x31')](db[_0x473a('0x32')]['rawAttributes'],function(_0x236e53){return{'name':_0x236e53[_0x473a('0x33')],'type':_0x236e53[_0x473a('0x34')][_0x473a('0x35')]};});_0x481683[_0x473a('0x36')]=_[_0x473a('0x31')](_0x528f20,_0x473a('0x2f'));_0x481683[_0x473a('0x37')]=_[_0x473a('0x38')](_0x427154['query']);_0x481683[_0x473a('0x39')]=_[_0x473a('0x3a')](_0x481683['model'],_0x481683['query']);_0x51d35b[_0x473a('0x3b')]=_[_0x473a('0x3a')](_0x481683[_0x473a('0x36')],qs[_0x473a('0x3c')](_0x427154[_0x473a('0x37')][_0x473a('0x3c')]));_0x51d35b['attributes']=_0x51d35b[_0x473a('0x3b')][_0x473a('0x3d')]?_0x51d35b[_0x473a('0x3b')]:_0x481683[_0x473a('0x36')];if(!_0x427154[_0x473a('0x37')][_0x473a('0x3e')](_0x473a('0x3f'))){_0x51d35b[_0x473a('0x1d')]=qs[_0x473a('0x1d')](_0x427154[_0x473a('0x37')]['limit']);_0x51d35b[_0x473a('0x1c')]=qs[_0x473a('0x1c')](_0x427154[_0x473a('0x37')][_0x473a('0x1c')]);}_0x51d35b[_0x473a('0x40')]=qs[_0x473a('0x41')](_0x427154[_0x473a('0x37')][_0x473a('0x41')]);_0x51d35b['where']=qs[_0x473a('0x39')](_[_0x473a('0x42')](_0x427154[_0x473a('0x37')],_0x481683[_0x473a('0x39')]),_0x528f20);if(_0x427154['query'][_0x473a('0x43')]){_0x51d35b[_0x473a('0x44')]=_[_0x473a('0x45')](_0x51d35b[_0x473a('0x44')],{'$or':_[_0x473a('0x31')](_0x528f20,function(_0x31b6f3){if(_0x31b6f3[_0x473a('0x34')]!==_0x473a('0x46')){var _0x4d9af0={};_0x4d9af0[_0x31b6f3['name']]={'$like':'%'+_0x427154[_0x473a('0x37')]['filter']+'%'};return _0x4d9af0;}})});}_0x51d35b=_['merge']({},_0x51d35b,_0x427154['options']);var _0x68886a={'where':_0x51d35b['where']};return db['Sound'][_0x473a('0x1f')](_0x68886a)['then'](function(_0x3b735d){_0x15960a[_0x473a('0x1f')]=_0x3b735d;if(_0x427154[_0x473a('0x37')][_0x473a('0x47')]){_0x51d35b['include']=[{'all':!![]}];}return db[_0x473a('0x32')]['findAll'](_0x51d35b);})[_0x473a('0x27')](function(_0x406a3b){_0x15960a['rows']=_0x406a3b;return _0x15960a;})[_0x473a('0x27')](respondWithFilteredResult(_0x4641c6,_0x51d35b))[_0x473a('0x48')](handleError(_0x4641c6,null));};exports['show']=function(_0x2a4e50,_0x2efb79){var _0x2db2f6={'raw':!![],'where':{'id':_0x2a4e50[_0x473a('0x49')]['id']}},_0x4d41aa={};_0x4d41aa[_0x473a('0x36')]=_['keys'](db[_0x473a('0x32')][_0x473a('0x4a')]);_0x4d41aa[_0x473a('0x37')]=_[_0x473a('0x38')](_0x2a4e50[_0x473a('0x37')]);_0x4d41aa[_0x473a('0x39')]=_[_0x473a('0x3a')](_0x4d41aa[_0x473a('0x36')],_0x4d41aa[_0x473a('0x37')]);_0x2db2f6[_0x473a('0x3b')]=_[_0x473a('0x3a')](_0x4d41aa[_0x473a('0x36')],qs['fields'](_0x2a4e50[_0x473a('0x37')]['fields']));_0x2db2f6['attributes']=_0x2db2f6[_0x473a('0x3b')][_0x473a('0x3d')]?_0x2db2f6[_0x473a('0x3b')]:_0x4d41aa[_0x473a('0x36')];if(_0x2a4e50[_0x473a('0x37')][_0x473a('0x47')]){_0x2db2f6['include']=[{'all':!![]}];}_0x2db2f6=_[_0x473a('0x45')]({},_0x2db2f6,_0x2a4e50[_0x473a('0x4b')]);return db[_0x473a('0x32')][_0x473a('0x4c')](_0x2db2f6)[_0x473a('0x27')](handleEntityNotFound(_0x2efb79,null))[_0x473a('0x27')](respondWithResult(_0x2efb79,null))[_0x473a('0x48')](handleError(_0x2efb79,null));};exports[_0x473a('0x4d')]=function(_0x1f9a9a,_0x58806a,_0x1fb3fe){return db[_0x473a('0x32')][_0x473a('0x4c')]({'where':{'id':_0x1f9a9a['params']['id']},'attributes':[_0x473a('0x2f'),_0x473a('0x4e'),_0x473a('0x4f')],'raw':!![]})[_0x473a('0x27')](handleEntityNotFound(_0x58806a,null))[_0x473a('0x27')](function(_0x55e4aa){if(_0x55e4aa){if(!fs[_0x473a('0x50')](path['join'](config[_0x473a('0x51')],'server/files/sounds/converted',_0x55e4aa['save_name']+'.'+_0x55e4aa['converted_format']))){throw new db[(_0x473a('0x52'))][(_0x473a('0x53'))](_0x473a('0x54'));}return _0x58806a['download'](path['join'](config['root'],_0x473a('0x55'),util[_0x473a('0x56')](_0x473a('0x57'),_0x55e4aa[_0x473a('0x4e')],_0x55e4aa['converted_format'])),util['format'](_0x473a('0x57'),_0x55e4aa[_0x473a('0x2f')],_0x55e4aa[_0x473a('0x4f')]));}return null;})[_0x473a('0x48')](handleError(_0x58806a,null));};exports[_0x473a('0x58')]=function(_0x2654f7,_0x164afc,_0xff1c30){var _0x54089c={'name':path[_0x473a('0x59')](_0x2654f7['file']['originalname'],path[_0x473a('0x5a')](_0x2654f7['file'][_0x473a('0x5b')])),'save_name':path['basename'](_0x2654f7[_0x473a('0x5c')]['filename'],path[_0x473a('0x5a')](_0x2654f7[_0x473a('0x5c')]['filename'])),'original_format':path[_0x473a('0x5a')](_0x2654f7[_0x473a('0x5c')][_0x473a('0x5b')])[_0x473a('0x5d')](0x1),'converted_format':_0x473a('0x5e')};var _0x31f994=path[_0x473a('0x5f')](config[_0x473a('0x51')],_0x473a('0x60'),_0x2654f7[_0x473a('0x5c')][_0x473a('0x61')]);var _0x586165=path[_0x473a('0x5f')](config['root'],'server/files/sounds/converted',util[_0x473a('0x56')](_0x473a('0x57'),path[_0x473a('0x59')](_0x2654f7[_0x473a('0x5c')]['filename'],path[_0x473a('0x5a')](_0x2654f7[_0x473a('0x5c')][_0x473a('0x61')])),_0x54089c[_0x473a('0x4f')]));logger[_0x473a('0x62')](_0x473a('0x63'),_0x31f994);logger[_0x473a('0x62')](_0x473a('0x64'),_0x586165);try{fs[_0x473a('0x65')](_0x31f994,parseInt('0777',0x8));var _0x5dd925=sox[_0x473a('0x66')](_0x31f994,_0x586165,{'sampleRate':0x1f40,'format':_0x473a('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5dd925['on'](_0x473a('0x2d'),function(_0x5994b5){fs[_0x473a('0x67')](_0x31f994);_0x164afc[_0x473a('0x1b')](0x1f4)['send'](_0x5994b5);});_0x5dd925['on'](_0x473a('0x68'),function(_0x351b00){_0x54089c[_0x473a('0x69')]=isNaN(_0x351b00['duration'])?null:_0x351b00['duration']*0x3e8;_0x54089c['original_sampleCount']=isNaN(_0x351b00[_0x473a('0x6a')])?null:_0x351b00[_0x473a('0x6a')];_0x54089c[_0x473a('0x6b')]=isNaN(_0x351b00[_0x473a('0x6c')])?null:_0x351b00[_0x473a('0x6c')];_0x54089c[_0x473a('0x6d')]=isNaN(_0x351b00['bitRate'])?null:_0x351b00['bitRate'];_0x54089c[_0x473a('0x6e')]=isNaN(_0x351b00[_0x473a('0x6f')])?null:_0x351b00['sampleRate'];});_0x5dd925['on'](_0x473a('0x70'),function(_0x3544c5){_0x54089c[_0x473a('0x71')]=isNaN(_0x3544c5[_0x473a('0x72')])?null:_0x3544c5[_0x473a('0x72')]*0x3e8;_0x54089c[_0x473a('0x73')]=isNaN(_0x3544c5[_0x473a('0x6a')])?null:_0x3544c5['sampleCount'];_0x54089c['converted_channelCount']=isNaN(_0x3544c5[_0x473a('0x6c')])?null:_0x3544c5['channelCount'];_0x54089c[_0x473a('0x74')]=isNaN(_0x3544c5[_0x473a('0x75')])?null:_0x3544c5[_0x473a('0x75')];_0x54089c['converted_sampleRate']=isNaN(_0x3544c5[_0x473a('0x6f')])?null:_0x3544c5[_0x473a('0x6f')];});_0x5dd925['on'](_0x473a('0x2c'),function(){fs['chmodSync'](_0x586165,parseInt(_0x473a('0x76'),0x8));return db[_0x473a('0x32')][_0x473a('0x58')](_0x54089c)['then'](function(_0x2d54a8){var _0x5959ef={'role':_0x2654f7[_0x473a('0x77')]['role'],'userProfileId':_0x2654f7[_0x473a('0x77')][_0x473a('0x78')]};if(!_0x5959ef)throw new Error(_0x473a('0x79'));if(_0x5959ef['role']===_0x473a('0x7a')){var _0x1ce876=_0x2d54a8['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Sounds','userProfileId':_0x5959ef[_0x473a('0x78')]},'raw':!![]})['then'](function(_0x1b246f){if(_0x1b246f&&_0x1b246f[_0x473a('0x7b')]===0x0){return db[_0x473a('0x2a')]['create']({'name':_0x1ce876[_0x473a('0x2f')],'resourceId':_0x1ce876['id'],'type':_0x1b246f['name'],'sectionId':_0x1b246f['id']},{})[_0x473a('0x27')](function(){return _0x2d54a8;});}else{return _0x2d54a8;}})[_0x473a('0x48')](function(_0x4f89ae){logger[_0x473a('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f89ae);throw _0x4f89ae;});}return _0x2d54a8;})[_0x473a('0x27')](respondWithResult(_0x164afc,null))[_0x473a('0x48')](handleError(_0x164afc,null));});_0x5dd925[_0x473a('0x7c')]();}catch(_0x1d6c9c){_0x164afc[_0x473a('0x1b')](0x1f4)[_0x473a('0x30')](_0x1d6c9c);}};exports[_0x473a('0x26')]=function(_0x7383ac,_0x240377,_0x1cf2cf){return db[_0x473a('0x32')][_0x473a('0x4c')]({'where':{'id':_0x7383ac[_0x473a('0x49')]['id']}})[_0x473a('0x27')](handleEntityNotFound(_0x240377,null))[_0x473a('0x27')](saveUpdates(_[_0x473a('0x42')](_0x7383ac[_0x473a('0x77')],[_0x473a('0x2f'),_0x473a('0x7d')]),null))[_0x473a('0x27')](respondWithResult(_0x240377,null))['catch'](handleError(_0x240377,null));};exports[_0x473a('0x7e')]=function(_0x160e77,_0x2203e6,_0x3bb538){return db['Sound'][_0x473a('0x4c')]({'where':{'id':_0x160e77[_0x473a('0x49')]['id']}})[_0x473a('0x27')](function(_0x519ea9){if(_0x519ea9){return _0x519ea9[_0x473a('0x2b')]();}})[_0x473a('0x27')](function(_0x14146e){var _0x5b0133=path['join'](config['root'],_0x473a('0x60'),util[_0x473a('0x56')](_0x473a('0x57'),_0x14146e['save_name'],_0x14146e[_0x473a('0x7f')]));var _0x24cf4f=path[_0x473a('0x5f')](config[_0x473a('0x51')],_0x473a('0x55'),util[_0x473a('0x56')](_0x473a('0x57'),_0x14146e['save_name'],_0x14146e[_0x473a('0x4f')]));fs[_0x473a('0x67')](_0x5b0133);fs[_0x473a('0x67')](_0x24cf4f);return _0x14146e;})[_0x473a('0x27')](function(_0xd67c18){if(_0xd67c18){return _0x2203e6['status'](0xcc)[_0x473a('0x2c')]();}})[_0x473a('0x27')](handleEntityNotFound(_0x2203e6,null))['catch'](handleError(_0x2203e6,null));}; \ No newline at end of file +var _0xb716=['bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','limit','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','rows','catch','params','merge','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','create','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','end','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Sounds','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb716,0x179));var _0x6b71=function(_0x599eee,_0x154fb0){_0x599eee=_0x599eee-0x0;var _0x266943=_0xb716[_0x599eee];return _0x266943;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b71('0x0'));var zipdir=require(_0x6b71('0x1'));var jsonpatch=require(_0x6b71('0x2'));var rp=require(_0x6b71('0x3'));var moment=require('moment');var BPromise=require(_0x6b71('0x4'));var Mustache=require('mustache');var util=require(_0x6b71('0x5'));var path=require('path');var sox=require(_0x6b71('0x6'));var csv=require(_0x6b71('0x7'));var ejs=require(_0x6b71('0x8'));var fs=require('fs');var fs_extra=require(_0x6b71('0x9'));var _=require(_0x6b71('0xa'));var squel=require(_0x6b71('0xb'));var crypto=require('crypto');var jsforce=require(_0x6b71('0xc'));var deskjs=require(_0x6b71('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6b71('0xe'));var Papa=require(_0x6b71('0xf'));var Redis=require(_0x6b71('0x10'));var authService=require(_0x6b71('0x11'));var qs=require(_0x6b71('0x12'));var as=require(_0x6b71('0x13'));var hardwareService=require(_0x6b71('0x14'));var logger=require('../../config/logger')(_0x6b71('0x15'));var utils=require(_0x6b71('0x16'));var config=require(_0x6b71('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b71('0x18'))['db'];function respondWithStatusCode(_0x2e193c,_0x3c15f5){_0x3c15f5=_0x3c15f5||0xcc;return function(_0x247600){if(_0x247600){return _0x2e193c['sendStatus'](_0x3c15f5);}return _0x2e193c[_0x6b71('0x19')](_0x3c15f5)['end']();};}function respondWithResult(_0x478c5b,_0xb80a50){_0xb80a50=_0xb80a50||0xc8;return function(_0x4d442c){if(_0x4d442c){return _0x478c5b[_0x6b71('0x19')](_0xb80a50)['json'](_0x4d442c);}};}function respondWithFilteredResult(_0xd9f3af,_0x43b880){return function(_0x4d4ff2){if(_0x4d4ff2){var _0x40b50c=typeof _0x43b880['offset']==='undefined'&&typeof _0x43b880[_0x6b71('0x1a')]===_0x6b71('0x1b');var _0xbdb227=_0x4d4ff2[_0x6b71('0x1c')];var _0x1038d0=_0x40b50c?0x0:_0x43b880[_0x6b71('0x1d')];var _0x4ac262=_0x40b50c?_0x4d4ff2[_0x6b71('0x1c')]:_0x43b880['offset']+_0x43b880['limit'];var _0x8217f1;if(_0x4ac262>=_0xbdb227){_0x4ac262=_0xbdb227;_0x8217f1=0xc8;}else{_0x8217f1=0xce;}_0xd9f3af[_0x6b71('0x19')](_0x8217f1);return _0xd9f3af[_0x6b71('0x1e')]('Content-Range',_0x1038d0+'-'+_0x4ac262+'/'+_0xbdb227)[_0x6b71('0x1f')](_0x4d4ff2);}return null;};}function patchUpdates(_0x59eb8c){return function(_0xd33a8d){try{jsonpatch[_0x6b71('0x20')](_0xd33a8d,_0x59eb8c,!![]);}catch(_0x120446){return BPromise[_0x6b71('0x21')](_0x120446);}return _0xd33a8d[_0x6b71('0x22')]();};}function saveUpdates(_0x14cc2f,_0x43c292){return function(_0x3c2642){if(_0x3c2642){return _0x3c2642[_0x6b71('0x23')](_0x14cc2f)[_0x6b71('0x24')](function(_0x397102){return _0x397102;});}return null;};}function removeEntity(_0x1efc53,_0xb80514){return function(_0x284580){if(_0x284580){return _0x284580[_0x6b71('0x25')]()[_0x6b71('0x24')](function(){var _0x32e76e=_0x284580[_0x6b71('0x26')]({'plain':!![]});var _0x712674='Sounds';return db[_0x6b71('0x27')][_0x6b71('0x25')]({'where':{'type':_0x712674,'resourceId':_0x32e76e['id']}})[_0x6b71('0x24')](function(){return _0x284580;});})[_0x6b71('0x24')](function(){_0x1efc53['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d8a6,_0x48cf98){return function(_0x259bd7){if(!_0x259bd7){_0x24d8a6[_0x6b71('0x28')](0x194);}return _0x259bd7;};}function handleError(_0x112c50,_0x50fc0a){_0x50fc0a=_0x50fc0a||0x1f4;return function(_0x927d1b){logger['error'](_0x927d1b[_0x6b71('0x29')]);if(_0x927d1b[_0x6b71('0x2a')]){delete _0x927d1b[_0x6b71('0x2a')];}_0x112c50['status'](_0x50fc0a)[_0x6b71('0x2b')](_0x927d1b);};}exports[_0x6b71('0x2c')]=function(_0xad9398,_0x529e9e){var _0x37c0e0={},_0x45e8ab={},_0x1e87d9={'count':0x0,'rows':[]};var _0x56baac=_[_0x6b71('0x2d')](db[_0x6b71('0x2e')][_0x6b71('0x2f')],function(_0xe9b0de){return{'name':_0xe9b0de[_0x6b71('0x30')],'type':_0xe9b0de[_0x6b71('0x31')][_0x6b71('0x32')]};});_0x45e8ab[_0x6b71('0x33')]=_['map'](_0x56baac,_0x6b71('0x2a'));_0x45e8ab['query']=_[_0x6b71('0x34')](_0xad9398[_0x6b71('0x35')]);_0x45e8ab[_0x6b71('0x36')]=_['intersection'](_0x45e8ab[_0x6b71('0x33')],_0x45e8ab[_0x6b71('0x35')]);_0x37c0e0[_0x6b71('0x37')]=_[_0x6b71('0x38')](_0x45e8ab[_0x6b71('0x33')],qs[_0x6b71('0x39')](_0xad9398[_0x6b71('0x35')]['fields']));_0x37c0e0[_0x6b71('0x37')]=_0x37c0e0[_0x6b71('0x37')]['length']?_0x37c0e0['attributes']:_0x45e8ab[_0x6b71('0x33')];if(!_0xad9398[_0x6b71('0x35')][_0x6b71('0x3a')](_0x6b71('0x3b'))){_0x37c0e0['limit']=qs[_0x6b71('0x1a')](_0xad9398['query'][_0x6b71('0x1a')]);_0x37c0e0[_0x6b71('0x1d')]=qs[_0x6b71('0x1d')](_0xad9398[_0x6b71('0x35')]['offset']);}_0x37c0e0[_0x6b71('0x3c')]=qs[_0x6b71('0x3d')](_0xad9398['query'][_0x6b71('0x3d')]);_0x37c0e0['where']=qs[_0x6b71('0x36')](_['pick'](_0xad9398[_0x6b71('0x35')],_0x45e8ab[_0x6b71('0x36')]),_0x56baac);if(_0xad9398[_0x6b71('0x35')]['filter']){_0x37c0e0[_0x6b71('0x3e')]=_['merge'](_0x37c0e0['where'],{'$or':_[_0x6b71('0x2d')](_0x56baac,function(_0x213799){if(_0x213799[_0x6b71('0x31')]!=='VIRTUAL'){var _0x248a4a={};_0x248a4a[_0x213799[_0x6b71('0x2a')]]={'$like':'%'+_0xad9398[_0x6b71('0x35')][_0x6b71('0x3f')]+'%'};return _0x248a4a;}})});}_0x37c0e0=_['merge']({},_0x37c0e0,_0xad9398[_0x6b71('0x40')]);var _0x4871ce={'where':_0x37c0e0[_0x6b71('0x3e')]};return db[_0x6b71('0x2e')][_0x6b71('0x1c')](_0x4871ce)['then'](function(_0x203af7){_0x1e87d9[_0x6b71('0x1c')]=_0x203af7;if(_0xad9398['query'][_0x6b71('0x41')]){_0x37c0e0[_0x6b71('0x42')]=[{'all':!![]}];}return db[_0x6b71('0x2e')]['findAll'](_0x37c0e0);})[_0x6b71('0x24')](function(_0x4bbb6e){_0x1e87d9[_0x6b71('0x43')]=_0x4bbb6e;return _0x1e87d9;})[_0x6b71('0x24')](respondWithFilteredResult(_0x529e9e,_0x37c0e0))[_0x6b71('0x44')](handleError(_0x529e9e,null));};exports['show']=function(_0x545a52,_0x438276){var _0x103498={'raw':!![],'where':{'id':_0x545a52[_0x6b71('0x45')]['id']}},_0x3e0ac1={};_0x3e0ac1[_0x6b71('0x33')]=_['keys'](db[_0x6b71('0x2e')]['rawAttributes']);_0x3e0ac1[_0x6b71('0x35')]=_[_0x6b71('0x34')](_0x545a52['query']);_0x3e0ac1[_0x6b71('0x36')]=_[_0x6b71('0x38')](_0x3e0ac1['model'],_0x3e0ac1[_0x6b71('0x35')]);_0x103498[_0x6b71('0x37')]=_[_0x6b71('0x38')](_0x3e0ac1['model'],qs[_0x6b71('0x39')](_0x545a52[_0x6b71('0x35')][_0x6b71('0x39')]));_0x103498[_0x6b71('0x37')]=_0x103498[_0x6b71('0x37')]['length']?_0x103498[_0x6b71('0x37')]:_0x3e0ac1[_0x6b71('0x33')];if(_0x545a52[_0x6b71('0x35')][_0x6b71('0x41')]){_0x103498['include']=[{'all':!![]}];}_0x103498=_[_0x6b71('0x46')]({},_0x103498,_0x545a52[_0x6b71('0x40')]);return db[_0x6b71('0x2e')][_0x6b71('0x47')](_0x103498)[_0x6b71('0x24')](handleEntityNotFound(_0x438276,null))[_0x6b71('0x24')](respondWithResult(_0x438276,null))[_0x6b71('0x44')](handleError(_0x438276,null));};exports[_0x6b71('0x48')]=function(_0x431e73,_0x3e1fe1,_0x1435f1){return db[_0x6b71('0x2e')][_0x6b71('0x47')]({'where':{'id':_0x431e73[_0x6b71('0x45')]['id']},'attributes':['name',_0x6b71('0x49'),_0x6b71('0x4a')],'raw':!![]})[_0x6b71('0x24')](handleEntityNotFound(_0x3e1fe1,null))['then'](function(_0x422aa9){if(_0x422aa9){if(!fs[_0x6b71('0x4b')](path[_0x6b71('0x4c')](config[_0x6b71('0x4d')],_0x6b71('0x4e'),_0x422aa9[_0x6b71('0x49')]+'.'+_0x422aa9['converted_format']))){throw new db[(_0x6b71('0x4f'))]['ValidationError'](_0x6b71('0x50'));}return _0x3e1fe1[_0x6b71('0x48')](path[_0x6b71('0x4c')](config[_0x6b71('0x4d')],_0x6b71('0x4e'),util[_0x6b71('0x51')](_0x6b71('0x52'),_0x422aa9[_0x6b71('0x49')],_0x422aa9[_0x6b71('0x4a')])),util['format'](_0x6b71('0x52'),_0x422aa9[_0x6b71('0x2a')],_0x422aa9[_0x6b71('0x4a')]));}return null;})[_0x6b71('0x44')](handleError(_0x3e1fe1,null));};exports[_0x6b71('0x53')]=function(_0x55421d,_0x2e60ac,_0x1d1813){var _0x27ff91={'name':path[_0x6b71('0x54')](_0x55421d[_0x6b71('0x55')]['originalname'],path[_0x6b71('0x56')](_0x55421d[_0x6b71('0x55')][_0x6b71('0x57')])),'save_name':path['basename'](_0x55421d['file'][_0x6b71('0x58')],path[_0x6b71('0x56')](_0x55421d[_0x6b71('0x55')][_0x6b71('0x58')])),'original_format':path[_0x6b71('0x56')](_0x55421d[_0x6b71('0x55')][_0x6b71('0x57')])[_0x6b71('0x59')](0x1),'converted_format':_0x6b71('0x5a')};var _0x109c9c=path['join'](config[_0x6b71('0x4d')],_0x6b71('0x5b'),_0x55421d['file'][_0x6b71('0x58')]);var _0xc3f310=path[_0x6b71('0x4c')](config[_0x6b71('0x4d')],_0x6b71('0x4e'),util[_0x6b71('0x51')](_0x6b71('0x52'),path[_0x6b71('0x54')](_0x55421d['file'][_0x6b71('0x58')],path[_0x6b71('0x56')](_0x55421d['file']['filename'])),_0x27ff91['converted_format']));logger[_0x6b71('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x109c9c);logger[_0x6b71('0x5c')](_0x6b71('0x5d'),_0xc3f310);try{fs[_0x6b71('0x5e')](_0x109c9c,parseInt(_0x6b71('0x5f'),0x8));var _0x45f654=sox[_0x6b71('0x60')](_0x109c9c,_0xc3f310,{'sampleRate':0x1f40,'format':_0x6b71('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x45f654['on'](_0x6b71('0x61'),function(_0x3df7dd){fs['unlinkSync'](_0x109c9c);_0x2e60ac[_0x6b71('0x19')](0x1f4)['send'](_0x3df7dd);});_0x45f654['on'](_0x6b71('0x62'),function(_0x39e27c){_0x27ff91[_0x6b71('0x63')]=isNaN(_0x39e27c[_0x6b71('0x64')])?null:_0x39e27c[_0x6b71('0x64')]*0x3e8;_0x27ff91[_0x6b71('0x65')]=isNaN(_0x39e27c[_0x6b71('0x66')])?null:_0x39e27c[_0x6b71('0x66')];_0x27ff91[_0x6b71('0x67')]=isNaN(_0x39e27c[_0x6b71('0x68')])?null:_0x39e27c[_0x6b71('0x68')];_0x27ff91[_0x6b71('0x69')]=isNaN(_0x39e27c['bitRate'])?null:_0x39e27c[_0x6b71('0x6a')];_0x27ff91[_0x6b71('0x6b')]=isNaN(_0x39e27c['sampleRate'])?null:_0x39e27c[_0x6b71('0x6c')];});_0x45f654['on'](_0x6b71('0x6d'),function(_0x56f247){_0x27ff91[_0x6b71('0x6e')]=isNaN(_0x56f247[_0x6b71('0x64')])?null:_0x56f247[_0x6b71('0x64')]*0x3e8;_0x27ff91[_0x6b71('0x6f')]=isNaN(_0x56f247[_0x6b71('0x66')])?null:_0x56f247[_0x6b71('0x66')];_0x27ff91['converted_channelCount']=isNaN(_0x56f247[_0x6b71('0x68')])?null:_0x56f247[_0x6b71('0x68')];_0x27ff91[_0x6b71('0x70')]=isNaN(_0x56f247[_0x6b71('0x6a')])?null:_0x56f247[_0x6b71('0x6a')];_0x27ff91['converted_sampleRate']=isNaN(_0x56f247[_0x6b71('0x6c')])?null:_0x56f247[_0x6b71('0x6c')];});_0x45f654['on'](_0x6b71('0x71'),function(){fs[_0x6b71('0x5e')](_0xc3f310,parseInt('0777',0x8));return db[_0x6b71('0x2e')][_0x6b71('0x53')](_0x27ff91)['then'](function(_0xe06830){var _0x1b183a={'role':_0x55421d['body']['role'],'userProfileId':_0x55421d[_0x6b71('0x72')]['userProfileId']};if(!_0x1b183a)throw new Error(_0x6b71('0x73'));if(_0x1b183a[_0x6b71('0x74')]==='user'){var _0x3eb54e=_0xe06830[_0x6b71('0x26')]({'plain':!![]});return db[_0x6b71('0x75')][_0x6b71('0x47')]({'where':{'name':_0x6b71('0x76'),'userProfileId':_0x1b183a[_0x6b71('0x77')]},'raw':!![]})[_0x6b71('0x24')](function(_0x4070b9){if(_0x4070b9&&_0x4070b9['autoAssociation']===0x0){return db[_0x6b71('0x27')]['create']({'name':_0x3eb54e[_0x6b71('0x2a')],'resourceId':_0x3eb54e['id'],'type':_0x4070b9[_0x6b71('0x2a')],'sectionId':_0x4070b9['id']},{})[_0x6b71('0x24')](function(){return _0xe06830;});}else{return _0xe06830;}})[_0x6b71('0x44')](function(_0x50971c){logger[_0x6b71('0x61')](_0x6b71('0x78'),_0x50971c);throw _0x50971c;});}return _0xe06830;})[_0x6b71('0x24')](respondWithResult(_0x2e60ac,null))['catch'](handleError(_0x2e60ac,null));});_0x45f654[_0x6b71('0x79')]();}catch(_0x3213a3){_0x2e60ac['status'](0x1f4)[_0x6b71('0x2b')](_0x3213a3);}};exports[_0x6b71('0x23')]=function(_0x562edf,_0x42f491,_0x4b8bbb){return db[_0x6b71('0x2e')][_0x6b71('0x47')]({'where':{'id':_0x562edf[_0x6b71('0x45')]['id']}})[_0x6b71('0x24')](handleEntityNotFound(_0x42f491,null))[_0x6b71('0x24')](saveUpdates(_[_0x6b71('0x7a')](_0x562edf['body'],[_0x6b71('0x2a'),_0x6b71('0x7b')]),null))[_0x6b71('0x24')](respondWithResult(_0x42f491,null))[_0x6b71('0x44')](handleError(_0x42f491,null));};exports[_0x6b71('0x7c')]=function(_0x37fc7b,_0x16b1fd,_0x5155d9){return db[_0x6b71('0x2e')][_0x6b71('0x47')]({'where':{'id':_0x37fc7b[_0x6b71('0x45')]['id']}})['then'](function(_0x254bdb){if(_0x254bdb){return _0x254bdb[_0x6b71('0x25')]();}})['then'](function(_0x5aa2f0){var _0x11bf2a=path[_0x6b71('0x4c')](config[_0x6b71('0x4d')],_0x6b71('0x5b'),util[_0x6b71('0x51')]('%s.%s',_0x5aa2f0[_0x6b71('0x49')],_0x5aa2f0[_0x6b71('0x7d')]));var _0x8ccf0b=path[_0x6b71('0x4c')](config[_0x6b71('0x4d')],_0x6b71('0x4e'),util[_0x6b71('0x51')](_0x6b71('0x52'),_0x5aa2f0[_0x6b71('0x49')],_0x5aa2f0[_0x6b71('0x4a')]));fs['unlinkSync'](_0x11bf2a);fs[_0x6b71('0x7e')](_0x8ccf0b);return _0x5aa2f0;})[_0x6b71('0x24')](function(_0x57073a){if(_0x57073a){return _0x16b1fd[_0x6b71('0x19')](0xcc)[_0x6b71('0x71')]();}})[_0x6b71('0x24')](handleEntityNotFound(_0x16b1fd,null))[_0x6b71('0x44')](handleError(_0x16b1fd,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index de624c8..b5d7323 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 _0x2757=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','../../config/logger','api'];(function(_0x12287a,_0x22f00c){var _0x2141a0=function(_0xeb3b07){while(--_0xeb3b07){_0x12287a['push'](_0x12287a['shift']());}};_0x2141a0(++_0x22f00c);}(_0x2757,0xf4));var _0x7275=function(_0x183b18,_0x243de5){_0x183b18=_0x183b18-0x0;var _0xad9a35=_0x2757[_0x183b18];return _0xad9a35;};'use strict';var _=require(_0x7275('0x0'));var util=require('util');var logger=require(_0x7275('0x1'))(_0x7275('0x2'));var moment=require('moment');var BPromise=require(_0x7275('0x3'));var rp=require(_0x7275('0x4'));var fs=require('fs');var path=require(_0x7275('0x5'));var rimraf=require(_0x7275('0x6'));var config=require(_0x7275('0x7'));var attributes=require(_0x7275('0x8'));module[_0x7275('0x9')]=function(_0x134226,_0x53befb){return _0x134226[_0x7275('0xa')](_0x7275('0xb'),attributes,{'tableName':_0x7275('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9770=['rimraf','./sound.attributes','exports','define','Sound','lodash','util','bluebird','request-promise','path'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0x9770,0x1c7));var _0x0977=function(_0x2f278d,_0x2064b9){_0x2f278d=_0x2f278d-0x0;var _0x34c4ab=_0x9770[_0x2f278d];return _0x34c4ab;};'use strict';var _=require(_0x0977('0x0'));var util=require(_0x0977('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0977('0x2'));var rp=require(_0x0977('0x3'));var fs=require('fs');var path=require(_0x0977('0x4'));var rimraf=require(_0x0977('0x5'));var config=require('../../config/environment');var attributes=require(_0x0977('0x6'));module[_0x0977('0x7')]=function(_0x3db1d7,_0x2071c5){return _0x3db1d7[_0x0977('0x8')](_0x0977('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 95dbf94..72ad5eb 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 _0xd1d0=['jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xecdd9b,_0x3f2836){var _0x17237d=function(_0x37430b){while(--_0x37430b){_0xecdd9b['push'](_0xecdd9b['shift']());}};_0x17237d(++_0x3f2836);}(_0xd1d0,0x118));var _0x0d1d=function(_0x4e2697,_0x5e860d){_0x4e2697=_0x4e2697-0x0;var _0x46fe39=_0xd1d0[_0x4e2697];return _0x46fe39;};'use strict';var _=require('lodash');var util=require(_0x0d1d('0x0'));var moment=require('moment');var BPromise=require(_0x0d1d('0x1'));var rs=require(_0x0d1d('0x2'));var fs=require('fs');var Redis=require(_0x0d1d('0x3'));var db=require(_0x0d1d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d1d('0x5'))(_0x0d1d('0x6'));var config=require(_0x0d1d('0x7'));var jayson=require(_0x0d1d('0x8'));var client=jayson['client'][_0x0d1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x196d14,_0x9ec677,_0x28f376){return new BPromise(function(_0x490d81,_0x3c8a59){return client[_0x0d1d('0xa')](_0x196d14,_0x28f376)[_0x0d1d('0xb')](function(_0x139c54){logger[_0x0d1d('0xc')](_0x0d1d('0xd'),_0x9ec677,_0x0d1d('0xe'));logger[_0x0d1d('0xf')](_0x0d1d('0x10'),_0x9ec677,'request\x20sent',JSON[_0x0d1d('0x11')](_0x139c54));if(_0x139c54[_0x0d1d('0x12')]){if(_0x139c54[_0x0d1d('0x12')][_0x0d1d('0x13')]===0x1f4){logger['error'](_0x0d1d('0xd'),_0x9ec677,_0x139c54['error'][_0x0d1d('0x14')]);return _0x3c8a59(_0x139c54[_0x0d1d('0x12')][_0x0d1d('0x14')]);}logger[_0x0d1d('0x12')](_0x0d1d('0xd'),_0x9ec677,_0x139c54[_0x0d1d('0x12')][_0x0d1d('0x14')]);return _0x490d81(_0x139c54[_0x0d1d('0x12')][_0x0d1d('0x14')]);}else{logger[_0x0d1d('0xc')](_0x0d1d('0xd'),_0x9ec677,'request\x20sent');_0x490d81(_0x139c54[_0x0d1d('0x15')][_0x0d1d('0x14')]);}})[_0x0d1d('0x16')](function(_0x7490a0){logger['error'](_0x0d1d('0xd'),_0x9ec677,_0x7490a0);_0x3c8a59(_0x7490a0);});});}exports[_0x0d1d('0x17')]=function(_0x3c6c92){var _0x41c801=this;return new Promise(function(_0x4444c9,_0x66c6c5){return db[_0x0d1d('0x18')][_0x0d1d('0x19')]({'raw':_0x3c6c92[_0x0d1d('0x1a')]?_0x3c6c92['options'][_0x0d1d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c6c92[_0x0d1d('0x1a')]?_0x3c6c92['options']['where']||null:null,'attributes':_0x3c6c92['options']?_0x3c6c92[_0x0d1d('0x1a')][_0x0d1d('0x1c')]||null:null,'include':_0x3c6c92[_0x0d1d('0x1a')]?_0x3c6c92[_0x0d1d('0x1a')][_0x0d1d('0x1d')]?_[_0x0d1d('0x1e')](_0x3c6c92[_0x0d1d('0x1a')][_0x0d1d('0x1d')],function(_0x274ba5){return{'model':db[_0x274ba5[_0x0d1d('0x1f')]],'as':_0x274ba5['as'],'attributes':_0x274ba5['attributes'],'include':_0x274ba5[_0x0d1d('0x1d')]?_['map'](_0x274ba5[_0x0d1d('0x1d')],function(_0x5a4e1b){return{'model':db[_0x5a4e1b[_0x0d1d('0x1f')]],'as':_0x5a4e1b['as'],'attributes':_0x5a4e1b['attributes'],'include':_0x5a4e1b['include']?_[_0x0d1d('0x1e')](_0x5a4e1b[_0x0d1d('0x1d')],function(_0x5a8825){return{'model':db[_0x5a8825[_0x0d1d('0x1f')]],'as':_0x5a8825['as'],'attributes':_0x5a8825[_0x0d1d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0d1d('0xb')](function(_0x26ac5c){logger[_0x0d1d('0xc')]('ShowSound',_0x3c6c92);logger['debug'](_0x0d1d('0x17'),_0x3c6c92,JSON[_0x0d1d('0x11')](_0x26ac5c));_0x4444c9(_0x26ac5c);})[_0x0d1d('0x16')](function(_0x39426a){logger[_0x0d1d('0x12')](_0x0d1d('0x17'),_0x39426a[_0x0d1d('0x14')],_0x3c6c92);_0x66c6c5(_0x41c801['error'](0x1f4,_0x39426a[_0x0d1d('0x14')]));});});}; \ No newline at end of file +var _0xec66=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x3b7f47,_0x501172){var _0x270b0b=function(_0x1021f7){while(--_0x1021f7){_0x3b7f47['push'](_0x3b7f47['shift']());}};_0x270b0b(++_0x501172);}(_0xec66,0x1eb));var _0x6ec6=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0xec66[_0x1486e5];return _0x29d89b;};'use strict';var _=require(_0x6ec6('0x0'));var util=require(_0x6ec6('0x1'));var moment=require(_0x6ec6('0x2'));var BPromise=require(_0x6ec6('0x3'));var rs=require(_0x6ec6('0x4'));var fs=require('fs');var Redis=require(_0x6ec6('0x5'));var db=require(_0x6ec6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ec6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ec6('0x8'));var client=jayson[_0x6ec6('0x9')][_0x6ec6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42762b,_0x51f710,_0x264ecc){return new BPromise(function(_0x1c8db2,_0x4e3092){return client['request'](_0x42762b,_0x264ecc)['then'](function(_0x56d4bd){logger['info'](_0x6ec6('0xb'),_0x51f710,_0x6ec6('0xc'));logger[_0x6ec6('0xd')](_0x6ec6('0xe'),_0x51f710,_0x6ec6('0xc'),JSON['stringify'](_0x56d4bd));if(_0x56d4bd[_0x6ec6('0xf')]){if(_0x56d4bd[_0x6ec6('0xf')][_0x6ec6('0x10')]===0x1f4){logger[_0x6ec6('0xf')](_0x6ec6('0xb'),_0x51f710,_0x56d4bd[_0x6ec6('0xf')][_0x6ec6('0x11')]);return _0x4e3092(_0x56d4bd[_0x6ec6('0xf')][_0x6ec6('0x11')]);}logger['error'](_0x6ec6('0xb'),_0x51f710,_0x56d4bd['error'][_0x6ec6('0x11')]);return _0x1c8db2(_0x56d4bd[_0x6ec6('0xf')][_0x6ec6('0x11')]);}else{logger[_0x6ec6('0x12')](_0x6ec6('0xb'),_0x51f710,_0x6ec6('0xc'));_0x1c8db2(_0x56d4bd['result'][_0x6ec6('0x11')]);}})[_0x6ec6('0x13')](function(_0x480637){logger['error'](_0x6ec6('0xb'),_0x51f710,_0x480637);_0x4e3092(_0x480637);});});}exports['ShowSound']=function(_0x2db746){var _0x4bdb12=this;return new Promise(function(_0xbb8ddc,_0x96573f){return db[_0x6ec6('0x14')][_0x6ec6('0x15')]({'raw':_0x2db746[_0x6ec6('0x16')]?_0x2db746[_0x6ec6('0x16')][_0x6ec6('0x17')]===undefined?!![]:![]:!![],'where':_0x2db746[_0x6ec6('0x16')]?_0x2db746[_0x6ec6('0x16')][_0x6ec6('0x18')]||null:null,'attributes':_0x2db746['options']?_0x2db746[_0x6ec6('0x16')][_0x6ec6('0x19')]||null:null,'include':_0x2db746[_0x6ec6('0x16')]?_0x2db746[_0x6ec6('0x16')]['include']?_['map'](_0x2db746[_0x6ec6('0x16')][_0x6ec6('0x1a')],function(_0x1ec4db){return{'model':db[_0x1ec4db['model']],'as':_0x1ec4db['as'],'attributes':_0x1ec4db[_0x6ec6('0x19')],'include':_0x1ec4db['include']?_['map'](_0x1ec4db[_0x6ec6('0x1a')],function(_0x24431f){return{'model':db[_0x24431f['model']],'as':_0x24431f['as'],'attributes':_0x24431f[_0x6ec6('0x19')],'include':_0x24431f['include']?_[_0x6ec6('0x1b')](_0x24431f[_0x6ec6('0x1a')],function(_0x309ed5){return{'model':db[_0x309ed5[_0x6ec6('0x1c')]],'as':_0x309ed5['as'],'attributes':_0x309ed5[_0x6ec6('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e920b){logger[_0x6ec6('0x12')](_0x6ec6('0x1d'),_0x2db746);logger[_0x6ec6('0xd')](_0x6ec6('0x1d'),_0x2db746,JSON[_0x6ec6('0x1e')](_0x1e920b));_0xbb8ddc(_0x1e920b);})[_0x6ec6('0x13')](function(_0x1e71d6){logger[_0x6ec6('0xf')](_0x6ec6('0x1d'),_0x1e71d6[_0x6ec6('0x11')],_0x2db746);_0x96573f(_0x4bdb12[_0x6ec6('0xf')](0x1f4,_0x1e71d6[_0x6ec6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index cae5b06..256b0be 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 _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(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x471898,_0x8354a9){_0x471898=_0x471898-0x0;var _0x566793=_0x9ffd[_0x471898];return _0x566793;};'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 +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x3aea93,_0x4bd632){var _0x1adb9b=function(_0xe756ab){while(--_0xe756ab){_0x3aea93['push'](_0x3aea93['shift']());}};_0x1adb9b(++_0x4bd632);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a4b9967..b070adb 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 _0xa116=['exports','STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x5966d3,_0x47f9a6){var _0x342a1c=function(_0x2309cf){while(--_0x2309cf){_0x5966d3['push'](_0x5966d3['shift']());}};_0x342a1c(++_0x47f9a6);}(_0xa116,0xd1));var _0x6a11=function(_0x443125,_0x427648){_0x443125=_0x443125-0x0;var _0x30ffaf=_0xa116[_0x443125];return _0x30ffaf;};'use strict';var Sequelize=require(_0x6a11('0x0'));module[_0x6a11('0x1')]={'uniqueid':{'type':Sequelize[_0x6a11('0x2')]},'body':{'type':Sequelize[_0x6a11('0x3')](_0x6a11('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x6a11('0x5')]('in',_0x6a11('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x6a11('0x2')]},'providerResponse':{'type':Sequelize[_0x6a11('0x3')]}}; \ No newline at end of file +var _0x41dd=['TEXT','out','sequelize','exports','STRING'];(function(_0x265878,_0x48f44c){var _0xf6a139=function(_0xe31091){while(--_0xe31091){_0x265878['push'](_0x265878['shift']());}};_0xf6a139(++_0x48f44c);}(_0x41dd,0x1bf));var _0xd41d=function(_0x2b358e,_0x46fc58){_0x2b358e=_0x2b358e-0x0;var _0x3bb291=_0x41dd[_0x2b358e];return _0x3bb291;};'use strict';var Sequelize=require(_0xd41d('0x0'));module[_0xd41d('0x1')]={'uniqueid':{'type':Sequelize[_0xd41d('0x2')]},'body':{'type':Sequelize[_0xd41d('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd41d('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xd41d('0x2')]},'providerResponse':{'type':Sequelize[_0xd41d('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 9121505..350285d 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 _0x4bd3=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','SquareMessage','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','order','sort','where','filter','merge','map','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x4bd3,0x10f));var _0x34bd=function(_0x56b50e,_0x51dd71){_0x56b50e=_0x56b50e-0x0;var _0x4a6cb8=_0x4bd3[_0x56b50e];return _0x4a6cb8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x34bd('0x0'));var rp=require(_0x34bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x34bd('0x2'));var util=require(_0x34bd('0x3'));var path=require(_0x34bd('0x4'));var sox=require('sox');var csv=require(_0x34bd('0x5'));var ejs=require(_0x34bd('0x6'));var fs=require('fs');var fs_extra=require(_0x34bd('0x7'));var _=require(_0x34bd('0x8'));var squel=require(_0x34bd('0x9'));var crypto=require(_0x34bd('0xa'));var jsforce=require(_0x34bd('0xb'));var deskjs=require(_0x34bd('0xc'));var toCsv=require(_0x34bd('0x5'));var querystring=require(_0x34bd('0xd'));var Papa=require('papaparse');var Redis=require(_0x34bd('0xe'));var authService=require(_0x34bd('0xf'));var qs=require(_0x34bd('0x10'));var as=require(_0x34bd('0x11'));var hardwareService=require(_0x34bd('0x12'));var logger=require(_0x34bd('0x13'))(_0x34bd('0x14'));var utils=require(_0x34bd('0x15'));var config=require(_0x34bd('0x16'));var licenseUtil=require(_0x34bd('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cfd86,_0x7a8ec6){_0x7a8ec6=_0x7a8ec6||0xcc;return function(_0x26a515){if(_0x26a515){return _0x2cfd86['sendStatus'](_0x7a8ec6);}return _0x2cfd86[_0x34bd('0x18')](_0x7a8ec6)[_0x34bd('0x19')]();};}function respondWithResult(_0x3af1d1,_0x3f6130){_0x3f6130=_0x3f6130||0xc8;return function(_0x320bc9){if(_0x320bc9){return _0x3af1d1[_0x34bd('0x18')](_0x3f6130)[_0x34bd('0x1a')](_0x320bc9);}};}function respondWithFilteredResult(_0x1ee4eb,_0x423a90){return function(_0x58425a){if(_0x58425a){var _0xf33ca0=typeof _0x423a90[_0x34bd('0x1b')]===_0x34bd('0x1c')&&typeof _0x423a90['limit']===_0x34bd('0x1c');var _0x257402=_0x58425a[_0x34bd('0x1d')];var _0x492144=_0xf33ca0?0x0:_0x423a90[_0x34bd('0x1b')];var _0x2f4c7b=_0xf33ca0?_0x58425a['count']:_0x423a90[_0x34bd('0x1b')]+_0x423a90[_0x34bd('0x1e')];var _0x963ebc;if(_0x2f4c7b>=_0x257402){_0x2f4c7b=_0x257402;_0x963ebc=0xc8;}else{_0x963ebc=0xce;}_0x1ee4eb[_0x34bd('0x18')](_0x963ebc);return _0x1ee4eb[_0x34bd('0x1f')](_0x34bd('0x20'),_0x492144+'-'+_0x2f4c7b+'/'+_0x257402)[_0x34bd('0x1a')](_0x58425a);}return null;};}function patchUpdates(_0x293426){return function(_0x36613e){try{jsonpatch[_0x34bd('0x21')](_0x36613e,_0x293426,!![]);}catch(_0x4e80fd){return BPromise[_0x34bd('0x22')](_0x4e80fd);}return _0x36613e[_0x34bd('0x23')]();};}function saveUpdates(_0x4823c7,_0x373ad5){return function(_0x2c341a){if(_0x2c341a){return _0x2c341a[_0x34bd('0x24')](_0x4823c7)[_0x34bd('0x25')](function(_0x500747){return _0x500747;});}return null;};}function removeEntity(_0x444f21,_0x2acdc2){return function(_0x5c1616){if(_0x5c1616){return _0x5c1616[_0x34bd('0x26')]()[_0x34bd('0x25')](function(){_0x444f21[_0x34bd('0x18')](0xcc)[_0x34bd('0x19')]();});}};}function handleEntityNotFound(_0x3556ff,_0x3c1c6e){return function(_0x3095bf){if(!_0x3095bf){_0x3556ff[_0x34bd('0x27')](0x194);}return _0x3095bf;};}function handleError(_0x55815b,_0x57e03a){_0x57e03a=_0x57e03a||0x1f4;return function(_0x170ea6){logger[_0x34bd('0x28')](_0x170ea6['stack']);if(_0x170ea6[_0x34bd('0x29')]){delete _0x170ea6['name'];}_0x55815b[_0x34bd('0x18')](_0x57e03a)[_0x34bd('0x2a')](_0x170ea6);};}exports[_0x34bd('0x2b')]=function(_0x302f77,_0x3c5479){var _0x5d9579={},_0x169786={},_0x545089={'count':0x0,'rows':[]};var _0x300b60=_['map'](db[_0x34bd('0x2c')][_0x34bd('0x2d')],function(_0x28611e){return{'name':_0x28611e['fieldName'],'type':_0x28611e['type'][_0x34bd('0x2e')]};});_0x169786[_0x34bd('0x2f')]=_['map'](_0x300b60,_0x34bd('0x29'));_0x169786['query']=_[_0x34bd('0x30')](_0x302f77[_0x34bd('0x31')]);_0x169786[_0x34bd('0x32')]=_[_0x34bd('0x33')](_0x169786[_0x34bd('0x2f')],_0x169786[_0x34bd('0x31')]);_0x5d9579[_0x34bd('0x34')]=_[_0x34bd('0x33')](_0x169786[_0x34bd('0x2f')],qs[_0x34bd('0x35')](_0x302f77['query'][_0x34bd('0x35')]));_0x5d9579['attributes']=_0x5d9579['attributes']['length']?_0x5d9579[_0x34bd('0x34')]:_0x169786['model'];if(!_0x302f77['query']['hasOwnProperty']('nolimit')){_0x5d9579[_0x34bd('0x1e')]=qs['limit'](_0x302f77[_0x34bd('0x31')][_0x34bd('0x1e')]);_0x5d9579['offset']=qs['offset'](_0x302f77[_0x34bd('0x31')]['offset']);}_0x5d9579[_0x34bd('0x36')]=qs[_0x34bd('0x37')](_0x302f77[_0x34bd('0x31')][_0x34bd('0x37')]);_0x5d9579[_0x34bd('0x38')]=qs[_0x34bd('0x32')](_['pick'](_0x302f77[_0x34bd('0x31')],_0x169786[_0x34bd('0x32')]),_0x300b60);if(_0x302f77[_0x34bd('0x31')][_0x34bd('0x39')]){_0x5d9579[_0x34bd('0x38')]=_[_0x34bd('0x3a')](_0x5d9579[_0x34bd('0x38')],{'$or':_[_0x34bd('0x3b')](_0x300b60,function(_0x25f6ac){if(_0x25f6ac['type']!=='VIRTUAL'){var _0x116f0c={};_0x116f0c[_0x25f6ac['name']]={'$like':'%'+_0x302f77[_0x34bd('0x31')][_0x34bd('0x39')]+'%'};return _0x116f0c;}})});}_0x5d9579=_[_0x34bd('0x3a')]({},_0x5d9579,_0x302f77[_0x34bd('0x3c')]);var _0x200363={'where':_0x5d9579[_0x34bd('0x38')]};return db['SquareMessage'][_0x34bd('0x1d')](_0x200363)[_0x34bd('0x25')](function(_0x3e8705){_0x545089[_0x34bd('0x1d')]=_0x3e8705;if(_0x302f77[_0x34bd('0x31')][_0x34bd('0x3d')]){_0x5d9579['include']=[{'all':!![]}];}return db[_0x34bd('0x2c')][_0x34bd('0x3e')](_0x5d9579);})['then'](function(_0x36ae3e){_0x545089[_0x34bd('0x3f')]=_0x36ae3e;return _0x545089;})[_0x34bd('0x25')](respondWithFilteredResult(_0x3c5479,_0x5d9579))[_0x34bd('0x40')](handleError(_0x3c5479,null));};exports['show']=function(_0x59850e,_0x46d855){var _0x242894={'raw':!![],'where':{'id':_0x59850e[_0x34bd('0x41')]['id']}},_0x1572be={};_0x1572be['model']=_[_0x34bd('0x30')](db['SquareMessage'][_0x34bd('0x2d')]);_0x1572be['query']=_[_0x34bd('0x30')](_0x59850e['query']);_0x1572be[_0x34bd('0x32')]=_[_0x34bd('0x33')](_0x1572be[_0x34bd('0x2f')],_0x1572be[_0x34bd('0x31')]);_0x242894[_0x34bd('0x34')]=_[_0x34bd('0x33')](_0x1572be[_0x34bd('0x2f')],qs[_0x34bd('0x35')](_0x59850e[_0x34bd('0x31')][_0x34bd('0x35')]));_0x242894[_0x34bd('0x34')]=_0x242894['attributes'][_0x34bd('0x42')]?_0x242894[_0x34bd('0x34')]:_0x1572be[_0x34bd('0x2f')];if(_0x59850e['query']['includeAll']){_0x242894[_0x34bd('0x43')]=[{'all':!![]}];}_0x242894=_['merge']({},_0x242894,_0x59850e[_0x34bd('0x3c')]);return db[_0x34bd('0x2c')][_0x34bd('0x44')](_0x242894)[_0x34bd('0x25')](handleEntityNotFound(_0x46d855,null))[_0x34bd('0x25')](respondWithResult(_0x46d855,null))['catch'](handleError(_0x46d855,null));};exports[_0x34bd('0x45')]=function(_0x12d712,_0x407b0c){return db[_0x34bd('0x2c')][_0x34bd('0x45')](_0x12d712[_0x34bd('0x46')],{})[_0x34bd('0x25')](respondWithResult(_0x407b0c,0xc9))[_0x34bd('0x40')](handleError(_0x407b0c,null));};exports[_0x34bd('0x24')]=function(_0x186034,_0x2d01d8){if(_0x186034[_0x34bd('0x46')]['id']){delete _0x186034['body']['id'];}return db['SquareMessage'][_0x34bd('0x44')]({'where':{'id':_0x186034[_0x34bd('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d01d8,null))[_0x34bd('0x25')](saveUpdates(_0x186034[_0x34bd('0x46')],null))[_0x34bd('0x25')](respondWithResult(_0x2d01d8,null))[_0x34bd('0x40')](handleError(_0x2d01d8,null));};exports[_0x34bd('0x26')]=function(_0x32cbe8,_0x27c1b8){return db[_0x34bd('0x2c')][_0x34bd('0x44')]({'where':{'id':_0x32cbe8[_0x34bd('0x41')]['id']}})['then'](handleEntityNotFound(_0x27c1b8,null))[_0x34bd('0x25')](removeEntity(_0x27c1b8,null))[_0x34bd('0x40')](handleError(_0x27c1b8,null));}; \ No newline at end of file +var _0x5f11=['SquareMessage','count','include','rows','catch','show','params','intersection','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','update','then','destroy','error','name','index','rawAttributes','fieldName','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options'];(function(_0x1ed792,_0x476ac4){var _0x3087cc=function(_0x21dd34){while(--_0x21dd34){_0x1ed792['push'](_0x1ed792['shift']());}};_0x3087cc(++_0x476ac4);}(_0x5f11,0x98));var _0x15f1=function(_0x1033b9,_0x101673){_0x1033b9=_0x1033b9-0x0;var _0x292719=_0x5f11[_0x1033b9];return _0x292719;};'use strict';var emlformat=require(_0x15f1('0x0'));var rimraf=require(_0x15f1('0x1'));var zipdir=require(_0x15f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15f1('0x3'));var moment=require(_0x15f1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x15f1('0x5'));var util=require('util');var path=require(_0x15f1('0x6'));var sox=require(_0x15f1('0x7'));var csv=require(_0x15f1('0x8'));var ejs=require(_0x15f1('0x9'));var fs=require('fs');var fs_extra=require(_0x15f1('0xa'));var _=require(_0x15f1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x15f1('0xc'));var deskjs=require(_0x15f1('0xd'));var toCsv=require(_0x15f1('0x8'));var querystring=require(_0x15f1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x15f1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x15f1('0x10'));var hardwareService=require(_0x15f1('0x11'));var logger=require(_0x15f1('0x12'))('api');var utils=require(_0x15f1('0x13'));var config=require(_0x15f1('0x14'));var licenseUtil=require(_0x15f1('0x15'));var db=require(_0x15f1('0x16'))['db'];function respondWithStatusCode(_0x13fe7b,_0xb42d4c){_0xb42d4c=_0xb42d4c||0xcc;return function(_0x25c461){if(_0x25c461){return _0x13fe7b[_0x15f1('0x17')](_0xb42d4c);}return _0x13fe7b[_0x15f1('0x18')](_0xb42d4c)[_0x15f1('0x19')]();};}function respondWithResult(_0x52ff82,_0x5b64b6){_0x5b64b6=_0x5b64b6||0xc8;return function(_0x4d5e26){if(_0x4d5e26){return _0x52ff82[_0x15f1('0x18')](_0x5b64b6)['json'](_0x4d5e26);}};}function respondWithFilteredResult(_0xd28a30,_0x311ff1){return function(_0x5a9883){if(_0x5a9883){var _0x4ffef4=typeof _0x311ff1[_0x15f1('0x1a')]===_0x15f1('0x1b')&&typeof _0x311ff1[_0x15f1('0x1c')]===_0x15f1('0x1b');var _0x277781=_0x5a9883['count'];var _0x3e37f6=_0x4ffef4?0x0:_0x311ff1[_0x15f1('0x1a')];var _0x179a30=_0x4ffef4?_0x5a9883['count']:_0x311ff1[_0x15f1('0x1a')]+_0x311ff1[_0x15f1('0x1c')];var _0x3dc37a;if(_0x179a30>=_0x277781){_0x179a30=_0x277781;_0x3dc37a=0xc8;}else{_0x3dc37a=0xce;}_0xd28a30[_0x15f1('0x18')](_0x3dc37a);return _0xd28a30['set'](_0x15f1('0x1d'),_0x3e37f6+'-'+_0x179a30+'/'+_0x277781)[_0x15f1('0x1e')](_0x5a9883);}return null;};}function patchUpdates(_0x5d21b2){return function(_0x5c6ba2){try{jsonpatch[_0x15f1('0x1f')](_0x5c6ba2,_0x5d21b2,!![]);}catch(_0x350581){return BPromise[_0x15f1('0x20')](_0x350581);}return _0x5c6ba2['save']();};}function saveUpdates(_0x584f22,_0x1190a9){return function(_0x254c2a){if(_0x254c2a){return _0x254c2a[_0x15f1('0x21')](_0x584f22)[_0x15f1('0x22')](function(_0x10d18e){return _0x10d18e;});}return null;};}function removeEntity(_0x94e50b,_0xd72faa){return function(_0x48038d){if(_0x48038d){return _0x48038d[_0x15f1('0x23')]()[_0x15f1('0x22')](function(){_0x94e50b['status'](0xcc)[_0x15f1('0x19')]();});}};}function handleEntityNotFound(_0x152d4d,_0x4fcb25){return function(_0x27d7ae){if(!_0x27d7ae){_0x152d4d['sendStatus'](0x194);}return _0x27d7ae;};}function handleError(_0x5c71da,_0x339a22){_0x339a22=_0x339a22||0x1f4;return function(_0x11db76){logger[_0x15f1('0x24')](_0x11db76['stack']);if(_0x11db76[_0x15f1('0x25')]){delete _0x11db76['name'];}_0x5c71da[_0x15f1('0x18')](_0x339a22)['send'](_0x11db76);};}exports[_0x15f1('0x26')]=function(_0x453eb3,_0x4ea68e){var _0x623bf8={},_0x1c854b={},_0x3bfd5c={'count':0x0,'rows':[]};var _0x1e0d18=_['map'](db['SquareMessage'][_0x15f1('0x27')],function(_0x538377){return{'name':_0x538377[_0x15f1('0x28')],'type':_0x538377['type']['key']};});_0x1c854b[_0x15f1('0x29')]=_[_0x15f1('0x2a')](_0x1e0d18,_0x15f1('0x25'));_0x1c854b['query']=_[_0x15f1('0x2b')](_0x453eb3[_0x15f1('0x2c')]);_0x1c854b[_0x15f1('0x2d')]=_['intersection'](_0x1c854b['model'],_0x1c854b[_0x15f1('0x2c')]);_0x623bf8[_0x15f1('0x2e')]=_['intersection'](_0x1c854b[_0x15f1('0x29')],qs[_0x15f1('0x2f')](_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x2f')]));_0x623bf8[_0x15f1('0x2e')]=_0x623bf8[_0x15f1('0x2e')][_0x15f1('0x30')]?_0x623bf8['attributes']:_0x1c854b[_0x15f1('0x29')];if(!_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x31')](_0x15f1('0x32'))){_0x623bf8[_0x15f1('0x1c')]=qs['limit'](_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x1c')]);_0x623bf8['offset']=qs[_0x15f1('0x1a')](_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x1a')]);}_0x623bf8['order']=qs[_0x15f1('0x33')](_0x453eb3['query'][_0x15f1('0x33')]);_0x623bf8[_0x15f1('0x34')]=qs[_0x15f1('0x2d')](_[_0x15f1('0x35')](_0x453eb3[_0x15f1('0x2c')],_0x1c854b['filters']),_0x1e0d18);if(_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x36')]){_0x623bf8[_0x15f1('0x34')]=_[_0x15f1('0x37')](_0x623bf8['where'],{'$or':_[_0x15f1('0x2a')](_0x1e0d18,function(_0x1bad37){if(_0x1bad37[_0x15f1('0x38')]!=='VIRTUAL'){var _0x99d8ba={};_0x99d8ba[_0x1bad37[_0x15f1('0x25')]]={'$like':'%'+_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x36')]+'%'};return _0x99d8ba;}})});}_0x623bf8=_[_0x15f1('0x37')]({},_0x623bf8,_0x453eb3[_0x15f1('0x39')]);var _0x3216f1={'where':_0x623bf8[_0x15f1('0x34')]};return db[_0x15f1('0x3a')][_0x15f1('0x3b')](_0x3216f1)[_0x15f1('0x22')](function(_0x52e2b8){_0x3bfd5c[_0x15f1('0x3b')]=_0x52e2b8;if(_0x453eb3[_0x15f1('0x2c')]['includeAll']){_0x623bf8[_0x15f1('0x3c')]=[{'all':!![]}];}return db[_0x15f1('0x3a')]['findAll'](_0x623bf8);})[_0x15f1('0x22')](function(_0x100120){_0x3bfd5c[_0x15f1('0x3d')]=_0x100120;return _0x3bfd5c;})['then'](respondWithFilteredResult(_0x4ea68e,_0x623bf8))[_0x15f1('0x3e')](handleError(_0x4ea68e,null));};exports[_0x15f1('0x3f')]=function(_0x370eea,_0x1c87da){var _0x3b7426={'raw':!![],'where':{'id':_0x370eea[_0x15f1('0x40')]['id']}},_0x3870ad={};_0x3870ad[_0x15f1('0x29')]=_['keys'](db[_0x15f1('0x3a')][_0x15f1('0x27')]);_0x3870ad[_0x15f1('0x2c')]=_['keys'](_0x370eea['query']);_0x3870ad[_0x15f1('0x2d')]=_['intersection'](_0x3870ad[_0x15f1('0x29')],_0x3870ad[_0x15f1('0x2c')]);_0x3b7426[_0x15f1('0x2e')]=_[_0x15f1('0x41')](_0x3870ad[_0x15f1('0x29')],qs['fields'](_0x370eea[_0x15f1('0x2c')]['fields']));_0x3b7426['attributes']=_0x3b7426[_0x15f1('0x2e')][_0x15f1('0x30')]?_0x3b7426[_0x15f1('0x2e')]:_0x3870ad['model'];if(_0x370eea[_0x15f1('0x2c')][_0x15f1('0x42')]){_0x3b7426[_0x15f1('0x3c')]=[{'all':!![]}];}_0x3b7426=_[_0x15f1('0x37')]({},_0x3b7426,_0x370eea[_0x15f1('0x39')]);return db[_0x15f1('0x3a')][_0x15f1('0x43')](_0x3b7426)[_0x15f1('0x22')](handleEntityNotFound(_0x1c87da,null))[_0x15f1('0x22')](respondWithResult(_0x1c87da,null))[_0x15f1('0x3e')](handleError(_0x1c87da,null));};exports[_0x15f1('0x44')]=function(_0x1e19ad,_0x14531d){return db['SquareMessage'][_0x15f1('0x44')](_0x1e19ad[_0x15f1('0x45')],{})[_0x15f1('0x22')](respondWithResult(_0x14531d,0xc9))[_0x15f1('0x3e')](handleError(_0x14531d,null));};exports[_0x15f1('0x21')]=function(_0x15051f,_0x445d1b){if(_0x15051f[_0x15f1('0x45')]['id']){delete _0x15051f[_0x15f1('0x45')]['id'];}return db[_0x15f1('0x3a')]['find']({'where':{'id':_0x15051f[_0x15f1('0x40')]['id']}})[_0x15f1('0x22')](handleEntityNotFound(_0x445d1b,null))[_0x15f1('0x22')](saveUpdates(_0x15051f[_0x15f1('0x45')],null))[_0x15f1('0x22')](respondWithResult(_0x445d1b,null))[_0x15f1('0x3e')](handleError(_0x445d1b,null));};exports[_0x15f1('0x23')]=function(_0x1b6e77,_0x535184){return db[_0x15f1('0x3a')][_0x15f1('0x43')]({'where':{'id':_0x1b6e77[_0x15f1('0x40')]['id']}})[_0x15f1('0x22')](handleEntityNotFound(_0x535184,null))['then'](removeEntity(_0x535184,null))[_0x15f1('0x3e')](handleError(_0x535184,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6667158..23d4d33 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 _0x43e9=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x648f5e,_0x69583c){var _0x3cf5b5=function(_0x4b24fe){while(--_0x4b24fe){_0x648f5e['push'](_0x648f5e['shift']());}};_0x3cf5b5(++_0x69583c);}(_0x43e9,0xca));var _0x943e=function(_0x2d424a,_0x5ec74c){_0x2d424a=_0x2d424a-0x0;var _0x351031=_0x43e9[_0x2d424a];return _0x351031;};'use strict';var _=require('lodash');var util=require(_0x943e('0x0'));var logger=require(_0x943e('0x1'))(_0x943e('0x2'));var moment=require('moment');var BPromise=require(_0x943e('0x3'));var rp=require(_0x943e('0x4'));var fs=require('fs');var path=require(_0x943e('0x5'));var rimraf=require(_0x943e('0x6'));var config=require(_0x943e('0x7'));var attributes=require(_0x943e('0x8'));module[_0x943e('0x9')]=function(_0x5ca7c6,_0x2dc203){return _0x5ca7c6[_0x943e('0xa')](_0x943e('0xb'),attributes,{'tableName':_0x943e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bd1=['../../config/environment','./squareMessage.attributes','SquareMessage','square_messages','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x20a356,_0x7313f6){var _0x454c50=function(_0x3725b6){while(--_0x3725b6){_0x20a356['push'](_0x20a356['shift']());}};_0x454c50(++_0x7313f6);}(_0x6bd1,0x1c6));var _0x16bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6bd1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x16bd('0x0'));var util=require(_0x16bd('0x1'));var logger=require(_0x16bd('0x2'))(_0x16bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16bd('0x5'));var config=require(_0x16bd('0x6'));var attributes=require(_0x16bd('0x7'));module['exports']=function(_0x206b88,_0x2de8a2){return _0x206b88['define'](_0x16bd('0x8'),attributes,{'tableName':_0x16bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index b9e0625..6863383 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 _0x942b=['SquareMessage','create','options','raw','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareMessage'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x942b,0xe6));var _0xb942=function(_0x1e11c4,_0x20fe65){_0x1e11c4=_0x1e11c4-0x0;var _0x1229a0=_0x942b[_0x1e11c4];return _0x1229a0;};'use strict';var _=require(_0xb942('0x0'));var util=require(_0xb942('0x1'));var moment=require('moment');var BPromise=require(_0xb942('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb942('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb942('0x4'))(_0xb942('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb942('0x6')][_0xb942('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56666c,_0x5289ee,_0x189f5c){return new BPromise(function(_0x3344d9,_0x20b0a7){return client[_0xb942('0x8')](_0x56666c,_0x189f5c)[_0xb942('0x9')](function(_0x44eafa){logger[_0xb942('0xa')](_0xb942('0xb'),_0x5289ee,_0xb942('0xc'));logger[_0xb942('0xd')](_0xb942('0xe'),_0x5289ee,_0xb942('0xc'),JSON['stringify'](_0x44eafa));if(_0x44eafa[_0xb942('0xf')]){if(_0x44eafa['error'][_0xb942('0x10')]===0x1f4){logger[_0xb942('0xf')]('SquareMessage,\x20%s,\x20%s',_0x5289ee,_0x44eafa['error'][_0xb942('0x11')]);return _0x20b0a7(_0x44eafa['error']['message']);}logger['error'](_0xb942('0xb'),_0x5289ee,_0x44eafa[_0xb942('0xf')][_0xb942('0x11')]);return _0x3344d9(_0x44eafa[_0xb942('0xf')][_0xb942('0x11')]);}else{logger['info'](_0xb942('0xb'),_0x5289ee,'request\x20sent');_0x3344d9(_0x44eafa[_0xb942('0x12')][_0xb942('0x11')]);}})['catch'](function(_0x5bab04){logger[_0xb942('0xf')]('SquareMessage,\x20%s,\x20%s',_0x5289ee,_0x5bab04);_0x20b0a7(_0x5bab04);});});}exports[_0xb942('0x13')]=function(_0x4b664e){var _0x23f567=this;return new Promise(function(_0x2e4780,_0x2e0d42){return db[_0xb942('0x14')][_0xb942('0x15')](_0x4b664e['body'],{'raw':_0x4b664e[_0xb942('0x16')]?_0x4b664e[_0xb942('0x16')][_0xb942('0x17')]===undefined?!![]:![]:!![]})[_0xb942('0x9')](function(_0x83e5fc){logger['info'](_0xb942('0x13'),_0x4b664e);logger[_0xb942('0xd')](_0xb942('0x13'),_0x4b664e,JSON['stringify'](_0x83e5fc));_0x2e4780(_0x83e5fc);})[_0xb942('0x18')](function(_0x26d2ad){logger[_0xb942('0xf')](_0xb942('0x13'),_0x26d2ad[_0xb942('0x11')],_0x4b664e);_0x2e0d42(_0x23f567[_0xb942('0xf')](0x1f4,_0x26d2ad[_0xb942('0x11')]));});});}; \ No newline at end of file +var _0x3d18=['SquareMessage,\x20%s,\x20%s','info','result','catch','CreateSquareMessage','create','raw','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','error','message'];(function(_0x84bd8a,_0x5dbba2){var _0x4ca232=function(_0x1209c3){while(--_0x1209c3){_0x84bd8a['push'](_0x84bd8a['shift']());}};_0x4ca232(++_0x5dbba2);}(_0x3d18,0x102));var _0x83d1=function(_0x3f8032,_0x14bee7){_0x3f8032=_0x3f8032-0x0;var _0x4b67dd=_0x3d18[_0x3f8032];return _0x4b67dd;};'use strict';var _=require(_0x83d1('0x0'));var util=require(_0x83d1('0x1'));var moment=require(_0x83d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x83d1('0x3'));var fs=require('fs');var Redis=require(_0x83d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x83d1('0x5'));var logger=require(_0x83d1('0x6'))(_0x83d1('0x7'));var config=require(_0x83d1('0x8'));var jayson=require(_0x83d1('0x9'));var client=jayson[_0x83d1('0xa')][_0x83d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d3dd9,_0x3c4499,_0xcf4a49){return new BPromise(function(_0x2f53e4,_0x2af3e8){return client['request'](_0x2d3dd9,_0xcf4a49)[_0x83d1('0xc')](function(_0x49e7a2){logger['info']('SquareMessage,\x20%s,\x20%s',_0x3c4499,_0x83d1('0xd'));logger[_0x83d1('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3c4499,'request\x20sent',JSON['stringify'](_0x49e7a2));if(_0x49e7a2[_0x83d1('0xf')]){if(_0x49e7a2[_0x83d1('0xf')]['code']===0x1f4){logger[_0x83d1('0xf')]('SquareMessage,\x20%s,\x20%s',_0x3c4499,_0x49e7a2[_0x83d1('0xf')][_0x83d1('0x10')]);return _0x2af3e8(_0x49e7a2[_0x83d1('0xf')]['message']);}logger[_0x83d1('0xf')](_0x83d1('0x11'),_0x3c4499,_0x49e7a2[_0x83d1('0xf')][_0x83d1('0x10')]);return _0x2f53e4(_0x49e7a2[_0x83d1('0xf')][_0x83d1('0x10')]);}else{logger[_0x83d1('0x12')]('SquareMessage,\x20%s,\x20%s',_0x3c4499,_0x83d1('0xd'));_0x2f53e4(_0x49e7a2[_0x83d1('0x13')][_0x83d1('0x10')]);}})[_0x83d1('0x14')](function(_0x35fe43){logger['error'](_0x83d1('0x11'),_0x3c4499,_0x35fe43);_0x2af3e8(_0x35fe43);});});}exports[_0x83d1('0x15')]=function(_0x118e04){var _0x18678d=this;return new Promise(function(_0x139a59,_0x299ee7){return db['SquareMessage'][_0x83d1('0x16')](_0x118e04['body'],{'raw':_0x118e04['options']?_0x118e04['options'][_0x83d1('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2b7586){logger[_0x83d1('0x12')]('CreateSquareMessage',_0x118e04);logger[_0x83d1('0xe')]('CreateSquareMessage',_0x118e04,JSON[_0x83d1('0x18')](_0x2b7586));_0x139a59(_0x2b7586);})['catch'](function(_0x46801e){logger[_0x83d1('0xf')](_0x83d1('0x15'),_0x46801e[_0x83d1('0x10')],_0x118e04);_0x299ee7(_0x18678d['error'](0x1f4,_0x46801e[_0x83d1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index e2eabb0..a136b1e 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 _0x60f5=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','test','post','create'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0x60f5,0x1a9));var _0x560f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60f5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x560f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x560f('0x1'));var express=require(_0x560f('0x2'));var router=express[_0x560f('0x3')]();var fs_extra=require(_0x560f('0x4'));var auth=require(_0x560f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x560f('0x6'));router[_0x560f('0x7')]('/',auth[_0x560f('0x8')](),controller[_0x560f('0x9')]);router[_0x560f('0x7')](_0x560f('0xa'),auth[_0x560f('0x8')](),controller[_0x560f('0xb')]);router[_0x560f('0x7')]('/:id/test',auth[_0x560f('0x8')](),timeout('15s'),controller[_0x560f('0xc')]);router[_0x560f('0xd')]('/',auth[_0x560f('0x8')](),controller[_0x560f('0xe')]);router[_0x560f('0xf')](_0x560f('0xa'),auth[_0x560f('0x8')](),controller[_0x560f('0x10')]);router[_0x560f('0x11')](_0x560f('0xa'),auth[_0x560f('0x8')](),controller[_0x560f('0x12')]);module[_0x560f('0x13')]=router; \ No newline at end of file +var _0xec6b=['get','isAuthenticated','index','/:id','show','/:id/test','15s','test','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x57c8ca,_0x4ef57f){var _0x58588c=function(_0x323240){while(--_0x323240){_0x57c8ca['push'](_0x57c8ca['shift']());}};_0x58588c(++_0x4ef57f);}(_0xec6b,0x12b));var _0xbec6=function(_0x481fa8,_0x22f4b5){_0x481fa8=_0x481fa8-0x0;var _0x39df0c=_0xec6b[_0x481fa8];return _0x39df0c;};'use strict';var multer=require(_0xbec6('0x0'));var util=require(_0xbec6('0x1'));var path=require(_0xbec6('0x2'));var timeout=require(_0xbec6('0x3'));var express=require(_0xbec6('0x4'));var router=express['Router']();var fs_extra=require(_0xbec6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbec6('0x6'));var config=require(_0xbec6('0x7'));var controller=require(_0xbec6('0x8'));router[_0xbec6('0x9')]('/',auth[_0xbec6('0xa')](),controller[_0xbec6('0xb')]);router[_0xbec6('0x9')](_0xbec6('0xc'),auth[_0xbec6('0xa')](),controller[_0xbec6('0xd')]);router['get'](_0xbec6('0xe'),auth[_0xbec6('0xa')](),timeout(_0xbec6('0xf')),controller[_0xbec6('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbec6('0x11')]);router[_0xbec6('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbec6('0x13')]);router['delete'](_0xbec6('0xc'),auth[_0xbec6('0xa')](),controller[_0xbec6('0x14')]);module[_0xbec6('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 2feba21..43dd4d8 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 _0x805f=['name','sequelize','exports','STRING'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x805f,0xbd));var _0xf805=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x805f[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xf805('0x0'));module[_0xf805('0x1')]={'name':{'type':Sequelize[_0xf805('0x2')],'unique':_0xf805('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf805('0x2')]},'description':{'type':Sequelize[_0xf805('0x2')]}}; \ No newline at end of file +var _0x117b=['STRING','name','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x117b,0x77));var _0xb117=function(_0x211b21,_0x12f0f7){_0x211b21=_0x211b21-0x0;var _0x29ca41=_0x117b[_0x211b21];return _0x29ca41;};'use strict';var Sequelize=require('sequelize');module[_0xb117('0x0')]={'name':{'type':Sequelize[_0xb117('0x1')],'unique':_0xb117('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb117('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 21e4a37..79f4ffb 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 _0x4a92=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','type','VIRTUAL','includeAll','rows','show','params','keys','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','odbc','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a92,0xeb));var _0x24a9=function(_0x305cc5,_0x317607){_0x305cc5=_0x305cc5-0x0;var _0x3ef26f=_0x4a92[_0x305cc5];return _0x3ef26f;};'use strict';var emlformat=require(_0x24a9('0x0'));var rimraf=require(_0x24a9('0x1'));var zipdir=require(_0x24a9('0x2'));var jsonpatch=require(_0x24a9('0x3'));var rp=require('request-promise');var moment=require(_0x24a9('0x4'));var BPromise=require(_0x24a9('0x5'));var Mustache=require(_0x24a9('0x6'));var util=require(_0x24a9('0x7'));var path=require(_0x24a9('0x8'));var sox=require('sox');var csv=require(_0x24a9('0x9'));var ejs=require(_0x24a9('0xa'));var fs=require('fs');var fs_extra=require(_0x24a9('0xb'));var _=require('lodash');var squel=require(_0x24a9('0xc'));var crypto=require(_0x24a9('0xd'));var jsforce=require(_0x24a9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x24a9('0x9'));var querystring=require(_0x24a9('0xf'));var Papa=require('papaparse');var Redis=require(_0x24a9('0x10'));var authService=require(_0x24a9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x24a9('0x12'));var hardwareService=require(_0x24a9('0x13'));var logger=require(_0x24a9('0x14'))('api');var utils=require(_0x24a9('0x15'));var config=require(_0x24a9('0x16'));var licenseUtil=require(_0x24a9('0x17'));var db=require(_0x24a9('0x18'))['db'];function respondWithStatusCode(_0x318876,_0x3e68f6){_0x3e68f6=_0x3e68f6||0xcc;return function(_0x3cec39){if(_0x3cec39){return _0x318876[_0x24a9('0x19')](_0x3e68f6);}return _0x318876[_0x24a9('0x1a')](_0x3e68f6)['end']();};}function respondWithResult(_0x5c8844,_0x45e63e){_0x45e63e=_0x45e63e||0xc8;return function(_0x4d5e12){if(_0x4d5e12){return _0x5c8844[_0x24a9('0x1a')](_0x45e63e)[_0x24a9('0x1b')](_0x4d5e12);}};}function respondWithFilteredResult(_0x1e5156,_0x5a7104){return function(_0x41ef3f){if(_0x41ef3f){var _0x4e87a5=typeof _0x5a7104[_0x24a9('0x1c')]===_0x24a9('0x1d')&&typeof _0x5a7104['limit']===_0x24a9('0x1d');var _0x20790a=_0x41ef3f[_0x24a9('0x1e')];var _0x3b954b=_0x4e87a5?0x0:_0x5a7104[_0x24a9('0x1c')];var _0x23c6e9=_0x4e87a5?_0x41ef3f[_0x24a9('0x1e')]:_0x5a7104[_0x24a9('0x1c')]+_0x5a7104[_0x24a9('0x1f')];var _0x153cc7;if(_0x23c6e9>=_0x20790a){_0x23c6e9=_0x20790a;_0x153cc7=0xc8;}else{_0x153cc7=0xce;}_0x1e5156[_0x24a9('0x1a')](_0x153cc7);return _0x1e5156[_0x24a9('0x20')](_0x24a9('0x21'),_0x3b954b+'-'+_0x23c6e9+'/'+_0x20790a)['json'](_0x41ef3f);}return null;};}function patchUpdates(_0xd26265){return function(_0x27b2f9){try{jsonpatch[_0x24a9('0x22')](_0x27b2f9,_0xd26265,!![]);}catch(_0x2aca0c){return BPromise[_0x24a9('0x23')](_0x2aca0c);}return _0x27b2f9[_0x24a9('0x24')]();};}function saveUpdates(_0x45a227,_0x1d279b){return function(_0x439149){if(_0x439149){return _0x439149['update'](_0x45a227)[_0x24a9('0x25')](function(_0x4563a9){return _0x4563a9;});}return null;};}function removeEntity(_0x3a2c36,_0x5aa908){return function(_0x5627ef){if(_0x5627ef){return _0x5627ef[_0x24a9('0x26')]()[_0x24a9('0x25')](function(){var _0x50d5db=_0x5627ef[_0x24a9('0x27')]({'plain':!![]});var _0x4a4b3c=_0x24a9('0x28');return db[_0x24a9('0x29')][_0x24a9('0x26')]({'where':{'type':_0x4a4b3c,'resourceId':_0x50d5db['id']}})['then'](function(){return _0x5627ef;});})[_0x24a9('0x25')](function(){_0x3a2c36[_0x24a9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d835e,_0x4cbb56){return function(_0x12021a){if(!_0x12021a){_0x5d835e['sendStatus'](0x194);}return _0x12021a;};}function handleError(_0x1f851f,_0x1ea027){_0x1ea027=_0x1ea027||0x1f4;return function(_0x382bfc){logger[_0x24a9('0x2a')](_0x382bfc['stack']);if(_0x382bfc[_0x24a9('0x2b')]){delete _0x382bfc['name'];}_0x1f851f[_0x24a9('0x1a')](_0x1ea027)[_0x24a9('0x2c')](_0x382bfc);};}exports[_0x24a9('0x2d')]=function(_0x598638,_0x41b2fe){var _0x1bef87={},_0x4d70ce={},_0x1c8ac0={'count':0x0,'rows':[]};var _0x1034f7=_[_0x24a9('0x2e')](db[_0x24a9('0x2f')][_0x24a9('0x30')],function(_0x51e23e){return{'name':_0x51e23e[_0x24a9('0x31')],'type':_0x51e23e['type'][_0x24a9('0x32')]};});_0x4d70ce[_0x24a9('0x33')]=_[_0x24a9('0x2e')](_0x1034f7,'name');_0x4d70ce[_0x24a9('0x34')]=_['keys'](_0x598638[_0x24a9('0x34')]);_0x4d70ce['filters']=_[_0x24a9('0x35')](_0x4d70ce[_0x24a9('0x33')],_0x4d70ce[_0x24a9('0x34')]);_0x1bef87[_0x24a9('0x36')]=_[_0x24a9('0x35')](_0x4d70ce[_0x24a9('0x33')],qs[_0x24a9('0x37')](_0x598638[_0x24a9('0x34')][_0x24a9('0x37')]));_0x1bef87[_0x24a9('0x36')]=_0x1bef87[_0x24a9('0x36')][_0x24a9('0x38')]?_0x1bef87[_0x24a9('0x36')]:_0x4d70ce[_0x24a9('0x33')];if(!_0x598638[_0x24a9('0x34')]['hasOwnProperty'](_0x24a9('0x39'))){_0x1bef87[_0x24a9('0x1f')]=qs[_0x24a9('0x1f')](_0x598638['query']['limit']);_0x1bef87['offset']=qs[_0x24a9('0x1c')](_0x598638[_0x24a9('0x34')][_0x24a9('0x1c')]);}_0x1bef87[_0x24a9('0x3a')]=qs[_0x24a9('0x3b')](_0x598638[_0x24a9('0x34')][_0x24a9('0x3b')]);_0x1bef87[_0x24a9('0x3c')]=qs['filters'](_['pick'](_0x598638[_0x24a9('0x34')],_0x4d70ce[_0x24a9('0x3d')]),_0x1034f7);if(_0x598638[_0x24a9('0x34')]['filter']){_0x1bef87[_0x24a9('0x3c')]=_[_0x24a9('0x3e')](_0x1bef87[_0x24a9('0x3c')],{'$or':_[_0x24a9('0x2e')](_0x1034f7,function(_0x222b5e){if(_0x222b5e[_0x24a9('0x3f')]!==_0x24a9('0x40')){var _0x108fa6={};_0x108fa6[_0x222b5e['name']]={'$like':'%'+_0x598638[_0x24a9('0x34')]['filter']+'%'};return _0x108fa6;}})});}_0x1bef87=_['merge']({},_0x1bef87,_0x598638['options']);var _0x49d82b={'where':_0x1bef87[_0x24a9('0x3c')]};return db[_0x24a9('0x2f')][_0x24a9('0x1e')](_0x49d82b)[_0x24a9('0x25')](function(_0x425130){_0x1c8ac0[_0x24a9('0x1e')]=_0x425130;if(_0x598638[_0x24a9('0x34')][_0x24a9('0x41')]){_0x1bef87['include']=[{'all':!![]}];}return db[_0x24a9('0x2f')]['findAll'](_0x1bef87);})[_0x24a9('0x25')](function(_0x20b3c2){_0x1c8ac0[_0x24a9('0x42')]=_0x20b3c2;return _0x1c8ac0;})[_0x24a9('0x25')](respondWithFilteredResult(_0x41b2fe,_0x1bef87))['catch'](handleError(_0x41b2fe,null));};exports[_0x24a9('0x43')]=function(_0x34a268,_0x23ecc9){var _0x5c9cb2={'raw':!![],'where':{'id':_0x34a268[_0x24a9('0x44')]['id']}},_0x2dd0ea={};_0x2dd0ea[_0x24a9('0x33')]=_['keys'](db[_0x24a9('0x2f')][_0x24a9('0x30')]);_0x2dd0ea[_0x24a9('0x34')]=_[_0x24a9('0x45')](_0x34a268[_0x24a9('0x34')]);_0x2dd0ea[_0x24a9('0x3d')]=_['intersection'](_0x2dd0ea[_0x24a9('0x33')],_0x2dd0ea[_0x24a9('0x34')]);_0x5c9cb2[_0x24a9('0x36')]=_[_0x24a9('0x35')](_0x2dd0ea[_0x24a9('0x33')],qs['fields'](_0x34a268[_0x24a9('0x34')][_0x24a9('0x37')]));_0x5c9cb2[_0x24a9('0x36')]=_0x5c9cb2['attributes'][_0x24a9('0x38')]?_0x5c9cb2[_0x24a9('0x36')]:_0x2dd0ea[_0x24a9('0x33')];if(_0x34a268[_0x24a9('0x34')]['includeAll']){_0x5c9cb2['include']=[{'all':!![]}];}_0x5c9cb2=_[_0x24a9('0x3e')]({},_0x5c9cb2,_0x34a268[_0x24a9('0x46')]);return db[_0x24a9('0x2f')][_0x24a9('0x47')](_0x5c9cb2)[_0x24a9('0x25')](handleEntityNotFound(_0x23ecc9,null))[_0x24a9('0x25')](respondWithResult(_0x23ecc9,null))[_0x24a9('0x48')](handleError(_0x23ecc9,null));};exports[_0x24a9('0x49')]=function(_0x1abbd2,_0x124d52){return db['SquareOdbc'][_0x24a9('0x49')](_0x1abbd2[_0x24a9('0x4a')],{})[_0x24a9('0x25')](function(_0x4c8ead){var _0x25dee1=_0x1abbd2['user'][_0x24a9('0x27')]({'plain':!![]});if(!_0x25dee1)throw new Error(_0x24a9('0x4b'));if(_0x25dee1['role']===_0x24a9('0x4c')){var _0x11d587=_0x4c8ead[_0x24a9('0x27')]({'plain':!![]});var _0x3f8ffa='ODBC';return db['UserProfileSection'][_0x24a9('0x47')]({'where':{'name':_0x3f8ffa,'userProfileId':_0x25dee1[_0x24a9('0x4d')]},'raw':!![]})['then'](function(_0x43f886){if(_0x43f886&&_0x43f886[_0x24a9('0x4e')]===0x0){return db['UserProfileResource'][_0x24a9('0x49')]({'name':_0x11d587[_0x24a9('0x2b')],'resourceId':_0x11d587['id'],'type':_0x43f886[_0x24a9('0x2b')],'sectionId':_0x43f886['id']},{})['then'](function(){return _0x4c8ead;});}else{return _0x4c8ead;}})['catch'](function(_0x44e80d){logger[_0x24a9('0x2a')](_0x24a9('0x4f'),_0x44e80d);throw _0x44e80d;});}return _0x4c8ead;})['then'](respondWithResult(_0x124d52,0xc9))[_0x24a9('0x48')](handleError(_0x124d52,null));};exports[_0x24a9('0x50')]=function(_0x1a5bba,_0x2d8c7b){if(_0x1a5bba[_0x24a9('0x4a')]['id']){delete _0x1a5bba[_0x24a9('0x4a')]['id'];}return db['SquareOdbc'][_0x24a9('0x47')]({'where':{'id':_0x1a5bba[_0x24a9('0x44')]['id']}})[_0x24a9('0x25')](handleEntityNotFound(_0x2d8c7b,null))[_0x24a9('0x25')](saveUpdates(_0x1a5bba[_0x24a9('0x4a')],null))[_0x24a9('0x25')](respondWithResult(_0x2d8c7b,null))['catch'](handleError(_0x2d8c7b,null));};exports['destroy']=function(_0xe57807,_0x1bde32){return db[_0x24a9('0x2f')][_0x24a9('0x47')]({'where':{'id':_0xe57807[_0x24a9('0x44')]['id']}})[_0x24a9('0x25')](handleEntityNotFound(_0x1bde32,null))[_0x24a9('0x25')](removeEntity(_0x1bde32,null))['catch'](handleError(_0x1bde32,null));};exports[_0x24a9('0x51')]=function(_0x4a9a8e,_0xb83642,_0x4c07ee){var _0x8be54d;return db['SquareOdbc'][_0x24a9('0x47')]({'where':{'id':_0x4a9a8e[_0x24a9('0x44')]['id']},'attributes':['id','dsn']})[_0x24a9('0x25')](handleEntityNotFound(_0xb83642,null))[_0x24a9('0x25')](function(_0x5a76cf){if(_0x5a76cf){var _0xd30fab=require(_0x24a9('0x52'))();_0xd30fab['openSync'](_0x5a76cf[_0x24a9('0x53')]);_0xd30fab[_0x24a9('0x54')]();return _0x5a76cf;}})[_0x24a9('0x25')](respondWithResult(_0xb83642,null))[_0x24a9('0x48')](handleError(_0xb83642,null));}; \ No newline at end of file +var _0x5db4=['sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5db4,0x197));var _0x45db=function(_0x15447d,_0x19d97c){_0x15447d=_0x15447d-0x0;var _0x4cc882=_0x5db4[_0x15447d];return _0x4cc882;};'use strict';var emlformat=require(_0x45db('0x0'));var rimraf=require(_0x45db('0x1'));var zipdir=require(_0x45db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45db('0x3'));var moment=require(_0x45db('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x45db('0x5'));var util=require(_0x45db('0x6'));var path=require(_0x45db('0x7'));var sox=require('sox');var csv=require(_0x45db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x45db('0x9'));var _=require(_0x45db('0xa'));var squel=require(_0x45db('0xb'));var crypto=require('crypto');var jsforce=require(_0x45db('0xc'));var deskjs=require(_0x45db('0xd'));var toCsv=require(_0x45db('0x8'));var querystring=require(_0x45db('0xe'));var Papa=require(_0x45db('0xf'));var Redis=require('ioredis');var authService=require(_0x45db('0x10'));var qs=require(_0x45db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45db('0x12'));var logger=require('../../config/logger')(_0x45db('0x13'));var utils=require('../../config/utils');var config=require(_0x45db('0x14'));var licenseUtil=require(_0x45db('0x15'));var db=require(_0x45db('0x16'))['db'];function respondWithStatusCode(_0x498b4a,_0x3f3496){_0x3f3496=_0x3f3496||0xcc;return function(_0x33ff0a){if(_0x33ff0a){return _0x498b4a[_0x45db('0x17')](_0x3f3496);}return _0x498b4a[_0x45db('0x18')](_0x3f3496)['end']();};}function respondWithResult(_0x4c8b53,_0x5f39c6){_0x5f39c6=_0x5f39c6||0xc8;return function(_0x5b7661){if(_0x5b7661){return _0x4c8b53[_0x45db('0x18')](_0x5f39c6)[_0x45db('0x19')](_0x5b7661);}};}function respondWithFilteredResult(_0x27cc1,_0x18a331){return function(_0x5c4936){if(_0x5c4936){var _0x4d4527=typeof _0x18a331['offset']===_0x45db('0x1a')&&typeof _0x18a331[_0x45db('0x1b')]===_0x45db('0x1a');var _0x298d63=_0x5c4936[_0x45db('0x1c')];var _0x1accc2=_0x4d4527?0x0:_0x18a331[_0x45db('0x1d')];var _0x115f56=_0x4d4527?_0x5c4936[_0x45db('0x1c')]:_0x18a331[_0x45db('0x1d')]+_0x18a331['limit'];var _0x1ecfdc;if(_0x115f56>=_0x298d63){_0x115f56=_0x298d63;_0x1ecfdc=0xc8;}else{_0x1ecfdc=0xce;}_0x27cc1['status'](_0x1ecfdc);return _0x27cc1[_0x45db('0x1e')](_0x45db('0x1f'),_0x1accc2+'-'+_0x115f56+'/'+_0x298d63)[_0x45db('0x19')](_0x5c4936);}return null;};}function patchUpdates(_0x3954b3){return function(_0x3d2a82){try{jsonpatch[_0x45db('0x20')](_0x3d2a82,_0x3954b3,!![]);}catch(_0x1418df){return BPromise[_0x45db('0x21')](_0x1418df);}return _0x3d2a82[_0x45db('0x22')]();};}function saveUpdates(_0x4559fc,_0xbeec9b){return function(_0x59e1c3){if(_0x59e1c3){return _0x59e1c3[_0x45db('0x23')](_0x4559fc)['then'](function(_0xb14d90){return _0xb14d90;});}return null;};}function removeEntity(_0x1c66d1,_0x5e924f){return function(_0x47ecc7){if(_0x47ecc7){return _0x47ecc7[_0x45db('0x24')]()[_0x45db('0x25')](function(){var _0x3a583b=_0x47ecc7[_0x45db('0x26')]({'plain':!![]});var _0x54cdf1=_0x45db('0x27');return db[_0x45db('0x28')][_0x45db('0x24')]({'where':{'type':_0x54cdf1,'resourceId':_0x3a583b['id']}})['then'](function(){return _0x47ecc7;});})[_0x45db('0x25')](function(){_0x1c66d1[_0x45db('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c8885,_0x51ed23){return function(_0x846d91){if(!_0x846d91){_0x1c8885[_0x45db('0x17')](0x194);}return _0x846d91;};}function handleError(_0x6aa570,_0x237740){_0x237740=_0x237740||0x1f4;return function(_0x5a88c2){logger[_0x45db('0x29')](_0x5a88c2[_0x45db('0x2a')]);if(_0x5a88c2['name']){delete _0x5a88c2[_0x45db('0x2b')];}_0x6aa570[_0x45db('0x18')](_0x237740)[_0x45db('0x2c')](_0x5a88c2);};}exports[_0x45db('0x2d')]=function(_0x5bbc7e,_0x42f020){var _0x46e3e3={},_0x357ce4={},_0x5bed6b={'count':0x0,'rows':[]};var _0x2b7c24=_[_0x45db('0x2e')](db[_0x45db('0x2f')][_0x45db('0x30')],function(_0x320659){return{'name':_0x320659[_0x45db('0x31')],'type':_0x320659[_0x45db('0x32')]['key']};});_0x357ce4[_0x45db('0x33')]=_[_0x45db('0x2e')](_0x2b7c24,_0x45db('0x2b'));_0x357ce4[_0x45db('0x34')]=_[_0x45db('0x35')](_0x5bbc7e[_0x45db('0x34')]);_0x357ce4[_0x45db('0x36')]=_[_0x45db('0x37')](_0x357ce4[_0x45db('0x33')],_0x357ce4[_0x45db('0x34')]);_0x46e3e3[_0x45db('0x38')]=_[_0x45db('0x37')](_0x357ce4[_0x45db('0x33')],qs['fields'](_0x5bbc7e[_0x45db('0x34')][_0x45db('0x39')]));_0x46e3e3[_0x45db('0x38')]=_0x46e3e3[_0x45db('0x38')][_0x45db('0x3a')]?_0x46e3e3[_0x45db('0x38')]:_0x357ce4['model'];if(!_0x5bbc7e[_0x45db('0x34')]['hasOwnProperty'](_0x45db('0x3b'))){_0x46e3e3[_0x45db('0x1b')]=qs[_0x45db('0x1b')](_0x5bbc7e[_0x45db('0x34')]['limit']);_0x46e3e3['offset']=qs[_0x45db('0x1d')](_0x5bbc7e['query']['offset']);}_0x46e3e3[_0x45db('0x3c')]=qs['sort'](_0x5bbc7e[_0x45db('0x34')][_0x45db('0x3d')]);_0x46e3e3[_0x45db('0x3e')]=qs[_0x45db('0x36')](_['pick'](_0x5bbc7e[_0x45db('0x34')],_0x357ce4[_0x45db('0x36')]),_0x2b7c24);if(_0x5bbc7e[_0x45db('0x34')][_0x45db('0x3f')]){_0x46e3e3[_0x45db('0x3e')]=_[_0x45db('0x40')](_0x46e3e3[_0x45db('0x3e')],{'$or':_[_0x45db('0x2e')](_0x2b7c24,function(_0x3e71c2){if(_0x3e71c2[_0x45db('0x32')]!==_0x45db('0x41')){var _0x382b2c={};_0x382b2c[_0x3e71c2[_0x45db('0x2b')]]={'$like':'%'+_0x5bbc7e[_0x45db('0x34')][_0x45db('0x3f')]+'%'};return _0x382b2c;}})});}_0x46e3e3=_[_0x45db('0x40')]({},_0x46e3e3,_0x5bbc7e[_0x45db('0x42')]);var _0xc0b963={'where':_0x46e3e3[_0x45db('0x3e')]};return db['SquareOdbc'][_0x45db('0x1c')](_0xc0b963)[_0x45db('0x25')](function(_0x35b8a4){_0x5bed6b[_0x45db('0x1c')]=_0x35b8a4;if(_0x5bbc7e[_0x45db('0x34')]['includeAll']){_0x46e3e3[_0x45db('0x43')]=[{'all':!![]}];}return db[_0x45db('0x2f')][_0x45db('0x44')](_0x46e3e3);})[_0x45db('0x25')](function(_0x551c30){_0x5bed6b[_0x45db('0x45')]=_0x551c30;return _0x5bed6b;})['then'](respondWithFilteredResult(_0x42f020,_0x46e3e3))[_0x45db('0x46')](handleError(_0x42f020,null));};exports['show']=function(_0x1f5459,_0x46a4db){var _0x3fe5ad={'raw':!![],'where':{'id':_0x1f5459['params']['id']}},_0x472217={};_0x472217[_0x45db('0x33')]=_[_0x45db('0x35')](db['SquareOdbc'][_0x45db('0x30')]);_0x472217['query']=_[_0x45db('0x35')](_0x1f5459[_0x45db('0x34')]);_0x472217[_0x45db('0x36')]=_['intersection'](_0x472217[_0x45db('0x33')],_0x472217[_0x45db('0x34')]);_0x3fe5ad['attributes']=_[_0x45db('0x37')](_0x472217['model'],qs[_0x45db('0x39')](_0x1f5459['query'][_0x45db('0x39')]));_0x3fe5ad[_0x45db('0x38')]=_0x3fe5ad[_0x45db('0x38')][_0x45db('0x3a')]?_0x3fe5ad[_0x45db('0x38')]:_0x472217[_0x45db('0x33')];if(_0x1f5459[_0x45db('0x34')][_0x45db('0x47')]){_0x3fe5ad[_0x45db('0x43')]=[{'all':!![]}];}_0x3fe5ad=_[_0x45db('0x40')]({},_0x3fe5ad,_0x1f5459[_0x45db('0x42')]);return db[_0x45db('0x2f')][_0x45db('0x48')](_0x3fe5ad)['then'](handleEntityNotFound(_0x46a4db,null))[_0x45db('0x25')](respondWithResult(_0x46a4db,null))['catch'](handleError(_0x46a4db,null));};exports[_0x45db('0x49')]=function(_0x576726,_0x5b7633){return db[_0x45db('0x2f')][_0x45db('0x49')](_0x576726['body'],{})[_0x45db('0x25')](function(_0x4d82fa){var _0x4028f6=_0x576726[_0x45db('0x4a')][_0x45db('0x26')]({'plain':!![]});if(!_0x4028f6)throw new Error(_0x45db('0x4b'));if(_0x4028f6['role']==='user'){var _0x23120e=_0x4d82fa['get']({'plain':!![]});var _0x2156e8='ODBC';return db[_0x45db('0x4c')][_0x45db('0x48')]({'where':{'name':_0x2156e8,'userProfileId':_0x4028f6[_0x45db('0x4d')]},'raw':!![]})['then'](function(_0x1c7381){if(_0x1c7381&&_0x1c7381['autoAssociation']===0x0){return db[_0x45db('0x28')][_0x45db('0x49')]({'name':_0x23120e[_0x45db('0x2b')],'resourceId':_0x23120e['id'],'type':_0x1c7381[_0x45db('0x2b')],'sectionId':_0x1c7381['id']},{})['then'](function(){return _0x4d82fa;});}else{return _0x4d82fa;}})['catch'](function(_0x4330b4){logger['error'](_0x45db('0x4e'),_0x4330b4);throw _0x4330b4;});}return _0x4d82fa;})[_0x45db('0x25')](respondWithResult(_0x5b7633,0xc9))[_0x45db('0x46')](handleError(_0x5b7633,null));};exports['update']=function(_0x1a665d,_0xe82099){if(_0x1a665d[_0x45db('0x4f')]['id']){delete _0x1a665d['body']['id'];}return db[_0x45db('0x2f')][_0x45db('0x48')]({'where':{'id':_0x1a665d[_0x45db('0x50')]['id']}})['then'](handleEntityNotFound(_0xe82099,null))[_0x45db('0x25')](saveUpdates(_0x1a665d[_0x45db('0x4f')],null))[_0x45db('0x25')](respondWithResult(_0xe82099,null))[_0x45db('0x46')](handleError(_0xe82099,null));};exports[_0x45db('0x24')]=function(_0x5944ea,_0x896dba){return db[_0x45db('0x2f')][_0x45db('0x48')]({'where':{'id':_0x5944ea[_0x45db('0x50')]['id']}})[_0x45db('0x25')](handleEntityNotFound(_0x896dba,null))[_0x45db('0x25')](removeEntity(_0x896dba,null))[_0x45db('0x46')](handleError(_0x896dba,null));};exports[_0x45db('0x51')]=function(_0x4349c1,_0x5cbbc1,_0x5495da){var _0x26b6c0;return db[_0x45db('0x2f')][_0x45db('0x48')]({'where':{'id':_0x4349c1[_0x45db('0x50')]['id']},'attributes':['id',_0x45db('0x52')]})[_0x45db('0x25')](handleEntityNotFound(_0x5cbbc1,null))['then'](function(_0x4dbdd4){if(_0x4dbdd4){var _0xae19e3=require(_0x45db('0x53'))();_0xae19e3[_0x45db('0x54')](_0x4dbdd4[_0x45db('0x52')]);_0xae19e3[_0x45db('0x55')]();return _0x4dbdd4;}})['then'](respondWithResult(_0x5cbbc1,null))[_0x45db('0x46')](handleError(_0x5cbbc1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3457225..471bac7 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 _0x3210=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x5ce5f2,_0x39548b){var _0x5f2c0b=function(_0x697efb){while(--_0x697efb){_0x5ce5f2['push'](_0x5ce5f2['shift']());}};_0x5f2c0b(++_0x39548b);}(_0x3210,0x19e));var _0x0321=function(_0x26d04c,_0x5930f6){_0x26d04c=_0x26d04c-0x0;var _0x2dc062=_0x3210[_0x26d04c];return _0x2dc062;};'use strict';var _=require(_0x0321('0x0'));var util=require('util');var logger=require(_0x0321('0x1'))(_0x0321('0x2'));var moment=require('moment');var BPromise=require(_0x0321('0x3'));var rp=require(_0x0321('0x4'));var fs=require('fs');var path=require(_0x0321('0x5'));var rimraf=require('rimraf');var config=require(_0x0321('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x0321('0x7')]=function(_0x29290e,_0x14ecd8){return _0x29290e[_0x0321('0x8')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4d4=['request-promise','rimraf','../../config/environment','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x51252f,_0x51a2fd){var _0x54b853=function(_0x45ab03){while(--_0x45ab03){_0x51252f['push'](_0x51252f['shift']());}};_0x54b853(++_0x51a2fd);}(_0xf4d4,0xae));var _0x4f4d=function(_0x453f54,_0x28ebf2){_0x453f54=_0x453f54-0x0;var _0x46f6cc=_0xf4d4[_0x453f54];return _0x46f6cc;};'use strict';var _=require(_0x4f4d('0x0'));var util=require(_0x4f4d('0x1'));var logger=require(_0x4f4d('0x2'))(_0x4f4d('0x3'));var moment=require(_0x4f4d('0x4'));var BPromise=require(_0x4f4d('0x5'));var rp=require(_0x4f4d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f4d('0x7'));var config=require(_0x4f4d('0x8'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x136d5d,_0x44165a){return _0x136d5d[_0x4f4d('0x9')](_0x4f4d('0xa'),attributes,{'tableName':_0x4f4d('0xb'),'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 568beda..b90d908 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 _0x91e8=['map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include'];(function(_0x21ee77,_0x43b0c2){var _0x47ff4f=function(_0x3b27e6){while(--_0x3b27e6){_0x21ee77['push'](_0x21ee77['shift']());}};_0x47ff4f(++_0x43b0c2);}(_0x91e8,0x18f));var _0x891e=function(_0x512243,_0x515f84){_0x512243=_0x512243-0x0;var _0x2f5cae=_0x91e8[_0x512243];return _0x2f5cae;};'use strict';var _=require(_0x891e('0x0'));var util=require(_0x891e('0x1'));var moment=require('moment');var BPromise=require(_0x891e('0x2'));var rs=require(_0x891e('0x3'));var fs=require('fs');var Redis=require(_0x891e('0x4'));var db=require(_0x891e('0x5'))['db'];var utils=require(_0x891e('0x6'));var logger=require(_0x891e('0x7'))(_0x891e('0x8'));var config=require(_0x891e('0x9'));var jayson=require(_0x891e('0xa'));var client=jayson[_0x891e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2642cb,_0x3be112,_0x4ff446){return new BPromise(function(_0x4414b4,_0x2760e2){return client['request'](_0x2642cb,_0x4ff446)[_0x891e('0xc')](function(_0x1bafa3){logger[_0x891e('0xd')](_0x891e('0xe'),_0x3be112,_0x891e('0xf'));logger[_0x891e('0x10')](_0x891e('0x11'),_0x3be112,_0x891e('0xf'),JSON[_0x891e('0x12')](_0x1bafa3));if(_0x1bafa3[_0x891e('0x13')]){if(_0x1bafa3[_0x891e('0x13')][_0x891e('0x14')]===0x1f4){logger[_0x891e('0x13')](_0x891e('0xe'),_0x3be112,_0x1bafa3['error']['message']);return _0x2760e2(_0x1bafa3[_0x891e('0x13')][_0x891e('0x15')]);}logger['error'](_0x891e('0xe'),_0x3be112,_0x1bafa3[_0x891e('0x13')][_0x891e('0x15')]);return _0x4414b4(_0x1bafa3[_0x891e('0x13')][_0x891e('0x15')]);}else{logger[_0x891e('0xd')](_0x891e('0xe'),_0x3be112,_0x891e('0xf'));_0x4414b4(_0x1bafa3[_0x891e('0x16')]['message']);}})['catch'](function(_0x44cfa8){logger['error'](_0x891e('0xe'),_0x3be112,_0x44cfa8);_0x2760e2(_0x44cfa8);});});}exports[_0x891e('0x17')]=function(_0x24261d){var _0x13e124=this;return new Promise(function(_0x3cfb4a,_0x5dc587){return db[_0x891e('0x18')][_0x891e('0x19')]({'raw':_0x24261d['options']?_0x24261d[_0x891e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24261d[_0x891e('0x1a')]?_0x24261d[_0x891e('0x1a')][_0x891e('0x1b')]||null:null,'attributes':_0x24261d[_0x891e('0x1a')]?_0x24261d[_0x891e('0x1a')][_0x891e('0x1c')]||null:null,'include':_0x24261d['options']?_0x24261d[_0x891e('0x1a')][_0x891e('0x1d')]?_[_0x891e('0x1e')](_0x24261d[_0x891e('0x1a')][_0x891e('0x1d')],function(_0xf484b8){return{'model':db[_0xf484b8[_0x891e('0x1f')]],'as':_0xf484b8['as'],'attributes':_0xf484b8[_0x891e('0x1c')],'include':_0xf484b8[_0x891e('0x1d')]?_[_0x891e('0x1e')](_0xf484b8[_0x891e('0x1d')],function(_0x353ddb){return{'model':db[_0x353ddb['model']],'as':_0x353ddb['as'],'attributes':_0x353ddb[_0x891e('0x1c')],'include':_0x353ddb[_0x891e('0x1d')]?_['map'](_0x353ddb[_0x891e('0x1d')],function(_0x17516e){return{'model':db[_0x17516e['model']],'as':_0x17516e['as'],'attributes':_0x17516e[_0x891e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51c993){logger[_0x891e('0xd')](_0x891e('0x17'),_0x24261d);logger['debug'](_0x891e('0x17'),_0x24261d,JSON[_0x891e('0x12')](_0x51c993));_0x3cfb4a(_0x51c993);})[_0x891e('0x20')](function(_0x117f5f){logger[_0x891e('0x13')](_0x891e('0x17'),_0x117f5f[_0x891e('0x15')],_0x24261d);_0x5dc587(_0x13e124[_0x891e('0x13')](0x1f4,_0x117f5f[_0x891e('0x15')]));});});}; \ No newline at end of file +var _0x9fa2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model','attributes','then'];(function(_0x4859ff,_0x1b0362){var _0x446603=function(_0x4d81a8){while(--_0x4d81a8){_0x4859ff['push'](_0x4859ff['shift']());}};_0x446603(++_0x1b0362);}(_0x9fa2,0x120));var _0x29fa=function(_0x33be9d,_0x41618e){_0x33be9d=_0x33be9d-0x0;var _0x4a9267=_0x9fa2[_0x33be9d];return _0x4a9267;};'use strict';var _=require('lodash');var util=require(_0x29fa('0x0'));var moment=require(_0x29fa('0x1'));var BPromise=require(_0x29fa('0x2'));var rs=require(_0x29fa('0x3'));var fs=require('fs');var Redis=require(_0x29fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x29fa('0x5'));var logger=require('../../config/logger')(_0x29fa('0x6'));var config=require('../../config/environment');var jayson=require(_0x29fa('0x7'));var client=jayson[_0x29fa('0x8')][_0x29fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x147b99,_0x4c7293,_0x544a12){return new BPromise(function(_0x24900b,_0x1a8355){return client[_0x29fa('0xa')](_0x147b99,_0x544a12)['then'](function(_0x38732e){logger[_0x29fa('0xb')](_0x29fa('0xc'),_0x4c7293,_0x29fa('0xd'));logger[_0x29fa('0xe')](_0x29fa('0xf'),_0x4c7293,'request\x20sent',JSON[_0x29fa('0x10')](_0x38732e));if(_0x38732e[_0x29fa('0x11')]){if(_0x38732e[_0x29fa('0x11')][_0x29fa('0x12')]===0x1f4){logger['error'](_0x29fa('0xc'),_0x4c7293,_0x38732e['error'][_0x29fa('0x13')]);return _0x1a8355(_0x38732e[_0x29fa('0x11')][_0x29fa('0x13')]);}logger['error'](_0x29fa('0xc'),_0x4c7293,_0x38732e[_0x29fa('0x11')][_0x29fa('0x13')]);return _0x24900b(_0x38732e[_0x29fa('0x11')][_0x29fa('0x13')]);}else{logger[_0x29fa('0xb')](_0x29fa('0xc'),_0x4c7293,_0x29fa('0xd'));_0x24900b(_0x38732e['result'][_0x29fa('0x13')]);}})[_0x29fa('0x14')](function(_0x55be87){logger[_0x29fa('0x11')](_0x29fa('0xc'),_0x4c7293,_0x55be87);_0x1a8355(_0x55be87);});});}exports[_0x29fa('0x15')]=function(_0x5db485){var _0x107edc=this;return new Promise(function(_0x45af71,_0x32e214){return db[_0x29fa('0x16')][_0x29fa('0x17')]({'raw':_0x5db485[_0x29fa('0x18')]?_0x5db485[_0x29fa('0x18')][_0x29fa('0x19')]===undefined?!![]:![]:!![],'where':_0x5db485[_0x29fa('0x18')]?_0x5db485[_0x29fa('0x18')][_0x29fa('0x1a')]||null:null,'attributes':_0x5db485['options']?_0x5db485['options']['attributes']||null:null,'include':_0x5db485['options']?_0x5db485[_0x29fa('0x18')][_0x29fa('0x1b')]?_[_0x29fa('0x1c')](_0x5db485[_0x29fa('0x18')][_0x29fa('0x1b')],function(_0x160713){return{'model':db[_0x160713[_0x29fa('0x1d')]],'as':_0x160713['as'],'attributes':_0x160713[_0x29fa('0x1e')],'include':_0x160713['include']?_[_0x29fa('0x1c')](_0x160713[_0x29fa('0x1b')],function(_0x59e206){return{'model':db[_0x59e206[_0x29fa('0x1d')]],'as':_0x59e206['as'],'attributes':_0x59e206['attributes'],'include':_0x59e206[_0x29fa('0x1b')]?_[_0x29fa('0x1c')](_0x59e206[_0x29fa('0x1b')],function(_0x518522){return{'model':db[_0x518522[_0x29fa('0x1d')]],'as':_0x518522['as'],'attributes':_0x518522['attributes']};}):[]};}):[]};}):[]:[]})[_0x29fa('0x1f')](function(_0x5aa663){logger['info']('ShowSquareOdbc',_0x5db485);logger[_0x29fa('0xe')](_0x29fa('0x15'),_0x5db485,JSON[_0x29fa('0x10')](_0x5aa663));_0x45af71(_0x5aa663);})[_0x29fa('0x14')](function(_0x2090e5){logger[_0x29fa('0x11')](_0x29fa('0x15'),_0x2090e5[_0x29fa('0x13')],_0x5db485);_0x32e214(_0x107edc['error'](0x1f4,_0x2090e5[_0x29fa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 69ac740..03cdcd2 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 _0x964b=['index','get','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','./squareProject.controller','isAuthenticated'];(function(_0x1d0213,_0x179020){var _0x59527a=function(_0x50786e){while(--_0x50786e){_0x1d0213['push'](_0x1d0213['shift']());}};_0x59527a(++_0x179020);}(_0x964b,0x80));var _0xb964=function(_0xf673bf,_0x130427){_0xf673bf=_0xf673bf-0x0;var _0x403314=_0x964b[_0xf673bf];return _0x403314;};'use strict';var multer=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var path=require(_0xb964('0x2'));var timeout=require(_0xb964('0x3'));var express=require('express');var router=express[_0xb964('0x4')]();var fs_extra=require(_0xb964('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb964('0x6'));router['get']('/',auth[_0xb964('0x7')](),controller[_0xb964('0x8')]);router[_0xb964('0x9')]('/:id',auth[_0xb964('0x7')](),controller['show']);router[_0xb964('0xa')]('/',auth[_0xb964('0x7')](),controller[_0xb964('0xb')]);router[_0xb964('0xc')](_0xb964('0xd'),auth[_0xb964('0x7')](),controller[_0xb964('0xe')]);router[_0xb964('0xf')]('/:id',auth[_0xb964('0x7')](),controller['destroy']);module[_0xb964('0x10')]=router; \ No newline at end of file +var _0xd157=['post','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x346fd9,_0x105fa8){var _0xa84be=function(_0x14ab15){while(--_0x14ab15){_0x346fd9['push'](_0x346fd9['shift']());}};_0xa84be(++_0x105fa8);}(_0xd157,0x1af));var _0x7d15=function(_0x544419,_0x37287e){_0x544419=_0x544419-0x0;var _0x328b19=_0xd157[_0x544419];return _0x328b19;};'use strict';var multer=require(_0x7d15('0x0'));var util=require('util');var path=require(_0x7d15('0x1'));var timeout=require(_0x7d15('0x2'));var express=require('express');var router=express[_0x7d15('0x3')]();var fs_extra=require(_0x7d15('0x4'));var auth=require(_0x7d15('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7d15('0x6'));var controller=require('./squareProject.controller');router[_0x7d15('0x7')]('/',auth[_0x7d15('0x8')](),controller[_0x7d15('0x9')]);router[_0x7d15('0x7')](_0x7d15('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7d15('0xb')]('/',auth[_0x7d15('0x8')](),controller[_0x7d15('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7d15('0xd')]);router[_0x7d15('0xe')](_0x7d15('0xa'),auth[_0x7d15('0x8')](),controller[_0x7d15('0xf')]);module[_0x7d15('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 493d497..4902894 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 _0x0ab3=['BLOB','production','DATE','exports','STRING','name','long','getDataValue','preproduction','toString'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x0ab3,0x111));var _0x30ab=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0ab3[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module[_0x30ab('0x0')]={'name':{'type':Sequelize[_0x30ab('0x1')],'unique':_0x30ab('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x30ab('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x30ab('0x3')),'get':function(){if(this[_0x30ab('0x4')]('preproduction')){return this[_0x30ab('0x4')](_0x30ab('0x5'))[_0x30ab('0x6')]('utf8');}}},'production':{'type':Sequelize[_0x30ab('0x7')](_0x30ab('0x3')),'get':function(){if(this[_0x30ab('0x4')](_0x30ab('0x8'))){return this[_0x30ab('0x4')]('production')[_0x30ab('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0x30ab('0x9')]},'publishedAt':{'type':Sequelize[_0x30ab('0x9')]}}; \ No newline at end of file +var _0x8014=['production','toString','DATE','sequelize','STRING','name','BLOB','long','getDataValue','preproduction','utf8'];(function(_0x1f9ca4,_0x3276ff){var _0xfedbdd=function(_0x2da635){while(--_0x2da635){_0x1f9ca4['push'](_0x1f9ca4['shift']());}};_0xfedbdd(++_0x3276ff);}(_0x8014,0x163));var _0x4801=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x8014[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0x4801('0x0'));module['exports']={'name':{'type':Sequelize[_0x4801('0x1')],'unique':_0x4801('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4801('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x4801('0x3')](_0x4801('0x4')),'get':function(){if(this[_0x4801('0x5')](_0x4801('0x6'))){return this['getDataValue'](_0x4801('0x6'))['toString'](_0x4801('0x7'));}}},'production':{'type':Sequelize[_0x4801('0x3')]('long'),'get':function(){if(this[_0x4801('0x5')](_0x4801('0x8'))){return this[_0x4801('0x5')](_0x4801('0x8'))[_0x4801('0x9')](_0x4801('0x7'));}}},'savedAt':{'type':Sequelize[_0x4801('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index e8ad8ee..add9086 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 _0x3601=['index','map','SquareProject','rawAttributes','fieldName','model','name','keys','intersection','fields','query','attributes','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./squareProject.socket','register','status','offset','limit','undefined','count','Content-Range','json','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','send'];(function(_0x59ff11,_0x12f8bd){var _0x232a60=function(_0x1e0bdb){while(--_0x1e0bdb){_0x59ff11['push'](_0x59ff11['shift']());}};_0x232a60(++_0x12f8bd);}(_0x3601,0x6c));var _0x1360=function(_0x2f992e,_0x2c859d){_0x2f992e=_0x2f992e-0x0;var _0xf4f26=_0x3601[_0x2f992e];return _0xf4f26;};'use strict';var _=require(_0x1360('0x0'));var Redis=require(_0x1360('0x1'));var qs=require(_0x1360('0x2'));var logger=require(_0x1360('0x3'))(_0x1360('0x4'));var config=require(_0x1360('0x5'));var db=require(_0x1360('0x6'))['db'];config['redis']=_[_0x1360('0x7')](config[_0x1360('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1360('0x9'))(new Redis(config[_0x1360('0x8')]));require(_0x1360('0xa'))[_0x1360('0xb')](socket);function respondWithResult(_0x59d074,_0x5c0af2){_0x5c0af2=_0x5c0af2||0xc8;return function(_0x4b205d){if(_0x4b205d){return _0x59d074[_0x1360('0xc')](_0x5c0af2)['json'](_0x4b205d);}};}function respondWithFilteredResult(_0x26a9d7,_0x3181c1){return function(_0x1c8fdf){if(_0x1c8fdf){var _0x5d954f=typeof _0x3181c1[_0x1360('0xd')]==='undefined'&&typeof _0x3181c1[_0x1360('0xe')]===_0x1360('0xf');var _0x2caac9=_0x1c8fdf['count'];var _0x358163=_0x5d954f?0x0:_0x3181c1[_0x1360('0xd')];var _0x1646ed=_0x5d954f?_0x1c8fdf[_0x1360('0x10')]:_0x3181c1[_0x1360('0xd')]+_0x3181c1[_0x1360('0xe')];var _0x1cdc55;if(_0x1646ed>=_0x2caac9){_0x1646ed=_0x2caac9;_0x1cdc55=0xc8;}else{_0x1cdc55=0xce;}_0x26a9d7['status'](_0x1cdc55);return _0x26a9d7['set'](_0x1360('0x11'),_0x358163+'-'+_0x1646ed+'/'+_0x2caac9)[_0x1360('0x12')](_0x1c8fdf);}return null;};}function saveUpdates(_0x377b8c){return function(_0x4422ba){if(_0x4422ba){return _0x4422ba['update'](_0x377b8c)[_0x1360('0x13')](function(_0x4079ff){return _0x4079ff;});}return null;};}function removeEntity(_0x544503){return function(_0x1137d4){if(_0x1137d4){return _0x1137d4[_0x1360('0x14')]()['then'](function(){var _0x471eb1=_0x1137d4[_0x1360('0x15')]({'plain':!![]});var _0x10a130=_0x1360('0x16');return db[_0x1360('0x17')][_0x1360('0x14')]({'where':{'type':_0x10a130,'resourceId':_0x471eb1['id']}})['then'](function(){return _0x1137d4;});})[_0x1360('0x13')](function(){var _0x405c57=new Redis(config[_0x1360('0x8')]);_0x405c57[_0x1360('0x18')](_0x1360('0x19'),JSON[_0x1360('0x1a')]({'id':_0x1137d4['id'],'deleted':!![]}));})[_0x1360('0x13')](function(){_0x544503[_0x1360('0xc')](0xcc)[_0x1360('0x1b')]();});}};}function handleEntityNotFound(_0x2520a8){return function(_0x363c11){if(!_0x363c11){_0x2520a8[_0x1360('0x1c')](0x194);}return _0x363c11;};}function handleError(_0x627a75,_0x2f0c30){_0x2f0c30=_0x2f0c30||0x1f4;return function(_0x231fc7){logger['error'](_0x231fc7['stack']);if(_0x231fc7['name']){delete _0x231fc7['name'];}_0x627a75[_0x1360('0xc')](_0x2f0c30)[_0x1360('0x1d')](_0x231fc7);};}exports[_0x1360('0x1e')]=function(_0x377177,_0x52ad4c){var _0x523efa={},_0x4317fa={},_0xa83e8d={'count':0x0,'rows':[]};var _0x124f96=_[_0x1360('0x1f')](db[_0x1360('0x20')][_0x1360('0x21')],function(_0x274d23){return{'name':_0x274d23[_0x1360('0x22')],'type':_0x274d23['type']['key']};});_0x4317fa[_0x1360('0x23')]=_['map'](_0x124f96,_0x1360('0x24'));_0x4317fa['query']=_[_0x1360('0x25')](_0x377177['query']);_0x4317fa['filters']=_[_0x1360('0x26')](_0x4317fa[_0x1360('0x23')],_0x4317fa['query']);_0x523efa['attributes']=_[_0x1360('0x26')](_0x4317fa[_0x1360('0x23')],qs[_0x1360('0x27')](_0x377177[_0x1360('0x28')][_0x1360('0x27')]));_0x523efa['attributes']=_0x523efa[_0x1360('0x29')]['length']?_0x523efa[_0x1360('0x29')]:_0x4317fa[_0x1360('0x23')];if(!_0x377177[_0x1360('0x28')][_0x1360('0x2a')]('nolimit')){_0x523efa['limit']=qs[_0x1360('0xe')](_0x377177[_0x1360('0x28')][_0x1360('0xe')]);_0x523efa[_0x1360('0xd')]=qs[_0x1360('0xd')](_0x377177[_0x1360('0x28')][_0x1360('0xd')]);}_0x523efa[_0x1360('0x2b')]=qs[_0x1360('0x2c')](_0x377177[_0x1360('0x28')][_0x1360('0x2c')]);_0x523efa['where']=qs['filters'](_[_0x1360('0x2d')](_0x377177[_0x1360('0x28')],_0x4317fa[_0x1360('0x2e')]),_0x124f96);if(_0x377177[_0x1360('0x28')][_0x1360('0x2f')]){_0x523efa[_0x1360('0x30')]=_[_0x1360('0x31')](_0x523efa[_0x1360('0x30')],{'$or':_['map'](_0x124f96,function(_0x54c6ba){if(_0x54c6ba['type']!==_0x1360('0x32')){var _0x42bb9b={};_0x42bb9b[_0x54c6ba[_0x1360('0x24')]]={'$like':'%'+_0x377177[_0x1360('0x28')][_0x1360('0x2f')]+'%'};return _0x42bb9b;}})});}_0x523efa=_[_0x1360('0x31')]({},_0x523efa,_0x377177['options']);var _0x25371c={'where':_0x523efa['where']};return db[_0x1360('0x20')][_0x1360('0x10')](_0x25371c)[_0x1360('0x13')](function(_0x29ff45){_0xa83e8d['count']=_0x29ff45;if(_0x377177[_0x1360('0x28')][_0x1360('0x33')]){_0x523efa[_0x1360('0x34')]=[{'all':!![]}];}return db[_0x1360('0x20')][_0x1360('0x35')](_0x523efa);})[_0x1360('0x13')](function(_0x2232a3){_0xa83e8d[_0x1360('0x36')]=_0x2232a3;return _0xa83e8d;})[_0x1360('0x13')](respondWithFilteredResult(_0x52ad4c,_0x523efa))[_0x1360('0x37')](handleError(_0x52ad4c,null));};exports[_0x1360('0x38')]=function(_0x3638af,_0x179977){var _0x12fc62={'raw':![],'where':{'id':_0x3638af[_0x1360('0x39')]['id']}},_0x3852f3={};_0x3852f3[_0x1360('0x23')]=_[_0x1360('0x25')](db['SquareProject'][_0x1360('0x21')]);_0x3852f3[_0x1360('0x28')]=_[_0x1360('0x25')](_0x3638af['query']);_0x3852f3[_0x1360('0x2e')]=_[_0x1360('0x26')](_0x3852f3[_0x1360('0x23')],_0x3852f3[_0x1360('0x28')]);_0x12fc62[_0x1360('0x29')]=_[_0x1360('0x26')](_0x3852f3[_0x1360('0x23')],qs['fields'](_0x3638af[_0x1360('0x28')][_0x1360('0x27')]));_0x12fc62[_0x1360('0x29')]=_0x12fc62[_0x1360('0x29')][_0x1360('0x3a')]?_0x12fc62[_0x1360('0x29')]:_0x3852f3[_0x1360('0x23')];if(_0x3638af['query']['includeAll']){_0x12fc62[_0x1360('0x34')]=[{'all':!![]}];}_0x12fc62=_[_0x1360('0x31')]({},_0x12fc62,_0x3638af[_0x1360('0x3b')]);return db[_0x1360('0x20')][_0x1360('0x3c')](_0x12fc62)[_0x1360('0x13')](handleEntityNotFound(_0x179977,null))[_0x1360('0x13')](respondWithResult(_0x179977,null))[_0x1360('0x37')](handleError(_0x179977,null));};exports[_0x1360('0x3d')]=function(_0x393227,_0x4cb5cd){return db[_0x1360('0x20')][_0x1360('0x3d')](_0x393227['body'],{})[_0x1360('0x13')](function(_0x91a242){var _0x7f4ff6=_0x393227[_0x1360('0x3e')]['get']({'plain':!![]});if(!_0x7f4ff6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7f4ff6[_0x1360('0x3f')]===_0x1360('0x3e')){var _0x3227b3=_0x91a242[_0x1360('0x15')]({'plain':!![]});var _0x2fe0f0=_0x1360('0x16');return db['UserProfileSection']['find']({'where':{'name':_0x2fe0f0,'userProfileId':_0x7f4ff6[_0x1360('0x40')]},'raw':!![]})[_0x1360('0x13')](function(_0x3bc37b){if(_0x3bc37b&&_0x3bc37b[_0x1360('0x41')]===0x0){return db[_0x1360('0x17')]['create']({'name':_0x3227b3[_0x1360('0x24')],'resourceId':_0x3227b3['id'],'type':_0x3bc37b[_0x1360('0x24')],'sectionId':_0x3bc37b['id']},{})[_0x1360('0x13')](function(){return _0x91a242;});}else{return _0x91a242;}})['catch'](function(_0xea34cf){logger[_0x1360('0x42')](_0x1360('0x43'),_0xea34cf);throw _0xea34cf;});}return _0x91a242;})[_0x1360('0x13')](respondWithResult(_0x4cb5cd,0xc9))[_0x1360('0x37')](handleError(_0x4cb5cd,null));};exports['update']=function(_0x3569ab,_0x47e977){if(_0x3569ab[_0x1360('0x44')]['id']){delete _0x3569ab[_0x1360('0x44')]['id'];}return db['SquareProject'][_0x1360('0x3c')]({'where':{'id':_0x3569ab[_0x1360('0x39')]['id']}})[_0x1360('0x13')](handleEntityNotFound(_0x47e977,null))[_0x1360('0x13')](saveUpdates(_0x3569ab[_0x1360('0x44')],null))['then'](function(_0x4ccd6e){if(!_0x4ccd6e)return;var _0x5d1de4=_0x4ccd6e[_0x1360('0x15')]({'plain':!![]});return _0x5d1de4;})[_0x1360('0x13')](function(_0x19f6a6){var _0x506175=new Redis(config['redis']);_0x506175[_0x1360('0x18')](_0x1360('0x19'),JSON[_0x1360('0x1a')](_['pick'](_0x19f6a6,['id',_0x1360('0x24'),'production'])));return _0x19f6a6;})[_0x1360('0x13')](respondWithResult(_0x47e977,null))[_0x1360('0x37')](handleError(_0x47e977,null));};exports[_0x1360('0x14')]=function(_0x4da041,_0x43c4af){return db[_0x1360('0x20')][_0x1360('0x3c')]({'where':{'id':_0x4da041['params']['id']}})[_0x1360('0x13')](handleEntityNotFound(_0x43c4af,null))[_0x1360('0x13')](removeEntity(_0x43c4af,null))[_0x1360('0x37')](handleError(_0x43c4af,null));}; \ No newline at end of file +var _0xeccc=['stringify','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','limit','count','set','Content-Range','then','destroy','get','SquareProjects','publish','agi','end','sendStatus','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SquareProject','includeAll','include','findAll','rows','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','update','body'];(function(_0x202b44,_0x5addf7){var _0x12139d=function(_0x52f7a9){while(--_0x52f7a9){_0x202b44['push'](_0x202b44['shift']());}};_0x12139d(++_0x5addf7);}(_0xeccc,0xd6));var _0xcecc=function(_0x4f3242,_0x391954){_0x4f3242=_0x4f3242-0x0;var _0x49844f=_0xeccc[_0x4f3242];return _0x49844f;};'use strict';var _=require(_0xcecc('0x0'));var Redis=require(_0xcecc('0x1'));var qs=require(_0xcecc('0x2'));var logger=require(_0xcecc('0x3'))('api');var config=require(_0xcecc('0x4'));var db=require(_0xcecc('0x5'))['db'];config['redis']=_['defaults'](config[_0xcecc('0x6')],{'host':_0xcecc('0x7'),'port':0x18eb});var socket=require(_0xcecc('0x8'))(new Redis(config[_0xcecc('0x6')]));require(_0xcecc('0x9'))['register'](socket);function respondWithResult(_0x21d743,_0x3617f3){_0x3617f3=_0x3617f3||0xc8;return function(_0xc9622b){if(_0xc9622b){return _0x21d743[_0xcecc('0xa')](_0x3617f3)[_0xcecc('0xb')](_0xc9622b);}};}function respondWithFilteredResult(_0x3a2212,_0x5f0d61){return function(_0x1aa10d){if(_0x1aa10d){var _0xfd141a=typeof _0x5f0d61[_0xcecc('0xc')]==='undefined'&&typeof _0x5f0d61[_0xcecc('0xd')]==='undefined';var _0xe53336=_0x1aa10d['count'];var _0x2535aa=_0xfd141a?0x0:_0x5f0d61[_0xcecc('0xc')];var _0x298ad7=_0xfd141a?_0x1aa10d[_0xcecc('0xe')]:_0x5f0d61['offset']+_0x5f0d61[_0xcecc('0xd')];var _0x3b5492;if(_0x298ad7>=_0xe53336){_0x298ad7=_0xe53336;_0x3b5492=0xc8;}else{_0x3b5492=0xce;}_0x3a2212[_0xcecc('0xa')](_0x3b5492);return _0x3a2212[_0xcecc('0xf')](_0xcecc('0x10'),_0x2535aa+'-'+_0x298ad7+'/'+_0xe53336)[_0xcecc('0xb')](_0x1aa10d);}return null;};}function saveUpdates(_0x2c70e4){return function(_0x503ff8){if(_0x503ff8){return _0x503ff8['update'](_0x2c70e4)[_0xcecc('0x11')](function(_0x36ea71){return _0x36ea71;});}return null;};}function removeEntity(_0x3eff20){return function(_0x3a9b61){if(_0x3a9b61){return _0x3a9b61[_0xcecc('0x12')]()[_0xcecc('0x11')](function(){var _0x272da9=_0x3a9b61[_0xcecc('0x13')]({'plain':!![]});var _0x4fc17b=_0xcecc('0x14');return db['UserProfileResource'][_0xcecc('0x12')]({'where':{'type':_0x4fc17b,'resourceId':_0x272da9['id']}})[_0xcecc('0x11')](function(){return _0x3a9b61;});})[_0xcecc('0x11')](function(){var _0x4fbd93=new Redis(config['redis']);_0x4fbd93[_0xcecc('0x15')](_0xcecc('0x16'),JSON['stringify']({'id':_0x3a9b61['id'],'deleted':!![]}));})[_0xcecc('0x11')](function(){_0x3eff20[_0xcecc('0xa')](0xcc)[_0xcecc('0x17')]();});}};}function handleEntityNotFound(_0x40579b){return function(_0x525363){if(!_0x525363){_0x40579b[_0xcecc('0x18')](0x194);}return _0x525363;};}function handleError(_0x1cbf49,_0x34fc48){_0x34fc48=_0x34fc48||0x1f4;return function(_0x6f809){logger[_0xcecc('0x19')](_0x6f809[_0xcecc('0x1a')]);if(_0x6f809[_0xcecc('0x1b')]){delete _0x6f809['name'];}_0x1cbf49[_0xcecc('0xa')](_0x34fc48)[_0xcecc('0x1c')](_0x6f809);};}exports['index']=function(_0x57ef8f,_0x305718){var _0x55ee47={},_0x438c6c={},_0x446880={'count':0x0,'rows':[]};var _0x485867=_['map'](db['SquareProject'][_0xcecc('0x1d')],function(_0x164854){return{'name':_0x164854[_0xcecc('0x1e')],'type':_0x164854['type'][_0xcecc('0x1f')]};});_0x438c6c[_0xcecc('0x20')]=_[_0xcecc('0x21')](_0x485867,_0xcecc('0x1b'));_0x438c6c[_0xcecc('0x22')]=_[_0xcecc('0x23')](_0x57ef8f[_0xcecc('0x22')]);_0x438c6c[_0xcecc('0x24')]=_[_0xcecc('0x25')](_0x438c6c[_0xcecc('0x20')],_0x438c6c[_0xcecc('0x22')]);_0x55ee47['attributes']=_[_0xcecc('0x25')](_0x438c6c['model'],qs[_0xcecc('0x26')](_0x57ef8f[_0xcecc('0x22')]['fields']));_0x55ee47['attributes']=_0x55ee47[_0xcecc('0x27')][_0xcecc('0x28')]?_0x55ee47['attributes']:_0x438c6c[_0xcecc('0x20')];if(!_0x57ef8f[_0xcecc('0x22')]['hasOwnProperty'](_0xcecc('0x29'))){_0x55ee47[_0xcecc('0xd')]=qs[_0xcecc('0xd')](_0x57ef8f['query'][_0xcecc('0xd')]);_0x55ee47['offset']=qs[_0xcecc('0xc')](_0x57ef8f[_0xcecc('0x22')][_0xcecc('0xc')]);}_0x55ee47[_0xcecc('0x2a')]=qs[_0xcecc('0x2b')](_0x57ef8f[_0xcecc('0x22')]['sort']);_0x55ee47[_0xcecc('0x2c')]=qs[_0xcecc('0x24')](_[_0xcecc('0x2d')](_0x57ef8f[_0xcecc('0x22')],_0x438c6c[_0xcecc('0x24')]),_0x485867);if(_0x57ef8f[_0xcecc('0x22')]['filter']){_0x55ee47['where']=_[_0xcecc('0x2e')](_0x55ee47[_0xcecc('0x2c')],{'$or':_[_0xcecc('0x21')](_0x485867,function(_0x5a5bfc){if(_0x5a5bfc[_0xcecc('0x2f')]!==_0xcecc('0x30')){var _0x38935a={};_0x38935a[_0x5a5bfc[_0xcecc('0x1b')]]={'$like':'%'+_0x57ef8f['query'][_0xcecc('0x31')]+'%'};return _0x38935a;}})});}_0x55ee47=_[_0xcecc('0x2e')]({},_0x55ee47,_0x57ef8f[_0xcecc('0x32')]);var _0x1c179e={'where':_0x55ee47[_0xcecc('0x2c')]};return db[_0xcecc('0x33')][_0xcecc('0xe')](_0x1c179e)[_0xcecc('0x11')](function(_0x4219dd){_0x446880[_0xcecc('0xe')]=_0x4219dd;if(_0x57ef8f[_0xcecc('0x22')][_0xcecc('0x34')]){_0x55ee47[_0xcecc('0x35')]=[{'all':!![]}];}return db['SquareProject'][_0xcecc('0x36')](_0x55ee47);})[_0xcecc('0x11')](function(_0x4c2038){_0x446880[_0xcecc('0x37')]=_0x4c2038;return _0x446880;})[_0xcecc('0x11')](respondWithFilteredResult(_0x305718,_0x55ee47))['catch'](handleError(_0x305718,null));};exports[_0xcecc('0x38')]=function(_0xdead15,_0x400d6d){var _0x496a3c={'raw':![],'where':{'id':_0xdead15[_0xcecc('0x39')]['id']}},_0x53ed57={};_0x53ed57[_0xcecc('0x20')]=_['keys'](db[_0xcecc('0x33')]['rawAttributes']);_0x53ed57[_0xcecc('0x22')]=_['keys'](_0xdead15[_0xcecc('0x22')]);_0x53ed57[_0xcecc('0x24')]=_[_0xcecc('0x25')](_0x53ed57[_0xcecc('0x20')],_0x53ed57[_0xcecc('0x22')]);_0x496a3c[_0xcecc('0x27')]=_[_0xcecc('0x25')](_0x53ed57[_0xcecc('0x20')],qs[_0xcecc('0x26')](_0xdead15[_0xcecc('0x22')][_0xcecc('0x26')]));_0x496a3c[_0xcecc('0x27')]=_0x496a3c[_0xcecc('0x27')][_0xcecc('0x28')]?_0x496a3c['attributes']:_0x53ed57[_0xcecc('0x20')];if(_0xdead15['query'][_0xcecc('0x34')]){_0x496a3c[_0xcecc('0x35')]=[{'all':!![]}];}_0x496a3c=_[_0xcecc('0x2e')]({},_0x496a3c,_0xdead15['options']);return db['SquareProject']['find'](_0x496a3c)[_0xcecc('0x11')](handleEntityNotFound(_0x400d6d,null))[_0xcecc('0x11')](respondWithResult(_0x400d6d,null))['catch'](handleError(_0x400d6d,null));};exports[_0xcecc('0x3a')]=function(_0x1031a3,_0x1d63f8){return db[_0xcecc('0x33')][_0xcecc('0x3a')](_0x1031a3['body'],{})['then'](function(_0x232dce){var _0x1dc322=_0x1031a3[_0xcecc('0x3b')][_0xcecc('0x13')]({'plain':!![]});if(!_0x1dc322)throw new Error(_0xcecc('0x3c'));if(_0x1dc322[_0xcecc('0x3d')]===_0xcecc('0x3b')){var _0x1483eb=_0x232dce[_0xcecc('0x13')]({'plain':!![]});var _0x573069=_0xcecc('0x14');return db[_0xcecc('0x3e')][_0xcecc('0x3f')]({'where':{'name':_0x573069,'userProfileId':_0x1dc322[_0xcecc('0x40')]},'raw':!![]})[_0xcecc('0x11')](function(_0x2c8acf){if(_0x2c8acf&&_0x2c8acf[_0xcecc('0x41')]===0x0){return db[_0xcecc('0x42')][_0xcecc('0x3a')]({'name':_0x1483eb[_0xcecc('0x1b')],'resourceId':_0x1483eb['id'],'type':_0x2c8acf[_0xcecc('0x1b')],'sectionId':_0x2c8acf['id']},{})['then'](function(){return _0x232dce;});}else{return _0x232dce;}})['catch'](function(_0x13296d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13296d);throw _0x13296d;});}return _0x232dce;})[_0xcecc('0x11')](respondWithResult(_0x1d63f8,0xc9))[_0xcecc('0x43')](handleError(_0x1d63f8,null));};exports[_0xcecc('0x44')]=function(_0x260852,_0x299bf6){if(_0x260852[_0xcecc('0x45')]['id']){delete _0x260852[_0xcecc('0x45')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x260852['params']['id']}})[_0xcecc('0x11')](handleEntityNotFound(_0x299bf6,null))['then'](saveUpdates(_0x260852[_0xcecc('0x45')],null))['then'](function(_0xb7bd89){if(!_0xb7bd89)return;var _0x22a09a=_0xb7bd89[_0xcecc('0x13')]({'plain':!![]});return _0x22a09a;})[_0xcecc('0x11')](function(_0x30a5a5){var _0xf69089=new Redis(config['redis']);_0xf69089[_0xcecc('0x15')]('agi',JSON[_0xcecc('0x46')](_[_0xcecc('0x2d')](_0x30a5a5,['id',_0xcecc('0x1b'),'production'])));return _0x30a5a5;})[_0xcecc('0x11')](respondWithResult(_0x299bf6,null))[_0xcecc('0x43')](handleError(_0x299bf6,null));};exports[_0xcecc('0x12')]=function(_0x5150fb,_0x40d014){return db[_0xcecc('0x33')][_0xcecc('0x3f')]({'where':{'id':_0x5150fb[_0xcecc('0x39')]['id']}})['then'](handleEntityNotFound(_0x40d014,null))['then'](removeEntity(_0x40d014,null))[_0xcecc('0x43')](handleError(_0x40d014,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index bc87fdd..64ba375 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 _0x6341=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','update','remove','emit'];(function(_0x1e1f4a,_0x15d8c7){var _0x2221c8=function(_0xd9e618){while(--_0xd9e618){_0x1e1f4a['push'](_0x1e1f4a['shift']());}};_0x2221c8(++_0x15d8c7);}(_0x6341,0x125));var _0x1634=function(_0x58512e,_0x2cc279){_0x58512e=_0x58512e-0x0;var _0x225d90=_0x6341[_0x58512e];return _0x225d90;};'use strict';var EventEmitter=require(_0x1634('0x0'));var SquareProject=require(_0x1634('0x1'))['db'][_0x1634('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1634('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1634('0x4'),'afterDestroy':_0x1634('0x5')};function emitEvent(_0x5895a8){return function(_0x20443a,_0x36ab83,_0x1f3174){SquareProjectEvents[_0x1634('0x6')](_0x5895a8+':'+_0x20443a['id'],_0x20443a);SquareProjectEvents[_0x1634('0x6')](_0x5895a8,_0x20443a);_0x1f3174(null);};}for(var e in events){if(events[_0x1634('0x7')](e)){var event=events[e];SquareProject[_0x1634('0x8')](e,emitEvent(event));}}module[_0x1634('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xc5ad=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0xc5ad,0xb7));var _0xdc5a=function(_0x36b71a,_0x542b85){_0x36b71a=_0x36b71a-0x0;var _0xe6009a=_0xc5ad[_0x36b71a];return _0xe6009a;};'use strict';var EventEmitter=require(_0xdc5a('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xdc5a('0x1')](0x0);var events={'afterCreate':_0xdc5a('0x2'),'afterUpdate':_0xdc5a('0x3'),'afterDestroy':_0xdc5a('0x4')};function emitEvent(_0x326877){return function(_0x34c564,_0x46e403,_0x39af51){SquareProjectEvents[_0xdc5a('0x5')](_0x326877+':'+_0x34c564['id'],_0x34c564);SquareProjectEvents[_0xdc5a('0x5')](_0x326877,_0x34c564);_0x39af51(null);};}for(var e in events){if(events[_0xdc5a('0x6')](e)){var event=events[e];SquareProject[_0xdc5a('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 42070d5..1cf3cf8 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 _0x4f34=['define','square_projects','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','../../config/logger','api','moment','../../config/environment','./squareProject.attributes','exports'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x4f34,0x190));var _0x44f3=function(_0x11eebd,_0x3e2689){_0x11eebd=_0x11eebd-0x0;var _0x33855d=_0x4f34[_0x11eebd];return _0x33855d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x44f3('0x0'))(_0x44f3('0x1'));var moment=require(_0x44f3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x44f3('0x3'));var attributes=require(_0x44f3('0x4'));module[_0x44f3('0x5')]=function(_0x3cea32,_0x148b87){return _0x3cea32[_0x44f3('0x6')]('SquareProject',attributes,{'tableName':_0x44f3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d223e,_0x17c37b,_0x4a2ee8){if(_0x2d223e['changed']('preproduction')){_0x2d223e[_0x44f3('0x8')]=moment()[_0x44f3('0x9')](_0x44f3('0xa'));}if(_0x2d223e[_0x44f3('0xb')](_0x44f3('0xc'))){_0x2d223e[_0x44f3('0xd')]=moment()[_0x44f3('0x9')](_0x44f3('0xa'));}_0x4a2ee8(null,_0x2d223e);}}});}; \ No newline at end of file +var _0x8000=['savedAt','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','SquareProject','square_projects','changed','preproduction'];(function(_0x1f46b8,_0x15f6d1){var _0xcae172=function(_0x2f1bf9){while(--_0x2f1bf9){_0x1f46b8['push'](_0x1f46b8['shift']());}};_0xcae172(++_0x15f6d1);}(_0x8000,0xa6));var _0x0800=function(_0x120599,_0x5a335d){_0x120599=_0x120599-0x0;var _0x2ad666=_0x8000[_0x120599];return _0x2ad666;};'use strict';var _=require(_0x0800('0x0'));var util=require(_0x0800('0x1'));var logger=require(_0x0800('0x2'))(_0x0800('0x3'));var moment=require(_0x0800('0x4'));var BPromise=require('bluebird');var rp=require(_0x0800('0x5'));var fs=require('fs');var path=require(_0x0800('0x6'));var rimraf=require(_0x0800('0x7'));var config=require(_0x0800('0x8'));var attributes=require('./squareProject.attributes');module[_0x0800('0x9')]=function(_0x52a028,_0x4b877a){return _0x52a028['define'](_0x0800('0xa'),attributes,{'tableName':_0x0800('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e33c4,_0x2344b0,_0x30bb06){if(_0x5e33c4[_0x0800('0xc')](_0x0800('0xd'))){_0x5e33c4[_0x0800('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5e33c4[_0x0800('0xc')]('production')){_0x5e33c4[_0x0800('0xf')]=moment()[_0x0800('0x10')](_0x0800('0x11'));}_0x30bb06(null,_0x5e33c4);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 900400a..552c24e 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 _0xcd15=['where','debug','catch','lodash','ioredis','rpc','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','SquareProject','options','raw','attributes','limit','include','model','map','then','info','GetSquareProjects','stringify','error','message','ShowSquareProject','find'];(function(_0x3b4cf3,_0x29472b){var _0x43769d=function(_0x140a47){while(--_0x140a47){_0x3b4cf3['push'](_0x3b4cf3['shift']());}};_0x43769d(++_0x29472b);}(_0xcd15,0xc7));var _0x5cd1=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xcd15[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x5cd1('0x0'));var Redis=require(_0x5cd1('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x5cd1('0x2'));var config=require(_0x5cd1('0x3'));config[_0x5cd1('0x4')]=_['defaults'](config[_0x5cd1('0x4')],{'host':_0x5cd1('0x5'),'port':0x18eb});var socket=require(_0x5cd1('0x6'))(new Redis(config[_0x5cd1('0x4')]));require(_0x5cd1('0x7'))[_0x5cd1('0x8')](socket);exports['GetSquareProjects']=function(_0x43902e){var _0x433edf=this;return new Promise(function(_0x5e9072,_0x57d034){return db[_0x5cd1('0x9')]['findAll']({'raw':_0x43902e[_0x5cd1('0xa')]?_0x43902e['options'][_0x5cd1('0xb')]===undefined?!![]:![]:!![],'where':_0x43902e[_0x5cd1('0xa')]?_0x43902e[_0x5cd1('0xa')]['where']||null:null,'attributes':_0x43902e['options']?_0x43902e['options'][_0x5cd1('0xc')]||null:null,'limit':_0x43902e['options']?_0x43902e[_0x5cd1('0xa')][_0x5cd1('0xd')]||null:null,'include':_0x43902e['options']?_0x43902e[_0x5cd1('0xa')][_0x5cd1('0xe')]?_['map'](_0x43902e[_0x5cd1('0xa')][_0x5cd1('0xe')],function(_0x52bd62){return{'model':db[_0x52bd62[_0x5cd1('0xf')]],'as':_0x52bd62['as'],'attributes':_0x52bd62['attributes'],'include':_0x52bd62[_0x5cd1('0xe')]?_[_0x5cd1('0x10')](_0x52bd62[_0x5cd1('0xe')],function(_0x242e6c){return{'model':db[_0x242e6c[_0x5cd1('0xf')]],'as':_0x242e6c['as'],'attributes':_0x242e6c[_0x5cd1('0xc')],'include':_0x242e6c['include']?_[_0x5cd1('0x10')](_0x242e6c['include'],function(_0x3f0054){return{'model':db[_0x3f0054[_0x5cd1('0xf')]],'as':_0x3f0054['as'],'attributes':_0x3f0054[_0x5cd1('0xc')]};}):[]};}):[]};}):[]:[]})[_0x5cd1('0x11')](function(_0x588694){logger[_0x5cd1('0x12')]('GetSquareProjects',_0x43902e);logger['debug'](_0x5cd1('0x13'),_0x43902e,JSON[_0x5cd1('0x14')](_0x588694));_0x5e9072(_0x588694);})['catch'](function(_0x470e69){logger[_0x5cd1('0x15')](_0x5cd1('0x13'),_0x470e69[_0x5cd1('0x16')],_0x43902e);_0x57d034(_0x433edf['error'](0x1f4,_0x470e69[_0x5cd1('0x16')]));});});};exports[_0x5cd1('0x17')]=function(_0x2025fd){var _0x1d690e=this;return new Promise(function(_0x44e9fc,_0x59a6d1){return db[_0x5cd1('0x9')][_0x5cd1('0x18')]({'raw':_0x2025fd[_0x5cd1('0xa')]?_0x2025fd[_0x5cd1('0xa')][_0x5cd1('0xb')]===undefined?!![]:![]:!![],'where':_0x2025fd['options']?_0x2025fd['options'][_0x5cd1('0x19')]||null:null,'attributes':_0x2025fd[_0x5cd1('0xa')]?_0x2025fd[_0x5cd1('0xa')]['attributes']||null:null,'include':_0x2025fd['options']?_0x2025fd[_0x5cd1('0xa')][_0x5cd1('0xe')]?_[_0x5cd1('0x10')](_0x2025fd[_0x5cd1('0xa')][_0x5cd1('0xe')],function(_0x4fc746){return{'model':db[_0x4fc746[_0x5cd1('0xf')]],'as':_0x4fc746['as'],'attributes':_0x4fc746[_0x5cd1('0xc')],'include':_0x4fc746[_0x5cd1('0xe')]?_[_0x5cd1('0x10')](_0x4fc746[_0x5cd1('0xe')],function(_0x1cbd6a){return{'model':db[_0x1cbd6a['model']],'as':_0x1cbd6a['as'],'attributes':_0x1cbd6a[_0x5cd1('0xc')],'include':_0x1cbd6a[_0x5cd1('0xe')]?_['map'](_0x1cbd6a[_0x5cd1('0xe')],function(_0x5ac353){return{'model':db[_0x5ac353[_0x5cd1('0xf')]],'as':_0x5ac353['as'],'attributes':_0x5ac353[_0x5cd1('0xc')]};}):[]};}):[]};}):[]:[]})[_0x5cd1('0x11')](function(_0x3d1a95){logger[_0x5cd1('0x12')](_0x5cd1('0x17'),_0x2025fd);logger[_0x5cd1('0x1a')](_0x5cd1('0x17'),_0x2025fd,JSON[_0x5cd1('0x14')](_0x3d1a95));_0x44e9fc(_0x3d1a95);})[_0x5cd1('0x1b')](function(_0x1f85f2){logger[_0x5cd1('0x15')](_0x5cd1('0x17'),_0x1f85f2['message'],_0x2025fd);_0x59a6d1(_0x1d690e[_0x5cd1('0x15')](0x1f4,_0x1f85f2[_0x5cd1('0x16')]));});});}; \ No newline at end of file +var _0x7a74=['SquareProject','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','error','message','find','ShowSquareProject','catch','lodash','ioredis','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects'];(function(_0x1d6a97,_0x32f3eb){var _0x18a5fe=function(_0x178595){while(--_0x178595){_0x1d6a97['push'](_0x1d6a97['shift']());}};_0x18a5fe(++_0x32f3eb);}(_0x7a74,0xf2));var _0x47a7=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x7a74[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x47a7('0x0'));var Redis=require(_0x47a7('0x1'));var db=require(_0x47a7('0x2'))['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');config[_0x47a7('0x3')]=_[_0x47a7('0x4')](config[_0x47a7('0x3')],{'host':_0x47a7('0x5'),'port':0x18eb});var socket=require(_0x47a7('0x6'))(new Redis(config['redis']));require(_0x47a7('0x7'))[_0x47a7('0x8')](socket);exports[_0x47a7('0x9')]=function(_0x59ac17){var _0x53f7ec=this;return new Promise(function(_0x3f6fef,_0x2ed012){return db[_0x47a7('0xa')]['findAll']({'raw':_0x59ac17[_0x47a7('0xb')]?_0x59ac17[_0x47a7('0xb')][_0x47a7('0xc')]===undefined?!![]:![]:!![],'where':_0x59ac17[_0x47a7('0xb')]?_0x59ac17[_0x47a7('0xb')][_0x47a7('0xd')]||null:null,'attributes':_0x59ac17[_0x47a7('0xb')]?_0x59ac17[_0x47a7('0xb')]['attributes']||null:null,'limit':_0x59ac17[_0x47a7('0xb')]?_0x59ac17[_0x47a7('0xb')][_0x47a7('0xe')]||null:null,'include':_0x59ac17[_0x47a7('0xb')]?_0x59ac17[_0x47a7('0xb')][_0x47a7('0xf')]?_[_0x47a7('0x10')](_0x59ac17[_0x47a7('0xb')][_0x47a7('0xf')],function(_0x353012){return{'model':db[_0x353012[_0x47a7('0x11')]],'as':_0x353012['as'],'attributes':_0x353012[_0x47a7('0x12')],'include':_0x353012[_0x47a7('0xf')]?_[_0x47a7('0x10')](_0x353012[_0x47a7('0xf')],function(_0x3d5aed){return{'model':db[_0x3d5aed[_0x47a7('0x11')]],'as':_0x3d5aed['as'],'attributes':_0x3d5aed[_0x47a7('0x12')],'include':_0x3d5aed['include']?_[_0x47a7('0x10')](_0x3d5aed[_0x47a7('0xf')],function(_0x2a3811){return{'model':db[_0x2a3811['model']],'as':_0x2a3811['as'],'attributes':_0x2a3811['attributes']};}):[]};}):[]};}):[]:[]})[_0x47a7('0x13')](function(_0x57977b){logger[_0x47a7('0x14')](_0x47a7('0x9'),_0x59ac17);logger[_0x47a7('0x15')](_0x47a7('0x9'),_0x59ac17,JSON[_0x47a7('0x16')](_0x57977b));_0x3f6fef(_0x57977b);})['catch'](function(_0x1734b1){logger[_0x47a7('0x17')](_0x47a7('0x9'),_0x1734b1['message'],_0x59ac17);_0x2ed012(_0x53f7ec[_0x47a7('0x17')](0x1f4,_0x1734b1[_0x47a7('0x18')]));});});};exports['ShowSquareProject']=function(_0x33338d){var _0x1808cb=this;return new Promise(function(_0x251c8c,_0x19abed){return db[_0x47a7('0xa')][_0x47a7('0x19')]({'raw':_0x33338d[_0x47a7('0xb')]?_0x33338d[_0x47a7('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x33338d[_0x47a7('0xb')]?_0x33338d[_0x47a7('0xb')][_0x47a7('0xd')]||null:null,'attributes':_0x33338d[_0x47a7('0xb')]?_0x33338d[_0x47a7('0xb')]['attributes']||null:null,'include':_0x33338d['options']?_0x33338d['options']['include']?_[_0x47a7('0x10')](_0x33338d[_0x47a7('0xb')][_0x47a7('0xf')],function(_0x4a6f0c){return{'model':db[_0x4a6f0c[_0x47a7('0x11')]],'as':_0x4a6f0c['as'],'attributes':_0x4a6f0c[_0x47a7('0x12')],'include':_0x4a6f0c['include']?_[_0x47a7('0x10')](_0x4a6f0c[_0x47a7('0xf')],function(_0x12f8a3){return{'model':db[_0x12f8a3[_0x47a7('0x11')]],'as':_0x12f8a3['as'],'attributes':_0x12f8a3['attributes'],'include':_0x12f8a3['include']?_[_0x47a7('0x10')](_0x12f8a3[_0x47a7('0xf')],function(_0x2e2f1f){return{'model':db[_0x2e2f1f[_0x47a7('0x11')]],'as':_0x2e2f1f['as'],'attributes':_0x2e2f1f[_0x47a7('0x12')]};}):[]};}):[]};}):[]:[]})[_0x47a7('0x13')](function(_0x4741fa){logger[_0x47a7('0x14')](_0x47a7('0x1a'),_0x33338d);logger['debug'](_0x47a7('0x1a'),_0x33338d,JSON[_0x47a7('0x16')](_0x4741fa));_0x251c8c(_0x4741fa);})[_0x47a7('0x1b')](function(_0xd28e3b){logger[_0x47a7('0x17')](_0x47a7('0x1a'),_0xd28e3b[_0x47a7('0x18')],_0x33338d);_0x19abed(_0x1808cb[_0x47a7('0x17')](0x1f4,_0xd28e3b[_0x47a7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b079740..055ca34 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 _0x0dd3=['remove','removeListener','register','squareProject:','./squareProject.events','save'];(function(_0x57613b,_0x318d64){var _0x80078d=function(_0x47ce0b){while(--_0x47ce0b){_0x57613b['push'](_0x57613b['shift']());}};_0x80078d(++_0x318d64);}(_0x0dd3,0xd6));var _0x30dd=function(_0x29a6cd,_0x481b0e){_0x29a6cd=_0x29a6cd-0x0;var _0xc1922=_0x0dd3[_0x29a6cd];return _0xc1922;};'use strict';var SquareProjectEvents=require(_0x30dd('0x0'));var events=[_0x30dd('0x1'),_0x30dd('0x2'),'update'];function createListener(_0x4118a8,_0xa30332){return function(_0x5dea03){_0xa30332['emit'](_0x4118a8,_0x5dea03);};}function removeListener(_0x39849c,_0x5721c1){return function(){SquareProjectEvents[_0x30dd('0x3')](_0x39849c,_0x5721c1);};}exports[_0x30dd('0x4')]=function(_0x3d9f2d){for(var _0xfe9cc3=0x0,_0x4fb178=events['length'];_0xfe9cc3<_0x4fb178;_0xfe9cc3++){var _0x4985a9=events[_0xfe9cc3];var _0xa4bd92=createListener(_0x30dd('0x5')+_0x4985a9,_0x3d9f2d);SquareProjectEvents['on'](_0x4985a9,_0xa4bd92);}}; \ No newline at end of file +var _0x7586=['length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x289fd7,_0x341a58){var _0x44f7e0=function(_0x3e33cf){while(--_0x3e33cf){_0x289fd7['push'](_0x289fd7['shift']());}};_0x44f7e0(++_0x341a58);}(_0x7586,0x18e));var _0x6758=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0x7586[_0x594ece];return _0x471bc4;};'use strict';var SquareProjectEvents=require(_0x6758('0x0'));var events=[_0x6758('0x1'),_0x6758('0x2'),_0x6758('0x3')];function createListener(_0x3a2338,_0x52664f){return function(_0x4ef73e){_0x52664f[_0x6758('0x4')](_0x3a2338,_0x4ef73e);};}function removeListener(_0x327db1,_0xef50f1){return function(){SquareProjectEvents[_0x6758('0x5')](_0x327db1,_0xef50f1);};}exports[_0x6758('0x6')]=function(_0x3bc514){for(var _0x1487dd=0x0,_0x15e443=events[_0x6758('0x7')];_0x1487dd<_0x15e443;_0x1487dd++){var _0x205dbb=events[_0x1487dd];var _0x4b1abb=createListener(_0x6758('0x8')+_0x205dbb,_0x3bc514);SquareProjectEvents['on'](_0x205dbb,_0x4b1abb);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8fdc106..b297cf5 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(_0x56d521,_0x4200f1){var _0x12da6c=function(_0x2ec347){while(--_0x2ec347){_0x56d521['push'](_0x56d521['shift']());}};_0x12da6c(++_0x4200f1);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xe75d24,_0x54f93b){_0xe75d24=_0xe75d24-0x0;var _0x4d2587=_0x7fbe[_0xe75d24];return _0x4d2587;};'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(_0x8b8863,_0x5c7366){var _0x7d1752=function(_0x53aeae){while(--_0x53aeae){_0x8b8863['push'](_0x8b8863['shift']());}};_0x7d1752(++_0x5c7366);}(_0x5fc3,0xa8));var _0x35fc=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0x5fc3[_0x529f1c];return _0x4d57ab;};'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 49b272f..ad3a56f 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 _0x9c5a=['getDataValue','savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x5eca9f,_0x1d15d3){var _0x53a05c=function(_0x10bacd){while(--_0x10bacd){_0x5eca9f['push'](_0x5eca9f['shift']());}};_0x53a05c(++_0x1d15d3);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x19cc2c,_0x48fb6c){_0x19cc2c=_0x19cc2c-0x0;var _0x2f23f4=_0x9c5a[_0x19cc2c];return _0x2f23f4;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9c5('0x2')]},'calleridname':{'type':Sequelize[_0xa9c5('0x2')]},'context':{'type':Sequelize[_0xa9c5('0x2')]},'extension':{'type':Sequelize[_0xa9c5('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x2')]},'dnid':{'type':Sequelize[_0xa9c5('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xa9c5('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xa9c5('0x2')]},'format':{'type':Sequelize[_0xa9c5('0x3')],'get':function(){var _0x4cb597='';var _0x4b6db6=this[_0xa9c5('0x4')](_0xa9c5('0x5'));if(_0x4b6db6){_0x4cb597=_0x4b6db6['substring'](_0x4b6db6[_0xa9c5('0x6')]('.'));}return _0x4cb597;}}}; \ No newline at end of file +var _0xeec6=['sequelize','exports','STRING','getDataValue','savePath','lastIndexOf'];(function(_0xd9eaa6,_0x3faff0){var _0x3c7319=function(_0x385625){while(--_0x385625){_0xd9eaa6['push'](_0xd9eaa6['shift']());}};_0x3c7319(++_0x3faff0);}(_0xeec6,0x1c2));var _0x6eec=function(_0x37d4ac,_0x4e47d6){_0x37d4ac=_0x37d4ac-0x0;var _0x5e727a=_0xeec6[_0x37d4ac];return _0x5e727a;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'uniqueid':{'type':Sequelize[_0x6eec('0x2')]},'callerid':{'type':Sequelize[_0x6eec('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6eec('0x2')]},'extension':{'type':Sequelize[_0x6eec('0x2')]},'priority':{'type':Sequelize[_0x6eec('0x2')]},'accountcode':{'type':Sequelize[_0x6eec('0x2')]},'dnid':{'type':Sequelize[_0x6eec('0x2')]},'projectName':{'type':Sequelize[_0x6eec('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x6eec('0x2')]},'savePath':{'type':Sequelize[_0x6eec('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5a5e47='';var _0x1c810e=this[_0x6eec('0x3')](_0x6eec('0x4'));if(_0x1c810e){_0x5a5e47=_0x1c810e['substring'](_0x1c810e[_0x6eec('0x5')]('.'));}return _0x5a5e47;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ac9c128..4989c26 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 _0x4062=['key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','SquareRecording','includeAll','include','findAll','rows','catch','length','options','find','create','body','params','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','unlink','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','end','eml-format','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','name','send','index','map','rawAttributes'];(function(_0x595e2b,_0x504290){var _0xce5d7=function(_0x175ed5){while(--_0x175ed5){_0x595e2b['push'](_0x595e2b['shift']());}};_0xce5d7(++_0x504290);}(_0x4062,0x8e));var _0x2406=function(_0xd8f814,_0x341c6c){_0xd8f814=_0xd8f814-0x0;var _0x46dd67=_0x4062[_0xd8f814];return _0x46dd67;};'use strict';var emlformat=require(_0x2406('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2406('0x1'));var rp=require('request-promise');var moment=require(_0x2406('0x2'));var BPromise=require(_0x2406('0x3'));var Mustache=require('mustache');var util=require(_0x2406('0x4'));var path=require('path');var sox=require(_0x2406('0x5'));var csv=require(_0x2406('0x6'));var ejs=require(_0x2406('0x7'));var fs=require('fs');var fs_extra=require(_0x2406('0x8'));var _=require('lodash');var squel=require(_0x2406('0x9'));var crypto=require('crypto');var jsforce=require(_0x2406('0xa'));var deskjs=require(_0x2406('0xb'));var toCsv=require(_0x2406('0x6'));var querystring=require(_0x2406('0xc'));var Papa=require(_0x2406('0xd'));var Redis=require(_0x2406('0xe'));var authService=require(_0x2406('0xf'));var qs=require(_0x2406('0x10'));var as=require(_0x2406('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2406('0x12'))('api');var utils=require(_0x2406('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2406('0x14'))['db'];function respondWithStatusCode(_0x575e98,_0x1853f4){_0x1853f4=_0x1853f4||0xcc;return function(_0x178119){if(_0x178119){return _0x575e98[_0x2406('0x15')](_0x1853f4);}return _0x575e98['status'](_0x1853f4)['end']();};}function respondWithResult(_0x52ac0c,_0x41e3fb){_0x41e3fb=_0x41e3fb||0xc8;return function(_0x9a644b){if(_0x9a644b){return _0x52ac0c[_0x2406('0x16')](_0x41e3fb)[_0x2406('0x17')](_0x9a644b);}};}function respondWithFilteredResult(_0x4e7f33,_0x304427){return function(_0x3e9209){if(_0x3e9209){var _0x1dfd29=typeof _0x304427[_0x2406('0x18')]===_0x2406('0x19')&&typeof _0x304427[_0x2406('0x1a')]==='undefined';var _0x32f082=_0x3e9209[_0x2406('0x1b')];var _0x1ca679=_0x1dfd29?0x0:_0x304427['offset'];var _0x17a207=_0x1dfd29?_0x3e9209['count']:_0x304427[_0x2406('0x18')]+_0x304427[_0x2406('0x1a')];var _0x25a5d0;if(_0x17a207>=_0x32f082){_0x17a207=_0x32f082;_0x25a5d0=0xc8;}else{_0x25a5d0=0xce;}_0x4e7f33[_0x2406('0x16')](_0x25a5d0);return _0x4e7f33[_0x2406('0x1c')](_0x2406('0x1d'),_0x1ca679+'-'+_0x17a207+'/'+_0x32f082)[_0x2406('0x17')](_0x3e9209);}return null;};}function patchUpdates(_0x30c4f1){return function(_0x47bc8b){try{jsonpatch['apply'](_0x47bc8b,_0x30c4f1,!![]);}catch(_0x27e187){return BPromise[_0x2406('0x1e')](_0x27e187);}return _0x47bc8b['save']();};}function saveUpdates(_0x41e1f3,_0x32ad9f){return function(_0x5aec71){if(_0x5aec71){return _0x5aec71[_0x2406('0x1f')](_0x41e1f3)[_0x2406('0x20')](function(_0x1ea025){return _0x1ea025;});}return null;};}function removeEntity(_0x34dadb,_0xe19e6b){return function(_0x282456){if(_0x282456){return _0x282456[_0x2406('0x21')]()['then'](function(){_0x34dadb[_0x2406('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26f972,_0x383b02){return function(_0x50c798){if(!_0x50c798){_0x26f972[_0x2406('0x15')](0x194);}return _0x50c798;};}function handleError(_0x543831,_0x1240ad){_0x1240ad=_0x1240ad||0x1f4;return function(_0x5699aa){logger[_0x2406('0x22')](_0x5699aa['stack']);if(_0x5699aa[_0x2406('0x23')]){delete _0x5699aa['name'];}_0x543831['status'](_0x1240ad)[_0x2406('0x24')](_0x5699aa);};}exports[_0x2406('0x25')]=function(_0x162c1b,_0x26a76b){var _0x10babd={},_0x39a833={},_0x2dd4e8={'count':0x0,'rows':[]};var _0x16f60a=_[_0x2406('0x26')](db['SquareRecording'][_0x2406('0x27')],function(_0x236c17){return{'name':_0x236c17['fieldName'],'type':_0x236c17['type'][_0x2406('0x28')]};});_0x39a833[_0x2406('0x29')]=_['map'](_0x16f60a,_0x2406('0x23'));_0x39a833[_0x2406('0x2a')]=_[_0x2406('0x2b')](_0x162c1b[_0x2406('0x2a')]);_0x39a833[_0x2406('0x2c')]=_[_0x2406('0x2d')](_0x39a833[_0x2406('0x29')],_0x39a833[_0x2406('0x2a')]);_0x10babd[_0x2406('0x2e')]=_[_0x2406('0x2d')](_0x39a833[_0x2406('0x29')],qs[_0x2406('0x2f')](_0x162c1b['query'][_0x2406('0x2f')]));_0x10babd[_0x2406('0x2e')]=_0x10babd[_0x2406('0x2e')]['length']?_0x10babd[_0x2406('0x2e')]:_0x39a833[_0x2406('0x29')];if(!_0x162c1b[_0x2406('0x2a')][_0x2406('0x30')](_0x2406('0x31'))){_0x10babd['limit']=qs[_0x2406('0x1a')](_0x162c1b['query'][_0x2406('0x1a')]);_0x10babd[_0x2406('0x18')]=qs['offset'](_0x162c1b[_0x2406('0x2a')][_0x2406('0x18')]);}_0x10babd[_0x2406('0x32')]=qs[_0x2406('0x33')](_0x162c1b[_0x2406('0x2a')][_0x2406('0x33')]);_0x10babd[_0x2406('0x34')]=qs['filters'](_[_0x2406('0x35')](_0x162c1b[_0x2406('0x2a')],_0x39a833[_0x2406('0x2c')]),_0x16f60a);if(_0x162c1b[_0x2406('0x2a')]['filter']){_0x10babd[_0x2406('0x34')]=_[_0x2406('0x36')](_0x10babd['where'],{'$or':_['map'](_0x16f60a,function(_0x247d8e){if(_0x247d8e[_0x2406('0x37')]!=='VIRTUAL'){var _0x443649={};_0x443649[_0x247d8e[_0x2406('0x23')]]={'$like':'%'+_0x162c1b[_0x2406('0x2a')][_0x2406('0x38')]+'%'};return _0x443649;}})});}_0x10babd=_[_0x2406('0x36')]({},_0x10babd,_0x162c1b['options']);var _0xa1b101={'where':_0x10babd[_0x2406('0x34')]};return db[_0x2406('0x39')][_0x2406('0x1b')](_0xa1b101)[_0x2406('0x20')](function(_0x13d539){_0x2dd4e8[_0x2406('0x1b')]=_0x13d539;if(_0x162c1b['query'][_0x2406('0x3a')]){_0x10babd[_0x2406('0x3b')]=[{'all':!![]}];}return db[_0x2406('0x39')][_0x2406('0x3c')](_0x10babd);})['then'](function(_0xc8d231){_0x2dd4e8[_0x2406('0x3d')]=_0xc8d231;return _0x2dd4e8;})[_0x2406('0x20')](respondWithFilteredResult(_0x26a76b,_0x10babd))[_0x2406('0x3e')](handleError(_0x26a76b,null));};exports['show']=function(_0x14ed86,_0x4e3d24){var _0x59e6a7={'raw':!![],'where':{'id':_0x14ed86['params']['id']}},_0x863edf={};_0x863edf[_0x2406('0x29')]=_[_0x2406('0x2b')](db['SquareRecording']['rawAttributes']);_0x863edf[_0x2406('0x2a')]=_[_0x2406('0x2b')](_0x14ed86['query']);_0x863edf[_0x2406('0x2c')]=_[_0x2406('0x2d')](_0x863edf[_0x2406('0x29')],_0x863edf[_0x2406('0x2a')]);_0x59e6a7[_0x2406('0x2e')]=_[_0x2406('0x2d')](_0x863edf[_0x2406('0x29')],qs[_0x2406('0x2f')](_0x14ed86[_0x2406('0x2a')][_0x2406('0x2f')]));_0x59e6a7[_0x2406('0x2e')]=_0x59e6a7[_0x2406('0x2e')][_0x2406('0x3f')]?_0x59e6a7[_0x2406('0x2e')]:_0x863edf[_0x2406('0x29')];if(_0x14ed86['query'][_0x2406('0x3a')]){_0x59e6a7[_0x2406('0x3b')]=[{'all':!![]}];}_0x59e6a7=_[_0x2406('0x36')]({},_0x59e6a7,_0x14ed86[_0x2406('0x40')]);return db['SquareRecording'][_0x2406('0x41')](_0x59e6a7)[_0x2406('0x20')](handleEntityNotFound(_0x4e3d24,null))[_0x2406('0x20')](respondWithResult(_0x4e3d24,null))[_0x2406('0x3e')](handleError(_0x4e3d24,null));};exports[_0x2406('0x42')]=function(_0xfe8456,_0x26c1c2){return db['SquareRecording']['create'](_0xfe8456[_0x2406('0x43')],{})[_0x2406('0x20')](respondWithResult(_0x26c1c2,0xc9))[_0x2406('0x3e')](handleError(_0x26c1c2,null));};exports[_0x2406('0x1f')]=function(_0x27fdaa,_0x2d059a){if(_0x27fdaa[_0x2406('0x43')]['id']){delete _0x27fdaa['body']['id'];}return db[_0x2406('0x39')][_0x2406('0x41')]({'where':{'id':_0x27fdaa[_0x2406('0x44')]['id']}})['then'](handleEntityNotFound(_0x2d059a,null))[_0x2406('0x20')](saveUpdates(_0x27fdaa[_0x2406('0x43')],null))[_0x2406('0x20')](respondWithResult(_0x2d059a,null))[_0x2406('0x3e')](handleError(_0x2d059a,null));};exports['download']=function(_0x122787,_0x2b62da,_0x2dcc4e){var _0xb84487=require(_0x2406('0x45'));var _0x3b018f=![];var _0x21682b={};if(_0x122787[_0x2406('0x2a')][_0x2406('0x37')]&&_0x122787[_0x2406('0x2a')][_0x2406('0x37')]===_0x2406('0x46')){_0x21682b[_0x2406('0x46')]=_0x122787['params']['id'];}else{_0x21682b['id']=_0x122787[_0x2406('0x44')]['id'];}return db['SquareRecording'][_0x2406('0x41')]({'where':_0x21682b,'attributes':['id','savePath',_0x2406('0x47')],'raw':!![]})[_0x2406('0x20')](handleEntityNotFound(_0x2b62da,null))[_0x2406('0x20')](function(_0x3048f9){if(_0x3048f9){var _0x2852d3=_0x3048f9[_0x2406('0x48')];var _0x453480=util[_0x2406('0x49')](_0x2406('0x4a'),_0x2852d3);if(fs[_0x2406('0x4b')](_0x453480)){_0x3b018f=!![];return _0xb84487[_0x2406('0x4c')](_0x453480,_0x2852d3,config['secrets'][_0x2406('0x4d')])[_0x2406('0x20')](function(){return _0x3048f9;});}return _0x3048f9;}})[_0x2406('0x20')](function(_0x5cb2a5){if(_0x5cb2a5){var _0x52f2a0=_0x5cb2a5[_0x2406('0x48')];if(!fs[_0x2406('0x4b')](_0x52f2a0)){throw new db[(_0x2406('0x4e'))][(_0x2406('0x4f'))](_0x2406('0x50'));}if(_0x5cb2a5[_0x2406('0x47')]){return _0x2b62da[_0x2406('0x51')](_0x52f2a0,_0x5cb2a5[_0x2406('0x47')]+path['extname'](_0x52f2a0),function(){if(_0x3b018f){fs['unlink'](_0x52f2a0);}});}else{return _0x2b62da[_0x2406('0x51')](_0x52f2a0,function(_0xbe4caa){if(_0x3b018f){fs[_0x2406('0x52')](_0x52f2a0);}});}}})[_0x2406('0x3e')](function(_0x3883dd){if(_0x3883dd['message']===_0x2406('0x50')){_0x2b62da[_0x2406('0x16')](0x194)[_0x2406('0x24')](_0x2406('0x53'));}else{return handleError(_0x2b62da,null);}});};exports['destroy']=function(_0x2e3d62,_0x406767){return db[_0x2406('0x39')][_0x2406('0x41')]({'where':{'id':_0x2e3d62['params']['id']}})['then'](function(_0x501156){if(_['isNil'](_0x501156)){throw new ReferenceError('Entity\x20not\x20found');}return _0x501156;})[_0x2406('0x20')](function(_0x2d6bbe){var _0x36ddf9=_0x2d6bbe[_0x2406('0x48')];logger[_0x2406('0x54')](_0x2406('0x55'),_0x36ddf9);if(!_['isNil'](_0x2d6bbe[_0x2406('0x48')])&&fs[_0x2406('0x4b')](_0x36ddf9)){logger[_0x2406('0x54')](_0x2406('0x56')+_0x36ddf9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2406('0x57')](_0x36ddf9);}_0x36ddf9=_0x36ddf9+_0x2406('0x58');if(!_['isNil'](_0x2d6bbe[_0x2406('0x48')])&&fs[_0x2406('0x4b')](_0x36ddf9)){logger['info'](_0x2406('0x56')+_0x36ddf9+_0x2406('0x59'));fs[_0x2406('0x57')](_0x36ddf9);}return _0x2d6bbe;})[_0x2406('0x20')](function(_0x316a5a){if(!_0x316a5a)throw new InternalError();return _0x316a5a[_0x2406('0x21')]();})[_0x2406('0x20')](function(){_0x406767[_0x2406('0x16')](0xcc)[_0x2406('0x5a')]();})[_0x2406('0x3e')](handleError(_0x406767,null));}; \ No newline at end of file +var _0xc08d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','end','error','stack','name','send','SquareRecording','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','create','body','catch','download','../../components/encryptor','uniqueid','params','savePath','filename','format','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xc08d,0xae));var _0xdc08=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xc08d[_0x46f1a6];return _0x38429a;};'use strict';var emlformat=require(_0xdc08('0x0'));var rimraf=require(_0xdc08('0x1'));var zipdir=require(_0xdc08('0x2'));var jsonpatch=require(_0xdc08('0x3'));var rp=require(_0xdc08('0x4'));var moment=require(_0xdc08('0x5'));var BPromise=require(_0xdc08('0x6'));var Mustache=require('mustache');var util=require(_0xdc08('0x7'));var path=require(_0xdc08('0x8'));var sox=require(_0xdc08('0x9'));var csv=require(_0xdc08('0xa'));var ejs=require(_0xdc08('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc08('0xc'));var squel=require(_0xdc08('0xd'));var crypto=require(_0xdc08('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc08('0xa'));var querystring=require(_0xdc08('0xf'));var Papa=require(_0xdc08('0x10'));var Redis=require(_0xdc08('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc08('0x12'));var as=require(_0xdc08('0x13'));var hardwareService=require(_0xdc08('0x14'));var logger=require(_0xdc08('0x15'))('api');var utils=require(_0xdc08('0x16'));var config=require(_0xdc08('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc08('0x18'))['db'];function respondWithStatusCode(_0x5f32fa,_0x94cf15){_0x94cf15=_0x94cf15||0xcc;return function(_0x1f1b4b){if(_0x1f1b4b){return _0x5f32fa[_0xdc08('0x19')](_0x94cf15);}return _0x5f32fa[_0xdc08('0x1a')](_0x94cf15)['end']();};}function respondWithResult(_0x39c20f,_0x59fb1f){_0x59fb1f=_0x59fb1f||0xc8;return function(_0x2f3721){if(_0x2f3721){return _0x39c20f[_0xdc08('0x1a')](_0x59fb1f)[_0xdc08('0x1b')](_0x2f3721);}};}function respondWithFilteredResult(_0x67ca8d,_0x5b5ae9){return function(_0x31f3ef){if(_0x31f3ef){var _0x166838=typeof _0x5b5ae9[_0xdc08('0x1c')]===_0xdc08('0x1d')&&typeof _0x5b5ae9[_0xdc08('0x1e')]===_0xdc08('0x1d');var _0x2c60c8=_0x31f3ef[_0xdc08('0x1f')];var _0x37c1a8=_0x166838?0x0:_0x5b5ae9['offset'];var _0xe94637=_0x166838?_0x31f3ef[_0xdc08('0x1f')]:_0x5b5ae9[_0xdc08('0x1c')]+_0x5b5ae9[_0xdc08('0x1e')];var _0xc129a8;if(_0xe94637>=_0x2c60c8){_0xe94637=_0x2c60c8;_0xc129a8=0xc8;}else{_0xc129a8=0xce;}_0x67ca8d[_0xdc08('0x1a')](_0xc129a8);return _0x67ca8d[_0xdc08('0x20')]('Content-Range',_0x37c1a8+'-'+_0xe94637+'/'+_0x2c60c8)['json'](_0x31f3ef);}return null;};}function patchUpdates(_0x108bd8){return function(_0x3a9ad8){try{jsonpatch[_0xdc08('0x21')](_0x3a9ad8,_0x108bd8,!![]);}catch(_0x113294){return BPromise['reject'](_0x113294);}return _0x3a9ad8[_0xdc08('0x22')]();};}function saveUpdates(_0x44f7e9,_0x174999){return function(_0x425a69){if(_0x425a69){return _0x425a69[_0xdc08('0x23')](_0x44f7e9)['then'](function(_0x575a56){return _0x575a56;});}return null;};}function removeEntity(_0x3ba22b,_0x183fbe){return function(_0x23797c){if(_0x23797c){return _0x23797c[_0xdc08('0x24')]()[_0xdc08('0x25')](function(){_0x3ba22b[_0xdc08('0x1a')](0xcc)[_0xdc08('0x26')]();});}};}function handleEntityNotFound(_0x8f698c,_0x271fed){return function(_0x5942a7){if(!_0x5942a7){_0x8f698c[_0xdc08('0x19')](0x194);}return _0x5942a7;};}function handleError(_0x1209f7,_0x30fea3){_0x30fea3=_0x30fea3||0x1f4;return function(_0x3355c5){logger[_0xdc08('0x27')](_0x3355c5[_0xdc08('0x28')]);if(_0x3355c5['name']){delete _0x3355c5[_0xdc08('0x29')];}_0x1209f7[_0xdc08('0x1a')](_0x30fea3)[_0xdc08('0x2a')](_0x3355c5);};}exports['index']=function(_0x417ada,_0x139f84){var _0x3c1df9={},_0x23af8e={},_0x7172b1={'count':0x0,'rows':[]};var _0x17c827=_['map'](db[_0xdc08('0x2b')]['rawAttributes'],function(_0x292ad2){return{'name':_0x292ad2[_0xdc08('0x2c')],'type':_0x292ad2[_0xdc08('0x2d')][_0xdc08('0x2e')]};});_0x23af8e[_0xdc08('0x2f')]=_[_0xdc08('0x30')](_0x17c827,_0xdc08('0x29'));_0x23af8e[_0xdc08('0x31')]=_[_0xdc08('0x32')](_0x417ada[_0xdc08('0x31')]);_0x23af8e[_0xdc08('0x33')]=_['intersection'](_0x23af8e['model'],_0x23af8e['query']);_0x3c1df9[_0xdc08('0x34')]=_[_0xdc08('0x35')](_0x23af8e[_0xdc08('0x2f')],qs['fields'](_0x417ada[_0xdc08('0x31')][_0xdc08('0x36')]));_0x3c1df9['attributes']=_0x3c1df9[_0xdc08('0x34')]['length']?_0x3c1df9[_0xdc08('0x34')]:_0x23af8e['model'];if(!_0x417ada['query'][_0xdc08('0x37')]('nolimit')){_0x3c1df9['limit']=qs['limit'](_0x417ada[_0xdc08('0x31')][_0xdc08('0x1e')]);_0x3c1df9[_0xdc08('0x1c')]=qs[_0xdc08('0x1c')](_0x417ada[_0xdc08('0x31')][_0xdc08('0x1c')]);}_0x3c1df9['order']=qs[_0xdc08('0x38')](_0x417ada[_0xdc08('0x31')][_0xdc08('0x38')]);_0x3c1df9['where']=qs['filters'](_[_0xdc08('0x39')](_0x417ada['query'],_0x23af8e[_0xdc08('0x33')]),_0x17c827);if(_0x417ada[_0xdc08('0x31')][_0xdc08('0x3a')]){_0x3c1df9[_0xdc08('0x3b')]=_[_0xdc08('0x3c')](_0x3c1df9[_0xdc08('0x3b')],{'$or':_['map'](_0x17c827,function(_0x1ae760){if(_0x1ae760[_0xdc08('0x2d')]!==_0xdc08('0x3d')){var _0x5548aa={};_0x5548aa[_0x1ae760['name']]={'$like':'%'+_0x417ada[_0xdc08('0x31')][_0xdc08('0x3a')]+'%'};return _0x5548aa;}})});}_0x3c1df9=_[_0xdc08('0x3c')]({},_0x3c1df9,_0x417ada[_0xdc08('0x3e')]);var _0xce8fc1={'where':_0x3c1df9['where']};return db[_0xdc08('0x2b')][_0xdc08('0x1f')](_0xce8fc1)[_0xdc08('0x25')](function(_0x5bec88){_0x7172b1[_0xdc08('0x1f')]=_0x5bec88;if(_0x417ada['query'][_0xdc08('0x3f')]){_0x3c1df9['include']=[{'all':!![]}];}return db['SquareRecording'][_0xdc08('0x40')](_0x3c1df9);})[_0xdc08('0x25')](function(_0x4d9815){_0x7172b1[_0xdc08('0x41')]=_0x4d9815;return _0x7172b1;})[_0xdc08('0x25')](respondWithFilteredResult(_0x139f84,_0x3c1df9))['catch'](handleError(_0x139f84,null));};exports[_0xdc08('0x42')]=function(_0x16e15e,_0x3af12a){var _0x40d582={'raw':!![],'where':{'id':_0x16e15e['params']['id']}},_0x31b222={};_0x31b222[_0xdc08('0x2f')]=_[_0xdc08('0x32')](db['SquareRecording']['rawAttributes']);_0x31b222[_0xdc08('0x31')]=_['keys'](_0x16e15e[_0xdc08('0x31')]);_0x31b222[_0xdc08('0x33')]=_[_0xdc08('0x35')](_0x31b222['model'],_0x31b222['query']);_0x40d582['attributes']=_[_0xdc08('0x35')](_0x31b222[_0xdc08('0x2f')],qs['fields'](_0x16e15e[_0xdc08('0x31')][_0xdc08('0x36')]));_0x40d582['attributes']=_0x40d582['attributes']['length']?_0x40d582[_0xdc08('0x34')]:_0x31b222[_0xdc08('0x2f')];if(_0x16e15e['query'][_0xdc08('0x3f')]){_0x40d582[_0xdc08('0x43')]=[{'all':!![]}];}_0x40d582=_[_0xdc08('0x3c')]({},_0x40d582,_0x16e15e[_0xdc08('0x3e')]);return db[_0xdc08('0x2b')][_0xdc08('0x44')](_0x40d582)[_0xdc08('0x25')](handleEntityNotFound(_0x3af12a,null))[_0xdc08('0x25')](respondWithResult(_0x3af12a,null))['catch'](handleError(_0x3af12a,null));};exports[_0xdc08('0x45')]=function(_0x359e5e,_0x42db05){return db[_0xdc08('0x2b')][_0xdc08('0x45')](_0x359e5e[_0xdc08('0x46')],{})['then'](respondWithResult(_0x42db05,0xc9))['catch'](handleError(_0x42db05,null));};exports[_0xdc08('0x23')]=function(_0x6b7634,_0x16e91e){if(_0x6b7634[_0xdc08('0x46')]['id']){delete _0x6b7634[_0xdc08('0x46')]['id'];}return db[_0xdc08('0x2b')]['find']({'where':{'id':_0x6b7634['params']['id']}})[_0xdc08('0x25')](handleEntityNotFound(_0x16e91e,null))[_0xdc08('0x25')](saveUpdates(_0x6b7634[_0xdc08('0x46')],null))[_0xdc08('0x25')](respondWithResult(_0x16e91e,null))[_0xdc08('0x47')](handleError(_0x16e91e,null));};exports[_0xdc08('0x48')]=function(_0x5ba613,_0x384525,_0x1e7aab){var _0x217746=require(_0xdc08('0x49'));var _0x4d30ad=![];var _0x174e5f={};if(_0x5ba613[_0xdc08('0x31')][_0xdc08('0x2d')]&&_0x5ba613[_0xdc08('0x31')][_0xdc08('0x2d')]===_0xdc08('0x4a')){_0x174e5f[_0xdc08('0x4a')]=_0x5ba613[_0xdc08('0x4b')]['id'];}else{_0x174e5f['id']=_0x5ba613['params']['id'];}return db[_0xdc08('0x2b')][_0xdc08('0x44')]({'where':_0x174e5f,'attributes':['id',_0xdc08('0x4c'),_0xdc08('0x4d')],'raw':!![]})[_0xdc08('0x25')](handleEntityNotFound(_0x384525,null))['then'](function(_0x5d3b84){if(_0x5d3b84){var _0x6b2d16=_0x5d3b84[_0xdc08('0x4c')];var _0x18ba32=util[_0xdc08('0x4e')](_0xdc08('0x4f'),_0x6b2d16);if(fs[_0xdc08('0x50')](_0x18ba32)){_0x4d30ad=!![];return _0x217746[_0xdc08('0x51')](_0x18ba32,_0x6b2d16,config['secrets']['recording'])[_0xdc08('0x25')](function(){return _0x5d3b84;});}return _0x5d3b84;}})[_0xdc08('0x25')](function(_0x32da68){if(_0x32da68){var _0x14712c=_0x32da68[_0xdc08('0x4c')];if(!fs[_0xdc08('0x50')](_0x14712c)){throw new db[(_0xdc08('0x52'))][(_0xdc08('0x53'))](_0xdc08('0x54'));}if(_0x32da68[_0xdc08('0x4d')]){return _0x384525[_0xdc08('0x48')](_0x14712c,_0x32da68[_0xdc08('0x4d')]+path[_0xdc08('0x55')](_0x14712c),function(){if(_0x4d30ad){fs[_0xdc08('0x56')](_0x14712c);}});}else{return _0x384525[_0xdc08('0x48')](_0x14712c,function(_0x287e99){if(_0x4d30ad){fs[_0xdc08('0x56')](_0x14712c);}});}}})['catch'](function(_0x48eb08){if(_0x48eb08[_0xdc08('0x57')]===_0xdc08('0x54')){_0x384525[_0xdc08('0x1a')](0x194)[_0xdc08('0x2a')]('Not\x20found');}else{return handleError(_0x384525,null);}});};exports[_0xdc08('0x24')]=function(_0x563929,_0x322dfd){return db[_0xdc08('0x2b')][_0xdc08('0x44')]({'where':{'id':_0x563929[_0xdc08('0x4b')]['id']}})['then'](function(_0x524835){if(_[_0xdc08('0x58')](_0x524835)){throw new ReferenceError(_0xdc08('0x59'));}return _0x524835;})[_0xdc08('0x25')](function(_0x4e00ef){var _0x428305=_0x4e00ef[_0xdc08('0x4c')];logger['info'](_0xdc08('0x5a'),_0x428305);if(!_[_0xdc08('0x58')](_0x4e00ef[_0xdc08('0x4c')])&&fs[_0xdc08('0x50')](_0x428305)){logger['info'](_0xdc08('0x5b')+_0x428305+_0xdc08('0x5c'));fs[_0xdc08('0x5d')](_0x428305);}_0x428305=_0x428305+_0xdc08('0x5e');if(!_[_0xdc08('0x58')](_0x4e00ef[_0xdc08('0x4c')])&&fs['existsSync'](_0x428305)){logger[_0xdc08('0x5f')](_0xdc08('0x5b')+_0x428305+_0xdc08('0x5c'));fs[_0xdc08('0x5d')](_0x428305);}return _0x4e00ef;})[_0xdc08('0x25')](function(_0x17fbad){if(!_0x17fbad)throw new InternalError();return _0x17fbad['destroy']();})[_0xdc08('0x25')](function(){_0x322dfd[_0xdc08('0x1a')](0xcc)[_0xdc08('0x26')]();})[_0xdc08('0x47')](handleError(_0x322dfd,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index abcecf3..30f03bc 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 _0x22b4=['bluebird','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','lodash','util','../../config/logger','api','moment'];(function(_0x16fc9a,_0x31a47c){var _0x477d98=function(_0x58af0){while(--_0x58af0){_0x16fc9a['push'](_0x16fc9a['shift']());}};_0x477d98(++_0x31a47c);}(_0x22b4,0x8b));var _0x422b=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x22b4[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x422b('0x0'));var util=require(_0x422b('0x1'));var logger=require(_0x422b('0x2'))(_0x422b('0x3'));var moment=require(_0x422b('0x4'));var BPromise=require(_0x422b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x422b('0x6'));var rimraf=require(_0x422b('0x7'));var config=require('../../config/environment');var attributes=require(_0x422b('0x8'));module[_0x422b('0x9')]=function(_0x2cde8e,_0x1a758a){return _0x2cde8e[_0x422b('0xa')](_0x422b('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4325=['moment','bluebird','rimraf','../../config/environment','./squareRecording.attributes','SquareRecording','lodash','util','api'];(function(_0x2458c4,_0xe564b){var _0x3c8325=function(_0x89452c){while(--_0x89452c){_0x2458c4['push'](_0x2458c4['shift']());}};_0x3c8325(++_0xe564b);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var logger=require('../../config/logger')(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var attributes=require(_0x5432('0x7'));module['exports']=function(_0x209e2e,_0xbb0075){return _0x209e2e['define'](_0x5432('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 2329549..d371e5e 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 _0x9920=['jayson/promise','client','http','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSquareRecording','SquareRecording','options','catch','util','moment','randomstring','rpc'];(function(_0x35447c,_0x45845a){var _0x19f19a=function(_0xe092cf){while(--_0xe092cf){_0x35447c['push'](_0x35447c['shift']());}};_0x19f19a(++_0x45845a);}(_0x9920,0x15c));var _0x0992=function(_0x59fbd3,_0x16f48f){_0x59fbd3=_0x59fbd3-0x0;var _0x21d92d=_0x9920[_0x59fbd3];return _0x21d92d;};'use strict';var _=require('lodash');var util=require(_0x0992('0x0'));var moment=require(_0x0992('0x1'));var BPromise=require('bluebird');var rs=require(_0x0992('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0992('0x3'));var config=require('../../config/environment');var jayson=require(_0x0992('0x4'));var client=jayson[_0x0992('0x5')][_0x0992('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x52a122,_0x167a69,_0x3d241e){return new BPromise(function(_0x4ee6d2,_0x3b63b6){return client['request'](_0x52a122,_0x3d241e)[_0x0992('0x7')](function(_0x362a48){logger['info'](_0x0992('0x8'),_0x167a69,_0x0992('0x9'));logger[_0x0992('0xa')](_0x0992('0xb'),_0x167a69,_0x0992('0x9'),JSON[_0x0992('0xc')](_0x362a48));if(_0x362a48[_0x0992('0xd')]){if(_0x362a48[_0x0992('0xd')][_0x0992('0xe')]===0x1f4){logger[_0x0992('0xd')](_0x0992('0x8'),_0x167a69,_0x362a48[_0x0992('0xd')]['message']);return _0x3b63b6(_0x362a48[_0x0992('0xd')]['message']);}logger[_0x0992('0xd')](_0x0992('0x8'),_0x167a69,_0x362a48[_0x0992('0xd')][_0x0992('0xf')]);return _0x4ee6d2(_0x362a48[_0x0992('0xd')][_0x0992('0xf')]);}else{logger[_0x0992('0x10')](_0x0992('0x8'),_0x167a69,'request\x20sent');_0x4ee6d2(_0x362a48[_0x0992('0x11')][_0x0992('0xf')]);}})['catch'](function(_0xf5947a){logger[_0x0992('0xd')](_0x0992('0x8'),_0x167a69,_0xf5947a);_0x3b63b6(_0xf5947a);});});}exports[_0x0992('0x12')]=function(_0x572d10){var _0x36d9fc=this;return new Promise(function(_0x29e101,_0xad1380){return db[_0x0992('0x13')]['create'](_0x572d10['body'],{'raw':_0x572d10['options']?_0x572d10[_0x0992('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x0992('0x7')](function(_0x53995c){logger[_0x0992('0x10')](_0x0992('0x12'),_0x572d10);logger[_0x0992('0xa')]('CreateSquareRecording',_0x572d10,JSON['stringify'](_0x53995c));_0x29e101(_0x53995c);})[_0x0992('0x15')](function(_0x1b7efd){logger[_0x0992('0xd')](_0x0992('0x12'),_0x1b7efd[_0x0992('0xf')],_0x572d10);_0xad1380(_0x36d9fc[_0x0992('0xd')](0x1f4,_0x1b7efd[_0x0992('0xf')]));});});}; \ No newline at end of file +var _0xbac1=['message','info','result','CreateSquareRecording','create','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3010f3,_0x5f49da){var _0x34cd9e=function(_0x56a2df){while(--_0x56a2df){_0x3010f3['push'](_0x3010f3['shift']());}};_0x34cd9e(++_0x5f49da);}(_0xbac1,0x9f));var _0x1bac=function(_0x5df2e1,_0x512639){_0x5df2e1=_0x5df2e1-0x0;var _0x3c288c=_0xbac1[_0x5df2e1];return _0x3c288c;};'use strict';var _=require(_0x1bac('0x0'));var util=require(_0x1bac('0x1'));var moment=require(_0x1bac('0x2'));var BPromise=require(_0x1bac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bac('0x4'));var db=require(_0x1bac('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1bac('0x6'));var config=require(_0x1bac('0x7'));var jayson=require(_0x1bac('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ec3af,_0x259b28,_0x37f956){return new BPromise(function(_0x15aba4,_0x302d36){return client[_0x1bac('0x9')](_0x3ec3af,_0x37f956)['then'](function(_0x19a528){logger['info'](_0x1bac('0xa'),_0x259b28,_0x1bac('0xb'));logger[_0x1bac('0xc')](_0x1bac('0xd'),_0x259b28,'request\x20sent',JSON[_0x1bac('0xe')](_0x19a528));if(_0x19a528['error']){if(_0x19a528[_0x1bac('0xf')]['code']===0x1f4){logger[_0x1bac('0xf')](_0x1bac('0xa'),_0x259b28,_0x19a528[_0x1bac('0xf')][_0x1bac('0x10')]);return _0x302d36(_0x19a528[_0x1bac('0xf')]['message']);}logger[_0x1bac('0xf')]('SquareRecording,\x20%s,\x20%s',_0x259b28,_0x19a528[_0x1bac('0xf')][_0x1bac('0x10')]);return _0x15aba4(_0x19a528[_0x1bac('0xf')][_0x1bac('0x10')]);}else{logger[_0x1bac('0x11')](_0x1bac('0xa'),_0x259b28,_0x1bac('0xb'));_0x15aba4(_0x19a528[_0x1bac('0x12')][_0x1bac('0x10')]);}})['catch'](function(_0x51dba8){logger[_0x1bac('0xf')](_0x1bac('0xa'),_0x259b28,_0x51dba8);_0x302d36(_0x51dba8);});});}exports[_0x1bac('0x13')]=function(_0x288001){var _0x5b7e9f=this;return new Promise(function(_0x2ae2da,_0x4e0e68){return db['SquareRecording'][_0x1bac('0x14')](_0x288001[_0x1bac('0x15')],{'raw':_0x288001[_0x1bac('0x16')]?_0x288001['options'][_0x1bac('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x117a6e){logger[_0x1bac('0x11')](_0x1bac('0x13'),_0x288001);logger[_0x1bac('0xc')](_0x1bac('0x13'),_0x288001,JSON[_0x1bac('0xe')](_0x117a6e));_0x2ae2da(_0x117a6e);})[_0x1bac('0x18')](function(_0x41b3cc){logger[_0x1bac('0xf')](_0x1bac('0x13'),_0x41b3cc['message'],_0x288001);_0x4e0e68(_0x5b7e9f[_0x1bac('0xf')](0x1f4,_0x41b3cc[_0x1bac('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index ca6b175..fe953fb 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4d9c3b,_0x3c4663){var _0x35c391=function(_0x22ac2e){while(--_0x22ac2e){_0x4d9c3b['push'](_0x4d9c3b['shift']());}};_0x35c391(++_0x3c4663);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c3b2784..3bef285 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 _0xec3c=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x3f01b1,_0x2ac71d){var _0x3fcd1c=function(_0x2ef79f){while(--_0x2ef79f){_0x3f01b1['push'](_0x3f01b1['shift']());}};_0x3fcd1c(++_0x2ac71d);}(_0xec3c,0x1e6));var _0xcec3=function(_0x3995ea,_0x230620){_0x3995ea=_0x3995ea-0x0;var _0x10477f=_0xec3c[_0x3995ea];return _0x10477f;};'use strict';var Sequelize=require(_0xcec3('0x0'));module[_0xcec3('0x1')]={'network':{'type':Sequelize[_0xcec3('0x2')]},'network_script':{'type':Sequelize[_0xcec3('0x2')]},'request':{'type':Sequelize[_0xcec3('0x2')]},'channel':{'type':Sequelize[_0xcec3('0x2')]},'language':{'type':Sequelize[_0xcec3('0x2')]},'type':{'type':Sequelize[_0xcec3('0x2')]},'uniqueid':{'type':Sequelize[_0xcec3('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xcec3('0x2')]},'calleridname':{'type':Sequelize[_0xcec3('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xcec3('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xcec3('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xcec3('0x2')]},'priority':{'type':Sequelize[_0xcec3('0x2')]},'enhanced':{'type':Sequelize[_0xcec3('0x2')]},'accountcode':{'type':Sequelize[_0xcec3('0x2')]},'threadid':{'type':Sequelize[_0xcec3('0x2')]},'project_name':{'type':Sequelize[_0xcec3('0x2')]},'joinAt':{'type':Sequelize[_0xcec3('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xcec3('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3c69=['BOOLEAN','STRING','DATE'];(function(_0x1b2626,_0x2b8a50){var _0x3b2a61=function(_0x28b22d){while(--_0x28b22d){_0x1b2626['push'](_0x1b2626['shift']());}};_0x3b2a61(++_0x2b8a50);}(_0x3c69,0x1bd));var _0x93c6=function(_0x599fdc,_0x1f1138){_0x599fdc=_0x599fdc-0x0;var _0x98ea0f=_0x3c69[_0x599fdc];return _0x98ea0f;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x93c6('0x0')]},'request':{'type':Sequelize[_0x93c6('0x0')]},'channel':{'type':Sequelize[_0x93c6('0x0')]},'language':{'type':Sequelize[_0x93c6('0x0')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x93c6('0x0')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x93c6('0x0')]},'callingani2':{'type':Sequelize[_0x93c6('0x0')]},'callington':{'type':Sequelize[_0x93c6('0x0')]},'callingtns':{'type':Sequelize[_0x93c6('0x0')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x93c6('0x0')]},'context':{'type':Sequelize[_0x93c6('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x93c6('0x0')]},'enhanced':{'type':Sequelize[_0x93c6('0x0')]},'accountcode':{'type':Sequelize[_0x93c6('0x0')]},'threadid':{'type':Sequelize[_0x93c6('0x0')]},'project_name':{'type':Sequelize[_0x93c6('0x0')]},'joinAt':{'type':Sequelize[_0x93c6('0x1')]},'leaveAt':{'type':Sequelize[_0x93c6('0x1')]},'bot':{'type':Sequelize[_0x93c6('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 8f0304c..6cc87d2 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 _0xd3a2=['map','SquareReport','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','end','error','name'];(function(_0x89e536,_0x5ba5a5){var _0x41513c=function(_0x2b8d99){while(--_0x2b8d99){_0x89e536['push'](_0x89e536['shift']());}};_0x41513c(++_0x5ba5a5);}(_0xd3a2,0x66));var _0x2d3a=function(_0x1d6ef1,_0x55a673){_0x1d6ef1=_0x1d6ef1-0x0;var _0x2769b1=_0xd3a2[_0x1d6ef1];return _0x2769b1;};'use strict';var emlformat=require(_0x2d3a('0x0'));var rimraf=require(_0x2d3a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d3a('0x2'));var rp=require(_0x2d3a('0x3'));var moment=require(_0x2d3a('0x4'));var BPromise=require(_0x2d3a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2d3a('0x6'));var csv=require(_0x2d3a('0x7'));var ejs=require(_0x2d3a('0x8'));var fs=require('fs');var fs_extra=require(_0x2d3a('0x9'));var _=require(_0x2d3a('0xa'));var squel=require('squel');var crypto=require(_0x2d3a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2d3a('0xc'));var toCsv=require(_0x2d3a('0x7'));var querystring=require(_0x2d3a('0xd'));var Papa=require(_0x2d3a('0xe'));var Redis=require('ioredis');var authService=require(_0x2d3a('0xf'));var qs=require(_0x2d3a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d3a('0x11'));var logger=require(_0x2d3a('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2d3a('0x13'));var licenseUtil=require(_0x2d3a('0x14'));var db=require(_0x2d3a('0x15'))['db'];function respondWithStatusCode(_0x1cc624,_0x309e4b){_0x309e4b=_0x309e4b||0xcc;return function(_0x1aa5a0){if(_0x1aa5a0){return _0x1cc624[_0x2d3a('0x16')](_0x309e4b);}return _0x1cc624[_0x2d3a('0x17')](_0x309e4b)['end']();};}function respondWithResult(_0x4b1bfb,_0x25fb24){_0x25fb24=_0x25fb24||0xc8;return function(_0x82984f){if(_0x82984f){return _0x4b1bfb['status'](_0x25fb24)[_0x2d3a('0x18')](_0x82984f);}};}function respondWithFilteredResult(_0x404755,_0x54bf13){return function(_0x38e36a){if(_0x38e36a){var _0x1c75f0=typeof _0x54bf13[_0x2d3a('0x19')]===_0x2d3a('0x1a')&&typeof _0x54bf13[_0x2d3a('0x1b')]===_0x2d3a('0x1a');var _0x21f2eb=_0x38e36a['count'];var _0x49bc98=_0x1c75f0?0x0:_0x54bf13['offset'];var _0x905974=_0x1c75f0?_0x38e36a[_0x2d3a('0x1c')]:_0x54bf13[_0x2d3a('0x19')]+_0x54bf13[_0x2d3a('0x1b')];var _0x1651d9;if(_0x905974>=_0x21f2eb){_0x905974=_0x21f2eb;_0x1651d9=0xc8;}else{_0x1651d9=0xce;}_0x404755[_0x2d3a('0x17')](_0x1651d9);return _0x404755[_0x2d3a('0x1d')](_0x2d3a('0x1e'),_0x49bc98+'-'+_0x905974+'/'+_0x21f2eb)['json'](_0x38e36a);}return null;};}function patchUpdates(_0x15e105){return function(_0x3b711c){try{jsonpatch['apply'](_0x3b711c,_0x15e105,!![]);}catch(_0x555986){return BPromise[_0x2d3a('0x1f')](_0x555986);}return _0x3b711c['save']();};}function saveUpdates(_0x18aeaa,_0x5c341c){return function(_0x32ca58){if(_0x32ca58){return _0x32ca58[_0x2d3a('0x20')](_0x18aeaa)['then'](function(_0x2d9bde){return _0x2d9bde;});}return null;};}function removeEntity(_0x165c8b,_0x434df0){return function(_0x57b624){if(_0x57b624){return _0x57b624[_0x2d3a('0x21')]()[_0x2d3a('0x22')](function(){_0x165c8b[_0x2d3a('0x17')](0xcc)[_0x2d3a('0x23')]();});}};}function handleEntityNotFound(_0x4e9bb9,_0x417a8b){return function(_0x23f4a7){if(!_0x23f4a7){_0x4e9bb9[_0x2d3a('0x16')](0x194);}return _0x23f4a7;};}function handleError(_0x5cc140,_0x1abad8){_0x1abad8=_0x1abad8||0x1f4;return function(_0x2d7e59){logger[_0x2d3a('0x24')](_0x2d7e59['stack']);if(_0x2d7e59[_0x2d3a('0x25')]){delete _0x2d7e59[_0x2d3a('0x25')];}_0x5cc140[_0x2d3a('0x17')](_0x1abad8)['send'](_0x2d7e59);};}exports['index']=function(_0x3afa9a,_0x21890f){var _0x16466c={},_0x3f0c12={},_0x15a457={'count':0x0,'rows':[]};var _0x24fce8=_[_0x2d3a('0x26')](db[_0x2d3a('0x27')][_0x2d3a('0x28')],function(_0x12d6c7){return{'name':_0x12d6c7['fieldName'],'type':_0x12d6c7[_0x2d3a('0x29')][_0x2d3a('0x2a')]};});_0x3f0c12[_0x2d3a('0x2b')]=_['map'](_0x24fce8,_0x2d3a('0x25'));_0x3f0c12['query']=_[_0x2d3a('0x2c')](_0x3afa9a[_0x2d3a('0x2d')]);_0x3f0c12[_0x2d3a('0x2e')]=_['intersection'](_0x3f0c12[_0x2d3a('0x2b')],_0x3f0c12[_0x2d3a('0x2d')]);_0x16466c[_0x2d3a('0x2f')]=_[_0x2d3a('0x30')](_0x3f0c12[_0x2d3a('0x2b')],qs[_0x2d3a('0x31')](_0x3afa9a[_0x2d3a('0x2d')]['fields']));_0x16466c[_0x2d3a('0x2f')]=_0x16466c[_0x2d3a('0x2f')][_0x2d3a('0x32')]?_0x16466c[_0x2d3a('0x2f')]:_0x3f0c12[_0x2d3a('0x2b')];if(!_0x3afa9a[_0x2d3a('0x2d')]['hasOwnProperty'](_0x2d3a('0x33'))){_0x16466c[_0x2d3a('0x1b')]=qs[_0x2d3a('0x1b')](_0x3afa9a[_0x2d3a('0x2d')]['limit']);_0x16466c[_0x2d3a('0x19')]=qs[_0x2d3a('0x19')](_0x3afa9a[_0x2d3a('0x2d')][_0x2d3a('0x19')]);}_0x16466c[_0x2d3a('0x34')]=qs[_0x2d3a('0x35')](_0x3afa9a['query'][_0x2d3a('0x35')]);_0x16466c[_0x2d3a('0x36')]=qs[_0x2d3a('0x2e')](_[_0x2d3a('0x37')](_0x3afa9a[_0x2d3a('0x2d')],_0x3f0c12['filters']),_0x24fce8);if(_0x3afa9a[_0x2d3a('0x2d')][_0x2d3a('0x38')]){_0x16466c['where']=_[_0x2d3a('0x39')](_0x16466c['where'],{'$or':_[_0x2d3a('0x26')](_0x24fce8,function(_0x43f8b3){if(_0x43f8b3[_0x2d3a('0x29')]!==_0x2d3a('0x3a')){var _0x488975={};_0x488975[_0x43f8b3[_0x2d3a('0x25')]]={'$like':'%'+_0x3afa9a[_0x2d3a('0x2d')][_0x2d3a('0x38')]+'%'};return _0x488975;}})});}_0x16466c=_['merge']({},_0x16466c,_0x3afa9a[_0x2d3a('0x3b')]);var _0x1513e4={'where':_0x16466c[_0x2d3a('0x36')]};return db[_0x2d3a('0x27')][_0x2d3a('0x1c')](_0x1513e4)[_0x2d3a('0x22')](function(_0x1560c2){_0x15a457[_0x2d3a('0x1c')]=_0x1560c2;if(_0x3afa9a[_0x2d3a('0x2d')][_0x2d3a('0x3c')]){_0x16466c[_0x2d3a('0x3d')]=[{'all':!![]}];}return db[_0x2d3a('0x27')][_0x2d3a('0x3e')](_0x16466c);})['then'](function(_0x5d1cd1){_0x15a457['rows']=_0x5d1cd1;return _0x15a457;})[_0x2d3a('0x22')](respondWithFilteredResult(_0x21890f,_0x16466c))[_0x2d3a('0x3f')](handleError(_0x21890f,null));};exports[_0x2d3a('0x40')]=function(_0x4b4b06,_0x3d29f0){var _0x5c6ac0={'raw':!![],'where':{'id':_0x4b4b06[_0x2d3a('0x41')]['id']}},_0x457be8={};_0x457be8['model']=_['keys'](db['SquareReport'][_0x2d3a('0x28')]);_0x457be8[_0x2d3a('0x2d')]=_[_0x2d3a('0x2c')](_0x4b4b06[_0x2d3a('0x2d')]);_0x457be8[_0x2d3a('0x2e')]=_['intersection'](_0x457be8[_0x2d3a('0x2b')],_0x457be8[_0x2d3a('0x2d')]);_0x5c6ac0['attributes']=_[_0x2d3a('0x30')](_0x457be8['model'],qs[_0x2d3a('0x31')](_0x4b4b06[_0x2d3a('0x2d')][_0x2d3a('0x31')]));_0x5c6ac0['attributes']=_0x5c6ac0['attributes'][_0x2d3a('0x32')]?_0x5c6ac0[_0x2d3a('0x2f')]:_0x457be8[_0x2d3a('0x2b')];if(_0x4b4b06[_0x2d3a('0x2d')][_0x2d3a('0x3c')]){_0x5c6ac0[_0x2d3a('0x3d')]=[{'all':!![]}];}_0x5c6ac0=_['merge']({},_0x5c6ac0,_0x4b4b06[_0x2d3a('0x3b')]);return db['SquareReport'][_0x2d3a('0x42')](_0x5c6ac0)[_0x2d3a('0x22')](handleEntityNotFound(_0x3d29f0,null))[_0x2d3a('0x22')](respondWithResult(_0x3d29f0,null))[_0x2d3a('0x3f')](handleError(_0x3d29f0,null));};exports['create']=function(_0x2aca52,_0x518126){return db[_0x2d3a('0x27')][_0x2d3a('0x43')](_0x2aca52[_0x2d3a('0x44')],{})['then'](respondWithResult(_0x518126,0xc9))['catch'](handleError(_0x518126,null));};exports[_0x2d3a('0x20')]=function(_0x3723c1,_0x43af83){if(_0x3723c1[_0x2d3a('0x44')]['id']){delete _0x3723c1[_0x2d3a('0x44')]['id'];}return db[_0x2d3a('0x27')][_0x2d3a('0x42')]({'where':{'id':_0x3723c1[_0x2d3a('0x41')]['id']}})[_0x2d3a('0x22')](handleEntityNotFound(_0x43af83,null))[_0x2d3a('0x22')](saveUpdates(_0x3723c1[_0x2d3a('0x44')],null))[_0x2d3a('0x22')](respondWithResult(_0x43af83,null))['catch'](handleError(_0x43af83,null));};exports['destroy']=function(_0x4277a0,_0x186bb0){return db[_0x2d3a('0x27')]['find']({'where':{'id':_0x4277a0[_0x2d3a('0x41')]['id']}})[_0x2d3a('0x22')](handleEntityNotFound(_0x186bb0,null))[_0x2d3a('0x22')](removeEntity(_0x186bb0,null))['catch'](handleError(_0x186bb0,null));};exports[_0x2d3a('0x45')]=function(_0x23fcd8,_0x516868){return db[_0x2d3a('0x27')][_0x2d3a('0x45')]()[_0x2d3a('0x22')](respondWithResult(_0x516868,null))[_0x2d3a('0x3f')](handleError(_0x516868,null));}; \ No newline at end of file +var _0x731b=['sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x731b,0x190));var _0xb731=function(_0x27ca5b,_0x41becd){_0x27ca5b=_0x27ca5b-0x0;var _0x57021e=_0x731b[_0x27ca5b];return _0x57021e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb731('0x0'));var zipdir=require(_0xb731('0x1'));var jsonpatch=require(_0xb731('0x2'));var rp=require(_0xb731('0x3'));var moment=require(_0xb731('0x4'));var BPromise=require(_0xb731('0x5'));var Mustache=require('mustache');var util=require(_0xb731('0x6'));var path=require('path');var sox=require(_0xb731('0x7'));var csv=require(_0xb731('0x8'));var ejs=require(_0xb731('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb731('0xa'));var crypto=require('crypto');var jsforce=require(_0xb731('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb731('0x8'));var querystring=require(_0xb731('0xc'));var Papa=require(_0xb731('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb731('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb731('0xf'));var logger=require(_0xb731('0x10'))(_0xb731('0x11'));var utils=require(_0xb731('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb731('0x13'))['db'];function respondWithStatusCode(_0x4a2c03,_0x102ff6){_0x102ff6=_0x102ff6||0xcc;return function(_0x1f2bb8){if(_0x1f2bb8){return _0x4a2c03[_0xb731('0x14')](_0x102ff6);}return _0x4a2c03[_0xb731('0x15')](_0x102ff6)[_0xb731('0x16')]();};}function respondWithResult(_0x2eb73d,_0x559e37){_0x559e37=_0x559e37||0xc8;return function(_0x1d940e){if(_0x1d940e){return _0x2eb73d['status'](_0x559e37)[_0xb731('0x17')](_0x1d940e);}};}function respondWithFilteredResult(_0x4e75b3,_0x5de223){return function(_0x2485e0){if(_0x2485e0){var _0x18d61a=typeof _0x5de223[_0xb731('0x18')]===_0xb731('0x19')&&typeof _0x5de223['limit']==='undefined';var _0x599b24=_0x2485e0[_0xb731('0x1a')];var _0x1d2f7e=_0x18d61a?0x0:_0x5de223[_0xb731('0x18')];var _0x5ef6fc=_0x18d61a?_0x2485e0[_0xb731('0x1a')]:_0x5de223['offset']+_0x5de223[_0xb731('0x1b')];var _0x562417;if(_0x5ef6fc>=_0x599b24){_0x5ef6fc=_0x599b24;_0x562417=0xc8;}else{_0x562417=0xce;}_0x4e75b3[_0xb731('0x15')](_0x562417);return _0x4e75b3['set'](_0xb731('0x1c'),_0x1d2f7e+'-'+_0x5ef6fc+'/'+_0x599b24)[_0xb731('0x17')](_0x2485e0);}return null;};}function patchUpdates(_0x302049){return function(_0x3f7c9d){try{jsonpatch['apply'](_0x3f7c9d,_0x302049,!![]);}catch(_0x13c3e3){return BPromise[_0xb731('0x1d')](_0x13c3e3);}return _0x3f7c9d[_0xb731('0x1e')]();};}function saveUpdates(_0x829da,_0x5b2ca0){return function(_0x4c5471){if(_0x4c5471){return _0x4c5471[_0xb731('0x1f')](_0x829da)['then'](function(_0x9f7cb4){return _0x9f7cb4;});}return null;};}function removeEntity(_0x1aa981,_0x31dcc6){return function(_0x44d775){if(_0x44d775){return _0x44d775[_0xb731('0x20')]()[_0xb731('0x21')](function(){_0x1aa981[_0xb731('0x15')](0xcc)[_0xb731('0x16')]();});}};}function handleEntityNotFound(_0x4d918c,_0x56dcac){return function(_0x4127bf){if(!_0x4127bf){_0x4d918c[_0xb731('0x14')](0x194);}return _0x4127bf;};}function handleError(_0xdaea94,_0x48450f){_0x48450f=_0x48450f||0x1f4;return function(_0x177ab3){logger[_0xb731('0x22')](_0x177ab3[_0xb731('0x23')]);if(_0x177ab3[_0xb731('0x24')]){delete _0x177ab3[_0xb731('0x24')];}_0xdaea94['status'](_0x48450f)['send'](_0x177ab3);};}exports[_0xb731('0x25')]=function(_0x1f8230,_0x4c0707){var _0x44e69e={},_0x355d14={},_0x57f09e={'count':0x0,'rows':[]};var _0x235182=_[_0xb731('0x26')](db[_0xb731('0x27')][_0xb731('0x28')],function(_0x48f34f){return{'name':_0x48f34f[_0xb731('0x29')],'type':_0x48f34f['type'][_0xb731('0x2a')]};});_0x355d14[_0xb731('0x2b')]=_[_0xb731('0x26')](_0x235182,_0xb731('0x24'));_0x355d14[_0xb731('0x2c')]=_[_0xb731('0x2d')](_0x1f8230[_0xb731('0x2c')]);_0x355d14['filters']=_['intersection'](_0x355d14[_0xb731('0x2b')],_0x355d14['query']);_0x44e69e[_0xb731('0x2e')]=_[_0xb731('0x2f')](_0x355d14[_0xb731('0x2b')],qs[_0xb731('0x30')](_0x1f8230[_0xb731('0x2c')]['fields']));_0x44e69e[_0xb731('0x2e')]=_0x44e69e['attributes'][_0xb731('0x31')]?_0x44e69e[_0xb731('0x2e')]:_0x355d14[_0xb731('0x2b')];if(!_0x1f8230[_0xb731('0x2c')][_0xb731('0x32')](_0xb731('0x33'))){_0x44e69e[_0xb731('0x1b')]=qs['limit'](_0x1f8230[_0xb731('0x2c')][_0xb731('0x1b')]);_0x44e69e[_0xb731('0x18')]=qs[_0xb731('0x18')](_0x1f8230[_0xb731('0x2c')][_0xb731('0x18')]);}_0x44e69e['order']=qs['sort'](_0x1f8230[_0xb731('0x2c')]['sort']);_0x44e69e[_0xb731('0x34')]=qs['filters'](_[_0xb731('0x35')](_0x1f8230['query'],_0x355d14['filters']),_0x235182);if(_0x1f8230[_0xb731('0x2c')][_0xb731('0x36')]){_0x44e69e['where']=_[_0xb731('0x37')](_0x44e69e[_0xb731('0x34')],{'$or':_[_0xb731('0x26')](_0x235182,function(_0x4dffa6){if(_0x4dffa6[_0xb731('0x38')]!==_0xb731('0x39')){var _0x10d82e={};_0x10d82e[_0x4dffa6[_0xb731('0x24')]]={'$like':'%'+_0x1f8230[_0xb731('0x2c')][_0xb731('0x36')]+'%'};return _0x10d82e;}})});}_0x44e69e=_['merge']({},_0x44e69e,_0x1f8230[_0xb731('0x3a')]);var _0x104b7d={'where':_0x44e69e[_0xb731('0x34')]};return db[_0xb731('0x27')][_0xb731('0x1a')](_0x104b7d)[_0xb731('0x21')](function(_0x5dd7fb){_0x57f09e[_0xb731('0x1a')]=_0x5dd7fb;if(_0x1f8230['query'][_0xb731('0x3b')]){_0x44e69e[_0xb731('0x3c')]=[{'all':!![]}];}return db[_0xb731('0x27')][_0xb731('0x3d')](_0x44e69e);})[_0xb731('0x21')](function(_0x3a851e){_0x57f09e[_0xb731('0x3e')]=_0x3a851e;return _0x57f09e;})[_0xb731('0x21')](respondWithFilteredResult(_0x4c0707,_0x44e69e))[_0xb731('0x3f')](handleError(_0x4c0707,null));};exports[_0xb731('0x40')]=function(_0x8b9f95,_0x5e408d){var _0x586dc2={'raw':!![],'where':{'id':_0x8b9f95[_0xb731('0x41')]['id']}},_0x126c31={};_0x126c31[_0xb731('0x2b')]=_[_0xb731('0x2d')](db['SquareReport'][_0xb731('0x28')]);_0x126c31[_0xb731('0x2c')]=_[_0xb731('0x2d')](_0x8b9f95[_0xb731('0x2c')]);_0x126c31[_0xb731('0x42')]=_[_0xb731('0x2f')](_0x126c31['model'],_0x126c31[_0xb731('0x2c')]);_0x586dc2[_0xb731('0x2e')]=_['intersection'](_0x126c31[_0xb731('0x2b')],qs[_0xb731('0x30')](_0x8b9f95[_0xb731('0x2c')][_0xb731('0x30')]));_0x586dc2['attributes']=_0x586dc2['attributes'][_0xb731('0x31')]?_0x586dc2[_0xb731('0x2e')]:_0x126c31[_0xb731('0x2b')];if(_0x8b9f95['query'][_0xb731('0x3b')]){_0x586dc2['include']=[{'all':!![]}];}_0x586dc2=_[_0xb731('0x37')]({},_0x586dc2,_0x8b9f95[_0xb731('0x3a')]);return db[_0xb731('0x27')][_0xb731('0x43')](_0x586dc2)[_0xb731('0x21')](handleEntityNotFound(_0x5e408d,null))[_0xb731('0x21')](respondWithResult(_0x5e408d,null))['catch'](handleError(_0x5e408d,null));};exports['create']=function(_0x17669d,_0x3d10db){return db['SquareReport']['create'](_0x17669d[_0xb731('0x44')],{})[_0xb731('0x21')](respondWithResult(_0x3d10db,0xc9))[_0xb731('0x3f')](handleError(_0x3d10db,null));};exports['update']=function(_0x46546d,_0x374c28){if(_0x46546d[_0xb731('0x44')]['id']){delete _0x46546d['body']['id'];}return db['SquareReport']['find']({'where':{'id':_0x46546d[_0xb731('0x41')]['id']}})[_0xb731('0x21')](handleEntityNotFound(_0x374c28,null))['then'](saveUpdates(_0x46546d[_0xb731('0x44')],null))[_0xb731('0x21')](respondWithResult(_0x374c28,null))[_0xb731('0x3f')](handleError(_0x374c28,null));};exports[_0xb731('0x20')]=function(_0x43341a,_0x13d345){return db[_0xb731('0x27')][_0xb731('0x43')]({'where':{'id':_0x43341a['params']['id']}})[_0xb731('0x21')](handleEntityNotFound(_0x13d345,null))[_0xb731('0x21')](removeEntity(_0x13d345,null))[_0xb731('0x3f')](handleError(_0x13d345,null));};exports[_0xb731('0x45')]=function(_0x5e9286,_0xeeef65){return db[_0xb731('0x27')][_0xb731('0x45')]()[_0xb731('0x21')](respondWithResult(_0xeeef65,null))[_0xb731('0x3f')](handleError(_0xeeef65,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 968824c..49a9e85 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 _0x7519=['leaveAt','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uniqueid','project_name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7519,0x160));var _0x9751=function(_0x383125,_0x176638){_0x383125=_0x383125-0x0;var _0x37d1b6=_0x7519[_0x383125];return _0x37d1b6;};'use strict';var _=require('lodash');var util=require(_0x9751('0x0'));var logger=require(_0x9751('0x1'))('api');var moment=require(_0x9751('0x2'));var BPromise=require(_0x9751('0x3'));var rp=require(_0x9751('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9751('0x5'));var attributes=require(_0x9751('0x6'));module['exports']=function(_0x5ef94d,_0x4568){return _0x5ef94d[_0x9751('0x7')](_0x9751('0x8'),attributes,{'tableName':_0x9751('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x9751('0xa'),_0x9751('0xb')]},{'name':_0x9751('0xc'),'fields':[_0x9751('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0691=['../../config/environment','define','SquareReport','report_square','uniqueid','project_name','leaveAt','util','moment','bluebird','path','rimraf'];(function(_0x5622d4,_0x396780){var _0x353176=function(_0x3d1ede){while(--_0x3d1ede){_0x5622d4['push'](_0x5622d4['shift']());}};_0x353176(++_0x396780);}(_0x0691,0x133));var _0x1069=function(_0x5ee908,_0x1ef159){_0x5ee908=_0x5ee908-0x0;var _0x4aebf3=_0x0691[_0x5ee908];return _0x4aebf3;};'use strict';var _=require('lodash');var util=require(_0x1069('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1069('0x1'));var BPromise=require(_0x1069('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1069('0x3'));var rimraf=require(_0x1069('0x4'));var config=require(_0x1069('0x5'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x1a0a7e,_0x3f2ddb){return _0x1a0a7e[_0x1069('0x6')](_0x1069('0x7'),attributes,{'tableName':_0x1069('0x8'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1069('0x9'),_0x1069('0xa')]},{'name':_0x1069('0xb'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 5d142d1..83999dc 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 _0xecfd=['../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0xecfd,0x7f));var _0xdecf=function(_0x344972,_0x39ba31){_0x344972=_0x344972-0x0;var _0x5a6ca1=_0xecfd[_0x344972];return _0x5a6ca1;};'use strict';var _=require(_0xdecf('0x0'));var util=require('util');var moment=require(_0xdecf('0x1'));var BPromise=require(_0xdecf('0x2'));var rs=require(_0xdecf('0x3'));var fs=require('fs');var Redis=require(_0xdecf('0x4'));var db=require(_0xdecf('0x5'))['db'];var utils=require(_0xdecf('0x6'));var logger=require(_0xdecf('0x7'))(_0xdecf('0x8'));var config=require(_0xdecf('0x9'));var jayson=require(_0xdecf('0xa'));var client=jayson[_0xdecf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x295eff,_0x37eac6,_0x375b19){return new BPromise(function(_0x1a1583,_0xff1424){return client[_0xdecf('0xc')](_0x295eff,_0x375b19)[_0xdecf('0xd')](function(_0x37d75d){logger[_0xdecf('0xe')](_0xdecf('0xf'),_0x37eac6,_0xdecf('0x10'));logger[_0xdecf('0x11')](_0xdecf('0x12'),_0x37eac6,_0xdecf('0x10'),JSON[_0xdecf('0x13')](_0x37d75d));if(_0x37d75d[_0xdecf('0x14')]){if(_0x37d75d[_0xdecf('0x14')][_0xdecf('0x15')]===0x1f4){logger['error'](_0xdecf('0xf'),_0x37eac6,_0x37d75d['error'][_0xdecf('0x16')]);return _0xff1424(_0x37d75d[_0xdecf('0x14')][_0xdecf('0x16')]);}logger[_0xdecf('0x14')](_0xdecf('0xf'),_0x37eac6,_0x37d75d[_0xdecf('0x14')][_0xdecf('0x16')]);return _0x1a1583(_0x37d75d[_0xdecf('0x14')]['message']);}else{logger[_0xdecf('0xe')](_0xdecf('0xf'),_0x37eac6,_0xdecf('0x10'));_0x1a1583(_0x37d75d['result'][_0xdecf('0x16')]);}})[_0xdecf('0x17')](function(_0x1e5c1a){logger[_0xdecf('0x14')](_0xdecf('0xf'),_0x37eac6,_0x1e5c1a);_0xff1424(_0x1e5c1a);});});}exports[_0xdecf('0x18')]=function(_0x3be85b){var _0x27e8dd=this;return new Promise(function(_0x490b2d,_0x3adb4){return db['SquareReport'][_0xdecf('0x19')](_0x3be85b[_0xdecf('0x1a')],{'raw':_0x3be85b[_0xdecf('0x1b')]?_0x3be85b['options'][_0xdecf('0x1c')]===undefined?!![]:![]:!![]})[_0xdecf('0xd')](function(_0x100ee8){logger[_0xdecf('0xe')](_0xdecf('0x18'),_0x3be85b);logger['debug'](_0xdecf('0x18'),_0x3be85b,JSON[_0xdecf('0x13')](_0x100ee8));_0x490b2d(_0x100ee8);})[_0xdecf('0x17')](function(_0x603592){logger[_0xdecf('0x14')](_0xdecf('0x18'),_0x603592[_0xdecf('0x16')],_0x3be85b);_0x3adb4(_0x27e8dd[_0xdecf('0x14')](0x1f4,_0x603592[_0xdecf('0x16')]));});});};exports[_0xdecf('0x1d')]=function(_0x1d6ff7){var _0x458729=this;return new Promise(function(_0x259f9a,_0x40b8ce){return db[_0xdecf('0x1e')][_0xdecf('0x1f')](_0x1d6ff7[_0xdecf('0x1a')],{'raw':_0x1d6ff7[_0xdecf('0x1b')]?_0x1d6ff7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d6ff7[_0xdecf('0x1b')]?_0x1d6ff7[_0xdecf('0x1b')][_0xdecf('0x20')]||null:null,'attributes':_0x1d6ff7[_0xdecf('0x1b')]?_0x1d6ff7[_0xdecf('0x1b')]['attributes']||null:null,'limit':_0x1d6ff7[_0xdecf('0x1b')]?_0x1d6ff7['options'][_0xdecf('0x21')]||null:null})[_0xdecf('0xd')](function(_0xfeca18){logger[_0xdecf('0xe')](_0xdecf('0x1d'),_0x1d6ff7);logger[_0xdecf('0x11')](_0xdecf('0x1d'),_0x1d6ff7,JSON[_0xdecf('0x13')](_0xfeca18));_0x259f9a(_0xfeca18);})[_0xdecf('0x17')](function(_0x3b8676){logger[_0xdecf('0x14')]('UpdateSquareReport',_0x3b8676[_0xdecf('0x16')],_0x1d6ff7);_0x40b8ce(_0x458729['error'](0x1f4,_0x3b8676[_0xdecf('0x16')]));});});}; \ No newline at end of file +var _0x471a=['UpdateSquareReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','body','options','raw','update','where','attributes','limit'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x471a,0xa6));var _0xa471=function(_0xf549a4,_0x58c9cd){_0xf549a4=_0xf549a4-0x0;var _0x57bf42=_0x471a[_0xf549a4];return _0x57bf42;};'use strict';var _=require('lodash');var util=require(_0xa471('0x0'));var moment=require(_0xa471('0x1'));var BPromise=require('bluebird');var rs=require(_0xa471('0x2'));var fs=require('fs');var Redis=require(_0xa471('0x3'));var db=require(_0xa471('0x4'))['db'];var utils=require(_0xa471('0x5'));var logger=require(_0xa471('0x6'))('rpc');var config=require(_0xa471('0x7'));var jayson=require(_0xa471('0x8'));var client=jayson[_0xa471('0x9')][_0xa471('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7e7d19,_0x24e934,_0x537702){return new BPromise(function(_0x33df99,_0x239fb8){return client[_0xa471('0xb')](_0x7e7d19,_0x537702)[_0xa471('0xc')](function(_0x11dccf){logger[_0xa471('0xd')]('SquareReport,\x20%s,\x20%s',_0x24e934,_0xa471('0xe'));logger['debug'](_0xa471('0xf'),_0x24e934,'request\x20sent',JSON[_0xa471('0x10')](_0x11dccf));if(_0x11dccf[_0xa471('0x11')]){if(_0x11dccf[_0xa471('0x11')][_0xa471('0x12')]===0x1f4){logger[_0xa471('0x11')](_0xa471('0x13'),_0x24e934,_0x11dccf[_0xa471('0x11')][_0xa471('0x14')]);return _0x239fb8(_0x11dccf['error'][_0xa471('0x14')]);}logger[_0xa471('0x11')](_0xa471('0x13'),_0x24e934,_0x11dccf['error'][_0xa471('0x14')]);return _0x33df99(_0x11dccf[_0xa471('0x11')][_0xa471('0x14')]);}else{logger[_0xa471('0xd')](_0xa471('0x13'),_0x24e934,_0xa471('0xe'));_0x33df99(_0x11dccf[_0xa471('0x15')][_0xa471('0x14')]);}})[_0xa471('0x16')](function(_0x426641){logger[_0xa471('0x11')](_0xa471('0x13'),_0x24e934,_0x426641);_0x239fb8(_0x426641);});});}exports[_0xa471('0x17')]=function(_0x28e71c){var _0x455a71=this;return new Promise(function(_0xca39f,_0x22f3b9){return db['SquareReport'][_0xa471('0x18')](_0x28e71c[_0xa471('0x19')],{'raw':_0x28e71c['options']?_0x28e71c[_0xa471('0x1a')][_0xa471('0x1b')]===undefined?!![]:![]:!![]})[_0xa471('0xc')](function(_0xae7633){logger[_0xa471('0xd')]('CreateSquareReport',_0x28e71c);logger['debug'](_0xa471('0x17'),_0x28e71c,JSON[_0xa471('0x10')](_0xae7633));_0xca39f(_0xae7633);})[_0xa471('0x16')](function(_0x4f476a){logger[_0xa471('0x11')](_0xa471('0x17'),_0x4f476a[_0xa471('0x14')],_0x28e71c);_0x22f3b9(_0x455a71[_0xa471('0x11')](0x1f4,_0x4f476a['message']));});});};exports['UpdateSquareReport']=function(_0x4b101b){var _0x3a04b2=this;return new Promise(function(_0x5f3f3d,_0x42ae0f){return db['SquareReport'][_0xa471('0x1c')](_0x4b101b[_0xa471('0x19')],{'raw':_0x4b101b[_0xa471('0x1a')]?_0x4b101b[_0xa471('0x1a')][_0xa471('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b101b[_0xa471('0x1a')]?_0x4b101b[_0xa471('0x1a')][_0xa471('0x1d')]||null:null,'attributes':_0x4b101b['options']?_0x4b101b[_0xa471('0x1a')][_0xa471('0x1e')]||null:null,'limit':_0x4b101b[_0xa471('0x1a')]?_0x4b101b[_0xa471('0x1a')][_0xa471('0x1f')]||null:null})[_0xa471('0xc')](function(_0x582693){logger[_0xa471('0xd')](_0xa471('0x20'),_0x4b101b);logger['debug']('UpdateSquareReport',_0x4b101b,JSON[_0xa471('0x10')](_0x582693));_0x5f3f3d(_0x582693);})[_0xa471('0x16')](function(_0x438f3a){logger[_0xa471('0x11')](_0xa471('0x20'),_0x438f3a[_0xa471('0x14')],_0x4b101b);_0x42ae0f(_0x3a04b2['error'](0x1f4,_0x438f3a[_0xa471('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c6b211f..d8e79f9 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 _0x88d2=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','show','post','create','put'];(function(_0x1852b9,_0x2dde2f){var _0x4b6a84=function(_0x1ef71e){while(--_0x1ef71e){_0x1852b9['push'](_0x1852b9['shift']());}};_0x4b6a84(++_0x2dde2f);}(_0x88d2,0x193));var _0x288d=function(_0x44b75a,_0xd3888d){_0x44b75a=_0x44b75a-0x0;var _0x1c0928=_0x88d2[_0x44b75a];return _0x1c0928;};'use strict';var multer=require(_0x288d('0x0'));var util=require(_0x288d('0x1'));var path=require(_0x288d('0x2'));var timeout=require(_0x288d('0x3'));var express=require(_0x288d('0x4'));var router=express[_0x288d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x288d('0x6'));var interaction=require(_0x288d('0x7'));var config=require('../../config/environment');var controller=require(_0x288d('0x8'));router[_0x288d('0x9')]('/',auth[_0x288d('0xa')](),controller['index']);router[_0x288d('0x9')](_0x288d('0xb'),auth[_0x288d('0xa')](),controller[_0x288d('0xc')]);router['get']('/:id',auth[_0x288d('0xa')](),controller[_0x288d('0xd')]);router[_0x288d('0xe')]('/',auth[_0x288d('0xa')](),controller[_0x288d('0xf')]);router[_0x288d('0x10')](_0x288d('0x11'),auth['isAuthenticated'](),controller[_0x288d('0x12')]);router['delete'](_0x288d('0x11'),auth[_0x288d('0xa')](),controller[_0x288d('0x13')]);module[_0x288d('0x14')]=router; \ No newline at end of file +var _0x0d03=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','show','create','put','delete','/:id','destroy','multer','util'];(function(_0xe47217,_0x3a35db){var _0x3dc84c=function(_0x2b5480){while(--_0x2b5480){_0xe47217['push'](_0xe47217['shift']());}};_0x3dc84c(++_0x3a35db);}(_0x0d03,0xfa));var _0x30d0=function(_0x3bedc9,_0x5587e9){_0x3bedc9=_0x3bedc9-0x0;var _0x1e86aa=_0x0d03[_0x3bedc9];return _0x1e86aa;};'use strict';var multer=require(_0x30d0('0x0'));var util=require(_0x30d0('0x1'));var path=require(_0x30d0('0x2'));var timeout=require(_0x30d0('0x3'));var express=require(_0x30d0('0x4'));var router=express['Router']();var fs_extra=require(_0x30d0('0x5'));var auth=require(_0x30d0('0x6'));var interaction=require(_0x30d0('0x7'));var config=require(_0x30d0('0x8'));var controller=require(_0x30d0('0x9'));router[_0x30d0('0xa')]('/',auth['isAuthenticated'](),controller[_0x30d0('0xb')]);router[_0x30d0('0xa')](_0x30d0('0xc'),auth[_0x30d0('0xd')](),controller[_0x30d0('0xe')]);router[_0x30d0('0xa')]('/:id',auth[_0x30d0('0xd')](),controller[_0x30d0('0xf')]);router['post']('/',auth[_0x30d0('0xd')](),controller[_0x30d0('0x10')]);router[_0x30d0('0x11')]('/:id',auth[_0x30d0('0xd')](),controller['update']);router[_0x30d0('0x12')](_0x30d0('0x13'),auth[_0x30d0('0xd')](),controller[_0x30d0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 993fc6a..e43510c 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 _0x9fe6=['sequelize','exports','STRING','TEXT'];(function(_0x2b0ae7,_0x2f9405){var _0x92a676=function(_0x3154b4){while(--_0x3154b4){_0x2b0ae7['push'](_0x2b0ae7['shift']());}};_0x92a676(++_0x2f9405);}(_0x9fe6,0xb4));var _0x69fe=function(_0x2d5297,_0xb5220f){_0x2d5297=_0x2d5297-0x0;var _0x4cce94=_0x9fe6[_0x2d5297];return _0x4cce94;};'use strict';var Sequelize=require(_0x69fe('0x0'));module[_0x69fe('0x1')]={'uniqueid':{'type':Sequelize[_0x69fe('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x69fe('0x2')]},'data':{'type':Sequelize[_0x69fe('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x69fe('0x2')]}}; \ No newline at end of file +var _0x895c=['STRING','sequelize','exports'];(function(_0xc8ffa5,_0x1fd15f){var _0x35bc1b=function(_0x41bfa9){while(--_0x41bfa9){_0xc8ffa5['push'](_0xc8ffa5['shift']());}};_0x35bc1b(++_0x1fd15f);}(_0x895c,0xdc));var _0xc895=function(_0x1db9e7,_0xc84467){_0x1db9e7=_0x1db9e7-0x0;var _0x8109c8=_0x895c[_0x1db9e7];return _0x8109c8;};'use strict';var Sequelize=require(_0xc895('0x0'));module[_0xc895('0x1')]={'uniqueid':{'type':Sequelize[_0xc895('0x2')]},'node':{'type':Sequelize[_0xc895('0x2')]},'application':{'type':Sequelize[_0xc895('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xc895('0x2')]},'callerid':{'type':Sequelize[_0xc895('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 2c0db56..2e4039a 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 _0x6baa=['count','limit','Content-Range','apply','reject','save','update','then','name','send','index','map','SquareDetailsReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','options','find','create','body','catch','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x4e163c,_0x26e42c){var _0x15f2e7=function(_0x27dc5e){while(--_0x27dc5e){_0x4e163c['push'](_0x4e163c['shift']());}};_0x15f2e7(++_0x26e42c);}(_0x6baa,0x1e2));var _0xa6ba=function(_0x215662,_0x462187){_0x215662=_0x215662-0x0;var _0x24d40b=_0x6baa[_0x215662];return _0x24d40b;};'use strict';var emlformat=require(_0xa6ba('0x0'));var rimraf=require(_0xa6ba('0x1'));var zipdir=require(_0xa6ba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6ba('0x3'));var moment=require(_0xa6ba('0x4'));var BPromise=require(_0xa6ba('0x5'));var Mustache=require('mustache');var util=require(_0xa6ba('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa6ba('0x7'));var fs=require('fs');var fs_extra=require(_0xa6ba('0x8'));var _=require('lodash');var squel=require(_0xa6ba('0x9'));var crypto=require(_0xa6ba('0xa'));var jsforce=require(_0xa6ba('0xb'));var deskjs=require(_0xa6ba('0xc'));var toCsv=require(_0xa6ba('0xd'));var querystring=require(_0xa6ba('0xe'));var Papa=require(_0xa6ba('0xf'));var Redis=require(_0xa6ba('0x10'));var authService=require(_0xa6ba('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6ba('0x12'));var logger=require(_0xa6ba('0x13'))(_0xa6ba('0x14'));var utils=require(_0xa6ba('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa6ba('0x16'))['db'];function respondWithStatusCode(_0xdedbd7,_0x503dd1){_0x503dd1=_0x503dd1||0xcc;return function(_0x5a0659){if(_0x5a0659){return _0xdedbd7[_0xa6ba('0x17')](_0x503dd1);}return _0xdedbd7[_0xa6ba('0x18')](_0x503dd1)[_0xa6ba('0x19')]();};}function respondWithResult(_0xf26832,_0x436d47){_0x436d47=_0x436d47||0xc8;return function(_0x528a6e){if(_0x528a6e){return _0xf26832[_0xa6ba('0x18')](_0x436d47)[_0xa6ba('0x1a')](_0x528a6e);}};}function respondWithFilteredResult(_0x34f453,_0x176b77){return function(_0x2a56fd){if(_0x2a56fd){var _0x570387=typeof _0x176b77[_0xa6ba('0x1b')]===_0xa6ba('0x1c')&&typeof _0x176b77['limit']==='undefined';var _0x24c040=_0x2a56fd['count'];var _0x350064=_0x570387?0x0:_0x176b77[_0xa6ba('0x1b')];var _0x37020f=_0x570387?_0x2a56fd[_0xa6ba('0x1d')]:_0x176b77[_0xa6ba('0x1b')]+_0x176b77[_0xa6ba('0x1e')];var _0x51698e;if(_0x37020f>=_0x24c040){_0x37020f=_0x24c040;_0x51698e=0xc8;}else{_0x51698e=0xce;}_0x34f453['status'](_0x51698e);return _0x34f453['set'](_0xa6ba('0x1f'),_0x350064+'-'+_0x37020f+'/'+_0x24c040)[_0xa6ba('0x1a')](_0x2a56fd);}return null;};}function patchUpdates(_0x3c5de9){return function(_0x5f3da8){try{jsonpatch[_0xa6ba('0x20')](_0x5f3da8,_0x3c5de9,!![]);}catch(_0x2ec14b){return BPromise[_0xa6ba('0x21')](_0x2ec14b);}return _0x5f3da8[_0xa6ba('0x22')]();};}function saveUpdates(_0x13ebff,_0x4a1a30){return function(_0x30013b){if(_0x30013b){return _0x30013b[_0xa6ba('0x23')](_0x13ebff)[_0xa6ba('0x24')](function(_0x156ddd){return _0x156ddd;});}return null;};}function removeEntity(_0x38bbcd,_0x2a5aca){return function(_0x16f90d){if(_0x16f90d){return _0x16f90d['destroy']()[_0xa6ba('0x24')](function(){_0x38bbcd[_0xa6ba('0x18')](0xcc)[_0xa6ba('0x19')]();});}};}function handleEntityNotFound(_0x3edb48,_0x2dbfa2){return function(_0x492135){if(!_0x492135){_0x3edb48['sendStatus'](0x194);}return _0x492135;};}function handleError(_0x23bd03,_0x26c956){_0x26c956=_0x26c956||0x1f4;return function(_0x148fcd){logger['error'](_0x148fcd['stack']);if(_0x148fcd[_0xa6ba('0x25')]){delete _0x148fcd[_0xa6ba('0x25')];}_0x23bd03[_0xa6ba('0x18')](_0x26c956)[_0xa6ba('0x26')](_0x148fcd);};}exports[_0xa6ba('0x27')]=function(_0x162d76,_0x2098df){var _0x5bf853={},_0x1dfc99={},_0x37e22e={'count':0x0,'rows':[]};var _0x808320=_[_0xa6ba('0x28')](db[_0xa6ba('0x29')][_0xa6ba('0x2a')],function(_0x105773){return{'name':_0x105773['fieldName'],'type':_0x105773['type'][_0xa6ba('0x2b')]};});_0x1dfc99[_0xa6ba('0x2c')]=_[_0xa6ba('0x28')](_0x808320,'name');_0x1dfc99[_0xa6ba('0x2d')]=_[_0xa6ba('0x2e')](_0x162d76[_0xa6ba('0x2d')]);_0x1dfc99[_0xa6ba('0x2f')]=_[_0xa6ba('0x30')](_0x1dfc99[_0xa6ba('0x2c')],_0x1dfc99['query']);_0x5bf853[_0xa6ba('0x31')]=_['intersection'](_0x1dfc99['model'],qs[_0xa6ba('0x32')](_0x162d76['query'][_0xa6ba('0x32')]));_0x5bf853['attributes']=_0x5bf853['attributes'][_0xa6ba('0x33')]?_0x5bf853[_0xa6ba('0x31')]:_0x1dfc99[_0xa6ba('0x2c')];if(!_0x162d76[_0xa6ba('0x2d')][_0xa6ba('0x34')](_0xa6ba('0x35'))){_0x5bf853[_0xa6ba('0x1e')]=qs[_0xa6ba('0x1e')](_0x162d76[_0xa6ba('0x2d')][_0xa6ba('0x1e')]);_0x5bf853[_0xa6ba('0x1b')]=qs[_0xa6ba('0x1b')](_0x162d76['query']['offset']);}_0x5bf853[_0xa6ba('0x36')]=qs[_0xa6ba('0x37')](_0x162d76[_0xa6ba('0x2d')][_0xa6ba('0x37')]);_0x5bf853[_0xa6ba('0x38')]=qs[_0xa6ba('0x2f')](_[_0xa6ba('0x39')](_0x162d76[_0xa6ba('0x2d')],_0x1dfc99[_0xa6ba('0x2f')]),_0x808320);if(_0x162d76['query'][_0xa6ba('0x3a')]){_0x5bf853[_0xa6ba('0x38')]=_[_0xa6ba('0x3b')](_0x5bf853[_0xa6ba('0x38')],{'$or':_['map'](_0x808320,function(_0x212654){if(_0x212654[_0xa6ba('0x3c')]!==_0xa6ba('0x3d')){var _0x43b1dc={};_0x43b1dc[_0x212654[_0xa6ba('0x25')]]={'$like':'%'+_0x162d76[_0xa6ba('0x2d')][_0xa6ba('0x3a')]+'%'};return _0x43b1dc;}})});}_0x5bf853=_[_0xa6ba('0x3b')]({},_0x5bf853,_0x162d76['options']);var _0x2d11d7={'where':_0x5bf853['where']};return db[_0xa6ba('0x29')][_0xa6ba('0x1d')](_0x2d11d7)[_0xa6ba('0x24')](function(_0x24f95a){_0x37e22e['count']=_0x24f95a;if(_0x162d76[_0xa6ba('0x2d')][_0xa6ba('0x3e')]){_0x5bf853[_0xa6ba('0x3f')]=[{'all':!![]}];}return db[_0xa6ba('0x29')][_0xa6ba('0x40')](_0x5bf853);})[_0xa6ba('0x24')](function(_0x30cbf1){_0x37e22e[_0xa6ba('0x41')]=_0x30cbf1;return _0x37e22e;})['then'](respondWithFilteredResult(_0x2098df,_0x5bf853))['catch'](handleError(_0x2098df,null));};exports[_0xa6ba('0x42')]=function(_0x1b21c2,_0x4a8734){var _0x1dc3ae={'raw':!![],'where':{'id':_0x1b21c2['params']['id']}},_0x410b9f={};_0x410b9f[_0xa6ba('0x2c')]=_[_0xa6ba('0x2e')](db[_0xa6ba('0x29')][_0xa6ba('0x2a')]);_0x410b9f[_0xa6ba('0x2d')]=_[_0xa6ba('0x2e')](_0x1b21c2['query']);_0x410b9f['filters']=_[_0xa6ba('0x30')](_0x410b9f[_0xa6ba('0x2c')],_0x410b9f['query']);_0x1dc3ae[_0xa6ba('0x31')]=_[_0xa6ba('0x30')](_0x410b9f[_0xa6ba('0x2c')],qs['fields'](_0x1b21c2[_0xa6ba('0x2d')][_0xa6ba('0x32')]));_0x1dc3ae[_0xa6ba('0x31')]=_0x1dc3ae[_0xa6ba('0x31')]['length']?_0x1dc3ae[_0xa6ba('0x31')]:_0x410b9f[_0xa6ba('0x2c')];if(_0x1b21c2[_0xa6ba('0x2d')][_0xa6ba('0x3e')]){_0x1dc3ae['include']=[{'all':!![]}];}_0x1dc3ae=_[_0xa6ba('0x3b')]({},_0x1dc3ae,_0x1b21c2[_0xa6ba('0x43')]);return db[_0xa6ba('0x29')][_0xa6ba('0x44')](_0x1dc3ae)['then'](handleEntityNotFound(_0x4a8734,null))['then'](respondWithResult(_0x4a8734,null))['catch'](handleError(_0x4a8734,null));};exports[_0xa6ba('0x45')]=function(_0x921dfa,_0xe8642d){return db[_0xa6ba('0x29')][_0xa6ba('0x45')](_0x921dfa[_0xa6ba('0x46')],{})[_0xa6ba('0x24')](respondWithResult(_0xe8642d,0xc9))[_0xa6ba('0x47')](handleError(_0xe8642d,null));};exports[_0xa6ba('0x23')]=function(_0x34aefc,_0x398f82){if(_0x34aefc[_0xa6ba('0x46')]['id']){delete _0x34aefc[_0xa6ba('0x46')]['id'];}return db[_0xa6ba('0x29')][_0xa6ba('0x44')]({'where':{'id':_0x34aefc[_0xa6ba('0x48')]['id']}})[_0xa6ba('0x24')](handleEntityNotFound(_0x398f82,null))[_0xa6ba('0x24')](saveUpdates(_0x34aefc[_0xa6ba('0x46')],null))['then'](respondWithResult(_0x398f82,null))[_0xa6ba('0x47')](handleError(_0x398f82,null));};exports['destroy']=function(_0x4d9d8e,_0x1d7129){return db['SquareDetailsReport'][_0xa6ba('0x44')]({'where':{'id':_0x4d9d8e['params']['id']}})[_0xa6ba('0x24')](handleEntityNotFound(_0x1d7129,null))[_0xa6ba('0x24')](removeEntity(_0x1d7129,null))['catch'](handleError(_0x1d7129,null));};exports['describe']=function(_0x368a0a,_0xec41dd){return db['SquareDetailsReport']['describe']()[_0xa6ba('0x24')](respondWithResult(_0xec41dd,null))['catch'](handleError(_0xec41dd,null));}; \ No newline at end of file +var _0x4b46=['json','apply','reject','then','destroy','error','name','index','map','SquareDetailsReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','update','body','describe','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','set'];(function(_0x38e407,_0x419b6e){var _0x5f3dbf=function(_0x430626){while(--_0x430626){_0x38e407['push'](_0x38e407['shift']());}};_0x5f3dbf(++_0x419b6e);}(_0x4b46,0x75));var _0x64b4=function(_0x211289,_0x2f9e0){_0x211289=_0x211289-0x0;var _0x145db5=_0x4b46[_0x211289];return _0x145db5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x64b4('0x0'));var jsonpatch=require(_0x64b4('0x1'));var rp=require('request-promise');var moment=require(_0x64b4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x64b4('0x3'));var util=require(_0x64b4('0x4'));var path=require(_0x64b4('0x5'));var sox=require(_0x64b4('0x6'));var csv=require('to-csv');var ejs=require(_0x64b4('0x7'));var fs=require('fs');var fs_extra=require(_0x64b4('0x8'));var _=require('lodash');var squel=require(_0x64b4('0x9'));var crypto=require(_0x64b4('0xa'));var jsforce=require(_0x64b4('0xb'));var deskjs=require(_0x64b4('0xc'));var toCsv=require(_0x64b4('0xd'));var querystring=require('querystring');var Papa=require(_0x64b4('0xe'));var Redis=require(_0x64b4('0xf'));var authService=require(_0x64b4('0x10'));var qs=require(_0x64b4('0x11'));var as=require(_0x64b4('0x12'));var hardwareService=require(_0x64b4('0x13'));var logger=require(_0x64b4('0x14'))(_0x64b4('0x15'));var utils=require(_0x64b4('0x16'));var config=require(_0x64b4('0x17'));var licenseUtil=require(_0x64b4('0x18'));var db=require(_0x64b4('0x19'))['db'];function respondWithStatusCode(_0x3f8018,_0xa821ae){_0xa821ae=_0xa821ae||0xcc;return function(_0x15cc5d){if(_0x15cc5d){return _0x3f8018[_0x64b4('0x1a')](_0xa821ae);}return _0x3f8018['status'](_0xa821ae)[_0x64b4('0x1b')]();};}function respondWithResult(_0x1f9e2b,_0x16ef12){_0x16ef12=_0x16ef12||0xc8;return function(_0x491e04){if(_0x491e04){return _0x1f9e2b[_0x64b4('0x1c')](_0x16ef12)['json'](_0x491e04);}};}function respondWithFilteredResult(_0x4cdebe,_0x3d1d44){return function(_0x1d855e){if(_0x1d855e){var _0x10646f=typeof _0x3d1d44['offset']==='undefined'&&typeof _0x3d1d44['limit']===_0x64b4('0x1d');var _0x855b74=_0x1d855e[_0x64b4('0x1e')];var _0x378a3f=_0x10646f?0x0:_0x3d1d44[_0x64b4('0x1f')];var _0xf9b734=_0x10646f?_0x1d855e['count']:_0x3d1d44['offset']+_0x3d1d44['limit'];var _0x5e5f68;if(_0xf9b734>=_0x855b74){_0xf9b734=_0x855b74;_0x5e5f68=0xc8;}else{_0x5e5f68=0xce;}_0x4cdebe[_0x64b4('0x1c')](_0x5e5f68);return _0x4cdebe[_0x64b4('0x20')]('Content-Range',_0x378a3f+'-'+_0xf9b734+'/'+_0x855b74)[_0x64b4('0x21')](_0x1d855e);}return null;};}function patchUpdates(_0x5d3879){return function(_0xd0758e){try{jsonpatch[_0x64b4('0x22')](_0xd0758e,_0x5d3879,!![]);}catch(_0xc68b32){return BPromise[_0x64b4('0x23')](_0xc68b32);}return _0xd0758e['save']();};}function saveUpdates(_0x1931b8,_0x34dc23){return function(_0x3397dd){if(_0x3397dd){return _0x3397dd['update'](_0x1931b8)[_0x64b4('0x24')](function(_0x32923e){return _0x32923e;});}return null;};}function removeEntity(_0x29e9df,_0x13c468){return function(_0x3d771c){if(_0x3d771c){return _0x3d771c[_0x64b4('0x25')]()[_0x64b4('0x24')](function(){_0x29e9df[_0x64b4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x174955,_0x5c71a3){return function(_0x486a10){if(!_0x486a10){_0x174955[_0x64b4('0x1a')](0x194);}return _0x486a10;};}function handleError(_0x2c1a5f,_0x36c827){_0x36c827=_0x36c827||0x1f4;return function(_0x22f3c7){logger[_0x64b4('0x26')](_0x22f3c7['stack']);if(_0x22f3c7['name']){delete _0x22f3c7[_0x64b4('0x27')];}_0x2c1a5f[_0x64b4('0x1c')](_0x36c827)['send'](_0x22f3c7);};}exports[_0x64b4('0x28')]=function(_0x2ed6fb,_0x18f0db){var _0x154830={},_0xd2e90d={},_0x448035={'count':0x0,'rows':[]};var _0x2ea14f=_[_0x64b4('0x29')](db[_0x64b4('0x2a')][_0x64b4('0x2b')],function(_0x840816){return{'name':_0x840816[_0x64b4('0x2c')],'type':_0x840816['type'][_0x64b4('0x2d')]};});_0xd2e90d['model']=_[_0x64b4('0x29')](_0x2ea14f,_0x64b4('0x27'));_0xd2e90d[_0x64b4('0x2e')]=_[_0x64b4('0x2f')](_0x2ed6fb['query']);_0xd2e90d[_0x64b4('0x30')]=_[_0x64b4('0x31')](_0xd2e90d[_0x64b4('0x32')],_0xd2e90d[_0x64b4('0x2e')]);_0x154830[_0x64b4('0x33')]=_[_0x64b4('0x31')](_0xd2e90d[_0x64b4('0x32')],qs[_0x64b4('0x34')](_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x34')]));_0x154830[_0x64b4('0x33')]=_0x154830['attributes'][_0x64b4('0x35')]?_0x154830[_0x64b4('0x33')]:_0xd2e90d[_0x64b4('0x32')];if(!_0x2ed6fb['query'][_0x64b4('0x36')](_0x64b4('0x37'))){_0x154830['limit']=qs[_0x64b4('0x38')](_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x38')]);_0x154830[_0x64b4('0x1f')]=qs[_0x64b4('0x1f')](_0x2ed6fb[_0x64b4('0x2e')]['offset']);}_0x154830[_0x64b4('0x39')]=qs['sort'](_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x3a')]);_0x154830[_0x64b4('0x3b')]=qs['filters'](_['pick'](_0x2ed6fb[_0x64b4('0x2e')],_0xd2e90d[_0x64b4('0x30')]),_0x2ea14f);if(_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x3c')]){_0x154830[_0x64b4('0x3b')]=_[_0x64b4('0x3d')](_0x154830[_0x64b4('0x3b')],{'$or':_[_0x64b4('0x29')](_0x2ea14f,function(_0x5b77ae){if(_0x5b77ae[_0x64b4('0x3e')]!==_0x64b4('0x3f')){var _0x248a1e={};_0x248a1e[_0x5b77ae[_0x64b4('0x27')]]={'$like':'%'+_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x3c')]+'%'};return _0x248a1e;}})});}_0x154830=_[_0x64b4('0x3d')]({},_0x154830,_0x2ed6fb[_0x64b4('0x40')]);var _0x1c1d65={'where':_0x154830[_0x64b4('0x3b')]};return db[_0x64b4('0x2a')]['count'](_0x1c1d65)[_0x64b4('0x24')](function(_0xb422f){_0x448035[_0x64b4('0x1e')]=_0xb422f;if(_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x41')]){_0x154830[_0x64b4('0x42')]=[{'all':!![]}];}return db[_0x64b4('0x2a')]['findAll'](_0x154830);})[_0x64b4('0x24')](function(_0x20146f){_0x448035[_0x64b4('0x43')]=_0x20146f;return _0x448035;})['then'](respondWithFilteredResult(_0x18f0db,_0x154830))[_0x64b4('0x44')](handleError(_0x18f0db,null));};exports['show']=function(_0x5761ac,_0x13a518){var _0x241fca={'raw':!![],'where':{'id':_0x5761ac[_0x64b4('0x45')]['id']}},_0x51eaf9={};_0x51eaf9[_0x64b4('0x32')]=_[_0x64b4('0x2f')](db['SquareDetailsReport'][_0x64b4('0x2b')]);_0x51eaf9[_0x64b4('0x2e')]=_[_0x64b4('0x2f')](_0x5761ac[_0x64b4('0x2e')]);_0x51eaf9[_0x64b4('0x30')]=_['intersection'](_0x51eaf9[_0x64b4('0x32')],_0x51eaf9[_0x64b4('0x2e')]);_0x241fca[_0x64b4('0x33')]=_[_0x64b4('0x31')](_0x51eaf9[_0x64b4('0x32')],qs[_0x64b4('0x34')](_0x5761ac[_0x64b4('0x2e')][_0x64b4('0x34')]));_0x241fca[_0x64b4('0x33')]=_0x241fca[_0x64b4('0x33')][_0x64b4('0x35')]?_0x241fca[_0x64b4('0x33')]:_0x51eaf9[_0x64b4('0x32')];if(_0x5761ac[_0x64b4('0x2e')]['includeAll']){_0x241fca[_0x64b4('0x42')]=[{'all':!![]}];}_0x241fca=_[_0x64b4('0x3d')]({},_0x241fca,_0x5761ac[_0x64b4('0x40')]);return db[_0x64b4('0x2a')][_0x64b4('0x46')](_0x241fca)[_0x64b4('0x24')](handleEntityNotFound(_0x13a518,null))[_0x64b4('0x24')](respondWithResult(_0x13a518,null))[_0x64b4('0x44')](handleError(_0x13a518,null));};exports[_0x64b4('0x47')]=function(_0x26345b,_0x33d8b0){return db[_0x64b4('0x2a')][_0x64b4('0x47')](_0x26345b['body'],{})[_0x64b4('0x24')](respondWithResult(_0x33d8b0,0xc9))[_0x64b4('0x44')](handleError(_0x33d8b0,null));};exports[_0x64b4('0x48')]=function(_0x5c40f9,_0x372d21){if(_0x5c40f9[_0x64b4('0x49')]['id']){delete _0x5c40f9[_0x64b4('0x49')]['id'];}return db[_0x64b4('0x2a')]['find']({'where':{'id':_0x5c40f9[_0x64b4('0x45')]['id']}})['then'](handleEntityNotFound(_0x372d21,null))[_0x64b4('0x24')](saveUpdates(_0x5c40f9[_0x64b4('0x49')],null))[_0x64b4('0x24')](respondWithResult(_0x372d21,null))[_0x64b4('0x44')](handleError(_0x372d21,null));};exports[_0x64b4('0x25')]=function(_0x445207,_0x3a39a3){return db['SquareDetailsReport'][_0x64b4('0x46')]({'where':{'id':_0x445207['params']['id']}})[_0x64b4('0x24')](handleEntityNotFound(_0x3a39a3,null))[_0x64b4('0x24')](removeEntity(_0x3a39a3,null))[_0x64b4('0x44')](handleError(_0x3a39a3,null));};exports[_0x64b4('0x4a')]=function(_0x5856a9,_0x19c2f8){return db['SquareDetailsReport'][_0x64b4('0x4a')]()[_0x64b4('0x24')](respondWithResult(_0x19c2f8,null))[_0x64b4('0x44')](handleError(_0x19c2f8,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index e8ac03b..6a6e303 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 _0x98c5=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird'];(function(_0x579520,_0x180667){var _0x2d71a4=function(_0x13729f){while(--_0x13729f){_0x579520['push'](_0x579520['shift']());}};_0x2d71a4(++_0x180667);}(_0x98c5,0xe5));var _0x598c=function(_0x4c8feb,_0x43f151){_0x4c8feb=_0x4c8feb-0x0;var _0x257757=_0x98c5[_0x4c8feb];return _0x257757;};'use strict';var _=require(_0x598c('0x0'));var util=require('util');var logger=require(_0x598c('0x1'))(_0x598c('0x2'));var moment=require(_0x598c('0x3'));var BPromise=require(_0x598c('0x4'));var rp=require(_0x598c('0x5'));var fs=require('fs');var path=require(_0x598c('0x6'));var rimraf=require(_0x598c('0x7'));var config=require(_0x598c('0x8'));var attributes=require(_0x598c('0x9'));module['exports']=function(_0x2f3100,_0x214257){return _0x2f3100[_0x598c('0xa')](_0x598c('0xb'),attributes,{'tableName':_0x598c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae91=['lodash','api','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','report_square_details'];(function(_0x4e7c7e,_0x4c5955){var _0x344839=function(_0x110ca7){while(--_0x110ca7){_0x4e7c7e['push'](_0x4e7c7e['shift']());}};_0x344839(++_0x4c5955);}(_0xae91,0x7e));var _0x1ae9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xae91[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x1ae9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1ae9('0x1'));var moment=require(_0x1ae9('0x2'));var BPromise=require('bluebird');var rp=require(_0x1ae9('0x3'));var fs=require('fs');var path=require(_0x1ae9('0x4'));var rimraf=require(_0x1ae9('0x5'));var config=require(_0x1ae9('0x6'));var attributes=require(_0x1ae9('0x7'));module['exports']=function(_0x1cd164,_0x4010fb){return _0x1cd164['define']('SquareDetailsReport',attributes,{'tableName':_0x1ae9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 8486833..618d255 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 _0x8d05=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','catch'];(function(_0x38a39b,_0x42847b){var _0x4e15f8=function(_0x569e17){while(--_0x569e17){_0x38a39b['push'](_0x38a39b['shift']());}};_0x4e15f8(++_0x42847b);}(_0x8d05,0xe8));var _0x58d0=function(_0x16bad2,_0x198185){_0x16bad2=_0x16bad2-0x0;var _0x240717=_0x8d05[_0x16bad2];return _0x240717;};'use strict';var _=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var moment=require(_0x58d0('0x2'));var BPromise=require(_0x58d0('0x3'));var rs=require(_0x58d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58d0('0x5'));var logger=require(_0x58d0('0x6'))(_0x58d0('0x7'));var config=require(_0x58d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x58d0('0x9')][_0x58d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528303,_0x66aef1,_0x4e44e2){return new BPromise(function(_0xe744f4,_0x34ab60){return client[_0x58d0('0xb')](_0x528303,_0x4e44e2)[_0x58d0('0xc')](function(_0x1d070a){logger['info'](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));logger['debug'](_0x58d0('0xf'),_0x66aef1,_0x58d0('0xe'),JSON['stringify'](_0x1d070a));if(_0x1d070a['error']){if(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x11')]===0x1f4){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0x34ab60(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0xe744f4(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}else{logger[_0x58d0('0x13')](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));_0xe744f4(_0x1d070a[_0x58d0('0x14')][_0x58d0('0x12')]);}})['catch'](function(_0x10874e){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x10874e);_0x34ab60(_0x10874e);});});}exports[_0x58d0('0x15')]=function(_0xb8dd5f){var _0x2c7db6=this;return new Promise(function(_0x23dcfb,_0x41d221){return db[_0x58d0('0x16')][_0x58d0('0x17')](_0xb8dd5f[_0x58d0('0x18')],{'raw':_0xb8dd5f[_0x58d0('0x19')]?_0xb8dd5f[_0x58d0('0x19')][_0x58d0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3072f9){logger[_0x58d0('0x13')](_0x58d0('0x15'),_0xb8dd5f);logger['debug'](_0x58d0('0x15'),_0xb8dd5f,JSON[_0x58d0('0x1b')](_0x3072f9));_0x23dcfb(_0x3072f9);})[_0x58d0('0x1c')](function(_0x575b34){logger[_0x58d0('0x10')]('CreateSquareDetailsReport',_0x575b34['message'],_0xb8dd5f);_0x41d221(_0x2c7db6[_0x58d0('0x10')](0x1f4,_0x575b34[_0x58d0('0x12')]));});});}; \ No newline at end of file +var _0x36ee=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw'];(function(_0x52f2ed,_0x3efc6b){var _0x2f3229=function(_0x55e50d){while(--_0x55e50d){_0x52f2ed['push'](_0x52f2ed['shift']());}};_0x2f3229(++_0x3efc6b);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')](_0x2184ae['body'],{'raw':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x21e95e){logger[_0xe36e('0x15')](_0xe36e('0x18'),_0x2184ae);logger[_0xe36e('0xe')](_0xe36e('0x18'),_0x2184ae,JSON[_0xe36e('0x11')](_0x21e95e));_0x21d9a3(_0x21e95e);})['catch'](function(_0xd71137){logger[_0xe36e('0x12')](_0xe36e('0x18'),_0xd71137[_0xe36e('0x14')],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0xd71137['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d6234d4..f1d1fd9 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 _0x35d2=['exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill'];(function(_0x30eb5,_0x59349f){var _0x5d9c48=function(_0x544f45){while(--_0x544f45){_0x30eb5['push'](_0x30eb5['shift']());}};_0x5d9c48(++_0x59349f);}(_0x35d2,0x161));var _0x235d=function(_0x204193,_0x5b075e){_0x204193=_0x204193-0x0;var _0x3bae7e=_0x35d2[_0x204193];return _0x3bae7e;};'use strict';var express=require(_0x235d('0x0'));var router=express[_0x235d('0x1')]();var auth=require(_0x235d('0x2'));var controller=require(_0x235d('0x3'));router[_0x235d('0x4')]('/',auth[_0x235d('0x5')](),controller['index']);router['get'](_0x235d('0x6'),auth[_0x235d('0x5')](),controller['killProcess']);module[_0x235d('0x7')]=router; \ No newline at end of file +var _0xc974=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express','Router','../../components/auth/service'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0xc974,0x72));var _0x4c97=function(_0x406720,_0x4502fc){_0x406720=_0x406720-0x0;var _0x3c0262=_0xc974[_0x406720];return _0x3c0262;};'use strict';var express=require(_0x4c97('0x0'));var router=express[_0x4c97('0x1')]();var auth=require(_0x4c97('0x2'));var controller=require(_0x4c97('0x3'));router[_0x4c97('0x4')]('/',auth[_0x4c97('0x5')](),controller[_0x4c97('0x6')]);router[_0x4c97('0x4')](_0x4c97('0x7'),auth[_0x4c97('0x5')](),controller[_0x4c97('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index d8df1b4..7fa5714 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 _0x4351=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','params','killProcess','systeminformation','child_process','../../config/logger','api','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','json','catch'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0x4351,0x15e));var _0x1435=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x4351[_0x21549c];return _0x426cbd;};'use strict';var info=require(_0x1435('0x0'));var exec=require(_0x1435('0x1'))['exec'];var logger=require(_0x1435('0x2'))(_0x1435('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x1435('0x4'));function handleError(_0x37509b,_0xf89d,_0x221cda){_0xf89d=_0xf89d||0x1f4;return function(_0x143dda){logger[_0x1435('0x5')](_0x1435('0x6'),_0x221cda,_0xf89d,util[_0x1435('0x7')](_0x143dda,{'showHidden':![],'depth':null}));delete _0x143dda[_0x1435('0x8')];_0x37509b[_0x1435('0x9')](_0xf89d)['send'](_0x143dda);};}exports[_0x1435('0xa')]=function(_0x2a09e7,_0x1b2c5a){return info[_0x1435('0xb')]()['then'](function(_0x184f32){return _0x1b2c5a[_0x1435('0x9')](0xc8)[_0x1435('0xc')](_0x184f32);})[_0x1435('0xd')](function(_0x3bf3c6){return _0x1b2c5a[_0x1435('0x9')](0x1f4)[_0x1435('0xc')](_0x3bf3c6);});};exports['killProcess']=function(_0x4b0a26,_0x51294d){var _0x4e4125=[_0x1435('0xe')];return new BPromise(function(_0x34da3b,_0x48ab52){return exec(util[_0x1435('0xf')](_0x1435('0x10'),_0x4b0a26['params'][_0x1435('0x11')]),function(_0x17bee9,_0x3855e7,_0x89e482){if(_0x17bee9){return _0x48ab52(_0x17bee9);}return _0x34da3b(_0x3855e7);});})['then'](function(_0x2ab3c4){var _0x22f3ad=![];var _0x89009=_0x2ab3c4[_0x1435('0x12')](/\n/);for(var _0x3c85b0=0x0,_0x436702=_0x4e4125[_0x1435('0x13')];_0x3c85b0<_0x436702,_0x22f3ad===![];_0x3c85b0+=0x1){if(_0x2ab3c4[_0x1435('0x14')](_0x4e4125[_0x3c85b0])>=0x0){_0x22f3ad=!![];}}if(!_0x22f3ad){throw new Error(util[_0x1435('0xf')](_0x1435('0x15'),_0x4b0a26['params'][_0x1435('0x11')]));}process['kill'](_0x4b0a26['params'][_0x1435('0x11')],_0x1435('0x16'));return _0x51294d[_0x1435('0x9')](0xc8)[_0x1435('0xc')]({'message':util['format'](_0x1435('0x17'),_0x4b0a26[_0x1435('0x18')][_0x1435('0x11')])});})['catch'](handleError(_0x51294d,null,_0x1435('0x19')));}; \ No newline at end of file +var _0xa7a0=['util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','status','json','catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api'];(function(_0x3c0c96,_0x449674){var _0x1780ec=function(_0x395465){while(--_0x395465){_0x3c0c96['push'](_0x3c0c96['shift']());}};_0x1780ec(++_0x449674);}(_0xa7a0,0x183));var _0x0a7a=function(_0x23ba67,_0x1915ab){_0x23ba67=_0x23ba67-0x0;var _0x54e34f=_0xa7a0[_0x23ba67];return _0x54e34f;};'use strict';var info=require(_0x0a7a('0x0'));var exec=require(_0x0a7a('0x1'))[_0x0a7a('0x2')];var logger=require(_0x0a7a('0x3'))(_0x0a7a('0x4'));var util=require(_0x0a7a('0x5'));var BPromise=require('bluebird');var _=require(_0x0a7a('0x6'));function handleError(_0x3746ee,_0x5ec939,_0x44bc76){_0x5ec939=_0x5ec939||0x1f4;return function(_0x35480c){logger[_0x0a7a('0x7')](_0x0a7a('0x8'),_0x44bc76,_0x5ec939,util[_0x0a7a('0x9')](_0x35480c,{'showHidden':![],'depth':null}));delete _0x35480c[_0x0a7a('0xa')];_0x3746ee['status'](_0x5ec939)[_0x0a7a('0xb')](_0x35480c);};}exports[_0x0a7a('0xc')]=function(_0xc1dbfc,_0xeb0127){return info[_0x0a7a('0xd')]()['then'](function(_0x3bc357){return _0xeb0127[_0x0a7a('0xe')](0xc8)[_0x0a7a('0xf')](_0x3bc357);})[_0x0a7a('0x10')](function(_0x1f5ec4){return _0xeb0127['status'](0x1f4)[_0x0a7a('0xf')](_0x1f5ec4);});};exports[_0x0a7a('0x11')]=function(_0x313904,_0x351c54){var _0x31a0b5=['components/import/cm'];return new BPromise(function(_0x681c39,_0x3d27b9){return exec(util['format'](_0x0a7a('0x12'),_0x313904[_0x0a7a('0x13')][_0x0a7a('0x14')]),function(_0x339eb4,_0x7ea397,_0x48cbf9){if(_0x339eb4){return _0x3d27b9(_0x339eb4);}return _0x681c39(_0x7ea397);});})['then'](function(_0x5881f7){var _0x3c57b2=![];var _0x2340b2=_0x5881f7[_0x0a7a('0x15')](/\n/);for(var _0x3cfdc3=0x0,_0x323419=_0x31a0b5[_0x0a7a('0x16')];_0x3cfdc3<_0x323419,_0x3c57b2===![];_0x3cfdc3+=0x1){if(_0x5881f7[_0x0a7a('0x17')](_0x31a0b5[_0x3cfdc3])>=0x0){_0x3c57b2=!![];}}if(!_0x3c57b2){throw new Error(util['format'](_0x0a7a('0x18'),_0x313904[_0x0a7a('0x13')][_0x0a7a('0x14')]));}process[_0x0a7a('0x19')](_0x313904[_0x0a7a('0x13')][_0x0a7a('0x14')],_0x0a7a('0x1a'));return _0x351c54['status'](0xc8)[_0x0a7a('0xf')]({'message':util['format'](_0x0a7a('0x1b'),_0x313904[_0x0a7a('0x13')][_0x0a7a('0x14')])});})[_0x0a7a('0x10')](handleError(_0x351c54,null,_0x0a7a('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index af3ebc3..b337588 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 _0xbcff=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller'];(function(_0x2c5282,_0xd3c53a){var _0x4fc235=function(_0x3b0724){while(--_0x3b0724){_0x2c5282['push'](_0x2c5282['shift']());}};_0x4fc235(++_0xd3c53a);}(_0xbcff,0x108));var _0xfbcf=function(_0x200fad,_0x21454e){_0x200fad=_0x200fad-0x0;var _0x4a10fe=_0xbcff[_0x200fad];return _0x4a10fe;};'use strict';var multer=require(_0xfbcf('0x0'));var util=require('util');var path=require(_0xfbcf('0x1'));var timeout=require(_0xfbcf('0x2'));var express=require(_0xfbcf('0x3'));var router=express[_0xfbcf('0x4')]();var fs_extra=require(_0xfbcf('0x5'));var auth=require(_0xfbcf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfbcf('0x7'));var controller=require(_0xfbcf('0x8'));router[_0xfbcf('0x9')]('/',auth[_0xfbcf('0xa')](),controller[_0xfbcf('0xb')]);router['get'](_0xfbcf('0xc'),auth[_0xfbcf('0xa')](),controller[_0xfbcf('0xd')]);router[_0xfbcf('0xe')]('/',auth['isAuthenticated'](),controller[_0xfbcf('0xf')]);router[_0xfbcf('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfbcf('0x11')]);router[_0xfbcf('0x12')](_0xfbcf('0xc'),auth[_0xfbcf('0xa')](),controller[_0xfbcf('0x13')]);module[_0xfbcf('0x14')]=router; \ No newline at end of file +var _0xff99=['get','/:id','isAuthenticated','post','create','put','update','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','index'];(function(_0xc7a7f0,_0x48c403){var _0x100926=function(_0x4bc8e6){while(--_0x4bc8e6){_0xc7a7f0['push'](_0xc7a7f0['shift']());}};_0x100926(++_0x48c403);}(_0xff99,0x129));var _0x9ff9=function(_0x1bb1d5,_0x4dd8fc){_0x1bb1d5=_0x1bb1d5-0x0;var _0x4436c1=_0xff99[_0x1bb1d5];return _0x4436c1;};'use strict';var multer=require('multer');var util=require(_0x9ff9('0x0'));var path=require('path');var timeout=require(_0x9ff9('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9ff9('0x2'));var interaction=require(_0x9ff9('0x3'));var config=require(_0x9ff9('0x4'));var controller=require(_0x9ff9('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x9ff9('0x6')]);router[_0x9ff9('0x7')](_0x9ff9('0x8'),auth[_0x9ff9('0x9')](),controller['show']);router[_0x9ff9('0xa')]('/',auth['isAuthenticated'](),controller[_0x9ff9('0xb')]);router[_0x9ff9('0xc')](_0x9ff9('0x8'),auth[_0x9ff9('0x9')](),controller[_0x9ff9('0xd')]);router[_0x9ff9('0xe')]('/:id',auth[_0x9ff9('0x9')](),controller['destroy']);module[_0x9ff9('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index f8c2b9d..764a2c5 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 _0x3f8c=['name','#0091EA','STRING'];(function(_0x189ed5,_0xae2ff7){var _0x2b7f44=function(_0x103b58){while(--_0x103b58){_0x189ed5['push'](_0x189ed5['shift']());}};_0x2b7f44(++_0xae2ff7);}(_0x3f8c,0x104));var _0xc3f8=function(_0x55694d,_0x18073a){_0x55694d=_0x55694d-0x0;var _0x50ca26=_0x3f8c[_0x55694d];return _0x50ca26;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc3f8('0x0')],'unique':_0xc3f8('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc3f8('0x0')],'defaultValue':_0xc3f8('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6e1c=['STRING','#0091EA','sequelize','name'];(function(_0x27964e,_0x2609a2){var _0x4d304c=function(_0x2e8992){while(--_0x2e8992){_0x27964e['push'](_0x27964e['shift']());}};_0x4d304c(++_0x2609a2);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc6e1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc6e1('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc6e1('0x2')],'defaultValue':_0xc6e1('0x3')},'description':{'type':Sequelize[_0xc6e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a97e15c..a1926f4 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 _0x1b73=['map','Tag','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','error','stack','name','send','index'];(function(_0xc6272f,_0x5e0597){var _0x4e1d57=function(_0xb33511){while(--_0xb33511){_0xc6272f['push'](_0xc6272f['shift']());}};_0x4e1d57(++_0x5e0597);}(_0x1b73,0x1d5));var _0x31b7=function(_0x269539,_0x50faab){_0x269539=_0x269539-0x0;var _0x558c07=_0x1b73[_0x269539];return _0x558c07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31b7('0x0'));var zipdir=require(_0x31b7('0x1'));var jsonpatch=require(_0x31b7('0x2'));var rp=require(_0x31b7('0x3'));var moment=require('moment');var BPromise=require(_0x31b7('0x4'));var Mustache=require('mustache');var util=require(_0x31b7('0x5'));var path=require(_0x31b7('0x6'));var sox=require('sox');var csv=require(_0x31b7('0x7'));var ejs=require(_0x31b7('0x8'));var fs=require('fs');var fs_extra=require(_0x31b7('0x9'));var _=require('lodash');var squel=require(_0x31b7('0xa'));var crypto=require(_0x31b7('0xb'));var jsforce=require(_0x31b7('0xc'));var deskjs=require(_0x31b7('0xd'));var toCsv=require(_0x31b7('0x7'));var querystring=require(_0x31b7('0xe'));var Papa=require(_0x31b7('0xf'));var Redis=require('ioredis');var authService=require(_0x31b7('0x10'));var qs=require(_0x31b7('0x11'));var as=require(_0x31b7('0x12'));var hardwareService=require(_0x31b7('0x13'));var logger=require(_0x31b7('0x14'))(_0x31b7('0x15'));var utils=require(_0x31b7('0x16'));var config=require(_0x31b7('0x17'));var licenseUtil=require(_0x31b7('0x18'));var db=require(_0x31b7('0x19'))['db'];function respondWithStatusCode(_0x492612,_0x32afeb){_0x32afeb=_0x32afeb||0xcc;return function(_0x55e1bb){if(_0x55e1bb){return _0x492612[_0x31b7('0x1a')](_0x32afeb);}return _0x492612[_0x31b7('0x1b')](_0x32afeb)[_0x31b7('0x1c')]();};}function respondWithResult(_0x1969d2,_0x7988e2){_0x7988e2=_0x7988e2||0xc8;return function(_0x34e917){if(_0x34e917){return _0x1969d2[_0x31b7('0x1b')](_0x7988e2)['json'](_0x34e917);}};}function respondWithFilteredResult(_0x1e93fb,_0x491c98){return function(_0x210f18){if(_0x210f18){var _0xf213c9=typeof _0x491c98['offset']===_0x31b7('0x1d')&&typeof _0x491c98[_0x31b7('0x1e')]===_0x31b7('0x1d');var _0x39eee9=_0x210f18[_0x31b7('0x1f')];var _0x5f3245=_0xf213c9?0x0:_0x491c98[_0x31b7('0x20')];var _0x437eba=_0xf213c9?_0x210f18[_0x31b7('0x1f')]:_0x491c98[_0x31b7('0x20')]+_0x491c98[_0x31b7('0x1e')];var _0x4b8ab1;if(_0x437eba>=_0x39eee9){_0x437eba=_0x39eee9;_0x4b8ab1=0xc8;}else{_0x4b8ab1=0xce;}_0x1e93fb[_0x31b7('0x1b')](_0x4b8ab1);return _0x1e93fb[_0x31b7('0x21')](_0x31b7('0x22'),_0x5f3245+'-'+_0x437eba+'/'+_0x39eee9)[_0x31b7('0x23')](_0x210f18);}return null;};}function patchUpdates(_0x5b56bc){return function(_0x892fe4){try{jsonpatch[_0x31b7('0x24')](_0x892fe4,_0x5b56bc,!![]);}catch(_0x424318){return BPromise[_0x31b7('0x25')](_0x424318);}return _0x892fe4['save']();};}function saveUpdates(_0x33dd04,_0x20cb03){return function(_0x250574){if(_0x250574){return _0x250574[_0x31b7('0x26')](_0x33dd04)[_0x31b7('0x27')](function(_0x2d24bf){return _0x2d24bf;});}return null;};}function removeEntity(_0x36492c,_0x20e5b0){return function(_0x3b0eff){if(_0x3b0eff){return _0x3b0eff['destroy']()[_0x31b7('0x27')](function(){var _0x35a51f=_0x3b0eff[_0x31b7('0x28')]({'plain':!![]});var _0x2c993b='Tags';return db[_0x31b7('0x29')]['destroy']({'where':{'type':_0x2c993b,'resourceId':_0x35a51f['id']}})[_0x31b7('0x27')](function(){return _0x3b0eff;});})[_0x31b7('0x27')](function(){_0x36492c[_0x31b7('0x1b')](0xcc)[_0x31b7('0x1c')]();});}};}function handleEntityNotFound(_0xffacb,_0x128865){return function(_0x21ab03){if(!_0x21ab03){_0xffacb[_0x31b7('0x1a')](0x194);}return _0x21ab03;};}function handleError(_0x4e58e5,_0x47ef33){_0x47ef33=_0x47ef33||0x1f4;return function(_0x503549){logger[_0x31b7('0x2a')](_0x503549[_0x31b7('0x2b')]);if(_0x503549[_0x31b7('0x2c')]){delete _0x503549['name'];}_0x4e58e5[_0x31b7('0x1b')](_0x47ef33)[_0x31b7('0x2d')](_0x503549);};}exports[_0x31b7('0x2e')]=function(_0x277273,_0x58a87e){var _0x5b0ed2={},_0x34c62a={},_0x4b5cf9={'count':0x0,'rows':[]};var _0x574dfe=_[_0x31b7('0x2f')](db[_0x31b7('0x30')][_0x31b7('0x31')],function(_0x35f83c){return{'name':_0x35f83c['fieldName'],'type':_0x35f83c['type'][_0x31b7('0x32')]};});_0x34c62a[_0x31b7('0x33')]=_[_0x31b7('0x2f')](_0x574dfe,_0x31b7('0x2c'));_0x34c62a[_0x31b7('0x34')]=_['keys'](_0x277273['query']);_0x34c62a[_0x31b7('0x35')]=_[_0x31b7('0x36')](_0x34c62a['model'],_0x34c62a[_0x31b7('0x34')]);_0x5b0ed2[_0x31b7('0x37')]=_['intersection'](_0x34c62a[_0x31b7('0x33')],qs[_0x31b7('0x38')](_0x277273[_0x31b7('0x34')][_0x31b7('0x38')]));_0x5b0ed2[_0x31b7('0x37')]=_0x5b0ed2[_0x31b7('0x37')][_0x31b7('0x39')]?_0x5b0ed2[_0x31b7('0x37')]:_0x34c62a[_0x31b7('0x33')];if(!_0x277273[_0x31b7('0x34')][_0x31b7('0x3a')](_0x31b7('0x3b'))){_0x5b0ed2[_0x31b7('0x1e')]=qs['limit'](_0x277273['query'][_0x31b7('0x1e')]);_0x5b0ed2[_0x31b7('0x20')]=qs[_0x31b7('0x20')](_0x277273[_0x31b7('0x34')][_0x31b7('0x20')]);}_0x5b0ed2[_0x31b7('0x3c')]=qs[_0x31b7('0x3d')](_0x277273[_0x31b7('0x34')][_0x31b7('0x3d')]);_0x5b0ed2[_0x31b7('0x3e')]=qs['filters'](_[_0x31b7('0x3f')](_0x277273[_0x31b7('0x34')],_0x34c62a[_0x31b7('0x35')]),_0x574dfe);if(_0x277273[_0x31b7('0x34')]['filter']){_0x5b0ed2[_0x31b7('0x3e')]=_[_0x31b7('0x40')](_0x5b0ed2['where'],{'$or':_[_0x31b7('0x2f')](_0x574dfe,function(_0x5724fa){if(_0x5724fa['type']!==_0x31b7('0x41')){var _0x10e82c={};_0x10e82c[_0x5724fa[_0x31b7('0x2c')]]={'$like':'%'+_0x277273[_0x31b7('0x34')][_0x31b7('0x42')]+'%'};return _0x10e82c;}})});}_0x5b0ed2=_['merge']({},_0x5b0ed2,_0x277273[_0x31b7('0x43')]);var _0x5d01ee={'where':_0x5b0ed2['where']};return db['Tag'][_0x31b7('0x1f')](_0x5d01ee)[_0x31b7('0x27')](function(_0x1527b3){_0x4b5cf9[_0x31b7('0x1f')]=_0x1527b3;if(_0x277273[_0x31b7('0x34')]['includeAll']){_0x5b0ed2[_0x31b7('0x44')]=[{'all':!![]}];}return db['Tag'][_0x31b7('0x45')](_0x5b0ed2);})[_0x31b7('0x27')](function(_0x41c92e){_0x4b5cf9[_0x31b7('0x46')]=_0x41c92e;return _0x4b5cf9;})['then'](respondWithFilteredResult(_0x58a87e,_0x5b0ed2))[_0x31b7('0x47')](handleError(_0x58a87e,null));};exports[_0x31b7('0x48')]=function(_0x1046fb,_0x4b3d24){var _0x31fd89={'raw':!![],'where':{'id':_0x1046fb[_0x31b7('0x49')]['id']}},_0x51918d={};_0x51918d[_0x31b7('0x33')]=_['keys'](db[_0x31b7('0x30')][_0x31b7('0x31')]);_0x51918d[_0x31b7('0x34')]=_[_0x31b7('0x4a')](_0x1046fb['query']);_0x51918d[_0x31b7('0x35')]=_['intersection'](_0x51918d['model'],_0x51918d[_0x31b7('0x34')]);_0x31fd89[_0x31b7('0x37')]=_[_0x31b7('0x36')](_0x51918d[_0x31b7('0x33')],qs['fields'](_0x1046fb[_0x31b7('0x34')][_0x31b7('0x38')]));_0x31fd89['attributes']=_0x31fd89[_0x31b7('0x37')][_0x31b7('0x39')]?_0x31fd89[_0x31b7('0x37')]:_0x51918d['model'];if(_0x1046fb[_0x31b7('0x34')][_0x31b7('0x4b')]){_0x31fd89[_0x31b7('0x44')]=[{'all':!![]}];}_0x31fd89=_[_0x31b7('0x40')]({},_0x31fd89,_0x1046fb[_0x31b7('0x43')]);return db[_0x31b7('0x30')][_0x31b7('0x4c')](_0x31fd89)[_0x31b7('0x27')](handleEntityNotFound(_0x4b3d24,null))['then'](respondWithResult(_0x4b3d24,null))[_0x31b7('0x47')](handleError(_0x4b3d24,null));};exports['create']=function(_0x5a72ee,_0x22cc77){return db[_0x31b7('0x30')][_0x31b7('0x4d')](_0x5a72ee[_0x31b7('0x4e')],{})['then'](function(_0x322798){var _0x18556b=_0x5a72ee[_0x31b7('0x4f')]['get']({'plain':!![]});if(!_0x18556b)throw new Error(_0x31b7('0x50'));if(_0x18556b[_0x31b7('0x51')]===_0x31b7('0x4f')){var _0x3b5868=_0x322798[_0x31b7('0x28')]({'plain':!![]});var _0x309077=_0x31b7('0x52');return db[_0x31b7('0x53')]['find']({'where':{'name':_0x309077,'userProfileId':_0x18556b['userProfileId']},'raw':!![]})[_0x31b7('0x27')](function(_0x1d55e6){if(_0x1d55e6&&_0x1d55e6[_0x31b7('0x54')]===0x0){return db[_0x31b7('0x29')]['create']({'name':_0x3b5868['name'],'resourceId':_0x3b5868['id'],'type':_0x1d55e6[_0x31b7('0x2c')],'sectionId':_0x1d55e6['id']},{})[_0x31b7('0x27')](function(){return _0x322798;});}else{return _0x322798;}})[_0x31b7('0x47')](function(_0x5ea605){logger[_0x31b7('0x2a')](_0x31b7('0x55'),_0x5ea605);throw _0x5ea605;});}return _0x322798;})[_0x31b7('0x27')](respondWithResult(_0x22cc77,0xc9))[_0x31b7('0x47')](handleError(_0x22cc77,null));};exports['update']=function(_0x535a3c,_0x43c1ee){if(_0x535a3c[_0x31b7('0x4e')]['id']){delete _0x535a3c[_0x31b7('0x4e')]['id'];}return db[_0x31b7('0x30')][_0x31b7('0x4c')]({'where':{'id':_0x535a3c[_0x31b7('0x49')]['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x43c1ee,null))[_0x31b7('0x27')](saveUpdates(_0x535a3c[_0x31b7('0x4e')],null))[_0x31b7('0x27')](respondWithResult(_0x43c1ee,null))['catch'](handleError(_0x43c1ee,null));};exports['destroy']=function(_0x4bd00d,_0x954c){return db[_0x31b7('0x30')][_0x31b7('0x4c')]({'where':{'id':_0x4bd00d['params']['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x954c,null))[_0x31b7('0x27')](removeEntity(_0x954c,null))[_0x31b7('0x47')](handleError(_0x954c,null));}; \ No newline at end of file +var _0x0624=['count','offset','set','json','apply','reject','save','then','get','Tags','UserProfileResource','destroy','end','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','Tag','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','request-promise','moment','bluebird','mustache','util','path','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','sendStatus','status','limit'];(function(_0x1899dd,_0x5cd649){var _0x5ec613=function(_0x58e14e){while(--_0x58e14e){_0x1899dd['push'](_0x1899dd['shift']());}};_0x5ec613(++_0x5cd649);}(_0x0624,0x132));var _0x4062=function(_0x3857f9,_0x29640b){_0x3857f9=_0x3857f9-0x0;var _0x1b4dfe=_0x0624[_0x3857f9];return _0x1b4dfe;};'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(_0x4062('0x0'));var moment=require(_0x4062('0x1'));var BPromise=require(_0x4062('0x2'));var Mustache=require(_0x4062('0x3'));var util=require(_0x4062('0x4'));var path=require(_0x4062('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4062('0x6'));var fs=require('fs');var fs_extra=require(_0x4062('0x7'));var _=require(_0x4062('0x8'));var squel=require(_0x4062('0x9'));var crypto=require(_0x4062('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4062('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4062('0xc'));var Papa=require(_0x4062('0xd'));var Redis=require(_0x4062('0xe'));var authService=require(_0x4062('0xf'));var qs=require(_0x4062('0x10'));var as=require(_0x4062('0x11'));var hardwareService=require(_0x4062('0x12'));var logger=require('../../config/logger')(_0x4062('0x13'));var utils=require('../../config/utils');var config=require(_0x4062('0x14'));var licenseUtil=require(_0x4062('0x15'));var db=require(_0x4062('0x16'))['db'];function respondWithStatusCode(_0x3146e2,_0x160b6d){_0x160b6d=_0x160b6d||0xcc;return function(_0x57e04b){if(_0x57e04b){return _0x3146e2[_0x4062('0x17')](_0x160b6d);}return _0x3146e2[_0x4062('0x18')](_0x160b6d)['end']();};}function respondWithResult(_0x32ced6,_0x42859d){_0x42859d=_0x42859d||0xc8;return function(_0x95bb42){if(_0x95bb42){return _0x32ced6['status'](_0x42859d)['json'](_0x95bb42);}};}function respondWithFilteredResult(_0x25a717,_0x467ac7){return function(_0x48ea2b){if(_0x48ea2b){var _0x4d7166=typeof _0x467ac7['offset']==='undefined'&&typeof _0x467ac7[_0x4062('0x19')]==='undefined';var _0x2efc3c=_0x48ea2b[_0x4062('0x1a')];var _0x3d14bb=_0x4d7166?0x0:_0x467ac7[_0x4062('0x1b')];var _0x2a04c7=_0x4d7166?_0x48ea2b[_0x4062('0x1a')]:_0x467ac7[_0x4062('0x1b')]+_0x467ac7['limit'];var _0x324bb3;if(_0x2a04c7>=_0x2efc3c){_0x2a04c7=_0x2efc3c;_0x324bb3=0xc8;}else{_0x324bb3=0xce;}_0x25a717['status'](_0x324bb3);return _0x25a717[_0x4062('0x1c')]('Content-Range',_0x3d14bb+'-'+_0x2a04c7+'/'+_0x2efc3c)[_0x4062('0x1d')](_0x48ea2b);}return null;};}function patchUpdates(_0x31777f){return function(_0x12c6a3){try{jsonpatch[_0x4062('0x1e')](_0x12c6a3,_0x31777f,!![]);}catch(_0x3cb45d){return BPromise[_0x4062('0x1f')](_0x3cb45d);}return _0x12c6a3[_0x4062('0x20')]();};}function saveUpdates(_0x341310,_0xc6c0ba){return function(_0x53648a){if(_0x53648a){return _0x53648a['update'](_0x341310)[_0x4062('0x21')](function(_0xc5e4a0){return _0xc5e4a0;});}return null;};}function removeEntity(_0x23f81c,_0x1fa194){return function(_0x59d19f){if(_0x59d19f){return _0x59d19f['destroy']()['then'](function(){var _0x11e837=_0x59d19f[_0x4062('0x22')]({'plain':!![]});var _0x11b962=_0x4062('0x23');return db[_0x4062('0x24')][_0x4062('0x25')]({'where':{'type':_0x11b962,'resourceId':_0x11e837['id']}})['then'](function(){return _0x59d19f;});})[_0x4062('0x21')](function(){_0x23f81c[_0x4062('0x18')](0xcc)[_0x4062('0x26')]();});}};}function handleEntityNotFound(_0x28e9e4,_0xb7f7c7){return function(_0x5934d2){if(!_0x5934d2){_0x28e9e4[_0x4062('0x17')](0x194);}return _0x5934d2;};}function handleError(_0x4a0312,_0x4de5c0){_0x4de5c0=_0x4de5c0||0x1f4;return function(_0x391065){logger['error'](_0x391065[_0x4062('0x27')]);if(_0x391065[_0x4062('0x28')]){delete _0x391065[_0x4062('0x28')];}_0x4a0312[_0x4062('0x18')](_0x4de5c0)[_0x4062('0x29')](_0x391065);};}exports[_0x4062('0x2a')]=function(_0xd818bc,_0x253bcf){var _0x5f569c={},_0x592fca={},_0x51de11={'count':0x0,'rows':[]};var _0x70dfdc=_[_0x4062('0x2b')](db['Tag'][_0x4062('0x2c')],function(_0x5ad1a3){return{'name':_0x5ad1a3['fieldName'],'type':_0x5ad1a3['type'][_0x4062('0x2d')]};});_0x592fca[_0x4062('0x2e')]=_[_0x4062('0x2b')](_0x70dfdc,_0x4062('0x28'));_0x592fca[_0x4062('0x2f')]=_[_0x4062('0x30')](_0xd818bc[_0x4062('0x2f')]);_0x592fca[_0x4062('0x31')]=_[_0x4062('0x32')](_0x592fca[_0x4062('0x2e')],_0x592fca[_0x4062('0x2f')]);_0x5f569c[_0x4062('0x33')]=_['intersection'](_0x592fca[_0x4062('0x2e')],qs['fields'](_0xd818bc[_0x4062('0x2f')][_0x4062('0x34')]));_0x5f569c[_0x4062('0x33')]=_0x5f569c['attributes'][_0x4062('0x35')]?_0x5f569c[_0x4062('0x33')]:_0x592fca[_0x4062('0x2e')];if(!_0xd818bc[_0x4062('0x2f')][_0x4062('0x36')](_0x4062('0x37'))){_0x5f569c[_0x4062('0x19')]=qs[_0x4062('0x19')](_0xd818bc[_0x4062('0x2f')]['limit']);_0x5f569c[_0x4062('0x1b')]=qs[_0x4062('0x1b')](_0xd818bc[_0x4062('0x2f')][_0x4062('0x1b')]);}_0x5f569c[_0x4062('0x38')]=qs[_0x4062('0x39')](_0xd818bc['query'][_0x4062('0x39')]);_0x5f569c[_0x4062('0x3a')]=qs[_0x4062('0x31')](_[_0x4062('0x3b')](_0xd818bc[_0x4062('0x2f')],_0x592fca['filters']),_0x70dfdc);if(_0xd818bc['query'][_0x4062('0x3c')]){_0x5f569c[_0x4062('0x3a')]=_['merge'](_0x5f569c[_0x4062('0x3a')],{'$or':_[_0x4062('0x2b')](_0x70dfdc,function(_0x3d4fab){if(_0x3d4fab[_0x4062('0x3d')]!==_0x4062('0x3e')){var _0x218864={};_0x218864[_0x3d4fab[_0x4062('0x28')]]={'$like':'%'+_0xd818bc[_0x4062('0x2f')][_0x4062('0x3c')]+'%'};return _0x218864;}})});}_0x5f569c=_[_0x4062('0x3f')]({},_0x5f569c,_0xd818bc['options']);var _0x32debb={'where':_0x5f569c[_0x4062('0x3a')]};return db['Tag']['count'](_0x32debb)['then'](function(_0x3e903b){_0x51de11[_0x4062('0x1a')]=_0x3e903b;if(_0xd818bc[_0x4062('0x2f')][_0x4062('0x40')]){_0x5f569c['include']=[{'all':!![]}];}return db['Tag'][_0x4062('0x41')](_0x5f569c);})[_0x4062('0x21')](function(_0x39c9ef){_0x51de11[_0x4062('0x42')]=_0x39c9ef;return _0x51de11;})['then'](respondWithFilteredResult(_0x253bcf,_0x5f569c))['catch'](handleError(_0x253bcf,null));};exports[_0x4062('0x43')]=function(_0x2ac3b5,_0x1c4259){var _0x1b3897={'raw':!![],'where':{'id':_0x2ac3b5[_0x4062('0x44')]['id']}},_0x9ab8ac={};_0x9ab8ac[_0x4062('0x2e')]=_[_0x4062('0x30')](db['Tag'][_0x4062('0x2c')]);_0x9ab8ac[_0x4062('0x2f')]=_[_0x4062('0x30')](_0x2ac3b5['query']);_0x9ab8ac[_0x4062('0x31')]=_['intersection'](_0x9ab8ac['model'],_0x9ab8ac[_0x4062('0x2f')]);_0x1b3897[_0x4062('0x33')]=_['intersection'](_0x9ab8ac[_0x4062('0x2e')],qs[_0x4062('0x34')](_0x2ac3b5[_0x4062('0x2f')][_0x4062('0x34')]));_0x1b3897[_0x4062('0x33')]=_0x1b3897['attributes']['length']?_0x1b3897[_0x4062('0x33')]:_0x9ab8ac[_0x4062('0x2e')];if(_0x2ac3b5[_0x4062('0x2f')]['includeAll']){_0x1b3897[_0x4062('0x45')]=[{'all':!![]}];}_0x1b3897=_[_0x4062('0x3f')]({},_0x1b3897,_0x2ac3b5['options']);return db[_0x4062('0x46')][_0x4062('0x47')](_0x1b3897)['then'](handleEntityNotFound(_0x1c4259,null))['then'](respondWithResult(_0x1c4259,null))['catch'](handleError(_0x1c4259,null));};exports[_0x4062('0x48')]=function(_0x560b20,_0x58921a){return db[_0x4062('0x46')]['create'](_0x560b20['body'],{})[_0x4062('0x21')](function(_0x15819a){var _0x1f6df9=_0x560b20['user'][_0x4062('0x22')]({'plain':!![]});if(!_0x1f6df9)throw new Error(_0x4062('0x49'));if(_0x1f6df9[_0x4062('0x4a')]==='user'){var _0x5c75b6=_0x15819a[_0x4062('0x22')]({'plain':!![]});var _0x1e9b7a='Tags';return db[_0x4062('0x4b')][_0x4062('0x47')]({'where':{'name':_0x1e9b7a,'userProfileId':_0x1f6df9[_0x4062('0x4c')]},'raw':!![]})['then'](function(_0x53729d){if(_0x53729d&&_0x53729d[_0x4062('0x4d')]===0x0){return db[_0x4062('0x24')][_0x4062('0x48')]({'name':_0x5c75b6[_0x4062('0x28')],'resourceId':_0x5c75b6['id'],'type':_0x53729d[_0x4062('0x28')],'sectionId':_0x53729d['id']},{})['then'](function(){return _0x15819a;});}else{return _0x15819a;}})['catch'](function(_0x6797c6){logger[_0x4062('0x4e')](_0x4062('0x4f'),_0x6797c6);throw _0x6797c6;});}return _0x15819a;})[_0x4062('0x21')](respondWithResult(_0x58921a,0xc9))[_0x4062('0x50')](handleError(_0x58921a,null));};exports[_0x4062('0x51')]=function(_0x2180ae,_0x2afcc7){if(_0x2180ae[_0x4062('0x52')]['id']){delete _0x2180ae[_0x4062('0x52')]['id'];}return db[_0x4062('0x46')][_0x4062('0x47')]({'where':{'id':_0x2180ae['params']['id']}})[_0x4062('0x21')](handleEntityNotFound(_0x2afcc7,null))[_0x4062('0x21')](saveUpdates(_0x2180ae['body'],null))[_0x4062('0x21')](respondWithResult(_0x2afcc7,null))[_0x4062('0x50')](handleError(_0x2afcc7,null));};exports['destroy']=function(_0x24e98c,_0x5c76e7){return db['Tag'][_0x4062('0x47')]({'where':{'id':_0x24e98c[_0x4062('0x44')]['id']}})[_0x4062('0x21')](handleEntityNotFound(_0x5c76e7,null))[_0x4062('0x21')](removeEntity(_0x5c76e7,null))[_0x4062('0x50')](handleError(_0x5c76e7,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 0074b5f..ca67d37 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 _0xc400=['tools_tags','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','Tag'];(function(_0x138ac9,_0x597a20){var _0xe99ea3=function(_0x1ff42f){while(--_0x1ff42f){_0x138ac9['push'](_0x138ac9['shift']());}};_0xe99ea3(++_0x597a20);}(_0xc400,0x105));var _0x0c40=function(_0x1cb6f4,_0x4ec026){_0x1cb6f4=_0x1cb6f4-0x0;var _0x1064c2=_0xc400[_0x1cb6f4];return _0x1064c2;};'use strict';var _=require(_0x0c40('0x0'));var util=require('util');var logger=require(_0x0c40('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0c40('0x2'));var rp=require(_0x0c40('0x3'));var fs=require('fs');var path=require(_0x0c40('0x4'));var rimraf=require(_0x0c40('0x5'));var config=require(_0x0c40('0x6'));var attributes=require(_0x0c40('0x7'));module['exports']=function(_0x3497eb,_0x5d898a){return _0x3497eb['define'](_0x0c40('0x8'),attributes,{'tableName':_0x0c40('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x842a=['bluebird','request-promise','path','rimraf','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x1b637b,_0x18155b){var _0x456ee3=function(_0x59ac87){while(--_0x59ac87){_0x1b637b['push'](_0x1b637b['shift']());}};_0x456ee3(++_0x18155b);}(_0x842a,0x133));var _0xa842=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0x842a[_0x57474e];return _0xfaae8c;};'use strict';var _=require(_0xa842('0x0'));var util=require(_0xa842('0x1'));var logger=require(_0xa842('0x2'))(_0xa842('0x3'));var moment=require(_0xa842('0x4'));var BPromise=require(_0xa842('0x5'));var rp=require(_0xa842('0x6'));var fs=require('fs');var path=require(_0xa842('0x7'));var rimraf=require(_0xa842('0x8'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xa842('0x9')]=function(_0x55c8ed,_0x3a78ae){return _0x55c8ed[_0xa842('0xa')](_0xa842('0xb'),attributes,{'tableName':_0xa842('0xc'),'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 04e7c0f..5ec6149 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 _0x0b78=['request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info'];(function(_0x34bb7e,_0x2e1af5){var _0x475bd6=function(_0x385214){while(--_0x385214){_0x34bb7e['push'](_0x34bb7e['shift']());}};_0x475bd6(++_0x2e1af5);}(_0x0b78,0x1ad));var _0x80b7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0b78[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var moment=require('moment');var BPromise=require(_0x80b7('0x2'));var rs=require(_0x80b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x80b7('0x5'))(_0x80b7('0x6'));var config=require(_0x80b7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x80b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x584401,_0x5e19ef,_0x122ebe){return new BPromise(function(_0x3c248d,_0x445c23){return client['request'](_0x584401,_0x122ebe)[_0x80b7('0x9')](function(_0x25a015){logger[_0x80b7('0xa')]('Tag,\x20%s,\x20%s',_0x5e19ef,_0x80b7('0xb'));logger['debug'](_0x80b7('0xc'),_0x5e19ef,_0x80b7('0xb'),JSON[_0x80b7('0xd')](_0x25a015));if(_0x25a015[_0x80b7('0xe')]){if(_0x25a015[_0x80b7('0xe')][_0x80b7('0xf')]===0x1f4){logger[_0x80b7('0xe')](_0x80b7('0x10'),_0x5e19ef,_0x25a015[_0x80b7('0xe')][_0x80b7('0x11')]);return _0x445c23(_0x25a015[_0x80b7('0xe')]['message']);}logger[_0x80b7('0xe')](_0x80b7('0x10'),_0x5e19ef,_0x25a015['error'][_0x80b7('0x11')]);return _0x3c248d(_0x25a015[_0x80b7('0xe')]['message']);}else{logger[_0x80b7('0xa')](_0x80b7('0x10'),_0x5e19ef,_0x80b7('0xb'));_0x3c248d(_0x25a015[_0x80b7('0x12')][_0x80b7('0x11')]);}})[_0x80b7('0x13')](function(_0x1e3d1c){logger[_0x80b7('0xe')](_0x80b7('0x10'),_0x5e19ef,_0x1e3d1c);_0x445c23(_0x1e3d1c);});});} \ No newline at end of file +var _0xaf93=['jayson/promise','client','http','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0xaf93,0x151));var _0x3af9=function(_0x2f0418,_0x505390){_0x2f0418=_0x2f0418-0x0;var _0x9cbea4=_0xaf93[_0x2f0418];return _0x9cbea4;};'use strict';var _=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3af9('0x2'));var fs=require('fs');var Redis=require(_0x3af9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3af9('0x4'));var logger=require(_0x3af9('0x5'))(_0x3af9('0x6'));var config=require(_0x3af9('0x7'));var jayson=require(_0x3af9('0x8'));var client=jayson[_0x3af9('0x9')][_0x3af9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x535583,_0x2ac1a2,_0x56e4c2){return new BPromise(function(_0x133672,_0x53b5ba){return client['request'](_0x535583,_0x56e4c2)[_0x3af9('0xb')](function(_0x5d655f){logger['info'](_0x3af9('0xc'),_0x2ac1a2,_0x3af9('0xd'));logger[_0x3af9('0xe')](_0x3af9('0xf'),_0x2ac1a2,'request\x20sent',JSON[_0x3af9('0x10')](_0x5d655f));if(_0x5d655f[_0x3af9('0x11')]){if(_0x5d655f[_0x3af9('0x11')][_0x3af9('0x12')]===0x1f4){logger[_0x3af9('0x11')](_0x3af9('0xc'),_0x2ac1a2,_0x5d655f[_0x3af9('0x11')][_0x3af9('0x13')]);return _0x53b5ba(_0x5d655f['error'][_0x3af9('0x13')]);}logger['error'](_0x3af9('0xc'),_0x2ac1a2,_0x5d655f[_0x3af9('0x11')][_0x3af9('0x13')]);return _0x133672(_0x5d655f['error'][_0x3af9('0x13')]);}else{logger[_0x3af9('0x14')](_0x3af9('0xc'),_0x2ac1a2,'request\x20sent');_0x133672(_0x5d655f[_0x3af9('0x15')][_0x3af9('0x13')]);}})[_0x3af9('0x16')](function(_0x29dc4b){logger['error'](_0x3af9('0xc'),_0x2ac1a2,_0x29dc4b);_0x53b5ba(_0x29dc4b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6227a8b..6a3f3fb 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 a0df3a9..30e5655 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(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb7e7[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x182439,_0x768e81){var _0x4a8633=function(_0x3a1d09){while(--_0x3a1d09){_0x182439['push'](_0x182439['shift']());}};_0x4a8633(++_0x768e81);}(_0x2032,0xd9));var _0x2203=function(_0x20e51a,_0x3af51f){_0x20e51a=_0x20e51a-0x0;var _0x29ca98=_0x2032[_0x20e51a];return _0x29ca98;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 1c579ed..75153c7 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 _0x4bea=['remove','addAgents','isArray','Chat','Mail','Sms','Fax','Openchannel','Voice','through','penalty','TeamVoiceQueue','User','findOrCreate','Queue:save','QueueId','interface','isNil','format','SIP/%s','voicePause','all','removeAgents','Whatsapp','emit','Queue:remove','UserVoiceQueueRt','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Team','includeAll','include','findAll','rows','show','params','keys','catch','create','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','find','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','ValidationError','capitalize','Queue','Queues','Unknown\x20channel','add','toLowerCase','ids','removeQueues','isValidChannel'];(function(_0x293fa4,_0x3ee6cc){var _0x58d190=function(_0x7aea40){while(--_0x7aea40){_0x293fa4['push'](_0x293fa4['shift']());}};_0x58d190(++_0x3ee6cc);}(_0x4bea,0x14e));var _0xa4be=function(_0x372915,_0x2dbd58){_0x372915=_0x372915-0x0;var _0x42ea51=_0x4bea[_0x372915];return _0x42ea51;};'use strict';var emlformat=require(_0xa4be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4be('0x1'));var jsonpatch=require(_0xa4be('0x2'));var rp=require(_0xa4be('0x3'));var moment=require(_0xa4be('0x4'));var BPromise=require(_0xa4be('0x5'));var Mustache=require(_0xa4be('0x6'));var util=require(_0xa4be('0x7'));var path=require('path');var sox=require(_0xa4be('0x8'));var csv=require(_0xa4be('0x9'));var ejs=require(_0xa4be('0xa'));var fs=require('fs');var fs_extra=require(_0xa4be('0xb'));var _=require(_0xa4be('0xc'));var squel=require(_0xa4be('0xd'));var crypto=require('crypto');var jsforce=require(_0xa4be('0xe'));var deskjs=require(_0xa4be('0xf'));var toCsv=require(_0xa4be('0x9'));var querystring=require(_0xa4be('0x10'));var Papa=require(_0xa4be('0x11'));var Redis=require(_0xa4be('0x12'));var authService=require(_0xa4be('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa4be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4be('0x15'))(_0xa4be('0x16'));var utils=require('../../config/utils');var config=require(_0xa4be('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4be('0x18'))['db'];config[_0xa4be('0x19')]=_[_0xa4be('0x1a')](config['redis'],{'host':_0xa4be('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa4be('0x19')]));require(_0xa4be('0x1c'))[_0xa4be('0x1d')](socket);function respondWithStatusCode(_0x17b46a,_0x44732b){_0x44732b=_0x44732b||0xcc;return function(_0x30e150){if(_0x30e150){return _0x17b46a[_0xa4be('0x1e')](_0x44732b);}return _0x17b46a[_0xa4be('0x1f')](_0x44732b)[_0xa4be('0x20')]();};}function respondWithResult(_0x1ef9d9,_0x521843){_0x521843=_0x521843||0xc8;return function(_0x2e32fc){if(_0x2e32fc){return _0x1ef9d9[_0xa4be('0x1f')](_0x521843)[_0xa4be('0x21')](_0x2e32fc);}};}function respondWithFilteredResult(_0x3f9d54,_0x7e16cb){return function(_0x3c5804){if(_0x3c5804){var _0x23231b=typeof _0x7e16cb[_0xa4be('0x22')]==='undefined'&&typeof _0x7e16cb[_0xa4be('0x23')]===_0xa4be('0x24');var _0x4aa365=_0x3c5804[_0xa4be('0x25')];var _0x5d5115=_0x23231b?0x0:_0x7e16cb[_0xa4be('0x22')];var _0x777fd=_0x23231b?_0x3c5804[_0xa4be('0x25')]:_0x7e16cb[_0xa4be('0x22')]+_0x7e16cb['limit'];var _0xde2ad2;if(_0x777fd>=_0x4aa365){_0x777fd=_0x4aa365;_0xde2ad2=0xc8;}else{_0xde2ad2=0xce;}_0x3f9d54[_0xa4be('0x1f')](_0xde2ad2);return _0x3f9d54['set'](_0xa4be('0x26'),_0x5d5115+'-'+_0x777fd+'/'+_0x4aa365)[_0xa4be('0x21')](_0x3c5804);}return null;};}function patchUpdates(_0x3f624e){return function(_0x4b6826){try{jsonpatch['apply'](_0x4b6826,_0x3f624e,!![]);}catch(_0x5db7de){return BPromise['reject'](_0x5db7de);}return _0x4b6826['save']();};}function saveUpdates(_0x433427,_0x4eef6c){return function(_0x2102ae){if(_0x2102ae){return _0x2102ae[_0xa4be('0x27')](_0x433427)[_0xa4be('0x28')](function(_0x945539){return _0x945539;});}return null;};}function handleEntityNotFound(_0x44eecb,_0x18ec41){return function(_0x453f2e){if(!_0x453f2e){_0x44eecb[_0xa4be('0x1e')](0x194);}return _0x453f2e;};}function handleError(_0x3f6cfe,_0x35bf32){_0x35bf32=_0x35bf32||0x1f4;return function(_0x2baaa7){logger[_0xa4be('0x29')](_0x2baaa7[_0xa4be('0x2a')]);if(_0x2baaa7[_0xa4be('0x2b')]){delete _0x2baaa7[_0xa4be('0x2b')];}_0x3f6cfe[_0xa4be('0x1f')](_0x35bf32)[_0xa4be('0x2c')](_0x2baaa7);};}exports['index']=function(_0x22895c,_0x36352f){var _0x30797e={},_0x2900e8={},_0x53e112={'count':0x0,'rows':[]};var _0x11d64=_[_0xa4be('0x2d')](db['Team'][_0xa4be('0x2e')],function(_0x19b267){return{'name':_0x19b267['fieldName'],'type':_0x19b267[_0xa4be('0x2f')][_0xa4be('0x30')]};});_0x2900e8[_0xa4be('0x31')]=_['map'](_0x11d64,_0xa4be('0x2b'));_0x2900e8[_0xa4be('0x32')]=_['keys'](_0x22895c['query']);_0x2900e8[_0xa4be('0x33')]=_[_0xa4be('0x34')](_0x2900e8[_0xa4be('0x31')],_0x2900e8['query']);_0x30797e[_0xa4be('0x35')]=_['intersection'](_0x2900e8[_0xa4be('0x31')],qs[_0xa4be('0x36')](_0x22895c[_0xa4be('0x32')][_0xa4be('0x36')]));_0x30797e[_0xa4be('0x35')]=_0x30797e[_0xa4be('0x35')][_0xa4be('0x37')]?_0x30797e['attributes']:_0x2900e8[_0xa4be('0x31')];if(!_0x22895c[_0xa4be('0x32')][_0xa4be('0x38')](_0xa4be('0x39'))){_0x30797e[_0xa4be('0x23')]=qs[_0xa4be('0x23')](_0x22895c[_0xa4be('0x32')][_0xa4be('0x23')]);_0x30797e[_0xa4be('0x22')]=qs[_0xa4be('0x22')](_0x22895c[_0xa4be('0x32')]['offset']);}_0x30797e[_0xa4be('0x3a')]=qs['sort'](_0x22895c[_0xa4be('0x32')][_0xa4be('0x3b')]);_0x30797e[_0xa4be('0x3c')]=qs[_0xa4be('0x33')](_[_0xa4be('0x3d')](_0x22895c[_0xa4be('0x32')],_0x2900e8[_0xa4be('0x33')]),_0x11d64);if(_0x22895c[_0xa4be('0x32')][_0xa4be('0x3e')]){_0x30797e[_0xa4be('0x3c')]=_[_0xa4be('0x3f')](_0x30797e[_0xa4be('0x3c')],{'$or':_['map'](_0x11d64,function(_0x401e27){if(_0x401e27[_0xa4be('0x2f')]!==_0xa4be('0x40')){var _0xcaba9d={};_0xcaba9d[_0x401e27[_0xa4be('0x2b')]]={'$like':'%'+_0x22895c['query']['filter']+'%'};return _0xcaba9d;}})});}_0x30797e=_[_0xa4be('0x3f')]({},_0x30797e,_0x22895c[_0xa4be('0x41')]);var _0x3d686d={'where':_0x30797e[_0xa4be('0x3c')]};return db[_0xa4be('0x42')]['count'](_0x3d686d)[_0xa4be('0x28')](function(_0x2c4e41){_0x53e112[_0xa4be('0x25')]=_0x2c4e41;if(_0x22895c['query'][_0xa4be('0x43')]){_0x30797e[_0xa4be('0x44')]=[{'all':!![]}];}return db[_0xa4be('0x42')][_0xa4be('0x45')](_0x30797e);})[_0xa4be('0x28')](function(_0x1bb3ae){_0x53e112[_0xa4be('0x46')]=_0x1bb3ae;return _0x53e112;})[_0xa4be('0x28')](respondWithFilteredResult(_0x36352f,_0x30797e))['catch'](handleError(_0x36352f,null));};exports[_0xa4be('0x47')]=function(_0x4a71e3,_0x22c82a){var _0x494721={'raw':![],'where':{'id':_0x4a71e3[_0xa4be('0x48')]['id']}},_0x18da10={};_0x18da10[_0xa4be('0x31')]=_[_0xa4be('0x49')](db[_0xa4be('0x42')][_0xa4be('0x2e')]);_0x18da10['query']=_['keys'](_0x4a71e3[_0xa4be('0x32')]);_0x18da10[_0xa4be('0x33')]=_[_0xa4be('0x34')](_0x18da10[_0xa4be('0x31')],_0x18da10[_0xa4be('0x32')]);_0x494721[_0xa4be('0x35')]=_[_0xa4be('0x34')](_0x18da10[_0xa4be('0x31')],qs[_0xa4be('0x36')](_0x4a71e3[_0xa4be('0x32')]['fields']));_0x494721[_0xa4be('0x35')]=_0x494721[_0xa4be('0x35')][_0xa4be('0x37')]?_0x494721[_0xa4be('0x35')]:_0x18da10[_0xa4be('0x31')];if(_0x4a71e3['query'][_0xa4be('0x43')]){_0x494721[_0xa4be('0x44')]=[{'all':!![]}];}_0x494721=_[_0xa4be('0x3f')]({},_0x494721,_0x4a71e3['options']);return db['Team']['find'](_0x494721)[_0xa4be('0x28')](handleEntityNotFound(_0x22c82a,null))[_0xa4be('0x28')](respondWithResult(_0x22c82a,null))[_0xa4be('0x4a')](handleError(_0x22c82a,null));};exports[_0xa4be('0x4b')]=function(_0x1578d5,_0x513761){return db['Team']['create'](_0x1578d5['body'],{})[_0xa4be('0x28')](function(_0x41734c){var _0x4129c9=_0x1578d5[_0xa4be('0x4c')][_0xa4be('0x4d')]({'plain':!![]});if(!_0x4129c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4129c9['role']===_0xa4be('0x4c')){var _0x2ba309=_0x41734c[_0xa4be('0x4d')]({'plain':!![]});var _0x5bb1b8='Teams';return db[_0xa4be('0x4e')]['find']({'where':{'name':_0x5bb1b8,'userProfileId':_0x4129c9['userProfileId']},'raw':!![]})[_0xa4be('0x28')](function(_0x5a5513){if(_0x5a5513&&_0x5a5513[_0xa4be('0x4f')]===0x0){return db['UserProfileResource'][_0xa4be('0x4b')]({'name':_0x2ba309[_0xa4be('0x2b')],'resourceId':_0x2ba309['id'],'type':_0x5a5513[_0xa4be('0x2b')],'sectionId':_0x5a5513['id']},{})[_0xa4be('0x28')](function(){return _0x41734c;});}else{return _0x41734c;}})[_0xa4be('0x4a')](function(_0x5e68d2){logger['error'](_0xa4be('0x50'),_0x5e68d2);throw _0x5e68d2;});}return _0x41734c;})['then'](respondWithResult(_0x513761,0xc9))[_0xa4be('0x4a')](handleError(_0x513761,null));};exports['update']=function(_0x2a78ed,_0x262882){if(_0x2a78ed[_0xa4be('0x51')]['id']){delete _0x2a78ed[_0xa4be('0x51')]['id'];}return db[_0xa4be('0x42')]['find']({'where':{'id':_0x2a78ed['params']['id']}})[_0xa4be('0x28')](handleEntityNotFound(_0x262882,null))['then'](saveUpdates(_0x2a78ed[_0xa4be('0x51')],null))['then'](respondWithResult(_0x262882,null))['catch'](handleError(_0x262882,null));};exports[_0xa4be('0x52')]=function(_0x3029cd,_0x1cee2c){var _0x2401aa=_0x3029cd[_0xa4be('0x48')]['id'];var _0x206b12=[];return db[_0xa4be('0x53')][_0xa4be('0x54')](function(_0x28d2b1){var _0x33fe74=_0xa4be('0x55')+_0x2401aa;return db[_0xa4be('0x53')][_0xa4be('0x32')](_0x33fe74,{'type':db['Sequelize'][_0xa4be('0x56')][_0xa4be('0x57')],'raw':!![],'transaction':_0x28d2b1})['then'](function(_0x3387b6){_0x206b12=_['map'](_0x3387b6,function(_0x382d82){return Number(_0x382d82[_0xa4be('0x58')]);});})[_0xa4be('0x28')](function(){var _0x38f4ac=_0xa4be('0x59')+_0x2401aa;return db[_0xa4be('0x53')][_0xa4be('0x32')](_0x38f4ac,{'type':db['Sequelize']['QueryTypes'][_0xa4be('0x57')],'raw':!![],'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(_0x3c5117){var _0x57ad77=_[_0xa4be('0x2d')](_0x3c5117,function(_0x4ec61c){return Number(_0x4ec61c[_0xa4be('0x5a')]);});return db[_0xa4be('0x5b')][_0xa4be('0x52')]({'where':{'UserId':{'$in':_0x206b12},'VoiceQueueId':{'$in':_0x57ad77}},'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(){var _0x18e1a7=_0xa4be('0x5c')+_0x2401aa;return db['sequelize'][_0xa4be('0x32')](_0x18e1a7,{'type':db[_0xa4be('0x5d')][_0xa4be('0x56')]['SELECT'],'raw':!![],'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(_0x250030){var _0x1c617b=_[_0xa4be('0x2d')](_0x250030,function(_0x4bef28){return Number(_0x4bef28[_0xa4be('0x5e')]);});return db['UserMailQueue'][_0xa4be('0x52')]({'where':{'UserId':{'$in':_0x206b12},'MailQueueId':{'$in':_0x1c617b}},'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(){var _0x18f1d6=_0xa4be('0x5f')+_0x2401aa;return db['sequelize'][_0xa4be('0x32')](_0x18f1d6,{'type':db['Sequelize'][_0xa4be('0x56')][_0xa4be('0x57')],'raw':!![],'transaction':_0x28d2b1});})['then'](function(_0x2ac61b){var _0x5cba73=_[_0xa4be('0x2d')](_0x2ac61b,function(_0x4d8adc){return Number(_0x4d8adc['SmsQueueId']);});return db['UserSmsQueue'][_0xa4be('0x52')]({'where':{'UserId':{'$in':_0x206b12},'SmsQueueId':{'$in':_0x5cba73}},'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(){var _0x453de9=_0xa4be('0x60')+_0x2401aa;return db[_0xa4be('0x53')]['query'](_0x453de9,{'type':db[_0xa4be('0x5d')][_0xa4be('0x56')][_0xa4be('0x57')],'raw':!![],'transaction':_0x28d2b1});})['then'](function(_0x433c98){var _0x5da250=_[_0xa4be('0x2d')](_0x433c98,function(_0x74a1d9){return Number(_0x74a1d9[_0xa4be('0x61')]);});return db[_0xa4be('0x62')][_0xa4be('0x52')]({'where':{'UserId':{'$in':_0x206b12},'ChatQueueId':{'$in':_0x5da250}},'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(){var _0x1a292d=_0xa4be('0x63')+_0x2401aa;return db[_0xa4be('0x53')][_0xa4be('0x32')](_0x1a292d,{'type':db[_0xa4be('0x5d')][_0xa4be('0x56')][_0xa4be('0x57')],'raw':!![],'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(_0x7ec08e){var _0x432b19=_[_0xa4be('0x2d')](_0x7ec08e,function(_0x5ad337){return Number(_0x5ad337[_0xa4be('0x64')]);});return db[_0xa4be('0x65')][_0xa4be('0x52')]({'where':{'UserId':{'$in':_0x206b12},'FaxQueueId':{'$in':_0x432b19}},'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(){var _0x1ecb06=_0xa4be('0x66')+_0x2401aa;return db[_0xa4be('0x53')][_0xa4be('0x32')](_0x1ecb06,{'type':db[_0xa4be('0x5d')][_0xa4be('0x56')][_0xa4be('0x57')],'raw':!![],'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(_0xf6d270){var _0x4d3163=_[_0xa4be('0x2d')](_0xf6d270,function(_0x6c0b10){return Number(_0x6c0b10[_0xa4be('0x67')]);});return db['UserOpenchannelQueue'][_0xa4be('0x52')]({'where':{'UserId':{'$in':_0x206b12},'OpenchannelQueueId':{'$in':_0x4d3163}},'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(){var _0x33f5f0=_0xa4be('0x68')+_0x2401aa;return db[_0xa4be('0x53')][_0xa4be('0x32')](_0x33f5f0,{'type':db[_0xa4be('0x5d')]['QueryTypes'][_0xa4be('0x57')],'raw':!![],'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(_0x5d84c6){var _0x4fe667=_[_0xa4be('0x2d')](_0x5d84c6,function(_0x23d8b2){return Number(_0x23d8b2[_0xa4be('0x69')]);});return db[_0xa4be('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x206b12},'WhatsappQueueId':{'$in':_0x4fe667}},'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(){return db[_0xa4be('0x6b')][_0xa4be('0x6c')]({'where':{'TeamId':_0x2401aa}});})['then'](function(_0x3ee191){if(_0x3ee191===null){return;}return db[_0xa4be('0x6d')][_0xa4be('0x52')]({'where':{'UserId':{'$in':_0x206b12},'VoicePrefixId':_0x3ee191[_0xa4be('0x6e')]},'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(){return db[_0xa4be('0x42')][_0xa4be('0x52')]({'where':{'id':_0x2401aa},'cascade':!![],'transaction':_0x28d2b1});})[_0xa4be('0x28')](function(_0x158004){if(_0x158004===0x0){_0x1cee2c[_0xa4be('0x1e')](0x194);}else{return db[_0xa4be('0x6f')][_0xa4be('0x52')]({'where':{'type':'Teams','resourceId':_0x2401aa},'cascade':!![],'transaction':_0x28d2b1})[_0xa4be('0x28')](function(){_0x1cee2c['status'](0xcc)[_0xa4be('0x20')]();});}})['catch'](function(_0x5df4bf){_0x1cee2c['status'](0x1f4)['send'](_0x5df4bf);});});};exports[_0xa4be('0x70')]=function(_0xfad60b,_0x43430e,_0x1bd085){return db[_0xa4be('0x42')][_0xa4be('0x71')]({'where':{'id':_0xfad60b[_0xa4be('0x48')]['id']}})['then'](handleEntityNotFound(_0x43430e,null))[_0xa4be('0x28')](function(_0x2a9ae9){if(!_0xfad60b[_0xa4be('0x32')][_0xa4be('0x72')]||!utils['isValidChannel'](_0xfad60b[_0xa4be('0x32')][_0xa4be('0x72')])){throw new db[(_0xa4be('0x5d'))][(_0xa4be('0x73'))]('Unknown\x20channel');}var _0x533f31={};var _0x180009={};_0x180009[_0xa4be('0x31')]=_[_0xa4be('0x49')](db[_[_0xa4be('0x74')](_0xfad60b[_0xa4be('0x32')][_0xa4be('0x72')]['toLowerCase']())+_0xa4be('0x75')][_0xa4be('0x2e')]);_0x180009[_0xa4be('0x32')]=_['keys'](_0xfad60b[_0xa4be('0x32')]);_0x180009[_0xa4be('0x33')]=_[_0xa4be('0x34')](_0x180009['model'],_0x180009[_0xa4be('0x32')]);_0x533f31[_0xa4be('0x35')]=_[_0xa4be('0x34')](_0x180009[_0xa4be('0x31')],qs[_0xa4be('0x36')](_0xfad60b[_0xa4be('0x32')][_0xa4be('0x36')]));_0x533f31[_0xa4be('0x35')]=_0x533f31[_0xa4be('0x35')][_0xa4be('0x37')]?_0x533f31['attributes']:_0x180009[_0xa4be('0x31')];_0x533f31[_0xa4be('0x23')]=qs['limit'](_0xfad60b[_0xa4be('0x32')]['limit']);_0x533f31[_0xa4be('0x22')]=qs[_0xa4be('0x22')](_0xfad60b[_0xa4be('0x32')][_0xa4be('0x22')]);_0x533f31[_0xa4be('0x3a')]=qs['sort'](_0xfad60b[_0xa4be('0x32')][_0xa4be('0x3b')]);_0x533f31[_0xa4be('0x3c')]=qs[_0xa4be('0x33')](_['pick'](_0xfad60b[_0xa4be('0x32')],_0x180009[_0xa4be('0x33')]));_0x533f31=_[_0xa4be('0x3f')]({},_0x533f31,_0xfad60b[_0xa4be('0x41')]);return _0x2a9ae9[_0xa4be('0x4d')+_['capitalize'](_0xfad60b[_0xa4be('0x32')]['channel']['toLowerCase']())+_0xa4be('0x76')](_0x533f31);})[_0xa4be('0x28')](respondWithResult(_0x43430e,null))[_0xa4be('0x4a')](handleError(_0x43430e,null));};exports['addQueues']=function(_0x221d97,_0x1d58e5,_0x23261b){return db[_0xa4be('0x42')][_0xa4be('0x71')]({'where':{'id':_0x221d97[_0xa4be('0x48')]['id']}})[_0xa4be('0x28')](function(_0x1cd6a9){if(_0x1cd6a9){if(!_0x221d97[_0xa4be('0x51')][_0xa4be('0x72')]||!utils['isValidChannel'](_0x221d97['body'][_0xa4be('0x72')])){throw new db[(_0xa4be('0x5d'))]['ValidationError'](_0xa4be('0x77'));}return _0x1cd6a9[_0xa4be('0x78')+_[_0xa4be('0x74')](_0x221d97[_0xa4be('0x51')]['channel'][_0xa4be('0x79')]())+_0xa4be('0x76')](_0x221d97['body'][_0xa4be('0x7a')]);}return null;})[_0xa4be('0x28')](handleEntityNotFound(_0x1d58e5,null))[_0xa4be('0x28')](respondWithStatusCode(_0x1d58e5,null))['catch'](handleError(_0x1d58e5,null));};exports[_0xa4be('0x7b')]=function(_0x11a4e9,_0x3392aa,_0x9c05bd){return db[_0xa4be('0x42')][_0xa4be('0x71')]({'where':{'id':_0x11a4e9[_0xa4be('0x48')]['id']}})[_0xa4be('0x28')](function(_0x33fc26){if(_0x33fc26){if(!_0x11a4e9[_0xa4be('0x32')][_0xa4be('0x72')]||!utils[_0xa4be('0x7c')](_0x11a4e9[_0xa4be('0x32')]['channel'])){throw new db[(_0xa4be('0x5d'))][(_0xa4be('0x73'))](_0xa4be('0x77'));}return _0x33fc26[_0xa4be('0x7d')+_[_0xa4be('0x74')](_0x11a4e9[_0xa4be('0x32')][_0xa4be('0x72')][_0xa4be('0x79')]())+_0xa4be('0x76')](_0x11a4e9[_0xa4be('0x32')]['ids']);}return null;})[_0xa4be('0x28')](handleEntityNotFound(_0x3392aa,null))[_0xa4be('0x28')](respondWithStatusCode(_0x3392aa,null))[_0xa4be('0x4a')](handleError(_0x3392aa,null));};exports[_0xa4be('0x7e')]=function(_0x158bbb,_0x226ff7){var _0x502351=_[_0xa4be('0x7f')](_0x158bbb[_0xa4be('0x51')]['ids'])?_0x158bbb[_0xa4be('0x51')][_0xa4be('0x7a')]:[_0x158bbb[_0xa4be('0x51')][_0xa4be('0x7a')]];var _0x291387=_0x158bbb['params']['id'];return db[_0xa4be('0x42')][_0xa4be('0x6c')]({'where':{'id':_0x291387}})[_0xa4be('0x28')](handleEntityNotFound(_0x226ff7,null))['then'](function(_0x465709){if(_0x465709){var _0x1a3a4c=['Voice',_0xa4be('0x80'),_0xa4be('0x81'),_0xa4be('0x82'),_0xa4be('0x83'),_0xa4be('0x84'),'Whatsapp'];return db['sequelize'][_0xa4be('0x54')](function(_0x48ef36){var _0x37999b=_[_0xa4be('0x2d')](_0x1a3a4c,function(_0x4ed290){var _0x420714={'attributes':['id',_0xa4be('0x2b')]};if(_0x4ed290===_0xa4be('0x85')){_0x420714[_0xa4be('0x86')]={'attributes':[_0xa4be('0x87')]};}return _0x465709[_0xa4be('0x4d')+_0x4ed290+_0xa4be('0x76')](_0x420714)[_0xa4be('0x28')](function(_0x34573c){var _0x11d867=_[_0xa4be('0x2d')](_0x34573c,function(_0x3eebee){var _0xcca16c=_[_0xa4be('0x2d')](_0x502351,function(_0x4d048d){var _0x37f8fd={'where':{'UserId':_0x4d048d,[_0x4ed290+'QueueId']:_0x3eebee['id']},'transaction':_0x48ef36};if(_0x4ed290==='Voice'){_0x37f8fd[_0xa4be('0x1a')]={'penalty':_0x3eebee[_0xa4be('0x88')][_0xa4be('0x87')]};}return db[_0xa4be('0x89')+_0x4ed290+_0xa4be('0x75')][_0xa4be('0x8a')](_0x37f8fd)[_0xa4be('0x28')](function(){socket['emit']('user'+_0x4ed290+_0xa4be('0x8b'),{'UserId':_0x4d048d,[_0x4ed290+_0xa4be('0x8c')]:_0x3eebee['id']});if(_0x4ed290!==_0xa4be('0x85')){return;}return db[_0xa4be('0x89')][_0xa4be('0x45')]({'where':{'id':_0x502351,'online':0x1},'attributes':['id',_0xa4be('0x2b'),'online','voicePause',_0xa4be('0x8d')],'raw':!![]})['then'](function(_0x203049){var _0x1f2e22=_[_0xa4be('0x2d')](_0x203049,function(_0x193f8a){return db['UserVoiceQueueRt']['upsert']({'membername':_0x193f8a[_0xa4be('0x2b')],'UserId':_0x193f8a['id'],'queue_name':_0x3eebee[_0xa4be('0x2b')],'VoiceQueueId':_0x3eebee['id'],'interface':_[_0xa4be('0x8e')](_0x193f8a[_0xa4be('0x8d')])?util[_0xa4be('0x8f')](_0xa4be('0x90'),_0x193f8a[_0xa4be('0x2b')]):_0x193f8a[_0xa4be('0x8d')],'paused':_0x193f8a[_0xa4be('0x91')]||![],'penalty':_0x3eebee[_0xa4be('0x88')]['penalty']},{'transaction':_0x48ef36});});return Promise[_0xa4be('0x92')](_0x1f2e22);});});});return Promise[_0xa4be('0x92')](_0xcca16c);});return Promise[_0xa4be('0x92')](_0x11d867);})[_0xa4be('0x28')](function(){return db[_0xa4be('0x6b')]['findOne']({'where':{'teamId':_0x291387}})[_0xa4be('0x28')](function(_0x2c50b3){if(_0x2c50b3){var _0x13d28b=_[_0xa4be('0x2d')](_0x502351,function(_0x3e91a4){db[_0xa4be('0x6d')]['upsert']({'UserId':_0x3e91a4,'VoicePrefixId':_0x2c50b3[_0xa4be('0x6e')]});});return Promise[_0xa4be('0x92')](_0x13d28b);}});});});return Promise['all'](_0x37999b)['then'](function(){return _0x465709[_0xa4be('0x7e')](_0x502351,{'transaction':_0x48ef36})['spread'](function(_0x4acf9e){return _0x4acf9e;});});});}})['then'](respondWithResult(_0x226ff7,null))[_0xa4be('0x4a')](handleError(_0x226ff7,null));};exports[_0xa4be('0x93')]=function(_0x224479,_0x4f8ada){var _0x5828af=_[_0xa4be('0x7f')](_0x224479[_0xa4be('0x32')][_0xa4be('0x7a')])?_0x224479[_0xa4be('0x32')][_0xa4be('0x7a')]:[_0x224479['query'][_0xa4be('0x7a')]];var _0x5106b3=_0x224479[_0xa4be('0x48')]['id'];return db[_0xa4be('0x42')][_0xa4be('0x6c')]({'where':{'id':_0x5106b3}})[_0xa4be('0x28')](handleEntityNotFound(_0x4f8ada,null))[_0xa4be('0x28')](function(_0x44bdae){if(_0x44bdae){var _0x2decaa=[_0xa4be('0x85'),'Chat',_0xa4be('0x81'),_0xa4be('0x82'),_0xa4be('0x83'),_0xa4be('0x84'),_0xa4be('0x94')];return db[_0xa4be('0x53')]['transaction'](function(_0x42c6b7){var _0x19ba1c=_[_0xa4be('0x2d')](_0x2decaa,function(_0x19676d){var _0xeae1ea={'attributes':['id',_0xa4be('0x2b')]};return _0x44bdae[_0xa4be('0x4d')+_0x19676d+_0xa4be('0x76')](_0xeae1ea)['then'](function(_0x8171c8){var _0x399db1=_[_0xa4be('0x2d')](_0x8171c8,function(_0x1bdd5a){return _0x1bdd5a[_0xa4be('0x93')](_0x5828af,{'transaction':_0x42c6b7})[_0xa4be('0x28')](function(){var _0xf0de78=_['map'](_0x5828af,function(_0x1cbbb1){socket[_0xa4be('0x95')]('user'+_0x19676d+_0xa4be('0x96'),{'UserId':Number(_0x1cbbb1),[_0x19676d+_0xa4be('0x8c')]:_0x1bdd5a['id']});if(_0x19676d!=='Voice'){return;}return db[_0xa4be('0x97')][_0xa4be('0x52')]({'where':{'VoiceQueueId':_0x1bdd5a['id'],'UserId':_0x1cbbb1},'transaction':_0x42c6b7});});return Promise[_0xa4be('0x92')](_0xf0de78);});});return Promise[_0xa4be('0x92')](_0x399db1);});});return Promise['all'](_0x19ba1c)[_0xa4be('0x28')](function(){return _0x44bdae[_0xa4be('0x93')](_0x5828af,{'transaction':_0x42c6b7});})[_0xa4be('0x28')](function(){return db[_0xa4be('0x6b')][_0xa4be('0x71')]({'where':{'teamId':_0x5106b3}})[_0xa4be('0x28')](function(_0xdeb507){if(_0xdeb507){var _0x39bf28=_['map'](_0x5828af,function(_0x4496c9){db[_0xa4be('0x6d')][_0xa4be('0x52')]({'where':{'UserId':_0x4496c9,'VoicePrefixId':_0xdeb507[_0xa4be('0x6e')]}});});return Promise[_0xa4be('0x92')](_0x39bf28);}});});});}})[_0xa4be('0x28')](respondWithStatusCode(_0x4f8ada,null))['catch'](handleError(_0x4f8ada,null));};exports[_0xa4be('0x98')]=function(_0x3c473d,_0x265391,_0x25d51e){var _0xd363ea={};var _0x562253={};var _0x27843a;var _0xa25c39;return db[_0xa4be('0x42')][_0xa4be('0x71')]({'where':{'id':_0x3c473d[_0xa4be('0x48')]['id']}})['then'](handleEntityNotFound(_0x265391,null))[_0xa4be('0x28')](function(_0x45f1d8){if(_0x45f1d8){_0x27843a=_0x45f1d8;_0x562253['model']=_['keys'](db[_0xa4be('0x89')][_0xa4be('0x2e')]);_0x562253[_0xa4be('0x32')]=_['keys'](_0x3c473d[_0xa4be('0x32')]);_0x562253['filters']=_[_0xa4be('0x34')](_0x562253['model'],_0x562253['query']);_0xd363ea[_0xa4be('0x35')]=_['intersection'](_0x562253[_0xa4be('0x31')],qs[_0xa4be('0x36')](_0x3c473d[_0xa4be('0x32')][_0xa4be('0x36')]));_0xd363ea[_0xa4be('0x35')]=_0xd363ea[_0xa4be('0x35')][_0xa4be('0x37')]?_0xd363ea[_0xa4be('0x35')]:_0x562253[_0xa4be('0x31')];_0xd363ea[_0xa4be('0x3a')]=qs[_0xa4be('0x3b')](_0x3c473d[_0xa4be('0x32')][_0xa4be('0x3b')]);_0xd363ea[_0xa4be('0x3c')]=qs[_0xa4be('0x33')](_['pick'](_0x3c473d[_0xa4be('0x32')],_0x562253[_0xa4be('0x33')]));if(_0x3c473d[_0xa4be('0x32')][_0xa4be('0x3e')]){_0xd363ea[_0xa4be('0x3c')]=_[_0xa4be('0x3f')](_0xd363ea['where'],{'$or':_[_0xa4be('0x2d')](_0xd363ea[_0xa4be('0x35')],function(_0x14522d){var _0x36506c={};_0x36506c[_0x14522d]={'$like':'%'+_0x3c473d['query'][_0xa4be('0x3e')]+'%'};return _0x36506c;})});}_0xd363ea=_[_0xa4be('0x3f')]({},_0xd363ea,_0x3c473d[_0xa4be('0x41')]);return _0x27843a[_0xa4be('0x98')](_0xd363ea);}})[_0xa4be('0x28')](function(_0x124d0b){if(_0x124d0b){_0xa25c39=_0x124d0b[_0xa4be('0x37')];if(!_0x3c473d[_0xa4be('0x32')][_0xa4be('0x38')](_0xa4be('0x39'))){_0xd363ea[_0xa4be('0x23')]=qs['limit'](_0x3c473d[_0xa4be('0x32')][_0xa4be('0x23')]);_0xd363ea['offset']=qs[_0xa4be('0x22')](_0x3c473d[_0xa4be('0x32')][_0xa4be('0x22')]);}return _0x27843a[_0xa4be('0x98')](_0xd363ea);}})[_0xa4be('0x28')](function(_0x3294eb){if(_0x3294eb){return _0x3294eb?{'count':_0xa25c39,'rows':_0x3294eb}:null;}})[_0xa4be('0x28')](respondWithResult(_0x265391,null))[_0xa4be('0x4a')](handleError(_0x265391,null));}; \ No newline at end of file +var _0xea53=['query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','Sequelize','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','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','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','getQueues','isValidChannel','channel','ValidationError','capitalize','toLowerCase','Queues','addQueues','findOne','ids','removeQueues','Unknown\x20channel','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','Queue','findOrCreate','emit','Queue:save','User','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','addAgents','spread','removeAgents','Queue:remove','getAgents','nolimit','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','error','name','send','map','Team','rawAttributes','fieldName','type','key','model'];(function(_0x3bfaec,_0x52c9a2){var _0x1c002a=function(_0x4492a3){while(--_0x4492a3){_0x3bfaec['push'](_0x3bfaec['shift']());}};_0x1c002a(++_0x52c9a2);}(_0xea53,0x102));var _0x3ea5=function(_0x34d9e8,_0x3a6afb){_0x34d9e8=_0x34d9e8-0x0;var _0x48127d=_0xea53[_0x34d9e8];return _0x48127d;};'use strict';var emlformat=require(_0x3ea5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3ea5('0x1'));var moment=require(_0x3ea5('0x2'));var BPromise=require(_0x3ea5('0x3'));var Mustache=require(_0x3ea5('0x4'));var util=require(_0x3ea5('0x5'));var path=require('path');var sox=require(_0x3ea5('0x6'));var csv=require(_0x3ea5('0x7'));var ejs=require(_0x3ea5('0x8'));var fs=require('fs');var fs_extra=require(_0x3ea5('0x9'));var _=require(_0x3ea5('0xa'));var squel=require(_0x3ea5('0xb'));var crypto=require(_0x3ea5('0xc'));var jsforce=require(_0x3ea5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3ea5('0x7'));var querystring=require(_0x3ea5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3ea5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ea5('0x10'))(_0x3ea5('0x11'));var utils=require(_0x3ea5('0x12'));var config=require(_0x3ea5('0x13'));var licenseUtil=require(_0x3ea5('0x14'));var db=require(_0x3ea5('0x15'))['db'];config[_0x3ea5('0x16')]=_[_0x3ea5('0x17')](config[_0x3ea5('0x16')],{'host':_0x3ea5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ea5('0x16')]));require('./team.socket')[_0x3ea5('0x19')](socket);function respondWithStatusCode(_0x9acf14,_0x4d2689){_0x4d2689=_0x4d2689||0xcc;return function(_0x12c22e){if(_0x12c22e){return _0x9acf14[_0x3ea5('0x1a')](_0x4d2689);}return _0x9acf14[_0x3ea5('0x1b')](_0x4d2689)['end']();};}function respondWithResult(_0x52b4db,_0x5e85c5){_0x5e85c5=_0x5e85c5||0xc8;return function(_0x598375){if(_0x598375){return _0x52b4db[_0x3ea5('0x1b')](_0x5e85c5)[_0x3ea5('0x1c')](_0x598375);}};}function respondWithFilteredResult(_0x2884aa,_0x497242){return function(_0x541476){if(_0x541476){var _0x3094bc=typeof _0x497242['offset']===_0x3ea5('0x1d')&&typeof _0x497242['limit']===_0x3ea5('0x1d');var _0x4c444b=_0x541476[_0x3ea5('0x1e')];var _0x1bf000=_0x3094bc?0x0:_0x497242[_0x3ea5('0x1f')];var _0x477f97=_0x3094bc?_0x541476[_0x3ea5('0x1e')]:_0x497242[_0x3ea5('0x1f')]+_0x497242[_0x3ea5('0x20')];var _0x2dbdc2;if(_0x477f97>=_0x4c444b){_0x477f97=_0x4c444b;_0x2dbdc2=0xc8;}else{_0x2dbdc2=0xce;}_0x2884aa[_0x3ea5('0x1b')](_0x2dbdc2);return _0x2884aa[_0x3ea5('0x21')](_0x3ea5('0x22'),_0x1bf000+'-'+_0x477f97+'/'+_0x4c444b)[_0x3ea5('0x1c')](_0x541476);}return null;};}function patchUpdates(_0x541d7b){return function(_0x2f8eb6){try{jsonpatch[_0x3ea5('0x23')](_0x2f8eb6,_0x541d7b,!![]);}catch(_0x549b15){return BPromise['reject'](_0x549b15);}return _0x2f8eb6[_0x3ea5('0x24')]();};}function saveUpdates(_0x5690d9,_0x397f55){return function(_0x59a21e){if(_0x59a21e){return _0x59a21e[_0x3ea5('0x25')](_0x5690d9)['then'](function(_0x3e9beb){return _0x3e9beb;});}return null;};}function handleEntityNotFound(_0x2ee378,_0x166f95){return function(_0x55800c){if(!_0x55800c){_0x2ee378[_0x3ea5('0x1a')](0x194);}return _0x55800c;};}function handleError(_0x4a0d2d,_0x5d213a){_0x5d213a=_0x5d213a||0x1f4;return function(_0x6009c4){logger[_0x3ea5('0x26')](_0x6009c4['stack']);if(_0x6009c4[_0x3ea5('0x27')]){delete _0x6009c4[_0x3ea5('0x27')];}_0x4a0d2d['status'](_0x5d213a)[_0x3ea5('0x28')](_0x6009c4);};}exports['index']=function(_0x24a151,_0x48f6a4){var _0x4a7221={},_0x25adf4={},_0x316d90={'count':0x0,'rows':[]};var _0x1452c9=_[_0x3ea5('0x29')](db[_0x3ea5('0x2a')][_0x3ea5('0x2b')],function(_0x10d6c3){return{'name':_0x10d6c3[_0x3ea5('0x2c')],'type':_0x10d6c3[_0x3ea5('0x2d')][_0x3ea5('0x2e')]};});_0x25adf4[_0x3ea5('0x2f')]=_[_0x3ea5('0x29')](_0x1452c9,_0x3ea5('0x27'));_0x25adf4[_0x3ea5('0x30')]=_[_0x3ea5('0x31')](_0x24a151[_0x3ea5('0x30')]);_0x25adf4['filters']=_['intersection'](_0x25adf4[_0x3ea5('0x2f')],_0x25adf4[_0x3ea5('0x30')]);_0x4a7221[_0x3ea5('0x32')]=_[_0x3ea5('0x33')](_0x25adf4[_0x3ea5('0x2f')],qs[_0x3ea5('0x34')](_0x24a151['query'][_0x3ea5('0x34')]));_0x4a7221['attributes']=_0x4a7221['attributes'][_0x3ea5('0x35')]?_0x4a7221['attributes']:_0x25adf4[_0x3ea5('0x2f')];if(!_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x36')]('nolimit')){_0x4a7221[_0x3ea5('0x20')]=qs['limit'](_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x20')]);_0x4a7221['offset']=qs['offset'](_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x1f')]);}_0x4a7221[_0x3ea5('0x37')]=qs['sort'](_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x38')]);_0x4a7221['where']=qs[_0x3ea5('0x39')](_[_0x3ea5('0x3a')](_0x24a151['query'],_0x25adf4[_0x3ea5('0x39')]),_0x1452c9);if(_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x3b')]){_0x4a7221[_0x3ea5('0x3c')]=_[_0x3ea5('0x3d')](_0x4a7221[_0x3ea5('0x3c')],{'$or':_[_0x3ea5('0x29')](_0x1452c9,function(_0x5b81f6){if(_0x5b81f6[_0x3ea5('0x2d')]!==_0x3ea5('0x3e')){var _0x1bb6f8={};_0x1bb6f8[_0x5b81f6[_0x3ea5('0x27')]]={'$like':'%'+_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x3b')]+'%'};return _0x1bb6f8;}})});}_0x4a7221=_[_0x3ea5('0x3d')]({},_0x4a7221,_0x24a151[_0x3ea5('0x3f')]);var _0x2a508b={'where':_0x4a7221[_0x3ea5('0x3c')]};return db['Team']['count'](_0x2a508b)[_0x3ea5('0x40')](function(_0x3ab814){_0x316d90['count']=_0x3ab814;if(_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x41')]){_0x4a7221[_0x3ea5('0x42')]=[{'all':!![]}];}return db[_0x3ea5('0x2a')][_0x3ea5('0x43')](_0x4a7221);})[_0x3ea5('0x40')](function(_0x51792b){_0x316d90[_0x3ea5('0x44')]=_0x51792b;return _0x316d90;})[_0x3ea5('0x40')](respondWithFilteredResult(_0x48f6a4,_0x4a7221))['catch'](handleError(_0x48f6a4,null));};exports[_0x3ea5('0x45')]=function(_0x13c539,_0x359b12){var _0x2af4ae={'raw':![],'where':{'id':_0x13c539[_0x3ea5('0x46')]['id']}},_0x5803c2={};_0x5803c2[_0x3ea5('0x2f')]=_[_0x3ea5('0x31')](db[_0x3ea5('0x2a')][_0x3ea5('0x2b')]);_0x5803c2['query']=_[_0x3ea5('0x31')](_0x13c539[_0x3ea5('0x30')]);_0x5803c2['filters']=_['intersection'](_0x5803c2[_0x3ea5('0x2f')],_0x5803c2[_0x3ea5('0x30')]);_0x2af4ae[_0x3ea5('0x32')]=_[_0x3ea5('0x33')](_0x5803c2[_0x3ea5('0x2f')],qs[_0x3ea5('0x34')](_0x13c539[_0x3ea5('0x30')]['fields']));_0x2af4ae[_0x3ea5('0x32')]=_0x2af4ae[_0x3ea5('0x32')][_0x3ea5('0x35')]?_0x2af4ae[_0x3ea5('0x32')]:_0x5803c2[_0x3ea5('0x2f')];if(_0x13c539[_0x3ea5('0x30')][_0x3ea5('0x41')]){_0x2af4ae[_0x3ea5('0x42')]=[{'all':!![]}];}_0x2af4ae=_['merge']({},_0x2af4ae,_0x13c539['options']);return db[_0x3ea5('0x2a')][_0x3ea5('0x47')](_0x2af4ae)['then'](handleEntityNotFound(_0x359b12,null))['then'](respondWithResult(_0x359b12,null))[_0x3ea5('0x48')](handleError(_0x359b12,null));};exports['create']=function(_0x58ee39,_0x2c7513){return db['Team'][_0x3ea5('0x49')](_0x58ee39[_0x3ea5('0x4a')],{})[_0x3ea5('0x40')](function(_0x5d17ed){var _0x3c0615=_0x58ee39[_0x3ea5('0x4b')]['get']({'plain':!![]});if(!_0x3c0615)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c0615[_0x3ea5('0x4c')]===_0x3ea5('0x4b')){var _0x301b47=_0x5d17ed[_0x3ea5('0x4d')]({'plain':!![]});var _0x573171=_0x3ea5('0x4e');return db[_0x3ea5('0x4f')][_0x3ea5('0x47')]({'where':{'name':_0x573171,'userProfileId':_0x3c0615[_0x3ea5('0x50')]},'raw':!![]})[_0x3ea5('0x40')](function(_0x33555e){if(_0x33555e&&_0x33555e[_0x3ea5('0x51')]===0x0){return db[_0x3ea5('0x52')]['create']({'name':_0x301b47[_0x3ea5('0x27')],'resourceId':_0x301b47['id'],'type':_0x33555e[_0x3ea5('0x27')],'sectionId':_0x33555e['id']},{})['then'](function(){return _0x5d17ed;});}else{return _0x5d17ed;}})[_0x3ea5('0x48')](function(_0x4d4885){logger['error'](_0x3ea5('0x53'),_0x4d4885);throw _0x4d4885;});}return _0x5d17ed;})['then'](respondWithResult(_0x2c7513,0xc9))[_0x3ea5('0x48')](handleError(_0x2c7513,null));};exports[_0x3ea5('0x25')]=function(_0xd2bdea,_0x1dbaa4){if(_0xd2bdea[_0x3ea5('0x4a')]['id']){delete _0xd2bdea[_0x3ea5('0x4a')]['id'];}return db[_0x3ea5('0x2a')]['find']({'where':{'id':_0xd2bdea[_0x3ea5('0x46')]['id']}})['then'](handleEntityNotFound(_0x1dbaa4,null))[_0x3ea5('0x40')](saveUpdates(_0xd2bdea['body'],null))[_0x3ea5('0x40')](respondWithResult(_0x1dbaa4,null))[_0x3ea5('0x48')](handleError(_0x1dbaa4,null));};exports[_0x3ea5('0x54')]=function(_0x445166,_0x51659f){var _0x5bf195=_0x445166[_0x3ea5('0x46')]['id'];var _0x316165=[];return db[_0x3ea5('0x55')][_0x3ea5('0x56')](function(_0x590230){var _0x537207=_0x3ea5('0x57')+_0x5bf195;return db[_0x3ea5('0x55')][_0x3ea5('0x30')](_0x537207,{'type':db['Sequelize'][_0x3ea5('0x58')][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230})[_0x3ea5('0x40')](function(_0x4706c3){_0x316165=_['map'](_0x4706c3,function(_0x20d9a6){return Number(_0x20d9a6['UserId']);});})[_0x3ea5('0x40')](function(){var _0x5ed9c8='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5bf195;return db[_0x3ea5('0x55')]['query'](_0x5ed9c8,{'type':db[_0x3ea5('0x5a')][_0x3ea5('0x58')]['SELECT'],'raw':!![],'transaction':_0x590230});})[_0x3ea5('0x40')](function(_0x2f1535){var _0x1972b2=_['map'](_0x2f1535,function(_0x1ad935){return Number(_0x1ad935['VoiceQueueId']);});return db[_0x3ea5('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x316165},'VoiceQueueId':{'$in':_0x1972b2}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){var _0x2971b1=_0x3ea5('0x5c')+_0x5bf195;return db[_0x3ea5('0x55')][_0x3ea5('0x30')](_0x2971b1,{'type':db[_0x3ea5('0x5a')][_0x3ea5('0x58')][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230});})['then'](function(_0xa94ada){var _0x3c350c=_[_0x3ea5('0x29')](_0xa94ada,function(_0x250412){return Number(_0x250412[_0x3ea5('0x5d')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x316165},'MailQueueId':{'$in':_0x3c350c}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){var _0x2c5cf2=_0x3ea5('0x5e')+_0x5bf195;return db['sequelize']['query'](_0x2c5cf2,{'type':db['Sequelize'][_0x3ea5('0x58')][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230});})[_0x3ea5('0x40')](function(_0x5cf741){var _0x528eed=_[_0x3ea5('0x29')](_0x5cf741,function(_0x100d09){return Number(_0x100d09[_0x3ea5('0x5f')]);});return db[_0x3ea5('0x60')]['destroy']({'where':{'UserId':{'$in':_0x316165},'SmsQueueId':{'$in':_0x528eed}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){var _0x40c1a7='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5bf195;return db[_0x3ea5('0x55')]['query'](_0x40c1a7,{'type':db[_0x3ea5('0x5a')][_0x3ea5('0x58')][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230});})[_0x3ea5('0x40')](function(_0x233baf){var _0x4daab9=_[_0x3ea5('0x29')](_0x233baf,function(_0x23778d){return Number(_0x23778d[_0x3ea5('0x61')]);});return db[_0x3ea5('0x62')][_0x3ea5('0x54')]({'where':{'UserId':{'$in':_0x316165},'ChatQueueId':{'$in':_0x4daab9}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){var _0x1773f8=_0x3ea5('0x63')+_0x5bf195;return db[_0x3ea5('0x55')]['query'](_0x1773f8,{'type':db[_0x3ea5('0x5a')]['QueryTypes'][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230});})[_0x3ea5('0x40')](function(_0xe60073){var _0x129da0=_['map'](_0xe60073,function(_0x1aec80){return Number(_0x1aec80['FaxQueueId']);});return db[_0x3ea5('0x64')]['destroy']({'where':{'UserId':{'$in':_0x316165},'FaxQueueId':{'$in':_0x129da0}},'transaction':_0x590230});})['then'](function(){var _0x4e17d6=_0x3ea5('0x65')+_0x5bf195;return db[_0x3ea5('0x55')][_0x3ea5('0x30')](_0x4e17d6,{'type':db[_0x3ea5('0x5a')][_0x3ea5('0x58')][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230});})['then'](function(_0xd686da){var _0x510aea=_[_0x3ea5('0x29')](_0xd686da,function(_0x50227f){return Number(_0x50227f[_0x3ea5('0x66')]);});return db[_0x3ea5('0x67')][_0x3ea5('0x54')]({'where':{'UserId':{'$in':_0x316165},'OpenchannelQueueId':{'$in':_0x510aea}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){var _0x2dc08d=_0x3ea5('0x68')+_0x5bf195;return db[_0x3ea5('0x55')][_0x3ea5('0x30')](_0x2dc08d,{'type':db[_0x3ea5('0x5a')][_0x3ea5('0x58')]['SELECT'],'raw':!![],'transaction':_0x590230});})[_0x3ea5('0x40')](function(_0x1dca7f){var _0x3d6df8=_['map'](_0x1dca7f,function(_0x3587aa){return Number(_0x3587aa[_0x3ea5('0x69')]);});return db[_0x3ea5('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x316165},'WhatsappQueueId':{'$in':_0x3d6df8}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){return db[_0x3ea5('0x6b')]['find']({'where':{'TeamId':_0x5bf195}});})[_0x3ea5('0x40')](function(_0x2f805c){if(_0x2f805c===null){return;}return db[_0x3ea5('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x316165},'VoicePrefixId':_0x2f805c[_0x3ea5('0x6d')]},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){return db['Team'][_0x3ea5('0x54')]({'where':{'id':_0x5bf195},'cascade':!![],'transaction':_0x590230});})['then'](function(_0x221f66){if(_0x221f66===0x0){_0x51659f[_0x3ea5('0x1a')](0x194);}else{return db[_0x3ea5('0x52')][_0x3ea5('0x54')]({'where':{'type':_0x3ea5('0x4e'),'resourceId':_0x5bf195},'cascade':!![],'transaction':_0x590230})[_0x3ea5('0x40')](function(){_0x51659f['status'](0xcc)[_0x3ea5('0x6e')]();});}})[_0x3ea5('0x48')](function(_0x196109){_0x51659f[_0x3ea5('0x1b')](0x1f4)['send'](_0x196109);});});};exports[_0x3ea5('0x6f')]=function(_0x4e0564,_0x43f6dd,_0x8e3935){return db[_0x3ea5('0x2a')]['findOne']({'where':{'id':_0x4e0564['params']['id']}})[_0x3ea5('0x40')](handleEntityNotFound(_0x43f6dd,null))[_0x3ea5('0x40')](function(_0x5a4b45){if(!_0x4e0564[_0x3ea5('0x30')]['channel']||!utils[_0x3ea5('0x70')](_0x4e0564[_0x3ea5('0x30')][_0x3ea5('0x71')])){throw new db[(_0x3ea5('0x5a'))][(_0x3ea5('0x72'))]('Unknown\x20channel');}var _0x549f33={};var _0x4c7556={};_0x4c7556[_0x3ea5('0x2f')]=_[_0x3ea5('0x31')](db[_[_0x3ea5('0x73')](_0x4e0564['query'][_0x3ea5('0x71')]['toLowerCase']())+'Queue'][_0x3ea5('0x2b')]);_0x4c7556['query']=_[_0x3ea5('0x31')](_0x4e0564[_0x3ea5('0x30')]);_0x4c7556[_0x3ea5('0x39')]=_[_0x3ea5('0x33')](_0x4c7556['model'],_0x4c7556[_0x3ea5('0x30')]);_0x549f33['attributes']=_['intersection'](_0x4c7556[_0x3ea5('0x2f')],qs['fields'](_0x4e0564[_0x3ea5('0x30')][_0x3ea5('0x34')]));_0x549f33[_0x3ea5('0x32')]=_0x549f33[_0x3ea5('0x32')]['length']?_0x549f33[_0x3ea5('0x32')]:_0x4c7556[_0x3ea5('0x2f')];_0x549f33[_0x3ea5('0x20')]=qs[_0x3ea5('0x20')](_0x4e0564[_0x3ea5('0x30')][_0x3ea5('0x20')]);_0x549f33[_0x3ea5('0x1f')]=qs['offset'](_0x4e0564[_0x3ea5('0x30')][_0x3ea5('0x1f')]);_0x549f33[_0x3ea5('0x37')]=qs['sort'](_0x4e0564['query'][_0x3ea5('0x38')]);_0x549f33[_0x3ea5('0x3c')]=qs[_0x3ea5('0x39')](_['pick'](_0x4e0564[_0x3ea5('0x30')],_0x4c7556[_0x3ea5('0x39')]));_0x549f33=_[_0x3ea5('0x3d')]({},_0x549f33,_0x4e0564[_0x3ea5('0x3f')]);return _0x5a4b45[_0x3ea5('0x4d')+_[_0x3ea5('0x73')](_0x4e0564[_0x3ea5('0x30')][_0x3ea5('0x71')][_0x3ea5('0x74')]())+_0x3ea5('0x75')](_0x549f33);})[_0x3ea5('0x40')](respondWithResult(_0x43f6dd,null))[_0x3ea5('0x48')](handleError(_0x43f6dd,null));};exports[_0x3ea5('0x76')]=function(_0x43efff,_0x1e70e5,_0xcc3856){return db[_0x3ea5('0x2a')][_0x3ea5('0x77')]({'where':{'id':_0x43efff[_0x3ea5('0x46')]['id']}})['then'](function(_0x4f6a63){if(_0x4f6a63){if(!_0x43efff[_0x3ea5('0x4a')]['channel']||!utils['isValidChannel'](_0x43efff['body'][_0x3ea5('0x71')])){throw new db[(_0x3ea5('0x5a'))][(_0x3ea5('0x72'))]('Unknown\x20channel');}return _0x4f6a63['add'+_[_0x3ea5('0x73')](_0x43efff[_0x3ea5('0x4a')]['channel'][_0x3ea5('0x74')]())+_0x3ea5('0x75')](_0x43efff['body'][_0x3ea5('0x78')]);}return null;})[_0x3ea5('0x40')](handleEntityNotFound(_0x1e70e5,null))[_0x3ea5('0x40')](respondWithStatusCode(_0x1e70e5,null))[_0x3ea5('0x48')](handleError(_0x1e70e5,null));};exports[_0x3ea5('0x79')]=function(_0x371012,_0x54a48a,_0x5b77c8){return db[_0x3ea5('0x2a')][_0x3ea5('0x77')]({'where':{'id':_0x371012['params']['id']}})[_0x3ea5('0x40')](function(_0x3af58b){if(_0x3af58b){if(!_0x371012[_0x3ea5('0x30')][_0x3ea5('0x71')]||!utils[_0x3ea5('0x70')](_0x371012['query']['channel'])){throw new db[(_0x3ea5('0x5a'))][(_0x3ea5('0x72'))](_0x3ea5('0x7a'));}return _0x3af58b['remove'+_[_0x3ea5('0x73')](_0x371012['query'][_0x3ea5('0x71')]['toLowerCase']())+_0x3ea5('0x75')](_0x371012[_0x3ea5('0x30')][_0x3ea5('0x78')]);}return null;})[_0x3ea5('0x40')](handleEntityNotFound(_0x54a48a,null))[_0x3ea5('0x40')](respondWithStatusCode(_0x54a48a,null))[_0x3ea5('0x48')](handleError(_0x54a48a,null));};exports['addAgents']=function(_0x178fcd,_0x459606){var _0x23cfae=_[_0x3ea5('0x7b')](_0x178fcd[_0x3ea5('0x4a')][_0x3ea5('0x78')])?_0x178fcd['body']['ids']:[_0x178fcd[_0x3ea5('0x4a')][_0x3ea5('0x78')]];var _0x45f455=_0x178fcd['params']['id'];return db[_0x3ea5('0x2a')][_0x3ea5('0x47')]({'where':{'id':_0x45f455}})[_0x3ea5('0x40')](handleEntityNotFound(_0x459606,null))['then'](function(_0x3ff3ea){if(_0x3ff3ea){var _0x372e15=[_0x3ea5('0x7c'),_0x3ea5('0x7d'),_0x3ea5('0x7e'),_0x3ea5('0x7f'),_0x3ea5('0x80'),_0x3ea5('0x81'),_0x3ea5('0x82')];return db['sequelize']['transaction'](function(_0x592466){var _0x1accb8=_[_0x3ea5('0x29')](_0x372e15,function(_0x442b1d){var _0x573654={'attributes':['id',_0x3ea5('0x27')]};if(_0x442b1d===_0x3ea5('0x7c')){_0x573654['through']={'attributes':[_0x3ea5('0x83')]};}return _0x3ff3ea[_0x3ea5('0x4d')+_0x442b1d+_0x3ea5('0x75')](_0x573654)[_0x3ea5('0x40')](function(_0xe74972){var _0x4a8cf9=_[_0x3ea5('0x29')](_0xe74972,function(_0x1bf6ea){var _0x3700a2=_['map'](_0x23cfae,function(_0xee266b){var _0x3b1906={'where':{'UserId':_0xee266b,[_0x442b1d+_0x3ea5('0x84')]:_0x1bf6ea['id']},'transaction':_0x592466};if(_0x442b1d===_0x3ea5('0x7c')){_0x3b1906[_0x3ea5('0x17')]={'penalty':_0x1bf6ea[_0x3ea5('0x85')]['penalty']};}return db['User'+_0x442b1d+_0x3ea5('0x86')][_0x3ea5('0x87')](_0x3b1906)['then'](function(){socket[_0x3ea5('0x88')](_0x3ea5('0x4b')+_0x442b1d+_0x3ea5('0x89'),{'UserId':_0xee266b,[_0x442b1d+_0x3ea5('0x84')]:_0x1bf6ea['id']});if(_0x442b1d!=='Voice'){return;}return db[_0x3ea5('0x8a')][_0x3ea5('0x43')]({'where':{'id':_0x23cfae,'online':0x1},'attributes':['id',_0x3ea5('0x27'),'online',_0x3ea5('0x8b'),'interface'],'raw':!![]})[_0x3ea5('0x40')](function(_0x45f689){var _0x112e89=_[_0x3ea5('0x29')](_0x45f689,function(_0x401151){return db[_0x3ea5('0x8c')][_0x3ea5('0x8d')]({'membername':_0x401151[_0x3ea5('0x27')],'UserId':_0x401151['id'],'queue_name':_0x1bf6ea['name'],'VoiceQueueId':_0x1bf6ea['id'],'interface':_[_0x3ea5('0x8e')](_0x401151[_0x3ea5('0x8f')])?util[_0x3ea5('0x90')](_0x3ea5('0x91'),_0x401151[_0x3ea5('0x27')]):_0x401151[_0x3ea5('0x8f')],'paused':_0x401151[_0x3ea5('0x8b')]||![],'penalty':_0x1bf6ea[_0x3ea5('0x85')][_0x3ea5('0x83')]},{'transaction':_0x592466});});return Promise['all'](_0x112e89);});});});return Promise[_0x3ea5('0x92')](_0x3700a2);});return Promise[_0x3ea5('0x92')](_0x4a8cf9);})[_0x3ea5('0x40')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x45f455}})[_0x3ea5('0x40')](function(_0x4731a5){if(_0x4731a5){var _0x50536a=_[_0x3ea5('0x29')](_0x23cfae,function(_0x86ce6d){db[_0x3ea5('0x6c')][_0x3ea5('0x8d')]({'UserId':_0x86ce6d,'VoicePrefixId':_0x4731a5[_0x3ea5('0x6d')]});});return Promise[_0x3ea5('0x92')](_0x50536a);}});});});return Promise[_0x3ea5('0x92')](_0x1accb8)[_0x3ea5('0x40')](function(){return _0x3ff3ea[_0x3ea5('0x93')](_0x23cfae,{'transaction':_0x592466})[_0x3ea5('0x94')](function(_0x24f873){return _0x24f873;});});});}})[_0x3ea5('0x40')](respondWithResult(_0x459606,null))[_0x3ea5('0x48')](handleError(_0x459606,null));};exports[_0x3ea5('0x95')]=function(_0x331210,_0x2020ac){var _0x48f87b=_['isArray'](_0x331210[_0x3ea5('0x30')][_0x3ea5('0x78')])?_0x331210['query']['ids']:[_0x331210['query'][_0x3ea5('0x78')]];var _0x520265=_0x331210[_0x3ea5('0x46')]['id'];return db[_0x3ea5('0x2a')][_0x3ea5('0x47')]({'where':{'id':_0x520265}})['then'](handleEntityNotFound(_0x2020ac,null))['then'](function(_0x58527d){if(_0x58527d){var _0x480f6c=[_0x3ea5('0x7c'),_0x3ea5('0x7d'),_0x3ea5('0x7e'),_0x3ea5('0x7f'),'Fax',_0x3ea5('0x81'),_0x3ea5('0x82')];return db[_0x3ea5('0x55')][_0x3ea5('0x56')](function(_0x1a1289){var _0x10d234=_[_0x3ea5('0x29')](_0x480f6c,function(_0x3ea95b){var _0x13b4c2={'attributes':['id',_0x3ea5('0x27')]};return _0x58527d[_0x3ea5('0x4d')+_0x3ea95b+_0x3ea5('0x75')](_0x13b4c2)['then'](function(_0x4f7a67){var _0x3426da=_['map'](_0x4f7a67,function(_0x46722b){return _0x46722b['removeAgents'](_0x48f87b,{'transaction':_0x1a1289})[_0x3ea5('0x40')](function(){var _0x76ad6f=_[_0x3ea5('0x29')](_0x48f87b,function(_0x47143f){socket[_0x3ea5('0x88')](_0x3ea5('0x4b')+_0x3ea95b+_0x3ea5('0x96'),{'UserId':Number(_0x47143f),[_0x3ea95b+'QueueId']:_0x46722b['id']});if(_0x3ea95b!==_0x3ea5('0x7c')){return;}return db[_0x3ea5('0x8c')]['destroy']({'where':{'VoiceQueueId':_0x46722b['id'],'UserId':_0x47143f},'transaction':_0x1a1289});});return Promise[_0x3ea5('0x92')](_0x76ad6f);});});return Promise[_0x3ea5('0x92')](_0x3426da);});});return Promise[_0x3ea5('0x92')](_0x10d234)[_0x3ea5('0x40')](function(){return _0x58527d['removeAgents'](_0x48f87b,{'transaction':_0x1a1289});})[_0x3ea5('0x40')](function(){return db[_0x3ea5('0x6b')][_0x3ea5('0x77')]({'where':{'teamId':_0x520265}})[_0x3ea5('0x40')](function(_0x274700){if(_0x274700){var _0x23fcb2=_[_0x3ea5('0x29')](_0x48f87b,function(_0x1af62d){db[_0x3ea5('0x6c')][_0x3ea5('0x54')]({'where':{'UserId':_0x1af62d,'VoicePrefixId':_0x274700[_0x3ea5('0x6d')]}});});return Promise[_0x3ea5('0x92')](_0x23fcb2);}});});});}})['then'](respondWithStatusCode(_0x2020ac,null))[_0x3ea5('0x48')](handleError(_0x2020ac,null));};exports[_0x3ea5('0x97')]=function(_0x4011ec,_0xc50b2b,_0x1ec1cc){var _0x32cdd2={};var _0x315d81={};var _0x2f9208;var _0x482303;return db[_0x3ea5('0x2a')][_0x3ea5('0x77')]({'where':{'id':_0x4011ec[_0x3ea5('0x46')]['id']}})['then'](handleEntityNotFound(_0xc50b2b,null))[_0x3ea5('0x40')](function(_0x233df6){if(_0x233df6){_0x2f9208=_0x233df6;_0x315d81[_0x3ea5('0x2f')]=_[_0x3ea5('0x31')](db[_0x3ea5('0x8a')][_0x3ea5('0x2b')]);_0x315d81[_0x3ea5('0x30')]=_[_0x3ea5('0x31')](_0x4011ec[_0x3ea5('0x30')]);_0x315d81['filters']=_[_0x3ea5('0x33')](_0x315d81['model'],_0x315d81[_0x3ea5('0x30')]);_0x32cdd2['attributes']=_['intersection'](_0x315d81[_0x3ea5('0x2f')],qs[_0x3ea5('0x34')](_0x4011ec['query'][_0x3ea5('0x34')]));_0x32cdd2[_0x3ea5('0x32')]=_0x32cdd2[_0x3ea5('0x32')][_0x3ea5('0x35')]?_0x32cdd2['attributes']:_0x315d81[_0x3ea5('0x2f')];_0x32cdd2[_0x3ea5('0x37')]=qs[_0x3ea5('0x38')](_0x4011ec['query']['sort']);_0x32cdd2['where']=qs[_0x3ea5('0x39')](_[_0x3ea5('0x3a')](_0x4011ec['query'],_0x315d81['filters']));if(_0x4011ec[_0x3ea5('0x30')]['filter']){_0x32cdd2[_0x3ea5('0x3c')]=_[_0x3ea5('0x3d')](_0x32cdd2[_0x3ea5('0x3c')],{'$or':_[_0x3ea5('0x29')](_0x32cdd2[_0x3ea5('0x32')],function(_0x538bdf){var _0x41370c={};_0x41370c[_0x538bdf]={'$like':'%'+_0x4011ec[_0x3ea5('0x30')][_0x3ea5('0x3b')]+'%'};return _0x41370c;})});}_0x32cdd2=_[_0x3ea5('0x3d')]({},_0x32cdd2,_0x4011ec[_0x3ea5('0x3f')]);return _0x2f9208[_0x3ea5('0x97')](_0x32cdd2);}})[_0x3ea5('0x40')](function(_0x52e1db){if(_0x52e1db){_0x482303=_0x52e1db['length'];if(!_0x4011ec['query'][_0x3ea5('0x36')](_0x3ea5('0x98'))){_0x32cdd2['limit']=qs[_0x3ea5('0x20')](_0x4011ec[_0x3ea5('0x30')]['limit']);_0x32cdd2[_0x3ea5('0x1f')]=qs[_0x3ea5('0x1f')](_0x4011ec['query']['offset']);}return _0x2f9208[_0x3ea5('0x97')](_0x32cdd2);}})[_0x3ea5('0x40')](function(_0xd21a5d){if(_0xd21a5d){return _0xd21a5d?{'count':_0x482303,'rows':_0xd21a5d}:null;}})['then'](respondWithResult(_0xc50b2b,null))[_0x3ea5('0x48')](handleError(_0xc50b2b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 377eb9d..37f7098 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 _0xaf2a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','Team','setMaxListeners','update'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xaf2a,0xca));var _0xaaf2=function(_0xf456d5,_0x2350a5){_0xf456d5=_0xf456d5-0x0;var _0x158bfe=_0xaf2a[_0xf456d5];return _0x158bfe;};'use strict';var EventEmitter=require(_0xaaf2('0x0'));var Team=require(_0xaaf2('0x1'))['db'][_0xaaf2('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xaaf2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaaf2('0x4'),'afterDestroy':_0xaaf2('0x5')};function emitEvent(_0x57a6a9){return function(_0x29657e,_0x2885cc,_0x240f3c){TeamEvents[_0xaaf2('0x6')](_0x57a6a9+':'+_0x29657e['id'],_0x29657e);TeamEvents[_0xaaf2('0x6')](_0x57a6a9,_0x29657e);_0x240f3c(null);};}for(var e in events){if(events[_0xaaf2('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xaaf2('0x8')]=TeamEvents; \ No newline at end of file +var _0x114f=['save','remove','emit','hook','exports','events','../../mysqldb','Team'];(function(_0x5f36fb,_0x562c4f){var _0x2e9f8a=function(_0x473b4a){while(--_0x473b4a){_0x5f36fb['push'](_0x5f36fb['shift']());}};_0x2e9f8a(++_0x562c4f);}(_0x114f,0x145));var _0xf114=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x114f[_0x2f62aa];return _0x1a341f;};'use strict';var EventEmitter=require(_0xf114('0x0'));var Team=require(_0xf114('0x1'))['db'][_0xf114('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf114('0x3'),'afterUpdate':'update','afterDestroy':_0xf114('0x4')};function emitEvent(_0x48c0d2){return function(_0x3b7071,_0x263cb9,_0x3848f2){TeamEvents[_0xf114('0x5')](_0x48c0d2+':'+_0x3b7071['id'],_0x3b7071);TeamEvents['emit'](_0x48c0d2,_0x3b7071);_0x3848f2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xf114('0x6')](e,emitEvent(event));}}module[_0xf114('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d5180f4..4b2fd4a 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 _0xbc7f=['Mail','Openchannel','Sms','Voice','Whatsapp','resolve','lodash','./team.attributes','get','Queues','map','setDataValue','channel','exports','define','Team','teams','Chat','Fax'];(function(_0x24994d,_0x5dd114){var _0x1a3545=function(_0x49c6c9){while(--_0x49c6c9){_0x24994d['push'](_0x24994d['shift']());}};_0x1a3545(++_0x5dd114);}(_0xbc7f,0x1a8));var _0xfbc7=function(_0x2b15f6,_0x52fff5){_0x2b15f6=_0x2b15f6-0x0;var _0x22f5b0=_0xbc7f[_0x2b15f6];return _0x22f5b0;};'use strict';var _=require(_0xfbc7('0x0'));var attributes=require(_0xfbc7('0x1'));function getQueuesByChannel(_0x1d8b60,_0xe184d1){var _0x33cc5d=_0xfbc7('0x2')+_0xe184d1+_0xfbc7('0x3');return _0x1d8b60[_0x33cc5d]()['then'](function(_0xc1f734){return _[_0xfbc7('0x4')](_0xc1f734,function(_0x388b03){_0x388b03[_0xfbc7('0x5')](_0xfbc7('0x6'),_0xe184d1);return _0x388b03;});})['catch'](function(_0x21503a){throw _0x21503a;});}module[_0xfbc7('0x7')]=function(_0x307d52){return _0x307d52[_0xfbc7('0x8')](_0xfbc7('0x9'),attributes,{'tableName':_0xfbc7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2b6027=this;var _0x571d93=[_0xfbc7('0xb'),_0xfbc7('0xc'),_0xfbc7('0xd'),_0xfbc7('0xe'),_0xfbc7('0xf'),_0xfbc7('0x10'),_0xfbc7('0x11')];return Promise[_0xfbc7('0x12')]()['then'](function(){var _0x2578eb=_[_0xfbc7('0x4')](_0x571d93,function(_0x421a94){return getQueuesByChannel(_0x2b6027,_0x421a94);});return Promise['all'](_0x2578eb);})['catch'](function(_0x13a7c6){throw _0x13a7c6;});}}});}; \ No newline at end of file +var _0x1547=['Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','define','teams','Chat','Fax'];(function(_0x1eb1c2,_0x54d65c){var _0x3a5f7e=function(_0x2f43a8){while(--_0x2f43a8){_0x1eb1c2['push'](_0x1eb1c2['shift']());}};_0x3a5f7e(++_0x54d65c);}(_0x1547,0x1bf));var _0x7154=function(_0x42f374,_0x1d445f){_0x42f374=_0x42f374-0x0;var _0x361747=_0x1547[_0x42f374];return _0x361747;};'use strict';var _=require(_0x7154('0x0'));var attributes=require(_0x7154('0x1'));function getQueuesByChannel(_0x4724b5,_0x5aa017){var _0x24ccd1=_0x7154('0x2')+_0x5aa017+_0x7154('0x3');return _0x4724b5[_0x24ccd1]()[_0x7154('0x4')](function(_0x2a1aab){return _[_0x7154('0x5')](_0x2a1aab,function(_0x4c2199){_0x4c2199[_0x7154('0x6')](_0x7154('0x7'),_0x5aa017);return _0x4c2199;});})[_0x7154('0x8')](function(_0x4fd789){throw _0x4fd789;});}module['exports']=function(_0xa4474b){return _0xa4474b[_0x7154('0x9')]('Team',attributes,{'tableName':_0x7154('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x653da=this;var _0x368d1b=[_0x7154('0xb'),_0x7154('0xc'),_0x7154('0xd'),_0x7154('0xe'),_0x7154('0xf'),_0x7154('0x10'),_0x7154('0x11')];return Promise[_0x7154('0x12')]()[_0x7154('0x4')](function(){var _0xbc6cba=_[_0x7154('0x5')](_0x368d1b,function(_0x3d9abd){return getQueuesByChannel(_0x653da,_0x3d9abd);});return Promise[_0x7154('0x13')](_0xbc6cba);})['catch'](function(_0x550f92){throw _0x550f92;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 432ca75..df9f662 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 _0x641f=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','then','info','Team,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x641f,0x83));var _0xf641=function(_0x24a40b,_0x587494){_0x24a40b=_0x24a40b-0x0;var _0x4b4ab8=_0x641f[_0x24a40b];return _0x4b4ab8;};'use strict';var _=require(_0xf641('0x0'));var util=require(_0xf641('0x1'));var moment=require(_0xf641('0x2'));var BPromise=require(_0xf641('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf641('0x4'));var db=require(_0xf641('0x5'))['db'];var utils=require(_0xf641('0x6'));var logger=require(_0xf641('0x7'))(_0xf641('0x8'));var config=require(_0xf641('0x9'));var jayson=require(_0xf641('0xa'));var client=jayson[_0xf641('0xb')][_0xf641('0xc')]({'port':0x232a});config[_0xf641('0xd')]=_[_0xf641('0xe')](config[_0xf641('0xd')],{'host':_0xf641('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf641('0x10'))['register'](socket);function respondWithRpcPromise(_0x31d203,_0x40f7d3,_0x481da8){return new BPromise(function(_0x34b556,_0x3ebb71){return client['request'](_0x31d203,_0x481da8)[_0xf641('0x11')](function(_0x4abbc1){logger[_0xf641('0x12')](_0xf641('0x13'),_0x40f7d3,'request\x20sent');logger[_0xf641('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x40f7d3,_0xf641('0x15'),JSON[_0xf641('0x16')](_0x4abbc1));if(_0x4abbc1[_0xf641('0x17')]){if(_0x4abbc1[_0xf641('0x17')][_0xf641('0x18')]===0x1f4){logger[_0xf641('0x17')]('Team,\x20%s,\x20%s',_0x40f7d3,_0x4abbc1[_0xf641('0x17')][_0xf641('0x19')]);return _0x3ebb71(_0x4abbc1[_0xf641('0x17')]['message']);}logger[_0xf641('0x17')](_0xf641('0x13'),_0x40f7d3,_0x4abbc1[_0xf641('0x17')][_0xf641('0x19')]);return _0x34b556(_0x4abbc1[_0xf641('0x17')][_0xf641('0x19')]);}else{logger['info'](_0xf641('0x13'),_0x40f7d3,'request\x20sent');_0x34b556(_0x4abbc1[_0xf641('0x1a')][_0xf641('0x19')]);}})[_0xf641('0x1b')](function(_0x483aa4){logger['error'](_0xf641('0x13'),_0x40f7d3,_0x483aa4);_0x3ebb71(_0x483aa4);});});} \ No newline at end of file +var _0x71b8=['./team.socket','register','request','info','request\x20sent','debug','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x154e4c,_0x28ee85){var _0x335d4a=function(_0x9fd158){while(--_0x9fd158){_0x154e4c['push'](_0x154e4c['shift']());}};_0x335d4a(++_0x28ee85);}(_0x71b8,0x109));var _0x871b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x71b8[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x871b('0x0'));var util=require(_0x871b('0x1'));var moment=require(_0x871b('0x2'));var BPromise=require(_0x871b('0x3'));var rs=require(_0x871b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x871b('0x5'))['db'];var utils=require(_0x871b('0x6'));var logger=require('../../config/logger')(_0x871b('0x7'));var config=require('../../config/environment');var jayson=require(_0x871b('0x8'));var client=jayson[_0x871b('0x9')][_0x871b('0xa')]({'port':0x232a});config['redis']=_[_0x871b('0xb')](config[_0x871b('0xc')],{'host':_0x871b('0xd'),'port':0x18eb});var socket=require(_0x871b('0xe'))(new Redis(config['redis']));require(_0x871b('0xf'))[_0x871b('0x10')](socket);function respondWithRpcPromise(_0x50994c,_0x4aae77,_0x349a4a){return new BPromise(function(_0x5ddabe,_0x499a6d){return client[_0x871b('0x11')](_0x50994c,_0x349a4a)['then'](function(_0x664418){logger[_0x871b('0x12')]('Team,\x20%s,\x20%s',_0x4aae77,_0x871b('0x13'));logger[_0x871b('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x4aae77,_0x871b('0x13'),JSON[_0x871b('0x15')](_0x664418));if(_0x664418[_0x871b('0x16')]){if(_0x664418[_0x871b('0x16')][_0x871b('0x17')]===0x1f4){logger[_0x871b('0x16')](_0x871b('0x18'),_0x4aae77,_0x664418[_0x871b('0x16')][_0x871b('0x19')]);return _0x499a6d(_0x664418[_0x871b('0x16')][_0x871b('0x19')]);}logger[_0x871b('0x16')](_0x871b('0x18'),_0x4aae77,_0x664418[_0x871b('0x16')]['message']);return _0x5ddabe(_0x664418[_0x871b('0x16')][_0x871b('0x19')]);}else{logger['info'](_0x871b('0x18'),_0x4aae77,_0x871b('0x13'));_0x5ddabe(_0x664418[_0x871b('0x1a')]['message']);}})[_0x871b('0x1b')](function(_0x3c5088){logger[_0x871b('0x16')](_0x871b('0x18'),_0x4aae77,_0x3c5088);_0x499a6d(_0x3c5088);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e75e431..41f9967 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 _0xdcb9=['remove','update','removeListener','register','team:','./team.events'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0xdcb9,0xa7));var _0x9dcb=function(_0x45e8b4,_0x4c4e9a){_0x45e8b4=_0x45e8b4-0x0;var _0x1566f4=_0xdcb9[_0x45e8b4];return _0x1566f4;};'use strict';var TeamEvents=require(_0x9dcb('0x0'));var events=['save',_0x9dcb('0x1'),_0x9dcb('0x2')];function createListener(_0x54d7af,_0x396477){return function(_0x556d03){_0x396477['emit'](_0x54d7af,_0x556d03);};}function removeListener(_0x5b842e,_0x35841a){return function(){TeamEvents[_0x9dcb('0x3')](_0x5b842e,_0x35841a);};}exports[_0x9dcb('0x4')]=function(_0x15ee97){for(var _0x4f9b4c=0x0,_0x1a364f=events['length'];_0x4f9b4c<_0x1a364f;_0x4f9b4c++){var _0x25f844=events[_0x4f9b4c];var _0x578700=createListener(_0x9dcb('0x5')+_0x25f844,_0x15ee97);TeamEvents['on'](_0x25f844,_0x578700);}}; \ No newline at end of file +var _0x13cc=['update','emit','removeListener','length','team:','remove'];(function(_0x5d0e57,_0xdb5c66){var _0x24934c=function(_0x4c60eb){while(--_0x4c60eb){_0x5d0e57['push'](_0x5d0e57['shift']());}};_0x24934c(++_0xdb5c66);}(_0x13cc,0x161));var _0xc13c=function(_0x56d17c,_0x1a21af){_0x56d17c=_0x56d17c-0x0;var _0x2c4bfd=_0x13cc[_0x56d17c];return _0x2c4bfd;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xc13c('0x0'),_0xc13c('0x1')];function createListener(_0x4e5b66,_0x280439){return function(_0x34dc01){_0x280439[_0xc13c('0x2')](_0x4e5b66,_0x34dc01);};}function removeListener(_0xd65d02,_0x7e5e19){return function(){TeamEvents[_0xc13c('0x3')](_0xd65d02,_0x7e5e19);};}exports['register']=function(_0x98e54d){for(var _0x4c9afa=0x0,_0x18b0b4=events[_0xc13c('0x4')];_0x4c9afa<_0x18b0b4;_0x4c9afa++){var _0x4889d6=events[_0x4c9afa];var _0x318eab=createListener(_0xc13c('0x5')+_0x4889d6,_0x98e54d);TeamEvents['on'](_0x4889d6,_0x318eab);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 065437c..31bc31a 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 _0x82b0=['sequelize','exports','INTEGER'];(function(_0x271a21,_0x40555e){var _0x825d3e=function(_0xe0100){while(--_0xe0100){_0x271a21['push'](_0x271a21['shift']());}};_0x825d3e(++_0x40555e);}(_0x82b0,0x81));var _0x082b=function(_0x304bd5,_0xea943d){_0x304bd5=_0x304bd5-0x0;var _0x2bcd87=_0x82b0[_0x304bd5];return _0x2bcd87;};'use strict';var Sequelize=require(_0x082b('0x0'));module[_0x082b('0x1')]={'TeamId':{'type':Sequelize[_0x082b('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x58e5=['exports','INTEGER','sequelize'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0x58e5,0xd1));var _0x558e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x58e5[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x558e('0x0'));module[_0x558e('0x1')]={'TeamId':{'type':Sequelize[_0x558e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x558e('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 6a5d2d9..bd05931 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 _0x3276=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','team_has_voice_prefixes','lodash'];(function(_0x5bf465,_0x261834){var _0x2fa4e1=function(_0x4453ea){while(--_0x4453ea){_0x5bf465['push'](_0x5bf465['shift']());}};_0x2fa4e1(++_0x261834);}(_0x3276,0xc7));var _0x6327=function(_0xec4477,_0x22a4ed){_0xec4477=_0xec4477-0x0;var _0x58ed11=_0x3276[_0xec4477];return _0x58ed11;};'use strict';var _=require(_0x6327('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6327('0x1'));var moment=require(_0x6327('0x2'));var BPromise=require(_0x6327('0x3'));var rp=require(_0x6327('0x4'));var fs=require('fs');var path=require(_0x6327('0x5'));var rimraf=require(_0x6327('0x6'));var config=require(_0x6327('0x7'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x10b982,_0x37adde){return _0x10b982[_0x6327('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x6327('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0db9=['team_has_voice_prefixes','lodash','moment','bluebird','path','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix'];(function(_0x46d6d3,_0x31982b){var _0x393eac=function(_0x2d82a5){while(--_0x2d82a5){_0x46d6d3['push'](_0x46d6d3['shift']());}};_0x393eac(++_0x31982b);}(_0x0db9,0xa3));var _0x90db=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0x0db9[_0x1dbaf7];return _0x593f05;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x90db('0x1'));var BPromise=require(_0x90db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90db('0x3'));var rimraf=require('rimraf');var config=require(_0x90db('0x4'));var attributes=require(_0x90db('0x5'));module['exports']=function(_0x2d02a1,_0x242774){return _0x2d02a1[_0x90db('0x6')](_0x90db('0x7'),attributes,{'tableName':_0x90db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index cc50222..d8298c2 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x8234f,_0x46f87a){var _0x4592ba=function(_0x5784b6){while(--_0x5784b6){_0x8234f['push'](_0x8234f['shift']());}};_0x4592ba(++_0x46f87a);}(_0x70e0,0x17b));var _0x070e=function(_0x348f5d,_0x4e81b7){_0x348f5d=_0x348f5d-0x0;var _0x3d8d88=_0x70e0[_0x348f5d];return _0x3d8d88;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x55c99e,_0x46d478){var _0x5a89be=function(_0x481293){while(--_0x481293){_0x55c99e['push'](_0x55c99e['shift']());}};_0x5a89be(++_0x46d478);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 5b49b6c..c7ca742 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 _0xa182=['INTEGER','exports'];(function(_0x24edc0,_0xfe9038){var _0x9d03e5=function(_0x8a2368){while(--_0x8a2368){_0x24edc0['push'](_0x24edc0['shift']());}};_0x9d03e5(++_0xfe9038);}(_0xa182,0x1d5));var _0x2a18=function(_0x183cd5,_0x59c3bb){_0x183cd5=_0x183cd5-0x0;var _0x55fa87=_0xa182[_0x183cd5];return _0x55fa87;};'use strict';var Sequelize=require('sequelize');module[_0x2a18('0x0')]={'penalty':{'type':Sequelize[_0x2a18('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8795=['sequelize','exports','INTEGER'];(function(_0xde1348,_0x5205b6){var _0x32c5e0=function(_0x4fcf88){while(--_0x4fcf88){_0xde1348['push'](_0xde1348['shift']());}};_0x32c5e0(++_0x5205b6);}(_0x8795,0x14a));var _0x5879=function(_0x559d3b,_0x2121c6){_0x559d3b=_0x559d3b-0x0;var _0x494fd6=_0x8795[_0x559d3b];return _0x494fd6;};'use strict';var Sequelize=require(_0x5879('0x0'));module[_0x5879('0x1')]={'penalty':{'type':Sequelize[_0x5879('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 889ed94..05b1ba9 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 _0xea1a=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x276009,_0x37624b){var _0x9ebe29=function(_0x1ed661){while(--_0x1ed661){_0x276009['push'](_0x276009['shift']());}};_0x9ebe29(++_0x37624b);}(_0xea1a,0x158));var _0xaea1=function(_0x86761c,_0x205187){_0x86761c=_0x86761c-0x0;var _0x763ca0=_0xea1a[_0x86761c];return _0x763ca0;};'use strict';var _=require(_0xaea1('0x0'));var util=require(_0xaea1('0x1'));var logger=require(_0xaea1('0x2'))(_0xaea1('0x3'));var moment=require('moment');var BPromise=require(_0xaea1('0x4'));var rp=require(_0xaea1('0x5'));var fs=require('fs');var path=require(_0xaea1('0x6'));var rimraf=require(_0xaea1('0x7'));var config=require(_0xaea1('0x8'));var attributes=require(_0xaea1('0x9'));module[_0xaea1('0xa')]=function(_0x246ebc,_0x5208c7){return _0x246ebc[_0xaea1('0xb')](_0xaea1('0xc'),attributes,{'tableName':_0xaea1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdab2=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var logger=require('../../config/logger')(_0x2dab('0x2'));var moment=require(_0x2dab('0x3'));var BPromise=require(_0x2dab('0x4'));var rp=require(_0x2dab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dab('0x6'));var config=require(_0x2dab('0x7'));var attributes=require(_0x2dab('0x8'));module[_0x2dab('0x9')]=function(_0x4562bb,_0x1421d5){return _0x4562bb[_0x2dab('0xa')](_0x2dab('0xb'),attributes,{'tableName':_0x2dab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 15870cb..4ca682b 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 _0xd5e4=['info','debug','request\x20sent','stringify','code','error','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x414806,_0x12a8c2){var _0x14e039=function(_0x40fb9c){while(--_0x40fb9c){_0x414806['push'](_0x414806['shift']());}};_0x14e039(++_0x12a8c2);}(_0xd5e4,0x8e));var _0x4d5e=function(_0x4577ce,_0x2b6616){_0x4577ce=_0x4577ce-0x0;var _0x3213e5=_0xd5e4[_0x4577ce];return _0x3213e5;};'use strict';var _=require(_0x4d5e('0x0'));var util=require(_0x4d5e('0x1'));var moment=require('moment');var BPromise=require(_0x4d5e('0x2'));var rs=require(_0x4d5e('0x3'));var fs=require('fs');var Redis=require(_0x4d5e('0x4'));var db=require(_0x4d5e('0x5'))['db'];var utils=require(_0x4d5e('0x6'));var logger=require('../../config/logger')(_0x4d5e('0x7'));var config=require(_0x4d5e('0x8'));var jayson=require(_0x4d5e('0x9'));var client=jayson[_0x4d5e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x408d51,_0x1a73fe,_0x28e2ca){return new BPromise(function(_0x583a3a,_0x7cacd1){return client['request'](_0x408d51,_0x28e2ca)[_0x4d5e('0xb')](function(_0x5a8186){logger[_0x4d5e('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1a73fe,'request\x20sent');logger[_0x4d5e('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1a73fe,_0x4d5e('0xe'),JSON[_0x4d5e('0xf')](_0x5a8186));if(_0x5a8186['error']){if(_0x5a8186['error'][_0x4d5e('0x10')]===0x1f4){logger[_0x4d5e('0x11')](_0x4d5e('0x12'),_0x1a73fe,_0x5a8186[_0x4d5e('0x11')]['message']);return _0x7cacd1(_0x5a8186[_0x4d5e('0x11')][_0x4d5e('0x13')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x1a73fe,_0x5a8186[_0x4d5e('0x11')][_0x4d5e('0x13')]);return _0x583a3a(_0x5a8186[_0x4d5e('0x11')][_0x4d5e('0x13')]);}else{logger[_0x4d5e('0xc')](_0x4d5e('0x12'),_0x1a73fe,_0x4d5e('0xe'));_0x583a3a(_0x5a8186[_0x4d5e('0x14')]['message']);}})[_0x4d5e('0x15')](function(_0x4b03e1){logger[_0x4d5e('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1a73fe,_0x4b03e1);_0x7cacd1(_0x4b03e1);});});} \ No newline at end of file +var _0x6082=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x6082,0x134));var _0x2608=function(_0x2eac9d,_0x56138c){_0x2eac9d=_0x2eac9d-0x0;var _0x13c11b=_0x6082[_0x2eac9d];return _0x13c11b;};'use strict';var _=require(_0x2608('0x0'));var util=require(_0x2608('0x1'));var moment=require('moment');var BPromise=require(_0x2608('0x2'));var rs=require(_0x2608('0x3'));var fs=require('fs');var Redis=require(_0x2608('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2608('0x5'));var logger=require(_0x2608('0x6'))(_0x2608('0x7'));var config=require(_0x2608('0x8'));var jayson=require(_0x2608('0x9'));var client=jayson[_0x2608('0xa')][_0x2608('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54384c,_0x47ef56,_0x34fa79){return new BPromise(function(_0x13a64a,_0x6c393){return client['request'](_0x54384c,_0x34fa79)[_0x2608('0xc')](function(_0x2a7967){logger[_0x2608('0xd')](_0x2608('0xe'),_0x47ef56,_0x2608('0xf'));logger[_0x2608('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x47ef56,'request\x20sent',JSON[_0x2608('0x11')](_0x2a7967));if(_0x2a7967[_0x2608('0x12')]){if(_0x2a7967[_0x2608('0x12')][_0x2608('0x13')]===0x1f4){logger['error'](_0x2608('0xe'),_0x47ef56,_0x2a7967['error'][_0x2608('0x14')]);return _0x6c393(_0x2a7967['error'][_0x2608('0x14')]);}logger['error'](_0x2608('0xe'),_0x47ef56,_0x2a7967[_0x2608('0x12')][_0x2608('0x14')]);return _0x13a64a(_0x2a7967[_0x2608('0x12')]['message']);}else{logger['info'](_0x2608('0xe'),_0x47ef56,_0x2608('0xf'));_0x13a64a(_0x2a7967[_0x2608('0x15')][_0x2608('0x14')]);}})[_0x2608('0x16')](function(_0x36b739){logger[_0x2608('0x12')](_0x2608('0xe'),_0x47ef56,_0x36b739);_0x6c393(_0x36b739);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 2e55989..286a107 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 _0xd916=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./template.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd916,0x18a));var _0x6d91=function(_0x450479,_0x212b3a){_0x450479=_0x450479-0x0;var _0x332be8=_0xd916[_0x450479];return _0x332be8;};'use strict';var multer=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var path=require(_0x6d91('0x2'));var timeout=require(_0x6d91('0x3'));var express=require(_0x6d91('0x4'));var router=express['Router']();var fs_extra=require(_0x6d91('0x5'));var auth=require(_0x6d91('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d91('0x7'));router[_0x6d91('0x8')]('/',auth['isAuthenticated'](),controller[_0x6d91('0x9')]);router[_0x6d91('0x8')](_0x6d91('0xa'),auth[_0x6d91('0xb')](),controller[_0x6d91('0xc')]);router[_0x6d91('0xd')]('/',auth[_0x6d91('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6d91('0xe')]);router[_0x6d91('0xf')](_0x6d91('0xa'),auth[_0x6d91('0xb')](),controller[_0x6d91('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc177=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x1b2eea,_0x2ac071){var _0x2a81cf=function(_0xacc88f){while(--_0xacc88f){_0x1b2eea['push'](_0x1b2eea['shift']());}};_0x2a81cf(++_0x2ac071);}(_0xc177,0x1b2));var _0x7c17=function(_0x21cbec,_0x2f7d5f){_0x21cbec=_0x21cbec-0x0;var _0x35376f=_0xc177[_0x21cbec];return _0x35376f;};'use strict';var multer=require(_0x7c17('0x0'));var util=require(_0x7c17('0x1'));var path=require(_0x7c17('0x2'));var timeout=require(_0x7c17('0x3'));var express=require(_0x7c17('0x4'));var router=express['Router']();var fs_extra=require(_0x7c17('0x5'));var auth=require(_0x7c17('0x6'));var interaction=require(_0x7c17('0x7'));var config=require(_0x7c17('0x8'));var controller=require('./template.controller');router[_0x7c17('0x9')]('/',auth[_0x7c17('0xa')](),controller[_0x7c17('0xb')]);router['get'](_0x7c17('0xc'),auth[_0x7c17('0xa')](),controller[_0x7c17('0xd')]);router[_0x7c17('0xe')]('/',auth[_0x7c17('0xa')](),controller[_0x7c17('0xf')]);router[_0x7c17('0x10')](_0x7c17('0xc'),auth[_0x7c17('0xa')](),controller[_0x7c17('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7c17('0x12')]);module[_0x7c17('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 71a81e2..0d4bb9a 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 _0xceac=['STRING','TEXT','exports'];(function(_0x49b5e8,_0x49f37a){var _0x54c5e3=function(_0x21c235){while(--_0x21c235){_0x49b5e8['push'](_0x49b5e8['shift']());}};_0x54c5e3(++_0x49f37a);}(_0xceac,0x1cd));var _0xccea=function(_0x5a0f5d,_0x3ecc15){_0x5a0f5d=_0x5a0f5d-0x0;var _0x702e=_0xceac[_0x5a0f5d];return _0x702e;};'use strict';var Sequelize=require('sequelize');module[_0xccea('0x0')]={'name':{'type':Sequelize[_0xccea('0x1')]},'description':{'type':Sequelize[_0xccea('0x1')]},'html':{'type':Sequelize[_0xccea('0x2')]}}; \ No newline at end of file +var _0x176b=['TEXT','sequelize','exports','STRING'];(function(_0x5b3333,_0x52d211){var _0x6fe2df=function(_0x1166a3){while(--_0x1166a3){_0x5b3333['push'](_0x5b3333['shift']());}};_0x6fe2df(++_0x52d211);}(_0x176b,0x1b5));var _0xb176=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0x176b[_0xb7cb72];return _0x4b7570;};'use strict';var Sequelize=require(_0xb176('0x0'));module[_0xb176('0x1')]={'name':{'type':Sequelize[_0xb176('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xb176('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index ed5555d..37739e2 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 _0x2727=['UserProfileResource','destroy','error','stack','name','index','map','Template','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','options','includeAll','findAll','catch','show','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','get','Templates'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2727,0x11a));var _0x7272=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2727[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7272('0x0'));var zipdir=require(_0x7272('0x1'));var jsonpatch=require(_0x7272('0x2'));var rp=require(_0x7272('0x3'));var moment=require(_0x7272('0x4'));var BPromise=require(_0x7272('0x5'));var Mustache=require(_0x7272('0x6'));var util=require(_0x7272('0x7'));var path=require(_0x7272('0x8'));var sox=require(_0x7272('0x9'));var csv=require(_0x7272('0xa'));var ejs=require(_0x7272('0xb'));var fs=require('fs');var fs_extra=require(_0x7272('0xc'));var _=require(_0x7272('0xd'));var squel=require(_0x7272('0xe'));var crypto=require(_0x7272('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7272('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7272('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7272('0x11'));var hardwareService=require(_0x7272('0x12'));var logger=require(_0x7272('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7272('0x14'));var db=require(_0x7272('0x15'))['db'];function respondWithStatusCode(_0x51a20e,_0x548000){_0x548000=_0x548000||0xcc;return function(_0x4247cf){if(_0x4247cf){return _0x51a20e[_0x7272('0x16')](_0x548000);}return _0x51a20e[_0x7272('0x17')](_0x548000)[_0x7272('0x18')]();};}function respondWithResult(_0x5374f5,_0x34ace7){_0x34ace7=_0x34ace7||0xc8;return function(_0x3c78ba){if(_0x3c78ba){return _0x5374f5[_0x7272('0x17')](_0x34ace7)[_0x7272('0x19')](_0x3c78ba);}};}function respondWithFilteredResult(_0x1f6c98,_0x2727f0){return function(_0x1e8343){if(_0x1e8343){var _0x18a691=typeof _0x2727f0['offset']===_0x7272('0x1a')&&typeof _0x2727f0['limit']===_0x7272('0x1a');var _0x14559c=_0x1e8343[_0x7272('0x1b')];var _0x1bf2a0=_0x18a691?0x0:_0x2727f0[_0x7272('0x1c')];var _0x474014=_0x18a691?_0x1e8343[_0x7272('0x1b')]:_0x2727f0[_0x7272('0x1c')]+_0x2727f0['limit'];var _0x28088a;if(_0x474014>=_0x14559c){_0x474014=_0x14559c;_0x28088a=0xc8;}else{_0x28088a=0xce;}_0x1f6c98[_0x7272('0x17')](_0x28088a);return _0x1f6c98[_0x7272('0x1d')](_0x7272('0x1e'),_0x1bf2a0+'-'+_0x474014+'/'+_0x14559c)[_0x7272('0x19')](_0x1e8343);}return null;};}function patchUpdates(_0x26c4d9){return function(_0x5aaf30){try{jsonpatch[_0x7272('0x1f')](_0x5aaf30,_0x26c4d9,!![]);}catch(_0x912527){return BPromise[_0x7272('0x20')](_0x912527);}return _0x5aaf30[_0x7272('0x21')]();};}function saveUpdates(_0x4c9aad,_0x3b4d97){return function(_0x8d04a0){if(_0x8d04a0){return _0x8d04a0[_0x7272('0x22')](_0x4c9aad)[_0x7272('0x23')](function(_0x13d18c){return _0x13d18c;});}return null;};}function removeEntity(_0x16f256,_0x4434f5){return function(_0x1911de){if(_0x1911de){return _0x1911de['destroy']()[_0x7272('0x23')](function(){var _0x16342b=_0x1911de[_0x7272('0x24')]({'plain':!![]});var _0x267b1d=_0x7272('0x25');return db[_0x7272('0x26')][_0x7272('0x27')]({'where':{'type':_0x267b1d,'resourceId':_0x16342b['id']}})[_0x7272('0x23')](function(){return _0x1911de;});})[_0x7272('0x23')](function(){_0x16f256['status'](0xcc)[_0x7272('0x18')]();});}};}function handleEntityNotFound(_0x1d7264,_0x2daf5d){return function(_0x27a250){if(!_0x27a250){_0x1d7264['sendStatus'](0x194);}return _0x27a250;};}function handleError(_0xd6d759,_0xa9023c){_0xa9023c=_0xa9023c||0x1f4;return function(_0x3d1233){logger[_0x7272('0x28')](_0x3d1233[_0x7272('0x29')]);if(_0x3d1233[_0x7272('0x2a')]){delete _0x3d1233[_0x7272('0x2a')];}_0xd6d759['status'](_0xa9023c)['send'](_0x3d1233);};}exports[_0x7272('0x2b')]=function(_0x2fc117,_0x5629d8){var _0x5295bf={},_0x3481d4={},_0x427b4f={'count':0x0,'rows':[]};var _0x4e3860=_[_0x7272('0x2c')](db[_0x7272('0x2d')][_0x7272('0x2e')],function(_0x26c061){return{'name':_0x26c061[_0x7272('0x2f')],'type':_0x26c061['type']['key']};});_0x3481d4[_0x7272('0x30')]=_[_0x7272('0x2c')](_0x4e3860,'name');_0x3481d4['query']=_[_0x7272('0x31')](_0x2fc117['query']);_0x3481d4[_0x7272('0x32')]=_[_0x7272('0x33')](_0x3481d4[_0x7272('0x30')],_0x3481d4[_0x7272('0x34')]);_0x5295bf[_0x7272('0x35')]=_[_0x7272('0x33')](_0x3481d4[_0x7272('0x30')],qs[_0x7272('0x36')](_0x2fc117['query'][_0x7272('0x36')]));_0x5295bf[_0x7272('0x35')]=_0x5295bf[_0x7272('0x35')][_0x7272('0x37')]?_0x5295bf[_0x7272('0x35')]:_0x3481d4['model'];if(!_0x2fc117[_0x7272('0x34')][_0x7272('0x38')](_0x7272('0x39'))){_0x5295bf[_0x7272('0x3a')]=qs[_0x7272('0x3a')](_0x2fc117[_0x7272('0x34')][_0x7272('0x3a')]);_0x5295bf[_0x7272('0x1c')]=qs[_0x7272('0x1c')](_0x2fc117[_0x7272('0x34')][_0x7272('0x1c')]);}_0x5295bf[_0x7272('0x3b')]=qs[_0x7272('0x3c')](_0x2fc117[_0x7272('0x34')][_0x7272('0x3c')]);_0x5295bf['where']=qs['filters'](_['pick'](_0x2fc117['query'],_0x3481d4[_0x7272('0x32')]),_0x4e3860);if(_0x2fc117[_0x7272('0x34')][_0x7272('0x3d')]){_0x5295bf[_0x7272('0x3e')]=_[_0x7272('0x3f')](_0x5295bf[_0x7272('0x3e')],{'$or':_['map'](_0x4e3860,function(_0xbb9120){if(_0xbb9120[_0x7272('0x40')]!=='VIRTUAL'){var _0x22b5fb={};_0x22b5fb[_0xbb9120[_0x7272('0x2a')]]={'$like':'%'+_0x2fc117['query']['filter']+'%'};return _0x22b5fb;}})});}_0x5295bf=_[_0x7272('0x3f')]({},_0x5295bf,_0x2fc117[_0x7272('0x41')]);var _0x43cc74={'where':_0x5295bf[_0x7272('0x3e')]};return db[_0x7272('0x2d')][_0x7272('0x1b')](_0x43cc74)[_0x7272('0x23')](function(_0x32f1bd){_0x427b4f[_0x7272('0x1b')]=_0x32f1bd;if(_0x2fc117[_0x7272('0x34')][_0x7272('0x42')]){_0x5295bf['include']=[{'all':!![]}];}return db[_0x7272('0x2d')][_0x7272('0x43')](_0x5295bf);})[_0x7272('0x23')](function(_0x3ddefb){_0x427b4f['rows']=_0x3ddefb;return _0x427b4f;})[_0x7272('0x23')](respondWithFilteredResult(_0x5629d8,_0x5295bf))[_0x7272('0x44')](handleError(_0x5629d8,null));};exports[_0x7272('0x45')]=function(_0x53e76b,_0x3f29ae){var _0x2a3080={'raw':!![],'where':{'id':_0x53e76b[_0x7272('0x46')]['id']}},_0x5e9042={};_0x5e9042[_0x7272('0x30')]=_[_0x7272('0x31')](db[_0x7272('0x2d')][_0x7272('0x2e')]);_0x5e9042[_0x7272('0x34')]=_[_0x7272('0x31')](_0x53e76b['query']);_0x5e9042[_0x7272('0x32')]=_['intersection'](_0x5e9042[_0x7272('0x30')],_0x5e9042[_0x7272('0x34')]);_0x2a3080[_0x7272('0x35')]=_[_0x7272('0x33')](_0x5e9042[_0x7272('0x30')],qs[_0x7272('0x36')](_0x53e76b[_0x7272('0x34')][_0x7272('0x36')]));_0x2a3080[_0x7272('0x35')]=_0x2a3080['attributes']['length']?_0x2a3080[_0x7272('0x35')]:_0x5e9042['model'];if(_0x53e76b[_0x7272('0x34')][_0x7272('0x42')]){_0x2a3080[_0x7272('0x47')]=[{'all':!![]}];}_0x2a3080=_[_0x7272('0x3f')]({},_0x2a3080,_0x53e76b[_0x7272('0x41')]);return db[_0x7272('0x2d')][_0x7272('0x48')](_0x2a3080)['then'](handleEntityNotFound(_0x3f29ae,null))['then'](respondWithResult(_0x3f29ae,null))['catch'](handleError(_0x3f29ae,null));};exports[_0x7272('0x49')]=function(_0x2ff594,_0x21b305){return db[_0x7272('0x2d')]['create'](_0x2ff594[_0x7272('0x4a')],{})[_0x7272('0x23')](function(_0x3bbcbd){var _0x3e8062=_0x2ff594[_0x7272('0x4b')][_0x7272('0x24')]({'plain':!![]});if(!_0x3e8062)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e8062['role']===_0x7272('0x4b')){var _0x12e6ac=_0x3bbcbd[_0x7272('0x24')]({'plain':!![]});var _0x2c85e3='Templates';return db[_0x7272('0x4c')]['find']({'where':{'name':_0x2c85e3,'userProfileId':_0x3e8062[_0x7272('0x4d')]},'raw':!![]})[_0x7272('0x23')](function(_0x71d947){if(_0x71d947&&_0x71d947[_0x7272('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x12e6ac[_0x7272('0x2a')],'resourceId':_0x12e6ac['id'],'type':_0x71d947[_0x7272('0x2a')],'sectionId':_0x71d947['id']},{})[_0x7272('0x23')](function(){return _0x3bbcbd;});}else{return _0x3bbcbd;}})[_0x7272('0x44')](function(_0x30f4c7){logger['error'](_0x7272('0x4f'),_0x30f4c7);throw _0x30f4c7;});}return _0x3bbcbd;})[_0x7272('0x23')](respondWithResult(_0x21b305,0xc9))[_0x7272('0x44')](handleError(_0x21b305,null));};exports[_0x7272('0x22')]=function(_0x380bee,_0xa8c632){if(_0x380bee[_0x7272('0x4a')]['id']){delete _0x380bee[_0x7272('0x4a')]['id'];}return db['Template'][_0x7272('0x48')]({'where':{'id':_0x380bee[_0x7272('0x46')]['id']}})[_0x7272('0x23')](handleEntityNotFound(_0xa8c632,null))[_0x7272('0x23')](saveUpdates(_0x380bee[_0x7272('0x4a')],null))[_0x7272('0x23')](respondWithResult(_0xa8c632,null))[_0x7272('0x44')](handleError(_0xa8c632,null));};exports[_0x7272('0x27')]=function(_0x24d2ad,_0x222869){return db[_0x7272('0x2d')][_0x7272('0x48')]({'where':{'id':_0x24d2ad[_0x7272('0x46')]['id']}})[_0x7272('0x23')](handleEntityNotFound(_0x222869,null))[_0x7272('0x23')](removeEntity(_0x222869,null))[_0x7272('0x44')](handleError(_0x222869,null));}; \ No newline at end of file +var _0x0e22=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','Templates','UserProfileResource','then','error','stack','name','send','map','Template','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','status'];(function(_0x208b37,_0x14f91a){var _0x1b54e5=function(_0x395de8){while(--_0x395de8){_0x208b37['push'](_0x208b37['shift']());}};_0x1b54e5(++_0x14f91a);}(_0x0e22,0x84));var _0x20e2=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x0e22[_0x5ebc04];return _0x17845c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20e2('0x0'));var zipdir=require(_0x20e2('0x1'));var jsonpatch=require(_0x20e2('0x2'));var rp=require(_0x20e2('0x3'));var moment=require(_0x20e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x20e2('0x5'));var util=require(_0x20e2('0x6'));var path=require(_0x20e2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20e2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x20e2('0x9'));var jsforce=require(_0x20e2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x20e2('0xb'));var querystring=require(_0x20e2('0xc'));var Papa=require(_0x20e2('0xd'));var Redis=require(_0x20e2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x20e2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x20e2('0x10'))('api');var utils=require(_0x20e2('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x20e2('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11cbed,_0xa56d74){_0xa56d74=_0xa56d74||0xcc;return function(_0x24f7b9){if(_0x24f7b9){return _0x11cbed['sendStatus'](_0xa56d74);}return _0x11cbed[_0x20e2('0x13')](_0xa56d74)[_0x20e2('0x14')]();};}function respondWithResult(_0x5f0b1c,_0x2ee675){_0x2ee675=_0x2ee675||0xc8;return function(_0x2ca37d){if(_0x2ca37d){return _0x5f0b1c[_0x20e2('0x13')](_0x2ee675)[_0x20e2('0x15')](_0x2ca37d);}};}function respondWithFilteredResult(_0x6c8ed,_0x421f76){return function(_0x3096c8){if(_0x3096c8){var _0xb3eb65=typeof _0x421f76[_0x20e2('0x16')]===_0x20e2('0x17')&&typeof _0x421f76[_0x20e2('0x18')]===_0x20e2('0x17');var _0x1ef476=_0x3096c8[_0x20e2('0x19')];var _0x5b0bdd=_0xb3eb65?0x0:_0x421f76[_0x20e2('0x16')];var _0x2c6acc=_0xb3eb65?_0x3096c8[_0x20e2('0x19')]:_0x421f76['offset']+_0x421f76[_0x20e2('0x18')];var _0x35597f;if(_0x2c6acc>=_0x1ef476){_0x2c6acc=_0x1ef476;_0x35597f=0xc8;}else{_0x35597f=0xce;}_0x6c8ed[_0x20e2('0x13')](_0x35597f);return _0x6c8ed[_0x20e2('0x1a')](_0x20e2('0x1b'),_0x5b0bdd+'-'+_0x2c6acc+'/'+_0x1ef476)['json'](_0x3096c8);}return null;};}function patchUpdates(_0x497a84){return function(_0xbd33be){try{jsonpatch['apply'](_0xbd33be,_0x497a84,!![]);}catch(_0xc18a46){return BPromise[_0x20e2('0x1c')](_0xc18a46);}return _0xbd33be[_0x20e2('0x1d')]();};}function saveUpdates(_0x737758,_0x2e44a2){return function(_0x46666a){if(_0x46666a){return _0x46666a[_0x20e2('0x1e')](_0x737758)['then'](function(_0x3b7004){return _0x3b7004;});}return null;};}function removeEntity(_0x2102e3,_0x3a703d){return function(_0x48aa4f){if(_0x48aa4f){return _0x48aa4f[_0x20e2('0x1f')]()['then'](function(){var _0x3e0647=_0x48aa4f[_0x20e2('0x20')]({'plain':!![]});var _0x4d37d5=_0x20e2('0x21');return db[_0x20e2('0x22')][_0x20e2('0x1f')]({'where':{'type':_0x4d37d5,'resourceId':_0x3e0647['id']}})[_0x20e2('0x23')](function(){return _0x48aa4f;});})[_0x20e2('0x23')](function(){_0x2102e3[_0x20e2('0x13')](0xcc)[_0x20e2('0x14')]();});}};}function handleEntityNotFound(_0x54bf27,_0x4f611d){return function(_0xd2417c){if(!_0xd2417c){_0x54bf27['sendStatus'](0x194);}return _0xd2417c;};}function handleError(_0x4dcf4f,_0x538166){_0x538166=_0x538166||0x1f4;return function(_0x221152){logger[_0x20e2('0x24')](_0x221152[_0x20e2('0x25')]);if(_0x221152['name']){delete _0x221152[_0x20e2('0x26')];}_0x4dcf4f[_0x20e2('0x13')](_0x538166)[_0x20e2('0x27')](_0x221152);};}exports['index']=function(_0x18c15a,_0x5632e5){var _0x5556b9={},_0x7e1438={},_0x407d9f={'count':0x0,'rows':[]};var _0x27e248=_[_0x20e2('0x28')](db[_0x20e2('0x29')][_0x20e2('0x2a')],function(_0x5bdf2a){return{'name':_0x5bdf2a[_0x20e2('0x2b')],'type':_0x5bdf2a['type'][_0x20e2('0x2c')]};});_0x7e1438[_0x20e2('0x2d')]=_[_0x20e2('0x28')](_0x27e248,_0x20e2('0x26'));_0x7e1438[_0x20e2('0x2e')]=_[_0x20e2('0x2f')](_0x18c15a[_0x20e2('0x2e')]);_0x7e1438[_0x20e2('0x30')]=_[_0x20e2('0x31')](_0x7e1438[_0x20e2('0x2d')],_0x7e1438['query']);_0x5556b9[_0x20e2('0x32')]=_['intersection'](_0x7e1438[_0x20e2('0x2d')],qs[_0x20e2('0x33')](_0x18c15a['query']['fields']));_0x5556b9[_0x20e2('0x32')]=_0x5556b9[_0x20e2('0x32')][_0x20e2('0x34')]?_0x5556b9['attributes']:_0x7e1438[_0x20e2('0x2d')];if(!_0x18c15a[_0x20e2('0x2e')]['hasOwnProperty'](_0x20e2('0x35'))){_0x5556b9['limit']=qs[_0x20e2('0x18')](_0x18c15a['query'][_0x20e2('0x18')]);_0x5556b9[_0x20e2('0x16')]=qs[_0x20e2('0x16')](_0x18c15a['query'][_0x20e2('0x16')]);}_0x5556b9[_0x20e2('0x36')]=qs[_0x20e2('0x37')](_0x18c15a[_0x20e2('0x2e')][_0x20e2('0x37')]);_0x5556b9['where']=qs[_0x20e2('0x30')](_[_0x20e2('0x38')](_0x18c15a[_0x20e2('0x2e')],_0x7e1438[_0x20e2('0x30')]),_0x27e248);if(_0x18c15a['query'][_0x20e2('0x39')]){_0x5556b9['where']=_[_0x20e2('0x3a')](_0x5556b9['where'],{'$or':_['map'](_0x27e248,function(_0x3780d2){if(_0x3780d2[_0x20e2('0x3b')]!==_0x20e2('0x3c')){var _0x3864eb={};_0x3864eb[_0x3780d2[_0x20e2('0x26')]]={'$like':'%'+_0x18c15a[_0x20e2('0x2e')][_0x20e2('0x39')]+'%'};return _0x3864eb;}})});}_0x5556b9=_[_0x20e2('0x3a')]({},_0x5556b9,_0x18c15a['options']);var _0x3456c9={'where':_0x5556b9['where']};return db[_0x20e2('0x29')]['count'](_0x3456c9)[_0x20e2('0x23')](function(_0x2d558f){_0x407d9f[_0x20e2('0x19')]=_0x2d558f;if(_0x18c15a[_0x20e2('0x2e')][_0x20e2('0x3d')]){_0x5556b9[_0x20e2('0x3e')]=[{'all':!![]}];}return db['Template']['findAll'](_0x5556b9);})[_0x20e2('0x23')](function(_0x29f6a8){_0x407d9f['rows']=_0x29f6a8;return _0x407d9f;})['then'](respondWithFilteredResult(_0x5632e5,_0x5556b9))[_0x20e2('0x3f')](handleError(_0x5632e5,null));};exports[_0x20e2('0x40')]=function(_0x2ca835,_0x2ef33d){var _0x8d0314={'raw':!![],'where':{'id':_0x2ca835['params']['id']}},_0x2b8f87={};_0x2b8f87[_0x20e2('0x2d')]=_[_0x20e2('0x2f')](db['Template'][_0x20e2('0x2a')]);_0x2b8f87['query']=_['keys'](_0x2ca835[_0x20e2('0x2e')]);_0x2b8f87['filters']=_[_0x20e2('0x31')](_0x2b8f87[_0x20e2('0x2d')],_0x2b8f87[_0x20e2('0x2e')]);_0x8d0314[_0x20e2('0x32')]=_['intersection'](_0x2b8f87[_0x20e2('0x2d')],qs[_0x20e2('0x33')](_0x2ca835[_0x20e2('0x2e')]['fields']));_0x8d0314[_0x20e2('0x32')]=_0x8d0314[_0x20e2('0x32')]['length']?_0x8d0314[_0x20e2('0x32')]:_0x2b8f87[_0x20e2('0x2d')];if(_0x2ca835['query'][_0x20e2('0x3d')]){_0x8d0314[_0x20e2('0x3e')]=[{'all':!![]}];}_0x8d0314=_['merge']({},_0x8d0314,_0x2ca835[_0x20e2('0x41')]);return db[_0x20e2('0x29')][_0x20e2('0x42')](_0x8d0314)[_0x20e2('0x23')](handleEntityNotFound(_0x2ef33d,null))['then'](respondWithResult(_0x2ef33d,null))[_0x20e2('0x3f')](handleError(_0x2ef33d,null));};exports[_0x20e2('0x43')]=function(_0x1bb0fc,_0x500027){return db['Template'][_0x20e2('0x43')](_0x1bb0fc['body'],{})[_0x20e2('0x23')](function(_0x5854de){var _0x350479=_0x1bb0fc[_0x20e2('0x44')][_0x20e2('0x20')]({'plain':!![]});if(!_0x350479)throw new Error(_0x20e2('0x45'));if(_0x350479[_0x20e2('0x46')]===_0x20e2('0x44')){var _0x81ff18=_0x5854de[_0x20e2('0x20')]({'plain':!![]});var _0xcc19d5=_0x20e2('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xcc19d5,'userProfileId':_0x350479[_0x20e2('0x47')]},'raw':!![]})[_0x20e2('0x23')](function(_0x4f26fd){if(_0x4f26fd&&_0x4f26fd[_0x20e2('0x48')]===0x0){return db['UserProfileResource'][_0x20e2('0x43')]({'name':_0x81ff18[_0x20e2('0x26')],'resourceId':_0x81ff18['id'],'type':_0x4f26fd[_0x20e2('0x26')],'sectionId':_0x4f26fd['id']},{})[_0x20e2('0x23')](function(){return _0x5854de;});}else{return _0x5854de;}})[_0x20e2('0x3f')](function(_0x1e68c5){logger['error'](_0x20e2('0x49'),_0x1e68c5);throw _0x1e68c5;});}return _0x5854de;})[_0x20e2('0x23')](respondWithResult(_0x500027,0xc9))['catch'](handleError(_0x500027,null));};exports['update']=function(_0x17e25f,_0x2c6a4a){if(_0x17e25f[_0x20e2('0x4a')]['id']){delete _0x17e25f[_0x20e2('0x4a')]['id'];}return db[_0x20e2('0x29')][_0x20e2('0x42')]({'where':{'id':_0x17e25f[_0x20e2('0x4b')]['id']}})[_0x20e2('0x23')](handleEntityNotFound(_0x2c6a4a,null))['then'](saveUpdates(_0x17e25f[_0x20e2('0x4a')],null))[_0x20e2('0x23')](respondWithResult(_0x2c6a4a,null))[_0x20e2('0x3f')](handleError(_0x2c6a4a,null));};exports['destroy']=function(_0x38fdd3,_0x3fbd1c){return db[_0x20e2('0x29')][_0x20e2('0x42')]({'where':{'id':_0x38fdd3[_0x20e2('0x4b')]['id']}})[_0x20e2('0x23')](handleEntityNotFound(_0x3fbd1c,null))[_0x20e2('0x23')](removeEntity(_0x3fbd1c,null))[_0x20e2('0x3f')](handleError(_0x3fbd1c,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d265983..24ffbb0 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 _0xd90e=['path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x298642,_0x46ab91){var _0x4216d6=function(_0x10e81d){while(--_0x10e81d){_0x298642['push'](_0x298642['shift']());}};_0x4216d6(++_0x46ab91);}(_0xd90e,0x1f1));var _0xed90=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd90e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xed90('0x0'));var util=require(_0xed90('0x1'));var logger=require(_0xed90('0x2'))(_0xed90('0x3'));var moment=require(_0xed90('0x4'));var BPromise=require(_0xed90('0x5'));var rp=require(_0xed90('0x6'));var fs=require('fs');var path=require(_0xed90('0x7'));var rimraf=require(_0xed90('0x8'));var config=require('../../config/environment');var attributes=require(_0xed90('0x9'));module[_0xed90('0xa')]=function(_0x44e050,_0xe88eb1){return _0x44e050[_0xed90('0xb')](_0xed90('0xc'),attributes,{'tableName':_0xed90('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bfe=['tools_templates','util','moment','bluebird','./template.attributes','exports','define','Template'];(function(_0x31405e,_0x5b6141){var _0x4c28e4=function(_0x690ef9){while(--_0x690ef9){_0x31405e['push'](_0x31405e['shift']());}};_0x4c28e4(++_0x5b6141);}(_0x5bfe,0xe9));var _0xe5bf=function(_0x313803,_0x53a75c){_0x313803=_0x313803-0x0;var _0xf2c9ab=_0x5bfe[_0x313803];return _0xf2c9ab;};'use strict';var _=require('lodash');var util=require(_0xe5bf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe5bf('0x1'));var BPromise=require(_0xe5bf('0x2'));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(_0xe5bf('0x3'));module[_0xe5bf('0x4')]=function(_0x29824d,_0x1de07b){return _0x29824d[_0xe5bf('0x5')](_0xe5bf('0x6'),attributes,{'tableName':_0xe5bf('0x7'),'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 e9df71a..d161722 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 _0x64a4=['include','attributes','model','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','raw','options','where','limit','map'];(function(_0xeb442a,_0x3949c5){var _0x1b2bd8=function(_0x3beb31){while(--_0x3beb31){_0xeb442a['push'](_0xeb442a['shift']());}};_0x1b2bd8(++_0x3949c5);}(_0x64a4,0x1d2));var _0x464a=function(_0x573b76,_0x3fcca8){_0x573b76=_0x573b76-0x0;var _0x22e32c=_0x64a4[_0x573b76];return _0x22e32c;};'use strict';var _=require(_0x464a('0x0'));var util=require(_0x464a('0x1'));var moment=require('moment');var BPromise=require(_0x464a('0x2'));var rs=require(_0x464a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x464a('0x4'))['db'];var utils=require(_0x464a('0x5'));var logger=require(_0x464a('0x6'))(_0x464a('0x7'));var config=require(_0x464a('0x8'));var jayson=require(_0x464a('0x9'));var client=jayson['client'][_0x464a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b3f51,_0xa4e3a1,_0x265dee){return new BPromise(function(_0x4a9757,_0x127582){return client[_0x464a('0xb')](_0x5b3f51,_0x265dee)[_0x464a('0xc')](function(_0x41cbd6){logger[_0x464a('0xd')](_0x464a('0xe'),_0xa4e3a1,_0x464a('0xf'));logger['debug'](_0x464a('0x10'),_0xa4e3a1,_0x464a('0xf'),JSON[_0x464a('0x11')](_0x41cbd6));if(_0x41cbd6[_0x464a('0x12')]){if(_0x41cbd6['error'][_0x464a('0x13')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0xa4e3a1,_0x41cbd6[_0x464a('0x12')][_0x464a('0x14')]);return _0x127582(_0x41cbd6['error']['message']);}logger['error'](_0x464a('0xe'),_0xa4e3a1,_0x41cbd6['error'][_0x464a('0x14')]);return _0x4a9757(_0x41cbd6[_0x464a('0x12')][_0x464a('0x14')]);}else{logger[_0x464a('0xd')]('Template,\x20%s,\x20%s',_0xa4e3a1,'request\x20sent');_0x4a9757(_0x41cbd6['result']['message']);}})[_0x464a('0x15')](function(_0x1fe58a){logger[_0x464a('0x12')](_0x464a('0xe'),_0xa4e3a1,_0x1fe58a);_0x127582(_0x1fe58a);});});}exports[_0x464a('0x16')]=function(_0x3d86d1){var _0x567051=this;return new Promise(function(_0x495a1b,_0x4468ca){return db[_0x464a('0x17')]['findAll']({'raw':_0x3d86d1['options']?_0x3d86d1['options'][_0x464a('0x18')]===undefined?!![]:![]:!![],'where':_0x3d86d1[_0x464a('0x19')]?_0x3d86d1['options'][_0x464a('0x1a')]||null:null,'attributes':_0x3d86d1['options']?_0x3d86d1[_0x464a('0x19')]['attributes']||null:null,'limit':_0x3d86d1['options']?_0x3d86d1['options'][_0x464a('0x1b')]||null:null,'include':_0x3d86d1[_0x464a('0x19')]?_0x3d86d1[_0x464a('0x19')]['include']?_[_0x464a('0x1c')](_0x3d86d1[_0x464a('0x19')][_0x464a('0x1d')],function(_0x243788){return{'model':db[_0x243788['model']],'as':_0x243788['as'],'attributes':_0x243788['attributes'],'include':_0x243788['include']?_['map'](_0x243788[_0x464a('0x1d')],function(_0x2bef5e){return{'model':db[_0x2bef5e['model']],'as':_0x2bef5e['as'],'attributes':_0x2bef5e[_0x464a('0x1e')],'include':_0x2bef5e[_0x464a('0x1d')]?_[_0x464a('0x1c')](_0x2bef5e[_0x464a('0x1d')],function(_0x4b8d71){return{'model':db[_0x4b8d71[_0x464a('0x1f')]],'as':_0x4b8d71['as'],'attributes':_0x4b8d71['attributes']};}):[]};}):[]};}):[]:[]})[_0x464a('0xc')](function(_0x415a0f){logger['info'](_0x464a('0x16'),_0x3d86d1);logger[_0x464a('0x20')](_0x464a('0x16'),_0x3d86d1,JSON[_0x464a('0x11')](_0x415a0f));_0x495a1b(_0x415a0f);})[_0x464a('0x15')](function(_0x1a8fb4){logger[_0x464a('0x12')](_0x464a('0x16'),_0x1a8fb4[_0x464a('0x14')],_0x3d86d1);_0x4468ca(_0x567051['error'](0x1f4,_0x1a8fb4['message']));});});}; \ No newline at end of file +var _0xd882=['map','model','then','debug','GetTemplate','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','result','Template','findAll','options','raw','where','attributes','limit','include'];(function(_0x3bf0bc,_0x39732e){var _0x12f9e3=function(_0x258c0c){while(--_0x258c0c){_0x3bf0bc['push'](_0x3bf0bc['shift']());}};_0x12f9e3(++_0x39732e);}(_0xd882,0xfb));var _0x2d88=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0xd882[_0x20b29c];return _0x20d81b;};'use strict';var _=require(_0x2d88('0x0'));var util=require(_0x2d88('0x1'));var moment=require(_0x2d88('0x2'));var BPromise=require(_0x2d88('0x3'));var rs=require(_0x2d88('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d88('0x5'));var logger=require(_0x2d88('0x6'))(_0x2d88('0x7'));var config=require(_0x2d88('0x8'));var jayson=require(_0x2d88('0x9'));var client=jayson['client'][_0x2d88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d771f,_0x501d7b,_0xdc8be2){return new BPromise(function(_0x29aa2d,_0x3500db){return client[_0x2d88('0xb')](_0x4d771f,_0xdc8be2)['then'](function(_0x54b2c5){logger[_0x2d88('0xc')]('Template,\x20%s,\x20%s',_0x501d7b,_0x2d88('0xd'));logger['debug'](_0x2d88('0xe'),_0x501d7b,_0x2d88('0xd'),JSON[_0x2d88('0xf')](_0x54b2c5));if(_0x54b2c5['error']){if(_0x54b2c5[_0x2d88('0x10')][_0x2d88('0x11')]===0x1f4){logger[_0x2d88('0x10')]('Template,\x20%s,\x20%s',_0x501d7b,_0x54b2c5['error'][_0x2d88('0x12')]);return _0x3500db(_0x54b2c5[_0x2d88('0x10')]['message']);}logger['error']('Template,\x20%s,\x20%s',_0x501d7b,_0x54b2c5[_0x2d88('0x10')]['message']);return _0x29aa2d(_0x54b2c5['error'][_0x2d88('0x12')]);}else{logger['info'](_0x2d88('0x13'),_0x501d7b,_0x2d88('0xd'));_0x29aa2d(_0x54b2c5[_0x2d88('0x14')]['message']);}})['catch'](function(_0xde4241){logger['error'](_0x2d88('0x13'),_0x501d7b,_0xde4241);_0x3500db(_0xde4241);});});}exports['GetTemplate']=function(_0x18aafb){var _0x50eee4=this;return new Promise(function(_0x491973,_0x10f345){return db[_0x2d88('0x15')][_0x2d88('0x16')]({'raw':_0x18aafb['options']?_0x18aafb[_0x2d88('0x17')][_0x2d88('0x18')]===undefined?!![]:![]:!![],'where':_0x18aafb[_0x2d88('0x17')]?_0x18aafb[_0x2d88('0x17')][_0x2d88('0x19')]||null:null,'attributes':_0x18aafb['options']?_0x18aafb[_0x2d88('0x17')][_0x2d88('0x1a')]||null:null,'limit':_0x18aafb[_0x2d88('0x17')]?_0x18aafb[_0x2d88('0x17')][_0x2d88('0x1b')]||null:null,'include':_0x18aafb['options']?_0x18aafb[_0x2d88('0x17')][_0x2d88('0x1c')]?_[_0x2d88('0x1d')](_0x18aafb['options'][_0x2d88('0x1c')],function(_0x3b76ba){return{'model':db[_0x3b76ba['model']],'as':_0x3b76ba['as'],'attributes':_0x3b76ba[_0x2d88('0x1a')],'include':_0x3b76ba[_0x2d88('0x1c')]?_[_0x2d88('0x1d')](_0x3b76ba[_0x2d88('0x1c')],function(_0x1d9ac6){return{'model':db[_0x1d9ac6[_0x2d88('0x1e')]],'as':_0x1d9ac6['as'],'attributes':_0x1d9ac6[_0x2d88('0x1a')],'include':_0x1d9ac6[_0x2d88('0x1c')]?_['map'](_0x1d9ac6[_0x2d88('0x1c')],function(_0x2f333e){return{'model':db[_0x2f333e[_0x2d88('0x1e')]],'as':_0x2f333e['as'],'attributes':_0x2f333e[_0x2d88('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2d88('0x1f')](function(_0x1210bb){logger[_0x2d88('0xc')]('GetTemplate',_0x18aafb);logger[_0x2d88('0x20')](_0x2d88('0x21'),_0x18aafb,JSON[_0x2d88('0xf')](_0x1210bb));_0x491973(_0x1210bb);})[_0x2d88('0x22')](function(_0x2d4aa7){logger['error'](_0x2d88('0x21'),_0x2d4aa7[_0x2d88('0x12')],_0x18aafb);_0x10f345(_0x50eee4['error'](0x1f4,_0x2d4aa7[_0x2d88('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 381beba..a2e797c 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 _0x047f=['get','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','create','post','addAllCondition','addAnyCondition','/:id/actions','addAction','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x253095,_0x33ca26){var _0x1b08f1=function(_0x1a940a){while(--_0x1a940a){_0x253095['push'](_0x253095['shift']());}};_0x1b08f1(++_0x33ca26);}(_0x047f,0xfc));var _0xf047=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x047f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf047('0x0'));var util=require(_0xf047('0x1'));var path=require(_0xf047('0x2'));var timeout=require(_0xf047('0x3'));var express=require('express');var router=express[_0xf047('0x4')]();var fs_extra=require(_0xf047('0x5'));var auth=require(_0xf047('0x6'));var interaction=require(_0xf047('0x7'));var config=require(_0xf047('0x8'));var controller=require('./trigger.controller');router[_0xf047('0x9')]('/',auth['isAuthenticated'](),controller[_0xf047('0xa')]);router[_0xf047('0x9')](_0xf047('0xb'),auth[_0xf047('0xc')](),controller[_0xf047('0xd')]);router[_0xf047('0x9')](_0xf047('0xe'),auth['isAuthenticated'](),controller[_0xf047('0xf')]);router['get'](_0xf047('0x10'),auth[_0xf047('0xc')](),controller[_0xf047('0x11')]);router[_0xf047('0x9')]('/:id/actions',auth[_0xf047('0xc')](),controller[_0xf047('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf047('0x13')]);router[_0xf047('0x14')]('/:id/all_conditions',auth[_0xf047('0xc')](),controller[_0xf047('0x15')]);router['post'](_0xf047('0x10'),auth[_0xf047('0xc')](),controller[_0xf047('0x16')]);router[_0xf047('0x14')](_0xf047('0x17'),auth[_0xf047('0xc')](),controller[_0xf047('0x18')]);router[_0xf047('0x19')](_0xf047('0xb'),auth[_0xf047('0xc')](),controller['update']);router[_0xf047('0x1a')](_0xf047('0xb'),auth[_0xf047('0xc')](),controller[_0xf047('0x1b')]);module[_0xf047('0x1c')]=router; \ No newline at end of file +var _0x8c43=['getAnyConditions','/:id/actions','create','post','addAllCondition','addAction','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions'];(function(_0x5ae9a7,_0x31a592){var _0x53caca=function(_0x1ea41d){while(--_0x1ea41d){_0x5ae9a7['push'](_0x5ae9a7['shift']());}};_0x53caca(++_0x31a592);}(_0x8c43,0x1e5));var _0x38c4=function(_0x2095cf,_0x12058b){_0x2095cf=_0x2095cf-0x0;var _0x293cba=_0x8c43[_0x2095cf];return _0x293cba;};'use strict';var multer=require(_0x38c4('0x0'));var util=require(_0x38c4('0x1'));var path=require(_0x38c4('0x2'));var timeout=require(_0x38c4('0x3'));var express=require(_0x38c4('0x4'));var router=express['Router']();var fs_extra=require(_0x38c4('0x5'));var auth=require(_0x38c4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x38c4('0x7'));router[_0x38c4('0x8')]('/',auth[_0x38c4('0x9')](),controller['index']);router[_0x38c4('0x8')](_0x38c4('0xa'),auth[_0x38c4('0x9')](),controller[_0x38c4('0xb')]);router[_0x38c4('0x8')](_0x38c4('0xc'),auth[_0x38c4('0x9')](),controller[_0x38c4('0xd')]);router['get'](_0x38c4('0xe'),auth['isAuthenticated'](),controller[_0x38c4('0xf')]);router[_0x38c4('0x8')](_0x38c4('0x10'),auth[_0x38c4('0x9')](),controller['getActions']);router['post']('/',auth[_0x38c4('0x9')](),controller[_0x38c4('0x11')]);router[_0x38c4('0x12')]('/:id/all_conditions',auth[_0x38c4('0x9')](),controller[_0x38c4('0x13')]);router[_0x38c4('0x12')](_0x38c4('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0x38c4('0x14')]);router['put'](_0x38c4('0xa'),auth['isAuthenticated'](),controller[_0x38c4('0x15')]);router[_0x38c4('0x16')](_0x38c4('0xa'),auth[_0x38c4('0x9')](),controller[_0x38c4('0x17')]);module[_0x38c4('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index e7c78bb..6f240de 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 _0xf8ef=['sequelize','exports','STRING'];(function(_0x4e7c1c,_0x56eafd){var _0x47adb2=function(_0x346135){while(--_0x346135){_0x4e7c1c['push'](_0x4e7c1c['shift']());}};_0x47adb2(++_0x56eafd);}(_0xf8ef,0x114));var _0xff8e=function(_0x2f1904,_0x22646f){_0x2f1904=_0x2f1904-0x0;var _0x3e6354=_0xf8ef[_0x2f1904];return _0x3e6354;};'use strict';var Sequelize=require(_0xff8e('0x0'));module[_0xff8e('0x1')]={'name':{'type':Sequelize[_0xff8e('0x2')]},'channel':{'type':Sequelize[_0xff8e('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x317a=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5ed036,_0x433b87){var _0x4b9180=function(_0x34c6c7){while(--_0x34c6c7){_0x5ed036['push'](_0x5ed036['shift']());}};_0x4b9180(++_0x433b87);}(_0x317a,0x1d5));var _0xa317=function(_0x4cecf8,_0x522f97){_0x4cecf8=_0x4cecf8-0x0;var _0x311797=_0x317a[_0x4cecf8];return _0x311797;};'use strict';var Sequelize=require(_0xa317('0x0'));module[_0xa317('0x1')]={'name':{'type':Sequelize[_0xa317('0x2')]},'channel':{'type':Sequelize[_0xa317('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa317('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 6b5171a..c2fa71f 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 _0x28d5=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','get','Triggers','UserProfileResource','stack','name','send','map','Trigger','rawAttributes','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','create','body','user','role','find','userProfileId','autoAssociation','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x51b829,_0xb2594c){var _0x12437a=function(_0x480822){while(--_0x480822){_0x51b829['push'](_0x51b829['shift']());}};_0x12437a(++_0xb2594c);}(_0x28d5,0xb8));var _0x528d=function(_0x189dbd,_0x1d3cad){_0x189dbd=_0x189dbd-0x0;var _0x7861fb=_0x28d5[_0x189dbd];return _0x7861fb;};'use strict';var emlformat=require(_0x528d('0x0'));var rimraf=require(_0x528d('0x1'));var zipdir=require(_0x528d('0x2'));var jsonpatch=require(_0x528d('0x3'));var rp=require('request-promise');var moment=require(_0x528d('0x4'));var BPromise=require(_0x528d('0x5'));var Mustache=require(_0x528d('0x6'));var util=require(_0x528d('0x7'));var path=require(_0x528d('0x8'));var sox=require(_0x528d('0x9'));var csv=require(_0x528d('0xa'));var ejs=require(_0x528d('0xb'));var fs=require('fs');var fs_extra=require(_0x528d('0xc'));var _=require(_0x528d('0xd'));var squel=require(_0x528d('0xe'));var crypto=require('crypto');var jsforce=require(_0x528d('0xf'));var deskjs=require(_0x528d('0x10'));var toCsv=require(_0x528d('0xa'));var querystring=require(_0x528d('0x11'));var Papa=require(_0x528d('0x12'));var Redis=require(_0x528d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x528d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x528d('0x15'));var logger=require(_0x528d('0x16'))('api');var utils=require(_0x528d('0x17'));var config=require(_0x528d('0x18'));var licenseUtil=require(_0x528d('0x19'));var db=require(_0x528d('0x1a'))['db'];function respondWithStatusCode(_0x56d55d,_0x11d073){_0x11d073=_0x11d073||0xcc;return function(_0x30cc40){if(_0x30cc40){return _0x56d55d[_0x528d('0x1b')](_0x11d073);}return _0x56d55d[_0x528d('0x1c')](_0x11d073)['end']();};}function respondWithResult(_0x1b78ac,_0x18388d){_0x18388d=_0x18388d||0xc8;return function(_0x39d538){if(_0x39d538){return _0x1b78ac[_0x528d('0x1c')](_0x18388d)[_0x528d('0x1d')](_0x39d538);}};}function respondWithFilteredResult(_0x2d1331,_0xa81c99){return function(_0xa16d13){if(_0xa16d13){var _0xd33a19=typeof _0xa81c99[_0x528d('0x1e')]===_0x528d('0x1f')&&typeof _0xa81c99['limit']===_0x528d('0x1f');var _0x2d90c3=_0xa16d13[_0x528d('0x20')];var _0x401cf1=_0xd33a19?0x0:_0xa81c99[_0x528d('0x1e')];var _0x45ab87=_0xd33a19?_0xa16d13['count']:_0xa81c99['offset']+_0xa81c99[_0x528d('0x21')];var _0x4bbc6e;if(_0x45ab87>=_0x2d90c3){_0x45ab87=_0x2d90c3;_0x4bbc6e=0xc8;}else{_0x4bbc6e=0xce;}_0x2d1331[_0x528d('0x1c')](_0x4bbc6e);return _0x2d1331[_0x528d('0x22')](_0x528d('0x23'),_0x401cf1+'-'+_0x45ab87+'/'+_0x2d90c3)[_0x528d('0x1d')](_0xa16d13);}return null;};}function patchUpdates(_0x5bef34){return function(_0x158803){try{jsonpatch['apply'](_0x158803,_0x5bef34,!![]);}catch(_0x3ac357){return BPromise[_0x528d('0x24')](_0x3ac357);}return _0x158803[_0x528d('0x25')]();};}function saveUpdates(_0xb1165c,_0x1bd4a0){return function(_0x3180ba){if(_0x3180ba){return _0x3180ba['update'](_0xb1165c)[_0x528d('0x26')](function(_0x3caea2){return _0x3caea2;});}return null;};}function removeEntity(_0x420283,_0x440b40){return function(_0x54a040){if(_0x54a040){return _0x54a040[_0x528d('0x27')]()[_0x528d('0x26')](function(){var _0xc37c9b=_0x54a040[_0x528d('0x28')]({'plain':!![]});var _0x33b5c2=_0x528d('0x29');return db[_0x528d('0x2a')][_0x528d('0x27')]({'where':{'type':_0x33b5c2,'resourceId':_0xc37c9b['id']}})['then'](function(){return _0x54a040;});})[_0x528d('0x26')](function(){_0x420283[_0x528d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x561a5a,_0x51ae3c){return function(_0x1a442a){if(!_0x1a442a){_0x561a5a[_0x528d('0x1b')](0x194);}return _0x1a442a;};}function handleError(_0x216162,_0x20453c){_0x20453c=_0x20453c||0x1f4;return function(_0xfeb8d){logger['error'](_0xfeb8d[_0x528d('0x2b')]);if(_0xfeb8d[_0x528d('0x2c')]){delete _0xfeb8d[_0x528d('0x2c')];}_0x216162[_0x528d('0x1c')](_0x20453c)[_0x528d('0x2d')](_0xfeb8d);};}exports['index']=function(_0x3d3cea,_0xb2212e){var _0x5661a2={},_0x1318ce={},_0x286920={'count':0x0,'rows':[]};var _0x3fb2e4=_[_0x528d('0x2e')](db[_0x528d('0x2f')][_0x528d('0x30')],function(_0x15295a){return{'name':_0x15295a['fieldName'],'type':_0x15295a['type'][_0x528d('0x31')]};});_0x1318ce[_0x528d('0x32')]=_['map'](_0x3fb2e4,_0x528d('0x2c'));_0x1318ce['query']=_['keys'](_0x3d3cea['query']);_0x1318ce[_0x528d('0x33')]=_[_0x528d('0x34')](_0x1318ce[_0x528d('0x32')],_0x1318ce['query']);_0x5661a2[_0x528d('0x35')]=_[_0x528d('0x34')](_0x1318ce[_0x528d('0x32')],qs[_0x528d('0x36')](_0x3d3cea[_0x528d('0x37')][_0x528d('0x36')]));_0x5661a2[_0x528d('0x35')]=_0x5661a2[_0x528d('0x35')][_0x528d('0x38')]?_0x5661a2[_0x528d('0x35')]:_0x1318ce[_0x528d('0x32')];if(!_0x3d3cea[_0x528d('0x37')][_0x528d('0x39')](_0x528d('0x3a'))){_0x5661a2['limit']=qs[_0x528d('0x21')](_0x3d3cea[_0x528d('0x37')][_0x528d('0x21')]);_0x5661a2['offset']=qs[_0x528d('0x1e')](_0x3d3cea[_0x528d('0x37')]['offset']);}_0x5661a2['order']=qs[_0x528d('0x3b')](_0x3d3cea[_0x528d('0x37')][_0x528d('0x3b')]);_0x5661a2[_0x528d('0x3c')]=qs[_0x528d('0x33')](_[_0x528d('0x3d')](_0x3d3cea['query'],_0x1318ce[_0x528d('0x33')]),_0x3fb2e4);if(_0x3d3cea[_0x528d('0x37')][_0x528d('0x3e')]){_0x5661a2[_0x528d('0x3c')]=_['merge'](_0x5661a2[_0x528d('0x3c')],{'$or':_['map'](_0x3fb2e4,function(_0x2a2220){if(_0x2a2220[_0x528d('0x3f')]!==_0x528d('0x40')){var _0x2ef810={};_0x2ef810[_0x2a2220[_0x528d('0x2c')]]={'$like':'%'+_0x3d3cea[_0x528d('0x37')]['filter']+'%'};return _0x2ef810;}})});}_0x5661a2=_[_0x528d('0x41')]({},_0x5661a2,_0x3d3cea['options']);var _0x2728f1={'where':_0x5661a2[_0x528d('0x3c')]};return db['Trigger'][_0x528d('0x20')](_0x2728f1)[_0x528d('0x26')](function(_0x42b3ed){_0x286920[_0x528d('0x20')]=_0x42b3ed;if(_0x3d3cea[_0x528d('0x37')]['includeAll']){_0x5661a2[_0x528d('0x42')]=[{'all':!![]}];}return db[_0x528d('0x2f')][_0x528d('0x43')](_0x5661a2);})[_0x528d('0x26')](function(_0x4c08a3){_0x286920[_0x528d('0x44')]=_0x4c08a3;return _0x286920;})['then'](respondWithFilteredResult(_0xb2212e,_0x5661a2))[_0x528d('0x45')](handleError(_0xb2212e,null));};exports[_0x528d('0x46')]=function(_0x3f0bb6,_0x16db59){var _0x11e6bc={'raw':![],'where':{'id':_0x3f0bb6[_0x528d('0x47')]['id']}},_0x20a7da={};_0x20a7da[_0x528d('0x32')]=_['keys'](db[_0x528d('0x2f')]['rawAttributes']);_0x20a7da[_0x528d('0x37')]=_[_0x528d('0x48')](_0x3f0bb6['query']);_0x20a7da[_0x528d('0x33')]=_[_0x528d('0x34')](_0x20a7da['model'],_0x20a7da[_0x528d('0x37')]);_0x11e6bc[_0x528d('0x35')]=_[_0x528d('0x34')](_0x20a7da['model'],qs['fields'](_0x3f0bb6[_0x528d('0x37')][_0x528d('0x36')]));_0x11e6bc['attributes']=_0x11e6bc[_0x528d('0x35')]['length']?_0x11e6bc[_0x528d('0x35')]:_0x20a7da[_0x528d('0x32')];if(_0x3f0bb6['query'][_0x528d('0x49')]){_0x11e6bc[_0x528d('0x42')]=[{'all':!![]}];}_0x11e6bc=_[_0x528d('0x41')]({},_0x11e6bc,_0x3f0bb6[_0x528d('0x4a')]);return db[_0x528d('0x2f')]['find'](_0x11e6bc)[_0x528d('0x26')](handleEntityNotFound(_0x16db59,null))[_0x528d('0x26')](respondWithResult(_0x16db59,null))['catch'](handleError(_0x16db59,null));};exports[_0x528d('0x4b')]=function(_0x544da1,_0x1924cb){return db[_0x528d('0x2f')][_0x528d('0x4b')](_0x544da1[_0x528d('0x4c')],{})[_0x528d('0x26')](function(_0x4e4859){var _0x331d28=_0x544da1[_0x528d('0x4d')][_0x528d('0x28')]({'plain':!![]});if(!_0x331d28)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x331d28[_0x528d('0x4e')]===_0x528d('0x4d')){var _0xee4520=_0x4e4859['get']({'plain':!![]});var _0x9e3ea3='Triggers';return db['UserProfileSection'][_0x528d('0x4f')]({'where':{'name':_0x9e3ea3,'userProfileId':_0x331d28[_0x528d('0x50')]},'raw':!![]})[_0x528d('0x26')](function(_0x3a1795){if(_0x3a1795&&_0x3a1795[_0x528d('0x51')]===0x0){return db[_0x528d('0x2a')][_0x528d('0x4b')]({'name':_0xee4520[_0x528d('0x2c')],'resourceId':_0xee4520['id'],'type':_0x3a1795[_0x528d('0x2c')],'sectionId':_0x3a1795['id']},{})[_0x528d('0x26')](function(){return _0x4e4859;});}else{return _0x4e4859;}})[_0x528d('0x45')](function(_0x2727b0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2727b0);throw _0x2727b0;});}return _0x4e4859;})[_0x528d('0x26')](respondWithResult(_0x1924cb,0xc9))[_0x528d('0x45')](handleError(_0x1924cb,null));};exports['update']=function(_0x1f5b79,_0x14ef2f){if(_0x1f5b79['body']['id']){delete _0x1f5b79[_0x528d('0x4c')]['id'];}return db[_0x528d('0x2f')][_0x528d('0x4f')]({'where':{'id':_0x1f5b79[_0x528d('0x47')]['id']}})[_0x528d('0x26')](handleEntityNotFound(_0x14ef2f,null))[_0x528d('0x26')](saveUpdates(_0x1f5b79[_0x528d('0x4c')],null))[_0x528d('0x26')](respondWithResult(_0x14ef2f,null))['catch'](handleError(_0x14ef2f,null));};exports[_0x528d('0x27')]=function(_0x235f35,_0x22c8ec){return db[_0x528d('0x2f')][_0x528d('0x4f')]({'where':{'id':_0x235f35[_0x528d('0x47')]['id']}})['then'](handleEntityNotFound(_0x22c8ec,null))[_0x528d('0x26')](removeEntity(_0x22c8ec,null))[_0x528d('0x45')](handleError(_0x22c8ec,null));};exports['addAllCondition']=function(_0x448d0f,_0x3aa463,_0x2facc0){if(_0x448d0f[_0x528d('0x4c')]['id']){delete _0x448d0f[_0x528d('0x4c')]['id'];}return db['Trigger'][_0x528d('0x4f')]({'where':{'id':_0x448d0f[_0x528d('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa463,null))[_0x528d('0x26')](function(_0x3a06f9){if(_0x3a06f9){_0x448d0f['body'][_0x528d('0x52')]=_0x3a06f9['id'];return db[_0x528d('0x53')][_0x528d('0x4b')](_0x448d0f[_0x528d('0x4c')]);}})[_0x528d('0x26')](respondWithResult(_0x3aa463,null))[_0x528d('0x45')](handleError(_0x3aa463,null));};exports[_0x528d('0x54')]=function(_0x97724b,_0x3550b2,_0x293b55){if(_0x97724b[_0x528d('0x4c')]['id']){delete _0x97724b['body']['id'];}return db[_0x528d('0x2f')][_0x528d('0x4f')]({'where':{'id':_0x97724b[_0x528d('0x47')]['id']}})[_0x528d('0x26')](handleEntityNotFound(_0x3550b2,null))[_0x528d('0x26')](function(_0x407af5){if(_0x407af5){_0x97724b[_0x528d('0x4c')][_0x528d('0x55')]=_0x407af5['id'];return db[_0x528d('0x53')]['create'](_0x97724b['body']);}})[_0x528d('0x26')](respondWithResult(_0x3550b2,null))[_0x528d('0x45')](handleError(_0x3550b2,null));};exports[_0x528d('0x56')]=function(_0x522a63,_0x2a8f75,_0x118884){var _0xaf129c={};var _0x50c1cb={};var _0x3f556c;var _0x2effb9;return db[_0x528d('0x2f')]['findOne']({'where':{'id':_0x522a63['params']['id']}})['then'](handleEntityNotFound(_0x2a8f75,null))['then'](function(_0x4b80c5){if(_0x4b80c5){_0x3f556c=_0x4b80c5;_0x50c1cb['model']=_[_0x528d('0x48')](db[_0x528d('0x53')]['rawAttributes']);_0x50c1cb[_0x528d('0x37')]=_[_0x528d('0x48')](_0x522a63[_0x528d('0x37')]);_0x50c1cb[_0x528d('0x33')]=_[_0x528d('0x34')](_0x50c1cb[_0x528d('0x32')],_0x50c1cb[_0x528d('0x37')]);_0xaf129c[_0x528d('0x35')]=_[_0x528d('0x34')](_0x50c1cb[_0x528d('0x32')],qs[_0x528d('0x36')](_0x522a63[_0x528d('0x37')][_0x528d('0x36')]));_0xaf129c[_0x528d('0x35')]=_0xaf129c[_0x528d('0x35')][_0x528d('0x38')]?_0xaf129c[_0x528d('0x35')]:_0x50c1cb[_0x528d('0x32')];_0xaf129c[_0x528d('0x57')]=qs[_0x528d('0x3b')](_0x522a63[_0x528d('0x37')][_0x528d('0x3b')]);_0xaf129c['where']=qs['filters'](_[_0x528d('0x3d')](_0x522a63['query'],_0x50c1cb['filters']));if(_0x522a63[_0x528d('0x37')]['filter']){_0xaf129c['where']=_[_0x528d('0x41')](_0xaf129c[_0x528d('0x3c')],{'$or':_[_0x528d('0x2e')](_0xaf129c[_0x528d('0x35')],function(_0x1625a2){var _0x559040={};_0x559040[_0x1625a2]={'$like':'%'+_0x522a63['query'][_0x528d('0x3e')]+'%'};return _0x559040;})});}_0xaf129c=_[_0x528d('0x41')]({},_0xaf129c,_0x522a63[_0x528d('0x4a')]);return _0x3f556c[_0x528d('0x56')](_0xaf129c);}})[_0x528d('0x26')](function(_0x3c6f2f){if(_0x3c6f2f){_0x2effb9=_0x3c6f2f[_0x528d('0x38')];if(!_0x522a63[_0x528d('0x37')][_0x528d('0x39')](_0x528d('0x3a'))){_0xaf129c[_0x528d('0x21')]=qs[_0x528d('0x21')](_0x522a63['query']['limit']);_0xaf129c[_0x528d('0x1e')]=qs[_0x528d('0x1e')](_0x522a63['query'][_0x528d('0x1e')]);}return _0x3f556c[_0x528d('0x56')](_0xaf129c);}})[_0x528d('0x26')](function(_0x1a8dbd){if(_0x1a8dbd){return _0x1a8dbd?{'count':_0x2effb9,'rows':_0x1a8dbd}:null;}})[_0x528d('0x26')](respondWithResult(_0x2a8f75,null))[_0x528d('0x45')](handleError(_0x2a8f75,null));};exports[_0x528d('0x58')]=function(_0x509059,_0x3349aa,_0x2c3ebb){var _0x15bed1={};var _0x260c78={};var _0x5b8672;var _0x3587c4;return db[_0x528d('0x2f')][_0x528d('0x59')]({'where':{'id':_0x509059[_0x528d('0x47')]['id']}})[_0x528d('0x26')](handleEntityNotFound(_0x3349aa,null))['then'](function(_0x1db967){if(_0x1db967){_0x5b8672=_0x1db967;_0x260c78[_0x528d('0x32')]=_[_0x528d('0x48')](db[_0x528d('0x53')]['rawAttributes']);_0x260c78[_0x528d('0x37')]=_[_0x528d('0x48')](_0x509059[_0x528d('0x37')]);_0x260c78['filters']=_[_0x528d('0x34')](_0x260c78[_0x528d('0x32')],_0x260c78[_0x528d('0x37')]);_0x15bed1[_0x528d('0x35')]=_[_0x528d('0x34')](_0x260c78[_0x528d('0x32')],qs[_0x528d('0x36')](_0x509059[_0x528d('0x37')][_0x528d('0x36')]));_0x15bed1[_0x528d('0x35')]=_0x15bed1[_0x528d('0x35')][_0x528d('0x38')]?_0x15bed1[_0x528d('0x35')]:_0x260c78[_0x528d('0x32')];_0x15bed1[_0x528d('0x57')]=qs[_0x528d('0x3b')](_0x509059[_0x528d('0x37')][_0x528d('0x3b')]);_0x15bed1[_0x528d('0x3c')]=qs['filters'](_[_0x528d('0x3d')](_0x509059[_0x528d('0x37')],_0x260c78[_0x528d('0x33')]));if(_0x509059[_0x528d('0x37')][_0x528d('0x3e')]){_0x15bed1['where']=_[_0x528d('0x41')](_0x15bed1[_0x528d('0x3c')],{'$or':_['map'](_0x15bed1[_0x528d('0x35')],function(_0x263bf3){var _0x4be506={};_0x4be506[_0x263bf3]={'$like':'%'+_0x509059[_0x528d('0x37')][_0x528d('0x3e')]+'%'};return _0x4be506;})});}_0x15bed1=_[_0x528d('0x41')]({},_0x15bed1,_0x509059['options']);return _0x5b8672[_0x528d('0x58')](_0x15bed1);}})[_0x528d('0x26')](function(_0x534f38){if(_0x534f38){_0x3587c4=_0x534f38[_0x528d('0x38')];if(!_0x509059[_0x528d('0x37')][_0x528d('0x39')](_0x528d('0x3a'))){_0x15bed1[_0x528d('0x21')]=qs[_0x528d('0x21')](_0x509059[_0x528d('0x37')][_0x528d('0x21')]);_0x15bed1[_0x528d('0x1e')]=qs[_0x528d('0x1e')](_0x509059[_0x528d('0x37')][_0x528d('0x1e')]);}return _0x5b8672[_0x528d('0x58')](_0x15bed1);}})['then'](function(_0x47847a){if(_0x47847a){return _0x47847a?{'count':_0x3587c4,'rows':_0x47847a}:null;}})[_0x528d('0x26')](respondWithResult(_0x3349aa,null))['catch'](handleError(_0x3349aa,null));};exports[_0x528d('0x5a')]=function(_0x53f498,_0x5a80c7,_0x550214){if(_0x53f498[_0x528d('0x4c')]['id']){delete _0x53f498['body']['id'];}return db['Trigger'][_0x528d('0x4f')]({'where':{'id':_0x53f498[_0x528d('0x47')]['id']}})[_0x528d('0x26')](handleEntityNotFound(_0x5a80c7,null))[_0x528d('0x26')](function(_0x3e2468){if(_0x3e2468){_0x53f498[_0x528d('0x4c')][_0x528d('0x5b')]=_0x3e2468['id'];return db[_0x528d('0x5c')][_0x528d('0x4b')](_0x53f498[_0x528d('0x4c')]);}})[_0x528d('0x26')](respondWithResult(_0x5a80c7,null))[_0x528d('0x45')](handleError(_0x5a80c7,null));};exports[_0x528d('0x5d')]=function(_0xd8d711,_0x3c8276,_0x17ea3b){var _0x3fc8dc={};var _0x246fdb={};var _0x1269b5;var _0x540983;return db['Trigger']['findOne']({'where':{'id':_0xd8d711[_0x528d('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c8276,null))[_0x528d('0x26')](function(_0x249e15){if(_0x249e15){_0x1269b5=_0x249e15;_0x246fdb['model']=_['keys'](db[_0x528d('0x5c')][_0x528d('0x30')]);_0x246fdb[_0x528d('0x37')]=_['keys'](_0xd8d711['query']);_0x246fdb[_0x528d('0x33')]=_['intersection'](_0x246fdb[_0x528d('0x32')],_0x246fdb[_0x528d('0x37')]);_0x3fc8dc[_0x528d('0x35')]=_[_0x528d('0x34')](_0x246fdb[_0x528d('0x32')],qs['fields'](_0xd8d711['query'][_0x528d('0x36')]));_0x3fc8dc[_0x528d('0x35')]=_0x3fc8dc[_0x528d('0x35')][_0x528d('0x38')]?_0x3fc8dc[_0x528d('0x35')]:_0x246fdb['model'];_0x3fc8dc['order']=qs[_0x528d('0x3b')](_0xd8d711[_0x528d('0x37')]['sort']);_0x3fc8dc[_0x528d('0x3c')]=qs[_0x528d('0x33')](_[_0x528d('0x3d')](_0xd8d711[_0x528d('0x37')],_0x246fdb[_0x528d('0x33')]));if(_0xd8d711[_0x528d('0x37')][_0x528d('0x3e')]){_0x3fc8dc[_0x528d('0x3c')]=_[_0x528d('0x41')](_0x3fc8dc[_0x528d('0x3c')],{'$or':_[_0x528d('0x2e')](_0x3fc8dc[_0x528d('0x35')],function(_0x5b8296){var _0x3fc7f4={};_0x3fc7f4[_0x5b8296]={'$like':'%'+_0xd8d711['query']['filter']+'%'};return _0x3fc7f4;})});}_0x3fc8dc=_[_0x528d('0x41')]({},_0x3fc8dc,_0xd8d711[_0x528d('0x4a')]);return _0x1269b5[_0x528d('0x5d')](_0x3fc8dc);}})[_0x528d('0x26')](function(_0xbda164){if(_0xbda164){_0x540983=_0xbda164[_0x528d('0x38')];if(!_0xd8d711['query']['hasOwnProperty'](_0x528d('0x3a'))){_0x3fc8dc[_0x528d('0x21')]=qs[_0x528d('0x21')](_0xd8d711[_0x528d('0x37')][_0x528d('0x21')]);_0x3fc8dc[_0x528d('0x1e')]=qs['offset'](_0xd8d711[_0x528d('0x37')][_0x528d('0x1e')]);}return _0x1269b5[_0x528d('0x5d')](_0x3fc8dc);}})['then'](function(_0x153fe6){if(_0x153fe6){return _0x153fe6?{'count':_0x540983,'rows':_0x153fe6}:null;}})[_0x528d('0x26')](respondWithResult(_0x3c8276,null))[_0x528d('0x45')](handleError(_0x3c8276,null));}; \ No newline at end of file +var _0x6537=['fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Trigger','includeAll','include','findAll','rows','catch','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','TriggerAnyId','order','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','destroy','get','Triggers','UserProfileResource','then','end','error','stack','name','send','map','rawAttributes'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x6537,0x87));var _0x7653=function(_0x401004,_0x5061d5){_0x401004=_0x401004-0x0;var _0x228719=_0x6537[_0x401004];return _0x228719;};'use strict';var emlformat=require(_0x7653('0x0'));var rimraf=require(_0x7653('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7653('0x2'));var rp=require(_0x7653('0x3'));var moment=require(_0x7653('0x4'));var BPromise=require(_0x7653('0x5'));var Mustache=require(_0x7653('0x6'));var util=require(_0x7653('0x7'));var path=require(_0x7653('0x8'));var sox=require(_0x7653('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7653('0xa'));var _=require(_0x7653('0xb'));var squel=require(_0x7653('0xc'));var crypto=require('crypto');var jsforce=require(_0x7653('0xd'));var deskjs=require(_0x7653('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7653('0xf'));var Papa=require(_0x7653('0x10'));var Redis=require(_0x7653('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7653('0x12'));var as=require(_0x7653('0x13'));var hardwareService=require(_0x7653('0x14'));var logger=require(_0x7653('0x15'))(_0x7653('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x257f73,_0x2559e5){_0x2559e5=_0x2559e5||0xcc;return function(_0x3f43ae){if(_0x3f43ae){return _0x257f73[_0x7653('0x17')](_0x2559e5);}return _0x257f73['status'](_0x2559e5)['end']();};}function respondWithResult(_0x2fbcf1,_0x509edb){_0x509edb=_0x509edb||0xc8;return function(_0x310cf1){if(_0x310cf1){return _0x2fbcf1[_0x7653('0x18')](_0x509edb)[_0x7653('0x19')](_0x310cf1);}};}function respondWithFilteredResult(_0x23db69,_0x409f7c){return function(_0x32e35e){if(_0x32e35e){var _0x200ba7=typeof _0x409f7c[_0x7653('0x1a')]==='undefined'&&typeof _0x409f7c[_0x7653('0x1b')]===_0x7653('0x1c');var _0x7fe3de=_0x32e35e['count'];var _0x2ae953=_0x200ba7?0x0:_0x409f7c['offset'];var _0x9de27=_0x200ba7?_0x32e35e['count']:_0x409f7c[_0x7653('0x1a')]+_0x409f7c[_0x7653('0x1b')];var _0x5f1bec;if(_0x9de27>=_0x7fe3de){_0x9de27=_0x7fe3de;_0x5f1bec=0xc8;}else{_0x5f1bec=0xce;}_0x23db69['status'](_0x5f1bec);return _0x23db69[_0x7653('0x1d')](_0x7653('0x1e'),_0x2ae953+'-'+_0x9de27+'/'+_0x7fe3de)[_0x7653('0x19')](_0x32e35e);}return null;};}function patchUpdates(_0x337909){return function(_0x465f4d){try{jsonpatch[_0x7653('0x1f')](_0x465f4d,_0x337909,!![]);}catch(_0x38f964){return BPromise[_0x7653('0x20')](_0x38f964);}return _0x465f4d[_0x7653('0x21')]();};}function saveUpdates(_0x3b976b,_0x50f684){return function(_0x3d18f7){if(_0x3d18f7){return _0x3d18f7[_0x7653('0x22')](_0x3b976b)['then'](function(_0x45d498){return _0x45d498;});}return null;};}function removeEntity(_0x266df9,_0x46d323){return function(_0x291a4f){if(_0x291a4f){return _0x291a4f[_0x7653('0x23')]()['then'](function(){var _0x1f8771=_0x291a4f[_0x7653('0x24')]({'plain':!![]});var _0x27c840=_0x7653('0x25');return db[_0x7653('0x26')][_0x7653('0x23')]({'where':{'type':_0x27c840,'resourceId':_0x1f8771['id']}})[_0x7653('0x27')](function(){return _0x291a4f;});})[_0x7653('0x27')](function(){_0x266df9[_0x7653('0x18')](0xcc)[_0x7653('0x28')]();});}};}function handleEntityNotFound(_0xf718f,_0x2dae7f){return function(_0x3a64d6){if(!_0x3a64d6){_0xf718f[_0x7653('0x17')](0x194);}return _0x3a64d6;};}function handleError(_0xc16391,_0x4b81c3){_0x4b81c3=_0x4b81c3||0x1f4;return function(_0x672fb2){logger[_0x7653('0x29')](_0x672fb2[_0x7653('0x2a')]);if(_0x672fb2[_0x7653('0x2b')]){delete _0x672fb2['name'];}_0xc16391[_0x7653('0x18')](_0x4b81c3)[_0x7653('0x2c')](_0x672fb2);};}exports['index']=function(_0x83009c,_0x3b5ea5){var _0x482d41={},_0x4ed060={},_0x387bf4={'count':0x0,'rows':[]};var _0x1a9b63=_[_0x7653('0x2d')](db['Trigger'][_0x7653('0x2e')],function(_0x11173b){return{'name':_0x11173b[_0x7653('0x2f')],'type':_0x11173b[_0x7653('0x30')]['key']};});_0x4ed060[_0x7653('0x31')]=_[_0x7653('0x2d')](_0x1a9b63,_0x7653('0x2b'));_0x4ed060[_0x7653('0x32')]=_['keys'](_0x83009c[_0x7653('0x32')]);_0x4ed060[_0x7653('0x33')]=_[_0x7653('0x34')](_0x4ed060['model'],_0x4ed060[_0x7653('0x32')]);_0x482d41[_0x7653('0x35')]=_['intersection'](_0x4ed060[_0x7653('0x31')],qs['fields'](_0x83009c[_0x7653('0x32')][_0x7653('0x36')]));_0x482d41[_0x7653('0x35')]=_0x482d41['attributes'][_0x7653('0x37')]?_0x482d41[_0x7653('0x35')]:_0x4ed060[_0x7653('0x31')];if(!_0x83009c[_0x7653('0x32')][_0x7653('0x38')](_0x7653('0x39'))){_0x482d41[_0x7653('0x1b')]=qs['limit'](_0x83009c[_0x7653('0x32')][_0x7653('0x1b')]);_0x482d41['offset']=qs[_0x7653('0x1a')](_0x83009c[_0x7653('0x32')]['offset']);}_0x482d41['order']=qs[_0x7653('0x3a')](_0x83009c[_0x7653('0x32')][_0x7653('0x3a')]);_0x482d41[_0x7653('0x3b')]=qs[_0x7653('0x33')](_[_0x7653('0x3c')](_0x83009c['query'],_0x4ed060['filters']),_0x1a9b63);if(_0x83009c[_0x7653('0x32')][_0x7653('0x3d')]){_0x482d41[_0x7653('0x3b')]=_['merge'](_0x482d41[_0x7653('0x3b')],{'$or':_[_0x7653('0x2d')](_0x1a9b63,function(_0x44324a){if(_0x44324a['type']!==_0x7653('0x3e')){var _0x3d5a7d={};_0x3d5a7d[_0x44324a['name']]={'$like':'%'+_0x83009c[_0x7653('0x32')][_0x7653('0x3d')]+'%'};return _0x3d5a7d;}})});}_0x482d41=_[_0x7653('0x3f')]({},_0x482d41,_0x83009c[_0x7653('0x40')]);var _0x29c110={'where':_0x482d41[_0x7653('0x3b')]};return db[_0x7653('0x41')]['count'](_0x29c110)[_0x7653('0x27')](function(_0x4b0bd4){_0x387bf4['count']=_0x4b0bd4;if(_0x83009c[_0x7653('0x32')][_0x7653('0x42')]){_0x482d41[_0x7653('0x43')]=[{'all':!![]}];}return db[_0x7653('0x41')][_0x7653('0x44')](_0x482d41);})[_0x7653('0x27')](function(_0x143efe){_0x387bf4[_0x7653('0x45')]=_0x143efe;return _0x387bf4;})[_0x7653('0x27')](respondWithFilteredResult(_0x3b5ea5,_0x482d41))[_0x7653('0x46')](handleError(_0x3b5ea5,null));};exports['show']=function(_0x231f9d,_0x3e012e){var _0x182b7d={'raw':![],'where':{'id':_0x231f9d[_0x7653('0x47')]['id']}},_0x23a39f={};_0x23a39f[_0x7653('0x31')]=_[_0x7653('0x48')](db['Trigger']['rawAttributes']);_0x23a39f['query']=_[_0x7653('0x48')](_0x231f9d[_0x7653('0x32')]);_0x23a39f[_0x7653('0x33')]=_[_0x7653('0x34')](_0x23a39f[_0x7653('0x31')],_0x23a39f[_0x7653('0x32')]);_0x182b7d[_0x7653('0x35')]=_[_0x7653('0x34')](_0x23a39f[_0x7653('0x31')],qs['fields'](_0x231f9d['query'][_0x7653('0x36')]));_0x182b7d['attributes']=_0x182b7d[_0x7653('0x35')][_0x7653('0x37')]?_0x182b7d[_0x7653('0x35')]:_0x23a39f['model'];if(_0x231f9d[_0x7653('0x32')][_0x7653('0x42')]){_0x182b7d[_0x7653('0x43')]=[{'all':!![]}];}_0x182b7d=_['merge']({},_0x182b7d,_0x231f9d['options']);return db[_0x7653('0x41')]['find'](_0x182b7d)[_0x7653('0x27')](handleEntityNotFound(_0x3e012e,null))[_0x7653('0x27')](respondWithResult(_0x3e012e,null))['catch'](handleError(_0x3e012e,null));};exports[_0x7653('0x49')]=function(_0x280ea0,_0x538bb8){return db[_0x7653('0x41')][_0x7653('0x49')](_0x280ea0[_0x7653('0x4a')],{})[_0x7653('0x27')](function(_0x36da0e){var _0x304a22=_0x280ea0['user']['get']({'plain':!![]});if(!_0x304a22)throw new Error(_0x7653('0x4b'));if(_0x304a22[_0x7653('0x4c')]==='user'){var _0x225f76=_0x36da0e[_0x7653('0x24')]({'plain':!![]});var _0x342808=_0x7653('0x25');return db['UserProfileSection'][_0x7653('0x4d')]({'where':{'name':_0x342808,'userProfileId':_0x304a22[_0x7653('0x4e')]},'raw':!![]})[_0x7653('0x27')](function(_0x1efd86){if(_0x1efd86&&_0x1efd86[_0x7653('0x4f')]===0x0){return db[_0x7653('0x26')][_0x7653('0x49')]({'name':_0x225f76[_0x7653('0x2b')],'resourceId':_0x225f76['id'],'type':_0x1efd86[_0x7653('0x2b')],'sectionId':_0x1efd86['id']},{})[_0x7653('0x27')](function(){return _0x36da0e;});}else{return _0x36da0e;}})['catch'](function(_0x5260d8){logger[_0x7653('0x29')](_0x7653('0x50'),_0x5260d8);throw _0x5260d8;});}return _0x36da0e;})[_0x7653('0x27')](respondWithResult(_0x538bb8,0xc9))[_0x7653('0x46')](handleError(_0x538bb8,null));};exports[_0x7653('0x22')]=function(_0x1b0882,_0x460f08){if(_0x1b0882[_0x7653('0x4a')]['id']){delete _0x1b0882[_0x7653('0x4a')]['id'];}return db[_0x7653('0x41')]['find']({'where':{'id':_0x1b0882[_0x7653('0x47')]['id']}})['then'](handleEntityNotFound(_0x460f08,null))['then'](saveUpdates(_0x1b0882['body'],null))[_0x7653('0x27')](respondWithResult(_0x460f08,null))[_0x7653('0x46')](handleError(_0x460f08,null));};exports[_0x7653('0x23')]=function(_0x34c503,_0x5cb4df){return db['Trigger']['find']({'where':{'id':_0x34c503['params']['id']}})[_0x7653('0x27')](handleEntityNotFound(_0x5cb4df,null))['then'](removeEntity(_0x5cb4df,null))[_0x7653('0x46')](handleError(_0x5cb4df,null));};exports[_0x7653('0x51')]=function(_0x2f3ef7,_0x20897c,_0x23b1af){if(_0x2f3ef7[_0x7653('0x4a')]['id']){delete _0x2f3ef7[_0x7653('0x4a')]['id'];}return db['Trigger'][_0x7653('0x4d')]({'where':{'id':_0x2f3ef7[_0x7653('0x47')]['id']}})[_0x7653('0x27')](handleEntityNotFound(_0x20897c,null))[_0x7653('0x27')](function(_0x2c3f05){if(_0x2c3f05){_0x2f3ef7[_0x7653('0x4a')]['TriggerAllId']=_0x2c3f05['id'];return db[_0x7653('0x52')][_0x7653('0x49')](_0x2f3ef7['body']);}})[_0x7653('0x27')](respondWithResult(_0x20897c,null))[_0x7653('0x46')](handleError(_0x20897c,null));};exports['addAnyCondition']=function(_0x40a19c,_0x44e994,_0xe79f99){if(_0x40a19c['body']['id']){delete _0x40a19c['body']['id'];}return db['Trigger'][_0x7653('0x4d')]({'where':{'id':_0x40a19c[_0x7653('0x47')]['id']}})[_0x7653('0x27')](handleEntityNotFound(_0x44e994,null))[_0x7653('0x27')](function(_0x533969){if(_0x533969){_0x40a19c[_0x7653('0x4a')][_0x7653('0x53')]=_0x533969['id'];return db[_0x7653('0x52')][_0x7653('0x49')](_0x40a19c[_0x7653('0x4a')]);}})[_0x7653('0x27')](respondWithResult(_0x44e994,null))[_0x7653('0x46')](handleError(_0x44e994,null));};exports['getAllConditions']=function(_0x55cd52,_0x47c8af,_0xf0d7a4){var _0x4ff06c={};var _0x59d54e={};var _0x263643;var _0x169bcb;return db[_0x7653('0x41')]['findOne']({'where':{'id':_0x55cd52['params']['id']}})[_0x7653('0x27')](handleEntityNotFound(_0x47c8af,null))['then'](function(_0x17c7cb){if(_0x17c7cb){_0x263643=_0x17c7cb;_0x59d54e['model']=_[_0x7653('0x48')](db[_0x7653('0x52')][_0x7653('0x2e')]);_0x59d54e[_0x7653('0x32')]=_['keys'](_0x55cd52[_0x7653('0x32')]);_0x59d54e[_0x7653('0x33')]=_[_0x7653('0x34')](_0x59d54e['model'],_0x59d54e[_0x7653('0x32')]);_0x4ff06c['attributes']=_[_0x7653('0x34')](_0x59d54e['model'],qs[_0x7653('0x36')](_0x55cd52[_0x7653('0x32')][_0x7653('0x36')]));_0x4ff06c[_0x7653('0x35')]=_0x4ff06c[_0x7653('0x35')][_0x7653('0x37')]?_0x4ff06c['attributes']:_0x59d54e[_0x7653('0x31')];_0x4ff06c[_0x7653('0x54')]=qs[_0x7653('0x3a')](_0x55cd52['query'][_0x7653('0x3a')]);_0x4ff06c['where']=qs[_0x7653('0x33')](_['pick'](_0x55cd52['query'],_0x59d54e[_0x7653('0x33')]));if(_0x55cd52['query'][_0x7653('0x3d')]){_0x4ff06c[_0x7653('0x3b')]=_[_0x7653('0x3f')](_0x4ff06c[_0x7653('0x3b')],{'$or':_[_0x7653('0x2d')](_0x4ff06c[_0x7653('0x35')],function(_0x396b7c){var _0xf20cbd={};_0xf20cbd[_0x396b7c]={'$like':'%'+_0x55cd52[_0x7653('0x32')]['filter']+'%'};return _0xf20cbd;})});}_0x4ff06c=_[_0x7653('0x3f')]({},_0x4ff06c,_0x55cd52[_0x7653('0x40')]);return _0x263643[_0x7653('0x55')](_0x4ff06c);}})['then'](function(_0x518811){if(_0x518811){_0x169bcb=_0x518811[_0x7653('0x37')];if(!_0x55cd52[_0x7653('0x32')][_0x7653('0x38')](_0x7653('0x39'))){_0x4ff06c[_0x7653('0x1b')]=qs[_0x7653('0x1b')](_0x55cd52[_0x7653('0x32')][_0x7653('0x1b')]);_0x4ff06c[_0x7653('0x1a')]=qs[_0x7653('0x1a')](_0x55cd52[_0x7653('0x32')][_0x7653('0x1a')]);}return _0x263643[_0x7653('0x55')](_0x4ff06c);}})[_0x7653('0x27')](function(_0x5d7549){if(_0x5d7549){return _0x5d7549?{'count':_0x169bcb,'rows':_0x5d7549}:null;}})[_0x7653('0x27')](respondWithResult(_0x47c8af,null))[_0x7653('0x46')](handleError(_0x47c8af,null));};exports['getAnyConditions']=function(_0x1c450,_0x324877,_0x147242){var _0x56e18f={};var _0x47804a={};var _0x1a395c;var _0x54aa88;return db[_0x7653('0x41')][_0x7653('0x56')]({'where':{'id':_0x1c450[_0x7653('0x47')]['id']}})['then'](handleEntityNotFound(_0x324877,null))[_0x7653('0x27')](function(_0x5a5257){if(_0x5a5257){_0x1a395c=_0x5a5257;_0x47804a[_0x7653('0x31')]=_[_0x7653('0x48')](db[_0x7653('0x52')][_0x7653('0x2e')]);_0x47804a[_0x7653('0x32')]=_[_0x7653('0x48')](_0x1c450[_0x7653('0x32')]);_0x47804a[_0x7653('0x33')]=_[_0x7653('0x34')](_0x47804a['model'],_0x47804a[_0x7653('0x32')]);_0x56e18f[_0x7653('0x35')]=_[_0x7653('0x34')](_0x47804a['model'],qs[_0x7653('0x36')](_0x1c450[_0x7653('0x32')]['fields']));_0x56e18f['attributes']=_0x56e18f['attributes'][_0x7653('0x37')]?_0x56e18f[_0x7653('0x35')]:_0x47804a[_0x7653('0x31')];_0x56e18f['order']=qs['sort'](_0x1c450[_0x7653('0x32')][_0x7653('0x3a')]);_0x56e18f['where']=qs['filters'](_[_0x7653('0x3c')](_0x1c450[_0x7653('0x32')],_0x47804a['filters']));if(_0x1c450[_0x7653('0x32')][_0x7653('0x3d')]){_0x56e18f['where']=_['merge'](_0x56e18f[_0x7653('0x3b')],{'$or':_[_0x7653('0x2d')](_0x56e18f[_0x7653('0x35')],function(_0x121f0f){var _0x4ac0da={};_0x4ac0da[_0x121f0f]={'$like':'%'+_0x1c450['query'][_0x7653('0x3d')]+'%'};return _0x4ac0da;})});}_0x56e18f=_['merge']({},_0x56e18f,_0x1c450[_0x7653('0x40')]);return _0x1a395c['getAnyConditions'](_0x56e18f);}})[_0x7653('0x27')](function(_0x238ecb){if(_0x238ecb){_0x54aa88=_0x238ecb['length'];if(!_0x1c450[_0x7653('0x32')][_0x7653('0x38')](_0x7653('0x39'))){_0x56e18f[_0x7653('0x1b')]=qs[_0x7653('0x1b')](_0x1c450[_0x7653('0x32')][_0x7653('0x1b')]);_0x56e18f[_0x7653('0x1a')]=qs[_0x7653('0x1a')](_0x1c450[_0x7653('0x32')][_0x7653('0x1a')]);}return _0x1a395c[_0x7653('0x57')](_0x56e18f);}})[_0x7653('0x27')](function(_0x53fe64){if(_0x53fe64){return _0x53fe64?{'count':_0x54aa88,'rows':_0x53fe64}:null;}})['then'](respondWithResult(_0x324877,null))[_0x7653('0x46')](handleError(_0x324877,null));};exports[_0x7653('0x58')]=function(_0x448edc,_0x154dbd,_0x5e8355){if(_0x448edc['body']['id']){delete _0x448edc[_0x7653('0x4a')]['id'];}return db[_0x7653('0x41')][_0x7653('0x4d')]({'where':{'id':_0x448edc[_0x7653('0x47')]['id']}})[_0x7653('0x27')](handleEntityNotFound(_0x154dbd,null))['then'](function(_0x40ebc7){if(_0x40ebc7){_0x448edc[_0x7653('0x4a')]['TriggerId']=_0x40ebc7['id'];return db[_0x7653('0x59')][_0x7653('0x49')](_0x448edc[_0x7653('0x4a')]);}})['then'](respondWithResult(_0x154dbd,null))['catch'](handleError(_0x154dbd,null));};exports[_0x7653('0x5a')]=function(_0x29a2fb,_0x11d00a,_0x337037){var _0x1ccaf3={};var _0x212150={};var _0x8bf5de;var _0xb2d199;return db['Trigger']['findOne']({'where':{'id':_0x29a2fb[_0x7653('0x47')]['id']}})['then'](handleEntityNotFound(_0x11d00a,null))[_0x7653('0x27')](function(_0x341fb8){if(_0x341fb8){_0x8bf5de=_0x341fb8;_0x212150[_0x7653('0x31')]=_[_0x7653('0x48')](db[_0x7653('0x59')]['rawAttributes']);_0x212150['query']=_[_0x7653('0x48')](_0x29a2fb[_0x7653('0x32')]);_0x212150['filters']=_[_0x7653('0x34')](_0x212150[_0x7653('0x31')],_0x212150[_0x7653('0x32')]);_0x1ccaf3[_0x7653('0x35')]=_[_0x7653('0x34')](_0x212150[_0x7653('0x31')],qs[_0x7653('0x36')](_0x29a2fb[_0x7653('0x32')]['fields']));_0x1ccaf3[_0x7653('0x35')]=_0x1ccaf3['attributes'][_0x7653('0x37')]?_0x1ccaf3[_0x7653('0x35')]:_0x212150[_0x7653('0x31')];_0x1ccaf3[_0x7653('0x54')]=qs[_0x7653('0x3a')](_0x29a2fb[_0x7653('0x32')]['sort']);_0x1ccaf3['where']=qs[_0x7653('0x33')](_[_0x7653('0x3c')](_0x29a2fb[_0x7653('0x32')],_0x212150['filters']));if(_0x29a2fb[_0x7653('0x32')][_0x7653('0x3d')]){_0x1ccaf3[_0x7653('0x3b')]=_[_0x7653('0x3f')](_0x1ccaf3[_0x7653('0x3b')],{'$or':_[_0x7653('0x2d')](_0x1ccaf3['attributes'],function(_0x271fcc){var _0x57b327={};_0x57b327[_0x271fcc]={'$like':'%'+_0x29a2fb[_0x7653('0x32')][_0x7653('0x3d')]+'%'};return _0x57b327;})});}_0x1ccaf3=_[_0x7653('0x3f')]({},_0x1ccaf3,_0x29a2fb[_0x7653('0x40')]);return _0x8bf5de['getActions'](_0x1ccaf3);}})['then'](function(_0x13e8d6){if(_0x13e8d6){_0xb2d199=_0x13e8d6[_0x7653('0x37')];if(!_0x29a2fb['query'][_0x7653('0x38')](_0x7653('0x39'))){_0x1ccaf3[_0x7653('0x1b')]=qs[_0x7653('0x1b')](_0x29a2fb[_0x7653('0x32')][_0x7653('0x1b')]);_0x1ccaf3[_0x7653('0x1a')]=qs[_0x7653('0x1a')](_0x29a2fb[_0x7653('0x32')][_0x7653('0x1a')]);}return _0x8bf5de[_0x7653('0x5a')](_0x1ccaf3);}})['then'](function(_0x2f93b4){if(_0x2f93b4){return _0x2f93b4?{'count':_0xb2d199,'rows':_0x2f93b4}:null;}})['then'](respondWithResult(_0x11d00a,null))[_0x7653('0x46')](handleError(_0x11d00a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 187f1c1..9c98033 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 _0xc576=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./trigger.attributes','define','Trigger'];(function(_0x41bab8,_0x2469cf){var _0x541174=function(_0x5da0b4){while(--_0x5da0b4){_0x41bab8['push'](_0x41bab8['shift']());}};_0x541174(++_0x2469cf);}(_0xc576,0x1ea));var _0x6c57=function(_0x289874,_0x1b6752){_0x289874=_0x289874-0x0;var _0x2f8bbb=_0xc576[_0x289874];return _0x2f8bbb;};'use strict';var _=require(_0x6c57('0x0'));var util=require(_0x6c57('0x1'));var logger=require(_0x6c57('0x2'))(_0x6c57('0x3'));var moment=require(_0x6c57('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c57('0x5'));var rimraf=require('rimraf');var config=require(_0x6c57('0x6'));var attributes=require(_0x6c57('0x7'));module['exports']=function(_0xa6e0c4,_0x5e81a6){return _0xa6e0c4[_0x6c57('0x8')](_0x6c57('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x255f=['../../config/environment','./trigger.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2709cf,_0x3f0472){var _0x3afeca=function(_0x4057c1){while(--_0x4057c1){_0x2709cf['push'](_0x2709cf['shift']());}};_0x3afeca(++_0x3f0472);}(_0x255f,0x185));var _0xf255=function(_0x33c310,_0x9647a4){_0x33c310=_0x33c310-0x0;var _0x54a097=_0x255f[_0x33c310];return _0x54a097;};'use strict';var _=require(_0xf255('0x0'));var util=require('util');var logger=require(_0xf255('0x1'))(_0xf255('0x2'));var moment=require(_0xf255('0x3'));var BPromise=require('bluebird');var rp=require(_0xf255('0x4'));var fs=require('fs');var path=require(_0xf255('0x5'));var rimraf=require(_0xf255('0x6'));var config=require(_0xf255('0x7'));var attributes=require(_0xf255('0x8'));module[_0xf255('0x9')]=function(_0xc1d19f,_0x5bbed0){return _0xc1d19f[_0xf255('0xa')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 0d32552..b29b585 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 _0xe9f2=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','Trigger,\x20%s,\x20%s','message','info','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','stringify','ShowTrigger','find','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9f2,0xfb));var _0x2e9f=function(_0x2eca2a,_0x17d4c1){_0x2eca2a=_0x2eca2a-0x0;var _0x2e87d5=_0xe9f2[_0x2eca2a];return _0x2e87d5;};'use strict';var _=require('lodash');var util=require(_0x2e9f('0x0'));var moment=require(_0x2e9f('0x1'));var BPromise=require(_0x2e9f('0x2'));var rs=require(_0x2e9f('0x3'));var fs=require('fs');var Redis=require(_0x2e9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e9f('0x5'));var logger=require(_0x2e9f('0x6'))(_0x2e9f('0x7'));var config=require(_0x2e9f('0x8'));var jayson=require(_0x2e9f('0x9'));var client=jayson[_0x2e9f('0xa')][_0x2e9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e63c5,_0x117352,_0xbddda5){return new BPromise(function(_0x27ddab,_0x5d5696){return client[_0x2e9f('0xc')](_0x3e63c5,_0xbddda5)['then'](function(_0x3fdd80){logger['info']('Trigger,\x20%s,\x20%s',_0x117352,_0x2e9f('0xd'));logger[_0x2e9f('0xe')](_0x2e9f('0xf'),_0x117352,_0x2e9f('0xd'),JSON['stringify'](_0x3fdd80));if(_0x3fdd80[_0x2e9f('0x10')]){if(_0x3fdd80['error']['code']===0x1f4){logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x117352,_0x3fdd80[_0x2e9f('0x10')][_0x2e9f('0x12')]);return _0x5d5696(_0x3fdd80[_0x2e9f('0x10')][_0x2e9f('0x12')]);}logger['error'](_0x2e9f('0x11'),_0x117352,_0x3fdd80[_0x2e9f('0x10')][_0x2e9f('0x12')]);return _0x27ddab(_0x3fdd80['error']['message']);}else{logger[_0x2e9f('0x13')](_0x2e9f('0x11'),_0x117352,_0x2e9f('0xd'));_0x27ddab(_0x3fdd80['result'][_0x2e9f('0x12')]);}})[_0x2e9f('0x14')](function(_0x4826ea){logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x117352,_0x4826ea);_0x5d5696(_0x4826ea);});});}exports['GetTrigger']=function(_0x4aa3c6){var _0x204bdd=this;return new Promise(function(_0x175bec,_0x13fb4c){return db[_0x2e9f('0x15')][_0x2e9f('0x16')]({'raw':_0x4aa3c6[_0x2e9f('0x17')]?_0x4aa3c6[_0x2e9f('0x17')][_0x2e9f('0x18')]===undefined?!![]:![]:!![],'where':_0x4aa3c6['options']?_0x4aa3c6[_0x2e9f('0x17')][_0x2e9f('0x19')]||null:null,'attributes':_0x4aa3c6[_0x2e9f('0x17')]?_0x4aa3c6['options'][_0x2e9f('0x1a')]||null:null,'limit':_0x4aa3c6[_0x2e9f('0x17')]?_0x4aa3c6['options'][_0x2e9f('0x1b')]||null:null,'include':_0x4aa3c6[_0x2e9f('0x17')]?_0x4aa3c6['options'][_0x2e9f('0x1c')]?_[_0x2e9f('0x1d')](_0x4aa3c6['options'][_0x2e9f('0x1c')],function(_0x1db94f){return{'model':db[_0x1db94f[_0x2e9f('0x1e')]],'as':_0x1db94f['as'],'attributes':_0x1db94f[_0x2e9f('0x1a')],'include':_0x1db94f[_0x2e9f('0x1c')]?_[_0x2e9f('0x1d')](_0x1db94f[_0x2e9f('0x1c')],function(_0x38199c){return{'model':db[_0x38199c[_0x2e9f('0x1e')]],'as':_0x38199c['as'],'attributes':_0x38199c[_0x2e9f('0x1a')],'include':_0x38199c[_0x2e9f('0x1c')]?_[_0x2e9f('0x1d')](_0x38199c[_0x2e9f('0x1c')],function(_0x1c41bc){return{'model':db[_0x1c41bc['model']],'as':_0x1c41bc['as'],'attributes':_0x1c41bc[_0x2e9f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2e9f('0x1f')](function(_0x215d32){logger['info'](_0x2e9f('0x20'),_0x4aa3c6);logger[_0x2e9f('0xe')]('GetTrigger',_0x4aa3c6,JSON[_0x2e9f('0x21')](_0x215d32));_0x175bec(_0x215d32);})[_0x2e9f('0x14')](function(_0x43f763){logger['error'](_0x2e9f('0x20'),_0x43f763['message'],_0x4aa3c6);_0x13fb4c(_0x204bdd['error'](0x1f4,_0x43f763['message']));});});};exports[_0x2e9f('0x22')]=function(_0x1dbaf7){var _0x3c5b0e=this;return new Promise(function(_0x49e7d8,_0x4c70b1){return db[_0x2e9f('0x15')][_0x2e9f('0x23')]({'raw':_0x1dbaf7[_0x2e9f('0x17')]?_0x1dbaf7['options'][_0x2e9f('0x18')]===undefined?!![]:![]:!![],'where':_0x1dbaf7[_0x2e9f('0x17')]?_0x1dbaf7[_0x2e9f('0x17')][_0x2e9f('0x19')]||null:null,'attributes':_0x1dbaf7['options']?_0x1dbaf7[_0x2e9f('0x17')][_0x2e9f('0x1a')]||null:null,'include':_0x1dbaf7[_0x2e9f('0x17')]?_0x1dbaf7[_0x2e9f('0x17')]['include']?_['map'](_0x1dbaf7[_0x2e9f('0x17')]['include'],function(_0x15fe7b){return{'model':db[_0x15fe7b['model']],'as':_0x15fe7b['as'],'attributes':_0x15fe7b[_0x2e9f('0x1a')],'include':_0x15fe7b['include']?_[_0x2e9f('0x1d')](_0x15fe7b['include'],function(_0x2f0e83){return{'model':db[_0x2f0e83[_0x2e9f('0x1e')]],'as':_0x2f0e83['as'],'attributes':_0x2f0e83[_0x2e9f('0x1a')],'include':_0x2f0e83[_0x2e9f('0x1c')]?_[_0x2e9f('0x1d')](_0x2f0e83['include'],function(_0x5670af){return{'model':db[_0x5670af[_0x2e9f('0x1e')]],'as':_0x5670af['as'],'attributes':_0x5670af['attributes']};}):[]};}):[]};}):[]:[]})[_0x2e9f('0x1f')](function(_0x4bd5ab){logger[_0x2e9f('0x13')]('ShowTrigger',_0x1dbaf7);logger[_0x2e9f('0xe')](_0x2e9f('0x22'),_0x1dbaf7,JSON[_0x2e9f('0x21')](_0x4bd5ab));_0x49e7d8(_0x4bd5ab);})[_0x2e9f('0x14')](function(_0x48f8d1){logger['error'](_0x2e9f('0x22'),_0x48f8d1[_0x2e9f('0x12')],_0x1dbaf7);_0x4c70b1(_0x3c5b0e[_0x2e9f('0x10')](0x1f4,_0x48f8d1[_0x2e9f('0x12')]));});});}; \ No newline at end of file +var _0x15dc=['GetTrigger','catch','ShowTrigger','find','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','stringify','code','error','Trigger,\x20%s,\x20%s','message','info','Trigger','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x25f265,_0xfac482){var _0x451499=function(_0x2a7d5a){while(--_0x2a7d5a){_0x25f265['push'](_0x25f265['shift']());}};_0x451499(++_0xfac482);}(_0x15dc,0x91));var _0xc15d=function(_0x5bd072,_0x3f02d6){_0x5bd072=_0x5bd072-0x0;var _0x17c868=_0x15dc[_0x5bd072];return _0x17c868;};'use strict';var _=require('lodash');var util=require(_0xc15d('0x0'));var moment=require(_0xc15d('0x1'));var BPromise=require(_0xc15d('0x2'));var rs=require(_0xc15d('0x3'));var fs=require('fs');var Redis=require(_0xc15d('0x4'));var db=require(_0xc15d('0x5'))['db'];var utils=require(_0xc15d('0x6'));var logger=require('../../config/logger')(_0xc15d('0x7'));var config=require(_0xc15d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc15d('0x9')][_0xc15d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8bbb5d,_0x249019,_0x204f7e){return new BPromise(function(_0x19386e,_0x298dae){return client[_0xc15d('0xb')](_0x8bbb5d,_0x204f7e)[_0xc15d('0xc')](function(_0x543c4b){logger['info']('Trigger,\x20%s,\x20%s',_0x249019,_0xc15d('0xd'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x249019,_0xc15d('0xd'),JSON[_0xc15d('0xe')](_0x543c4b));if(_0x543c4b['error']){if(_0x543c4b['error'][_0xc15d('0xf')]===0x1f4){logger[_0xc15d('0x10')](_0xc15d('0x11'),_0x249019,_0x543c4b[_0xc15d('0x10')][_0xc15d('0x12')]);return _0x298dae(_0x543c4b[_0xc15d('0x10')][_0xc15d('0x12')]);}logger['error'](_0xc15d('0x11'),_0x249019,_0x543c4b['error']['message']);return _0x19386e(_0x543c4b[_0xc15d('0x10')][_0xc15d('0x12')]);}else{logger[_0xc15d('0x13')](_0xc15d('0x11'),_0x249019,_0xc15d('0xd'));_0x19386e(_0x543c4b['result']['message']);}})['catch'](function(_0x54f901){logger['error'](_0xc15d('0x11'),_0x249019,_0x54f901);_0x298dae(_0x54f901);});});}exports['GetTrigger']=function(_0x2af02f){var _0x35a4c5=this;return new Promise(function(_0x2daa7e,_0x7fce90){return db[_0xc15d('0x14')][_0xc15d('0x15')]({'raw':_0x2af02f[_0xc15d('0x16')]?_0x2af02f[_0xc15d('0x16')][_0xc15d('0x17')]===undefined?!![]:![]:!![],'where':_0x2af02f[_0xc15d('0x16')]?_0x2af02f[_0xc15d('0x16')][_0xc15d('0x18')]||null:null,'attributes':_0x2af02f[_0xc15d('0x16')]?_0x2af02f['options'][_0xc15d('0x19')]||null:null,'limit':_0x2af02f[_0xc15d('0x16')]?_0x2af02f[_0xc15d('0x16')][_0xc15d('0x1a')]||null:null,'include':_0x2af02f[_0xc15d('0x16')]?_0x2af02f[_0xc15d('0x16')][_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x2af02f[_0xc15d('0x16')]['include'],function(_0x49b34c){return{'model':db[_0x49b34c['model']],'as':_0x49b34c['as'],'attributes':_0x49b34c[_0xc15d('0x19')],'include':_0x49b34c[_0xc15d('0x1b')]?_['map'](_0x49b34c[_0xc15d('0x1b')],function(_0x4f18ad){return{'model':db[_0x4f18ad['model']],'as':_0x4f18ad['as'],'attributes':_0x4f18ad['attributes'],'include':_0x4f18ad['include']?_[_0xc15d('0x1c')](_0x4f18ad[_0xc15d('0x1b')],function(_0x31592a){return{'model':db[_0x31592a[_0xc15d('0x1d')]],'as':_0x31592a['as'],'attributes':_0x31592a[_0xc15d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d0edb){logger[_0xc15d('0x13')](_0xc15d('0x1e'),_0x2af02f);logger['debug'](_0xc15d('0x1e'),_0x2af02f,JSON[_0xc15d('0xe')](_0x4d0edb));_0x2daa7e(_0x4d0edb);})[_0xc15d('0x1f')](function(_0x4c99be){logger[_0xc15d('0x10')](_0xc15d('0x1e'),_0x4c99be['message'],_0x2af02f);_0x7fce90(_0x35a4c5[_0xc15d('0x10')](0x1f4,_0x4c99be[_0xc15d('0x12')]));});});};exports[_0xc15d('0x20')]=function(_0x2319da){var _0x20b1f6=this;return new Promise(function(_0xc08b5b,_0x535e2d){return db[_0xc15d('0x14')][_0xc15d('0x21')]({'raw':_0x2319da['options']?_0x2319da['options'][_0xc15d('0x17')]===undefined?!![]:![]:!![],'where':_0x2319da[_0xc15d('0x16')]?_0x2319da[_0xc15d('0x16')][_0xc15d('0x18')]||null:null,'attributes':_0x2319da['options']?_0x2319da[_0xc15d('0x16')][_0xc15d('0x19')]||null:null,'include':_0x2319da['options']?_0x2319da[_0xc15d('0x16')][_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x2319da[_0xc15d('0x16')][_0xc15d('0x1b')],function(_0x1fb6f2){return{'model':db[_0x1fb6f2[_0xc15d('0x1d')]],'as':_0x1fb6f2['as'],'attributes':_0x1fb6f2[_0xc15d('0x19')],'include':_0x1fb6f2[_0xc15d('0x1b')]?_['map'](_0x1fb6f2[_0xc15d('0x1b')],function(_0x229c3e){return{'model':db[_0x229c3e[_0xc15d('0x1d')]],'as':_0x229c3e['as'],'attributes':_0x229c3e[_0xc15d('0x19')],'include':_0x229c3e[_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x229c3e['include'],function(_0xc1309){return{'model':db[_0xc1309['model']],'as':_0xc1309['as'],'attributes':_0xc1309[_0xc15d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc15d('0xc')](function(_0x45a7e7){logger[_0xc15d('0x13')]('ShowTrigger',_0x2319da);logger[_0xc15d('0x22')](_0xc15d('0x20'),_0x2319da,JSON[_0xc15d('0xe')](_0x45a7e7));_0xc08b5b(_0x45a7e7);})[_0xc15d('0x1f')](function(_0x852fb4){logger[_0xc15d('0x10')](_0xc15d('0x20'),_0x852fb4['message'],_0x2319da);_0x535e2d(_0x20b1f6['error'](0x1f4,_0x852fb4['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 6910126..6252eab 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 _0xc3b3=['index','/:id','isAuthenticated','/:id/clone','clone','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get'];(function(_0x7b9b5f,_0x46917d){var _0x1fcdf7=function(_0x3b79a2){while(--_0x3b79a2){_0x7b9b5f['push'](_0x7b9b5f['shift']());}};_0x1fcdf7(++_0x46917d);}(_0xc3b3,0x1b0));var _0x3c3b=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xc3b3[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x3c3b('0x0'));var util=require(_0x3c3b('0x1'));var path=require('path');var timeout=require(_0x3c3b('0x2'));var express=require(_0x3c3b('0x3'));var router=express['Router']();var fs_extra=require(_0x3c3b('0x4'));var auth=require(_0x3c3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3c3b('0x6'));var controller=require(_0x3c3b('0x7'));router[_0x3c3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x3c3b('0x9')]);router[_0x3c3b('0x8')](_0x3c3b('0xa'),auth[_0x3c3b('0xb')](),controller['show']);router['post'](_0x3c3b('0xc'),auth[_0x3c3b('0xb')](),controller[_0x3c3b('0xd')]);router[_0x3c3b('0xe')]('/',auth[_0x3c3b('0xb')](),controller[_0x3c3b('0xf')]);router[_0x3c3b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3c3b('0x11')]);router[_0x3c3b('0x12')](_0x3c3b('0xa'),auth[_0x3c3b('0xb')](),controller[_0x3c3b('0x13')]);module[_0x3c3b('0x14')]=router; \ No newline at end of file +var _0x765a=['clone','create','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone'];(function(_0x2db983,_0x48f63d){var _0x368dda=function(_0x5c6b05){while(--_0x5c6b05){_0x2db983['push'](_0x2db983['shift']());}};_0x368dda(++_0x48f63d);}(_0x765a,0x1bf));var _0xa765=function(_0xde0155,_0x197649){_0xde0155=_0xde0155-0x0;var _0x41f706=_0x765a[_0xde0155];return _0x41f706;};'use strict';var multer=require(_0xa765('0x0'));var util=require(_0xa765('0x1'));var path=require('path');var timeout=require(_0xa765('0x2'));var express=require(_0xa765('0x3'));var router=express[_0xa765('0x4')]();var fs_extra=require(_0xa765('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa765('0x6'));var config=require(_0xa765('0x7'));var controller=require(_0xa765('0x8'));router[_0xa765('0x9')]('/',auth[_0xa765('0xa')](),controller[_0xa765('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa765('0xc')]);router[_0xa765('0xd')](_0xa765('0xe'),auth[_0xa765('0xa')](),controller[_0xa765('0xf')]);router[_0xa765('0xd')]('/',auth['isAuthenticated'](),controller[_0xa765('0x10')]);router[_0xa765('0x11')](_0xa765('0x12'),auth[_0xa765('0xa')](),controller[_0xa765('0x13')]);router['delete'](_0xa765('0x12'),auth[_0xa765('0xa')](),controller[_0xa765('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 22bce51..7be2e31 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 _0xf96f=['outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','nonat','BOOLEAN','sequelize','STRING','name','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0xf96f,0xad));var _0xff96=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf96f[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xff96('0x0'));module['exports']={'name':{'type':Sequelize[_0xff96('0x1')],'allowNull':![],'unique':_0xff96('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0xff96('0x3'),_0xff96('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xff96('0x1')],'allowNull':![],'defaultValue':_0xff96('0x5')},'callingpres':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x7'),_0xff96('0x8'),_0xff96('0x9'),_0xff96('0xa'),_0xff96('0xb'),'PROHIB_PASSED_SCREEN',_0xff96('0xc'),_0xff96('0xd'))},'deny':{'type':Sequelize[_0xff96('0x1')]},'permit':{'type':Sequelize[_0xff96('0x1')]},'secret':{'type':Sequelize[_0xff96('0x1')]},'md5secret':{'type':Sequelize[_0xff96('0x1')]},'remotesecret':{'type':Sequelize[_0xff96('0x1')]},'transport':{'type':Sequelize[_0xff96('0x1')],'defaultValue':'udp','set':function(_0x435bc3){this['setDataValue'](_0xff96('0xe'),_0x435bc3?_0x435bc3[_0xff96('0xf')](','):null);},'get':function(){return this[_0xff96('0x10')](_0xff96('0xe'))?this[_0xff96('0x10')](_0xff96('0xe'))[_0xff96('0x11')](','):null;},'comment':_0xff96('0x12')},'dtmfmode':{'type':Sequelize[_0xff96('0x6')]('rfc2833',_0xff96('0x13'),_0xff96('0x14'),_0xff96('0x15'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no','nonat','update',_0xff96('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xff96('0x1')]},'directmediadeny':{'type':Sequelize[_0xff96('0x1')]},'nat':{'type':Sequelize[_0xff96('0x1')],'defaultValue':_0xff96('0x18'),'set':function(_0x2329b0){this['setDataValue'](_0xff96('0x19'),_0x2329b0?_0x2329b0[_0xff96('0xf')](','):null);},'get':function(){return this[_0xff96('0x10')]('nat')?this[_0xff96('0x10')]('nat')[_0xff96('0x11')](','):null;},'comment':_0xff96('0x1a')},'callgroup':{'type':Sequelize[_0xff96('0x1')]},'namedcallgroup':{'type':Sequelize[_0xff96('0x1')]},'pickupgroup':{'type':Sequelize[_0xff96('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xff96('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xff96('0x1b')},'allow':{'type':Sequelize[_0xff96('0x1')],'allowNull':![],'defaultValue':_0xff96('0x1c'),'set':function(_0x7143a8){this[_0xff96('0x1d')](_0xff96('0x1e'),_0x7143a8?_0x7143a8[_0xff96('0xf')](';'):_0xff96('0x1c'));},'get':function(){return this['getDataValue']('allow')?this[_0xff96('0x10')](_0xff96('0x1e'))[_0xff96('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xff96('0x1f'),'set':function(_0x5a6da2){this[_0xff96('0x1d')](_0xff96('0x20'),_0x5a6da2?_0x5a6da2[_0xff96('0xf')](','):null);},'get':function(){return this[_0xff96('0x10')](_0xff96('0x20'))?this['getDataValue']('insecure')[_0xff96('0x11')](','):null;},'comment':_0xff96('0x21')},'trustrpid':{'type':Sequelize[_0xff96('0x6')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xff96('0x6')]('yes','no',_0xff96('0x22'))},'promiscredir':{'type':Sequelize[_0xff96('0x6')]('yes','no')},'useclientcode':{'type':Sequelize[_0xff96('0x6')]('yes','no')},'accountcode':{'type':Sequelize[_0xff96('0x23')](0xb)},'setvar':{'type':Sequelize[_0xff96('0x1')]},'callerid':{'type':Sequelize[_0xff96('0x1')],'defaultValue':_0xff96('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xff96('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xff96('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xff96('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no',_0xff96('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xff96('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'mailbox':{'type':Sequelize[_0xff96('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0xff96('0x26'),_0xff96('0x27'),_0xff96('0x28'))},'session_expires':{'type':Sequelize[_0xff96('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xff96('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x29'),_0xff96('0x2a')),'defaultValue':_0xff96('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xff96('0x1')]},'fromdomain':{'type':Sequelize[_0xff96('0x1')]},'fromuser':{'type':Sequelize[_0xff96('0x1')]},'port':{'type':Sequelize[_0xff96('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xff96('0x16'),'no'),'defaultValue':_0xff96('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xff96('0x1')]},'defaultuser':{'type':Sequelize[_0xff96('0x1')]},'rtptimeout':{'type':Sequelize[_0xff96('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xff96('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xff96('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xff96('0x1')]},'callbackextension':{'type':Sequelize[_0xff96('0x1')]},'timert1':{'type':Sequelize[_0xff96('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xff96('0x1')]},'contactdeny':{'type':Sequelize[_0xff96('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xff96('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xff96('0x23')](0xb)},'encryption':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'force_avp':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'icesupport':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xff96('0x16'),'no',_0xff96('0x2b'),_0xff96('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xff96('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xff96('0x1')]},'dtlscafile':{'type':Sequelize[_0xff96('0x1')]},'dtlscapath':{'type':Sequelize[_0xff96('0x1')]},'dtlssetup':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x2d'),'passive',_0xff96('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xff96('0x1')]},'recordofffeature':{'type':Sequelize[_0xff96('0x1')]},'call_limit':{'type':Sequelize[_0xff96('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xff96('0x6')](_0xff96('0x16'),'no')},'vmexten':{'type':Sequelize[_0xff96('0x1')]},'mohinterpret':{'type':Sequelize[_0xff96('0x1')]},'mohsuggest':{'type':Sequelize[_0xff96('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xff96('0x1')]},'host':{'type':Sequelize[_0xff96('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0xff96('0x16'),'no',_0xff96('0x2f'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xff96('0x1')]},'otherFields':{'type':Sequelize[_0xff96('0x1')]},'active':{'type':Sequelize[_0xff96('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xff96('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xab93=['update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','allow','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','BOOLEAN','sequelize','name','ENUM','friend','STRING','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','nonat'];(function(_0x4d7634,_0x23ac0f){var _0x56e536=function(_0x207294){while(--_0x207294){_0x4d7634['push'](_0x4d7634['shift']());}};_0x56e536(++_0x23ac0f);}(_0xab93,0x1a3));var _0x3ab9=function(_0x4bd7aa,_0xf33452){_0x4bd7aa=_0x4bd7aa-0x0;var _0x2bea8a=_0xab93[_0x4bd7aa];return _0x2bea8a;};'use strict';var Sequelize=require(_0x3ab9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3ab9('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x3'),'user','peer'),'allowNull':![],'defaultValue':_0x3ab9('0x3')},'context':{'type':Sequelize[_0x3ab9('0x4')],'allowNull':![],'defaultValue':_0x3ab9('0x5')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x3ab9('0x6'),_0x3ab9('0x7'),'ALLOWED',_0x3ab9('0x8'),'PROHIB_PASSED_SCREEN',_0x3ab9('0x9'),_0x3ab9('0xa'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x3ab9('0x4')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x3ab9('0x4')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':_0x3ab9('0xb'),'set':function(_0x582f49){this['setDataValue'](_0x3ab9('0xc'),_0x582f49?_0x582f49[_0x3ab9('0xd')](','):null);},'get':function(){return this['getDataValue'](_0x3ab9('0xc'))?this[_0x3ab9('0xe')](_0x3ab9('0xc'))[_0x3ab9('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x3ab9('0x10'),_0x3ab9('0x11'),_0x3ab9('0x12'),_0x3ab9('0x13'),_0x3ab9('0x14')),'defaultValue':_0x3ab9('0x10')},'directmedia':{'type':Sequelize[_0x3ab9('0x2')]('yes','no',_0x3ab9('0x15'),_0x3ab9('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3ab9('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3ab9('0x4')]},'directmediadeny':{'type':Sequelize[_0x3ab9('0x4')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x535b16){this['setDataValue']('nat',_0x535b16?_0x535b16[_0x3ab9('0xd')](','):null);},'get':function(){return this[_0x3ab9('0xe')](_0x3ab9('0x17'))?this[_0x3ab9('0xe')]('nat')[_0x3ab9('0xf')](','):null;},'comment':_0x3ab9('0x18')},'callgroup':{'type':Sequelize[_0x3ab9('0x4')]},'namedcallgroup':{'type':Sequelize[_0x3ab9('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x3ab9('0x4')]},'language':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3ab9('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':_0x3ab9('0x19')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3ab9('0x1a'),'set':function(_0x4ffa9c){this[_0x3ab9('0x1b')](_0x3ab9('0x1c'),_0x4ffa9c?_0x4ffa9c[_0x3ab9('0xd')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x3ab9('0x1c'))?this[_0x3ab9('0xe')](_0x3ab9('0x1c'))[_0x3ab9('0xf')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'insecure':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':'port,invite','set':function(_0x5dfd78){this['setDataValue'](_0x3ab9('0x1e'),_0x5dfd78?_0x5dfd78[_0x3ab9('0xd')](','):null);},'get':function(){return this[_0x3ab9('0xe')](_0x3ab9('0x1e'))?this['getDataValue']('insecure')[_0x3ab9('0xf')](','):null;},'comment':_0x3ab9('0x1f')},'trustrpid':{'type':Sequelize[_0x3ab9('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no',_0x3ab9('0x20'))},'promiscredir':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'useclientcode':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'accountcode':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'setvar':{'type':Sequelize[_0x3ab9('0x4')]},'callerid':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':_0x3ab9('0x22')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no'),'defaultValue':_0x3ab9('0x1d')},'busylevel':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'allowsubscribe':{'type':Sequelize[_0x3ab9('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3ab9('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x3ab9('0x4')]},'videosupport':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no',_0x3ab9('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'mailbox':{'type':Sequelize[_0x3ab9('0x4')]},'session_timers':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x24'),_0x3ab9('0x25'),_0x3ab9('0x26'))},'session_expires':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x27'),_0x3ab9('0x28')),'defaultValue':_0x3ab9('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x3ab9('0x4')]},'regexten':{'type':Sequelize[_0x3ab9('0x4')]},'fromdomain':{'type':Sequelize[_0x3ab9('0x4')]},'fromuser':{'type':Sequelize[_0x3ab9('0x4')]},'port':{'type':Sequelize[_0x3ab9('0x21')](0x5)},'qualify':{'type':Sequelize[_0x3ab9('0x2')]('yes','no'),'defaultValue':_0x3ab9('0x1d')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x3ab9('0x4')]},'defaultuser':{'type':Sequelize[_0x3ab9('0x4')]},'rtptimeout':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no',_0x3ab9('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3ab9('0x4')]},'callbackextension':{'type':Sequelize[_0x3ab9('0x4')]},'timert1':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'timerb':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x3ab9('0x4')]},'contactdeny':{'type':Sequelize[_0x3ab9('0x4')]},'contactacl':{'type':Sequelize[_0x3ab9('0x4')]},'unsolicited_mailbox':{'type':Sequelize[_0x3ab9('0x4')]},'use_q850_reason':{'type':Sequelize[_0x3ab9('0x4')]},'maxforwards':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'encryption':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3ab9('0x1d'),'no')},'force_avp':{'type':Sequelize[_0x3ab9('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'dtlsenable':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'dtlsverify':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no',_0x3ab9('0x2a'),_0x3ab9('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x3ab9('0x4')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x3ab9('0x4')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3ab9('0x2c'),_0x3ab9('0x2d'),_0x3ab9('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3ab9('0x4')]},'usereqphone':{'type':Sequelize[_0x3ab9('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'subscribemwi':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'vmexten':{'type':Sequelize[_0x3ab9('0x4')]},'mohinterpret':{'type':Sequelize[_0x3ab9('0x4')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x3ab9('0x4')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x3ab9('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x3ab9('0x1d'),'no',_0x3ab9('0x15'),_0x3ab9('0x16'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3ab9('0x4')]},'otherFields':{'type':Sequelize[_0x3ab9('0x4')]},'active':{'type':Sequelize[_0x3ab9('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 04214d4..0e5f635 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 _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x24ae15,_0x52794c){var _0x75035=function(_0x2c0e1e){while(--_0x2c0e1e){_0x24ae15['push'](_0x24ae15['shift']());}};_0x75035(++_0x52794c);}(_0x98a8,0x12c));var _0x898a=function(_0x266279,_0x1f2391){_0x266279=_0x266279-0x0;var _0x115bb0=_0x98a8[_0x266279];return _0x115bb0;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file +var _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0x4b84[_0x333798];return _0x389f4e;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 201f1f7..7b9f0f3 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 _0xeb91=['rimraf','../../config/environment','exports','define','tools_trunks','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x508a80,_0x16f1e6){var _0x44d5e2=function(_0x507887){while(--_0x507887){_0x508a80['push'](_0x508a80['shift']());}};_0x44d5e2(++_0x16f1e6);}(_0xeb91,0x7e));var _0x1eb9=function(_0x246119,_0x30a4f3){_0x246119=_0x246119-0x0;var _0x59c74f=_0xeb91[_0x246119];return _0x59c74f;};'use strict';var _=require(_0x1eb9('0x0'));var util=require(_0x1eb9('0x1'));var logger=require(_0x1eb9('0x2'))(_0x1eb9('0x3'));var moment=require('moment');var BPromise=require(_0x1eb9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1eb9('0x5'));var rimraf=require(_0x1eb9('0x6'));var config=require(_0x1eb9('0x7'));var attributes=require('./trunk.attributes');module[_0x1eb9('0x8')]=function(_0x2c75ca,_0xeb2bf3){return _0x2c75ca[_0x1eb9('0x9')]('Trunk',attributes,{'tableName':_0x1eb9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcca0=['define','Trunk','tools_trunks','lodash','../../config/logger','api','request-promise','../../config/environment','exports'];(function(_0x1d83db,_0x89d115){var _0x2dc1d1=function(_0x13fdc3){while(--_0x13fdc3){_0x1d83db['push'](_0x1d83db['shift']());}};_0x2dc1d1(++_0x89d115);}(_0xcca0,0xf6));var _0x0cca=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xcca0[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x0cca('0x0'));var util=require('util');var logger=require(_0x0cca('0x1'))(_0x0cca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0cca('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0cca('0x4'));var attributes=require('./trunk.attributes');module[_0x0cca('0x5')]=function(_0x449db7,_0x407329){return _0x449db7[_0x0cca('0x6')](_0x0cca('0x7'),attributes,{'tableName':_0x0cca('0x8'),'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 476b3f1..f05bf0b 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 _0xda08=['code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','Trunk','lodash','moment','bluebird','../../config/logger','rpc','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0xda08,0x185));var _0x8da0=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xda08[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x8da0('0x0'));var util=require('util');var moment=require(_0x8da0('0x1'));var BPromise=require(_0x8da0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8da0('0x3'))(_0x8da0('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8da0('0x5')][_0x8da0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5e9a75,_0x272fcc,_0x576b0c){return new BPromise(function(_0x3eafdf,_0x1c80b2){return client[_0x8da0('0x7')](_0x5e9a75,_0x576b0c)[_0x8da0('0x8')](function(_0x4bfaed){logger['info']('Trunk,\x20%s,\x20%s',_0x272fcc,_0x8da0('0x9'));logger[_0x8da0('0xa')](_0x8da0('0xb'),_0x272fcc,_0x8da0('0x9'),JSON[_0x8da0('0xc')](_0x4bfaed));if(_0x4bfaed[_0x8da0('0xd')]){if(_0x4bfaed[_0x8da0('0xd')][_0x8da0('0xe')]===0x1f4){logger[_0x8da0('0xd')](_0x8da0('0xf'),_0x272fcc,_0x4bfaed['error'][_0x8da0('0x10')]);return _0x1c80b2(_0x4bfaed['error'][_0x8da0('0x10')]);}logger[_0x8da0('0xd')](_0x8da0('0xf'),_0x272fcc,_0x4bfaed[_0x8da0('0xd')]['message']);return _0x3eafdf(_0x4bfaed[_0x8da0('0xd')][_0x8da0('0x10')]);}else{logger[_0x8da0('0x11')](_0x8da0('0xf'),_0x272fcc,_0x8da0('0x9'));_0x3eafdf(_0x4bfaed[_0x8da0('0x12')]['message']);}})[_0x8da0('0x13')](function(_0x1065e6){logger['error'](_0x8da0('0xf'),_0x272fcc,_0x1065e6);_0x1c80b2(_0x1065e6);});});}exports[_0x8da0('0x14')]=function(_0x5eb98c){var _0x4e4740=this;return new Promise(function(_0x3e916e,_0x257b4e){return db['Trunk'][_0x8da0('0x15')]({'raw':_0x5eb98c[_0x8da0('0x16')]?_0x5eb98c[_0x8da0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5eb98c[_0x8da0('0x16')]?_0x5eb98c[_0x8da0('0x16')][_0x8da0('0x17')]||null:null,'attributes':_0x5eb98c[_0x8da0('0x16')]?_0x5eb98c['options'][_0x8da0('0x18')]||null:null,'limit':_0x5eb98c[_0x8da0('0x16')]?_0x5eb98c[_0x8da0('0x16')][_0x8da0('0x19')]||null:null,'include':_0x5eb98c[_0x8da0('0x16')]?_0x5eb98c['options'][_0x8da0('0x1a')]?_[_0x8da0('0x1b')](_0x5eb98c[_0x8da0('0x16')][_0x8da0('0x1a')],function(_0x140548){return{'model':db[_0x140548['model']],'as':_0x140548['as'],'attributes':_0x140548['attributes'],'include':_0x140548[_0x8da0('0x1a')]?_['map'](_0x140548['include'],function(_0x34f2ee){return{'model':db[_0x34f2ee[_0x8da0('0x1c')]],'as':_0x34f2ee['as'],'attributes':_0x34f2ee[_0x8da0('0x18')],'include':_0x34f2ee[_0x8da0('0x1a')]?_[_0x8da0('0x1b')](_0x34f2ee['include'],function(_0x4450b0){return{'model':db[_0x4450b0[_0x8da0('0x1c')]],'as':_0x4450b0['as'],'attributes':_0x4450b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8da0('0x8')](function(_0xb9cb01){logger[_0x8da0('0x11')](_0x8da0('0x14'),_0x5eb98c);logger['debug'](_0x8da0('0x14'),_0x5eb98c,JSON[_0x8da0('0xc')](_0xb9cb01));_0x3e916e(_0xb9cb01);})[_0x8da0('0x13')](function(_0x3a75ee){logger[_0x8da0('0xd')]('GetTrunk',_0x3a75ee[_0x8da0('0x10')],_0x5eb98c);_0x257b4e(_0x4e4740['error'](0x1f4,_0x3a75ee[_0x8da0('0x10')]));});});};exports[_0x8da0('0x1d')]=function(_0x30716c){var _0x42656a=this;return new Promise(function(_0x3551b2,_0x3877ad){return db[_0x8da0('0x1e')]['find']({'raw':_0x30716c['options']?_0x30716c[_0x8da0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x30716c[_0x8da0('0x16')]?_0x30716c[_0x8da0('0x16')][_0x8da0('0x17')]||null:null,'attributes':_0x30716c['options']?_0x30716c['options']['attributes']||null:null,'include':_0x30716c[_0x8da0('0x16')]?_0x30716c[_0x8da0('0x16')][_0x8da0('0x1a')]?_[_0x8da0('0x1b')](_0x30716c[_0x8da0('0x16')]['include'],function(_0x29e452){return{'model':db[_0x29e452[_0x8da0('0x1c')]],'as':_0x29e452['as'],'attributes':_0x29e452[_0x8da0('0x18')],'include':_0x29e452[_0x8da0('0x1a')]?_['map'](_0x29e452[_0x8da0('0x1a')],function(_0x479e69){return{'model':db[_0x479e69['model']],'as':_0x479e69['as'],'attributes':_0x479e69[_0x8da0('0x18')],'include':_0x479e69['include']?_['map'](_0x479e69[_0x8da0('0x1a')],function(_0x2f9a6e){return{'model':db[_0x2f9a6e['model']],'as':_0x2f9a6e['as'],'attributes':_0x2f9a6e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3170ac){logger[_0x8da0('0x11')](_0x8da0('0x1d'),_0x30716c);logger[_0x8da0('0xa')]('ShowTrunk',_0x30716c,JSON[_0x8da0('0xc')](_0x3170ac));_0x3551b2(_0x3170ac);})['catch'](function(_0x64cde3){logger['error']('ShowTrunk',_0x64cde3[_0x8da0('0x10')],_0x30716c);_0x3877ad(_0x42656a[_0x8da0('0xd')](0x1f4,_0x64cde3[_0x8da0('0x10')]));});});}; \ No newline at end of file +var _0x026b=['model','stringify','find','map','ShowTrunk','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include'];(function(_0xb6790e,_0x38fbe3){var _0x3b1955=function(_0x43155e){while(--_0x43155e){_0xb6790e['push'](_0xb6790e['shift']());}};_0x3b1955(++_0x38fbe3);}(_0x026b,0x192));var _0xb026=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x026b[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xb026('0x0'));var util=require(_0xb026('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb026('0x2'));var fs=require('fs');var Redis=require(_0xb026('0x3'));var db=require(_0xb026('0x4'))['db'];var utils=require(_0xb026('0x5'));var logger=require(_0xb026('0x6'))(_0xb026('0x7'));var config=require(_0xb026('0x8'));var jayson=require(_0xb026('0x9'));var client=jayson[_0xb026('0xa')][_0xb026('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53caed,_0x559b88,_0x32bdd6){return new BPromise(function(_0x477f20,_0x26f6a5){return client[_0xb026('0xc')](_0x53caed,_0x32bdd6)[_0xb026('0xd')](function(_0x5ba938){logger['info'](_0xb026('0xe'),_0x559b88,'request\x20sent');logger[_0xb026('0xf')](_0xb026('0x10'),_0x559b88,'request\x20sent',JSON['stringify'](_0x5ba938));if(_0x5ba938[_0xb026('0x11')]){if(_0x5ba938[_0xb026('0x11')]['code']===0x1f4){logger[_0xb026('0x11')](_0xb026('0xe'),_0x559b88,_0x5ba938['error'][_0xb026('0x12')]);return _0x26f6a5(_0x5ba938[_0xb026('0x11')]['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x559b88,_0x5ba938[_0xb026('0x11')][_0xb026('0x12')]);return _0x477f20(_0x5ba938[_0xb026('0x11')][_0xb026('0x12')]);}else{logger[_0xb026('0x13')](_0xb026('0xe'),_0x559b88,_0xb026('0x14'));_0x477f20(_0x5ba938['result'][_0xb026('0x12')]);}})['catch'](function(_0x1d192c){logger['error'](_0xb026('0xe'),_0x559b88,_0x1d192c);_0x26f6a5(_0x1d192c);});});}exports[_0xb026('0x15')]=function(_0x4cfc96){var _0x4acf3d=this;return new Promise(function(_0xcf144e,_0x5d03b7){return db[_0xb026('0x16')][_0xb026('0x17')]({'raw':_0x4cfc96['options']?_0x4cfc96[_0xb026('0x18')][_0xb026('0x19')]===undefined?!![]:![]:!![],'where':_0x4cfc96['options']?_0x4cfc96[_0xb026('0x18')][_0xb026('0x1a')]||null:null,'attributes':_0x4cfc96[_0xb026('0x18')]?_0x4cfc96[_0xb026('0x18')][_0xb026('0x1b')]||null:null,'limit':_0x4cfc96[_0xb026('0x18')]?_0x4cfc96[_0xb026('0x18')][_0xb026('0x1c')]||null:null,'include':_0x4cfc96[_0xb026('0x18')]?_0x4cfc96['options'][_0xb026('0x1d')]?_['map'](_0x4cfc96[_0xb026('0x18')][_0xb026('0x1d')],function(_0x3ad296){return{'model':db[_0x3ad296[_0xb026('0x1e')]],'as':_0x3ad296['as'],'attributes':_0x3ad296[_0xb026('0x1b')],'include':_0x3ad296[_0xb026('0x1d')]?_['map'](_0x3ad296[_0xb026('0x1d')],function(_0x3c944e){return{'model':db[_0x3c944e['model']],'as':_0x3c944e['as'],'attributes':_0x3c944e['attributes'],'include':_0x3c944e[_0xb026('0x1d')]?_['map'](_0x3c944e[_0xb026('0x1d')],function(_0x445d24){return{'model':db[_0x445d24[_0xb026('0x1e')]],'as':_0x445d24['as'],'attributes':_0x445d24[_0xb026('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16bbeb){logger['info']('GetTrunk',_0x4cfc96);logger[_0xb026('0xf')]('GetTrunk',_0x4cfc96,JSON[_0xb026('0x1f')](_0x16bbeb));_0xcf144e(_0x16bbeb);})['catch'](function(_0x4fb953){logger['error'](_0xb026('0x15'),_0x4fb953[_0xb026('0x12')],_0x4cfc96);_0x5d03b7(_0x4acf3d[_0xb026('0x11')](0x1f4,_0x4fb953[_0xb026('0x12')]));});});};exports['ShowTrunk']=function(_0x54d4f1){var _0x42aa63=this;return new Promise(function(_0x252969,_0x41f585){return db[_0xb026('0x16')][_0xb026('0x20')]({'raw':_0x54d4f1[_0xb026('0x18')]?_0x54d4f1['options'][_0xb026('0x19')]===undefined?!![]:![]:!![],'where':_0x54d4f1[_0xb026('0x18')]?_0x54d4f1[_0xb026('0x18')][_0xb026('0x1a')]||null:null,'attributes':_0x54d4f1['options']?_0x54d4f1[_0xb026('0x18')][_0xb026('0x1b')]||null:null,'include':_0x54d4f1[_0xb026('0x18')]?_0x54d4f1[_0xb026('0x18')][_0xb026('0x1d')]?_['map'](_0x54d4f1['options'][_0xb026('0x1d')],function(_0x389fc2){return{'model':db[_0x389fc2[_0xb026('0x1e')]],'as':_0x389fc2['as'],'attributes':_0x389fc2[_0xb026('0x1b')],'include':_0x389fc2[_0xb026('0x1d')]?_[_0xb026('0x21')](_0x389fc2[_0xb026('0x1d')],function(_0x56f684){return{'model':db[_0x56f684[_0xb026('0x1e')]],'as':_0x56f684['as'],'attributes':_0x56f684[_0xb026('0x1b')],'include':_0x56f684[_0xb026('0x1d')]?_[_0xb026('0x21')](_0x56f684[_0xb026('0x1d')],function(_0x58af8d){return{'model':db[_0x58af8d[_0xb026('0x1e')]],'as':_0x58af8d['as'],'attributes':_0x58af8d[_0xb026('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb026('0xd')](function(_0x1691e5){logger[_0xb026('0x13')](_0xb026('0x22'),_0x54d4f1);logger[_0xb026('0xf')](_0xb026('0x22'),_0x54d4f1,JSON[_0xb026('0x1f')](_0x1691e5));_0x252969(_0x1691e5);})[_0xb026('0x23')](function(_0x5d7ee3){logger[_0xb026('0x11')]('ShowTrunk',_0x5d7ee3['message'],_0x54d4f1);_0x41f585(_0x42aa63[_0xb026('0x11')](0x1f4,_0x5d7ee3[_0xb026('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 3894888..f736138 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 _0x4abb=['./user-setting.controller','put','/:id','isAuthenticated','update','exports','express','../../components/auth/service'];(function(_0x3b0b96,_0x5d3a05){var _0x4bb187=function(_0x27f015){while(--_0x27f015){_0x3b0b96['push'](_0x3b0b96['shift']());}};_0x4bb187(++_0x5d3a05);}(_0x4abb,0xb6));var _0xb4ab=function(_0x53a8d2,_0x1a713f){_0x53a8d2=_0x53a8d2-0x0;var _0x47165a=_0x4abb[_0x53a8d2];return _0x47165a;};'use strict';var express=require(_0xb4ab('0x0'));var router=express['Router']();var auth=require(_0xb4ab('0x1'));var controller=require(_0xb4ab('0x2'));router[_0xb4ab('0x3')](_0xb4ab('0x4'),auth[_0xb4ab('0x5')](),controller[_0xb4ab('0x6')]);module[_0xb4ab('0x7')]=router; \ No newline at end of file +var _0x6661=['../../components/auth/service','./user-setting.controller','put','update','exports','express','Router'];(function(_0xa388eb,_0x3660c2){var _0x481ab0=function(_0x2ddade){while(--_0x2ddade){_0xa388eb['push'](_0xa388eb['shift']());}};_0x481ab0(++_0x3660c2);}(_0x6661,0x11d));var _0x1666=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x6661[_0x45783c];return _0x1161da;};'use strict';var express=require(_0x1666('0x0'));var router=express[_0x1666('0x1')]();var auth=require(_0x1666('0x2'));var controller=require(_0x1666('0x3'));router[_0x1666('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x1666('0x5')]);module[_0x1666('0x6')]=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 0a1ab04..1eb5aab 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 _0x9cd5=['warning','info','debug','exports','ENUM','sequelize'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x9cd5,0x10d));var _0x59cd=function(_0x560215,_0x214783){_0x560215=_0x560215-0x0;var _0x464ad8=_0x9cd5[_0x560215];return _0x464ad8;};'use strict';var Sequelize=require(_0x59cd('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x59cd('0x1'),_0x59cd('0x2'),_0x59cd('0x3')];module[_0x59cd('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x59cd('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','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['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0x1317=['warning','info','debug','exports','TEXT','error'];(function(_0x3e76d1,_0x96e1ac){var _0x379c03=function(_0x5ea233){while(--_0x5ea233){_0x3e76d1['push'](_0x3e76d1['shift']());}};_0x379c03(++_0x96e1ac);}(_0x1317,0x149));var _0x7131=function(_0x5101f4,_0x5dd286){_0x5101f4=_0x5101f4-0x0;var _0x5aa86c=_0x1317[_0x5101f4];return _0x5aa86c;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x7131('0x0'),_0x7131('0x1'),_0x7131('0x2'),_0x7131('0x3')];module[_0x7131('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x7131('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 68cd0f5..98a9afa 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 _0x544f=['socket.io-emitter','./user-setting.socket','register','defaults','redis','json','then','sendStatus','error','stack','name','send','update','role','Unauthorized','Invalid\x20user\x20setting\x20id','find','params','body','catch','lodash','api','../../config/environment','../../mysqldb'];(function(_0x1f2f06,_0x43b758){var _0x24df35=function(_0x2c4d33){while(--_0x2c4d33){_0x1f2f06['push'](_0x1f2f06['shift']());}};_0x24df35(++_0x43b758);}(_0x544f,0x14c));var _0xf544=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x544f[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xf544('0x0'));var Redis=require('ioredis');var logger=require('../../config/logger')(_0xf544('0x1'));var config=require(_0xf544('0x2'));var db=require(_0xf544('0x3'))['db'];var socket=require(_0xf544('0x4'))(new Redis(config['redis']));require(_0xf544('0x5'))[_0xf544('0x6')](socket);config['redis']=_[_0xf544('0x7')](config[_0xf544('0x8')],{'host':'localhost','port':0x18eb});function respondWithResult(_0xdb52e7,_0x2ce041){_0x2ce041=_0x2ce041||0xc8;return function(_0x1749cc){if(_0x1749cc){return _0xdb52e7['status'](_0x2ce041)[_0xf544('0x9')](_0x1749cc);}};}function saveUpdates(_0x5f445c){return function(_0x258808){if(_0x258808){return _0x258808['update'](_0x5f445c)[_0xf544('0xa')](function(_0x4a042d){return _0x4a042d;});}return null;};}function handleEntityNotFound(_0x445fbe){return function(_0x47e00a){if(!_0x47e00a){_0x445fbe[_0xf544('0xb')](0x194);}return _0x47e00a;};}function handleError(_0x166f77,_0x28cac4){_0x28cac4=_0x28cac4||0x1f4;return function(_0x3c23d6){logger[_0xf544('0xc')](_0x3c23d6[_0xf544('0xd')]);if(_0x3c23d6[_0xf544('0xe')]){delete _0x3c23d6[_0xf544('0xe')];}_0x166f77['status'](_0x28cac4)[_0xf544('0xf')](_0x3c23d6);};}exports[_0xf544('0x10')]=function(_0x56c8d4,_0x4903e1){if(_0x56c8d4['user'][_0xf544('0x11')]!=='admin')throw new Error(_0xf544('0x12'));if(isNaN(Number(_0x56c8d4['params']['id'])))throw new Error(_0xf544('0x13'));return db['UserSetting'][_0xf544('0x14')]({'where':{'id':_0x56c8d4[_0xf544('0x15')]['id']}})[_0xf544('0xa')](handleEntityNotFound(_0x4903e1,null))['then'](saveUpdates(_0x56c8d4[_0xf544('0x16')],null))[_0xf544('0xa')](respondWithResult(_0x4903e1,null))[_0xf544('0x17')](handleError(_0x4903e1,null));}; \ No newline at end of file +var _0xf3dc=['then','error','stack','name','send','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','status','json','update'];(function(_0xf64e5,_0x4a3232){var _0x5f312c=function(_0x4d816c){while(--_0x4d816c){_0xf64e5['push'](_0xf64e5['shift']());}};_0x5f312c(++_0x4a3232);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x575446,_0x1a13fa){_0x575446=_0x575446-0x0;var _0x2fb644=_0xf3dc[_0x575446];return _0x2fb644;};'use strict';var _=require(_0xcf3d('0x0'));var Redis=require(_0xcf3d('0x1'));var logger=require(_0xcf3d('0x2'))('api');var config=require(_0xcf3d('0x3'));var db=require(_0xcf3d('0x4'))['db'];var socket=require(_0xcf3d('0x5'))(new Redis(config[_0xcf3d('0x6')]));require(_0xcf3d('0x7'))[_0xcf3d('0x8')](socket);config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x4e3427,_0x5bc3d6){_0x5bc3d6=_0x5bc3d6||0xc8;return function(_0x1a69de){if(_0x1a69de){return _0x4e3427[_0xcf3d('0x9')](_0x5bc3d6)[_0xcf3d('0xa')](_0x1a69de);}};}function saveUpdates(_0x1acad0){return function(_0x368e74){if(_0x368e74){return _0x368e74[_0xcf3d('0xb')](_0x1acad0)[_0xcf3d('0xc')](function(_0x4106fe){return _0x4106fe;});}return null;};}function handleEntityNotFound(_0x1b0dea){return function(_0x5e1d45){if(!_0x5e1d45){_0x1b0dea['sendStatus'](0x194);}return _0x5e1d45;};}function handleError(_0x4a52c3,_0x468f7e){_0x468f7e=_0x468f7e||0x1f4;return function(_0x5047b9){logger[_0xcf3d('0xd')](_0x5047b9[_0xcf3d('0xe')]);if(_0x5047b9[_0xcf3d('0xf')]){delete _0x5047b9[_0xcf3d('0xf')];}_0x4a52c3[_0xcf3d('0x9')](_0x468f7e)[_0xcf3d('0x10')](_0x5047b9);};}exports[_0xcf3d('0xb')]=function(_0x115fca,_0xd36708){if(_0x115fca['user']['role']!==_0xcf3d('0x11'))throw new Error(_0xcf3d('0x12'));if(isNaN(Number(_0x115fca[_0xcf3d('0x13')]['id'])))throw new Error(_0xcf3d('0x14'));return db[_0xcf3d('0x15')][_0xcf3d('0x16')]({'where':{'id':_0x115fca[_0xcf3d('0x13')]['id']}})[_0xcf3d('0xc')](handleEntityNotFound(_0xd36708,null))[_0xcf3d('0xc')](saveUpdates(_0x115fca[_0xcf3d('0x17')],null))['then'](respondWithResult(_0xd36708,null))['catch'](handleError(_0xd36708,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 5c56b88..adc9ac4 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 _0x1523=['UserSetting','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x22efd9,_0x1a8b57){var _0x2c3fcb=function(_0x3de54a){while(--_0x3de54a){_0x22efd9['push'](_0x22efd9['shift']());}};_0x2c3fcb(++_0x1a8b57);}(_0x1523,0x1c8));var _0x3152=function(_0x303f80,_0x27afc5){_0x303f80=_0x303f80-0x0;var _0x30b6d7=_0x1523[_0x303f80];return _0x30b6d7;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0x3152('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3152('0x1'),'afterUpdate':_0x3152('0x2'),'afterDestroy':_0x3152('0x3')};function emitEvent(_0x1b94d7){return function(_0x4d8add,_0x217d3d,_0x11d65e){UserSettingEvents[_0x3152('0x4')](_0x1b94d7+':'+_0x4d8add['id'],_0x4d8add);UserSettingEvents['emit'](_0x1b94d7,_0x4d8add);_0x11d65e(null);};}for(var e in events){if(events[_0x3152('0x5')](e)){var event=events[e];UserSetting[_0x3152('0x6')](e,emitEvent(event));}}module[_0x3152('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x845c=['../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x334713,_0x5e6776){var _0x376838=function(_0x32b98a){while(--_0x32b98a){_0x334713['push'](_0x334713['shift']());}};_0x376838(++_0x5e6776);}(_0x845c,0x10e));var _0xc845=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x845c[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xc845('0x0'))['db'][_0xc845('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xc845('0x2')](0x0);var events={'afterCreate':_0xc845('0x3'),'afterUpdate':_0xc845('0x4'),'afterDestroy':_0xc845('0x5')};function emitEvent(_0x163fe2){return function(_0x51299e,_0x419f15,_0x1d6645){UserSettingEvents[_0xc845('0x6')](_0x163fe2+':'+_0x51299e['id'],_0x51299e);UserSettingEvents[_0xc845('0x6')](_0x163fe2,_0x51299e);_0x1d6645(null);};}for(var e in events){if(events[_0xc845('0x7')](e)){var event=events[e];UserSetting[_0xc845('0x8')](e,emitEvent(event));}}module[_0xc845('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 992c725..eb64630 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 _0x7462=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting'];(function(_0x133296,_0xe8ff9a){var _0x193517=function(_0x161ffd){while(--_0x161ffd){_0x133296['push'](_0x133296['shift']());}};_0x193517(++_0xe8ff9a);}(_0x7462,0x165));var _0x2746=function(_0x2cc0b3,_0x120bf1){_0x2cc0b3=_0x2cc0b3-0x0;var _0x1667ef=_0x7462[_0x2cc0b3];return _0x1667ef;};'use strict';var attributes=require(_0x2746('0x0'));module[_0x2746('0x1')]=function(_0x5666d5){return _0x5666d5['define'](_0x2746('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x497e67){if(!_0x497e67[_0x2746('0x3')])_0x497e67[_0x2746('0x4')]=null;else if(_0x497e67['clientSideLoggingEnabledSince']===null)_0x497e67[_0x2746('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x4e81=['./user-setting.attributes','exports','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x112a3e,_0x23f15c){var _0x577bfc=function(_0x4c47c0){while(--_0x4c47c0){_0x112a3e['push'](_0x112a3e['shift']());}};_0x577bfc(++_0x23f15c);}(_0x4e81,0x1bc));var _0x14e8=function(_0x266ddc,_0x45aa52){_0x266ddc=_0x266ddc-0x0;var _0x39c1d7=_0x4e81[_0x266ddc];return _0x39c1d7;};'use strict';var attributes=require(_0x14e8('0x0'));module[_0x14e8('0x1')]=function(_0x354aac){return _0x354aac['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2184fc){if(!_0x2184fc[_0x14e8('0x2')])_0x2184fc[_0x14e8('0x3')]=null;else if(_0x2184fc[_0x14e8('0x3')]===null)_0x2184fc[_0x14e8('0x3')]=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 e070552..f4fc5ab 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 _0x7c07=['UserId','register','user-setting:','save','remove','update','user-setting:update','emit','user-setting:update:user-'];(function(_0x23e5fd,_0x2c6da6){var _0xab592b=function(_0x75559a){while(--_0x75559a){_0x23e5fd['push'](_0x23e5fd['shift']());}};_0xab592b(++_0x2c6da6);}(_0x7c07,0x111));var _0x77c0=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x7c07[_0x1e3c16];return _0x47a0c9;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x77c0('0x0'),_0x77c0('0x1'),_0x77c0('0x2')];function createListener(_0xd84520,_0x521e97){return function(_0x2bf008){_0x521e97['emit'](_0xd84520,_0x2bf008);if(_0xd84520===_0x77c0('0x3')){_0x521e97[_0x77c0('0x4')](_0x77c0('0x5')+_0x2bf008[_0x77c0('0x6')],_0x2bf008);}};}exports[_0x77c0('0x7')]=function(_0x29c08b){for(var _0x1e5c96=0x0,_0x5ba918=events['length'];_0x1e5c96<_0x5ba918;_0x1e5c96++){var _0x5d6be5=events[_0x1e5c96];var _0x38c979=createListener(_0x77c0('0x8')+_0x5d6be5,_0x29c08b);UserSettingEvents['on'](_0x5d6be5,_0x38c979);}}; \ No newline at end of file +var _0x8b98=['user-setting:','./user-setting.events','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','length'];(function(_0x56f14,_0x4c1ee2){var _0x429577=function(_0x21d141){while(--_0x21d141){_0x56f14['push'](_0x56f14['shift']());}};_0x429577(++_0x4c1ee2);}(_0x8b98,0x1cc));var _0x88b9=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x8b98[_0x4cf98e];return _0x1623ac;};'use strict';var UserSettingEvents=require(_0x88b9('0x0'));var events=['save',_0x88b9('0x1'),_0x88b9('0x2')];function createListener(_0x3a6662,_0x4d3e94){return function(_0x4dba57){_0x4d3e94[_0x88b9('0x3')](_0x3a6662,_0x4dba57);if(_0x3a6662===_0x88b9('0x4')){_0x4d3e94[_0x88b9('0x3')](_0x88b9('0x5')+_0x4dba57[_0x88b9('0x6')],_0x4dba57);}};}exports['register']=function(_0x26da1b){for(var _0x3666e3=0x0,_0x4d45b5=events[_0x88b9('0x7')];_0x3666e3<_0x4d45b5;_0x3666e3++){var _0x3c44be=events[_0x3666e3];var _0x486976=createListener(_0x88b9('0x8')+_0x3c44be,_0x26da1b);UserSettingEvents['on'](_0x3c44be,_0x486976);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 1631ec0..e6dc25a 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 _0xd57b=['show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','format','now','originalname','single','file','addAvatar','login','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/whoami','whoami','getPresence','/:id'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0xd57b,0x1be));var _0xbd57=function(_0x129954,_0x17b156){_0x129954=_0x129954-0x0;var _0x2b40f2=_0xd57b[_0x129954];return _0x2b40f2;};'use strict';var multer=require(_0xbd57('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbd57('0x1')]();var fs_extra=require(_0xbd57('0x2'));var auth=require(_0xbd57('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbd57('0x4'));var controller=require('./user.controller');router[_0xbd57('0x5')]('/',auth['isAuthenticated'](),controller[_0xbd57('0x6')]);router[_0xbd57('0x5')](_0xbd57('0x7'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x9')]);router[_0xbd57('0x5')](_0xbd57('0xa'),auth[_0xbd57('0x8')](),controller[_0xbd57('0xb')]);router['get']('/presence',auth[_0xbd57('0x8')](),controller[_0xbd57('0xc')]);router[_0xbd57('0x5')](_0xbd57('0xd'),auth[_0xbd57('0x8')](),controller[_0xbd57('0xe')]);router[_0xbd57('0x5')](_0xbd57('0xf'),controller[_0xbd57('0x10')]);router[_0xbd57('0x5')](_0xbd57('0x11'),auth[_0xbd57('0x8')](),controller['getOpenTabs']);router[_0xbd57('0x5')](_0xbd57('0x12'),auth['isAuthenticated'](),controller[_0xbd57('0x13')]);router[_0xbd57('0x5')](_0xbd57('0x14'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x15')]);router[_0xbd57('0x5')](_0xbd57('0x16'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xbd57('0x5')](_0xbd57('0x17'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x18')]);router['get'](_0xbd57('0x19'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x1a')]);router['get'](_0xbd57('0x1b'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x1c')]);router[_0xbd57('0x5')]('/:id/chat/interactions',auth[_0xbd57('0x8')](),controller[_0xbd57('0x1d')]);router[_0xbd57('0x5')]('/:id/openchannel/interactions',auth[_0xbd57('0x8')](),controller[_0xbd57('0x1e')]);router['get'](_0xbd57('0x1f'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0xbd57('0x5')](_0xbd57('0x20'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x21')]);router['get'](_0xbd57('0x22'),auth['isAuthenticated'](),controller[_0xbd57('0x23')]);router['get'](_0xbd57('0x24'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x25')]);router[_0xbd57('0x5')](_0xbd57('0x26'),auth[_0xbd57('0x8')](),controller['getTeams']);router[_0xbd57('0x5')](_0xbd57('0x27'),auth['isAuthenticated'](),controller[_0xbd57('0x28')]);router[_0xbd57('0x5')](_0xbd57('0x29'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x2a')]);router[_0xbd57('0x5')](_0xbd57('0x2b'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x2c')]);router['get'](_0xbd57('0x2d'),auth['isAuthenticated'](),controller['getFaxAccounts']);router['get'](_0xbd57('0x2e'),auth['isAuthenticated'](),controller[_0xbd57('0x2f')]);router[_0xbd57('0x5')](_0xbd57('0x30'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xbd57('0x5')](_0xbd57('0x31'),auth['isAuthenticated'](),controller[_0xbd57('0x32')]);router[_0xbd57('0x5')](_0xbd57('0x33'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x34')]);router[_0xbd57('0x5')](_0xbd57('0x35'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x36')]);router[_0xbd57('0x5')](_0xbd57('0x37'),auth['isAuthenticated'](),controller[_0xbd57('0x38')]);router[_0xbd57('0x5')](_0xbd57('0x39'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x3a')]);router[_0xbd57('0x3b')](_0xbd57('0x12'),auth[_0xbd57('0x8')](),controller['addContacts']);router[_0xbd57('0x3b')]('/',auth[_0xbd57('0x8')](),controller[_0xbd57('0x3c')]);router[_0xbd57('0x3b')](_0xbd57('0x3d'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x3e')]);router[_0xbd57('0x3b')](_0xbd57('0x14'),auth['isAuthenticated'](),controller[_0xbd57('0x3f')]);var upload=multer({'storage':multer[_0xbd57('0x40')]({'destination':function(_0x2f3e9c,_0x3b88f6,_0x5026a1){_0x5026a1(null,path[_0xbd57('0x41')](config['root'],'server/files/images/'));},'filename':function(_0x560d31,_0x2e704d,_0x1392aa){_0x1392aa(null,util[_0xbd57('0x42')]('%s-%s',Date[_0xbd57('0x43')](),_0x2e704d[_0xbd57('0x44')]));}})});router['post'](_0xbd57('0xf'),upload[_0xbd57('0x45')](_0xbd57('0x46')),controller[_0xbd57('0x47')]);router[_0xbd57('0x3b')]('/:id/login',auth[_0xbd57('0x8')](),controller[_0xbd57('0x48')]);router['post']('/:id/logout',auth[_0xbd57('0x8')](),controller['logout']);router[_0xbd57('0x3b')]('/:id/pause',auth[_0xbd57('0x8')](),controller[_0xbd57('0x49')]);router[_0xbd57('0x3b')](_0xbd57('0x4a'),auth['isAuthenticated'](),controller[_0xbd57('0x4b')]);router[_0xbd57('0x3b')](_0xbd57('0x26'),auth['isAuthenticated'](),controller[_0xbd57('0x4c')]);router[_0xbd57('0x3b')](_0xbd57('0x4d'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x4e')]);router[_0xbd57('0x3b')](_0xbd57('0x4f'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x50')]);router[_0xbd57('0x3b')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xbd57('0x51')]);router[_0xbd57('0x3b')](_0xbd57('0x52'),auth['isAuthenticated'](),controller[_0xbd57('0x53')]);router[_0xbd57('0x3b')](_0xbd57('0x54'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x55')]);router[_0xbd57('0x3b')](_0xbd57('0x56'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x57')]);router[_0xbd57('0x3b')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xbd57('0x58')]);router[_0xbd57('0x3b')](_0xbd57('0x2e'),auth[_0xbd57('0x8')](),controller['addMailAccounts']);router[_0xbd57('0x3b')](_0xbd57('0x30'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x59')]);router[_0xbd57('0x3b')](_0xbd57('0x31'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x5a')]);router[_0xbd57('0x3b')](_0xbd57('0x33'),auth['isAuthenticated'](),controller[_0xbd57('0x5b')]);router[_0xbd57('0x3b')](_0xbd57('0x35'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x5c')]);router['post']('/:id/api_key',auth[_0xbd57('0x8')](),controller[_0xbd57('0x5d')]);router[_0xbd57('0x5e')](_0xbd57('0xd'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x5f')]);router['put'](_0xbd57('0x60'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x61')]);router['delete'](_0xbd57('0x14'),auth['isAuthenticated'](),controller[_0xbd57('0x62')]);router[_0xbd57('0x63')]('/:id/teams',auth[_0xbd57('0x8')](),controller[_0xbd57('0x64')]);router[_0xbd57('0x63')]('/:id',auth[_0xbd57('0x8')](),controller['destroy']);router[_0xbd57('0x63')](_0xbd57('0x4d'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x65')]);router[_0xbd57('0x63')](_0xbd57('0x4f'),auth['isAuthenticated'](),controller[_0xbd57('0x66')]);router[_0xbd57('0x63')](_0xbd57('0x67'),auth['isAuthenticated'](),controller[_0xbd57('0x68')]);router[_0xbd57('0x63')](_0xbd57('0x52'),auth['isAuthenticated'](),controller[_0xbd57('0x69')]);router[_0xbd57('0x63')](_0xbd57('0x54'),auth['isAuthenticated'](),controller[_0xbd57('0x6a')]);router['delete'](_0xbd57('0x56'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x6b')]);router['delete'](_0xbd57('0x2d'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x6c')]);router['delete'](_0xbd57('0x2e'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x6d')]);router['delete']('/:id/openchannel_accounts',auth[_0xbd57('0x8')](),controller[_0xbd57('0x6e')]);router[_0xbd57('0x63')](_0xbd57('0x31'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x6f')]);router[_0xbd57('0x63')](_0xbd57('0x33'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x70')]);router[_0xbd57('0x63')](_0xbd57('0x35'),auth[_0xbd57('0x8')](),controller[_0xbd57('0x71')]);router[_0xbd57('0x63')](_0xbd57('0x39'),auth['isAuthenticated'](),controller['removeApiKey']);module[_0xbd57('0x72')]=router; \ No newline at end of file +var _0x4458=['/:id','update','changePassword','delete','removeTeams','destroy','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','describe','/whoami','whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put'];(function(_0x324870,_0x11431a){var _0x2d81be=function(_0x4e1e24){while(--_0x4e1e24){_0x324870['push'](_0x324870['shift']());}};_0x2d81be(++_0x11431a);}(_0x4458,0x1e4));var _0x8445=function(_0x3bad26,_0x356e96){_0x3bad26=_0x3bad26-0x0;var _0x236ba2=_0x4458[_0x3bad26];return _0x236ba2;};'use strict';var multer=require(_0x8445('0x0'));var util=require(_0x8445('0x1'));var path=require(_0x8445('0x2'));var timeout=require(_0x8445('0x3'));var express=require(_0x8445('0x4'));var router=express[_0x8445('0x5')]();var fs_extra=require(_0x8445('0x6'));var auth=require(_0x8445('0x7'));var interaction=require(_0x8445('0x8'));var config=require(_0x8445('0x9'));var controller=require(_0x8445('0xa'));router['get']('/',auth[_0x8445('0xb')](),controller[_0x8445('0xc')]);router[_0x8445('0xd')]('/describe',auth['isAuthenticated'](),controller[_0x8445('0xe')]);router[_0x8445('0xd')](_0x8445('0xf'),auth['isAuthenticated'](),controller[_0x8445('0x10')]);router[_0x8445('0xd')]('/presence',auth[_0x8445('0xb')](),controller[_0x8445('0x11')]);router[_0x8445('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8445('0x12')]);router[_0x8445('0xd')](_0x8445('0x13'),controller[_0x8445('0x14')]);router[_0x8445('0xd')](_0x8445('0x15'),auth[_0x8445('0xb')](),controller['getOpenTabs']);router[_0x8445('0xd')](_0x8445('0x16'),auth[_0x8445('0xb')](),controller[_0x8445('0x17')]);router[_0x8445('0xd')](_0x8445('0x18'),auth[_0x8445('0xb')](),controller[_0x8445('0x19')]);router[_0x8445('0xd')](_0x8445('0x1a'),auth[_0x8445('0xb')](),controller[_0x8445('0x1b')]);router[_0x8445('0xd')](_0x8445('0x1c'),auth['isAuthenticated'](),controller[_0x8445('0x1d')]);router[_0x8445('0xd')]('/:id/recordings',auth[_0x8445('0xb')](),controller['getRecordings']);router[_0x8445('0xd')](_0x8445('0x1e'),auth[_0x8445('0xb')](),controller[_0x8445('0x1f')]);router['get'](_0x8445('0x20'),auth['isAuthenticated'](),controller[_0x8445('0x21')]);router[_0x8445('0xd')](_0x8445('0x22'),auth['isAuthenticated'](),controller[_0x8445('0x23')]);router[_0x8445('0xd')](_0x8445('0x24'),auth[_0x8445('0xb')](),controller[_0x8445('0x25')]);router[_0x8445('0xd')](_0x8445('0x26'),auth['isAuthenticated'](),controller[_0x8445('0x27')]);router[_0x8445('0xd')](_0x8445('0x28'),auth[_0x8445('0xb')](),controller[_0x8445('0x29')]);router['get'](_0x8445('0x2a'),auth['isAuthenticated'](),controller[_0x8445('0x2b')]);router['get'](_0x8445('0x2c'),auth[_0x8445('0xb')](),controller[_0x8445('0x2d')]);router['get'](_0x8445('0x2e'),auth[_0x8445('0xb')](),controller[_0x8445('0x2f')]);router[_0x8445('0xd')]('/:id/agents',auth[_0x8445('0xb')](),controller[_0x8445('0x30')]);router[_0x8445('0xd')](_0x8445('0x31'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x8445('0xd')](_0x8445('0x32'),auth['isAuthenticated'](),controller[_0x8445('0x33')]);router['get'](_0x8445('0x34'),auth[_0x8445('0xb')](),controller[_0x8445('0x35')]);router[_0x8445('0xd')](_0x8445('0x36'),auth[_0x8445('0xb')](),controller['getOpenchannelAccounts']);router[_0x8445('0xd')]('/:id/sms_accounts',auth[_0x8445('0xb')](),controller[_0x8445('0x37')]);router[_0x8445('0xd')](_0x8445('0x38'),auth[_0x8445('0xb')](),controller[_0x8445('0x39')]);router[_0x8445('0xd')](_0x8445('0x3a'),auth[_0x8445('0xb')](),controller[_0x8445('0x3b')]);router[_0x8445('0xd')](_0x8445('0x3c'),auth[_0x8445('0xb')](),controller['getScheduledCalls']);router[_0x8445('0xd')](_0x8445('0x3d'),auth[_0x8445('0xb')](),controller[_0x8445('0x3e')]);router[_0x8445('0x3f')](_0x8445('0x16'),auth[_0x8445('0xb')](),controller[_0x8445('0x40')]);router['post']('/',auth[_0x8445('0xb')](),controller[_0x8445('0x41')]);router[_0x8445('0x3f')]('/create_many',auth[_0x8445('0xb')](),controller[_0x8445('0x42')]);router[_0x8445('0x3f')]('/:id/queues',auth[_0x8445('0xb')](),controller[_0x8445('0x43')]);var upload=multer({'storage':multer[_0x8445('0x44')]({'destination':function(_0x3b56de,_0xdfac2c,_0x271afb){_0x271afb(null,path[_0x8445('0x45')](config[_0x8445('0x46')],'server/files/images/'));},'filename':function(_0x13b641,_0x359a16,_0x3c1797){_0x3c1797(null,util[_0x8445('0x47')](_0x8445('0x48'),Date[_0x8445('0x49')](),_0x359a16[_0x8445('0x4a')]));}})});router[_0x8445('0x3f')]('/:id/avatar',upload[_0x8445('0x4b')](_0x8445('0x4c')),controller[_0x8445('0x4d')]);router[_0x8445('0x3f')](_0x8445('0x4e'),auth['isAuthenticated'](),controller['login']);router[_0x8445('0x3f')](_0x8445('0x4f'),auth[_0x8445('0xb')](),controller[_0x8445('0x50')]);router[_0x8445('0x3f')]('/:id/pause',auth[_0x8445('0xb')](),controller['pause']);router[_0x8445('0x3f')](_0x8445('0x51'),auth['isAuthenticated'](),controller['unpause']);router[_0x8445('0x3f')](_0x8445('0x2c'),auth[_0x8445('0xb')](),controller[_0x8445('0x52')]);router[_0x8445('0x3f')](_0x8445('0x53'),auth['isAuthenticated'](),controller['addChatInteractions']);router['post'](_0x8445('0x54'),auth[_0x8445('0xb')](),controller[_0x8445('0x55')]);router[_0x8445('0x3f')](_0x8445('0x56'),auth['isAuthenticated'](),controller[_0x8445('0x57')]);router[_0x8445('0x3f')](_0x8445('0x58'),auth['isAuthenticated'](),controller[_0x8445('0x59')]);router[_0x8445('0x3f')](_0x8445('0x5a'),auth[_0x8445('0xb')](),controller[_0x8445('0x5b')]);router[_0x8445('0x3f')](_0x8445('0x5c'),auth[_0x8445('0xb')](),controller[_0x8445('0x5d')]);router['post'](_0x8445('0x32'),auth[_0x8445('0xb')](),controller[_0x8445('0x5e')]);router[_0x8445('0x3f')](_0x8445('0x34'),auth[_0x8445('0xb')](),controller[_0x8445('0x5f')]);router[_0x8445('0x3f')](_0x8445('0x36'),auth[_0x8445('0xb')](),controller[_0x8445('0x60')]);router['post']('/:id/sms_accounts',auth[_0x8445('0xb')](),controller[_0x8445('0x61')]);router[_0x8445('0x3f')]('/:id/chat_websites',auth[_0x8445('0xb')](),controller[_0x8445('0x62')]);router[_0x8445('0x3f')](_0x8445('0x3a'),auth[_0x8445('0xb')](),controller[_0x8445('0x63')]);router['post'](_0x8445('0x3d'),auth[_0x8445('0xb')](),controller['createApiKey']);router[_0x8445('0x64')](_0x8445('0x65'),auth['isAuthenticated'](),controller[_0x8445('0x66')]);router[_0x8445('0x64')]('/:id/password',auth['isAuthenticated'](),controller[_0x8445('0x67')]);router[_0x8445('0x68')](_0x8445('0x18'),auth[_0x8445('0xb')](),controller['removeQueues']);router[_0x8445('0x68')](_0x8445('0x2c'),auth[_0x8445('0xb')](),controller[_0x8445('0x69')]);router['delete'](_0x8445('0x65'),auth[_0x8445('0xb')](),controller[_0x8445('0x6a')]);router[_0x8445('0x68')]('/:id/chat_interactions',auth[_0x8445('0xb')](),controller['removeChatInteractions']);router[_0x8445('0x68')](_0x8445('0x54'),auth[_0x8445('0xb')](),controller['removeMailInteractions']);router[_0x8445('0x68')](_0x8445('0x56'),auth[_0x8445('0xb')](),controller[_0x8445('0x6b')]);router[_0x8445('0x68')](_0x8445('0x58'),auth[_0x8445('0xb')](),controller[_0x8445('0x6c')]);router[_0x8445('0x68')]('/:id/openchannel_interactions',auth[_0x8445('0xb')](),controller[_0x8445('0x6d')]);router['delete']('/:id/whatsapp_interactions',auth[_0x8445('0xb')](),controller[_0x8445('0x6e')]);router[_0x8445('0x68')](_0x8445('0x32'),auth[_0x8445('0xb')](),controller['removeFaxAccounts']);router[_0x8445('0x68')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x8445('0x68')](_0x8445('0x36'),auth['isAuthenticated'](),controller[_0x8445('0x6f')]);router[_0x8445('0x68')](_0x8445('0x70'),auth['isAuthenticated'](),controller[_0x8445('0x71')]);router[_0x8445('0x68')](_0x8445('0x38'),auth['isAuthenticated'](),controller[_0x8445('0x72')]);router[_0x8445('0x68')]('/:id/whatsapp_accounts',auth[_0x8445('0xb')](),controller[_0x8445('0x73')]);router[_0x8445('0x68')]('/:id/api_key',auth[_0x8445('0xb')](),controller['removeApiKey']);module[_0x8445('0x74')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 63684e1..15fdbf3 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 _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x20af80,_0x1b12cd){var _0xe5b049=function(_0x4b1379){while(--_0x4b1379){_0x20af80['push'](_0x20af80['shift']());}};_0xe5b049(++_0x1b12cd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0xcb91[_0x2e6dbf];return _0x2680e5;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 67995cb..0ebdbdd 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 _0xc358=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','request','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','then','agent','emit','get','role','user','Agents','Telephones','telephone','ignore','map','value','includes','UserProfileResource','destroy','end','stack','name','send','index','User','rawAttributes','type','key','salt','getOptions','where','query','includeAll','include','UserSetting','attributes','push','findAll','rows','true','chat','dataValues','mail','all','show','params','model','keys','password','filters','intersection','fields','userSetting','options','find','openTabs','sms','openchannel','whatsapp','fax','body','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','internal','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','length','from','voicemail','permissions','102','113','110','109','100','114','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','VoiceMail','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','Queues','spread','QueueId','voice','VoiceQueue','format','SIP/%s','penalty','upsert','removeQueues','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','existsSync','join','server/files/images/','download','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','WHATSAPP','CmContact','order','sort','pick','merge','hasOwnProperty','CmList','Tag','Tags','tag','getContacts','getQueues','Queue','Unknown\x20role','nolimit','filter','getVoiceQueuesRt','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','LOGININPAUSE','concat','isMiddleware','logout','pause','QueuePause','updateAttributes','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','faxPause','openchannelPause','smsPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Queue:save','removeTeams','resolve','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','Voice','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$any','lastName','Contact','dialActive','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','inbound','flatten','lower','col','toString','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','http','offline','idle','unknown','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','_interactions','ui.UserId\x20=\x20?','moment','util','path','lodash','squel','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc358,0x17e));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x8c35('0x0'));var util=require(_0x8c35('0x1'));var path=require(_0x8c35('0x2'));var fs=require('fs');var _=require(_0x8c35('0x3'));var squel=require(_0x8c35('0x4'));var jayson=require(_0x8c35('0x5'));var Redis=require(_0x8c35('0x6'));var authService=require('../../components/auth/service');var qs=require(_0x8c35('0x7'));var logger=require(_0x8c35('0x8'))(_0x8c35('0x9'));var utils=require(_0x8c35('0xa'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x8c35('0xb'))[_0x8c35('0xc')];var APINotFoundError=require(_0x8c35('0xb'))['APINotFoundError'];var APIHandleError=require(_0x8c35('0xb'))[_0x8c35('0xd')];var db=require(_0x8c35('0xe'))['db'];var socket=require(_0x8c35('0xf'))(new Redis(config[_0x8c35('0x10')]));require(_0x8c35('0x11'))[_0x8c35('0x12')](socket);config['redis']=_[_0x8c35('0x13')](config[_0x8c35('0x10')],{'host':_0x8c35('0x14'),'port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x3bc72a,_0x171049,_0x44070b,_0x3c1c8f){return new Promise(function(_0x88def8,_0x12e499){var _0x1a3206=_0x3c1c8f||amiClient;return _0x1a3206[_0x8c35('0x15')](_0x3bc72a,_0x44070b)['then'](function(_0x116714){logger[_0x8c35('0x16')](_0x8c35('0x17'),_0x171049,_0x8c35('0x18'));logger[_0x8c35('0x19')]('User,\x20%s,\x20%s,\x20%s',_0x171049,_0x8c35('0x18'),JSON[_0x8c35('0x1a')](_0x116714));if(_0x116714[_0x8c35('0x1b')]){if(_0x116714[_0x8c35('0x1b')][_0x8c35('0x1c')]===0x1f4){logger[_0x8c35('0x1b')](_0x8c35('0x17'),_0x171049,_0x116714[_0x8c35('0x1b')][_0x8c35('0x1d')]);return _0x12e499(_0x116714['error'][_0x8c35('0x1d')]);}logger[_0x8c35('0x1b')]('User,\x20%s,\x20%s',_0x171049,_0x116714[_0x8c35('0x1b')][_0x8c35('0x1d')]);return _0x88def8(_0x116714[_0x8c35('0x1b')][_0x8c35('0x1d')]);}else{logger[_0x8c35('0x16')](_0x8c35('0x17'),_0x171049,_0x8c35('0x18'));_0x88def8(_0x116714[_0x8c35('0x1e')]['message']);}})[_0x8c35('0x1f')](function(_0x4980cd){logger['error'](_0x8c35('0x17'),_0x171049,_0x4980cd);_0x12e499(_0x4980cd);});});}function respondWithStatusCode(_0x320ee7,_0x452e86){_0x452e86=_0x452e86||0xcc;return function(_0x2f266f){if(_0x2f266f){return _0x320ee7['sendStatus'](_0x452e86);}return _0x320ee7[_0x8c35('0x20')](_0x452e86)['end']();};}function respondWithResult(_0x1b9547,_0xda0f1a){_0xda0f1a=_0xda0f1a||0xc8;return function(_0x5bb377){if(_0x5bb377){return _0x1b9547[_0x8c35('0x20')](_0xda0f1a)[_0x8c35('0x21')](_0x5bb377);}};}function respondWithFilteredResult(_0x12cde8,_0x330698){return function(_0x3f0155){if(_0x3f0155){var _0x38d9ad=typeof _0x330698[_0x8c35('0x22')]==='undefined'&&typeof _0x330698[_0x8c35('0x23')]===_0x8c35('0x24');var _0x21c2d0=_0x3f0155[_0x8c35('0x25')];var _0x10be27=_0x38d9ad?0x0:_0x330698[_0x8c35('0x22')];var _0x245744=_0x38d9ad?_0x3f0155[_0x8c35('0x25')]:_0x330698['offset']+_0x330698[_0x8c35('0x23')];var _0x24fca2;if(_0x245744>=_0x21c2d0){_0x245744=_0x21c2d0;_0x24fca2=0xc8;}else{_0x24fca2=0xce;}_0x12cde8[_0x8c35('0x20')](_0x24fca2);return _0x12cde8[_0x8c35('0x26')](_0x8c35('0x27'),_0x10be27+'-'+_0x245744+'/'+_0x21c2d0)[_0x8c35('0x21')](_0x3f0155);}return null;};}function saveUpdates(_0x3727e3){return function(_0x4a0f69){if(_0x4a0f69){return _0x4a0f69[_0x8c35('0x28')](_0x3727e3)[_0x8c35('0x29')](function(_0x94ec01){if(_0x94ec01['role']===_0x8c35('0x2a')){socket[_0x8c35('0x2b')]('userNotification:recalc:'+_0x94ec01['id'],_0x94ec01);}return _0x94ec01;});}return null;};}function removeEntity(_0x3fe9d0){return function(_0x7ba8d9){if(_0x7ba8d9){return _0x7ba8d9['destroy']()[_0x8c35('0x29')](function(){var _0x37557d=_0x7ba8d9[_0x8c35('0x2c')]({'plain':!![]});if(_0x37557d[_0x8c35('0x2d')]==='admin')return;var _0x2f5cc6=[{'name':'Users','value':_0x8c35('0x2e'),'ignore':!![]},{'name':_0x8c35('0x2f'),'value':'agent','ignore':![]},{'name':_0x8c35('0x30'),'value':_0x8c35('0x31'),'ignore':![]}];var _0x3ae66d=_(_0x2f5cc6)['filter'](_0x8c35('0x32'))[_0x8c35('0x33')](_0x8c35('0x34'))[_0x8c35('0x34')]();if(_[_0x8c35('0x35')](_0x3ae66d,_0x37557d[_0x8c35('0x2d')])){return;}var _0x42dfa5=_['find'](_0x2f5cc6,[_0x8c35('0x34'),_0x37557d['role']])['name'];return db[_0x8c35('0x36')][_0x8c35('0x37')]({'where':{'type':_0x42dfa5,'resourceId':_0x37557d['id']}})[_0x8c35('0x29')](function(){return _0x7ba8d9;});})[_0x8c35('0x29')](function(){_0x3fe9d0[_0x8c35('0x20')](0xcc)[_0x8c35('0x38')]();});}};}function handleEntityNotFound(_0x15789e){return function(_0x15f332){if(!_0x15f332){_0x15789e['sendStatus'](0x194);}return _0x15f332;};}function handleError(_0x27cf43,_0x598941){_0x598941=_0x598941||0x1f4;return function(_0x44d82d){logger[_0x8c35('0x1b')](_0x44d82d[_0x8c35('0x39')]);if(_0x44d82d[_0x8c35('0x3a')]){delete _0x44d82d['name'];}_0x27cf43[_0x8c35('0x20')](_0x598941)[_0x8c35('0x3b')](_0x44d82d);};}exports[_0x8c35('0x3c')]=function(_0x57415b,_0xd13caa){var _0xa5b43c={},_0x19927d={'count':0x0,'rows':[]};var _0x15570f=_(db[_0x8c35('0x3d')][_0x8c35('0x3e')])[_0x8c35('0x33')](function(_0xfea7d8){return{'name':_0xfea7d8['fieldName'],'type':_0xfea7d8[_0x8c35('0x3f')][_0x8c35('0x40')]};})['filter'](function(_0x1c1c81){return!_[_0x8c35('0x35')](['password',_0x8c35('0x41')],_0x1c1c81[_0x8c35('0x3a')]);})[_0x8c35('0x34')]();_0xa5b43c=qs[_0x8c35('0x42')](_0x15570f,_0x57415b);var _0x29e11d={'where':_0xa5b43c[_0x8c35('0x43')]};return db[_0x8c35('0x3d')][_0x8c35('0x25')](_0x29e11d)[_0x8c35('0x29')](function(_0xb3c99d){_0x19927d[_0x8c35('0x25')]=_0xb3c99d;if(_0x57415b[_0x8c35('0x44')][_0x8c35('0x45')]){_0xa5b43c[_0x8c35('0x46')]=[{'all':!![]}];}if(_0x57415b[_0x8c35('0x44')]['userSetting']==='true'){_0xa5b43c[_0x8c35('0x46')]=[{'model':db[_0x8c35('0x47')],'as':'userSetting'}];}if(!_[_0x8c35('0x35')](_0xa5b43c['attributes'],'id')){_0xa5b43c[_0x8c35('0x48')][_0x8c35('0x49')]('id');}return db[_0x8c35('0x3d')][_0x8c35('0x4a')](_0xa5b43c);})[_0x8c35('0x29')](function(_0x22bf39){_0x19927d[_0x8c35('0x4b')]=_0x22bf39;if(_0x57415b[_0x8c35('0x44')]['openTabs']===_0x8c35('0x4c')){var _0x354db9=[];for(var _0x11acd2=0x0;_0x11acd2<_0x19927d['rows']['length'];_0x11acd2++){_0x354db9[_0x8c35('0x49')](get_open_tabs(_0x8c35('0x4d'),_0x19927d[_0x8c35('0x4b')][_0x11acd2]['dataValues']));_0x354db9['push'](get_open_tabs('sms',_0x19927d['rows'][_0x11acd2][_0x8c35('0x4e')]));_0x354db9['push'](get_open_tabs('fax',_0x19927d[_0x8c35('0x4b')][_0x11acd2][_0x8c35('0x4e')]));_0x354db9[_0x8c35('0x49')](get_open_tabs(_0x8c35('0x4f'),_0x19927d[_0x8c35('0x4b')][_0x11acd2][_0x8c35('0x4e')]));_0x354db9[_0x8c35('0x49')](get_open_tabs('openchannel',_0x19927d[_0x8c35('0x4b')][_0x11acd2][_0x8c35('0x4e')]));_0x354db9[_0x8c35('0x49')](get_open_tabs('whatsapp',_0x19927d[_0x8c35('0x4b')][_0x11acd2][_0x8c35('0x4e')]));}return Promise[_0x8c35('0x50')](_0x354db9)[_0x8c35('0x29')](function(){return _0x19927d;});}else{return _0x19927d;}})[_0x8c35('0x29')](respondWithFilteredResult(_0xd13caa,_0xa5b43c))[_0x8c35('0x1f')](handleError(_0xd13caa,null));};exports[_0x8c35('0x51')]=function(_0x4215f4,_0x442606){var _0xaa9575={'raw':![],'where':{'id':_0x4215f4[_0x8c35('0x52')]['id']}},_0xa80377={};_0xa80377[_0x8c35('0x53')]=_['differenceBy'](_[_0x8c35('0x54')](db[_0x8c35('0x3d')][_0x8c35('0x3e')]),[_0x8c35('0x55'),_0x8c35('0x41')]);_0xa80377[_0x8c35('0x44')]=_[_0x8c35('0x54')](_0x4215f4['query']);_0xa80377[_0x8c35('0x56')]=_[_0x8c35('0x57')](_0xa80377['model'],_0xa80377[_0x8c35('0x44')]);_0xaa9575[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0xa80377['model'],qs['fields'](_0x4215f4[_0x8c35('0x44')][_0x8c35('0x58')]));_0xaa9575[_0x8c35('0x48')]=_0xaa9575[_0x8c35('0x48')]['length']?_0xaa9575[_0x8c35('0x48')]:_0xa80377[_0x8c35('0x53')];if(_0x4215f4['query'][_0x8c35('0x45')]){_0xaa9575[_0x8c35('0x46')]=[{'all':!![]}];}if(_0x4215f4[_0x8c35('0x44')][_0x8c35('0x59')]==='true'){_0xaa9575[_0x8c35('0x46')]=[{'model':db[_0x8c35('0x47')],'as':_0x8c35('0x59')}];}_0xaa9575=_['merge']({},_0xaa9575,_0x4215f4[_0x8c35('0x5a')]);if(!_[_0x8c35('0x35')](_0xaa9575['attributes'],'id')){_0xaa9575['attributes'][_0x8c35('0x49')]('id');}return db[_0x8c35('0x3d')][_0x8c35('0x5b')](_0xaa9575)[_0x8c35('0x29')](handleEntityNotFound(_0x442606,null))['then'](function(_0x589e6c){var _0x164d49=[];values=_0x589e6c;if(_0x4215f4[_0x8c35('0x44')][_0x8c35('0x5c')]===_0x8c35('0x4c')){_0x164d49[_0x8c35('0x49')](get_open_tabs(_0x8c35('0x4d'),_0x589e6c[_0x8c35('0x4e')]));_0x164d49[_0x8c35('0x49')](get_open_tabs(_0x8c35('0x5d'),_0x589e6c[_0x8c35('0x4e')]));_0x164d49['push'](get_open_tabs(_0x8c35('0x5e'),_0x589e6c[_0x8c35('0x4e')]));_0x164d49[_0x8c35('0x49')](get_open_tabs(_0x8c35('0x5f'),_0x589e6c[_0x8c35('0x4e')]));_0x164d49[_0x8c35('0x49')](get_open_tabs(_0x8c35('0x60'),_0x589e6c[_0x8c35('0x4e')]));_0x164d49['push'](get_open_tabs(_0x8c35('0x4f'),_0x589e6c[_0x8c35('0x4e')]));return Promise['all'](_0x164d49);}else{return values;}})['then'](function(){return values;})[_0x8c35('0x29')](respondWithResult(_0x442606,null))[_0x8c35('0x1f')](handleError(_0x442606,null));};exports[_0x8c35('0x28')]=function(_0x581cf6,_0x7f7c59){if(_0x581cf6[_0x8c35('0x61')]['id']){delete _0x581cf6[_0x8c35('0x61')]['id'];}delete _0x581cf6[_0x8c35('0x61')][_0x8c35('0x2d')];return db[_0x8c35('0x3d')]['find']({'where':{'id':_0x581cf6[_0x8c35('0x52')]['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0x7f7c59,null))['then'](saveUpdates(_0x581cf6[_0x8c35('0x61')],null))['then'](respondWithResult(_0x7f7c59,null))[_0x8c35('0x1f')](handleError(_0x7f7c59,null));};exports[_0x8c35('0x62')]=function(_0x1307ee,_0x34d491){return db[_0x8c35('0x3d')][_0x8c35('0x62')]()['then'](respondWithResult(_0x34d491,null))[_0x8c35('0x1f')](handleError(_0x34d491,null));};exports[_0x8c35('0x63')]=function(_0x33c39f,_0x4a14db){return db['User'][_0x8c35('0x5b')]({'where':{'id':_0x33c39f['params']['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0x4a14db,null))[_0x8c35('0x29')](function(_0x4bb96a){if(_0x4bb96a){return _0x4bb96a[_0x8c35('0x63')](_0x33c39f['body'][_0x8c35('0x64')],_[_0x8c35('0x65')](_0x33c39f['body'],[_0x8c35('0x64'),'id'])||{});}})[_0x8c35('0x29')](respondWithResult(_0x4a14db,null))[_0x8c35('0x1f')](handleError(_0x4a14db,null));};function validateUser(_0x4ce9af){return new Promise(function(_0x580b39,_0x56a458){if(_0x4ce9af['internal'])return _0x580b39(_0x4ce9af);return db[_0x8c35('0x66')][_0x8c35('0x67')](0x1)[_0x8c35('0x29')](function(_0x22f8e5){if(_0x22f8e5[_0x8c35('0x68')])authService[_0x8c35('0x69')](_0x4ce9af[_0x8c35('0x55')]);db[_0x8c35('0x3d')][_0x8c35('0x6a')](_0x8c35('0x6b'))[_0x8c35('0x29')](function(_0x7466c1){if(_[_0x8c35('0x6c')](_0x7466c1)){_0x4ce9af[_0x8c35('0x6b')]=_0x22f8e5[_0x8c35('0x6d')]||0x1;return;}if(_[_0x8c35('0x6c')](_0x22f8e5['min_internal'])||_0x22f8e5[_0x8c35('0x6d')]===_0x7466c1){_0x4ce9af[_0x8c35('0x6b')]=_0x7466c1+0x1;return;}if(_0x22f8e5[_0x8c35('0x6d')]>_0x7466c1){_0x4ce9af[_0x8c35('0x6b')]=_0x22f8e5[_0x8c35('0x6d')];return;}return db[_0x8c35('0x6e')]['query'](_0x8c35('0x6f'),{'type':db[_0x8c35('0x6e')][_0x8c35('0x70')]['SELECT']})[_0x8c35('0x29')](function(_0x5e42bb){if(_0x5e42bb&&_0x5e42bb['length']){for(var _0x53b1c9=0x0,_0x49bfd5=_0x5e42bb[_0x8c35('0x71')];_0x53b1c9<_0x49bfd5&&_['isNil'](_0x4ce9af[_0x8c35('0x6b')]);_0x53b1c9++){if(_0x22f8e5[_0x8c35('0x6d')]<=_0x5e42bb[_0x53b1c9][_0x8c35('0x72')]){_0x4ce9af[_0x8c35('0x6b')]=_0x5e42bb[_0x53b1c9][_0x8c35('0x72')];}else if(_0x22f8e5[_0x8c35('0x6d')]>_0x5e42bb[_0x53b1c9][_0x8c35('0x72')]&&_0x22f8e5[_0x8c35('0x6d')]<=_0x5e42bb[_0x53b1c9]['to']){_0x4ce9af[_0x8c35('0x6b')]=_0x22f8e5[_0x8c35('0x6d')];}}}if(_[_0x8c35('0x6c')](_0x4ce9af['internal'])){_0x4ce9af['internal']=_0x7466c1+0x1;}return _0x580b39(_0x4ce9af);});});})[_0x8c35('0x1f')](function(_0x6a4d33){_0x56a458(_0x6a4d33);});});}function updateUser(_0x652ad3){return new Promise(function(_0x364a3b,_0x13e742){try{if(_0x652ad3[_0x8c35('0x73')]){_0x652ad3['mailbox']=_0x652ad3[_0x8c35('0x6b')];_0x652ad3['VoiceMail']={'mailbox':_0x652ad3[_0x8c35('0x6b')],'password':_0x652ad3[_0x8c35('0x55')],'fullname':_0x652ad3['fullname'],'email':_0x652ad3['email']};}if(_0x652ad3[_0x8c35('0x2d')]===_0x8c35('0x2a')){if(!_0x652ad3[_0x8c35('0x74')])_0x652ad3[_0x8c35('0x74')]=['101',_0x8c35('0x75'),'103',_0x8c35('0x76'),_0x8c35('0x77'),'104','105','106','107','108',_0x8c35('0x78'),_0x8c35('0x79'),'111',_0x8c35('0x7a'),_0x8c35('0x7b')];}_0x364a3b(_0x652ad3);}catch(_0x442eb6){_0x13e742(_0x442eb6);}});}exports[_0x8c35('0x7c')]=function(_0x3f23bc,_0x375657){if(_0x3f23bc[_0x8c35('0x2e')]['role']===_0x8c35('0x2a'))throw new Error(_0x8c35('0x7d'));if(_0x3f23bc[_0x8c35('0x61')][_0x8c35('0x2d')]===_0x8c35('0x2e')&&_0x3f23bc[_0x8c35('0x2e')][_0x8c35('0x2d')]!==_0x8c35('0x7e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x3f23bc[_0x8c35('0x61')][_0x8c35('0x2d')]===_0x8c35('0x7e')&&_0x3f23bc[_0x8c35('0x2e')][_0x8c35('0x2d')]!==_0x8c35('0x7e')){throw new Error(_0x8c35('0x7f'));}return licenseUtil[_0x8c35('0x80')]([_0x3f23bc[_0x8c35('0x61')]])['then'](function(){return validateUser(_0x3f23bc['body']);})[_0x8c35('0x29')](function(_0x4f3425){return updateUser(_0x4f3425)[_0x8c35('0x29')](function(_0x7e3e53){if(_0x7e3e53['role']===_0x8c35('0x7e')){_0x7e3e53[_0x8c35('0x81')]=_0x3f23bc[_0x8c35('0x2e')][_0x8c35('0x81')];delete _0x7e3e53['userProfileId'];}return _0x7e3e53;});})[_0x8c35('0x29')](function(_0xba3a5c){return db[_0x8c35('0x3d')][_0x8c35('0x7c')](_0xba3a5c,{'include':[{'model':db['VoiceMail'],'as':_0x8c35('0x82')}]});})['then'](function(_0xc9077b){if(_0x3f23bc[_0x8c35('0x61')][_0x8c35('0x2d')]==='user')return _0xc9077b;if(_0x3f23bc['user'][_0x8c35('0x2d')]!=='user')return _0xc9077b;return db[_0x8c35('0x83')]['find']({'where':{'name':_0xc9077b[_0x8c35('0x2d')]===_0x8c35('0x2a')?_0x8c35('0x2f'):_0x8c35('0x30'),'userProfileId':_0x3f23bc[_0x8c35('0x2e')][_0x8c35('0x84')]},'raw':!![]})[_0x8c35('0x29')](function(_0x42b36c){if(!_0x42b36c||_0x42b36c[_0x8c35('0x85')]!=0x0)return _0xc9077b;return db[_0x8c35('0x36')]['create']({'name':_0xc9077b[_0x8c35('0x3a')],'resourceId':_0xc9077b['id'],'type':_0x42b36c['name'],'sectionId':_0x42b36c['id']},{})[_0x8c35('0x29')](function(){return _0xc9077b;});})[_0x8c35('0x1f')](function(_0xb36103){logger[_0x8c35('0x1b')](_0x8c35('0x86'),_0xb36103);throw _0xb36103;});})[_0x8c35('0x29')](respondWithResult(_0x375657,0xc9))['catch'](handleError(_0x375657,null));};exports[_0x8c35('0x87')]=function(_0x46bbc5,_0x428407){var _0x11db7e=_0x46bbc5[_0x8c35('0x61')];var _0x4ee9eb=[];if(_0x46bbc5['user'][_0x8c35('0x2d')]===_0x8c35('0x2a'))throw new Error(_0x8c35('0x7d'));if(_[_0x8c35('0x88')](_0x11db7e,[_0x8c35('0x2d'),_0x8c35('0x2e')])&&_0x46bbc5[_0x8c35('0x2e')][_0x8c35('0x2d')]!==_0x8c35('0x7e')){throw new Error(_0x8c35('0x89'));}if(_[_0x8c35('0x88')](_0x11db7e,[_0x8c35('0x2d'),'admin'])&&_0x46bbc5[_0x8c35('0x2e')]['role']!=='admin'){throw new Error(_0x8c35('0x8a'));}return licenseUtil[_0x8c35('0x80')](_0x11db7e)[_0x8c35('0x29')](function(){return validateUser(_0x11db7e[0x0]);})[_0x8c35('0x29')](function(){for(var _0x29c740=0x1;_0x29c740<_0x11db7e[_0x8c35('0x71')];_0x29c740++){var _0x11bedc=_0x11db7e[_0x29c740-0x1][_0x8c35('0x6b')];if(!_0x11db7e[_0x29c740][_0x8c35('0x6b')])_0x11db7e[_0x29c740][_0x8c35('0x6b')]=_0x11bedc+0x1;_0x4ee9eb['push'](validateUser(_0x11db7e[_0x29c740]));}return Promise[_0x8c35('0x50')](_0x4ee9eb);})[_0x8c35('0x29')](function(){_0x4ee9eb=[];for(var _0x1d2682=0x0;_0x1d2682<_0x11db7e[_0x8c35('0x71')];_0x1d2682++){_0x4ee9eb['push'](updateUser(_0x11db7e[_0x1d2682]));}return Promise[_0x8c35('0x50')](_0x4ee9eb);})['then'](function(){_0x4ee9eb=_0x11db7e['map'](function(_0x2efa49){return db[_0x8c35('0x3d')][_0x8c35('0x7c')](_0x2efa49,{'include':[{'model':db[_0x8c35('0x82')],'as':'VoiceMail'}]})[_0x8c35('0x29')](function(_0x582cba){_0x2efa49['id']=_0x582cba['id'];return _0x2efa49;});});return Promise[_0x8c35('0x50')](_0x4ee9eb);})[_0x8c35('0x29')](function(_0x3cde51){if(_0x46bbc5[_0x8c35('0x61')][_0x8c35('0x2d')]===_0x8c35('0x2e'))return _0x3cde51;if(_0x46bbc5[_0x8c35('0x2e')]['role']!==_0x8c35('0x2e'))return _0x3cde51;var _0x4ab9dd=_[_0x8c35('0x88')](_0x3cde51,function(_0x950743){return _0x950743[_0x8c35('0x2d')]==='agent'||_0x950743[_0x8c35('0x2d')]===_0x8c35('0x31');});if(!_0x4ab9dd)return _0x3cde51;return db[_0x8c35('0x83')]['findAll']({'where':{'name':{'$or':[_0x8c35('0x2f'),_0x8c35('0x30')]},'userProfileId':_0x46bbc5[_0x8c35('0x2e')][_0x8c35('0x84')]},'raw':!![]})[_0x8c35('0x29')](function(_0xd7c76){if(_[_0x8c35('0x8b')](_0xd7c76)||!_[_0x8c35('0x88')](_0xd7c76,['autoAssociation',0x0]))return _0x3cde51;_0x4ee9eb=[];var _0xfde0e0=_(_0xd7c76)[_0x8c35('0x33')](function(_0x18a0c8){if(_0x18a0c8[_0x8c35('0x85')]===0x1)return;return _0x18a0c8[_0x8c35('0x3a')]===_0x8c35('0x2f')?_0x8c35('0x2a'):_0x8c35('0x31');})[_0x8c35('0x8c')]()[_0x8c35('0x34')]();for(var _0x424a13=0x0;_0x424a13<_0x3cde51[_0x8c35('0x71')];_0x424a13++){if(!_[_0x8c35('0x35')](_0xfde0e0,_0x3cde51[_0x424a13]['role']))return;var _0x1a2d72=_0x3cde51[_0x424a13][_0x8c35('0x2d')]===_0x8c35('0x2a')?_0x8c35('0x2f'):_0x8c35('0x30');_0x4ee9eb['push'](db['UserProfileResource']['create']({'name':_0x3cde51[_0x424a13][_0x8c35('0x3a')],'resourceId':_0x3cde51[_0x424a13]['id'],'type':_0x1a2d72,'sectionId':_[_0x8c35('0x5b')](_0xd7c76,[_0x8c35('0x3a'),_0x1a2d72])['id']},{}));}return Promise[_0x8c35('0x50')](_0x4ee9eb);});})[_0x8c35('0x29')](respondWithResult(_0x428407,0xc9))[_0x8c35('0x1f')](handleError(_0x428407,null));};exports[_0x8c35('0x8d')]=function(_0x30a172,_0x1544d1){if(_0x30a172[_0x8c35('0x61')]['id']){delete _0x30a172[_0x8c35('0x61')]['id'];}return db[_0x8c35('0x3d')]['find']({'where':{'id':_0x30a172[_0x8c35('0x52')]['id']}})[_0x8c35('0x29')](function(_0x84f77d){if(!_0x84f77d)return null;if(_0x84f77d['id']===_0x30a172['user']['id']){if(!_0x30a172[_0x8c35('0x61')]['oldPassword']||!_0x30a172[_0x8c35('0x61')][_0x8c35('0x8e')]){throw new db[(_0x8c35('0x8f'))][(_0x8c35('0x90'))](_0x8c35('0x91'));}if(!_0x84f77d['authenticate'](_0x30a172[_0x8c35('0x61')][_0x8c35('0x92')])){throw new db[(_0x8c35('0x8f'))][(_0x8c35('0x90'))](_0x8c35('0x93'));}if(_0x30a172['body'][_0x8c35('0x92')]===_0x30a172[_0x8c35('0x61')][_0x8c35('0x8e')]){throw new db[(_0x8c35('0x8f'))]['ValidationError'](_0x8c35('0x94'));}}else if(_0x30a172['user'][_0x8c35('0x2d')]==='admin'){if(!_0x30a172[_0x8c35('0x61')]['newPassword']){throw new db[(_0x8c35('0x8f'))]['ValidationError'](_0x8c35('0x95'));}}else if(_0x30a172[_0x8c35('0x2e')]['role']===_0x8c35('0x2e')){if(!_0x30a172[_0x8c35('0x61')][_0x8c35('0x8e')]){throw new db[(_0x8c35('0x8f'))][(_0x8c35('0x90'))](_0x8c35('0x95'));}if(_0x84f77d[_0x8c35('0x2d')]!==_0x8c35('0x2a')){throw new db[(_0x8c35('0x8f'))][(_0x8c35('0x90'))](_0x8c35('0x7d'));}}else{throw new db['Sequelize'][(_0x8c35('0x90'))](_0x8c35('0x7d'));}return _0x84f77d;})['then'](handleEntityNotFound(_0x1544d1,null))[_0x8c35('0x29')](function(_0x203839){return db[_0x8c35('0x66')][_0x8c35('0x96')]({'attributes':['id','securePassword',_0x8c35('0x97'),_0x8c35('0x98')]})[_0x8c35('0x29')](function(_0x21fba7){if(_0x21fba7['securePassword'])authService[_0x8c35('0x69')](_0x30a172[_0x8c35('0x61')][_0x8c35('0x8e')]);if(!_0x21fba7[_0x8c35('0x97')]||!_0x203839[_0x8c35('0x99')])return _0x203839;authService[_0x8c35('0x9a')](_0x30a172[_0x8c35('0x61')]['newPassword'],_0x203839[_0x8c35('0x99')],_0x21fba7['passwordHistoryLimit']);return _0x203839;})[_0x8c35('0x29')](saveUpdates({'password':_0x30a172[_0x8c35('0x61')][_0x8c35('0x8e')],'passwordResetAt':_0x30a172[_0x8c35('0x2e')]['id']==_0x30a172['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x30a172['body'][_0x8c35('0x8e')],_0x203839[_0x8c35('0x99')])},null));})[_0x8c35('0x29')](respondWithResult(_0x1544d1,null))[_0x8c35('0x1f')](handleError(_0x1544d1,null));};exports[_0x8c35('0x9b')]=function(_0x9165d1,_0x5a1563){var _0x3129c6=_0x9165d1[_0x8c35('0x61')][_0x8c35('0x9c')];return db[_0x8c35('0x3d')][_0x8c35('0x5b')]({'where':{'id':_0x9165d1['params']['id']},'attributes':['id','name',_0x8c35('0x2d'),_0x8c35('0x9d'),_0x8c35('0x9e'),_0x8c35('0x9f'),_0x8c35('0xa0')]})['then'](handleEntityNotFound(_0x5a1563,null))[_0x8c35('0x29')](function(_0x4bafad){if(_0x4bafad){if(!utils[_0x8c35('0xa1')](_0x3129c6)){throw new db[(_0x8c35('0x8f'))][(_0x8c35('0x90'))]('Unknown\x20channel');}return _0x4bafad[_0x8c35('0xa2')+_[_0x8c35('0xa3')](_0x3129c6[_0x8c35('0xa4')]())+_0x8c35('0xa5')](_0x9165d1[_0x8c35('0x61')]['ids'],{'penalty':_0x9165d1[_0x8c35('0x61')]['penalty']||0x0})[_0x8c35('0xa6')](function(_0x66d8f3){for(var _0x9b4e2c=0x0;_0x9b4e2c<_0x9165d1[_0x8c35('0x61')][_0x8c35('0x64')]['length'];_0x9b4e2c+=0x1){var _0x1506d6={'UserId':Number(_0x9165d1[_0x8c35('0x52')]['id'])};_0x1506d6[_['capitalize'](_0x3129c6[_0x8c35('0xa4')]())+_0x8c35('0xa7')]=Number(_0x9165d1['body']['ids'][_0x9b4e2c]);socket['emit']('user'+_['capitalize'](_0x3129c6[_0x8c35('0xa4')]())+'Queue:save',_0x1506d6);}return _0x66d8f3;})['then'](function(){if(_0x3129c6===_0x8c35('0xa8')){return db[_0x8c35('0xa9')][_0x8c35('0x4a')]({'where':{'id':_0x9165d1[_0x8c35('0x61')][_0x8c35('0x64')]||[]},'raw':!![],'attributes':['id',_0x8c35('0x3a')]});}})['then'](function(_0xbdf917){var _0x36a8bc=_0x4bafad['get']({'plain':!![]});var _0x2522d1=[];if(_0x3129c6===_0x8c35('0xa8')&&_0x36a8bc[_0x8c35('0x2d')]===_0x8c35('0x2a')&&_0x36a8bc[_0x8c35('0x9d')]){for(let _0x31aef0=0x0;_0x31aef0<_0xbdf917['length'];_0x31aef0+=0x1){_0x2522d1[_0x8c35('0x49')]({'membername':_0x36a8bc[_0x8c35('0x3a')],'UserId':_0x36a8bc['id'],'queue_name':_0xbdf917[_0x31aef0][_0x8c35('0x3a')],'VoiceQueueId':_0xbdf917[_0x31aef0]['id'],'interface':_[_0x8c35('0x6c')](_0x36a8bc['interface'])?util[_0x8c35('0xaa')](_0x8c35('0xab'),_0x36a8bc['name']):_0x36a8bc['interface'],'paused':_0x36a8bc[_0x8c35('0x9f')]||![],'penalty':_0x9165d1['body'][_0x8c35('0xac')]||0x0});}return Promise[_0x8c35('0x50')](_0x2522d1[_0x8c35('0x33')](function(_0x3d955a){return db['UserVoiceQueueRt'][_0x8c35('0xad')](_0x3d955a);}));}return _0x4bafad;});}})[_0x8c35('0x29')](respondWithStatusCode(_0x5a1563,null))[_0x8c35('0x1f')](handleError(_0x5a1563,null));};exports[_0x8c35('0xae')]=function(_0x59b7d4,_0x5a0667){var _0x5c24e3,_0x32e63c;return db[_0x8c35('0x3d')][_0x8c35('0x5b')]({'where':{'id':_0x59b7d4[_0x8c35('0x52')]['id']},'attributes':['id',_0x8c35('0x3a'),_0x8c35('0x2d')]})['then'](handleEntityNotFound(_0x5a0667,null))[_0x8c35('0x29')](function(_0x158f7f){if(_0x158f7f){_0x5c24e3=_0x158f7f;if(!_0x59b7d4[_0x8c35('0x44')][_0x8c35('0x9c')]||!utils['isValidChannel'](_0x59b7d4[_0x8c35('0x44')]['channel'])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x158f7f[_0x8c35('0xaf')+_[_0x8c35('0xa3')](_0x59b7d4[_0x8c35('0x44')][_0x8c35('0x9c')][_0x8c35('0xa4')]())+_0x8c35('0xa5')](_0x59b7d4['query']['ids']);}})[_0x8c35('0x29')](function(_0x250932){if(_[_0x8c35('0xb0')](_0x59b7d4[_0x8c35('0x44')][_0x8c35('0x64')])){for(var _0x171dd0=0x0;_0x171dd0<_0x59b7d4['query'][_0x8c35('0x64')][_0x8c35('0x71')];_0x171dd0+=0x1){_0x32e63c={'UserId':Number(_0x59b7d4['params']['id'])};_0x32e63c[_[_0x8c35('0xa3')](_0x59b7d4['query'][_0x8c35('0x9c')][_0x8c35('0xa4')]())+_0x8c35('0xa7')]=Number(_0x59b7d4[_0x8c35('0x44')][_0x8c35('0x64')][_0x171dd0]);socket[_0x8c35('0x2b')](_0x8c35('0x2e')+_[_0x8c35('0xa3')](_0x59b7d4[_0x8c35('0x44')][_0x8c35('0x9c')][_0x8c35('0xa4')]())+_0x8c35('0xb1'),_0x32e63c);}}else{_0x32e63c={'UserId':Number(_0x59b7d4['params']['id'])};_0x32e63c[_[_0x8c35('0xa3')](_0x59b7d4['query'][_0x8c35('0x9c')][_0x8c35('0xa4')]())+_0x8c35('0xa7')]=Number(_0x59b7d4['query']['ids']);socket[_0x8c35('0x2b')](_0x8c35('0x2e')+_[_0x8c35('0xa3')](_0x59b7d4[_0x8c35('0x44')][_0x8c35('0x9c')]['toLowerCase']())+_0x8c35('0xb1'),_0x32e63c);}return _0x250932;})['then'](function(){if(_0x59b7d4[_0x8c35('0x44')][_0x8c35('0x9c')]==='voice'){return db[_0x8c35('0xb2')][_0x8c35('0x37')]({'where':{'UserId':_0x59b7d4['params']['id'],'VoiceQueueId':_0x59b7d4['query'][_0x8c35('0x64')]},'individualHooks':!![]})[_0x8c35('0x29')](function(){return _0x5c24e3;});}return _0x5c24e3;})['then'](respondWithStatusCode(_0x5a0667,null))[_0x8c35('0x1f')](handleError(_0x5a0667,null));};exports[_0x8c35('0xb3')]=function(_0x432f26,_0x5399fa){_0x432f26['body'][_0x8c35('0xb4')]=_0x432f26[_0x8c35('0xb5')][_0x8c35('0xb6')];return db[_0x8c35('0x3d')][_0x8c35('0x5b')]({'where':{'id':_0x432f26[_0x8c35('0x52')]['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0x5399fa,null))['then'](saveUpdates(_0x432f26[_0x8c35('0x61')],null))['then'](respondWithResult(_0x5399fa,null))['catch'](handleError(_0x5399fa,null));};exports[_0x8c35('0xb7')]=function(_0x3cfda8,_0x1fbddc){var _0x3fee96=path['join'](config[_0x8c35('0xb8')],_0x8c35('0xb9'));return db[_0x8c35('0x3d')][_0x8c35('0x5b')]({'where':{'id':_0x3cfda8[_0x8c35('0x52')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x8c35('0x29')](handleEntityNotFound(_0x1fbddc,null))[_0x8c35('0x29')](function(_0x25d90c){if(_0x25d90c){if(_[_0x8c35('0x6c')](_0x25d90c[_0x8c35('0xb4')])){return _0x1fbddc['download'](_0x3fee96);}else{if(!fs[_0x8c35('0xba')](path[_0x8c35('0xbb')](config['root'],_0x8c35('0xbc'),_0x25d90c[_0x8c35('0xb4')]))){return _0x1fbddc[_0x8c35('0xbd')](_0x3fee96);}return _0x1fbddc[_0x8c35('0xbd')](path['join'](config[_0x8c35('0xb8')],_0x8c35('0xbc'),_0x25d90c[_0x8c35('0xb4')]));}}})['catch'](handleError(_0x1fbddc,null));};exports['getOpenTabs']=function(_0xc13b6,_0x504534){return db[_0x8c35('0x3d')][_0x8c35('0x5b')]({'where':{'id':_0xc13b6['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x504534,null))[_0x8c35('0x29')](function(_0x49c144){var _0x37b92f=[];values=_0x49c144['dataValues'];_0x37b92f[_0x8c35('0x49')](get_open_tabs('chat',_0x49c144['dataValues']));_0x37b92f[_0x8c35('0x49')](get_open_tabs(_0x8c35('0x5d'),_0x49c144['dataValues']));_0x37b92f[_0x8c35('0x49')](get_open_tabs(_0x8c35('0x5e'),_0x49c144['dataValues']));_0x37b92f[_0x8c35('0x49')](get_open_tabs(_0x8c35('0x5f'),_0x49c144['dataValues']));_0x37b92f[_0x8c35('0x49')](get_open_tabs('fax',_0x49c144[_0x8c35('0x4e')]));_0x37b92f[_0x8c35('0x49')](get_open_tabs('mail',_0x49c144['dataValues']));return Promise[_0x8c35('0x50')](_0x37b92f);})[_0x8c35('0x29')](function(_0x4a6eb1){if(_0x4a6eb1){var _0x20df40=_['map'](values[_0x8c35('0xbe')],function(_0x307b29){return{'channel':_0x8c35('0xbf'),'id':_0x307b29['id'],'createdAt':_0x307b29[_0x8c35('0xc0')]};});var _0x49ae48=_[_0x8c35('0x33')](values[_0x8c35('0xc1')],function(_0x110043){return{'channel':'FAX','id':_0x110043['id'],'createdAt':_0x110043[_0x8c35('0xc0')]};});var _0x479356=_['map'](values[_0x8c35('0xc2')],function(_0x45e732){return{'channel':_0x8c35('0xc3'),'id':_0x45e732['id'],'createdAt':_0x45e732['createdAt']};});var _0x20b078=_['map'](values[_0x8c35('0xc4')],function(_0x25c385){return{'channel':_0x8c35('0xc5'),'id':_0x25c385['id'],'createdAt':_0x25c385[_0x8c35('0xc0')]};});var _0x3e4186=_[_0x8c35('0x33')](values['SmsOpenTabs'],function(_0x535c86){return{'channel':'SMS','id':_0x535c86['id'],'createdAt':_0x535c86[_0x8c35('0xc0')]};});var _0x4e6fb4=_[_0x8c35('0x33')](values['WhatsappOpenTabs'],function(_0x133874){return{'channel':_0x8c35('0xc6'),'id':_0x133874['id'],'createdAt':_0x133874[_0x8c35('0xc0')]};});var _0x123a35=_['concat'](_0x20df40,_0x49ae48,_0x479356,_0x20b078,_0x3e4186,_0x4e6fb4);var _0x52948e={'count':_0x123a35[_0x8c35('0x71')],'rows':_0x123a35};return _0x52948e;}else return null;})['then'](respondWithResult(_0x504534,null))[_0x8c35('0x1f')](handleError(_0x504534,null));};exports['getContacts']=function(_0x3505fb,_0x241bb0){var _0xb3d8c0={};var _0x25db3d={};var _0x35a7df;var _0x361bd7;return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0x3505fb[_0x8c35('0x52')]['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0x241bb0,null))[_0x8c35('0x29')](function(_0x1a0ac2){if(_0x1a0ac2){_0x35a7df=_0x1a0ac2;_0x25db3d[_0x8c35('0x53')]=_[_0x8c35('0x54')](db[_0x8c35('0xc7')][_0x8c35('0x3e')]);_0x25db3d['query']=_[_0x8c35('0x54')](_0x3505fb['query']);_0x25db3d[_0x8c35('0x56')]=_[_0x8c35('0x57')](_0x25db3d['model'],_0x25db3d[_0x8c35('0x44')]);_0xb3d8c0[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0x25db3d['model'],qs[_0x8c35('0x58')](_0x3505fb['query'][_0x8c35('0x58')]));_0xb3d8c0[_0x8c35('0x48')]=_0xb3d8c0[_0x8c35('0x48')][_0x8c35('0x71')]?_0xb3d8c0[_0x8c35('0x48')]:_0x25db3d['model'];_0xb3d8c0[_0x8c35('0xc8')]=qs[_0x8c35('0xc9')](_0x3505fb['query']['sort']);_0xb3d8c0[_0x8c35('0x43')]=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0x3505fb[_0x8c35('0x44')],_0x25db3d[_0x8c35('0x56')]));if(_0x3505fb[_0x8c35('0x44')]['filter']){_0xb3d8c0[_0x8c35('0x43')]=_[_0x8c35('0xcb')](_0xb3d8c0[_0x8c35('0x43')],{'$or':_['map'](_0xb3d8c0[_0x8c35('0x48')],function(_0x573356){var _0x117033={};_0x117033[_0x573356]={'$like':'%'+_0x3505fb[_0x8c35('0x44')]['filter']+'%'};return _0x117033;})});}_0xb3d8c0=_[_0x8c35('0xcb')]({},_0xb3d8c0,_0x3505fb[_0x8c35('0x5a')]);return _0x35a7df['getContacts'](_0xb3d8c0);}})['then'](function(_0x21c3c3){if(_0x21c3c3){_0x361bd7=_0x21c3c3['length'];if(_0x3505fb[_0x8c35('0x44')][_0x8c35('0xcc')](_0x8c35('0x45'))){_0xb3d8c0['include']=[{'model':db[_0x8c35('0xcd')],'as':'List','required':![]},{'model':db[_0x8c35('0xce')],'as':_0x8c35('0xcf'),'attributes':['id',_0x8c35('0x3a'),'color'],'where':_0x3505fb[_0x8c35('0x44')]['tag']?{'id':_0x3505fb[_0x8c35('0x44')][_0x8c35('0xd0')]}:undefined,'required':_0x3505fb['query']['tag']?!![]:![]}];}if(!_0x3505fb[_0x8c35('0x44')]['hasOwnProperty']('nolimit')){_0xb3d8c0['limit']=qs[_0x8c35('0x23')](_0x3505fb[_0x8c35('0x44')][_0x8c35('0x23')]);_0xb3d8c0[_0x8c35('0x22')]=qs['offset'](_0x3505fb['query'][_0x8c35('0x22')]);}return _0x35a7df[_0x8c35('0xd1')](_0xb3d8c0);}})['then'](function(_0x122f75){if(_0x122f75){return _0x122f75?{'count':_0x361bd7,'rows':_0x122f75}:null;}})['then'](respondWithResult(_0x241bb0,null))[_0x8c35('0x1f')](handleError(_0x241bb0,null));};exports[_0x8c35('0xd2')]=function(_0x4b272a,_0x1ef3e9){var _0x18afe0;var _0xbbddc5={};var _0x3934e2;return db[_0x8c35('0x3d')]['findOne']({'where':{'id':_0x4b272a['params']['id']},'attributes':['id',_0x8c35('0x3a'),_0x8c35('0x2d')]})['then'](handleEntityNotFound(_0x1ef3e9,null))[_0x8c35('0x29')](function(_0x172565){if(!utils[_0x8c35('0xa1')](_0x4b272a[_0x8c35('0x44')][_0x8c35('0x9c')])){throw new db[(_0x8c35('0x8f'))][(_0x8c35('0x90'))]('Unknown\x20channel');}_0x18afe0=_0x172565;var _0xa7b682={};_0xa7b682[_0x8c35('0x53')]=_[_0x8c35('0x54')](db[_[_0x8c35('0xa3')](_0x4b272a['query'][_0x8c35('0x9c')])+_0x8c35('0xd3')][_0x8c35('0x3e')]);_0xa7b682['query']=_[_0x8c35('0x54')](_0x4b272a['query']);_0xa7b682['filters']=_['intersection'](_0xa7b682[_0x8c35('0x53')],_0xa7b682['query']);_0xbbddc5[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0xa7b682[_0x8c35('0x53')],qs['fields'](_0x4b272a[_0x8c35('0x44')][_0x8c35('0x58')]));_0xbbddc5['attributes']=_0xbbddc5['attributes'][_0x8c35('0x71')]?_0xbbddc5['attributes']:_0xa7b682[_0x8c35('0x53')];_0xbbddc5[_0x8c35('0xc8')]=qs[_0x8c35('0xc9')](_0x4b272a[_0x8c35('0x44')]['sort']);_0xbbddc5['where']=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0x4b272a[_0x8c35('0x44')],_0xa7b682[_0x8c35('0x56')]));if(_0x4b272a[_0x8c35('0x44')]['filter']){_0xbbddc5[_0x8c35('0x43')]=_['merge'](_0xbbddc5[_0x8c35('0x43')],{'$or':_['map'](_0xbbddc5[_0x8c35('0x48')],function(_0x16f078){var _0x101d8f={};_0x101d8f[_0x16f078]={'$like':'%'+_0x4b272a[_0x8c35('0x44')]['filter']+'%'};return _0x101d8f;})});}_0xbbddc5=_[_0x8c35('0xcb')]({},_0xbbddc5,_0x4b272a['options']);switch(_0x18afe0[_0x8c35('0x2d')]){case'admin':return db[_[_0x8c35('0xa3')](_0x4b272a['query'][_0x8c35('0x9c')])+'Queue'][_0x8c35('0x4a')](_0xbbddc5);case _0x8c35('0x2e'):case _0x8c35('0x2a'):return _0x18afe0[_0x8c35('0x2c')+_[_0x8c35('0xa3')](_0x4b272a[_0x8c35('0x44')][_0x8c35('0x9c')])+_0x8c35('0xa5')](_0xbbddc5);default:throw new db[(_0x8c35('0x8f'))][(_0x8c35('0x90'))](_0x8c35('0xd4'));}})[_0x8c35('0x29')](function(_0x1282df){_0x3934e2=_0x1282df[_0x8c35('0x71')];if(!_0x4b272a['query']['hasOwnProperty'](_0x8c35('0xd5'))){_0xbbddc5[_0x8c35('0x23')]=qs[_0x8c35('0x23')](_0x4b272a[_0x8c35('0x44')]['limit']);_0xbbddc5[_0x8c35('0x22')]=qs[_0x8c35('0x22')](_0x4b272a[_0x8c35('0x44')][_0x8c35('0x22')]);}switch(_0x18afe0[_0x8c35('0x2d')]){case _0x8c35('0x7e'):return db[_[_0x8c35('0xa3')](_0x4b272a[_0x8c35('0x44')]['channel'])+_0x8c35('0xd3')][_0x8c35('0x4a')](_0xbbddc5);case _0x8c35('0x2e'):case _0x8c35('0x2a'):return _0x18afe0[_0x8c35('0x2c')+_[_0x8c35('0xa3')](_0x4b272a[_0x8c35('0x44')]['channel'])+_0x8c35('0xa5')](_0xbbddc5);}})[_0x8c35('0x29')](function(_0x1a5d02){return{'count':_0x3934e2,'rows':_0x1a5d02};})[_0x8c35('0x29')](respondWithResult(_0x1ef3e9,null))[_0x8c35('0x1f')](handleError(_0x1ef3e9,null));};exports['getVoiceQueuesRt']=function(_0x30f5d7,_0x59b7dc){var _0x3dccc7={};var _0x304b6b={};var _0x97d16b;var _0x52366a;return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0x30f5d7[_0x8c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x59b7dc,null))[_0x8c35('0x29')](function(_0x1080d8){if(_0x1080d8){_0x97d16b=_0x1080d8;_0x304b6b[_0x8c35('0x53')]=_[_0x8c35('0x54')](db[_0x8c35('0xb2')][_0x8c35('0x3e')]);_0x304b6b['query']=_[_0x8c35('0x54')](_0x30f5d7[_0x8c35('0x44')]);_0x304b6b[_0x8c35('0x56')]=_[_0x8c35('0x57')](_0x304b6b['model'],_0x304b6b['query']);_0x3dccc7[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0x304b6b[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0x30f5d7[_0x8c35('0x44')][_0x8c35('0x58')]));_0x3dccc7[_0x8c35('0x48')]=_0x3dccc7[_0x8c35('0x48')][_0x8c35('0x71')]?_0x3dccc7['attributes']:_0x304b6b['model'];_0x3dccc7['order']=qs['sort'](_0x30f5d7[_0x8c35('0x44')][_0x8c35('0xc9')]);_0x3dccc7[_0x8c35('0x43')]=qs[_0x8c35('0x56')](_['pick'](_0x30f5d7[_0x8c35('0x44')],_0x304b6b['filters']));if(_0x30f5d7['query'][_0x8c35('0xd6')]){_0x3dccc7['where']=_['merge'](_0x3dccc7[_0x8c35('0x43')],{'$or':_['map'](_0x3dccc7[_0x8c35('0x48')],function(_0x13d942){var _0x109f4c={};_0x109f4c[_0x13d942]={'$like':'%'+_0x30f5d7['query'][_0x8c35('0xd6')]+'%'};return _0x109f4c;})});}_0x3dccc7=_['merge']({},_0x3dccc7,_0x30f5d7['options']);return _0x97d16b[_0x8c35('0xd7')](_0x3dccc7);}})[_0x8c35('0x29')](function(_0x451366){if(_0x451366){_0x52366a=_0x451366[_0x8c35('0x71')];if(!_0x30f5d7[_0x8c35('0x44')][_0x8c35('0xcc')](_0x8c35('0xd5'))){_0x3dccc7[_0x8c35('0x23')]=qs[_0x8c35('0x23')](_0x30f5d7[_0x8c35('0x44')][_0x8c35('0x23')]);_0x3dccc7['offset']=qs[_0x8c35('0x22')](_0x30f5d7[_0x8c35('0x44')][_0x8c35('0x22')]);}return _0x97d16b['getVoiceQueuesRt'](_0x3dccc7);}})[_0x8c35('0x29')](function(_0x57f35f){if(_0x57f35f){return _0x57f35f?{'count':_0x52366a,'rows':_0x57f35f}:null;}})[_0x8c35('0x29')](respondWithResult(_0x59b7dc,null))[_0x8c35('0x1f')](handleError(_0x59b7dc,null));};exports['getGroups']=function(_0x34d613,_0x503a16){var _0x5c1678={};var _0x14c7f4={};var _0x28b008;var _0x458fdc;return db['User'][_0x8c35('0x96')]({'where':{'id':_0x34d613[_0x8c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x503a16,null))[_0x8c35('0x29')](function(_0x95fa8){if(_0x95fa8){_0x28b008=_0x95fa8;_0x14c7f4[_0x8c35('0x53')]=_[_0x8c35('0x54')](db[_0x8c35('0xd8')][_0x8c35('0x3e')]);_0x14c7f4['query']=_['keys'](_0x34d613['query']);_0x14c7f4[_0x8c35('0x56')]=_[_0x8c35('0x57')](_0x14c7f4['model'],_0x14c7f4['query']);_0x5c1678[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0x14c7f4[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0x34d613['query'][_0x8c35('0x58')]));_0x5c1678[_0x8c35('0x48')]=_0x5c1678['attributes'][_0x8c35('0x71')]?_0x5c1678['attributes']:_0x14c7f4['model'];_0x5c1678['order']=qs[_0x8c35('0xc9')](_0x34d613['query'][_0x8c35('0xc9')]);_0x5c1678[_0x8c35('0x43')]=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0x34d613['query'],_0x14c7f4[_0x8c35('0x56')]));if(_0x34d613[_0x8c35('0x44')][_0x8c35('0xd6')]){_0x5c1678[_0x8c35('0x43')]=_[_0x8c35('0xcb')](_0x5c1678[_0x8c35('0x43')],{'$or':_[_0x8c35('0x33')](_0x5c1678[_0x8c35('0x48')],function(_0x36c834){var _0x243545={};_0x243545[_0x36c834]={'$like':'%'+_0x34d613[_0x8c35('0x44')][_0x8c35('0xd6')]+'%'};return _0x243545;})});}_0x5c1678=_[_0x8c35('0xcb')]({},_0x5c1678,_0x34d613['options']);return _0x28b008['getGroups'](_0x5c1678);}})[_0x8c35('0x29')](function(_0x3b312a){if(_0x3b312a){_0x458fdc=_0x3b312a[_0x8c35('0x71')];if(!_0x34d613[_0x8c35('0x44')]['hasOwnProperty'](_0x8c35('0xd5'))){_0x5c1678['limit']=qs[_0x8c35('0x23')](_0x34d613[_0x8c35('0x44')][_0x8c35('0x23')]);_0x5c1678['offset']=qs[_0x8c35('0x22')](_0x34d613['query']['offset']);}return _0x28b008['getGroups'](_0x5c1678);}})[_0x8c35('0x29')](function(_0x3947e3){if(_0x3947e3){return _0x3947e3?{'count':_0x458fdc,'rows':_0x3947e3}:null;}})[_0x8c35('0x29')](respondWithResult(_0x503a16,null))[_0x8c35('0x1f')](handleError(_0x503a16,null));};exports[_0x8c35('0xd9')]=function(_0x29dea9,_0x9db7d1){var _0xf62881={'raw':!![],'where':{}};var _0x49eb07={};var _0x5e0911={'count':0x0,'rows':[]};return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0x29dea9['params']['id']}})['then'](handleEntityNotFound(_0x9db7d1,null))[_0x8c35('0x29')](function(_0x35fd95){if(_0x35fd95){_0x49eb07[_0x8c35('0x53')]=_[_0x8c35('0x54')](db[_0x8c35('0xda')]['rawAttributes']);_0x49eb07[_0x8c35('0x44')]=_['keys'](_0x29dea9[_0x8c35('0x44')]);_0x49eb07[_0x8c35('0x56')]=_[_0x8c35('0x57')](_0x49eb07[_0x8c35('0x53')],_0x49eb07['query']);_0xf62881['attributes']=_[_0x8c35('0x57')](_0x49eb07[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0x29dea9['query'][_0x8c35('0x58')]));_0xf62881[_0x8c35('0x48')]=_0xf62881[_0x8c35('0x48')]['length']?_0xf62881[_0x8c35('0x48')]:_0x49eb07[_0x8c35('0x53')];if(!_0x29dea9['query'][_0x8c35('0xcc')](_0x8c35('0xd5'))){_0xf62881[_0x8c35('0x23')]=qs[_0x8c35('0x23')](_0x29dea9['query'][_0x8c35('0x23')]);_0xf62881[_0x8c35('0x22')]=qs[_0x8c35('0x22')](_0x29dea9[_0x8c35('0x44')][_0x8c35('0x22')]);}_0xf62881[_0x8c35('0xc8')]=qs[_0x8c35('0xc9')](_0x29dea9[_0x8c35('0x44')][_0x8c35('0xc9')]);_0xf62881[_0x8c35('0x43')]=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0x29dea9['query'],_0x49eb07['filters']));_0xf62881[_0x8c35('0x43')][_0x8c35('0xdb')]=_0x35fd95['id'];if(_0x29dea9[_0x8c35('0x44')][_0x8c35('0xd6')]){_0xf62881[_0x8c35('0x43')]=_[_0x8c35('0xcb')](_0xf62881[_0x8c35('0x43')],{'$or':_[_0x8c35('0x33')](_0xf62881[_0x8c35('0x48')],function(_0x147fee){var _0x443fb4={};_0x443fb4[_0x147fee]={'$like':'%'+_0x29dea9[_0x8c35('0x44')]['filter']+'%'};return _0x443fb4;})});}_0xf62881=_['merge']({},_0xf62881,_0x29dea9[_0x8c35('0x5a')]);return db['VoiceRecording'][_0x8c35('0x25')]({'where':_0xf62881[_0x8c35('0x43')]})[_0x8c35('0x29')](function(_0x53f5ca){_0x5e0911[_0x8c35('0x25')]=_0x53f5ca;if(_0x29dea9[_0x8c35('0x44')][_0x8c35('0x45')]){_0xf62881[_0x8c35('0x46')]=[{'all':!![]}];}return db[_0x8c35('0xda')][_0x8c35('0x4a')](_0xf62881);})['then'](function(_0x2f3b53){_0x5e0911[_0x8c35('0x4b')]=_0x2f3b53;return _0x5e0911;});}})[_0x8c35('0x29')](respondWithFilteredResult(_0x9db7d1,_0xf62881))[_0x8c35('0x1f')](handleError(_0x9db7d1,null));};exports[_0x8c35('0xdc')]=function(_0x37eb9f,_0x590bfe){var _0x2bf725={'raw':!![],'where':{}};var _0x528822={};var _0x37f618={'count':0x0,'rows':[]};return db['User'][_0x8c35('0x96')]({'where':{'id':_0x37eb9f[_0x8c35('0x52')]['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0x590bfe,null))[_0x8c35('0x29')](function(_0x24cd65){if(_0x24cd65){_0x528822['model']=_['keys'](db[_0x8c35('0xdd')]['rawAttributes']);_0x528822[_0x8c35('0x44')]=_['keys'](_0x37eb9f[_0x8c35('0x44')]);_0x528822['filters']=_[_0x8c35('0x57')](_0x528822[_0x8c35('0x53')],_0x528822['query']);_0x2bf725[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0x528822[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0x37eb9f[_0x8c35('0x44')][_0x8c35('0x58')]));_0x2bf725[_0x8c35('0x48')]=_0x2bf725[_0x8c35('0x48')]['length']?_0x2bf725['attributes']:_0x528822[_0x8c35('0x53')];if(!_0x37eb9f[_0x8c35('0x44')][_0x8c35('0xcc')](_0x8c35('0xd5'))){_0x2bf725[_0x8c35('0x23')]=qs[_0x8c35('0x23')](_0x37eb9f[_0x8c35('0x44')]['limit']);_0x2bf725[_0x8c35('0x22')]=qs['offset'](_0x37eb9f[_0x8c35('0x44')][_0x8c35('0x22')]);}_0x2bf725['order']=qs['sort'](_0x37eb9f[_0x8c35('0x44')][_0x8c35('0xc9')]);_0x2bf725[_0x8c35('0x43')]=qs[_0x8c35('0x56')](_['pick'](_0x37eb9f[_0x8c35('0x44')],_0x528822[_0x8c35('0x56')]));_0x2bf725[_0x8c35('0x43')]['UserId']=_0x24cd65['id'];if(_0x37eb9f[_0x8c35('0x44')]['filter']){_0x2bf725[_0x8c35('0x43')]=_[_0x8c35('0xcb')](_0x2bf725[_0x8c35('0x43')],{'$or':_['map'](_0x2bf725[_0x8c35('0x48')],function(_0x31b90d){var _0x1fb1a1={};_0x1fb1a1[_0x31b90d]={'$like':'%'+_0x37eb9f[_0x8c35('0x44')][_0x8c35('0xd6')]+'%'};return _0x1fb1a1;})});}_0x2bf725=_[_0x8c35('0xcb')]({},_0x2bf725,_0x37eb9f[_0x8c35('0x5a')]);return db[_0x8c35('0xdd')][_0x8c35('0x25')]({'where':_0x2bf725[_0x8c35('0x43')]})[_0x8c35('0x29')](function(_0xd17a6){_0x37f618[_0x8c35('0x25')]=_0xd17a6;if(_0x37eb9f[_0x8c35('0x44')]['includeAll']){_0x2bf725[_0x8c35('0x46')]=[{'all':!![]}];}return db[_0x8c35('0xdd')][_0x8c35('0x4a')](_0x2bf725);})[_0x8c35('0x29')](function(_0x332ae7){_0x37f618[_0x8c35('0x4b')]=_0x332ae7;return _0x37f618;});}})[_0x8c35('0x29')](respondWithFilteredResult(_0x590bfe,_0x2bf725))[_0x8c35('0x1f')](handleError(_0x590bfe,null));};exports[_0x8c35('0xde')]=function(_0x4a28a5,_0x57b823){var _0x1f0060={};var _0x40cd88={};var _0x4e9b1e;var _0x44b908;return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0x4a28a5['params']['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0x57b823,null))[_0x8c35('0x29')](function(_0x93daa3){if(_0x93daa3){_0x4e9b1e=_0x93daa3;_0x40cd88[_0x8c35('0x53')]=_[_0x8c35('0x54')](db[_0x8c35('0xdf')][_0x8c35('0x3e')]);_0x40cd88['query']=_[_0x8c35('0x54')](_0x4a28a5[_0x8c35('0x44')]);_0x40cd88[_0x8c35('0x56')]=_[_0x8c35('0x57')](_0x40cd88[_0x8c35('0x53')],_0x40cd88[_0x8c35('0x44')]);_0x1f0060[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0x40cd88[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0x4a28a5['query'][_0x8c35('0x58')]));_0x1f0060[_0x8c35('0x48')]=_0x1f0060[_0x8c35('0x48')][_0x8c35('0x71')]?_0x1f0060[_0x8c35('0x48')]:_0x40cd88[_0x8c35('0x53')];_0x1f0060[_0x8c35('0xc8')]=qs[_0x8c35('0xc9')](_0x4a28a5['query'][_0x8c35('0xc9')]);_0x1f0060[_0x8c35('0x43')]=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0x4a28a5[_0x8c35('0x44')],_0x40cd88['filters']));if(_0x4a28a5[_0x8c35('0x44')][_0x8c35('0xd6')]){_0x1f0060[_0x8c35('0x43')]=_['merge'](_0x1f0060[_0x8c35('0x43')],{'$or':_[_0x8c35('0x33')](_0x1f0060[_0x8c35('0x48')],function(_0x1ab0a2){var _0x4781ae={};_0x4781ae[_0x1ab0a2]={'$like':'%'+_0x4a28a5[_0x8c35('0x44')][_0x8c35('0xd6')]+'%'};return _0x4781ae;})});}_0x1f0060=_[_0x8c35('0xcb')]({},_0x1f0060,_0x4a28a5[_0x8c35('0x5a')]);return _0x4e9b1e[_0x8c35('0xde')](_0x1f0060);}})[_0x8c35('0x29')](function(_0x394196){if(_0x394196){_0x44b908=_0x394196['length'];if(!_0x4a28a5[_0x8c35('0x44')][_0x8c35('0xcc')]('nolimit')){_0x1f0060[_0x8c35('0x23')]=qs[_0x8c35('0x23')](_0x4a28a5[_0x8c35('0x44')][_0x8c35('0x23')]);_0x1f0060[_0x8c35('0x22')]=qs[_0x8c35('0x22')](_0x4a28a5[_0x8c35('0x44')]['offset']);}return _0x4e9b1e['getChatInteractions'](_0x1f0060);}})[_0x8c35('0x29')](function(_0x363ed3){if(_0x363ed3){return _0x363ed3?{'count':_0x44b908,'rows':_0x363ed3}:null;}})[_0x8c35('0x29')](respondWithResult(_0x57b823,null))[_0x8c35('0x1f')](handleError(_0x57b823,null));};exports['getOpenchannelInteractions']=function(_0x19e662,_0x2a65b8){var _0x1c326f={};var _0x55d634={};var _0x43d651;var _0x1e90f3;return db[_0x8c35('0x3d')]['findOne']({'where':{'id':_0x19e662['params']['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0x2a65b8,null))['then'](function(_0x3f0178){if(_0x3f0178){_0x43d651=_0x3f0178;_0x55d634[_0x8c35('0x53')]=_[_0x8c35('0x54')](db['OpenchannelInteraction'][_0x8c35('0x3e')]);_0x55d634[_0x8c35('0x44')]=_[_0x8c35('0x54')](_0x19e662[_0x8c35('0x44')]);_0x55d634['filters']=_[_0x8c35('0x57')](_0x55d634[_0x8c35('0x53')],_0x55d634['query']);_0x1c326f[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0x55d634[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0x19e662[_0x8c35('0x44')][_0x8c35('0x58')]));_0x1c326f[_0x8c35('0x48')]=_0x1c326f[_0x8c35('0x48')][_0x8c35('0x71')]?_0x1c326f[_0x8c35('0x48')]:_0x55d634[_0x8c35('0x53')];_0x1c326f[_0x8c35('0xc8')]=qs[_0x8c35('0xc9')](_0x19e662[_0x8c35('0x44')]['sort']);_0x1c326f[_0x8c35('0x43')]=qs['filters'](_[_0x8c35('0xca')](_0x19e662[_0x8c35('0x44')],_0x55d634[_0x8c35('0x56')]));if(_0x19e662[_0x8c35('0x44')][_0x8c35('0xd6')]){_0x1c326f[_0x8c35('0x43')]=_['merge'](_0x1c326f['where'],{'$or':_[_0x8c35('0x33')](_0x1c326f['attributes'],function(_0x5caff4){var _0x120e9f={};_0x120e9f[_0x5caff4]={'$like':'%'+_0x19e662['query'][_0x8c35('0xd6')]+'%'};return _0x120e9f;})});}_0x1c326f=_[_0x8c35('0xcb')]({},_0x1c326f,_0x19e662[_0x8c35('0x5a')]);return _0x43d651['getOpenchannelInteractions'](_0x1c326f);}})[_0x8c35('0x29')](function(_0x4691b6){if(_0x4691b6){_0x1e90f3=_0x4691b6['length'];if(!_0x19e662['query'][_0x8c35('0xcc')](_0x8c35('0xd5'))){_0x1c326f[_0x8c35('0x23')]=qs[_0x8c35('0x23')](_0x19e662[_0x8c35('0x44')][_0x8c35('0x23')]);_0x1c326f[_0x8c35('0x22')]=qs['offset'](_0x19e662[_0x8c35('0x44')][_0x8c35('0x22')]);}return _0x43d651[_0x8c35('0xe0')](_0x1c326f);}})['then'](function(_0x30f44e){if(_0x30f44e){return _0x30f44e?{'count':_0x1e90f3,'rows':_0x30f44e}:null;}})[_0x8c35('0x29')](respondWithResult(_0x2a65b8,null))['catch'](handleError(_0x2a65b8,null));};exports[_0x8c35('0xe1')]=function(_0x962d0a,_0xbd561c){var _0x27014a={'raw':!![],'where':{}};var _0x302486={};var _0x6e4e5e={'count':0x0,'rows':[]};return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0x962d0a['params']['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0xbd561c,null))[_0x8c35('0x29')](function(_0x43db96){if(_0x43db96){_0x302486['model']=_[_0x8c35('0x54')](db[_0x8c35('0xe2')][_0x8c35('0x3e')]);_0x302486[_0x8c35('0x44')]=_[_0x8c35('0x54')](_0x962d0a[_0x8c35('0x44')]);_0x302486['filters']=_[_0x8c35('0x57')](_0x302486[_0x8c35('0x53')],_0x302486[_0x8c35('0x44')]);_0x27014a[_0x8c35('0x48')]=_['intersection'](_0x302486[_0x8c35('0x53')],qs['fields'](_0x962d0a[_0x8c35('0x44')][_0x8c35('0x58')]));_0x27014a[_0x8c35('0x48')]=_0x27014a[_0x8c35('0x48')][_0x8c35('0x71')]?_0x27014a['attributes']:_0x302486['model'];if(!_0x962d0a[_0x8c35('0x44')][_0x8c35('0xcc')](_0x8c35('0xd5'))){_0x27014a[_0x8c35('0x23')]=qs[_0x8c35('0x23')](_0x962d0a[_0x8c35('0x44')][_0x8c35('0x23')]);_0x27014a[_0x8c35('0x22')]=qs[_0x8c35('0x22')](_0x962d0a['query'][_0x8c35('0x22')]);}_0x27014a['order']=qs['sort'](_0x962d0a[_0x8c35('0x44')][_0x8c35('0xc9')]);_0x27014a['where']=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0x962d0a[_0x8c35('0x44')],_0x302486[_0x8c35('0x56')]));_0x27014a[_0x8c35('0x43')][_0x8c35('0xdb')]=_0x43db96['id'];if(_0x962d0a[_0x8c35('0x44')][_0x8c35('0xd6')]){_0x27014a[_0x8c35('0x43')]=_[_0x8c35('0xcb')](_0x27014a['where'],{'$or':_[_0x8c35('0x33')](_0x27014a[_0x8c35('0x48')],function(_0x3803b5){var _0x41f146={};_0x41f146[_0x3803b5]={'$like':'%'+_0x962d0a[_0x8c35('0x44')]['filter']+'%'};return _0x41f146;})});}_0x27014a=_[_0x8c35('0xcb')]({},_0x27014a,_0x962d0a[_0x8c35('0x5a')]);return db['MailInteraction'][_0x8c35('0x25')]({'where':_0x27014a[_0x8c35('0x43')]})[_0x8c35('0x29')](function(_0x5d1574){_0x6e4e5e[_0x8c35('0x25')]=_0x5d1574;if(_0x962d0a[_0x8c35('0x44')][_0x8c35('0x45')]){_0x27014a[_0x8c35('0x46')]=[{'all':!![]}];}return db['MailInteraction'][_0x8c35('0x4a')](_0x27014a);})[_0x8c35('0x29')](function(_0x4744a8){_0x6e4e5e[_0x8c35('0x4b')]=_0x4744a8;return _0x6e4e5e;});}})[_0x8c35('0x29')](respondWithFilteredResult(_0xbd561c,_0x27014a))['catch'](handleError(_0xbd561c,null));};exports['getSmsInteractions']=function(_0x24c027,_0xcd1fec){var _0x20915b={};var _0x3e8d36={};var _0x5b95bb;var _0x51fb57;return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0x24c027[_0x8c35('0x52')]['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0xcd1fec,null))['then'](function(_0x57bbd3){if(_0x57bbd3){_0x5b95bb=_0x57bbd3;_0x3e8d36['model']=_['keys'](db[_0x8c35('0xe3')][_0x8c35('0x3e')]);_0x3e8d36[_0x8c35('0x44')]=_['keys'](_0x24c027[_0x8c35('0x44')]);_0x3e8d36[_0x8c35('0x56')]=_[_0x8c35('0x57')](_0x3e8d36[_0x8c35('0x53')],_0x3e8d36[_0x8c35('0x44')]);_0x20915b[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0x3e8d36['model'],qs[_0x8c35('0x58')](_0x24c027[_0x8c35('0x44')][_0x8c35('0x58')]));_0x20915b[_0x8c35('0x48')]=_0x20915b[_0x8c35('0x48')][_0x8c35('0x71')]?_0x20915b[_0x8c35('0x48')]:_0x3e8d36[_0x8c35('0x53')];_0x20915b[_0x8c35('0xc8')]=qs[_0x8c35('0xc9')](_0x24c027[_0x8c35('0x44')][_0x8c35('0xc9')]);_0x20915b['where']=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0x24c027[_0x8c35('0x44')],_0x3e8d36[_0x8c35('0x56')]));if(_0x24c027[_0x8c35('0x44')][_0x8c35('0xd6')]){_0x20915b[_0x8c35('0x43')]=_['merge'](_0x20915b['where'],{'$or':_[_0x8c35('0x33')](_0x20915b['attributes'],function(_0x3ec929){var _0x23aafd={};_0x23aafd[_0x3ec929]={'$like':'%'+_0x24c027[_0x8c35('0x44')]['filter']+'%'};return _0x23aafd;})});}_0x20915b=_['merge']({},_0x20915b,_0x24c027['options']);return _0x5b95bb['getSmsInteractions'](_0x20915b);}})['then'](function(_0x4f4a4d){if(_0x4f4a4d){_0x51fb57=_0x4f4a4d[_0x8c35('0x71')];if(!_0x24c027[_0x8c35('0x44')][_0x8c35('0xcc')](_0x8c35('0xd5'))){_0x20915b[_0x8c35('0x23')]=qs['limit'](_0x24c027[_0x8c35('0x44')][_0x8c35('0x23')]);_0x20915b['offset']=qs[_0x8c35('0x22')](_0x24c027[_0x8c35('0x44')]['offset']);}return _0x5b95bb[_0x8c35('0xe4')](_0x20915b);}})[_0x8c35('0x29')](function(_0x58ce9f){if(_0x58ce9f){return _0x58ce9f?{'count':_0x51fb57,'rows':_0x58ce9f}:null;}})['then'](respondWithResult(_0xcd1fec,null))['catch'](handleError(_0xcd1fec,null));};exports['getFaxInteractions']=function(_0x57c045,_0x433778){var _0x9a0d9={};var _0x479d6c={};var _0x3b6288;var _0x43d2ce;return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0x57c045['params']['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0x433778,null))[_0x8c35('0x29')](function(_0x31609e){if(_0x31609e){_0x3b6288=_0x31609e;_0x479d6c[_0x8c35('0x53')]=_['keys'](db[_0x8c35('0xe5')]['rawAttributes']);_0x479d6c['query']=_['keys'](_0x57c045[_0x8c35('0x44')]);_0x479d6c['filters']=_[_0x8c35('0x57')](_0x479d6c['model'],_0x479d6c[_0x8c35('0x44')]);_0x9a0d9[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0x479d6c[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0x57c045[_0x8c35('0x44')][_0x8c35('0x58')]));_0x9a0d9[_0x8c35('0x48')]=_0x9a0d9[_0x8c35('0x48')]['length']?_0x9a0d9[_0x8c35('0x48')]:_0x479d6c['model'];_0x9a0d9[_0x8c35('0xc8')]=qs['sort'](_0x57c045[_0x8c35('0x44')][_0x8c35('0xc9')]);_0x9a0d9[_0x8c35('0x43')]=qs['filters'](_[_0x8c35('0xca')](_0x57c045[_0x8c35('0x44')],_0x479d6c[_0x8c35('0x56')]));if(_0x57c045[_0x8c35('0x44')]['filter']){_0x9a0d9[_0x8c35('0x43')]=_[_0x8c35('0xcb')](_0x9a0d9[_0x8c35('0x43')],{'$or':_['map'](_0x9a0d9[_0x8c35('0x48')],function(_0x47ba47){var _0x14cb8e={};_0x14cb8e[_0x47ba47]={'$like':'%'+_0x57c045[_0x8c35('0x44')][_0x8c35('0xd6')]+'%'};return _0x14cb8e;})});}_0x9a0d9=_['merge']({},_0x9a0d9,_0x57c045[_0x8c35('0x5a')]);return _0x3b6288[_0x8c35('0xe6')](_0x9a0d9);}})[_0x8c35('0x29')](function(_0x4345da){if(_0x4345da){_0x43d2ce=_0x4345da['length'];if(!_0x57c045[_0x8c35('0x44')]['hasOwnProperty'](_0x8c35('0xd5'))){_0x9a0d9['limit']=qs['limit'](_0x57c045['query'][_0x8c35('0x23')]);_0x9a0d9[_0x8c35('0x22')]=qs[_0x8c35('0x22')](_0x57c045['query']['offset']);}return _0x3b6288[_0x8c35('0xe6')](_0x9a0d9);}})[_0x8c35('0x29')](function(_0x3e9885){if(_0x3e9885){return _0x3e9885?{'count':_0x43d2ce,'rows':_0x3e9885}:null;}})[_0x8c35('0x29')](respondWithResult(_0x433778,null))['catch'](handleError(_0x433778,null));};exports[_0x8c35('0xe7')]=function(_0xb01197,_0x3e7dfb){var _0x47d160={};var _0x4f6ec0={};var _0x3566e8;var _0x350bc5;return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0xb01197[_0x8c35('0x52')]['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0x3e7dfb,null))['then'](function(_0x27c92f){if(_0x27c92f){_0x3566e8=_0x27c92f;_0x4f6ec0[_0x8c35('0x53')]=_[_0x8c35('0x54')](db[_0x8c35('0xe8')][_0x8c35('0x3e')]);_0x4f6ec0['query']=_['keys'](_0xb01197[_0x8c35('0x44')]);_0x4f6ec0[_0x8c35('0x56')]=_[_0x8c35('0x57')](_0x4f6ec0[_0x8c35('0x53')],_0x4f6ec0['query']);_0x47d160['attributes']=_[_0x8c35('0x57')](_0x4f6ec0[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0xb01197['query'][_0x8c35('0x58')]));_0x47d160[_0x8c35('0x48')]=_0x47d160[_0x8c35('0x48')][_0x8c35('0x71')]?_0x47d160[_0x8c35('0x48')]:_0x4f6ec0[_0x8c35('0x53')];_0x47d160[_0x8c35('0xc8')]=qs[_0x8c35('0xc9')](_0xb01197[_0x8c35('0x44')][_0x8c35('0xc9')]);_0x47d160[_0x8c35('0x43')]=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0xb01197[_0x8c35('0x44')],_0x4f6ec0[_0x8c35('0x56')]));if(_0xb01197['query'][_0x8c35('0xd6')]){_0x47d160[_0x8c35('0x43')]=_['merge'](_0x47d160[_0x8c35('0x43')],{'$or':_[_0x8c35('0x33')](_0x47d160[_0x8c35('0x48')],function(_0x2c2158){var _0x2bf2b4={};_0x2bf2b4[_0x2c2158]={'$like':'%'+_0xb01197[_0x8c35('0x44')][_0x8c35('0xd6')]+'%'};return _0x2bf2b4;})});}_0x47d160=_[_0x8c35('0xcb')]({},_0x47d160,_0xb01197[_0x8c35('0x5a')]);return _0x3566e8[_0x8c35('0xe7')](_0x47d160);}})['then'](function(_0x2b6a76){if(_0x2b6a76){_0x350bc5=_0x2b6a76['length'];if(!_0xb01197['query']['hasOwnProperty'](_0x8c35('0xd5'))){_0x47d160[_0x8c35('0x23')]=qs['limit'](_0xb01197['query'][_0x8c35('0x23')]);_0x47d160['offset']=qs[_0x8c35('0x22')](_0xb01197['query'][_0x8c35('0x22')]);}return _0x3566e8[_0x8c35('0xe7')](_0x47d160);}})['then'](function(_0x62004e){if(_0x62004e){return _0x62004e?{'count':_0x350bc5,'rows':_0x62004e}:null;}})[_0x8c35('0x29')](respondWithResult(_0x3e7dfb,null))[_0x8c35('0x1f')](handleError(_0x3e7dfb,null));};exports['login']=function(_0xe7de52,_0x137f8d,_0x1bbeb7){var _0x5943a8;var _0x224b71;var _0x110404;var _0x36732f=!_[_0x8c35('0x6c')](_0xe7de52['params']['id'])?_0xe7de52[_0x8c35('0x52')]['id']:!_[_0x8c35('0x6c')](_0xe7de52[_0x8c35('0x2e')]['id'])?_0xe7de52[_0x8c35('0x2e')]['id']:null;return db[_0x8c35('0x3d')]['find']({'where':{'id':_0x36732f,'role':{'$or':[_0x8c35('0x7e'),_0x8c35('0x2e'),_0x8c35('0x2a')]}},'attributes':['id',_0x8c35('0x3a'),_0x8c35('0xe9'),_0x8c35('0xea'),_0x8c35('0x2d'),_0x8c35('0x6b'),_0x8c35('0x9e')]})['then'](function(_0x199993){if(_0x199993){if(_0x199993['role']==='agent'){_0x5943a8=_0x199993;if(_0xe7de52[_0x8c35('0x61')]['interface']){_0x110404=util['format'](_0x8c35('0xeb'),_0x5943a8[_0xe7de52[_0x8c35('0x61')]['interface']]);}else if(_0xe7de52[_0x8c35('0x61')][_0x8c35('0xec')]){_0x110404=util[_0x8c35('0xaa')](_0x8c35('0xab'),_0xe7de52['body'][_0x8c35('0xec')]);}else{_0x110404=util[_0x8c35('0xaa')](_0x8c35('0xab'),_0x5943a8[_0x8c35('0x3a')]);}socket['to'](util[_0x8c35('0xaa')](_0x8c35('0xed'),_0x5943a8['name']))[_0x8c35('0x2b')](_0x8c35('0xee'),{'user':{'id':_0x5943a8['id'],'name':_0x5943a8[_0x8c35('0x3a')]},'ip':_0xe7de52['headers'][_0x8c35('0xef')]||_0xe7de52[_0x8c35('0xf0')]['remoteAddress']||_0xe7de52[_0x8c35('0xf1')][_0x8c35('0xf2')]||_0xe7de52[_0x8c35('0xf0')][_0x8c35('0xf1')][_0x8c35('0xf2')]});return db[_0x8c35('0xb2')][_0x8c35('0x37')]({'where':{'membername':_0x5943a8['name']},'individualHooks':!![]});}}else{throw new db[(_0x8c35('0x8f'))][(_0x8c35('0x90'))](_0x8c35('0xf3'));}})[_0x8c35('0x29')](function(){if(_0x5943a8){return _0x5943a8[_0x8c35('0xf4')]({'raw':!![]});}})[_0x8c35('0x29')](function(_0x167255){if(_0x5943a8){if(_0x167255){_0x224b71=_0x167255;if(_0x224b71['length']){var _0xdc31d6=_0x224b71[_0x8c35('0x33')](function(_0x3087e2){var _0x3c2334={'membername':_0x5943a8[_0x8c35('0x3a')],'UserId':_0x5943a8['id'],'queue_name':_0x3087e2[_0x8c35('0x3a')],'VoiceQueueId':_0x3087e2['id'],'interface':_0x110404,'paused':_0x5943a8[_0x8c35('0x9e')]||![],'penalty':_0x3087e2['UserVoiceQueue.penalty']||0x0};return db[_0x8c35('0xb2')][_0x8c35('0xad')](_0x3c2334);});return Promise[_0x8c35('0x50')](_0xdc31d6);}}}})['then'](function(){if(_0x5943a8){return db[_0x8c35('0xf5')]['findAll']({'where':{'membername':_0x5943a8[_0x8c35('0x3a')],'exitAt':null}});}})[_0x8c35('0x29')](function(_0x248959){if(_0x5943a8){var _0x28f2a4=[];_0x248959[_0x8c35('0xf6')](function(_0x23577a){_0x28f2a4['push'](_0x23577a[_0x8c35('0x28')]({'exitAt':moment()[_0x8c35('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x8c35('0x50')](_0x28f2a4);}})[_0x8c35('0x29')](function(){if(_0x5943a8){var _0x1fdac2=[];var _0x3d35f9=[];var _0x55740b=utils['getChannels']();var _0x5184d6={'membername':_0x5943a8['name'],'interface':_0x110404,'enterAt':moment()[_0x8c35('0xaa')](_0x8c35('0xf7')),'role':_0x5943a8[_0x8c35('0x2d')],'internal':_0x5943a8[_0x8c35('0x6b')]};_0x55740b['forEach'](function(_0x2bc8d7){_0x1fdac2['push'](_['merge']({'channel':_0x2bc8d7,'type':_0x8c35('0xf8'),'data1':_0xe7de52[_0x8c35('0x61')][_0x8c35('0xf9')],'data2':_0x110404},_0x5184d6));if(_0x5943a8['loginInPause']){_0x3d35f9['push'](_['merge']({'channel':_0x2bc8d7,'type':'PAUSE','data1':_0x8c35('0xfa')},_0x5184d6));}});return db[_0x8c35('0xf5')][_0x8c35('0x87')](_0x1fdac2[_0x8c35('0xfb')](_0x3d35f9),{'individualHooks':!![]});}})[_0x8c35('0x29')](function(){if(_0x5943a8){return _0x5943a8[_0x8c35('0x28')]({'online':!![],'lastLoginAt':moment()[_0x8c35('0xaa')](_0x8c35('0xf7')),'voicePause':_0x5943a8[_0x8c35('0x9e')]||![],'mailPause':_0x5943a8[_0x8c35('0x9e')]||![],'chatPause':_0x5943a8[_0x8c35('0x9e')]||![],'faxPause':_0x5943a8[_0x8c35('0x9e')]||![],'smsPause':_0x5943a8[_0x8c35('0x9e')]||![],'openchannelPause':_0x5943a8['loginInPause']||![],'whatsappPause':_0x5943a8[_0x8c35('0x9e')]||![],'pauseType':_0x5943a8[_0x8c35('0x9e')]?'LOGININPAUSE':null,'interface':_0x110404,'lastPauseAt':moment()[_0x8c35('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x47ded4){if(_0xe7de52[_0x8c35('0xfc')]){return _0x1bbeb7();}else{return Promise['resolve'](_0x47ded4)[_0x8c35('0x29')](respondWithResult(_0x137f8d,null));}})[_0x8c35('0x1f')](handleError(_0x137f8d,null));};exports[_0x8c35('0xfd')]=function(_0xb3d08b,_0xfae172){var _0x669bc;return db[_0x8c35('0x3d')][_0x8c35('0x5b')]({'where':{'id':_0xb3d08b['params']['id'],'role':_0x8c35('0x2a')},'attributes':['id',_0x8c35('0x3a'),_0x8c35('0x2d')]})[_0x8c35('0x29')](handleEntityNotFound(_0xfae172,null))[_0x8c35('0x29')](function(_0x22c85c){if(_0x22c85c){_0x669bc=_0x22c85c;return db[_0x8c35('0xb2')]['destroy']({'where':{'membername':_0x669bc[_0x8c35('0x3a')]},'individualHooks':!![]});}})[_0x8c35('0x29')](function(){return db[_0x8c35('0xf5')][_0x8c35('0x4a')]({'where':{'membername':_0x669bc[_0x8c35('0x3a')],'exitAt':null}});})[_0x8c35('0x29')](function(_0x2b6c34){var _0x581147=[];_0x2b6c34[_0x8c35('0xf6')](function(_0x385643){_0x581147['push'](_0x385643[_0x8c35('0x28')]({'exitAt':moment()['format'](_0x8c35('0xf7'))}));});return Promise[_0x8c35('0x50')](_0x581147);})[_0x8c35('0x29')](function(){return _0x669bc[_0x8c35('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8c35('0x29')](respondWithResult(_0xfae172,null))[_0x8c35('0x1f')](handleError(_0xfae172,null));};exports[_0x8c35('0xfe')]=function(_0x2ef08c,_0x546104){var _0x2f686d;return db[_0x8c35('0xb2')]['update']({'paused':0x1},{'where':{'UserId':_0x2ef08c[_0x8c35('0x52')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x8c35('0x3d')][_0x8c35('0x5b')]({'where':{'id':_0x2ef08c['params']['id'],'role':'agent'},'attributes':['id',_0x8c35('0x3a'),'role',_0x8c35('0x6b'),_0x8c35('0xa0'),'online']});})[_0x8c35('0x29')](handleEntityNotFound(_0x546104,null))[_0x8c35('0x29')](function(_0x2a4fe6){if(_0x2a4fe6){_0x2f686d=_0x2a4fe6;return respondWithRpcPromise(_0x8c35('0xff'),_0x8c35('0xfe'),{'id':_0x2f686d['id'],'name':_0x2f686d[_0x8c35('0x3a')],'pause':!![]});}})[_0x8c35('0x29')](function(){if(_0x2f686d){return db[_0x8c35('0xf5')][_0x8c35('0x4a')]({'where':{'membername':_0x2f686d[_0x8c35('0x3a')],'type':'PAUSE','exitAt':null}});}})[_0x8c35('0x29')](function(_0x53ff9f){if(_0x53ff9f[_0x8c35('0x71')]){var _0x51a6b7=moment()[_0x8c35('0xaa')](_0x8c35('0xf7'));for(var _0x359959=0x0,_0x58e6ca=_0x53ff9f['length'];_0x359959<_0x58e6ca;_0x359959++){_0x53ff9f[_0x359959][_0x8c35('0x100')]({'exitAt':_0x51a6b7});}}})[_0x8c35('0x29')](function(){var _0x110107=[];var _0x326777=utils['getChannels']();_0x326777[_0x8c35('0xf6')](function(_0x28211e){_0x110107['push']({'channel':_0x28211e,'membername':_0x2f686d['name'],'interface':_['isNil'](_0x2f686d['interface'])?util[_0x8c35('0xaa')](_0x8c35('0xab'),_0x2f686d[_0x8c35('0x3a')]):_0x2f686d['interface'],'type':'PAUSE','enterAt':moment()[_0x8c35('0xaa')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2ef08c[_0x8c35('0x61')][_0x8c35('0x3f')]||'DEFAULT\x20PAUSE','role':_0x2f686d['role'],'internal':_0x2f686d['internal']});});return db[_0x8c35('0xf5')]['bulkCreate'](_0x110107,{'individualHooks':!![]});})[_0x8c35('0x29')](function(){return _0x2f686d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2ef08c['body'][_0x8c35('0x3f')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x8c35('0x29')](respondWithResult(_0x546104,null))[_0x8c35('0x1f')](handleError(_0x546104,null));};exports[_0x8c35('0x101')]=function(_0xb1bd8,_0xcfaff0){if(_0xb1bd8[_0x8c35('0x61')][_0x8c35('0x9c')]&&!utils[_0x8c35('0xa1')](_0xb1bd8['body'][_0x8c35('0x9c')])){throw new APIBadRequestError(util['format'](_0x8c35('0x102'),_0xb1bd8['body'][_0x8c35('0x9c')]));}return db[_0x8c35('0x3d')][_0x8c35('0x5b')]({'where':{'id':_0xb1bd8[_0x8c35('0x52')]['id']},'attributes':['id',_0x8c35('0x3a'),'role',_0x8c35('0x6b'),_0x8c35('0xa0'),_0x8c35('0x9d'),'voicePause',_0x8c35('0x103'),'chatPause',_0x8c35('0x104'),_0x8c35('0x105'),_0x8c35('0x106'),'whatsappPause',_0x8c35('0x107'),'lastPauseAt']})[_0x8c35('0x29')](function(_0x13e4c0){if(!_0x13e4c0){throw new APINotFoundError(util[_0x8c35('0xaa')](_0x8c35('0x108'),_0xb1bd8[_0x8c35('0x52')]['id']));}return _0x13e4c0[_0x8c35('0x101')](_0xb1bd8[_0x8c35('0x61')][_0x8c35('0x9c')]);})[_0x8c35('0x29')](respondWithResult(_0xcfaff0,null))['catch'](APIHandleError(_0xcfaff0));};exports[_0x8c35('0x109')]=function(_0x29f2cb,_0x6f6eeb){var _0x4fa287={};var _0xf0bd14={};var _0x3be31a;var _0x49bab4;return db[_0x8c35('0x3d')]['findOne']({'where':{'id':_0x29f2cb['params']['id']}})['then'](handleEntityNotFound(_0x6f6eeb,null))['then'](function(_0x42ea57){if(_0x42ea57){_0x3be31a=_0x42ea57;_0xf0bd14[_0x8c35('0x53')]=_['keys'](db[_0x8c35('0x10a')][_0x8c35('0x3e')]);_0xf0bd14['query']=_[_0x8c35('0x54')](_0x29f2cb[_0x8c35('0x44')]);_0xf0bd14['filters']=_[_0x8c35('0x57')](_0xf0bd14['model'],_0xf0bd14[_0x8c35('0x44')]);_0x4fa287[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0xf0bd14[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0x29f2cb[_0x8c35('0x44')][_0x8c35('0x58')]));_0x4fa287[_0x8c35('0x48')]=_0x4fa287['attributes']['length']?_0x4fa287['attributes']:_0xf0bd14['model'];_0x4fa287[_0x8c35('0xc8')]=qs[_0x8c35('0xc9')](_0x29f2cb[_0x8c35('0x44')][_0x8c35('0xc9')]);_0x4fa287[_0x8c35('0x43')]=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0x29f2cb['query'],_0xf0bd14[_0x8c35('0x56')]));if(_0x29f2cb[_0x8c35('0x44')]['filter']){_0x4fa287[_0x8c35('0x43')]=_['merge'](_0x4fa287['where'],{'$or':_['map'](_0x4fa287[_0x8c35('0x48')],function(_0x70d560){var _0x5db342={};_0x5db342[_0x70d560]={'$like':'%'+_0x29f2cb[_0x8c35('0x44')][_0x8c35('0xd6')]+'%'};return _0x5db342;})});}_0x4fa287=_[_0x8c35('0xcb')]({},_0x4fa287,_0x29f2cb[_0x8c35('0x5a')]);return _0x3be31a['getTeams'](_0x4fa287);}})[_0x8c35('0x29')](function(_0x536427){if(_0x536427){_0x49bab4=_0x536427[_0x8c35('0x71')];if(!_0x29f2cb[_0x8c35('0x44')][_0x8c35('0xcc')]('nolimit')){_0x4fa287[_0x8c35('0x23')]=qs[_0x8c35('0x23')](_0x29f2cb['query']['limit']);_0x4fa287[_0x8c35('0x22')]=qs[_0x8c35('0x22')](_0x29f2cb[_0x8c35('0x44')]['offset']);}return _0x3be31a['getTeams'](_0x4fa287);}})[_0x8c35('0x29')](function(_0xfe34b6){if(_0xfe34b6){return _0xfe34b6?{'count':_0x49bab4,'rows':_0xfe34b6}:null;}})['then'](respondWithResult(_0x6f6eeb,null))['catch'](handleError(_0x6f6eeb,null));};exports['addTeams']=function(_0x14b326,_0xef9144){var _0x17fbcd=_0x14b326[_0x8c35('0x52')]['id'];var _0xf5bbc=_0x14b326[_0x8c35('0x61')]?_0x14b326['body'][_0x8c35('0x64')]:null;var _0x3a68b5=[];return Promise['resolve']()['then'](function(){if(!_0xf5bbc)throw new APIBadRequestError(_0x8c35('0x10b'));})['then'](function(){return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0x17fbcd}});})[_0x8c35('0x29')](function(_0xe93dfc){if(!_0xe93dfc)throw new APINotFoundError(util[_0x8c35('0xaa')](_0x8c35('0x108'),_0x14b326[_0x8c35('0x52')]['id']));return db[_0x8c35('0x6e')][_0x8c35('0x10c')](function(_0x93b354){return _0xe93dfc[_0x8c35('0x10d')](_0xf5bbc,{'transaction':_0x93b354})[_0x8c35('0x29')](function(){return db['Team'][_0x8c35('0x4a')]({'where':{'id':{'$in':_0xf5bbc}}});})[_0x8c35('0x29')](function(_0x3c2f04){var _0x3a0efe=_[_0x8c35('0x33')](_0x3c2f04,function(_0xb92319){return _0xb92319['getAssociatedQueues']();});return Promise['all'](_0x3a0efe);})[_0x8c35('0x29')](function(_0x1397b8){_0x3a68b5=_[_0x8c35('0x10e')](_0x1397b8);var _0x471a64=_['map'](_0x3a68b5,function(_0x4eb340){return _0x4eb340[_0x8c35('0x10f')](_0xe93dfc['id'],{'transaction':_0x93b354});});return Promise['all'](_0x471a64);})[_0x8c35('0x29')](function(){if(!_0xe93dfc[_0x8c35('0x9d')])return;var _0x4d56d3=_[_0x8c35('0xd6')](_0x3a68b5,function(_0x7f19d4){return _0x7f19d4[_0x8c35('0x110')](_0x8c35('0x9c'))==='Voice';});var _0x348a63=_[_0x8c35('0x33')](_0x4d56d3,function(_0x2459bc){return db['UserVoiceQueueRt'][_0x8c35('0xad')]({'membername':_0xe93dfc[_0x8c35('0x3a')],'UserId':_0xe93dfc['id'],'queue_name':_0x2459bc[_0x8c35('0x3a')],'VoiceQueueId':_0x2459bc['id'],'interface':_[_0x8c35('0x6c')](_0xe93dfc['interface'])?util[_0x8c35('0xaa')](_0x8c35('0xab'),_0xe93dfc[_0x8c35('0x3a')]):_0xe93dfc['interface'],'paused':_0xe93dfc[_0x8c35('0x9f')]||![],'penalty':_0xe93dfc['penalty']},{'transaction':_0x93b354});});return Promise[_0x8c35('0x50')](_0x348a63);})[_0x8c35('0x29')](function(){return db[_0x8c35('0x111')]['findAll']({'where':{'teamId':{'$in':_0xf5bbc}}});})[_0x8c35('0x29')](function(_0x59c078){var _0xf11703=_[_0x8c35('0x33')](_0x59c078,function(_0x4be075){return db[_0x8c35('0x112')][_0x8c35('0x7c')]({'UserId':_0xe93dfc['id'],'VoicePrefixId':_0x4be075[_0x8c35('0x113')]},{'transaction':_0x93b354});});return Promise['all'](_0xf11703);});});})['then'](function(){for(var _0x3a0a6a=0x0;_0x3a0a6a<_0x3a68b5[_0x8c35('0x71')];_0x3a0a6a++){var _0x16813c=_0x3a68b5[_0x3a0a6a]['getDataValue'](_0x8c35('0x9c'));var _0x2cba5a=_0x16813c+'QueueId';socket[_0x8c35('0x2b')]('user'+_0x16813c+_0x8c35('0x114'),{'UserId':_0x17fbcd,['queueField']:_0x3a68b5[_0x3a0a6a]['id']});}})[_0x8c35('0x29')](respondWithStatusCode(_0xef9144,null))[_0x8c35('0x1f')](APIHandleError(_0xef9144));};exports[_0x8c35('0x115')]=function(_0x49fe57,_0x2053a9){var _0xddc882=_0x49fe57['params']['id'];var _0x41da68=null;if(_0x49fe57[_0x8c35('0x44')]['ids']){_0x41da68=_[_0x8c35('0xb0')](_0x49fe57[_0x8c35('0x44')][_0x8c35('0x64')])?_0x49fe57['query'][_0x8c35('0x64')]:[_0x49fe57[_0x8c35('0x44')][_0x8c35('0x64')]];}var _0x20f206=[];return Promise[_0x8c35('0x116')]()['then'](function(){if(!_0x41da68)throw new APIBadRequestError(_0x8c35('0x117'));})[_0x8c35('0x29')](function(){return db['User'][_0x8c35('0x96')]({'where':{'id':_0xddc882}});})[_0x8c35('0x29')](function(_0x421d92){if(!_0x421d92)throw new APINotFoundError(util[_0x8c35('0xaa')]('User\x20with\x20id\x20%s\x20not\x20found',_0x49fe57[_0x8c35('0x52')]['id']));return db['sequelize'][_0x8c35('0x10c')](function(_0x409270){return _0x421d92[_0x8c35('0x115')](_0x41da68,{'transaction':_0x409270})[_0x8c35('0x29')](function(){return db[_0x8c35('0x10a')][_0x8c35('0x4a')]({'where':{'id':{'$in':_0x41da68}}});})[_0x8c35('0x29')](function(_0x2059ef){var _0x4bc69d=_[_0x8c35('0x33')](_0x2059ef,function(_0x2774b4){return _0x2774b4[_0x8c35('0x118')]();});return Promise[_0x8c35('0x50')](_0x4bc69d);})['then'](function(_0x407976){_0x20f206=_[_0x8c35('0x10e')](_0x407976);var _0x15b284=_[_0x8c35('0x33')](_0x20f206,function(_0xcfad24){return _0xcfad24['removeAgent'](_0x421d92['id'],{'transaction':_0x409270});});return Promise[_0x8c35('0x50')](_0x15b284);})['then'](function(){if(!_0x421d92[_0x8c35('0x9d')])return;var _0x448826=_[_0x8c35('0xd6')](_0x20f206,function(_0xd5ed9d){return _0xd5ed9d[_0x8c35('0x110')](_0x8c35('0x9c'))===_0x8c35('0x119');});var _0x30cbd0=_[_0x8c35('0x33')](_0x448826,function(_0x3ec9f8){return db[_0x8c35('0xb2')][_0x8c35('0x37')]({'where':{'VoiceQueueId':_0x3ec9f8['id'],'UserId':_0x421d92['id']},'transaction':_0x409270});});return Promise['all'](_0x30cbd0);})[_0x8c35('0x29')](function(){return db[_0x8c35('0x111')][_0x8c35('0x4a')]({'where':{'teamId':{'$in':_0x41da68}}});})[_0x8c35('0x29')](function(_0x435cd7){var _0x58fe90=_['map'](_0x435cd7,function(_0x2a2fe0){return db[_0x8c35('0x112')][_0x8c35('0x37')]({'where':{'UserId':_0x421d92['id'],'VoicePrefixId':_0x2a2fe0[_0x8c35('0x113')]}},{'transaction':_0x409270});});return Promise[_0x8c35('0x50')](_0x58fe90);});});})[_0x8c35('0x29')](function(){for(var _0x2fefd9=0x0;_0x2fefd9<_0x20f206['length'];_0x2fefd9++){var _0x5a0822=_0x20f206[_0x2fefd9][_0x8c35('0x110')](_0x8c35('0x9c'));var _0x1afb5a=_0x5a0822+_0x8c35('0xa7');socket[_0x8c35('0x2b')](_0x8c35('0x2e')+_0x5a0822+'Queue:remove',{'UserId':_0xddc882,['queueField']:_0x20f206[_0x2fefd9]['id']});}})[_0x8c35('0x29')](respondWithStatusCode(_0x2053a9,null))['catch'](APIHandleError(_0x2053a9));};exports[_0x8c35('0x11a')]=function(_0x9e6689,_0x4802eb){var _0x5427ff={};var _0xcab585={};var _0x590506;var _0x2ab981;return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0x9e6689[_0x8c35('0x52')]['id']}})[_0x8c35('0x29')](handleEntityNotFound(_0x4802eb,null))[_0x8c35('0x29')](function(_0xb4066c){if(_0xb4066c){_0x590506=_0xb4066c;_0xcab585[_0x8c35('0x53')]=_[_0x8c35('0x54')](db[_0x8c35('0xcd')]['rawAttributes']);_0xcab585[_0x8c35('0x44')]=_['keys'](_0x9e6689[_0x8c35('0x44')]);_0xcab585['filters']=_[_0x8c35('0x57')](_0xcab585[_0x8c35('0x53')],_0xcab585['query']);_0x5427ff[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0xcab585[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0x9e6689[_0x8c35('0x44')]['fields']));_0x5427ff[_0x8c35('0x48')]=_0x5427ff[_0x8c35('0x48')]['length']?_0x5427ff['attributes']:_0xcab585['model'];_0x5427ff['order']=qs[_0x8c35('0xc9')](_0x9e6689[_0x8c35('0x44')]['sort']);_0x5427ff[_0x8c35('0x43')]=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0x9e6689[_0x8c35('0x44')],_0xcab585[_0x8c35('0x56')]));if(_0x9e6689['query'][_0x8c35('0xd6')]){_0x5427ff[_0x8c35('0x43')]=_[_0x8c35('0xcb')](_0x5427ff[_0x8c35('0x43')],{'$or':_[_0x8c35('0x33')](_0x5427ff[_0x8c35('0x48')],function(_0x221048){var _0x37b28b={};_0x37b28b[_0x221048]={'$like':'%'+_0x9e6689[_0x8c35('0x44')][_0x8c35('0xd6')]+'%'};return _0x37b28b;})});}_0x5427ff=_[_0x8c35('0xcb')]({},_0x5427ff,_0x9e6689['options']);return _0x590506[_0x8c35('0x11a')](_0x5427ff);}})['then'](function(_0x4e2427){if(_0x4e2427){_0x2ab981=_0x4e2427[_0x8c35('0x71')];if(!_0x9e6689[_0x8c35('0x44')]['hasOwnProperty'](_0x8c35('0xd5'))){_0x5427ff[_0x8c35('0x23')]=qs[_0x8c35('0x23')](_0x9e6689[_0x8c35('0x44')][_0x8c35('0x23')]);_0x5427ff[_0x8c35('0x22')]=qs[_0x8c35('0x22')](_0x9e6689[_0x8c35('0x44')][_0x8c35('0x22')]);}return _0x590506['getLists'](_0x5427ff);}})['then'](function(_0xd055dd){if(_0xd055dd){return _0xd055dd?{'count':_0x2ab981,'rows':_0xd055dd}:null;}})[_0x8c35('0x29')](respondWithResult(_0x4802eb,null))[_0x8c35('0x1f')](handleError(_0x4802eb,null));};exports[_0x8c35('0x11b')]=function(_0x4e58ac,_0x456634){var _0x5f1d22={};var _0x3c2218={};var _0x53ceb7;return db[_0x8c35('0x3d')][_0x8c35('0x96')]({'where':{'id':_0x4e58ac[_0x8c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x456634,null))[_0x8c35('0x29')](function(_0x283c07){if(_0x283c07){_0x53ceb7=_0x283c07;_0x3c2218[_0x8c35('0x53')]=_[_0x8c35('0x54')](db[_0x8c35('0x3d')][_0x8c35('0x3e')]);_0x3c2218['query']=_[_0x8c35('0x54')](_0x4e58ac[_0x8c35('0x44')]);_0x3c2218[_0x8c35('0x56')]=_['intersection'](_0x3c2218['model'],_0x3c2218['query']);_0x5f1d22[_0x8c35('0x48')]=_[_0x8c35('0x57')](_0x3c2218[_0x8c35('0x53')],qs[_0x8c35('0x58')](_0x4e58ac[_0x8c35('0x44')][_0x8c35('0x58')]));_0x5f1d22['attributes']=_0x5f1d22[_0x8c35('0x48')][_0x8c35('0x71')]?_0x5f1d22[_0x8c35('0x48')]:_0x3c2218['model'];_0x5f1d22[_0x8c35('0xc8')]=qs[_0x8c35('0xc9')](_0x4e58ac[_0x8c35('0x44')][_0x8c35('0xc9')]);_0x5f1d22[_0x8c35('0x43')]=qs[_0x8c35('0x56')](_[_0x8c35('0xca')](_0x4e58ac[_0x8c35('0x44')],_0x3c2218['filters']));if(_0x4e58ac[_0x8c35('0x44')][_0x8c35('0xd6')]){_0x5f1d22[_0x8c35('0x43')]=_[_0x8c35('0xcb')](_0x5f1d22[_0x8c35('0x43')],{'$or':_['map'](_0x5f1d22[_0x8c35('0x48')],function(_0x590b8c){var _0x5080a7={};_0x5080a7[_0x590b8c]={'$like':'%'+_0x4e58ac[_0x8c35('0x44')][_0x8c35('0xd6')]+'%'};return _0x5080a7;})});}_0x5f1d22['model']=db[_0x8c35('0x3d')];_0x5f1d22['as']=_0x8c35('0x2f');_0x5f1d22=_[_0x8c35('0xcb')]({},_0x5f1d22,_0x4e58ac[_0x8c35('0x5a')]);return _0x53ceb7[_0x8c35('0xf4')]({'include':[_0x5f1d22]});}})[_0x8c35('0x29')](function(_0x73995b){if(_0x73995b){var _0x168a6d={},_0x332f11=[];for(var _0x470e2e=0x0;_0x470e2e<_0x73995b['length'];_0x470e2e+=0x1){for(var _0x5e9267=0x0,_0x23ee1a;_0x5e9267<_0x73995b[_0x470e2e]['Agents'][_0x8c35('0x71')];_0x5e9267+=0x1){_0x23ee1a=_0x73995b[_0x470e2e][_0x8c35('0x2f')][_0x5e9267][_0x8c35('0x2c')]({'plain':!![]});_0x168a6d[_0x23ee1a['id']]=_0x23ee1a;}}_0x168a6d=_[_0x8c35('0x11c')](_0x168a6d);for(var _0x4bcf5f=qs[_0x8c35('0x22')](_0x4e58ac['query']['offset']);_0x4bcf5f<_0x168a6d[_0x8c35('0x71')]&&_0x332f11[_0x8c35('0x71')]=_0x5d26d5){_0x3d0f1a=_0x5d26d5;_0x19a2df=0xc8;}else{_0x19a2df=0xce;}_0x56ac9f['status'](_0x19a2df);return _0x56ac9f[_0x8fdb('0x27')]('Content-Range',_0x5e126b+'-'+_0x3d0f1a+'/'+_0x5d26d5)[_0x8fdb('0x22')](_0x3101f0);}return null;};}function saveUpdates(_0x74bf4a){return function(_0x45e297){if(_0x45e297){return _0x45e297[_0x8fdb('0x28')](_0x74bf4a)[_0x8fdb('0x29')](function(_0xbf0143){if(_0xbf0143['role']===_0x8fdb('0x2a')){socket['emit'](_0x8fdb('0x2b')+_0xbf0143['id'],_0xbf0143);}return _0xbf0143;});}return null;};}function removeEntity(_0x512354){return function(_0x54a322){if(_0x54a322){return _0x54a322[_0x8fdb('0x2c')]()[_0x8fdb('0x29')](function(){var _0x9824b3=_0x54a322[_0x8fdb('0x2d')]({'plain':!![]});if(_0x9824b3[_0x8fdb('0x2e')]==='admin')return;var _0x2fe19f=[{'name':_0x8fdb('0x2f'),'value':_0x8fdb('0x30'),'ignore':!![]},{'name':_0x8fdb('0x31'),'value':_0x8fdb('0x2a'),'ignore':![]},{'name':_0x8fdb('0x32'),'value':'telephone','ignore':![]}];var _0x390feb=_(_0x2fe19f)[_0x8fdb('0x33')](_0x8fdb('0x34'))[_0x8fdb('0x35')](_0x8fdb('0x36'))[_0x8fdb('0x36')]();if(_[_0x8fdb('0x37')](_0x390feb,_0x9824b3[_0x8fdb('0x2e')])){return;}var _0x22368c=_[_0x8fdb('0x38')](_0x2fe19f,[_0x8fdb('0x36'),_0x9824b3[_0x8fdb('0x2e')]])['name'];return db[_0x8fdb('0x39')][_0x8fdb('0x2c')]({'where':{'type':_0x22368c,'resourceId':_0x9824b3['id']}})[_0x8fdb('0x29')](function(){return _0x54a322;});})[_0x8fdb('0x29')](function(){_0x512354[_0x8fdb('0x20')](0xcc)[_0x8fdb('0x21')]();});}};}function handleEntityNotFound(_0x4b88fd){return function(_0x25bf0e){if(!_0x25bf0e){_0x4b88fd[_0x8fdb('0x3a')](0x194);}return _0x25bf0e;};}function handleError(_0x16d63d,_0x454c79){_0x454c79=_0x454c79||0x1f4;return function(_0x64e605){logger['error'](_0x64e605[_0x8fdb('0x3b')]);if(_0x64e605[_0x8fdb('0x3c')]){delete _0x64e605[_0x8fdb('0x3c')];}_0x16d63d[_0x8fdb('0x20')](_0x454c79)[_0x8fdb('0x3d')](_0x64e605);};}exports[_0x8fdb('0x3e')]=function(_0x47916f,_0x361d86){var _0x24ed6c={},_0x49c423={'count':0x0,'rows':[]};var _0x3224aa=_(db[_0x8fdb('0x3f')][_0x8fdb('0x40')])['map'](function(_0x36e756){return{'name':_0x36e756[_0x8fdb('0x41')],'type':_0x36e756[_0x8fdb('0x42')]['key']};})[_0x8fdb('0x33')](function(_0xb7c745){return!_['includes']([_0x8fdb('0x43'),'salt'],_0xb7c745[_0x8fdb('0x3c')]);})[_0x8fdb('0x36')]();_0x24ed6c=qs['getOptions'](_0x3224aa,_0x47916f);var _0x50e116={'where':_0x24ed6c[_0x8fdb('0x44')]};return db['User']['count'](_0x50e116)[_0x8fdb('0x29')](function(_0x4cf021){_0x49c423[_0x8fdb('0x26')]=_0x4cf021;if(_0x47916f['query'][_0x8fdb('0x45')]){_0x24ed6c[_0x8fdb('0x46')]=[{'all':!![]}];}if(_0x47916f[_0x8fdb('0x47')][_0x8fdb('0x48')]===_0x8fdb('0x49')){_0x24ed6c[_0x8fdb('0x46')]=[{'model':db[_0x8fdb('0x4a')],'as':_0x8fdb('0x48')}];}if(!_[_0x8fdb('0x37')](_0x24ed6c[_0x8fdb('0x4b')],'id')){_0x24ed6c[_0x8fdb('0x4b')][_0x8fdb('0x4c')]('id');}return db['User'][_0x8fdb('0x4d')](_0x24ed6c);})[_0x8fdb('0x29')](function(_0x4c81ce){_0x49c423[_0x8fdb('0x4e')]=_0x4c81ce;if(_0x47916f[_0x8fdb('0x47')][_0x8fdb('0x4f')]===_0x8fdb('0x49')){var _0x2302c5=[];for(var _0x55b0de=0x0;_0x55b0de<_0x49c423[_0x8fdb('0x4e')][_0x8fdb('0x50')];_0x55b0de++){_0x2302c5[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x51'),_0x49c423['rows'][_0x55b0de][_0x8fdb('0x52')]));_0x2302c5[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x53'),_0x49c423[_0x8fdb('0x4e')][_0x55b0de][_0x8fdb('0x52')]));_0x2302c5[_0x8fdb('0x4c')](get_open_tabs('fax',_0x49c423['rows'][_0x55b0de]['dataValues']));_0x2302c5['push'](get_open_tabs(_0x8fdb('0x54'),_0x49c423[_0x8fdb('0x4e')][_0x55b0de][_0x8fdb('0x52')]));_0x2302c5['push'](get_open_tabs(_0x8fdb('0x55'),_0x49c423['rows'][_0x55b0de]['dataValues']));_0x2302c5[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x56'),_0x49c423[_0x8fdb('0x4e')][_0x55b0de][_0x8fdb('0x52')]));}return Promise[_0x8fdb('0x57')](_0x2302c5)[_0x8fdb('0x29')](function(){return _0x49c423;});}else{return _0x49c423;}})['then'](respondWithFilteredResult(_0x361d86,_0x24ed6c))[_0x8fdb('0x1f')](handleError(_0x361d86,null));};exports[_0x8fdb('0x58')]=function(_0x4264aa,_0x921358){var _0x9213={'raw':![],'where':{'id':_0x4264aa[_0x8fdb('0x59')]['id']}},_0x3fd56e={};_0x3fd56e['model']=_[_0x8fdb('0x5a')](_['keys'](db[_0x8fdb('0x3f')][_0x8fdb('0x40')]),[_0x8fdb('0x43'),_0x8fdb('0x5b')]);_0x3fd56e[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x4264aa[_0x8fdb('0x47')]);_0x3fd56e[_0x8fdb('0x5d')]=_['intersection'](_0x3fd56e[_0x8fdb('0x5e')],_0x3fd56e[_0x8fdb('0x47')]);_0x9213[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x3fd56e[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x4264aa[_0x8fdb('0x47')]['fields']));_0x9213[_0x8fdb('0x4b')]=_0x9213[_0x8fdb('0x4b')]['length']?_0x9213[_0x8fdb('0x4b')]:_0x3fd56e[_0x8fdb('0x5e')];if(_0x4264aa[_0x8fdb('0x47')][_0x8fdb('0x45')]){_0x9213[_0x8fdb('0x46')]=[{'all':!![]}];}if(_0x4264aa['query'][_0x8fdb('0x48')]===_0x8fdb('0x49')){_0x9213[_0x8fdb('0x46')]=[{'model':db['UserSetting'],'as':_0x8fdb('0x48')}];}_0x9213=_['merge']({},_0x9213,_0x4264aa['options']);if(!_[_0x8fdb('0x37')](_0x9213[_0x8fdb('0x4b')],'id')){_0x9213[_0x8fdb('0x4b')][_0x8fdb('0x4c')]('id');}return db['User']['find'](_0x9213)[_0x8fdb('0x29')](handleEntityNotFound(_0x921358,null))[_0x8fdb('0x29')](function(_0x2e0f3e){var _0x173996=[];values=_0x2e0f3e;if(_0x4264aa[_0x8fdb('0x47')][_0x8fdb('0x4f')]===_0x8fdb('0x49')){_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x51'),_0x2e0f3e['dataValues']));_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x53'),_0x2e0f3e[_0x8fdb('0x52')]));_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x55'),_0x2e0f3e[_0x8fdb('0x52')]));_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x56'),_0x2e0f3e['dataValues']));_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x61'),_0x2e0f3e[_0x8fdb('0x52')]));_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x54'),_0x2e0f3e['dataValues']));return Promise[_0x8fdb('0x57')](_0x173996);}else{return values;}})['then'](function(){return values;})[_0x8fdb('0x29')](respondWithResult(_0x921358,null))[_0x8fdb('0x1f')](handleError(_0x921358,null));};exports['update']=function(_0x44f2d1,_0x5a095d){if(_0x44f2d1[_0x8fdb('0x62')]['id']){delete _0x44f2d1[_0x8fdb('0x62')]['id'];}delete _0x44f2d1[_0x8fdb('0x62')][_0x8fdb('0x2e')];return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x44f2d1['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x5a095d,null))[_0x8fdb('0x29')](saveUpdates(_0x44f2d1[_0x8fdb('0x62')],null))[_0x8fdb('0x29')](respondWithResult(_0x5a095d,null))[_0x8fdb('0x1f')](handleError(_0x5a095d,null));};exports[_0x8fdb('0x63')]=function(_0xa6d3b2,_0x4f2d1a){return db[_0x8fdb('0x3f')]['describe']()[_0x8fdb('0x29')](respondWithResult(_0x4f2d1a,null))['catch'](handleError(_0x4f2d1a,null));};exports[_0x8fdb('0x64')]=function(_0x2ec7f8,_0x4ce38c){return db['User']['find']({'where':{'id':_0x2ec7f8['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x4ce38c,null))[_0x8fdb('0x29')](function(_0x127fd7){if(_0x127fd7){return _0x127fd7[_0x8fdb('0x64')](_0x2ec7f8['body']['ids'],_['omit'](_0x2ec7f8['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4ce38c,null))[_0x8fdb('0x1f')](handleError(_0x4ce38c,null));};function validateUser(_0x43494d){return new Promise(function(_0x622aac,_0x256a59){if(_0x43494d['internal'])return _0x622aac(_0x43494d);return db['Setting'][_0x8fdb('0x65')](0x1)[_0x8fdb('0x29')](function(_0x27bd5f){if(_0x27bd5f[_0x8fdb('0x66')])authService[_0x8fdb('0x67')](_0x43494d[_0x8fdb('0x43')]);db['User'][_0x8fdb('0x68')](_0x8fdb('0x69'))[_0x8fdb('0x29')](function(_0x207f42){if(_[_0x8fdb('0x6a')](_0x207f42)){_0x43494d[_0x8fdb('0x69')]=_0x27bd5f['min_internal']||0x1;return;}if(_[_0x8fdb('0x6a')](_0x27bd5f[_0x8fdb('0x6b')])||_0x27bd5f['min_internal']===_0x207f42){_0x43494d[_0x8fdb('0x69')]=_0x207f42+0x1;return;}if(_0x27bd5f[_0x8fdb('0x6b')]>_0x207f42){_0x43494d['internal']=_0x27bd5f[_0x8fdb('0x6b')];return;}return db[_0x8fdb('0x6c')]['query']('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[_0x8fdb('0x6c')][_0x8fdb('0x6d')][_0x8fdb('0x6e')]})[_0x8fdb('0x29')](function(_0x5504f1){if(_0x5504f1&&_0x5504f1[_0x8fdb('0x50')]){for(var _0x4e5a81=0x0,_0x337e40=_0x5504f1[_0x8fdb('0x50')];_0x4e5a81<_0x337e40&&_['isNil'](_0x43494d['internal']);_0x4e5a81++){if(_0x27bd5f['min_internal']<=_0x5504f1[_0x4e5a81][_0x8fdb('0x6f')]){_0x43494d['internal']=_0x5504f1[_0x4e5a81][_0x8fdb('0x6f')];}else if(_0x27bd5f[_0x8fdb('0x6b')]>_0x5504f1[_0x4e5a81][_0x8fdb('0x6f')]&&_0x27bd5f[_0x8fdb('0x6b')]<=_0x5504f1[_0x4e5a81]['to']){_0x43494d[_0x8fdb('0x69')]=_0x27bd5f[_0x8fdb('0x6b')];}}}if(_[_0x8fdb('0x6a')](_0x43494d[_0x8fdb('0x69')])){_0x43494d[_0x8fdb('0x69')]=_0x207f42+0x1;}return _0x622aac(_0x43494d);});});})[_0x8fdb('0x1f')](function(_0x5d640e){_0x256a59(_0x5d640e);});});}function updateUser(_0x2b6f95){return new Promise(function(_0x50f42a,_0x4121d9){try{if(_0x2b6f95[_0x8fdb('0x70')]){_0x2b6f95[_0x8fdb('0x71')]=_0x2b6f95['internal'];_0x2b6f95[_0x8fdb('0x72')]={'mailbox':_0x2b6f95[_0x8fdb('0x69')],'password':_0x2b6f95['password'],'fullname':_0x2b6f95[_0x8fdb('0x73')],'email':_0x2b6f95[_0x8fdb('0x74')]};}if(_0x2b6f95[_0x8fdb('0x2e')]===_0x8fdb('0x2a')){if(!_0x2b6f95[_0x8fdb('0x75')])_0x2b6f95['permissions']=[_0x8fdb('0x76'),_0x8fdb('0x77'),'103',_0x8fdb('0x78'),_0x8fdb('0x79'),_0x8fdb('0x7a'),'105',_0x8fdb('0x7b'),'107','108',_0x8fdb('0x7c'),_0x8fdb('0x7d'),_0x8fdb('0x7e'),_0x8fdb('0x7f'),'115'];}_0x50f42a(_0x2b6f95);}catch(_0x408f91){_0x4121d9(_0x408f91);}});}exports[_0x8fdb('0x80')]=function(_0x401caf,_0x4b7883){if(_0x401caf[_0x8fdb('0x30')]['role']===_0x8fdb('0x2a'))throw new Error(_0x8fdb('0x81'));if(_0x401caf[_0x8fdb('0x62')][_0x8fdb('0x2e')]===_0x8fdb('0x30')&&_0x401caf['user'][_0x8fdb('0x2e')]!==_0x8fdb('0x82')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x401caf[_0x8fdb('0x62')][_0x8fdb('0x2e')]===_0x8fdb('0x82')&&_0x401caf[_0x8fdb('0x30')]['role']!==_0x8fdb('0x82')){throw new Error(_0x8fdb('0x83'));}return licenseUtil[_0x8fdb('0x84')]([_0x401caf[_0x8fdb('0x62')]])[_0x8fdb('0x29')](function(){return validateUser(_0x401caf[_0x8fdb('0x62')]);})[_0x8fdb('0x29')](function(_0x471b68){return updateUser(_0x471b68)['then'](function(_0x8cabb4){if(_0x8cabb4[_0x8fdb('0x2e')]==='admin'){_0x8cabb4[_0x8fdb('0x85')]=_0x401caf['user'][_0x8fdb('0x85')];delete _0x8cabb4['userProfileId'];}return _0x8cabb4;});})[_0x8fdb('0x29')](function(_0x16e257){return db[_0x8fdb('0x3f')][_0x8fdb('0x80')](_0x16e257,{'include':[{'model':db[_0x8fdb('0x72')],'as':_0x8fdb('0x72')}]});})[_0x8fdb('0x29')](function(_0x381f9b){if(_0x401caf[_0x8fdb('0x62')][_0x8fdb('0x2e')]===_0x8fdb('0x30'))return _0x381f9b;if(_0x401caf[_0x8fdb('0x30')]['role']!=='user')return _0x381f9b;return db['UserProfileSection']['find']({'where':{'name':_0x381f9b[_0x8fdb('0x2e')]===_0x8fdb('0x2a')?_0x8fdb('0x31'):'Telephones','userProfileId':_0x401caf[_0x8fdb('0x30')][_0x8fdb('0x86')]},'raw':!![]})['then'](function(_0xc71b6c){if(!_0xc71b6c||_0xc71b6c[_0x8fdb('0x87')]!=0x0)return _0x381f9b;return db['UserProfileResource'][_0x8fdb('0x80')]({'name':_0x381f9b[_0x8fdb('0x3c')],'resourceId':_0x381f9b['id'],'type':_0xc71b6c[_0x8fdb('0x3c')],'sectionId':_0xc71b6c['id']},{})[_0x8fdb('0x29')](function(){return _0x381f9b;});})['catch'](function(_0xb8e330){logger[_0x8fdb('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb8e330);throw _0xb8e330;});})[_0x8fdb('0x29')](respondWithResult(_0x4b7883,0xc9))['catch'](handleError(_0x4b7883,null));};exports[_0x8fdb('0x88')]=function(_0x20444a,_0x5edcb9){var _0xd3377f=_0x20444a['body'];var _0x41446f=[];if(_0x20444a[_0x8fdb('0x30')][_0x8fdb('0x2e')]===_0x8fdb('0x2a'))throw new Error(_0x8fdb('0x81'));if(_[_0x8fdb('0x89')](_0xd3377f,['role',_0x8fdb('0x30')])&&_0x20444a[_0x8fdb('0x30')]['role']!==_0x8fdb('0x82')){throw new Error(_0x8fdb('0x8a'));}if(_['some'](_0xd3377f,['role',_0x8fdb('0x82')])&&_0x20444a[_0x8fdb('0x30')]['role']!==_0x8fdb('0x82')){throw new Error(_0x8fdb('0x8b'));}return licenseUtil[_0x8fdb('0x84')](_0xd3377f)[_0x8fdb('0x29')](function(){return validateUser(_0xd3377f[0x0]);})[_0x8fdb('0x29')](function(){for(var _0x207c00=0x1;_0x207c00<_0xd3377f[_0x8fdb('0x50')];_0x207c00++){var _0x26167c=_0xd3377f[_0x207c00-0x1][_0x8fdb('0x69')];if(!_0xd3377f[_0x207c00][_0x8fdb('0x69')])_0xd3377f[_0x207c00][_0x8fdb('0x69')]=_0x26167c+0x1;_0x41446f['push'](validateUser(_0xd3377f[_0x207c00]));}return Promise['all'](_0x41446f);})['then'](function(){_0x41446f=[];for(var _0x1c05ca=0x0;_0x1c05ca<_0xd3377f[_0x8fdb('0x50')];_0x1c05ca++){_0x41446f[_0x8fdb('0x4c')](updateUser(_0xd3377f[_0x1c05ca]));}return Promise['all'](_0x41446f);})[_0x8fdb('0x29')](function(){_0x41446f=_0xd3377f[_0x8fdb('0x35')](function(_0x13fd70){return db['User']['create'](_0x13fd70,{'include':[{'model':db[_0x8fdb('0x72')],'as':'VoiceMail'}]})[_0x8fdb('0x29')](function(_0x40cb8d){_0x13fd70['id']=_0x40cb8d['id'];return _0x13fd70;});});return Promise[_0x8fdb('0x57')](_0x41446f);})['then'](function(_0x44ab9c){if(_0x20444a[_0x8fdb('0x62')]['role']===_0x8fdb('0x30'))return _0x44ab9c;if(_0x20444a[_0x8fdb('0x30')][_0x8fdb('0x2e')]!==_0x8fdb('0x30'))return _0x44ab9c;var _0x2953ce=_[_0x8fdb('0x89')](_0x44ab9c,function(_0x9f81c0){return _0x9f81c0[_0x8fdb('0x2e')]==='agent'||_0x9f81c0[_0x8fdb('0x2e')]===_0x8fdb('0x8c');});if(!_0x2953ce)return _0x44ab9c;return db[_0x8fdb('0x8d')][_0x8fdb('0x4d')]({'where':{'name':{'$or':[_0x8fdb('0x31'),_0x8fdb('0x32')]},'userProfileId':_0x20444a[_0x8fdb('0x30')][_0x8fdb('0x86')]},'raw':!![]})[_0x8fdb('0x29')](function(_0x58312b){if(_['isEmpty'](_0x58312b)||!_[_0x8fdb('0x89')](_0x58312b,[_0x8fdb('0x87'),0x0]))return _0x44ab9c;_0x41446f=[];var _0x1f3231=_(_0x58312b)[_0x8fdb('0x35')](function(_0x286f06){if(_0x286f06['autoAssociation']===0x1)return;return _0x286f06[_0x8fdb('0x3c')]==='Agents'?_0x8fdb('0x2a'):'telephone';})['compact']()[_0x8fdb('0x36')]();for(var _0x1793a8=0x0;_0x1793a8<_0x44ab9c[_0x8fdb('0x50')];_0x1793a8++){if(!_['includes'](_0x1f3231,_0x44ab9c[_0x1793a8]['role']))return;var _0x43d9ba=_0x44ab9c[_0x1793a8]['role']==='agent'?'Agents':_0x8fdb('0x32');_0x41446f['push'](db['UserProfileResource'][_0x8fdb('0x80')]({'name':_0x44ab9c[_0x1793a8][_0x8fdb('0x3c')],'resourceId':_0x44ab9c[_0x1793a8]['id'],'type':_0x43d9ba,'sectionId':_[_0x8fdb('0x38')](_0x58312b,[_0x8fdb('0x3c'),_0x43d9ba])['id']},{}));}return Promise[_0x8fdb('0x57')](_0x41446f);});})[_0x8fdb('0x29')](respondWithResult(_0x5edcb9,0xc9))[_0x8fdb('0x1f')](handleError(_0x5edcb9,null));};exports[_0x8fdb('0x8e')]=function(_0x17b9e8,_0x56c88f){if(_0x17b9e8['body']['id']){delete _0x17b9e8[_0x8fdb('0x62')]['id'];}return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x17b9e8[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](function(_0x56c547){if(!_0x56c547)return null;if(_0x56c547['id']===_0x17b9e8[_0x8fdb('0x30')]['id']){if(!_0x17b9e8['body']['oldPassword']||!_0x17b9e8[_0x8fdb('0x62')][_0x8fdb('0x8f')]){throw new db['Sequelize'][(_0x8fdb('0x90'))](_0x8fdb('0x91'));}if(!_0x56c547[_0x8fdb('0x92')](_0x17b9e8['body'][_0x8fdb('0x93')])){throw new db['Sequelize'][(_0x8fdb('0x90'))](_0x8fdb('0x94'));}if(_0x17b9e8[_0x8fdb('0x62')][_0x8fdb('0x93')]===_0x17b9e8[_0x8fdb('0x62')]['newPassword']){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0x96'));}}else if(_0x17b9e8[_0x8fdb('0x30')]['role']===_0x8fdb('0x82')){if(!_0x17b9e8[_0x8fdb('0x62')][_0x8fdb('0x8f')]){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0x97'));}}else if(_0x17b9e8[_0x8fdb('0x30')][_0x8fdb('0x2e')]===_0x8fdb('0x30')){if(!_0x17b9e8['body']['newPassword']){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x56c547[_0x8fdb('0x2e')]!==_0x8fdb('0x2a')){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0x81'));}}else{throw new db['Sequelize'][(_0x8fdb('0x90'))]('Unauthorized');}return _0x56c547;})[_0x8fdb('0x29')](handleEntityNotFound(_0x56c88f,null))[_0x8fdb('0x29')](function(_0xf42c1e){return db[_0x8fdb('0x98')]['findOne']({'attributes':['id',_0x8fdb('0x66'),_0x8fdb('0x99'),_0x8fdb('0x9a')]})[_0x8fdb('0x29')](function(_0x5bc5a3){if(_0x5bc5a3[_0x8fdb('0x66')])authService[_0x8fdb('0x67')](_0x17b9e8[_0x8fdb('0x62')]['newPassword']);if(!_0x5bc5a3[_0x8fdb('0x99')]||!_0xf42c1e['previousPasswords'])return _0xf42c1e;authService['validatePasswordHistory'](_0x17b9e8['body'][_0x8fdb('0x8f')],_0xf42c1e['previousPasswords'],_0x5bc5a3[_0x8fdb('0x9a')]);return _0xf42c1e;})[_0x8fdb('0x29')](saveUpdates({'password':_0x17b9e8['body'][_0x8fdb('0x8f')],'passwordResetAt':_0x17b9e8[_0x8fdb('0x30')]['id']==_0x17b9e8[_0x8fdb('0x59')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x17b9e8['body']['newPassword'],_0xf42c1e[_0x8fdb('0x9b')])},null));})[_0x8fdb('0x29')](respondWithResult(_0x56c88f,null))[_0x8fdb('0x1f')](handleError(_0x56c88f,null));};exports['addQueues']=function(_0x2d7767,_0x674fca){var _0x3898e5=_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0x9c')];return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x2d7767[_0x8fdb('0x59')]['id']},'attributes':['id','name',_0x8fdb('0x2e'),_0x8fdb('0x9d'),_0x8fdb('0x9e'),'voicePause',_0x8fdb('0x9f')]})[_0x8fdb('0x29')](handleEntityNotFound(_0x674fca,null))[_0x8fdb('0x29')](function(_0x31cd09){if(_0x31cd09){if(!utils['isValidChannel'](_0x3898e5)){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0xa0'));}return _0x31cd09[_0x8fdb('0xa1')+_[_0x8fdb('0xa2')](_0x3898e5[_0x8fdb('0xa3')]())+'Queues'](_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0xa4')],{'penalty':_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0xa5')]||0x0})[_0x8fdb('0xa6')](function(_0x5a09e3){for(var _0x17aa77=0x0;_0x17aa77<_0x2d7767['body'][_0x8fdb('0xa4')]['length'];_0x17aa77+=0x1){var _0xce7557={'UserId':Number(_0x2d7767[_0x8fdb('0x59')]['id'])};_0xce7557[_['capitalize'](_0x3898e5[_0x8fdb('0xa3')]())+'QueueId']=Number(_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0xa4')][_0x17aa77]);socket[_0x8fdb('0xa7')](_0x8fdb('0x30')+_[_0x8fdb('0xa2')](_0x3898e5[_0x8fdb('0xa3')]())+_0x8fdb('0xa8'),_0xce7557);}return _0x5a09e3;})[_0x8fdb('0x29')](function(){if(_0x3898e5===_0x8fdb('0xa9')){return db[_0x8fdb('0xaa')][_0x8fdb('0x4d')]({'where':{'id':_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0xa4')]||[]},'raw':!![],'attributes':['id',_0x8fdb('0x3c')]});}})[_0x8fdb('0x29')](function(_0x4ae24e){var _0x248ab2=_0x31cd09['get']({'plain':!![]});var _0x5c5548=[];if(_0x3898e5==='voice'&&_0x248ab2[_0x8fdb('0x2e')]==='agent'&&_0x248ab2[_0x8fdb('0x9d')]){for(let _0x134eba=0x0;_0x134eba<_0x4ae24e[_0x8fdb('0x50')];_0x134eba+=0x1){_0x5c5548['push']({'membername':_0x248ab2[_0x8fdb('0x3c')],'UserId':_0x248ab2['id'],'queue_name':_0x4ae24e[_0x134eba][_0x8fdb('0x3c')],'VoiceQueueId':_0x4ae24e[_0x134eba]['id'],'interface':_[_0x8fdb('0x6a')](_0x248ab2[_0x8fdb('0x9f')])?util[_0x8fdb('0xab')](_0x8fdb('0xac'),_0x248ab2[_0x8fdb('0x3c')]):_0x248ab2[_0x8fdb('0x9f')],'paused':_0x248ab2['voicePause']||![],'penalty':_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0xa5')]||0x0});}return Promise[_0x8fdb('0x57')](_0x5c5548[_0x8fdb('0x35')](function(_0x198dd6){return db[_0x8fdb('0xad')][_0x8fdb('0xae')](_0x198dd6);}));}return _0x31cd09;});}})['then'](respondWithStatusCode(_0x674fca,null))[_0x8fdb('0x1f')](handleError(_0x674fca,null));};exports[_0x8fdb('0xaf')]=function(_0x55c1b2,_0x2a3e5b){var _0x23cf9f,_0x439825;return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x55c1b2['params']['id']},'attributes':['id','name','role']})[_0x8fdb('0x29')](handleEntityNotFound(_0x2a3e5b,null))[_0x8fdb('0x29')](function(_0x1ab973){if(_0x1ab973){_0x23cf9f=_0x1ab973;if(!_0x55c1b2['query'][_0x8fdb('0x9c')]||!utils[_0x8fdb('0xb0')](_0x55c1b2[_0x8fdb('0x47')]['channel'])){throw new db[(_0x8fdb('0x95'))]['ValidationError'](_0x8fdb('0xa0'));}return _0x1ab973[_0x8fdb('0xb1')+_[_0x8fdb('0xa2')](_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0x9c')][_0x8fdb('0xa3')]())+'Queues'](_0x55c1b2[_0x8fdb('0x47')]['ids']);}})[_0x8fdb('0x29')](function(_0x1882f7){if(_[_0x8fdb('0xb2')](_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0xa4')])){for(var _0xc16f4c=0x0;_0xc16f4c<_0x55c1b2[_0x8fdb('0x47')]['ids']['length'];_0xc16f4c+=0x1){_0x439825={'UserId':Number(_0x55c1b2[_0x8fdb('0x59')]['id'])};_0x439825[_[_0x8fdb('0xa2')](_0x55c1b2['query'][_0x8fdb('0x9c')][_0x8fdb('0xa3')]())+_0x8fdb('0xb3')]=Number(_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0xa4')][_0xc16f4c]);socket[_0x8fdb('0xa7')]('user'+_[_0x8fdb('0xa2')](_0x55c1b2['query'][_0x8fdb('0x9c')][_0x8fdb('0xa3')]())+_0x8fdb('0xb4'),_0x439825);}}else{_0x439825={'UserId':Number(_0x55c1b2[_0x8fdb('0x59')]['id'])};_0x439825[_[_0x8fdb('0xa2')](_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0x9c')][_0x8fdb('0xa3')]())+_0x8fdb('0xb3')]=Number(_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0xa4')]);socket[_0x8fdb('0xa7')](_0x8fdb('0x30')+_[_0x8fdb('0xa2')](_0x55c1b2[_0x8fdb('0x47')]['channel'][_0x8fdb('0xa3')]())+_0x8fdb('0xb4'),_0x439825);}return _0x1882f7;})[_0x8fdb('0x29')](function(){if(_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0x9c')]===_0x8fdb('0xa9')){return db[_0x8fdb('0xad')]['destroy']({'where':{'UserId':_0x55c1b2[_0x8fdb('0x59')]['id'],'VoiceQueueId':_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0xa4')]},'individualHooks':!![]})['then'](function(){return _0x23cf9f;});}return _0x23cf9f;})[_0x8fdb('0x29')](respondWithStatusCode(_0x2a3e5b,null))[_0x8fdb('0x1f')](handleError(_0x2a3e5b,null));};exports[_0x8fdb('0xb5')]=function(_0x4fde63,_0x3862cc){_0x4fde63[_0x8fdb('0x62')][_0x8fdb('0xb6')]=_0x4fde63[_0x8fdb('0xb7')][_0x8fdb('0xb8')];return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x4fde63['params']['id']}})['then'](handleEntityNotFound(_0x3862cc,null))[_0x8fdb('0x29')](saveUpdates(_0x4fde63['body'],null))[_0x8fdb('0x29')](respondWithResult(_0x3862cc,null))[_0x8fdb('0x1f')](handleError(_0x3862cc,null));};exports[_0x8fdb('0xb9')]=function(_0xb910c1,_0x38a2d6){var _0x661cb4=path[_0x8fdb('0xba')](config['root'],_0x8fdb('0xbb'));return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0xb910c1[_0x8fdb('0x59')]['id']},'attributes':['id',_0x8fdb('0xb6')],'raw':!![]})[_0x8fdb('0x29')](handleEntityNotFound(_0x38a2d6,null))[_0x8fdb('0x29')](function(_0x14c7a6){if(_0x14c7a6){if(_['isNil'](_0x14c7a6['userpic'])){return _0x38a2d6['download'](_0x661cb4);}else{if(!fs[_0x8fdb('0xbc')](path[_0x8fdb('0xba')](config[_0x8fdb('0xbd')],_0x8fdb('0xbe'),_0x14c7a6[_0x8fdb('0xb6')]))){return _0x38a2d6['download'](_0x661cb4);}return _0x38a2d6[_0x8fdb('0xbf')](path[_0x8fdb('0xba')](config[_0x8fdb('0xbd')],_0x8fdb('0xbe'),_0x14c7a6['userpic']));}}})['catch'](handleError(_0x38a2d6,null));};exports[_0x8fdb('0xc0')]=function(_0x55997f,_0x535d36){return db[_0x8fdb('0x3f')]['find']({'where':{'id':_0x55997f[_0x8fdb('0x59')]['id']},'attributes':['id']})[_0x8fdb('0x29')](handleEntityNotFound(_0x535d36,null))[_0x8fdb('0x29')](function(_0x55d561){var _0x59d4d8=[];values=_0x55d561[_0x8fdb('0x52')];_0x59d4d8[_0x8fdb('0x4c')](get_open_tabs('chat',_0x55d561['dataValues']));_0x59d4d8[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x53'),_0x55d561[_0x8fdb('0x52')]));_0x59d4d8['push'](get_open_tabs('openchannel',_0x55d561[_0x8fdb('0x52')]));_0x59d4d8[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x56'),_0x55d561['dataValues']));_0x59d4d8[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x61'),_0x55d561[_0x8fdb('0x52')]));_0x59d4d8[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x54'),_0x55d561[_0x8fdb('0x52')]));return Promise['all'](_0x59d4d8);})[_0x8fdb('0x29')](function(_0x1adeca){if(_0x1adeca){var _0x12f5f7=_['map'](values[_0x8fdb('0xc1')],function(_0x33c50b){return{'channel':_0x8fdb('0xc2'),'id':_0x33c50b['id'],'createdAt':_0x33c50b[_0x8fdb('0xc3')]};});var _0x2db42c=_[_0x8fdb('0x35')](values[_0x8fdb('0xc4')],function(_0x307b79){return{'channel':_0x8fdb('0xc5'),'id':_0x307b79['id'],'createdAt':_0x307b79[_0x8fdb('0xc3')]};});var _0x21125a=_[_0x8fdb('0x35')](values[_0x8fdb('0xc6')],function(_0x436d89){return{'channel':_0x8fdb('0xc7'),'id':_0x436d89['id'],'createdAt':_0x436d89['createdAt']};});var _0x559eb3=_[_0x8fdb('0x35')](values[_0x8fdb('0xc8')],function(_0x15371f){return{'channel':'MAIL','id':_0x15371f['id'],'createdAt':_0x15371f['createdAt']};});var _0x994794=_['map'](values[_0x8fdb('0xc9')],function(_0x5d90e5){return{'channel':_0x8fdb('0xca'),'id':_0x5d90e5['id'],'createdAt':_0x5d90e5['createdAt']};});var _0x3f009a=_[_0x8fdb('0x35')](values[_0x8fdb('0xcb')],function(_0x1b16fb){return{'channel':_0x8fdb('0xcc'),'id':_0x1b16fb['id'],'createdAt':_0x1b16fb[_0x8fdb('0xc3')]};});var _0x1747e1=_[_0x8fdb('0xcd')](_0x12f5f7,_0x2db42c,_0x21125a,_0x559eb3,_0x994794,_0x3f009a);var _0xc92c5d={'count':_0x1747e1['length'],'rows':_0x1747e1};return _0xc92c5d;}else return null;})[_0x8fdb('0x29')](respondWithResult(_0x535d36,null))[_0x8fdb('0x1f')](handleError(_0x535d36,null));};exports[_0x8fdb('0xce')]=function(_0x219590,_0x381ce7){var _0xf3fd={};var _0x2521f7={};var _0x588c75;var _0x8d1ff5;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x219590[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x381ce7,null))[_0x8fdb('0x29')](function(_0x2cb47a){if(_0x2cb47a){_0x588c75=_0x2cb47a;_0x2521f7[_0x8fdb('0x5e')]=_['keys'](db[_0x8fdb('0xd0')][_0x8fdb('0x40')]);_0x2521f7[_0x8fdb('0x47')]=_['keys'](_0x219590[_0x8fdb('0x47')]);_0x2521f7[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x2521f7[_0x8fdb('0x5e')],_0x2521f7[_0x8fdb('0x47')]);_0xf3fd[_0x8fdb('0x4b')]=_['intersection'](_0x2521f7[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x219590[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0xf3fd[_0x8fdb('0x4b')]=_0xf3fd[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0xf3fd[_0x8fdb('0x4b')]:_0x2521f7[_0x8fdb('0x5e')];_0xf3fd['order']=qs[_0x8fdb('0xd1')](_0x219590[_0x8fdb('0x47')][_0x8fdb('0xd1')]);_0xf3fd[_0x8fdb('0x44')]=qs['filters'](_[_0x8fdb('0xd2')](_0x219590[_0x8fdb('0x47')],_0x2521f7['filters']));if(_0x219590[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0xf3fd[_0x8fdb('0x44')]=_['merge'](_0xf3fd['where'],{'$or':_[_0x8fdb('0x35')](_0xf3fd['attributes'],function(_0x370be2){var _0x1e904f={};_0x1e904f[_0x370be2]={'$like':'%'+_0x219590[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x1e904f;})});}_0xf3fd=_[_0x8fdb('0xd3')]({},_0xf3fd,_0x219590['options']);return _0x588c75['getContacts'](_0xf3fd);}})[_0x8fdb('0x29')](function(_0x4949d7){if(_0x4949d7){_0x8d1ff5=_0x4949d7['length'];if(_0x219590[_0x8fdb('0x47')]['hasOwnProperty'](_0x8fdb('0x45'))){_0xf3fd['include']=[{'model':db['CmList'],'as':_0x8fdb('0xd4'),'required':![]},{'model':db[_0x8fdb('0xd5')],'as':'Tags','attributes':['id','name',_0x8fdb('0xd6')],'where':_0x219590['query'][_0x8fdb('0xd7')]?{'id':_0x219590[_0x8fdb('0x47')]['tag']}:undefined,'required':_0x219590[_0x8fdb('0x47')][_0x8fdb('0xd7')]?!![]:![]}];}if(!_0x219590['query']['hasOwnProperty'](_0x8fdb('0xd8'))){_0xf3fd['limit']=qs[_0x8fdb('0x24')](_0x219590[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0xf3fd[_0x8fdb('0x25')]=qs['offset'](_0x219590['query'][_0x8fdb('0x25')]);}return _0x588c75['getContacts'](_0xf3fd);}})['then'](function(_0x378c5a){if(_0x378c5a){return _0x378c5a?{'count':_0x8d1ff5,'rows':_0x378c5a}:null;}})['then'](respondWithResult(_0x381ce7,null))[_0x8fdb('0x1f')](handleError(_0x381ce7,null));};exports['getQueues']=function(_0x5f1c60,_0x38d045){var _0x435662;var _0x45a570={};var _0x52112f;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x5f1c60['params']['id']},'attributes':['id','name',_0x8fdb('0x2e')]})[_0x8fdb('0x29')](handleEntityNotFound(_0x38d045,null))[_0x8fdb('0x29')](function(_0x18913c){if(!utils[_0x8fdb('0xb0')](_0x5f1c60['query'][_0x8fdb('0x9c')])){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0xa0'));}_0x435662=_0x18913c;var _0x1a61cb={};_0x1a61cb[_0x8fdb('0x5e')]=_['keys'](db[_[_0x8fdb('0xa2')](_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x9c')])+_0x8fdb('0xd9')][_0x8fdb('0x40')]);_0x1a61cb[_0x8fdb('0x47')]=_['keys'](_0x5f1c60['query']);_0x1a61cb[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x1a61cb[_0x8fdb('0x5e')],_0x1a61cb[_0x8fdb('0x47')]);_0x45a570[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x1a61cb['model'],qs[_0x8fdb('0x60')](_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x45a570['attributes']=_0x45a570[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x45a570[_0x8fdb('0x4b')]:_0x1a61cb[_0x8fdb('0x5e')];_0x45a570['order']=qs['sort'](_0x5f1c60[_0x8fdb('0x47')]['sort']);_0x45a570[_0x8fdb('0x44')]=qs['filters'](_[_0x8fdb('0xd2')](_0x5f1c60[_0x8fdb('0x47')],_0x1a61cb[_0x8fdb('0x5d')]));if(_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x45a570[_0x8fdb('0x44')]=_['merge'](_0x45a570[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x45a570['attributes'],function(_0x37aadd){var _0xbc8dbe={};_0xbc8dbe[_0x37aadd]={'$like':'%'+_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0xbc8dbe;})});}_0x45a570=_['merge']({},_0x45a570,_0x5f1c60['options']);switch(_0x435662['role']){case'admin':return db[_[_0x8fdb('0xa2')](_0x5f1c60[_0x8fdb('0x47')]['channel'])+_0x8fdb('0xd9')][_0x8fdb('0x4d')](_0x45a570);case _0x8fdb('0x30'):case'agent':return _0x435662[_0x8fdb('0x2d')+_['capitalize'](_0x5f1c60['query']['channel'])+_0x8fdb('0xda')](_0x45a570);default:throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0xdb'));}})['then'](function(_0x547a1c){_0x52112f=_0x547a1c[_0x8fdb('0x50')];if(!_0x5f1c60['query']['hasOwnProperty']('nolimit')){_0x45a570[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x45a570[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x5f1c60['query']['offset']);}switch(_0x435662[_0x8fdb('0x2e')]){case _0x8fdb('0x82'):return db[_['capitalize'](_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x9c')])+_0x8fdb('0xd9')][_0x8fdb('0x4d')](_0x45a570);case _0x8fdb('0x30'):case'agent':return _0x435662[_0x8fdb('0x2d')+_[_0x8fdb('0xa2')](_0x5f1c60[_0x8fdb('0x47')]['channel'])+'Queues'](_0x45a570);}})[_0x8fdb('0x29')](function(_0x1e063e){return{'count':_0x52112f,'rows':_0x1e063e};})[_0x8fdb('0x29')](respondWithResult(_0x38d045,null))[_0x8fdb('0x1f')](handleError(_0x38d045,null));};exports[_0x8fdb('0xdc')]=function(_0x2f0e01,_0x19ea2b){var _0x299e09={};var _0xab44da={};var _0x4300ef;var _0x1f6642;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x2f0e01[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x19ea2b,null))[_0x8fdb('0x29')](function(_0x526792){if(_0x526792){_0x4300ef=_0x526792;_0xab44da[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db['UserVoiceQueueRt'][_0x8fdb('0x40')]);_0xab44da['query']=_['keys'](_0x2f0e01['query']);_0xab44da['filters']=_[_0x8fdb('0x5f')](_0xab44da['model'],_0xab44da[_0x8fdb('0x47')]);_0x299e09['attributes']=_['intersection'](_0xab44da[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x2f0e01[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x299e09[_0x8fdb('0x4b')]=_0x299e09['attributes'][_0x8fdb('0x50')]?_0x299e09['attributes']:_0xab44da[_0x8fdb('0x5e')];_0x299e09['order']=qs[_0x8fdb('0xd1')](_0x2f0e01['query'][_0x8fdb('0xd1')]);_0x299e09[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x2f0e01['query'],_0xab44da['filters']));if(_0x2f0e01[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x299e09[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x299e09[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x299e09[_0x8fdb('0x4b')],function(_0x432adb){var _0x310c7a={};_0x310c7a[_0x432adb]={'$like':'%'+_0x2f0e01['query']['filter']+'%'};return _0x310c7a;})});}_0x299e09=_[_0x8fdb('0xd3')]({},_0x299e09,_0x2f0e01['options']);return _0x4300ef[_0x8fdb('0xdc')](_0x299e09);}})[_0x8fdb('0x29')](function(_0x160259){if(_0x160259){_0x1f6642=_0x160259['length'];if(!_0x2f0e01[_0x8fdb('0x47')][_0x8fdb('0xdd')]('nolimit')){_0x299e09['limit']=qs[_0x8fdb('0x24')](_0x2f0e01[_0x8fdb('0x47')]['limit']);_0x299e09['offset']=qs[_0x8fdb('0x25')](_0x2f0e01['query'][_0x8fdb('0x25')]);}return _0x4300ef[_0x8fdb('0xdc')](_0x299e09);}})[_0x8fdb('0x29')](function(_0x1f148){if(_0x1f148){return _0x1f148?{'count':_0x1f6642,'rows':_0x1f148}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x19ea2b,null))[_0x8fdb('0x1f')](handleError(_0x19ea2b,null));};exports['getGroups']=function(_0x44f734,_0x5f3d84){var _0x2e2f3e={};var _0x1840e5={};var _0x216c4d;var _0x2b2b0c;return db[_0x8fdb('0x3f')]['findOne']({'where':{'id':_0x44f734['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x5f3d84,null))[_0x8fdb('0x29')](function(_0x400872){if(_0x400872){_0x216c4d=_0x400872;_0x1840e5[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db[_0x8fdb('0xde')][_0x8fdb('0x40')]);_0x1840e5['query']=_['keys'](_0x44f734[_0x8fdb('0x47')]);_0x1840e5[_0x8fdb('0x5d')]=_['intersection'](_0x1840e5[_0x8fdb('0x5e')],_0x1840e5['query']);_0x2e2f3e[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x1840e5[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x44f734[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x2e2f3e[_0x8fdb('0x4b')]=_0x2e2f3e[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x2e2f3e[_0x8fdb('0x4b')]:_0x1840e5[_0x8fdb('0x5e')];_0x2e2f3e['order']=qs['sort'](_0x44f734[_0x8fdb('0x47')]['sort']);_0x2e2f3e[_0x8fdb('0x44')]=qs['filters'](_[_0x8fdb('0xd2')](_0x44f734[_0x8fdb('0x47')],_0x1840e5[_0x8fdb('0x5d')]));if(_0x44f734[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x2e2f3e['where']=_[_0x8fdb('0xd3')](_0x2e2f3e[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x2e2f3e[_0x8fdb('0x4b')],function(_0x19108e){var _0x413d18={};_0x413d18[_0x19108e]={'$like':'%'+_0x44f734[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x413d18;})});}_0x2e2f3e=_[_0x8fdb('0xd3')]({},_0x2e2f3e,_0x44f734[_0x8fdb('0xdf')]);return _0x216c4d[_0x8fdb('0xe0')](_0x2e2f3e);}})[_0x8fdb('0x29')](function(_0x39850d){if(_0x39850d){_0x2b2b0c=_0x39850d[_0x8fdb('0x50')];if(!_0x44f734['query'][_0x8fdb('0xdd')](_0x8fdb('0xd8'))){_0x2e2f3e[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x44f734[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x2e2f3e[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x44f734[_0x8fdb('0x47')]['offset']);}return _0x216c4d[_0x8fdb('0xe0')](_0x2e2f3e);}})['then'](function(_0x457b4a){if(_0x457b4a){return _0x457b4a?{'count':_0x2b2b0c,'rows':_0x457b4a}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x5f3d84,null))[_0x8fdb('0x1f')](handleError(_0x5f3d84,null));};exports[_0x8fdb('0xe1')]=function(_0x543ff0,_0x207209){var _0x205e48={'raw':!![],'where':{}};var _0x3395cc={};var _0x91fc05={'count':0x0,'rows':[]};return db['User'][_0x8fdb('0xcf')]({'where':{'id':_0x543ff0[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x207209,null))[_0x8fdb('0x29')](function(_0xc96a49){if(_0xc96a49){_0x3395cc['model']=_[_0x8fdb('0x5c')](db[_0x8fdb('0xe2')]['rawAttributes']);_0x3395cc[_0x8fdb('0x47')]=_['keys'](_0x543ff0[_0x8fdb('0x47')]);_0x3395cc[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x3395cc[_0x8fdb('0x5e')],_0x3395cc['query']);_0x205e48['attributes']=_[_0x8fdb('0x5f')](_0x3395cc[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x543ff0['query']['fields']));_0x205e48[_0x8fdb('0x4b')]=_0x205e48[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x205e48['attributes']:_0x3395cc[_0x8fdb('0x5e')];if(!_0x543ff0[_0x8fdb('0x47')][_0x8fdb('0xdd')]('nolimit')){_0x205e48[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x543ff0[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x205e48[_0x8fdb('0x25')]=qs['offset'](_0x543ff0['query']['offset']);}_0x205e48[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x543ff0[_0x8fdb('0x47')][_0x8fdb('0xd1')]);_0x205e48['where']=qs[_0x8fdb('0x5d')](_['pick'](_0x543ff0[_0x8fdb('0x47')],_0x3395cc['filters']));_0x205e48['where']['UserId']=_0xc96a49['id'];if(_0x543ff0[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x205e48['where']=_[_0x8fdb('0xd3')](_0x205e48[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x205e48[_0x8fdb('0x4b')],function(_0x302b85){var _0x70c7ed={};_0x70c7ed[_0x302b85]={'$like':'%'+_0x543ff0['query']['filter']+'%'};return _0x70c7ed;})});}_0x205e48=_['merge']({},_0x205e48,_0x543ff0[_0x8fdb('0xdf')]);return db['VoiceRecording'][_0x8fdb('0x26')]({'where':_0x205e48[_0x8fdb('0x44')]})['then'](function(_0x528ba1){_0x91fc05[_0x8fdb('0x26')]=_0x528ba1;if(_0x543ff0[_0x8fdb('0x47')][_0x8fdb('0x45')]){_0x205e48[_0x8fdb('0x46')]=[{'all':!![]}];}return db[_0x8fdb('0xe2')][_0x8fdb('0x4d')](_0x205e48);})[_0x8fdb('0x29')](function(_0x513d3f){_0x91fc05[_0x8fdb('0x4e')]=_0x513d3f;return _0x91fc05;});}})[_0x8fdb('0x29')](respondWithFilteredResult(_0x207209,_0x205e48))[_0x8fdb('0x1f')](handleError(_0x207209,null));};exports[_0x8fdb('0xe4')]=function(_0x5b1cd6,_0x2ada5d){var _0x5f4785={'raw':!![],'where':{}};var _0xf101f7={};var _0x5de1a1={'count':0x0,'rows':[]};return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x5b1cd6[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x2ada5d,null))[_0x8fdb('0x29')](function(_0x4f0a28){if(_0x4f0a28){_0xf101f7[_0x8fdb('0x5e')]=_['keys'](db[_0x8fdb('0xe5')][_0x8fdb('0x40')]);_0xf101f7[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x5b1cd6[_0x8fdb('0x47')]);_0xf101f7['filters']=_[_0x8fdb('0x5f')](_0xf101f7['model'],_0xf101f7[_0x8fdb('0x47')]);_0x5f4785[_0x8fdb('0x4b')]=_['intersection'](_0xf101f7[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x5b1cd6['query']['fields']));_0x5f4785[_0x8fdb('0x4b')]=_0x5f4785['attributes'][_0x8fdb('0x50')]?_0x5f4785[_0x8fdb('0x4b')]:_0xf101f7[_0x8fdb('0x5e')];if(!_0x5b1cd6['query']['hasOwnProperty'](_0x8fdb('0xd8'))){_0x5f4785[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x5b1cd6[_0x8fdb('0x47')]['limit']);_0x5f4785[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x5b1cd6[_0x8fdb('0x47')][_0x8fdb('0x25')]);}_0x5f4785[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x5b1cd6['query'][_0x8fdb('0xd1')]);_0x5f4785[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x5b1cd6['query'],_0xf101f7[_0x8fdb('0x5d')]));_0x5f4785[_0x8fdb('0x44')][_0x8fdb('0xe6')]=_0x4f0a28['id'];if(_0x5b1cd6[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x5f4785[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x5f4785['where'],{'$or':_[_0x8fdb('0x35')](_0x5f4785['attributes'],function(_0x3e2014){var _0x349397={};_0x349397[_0x3e2014]={'$like':'%'+_0x5b1cd6[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x349397;})});}_0x5f4785=_[_0x8fdb('0xd3')]({},_0x5f4785,_0x5b1cd6['options']);return db[_0x8fdb('0xe5')][_0x8fdb('0x26')]({'where':_0x5f4785[_0x8fdb('0x44')]})[_0x8fdb('0x29')](function(_0x70915f){_0x5de1a1['count']=_0x70915f;if(_0x5b1cd6[_0x8fdb('0x47')][_0x8fdb('0x45')]){_0x5f4785[_0x8fdb('0x46')]=[{'all':!![]}];}return db[_0x8fdb('0xe5')][_0x8fdb('0x4d')](_0x5f4785);})[_0x8fdb('0x29')](function(_0x31d250){_0x5de1a1['rows']=_0x31d250;return _0x5de1a1;});}})[_0x8fdb('0x29')](respondWithFilteredResult(_0x2ada5d,_0x5f4785))[_0x8fdb('0x1f')](handleError(_0x2ada5d,null));};exports[_0x8fdb('0xe7')]=function(_0x437fdf,_0x1e13e3){var _0x22d6f4={};var _0x1eab3a={};var _0x19bb38;var _0x147c3e;return db[_0x8fdb('0x3f')]['findOne']({'where':{'id':_0x437fdf[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x1e13e3,null))[_0x8fdb('0x29')](function(_0x35a982){if(_0x35a982){_0x19bb38=_0x35a982;_0x1eab3a[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db[_0x8fdb('0xe8')]['rawAttributes']);_0x1eab3a[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x437fdf[_0x8fdb('0x47')]);_0x1eab3a['filters']=_[_0x8fdb('0x5f')](_0x1eab3a[_0x8fdb('0x5e')],_0x1eab3a[_0x8fdb('0x47')]);_0x22d6f4[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x1eab3a[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x437fdf[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x22d6f4[_0x8fdb('0x4b')]=_0x22d6f4[_0x8fdb('0x4b')]['length']?_0x22d6f4[_0x8fdb('0x4b')]:_0x1eab3a[_0x8fdb('0x5e')];_0x22d6f4['order']=qs['sort'](_0x437fdf['query'][_0x8fdb('0xd1')]);_0x22d6f4[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x437fdf[_0x8fdb('0x47')],_0x1eab3a[_0x8fdb('0x5d')]));if(_0x437fdf['query'][_0x8fdb('0x33')]){_0x22d6f4[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x22d6f4['where'],{'$or':_[_0x8fdb('0x35')](_0x22d6f4['attributes'],function(_0x4d3b52){var _0x2aea33={};_0x2aea33[_0x4d3b52]={'$like':'%'+_0x437fdf[_0x8fdb('0x47')]['filter']+'%'};return _0x2aea33;})});}_0x22d6f4=_[_0x8fdb('0xd3')]({},_0x22d6f4,_0x437fdf[_0x8fdb('0xdf')]);return _0x19bb38[_0x8fdb('0xe7')](_0x22d6f4);}})[_0x8fdb('0x29')](function(_0x4ab28a){if(_0x4ab28a){_0x147c3e=_0x4ab28a[_0x8fdb('0x50')];if(!_0x437fdf['query'][_0x8fdb('0xdd')]('nolimit')){_0x22d6f4[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x437fdf[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x22d6f4[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x437fdf[_0x8fdb('0x47')]['offset']);}return _0x19bb38['getChatInteractions'](_0x22d6f4);}})[_0x8fdb('0x29')](function(_0x3f4745){if(_0x3f4745){return _0x3f4745?{'count':_0x147c3e,'rows':_0x3f4745}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x1e13e3,null))[_0x8fdb('0x1f')](handleError(_0x1e13e3,null));};exports[_0x8fdb('0xe9')]=function(_0x300e99,_0x18e12f){var _0x41ba18={};var _0xaa127f={};var _0x12d12b;var _0x79b9b6;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x300e99['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x18e12f,null))[_0x8fdb('0x29')](function(_0x450743){if(_0x450743){_0x12d12b=_0x450743;_0xaa127f['model']=_[_0x8fdb('0x5c')](db[_0x8fdb('0xea')][_0x8fdb('0x40')]);_0xaa127f[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x300e99[_0x8fdb('0x47')]);_0xaa127f[_0x8fdb('0x5d')]=_['intersection'](_0xaa127f[_0x8fdb('0x5e')],_0xaa127f[_0x8fdb('0x47')]);_0x41ba18[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0xaa127f[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x300e99[_0x8fdb('0x47')]['fields']));_0x41ba18[_0x8fdb('0x4b')]=_0x41ba18[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x41ba18['attributes']:_0xaa127f[_0x8fdb('0x5e')];_0x41ba18[_0x8fdb('0xe3')]=qs['sort'](_0x300e99['query']['sort']);_0x41ba18[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x300e99[_0x8fdb('0x47')],_0xaa127f['filters']));if(_0x300e99[_0x8fdb('0x47')]['filter']){_0x41ba18[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x41ba18[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x41ba18['attributes'],function(_0x4182f1){var _0x4c2027={};_0x4c2027[_0x4182f1]={'$like':'%'+_0x300e99['query'][_0x8fdb('0x33')]+'%'};return _0x4c2027;})});}_0x41ba18=_[_0x8fdb('0xd3')]({},_0x41ba18,_0x300e99[_0x8fdb('0xdf')]);return _0x12d12b[_0x8fdb('0xe9')](_0x41ba18);}})['then'](function(_0x559352){if(_0x559352){_0x79b9b6=_0x559352[_0x8fdb('0x50')];if(!_0x300e99[_0x8fdb('0x47')][_0x8fdb('0xdd')](_0x8fdb('0xd8'))){_0x41ba18[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x300e99[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x41ba18[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x300e99[_0x8fdb('0x47')]['offset']);}return _0x12d12b['getOpenchannelInteractions'](_0x41ba18);}})[_0x8fdb('0x29')](function(_0x4ec8a5){if(_0x4ec8a5){return _0x4ec8a5?{'count':_0x79b9b6,'rows':_0x4ec8a5}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x18e12f,null))['catch'](handleError(_0x18e12f,null));};exports[_0x8fdb('0xeb')]=function(_0x55ad66,_0x70dd3c){var _0x59e4dd={'raw':!![],'where':{}};var _0x1cb3a8={};var _0x56e220={'count':0x0,'rows':[]};return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x55ad66['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x70dd3c,null))[_0x8fdb('0x29')](function(_0x390def){if(_0x390def){_0x1cb3a8[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db[_0x8fdb('0xec')][_0x8fdb('0x40')]);_0x1cb3a8[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x55ad66['query']);_0x1cb3a8[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x1cb3a8[_0x8fdb('0x5e')],_0x1cb3a8[_0x8fdb('0x47')]);_0x59e4dd[_0x8fdb('0x4b')]=_['intersection'](_0x1cb3a8[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x59e4dd[_0x8fdb('0x4b')]=_0x59e4dd[_0x8fdb('0x4b')]['length']?_0x59e4dd[_0x8fdb('0x4b')]:_0x1cb3a8['model'];if(!_0x55ad66[_0x8fdb('0x47')]['hasOwnProperty'](_0x8fdb('0xd8'))){_0x59e4dd['limit']=qs[_0x8fdb('0x24')](_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x59e4dd['offset']=qs['offset'](_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0x25')]);}_0x59e4dd[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0xd1')]);_0x59e4dd['where']=qs['filters'](_[_0x8fdb('0xd2')](_0x55ad66[_0x8fdb('0x47')],_0x1cb3a8[_0x8fdb('0x5d')]));_0x59e4dd[_0x8fdb('0x44')][_0x8fdb('0xe6')]=_0x390def['id'];if(_0x55ad66['query'][_0x8fdb('0x33')]){_0x59e4dd['where']=_[_0x8fdb('0xd3')](_0x59e4dd[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x59e4dd[_0x8fdb('0x4b')],function(_0x281300){var _0x4d7e73={};_0x4d7e73[_0x281300]={'$like':'%'+_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x4d7e73;})});}_0x59e4dd=_[_0x8fdb('0xd3')]({},_0x59e4dd,_0x55ad66[_0x8fdb('0xdf')]);return db[_0x8fdb('0xec')][_0x8fdb('0x26')]({'where':_0x59e4dd[_0x8fdb('0x44')]})[_0x8fdb('0x29')](function(_0x243a5f){_0x56e220[_0x8fdb('0x26')]=_0x243a5f;if(_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0x45')]){_0x59e4dd['include']=[{'all':!![]}];}return db[_0x8fdb('0xec')][_0x8fdb('0x4d')](_0x59e4dd);})[_0x8fdb('0x29')](function(_0x2e14da){_0x56e220[_0x8fdb('0x4e')]=_0x2e14da;return _0x56e220;});}})[_0x8fdb('0x29')](respondWithFilteredResult(_0x70dd3c,_0x59e4dd))[_0x8fdb('0x1f')](handleError(_0x70dd3c,null));};exports[_0x8fdb('0xed')]=function(_0x114f96,_0x728b36){var _0x1b1eb8={};var _0x3003d8={};var _0xdf426c;var _0xc47a9c;return db[_0x8fdb('0x3f')]['findOne']({'where':{'id':_0x114f96[_0x8fdb('0x59')]['id']}})['then'](handleEntityNotFound(_0x728b36,null))[_0x8fdb('0x29')](function(_0x40c111){if(_0x40c111){_0xdf426c=_0x40c111;_0x3003d8[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db[_0x8fdb('0xee')][_0x8fdb('0x40')]);_0x3003d8[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x114f96[_0x8fdb('0x47')]);_0x3003d8[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x3003d8[_0x8fdb('0x5e')],_0x3003d8[_0x8fdb('0x47')]);_0x1b1eb8[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x3003d8[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x114f96['query'][_0x8fdb('0x60')]));_0x1b1eb8[_0x8fdb('0x4b')]=_0x1b1eb8[_0x8fdb('0x4b')]['length']?_0x1b1eb8[_0x8fdb('0x4b')]:_0x3003d8['model'];_0x1b1eb8[_0x8fdb('0xe3')]=qs['sort'](_0x114f96[_0x8fdb('0x47')]['sort']);_0x1b1eb8['where']=qs['filters'](_[_0x8fdb('0xd2')](_0x114f96[_0x8fdb('0x47')],_0x3003d8[_0x8fdb('0x5d')]));if(_0x114f96['query'][_0x8fdb('0x33')]){_0x1b1eb8[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x1b1eb8[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x1b1eb8[_0x8fdb('0x4b')],function(_0x5e0d8b){var _0x7ed2f2={};_0x7ed2f2[_0x5e0d8b]={'$like':'%'+_0x114f96[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x7ed2f2;})});}_0x1b1eb8=_['merge']({},_0x1b1eb8,_0x114f96[_0x8fdb('0xdf')]);return _0xdf426c[_0x8fdb('0xed')](_0x1b1eb8);}})['then'](function(_0x1f3088){if(_0x1f3088){_0xc47a9c=_0x1f3088['length'];if(!_0x114f96['query']['hasOwnProperty'](_0x8fdb('0xd8'))){_0x1b1eb8['limit']=qs[_0x8fdb('0x24')](_0x114f96[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x1b1eb8[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x114f96[_0x8fdb('0x47')][_0x8fdb('0x25')]);}return _0xdf426c[_0x8fdb('0xed')](_0x1b1eb8);}})[_0x8fdb('0x29')](function(_0x592856){if(_0x592856){return _0x592856?{'count':_0xc47a9c,'rows':_0x592856}:null;}})['then'](respondWithResult(_0x728b36,null))['catch'](handleError(_0x728b36,null));};exports['getFaxInteractions']=function(_0xfbaaa9,_0x590022){var _0x3764ab={};var _0x488324={};var _0x3e1a21;var _0x23ef6b;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0xfbaaa9[_0x8fdb('0x59')]['id']}})['then'](handleEntityNotFound(_0x590022,null))[_0x8fdb('0x29')](function(_0xdebcf0){if(_0xdebcf0){_0x3e1a21=_0xdebcf0;_0x488324[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db[_0x8fdb('0xef')][_0x8fdb('0x40')]);_0x488324[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0xfbaaa9['query']);_0x488324[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x488324[_0x8fdb('0x5e')],_0x488324[_0x8fdb('0x47')]);_0x3764ab['attributes']=_['intersection'](_0x488324[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0xfbaaa9[_0x8fdb('0x47')]['fields']));_0x3764ab[_0x8fdb('0x4b')]=_0x3764ab[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x3764ab['attributes']:_0x488324['model'];_0x3764ab[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0xfbaaa9['query']['sort']);_0x3764ab['where']=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0xfbaaa9[_0x8fdb('0x47')],_0x488324[_0x8fdb('0x5d')]));if(_0xfbaaa9[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x3764ab[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x3764ab['where'],{'$or':_['map'](_0x3764ab[_0x8fdb('0x4b')],function(_0x5edea5){var _0x3bfc97={};_0x3bfc97[_0x5edea5]={'$like':'%'+_0xfbaaa9[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x3bfc97;})});}_0x3764ab=_[_0x8fdb('0xd3')]({},_0x3764ab,_0xfbaaa9[_0x8fdb('0xdf')]);return _0x3e1a21['getFaxInteractions'](_0x3764ab);}})[_0x8fdb('0x29')](function(_0x522c06){if(_0x522c06){_0x23ef6b=_0x522c06[_0x8fdb('0x50')];if(!_0xfbaaa9['query']['hasOwnProperty'](_0x8fdb('0xd8'))){_0x3764ab['limit']=qs[_0x8fdb('0x24')](_0xfbaaa9[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x3764ab[_0x8fdb('0x25')]=qs['offset'](_0xfbaaa9[_0x8fdb('0x47')][_0x8fdb('0x25')]);}return _0x3e1a21['getFaxInteractions'](_0x3764ab);}})['then'](function(_0x3fcb82){if(_0x3fcb82){return _0x3fcb82?{'count':_0x23ef6b,'rows':_0x3fcb82}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x590022,null))[_0x8fdb('0x1f')](handleError(_0x590022,null));};exports['getWhatsappInteractions']=function(_0x472dbd,_0x3b1f9c){var _0x551083={};var _0x34b121={};var _0x25a5b3;var _0x342a1a;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x472dbd[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x3b1f9c,null))[_0x8fdb('0x29')](function(_0x4e06f1){if(_0x4e06f1){_0x25a5b3=_0x4e06f1;_0x34b121['model']=_['keys'](db[_0x8fdb('0xf0')][_0x8fdb('0x40')]);_0x34b121[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x472dbd['query']);_0x34b121[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x34b121[_0x8fdb('0x5e')],_0x34b121[_0x8fdb('0x47')]);_0x551083[_0x8fdb('0x4b')]=_['intersection'](_0x34b121['model'],qs[_0x8fdb('0x60')](_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x551083[_0x8fdb('0x4b')]=_0x551083[_0x8fdb('0x4b')]['length']?_0x551083['attributes']:_0x34b121[_0x8fdb('0x5e')];_0x551083[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0xd1')]);_0x551083['where']=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x472dbd['query'],_0x34b121[_0x8fdb('0x5d')]));if(_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x551083[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x551083['where'],{'$or':_[_0x8fdb('0x35')](_0x551083['attributes'],function(_0x1a6353){var _0x1327c4={};_0x1327c4[_0x1a6353]={'$like':'%'+_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x1327c4;})});}_0x551083=_[_0x8fdb('0xd3')]({},_0x551083,_0x472dbd[_0x8fdb('0xdf')]);return _0x25a5b3[_0x8fdb('0xf1')](_0x551083);}})[_0x8fdb('0x29')](function(_0x3894a1){if(_0x3894a1){_0x342a1a=_0x3894a1[_0x8fdb('0x50')];if(!_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0xdd')](_0x8fdb('0xd8'))){_0x551083['limit']=qs[_0x8fdb('0x24')](_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x551083[_0x8fdb('0x25')]=qs['offset'](_0x472dbd['query'][_0x8fdb('0x25')]);}return _0x25a5b3[_0x8fdb('0xf1')](_0x551083);}})[_0x8fdb('0x29')](function(_0x257441){if(_0x257441){return _0x257441?{'count':_0x342a1a,'rows':_0x257441}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x3b1f9c,null))['catch'](handleError(_0x3b1f9c,null));};exports['login']=function(_0x40fbb1,_0x5240b9,_0x56a5db){var _0x80184b;var _0x309dd1;var _0x331f71;var _0x4abec8=!_['isNil'](_0x40fbb1[_0x8fdb('0x59')]['id'])?_0x40fbb1[_0x8fdb('0x59')]['id']:!_[_0x8fdb('0x6a')](_0x40fbb1[_0x8fdb('0x30')]['id'])?_0x40fbb1['user']['id']:null;return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x4abec8,'role':{'$or':[_0x8fdb('0x82'),'user',_0x8fdb('0x2a')]}},'attributes':['id',_0x8fdb('0x3c'),_0x8fdb('0xf2'),_0x8fdb('0xf3'),_0x8fdb('0x2e'),_0x8fdb('0x69'),'loginInPause']})[_0x8fdb('0x29')](function(_0x536fbf){if(_0x536fbf){if(_0x536fbf[_0x8fdb('0x2e')]===_0x8fdb('0x2a')){_0x80184b=_0x536fbf;if(_0x40fbb1[_0x8fdb('0x62')][_0x8fdb('0x9f')]){_0x331f71=util['format'](_0x8fdb('0xf4'),_0x80184b[_0x40fbb1[_0x8fdb('0x62')]['interface']]);}else if(_0x40fbb1['body']['intrf']){_0x331f71=util[_0x8fdb('0xab')](_0x8fdb('0xac'),_0x40fbb1[_0x8fdb('0x62')][_0x8fdb('0xf5')]);}else{_0x331f71=util['format'](_0x8fdb('0xac'),_0x80184b['name']);}socket['to'](util['format'](_0x8fdb('0xf6'),_0x80184b[_0x8fdb('0x3c')]))[_0x8fdb('0xa7')]('user:forcelogout',{'user':{'id':_0x80184b['id'],'name':_0x80184b[_0x8fdb('0x3c')]},'ip':_0x40fbb1[_0x8fdb('0xf7')][_0x8fdb('0xf8')]||_0x40fbb1[_0x8fdb('0xf9')]['remoteAddress']||_0x40fbb1['socket']['remoteAddress']||_0x40fbb1['connection'][_0x8fdb('0xfa')][_0x8fdb('0xfb')]});return db[_0x8fdb('0xad')][_0x8fdb('0x2c')]({'where':{'membername':_0x80184b[_0x8fdb('0x3c')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0x8fdb('0xfc'));}})[_0x8fdb('0x29')](function(){if(_0x80184b){return _0x80184b[_0x8fdb('0xfd')]({'raw':!![]});}})['then'](function(_0x528766){if(_0x80184b){if(_0x528766){_0x309dd1=_0x528766;if(_0x309dd1['length']){var _0x2928c2=_0x309dd1[_0x8fdb('0x35')](function(_0x254b99){var _0x2677e2={'membername':_0x80184b[_0x8fdb('0x3c')],'UserId':_0x80184b['id'],'queue_name':_0x254b99[_0x8fdb('0x3c')],'VoiceQueueId':_0x254b99['id'],'interface':_0x331f71,'paused':_0x80184b[_0x8fdb('0x9e')]||![],'penalty':_0x254b99[_0x8fdb('0xfe')]||0x0};return db[_0x8fdb('0xad')][_0x8fdb('0xae')](_0x2677e2);});return Promise['all'](_0x2928c2);}}}})['then'](function(){if(_0x80184b){return db['MemberReport'][_0x8fdb('0x4d')]({'where':{'membername':_0x80184b['name'],'exitAt':null}});}})[_0x8fdb('0x29')](function(_0x39ed86){if(_0x80184b){var _0x2f2415=[];_0x39ed86['forEach'](function(_0x2fe3d7){_0x2f2415[_0x8fdb('0x4c')](_0x2fe3d7['update']({'exitAt':moment()['format'](_0x8fdb('0xff'))}));});return Promise['all'](_0x2f2415);}})[_0x8fdb('0x29')](function(){if(_0x80184b){var _0x569903=[];var _0x341fdb=[];var _0x54c24b=utils[_0x8fdb('0x100')]();var _0xdc4a05={'membername':_0x80184b['name'],'interface':_0x331f71,'enterAt':moment()[_0x8fdb('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x80184b['role'],'internal':_0x80184b[_0x8fdb('0x69')]};_0x54c24b[_0x8fdb('0x101')](function(_0x4a2af4){_0x569903[_0x8fdb('0x4c')](_[_0x8fdb('0xd3')]({'channel':_0x4a2af4,'type':_0x8fdb('0x102'),'data1':_0x40fbb1['body'][_0x8fdb('0x103')],'data2':_0x331f71},_0xdc4a05));if(_0x80184b[_0x8fdb('0x9e')]){_0x341fdb['push'](_[_0x8fdb('0xd3')]({'channel':_0x4a2af4,'type':_0x8fdb('0x104'),'data1':_0x8fdb('0x105')},_0xdc4a05));}});return db[_0x8fdb('0x106')][_0x8fdb('0x88')](_0x569903[_0x8fdb('0xcd')](_0x341fdb),{'individualHooks':!![]});}})[_0x8fdb('0x29')](function(){if(_0x80184b){return _0x80184b[_0x8fdb('0x28')]({'online':!![],'lastLoginAt':moment()[_0x8fdb('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x80184b['loginInPause']||![],'mailPause':_0x80184b[_0x8fdb('0x9e')]||![],'chatPause':_0x80184b[_0x8fdb('0x9e')]||![],'faxPause':_0x80184b['loginInPause']||![],'smsPause':_0x80184b[_0x8fdb('0x9e')]||![],'openchannelPause':_0x80184b[_0x8fdb('0x9e')]||![],'whatsappPause':_0x80184b['loginInPause']||![],'pauseType':_0x80184b[_0x8fdb('0x9e')]?_0x8fdb('0x105'):null,'interface':_0x331f71,'lastPauseAt':moment()['format'](_0x8fdb('0xff'))});}})['then'](function(_0x489a75){if(_0x40fbb1['isMiddleware']){return _0x56a5db();}else{return Promise[_0x8fdb('0x107')](_0x489a75)[_0x8fdb('0x29')](respondWithResult(_0x5240b9,null));}})[_0x8fdb('0x1f')](handleError(_0x5240b9,null));};exports['logout']=function(_0x182cb7,_0x402cc9){var _0x4d548c;return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x182cb7[_0x8fdb('0x59')]['id'],'role':_0x8fdb('0x2a')},'attributes':['id',_0x8fdb('0x3c'),_0x8fdb('0x2e')]})[_0x8fdb('0x29')](handleEntityNotFound(_0x402cc9,null))[_0x8fdb('0x29')](function(_0x14e5ae){if(_0x14e5ae){_0x4d548c=_0x14e5ae;return db[_0x8fdb('0xad')][_0x8fdb('0x2c')]({'where':{'membername':_0x4d548c[_0x8fdb('0x3c')]},'individualHooks':!![]});}})[_0x8fdb('0x29')](function(){return db[_0x8fdb('0x106')]['findAll']({'where':{'membername':_0x4d548c['name'],'exitAt':null}});})[_0x8fdb('0x29')](function(_0x5855fb){var _0x34e5c7=[];_0x5855fb[_0x8fdb('0x101')](function(_0x2849a9){_0x34e5c7['push'](_0x2849a9[_0x8fdb('0x28')]({'exitAt':moment()['format'](_0x8fdb('0xff'))}));});return Promise[_0x8fdb('0x57')](_0x34e5c7);})['then'](function(){return _0x4d548c[_0x8fdb('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8fdb('0x29')](respondWithResult(_0x402cc9,null))[_0x8fdb('0x1f')](handleError(_0x402cc9,null));};exports[_0x8fdb('0x108')]=function(_0x4b06ba,_0x119418){var _0x366a9f;return db[_0x8fdb('0xad')][_0x8fdb('0x28')]({'paused':0x1},{'where':{'UserId':_0x4b06ba[_0x8fdb('0x59')]['id']},'individualHooks':!![]})[_0x8fdb('0x29')](function(){return db['User'][_0x8fdb('0x38')]({'where':{'id':_0x4b06ba[_0x8fdb('0x59')]['id'],'role':'agent'},'attributes':['id','name',_0x8fdb('0x2e'),_0x8fdb('0x69'),_0x8fdb('0x9f'),_0x8fdb('0x9d')]});})['then'](handleEntityNotFound(_0x119418,null))[_0x8fdb('0x29')](function(_0xc9d0b5){if(_0xc9d0b5){_0x366a9f=_0xc9d0b5;return respondWithRpcPromise(_0x8fdb('0x109'),_0x8fdb('0x108'),{'id':_0x366a9f['id'],'name':_0x366a9f[_0x8fdb('0x3c')],'pause':!![]});}})['then'](function(){if(_0x366a9f){return db[_0x8fdb('0x106')][_0x8fdb('0x4d')]({'where':{'membername':_0x366a9f[_0x8fdb('0x3c')],'type':_0x8fdb('0x104'),'exitAt':null}});}})[_0x8fdb('0x29')](function(_0x4f902b){if(_0x4f902b['length']){var _0x47cc6d=moment()[_0x8fdb('0xab')](_0x8fdb('0xff'));for(var _0x46393a=0x0,_0xde41a0=_0x4f902b['length'];_0x46393a<_0xde41a0;_0x46393a++){_0x4f902b[_0x46393a][_0x8fdb('0x10a')]({'exitAt':_0x47cc6d});}}})[_0x8fdb('0x29')](function(){var _0x1e2acb=[];var _0x3d2778=utils[_0x8fdb('0x100')]();_0x3d2778[_0x8fdb('0x101')](function(_0x1df630){_0x1e2acb['push']({'channel':_0x1df630,'membername':_0x366a9f['name'],'interface':_[_0x8fdb('0x6a')](_0x366a9f[_0x8fdb('0x9f')])?util[_0x8fdb('0xab')](_0x8fdb('0xac'),_0x366a9f[_0x8fdb('0x3c')]):_0x366a9f['interface'],'type':_0x8fdb('0x104'),'enterAt':moment()[_0x8fdb('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4b06ba['body'][_0x8fdb('0x42')]||_0x8fdb('0x10b'),'role':_0x366a9f[_0x8fdb('0x2e')],'internal':_0x366a9f[_0x8fdb('0x69')]});});return db[_0x8fdb('0x106')][_0x8fdb('0x88')](_0x1e2acb,{'individualHooks':!![]});})[_0x8fdb('0x29')](function(){return _0x366a9f[_0x8fdb('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4b06ba[_0x8fdb('0x62')][_0x8fdb('0x42')]||_0x8fdb('0x10b'),'lastPauseAt':moment()[_0x8fdb('0xab')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x119418,null))[_0x8fdb('0x1f')](handleError(_0x119418,null));};exports[_0x8fdb('0x10c')]=function(_0x38be32,_0xb90d1){if(_0x38be32['body'][_0x8fdb('0x9c')]&&!utils[_0x8fdb('0xb0')](_0x38be32[_0x8fdb('0x62')][_0x8fdb('0x9c')])){throw new APIBadRequestError(util['format'](_0x8fdb('0x10d'),_0x38be32[_0x8fdb('0x62')][_0x8fdb('0x9c')]));}return db[_0x8fdb('0x3f')]['find']({'where':{'id':_0x38be32[_0x8fdb('0x59')]['id']},'attributes':['id',_0x8fdb('0x3c'),_0x8fdb('0x2e'),_0x8fdb('0x69'),_0x8fdb('0x9f'),_0x8fdb('0x9d'),_0x8fdb('0x10e'),_0x8fdb('0x10f'),'chatPause',_0x8fdb('0x110'),_0x8fdb('0x111'),'smsPause',_0x8fdb('0x112'),_0x8fdb('0x113'),_0x8fdb('0x114')]})[_0x8fdb('0x29')](function(_0x4b9774){if(!_0x4b9774){throw new APINotFoundError(util[_0x8fdb('0xab')](_0x8fdb('0x115'),_0x38be32[_0x8fdb('0x59')]['id']));}return _0x4b9774[_0x8fdb('0x10c')](_0x38be32[_0x8fdb('0x62')][_0x8fdb('0x9c')]);})[_0x8fdb('0x29')](respondWithResult(_0xb90d1,null))[_0x8fdb('0x1f')](APIHandleError(_0xb90d1));};exports['getTeams']=function(_0x40ab44,_0x5015de){var _0x58065f={};var _0x5a3948={};var _0xfc5335;var _0x1864f8;return db['User'][_0x8fdb('0xcf')]({'where':{'id':_0x40ab44['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x5015de,null))[_0x8fdb('0x29')](function(_0x2d74ac){if(_0x2d74ac){_0xfc5335=_0x2d74ac;_0x5a3948['model']=_[_0x8fdb('0x5c')](db[_0x8fdb('0x116')]['rawAttributes']);_0x5a3948['query']=_[_0x8fdb('0x5c')](_0x40ab44['query']);_0x5a3948[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x5a3948[_0x8fdb('0x5e')],_0x5a3948[_0x8fdb('0x47')]);_0x58065f['attributes']=_[_0x8fdb('0x5f')](_0x5a3948[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x40ab44[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x58065f['attributes']=_0x58065f['attributes'][_0x8fdb('0x50')]?_0x58065f['attributes']:_0x5a3948['model'];_0x58065f[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x40ab44['query'][_0x8fdb('0xd1')]);_0x58065f[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x40ab44[_0x8fdb('0x47')],_0x5a3948[_0x8fdb('0x5d')]));if(_0x40ab44[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x58065f[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x58065f[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x58065f[_0x8fdb('0x4b')],function(_0x33144a){var _0x15cb8a={};_0x15cb8a[_0x33144a]={'$like':'%'+_0x40ab44['query'][_0x8fdb('0x33')]+'%'};return _0x15cb8a;})});}_0x58065f=_[_0x8fdb('0xd3')]({},_0x58065f,_0x40ab44[_0x8fdb('0xdf')]);return _0xfc5335['getTeams'](_0x58065f);}})[_0x8fdb('0x29')](function(_0x343403){if(_0x343403){_0x1864f8=_0x343403[_0x8fdb('0x50')];if(!_0x40ab44[_0x8fdb('0x47')][_0x8fdb('0xdd')]('nolimit')){_0x58065f['limit']=qs[_0x8fdb('0x24')](_0x40ab44['query']['limit']);_0x58065f[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x40ab44[_0x8fdb('0x47')][_0x8fdb('0x25')]);}return _0xfc5335['getTeams'](_0x58065f);}})[_0x8fdb('0x29')](function(_0x49cdd4){if(_0x49cdd4){return _0x49cdd4?{'count':_0x1864f8,'rows':_0x49cdd4}:null;}})['then'](respondWithResult(_0x5015de,null))['catch'](handleError(_0x5015de,null));};exports[_0x8fdb('0x117')]=function(_0x1e4d3c,_0xbb0b30){var _0x133450=_0x1e4d3c[_0x8fdb('0x59')]['id'];var _0x2e7cb2=_0x1e4d3c[_0x8fdb('0x62')]?_0x1e4d3c[_0x8fdb('0x62')]['ids']:null;var _0x2235c3=[];return Promise['resolve']()[_0x8fdb('0x29')](function(){if(!_0x2e7cb2)throw new APIBadRequestError(_0x8fdb('0x118'));})['then'](function(){return db['User'][_0x8fdb('0xcf')]({'where':{'id':_0x133450}});})[_0x8fdb('0x29')](function(_0x272b4f){if(!_0x272b4f)throw new APINotFoundError(util[_0x8fdb('0xab')](_0x8fdb('0x115'),_0x1e4d3c[_0x8fdb('0x59')]['id']));return db[_0x8fdb('0x6c')]['transaction'](function(_0x59c6cb){return _0x272b4f['addTeams'](_0x2e7cb2,{'transaction':_0x59c6cb})[_0x8fdb('0x29')](function(){return db[_0x8fdb('0x116')][_0x8fdb('0x4d')]({'where':{'id':{'$in':_0x2e7cb2}}});})[_0x8fdb('0x29')](function(_0x23da3c){var _0x538bab=_['map'](_0x23da3c,function(_0x450aba){return _0x450aba[_0x8fdb('0x119')]();});return Promise[_0x8fdb('0x57')](_0x538bab);})[_0x8fdb('0x29')](function(_0x5eafc5){_0x2235c3=_['flattenDeep'](_0x5eafc5);var _0x127914=_[_0x8fdb('0x35')](_0x2235c3,function(_0xee00ea){return _0xee00ea[_0x8fdb('0x11a')](_0x272b4f['id'],{'transaction':_0x59c6cb});});return Promise['all'](_0x127914);})[_0x8fdb('0x29')](function(){if(!_0x272b4f['online'])return;var _0x862a=_[_0x8fdb('0x33')](_0x2235c3,function(_0x7141b3){return _0x7141b3[_0x8fdb('0x11b')](_0x8fdb('0x9c'))===_0x8fdb('0x11c');});var _0x316aa6=_[_0x8fdb('0x35')](_0x862a,function(_0x7f37db){return db['UserVoiceQueueRt']['upsert']({'membername':_0x272b4f[_0x8fdb('0x3c')],'UserId':_0x272b4f['id'],'queue_name':_0x7f37db[_0x8fdb('0x3c')],'VoiceQueueId':_0x7f37db['id'],'interface':_[_0x8fdb('0x6a')](_0x272b4f[_0x8fdb('0x9f')])?util[_0x8fdb('0xab')](_0x8fdb('0xac'),_0x272b4f[_0x8fdb('0x3c')]):_0x272b4f[_0x8fdb('0x9f')],'paused':_0x272b4f[_0x8fdb('0x10e')]||![],'penalty':_0x272b4f[_0x8fdb('0xa5')]},{'transaction':_0x59c6cb});});return Promise['all'](_0x316aa6);})[_0x8fdb('0x29')](function(){return db[_0x8fdb('0x11d')][_0x8fdb('0x4d')]({'where':{'teamId':{'$in':_0x2e7cb2}}});})[_0x8fdb('0x29')](function(_0x58dba7){var _0x2a5df0=_[_0x8fdb('0x35')](_0x58dba7,function(_0x571fcf){return db[_0x8fdb('0x11e')]['create']({'UserId':_0x272b4f['id'],'VoicePrefixId':_0x571fcf[_0x8fdb('0x11f')]},{'transaction':_0x59c6cb});});return Promise[_0x8fdb('0x57')](_0x2a5df0);});});})['then'](function(){for(var _0x17eba1=0x0;_0x17eba1<_0x2235c3[_0x8fdb('0x50')];_0x17eba1++){var _0x427f79=_0x2235c3[_0x17eba1][_0x8fdb('0x11b')](_0x8fdb('0x9c'));var _0x287d08=_0x427f79+_0x8fdb('0xb3');socket['emit'](_0x8fdb('0x30')+_0x427f79+_0x8fdb('0xa8'),{'UserId':_0x133450,['queueField']:_0x2235c3[_0x17eba1]['id']});}})['then'](respondWithStatusCode(_0xbb0b30,null))['catch'](APIHandleError(_0xbb0b30));};exports[_0x8fdb('0x120')]=function(_0x33e1c8,_0x195e05){var _0x399d35=_0x33e1c8[_0x8fdb('0x59')]['id'];var _0x436646=null;if(_0x33e1c8[_0x8fdb('0x47')][_0x8fdb('0xa4')]){_0x436646=_[_0x8fdb('0xb2')](_0x33e1c8['query'][_0x8fdb('0xa4')])?_0x33e1c8[_0x8fdb('0x47')][_0x8fdb('0xa4')]:[_0x33e1c8[_0x8fdb('0x47')]['ids']];}var _0x5563f7=[];return Promise['resolve']()[_0x8fdb('0x29')](function(){if(!_0x436646)throw new APIBadRequestError(_0x8fdb('0x121'));})[_0x8fdb('0x29')](function(){return db[_0x8fdb('0x3f')]['findOne']({'where':{'id':_0x399d35}});})[_0x8fdb('0x29')](function(_0x4066c4){if(!_0x4066c4)throw new APINotFoundError(util['format'](_0x8fdb('0x115'),_0x33e1c8[_0x8fdb('0x59')]['id']));return db['sequelize']['transaction'](function(_0x29c71d){return _0x4066c4[_0x8fdb('0x120')](_0x436646,{'transaction':_0x29c71d})[_0x8fdb('0x29')](function(){return db[_0x8fdb('0x116')][_0x8fdb('0x4d')]({'where':{'id':{'$in':_0x436646}}});})[_0x8fdb('0x29')](function(_0x5e3710){var _0x59175f=_[_0x8fdb('0x35')](_0x5e3710,function(_0x43de12){return _0x43de12['getAssociatedQueues']();});return Promise[_0x8fdb('0x57')](_0x59175f);})[_0x8fdb('0x29')](function(_0x470bae){_0x5563f7=_[_0x8fdb('0x122')](_0x470bae);var _0x1ab0a4=_[_0x8fdb('0x35')](_0x5563f7,function(_0x5b17f1){return _0x5b17f1[_0x8fdb('0x123')](_0x4066c4['id'],{'transaction':_0x29c71d});});return Promise[_0x8fdb('0x57')](_0x1ab0a4);})[_0x8fdb('0x29')](function(){if(!_0x4066c4[_0x8fdb('0x9d')])return;var _0xbde909=_[_0x8fdb('0x33')](_0x5563f7,function(_0x40952c){return _0x40952c[_0x8fdb('0x11b')]('channel')===_0x8fdb('0x11c');});var _0x495c68=_[_0x8fdb('0x35')](_0xbde909,function(_0x4a29d9){return db[_0x8fdb('0xad')][_0x8fdb('0x2c')]({'where':{'VoiceQueueId':_0x4a29d9['id'],'UserId':_0x4066c4['id']},'transaction':_0x29c71d});});return Promise['all'](_0x495c68);})[_0x8fdb('0x29')](function(){return db['TeamVoicePrefix'][_0x8fdb('0x4d')]({'where':{'teamId':{'$in':_0x436646}}});})[_0x8fdb('0x29')](function(_0x12dbe1){var _0x240456=_[_0x8fdb('0x35')](_0x12dbe1,function(_0x37db70){return db[_0x8fdb('0x11e')][_0x8fdb('0x2c')]({'where':{'UserId':_0x4066c4['id'],'VoicePrefixId':_0x37db70[_0x8fdb('0x11f')]}},{'transaction':_0x29c71d});});return Promise[_0x8fdb('0x57')](_0x240456);});});})[_0x8fdb('0x29')](function(){for(var _0x57eb13=0x0;_0x57eb13<_0x5563f7['length'];_0x57eb13++){var _0xf72bb1=_0x5563f7[_0x57eb13][_0x8fdb('0x11b')](_0x8fdb('0x9c'));var _0x2266b8=_0xf72bb1+_0x8fdb('0xb3');socket[_0x8fdb('0xa7')](_0x8fdb('0x30')+_0xf72bb1+_0x8fdb('0xb4'),{'UserId':_0x399d35,['queueField']:_0x5563f7[_0x57eb13]['id']});}})['then'](respondWithStatusCode(_0x195e05,null))['catch'](APIHandleError(_0x195e05));};exports[_0x8fdb('0x124')]=function(_0x2671d4,_0x5136b5){var _0x4b9197={};var _0x4102e8={};var _0x14bb15;var _0x9c629c;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x2671d4['params']['id']}})['then'](handleEntityNotFound(_0x5136b5,null))[_0x8fdb('0x29')](function(_0xbeea92){if(_0xbeea92){_0x14bb15=_0xbeea92;_0x4102e8[_0x8fdb('0x5e')]=_['keys'](db[_0x8fdb('0x125')]['rawAttributes']);_0x4102e8[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x2671d4[_0x8fdb('0x47')]);_0x4102e8[_0x8fdb('0x5d')]=_['intersection'](_0x4102e8['model'],_0x4102e8['query']);_0x4b9197[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x4102e8[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x2671d4[_0x8fdb('0x47')]['fields']));_0x4b9197['attributes']=_0x4b9197[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x4b9197['attributes']:_0x4102e8['model'];_0x4b9197[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x2671d4[_0x8fdb('0x47')][_0x8fdb('0xd1')]);_0x4b9197[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_['pick'](_0x2671d4['query'],_0x4102e8[_0x8fdb('0x5d')]));if(_0x2671d4[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x4b9197['where']=_[_0x8fdb('0xd3')](_0x4b9197[_0x8fdb('0x44')],{'$or':_['map'](_0x4b9197[_0x8fdb('0x4b')],function(_0x4f0649){var _0x17bb17={};_0x17bb17[_0x4f0649]={'$like':'%'+_0x2671d4[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x17bb17;})});}_0x4b9197=_[_0x8fdb('0xd3')]({},_0x4b9197,_0x2671d4[_0x8fdb('0xdf')]);return _0x14bb15[_0x8fdb('0x124')](_0x4b9197);}})[_0x8fdb('0x29')](function(_0x115b45){if(_0x115b45){_0x9c629c=_0x115b45['length'];if(!_0x2671d4['query'][_0x8fdb('0xdd')]('nolimit')){_0x4b9197[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x2671d4[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x4b9197[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x2671d4['query']['offset']);}return _0x14bb15[_0x8fdb('0x124')](_0x4b9197);}})[_0x8fdb('0x29')](function(_0x4fe35f){if(_0x4fe35f){return _0x4fe35f?{'count':_0x9c629c,'rows':_0x4fe35f}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x5136b5,null))[_0x8fdb('0x1f')](handleError(_0x5136b5,null));};exports['getAgents']=function(_0x204422,_0x45ac13){var _0x42f88a={};var _0x12873f={};var _0xab6790;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x204422[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x45ac13,null))[_0x8fdb('0x29')](function(_0x485bea){if(_0x485bea){_0xab6790=_0x485bea;_0x12873f[_0x8fdb('0x5e')]=_['keys'](db[_0x8fdb('0x3f')][_0x8fdb('0x40')]);_0x12873f['query']=_[_0x8fdb('0x5c')](_0x204422[_0x8fdb('0x47')]);_0x12873f[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x12873f['model'],_0x12873f[_0x8fdb('0x47')]);_0x42f88a['attributes']=_[_0x8fdb('0x5f')](_0x12873f[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x204422[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x42f88a[_0x8fdb('0x4b')]=_0x42f88a[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x42f88a[_0x8fdb('0x4b')]:_0x12873f[_0x8fdb('0x5e')];_0x42f88a[_0x8fdb('0xe3')]=qs['sort'](_0x204422['query'][_0x8fdb('0xd1')]);_0x42f88a[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x204422['query'],_0x12873f[_0x8fdb('0x5d')]));if(_0x204422[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x42f88a[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x42f88a[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x42f88a[_0x8fdb('0x4b')],function(_0x90810d){var _0x1ac5b2={};_0x1ac5b2[_0x90810d]={'$like':'%'+_0x204422[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x1ac5b2;})});}_0x42f88a[_0x8fdb('0x5e')]=db[_0x8fdb('0x3f')];_0x42f88a['as']=_0x8fdb('0x31');_0x42f88a=_[_0x8fdb('0xd3')]({},_0x42f88a,_0x204422['options']);return _0xab6790['getVoiceQueues']({'include':[_0x42f88a]});}})[_0x8fdb('0x29')](function(_0x1d7ffb){if(_0x1d7ffb){var _0x6fa177={},_0x128383=[];for(var _0x885d17=0x0;_0x885d17<_0x1d7ffb[_0x8fdb('0x50')];_0x885d17+=0x1){for(var _0x182e4b=0x0,_0x12d3b8;_0x182e4b<_0x1d7ffb[_0x885d17]['Agents'][_0x8fdb('0x50')];_0x182e4b+=0x1){_0x12d3b8=_0x1d7ffb[_0x885d17][_0x8fdb('0x31')][_0x182e4b]['get']({'plain':!![]});_0x6fa177[_0x12d3b8['id']]=_0x12d3b8;}}_0x6fa177=_[_0x8fdb('0x126')](_0x6fa177);for(var _0x11a941=qs[_0x8fdb('0x25')](_0x204422['query'][_0x8fdb('0x25')]);_0x11a941<_0x6fa177['length']&&_0x128383[_0x8fdb('0x50')]=_0x215b9e['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xacdb('0x17')](function(){if(_0xa65da2){return db[_0xacdb('0x28')][_0xacdb('0x49')]({'where':{'membername':_0xa65da2[_0xacdb('0x22')]},'individualHooks':!![]});}})[_0xacdb('0x17')](function(){if(_0xa65da2){return _0xa65da2[_0xacdb('0x53')]({'raw':!![]});}})[_0xacdb('0x17')](function(_0x30be97){if(_0xa65da2){if(_0x30be97){var _0x12c259=[];_0x987dde=_0x30be97;if(_0x987dde['length']){for(var _0x23a49a=0x0;_0x23a49a<_0x987dde['length'];_0x23a49a++){_0x12c259[_0xacdb('0x2f')](db[_0xacdb('0x28')][_0xacdb('0x54')]({'membername':_0xa65da2[_0xacdb('0x22')],'UserId':_0xa65da2['id'],'queue_name':_0x987dde[_0x23a49a]['name'],'VoiceQueueId':_0x987dde[_0x23a49a]['id'],'interface':_0x4562a6,'paused':_0xa65da2['loginInPause']||![],'penalty':_0x987dde[_0x23a49a][_0xacdb('0x55')]||0x0}));}return BPromise[_0xacdb('0x56')](_0x12c259);}}}})[_0xacdb('0x17')](function(){if(_0xa65da2){return db[_0xacdb('0x37')][_0xacdb('0x2a')]({'where':{'membername':_0xa65da2[_0xacdb('0x22')],'exitAt':null}});}})[_0xacdb('0x17')](function(_0x221286){if(_0xa65da2){if(_0x221286&&_0x221286['length']){var _0x593f69=[];_0x221286[_0xacdb('0x2e')](function(_0x930db4){_0x593f69['push'](_0x930db4['update']({'exitAt':moment()[_0xacdb('0x26')](_0xacdb('0x2c'))}));});return BPromise['all'](_0x593f69);}}})['then'](function(){if(_0xa65da2){var _0x2bd3b6=[];var _0x56b9c0=[];var _0x3d07f4=utils[_0xacdb('0x2d')]();var _0x501887={'membername':_0xa65da2[_0xacdb('0x22')],'interface':_0x4562a6,'enterAt':moment()['format'](_0xacdb('0x2c')),'role':_0xa65da2['role'],'internal':_0xa65da2[_0xacdb('0x24')]};_0x3d07f4[_0xacdb('0x2e')](function(_0x5df47c){_0x2bd3b6[_0xacdb('0x2f')](_[_0xacdb('0x57')]({'channel':_0x5df47c,'type':_0xacdb('0x58'),'data1':_0xacdb('0x59'),'data2':_0x4562a6},_0x501887));if(_0xa65da2[_0xacdb('0x4d')]){_0x56b9c0[_0xacdb('0x2f')](_[_0xacdb('0x57')]({'channel':_0x5df47c,'type':_0xacdb('0x32'),'data1':_0xacdb('0x5a')},_0x501887));}});return db[_0xacdb('0x37')]['bulkCreate'](_0x2bd3b6[_0xacdb('0x5b')](_0x56b9c0),{'individualHooks':!![]});}})[_0xacdb('0x17')](function(){if(_0xa65da2){return _0xa65da2[_0xacdb('0x29')]({'online':!![],'lastLoginAt':moment()['format'](_0xacdb('0x2c')),'voicePause':_0xa65da2['loginInPause']||![],'mailPause':_0xa65da2['loginInPause']||![],'chatPause':_0xa65da2['loginInPause']||![],'faxPause':_0xa65da2['loginInPause']||![],'smsPause':_0xa65da2['loginInPause']||![],'openchannelPause':_0xa65da2[_0xacdb('0x4d')]||![],'pauseType':_0xa65da2[_0xacdb('0x4d')]?_0xacdb('0x5a'):null,'lastPauseAt':moment()[_0xacdb('0x26')](_0xacdb('0x2c')),'interface':_0x4562a6});}})['then'](function(_0x2111bf){_0x37af64(_0x2111bf);})['catch'](function(_0x770225){_0x3cd5d8(_0x5d1fe7[_0xacdb('0x1c')](0x1f4,_0x770225['message']));});});}; \ No newline at end of file +var _0x4d13=['internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','MemberReport','name','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','isNil','SIP/%s','PAUSE','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','role','voicePause','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','params','unpause','system','destroy','forEach','push','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','findAll','options','where','attributes','limit','include','map','model','then','info','stringify','catch','error','message','User','ShowUser','debug','find'];(function(_0x3fb905,_0x14aa93){var _0x334d91=function(_0xb8188e){while(--_0xb8188e){_0x3fb905['push'](_0x3fb905['shift']());}};_0x334d91(++_0x14aa93);}(_0x4d13,0x14e));var _0x34d1=function(_0x5091fc,_0x578f58){_0x5091fc=_0x5091fc-0x0;var _0x465ab7=_0x4d13[_0x5091fc];return _0x465ab7;};'use strict';var _=require(_0x34d1('0x0'));var util=require(_0x34d1('0x1'));var moment=require(_0x34d1('0x2'));var BPromise=require(_0x34d1('0x3'));var Redis=require(_0x34d1('0x4'));var db=require(_0x34d1('0x5'))['db'];var utils=require(_0x34d1('0x6'));var logger=require('../../config/logger')(_0x34d1('0x7'));var config=require(_0x34d1('0x8'));config[_0x34d1('0x9')]=_[_0x34d1('0xa')](config[_0x34d1('0x9')],{'host':_0x34d1('0xb'),'port':0x18eb});var socket=require(_0x34d1('0xc'))(new Redis(config['redis']));require(_0x34d1('0xd'))[_0x34d1('0xe')](socket);exports[_0x34d1('0xf')]=function(_0x17363c){var _0x3d5c57=this;return new Promise(function(_0x1daf4a,_0x277adc){return db['User'][_0x34d1('0x10')]({'raw':_0x17363c['options']?_0x17363c[_0x34d1('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x17363c[_0x34d1('0x11')]?_0x17363c[_0x34d1('0x11')][_0x34d1('0x12')]||null:null,'attributes':_0x17363c[_0x34d1('0x11')]?_0x17363c[_0x34d1('0x11')][_0x34d1('0x13')]||null:null,'limit':_0x17363c[_0x34d1('0x11')]?_0x17363c['options'][_0x34d1('0x14')]||null:null,'include':_0x17363c[_0x34d1('0x11')]?_0x17363c[_0x34d1('0x11')][_0x34d1('0x15')]?_[_0x34d1('0x16')](_0x17363c[_0x34d1('0x11')]['include'],function(_0x1cc4bd){return{'model':db[_0x1cc4bd[_0x34d1('0x17')]],'as':_0x1cc4bd['as'],'attributes':_0x1cc4bd[_0x34d1('0x13')],'include':_0x1cc4bd[_0x34d1('0x15')]?_['map'](_0x1cc4bd['include'],function(_0x4d714d){return{'model':db[_0x4d714d[_0x34d1('0x17')]],'as':_0x4d714d['as'],'attributes':_0x4d714d['attributes'],'include':_0x4d714d[_0x34d1('0x15')]?_['map'](_0x4d714d[_0x34d1('0x15')],function(_0x568218){return{'model':db[_0x568218[_0x34d1('0x17')]],'as':_0x568218['as'],'attributes':_0x568218[_0x34d1('0x13')]};}):[]};}):[]};}):[]:[]})[_0x34d1('0x18')](function(_0x423e2a){logger[_0x34d1('0x19')](_0x34d1('0xf'),_0x17363c);logger['debug'](_0x34d1('0xf'),_0x17363c,JSON[_0x34d1('0x1a')](_0x423e2a));_0x1daf4a(_0x423e2a);})[_0x34d1('0x1b')](function(_0x22602a){logger[_0x34d1('0x1c')](_0x34d1('0xf'),_0x22602a[_0x34d1('0x1d')],_0x17363c);_0x277adc(_0x3d5c57[_0x34d1('0x1c')](0x1f4,_0x22602a['message']));});});};exports['ShowUser']=function(_0x3d34e2){var _0x3aa1fc=this;return new Promise(function(_0x45ef83,_0x1a278c){return db[_0x34d1('0x1e')]['find']({'raw':_0x3d34e2[_0x34d1('0x11')]?_0x3d34e2[_0x34d1('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x3d34e2[_0x34d1('0x11')]?_0x3d34e2[_0x34d1('0x11')][_0x34d1('0x12')]||null:null,'attributes':_0x3d34e2[_0x34d1('0x11')]?_0x3d34e2['options']['attributes']||null:null,'include':_0x3d34e2[_0x34d1('0x11')]?_0x3d34e2[_0x34d1('0x11')]['include']?_[_0x34d1('0x16')](_0x3d34e2[_0x34d1('0x11')][_0x34d1('0x15')],function(_0x37b82e){return{'model':db[_0x37b82e[_0x34d1('0x17')]],'as':_0x37b82e['as'],'attributes':_0x37b82e[_0x34d1('0x13')],'include':_0x37b82e[_0x34d1('0x15')]?_[_0x34d1('0x16')](_0x37b82e[_0x34d1('0x15')],function(_0x28611c){return{'model':db[_0x28611c[_0x34d1('0x17')]],'as':_0x28611c['as'],'attributes':_0x28611c[_0x34d1('0x13')],'include':_0x28611c[_0x34d1('0x15')]?_[_0x34d1('0x16')](_0x28611c[_0x34d1('0x15')],function(_0x42092a){return{'model':db[_0x42092a[_0x34d1('0x17')]],'as':_0x42092a['as'],'attributes':_0x42092a[_0x34d1('0x13')]};}):[]};}):[]};}):[]:[]})[_0x34d1('0x18')](function(_0x50e473){logger[_0x34d1('0x19')](_0x34d1('0x1f'),_0x3d34e2);logger[_0x34d1('0x20')](_0x34d1('0x1f'),_0x3d34e2,JSON[_0x34d1('0x1a')](_0x50e473));_0x45ef83(_0x50e473);})[_0x34d1('0x1b')](function(_0x99af38){logger[_0x34d1('0x1c')](_0x34d1('0x1f'),_0x99af38[_0x34d1('0x1d')],_0x3d34e2);_0x1a278c(_0x3aa1fc[_0x34d1('0x1c')](0x1f4,_0x99af38[_0x34d1('0x1d')]));});});};exports['PauseUser']=function(_0x51cda0){var _0x1450ba;return db[_0x34d1('0x1e')][_0x34d1('0x21')]({'where':_0x51cda0[_0x34d1('0x11')]['where']||{},'attributes':['id','name','role',_0x34d1('0x22'),_0x34d1('0x23')]})['then'](function(_0x3b7457){if(!_0x3b7457){throw new Error(util[_0x34d1('0x24')](_0x34d1('0x25'),_0x51cda0['params']['id']));}_0x1450ba=_0x3b7457;return db[_0x34d1('0x26')][_0x34d1('0x27')]({'paused':0x1},{'where':{'UserId':_0x1450ba['id']},'individualHooks':!![]});})[_0x34d1('0x18')](function(){return db[_0x34d1('0x28')][_0x34d1('0x10')]({'where':{'membername':_0x1450ba[_0x34d1('0x29')],'type':'PAUSE','exitAt':null}});})[_0x34d1('0x18')](function(_0xe21312){if(_0xe21312&&_0xe21312[_0x34d1('0x2a')]){var _0xe0707f=moment()[_0x34d1('0x24')](_0x34d1('0x2b'));for(var _0x3bd91a=0x0,_0x44a076=_0xe21312['length'];_0x3bd91a<_0x44a076;_0x3bd91a++){_0xe21312[_0x3bd91a][_0x34d1('0x2c')]({'exitAt':_0xe0707f});}}})[_0x34d1('0x18')](function(){var _0x3243a4=[];var _0x3b2e5e=utils[_0x34d1('0x2d')]();_0x3b2e5e['forEach'](function(_0x2d894f){_0x3243a4['push']({'channel':_0x2d894f,'membername':_0x1450ba[_0x34d1('0x29')],'interface':_[_0x34d1('0x2e')](_0x1450ba['interface'])?util[_0x34d1('0x24')](_0x34d1('0x2f'),_0x1450ba[_0x34d1('0x29')]):_0x1450ba['interface'],'type':_0x34d1('0x30'),'enterAt':moment()[_0x34d1('0x24')](_0x34d1('0x2b')),'data1':_0x51cda0[_0x34d1('0x31')][_0x34d1('0x32')]||_0x34d1('0x33'),'role':_0x1450ba['role'],'internal':_0x1450ba[_0x34d1('0x22')],'uniqueid':_0x51cda0[_0x34d1('0x31')][_0x34d1('0x34')]||null});});return db[_0x34d1('0x28')][_0x34d1('0x35')](_0x3243a4,{'individualHooks':!![]});})[_0x34d1('0x18')](function(){return _0x1450ba[_0x34d1('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x51cda0[_0x34d1('0x31')][_0x34d1('0x32')]||_0x34d1('0x33'),'lastPauseAt':moment()[_0x34d1('0x24')](_0x34d1('0x2b'))});})['catch'](function(_0x59093f){throw _0x59093f;});};exports[_0x34d1('0x36')]=function(_0x8cb3b8){return Promise[_0x34d1('0x37')]()[_0x34d1('0x18')](function(){if(_0x8cb3b8['body'][_0x34d1('0x38')]&&!utils[_0x34d1('0x39')](_0x8cb3b8[_0x34d1('0x31')][_0x34d1('0x38')])){throw new Error(util[_0x34d1('0x24')](_0x34d1('0x3a'),_0x8cb3b8[_0x34d1('0x31')][_0x34d1('0x38')]));}return db[_0x34d1('0x1e')][_0x34d1('0x3b')]({'where':_0x8cb3b8['options']['where']||{},'attributes':['id',_0x34d1('0x29'),_0x34d1('0x3c'),_0x34d1('0x22'),'interface','online',_0x34d1('0x3d'),_0x34d1('0x3e'),_0x34d1('0x3f'),_0x34d1('0x40'),_0x34d1('0x41'),'smsPause',_0x34d1('0x42'),_0x34d1('0x43'),'lastPauseAt']});})[_0x34d1('0x18')](function(_0x350a7d){if(!_0x350a7d){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x8cb3b8[_0x34d1('0x44')]['id']));}return _0x350a7d[_0x34d1('0x45')](_0x8cb3b8[_0x34d1('0x31')][_0x34d1('0x38')],_0x34d1('0x46'));})['catch'](function(_0x459ee6){throw _0x459ee6;});};exports['LogoutUser']=function(_0x5a723f){var _0x32edc3=this;return new Promise(function(_0x460db4,_0x4f04db){var _0x1bc171;return db[_0x34d1('0x1e')][_0x34d1('0x3b')]({'where':_0x5a723f[_0x34d1('0x11')][_0x34d1('0x12')]||{},'attributes':['id',_0x34d1('0x29')]})[_0x34d1('0x18')](function(_0x301594){if(_0x301594){_0x1bc171=_0x301594;return db['UserVoiceQueueRt'][_0x34d1('0x47')]({'where':{'membername':_0x1bc171['name']},'individualHooks':!![]});}})[_0x34d1('0x18')](function(){if(_0x1bc171){return db['MemberReport'][_0x34d1('0x10')]({'where':{'membername':_0x1bc171[_0x34d1('0x29')],'exitAt':null}});}})[_0x34d1('0x18')](function(_0x4e4c15){if(_0x1bc171){if(_0x4e4c15&&_0x4e4c15[_0x34d1('0x2a')]){var _0x37eb26=[];_0x4e4c15[_0x34d1('0x48')](function(_0x1c57f4){_0x37eb26[_0x34d1('0x49')](_0x1c57f4[_0x34d1('0x27')]({'exitAt':moment()[_0x34d1('0x24')](_0x34d1('0x2b'))}));});return BPromise[_0x34d1('0x4a')](_0x37eb26);}}})[_0x34d1('0x18')](function(){if(_0x1bc171){return _0x1bc171[_0x34d1('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x34d1('0x18')](function(_0x2f7fec){_0x460db4(_0x2f7fec);})[_0x34d1('0x1b')](function(_0x3cc699){_0x4f04db(_0x32edc3[_0x34d1('0x1c')](0x1f4,_0x3cc699[_0x34d1('0x1d')]));});});};exports[_0x34d1('0x4b')]=function(_0x2871c5){var _0x315c13=this;return new Promise(function(_0x2a754b,_0x1530e6){var _0x315bed;var _0x264e0f;var _0x558b6f;var _0x20b232;return db['User'][_0x34d1('0x3b')]({'where':_0x2871c5[_0x34d1('0x11')]['where']||{},'attributes':['id',_0x34d1('0x29'),'role',_0x34d1('0x4c'),_0x34d1('0x4d'),_0x34d1('0x22'),_0x34d1('0x4e'),'interface']})[_0x34d1('0x18')](function(_0x345713){if(_0x345713){_0x315bed=_0x345713;_0x20b232=_0x2871c5[_0x34d1('0x31')][_0x34d1('0x23')]?_0x2871c5['body']['interface']:util[_0x34d1('0x24')](_0x34d1('0x2f'),_0x315bed['name']);return db[_0x34d1('0x1e')][_0x34d1('0x4f')]({'where':{'role':_0x34d1('0x50'),'online':!![],'id':{'$ne':_0x315bed['id']}}});}})['then'](function(_0xa0517f){if(_0xa0517f){_0x558b6f=_0xa0517f;return require(_0x34d1('0x51'))[_0x34d1('0x52')]();}})[_0x34d1('0x18')](function(_0x57d093){if(_0x57d093&&_0x57d093[_0x34d1('0x53')]&&_0x558b6f>=_0x57d093[_0x34d1('0x53')]){throw new Error(_0x34d1('0x54'));}})[_0x34d1('0x18')](function(){if(_0x315bed){return db[_0x34d1('0x26')][_0x34d1('0x47')]({'where':{'membername':_0x315bed[_0x34d1('0x29')]},'individualHooks':!![]});}})[_0x34d1('0x18')](function(){if(_0x315bed){return _0x315bed[_0x34d1('0x55')]({'raw':!![]});}})[_0x34d1('0x18')](function(_0x3eacad){if(_0x315bed){if(_0x3eacad){var _0x204914=[];_0x264e0f=_0x3eacad;if(_0x264e0f['length']){for(var _0x5aacc1=0x0;_0x5aacc1<_0x264e0f['length'];_0x5aacc1++){_0x204914[_0x34d1('0x49')](db[_0x34d1('0x26')][_0x34d1('0x56')]({'membername':_0x315bed[_0x34d1('0x29')],'UserId':_0x315bed['id'],'queue_name':_0x264e0f[_0x5aacc1]['name'],'VoiceQueueId':_0x264e0f[_0x5aacc1]['id'],'interface':_0x20b232,'paused':_0x315bed[_0x34d1('0x4e')]||![],'penalty':_0x264e0f[_0x5aacc1][_0x34d1('0x57')]||0x0}));}return BPromise['all'](_0x204914);}}}})[_0x34d1('0x18')](function(){if(_0x315bed){return db['MemberReport'][_0x34d1('0x10')]({'where':{'membername':_0x315bed[_0x34d1('0x29')],'exitAt':null}});}})[_0x34d1('0x18')](function(_0x595d93){if(_0x315bed){if(_0x595d93&&_0x595d93[_0x34d1('0x2a')]){var _0x9c1ff1=[];_0x595d93['forEach'](function(_0x2a864d){_0x9c1ff1[_0x34d1('0x49')](_0x2a864d[_0x34d1('0x27')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x34d1('0x4a')](_0x9c1ff1);}}})[_0x34d1('0x18')](function(){if(_0x315bed){var _0x3a3b7b=[];var _0x33ae3e=[];var _0x27f069=utils[_0x34d1('0x2d')]();var _0x241b38={'membername':_0x315bed[_0x34d1('0x29')],'interface':_0x20b232,'enterAt':moment()[_0x34d1('0x24')](_0x34d1('0x2b')),'role':_0x315bed[_0x34d1('0x3c')],'internal':_0x315bed[_0x34d1('0x22')]};_0x27f069[_0x34d1('0x48')](function(_0x27f825){_0x3a3b7b['push'](_[_0x34d1('0x58')]({'channel':_0x27f825,'type':_0x34d1('0x59'),'data1':_0x34d1('0x5a'),'data2':_0x20b232},_0x241b38));if(_0x315bed[_0x34d1('0x4e')]){_0x33ae3e['push'](_[_0x34d1('0x58')]({'channel':_0x27f825,'type':_0x34d1('0x30'),'data1':'LOGININPAUSE'},_0x241b38));}});return db[_0x34d1('0x28')]['bulkCreate'](_0x3a3b7b[_0x34d1('0x5b')](_0x33ae3e),{'individualHooks':!![]});}})['then'](function(){if(_0x315bed){return _0x315bed[_0x34d1('0x27')]({'online':!![],'lastLoginAt':moment()[_0x34d1('0x24')](_0x34d1('0x2b')),'voicePause':_0x315bed[_0x34d1('0x4e')]||![],'mailPause':_0x315bed[_0x34d1('0x4e')]||![],'chatPause':_0x315bed['loginInPause']||![],'faxPause':_0x315bed[_0x34d1('0x4e')]||![],'smsPause':_0x315bed[_0x34d1('0x4e')]||![],'openchannelPause':_0x315bed[_0x34d1('0x4e')]||![],'pauseType':_0x315bed[_0x34d1('0x4e')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x34d1('0x2b')),'interface':_0x20b232});}})[_0x34d1('0x18')](function(_0x1c4933){_0x2a754b(_0x1c4933);})[_0x34d1('0x1b')](function(_0xca53ca){_0x1530e6(_0x315c13[_0x34d1('0x1c')](0x1f4,_0xca53ca[_0x34d1('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 614a426..482da50 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 _0x1b4a=['./user.events','save','remove','removeListener','register','length','user:'];(function(_0x4e58c8,_0xf8c145){var _0x5dc892=function(_0x5225eb){while(--_0x5225eb){_0x4e58c8['push'](_0x4e58c8['shift']());}};_0x5dc892(++_0xf8c145);}(_0x1b4a,0x13b));var _0xa1b4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1b4a[_0x19e35c];return _0x3e1fe8;};'use strict';var UserEvents=require(_0xa1b4('0x0'));var events=[_0xa1b4('0x1'),_0xa1b4('0x2'),'update'];function createListener(_0x56176b,_0x479a6e){return function(_0x26cfde){_0x479a6e['emit'](_0x56176b,_0x26cfde);};}function removeListener(_0x267116,_0x505bf0){return function(){UserEvents[_0xa1b4('0x3')](_0x267116,_0x505bf0);};}exports[_0xa1b4('0x4')]=function(_0xcb3351){for(var _0x4fce5a=0x0,_0x1a5d83=events[_0xa1b4('0x5')];_0x4fce5a<_0x1a5d83;_0x4fce5a++){var _0x5b3f1c=events[_0x4fce5a];var _0x317409=createListener(_0xa1b4('0x6')+_0x5b3f1c,_0xcb3351);UserEvents['on'](_0x5b3f1c,_0x317409);}}; \ No newline at end of file +var _0x3d33=['length','user:','./user.events','save','update','emit','register'];(function(_0x10e164,_0x246406){var _0x3a89f0=function(_0x4fe71c){while(--_0x4fe71c){_0x10e164['push'](_0x10e164['shift']());}};_0x3a89f0(++_0x246406);}(_0x3d33,0xb1));var _0x33d3=function(_0x34f254,_0x2e31b4){_0x34f254=_0x34f254-0x0;var _0x31ea95=_0x3d33[_0x34f254];return _0x31ea95;};'use strict';var UserEvents=require(_0x33d3('0x0'));var events=[_0x33d3('0x1'),'remove',_0x33d3('0x2')];function createListener(_0x3f24e4,_0x3c08b0){return function(_0x517c51){_0x3c08b0[_0x33d3('0x3')](_0x3f24e4,_0x517c51);};}function removeListener(_0x4aba38,_0x31e0ad){return function(){UserEvents['removeListener'](_0x4aba38,_0x31e0ad);};}exports[_0x33d3('0x4')]=function(_0x19b175){for(var _0x3466b0=0x0,_0x1c3c49=events[_0x33d3('0x5')];_0x3466b0<_0x1c3c49;_0x3466b0++){var _0x33be07=events[_0x3466b0];var _0x2c1f55=createListener(_0x33d3('0x6')+_0x33be07,_0x19b175);UserEvents['on'](_0x33be07,_0x2c1f55);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 05ba021..9db8d12 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x109f6b,_0x2a164c){var _0x22c967=function(_0x854889){while(--_0x854889){_0x109f6b['push'](_0x109f6b['shift']());}};_0x22c967(++_0x2a164c);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4e7afb,_0x23f6ee){var _0x2532d9=function(_0x137f3b){while(--_0x137f3b){_0x4e7afb['push'](_0x4e7afb['shift']());}};_0x2532d9(++_0x23f6ee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0xcb91[_0x553a87];return _0x12d1e6;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 8f5fc2d..9006424 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 _0x1603=['exports','INTEGER'];(function(_0x1b531e,_0x26eea2){var _0x51ebf9=function(_0x59ea53){while(--_0x59ea53){_0x1b531e['push'](_0x1b531e['shift']());}};_0x51ebf9(++_0x26eea2);}(_0x1603,0x1b4));var _0x3160=function(_0x42087f,_0x59d2c1){_0x42087f=_0x42087f-0x0;var _0x5dce5d=_0x1603[_0x42087f];return _0x5dce5d;};'use strict';var Sequelize=require('sequelize');module[_0x3160('0x0')]={'penalty':{'type':Sequelize[_0x3160('0x1')],'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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 64a5c8f..722d415 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 _0x1cd2=['user_has_chat_queues','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x1cd2,0x199));var _0x21cd=function(_0x5700d5,_0x14eaa7){_0x5700d5=_0x5700d5-0x0;var _0x3ed378=_0x1cd2[_0x5700d5];return _0x3ed378;};'use strict';var _=require(_0x21cd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x21cd('0x1'));var moment=require(_0x21cd('0x2'));var BPromise=require('bluebird');var rp=require(_0x21cd('0x3'));var fs=require('fs');var path=require(_0x21cd('0x4'));var rimraf=require(_0x21cd('0x5'));var config=require(_0x21cd('0x6'));var attributes=require(_0x21cd('0x7'));module[_0x21cd('0x8')]=function(_0xef3e2e,_0xa63485){return _0xef3e2e[_0x21cd('0x9')](_0x21cd('0xa'),attributes,{'tableName':_0x21cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb265=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','define'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xb265,0xc2));var _0x5b26=function(_0x1e64f9,_0x6741b7){_0x1e64f9=_0x1e64f9-0x0;var _0x3008ff=_0xb265[_0x1e64f9];return _0x3008ff;};'use strict';var _=require(_0x5b26('0x0'));var util=require(_0x5b26('0x1'));var logger=require(_0x5b26('0x2'))(_0x5b26('0x3'));var moment=require('moment');var BPromise=require(_0x5b26('0x4'));var rp=require(_0x5b26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b26('0x6'));var config=require(_0x5b26('0x7'));var attributes=require(_0x5b26('0x8'));module['exports']=function(_0x9ed0eb,_0x556292){return _0x9ed0eb[_0x5b26('0x9')](_0x5b26('0xa'),attributes,{'tableName':_0x5b26('0xb'),'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 f8c1cea..70ee90c 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 _0x8f74=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e9c70,_0x368b6b){var _0x517ec3=function(_0x4d6e29){while(--_0x4d6e29){_0x1e9c70['push'](_0x1e9c70['shift']());}};_0x517ec3(++_0x368b6b);}(_0x8f74,0x126));var _0x48f7=function(_0x4d8b94,_0x2621c8){_0x4d8b94=_0x4d8b94-0x0;var _0x32696f=_0x8f74[_0x4d8b94];return _0x32696f;};'use strict';var _=require(_0x48f7('0x0'));var util=require(_0x48f7('0x1'));var moment=require(_0x48f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x48f7('0x3'));var fs=require('fs');var Redis=require(_0x48f7('0x4'));var db=require(_0x48f7('0x5'))['db'];var utils=require(_0x48f7('0x6'));var logger=require(_0x48f7('0x7'))(_0x48f7('0x8'));var config=require(_0x48f7('0x9'));var jayson=require(_0x48f7('0xa'));var client=jayson[_0x48f7('0xb')][_0x48f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x635c64,_0x52406b,_0x55b5a3){return new BPromise(function(_0x409454,_0x3790f9){return client[_0x48f7('0xd')](_0x635c64,_0x55b5a3)[_0x48f7('0xe')](function(_0x1ce256){logger['info'](_0x48f7('0xf'),_0x52406b,_0x48f7('0x10'));logger[_0x48f7('0x11')](_0x48f7('0x12'),_0x52406b,_0x48f7('0x10'),JSON[_0x48f7('0x13')](_0x1ce256));if(_0x1ce256[_0x48f7('0x14')]){if(_0x1ce256[_0x48f7('0x14')][_0x48f7('0x15')]===0x1f4){logger[_0x48f7('0x14')](_0x48f7('0xf'),_0x52406b,_0x1ce256[_0x48f7('0x14')][_0x48f7('0x16')]);return _0x3790f9(_0x1ce256[_0x48f7('0x14')][_0x48f7('0x16')]);}logger['error'](_0x48f7('0xf'),_0x52406b,_0x1ce256[_0x48f7('0x14')][_0x48f7('0x16')]);return _0x409454(_0x1ce256['error'][_0x48f7('0x16')]);}else{logger[_0x48f7('0x17')](_0x48f7('0xf'),_0x52406b,_0x48f7('0x10'));_0x409454(_0x1ce256[_0x48f7('0x18')][_0x48f7('0x16')]);}})[_0x48f7('0x19')](function(_0x4cfdd5){logger['error'](_0x48f7('0xf'),_0x52406b,_0x4cfdd5);_0x3790f9(_0x4cfdd5);});});} \ No newline at end of file +var _0x172f=['request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x2bcede,_0x5e8f52){var _0xb11943=function(_0x4a03e6){while(--_0x4a03e6){_0x2bcede['push'](_0x2bcede['shift']());}};_0xb11943(++_0x5e8f52);}(_0x172f,0x170));var _0xf172=function(_0x731aa2,_0x30a2de){_0x731aa2=_0x731aa2-0x0;var _0xf3690a=_0x172f[_0x731aa2];return _0xf3690a;};'use strict';var _=require(_0xf172('0x0'));var util=require(_0xf172('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf172('0x2'));var fs=require('fs');var Redis=require(_0xf172('0x3'));var db=require(_0xf172('0x4'))['db'];var utils=require(_0xf172('0x5'));var logger=require('../../config/logger')(_0xf172('0x6'));var config=require(_0xf172('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf172('0x8')][_0xf172('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1120dd,_0x541a67,_0x2e36ba){return new BPromise(function(_0x21489c,_0x15b758){return client[_0xf172('0xa')](_0x1120dd,_0x2e36ba)[_0xf172('0xb')](function(_0x466c48){logger[_0xf172('0xc')](_0xf172('0xd'),_0x541a67,_0xf172('0xe'));logger[_0xf172('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x541a67,_0xf172('0xe'),JSON[_0xf172('0x10')](_0x466c48));if(_0x466c48[_0xf172('0x11')]){if(_0x466c48['error'][_0xf172('0x12')]===0x1f4){logger['error'](_0xf172('0xd'),_0x541a67,_0x466c48[_0xf172('0x11')][_0xf172('0x13')]);return _0x15b758(_0x466c48[_0xf172('0x11')]['message']);}logger['error'](_0xf172('0xd'),_0x541a67,_0x466c48[_0xf172('0x11')][_0xf172('0x13')]);return _0x21489c(_0x466c48[_0xf172('0x11')][_0xf172('0x13')]);}else{logger[_0xf172('0xc')](_0xf172('0xd'),_0x541a67,_0xf172('0xe'));_0x21489c(_0x466c48['result'][_0xf172('0x13')]);}})[_0xf172('0x14')](function(_0x10510e){logger[_0xf172('0x11')](_0xf172('0xd'),_0x541a67,_0x10510e);_0x15b758(_0x10510e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8d9e2a5..0f36454 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x31f581,_0x1467e8){var _0x1349c5=function(_0x3cd4eb){while(--_0x3cd4eb){_0x31f581['push'](_0x31f581['shift']());}};_0x1349c5(++_0x1467e8);}(_0x70e0,0x17b));var _0x070e=function(_0x4e7642,_0x401ae8){_0x4e7642=_0x4e7642-0x0;var _0x330cd2=_0x70e0[_0x4e7642];return _0x330cd2;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5a442e,_0x470676){var _0x495b90=function(_0x127f14){while(--_0x127f14){_0x5a442e['push'](_0x5a442e['shift']());}};_0x495b90(++_0x470676);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0xcb91[_0xfedc72];return _0x2c7c78;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 932969e..cd5ae3b 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 _0xf772=['sequelize','INTEGER','STRING'];(function(_0x5be7a8,_0x136921){var _0x58ebee=function(_0x50737e){while(--_0x50737e){_0x5be7a8['push'](_0x5be7a8['shift']());}};_0x58ebee(++_0x136921);}(_0xf772,0x18c));var _0x2f77=function(_0x138bea,_0x4d86d8){_0x138bea=_0x138bea-0x0;var _0x2c139d=_0xf772[_0x138bea];return _0x2c139d;};'use strict';var Sequelize=require(_0x2f77('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2f77('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2f77('0x2')]}}; \ No newline at end of file +var _0x1991=['exports','INTEGER','STRING','sequelize'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x1991,0x187));var _0x1199=function(_0x19b2bd,_0x3fe339){_0x19b2bd=_0x19b2bd-0x0;var _0x38bd2b=_0x1991[_0x19b2bd];return _0x38bd2b;};'use strict';var Sequelize=require(_0x1199('0x0'));module[_0x1199('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1199('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1199('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 658a073..b69b7c4 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 _0x4f12=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','util'];(function(_0x32c5b1,_0x56c82a){var _0x581b03=function(_0x18ab53){while(--_0x18ab53){_0x32c5b1['push'](_0x32c5b1['shift']());}};_0x581b03(++_0x56c82a);}(_0x4f12,0x102));var _0x24f1=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0x4f12[_0x26cab7];return _0x31ba06;};'use strict';var _=require(_0x24f1('0x0'));var util=require(_0x24f1('0x1'));var logger=require(_0x24f1('0x2'))(_0x24f1('0x3'));var moment=require(_0x24f1('0x4'));var BPromise=require('bluebird');var rp=require(_0x24f1('0x5'));var fs=require('fs');var path=require(_0x24f1('0x6'));var rimraf=require(_0x24f1('0x7'));var config=require(_0x24f1('0x8'));var attributes=require(_0x24f1('0x9'));module[_0x24f1('0xa')]=function(_0x4c5af1,_0x267914){return _0x4c5af1[_0x24f1('0xb')]('UserFaxQueue',attributes,{'tableName':_0x24f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4028=['bluebird','request-promise','rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','moment'];(function(_0x1476ba,_0x446421){var _0x5e7bc1=function(_0x4aa99c){while(--_0x4aa99c){_0x1476ba['push'](_0x1476ba['shift']());}};_0x5e7bc1(++_0x446421);}(_0x4028,0xf8));var _0x8402=function(_0x4f0e8e,_0x4b637d){_0x4f0e8e=_0x4f0e8e-0x0;var _0x5e1f42=_0x4028[_0x4f0e8e];return _0x5e1f42;};'use strict';var _=require(_0x8402('0x0'));var util=require('util');var logger=require(_0x8402('0x1'))(_0x8402('0x2'));var moment=require(_0x8402('0x3'));var BPromise=require(_0x8402('0x4'));var rp=require(_0x8402('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8402('0x6'));var config=require(_0x8402('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x8402('0x8')]=function(_0x401802,_0x2e6fd0){return _0x401802[_0x8402('0x9')](_0x8402('0xa'),attributes,{'tableName':_0x8402('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 6451425..270fe28 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 _0x4f02=['error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5f5cce,_0x138cc5){var _0x705ecf=function(_0x28bc5d){while(--_0x28bc5d){_0x5f5cce['push'](_0x5f5cce['shift']());}};_0x705ecf(++_0x138cc5);}(_0x4f02,0x82));var _0x24f0=function(_0x15010c,_0x109be0){_0x15010c=_0x15010c-0x0;var _0x481c3b=_0x4f02[_0x15010c];return _0x481c3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x24f0('0x0'));var rs=require(_0x24f0('0x1'));var fs=require('fs');var Redis=require(_0x24f0('0x2'));var db=require(_0x24f0('0x3'))['db'];var utils=require(_0x24f0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x24f0('0x5'));var jayson=require(_0x24f0('0x6'));var client=jayson['client'][_0x24f0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b1091,_0x3a52f5,_0x8645){return new BPromise(function(_0x22c332,_0x3132e6){return client[_0x24f0('0x8')](_0x2b1091,_0x8645)['then'](function(_0x5da72d){logger[_0x24f0('0x9')](_0x24f0('0xa'),_0x3a52f5,_0x24f0('0xb'));logger[_0x24f0('0xc')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3a52f5,'request\x20sent',JSON[_0x24f0('0xd')](_0x5da72d));if(_0x5da72d[_0x24f0('0xe')]){if(_0x5da72d['error'][_0x24f0('0xf')]===0x1f4){logger[_0x24f0('0xe')](_0x24f0('0xa'),_0x3a52f5,_0x5da72d['error'][_0x24f0('0x10')]);return _0x3132e6(_0x5da72d[_0x24f0('0xe')][_0x24f0('0x10')]);}logger[_0x24f0('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x3a52f5,_0x5da72d[_0x24f0('0xe')][_0x24f0('0x10')]);return _0x22c332(_0x5da72d[_0x24f0('0xe')][_0x24f0('0x10')]);}else{logger['info'](_0x24f0('0xa'),_0x3a52f5,_0x24f0('0xb'));_0x22c332(_0x5da72d['result']['message']);}})[_0x24f0('0x11')](function(_0xe03d0d){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3a52f5,_0xe03d0d);_0x3132e6(_0xe03d0d);});});} \ No newline at end of file +var _0x8944=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x17e849,_0x588a88){var _0x35d503=function(_0x1d7eb7){while(--_0x1d7eb7){_0x17e849['push'](_0x17e849['shift']());}};_0x35d503(++_0x588a88);}(_0x8944,0x1c6));var _0x4894=function(_0x5bdc4e,_0x3c78c4){_0x5bdc4e=_0x5bdc4e-0x0;var _0x22c216=_0x8944[_0x5bdc4e];return _0x22c216;};'use strict';var _=require(_0x4894('0x0'));var util=require(_0x4894('0x1'));var moment=require('moment');var BPromise=require(_0x4894('0x2'));var rs=require(_0x4894('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4894('0x4'))['db'];var utils=require(_0x4894('0x5'));var logger=require(_0x4894('0x6'))(_0x4894('0x7'));var config=require(_0x4894('0x8'));var jayson=require(_0x4894('0x9'));var client=jayson[_0x4894('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11bef9,_0x2a0c91,_0x33177c){return new BPromise(function(_0x938cea,_0x4f01eb){return client['request'](_0x11bef9,_0x33177c)[_0x4894('0xb')](function(_0x151e14){logger[_0x4894('0xc')](_0x4894('0xd'),_0x2a0c91,_0x4894('0xe'));logger[_0x4894('0xf')](_0x4894('0x10'),_0x2a0c91,_0x4894('0xe'),JSON[_0x4894('0x11')](_0x151e14));if(_0x151e14['error']){if(_0x151e14[_0x4894('0x12')][_0x4894('0x13')]===0x1f4){logger[_0x4894('0x12')](_0x4894('0xd'),_0x2a0c91,_0x151e14[_0x4894('0x12')][_0x4894('0x14')]);return _0x4f01eb(_0x151e14[_0x4894('0x12')][_0x4894('0x14')]);}logger['error'](_0x4894('0xd'),_0x2a0c91,_0x151e14[_0x4894('0x12')]['message']);return _0x938cea(_0x151e14[_0x4894('0x12')][_0x4894('0x14')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x2a0c91,'request\x20sent');_0x938cea(_0x151e14[_0x4894('0x15')]['message']);}})[_0x4894('0x16')](function(_0x455d40){logger[_0x4894('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x2a0c91,_0x455d40);_0x4f01eb(_0x455d40);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index cd636b6..080c3a7 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x125c6b,_0x3396bd){var _0x49b36f=function(_0x14a408){while(--_0x14a408){_0x125c6b['push'](_0x125c6b['shift']());}};_0x49b36f(++_0x3396bd);}(_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 diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index eb52235..87ba11d 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 _0x3f1c=['sequelize'];(function(_0xf96d8f,_0x2cc4c3){var _0x237b6b=function(_0xf1386c){while(--_0xf1386c){_0xf96d8f['push'](_0xf96d8f['shift']());}};_0x237b6b(++_0x2cc4c3);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x120dd0,_0x523230){_0x120dd0=_0x120dd0-0x0;var _0x22bf27=_0x3f1c[_0x120dd0];return _0x22bf27;};'use strict';var Sequelize=require(_0xc3f1('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x32c2=['sequelize','exports','INTEGER'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x32c2,0x90));var _0x232c=function(_0x583278,_0x5474fa){_0x583278=_0x583278-0x0;var _0x7af2fe=_0x32c2[_0x583278];return _0x7af2fe;};'use strict';var Sequelize=require(_0x232c('0x0'));module[_0x232c('0x1')]={'penalty':{'type':Sequelize[_0x232c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 8dfe113..99a32ba 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 _0x4524=['bluebird','request-promise','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x2a0c97,_0x3e0a91){var _0x56e5e2=function(_0x249e08){while(--_0x249e08){_0x2a0c97['push'](_0x2a0c97['shift']());}};_0x56e5e2(++_0x3e0a91);}(_0x4524,0xef));var _0x4452=function(_0x33a9aa,_0x6e72f5){_0x33a9aa=_0x33a9aa-0x0;var _0xc0a26f=_0x4524[_0x33a9aa];return _0xc0a26f;};'use strict';var _=require(_0x4452('0x0'));var util=require(_0x4452('0x1'));var logger=require(_0x4452('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4452('0x3'));var rp=require(_0x4452('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4452('0x5'));var config=require('../../config/environment');var attributes=require(_0x4452('0x6'));module[_0x4452('0x7')]=function(_0x218d40,_0x53a9d9){return _0x218d40[_0x4452('0x8')](_0x4452('0x9'),attributes,{'tableName':_0x4452('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8f0=['moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','../../config/logger'];(function(_0x272573,_0x354a17){var _0x35de24=function(_0x2faf6c){while(--_0x2faf6c){_0x272573['push'](_0x272573['shift']());}};_0x35de24(++_0x354a17);}(_0xd8f0,0xbe));var _0x0d8f=function(_0x4e936b,_0x193d71){_0x4e936b=_0x4e936b-0x0;var _0xda6dd6=_0xd8f0[_0x4e936b];return _0xda6dd6;};'use strict';var _=require(_0x0d8f('0x0'));var util=require('util');var logger=require(_0x0d8f('0x1'))('api');var moment=require(_0x0d8f('0x2'));var BPromise=require('bluebird');var rp=require(_0x0d8f('0x3'));var fs=require('fs');var path=require(_0x0d8f('0x4'));var rimraf=require(_0x0d8f('0x5'));var config=require(_0x0d8f('0x6'));var attributes=require(_0x0d8f('0x7'));module[_0x0d8f('0x8')]=function(_0x546b72,_0x5109b2){return _0x546b72[_0x0d8f('0x9')](_0x0d8f('0xa'),attributes,{'tableName':_0x0d8f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 49f49e0..74ed527 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xb2946c,_0x1dce74){var _0x3ed01c=function(_0x3b244e){while(--_0x3b244e){_0xb2946c['push'](_0xb2946c['shift']());}};_0x3ed01c(++_0x1dce74);}(_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']('UserMailQueue,\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 _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(_0x437abe,_0x3e33a8){_0x437abe=_0x437abe-0x0;var _0x51189b=_0x008c[_0x437abe];return _0x51189b;};'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 2c35971..c0fc9d4 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 _0x14a1=['isAuthenticated','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post'];(function(_0x50653b,_0x565ab3){var _0x446b45=function(_0x280f9f){while(--_0x280f9f){_0x50653b['push'](_0x50653b['shift']());}};_0x446b45(++_0x565ab3);}(_0x14a1,0x18e));var _0x114a=function(_0x50f84a,_0x4623ba){_0x50f84a=_0x50f84a-0x0;var _0x43088c=_0x14a1[_0x50f84a];return _0x43088c;};'use strict';var multer=require(_0x114a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x114a('0x1')]();var fs_extra=require(_0x114a('0x2'));var auth=require(_0x114a('0x3'));var interaction=require(_0x114a('0x4'));var config=require(_0x114a('0x5'));var controller=require('./userNotification.controller');router[_0x114a('0x6')]('/',auth[_0x114a('0x7')](),controller['sendUserNotification']);module[_0x114a('0x8')]=router; \ No newline at end of file +var _0xe169=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','sendUserNotification'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xe169,0x1cb));var _0x9e16=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe169[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x9e16('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9e16('0x1'));var express=require(_0x9e16('0x2'));var router=express['Router']();var fs_extra=require(_0x9e16('0x3'));var auth=require(_0x9e16('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9e16('0x5'));var controller=require(_0x9e16('0x6'));router[_0x9e16('0x7')]('/',auth['isAuthenticated'](),controller[_0x9e16('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 3dac6c2..8962371 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 _0xda43=['STRING','sequelize','exports','TEXT'];(function(_0x321533,_0x43fb8f){var _0x33a656=function(_0xcad470){while(--_0xcad470){_0x321533['push'](_0x321533['shift']());}};_0x33a656(++_0x43fb8f);}(_0xda43,0xd9));var _0x3da4=function(_0x1c4b44,_0x2377de){_0x1c4b44=_0x1c4b44-0x0;var _0x10d72b=_0xda43[_0x1c4b44];return _0x10d72b;};'use strict';var Sequelize=require(_0x3da4('0x0'));module[_0x3da4('0x1')]={'body':{'type':Sequelize[_0x3da4('0x2')]},'senderName':{'type':Sequelize[_0x3da4('0x3')]},'recipientsId':{'type':Sequelize[_0x3da4('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xfa86=['sequelize','TEXT','STRING'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xfa86,0x1a4));var _0x6fa8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xfa86[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require(_0x6fa8('0x0'));module['exports']={'body':{'type':Sequelize[_0x6fa8('0x1')]},'senderName':{'type':Sequelize[_0x6fa8('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'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 aa9f81f..74e142b 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 _0xa923=['hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','openchannelqueue','smsqueue','whatsappqueue','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','catch','Template','findOne','html','forEach','User','ids','queue','replace','push','all','union','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./userNotification.socket','register','sendStatus','end','status','json','undefined','offset','set','save','then','destroy','error','name','sendUserNotification','body'];(function(_0x449b6b,_0x1201c2){var _0x21d8c3=function(_0x311f46){while(--_0x311f46){_0x449b6b['push'](_0x449b6b['shift']());}};_0x21d8c3(++_0x1201c2);}(_0xa923,0x148));var _0x3a92=function(_0x530ec8,_0x12ae7f){_0x530ec8=_0x530ec8-0x0;var _0x3edc09=_0xa923[_0x530ec8];return _0x3edc09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a92('0x0'));var zipdir=require(_0x3a92('0x1'));var jsonpatch=require(_0x3a92('0x2'));var rp=require('request-promise');var moment=require(_0x3a92('0x3'));var BPromise=require(_0x3a92('0x4'));var Mustache=require(_0x3a92('0x5'));var util=require(_0x3a92('0x6'));var path=require(_0x3a92('0x7'));var sox=require(_0x3a92('0x8'));var csv=require(_0x3a92('0x9'));var ejs=require(_0x3a92('0xa'));var fs=require('fs');var fs_extra=require(_0x3a92('0xb'));var _=require('lodash');var squel=require(_0x3a92('0xc'));var crypto=require('crypto');var jsforce=require(_0x3a92('0xd'));var deskjs=require(_0x3a92('0xe'));var toCsv=require(_0x3a92('0x9'));var querystring=require(_0x3a92('0xf'));var Papa=require(_0x3a92('0x10'));var Redis=require(_0x3a92('0x11'));var authService=require(_0x3a92('0x12'));var qs=require(_0x3a92('0x13'));var as=require(_0x3a92('0x14'));var hardwareService=require(_0x3a92('0x15'));var logger=require(_0x3a92('0x16'))(_0x3a92('0x17'));var utils=require('../../config/utils');var config=require(_0x3a92('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a92('0x19'))['db'];config[_0x3a92('0x1a')]=_[_0x3a92('0x1b')](config[_0x3a92('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a92('0x1a')]));require(_0x3a92('0x1c'))[_0x3a92('0x1d')](socket);function respondWithStatusCode(_0x32b6c0,_0x525456){_0x525456=_0x525456||0xcc;return function(_0x48f555){if(_0x48f555){return _0x32b6c0[_0x3a92('0x1e')](_0x525456);}return _0x32b6c0['status'](_0x525456)[_0x3a92('0x1f')]();};}function respondWithResult(_0x2b0871,_0x2135ae){_0x2135ae=_0x2135ae||0xc8;return function(_0x44f740){if(_0x44f740){return _0x2b0871[_0x3a92('0x20')](_0x2135ae)[_0x3a92('0x21')](_0x44f740);}};}function respondWithFilteredResult(_0x4b8ca9,_0x48ea11){return function(_0x5a07da){if(_0x5a07da){var _0x5e565e=typeof _0x48ea11['offset']===_0x3a92('0x22')&&typeof _0x48ea11['limit']==='undefined';var _0x595751=_0x5a07da['count'];var _0x344ee0=_0x5e565e?0x0:_0x48ea11[_0x3a92('0x23')];var _0x334ad1=_0x5e565e?_0x5a07da['count']:_0x48ea11[_0x3a92('0x23')]+_0x48ea11['limit'];var _0xa22bf5;if(_0x334ad1>=_0x595751){_0x334ad1=_0x595751;_0xa22bf5=0xc8;}else{_0xa22bf5=0xce;}_0x4b8ca9[_0x3a92('0x20')](_0xa22bf5);return _0x4b8ca9[_0x3a92('0x24')]('Content-Range',_0x344ee0+'-'+_0x334ad1+'/'+_0x595751)['json'](_0x5a07da);}return null;};}function patchUpdates(_0x506c7a){return function(_0x301c0e){try{jsonpatch['apply'](_0x301c0e,_0x506c7a,!![]);}catch(_0x82c158){return BPromise['reject'](_0x82c158);}return _0x301c0e[_0x3a92('0x25')]();};}function saveUpdates(_0x1c2efe,_0x54ec54){return function(_0xa8819d){if(_0xa8819d){return _0xa8819d['update'](_0x1c2efe)[_0x3a92('0x26')](function(_0x18030c){return _0x18030c;});}return null;};}function removeEntity(_0x1de8a4,_0x4dcf23){return function(_0x24c6fd){if(_0x24c6fd){return _0x24c6fd[_0x3a92('0x27')]()[_0x3a92('0x26')](function(){_0x1de8a4[_0x3a92('0x20')](0xcc)[_0x3a92('0x1f')]();});}};}function handleEntityNotFound(_0x21efb8,_0x3f4144){return function(_0x5a0365){if(!_0x5a0365){_0x21efb8[_0x3a92('0x1e')](0x194);}return _0x5a0365;};}function handleError(_0xc22728,_0x9e9b7b){_0x9e9b7b=_0x9e9b7b||0x1f4;return function(_0x2f12e0){logger[_0x3a92('0x28')](_0x2f12e0['stack']);if(_0x2f12e0[_0x3a92('0x29')]){delete _0x2f12e0[_0x3a92('0x29')];}_0xc22728[_0x3a92('0x20')](_0x9e9b7b)['send'](_0x2f12e0);};}exports[_0x3a92('0x2a')]=function(_0x339ce4,_0x252cdf,_0x1ef009){if(!_0x339ce4[_0x3a92('0x2b')][_0x3a92('0x2c')](_0x3a92('0x2d'))&&!_0x339ce4[_0x3a92('0x2b')]['hasOwnProperty'](_0x3a92('0x2e'))){throw new db[(_0x3a92('0x2f'))][(_0x3a92('0x30'))](_0x3a92('0x31'));}else{if(_0x339ce4[_0x3a92('0x2b')][_0x3a92('0x2c')](_0x3a92('0x2e'))&&!_0x339ce4['body'][_0x3a92('0x2c')](_0x3a92('0x32'))){throw new db[(_0x3a92('0x2f'))][(_0x3a92('0x30'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x339ce4['body'][_0x3a92('0x2c')](_0x3a92('0x33'))){throw new db[(_0x3a92('0x2f'))][(_0x3a92('0x30'))](_0x3a92('0x34'));}else{try{var _0x860f5d=JSON[_0x3a92('0x35')](_0x339ce4[_0x3a92('0x2b')][_0x3a92('0x33')]);}catch(_0x35f98e){logger[_0x3a92('0x28')](_0x35f98e);throw new db[(_0x3a92('0x2f'))][(_0x3a92('0x30'))]('Invalid\x20\x27recipients\x27\x20object');}var _0xb58db=[_0x3a92('0x36'),_0x3a92('0x37'),'mailqueue',_0x3a92('0x38'),_0x3a92('0x39'),'voicequeue',_0x3a92('0x3a'),'team',_0x3a92('0x3b')];if(_[_0x3a92('0x3c')](_0x860f5d,function(_0x3f18cc){return!_[_0x3a92('0x3d')](_0xb58db,_0x3f18cc[_0x3a92('0x3e')][_0x3a92('0x3f')]());})){throw new db['Sequelize'][(_0x3a92('0x30'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x28daca={};_0x28daca[_0x3a92('0x40')]=_0x339ce4[_0x3a92('0x2b')][_0x3a92('0x2c')]('senderName')?_0x339ce4[_0x3a92('0x2b')][_0x3a92('0x40')]:_0x339ce4[_0x3a92('0x3b')][_0x3a92('0x41')];_0x28daca[_0x3a92('0x42')]=_[_0x3a92('0x43')](_0x339ce4['body']['recipientsDescription'])?null:_0x339ce4[_0x3a92('0x2b')][_0x3a92('0x42')];_0x28daca[_0x3a92('0x44')]=_0x339ce4[_0x3a92('0x2b')][_0x3a92('0x44')]||![];_0x28daca[_0x3a92('0x45')]=_0x339ce4[_0x3a92('0x3b')]['id'];return getContent(_0x339ce4[_0x3a92('0x2b')])[_0x3a92('0x26')](function(_0x2571ad){_0x28daca[_0x3a92('0x2b')]=_0x2571ad;return getRecipients(_0x860f5d);})['then'](function(_0x1a63ac){_0x28daca[_0x3a92('0x46')]=_[_0x3a92('0x47')](_0x1a63ac)['join'](',');return db[_0x3a92('0x48')][_0x3a92('0x49')](function(_0x49f607){return db[_0x3a92('0x4a')]['create'](_0x28daca,{'raw':!![],'transaction':_0x49f607})[_0x3a92('0x26')](function(_0x3361f6){var _0x187fe4={'sender':_0x28daca[_0x3a92('0x40')],'description':_0x28daca['recipientsDescription'],'content':_0x28daca[_0x3a92('0x2b')],'beep':_0x28daca[_0x3a92('0x44')]};_0x1a63ac['forEach'](function(_0x18b7c9){_0x187fe4[_0x3a92('0x4b')]=_0x18b7c9;socket[_0x3a92('0x4c')](_0x3a92('0x4d'),_0x187fe4);});return _0x3361f6;});});})['then'](respondWithResult(_0x252cdf,0xc9))[_0x3a92('0x4e')](handleError(_0x252cdf,null));};function getContent(_0x2e92bb){return new BPromise(function(_0x4bdf5d,_0x53b7df){if(_0x2e92bb[_0x3a92('0x2d')]){_0x4bdf5d(_0x2e92bb[_0x3a92('0x2d')]);return;}return db[_0x3a92('0x4f')][_0x3a92('0x50')]({'attributes':[_0x3a92('0x51')],'where':{'id':_0x2e92bb[_0x3a92('0x2e')]},'raw':!![]})[_0x3a92('0x26')](function(_0x4b9d1e){if(!_0x4b9d1e)throw new db[(_0x3a92('0x2f'))][(_0x3a92('0x30'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x8f4995=Mustache['render'](_0x4b9d1e[_0x3a92('0x51')],_0x2e92bb['view']);_0x4bdf5d(_0x8f4995);})[_0x3a92('0x4e')](function(_0x3e5662){_0x53b7df(_0x3e5662);});});}function getRecipients(_0x546933){return new BPromise(function(_0x54b124,_0x11d42c){var _0x24f67a=[];var _0x5650d1=[];_0x546933[_0x3a92('0x52')](function(_0x5549d2){var _0x3368c9=_['startCase'](_0x5549d2[_0x3a92('0x3e')]['toLowerCase']());if(_0x3368c9===_0x3a92('0x53')){_0x24f67a=_['union'](_0x24f67a,_0x5549d2[_0x3a92('0x54')]);}else{if(_['includes'](_0x3368c9,_0x3a92('0x55')))_0x3368c9=_0x3368c9[_0x3a92('0x56')](_0x3a92('0x55'),'Queue');_0x5549d2[_0x3a92('0x54')][_0x3a92('0x52')](function(_0x20ad19){_0x5650d1[_0x3a92('0x57')](getAgents(_0x3368c9,_0x20ad19));});}});return BPromise[_0x3a92('0x58')](_0x5650d1)['then'](function(_0x5ce032){_0x24f67a=_[_0x3a92('0x59')](_0x24f67a,_[_0x3a92('0x5a')](_0x5ce032));_0x54b124(_0x24f67a);})['catch'](function(_0x40b982){_0x11d42c(_0x40b982);});});}function getAgents(_0x3add9a,_0x542263){return new BPromise(function(_0x49063c,_0x2d67f2){return db[_0x3add9a]['findOne']({'where':{'id':_0x542263}})[_0x3a92('0x26')](function(_0x1c9a58){return _0x1c9a58[_0x3a92('0x5b')]({'attributes':['id'],'raw':!![]})[_0x3a92('0x26')](function(_0x2d6a41){var _0x4accdb=_[_0x3a92('0x5c')](_0x2d6a41,'id');_0x49063c(_0x4accdb);});})[_0x3a92('0x4e')](function(_0x24452a){_0x2d67f2(_0x24452a);});});} \ No newline at end of file +var _0x5448=['union','ids','includes','queue','replace','Queue','push','all','flatten','findOne','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userNotification.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','some','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User'];(function(_0x214403,_0x1b71ce){var _0xd1faf3=function(_0x38eb37){while(--_0x38eb37){_0x214403['push'](_0x214403['shift']());}};_0xd1faf3(++_0x1b71ce);}(_0x5448,0x138));var _0x8544=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5448[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x8544('0x0'));var rimraf=require(_0x8544('0x1'));var zipdir=require(_0x8544('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8544('0x3'));var moment=require(_0x8544('0x4'));var BPromise=require(_0x8544('0x5'));var Mustache=require(_0x8544('0x6'));var util=require(_0x8544('0x7'));var path=require('path');var sox=require(_0x8544('0x8'));var csv=require(_0x8544('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8544('0xa'));var _=require('lodash');var squel=require(_0x8544('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8544('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8544('0xd'));var Papa=require(_0x8544('0xe'));var Redis=require(_0x8544('0xf'));var authService=require(_0x8544('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8544('0x11'));var logger=require(_0x8544('0x12'))(_0x8544('0x13'));var utils=require(_0x8544('0x14'));var config=require(_0x8544('0x15'));var licenseUtil=require(_0x8544('0x16'));var db=require('../../mysqldb')['db'];config[_0x8544('0x17')]=_[_0x8544('0x18')](config[_0x8544('0x17')],{'host':_0x8544('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8544('0x1a'))[_0x8544('0x1b')](socket);function respondWithStatusCode(_0x3b140b,_0x5839d5){_0x5839d5=_0x5839d5||0xcc;return function(_0x466ffb){if(_0x466ffb){return _0x3b140b[_0x8544('0x1c')](_0x5839d5);}return _0x3b140b['status'](_0x5839d5)[_0x8544('0x1d')]();};}function respondWithResult(_0x11f892,_0x3a8ee6){_0x3a8ee6=_0x3a8ee6||0xc8;return function(_0x318e18){if(_0x318e18){return _0x11f892['status'](_0x3a8ee6)[_0x8544('0x1e')](_0x318e18);}};}function respondWithFilteredResult(_0x30d46c,_0x23c3c0){return function(_0xa4e8ed){if(_0xa4e8ed){var _0x48e541=typeof _0x23c3c0['offset']===_0x8544('0x1f')&&typeof _0x23c3c0[_0x8544('0x20')]===_0x8544('0x1f');var _0x43927e=_0xa4e8ed[_0x8544('0x21')];var _0x536394=_0x48e541?0x0:_0x23c3c0[_0x8544('0x22')];var _0x28ad53=_0x48e541?_0xa4e8ed[_0x8544('0x21')]:_0x23c3c0[_0x8544('0x22')]+_0x23c3c0[_0x8544('0x20')];var _0x428b35;if(_0x28ad53>=_0x43927e){_0x28ad53=_0x43927e;_0x428b35=0xc8;}else{_0x428b35=0xce;}_0x30d46c[_0x8544('0x23')](_0x428b35);return _0x30d46c[_0x8544('0x24')]('Content-Range',_0x536394+'-'+_0x28ad53+'/'+_0x43927e)[_0x8544('0x1e')](_0xa4e8ed);}return null;};}function patchUpdates(_0x2c98eb){return function(_0x256bb1){try{jsonpatch[_0x8544('0x25')](_0x256bb1,_0x2c98eb,!![]);}catch(_0x40f0ef){return BPromise[_0x8544('0x26')](_0x40f0ef);}return _0x256bb1[_0x8544('0x27')]();};}function saveUpdates(_0x581606,_0x68bc17){return function(_0x18cdf3){if(_0x18cdf3){return _0x18cdf3[_0x8544('0x28')](_0x581606)[_0x8544('0x29')](function(_0x95bea9){return _0x95bea9;});}return null;};}function removeEntity(_0x6abd6e,_0x32a13f){return function(_0x4eacba){if(_0x4eacba){return _0x4eacba[_0x8544('0x2a')]()[_0x8544('0x29')](function(){_0x6abd6e[_0x8544('0x23')](0xcc)[_0x8544('0x1d')]();});}};}function handleEntityNotFound(_0xe3d21b,_0x20213d){return function(_0x5f4596){if(!_0x5f4596){_0xe3d21b[_0x8544('0x1c')](0x194);}return _0x5f4596;};}function handleError(_0x4e693d,_0x3c75cf){_0x3c75cf=_0x3c75cf||0x1f4;return function(_0x3236c9){logger[_0x8544('0x2b')](_0x3236c9[_0x8544('0x2c')]);if(_0x3236c9['name']){delete _0x3236c9[_0x8544('0x2d')];}_0x4e693d[_0x8544('0x23')](_0x3c75cf)[_0x8544('0x2e')](_0x3236c9);};}exports['sendUserNotification']=function(_0x35dddd,_0x117133,_0xc08b9e){if(!_0x35dddd[_0x8544('0x2f')][_0x8544('0x30')](_0x8544('0x31'))&&!_0x35dddd[_0x8544('0x2f')]['hasOwnProperty'](_0x8544('0x32'))){throw new db[(_0x8544('0x33'))]['ValidationError'](_0x8544('0x34'));}else{if(_0x35dddd[_0x8544('0x2f')][_0x8544('0x30')](_0x8544('0x32'))&&!_0x35dddd[_0x8544('0x2f')][_0x8544('0x30')](_0x8544('0x35'))){throw new db[(_0x8544('0x33'))]['ValidationError'](_0x8544('0x36'));}if(!_0x35dddd[_0x8544('0x2f')]['hasOwnProperty']('recipients')){throw new db[(_0x8544('0x33'))][(_0x8544('0x37'))](_0x8544('0x38'));}else{try{var _0x2e4b6c=JSON[_0x8544('0x39')](_0x35dddd[_0x8544('0x2f')]['recipients']);}catch(_0xdb9118){logger['error'](_0xdb9118);throw new db[(_0x8544('0x33'))][(_0x8544('0x37'))](_0x8544('0x3a'));}var _0x5678d0=['chatqueue',_0x8544('0x3b'),_0x8544('0x3c'),_0x8544('0x3d'),_0x8544('0x3e'),_0x8544('0x3f'),'whatsappqueue','team','user'];if(_[_0x8544('0x40')](_0x2e4b6c,function(_0x254251){return!_['includes'](_0x5678d0,_0x254251[_0x8544('0x41')]['toLowerCase']());})){throw new db[(_0x8544('0x33'))][(_0x8544('0x37'))](_0x8544('0x42'));}}}var _0x17376f={};_0x17376f[_0x8544('0x43')]=_0x35dddd['body'][_0x8544('0x30')](_0x8544('0x43'))?_0x35dddd[_0x8544('0x2f')][_0x8544('0x43')]:_0x35dddd[_0x8544('0x44')][_0x8544('0x45')];_0x17376f[_0x8544('0x46')]=_['isEmpty'](_0x35dddd[_0x8544('0x2f')]['recipientsDescription'])?null:_0x35dddd['body'][_0x8544('0x46')];_0x17376f['beep']=_0x35dddd[_0x8544('0x2f')][_0x8544('0x47')]||![];_0x17376f[_0x8544('0x48')]=_0x35dddd['user']['id'];return getContent(_0x35dddd['body'])[_0x8544('0x29')](function(_0x328bd0){_0x17376f[_0x8544('0x2f')]=_0x328bd0;return getRecipients(_0x2e4b6c);})[_0x8544('0x29')](function(_0x4f1632){_0x17376f[_0x8544('0x49')]=_[_0x8544('0x4a')](_0x4f1632)[_0x8544('0x4b')](',');return db[_0x8544('0x4c')][_0x8544('0x4d')](function(_0x51d1f5){return db['UserNotification'][_0x8544('0x4e')](_0x17376f,{'raw':!![],'transaction':_0x51d1f5})['then'](function(_0x16d750){var _0x3d4ca7={'sender':_0x17376f[_0x8544('0x43')],'description':_0x17376f['recipientsDescription'],'content':_0x17376f[_0x8544('0x2f')],'beep':_0x17376f['beep']};_0x4f1632[_0x8544('0x4f')](function(_0x564370){_0x3d4ca7[_0x8544('0x50')]=_0x564370;socket[_0x8544('0x51')]('userNotification:send',_0x3d4ca7);});return _0x16d750;});});})[_0x8544('0x29')](respondWithResult(_0x117133,0xc9))[_0x8544('0x52')](handleError(_0x117133,null));};function getContent(_0x331077){return new BPromise(function(_0xa5b14b,_0x33c06b){if(_0x331077[_0x8544('0x31')]){_0xa5b14b(_0x331077['text']);return;}return db['Template']['findOne']({'attributes':[_0x8544('0x53')],'where':{'id':_0x331077[_0x8544('0x32')]},'raw':!![]})['then'](function(_0x156ad1){if(!_0x156ad1)throw new db[(_0x8544('0x33'))][(_0x8544('0x37'))](_0x8544('0x54'));var _0x37e0cf=Mustache[_0x8544('0x55')](_0x156ad1[_0x8544('0x53')],_0x331077['view']);_0xa5b14b(_0x37e0cf);})[_0x8544('0x52')](function(_0x1929f1){_0x33c06b(_0x1929f1);});});}function getRecipients(_0xbd050){return new BPromise(function(_0x32d6dd,_0x86d524){var _0x16da7c=[];var _0x10f5d1=[];_0xbd050[_0x8544('0x4f')](function(_0xe68cc8){var _0xd20a7e=_[_0x8544('0x56')](_0xe68cc8[_0x8544('0x41')]['toLowerCase']());if(_0xd20a7e===_0x8544('0x57')){_0x16da7c=_[_0x8544('0x58')](_0x16da7c,_0xe68cc8[_0x8544('0x59')]);}else{if(_[_0x8544('0x5a')](_0xd20a7e,_0x8544('0x5b')))_0xd20a7e=_0xd20a7e[_0x8544('0x5c')]('queue',_0x8544('0x5d'));_0xe68cc8[_0x8544('0x59')]['forEach'](function(_0x2c7a45){_0x10f5d1[_0x8544('0x5e')](getAgents(_0xd20a7e,_0x2c7a45));});}});return BPromise[_0x8544('0x5f')](_0x10f5d1)[_0x8544('0x29')](function(_0x17a811){_0x16da7c=_[_0x8544('0x58')](_0x16da7c,_[_0x8544('0x60')](_0x17a811));_0x32d6dd(_0x16da7c);})[_0x8544('0x52')](function(_0x57e115){_0x86d524(_0x57e115);});});}function getAgents(_0x105398,_0x300ee8){return new BPromise(function(_0x244d3e,_0xb597e4){return db[_0x105398][_0x8544('0x61')]({'where':{'id':_0x300ee8}})[_0x8544('0x29')](function(_0x4efc5d){return _0x4efc5d[_0x8544('0x62')]({'attributes':['id'],'raw':!![]})[_0x8544('0x29')](function(_0x42d91f){var _0x39a045=_[_0x8544('0x63')](_0x42d91f,'id');_0x244d3e(_0x39a045);});})[_0x8544('0x52')](function(_0x297b0b){_0xb597e4(_0x297b0b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e9e65d9..d3c481f 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 _0xf3c8=['update','emit','hasOwnProperty','hook','setMaxListeners','save'];(function(_0x100a3c,_0x56f6b9){var _0x27f991=function(_0x5a7dbf){while(--_0x5a7dbf){_0x100a3c['push'](_0x100a3c['shift']());}};_0x27f991(++_0x56f6b9);}(_0xf3c8,0x76));var _0x8f3c=function(_0x5f3525,_0x1f613f){_0x5f3525=_0x5f3525-0x0;var _0x203efd=_0xf3c8[_0x5f3525];return _0x203efd;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8f3c('0x0')](0x0);var events={'afterCreate':_0x8f3c('0x1'),'afterUpdate':_0x8f3c('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4d4848){return function(_0xb54cab,_0x312469,_0x1a000d){UserNotificationEvents[_0x8f3c('0x3')](_0x4d4848+':'+_0xb54cab['id'],_0xb54cab);UserNotificationEvents[_0x8f3c('0x3')](_0x4d4848,_0xb54cab);_0x1a000d(null);};}for(var e in events){if(events[_0x8f3c('0x4')](e)){var event=events[e];UserNotification[_0x8f3c('0x5')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xeb55=['hook','events','../../mysqldb','UserNotification','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x56fc1f,_0x23e840){var _0x2aea15=function(_0x5ee54f){while(--_0x5ee54f){_0x56fc1f['push'](_0x56fc1f['shift']());}};_0x2aea15(++_0x23e840);}(_0xeb55,0x1cc));var _0x5eb5=function(_0x245dbe,_0x3e0831){_0x245dbe=_0x245dbe-0x0;var _0x597415=_0xeb55[_0x245dbe];return _0x597415;};'use strict';var EventEmitter=require(_0x5eb5('0x0'));var UserNotification=require(_0x5eb5('0x1'))['db'][_0x5eb5('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5eb5('0x3')](0x0);var events={'afterCreate':_0x5eb5('0x4'),'afterUpdate':'update','afterDestroy':_0x5eb5('0x5')};function emitEvent(_0x1a0bb1){return function(_0x45b47b,_0x1c953f,_0xe3284c){UserNotificationEvents[_0x5eb5('0x6')](_0x1a0bb1+':'+_0x45b47b['id'],_0x45b47b);UserNotificationEvents[_0x5eb5('0x6')](_0x1a0bb1,_0x45b47b);_0xe3284c(null);};}for(var e in events){if(events[_0x5eb5('0x7')](e)){var event=events[e];UserNotification[_0x5eb5('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 974e3e3..e2da9d5 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 _0x5cc1=['./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x172feb,_0x4bb62f){var _0x5341af=function(_0x33392e){while(--_0x33392e){_0x172feb['push'](_0x172feb['shift']());}};_0x5341af(++_0x4bb62f);}(_0x5cc1,0xf5));var _0x15cc=function(_0x3c4adf,_0x958338){_0x3c4adf=_0x3c4adf-0x0;var _0x165a3b=_0x5cc1[_0x3c4adf];return _0x165a3b;};'use strict';var _=require('lodash');var util=require(_0x15cc('0x0'));var logger=require(_0x15cc('0x1'))(_0x15cc('0x2'));var moment=require(_0x15cc('0x3'));var BPromise=require(_0x15cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15cc('0x5'));var rimraf=require(_0x15cc('0x6'));var config=require('../../config/environment');var attributes=require(_0x15cc('0x7'));module[_0x15cc('0x8')]=function(_0x16f49c,_0x581c95){return _0x16f49c[_0x15cc('0x9')](_0x15cc('0xa'),attributes,{'tableName':_0x15cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x15cc('0xc'),'collate':_0x15cc('0xd')});}; \ No newline at end of file +var _0x0347=['moment','bluebird','request-promise','rimraf','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x4e3e48,_0x4ebb2e){var _0x5eda66=function(_0x15e187){while(--_0x15e187){_0x4e3e48['push'](_0x4e3e48['shift']());}};_0x5eda66(++_0x4ebb2e);}(_0x0347,0x1d8));var _0x7034=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0347[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7034('0x0'));var util=require(_0x7034('0x1'));var logger=require(_0x7034('0x2'))(_0x7034('0x3'));var moment=require(_0x7034('0x4'));var BPromise=require(_0x7034('0x5'));var rp=require(_0x7034('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7034('0x7'));var config=require('../../config/environment');var attributes=require(_0x7034('0x8'));module[_0x7034('0x9')]=function(_0x59b527,_0x54039a){return _0x59b527[_0x7034('0xa')]('UserNotification',attributes,{'tableName':_0x7034('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7034('0xc'),'collate':_0x7034('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 1c98b5a..3ecd4d2 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 _0x1702=['info','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then'];(function(_0x597646,_0x3b7fa5){var _0x3d2ee8=function(_0x8fe622){while(--_0x8fe622){_0x597646['push'](_0x597646['shift']());}};_0x3d2ee8(++_0x3b7fa5);}(_0x1702,0x8a));var _0x2170=function(_0x25b2ff,_0x3d6e20){_0x25b2ff=_0x25b2ff-0x0;var _0x2c4b56=_0x1702[_0x25b2ff];return _0x2c4b56;};'use strict';var _=require(_0x2170('0x0'));var util=require(_0x2170('0x1'));var moment=require('moment');var BPromise=require(_0x2170('0x2'));var rs=require(_0x2170('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2170('0x4'))['db'];var utils=require(_0x2170('0x5'));var logger=require('../../config/logger')(_0x2170('0x6'));var config=require(_0x2170('0x7'));var jayson=require(_0x2170('0x8'));var client=jayson[_0x2170('0x9')][_0x2170('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2170('0xb')],{'host':_0x2170('0xc'),'port':0x18eb});var socket=require(_0x2170('0xd'))(new Redis(config[_0x2170('0xb')]));require(_0x2170('0xe'))[_0x2170('0xf')](socket);function respondWithRpcPromise(_0x446601,_0x4e8f08,_0x948308){return new BPromise(function(_0x246f60,_0x59b79c){return client[_0x2170('0x10')](_0x446601,_0x948308)[_0x2170('0x11')](function(_0x1e9ba8){logger[_0x2170('0x12')](_0x2170('0x13'),_0x4e8f08,_0x2170('0x14'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x4e8f08,_0x2170('0x14'),JSON[_0x2170('0x15')](_0x1e9ba8));if(_0x1e9ba8[_0x2170('0x16')]){if(_0x1e9ba8[_0x2170('0x16')]['code']===0x1f4){logger[_0x2170('0x16')]('UserNotification,\x20%s,\x20%s',_0x4e8f08,_0x1e9ba8[_0x2170('0x16')][_0x2170('0x17')]);return _0x59b79c(_0x1e9ba8[_0x2170('0x16')][_0x2170('0x17')]);}logger[_0x2170('0x16')](_0x2170('0x13'),_0x4e8f08,_0x1e9ba8[_0x2170('0x16')][_0x2170('0x17')]);return _0x246f60(_0x1e9ba8['error'][_0x2170('0x17')]);}else{logger[_0x2170('0x12')](_0x2170('0x13'),_0x4e8f08,_0x2170('0x14'));_0x246f60(_0x1e9ba8[_0x2170('0x18')]['message']);}})[_0x2170('0x19')](function(_0x1fb736){logger[_0x2170('0x16')](_0x2170('0x13'),_0x4e8f08,_0x1fb736);_0x59b79c(_0x1fb736);});});} \ No newline at end of file +var _0x684f=['code','message','UserNotification,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x56e172,_0x59bedb){var _0xc92dd7=function(_0x4ae9ca){while(--_0x4ae9ca){_0x56e172['push'](_0x56e172['shift']());}};_0xc92dd7(++_0x59bedb);}(_0x684f,0x1e1));var _0xf684=function(_0x2aaa60,_0x4148dc){_0x2aaa60=_0x2aaa60-0x0;var _0x344bfc=_0x684f[_0x2aaa60];return _0x344bfc;};'use strict';var _=require(_0xf684('0x0'));var util=require(_0xf684('0x1'));var moment=require(_0xf684('0x2'));var BPromise=require('bluebird');var rs=require(_0xf684('0x3'));var fs=require('fs');var Redis=require(_0xf684('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf684('0x5'));var logger=require(_0xf684('0x6'))(_0xf684('0x7'));var config=require(_0xf684('0x8'));var jayson=require(_0xf684('0x9'));var client=jayson[_0xf684('0xa')][_0xf684('0xb')]({'port':0x232a});config[_0xf684('0xc')]=_[_0xf684('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf684('0xe'))(new Redis(config[_0xf684('0xc')]));require(_0xf684('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b7f75,_0x673a19,_0xf45c6f){return new BPromise(function(_0x1b86b0,_0x4e799d){return client[_0xf684('0x10')](_0x5b7f75,_0xf45c6f)[_0xf684('0x11')](function(_0x485eb9){logger[_0xf684('0x12')]('UserNotification,\x20%s,\x20%s',_0x673a19,'request\x20sent');logger['debug'](_0xf684('0x13'),_0x673a19,_0xf684('0x14'),JSON[_0xf684('0x15')](_0x485eb9));if(_0x485eb9[_0xf684('0x16')]){if(_0x485eb9[_0xf684('0x16')][_0xf684('0x17')]===0x1f4){logger[_0xf684('0x16')]('UserNotification,\x20%s,\x20%s',_0x673a19,_0x485eb9[_0xf684('0x16')][_0xf684('0x18')]);return _0x4e799d(_0x485eb9[_0xf684('0x16')][_0xf684('0x18')]);}logger[_0xf684('0x16')](_0xf684('0x19'),_0x673a19,_0x485eb9[_0xf684('0x16')][_0xf684('0x18')]);return _0x1b86b0(_0x485eb9[_0xf684('0x16')][_0xf684('0x18')]);}else{logger[_0xf684('0x12')](_0xf684('0x19'),_0x673a19,'request\x20sent');_0x1b86b0(_0x485eb9[_0xf684('0x1a')][_0xf684('0x18')]);}})[_0xf684('0x1b')](function(_0x40e221){logger[_0xf684('0x16')](_0xf684('0x19'),_0x673a19,_0x40e221);_0x4e799d(_0x40e221);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index a60f70a..44274a0 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 _0x559b=['length','save','remove','update'];(function(_0x515e2b,_0xb4a2b5){var _0xc74bef=function(_0x43d02b){while(--_0x43d02b){_0x515e2b['push'](_0x515e2b['shift']());}};_0xc74bef(++_0xb4a2b5);}(_0x559b,0x17d));var _0xb559=function(_0x3f4600,_0x4845eb){_0x3f4600=_0x3f4600-0x0;var _0x34cf20=_0x559b[_0x3f4600];return _0x34cf20;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xb559('0x0'),_0xb559('0x1'),_0xb559('0x2')];function createListener(_0x309fe8,_0xaf07fc){return function(_0x43a254){_0xaf07fc['emit'](_0x309fe8,_0x43a254);};}function removeListener(_0x542d0c,_0x31fa5d){return function(){UserNotificationEvents['removeListener'](_0x542d0c,_0x31fa5d);};}exports['register']=function(_0xd3a0e){for(var _0x2e3aad=0x0,_0x3f9e59=events[_0xb559('0x3')];_0x2e3aad<_0x3f9e59;_0x2e3aad++){var _0x2f6d44=events[_0x2e3aad];var _0x519ec0=createListener('userNotification:'+_0x2f6d44,_0xd3a0e);UserNotificationEvents['on'](_0x2f6d44,_0x519ec0);}}; \ No newline at end of file +var _0xcda2=['remove','emit','register','length','userNotification:','./userNotification.events','save'];(function(_0x441dd4,_0x582db9){var _0x54ea8b=function(_0x308f42){while(--_0x308f42){_0x441dd4['push'](_0x441dd4['shift']());}};_0x54ea8b(++_0x582db9);}(_0xcda2,0x9f));var _0x2cda=function(_0x328ac9,_0x2f7225){_0x328ac9=_0x328ac9-0x0;var _0x2b3a0a=_0xcda2[_0x328ac9];return _0x2b3a0a;};'use strict';var UserNotificationEvents=require(_0x2cda('0x0'));var events=[_0x2cda('0x1'),_0x2cda('0x2'),'update'];function createListener(_0x4e8dba,_0x5e7b3f){return function(_0x56af98){_0x5e7b3f[_0x2cda('0x3')](_0x4e8dba,_0x56af98);};}function removeListener(_0x2693d0,_0x5c6b3c){return function(){UserNotificationEvents['removeListener'](_0x2693d0,_0x5c6b3c);};}exports[_0x2cda('0x4')]=function(_0x20adc9){for(var _0xfc0daa=0x0,_0x445212=events[_0x2cda('0x5')];_0xfc0daa<_0x445212;_0xfc0daa++){var _0x11d999=events[_0xfc0daa];var _0x3ae1b5=createListener(_0x2cda('0x6')+_0x11d999,_0x20adc9);UserNotificationEvents['on'](_0x11d999,_0x3ae1b5);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index cd1fc17..8ee24fd 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(_0x34c6be,_0x5648bc){var _0x22006f=function(_0x3a0282){while(--_0x3a0282){_0x34c6be['push'](_0x34c6be['shift']());}};_0x22006f(++_0x5648bc);}(_0x70e0,0x17b));var _0x070e=function(_0x3843c5,_0xd1aff1){_0x3843c5=_0x3843c5-0x0;var _0x2bba6f=_0x70e0[_0x3843c5];return _0x2bba6f;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xbb9492,_0xad1af1){var _0x5e401a=function(_0x136740){while(--_0x136740){_0xbb9492['push'](_0xbb9492['shift']());}};_0x5e401a(++_0xad1af1);}(_0xedd9,0xfc));var _0x9edd=function(_0x53bdbb,_0x631e8){_0x53bdbb=_0x53bdbb-0x0;var _0x1398b1=_0xedd9[_0x53bdbb];return _0x1398b1;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 8b685e4..38bc941 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 _0x3ad5=['INTEGER','sequelize'];(function(_0x2e3ec2,_0x10a7cf){var _0x1e4363=function(_0x4cf5fb){while(--_0x4cf5fb){_0x2e3ec2['push'](_0x2e3ec2['shift']());}};_0x1e4363(++_0x10a7cf);}(_0x3ad5,0x151));var _0x53ad=function(_0x4118ab,_0x25759d){_0x4118ab=_0x4118ab-0x0;var _0x5a0c8c=_0x3ad5[_0x4118ab];return _0x5a0c8c;};'use strict';var Sequelize=require(_0x53ad('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x53ad('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe2ac=['sequelize','exports','INTEGER'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0xe2ac,0xfc));var _0xce2a=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xe2ac[_0x1ab0e6];return _0x248815;};'use strict';var Sequelize=require(_0xce2a('0x0'));module[_0xce2a('0x1')]={'penalty':{'type':Sequelize[_0xce2a('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 a9d81e9..1055239 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 _0x35c2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x42b4b4,_0x145ed9){var _0xc3d5ff=function(_0x2e0ea7){while(--_0x2e0ea7){_0x42b4b4['push'](_0x42b4b4['shift']());}};_0xc3d5ff(++_0x145ed9);}(_0x35c2,0x1ad));var _0x235c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x35c2[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x235c('0x0'));var util=require(_0x235c('0x1'));var logger=require(_0x235c('0x2'))(_0x235c('0x3'));var moment=require('moment');var BPromise=require(_0x235c('0x4'));var rp=require(_0x235c('0x5'));var fs=require('fs');var path=require(_0x235c('0x6'));var rimraf=require(_0x235c('0x7'));var config=require('../../config/environment');var attributes=require(_0x235c('0x8'));module['exports']=function(_0x4aefac,_0x75edaf){return _0x4aefac['define'](_0x235c('0x9'),attributes,{'tableName':_0x235c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfafb=['UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes'];(function(_0x1230e9,_0x27ce36){var _0x194a09=function(_0x4cd12f){while(--_0x4cd12f){_0x1230e9['push'](_0x1230e9['shift']());}};_0x194a09(++_0x27ce36);}(_0xfafb,0x8e));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbfaf('0x0'));var logger=require(_0xbfaf('0x1'))('api');var moment=require(_0xbfaf('0x2'));var BPromise=require(_0xbfaf('0x3'));var rp=require(_0xbfaf('0x4'));var fs=require('fs');var path=require(_0xbfaf('0x5'));var rimraf=require(_0xbfaf('0x6'));var config=require('../../config/environment');var attributes=require(_0xbfaf('0x7'));module['exports']=function(_0x413e2e,_0x402855){return _0x413e2e['define'](_0xbfaf('0x8'),attributes,{'tableName':_0xbfaf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 34c052c..96d9eba 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 _0xb718=['http','info','request\x20sent','debug','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x124325,_0x40d0c7){var _0x2d0006=function(_0x137af9){while(--_0x137af9){_0x124325['push'](_0x124325['shift']());}};_0x2d0006(++_0x40d0c7);}(_0xb718,0x1ee));var _0x8b71=function(_0x5c2f5c,_0x2632d7){_0x5c2f5c=_0x5c2f5c-0x0;var _0x230e26=_0xb718[_0x5c2f5c];return _0x230e26;};'use strict';var _=require(_0x8b71('0x0'));var util=require(_0x8b71('0x1'));var moment=require(_0x8b71('0x2'));var BPromise=require(_0x8b71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b71('0x4'));var db=require(_0x8b71('0x5'))['db'];var utils=require(_0x8b71('0x6'));var logger=require(_0x8b71('0x7'))('rpc');var config=require(_0x8b71('0x8'));var jayson=require(_0x8b71('0x9'));var client=jayson['client'][_0x8b71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31dd76,_0x28ceb5,_0x1849b6){return new BPromise(function(_0x3e0f18,_0x27f57a){return client['request'](_0x31dd76,_0x1849b6)['then'](function(_0x21a25f){logger[_0x8b71('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x28ceb5,_0x8b71('0xc'));logger[_0x8b71('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x28ceb5,'request\x20sent',JSON[_0x8b71('0xe')](_0x21a25f));if(_0x21a25f[_0x8b71('0xf')]){if(_0x21a25f[_0x8b71('0xf')][_0x8b71('0x10')]===0x1f4){logger[_0x8b71('0xf')](_0x8b71('0x11'),_0x28ceb5,_0x21a25f[_0x8b71('0xf')][_0x8b71('0x12')]);return _0x27f57a(_0x21a25f[_0x8b71('0xf')][_0x8b71('0x12')]);}logger[_0x8b71('0xf')](_0x8b71('0x11'),_0x28ceb5,_0x21a25f[_0x8b71('0xf')][_0x8b71('0x12')]);return _0x3e0f18(_0x21a25f[_0x8b71('0xf')][_0x8b71('0x12')]);}else{logger[_0x8b71('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x28ceb5,'request\x20sent');_0x3e0f18(_0x21a25f[_0x8b71('0x13')][_0x8b71('0x12')]);}})[_0x8b71('0x14')](function(_0x144130){logger[_0x8b71('0xf')](_0x8b71('0x11'),_0x28ceb5,_0x144130);_0x27f57a(_0x144130);});});} \ No newline at end of file +var _0xf8ae=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x285b13,_0x448696){var _0x53b0da=function(_0x28bd70){while(--_0x28bd70){_0x285b13['push'](_0x285b13['shift']());}};_0x53b0da(++_0x448696);}(_0xf8ae,0x1df));var _0xef8a=function(_0x3cba1d,_0x2825ae){_0x3cba1d=_0x3cba1d-0x0;var _0x5f192b=_0xf8ae[_0x3cba1d];return _0x5f192b;};'use strict';var _=require(_0xef8a('0x0'));var util=require(_0xef8a('0x1'));var moment=require(_0xef8a('0x2'));var BPromise=require(_0xef8a('0x3'));var rs=require(_0xef8a('0x4'));var fs=require('fs');var Redis=require(_0xef8a('0x5'));var db=require(_0xef8a('0x6'))['db'];var utils=require(_0xef8a('0x7'));var logger=require(_0xef8a('0x8'))(_0xef8a('0x9'));var config=require('../../config/environment');var jayson=require(_0xef8a('0xa'));var client=jayson[_0xef8a('0xb')][_0xef8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ec4dc,_0x5b72a2,_0x37c90f){return new BPromise(function(_0x54a7c8,_0x32f4a7){return client[_0xef8a('0xd')](_0x2ec4dc,_0x37c90f)[_0xef8a('0xe')](function(_0x29ab8b){logger[_0xef8a('0xf')](_0xef8a('0x10'),_0x5b72a2,_0xef8a('0x11'));logger[_0xef8a('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5b72a2,_0xef8a('0x11'),JSON[_0xef8a('0x13')](_0x29ab8b));if(_0x29ab8b[_0xef8a('0x14')]){if(_0x29ab8b[_0xef8a('0x14')][_0xef8a('0x15')]===0x1f4){logger['error'](_0xef8a('0x10'),_0x5b72a2,_0x29ab8b[_0xef8a('0x14')][_0xef8a('0x16')]);return _0x32f4a7(_0x29ab8b[_0xef8a('0x14')]['message']);}logger[_0xef8a('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5b72a2,_0x29ab8b[_0xef8a('0x14')][_0xef8a('0x16')]);return _0x54a7c8(_0x29ab8b['error'][_0xef8a('0x16')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5b72a2,_0xef8a('0x11'));_0x54a7c8(_0x29ab8b[_0xef8a('0x17')][_0xef8a('0x16')]);}})[_0xef8a('0x18')](function(_0x11f5d1){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5b72a2,_0x11f5d1);_0x32f4a7(_0x11f5d1);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ebbbe08..9e2ace8 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 _0x5296=['isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','/:id/resources','post','/:id/clone','clone','addSections','put','update','delete','removeSections','removeResources','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get'];(function(_0x58073,_0x5d320d){var _0x37d3f7=function(_0x2a7651){while(--_0x2a7651){_0x58073['push'](_0x58073['shift']());}};_0x37d3f7(++_0x5d320d);}(_0x5296,0x17d));var _0x6529=function(_0x19ec18,_0x19fa22){_0x19ec18=_0x19ec18-0x0;var _0x13ceca=_0x5296[_0x19ec18];return _0x13ceca;};'use strict';var multer=require(_0x6529('0x0'));var util=require(_0x6529('0x1'));var path=require(_0x6529('0x2'));var timeout=require(_0x6529('0x3'));var express=require(_0x6529('0x4'));var router=express['Router']();var fs_extra=require(_0x6529('0x5'));var auth=require(_0x6529('0x6'));var interaction=require(_0x6529('0x7'));var config=require(_0x6529('0x8'));var controller=require(_0x6529('0x9'));router[_0x6529('0xa')]('/',auth[_0x6529('0xb')](),controller[_0x6529('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6529('0xd')]);router['get'](_0x6529('0xe'),auth[_0x6529('0xb')](),controller[_0x6529('0xf')]);router[_0x6529('0xa')](_0x6529('0x10'),auth[_0x6529('0xb')](),controller[_0x6529('0x11')]);router[_0x6529('0xa')](_0x6529('0x12'),auth['isAuthenticated'](),controller['getResources']);router[_0x6529('0x13')]('/',auth[_0x6529('0xb')](),controller['create']);router[_0x6529('0x13')](_0x6529('0x14'),auth['isAuthenticated'](),controller[_0x6529('0x15')]);router[_0x6529('0x13')](_0x6529('0x10'),auth[_0x6529('0xb')](),controller[_0x6529('0x16')]);router[_0x6529('0x13')](_0x6529('0x12'),auth[_0x6529('0xb')](),controller['addResources']);router[_0x6529('0x17')](_0x6529('0xe'),auth[_0x6529('0xb')](),controller[_0x6529('0x18')]);router[_0x6529('0x19')](_0x6529('0xe'),auth[_0x6529('0xb')](),controller['destroy']);router[_0x6529('0x19')](_0x6529('0x10'),auth[_0x6529('0xb')](),controller[_0x6529('0x1a')]);router[_0x6529('0x19')](_0x6529('0x12'),auth[_0x6529('0xb')](),controller[_0x6529('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa536=['/:id/sections','getSections','post','/:id/clone','addSections','addResources','update','delete','destroy','/:id/resources','removeResources','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0xcbd7ae,_0x60d37d){var _0x334d47=function(_0x29ffa8){while(--_0x29ffa8){_0xcbd7ae['push'](_0xcbd7ae['shift']());}};_0x334d47(++_0x60d37d);}(_0xa536,0x73));var _0x6a53=function(_0x45c982,_0x15739a){_0x45c982=_0x45c982-0x0;var _0x552646=_0xa536[_0x45c982];return _0x552646;};'use strict';var multer=require(_0x6a53('0x0'));var util=require(_0x6a53('0x1'));var path=require(_0x6a53('0x2'));var timeout=require(_0x6a53('0x3'));var express=require(_0x6a53('0x4'));var router=express[_0x6a53('0x5')]();var fs_extra=require(_0x6a53('0x6'));var auth=require(_0x6a53('0x7'));var interaction=require(_0x6a53('0x8'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x6a53('0x9')]('/',auth['isAuthenticated'](),controller[_0x6a53('0xa')]);router[_0x6a53('0x9')](_0x6a53('0xb'),auth[_0x6a53('0xc')](),controller[_0x6a53('0xd')]);router[_0x6a53('0x9')](_0x6a53('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6a53('0x9')](_0x6a53('0xf'),auth[_0x6a53('0xc')](),controller[_0x6a53('0x10')]);router[_0x6a53('0x9')]('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router[_0x6a53('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6a53('0x11')](_0x6a53('0x12'),auth[_0x6a53('0xc')](),controller['clone']);router[_0x6a53('0x11')](_0x6a53('0xf'),auth[_0x6a53('0xc')](),controller[_0x6a53('0x13')]);router[_0x6a53('0x11')]('/:id/resources',auth[_0x6a53('0xc')](),controller[_0x6a53('0x14')]);router['put'](_0x6a53('0xe'),auth[_0x6a53('0xc')](),controller[_0x6a53('0x15')]);router[_0x6a53('0x16')](_0x6a53('0xe'),auth[_0x6a53('0xc')](),controller[_0x6a53('0x17')]);router[_0x6a53('0x16')](_0x6a53('0xf'),auth[_0x6a53('0xc')](),controller['removeSections']);router[_0x6a53('0x16')](_0x6a53('0x18'),auth[_0x6a53('0xc')](),controller[_0x6a53('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index bb6858b..b88bfed 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 _0x05d1=['crudPermissions','join','getDataValue','BOOLEAN','sequelize','exports','name','STRING'];(function(_0x593e2c,_0x4858de){var _0x2e7cb2=function(_0xeb0a19){while(--_0xeb0a19){_0x593e2c['push'](_0x593e2c['shift']());}};_0x2e7cb2(++_0x4858de);}(_0x05d1,0x14c));var _0x105d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x05d1[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x105d('0x0'));module[_0x105d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x105d('0x2')},'crudPermissions':{'type':Sequelize[_0x105d('0x3')],'set':function(_0x22e0b6){this['setDataValue'](_0x105d('0x4'),_0x22e0b6?_0x22e0b6[_0x105d('0x5')](''):[]);},'get':function(){return this[_0x105d('0x6')](_0x105d('0x4'))?this[_0x105d('0x6')](_0x105d('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x105d('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x105d('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x105d('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x105d('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x105d('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x105d('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9724=['sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x4e881d,_0x129963){var _0x321e0d=function(_0x2b2340){while(--_0x2b2340){_0x4e881d['push'](_0x4e881d['shift']());}};_0x321e0d(++_0x129963);}(_0x9724,0x8c));var _0x4972=function(_0xa32065,_0x482469){_0xa32065=_0xa32065-0x0;var _0x182cde=_0x9724[_0xa32065];return _0x182cde;};'use strict';var Sequelize=require(_0x4972('0x0'));module[_0x4972('0x1')]={'name':{'type':Sequelize[_0x4972('0x2')],'allowNull':![],'unique':_0x4972('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x254f04){this[_0x4972('0x4')](_0x4972('0x5'),_0x254f04?_0x254f04[_0x4972('0x6')](''):[]);},'get':function(){return this[_0x4972('0x7')]('crudPermissions')?this[_0x4972('0x7')](_0x4972('0x5'))[_0x4972('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4972('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 086c4d4..c3d5b36 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 _0x1b32=['../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','./userProfile.socket','register','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','params','find','create','body','catch','get','updatedAt','omit','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','push','removeSections','ids','getSections','enabled','includes','subsections','concat','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','moment','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x1b32,0x1a6));var _0x21b3=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x1b32[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0x21b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21b3('0x1'));var jsonpatch=require(_0x21b3('0x2'));var rp=require('request-promise');var moment=require(_0x21b3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x21b3('0x4'));var util=require('util');var path=require(_0x21b3('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x21b3('0x6'));var fs=require('fs');var fs_extra=require(_0x21b3('0x7'));var _=require(_0x21b3('0x8'));var squel=require(_0x21b3('0x9'));var crypto=require('crypto');var jsforce=require(_0x21b3('0xa'));var deskjs=require(_0x21b3('0xb'));var toCsv=require(_0x21b3('0xc'));var querystring=require(_0x21b3('0xd'));var Papa=require(_0x21b3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x21b3('0xf'));var as=require(_0x21b3('0x10'));var hardwareService=require(_0x21b3('0x11'));var logger=require(_0x21b3('0x12'))(_0x21b3('0x13'));var utils=require(_0x21b3('0x14'));var config=require(_0x21b3('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x21b3('0x16')]=_['defaults'](config['redis'],{'host':_0x21b3('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x21b3('0x18'))[_0x21b3('0x19')](socket);function respondWithStatusCode(_0xee1787,_0x263d2f){_0x263d2f=_0x263d2f||0xcc;return function(_0x241035){if(_0x241035){return _0xee1787['sendStatus'](_0x263d2f);}return _0xee1787['status'](_0x263d2f)[_0x21b3('0x1a')]();};}function respondWithResult(_0x12221b,_0x30b9be){_0x30b9be=_0x30b9be||0xc8;return function(_0x385e0a){if(_0x385e0a){return _0x12221b['status'](_0x30b9be)[_0x21b3('0x1b')](_0x385e0a);}};}function respondWithFilteredResult(_0x1ff0f0,_0x197969){return function(_0x5c072a){if(_0x5c072a){var _0x12985b=typeof _0x197969[_0x21b3('0x1c')]===_0x21b3('0x1d')&&typeof _0x197969[_0x21b3('0x1e')]==='undefined';var _0x3d61f1=_0x5c072a[_0x21b3('0x1f')];var _0x40f51c=_0x12985b?0x0:_0x197969[_0x21b3('0x1c')];var _0x49b51a=_0x12985b?_0x5c072a[_0x21b3('0x1f')]:_0x197969[_0x21b3('0x1c')]+_0x197969[_0x21b3('0x1e')];var _0x3cda83;if(_0x49b51a>=_0x3d61f1){_0x49b51a=_0x3d61f1;_0x3cda83=0xc8;}else{_0x3cda83=0xce;}_0x1ff0f0[_0x21b3('0x20')](_0x3cda83);return _0x1ff0f0[_0x21b3('0x21')](_0x21b3('0x22'),_0x40f51c+'-'+_0x49b51a+'/'+_0x3d61f1)[_0x21b3('0x1b')](_0x5c072a);}return null;};}function patchUpdates(_0x1fe03b){return function(_0x47b95d){try{jsonpatch[_0x21b3('0x23')](_0x47b95d,_0x1fe03b,!![]);}catch(_0x4d0970){return BPromise[_0x21b3('0x24')](_0x4d0970);}return _0x47b95d[_0x21b3('0x25')]();};}function saveUpdates(_0x32d85b,_0x341208){return function(_0x124bf2){if(_0x124bf2){return _0x124bf2['update'](_0x32d85b)[_0x21b3('0x26')](function(_0x444249){return _0x444249;});}return null;};}function removeEntity(_0x394359,_0x52ef32){return function(_0x54198e){if(_0x54198e){return _0x54198e[_0x21b3('0x27')]()[_0x21b3('0x26')](function(){_0x394359['status'](0xcc)[_0x21b3('0x1a')]();});}};}function handleEntityNotFound(_0x15d317,_0x1e9b9c){return function(_0x35e8d5){if(!_0x35e8d5){_0x15d317[_0x21b3('0x28')](0x194);}return _0x35e8d5;};}function handleError(_0xf01b3a,_0x36724f){_0x36724f=_0x36724f||0x1f4;return function(_0x36c325){logger['error'](_0x36c325[_0x21b3('0x29')]);if(_0x36c325[_0x21b3('0x2a')]){delete _0x36c325[_0x21b3('0x2a')];}_0xf01b3a['status'](_0x36724f)[_0x21b3('0x2b')](_0x36c325);};}exports[_0x21b3('0x2c')]=function(_0x4c312b,_0xdb59bc){var _0x398dd2={},_0x8250dc={},_0x4a9d43={'count':0x0,'rows':[]};var _0x4d77c8=_['map'](db[_0x21b3('0x2d')][_0x21b3('0x2e')],function(_0x1e9999){return{'name':_0x1e9999[_0x21b3('0x2f')],'type':_0x1e9999[_0x21b3('0x30')][_0x21b3('0x31')]};});_0x8250dc[_0x21b3('0x32')]=_['map'](_0x4d77c8,_0x21b3('0x2a'));_0x8250dc[_0x21b3('0x33')]=_[_0x21b3('0x34')](_0x4c312b[_0x21b3('0x33')]);_0x8250dc[_0x21b3('0x35')]=_[_0x21b3('0x36')](_0x8250dc[_0x21b3('0x32')],_0x8250dc[_0x21b3('0x33')]);_0x398dd2[_0x21b3('0x37')]=_['intersection'](_0x8250dc[_0x21b3('0x32')],qs[_0x21b3('0x38')](_0x4c312b[_0x21b3('0x33')]['fields']));_0x398dd2[_0x21b3('0x37')]=_0x398dd2[_0x21b3('0x37')][_0x21b3('0x39')]?_0x398dd2[_0x21b3('0x37')]:_0x8250dc[_0x21b3('0x32')];if(!_0x4c312b['query'][_0x21b3('0x3a')](_0x21b3('0x3b'))){_0x398dd2['limit']=qs[_0x21b3('0x1e')](_0x4c312b['query'][_0x21b3('0x1e')]);_0x398dd2[_0x21b3('0x1c')]=qs['offset'](_0x4c312b[_0x21b3('0x33')][_0x21b3('0x1c')]);}_0x398dd2[_0x21b3('0x3c')]=qs[_0x21b3('0x3d')](_0x4c312b['query'][_0x21b3('0x3d')]);_0x398dd2[_0x21b3('0x3e')]=qs[_0x21b3('0x35')](_[_0x21b3('0x3f')](_0x4c312b[_0x21b3('0x33')],_0x8250dc[_0x21b3('0x35')]),_0x4d77c8);if(_0x4c312b[_0x21b3('0x33')][_0x21b3('0x40')]){_0x398dd2[_0x21b3('0x3e')]=_[_0x21b3('0x41')](_0x398dd2[_0x21b3('0x3e')],{'$or':_[_0x21b3('0x42')](_0x4d77c8,function(_0x139a27){if(_0x139a27[_0x21b3('0x30')]!==_0x21b3('0x43')){var _0xaa65f2={};_0xaa65f2[_0x139a27[_0x21b3('0x2a')]]={'$like':'%'+_0x4c312b[_0x21b3('0x33')][_0x21b3('0x40')]+'%'};return _0xaa65f2;}})});}_0x398dd2=_[_0x21b3('0x41')]({},_0x398dd2,_0x4c312b[_0x21b3('0x44')]);var _0x47b4ba={'where':_0x398dd2[_0x21b3('0x3e')]};return db[_0x21b3('0x2d')][_0x21b3('0x1f')](_0x47b4ba)[_0x21b3('0x26')](function(_0x535e0e){_0x4a9d43[_0x21b3('0x1f')]=_0x535e0e;if(_0x4c312b[_0x21b3('0x33')][_0x21b3('0x45')]){_0x398dd2[_0x21b3('0x46')]=[{'all':!![]}];}return db[_0x21b3('0x2d')][_0x21b3('0x47')](_0x398dd2);})[_0x21b3('0x26')](function(_0xed7a52){_0x4a9d43['rows']=_0xed7a52;return _0x4a9d43;})[_0x21b3('0x26')](respondWithFilteredResult(_0xdb59bc,_0x398dd2))['catch'](handleError(_0xdb59bc,null));};exports['show']=function(_0x45380e,_0x414a7b){var _0x394203={'raw':![],'where':{'id':_0x45380e[_0x21b3('0x48')]['id']}},_0xff61d4={};_0xff61d4[_0x21b3('0x32')]=_[_0x21b3('0x34')](db[_0x21b3('0x2d')][_0x21b3('0x2e')]);_0xff61d4['query']=_[_0x21b3('0x34')](_0x45380e[_0x21b3('0x33')]);_0xff61d4['filters']=_[_0x21b3('0x36')](_0xff61d4[_0x21b3('0x32')],_0xff61d4[_0x21b3('0x33')]);_0x394203[_0x21b3('0x37')]=_[_0x21b3('0x36')](_0xff61d4[_0x21b3('0x32')],qs[_0x21b3('0x38')](_0x45380e[_0x21b3('0x33')][_0x21b3('0x38')]));_0x394203['attributes']=_0x394203[_0x21b3('0x37')][_0x21b3('0x39')]?_0x394203['attributes']:_0xff61d4['model'];if(_0x45380e['query'][_0x21b3('0x45')]){_0x394203[_0x21b3('0x46')]=[{'all':!![]}];}_0x394203=_[_0x21b3('0x41')]({},_0x394203,_0x45380e[_0x21b3('0x44')]);return db[_0x21b3('0x2d')][_0x21b3('0x49')](_0x394203)[_0x21b3('0x26')](handleEntityNotFound(_0x414a7b,null))[_0x21b3('0x26')](respondWithResult(_0x414a7b,null))['catch'](handleError(_0x414a7b,null));};exports[_0x21b3('0x4a')]=function(_0x401162,_0x336d6b){return db[_0x21b3('0x2d')][_0x21b3('0x4a')](_0x401162[_0x21b3('0x4b')],{})[_0x21b3('0x26')](respondWithResult(_0x336d6b,0xc9))[_0x21b3('0x4c')](handleError(_0x336d6b,null));};exports['clone']=function(_0xa07276,_0x54cdcf){var _0xc6714d={'where':{'id':_0xa07276[_0x21b3('0x48')]['id']}},_0x2a66f3={};_0x2a66f3[_0x21b3('0x32')]=_[_0x21b3('0x34')](db[_0x21b3('0x2d')][_0x21b3('0x2e')]);_0xc6714d[_0x21b3('0x37')]=_[_0x21b3('0x36')](_0x2a66f3[_0x21b3('0x32')],qs['fields'](_0xa07276[_0x21b3('0x33')][_0x21b3('0x38')]));_0xc6714d[_0x21b3('0x37')]=_0xc6714d[_0x21b3('0x37')][_0x21b3('0x39')]?_0xc6714d[_0x21b3('0x37')]:_0x2a66f3[_0x21b3('0x32')];if(_0xa07276[_0x21b3('0x33')][_0x21b3('0x45')]){_0xc6714d[_0x21b3('0x46')]=[{'all':!![]}];}_0xc6714d=_['merge']({},_0xc6714d,_0xa07276[_0x21b3('0x44')]);return db[_0x21b3('0x2d')][_0x21b3('0x49')](_0xc6714d)[_0x21b3('0x26')](handleEntityNotFound(_0x54cdcf,null))[_0x21b3('0x26')](function(_0x22a982){if(_0x22a982){var _0x412c1d=_0x22a982[_0x21b3('0x4d')]({'plain':!![]});_0x412c1d=qs['omit'](_0x412c1d,['id','createdAt',_0x21b3('0x4e'),'crudPermissions']);_0xa07276[_0x21b3('0x4b')]=_[_0x21b3('0x4f')](_0xa07276['body'],['id',_0x21b3('0x50'),_0x21b3('0x4e')]);return db[_0x21b3('0x51')][_0x21b3('0x52')](function(_0x45b0cc){return db[_0x21b3('0x2d')]['create'](_[_0x21b3('0x41')](_0x412c1d,_0xa07276[_0x21b3('0x4b')]),{'include':_0xa07276[_0x21b3('0x33')][_0x21b3('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x45b0cc})['then'](function(_0x5ba2e2){var _0x210961=_0x5ba2e2[_0x21b3('0x4d')]({'plain':!![]});return db[_0x21b3('0x53')][_0x21b3('0x47')]({'where':{'userProfileId':_0xa07276['params']['id']},'raw':!![]})['then'](function(_0xc6ec17){if(_0xc6ec17){return BPromise[_0x21b3('0x54')](_0xc6ec17,function(_0x54d676){return new BPromise(function(_0x5f0834,_0x272ab8){if(_0x54d676[_0x21b3('0x55')]===null||_0x54d676[_0x21b3('0x55')]===0x1)_0x5f0834(null);return db[_0x21b3('0x56')][_0x21b3('0x47')]({'where':{'sectionId':_0x54d676['id']},'raw':!![]})[_0x21b3('0x26')](function(_0x84ff6a){var _0x49dd00=_[_0x21b3('0x42')](_0x84ff6a,function(_0x21e788){return qs[_0x21b3('0x4f')](_0x21e788,['id','createdAt',_0x21b3('0x4e'),_0x21b3('0x57')]);});_0x5f0834(_0x49dd00);})[_0x21b3('0x4c')](function(_0x1beca9){_0x272ab8(_0x1beca9);});})[_0x21b3('0x26')](function(_0x3b01aa){var _0x44a819=qs[_0x21b3('0x4f')](_0x54d676,['id',_0x21b3('0x50'),_0x21b3('0x4e')]);_0x44a819[_0x21b3('0x58')]=_0x210961['id'];if(_0x3b01aa)_0x44a819['Resources']=_0x3b01aa;return _0x44a819;})['then'](function(_0x3244a0){return db[_0x21b3('0x53')]['create'](_0x3244a0,{'include':[{'model':db[_0x21b3('0x56')],'as':_0x21b3('0x59')}],'raw':!![],'transaction':_0x45b0cc});});})[_0x21b3('0x26')](function(){return _0x210961;});}});});});}})[_0x21b3('0x26')](respondWithResult(_0x54cdcf,0xc9))[_0x21b3('0x4c')](handleError(_0x54cdcf,null));};exports[_0x21b3('0x5a')]=function(_0x1daed7,_0x557e2b){if(_0x1daed7[_0x21b3('0x4b')]['id']){delete _0x1daed7[_0x21b3('0x4b')]['id'];}return db[_0x21b3('0x2d')]['find']({'where':{'id':_0x1daed7[_0x21b3('0x48')]['id']}})[_0x21b3('0x26')](handleEntityNotFound(_0x557e2b,null))[_0x21b3('0x26')](saveUpdates(_0x1daed7[_0x21b3('0x4b')],null))[_0x21b3('0x26')](respondWithResult(_0x557e2b,null))[_0x21b3('0x4c')](handleError(_0x557e2b,null));};exports[_0x21b3('0x27')]=function(_0x208881,_0x4b89a0){return db['UserProfile'][_0x21b3('0x49')]({'where':{'id':_0x208881[_0x21b3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b89a0,null))[_0x21b3('0x26')](removeEntity(_0x4b89a0,null))[_0x21b3('0x4c')](handleError(_0x4b89a0,null));};exports[_0x21b3('0x5b')]=function(_0x5c2de9,_0x292f26){return db[_0x21b3('0x2d')]['describe']()[_0x21b3('0x26')](respondWithResult(_0x292f26,null))['catch'](handleError(_0x292f26,null));};exports[_0x21b3('0x5c')]=function(_0x944939,_0x254624){var _0x459a67=_0x944939[_0x21b3('0x4b')];return db[_0x21b3('0x2d')]['find']({'where':{'id':_0x944939['params']['id']}})[_0x21b3('0x26')](handleEntityNotFound(_0x254624,null))[_0x21b3('0x26')](function(_0x32d0b2){if(_0x32d0b2){return db[_0x21b3('0x51')][_0x21b3('0x52')](function(_0x12d6d8){return db[_0x21b3('0x53')]['destroy']({'where':{'userProfileId':_0x944939[_0x21b3('0x48')]['id'],'sectionId':_[_0x21b3('0x42')](_0x459a67,function(_0x440702){return _0x440702[_0x21b3('0x57')];})},'transaction':_0x12d6d8})['then'](function(){var _0x299dfe=_[_0x21b3('0x42')](_0x459a67,function(_0x2ea818){_0x2ea818['userProfileId']=_0x944939[_0x21b3('0x48')]['id'];return _0x2ea818;});var _0x30c318=[];return BPromise[_0x21b3('0x54')](_0x299dfe,function(_0x230d36){return db[_0x21b3('0x53')]['create'](_0x230d36,{'include':[{'model':db[_0x21b3('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x12d6d8})[_0x21b3('0x26')](function(_0x10d701){_0x30c318[_0x21b3('0x5d')](_0x10d701['get']({'plain':!![]}));});})['then'](function(){return _0x30c318;});});});}})[_0x21b3('0x26')](function(_0x44c4c1){return _0x44c4c1;})['then'](respondWithResult(_0x254624,null))['catch'](handleError(_0x254624,null));};exports[_0x21b3('0x5e')]=function(_0x3506f4,_0x3894da){var _0x30972f;return db['UserProfile'][_0x21b3('0x49')]({'where':{'id':_0x3506f4[_0x21b3('0x48')]['id']},'attributes':['id',_0x21b3('0x2a')]})[_0x21b3('0x26')](handleEntityNotFound(_0x3894da,null))['then'](function(_0x333553){if(_0x333553){_0x30972f=_0x333553;return db['UserProfileSection'][_0x21b3('0x27')]({'where':{'userProfileId':_0x3506f4[_0x21b3('0x48')]['id'],'sectionId':_0x3506f4['query'][_0x21b3('0x5f')]}});}})['then'](function(){return _0x30972f;})['then'](respondWithStatusCode(_0x3894da,null))['catch'](handleError(_0x3894da,null));};exports[_0x21b3('0x60')]=function(_0x4f9c19,_0x431c3d){var _0xf6f83d=[];var _0x4d30ca=[];return db[_0x21b3('0x53')][_0x21b3('0x47')]({'where':{'userProfileId':_0x4f9c19[_0x21b3('0x48')]['id']},'raw':!![]})['then'](function(_0x33766b){_0xf6f83d=_[_0x21b3('0x40')](_0x33766b,function(_0x43f003){return _0x43f003[_0x21b3('0x61')]===0x1||_[_0x21b3('0x62')]([0x3eb,0x709],_0x43f003[_0x21b3('0x57')]);});if(!_['isEmpty'](_0xf6f83d)){return _[_0x21b3('0x42')](_0xf6f83d,function(_0x26cee2){return _0x26cee2[_0x21b3('0x57')];});}else{return;}})[_0x21b3('0x26')](function(_0xd567b8){if(_0xd567b8)_0x4d30ca=_0xd567b8;if(_[_0x21b3('0x62')](_0x4d30ca,0x64)){var _0x54f0c3=_[_0x21b3('0x49')](_0xf6f83d,{'sectionId':0x64});return hasDefaultDashboard(_0x54f0c3)[_0x21b3('0x26')](function(_0x305f0d){return _[_0x21b3('0x42')](_0xf6f83d,function(_0x112a3c){if(_0x112a3c[_0x21b3('0x57')]===0x64){_0x112a3c[_0x21b3('0x63')]=_0x305f0d;}return _0x112a3c;});});}else{return;}})[_0x21b3('0x26')](function(_0x528860){if(_0x528860)_0xf6f83d=_0x528860;if(_['includes'](_0x4d30ca,0x3eb)){var _0x2115e9=_['find'](_0xf6f83d,{'sectionId':0x3eb});return getCustomDashboards(_0x2115e9)[_0x21b3('0x26')](function(_0x3d770a){return _[_0x21b3('0x42')](_0xf6f83d,function(_0x16b1f1){if(_0x2115e9['enabled']){if(_0x16b1f1['sectionId']===0x3eb){_0x16b1f1[_0x21b3('0x63')]=_0x3d770a;}}else{if(_0x16b1f1[_0x21b3('0x57')]===0x64){if(!_0x16b1f1['subsections']){_0x16b1f1[_0x21b3('0x63')]=[];}_0x16b1f1[_0x21b3('0x63')]=_0x16b1f1[_0x21b3('0x63')][_0x21b3('0x64')](_0x3d770a);}}return _0x16b1f1;});});}else{return;}})['then'](function(_0x1e9df6){if(_0x1e9df6)_0xf6f83d=_0x1e9df6;if(_[_0x21b3('0x62')](_0x4d30ca,0x709)){var _0x452715=_[_0x21b3('0x49')](_0xf6f83d,{'sectionId':0x709});return getPlugins(_0x452715)[_0x21b3('0x26')](function(_0x12d143){if(_0x452715[_0x21b3('0x61')]){return _[_0x21b3('0x42')](_0xf6f83d,function(_0x203b12){if(_0x203b12[_0x21b3('0x57')]===0x709){_0x203b12['subsections']=_0x12d143;}return _0x203b12;});}else{var _0x464396={'sectionId':0x76c,'enabled':0x1,'subsections':_0x12d143};var _0x1dbfc3=_[_0x21b3('0x42')](_0xf6f83d);_0x1dbfc3[_0x21b3('0x5d')](_0x464396);return _0x1dbfc3;}});}else{return;}})[_0x21b3('0x26')](function(_0x2b943c){if(_0x2b943c)_0xf6f83d=_0x2b943c;return _['filter'](_0xf6f83d,['enabled',0x1]);})[_0x21b3('0x26')](respondWithResult(_0x431c3d,null))['catch'](handleError(_0x431c3d,null));};function hasDefaultDashboard(_0x40cd08){var _0x46a4e7=[0x65];return new BPromise(function(_0x20dada,_0x3553d7){try{if(_0x40cd08[_0x21b3('0x55')]){_0x20dada(_0x46a4e7);}else{return db[_0x21b3('0x56')]['findOne']({'where':{'sectionId':_0x40cd08['id']},'raw':!![]})['then'](function(_0x49b690){_0x49b690?_0x20dada(_0x46a4e7):_0x20dada();});}}catch(_0x3ea847){_0x3553d7(_0x3ea847);}});}function getCustomDashboards(_0x2b1cda){var _0x2677fe=[];return new BPromise(function(_0xac1d0e,_0x49cf18){try{if(_0x2b1cda[_0x21b3('0x55')]){return db['Dashboard']['findAll']({'raw':!![]})[_0x21b3('0x26')](function(_0x3317f4){_0x3317f4['forEach'](function(_0x48c661){_0x2677fe[_0x21b3('0x5d')](_0x48c661['id']+0x1869f);});_0xac1d0e(_0x2677fe);});}else{return db[_0x21b3('0x56')][_0x21b3('0x47')]({'where':{'sectionId':_0x2b1cda['id']},'raw':!![]})['then'](function(_0x389e0d){_0x389e0d[_0x21b3('0x65')](function(_0x2cd24d){_0x2677fe[_0x21b3('0x5d')](_0x2cd24d['resourceId']+0x1869f);});_0xac1d0e(_0x2677fe);});}}catch(_0x29f7ec){_0x49cf18(_0x29f7ec);}});}function getPlugins(_0x27e5ba){var _0x3247e5=[];return new BPromise(function(_0x4a6fce,_0xa6d738){try{if(_0x27e5ba[_0x21b3('0x55')]){return db[_0x21b3('0x66')]['findAll']({'raw':!![]})[_0x21b3('0x26')](function(_0x5f3147){_0x5f3147[_0x21b3('0x65')](function(_0x5dbb1b){_0x3247e5[_0x21b3('0x5d')](_0x5dbb1b['id']+0x15b38);});_0x4a6fce(_0x3247e5);});}else{return db[_0x21b3('0x56')][_0x21b3('0x47')]({'where':{'sectionId':_0x27e5ba['id']},'raw':!![]})[_0x21b3('0x26')](function(_0x9cc4f9){_0x9cc4f9[_0x21b3('0x65')](function(_0x8b7c5d){_0x3247e5[_0x21b3('0x5d')](_0x8b7c5d[_0x21b3('0x67')]+0x15b38);});_0x4a6fce(_0x3247e5);});}}catch(_0x4d48c8){_0xa6d738(_0x4d48c8);}});}exports[_0x21b3('0x68')]=function(_0x177463,_0x102e1a){return db[_0x21b3('0x2d')][_0x21b3('0x49')]({'where':{'id':_0x177463[_0x21b3('0x48')]['id']}})['then'](handleEntityNotFound(_0x102e1a,null))[_0x21b3('0x26')](function(_0x3efcc5){if(_0x3efcc5){return db[_0x21b3('0x51')][_0x21b3('0x52')](function(_0x2c00ea){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x177463[_0x21b3('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x3b46ae){if(_0x3b46ae){return db['UserProfileSection'][_0x21b3('0x27')]({'where':{'userProfileId':_0x177463[_0x21b3('0x48')]['id'],'id':_['map'](_0x3b46ae,function(_0x56ffdf){return _0x56ffdf['id'];})},'transaction':_0x2c00ea});}})[_0x21b3('0x26')](function(_0xbf2a6a){var _0x53ada9=_['map'](_0x177463[_0x21b3('0x4b')],function(_0x272c6c){_0x272c6c[_0x21b3('0x58')]=_0x177463['params']['id'];return _0x272c6c;});return db[_0x21b3('0x53')][_0x21b3('0x69')](_0x53ada9,{'raw':!![],'transaction':_0x2c00ea});})['then'](function(_0x58c55d){var _0x52916e=_[_0x21b3('0x40')](_[_0x21b3('0x42')](_0x58c55d,function(_0x59f599){return _0x59f599[_0x21b3('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x52916e){return db[_0x21b3('0x53')][_0x21b3('0x47')]({'where':{'userProfileId':_0x177463['params']['id'],'sectionId':_[_0x21b3('0x42')](_0x52916e,function(_0x386eef){return _0x386eef[_0x21b3('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x21b3('0x26')](function(_0x4ad083){var _0xd87906=_[_0x21b3('0x42')](_0x177463[_0x21b3('0x4b')],function(_0x3abd59){_0x3abd59[_0x21b3('0x58')]=_0x177463[_0x21b3('0x48')]['id'];return _0x3abd59;});return db['UserProfileResource'][_0x21b3('0x69')](_0xd87906,{'raw':!![],'transaction':_0x2c00ea});});}})[_0x21b3('0x4c')](handleError(_0x102e1a,null));});}})['then'](function(_0x3d1818){var _0x30c6bd=_[_0x21b3('0x42')](_0x3d1818,function(_0x3b9b45){return _0x3b9b45[_0x21b3('0x4d')]({'plain':!![]});});})[_0x21b3('0x26')](respondWithResult(_0x102e1a,null))[_0x21b3('0x4c')](handleError(_0x102e1a,null));};exports[_0x21b3('0x6a')]=function(_0x44d998,_0x51c10a,_0x550eff){return db[_0x21b3('0x2d')][_0x21b3('0x49')]({'where':{'id':_0x44d998[_0x21b3('0x48')]['id']}})['then'](handleEntityNotFound(_0x51c10a,null))[_0x21b3('0x26')](function(_0x13d0d7){if(_0x13d0d7){return _0x13d0d7[_0x21b3('0x6a')](_0x44d998[_0x21b3('0x33')][_0x21b3('0x5f')]);}})['then'](respondWithStatusCode(_0x51c10a,null))[_0x21b3('0x4c')](handleError(_0x51c10a,null));};exports[_0x21b3('0x6b')]=function(_0x4eb5b3,_0x1833bb){var _0x1a8f9e={};if(!_0x4eb5b3[_0x21b3('0x33')]['section'])throw new Error(_0x21b3('0x6c'));if(!_0x4eb5b3[_0x21b3('0x33')][_0x21b3('0x3a')](_0x21b3('0x3b'))){_0x1a8f9e[_0x21b3('0x1e')]=qs[_0x21b3('0x1e')](_0x4eb5b3['query'][_0x21b3('0x1e')]);_0x1a8f9e[_0x21b3('0x1c')]=qs[_0x21b3('0x1c')](_0x4eb5b3[_0x21b3('0x33')][_0x21b3('0x1c')]);}return db[_0x21b3('0x2d')][_0x21b3('0x49')]({'where':{'id':_0x4eb5b3['params']['id']}})['then'](function(_0x586201){if(!_0x586201)throw new Error(_0x21b3('0x6d')+_0x4eb5b3[_0x21b3('0x48')]['id']);return db[_0x21b3('0x2d')]['getResources'](_0x4eb5b3);})[_0x21b3('0x26')](respondWithFilteredResult(_0x1833bb,_0x1a8f9e))[_0x21b3('0x4c')](handleError(_0x1833bb,null));}; \ No newline at end of file +var _0x92c4=['sendStatus','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','params','find','catch','create','body','length','get','omit','createdAt','crudPermissions','updatedAt','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','update','describe','addSections','sequelize','transaction','push','removeSections','ids','getSections','includes','isEmpty','subsections','concat','enabled','findOne','Dashboard','forEach','resourceId','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','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./userProfile.socket','status','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','end'];(function(_0x59836c,_0x468f70){var _0x3b38a6=function(_0x3f7538){while(--_0x3f7538){_0x59836c['push'](_0x59836c['shift']());}};_0x3b38a6(++_0x468f70);}(_0x92c4,0x1a8));var _0x492c=function(_0x1c2311,_0x11d54f){_0x1c2311=_0x1c2311-0x0;var _0x3fd970=_0x92c4[_0x1c2311];return _0x3fd970;};'use strict';var emlformat=require(_0x492c('0x0'));var rimraf=require(_0x492c('0x1'));var zipdir=require(_0x492c('0x2'));var jsonpatch=require(_0x492c('0x3'));var rp=require(_0x492c('0x4'));var moment=require(_0x492c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x492c('0x6'));var util=require(_0x492c('0x7'));var path=require(_0x492c('0x8'));var sox=require(_0x492c('0x9'));var csv=require(_0x492c('0xa'));var ejs=require(_0x492c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x492c('0xc'));var squel=require(_0x492c('0xd'));var crypto=require(_0x492c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x492c('0xf'));var toCsv=require(_0x492c('0xa'));var querystring=require(_0x492c('0x10'));var Papa=require(_0x492c('0x11'));var Redis=require(_0x492c('0x12'));var authService=require(_0x492c('0x13'));var qs=require(_0x492c('0x14'));var as=require(_0x492c('0x15'));var hardwareService=require(_0x492c('0x16'));var logger=require(_0x492c('0x17'))(_0x492c('0x18'));var utils=require(_0x492c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x492c('0x1a'));var db=require(_0x492c('0x1b'))['db'];config[_0x492c('0x1c')]=_[_0x492c('0x1d')](config[_0x492c('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x492c('0x1e'))['register'](socket);function respondWithStatusCode(_0x216666,_0x4bf1a9){_0x4bf1a9=_0x4bf1a9||0xcc;return function(_0x324715){if(_0x324715){return _0x216666['sendStatus'](_0x4bf1a9);}return _0x216666[_0x492c('0x1f')](_0x4bf1a9)['end']();};}function respondWithResult(_0x167237,_0x49831e){_0x49831e=_0x49831e||0xc8;return function(_0x127649){if(_0x127649){return _0x167237['status'](_0x49831e)[_0x492c('0x20')](_0x127649);}};}function respondWithFilteredResult(_0x39f7ff,_0x1ddc01){return function(_0x44b3d4){if(_0x44b3d4){var _0x28c9f0=typeof _0x1ddc01['offset']==='undefined'&&typeof _0x1ddc01[_0x492c('0x21')]==='undefined';var _0x5e0685=_0x44b3d4[_0x492c('0x22')];var _0x4f2fdb=_0x28c9f0?0x0:_0x1ddc01[_0x492c('0x23')];var _0x26948f=_0x28c9f0?_0x44b3d4[_0x492c('0x22')]:_0x1ddc01['offset']+_0x1ddc01[_0x492c('0x21')];var _0x1ed7ac;if(_0x26948f>=_0x5e0685){_0x26948f=_0x5e0685;_0x1ed7ac=0xc8;}else{_0x1ed7ac=0xce;}_0x39f7ff[_0x492c('0x1f')](_0x1ed7ac);return _0x39f7ff[_0x492c('0x24')](_0x492c('0x25'),_0x4f2fdb+'-'+_0x26948f+'/'+_0x5e0685)['json'](_0x44b3d4);}return null;};}function patchUpdates(_0x1544be){return function(_0x2ee6b9){try{jsonpatch[_0x492c('0x26')](_0x2ee6b9,_0x1544be,!![]);}catch(_0x3c53e8){return BPromise[_0x492c('0x27')](_0x3c53e8);}return _0x2ee6b9[_0x492c('0x28')]();};}function saveUpdates(_0x204ec1,_0x3c3684){return function(_0x367175){if(_0x367175){return _0x367175['update'](_0x204ec1)[_0x492c('0x29')](function(_0x243327){return _0x243327;});}return null;};}function removeEntity(_0x2cbfee,_0x470e94){return function(_0x1cfa47){if(_0x1cfa47){return _0x1cfa47[_0x492c('0x2a')]()[_0x492c('0x29')](function(){_0x2cbfee['status'](0xcc)[_0x492c('0x2b')]();});}};}function handleEntityNotFound(_0x3439dd,_0x3de196){return function(_0x8b49f9){if(!_0x8b49f9){_0x3439dd[_0x492c('0x2c')](0x194);}return _0x8b49f9;};}function handleError(_0x235c7a,_0x35d4b2){_0x35d4b2=_0x35d4b2||0x1f4;return function(_0x47831a){logger[_0x492c('0x2d')](_0x47831a[_0x492c('0x2e')]);if(_0x47831a['name']){delete _0x47831a[_0x492c('0x2f')];}_0x235c7a[_0x492c('0x1f')](_0x35d4b2)['send'](_0x47831a);};}exports[_0x492c('0x30')]=function(_0x2da009,_0x1ffcca){var _0x592a46={},_0x48a1c5={},_0x2c8cc4={'count':0x0,'rows':[]};var _0x3e70d4=_[_0x492c('0x31')](db[_0x492c('0x32')][_0x492c('0x33')],function(_0x3a1048){return{'name':_0x3a1048[_0x492c('0x34')],'type':_0x3a1048[_0x492c('0x35')][_0x492c('0x36')]};});_0x48a1c5['model']=_[_0x492c('0x31')](_0x3e70d4,_0x492c('0x2f'));_0x48a1c5[_0x492c('0x37')]=_[_0x492c('0x38')](_0x2da009[_0x492c('0x37')]);_0x48a1c5[_0x492c('0x39')]=_[_0x492c('0x3a')](_0x48a1c5['model'],_0x48a1c5['query']);_0x592a46[_0x492c('0x3b')]=_[_0x492c('0x3a')](_0x48a1c5[_0x492c('0x3c')],qs['fields'](_0x2da009[_0x492c('0x37')][_0x492c('0x3d')]));_0x592a46['attributes']=_0x592a46[_0x492c('0x3b')]['length']?_0x592a46[_0x492c('0x3b')]:_0x48a1c5[_0x492c('0x3c')];if(!_0x2da009[_0x492c('0x37')][_0x492c('0x3e')](_0x492c('0x3f'))){_0x592a46[_0x492c('0x21')]=qs[_0x492c('0x21')](_0x2da009[_0x492c('0x37')][_0x492c('0x21')]);_0x592a46[_0x492c('0x23')]=qs[_0x492c('0x23')](_0x2da009[_0x492c('0x37')]['offset']);}_0x592a46[_0x492c('0x40')]=qs[_0x492c('0x41')](_0x2da009[_0x492c('0x37')]['sort']);_0x592a46['where']=qs['filters'](_['pick'](_0x2da009[_0x492c('0x37')],_0x48a1c5[_0x492c('0x39')]),_0x3e70d4);if(_0x2da009[_0x492c('0x37')][_0x492c('0x42')]){_0x592a46['where']=_['merge'](_0x592a46['where'],{'$or':_[_0x492c('0x31')](_0x3e70d4,function(_0x58bec7){if(_0x58bec7[_0x492c('0x35')]!==_0x492c('0x43')){var _0x5a626a={};_0x5a626a[_0x58bec7[_0x492c('0x2f')]]={'$like':'%'+_0x2da009[_0x492c('0x37')][_0x492c('0x42')]+'%'};return _0x5a626a;}})});}_0x592a46=_[_0x492c('0x44')]({},_0x592a46,_0x2da009[_0x492c('0x45')]);var _0x5886f5={'where':_0x592a46[_0x492c('0x46')]};return db[_0x492c('0x32')][_0x492c('0x22')](_0x5886f5)[_0x492c('0x29')](function(_0x3f02d0){_0x2c8cc4['count']=_0x3f02d0;if(_0x2da009[_0x492c('0x37')][_0x492c('0x47')]){_0x592a46[_0x492c('0x48')]=[{'all':!![]}];}return db[_0x492c('0x32')][_0x492c('0x49')](_0x592a46);})[_0x492c('0x29')](function(_0x34d330){_0x2c8cc4['rows']=_0x34d330;return _0x2c8cc4;})[_0x492c('0x29')](respondWithFilteredResult(_0x1ffcca,_0x592a46))['catch'](handleError(_0x1ffcca,null));};exports['show']=function(_0x1ab4e9,_0x466d7c){var _0x499cac={'raw':![],'where':{'id':_0x1ab4e9[_0x492c('0x4a')]['id']}},_0x11c442={};_0x11c442[_0x492c('0x3c')]=_[_0x492c('0x38')](db[_0x492c('0x32')][_0x492c('0x33')]);_0x11c442['query']=_[_0x492c('0x38')](_0x1ab4e9[_0x492c('0x37')]);_0x11c442[_0x492c('0x39')]=_['intersection'](_0x11c442[_0x492c('0x3c')],_0x11c442['query']);_0x499cac[_0x492c('0x3b')]=_[_0x492c('0x3a')](_0x11c442[_0x492c('0x3c')],qs[_0x492c('0x3d')](_0x1ab4e9['query'][_0x492c('0x3d')]));_0x499cac[_0x492c('0x3b')]=_0x499cac[_0x492c('0x3b')]['length']?_0x499cac[_0x492c('0x3b')]:_0x11c442[_0x492c('0x3c')];if(_0x1ab4e9[_0x492c('0x37')]['includeAll']){_0x499cac[_0x492c('0x48')]=[{'all':!![]}];}_0x499cac=_[_0x492c('0x44')]({},_0x499cac,_0x1ab4e9['options']);return db[_0x492c('0x32')][_0x492c('0x4b')](_0x499cac)[_0x492c('0x29')](handleEntityNotFound(_0x466d7c,null))[_0x492c('0x29')](respondWithResult(_0x466d7c,null))[_0x492c('0x4c')](handleError(_0x466d7c,null));};exports[_0x492c('0x4d')]=function(_0x2a452c,_0x1c4821){return db[_0x492c('0x32')][_0x492c('0x4d')](_0x2a452c[_0x492c('0x4e')],{})[_0x492c('0x29')](respondWithResult(_0x1c4821,0xc9))[_0x492c('0x4c')](handleError(_0x1c4821,null));};exports['clone']=function(_0x2597a5,_0x17fc97){var _0x34037f={'where':{'id':_0x2597a5[_0x492c('0x4a')]['id']}},_0x2dacc5={};_0x2dacc5[_0x492c('0x3c')]=_['keys'](db['UserProfile'][_0x492c('0x33')]);_0x34037f[_0x492c('0x3b')]=_[_0x492c('0x3a')](_0x2dacc5[_0x492c('0x3c')],qs['fields'](_0x2597a5[_0x492c('0x37')][_0x492c('0x3d')]));_0x34037f[_0x492c('0x3b')]=_0x34037f[_0x492c('0x3b')][_0x492c('0x4f')]?_0x34037f[_0x492c('0x3b')]:_0x2dacc5[_0x492c('0x3c')];if(_0x2597a5['query'][_0x492c('0x47')]){_0x34037f['include']=[{'all':!![]}];}_0x34037f=_[_0x492c('0x44')]({},_0x34037f,_0x2597a5[_0x492c('0x45')]);return db[_0x492c('0x32')][_0x492c('0x4b')](_0x34037f)[_0x492c('0x29')](handleEntityNotFound(_0x17fc97,null))[_0x492c('0x29')](function(_0x113af4){if(_0x113af4){var _0x40be05=_0x113af4[_0x492c('0x50')]({'plain':!![]});_0x40be05=qs[_0x492c('0x51')](_0x40be05,['id',_0x492c('0x52'),'updatedAt',_0x492c('0x53')]);_0x2597a5[_0x492c('0x4e')]=_[_0x492c('0x51')](_0x2597a5[_0x492c('0x4e')],['id','createdAt',_0x492c('0x54')]);return db['sequelize']['transaction'](function(_0x30e800){return db[_0x492c('0x32')][_0x492c('0x4d')](_[_0x492c('0x44')](_0x40be05,_0x2597a5[_0x492c('0x4e')]),{'include':_0x2597a5[_0x492c('0x37')][_0x492c('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x30e800})[_0x492c('0x29')](function(_0x5613ff){var _0x4edcd0=_0x5613ff['get']({'plain':!![]});return db[_0x492c('0x55')][_0x492c('0x49')]({'where':{'userProfileId':_0x2597a5[_0x492c('0x4a')]['id']},'raw':!![]})['then'](function(_0xb3f35f){if(_0xb3f35f){return BPromise[_0x492c('0x56')](_0xb3f35f,function(_0x4e0153){return new BPromise(function(_0xca67a4,_0x138e9a){if(_0x4e0153['autoAssociation']===null||_0x4e0153[_0x492c('0x57')]===0x1)_0xca67a4(null);return db['UserProfileResource'][_0x492c('0x49')]({'where':{'sectionId':_0x4e0153['id']},'raw':!![]})[_0x492c('0x29')](function(_0x2e85e7){var _0x7715b4=_[_0x492c('0x31')](_0x2e85e7,function(_0x2079c){return qs[_0x492c('0x51')](_0x2079c,['id',_0x492c('0x52'),_0x492c('0x54'),_0x492c('0x58')]);});_0xca67a4(_0x7715b4);})[_0x492c('0x4c')](function(_0x1a9b2d){_0x138e9a(_0x1a9b2d);});})[_0x492c('0x29')](function(_0x4bf52e){var _0x27a4c4=qs[_0x492c('0x51')](_0x4e0153,['id',_0x492c('0x52'),'updatedAt']);_0x27a4c4[_0x492c('0x59')]=_0x4edcd0['id'];if(_0x4bf52e)_0x27a4c4[_0x492c('0x5a')]=_0x4bf52e;return _0x27a4c4;})[_0x492c('0x29')](function(_0x292fd8){return db[_0x492c('0x55')][_0x492c('0x4d')](_0x292fd8,{'include':[{'model':db[_0x492c('0x5b')],'as':_0x492c('0x5a')}],'raw':!![],'transaction':_0x30e800});});})[_0x492c('0x29')](function(){return _0x4edcd0;});}});});});}})['then'](respondWithResult(_0x17fc97,0xc9))[_0x492c('0x4c')](handleError(_0x17fc97,null));};exports[_0x492c('0x5c')]=function(_0x517eb9,_0xd312ac){if(_0x517eb9[_0x492c('0x4e')]['id']){delete _0x517eb9['body']['id'];}return db['UserProfile']['find']({'where':{'id':_0x517eb9['params']['id']}})[_0x492c('0x29')](handleEntityNotFound(_0xd312ac,null))[_0x492c('0x29')](saveUpdates(_0x517eb9[_0x492c('0x4e')],null))[_0x492c('0x29')](respondWithResult(_0xd312ac,null))[_0x492c('0x4c')](handleError(_0xd312ac,null));};exports[_0x492c('0x2a')]=function(_0x2d617a,_0x123936){return db[_0x492c('0x32')][_0x492c('0x4b')]({'where':{'id':_0x2d617a[_0x492c('0x4a')]['id']}})[_0x492c('0x29')](handleEntityNotFound(_0x123936,null))[_0x492c('0x29')](removeEntity(_0x123936,null))['catch'](handleError(_0x123936,null));};exports[_0x492c('0x5d')]=function(_0x2aa20d,_0x4f00e8){return db[_0x492c('0x32')]['describe']()['then'](respondWithResult(_0x4f00e8,null))[_0x492c('0x4c')](handleError(_0x4f00e8,null));};exports[_0x492c('0x5e')]=function(_0x2f531f,_0x512b1b){var _0xd7ae1c=_0x2f531f[_0x492c('0x4e')];return db['UserProfile'][_0x492c('0x4b')]({'where':{'id':_0x2f531f['params']['id']}})['then'](handleEntityNotFound(_0x512b1b,null))[_0x492c('0x29')](function(_0x349a4a){if(_0x349a4a){return db[_0x492c('0x5f')][_0x492c('0x60')](function(_0xc638d2){return db[_0x492c('0x55')][_0x492c('0x2a')]({'where':{'userProfileId':_0x2f531f['params']['id'],'sectionId':_[_0x492c('0x31')](_0xd7ae1c,function(_0x1f5cf1){return _0x1f5cf1[_0x492c('0x58')];})},'transaction':_0xc638d2})['then'](function(){var _0x434274=_[_0x492c('0x31')](_0xd7ae1c,function(_0x407101){_0x407101['userProfileId']=_0x2f531f[_0x492c('0x4a')]['id'];return _0x407101;});var _0x1ba869=[];return BPromise[_0x492c('0x56')](_0x434274,function(_0x5a51a1){return db[_0x492c('0x55')][_0x492c('0x4d')](_0x5a51a1,{'include':[{'model':db[_0x492c('0x5b')],'as':'Resources'}],'raw':!![],'transaction':_0xc638d2})[_0x492c('0x29')](function(_0x3c809d){_0x1ba869[_0x492c('0x61')](_0x3c809d[_0x492c('0x50')]({'plain':!![]}));});})[_0x492c('0x29')](function(){return _0x1ba869;});});});}})[_0x492c('0x29')](function(_0x41dfbc){return _0x41dfbc;})[_0x492c('0x29')](respondWithResult(_0x512b1b,null))['catch'](handleError(_0x512b1b,null));};exports[_0x492c('0x62')]=function(_0x435343,_0x28be0b){var _0x4747f6;return db[_0x492c('0x32')][_0x492c('0x4b')]({'where':{'id':_0x435343[_0x492c('0x4a')]['id']},'attributes':['id',_0x492c('0x2f')]})[_0x492c('0x29')](handleEntityNotFound(_0x28be0b,null))['then'](function(_0x511044){if(_0x511044){_0x4747f6=_0x511044;return db['UserProfileSection'][_0x492c('0x2a')]({'where':{'userProfileId':_0x435343[_0x492c('0x4a')]['id'],'sectionId':_0x435343[_0x492c('0x37')][_0x492c('0x63')]}});}})[_0x492c('0x29')](function(){return _0x4747f6;})[_0x492c('0x29')](respondWithStatusCode(_0x28be0b,null))['catch'](handleError(_0x28be0b,null));};exports[_0x492c('0x64')]=function(_0x409367,_0x590e76){var _0x5154b7=[];var _0x4d7587=[];return db['UserProfileSection'][_0x492c('0x49')]({'where':{'userProfileId':_0x409367[_0x492c('0x4a')]['id']},'raw':!![]})['then'](function(_0x578e78){_0x5154b7=_['filter'](_0x578e78,function(_0x3e0a4e){return _0x3e0a4e['enabled']===0x1||_[_0x492c('0x65')]([0x3eb,0x709],_0x3e0a4e[_0x492c('0x58')]);});if(!_[_0x492c('0x66')](_0x5154b7)){return _['map'](_0x5154b7,function(_0x73ee04){return _0x73ee04[_0x492c('0x58')];});}else{return;}})[_0x492c('0x29')](function(_0x65c1ba){if(_0x65c1ba)_0x4d7587=_0x65c1ba;if(_[_0x492c('0x65')](_0x4d7587,0x64)){var _0x1b1d77=_[_0x492c('0x4b')](_0x5154b7,{'sectionId':0x64});return hasDefaultDashboard(_0x1b1d77)[_0x492c('0x29')](function(_0x422869){return _[_0x492c('0x31')](_0x5154b7,function(_0x2af46f){if(_0x2af46f[_0x492c('0x58')]===0x64){_0x2af46f[_0x492c('0x67')]=_0x422869;}return _0x2af46f;});});}else{return;}})[_0x492c('0x29')](function(_0x1d5824){if(_0x1d5824)_0x5154b7=_0x1d5824;if(_[_0x492c('0x65')](_0x4d7587,0x3eb)){var _0x5a7bd5=_['find'](_0x5154b7,{'sectionId':0x3eb});return getCustomDashboards(_0x5a7bd5)['then'](function(_0x1aa2c3){return _['map'](_0x5154b7,function(_0x330716){if(_0x5a7bd5['enabled']){if(_0x330716[_0x492c('0x58')]===0x3eb){_0x330716[_0x492c('0x67')]=_0x1aa2c3;}}else{if(_0x330716[_0x492c('0x58')]===0x64){if(!_0x330716[_0x492c('0x67')]){_0x330716[_0x492c('0x67')]=[];}_0x330716[_0x492c('0x67')]=_0x330716['subsections'][_0x492c('0x68')](_0x1aa2c3);}}return _0x330716;});});}else{return;}})[_0x492c('0x29')](function(_0x45e7f4){if(_0x45e7f4)_0x5154b7=_0x45e7f4;if(_[_0x492c('0x65')](_0x4d7587,0x709)){var _0x2eab6f=_[_0x492c('0x4b')](_0x5154b7,{'sectionId':0x709});return getPlugins(_0x2eab6f)['then'](function(_0x25c49d){if(_0x2eab6f[_0x492c('0x69')]){return _[_0x492c('0x31')](_0x5154b7,function(_0x41ddda){if(_0x41ddda[_0x492c('0x58')]===0x709){_0x41ddda['subsections']=_0x25c49d;}return _0x41ddda;});}else{var _0x3335c4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x25c49d};var _0x25160f=_[_0x492c('0x31')](_0x5154b7);_0x25160f[_0x492c('0x61')](_0x3335c4);return _0x25160f;}});}else{return;}})[_0x492c('0x29')](function(_0x49e29c){if(_0x49e29c)_0x5154b7=_0x49e29c;return _[_0x492c('0x42')](_0x5154b7,['enabled',0x1]);})[_0x492c('0x29')](respondWithResult(_0x590e76,null))[_0x492c('0x4c')](handleError(_0x590e76,null));};function hasDefaultDashboard(_0x41552c){var _0xa323fe=[0x65];return new BPromise(function(_0x111d37,_0x5bdd67){try{if(_0x41552c[_0x492c('0x57')]){_0x111d37(_0xa323fe);}else{return db[_0x492c('0x5b')][_0x492c('0x6a')]({'where':{'sectionId':_0x41552c['id']},'raw':!![]})[_0x492c('0x29')](function(_0xfbf661){_0xfbf661?_0x111d37(_0xa323fe):_0x111d37();});}}catch(_0x233aac){_0x5bdd67(_0x233aac);}});}function getCustomDashboards(_0x47270b){var _0x27218e=[];return new BPromise(function(_0x4e9cb1,_0x1abf61){try{if(_0x47270b[_0x492c('0x57')]){return db[_0x492c('0x6b')][_0x492c('0x49')]({'raw':!![]})[_0x492c('0x29')](function(_0x4b2018){_0x4b2018[_0x492c('0x6c')](function(_0x3b7f1d){_0x27218e[_0x492c('0x61')](_0x3b7f1d['id']+0x1869f);});_0x4e9cb1(_0x27218e);});}else{return db[_0x492c('0x5b')][_0x492c('0x49')]({'where':{'sectionId':_0x47270b['id']},'raw':!![]})['then'](function(_0x45d30a){_0x45d30a['forEach'](function(_0xbd23e7){_0x27218e[_0x492c('0x61')](_0xbd23e7['resourceId']+0x1869f);});_0x4e9cb1(_0x27218e);});}}catch(_0x4f4f76){_0x1abf61(_0x4f4f76);}});}function getPlugins(_0x101ac1){var _0x37ffd0=[];return new BPromise(function(_0x41f093,_0x3f1219){try{if(_0x101ac1[_0x492c('0x57')]){return db['Plugin'][_0x492c('0x49')]({'raw':!![]})[_0x492c('0x29')](function(_0x410f2b){_0x410f2b[_0x492c('0x6c')](function(_0x46d12d){_0x37ffd0[_0x492c('0x61')](_0x46d12d['id']+0x15b38);});_0x41f093(_0x37ffd0);});}else{return db[_0x492c('0x5b')][_0x492c('0x49')]({'where':{'sectionId':_0x101ac1['id']},'raw':!![]})[_0x492c('0x29')](function(_0x2f175c){_0x2f175c[_0x492c('0x6c')](function(_0x59d93c){_0x37ffd0[_0x492c('0x61')](_0x59d93c[_0x492c('0x6d')]+0x15b38);});_0x41f093(_0x37ffd0);});}}catch(_0x18e7bc){_0x3f1219(_0x18e7bc);}});}exports[_0x492c('0x6e')]=function(_0x1326b2,_0x27cb9f){return db[_0x492c('0x32')][_0x492c('0x4b')]({'where':{'id':_0x1326b2[_0x492c('0x4a')]['id']}})[_0x492c('0x29')](handleEntityNotFound(_0x27cb9f,null))[_0x492c('0x29')](function(_0x3eab0a){if(_0x3eab0a){return db[_0x492c('0x5f')][_0x492c('0x60')](function(_0x100bf3){return db['UserProfileSection'][_0x492c('0x49')]({'where':{'userProfileId':_0x1326b2['params']['id']},'attributes':['id'],'raw':!![]})[_0x492c('0x29')](function(_0x4b2020){if(_0x4b2020){return db[_0x492c('0x55')][_0x492c('0x2a')]({'where':{'userProfileId':_0x1326b2[_0x492c('0x4a')]['id'],'id':_['map'](_0x4b2020,function(_0x43ef73){return _0x43ef73['id'];})},'transaction':_0x100bf3});}})[_0x492c('0x29')](function(_0x255773){var _0x1b0820=_[_0x492c('0x31')](_0x1326b2[_0x492c('0x4e')],function(_0x4e905f){_0x4e905f[_0x492c('0x59')]=_0x1326b2['params']['id'];return _0x4e905f;});return db[_0x492c('0x55')][_0x492c('0x6f')](_0x1b0820,{'raw':!![],'transaction':_0x100bf3});})[_0x492c('0x29')](function(_0x3a5e61){var _0x4858e4=_[_0x492c('0x42')](_['map'](_0x3a5e61,function(_0x27108a){return _0x27108a['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4858e4){return db[_0x492c('0x55')][_0x492c('0x49')]({'where':{'userProfileId':_0x1326b2[_0x492c('0x4a')]['id'],'sectionId':_[_0x492c('0x31')](_0x4858e4,function(_0x109a73){return _0x109a73[_0x492c('0x58')];})},'attributes':['id',_0x492c('0x58')],'raw':!![]})[_0x492c('0x29')](function(_0x1a6072){var _0x4dd159=_['map'](_0x1326b2['body'],function(_0x55d326){_0x55d326[_0x492c('0x59')]=_0x1326b2[_0x492c('0x4a')]['id'];return _0x55d326;});return db[_0x492c('0x5b')][_0x492c('0x6f')](_0x4dd159,{'raw':!![],'transaction':_0x100bf3});});}})[_0x492c('0x4c')](handleError(_0x27cb9f,null));});}})[_0x492c('0x29')](function(_0x19dd1c){var _0x27c8f3=_[_0x492c('0x31')](_0x19dd1c,function(_0x2346aa){return _0x2346aa[_0x492c('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x27cb9f,null))[_0x492c('0x4c')](handleError(_0x27cb9f,null));};exports[_0x492c('0x70')]=function(_0x3d909b,_0x444f5e,_0x5d250c){return db[_0x492c('0x32')][_0x492c('0x4b')]({'where':{'id':_0x3d909b[_0x492c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x444f5e,null))[_0x492c('0x29')](function(_0x4233bd){if(_0x4233bd){return _0x4233bd[_0x492c('0x70')](_0x3d909b[_0x492c('0x37')][_0x492c('0x63')]);}})[_0x492c('0x29')](respondWithStatusCode(_0x444f5e,null))[_0x492c('0x4c')](handleError(_0x444f5e,null));};exports[_0x492c('0x71')]=function(_0x3f382d,_0x2e02ca){var _0x478c6d={};if(!_0x3f382d[_0x492c('0x37')][_0x492c('0x72')])throw new Error(_0x492c('0x73'));if(!_0x3f382d[_0x492c('0x37')][_0x492c('0x3e')](_0x492c('0x3f'))){_0x478c6d['limit']=qs['limit'](_0x3f382d[_0x492c('0x37')][_0x492c('0x21')]);_0x478c6d[_0x492c('0x23')]=qs[_0x492c('0x23')](_0x3f382d['query']['offset']);}return db[_0x492c('0x32')][_0x492c('0x4b')]({'where':{'id':_0x3f382d[_0x492c('0x4a')]['id']}})[_0x492c('0x29')](function(_0x178e26){if(!_0x178e26)throw new Error(_0x492c('0x74')+_0x3f382d[_0x492c('0x4a')]['id']);return db[_0x492c('0x32')]['getResources'](_0x3f382d);})[_0x492c('0x29')](respondWithFilteredResult(_0x2e02ca,_0x478c6d))[_0x492c('0x4c')](handleError(_0x2e02ca,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ffda6ff..30a7d98 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 _0x1267=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x1267,0xb5));var _0x7126=function(_0xac51fb,_0x198ed5){_0xac51fb=_0xac51fb-0x0;var _0x1f42ff=_0x1267[_0xac51fb];return _0x1f42ff;};'use strict';var EventEmitter=require(_0x7126('0x0'));var UserProfile=require(_0x7126('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7126('0x2'),'afterUpdate':_0x7126('0x3'),'afterDestroy':_0x7126('0x4')};function emitEvent(_0x3587d0){return function(_0x35f8e5,_0x403ed4,_0x4346f7){UserProfileEvents['emit'](_0x3587d0+':'+_0x35f8e5['id'],_0x35f8e5);UserProfileEvents[_0x7126('0x5')](_0x3587d0,_0x35f8e5);_0x4346f7(null);};}for(var e in events){if(events[_0x7126('0x6')](e)){var event=events[e];UserProfile[_0x7126('0x7')](e,emitEvent(event));}}module[_0x7126('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x1c63=['update','remove','emit','hasOwnProperty','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x1c45fb,_0x43db02){var _0x51e46c=function(_0x9b4982){while(--_0x9b4982){_0x1c45fb['push'](_0x1c45fb['shift']());}};_0x51e46c(++_0x43db02);}(_0x1c63,0xdc));var _0x31c6=function(_0x1dd4de,_0x189290){_0x1dd4de=_0x1dd4de-0x0;var _0xf23408=_0x1c63[_0x1dd4de];return _0xf23408;};'use strict';var EventEmitter=require(_0x31c6('0x0'));var UserProfile=require(_0x31c6('0x1'))['db'][_0x31c6('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x31c6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x31c6('0x4'),'afterDestroy':_0x31c6('0x5')};function emitEvent(_0x2501a8){return function(_0x598eed,_0x12da33,_0x3c1288){UserProfileEvents[_0x31c6('0x6')](_0x2501a8+':'+_0x598eed['id'],_0x598eed);UserProfileEvents[_0x31c6('0x6')](_0x2501a8,_0x598eed);_0x3c1288(null);};}for(var e in events){if(events[_0x31c6('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index c943cf2..2e9e4a4 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 _0xed4e=['OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','queuecampaigns','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','templates','Trigger','trunks','Trunk','variables','Plugin','extractedreports','Reports','metrics','charAt','toUpperCase','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','UserProfile','raw','section','mergeResources','isEmpty','length','push','find','params','all','ignore','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','default','reportId','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tag','Tags','color','tag','ThroughTags','openTabs','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','../../components/parsers/qs','exports','models','filter','value','findAll','associatedResources','catch','field','model','then','name','resolve','UserProfileResource','AnalyticExtractedReport','map','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','voicerecordings','Agents','User','agent','Telephones','membername','role','telephone','VoiceQueues','queue','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues'];(function(_0x989b4c,_0x967c63){var _0x301398=function(_0x441986){while(--_0x441986){_0x989b4c['push'](_0x989b4c['shift']());}};_0x301398(++_0x967c63);}(_0xed4e,0x134));var _0xeed4=function(_0x3af4de,_0x40af7a){_0x3af4de=_0x3af4de-0x0;var _0xa55809=_0xed4e[_0x3af4de];return _0xa55809;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require(_0xeed4('0x0'));var squel=require('squel');module[_0xeed4('0x1')]=function(_0x56ec16){var _0x2f64fa=_0x56ec16[_0xeed4('0x2')];function _0x20521e(_0x453647,_0x11536e){return new Promise(function(_0xbb8974,_0x27ac75){if(!_0x11536e)return _0xbb8974(null);var _0x41a061=_0x11536e[_0xeed4('0x3')]?{[_0x11536e[_0xeed4('0x3')]['field']]:_0x11536e[_0xeed4('0x3')][_0xeed4('0x4')]}:undefined;return _0x2f64fa[_0x453647][_0xeed4('0x5')]({'where':_0x41a061,'raw':!![]})['then'](function(_0x1c4d98){_0x11536e[_0xeed4('0x6')]=_['map'](_0x1c4d98,'id');_0xbb8974(_0x11536e);})[_0xeed4('0x7')](function(_0x117453){_0x27ac75(_0x117453);});});}function _0x7a6dc8(_0x5a22bf,_0xeafd32){return new Promise(function(_0x125961,_0xc0e55){var _0x425b3d=_0x5a22bf[_0xeed4('0x3')]?{[_0x5a22bf[_0xeed4('0x3')][_0xeed4('0x8')]]:_0x5a22bf['filter'][_0xeed4('0x4')]}:undefined;return _0x2f64fa[_0x5a22bf[_0xeed4('0x9')]][_0xeed4('0x5')]({'where':_0x425b3d,'raw':!![]})[_0xeed4('0xa')](function(_0xba0f63){_0xeafd32[_0xeed4('0x6')]=_['map'](_0xba0f63,function(_0x5164a4){return _0x5164a4[_0xeed4('0xb')];});_0x125961(_0xeafd32);})[_0xeed4('0x7')](function(_0x5485f7){_0xc0e55(_0x5485f7);});});}function _0x10fda7(_0xaa1469,_0x52a18c,_0x43bdb7){if(!_0x52a18c)return Promise[_0xeed4('0xc')](null);return new Promise(function(_0x3b61bb,_0x2f6b7e){return _0x2f64fa[_0xeed4('0xd')][_0xeed4('0x5')]({'where':{'sectionId':_0x52a18c['id']},'raw':!![]})[_0xeed4('0xa')](function(_0x3f5213){if(_0xaa1469[_0xeed4('0x8')]&&_0xaa1469[_0xeed4('0x8')]!=='id'){_0x52a18c[_0xeed4('0x6')]=_['map'](_0x3f5213,function(_0x45a35e){return _0x45a35e[_0xaa1469[_0xeed4('0x8')]];});}else{if(_0x43bdb7===_0xeed4('0xe')){_0x52a18c[_0xeed4('0x6')]=_[_0xeed4('0xf')](_0x3f5213,function(_0x638be2){return{'id':_0x638be2[_0xeed4('0x10')],'type':_0x638be2[_0xeed4('0x11')]};});}else{_0x52a18c[_0xeed4('0x6')]=_[_0xeed4('0xf')](_0x3f5213,function(_0x5b602d){return _0x5b602d['resourceId'];});}}_0x3b61bb(_0x52a18c);})['catch'](function(_0x471bfc){_0x2f6b7e(_0x471bfc);});});}function _0x270894(_0x1232ca,_0x5b7859){var _0x2fc4f4={'parentSections':[]};switch(_0x1232ca['toLowerCase']()){case _0xeed4('0x12'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x14');break;case _0xeed4('0x15'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x16');break;case'squarerecordings':_0x2fc4f4['childModel']='SquareRecording';_0x2fc4f4[_0xeed4('0x17')]=[{'name':_0xeed4('0x18'),'field':'name','foreignKey':_0xeed4('0x19')}];break;case _0xeed4('0x1a'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x1b');break;case _0xeed4('0x1c'):_0x2fc4f4['childModel']='CmContact';_0x2fc4f4[_0xeed4('0x17')]=[{'name':_0xeed4('0x1d'),'field':'id','foreignKey':_0xeed4('0x1e')}];break;case _0xeed4('0x1f'):_0x2fc4f4[_0xeed4('0x13')]='CmList';break;case _0xeed4('0x20'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x21');break;case'globalcustomfields':_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x22');break;case _0xeed4('0x23'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x24');break;case _0xeed4('0x25'):_0x2fc4f4['childModel']=_0xeed4('0x26');break;case'faxqueues':_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x27');break;case _0xeed4('0x28'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x29');break;case _0xeed4('0x2a'):case _0xeed4('0x2b'):case'outboundroutes':_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x2c');break;case'contexts':_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x2d');break;case'voicemails':_0x2fc4f4[_0xeed4('0x13')]='VoiceMail';break;case _0xeed4('0x2e'):_0x2fc4f4[_0xeed4('0x13')]='VoiceRecording';_0x2fc4f4[_0xeed4('0x17')]=[{'name':_0xeed4('0x2f'),'field':_0xeed4('0xb'),'foreignKey':'membername','model':_0xeed4('0x30'),'filter':{'field':'role','value':[_0xeed4('0x31')]}},{'name':_0xeed4('0x32'),'field':_0xeed4('0xb'),'foreignKey':_0xeed4('0x33'),'model':_0xeed4('0x30'),'filter':{'field':_0xeed4('0x34'),'value':[_0xeed4('0x35')]}},{'name':_0xeed4('0x36'),'field':'name','foreignKey':_0xeed4('0x37'),'model':'VoiceQueue','filter':{'field':'type','value':['inbound']}},{'name':_0xeed4('0x38'),'field':_0xeed4('0xb'),'foreignKey':'queue','model':_0xeed4('0x39'),'filter':{'field':_0xeed4('0x11'),'value':[_0xeed4('0x3a')]}}];break;case _0xeed4('0x3b'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x3c');break;case _0xeed4('0x3d'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x3e');break;case _0xeed4('0x3f'):_0x2fc4f4['childModel']='VoicePrefix';break;case _0xeed4('0x40'):_0x2fc4f4[_0xeed4('0x13')]='Campaign';break;case _0xeed4('0x41'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x42');break;case _0xeed4('0x43'):_0x2fc4f4['childModel']=_0xeed4('0x44');break;case _0xeed4('0x45'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x46');break;case _0xeed4('0x47'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x48');break;case'openchannelaccounts':_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x49');break;case _0xeed4('0x4a'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x4b');break;case'smsaccounts':_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x4c');break;case _0xeed4('0x4d'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x4e');break;case _0xeed4('0x4f'):_0x2fc4f4['childModel']='WhatsappAccount';break;case _0xeed4('0x50'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x51');break;case'voicequeues':case _0xeed4('0x52'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x39');if(_0x5b7859){_0x2fc4f4[_0xeed4('0x17')]=[{'name':_0xeed4('0x36')},{'name':_0xeed4('0x38')}];}break;case'users':case'agents':case'telephones':_0x2fc4f4['childModel']=_0xeed4('0x30');if(_0x5b7859){_0x2fc4f4['parentSections']=[{'name':_0xeed4('0x53'),'filter':{'field':_0xeed4('0x34'),'value':[_0xeed4('0x54'),_0xeed4('0x55')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0xeed4('0x56'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x57');break;case _0xeed4('0x58'):_0x2fc4f4['childModel']=_0xeed4('0x59');break;case _0xeed4('0x5a'):_0x2fc4f4['childModel']=_0xeed4('0x5b');break;case _0xeed4('0x5c'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x5d');break;case _0xeed4('0x5e'):_0x2fc4f4[_0xeed4('0x13')]='DeskAccount';break;case'zohoaccounts':_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x5f');break;case _0xeed4('0x60'):_0x2fc4f4[_0xeed4('0x13')]='User';break;case _0xeed4('0x61'):_0x2fc4f4['childModel']=_0xeed4('0x62');break;case'dispositions':_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x63');break;case _0xeed4('0x64'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x65');break;case _0xeed4('0x66'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x67');break;case _0xeed4('0x68'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x69');break;case'scheduler':_0x2fc4f4['childModel']=_0xeed4('0x6a');break;case _0xeed4('0x6b'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x6c');break;case'tags':_0x2fc4f4[_0xeed4('0x13')]='Tag';break;case _0xeed4('0x6d'):_0x2fc4f4[_0xeed4('0x13')]='Template';break;case'triggers':_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x6e');break;case _0xeed4('0x6f'):_0x2fc4f4['childModel']=_0xeed4('0x70');break;case _0xeed4('0x71'):_0x2fc4f4[_0xeed4('0x13')]='Variable';break;case'plugins':_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0x72');break;case _0xeed4('0x73'):_0x2fc4f4[_0xeed4('0x13')]=_0xeed4('0xe');_0x2fc4f4[_0xeed4('0x17')]=[{'name':_0xeed4('0x74'),'field':'id','foreignKey':'reportId'}];break;case _0xeed4('0x75'):_0x2fc4f4['childModel']='AnalyticMetric';break;}return _0x2fc4f4;}function _0x1ba261(_0x419543,_0xeed50d){var _0x99ff45=_0x419543[_0xeed4('0x76')](0x0)[_0xeed4('0x77')]()+_0x419543['slice'](0x1);var _0x1fa02a={'type':_0x2f64fa['Sequelize'][_0xeed4('0x78')][_0xeed4('0x79')],'raw':!![]};return new Promise(function(_0x392365,_0xecd5fb){var _0x3a59a3=squel[_0xeed4('0x7a')]()['field']('ui.'+_0x99ff45+_0xeed4('0x7b'),'id')[_0xeed4('0x8')](_0xeed4('0x7c'))[_0xeed4('0x7d')](_0xeed4('0x7e')+_0x419543+_0xeed4('0x7f'),'ui')[_0xeed4('0x80')](_0xeed4('0x81'),_0xeed50d['id']);return _0x2f64fa['sequelize'][_0xeed4('0x82')](_0x3a59a3[_0xeed4('0x83')](),_0x1fa02a)[_0xeed4('0xa')](function(_0x2f6732){_0xeed50d[_0x99ff45+'OpenTabs']=_0x2f6732;_0x392365(_0x2f6732);})[_0xeed4('0x7')](function(_0xe37a0e){_0xecd5fb(_0xe37a0e);});});}return _0x56ec16['define'](_0xeed4('0x84'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x355564){var _0xf95c2f={'raw':_0x355564[_0xeed4('0x82')][_0xeed4('0x85')],'where':{}};var _0x354bf0={};var _0x389563={'count':0x0,'rows':[]};var _0x294b2d=_0x355564[_0xeed4('0x82')][_0xeed4('0x86')];var _0x508d16=_0x355564['query'][_0xeed4('0x87')]||![];var _0x23afbb=_0x270894(_0x294b2d,_0x508d16);if(!_0x23afbb[_0xeed4('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x294b2d+'\x27');var _0x880993=[{'name':_0x294b2d}];if(!_[_0xeed4('0x88')](_0x23afbb[_0xeed4('0x17')]))_0x880993=_0x23afbb['parentSections'];var _0x5df02b=[];for(var _0x593b22=0x0;_0x593b22<_0x880993[_0xeed4('0x89')];_0x593b22++){_0x5df02b[_0xeed4('0x8a')](_0x2f64fa['UserProfileSection'][_0xeed4('0x8b')]({'where':{'userProfileId':_0x355564[_0xeed4('0x8c')]['id'],'name':_0x880993[_0x593b22][_0xeed4('0xb')]},'raw':!![]}));}return Promise[_0xeed4('0x8d')](_0x5df02b)[_0xeed4('0xa')](function(_0x3c9b6a){var _0x4dc0d0=_[_0xeed4('0x3')](_0x3c9b6a,function(_0x543e63){return _0x543e63?_0x543e63:undefined;});var _0x72f9b5=_['filter'](_0x880993,[_0xeed4('0x8e'),!![]]);var _0x4a28fc=_['isEmpty'](_0x4dc0d0)&&_['isEmpty'](_0x72f9b5)?null:_['union'](_0x72f9b5,_0x4dc0d0);if(!_0x4a28fc)return null;var _0x2ac160=[];for(var _0xa5897e=0x0;_0xa5897e<_0x4a28fc[_0xeed4('0x89')];_0xa5897e++){var _0x63afef=_[_0xeed4('0x8b')](_0x880993,function(_0x183e93){return _0x4a28fc[_0xa5897e]?_0x183e93[_0xeed4('0xb')]===_0x4a28fc[_0xa5897e][_0xeed4('0xb')]:null;});if(_0x63afef){if(_0x4a28fc[_0xa5897e]['ignore']){_0x2ac160['push'](_0x20521e(_0x23afbb[_0xeed4('0x13')],_0x4a28fc[_0xa5897e]));}else{if(!_0x4a28fc[_0xa5897e][_0xeed4('0x8f')]){_0x2ac160[_0xeed4('0x8a')](_0x10fda7(_0x63afef,_0x4a28fc[_0xa5897e],_0x23afbb[_0xeed4('0x13')]));}else{if(_0x63afef[_0xeed4('0x9')]){_0x2ac160[_0xeed4('0x8a')](_0x7a6dc8(_0x63afef,_0x4a28fc[_0xa5897e]));}}}}}return Promise[_0xeed4('0x8d')](_0x2ac160);})[_0xeed4('0xa')](function(_0x43aa41){var _0x2bdf6c=_0x43aa41;var _0x544c15=null;if(_0x2bdf6c){_0x544c15=_0x2bdf6c['length']===0x1?_0x2bdf6c[0x0]:null;}if(!_0x544c15&&!_0x2bdf6c)return _0x389563;var _0x35e115=_0x2f64fa[_0x23afbb[_0xeed4('0x13')]][_0xeed4('0x90')];_0x354bf0[_0xeed4('0x9')]=_[_0xeed4('0x91')](_0x35e115);_0x354bf0[_0xeed4('0x82')]=_[_0xeed4('0x91')](_0x355564['query']);_0x354bf0['filters']=_[_0xeed4('0x92')](_0x354bf0['model'],_0x354bf0['query']);_0xf95c2f[_0xeed4('0x93')]=_['intersection'](_0x354bf0['model'],qs[_0xeed4('0x94')](_0x355564[_0xeed4('0x82')][_0xeed4('0x94')]));_0xf95c2f[_0xeed4('0x93')]=_0xf95c2f['attributes']['length']?_0xf95c2f['attributes']:_0x354bf0[_0xeed4('0x9')];if(!_0x355564[_0xeed4('0x82')][_0xeed4('0x95')](_0xeed4('0x96'))){_0xf95c2f[_0xeed4('0x97')]=qs['limit'](_0x355564[_0xeed4('0x82')][_0xeed4('0x97')]);_0xf95c2f['offset']=qs[_0xeed4('0x98')](_0x355564[_0xeed4('0x82')][_0xeed4('0x98')]);}_0xf95c2f[_0xeed4('0x99')]=qs[_0xeed4('0x9a')](_0x355564['query'][_0xeed4('0x9a')]);_0xf95c2f['where']=qs[_0xeed4('0x9b')](_[_0xeed4('0x9c')](_0x355564['query'],_0x354bf0[_0xeed4('0x9b')]));if(_0x355564[_0xeed4('0x82')][_0xeed4('0x3')]){_0xf95c2f[_0xeed4('0x80')]=_[_0xeed4('0x9d')](_0xf95c2f[_0xeed4('0x80')],{'$or':_[_0xeed4('0xf')](_0x35e115,function(_0x520028){if(_0x520028[_0xeed4('0x11')][_0xeed4('0x9e')]!==_0xeed4('0x9f')){var _0x2c9ff8={};_0x2c9ff8[_0x520028[_0xeed4('0x8')]]={'$like':'%'+_0x355564[_0xeed4('0x82')][_0xeed4('0x3')]+'%'};return _0x2c9ff8;}})});}var _0x926da0=[];var _0x24fc5d=null;var _0x250abc={};if(_0x544c15){_0x24fc5d=_[_0xeed4('0x8b')](_0x880993,['name',_0x544c15[_0xeed4('0xb')]]);if(_0x24fc5d[_0xeed4('0x8')]){_0x250abc={};if(_0x23afbb[_0xeed4('0x13')]===_0xeed4('0xe')){_0x250abc[_0x24fc5d[_0xeed4('0xa0')]]=_[_0xeed4('0xf')](_0x544c15[_0xeed4('0x6')],'id');}else{_0x250abc[_0x24fc5d['foreignKey']]=_0x544c15[_0xeed4('0x6')];}_0x926da0[_0xeed4('0x8a')](_0x250abc);}else{_0xf95c2f[_0xeed4('0x80')]['id']=_0x544c15[_0xeed4('0x6')];}}else{for(var _0x474697=0x0;_0x474697<_0x2bdf6c[_0xeed4('0x89')];_0x474697++){_0x24fc5d=_[_0xeed4('0x8b')](_0x880993,[_0xeed4('0xb'),_0x2bdf6c[_0x474697][_0xeed4('0xb')]]);if(_0x24fc5d[_0xeed4('0x8')]){_0x250abc={};_0x250abc[_0x24fc5d['foreignKey']]=_0x2bdf6c[_0x474697][_0xeed4('0x6')];_0x926da0[_0xeed4('0x8a')](_0x250abc);}else{if(!_0xf95c2f[_0xeed4('0x80')]['id'])_0xf95c2f[_0xeed4('0x80')]['id']=[];_0x2bdf6c[_0x474697][_0xeed4('0x6')][_0xeed4('0xa1')](function(_0x33bef5){_0xf95c2f[_0xeed4('0x80')]['id'][_0xeed4('0x8a')](_0x33bef5);});}}}if(!_[_0xeed4('0x88')](_0x926da0)){_0xf95c2f[_0xeed4('0x80')]=_[_0xeed4('0x9d')](_0xf95c2f[_0xeed4('0x80')],{'$and':{'$or':_0x926da0}});}_0xf95c2f=_['merge']({},_0xf95c2f,_0x355564['options']);if(_0x544c15&&!_0x544c15[_0xeed4('0x8f')]&&_0x23afbb[_0xeed4('0x13')]==='AnalyticExtractedReport'){if(_0x355564[_0xeed4('0x82')][_0xeed4('0xa2')]){_0xf95c2f[_0xeed4('0xa3')]=[{'all':!![]}];}return _0x2f64fa[_0x23afbb[_0xeed4('0x13')]][_0xeed4('0x5')](_0xf95c2f)[_0xeed4('0xa')](function(_0x55586b){var _0x40a909=[];_0x55586b[_0xeed4('0xa1')](function(_0x11d157){var _0x4801e7;switch(_0x11d157[_0xeed4('0xa4')]){case _0xeed4('0xa5'):_0x4801e7=_['find'](_0x544c15[_0xeed4('0x6')],function(_0x3f7055){return _0x3f7055['id']===_0x11d157[_0xeed4('0xa6')]&&_0x3f7055['type']===_0xeed4('0xa7');});break;case _0xeed4('0xa8'):_0x4801e7=_['find'](_0x544c15[_0xeed4('0x6')],function(_0x38dac9){return _0x38dac9['id']===_0x11d157[_0xeed4('0xa6')]&&_0x38dac9[_0xeed4('0x11')]===_0xeed4('0xa9');});break;}if(_0x4801e7)_0x40a909[_0xeed4('0x8a')](_0x11d157);});_0x389563[_0xeed4('0xaa')]=_0x40a909[_0xeed4('0x89')];_0x389563[_0xeed4('0xab')]=_0x40a909;return _0x389563;});}else{if(!_[_0xeed4('0x88')](_0x355564[_0xeed4('0x82')][_0xeed4('0xac')])){_0xf95c2f[_0xeed4('0x80')]['id']=_0xf95c2f[_0xeed4('0x80')]['id']?_['intersection'](_0xf95c2f[_0xeed4('0x80')]['id'],_0x355564[_0xeed4('0x82')][_0xeed4('0xac')]):_0x355564['query']['ids'];if(_0x355564[_0xeed4('0x82')]['customSorting']){_0xf95c2f[_0xeed4('0x99')]=_0x355564['query'][_0xeed4('0xad')];}}if(_0x355564[_0xeed4('0x82')][_0xeed4('0xae')]){_0xf95c2f[_0xeed4('0x80')]=_[_0xeed4('0x9d')](_0xf95c2f['where'],{'$and':_0x355564[_0xeed4('0x82')][_0xeed4('0xae')]});}return _0x2f64fa[_0x23afbb[_0xeed4('0x13')]][_0xeed4('0xaa')]({'where':_0xf95c2f['where']})['then'](function(_0xbfc457){_0x389563[_0xeed4('0xaa')]=_0xbfc457;if(_0x355564['query']['includeAll']){if(_0x23afbb[_0xeed4('0x13')]===_0xeed4('0xaf')){_0xf95c2f[_0xeed4('0xa3')]=[{'model':_0x2f64fa[_0xeed4('0xb0')],'as':_0xeed4('0xb1'),'attributes':['id','name',_0xeed4('0xb2')],'required':_0x355564[_0xeed4('0x82')][_0xeed4('0xb3')]?!![]:![]},{'model':_0x2f64fa[_0xeed4('0xb0')],'as':_0xeed4('0xb4'),'attributes':['id',_0xeed4('0xb'),_0xeed4('0xb2')],'through':_0x355564[_0xeed4('0x82')][_0xeed4('0xb3')]?{'attributes':[],'where':{'TagId':_0x355564[_0xeed4('0x82')][_0xeed4('0xb3')]||undefined}}:{},'required':_0x355564[_0xeed4('0x82')][_0xeed4('0xb3')]?!![]:![]}];}else{_0xf95c2f['include']=[{'all':!![]}];}}return _0x2f64fa[_0x23afbb[_0xeed4('0x13')]][_0xeed4('0x5')](_0xf95c2f);})[_0xeed4('0xa')](function(_0x55819f){_0x389563[_0xeed4('0xab')]=_0x55819f;if(_0x294b2d==='Agents'&&_0x355564['query'][_0xeed4('0xb5')]===_0xeed4('0xb6')){var _0x175b4d=[];for(var _0x380fca=0x0;_0x380fca<_0x389563[_0xeed4('0xab')][_0xeed4('0x89')];_0x380fca++){_0x175b4d[_0xeed4('0x8a')](_0x1ba261(_0xeed4('0xb7'),_0x389563[_0xeed4('0xab')][_0x380fca]['dataValues']));_0x175b4d['push'](_0x1ba261(_0xeed4('0xb8'),_0x389563[_0xeed4('0xab')][_0x380fca][_0xeed4('0xb9')]));_0x175b4d[_0xeed4('0x8a')](_0x1ba261(_0xeed4('0xba'),_0x389563['rows'][_0x380fca][_0xeed4('0xb9')]));_0x175b4d['push'](_0x1ba261(_0xeed4('0xbb'),_0x389563[_0xeed4('0xab')][_0x380fca][_0xeed4('0xb9')]));_0x175b4d['push'](_0x1ba261(_0xeed4('0xbc'),_0x389563[_0xeed4('0xab')][_0x380fca]['dataValues']));_0x175b4d[_0xeed4('0x8a')](_0x1ba261(_0xeed4('0xbd'),_0x389563[_0xeed4('0xab')][_0x380fca][_0xeed4('0xb9')]));}return Promise[_0xeed4('0x8d')](_0x175b4d)[_0xeed4('0xa')](function(){return _0x389563;});}return _0x389563;});}});}}});}; \ No newline at end of file +var _0xaf77=['lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','Agents','User','role','Telephones','membername','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','QueueCampaigns','users','agents','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','metrics','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','ignore','union','length','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filters','merge','VIRTUAL','foreignKey','forEach','options','include','default','reportId','DefaultReports','custom','CustomReports','rows','ids','customSorting','count','Tags','color','ThroughTags','tag','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','filter','value','findAll','associatedResources','map','catch','field','model','then','name','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','ListId'];(function(_0x233e6f,_0x4019ac){var _0x1deeb0=function(_0x43f942){while(--_0x43f942){_0x233e6f['push'](_0x233e6f['shift']());}};_0x1deeb0(++_0x4019ac);}(_0xaf77,0xa0));var _0x7af7=function(_0x379ca9,_0x268f7f){_0x379ca9=_0x379ca9-0x0;var _0x8c3467=_0xaf77[_0x379ca9];return _0x8c3467;};'use strict';var _=require('lodash');var attributes=require(_0x7af7('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0x7af7('0x1'));module[_0x7af7('0x2')]=function(_0x5c8b97){var _0x4936e5=_0x5c8b97['models'];function _0x46d93f(_0x33fc87,_0x4a7882){return new Promise(function(_0x6f1f90,_0x49eef6){if(!_0x4a7882)return _0x6f1f90(null);var _0x311ca2=_0x4a7882[_0x7af7('0x3')]?{[_0x4a7882['filter']['field']]:_0x4a7882[_0x7af7('0x3')][_0x7af7('0x4')]}:undefined;return _0x4936e5[_0x33fc87][_0x7af7('0x5')]({'where':_0x311ca2,'raw':!![]})['then'](function(_0x2330e4){_0x4a7882[_0x7af7('0x6')]=_[_0x7af7('0x7')](_0x2330e4,'id');_0x6f1f90(_0x4a7882);})[_0x7af7('0x8')](function(_0x2e99ed){_0x49eef6(_0x2e99ed);});});}function _0x17083b(_0x36f653,_0x3db663){return new Promise(function(_0x588644,_0x483a80){var _0x5f1863=_0x36f653['filter']?{[_0x36f653['filter'][_0x7af7('0x9')]]:_0x36f653[_0x7af7('0x3')][_0x7af7('0x4')]}:undefined;return _0x4936e5[_0x36f653[_0x7af7('0xa')]][_0x7af7('0x5')]({'where':_0x5f1863,'raw':!![]})[_0x7af7('0xb')](function(_0x36184a){_0x3db663[_0x7af7('0x6')]=_[_0x7af7('0x7')](_0x36184a,function(_0x2a3aa1){return _0x2a3aa1[_0x7af7('0xc')];});_0x588644(_0x3db663);})['catch'](function(_0x138bf6){_0x483a80(_0x138bf6);});});}function _0xb5b66e(_0x27aeef,_0x15af7a,_0x208137){if(!_0x15af7a)return Promise[_0x7af7('0xd')](null);return new Promise(function(_0x1e7e70,_0x3c5834){return _0x4936e5['UserProfileResource'][_0x7af7('0x5')]({'where':{'sectionId':_0x15af7a['id']},'raw':!![]})['then'](function(_0x152779){if(_0x27aeef[_0x7af7('0x9')]&&_0x27aeef[_0x7af7('0x9')]!=='id'){_0x15af7a['associatedResources']=_[_0x7af7('0x7')](_0x152779,function(_0x5a4c0d){return _0x5a4c0d[_0x27aeef[_0x7af7('0x9')]];});}else{if(_0x208137===_0x7af7('0xe')){_0x15af7a[_0x7af7('0x6')]=_[_0x7af7('0x7')](_0x152779,function(_0x16b6ac){return{'id':_0x16b6ac[_0x7af7('0xf')],'type':_0x16b6ac[_0x7af7('0x10')]};});}else{_0x15af7a[_0x7af7('0x6')]=_[_0x7af7('0x7')](_0x152779,function(_0x10a8b5){return _0x10a8b5[_0x7af7('0xf')];});}}_0x1e7e70(_0x15af7a);})[_0x7af7('0x8')](function(_0x5f429d){_0x3c5834(_0x5f429d);});});}function _0x5a2a98(_0x440352,_0x103faf){var _0x2462d7={'parentSections':[]};switch(_0x440352[_0x7af7('0x11')]()){case _0x7af7('0x12'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x14');break;case _0x7af7('0x15'):_0x2462d7['childModel']='SquareOdbc';break;case _0x7af7('0x16'):_0x2462d7['childModel']='SquareRecording';_0x2462d7['parentSections']=[{'name':'SquareProjects','field':_0x7af7('0xc'),'foreignKey':_0x7af7('0x17')}];break;case _0x7af7('0x18'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x19');break;case _0x7af7('0x1a'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x1b');_0x2462d7[_0x7af7('0x1c')]=[{'name':_0x7af7('0x1d'),'field':'id','foreignKey':_0x7af7('0x1e')}];break;case _0x7af7('0x1f'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x20');break;case _0x7af7('0x21'):_0x2462d7['childModel']=_0x7af7('0x22');break;case'globalcustomfields':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x23');break;case _0x7af7('0x24'):_0x2462d7['childModel']=_0x7af7('0x25');break;case'chatwebsites':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x26');break;case _0x7af7('0x27'):_0x2462d7['childModel']=_0x7af7('0x28');break;case _0x7af7('0x29'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x2a');break;case'inboundroutes':case _0x7af7('0x2b'):case'outboundroutes':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x2c');break;case _0x7af7('0x2d'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x2e');break;case _0x7af7('0x2f'):_0x2462d7[_0x7af7('0x13')]='VoiceMail';break;case _0x7af7('0x30'):_0x2462d7[_0x7af7('0x13')]='VoiceRecording';_0x2462d7[_0x7af7('0x1c')]=[{'name':_0x7af7('0x31'),'field':'name','foreignKey':'membername','model':_0x7af7('0x32'),'filter':{'field':_0x7af7('0x33'),'value':['agent']}},{'name':_0x7af7('0x34'),'field':_0x7af7('0xc'),'foreignKey':_0x7af7('0x35'),'model':_0x7af7('0x32'),'filter':{'field':'role','value':['telephone']}},{'name':_0x7af7('0x36'),'field':_0x7af7('0xc'),'foreignKey':_0x7af7('0x37'),'model':_0x7af7('0x38'),'filter':{'field':_0x7af7('0x10'),'value':[_0x7af7('0x39')]}},{'name':'QueueCampaigns','field':_0x7af7('0xc'),'foreignKey':'queue','model':_0x7af7('0x38'),'filter':{'field':_0x7af7('0x10'),'value':[_0x7af7('0x3a')]}}];break;case _0x7af7('0x3b'):_0x2462d7['childModel']=_0x7af7('0x3c');break;case'chanspies':_0x2462d7['childModel']='VoiceChanSpy';break;case _0x7af7('0x3d'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x3e');break;case _0x7af7('0x3f'):_0x2462d7['childModel']=_0x7af7('0x40');break;case _0x7af7('0x41'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x42');break;case _0x7af7('0x43'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x44');break;case _0x7af7('0x45'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x46');break;case _0x7af7('0x47'):_0x2462d7['childModel']='OpenchannelQueue';break;case _0x7af7('0x48'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x49');break;case _0x7af7('0x4a'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x4b');break;case _0x7af7('0x4c'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x4d');break;case'whatsappqueues':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x4e');break;case _0x7af7('0x4f'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x50');break;case _0x7af7('0x51'):_0x2462d7['childModel']='Team';break;case _0x7af7('0x52'):case _0x7af7('0x53'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x38');if(_0x103faf){_0x2462d7[_0x7af7('0x1c')]=[{'name':_0x7af7('0x36')},{'name':_0x7af7('0x54')}];}break;case _0x7af7('0x55'):case _0x7af7('0x56'):case'telephones':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x32');if(_0x103faf){_0x2462d7[_0x7af7('0x1c')]=[{'name':'Users','filter':{'field':_0x7af7('0x33'),'value':['admin',_0x7af7('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':_0x7af7('0x34')}];}break;case'zendeskaccounts':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x58');break;case _0x7af7('0x59'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x5a');break;case'freshdeskaccounts':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x5b');break;case'sugarcrmaccounts':_0x2462d7['childModel']=_0x7af7('0x5c');break;case _0x7af7('0x5d'):_0x2462d7['childModel']=_0x7af7('0x5e');break;case _0x7af7('0x5f'):_0x2462d7[_0x7af7('0x13')]='ZohoAccount';break;case'vtigeraccounts':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x32');break;case _0x7af7('0x60'):_0x2462d7['childModel']='CannedAnswer';break;case'dispositions':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x61');break;case _0x7af7('0x62'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x63');break;case _0x7af7('0x64'):_0x2462d7[_0x7af7('0x13')]='Interval';break;case _0x7af7('0x65'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x66');break;case'scheduler':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x67');break;case _0x7af7('0x68'):_0x2462d7['childModel']=_0x7af7('0x69');break;case _0x7af7('0x6a'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x6b');break;case _0x7af7('0x6c'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x6d');break;case _0x7af7('0x6e'):_0x2462d7[_0x7af7('0x13')]='Trigger';break;case _0x7af7('0x6f'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x70');break;case _0x7af7('0x71'):_0x2462d7[_0x7af7('0x13')]='Variable';break;case _0x7af7('0x72'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x73');break;case _0x7af7('0x74'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0xe');_0x2462d7[_0x7af7('0x1c')]=[{'name':_0x7af7('0x75'),'field':'id','foreignKey':'reportId'}];break;case _0x7af7('0x76'):_0x2462d7[_0x7af7('0x13')]='AnalyticMetric';break;}return _0x2462d7;}function _0x28c200(_0x10cc25,_0xe5bafa){var _0x223ccc=_0x10cc25['charAt'](0x0)[_0x7af7('0x77')]()+_0x10cc25[_0x7af7('0x78')](0x1);var _0x588fa7={'type':_0x4936e5[_0x7af7('0x79')]['QueryTypes'][_0x7af7('0x7a')],'raw':!![]};return new Promise(function(_0x342085,_0x139ccb){var _0x4e402f=squel[_0x7af7('0x7b')]()['field'](_0x7af7('0x7c')+_0x223ccc+_0x7af7('0x7d'),'id')[_0x7af7('0x9')](_0x7af7('0x7e'))[_0x7af7('0x7f')](_0x7af7('0x80')+_0x10cc25+_0x7af7('0x81'),'ui')[_0x7af7('0x82')](_0x7af7('0x83'),_0xe5bafa['id']);return _0x4936e5['sequelize'][_0x7af7('0x84')](_0x4e402f[_0x7af7('0x85')](),_0x588fa7)[_0x7af7('0xb')](function(_0x5b13ad){_0xe5bafa[_0x223ccc+_0x7af7('0x86')]=_0x5b13ad;_0x342085(_0x5b13ad);})[_0x7af7('0x8')](function(_0x407294){_0x139ccb(_0x407294);});});}return _0x5c8b97[_0x7af7('0x87')](_0x7af7('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x89b986){var _0x206106={'raw':_0x89b986[_0x7af7('0x84')][_0x7af7('0x89')],'where':{}};var _0x1ffe78={};var _0x5a04d3={'count':0x0,'rows':[]};var _0x59c72c=_0x89b986[_0x7af7('0x84')][_0x7af7('0x8a')];var _0x48e53d=_0x89b986[_0x7af7('0x84')][_0x7af7('0x8b')]||![];var _0x45cd13=_0x5a2a98(_0x59c72c,_0x48e53d);if(!_0x45cd13['childModel'])throw new Error(_0x7af7('0x8c')+_0x59c72c+'\x27');var _0x72dd2=[{'name':_0x59c72c}];if(!_[_0x7af7('0x8d')](_0x45cd13['parentSections']))_0x72dd2=_0x45cd13[_0x7af7('0x1c')];var _0x1e59e1=[];for(var _0x5ce9ec=0x0;_0x5ce9ec<_0x72dd2['length'];_0x5ce9ec++){_0x1e59e1[_0x7af7('0x8e')](_0x4936e5[_0x7af7('0x8f')][_0x7af7('0x90')]({'where':{'userProfileId':_0x89b986[_0x7af7('0x91')]['id'],'name':_0x72dd2[_0x5ce9ec][_0x7af7('0xc')]},'raw':!![]}));}return Promise[_0x7af7('0x92')](_0x1e59e1)[_0x7af7('0xb')](function(_0x21b095){var _0x100c9e=_[_0x7af7('0x3')](_0x21b095,function(_0x5d6c86){return _0x5d6c86?_0x5d6c86:undefined;});var _0x2cf52b=_[_0x7af7('0x3')](_0x72dd2,[_0x7af7('0x93'),!![]]);var _0x46ddcd=_[_0x7af7('0x8d')](_0x100c9e)&&_[_0x7af7('0x8d')](_0x2cf52b)?null:_[_0x7af7('0x94')](_0x2cf52b,_0x100c9e);if(!_0x46ddcd)return null;var _0x3ce52e=[];for(var _0x426cde=0x0;_0x426cde<_0x46ddcd[_0x7af7('0x95')];_0x426cde++){var _0x5a0400=_[_0x7af7('0x90')](_0x72dd2,function(_0x8e1a0f){return _0x46ddcd[_0x426cde]?_0x8e1a0f[_0x7af7('0xc')]===_0x46ddcd[_0x426cde][_0x7af7('0xc')]:null;});if(_0x5a0400){if(_0x46ddcd[_0x426cde][_0x7af7('0x93')]){_0x3ce52e[_0x7af7('0x8e')](_0x46d93f(_0x45cd13[_0x7af7('0x13')],_0x46ddcd[_0x426cde]));}else{if(!_0x46ddcd[_0x426cde][_0x7af7('0x96')]){_0x3ce52e[_0x7af7('0x8e')](_0xb5b66e(_0x5a0400,_0x46ddcd[_0x426cde],_0x45cd13[_0x7af7('0x13')]));}else{if(_0x5a0400[_0x7af7('0xa')]){_0x3ce52e[_0x7af7('0x8e')](_0x17083b(_0x5a0400,_0x46ddcd[_0x426cde]));}}}}}return Promise['all'](_0x3ce52e);})[_0x7af7('0xb')](function(_0x5ddd3b){var _0x300ca3=_0x5ddd3b;var _0x355fc8=null;if(_0x300ca3){_0x355fc8=_0x300ca3[_0x7af7('0x95')]===0x1?_0x300ca3[0x0]:null;}if(!_0x355fc8&&!_0x300ca3)return _0x5a04d3;var _0x1c7073=_0x4936e5[_0x45cd13[_0x7af7('0x13')]][_0x7af7('0x97')];_0x1ffe78['model']=_[_0x7af7('0x98')](_0x1c7073);_0x1ffe78['query']=_[_0x7af7('0x98')](_0x89b986['query']);_0x1ffe78['filters']=_[_0x7af7('0x99')](_0x1ffe78[_0x7af7('0xa')],_0x1ffe78[_0x7af7('0x84')]);_0x206106[_0x7af7('0x9a')]=_['intersection'](_0x1ffe78[_0x7af7('0xa')],qs[_0x7af7('0x9b')](_0x89b986['query'][_0x7af7('0x9b')]));_0x206106[_0x7af7('0x9a')]=_0x206106['attributes'][_0x7af7('0x95')]?_0x206106[_0x7af7('0x9a')]:_0x1ffe78[_0x7af7('0xa')];if(!_0x89b986[_0x7af7('0x84')][_0x7af7('0x9c')](_0x7af7('0x9d'))){_0x206106[_0x7af7('0x9e')]=qs[_0x7af7('0x9e')](_0x89b986[_0x7af7('0x84')][_0x7af7('0x9e')]);_0x206106[_0x7af7('0x9f')]=qs['offset'](_0x89b986[_0x7af7('0x84')][_0x7af7('0x9f')]);}_0x206106[_0x7af7('0xa0')]=qs[_0x7af7('0xa1')](_0x89b986['query'][_0x7af7('0xa1')]);_0x206106[_0x7af7('0x82')]=qs['filters'](_[_0x7af7('0xa2')](_0x89b986[_0x7af7('0x84')],_0x1ffe78[_0x7af7('0xa3')]));if(_0x89b986[_0x7af7('0x84')][_0x7af7('0x3')]){_0x206106[_0x7af7('0x82')]=_[_0x7af7('0xa4')](_0x206106[_0x7af7('0x82')],{'$or':_[_0x7af7('0x7')](_0x1c7073,function(_0x2ec015){if(_0x2ec015[_0x7af7('0x10')]['key']!==_0x7af7('0xa5')){var _0x1712c1={};_0x1712c1[_0x2ec015['field']]={'$like':'%'+_0x89b986[_0x7af7('0x84')][_0x7af7('0x3')]+'%'};return _0x1712c1;}})});}var _0x6eb663=[];var _0x2d80b1=null;var _0x4b492b={};if(_0x355fc8){_0x2d80b1=_[_0x7af7('0x90')](_0x72dd2,[_0x7af7('0xc'),_0x355fc8[_0x7af7('0xc')]]);if(_0x2d80b1['field']){_0x4b492b={};if(_0x45cd13['childModel']==='AnalyticExtractedReport'){_0x4b492b[_0x2d80b1['foreignKey']]=_[_0x7af7('0x7')](_0x355fc8[_0x7af7('0x6')],'id');}else{_0x4b492b[_0x2d80b1[_0x7af7('0xa6')]]=_0x355fc8[_0x7af7('0x6')];}_0x6eb663[_0x7af7('0x8e')](_0x4b492b);}else{_0x206106['where']['id']=_0x355fc8[_0x7af7('0x6')];}}else{for(var _0x38487a=0x0;_0x38487a<_0x300ca3[_0x7af7('0x95')];_0x38487a++){_0x2d80b1=_[_0x7af7('0x90')](_0x72dd2,[_0x7af7('0xc'),_0x300ca3[_0x38487a][_0x7af7('0xc')]]);if(_0x2d80b1[_0x7af7('0x9')]){_0x4b492b={};_0x4b492b[_0x2d80b1['foreignKey']]=_0x300ca3[_0x38487a][_0x7af7('0x6')];_0x6eb663[_0x7af7('0x8e')](_0x4b492b);}else{if(!_0x206106['where']['id'])_0x206106[_0x7af7('0x82')]['id']=[];_0x300ca3[_0x38487a][_0x7af7('0x6')][_0x7af7('0xa7')](function(_0x271103){_0x206106[_0x7af7('0x82')]['id'][_0x7af7('0x8e')](_0x271103);});}}}if(!_[_0x7af7('0x8d')](_0x6eb663)){_0x206106[_0x7af7('0x82')]=_[_0x7af7('0xa4')](_0x206106[_0x7af7('0x82')],{'$and':{'$or':_0x6eb663}});}_0x206106=_[_0x7af7('0xa4')]({},_0x206106,_0x89b986[_0x7af7('0xa8')]);if(_0x355fc8&&!_0x355fc8[_0x7af7('0x96')]&&_0x45cd13['childModel']===_0x7af7('0xe')){if(_0x89b986['query']['includeAll']){_0x206106[_0x7af7('0xa9')]=[{'all':!![]}];}return _0x4936e5[_0x45cd13[_0x7af7('0x13')]][_0x7af7('0x5')](_0x206106)[_0x7af7('0xb')](function(_0x3eb662){var _0x555e89=[];_0x3eb662[_0x7af7('0xa7')](function(_0x549a6e){var _0x397e76;switch(_0x549a6e['reportType']){case _0x7af7('0xaa'):_0x397e76=_[_0x7af7('0x90')](_0x355fc8['associatedResources'],function(_0x329bbf){return _0x329bbf['id']===_0x549a6e[_0x7af7('0xab')]&&_0x329bbf[_0x7af7('0x10')]===_0x7af7('0xac');});break;case _0x7af7('0xad'):_0x397e76=_[_0x7af7('0x90')](_0x355fc8[_0x7af7('0x6')],function(_0x2e70e6){return _0x2e70e6['id']===_0x549a6e[_0x7af7('0xab')]&&_0x2e70e6['type']===_0x7af7('0xae');});break;}if(_0x397e76)_0x555e89[_0x7af7('0x8e')](_0x549a6e);});_0x5a04d3['count']=_0x555e89[_0x7af7('0x95')];_0x5a04d3[_0x7af7('0xaf')]=_0x555e89;return _0x5a04d3;});}else{if(!_[_0x7af7('0x8d')](_0x89b986[_0x7af7('0x84')][_0x7af7('0xb0')])){_0x206106[_0x7af7('0x82')]['id']=_0x206106[_0x7af7('0x82')]['id']?_[_0x7af7('0x99')](_0x206106['where']['id'],_0x89b986[_0x7af7('0x84')][_0x7af7('0xb0')]):_0x89b986[_0x7af7('0x84')][_0x7af7('0xb0')];if(_0x89b986['query'][_0x7af7('0xb1')]){_0x206106[_0x7af7('0xa0')]=_0x89b986[_0x7af7('0x84')][_0x7af7('0xb1')];}}if(_0x89b986['query']['extraQueryConditions']){_0x206106[_0x7af7('0x82')]=_['merge'](_0x206106['where'],{'$and':_0x89b986[_0x7af7('0x84')]['extraQueryConditions']});}return _0x4936e5[_0x45cd13[_0x7af7('0x13')]][_0x7af7('0xb2')]({'where':_0x206106['where']})[_0x7af7('0xb')](function(_0x27412c){_0x5a04d3['count']=_0x27412c;if(_0x89b986['query']['includeAll']){if(_0x45cd13['childModel']===_0x7af7('0x1b')){_0x206106[_0x7af7('0xa9')]=[{'model':_0x4936e5[_0x7af7('0x6b')],'as':_0x7af7('0xb3'),'attributes':['id','name',_0x7af7('0xb4')],'required':_0x89b986[_0x7af7('0x84')]['tag']?!![]:![]},{'model':_0x4936e5[_0x7af7('0x6b')],'as':_0x7af7('0xb5'),'attributes':['id',_0x7af7('0xc'),'color'],'through':_0x89b986[_0x7af7('0x84')][_0x7af7('0xb6')]?{'attributes':[],'where':{'TagId':_0x89b986[_0x7af7('0x84')][_0x7af7('0xb6')]||undefined}}:{},'required':_0x89b986[_0x7af7('0x84')][_0x7af7('0xb6')]?!![]:![]}];}else{_0x206106[_0x7af7('0xa9')]=[{'all':!![]}];}}return _0x4936e5[_0x45cd13['childModel']][_0x7af7('0x5')](_0x206106);})[_0x7af7('0xb')](function(_0x2ee73d){_0x5a04d3[_0x7af7('0xaf')]=_0x2ee73d;if(_0x59c72c==='Agents'&&_0x89b986[_0x7af7('0x84')][_0x7af7('0xb7')]==='true'){var _0x2a7e71=[];for(var _0x278bac=0x0;_0x278bac<_0x5a04d3[_0x7af7('0xaf')][_0x7af7('0x95')];_0x278bac++){_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xb8'),_0x5a04d3[_0x7af7('0xaf')][_0x278bac][_0x7af7('0xb9')]));_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xba'),_0x5a04d3[_0x7af7('0xaf')][_0x278bac][_0x7af7('0xb9')]));_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xbb'),_0x5a04d3[_0x7af7('0xaf')][_0x278bac]['dataValues']));_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xbc'),_0x5a04d3['rows'][_0x278bac][_0x7af7('0xb9')]));_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xbd'),_0x5a04d3[_0x7af7('0xaf')][_0x278bac][_0x7af7('0xb9')]));_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xbe'),_0x5a04d3[_0x7af7('0xaf')][_0x278bac][_0x7af7('0xb9')]));}return Promise['all'](_0x2a7e71)[_0x7af7('0xb')](function(){return _0x5a04d3;});}return _0x5a04d3;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 35a8f64..398ac1f 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 _0x6144=['register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x1290cd,_0x3491b3){var _0x23d83d=function(_0x14550a){while(--_0x14550a){_0x1290cd['push'](_0x1290cd['shift']());}};_0x23d83d(++_0x3491b3);}(_0x6144,0x99));var _0x4614=function(_0x325d92,_0x5ec05f){_0x325d92=_0x325d92-0x0;var _0x268284=_0x6144[_0x325d92];return _0x268284;};'use strict';var _=require(_0x4614('0x0'));var util=require(_0x4614('0x1'));var moment=require(_0x4614('0x2'));var BPromise=require(_0x4614('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4614('0x4'));var db=require(_0x4614('0x5'))['db'];var utils=require(_0x4614('0x6'));var logger=require(_0x4614('0x7'))('rpc');var config=require(_0x4614('0x8'));var jayson=require(_0x4614('0x9'));var client=jayson[_0x4614('0xa')][_0x4614('0xb')]({'port':0x232a});config[_0x4614('0xc')]=_['defaults'](config[_0x4614('0xc')],{'host':_0x4614('0xd'),'port':0x18eb});var socket=require(_0x4614('0xe'))(new Redis(config[_0x4614('0xc')]));require('./userProfile.socket')[_0x4614('0xf')](socket);function respondWithRpcPromise(_0x3953bd,_0x7df8c,_0x3c339c){return new BPromise(function(_0x270e8d,_0x2b0439){return client[_0x4614('0x10')](_0x3953bd,_0x3c339c)['then'](function(_0x3f4202){logger[_0x4614('0x11')](_0x4614('0x12'),_0x7df8c,_0x4614('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x7df8c,_0x4614('0x13'),JSON[_0x4614('0x14')](_0x3f4202));if(_0x3f4202[_0x4614('0x15')]){if(_0x3f4202['error']['code']===0x1f4){logger['error'](_0x4614('0x12'),_0x7df8c,_0x3f4202[_0x4614('0x15')]['message']);return _0x2b0439(_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);}logger[_0x4614('0x15')]('UserProfile,\x20%s,\x20%s',_0x7df8c,_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);return _0x270e8d(_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);}else{logger[_0x4614('0x11')](_0x4614('0x12'),_0x7df8c,'request\x20sent');_0x270e8d(_0x3f4202[_0x4614('0x17')][_0x4614('0x16')]);}})['catch'](function(_0xb8c6fd){logger[_0x4614('0x15')](_0x4614('0x12'),_0x7df8c,_0xb8c6fd);_0x2b0439(_0xb8c6fd);});});} \ No newline at end of file +var _0xdbcd=['stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','socket.io-emitter','redis','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x5bb223,_0x64db26){_0x5bb223=_0x5bb223-0x0;var _0x15bae2=_0xdbcd[_0x5bb223];return _0x15bae2;};'use strict';var _=require(_0xddbc('0x0'));var util=require(_0xddbc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xddbc('0x2'));var fs=require('fs');var Redis=require(_0xddbc('0x3'));var db=require(_0xddbc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xddbc('0x5'))(_0xddbc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xddbc('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xddbc('0x8'))(new Redis(config[_0xddbc('0x9')]));require(_0xddbc('0xa'))[_0xddbc('0xb')](socket);function respondWithRpcPromise(_0x51d156,_0x4f90a9,_0x236a29){return new BPromise(function(_0x5e8424,_0x13b8f6){return client['request'](_0x51d156,_0x236a29)[_0xddbc('0xc')](function(_0x3a7f29){logger[_0xddbc('0xd')](_0xddbc('0xe'),_0x4f90a9,_0xddbc('0xf'));logger[_0xddbc('0x10')](_0xddbc('0x11'),_0x4f90a9,_0xddbc('0xf'),JSON[_0xddbc('0x12')](_0x3a7f29));if(_0x3a7f29[_0xddbc('0x13')]){if(_0x3a7f29[_0xddbc('0x13')][_0xddbc('0x14')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x4f90a9,_0x3a7f29[_0xddbc('0x13')][_0xddbc('0x15')]);return _0x13b8f6(_0x3a7f29['error']['message']);}logger[_0xddbc('0x13')](_0xddbc('0xe'),_0x4f90a9,_0x3a7f29[_0xddbc('0x13')][_0xddbc('0x15')]);return _0x5e8424(_0x3a7f29['error']['message']);}else{logger[_0xddbc('0xd')](_0xddbc('0xe'),_0x4f90a9,'request\x20sent');_0x5e8424(_0x3a7f29['result']['message']);}})[_0xddbc('0x16')](function(_0x48513e){logger[_0xddbc('0x13')](_0xddbc('0xe'),_0x4f90a9,_0x48513e);_0x13b8f6(_0x48513e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 2a7c731..b1d62fd 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 _0x8813=['emit','removeListener','userProfile:','remove','update'];(function(_0x18b940,_0x9644de){var _0x538f1c=function(_0x4c888f){while(--_0x4c888f){_0x18b940['push'](_0x18b940['shift']());}};_0x538f1c(++_0x9644de);}(_0x8813,0x139));var _0x3881=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8813[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x3881('0x0'),_0x3881('0x1')];function createListener(_0x4a17d5,_0x31f1e2){return function(_0x5b8a8c){_0x31f1e2[_0x3881('0x2')](_0x4a17d5,_0x5b8a8c);};}function removeListener(_0x50abbb,_0xa12c34){return function(){UserProfileEvents[_0x3881('0x3')](_0x50abbb,_0xa12c34);};}exports['register']=function(_0x1cebc8){for(var _0x3a71af=0x0,_0x2fc6b7=events['length'];_0x3a71af<_0x2fc6b7;_0x3a71af++){var _0x10c8cc=events[_0x3a71af];var _0x53295a=createListener(_0x3881('0x4')+_0x10c8cc,_0x1cebc8);UserProfileEvents['on'](_0x10c8cc,_0x53295a);}}; \ No newline at end of file +var _0x283a=['userProfile:','./userProfile.events','save','remove','removeListener','register','length'];(function(_0x18e896,_0x20d09b){var _0xfdd727=function(_0x258493){while(--_0x258493){_0x18e896['push'](_0x18e896['shift']());}};_0xfdd727(++_0x20d09b);}(_0x283a,0xf6));var _0xa283=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x283a[_0x3826ad];return _0x17b900;};'use strict';var UserProfileEvents=require(_0xa283('0x0'));var events=[_0xa283('0x1'),_0xa283('0x2'),'update'];function createListener(_0x36dc84,_0x22981f){return function(_0x2e99c4){_0x22981f['emit'](_0x36dc84,_0x2e99c4);};}function removeListener(_0x506419,_0x155346){return function(){UserProfileEvents[_0xa283('0x3')](_0x506419,_0x155346);};}exports[_0xa283('0x4')]=function(_0x3cd5c5){for(var _0x30ecda=0x0,_0x495d89=events[_0xa283('0x5')];_0x30ecda<_0x495d89;_0x30ecda++){var _0x36e10d=events[_0x30ecda];var _0x261da5=createListener(_0xa283('0x6')+_0x36e10d,_0x3cd5c5);UserProfileEvents['on'](_0x36e10d,_0x261da5);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index ff112ed..c07dc0e 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 _0x159c=['delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x159c,0x10c));var _0xc159=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x159c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc159('0x0'));var util=require(_0xc159('0x1'));var path=require(_0xc159('0x2'));var timeout=require(_0xc159('0x3'));var express=require(_0xc159('0x4'));var router=express[_0xc159('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc159('0x6'));var controller=require(_0xc159('0x7'));router[_0xc159('0x8')]('/',auth[_0xc159('0x9')](),controller[_0xc159('0xa')]);router['get'](_0xc159('0xb'),auth[_0xc159('0x9')](),controller[_0xc159('0xc')]);router[_0xc159('0x8')](_0xc159('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xc159('0xe')]('/',auth[_0xc159('0x9')](),controller[_0xc159('0xf')]);router['put']('/:id',auth[_0xc159('0x9')](),controller[_0xc159('0x10')]);router[_0xc159('0x11')]('/:id',auth[_0xc159('0x9')](),controller['destroy']);module[_0xc159('0x12')]=router; \ No newline at end of file +var _0xe92b=['isAuthenticated','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x29bcc3,_0x4dd6cc){var _0x1b6655=function(_0x4f1ddf){while(--_0x4f1ddf){_0x29bcc3['push'](_0x29bcc3['shift']());}};_0x1b6655(++_0x4dd6cc);}(_0xe92b,0xb2));var _0xbe92=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xe92b[_0x1a8bbc];return _0x212fc2;};'use strict';var multer=require(_0xbe92('0x0'));var util=require(_0xbe92('0x1'));var path=require(_0xbe92('0x2'));var timeout=require(_0xbe92('0x3'));var express=require('express');var router=express[_0xbe92('0x4')]();var fs_extra=require(_0xbe92('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbe92('0x6'));var config=require(_0xbe92('0x7'));var controller=require('./userProfileResource.controller');router[_0xbe92('0x8')]('/',auth[_0xbe92('0x9')](),controller['index']);router[_0xbe92('0x8')]('/describe',auth[_0xbe92('0x9')](),controller['describe']);router['get'](_0xbe92('0xa'),auth[_0xbe92('0x9')](),controller[_0xbe92('0xb')]);router[_0xbe92('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbe92('0xd')](_0xbe92('0xa'),auth['isAuthenticated'](),controller[_0xbe92('0xe')]);router[_0xbe92('0xf')](_0xbe92('0xa'),auth[_0xbe92('0x9')](),controller['destroy']);module[_0xbe92('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index be7597f..b5bce30 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 _0xa6bc=['sequelize','exports','STRING','INTEGER'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xa6bc,0x16c));var _0xca6b=function(_0x148bd2,_0x3338c6){_0x148bd2=_0x148bd2-0x0;var _0x38c56f=_0xa6bc[_0x148bd2];return _0x38c56f;};'use strict';var Sequelize=require(_0xca6b('0x0'));module[_0xca6b('0x1')]={'name':{'type':Sequelize[_0xca6b('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xca6b('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xca6b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7c92=['exports','STRING','INTEGER'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x7c92,0x150));var _0x27c9=function(_0x57da94,_0x432a4c){_0x57da94=_0x57da94-0x0;var _0x514aea=_0x7c92[_0x57da94];return _0x514aea;};'use strict';var Sequelize=require('sequelize');module[_0x27c9('0x0')]={'name':{'type':Sequelize[_0x27c9('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x27c9('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 2edc633..fa3bacb 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 _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1c860c,_0x1cf6b1){_0x1c860c=_0x1c860c-0x0;var _0x563247=_0x9f0e[_0x1c860c];return _0x563247;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['UserProfileResource'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['UserProfileResource'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['UserProfileResource'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file +var _0x1a37=['index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x1a37[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 991e25a..1d3a66c 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 _0x6630=['user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileResource'];(function(_0x47294a,_0x210b57){var _0x108840=function(_0xf14bc1){while(--_0xf14bc1){_0x47294a['push'](_0x47294a['shift']());}};_0x108840(++_0x210b57);}(_0x6630,0x84));var _0x0663=function(_0x3ce46b,_0x15f404){_0x3ce46b=_0x3ce46b-0x0;var _0x4c49fe=_0x6630[_0x3ce46b];return _0x4c49fe;};'use strict';var _=require(_0x0663('0x0'));var util=require(_0x0663('0x1'));var logger=require(_0x0663('0x2'))(_0x0663('0x3'));var moment=require(_0x0663('0x4'));var BPromise=require('bluebird');var rp=require(_0x0663('0x5'));var fs=require('fs');var path=require(_0x0663('0x6'));var rimraf=require(_0x0663('0x7'));var config=require(_0x0663('0x8'));var attributes=require('./userProfileResource.attributes');module[_0x0663('0x9')]=function(_0x1b5b4b,_0x5d8b83){return _0x1b5b4b[_0x0663('0xa')](_0x0663('0xb'),attributes,{'tableName':_0x0663('0xc'),'paranoid':![],'indexes':[{'name':_0x0663('0xd'),'fields':[_0x0663('0xe'),_0x0663('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bea=['resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','path','define','user_profile_has_resources','compositeIndex'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x4bea,0x7a));var _0xa4be=function(_0x259ccc,_0xa5fb99){_0x259ccc=_0x259ccc-0x0;var _0x353a33=_0x4bea[_0x259ccc];return _0x353a33;};'use strict';var _=require(_0xa4be('0x0'));var util=require(_0xa4be('0x1'));var logger=require(_0xa4be('0x2'))(_0xa4be('0x3'));var moment=require('moment');var BPromise=require(_0xa4be('0x4'));var rp=require(_0xa4be('0x5'));var fs=require('fs');var path=require(_0xa4be('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x7a144e,_0x51ef99){return _0x7a144e[_0xa4be('0x7')]('UserProfileResource',attributes,{'tableName':_0xa4be('0x8'),'paranoid':![],'indexes':[{'name':_0xa4be('0x9'),'fields':[_0xa4be('0xa'),_0xa4be('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 3f87e0b..a42e3d4 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 _0x67bb=['jayson/promise','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x52c5b4,_0x16defe){var _0xbd75b9=function(_0x194670){while(--_0x194670){_0x52c5b4['push'](_0x52c5b4['shift']());}};_0xbd75b9(++_0x16defe);}(_0x67bb,0xc6));var _0xb67b=function(_0x21328f,_0x6c0824){_0x21328f=_0x21328f-0x0;var _0x326291=_0x67bb[_0x21328f];return _0x326291;};'use strict';var _=require(_0xb67b('0x0'));var util=require('util');var moment=require(_0xb67b('0x1'));var BPromise=require(_0xb67b('0x2'));var rs=require(_0xb67b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb67b('0x4'))['db'];var utils=require(_0xb67b('0x5'));var logger=require(_0xb67b('0x6'))(_0xb67b('0x7'));var config=require(_0xb67b('0x8'));var jayson=require(_0xb67b('0x9'));var client=jayson['client'][_0xb67b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45c328,_0x139118,_0x5394ad){return new BPromise(function(_0x4cc39d,_0x5e4cd7){return client['request'](_0x45c328,_0x5394ad)[_0xb67b('0xb')](function(_0x1b3688){logger[_0xb67b('0xc')](_0xb67b('0xd'),_0x139118,_0xb67b('0xe'));logger[_0xb67b('0xf')](_0xb67b('0x10'),_0x139118,'request\x20sent',JSON[_0xb67b('0x11')](_0x1b3688));if(_0x1b3688[_0xb67b('0x12')]){if(_0x1b3688[_0xb67b('0x12')][_0xb67b('0x13')]===0x1f4){logger[_0xb67b('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x139118,_0x1b3688[_0xb67b('0x12')][_0xb67b('0x14')]);return _0x5e4cd7(_0x1b3688[_0xb67b('0x12')][_0xb67b('0x14')]);}logger[_0xb67b('0x12')](_0xb67b('0xd'),_0x139118,_0x1b3688[_0xb67b('0x12')]['message']);return _0x4cc39d(_0x1b3688['error']['message']);}else{logger[_0xb67b('0xc')](_0xb67b('0xd'),_0x139118,'request\x20sent');_0x4cc39d(_0x1b3688[_0xb67b('0x15')][_0xb67b('0x14')]);}})[_0xb67b('0x16')](function(_0xca1d63){logger[_0xb67b('0x12')](_0xb67b('0xd'),_0x139118,_0xca1d63);_0x5e4cd7(_0xca1d63);});});} \ No newline at end of file +var _0x93d9=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x39d3ce,_0x20c8a8){var _0xab780b=function(_0x3594f3){while(--_0x3594f3){_0x39d3ce['push'](_0x39d3ce['shift']());}};_0xab780b(++_0x20c8a8);}(_0x93d9,0xf7));var _0x993d=function(_0x130f5d,_0x422e9e){_0x130f5d=_0x130f5d-0x0;var _0x425398=_0x93d9[_0x130f5d];return _0x425398;};'use strict';var _=require('lodash');var util=require(_0x993d('0x0'));var moment=require(_0x993d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x993d('0x2'))['db'];var utils=require(_0x993d('0x3'));var logger=require(_0x993d('0x4'))('rpc');var config=require(_0x993d('0x5'));var jayson=require(_0x993d('0x6'));var client=jayson[_0x993d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23f050,_0x219fe3,_0x33bc7c){return new BPromise(function(_0x370c85,_0x19aeac){return client[_0x993d('0x8')](_0x23f050,_0x33bc7c)[_0x993d('0x9')](function(_0x4867b4){logger['info'](_0x993d('0xa'),_0x219fe3,_0x993d('0xb'));logger[_0x993d('0xc')](_0x993d('0xd'),_0x219fe3,_0x993d('0xb'),JSON[_0x993d('0xe')](_0x4867b4));if(_0x4867b4['error']){if(_0x4867b4[_0x993d('0xf')]['code']===0x1f4){logger[_0x993d('0xf')](_0x993d('0xa'),_0x219fe3,_0x4867b4[_0x993d('0xf')][_0x993d('0x10')]);return _0x19aeac(_0x4867b4['error'][_0x993d('0x10')]);}logger[_0x993d('0xf')](_0x993d('0xa'),_0x219fe3,_0x4867b4[_0x993d('0xf')][_0x993d('0x10')]);return _0x370c85(_0x4867b4[_0x993d('0xf')][_0x993d('0x10')]);}else{logger[_0x993d('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x219fe3,'request\x20sent');_0x370c85(_0x4867b4[_0x993d('0x12')][_0x993d('0x10')]);}})[_0x993d('0x13')](function(_0x1c50fc){logger[_0x993d('0xf')](_0x993d('0xa'),_0x219fe3,_0x1c50fc);_0x19aeac(_0x1c50fc);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 642ad7f..3e6a136 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 _0x8d10=['put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x19775d,_0x1a6776){var _0xdb2e24=function(_0x45a12e){while(--_0x45a12e){_0x19775d['push'](_0x19775d['shift']());}};_0xdb2e24(++_0x1a6776);}(_0x8d10,0xd0));var _0x08d1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8d10[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x08d1('0x0'));var timeout=require(_0x08d1('0x1'));var express=require(_0x08d1('0x2'));var router=express[_0x08d1('0x3')]();var fs_extra=require(_0x08d1('0x4'));var auth=require(_0x08d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x08d1('0x6'));var controller=require('./userProfileSection.controller');router[_0x08d1('0x7')]('/',auth[_0x08d1('0x8')](),controller['index']);router[_0x08d1('0x7')](_0x08d1('0x9'),auth[_0x08d1('0x8')](),controller['describe']);router[_0x08d1('0x7')](_0x08d1('0xa'),auth[_0x08d1('0x8')](),controller['show']);router[_0x08d1('0xb')]('/',auth['isAuthenticated'](),controller[_0x08d1('0xc')]);router[_0x08d1('0xd')](_0x08d1('0xa'),auth[_0x08d1('0x8')](),controller[_0x08d1('0xe')]);router[_0x08d1('0xf')](_0x08d1('0xa'),auth[_0x08d1('0x8')](),controller[_0x08d1('0x10')]);module['exports']=router; \ No newline at end of file +var _0xba86=['./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1574c7,_0xb0dac4){var _0x2b797e=function(_0x65d572){while(--_0x65d572){_0x1574c7['push'](_0x1574c7['shift']());}};_0x2b797e(++_0xb0dac4);}(_0xba86,0x128));var _0x6ba8=function(_0x5ad6b9,_0x13d6d4){_0x5ad6b9=_0x5ad6b9-0x0;var _0x4a42ca=_0xba86[_0x5ad6b9];return _0x4a42ca;};'use strict';var multer=require(_0x6ba8('0x0'));var util=require('util');var path=require(_0x6ba8('0x1'));var timeout=require('connect-timeout');var express=require(_0x6ba8('0x2'));var router=express[_0x6ba8('0x3')]();var fs_extra=require(_0x6ba8('0x4'));var auth=require(_0x6ba8('0x5'));var interaction=require(_0x6ba8('0x6'));var config=require(_0x6ba8('0x7'));var controller=require(_0x6ba8('0x8'));router[_0x6ba8('0x9')]('/',auth[_0x6ba8('0xa')](),controller[_0x6ba8('0xb')]);router[_0x6ba8('0x9')]('/describe',auth[_0x6ba8('0xa')](),controller[_0x6ba8('0xc')]);router[_0x6ba8('0x9')](_0x6ba8('0xd'),auth[_0x6ba8('0xa')](),controller['show']);router[_0x6ba8('0xe')]('/',auth['isAuthenticated'](),controller[_0x6ba8('0xf')]);router['put'](_0x6ba8('0xd'),auth[_0x6ba8('0xa')](),controller[_0x6ba8('0x10')]);router[_0x6ba8('0x11')](_0x6ba8('0xd'),auth[_0x6ba8('0xa')](),controller['destroy']);module[_0x6ba8('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index eb1c6e3..82c30fd 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 _0x0abf=['sequelize','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x5a7d39,_0x5e5668){var _0x4bcf8d=function(_0x1063d5){while(--_0x1063d5){_0x5a7d39['push'](_0x5a7d39['shift']());}};_0x4bcf8d(++_0x5e5668);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0ab('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xf0ab('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf0ab('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x7ea4e0){this[_0xf0ab('0x3')](_0xf0ab('0x4'),_0x7ea4e0?_0x7ea4e0[_0xf0ab('0x5')](''):[]);},'get':function(){return this[_0xf0ab('0x6')](_0xf0ab('0x4'))?this[_0xf0ab('0x6')]('crudPermissions')[_0xf0ab('0x7')](''):[];}}}; \ No newline at end of file +var _0x3c81=['join','getDataValue','sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions'];(function(_0x51c237,_0x45a050){var _0x54beb3=function(_0x4c1dd4){while(--_0x4c1dd4){_0x51c237['push'](_0x51c237['shift']());}};_0x54beb3(++_0x45a050);}(_0x3c81,0x102));var _0x13c8=function(_0x1fd668,_0xde7652){_0x1fd668=_0x1fd668-0x0;var _0x2e3d3e=_0x3c81[_0x1fd668];return _0x2e3d3e;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x13c8('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x548599){this[_0x13c8('0x4')](_0x13c8('0x5'),_0x548599?_0x548599[_0x13c8('0x6')](''):[]);},'get':function(){return this[_0x13c8('0x7')](_0x13c8('0x5'))?this[_0x13c8('0x7')](_0x13c8('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 49b709a..6f4ace1 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 _0xd133=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','rawAttributes','type','key','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','UserProfileSection','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2c5ec9,_0x497868){var _0x2ce268=function(_0x14cd42){while(--_0x14cd42){_0x2c5ec9['push'](_0x2c5ec9['shift']());}};_0x2ce268(++_0x497868);}(_0xd133,0x92));var _0x3d13=function(_0x2b72ef,_0x574981){_0x2b72ef=_0x2b72ef-0x0;var _0x56a161=_0xd133[_0x2b72ef];return _0x56a161;};'use strict';var emlformat=require(_0x3d13('0x0'));var rimraf=require(_0x3d13('0x1'));var zipdir=require(_0x3d13('0x2'));var jsonpatch=require(_0x3d13('0x3'));var rp=require('request-promise');var moment=require(_0x3d13('0x4'));var BPromise=require(_0x3d13('0x5'));var Mustache=require(_0x3d13('0x6'));var util=require(_0x3d13('0x7'));var path=require(_0x3d13('0x8'));var sox=require(_0x3d13('0x9'));var csv=require(_0x3d13('0xa'));var ejs=require(_0x3d13('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d13('0xc'));var squel=require('squel');var crypto=require(_0x3d13('0xd'));var jsforce=require(_0x3d13('0xe'));var deskjs=require(_0x3d13('0xf'));var toCsv=require(_0x3d13('0xa'));var querystring=require('querystring');var Papa=require(_0x3d13('0x10'));var Redis=require('ioredis');var authService=require(_0x3d13('0x11'));var qs=require(_0x3d13('0x12'));var as=require(_0x3d13('0x13'));var hardwareService=require(_0x3d13('0x14'));var logger=require('../../config/logger')(_0x3d13('0x15'));var utils=require(_0x3d13('0x16'));var config=require(_0x3d13('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3d13('0x18'))['db'];function respondWithStatusCode(_0xde405c,_0x41b533){_0x41b533=_0x41b533||0xcc;return function(_0x2d0a02){if(_0x2d0a02){return _0xde405c['sendStatus'](_0x41b533);}return _0xde405c['status'](_0x41b533)[_0x3d13('0x19')]();};}function respondWithResult(_0xbef0bd,_0x50a903){_0x50a903=_0x50a903||0xc8;return function(_0x3128ad){if(_0x3128ad){return _0xbef0bd[_0x3d13('0x1a')](_0x50a903)[_0x3d13('0x1b')](_0x3128ad);}};}function respondWithFilteredResult(_0x418237,_0x3c64c2){return function(_0x34f766){if(_0x34f766){var _0x5e7a8e=typeof _0x3c64c2[_0x3d13('0x1c')]==='undefined'&&typeof _0x3c64c2[_0x3d13('0x1d')]===_0x3d13('0x1e');var _0x1d6812=_0x34f766[_0x3d13('0x1f')];var _0x2e8592=_0x5e7a8e?0x0:_0x3c64c2[_0x3d13('0x1c')];var _0x3f6a74=_0x5e7a8e?_0x34f766[_0x3d13('0x1f')]:_0x3c64c2[_0x3d13('0x1c')]+_0x3c64c2[_0x3d13('0x1d')];var _0x1b39a9;if(_0x3f6a74>=_0x1d6812){_0x3f6a74=_0x1d6812;_0x1b39a9=0xc8;}else{_0x1b39a9=0xce;}_0x418237['status'](_0x1b39a9);return _0x418237[_0x3d13('0x20')](_0x3d13('0x21'),_0x2e8592+'-'+_0x3f6a74+'/'+_0x1d6812)[_0x3d13('0x1b')](_0x34f766);}return null;};}function patchUpdates(_0x431028){return function(_0x2918db){try{jsonpatch[_0x3d13('0x22')](_0x2918db,_0x431028,!![]);}catch(_0x6f4acb){return BPromise[_0x3d13('0x23')](_0x6f4acb);}return _0x2918db['save']();};}function saveUpdates(_0x59cc57,_0x4af203){return function(_0x3e2332){if(_0x3e2332){return _0x3e2332[_0x3d13('0x24')](_0x59cc57)['then'](function(_0x163e97){return _0x163e97;});}return null;};}function removeEntity(_0x577c15,_0x10c9a0){return function(_0x810c45){if(_0x810c45){return _0x810c45[_0x3d13('0x25')]()[_0x3d13('0x26')](function(){_0x577c15[_0x3d13('0x1a')](0xcc)[_0x3d13('0x19')]();});}};}function handleEntityNotFound(_0x5a7b05,_0x352f8c){return function(_0x3f1f03){if(!_0x3f1f03){_0x5a7b05['sendStatus'](0x194);}return _0x3f1f03;};}function handleError(_0x4f3970,_0x65d868){_0x65d868=_0x65d868||0x1f4;return function(_0x46b305){logger[_0x3d13('0x27')](_0x46b305['stack']);if(_0x46b305[_0x3d13('0x28')]){delete _0x46b305[_0x3d13('0x28')];}_0x4f3970['status'](_0x65d868)[_0x3d13('0x29')](_0x46b305);};}exports[_0x3d13('0x2a')]=function(_0x2500c5,_0x1125c4){var _0x57aa3d={},_0x4d8f3e={},_0xc3f467={'count':0x0,'rows':[]};var _0x21af02=_[_0x3d13('0x2b')](db['UserProfileSection'][_0x3d13('0x2c')],function(_0x169197){return{'name':_0x169197['fieldName'],'type':_0x169197[_0x3d13('0x2d')][_0x3d13('0x2e')]};});_0x4d8f3e['model']=_[_0x3d13('0x2b')](_0x21af02,_0x3d13('0x28'));_0x4d8f3e['query']=_[_0x3d13('0x2f')](_0x2500c5[_0x3d13('0x30')]);_0x4d8f3e['filters']=_[_0x3d13('0x31')](_0x4d8f3e['model'],_0x4d8f3e[_0x3d13('0x30')]);_0x57aa3d[_0x3d13('0x32')]=_[_0x3d13('0x31')](_0x4d8f3e[_0x3d13('0x33')],qs[_0x3d13('0x34')](_0x2500c5[_0x3d13('0x30')][_0x3d13('0x34')]));_0x57aa3d[_0x3d13('0x32')]=_0x57aa3d['attributes']['length']?_0x57aa3d[_0x3d13('0x32')]:_0x4d8f3e[_0x3d13('0x33')];if(!_0x2500c5[_0x3d13('0x30')][_0x3d13('0x35')](_0x3d13('0x36'))){_0x57aa3d['limit']=qs['limit'](_0x2500c5[_0x3d13('0x30')][_0x3d13('0x1d')]);_0x57aa3d[_0x3d13('0x1c')]=qs[_0x3d13('0x1c')](_0x2500c5[_0x3d13('0x30')][_0x3d13('0x1c')]);}_0x57aa3d['order']=qs[_0x3d13('0x37')](_0x2500c5['query'][_0x3d13('0x37')]);_0x57aa3d['where']=qs[_0x3d13('0x38')](_[_0x3d13('0x39')](_0x2500c5[_0x3d13('0x30')],_0x4d8f3e['filters']),_0x21af02);if(_0x2500c5[_0x3d13('0x30')][_0x3d13('0x3a')]){_0x57aa3d[_0x3d13('0x3b')]=_['merge'](_0x57aa3d['where'],{'$or':_[_0x3d13('0x2b')](_0x21af02,function(_0x2426d2){if(_0x2426d2[_0x3d13('0x2d')]!==_0x3d13('0x3c')){var _0x25505a={};_0x25505a[_0x2426d2['name']]={'$like':'%'+_0x2500c5[_0x3d13('0x30')][_0x3d13('0x3a')]+'%'};return _0x25505a;}})});}_0x57aa3d=_[_0x3d13('0x3d')]({},_0x57aa3d,_0x2500c5[_0x3d13('0x3e')]);var _0x52f69a={'where':_0x57aa3d[_0x3d13('0x3b')]};return db[_0x3d13('0x3f')]['count'](_0x52f69a)['then'](function(_0x10eff7){_0xc3f467[_0x3d13('0x1f')]=_0x10eff7;if(_0x2500c5['query'][_0x3d13('0x40')]){_0x57aa3d[_0x3d13('0x41')]=[{'all':!![]}];}return db[_0x3d13('0x3f')][_0x3d13('0x42')](_0x57aa3d);})['then'](function(_0x3ee2e7){_0xc3f467['rows']=_0x3ee2e7;return _0xc3f467;})['then'](respondWithFilteredResult(_0x1125c4,_0x57aa3d))[_0x3d13('0x43')](handleError(_0x1125c4,null));};exports[_0x3d13('0x44')]=function(_0x42e353,_0x3ad342){var _0x2842fe={'raw':![],'where':{'id':_0x42e353[_0x3d13('0x45')]['id']}},_0x2bdea0={};_0x2bdea0[_0x3d13('0x33')]=_['keys'](db[_0x3d13('0x3f')]['rawAttributes']);_0x2bdea0['query']=_[_0x3d13('0x2f')](_0x42e353[_0x3d13('0x30')]);_0x2bdea0['filters']=_[_0x3d13('0x31')](_0x2bdea0['model'],_0x2bdea0[_0x3d13('0x30')]);_0x2842fe[_0x3d13('0x32')]=_['intersection'](_0x2bdea0[_0x3d13('0x33')],qs['fields'](_0x42e353['query'][_0x3d13('0x34')]));_0x2842fe[_0x3d13('0x32')]=_0x2842fe[_0x3d13('0x32')][_0x3d13('0x46')]?_0x2842fe[_0x3d13('0x32')]:_0x2bdea0['model'];if(_0x42e353[_0x3d13('0x30')][_0x3d13('0x40')]){_0x2842fe[_0x3d13('0x41')]=[{'all':!![]}];}_0x2842fe=_[_0x3d13('0x3d')]({},_0x2842fe,_0x42e353['options']);return db[_0x3d13('0x3f')][_0x3d13('0x47')](_0x2842fe)[_0x3d13('0x26')](handleEntityNotFound(_0x3ad342,null))[_0x3d13('0x26')](respondWithResult(_0x3ad342,null))['catch'](handleError(_0x3ad342,null));};exports[_0x3d13('0x48')]=function(_0x4930dd,_0x28fb85){return db['UserProfileSection'][_0x3d13('0x48')](_0x4930dd['body'],{})['then'](respondWithResult(_0x28fb85,0xc9))[_0x3d13('0x43')](handleError(_0x28fb85,null));};exports[_0x3d13('0x24')]=function(_0x186f80,_0x4561f){if(_0x186f80['body']['id']){delete _0x186f80[_0x3d13('0x49')]['id'];}return db[_0x3d13('0x3f')]['find']({'where':{'id':_0x186f80[_0x3d13('0x45')]['id']}})[_0x3d13('0x26')](handleEntityNotFound(_0x4561f,null))[_0x3d13('0x26')](saveUpdates(_0x186f80[_0x3d13('0x49')],null))[_0x3d13('0x26')](respondWithResult(_0x4561f,null))[_0x3d13('0x43')](handleError(_0x4561f,null));};exports[_0x3d13('0x25')]=function(_0x4510d8,_0x53b908){return db['UserProfileSection']['find']({'where':{'id':_0x4510d8[_0x3d13('0x45')]['id']}})[_0x3d13('0x26')](handleEntityNotFound(_0x53b908,null))['then'](removeEntity(_0x53b908,null))[_0x3d13('0x43')](handleError(_0x53b908,null));};exports[_0x3d13('0x4a')]=function(_0x3fa7ba,_0x2ce179){return db[_0x3d13('0x3f')]['describe']()['then'](respondWithResult(_0x2ce179,null))[_0x3d13('0x43')](handleError(_0x2ce179,null));}; \ No newline at end of file +var _0x7882=['intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','include','findAll','rows','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','filters'];(function(_0x3dd5f5,_0x1ee4ca){var _0x5d16ce=function(_0x260949){while(--_0x260949){_0x3dd5f5['push'](_0x3dd5f5['shift']());}};_0x5d16ce(++_0x1ee4ca);}(_0x7882,0x1ea));var _0x2788=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x7882[_0x450689];return _0x46ffb0;};'use strict';var emlformat=require(_0x2788('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2788('0x1'));var jsonpatch=require(_0x2788('0x2'));var rp=require(_0x2788('0x3'));var moment=require('moment');var BPromise=require(_0x2788('0x4'));var Mustache=require(_0x2788('0x5'));var util=require(_0x2788('0x6'));var path=require(_0x2788('0x7'));var sox=require(_0x2788('0x8'));var csv=require('to-csv');var ejs=require(_0x2788('0x9'));var fs=require('fs');var fs_extra=require(_0x2788('0xa'));var _=require(_0x2788('0xb'));var squel=require(_0x2788('0xc'));var crypto=require(_0x2788('0xd'));var jsforce=require(_0x2788('0xe'));var deskjs=require(_0x2788('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2788('0x10'));var Papa=require(_0x2788('0x11'));var Redis=require(_0x2788('0x12'));var authService=require(_0x2788('0x13'));var qs=require(_0x2788('0x14'));var as=require(_0x2788('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2788('0x16'))(_0x2788('0x17'));var utils=require(_0x2788('0x18'));var config=require(_0x2788('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2788('0x1a'))['db'];function respondWithStatusCode(_0x1e48ce,_0x418c03){_0x418c03=_0x418c03||0xcc;return function(_0x22c4e7){if(_0x22c4e7){return _0x1e48ce[_0x2788('0x1b')](_0x418c03);}return _0x1e48ce['status'](_0x418c03)[_0x2788('0x1c')]();};}function respondWithResult(_0x3780f6,_0x4fd9c2){_0x4fd9c2=_0x4fd9c2||0xc8;return function(_0x389d4d){if(_0x389d4d){return _0x3780f6[_0x2788('0x1d')](_0x4fd9c2)['json'](_0x389d4d);}};}function respondWithFilteredResult(_0x17ae26,_0x4e5e88){return function(_0x9e308f){if(_0x9e308f){var _0x3c97c6=typeof _0x4e5e88['offset']===_0x2788('0x1e')&&typeof _0x4e5e88['limit']===_0x2788('0x1e');var _0x3abace=_0x9e308f['count'];var _0x254a1b=_0x3c97c6?0x0:_0x4e5e88[_0x2788('0x1f')];var _0x2173db=_0x3c97c6?_0x9e308f[_0x2788('0x20')]:_0x4e5e88['offset']+_0x4e5e88[_0x2788('0x21')];var _0x3eb86a;if(_0x2173db>=_0x3abace){_0x2173db=_0x3abace;_0x3eb86a=0xc8;}else{_0x3eb86a=0xce;}_0x17ae26[_0x2788('0x1d')](_0x3eb86a);return _0x17ae26[_0x2788('0x22')](_0x2788('0x23'),_0x254a1b+'-'+_0x2173db+'/'+_0x3abace)['json'](_0x9e308f);}return null;};}function patchUpdates(_0xffe07){return function(_0x3088c0){try{jsonpatch[_0x2788('0x24')](_0x3088c0,_0xffe07,!![]);}catch(_0x25eaa4){return BPromise[_0x2788('0x25')](_0x25eaa4);}return _0x3088c0[_0x2788('0x26')]();};}function saveUpdates(_0x347d8e,_0x19ff14){return function(_0x4a48a3){if(_0x4a48a3){return _0x4a48a3[_0x2788('0x27')](_0x347d8e)[_0x2788('0x28')](function(_0x10a543){return _0x10a543;});}return null;};}function removeEntity(_0x6f732f,_0xf1edce){return function(_0x36c8fd){if(_0x36c8fd){return _0x36c8fd[_0x2788('0x29')]()['then'](function(){_0x6f732f[_0x2788('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4df689,_0x136f20){return function(_0x3df005){if(!_0x3df005){_0x4df689[_0x2788('0x1b')](0x194);}return _0x3df005;};}function handleError(_0x1b0b38,_0x7fda4){_0x7fda4=_0x7fda4||0x1f4;return function(_0x5aaba1){logger[_0x2788('0x2a')](_0x5aaba1[_0x2788('0x2b')]);if(_0x5aaba1[_0x2788('0x2c')]){delete _0x5aaba1['name'];}_0x1b0b38['status'](_0x7fda4)[_0x2788('0x2d')](_0x5aaba1);};}exports[_0x2788('0x2e')]=function(_0x37e4ff,_0x173260){var _0x19d7d7={},_0x3ba648={},_0x4e94e7={'count':0x0,'rows':[]};var _0x242d60=_[_0x2788('0x2f')](db[_0x2788('0x30')][_0x2788('0x31')],function(_0x257847){return{'name':_0x257847[_0x2788('0x32')],'type':_0x257847[_0x2788('0x33')][_0x2788('0x34')]};});_0x3ba648[_0x2788('0x35')]=_[_0x2788('0x2f')](_0x242d60,'name');_0x3ba648['query']=_[_0x2788('0x36')](_0x37e4ff['query']);_0x3ba648[_0x2788('0x37')]=_[_0x2788('0x38')](_0x3ba648[_0x2788('0x35')],_0x3ba648[_0x2788('0x39')]);_0x19d7d7[_0x2788('0x3a')]=_[_0x2788('0x38')](_0x3ba648[_0x2788('0x35')],qs[_0x2788('0x3b')](_0x37e4ff[_0x2788('0x39')]['fields']));_0x19d7d7['attributes']=_0x19d7d7[_0x2788('0x3a')][_0x2788('0x3c')]?_0x19d7d7[_0x2788('0x3a')]:_0x3ba648[_0x2788('0x35')];if(!_0x37e4ff[_0x2788('0x39')][_0x2788('0x3d')](_0x2788('0x3e'))){_0x19d7d7[_0x2788('0x21')]=qs[_0x2788('0x21')](_0x37e4ff[_0x2788('0x39')]['limit']);_0x19d7d7[_0x2788('0x1f')]=qs[_0x2788('0x1f')](_0x37e4ff[_0x2788('0x39')]['offset']);}_0x19d7d7[_0x2788('0x3f')]=qs['sort'](_0x37e4ff[_0x2788('0x39')]['sort']);_0x19d7d7['where']=qs[_0x2788('0x37')](_[_0x2788('0x40')](_0x37e4ff['query'],_0x3ba648['filters']),_0x242d60);if(_0x37e4ff[_0x2788('0x39')][_0x2788('0x41')]){_0x19d7d7[_0x2788('0x42')]=_[_0x2788('0x43')](_0x19d7d7[_0x2788('0x42')],{'$or':_['map'](_0x242d60,function(_0x277e69){if(_0x277e69['type']!=='VIRTUAL'){var _0x51c339={};_0x51c339[_0x277e69[_0x2788('0x2c')]]={'$like':'%'+_0x37e4ff['query'][_0x2788('0x41')]+'%'};return _0x51c339;}})});}_0x19d7d7=_[_0x2788('0x43')]({},_0x19d7d7,_0x37e4ff['options']);var _0x65f299={'where':_0x19d7d7[_0x2788('0x42')]};return db[_0x2788('0x30')][_0x2788('0x20')](_0x65f299)[_0x2788('0x28')](function(_0x2003de){_0x4e94e7['count']=_0x2003de;if(_0x37e4ff['query']['includeAll']){_0x19d7d7[_0x2788('0x44')]=[{'all':!![]}];}return db['UserProfileSection'][_0x2788('0x45')](_0x19d7d7);})['then'](function(_0x2f7d25){_0x4e94e7[_0x2788('0x46')]=_0x2f7d25;return _0x4e94e7;})[_0x2788('0x28')](respondWithFilteredResult(_0x173260,_0x19d7d7))['catch'](handleError(_0x173260,null));};exports['show']=function(_0x582ecf,_0x3b3be1){var _0x825dc5={'raw':![],'where':{'id':_0x582ecf[_0x2788('0x47')]['id']}},_0xe88104={};_0xe88104[_0x2788('0x35')]=_[_0x2788('0x36')](db[_0x2788('0x30')]['rawAttributes']);_0xe88104['query']=_[_0x2788('0x36')](_0x582ecf[_0x2788('0x39')]);_0xe88104[_0x2788('0x37')]=_[_0x2788('0x38')](_0xe88104[_0x2788('0x35')],_0xe88104['query']);_0x825dc5[_0x2788('0x3a')]=_[_0x2788('0x38')](_0xe88104['model'],qs['fields'](_0x582ecf['query']['fields']));_0x825dc5[_0x2788('0x3a')]=_0x825dc5[_0x2788('0x3a')]['length']?_0x825dc5[_0x2788('0x3a')]:_0xe88104[_0x2788('0x35')];if(_0x582ecf['query']['includeAll']){_0x825dc5[_0x2788('0x44')]=[{'all':!![]}];}_0x825dc5=_[_0x2788('0x43')]({},_0x825dc5,_0x582ecf[_0x2788('0x48')]);return db['UserProfileSection'][_0x2788('0x49')](_0x825dc5)[_0x2788('0x28')](handleEntityNotFound(_0x3b3be1,null))[_0x2788('0x28')](respondWithResult(_0x3b3be1,null))[_0x2788('0x4a')](handleError(_0x3b3be1,null));};exports[_0x2788('0x4b')]=function(_0x42df3a,_0x274896){return db[_0x2788('0x30')][_0x2788('0x4b')](_0x42df3a[_0x2788('0x4c')],{})[_0x2788('0x28')](respondWithResult(_0x274896,0xc9))['catch'](handleError(_0x274896,null));};exports[_0x2788('0x27')]=function(_0x5431b9,_0x426e48){if(_0x5431b9[_0x2788('0x4c')]['id']){delete _0x5431b9[_0x2788('0x4c')]['id'];}return db[_0x2788('0x30')][_0x2788('0x49')]({'where':{'id':_0x5431b9['params']['id']}})[_0x2788('0x28')](handleEntityNotFound(_0x426e48,null))[_0x2788('0x28')](saveUpdates(_0x5431b9['body'],null))['then'](respondWithResult(_0x426e48,null))[_0x2788('0x4a')](handleError(_0x426e48,null));};exports[_0x2788('0x29')]=function(_0x10e5d8,_0x4713ea){return db[_0x2788('0x30')]['find']({'where':{'id':_0x10e5d8[_0x2788('0x47')]['id']}})[_0x2788('0x28')](handleEntityNotFound(_0x4713ea,null))[_0x2788('0x28')](removeEntity(_0x4713ea,null))[_0x2788('0x4a')](handleError(_0x4713ea,null));};exports['describe']=function(_0x71f694,_0x3da94f){return db[_0x2788('0x30')][_0x2788('0x4d')]()[_0x2788('0x28')](respondWithResult(_0x3da94f,null))[_0x2788('0x4a')](handleError(_0x3da94f,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index e874c84..79e43bc 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 _0x366c=['../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x11cef1,_0x1ad3ef){var _0x31e3e8=function(_0x2056b9){while(--_0x2056b9){_0x11cef1['push'](_0x11cef1['shift']());}};_0x31e3e8(++_0x1ad3ef);}(_0x366c,0x189));var _0xc366=function(_0x23b4ad,_0x248517){_0x23b4ad=_0x23b4ad-0x0;var _0x4fa166=_0x366c[_0x23b4ad];return _0x4fa166;};'use strict';var _=require(_0xc366('0x0'));var util=require(_0xc366('0x1'));var logger=require('../../config/logger')(_0xc366('0x2'));var moment=require('moment');var BPromise=require(_0xc366('0x3'));var rp=require(_0xc366('0x4'));var fs=require('fs');var path=require(_0xc366('0x5'));var rimraf=require(_0xc366('0x6'));var config=require(_0xc366('0x7'));var attributes=require(_0xc366('0x8'));module[_0xc366('0x9')]=function(_0x45b753,_0xcbff9a){return _0x45b753[_0xc366('0xa')](_0xc366('0xb'),attributes,{'tableName':_0xc366('0xc'),'paranoid':![],'indexes':[{'name':_0xc366('0xd'),'fields':[_0xc366('0xe'),_0xc366('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb59f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x2f92a,_0x1536f9){var _0x1a4b6d=function(_0x415cce){while(--_0x415cce){_0x2f92a['push'](_0x2f92a['shift']());}};_0x1a4b6d(++_0x1536f9);}(_0xb59f,0xc0));var _0xfb59=function(_0x76bd17,_0x51e665){_0x76bd17=_0x76bd17-0x0;var _0x32b726=_0xb59f[_0x76bd17];return _0x32b726;};'use strict';var _=require(_0xfb59('0x0'));var util=require(_0xfb59('0x1'));var logger=require(_0xfb59('0x2'))('api');var moment=require(_0xfb59('0x3'));var BPromise=require(_0xfb59('0x4'));var rp=require(_0xfb59('0x5'));var fs=require('fs');var path=require(_0xfb59('0x6'));var rimraf=require(_0xfb59('0x7'));var config=require(_0xfb59('0x8'));var attributes=require(_0xfb59('0x9'));module[_0xfb59('0xa')]=function(_0x2242f2,_0x5c04ee){return _0x2242f2[_0xfb59('0xb')]('UserProfileSection',attributes,{'tableName':_0xfb59('0xc'),'paranoid':![],'indexes':[{'name':_0xfb59('0xd'),'fields':[_0xfb59('0xe'),_0xfb59('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ec26ae2..1ed2978 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 _0x13a6=['http','request','then','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2518bf,_0x2c94ba){var _0x3d3a69=function(_0x470666){while(--_0x470666){_0x2518bf['push'](_0x2518bf['shift']());}};_0x3d3a69(++_0x2c94ba);}(_0x13a6,0x9c));var _0x613a=function(_0x3d4d91,_0x577d8a){_0x3d4d91=_0x3d4d91-0x0;var _0xa30755=_0x13a6[_0x3d4d91];return _0xa30755;};'use strict';var _=require(_0x613a('0x0'));var util=require('util');var moment=require(_0x613a('0x1'));var BPromise=require(_0x613a('0x2'));var rs=require(_0x613a('0x3'));var fs=require('fs');var Redis=require(_0x613a('0x4'));var db=require(_0x613a('0x5'))['db'];var utils=require(_0x613a('0x6'));var logger=require(_0x613a('0x7'))(_0x613a('0x8'));var config=require(_0x613a('0x9'));var jayson=require(_0x613a('0xa'));var client=jayson[_0x613a('0xb')][_0x613a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa7a33f,_0x3aa6ec,_0x5f0f73){return new BPromise(function(_0x47b356,_0x40c09b){return client[_0x613a('0xd')](_0xa7a33f,_0x5f0f73)[_0x613a('0xe')](function(_0x2e3f41){logger['info'](_0x613a('0xf'),_0x3aa6ec,'request\x20sent');logger['debug'](_0x613a('0x10'),_0x3aa6ec,_0x613a('0x11'),JSON['stringify'](_0x2e3f41));if(_0x2e3f41[_0x613a('0x12')]){if(_0x2e3f41[_0x613a('0x12')]['code']===0x1f4){logger[_0x613a('0x12')](_0x613a('0xf'),_0x3aa6ec,_0x2e3f41['error'][_0x613a('0x13')]);return _0x40c09b(_0x2e3f41['error']['message']);}logger[_0x613a('0x12')](_0x613a('0xf'),_0x3aa6ec,_0x2e3f41[_0x613a('0x12')][_0x613a('0x13')]);return _0x47b356(_0x2e3f41[_0x613a('0x12')][_0x613a('0x13')]);}else{logger['info'](_0x613a('0xf'),_0x3aa6ec,_0x613a('0x11'));_0x47b356(_0x2e3f41[_0x613a('0x14')][_0x613a('0x13')]);}})['catch'](function(_0x24c215){logger[_0x613a('0x12')](_0x613a('0xf'),_0x3aa6ec,_0x24c215);_0x40c09b(_0x24c215);});});} \ No newline at end of file +var _0xdafa=['stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0xdafa,0x124));var _0xadaf=function(_0x684edd,_0x4e01b5){_0x684edd=_0x684edd-0x0;var _0x1d98b5=_0xdafa[_0x684edd];return _0x1d98b5;};'use strict';var _=require('lodash');var util=require(_0xadaf('0x0'));var moment=require(_0xadaf('0x1'));var BPromise=require(_0xadaf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadaf('0x3'))['db'];var utils=require(_0xadaf('0x4'));var logger=require(_0xadaf('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xadaf('0x6'));var client=jayson[_0xadaf('0x7')][_0xadaf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12c840,_0x4fe23a,_0x31d16a){return new BPromise(function(_0xa77e78,_0x107514){return client['request'](_0x12c840,_0x31d16a)[_0xadaf('0x9')](function(_0x266a0c){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x4fe23a,'request\x20sent');logger['debug'](_0xadaf('0xa'),_0x4fe23a,_0xadaf('0xb'),JSON[_0xadaf('0xc')](_0x266a0c));if(_0x266a0c[_0xadaf('0xd')]){if(_0x266a0c[_0xadaf('0xd')][_0xadaf('0xe')]===0x1f4){logger[_0xadaf('0xd')](_0xadaf('0xf'),_0x4fe23a,_0x266a0c[_0xadaf('0xd')][_0xadaf('0x10')]);return _0x107514(_0x266a0c[_0xadaf('0xd')][_0xadaf('0x10')]);}logger[_0xadaf('0xd')](_0xadaf('0xf'),_0x4fe23a,_0x266a0c[_0xadaf('0xd')]['message']);return _0xa77e78(_0x266a0c[_0xadaf('0xd')]['message']);}else{logger[_0xadaf('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x4fe23a,_0xadaf('0xb'));_0xa77e78(_0x266a0c[_0xadaf('0x12')][_0xadaf('0x10')]);}})['catch'](function(_0x1b709a){logger[_0xadaf('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x4fe23a,_0x1b709a);_0x107514(_0x1b709a);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index fdd7b0d..089d8ea 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x16ca56,_0x199c36){var _0x289c68=function(_0x2903e3){while(--_0x2903e3){_0x16ca56['push'](_0x16ca56['shift']());}};_0x289c68(++_0x199c36);}(_0xedd9,0xfc));var _0x9edd=function(_0x3d1fdc,_0x28b2bc){_0x3d1fdc=_0x3d1fdc-0x0;var _0xffbd83=_0xedd9[_0x3d1fdc];return _0xffbd83;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x513752,_0x50e1b7){var _0x407985=function(_0x54bd0f){while(--_0x54bd0f){_0x513752['push'](_0x513752['shift']());}};_0x407985(++_0x50e1b7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x209bbf,_0x2e2375){_0x209bbf=_0x209bbf-0x0;var _0x592d4b=_0xcb91[_0x209bbf];return _0x592d4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index fb89bae..da8475b 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 _0x5f7b=['exports','INTEGER'];(function(_0x1ee739,_0x29ae9e){var _0xee5173=function(_0x9078bc){while(--_0x9078bc){_0x1ee739['push'](_0x1ee739['shift']());}};_0xee5173(++_0x29ae9e);}(_0x5f7b,0x19c));var _0xb5f7=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5f7b[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require('sequelize');module[_0xb5f7('0x0')]={'penalty':{'type':Sequelize[_0xb5f7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8647=['INTEGER','sequelize','exports'];(function(_0x10d48f,_0x17f1a6){var _0x44673c=function(_0x18d462){while(--_0x18d462){_0x10d48f['push'](_0x10d48f['shift']());}};_0x44673c(++_0x17f1a6);}(_0x8647,0x1cc));var _0x7864=function(_0x2bb5c2,_0x2c11d0){_0x2bb5c2=_0x2bb5c2-0x0;var _0x199fc3=_0x8647[_0x2bb5c2];return _0x199fc3;};'use strict';var Sequelize=require(_0x7864('0x0'));module[_0x7864('0x1')]={'penalty':{'type':Sequelize[_0x7864('0x2')],'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 13e14d1..c5015d2 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 _0x8cad=['UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0xf65783,_0x50c29f){var _0x221b4b=function(_0x27855c){while(--_0x27855c){_0xf65783['push'](_0xf65783['shift']());}};_0x221b4b(++_0x50c29f);}(_0x8cad,0xfe));var _0xd8ca=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x8cad[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var logger=require(_0xd8ca('0x2'))(_0xd8ca('0x3'));var moment=require(_0xd8ca('0x4'));var BPromise=require(_0xd8ca('0x5'));var rp=require(_0xd8ca('0x6'));var fs=require('fs');var path=require(_0xd8ca('0x7'));var rimraf=require(_0xd8ca('0x8'));var config=require(_0xd8ca('0x9'));var attributes=require(_0xd8ca('0xa'));module[_0xd8ca('0xb')]=function(_0x14c73e,_0x6d5070){return _0x14c73e['define'](_0xd8ca('0xc'),attributes,{'tableName':_0xd8ca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf1b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','util','../../config/logger','api'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x4d7181,_0x407a34){_0x4d7181=_0x4d7181-0x0;var _0x4abf2a=_0xaf1b[_0x4d7181];return _0x4abf2a;};'use strict';var _=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var logger=require(_0xbaf1('0x2'))(_0xbaf1('0x3'));var moment=require(_0xbaf1('0x4'));var BPromise=require(_0xbaf1('0x5'));var rp=require(_0xbaf1('0x6'));var fs=require('fs');var path=require(_0xbaf1('0x7'));var rimraf=require(_0xbaf1('0x8'));var config=require(_0xbaf1('0x9'));var attributes=require(_0xbaf1('0xa'));module[_0xbaf1('0xb')]=function(_0x7dd657,_0x2f05ad){return _0x7dd657['define'](_0xbaf1('0xc'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index aa997da..94d0615 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 _0x1c13=['../../config/logger','rpc','../../config/environment','client','http','request','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x1c13,0x1b3));var _0x31c1=function(_0x427904,_0x50f281){_0x427904=_0x427904-0x0;var _0x3c46fc=_0x1c13[_0x427904];return _0x3c46fc;};'use strict';var _=require('lodash');var util=require(_0x31c1('0x0'));var moment=require(_0x31c1('0x1'));var BPromise=require(_0x31c1('0x2'));var rs=require(_0x31c1('0x3'));var fs=require('fs');var Redis=require(_0x31c1('0x4'));var db=require(_0x31c1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x31c1('0x6'))(_0x31c1('0x7'));var config=require(_0x31c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x31c1('0x9')][_0x31c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x341663,_0xb921a5,_0x11ec78){return new BPromise(function(_0x19b54a,_0x4a4da8){return client[_0x31c1('0xb')](_0x341663,_0x11ec78)['then'](function(_0x3ec0b5){logger['info'](_0x31c1('0xc'),_0xb921a5,_0x31c1('0xd'));logger[_0x31c1('0xe')](_0x31c1('0xf'),_0xb921a5,_0x31c1('0xd'),JSON[_0x31c1('0x10')](_0x3ec0b5));if(_0x3ec0b5[_0x31c1('0x11')]){if(_0x3ec0b5[_0x31c1('0x11')][_0x31c1('0x12')]===0x1f4){logger[_0x31c1('0x11')](_0x31c1('0xc'),_0xb921a5,_0x3ec0b5[_0x31c1('0x11')][_0x31c1('0x13')]);return _0x4a4da8(_0x3ec0b5['error'][_0x31c1('0x13')]);}logger[_0x31c1('0x11')](_0x31c1('0xc'),_0xb921a5,_0x3ec0b5[_0x31c1('0x11')][_0x31c1('0x13')]);return _0x19b54a(_0x3ec0b5['error'][_0x31c1('0x13')]);}else{logger['info'](_0x31c1('0xc'),_0xb921a5,_0x31c1('0xd'));_0x19b54a(_0x3ec0b5[_0x31c1('0x14')]['message']);}})['catch'](function(_0x5a2554){logger[_0x31c1('0x11')](_0x31c1('0xc'),_0xb921a5,_0x5a2554);_0x4a4da8(_0x5a2554);});});} \ No newline at end of file +var _0xaabc=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x277cba,_0x3a8ed5){var _0x218df5=function(_0x26b4bb){while(--_0x26b4bb){_0x277cba['push'](_0x277cba['shift']());}};_0x218df5(++_0x3a8ed5);}(_0xaabc,0x1de));var _0xcaab=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0xaabc[_0x2ae8ce];return _0x4bf686;};'use strict';var _=require(_0xcaab('0x0'));var util=require(_0xcaab('0x1'));var moment=require(_0xcaab('0x2'));var BPromise=require(_0xcaab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcaab('0x4'));var db=require(_0xcaab('0x5'))['db'];var utils=require(_0xcaab('0x6'));var logger=require('../../config/logger')(_0xcaab('0x7'));var config=require(_0xcaab('0x8'));var jayson=require(_0xcaab('0x9'));var client=jayson[_0xcaab('0xa')][_0xcaab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34349d,_0x3e20c8,_0x17f2ca){return new BPromise(function(_0x3d7b8e,_0x284838){return client[_0xcaab('0xc')](_0x34349d,_0x17f2ca)[_0xcaab('0xd')](function(_0xbd8f97){logger[_0xcaab('0xe')](_0xcaab('0xf'),_0x3e20c8,_0xcaab('0x10'));logger[_0xcaab('0x11')](_0xcaab('0x12'),_0x3e20c8,_0xcaab('0x10'),JSON[_0xcaab('0x13')](_0xbd8f97));if(_0xbd8f97[_0xcaab('0x14')]){if(_0xbd8f97['error'][_0xcaab('0x15')]===0x1f4){logger[_0xcaab('0x14')](_0xcaab('0xf'),_0x3e20c8,_0xbd8f97[_0xcaab('0x14')][_0xcaab('0x16')]);return _0x284838(_0xbd8f97[_0xcaab('0x14')]['message']);}logger[_0xcaab('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x3e20c8,_0xbd8f97[_0xcaab('0x14')][_0xcaab('0x16')]);return _0x3d7b8e(_0xbd8f97[_0xcaab('0x14')][_0xcaab('0x16')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x3e20c8,_0xcaab('0x10'));_0x3d7b8e(_0xbd8f97[_0xcaab('0x17')][_0xcaab('0x16')]);}})[_0xcaab('0x18')](function(_0x8210b6){logger['error'](_0xcaab('0xf'),_0x3e20c8,_0x8210b6);_0x284838(_0x8210b6);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 58878e1..603056a 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 _0xaca5=['sequelize','exports','INTEGER'];(function(_0x4aaa3b,_0x2730fe){var _0x3f6749=function(_0x1f2f9a){while(--_0x1f2f9a){_0x4aaa3b['push'](_0x4aaa3b['shift']());}};_0x3f6749(++_0x2730fe);}(_0xaca5,0xa2));var _0x5aca=function(_0x50c2f0,_0x36f947){_0x50c2f0=_0x50c2f0-0x0;var _0x42aa7a=_0xaca5[_0x50c2f0];return _0x42aa7a;};'use strict';var Sequelize=require(_0x5aca('0x0'));module[_0x5aca('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x5aca('0x2')]}}; \ No newline at end of file +var _0x0df3=['INTEGER','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0df3,0xb7));var _0x30df=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0x0df3[_0x2fd0f0];return _0x57f71a;};'use strict';var Sequelize=require('sequelize');module[_0x30df('0x0')]={'UserId':{'type':Sequelize[_0x30df('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x30df('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 5ad87b2..16477ea 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(_0x28c3f0,_0x2cfa4e){var _0x466daf=function(_0x4e6071){while(--_0x4e6071){_0x28c3f0['push'](_0x28c3f0['shift']());}};_0x466daf(++_0x2cfa4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x54d507,_0x402db1){var _0x441b22=function(_0x40026a){while(--_0x40026a){_0x54d507['push'](_0x54d507['shift']());}};_0x441b22(++_0x402db1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 4b99528..5f9fedf 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1972f4,_0x1231ff){var _0x42159b=function(_0x1f9d6f){while(--_0x1f9d6f){_0x1972f4['push'](_0x1972f4['shift']());}};_0x42159b(++_0x1231ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x19a43b,_0x26ee5d){var _0x1b2679=function(_0x415dc8){while(--_0x415dc8){_0x19a43b['push'](_0x19a43b['shift']());}};_0x1b2679(++_0x26ee5d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0xcb91[_0x18e52b];return _0x3d3062;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index c6a5a9d..6f07042 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 _0x7076=['INTEGER','sequelize'];(function(_0x34b1b8,_0x54c9bf){var _0x542dd8=function(_0xff3f89){while(--_0xff3f89){_0x34b1b8['push'](_0x34b1b8['shift']());}};_0x542dd8(++_0x54c9bf);}(_0x7076,0x1b9));var _0x6707=function(_0x4c54c3,_0x1558c3){_0x4c54c3=_0x4c54c3-0x0;var _0x2d9345=_0x7076[_0x4c54c3];return _0x2d9345;};'use strict';var Sequelize=require(_0x6707('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6707('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaf70=['sequelize','exports'];(function(_0x5e1094,_0x411c56){var _0x3144aa=function(_0x59334b){while(--_0x59334b){_0x5e1094['push'](_0x5e1094['shift']());}};_0x3144aa(++_0x411c56);}(_0xaf70,0x17a));var _0x0af7=function(_0x999827,_0x13a115){_0x999827=_0x999827-0x0;var _0x5996ce=_0xaf70[_0x999827];return _0x5996ce;};'use strict';var Sequelize=require(_0x0af7('0x0'));module[_0x0af7('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 e51951f..cde4632 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 _0x9b67=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util'];(function(_0x54bbbd,_0x54cb23){var _0x177c4d=function(_0x5ef6cd){while(--_0x5ef6cd){_0x54bbbd['push'](_0x54bbbd['shift']());}};_0x177c4d(++_0x54cb23);}(_0x9b67,0x8d));var _0x79b6=function(_0x4b1b2a,_0x2c556f){_0x4b1b2a=_0x4b1b2a-0x0;var _0x46b969=_0x9b67[_0x4b1b2a];return _0x46b969;};'use strict';var _=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var logger=require(_0x79b6('0x2'))(_0x79b6('0x3'));var moment=require('moment');var BPromise=require(_0x79b6('0x4'));var rp=require(_0x79b6('0x5'));var fs=require('fs');var path=require(_0x79b6('0x6'));var rimraf=require(_0x79b6('0x7'));var config=require(_0x79b6('0x8'));var attributes=require(_0x79b6('0x9'));module[_0x79b6('0xa')]=function(_0xb3888,_0x5b2afb){return _0xb3888[_0x79b6('0xb')](_0x79b6('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2130=['./userVoiceQueue.attributes','exports','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3a53a3,_0x2f915d){var _0x3eabc2=function(_0x3f7c4f){while(--_0x3f7c4f){_0x3a53a3['push'](_0x3a53a3['shift']());}};_0x3eabc2(++_0x2f915d);}(_0x2130,0x1e7));var _0x0213=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x2130[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x0213('0x0'));var util=require(_0x0213('0x1'));var logger=require(_0x0213('0x2'))(_0x0213('0x3'));var moment=require(_0x0213('0x4'));var BPromise=require(_0x0213('0x5'));var rp=require(_0x0213('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0213('0x7'));var attributes=require(_0x0213('0x8'));module[_0x0213('0x9')]=function(_0x2960a1,_0x3f06cf){return _0x2960a1['define'](_0x0213('0xa'),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 c0df53f..dc40332 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 _0xa7d2=['request','then','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5b2859,_0x4f5083){var _0x4ee253=function(_0x1a36ca){while(--_0x1a36ca){_0x5b2859['push'](_0x5b2859['shift']());}};_0x4ee253(++_0x4f5083);}(_0xa7d2,0x138));var _0x2a7d=function(_0x55d688,_0x3f058c){_0x55d688=_0x55d688-0x0;var _0x1327e8=_0xa7d2[_0x55d688];return _0x1327e8;};'use strict';var _=require(_0x2a7d('0x0'));var util=require('util');var moment=require(_0x2a7d('0x1'));var BPromise=require('bluebird');var rs=require(_0x2a7d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a7d('0x3'))['db'];var utils=require(_0x2a7d('0x4'));var logger=require(_0x2a7d('0x5'))('rpc');var config=require(_0x2a7d('0x6'));var jayson=require(_0x2a7d('0x7'));var client=jayson[_0x2a7d('0x8')][_0x2a7d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a79f8,_0x270259,_0x2691e7){return new BPromise(function(_0x6eb634,_0x52ab6d){return client[_0x2a7d('0xa')](_0x4a79f8,_0x2691e7)[_0x2a7d('0xb')](function(_0x1cdcd7){logger[_0x2a7d('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x270259,'request\x20sent');logger[_0x2a7d('0xd')](_0x2a7d('0xe'),_0x270259,_0x2a7d('0xf'),JSON[_0x2a7d('0x10')](_0x1cdcd7));if(_0x1cdcd7[_0x2a7d('0x11')]){if(_0x1cdcd7[_0x2a7d('0x11')][_0x2a7d('0x12')]===0x1f4){logger['error'](_0x2a7d('0x13'),_0x270259,_0x1cdcd7[_0x2a7d('0x11')][_0x2a7d('0x14')]);return _0x52ab6d(_0x1cdcd7[_0x2a7d('0x11')][_0x2a7d('0x14')]);}logger['error'](_0x2a7d('0x13'),_0x270259,_0x1cdcd7[_0x2a7d('0x11')][_0x2a7d('0x14')]);return _0x6eb634(_0x1cdcd7['error'][_0x2a7d('0x14')]);}else{logger[_0x2a7d('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x270259,_0x2a7d('0xf'));_0x6eb634(_0x1cdcd7[_0x2a7d('0x15')][_0x2a7d('0x14')]);}})[_0x2a7d('0x16')](function(_0x494023){logger[_0x2a7d('0x11')](_0x2a7d('0x13'),_0x270259,_0x494023);_0x52ab6d(_0x494023);});});} \ No newline at end of file +var _0x33ba=['jayson/promise','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x33ba,0xd5));var _0xa33b=function(_0x6162a,_0x3a6a5a){_0x6162a=_0x6162a-0x0;var _0x4d6dcb=_0x33ba[_0x6162a];return _0x4d6dcb;};'use strict';var _=require('lodash');var util=require(_0xa33b('0x0'));var moment=require(_0xa33b('0x1'));var BPromise=require(_0xa33b('0x2'));var rs=require(_0xa33b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa33b('0x4'))['db'];var utils=require(_0xa33b('0x5'));var logger=require(_0xa33b('0x6'))(_0xa33b('0x7'));var config=require('../../config/environment');var jayson=require(_0xa33b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28ae48,_0x499579,_0x34d0ec){return new BPromise(function(_0xaf25e1,_0x421e10){return client[_0xa33b('0x9')](_0x28ae48,_0x34d0ec)[_0xa33b('0xa')](function(_0x228d00){logger[_0xa33b('0xb')](_0xa33b('0xc'),_0x499579,_0xa33b('0xd'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x499579,_0xa33b('0xd'),JSON['stringify'](_0x228d00));if(_0x228d00[_0xa33b('0xe')]){if(_0x228d00[_0xa33b('0xe')][_0xa33b('0xf')]===0x1f4){logger[_0xa33b('0xe')](_0xa33b('0xc'),_0x499579,_0x228d00[_0xa33b('0xe')][_0xa33b('0x10')]);return _0x421e10(_0x228d00[_0xa33b('0xe')]['message']);}logger[_0xa33b('0xe')](_0xa33b('0xc'),_0x499579,_0x228d00['error'][_0xa33b('0x10')]);return _0xaf25e1(_0x228d00[_0xa33b('0xe')][_0xa33b('0x10')]);}else{logger[_0xa33b('0xb')](_0xa33b('0xc'),_0x499579,'request\x20sent');_0xaf25e1(_0x228d00['result'][_0xa33b('0x10')]);}})['catch'](function(_0x5c3841){logger[_0xa33b('0xe')](_0xa33b('0xc'),_0x499579,_0x5c3841);_0x421e10(_0x5c3841);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index aa43869..1edd96c 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x242a46,_0x46d41d){var _0x1fb3bc=function(_0x55730b){while(--_0x55730b){_0x242a46['push'](_0x242a46['shift']());}};_0x1fb3bc(++_0x46d41d);}(_0xe706,0xa3));var _0x6e70=function(_0x184a95,_0x500731){_0x184a95=_0x184a95-0x0;var _0x55eadf=_0xe706[_0x184a95];return _0x55eadf;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5d7803,_0x30e9aa){var _0x1a43b2=function(_0x1359df){while(--_0x1359df){_0x5d7803['push'](_0x5d7803['shift']());}};_0x1a43b2(++_0x30e9aa);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'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 0edcac4..3a24f05 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 _0x1177=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x3b5450,_0x3b7706){var _0xf5b86d=function(_0xf64038){while(--_0xf64038){_0x3b5450['push'](_0x3b5450['shift']());}};_0xf5b86d(++_0x3b7706);}(_0x1177,0x1ab));var _0x7117=function(_0x3069a4,_0x424754){_0x3069a4=_0x3069a4-0x0;var _0x1ee18d=_0x1177[_0x3069a4];return _0x1ee18d;};'use strict';var Sequelize=require(_0x7117('0x0'));module[_0x7117('0x1')]={'uniqueid':{'type':Sequelize[_0x7117('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7117('0x3')},'membername':{'type':Sequelize[_0x7117('0x4')],'allowNull':![],'comment':_0x7117('0x3')},'UserId':{'type':Sequelize[_0x7117('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7117('0x4')],'allowNull':![],'unique':_0x7117('0x5'),'comment':_0x7117('0x3')},'VoiceQueueId':{'type':Sequelize[_0x7117('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7117('0x5'),'comment':_0x7117('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x7117('0x3')},'paused':{'type':Sequelize[_0x7117('0x2')](0xb),'defaultValue':0x0,'comment':_0x7117('0x3')}}; \ No newline at end of file +var _0xe888=['queue_interface','sequelize','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xe888,0x97));var _0x8e88=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0xe888[_0x3227c1];return _0x31fd48;};'use strict';var Sequelize=require(_0x8e88('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8e88('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x8e88('0x2')],'allowNull':![],'comment':_0x8e88('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8e88('0x2')],'allowNull':![],'unique':_0x8e88('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x8e88('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8e88('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x8e88('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x8e88('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 9b1e7af..e9785aa 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 _0xa1d7=['update','remove','emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt','save'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa1d7,0x8c));var _0x7a1d=function(_0x28f922,_0x1302f8){_0x28f922=_0x28f922-0x0;var _0x4eceac=_0xa1d7[_0x28f922];return _0x4eceac;};'use strict';var EventEmitter=require(_0x7a1d('0x0'));var UserVoiceQueueRt=require(_0x7a1d('0x1'))['db'][_0x7a1d('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a1d('0x3'),'afterUpdate':_0x7a1d('0x4'),'afterDestroy':_0x7a1d('0x5')};function emitEvent(_0xf8ba1){return function(_0x570ea7,_0x46f165,_0x329cfb){UserVoiceQueueRtEvents['emit'](_0xf8ba1+':'+_0x570ea7['id'],_0x570ea7);UserVoiceQueueRtEvents[_0x7a1d('0x6')](_0xf8ba1,_0x570ea7);_0x329cfb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x7a1d('0x7')](e,emitEvent(event));}}module[_0x7a1d('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x4756=['hook','exports','events','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x16141d,_0xf66077){var _0x512956=function(_0x80a038){while(--_0x80a038){_0x16141d['push'](_0x16141d['shift']());}};_0x512956(++_0xf66077);}(_0x4756,0x13d));var _0x6475=function(_0x18acb1,_0x438a64){_0x18acb1=_0x18acb1-0x0;var _0x36ea0b=_0x4756[_0x18acb1];return _0x36ea0b;};'use strict';var EventEmitter=require(_0x6475('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6475('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6475('0x2')};function emitEvent(_0x89dab4){return function(_0x5dae3d,_0x51e17d,_0x19c30e){UserVoiceQueueRtEvents[_0x6475('0x3')](_0x89dab4+':'+_0x5dae3d['id'],_0x5dae3d);UserVoiceQueueRtEvents[_0x6475('0x3')](_0x89dab4,_0x5dae3d);_0x19c30e(null);};}for(var e in events){if(events[_0x6475('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x6475('0x5')](e,emitEvent(event));}}module[_0x6475('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 5826672..3109703 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 _0x7e83=['api','bluebird','path','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7e83,0xc3));var _0x37e8=function(_0x1a381e,_0x3030ab){_0x1a381e=_0x1a381e-0x0;var _0x4d0482=_0x7e83[_0x1a381e];return _0x4d0482;};'use strict';var _=require(_0x37e8('0x0'));var util=require(_0x37e8('0x1'));var logger=require(_0x37e8('0x2'))(_0x37e8('0x3'));var moment=require('moment');var BPromise=require(_0x37e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37e8('0x5'));var rimraf=require('rimraf');var config=require(_0x37e8('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x37e8('0x7')]=function(_0x494cee,_0x1aa8ae){return _0x494cee[_0x37e8('0x8')](_0x37e8('0x9'),attributes,{'tableName':_0x37e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2aeb=['exports','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x57fd10,_0x1e6153){var _0x443ba1=function(_0x2c0d05){while(--_0x2c0d05){_0x57fd10['push'](_0x57fd10['shift']());}};_0x443ba1(++_0x1e6153);}(_0x2aeb,0xa4));var _0xb2ae=function(_0x1adcee,_0x21ed8e){_0x1adcee=_0x1adcee-0x0;var _0x4f79ba=_0x2aeb[_0x1adcee];return _0x4f79ba;};'use strict';var _=require(_0xb2ae('0x0'));var util=require(_0xb2ae('0x1'));var logger=require(_0xb2ae('0x2'))('api');var moment=require(_0xb2ae('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb2ae('0x4'));var config=require(_0xb2ae('0x5'));var attributes=require(_0xb2ae('0x6'));module[_0xb2ae('0x7')]=function(_0x40e417,_0x58213f){return _0x40e417['define']('UserVoiceQueueRt',attributes,{'tableName':_0xb2ae('0x8'),'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 cb28b7a..9556469 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 _0x5409=['client','http','redis','defaults','socket.io-emitter','register','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','COUNT','sequelize','literal','outboundQueuePauses','stringify','lodash','util','moment','randomstring','ioredis','jayson/promise'];(function(_0x73e588,_0x2c82b4){var _0x20ef8b=function(_0x708003){while(--_0x708003){_0x73e588['push'](_0x73e588['shift']());}};_0x20ef8b(++_0x2c82b4);}(_0x5409,0x156));var _0x9540=function(_0x3792f4,_0x139d6f){_0x3792f4=_0x3792f4-0x0;var _0x1f630b=_0x5409[_0x3792f4];return _0x1f630b;};'use strict';var _=require(_0x9540('0x0'));var util=require(_0x9540('0x1'));var moment=require(_0x9540('0x2'));var BPromise=require('bluebird');var rs=require(_0x9540('0x3'));var fs=require('fs');var Redis=require(_0x9540('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9540('0x5'));var client=jayson[_0x9540('0x6')][_0x9540('0x7')]({'port':0x232a});config[_0x9540('0x8')]=_[_0x9540('0x9')](config[_0x9540('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9540('0xa'))(new Redis(config[_0x9540('0x8')]));require('./userVoiceQueueRt.socket')[_0x9540('0xb')](socket);function respondWithRpcPromise(_0x393cfb,_0x49b1b9,_0x55c9d2){return new BPromise(function(_0x4810a5,_0xfdf903){return client['request'](_0x393cfb,_0x55c9d2)[_0x9540('0xc')](function(_0x1fef42){logger['info'](_0x9540('0xd'),_0x49b1b9,_0x9540('0xe'));logger[_0x9540('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x49b1b9,_0x9540('0xe'),JSON['stringify'](_0x1fef42));if(_0x1fef42[_0x9540('0x10')]){if(_0x1fef42[_0x9540('0x10')][_0x9540('0x11')]===0x1f4){logger[_0x9540('0x10')](_0x9540('0xd'),_0x49b1b9,_0x1fef42['error']['message']);return _0xfdf903(_0x1fef42['error'][_0x9540('0x12')]);}logger[_0x9540('0x10')](_0x9540('0xd'),_0x49b1b9,_0x1fef42['error'][_0x9540('0x12')]);return _0x4810a5(_0x1fef42[_0x9540('0x10')]['message']);}else{logger['info'](_0x9540('0xd'),_0x49b1b9,_0x9540('0xe'));_0x4810a5(_0x1fef42['result'][_0x9540('0x12')]);}})[_0x9540('0x13')](function(_0x95d633){logger[_0x9540('0x10')](_0x9540('0xd'),_0x49b1b9,_0x95d633);_0xfdf903(_0x95d633);});});}exports[_0x9540('0x14')]=function(_0x1f824f){var _0x2d6a6e=this;return new Promise(function(_0x1e9415,_0x495574){return db[_0x9540('0x15')]['findAll']({'raw':_0x1f824f[_0x9540('0x16')]?_0x1f824f['options'][_0x9540('0x17')]===undefined?!![]:![]:!![],'where':_0x1f824f[_0x9540('0x16')]?_0x1f824f[_0x9540('0x16')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x9540('0x18'),db[_0x9540('0x19')]['fn']('IF',db[_0x9540('0x19')][_0x9540('0x1a')]('`paused`\x20=\x201,\x201,\x20null'))),_0x9540('0x1b')]]})['then'](function(_0x3b5f5d){logger['info']('GetVoiceQueueRtPauses',_0x1f824f);logger[_0x9540('0xf')](_0x9540('0x14'),_0x1f824f,JSON[_0x9540('0x1c')](_0x3b5f5d));_0x1e9415(_0x3b5f5d);})[_0x9540('0x13')](function(_0x396d0e){logger['error'](_0x9540('0x14'),_0x396d0e['message'],_0x1f824f);_0x495574(_0x2d6a6e[_0x9540('0x10')](0x1f4,_0x396d0e[_0x9540('0x12')]));});});}; \ No newline at end of file +var _0x7733=['register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UserVoiceQueueRt,\x20%s,\x20%s','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket'];(function(_0x180b01,_0x16cd10){var _0x51fe8f=function(_0x3590b8){while(--_0x3590b8){_0x180b01['push'](_0x180b01['shift']());}};_0x51fe8f(++_0x16cd10);}(_0x7733,0xd4));var _0x3773=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x7733[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x3773('0x0'));var util=require(_0x3773('0x1'));var moment=require(_0x3773('0x2'));var BPromise=require(_0x3773('0x3'));var rs=require(_0x3773('0x4'));var fs=require('fs');var Redis=require(_0x3773('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3773('0x6'));var logger=require(_0x3773('0x7'))('rpc');var config=require(_0x3773('0x8'));var jayson=require(_0x3773('0x9'));var client=jayson[_0x3773('0xa')]['http']({'port':0x232a});config[_0x3773('0xb')]=_[_0x3773('0xc')](config[_0x3773('0xb')],{'host':_0x3773('0xd'),'port':0x18eb});var socket=require(_0x3773('0xe'))(new Redis(config[_0x3773('0xb')]));require(_0x3773('0xf'))[_0x3773('0x10')](socket);function respondWithRpcPromise(_0x2ea956,_0x5eb99c,_0x2186d4){return new BPromise(function(_0x70170b,_0x41f926){return client[_0x3773('0x11')](_0x2ea956,_0x2186d4)[_0x3773('0x12')](function(_0x3935a9){logger[_0x3773('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5eb99c,_0x3773('0x14'));logger[_0x3773('0x15')](_0x3773('0x16'),_0x5eb99c,_0x3773('0x14'),JSON[_0x3773('0x17')](_0x3935a9));if(_0x3935a9['error']){if(_0x3935a9['error'][_0x3773('0x18')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5eb99c,_0x3935a9[_0x3773('0x19')][_0x3773('0x1a')]);return _0x41f926(_0x3935a9[_0x3773('0x19')][_0x3773('0x1a')]);}logger[_0x3773('0x19')](_0x3773('0x1b'),_0x5eb99c,_0x3935a9[_0x3773('0x19')][_0x3773('0x1a')]);return _0x70170b(_0x3935a9[_0x3773('0x19')]['message']);}else{logger['info'](_0x3773('0x1b'),_0x5eb99c,_0x3773('0x14'));_0x70170b(_0x3935a9[_0x3773('0x1c')]['message']);}})[_0x3773('0x1d')](function(_0x3a50ab){logger[_0x3773('0x19')](_0x3773('0x1b'),_0x5eb99c,_0x3a50ab);_0x41f926(_0x3a50ab);});});}exports[_0x3773('0x1e')]=function(_0x266303){var _0x33529d=this;return new Promise(function(_0x42c0c3,_0x2fa011){return db[_0x3773('0x1f')][_0x3773('0x20')]({'raw':_0x266303[_0x3773('0x21')]?_0x266303[_0x3773('0x21')][_0x3773('0x22')]===undefined?!![]:![]:!![],'where':_0x266303[_0x3773('0x21')]?_0x266303[_0x3773('0x21')]['where']||null:null,'attributes':[[db[_0x3773('0x23')]['fn'](_0x3773('0x24'),db[_0x3773('0x23')]['fn']('IF',db[_0x3773('0x23')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x3773('0x25')]]})[_0x3773('0x12')](function(_0x32840b){logger['info'](_0x3773('0x1e'),_0x266303);logger[_0x3773('0x15')](_0x3773('0x1e'),_0x266303,JSON['stringify'](_0x32840b));_0x42c0c3(_0x32840b);})[_0x3773('0x1d')](function(_0xe6245c){logger[_0x3773('0x19')](_0x3773('0x1e'),_0xe6245c['message'],_0x266303);_0x2fa011(_0x33529d[_0x3773('0x19')](0x1f4,_0xe6245c[_0x3773('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 281b758..c9a1fdb 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 _0x14f5=['update','emit','removeListener','register','length','userVoiceQueueRt:','save'];(function(_0x414bb3,_0x3eeca4){var _0x31b0cc=function(_0x286392){while(--_0x286392){_0x414bb3['push'](_0x414bb3['shift']());}};_0x31b0cc(++_0x3eeca4);}(_0x14f5,0xae));var _0x514f=function(_0x4fcfda,_0x45099a){_0x4fcfda=_0x4fcfda-0x0;var _0x12c8a5=_0x14f5[_0x4fcfda];return _0x12c8a5;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x514f('0x0'),'remove',_0x514f('0x1')];function createListener(_0x2e8eb2,_0x12d5e2){return function(_0x5281a3){_0x12d5e2[_0x514f('0x2')](_0x2e8eb2,_0x5281a3);};}function removeListener(_0x2443e8,_0x483c2a){return function(){UserVoiceQueueRtEvents[_0x514f('0x3')](_0x2443e8,_0x483c2a);};}exports[_0x514f('0x4')]=function(_0xc2ca56){for(var _0x434452=0x0,_0x463985=events[_0x514f('0x5')];_0x434452<_0x463985;_0x434452++){var _0xdb9614=events[_0x434452];var _0x4a5497=createListener(_0x514f('0x6')+_0xdb9614,_0xc2ca56);UserVoiceQueueRtEvents['on'](_0xdb9614,_0x4a5497);}}; \ No newline at end of file +var _0x00f0=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x00f0,0xec));var _0x000f=function(_0x126c12,_0x194007){_0x126c12=_0x126c12-0x0;var _0x22a8fa=_0x00f0[_0x126c12];return _0x22a8fa;};'use strict';var UserVoiceQueueRtEvents=require(_0x000f('0x0'));var events=[_0x000f('0x1'),_0x000f('0x2'),_0x000f('0x3')];function createListener(_0x55b9cf,_0x4d5c3d){return function(_0x4095d5){_0x4d5c3d['emit'](_0x55b9cf,_0x4095d5);};}function removeListener(_0x3cd8ed,_0x53989d){return function(){UserVoiceQueueRtEvents[_0x000f('0x4')](_0x3cd8ed,_0x53989d);};}exports[_0x000f('0x5')]=function(_0x4ce2d9){for(var _0x7827b=0x0,_0x3c54d0=events[_0x000f('0x6')];_0x7827b<_0x3c54d0;_0x7827b++){var _0x621ab6=events[_0x7827b];var _0x330e11=createListener(_0x000f('0x7')+_0x621ab6,_0x4ce2d9);UserVoiceQueueRtEvents['on'](_0x621ab6,_0x330e11);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index faac0d6..5fba7c0 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x23d903,_0x140151){var _0x55ce97=function(_0x26a45b){while(--_0x26a45b){_0x23d903['push'](_0x23d903['shift']());}};_0x55ce97(++_0x140151);}(_0x70e0,0x17b));var _0x070e=function(_0x434390,_0x3e370b){_0x434390=_0x434390-0x0;var _0x53f373=_0x70e0[_0x434390];return _0x53f373;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x536498,_0x23cd37){var _0x582b16=function(_0x30967d){while(--_0x30967d){_0x536498['push'](_0x536498['shift']());}};_0x582b16(++_0x23cd37);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f8f7e,_0x47fd7d){_0x3f8f7e=_0x3f8f7e-0x0;var _0x5a708f=_0xedd9[_0x3f8f7e];return _0x5a708f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 3075827..9006424 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 _0x7bae=['INTEGER'];(function(_0x5707d2,_0x280c70){var _0x4e358d=function(_0x4a741e){while(--_0x4a741e){_0x5707d2['push'](_0x5707d2['shift']());}};_0x4e358d(++_0x280c70);}(_0x7bae,0x13b));var _0xe7ba=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7bae[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xe7ba('0x0')],'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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index a46e33f..c96dcf8 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 _0xf4b1=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','util','../../config/logger','api','moment','bluebird'];(function(_0x3192c1,_0x2c82ad){var _0x5418c5=function(_0x289ea9){while(--_0x289ea9){_0x3192c1['push'](_0x3192c1['shift']());}};_0x5418c5(++_0x2c82ad);}(_0xf4b1,0x74));var _0x1f4b=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xf4b1[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x1f4b('0x0'));var logger=require(_0x1f4b('0x1'))(_0x1f4b('0x2'));var moment=require(_0x1f4b('0x3'));var BPromise=require(_0x1f4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1f4b('0x5'));var config=require(_0x1f4b('0x6'));var attributes=require(_0x1f4b('0x7'));module[_0x1f4b('0x8')]=function(_0x1678d1,_0xb3597b){return _0x1678d1[_0x1f4b('0x9')](_0x1f4b('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7778=['bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment'];(function(_0x698215,_0x23dd08){var _0x54e777=function(_0x14e5bb){while(--_0x14e5bb){_0x698215['push'](_0x698215['shift']());}};_0x54e777(++_0x23dd08);}(_0x7778,0x8b));var _0x8777=function(_0x183119,_0x1162a5){_0x183119=_0x183119-0x0;var _0x19f642=_0x7778[_0x183119];return _0x19f642;};'use strict';var _=require(_0x8777('0x0'));var util=require(_0x8777('0x1'));var logger=require(_0x8777('0x2'))('api');var moment=require(_0x8777('0x3'));var BPromise=require(_0x8777('0x4'));var rp=require(_0x8777('0x5'));var fs=require('fs');var path=require(_0x8777('0x6'));var rimraf=require(_0x8777('0x7'));var config=require(_0x8777('0x8'));var attributes=require(_0x8777('0x9'));module[_0x8777('0xa')]=function(_0x3a37fd,_0x23cfe9){return _0x3a37fd['define'](_0x8777('0xb'),attributes,{'tableName':_0x8777('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index a3fbf1b..f846047 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 _0xfe37=['error','code','message','result','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xfe37,0xf4));var _0x7fe3=function(_0x2aad76,_0x52d456){_0x2aad76=_0x2aad76-0x0;var _0x465c40=_0xfe37[_0x2aad76];return _0x465c40;};'use strict';var _=require(_0x7fe3('0x0'));var util=require(_0x7fe3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fe3('0x2'));var db=require(_0x7fe3('0x3'))['db'];var utils=require(_0x7fe3('0x4'));var logger=require(_0x7fe3('0x5'))('rpc');var config=require(_0x7fe3('0x6'));var jayson=require(_0x7fe3('0x7'));var client=jayson[_0x7fe3('0x8')][_0x7fe3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x509c86,_0x15d088,_0x343978){return new BPromise(function(_0x828c89,_0x62774b){return client[_0x7fe3('0xa')](_0x509c86,_0x343978)['then'](function(_0x412335){logger[_0x7fe3('0xb')](_0x7fe3('0xc'),_0x15d088,_0x7fe3('0xd'));logger['debug'](_0x7fe3('0xe'),_0x15d088,'request\x20sent',JSON[_0x7fe3('0xf')](_0x412335));if(_0x412335[_0x7fe3('0x10')]){if(_0x412335['error'][_0x7fe3('0x11')]===0x1f4){logger[_0x7fe3('0x10')](_0x7fe3('0xc'),_0x15d088,_0x412335[_0x7fe3('0x10')][_0x7fe3('0x12')]);return _0x62774b(_0x412335[_0x7fe3('0x10')][_0x7fe3('0x12')]);}logger[_0x7fe3('0x10')](_0x7fe3('0xc'),_0x15d088,_0x412335[_0x7fe3('0x10')][_0x7fe3('0x12')]);return _0x828c89(_0x412335[_0x7fe3('0x10')]['message']);}else{logger[_0x7fe3('0xb')](_0x7fe3('0xc'),_0x15d088,_0x7fe3('0xd'));_0x828c89(_0x412335[_0x7fe3('0x13')][_0x7fe3('0x12')]);}})['catch'](function(_0xa05e0){logger[_0x7fe3('0x10')](_0x7fe3('0xc'),_0x15d088,_0xa05e0);_0x62774b(_0xa05e0);});});} \ No newline at end of file +var _0xfc2c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x59d888,_0x858fa4){var _0x59a5ef=function(_0x4c159f){while(--_0x4c159f){_0x59d888['push'](_0x59d888['shift']());}};_0x59a5ef(++_0x858fa4);}(_0xfc2c,0x191));var _0xcfc2=function(_0x4ec263,_0x52c94b){_0x4ec263=_0x4ec263-0x0;var _0x336deb=_0xfc2c[_0x4ec263];return _0x336deb;};'use strict';var _=require(_0xcfc2('0x0'));var util=require(_0xcfc2('0x1'));var moment=require(_0xcfc2('0x2'));var BPromise=require(_0xcfc2('0x3'));var rs=require(_0xcfc2('0x4'));var fs=require('fs');var Redis=require(_0xcfc2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfc2('0x6'));var logger=require(_0xcfc2('0x7'))(_0xcfc2('0x8'));var config=require(_0xcfc2('0x9'));var jayson=require(_0xcfc2('0xa'));var client=jayson[_0xcfc2('0xb')][_0xcfc2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e40ae,_0x395f7a,_0x1ffbd3){return new BPromise(function(_0x4b6a29,_0x234af3){return client[_0xcfc2('0xd')](_0x4e40ae,_0x1ffbd3)['then'](function(_0x3dd23b){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x395f7a,_0xcfc2('0xe'));logger[_0xcfc2('0xf')](_0xcfc2('0x10'),_0x395f7a,_0xcfc2('0xe'),JSON[_0xcfc2('0x11')](_0x3dd23b));if(_0x3dd23b[_0xcfc2('0x12')]){if(_0x3dd23b[_0xcfc2('0x12')][_0xcfc2('0x13')]===0x1f4){logger[_0xcfc2('0x12')](_0xcfc2('0x14'),_0x395f7a,_0x3dd23b[_0xcfc2('0x12')][_0xcfc2('0x15')]);return _0x234af3(_0x3dd23b[_0xcfc2('0x12')][_0xcfc2('0x15')]);}logger[_0xcfc2('0x12')](_0xcfc2('0x14'),_0x395f7a,_0x3dd23b[_0xcfc2('0x12')][_0xcfc2('0x15')]);return _0x4b6a29(_0x3dd23b[_0xcfc2('0x12')][_0xcfc2('0x15')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x395f7a,_0xcfc2('0xe'));_0x4b6a29(_0x3dd23b[_0xcfc2('0x16')][_0xcfc2('0x15')]);}})[_0xcfc2('0x17')](function(_0x378a3e){logger[_0xcfc2('0x12')](_0xcfc2('0x14'),_0x395f7a,_0x378a3e);_0x234af3(_0x378a3e);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 2fcac69..da7c007 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 _0x1c4d=['delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','index','get','/:id','show','create','update'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x1c4d,0x1d7));var _0xd1c4=function(_0x3c8a35,_0x196fa5){_0x3c8a35=_0x3c8a35-0x0;var _0x1d4bbe=_0x1c4d[_0x3c8a35];return _0x1d4bbe;};'use strict';var multer=require('multer');var util=require(_0xd1c4('0x0'));var path=require(_0xd1c4('0x1'));var timeout=require(_0xd1c4('0x2'));var express=require('express');var router=express[_0xd1c4('0x3')]();var fs_extra=require(_0xd1c4('0x4'));var auth=require(_0xd1c4('0x5'));var interaction=require(_0xd1c4('0x6'));var config=require('../../config/environment');var controller=require(_0xd1c4('0x7'));router['get']('/',auth[_0xd1c4('0x8')](),controller[_0xd1c4('0x9')]);router[_0xd1c4('0xa')](_0xd1c4('0xb'),auth[_0xd1c4('0x8')](),controller[_0xd1c4('0xc')]);router['post']('/',auth[_0xd1c4('0x8')](),controller[_0xd1c4('0xd')]);router['put'](_0xd1c4('0xb'),auth['isAuthenticated'](),controller[_0xd1c4('0xe')]);router[_0xd1c4('0xf')](_0xd1c4('0xb'),auth[_0xd1c4('0x8')](),controller[_0xd1c4('0x10')]);module[_0xd1c4('0x11')]=router; \ No newline at end of file +var _0x6921=['post','create','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x55448c,_0x174be9){var _0x3b6b3a=function(_0x1ac9e0){while(--_0x1ac9e0){_0x55448c['push'](_0x55448c['shift']());}};_0x3b6b3a(++_0x174be9);}(_0x6921,0x1d1));var _0x1692=function(_0x33837d,_0x35f93b){_0x33837d=_0x33837d-0x0;var _0x133c21=_0x6921[_0x33837d];return _0x133c21;};'use strict';var multer=require('multer');var util=require(_0x1692('0x0'));var path=require('path');var timeout=require(_0x1692('0x1'));var express=require('express');var router=express[_0x1692('0x2')]();var fs_extra=require(_0x1692('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1692('0x4'));var config=require('../../config/environment');var controller=require(_0x1692('0x5'));router[_0x1692('0x6')]('/',auth[_0x1692('0x7')](),controller[_0x1692('0x8')]);router[_0x1692('0x6')](_0x1692('0x9'),auth[_0x1692('0x7')](),controller[_0x1692('0xa')]);router[_0x1692('0xb')]('/',auth[_0x1692('0x7')](),controller[_0x1692('0xc')]);router['put'](_0x1692('0x9'),auth['isAuthenticated'](),controller[_0x1692('0xd')]);router[_0x1692('0xe')](_0x1692('0x9'),auth[_0x1692('0x7')](),controller[_0x1692('0xf')]);module[_0x1692('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 910cb31..a43d4d0 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 _0x2c54=['STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2c54,0x181));var _0x42c5=function(_0x370449,_0x5dbfc3){_0x370449=_0x370449-0x0;var _0x340356=_0x2c54[_0x370449];return _0x340356;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x42c5('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x42c5('0x0')]}}; \ No newline at end of file +var _0xd84d=['sequelize','STRING','name'];(function(_0x46cbff,_0x246e9){var _0x1554a4=function(_0x23ab02){while(--_0x23ab02){_0x46cbff['push'](_0x46cbff['shift']());}};_0x1554a4(++_0x246e9);}(_0xd84d,0x69));var _0xdd84=function(_0x33a559,_0x37ccba){_0x33a559=_0x33a559-0x0;var _0x5bff0f=_0xd84d[_0x33a559];return _0x5bff0f;};'use strict';var Sequelize=require(_0xdd84('0x0'));module['exports']={'name':{'type':Sequelize[_0xdd84('0x1')],'unique':_0xdd84('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdd84('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 0b9d82e..b6fa8fc 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 _0xf1f5=['catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','save','update','then','destroy','Variables','UserProfileResource','error','stack','name','send','map','Variable','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x11518f,_0x367253){var _0x34153f=function(_0x458e6c){while(--_0x458e6c){_0x11518f['push'](_0x11518f['shift']());}};_0x34153f(++_0x367253);}(_0xf1f5,0xb4));var _0x5f1f=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xf1f5[_0x251d9c];return _0x16ae64;};'use strict';var emlformat=require(_0x5f1f('0x0'));var rimraf=require(_0x5f1f('0x1'));var zipdir=require(_0x5f1f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f1f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5f1f('0x4'));var util=require(_0x5f1f('0x5'));var path=require('path');var sox=require(_0x5f1f('0x6'));var csv=require(_0x5f1f('0x7'));var ejs=require(_0x5f1f('0x8'));var fs=require('fs');var fs_extra=require(_0x5f1f('0x9'));var _=require(_0x5f1f('0xa'));var squel=require(_0x5f1f('0xb'));var crypto=require(_0x5f1f('0xc'));var jsforce=require(_0x5f1f('0xd'));var deskjs=require(_0x5f1f('0xe'));var toCsv=require(_0x5f1f('0x7'));var querystring=require(_0x5f1f('0xf'));var Papa=require(_0x5f1f('0x10'));var Redis=require(_0x5f1f('0x11'));var authService=require(_0x5f1f('0x12'));var qs=require(_0x5f1f('0x13'));var as=require(_0x5f1f('0x14'));var hardwareService=require(_0x5f1f('0x15'));var logger=require(_0x5f1f('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5f1f('0x17'));var licenseUtil=require(_0x5f1f('0x18'));var db=require(_0x5f1f('0x19'))['db'];function respondWithStatusCode(_0x41fbe2,_0xf6eede){_0xf6eede=_0xf6eede||0xcc;return function(_0x2df8e9){if(_0x2df8e9){return _0x41fbe2[_0x5f1f('0x1a')](_0xf6eede);}return _0x41fbe2[_0x5f1f('0x1b')](_0xf6eede)[_0x5f1f('0x1c')]();};}function respondWithResult(_0x392886,_0x110b02){_0x110b02=_0x110b02||0xc8;return function(_0x385632){if(_0x385632){return _0x392886[_0x5f1f('0x1b')](_0x110b02)[_0x5f1f('0x1d')](_0x385632);}};}function respondWithFilteredResult(_0x3c0edb,_0x580118){return function(_0x51cf2f){if(_0x51cf2f){var _0x4b2aeb=typeof _0x580118[_0x5f1f('0x1e')]===_0x5f1f('0x1f')&&typeof _0x580118['limit']===_0x5f1f('0x1f');var _0x2809c4=_0x51cf2f['count'];var _0x24b22e=_0x4b2aeb?0x0:_0x580118[_0x5f1f('0x1e')];var _0x3129fc=_0x4b2aeb?_0x51cf2f[_0x5f1f('0x20')]:_0x580118[_0x5f1f('0x1e')]+_0x580118['limit'];var _0x2e64a6;if(_0x3129fc>=_0x2809c4){_0x3129fc=_0x2809c4;_0x2e64a6=0xc8;}else{_0x2e64a6=0xce;}_0x3c0edb['status'](_0x2e64a6);return _0x3c0edb['set'](_0x5f1f('0x21'),_0x24b22e+'-'+_0x3129fc+'/'+_0x2809c4)[_0x5f1f('0x1d')](_0x51cf2f);}return null;};}function patchUpdates(_0x4fd27b){return function(_0x215a7a){try{jsonpatch['apply'](_0x215a7a,_0x4fd27b,!![]);}catch(_0xa814cb){return BPromise['reject'](_0xa814cb);}return _0x215a7a[_0x5f1f('0x22')]();};}function saveUpdates(_0x1b91d1,_0x1d4b45){return function(_0x5681c1){if(_0x5681c1){return _0x5681c1[_0x5f1f('0x23')](_0x1b91d1)[_0x5f1f('0x24')](function(_0x378313){return _0x378313;});}return null;};}function removeEntity(_0x4bba14,_0x470661){return function(_0x348ac6){if(_0x348ac6){return _0x348ac6[_0x5f1f('0x25')]()[_0x5f1f('0x24')](function(){var _0x56a6fc=_0x348ac6['get']({'plain':!![]});var _0x89eb72=_0x5f1f('0x26');return db[_0x5f1f('0x27')][_0x5f1f('0x25')]({'where':{'type':_0x89eb72,'resourceId':_0x56a6fc['id']}})[_0x5f1f('0x24')](function(){return _0x348ac6;});})['then'](function(){_0x4bba14['status'](0xcc)[_0x5f1f('0x1c')]();});}};}function handleEntityNotFound(_0x29c040,_0x91822b){return function(_0xfa6886){if(!_0xfa6886){_0x29c040[_0x5f1f('0x1a')](0x194);}return _0xfa6886;};}function handleError(_0x2c3bf6,_0x1a0a1e){_0x1a0a1e=_0x1a0a1e||0x1f4;return function(_0x3985b8){logger[_0x5f1f('0x28')](_0x3985b8[_0x5f1f('0x29')]);if(_0x3985b8[_0x5f1f('0x2a')]){delete _0x3985b8[_0x5f1f('0x2a')];}_0x2c3bf6[_0x5f1f('0x1b')](_0x1a0a1e)[_0x5f1f('0x2b')](_0x3985b8);};}exports['index']=function(_0x2a5e34,_0x4748f2){var _0x5a0a35={},_0x171613={},_0x2060f9={'count':0x0,'rows':[]};var _0x5380a5=_[_0x5f1f('0x2c')](db[_0x5f1f('0x2d')][_0x5f1f('0x2e')],function(_0x437a3d){return{'name':_0x437a3d['fieldName'],'type':_0x437a3d[_0x5f1f('0x2f')]['key']};});_0x171613['model']=_[_0x5f1f('0x2c')](_0x5380a5,_0x5f1f('0x2a'));_0x171613[_0x5f1f('0x30')]=_[_0x5f1f('0x31')](_0x2a5e34[_0x5f1f('0x30')]);_0x171613[_0x5f1f('0x32')]=_[_0x5f1f('0x33')](_0x171613[_0x5f1f('0x34')],_0x171613[_0x5f1f('0x30')]);_0x5a0a35['attributes']=_[_0x5f1f('0x33')](_0x171613[_0x5f1f('0x34')],qs[_0x5f1f('0x35')](_0x2a5e34[_0x5f1f('0x30')][_0x5f1f('0x35')]));_0x5a0a35[_0x5f1f('0x36')]=_0x5a0a35[_0x5f1f('0x36')][_0x5f1f('0x37')]?_0x5a0a35[_0x5f1f('0x36')]:_0x171613[_0x5f1f('0x34')];if(!_0x2a5e34[_0x5f1f('0x30')][_0x5f1f('0x38')]('nolimit')){_0x5a0a35[_0x5f1f('0x39')]=qs[_0x5f1f('0x39')](_0x2a5e34['query'][_0x5f1f('0x39')]);_0x5a0a35[_0x5f1f('0x1e')]=qs[_0x5f1f('0x1e')](_0x2a5e34[_0x5f1f('0x30')]['offset']);}_0x5a0a35['order']=qs[_0x5f1f('0x3a')](_0x2a5e34[_0x5f1f('0x30')][_0x5f1f('0x3a')]);_0x5a0a35['where']=qs[_0x5f1f('0x32')](_[_0x5f1f('0x3b')](_0x2a5e34['query'],_0x171613['filters']),_0x5380a5);if(_0x2a5e34[_0x5f1f('0x30')][_0x5f1f('0x3c')]){_0x5a0a35[_0x5f1f('0x3d')]=_[_0x5f1f('0x3e')](_0x5a0a35[_0x5f1f('0x3d')],{'$or':_['map'](_0x5380a5,function(_0x44f004){if(_0x44f004[_0x5f1f('0x2f')]!==_0x5f1f('0x3f')){var _0x3753ec={};_0x3753ec[_0x44f004['name']]={'$like':'%'+_0x2a5e34[_0x5f1f('0x30')]['filter']+'%'};return _0x3753ec;}})});}_0x5a0a35=_['merge']({},_0x5a0a35,_0x2a5e34[_0x5f1f('0x40')]);var _0x2275b1={'where':_0x5a0a35[_0x5f1f('0x3d')]};return db[_0x5f1f('0x2d')]['count'](_0x2275b1)[_0x5f1f('0x24')](function(_0x56cc3b){_0x2060f9['count']=_0x56cc3b;if(_0x2a5e34[_0x5f1f('0x30')][_0x5f1f('0x41')]){_0x5a0a35[_0x5f1f('0x42')]=[{'all':!![]}];}return db['Variable'][_0x5f1f('0x43')](_0x5a0a35);})['then'](function(_0x1ce259){_0x2060f9[_0x5f1f('0x44')]=_0x1ce259;return _0x2060f9;})[_0x5f1f('0x24')](respondWithFilteredResult(_0x4748f2,_0x5a0a35))[_0x5f1f('0x45')](handleError(_0x4748f2,null));};exports[_0x5f1f('0x46')]=function(_0x2296f8,_0x1c6c32){var _0x4bdc40={'raw':!![],'where':{'id':_0x2296f8[_0x5f1f('0x47')]['id']}},_0x3483e2={};_0x3483e2[_0x5f1f('0x34')]=_[_0x5f1f('0x31')](db[_0x5f1f('0x2d')][_0x5f1f('0x2e')]);_0x3483e2[_0x5f1f('0x30')]=_[_0x5f1f('0x31')](_0x2296f8[_0x5f1f('0x30')]);_0x3483e2['filters']=_[_0x5f1f('0x33')](_0x3483e2[_0x5f1f('0x34')],_0x3483e2[_0x5f1f('0x30')]);_0x4bdc40[_0x5f1f('0x36')]=_['intersection'](_0x3483e2['model'],qs[_0x5f1f('0x35')](_0x2296f8['query'][_0x5f1f('0x35')]));_0x4bdc40['attributes']=_0x4bdc40[_0x5f1f('0x36')][_0x5f1f('0x37')]?_0x4bdc40[_0x5f1f('0x36')]:_0x3483e2[_0x5f1f('0x34')];if(_0x2296f8['query'][_0x5f1f('0x41')]){_0x4bdc40[_0x5f1f('0x42')]=[{'all':!![]}];}_0x4bdc40=_[_0x5f1f('0x3e')]({},_0x4bdc40,_0x2296f8['options']);return db[_0x5f1f('0x2d')]['find'](_0x4bdc40)[_0x5f1f('0x24')](handleEntityNotFound(_0x1c6c32,null))[_0x5f1f('0x24')](respondWithResult(_0x1c6c32,null))[_0x5f1f('0x45')](handleError(_0x1c6c32,null));};exports[_0x5f1f('0x48')]=function(_0x57a40e,_0x23c46e){return db['Variable'][_0x5f1f('0x48')](_0x57a40e[_0x5f1f('0x49')],{})[_0x5f1f('0x24')](function(_0x25eef9){var _0xb08089=_0x57a40e[_0x5f1f('0x4a')]['get']({'plain':!![]});if(!_0xb08089)throw new Error(_0x5f1f('0x4b'));if(_0xb08089[_0x5f1f('0x4c')]===_0x5f1f('0x4a')){var _0x477110=_0x25eef9[_0x5f1f('0x4d')]({'plain':!![]});var _0x353fdf=_0x5f1f('0x26');return db[_0x5f1f('0x4e')][_0x5f1f('0x4f')]({'where':{'name':_0x353fdf,'userProfileId':_0xb08089[_0x5f1f('0x50')]},'raw':!![]})[_0x5f1f('0x24')](function(_0x4d90e6){if(_0x4d90e6&&_0x4d90e6[_0x5f1f('0x51')]===0x0){return db[_0x5f1f('0x27')][_0x5f1f('0x48')]({'name':_0x477110[_0x5f1f('0x2a')],'resourceId':_0x477110['id'],'type':_0x4d90e6[_0x5f1f('0x2a')],'sectionId':_0x4d90e6['id']},{})[_0x5f1f('0x24')](function(){return _0x25eef9;});}else{return _0x25eef9;}})[_0x5f1f('0x45')](function(_0x598439){logger[_0x5f1f('0x28')](_0x5f1f('0x52'),_0x598439);throw _0x598439;});}return _0x25eef9;})[_0x5f1f('0x24')](respondWithResult(_0x23c46e,0xc9))['catch'](handleError(_0x23c46e,null));};exports[_0x5f1f('0x23')]=function(_0x591707,_0x9f60b6){if(_0x591707[_0x5f1f('0x49')]['id']){delete _0x591707['body']['id'];}return db[_0x5f1f('0x2d')]['find']({'where':{'id':_0x591707[_0x5f1f('0x47')]['id']}})[_0x5f1f('0x24')](handleEntityNotFound(_0x9f60b6,null))[_0x5f1f('0x24')](saveUpdates(_0x591707[_0x5f1f('0x49')],null))[_0x5f1f('0x24')](respondWithResult(_0x9f60b6,null))[_0x5f1f('0x45')](handleError(_0x9f60b6,null));};exports['destroy']=function(_0x1f4b56,_0x580ab2){return db[_0x5f1f('0x2d')][_0x5f1f('0x4f')]({'where':{'id':_0x1f4b56[_0x5f1f('0x47')]['id']}})[_0x5f1f('0x24')](handleEntityNotFound(_0x580ab2,null))[_0x5f1f('0x24')](removeEntity(_0x580ab2,null))['catch'](handleError(_0x580ab2,null));}; \ No newline at end of file +var _0xa36c=['undefined','limit','count','Content-Range','apply','reject','update','destroy','then','get','Variables','sendStatus','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','user','role','UserProfileSection','userProfileId','autoAssociation','create','params','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset'];(function(_0x227427,_0x39a41d){var _0x2f3aef=function(_0x391c69){while(--_0x391c69){_0x227427['push'](_0x227427['shift']());}};_0x2f3aef(++_0x39a41d);}(_0xa36c,0x17c));var _0xca36=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa36c[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xca36('0x0'));var rimraf=require(_0xca36('0x1'));var zipdir=require(_0xca36('0x2'));var jsonpatch=require(_0xca36('0x3'));var rp=require('request-promise');var moment=require(_0xca36('0x4'));var BPromise=require(_0xca36('0x5'));var Mustache=require(_0xca36('0x6'));var util=require(_0xca36('0x7'));var path=require(_0xca36('0x8'));var sox=require(_0xca36('0x9'));var csv=require(_0xca36('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca36('0xb'));var _=require(_0xca36('0xc'));var squel=require('squel');var crypto=require(_0xca36('0xd'));var jsforce=require(_0xca36('0xe'));var deskjs=require(_0xca36('0xf'));var toCsv=require(_0xca36('0xa'));var querystring=require(_0xca36('0x10'));var Papa=require(_0xca36('0x11'));var Redis=require(_0xca36('0x12'));var authService=require(_0xca36('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xca36('0x14'));var hardwareService=require(_0xca36('0x15'));var logger=require(_0xca36('0x16'))('api');var utils=require(_0xca36('0x17'));var config=require(_0xca36('0x18'));var licenseUtil=require(_0xca36('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x224cc2,_0x1cfcc9){_0x1cfcc9=_0x1cfcc9||0xcc;return function(_0x326668){if(_0x326668){return _0x224cc2['sendStatus'](_0x1cfcc9);}return _0x224cc2[_0xca36('0x1a')](_0x1cfcc9)[_0xca36('0x1b')]();};}function respondWithResult(_0x9b14cf,_0x4c91cd){_0x4c91cd=_0x4c91cd||0xc8;return function(_0x4573aa){if(_0x4573aa){return _0x9b14cf[_0xca36('0x1a')](_0x4c91cd)[_0xca36('0x1c')](_0x4573aa);}};}function respondWithFilteredResult(_0x148dbc,_0x586085){return function(_0xa02458){if(_0xa02458){var _0xb8d23b=typeof _0x586085[_0xca36('0x1d')]===_0xca36('0x1e')&&typeof _0x586085[_0xca36('0x1f')]===_0xca36('0x1e');var _0x3041fd=_0xa02458['count'];var _0x283fdf=_0xb8d23b?0x0:_0x586085[_0xca36('0x1d')];var _0x1c0b2b=_0xb8d23b?_0xa02458[_0xca36('0x20')]:_0x586085[_0xca36('0x1d')]+_0x586085[_0xca36('0x1f')];var _0x50e51f;if(_0x1c0b2b>=_0x3041fd){_0x1c0b2b=_0x3041fd;_0x50e51f=0xc8;}else{_0x50e51f=0xce;}_0x148dbc[_0xca36('0x1a')](_0x50e51f);return _0x148dbc['set'](_0xca36('0x21'),_0x283fdf+'-'+_0x1c0b2b+'/'+_0x3041fd)[_0xca36('0x1c')](_0xa02458);}return null;};}function patchUpdates(_0x458c7f){return function(_0xaa047f){try{jsonpatch[_0xca36('0x22')](_0xaa047f,_0x458c7f,!![]);}catch(_0x326d39){return BPromise[_0xca36('0x23')](_0x326d39);}return _0xaa047f['save']();};}function saveUpdates(_0x7a47ba,_0x110fdb){return function(_0x392d8b){if(_0x392d8b){return _0x392d8b[_0xca36('0x24')](_0x7a47ba)['then'](function(_0x3183d0){return _0x3183d0;});}return null;};}function removeEntity(_0x372493,_0x3d8f62){return function(_0x3c40a4){if(_0x3c40a4){return _0x3c40a4[_0xca36('0x25')]()[_0xca36('0x26')](function(){var _0x37b253=_0x3c40a4[_0xca36('0x27')]({'plain':!![]});var _0xa5b713=_0xca36('0x28');return db['UserProfileResource'][_0xca36('0x25')]({'where':{'type':_0xa5b713,'resourceId':_0x37b253['id']}})[_0xca36('0x26')](function(){return _0x3c40a4;});})[_0xca36('0x26')](function(){_0x372493[_0xca36('0x1a')](0xcc)[_0xca36('0x1b')]();});}};}function handleEntityNotFound(_0x346695,_0xf261ac){return function(_0x7d8ea3){if(!_0x7d8ea3){_0x346695[_0xca36('0x29')](0x194);}return _0x7d8ea3;};}function handleError(_0x549ff5,_0x4c413c){_0x4c413c=_0x4c413c||0x1f4;return function(_0x50d4c2){logger['error'](_0x50d4c2[_0xca36('0x2a')]);if(_0x50d4c2[_0xca36('0x2b')]){delete _0x50d4c2[_0xca36('0x2b')];}_0x549ff5[_0xca36('0x1a')](_0x4c413c)[_0xca36('0x2c')](_0x50d4c2);};}exports[_0xca36('0x2d')]=function(_0x5144ec,_0x517a3e){var _0x2bbbf2={},_0x476c24={},_0x2e0c22={'count':0x0,'rows':[]};var _0x5472b0=_[_0xca36('0x2e')](db[_0xca36('0x2f')][_0xca36('0x30')],function(_0x2c4bd0){return{'name':_0x2c4bd0[_0xca36('0x31')],'type':_0x2c4bd0[_0xca36('0x32')][_0xca36('0x33')]};});_0x476c24[_0xca36('0x34')]=_[_0xca36('0x2e')](_0x5472b0,_0xca36('0x2b'));_0x476c24['query']=_[_0xca36('0x35')](_0x5144ec[_0xca36('0x36')]);_0x476c24['filters']=_[_0xca36('0x37')](_0x476c24[_0xca36('0x34')],_0x476c24[_0xca36('0x36')]);_0x2bbbf2[_0xca36('0x38')]=_[_0xca36('0x37')](_0x476c24[_0xca36('0x34')],qs[_0xca36('0x39')](_0x5144ec[_0xca36('0x36')]['fields']));_0x2bbbf2[_0xca36('0x38')]=_0x2bbbf2[_0xca36('0x38')][_0xca36('0x3a')]?_0x2bbbf2[_0xca36('0x38')]:_0x476c24['model'];if(!_0x5144ec['query']['hasOwnProperty'](_0xca36('0x3b'))){_0x2bbbf2[_0xca36('0x1f')]=qs[_0xca36('0x1f')](_0x5144ec[_0xca36('0x36')][_0xca36('0x1f')]);_0x2bbbf2[_0xca36('0x1d')]=qs[_0xca36('0x1d')](_0x5144ec[_0xca36('0x36')][_0xca36('0x1d')]);}_0x2bbbf2['order']=qs[_0xca36('0x3c')](_0x5144ec['query']['sort']);_0x2bbbf2[_0xca36('0x3d')]=qs[_0xca36('0x3e')](_[_0xca36('0x3f')](_0x5144ec[_0xca36('0x36')],_0x476c24['filters']),_0x5472b0);if(_0x5144ec[_0xca36('0x36')]['filter']){_0x2bbbf2[_0xca36('0x3d')]=_[_0xca36('0x40')](_0x2bbbf2[_0xca36('0x3d')],{'$or':_[_0xca36('0x2e')](_0x5472b0,function(_0x307786){if(_0x307786[_0xca36('0x32')]!==_0xca36('0x41')){var _0x250212={};_0x250212[_0x307786[_0xca36('0x2b')]]={'$like':'%'+_0x5144ec['query'][_0xca36('0x42')]+'%'};return _0x250212;}})});}_0x2bbbf2=_[_0xca36('0x40')]({},_0x2bbbf2,_0x5144ec[_0xca36('0x43')]);var _0x11bf34={'where':_0x2bbbf2[_0xca36('0x3d')]};return db[_0xca36('0x2f')][_0xca36('0x20')](_0x11bf34)[_0xca36('0x26')](function(_0x1977cf){_0x2e0c22[_0xca36('0x20')]=_0x1977cf;if(_0x5144ec[_0xca36('0x36')][_0xca36('0x44')]){_0x2bbbf2[_0xca36('0x45')]=[{'all':!![]}];}return db[_0xca36('0x2f')]['findAll'](_0x2bbbf2);})['then'](function(_0x3b16a5){_0x2e0c22[_0xca36('0x46')]=_0x3b16a5;return _0x2e0c22;})['then'](respondWithFilteredResult(_0x517a3e,_0x2bbbf2))[_0xca36('0x47')](handleError(_0x517a3e,null));};exports[_0xca36('0x48')]=function(_0x338e49,_0x501fd2){var _0xc01643={'raw':!![],'where':{'id':_0x338e49['params']['id']}},_0x28c184={};_0x28c184['model']=_[_0xca36('0x35')](db[_0xca36('0x2f')]['rawAttributes']);_0x28c184['query']=_[_0xca36('0x35')](_0x338e49[_0xca36('0x36')]);_0x28c184[_0xca36('0x3e')]=_['intersection'](_0x28c184[_0xca36('0x34')],_0x28c184[_0xca36('0x36')]);_0xc01643[_0xca36('0x38')]=_[_0xca36('0x37')](_0x28c184[_0xca36('0x34')],qs[_0xca36('0x39')](_0x338e49['query'][_0xca36('0x39')]));_0xc01643[_0xca36('0x38')]=_0xc01643[_0xca36('0x38')][_0xca36('0x3a')]?_0xc01643[_0xca36('0x38')]:_0x28c184[_0xca36('0x34')];if(_0x338e49['query']['includeAll']){_0xc01643['include']=[{'all':!![]}];}_0xc01643=_[_0xca36('0x40')]({},_0xc01643,_0x338e49[_0xca36('0x43')]);return db[_0xca36('0x2f')][_0xca36('0x49')](_0xc01643)[_0xca36('0x26')](handleEntityNotFound(_0x501fd2,null))[_0xca36('0x26')](respondWithResult(_0x501fd2,null))[_0xca36('0x47')](handleError(_0x501fd2,null));};exports['create']=function(_0x211ed4,_0xfdfcc0){return db['Variable']['create'](_0x211ed4['body'],{})[_0xca36('0x26')](function(_0x272cd0){var _0x3e64cd=_0x211ed4[_0xca36('0x4a')][_0xca36('0x27')]({'plain':!![]});if(!_0x3e64cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e64cd[_0xca36('0x4b')]===_0xca36('0x4a')){var _0x14dc30=_0x272cd0['get']({'plain':!![]});var _0x4d0859=_0xca36('0x28');return db[_0xca36('0x4c')][_0xca36('0x49')]({'where':{'name':_0x4d0859,'userProfileId':_0x3e64cd[_0xca36('0x4d')]},'raw':!![]})['then'](function(_0x4f1907){if(_0x4f1907&&_0x4f1907[_0xca36('0x4e')]===0x0){return db['UserProfileResource'][_0xca36('0x4f')]({'name':_0x14dc30[_0xca36('0x2b')],'resourceId':_0x14dc30['id'],'type':_0x4f1907[_0xca36('0x2b')],'sectionId':_0x4f1907['id']},{})[_0xca36('0x26')](function(){return _0x272cd0;});}else{return _0x272cd0;}})[_0xca36('0x47')](function(_0x332007){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x332007);throw _0x332007;});}return _0x272cd0;})[_0xca36('0x26')](respondWithResult(_0xfdfcc0,0xc9))[_0xca36('0x47')](handleError(_0xfdfcc0,null));};exports['update']=function(_0x404517,_0x1c76bd){if(_0x404517['body']['id']){delete _0x404517['body']['id'];}return db['Variable'][_0xca36('0x49')]({'where':{'id':_0x404517[_0xca36('0x50')]['id']}})['then'](handleEntityNotFound(_0x1c76bd,null))[_0xca36('0x26')](saveUpdates(_0x404517[_0xca36('0x51')],null))[_0xca36('0x26')](respondWithResult(_0x1c76bd,null))[_0xca36('0x47')](handleError(_0x1c76bd,null));};exports[_0xca36('0x25')]=function(_0x397d56,_0x4262d5){return db[_0xca36('0x2f')][_0xca36('0x49')]({'where':{'id':_0x397d56[_0xca36('0x50')]['id']}})[_0xca36('0x26')](handleEntityNotFound(_0x4262d5,null))['then'](removeEntity(_0x4262d5,null))[_0xca36('0x47')](handleError(_0x4262d5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 42131e7..00baf77 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 _0x0497=['../../config/logger','api','bluebird','request-promise','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables'];(function(_0x53bedc,_0x553614){var _0x5a12e6=function(_0x3ce490){while(--_0x3ce490){_0x53bedc['push'](_0x53bedc['shift']());}};_0x5a12e6(++_0x553614);}(_0x0497,0x1e4));var _0x7049=function(_0x1458e2,_0x1b45c2){_0x1458e2=_0x1458e2-0x0;var _0x4d191c=_0x0497[_0x1458e2];return _0x4d191c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7049('0x0'))(_0x7049('0x1'));var moment=require('moment');var BPromise=require(_0x7049('0x2'));var rp=require(_0x7049('0x3'));var fs=require('fs');var path=require(_0x7049('0x4'));var rimraf=require(_0x7049('0x5'));var config=require('../../config/environment');var attributes=require(_0x7049('0x6'));module[_0x7049('0x7')]=function(_0x47ad90,_0x9476bd){return _0x47ad90[_0x7049('0x8')](_0x7049('0x9'),attributes,{'tableName':_0x7049('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0c1=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Variable','tools_variables'];(function(_0x4a0d89,_0x1c0550){var _0x5946c3=function(_0xf76a7b){while(--_0xf76a7b){_0x4a0d89['push'](_0x4a0d89['shift']());}};_0x5946c3(++_0x1c0550);}(_0xa0c1,0x114));var _0x1a0c=function(_0x3d552b,_0x5c65ff){_0x3d552b=_0x3d552b-0x0;var _0x301793=_0xa0c1[_0x3d552b];return _0x301793;};'use strict';var _=require(_0x1a0c('0x0'));var util=require(_0x1a0c('0x1'));var logger=require(_0x1a0c('0x2'))('api');var moment=require(_0x1a0c('0x3'));var BPromise=require(_0x1a0c('0x4'));var rp=require(_0x1a0c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a0c('0x6'));var config=require(_0x1a0c('0x7'));var attributes=require('./variable.attributes');module[_0x1a0c('0x8')]=function(_0x5ecf03,_0x1ccef8){return _0x5ecf03[_0x1a0c('0x9')](_0x1a0c('0xa'),attributes,{'tableName':_0x1a0c('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 4478919..78bc06e 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 _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(_0x3518b6,_0x1d6005){var _0x55a221=function(_0x25ebfa){while(--_0x25ebfa){_0x3518b6['push'](_0x3518b6['shift']());}};_0x55a221(++_0x1d6005);}(_0x5fc3,0xa8));var _0x35fc=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x5fc3[_0x8ae98b];return _0xc30bd4;};'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 +var _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x326f,0xd1));var _0xf326=function(_0x50438a,_0x45accc){_0x50438a=_0x50438a-0x0;var _0x5ec0c3=_0x326f[_0x50438a];return _0x5ec0c3;};'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')]('Variable,\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')]('Variable,\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')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index d686b51..4bffce6 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 _0x998b=['exports','Router','./version.controller','get','/fetch','isAuthenticated','canUpdate','/pull','/restart','restart','/migrations','migrations'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x998b,0x12d));var _0xb998=function(_0x4a9818,_0x4e60d6){_0x4a9818=_0x4a9818-0x0;var _0xccc713=_0x998b[_0x4a9818];return _0xccc713;};'use strict';var express=require('express');var router=express[_0xb998('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xb998('0x1'));router[_0xb998('0x2')]('/',controller['index']);router[_0xb998('0x2')](_0xb998('0x3'),auth[_0xb998('0x4')](),auth[_0xb998('0x5')](),controller['fetch']);router[_0xb998('0x2')]('/reset',auth[_0xb998('0x4')](),auth[_0xb998('0x5')](),controller['reset']);router[_0xb998('0x2')](_0xb998('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller['pull']);router['get'](_0xb998('0x7'),auth[_0xb998('0x4')](),controller[_0xb998('0x8')]);router[_0xb998('0x2')](_0xb998('0x9'),controller[_0xb998('0xa')]);module[_0xb998('0xb')]=router; \ No newline at end of file +var _0x0dcb=['/fetch','canUpdate','get','/reset','isAuthenticated','reset','/pull','pull','/restart','restart','/migrations','exports','Router','../../components/auth/service','./version.controller','index'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0dcb,0x12c));var _0xb0dc=function(_0x44eeb9,_0x1a5603){_0x44eeb9=_0x44eeb9-0x0;var _0x38738f=_0x0dcb[_0x44eeb9];return _0x38738f;};'use strict';var express=require('express');var router=express[_0xb0dc('0x0')]();var auth=require(_0xb0dc('0x1'));var controller=require(_0xb0dc('0x2'));router['get']('/',controller[_0xb0dc('0x3')]);router['get'](_0xb0dc('0x4'),auth['isAuthenticated'](),auth[_0xb0dc('0x5')](),controller['fetch']);router[_0xb0dc('0x6')](_0xb0dc('0x7'),auth[_0xb0dc('0x8')](),auth[_0xb0dc('0x5')](),controller[_0xb0dc('0x9')]);router[_0xb0dc('0x6')](_0xb0dc('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xb0dc('0xb')]);router[_0xb0dc('0x6')](_0xb0dc('0xc'),auth[_0xb0dc('0x8')](),controller[_0xb0dc('0xd')]);router[_0xb0dc('0x6')](_0xb0dc('0xe'),controller['migrations']);module[_0xb0dc('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 292f1ad..062a899 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 _0x2aee=['lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','exports','query','latest','tags','2.0.0','status','json','fetch','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug'];(function(_0x4e877e,_0x2fb483){var _0x1cd509=function(_0x4ae36a){while(--_0x4ae36a){_0x4e877e['push'](_0x4e877e['shift']());}};_0x1cd509(++_0x2fb483);}(_0x2aee,0xfe));var _0xe2ae=function(_0x185d2a,_0x308609){_0x185d2a=_0x185d2a-0x0;var _0x4dea27=_0x2aee[_0x185d2a];return _0x4dea27;};'use strict';var Umzug=require(_0xe2ae('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xe2ae('0x1'));var pkginfo=require(_0xe2ae('0x2'))(module,_0xe2ae('0x3'));var compareVersions=require(_0xe2ae('0x4'));var exec=require(_0xe2ae('0x5'))[_0xe2ae('0x6')];var db=require(_0xe2ae('0x7'))['db'];var config=require(_0xe2ae('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xe2ae('0x9'))('update');var git=require(_0xe2ae('0xa'))(config[_0xe2ae('0xb')]);exports['index']=function(_0x49b7bf,_0x439815){var _0x21c0f1={'current':module[_0xe2ae('0xc')]['version'],'phonebar':0x2};if(_0x49b7bf[_0xe2ae('0xd')]&&_0x49b7bf[_0xe2ae('0xd')][_0xe2ae('0xe')]){return git['fetch']()[_0xe2ae('0xf')](function(_0x64d8d2,_0x5d5250){_0x21c0f1[_0xe2ae('0xe')]=(_0x64d8d2?module[_0xe2ae('0xc')][_0xe2ae('0x3')]:_0x5d5250[_0xe2ae('0xe')])||_0xe2ae('0x10');return _0x439815[_0xe2ae('0x11')](0xc8)[_0xe2ae('0x12')](_0x21c0f1);});}else{return _0x439815[_0xe2ae('0x11')](0xc8)['json'](_0x21c0f1);}};exports['fetch']=function(_0x292d0d,_0x23296f){return git[_0xe2ae('0x13')](['origin','master'],function(_0x784823){if(_0x784823){logger[_0xe2ae('0x14')](_0x784823);return _0x23296f['status'](0x1f4)[_0xe2ae('0x12')](_0x784823);}logger[_0xe2ae('0x15')](_0xe2ae('0x16'));return _0x23296f[_0xe2ae('0x11')](0xc8)[_0xe2ae('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xe2ae('0x17')]=function(_0x5de894,_0x2829c4){return git[_0xe2ae('0x17')]([_0xe2ae('0x18'),_0xe2ae('0x19')],function(_0x430a6b){if(_0x430a6b){logger[_0xe2ae('0x14')](_0x430a6b);return _0x2829c4[_0xe2ae('0x11')](0x1f4)[_0xe2ae('0x12')](_0x430a6b);}logger[_0xe2ae('0x15')](_0xe2ae('0x1a'));return _0x2829c4[_0xe2ae('0x11')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0xe2ae('0x1b')]=function(_0x36cd74,_0x3c97ba){exec(_0xe2ae('0x1c'),function(_0x5be0ce,_0x15c09a,_0x4fb9ab){logger['info'](_0x15c09a);logger[_0xe2ae('0x15')](_0x4fb9ab);if(_0x5be0ce){logger['error'](_0x5be0ce);return _0x3c97ba[_0xe2ae('0x11')](0x1f4)[_0xe2ae('0x12')](_0x5be0ce);}return _0x3c97ba[_0xe2ae('0x11')](0xc8)[_0xe2ae('0x12')]({'output':_0x15c09a});});};exports[_0xe2ae('0x1d')]=function(_0x3fa6af,_0x441c08){return pm2[_0xe2ae('0x1d')](_0xe2ae('0x1e'))['then'](function(_0x538996){logger[_0xe2ae('0x15')]('pm2\x20restart\x20motion\x20%s',_0x538996);return _0x441c08['status'](0xc8)[_0xe2ae('0x12')]({'output':_0xe2ae('0x1f')});})[_0xe2ae('0x20')](function(_0xbb6d2d){logger[_0xe2ae('0x14')](_0xbb6d2d);return _0x441c08[_0xe2ae('0x11')](0x1f4)[_0xe2ae('0x12')](_0xbb6d2d);});};exports[_0xe2ae('0x21')]=function(_0x54b71e,_0x4d9ece){var _0x2af4d5=fs[_0xe2ae('0x22')](path['join'](config[_0xe2ae('0xb')],_0xe2ae('0x23'),_0xe2ae('0x21')));var _0x296c01=[];for(var _0x284205=0x0;_0x284205<_0x2af4d5[_0xe2ae('0x24')];_0x284205++){var _0x1cf5c0=_0x2af4d5[_0x284205][_0xe2ae('0x25')](_0xe2ae('0x26'),'');if(compareVersions(module[_0xe2ae('0xc')]['version'],_0x1cf5c0)===-0x1){_0x296c01[_0xe2ae('0x27')](_0x1cf5c0);}}if(_0x296c01['length']){var _0x74e1b6=_0x296c01[_0xe2ae('0x28')](compareVersions);var _0x3420ae=new Umzug({'storage':_0xe2ae('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0xe2ae('0x2a'),'columnName':'version'},'migrations':{'params':[db[_0xe2ae('0x29')]['getQueryInterface'](),db[_0xe2ae('0x29')][_0xe2ae('0x2b')],function(){throw new Error(_0xe2ae('0x2c'));}],'path':path[_0xe2ae('0x2d')](config[_0xe2ae('0xb')],_0xe2ae('0x23'),_0xe2ae('0x21')),'pattern':/\.js$/}});_0x3420ae['up']({'migrations':_['map'](_0x74e1b6,function(_0x224d4e){return _0x224d4e+_0xe2ae('0x26');})})[_0xe2ae('0x2e')](function(){return _0x4d9ece[_0xe2ae('0x11')](0xc8)[_0xe2ae('0x12')]({'output':_0xe2ae('0x2f')+module[_0xe2ae('0xc')][_0xe2ae('0x3')]+_0xe2ae('0x30')+_['last'](_0x74e1b6),'migrations':_['join'](_0x74e1b6)});})['catch'](function(_0x7a3b57){if(_0x7a3b57 instanceof db[_0xe2ae('0x29')][_0xe2ae('0x31')]){return _0x4d9ece[_0xe2ae('0x11')](0xc8)['json']({'output':_0xe2ae('0x32')});}else{return _0x4d9ece[_0xe2ae('0x11')](0x1f4)[_0xe2ae('0x12')](_0x7a3b57);}});}else{return _0x4d9ece[_0xe2ae('0x11')](0xc8)[_0xe2ae('0x12')]({'output':_0xe2ae('0x32')});}}; \ No newline at end of file +var _0x42a5=['length','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','server','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','exports','latest','fetch','tags','2.0.0','status','json','origin','master','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','.js','push'];(function(_0x5ef12e,_0x59a72a){var _0xd8607=function(_0x4a71f8){while(--_0x4a71f8){_0x5ef12e['push'](_0x5ef12e['shift']());}};_0xd8607(++_0x59a72a);}(_0x42a5,0x7c));var _0x542a=function(_0x50d42d,_0x58ad84){_0x50d42d=_0x50d42d-0x0;var _0xdd8d30=_0x42a5[_0x50d42d];return _0xdd8d30;};'use strict';var Umzug=require(_0x542a('0x0'));var path=require(_0x542a('0x1'));var fs=require('fs');var _=require(_0x542a('0x2'));var pkginfo=require(_0x542a('0x3'))(module,_0x542a('0x4'));var compareVersions=require(_0x542a('0x5'));var exec=require('child_process')[_0x542a('0x6')];var db=require(_0x542a('0x7'))['db'];var config=require(_0x542a('0x8'));var pm2=require(_0x542a('0x9'));var logger=require(_0x542a('0xa'))(_0x542a('0xb'));var git=require(_0x542a('0xc'))(config['root']);exports['index']=function(_0x585859,_0xa987f3){var _0xe975e1={'current':module[_0x542a('0xd')][_0x542a('0x4')],'phonebar':0x2};if(_0x585859['query']&&_0x585859['query'][_0x542a('0xe')]){return git[_0x542a('0xf')]()[_0x542a('0x10')](function(_0x4bf222,_0x4142aa){_0xe975e1[_0x542a('0xe')]=(_0x4bf222?module[_0x542a('0xd')][_0x542a('0x4')]:_0x4142aa[_0x542a('0xe')])||_0x542a('0x11');return _0xa987f3[_0x542a('0x12')](0xc8)[_0x542a('0x13')](_0xe975e1);});}else{return _0xa987f3[_0x542a('0x12')](0xc8)[_0x542a('0x13')](_0xe975e1);}};exports['fetch']=function(_0x438cbc,_0x21a6bd){return git[_0x542a('0xf')]([_0x542a('0x14'),_0x542a('0x15')],function(_0x1e6b7f){if(_0x1e6b7f){logger['error'](_0x1e6b7f);return _0x21a6bd[_0x542a('0x12')](0x1f4)['json'](_0x1e6b7f);}logger['info'](_0x542a('0x16'));return _0x21a6bd[_0x542a('0x12')](0xc8)[_0x542a('0x13')]({'output':_0x542a('0x17')});});};exports[_0x542a('0x18')]=function(_0x386f73,_0x369046){return git['reset']([_0x542a('0x19'),'FETCH_HEAD'],function(_0x3341f6){if(_0x3341f6){logger[_0x542a('0x1a')](_0x3341f6);return _0x369046[_0x542a('0x12')](0x1f4)['json'](_0x3341f6);}logger[_0x542a('0x1b')](_0x542a('0x1c'));return _0x369046['status'](0xc8)[_0x542a('0x13')]({'output':_0x542a('0x1d')});});};exports[_0x542a('0x1e')]=function(_0x1c2f14,_0x399df7){exec('npm\x20install\x20--production',function(_0x3447ea,_0x238dd6,_0x1c02f9){logger['info'](_0x238dd6);logger[_0x542a('0x1b')](_0x1c02f9);if(_0x3447ea){logger[_0x542a('0x1a')](_0x3447ea);return _0x399df7[_0x542a('0x12')](0x1f4)[_0x542a('0x13')](_0x3447ea);}return _0x399df7[_0x542a('0x12')](0xc8)[_0x542a('0x13')]({'output':_0x238dd6});});};exports[_0x542a('0x1f')]=function(_0x327f64,_0x563a1e){return pm2[_0x542a('0x1f')]('motion2')['then'](function(_0x44e8b7){logger['info'](_0x542a('0x20'),_0x44e8b7);return _0x563a1e[_0x542a('0x12')](0xc8)[_0x542a('0x13')]({'output':_0x542a('0x21')});})[_0x542a('0x22')](function(_0x1f1448){logger['error'](_0x1f1448);return _0x563a1e['status'](0x1f4)[_0x542a('0x13')](_0x1f1448);});};exports[_0x542a('0x23')]=function(_0x3c91f1,_0x5e4165){var _0x45e68e=fs[_0x542a('0x24')](path[_0x542a('0x25')](config['root'],'server',_0x542a('0x23')));var _0x519d84=[];for(var _0xdc38c6=0x0;_0xdc38c6<_0x45e68e['length'];_0xdc38c6++){var _0x4982ff=_0x45e68e[_0xdc38c6][_0x542a('0x26')](_0x542a('0x27'),'');if(compareVersions(module['exports'][_0x542a('0x4')],_0x4982ff)===-0x1){_0x519d84[_0x542a('0x28')](_0x4982ff);}}if(_0x519d84[_0x542a('0x29')]){var _0x4de6d1=_0x519d84[_0x542a('0x2a')](compareVersions);var _0x20a806=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x542a('0x2b'),'columnName':_0x542a('0x4')},'migrations':{'params':[db[_0x542a('0x2c')][_0x542a('0x2d')](),db[_0x542a('0x2c')][_0x542a('0x2e')],function(){throw new Error(_0x542a('0x2f'));}],'path':path[_0x542a('0x25')](config[_0x542a('0x30')],_0x542a('0x31'),_0x542a('0x23')),'pattern':/\.js$/}});_0x20a806['up']({'migrations':_['map'](_0x4de6d1,function(_0x1c3475){return _0x1c3475+_0x542a('0x27');})})[_0x542a('0x32')](function(){return _0x5e4165[_0x542a('0x12')](0xc8)[_0x542a('0x13')]({'output':_0x542a('0x33')+module[_0x542a('0xd')][_0x542a('0x4')]+_0x542a('0x34')+_[_0x542a('0x35')](_0x4de6d1),'migrations':_[_0x542a('0x25')](_0x4de6d1)});})['catch'](function(_0x8b2b3d){if(_0x8b2b3d instanceof db[_0x542a('0x2c')]['UniqueConstraintError']){return _0x5e4165['status'](0xc8)[_0x542a('0x13')]({'output':_0x542a('0x36')});}else{return _0x5e4165[_0x542a('0x12')](0x1f4)[_0x542a('0x13')](_0x8b2b3d);}});}else{return _0x5e4165[_0x542a('0x12')](0xc8)[_0x542a('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 58fc365..727b548 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 _0x9f84=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','exports','util','path'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x9f84,0xbb));var _0x49f8=function(_0x1ec3fa,_0x3e9940){_0x1ec3fa=_0x1ec3fa-0x0;var _0x349bee=_0x9f84[_0x1ec3fa];return _0x349bee;};'use strict';var multer=require('multer');var util=require(_0x49f8('0x0'));var path=require(_0x49f8('0x1'));var timeout=require(_0x49f8('0x2'));var express=require(_0x49f8('0x3'));var router=express[_0x49f8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x49f8('0x5'));var config=require(_0x49f8('0x6'));var controller=require(_0x49f8('0x7'));router[_0x49f8('0x8')]('/',auth[_0x49f8('0x9')](),controller[_0x49f8('0xa')]);router[_0x49f8('0x8')](_0x49f8('0xb'),auth[_0x49f8('0x9')](),controller[_0x49f8('0xc')]);router[_0x49f8('0x8')]('/:id',auth[_0x49f8('0x9')](),controller[_0x49f8('0xd')]);router[_0x49f8('0xe')]('/',auth[_0x49f8('0x9')](),controller[_0x49f8('0xf')]);router[_0x49f8('0x10')](_0x49f8('0x11'),auth[_0x49f8('0x9')](),controller[_0x49f8('0x12')]);router[_0x49f8('0x13')](_0x49f8('0x11'),auth[_0x49f8('0x9')](),controller['destroy']);module[_0x49f8('0x14')]=router; \ No newline at end of file +var _0xb34d=['show','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb34d,0x1ec));var _0xdb34=function(_0x4acf81,_0x531bd2){_0x4acf81=_0x4acf81-0x0;var _0x338298=_0xb34d[_0x4acf81];return _0x338298;};'use strict';var multer=require(_0xdb34('0x0'));var util=require(_0xdb34('0x1'));var path=require(_0xdb34('0x2'));var timeout=require(_0xdb34('0x3'));var express=require(_0xdb34('0x4'));var router=express['Router']();var fs_extra=require(_0xdb34('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb34('0x6'));var config=require(_0xdb34('0x7'));var controller=require(_0xdb34('0x8'));router[_0xdb34('0x9')]('/',auth[_0xdb34('0xa')](),controller[_0xdb34('0xb')]);router['get'](_0xdb34('0xc'),auth[_0xdb34('0xa')](),controller[_0xdb34('0xd')]);router[_0xdb34('0x9')]('/:id',auth[_0xdb34('0xa')](),controller[_0xdb34('0xe')]);router[_0xdb34('0xf')]('/',auth[_0xdb34('0xa')](),controller[_0xdb34('0x10')]);router[_0xdb34('0x11')]('/:id',auth[_0xdb34('0xa')](),controller['update']);router[_0xdb34('0x12')](_0xdb34('0x13'),auth[_0xdb34('0xa')](),controller[_0xdb34('0x14')]);module[_0xdb34('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index bb65189..da00f5d 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 _0xdaa8=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xdaa8,0xe4));var _0x8daa=function(_0x24b948,_0x1b2ddc){_0x24b948=_0x24b948-0x0;var _0x2d38ec=_0xdaa8[_0x24b948];return _0x2d38ec;};'use strict';var Sequelize=require(_0x8daa('0x0'));module[_0x8daa('0x1')]={'type':{'type':Sequelize[_0x8daa('0x2')]},'uniqueid':{'type':Sequelize[_0x8daa('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x8daa('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8daa('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x8daa('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8daa('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8daa('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8daa('0x5')]},'agentacw':{'type':Sequelize[_0x8daa('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8daa('0x5')]},'reason':{'type':Sequelize[_0x8daa('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8daa('0x2')]},'channelstate':{'type':Sequelize[_0x8daa('0x5')]},'channelstatedesc':{'type':Sequelize[_0x8daa('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8daa('0x2')]},'connectedlinename':{'type':Sequelize[_0x8daa('0x2')]},'language':{'type':Sequelize[_0x8daa('0x2')]},'accountcode':{'type':Sequelize[_0x8daa('0x2')]},'context':{'type':Sequelize[_0x8daa('0x2')]},'exten':{'type':Sequelize[_0x8daa('0x2')]},'priority':{'type':Sequelize[_0x8daa('0x2')]},'destchannel':{'type':Sequelize[_0x8daa('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x8daa('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8daa('0x2')]},'destcalleridname':{'type':Sequelize[_0x8daa('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x8daa('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8daa('0x2')]},'destcontext':{'type':Sequelize[_0x8daa('0x2')]},'destexten':{'type':Sequelize[_0x8daa('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x8daa('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8daa('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8daa('0x2')],'comment':_0x8daa('0x6')},'transferexten':{'type':Sequelize[_0x8daa('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8daa('0x2')]},'agententerreason':{'type':Sequelize[_0x8daa('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5c3c=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x43bd66,_0x27e9b3){var _0x5195cb=function(_0xe936f0){while(--_0xe936f0){_0x43bd66['push'](_0x43bd66['shift']());}};_0x5195cb(++_0x27e9b3);}(_0x5c3c,0x132));var _0xc5c3=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x5c3c[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0xc5c3('0x0'));module[_0xc5c3('0x1')]={'type':{'type':Sequelize[_0xc5c3('0x2')]},'uniqueid':{'type':Sequelize[_0xc5c3('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc5c3('0x2')]},'queue':{'type':Sequelize[_0xc5c3('0x2')]},'interface':{'type':Sequelize[_0xc5c3('0x2')]},'membername':{'type':Sequelize[_0xc5c3('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc5c3('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc5c3('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xc5c3('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xc5c3('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc5c3('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc5c3('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc5c3('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc5c3('0x5')]},'reason':{'type':Sequelize[_0xc5c3('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc5c3('0x2')]},'channelstate':{'type':Sequelize[_0xc5c3('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc5c3('0x2')]},'connectedlinename':{'type':Sequelize[_0xc5c3('0x2')]},'language':{'type':Sequelize[_0xc5c3('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc5c3('0x2')]},'exten':{'type':Sequelize[_0xc5c3('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xc5c3('0x2')]},'destchannelstate':{'type':Sequelize[_0xc5c3('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xc5c3('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc5c3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc5c3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc5c3('0x2')]},'destlanguage':{'type':Sequelize[_0xc5c3('0x2')]},'destaccountcode':{'type':Sequelize[_0xc5c3('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc5c3('0x2')]},'destuniqueid':{'type':Sequelize[_0xc5c3('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc5c3('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc5c3('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xc5c3('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xc5c3('0x2')]},'agententerreason':{'type':Sequelize[_0xc5c3('0x5')],'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 1bb291f..e9ac907 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +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(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 6e45186..37e9ebe 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 _0xd2bb=['util','api','moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0x116912,_0x5b23d3){var _0x46a7ce=function(_0xde6fa6){while(--_0xde6fa6){_0x116912['push'](_0x116912['shift']());}};_0x46a7ce(++_0x5b23d3);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x2a99ad,_0x398e91){_0x2a99ad=_0x2a99ad-0x0;var _0x2454ad=_0xd2bb[_0x2a99ad];return _0x2454ad;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var logger=require('../../config/logger')(_0xbd2b('0x1'));var moment=require(_0xbd2b('0x2'));var BPromise=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var fs=require('fs');var path=require(_0xbd2b('0x5'));var rimraf=require(_0xbd2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd2b('0x7'));module[_0xbd2b('0x8')]=function(_0xdcd8bd,_0x2f64a8){return _0xdcd8bd[_0xbd2b('0x9')](_0xbd2b('0xa'),attributes,{'tableName':_0xbd2b('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbd2b('0xc'),_0xbd2b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x383d=['define','VoiceAgentReport','report_agent','uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x1630f1,_0x2eba83){var _0x1531e6=function(_0x1d25ec){while(--_0x1d25ec){_0x1630f1['push'](_0x1630f1['shift']());}};_0x1531e6(++_0x2eba83);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd383('0x0'))(_0xd383('0x1'));var moment=require(_0xd383('0x2'));var BPromise=require('bluebird');var rp=require(_0xd383('0x3'));var fs=require('fs');var path=require(_0xd383('0x4'));var rimraf=require(_0xd383('0x5'));var config=require(_0xd383('0x6'));var attributes=require(_0xd383('0x7'));module[_0xd383('0x8')]=function(_0x5a0b1d,_0xc64e9b){return _0x5a0b1d[_0xd383('0x9')](_0xd383('0xa'),attributes,{'tableName':_0xd383('0xb'),'paranoid':![],'indexes':[{'fields':[_0xd383('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 306739b..f331a4d 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 _0x14d0=['create','options','raw','update','body','where','attributes','UpdateVoiceAgentReport','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport'];(function(_0x926f57,_0x147709){var _0x502cf8=function(_0xf21a4f){while(--_0xf21a4f){_0x926f57['push'](_0x926f57['shift']());}};_0x502cf8(++_0x147709);}(_0x14d0,0x13e));var _0x014d=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x14d0[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0x014d('0x0'));var util=require(_0x014d('0x1'));var moment=require('moment');var BPromise=require(_0x014d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x014d('0x3'))['db'];var utils=require(_0x014d('0x4'));var logger=require(_0x014d('0x5'))(_0x014d('0x6'));var config=require('../../config/environment');var jayson=require(_0x014d('0x7'));var client=jayson[_0x014d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a242d,_0x19b4dc,_0x2ba5c1){return new BPromise(function(_0x2de843,_0x4ac47a){return client[_0x014d('0x9')](_0x2a242d,_0x2ba5c1)[_0x014d('0xa')](function(_0x57ab23){logger[_0x014d('0xb')](_0x014d('0xc'),_0x19b4dc,_0x014d('0xd'));logger[_0x014d('0xe')](_0x014d('0xf'),_0x19b4dc,'request\x20sent',JSON[_0x014d('0x10')](_0x57ab23));if(_0x57ab23[_0x014d('0x11')]){if(_0x57ab23[_0x014d('0x11')][_0x014d('0x12')]===0x1f4){logger[_0x014d('0x11')](_0x014d('0xc'),_0x19b4dc,_0x57ab23[_0x014d('0x11')]['message']);return _0x4ac47a(_0x57ab23[_0x014d('0x11')]['message']);}logger[_0x014d('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x19b4dc,_0x57ab23[_0x014d('0x11')][_0x014d('0x13')]);return _0x2de843(_0x57ab23[_0x014d('0x11')][_0x014d('0x13')]);}else{logger[_0x014d('0xb')](_0x014d('0xc'),_0x19b4dc,_0x014d('0xd'));_0x2de843(_0x57ab23['result'][_0x014d('0x13')]);}})[_0x014d('0x14')](function(_0xa85962){logger[_0x014d('0x11')](_0x014d('0xc'),_0x19b4dc,_0xa85962);_0x4ac47a(_0xa85962);});});}exports[_0x014d('0x15')]=function(_0x485c0f){var _0x46044f=this;return new Promise(function(_0x4fd37c,_0x2e10d5){return db[_0x014d('0x16')][_0x014d('0x17')](_0x485c0f['body'],{'raw':_0x485c0f[_0x014d('0x18')]?_0x485c0f['options'][_0x014d('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x21a84e){logger[_0x014d('0xb')](_0x014d('0x15'),_0x485c0f);logger[_0x014d('0xe')](_0x014d('0x15'),_0x485c0f,JSON[_0x014d('0x10')](_0x21a84e));_0x4fd37c(_0x21a84e);})[_0x014d('0x14')](function(_0xa880fe){logger[_0x014d('0x11')](_0x014d('0x15'),_0xa880fe[_0x014d('0x13')],_0x485c0f);_0x2e10d5(_0x46044f[_0x014d('0x11')](0x1f4,_0xa880fe[_0x014d('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x4943c6){var _0x586e82=this;return new Promise(function(_0x56da5d,_0x2c4659){return db[_0x014d('0x16')][_0x014d('0x1a')](_0x4943c6[_0x014d('0x1b')],{'raw':_0x4943c6[_0x014d('0x18')]?_0x4943c6[_0x014d('0x18')][_0x014d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4943c6['options']?_0x4943c6['options'][_0x014d('0x1c')]||null:null,'attributes':_0x4943c6[_0x014d('0x18')]?_0x4943c6[_0x014d('0x18')][_0x014d('0x1d')]||null:null,'limit':_0x4943c6[_0x014d('0x18')]?_0x4943c6['options']['limit']||null:null})['then'](function(_0xf5298d){logger[_0x014d('0xb')]('UpdateVoiceAgentReport',_0x4943c6);logger['debug']('UpdateVoiceAgentReport',_0x4943c6,JSON['stringify'](_0xf5298d));_0x56da5d(_0xf5298d);})['catch'](function(_0x20587b){logger[_0x014d('0x11')](_0x014d('0x1e'),_0x20587b['message'],_0x4943c6);_0x2c4659(_0x586e82[_0x014d('0x11')](0x1f4,_0x20587b[_0x014d('0x13')]));});});}; \ No newline at end of file +var _0xf982=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','moment','randomstring','ioredis'];(function(_0xadeb56,_0x1c1af5){var _0xe0c8b2=function(_0x4ecbfa){while(--_0x4ecbfa){_0xadeb56['push'](_0xadeb56['shift']());}};_0xe0c8b2(++_0x1c1af5);}(_0xf982,0x170));var _0x2f98=function(_0x202f18,_0x2b615d){_0x202f18=_0x202f18-0x0;var _0x4d5e20=_0xf982[_0x202f18];return _0x4d5e20;};'use strict';var _=require(_0x2f98('0x0'));var util=require('util');var moment=require(_0x2f98('0x1'));var BPromise=require('bluebird');var rs=require(_0x2f98('0x2'));var fs=require('fs');var Redis=require(_0x2f98('0x3'));var db=require(_0x2f98('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f98('0x5'))('rpc');var config=require(_0x2f98('0x6'));var jayson=require(_0x2f98('0x7'));var client=jayson['client'][_0x2f98('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bdd0d,_0x19e214,_0x180a9f){return new BPromise(function(_0x3bfae1,_0x4f232c){return client[_0x2f98('0x9')](_0x1bdd0d,_0x180a9f)[_0x2f98('0xa')](function(_0x48b43b){logger[_0x2f98('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x19e214,_0x2f98('0xc'));logger[_0x2f98('0xd')](_0x2f98('0xe'),_0x19e214,_0x2f98('0xc'),JSON[_0x2f98('0xf')](_0x48b43b));if(_0x48b43b[_0x2f98('0x10')]){if(_0x48b43b[_0x2f98('0x10')]['code']===0x1f4){logger[_0x2f98('0x10')](_0x2f98('0x11'),_0x19e214,_0x48b43b[_0x2f98('0x10')]['message']);return _0x4f232c(_0x48b43b[_0x2f98('0x10')]['message']);}logger[_0x2f98('0x10')](_0x2f98('0x11'),_0x19e214,_0x48b43b['error'][_0x2f98('0x12')]);return _0x3bfae1(_0x48b43b[_0x2f98('0x10')][_0x2f98('0x12')]);}else{logger[_0x2f98('0xb')](_0x2f98('0x11'),_0x19e214,_0x2f98('0xc'));_0x3bfae1(_0x48b43b[_0x2f98('0x13')][_0x2f98('0x12')]);}})[_0x2f98('0x14')](function(_0x12702c){logger['error'](_0x2f98('0x11'),_0x19e214,_0x12702c);_0x4f232c(_0x12702c);});});}exports[_0x2f98('0x15')]=function(_0x48743c){var _0x21273f=this;return new Promise(function(_0x4fb2a0,_0x87506c){return db[_0x2f98('0x16')]['create'](_0x48743c[_0x2f98('0x17')],{'raw':_0x48743c[_0x2f98('0x18')]?_0x48743c[_0x2f98('0x18')][_0x2f98('0x19')]===undefined?!![]:![]:!![]})[_0x2f98('0xa')](function(_0x10482e){logger[_0x2f98('0xb')](_0x2f98('0x15'),_0x48743c);logger['debug'](_0x2f98('0x15'),_0x48743c,JSON[_0x2f98('0xf')](_0x10482e));_0x4fb2a0(_0x10482e);})['catch'](function(_0x5e99d9){logger[_0x2f98('0x10')]('CreateVoiceAgentReport',_0x5e99d9[_0x2f98('0x12')],_0x48743c);_0x87506c(_0x21273f[_0x2f98('0x10')](0x1f4,_0x5e99d9[_0x2f98('0x12')]));});});};exports[_0x2f98('0x1a')]=function(_0x5cf83e){var _0x436839=this;return new Promise(function(_0x1557ab,_0x5d08e9){return db['VoiceAgentReport'][_0x2f98('0x1b')](_0x5cf83e['body'],{'raw':_0x5cf83e['options']?_0x5cf83e[_0x2f98('0x18')][_0x2f98('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cf83e[_0x2f98('0x18')]?_0x5cf83e[_0x2f98('0x18')][_0x2f98('0x1c')]||null:null,'attributes':_0x5cf83e[_0x2f98('0x18')]?_0x5cf83e[_0x2f98('0x18')][_0x2f98('0x1d')]||null:null,'limit':_0x5cf83e[_0x2f98('0x18')]?_0x5cf83e['options'][_0x2f98('0x1e')]||null:null})[_0x2f98('0xa')](function(_0x1bca30){logger['info'](_0x2f98('0x1a'),_0x5cf83e);logger[_0x2f98('0xd')](_0x2f98('0x1a'),_0x5cf83e,JSON[_0x2f98('0xf')](_0x1bca30));_0x1557ab(_0x1bca30);})['catch'](function(_0x1497df){logger[_0x2f98('0x10')](_0x2f98('0x1a'),_0x1497df[_0x2f98('0x12')],_0x5cf83e);_0x5d08e9(_0x436839[_0x2f98('0x10')](0x1f4,_0x1497df[_0x2f98('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index fb5555d..42a0baa 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 _0x7bae=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get'];(function(_0x272d8a,_0x45184b){var _0x26286e=function(_0x93beaa){while(--_0x93beaa){_0x272d8a['push'](_0x272d8a['shift']());}};_0x26286e(++_0x45184b);}(_0x7bae,0x13b));var _0xe7ba=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x7bae[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['show']);router[_0xe7ba('0xd')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x11')](_0xe7ba('0xc'),auth['isAuthenticated'](),controller[_0xe7ba('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4bc3=['post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x10fd27,_0x9e3ecd){var _0x5b5d6a=function(_0x4e197a){while(--_0x4e197a){_0x10fd27['push'](_0x10fd27['shift']());}};_0x5b5d6a(++_0x9e3ecd);}(_0x4bc3,0x16e));var _0x34bc=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4bc3[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x34bc('0xb')]);router[_0x34bc('0x9')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x10')]('/:id',auth[_0x34bc('0xa')](),controller[_0x34bc('0x11')]);module[_0x34bc('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index cf2517a..552e884 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 _0xe707=['outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xe707,0x17a));var _0x7e70=function(_0x405d93,_0x514615){_0x405d93=_0x405d93-0x0;var _0x2da30b=_0xe707[_0x405d93];return _0x2da30b;};'use strict';var Sequelize=require(_0x7e70('0x0'));module[_0x7e70('0x1')]={'uniqueid':{'type':Sequelize[_0x7e70('0x2')]},'type':{'type':Sequelize[_0x7e70('0x3')](_0x7e70('0x4'),_0x7e70('0x5'),_0x7e70('0x6'),_0x7e70('0x7'),'outbound-fax',_0x7e70('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7e70('0x2')]},'source':{'type':Sequelize[_0x7e70('0x2')]},'destination':{'type':Sequelize[_0x7e70('0x2')]},'destinationcontext':{'type':Sequelize[_0x7e70('0x2')]},'callerid':{'type':Sequelize[_0x7e70('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x7e70('0x2')]},'lastdata':{'type':Sequelize[_0x7e70('0x9')]},'starttime':{'type':Sequelize[_0x7e70('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x7e70('0xa')]},'endtime':{'type':Sequelize[_0x7e70('0xa')]},'duration':{'type':Sequelize[_0x7e70('0xb')]},'billableseconds':{'type':Sequelize[_0x7e70('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7e70('0x2')]},'amaflags':{'type':Sequelize[_0x7e70('0x2')]},'userfield':{'type':Sequelize[_0x7e70('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x7e70('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x7e70('0x2')]},'note':{'type':Sequelize[_0x7e70('0x2')]},'prefix':{'type':Sequelize[_0x7e70('0x2')]},'routeid':{'type':Sequelize[_0x7e70('0xb')]},'sipcallid':{'type':Sequelize[_0x7e70('0x2')]}}; \ No newline at end of file +var _0x7152=['INTEGER','exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x5969d1,_0xda2050){var _0x18cad1=function(_0x51821c){while(--_0x51821c){_0x5969d1['push'](_0x5969d1['shift']());}};_0x18cad1(++_0xda2050);}(_0x7152,0x114));var _0x2715=function(_0x40b6db,_0x2a1fbb){_0x40b6db=_0x40b6db-0x0;var _0x3eaa81=_0x7152[_0x40b6db];return _0x3eaa81;};'use strict';var Sequelize=require('sequelize');module[_0x2715('0x0')]={'uniqueid':{'type':Sequelize[_0x2715('0x1')]},'type':{'type':Sequelize['ENUM'](_0x2715('0x2'),_0x2715('0x3'),_0x2715('0x4'),_0x2715('0x5'),_0x2715('0x6'),_0x2715('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2715('0x1')]},'source':{'type':Sequelize[_0x2715('0x1')]},'destination':{'type':Sequelize[_0x2715('0x1')]},'destinationcontext':{'type':Sequelize[_0x2715('0x1')]},'callerid':{'type':Sequelize[_0x2715('0x1')]},'channel':{'type':Sequelize[_0x2715('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x2715('0x1')]},'lastdata':{'type':Sequelize[_0x2715('0x8')]},'starttime':{'type':Sequelize[_0x2715('0x9')]},'systemanswertime':{'type':Sequelize[_0x2715('0x9')]},'answertime':{'type':Sequelize[_0x2715('0x9')]},'endtime':{'type':Sequelize[_0x2715('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x2715('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2715('0x1')]},'amaflags':{'type':Sequelize[_0x2715('0x1')]},'userfield':{'type':Sequelize[_0x2715('0x1')]},'userDisposition':{'type':Sequelize[_0x2715('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x2715('0x1')]},'note':{'type':Sequelize[_0x2715('0x1')]},'prefix':{'type':Sequelize[_0x2715('0x1')]},'routeid':{'type':Sequelize[_0x2715('0xa')]},'sipcallid':{'type':Sequelize[_0x2715('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2f112ef..a25bf76 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x9d76e6,_0x243275){_0x9d76e6=_0x9d76e6-0x0;var _0x357a60=_0x5f2f[_0x9d76e6];return _0x357a60;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index fd09cff..1d91c9e 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 _0xc00c=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','../../config/logger','api','path'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0xc00c,0x97));var _0xcc00=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xc00c[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcc00('0x0'))(_0xcc00('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc00('0x2'));var rimraf=require(_0xcc00('0x3'));var config=require(_0xcc00('0x4'));var attributes=require(_0xcc00('0x5'));module[_0xcc00('0x6')]=function(_0x13df32,_0x482f73){return _0x13df32[_0xcc00('0x7')](_0xcc00('0x8'),attributes,{'tableName':_0xcc00('0x9'),'paranoid':![],'indexes':[{'fields':[_0xcc00('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x282f=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','api'];(function(_0x29d28c,_0x2bd080){var _0xd6f3ea=function(_0x44360c){while(--_0x44360c){_0x29d28c['push'](_0x29d28c['shift']());}};_0xd6f3ea(++_0x2bd080);}(_0x282f,0x135));var _0xf282=function(_0x1122fa,_0x41cf04){_0x1122fa=_0x1122fa-0x0;var _0x481350=_0x282f[_0x1122fa];return _0x481350;};'use strict';var _=require(_0xf282('0x0'));var util=require(_0xf282('0x1'));var logger=require('../../config/logger')(_0xf282('0x2'));var moment=require(_0xf282('0x3'));var BPromise=require(_0xf282('0x4'));var rp=require(_0xf282('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf282('0x6'));var config=require(_0xf282('0x7'));var attributes=require(_0xf282('0x8'));module[_0xf282('0x9')]=function(_0x3a1af2,_0x4767a0){return _0x3a1af2[_0xf282('0xa')](_0xf282('0xb'),attributes,{'tableName':_0xf282('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index e383477..6fd4611 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 _0x6e0e=['CreateVoiceCallReport','create','body','then','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x1068ce,_0x45ba6b){var _0x16d54f=function(_0x248078){while(--_0x248078){_0x1068ce['push'](_0x1068ce['shift']());}};_0x16d54f(++_0x45ba6b);}(_0x6e0e,0x7e));var _0xe6e0=function(_0x1d6482,_0x12f1e7){_0x1d6482=_0x1d6482-0x0;var _0x1c265c=_0x6e0e[_0x1d6482];return _0x1c265c;};'use strict';var _=require(_0xe6e0('0x0'));var util=require(_0xe6e0('0x1'));var moment=require(_0xe6e0('0x2'));var BPromise=require(_0xe6e0('0x3'));var rs=require(_0xe6e0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6e0('0x6'))(_0xe6e0('0x7'));var config=require(_0xe6e0('0x8'));var jayson=require(_0xe6e0('0x9'));var client=jayson[_0xe6e0('0xa')][_0xe6e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1186d2,_0x1f61e8,_0x415741){return new BPromise(function(_0x250e4f,_0x32f16a){return client['request'](_0x1186d2,_0x415741)['then'](function(_0x135b1b){logger[_0xe6e0('0xc')](_0xe6e0('0xd'),_0x1f61e8,'request\x20sent');logger[_0xe6e0('0xe')](_0xe6e0('0xf'),_0x1f61e8,_0xe6e0('0x10'),JSON[_0xe6e0('0x11')](_0x135b1b));if(_0x135b1b['error']){if(_0x135b1b[_0xe6e0('0x12')][_0xe6e0('0x13')]===0x1f4){logger[_0xe6e0('0x12')](_0xe6e0('0xd'),_0x1f61e8,_0x135b1b['error']['message']);return _0x32f16a(_0x135b1b['error'][_0xe6e0('0x14')]);}logger['error'](_0xe6e0('0xd'),_0x1f61e8,_0x135b1b[_0xe6e0('0x12')][_0xe6e0('0x14')]);return _0x250e4f(_0x135b1b['error'][_0xe6e0('0x14')]);}else{logger[_0xe6e0('0xc')](_0xe6e0('0xd'),_0x1f61e8,_0xe6e0('0x10'));_0x250e4f(_0x135b1b[_0xe6e0('0x15')][_0xe6e0('0x14')]);}})[_0xe6e0('0x16')](function(_0x3a7286){logger[_0xe6e0('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x1f61e8,_0x3a7286);_0x32f16a(_0x3a7286);});});}exports[_0xe6e0('0x17')]=function(_0x303371){var _0x256038=this;return new Promise(function(_0x4104bc,_0x1a1df7){return db[_0xe6e0('0x18')][_0xe6e0('0x19')]({'raw':_0x303371[_0xe6e0('0x1a')]?_0x303371[_0xe6e0('0x1a')][_0xe6e0('0x1b')]===undefined?!![]:![]:!![],'where':_0x303371[_0xe6e0('0x1a')]?_0x303371[_0xe6e0('0x1a')][_0xe6e0('0x1c')]||null:null,'attributes':_0x303371[_0xe6e0('0x1a')]?_0x303371[_0xe6e0('0x1a')][_0xe6e0('0x1d')]||null:null,'limit':_0x303371[_0xe6e0('0x1a')]?_0x303371[_0xe6e0('0x1a')][_0xe6e0('0x1e')]||null:null,'include':_0x303371[_0xe6e0('0x1a')]?_0x303371[_0xe6e0('0x1a')][_0xe6e0('0x1f')]?_[_0xe6e0('0x20')](_0x303371[_0xe6e0('0x1a')][_0xe6e0('0x1f')],function(_0x14606d){return{'model':db[_0x14606d[_0xe6e0('0x21')]],'as':_0x14606d['as'],'attributes':_0x14606d['attributes'],'include':_0x14606d[_0xe6e0('0x1f')]?_[_0xe6e0('0x20')](_0x14606d[_0xe6e0('0x1f')],function(_0xe84799){return{'model':db[_0xe84799[_0xe6e0('0x21')]],'as':_0xe84799['as'],'attributes':_0xe84799[_0xe6e0('0x1d')],'include':_0xe84799[_0xe6e0('0x1f')]?_[_0xe6e0('0x20')](_0xe84799[_0xe6e0('0x1f')],function(_0x30990b){return{'model':db[_0x30990b[_0xe6e0('0x21')]],'as':_0x30990b['as'],'attributes':_0x30990b[_0xe6e0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ac1a1){logger['info'](_0xe6e0('0x17'),_0x303371);logger[_0xe6e0('0xe')](_0xe6e0('0x17'),_0x303371,JSON['stringify'](_0x5ac1a1));_0x4104bc(_0x5ac1a1);})[_0xe6e0('0x16')](function(_0xeffa14){logger[_0xe6e0('0x12')](_0xe6e0('0x17'),_0xeffa14[_0xe6e0('0x14')],_0x303371);_0x1a1df7(_0x256038['error'](0x1f4,_0xeffa14[_0xe6e0('0x14')]));});});};exports[_0xe6e0('0x22')]=function(_0x18f44e){var _0x110d69=this;return new Promise(function(_0x2b175b,_0x1fa668){return db['VoiceCallReport'][_0xe6e0('0x23')](_0x18f44e[_0xe6e0('0x24')],{'raw':_0x18f44e[_0xe6e0('0x1a')]?_0x18f44e[_0xe6e0('0x1a')][_0xe6e0('0x1b')]===undefined?!![]:![]:!![]})[_0xe6e0('0x25')](function(_0xffebfe){logger[_0xe6e0('0xc')](_0xe6e0('0x22'),_0x18f44e);logger[_0xe6e0('0xe')](_0xe6e0('0x22'),_0x18f44e,JSON['stringify'](_0xffebfe));_0x2b175b(_0xffebfe);})['catch'](function(_0x3bddbb){logger[_0xe6e0('0x12')](_0xe6e0('0x22'),_0x3bddbb['message'],_0x18f44e);_0x1fa668(_0x110d69[_0xe6e0('0x12')](0x1f4,_0x3bddbb['message']));});});};exports[_0xe6e0('0x26')]=function(_0x592a62){var _0x5f0964=this;return new Promise(function(_0x59993e,_0x421478){return db[_0xe6e0('0x18')][_0xe6e0('0x27')](_0x592a62[_0xe6e0('0x24')],{'raw':_0x592a62['options']?_0x592a62[_0xe6e0('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x592a62[_0xe6e0('0x1a')]?_0x592a62[_0xe6e0('0x1a')][_0xe6e0('0x1c')]||null:null,'attributes':_0x592a62[_0xe6e0('0x1a')]?_0x592a62[_0xe6e0('0x1a')][_0xe6e0('0x1d')]||null:null,'limit':_0x592a62[_0xe6e0('0x1a')]?_0x592a62[_0xe6e0('0x1a')][_0xe6e0('0x1e')]||null:null})[_0xe6e0('0x25')](function(_0x5c41fd){logger[_0xe6e0('0xc')]('UpdateVoiceCallReport',_0x592a62);logger['debug'](_0xe6e0('0x26'),_0x592a62,JSON[_0xe6e0('0x11')](_0x5c41fd));_0x59993e(_0x5c41fd);})[_0xe6e0('0x16')](function(_0xdfa36a){logger[_0xe6e0('0x12')](_0xe6e0('0x26'),_0xdfa36a[_0xe6e0('0x14')],_0x592a62);_0x421478(_0x5f0964[_0xe6e0('0x12')](0x1f4,_0xdfa36a['message']));});});}; \ No newline at end of file +var _0x406f=['CreateVoiceCallReport','body','UpdateVoiceCallReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','options','raw','limit','include','map','model','attributes','GetVoiceCallReport'];(function(_0x4c91f6,_0x3fcabc){var _0x34d997=function(_0x1eea46){while(--_0x1eea46){_0x4c91f6['push'](_0x4c91f6['shift']());}};_0x34d997(++_0x3fcabc);}(_0x406f,0xe8));var _0xf406=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x406f[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xf406('0x0'));var util=require('util');var moment=require(_0xf406('0x1'));var BPromise=require('bluebird');var rs=require(_0xf406('0x2'));var fs=require('fs');var Redis=require(_0xf406('0x3'));var db=require(_0xf406('0x4'))['db'];var utils=require(_0xf406('0x5'));var logger=require(_0xf406('0x6'))(_0xf406('0x7'));var config=require(_0xf406('0x8'));var jayson=require(_0xf406('0x9'));var client=jayson[_0xf406('0xa')][_0xf406('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51237b,_0x198f48,_0x18bf2f){return new BPromise(function(_0x1130ae,_0x4a2821){return client[_0xf406('0xc')](_0x51237b,_0x18bf2f)[_0xf406('0xd')](function(_0x5286ac){logger[_0xf406('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x198f48,_0xf406('0xf'));logger[_0xf406('0x10')](_0xf406('0x11'),_0x198f48,_0xf406('0xf'),JSON[_0xf406('0x12')](_0x5286ac));if(_0x5286ac[_0xf406('0x13')]){if(_0x5286ac[_0xf406('0x13')][_0xf406('0x14')]===0x1f4){logger[_0xf406('0x13')](_0xf406('0x15'),_0x198f48,_0x5286ac['error'][_0xf406('0x16')]);return _0x4a2821(_0x5286ac[_0xf406('0x13')]['message']);}logger[_0xf406('0x13')](_0xf406('0x15'),_0x198f48,_0x5286ac['error']['message']);return _0x1130ae(_0x5286ac['error'][_0xf406('0x16')]);}else{logger[_0xf406('0xe')](_0xf406('0x15'),_0x198f48,_0xf406('0xf'));_0x1130ae(_0x5286ac[_0xf406('0x17')][_0xf406('0x16')]);}})[_0xf406('0x18')](function(_0xf12e37){logger['error'](_0xf406('0x15'),_0x198f48,_0xf12e37);_0x4a2821(_0xf12e37);});});}exports['GetVoiceCallReport']=function(_0x4f441f){var _0x5212c3=this;return new Promise(function(_0x42c349,_0x5d7d0c){return db[_0xf406('0x19')]['findAll']({'raw':_0x4f441f[_0xf406('0x1a')]?_0x4f441f['options'][_0xf406('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f441f[_0xf406('0x1a')]?_0x4f441f['options']['where']||null:null,'attributes':_0x4f441f[_0xf406('0x1a')]?_0x4f441f[_0xf406('0x1a')]['attributes']||null:null,'limit':_0x4f441f['options']?_0x4f441f[_0xf406('0x1a')][_0xf406('0x1c')]||null:null,'include':_0x4f441f[_0xf406('0x1a')]?_0x4f441f[_0xf406('0x1a')][_0xf406('0x1d')]?_[_0xf406('0x1e')](_0x4f441f['options'][_0xf406('0x1d')],function(_0x3ea732){return{'model':db[_0x3ea732[_0xf406('0x1f')]],'as':_0x3ea732['as'],'attributes':_0x3ea732[_0xf406('0x20')],'include':_0x3ea732[_0xf406('0x1d')]?_[_0xf406('0x1e')](_0x3ea732['include'],function(_0x14a818){return{'model':db[_0x14a818['model']],'as':_0x14a818['as'],'attributes':_0x14a818['attributes'],'include':_0x14a818[_0xf406('0x1d')]?_[_0xf406('0x1e')](_0x14a818[_0xf406('0x1d')],function(_0x44ff3c){return{'model':db[_0x44ff3c[_0xf406('0x1f')]],'as':_0x44ff3c['as'],'attributes':_0x44ff3c[_0xf406('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5377d8){logger['info'](_0xf406('0x21'),_0x4f441f);logger[_0xf406('0x10')](_0xf406('0x21'),_0x4f441f,JSON[_0xf406('0x12')](_0x5377d8));_0x42c349(_0x5377d8);})[_0xf406('0x18')](function(_0x1e2e45){logger[_0xf406('0x13')](_0xf406('0x21'),_0x1e2e45[_0xf406('0x16')],_0x4f441f);_0x5d7d0c(_0x5212c3[_0xf406('0x13')](0x1f4,_0x1e2e45['message']));});});};exports[_0xf406('0x22')]=function(_0x36ce13){var _0x170307=this;return new Promise(function(_0x291f69,_0x37b7f6){return db[_0xf406('0x19')]['create'](_0x36ce13[_0xf406('0x23')],{'raw':_0x36ce13[_0xf406('0x1a')]?_0x36ce13['options'][_0xf406('0x1b')]===undefined?!![]:![]:!![]})[_0xf406('0xd')](function(_0x274a3a){logger['info'](_0xf406('0x22'),_0x36ce13);logger[_0xf406('0x10')](_0xf406('0x22'),_0x36ce13,JSON[_0xf406('0x12')](_0x274a3a));_0x291f69(_0x274a3a);})[_0xf406('0x18')](function(_0x4b9e23){logger[_0xf406('0x13')](_0xf406('0x22'),_0x4b9e23[_0xf406('0x16')],_0x36ce13);_0x37b7f6(_0x170307[_0xf406('0x13')](0x1f4,_0x4b9e23[_0xf406('0x16')]));});});};exports[_0xf406('0x24')]=function(_0x1ccc56){var _0x30e232=this;return new Promise(function(_0x101383,_0x3b8106){return db[_0xf406('0x19')][_0xf406('0x25')](_0x1ccc56[_0xf406('0x23')],{'raw':_0x1ccc56['options']?_0x1ccc56[_0xf406('0x1a')][_0xf406('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ccc56[_0xf406('0x1a')]?_0x1ccc56[_0xf406('0x1a')]['where']||null:null,'attributes':_0x1ccc56[_0xf406('0x1a')]?_0x1ccc56[_0xf406('0x1a')][_0xf406('0x20')]||null:null,'limit':_0x1ccc56[_0xf406('0x1a')]?_0x1ccc56[_0xf406('0x1a')][_0xf406('0x1c')]||null:null})[_0xf406('0xd')](function(_0x2f5a1f){logger[_0xf406('0xe')](_0xf406('0x24'),_0x1ccc56);logger[_0xf406('0x10')]('UpdateVoiceCallReport',_0x1ccc56,JSON['stringify'](_0x2f5a1f));_0x101383(_0x2f5a1f);})[_0xf406('0x18')](function(_0xdb40f6){logger[_0xf406('0x13')](_0xf406('0x24'),_0xdb40f6[_0xf406('0x16')],_0x1ccc56);_0x3b8106(_0x30e232[_0xf406('0x13')](0x1f4,_0xdb40f6[_0xf406('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index bf94b5c..1e32e6e 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 _0x52ca=['get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0x52ca,0x95));var _0xa52c=function(_0x5b9e04,_0x4f3dcd){_0x5b9e04=_0x5b9e04-0x0;var _0x5b8484=_0x52ca[_0x5b9e04];return _0x5b8484;};'use strict';var multer=require(_0xa52c('0x0'));var util=require(_0xa52c('0x1'));var path=require(_0xa52c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa52c('0x3'));var router=express[_0xa52c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa52c('0x5'));var interaction=require(_0xa52c('0x6'));var config=require(_0xa52c('0x7'));var controller=require(_0xa52c('0x8'));router['get']('/',auth[_0xa52c('0x9')](),controller[_0xa52c('0xa')]);router[_0xa52c('0xb')](_0xa52c('0xc'),auth[_0xa52c('0x9')](),controller[_0xa52c('0xd')]);router[_0xa52c('0xe')]('/',auth[_0xa52c('0x9')](),controller[_0xa52c('0xf')]);router[_0xa52c('0x10')](_0xa52c('0xc'),auth[_0xa52c('0x9')](),controller[_0xa52c('0x11')]);router['delete'](_0xa52c('0xc'),auth[_0xa52c('0x9')](),controller[_0xa52c('0x12')]);module[_0xa52c('0x13')]=router; \ No newline at end of file +var _0xcbbd=['exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','update','delete','destroy'];(function(_0x4346f3,_0xfd454f){var _0xbc5a24=function(_0x82065f){while(--_0x82065f){_0x4346f3['push'](_0x4346f3['shift']());}};_0xbc5a24(++_0xfd454f);}(_0xcbbd,0xb5));var _0xdcbb=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xcbbd[_0x53e3fa];return _0xe8584a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdcbb('0x0'));var timeout=require(_0xdcbb('0x1'));var express=require('express');var router=express[_0xdcbb('0x2')]();var fs_extra=require(_0xdcbb('0x3'));var auth=require(_0xdcbb('0x4'));var interaction=require(_0xdcbb('0x5'));var config=require(_0xdcbb('0x6'));var controller=require(_0xdcbb('0x7'));router['get']('/',auth[_0xdcbb('0x8')](),controller[_0xdcbb('0x9')]);router[_0xdcbb('0xa')](_0xdcbb('0xb'),auth[_0xdcbb('0x8')](),controller[_0xdcbb('0xc')]);router[_0xdcbb('0xd')]('/',auth[_0xdcbb('0x8')](),controller['create']);router['put'](_0xdcbb('0xb'),auth[_0xdcbb('0x8')](),controller[_0xdcbb('0xe')]);router[_0xdcbb('0xf')](_0xdcbb('0xb'),auth['isAuthenticated'](),controller[_0xdcbb('0x10')]);module[_0xdcbb('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 73c97a1..b26bb4f 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 _0x786b=['BOOLEAN','exports','STRING','name','setDataValue','options','join','getDataValue','split'];(function(_0x1f2fbf,_0xfe8bcc){var _0xef8cfa=function(_0x4de263){while(--_0x4de263){_0x1f2fbf['push'](_0x1f2fbf['shift']());}};_0xef8cfa(++_0xfe8bcc);}(_0x786b,0x1a8));var _0xb786=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x786b[_0x648163];return _0x199d4d;};'use strict';var Sequelize=require('sequelize');module[_0xb786('0x0')]={'name':{'type':Sequelize[_0xb786('0x1')]},'prefix':{'type':Sequelize[_0xb786('0x1')],'unique':_0xb786('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xb786('0x1')],'set':function(_0x1da57a){this[_0xb786('0x3')](_0xb786('0x4'),_0x1da57a?_0x1da57a[_0xb786('0x5')](''):[]);},'get':function(){return this[_0xb786('0x6')]('options')?this['getDataValue']('options')[_0xb786('0x7')](''):[];}},'auth':{'type':Sequelize[_0xb786('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xb786('0x1')]},'record':{'type':Sequelize[_0xb786('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb786('0x1')]}}; \ No newline at end of file +var _0xec87=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','BOOLEAN'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0xec87,0x18c));var _0x7ec8=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0xec87[_0x4fda88];return _0xe37511;};'use strict';var Sequelize=require(_0x7ec8('0x0'));module[_0x7ec8('0x1')]={'name':{'type':Sequelize[_0x7ec8('0x2')]},'prefix':{'type':Sequelize[_0x7ec8('0x2')],'unique':_0x7ec8('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x7ec8('0x2')],'set':function(_0x295d4c){this[_0x7ec8('0x4')](_0x7ec8('0x5'),_0x295d4c?_0x295d4c[_0x7ec8('0x6')](''):[]);},'get':function(){return this[_0x7ec8('0x7')](_0x7ec8('0x5'))?this[_0x7ec8('0x7')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x7ec8('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x7ec8('0x2')]},'record':{'type':Sequelize[_0x7ec8('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7ec8('0x2')]},'description':{'type':Sequelize[_0x7ec8('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index c0a7b46..1c6c2f6 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 _0x477a=['role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','include','rows','catch','show','options','find','create','body','user'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa477('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa477('0x1'));var jsonpatch=require(_0xa477('0x2'));var rp=require('request-promise');var moment=require(_0xa477('0x3'));var BPromise=require(_0xa477('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa477('0x5'));var sox=require(_0xa477('0x6'));var csv=require('to-csv');var ejs=require(_0xa477('0x7'));var fs=require('fs');var fs_extra=require(_0xa477('0x8'));var _=require(_0xa477('0x9'));var squel=require(_0xa477('0xa'));var crypto=require(_0xa477('0xb'));var jsforce=require(_0xa477('0xc'));var deskjs=require(_0xa477('0xd'));var toCsv=require(_0xa477('0xe'));var querystring=require(_0xa477('0xf'));var Papa=require('papaparse');var Redis=require(_0xa477('0x10'));var authService=require(_0xa477('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa477('0x12'));var config=require(_0xa477('0x13'));var licenseUtil=require(_0xa477('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x280b97,_0x3d2a17){_0x3d2a17=_0x3d2a17||0xcc;return function(_0x70e1c1){if(_0x70e1c1){return _0x280b97['sendStatus'](_0x3d2a17);}return _0x280b97[_0xa477('0x15')](_0x3d2a17)[_0xa477('0x16')]();};}function respondWithResult(_0xbb21a7,_0x185c76){_0x185c76=_0x185c76||0xc8;return function(_0xe878a){if(_0xe878a){return _0xbb21a7['status'](_0x185c76)[_0xa477('0x17')](_0xe878a);}};}function respondWithFilteredResult(_0x2336fe,_0xa607d0){return function(_0x45ecc1){if(_0x45ecc1){var _0x22a156=typeof _0xa607d0[_0xa477('0x18')]===_0xa477('0x19')&&typeof _0xa607d0[_0xa477('0x1a')]===_0xa477('0x19');var _0x22a71c=_0x45ecc1[_0xa477('0x1b')];var _0x33db41=_0x22a156?0x0:_0xa607d0[_0xa477('0x18')];var _0x4a413c=_0x22a156?_0x45ecc1[_0xa477('0x1b')]:_0xa607d0[_0xa477('0x18')]+_0xa607d0[_0xa477('0x1a')];var _0x21cd60;if(_0x4a413c>=_0x22a71c){_0x4a413c=_0x22a71c;_0x21cd60=0xc8;}else{_0x21cd60=0xce;}_0x2336fe[_0xa477('0x15')](_0x21cd60);return _0x2336fe[_0xa477('0x1c')](_0xa477('0x1d'),_0x33db41+'-'+_0x4a413c+'/'+_0x22a71c)[_0xa477('0x17')](_0x45ecc1);}return null;};}function patchUpdates(_0x5af670){return function(_0x434ef1){try{jsonpatch[_0xa477('0x1e')](_0x434ef1,_0x5af670,!![]);}catch(_0x4a8c94){return BPromise['reject'](_0x4a8c94);}return _0x434ef1['save']();};}function saveUpdates(_0x4b7f69,_0x14d01e){return function(_0x2debae){if(_0x2debae){return _0x2debae['update'](_0x4b7f69)[_0xa477('0x1f')](function(_0x4faebd){return _0x4faebd;});}return null;};}function removeEntity(_0x5b6e98,_0x7aa4ac){return function(_0x166694){if(_0x166694){return _0x166694[_0xa477('0x20')]()[_0xa477('0x1f')](function(){var _0x472ed1=_0x166694[_0xa477('0x21')]({'plain':!![]});var _0x2b5c7f='ChanSpies';return db[_0xa477('0x22')][_0xa477('0x20')]({'where':{'type':_0x2b5c7f,'resourceId':_0x472ed1['id']}})[_0xa477('0x1f')](function(){return _0x166694;});})[_0xa477('0x1f')](function(){_0x5b6e98[_0xa477('0x15')](0xcc)[_0xa477('0x16')]();});}};}function handleEntityNotFound(_0x75f779,_0x47a86c){return function(_0x46c831){if(!_0x46c831){_0x75f779[_0xa477('0x23')](0x194);}return _0x46c831;};}function handleError(_0x287c83,_0x25acee){_0x25acee=_0x25acee||0x1f4;return function(_0x18d6a1){logger[_0xa477('0x24')](_0x18d6a1[_0xa477('0x25')]);if(_0x18d6a1['name']){delete _0x18d6a1[_0xa477('0x26')];}_0x287c83['status'](_0x25acee)['send'](_0x18d6a1);};}exports[_0xa477('0x27')]=function(_0x1fa6a5,_0x4c27e7){var _0x15e476={},_0x15c0ea={},_0x3dd666={'count':0x0,'rows':[]};var _0x3ec631=_[_0xa477('0x28')](db[_0xa477('0x29')][_0xa477('0x2a')],function(_0x91f9bf){return{'name':_0x91f9bf[_0xa477('0x2b')],'type':_0x91f9bf[_0xa477('0x2c')][_0xa477('0x2d')]};});_0x15c0ea[_0xa477('0x2e')]=_[_0xa477('0x28')](_0x3ec631,'name');_0x15c0ea[_0xa477('0x2f')]=_[_0xa477('0x30')](_0x1fa6a5[_0xa477('0x2f')]);_0x15c0ea[_0xa477('0x31')]=_[_0xa477('0x32')](_0x15c0ea[_0xa477('0x2e')],_0x15c0ea[_0xa477('0x2f')]);_0x15e476[_0xa477('0x33')]=_['intersection'](_0x15c0ea[_0xa477('0x2e')],qs[_0xa477('0x34')](_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x34')]));_0x15e476[_0xa477('0x33')]=_0x15e476[_0xa477('0x33')][_0xa477('0x35')]?_0x15e476[_0xa477('0x33')]:_0x15c0ea[_0xa477('0x2e')];if(!_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x36')](_0xa477('0x37'))){_0x15e476[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x1a')]);_0x15e476[_0xa477('0x18')]=qs[_0xa477('0x18')](_0x1fa6a5[_0xa477('0x2f')]['offset']);}_0x15e476[_0xa477('0x38')]=qs[_0xa477('0x39')](_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x39')]);_0x15e476[_0xa477('0x3a')]=qs[_0xa477('0x31')](_['pick'](_0x1fa6a5['query'],_0x15c0ea[_0xa477('0x31')]),_0x3ec631);if(_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x3b')]){_0x15e476[_0xa477('0x3a')]=_['merge'](_0x15e476['where'],{'$or':_[_0xa477('0x28')](_0x3ec631,function(_0x318086){if(_0x318086[_0xa477('0x2c')]!==_0xa477('0x3c')){var _0x326962={};_0x326962[_0x318086[_0xa477('0x26')]]={'$like':'%'+_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x3b')]+'%'};return _0x326962;}})});}_0x15e476=_[_0xa477('0x3d')]({},_0x15e476,_0x1fa6a5['options']);var _0x2406ff={'where':_0x15e476[_0xa477('0x3a')]};return db[_0xa477('0x29')]['count'](_0x2406ff)[_0xa477('0x1f')](function(_0x4be8cb){_0x3dd666[_0xa477('0x1b')]=_0x4be8cb;if(_0x1fa6a5[_0xa477('0x2f')]['includeAll']){_0x15e476[_0xa477('0x3e')]=[{'all':!![]}];}return db[_0xa477('0x29')]['findAll'](_0x15e476);})[_0xa477('0x1f')](function(_0x37f18c){_0x3dd666[_0xa477('0x3f')]=_0x37f18c;return _0x3dd666;})[_0xa477('0x1f')](respondWithFilteredResult(_0x4c27e7,_0x15e476))[_0xa477('0x40')](handleError(_0x4c27e7,null));};exports[_0xa477('0x41')]=function(_0x2ecc11,_0xb1480a){var _0x983c11={'raw':![],'where':{'id':_0x2ecc11['params']['id']}},_0x476746={};_0x476746[_0xa477('0x2e')]=_[_0xa477('0x30')](db[_0xa477('0x29')][_0xa477('0x2a')]);_0x476746[_0xa477('0x2f')]=_['keys'](_0x2ecc11[_0xa477('0x2f')]);_0x476746['filters']=_[_0xa477('0x32')](_0x476746[_0xa477('0x2e')],_0x476746[_0xa477('0x2f')]);_0x983c11['attributes']=_[_0xa477('0x32')](_0x476746[_0xa477('0x2e')],qs[_0xa477('0x34')](_0x2ecc11[_0xa477('0x2f')][_0xa477('0x34')]));_0x983c11[_0xa477('0x33')]=_0x983c11[_0xa477('0x33')][_0xa477('0x35')]?_0x983c11[_0xa477('0x33')]:_0x476746[_0xa477('0x2e')];if(_0x2ecc11[_0xa477('0x2f')]['includeAll']){_0x983c11[_0xa477('0x3e')]=[{'all':!![]}];}_0x983c11=_[_0xa477('0x3d')]({},_0x983c11,_0x2ecc11[_0xa477('0x42')]);return db['VoiceChanSpy'][_0xa477('0x43')](_0x983c11)[_0xa477('0x1f')](handleEntityNotFound(_0xb1480a,null))['then'](respondWithResult(_0xb1480a,null))[_0xa477('0x40')](handleError(_0xb1480a,null));};exports[_0xa477('0x44')]=function(_0x404b00,_0x543a19){return db[_0xa477('0x29')]['create'](_0x404b00[_0xa477('0x45')],{})['then'](function(_0xd74d50){var _0x271831=_0x404b00[_0xa477('0x46')][_0xa477('0x21')]({'plain':!![]});if(!_0x271831)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x271831[_0xa477('0x47')]===_0xa477('0x46')){var _0xa30b74=_0xd74d50['get']({'plain':!![]});var _0x4fb38b=_0xa477('0x48');return db[_0xa477('0x49')][_0xa477('0x43')]({'where':{'name':_0x4fb38b,'userProfileId':_0x271831[_0xa477('0x4a')]},'raw':!![]})[_0xa477('0x1f')](function(_0x1dfcbd){if(_0x1dfcbd&&_0x1dfcbd[_0xa477('0x4b')]===0x0){return db[_0xa477('0x22')]['create']({'name':_0xa30b74['name'],'resourceId':_0xa30b74['id'],'type':_0x1dfcbd[_0xa477('0x26')],'sectionId':_0x1dfcbd['id']},{})[_0xa477('0x1f')](function(){return _0xd74d50;});}else{return _0xd74d50;}})[_0xa477('0x40')](function(_0xadf7b9){logger[_0xa477('0x24')](_0xa477('0x4c'),_0xadf7b9);throw _0xadf7b9;});}return _0xd74d50;})['then'](respondWithResult(_0x543a19,0xc9))[_0xa477('0x40')](handleError(_0x543a19,null));};exports[_0xa477('0x4d')]=function(_0x219417,_0x2d4b29){if(_0x219417[_0xa477('0x45')]['id']){delete _0x219417[_0xa477('0x45')]['id'];}return db[_0xa477('0x29')]['find']({'where':{'id':_0x219417['params']['id']}})[_0xa477('0x1f')](handleEntityNotFound(_0x2d4b29,null))[_0xa477('0x1f')](saveUpdates(_0x219417[_0xa477('0x45')],null))['then'](respondWithResult(_0x2d4b29,null))[_0xa477('0x40')](handleError(_0x2d4b29,null));};exports[_0xa477('0x20')]=function(_0x12b028,_0x504722){return db[_0xa477('0x29')][_0xa477('0x43')]({'where':{'id':_0x12b028[_0xa477('0x4e')]['id']}})[_0xa477('0x1f')](handleEntityNotFound(_0x504722,null))[_0xa477('0x1f')](removeEntity(_0x504722,null))[_0xa477('0x40')](handleError(_0x504722,null));}; \ No newline at end of file +var _0x3a79=['VoiceChanSpy','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','rawAttributes','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','ChanSpies','destroy','error','stack','name','send','index'];(function(_0x5370d1,_0x55644e){var _0x479410=function(_0x449e7c){while(--_0x449e7c){_0x5370d1['push'](_0x5370d1['shift']());}};_0x479410(++_0x55644e);}(_0x3a79,0xca));var _0x93a7=function(_0x18435d,_0x1a5266){_0x18435d=_0x18435d-0x0;var _0x3a7d61=_0x3a79[_0x18435d];return _0x3a7d61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93a7('0x0'));var zipdir=require(_0x93a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x93a7('0x2'));var moment=require(_0x93a7('0x3'));var BPromise=require(_0x93a7('0x4'));var Mustache=require(_0x93a7('0x5'));var util=require(_0x93a7('0x6'));var path=require(_0x93a7('0x7'));var sox=require(_0x93a7('0x8'));var csv=require('to-csv');var ejs=require(_0x93a7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93a7('0xa'));var squel=require(_0x93a7('0xb'));var crypto=require(_0x93a7('0xc'));var jsforce=require(_0x93a7('0xd'));var deskjs=require(_0x93a7('0xe'));var toCsv=require(_0x93a7('0xf'));var querystring=require('querystring');var Papa=require(_0x93a7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x93a7('0x11'));var as=require(_0x93a7('0x12'));var hardwareService=require(_0x93a7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x93a7('0x14'));var config=require(_0x93a7('0x15'));var licenseUtil=require(_0x93a7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57ff4d,_0x1c9461){_0x1c9461=_0x1c9461||0xcc;return function(_0x5289f7){if(_0x5289f7){return _0x57ff4d[_0x93a7('0x17')](_0x1c9461);}return _0x57ff4d[_0x93a7('0x18')](_0x1c9461)[_0x93a7('0x19')]();};}function respondWithResult(_0xa0234a,_0x23380e){_0x23380e=_0x23380e||0xc8;return function(_0x423458){if(_0x423458){return _0xa0234a[_0x93a7('0x18')](_0x23380e)['json'](_0x423458);}};}function respondWithFilteredResult(_0x46967b,_0x27ae27){return function(_0x4aa44e){if(_0x4aa44e){var _0x517a72=typeof _0x27ae27[_0x93a7('0x1a')]==='undefined'&&typeof _0x27ae27[_0x93a7('0x1b')]===_0x93a7('0x1c');var _0x8c8f3b=_0x4aa44e[_0x93a7('0x1d')];var _0x3d1db3=_0x517a72?0x0:_0x27ae27['offset'];var _0xfe6814=_0x517a72?_0x4aa44e['count']:_0x27ae27[_0x93a7('0x1a')]+_0x27ae27[_0x93a7('0x1b')];var _0x1870cb;if(_0xfe6814>=_0x8c8f3b){_0xfe6814=_0x8c8f3b;_0x1870cb=0xc8;}else{_0x1870cb=0xce;}_0x46967b[_0x93a7('0x18')](_0x1870cb);return _0x46967b[_0x93a7('0x1e')]('Content-Range',_0x3d1db3+'-'+_0xfe6814+'/'+_0x8c8f3b)[_0x93a7('0x1f')](_0x4aa44e);}return null;};}function patchUpdates(_0x321c32){return function(_0xdebaba){try{jsonpatch[_0x93a7('0x20')](_0xdebaba,_0x321c32,!![]);}catch(_0x3d0e5a){return BPromise[_0x93a7('0x21')](_0x3d0e5a);}return _0xdebaba[_0x93a7('0x22')]();};}function saveUpdates(_0x446b7a,_0x50ea8d){return function(_0x29cd68){if(_0x29cd68){return _0x29cd68[_0x93a7('0x23')](_0x446b7a)['then'](function(_0x323cb2){return _0x323cb2;});}return null;};}function removeEntity(_0x198b82,_0x24fa68){return function(_0x461632){if(_0x461632){return _0x461632['destroy']()[_0x93a7('0x24')](function(){var _0x247d63=_0x461632['get']({'plain':!![]});var _0xafae92=_0x93a7('0x25');return db['UserProfileResource'][_0x93a7('0x26')]({'where':{'type':_0xafae92,'resourceId':_0x247d63['id']}})['then'](function(){return _0x461632;});})[_0x93a7('0x24')](function(){_0x198b82[_0x93a7('0x18')](0xcc)[_0x93a7('0x19')]();});}};}function handleEntityNotFound(_0x4735a8,_0x5994dd){return function(_0x1eaff9){if(!_0x1eaff9){_0x4735a8['sendStatus'](0x194);}return _0x1eaff9;};}function handleError(_0x5efcb7,_0x10d410){_0x10d410=_0x10d410||0x1f4;return function(_0x44c6da){logger[_0x93a7('0x27')](_0x44c6da[_0x93a7('0x28')]);if(_0x44c6da[_0x93a7('0x29')]){delete _0x44c6da['name'];}_0x5efcb7[_0x93a7('0x18')](_0x10d410)[_0x93a7('0x2a')](_0x44c6da);};}exports[_0x93a7('0x2b')]=function(_0x5a12b0,_0x4dca12){var _0x511748={},_0x1ecdd7={},_0x19cae4={'count':0x0,'rows':[]};var _0xd5bbf3=_['map'](db[_0x93a7('0x2c')]['rawAttributes'],function(_0x4d1a28){return{'name':_0x4d1a28['fieldName'],'type':_0x4d1a28[_0x93a7('0x2d')]['key']};});_0x1ecdd7[_0x93a7('0x2e')]=_[_0x93a7('0x2f')](_0xd5bbf3,'name');_0x1ecdd7['query']=_['keys'](_0x5a12b0[_0x93a7('0x30')]);_0x1ecdd7[_0x93a7('0x31')]=_[_0x93a7('0x32')](_0x1ecdd7[_0x93a7('0x2e')],_0x1ecdd7['query']);_0x511748[_0x93a7('0x33')]=_[_0x93a7('0x32')](_0x1ecdd7['model'],qs['fields'](_0x5a12b0[_0x93a7('0x30')][_0x93a7('0x34')]));_0x511748[_0x93a7('0x33')]=_0x511748[_0x93a7('0x33')][_0x93a7('0x35')]?_0x511748[_0x93a7('0x33')]:_0x1ecdd7[_0x93a7('0x2e')];if(!_0x5a12b0['query'][_0x93a7('0x36')](_0x93a7('0x37'))){_0x511748[_0x93a7('0x1b')]=qs[_0x93a7('0x1b')](_0x5a12b0[_0x93a7('0x30')][_0x93a7('0x1b')]);_0x511748[_0x93a7('0x1a')]=qs['offset'](_0x5a12b0['query'][_0x93a7('0x1a')]);}_0x511748[_0x93a7('0x38')]=qs[_0x93a7('0x39')](_0x5a12b0[_0x93a7('0x30')][_0x93a7('0x39')]);_0x511748['where']=qs[_0x93a7('0x31')](_[_0x93a7('0x3a')](_0x5a12b0[_0x93a7('0x30')],_0x1ecdd7[_0x93a7('0x31')]),_0xd5bbf3);if(_0x5a12b0[_0x93a7('0x30')][_0x93a7('0x3b')]){_0x511748[_0x93a7('0x3c')]=_[_0x93a7('0x3d')](_0x511748[_0x93a7('0x3c')],{'$or':_[_0x93a7('0x2f')](_0xd5bbf3,function(_0x5a0a88){if(_0x5a0a88[_0x93a7('0x2d')]!==_0x93a7('0x3e')){var _0x50b4f0={};_0x50b4f0[_0x5a0a88[_0x93a7('0x29')]]={'$like':'%'+_0x5a12b0[_0x93a7('0x30')][_0x93a7('0x3b')]+'%'};return _0x50b4f0;}})});}_0x511748=_['merge']({},_0x511748,_0x5a12b0[_0x93a7('0x3f')]);var _0x21cbaa={'where':_0x511748[_0x93a7('0x3c')]};return db[_0x93a7('0x2c')][_0x93a7('0x1d')](_0x21cbaa)[_0x93a7('0x24')](function(_0x50de34){_0x19cae4[_0x93a7('0x1d')]=_0x50de34;if(_0x5a12b0['query'][_0x93a7('0x40')]){_0x511748[_0x93a7('0x41')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x93a7('0x42')](_0x511748);})[_0x93a7('0x24')](function(_0x5659b9){_0x19cae4['rows']=_0x5659b9;return _0x19cae4;})[_0x93a7('0x24')](respondWithFilteredResult(_0x4dca12,_0x511748))['catch'](handleError(_0x4dca12,null));};exports['show']=function(_0x13c49b,_0x3342f2){var _0x5cd980={'raw':![],'where':{'id':_0x13c49b[_0x93a7('0x43')]['id']}},_0x5aca88={};_0x5aca88['model']=_[_0x93a7('0x44')](db['VoiceChanSpy'][_0x93a7('0x45')]);_0x5aca88[_0x93a7('0x30')]=_[_0x93a7('0x44')](_0x13c49b[_0x93a7('0x30')]);_0x5aca88['filters']=_['intersection'](_0x5aca88['model'],_0x5aca88[_0x93a7('0x30')]);_0x5cd980[_0x93a7('0x33')]=_[_0x93a7('0x32')](_0x5aca88['model'],qs[_0x93a7('0x34')](_0x13c49b[_0x93a7('0x30')][_0x93a7('0x34')]));_0x5cd980['attributes']=_0x5cd980[_0x93a7('0x33')][_0x93a7('0x35')]?_0x5cd980['attributes']:_0x5aca88[_0x93a7('0x2e')];if(_0x13c49b[_0x93a7('0x30')]['includeAll']){_0x5cd980[_0x93a7('0x41')]=[{'all':!![]}];}_0x5cd980=_[_0x93a7('0x3d')]({},_0x5cd980,_0x13c49b[_0x93a7('0x3f')]);return db[_0x93a7('0x2c')]['find'](_0x5cd980)[_0x93a7('0x24')](handleEntityNotFound(_0x3342f2,null))[_0x93a7('0x24')](respondWithResult(_0x3342f2,null))[_0x93a7('0x46')](handleError(_0x3342f2,null));};exports['create']=function(_0x1cddbc,_0x23a1dc){return db[_0x93a7('0x2c')][_0x93a7('0x47')](_0x1cddbc[_0x93a7('0x48')],{})[_0x93a7('0x24')](function(_0x4cb904){var _0x598a17=_0x1cddbc[_0x93a7('0x49')][_0x93a7('0x4a')]({'plain':!![]});if(!_0x598a17)throw new Error(_0x93a7('0x4b'));if(_0x598a17[_0x93a7('0x4c')]==='user'){var _0x18071f=_0x4cb904[_0x93a7('0x4a')]({'plain':!![]});var _0x3b79d9=_0x93a7('0x25');return db['UserProfileSection'][_0x93a7('0x4d')]({'where':{'name':_0x3b79d9,'userProfileId':_0x598a17[_0x93a7('0x4e')]},'raw':!![]})[_0x93a7('0x24')](function(_0x50a4f2){if(_0x50a4f2&&_0x50a4f2[_0x93a7('0x4f')]===0x0){return db[_0x93a7('0x50')]['create']({'name':_0x18071f[_0x93a7('0x29')],'resourceId':_0x18071f['id'],'type':_0x50a4f2[_0x93a7('0x29')],'sectionId':_0x50a4f2['id']},{})[_0x93a7('0x24')](function(){return _0x4cb904;});}else{return _0x4cb904;}})[_0x93a7('0x46')](function(_0x214498){logger[_0x93a7('0x27')](_0x93a7('0x51'),_0x214498);throw _0x214498;});}return _0x4cb904;})[_0x93a7('0x24')](respondWithResult(_0x23a1dc,0xc9))['catch'](handleError(_0x23a1dc,null));};exports['update']=function(_0x75339a,_0xcfb3fb){if(_0x75339a['body']['id']){delete _0x75339a[_0x93a7('0x48')]['id'];}return db['VoiceChanSpy'][_0x93a7('0x4d')]({'where':{'id':_0x75339a[_0x93a7('0x43')]['id']}})[_0x93a7('0x24')](handleEntityNotFound(_0xcfb3fb,null))[_0x93a7('0x24')](saveUpdates(_0x75339a[_0x93a7('0x48')],null))[_0x93a7('0x24')](respondWithResult(_0xcfb3fb,null))[_0x93a7('0x46')](handleError(_0xcfb3fb,null));};exports[_0x93a7('0x26')]=function(_0x15905d,_0x5e1c9f){return db[_0x93a7('0x2c')][_0x93a7('0x4d')]({'where':{'id':_0x15905d[_0x93a7('0x43')]['id']}})[_0x93a7('0x24')](handleEntityNotFound(_0x5e1c9f,null))[_0x93a7('0x24')](removeEntity(_0x5e1c9f,null))[_0x93a7('0x46')](handleError(_0x5e1c9f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f7272e3..c359c78 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 _0x1103=['CDR(type)=%s','chanspy','push','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','VoiceExtension','destroy','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','merge','Set'];(function(_0x37396d,_0x1218bd){var _0x21f61a=function(_0x3dd8fe){while(--_0x3dd8fe){_0x37396d['push'](_0x37396d['shift']());}};_0x21f61a(++_0x1218bd);}(_0x1103,0x18f));var _0x3110=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1103[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x3110('0x0'));var attributes=require(_0x3110('0x1'));var getUserApplications=function(_0xc620d3,_0x320ebd,_0x4db596){var _0x15d41d=0x1;var _0x120460=[];var _0x560cfd={'context':_0x320ebd[_0x3110('0x2')]||_0x3110('0x3'),'exten':util[_0x3110('0x4')](_0x3110('0x5'),_0xc620d3['prefix'],_0x4db596),'type':_0x3110('0x6'),'isApp':![],'ChanSpyId':_0xc620d3['id'],'UserId':_0x320ebd['id']};_0x120460['push'](_[_0x3110('0x7')]({'app':_0x3110('0x8'),'appdata':util['format'](_0x3110('0x9'),_0x3110('0xa')),'priority':_0x15d41d++},_0x560cfd));if(_0xc620d3['record']){_0x120460[_0x3110('0xb')](_['merge']({'app':'MixMonitor','appdata':util[_0x3110('0x4')]('${UNIQUEID}.%s,a',_0xc620d3[_0x3110('0xc')]),'priority':_0x15d41d++},_0x560cfd));}if(_0xc620d3['auth']){_0x120460[_0x3110('0xb')](_[_0x3110('0x7')]({'app':_0x3110('0xd'),'appdata':_0xc620d3['password'],'priority':_0x15d41d++},_0x560cfd));}_0x120460['push'](_[_0x3110('0x7')]({'app':_0x3110('0xe'),'appdata':util['format'](_0x3110('0xf'),_0x320ebd[_0x3110('0x10')],_0xc620d3[_0x3110('0x11')]?_0xc620d3[_0x3110('0x11')][_0x3110('0x12')](''):''),'priority':_0x15d41d++},_0x560cfd));if(_0xc620d3['record']){_0x120460[_0x3110('0xb')](_['merge']({'app':'StopMixMonitor','priority':_0x15d41d++},_0x560cfd));}return _0x120460;};var getChanSpyApplications=function(_0xd51086,_0xba24a6){var _0x5ea164=[];for(var _0x14554a=0x0,_0x5b6409=0x1;_0x14554a<_0xba24a6[_0x3110('0x13')];_0x14554a++,_0x5b6409=0x1){_0x5ea164=_0x5ea164[_0x3110('0x14')](getUserApplications(_0xd51086,_0xba24a6[_0x14554a],_0xba24a6[_0x14554a][_0x3110('0x15')]));if(_0xba24a6[_0x14554a][_0x3110('0x15')]!=_0xba24a6[_0x14554a][_0x3110('0x10')]){_0x5ea164=_0x5ea164['concat'](getUserApplications(_0xd51086,_0xba24a6[_0x14554a],_0xba24a6[_0x14554a][_0x3110('0x10')]));}}return _0x5ea164;};var getChanSpyPromise=function(_0x488c4b,_0x3f7a32){return new BPromise(function(_0x280fd9,_0x1f32b7){return _0x488c4b[_0x3110('0x16')][_0x3110('0x17')]({'attributes':['id','name',_0x3110('0x15')],'where':{'role':_0x3110('0x18'),'chanspy':!![]},'raw':!![]})[_0x3110('0x19')](function(_0x34e70e){if(_0x34e70e){return _0x280fd9(getChanSpyApplications(_0x3f7a32,_0x34e70e));}return _0x280fd9([]);})[_0x3110('0x1a')](function(_0x27e7ee){_0x1f32b7(_0x27e7ee);});});};module['exports']=function(_0x27a116,_0x4b5ebb){var _0xe37c96=_0x27a116[_0x3110('0x1b')];return _0x27a116[_0x3110('0x1c')](_0x3110('0x1d'),attributes,{'tableName':_0x3110('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3432c1,_0x33bffc,_0x487f8a){return getChanSpyPromise(_0xe37c96,_0x3432c1)['then'](function(_0x125518){if(_0x125518&&_0x125518[_0x3110('0x13')]){return _0xe37c96['VoiceExtension'][_0x3110('0x1f')](_0x125518);}})[_0x3110('0x19')](function(){_0x487f8a();})[_0x3110('0x1a')](function(_0x19e894){_0x487f8a(_0x19e894);});},'afterUpdate':function(_0xe26c2d,_0x531fbc,_0x515b34){return _0xe37c96[_0x3110('0x20')][_0x3110('0x21')]({'where':{'ChanSpyId':_0xe26c2d['id']}})[_0x3110('0x19')](function(){return getChanSpyPromise(_0xe37c96,_0xe26c2d);})[_0x3110('0x19')](function(_0x258480){if(_0x258480&&_0x258480[_0x3110('0x13')]){return _0xe37c96['VoiceExtension'][_0x3110('0x1f')](_0x258480);}})[_0x3110('0x19')](function(){_0x515b34();})[_0x3110('0x1a')](function(_0x55ef49){_0x515b34(_0x55ef49);});},'afterDestroy':function(_0x1b25d9,_0x1fc5be,_0x5dd2a0){return _0xe37c96[_0x3110('0x20')]['destroy']({'where':{'ChanSpyId':_0x1b25d9['id']}})['then'](function(){_0x5dd2a0();})[_0x3110('0x1a')](function(_0x2b578d){_0x5dd2a0(_0x2b578d);});}}});}; \ No newline at end of file +var _0x86b4=['from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','chanspy','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','SIP/%s,%s','name','options','join','record','StopMixMonitor','internal','concat','agent','then','catch','exports','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','length','lodash','util'];(function(_0x208f73,_0x54bfc2){var _0x465378=function(_0x7f4a5){while(--_0x7f4a5){_0x208f73['push'](_0x208f73['shift']());}};_0x465378(++_0x54bfc2);}(_0x86b4,0x64));var _0x486b=function(_0x11c5bc,_0x384d4e){_0x11c5bc=_0x11c5bc-0x0;var _0x91e217=_0x86b4[_0x11c5bc];return _0x91e217;};'use strict';var _=require(_0x486b('0x0'));var util=require(_0x486b('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x47252a,_0x2d23de,_0x531c64){var _0x1ec097=0x1;var _0x320d21=[];var _0x24badf={'context':_0x2d23de['context']||_0x486b('0x2'),'exten':util[_0x486b('0x3')](_0x486b('0x4'),_0x47252a[_0x486b('0x5')],_0x531c64),'type':_0x486b('0x6'),'isApp':![],'ChanSpyId':_0x47252a['id'],'UserId':_0x2d23de['id']};_0x320d21[_0x486b('0x7')](_['merge']({'app':_0x486b('0x8'),'appdata':util[_0x486b('0x3')](_0x486b('0x9'),_0x486b('0xa')),'priority':_0x1ec097++},_0x24badf));if(_0x47252a['record']){_0x320d21[_0x486b('0x7')](_[_0x486b('0xb')]({'app':_0x486b('0xc'),'appdata':util[_0x486b('0x3')](_0x486b('0xd'),_0x47252a[_0x486b('0xe')]),'priority':_0x1ec097++},_0x24badf));}if(_0x47252a['auth']){_0x320d21[_0x486b('0x7')](_[_0x486b('0xb')]({'app':'Authenticate','appdata':_0x47252a[_0x486b('0xf')],'priority':_0x1ec097++},_0x24badf));}_0x320d21['push'](_['merge']({'app':'ChanSpy','appdata':util['format'](_0x486b('0x10'),_0x2d23de[_0x486b('0x11')],_0x47252a['options']?_0x47252a[_0x486b('0x12')][_0x486b('0x13')](''):''),'priority':_0x1ec097++},_0x24badf));if(_0x47252a[_0x486b('0x14')]){_0x320d21[_0x486b('0x7')](_[_0x486b('0xb')]({'app':_0x486b('0x15'),'priority':_0x1ec097++},_0x24badf));}return _0x320d21;};var getChanSpyApplications=function(_0x139c88,_0x1d1057){var _0x3d1d2d=[];for(var _0x21e934=0x0,_0x4b1b0f=0x1;_0x21e934<_0x1d1057['length'];_0x21e934++,_0x4b1b0f=0x1){_0x3d1d2d=_0x3d1d2d['concat'](getUserApplications(_0x139c88,_0x1d1057[_0x21e934],_0x1d1057[_0x21e934][_0x486b('0x16')]));if(_0x1d1057[_0x21e934][_0x486b('0x16')]!=_0x1d1057[_0x21e934][_0x486b('0x11')]){_0x3d1d2d=_0x3d1d2d[_0x486b('0x17')](getUserApplications(_0x139c88,_0x1d1057[_0x21e934],_0x1d1057[_0x21e934][_0x486b('0x11')]));}}return _0x3d1d2d;};var getChanSpyPromise=function(_0x46bfea,_0x1463ea){return new BPromise(function(_0x5665d6,_0x4d5d55){return _0x46bfea['User']['findAll']({'attributes':['id',_0x486b('0x11'),_0x486b('0x16')],'where':{'role':_0x486b('0x18'),'chanspy':!![]},'raw':!![]})[_0x486b('0x19')](function(_0x4cdb38){if(_0x4cdb38){return _0x5665d6(getChanSpyApplications(_0x1463ea,_0x4cdb38));}return _0x5665d6([]);})[_0x486b('0x1a')](function(_0x3fc927){_0x4d5d55(_0x3fc927);});});};module[_0x486b('0x1b')]=function(_0x42ece4,_0x502fe5){var _0x1a6063=_0x42ece4['models'];return _0x42ece4[_0x486b('0x1c')](_0x486b('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a6a53,_0x210c8b,_0x17a769){return getChanSpyPromise(_0x1a6063,_0x4a6a53)['then'](function(_0x11e964){if(_0x11e964&&_0x11e964['length']){return _0x1a6063[_0x486b('0x1e')][_0x486b('0x1f')](_0x11e964);}})[_0x486b('0x19')](function(){_0x17a769();})[_0x486b('0x1a')](function(_0x4acd82){_0x17a769(_0x4acd82);});},'afterUpdate':function(_0x3fb060,_0x3f8e65,_0x3ba359){return _0x1a6063[_0x486b('0x1e')][_0x486b('0x20')]({'where':{'ChanSpyId':_0x3fb060['id']}})['then'](function(){return getChanSpyPromise(_0x1a6063,_0x3fb060);})[_0x486b('0x19')](function(_0x11c732){if(_0x11c732&&_0x11c732[_0x486b('0x21')]){return _0x1a6063[_0x486b('0x1e')]['bulkCreate'](_0x11c732);}})[_0x486b('0x19')](function(){_0x3ba359();})[_0x486b('0x1a')](function(_0x41fbcb){_0x3ba359(_0x41fbcb);});},'afterDestroy':function(_0x26d1db,_0x37a863,_0x3e39fc){return _0x1a6063[_0x486b('0x1e')][_0x486b('0x20')]({'where':{'ChanSpyId':_0x26d1db['id']}})[_0x486b('0x19')](function(){_0x3e39fc();})[_0x486b('0x1a')](function(_0x182c0e){_0x3e39fc(_0x182c0e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index c1223d6..f718c76 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 _0x5ff3=['message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x23a3aa,_0x5a7353){var _0x3b4d00=function(_0x5135c4){while(--_0x5135c4){_0x23a3aa['push'](_0x23a3aa['shift']());}};_0x3b4d00(++_0x5a7353);}(_0x5ff3,0x17d));var _0x35ff=function(_0x1e8287,_0x592fed){_0x1e8287=_0x1e8287-0x0;var _0x44bea5=_0x5ff3[_0x1e8287];return _0x44bea5;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});} \ No newline at end of file +var _0xf9f7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error'];(function(_0x4092b6,_0x34ecad){var _0x56fef0=function(_0x53d3f7){while(--_0x53d3f7){_0x4092b6['push'](_0x4092b6['shift']());}};_0x56fef0(++_0x34ecad);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x4b0008,_0x41218b){_0x4b0008=_0x4b0008-0x0;var _0x401c96=_0xf9f7[_0x4b0008];return _0x401c96;};'use strict';var _=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var moment=require(_0x7f9f('0x2'));var BPromise=require(_0x7f9f('0x3'));var rs=require(_0x7f9f('0x4'));var fs=require('fs');var Redis=require(_0x7f9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f9f('0x6'))(_0x7f9f('0x7'));var config=require(_0x7f9f('0x8'));var jayson=require(_0x7f9f('0x9'));var client=jayson[_0x7f9f('0xa')][_0x7f9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5819,_0x37e39f,_0x3da87e){return new BPromise(function(_0x181328,_0x3e9e75){return client[_0x7f9f('0xc')](_0x5b5819,_0x3da87e)['then'](function(_0x3fda85){logger[_0x7f9f('0xd')](_0x7f9f('0xe'),_0x37e39f,_0x7f9f('0xf'));logger[_0x7f9f('0x10')](_0x7f9f('0x11'),_0x37e39f,_0x7f9f('0xf'),JSON['stringify'](_0x3fda85));if(_0x3fda85[_0x7f9f('0x12')]){if(_0x3fda85[_0x7f9f('0x12')]['code']===0x1f4){logger['error'](_0x7f9f('0xe'),_0x37e39f,_0x3fda85['error'][_0x7f9f('0x13')]);return _0x3e9e75(_0x3fda85[_0x7f9f('0x12')]['message']);}logger[_0x7f9f('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x37e39f,_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);return _0x181328(_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);}else{logger[_0x7f9f('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x37e39f,_0x7f9f('0xf'));_0x181328(_0x3fda85[_0x7f9f('0x14')]['message']);}})[_0x7f9f('0x15')](function(_0x4a36c8){logger[_0x7f9f('0x12')](_0x7f9f('0xe'),_0x37e39f,_0x4a36c8);_0x3e9e75(_0x4a36c8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 1ccceac..3ca5690 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 _0x97fe=['multer','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports'];(function(_0xaadfc3,_0x3732d6){var _0x5e34a2=function(_0x1ad0e5){while(--_0x1ad0e5){_0xaadfc3['push'](_0xaadfc3['shift']());}};_0x5e34a2(++_0x3732d6);}(_0x97fe,0x110));var _0xe97f=function(_0x655d14,_0x391bd5){_0x655d14=_0x655d14-0x0;var _0x499204=_0x97fe[_0x655d14];return _0x499204;};'use strict';var multer=require(_0xe97f('0x0'));var util=require('util');var path=require(_0xe97f('0x1'));var timeout=require('connect-timeout');var express=require(_0xe97f('0x2'));var router=express['Router']();var fs_extra=require(_0xe97f('0x3'));var auth=require(_0xe97f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe97f('0x5'));var controller=require(_0xe97f('0x6'));router[_0xe97f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe97f('0x7')](_0xe97f('0x8'),auth[_0xe97f('0x9')](),controller[_0xe97f('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe97f('0xb')]);router[_0xe97f('0xc')](_0xe97f('0x8'),auth['isAuthenticated'](),controller[_0xe97f('0xd')]);router[_0xe97f('0xe')](_0xe97f('0x8'),auth[_0xe97f('0x9')](),controller[_0xe97f('0xf')]);module[_0xe97f('0x10')]=router; \ No newline at end of file +var _0x734e=['exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0xa82967,_0x1fe811){var _0xd43329=function(_0x26c3c1){while(--_0x26c3c1){_0xa82967['push'](_0xa82967['shift']());}};_0xd43329(++_0x1fe811);}(_0x734e,0x1b6));var _0xe734=function(_0x579b79,_0x5b57b2){_0x579b79=_0x579b79-0x0;var _0x41e899=_0x734e[_0x579b79];return _0x41e899;};'use strict';var multer=require(_0xe734('0x0'));var util=require(_0xe734('0x1'));var path=require('path');var timeout=require(_0xe734('0x2'));var express=require(_0xe734('0x3'));var router=express[_0xe734('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe734('0x5'));var config=require(_0xe734('0x6'));var controller=require(_0xe734('0x7'));router[_0xe734('0x8')]('/',auth[_0xe734('0x9')](),controller[_0xe734('0xa')]);router[_0xe734('0x8')](_0xe734('0xb'),auth[_0xe734('0x9')](),controller[_0xe734('0xc')]);router[_0xe734('0xd')]('/',auth[_0xe734('0x9')](),controller[_0xe734('0xe')]);router['put'](_0xe734('0xb'),auth[_0xe734('0x9')](),controller[_0xe734('0xf')]);router[_0xe734('0x10')](_0xe734('0xb'),auth[_0xe734('0x9')](),controller[_0xe734('0x11')]);module[_0xe734('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index bfd6137..404fa95 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 _0xb93f=['exports','STRING','BOOLEAN','sequelize'];(function(_0x54f060,_0x1de751){var _0xb2b587=function(_0x3d3bd5){while(--_0x3d3bd5){_0x54f060['push'](_0x54f060['shift']());}};_0xb2b587(++_0x1de751);}(_0xb93f,0x17f));var _0xfb93=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0xb93f[_0x83af7f];return _0x32d85c;};'use strict';var Sequelize=require(_0xfb93('0x0'));module[_0xfb93('0x1')]={'name':{'type':Sequelize[_0xfb93('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xfb93('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xfb93('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x69dc=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x176953,_0x159407){var _0x58e5e2=function(_0x43fa0f){while(--_0x43fa0f){_0x176953['push'](_0x176953['shift']());}};_0x58e5e2(++_0x159407);}(_0x69dc,0x1df));var _0xc69d=function(_0x59b58e,_0x531882){_0x59b58e=_0x59b58e-0x0;var _0x58a7fe=_0x69dc[_0x59b58e];return _0x58a7fe;};'use strict';var Sequelize=require(_0xc69d('0x0'));module[_0xc69d('0x1')]={'name':{'type':Sequelize[_0xc69d('0x2')],'unique':_0xc69d('0x3')},'description':{'type':Sequelize[_0xc69d('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc69d('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 1b84fab..67d75ca 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 _0xa73a=['show','include','create','body','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','role','UserProfileSection','find','Contexts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','readFileSync','join','render','chan_sip.so','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','sendStatus','status','end','json','undefined','offset','set','Content-Range','apply','save','destroy','get','stack','name','send','index','map','VoiceContext','fieldName','type','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch'];(function(_0x4eb6e8,_0x247ce5){var _0x444f69=function(_0x23aa4d){while(--_0x23aa4d){_0x4eb6e8['push'](_0x4eb6e8['shift']());}};_0x444f69(++_0x247ce5);}(_0xa73a,0x82));var _0xaa73=function(_0x34b6aa,_0x5ddd29){_0x34b6aa=_0x34b6aa-0x0;var _0x3ead29=_0xa73a[_0x34b6aa];return _0x3ead29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa73('0x0'));var zipdir=require(_0xaa73('0x1'));var jsonpatch=require(_0xaa73('0x2'));var rp=require(_0xaa73('0x3'));var moment=require(_0xaa73('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaa73('0x5'));var sox=require(_0xaa73('0x6'));var csv=require(_0xaa73('0x7'));var ejs=require(_0xaa73('0x8'));var fs=require('fs');var fs_extra=require(_0xaa73('0x9'));var _=require(_0xaa73('0xa'));var squel=require(_0xaa73('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa73('0xc'));var toCsv=require(_0xaa73('0x7'));var querystring=require(_0xaa73('0xd'));var Papa=require(_0xaa73('0xe'));var Redis=require(_0xaa73('0xf'));var authService=require(_0xaa73('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa73('0x11'));var logger=require('../../config/logger')(_0xaa73('0x12'));var utils=require('../../config/utils');var config=require(_0xaa73('0x13'));var licenseUtil=require(_0xaa73('0x14'));var db=require(_0xaa73('0x15'))['db'];var jayson=require(_0xaa73('0x16'));var client=jayson[_0xaa73('0x17')][_0xaa73('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5e3bba,_0x2d1c07,_0x167db5,_0x29128f){return new BPromise(function(_0x457922,_0xc4a8e){var _0x319e55=_0x29128f||client;return _0x319e55[_0xaa73('0x19')](_0x5e3bba,_0x167db5)[_0xaa73('0x1a')](function(_0x339c82){logger['info'](_0xaa73('0x1b'),_0x2d1c07,'request\x20sent');logger[_0xaa73('0x1c')](_0xaa73('0x1d'),_0x2d1c07,_0xaa73('0x1e'),JSON['stringify'](_0x339c82));if(_0x339c82['error']){if(_0x339c82[_0xaa73('0x1f')]['code']===0x1f4){logger[_0xaa73('0x1f')](_0xaa73('0x1b'),_0x2d1c07,_0x339c82['error'][_0xaa73('0x20')]);return _0xc4a8e(_0x339c82[_0xaa73('0x1f')][_0xaa73('0x20')]);}logger[_0xaa73('0x1f')](_0xaa73('0x1b'),_0x2d1c07,_0x339c82[_0xaa73('0x1f')]['message']);return _0x457922(_0x339c82[_0xaa73('0x1f')]['message']);}else{logger[_0xaa73('0x21')](_0xaa73('0x1b'),_0x2d1c07,_0xaa73('0x1e'));_0x457922(_0x339c82[_0xaa73('0x22')]['message']);}})['catch'](function(_0x5303eb){logger[_0xaa73('0x1f')](_0xaa73('0x1b'),_0x2d1c07,_0x5303eb);_0xc4a8e(_0x5303eb);});});}function respondWithStatusCode(_0x2d7798,_0x346d57){_0x346d57=_0x346d57||0xcc;return function(_0x482795){if(_0x482795){return _0x2d7798[_0xaa73('0x23')](_0x346d57);}return _0x2d7798[_0xaa73('0x24')](_0x346d57)[_0xaa73('0x25')]();};}function respondWithResult(_0x4bdd4e,_0x3cae16){_0x3cae16=_0x3cae16||0xc8;return function(_0x88731){if(_0x88731){return _0x4bdd4e[_0xaa73('0x24')](_0x3cae16)[_0xaa73('0x26')](_0x88731);}};}function respondWithFilteredResult(_0x3af228,_0x1253aa){return function(_0x1ed112){if(_0x1ed112){var _0x3ab19f=typeof _0x1253aa['offset']==='undefined'&&typeof _0x1253aa['limit']===_0xaa73('0x27');var _0x562f01=_0x1ed112['count'];var _0x5617da=_0x3ab19f?0x0:_0x1253aa[_0xaa73('0x28')];var _0x344e31=_0x3ab19f?_0x1ed112['count']:_0x1253aa['offset']+_0x1253aa['limit'];var _0x35e714;if(_0x344e31>=_0x562f01){_0x344e31=_0x562f01;_0x35e714=0xc8;}else{_0x35e714=0xce;}_0x3af228[_0xaa73('0x24')](_0x35e714);return _0x3af228[_0xaa73('0x29')](_0xaa73('0x2a'),_0x5617da+'-'+_0x344e31+'/'+_0x562f01)['json'](_0x1ed112);}return null;};}function patchUpdates(_0x33d0a9){return function(_0x56b782){try{jsonpatch[_0xaa73('0x2b')](_0x56b782,_0x33d0a9,!![]);}catch(_0x5abf26){return BPromise['reject'](_0x5abf26);}return _0x56b782[_0xaa73('0x2c')]();};}function saveUpdates(_0x4e3e15,_0x71f997){return function(_0x99fac7){if(_0x99fac7){return _0x99fac7['update'](_0x4e3e15)[_0xaa73('0x1a')](function(_0x10deee){return _0x10deee;});}return null;};}function removeEntity(_0x30c22f,_0xa005dd){return function(_0xd6e953){if(_0xd6e953){return _0xd6e953[_0xaa73('0x2d')]()[_0xaa73('0x1a')](function(){var _0xd24899=_0xd6e953[_0xaa73('0x2e')]({'plain':!![]});var _0x54089f='Contexts';return db['UserProfileResource'][_0xaa73('0x2d')]({'where':{'type':_0x54089f,'resourceId':_0xd24899['id']}})[_0xaa73('0x1a')](function(){return _0xd6e953;});})[_0xaa73('0x1a')](function(){_0x30c22f[_0xaa73('0x24')](0xcc)[_0xaa73('0x25')]();});}};}function handleEntityNotFound(_0x3423bd,_0x418a54){return function(_0x3bc667){if(!_0x3bc667){_0x3423bd[_0xaa73('0x23')](0x194);}return _0x3bc667;};}function handleError(_0x317c9e,_0x582ee7){_0x582ee7=_0x582ee7||0x1f4;return function(_0x562e90){logger[_0xaa73('0x1f')](_0x562e90[_0xaa73('0x2f')]);if(_0x562e90[_0xaa73('0x30')]){delete _0x562e90[_0xaa73('0x30')];}_0x317c9e[_0xaa73('0x24')](_0x582ee7)[_0xaa73('0x31')](_0x562e90);};}exports[_0xaa73('0x32')]=function(_0x183992,_0x490417){var _0x25cb02={},_0x3099d0={},_0x1199b6={'count':0x0,'rows':[]};var _0x32e4d0=_[_0xaa73('0x33')](db[_0xaa73('0x34')]['rawAttributes'],function(_0x448f8c){return{'name':_0x448f8c[_0xaa73('0x35')],'type':_0x448f8c[_0xaa73('0x36')][_0xaa73('0x37')]};});_0x3099d0['model']=_[_0xaa73('0x33')](_0x32e4d0,'name');_0x3099d0['query']=_[_0xaa73('0x38')](_0x183992[_0xaa73('0x39')]);_0x3099d0['filters']=_['intersection'](_0x3099d0['model'],_0x3099d0['query']);_0x25cb02[_0xaa73('0x3a')]=_[_0xaa73('0x3b')](_0x3099d0[_0xaa73('0x3c')],qs[_0xaa73('0x3d')](_0x183992['query'][_0xaa73('0x3d')]));_0x25cb02[_0xaa73('0x3a')]=_0x25cb02[_0xaa73('0x3a')][_0xaa73('0x3e')]?_0x25cb02[_0xaa73('0x3a')]:_0x3099d0['model'];if(!_0x183992[_0xaa73('0x39')][_0xaa73('0x3f')](_0xaa73('0x40'))){_0x25cb02['limit']=qs[_0xaa73('0x41')](_0x183992[_0xaa73('0x39')][_0xaa73('0x41')]);_0x25cb02[_0xaa73('0x28')]=qs[_0xaa73('0x28')](_0x183992[_0xaa73('0x39')][_0xaa73('0x28')]);}_0x25cb02[_0xaa73('0x42')]=qs['sort'](_0x183992[_0xaa73('0x39')][_0xaa73('0x43')]);_0x25cb02[_0xaa73('0x44')]=qs[_0xaa73('0x45')](_[_0xaa73('0x46')](_0x183992[_0xaa73('0x39')],_0x3099d0[_0xaa73('0x45')]),_0x32e4d0);if(_0x183992['query']['filter']){_0x25cb02[_0xaa73('0x44')]=_[_0xaa73('0x47')](_0x25cb02[_0xaa73('0x44')],{'$or':_[_0xaa73('0x33')](_0x32e4d0,function(_0x726844){if(_0x726844['type']!==_0xaa73('0x48')){var _0x33b5d7={};_0x33b5d7[_0x726844[_0xaa73('0x30')]]={'$like':'%'+_0x183992[_0xaa73('0x39')][_0xaa73('0x49')]+'%'};return _0x33b5d7;}})});}_0x25cb02=_[_0xaa73('0x47')]({},_0x25cb02,_0x183992[_0xaa73('0x4a')]);var _0x31841f={'where':_0x25cb02['where']};return db[_0xaa73('0x34')][_0xaa73('0x4b')](_0x31841f)['then'](function(_0x5d9a5b){_0x1199b6[_0xaa73('0x4b')]=_0x5d9a5b;if(_0x183992['query'][_0xaa73('0x4c')]){_0x25cb02['include']=[{'all':!![]}];}return db['VoiceContext'][_0xaa73('0x4d')](_0x25cb02);})[_0xaa73('0x1a')](function(_0x2dd8e0){_0x1199b6[_0xaa73('0x4e')]=_0x2dd8e0;return _0x1199b6;})[_0xaa73('0x1a')](respondWithFilteredResult(_0x490417,_0x25cb02))[_0xaa73('0x4f')](handleError(_0x490417,null));};exports[_0xaa73('0x50')]=function(_0x443c4a,_0x58edd5){var _0x40ba57={'raw':![],'where':{'id':_0x443c4a['params']['id']}},_0xff5109={};_0xff5109[_0xaa73('0x3c')]=_[_0xaa73('0x38')](db[_0xaa73('0x34')]['rawAttributes']);_0xff5109['query']=_['keys'](_0x443c4a[_0xaa73('0x39')]);_0xff5109['filters']=_['intersection'](_0xff5109[_0xaa73('0x3c')],_0xff5109['query']);_0x40ba57[_0xaa73('0x3a')]=_['intersection'](_0xff5109['model'],qs[_0xaa73('0x3d')](_0x443c4a['query'][_0xaa73('0x3d')]));_0x40ba57[_0xaa73('0x3a')]=_0x40ba57[_0xaa73('0x3a')][_0xaa73('0x3e')]?_0x40ba57['attributes']:_0xff5109[_0xaa73('0x3c')];if(_0x443c4a[_0xaa73('0x39')]['includeAll']){_0x40ba57[_0xaa73('0x51')]=[{'all':!![]}];}_0x40ba57=_[_0xaa73('0x47')]({},_0x40ba57,_0x443c4a[_0xaa73('0x4a')]);return db[_0xaa73('0x34')]['find'](_0x40ba57)[_0xaa73('0x1a')](handleEntityNotFound(_0x58edd5,null))[_0xaa73('0x1a')](respondWithResult(_0x58edd5,null))['catch'](handleError(_0x58edd5,null));};exports['create']=function(_0x33258c,_0x28c65d,_0x3433fc){var _0x2b2fa2;return db[_0xaa73('0x34')][_0xaa73('0x52')](_0x33258c[_0xaa73('0x53')],{'raw':!![]})[_0xaa73('0x1a')](function(_0x512617){_0x2b2fa2=_0x512617;return db[_0xaa73('0x34')][_0xaa73('0x4d')]({'raw':!![]});})[_0xaa73('0x1a')](function(_0x2965ac){var _0x47b46b=fs['readFileSync'](path['join'](config[_0xaa73('0x54')],_0xaa73('0x55')),_0xaa73('0x56'));var _0x2aef71=ejs['render'](_0x47b46b,{'contexts':_0x2965ac||[]});fs[_0xaa73('0x57')](_0xaa73('0x58'),_0x2aef71);})[_0xaa73('0x1a')](function(){return respondWithRpcPromise(_0xaa73('0x59'),'create',{'module':'chan_sip.so'});})[_0xaa73('0x1a')](function(){var _0x314c5e=_0x33258c[_0xaa73('0x5a')][_0xaa73('0x2e')]({'plain':!![]});if(!_0x314c5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x314c5e[_0xaa73('0x5b')]===_0xaa73('0x5a')){var _0x1ba8b8=_0x2b2fa2[_0xaa73('0x2e')]({'plain':!![]});return db[_0xaa73('0x5c')][_0xaa73('0x5d')]({'where':{'name':_0xaa73('0x5e'),'userProfileId':_0x314c5e[_0xaa73('0x5f')]},'raw':!![]})[_0xaa73('0x1a')](function(_0xfbd4a1){if(_0xfbd4a1&&_0xfbd4a1[_0xaa73('0x60')]===0x0){return db[_0xaa73('0x61')][_0xaa73('0x52')]({'name':_0x1ba8b8[_0xaa73('0x30')],'resourceId':_0x1ba8b8['id'],'type':_0xfbd4a1[_0xaa73('0x30')],'sectionId':_0xfbd4a1['id']},{})[_0xaa73('0x1a')](function(){return _0x2b2fa2;});}else{return _0x2b2fa2;}})[_0xaa73('0x4f')](function(_0x4fdebf){logger[_0xaa73('0x1f')](_0xaa73('0x62'),_0x4fdebf);throw _0x4fdebf;});}return _0x2b2fa2;})[_0xaa73('0x1a')](respondWithResult(_0x28c65d,0xc9))['catch'](handleError(_0x28c65d,null));};exports[_0xaa73('0x63')]=function(_0x5e84d5,_0x58c65e,_0x6a7bd6){var _0x545342;return db[_0xaa73('0x34')][_0xaa73('0x5d')]({'where':{'id':_0x5e84d5[_0xaa73('0x64')]['id']}})['then'](handleEntityNotFound(_0x58c65e,null))[_0xaa73('0x1a')](saveUpdates(_0x5e84d5[_0xaa73('0x53')],null))[_0xaa73('0x1a')](function(_0x2f139f){if(_0x2f139f){_0x545342=_0x2f139f;return db[_0xaa73('0x34')][_0xaa73('0x4d')]({'raw':!![]});}})[_0xaa73('0x1a')](function(_0x313cc7){var _0xe0e414=fs[_0xaa73('0x65')](path[_0xaa73('0x66')](config[_0xaa73('0x54')],_0xaa73('0x55')),'utf8');var _0x418d04=ejs[_0xaa73('0x67')](_0xe0e414,{'contexts':_0x313cc7||[]});fs[_0xaa73('0x57')](_0xaa73('0x58'),_0x418d04);})[_0xaa73('0x1a')](function(){return respondWithRpcPromise('Reload',_0xaa73('0x63'),{'module':_0xaa73('0x68')});})[_0xaa73('0x1a')](function(){return _0x545342;})[_0xaa73('0x1a')](respondWithResult(_0x58c65e,null))[_0xaa73('0x4f')](handleError(_0x58c65e,null));};exports['destroy']=function(_0x2237c2,_0x2a54cc,_0x524eb7){var _0x39c12f;return db[_0xaa73('0x34')][_0xaa73('0x5d')]({'where':{'id':_0x2237c2[_0xaa73('0x64')]['id']}})['then'](handleEntityNotFound(_0x2a54cc,null))[_0xaa73('0x1a')](removeEntity(_0x2a54cc,null))[_0xaa73('0x1a')](function(){return db[_0xaa73('0x34')][_0xaa73('0x4d')]({'raw':!![]});})[_0xaa73('0x1a')](function(_0x3c686e){var _0x54b4ad=fs[_0xaa73('0x65')](path[_0xaa73('0x66')](config['root'],'server/files/templates/context.ejs'),_0xaa73('0x56'));var _0x548266=ejs[_0xaa73('0x67')](_0x54b4ad,{'contexts':_0x3c686e});fs[_0xaa73('0x57')](_0xaa73('0x58'),_0x548266);return respondWithRpcPromise('Reload',_0xaa73('0x2d'),{'module':_0xaa73('0x68')});})['catch'](handleError(_0x2a54cc,null));}; \ No newline at end of file +var _0x3d03=['merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','Reload','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','offset','limit','Content-Range','apply','save','update','destroy','get','Contexts','UserProfileResource','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x4057f9,_0x17c5b5){var _0x5552b7=function(_0xeb792f){while(--_0xeb792f){_0x4057f9['push'](_0x4057f9['shift']());}};_0x5552b7(++_0x17c5b5);}(_0x3d03,0xef));var _0x33d0=function(_0x24896c,_0x3d3472){_0x24896c=_0x24896c-0x0;var _0x4dbcf6=_0x3d03[_0x24896c];return _0x4dbcf6;};'use strict';var emlformat=require(_0x33d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33d0('0x1'));var jsonpatch=require(_0x33d0('0x2'));var rp=require('request-promise');var moment=require(_0x33d0('0x3'));var BPromise=require(_0x33d0('0x4'));var Mustache=require(_0x33d0('0x5'));var util=require(_0x33d0('0x6'));var path=require('path');var sox=require(_0x33d0('0x7'));var csv=require(_0x33d0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33d0('0x9'));var _=require('lodash');var squel=require(_0x33d0('0xa'));var crypto=require(_0x33d0('0xb'));var jsforce=require(_0x33d0('0xc'));var deskjs=require(_0x33d0('0xd'));var toCsv=require(_0x33d0('0x8'));var querystring=require(_0x33d0('0xe'));var Papa=require(_0x33d0('0xf'));var Redis=require('ioredis');var authService=require(_0x33d0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x33d0('0x11'));var hardwareService=require(_0x33d0('0x12'));var logger=require('../../config/logger')(_0x33d0('0x13'));var utils=require(_0x33d0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x33d0('0x15'));var db=require(_0x33d0('0x16'))['db'];var jayson=require(_0x33d0('0x17'));var client=jayson[_0x33d0('0x18')][_0x33d0('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4ff992,_0x18a467,_0x50a96c,_0x550761){return new BPromise(function(_0x157d7d,_0xd7e945){var _0x32b929=_0x550761||client;return _0x32b929[_0x33d0('0x1a')](_0x4ff992,_0x50a96c)[_0x33d0('0x1b')](function(_0x29c5ac){logger[_0x33d0('0x1c')](_0x33d0('0x1d'),_0x18a467,'request\x20sent');logger[_0x33d0('0x1e')](_0x33d0('0x1f'),_0x18a467,_0x33d0('0x20'),JSON['stringify'](_0x29c5ac));if(_0x29c5ac[_0x33d0('0x21')]){if(_0x29c5ac[_0x33d0('0x21')][_0x33d0('0x22')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x18a467,_0x29c5ac['error'][_0x33d0('0x23')]);return _0xd7e945(_0x29c5ac[_0x33d0('0x21')][_0x33d0('0x23')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x18a467,_0x29c5ac[_0x33d0('0x21')]['message']);return _0x157d7d(_0x29c5ac[_0x33d0('0x21')][_0x33d0('0x23')]);}else{logger[_0x33d0('0x1c')](_0x33d0('0x1d'),_0x18a467,'request\x20sent');_0x157d7d(_0x29c5ac[_0x33d0('0x24')][_0x33d0('0x23')]);}})[_0x33d0('0x25')](function(_0x5eba8f){logger['error'](_0x33d0('0x1d'),_0x18a467,_0x5eba8f);_0xd7e945(_0x5eba8f);});});}function respondWithStatusCode(_0x3c6225,_0x3759e4){_0x3759e4=_0x3759e4||0xcc;return function(_0x4047c0){if(_0x4047c0){return _0x3c6225[_0x33d0('0x26')](_0x3759e4);}return _0x3c6225[_0x33d0('0x27')](_0x3759e4)[_0x33d0('0x28')]();};}function respondWithResult(_0x1ed1ff,_0x59bf09){_0x59bf09=_0x59bf09||0xc8;return function(_0x13f9c3){if(_0x13f9c3){return _0x1ed1ff[_0x33d0('0x27')](_0x59bf09)[_0x33d0('0x29')](_0x13f9c3);}};}function respondWithFilteredResult(_0x53b92b,_0xf1e2d7){return function(_0x5da337){if(_0x5da337){var _0x175213=typeof _0xf1e2d7['offset']===_0x33d0('0x2a')&&typeof _0xf1e2d7['limit']==='undefined';var _0x4c0893=_0x5da337['count'];var _0x4ffab9=_0x175213?0x0:_0xf1e2d7[_0x33d0('0x2b')];var _0x5a4989=_0x175213?_0x5da337['count']:_0xf1e2d7[_0x33d0('0x2b')]+_0xf1e2d7[_0x33d0('0x2c')];var _0x3459d9;if(_0x5a4989>=_0x4c0893){_0x5a4989=_0x4c0893;_0x3459d9=0xc8;}else{_0x3459d9=0xce;}_0x53b92b['status'](_0x3459d9);return _0x53b92b['set'](_0x33d0('0x2d'),_0x4ffab9+'-'+_0x5a4989+'/'+_0x4c0893)['json'](_0x5da337);}return null;};}function patchUpdates(_0x417442){return function(_0x9d87d3){try{jsonpatch[_0x33d0('0x2e')](_0x9d87d3,_0x417442,!![]);}catch(_0x51235b){return BPromise['reject'](_0x51235b);}return _0x9d87d3[_0x33d0('0x2f')]();};}function saveUpdates(_0x576ac1,_0xc585e1){return function(_0x28ec87){if(_0x28ec87){return _0x28ec87[_0x33d0('0x30')](_0x576ac1)[_0x33d0('0x1b')](function(_0x38ace4){return _0x38ace4;});}return null;};}function removeEntity(_0x155e4d,_0xc46964){return function(_0x27d7f9){if(_0x27d7f9){return _0x27d7f9[_0x33d0('0x31')]()[_0x33d0('0x1b')](function(){var _0x4055ae=_0x27d7f9[_0x33d0('0x32')]({'plain':!![]});var _0x5b3a26=_0x33d0('0x33');return db[_0x33d0('0x34')][_0x33d0('0x31')]({'where':{'type':_0x5b3a26,'resourceId':_0x4055ae['id']}})[_0x33d0('0x1b')](function(){return _0x27d7f9;});})[_0x33d0('0x1b')](function(){_0x155e4d[_0x33d0('0x27')](0xcc)[_0x33d0('0x28')]();});}};}function handleEntityNotFound(_0x2cf9b6,_0x35bfd1){return function(_0x17569f){if(!_0x17569f){_0x2cf9b6['sendStatus'](0x194);}return _0x17569f;};}function handleError(_0x195e82,_0x33927c){_0x33927c=_0x33927c||0x1f4;return function(_0x10c059){logger[_0x33d0('0x21')](_0x10c059['stack']);if(_0x10c059[_0x33d0('0x35')]){delete _0x10c059['name'];}_0x195e82[_0x33d0('0x27')](_0x33927c)[_0x33d0('0x36')](_0x10c059);};}exports['index']=function(_0x48b2be,_0x5cc34e){var _0x1c02fe={},_0x320461={},_0x58c095={'count':0x0,'rows':[]};var _0x1b7416=_[_0x33d0('0x37')](db[_0x33d0('0x38')][_0x33d0('0x39')],function(_0xd615d6){return{'name':_0xd615d6[_0x33d0('0x3a')],'type':_0xd615d6[_0x33d0('0x3b')][_0x33d0('0x3c')]};});_0x320461['model']=_[_0x33d0('0x37')](_0x1b7416,_0x33d0('0x35'));_0x320461[_0x33d0('0x3d')]=_[_0x33d0('0x3e')](_0x48b2be[_0x33d0('0x3d')]);_0x320461[_0x33d0('0x3f')]=_[_0x33d0('0x40')](_0x320461[_0x33d0('0x41')],_0x320461[_0x33d0('0x3d')]);_0x1c02fe[_0x33d0('0x42')]=_[_0x33d0('0x40')](_0x320461[_0x33d0('0x41')],qs[_0x33d0('0x43')](_0x48b2be[_0x33d0('0x3d')]['fields']));_0x1c02fe['attributes']=_0x1c02fe[_0x33d0('0x42')][_0x33d0('0x44')]?_0x1c02fe[_0x33d0('0x42')]:_0x320461[_0x33d0('0x41')];if(!_0x48b2be[_0x33d0('0x3d')][_0x33d0('0x45')](_0x33d0('0x46'))){_0x1c02fe[_0x33d0('0x2c')]=qs[_0x33d0('0x2c')](_0x48b2be[_0x33d0('0x3d')][_0x33d0('0x2c')]);_0x1c02fe[_0x33d0('0x2b')]=qs[_0x33d0('0x2b')](_0x48b2be['query']['offset']);}_0x1c02fe[_0x33d0('0x47')]=qs[_0x33d0('0x48')](_0x48b2be['query'][_0x33d0('0x48')]);_0x1c02fe[_0x33d0('0x49')]=qs[_0x33d0('0x3f')](_[_0x33d0('0x4a')](_0x48b2be['query'],_0x320461[_0x33d0('0x3f')]),_0x1b7416);if(_0x48b2be[_0x33d0('0x3d')][_0x33d0('0x4b')]){_0x1c02fe[_0x33d0('0x49')]=_[_0x33d0('0x4c')](_0x1c02fe[_0x33d0('0x49')],{'$or':_[_0x33d0('0x37')](_0x1b7416,function(_0x43556e){if(_0x43556e[_0x33d0('0x3b')]!==_0x33d0('0x4d')){var _0x1382b0={};_0x1382b0[_0x43556e[_0x33d0('0x35')]]={'$like':'%'+_0x48b2be[_0x33d0('0x3d')][_0x33d0('0x4b')]+'%'};return _0x1382b0;}})});}_0x1c02fe=_[_0x33d0('0x4c')]({},_0x1c02fe,_0x48b2be['options']);var _0x5caa5d={'where':_0x1c02fe[_0x33d0('0x49')]};return db[_0x33d0('0x38')][_0x33d0('0x4e')](_0x5caa5d)[_0x33d0('0x1b')](function(_0x2f2ef8){_0x58c095[_0x33d0('0x4e')]=_0x2f2ef8;if(_0x48b2be[_0x33d0('0x3d')][_0x33d0('0x4f')]){_0x1c02fe[_0x33d0('0x50')]=[{'all':!![]}];}return db[_0x33d0('0x38')][_0x33d0('0x51')](_0x1c02fe);})[_0x33d0('0x1b')](function(_0x3512d3){_0x58c095[_0x33d0('0x52')]=_0x3512d3;return _0x58c095;})[_0x33d0('0x1b')](respondWithFilteredResult(_0x5cc34e,_0x1c02fe))[_0x33d0('0x25')](handleError(_0x5cc34e,null));};exports[_0x33d0('0x53')]=function(_0x347e1,_0x4ec193){var _0x6f791f={'raw':![],'where':{'id':_0x347e1[_0x33d0('0x54')]['id']}},_0x4d3427={};_0x4d3427['model']=_['keys'](db[_0x33d0('0x38')][_0x33d0('0x39')]);_0x4d3427[_0x33d0('0x3d')]=_[_0x33d0('0x3e')](_0x347e1[_0x33d0('0x3d')]);_0x4d3427[_0x33d0('0x3f')]=_[_0x33d0('0x40')](_0x4d3427[_0x33d0('0x41')],_0x4d3427[_0x33d0('0x3d')]);_0x6f791f['attributes']=_[_0x33d0('0x40')](_0x4d3427[_0x33d0('0x41')],qs[_0x33d0('0x43')](_0x347e1[_0x33d0('0x3d')][_0x33d0('0x43')]));_0x6f791f[_0x33d0('0x42')]=_0x6f791f[_0x33d0('0x42')][_0x33d0('0x44')]?_0x6f791f[_0x33d0('0x42')]:_0x4d3427['model'];if(_0x347e1[_0x33d0('0x3d')][_0x33d0('0x4f')]){_0x6f791f['include']=[{'all':!![]}];}_0x6f791f=_[_0x33d0('0x4c')]({},_0x6f791f,_0x347e1[_0x33d0('0x55')]);return db[_0x33d0('0x38')][_0x33d0('0x56')](_0x6f791f)['then'](handleEntityNotFound(_0x4ec193,null))[_0x33d0('0x1b')](respondWithResult(_0x4ec193,null))[_0x33d0('0x25')](handleError(_0x4ec193,null));};exports[_0x33d0('0x57')]=function(_0x2b2d1a,_0x162fd2,_0x2b94c5){var _0x119b9d;return db[_0x33d0('0x38')]['create'](_0x2b2d1a[_0x33d0('0x58')],{'raw':!![]})[_0x33d0('0x1b')](function(_0x215eb7){_0x119b9d=_0x215eb7;return db[_0x33d0('0x38')][_0x33d0('0x51')]({'raw':!![]});})[_0x33d0('0x1b')](function(_0x941a6e){var _0x50cf25=fs[_0x33d0('0x59')](path[_0x33d0('0x5a')](config[_0x33d0('0x5b')],_0x33d0('0x5c')),'utf8');var _0x238fc2=ejs[_0x33d0('0x5d')](_0x50cf25,{'contexts':_0x941a6e||[]});fs[_0x33d0('0x5e')](_0x33d0('0x5f'),_0x238fc2);})[_0x33d0('0x1b')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x33d0('0x60')});})[_0x33d0('0x1b')](function(){var _0x18e2e8=_0x2b2d1a[_0x33d0('0x61')][_0x33d0('0x32')]({'plain':!![]});if(!_0x18e2e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18e2e8[_0x33d0('0x62')]==='user'){var _0x23f847=_0x119b9d[_0x33d0('0x32')]({'plain':!![]});return db[_0x33d0('0x63')][_0x33d0('0x56')]({'where':{'name':_0x33d0('0x33'),'userProfileId':_0x18e2e8[_0x33d0('0x64')]},'raw':!![]})[_0x33d0('0x1b')](function(_0x32e1a8){if(_0x32e1a8&&_0x32e1a8[_0x33d0('0x65')]===0x0){return db[_0x33d0('0x34')][_0x33d0('0x57')]({'name':_0x23f847[_0x33d0('0x35')],'resourceId':_0x23f847['id'],'type':_0x32e1a8[_0x33d0('0x35')],'sectionId':_0x32e1a8['id']},{})[_0x33d0('0x1b')](function(){return _0x119b9d;});}else{return _0x119b9d;}})[_0x33d0('0x25')](function(_0xa94c){logger[_0x33d0('0x21')](_0x33d0('0x66'),_0xa94c);throw _0xa94c;});}return _0x119b9d;})[_0x33d0('0x1b')](respondWithResult(_0x162fd2,0xc9))[_0x33d0('0x25')](handleError(_0x162fd2,null));};exports[_0x33d0('0x30')]=function(_0x53a1a4,_0xd78a90,_0x5765c7){var _0x3adc61;return db[_0x33d0('0x38')][_0x33d0('0x56')]({'where':{'id':_0x53a1a4[_0x33d0('0x54')]['id']}})[_0x33d0('0x1b')](handleEntityNotFound(_0xd78a90,null))['then'](saveUpdates(_0x53a1a4[_0x33d0('0x58')],null))[_0x33d0('0x1b')](function(_0x31f01a){if(_0x31f01a){_0x3adc61=_0x31f01a;return db[_0x33d0('0x38')][_0x33d0('0x51')]({'raw':!![]});}})['then'](function(_0x264fbf){var _0x3c2cfb=fs[_0x33d0('0x59')](path[_0x33d0('0x5a')](config['root'],_0x33d0('0x5c')),_0x33d0('0x67'));var _0x331eb5=ejs[_0x33d0('0x5d')](_0x3c2cfb,{'contexts':_0x264fbf||[]});fs['writeFileSync'](_0x33d0('0x5f'),_0x331eb5);})['then'](function(){return respondWithRpcPromise('Reload',_0x33d0('0x30'),{'module':'chan_sip.so'});})[_0x33d0('0x1b')](function(){return _0x3adc61;})[_0x33d0('0x1b')](respondWithResult(_0xd78a90,null))[_0x33d0('0x25')](handleError(_0xd78a90,null));};exports[_0x33d0('0x31')]=function(_0x2f0e8b,_0x4d6541,_0x437bdc){var _0x332446;return db[_0x33d0('0x38')][_0x33d0('0x56')]({'where':{'id':_0x2f0e8b['params']['id']}})[_0x33d0('0x1b')](handleEntityNotFound(_0x4d6541,null))[_0x33d0('0x1b')](removeEntity(_0x4d6541,null))[_0x33d0('0x1b')](function(){return db[_0x33d0('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1413c5){var _0x612358=fs[_0x33d0('0x59')](path[_0x33d0('0x5a')](config[_0x33d0('0x5b')],_0x33d0('0x5c')),'utf8');var _0x5f383d=ejs[_0x33d0('0x5d')](_0x612358,{'contexts':_0x1413c5});fs['writeFileSync'](_0x33d0('0x5f'),_0x5f383d);return respondWithRpcPromise(_0x33d0('0x68'),_0x33d0('0x31'),{'module':_0x33d0('0x60')});})['catch'](handleError(_0x4d6541,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index aa9455d..69042ab 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 _0x3264=['voice_contexts','util','../../config/logger','api','moment','path','./voiceContext.attributes','exports','VoiceContext'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x3264,0x7f));var _0x4326=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3264[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var logger=require(_0x4326('0x1'))(_0x4326('0x2'));var moment=require(_0x4326('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4326('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4326('0x5'));module[_0x4326('0x6')]=function(_0xed0465,_0x3f8d4e){return _0xed0465['define'](_0x4326('0x7'),attributes,{'tableName':_0x4326('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa02b=['../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1523b6,_0x30d0ba){var _0x3f5ead=function(_0x26e9a3){while(--_0x26e9a3){_0x1523b6['push'](_0x1523b6['shift']());}};_0x3f5ead(++_0x30d0ba);}(_0xa02b,0xd5));var _0xba02=function(_0x9be62c,_0x4eb64d){_0x9be62c=_0x9be62c-0x0;var _0x969a49=_0xa02b[_0x9be62c];return _0x969a49;};'use strict';var _=require(_0xba02('0x0'));var util=require('util');var logger=require(_0xba02('0x1'))(_0xba02('0x2'));var moment=require(_0xba02('0x3'));var BPromise=require(_0xba02('0x4'));var rp=require(_0xba02('0x5'));var fs=require('fs');var path=require(_0xba02('0x6'));var rimraf=require(_0xba02('0x7'));var config=require(_0xba02('0x8'));var attributes=require(_0xba02('0x9'));module['exports']=function(_0x3c2749,_0x27ebc5){return _0x3c2749[_0xba02('0xa')](_0xba02('0xb'),attributes,{'tableName':_0xba02('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 0f7b47a..e7919b4 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 _0xdca3=['code','message','VoiceContext,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e457c,_0x407259){var _0x3d07e6=function(_0x246a41){while(--_0x246a41){_0x1e457c['push'](_0x1e457c['shift']());}};_0x3d07e6(++_0x407259);}(_0xdca3,0x64));var _0x3dca=function(_0x3de558,_0x428d3a){_0x3de558=_0x3de558-0x0;var _0x18a2cc=_0xdca3[_0x3de558];return _0x18a2cc;};'use strict';var _=require(_0x3dca('0x0'));var util=require('util');var moment=require(_0x3dca('0x1'));var BPromise=require(_0x3dca('0x2'));var rs=require(_0x3dca('0x3'));var fs=require('fs');var Redis=require(_0x3dca('0x4'));var db=require(_0x3dca('0x5'))['db'];var utils=require(_0x3dca('0x6'));var logger=require(_0x3dca('0x7'))(_0x3dca('0x8'));var config=require(_0x3dca('0x9'));var jayson=require(_0x3dca('0xa'));var client=jayson[_0x3dca('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4234a1,_0x5d52c3,_0x57264a){return new BPromise(function(_0xdea879,_0x576218){return client[_0x3dca('0xc')](_0x4234a1,_0x57264a)[_0x3dca('0xd')](function(_0x123b66){logger[_0x3dca('0xe')]('VoiceContext,\x20%s,\x20%s',_0x5d52c3,_0x3dca('0xf'));logger[_0x3dca('0x10')](_0x3dca('0x11'),_0x5d52c3,_0x3dca('0xf'),JSON[_0x3dca('0x12')](_0x123b66));if(_0x123b66[_0x3dca('0x13')]){if(_0x123b66['error'][_0x3dca('0x14')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x5d52c3,_0x123b66[_0x3dca('0x13')][_0x3dca('0x15')]);return _0x576218(_0x123b66[_0x3dca('0x13')][_0x3dca('0x15')]);}logger[_0x3dca('0x13')](_0x3dca('0x16'),_0x5d52c3,_0x123b66[_0x3dca('0x13')][_0x3dca('0x15')]);return _0xdea879(_0x123b66[_0x3dca('0x13')][_0x3dca('0x15')]);}else{logger[_0x3dca('0xe')](_0x3dca('0x16'),_0x5d52c3,_0x3dca('0xf'));_0xdea879(_0x123b66['result']['message']);}})[_0x3dca('0x17')](function(_0xb5b508){logger[_0x3dca('0x13')](_0x3dca('0x16'),_0x5d52c3,_0xb5b508);_0x576218(_0xb5b508);});});} \ No newline at end of file +var _0xb8c3=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4c5c22,_0x41c92e){var _0x176952=function(_0x28f615){while(--_0x28f615){_0x4c5c22['push'](_0x4c5c22['shift']());}};_0x176952(++_0x41c92e);}(_0xb8c3,0x9d));var _0x3b8c=function(_0x32ef2a,_0x11d483){_0x32ef2a=_0x32ef2a-0x0;var _0x7e3556=_0xb8c3[_0x32ef2a];return _0x7e3556;};'use strict';var _=require(_0x3b8c('0x0'));var util=require(_0x3b8c('0x1'));var moment=require(_0x3b8c('0x2'));var BPromise=require(_0x3b8c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b8c('0x4'));var db=require(_0x3b8c('0x5'))['db'];var utils=require(_0x3b8c('0x6'));var logger=require(_0x3b8c('0x7'))(_0x3b8c('0x8'));var config=require(_0x3b8c('0x9'));var jayson=require(_0x3b8c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48f946,_0x52e4e9,_0x503953){return new BPromise(function(_0x58c96f,_0x57f7b3){return client[_0x3b8c('0xb')](_0x48f946,_0x503953)['then'](function(_0x163eec){logger[_0x3b8c('0xc')](_0x3b8c('0xd'),_0x52e4e9,_0x3b8c('0xe'));logger['debug'](_0x3b8c('0xf'),_0x52e4e9,'request\x20sent',JSON[_0x3b8c('0x10')](_0x163eec));if(_0x163eec['error']){if(_0x163eec[_0x3b8c('0x11')][_0x3b8c('0x12')]===0x1f4){logger['error'](_0x3b8c('0xd'),_0x52e4e9,_0x163eec[_0x3b8c('0x11')][_0x3b8c('0x13')]);return _0x57f7b3(_0x163eec[_0x3b8c('0x11')][_0x3b8c('0x13')]);}logger[_0x3b8c('0x11')](_0x3b8c('0xd'),_0x52e4e9,_0x163eec['error'][_0x3b8c('0x13')]);return _0x58c96f(_0x163eec['error'][_0x3b8c('0x13')]);}else{logger[_0x3b8c('0xc')]('VoiceContext,\x20%s,\x20%s',_0x52e4e9,_0x3b8c('0xe'));_0x58c96f(_0x163eec[_0x3b8c('0x14')]['message']);}})[_0x3b8c('0x15')](function(_0x3c319f){logger[_0x3b8c('0x11')]('VoiceContext,\x20%s,\x20%s',_0x52e4e9,_0x3c319f);_0x57f7b3(_0x3c319f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b1a34ba..8eafcb0 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 _0xda65=['/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xda65,0x1d0));var _0x5da6=function(_0x487aa0,_0x116e9a){_0x487aa0=_0x487aa0-0x0;var _0x14f931=_0xda65[_0x487aa0];return _0x14f931;};'use strict';var multer=require(_0x5da6('0x0'));var util=require(_0x5da6('0x1'));var path=require(_0x5da6('0x2'));var timeout=require('connect-timeout');var express=require(_0x5da6('0x3'));var router=express[_0x5da6('0x4')]();var fs_extra=require(_0x5da6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5da6('0x6'));var controller=require(_0x5da6('0x7'));router[_0x5da6('0x8')]('/',auth[_0x5da6('0x9')](),controller[_0x5da6('0xa')]);router['get'](_0x5da6('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x5da6('0x8')]('/:id',auth[_0x5da6('0x9')](),controller[_0x5da6('0xc')]);router[_0x5da6('0xd')]('/',auth[_0x5da6('0x9')](),controller[_0x5da6('0xe')]);router[_0x5da6('0xf')](_0x5da6('0x10'),auth[_0x5da6('0x9')](),controller['update']);router[_0x5da6('0x11')](_0x5da6('0x10'),auth[_0x5da6('0x9')](),controller[_0x5da6('0x12')]);module[_0x5da6('0x13')]=router; \ No newline at end of file +var _0x6e5d=['exports','multer','util','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update'];(function(_0x5efbd0,_0x299553){var _0x475ec9=function(_0x3752ec){while(--_0x3752ec){_0x5efbd0['push'](_0x5efbd0['shift']());}};_0x475ec9(++_0x299553);}(_0x6e5d,0x9a));var _0xd6e5=function(_0x21928f,_0x486777){_0x21928f=_0x21928f-0x0;var _0x13583c=_0x6e5d[_0x21928f];return _0x13583c;};'use strict';var multer=require(_0xd6e5('0x0'));var util=require(_0xd6e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd6e5('0x2'));var router=express[_0xd6e5('0x3')]();var fs_extra=require(_0xd6e5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd6e5('0x5'));var controller=require(_0xd6e5('0x6'));router[_0xd6e5('0x7')]('/',auth[_0xd6e5('0x8')](),controller[_0xd6e5('0x9')]);router[_0xd6e5('0x7')]('/describe',auth[_0xd6e5('0x8')](),controller[_0xd6e5('0xa')]);router[_0xd6e5('0x7')](_0xd6e5('0xb'),auth[_0xd6e5('0x8')](),controller[_0xd6e5('0xc')]);router[_0xd6e5('0xd')]('/',auth[_0xd6e5('0x8')](),controller[_0xd6e5('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd6e5('0xf')]);router['delete'](_0xd6e5('0xb'),auth[_0xd6e5('0x8')](),controller['destroy']);module[_0xd6e5('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8e5ce39..25254e2 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 _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x27ece,_0x5dd680){var _0x33320a=function(_0x54a088){while(--_0x54a088){_0x27ece['push'](_0x27ece['shift']());}};_0x33320a(++_0x5dd680);}(_0x425d,0x1e0));var _0xd425=function(_0x1a42bc,_0x34a88c){_0x1a42bc=_0x1a42bc-0x0;var _0x33fd2b=_0x425d[_0x1a42bc];return _0x33fd2b;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x27c46a,_0x5a02b0){var _0x21513b=function(_0x5d7ef8){while(--_0x5d7ef8){_0x27c46a['push'](_0x27c46a['shift']());}};_0x21513b(++_0x5a02b0);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x32d330,_0xe907c8){_0x32d330=_0x32d330-0x0;var _0xe81a43=_0xf3cd[_0x32d330];return _0xe81a43;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5d584ee..924d0ee 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 _0xc73a=['../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2f7636,_0x3c7201){var _0x226919=function(_0x32ca70){while(--_0x32ca70){_0x2f7636['push'](_0x2f7636['shift']());}};_0x226919(++_0x3c7201);}(_0xc73a,0x7f));var _0xac73=function(_0x41aefa,_0x5eed6f){_0x41aefa=_0x41aefa-0x0;var _0x3aa2c7=_0xc73a[_0x41aefa];return _0x3aa2c7;};'use strict';var emlformat=require(_0xac73('0x0'));var rimraf=require(_0xac73('0x1'));var zipdir=require(_0xac73('0x2'));var jsonpatch=require(_0xac73('0x3'));var rp=require(_0xac73('0x4'));var moment=require(_0xac73('0x5'));var BPromise=require(_0xac73('0x6'));var Mustache=require(_0xac73('0x7'));var util=require(_0xac73('0x8'));var path=require('path');var sox=require(_0xac73('0x9'));var csv=require(_0xac73('0xa'));var ejs=require(_0xac73('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac73('0xc'));var squel=require('squel');var crypto=require(_0xac73('0xd'));var jsforce=require(_0xac73('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xac73('0xa'));var querystring=require(_0xac73('0xf'));var Papa=require(_0xac73('0x10'));var Redis=require(_0xac73('0x11'));var authService=require(_0xac73('0x12'));var qs=require(_0xac73('0x13'));var as=require(_0xac73('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac73('0x15'))(_0xac73('0x16'));var utils=require(_0xac73('0x17'));var config=require(_0xac73('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xac73('0x19'))['db'];function respondWithStatusCode(_0x40a605,_0x2cdd15){_0x2cdd15=_0x2cdd15||0xcc;return function(_0x456f98){if(_0x456f98){return _0x40a605['sendStatus'](_0x2cdd15);}return _0x40a605['status'](_0x2cdd15)[_0xac73('0x1a')]();};}function respondWithResult(_0x2b4345,_0x569f6d){_0x569f6d=_0x569f6d||0xc8;return function(_0x4723a1){if(_0x4723a1){return _0x2b4345[_0xac73('0x1b')](_0x569f6d)[_0xac73('0x1c')](_0x4723a1);}};}function respondWithFilteredResult(_0x68fabe,_0x198b2c){return function(_0x2d5bb7){if(_0x2d5bb7){var _0x3ee3f7=typeof _0x198b2c[_0xac73('0x1d')]===_0xac73('0x1e')&&typeof _0x198b2c[_0xac73('0x1f')]==='undefined';var _0x374f05=_0x2d5bb7[_0xac73('0x20')];var _0x254b7d=_0x3ee3f7?0x0:_0x198b2c[_0xac73('0x1d')];var _0xa9346c=_0x3ee3f7?_0x2d5bb7[_0xac73('0x20')]:_0x198b2c[_0xac73('0x1d')]+_0x198b2c[_0xac73('0x1f')];var _0x522025;if(_0xa9346c>=_0x374f05){_0xa9346c=_0x374f05;_0x522025=0xc8;}else{_0x522025=0xce;}_0x68fabe['status'](_0x522025);return _0x68fabe[_0xac73('0x21')](_0xac73('0x22'),_0x254b7d+'-'+_0xa9346c+'/'+_0x374f05)[_0xac73('0x1c')](_0x2d5bb7);}return null;};}function patchUpdates(_0x575159){return function(_0x4f905e){try{jsonpatch[_0xac73('0x23')](_0x4f905e,_0x575159,!![]);}catch(_0x28d935){return BPromise[_0xac73('0x24')](_0x28d935);}return _0x4f905e['save']();};}function saveUpdates(_0x3e1008,_0x33a326){return function(_0x56aab0){if(_0x56aab0){return _0x56aab0[_0xac73('0x25')](_0x3e1008)['then'](function(_0x4c0f38){return _0x4c0f38;});}return null;};}function removeEntity(_0x109b67,_0x3f900f){return function(_0x29b294){if(_0x29b294){return _0x29b294[_0xac73('0x26')]()[_0xac73('0x27')](function(){_0x109b67['status'](0xcc)[_0xac73('0x1a')]();});}};}function handleEntityNotFound(_0x346e7c,_0x26854b){return function(_0x1fc4a6){if(!_0x1fc4a6){_0x346e7c['sendStatus'](0x194);}return _0x1fc4a6;};}function handleError(_0x18806e,_0x208ed4){_0x208ed4=_0x208ed4||0x1f4;return function(_0x735ca7){logger[_0xac73('0x28')](_0x735ca7[_0xac73('0x29')]);if(_0x735ca7[_0xac73('0x2a')]){delete _0x735ca7[_0xac73('0x2a')];}_0x18806e[_0xac73('0x1b')](_0x208ed4)[_0xac73('0x2b')](_0x735ca7);};}exports[_0xac73('0x2c')]=function(_0xdc608a,_0x2bb8ec){var _0x4b18dc={},_0x47b3d7={},_0x5680bf={'count':0x0,'rows':[]};var _0x4cbb8d=_[_0xac73('0x2d')](db[_0xac73('0x2e')][_0xac73('0x2f')],function(_0x1ac1a8){return{'name':_0x1ac1a8[_0xac73('0x30')],'type':_0x1ac1a8['type']['key']};});_0x47b3d7[_0xac73('0x31')]=_[_0xac73('0x2d')](_0x4cbb8d,_0xac73('0x2a'));_0x47b3d7[_0xac73('0x32')]=_[_0xac73('0x33')](_0xdc608a[_0xac73('0x32')]);_0x47b3d7[_0xac73('0x34')]=_[_0xac73('0x35')](_0x47b3d7[_0xac73('0x31')],_0x47b3d7['query']);_0x4b18dc[_0xac73('0x36')]=_['intersection'](_0x47b3d7['model'],qs[_0xac73('0x37')](_0xdc608a['query']['fields']));_0x4b18dc[_0xac73('0x36')]=_0x4b18dc['attributes'][_0xac73('0x38')]?_0x4b18dc[_0xac73('0x36')]:_0x47b3d7[_0xac73('0x31')];if(!_0xdc608a['query']['hasOwnProperty'](_0xac73('0x39'))){_0x4b18dc['limit']=qs[_0xac73('0x1f')](_0xdc608a[_0xac73('0x32')]['limit']);_0x4b18dc['offset']=qs['offset'](_0xdc608a['query'][_0xac73('0x1d')]);}_0x4b18dc[_0xac73('0x3a')]=qs[_0xac73('0x3b')](_0xdc608a[_0xac73('0x32')]['sort']);_0x4b18dc[_0xac73('0x3c')]=qs[_0xac73('0x34')](_[_0xac73('0x3d')](_0xdc608a[_0xac73('0x32')],_0x47b3d7[_0xac73('0x34')]),_0x4cbb8d);if(_0xdc608a[_0xac73('0x32')][_0xac73('0x3e')]){_0x4b18dc[_0xac73('0x3c')]=_['merge'](_0x4b18dc[_0xac73('0x3c')],{'$or':_['map'](_0x4cbb8d,function(_0x5dcb92){if(_0x5dcb92[_0xac73('0x3f')]!==_0xac73('0x40')){var _0x1cd25b={};_0x1cd25b[_0x5dcb92[_0xac73('0x2a')]]={'$like':'%'+_0xdc608a[_0xac73('0x32')]['filter']+'%'};return _0x1cd25b;}})});}_0x4b18dc=_[_0xac73('0x41')]({},_0x4b18dc,_0xdc608a[_0xac73('0x42')]);var _0x3e0845={'where':_0x4b18dc[_0xac73('0x3c')]};return db[_0xac73('0x2e')][_0xac73('0x20')](_0x3e0845)[_0xac73('0x27')](function(_0x37b248){_0x5680bf[_0xac73('0x20')]=_0x37b248;if(_0xdc608a[_0xac73('0x32')][_0xac73('0x43')]){_0x4b18dc['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x4b18dc);})[_0xac73('0x27')](function(_0x4338f1){_0x5680bf[_0xac73('0x44')]=_0x4338f1;return _0x5680bf;})[_0xac73('0x27')](respondWithFilteredResult(_0x2bb8ec,_0x4b18dc))[_0xac73('0x45')](handleError(_0x2bb8ec,null));};exports[_0xac73('0x46')]=function(_0x10c270,_0x5ebbaa){var _0x3e52ac={'raw':!![],'where':{'id':_0x10c270[_0xac73('0x47')]['id']}},_0x55b0fc={};_0x55b0fc[_0xac73('0x31')]=_['keys'](db[_0xac73('0x2e')][_0xac73('0x2f')]);_0x55b0fc['query']=_[_0xac73('0x33')](_0x10c270[_0xac73('0x32')]);_0x55b0fc[_0xac73('0x34')]=_[_0xac73('0x35')](_0x55b0fc[_0xac73('0x31')],_0x55b0fc[_0xac73('0x32')]);_0x3e52ac[_0xac73('0x36')]=_[_0xac73('0x35')](_0x55b0fc[_0xac73('0x31')],qs[_0xac73('0x37')](_0x10c270[_0xac73('0x32')][_0xac73('0x37')]));_0x3e52ac[_0xac73('0x36')]=_0x3e52ac[_0xac73('0x36')][_0xac73('0x38')]?_0x3e52ac[_0xac73('0x36')]:_0x55b0fc[_0xac73('0x31')];if(_0x10c270[_0xac73('0x32')][_0xac73('0x43')]){_0x3e52ac['include']=[{'all':!![]}];}_0x3e52ac=_[_0xac73('0x41')]({},_0x3e52ac,_0x10c270['options']);return db['VoiceDialReport']['find'](_0x3e52ac)['then'](handleEntityNotFound(_0x5ebbaa,null))[_0xac73('0x27')](respondWithResult(_0x5ebbaa,null))[_0xac73('0x45')](handleError(_0x5ebbaa,null));};exports[_0xac73('0x48')]=function(_0x5046d6,_0x228be2){return db['VoiceDialReport'][_0xac73('0x48')](_0x5046d6[_0xac73('0x49')],{})[_0xac73('0x27')](respondWithResult(_0x228be2,0xc9))[_0xac73('0x45')](handleError(_0x228be2,null));};exports[_0xac73('0x25')]=function(_0xcbfad8,_0xdce454){if(_0xcbfad8[_0xac73('0x49')]['id']){delete _0xcbfad8[_0xac73('0x49')]['id'];}return db['VoiceDialReport'][_0xac73('0x4a')]({'where':{'id':_0xcbfad8[_0xac73('0x47')]['id']}})['then'](handleEntityNotFound(_0xdce454,null))['then'](saveUpdates(_0xcbfad8[_0xac73('0x49')],null))['then'](respondWithResult(_0xdce454,null))[_0xac73('0x45')](handleError(_0xdce454,null));};exports['destroy']=function(_0x1fac28,_0x2fca53){return db[_0xac73('0x2e')][_0xac73('0x4a')]({'where':{'id':_0x1fac28[_0xac73('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fca53,null))[_0xac73('0x27')](removeEntity(_0x2fca53,null))[_0xac73('0x45')](handleError(_0x2fca53,null));};exports[_0xac73('0x4b')]=function(_0x4ddf13,_0x55a535){return db[_0xac73('0x2e')][_0xac73('0x4b')]()[_0xac73('0x27')](respondWithResult(_0x55a535,null))['catch'](handleError(_0x55a535,null));}; \ No newline at end of file +var _0xef3e=['where','pick','filter','merge','type','options','VoiceDialReport','include','findAll','rows','show','params','includeAll','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x19b50e,_0x481072){var _0x29a4fa=function(_0x915d99){while(--_0x915d99){_0x19b50e['push'](_0x19b50e['shift']());}};_0x29a4fa(++_0x481072);}(_0xef3e,0x152));var _0xeef3=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xef3e[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0xeef3('0x0'));var rimraf=require(_0xeef3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeef3('0x2'));var rp=require(_0xeef3('0x3'));var moment=require(_0xeef3('0x4'));var BPromise=require(_0xeef3('0x5'));var Mustache=require(_0xeef3('0x6'));var util=require(_0xeef3('0x7'));var path=require(_0xeef3('0x8'));var sox=require(_0xeef3('0x9'));var csv=require(_0xeef3('0xa'));var ejs=require(_0xeef3('0xb'));var fs=require('fs');var fs_extra=require(_0xeef3('0xc'));var _=require(_0xeef3('0xd'));var squel=require(_0xeef3('0xe'));var crypto=require(_0xeef3('0xf'));var jsforce=require(_0xeef3('0x10'));var deskjs=require(_0xeef3('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeef3('0x12'));var Redis=require('ioredis');var authService=require(_0xeef3('0x13'));var qs=require(_0xeef3('0x14'));var as=require(_0xeef3('0x15'));var hardwareService=require(_0xeef3('0x16'));var logger=require(_0xeef3('0x17'))(_0xeef3('0x18'));var utils=require('../../config/utils');var config=require(_0xeef3('0x19'));var licenseUtil=require(_0xeef3('0x1a'));var db=require(_0xeef3('0x1b'))['db'];function respondWithStatusCode(_0x1cddfa,_0x4d8e9e){_0x4d8e9e=_0x4d8e9e||0xcc;return function(_0x43480d){if(_0x43480d){return _0x1cddfa[_0xeef3('0x1c')](_0x4d8e9e);}return _0x1cddfa[_0xeef3('0x1d')](_0x4d8e9e)[_0xeef3('0x1e')]();};}function respondWithResult(_0x2f9c67,_0x4d27c4){_0x4d27c4=_0x4d27c4||0xc8;return function(_0x173553){if(_0x173553){return _0x2f9c67['status'](_0x4d27c4)[_0xeef3('0x1f')](_0x173553);}};}function respondWithFilteredResult(_0x22136d,_0x141b4d){return function(_0x3eb1e3){if(_0x3eb1e3){var _0x32e8c4=typeof _0x141b4d[_0xeef3('0x20')]===_0xeef3('0x21')&&typeof _0x141b4d['limit']===_0xeef3('0x21');var _0x1c1869=_0x3eb1e3[_0xeef3('0x22')];var _0xf47100=_0x32e8c4?0x0:_0x141b4d[_0xeef3('0x20')];var _0x2bb454=_0x32e8c4?_0x3eb1e3[_0xeef3('0x22')]:_0x141b4d[_0xeef3('0x20')]+_0x141b4d[_0xeef3('0x23')];var _0x5bbd09;if(_0x2bb454>=_0x1c1869){_0x2bb454=_0x1c1869;_0x5bbd09=0xc8;}else{_0x5bbd09=0xce;}_0x22136d[_0xeef3('0x1d')](_0x5bbd09);return _0x22136d[_0xeef3('0x24')]('Content-Range',_0xf47100+'-'+_0x2bb454+'/'+_0x1c1869)[_0xeef3('0x1f')](_0x3eb1e3);}return null;};}function patchUpdates(_0x3b5ecc){return function(_0x267584){try{jsonpatch[_0xeef3('0x25')](_0x267584,_0x3b5ecc,!![]);}catch(_0x1f9fdb){return BPromise[_0xeef3('0x26')](_0x1f9fdb);}return _0x267584[_0xeef3('0x27')]();};}function saveUpdates(_0x220974,_0x2e7026){return function(_0x57e505){if(_0x57e505){return _0x57e505[_0xeef3('0x28')](_0x220974)[_0xeef3('0x29')](function(_0x128fa9){return _0x128fa9;});}return null;};}function removeEntity(_0x2f206c,_0x3bc275){return function(_0x27ea9f){if(_0x27ea9f){return _0x27ea9f['destroy']()[_0xeef3('0x29')](function(){_0x2f206c[_0xeef3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15d34c,_0x2648a8){return function(_0x573461){if(!_0x573461){_0x15d34c[_0xeef3('0x1c')](0x194);}return _0x573461;};}function handleError(_0x3bda90,_0x1c3102){_0x1c3102=_0x1c3102||0x1f4;return function(_0x3bccc8){logger[_0xeef3('0x2a')](_0x3bccc8[_0xeef3('0x2b')]);if(_0x3bccc8['name']){delete _0x3bccc8[_0xeef3('0x2c')];}_0x3bda90[_0xeef3('0x1d')](_0x1c3102)[_0xeef3('0x2d')](_0x3bccc8);};}exports[_0xeef3('0x2e')]=function(_0x4fc9b3,_0x32629a){var _0x28ed5b={},_0x3421ee={},_0x3e322b={'count':0x0,'rows':[]};var _0x5f4ebf=_[_0xeef3('0x2f')](db['VoiceDialReport']['rawAttributes'],function(_0x3c91f2){return{'name':_0x3c91f2[_0xeef3('0x30')],'type':_0x3c91f2['type'][_0xeef3('0x31')]};});_0x3421ee[_0xeef3('0x32')]=_[_0xeef3('0x2f')](_0x5f4ebf,_0xeef3('0x2c'));_0x3421ee[_0xeef3('0x33')]=_[_0xeef3('0x34')](_0x4fc9b3[_0xeef3('0x33')]);_0x3421ee[_0xeef3('0x35')]=_['intersection'](_0x3421ee[_0xeef3('0x32')],_0x3421ee[_0xeef3('0x33')]);_0x28ed5b['attributes']=_[_0xeef3('0x36')](_0x3421ee[_0xeef3('0x32')],qs[_0xeef3('0x37')](_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x37')]));_0x28ed5b[_0xeef3('0x38')]=_0x28ed5b[_0xeef3('0x38')][_0xeef3('0x39')]?_0x28ed5b[_0xeef3('0x38')]:_0x3421ee[_0xeef3('0x32')];if(!_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x3a')](_0xeef3('0x3b'))){_0x28ed5b[_0xeef3('0x23')]=qs[_0xeef3('0x23')](_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x23')]);_0x28ed5b[_0xeef3('0x20')]=qs[_0xeef3('0x20')](_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x20')]);}_0x28ed5b[_0xeef3('0x3c')]=qs['sort'](_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x3d')]);_0x28ed5b[_0xeef3('0x3e')]=qs[_0xeef3('0x35')](_[_0xeef3('0x3f')](_0x4fc9b3[_0xeef3('0x33')],_0x3421ee['filters']),_0x5f4ebf);if(_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x40')]){_0x28ed5b[_0xeef3('0x3e')]=_[_0xeef3('0x41')](_0x28ed5b['where'],{'$or':_[_0xeef3('0x2f')](_0x5f4ebf,function(_0x5c03e0){if(_0x5c03e0[_0xeef3('0x42')]!=='VIRTUAL'){var _0x557999={};_0x557999[_0x5c03e0[_0xeef3('0x2c')]]={'$like':'%'+_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x40')]+'%'};return _0x557999;}})});}_0x28ed5b=_['merge']({},_0x28ed5b,_0x4fc9b3[_0xeef3('0x43')]);var _0xbb57e8={'where':_0x28ed5b['where']};return db[_0xeef3('0x44')][_0xeef3('0x22')](_0xbb57e8)['then'](function(_0x51202a){_0x3e322b['count']=_0x51202a;if(_0x4fc9b3['query']['includeAll']){_0x28ed5b[_0xeef3('0x45')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xeef3('0x46')](_0x28ed5b);})[_0xeef3('0x29')](function(_0x133db2){_0x3e322b[_0xeef3('0x47')]=_0x133db2;return _0x3e322b;})['then'](respondWithFilteredResult(_0x32629a,_0x28ed5b))['catch'](handleError(_0x32629a,null));};exports[_0xeef3('0x48')]=function(_0x5cfaca,_0x159ff2){var _0x272d19={'raw':!![],'where':{'id':_0x5cfaca[_0xeef3('0x49')]['id']}},_0x24a5aa={};_0x24a5aa[_0xeef3('0x32')]=_['keys'](db[_0xeef3('0x44')]['rawAttributes']);_0x24a5aa[_0xeef3('0x33')]=_[_0xeef3('0x34')](_0x5cfaca[_0xeef3('0x33')]);_0x24a5aa[_0xeef3('0x35')]=_[_0xeef3('0x36')](_0x24a5aa[_0xeef3('0x32')],_0x24a5aa['query']);_0x272d19[_0xeef3('0x38')]=_['intersection'](_0x24a5aa[_0xeef3('0x32')],qs[_0xeef3('0x37')](_0x5cfaca[_0xeef3('0x33')][_0xeef3('0x37')]));_0x272d19[_0xeef3('0x38')]=_0x272d19[_0xeef3('0x38')]['length']?_0x272d19['attributes']:_0x24a5aa[_0xeef3('0x32')];if(_0x5cfaca[_0xeef3('0x33')][_0xeef3('0x4a')]){_0x272d19[_0xeef3('0x45')]=[{'all':!![]}];}_0x272d19=_[_0xeef3('0x41')]({},_0x272d19,_0x5cfaca[_0xeef3('0x43')]);return db[_0xeef3('0x44')]['find'](_0x272d19)['then'](handleEntityNotFound(_0x159ff2,null))[_0xeef3('0x29')](respondWithResult(_0x159ff2,null))[_0xeef3('0x4b')](handleError(_0x159ff2,null));};exports[_0xeef3('0x4c')]=function(_0x10e775,_0x213536){return db[_0xeef3('0x44')][_0xeef3('0x4c')](_0x10e775[_0xeef3('0x4d')],{})['then'](respondWithResult(_0x213536,0xc9))[_0xeef3('0x4b')](handleError(_0x213536,null));};exports[_0xeef3('0x28')]=function(_0x1c9a52,_0x2bf5d9){if(_0x1c9a52[_0xeef3('0x4d')]['id']){delete _0x1c9a52[_0xeef3('0x4d')]['id'];}return db[_0xeef3('0x44')]['find']({'where':{'id':_0x1c9a52['params']['id']}})[_0xeef3('0x29')](handleEntityNotFound(_0x2bf5d9,null))['then'](saveUpdates(_0x1c9a52[_0xeef3('0x4d')],null))[_0xeef3('0x29')](respondWithResult(_0x2bf5d9,null))['catch'](handleError(_0x2bf5d9,null));};exports['destroy']=function(_0x1966c4,_0x59b22f){return db[_0xeef3('0x44')][_0xeef3('0x4e')]({'where':{'id':_0x1966c4[_0xeef3('0x49')]['id']}})[_0xeef3('0x29')](handleEntityNotFound(_0x59b22f,null))[_0xeef3('0x29')](removeEntity(_0x59b22f,null))['catch'](handleError(_0x59b22f,null));};exports[_0xeef3('0x4f')]=function(_0x1131fe,_0x3f1393){return db[_0xeef3('0x44')][_0xeef3('0x4f')]()[_0xeef3('0x29')](respondWithResult(_0x3f1393,null))[_0xeef3('0x4b')](handleError(_0x3f1393,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 26ff39c..0e92e7c 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 _0x5887=['request-promise','path','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x316889,_0x1ed910){var _0x3f9a5f=function(_0xaffd61){while(--_0xaffd61){_0x316889['push'](_0x316889['shift']());}};_0x3f9a5f(++_0x1ed910);}(_0x5887,0x12e));var _0x7588=function(_0x4dbc5d,_0x2d0a51){_0x4dbc5d=_0x4dbc5d-0x0;var _0x45b461=_0x5887[_0x4dbc5d];return _0x45b461;};'use strict';var _=require(_0x7588('0x0'));var util=require(_0x7588('0x1'));var logger=require(_0x7588('0x2'))(_0x7588('0x3'));var moment=require(_0x7588('0x4'));var BPromise=require(_0x7588('0x5'));var rp=require(_0x7588('0x6'));var fs=require('fs');var path=require(_0x7588('0x7'));var rimraf=require('rimraf');var config=require(_0x7588('0x8'));var attributes=require(_0x7588('0x9'));module['exports']=function(_0x2bb028,_0x3c359d){return _0x2bb028[_0x7588('0xa')](_0x7588('0xb'),attributes,{'tableName':_0x7588('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7588('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44b4=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceDialReport','report_dial'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x44b4,0x143));var _0x444b=function(_0x450b0d,_0x5c7ec9){_0x450b0d=_0x450b0d-0x0;var _0x271152=_0x44b4[_0x450b0d];return _0x271152;};'use strict';var _=require(_0x444b('0x0'));var util=require(_0x444b('0x1'));var logger=require(_0x444b('0x2'))(_0x444b('0x3'));var moment=require(_0x444b('0x4'));var BPromise=require(_0x444b('0x5'));var rp=require(_0x444b('0x6'));var fs=require('fs');var path=require(_0x444b('0x7'));var rimraf=require(_0x444b('0x8'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x444b('0x9')]=function(_0x1bd97f,_0x1b064e){return _0x1bd97f[_0x444b('0xa')](_0x444b('0xb'),attributes,{'tableName':_0x444b('0xc'),'paranoid':![],'indexes':[{'fields':[_0x444b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a180f08..94fb32a 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 _0xe348=['VoiceDialReport','create','body','options','raw','debug','UpdateVoiceDialReport','where','limit','then','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceDialReport'];(function(_0x5a11b1,_0xd7d141){var _0x57996d=function(_0x41ab10){while(--_0x41ab10){_0x5a11b1['push'](_0x5a11b1['shift']());}};_0x57996d(++_0xd7d141);}(_0xe348,0xbe));var _0x8e34=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xe348[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0x8e34('0x0'));var util=require(_0x8e34('0x1'));var moment=require(_0x8e34('0x2'));var BPromise=require(_0x8e34('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8e34('0x4'));var logger=require(_0x8e34('0x5'))(_0x8e34('0x6'));var config=require(_0x8e34('0x7'));var jayson=require(_0x8e34('0x8'));var client=jayson[_0x8e34('0x9')][_0x8e34('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f9792,_0x4cf24f,_0x13d292){return new BPromise(function(_0x52224f,_0x3c23e3){return client['request'](_0x4f9792,_0x13d292)['then'](function(_0x326a26){logger[_0x8e34('0xb')](_0x8e34('0xc'),_0x4cf24f,_0x8e34('0xd'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x4cf24f,_0x8e34('0xd'),JSON[_0x8e34('0xe')](_0x326a26));if(_0x326a26['error']){if(_0x326a26['error']['code']===0x1f4){logger[_0x8e34('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x4cf24f,_0x326a26['error'][_0x8e34('0x10')]);return _0x3c23e3(_0x326a26['error'][_0x8e34('0x10')]);}logger[_0x8e34('0xf')](_0x8e34('0xc'),_0x4cf24f,_0x326a26[_0x8e34('0xf')][_0x8e34('0x10')]);return _0x52224f(_0x326a26[_0x8e34('0xf')][_0x8e34('0x10')]);}else{logger[_0x8e34('0xb')](_0x8e34('0xc'),_0x4cf24f,_0x8e34('0xd'));_0x52224f(_0x326a26[_0x8e34('0x11')][_0x8e34('0x10')]);}})[_0x8e34('0x12')](function(_0x2e1a12){logger[_0x8e34('0xf')](_0x8e34('0xc'),_0x4cf24f,_0x2e1a12);_0x3c23e3(_0x2e1a12);});});}exports[_0x8e34('0x13')]=function(_0x5136ed){var _0x21bb9f=this;return new Promise(function(_0x98c578,_0x5b54eb){return db[_0x8e34('0x14')][_0x8e34('0x15')](_0x5136ed[_0x8e34('0x16')],{'raw':_0x5136ed[_0x8e34('0x17')]?_0x5136ed[_0x8e34('0x17')][_0x8e34('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x551633){logger[_0x8e34('0xb')](_0x8e34('0x13'),_0x5136ed);logger[_0x8e34('0x19')]('CreateVoiceDialReport',_0x5136ed,JSON[_0x8e34('0xe')](_0x551633));_0x98c578(_0x551633);})['catch'](function(_0x2fbc3a){logger[_0x8e34('0xf')](_0x8e34('0x13'),_0x2fbc3a['message'],_0x5136ed);_0x5b54eb(_0x21bb9f[_0x8e34('0xf')](0x1f4,_0x2fbc3a['message']));});});};exports[_0x8e34('0x1a')]=function(_0x43e92c){var _0x3004a2=this;return new Promise(function(_0x189324,_0x42d396){return db[_0x8e34('0x14')]['update'](_0x43e92c[_0x8e34('0x16')],{'raw':_0x43e92c[_0x8e34('0x17')]?_0x43e92c[_0x8e34('0x17')][_0x8e34('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e92c[_0x8e34('0x17')]?_0x43e92c[_0x8e34('0x17')][_0x8e34('0x1b')]||null:null,'attributes':_0x43e92c[_0x8e34('0x17')]?_0x43e92c[_0x8e34('0x17')]['attributes']||null:null,'limit':_0x43e92c['options']?_0x43e92c[_0x8e34('0x17')][_0x8e34('0x1c')]||null:null})[_0x8e34('0x1d')](function(_0x6dde45){logger[_0x8e34('0xb')]('UpdateVoiceDialReport',_0x43e92c);logger[_0x8e34('0x19')](_0x8e34('0x1a'),_0x43e92c,JSON['stringify'](_0x6dde45));_0x189324(_0x6dde45);})[_0x8e34('0x12')](function(_0x2a8a79){logger[_0x8e34('0xf')](_0x8e34('0x1a'),_0x2a8a79[_0x8e34('0x10')],_0x43e92c);_0x42d396(_0x3004a2['error'](0x1f4,_0x2a8a79[_0x8e34('0x10')]));});});}; \ No newline at end of file +var _0x9803=['then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateVoiceDialReport','create','body','raw','VoiceDialReport','update','options','attributes','limit','UpdateVoiceDialReport','lodash','util','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x57d762,_0x1fd2e7){var _0x19db87=function(_0x3c08b7){while(--_0x3c08b7){_0x57d762['push'](_0x57d762['shift']());}};_0x19db87(++_0x1fd2e7);}(_0x9803,0x76));var _0x3980=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9803[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x3980('0x0'));var util=require(_0x3980('0x1'));var moment=require('moment');var BPromise=require(_0x3980('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3980('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3980('0x4'));var config=require(_0x3980('0x5'));var jayson=require(_0x3980('0x6'));var client=jayson[_0x3980('0x7')][_0x3980('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x82f8ee,_0x24aa77,_0x2b299b){return new BPromise(function(_0x27eb07,_0x93e159){return client[_0x3980('0x9')](_0x82f8ee,_0x2b299b)[_0x3980('0xa')](function(_0x1d3518){logger[_0x3980('0xb')](_0x3980('0xc'),_0x24aa77,'request\x20sent');logger[_0x3980('0xd')](_0x3980('0xe'),_0x24aa77,'request\x20sent',JSON[_0x3980('0xf')](_0x1d3518));if(_0x1d3518['error']){if(_0x1d3518[_0x3980('0x10')][_0x3980('0x11')]===0x1f4){logger[_0x3980('0x10')](_0x3980('0xc'),_0x24aa77,_0x1d3518[_0x3980('0x10')][_0x3980('0x12')]);return _0x93e159(_0x1d3518[_0x3980('0x10')][_0x3980('0x12')]);}logger[_0x3980('0x10')](_0x3980('0xc'),_0x24aa77,_0x1d3518[_0x3980('0x10')][_0x3980('0x12')]);return _0x27eb07(_0x1d3518['error'][_0x3980('0x12')]);}else{logger[_0x3980('0xb')](_0x3980('0xc'),_0x24aa77,_0x3980('0x13'));_0x27eb07(_0x1d3518[_0x3980('0x14')][_0x3980('0x12')]);}})[_0x3980('0x15')](function(_0x121691){logger['error'](_0x3980('0xc'),_0x24aa77,_0x121691);_0x93e159(_0x121691);});});}exports[_0x3980('0x16')]=function(_0x3d755c){var _0x3f8f3b=this;return new Promise(function(_0xa0261b,_0x3ab5b6){return db['VoiceDialReport'][_0x3980('0x17')](_0x3d755c[_0x3980('0x18')],{'raw':_0x3d755c['options']?_0x3d755c['options'][_0x3980('0x19')]===undefined?!![]:![]:!![]})[_0x3980('0xa')](function(_0x721ae4){logger[_0x3980('0xb')](_0x3980('0x16'),_0x3d755c);logger['debug'](_0x3980('0x16'),_0x3d755c,JSON[_0x3980('0xf')](_0x721ae4));_0xa0261b(_0x721ae4);})[_0x3980('0x15')](function(_0x2bdf31){logger[_0x3980('0x10')](_0x3980('0x16'),_0x2bdf31[_0x3980('0x12')],_0x3d755c);_0x3ab5b6(_0x3f8f3b['error'](0x1f4,_0x2bdf31[_0x3980('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x5ba82d){var _0x2b541f=this;return new Promise(function(_0x11e579,_0x3b45df){return db[_0x3980('0x1a')][_0x3980('0x1b')](_0x5ba82d['body'],{'raw':_0x5ba82d[_0x3980('0x1c')]?_0x5ba82d[_0x3980('0x1c')][_0x3980('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba82d[_0x3980('0x1c')]?_0x5ba82d[_0x3980('0x1c')]['where']||null:null,'attributes':_0x5ba82d[_0x3980('0x1c')]?_0x5ba82d['options'][_0x3980('0x1d')]||null:null,'limit':_0x5ba82d[_0x3980('0x1c')]?_0x5ba82d[_0x3980('0x1c')][_0x3980('0x1e')]||null:null})['then'](function(_0xd4a472){logger['info'](_0x3980('0x1f'),_0x5ba82d);logger['debug'](_0x3980('0x1f'),_0x5ba82d,JSON[_0x3980('0xf')](_0xd4a472));_0x11e579(_0xd4a472);})['catch'](function(_0x30c27e){logger[_0x3980('0x10')](_0x3980('0x1f'),_0x30c27e[_0x3980('0x12')],_0x5ba82d);_0x3b45df(_0x2b541f['error'](0x1f4,_0x30c27e[_0x3980('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f305133..aa4c164 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 _0x2484=['/:id/applications','addApplications','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x2484,0x75));var _0x4248=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0x2484[_0x3e961c];return _0x474f9c;};'use strict';var multer=require('multer');var util=require(_0x4248('0x0'));var path=require(_0x4248('0x1'));var timeout=require(_0x4248('0x2'));var express=require(_0x4248('0x3'));var router=express[_0x4248('0x4')]();var fs_extra=require(_0x4248('0x5'));var auth=require(_0x4248('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4248('0x7'));var controller=require('./voiceExtension.controller');router[_0x4248('0x8')]('/',auth['isAuthenticated'](),controller[_0x4248('0x9')]);router['get'](_0x4248('0xa'),auth[_0x4248('0xb')](),controller[_0x4248('0xc')]);router[_0x4248('0xd')]('/',auth[_0x4248('0xb')](),controller[_0x4248('0xe')]);router[_0x4248('0xd')](_0x4248('0xf'),auth[_0x4248('0xb')](),controller[_0x4248('0x10')]);router[_0x4248('0x11')]('/:id',auth[_0x4248('0xb')](),controller[_0x4248('0x12')]);router[_0x4248('0x13')](_0x4248('0xa'),auth[_0x4248('0xb')](),controller[_0x4248('0x14')]);module[_0x4248('0x15')]=router; \ No newline at end of file +var _0x912f=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','show','post','/:id/applications','addApplications','/:id','delete'];(function(_0x578676,_0x2b17e3){var _0x37f730=function(_0x31a6e8){while(--_0x31a6e8){_0x578676['push'](_0x578676['shift']());}};_0x37f730(++_0x2b17e3);}(_0x912f,0x11f));var _0xf912=function(_0x512061,_0x497fac){_0x512061=_0x512061-0x0;var _0xd576b4=_0x912f[_0x512061];return _0xd576b4;};'use strict';var multer=require(_0xf912('0x0'));var util=require(_0xf912('0x1'));var path=require(_0xf912('0x2'));var timeout=require('connect-timeout');var express=require(_0xf912('0x3'));var router=express[_0xf912('0x4')]();var fs_extra=require(_0xf912('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf912('0x6'));var config=require(_0xf912('0x7'));var controller=require(_0xf912('0x8'));router[_0xf912('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf912('0x9')]('/:id',auth[_0xf912('0xa')](),controller[_0xf912('0xb')]);router[_0xf912('0xc')]('/',auth[_0xf912('0xa')](),controller['create']);router[_0xf912('0xc')](_0xf912('0xd'),auth[_0xf912('0xa')](),controller[_0xf912('0xe')]);router['put'](_0xf912('0xf'),auth[_0xf912('0xa')](),controller['update']);router[_0xf912('0x10')](_0xf912('0xf'),auth[_0xf912('0xa')](),controller[_0xf912('0x11')]);module[_0xf912('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 d00fd94..09140eb 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 _0xcd4b=['outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','internal','inbound-fax'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xcd4b,0x185));var _0xbcd4=function(_0x21afd5,_0x57b9ba){_0x21afd5=_0x21afd5-0x0;var _0x59b71d=_0xcd4b[_0x21afd5];return _0x59b71d;};'use strict';var Sequelize=require(_0xbcd4('0x0'));module[_0xbcd4('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbcd4('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xbcd4('0x3')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xbcd4('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbcd4('0x4')},'appdata':{'type':Sequelize[_0xbcd4('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xbcd4('0x5')](_0xbcd4('0x6'),_0xbcd4('0x7'),_0xbcd4('0x8'),_0xbcd4('0x9'),_0xbcd4('0xa'),_0xbcd4('0xb'),_0xbcd4('0xc')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbcd4('0x3')],'allowNull':![],'defaultValue':_0xbcd4('0xd')},'IntervalId':{'type':Sequelize[_0xbcd4('0xe')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xbcd4('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xbcd4('0xe')]},'recordingFormat':{'type':Sequelize[_0xbcd4('0x3')],'defaultValue':_0xbcd4('0x10')},'answer':{'type':Sequelize[_0xbcd4('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0xbcd4('0x11')],'get':function(_0x218e2a){return this['getDataValue'](_0xbcd4('0x12'));}},'alias':{'type':Sequelize[_0xbcd4('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x8ab3=['STRING','compositeIndex','NoOp','inbound','internal','inbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','exten','sequelize'];(function(_0x1f3da9,_0x2919b9){var _0x2d33ee=function(_0x4c718c){while(--_0x4c718c){_0x1f3da9['push'](_0x1f3da9['shift']());}};_0x2d33ee(++_0x2919b9);}(_0x8ab3,0x10d));var _0x38ab=function(_0x28cbc5,_0x326e44){_0x28cbc5=_0x28cbc5-0x0;var _0x310541=_0x8ab3[_0x28cbc5];return _0x310541;};'use strict';var Sequelize=require(_0x38ab('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x38ab('0x1')],'allowNull':![],'unique':_0x38ab('0x2')},'priority':{'type':Sequelize[_0x38ab('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x38ab('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x38ab('0x1')],'allowNull':![],'defaultValue':_0x38ab('0x3')},'appdata':{'type':Sequelize[_0x38ab('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x38ab('0x4'),'outbound',_0x38ab('0x5'),_0x38ab('0x6'),'outbound-fax',_0x38ab('0x7'),_0x38ab('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x38ab('0x1')]},'interval':{'type':Sequelize[_0x38ab('0x1')],'allowNull':![],'defaultValue':_0x38ab('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x38ab('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x38ab('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x38ab('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x38ab('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x38ab('0xb')]},'recordingFormat':{'type':Sequelize[_0x38ab('0x1')],'defaultValue':_0x38ab('0xc')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x38ab('0xd')],'get':function(_0x9b1a1f){return this['getDataValue'](_0x38ab('0xe'));}},'alias':{'type':Sequelize[_0x38ab('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index e6c5a56..a7ed75c 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 _0x03fa=['bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','map','value','type','find','name','UserProfileResource','end','stack','send','index','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','show','keys','length','catch','params','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting'];(function(_0x35797e,_0x4c6baf){var _0x433741=function(_0x2f4954){while(--_0x2f4954){_0x35797e['push'](_0x35797e['shift']());}};_0x433741(++_0x4c6baf);}(_0x03fa,0xc4));var _0xa03f=function(_0xaccc0d,_0xb2eed5){_0xaccc0d=_0xaccc0d-0x0;var _0x646e25=_0x03fa[_0xaccc0d];return _0x646e25;};'use strict';var _=require(_0xa03f('0x0'));var Redis=require(_0xa03f('0x1'));var qs=require(_0xa03f('0x2'));var logger=require(_0xa03f('0x3'))(_0xa03f('0x4'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa03f('0x5')]=_[_0xa03f('0x6')](config[_0xa03f('0x5')],{'host':_0xa03f('0x7'),'port':0x18eb});var socket=require(_0xa03f('0x8'))(new Redis(config[_0xa03f('0x5')]));require(_0xa03f('0x9'))[_0xa03f('0xa')](socket);function respondWithStatusCode(_0x4e4a4c,_0x27ecd9){_0x27ecd9=_0x27ecd9||0xcc;return function(_0x409bcd){if(_0x409bcd){return _0x4e4a4c[_0xa03f('0xb')](_0x27ecd9);}return _0x4e4a4c[_0xa03f('0xc')](_0x27ecd9)['end']();};}function respondWithResult(_0x98378b,_0x1428f5){_0x1428f5=_0x1428f5||0xc8;return function(_0x140aa9){if(_0x140aa9){return _0x98378b[_0xa03f('0xc')](_0x1428f5)[_0xa03f('0xd')](_0x140aa9);}};}function respondWithFilteredResult(_0x40a415,_0x205c11){return function(_0x7e8651){if(_0x7e8651){var _0x49e4a3=typeof _0x205c11[_0xa03f('0xe')]==='undefined'&&typeof _0x205c11['limit']===_0xa03f('0xf');var _0x2dd160=_0x7e8651[_0xa03f('0x10')];var _0x5c2b5a=_0x49e4a3?0x0:_0x205c11[_0xa03f('0xe')];var _0x206934=_0x49e4a3?_0x7e8651[_0xa03f('0x10')]:_0x205c11['offset']+_0x205c11[_0xa03f('0x11')];var _0x3e420b;if(_0x206934>=_0x2dd160){_0x206934=_0x2dd160;_0x3e420b=0xc8;}else{_0x3e420b=0xce;}_0x40a415['status'](_0x3e420b);return _0x40a415[_0xa03f('0x12')](_0xa03f('0x13'),_0x5c2b5a+'-'+_0x206934+'/'+_0x2dd160)[_0xa03f('0xd')](_0x7e8651);}return null;};}function removeEntity(_0x5c438e){return function(_0x2889bf){if(_0x2889bf){return _0x2889bf[_0xa03f('0x14')]()[_0xa03f('0x15')](function(){var _0x291099=_0x2889bf[_0xa03f('0x16')]({'plain':!![]});var _0x400382=[{'name':_0xa03f('0x17'),'value':_0xa03f('0x18'),'ignore':![]},{'name':_0xa03f('0x19'),'value':_0xa03f('0x1a'),'ignore':![]},{'name':_0xa03f('0x1b'),'value':_0xa03f('0x1c'),'ignore':![]}];var _0x18d9a4=_(_0x400382)['filter']('ignore')[_0xa03f('0x1d')]('value')[_0xa03f('0x1e')]();if(_['includes'](_0x18d9a4,_0x291099[_0xa03f('0x1f')])){return;}var _0x459afe=_[_0xa03f('0x20')](_0x400382,[_0xa03f('0x1e'),_0x291099[_0xa03f('0x1f')]])[_0xa03f('0x21')];return db[_0xa03f('0x22')][_0xa03f('0x14')]({'where':{'type':_0x459afe,'resourceId':_0x291099['id']}})[_0xa03f('0x15')](function(){return _0x2889bf;});})[_0xa03f('0x15')](function(){_0x5c438e[_0xa03f('0xc')](0xcc)[_0xa03f('0x23')]();});}};}function handleEntityNotFound(_0x39065c){return function(_0x4f5046){if(!_0x4f5046){_0x39065c[_0xa03f('0xb')](0x194);}return _0x4f5046;};}function handleError(_0x5391a9,_0x4d7aa6){_0x4d7aa6=_0x4d7aa6||0x1f4;return function(_0x529d60){logger['error'](_0x529d60[_0xa03f('0x24')]);if(_0x529d60[_0xa03f('0x21')]){delete _0x529d60['name'];}_0x5391a9[_0xa03f('0xc')](_0x4d7aa6)[_0xa03f('0x25')](_0x529d60);};}exports[_0xa03f('0x26')]=function(_0x12ef12,_0x5d2868){var _0x2a3376={},_0xfb0e3c={},_0x3bed58={'count':0x0,'rows':[]};var _0x33ebb6=_[_0xa03f('0x1d')](db['VoiceExtension'][_0xa03f('0x27')],function(_0x25b19b){return{'name':_0x25b19b[_0xa03f('0x28')],'type':_0x25b19b[_0xa03f('0x1f')]['key']};});_0xfb0e3c[_0xa03f('0x29')]=_[_0xa03f('0x1d')](_0x33ebb6,_0xa03f('0x21'));_0xfb0e3c[_0xa03f('0x2a')]=_['keys'](_0x12ef12['query']);_0xfb0e3c[_0xa03f('0x2b')]=_[_0xa03f('0x2c')](_0xfb0e3c[_0xa03f('0x29')],_0xfb0e3c[_0xa03f('0x2a')]);_0x2a3376[_0xa03f('0x2d')]=_['intersection'](_0xfb0e3c[_0xa03f('0x29')],qs[_0xa03f('0x2e')](_0x12ef12[_0xa03f('0x2a')][_0xa03f('0x2e')]));_0x2a3376[_0xa03f('0x2d')]=_0x2a3376[_0xa03f('0x2d')]['length']?_0x2a3376[_0xa03f('0x2d')]:_0xfb0e3c[_0xa03f('0x29')];if(!_0x12ef12[_0xa03f('0x2a')][_0xa03f('0x2f')](_0xa03f('0x30'))){_0x2a3376[_0xa03f('0x11')]=qs[_0xa03f('0x11')](_0x12ef12[_0xa03f('0x2a')][_0xa03f('0x11')]);_0x2a3376[_0xa03f('0xe')]=qs[_0xa03f('0xe')](_0x12ef12[_0xa03f('0x2a')][_0xa03f('0xe')]);}_0x2a3376['order']=qs[_0xa03f('0x31')](_0x12ef12[_0xa03f('0x2a')][_0xa03f('0x31')]);_0x2a3376[_0xa03f('0x32')]=qs[_0xa03f('0x2b')](_[_0xa03f('0x33')](_0x12ef12[_0xa03f('0x2a')],_0xfb0e3c['filters']),_0x33ebb6);if(_0x12ef12[_0xa03f('0x2a')][_0xa03f('0x34')]){_0x2a3376[_0xa03f('0x32')]=_[_0xa03f('0x35')](_0x2a3376[_0xa03f('0x32')],{'$or':_[_0xa03f('0x1d')](_0x33ebb6,function(_0x3a9eac){if(_0x3a9eac[_0xa03f('0x1f')]!==_0xa03f('0x36')){var _0x135563={};_0x135563[_0x3a9eac[_0xa03f('0x21')]]={'$like':'%'+_0x12ef12['query']['filter']+'%'};return _0x135563;}})});}_0x2a3376=_[_0xa03f('0x35')]({},_0x2a3376,_0x12ef12[_0xa03f('0x37')]);var _0x36633c={'where':_0x2a3376[_0xa03f('0x32')]};return db[_0xa03f('0x38')][_0xa03f('0x10')](_0x36633c)[_0xa03f('0x15')](function(_0x1c8562){_0x3bed58[_0xa03f('0x10')]=_0x1c8562;if(_0x12ef12['query'][_0xa03f('0x39')]){_0x2a3376[_0xa03f('0x3a')]=[{'all':!![]}];}return db[_0xa03f('0x38')][_0xa03f('0x3b')](_0x2a3376);})[_0xa03f('0x15')](function(_0x3d836f){_0x3bed58[_0xa03f('0x3c')]=_0x3d836f;return _0x3bed58;})[_0xa03f('0x15')](respondWithFilteredResult(_0x5d2868,_0x2a3376))['catch'](handleError(_0x5d2868,null));};exports[_0xa03f('0x3d')]=function(_0x3bc5f5,_0x9fed4e){var _0x5ee005={'raw':![],'where':{'id':_0x3bc5f5['params']['id']}},_0x1d7ea9={};_0x1d7ea9[_0xa03f('0x29')]=_[_0xa03f('0x3e')](db[_0xa03f('0x38')][_0xa03f('0x27')]);_0x1d7ea9[_0xa03f('0x2a')]=_[_0xa03f('0x3e')](_0x3bc5f5[_0xa03f('0x2a')]);_0x1d7ea9[_0xa03f('0x2b')]=_['intersection'](_0x1d7ea9[_0xa03f('0x29')],_0x1d7ea9[_0xa03f('0x2a')]);_0x5ee005[_0xa03f('0x2d')]=_[_0xa03f('0x2c')](_0x1d7ea9['model'],qs[_0xa03f('0x2e')](_0x3bc5f5[_0xa03f('0x2a')][_0xa03f('0x2e')]));_0x5ee005[_0xa03f('0x2d')]=_0x5ee005[_0xa03f('0x2d')][_0xa03f('0x3f')]?_0x5ee005['attributes']:_0x1d7ea9[_0xa03f('0x29')];if(_0x3bc5f5[_0xa03f('0x2a')][_0xa03f('0x39')]){_0x5ee005[_0xa03f('0x3a')]=[{'all':!![]}];}_0x5ee005=_[_0xa03f('0x35')]({},_0x5ee005,_0x3bc5f5['options']);return db['VoiceExtension'][_0xa03f('0x20')](_0x5ee005)['then'](handleEntityNotFound(_0x9fed4e,null))[_0xa03f('0x15')](respondWithResult(_0x9fed4e,null))[_0xa03f('0x40')](handleError(_0x9fed4e,null));};exports[_0xa03f('0x14')]=function(_0x133509,_0x4911c2){return db[_0xa03f('0x38')][_0xa03f('0x20')]({'where':{'id':_0x133509[_0xa03f('0x41')]['id']}})[_0xa03f('0x15')](handleEntityNotFound(_0x4911c2,null))['then'](removeEntity(_0x4911c2,null))[_0xa03f('0x40')](handleError(_0x4911c2,null));};exports['create']=function(_0x16a01e,_0x1fb8ab){if(_0x16a01e[_0xa03f('0x42')][_0xa03f('0x1f')]===_0xa03f('0x1a')&&!_[_0xa03f('0x43')](_0x16a01e['body'][_0xa03f('0x44')],'_')){_0x16a01e['body'][_0xa03f('0x44')]='_'[_0xa03f('0x45')](_0x16a01e[_0xa03f('0x42')][_0xa03f('0x44')]);}return db['VoiceExtension'][_0xa03f('0x46')](_0x16a01e['body'],{'raw':![]})['then'](function(_0x3172b2){var _0x3ae29a=_0x16a01e[_0xa03f('0x47')][_0xa03f('0x16')]({'plain':!![]});if(!_0x3ae29a)throw new Error(_0xa03f('0x48'));if(_0x3ae29a['role']===_0xa03f('0x47')){var _0x28e2b6=_0x3172b2[_0xa03f('0x16')]({'plain':!![]});var _0x108101=[{'name':_0xa03f('0x17'),'value':_0xa03f('0x18')},{'name':'OutboundRoutes','value':_0xa03f('0x1a')},{'name':'InternalRoutes','value':_0xa03f('0x1c')}];var _0x1e7c25=_[_0xa03f('0x20')](_0x108101,[_0xa03f('0x1e'),_0x28e2b6[_0xa03f('0x1f')]])[_0xa03f('0x21')];return db[_0xa03f('0x49')][_0xa03f('0x20')]({'where':{'name':_0x1e7c25,'userProfileId':_0x3ae29a['userProfileId']},'raw':!![]})[_0xa03f('0x15')](function(_0x309812){if(_0x309812&&_0x309812[_0xa03f('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x28e2b6[_0xa03f('0x21')],'resourceId':_0x28e2b6['id'],'type':_0x309812[_0xa03f('0x21')],'sectionId':_0x309812['id']},{})[_0xa03f('0x15')](function(){return _0x3172b2;});}else{return _0x3172b2;}})[_0xa03f('0x40')](function(_0x299673){logger[_0xa03f('0x4b')](_0xa03f('0x4c'),_0x299673);throw _0x299673;});}return _0x3172b2;})['then'](respondWithResult(_0x1fb8ab,0xc9))[_0xa03f('0x40')](handleError(_0x1fb8ab,null));};exports[_0xa03f('0x4d')]=function(_0x1bfe1b,_0x5beb15){if(_0x1bfe1b['body']['id']){delete _0x1bfe1b[_0xa03f('0x42')]['id'];}return db[_0xa03f('0x38')][_0xa03f('0x20')]({'where':{'id':_0x1bfe1b[_0xa03f('0x41')]['id']}})['then'](handleEntityNotFound(_0x5beb15,null))[_0xa03f('0x15')](function(_0x459c1f){if(_0x459c1f){return db['VoiceExtension'][_0xa03f('0x4d')](_['pick'](_0x1bfe1b[_0xa03f('0x42')],[_0xa03f('0x44'),'context',_0xa03f('0x4e'),_0xa03f('0x4f'),_0xa03f('0x50'),_0xa03f('0x51'),_0xa03f('0x52')]),{'where':{'context':_0x459c1f[_0xa03f('0x53')],'exten':_0x459c1f['exten']},'individualHooks':!![]})['then'](function(_0x43d4d6){return _0x43d4d6;});}return null;})[_0xa03f('0x15')](respondWithStatusCode(_0x5beb15,null))[_0xa03f('0x40')](handleError(_0x5beb15,null));};exports[_0xa03f('0x54')]=function(_0x404633,_0x2bd92c){var _0x22d7dd=_0x404633[_0xa03f('0x41')]['id'];var _0x559ad9=_0x404633['body'];var _0x4dab77=0xc8;var _0x1d8477=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xa03f('0x55')][_0xa03f('0x56')]['ISOLATION_LEVELS'][_0xa03f('0x57')]},function(_0x5c96da){return db[_0xa03f('0x38')][_0xa03f('0x58')]({'where':{'id':_0x22d7dd},'transaction':_0x5c96da})[_0xa03f('0x15')](function(_0x5298b8){if(_0x5298b8){return db[_0xa03f('0x38')][_0xa03f('0x14')]({'where':{'VoiceExtensionId':_0x22d7dd},'transaction':_0x5c96da})[_0xa03f('0x15')](function(){var _0x303531=_[_0xa03f('0x1d')](_0x559ad9,function(_0xf85ad){_0xf85ad[_0xa03f('0x59')]=_0x22d7dd;_0xf85ad[_0xa03f('0x5a')]=!![];return _0xf85ad;});return _0x5298b8[_0xa03f('0x5b')](_0x303531);})['then'](function(_0x51d62f){return db[_0xa03f('0x38')][_0xa03f('0x5c')](_0x51d62f,{'transaction':_0x5c96da});});}else{_0x4dab77=0x194;_0x1d8477=[];}});})['then'](function(){if(_0x4dab77!==0x194){return db[_0xa03f('0x38')][_0xa03f('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x22d7dd},'order':_0xa03f('0x5e')})[_0xa03f('0x15')](function(_0x411ef5){_0x1d8477=_0x411ef5;});}})[_0xa03f('0x40')](function(_0xfd6701){_0x4dab77=0x1f4;logger[_0xa03f('0x4b')](_0xfd6701[_0xa03f('0x24')]);if(_0xfd6701[_0xa03f('0x21')]){delete _0xfd6701[_0xa03f('0x21')];}_0x1d8477=_0xfd6701;})[_0xa03f('0x5f')](function(){if(_0x1d8477===null){_0x2bd92c[_0xa03f('0xb')](_0x4dab77);}else{if(_0x4dab77===0x1f4){_0x2bd92c[_0xa03f('0xc')](_0x4dab77)[_0xa03f('0x25')](_0x1d8477);}else{_0x2bd92c[_0xa03f('0xc')](_0x4dab77)[_0xa03f('0xd')](_0x1d8477);}}});}; \ No newline at end of file +var _0x7c4d=['redis','localhost','socket.io-emitter','./voiceExtension.socket','register','end','offset','undefined','limit','count','set','Content-Range','json','destroy','OutboundRoutes','InternalRoutes','filter','ignore','map','value','includes','type','find','UserProfileResource','then','sendStatus','error','name','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','findAll','rows','catch','show','fields','params','create','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','inbound','userProfileId','autoAssociation','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','status','send','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb'];(function(_0x1fc331,_0x2f7678){var _0x35ece7=function(_0xc22e51){while(--_0xc22e51){_0x1fc331['push'](_0x1fc331['shift']());}};_0x35ece7(++_0x2f7678);}(_0x7c4d,0x163));var _0xd7c4=function(_0xdd8bef,_0x589d1d){_0xdd8bef=_0xdd8bef-0x0;var _0x2b16d3=_0x7c4d[_0xdd8bef];return _0x2b16d3;};'use strict';var _=require('lodash');var Redis=require(_0xd7c4('0x0'));var qs=require(_0xd7c4('0x1'));var logger=require('../../config/logger')(_0xd7c4('0x2'));var config=require(_0xd7c4('0x3'));var db=require(_0xd7c4('0x4'))['db'];config[_0xd7c4('0x5')]=_['defaults'](config[_0xd7c4('0x5')],{'host':_0xd7c4('0x6'),'port':0x18eb});var socket=require(_0xd7c4('0x7'))(new Redis(config[_0xd7c4('0x5')]));require(_0xd7c4('0x8'))[_0xd7c4('0x9')](socket);function respondWithStatusCode(_0x467014,_0x2a5c8c){_0x2a5c8c=_0x2a5c8c||0xcc;return function(_0x2c44fe){if(_0x2c44fe){return _0x467014['sendStatus'](_0x2a5c8c);}return _0x467014['status'](_0x2a5c8c)[_0xd7c4('0xa')]();};}function respondWithResult(_0x30c5c3,_0x288345){_0x288345=_0x288345||0xc8;return function(_0x58cd7e){if(_0x58cd7e){return _0x30c5c3['status'](_0x288345)['json'](_0x58cd7e);}};}function respondWithFilteredResult(_0x58c4f1,_0xfa8340){return function(_0x124602){if(_0x124602){var _0x4f0383=typeof _0xfa8340[_0xd7c4('0xb')]===_0xd7c4('0xc')&&typeof _0xfa8340[_0xd7c4('0xd')]==='undefined';var _0x26d021=_0x124602['count'];var _0x13bae7=_0x4f0383?0x0:_0xfa8340[_0xd7c4('0xb')];var _0x44dcfc=_0x4f0383?_0x124602[_0xd7c4('0xe')]:_0xfa8340['offset']+_0xfa8340['limit'];var _0x2bbbaa;if(_0x44dcfc>=_0x26d021){_0x44dcfc=_0x26d021;_0x2bbbaa=0xc8;}else{_0x2bbbaa=0xce;}_0x58c4f1['status'](_0x2bbbaa);return _0x58c4f1[_0xd7c4('0xf')](_0xd7c4('0x10'),_0x13bae7+'-'+_0x44dcfc+'/'+_0x26d021)[_0xd7c4('0x11')](_0x124602);}return null;};}function removeEntity(_0xe0137a){return function(_0x201ef0){if(_0x201ef0){return _0x201ef0[_0xd7c4('0x12')]()['then'](function(){var _0x177879=_0x201ef0['get']({'plain':!![]});var _0x43fd54=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xd7c4('0x13'),'value':'outbound','ignore':![]},{'name':_0xd7c4('0x14'),'value':'internal','ignore':![]}];var _0xbc4e06=_(_0x43fd54)[_0xd7c4('0x15')](_0xd7c4('0x16'))[_0xd7c4('0x17')](_0xd7c4('0x18'))[_0xd7c4('0x18')]();if(_[_0xd7c4('0x19')](_0xbc4e06,_0x177879[_0xd7c4('0x1a')])){return;}var _0x45811a=_[_0xd7c4('0x1b')](_0x43fd54,[_0xd7c4('0x18'),_0x177879[_0xd7c4('0x1a')]])['name'];return db[_0xd7c4('0x1c')]['destroy']({'where':{'type':_0x45811a,'resourceId':_0x177879['id']}})[_0xd7c4('0x1d')](function(){return _0x201ef0;});})[_0xd7c4('0x1d')](function(){_0xe0137a['status'](0xcc)[_0xd7c4('0xa')]();});}};}function handleEntityNotFound(_0x470ac9){return function(_0x361d3c){if(!_0x361d3c){_0x470ac9[_0xd7c4('0x1e')](0x194);}return _0x361d3c;};}function handleError(_0x4ca8cb,_0x4d27db){_0x4d27db=_0x4d27db||0x1f4;return function(_0x1f8829){logger[_0xd7c4('0x1f')](_0x1f8829['stack']);if(_0x1f8829[_0xd7c4('0x20')]){delete _0x1f8829[_0xd7c4('0x20')];}_0x4ca8cb['status'](_0x4d27db)['send'](_0x1f8829);};}exports[_0xd7c4('0x21')]=function(_0x248bcb,_0x19332e){var _0x524b5d={},_0xb1265a={},_0x65306b={'count':0x0,'rows':[]};var _0x45441d=_[_0xd7c4('0x17')](db['VoiceExtension'][_0xd7c4('0x22')],function(_0x28d400){return{'name':_0x28d400[_0xd7c4('0x23')],'type':_0x28d400[_0xd7c4('0x1a')][_0xd7c4('0x24')]};});_0xb1265a[_0xd7c4('0x25')]=_[_0xd7c4('0x17')](_0x45441d,_0xd7c4('0x20'));_0xb1265a[_0xd7c4('0x26')]=_[_0xd7c4('0x27')](_0x248bcb[_0xd7c4('0x26')]);_0xb1265a[_0xd7c4('0x28')]=_[_0xd7c4('0x29')](_0xb1265a['model'],_0xb1265a['query']);_0x524b5d[_0xd7c4('0x2a')]=_[_0xd7c4('0x29')](_0xb1265a[_0xd7c4('0x25')],qs['fields'](_0x248bcb[_0xd7c4('0x26')]['fields']));_0x524b5d[_0xd7c4('0x2a')]=_0x524b5d[_0xd7c4('0x2a')][_0xd7c4('0x2b')]?_0x524b5d[_0xd7c4('0x2a')]:_0xb1265a['model'];if(!_0x248bcb[_0xd7c4('0x26')][_0xd7c4('0x2c')]('nolimit')){_0x524b5d[_0xd7c4('0xd')]=qs[_0xd7c4('0xd')](_0x248bcb[_0xd7c4('0x26')][_0xd7c4('0xd')]);_0x524b5d[_0xd7c4('0xb')]=qs['offset'](_0x248bcb['query'][_0xd7c4('0xb')]);}_0x524b5d['order']=qs[_0xd7c4('0x2d')](_0x248bcb['query'][_0xd7c4('0x2d')]);_0x524b5d[_0xd7c4('0x2e')]=qs[_0xd7c4('0x28')](_[_0xd7c4('0x2f')](_0x248bcb[_0xd7c4('0x26')],_0xb1265a['filters']),_0x45441d);if(_0x248bcb[_0xd7c4('0x26')][_0xd7c4('0x15')]){_0x524b5d[_0xd7c4('0x2e')]=_[_0xd7c4('0x30')](_0x524b5d[_0xd7c4('0x2e')],{'$or':_[_0xd7c4('0x17')](_0x45441d,function(_0xc5c3d7){if(_0xc5c3d7[_0xd7c4('0x1a')]!==_0xd7c4('0x31')){var _0x53e4f0={};_0x53e4f0[_0xc5c3d7[_0xd7c4('0x20')]]={'$like':'%'+_0x248bcb[_0xd7c4('0x26')][_0xd7c4('0x15')]+'%'};return _0x53e4f0;}})});}_0x524b5d=_['merge']({},_0x524b5d,_0x248bcb[_0xd7c4('0x32')]);var _0x3cbfda={'where':_0x524b5d[_0xd7c4('0x2e')]};return db[_0xd7c4('0x33')][_0xd7c4('0xe')](_0x3cbfda)['then'](function(_0x1a6bf2){_0x65306b['count']=_0x1a6bf2;if(_0x248bcb[_0xd7c4('0x26')][_0xd7c4('0x34')]){_0x524b5d['include']=[{'all':!![]}];}return db[_0xd7c4('0x33')][_0xd7c4('0x35')](_0x524b5d);})[_0xd7c4('0x1d')](function(_0x410df4){_0x65306b[_0xd7c4('0x36')]=_0x410df4;return _0x65306b;})[_0xd7c4('0x1d')](respondWithFilteredResult(_0x19332e,_0x524b5d))[_0xd7c4('0x37')](handleError(_0x19332e,null));};exports[_0xd7c4('0x38')]=function(_0x1c34b1,_0x4e6c65){var _0x52c1c6={'raw':![],'where':{'id':_0x1c34b1['params']['id']}},_0x461aac={};_0x461aac[_0xd7c4('0x25')]=_[_0xd7c4('0x27')](db[_0xd7c4('0x33')][_0xd7c4('0x22')]);_0x461aac['query']=_[_0xd7c4('0x27')](_0x1c34b1[_0xd7c4('0x26')]);_0x461aac[_0xd7c4('0x28')]=_[_0xd7c4('0x29')](_0x461aac[_0xd7c4('0x25')],_0x461aac[_0xd7c4('0x26')]);_0x52c1c6['attributes']=_[_0xd7c4('0x29')](_0x461aac[_0xd7c4('0x25')],qs[_0xd7c4('0x39')](_0x1c34b1['query'][_0xd7c4('0x39')]));_0x52c1c6[_0xd7c4('0x2a')]=_0x52c1c6[_0xd7c4('0x2a')][_0xd7c4('0x2b')]?_0x52c1c6[_0xd7c4('0x2a')]:_0x461aac[_0xd7c4('0x25')];if(_0x1c34b1[_0xd7c4('0x26')][_0xd7c4('0x34')]){_0x52c1c6['include']=[{'all':!![]}];}_0x52c1c6=_['merge']({},_0x52c1c6,_0x1c34b1[_0xd7c4('0x32')]);return db[_0xd7c4('0x33')][_0xd7c4('0x1b')](_0x52c1c6)[_0xd7c4('0x1d')](handleEntityNotFound(_0x4e6c65,null))[_0xd7c4('0x1d')](respondWithResult(_0x4e6c65,null))[_0xd7c4('0x37')](handleError(_0x4e6c65,null));};exports[_0xd7c4('0x12')]=function(_0x5b9324,_0x5b252a){return db[_0xd7c4('0x33')][_0xd7c4('0x1b')]({'where':{'id':_0x5b9324[_0xd7c4('0x3a')]['id']}})[_0xd7c4('0x1d')](handleEntityNotFound(_0x5b252a,null))[_0xd7c4('0x1d')](removeEntity(_0x5b252a,null))['catch'](handleError(_0x5b252a,null));};exports[_0xd7c4('0x3b')]=function(_0x4ad8e8,_0xaf5d36){if(_0x4ad8e8['body'][_0xd7c4('0x1a')]==='outbound'&&!_['startsWith'](_0x4ad8e8[_0xd7c4('0x3c')][_0xd7c4('0x3d')],'_')){_0x4ad8e8['body'][_0xd7c4('0x3d')]='_'[_0xd7c4('0x3e')](_0x4ad8e8[_0xd7c4('0x3c')][_0xd7c4('0x3d')]);}return db[_0xd7c4('0x33')][_0xd7c4('0x3b')](_0x4ad8e8['body'],{'raw':![]})[_0xd7c4('0x1d')](function(_0x1ef952){var _0x3329e3=_0x4ad8e8[_0xd7c4('0x3f')][_0xd7c4('0x40')]({'plain':!![]});if(!_0x3329e3)throw new Error(_0xd7c4('0x41'));if(_0x3329e3[_0xd7c4('0x42')]===_0xd7c4('0x3f')){var _0x3a5474=_0x1ef952[_0xd7c4('0x40')]({'plain':!![]});var _0x493f1f=[{'name':_0xd7c4('0x43'),'value':_0xd7c4('0x44')},{'name':_0xd7c4('0x13'),'value':'outbound'},{'name':_0xd7c4('0x14'),'value':'internal'}];var _0x4da647=_['find'](_0x493f1f,[_0xd7c4('0x18'),_0x3a5474[_0xd7c4('0x1a')]])[_0xd7c4('0x20')];return db['UserProfileSection']['find']({'where':{'name':_0x4da647,'userProfileId':_0x3329e3[_0xd7c4('0x45')]},'raw':!![]})['then'](function(_0x3e9412){if(_0x3e9412&&_0x3e9412[_0xd7c4('0x46')]===0x0){return db['UserProfileResource'][_0xd7c4('0x3b')]({'name':_0x3a5474['name'],'resourceId':_0x3a5474['id'],'type':_0x3e9412['name'],'sectionId':_0x3e9412['id']},{})['then'](function(){return _0x1ef952;});}else{return _0x1ef952;}})[_0xd7c4('0x37')](function(_0xef7983){logger[_0xd7c4('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xef7983);throw _0xef7983;});}return _0x1ef952;})['then'](respondWithResult(_0xaf5d36,0xc9))[_0xd7c4('0x37')](handleError(_0xaf5d36,null));};exports[_0xd7c4('0x47')]=function(_0x4bfe60,_0x5f0fad){if(_0x4bfe60[_0xd7c4('0x3c')]['id']){delete _0x4bfe60[_0xd7c4('0x3c')]['id'];}return db[_0xd7c4('0x33')][_0xd7c4('0x1b')]({'where':{'id':_0x4bfe60[_0xd7c4('0x3a')]['id']}})[_0xd7c4('0x1d')](handleEntityNotFound(_0x5f0fad,null))['then'](function(_0x1c38b3){if(_0x1c38b3){return db[_0xd7c4('0x33')]['update'](_['pick'](_0x4bfe60[_0xd7c4('0x3c')],['exten',_0xd7c4('0x48'),'description',_0xd7c4('0x49'),_0xd7c4('0x4a'),_0xd7c4('0x4b'),_0xd7c4('0x4c')]),{'where':{'context':_0x1c38b3[_0xd7c4('0x48')],'exten':_0x1c38b3['exten']},'individualHooks':!![]})['then'](function(_0x2a97bf){return _0x2a97bf;});}return null;})[_0xd7c4('0x1d')](respondWithStatusCode(_0x5f0fad,null))[_0xd7c4('0x37')](handleError(_0x5f0fad,null));};exports[_0xd7c4('0x4d')]=function(_0x23ca0f,_0x3d693c){var _0x440d43=_0x23ca0f[_0xd7c4('0x3a')]['id'];var _0x337a7e=_0x23ca0f[_0xd7c4('0x3c')];var _0x33af6f=0xc8;var _0x526981=null;return db[_0xd7c4('0x4e')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xd7c4('0x4f')]['READ_COMMITTED']},function(_0x4cda03){return db[_0xd7c4('0x33')][_0xd7c4('0x50')]({'where':{'id':_0x440d43},'transaction':_0x4cda03})[_0xd7c4('0x1d')](function(_0x3604bf){if(_0x3604bf){return db[_0xd7c4('0x33')]['destroy']({'where':{'VoiceExtensionId':_0x440d43},'transaction':_0x4cda03})[_0xd7c4('0x1d')](function(){var _0x54eaf7=_[_0xd7c4('0x17')](_0x337a7e,function(_0xfa40e2){_0xfa40e2[_0xd7c4('0x51')]=_0x440d43;_0xfa40e2[_0xd7c4('0x52')]=!![];return _0xfa40e2;});return _0x3604bf[_0xd7c4('0x53')](_0x54eaf7);})[_0xd7c4('0x1d')](function(_0x1c8f70){return db[_0xd7c4('0x33')][_0xd7c4('0x54')](_0x1c8f70,{'transaction':_0x4cda03});});}else{_0x33af6f=0x194;_0x526981=[];}});})[_0xd7c4('0x1d')](function(){if(_0x33af6f!==0x194){return db[_0xd7c4('0x33')][_0xd7c4('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x440d43},'order':_0xd7c4('0x56')})[_0xd7c4('0x1d')](function(_0x53f286){_0x526981=_0x53f286;});}})[_0xd7c4('0x37')](function(_0x3bd237){_0x33af6f=0x1f4;logger[_0xd7c4('0x1f')](_0x3bd237['stack']);if(_0x3bd237[_0xd7c4('0x20')]){delete _0x3bd237[_0xd7c4('0x20')];}_0x526981=_0x3bd237;})[_0xd7c4('0x57')](function(){if(_0x526981===null){_0x3d693c[_0xd7c4('0x1e')](_0x33af6f);}else{if(_0x33af6f===0x1f4){_0x3d693c[_0xd7c4('0x58')](_0x33af6f)[_0xd7c4('0x59')](_0x526981);}else{_0x3d693c['status'](_0x33af6f)[_0xd7c4('0x11')](_0x526981);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 5bd9a86..aa006a1 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 _0x8a35=['emit','hasOwnProperty','hook','events','VoiceExtension','setMaxListeners','update'];(function(_0x30a956,_0x11222e){var _0x2ac17d=function(_0x3be1d2){while(--_0x3be1d2){_0x30a956['push'](_0x30a956['shift']());}};_0x2ac17d(++_0x11222e);}(_0x8a35,0xff));var _0x58a3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8a35[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x58a3('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x58a3('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x58a3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x58a3('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1a2063){return function(_0xe18545,_0x8924c2,_0x7103e6){VoiceExtensionEvents[_0x58a3('0x4')](_0x1a2063+':'+_0xe18545['id'],_0xe18545);VoiceExtensionEvents[_0x58a3('0x4')](_0x1a2063,_0xe18545);_0x7103e6(null);};}for(var e in events){if(events[_0x58a3('0x5')](e)){var event=events[e];VoiceExtension[_0x58a3('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xe39f=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x13020f,_0x190737){var _0x1151df=function(_0xf4b55e){while(--_0xf4b55e){_0x13020f['push'](_0x13020f['shift']());}};_0x1151df(++_0x190737);}(_0xe39f,0xb1));var _0xfe39=function(_0x41c44d,_0x31d1eb){_0x41c44d=_0x41c44d-0x0;var _0x5e00f5=_0xe39f[_0x41c44d];return _0x5e00f5;};'use strict';var EventEmitter=require(_0xfe39('0x0'));var VoiceExtension=require(_0xfe39('0x1'))['db'][_0xfe39('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xfe39('0x3')](0x0);var events={'afterCreate':_0xfe39('0x4'),'afterUpdate':_0xfe39('0x5'),'afterDestroy':_0xfe39('0x6')};function emitEvent(_0x22a160){return function(_0x34d58b,_0x4c3daf,_0xbed21){VoiceExtensionEvents[_0xfe39('0x7')](_0x22a160+':'+_0x34d58b['id'],_0x34d58b);VoiceExtensionEvents['emit'](_0x22a160,_0x34d58b);_0xbed21(null);};}for(var e in events){if(events[_0xfe39('0x8')](e)){var event=events[e];VoiceExtension[_0xfe39('0x9')](e,emitEvent(event));}}module[_0xfe39('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 2ef6760..2148855 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 _0x6c21=['define','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','split','phone','prefix','param','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch'];(function(_0x1e8645,_0x2fff3b){var _0x5f1146=function(_0x3396a8){while(--_0x3396a8){_0x1e8645['push'](_0x1e8645['shift']());}};_0x5f1146(++_0x2fff3b);}(_0x6c21,0x1b2));var _0x16c2=function(_0x5202e8,_0x2446f9){_0x5202e8=_0x5202e8-0x0;var _0x2d9ee9=_0x6c21[_0x5202e8];return _0x2d9ee9;};'use strict';var _=require(_0x16c2('0x0'));var attributes=require(_0x16c2('0x1'));module[_0x16c2('0x2')]=function(_0x2c3d62){var _0x576ea4=_0x2c3d62[_0x16c2('0x3')];function _0x2019f9(_0x32c4cf){var _0x55dcd4=0x2;var _0x26204f=[{'type':_0x32c4cf['type'],'app':_0x16c2('0x4'),'appdata':_0x16c2('0x5')+_0x32c4cf[_0x16c2('0x6')],'context':_0x32c4cf[_0x16c2('0x7')],'exten':_0x32c4cf[_0x16c2('0x8')],'priority':_0x55dcd4++,'VoiceExtensionId':_0x32c4cf['id']},{'type':_0x32c4cf[_0x16c2('0x6')],'app':_0x32c4cf[_0x16c2('0x9')]?_0x16c2('0x4'):_0x16c2('0xa'),'appdata':_0x32c4cf[_0x16c2('0x9')]?_0x16c2('0xb')+_0x32c4cf[_0x16c2('0x9')]:'No\x20alias\x20set','context':_0x32c4cf[_0x16c2('0x7')],'exten':_0x32c4cf[_0x16c2('0x8')],'priority':_0x55dcd4++,'VoiceExtensionId':_0x32c4cf['id']}];if(_0x32c4cf['type']===_0x16c2('0xc')){_0x26204f[_0x16c2('0xd')]({'type':_0x16c2('0xc'),'app':'Set','appdata':_0x16c2('0xe')+_0x32c4cf['id'],'context':_0x32c4cf[_0x16c2('0x7')],'exten':_0x32c4cf['exten'],'priority':_0x55dcd4++,'VoiceExtensionId':_0x32c4cf['id']});}_0x26204f[_0x16c2('0xd')]({'type':_0x32c4cf[_0x16c2('0x6')],'app':_0x16c2('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x32c4cf[_0x16c2('0x7')],'exten':_0x32c4cf[_0x16c2('0x8')],'priority':_0x55dcd4++,'VoiceExtensionId':_0x32c4cf['id']},{'type':_0x32c4cf[_0x16c2('0x6')],'app':'Set','appdata':_0x16c2('0xf'),'context':_0x32c4cf[_0x16c2('0x7')],'exten':_0x32c4cf[_0x16c2('0x8')],'priority':_0x55dcd4++,'VoiceExtensionId':_0x32c4cf['id']},{'type':_0x32c4cf['type'],'app':'Set','appdata':_0x16c2('0x10'),'context':_0x32c4cf[_0x16c2('0x7')],'exten':_0x32c4cf['exten'],'priority':_0x55dcd4++,'VoiceExtensionId':_0x32c4cf['id']});return _0x26204f;}function _0x3a7fd1(_0x5808d3){var _0x387a17=0x2;var _0x1a88e3=[{'type':_0x16c2('0x11'),'app':_0x16c2('0x4'),'appdata':_0x16c2('0x12'),'context':_0x5808d3['context'],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']},{'type':_0x16c2('0x11'),'app':_0x5808d3[_0x16c2('0x9')]?'Set':_0x16c2('0xa'),'appdata':_0x5808d3['alias']?_0x16c2('0xb')+_0x5808d3['alias']:_0x16c2('0x13'),'context':_0x5808d3['context'],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']},{'type':_0x16c2('0x11'),'app':_0x16c2('0x4'),'appdata':_0x16c2('0x14')+(_0x5808d3['cutdigits']?_0x16c2('0x15')+_0x5808d3[_0x16c2('0x16')]+'}':_0x16c2('0x17')),'context':_0x5808d3[_0x16c2('0x7')],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']},{'type':_0x16c2('0x11'),'app':_0x16c2('0x4'),'appdata':_0x16c2('0xe')+_0x5808d3['id'],'context':_0x5808d3['context'],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']},{'type':_0x16c2('0x11'),'app':_0x16c2('0x18'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x387a17+0x2)+_0x16c2('0x19')+(_0x387a17+0x1)+')','context':_0x5808d3['context'],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']},{'type':_0x16c2('0x11'),'app':'Set','appdata':_0x5808d3[_0x16c2('0x16')]?_0x16c2('0x1a')+_0x5808d3[_0x16c2('0x16')]+'}':_0x16c2('0x1b'),'context':_0x5808d3[_0x16c2('0x7')],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']},{'type':_0x16c2('0x11'),'app':_0x16c2('0x4'),'appdata':_0x16c2('0x1c'),'context':_0x5808d3[_0x16c2('0x7')],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']},{'type':_0x16c2('0x11'),'app':_0x16c2('0x4'),'appdata':_0x16c2('0xf'),'context':_0x5808d3[_0x16c2('0x7')],'exten':_0x5808d3['exten'],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']},{'type':_0x16c2('0x11'),'app':_0x16c2('0x4'),'appdata':_0x16c2('0x10'),'context':_0x5808d3['context'],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']},{'type':_0x16c2('0x11'),'app':_0x16c2('0x4'),'appdata':'outboundrouteid='+_0x5808d3['id'],'context':_0x5808d3['context'],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']}];if(_0x5808d3[_0x16c2('0x1d')](_0x16c2('0x1e'))&&_0x5808d3[_0x16c2('0x1e')]!=='none'){_0x1a88e3['push']({'type':'outbound','app':_0x16c2('0x4'),'appdata':_0x16c2('0x1f'),'context':_0x5808d3['context'],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']},{'type':_0x16c2('0x11'),'app':'Set','appdata':_0x16c2('0x20')+_0x5808d3[_0x16c2('0x1e')]||_0x16c2('0x21'),'context':_0x5808d3[_0x16c2('0x7')],'exten':_0x5808d3[_0x16c2('0x8')],'priority':_0x387a17++,'VoiceExtensionId':_0x5808d3['id']});}return _0x1a88e3;}function _0x515172(_0x492da5,_0x33e0dc){var _0x1fd885=[{'name':_0x16c2('0x22'),'param':0x0},{'name':_0x16c2('0x23'),'param':0x1},{'name':_0x16c2('0x24'),'param':0x2},{'name':_0x16c2('0x25'),'param':0x3}];var _0x426370={};var _0x17e8dc=_0x33e0dc['split'](',');var _0x2a1552=[];for(var _0x5d25b4=0x0;_0x5d25b4<_0x1fd885[_0x16c2('0x26')];_0x5d25b4++){switch(_0x1fd885[_0x5d25b4]['name']){case _0x16c2('0x22'):_0x426370[_0x16c2('0x22')]=_0x17e8dc[_0x1fd885[_0x5d25b4]['param']]['split']('/')[0x1];_0x426370['phone']=_0x17e8dc[_0x1fd885[_0x5d25b4]['param']][_0x16c2('0x27')]('/')[0x2];_0x426370['prefix']=_0x426370[_0x16c2('0x28')]?_0x426370[_0x16c2('0x28')]['split']('$')[0x0]:undefined;_0x426370[_0x16c2('0x28')]=_0x492da5['cutdigits']?(_0x426370[_0x16c2('0x29')]||'')+'${EXTEN:'+_0x492da5['cutdigits']+'}':(_0x426370[_0x16c2('0x29')]||'')+_0x16c2('0x17');_0x2a1552[_0x1fd885[_0x5d25b4][_0x16c2('0x2a')]]=[_0x16c2('0x2b'),_0x426370[_0x16c2('0x22')],_0x426370[_0x16c2('0x28')]][_0x16c2('0x2c')]('/');break;case _0x16c2('0x24'):_0x426370[_0x16c2('0x24')]=_0x17e8dc[_0x1fd885[_0x5d25b4][_0x16c2('0x2a')]];if(_0x492da5[_0x16c2('0x1e')]!==_0x16c2('0x2d')){if(_0x426370[_0x16c2('0x24')][_0x16c2('0x2e')](_0x16c2('0x2f'))<0x0){_0x426370[_0x16c2('0x24')]+='U(xcally-mixmonitor-context)';}}else{_0x426370['options']=_0x426370['options'][_0x16c2('0x30')](_0x16c2('0x2f'),'');}_0x2a1552[_0x1fd885[_0x5d25b4][_0x16c2('0x2a')]]=_0x426370[_0x16c2('0x24')];break;default:_0x2a1552[_0x1fd885[_0x5d25b4][_0x16c2('0x2a')]]=_0x17e8dc[_0x1fd885[_0x5d25b4][_0x16c2('0x2a')]];}}return _0x2a1552['join'](',');}function _0x5f2f5c(_0x3a0c74,_0x28a42e,_0x1c3ec9){return new Promise(function(_0x3813fc,_0x112f41){var _0x4e74a8=[];if(_[_0x16c2('0x31')](_0x28a42e))return _0x3813fc(_0x4e74a8);_0x576ea4[_0x16c2('0x32')]['findAll']({'attributes':['id',_0x16c2('0x33'),_0x16c2('0x34')],'raw':!![]})[_0x16c2('0x35')](function(_0x1098b4){for(var _0x23f471=0x0,_0x2be382=0x0;_0x23f471<_0x28a42e['length'];_0x23f471++,_0x2be382=0x0){var _0x1f1977=_0x28a42e[_0x23f471];var _0x201b99=[];var _0x2bcc9b=[];delete _0x1f1977['id'];if(_0x1f1977[_0x16c2('0x33')]!=='*,*,*,*'){_0x1f1977[_0x16c2('0x36')]=[_0x1f1977[_0x16c2('0x33')]];}else{_0x1f1977[_0x16c2('0x36')]=_0x1f1977[_0x16c2('0x34')]?_[_0x16c2('0x37')](_[_0x16c2('0x38')](_0x1098b4,{'IntervalId':_0x1f1977[_0x16c2('0x34')]}),'interval'):[];}_0x1f1977[_0x16c2('0x7')]=_0x3a0c74['context'];_0x1f1977[_0x16c2('0x8')]=_0x3a0c74[_0x16c2('0x8')];if(_0x1f1977[_0x16c2('0x6')])_0x1f1977['type']=_0x1f1977[_0x16c2('0x6')][_0x16c2('0x39')]();if(_0x3a0c74['type']==='outbound'){if(_0x1f1977['hasOwnProperty'](_0x16c2('0x3a'))&&_0x1f1977[_0x16c2('0x3a')]&&_0x1f1977['tag']!=='--'){_0x201b99[_0x16c2('0xd')]({'type':_0x1f1977[_0x16c2('0x6')]['toLowerCase'](),'app':'Set','appdata':_0x16c2('0x3b')+_0x1f1977[_0x16c2('0x3a')],'context':_0x3a0c74[_0x16c2('0x7')],'exten':_0x3a0c74[_0x16c2('0x8')],'priority':_0x1f1977['intervals'][_0x16c2('0x26')]+_0x1c3ec9+_0x2be382++,'VoiceExtensionId':_0x3a0c74['id']});}_0x201b99['push']({'type':_0x1f1977[_0x16c2('0x6')][_0x16c2('0x39')](),'app':_0x16c2('0x18'),'appdata':_0x16c2('0x3c')+(_0x1f1977[_0x16c2('0x3d')]?_0x16c2('0x3e')+_0x1f1977[_0x16c2('0x3d')]+')':_0x16c2('0x3f')),'context':_0x3a0c74[_0x16c2('0x7')],'exten':_0x3a0c74[_0x16c2('0x8')],'priority':_0x1f1977[_0x16c2('0x36')][_0x16c2('0x26')]+_0x1c3ec9+_0x2be382++,'VoiceExtensionId':_0x3a0c74['id']});}else{if(_0x1f1977[_0x16c2('0x1d')](_0x16c2('0x40'))){if([_0x16c2('0x41'),_0x16c2('0x42')][_0x16c2('0x43')](_0x1f1977[_0x16c2('0x44')]['toLowerCase']())&&_0x1f1977['appType']!==_0x16c2('0x45')){if(_0x1f1977[_0x16c2('0x40')]){_0x201b99[_0x16c2('0xd')]({'type':_0x1f1977[_0x16c2('0x6')][_0x16c2('0x39')](),'app':'ExecIf','appdata':_0x16c2('0x46'),'context':_0x3a0c74[_0x16c2('0x7')],'exten':_0x3a0c74[_0x16c2('0x8')],'priority':_0x1f1977['intervals'][_0x16c2('0x26')]+_0x1c3ec9+_0x2be382++,'VoiceExtensionId':_0x3a0c74['id']});_0x201b99['push']({'type':_0x1f1977[_0x16c2('0x6')][_0x16c2('0x39')](),'app':_0x16c2('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3a0c74[_0x16c2('0x7')],'exten':_0x3a0c74[_0x16c2('0x8')],'priority':_0x1f1977[_0x16c2('0x36')]['length']+_0x1c3ec9+_0x2be382++,'VoiceExtensionId':_0x3a0c74['id']});}else{_0x201b99['push']({'type':_0x1f1977[_0x16c2('0x6')][_0x16c2('0x39')](),'app':_0x16c2('0x18'),'appdata':_0x16c2('0x47'),'context':_0x3a0c74[_0x16c2('0x7')],'exten':_0x3a0c74[_0x16c2('0x8')],'priority':_0x1f1977[_0x16c2('0x36')]['length']+_0x1c3ec9+_0x2be382++,'VoiceExtensionId':_0x3a0c74['id']});_0x201b99[_0x16c2('0xd')]({'type':_0x1f1977[_0x16c2('0x6')][_0x16c2('0x39')](),'app':_0x16c2('0x4'),'appdata':_0x16c2('0x48'),'context':_0x3a0c74[_0x16c2('0x7')],'exten':_0x3a0c74['exten'],'priority':_0x1f1977[_0x16c2('0x36')][_0x16c2('0x26')]+_0x1c3ec9+_0x2be382++,'VoiceExtensionId':_0x3a0c74['id']});}}}}for(var _0x450019=0x0;_0x450019<_0x1f1977['intervals']['length'];_0x450019++){var _0x52cac5=_0x1c3ec9+_0x1f1977['intervals'][_0x16c2('0x26')];var _0x5a5f3b=_0x450019===_0x1f1977['intervals'][_0x16c2('0x26')]-0x1?_0x1c3ec9+_0x201b99[_0x16c2('0x26')]+_0x2bcc9b[_0x16c2('0x26')]+0x2:_0x1c3ec9+_0x450019+0x1;_0x201b99['splice'](_0x450019,0x0,{'type':_0x3a0c74[_0x16c2('0x6')],'app':_0x16c2('0x49'),'appdata':_0x1f1977['intervals'][_0x450019]+'?'+_0x3a0c74['context']+_0x16c2('0x4a')+_0x52cac5+':'+_0x3a0c74[_0x16c2('0x7')]+_0x16c2('0x4a')+_0x5a5f3b,'exten':_0x3a0c74[_0x16c2('0x8')],'context':_0x3a0c74['context'],'priority':_0x1c3ec9+_0x450019,'VoiceExtensionId':_0x3a0c74['id']});}if(_0x1f1977[_0x16c2('0x4b')]===_0x16c2('0x4c'))_0x1f1977[_0x16c2('0x4d')]=_0x515172(_0x3a0c74,_0x1f1977[_0x16c2('0x4d')]);_0x1f1977[_0x16c2('0x4e')]=_0x201b99[_0x16c2('0x26')]?_[_0x16c2('0x4f')](_0x201b99)[_0x16c2('0x4e')]+0x1:_0x1c3ec9;_0x4e74a8=_[_0x16c2('0x50')](_0x4e74a8,_0x201b99,[_0x1f1977],_0x2bcc9b);_0x1c3ec9=_['last'](_0x4e74a8)[_0x16c2('0x4e')]+0x1;}return _0x3813fc(_0x4e74a8);})[_0x16c2('0x51')](function(_0x475f3f){_0x112f41(_0x475f3f);});});}return _0x2c3d62[_0x16c2('0x52')](_0x16c2('0x53'),attributes,{'tableName':_0x16c2('0x54'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3f5675){var _0x329769=this['get']({'plain':!![]});var _0xeb24b6=_0x329769[_0x16c2('0x6')]===_0x16c2('0x11')?_0x3a7fd1(_0x329769):_0x2019f9(_0x329769);return _0x5f2f5c(_0x329769,_0x3f5675,_[_0x16c2('0x4f')](_0xeb24b6)[_0x16c2('0x4e')]+0x1)[_0x16c2('0x35')](function(_0xb4d2df){var _0x220582=_[_0x16c2('0x50')](_0xeb24b6,_0xb4d2df);_0x220582[_0x16c2('0xd')]({'type':_0x329769[_0x16c2('0x6')],'app':_0x16c2('0x55'),'exten':_0x329769[_0x16c2('0x8')],'context':_0x329769[_0x16c2('0x7')],'priority':_[_0x16c2('0x4f')](_0x220582)[_0x16c2('0x4e')]+0x1,'VoiceExtensionId':_0x329769['id']});return _0x220582;});}}});}; \ No newline at end of file +var _0xe9e7=['appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','Set','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','url','split','param','phone','prefix','${EXTEN:','SIP','options','none','indexOf','U(xcally-mixmonitor-context)','replace','join','interval','IntervalId','then','length','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial'];(function(_0x3ffa2a,_0x2aeefe){var _0x5e3246=function(_0xa4b6db){while(--_0xa4b6db){_0x3ffa2a['push'](_0x3ffa2a['shift']());}};_0x5e3246(++_0x2aeefe);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x55e9d0,_0x3c2653){_0x55e9d0=_0x55e9d0-0x0;var _0x18eeff=_0xe9e7[_0x55e9d0];return _0x18eeff;};'use strict';var _=require(_0x7e9e('0x0'));var attributes=require(_0x7e9e('0x1'));module[_0x7e9e('0x2')]=function(_0x4d5fa1){var _0x1fd5fc=_0x4d5fa1[_0x7e9e('0x3')];function _0x108c11(_0x132bd3){var _0x410b21=0x2;var _0x18bf13=[{'type':_0x132bd3[_0x7e9e('0x4')],'app':'Set','appdata':_0x7e9e('0x5')+_0x132bd3[_0x7e9e('0x4')],'context':_0x132bd3[_0x7e9e('0x6')],'exten':_0x132bd3['exten'],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']},{'type':_0x132bd3[_0x7e9e('0x4')],'app':_0x132bd3['alias']?_0x7e9e('0x7'):_0x7e9e('0x8'),'appdata':_0x132bd3[_0x7e9e('0x9')]?_0x7e9e('0xa')+_0x132bd3[_0x7e9e('0x9')]:_0x7e9e('0xb'),'context':_0x132bd3[_0x7e9e('0x6')],'exten':_0x132bd3[_0x7e9e('0xc')],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']}];if(_0x132bd3[_0x7e9e('0x4')]===_0x7e9e('0xd')){_0x18bf13[_0x7e9e('0xe')]({'type':_0x7e9e('0xd'),'app':'Set','appdata':'CDR(routeid)='+_0x132bd3['id'],'context':_0x132bd3['context'],'exten':_0x132bd3[_0x7e9e('0xc')],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']});}_0x18bf13[_0x7e9e('0xe')]({'type':_0x132bd3[_0x7e9e('0x4')],'app':_0x7e9e('0x7'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x132bd3['context'],'exten':_0x132bd3[_0x7e9e('0xc')],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']},{'type':_0x132bd3[_0x7e9e('0x4')],'app':_0x7e9e('0x7'),'appdata':_0x7e9e('0xf'),'context':_0x132bd3[_0x7e9e('0x6')],'exten':_0x132bd3[_0x7e9e('0xc')],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']},{'type':_0x132bd3[_0x7e9e('0x4')],'app':'Set','appdata':_0x7e9e('0x10'),'context':_0x132bd3['context'],'exten':_0x132bd3[_0x7e9e('0xc')],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']});return _0x18bf13;}function _0xfc5f48(_0x45e55c){var _0x1d973c=0x2;var _0x35af37=[{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x7'),'appdata':'CDR(type)=outbound','context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':'outbound','app':_0x45e55c['alias']?_0x7e9e('0x7'):'NoOp','appdata':_0x45e55c['alias']?_0x7e9e('0xa')+_0x45e55c[_0x7e9e('0x9')]:_0x7e9e('0xb'),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x7'),'appdata':_0x7e9e('0x12')+(_0x45e55c[_0x7e9e('0x13')]?'${EXTEN:'+_0x45e55c[_0x7e9e('0x13')]+'}':_0x7e9e('0x14')),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':'outbound','app':_0x7e9e('0x7'),'appdata':_0x7e9e('0x15')+_0x45e55c['id'],'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x16'),'appdata':_0x7e9e('0x17')+(_0x1d973c+0x2)+'):Goto('+(_0x1d973c+0x1)+')','context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x7'),'appdata':_0x45e55c['cutdigits']?_0x7e9e('0x18')+_0x45e55c[_0x7e9e('0x13')]+'}':_0x7e9e('0x19'),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c['exten'],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':'Set','appdata':_0x7e9e('0x1a'),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x7'),'appdata':_0x7e9e('0xf'),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':'outbound','app':'Set','appdata':_0x7e9e('0x10'),'context':_0x45e55c['context'],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':'Set','appdata':'outboundrouteid='+_0x45e55c['id'],'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']}];if(_0x45e55c['hasOwnProperty']('recordingFormat')&&_0x45e55c[_0x7e9e('0x1b')]!=='none'){_0x35af37[_0x7e9e('0xe')]({'type':_0x7e9e('0x11'),'app':'Set','appdata':_0x7e9e('0x1c'),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c['exten'],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x7'),'appdata':_0x7e9e('0x1d')+_0x45e55c[_0x7e9e('0x1b')]||'wav','context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c['exten'],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']});}return _0x35af37;}function _0xa26e82(_0xd37409,_0x2c7881){var _0x244ae9=[{'name':_0x7e9e('0x1e'),'param':0x0},{'name':_0x7e9e('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x7e9e('0x20'),'param':0x3}];var _0x5878e3={};var _0x26317c=_0x2c7881[_0x7e9e('0x21')](',');var _0x19fb3b=[];for(var _0x5e8aa7=0x0;_0x5e8aa7<_0x244ae9['length'];_0x5e8aa7++){switch(_0x244ae9[_0x5e8aa7]['name']){case _0x7e9e('0x1e'):_0x5878e3[_0x7e9e('0x1e')]=_0x26317c[_0x244ae9[_0x5e8aa7][_0x7e9e('0x22')]][_0x7e9e('0x21')]('/')[0x1];_0x5878e3['phone']=_0x26317c[_0x244ae9[_0x5e8aa7][_0x7e9e('0x22')]]['split']('/')[0x2];_0x5878e3['prefix']=_0x5878e3[_0x7e9e('0x23')]?_0x5878e3[_0x7e9e('0x23')][_0x7e9e('0x21')]('$')[0x0]:undefined;_0x5878e3['phone']=_0xd37409[_0x7e9e('0x13')]?(_0x5878e3[_0x7e9e('0x24')]||'')+_0x7e9e('0x25')+_0xd37409['cutdigits']+'}':(_0x5878e3[_0x7e9e('0x24')]||'')+_0x7e9e('0x14');_0x19fb3b[_0x244ae9[_0x5e8aa7][_0x7e9e('0x22')]]=[_0x7e9e('0x26'),_0x5878e3[_0x7e9e('0x1e')],_0x5878e3['phone']]['join']('/');break;case _0x7e9e('0x27'):_0x5878e3[_0x7e9e('0x27')]=_0x26317c[_0x244ae9[_0x5e8aa7]['param']];if(_0xd37409[_0x7e9e('0x1b')]!==_0x7e9e('0x28')){if(_0x5878e3[_0x7e9e('0x27')][_0x7e9e('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x5878e3[_0x7e9e('0x27')]+=_0x7e9e('0x2a');}}else{_0x5878e3['options']=_0x5878e3[_0x7e9e('0x27')][_0x7e9e('0x2b')](_0x7e9e('0x2a'),'');}_0x19fb3b[_0x244ae9[_0x5e8aa7][_0x7e9e('0x22')]]=_0x5878e3['options'];break;default:_0x19fb3b[_0x244ae9[_0x5e8aa7]['param']]=_0x26317c[_0x244ae9[_0x5e8aa7][_0x7e9e('0x22')]];}}return _0x19fb3b[_0x7e9e('0x2c')](',');}function _0x29edfb(_0xd7c825,_0x54a160,_0x68bb1f){return new Promise(function(_0x10bdab,_0x123e6f){var _0x120bbc=[];if(_['isEmpty'](_0x54a160))return _0x10bdab(_0x120bbc);_0x1fd5fc['Interval']['findAll']({'attributes':['id',_0x7e9e('0x2d'),_0x7e9e('0x2e')],'raw':!![]})[_0x7e9e('0x2f')](function(_0x46cf93){for(var _0x2c3fce=0x0,_0x2d70ed=0x0;_0x2c3fce<_0x54a160[_0x7e9e('0x30')];_0x2c3fce++,_0x2d70ed=0x0){var _0x4dbf2a=_0x54a160[_0x2c3fce];var _0xf57087=[];var _0x181d33=[];delete _0x4dbf2a['id'];if(_0x4dbf2a[_0x7e9e('0x2d')]!=='*,*,*,*'){_0x4dbf2a['intervals']=[_0x4dbf2a[_0x7e9e('0x2d')]];}else{_0x4dbf2a[_0x7e9e('0x31')]=_0x4dbf2a[_0x7e9e('0x2e')]?_[_0x7e9e('0x32')](_[_0x7e9e('0x33')](_0x46cf93,{'IntervalId':_0x4dbf2a[_0x7e9e('0x2e')]}),_0x7e9e('0x2d')):[];}_0x4dbf2a[_0x7e9e('0x6')]=_0xd7c825[_0x7e9e('0x6')];_0x4dbf2a[_0x7e9e('0xc')]=_0xd7c825[_0x7e9e('0xc')];if(_0x4dbf2a[_0x7e9e('0x4')])_0x4dbf2a[_0x7e9e('0x4')]=_0x4dbf2a['type'][_0x7e9e('0x34')]();if(_0xd7c825[_0x7e9e('0x4')]===_0x7e9e('0x11')){if(_0x4dbf2a[_0x7e9e('0x35')](_0x7e9e('0x36'))&&_0x4dbf2a[_0x7e9e('0x36')]&&_0x4dbf2a[_0x7e9e('0x36')]!=='--'){_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a[_0x7e9e('0x4')][_0x7e9e('0x34')](),'app':'Set','appdata':_0x7e9e('0x37')+_0x4dbf2a[_0x7e9e('0x36')],'context':_0xd7c825['context'],'exten':_0xd7c825[_0x7e9e('0xc')],'priority':_0x4dbf2a[_0x7e9e('0x31')][_0x7e9e('0x30')]+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});}_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a[_0x7e9e('0x4')][_0x7e9e('0x34')](),'app':_0x7e9e('0x16'),'appdata':_0x7e9e('0x38')+(_0x4dbf2a[_0x7e9e('0x39')]?_0x7e9e('0x3a')+_0x4dbf2a[_0x7e9e('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0xd7c825[_0x7e9e('0x6')],'exten':_0xd7c825[_0x7e9e('0xc')],'priority':_0x4dbf2a[_0x7e9e('0x31')]['length']+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});}else{if(_0x4dbf2a[_0x7e9e('0x35')](_0x7e9e('0x3b'))){if([_0x7e9e('0x3c'),_0x7e9e('0x3d')][_0x7e9e('0x3e')](_0x4dbf2a[_0x7e9e('0x3f')][_0x7e9e('0x34')]())&&_0x4dbf2a[_0x7e9e('0x40')]!==_0x7e9e('0x41')){if(_0x4dbf2a[_0x7e9e('0x3b')]){_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a[_0x7e9e('0x4')]['toLowerCase'](),'app':_0x7e9e('0x16'),'appdata':_0x7e9e('0x42'),'context':_0xd7c825[_0x7e9e('0x6')],'exten':_0xd7c825[_0x7e9e('0xc')],'priority':_0x4dbf2a[_0x7e9e('0x31')][_0x7e9e('0x30')]+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a['type'][_0x7e9e('0x34')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0xd7c825[_0x7e9e('0x6')],'exten':_0xd7c825[_0x7e9e('0xc')],'priority':_0x4dbf2a['intervals'][_0x7e9e('0x30')]+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});}else{_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a[_0x7e9e('0x4')][_0x7e9e('0x34')](),'app':_0x7e9e('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xd7c825['context'],'exten':_0xd7c825['exten'],'priority':_0x4dbf2a[_0x7e9e('0x31')][_0x7e9e('0x30')]+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a[_0x7e9e('0x4')][_0x7e9e('0x34')](),'app':'Set','appdata':_0x7e9e('0x43'),'context':_0xd7c825[_0x7e9e('0x6')],'exten':_0xd7c825[_0x7e9e('0xc')],'priority':_0x4dbf2a[_0x7e9e('0x31')]['length']+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});}}}}for(var _0x5d41f6=0x0;_0x5d41f6<_0x4dbf2a['intervals'][_0x7e9e('0x30')];_0x5d41f6++){var _0x3c5be4=_0x68bb1f+_0x4dbf2a[_0x7e9e('0x31')]['length'];var _0x2a43e6=_0x5d41f6===_0x4dbf2a['intervals'][_0x7e9e('0x30')]-0x1?_0x68bb1f+_0xf57087[_0x7e9e('0x30')]+_0x181d33[_0x7e9e('0x30')]+0x2:_0x68bb1f+_0x5d41f6+0x1;_0xf57087[_0x7e9e('0x44')](_0x5d41f6,0x0,{'type':_0xd7c825[_0x7e9e('0x4')],'app':'GotoIfTime','appdata':_0x4dbf2a['intervals'][_0x5d41f6]+'?'+_0xd7c825[_0x7e9e('0x6')]+_0x7e9e('0x45')+_0x3c5be4+':'+_0xd7c825[_0x7e9e('0x6')]+_0x7e9e('0x45')+_0x2a43e6,'exten':_0xd7c825['exten'],'context':_0xd7c825['context'],'priority':_0x68bb1f+_0x5d41f6,'VoiceExtensionId':_0xd7c825['id']});}if(_0x4dbf2a[_0x7e9e('0x40')]===_0x7e9e('0x46'))_0x4dbf2a[_0x7e9e('0x47')]=_0xa26e82(_0xd7c825,_0x4dbf2a[_0x7e9e('0x47')]);_0x4dbf2a[_0x7e9e('0x48')]=_0xf57087[_0x7e9e('0x30')]?_[_0x7e9e('0x49')](_0xf57087)[_0x7e9e('0x48')]+0x1:_0x68bb1f;_0x120bbc=_[_0x7e9e('0x4a')](_0x120bbc,_0xf57087,[_0x4dbf2a],_0x181d33);_0x68bb1f=_[_0x7e9e('0x49')](_0x120bbc)[_0x7e9e('0x48')]+0x1;}return _0x10bdab(_0x120bbc);})[_0x7e9e('0x4b')](function(_0x1efdc5){_0x123e6f(_0x1efdc5);});});}return _0x4d5fa1[_0x7e9e('0x4c')](_0x7e9e('0x4d'),attributes,{'tableName':_0x7e9e('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4b94b9){var _0x720db6=this[_0x7e9e('0x4f')]({'plain':!![]});var _0x59d5b5=_0x720db6[_0x7e9e('0x4')]===_0x7e9e('0x11')?_0xfc5f48(_0x720db6):_0x108c11(_0x720db6);return _0x29edfb(_0x720db6,_0x4b94b9,_[_0x7e9e('0x49')](_0x59d5b5)['priority']+0x1)['then'](function(_0xbde5d3){var _0x41eb4f=_[_0x7e9e('0x4a')](_0x59d5b5,_0xbde5d3);_0x41eb4f[_0x7e9e('0xe')]({'type':_0x720db6[_0x7e9e('0x4')],'app':_0x7e9e('0x50'),'exten':_0x720db6[_0x7e9e('0xc')],'context':_0x720db6[_0x7e9e('0x6')],'priority':_[_0x7e9e('0x49')](_0x41eb4f)['priority']+0x1,'VoiceExtensionId':_0x720db6['id']});return _0x41eb4f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index ae57abb..5878718 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 _0xff2a=['model','map','GetVoiceExtension','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','options','raw','where','attributes','include'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0xff2a,0x93));var _0xaff2=function(_0x5e410d,_0x4eaf38){_0x5e410d=_0x5e410d-0x0;var _0xa97676=_0xff2a[_0x5e410d];return _0xa97676;};'use strict';var _=require('lodash');var util=require(_0xaff2('0x0'));var moment=require(_0xaff2('0x1'));var BPromise=require('bluebird');var rs=require(_0xaff2('0x2'));var fs=require('fs');var Redis=require(_0xaff2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaff2('0x4'));var logger=require('../../config/logger')(_0xaff2('0x5'));var config=require(_0xaff2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaff2('0x7')][_0xaff2('0x8')]({'port':0x232a});config[_0xaff2('0x9')]=_[_0xaff2('0xa')](config[_0xaff2('0x9')],{'host':_0xaff2('0xb'),'port':0x18eb});var socket=require(_0xaff2('0xc'))(new Redis(config[_0xaff2('0x9')]));require(_0xaff2('0xd'))[_0xaff2('0xe')](socket);function respondWithRpcPromise(_0x5f2c47,_0x463233,_0x558f67){return new BPromise(function(_0x4e031d,_0x184f5b){return client[_0xaff2('0xf')](_0x5f2c47,_0x558f67)[_0xaff2('0x10')](function(_0x26de0d){logger[_0xaff2('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x463233,_0xaff2('0x12'));logger[_0xaff2('0x13')](_0xaff2('0x14'),_0x463233,'request\x20sent',JSON[_0xaff2('0x15')](_0x26de0d));if(_0x26de0d[_0xaff2('0x16')]){if(_0x26de0d['error'][_0xaff2('0x17')]===0x1f4){logger['error'](_0xaff2('0x18'),_0x463233,_0x26de0d['error']['message']);return _0x184f5b(_0x26de0d[_0xaff2('0x16')]['message']);}logger[_0xaff2('0x16')](_0xaff2('0x18'),_0x463233,_0x26de0d[_0xaff2('0x16')][_0xaff2('0x19')]);return _0x4e031d(_0x26de0d[_0xaff2('0x16')]['message']);}else{logger[_0xaff2('0x11')](_0xaff2('0x18'),_0x463233,_0xaff2('0x12'));_0x4e031d(_0x26de0d[_0xaff2('0x1a')][_0xaff2('0x19')]);}})[_0xaff2('0x1b')](function(_0x227720){logger['error'](_0xaff2('0x18'),_0x463233,_0x227720);_0x184f5b(_0x227720);});});}exports['GetVoiceExtension']=function(_0x1e61d6){var _0x5a393b=this;return new Promise(function(_0x528b15,_0x353ed0){return db['VoiceExtension']['findAll']({'raw':_0x1e61d6[_0xaff2('0x1c')]?_0x1e61d6[_0xaff2('0x1c')][_0xaff2('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e61d6[_0xaff2('0x1c')]?_0x1e61d6[_0xaff2('0x1c')][_0xaff2('0x1e')]||null:null,'attributes':_0x1e61d6['options']?_0x1e61d6['options'][_0xaff2('0x1f')]||null:null,'limit':_0x1e61d6[_0xaff2('0x1c')]?_0x1e61d6['options']['limit']||null:null,'include':_0x1e61d6[_0xaff2('0x1c')]?_0x1e61d6[_0xaff2('0x1c')][_0xaff2('0x20')]?_['map'](_0x1e61d6[_0xaff2('0x1c')][_0xaff2('0x20')],function(_0x3d3d39){return{'model':db[_0x3d3d39[_0xaff2('0x21')]],'as':_0x3d3d39['as'],'attributes':_0x3d3d39[_0xaff2('0x1f')],'include':_0x3d3d39[_0xaff2('0x20')]?_[_0xaff2('0x22')](_0x3d3d39[_0xaff2('0x20')],function(_0x173365){return{'model':db[_0x173365[_0xaff2('0x21')]],'as':_0x173365['as'],'attributes':_0x173365[_0xaff2('0x1f')],'include':_0x173365[_0xaff2('0x20')]?_[_0xaff2('0x22')](_0x173365['include'],function(_0x3ccb90){return{'model':db[_0x3ccb90[_0xaff2('0x21')]],'as':_0x3ccb90['as'],'attributes':_0x3ccb90['attributes']};}):[]};}):[]};}):[]:[]})[_0xaff2('0x10')](function(_0x3e182f){logger['info'](_0xaff2('0x23'),_0x1e61d6);logger[_0xaff2('0x13')](_0xaff2('0x23'),_0x1e61d6,JSON[_0xaff2('0x15')](_0x3e182f));_0x528b15(_0x3e182f);})[_0xaff2('0x1b')](function(_0x18774f){logger[_0xaff2('0x16')](_0xaff2('0x23'),_0x18774f[_0xaff2('0x19')],_0x1e61d6);_0x353ed0(_0x5a393b[_0xaff2('0x16')](0x1f4,_0x18774f['message']));});});}; \ No newline at end of file +var _0x7958=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','model','include','map','lodash','util'];(function(_0x5ad24f,_0x42432){var _0x4cd608=function(_0x486d91){while(--_0x486d91){_0x5ad24f['push'](_0x5ad24f['shift']());}};_0x4cd608(++_0x42432);}(_0x7958,0x126));var _0x8795=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7958[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var moment=require('moment');var BPromise=require(_0x8795('0x2'));var rs=require(_0x8795('0x3'));var fs=require('fs');var Redis=require(_0x8795('0x4'));var db=require(_0x8795('0x5'))['db'];var utils=require(_0x8795('0x6'));var logger=require(_0x8795('0x7'))(_0x8795('0x8'));var config=require(_0x8795('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8795('0xa')][_0x8795('0xb')]({'port':0x232a});config[_0x8795('0xc')]=_['defaults'](config[_0x8795('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8795('0xd'))(new Redis(config[_0x8795('0xc')]));require(_0x8795('0xe'))[_0x8795('0xf')](socket);function respondWithRpcPromise(_0x1bcd9c,_0x2191fb,_0x191cb0){return new BPromise(function(_0x441669,_0x416a3a){return client[_0x8795('0x10')](_0x1bcd9c,_0x191cb0)[_0x8795('0x11')](function(_0x2118ff){logger[_0x8795('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x2191fb,_0x8795('0x13'));logger[_0x8795('0x14')](_0x8795('0x15'),_0x2191fb,_0x8795('0x13'),JSON[_0x8795('0x16')](_0x2118ff));if(_0x2118ff[_0x8795('0x17')]){if(_0x2118ff[_0x8795('0x17')]['code']===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2191fb,_0x2118ff[_0x8795('0x17')][_0x8795('0x18')]);return _0x416a3a(_0x2118ff[_0x8795('0x17')][_0x8795('0x18')]);}logger[_0x8795('0x17')](_0x8795('0x19'),_0x2191fb,_0x2118ff[_0x8795('0x17')]['message']);return _0x441669(_0x2118ff[_0x8795('0x17')]['message']);}else{logger[_0x8795('0x12')](_0x8795('0x19'),_0x2191fb,_0x8795('0x13'));_0x441669(_0x2118ff[_0x8795('0x1a')][_0x8795('0x18')]);}})[_0x8795('0x1b')](function(_0x353290){logger['error'](_0x8795('0x19'),_0x2191fb,_0x353290);_0x416a3a(_0x353290);});});}exports[_0x8795('0x1c')]=function(_0x4a65f0){var _0x377dde=this;return new Promise(function(_0x2a9501,_0x458787){return db[_0x8795('0x1d')]['findAll']({'raw':_0x4a65f0[_0x8795('0x1e')]?_0x4a65f0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a65f0[_0x8795('0x1e')]?_0x4a65f0['options'][_0x8795('0x1f')]||null:null,'attributes':_0x4a65f0[_0x8795('0x1e')]?_0x4a65f0['options'][_0x8795('0x20')]||null:null,'limit':_0x4a65f0[_0x8795('0x1e')]?_0x4a65f0[_0x8795('0x1e')][_0x8795('0x21')]||null:null,'include':_0x4a65f0[_0x8795('0x1e')]?_0x4a65f0[_0x8795('0x1e')]['include']?_['map'](_0x4a65f0[_0x8795('0x1e')]['include'],function(_0x3ed14c){return{'model':db[_0x3ed14c[_0x8795('0x22')]],'as':_0x3ed14c['as'],'attributes':_0x3ed14c[_0x8795('0x20')],'include':_0x3ed14c[_0x8795('0x23')]?_[_0x8795('0x24')](_0x3ed14c['include'],function(_0x8dc441){return{'model':db[_0x8dc441[_0x8795('0x22')]],'as':_0x8dc441['as'],'attributes':_0x8dc441['attributes'],'include':_0x8dc441[_0x8795('0x23')]?_[_0x8795('0x24')](_0x8dc441[_0x8795('0x23')],function(_0x28770c){return{'model':db[_0x28770c[_0x8795('0x22')]],'as':_0x28770c['as'],'attributes':_0x28770c[_0x8795('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8795('0x11')](function(_0x2c7d1f){logger[_0x8795('0x12')](_0x8795('0x1c'),_0x4a65f0);logger[_0x8795('0x14')]('GetVoiceExtension',_0x4a65f0,JSON[_0x8795('0x16')](_0x2c7d1f));_0x2a9501(_0x2c7d1f);})[_0x8795('0x1b')](function(_0x3aab08){logger[_0x8795('0x17')]('GetVoiceExtension',_0x3aab08[_0x8795('0x18')],_0x4a65f0);_0x458787(_0x377dde[_0x8795('0x17')](0x1f4,_0x3aab08[_0x8795('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 79cd10d..01427b3 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 _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x4991e6,_0x64a838){var _0x141f72=function(_0x30ccd1){while(--_0x30ccd1){_0x4991e6['push'](_0x4991e6['shift']());}};_0x141f72(++_0x64a838);}(_0x326f,0xd1));var _0xf326=function(_0x2c0a74,_0x3f5bb5){_0x2c0a74=_0x2c0a74-0x0;var _0x5dd615=_0x326f[_0x2c0a74];return _0x5dd615;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x7e141e,_0x2091d0){var _0x527aff=function(_0x5f0c4f){while(--_0x5f0c4f){_0x7e141e['push'](_0x7e141e['shift']());}};_0x527aff(++_0x2091d0);}(_0x0295,0x1f0));var _0x5029=function(_0x3a07d4,_0xa80b88){_0x3a07d4=_0x3a07d4-0x0;var _0x2c352=_0x0295[_0x3a07d4];return _0x2c352;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index edb30d3..0006b93 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5cbf84,_0x28b0f9){_0x5cbf84=_0x5cbf84-0x0;var _0x2cff5e=_0x5f2f[_0x5cbf84];return _0x2cff5e;};'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 +var _0x7096=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0x7096,0x10c));var _0x6709=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7096[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id/messages',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0xe')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xf')]);router[_0x6709('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6709('0x11')]);router[_0x6709('0x12')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0x13')]);module[_0x6709('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index a38a369..e93cae2 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 _0x8a90=['contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x8a90,0x9f));var _0x08a9=function(_0x4584b7,_0x396a41){_0x4584b7=_0x4584b7-0x0;var _0x2bbf5c=_0x8a90[_0x4584b7];return _0x2bbf5c;};'use strict';var Sequelize=require(_0x08a9('0x0'));module[_0x08a9('0x1')]={'customer_id':{'type':Sequelize[_0x08a9('0x2')]},'context':{'type':Sequelize[_0x08a9('0x2')],'defaultValue':'from-voicemail','unique':_0x08a9('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x08a9('0x3')},'password':{'type':Sequelize[_0x08a9('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x08a9('0x2')],'validate':{'isEmail':!![]},'set':function(_0x537412){this[_0x08a9('0x4')](_0x08a9('0x5'),typeof _0x537412==='string'&&_0x537412[_0x08a9('0x6')]()?_0x537412[_0x08a9('0x6')]():null);}},'pager':{'type':Sequelize[_0x08a9('0x2')]},'tz':{'type':Sequelize[_0x08a9('0x2')],'defaultValue':_0x08a9('0x7')},'attach':{'type':Sequelize[_0x08a9('0x8')](_0x08a9('0x9'),'no'),'defaultValue':_0x08a9('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x08a9('0x9'),'no'),'defaultValue':_0x08a9('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x08a9('0x2')]},'review':{'type':Sequelize['ENUM'](_0x08a9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x08a9('0x8')](_0x08a9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x08a9('0x8')](_0x08a9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x08a9('0x8')](_0x08a9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x08a9('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x08a9('0x8')](_0x08a9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x08a9('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x08a9('0x8')]('yes','no'),'defaultValue':_0x08a9('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x08a9('0x8')](_0x08a9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x08a9('0x9'),'no'),'defaultValue':_0x08a9('0x9'),'allowNull':![]},'stamp':{'type':_0x08a9('0xb')},'emailsubject':{'type':Sequelize[_0x08a9('0x2')]},'emailbody':{'type':Sequelize[_0x08a9('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x08a9('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x08a9('0xd')],'get':function(){return this[_0x08a9('0xe')](_0x08a9('0xf'))+_0x08a9('0x10')+this[_0x08a9('0xe')](_0x08a9('0x11'));}}}; \ No newline at end of file +var _0x5e9f=['contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x5e9f,0xd4));var _0xf5e9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5e9f[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xf5e9('0x0'));module[_0xf5e9('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf5e9('0x2')],'defaultValue':_0xf5e9('0x3'),'unique':_0xf5e9('0x4')},'mailbox':{'type':Sequelize[_0xf5e9('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf5e9('0x2')]},'fullname':{'type':Sequelize[_0xf5e9('0x2')]},'email':{'type':Sequelize[_0xf5e9('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3a1df3){this[_0xf5e9('0x5')](_0xf5e9('0x6'),typeof _0x3a1df3===_0xf5e9('0x7')&&_0x3a1df3[_0xf5e9('0x8')]()?_0x3a1df3[_0xf5e9('0x8')]():null);}},'pager':{'type':Sequelize[_0xf5e9('0x2')]},'tz':{'type':Sequelize[_0xf5e9('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xf5e9('0xa'),'no'),'defaultValue':_0xf5e9('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf5e9('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf5e9('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf5e9('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf5e9('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':_0xf5e9('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf5e9('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':_0xf5e9('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xf5e9('0x2')]},'emailbody':{'type':Sequelize[_0xf5e9('0x2')]},'maxsecs':{'type':Sequelize[_0xf5e9('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf5e9('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf5e9('0xd')],'get':function(){return this[_0xf5e9('0xe')](_0xf5e9('0xf'))+_0xf5e9('0x10')+this[_0xf5e9('0xe')](_0xf5e9('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index d3c8d38..05dc404 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 _0x750a=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','json','destroy','then','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMail','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','getMessages','findOne','VoiceMailMessage','length','findAndCountAll','rimraf','request-promise','moment','bluebird'];(function(_0x5d50d7,_0x339501){var _0x4acb68=function(_0x6bd7a8){while(--_0x6bd7a8){_0x5d50d7['push'](_0x5d50d7['shift']());}};_0x4acb68(++_0x339501);}(_0x750a,0x140));var _0xa750=function(_0x5dea7d,_0x23364a){_0x5dea7d=_0x5dea7d-0x0;var _0xd904eb=_0x750a[_0x5dea7d];return _0xd904eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ec62,_0x1c5657){_0x1c5657=_0x1c5657||0xcc;return function(_0x344c67){if(_0x344c67){return _0x24ec62['sendStatus'](_0x1c5657);}return _0x24ec62[_0xa750('0x15')](_0x1c5657)[_0xa750('0x16')]();};}function respondWithResult(_0x2d3421,_0x24e48a){_0x24e48a=_0x24e48a||0xc8;return function(_0xa66181){if(_0xa66181){return _0x2d3421[_0xa750('0x15')](_0x24e48a)['json'](_0xa66181);}};}function respondWithFilteredResult(_0x3ae2a1,_0x8488ea){return function(_0x290d46){if(_0x290d46){var _0x49fe3b=typeof _0x8488ea[_0xa750('0x17')]===_0xa750('0x18')&&typeof _0x8488ea['limit']==='undefined';var _0x321eb2=_0x290d46['count'];var _0x433dbd=_0x49fe3b?0x0:_0x8488ea[_0xa750('0x17')];var _0x4f1faa=_0x49fe3b?_0x290d46[_0xa750('0x19')]:_0x8488ea['offset']+_0x8488ea['limit'];var _0x25e335;if(_0x4f1faa>=_0x321eb2){_0x4f1faa=_0x321eb2;_0x25e335=0xc8;}else{_0x25e335=0xce;}_0x3ae2a1['status'](_0x25e335);return _0x3ae2a1[_0xa750('0x1a')]('Content-Range',_0x433dbd+'-'+_0x4f1faa+'/'+_0x321eb2)[_0xa750('0x1b')](_0x290d46);}return null;};}function patchUpdates(_0x4a007d){return function(_0x3dc7f1){try{jsonpatch['apply'](_0x3dc7f1,_0x4a007d,!![]);}catch(_0x1efb68){return BPromise['reject'](_0x1efb68);}return _0x3dc7f1['save']();};}function saveUpdates(_0xaa9d3e,_0x52da84){return function(_0x216fbf){if(_0x216fbf){return _0x216fbf['update'](_0xaa9d3e)['then'](function(_0x5b433d){return _0x5b433d;});}return null;};}function removeEntity(_0x5d758e,_0x15d72f){return function(_0x2ec6c4){if(_0x2ec6c4){return _0x2ec6c4[_0xa750('0x1c')]()[_0xa750('0x1d')](function(){var _0x1b80a5=_0x2ec6c4[_0xa750('0x1e')]({'plain':!![]});var _0x3001bc=_0xa750('0x1f');return db[_0xa750('0x20')][_0xa750('0x1c')]({'where':{'type':_0x3001bc,'resourceId':_0x1b80a5['id']}})[_0xa750('0x1d')](function(){return _0x2ec6c4;});})[_0xa750('0x1d')](function(){_0x5d758e[_0xa750('0x15')](0xcc)[_0xa750('0x16')]();});}};}function handleEntityNotFound(_0x310e2d,_0x4ffff4){return function(_0x3d3923){if(!_0x3d3923){_0x310e2d[_0xa750('0x21')](0x194);}return _0x3d3923;};}function handleError(_0x21cd2c,_0x4cceee){_0x4cceee=_0x4cceee||0x1f4;return function(_0x35ab53){logger[_0xa750('0x22')](_0x35ab53[_0xa750('0x23')]);if(_0x35ab53[_0xa750('0x24')]){delete _0x35ab53['name'];}_0x21cd2c[_0xa750('0x15')](_0x4cceee)[_0xa750('0x25')](_0x35ab53);};}exports[_0xa750('0x26')]=function(_0x2aef3a,_0x2c5253){var _0x59ab33={},_0x46cc11={},_0x4c2c9e={'count':0x0,'rows':[]};var _0x2d0e93=_[_0xa750('0x27')](db['VoiceMail'][_0xa750('0x28')],function(_0x6bc25d){return{'name':_0x6bc25d[_0xa750('0x29')],'type':_0x6bc25d[_0xa750('0x2a')][_0xa750('0x2b')]};});_0x46cc11[_0xa750('0x2c')]=_[_0xa750('0x27')](_0x2d0e93,_0xa750('0x24'));_0x46cc11['query']=_[_0xa750('0x2d')](_0x2aef3a['query']);_0x46cc11[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],_0x46cc11[_0xa750('0x30')]);_0x59ab33['attributes']=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],qs['fields'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x31')]));_0x59ab33[_0xa750('0x32')]=_0x59ab33[_0xa750('0x32')]['length']?_0x59ab33[_0xa750('0x32')]:_0x46cc11['model'];if(!_0x2aef3a['query'][_0xa750('0x33')](_0xa750('0x34'))){_0x59ab33[_0xa750('0x35')]=qs['limit'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x35')]);_0x59ab33[_0xa750('0x17')]=qs['offset'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x17')]);}_0x59ab33[_0xa750('0x36')]=qs['sort'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x37')]);_0x59ab33[_0xa750('0x38')]=qs['filters'](_[_0xa750('0x39')](_0x2aef3a[_0xa750('0x30')],_0x46cc11[_0xa750('0x2e')]),_0x2d0e93);if(_0x2aef3a[_0xa750('0x30')]['filter']){_0x59ab33['where']=_[_0xa750('0x3a')](_0x59ab33[_0xa750('0x38')],{'$or':_['map'](_0x2d0e93,function(_0x43dc3a){if(_0x43dc3a[_0xa750('0x2a')]!==_0xa750('0x3b')){var _0x1166ff={};_0x1166ff[_0x43dc3a[_0xa750('0x24')]]={'$like':'%'+_0x2aef3a['query'][_0xa750('0x3c')]+'%'};return _0x1166ff;}})});}_0x59ab33=_[_0xa750('0x3a')]({},_0x59ab33,_0x2aef3a[_0xa750('0x3d')]);var _0x134874={'where':_0x59ab33[_0xa750('0x38')]};return db[_0xa750('0x3e')][_0xa750('0x19')](_0x134874)['then'](function(_0x3daa38){_0x4c2c9e['count']=_0x3daa38;if(_0x2aef3a[_0xa750('0x30')]['includeAll']){_0x59ab33[_0xa750('0x3f')]=[{'all':!![]}];}return db[_0xa750('0x3e')][_0xa750('0x40')](_0x59ab33);})[_0xa750('0x1d')](function(_0x430d60){_0x4c2c9e[_0xa750('0x41')]=_0x430d60;return _0x4c2c9e;})[_0xa750('0x1d')](respondWithFilteredResult(_0x2c5253,_0x59ab33))[_0xa750('0x42')](handleError(_0x2c5253,null));};exports[_0xa750('0x43')]=function(_0x108a1a,_0x36a8d6){var _0x1458f1={'raw':!![],'where':{'id':_0x108a1a[_0xa750('0x44')]['id']}},_0x3ec860={};_0x3ec860[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x3e')][_0xa750('0x28')]);_0x3ec860[_0xa750('0x30')]=_[_0xa750('0x2d')](_0x108a1a['query']);_0x3ec860[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],_0x3ec860[_0xa750('0x30')]);_0x1458f1[_0xa750('0x32')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x108a1a[_0xa750('0x30')]['fields']));_0x1458f1[_0xa750('0x32')]=_0x1458f1[_0xa750('0x32')]['length']?_0x1458f1[_0xa750('0x32')]:_0x3ec860[_0xa750('0x2c')];if(_0x108a1a[_0xa750('0x30')][_0xa750('0x45')]){_0x1458f1[_0xa750('0x3f')]=[{'all':!![]}];}_0x1458f1=_[_0xa750('0x3a')]({},_0x1458f1,_0x108a1a[_0xa750('0x3d')]);return db[_0xa750('0x3e')][_0xa750('0x46')](_0x1458f1)[_0xa750('0x1d')](handleEntityNotFound(_0x36a8d6,null))['then'](respondWithResult(_0x36a8d6,null))[_0xa750('0x42')](handleError(_0x36a8d6,null));};exports[_0xa750('0x47')]=function(_0x58afd2,_0x93e49f){return db[_0xa750('0x3e')][_0xa750('0x47')](_0x58afd2['body'],{})[_0xa750('0x1d')](function(_0x3fc623){var _0x1e5a9a=_0x58afd2[_0xa750('0x48')]['get']({'plain':!![]});if(!_0x1e5a9a)throw new Error(_0xa750('0x49'));if(_0x1e5a9a[_0xa750('0x4a')]===_0xa750('0x48')){var _0xed4f88=_0x3fc623['get']({'plain':!![]});var _0x203f2a=_0xa750('0x1f');return db['UserProfileSection'][_0xa750('0x46')]({'where':{'name':_0x203f2a,'userProfileId':_0x1e5a9a['userProfileId']},'raw':!![]})[_0xa750('0x1d')](function(_0x69995b){if(_0x69995b&&_0x69995b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xed4f88[_0xa750('0x24')],'resourceId':_0xed4f88['id'],'type':_0x69995b[_0xa750('0x24')],'sectionId':_0x69995b['id']},{})['then'](function(){return _0x3fc623;});}else{return _0x3fc623;}})[_0xa750('0x42')](function(_0x1a79a9){logger[_0xa750('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a79a9);throw _0x1a79a9;});}return _0x3fc623;})['then'](respondWithResult(_0x93e49f,0xc9))['catch'](handleError(_0x93e49f,null));};exports['update']=function(_0x3c34d4,_0x4a1b5d){if(_0x3c34d4[_0xa750('0x4b')]['id']){delete _0x3c34d4[_0xa750('0x4b')]['id'];}return db['VoiceMail'][_0xa750('0x46')]({'where':{'id':_0x3c34d4['params']['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x4a1b5d,null))['then'](saveUpdates(_0x3c34d4['body'],null))['then'](respondWithResult(_0x4a1b5d,null))['catch'](handleError(_0x4a1b5d,null));};exports[_0xa750('0x1c')]=function(_0x40dac2,_0x5f1313){return db['VoiceMail']['find']({'where':{'id':_0x40dac2[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x5f1313,null))[_0xa750('0x1d')](removeEntity(_0x5f1313,null))[_0xa750('0x42')](handleError(_0x5f1313,null));};exports[_0xa750('0x4c')]=function(_0x13528a,_0x599e7e,_0x590b1c){return db[_0xa750('0x3e')][_0xa750('0x4d')]({'where':{'id':_0x13528a[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x599e7e,null))[_0xa750('0x1d')](function(_0x5a3cd5){var _0x4030b3;var _0xaa63be={},_0x2c7dd0={};_0x2c7dd0[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x4e')][_0xa750('0x28')]);_0x2c7dd0[_0xa750('0x30')]=_['keys'](_0x13528a[_0xa750('0x30')]);_0x2c7dd0[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x2c7dd0[_0xa750('0x2c')],_0x2c7dd0[_0xa750('0x30')]);_0xaa63be['attributes']=_[_0xa750('0x2f')](_0x2c7dd0[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x13528a[_0xa750('0x30')][_0xa750('0x31')]));_0xaa63be[_0xa750('0x32')]=_0xaa63be[_0xa750('0x32')][_0xa750('0x4f')]?_0xaa63be[_0xa750('0x32')]:_0x2c7dd0[_0xa750('0x2c')];if(!_0x13528a[_0xa750('0x30')][_0xa750('0x33')](_0xa750('0x34'))){_0xaa63be[_0xa750('0x35')]=qs[_0xa750('0x35')](_0x13528a[_0xa750('0x30')]['limit']);_0xaa63be[_0xa750('0x17')]=qs['offset'](_0x13528a[_0xa750('0x30')][_0xa750('0x17')]);}_0xaa63be[_0xa750('0x36')]=qs['sort'](_0x13528a[_0xa750('0x30')][_0xa750('0x37')]);_0xaa63be[_0xa750('0x38')]=qs[_0xa750('0x2e')](_[_0xa750('0x39')](_0x13528a[_0xa750('0x30')],_0x2c7dd0['filters']));if(_0x13528a[_0xa750('0x30')][_0xa750('0x3c')]){_0xaa63be['where']=_[_0xa750('0x3a')](_0xaa63be[_0xa750('0x38')],{'$or':_[_0xa750('0x27')](_0xaa63be[_0xa750('0x32')],function(_0x3255c7){var _0x1b7597={};_0x1b7597[_0x3255c7]={'$like':'%'+_0x13528a[_0xa750('0x30')][_0xa750('0x3c')]+'%'};return _0x1b7597;})});}_0xaa63be[_0xa750('0x38')]=_[_0xa750('0x3a')](_0xaa63be[_0xa750('0x38')],{'mailboxuser':_0x5a3cd5['mailbox']});_0xaa63be=_['merge']({},_0xaa63be,_0x13528a[_0xa750('0x3d')]);return db[_0xa750('0x4e')][_0xa750('0x50')](_0xaa63be)[_0xa750('0x1d')](respondWithFilteredResult(_0x599e7e,_0xaa63be));})['catch'](handleError(_0x599e7e,null));}; \ No newline at end of file +var _0xb574=['filter','merge','VoiceMail','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','length','pick','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0xb574,0x106));var _0x4b57=function(_0x3b044e,_0x55b2e9){_0x3b044e=_0x3b044e-0x0;var _0x2d632b=_0xb574[_0x3b044e];return _0x2d632b;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){var _0x25d190=_0x4d07c9[_0x4b57('0x25')]({'plain':!![]});var _0x540eff=_0x4b57('0x26');return db['UserProfileResource'][_0x4b57('0x24')]({'where':{'type':_0x540eff,'resourceId':_0x25d190['id']}})['then'](function(){return _0x4d07c9;});})[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x6584c4,_0x104f52){return function(_0x392e37){if(!_0x392e37){_0x6584c4['sendStatus'](0x194);}return _0x392e37;};}function handleError(_0x5c3c7a,_0x16d196){_0x16d196=_0x16d196||0x1f4;return function(_0x4c58e4){logger[_0x4b57('0x27')](_0x4c58e4[_0x4b57('0x28')]);if(_0x4c58e4[_0x4b57('0x29')]){delete _0x4c58e4[_0x4b57('0x29')];}_0x5c3c7a[_0x4b57('0x17')](_0x16d196)[_0x4b57('0x2a')](_0x4c58e4);};}exports['index']=function(_0xab365c,_0x2e9922){var _0x68be27={},_0x3cd331={},_0x4ccf89={'count':0x0,'rows':[]};var _0xa91ba=_[_0x4b57('0x2b')](db['VoiceMail'][_0x4b57('0x2c')],function(_0xa5b5dc){return{'name':_0xa5b5dc[_0x4b57('0x2d')],'type':_0xa5b5dc[_0x4b57('0x2e')]['key']};});_0x3cd331['model']=_['map'](_0xa91ba,_0x4b57('0x29'));_0x3cd331[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0xab365c[_0x4b57('0x2f')]);_0x3cd331[_0x4b57('0x31')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],_0x3cd331[_0x4b57('0x2f')]);_0x68be27[_0x4b57('0x33')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0xab365c[_0x4b57('0x2f')]['fields']));_0x68be27[_0x4b57('0x33')]=_0x68be27[_0x4b57('0x33')]['length']?_0x68be27[_0x4b57('0x33')]:_0x3cd331[_0x4b57('0x32')];if(!_0xab365c[_0x4b57('0x2f')][_0x4b57('0x35')](_0x4b57('0x36'))){_0x68be27[_0x4b57('0x1b')]=qs['limit'](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1b')]);_0x68be27[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1d')]);}_0x68be27[_0x4b57('0x37')]=qs['sort'](_0xab365c['query'][_0x4b57('0x38')]);_0x68be27[_0x4b57('0x39')]=qs[_0x4b57('0x31')](_['pick'](_0xab365c[_0x4b57('0x2f')],_0x3cd331[_0x4b57('0x31')]),_0xa91ba);if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]){_0x68be27['where']=_[_0x4b57('0x3b')](_0x68be27[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0xa91ba,function(_0x2d24ab){if(_0x2d24ab['type']!=='VIRTUAL'){var _0x5d624c={};_0x5d624c[_0x2d24ab[_0x4b57('0x29')]]={'$like':'%'+_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]+'%'};return _0x5d624c;}})});}_0x68be27=_[_0x4b57('0x3b')]({},_0x68be27,_0xab365c['options']);var _0x445353={'where':_0x68be27[_0x4b57('0x39')]};return db[_0x4b57('0x3c')][_0x4b57('0x1c')](_0x445353)[_0x4b57('0x23')](function(_0x453129){_0x4ccf89[_0x4b57('0x1c')]=_0x453129;if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3d')]){_0x68be27['include']=[{'all':!![]}];}return db[_0x4b57('0x3c')][_0x4b57('0x3e')](_0x68be27);})[_0x4b57('0x23')](function(_0x5b2f50){_0x4ccf89[_0x4b57('0x3f')]=_0x5b2f50;return _0x4ccf89;})['then'](respondWithFilteredResult(_0x2e9922,_0x68be27))[_0x4b57('0x40')](handleError(_0x2e9922,null));};exports[_0x4b57('0x41')]=function(_0x457273,_0x19ba66){var _0x189fd0={'raw':!![],'where':{'id':_0x457273[_0x4b57('0x42')]['id']}},_0x477352={};_0x477352[_0x4b57('0x32')]=_[_0x4b57('0x30')](db[_0x4b57('0x3c')][_0x4b57('0x2c')]);_0x477352[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x457273['query']);_0x477352['filters']=_[_0x4b57('0x43')](_0x477352[_0x4b57('0x32')],_0x477352[_0x4b57('0x2f')]);_0x189fd0[_0x4b57('0x33')]=_['intersection'](_0x477352[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x457273['query'][_0x4b57('0x34')]));_0x189fd0['attributes']=_0x189fd0[_0x4b57('0x33')]['length']?_0x189fd0['attributes']:_0x477352[_0x4b57('0x32')];if(_0x457273[_0x4b57('0x2f')]['includeAll']){_0x189fd0[_0x4b57('0x44')]=[{'all':!![]}];}_0x189fd0=_[_0x4b57('0x3b')]({},_0x189fd0,_0x457273[_0x4b57('0x45')]);return db[_0x4b57('0x3c')][_0x4b57('0x46')](_0x189fd0)[_0x4b57('0x23')](handleEntityNotFound(_0x19ba66,null))['then'](respondWithResult(_0x19ba66,null))[_0x4b57('0x40')](handleError(_0x19ba66,null));};exports[_0x4b57('0x47')]=function(_0x4a632c,_0xd529fb){return db[_0x4b57('0x3c')][_0x4b57('0x47')](_0x4a632c['body'],{})[_0x4b57('0x23')](function(_0x5cba5f){var _0x213dca=_0x4a632c[_0x4b57('0x48')][_0x4b57('0x25')]({'plain':!![]});if(!_0x213dca)throw new Error(_0x4b57('0x49'));if(_0x213dca[_0x4b57('0x4a')]===_0x4b57('0x48')){var _0x3d1ecd=_0x5cba5f[_0x4b57('0x25')]({'plain':!![]});var _0x5ab120=_0x4b57('0x26');return db[_0x4b57('0x4b')][_0x4b57('0x46')]({'where':{'name':_0x5ab120,'userProfileId':_0x213dca['userProfileId']},'raw':!![]})[_0x4b57('0x23')](function(_0xcf72b6){if(_0xcf72b6&&_0xcf72b6[_0x4b57('0x4c')]===0x0){return db['UserProfileResource'][_0x4b57('0x47')]({'name':_0x3d1ecd[_0x4b57('0x29')],'resourceId':_0x3d1ecd['id'],'type':_0xcf72b6[_0x4b57('0x29')],'sectionId':_0xcf72b6['id']},{})[_0x4b57('0x23')](function(){return _0x5cba5f;});}else{return _0x5cba5f;}})[_0x4b57('0x40')](function(_0xb7c37c){logger[_0x4b57('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7c37c);throw _0xb7c37c;});}return _0x5cba5f;})['then'](respondWithResult(_0xd529fb,0xc9))[_0x4b57('0x40')](handleError(_0xd529fb,null));};exports[_0x4b57('0x22')]=function(_0x3b4cbf,_0x2e64c2){if(_0x3b4cbf['body']['id']){delete _0x3b4cbf[_0x4b57('0x4d')]['id'];}return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x3b4cbf[_0x4b57('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e64c2,null))['then'](saveUpdates(_0x3b4cbf[_0x4b57('0x4d')],null))[_0x4b57('0x23')](respondWithResult(_0x2e64c2,null))['catch'](handleError(_0x2e64c2,null));};exports['destroy']=function(_0x451737,_0x5c1082){return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x451737[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x5c1082,null))[_0x4b57('0x23')](removeEntity(_0x5c1082,null))['catch'](handleError(_0x5c1082,null));};exports['getMessages']=function(_0x54ff9d,_0x4c241a,_0x179802){return db[_0x4b57('0x3c')]['findOne']({'where':{'id':_0x54ff9d[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x4c241a,null))[_0x4b57('0x23')](function(_0x9ed750){var _0x64b0fd;var _0x1fcc10={},_0xf1bf63={};_0xf1bf63[_0x4b57('0x32')]=_[_0x4b57('0x30')](db['VoiceMailMessage'][_0x4b57('0x2c')]);_0xf1bf63['query']=_[_0x4b57('0x30')](_0x54ff9d[_0x4b57('0x2f')]);_0xf1bf63['filters']=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],_0xf1bf63[_0x4b57('0x2f')]);_0x1fcc10[_0x4b57('0x33')]=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x34')]));_0x1fcc10[_0x4b57('0x33')]=_0x1fcc10[_0x4b57('0x33')][_0x4b57('0x4e')]?_0x1fcc10['attributes']:_0xf1bf63[_0x4b57('0x32')];if(!_0x54ff9d[_0x4b57('0x2f')]['hasOwnProperty'](_0x4b57('0x36'))){_0x1fcc10['limit']=qs['limit'](_0x54ff9d['query'][_0x4b57('0x1b')]);_0x1fcc10['offset']=qs[_0x4b57('0x1d')](_0x54ff9d[_0x4b57('0x2f')]['offset']);}_0x1fcc10['order']=qs[_0x4b57('0x38')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x38')]);_0x1fcc10['where']=qs[_0x4b57('0x31')](_[_0x4b57('0x4f')](_0x54ff9d['query'],_0xf1bf63[_0x4b57('0x31')]));if(_0x54ff9d[_0x4b57('0x2f')]['filter']){_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0x1fcc10[_0x4b57('0x33')],function(_0x5d9dd5){var _0x2112d5={};_0x2112d5[_0x5d9dd5]={'$like':'%'+_0x54ff9d['query']['filter']+'%'};return _0x2112d5;})});}_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10['where'],{'mailboxuser':_0x9ed750['mailbox']});_0x1fcc10=_[_0x4b57('0x3b')]({},_0x1fcc10,_0x54ff9d[_0x4b57('0x45')]);return db['VoiceMailMessage']['findAndCountAll'](_0x1fcc10)['then'](respondWithFilteredResult(_0x4c241a,_0x1fcc10));})[_0x4b57('0x40')](handleError(_0x4c241a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c7d6fab..7a2ac25 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 _0x95c4=['bluebird','request-promise','path','rimraf','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','moment'];(function(_0x3208b9,_0x2be1ef){var _0x133c89=function(_0x2f549d){while(--_0x2f549d){_0x3208b9['push'](_0x3208b9['shift']());}};_0x133c89(++_0x2be1ef);}(_0x95c4,0x10d));var _0x495c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x95c4[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x495c('0x0'));var util=require(_0x495c('0x1'));var logger=require(_0x495c('0x2'))('api');var moment=require(_0x495c('0x3'));var BPromise=require(_0x495c('0x4'));var rp=require(_0x495c('0x5'));var fs=require('fs');var path=require(_0x495c('0x6'));var rimraf=require(_0x495c('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x495c('0x8')]=function(_0x2b1179,_0x5df12e){return _0x2b1179['define'](_0x495c('0x9'),attributes,{'tableName':_0x495c('0xa'),'paranoid':![],'indexes':[{'name':_0x495c('0xb'),'fields':[_0x495c('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5391=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','VoiceMail'];(function(_0x34aaa1,_0x54a4fd){var _0xe301af=function(_0x22d980){while(--_0x22d980){_0x34aaa1['push'](_0x34aaa1['shift']());}};_0xe301af(++_0x54a4fd);}(_0x5391,0xba));var _0x1539=function(_0x22199f,_0x3cd07c){_0x22199f=_0x22199f-0x0;var _0x2b8384=_0x5391[_0x22199f];return _0x2b8384;};'use strict';var _=require(_0x1539('0x0'));var util=require(_0x1539('0x1'));var logger=require(_0x1539('0x2'))('api');var moment=require(_0x1539('0x3'));var BPromise=require(_0x1539('0x4'));var rp=require(_0x1539('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1539('0x6'));var attributes=require('./voiceMail.attributes');module[_0x1539('0x7')]=function(_0x2c8b6d,_0x299c20){return _0x2c8b6d[_0x1539('0x8')](_0x1539('0x9'),attributes,{'tableName':_0x1539('0xa'),'paranoid':![],'indexes':[{'name':_0x1539('0xb'),'fields':[_0x1539('0xc'),_0x1539('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 89a9a71..31b376d 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 _0xa3ba=['jayson/promise','client','request','then','VoiceMail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa3ba,0x7b));var _0xaa3b=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0xa3ba[_0x508685];return _0x976a76;};'use strict';var _=require('lodash');var util=require(_0xaa3b('0x0'));var moment=require(_0xaa3b('0x1'));var BPromise=require(_0xaa3b('0x2'));var rs=require(_0xaa3b('0x3'));var fs=require('fs');var Redis=require(_0xaa3b('0x4'));var db=require(_0xaa3b('0x5'))['db'];var utils=require(_0xaa3b('0x6'));var logger=require(_0xaa3b('0x7'))(_0xaa3b('0x8'));var config=require('../../config/environment');var jayson=require(_0xaa3b('0x9'));var client=jayson[_0xaa3b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x266445,_0x2eb1db,_0x4f6fdb){return new BPromise(function(_0x24ba17,_0x332f54){return client[_0xaa3b('0xb')](_0x266445,_0x4f6fdb)[_0xaa3b('0xc')](function(_0x5e8515){logger['info'](_0xaa3b('0xd'),_0x2eb1db,'request\x20sent');logger[_0xaa3b('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x2eb1db,_0xaa3b('0xf'),JSON[_0xaa3b('0x10')](_0x5e8515));if(_0x5e8515[_0xaa3b('0x11')]){if(_0x5e8515[_0xaa3b('0x11')][_0xaa3b('0x12')]===0x1f4){logger[_0xaa3b('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2eb1db,_0x5e8515['error'][_0xaa3b('0x13')]);return _0x332f54(_0x5e8515['error'][_0xaa3b('0x13')]);}logger[_0xaa3b('0x11')](_0xaa3b('0xd'),_0x2eb1db,_0x5e8515[_0xaa3b('0x11')][_0xaa3b('0x13')]);return _0x24ba17(_0x5e8515[_0xaa3b('0x11')][_0xaa3b('0x13')]);}else{logger['info'](_0xaa3b('0xd'),_0x2eb1db,'request\x20sent');_0x24ba17(_0x5e8515[_0xaa3b('0x14')][_0xaa3b('0x13')]);}})[_0xaa3b('0x15')](function(_0x2a3328){logger[_0xaa3b('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2eb1db,_0x2a3328);_0x332f54(_0x2a3328);});});} \ No newline at end of file +var _0xa5c1=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x342cc6,_0x248259){var _0x560405=function(_0x37e0ce){while(--_0x37e0ce){_0x342cc6['push'](_0x342cc6['shift']());}};_0x560405(++_0x248259);}(_0xa5c1,0xa3));var _0x1a5c=function(_0x3f5d4f,_0x2f834f){_0x3f5d4f=_0x3f5d4f-0x0;var _0x7d0a62=_0xa5c1[_0x3f5d4f];return _0x7d0a62;};'use strict';var _=require('lodash');var util=require(_0x1a5c('0x0'));var moment=require('moment');var BPromise=require(_0x1a5c('0x1'));var rs=require(_0x1a5c('0x2'));var fs=require('fs');var Redis=require(_0x1a5c('0x3'));var db=require(_0x1a5c('0x4'))['db'];var utils=require(_0x1a5c('0x5'));var logger=require(_0x1a5c('0x6'))(_0x1a5c('0x7'));var config=require(_0x1a5c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1a5c('0x9')][_0x1a5c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1175f0,_0x56882c,_0x10a757){return new BPromise(function(_0x447a51,_0x202a38){return client[_0x1a5c('0xb')](_0x1175f0,_0x10a757)[_0x1a5c('0xc')](function(_0xef4cbf){logger[_0x1a5c('0xd')](_0x1a5c('0xe'),_0x56882c,_0x1a5c('0xf'));logger[_0x1a5c('0x10')](_0x1a5c('0x11'),_0x56882c,'request\x20sent',JSON['stringify'](_0xef4cbf));if(_0xef4cbf[_0x1a5c('0x12')]){if(_0xef4cbf[_0x1a5c('0x12')][_0x1a5c('0x13')]===0x1f4){logger['error'](_0x1a5c('0xe'),_0x56882c,_0xef4cbf['error'][_0x1a5c('0x14')]);return _0x202a38(_0xef4cbf[_0x1a5c('0x12')][_0x1a5c('0x14')]);}logger[_0x1a5c('0x12')]('VoiceMail,\x20%s,\x20%s',_0x56882c,_0xef4cbf[_0x1a5c('0x12')]['message']);return _0x447a51(_0xef4cbf[_0x1a5c('0x12')]['message']);}else{logger[_0x1a5c('0xd')]('VoiceMail,\x20%s,\x20%s',_0x56882c,_0x1a5c('0xf'));_0x447a51(_0xef4cbf[_0x1a5c('0x15')][_0x1a5c('0x14')]);}})[_0x1a5c('0x16')](function(_0x2f718d){logger['error'](_0x1a5c('0xe'),_0x56882c,_0x2f718d);_0x202a38(_0x2f718d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2267ad6..a9708ee 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 _0x880f=['connect-timeout','express','Router','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','/:id','show','get','/:id/download','download','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x1196bd,_0xba4aea){var _0x26014f=function(_0x542a3d){while(--_0x542a3d){_0x1196bd['push'](_0x1196bd['shift']());}};_0x26014f(++_0xba4aea);}(_0x880f,0x1b6));var _0xf880=function(_0x232ebb,_0x173163){_0x232ebb=_0x232ebb-0x0;var _0x128109=_0x880f[_0x232ebb];return _0x128109;};'use strict';var multer=require(_0xf880('0x0'));var util=require(_0xf880('0x1'));var path=require(_0xf880('0x2'));var timeout=require(_0xf880('0x3'));var express=require(_0xf880('0x4'));var router=express[_0xf880('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf880('0x6'));var config=require('../../config/environment');var controller=require(_0xf880('0x7'));router['get']('/',auth[_0xf880('0x8')](),controller[_0xf880('0x9')]);router['get'](_0xf880('0xa'),auth[_0xf880('0x8')](),controller[_0xf880('0xb')]);router[_0xf880('0xc')](_0xf880('0xd'),auth[_0xf880('0x8')](),controller[_0xf880('0xe')]);router[_0xf880('0xf')]('/',auth[_0xf880('0x8')](),controller[_0xf880('0x10')]);router['put'](_0xf880('0xa'),auth['isAuthenticated'](),controller[_0xf880('0x11')]);router[_0xf880('0x12')]('/:id',auth[_0xf880('0x8')](),controller[_0xf880('0x13')]);module[_0xf880('0x14')]=router; \ No newline at end of file +var _0x6ca8=['index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x553600,_0xf56180){var _0x156eae=function(_0x1239f5){while(--_0x1239f5){_0x553600['push'](_0x553600['shift']());}};_0x156eae(++_0xf56180);}(_0x6ca8,0x99));var _0x86ca=function(_0x456cca,_0x1b8475){_0x456cca=_0x456cca-0x0;var _0x73d1cd=_0x6ca8[_0x456cca];return _0x73d1cd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x86ca('0x0'));var timeout=require(_0x86ca('0x1'));var express=require(_0x86ca('0x2'));var router=express['Router']();var fs_extra=require(_0x86ca('0x3'));var auth=require(_0x86ca('0x4'));var interaction=require(_0x86ca('0x5'));var config=require(_0x86ca('0x6'));var controller=require(_0x86ca('0x7'));router[_0x86ca('0x8')]('/',auth['isAuthenticated'](),controller[_0x86ca('0x9')]);router[_0x86ca('0x8')]('/:id',auth[_0x86ca('0xa')](),controller[_0x86ca('0xb')]);router[_0x86ca('0x8')](_0x86ca('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x86ca('0xd')]('/',auth['isAuthenticated'](),controller[_0x86ca('0xe')]);router['put'](_0x86ca('0xf'),auth[_0x86ca('0xa')](),controller[_0x86ca('0x10')]);router[_0x86ca('0x11')](_0x86ca('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index fab9e9a..ffcfaf1 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 _0x668c=['long','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x3415d9,_0x225113){var _0x42ff90=function(_0x51fcb6){while(--_0x51fcb6){_0x3415d9['push'](_0x3415d9['shift']());}};_0x42ff90(++_0x225113);}(_0x668c,0x1a0));var _0xc668=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x668c[_0x2675da];return _0x5e6153;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc668('0x0')],'get':function(_0x465c80){return this[_0xc668('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xc668('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc668('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xc668('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xc668('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc668('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xc668('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc668('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc668('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xc668('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xc668('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc668('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x3e49=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER'];(function(_0x49cb59,_0x376b89){var _0x3b78f7=function(_0x15d4cd){while(--_0x15d4cd){_0x49cb59['push'](_0x49cb59['shift']());}};_0x3b78f7(++_0x376b89);}(_0x3e49,0xe7));var _0x93e4=function(_0x5ae1e2,_0x452abe){_0x5ae1e2=_0x5ae1e2-0x0;var _0x3710e6=_0x3e49[_0x5ae1e2];return _0x3710e6;};'use strict';var Sequelize=require(_0x93e4('0x0'));module[_0x93e4('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x23e87c){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x93e4('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x93e4('0x4')](_0x93e4('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'stamp':{'type':_0x93e4('0x6'),'defaultValue':Sequelize[_0x93e4('0x7')](_0x93e4('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 8d5ddfb..da78f4f 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 _0xa1bd=['set','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','then','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22'];(function(_0x15b5b7,_0xb40767){var _0x2e67e7=function(_0x7e76a2){while(--_0x7e76a2){_0x15b5b7['push'](_0x15b5b7['shift']());}};_0x2e67e7(++_0xb40767);}(_0xa1bd,0xf7));var _0xda1b=function(_0x15560,_0x576cc1){_0x15560=_0x15560-0x0;var _0x184bd5=_0xa1bd[_0x15560];return _0x184bd5;};'use strict';var emlformat=require(_0xda1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda1b('0x1'));var jsonpatch=require(_0xda1b('0x2'));var rp=require('request-promise');var moment=require(_0xda1b('0x3'));var BPromise=require(_0xda1b('0x4'));var Mustache=require('mustache');var util=require(_0xda1b('0x5'));var path=require(_0xda1b('0x6'));var sox=require(_0xda1b('0x7'));var csv=require(_0xda1b('0x8'));var ejs=require(_0xda1b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xda1b('0xa'));var crypto=require(_0xda1b('0xb'));var jsforce=require(_0xda1b('0xc'));var deskjs=require(_0xda1b('0xd'));var toCsv=require(_0xda1b('0x8'));var querystring=require(_0xda1b('0xe'));var Papa=require(_0xda1b('0xf'));var Redis=require(_0xda1b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xda1b('0x11'));var as=require(_0xda1b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xda1b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xda1b('0x14'))['db'];function respondWithStatusCode(_0x21d81,_0x4e3c62){_0x4e3c62=_0x4e3c62||0xcc;return function(_0x4d9123){if(_0x4d9123){return _0x21d81[_0xda1b('0x15')](_0x4e3c62);}return _0x21d81[_0xda1b('0x16')](_0x4e3c62)[_0xda1b('0x17')]();};}function respondWithResult(_0x3a8cf1,_0x4ea8ac){_0x4ea8ac=_0x4ea8ac||0xc8;return function(_0x2c62a5){if(_0x2c62a5){return _0x3a8cf1[_0xda1b('0x16')](_0x4ea8ac)[_0xda1b('0x18')](_0x2c62a5);}};}function respondWithFilteredResult(_0x1583b0,_0x3aa11e){return function(_0x3fbe8d){if(_0x3fbe8d){var _0x1b62da=typeof _0x3aa11e['offset']===_0xda1b('0x19')&&typeof _0x3aa11e[_0xda1b('0x1a')]==='undefined';var _0x4570b5=_0x3fbe8d[_0xda1b('0x1b')];var _0x2da723=_0x1b62da?0x0:_0x3aa11e['offset'];var _0x6b9cdf=_0x1b62da?_0x3fbe8d[_0xda1b('0x1b')]:_0x3aa11e[_0xda1b('0x1c')]+_0x3aa11e['limit'];var _0x3bc79d;if(_0x6b9cdf>=_0x4570b5){_0x6b9cdf=_0x4570b5;_0x3bc79d=0xc8;}else{_0x3bc79d=0xce;}_0x1583b0[_0xda1b('0x16')](_0x3bc79d);return _0x1583b0['set'](_0xda1b('0x1d'),_0x2da723+'-'+_0x6b9cdf+'/'+_0x4570b5)['json'](_0x3fbe8d);}return null;};}function patchUpdates(_0x4b1ab4){return function(_0x182f17){try{jsonpatch[_0xda1b('0x1e')](_0x182f17,_0x4b1ab4,!![]);}catch(_0x218c53){return BPromise[_0xda1b('0x1f')](_0x218c53);}return _0x182f17[_0xda1b('0x20')]();};}function saveUpdates(_0x4781cd,_0x57cd6c){return function(_0x2b1891){if(_0x2b1891){return _0x2b1891[_0xda1b('0x21')](_0x4781cd)['then'](function(_0x5d0729){return _0x5d0729;});}return null;};}function removeEntity(_0x1ca385,_0xf9160f){return function(_0x4433e2){if(_0x4433e2){return _0x4433e2[_0xda1b('0x22')]()['then'](function(){_0x1ca385[_0xda1b('0x16')](0xcc)[_0xda1b('0x17')]();});}};}function handleEntityNotFound(_0x57a412,_0x497e9c){return function(_0x4a8a9a){if(!_0x4a8a9a){_0x57a412['sendStatus'](0x194);}return _0x4a8a9a;};}function handleError(_0x176eeb,_0x50c73){_0x50c73=_0x50c73||0x1f4;return function(_0x3b48bc){logger['error'](_0x3b48bc[_0xda1b('0x23')]);if(_0x3b48bc[_0xda1b('0x24')]){delete _0x3b48bc['name'];}_0x176eeb[_0xda1b('0x16')](_0x50c73)[_0xda1b('0x25')](_0x3b48bc);};}exports[_0xda1b('0x26')]=function(_0x72e25f,_0xcec330){var _0x3460ae={},_0x4b9929={},_0x95cdef={'count':0x0,'rows':[]};var _0x436f04=_['map'](db[_0xda1b('0x27')][_0xda1b('0x28')],function(_0x189488){return{'name':_0x189488[_0xda1b('0x29')],'type':_0x189488[_0xda1b('0x2a')][_0xda1b('0x2b')]};});_0x4b9929[_0xda1b('0x2c')]=_['differenceBy'](_[_0xda1b('0x2d')](_0x436f04,_0xda1b('0x24')),[_0xda1b('0x24')]);_0x4b9929[_0xda1b('0x2e')]=_[_0xda1b('0x2f')](_0x72e25f[_0xda1b('0x2e')]);_0x4b9929[_0xda1b('0x30')]=_[_0xda1b('0x31')](_0x4b9929[_0xda1b('0x2c')],_0x4b9929[_0xda1b('0x2e')]);_0x3460ae[_0xda1b('0x32')]=_[_0xda1b('0x31')](_0x4b9929[_0xda1b('0x2c')],qs['fields'](_0x72e25f[_0xda1b('0x2e')][_0xda1b('0x33')]));_0x3460ae[_0xda1b('0x32')]=_0x3460ae[_0xda1b('0x32')][_0xda1b('0x34')]?_0x3460ae[_0xda1b('0x32')]:_0x4b9929[_0xda1b('0x2c')];if(!_0x72e25f[_0xda1b('0x2e')][_0xda1b('0x35')](_0xda1b('0x36'))){_0x3460ae[_0xda1b('0x1a')]=qs['limit'](_0x72e25f['query'][_0xda1b('0x1a')]);_0x3460ae[_0xda1b('0x1c')]=qs[_0xda1b('0x1c')](_0x72e25f[_0xda1b('0x2e')][_0xda1b('0x1c')]);}_0x3460ae[_0xda1b('0x37')]=qs[_0xda1b('0x38')](_0x72e25f[_0xda1b('0x2e')]['sort']);_0x3460ae[_0xda1b('0x39')]=qs['filters'](_[_0xda1b('0x3a')](_0x72e25f[_0xda1b('0x2e')],_0x4b9929['filters']),_0x436f04);if(_0x72e25f['query'][_0xda1b('0x3b')]){_0x3460ae[_0xda1b('0x39')]=_[_0xda1b('0x3c')](_0x3460ae[_0xda1b('0x39')],{'$or':_['map'](_0x436f04,function(_0x2e19e5){if(_0x2e19e5[_0xda1b('0x2a')]!=='VIRTUAL'){var _0x587890={};_0x587890[_0x2e19e5['name']]={'$like':'%'+_0x72e25f[_0xda1b('0x2e')][_0xda1b('0x3b')]+'%'};return _0x587890;}})});}_0x3460ae=_['merge']({},_0x3460ae,_0x72e25f['options']);var _0x40e895={'where':_0x3460ae[_0xda1b('0x39')]};return db[_0xda1b('0x27')][_0xda1b('0x1b')](_0x40e895)[_0xda1b('0x3d')](function(_0x3d5021){_0x95cdef[_0xda1b('0x1b')]=_0x3d5021;if(_0x72e25f[_0xda1b('0x2e')][_0xda1b('0x3e')]){_0x3460ae[_0xda1b('0x3f')]=[{'all':!![]}];}return db[_0xda1b('0x27')][_0xda1b('0x40')](_0x3460ae);})[_0xda1b('0x3d')](function(_0x16331e){_0x95cdef[_0xda1b('0x41')]=_0x16331e;return _0x95cdef;})[_0xda1b('0x3d')](respondWithFilteredResult(_0xcec330,_0x3460ae))[_0xda1b('0x42')](handleError(_0xcec330,null));};exports[_0xda1b('0x43')]=function(_0x59eee9,_0x4cd780){var _0x136f6c={'raw':!![],'where':{'id':_0x59eee9['params']['id']}},_0x329e3a={};_0x329e3a[_0xda1b('0x2c')]=_[_0xda1b('0x2f')](db[_0xda1b('0x27')][_0xda1b('0x28')]);_0x329e3a['query']=_[_0xda1b('0x2f')](_0x59eee9[_0xda1b('0x2e')]);_0x329e3a['filters']=_[_0xda1b('0x31')](_0x329e3a[_0xda1b('0x2c')],_0x329e3a[_0xda1b('0x2e')]);_0x136f6c[_0xda1b('0x32')]=_[_0xda1b('0x31')](_0x329e3a[_0xda1b('0x2c')],qs[_0xda1b('0x33')](_0x59eee9[_0xda1b('0x2e')][_0xda1b('0x33')]));_0x136f6c[_0xda1b('0x32')]=_0x136f6c['attributes']['length']?_0x136f6c[_0xda1b('0x32')]:_0x329e3a[_0xda1b('0x2c')];if(_0x59eee9[_0xda1b('0x2e')][_0xda1b('0x3e')]){_0x136f6c[_0xda1b('0x3f')]=[{'all':!![]}];}_0x136f6c=_[_0xda1b('0x3c')]({},_0x136f6c,_0x59eee9[_0xda1b('0x44')]);return db['VoiceMailMessage']['find'](_0x136f6c)[_0xda1b('0x3d')](handleEntityNotFound(_0x4cd780,null))[_0xda1b('0x3d')](respondWithResult(_0x4cd780,null))[_0xda1b('0x42')](handleError(_0x4cd780,null));};exports[_0xda1b('0x45')]=function(_0x15c0c8,_0x5d0890){return db['VoiceMailMessage']['create'](_0x15c0c8[_0xda1b('0x46')],{})[_0xda1b('0x3d')](respondWithResult(_0x5d0890,0xc9))[_0xda1b('0x42')](handleError(_0x5d0890,null));};exports[_0xda1b('0x21')]=function(_0x1c895f,_0x189fa0){if(_0x1c895f[_0xda1b('0x46')]['id']){delete _0x1c895f[_0xda1b('0x46')]['id'];}return db[_0xda1b('0x27')][_0xda1b('0x47')]({'where':{'id':_0x1c895f[_0xda1b('0x48')]['id']}})[_0xda1b('0x3d')](handleEntityNotFound(_0x189fa0,null))[_0xda1b('0x3d')](saveUpdates(_0x1c895f[_0xda1b('0x46')],null))[_0xda1b('0x3d')](respondWithResult(_0x189fa0,null))[_0xda1b('0x42')](handleError(_0x189fa0,null));};exports['destroy']=function(_0x12d23,_0x4a5594){return db[_0xda1b('0x27')]['find']({'where':{'id':_0x12d23[_0xda1b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a5594,null))['then'](removeEntity(_0x4a5594,null))[_0xda1b('0x42')](handleError(_0x4a5594,null));};exports[_0xda1b('0x49')]=function(_0x577c2a,_0x511a57,_0x2017de){return db[_0xda1b('0x27')][_0xda1b('0x47')]({'where':{'id':_0x577c2a[_0xda1b('0x48')]['id']},'attributes':['id',_0xda1b('0x4a'),_0xda1b('0x4b')]})[_0xda1b('0x3d')](handleEntityNotFound(_0x511a57,null))['then'](function(_0x52ebc0){if(_0x52ebc0){if(!_0x52ebc0[_0xda1b('0x4a')]){throw new db[(_0xda1b('0x4c'))][(_0xda1b('0x4d'))](_0xda1b('0x4e'));}var _0x373545={'Content-Type':'audio/wav','Content-Disposition':_0xda1b('0x4f')};if(_0x52ebc0[_0xda1b('0x4b')]){_0x373545['Content-Disposition']=_0xda1b('0x50')+_0x52ebc0[_0xda1b('0x4b')]+'.wav\x22';}_0x511a57[_0xda1b('0x51')](_0x373545);return _0x511a57[_0xda1b('0x25')](new Buffer(_0x52ebc0['recording']));}})['catch'](handleError(_0x511a57,null));}; \ No newline at end of file +var _0x3acd=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','VoiceMailMessage','include','findAll','catch','show','params','rawAttributes','keys','includeAll','options','find','create','body','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xe4326d,_0x25784d){var _0xd1ff82=function(_0x4908ad){while(--_0x4908ad){_0xe4326d['push'](_0xe4326d['shift']());}};_0xd1ff82(++_0x25784d);}(_0x3acd,0x138));var _0xd3ac=function(_0x3aff18,_0x80bc2c){_0x3aff18=_0x3aff18-0x0;var _0x54339b=_0x3acd[_0x3aff18];return _0x54339b;};'use strict';var emlformat=require(_0xd3ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3ac('0x1'));var jsonpatch=require(_0xd3ac('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3ac('0x3'));var Mustache=require(_0xd3ac('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd3ac('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3ac('0x6'));var squel=require(_0xd3ac('0x7'));var crypto=require(_0xd3ac('0x8'));var jsforce=require(_0xd3ac('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd3ac('0xa'));var querystring=require(_0xd3ac('0xb'));var Papa=require('papaparse');var Redis=require(_0xd3ac('0xc'));var authService=require(_0xd3ac('0xd'));var qs=require(_0xd3ac('0xe'));var as=require(_0xd3ac('0xf'));var hardwareService=require(_0xd3ac('0x10'));var logger=require(_0xd3ac('0x11'))(_0xd3ac('0x12'));var utils=require(_0xd3ac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd3ac('0x14'));var db=require(_0xd3ac('0x15'))['db'];function respondWithStatusCode(_0x5dacad,_0x36177e){_0x36177e=_0x36177e||0xcc;return function(_0x42e9ac){if(_0x42e9ac){return _0x5dacad[_0xd3ac('0x16')](_0x36177e);}return _0x5dacad['status'](_0x36177e)[_0xd3ac('0x17')]();};}function respondWithResult(_0x511662,_0x67de80){_0x67de80=_0x67de80||0xc8;return function(_0x2ed889){if(_0x2ed889){return _0x511662[_0xd3ac('0x18')](_0x67de80)['json'](_0x2ed889);}};}function respondWithFilteredResult(_0x61a9f2,_0x165118){return function(_0x29f487){if(_0x29f487){var _0x28a3b3=typeof _0x165118['offset']==='undefined'&&typeof _0x165118['limit']===_0xd3ac('0x19');var _0x49a939=_0x29f487[_0xd3ac('0x1a')];var _0xc700=_0x28a3b3?0x0:_0x165118[_0xd3ac('0x1b')];var _0x1740bf=_0x28a3b3?_0x29f487[_0xd3ac('0x1a')]:_0x165118[_0xd3ac('0x1b')]+_0x165118[_0xd3ac('0x1c')];var _0xd27fb0;if(_0x1740bf>=_0x49a939){_0x1740bf=_0x49a939;_0xd27fb0=0xc8;}else{_0xd27fb0=0xce;}_0x61a9f2[_0xd3ac('0x18')](_0xd27fb0);return _0x61a9f2['set']('Content-Range',_0xc700+'-'+_0x1740bf+'/'+_0x49a939)[_0xd3ac('0x1d')](_0x29f487);}return null;};}function patchUpdates(_0x4d70a1){return function(_0x1e12ed){try{jsonpatch[_0xd3ac('0x1e')](_0x1e12ed,_0x4d70a1,!![]);}catch(_0x115d7d){return BPromise[_0xd3ac('0x1f')](_0x115d7d);}return _0x1e12ed[_0xd3ac('0x20')]();};}function saveUpdates(_0x2e31b3,_0x483c50){return function(_0x49fff4){if(_0x49fff4){return _0x49fff4[_0xd3ac('0x21')](_0x2e31b3)[_0xd3ac('0x22')](function(_0x2792e2){return _0x2792e2;});}return null;};}function removeEntity(_0x2f2abe,_0x575724){return function(_0x2223f7){if(_0x2223f7){return _0x2223f7[_0xd3ac('0x23')]()[_0xd3ac('0x22')](function(){_0x2f2abe['status'](0xcc)[_0xd3ac('0x17')]();});}};}function handleEntityNotFound(_0x3b78d8,_0x3dcc1c){return function(_0x2163bd){if(!_0x2163bd){_0x3b78d8['sendStatus'](0x194);}return _0x2163bd;};}function handleError(_0x57ae6f,_0x565318){_0x565318=_0x565318||0x1f4;return function(_0x30b415){logger[_0xd3ac('0x24')](_0x30b415[_0xd3ac('0x25')]);if(_0x30b415[_0xd3ac('0x26')]){delete _0x30b415['name'];}_0x57ae6f[_0xd3ac('0x18')](_0x565318)[_0xd3ac('0x27')](_0x30b415);};}exports['index']=function(_0x59a2aa,_0x270ee7){var _0x1307d6={},_0x42df91={},_0x7a9107={'count':0x0,'rows':[]};var _0x59a6a0=_[_0xd3ac('0x28')](db['VoiceMailMessage']['rawAttributes'],function(_0x53bca2){return{'name':_0x53bca2['fieldName'],'type':_0x53bca2['type'][_0xd3ac('0x29')]};});_0x42df91[_0xd3ac('0x2a')]=_[_0xd3ac('0x2b')](_[_0xd3ac('0x28')](_0x59a6a0,_0xd3ac('0x26')),[_0xd3ac('0x26')]);_0x42df91[_0xd3ac('0x2c')]=_['keys'](_0x59a2aa['query']);_0x42df91[_0xd3ac('0x2d')]=_[_0xd3ac('0x2e')](_0x42df91[_0xd3ac('0x2a')],_0x42df91[_0xd3ac('0x2c')]);_0x1307d6[_0xd3ac('0x2f')]=_['intersection'](_0x42df91[_0xd3ac('0x2a')],qs['fields'](_0x59a2aa[_0xd3ac('0x2c')][_0xd3ac('0x30')]));_0x1307d6[_0xd3ac('0x2f')]=_0x1307d6[_0xd3ac('0x2f')][_0xd3ac('0x31')]?_0x1307d6[_0xd3ac('0x2f')]:_0x42df91[_0xd3ac('0x2a')];if(!_0x59a2aa['query'][_0xd3ac('0x32')](_0xd3ac('0x33'))){_0x1307d6[_0xd3ac('0x1c')]=qs[_0xd3ac('0x1c')](_0x59a2aa[_0xd3ac('0x2c')][_0xd3ac('0x1c')]);_0x1307d6['offset']=qs[_0xd3ac('0x1b')](_0x59a2aa[_0xd3ac('0x2c')][_0xd3ac('0x1b')]);}_0x1307d6[_0xd3ac('0x34')]=qs['sort'](_0x59a2aa[_0xd3ac('0x2c')][_0xd3ac('0x35')]);_0x1307d6[_0xd3ac('0x36')]=qs[_0xd3ac('0x2d')](_[_0xd3ac('0x37')](_0x59a2aa[_0xd3ac('0x2c')],_0x42df91[_0xd3ac('0x2d')]),_0x59a6a0);if(_0x59a2aa[_0xd3ac('0x2c')]['filter']){_0x1307d6['where']=_[_0xd3ac('0x38')](_0x1307d6[_0xd3ac('0x36')],{'$or':_['map'](_0x59a6a0,function(_0x555985){if(_0x555985['type']!=='VIRTUAL'){var _0x36e0ed={};_0x36e0ed[_0x555985['name']]={'$like':'%'+_0x59a2aa[_0xd3ac('0x2c')][_0xd3ac('0x39')]+'%'};return _0x36e0ed;}})});}_0x1307d6=_[_0xd3ac('0x38')]({},_0x1307d6,_0x59a2aa['options']);var _0x571a0a={'where':_0x1307d6[_0xd3ac('0x36')]};return db[_0xd3ac('0x3a')][_0xd3ac('0x1a')](_0x571a0a)[_0xd3ac('0x22')](function(_0x2d622e){_0x7a9107[_0xd3ac('0x1a')]=_0x2d622e;if(_0x59a2aa[_0xd3ac('0x2c')]['includeAll']){_0x1307d6[_0xd3ac('0x3b')]=[{'all':!![]}];}return db[_0xd3ac('0x3a')][_0xd3ac('0x3c')](_0x1307d6);})[_0xd3ac('0x22')](function(_0x5440c5){_0x7a9107['rows']=_0x5440c5;return _0x7a9107;})['then'](respondWithFilteredResult(_0x270ee7,_0x1307d6))[_0xd3ac('0x3d')](handleError(_0x270ee7,null));};exports[_0xd3ac('0x3e')]=function(_0x2c3c16,_0xf6b81b){var _0x11ea02={'raw':!![],'where':{'id':_0x2c3c16[_0xd3ac('0x3f')]['id']}},_0x28b73d={};_0x28b73d[_0xd3ac('0x2a')]=_['keys'](db[_0xd3ac('0x3a')][_0xd3ac('0x40')]);_0x28b73d[_0xd3ac('0x2c')]=_[_0xd3ac('0x41')](_0x2c3c16[_0xd3ac('0x2c')]);_0x28b73d[_0xd3ac('0x2d')]=_[_0xd3ac('0x2e')](_0x28b73d['model'],_0x28b73d[_0xd3ac('0x2c')]);_0x11ea02[_0xd3ac('0x2f')]=_['intersection'](_0x28b73d[_0xd3ac('0x2a')],qs[_0xd3ac('0x30')](_0x2c3c16[_0xd3ac('0x2c')][_0xd3ac('0x30')]));_0x11ea02['attributes']=_0x11ea02[_0xd3ac('0x2f')][_0xd3ac('0x31')]?_0x11ea02[_0xd3ac('0x2f')]:_0x28b73d['model'];if(_0x2c3c16[_0xd3ac('0x2c')][_0xd3ac('0x42')]){_0x11ea02[_0xd3ac('0x3b')]=[{'all':!![]}];}_0x11ea02=_['merge']({},_0x11ea02,_0x2c3c16[_0xd3ac('0x43')]);return db[_0xd3ac('0x3a')][_0xd3ac('0x44')](_0x11ea02)['then'](handleEntityNotFound(_0xf6b81b,null))[_0xd3ac('0x22')](respondWithResult(_0xf6b81b,null))[_0xd3ac('0x3d')](handleError(_0xf6b81b,null));};exports[_0xd3ac('0x45')]=function(_0x2e70c0,_0x181c27){return db[_0xd3ac('0x3a')]['create'](_0x2e70c0[_0xd3ac('0x46')],{})['then'](respondWithResult(_0x181c27,0xc9))[_0xd3ac('0x3d')](handleError(_0x181c27,null));};exports[_0xd3ac('0x21')]=function(_0x4ff4e3,_0x4a0335){if(_0x4ff4e3[_0xd3ac('0x46')]['id']){delete _0x4ff4e3[_0xd3ac('0x46')]['id'];}return db[_0xd3ac('0x3a')][_0xd3ac('0x44')]({'where':{'id':_0x4ff4e3[_0xd3ac('0x3f')]['id']}})[_0xd3ac('0x22')](handleEntityNotFound(_0x4a0335,null))['then'](saveUpdates(_0x4ff4e3[_0xd3ac('0x46')],null))['then'](respondWithResult(_0x4a0335,null))[_0xd3ac('0x3d')](handleError(_0x4a0335,null));};exports[_0xd3ac('0x23')]=function(_0x33c1fb,_0xabaf73){return db[_0xd3ac('0x3a')][_0xd3ac('0x44')]({'where':{'id':_0x33c1fb[_0xd3ac('0x3f')]['id']}})[_0xd3ac('0x22')](handleEntityNotFound(_0xabaf73,null))[_0xd3ac('0x22')](removeEntity(_0xabaf73,null))[_0xd3ac('0x3d')](handleError(_0xabaf73,null));};exports[_0xd3ac('0x47')]=function(_0x364a17,_0x49a42a,_0x51b431){return db['VoiceMailMessage']['find']({'where':{'id':_0x364a17[_0xd3ac('0x3f')]['id']},'attributes':['id',_0xd3ac('0x48'),_0xd3ac('0x49')]})['then'](handleEntityNotFound(_0x49a42a,null))[_0xd3ac('0x22')](function(_0x36af09){if(_0x36af09){if(!_0x36af09[_0xd3ac('0x48')]){throw new db[(_0xd3ac('0x4a'))][(_0xd3ac('0x4b'))]('VoiceMailMessage\x20not\x20found');}var _0x3a7f77={'Content-Type':_0xd3ac('0x4c'),'Content-Disposition':_0xd3ac('0x4d')};if(_0x36af09[_0xd3ac('0x49')]){_0x3a7f77[_0xd3ac('0x4e')]=_0xd3ac('0x4f')+_0x36af09[_0xd3ac('0x49')]+_0xd3ac('0x50');}_0x49a42a[_0xd3ac('0x51')](_0x3a7f77);return _0x49a42a[_0xd3ac('0x27')](new Buffer(_0x36af09[_0xd3ac('0x48')]));}})[_0xd3ac('0x3d')](handleError(_0x49a42a,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 965b7c3..35a6323 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 _0xb162=['util','../../config/logger','moment','bluebird','../../config/environment','exports','define','voice_voicemail_messages','dir'];(function(_0x241f74,_0x244cc0){var _0x5b63aa=function(_0x3b680e){while(--_0x3b680e){_0x241f74['push'](_0x241f74['shift']());}};_0x5b63aa(++_0x244cc0);}(_0xb162,0x18c));var _0x2b16=function(_0x3fb5e6,_0x5ba7c2){_0x3fb5e6=_0x3fb5e6-0x0;var _0x48dad1=_0xb162[_0x3fb5e6];return _0x48dad1;};'use strict';var _=require('lodash');var util=require(_0x2b16('0x0'));var logger=require(_0x2b16('0x1'))('api');var moment=require(_0x2b16('0x2'));var BPromise=require(_0x2b16('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b16('0x4'));var attributes=require('./voiceMailMessage.attributes');module[_0x2b16('0x5')]=function(_0x35ffcf,_0x535516){return _0x35ffcf[_0x2b16('0x6')]('VoiceMailMessage',attributes,{'tableName':_0x2b16('0x7'),'paranoid':![],'indexes':[{'name':_0x2b16('0x8'),'fields':[_0x2b16('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc5b0=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceMailMessage.attributes'];(function(_0x2d5e48,_0x4b0937){var _0x50e8b5=function(_0x5a0320){while(--_0x5a0320){_0x2d5e48['push'](_0x2d5e48['shift']());}};_0x50e8b5(++_0x4b0937);}(_0xc5b0,0x65));var _0x0c5b=function(_0xc1a7d3,_0x6ac180){_0xc1a7d3=_0xc1a7d3-0x0;var _0x576e8d=_0xc5b0[_0xc1a7d3];return _0x576e8d;};'use strict';var _=require('lodash');var util=require(_0x0c5b('0x0'));var logger=require(_0x0c5b('0x1'))(_0x0c5b('0x2'));var moment=require('moment');var BPromise=require(_0x0c5b('0x3'));var rp=require(_0x0c5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c5b('0x5'));var config=require('../../config/environment');var attributes=require(_0x0c5b('0x6'));module[_0x0c5b('0x7')]=function(_0x3c660f,_0x1ab812){return _0x3c660f[_0x0c5b('0x8')](_0x0c5b('0x9'),attributes,{'tableName':_0x0c5b('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x0c5b('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c81af84..7c7c103 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 _0x163f=['VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','info','request\x20sent','debug','code','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x163f,0x17e));var _0xf163=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x163f[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xf163('0x0'));var util=require(_0xf163('0x1'));var moment=require(_0xf163('0x2'));var BPromise=require(_0xf163('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf163('0x4'));var db=require(_0xf163('0x5'))['db'];var utils=require(_0xf163('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf163('0x7'));var client=jayson['client'][_0xf163('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56a026,_0x3cb55c,_0x193c22){return new BPromise(function(_0x12e5fb,_0x3ef717){return client['request'](_0x56a026,_0x193c22)['then'](function(_0x3af931){logger[_0xf163('0x9')]('VoiceMailMessage,\x20%s,\x20%s',_0x3cb55c,_0xf163('0xa'));logger[_0xf163('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x3cb55c,_0xf163('0xa'),JSON['stringify'](_0x3af931));if(_0x3af931['error']){if(_0x3af931['error'][_0xf163('0xc')]===0x1f4){logger[_0xf163('0xd')](_0xf163('0xe'),_0x3cb55c,_0x3af931['error']['message']);return _0x3ef717(_0x3af931[_0xf163('0xd')][_0xf163('0xf')]);}logger[_0xf163('0xd')](_0xf163('0xe'),_0x3cb55c,_0x3af931[_0xf163('0xd')]['message']);return _0x12e5fb(_0x3af931['error'][_0xf163('0xf')]);}else{logger[_0xf163('0x9')]('VoiceMailMessage,\x20%s,\x20%s',_0x3cb55c,_0xf163('0xa'));_0x12e5fb(_0x3af931[_0xf163('0x10')]['message']);}})[_0xf163('0x11')](function(_0x28e2c7){logger[_0xf163('0xd')](_0xf163('0xe'),_0x3cb55c,_0x28e2c7);_0x3ef717(_0x28e2c7);});});} \ No newline at end of file +var _0x99d9=['catch','util','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x277fe7,_0x921c17){var _0x361fd0=function(_0x5f59d6){while(--_0x5f59d6){_0x277fe7['push'](_0x277fe7['shift']());}};_0x361fd0(++_0x921c17);}(_0x99d9,0x133));var _0x999d=function(_0x2ba61c,_0x7e207b){_0x2ba61c=_0x2ba61c-0x0;var _0x14cbe9=_0x99d9[_0x2ba61c];return _0x14cbe9;};'use strict';var _=require('lodash');var util=require(_0x999d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x999d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999d('0x2'))['db'];var utils=require(_0x999d('0x3'));var logger=require('../../config/logger')(_0x999d('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x999d('0x5')][_0x999d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x323575,_0x269008,_0x58d55b){return new BPromise(function(_0x3840fd,_0x49c683){return client[_0x999d('0x7')](_0x323575,_0x58d55b)['then'](function(_0x43e8a8){logger[_0x999d('0x8')](_0x999d('0x9'),_0x269008,_0x999d('0xa'));logger[_0x999d('0xb')](_0x999d('0xc'),_0x269008,_0x999d('0xa'),JSON['stringify'](_0x43e8a8));if(_0x43e8a8['error']){if(_0x43e8a8[_0x999d('0xd')][_0x999d('0xe')]===0x1f4){logger['error'](_0x999d('0x9'),_0x269008,_0x43e8a8[_0x999d('0xd')][_0x999d('0xf')]);return _0x49c683(_0x43e8a8[_0x999d('0xd')][_0x999d('0xf')]);}logger[_0x999d('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x269008,_0x43e8a8[_0x999d('0xd')]['message']);return _0x3840fd(_0x43e8a8[_0x999d('0xd')][_0x999d('0xf')]);}else{logger['info'](_0x999d('0x9'),_0x269008,_0x999d('0xa'));_0x3840fd(_0x43e8a8[_0x999d('0x10')][_0x999d('0xf')]);}})[_0x999d('0x11')](function(_0x5c14da){logger[_0x999d('0xd')](_0x999d('0x9'),_0x269008,_0x5c14da);_0x49c683(_0x5c14da);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5d5b2e3..e32ae29 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 _0xf80a=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSounds','post','create','/:id/sounds','addSound','put','destroy','delete','/:id/sounds/:id2','exports','multer','util'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xf80a,0x166));var _0xaf80=function(_0x25fb19,_0x57b960){_0x25fb19=_0x25fb19-0x0;var _0x56a9d2=_0xf80a[_0x25fb19];return _0x56a9d2;};'use strict';var multer=require(_0xaf80('0x0'));var util=require(_0xaf80('0x1'));var path=require(_0xaf80('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf80('0x3'));var router=express[_0xaf80('0x4')]();var fs_extra=require(_0xaf80('0x5'));var auth=require(_0xaf80('0x6'));var interaction=require(_0xaf80('0x7'));var config=require(_0xaf80('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0xaf80('0x9')]('/',auth[_0xaf80('0xa')](),controller[_0xaf80('0xb')]);router[_0xaf80('0x9')](_0xaf80('0xc'),auth[_0xaf80('0xa')](),controller[_0xaf80('0xd')]);router[_0xaf80('0x9')]('/:id/sounds',auth[_0xaf80('0xa')](),controller[_0xaf80('0xe')]);router[_0xaf80('0xf')]('/',auth[_0xaf80('0xa')](),controller[_0xaf80('0x10')]);router[_0xaf80('0xf')](_0xaf80('0x11'),auth[_0xaf80('0xa')](),controller[_0xaf80('0x12')]);router[_0xaf80('0x13')](_0xaf80('0xc'),auth[_0xaf80('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xaf80('0x14')]);router[_0xaf80('0x15')](_0xaf80('0x16'),auth[_0xaf80('0xa')](),controller['removeSound']);module[_0xaf80('0x17')]=router; \ No newline at end of file +var _0xce0b=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','post','create','addSound','/:id','delete','destroy','removeSound','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0xce0b,0x15f));var _0xbce0=function(_0x485cca,_0x316194){_0x485cca=_0x485cca-0x0;var _0x1eeaa0=_0xce0b[_0x485cca];return _0x1eeaa0;};'use strict';var multer=require('multer');var util=require(_0xbce0('0x0'));var path=require(_0xbce0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbce0('0x2')]();var fs_extra=require(_0xbce0('0x3'));var auth=require(_0xbce0('0x4'));var interaction=require(_0xbce0('0x5'));var config=require(_0xbce0('0x6'));var controller=require(_0xbce0('0x7'));router[_0xbce0('0x8')]('/',auth[_0xbce0('0x9')](),controller[_0xbce0('0xa')]);router['get']('/:id',auth[_0xbce0('0x9')](),controller[_0xbce0('0xb')]);router[_0xbce0('0x8')](_0xbce0('0xc'),auth['isAuthenticated'](),controller['getSounds']);router[_0xbce0('0xd')]('/',auth[_0xbce0('0x9')](),controller[_0xbce0('0xe')]);router[_0xbce0('0xd')](_0xbce0('0xc'),auth[_0xbce0('0x9')](),controller[_0xbce0('0xf')]);router['put'](_0xbce0('0x10'),auth[_0xbce0('0x9')](),controller['update']);router[_0xbce0('0x11')](_0xbce0('0x10'),auth[_0xbce0('0x9')](),controller[_0xbce0('0x12')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xbce0('0x13')]);module[_0xbce0('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c616cd9..361fa1a 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 _0xaf99=['quietmp3nb','quietmp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','mp3nb'];(function(_0x3132e8,_0x499a0e){var _0x43eb8c=function(_0x2321e1){while(--_0x2321e1){_0x3132e8['push'](_0x3132e8['shift']());}};_0x43eb8c(++_0x499a0e);}(_0xaf99,0x13e));var _0x9af9=function(_0x11c275,_0x359c2e){_0x11c275=_0x11c275-0x0;var _0x2bb1ec=_0xaf99[_0x11c275];return _0x2bb1ec;};'use strict';var Sequelize=require(_0x9af9('0x0'));module[_0x9af9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9af9('0x2')},'mode':{'type':Sequelize[_0x9af9('0x3')](_0x9af9('0x4'),_0x9af9('0x5'),_0x9af9('0x6'),_0x9af9('0x7'),_0x9af9('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0x9af9('0x5')},'directory':{'type':Sequelize[_0x9af9('0x9')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x9af9('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9af9('0xa')},'format':{'type':Sequelize[_0x9af9('0x9')],'allowNull':!![]},'stamp':{'type':_0x9af9('0xb')},'defaultEntry':{'type':Sequelize[_0x9af9('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7420=['sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','alpha','TIMESTAMP','BOOLEAN'];(function(_0x4cf97f,_0x3bcb11){var _0x41106a=function(_0x31c7fb){while(--_0x31c7fb){_0x4cf97f['push'](_0x4cf97f['shift']());}};_0x41106a(++_0x3bcb11);}(_0x7420,0x6c));var _0x0742=function(_0x302d62,_0x97710d){_0x302d62=_0x302d62-0x0;var _0x43a9a7=_0x7420[_0x302d62];return _0x43a9a7;};'use strict';var Sequelize=require(_0x0742('0x0'));module[_0x0742('0x1')]={'name':{'type':Sequelize[_0x0742('0x2')],'allowNull':![],'unique':_0x0742('0x3')},'mode':{'type':Sequelize[_0x0742('0x4')](_0x0742('0x5'),_0x0742('0x6'),_0x0742('0x7'),_0x0742('0x8'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x0742('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x0742('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x0742('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x0742('0x2')],'allowNull':!![],'defaultValue':_0x0742('0x9')},'format':{'type':Sequelize[_0x0742('0x2')],'allowNull':!![]},'stamp':{'type':_0x0742('0xa')},'defaultEntry':{'type':Sequelize[_0x0742('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 c769039..bd72693 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 _0x1c06=['server/files/sounds/converted','%s.%s','basename','extname','format','Sequelize','removeSound','id2','order','getSounds','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','undefined','count','offset','status','set','Content-Range','json','apply','reject','save','then','destroy','get','MusicOnHolds','sendStatus','error','stack','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','body','params','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name','converted_format'];(function(_0x1d9102,_0x23c2fd){var _0x178f64=function(_0x409144){while(--_0x409144){_0x1d9102['push'](_0x1d9102['shift']());}};_0x178f64(++_0x23c2fd);}(_0x1c06,0x1d7));var _0x61c0=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x1c06[_0x5d72da];return _0x43ebe7;};'use strict';var emlformat=require(_0x61c0('0x0'));var rimraf=require(_0x61c0('0x1'));var zipdir=require(_0x61c0('0x2'));var jsonpatch=require(_0x61c0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x61c0('0x4'));var util=require(_0x61c0('0x5'));var path=require(_0x61c0('0x6'));var sox=require(_0x61c0('0x7'));var csv=require(_0x61c0('0x8'));var ejs=require(_0x61c0('0x9'));var fs=require('fs');var fs_extra=require(_0x61c0('0xa'));var _=require(_0x61c0('0xb'));var squel=require(_0x61c0('0xc'));var crypto=require('crypto');var jsforce=require(_0x61c0('0xd'));var deskjs=require(_0x61c0('0xe'));var toCsv=require(_0x61c0('0x8'));var querystring=require('querystring');var Papa=require(_0x61c0('0xf'));var Redis=require(_0x61c0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x61c0('0x11'));var as=require(_0x61c0('0x12'));var hardwareService=require(_0x61c0('0x13'));var logger=require(_0x61c0('0x14'))(_0x61c0('0x15'));var utils=require(_0x61c0('0x16'));var config=require(_0x61c0('0x17'));var licenseUtil=require(_0x61c0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50549d,_0x47c33f){_0x47c33f=_0x47c33f||0xcc;return function(_0x4aff21){if(_0x4aff21){return _0x50549d['sendStatus'](_0x47c33f);}return _0x50549d['status'](_0x47c33f)[_0x61c0('0x19')]();};}function respondWithResult(_0x456752,_0xaf5ac0){_0xaf5ac0=_0xaf5ac0||0xc8;return function(_0x4d051b){if(_0x4d051b){return _0x456752['status'](_0xaf5ac0)['json'](_0x4d051b);}};}function respondWithFilteredResult(_0xa52be4,_0x4d4012){return function(_0x2e4d32){if(_0x2e4d32){var _0x2760c0=typeof _0x4d4012['offset']===_0x61c0('0x1a')&&typeof _0x4d4012['limit']===_0x61c0('0x1a');var _0xcda9c9=_0x2e4d32[_0x61c0('0x1b')];var _0xff204e=_0x2760c0?0x0:_0x4d4012[_0x61c0('0x1c')];var _0x16b294=_0x2760c0?_0x2e4d32[_0x61c0('0x1b')]:_0x4d4012[_0x61c0('0x1c')]+_0x4d4012['limit'];var _0x508d6b;if(_0x16b294>=_0xcda9c9){_0x16b294=_0xcda9c9;_0x508d6b=0xc8;}else{_0x508d6b=0xce;}_0xa52be4[_0x61c0('0x1d')](_0x508d6b);return _0xa52be4[_0x61c0('0x1e')](_0x61c0('0x1f'),_0xff204e+'-'+_0x16b294+'/'+_0xcda9c9)[_0x61c0('0x20')](_0x2e4d32);}return null;};}function patchUpdates(_0x48ca9e){return function(_0x3064df){try{jsonpatch[_0x61c0('0x21')](_0x3064df,_0x48ca9e,!![]);}catch(_0x25aa27){return BPromise[_0x61c0('0x22')](_0x25aa27);}return _0x3064df[_0x61c0('0x23')]();};}function saveUpdates(_0x301766,_0x5237b5){return function(_0x1f9307){if(_0x1f9307){return _0x1f9307['update'](_0x301766)[_0x61c0('0x24')](function(_0xf48ecb){return _0xf48ecb;});}return null;};}function removeEntity(_0x634324,_0x47e1a){return function(_0x1c9751){if(_0x1c9751){return _0x1c9751[_0x61c0('0x25')]()[_0x61c0('0x24')](function(){var _0x52df5f=_0x1c9751[_0x61c0('0x26')]({'plain':!![]});var _0x43b906=_0x61c0('0x27');return db['UserProfileResource'][_0x61c0('0x25')]({'where':{'type':_0x43b906,'resourceId':_0x52df5f['id']}})[_0x61c0('0x24')](function(){return _0x1c9751;});})[_0x61c0('0x24')](function(){_0x634324[_0x61c0('0x1d')](0xcc)[_0x61c0('0x19')]();});}};}function handleEntityNotFound(_0x58c87f,_0x128b8f){return function(_0xc9e53d){if(!_0xc9e53d){_0x58c87f[_0x61c0('0x28')](0x194);}return _0xc9e53d;};}function handleError(_0x5c9378,_0x560e11){_0x560e11=_0x560e11||0x1f4;return function(_0x58f2ef){logger[_0x61c0('0x29')](_0x58f2ef[_0x61c0('0x2a')]);if(_0x58f2ef['name']){delete _0x58f2ef['name'];}_0x5c9378[_0x61c0('0x1d')](_0x560e11)[_0x61c0('0x2b')](_0x58f2ef);};}exports[_0x61c0('0x2c')]=function(_0x20cdd5,_0x22c424){var _0x52f298={},_0x174d3e={},_0x1f9da0={'count':0x0,'rows':[]};var _0x39ea7b=_[_0x61c0('0x2d')](db[_0x61c0('0x2e')][_0x61c0('0x2f')],function(_0x1f275e){return{'name':_0x1f275e[_0x61c0('0x30')],'type':_0x1f275e['type'][_0x61c0('0x31')]};});_0x174d3e[_0x61c0('0x32')]=_['map'](_0x39ea7b,_0x61c0('0x33'));_0x174d3e[_0x61c0('0x34')]=_['keys'](_0x20cdd5['query']);_0x174d3e['filters']=_[_0x61c0('0x35')](_0x174d3e['model'],_0x174d3e[_0x61c0('0x34')]);_0x52f298[_0x61c0('0x36')]=_['intersection'](_0x174d3e['model'],qs['fields'](_0x20cdd5['query'][_0x61c0('0x37')]));_0x52f298[_0x61c0('0x36')]=_0x52f298['attributes'][_0x61c0('0x38')]?_0x52f298[_0x61c0('0x36')]:_0x174d3e[_0x61c0('0x32')];if(!_0x20cdd5['query'][_0x61c0('0x39')]('nolimit')){_0x52f298[_0x61c0('0x3a')]=qs[_0x61c0('0x3a')](_0x20cdd5[_0x61c0('0x34')][_0x61c0('0x3a')]);_0x52f298[_0x61c0('0x1c')]=qs[_0x61c0('0x1c')](_0x20cdd5[_0x61c0('0x34')]['offset']);}_0x52f298['order']=qs['sort'](_0x20cdd5[_0x61c0('0x34')]['sort']);delete _0x20cdd5[_0x61c0('0x34')][_0x61c0('0x3b')];_0x52f298[_0x61c0('0x3c')]=qs[_0x61c0('0x3d')](_[_0x61c0('0x3e')](_0x20cdd5['query'],_0x174d3e[_0x61c0('0x3d')]),_0x39ea7b);if(_0x20cdd5[_0x61c0('0x34')][_0x61c0('0x3f')]){_0x52f298[_0x61c0('0x3c')]=_[_0x61c0('0x40')](_0x52f298['where'],{'$or':_[_0x61c0('0x2d')](_0x39ea7b,function(_0x4f807c){if(_0x4f807c['type']!==_0x61c0('0x41')){var _0x41dbf1={};_0x41dbf1[_0x4f807c[_0x61c0('0x33')]]={'$like':'%'+_0x20cdd5[_0x61c0('0x34')][_0x61c0('0x3f')]+'%'};return _0x41dbf1;}})});}_0x52f298=_['merge']({},_0x52f298,_0x20cdd5[_0x61c0('0x42')]);var _0x339341={'where':_0x52f298[_0x61c0('0x3c')]};return db['VoiceMusicOnHold']['count'](_0x339341)[_0x61c0('0x24')](function(_0xff050){_0x1f9da0[_0x61c0('0x1b')]=_0xff050;if(_0x20cdd5[_0x61c0('0x34')][_0x61c0('0x43')]){_0x52f298['include']=[{'all':!![]}];}return db[_0x61c0('0x2e')][_0x61c0('0x44')](_0x52f298);})[_0x61c0('0x24')](function(_0x4bcb9c){_0x1f9da0[_0x61c0('0x45')]=_0x4bcb9c;return _0x1f9da0;})[_0x61c0('0x24')](respondWithFilteredResult(_0x22c424,_0x52f298))[_0x61c0('0x46')](handleError(_0x22c424,null));};exports[_0x61c0('0x47')]=function(_0x515293,_0x1fe3f5){var _0x508ee0={'raw':![],'where':{'id':_0x515293['params']['id']}},_0x5bd1f3={};_0x5bd1f3[_0x61c0('0x32')]=_['keys'](db[_0x61c0('0x2e')][_0x61c0('0x2f')]);_0x5bd1f3[_0x61c0('0x34')]=_[_0x61c0('0x48')](_0x515293[_0x61c0('0x34')]);_0x5bd1f3['filters']=_[_0x61c0('0x35')](_0x5bd1f3['model'],_0x5bd1f3['query']);_0x508ee0[_0x61c0('0x36')]=_[_0x61c0('0x35')](_0x5bd1f3[_0x61c0('0x32')],qs[_0x61c0('0x37')](_0x515293[_0x61c0('0x34')][_0x61c0('0x37')]));_0x508ee0[_0x61c0('0x36')]=_0x508ee0[_0x61c0('0x36')]['length']?_0x508ee0[_0x61c0('0x36')]:_0x5bd1f3['model'];if(_0x515293['query'][_0x61c0('0x43')]){_0x508ee0[_0x61c0('0x49')]=[{'all':!![]}];}_0x508ee0=_[_0x61c0('0x40')]({},_0x508ee0,_0x515293[_0x61c0('0x42')]);return db[_0x61c0('0x2e')][_0x61c0('0x4a')](_0x508ee0)[_0x61c0('0x24')](handleEntityNotFound(_0x1fe3f5,null))[_0x61c0('0x24')](respondWithResult(_0x1fe3f5,null))['catch'](handleError(_0x1fe3f5,null));};exports['update']=function(_0x307365,_0x2b3d95){if(_0x307365['body']['id']){delete _0x307365[_0x61c0('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x61c0('0x4a')]({'where':{'id':_0x307365[_0x61c0('0x4c')]['id']}})[_0x61c0('0x24')](handleEntityNotFound(_0x2b3d95,null))[_0x61c0('0x24')](saveUpdates(_0x307365['body'],null))[_0x61c0('0x24')](respondWithResult(_0x2b3d95,null))['catch'](handleError(_0x2b3d95,null));};exports[_0x61c0('0x4d')]=function(_0x49ed0b,_0x1fd9a5,_0x131dd7){return db[_0x61c0('0x4e')][_0x61c0('0x4f')](function(_0x302f52){if(_0x49ed0b[_0x61c0('0x4b')][_0x61c0('0x50')]==='files'){_0x49ed0b[_0x61c0('0x4b')][_0x61c0('0x51')]=path[_0x61c0('0x52')](config[_0x61c0('0x53')],_0x61c0('0x54'),_0x49ed0b[_0x61c0('0x4b')][_0x61c0('0x33')]);}return db[_0x61c0('0x2e')]['create'](_0x49ed0b[_0x61c0('0x4b')],{'transaction':_0x302f52})[_0x61c0('0x24')](function(_0x1faf09){if(_0x49ed0b[_0x61c0('0x4b')][_0x61c0('0x50')]===_0x61c0('0x55')){fs[_0x61c0('0x56')](_0x1faf09[_0x61c0('0x51')],parseInt(_0x61c0('0x57'),0x8));}var _0x2e35c4=_0x49ed0b[_0x61c0('0x58')][_0x61c0('0x26')]({'plain':!![]});if(!_0x2e35c4)throw new Error(_0x61c0('0x59'));if(_0x2e35c4[_0x61c0('0x5a')]===_0x61c0('0x58')){var _0x6c79c2=_0x1faf09[_0x61c0('0x26')]({'plain':!![]});return db[_0x61c0('0x5b')][_0x61c0('0x4a')]({'where':{'name':_0x61c0('0x27'),'userProfileId':_0x2e35c4['userProfileId']},'raw':!![]})[_0x61c0('0x24')](function(_0x15d671){if(_0x15d671&&_0x15d671['autoAssociation']===0x0){return db[_0x61c0('0x5c')][_0x61c0('0x4d')]({'name':_0x6c79c2[_0x61c0('0x33')],'resourceId':_0x6c79c2['id'],'type':_0x15d671['name'],'sectionId':_0x15d671['id']},{})[_0x61c0('0x24')](function(){return _0x1faf09;});}else{return _0x1faf09;}})[_0x61c0('0x46')](function(_0x5ef7ba){logger['error'](_0x61c0('0x5d'),_0x5ef7ba);});}return _0x1faf09;});})[_0x61c0('0x24')](respondWithResult(_0x1fd9a5,0xc9))[_0x61c0('0x46')](handleError(_0x1fd9a5,null));};exports[_0x61c0('0x25')]=function(_0x47c59a,_0x24f921,_0x12ce55){var _0x54fcad;return db[_0x61c0('0x2e')][_0x61c0('0x4a')]({'where':{'id':_0x47c59a[_0x61c0('0x4c')]['id']}})[_0x61c0('0x24')](function(_0x39ce88){if(_0x39ce88){return db[_0x61c0('0x4e')]['transaction'](function(_0x1512b4){return _0x39ce88[_0x61c0('0x25')]({'transaction':_0x1512b4,'raw':!![]})['then'](function(_0x4b470c){if(_0x4b470c[_0x61c0('0x51')]){fs[_0x61c0('0x5e')](_0x4b470c[_0x61c0('0x51')])['forEach'](function(_0x2defc0){fs[_0x61c0('0x5f')](path[_0x61c0('0x52')](_0x4b470c[_0x61c0('0x51')],_0x2defc0));});fs[_0x61c0('0x60')](_0x4b470c[_0x61c0('0x51')]);}return _0x4b470c;});})[_0x61c0('0x46')](function(_0x2b1c2c){throw new db['Sequelize'][(_0x61c0('0x61'))](_0x2b1c2c[_0x61c0('0x62')]);});}})['then'](handleEntityNotFound(_0x24f921,null))[_0x61c0('0x24')](removeEntity(_0x24f921,null))[_0x61c0('0x46')](handleError(_0x24f921,null));};exports[_0x61c0('0x63')]=function(_0x3c52ba,_0x415572,_0x296e07){return db[_0x61c0('0x4e')][_0x61c0('0x4f')](function(_0x9198f9){var _0x379443;return db[_0x61c0('0x2e')][_0x61c0('0x4a')]({'where':{'id':_0x3c52ba[_0x61c0('0x4c')]['id']}})[_0x61c0('0x24')](function(_0x4d828b){if(_0x4d828b){_0x379443=_0x4d828b;return _0x4d828b['addSound'](_0x3c52ba['body']['id'],{'transaction':_0x9198f9});}})['then'](function(_0x3fbd2b){if(_0x3fbd2b){return db[_0x61c0('0x64')][_0x61c0('0x65')]({'where':{'id':_0x3c52ba[_0x61c0('0x4b')]['id']},'attributes':['id',_0x61c0('0x33'),_0x61c0('0x66'),_0x61c0('0x67'),'createdAt'],'raw':!![]});}})[_0x61c0('0x24')](function(_0x55bc53){if(_0x55bc53){var _0x15eae9=path[_0x61c0('0x52')](config[_0x61c0('0x53')],_0x61c0('0x68'),util['format'](_0x61c0('0x69'),path[_0x61c0('0x6a')](_0x55bc53[_0x61c0('0x66')],path[_0x61c0('0x6b')](_0x55bc53[_0x61c0('0x66')])),_0x55bc53[_0x61c0('0x67')]));var _0x398c55=path[_0x61c0('0x52')](config[_0x61c0('0x53')],'server/files/moh',_0x379443['name'],util[_0x61c0('0x6c')](_0x61c0('0x69'),_0x55bc53[_0x61c0('0x33')],_0x55bc53[_0x61c0('0x67')]));fs['symlinkSync'](_0x15eae9,_0x398c55);return _0x55bc53;}})['catch'](function(_0x1b2d57){throw new db[(_0x61c0('0x6d'))][(_0x61c0('0x61'))](_0x1b2d57[_0x61c0('0x62')]);});})['then'](handleEntityNotFound(_0x415572,null))[_0x61c0('0x24')](respondWithResult(_0x415572,0xc9))[_0x61c0('0x46')](handleError(_0x415572,null));};exports[_0x61c0('0x6e')]=function(_0x1e7945,_0x399103,_0x142de9){return db[_0x61c0('0x4e')][_0x61c0('0x4f')](function(_0x1771f2){var _0x41b943;return db[_0x61c0('0x2e')][_0x61c0('0x65')]({'where':{'id':_0x1e7945[_0x61c0('0x4c')]['id']}})[_0x61c0('0x24')](handleEntityNotFound(_0x399103,null))[_0x61c0('0x24')](function(_0x4324c7){if(_0x4324c7){_0x41b943=_0x4324c7;return _0x4324c7[_0x61c0('0x6e')](_0x1e7945[_0x61c0('0x4c')]['id2']);}})[_0x61c0('0x24')](function(_0x5e69a3){if(_0x5e69a3){return db['Sound'][_0x61c0('0x65')]({'where':{'id':_0x1e7945[_0x61c0('0x4c')][_0x61c0('0x6f')]},'attributes':['id','name',_0x61c0('0x66'),_0x61c0('0x67'),'createdAt'],'raw':!![]});}})[_0x61c0('0x24')](function(_0x56d55d){if(_0x56d55d){fs[_0x61c0('0x5f')](path[_0x61c0('0x52')](_0x41b943[_0x61c0('0x51')],util[_0x61c0('0x6c')](_0x61c0('0x69'),_0x56d55d[_0x61c0('0x33')],_0x56d55d[_0x61c0('0x67')])));return _0x56d55d;}})[_0x61c0('0x46')](function(_0x490ce8){throw new db['Sequelize'][(_0x61c0('0x61'))](_0x490ce8[_0x61c0('0x62')]);});})[_0x61c0('0x24')](handleEntityNotFound(_0x399103,null))[_0x61c0('0x24')](respondWithStatusCode(_0x399103,0xcc))[_0x61c0('0x46')](handleError(_0x399103,null));};exports['getSounds']=function(_0x1a1cab,_0x36ecfd,_0xfecc8c){var _0x17fde1={};var _0x3e134b={};var _0x54d336;var _0x185543;return db[_0x61c0('0x2e')][_0x61c0('0x65')]({'where':{'id':_0x1a1cab[_0x61c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x36ecfd,null))[_0x61c0('0x24')](function(_0x334402){if(_0x334402){_0x54d336=_0x334402;_0x3e134b[_0x61c0('0x32')]=_[_0x61c0('0x48')](db['Sound'][_0x61c0('0x2f')]);_0x3e134b['query']=_['keys'](_0x1a1cab[_0x61c0('0x34')]);_0x3e134b[_0x61c0('0x3d')]=_[_0x61c0('0x35')](_0x3e134b['model'],_0x3e134b[_0x61c0('0x34')]);_0x17fde1[_0x61c0('0x36')]=_['intersection'](_0x3e134b[_0x61c0('0x32')],qs[_0x61c0('0x37')](_0x1a1cab[_0x61c0('0x34')]['fields']));_0x17fde1[_0x61c0('0x36')]=_0x17fde1[_0x61c0('0x36')][_0x61c0('0x38')]?_0x17fde1[_0x61c0('0x36')]:_0x3e134b['model'];_0x17fde1[_0x61c0('0x70')]=qs[_0x61c0('0x3b')](_0x1a1cab[_0x61c0('0x34')][_0x61c0('0x3b')]);_0x17fde1['where']=qs[_0x61c0('0x3d')](_[_0x61c0('0x3e')](_0x1a1cab[_0x61c0('0x34')],_0x3e134b['filters']));if(_0x1a1cab[_0x61c0('0x34')][_0x61c0('0x3f')]){_0x17fde1[_0x61c0('0x3c')]=_[_0x61c0('0x40')](_0x17fde1['where'],{'$or':_['map'](_0x17fde1['attributes'],function(_0x1d5589){var _0x197322={};_0x197322[_0x1d5589]={'$like':'%'+_0x1a1cab[_0x61c0('0x34')][_0x61c0('0x3f')]+'%'};return _0x197322;})});}_0x17fde1=_[_0x61c0('0x40')]({},_0x17fde1,_0x1a1cab[_0x61c0('0x42')]);return _0x54d336[_0x61c0('0x71')](_0x17fde1);}})[_0x61c0('0x24')](function(_0xf37410){if(_0xf37410){_0x185543=_0xf37410[_0x61c0('0x38')];if(!_0x1a1cab['query'][_0x61c0('0x39')](_0x61c0('0x72'))){_0x17fde1[_0x61c0('0x3a')]=qs['limit'](_0x1a1cab[_0x61c0('0x34')][_0x61c0('0x3a')]);_0x17fde1['offset']=qs[_0x61c0('0x1c')](_0x1a1cab['query'][_0x61c0('0x1c')]);}return _0x54d336[_0x61c0('0x71')](_0x17fde1);}})['then'](function(_0x158a0f){if(_0x158a0f){return _0x158a0f?{'count':_0x185543,'rows':_0x158a0f}:null;}})[_0x61c0('0x24')](respondWithResult(_0x36ecfd,null))[_0x61c0('0x46')](handleError(_0x36ecfd,null));}; \ No newline at end of file +var _0x1e74=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','error','stack','name','VoiceMusicOnHold','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','length','body','find','params','mode','directory','join','root','server/files/moh','create','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','transaction','forEach','unlinkSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','extname','ValidationError','removeSound','sequelize','id2','%s.%s','getSounds','pick','filter','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x21bdd1,_0x3f7cd8){var _0x30514e=function(_0x4c644a){while(--_0x4c644a){_0x21bdd1['push'](_0x21bdd1['shift']());}};_0x30514e(++_0x3f7cd8);}(_0x1e74,0xc9));var _0x41e7=function(_0x227ca3,_0x2a1ab2){_0x227ca3=_0x227ca3-0x0;var _0x17ca7e=_0x1e74[_0x227ca3];return _0x17ca7e;};'use strict';var emlformat=require(_0x41e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x41e7('0x1'));var jsonpatch=require(_0x41e7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x41e7('0x3'));var Mustache=require(_0x41e7('0x4'));var util=require('util');var path=require('path');var sox=require(_0x41e7('0x5'));var csv=require(_0x41e7('0x6'));var ejs=require(_0x41e7('0x7'));var fs=require('fs');var fs_extra=require(_0x41e7('0x8'));var _=require(_0x41e7('0x9'));var squel=require(_0x41e7('0xa'));var crypto=require(_0x41e7('0xb'));var jsforce=require(_0x41e7('0xc'));var deskjs=require(_0x41e7('0xd'));var toCsv=require(_0x41e7('0x6'));var querystring=require(_0x41e7('0xe'));var Papa=require(_0x41e7('0xf'));var Redis=require(_0x41e7('0x10'));var authService=require(_0x41e7('0x11'));var qs=require(_0x41e7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41e7('0x13'));var logger=require(_0x41e7('0x14'))(_0x41e7('0x15'));var utils=require(_0x41e7('0x16'));var config=require(_0x41e7('0x17'));var licenseUtil=require(_0x41e7('0x18'));var db=require(_0x41e7('0x19'))['db'];function respondWithStatusCode(_0x193af5,_0x26251d){_0x26251d=_0x26251d||0xcc;return function(_0x5c2b5d){if(_0x5c2b5d){return _0x193af5[_0x41e7('0x1a')](_0x26251d);}return _0x193af5['status'](_0x26251d)['end']();};}function respondWithResult(_0x2fffce,_0x27fc9c){_0x27fc9c=_0x27fc9c||0xc8;return function(_0x10d6d2){if(_0x10d6d2){return _0x2fffce[_0x41e7('0x1b')](_0x27fc9c)[_0x41e7('0x1c')](_0x10d6d2);}};}function respondWithFilteredResult(_0x6b3e6d,_0x570532){return function(_0x22694a){if(_0x22694a){var _0x4219ce=typeof _0x570532[_0x41e7('0x1d')]===_0x41e7('0x1e')&&typeof _0x570532[_0x41e7('0x1f')]===_0x41e7('0x1e');var _0x418d28=_0x22694a['count'];var _0x5be138=_0x4219ce?0x0:_0x570532[_0x41e7('0x1d')];var _0x2d0b64=_0x4219ce?_0x22694a[_0x41e7('0x20')]:_0x570532[_0x41e7('0x1d')]+_0x570532[_0x41e7('0x1f')];var _0x1d5dd6;if(_0x2d0b64>=_0x418d28){_0x2d0b64=_0x418d28;_0x1d5dd6=0xc8;}else{_0x1d5dd6=0xce;}_0x6b3e6d[_0x41e7('0x1b')](_0x1d5dd6);return _0x6b3e6d[_0x41e7('0x21')](_0x41e7('0x22'),_0x5be138+'-'+_0x2d0b64+'/'+_0x418d28)[_0x41e7('0x1c')](_0x22694a);}return null;};}function patchUpdates(_0x40404e){return function(_0x46a92d){try{jsonpatch['apply'](_0x46a92d,_0x40404e,!![]);}catch(_0x4b27ac){return BPromise[_0x41e7('0x23')](_0x4b27ac);}return _0x46a92d[_0x41e7('0x24')]();};}function saveUpdates(_0x100dba,_0x5b41f1){return function(_0x5e6d71){if(_0x5e6d71){return _0x5e6d71[_0x41e7('0x25')](_0x100dba)['then'](function(_0x187c17){return _0x187c17;});}return null;};}function removeEntity(_0x5861a6,_0x1def96){return function(_0x444b15){if(_0x444b15){return _0x444b15[_0x41e7('0x26')]()[_0x41e7('0x27')](function(){var _0x39ad84=_0x444b15[_0x41e7('0x28')]({'plain':!![]});var _0x230be3=_0x41e7('0x29');return db[_0x41e7('0x2a')][_0x41e7('0x26')]({'where':{'type':_0x230be3,'resourceId':_0x39ad84['id']}})[_0x41e7('0x27')](function(){return _0x444b15;});})['then'](function(){_0x5861a6[_0x41e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f5c16,_0x451801){return function(_0x31bec8){if(!_0x31bec8){_0x1f5c16[_0x41e7('0x1a')](0x194);}return _0x31bec8;};}function handleError(_0x2a2903,_0x283070){_0x283070=_0x283070||0x1f4;return function(_0x1f8fcd){logger[_0x41e7('0x2b')](_0x1f8fcd[_0x41e7('0x2c')]);if(_0x1f8fcd[_0x41e7('0x2d')]){delete _0x1f8fcd[_0x41e7('0x2d')];}_0x2a2903[_0x41e7('0x1b')](_0x283070)['send'](_0x1f8fcd);};}exports['index']=function(_0x13cc80,_0x499041){var _0x212723={},_0x1bd511={},_0x5294fb={'count':0x0,'rows':[]};var _0x1f0a81=_['map'](db[_0x41e7('0x2e')][_0x41e7('0x2f')],function(_0x1dafe6){return{'name':_0x1dafe6[_0x41e7('0x30')],'type':_0x1dafe6['type'][_0x41e7('0x31')]};});_0x1bd511[_0x41e7('0x32')]=_[_0x41e7('0x33')](_0x1f0a81,_0x41e7('0x2d'));_0x1bd511[_0x41e7('0x34')]=_['keys'](_0x13cc80[_0x41e7('0x34')]);_0x1bd511[_0x41e7('0x35')]=_[_0x41e7('0x36')](_0x1bd511[_0x41e7('0x32')],_0x1bd511[_0x41e7('0x34')]);_0x212723['attributes']=_['intersection'](_0x1bd511[_0x41e7('0x32')],qs[_0x41e7('0x37')](_0x13cc80['query'][_0x41e7('0x37')]));_0x212723[_0x41e7('0x38')]=_0x212723[_0x41e7('0x38')]['length']?_0x212723['attributes']:_0x1bd511[_0x41e7('0x32')];if(!_0x13cc80[_0x41e7('0x34')][_0x41e7('0x39')](_0x41e7('0x3a'))){_0x212723[_0x41e7('0x1f')]=qs[_0x41e7('0x1f')](_0x13cc80[_0x41e7('0x34')][_0x41e7('0x1f')]);_0x212723[_0x41e7('0x1d')]=qs['offset'](_0x13cc80['query'][_0x41e7('0x1d')]);}_0x212723[_0x41e7('0x3b')]=qs['sort'](_0x13cc80['query']['sort']);delete _0x13cc80[_0x41e7('0x34')][_0x41e7('0x3c')];_0x212723[_0x41e7('0x3d')]=qs[_0x41e7('0x35')](_['pick'](_0x13cc80['query'],_0x1bd511[_0x41e7('0x35')]),_0x1f0a81);if(_0x13cc80[_0x41e7('0x34')]['filter']){_0x212723[_0x41e7('0x3d')]=_['merge'](_0x212723[_0x41e7('0x3d')],{'$or':_[_0x41e7('0x33')](_0x1f0a81,function(_0x114f88){if(_0x114f88['type']!==_0x41e7('0x3e')){var _0x5df1dc={};_0x5df1dc[_0x114f88[_0x41e7('0x2d')]]={'$like':'%'+_0x13cc80[_0x41e7('0x34')]['filter']+'%'};return _0x5df1dc;}})});}_0x212723=_[_0x41e7('0x3f')]({},_0x212723,_0x13cc80[_0x41e7('0x40')]);var _0x380084={'where':_0x212723['where']};return db['VoiceMusicOnHold'][_0x41e7('0x20')](_0x380084)[_0x41e7('0x27')](function(_0x4eb98d){_0x5294fb[_0x41e7('0x20')]=_0x4eb98d;if(_0x13cc80[_0x41e7('0x34')][_0x41e7('0x41')]){_0x212723[_0x41e7('0x42')]=[{'all':!![]}];}return db[_0x41e7('0x2e')]['findAll'](_0x212723);})['then'](function(_0x1aa249){_0x5294fb[_0x41e7('0x43')]=_0x1aa249;return _0x5294fb;})['then'](respondWithFilteredResult(_0x499041,_0x212723))[_0x41e7('0x44')](handleError(_0x499041,null));};exports[_0x41e7('0x45')]=function(_0x4318bc,_0xf9cc97){var _0x15edff={'raw':![],'where':{'id':_0x4318bc['params']['id']}},_0x55d520={};_0x55d520[_0x41e7('0x32')]=_[_0x41e7('0x46')](db[_0x41e7('0x2e')][_0x41e7('0x2f')]);_0x55d520[_0x41e7('0x34')]=_[_0x41e7('0x46')](_0x4318bc[_0x41e7('0x34')]);_0x55d520[_0x41e7('0x35')]=_[_0x41e7('0x36')](_0x55d520[_0x41e7('0x32')],_0x55d520[_0x41e7('0x34')]);_0x15edff[_0x41e7('0x38')]=_[_0x41e7('0x36')](_0x55d520[_0x41e7('0x32')],qs[_0x41e7('0x37')](_0x4318bc[_0x41e7('0x34')][_0x41e7('0x37')]));_0x15edff[_0x41e7('0x38')]=_0x15edff['attributes'][_0x41e7('0x47')]?_0x15edff[_0x41e7('0x38')]:_0x55d520[_0x41e7('0x32')];if(_0x4318bc[_0x41e7('0x34')][_0x41e7('0x41')]){_0x15edff[_0x41e7('0x42')]=[{'all':!![]}];}_0x15edff=_['merge']({},_0x15edff,_0x4318bc[_0x41e7('0x40')]);return db[_0x41e7('0x2e')]['find'](_0x15edff)['then'](handleEntityNotFound(_0xf9cc97,null))['then'](respondWithResult(_0xf9cc97,null))['catch'](handleError(_0xf9cc97,null));};exports['update']=function(_0x25a69a,_0x27a332){if(_0x25a69a[_0x41e7('0x48')]['id']){delete _0x25a69a[_0x41e7('0x48')]['id'];}return db[_0x41e7('0x2e')][_0x41e7('0x49')]({'where':{'id':_0x25a69a[_0x41e7('0x4a')]['id']}})[_0x41e7('0x27')](handleEntityNotFound(_0x27a332,null))['then'](saveUpdates(_0x25a69a['body'],null))[_0x41e7('0x27')](respondWithResult(_0x27a332,null))[_0x41e7('0x44')](handleError(_0x27a332,null));};exports['create']=function(_0x171358,_0x120767,_0x39470a){return db['sequelize']['transaction'](function(_0x58e771){if(_0x171358[_0x41e7('0x48')][_0x41e7('0x4b')]==='files'){_0x171358[_0x41e7('0x48')][_0x41e7('0x4c')]=path[_0x41e7('0x4d')](config[_0x41e7('0x4e')],_0x41e7('0x4f'),_0x171358['body'][_0x41e7('0x2d')]);}return db[_0x41e7('0x2e')][_0x41e7('0x50')](_0x171358[_0x41e7('0x48')],{'transaction':_0x58e771})['then'](function(_0x4c04ed){if(_0x171358[_0x41e7('0x48')][_0x41e7('0x4b')]===_0x41e7('0x51')){fs[_0x41e7('0x52')](_0x4c04ed[_0x41e7('0x4c')],parseInt(_0x41e7('0x53'),0x8));}var _0x301867=_0x171358[_0x41e7('0x54')]['get']({'plain':!![]});if(!_0x301867)throw new Error(_0x41e7('0x55'));if(_0x301867['role']===_0x41e7('0x54')){var _0x5d64b5=_0x4c04ed['get']({'plain':!![]});return db[_0x41e7('0x56')][_0x41e7('0x49')]({'where':{'name':_0x41e7('0x29'),'userProfileId':_0x301867[_0x41e7('0x57')]},'raw':!![]})[_0x41e7('0x27')](function(_0x5e6c4c){if(_0x5e6c4c&&_0x5e6c4c['autoAssociation']===0x0){return db[_0x41e7('0x2a')][_0x41e7('0x50')]({'name':_0x5d64b5[_0x41e7('0x2d')],'resourceId':_0x5d64b5['id'],'type':_0x5e6c4c['name'],'sectionId':_0x5e6c4c['id']},{})[_0x41e7('0x27')](function(){return _0x4c04ed;});}else{return _0x4c04ed;}})[_0x41e7('0x44')](function(_0x5d29ad){logger[_0x41e7('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d29ad);});}return _0x4c04ed;});})[_0x41e7('0x27')](respondWithResult(_0x120767,0xc9))[_0x41e7('0x44')](handleError(_0x120767,null));};exports[_0x41e7('0x26')]=function(_0x24f3ba,_0x3cff38,_0x571772){var _0x1aab9b;return db[_0x41e7('0x2e')][_0x41e7('0x49')]({'where':{'id':_0x24f3ba[_0x41e7('0x4a')]['id']}})[_0x41e7('0x27')](function(_0x8f4953){if(_0x8f4953){return db['sequelize'][_0x41e7('0x58')](function(_0x150a16){return _0x8f4953[_0x41e7('0x26')]({'transaction':_0x150a16,'raw':!![]})[_0x41e7('0x27')](function(_0x318d64){if(_0x318d64[_0x41e7('0x4c')]){fs['readdirSync'](_0x318d64['directory'])[_0x41e7('0x59')](function(_0x29e5b1){fs[_0x41e7('0x5a')](path[_0x41e7('0x4d')](_0x318d64[_0x41e7('0x4c')],_0x29e5b1));});fs['rmdirSync'](_0x318d64[_0x41e7('0x4c')]);}return _0x318d64;});})['catch'](function(_0x5aced2){throw new db[(_0x41e7('0x5b'))]['ValidationError'](_0x5aced2[_0x41e7('0x5c')]);});}})[_0x41e7('0x27')](handleEntityNotFound(_0x3cff38,null))['then'](removeEntity(_0x3cff38,null))[_0x41e7('0x44')](handleError(_0x3cff38,null));};exports['addSound']=function(_0x214016,_0x9b19e0,_0x49fc43){return db['sequelize']['transaction'](function(_0x4fa1a1){var _0x2bf9f;return db[_0x41e7('0x2e')][_0x41e7('0x49')]({'where':{'id':_0x214016[_0x41e7('0x4a')]['id']}})[_0x41e7('0x27')](function(_0x563f19){if(_0x563f19){_0x2bf9f=_0x563f19;return _0x563f19[_0x41e7('0x5d')](_0x214016[_0x41e7('0x48')]['id'],{'transaction':_0x4fa1a1});}})[_0x41e7('0x27')](function(_0x11132a){if(_0x11132a){return db[_0x41e7('0x5e')][_0x41e7('0x5f')]({'where':{'id':_0x214016['body']['id']},'attributes':['id','name',_0x41e7('0x60'),_0x41e7('0x61'),_0x41e7('0x62')],'raw':!![]});}})[_0x41e7('0x27')](function(_0x48b9b3){if(_0x48b9b3){var _0x19d506=path['join'](config[_0x41e7('0x4e')],_0x41e7('0x63'),util[_0x41e7('0x64')]('%s.%s',path[_0x41e7('0x65')](_0x48b9b3[_0x41e7('0x60')],path[_0x41e7('0x66')](_0x48b9b3['save_name'])),_0x48b9b3[_0x41e7('0x61')]));var _0x5a570f=path[_0x41e7('0x4d')](config['root'],_0x41e7('0x4f'),_0x2bf9f['name'],util[_0x41e7('0x64')]('%s.%s',_0x48b9b3[_0x41e7('0x2d')],_0x48b9b3[_0x41e7('0x61')]));fs['symlinkSync'](_0x19d506,_0x5a570f);return _0x48b9b3;}})[_0x41e7('0x44')](function(_0x41dfc4){throw new db[(_0x41e7('0x5b'))][(_0x41e7('0x67'))](_0x41dfc4[_0x41e7('0x5c')]);});})['then'](handleEntityNotFound(_0x9b19e0,null))[_0x41e7('0x27')](respondWithResult(_0x9b19e0,0xc9))[_0x41e7('0x44')](handleError(_0x9b19e0,null));};exports[_0x41e7('0x68')]=function(_0x207b31,_0x229f32,_0xc14fee){return db[_0x41e7('0x69')][_0x41e7('0x58')](function(_0x55d8a6){var _0x4161ac;return db[_0x41e7('0x2e')]['findOne']({'where':{'id':_0x207b31['params']['id']}})['then'](handleEntityNotFound(_0x229f32,null))[_0x41e7('0x27')](function(_0x3a4f52){if(_0x3a4f52){_0x4161ac=_0x3a4f52;return _0x3a4f52[_0x41e7('0x68')](_0x207b31[_0x41e7('0x4a')][_0x41e7('0x6a')]);}})[_0x41e7('0x27')](function(_0x95c316){if(_0x95c316){return db[_0x41e7('0x5e')][_0x41e7('0x5f')]({'where':{'id':_0x207b31[_0x41e7('0x4a')][_0x41e7('0x6a')]},'attributes':['id',_0x41e7('0x2d'),_0x41e7('0x60'),'converted_format',_0x41e7('0x62')],'raw':!![]});}})[_0x41e7('0x27')](function(_0xfda3b9){if(_0xfda3b9){fs[_0x41e7('0x5a')](path['join'](_0x4161ac[_0x41e7('0x4c')],util['format'](_0x41e7('0x6b'),_0xfda3b9['name'],_0xfda3b9['converted_format'])));return _0xfda3b9;}})[_0x41e7('0x44')](function(_0x36af19){throw new db[(_0x41e7('0x5b'))][(_0x41e7('0x67'))](_0x36af19['message']);});})[_0x41e7('0x27')](handleEntityNotFound(_0x229f32,null))[_0x41e7('0x27')](respondWithStatusCode(_0x229f32,0xcc))[_0x41e7('0x44')](handleError(_0x229f32,null));};exports[_0x41e7('0x6c')]=function(_0x4a78ac,_0x376f26,_0x2e6f9c){var _0x3f4275={};var _0x29a272={};var _0x214a6d;var _0x2fa85d;return db['VoiceMusicOnHold'][_0x41e7('0x5f')]({'where':{'id':_0x4a78ac['params']['id']}})['then'](handleEntityNotFound(_0x376f26,null))[_0x41e7('0x27')](function(_0x7ae06c){if(_0x7ae06c){_0x214a6d=_0x7ae06c;_0x29a272[_0x41e7('0x32')]=_[_0x41e7('0x46')](db[_0x41e7('0x5e')][_0x41e7('0x2f')]);_0x29a272[_0x41e7('0x34')]=_['keys'](_0x4a78ac['query']);_0x29a272[_0x41e7('0x35')]=_[_0x41e7('0x36')](_0x29a272[_0x41e7('0x32')],_0x29a272[_0x41e7('0x34')]);_0x3f4275[_0x41e7('0x38')]=_[_0x41e7('0x36')](_0x29a272['model'],qs[_0x41e7('0x37')](_0x4a78ac[_0x41e7('0x34')][_0x41e7('0x37')]));_0x3f4275[_0x41e7('0x38')]=_0x3f4275[_0x41e7('0x38')]['length']?_0x3f4275['attributes']:_0x29a272['model'];_0x3f4275[_0x41e7('0x3b')]=qs[_0x41e7('0x3c')](_0x4a78ac[_0x41e7('0x34')]['sort']);_0x3f4275[_0x41e7('0x3d')]=qs[_0x41e7('0x35')](_[_0x41e7('0x6d')](_0x4a78ac[_0x41e7('0x34')],_0x29a272[_0x41e7('0x35')]));if(_0x4a78ac[_0x41e7('0x34')][_0x41e7('0x6e')]){_0x3f4275['where']=_[_0x41e7('0x3f')](_0x3f4275[_0x41e7('0x3d')],{'$or':_[_0x41e7('0x33')](_0x3f4275[_0x41e7('0x38')],function(_0x47f581){var _0x53c168={};_0x53c168[_0x47f581]={'$like':'%'+_0x4a78ac[_0x41e7('0x34')][_0x41e7('0x6e')]+'%'};return _0x53c168;})});}_0x3f4275=_[_0x41e7('0x3f')]({},_0x3f4275,_0x4a78ac[_0x41e7('0x40')]);return _0x214a6d[_0x41e7('0x6c')](_0x3f4275);}})[_0x41e7('0x27')](function(_0x5e0780){if(_0x5e0780){_0x2fa85d=_0x5e0780[_0x41e7('0x47')];if(!_0x4a78ac[_0x41e7('0x34')]['hasOwnProperty']('nolimit')){_0x3f4275[_0x41e7('0x1f')]=qs['limit'](_0x4a78ac[_0x41e7('0x34')][_0x41e7('0x1f')]);_0x3f4275[_0x41e7('0x1d')]=qs['offset'](_0x4a78ac[_0x41e7('0x34')]['offset']);}return _0x214a6d['getSounds'](_0x3f4275);}})[_0x41e7('0x27')](function(_0x1f3b48){if(_0x1f3b48){return _0x1f3b48?{'count':_0x2fa85d,'rows':_0x1f3b48}:null;}})[_0x41e7('0x27')](respondWithResult(_0x376f26,null))[_0x41e7('0x44')](handleError(_0x376f26,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b50e889..9a0d047 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 _0x60ef=['exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','bluebird','request-promise','rimraf','./voiceMusicOnHold.attributes'];(function(_0x29cf87,_0x1fc11c){var _0x1585b1=function(_0x4ffb8f){while(--_0x4ffb8f){_0x29cf87['push'](_0x29cf87['shift']());}};_0x1585b1(++_0x1fc11c);}(_0x60ef,0x101));var _0xf60e=function(_0x466bfa,_0x25ea55){_0x466bfa=_0x466bfa-0x0;var _0x37e0b1=_0x60ef[_0x466bfa];return _0x37e0b1;};'use strict';var _=require(_0xf60e('0x0'));var util=require(_0xf60e('0x1'));var logger=require('../../config/logger')(_0xf60e('0x2'));var moment=require('moment');var BPromise=require(_0xf60e('0x3'));var rp=require(_0xf60e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf60e('0x5'));var config=require('../../config/environment');var attributes=require(_0xf60e('0x6'));module[_0xf60e('0x7')]=function(_0x25a8fa,_0x2c99c5){return _0x25a8fa[_0xf60e('0x8')](_0xf60e('0x9'),attributes,{'tableName':_0xf60e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8be1=['util','../../config/logger','bluebird','request-promise','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x2ea169,_0x3a6861){var _0x3d44b9=function(_0x253fae){while(--_0x253fae){_0x2ea169['push'](_0x2ea169['shift']());}};_0x3d44b9(++_0x3a6861);}(_0x8be1,0x104));var _0x18be=function(_0x223c62,_0x10f403){_0x223c62=_0x223c62-0x0;var _0x2b1c3d=_0x8be1[_0x223c62];return _0x2b1c3d;};'use strict';var _=require(_0x18be('0x0'));var util=require(_0x18be('0x1'));var logger=require(_0x18be('0x2'))('api');var moment=require('moment');var BPromise=require(_0x18be('0x3'));var rp=require(_0x18be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x18be('0x5'));module['exports']=function(_0x40706d,_0x4e4d72){return _0x40706d[_0x18be('0x6')](_0x18be('0x7'),attributes,{'tableName':_0x18be('0x8'),'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 a0e9ab5..4a60245 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x9bd50,_0x4d66f5){var _0x4c8228=function(_0x4b59a3){while(--_0x4b59a3){_0x9bd50['push'](_0x9bd50['shift']());}};_0x4c8228(++_0x4d66f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 _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(_0x51b078,_0x559b66){var _0x2200dd=function(_0x638ec){while(--_0x638ec){_0x51b078['push'](_0x51b078['shift']());}};_0x2200dd(++_0x559b66);}(_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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 8c1a538..f9ca59a 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 _0x23fe=['/:id','isAuthenticated','/:id/users','getAgents','/:id/teams','create','post','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','/describe','describe'];(function(_0x456f08,_0x150572){var _0x4a10bc=function(_0x3e6b8a){while(--_0x3e6b8a){_0x456f08['push'](_0x456f08['shift']());}};_0x4a10bc(++_0x150572);}(_0x23fe,0x102));var _0xe23f=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x23fe[_0x42f009];return _0x22a1e0;};'use strict';var multer=require(_0xe23f('0x0'));var util=require(_0xe23f('0x1'));var path=require('path');var timeout=require(_0xe23f('0x2'));var express=require(_0xe23f('0x3'));var router=express[_0xe23f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe23f('0x5'));var interaction=require(_0xe23f('0x6'));var config=require(_0xe23f('0x7'));var controller=require(_0xe23f('0x8'));router[_0xe23f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe23f('0xa'),auth['isAuthenticated'](),controller[_0xe23f('0xb')]);router[_0xe23f('0x9')](_0xe23f('0xc'),auth[_0xe23f('0xd')](),controller['show']);router[_0xe23f('0x9')](_0xe23f('0xe'),auth[_0xe23f('0xd')](),controller[_0xe23f('0xf')]);router[_0xe23f('0x9')](_0xe23f('0x10'),auth[_0xe23f('0xd')](),controller['getTeams']);router['post']('/',auth[_0xe23f('0xd')](),controller[_0xe23f('0x11')]);router[_0xe23f('0x12')]('/:id/users',auth[_0xe23f('0xd')](),controller[_0xe23f('0x13')]);router[_0xe23f('0x12')](_0xe23f('0x10'),auth['isAuthenticated'](),controller[_0xe23f('0x14')]);router[_0xe23f('0x15')](_0xe23f('0xc'),auth['isAuthenticated'](),controller[_0xe23f('0x16')]);router['delete'](_0xe23f('0xc'),auth[_0xe23f('0xd')](),controller['destroy']);router[_0xe23f('0x17')](_0xe23f('0xe'),auth[_0xe23f('0xd')](),controller[_0xe23f('0x18')]);router[_0xe23f('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe23f('0x19')]);module[_0xe23f('0x1a')]=router; \ No newline at end of file +var _0xa378=['exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','show','/:id/users','/:id/teams','getTeams','create','post','addAgents','put','/:id','update','delete','destroy'];(function(_0x4f0222,_0x5d70a8){var _0x1574a2=function(_0x5d5c1d){while(--_0x5d5c1d){_0x4f0222['push'](_0x4f0222['shift']());}};_0x1574a2(++_0x5d70a8);}(_0xa378,0xb9));var _0x8a37=function(_0x4a8417,_0x3e1d17){_0x4a8417=_0x4a8417-0x0;var _0x9393f5=_0xa378[_0x4a8417];return _0x9393f5;};'use strict';var multer=require(_0x8a37('0x0'));var util=require(_0x8a37('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8a37('0x2'));var router=express[_0x8a37('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8a37('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8a37('0x5'));var controller=require(_0x8a37('0x6'));router[_0x8a37('0x7')]('/',auth[_0x8a37('0x8')](),controller['index']);router[_0x8a37('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8a37('0x9')]);router[_0x8a37('0x7')]('/:id',auth[_0x8a37('0x8')](),controller[_0x8a37('0xa')]);router['get'](_0x8a37('0xb'),auth[_0x8a37('0x8')](),controller['getAgents']);router[_0x8a37('0x7')](_0x8a37('0xc'),auth['isAuthenticated'](),controller[_0x8a37('0xd')]);router['post']('/',auth[_0x8a37('0x8')](),controller[_0x8a37('0xe')]);router[_0x8a37('0xf')]('/:id/users',auth[_0x8a37('0x8')](),controller[_0x8a37('0x10')]);router[_0x8a37('0xf')](_0x8a37('0xc'),auth[_0x8a37('0x8')](),controller['addTeams']);router[_0x8a37('0x11')](_0x8a37('0x12'),auth[_0x8a37('0x8')](),controller[_0x8a37('0x13')]);router[_0x8a37('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8a37('0x15')]);router[_0x8a37('0x14')](_0x8a37('0xb'),auth[_0x8a37('0x8')](),controller['removeAgents']);router['delete'](_0x8a37('0xc'),auth[_0x8a37('0x8')](),controller['removeTeams']);module[_0x8a37('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index e45f707..77d36a0 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 _0xf4e9=['exports','STRING','name','VIRTUAL','INTEGER','sequelize'];(function(_0x662180,_0xb5dff7){var _0x4a70a9=function(_0x19ead5){while(--_0x19ead5){_0x662180['push'](_0x662180['shift']());}};_0x4a70a9(++_0xb5dff7);}(_0xf4e9,0x11f));var _0x9f4e=function(_0x1c4cf8,_0x3f4de9){_0x1c4cf8=_0x1c4cf8-0x0;var _0x4d8891=_0xf4e9[_0x1c4cf8];return _0x4d8891;};'use strict';var Sequelize=require(_0x9f4e('0x0'));module[_0x9f4e('0x1')]={'name':{'type':Sequelize[_0x9f4e('0x2')],'allowNull':![],'unique':_0x9f4e('0x3')},'prefix':{'type':Sequelize[_0x9f4e('0x4')],'get':function(_0x40f77f){return'system-'+this['getDataValue'](_0x9f4e('0x3'))+'-';}},'description':{'type':Sequelize[_0x9f4e('0x2')]},'callerIdAll':{'type':Sequelize[_0x9f4e('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x9f4e('0x5')]}}; \ No newline at end of file +var _0x3d52=['exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0x31ed80,_0x169ad8){var _0x79f455=function(_0x3ea504){while(--_0x3ea504){_0x31ed80['push'](_0x31ed80['shift']());}};_0x79f455(++_0x169ad8);}(_0x3d52,0x13f));var _0x23d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x23d5('0x0'));module[_0x23d5('0x1')]={'name':{'type':Sequelize[_0x23d5('0x2')],'allowNull':![],'unique':_0x23d5('0x3')},'prefix':{'type':Sequelize[_0x23d5('0x4')],'get':function(_0x539850){return _0x23d5('0x5')+this[_0x23d5('0x6')](_0x23d5('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x23d5('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x23d5('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 900dcb4..927713d 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 _0x958a=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','index','map','VoicePrefix','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','params','rawAttributes','include','find','describe','sequelize','transaction','create','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','type','description','Voice\x20Prefix\x20Extension','priority','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','getAgents','getTeams','addTeams','Team','User','online','voicePause','flatMap','Agents','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','isEmpty','forEach','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x958a,0x128));var _0xa958=function(_0x3cc7bc,_0x5699d6){_0x3cc7bc=_0x3cc7bc-0x0;var _0x478341=_0x958a[_0x3cc7bc];return _0x478341;};'use strict';var emlformat=require(_0xa958('0x0'));var rimraf=require(_0xa958('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa958('0x2'));var rp=require(_0xa958('0x3'));var moment=require(_0xa958('0x4'));var BPromise=require(_0xa958('0x5'));var Mustache=require(_0xa958('0x6'));var util=require('util');var path=require(_0xa958('0x7'));var sox=require('sox');var csv=require(_0xa958('0x8'));var ejs=require(_0xa958('0x9'));var fs=require('fs');var fs_extra=require(_0xa958('0xa'));var _=require(_0xa958('0xb'));var squel=require(_0xa958('0xc'));var crypto=require(_0xa958('0xd'));var jsforce=require(_0xa958('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa958('0xf'));var Papa=require(_0xa958('0x10'));var Redis=require(_0xa958('0x11'));var authService=require(_0xa958('0x12'));var qs=require(_0xa958('0x13'));var as=require(_0xa958('0x14'));var hardwareService=require(_0xa958('0x15'));var logger=require(_0xa958('0x16'))(_0xa958('0x17'));var utils=require(_0xa958('0x18'));var config=require(_0xa958('0x19'));var licenseUtil=require(_0xa958('0x1a'));var db=require(_0xa958('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa958('0x1c'),'port':0x18eb});var socket=require(_0xa958('0x1d'))(new Redis(config[_0xa958('0x1e')]));require('./voicePrefix.socket')[_0xa958('0x1f')](socket);function respondWithStatusCode(_0x54c439,_0x5194b4){_0x5194b4=_0x5194b4||0xcc;return function(_0x53d5c7){if(_0x53d5c7){return _0x54c439[_0xa958('0x20')](_0x5194b4);}return _0x54c439[_0xa958('0x21')](_0x5194b4)[_0xa958('0x22')]();};}function respondWithResult(_0x6a81c7,_0x2c270c){_0x2c270c=_0x2c270c||0xc8;return function(_0x398931){if(_0x398931){return _0x6a81c7[_0xa958('0x21')](_0x2c270c)[_0xa958('0x23')](_0x398931);}};}function respondWithFilteredResult(_0x4d836f,_0x39af49){return function(_0x4eadc9){if(_0x4eadc9){var _0x3a053f=typeof _0x39af49[_0xa958('0x24')]==='undefined'&&typeof _0x39af49[_0xa958('0x25')]===_0xa958('0x26');var _0x47636f=_0x4eadc9[_0xa958('0x27')];var _0x2759ad=_0x3a053f?0x0:_0x39af49[_0xa958('0x24')];var _0x56314b=_0x3a053f?_0x4eadc9['count']:_0x39af49[_0xa958('0x24')]+_0x39af49[_0xa958('0x25')];var _0x16c0be;if(_0x56314b>=_0x47636f){_0x56314b=_0x47636f;_0x16c0be=0xc8;}else{_0x16c0be=0xce;}_0x4d836f['status'](_0x16c0be);return _0x4d836f[_0xa958('0x28')](_0xa958('0x29'),_0x2759ad+'-'+_0x56314b+'/'+_0x47636f)['json'](_0x4eadc9);}return null;};}function patchUpdates(_0x28cf12){return function(_0x401175){try{jsonpatch['apply'](_0x401175,_0x28cf12,!![]);}catch(_0x5c5a2b){return BPromise[_0xa958('0x2a')](_0x5c5a2b);}return _0x401175[_0xa958('0x2b')]();};}function saveUpdates(_0x50b3c3,_0x25f461){return function(_0x27097a){if(_0x27097a){return _0x27097a[_0xa958('0x2c')](_0x50b3c3)[_0xa958('0x2d')](function(_0x16b04a){return _0x16b04a;});}return null;};}function removeEntity(_0xf1436e,_0x50fdb1){return function(_0x3e3d77){if(_0x3e3d77){return _0x3e3d77['destroy']()[_0xa958('0x2d')](function(){var _0x3c2ea3=_0x3e3d77[_0xa958('0x2e')]({'plain':!![]});var _0x18f600=_0xa958('0x2f');return db[_0xa958('0x30')][_0xa958('0x31')]({'where':{'type':_0x18f600,'resourceId':_0x3c2ea3['id']}})[_0xa958('0x2d')](function(){return _0x3e3d77;});})[_0xa958('0x2d')](function(){_0xf1436e[_0xa958('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47895c,_0xd2fcc9){return function(_0x4ef4f6){if(!_0x4ef4f6){_0x47895c[_0xa958('0x20')](0x194);}return _0x4ef4f6;};}function handleError(_0x1b76de,_0x4b3089){_0x4b3089=_0x4b3089||0x1f4;return function(_0x23bdbf){logger[_0xa958('0x32')](_0x23bdbf[_0xa958('0x33')]);if(_0x23bdbf[_0xa958('0x34')]){delete _0x23bdbf[_0xa958('0x34')];}_0x1b76de['status'](_0x4b3089)['send'](_0x23bdbf);};}exports[_0xa958('0x35')]=function(_0x5d9a3d,_0x51e50b){var _0x30d51f={},_0x3f6de3={},_0x135322={'count':0x0,'rows':[]};var _0x43b912=_[_0xa958('0x36')](db[_0xa958('0x37')]['rawAttributes'],function(_0x32c4e3){return{'name':_0x32c4e3['fieldName'],'type':_0x32c4e3['type'][_0xa958('0x38')]};});_0x3f6de3[_0xa958('0x39')]=_[_0xa958('0x36')](_0x43b912,_0xa958('0x34'));_0x3f6de3[_0xa958('0x3a')]=_[_0xa958('0x3b')](_0x5d9a3d[_0xa958('0x3a')]);_0x3f6de3[_0xa958('0x3c')]=_['intersection'](_0x3f6de3['model'],_0x3f6de3[_0xa958('0x3a')]);_0x30d51f[_0xa958('0x3d')]=_[_0xa958('0x3e')](_0x3f6de3[_0xa958('0x39')],qs[_0xa958('0x3f')](_0x5d9a3d['query'][_0xa958('0x3f')]));_0x30d51f[_0xa958('0x3d')]=_0x30d51f[_0xa958('0x3d')][_0xa958('0x40')]?_0x30d51f['attributes']:_0x3f6de3[_0xa958('0x39')];if(!_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x41')](_0xa958('0x42'))){_0x30d51f[_0xa958('0x25')]=qs['limit'](_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x25')]);_0x30d51f[_0xa958('0x24')]=qs[_0xa958('0x24')](_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x24')]);}_0x30d51f[_0xa958('0x43')]=qs[_0xa958('0x44')](_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x44')]);_0x30d51f['where']=qs[_0xa958('0x3c')](_[_0xa958('0x45')](_0x5d9a3d[_0xa958('0x3a')],_0x3f6de3['filters']),_0x43b912);if(_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x46')]){_0x30d51f['where']=_['merge'](_0x30d51f[_0xa958('0x47')],{'$or':_['map'](_0x43b912,function(_0x3b5e74){if(_0x3b5e74['type']!==_0xa958('0x48')){var _0x59d562={};_0x59d562[_0x3b5e74[_0xa958('0x34')]]={'$like':'%'+_0x5d9a3d[_0xa958('0x3a')][_0xa958('0x46')]+'%'};return _0x59d562;}})});}_0x30d51f=_[_0xa958('0x49')]({},_0x30d51f,_0x5d9a3d[_0xa958('0x4a')]);var _0x45b383={'where':_0x30d51f[_0xa958('0x47')]};return db[_0xa958('0x37')]['count'](_0x45b383)[_0xa958('0x2d')](function(_0x38dfb4){_0x135322[_0xa958('0x27')]=_0x38dfb4;if(_0x5d9a3d['query']['includeAll']){_0x30d51f['include']=[{'all':!![]}];}return db[_0xa958('0x37')][_0xa958('0x4b')](_0x30d51f);})[_0xa958('0x2d')](function(_0x155901){_0x135322[_0xa958('0x4c')]=_0x155901;return _0x135322;})['then'](respondWithFilteredResult(_0x51e50b,_0x30d51f))[_0xa958('0x4d')](handleError(_0x51e50b,null));};exports[_0xa958('0x4e')]=function(_0x2fdf2b,_0x2bfdee){var _0x303331={'raw':![],'where':{'id':_0x2fdf2b[_0xa958('0x4f')]['id']}},_0x1118bb={};_0x1118bb[_0xa958('0x39')]=_[_0xa958('0x3b')](db[_0xa958('0x37')][_0xa958('0x50')]);_0x1118bb[_0xa958('0x3a')]=_[_0xa958('0x3b')](_0x2fdf2b[_0xa958('0x3a')]);_0x1118bb[_0xa958('0x3c')]=_[_0xa958('0x3e')](_0x1118bb[_0xa958('0x39')],_0x1118bb['query']);_0x303331['attributes']=_['intersection'](_0x1118bb[_0xa958('0x39')],qs[_0xa958('0x3f')](_0x2fdf2b[_0xa958('0x3a')][_0xa958('0x3f')]));_0x303331['attributes']=_0x303331[_0xa958('0x3d')][_0xa958('0x40')]?_0x303331[_0xa958('0x3d')]:_0x1118bb[_0xa958('0x39')];if(_0x2fdf2b[_0xa958('0x3a')]['includeAll']){_0x303331[_0xa958('0x51')]=[{'all':!![]}];}_0x303331=_[_0xa958('0x49')]({},_0x303331,_0x2fdf2b[_0xa958('0x4a')]);return db['VoicePrefix'][_0xa958('0x52')](_0x303331)['then'](handleEntityNotFound(_0x2bfdee,null))[_0xa958('0x2d')](respondWithResult(_0x2bfdee,null))[_0xa958('0x4d')](handleError(_0x2bfdee,null));};exports[_0xa958('0x31')]=function(_0x4e0740,_0x35f6bf){return db['VoicePrefix'][_0xa958('0x52')]({'where':{'id':_0x4e0740[_0xa958('0x4f')]['id']}})[_0xa958('0x2d')](handleEntityNotFound(_0x35f6bf,null))[_0xa958('0x2d')](removeEntity(_0x35f6bf,null))[_0xa958('0x4d')](handleError(_0x35f6bf,null));};exports['describe']=function(_0x1e9c64,_0x49f9da){return db[_0xa958('0x37')][_0xa958('0x53')]()['then'](respondWithResult(_0x49f9da,null))[_0xa958('0x4d')](handleError(_0x49f9da,null));};exports['create']=function(_0x317059,_0x39619f){var _0x15c0fe;return db[_0xa958('0x54')][_0xa958('0x55')](function(_0x65f37f){return db[_0xa958('0x37')][_0xa958('0x56')](_0x317059[_0xa958('0x57')],{'transaction':_0x65f37f})['then'](function(_0x37d54f){_0x15c0fe=_0x37d54f['get']({'plain':!![]});return db[_0xa958('0x58')][_0xa958('0x52')]({'where':{'id':_0x15c0fe[_0xa958('0x59')]},'raw':!![]})['then'](function(_0x4f0440){return createVoicePrefixExtensions(_0x15c0fe,_0x4f0440,_0x65f37f);});});})[_0xa958('0x2d')](function(){var _0xab6085=_0x317059[_0xa958('0x5a')][_0xa958('0x2e')]({'plain':!![]});if(!_0xab6085)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xab6085[_0xa958('0x5b')]===_0xa958('0x5a')){var _0x4cf7af=_0x15c0fe;return db[_0xa958('0x5c')][_0xa958('0x52')]({'where':{'name':'VoicePrefixes','userProfileId':_0xab6085[_0xa958('0x5d')]},'raw':!![]})['then'](function(_0x5629c4){if(_0x5629c4&&_0x5629c4['autoAssociation']===0x0){return db[_0xa958('0x30')][_0xa958('0x56')]({'name':_0x4cf7af[_0xa958('0x34')],'resourceId':_0x4cf7af['id'],'type':_0x5629c4[_0xa958('0x34')],'sectionId':_0x5629c4['id']},{})['then'](function(){return _0x15c0fe;});}else{return _0x15c0fe;}})[_0xa958('0x4d')](function(_0x4aaf1a){logger[_0xa958('0x32')](_0xa958('0x5e'),_0x4aaf1a);throw _0x4aaf1a;});}return _0x15c0fe;})[_0xa958('0x2d')](respondWithResult(_0x39619f,null))[_0xa958('0x4d')](handleError(_0x39619f,null));};function Extension(_0x25865d,_0x11cc0b,_0x485e67,_0x4937a5){this[_0xa958('0x5f')]=_0xa958('0x60');this[_0xa958('0x61')]=_0x25865d;this[_0xa958('0x62')]=_0x485e67;this[_0xa958('0x63')]='system';this[_0xa958('0x64')]=_0xa958('0x65');this[_0xa958('0x66')]=_0x11cc0b;this['appdata']=_0x4937a5;}function createVoicePrefixExtensions(_0xf7e817,_0x2496f8,_0x364725){return new BPromise(function(_0x14cbb6,_0x35177a){var _0x2d40b1=new Extension(formatPrefixName(_0xf7e817[_0xa958('0x67')]),0x1,'NoOp','Voice\x20Prefix');_0x2d40b1[_0xa958('0x68')]=_0xf7e817['id'];return db['VoiceExtension'][_0xa958('0x56')](_0x2d40b1,{'transaction':_0x364725})[_0xa958('0x2d')](function(_0x1ea51b){var _0x3f0396=_0x1ea51b[_0xa958('0x2e')]({'plain':!![]});var _0x3859e2=_[_0xa958('0x36')](addVoicePrefixExtensions(_0xf7e817,_0x2496f8),function(_0x358c8b){_0x358c8b[_0xa958('0x59')]=_0x3f0396['id'];_0x358c8b['VoicePrefixId']=_0xf7e817['id'];return _0x358c8b;});return db[_0xa958('0x58')][_0xa958('0x69')](_0x3859e2,{'transaction':_0x364725})['then'](function(_0x53a26d){if(!_0x53a26d){return _0x35177a(_0xa958('0x6a'));}else{return _0x14cbb6(_0x53a26d);}})[_0xa958('0x4d')](function(_0xa769e0){return _0x35177a(_0xa769e0);});});;});};function addVoicePrefixExtensions(_0x36d3cd,_0x3736df){var _0x5625e7=[];var _0x25ca0b=formatPrefixName(_0x36d3cd['prefix']);_0x5625e7[_0xa958('0x6b')](new Extension(_0x25ca0b,0x2,'Set',_0xa958('0x6c')+_0x36d3cd[_0xa958('0x34')]));if(_0x36d3cd['callerIdAll']){_0x5625e7[_0xa958('0x6b')](new Extension(_0x25ca0b,0x3,_0xa958('0x6d'),_0xa958('0x6e')+_0x36d3cd[_0xa958('0x6f')]));}else{_0x5625e7[_0xa958('0x6b')](new Extension(_0x25ca0b,0x3,_0xa958('0x70'),_0xa958('0x71')));}_0x5625e7[_0xa958('0x6b')](new Extension(_0x25ca0b,0x4,'goto',_0x3736df['context']+','+'${EXTEN:'+(0x8+_0x36d3cd[_0xa958('0x34')]['length'])+'}'+','+0x1));return _0x5625e7;}function formatPrefixName(_0x21d139){var _0x739fa1='_';for(var _0x52484f=0x0;_0x52484f<_0x21d139['length'];_0x52484f++){if(_0x21d139[_0xa958('0x72')](_0x52484f)=='-'){_0x739fa1+=_0x21d139[_0xa958('0x72')](_0x52484f);}else{_0x739fa1+='['+_0x21d139[_0xa958('0x72')](_0x52484f)+']';}}_0x739fa1+='.';return _0x739fa1;}exports[_0xa958('0x2c')]=function(_0x2c2e81,_0x58083e,_0x32f9dc){var _0x5379f1=_0x2c2e81[_0xa958('0x57')];_0x5379f1[_0xa958('0x67')]=_0xa958('0x73')+_0x5379f1['name']+'-';return db[_0xa958('0x54')][_0xa958('0x55')](function(_0x4df64f){return db[_0xa958('0x37')][_0xa958('0x2c')](_0x5379f1,{'where':{'id':_0x5379f1['id']},'transaction':_0x4df64f})[_0xa958('0x2d')](function(){return db[_0xa958('0x58')][_0xa958('0x31')]({'where':{'VoicePrefixId':_0x5379f1['id']},'transaction':_0x4df64f})['then'](function(){return db[_0xa958('0x58')]['find']({'where':{'id':_0x5379f1[_0xa958('0x59')]},'raw':!![]})['then'](function(_0x1b2d7e){return createVoicePrefixExtensions(_0x5379f1,_0x1b2d7e,_0x4df64f);});});});})[_0xa958('0x2d')](function(){return db[_0xa958('0x37')][_0xa958('0x74')](_0x5379f1['id']);})[_0xa958('0x2d')](respondWithResult(_0x58083e,null))[_0xa958('0x4d')](handleError(_0x58083e,null));};exports[_0xa958('0x75')]=function(_0x5de628,_0x4a41a8,_0x349bf9){return db['VoicePrefix'][_0xa958('0x52')]({'where':{'id':_0x5de628[_0xa958('0x4f')]['id']}})[_0xa958('0x2d')](handleEntityNotFound(_0x4a41a8,null))[_0xa958('0x2d')](function(_0x3b8dbf){if(_0x3b8dbf){return _0x3b8dbf[_0xa958('0x75')](_0x5de628[_0xa958('0x57')][_0xa958('0x76')],_['omit'](_0x5de628[_0xa958('0x57')],[_0xa958('0x76'),'id'])||{})[_0xa958('0x77')](function(_0x443e97){for(var _0x4eb829=0x0;_0x4eb829<_0x5de628[_0xa958('0x57')][_0xa958('0x76')][_0xa958('0x40')];_0x4eb829+=0x1){socket[_0xa958('0x78')](_0xa958('0x79'),{'UserId':Number(_0x5de628[_0xa958('0x57')]['ids'][_0x4eb829]),'VoicePrefixId':Number(_0x5de628[_0xa958('0x4f')]['id'])});}return _0x443e97;});}})[_0xa958('0x2d')](respondWithResult(_0x4a41a8,null))[_0xa958('0x4d')](handleError(_0x4a41a8,null));};exports[_0xa958('0x7a')]=function(_0x2d54ba,_0x3c87c6,_0x501462){return db['VoicePrefix']['find']({'where':{'id':_0x2d54ba[_0xa958('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3c87c6,null))['then'](function(_0x1c05fa){if(_0x1c05fa){return _0x1c05fa[_0xa958('0x7a')](_0x2d54ba[_0xa958('0x3a')][_0xa958('0x76')])[_0xa958('0x2d')](function(){if(_['isArray'](_0x2d54ba['query'][_0xa958('0x76')])){for(var _0x477402=0x0;_0x477402<_0x2d54ba[_0xa958('0x3a')][_0xa958('0x76')]['length'];_0x477402+=0x1){socket[_0xa958('0x78')](_0xa958('0x7b'),{'UserId':Number(_0x2d54ba[_0xa958('0x3a')][_0xa958('0x76')][_0x477402]),'VoicePrefixId':Number(_0x2d54ba[_0xa958('0x4f')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2d54ba[_0xa958('0x3a')]['ids']),'VoicePrefixId':Number(_0x2d54ba[_0xa958('0x4f')]['id'])});}});}})[_0xa958('0x2d')](respondWithStatusCode(_0x3c87c6,null))[_0xa958('0x4d')](handleError(_0x3c87c6,null));};exports['getAgents']=function(_0x15544d,_0x4e4a98,_0x20a536){var _0xba7442={};var _0x5b32bf={};var _0x484790;var _0x5f2995;return db['VoicePrefix'][_0xa958('0x7c')]({'where':{'id':_0x15544d[_0xa958('0x4f')]['id']}})[_0xa958('0x2d')](handleEntityNotFound(_0x4e4a98,null))[_0xa958('0x2d')](function(_0x2aec5f){if(_0x2aec5f){_0x484790=_0x2aec5f;_0x5b32bf['model']=_[_0xa958('0x3b')](db['User']['rawAttributes']);_0x5b32bf[_0xa958('0x3a')]=_[_0xa958('0x3b')](_0x15544d[_0xa958('0x3a')]);_0x5b32bf['filters']=_[_0xa958('0x3e')](_0x5b32bf['model'],_0x5b32bf[_0xa958('0x3a')]);_0xba7442[_0xa958('0x3d')]=_['intersection'](_0x5b32bf['model'],qs[_0xa958('0x3f')](_0x15544d[_0xa958('0x3a')][_0xa958('0x3f')]));_0xba7442[_0xa958('0x3d')]=_0xba7442['attributes'][_0xa958('0x40')]?_0xba7442[_0xa958('0x3d')]:_0x5b32bf['model'];_0xba7442[_0xa958('0x43')]=qs['sort'](_0x15544d[_0xa958('0x3a')][_0xa958('0x44')]);_0xba7442[_0xa958('0x47')]=qs['filters'](_[_0xa958('0x45')](_0x15544d[_0xa958('0x3a')],_0x5b32bf['filters']));if(_0x15544d[_0xa958('0x3a')][_0xa958('0x46')]){_0xba7442[_0xa958('0x47')]=_[_0xa958('0x49')](_0xba7442[_0xa958('0x47')],{'$or':_[_0xa958('0x36')](_0xba7442[_0xa958('0x3d')],function(_0x1b5d8c){var _0x252300={};_0x252300[_0x1b5d8c]={'$like':'%'+_0x15544d['query'][_0xa958('0x46')]+'%'};return _0x252300;})});}_0xba7442=_[_0xa958('0x49')]({},_0xba7442,_0x15544d['options']);return _0x484790[_0xa958('0x7d')](_0xba7442);}})[_0xa958('0x2d')](function(_0x4fbefb){if(_0x4fbefb){_0x5f2995=_0x4fbefb['length'];if(!_0x15544d[_0xa958('0x3a')]['hasOwnProperty']('nolimit')){_0xba7442[_0xa958('0x25')]=qs[_0xa958('0x25')](_0x15544d['query']['limit']);_0xba7442[_0xa958('0x24')]=qs[_0xa958('0x24')](_0x15544d[_0xa958('0x3a')]['offset']);}return _0x484790[_0xa958('0x7d')](_0xba7442);}})['then'](function(_0x4d6455){if(_0x4d6455){return _0x4d6455?{'count':_0x5f2995,'rows':_0x4d6455}:null;}})[_0xa958('0x2d')](respondWithResult(_0x4e4a98,null))[_0xa958('0x4d')](handleError(_0x4e4a98,null));};exports[_0xa958('0x7e')]=function(_0x58feea,_0x278505,_0x36d9d4){var _0x213ee2={};var _0x4fffd9={};var _0x2b4e65;var _0x9207c3;return db[_0xa958('0x37')][_0xa958('0x7c')]({'where':{'id':_0x58feea['params']['id']}})[_0xa958('0x2d')](handleEntityNotFound(_0x278505,null))[_0xa958('0x2d')](function(_0x71d394){if(_0x71d394){_0x2b4e65=_0x71d394;_0x4fffd9[_0xa958('0x39')]=_['keys'](db['Team']['rawAttributes']);_0x4fffd9['query']=_[_0xa958('0x3b')](_0x58feea[_0xa958('0x3a')]);_0x4fffd9['filters']=_['intersection'](_0x4fffd9[_0xa958('0x39')],_0x4fffd9[_0xa958('0x3a')]);_0x213ee2[_0xa958('0x3d')]=_['intersection'](_0x4fffd9[_0xa958('0x39')],qs[_0xa958('0x3f')](_0x58feea['query'][_0xa958('0x3f')]));_0x213ee2[_0xa958('0x3d')]=_0x213ee2[_0xa958('0x3d')][_0xa958('0x40')]?_0x213ee2[_0xa958('0x3d')]:_0x4fffd9[_0xa958('0x39')];_0x213ee2[_0xa958('0x43')]=qs[_0xa958('0x44')](_0x58feea[_0xa958('0x3a')][_0xa958('0x44')]);_0x213ee2[_0xa958('0x47')]=qs[_0xa958('0x3c')](_['pick'](_0x58feea['query'],_0x4fffd9[_0xa958('0x3c')]));if(_0x58feea[_0xa958('0x3a')][_0xa958('0x46')]){_0x213ee2[_0xa958('0x47')]=_[_0xa958('0x49')](_0x213ee2[_0xa958('0x47')],{'$or':_[_0xa958('0x36')](_0x213ee2['attributes'],function(_0x7a2730){var _0x46ad43={};_0x46ad43[_0x7a2730]={'$like':'%'+_0x58feea['query'][_0xa958('0x46')]+'%'};return _0x46ad43;})});}_0x213ee2=_[_0xa958('0x49')]({},_0x213ee2,_0x58feea['options']);return _0x2b4e65[_0xa958('0x7e')](_0x213ee2);}})['then'](function(_0x57e780){if(_0x57e780){_0x9207c3=_0x57e780[_0xa958('0x40')];if(!_0x58feea[_0xa958('0x3a')][_0xa958('0x41')]('nolimit')){_0x213ee2['limit']=qs[_0xa958('0x25')](_0x58feea['query']['limit']);_0x213ee2[_0xa958('0x24')]=qs['offset'](_0x58feea[_0xa958('0x3a')][_0xa958('0x24')]);}return _0x2b4e65[_0xa958('0x7e')](_0x213ee2);}})[_0xa958('0x2d')](function(_0x3f58a2){if(_0x3f58a2){return _0x3f58a2?{'count':_0x9207c3,'rows':_0x3f58a2}:null;}})[_0xa958('0x2d')](respondWithResult(_0x278505,null))[_0xa958('0x4d')](handleError(_0x278505,null));};exports[_0xa958('0x7f')]=function(_0x22ba2f,_0x429870,_0x4d82b5){var _0x7f6ca5=_0x22ba2f['body'][_0xa958('0x76')];var _0x23823d;return db[_0xa958('0x80')]['findAll']({'where':{'id':_0x7f6ca5},'attributes':['id'],'include':[{'model':db[_0xa958('0x81')],'as':'Agents','attributes':['id','name',_0xa958('0x82'),_0xa958('0x83'),'interface'],'raw':!![]}]})[_0xa958('0x2d')](function(_0x4d907b){if(_0x4d907b){_0x23823d=_0x4d907b;var _0x310918=_[_0xa958('0x84')](_0x4d907b,function(_0x4fe178){var _0x57a1d9=_0x4fe178[_0xa958('0x2e')]({'plain':!![]});return _0x57a1d9[_0xa958('0x85')];});return db[_0xa958('0x37')][_0xa958('0x52')]({'where':{'id':_0x22ba2f[_0xa958('0x4f')]['id']}})[_0xa958('0x2d')](function(_0x162760){return db[_0xa958('0x54')]['transaction'](function(_0x1bdced){return _0x162760[_0xa958('0x7f')](_0x7f6ca5,{'transaction':_0x1bdced})['then'](function(){return BPromise[_0xa958('0x86')](_0x23823d,function(_0x167bb6){return db[_0xa958('0x87')][_0xa958('0x88')]({'TeamId':_0x167bb6['id'],'VoicePrefixId':_0x22ba2f[_0xa958('0x4f')]['id']},{'transaction':_0x1bdced});});})['then'](function(){return BPromise[_0xa958('0x86')](_0x310918,function(_0x2f8f94){return db[_0xa958('0x89')][_0xa958('0x8a')]({'where':{'UserId':_0x2f8f94['id'],'VoicePrefixId':_0x22ba2f[_0xa958('0x4f')]['id']},'transaction':_0x1bdced});});})[_0xa958('0x2d')](function(){_0x310918['forEach'](function(_0x46561b){socket[_0xa958('0x78')]('userVoicePrefix:save',{'UserId':_0x46561b['id'],'VoicePrefixId':_0x162760['id']});});});});});}})['then'](respondWithStatusCode(_0x429870,null))['catch'](handleError(_0x429870,null));};exports[_0xa958('0x8b')]=function(_0x5e31b4,_0x4edc45,_0x22890c){return db[_0xa958('0x80')][_0xa958('0x4b')]({'where':{'id':_0x5e31b4[_0xa958('0x3a')][_0xa958('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa958('0x2d')](handleEntityNotFound(_0x4edc45,null))[_0xa958('0x2d')](function(_0x42e2b4){var _0x24d6a4=_[_0xa958('0x36')](_0x42e2b4,'id');var _0x19a1da=[];var _0x2a29ad=[];var _0x4ecadc=squel['select']();_0x4ecadc[_0xa958('0x8c')](_0xa958('0x8d'))[_0xa958('0x8e')](_0xa958('0x8f'),'tq')[_0xa958('0x90')](_0xa958('0x91'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa958('0x47')](_0xa958('0x92'),_0x5e31b4[_0xa958('0x4f')]['id']);for(var _0x57f1eb=0x0;_0x57f1eb<_0x42e2b4[_0xa958('0x40')];_0x57f1eb+=0x1){let _0x3062c5=_0x42e2b4[_0x57f1eb];for(var _0x3cc980=0x0;_0x3cc980<_0x3062c5[_0xa958('0x85')][_0xa958('0x40')];_0x3cc980+=0x1){let _0x166267=_0x3062c5['Agents'][_0x3cc980];var _0x30133f=_0x4ecadc[_0xa958('0x93')]();_0x30133f['where'](_0xa958('0x94'),_0x166267['id']);_0x2a29ad[_0xa958('0x6b')](db[_0xa958('0x54')][_0xa958('0x3a')](_0x30133f[_0xa958('0x95')](),{'type':db[_0xa958('0x54')][_0xa958('0x96')][_0xa958('0x97')]})[_0xa958('0x2d')](function(_0x4f54a1){if(_0x4f54a1['length']===0x1){return _0x166267['id'];}else{var _0x563f9=_['every'](_[_0xa958('0x36')](_0x4f54a1,_0xa958('0x98')),function(_0x495b6d){return _[_0xa958('0x99')](_0x24d6a4,_0x495b6d);});if(_0x563f9){return _0x166267['id'];}}}));}}return BPromise[_0xa958('0x9a')](_0x2a29ad)[_0xa958('0x2d')](function(_0x48e953){_0x19a1da=_(_0x19a1da)['union'](_0x48e953)[_0xa958('0x9b')]()[_0xa958('0x9c')]();return db[_0xa958('0x37')][_0xa958('0x52')]({'where':{'id':_0x5e31b4[_0xa958('0x4f')]['id']}})['then'](function(_0x5548d1){return db[_0xa958('0x54')][_0xa958('0x55')](function(_0x4a4253){return _0x5548d1[_0xa958('0x8b')](_0x5e31b4['query']['ids'],{'transaction':_0x4a4253})[_0xa958('0x2d')](function(){if(!_[_0xa958('0x9d')](_0x19a1da)){return _0x5548d1[_0xa958('0x7a')](_0x19a1da,{'transaction':_0x4a4253});}})[_0xa958('0x2d')](function(){_0x19a1da[_0xa958('0x9e')](function(_0x5c0653){socket[_0xa958('0x78')]('userVoicePrefix:remove',{'UserId':_0x5c0653,'VoicePrefixId':_0x5548d1['id']});});});});});});})[_0xa958('0x2d')](respondWithStatusCode(_0x4edc45,null))[_0xa958('0x4d')](handleError(_0x4edc45,null));}; \ No newline at end of file +var _0xf4f4=['role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','context','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','User','order','findOne','Team','getTeams','addTeams','findAll','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','removeTeams','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','SELECT','includes','all','union','compact','value','removeAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','VoicePrefixes','destroy','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','keys','includeAll','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x45dfa3,_0x55a4f6){var _0x1fbee9=function(_0x141947){while(--_0x141947){_0x45dfa3['push'](_0x45dfa3['shift']());}};_0x1fbee9(++_0x55a4f6);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x2c11eb,_0x855d9a){_0x2c11eb=_0x2c11eb-0x0;var _0x30aece=_0xf4f4[_0x2c11eb];return _0x30aece;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];config[_0x4f4f('0x1b')]=_[_0x4f4f('0x1c')](config[_0x4f4f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f4f('0x1d'))(new Redis(config['redis']));require(_0x4f4f('0x1e'))[_0x4f4f('0x1f')](socket);function respondWithStatusCode(_0x3e16e9,_0x38535d){_0x38535d=_0x38535d||0xcc;return function(_0x4c849f){if(_0x4c849f){return _0x3e16e9[_0x4f4f('0x20')](_0x38535d);}return _0x3e16e9['status'](_0x38535d)['end']();};}function respondWithResult(_0x58de77,_0x422894){_0x422894=_0x422894||0xc8;return function(_0x8d65a2){if(_0x8d65a2){return _0x58de77[_0x4f4f('0x21')](_0x422894)[_0x4f4f('0x22')](_0x8d65a2);}};}function respondWithFilteredResult(_0x2d5e5d,_0x1777eb){return function(_0x1245c4){if(_0x1245c4){var _0x60ce2=typeof _0x1777eb[_0x4f4f('0x23')]===_0x4f4f('0x24')&&typeof _0x1777eb[_0x4f4f('0x25')]===_0x4f4f('0x24');var _0x499277=_0x1245c4[_0x4f4f('0x26')];var _0x4622c2=_0x60ce2?0x0:_0x1777eb[_0x4f4f('0x23')];var _0x201c60=_0x60ce2?_0x1245c4[_0x4f4f('0x26')]:_0x1777eb[_0x4f4f('0x23')]+_0x1777eb[_0x4f4f('0x25')];var _0x3e33d5;if(_0x201c60>=_0x499277){_0x201c60=_0x499277;_0x3e33d5=0xc8;}else{_0x3e33d5=0xce;}_0x2d5e5d[_0x4f4f('0x21')](_0x3e33d5);return _0x2d5e5d[_0x4f4f('0x27')](_0x4f4f('0x28'),_0x4622c2+'-'+_0x201c60+'/'+_0x499277)[_0x4f4f('0x22')](_0x1245c4);}return null;};}function patchUpdates(_0x17984d){return function(_0xc78135){try{jsonpatch['apply'](_0xc78135,_0x17984d,!![]);}catch(_0x4f7261){return BPromise['reject'](_0x4f7261);}return _0xc78135[_0x4f4f('0x29')]();};}function saveUpdates(_0x43e661,_0x5186ac){return function(_0x3960ae){if(_0x3960ae){return _0x3960ae[_0x4f4f('0x2a')](_0x43e661)[_0x4f4f('0x2b')](function(_0x2ec92a){return _0x2ec92a;});}return null;};}function removeEntity(_0x113ff7,_0x31b30e){return function(_0xa6371b){if(_0xa6371b){return _0xa6371b['destroy']()[_0x4f4f('0x2b')](function(){var _0x237cf9=_0xa6371b[_0x4f4f('0x2c')]({'plain':!![]});var _0x15c79c=_0x4f4f('0x2d');return db['UserProfileResource'][_0x4f4f('0x2e')]({'where':{'type':_0x15c79c,'resourceId':_0x237cf9['id']}})[_0x4f4f('0x2b')](function(){return _0xa6371b;});})[_0x4f4f('0x2b')](function(){_0x113ff7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2490,_0x73b8bb){return function(_0x5b4f6a){if(!_0x5b4f6a){_0x4c2490[_0x4f4f('0x20')](0x194);}return _0x5b4f6a;};}function handleError(_0x39c1a8,_0x2e688a){_0x2e688a=_0x2e688a||0x1f4;return function(_0x5eb7c9){logger[_0x4f4f('0x2f')](_0x5eb7c9[_0x4f4f('0x30')]);if(_0x5eb7c9['name']){delete _0x5eb7c9[_0x4f4f('0x31')];}_0x39c1a8[_0x4f4f('0x21')](_0x2e688a)[_0x4f4f('0x32')](_0x5eb7c9);};}exports['index']=function(_0x6bdf15,_0x343c75){var _0x59bdb0={},_0x5517d7={},_0x465a36={'count':0x0,'rows':[]};var _0x305bf7=_[_0x4f4f('0x33')](db[_0x4f4f('0x34')][_0x4f4f('0x35')],function(_0x8d0f53){return{'name':_0x8d0f53[_0x4f4f('0x36')],'type':_0x8d0f53[_0x4f4f('0x37')][_0x4f4f('0x38')]};});_0x5517d7[_0x4f4f('0x39')]=_['map'](_0x305bf7,'name');_0x5517d7[_0x4f4f('0x3a')]=_['keys'](_0x6bdf15[_0x4f4f('0x3a')]);_0x5517d7[_0x4f4f('0x3b')]=_[_0x4f4f('0x3c')](_0x5517d7[_0x4f4f('0x39')],_0x5517d7[_0x4f4f('0x3a')]);_0x59bdb0[_0x4f4f('0x3d')]=_[_0x4f4f('0x3c')](_0x5517d7[_0x4f4f('0x39')],qs[_0x4f4f('0x3e')](_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x59bdb0[_0x4f4f('0x3d')]=_0x59bdb0['attributes'][_0x4f4f('0x3f')]?_0x59bdb0[_0x4f4f('0x3d')]:_0x5517d7[_0x4f4f('0x39')];if(!_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x40')](_0x4f4f('0x41'))){_0x59bdb0[_0x4f4f('0x25')]=qs[_0x4f4f('0x25')](_0x6bdf15[_0x4f4f('0x3a')]['limit']);_0x59bdb0[_0x4f4f('0x23')]=qs[_0x4f4f('0x23')](_0x6bdf15[_0x4f4f('0x3a')]['offset']);}_0x59bdb0['order']=qs[_0x4f4f('0x42')](_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x42')]);_0x59bdb0[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0x6bdf15[_0x4f4f('0x3a')],_0x5517d7[_0x4f4f('0x3b')]),_0x305bf7);if(_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x45')]){_0x59bdb0[_0x4f4f('0x43')]=_[_0x4f4f('0x46')](_0x59bdb0['where'],{'$or':_[_0x4f4f('0x33')](_0x305bf7,function(_0x1b031e){if(_0x1b031e[_0x4f4f('0x37')]!==_0x4f4f('0x47')){var _0x18e805={};_0x18e805[_0x1b031e['name']]={'$like':'%'+_0x6bdf15['query'][_0x4f4f('0x45')]+'%'};return _0x18e805;}})});}_0x59bdb0=_[_0x4f4f('0x46')]({},_0x59bdb0,_0x6bdf15[_0x4f4f('0x48')]);var _0xa8f1a5={'where':_0x59bdb0['where']};return db[_0x4f4f('0x34')]['count'](_0xa8f1a5)[_0x4f4f('0x2b')](function(_0x5a7c94){_0x465a36['count']=_0x5a7c94;if(_0x6bdf15[_0x4f4f('0x3a')]['includeAll']){_0x59bdb0[_0x4f4f('0x49')]=[{'all':!![]}];}return db[_0x4f4f('0x34')]['findAll'](_0x59bdb0);})[_0x4f4f('0x2b')](function(_0x2d8ff6){_0x465a36['rows']=_0x2d8ff6;return _0x465a36;})[_0x4f4f('0x2b')](respondWithFilteredResult(_0x343c75,_0x59bdb0))[_0x4f4f('0x4a')](handleError(_0x343c75,null));};exports[_0x4f4f('0x4b')]=function(_0x3defd0,_0x162674){var _0x62b468={'raw':![],'where':{'id':_0x3defd0[_0x4f4f('0x4c')]['id']}},_0xb0d1b2={};_0xb0d1b2[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x34')][_0x4f4f('0x35')]);_0xb0d1b2[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0x3defd0[_0x4f4f('0x3a')]);_0xb0d1b2['filters']=_[_0x4f4f('0x3c')](_0xb0d1b2['model'],_0xb0d1b2['query']);_0x62b468[_0x4f4f('0x3d')]=_[_0x4f4f('0x3c')](_0xb0d1b2['model'],qs[_0x4f4f('0x3e')](_0x3defd0[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x62b468[_0x4f4f('0x3d')]=_0x62b468[_0x4f4f('0x3d')]['length']?_0x62b468[_0x4f4f('0x3d')]:_0xb0d1b2[_0x4f4f('0x39')];if(_0x3defd0[_0x4f4f('0x3a')][_0x4f4f('0x4e')]){_0x62b468[_0x4f4f('0x49')]=[{'all':!![]}];}_0x62b468=_[_0x4f4f('0x46')]({},_0x62b468,_0x3defd0[_0x4f4f('0x48')]);return db[_0x4f4f('0x34')][_0x4f4f('0x4f')](_0x62b468)['then'](handleEntityNotFound(_0x162674,null))[_0x4f4f('0x2b')](respondWithResult(_0x162674,null))[_0x4f4f('0x4a')](handleError(_0x162674,null));};exports['destroy']=function(_0x5ac4df,_0x5941ac){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x5ac4df[_0x4f4f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5941ac,null))[_0x4f4f('0x2b')](removeEntity(_0x5941ac,null))['catch'](handleError(_0x5941ac,null));};exports[_0x4f4f('0x50')]=function(_0x1c181e,_0x3c0d7b){return db[_0x4f4f('0x34')][_0x4f4f('0x50')]()[_0x4f4f('0x2b')](respondWithResult(_0x3c0d7b,null))[_0x4f4f('0x4a')](handleError(_0x3c0d7b,null));};exports[_0x4f4f('0x51')]=function(_0x17f6fb,_0x4dbce2){var _0x59e207;return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x4c04eb){return db['VoicePrefix'][_0x4f4f('0x51')](_0x17f6fb[_0x4f4f('0x54')],{'transaction':_0x4c04eb})[_0x4f4f('0x2b')](function(_0x55a5e4){_0x59e207=_0x55a5e4['get']({'plain':!![]});return db[_0x4f4f('0x55')][_0x4f4f('0x4f')]({'where':{'id':_0x59e207[_0x4f4f('0x56')]},'raw':!![]})[_0x4f4f('0x2b')](function(_0x37cf8e){return createVoicePrefixExtensions(_0x59e207,_0x37cf8e,_0x4c04eb);});});})[_0x4f4f('0x2b')](function(){var _0xe66fc=_0x17f6fb[_0x4f4f('0x57')][_0x4f4f('0x2c')]({'plain':!![]});if(!_0xe66fc)throw new Error(_0x4f4f('0x58'));if(_0xe66fc[_0x4f4f('0x59')]==='user'){var _0x585c06=_0x59e207;return db[_0x4f4f('0x5a')][_0x4f4f('0x4f')]({'where':{'name':_0x4f4f('0x2d'),'userProfileId':_0xe66fc[_0x4f4f('0x5b')]},'raw':!![]})['then'](function(_0x1bef77){if(_0x1bef77&&_0x1bef77['autoAssociation']===0x0){return db[_0x4f4f('0x5c')][_0x4f4f('0x51')]({'name':_0x585c06[_0x4f4f('0x31')],'resourceId':_0x585c06['id'],'type':_0x1bef77['name'],'sectionId':_0x1bef77['id']},{})[_0x4f4f('0x2b')](function(){return _0x59e207;});}else{return _0x59e207;}})[_0x4f4f('0x4a')](function(_0x23e9a9){logger['error'](_0x4f4f('0x5d'),_0x23e9a9);throw _0x23e9a9;});}return _0x59e207;})[_0x4f4f('0x2b')](respondWithResult(_0x4dbce2,null))[_0x4f4f('0x4a')](handleError(_0x4dbce2,null));};function Extension(_0x58a5dd,_0x2b01da,_0x16f162,_0x3fedae){this['context']=_0x4f4f('0x5e');this['exten']=_0x58a5dd;this[_0x4f4f('0x5f')]=_0x16f162;this[_0x4f4f('0x37')]=_0x4f4f('0x60');this[_0x4f4f('0x61')]=_0x4f4f('0x62');this[_0x4f4f('0x63')]=_0x2b01da;this[_0x4f4f('0x64')]=_0x3fedae;}function createVoicePrefixExtensions(_0xb2dfda,_0x40dffa,_0x36f369){return new BPromise(function(_0x269e0d,_0x5ba1e2){var _0x4794fe=new Extension(formatPrefixName(_0xb2dfda[_0x4f4f('0x65')]),0x1,_0x4f4f('0x66'),'Voice\x20Prefix');_0x4794fe[_0x4f4f('0x67')]=_0xb2dfda['id'];return db[_0x4f4f('0x55')][_0x4f4f('0x51')](_0x4794fe,{'transaction':_0x36f369})[_0x4f4f('0x2b')](function(_0x561411){var _0x28f9e1=_0x561411[_0x4f4f('0x2c')]({'plain':!![]});var _0xc9a47a=_[_0x4f4f('0x33')](addVoicePrefixExtensions(_0xb2dfda,_0x40dffa),function(_0x157af6){_0x157af6['VoiceExtensionId']=_0x28f9e1['id'];_0x157af6[_0x4f4f('0x67')]=_0xb2dfda['id'];return _0x157af6;});return db['VoiceExtension'][_0x4f4f('0x68')](_0xc9a47a,{'transaction':_0x36f369})[_0x4f4f('0x2b')](function(_0x2da4ea){if(!_0x2da4ea){return _0x5ba1e2(_0x4f4f('0x69'));}else{return _0x269e0d(_0x2da4ea);}})[_0x4f4f('0x4a')](function(_0x23366b){return _0x5ba1e2(_0x23366b);});});;});};function addVoicePrefixExtensions(_0x4bbbf6,_0x50590c){var _0x15c86f=[];var _0x4c42fd=formatPrefixName(_0x4bbbf6[_0x4f4f('0x65')]);_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x2,_0x4f4f('0x6b'),_0x4f4f('0x6c')+_0x4bbbf6[_0x4f4f('0x31')]));if(_0x4bbbf6[_0x4f4f('0x6d')]){_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x3,_0x4f4f('0x6b'),_0x4f4f('0x6e')+_0x4bbbf6[_0x4f4f('0x6d')]));}else{_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x3,'NoOp','No\x20callerid\x20available'));}_0x15c86f['push'](new Extension(_0x4c42fd,0x4,_0x4f4f('0x6f'),_0x50590c[_0x4f4f('0x70')]+','+'${EXTEN:'+(0x8+_0x4bbbf6[_0x4f4f('0x31')][_0x4f4f('0x3f')])+'}'+','+0x1));return _0x15c86f;}function formatPrefixName(_0x43d6c0){var _0x3007ff='_';for(var _0x12523f=0x0;_0x12523f<_0x43d6c0[_0x4f4f('0x3f')];_0x12523f++){if(_0x43d6c0['charAt'](_0x12523f)=='-'){_0x3007ff+=_0x43d6c0[_0x4f4f('0x71')](_0x12523f);}else{_0x3007ff+='['+_0x43d6c0[_0x4f4f('0x71')](_0x12523f)+']';}}_0x3007ff+='.';return _0x3007ff;}exports[_0x4f4f('0x2a')]=function(_0x24ed71,_0x33f4fd,_0x36299e){var _0x1d756b=_0x24ed71[_0x4f4f('0x54')];_0x1d756b['prefix']=_0x4f4f('0x72')+_0x1d756b[_0x4f4f('0x31')]+'-';return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x5f0efc){return db[_0x4f4f('0x34')]['update'](_0x1d756b,{'where':{'id':_0x1d756b['id']},'transaction':_0x5f0efc})[_0x4f4f('0x2b')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x1d756b['id']},'transaction':_0x5f0efc})[_0x4f4f('0x2b')](function(){return db[_0x4f4f('0x55')][_0x4f4f('0x4f')]({'where':{'id':_0x1d756b[_0x4f4f('0x56')]},'raw':!![]})['then'](function(_0x90813f){return createVoicePrefixExtensions(_0x1d756b,_0x90813f,_0x5f0efc);});});});})['then'](function(){return db[_0x4f4f('0x34')]['findById'](_0x1d756b['id']);})[_0x4f4f('0x2b')](respondWithResult(_0x33f4fd,null))[_0x4f4f('0x4a')](handleError(_0x33f4fd,null));};exports[_0x4f4f('0x73')]=function(_0x577fd9,_0x41c31c,_0x4b0ab5){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x577fd9[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x41c31c,null))[_0x4f4f('0x2b')](function(_0x4511c6){if(_0x4511c6){return _0x4511c6[_0x4f4f('0x73')](_0x577fd9[_0x4f4f('0x54')][_0x4f4f('0x74')],_['omit'](_0x577fd9[_0x4f4f('0x54')],[_0x4f4f('0x74'),'id'])||{})[_0x4f4f('0x75')](function(_0x14e4f3){for(var _0x42c638=0x0;_0x42c638<_0x577fd9[_0x4f4f('0x54')]['ids'][_0x4f4f('0x3f')];_0x42c638+=0x1){socket[_0x4f4f('0x76')](_0x4f4f('0x77'),{'UserId':Number(_0x577fd9[_0x4f4f('0x54')]['ids'][_0x42c638]),'VoicePrefixId':Number(_0x577fd9[_0x4f4f('0x4c')]['id'])});}return _0x14e4f3;});}})[_0x4f4f('0x2b')](respondWithResult(_0x41c31c,null))[_0x4f4f('0x4a')](handleError(_0x41c31c,null));};exports['removeAgents']=function(_0x838d05,_0x40bab8,_0x5ae1b6){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x838d05[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x40bab8,null))[_0x4f4f('0x2b')](function(_0x25cd1c){if(_0x25cd1c){return _0x25cd1c['removeAgents'](_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')])[_0x4f4f('0x2b')](function(){if(_[_0x4f4f('0x78')](_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')])){for(var _0x5b6633=0x0;_0x5b6633<_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')][_0x4f4f('0x3f')];_0x5b6633+=0x1){socket['emit'](_0x4f4f('0x79'),{'UserId':Number(_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')][_0x5b6633]),'VoicePrefixId':Number(_0x838d05[_0x4f4f('0x4c')]['id'])});}}else{socket[_0x4f4f('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x838d05[_0x4f4f('0x3a')]['ids']),'VoicePrefixId':Number(_0x838d05['params']['id'])});}});}})[_0x4f4f('0x2b')](respondWithStatusCode(_0x40bab8,null))[_0x4f4f('0x4a')](handleError(_0x40bab8,null));};exports[_0x4f4f('0x7a')]=function(_0x33c295,_0x762acd,_0x362c6d){var _0x1d1f5f={};var _0x19e743={};var _0x167c43;var _0x50058d;return db[_0x4f4f('0x34')]['findOne']({'where':{'id':_0x33c295[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x762acd,null))['then'](function(_0x3286b1){if(_0x3286b1){_0x167c43=_0x3286b1;_0x19e743[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x7b')][_0x4f4f('0x35')]);_0x19e743[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0x33c295[_0x4f4f('0x3a')]);_0x19e743['filters']=_[_0x4f4f('0x3c')](_0x19e743[_0x4f4f('0x39')],_0x19e743[_0x4f4f('0x3a')]);_0x1d1f5f['attributes']=_[_0x4f4f('0x3c')](_0x19e743['model'],qs['fields'](_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x1d1f5f[_0x4f4f('0x3d')]=_0x1d1f5f[_0x4f4f('0x3d')]['length']?_0x1d1f5f[_0x4f4f('0x3d')]:_0x19e743['model'];_0x1d1f5f[_0x4f4f('0x7c')]=qs[_0x4f4f('0x42')](_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x42')]);_0x1d1f5f[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0x33c295[_0x4f4f('0x3a')],_0x19e743[_0x4f4f('0x3b')]));if(_0x33c295[_0x4f4f('0x3a')]['filter']){_0x1d1f5f['where']=_[_0x4f4f('0x46')](_0x1d1f5f[_0x4f4f('0x43')],{'$or':_[_0x4f4f('0x33')](_0x1d1f5f[_0x4f4f('0x3d')],function(_0x515d05){var _0x485129={};_0x485129[_0x515d05]={'$like':'%'+_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x45')]+'%'};return _0x485129;})});}_0x1d1f5f=_[_0x4f4f('0x46')]({},_0x1d1f5f,_0x33c295[_0x4f4f('0x48')]);return _0x167c43[_0x4f4f('0x7a')](_0x1d1f5f);}})['then'](function(_0x10fa9e){if(_0x10fa9e){_0x50058d=_0x10fa9e[_0x4f4f('0x3f')];if(!_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x40')](_0x4f4f('0x41'))){_0x1d1f5f['limit']=qs[_0x4f4f('0x25')](_0x33c295['query']['limit']);_0x1d1f5f[_0x4f4f('0x23')]=qs[_0x4f4f('0x23')](_0x33c295[_0x4f4f('0x3a')]['offset']);}return _0x167c43[_0x4f4f('0x7a')](_0x1d1f5f);}})[_0x4f4f('0x2b')](function(_0x56015c){if(_0x56015c){return _0x56015c?{'count':_0x50058d,'rows':_0x56015c}:null;}})[_0x4f4f('0x2b')](respondWithResult(_0x762acd,null))[_0x4f4f('0x4a')](handleError(_0x762acd,null));};exports['getTeams']=function(_0xaa0e50,_0x23e8bd,_0x3b5214){var _0x38ea5d={};var _0x4632c0={};var _0x6ec076;var _0x56f2c5;return db[_0x4f4f('0x34')][_0x4f4f('0x7d')]({'where':{'id':_0xaa0e50[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x23e8bd,null))[_0x4f4f('0x2b')](function(_0x3d0e57){if(_0x3d0e57){_0x6ec076=_0x3d0e57;_0x4632c0[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x7e')][_0x4f4f('0x35')]);_0x4632c0[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0xaa0e50[_0x4f4f('0x3a')]);_0x4632c0[_0x4f4f('0x3b')]=_[_0x4f4f('0x3c')](_0x4632c0['model'],_0x4632c0[_0x4f4f('0x3a')]);_0x38ea5d['attributes']=_[_0x4f4f('0x3c')](_0x4632c0[_0x4f4f('0x39')],qs[_0x4f4f('0x3e')](_0xaa0e50['query'][_0x4f4f('0x3e')]));_0x38ea5d[_0x4f4f('0x3d')]=_0x38ea5d[_0x4f4f('0x3d')][_0x4f4f('0x3f')]?_0x38ea5d[_0x4f4f('0x3d')]:_0x4632c0['model'];_0x38ea5d[_0x4f4f('0x7c')]=qs[_0x4f4f('0x42')](_0xaa0e50[_0x4f4f('0x3a')]['sort']);_0x38ea5d[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0xaa0e50['query'],_0x4632c0[_0x4f4f('0x3b')]));if(_0xaa0e50['query'][_0x4f4f('0x45')]){_0x38ea5d['where']=_['merge'](_0x38ea5d['where'],{'$or':_['map'](_0x38ea5d['attributes'],function(_0x446cbd){var _0x2f2cb9={};_0x2f2cb9[_0x446cbd]={'$like':'%'+_0xaa0e50['query']['filter']+'%'};return _0x2f2cb9;})});}_0x38ea5d=_[_0x4f4f('0x46')]({},_0x38ea5d,_0xaa0e50[_0x4f4f('0x48')]);return _0x6ec076[_0x4f4f('0x7f')](_0x38ea5d);}})['then'](function(_0x5ad9f6){if(_0x5ad9f6){_0x56f2c5=_0x5ad9f6['length'];if(!_0xaa0e50[_0x4f4f('0x3a')]['hasOwnProperty']('nolimit')){_0x38ea5d[_0x4f4f('0x25')]=qs['limit'](_0xaa0e50[_0x4f4f('0x3a')][_0x4f4f('0x25')]);_0x38ea5d['offset']=qs[_0x4f4f('0x23')](_0xaa0e50[_0x4f4f('0x3a')]['offset']);}return _0x6ec076[_0x4f4f('0x7f')](_0x38ea5d);}})[_0x4f4f('0x2b')](function(_0x3be76f){if(_0x3be76f){return _0x3be76f?{'count':_0x56f2c5,'rows':_0x3be76f}:null;}})[_0x4f4f('0x2b')](respondWithResult(_0x23e8bd,null))['catch'](handleError(_0x23e8bd,null));};exports[_0x4f4f('0x80')]=function(_0x349e9c,_0x2fc478,_0x3a745a){var _0x53c962=_0x349e9c[_0x4f4f('0x54')][_0x4f4f('0x74')];var _0x27b573;return db[_0x4f4f('0x7e')][_0x4f4f('0x81')]({'where':{'id':_0x53c962},'attributes':['id'],'include':[{'model':db[_0x4f4f('0x7b')],'as':_0x4f4f('0x82'),'attributes':['id',_0x4f4f('0x31'),_0x4f4f('0x83'),_0x4f4f('0x84'),_0x4f4f('0x85')],'raw':!![]}]})[_0x4f4f('0x2b')](function(_0x3f87c8){if(_0x3f87c8){_0x27b573=_0x3f87c8;var _0x22e619=_['flatMap'](_0x3f87c8,function(_0x3bfc19){var _0x150474=_0x3bfc19[_0x4f4f('0x2c')]({'plain':!![]});return _0x150474[_0x4f4f('0x82')];});return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x349e9c['params']['id']}})[_0x4f4f('0x2b')](function(_0x5a4d26){return db[_0x4f4f('0x52')]['transaction'](function(_0x2d1cc1){return _0x5a4d26['addTeams'](_0x53c962,{'transaction':_0x2d1cc1})[_0x4f4f('0x2b')](function(){return BPromise[_0x4f4f('0x86')](_0x27b573,function(_0x2b6319){return db['TeamVoicePrefix'][_0x4f4f('0x87')]({'TeamId':_0x2b6319['id'],'VoicePrefixId':_0x349e9c[_0x4f4f('0x4c')]['id']},{'transaction':_0x2d1cc1});});})[_0x4f4f('0x2b')](function(){return BPromise[_0x4f4f('0x86')](_0x22e619,function(_0xbe8586){return db['UserVoicePrefix'][_0x4f4f('0x88')]({'where':{'UserId':_0xbe8586['id'],'VoicePrefixId':_0x349e9c['params']['id']},'transaction':_0x2d1cc1});});})[_0x4f4f('0x2b')](function(){_0x22e619[_0x4f4f('0x89')](function(_0x4bb547){socket['emit']('userVoicePrefix:save',{'UserId':_0x4bb547['id'],'VoicePrefixId':_0x5a4d26['id']});});});});});}})[_0x4f4f('0x2b')](respondWithStatusCode(_0x2fc478,null))[_0x4f4f('0x4a')](handleError(_0x2fc478,null));};exports[_0x4f4f('0x8a')]=function(_0x4c178d,_0x2cf10a,_0x53a849){return db[_0x4f4f('0x7e')]['findAll']({'where':{'id':_0x4c178d[_0x4f4f('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4f4f('0x7b')],'as':_0x4f4f('0x82'),'attributes':['id'],'raw':!![]}]})[_0x4f4f('0x2b')](handleEntityNotFound(_0x2cf10a,null))[_0x4f4f('0x2b')](function(_0x5063a6){var _0x1ce179=_[_0x4f4f('0x33')](_0x5063a6,'id');var _0x3f2b27=[];var _0x28049b=[];var _0x13418d=squel[_0x4f4f('0x8b')]();_0x13418d[_0x4f4f('0x8c')](_0x4f4f('0x8d'))[_0x4f4f('0x8e')](_0x4f4f('0x8f'),'tq')[_0x4f4f('0x90')]('user_has_teams','ut',_0x4f4f('0x91'))[_0x4f4f('0x43')](_0x4f4f('0x92'),_0x4c178d[_0x4f4f('0x4c')]['id']);for(var _0x223179=0x0;_0x223179<_0x5063a6['length'];_0x223179+=0x1){let _0x373ead=_0x5063a6[_0x223179];for(var _0x53dfb2=0x0;_0x53dfb2<_0x373ead[_0x4f4f('0x82')][_0x4f4f('0x3f')];_0x53dfb2+=0x1){let _0x3fcb64=_0x373ead[_0x4f4f('0x82')][_0x53dfb2];var _0x57405d=_0x13418d[_0x4f4f('0x93')]();_0x57405d['where'](_0x4f4f('0x94'),_0x3fcb64['id']);_0x28049b[_0x4f4f('0x6a')](db[_0x4f4f('0x52')][_0x4f4f('0x3a')](_0x57405d[_0x4f4f('0x95')](),{'type':db[_0x4f4f('0x52')][_0x4f4f('0x96')][_0x4f4f('0x97')]})[_0x4f4f('0x2b')](function(_0x3ce86c){if(_0x3ce86c['length']===0x1){return _0x3fcb64['id'];}else{var _0xe830ee=_['every'](_[_0x4f4f('0x33')](_0x3ce86c,'TeamId'),function(_0x277c96){return _[_0x4f4f('0x98')](_0x1ce179,_0x277c96);});if(_0xe830ee){return _0x3fcb64['id'];}}}));}}return BPromise[_0x4f4f('0x99')](_0x28049b)[_0x4f4f('0x2b')](function(_0x3a0382){_0x3f2b27=_(_0x3f2b27)[_0x4f4f('0x9a')](_0x3a0382)[_0x4f4f('0x9b')]()[_0x4f4f('0x9c')]();return db['VoicePrefix'][_0x4f4f('0x4f')]({'where':{'id':_0x4c178d[_0x4f4f('0x4c')]['id']}})['then'](function(_0x379a2e){return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x35e9e7){return _0x379a2e['removeTeams'](_0x4c178d[_0x4f4f('0x3a')]['ids'],{'transaction':_0x35e9e7})[_0x4f4f('0x2b')](function(){if(!_['isEmpty'](_0x3f2b27)){return _0x379a2e[_0x4f4f('0x9d')](_0x3f2b27,{'transaction':_0x35e9e7});}})['then'](function(){_0x3f2b27['forEach'](function(_0x3f2df9){socket[_0x4f4f('0x76')](_0x4f4f('0x79'),{'UserId':_0x3f2df9,'VoicePrefixId':_0x379a2e['id']});});});});});});})[_0x4f4f('0x2b')](respondWithStatusCode(_0x2cf10a,null))['catch'](handleError(_0x2cf10a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7740574..ec977b5 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 _0xe60f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x50d788,_0x3d4d71){var _0x242b34=function(_0x45ccda){while(--_0x45ccda){_0x50d788['push'](_0x50d788['shift']());}};_0x242b34(++_0x3d4d71);}(_0xe60f,0x1e8));var _0xfe60=function(_0x46dff2,_0x525d63){_0x46dff2=_0x46dff2-0x0;var _0xa65628=_0xe60f[_0x46dff2];return _0xa65628;};'use strict';var EventEmitter=require(_0xfe60('0x0'));var VoicePrefix=require(_0xfe60('0x1'))['db'][_0xfe60('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xfe60('0x3')](0x0);var events={'afterCreate':_0xfe60('0x4'),'afterUpdate':_0xfe60('0x5'),'afterDestroy':_0xfe60('0x6')};function emitEvent(_0x4efce7){return function(_0x2eacbe,_0x34acb3,_0x4d464f){VoicePrefixEvents['emit'](_0x4efce7+':'+_0x2eacbe['id'],_0x2eacbe);VoicePrefixEvents[_0xfe60('0x7')](_0x4efce7,_0x2eacbe);_0x4d464f(null);};}for(var e in events){if(events[_0xfe60('0x8')](e)){var event=events[e];VoicePrefix[_0xfe60('0x9')](e,emitEvent(event));}}module[_0xfe60('0xa')]=VoicePrefixEvents; \ No newline at end of file +var _0xe816=['emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x3cb68a,_0x648f8e){var _0x2e0bac=function(_0x459717){while(--_0x459717){_0x3cb68a['push'](_0x3cb68a['shift']());}};_0x2e0bac(++_0x648f8e);}(_0xe816,0x1bb));var _0x6e81=function(_0x16577c,_0x33d9a4){_0x16577c=_0x16577c-0x0;var _0x4d19b7=_0xe816[_0x16577c];return _0x4d19b7;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x6e81('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6e81('0x1')](0x0);var events={'afterCreate':_0x6e81('0x2'),'afterUpdate':_0x6e81('0x3'),'afterDestroy':_0x6e81('0x4')};function emitEvent(_0x1825d1){return function(_0x2043f2,_0x47140f,_0x54757c){VoicePrefixEvents[_0x6e81('0x5')](_0x1825d1+':'+_0x2043f2['id'],_0x2043f2);VoicePrefixEvents[_0x6e81('0x5')](_0x1825d1,_0x2043f2);_0x54757c(null);};}for(var e in events){if(events[_0x6e81('0x6')](e)){var event=events[e];VoicePrefix[_0x6e81('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 b2cc2fb..d8b5d2b 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 _0x21a7=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x14647d,_0x20a244){var _0x3a0cae=function(_0x6f6909){while(--_0x6f6909){_0x14647d['push'](_0x14647d['shift']());}};_0x3a0cae(++_0x20a244);}(_0x21a7,0x18c));var _0x721a=function(_0x289689,_0x19a641){_0x289689=_0x289689-0x0;var _0x4f5e29=_0x21a7[_0x289689];return _0x4f5e29;};'use strict';var _=require('lodash');var util=require(_0x721a('0x0'));var logger=require(_0x721a('0x1'))(_0x721a('0x2'));var moment=require('moment');var BPromise=require(_0x721a('0x3'));var rp=require(_0x721a('0x4'));var fs=require('fs');var path=require(_0x721a('0x5'));var rimraf=require(_0x721a('0x6'));var config=require('../../config/environment');var attributes=require(_0x721a('0x7'));module['exports']=function(_0x248c9c,_0x7275d0){return _0x248c9c[_0x721a('0x8')](_0x721a('0x9'),attributes,{'tableName':_0x721a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80d2=['path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','api','moment','bluebird'];(function(_0x53ed59,_0x4beb34){var _0x5834ca=function(_0x5f51f0){while(--_0x5f51f0){_0x53ed59['push'](_0x53ed59['shift']());}};_0x5834ca(++_0x4beb34);}(_0x80d2,0x189));var _0x280d=function(_0x365092,_0x53e788){_0x365092=_0x365092-0x0;var _0x48a039=_0x80d2[_0x365092];return _0x48a039;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x280d('0x0'));var moment=require(_0x280d('0x1'));var BPromise=require(_0x280d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x280d('0x3'));var rimraf=require(_0x280d('0x4'));var config=require(_0x280d('0x5'));var attributes=require(_0x280d('0x6'));module[_0x280d('0x7')]=function(_0x4d69f2,_0xd4c8b6){return _0x4d69f2[_0x280d('0x8')](_0x280d('0x9'),attributes,{'tableName':_0x280d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index eb7d0e8..a9c74dc 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 _0xba0d=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x4e3e75,_0x409bc0){var _0x5e66c6=function(_0x544777){while(--_0x544777){_0x4e3e75['push'](_0x4e3e75['shift']());}};_0x5e66c6(++_0x409bc0);}(_0xba0d,0x8e));var _0xdba0=function(_0x3be1e6,_0x1953f5){_0x3be1e6=_0x3be1e6-0x0;var _0x5c0be1=_0xba0d[_0x3be1e6];return _0x5c0be1;};'use strict';var _=require(_0xdba0('0x0'));var util=require('util');var moment=require(_0xdba0('0x1'));var BPromise=require(_0xdba0('0x2'));var rs=require(_0xdba0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdba0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdba0('0x5'))(_0xdba0('0x6'));var config=require(_0xdba0('0x7'));var jayson=require(_0xdba0('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xdba0('0x9')]=_[_0xdba0('0xa')](config[_0xdba0('0x9')],{'host':_0xdba0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdba0('0x9')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x21cb20,_0x4d01a9,_0x268cc3){return new BPromise(function(_0x56d368,_0x1b4dec){return client[_0xdba0('0xc')](_0x21cb20,_0x268cc3)[_0xdba0('0xd')](function(_0x193cd6){logger[_0xdba0('0xe')](_0xdba0('0xf'),_0x4d01a9,_0xdba0('0x10'));logger[_0xdba0('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x4d01a9,'request\x20sent',JSON[_0xdba0('0x12')](_0x193cd6));if(_0x193cd6[_0xdba0('0x13')]){if(_0x193cd6[_0xdba0('0x13')][_0xdba0('0x14')]===0x1f4){logger[_0xdba0('0x13')](_0xdba0('0xf'),_0x4d01a9,_0x193cd6[_0xdba0('0x13')]['message']);return _0x1b4dec(_0x193cd6[_0xdba0('0x13')][_0xdba0('0x15')]);}logger[_0xdba0('0x13')](_0xdba0('0xf'),_0x4d01a9,_0x193cd6[_0xdba0('0x13')][_0xdba0('0x15')]);return _0x56d368(_0x193cd6[_0xdba0('0x13')][_0xdba0('0x15')]);}else{logger[_0xdba0('0xe')](_0xdba0('0xf'),_0x4d01a9,'request\x20sent');_0x56d368(_0x193cd6[_0xdba0('0x16')]['message']);}})[_0xdba0('0x17')](function(_0x2915e6){logger[_0xdba0('0x13')](_0xdba0('0xf'),_0x4d01a9,_0x2915e6);_0x1b4dec(_0x2915e6);});});} \ No newline at end of file +var _0x25a9=['VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x25a9,0xf1));var _0x925a=function(_0xc72a72,_0xfaaf35){_0xc72a72=_0xc72a72-0x0;var _0x20f9a9=_0x25a9[_0xc72a72];return _0x20f9a9;};'use strict';var _=require('lodash');var util=require(_0x925a('0x0'));var moment=require(_0x925a('0x1'));var BPromise=require(_0x925a('0x2'));var rs=require(_0x925a('0x3'));var fs=require('fs');var Redis=require(_0x925a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x925a('0x5'));var logger=require(_0x925a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x925a('0x7'));var client=jayson['client'][_0x925a('0x8')]({'port':0x232a});config[_0x925a('0x9')]=_[_0x925a('0xa')](config[_0x925a('0x9')],{'host':_0x925a('0xb'),'port':0x18eb});var socket=require(_0x925a('0xc'))(new Redis(config[_0x925a('0x9')]));require('./voicePrefix.socket')[_0x925a('0xd')](socket);function respondWithRpcPromise(_0x55a571,_0x4f76b2,_0x575450){return new BPromise(function(_0x152980,_0x5871f4){return client[_0x925a('0xe')](_0x55a571,_0x575450)[_0x925a('0xf')](function(_0xe633a1){logger[_0x925a('0x10')](_0x925a('0x11'),_0x4f76b2,_0x925a('0x12'));logger['debug'](_0x925a('0x13'),_0x4f76b2,_0x925a('0x12'),JSON[_0x925a('0x14')](_0xe633a1));if(_0xe633a1[_0x925a('0x15')]){if(_0xe633a1[_0x925a('0x15')][_0x925a('0x16')]===0x1f4){logger[_0x925a('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x4f76b2,_0xe633a1[_0x925a('0x15')][_0x925a('0x17')]);return _0x5871f4(_0xe633a1[_0x925a('0x15')][_0x925a('0x17')]);}logger['error'](_0x925a('0x11'),_0x4f76b2,_0xe633a1[_0x925a('0x15')]['message']);return _0x152980(_0xe633a1[_0x925a('0x15')][_0x925a('0x17')]);}else{logger[_0x925a('0x10')](_0x925a('0x11'),_0x4f76b2,'request\x20sent');_0x152980(_0xe633a1[_0x925a('0x18')][_0x925a('0x17')]);}})[_0x925a('0x19')](function(_0x3375e6){logger[_0x925a('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x4f76b2,_0x3375e6);_0x5871f4(_0x3375e6);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index ee43e9d..eb90422 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 _0xc560=['./voicePrefix.events','remove','emit','removeListener','length'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc560,0x82));var _0x0c56=function(_0x1d71a9,_0x45bf27){_0x1d71a9=_0x1d71a9-0x0;var _0x404490=_0xc560[_0x1d71a9];return _0x404490;};'use strict';var VoicePrefixEvents=require(_0x0c56('0x0'));var events=['save',_0x0c56('0x1'),'update'];function createListener(_0x2c4115,_0x5b4dfe){return function(_0x5c33dd){_0x5b4dfe[_0x0c56('0x2')](_0x2c4115,_0x5c33dd);};}function removeListener(_0x39dbc7,_0x37c584){return function(){VoicePrefixEvents[_0x0c56('0x3')](_0x39dbc7,_0x37c584);};}exports['register']=function(_0x2b5654){for(var _0x2bc0a0=0x0,_0x35b4ee=events[_0x0c56('0x4')];_0x2bc0a0<_0x35b4ee;_0x2bc0a0++){var _0x501a0b=events[_0x2bc0a0];var _0x429ad1=createListener('voicePrefix:'+_0x501a0b,_0x2b5654);VoicePrefixEvents['on'](_0x501a0b,_0x429ad1);}}; \ No newline at end of file +var _0xc6d8=['remove','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0xd4ad6d,_0x5f0f35){var _0x5dca7d=function(_0x57b027){while(--_0x57b027){_0xd4ad6d['push'](_0xd4ad6d['shift']());}};_0x5dca7d(++_0x5f0f35);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x498e3c,_0x2455c4){_0x498e3c=_0x498e3c-0x0;var _0x1e5f5f=_0xc6d8[_0x498e3c];return _0x1e5f5f;};'use strict';var VoicePrefixEvents=require(_0x8c6d('0x0'));var events=['save',_0x8c6d('0x1'),'update'];function createListener(_0x3b88d1,_0x5974d3){return function(_0x292852){_0x5974d3['emit'](_0x3b88d1,_0x292852);};}function removeListener(_0x5b6b04,_0x352b8c){return function(){VoicePrefixEvents[_0x8c6d('0x2')](_0x5b6b04,_0x352b8c);};}exports[_0x8c6d('0x3')]=function(_0x4f5e8f){for(var _0x3c265c=0x0,_0x2dbb52=events[_0x8c6d('0x4')];_0x3c265c<_0x2dbb52;_0x3c265c++){var _0x5529f1=events[_0x3c265c];var _0x1496ba=createListener(_0x8c6d('0x5')+_0x5529f1,_0x4f5e8f);VoicePrefixEvents['on'](_0x5529f1,_0x1496ba);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 946cacf..d83e93c 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x467e37,_0x4692ff){var _0x555200=function(_0x4ae25a){while(--_0x4ae25a){_0x467e37['push'](_0x467e37['shift']());}};_0x555200(++_0x4692ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x150aa1,_0x16169e){var _0x186ac7=function(_0x2b8786){while(--_0x2b8786){_0x150aa1['push'](_0x150aa1['shift']());}};_0x186ac7(++_0x16169e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 5c5c4e7..0de2ab6 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 _0x1b01=['yes','all','once','join','periodic_announce','split','joinempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','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','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\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','ENUM','inbound','outbound','STRING','leastrecent','fewestcalls','random','rrmemory','wrandom','ringall','setDataValue','getDataValue','strategy','preview','booked','roundrobin','includes','INTEGER'];(function(_0x4da382,_0x4cfc5d){var _0x10073f=function(_0x32dc45){while(--_0x32dc45){_0x4da382['push'](_0x4da382['shift']());}};_0x10073f(++_0x4cfc5d);}(_0x1b01,0x81));var _0x11b0=function(_0x29af1d,_0x3c1398){_0x29af1d=_0x29af1d-0x0;var _0x551cb3=_0x1b01[_0x29af1d];return _0x551cb3;};'use strict';var Sequelize=require(_0x11b0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x2'),_0x11b0('0x3')),'allowNull':![],'defaultValue':_0x11b0('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0x11b0('0x1')]('rr','ringall',_0x11b0('0x5'),_0x11b0('0x6'),_0x11b0('0x7'),_0x11b0('0x8'),'linear',_0x11b0('0x9'),'rrordered'),'allowNull':![],'defaultValue':_0x11b0('0xa'),'set':function(_0x3c332f){this[_0x11b0('0xb')]('strategy',_0x3c332f?_0x3c332f:_0x11b0('0x8'));},'get':function(){var _0x1d8b0f=this[_0x11b0('0xc')]('type');var _0x378045=this['getDataValue']('dialMethod');var _0x9baa3c=this[_0x11b0('0xc')](_0x11b0('0xd'));if(_0x1d8b0f===_0x11b0('0x3')){if(_0x378045===_0x11b0('0xe')){return null;}if(_0x378045===_0x11b0('0xf')&&![_0x11b0('0x8'),_0x11b0('0x10')][_0x11b0('0x11')](_0x9baa3c)){this[_0x11b0('0xb')](_0x11b0('0xd'),'rrmemory');}}return _0x9baa3c;}},'servicelevel':{'type':Sequelize[_0x11b0('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x11b0('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x11b0('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x11b0('0x4')]},'weight':{'type':Sequelize[_0x11b0('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x11b0('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x13'),'no'),'defaultValue':_0x11b0('0x13')},'autopause':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x13'),'no',_0x11b0('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x11b0('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x11b0('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x11b0('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x11b0('0x1')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x11b0('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x11b0('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x11b0('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x11b0('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x11b0('0x1')]('yes','no'),'defaultValue':_0x11b0('0x13')},'announce_holdtime':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x13'),'no',_0x11b0('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x11b0('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x11b0('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x11b0('0x4')]},'queue_youarenext':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x11b0('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x11b0('0x4')]},'queue_quantity1':{'type':Sequelize[_0x11b0('0x4')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x11b0('0x4')]},'queue_less_than':{'type':Sequelize[_0x11b0('0x4')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x15f8b5){this['setDataValue']('periodic_announce',_0x15f8b5?_0x15f8b5[_0x11b0('0x16')](','):[]);},'get':function(){return this[_0x11b0('0xc')](_0x11b0('0x17'))?this[_0x11b0('0xc')](_0x11b0('0x17'))[_0x11b0('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':_0x11b0('0x13'),'set':function(_0xbfe1e3){this['setDataValue'](_0x11b0('0x19'),_0xbfe1e3?_0xbfe1e3[_0x11b0('0x16')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this['getDataValue']('joinempty')[_0x11b0('0x18')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':'no','set':function(_0x1c5e29){this[_0x11b0('0xb')]('leavewhenempty',_0x1c5e29?_0x1c5e29['join'](','):undefined);},'get':function(){return this[_0x11b0('0xc')]('leavewhenempty')?this[_0x11b0('0xc')]('leavewhenempty')[_0x11b0('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x11b0('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x11b0('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x11b0('0x1a')],'defaultValue':0x0,'set':function(_0x1633ae){this['setDataValue'](_0x11b0('0x1b'),_0x1633ae);if(_0x1633ae){if(this[_0x11b0('0xc')](_0x11b0('0x1c'))<0x2){this[_0x11b0('0xb')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x11b0('0x1a')],'defaultValue':0x0,'comment':_0x11b0('0x1d')},'dialMethod':{'type':Sequelize['ENUM'](_0x11b0('0xe'),_0x11b0('0x1e'),_0x11b0('0x1f'),_0x11b0('0x20'),_0x11b0('0xf')),'defaultValue':_0x11b0('0x1e'),'comment':_0x11b0('0x21')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x11b0('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x11b0('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x11b0('0x23')},'dialPowerLevel':{'type':Sequelize[_0x11b0('0x24')](0x2)[_0x11b0('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x11b0('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x11b0('0x1')](_0x11b0('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x11b0('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x11b0('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x11b0('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0x11b0('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x11b0('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x11b0('0x12')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11b0('0x29')},'dialQueueOptions':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':_0x11b0('0x2a'),'comment':_0x11b0('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x11b0('0x12')](0x3)[_0x11b0('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x11b0('0x4')],'comment':_0x11b0('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x11b0('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x11b0('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11b0('0x2d')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x11b0('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x11b0('0x12')](0x5)[_0x11b0('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x11b0('0x12')](0x3)[_0x11b0('0x22')],'defaultValue':0x3,'comment':_0x11b0('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11b0('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize[_0x11b0('0x12')](0x3)[_0x11b0('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x11b0('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x11b0('0x30')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x11b0('0x31'),_0x11b0('0x32')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x11b0('0x1a')],'defaultValue':0x0,'comment':_0x11b0('0x33')},'dialAMDInitialSilence':{'type':Sequelize[_0x11b0('0x12')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x11b0('0x34')},'dialAMDGreeting':{'type':Sequelize[_0x11b0('0x12')](0x9)[_0x11b0('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x11b0('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x11b0('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x11b0('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x11b0('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x11b0('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0x11b0('0x12')](0x9)[_0x11b0('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x11b0('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x11b0('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x11b0('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x11b0('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x11b0('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x11b0('0x12')](0x5)[_0x11b0('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x11b0('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x11b0('0x12')](0x9)[_0x11b0('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x11b0('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x11b0('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x11b0('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x11b0('0x1')]('DESC',_0x11b0('0x3e')),'defaultValue':_0x11b0('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x11b0('0x4')],'comment':_0x11b0('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x11b0('0x1a')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x11b0('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x11b0('0x40')},'dialCutDigit':{'type':Sequelize[_0x11b0('0x12')](0x3)[_0x11b0('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x11b0('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11b0('0x41')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x11b0('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11b0('0x42')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x11b0('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11b0('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0x11b0('0x12')](0x5)[_0x11b0('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x11b0('0x12')](0x3)[_0x11b0('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x11b0('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11b0('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0x11b0('0x12')](0x3)[_0x11b0('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11b0('0x45')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x11b0('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11b0('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x11b0('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x11b0('0x12')](0x5)[_0x11b0('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x11b0('0x12')],'allowNull':!![],'comment':_0x11b0('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x11b0('0x1a')],'defaultValue':![],'comment':_0x11b0('0x48'),'set':function(_0x599dbb){if(!_0x599dbb)this['setDataValue'](_0x11b0('0x49'),null);this[_0x11b0('0xb')]('mandatoryDisposition',_0x599dbb);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x11b0('0x12')](0x3)[_0x11b0('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x11b0('0x12')](0x3)[_0x11b0('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x11b0('0x12')](0x3)[_0x11b0('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x63c0=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','name','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','booked','INTEGER','STRING','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','BOOLEAN','Active/Disactive\x20Campaign','progressive','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x163691,_0x3d10c4){var _0x543ae5=function(_0x4af2ea){while(--_0x4af2ea){_0x163691['push'](_0x163691['shift']());}};_0x543ae5(++_0x3d10c4);}(_0x63c0,0xed));var _0x063c=function(_0x332251,_0x3c134f){_0x332251=_0x332251-0x0;var _0x592e7d=_0x63c0[_0x332251];return _0x592e7d;};'use strict';var Sequelize=require(_0x063c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x063c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x063c('0x2'),_0x063c('0x3')),'allowNull':![],'defaultValue':_0x063c('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x063c('0x4')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x063c('0x5')]('rr',_0x063c('0x6'),_0x063c('0x7'),_0x063c('0x8'),'random',_0x063c('0x9'),'linear',_0x063c('0xa'),_0x063c('0xb')),'allowNull':![],'defaultValue':_0x063c('0x6'),'set':function(_0x250dc8){this[_0x063c('0xc')](_0x063c('0xd'),_0x250dc8?_0x250dc8:_0x063c('0x9'));},'get':function(){var _0x2940de=this[_0x063c('0xe')]('type');var _0x263c92=this[_0x063c('0xe')](_0x063c('0xf'));var _0x18b6ca=this['getDataValue']('strategy');if(_0x2940de==='outbound'){if(_0x263c92===_0x063c('0x10')){return null;}if(_0x263c92===_0x063c('0x11')&&!['rrmemory','roundrobin']['includes'](_0x18b6ca)){this[_0x063c('0xc')](_0x063c('0xd'),_0x063c('0x9'));}}return _0x18b6ca;}},'servicelevel':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x063c('0x12')](0xb)},'timeout':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x063c('0x13')]},'weight':{'type':Sequelize[_0x063c('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x063c('0x14'),'no'),'defaultValue':_0x063c('0x14')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x063c('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x063c('0x12')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x063c('0x5')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x063c('0x5')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x063c('0x5')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x063c('0x13')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no'),'defaultValue':_0x063c('0x14')},'announce_holdtime':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no',_0x063c('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x063c('0x13')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x063c('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x063c('0x13')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x063c('0x13')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x063c('0x13')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x063c('0x13')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x063c('0x13')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x063c('0x13')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x063c('0x13')]},'queue_quantity2':{'type':Sequelize[_0x063c('0x13')]},'queue_periodic_announce':{'type':Sequelize[_0x063c('0x13')]},'queue_less_than':{'type':Sequelize[_0x063c('0x13')]},'periodic_announce':{'type':Sequelize[_0x063c('0x17')],'set':function(_0xb73849){this[_0x063c('0xc')](_0x063c('0x18'),_0xb73849?_0xb73849[_0x063c('0x19')](','):[]);},'get':function(){return this[_0x063c('0xe')](_0x063c('0x18'))?this[_0x063c('0xe')](_0x063c('0x18'))[_0x063c('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x063c('0x13')],'defaultValue':'yes','set':function(_0x443a66){this['setDataValue'](_0x063c('0x1b'),_0x443a66?_0x443a66[_0x063c('0x19')](','):undefined);},'get':function(){return this[_0x063c('0xe')](_0x063c('0x1b'))?this[_0x063c('0xe')](_0x063c('0x1b'))[_0x063c('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x063c('0x13')],'defaultValue':'no','set':function(_0x4a2444){this['setDataValue']('leavewhenempty',_0x4a2444?_0x4a2444[_0x063c('0x19')](','):undefined);},'get':function(){return this[_0x063c('0xe')](_0x063c('0x1c'))?this[_0x063c('0xe')](_0x063c('0x1c'))[_0x063c('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x063c('0x13')]},'description':{'type':Sequelize[_0x063c('0x13')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x5f1336){this['setDataValue'](_0x063c('0x1d'),_0x5f1336);if(_0x5f1336){if(this['getDataValue']('wrapuptime')<0x2){this[_0x063c('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':0x0,'comment':_0x063c('0x1f')},'dialMethod':{'type':Sequelize[_0x063c('0x5')]('preview',_0x063c('0x20'),'power',_0x063c('0x21'),_0x063c('0x11')),'defaultValue':_0x063c('0x20'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x063c('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x063c('0x23')},'dialLimitQueue':{'type':Sequelize[_0x063c('0x12')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x063c('0x24')},'dialPowerLevel':{'type':Sequelize[_0x063c('0x25')](0x2)[_0x063c('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x063c('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x27'),_0x063c('0x28')),'defaultValue':'dropRate','comment':_0x063c('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x063c('0x25')](0x2)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x063c('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x063c('0x13')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x063c('0x13')]},'dialOriginateTimeout':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x063c('0x13')],'defaultValue':'tTxX','comment':_0x063c('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x2d')},'dialQueueProject':{'type':Sequelize[_0x063c('0x13')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'comment':_0x063c('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x063c('0x13')],'defaultValue':_0x063c('0x33')},'dialPrefix':{'type':Sequelize[_0x063c('0x13')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x063c('0x34'),'never',_0x063c('0x35')),'defaultValue':_0x063c('0x34')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x063c('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x063c('0x12')](0x9)[_0x063c('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x063c('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x063c('0x12')](0x9)[_0x063c('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x063c('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x063c('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x063c('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x063c('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x063c('0x12')](0x9)[_0x063c('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x063c('0x12')](0x9)[_0x063c('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x063c('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x063c('0x12')](0x9)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x063c('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x063c('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x063c('0x3c')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x063c('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':0x0,'comment':_0x063c('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x063c('0x5')]('DESC',_0x063c('0x3f')),'defaultValue':_0x063c('0x40')},'dialQueueProject2':{'type':Sequelize[_0x063c('0x13')],'comment':_0x063c('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x063c('0x42')},'dialCutDigit':{'type':Sequelize[_0x063c('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x063c('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x063c('0x12')],'allowNull':!![],'comment':_0x063c('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':![],'comment':_0x063c('0x4d'),'set':function(_0x5e7d71){if(!_0x5e7d71)this[_0x063c('0xc')]('mandatoryDispositionPauseId',null);this[_0x063c('0xc')]('mandatoryDisposition',_0x5e7d71);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x063c('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 128d2d9..ce521e1 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 _0x39d2=['userVoiceQueue:remove','addAgents','ids','spread','push','isNil','removeAgents','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','scheduledAt','ContactId','phone','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','CmListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','OrderBy','ci.item','ci.OrderBy+1','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','VoiceQueues','outbound','ignore','includes','type','find','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceQueue','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','catch','params','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','value','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','createdAt','updatedAt','omit','QueueCampaigns','getHoppers','findOne','CmHopper','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','User','Agents','online','flatMap','forEach','penalty','TeamVoiceQueue','findOrCreate','each','UserVoiceQueueRt','upsert','interface','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','sequelize','toString','SELECT','every','all','compact','transaction','isEmpty'];(function(_0x160f00,_0x3d0338){var _0x2cd66a=function(_0x10bf67){while(--_0x10bf67){_0x160f00['push'](_0x160f00['shift']());}};_0x2cd66a(++_0x3d0338);}(_0x39d2,0xf5));var _0x239d=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x39d2[_0x421cf8];return _0x145c48;};'use strict';var emlformat=require(_0x239d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x239d('0x1'));var jsonpatch=require(_0x239d('0x2'));var rp=require(_0x239d('0x3'));var moment=require(_0x239d('0x4'));var BPromise=require(_0x239d('0x5'));var Mustache=require(_0x239d('0x6'));var util=require(_0x239d('0x7'));var path=require(_0x239d('0x8'));var sox=require(_0x239d('0x9'));var csv=require(_0x239d('0xa'));var ejs=require(_0x239d('0xb'));var fs=require('fs');var fs_extra=require(_0x239d('0xc'));var _=require(_0x239d('0xd'));var squel=require('squel');var crypto=require(_0x239d('0xe'));var jsforce=require(_0x239d('0xf'));var deskjs=require(_0x239d('0x10'));var toCsv=require(_0x239d('0xa'));var querystring=require(_0x239d('0x11'));var Papa=require(_0x239d('0x12'));var Redis=require(_0x239d('0x13'));var authService=require(_0x239d('0x14'));var qs=require(_0x239d('0x15'));var as=require(_0x239d('0x16'));var hardwareService=require(_0x239d('0x17'));var logger=require(_0x239d('0x18'))(_0x239d('0x19'));var utils=require(_0x239d('0x1a'));var config=require(_0x239d('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x239d('0x1c')]=_[_0x239d('0x1d')](config[_0x239d('0x1c')],{'host':_0x239d('0x1e'),'port':0x18eb});var socket=require(_0x239d('0x1f'))(new Redis(config[_0x239d('0x1c')]));require(_0x239d('0x20'))[_0x239d('0x21')](socket);function respondWithStatusCode(_0x269134,_0x5506b5){_0x5506b5=_0x5506b5||0xcc;return function(_0x27303b){if(_0x27303b){return _0x269134[_0x239d('0x22')](_0x5506b5);}return _0x269134[_0x239d('0x23')](_0x5506b5)[_0x239d('0x24')]();};}function respondWithResult(_0x132915,_0x4d1d18){_0x4d1d18=_0x4d1d18||0xc8;return function(_0x5e9e0e){if(_0x5e9e0e){return _0x132915[_0x239d('0x23')](_0x4d1d18)['json'](_0x5e9e0e);}};}function respondWithFilteredResult(_0x1b62eb,_0x47bec3){return function(_0x33f01d){if(_0x33f01d){var _0x39627f=typeof _0x47bec3[_0x239d('0x25')]===_0x239d('0x26')&&typeof _0x47bec3[_0x239d('0x27')]===_0x239d('0x26');var _0x2b1130=_0x33f01d[_0x239d('0x28')];var _0x49b100=_0x39627f?0x0:_0x47bec3[_0x239d('0x25')];var _0x4ef1a0=_0x39627f?_0x33f01d[_0x239d('0x28')]:_0x47bec3[_0x239d('0x25')]+_0x47bec3[_0x239d('0x27')];var _0x5abe81;if(_0x4ef1a0>=_0x2b1130){_0x4ef1a0=_0x2b1130;_0x5abe81=0xc8;}else{_0x5abe81=0xce;}_0x1b62eb[_0x239d('0x23')](_0x5abe81);return _0x1b62eb[_0x239d('0x29')](_0x239d('0x2a'),_0x49b100+'-'+_0x4ef1a0+'/'+_0x2b1130)[_0x239d('0x2b')](_0x33f01d);}return null;};}function patchUpdates(_0xb77bfe){return function(_0xc2c8da){try{jsonpatch[_0x239d('0x2c')](_0xc2c8da,_0xb77bfe,!![]);}catch(_0x2b8ad0){return BPromise[_0x239d('0x2d')](_0x2b8ad0);}return _0xc2c8da['save']();};}function saveUpdates(_0x13131e,_0x46e66f){return function(_0x1d8be6){if(_0x1d8be6){return _0x1d8be6[_0x239d('0x2e')](_0x13131e)[_0x239d('0x2f')](function(_0x72802){return _0x72802;});}return null;};}function removeEntity(_0xe97415,_0x281f57){return function(_0x44947c){if(_0x44947c){return _0x44947c['destroy']()[_0x239d('0x2f')](function(){var _0x395cc4=_0x44947c['get']({'plain':!![]});var _0x4e3a77=[{'name':_0x239d('0x30'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x239d('0x31'),'ignore':![]}];var _0x1ba3a0=_(_0x4e3a77)['filter'](_0x239d('0x32'))['map']('value')['value']();if(_[_0x239d('0x33')](_0x1ba3a0,_0x395cc4[_0x239d('0x34')])){return;}var _0x19bd2e=_[_0x239d('0x35')](_0x4e3a77,['value',_0x395cc4['type']])['name'];return db[_0x239d('0x36')][_0x239d('0x37')]({'where':{'type':_0x19bd2e,'resourceId':_0x395cc4['id']}})[_0x239d('0x2f')](function(){return _0x44947c;});})[_0x239d('0x2f')](function(){_0xe97415['status'](0xcc)[_0x239d('0x24')]();});}};}function handleEntityNotFound(_0x17c909,_0x384469){return function(_0x2c3927){if(!_0x2c3927){_0x17c909[_0x239d('0x22')](0x194);}return _0x2c3927;};}function handleError(_0x5bdba6,_0x3ab632){_0x3ab632=_0x3ab632||0x1f4;return function(_0x30e59f){logger[_0x239d('0x38')](_0x30e59f[_0x239d('0x39')]);if(_0x30e59f[_0x239d('0x3a')]){delete _0x30e59f[_0x239d('0x3a')];}_0x5bdba6[_0x239d('0x23')](_0x3ab632)[_0x239d('0x3b')](_0x30e59f);};}exports[_0x239d('0x3c')]=function(_0x6c73fc,_0x2f6c73){var _0x257d21={},_0x4a3725={},_0x162048={'count':0x0,'rows':[]};var _0x260eb2=_[_0x239d('0x3d')](db[_0x239d('0x3e')][_0x239d('0x3f')],function(_0x1b29ed){return{'name':_0x1b29ed['fieldName'],'type':_0x1b29ed[_0x239d('0x34')]['key']};});_0x4a3725[_0x239d('0x40')]=_[_0x239d('0x3d')](_0x260eb2,'name');_0x4a3725[_0x239d('0x41')]=_[_0x239d('0x42')](_0x6c73fc[_0x239d('0x41')]);_0x4a3725[_0x239d('0x43')]=_['intersection'](_0x4a3725['model'],_0x4a3725[_0x239d('0x41')]);_0x257d21[_0x239d('0x44')]=_[_0x239d('0x45')](_0x4a3725[_0x239d('0x40')],qs[_0x239d('0x46')](_0x6c73fc['query']['fields']));_0x257d21[_0x239d('0x44')]=_0x257d21['attributes'][_0x239d('0x47')]?_0x257d21['attributes']:_0x4a3725[_0x239d('0x40')];if(!_0x6c73fc['query'][_0x239d('0x48')](_0x239d('0x49'))){_0x257d21[_0x239d('0x27')]=qs[_0x239d('0x27')](_0x6c73fc['query'][_0x239d('0x27')]);_0x257d21[_0x239d('0x25')]=qs[_0x239d('0x25')](_0x6c73fc[_0x239d('0x41')][_0x239d('0x25')]);}_0x257d21[_0x239d('0x4a')]=qs[_0x239d('0x4b')](_0x6c73fc['query'][_0x239d('0x4b')]);_0x257d21[_0x239d('0x4c')]=qs[_0x239d('0x43')](_[_0x239d('0x4d')](_0x6c73fc[_0x239d('0x41')],_0x4a3725[_0x239d('0x43')]),_0x260eb2);if(_0x6c73fc[_0x239d('0x41')][_0x239d('0x4e')]){_0x257d21[_0x239d('0x4c')]=_[_0x239d('0x4f')](_0x257d21['where'],{'$or':_[_0x239d('0x3d')](_0x260eb2,function(_0x5b9082){if(_0x5b9082[_0x239d('0x34')]!=='VIRTUAL'){var _0x1734c4={};_0x1734c4[_0x5b9082[_0x239d('0x3a')]]={'$like':'%'+_0x6c73fc[_0x239d('0x41')][_0x239d('0x4e')]+'%'};return _0x1734c4;}})});}_0x257d21=_[_0x239d('0x4f')]({},_0x257d21,_0x6c73fc['options']);var _0x495d33={'where':_0x257d21[_0x239d('0x4c')]};return db[_0x239d('0x3e')][_0x239d('0x28')](_0x495d33)[_0x239d('0x2f')](function(_0x4c7d4e){_0x162048[_0x239d('0x28')]=_0x4c7d4e;if(_0x6c73fc[_0x239d('0x41')][_0x239d('0x50')]){_0x257d21['include']=[{'all':!![]}];}return db[_0x239d('0x3e')][_0x239d('0x51')](_0x257d21);})[_0x239d('0x2f')](function(_0x2643ae){_0x162048['rows']=_0x2643ae;return _0x162048;})[_0x239d('0x2f')](respondWithFilteredResult(_0x2f6c73,_0x257d21))[_0x239d('0x52')](handleError(_0x2f6c73,null));};exports['show']=function(_0x4abb23,_0x4e039a){var _0x220723={'raw':![],'where':{'id':_0x4abb23[_0x239d('0x53')]['id']}},_0x2b50c0={};_0x2b50c0[_0x239d('0x40')]=_['keys'](db['VoiceQueue'][_0x239d('0x3f')]);_0x2b50c0[_0x239d('0x41')]=_['keys'](_0x4abb23[_0x239d('0x41')]);_0x2b50c0[_0x239d('0x43')]=_['intersection'](_0x2b50c0[_0x239d('0x40')],_0x2b50c0[_0x239d('0x41')]);_0x220723[_0x239d('0x44')]=_['intersection'](_0x2b50c0[_0x239d('0x40')],qs[_0x239d('0x46')](_0x4abb23['query']['fields']));_0x220723[_0x239d('0x44')]=_0x220723['attributes'][_0x239d('0x47')]?_0x220723[_0x239d('0x44')]:_0x2b50c0[_0x239d('0x40')];if(_0x4abb23[_0x239d('0x41')][_0x239d('0x50')]){_0x220723['include']=[{'all':!![]}];}_0x220723=_['merge']({},_0x220723,_0x4abb23[_0x239d('0x54')]);return db['VoiceQueue'][_0x239d('0x35')](_0x220723)[_0x239d('0x2f')](handleEntityNotFound(_0x4e039a,null))[_0x239d('0x2f')](respondWithResult(_0x4e039a,null))[_0x239d('0x52')](handleError(_0x4e039a,null));};exports[_0x239d('0x55')]=function(_0x431093,_0x528542){return db[_0x239d('0x3e')][_0x239d('0x55')](_0x431093[_0x239d('0x56')],{})[_0x239d('0x2f')](function(_0x3b6477){var _0x559db1=_0x431093['user'][_0x239d('0x57')]({'plain':!![]});if(!_0x559db1)throw new Error(_0x239d('0x58'));if(_0x559db1[_0x239d('0x59')]===_0x239d('0x5a')){var _0x401fd0=_0x3b6477[_0x239d('0x57')]({'plain':!![]});var _0x3d5313=[{'name':_0x239d('0x30'),'value':_0x239d('0x5b')},{'name':'QueueCampaigns','value':_0x239d('0x31')}];var _0x4d762f=_[_0x239d('0x35')](_0x3d5313,[_0x239d('0x5c'),_0x401fd0[_0x239d('0x34')]])[_0x239d('0x3a')];return db[_0x239d('0x5d')][_0x239d('0x35')]({'where':{'name':_0x4d762f,'userProfileId':_0x559db1[_0x239d('0x5e')]},'raw':!![]})['then'](function(_0x46b162){if(_0x46b162&&_0x46b162[_0x239d('0x5f')]===0x0){return db[_0x239d('0x36')][_0x239d('0x55')]({'name':_0x401fd0[_0x239d('0x3a')],'resourceId':_0x401fd0['id'],'type':_0x46b162['name'],'sectionId':_0x46b162['id']},{})[_0x239d('0x2f')](function(){return _0x3b6477;});}else{return _0x3b6477;}})[_0x239d('0x52')](function(_0x2eb35e){logger[_0x239d('0x38')](_0x239d('0x60'),_0x2eb35e);throw _0x2eb35e;});}return _0x3b6477;})[_0x239d('0x2f')](respondWithResult(_0x528542,0xc9))['catch'](handleError(_0x528542,null));};exports[_0x239d('0x61')]=function(_0x1629be,_0x16b0b3){var _0x29890d={'where':{'id':_0x1629be[_0x239d('0x53')]['id']}},_0x119cbb={};_0x119cbb[_0x239d('0x40')]=_[_0x239d('0x42')](db[_0x239d('0x3e')][_0x239d('0x3f')]);_0x29890d['attributes']=_[_0x239d('0x45')](_0x119cbb[_0x239d('0x40')],qs[_0x239d('0x46')](_0x1629be['query'][_0x239d('0x46')]));_0x29890d[_0x239d('0x44')]=_0x29890d[_0x239d('0x44')]['length']?_0x29890d[_0x239d('0x44')]:_0x119cbb[_0x239d('0x40')];if(_0x1629be['query'][_0x239d('0x50')]){_0x29890d[_0x239d('0x62')]=[{'all':!![]}];}_0x29890d=_[_0x239d('0x4f')]({},_0x29890d,_0x1629be[_0x239d('0x54')]);return db[_0x239d('0x3e')][_0x239d('0x35')](_0x29890d)['then'](handleEntityNotFound(_0x16b0b3,null))[_0x239d('0x2f')](function(_0x5b4d11){if(_0x5b4d11){var _0x15a3ef=_0x5b4d11['get']({'plain':!![]});_0x15a3ef=qs['omit'](_0x15a3ef,['id',_0x239d('0x63'),_0x239d('0x64')]);_0x1629be[_0x239d('0x56')]=_[_0x239d('0x65')](_0x1629be[_0x239d('0x56')],['id',_0x239d('0x63'),_0x239d('0x64')]);return db[_0x239d('0x3e')][_0x239d('0x55')](_[_0x239d('0x4f')](_0x15a3ef,_0x1629be['body']),{'include':_0x1629be[_0x239d('0x41')][_0x239d('0x50')]?[{'all':!![]}]:undefined})[_0x239d('0x2f')](function(_0xf0073a){var _0x5331bc=_0x1629be[_0x239d('0x5a')][_0x239d('0x57')]({'plain':!![]});if(!_0x5331bc)throw new Error(_0x239d('0x58'));if(_0x5331bc[_0x239d('0x59')]===_0x239d('0x5a')){var _0x1a3526=_0xf0073a[_0x239d('0x57')]({'plain':!![]});var _0x5a677b=[{'name':_0x239d('0x30'),'value':'inbound'},{'name':_0x239d('0x66'),'value':'outbound'}];var _0x427001=_[_0x239d('0x35')](_0x5a677b,[_0x239d('0x5c'),_0x1a3526[_0x239d('0x34')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x427001,'userProfileId':_0x5331bc[_0x239d('0x5e')]},'raw':!![]})[_0x239d('0x2f')](function(_0x5c818f){if(_0x5c818f&&_0x5c818f['autoAssociation']===0x0){return db[_0x239d('0x36')]['create']({'name':_0x1a3526[_0x239d('0x3a')],'resourceId':_0x1a3526['id'],'type':_0x5c818f['name'],'sectionId':_0x5c818f['id']},{})[_0x239d('0x2f')](function(){return _0xf0073a;});}else{return _0xf0073a;}})['catch'](function(_0x1eb570){logger['error'](_0x239d('0x60'),_0x1eb570);throw _0x1eb570;});}return _0xf0073a;});}})[_0x239d('0x2f')](respondWithResult(_0x16b0b3,0xc9))[_0x239d('0x52')](handleError(_0x16b0b3,null));};exports[_0x239d('0x2e')]=function(_0x495bac,_0x2eb626){if(_0x495bac[_0x239d('0x56')]['id']){delete _0x495bac[_0x239d('0x56')]['id'];}return db[_0x239d('0x3e')][_0x239d('0x35')]({'where':{'id':_0x495bac['params']['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0x2eb626,null))[_0x239d('0x2f')](saveUpdates(_0x495bac['body'],null))[_0x239d('0x2f')](respondWithResult(_0x2eb626,null))[_0x239d('0x52')](handleError(_0x2eb626,null));};exports['destroy']=function(_0x19cf97,_0xba8512){return db[_0x239d('0x3e')][_0x239d('0x35')]({'where':{'id':_0x19cf97['params']['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0xba8512,null))['then'](removeEntity(_0xba8512,null))['catch'](handleError(_0xba8512,null));};exports[_0x239d('0x67')]=function(_0x391f9f,_0x5dac81,_0x44de7c){var _0x3c9458={'raw':![],'where':{}};var _0x4d4a05={};var _0x5821ce={'count':0x0,'rows':[]};return db[_0x239d('0x3e')][_0x239d('0x68')]({'where':{'id':_0x391f9f[_0x239d('0x53')]['id']}})['then'](handleEntityNotFound(_0x5dac81,null))[_0x239d('0x2f')](function(_0x3e3bb8){if(_0x3e3bb8){_0x4d4a05[_0x239d('0x40')]=_[_0x239d('0x42')](db[_0x239d('0x69')][_0x239d('0x3f')]);_0x4d4a05[_0x239d('0x41')]=_[_0x239d('0x42')](_0x391f9f[_0x239d('0x41')]);_0x4d4a05[_0x239d('0x43')]=_['intersection'](_0x4d4a05[_0x239d('0x40')],_0x4d4a05[_0x239d('0x41')]);_0x3c9458[_0x239d('0x44')]=_[_0x239d('0x45')](_0x4d4a05[_0x239d('0x40')],qs[_0x239d('0x46')](_0x391f9f[_0x239d('0x41')][_0x239d('0x46')]));_0x3c9458[_0x239d('0x44')]=_0x3c9458[_0x239d('0x44')][_0x239d('0x47')]?_0x3c9458[_0x239d('0x44')]:_0x4d4a05[_0x239d('0x40')];if(!_0x391f9f[_0x239d('0x41')][_0x239d('0x48')]('nolimit')){_0x3c9458['limit']=qs[_0x239d('0x27')](_0x391f9f[_0x239d('0x41')][_0x239d('0x27')]);_0x3c9458[_0x239d('0x25')]=qs[_0x239d('0x25')](_0x391f9f[_0x239d('0x41')][_0x239d('0x25')]);}_0x3c9458['order']=qs[_0x239d('0x4b')](_0x391f9f[_0x239d('0x41')][_0x239d('0x4b')]);_0x3c9458[_0x239d('0x4c')]=qs['filters'](_[_0x239d('0x4d')](_0x391f9f[_0x239d('0x41')],_0x4d4a05['filters']));_0x3c9458[_0x239d('0x4c')]['VoiceQueueId']=_0x3e3bb8['id'];if(_0x391f9f[_0x239d('0x41')][_0x239d('0x4e')]){_0x3c9458[_0x239d('0x4c')]=_[_0x239d('0x4f')](_0x3c9458['where'],{'$or':_[_0x239d('0x3d')](_0x3c9458[_0x239d('0x44')],function(_0x58a4a0){var _0x258499={};_0x258499[_0x58a4a0]={'$like':'%'+_0x391f9f[_0x239d('0x41')][_0x239d('0x4e')]+'%'};return _0x258499;})});}_0x3c9458=_[_0x239d('0x4f')]({},_0x3c9458,_0x391f9f[_0x239d('0x54')]);return db[_0x239d('0x69')][_0x239d('0x28')]({'where':_0x3c9458['where']})[_0x239d('0x2f')](function(_0x55438a){_0x5821ce[_0x239d('0x28')]=_0x55438a;if(_0x391f9f[_0x239d('0x41')]['includeAll']){_0x3c9458[_0x239d('0x62')]=[{'all':!![]}];}return db[_0x239d('0x69')]['findAll'](_0x3c9458);})[_0x239d('0x2f')](function(_0x10f53c){_0x5821ce['rows']=_0x10f53c;return _0x5821ce;});}})[_0x239d('0x2f')](respondWithFilteredResult(_0x5dac81,_0x3c9458))['catch'](handleError(_0x5dac81,null));};exports['getHopperHistories']=function(_0x3a8496,_0x3da31a,_0x10719c){var _0x17fa54={'raw':!![],'where':{}};var _0x1b4e78={};var _0x38c8fb={'count':0x0,'rows':[]};return db[_0x239d('0x3e')]['findOne']({'where':{'id':_0x3a8496[_0x239d('0x53')]['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0x3da31a,null))[_0x239d('0x2f')](function(_0x48a735){if(_0x48a735){_0x1b4e78[_0x239d('0x40')]=_[_0x239d('0x42')](db[_0x239d('0x6a')]['rawAttributes']);_0x1b4e78[_0x239d('0x41')]=_['keys'](_0x3a8496[_0x239d('0x41')]);_0x1b4e78[_0x239d('0x43')]=_[_0x239d('0x45')](_0x1b4e78['model'],_0x1b4e78[_0x239d('0x41')]);_0x17fa54[_0x239d('0x44')]=_[_0x239d('0x45')](_0x1b4e78[_0x239d('0x40')],qs[_0x239d('0x46')](_0x3a8496['query'][_0x239d('0x46')]));_0x17fa54['attributes']=_0x17fa54[_0x239d('0x44')][_0x239d('0x47')]?_0x17fa54[_0x239d('0x44')]:_0x1b4e78[_0x239d('0x40')];if(!_0x3a8496[_0x239d('0x41')]['hasOwnProperty'](_0x239d('0x49'))){_0x17fa54[_0x239d('0x27')]=qs[_0x239d('0x27')](_0x3a8496[_0x239d('0x41')][_0x239d('0x27')]);_0x17fa54['offset']=qs['offset'](_0x3a8496[_0x239d('0x41')][_0x239d('0x25')]);}_0x17fa54[_0x239d('0x4a')]=qs['sort'](_0x3a8496[_0x239d('0x41')]['sort']);_0x17fa54[_0x239d('0x4c')]=qs[_0x239d('0x43')](_[_0x239d('0x4d')](_0x3a8496[_0x239d('0x41')],_0x1b4e78[_0x239d('0x43')]));_0x17fa54[_0x239d('0x4c')]['VoiceQueueId']=_0x48a735['id'];if(_0x3a8496[_0x239d('0x41')][_0x239d('0x4e')]){_0x17fa54['where']=_[_0x239d('0x4f')](_0x17fa54[_0x239d('0x4c')],{'$or':_[_0x239d('0x3d')](_0x17fa54[_0x239d('0x44')],function(_0x2bc193){var _0x1a2534={};_0x1a2534[_0x2bc193]={'$like':'%'+_0x3a8496[_0x239d('0x41')][_0x239d('0x4e')]+'%'};return _0x1a2534;})});}_0x17fa54=_[_0x239d('0x4f')]({},_0x17fa54,_0x3a8496[_0x239d('0x54')]);return db[_0x239d('0x6a')][_0x239d('0x28')]({'where':_0x17fa54[_0x239d('0x4c')]})[_0x239d('0x2f')](function(_0x4b6c41){_0x38c8fb[_0x239d('0x28')]=_0x4b6c41;if(_0x3a8496[_0x239d('0x41')]['includeAll']){_0x17fa54[_0x239d('0x62')]=[{'all':!![]}];}return db[_0x239d('0x6a')][_0x239d('0x51')](_0x17fa54);})[_0x239d('0x2f')](function(_0x3484a1){_0x38c8fb[_0x239d('0x6b')]=_0x3484a1;return _0x38c8fb;});}})[_0x239d('0x2f')](respondWithFilteredResult(_0x3da31a,_0x17fa54))[_0x239d('0x52')](handleError(_0x3da31a,null));};exports[_0x239d('0x6c')]=function(_0x3af37f,_0xb351f8,_0x3c554c){var _0x3bbc3b={'raw':!![],'where':{}};var _0x32b87a={};var _0x293b85={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3af37f['params']['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0xb351f8,null))['then'](function(_0x16858e){if(_0x16858e){_0x32b87a[_0x239d('0x40')]=_[_0x239d('0x42')](db[_0x239d('0x6d')][_0x239d('0x3f')]);_0x32b87a[_0x239d('0x41')]=_[_0x239d('0x42')](_0x3af37f[_0x239d('0x41')]);_0x32b87a[_0x239d('0x43')]=_[_0x239d('0x45')](_0x32b87a[_0x239d('0x40')],_0x32b87a[_0x239d('0x41')]);_0x3bbc3b['attributes']=_[_0x239d('0x45')](_0x32b87a[_0x239d('0x40')],qs['fields'](_0x3af37f['query'][_0x239d('0x46')]));_0x3bbc3b[_0x239d('0x44')]=_0x3bbc3b[_0x239d('0x44')]['length']?_0x3bbc3b[_0x239d('0x44')]:_0x32b87a['model'];if(!_0x3af37f[_0x239d('0x41')]['hasOwnProperty']('nolimit')){_0x3bbc3b[_0x239d('0x27')]=qs[_0x239d('0x27')](_0x3af37f['query'][_0x239d('0x27')]);_0x3bbc3b[_0x239d('0x25')]=qs[_0x239d('0x25')](_0x3af37f[_0x239d('0x41')][_0x239d('0x25')]);}_0x3bbc3b['order']=qs['sort'](_0x3af37f['query'][_0x239d('0x4b')]);_0x3bbc3b[_0x239d('0x4c')]=qs[_0x239d('0x43')](_[_0x239d('0x4d')](_0x3af37f[_0x239d('0x41')],_0x32b87a[_0x239d('0x43')]));_0x3bbc3b[_0x239d('0x4c')][_0x239d('0x6e')]=_0x16858e['id'];if(_0x3af37f[_0x239d('0x41')]['filter']){_0x3bbc3b['where']=_[_0x239d('0x4f')](_0x3bbc3b[_0x239d('0x4c')],{'$or':_[_0x239d('0x3d')](_0x3bbc3b[_0x239d('0x44')],function(_0x470e15){var _0x4fbb14={};_0x4fbb14[_0x470e15]={'$like':'%'+_0x3af37f[_0x239d('0x41')]['filter']+'%'};return _0x4fbb14;})});}_0x3bbc3b=_[_0x239d('0x4f')]({},_0x3bbc3b,_0x3af37f['options']);return db['CmHopperFinal'][_0x239d('0x28')]({'where':_0x3bbc3b['where']})[_0x239d('0x2f')](function(_0x57b4e7){_0x293b85['count']=_0x57b4e7;if(_0x3af37f[_0x239d('0x41')][_0x239d('0x50')]){_0x3bbc3b[_0x239d('0x62')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x239d('0x51')](_0x3bbc3b);})[_0x239d('0x2f')](function(_0x44419b){_0x293b85[_0x239d('0x6b')]=_0x44419b;return _0x293b85;});}})['then'](respondWithFilteredResult(_0xb351f8,_0x3bbc3b))[_0x239d('0x52')](handleError(_0xb351f8,null));};exports[_0x239d('0x6f')]=function(_0x497618,_0x2983e8,_0x2d88b8){var _0x8a26c0={'raw':!![],'where':{}};var _0x29219d={};var _0x10a688={'count':0x0,'rows':[]};return db[_0x239d('0x3e')]['findOne']({'where':{'id':_0x497618[_0x239d('0x53')]['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0x2983e8,null))[_0x239d('0x2f')](function(_0x32b580){if(_0x32b580){_0x29219d['model']=_[_0x239d('0x42')](db[_0x239d('0x70')][_0x239d('0x3f')]);_0x29219d['query']=_[_0x239d('0x42')](_0x497618[_0x239d('0x41')]);_0x29219d['filters']=_[_0x239d('0x45')](_0x29219d[_0x239d('0x40')],_0x29219d[_0x239d('0x41')]);_0x8a26c0[_0x239d('0x44')]=_[_0x239d('0x45')](_0x29219d[_0x239d('0x40')],qs[_0x239d('0x46')](_0x497618['query'][_0x239d('0x46')]));_0x8a26c0[_0x239d('0x44')]=_0x8a26c0['attributes']['length']?_0x8a26c0[_0x239d('0x44')]:_0x29219d['model'];if(!_0x497618[_0x239d('0x41')]['hasOwnProperty'](_0x239d('0x49'))){_0x8a26c0[_0x239d('0x27')]=qs[_0x239d('0x27')](_0x497618['query']['limit']);_0x8a26c0[_0x239d('0x25')]=qs[_0x239d('0x25')](_0x497618['query'][_0x239d('0x25')]);}_0x8a26c0['order']=qs[_0x239d('0x4b')](_0x497618['query']['sort']);_0x8a26c0[_0x239d('0x4c')]=qs[_0x239d('0x43')](_[_0x239d('0x4d')](_0x497618['query'],_0x29219d[_0x239d('0x43')]));_0x8a26c0[_0x239d('0x4c')]['VoiceQueueId']=_0x32b580['id'];if(_0x497618[_0x239d('0x41')]['filter']){_0x8a26c0[_0x239d('0x4c')]=_['merge'](_0x8a26c0['where'],{'$or':_[_0x239d('0x3d')](_0x8a26c0[_0x239d('0x44')],function(_0x5bfc08){var _0x14ee7d={};_0x14ee7d[_0x5bfc08]={'$like':'%'+_0x497618['query'][_0x239d('0x4e')]+'%'};return _0x14ee7d;})});}_0x8a26c0=_[_0x239d('0x4f')]({},_0x8a26c0,_0x497618[_0x239d('0x54')]);return db[_0x239d('0x70')][_0x239d('0x28')]({'where':_0x8a26c0[_0x239d('0x4c')]})[_0x239d('0x2f')](function(_0x44d1bc){_0x10a688[_0x239d('0x28')]=_0x44d1bc;if(_0x497618[_0x239d('0x41')][_0x239d('0x50')]){_0x8a26c0[_0x239d('0x62')]=[{'all':!![]}];}return db[_0x239d('0x70')][_0x239d('0x51')](_0x8a26c0);})[_0x239d('0x2f')](function(_0x459d5d){_0x10a688[_0x239d('0x6b')]=_0x459d5d;return _0x10a688;});}})[_0x239d('0x2f')](respondWithFilteredResult(_0x2983e8,_0x8a26c0))['catch'](handleError(_0x2983e8,null));};exports['getTeams']=function(_0x92db5e,_0x42648e,_0x3f9b1a){var _0x38a895={};var _0x15cfac={};var _0x475773;var _0x219f20;return db['VoiceQueue'][_0x239d('0x68')]({'where':{'id':_0x92db5e[_0x239d('0x53')]['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0x42648e,null))[_0x239d('0x2f')](function(_0x23307f){if(_0x23307f){_0x475773=_0x23307f;_0x15cfac[_0x239d('0x40')]=_[_0x239d('0x42')](db[_0x239d('0x71')][_0x239d('0x3f')]);_0x15cfac['query']=_[_0x239d('0x42')](_0x92db5e[_0x239d('0x41')]);_0x15cfac['filters']=_[_0x239d('0x45')](_0x15cfac[_0x239d('0x40')],_0x15cfac[_0x239d('0x41')]);_0x38a895[_0x239d('0x44')]=_[_0x239d('0x45')](_0x15cfac[_0x239d('0x40')],qs[_0x239d('0x46')](_0x92db5e[_0x239d('0x41')][_0x239d('0x46')]));_0x38a895[_0x239d('0x44')]=_0x38a895[_0x239d('0x44')]['length']?_0x38a895[_0x239d('0x44')]:_0x15cfac[_0x239d('0x40')];_0x38a895[_0x239d('0x4a')]=qs[_0x239d('0x4b')](_0x92db5e[_0x239d('0x41')][_0x239d('0x4b')]);_0x38a895[_0x239d('0x4c')]=qs[_0x239d('0x43')](_[_0x239d('0x4d')](_0x92db5e[_0x239d('0x41')],_0x15cfac[_0x239d('0x43')]));if(_0x92db5e['query'][_0x239d('0x4e')]){_0x38a895[_0x239d('0x4c')]=_[_0x239d('0x4f')](_0x38a895['where'],{'$or':_[_0x239d('0x3d')](_0x38a895['attributes'],function(_0x5aee06){var _0x171bd6={};_0x171bd6[_0x5aee06]={'$like':'%'+_0x92db5e[_0x239d('0x41')][_0x239d('0x4e')]+'%'};return _0x171bd6;})});}_0x38a895=_[_0x239d('0x4f')]({},_0x38a895,_0x92db5e[_0x239d('0x54')]);return _0x475773[_0x239d('0x72')](_0x38a895);}})['then'](function(_0x2b7dbf){if(_0x2b7dbf){_0x219f20=_0x2b7dbf[_0x239d('0x47')];if(!_0x92db5e['query'][_0x239d('0x48')]('nolimit')){_0x38a895[_0x239d('0x27')]=qs[_0x239d('0x27')](_0x92db5e[_0x239d('0x41')][_0x239d('0x27')]);_0x38a895[_0x239d('0x25')]=qs[_0x239d('0x25')](_0x92db5e[_0x239d('0x41')]['offset']);}return _0x475773['getTeams'](_0x38a895);}})[_0x239d('0x2f')](function(_0x4c54b5){if(_0x4c54b5){return _0x4c54b5?{'count':_0x219f20,'rows':_0x4c54b5}:null;}})['then'](respondWithResult(_0x42648e,null))[_0x239d('0x52')](handleError(_0x42648e,null));};exports[_0x239d('0x73')]=function(_0x300d33,_0x374550,_0x3d5bc3){var _0x490c9c=_0x300d33[_0x239d('0x56')][_0x239d('0x74')];var _0x5509cc=_[_0x239d('0x3d')](_0x490c9c,'id');return db[_0x239d('0x71')][_0x239d('0x51')]({'where':{'id':_0x5509cc},'attributes':['id'],'include':[{'model':db[_0x239d('0x75')],'as':_0x239d('0x76'),'attributes':['id',_0x239d('0x3a'),_0x239d('0x77'),'voicePause','interface'],'raw':!![]}]})[_0x239d('0x2f')](function(_0x2ed9b2){if(_0x2ed9b2){var _0x36c1d8=_[_0x239d('0x78')](_0x2ed9b2,function(_0x34dbed){var _0x378466=_0x34dbed[_0x239d('0x57')]({'plain':!![]});_0x378466[_0x239d('0x76')][_0x239d('0x79')](function(_0x2c00db){_0x2c00db[_0x239d('0x7a')]=_['find'](_0x490c9c,{'id':_0x378466['id']})[_0x239d('0x7a')];});return _0x378466[_0x239d('0x76')];});return db[_0x239d('0x3e')][_0x239d('0x35')]({'where':{'id':_0x300d33[_0x239d('0x53')]['id']}})[_0x239d('0x2f')](function(_0x47e205){return db['sequelize']['transaction'](function(_0x1939cf){return _0x47e205['addTeams'](_0x5509cc,{'transaction':_0x1939cf})[_0x239d('0x2f')](function(){return BPromise['each'](_0x490c9c,function(_0x20daea){return db[_0x239d('0x7b')]['upsert']({'TeamId':_0x20daea['id'],'VoiceQueueId':_0x300d33[_0x239d('0x53')]['id'],'penalty':_0x20daea[_0x239d('0x7a')]},{'transaction':_0x1939cf});});})[_0x239d('0x2f')](function(){return BPromise['each'](_0x36c1d8,function(_0x1666f3){return db['UserVoiceQueue'][_0x239d('0x7c')]({'where':{'UserId':_0x1666f3['id'],'VoiceQueueId':_0x300d33[_0x239d('0x53')]['id']},'defaults':{'penalty':_0x1666f3[_0x239d('0x7a')]},'transaction':_0x1939cf});});})[_0x239d('0x2f')](function(){return BPromise[_0x239d('0x7d')](_['filter'](_0x36c1d8,{'online':!![]}),function(_0x37d40e){return db[_0x239d('0x7e')][_0x239d('0x7f')]({'membername':_0x37d40e[_0x239d('0x3a')],'UserId':_0x37d40e['id'],'queue_name':_0x47e205[_0x239d('0x3a')],'VoiceQueueId':_0x47e205['id'],'interface':_['isNil'](_0x37d40e[_0x239d('0x80')])?util[_0x239d('0x81')](_0x239d('0x82'),_0x37d40e[_0x239d('0x3a')]):_0x37d40e['interface'],'paused':_0x37d40e[_0x239d('0x83')]||![],'penalty':_0x37d40e[_0x239d('0x7a')]},{'transaction':_0x1939cf});});})['then'](function(){_0x36c1d8['forEach'](function(_0x310b93){socket[_0x239d('0x84')](_0x239d('0x85'),{'UserId':_0x310b93['id'],'VoiceQueueId':_0x47e205['id']});});});});});}})[_0x239d('0x2f')](respondWithStatusCode(_0x374550,null))[_0x239d('0x52')](handleError(_0x374550,null));};exports[_0x239d('0x86')]=function(_0x486b48,_0x59a340,_0x3577f5){return db[_0x239d('0x71')][_0x239d('0x51')]({'where':{'id':_0x486b48[_0x239d('0x41')]['ids']},'attributes':['id'],'include':[{'model':db[_0x239d('0x75')],'as':_0x239d('0x76'),'attributes':['id'],'raw':!![]}]})[_0x239d('0x2f')](handleEntityNotFound(_0x59a340,null))[_0x239d('0x2f')](function(_0x2ec6db){var _0x55c215=_['map'](_0x2ec6db,'id');var _0x4bd67d=[];var _0x45391e=[];var _0x112720=squel[_0x239d('0x87')]();_0x112720[_0x239d('0x88')](_0x239d('0x89'))[_0x239d('0x8a')](_0x239d('0x8b'),'tq')[_0x239d('0x8c')](_0x239d('0x8d'),'ut',_0x239d('0x8e'))[_0x239d('0x4c')]('VoiceQueueId\x20=\x20?',_0x486b48[_0x239d('0x53')]['id']);for(var _0x5287df=0x0;_0x5287df<_0x2ec6db[_0x239d('0x47')];_0x5287df+=0x1){let _0x288d60=_0x2ec6db[_0x5287df];for(var _0x87d9a7=0x0;_0x87d9a7<_0x288d60[_0x239d('0x76')][_0x239d('0x47')];_0x87d9a7+=0x1){let _0x18d44e=_0x288d60[_0x239d('0x76')][_0x87d9a7];var _0x1c037e=_0x112720[_0x239d('0x61')]();_0x1c037e[_0x239d('0x4c')]('ut.UserId\x20=\x20?',_0x18d44e['id']);_0x45391e['push'](db[_0x239d('0x8f')][_0x239d('0x41')](_0x1c037e[_0x239d('0x90')](),{'type':db['sequelize']['QueryTypes'][_0x239d('0x91')]})[_0x239d('0x2f')](function(_0x2adc34){if(_0x2adc34[_0x239d('0x47')]===0x1){return _0x18d44e['id'];}else{var _0x19ab1b=_[_0x239d('0x92')](_['map'](_0x2adc34,'TeamId'),function(_0x4da5a7){return _['includes'](_0x55c215,_0x4da5a7);});if(_0x19ab1b){return _0x18d44e['id'];}}}));}}return BPromise[_0x239d('0x93')](_0x45391e)[_0x239d('0x2f')](function(_0x3ac3a4){_0x4bd67d=_(_0x4bd67d)['union'](_0x3ac3a4)[_0x239d('0x94')]()[_0x239d('0x5c')]();return db[_0x239d('0x3e')]['find']({'where':{'id':_0x486b48['params']['id']}})['then'](function(_0x4052b7){return db['sequelize'][_0x239d('0x95')](function(_0x2ec725){return _0x4052b7[_0x239d('0x86')](_0x486b48[_0x239d('0x41')]['ids'],{'transaction':_0x2ec725})[_0x239d('0x2f')](function(){if(!_[_0x239d('0x96')](_0x4bd67d)){return _0x4052b7['removeAgents'](_0x4bd67d,{'transaction':_0x2ec725})[_0x239d('0x2f')](function(){return db[_0x239d('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x486b48[_0x239d('0x53')]['id'],'UserId':_0x4bd67d},'transaction':_0x2ec725});});}})['then'](function(){_0x4bd67d['forEach'](function(_0x23f11e){socket[_0x239d('0x84')](_0x239d('0x97'),{'UserId':_0x23f11e,'VoiceQueueId':_0x4052b7['id']});});});});});});})[_0x239d('0x2f')](respondWithStatusCode(_0x59a340,null))[_0x239d('0x52')](handleError(_0x59a340,null));};exports['addAgents']=function(_0x347d65,_0x59b716,_0x32885c){var _0x1c60b6,_0x4911ec;return db[_0x239d('0x3e')][_0x239d('0x35')]({'where':{'id':_0x347d65['params']['id']}})['then'](handleEntityNotFound(_0x59b716,null))['then'](function(_0x1e6e02){if(_0x1e6e02){_0x4911ec=_0x1e6e02;return _0x1e6e02[_0x239d('0x98')](_0x347d65['body'][_0x239d('0x99')],_[_0x239d('0x65')](_0x347d65[_0x239d('0x56')],[_0x239d('0x99'),'id'])||{})[_0x239d('0x9a')](function(_0x85f8da){for(var _0x2bb55e=0x0;_0x2bb55e<_0x347d65['body'][_0x239d('0x99')][_0x239d('0x47')];_0x2bb55e+=0x1){socket[_0x239d('0x84')]('userVoiceQueue:save',{'UserId':Number(_0x347d65[_0x239d('0x56')][_0x239d('0x99')][_0x2bb55e]),'VoiceQueueId':Number(_0x347d65[_0x239d('0x53')]['id'])});}return _0x85f8da;});}})[_0x239d('0x2f')](function(_0x555c9b){_0x1c60b6=_0x555c9b||[];if(_0x4911ec){return db[_0x239d('0x75')][_0x239d('0x51')]({'where':{'id':_0x347d65[_0x239d('0x56')][_0x239d('0x99')]},'attributes':['id',_0x239d('0x3a'),_0x239d('0x77'),_0x239d('0x83'),_0x239d('0x80')],'raw':!![]});}})[_0x239d('0x2f')](function(_0x5a2d2a){if(!_['isEmpty'](_0x5a2d2a)){var _0x4c38ec=[];for(var _0x17d227=0x0;_0x17d227<_0x5a2d2a[_0x239d('0x47')];_0x17d227++){if(_0x5a2d2a[_0x17d227]['online']){_0x4c38ec[_0x239d('0x9b')](db[_0x239d('0x7e')][_0x239d('0x7f')]({'membername':_0x5a2d2a[_0x17d227][_0x239d('0x3a')],'UserId':_0x5a2d2a[_0x17d227]['id'],'queue_name':_0x4911ec[_0x239d('0x3a')],'VoiceQueueId':_0x4911ec['id'],'interface':_[_0x239d('0x9c')](_0x5a2d2a[_0x17d227][_0x239d('0x80')])?util[_0x239d('0x81')](_0x239d('0x82'),_0x5a2d2a[_0x17d227]['name']):_0x5a2d2a[_0x17d227]['interface'],'paused':_0x5a2d2a[_0x17d227][_0x239d('0x83')]||![],'penalty':_0x347d65[_0x239d('0x56')]['penalty']||0x0}));}}return BPromise[_0x239d('0x93')](_0x4c38ec);}})[_0x239d('0x2f')](function(){return _0x1c60b6;})[_0x239d('0x2f')](respondWithResult(_0x59b716,null))[_0x239d('0x52')](handleError(_0x59b716,null));};exports[_0x239d('0x9d')]=function(_0xa04de7,_0x370a0a,_0x3daf92){return db[_0x239d('0x3e')][_0x239d('0x35')]({'where':{'id':_0xa04de7['params']['id']}})['then'](handleEntityNotFound(_0x370a0a,null))[_0x239d('0x2f')](function(_0x375b4b){if(_0x375b4b){return _0x375b4b['removeAgents'](_0xa04de7[_0x239d('0x41')][_0x239d('0x99')])[_0x239d('0x2f')](function(){if(_[_0x239d('0x9e')](_0xa04de7[_0x239d('0x41')]['ids'])){for(var _0x1150fd=0x0;_0x1150fd<_0xa04de7[_0x239d('0x41')]['ids']['length'];_0x1150fd+=0x1){socket[_0x239d('0x84')](_0x239d('0x97'),{'UserId':Number(_0xa04de7['query'][_0x239d('0x99')][_0x1150fd]),'VoiceQueueId':Number(_0xa04de7[_0x239d('0x53')]['id'])});}}else{socket[_0x239d('0x84')](_0x239d('0x97'),{'UserId':Number(_0xa04de7[_0x239d('0x41')]['ids']),'VoiceQueueId':Number(_0xa04de7[_0x239d('0x53')]['id'])});}});}})[_0x239d('0x2f')](function(_0x31c982){return db['UserVoiceQueueRt'][_0x239d('0x37')]({'where':{'VoiceQueueId':_0xa04de7['params']['id'],'UserId':_0xa04de7['query'][_0x239d('0x99')]}})[_0x239d('0x2f')](function(){return _0x31c982;});})[_0x239d('0x2f')](respondWithStatusCode(_0x370a0a,null))[_0x239d('0x52')](handleError(_0x370a0a,null));};exports['getAgents']=function(_0x13fdad,_0x7a2475,_0x5a908c){var _0x60da28={};var _0x3e399a={};var _0x17d60b;var _0x103003;return db[_0x239d('0x3e')][_0x239d('0x68')]({'where':{'id':_0x13fdad[_0x239d('0x53')]['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0x7a2475,null))['then'](function(_0x53f60e){if(_0x53f60e){_0x17d60b=_0x53f60e;_0x3e399a[_0x239d('0x40')]=_['keys'](db[_0x239d('0x75')][_0x239d('0x3f')]);_0x3e399a['query']=_[_0x239d('0x42')](_0x13fdad[_0x239d('0x41')]);_0x3e399a['filters']=_[_0x239d('0x45')](_0x3e399a[_0x239d('0x40')],_0x3e399a[_0x239d('0x41')]);_0x60da28[_0x239d('0x44')]=_[_0x239d('0x45')](_0x3e399a[_0x239d('0x40')],qs[_0x239d('0x46')](_0x13fdad[_0x239d('0x41')]['fields']));_0x60da28[_0x239d('0x44')]=_0x60da28[_0x239d('0x44')][_0x239d('0x47')]?_0x60da28[_0x239d('0x44')]:_0x3e399a[_0x239d('0x40')];_0x60da28[_0x239d('0x4a')]=qs['sort'](_0x13fdad[_0x239d('0x41')]['sort']);_0x60da28[_0x239d('0x4c')]=qs[_0x239d('0x43')](_[_0x239d('0x4d')](_0x13fdad[_0x239d('0x41')],_0x3e399a[_0x239d('0x43')]));if(_0x13fdad[_0x239d('0x41')][_0x239d('0x4e')]){_0x60da28[_0x239d('0x4c')]=_[_0x239d('0x4f')](_0x60da28[_0x239d('0x4c')],{'$or':_['map'](_0x60da28[_0x239d('0x44')],function(_0x5b3dcc){var _0x21eb9f={};_0x21eb9f[_0x5b3dcc]={'$like':'%'+_0x13fdad[_0x239d('0x41')][_0x239d('0x4e')]+'%'};return _0x21eb9f;})});}_0x60da28=_['merge']({},_0x60da28,_0x13fdad[_0x239d('0x54')]);return _0x17d60b[_0x239d('0x9f')](_0x60da28);}})[_0x239d('0x2f')](function(_0x22e6a1){if(_0x22e6a1){_0x103003=_0x22e6a1[_0x239d('0x47')];if(!_0x13fdad[_0x239d('0x41')]['hasOwnProperty'](_0x239d('0x49'))){_0x60da28[_0x239d('0x27')]=qs[_0x239d('0x27')](_0x13fdad['query'][_0x239d('0x27')]);_0x60da28[_0x239d('0x25')]=qs[_0x239d('0x25')](_0x13fdad[_0x239d('0x41')][_0x239d('0x25')]);}return _0x17d60b['getAgents'](_0x60da28);}})['then'](function(_0x5e2614){if(_0x5e2614){return _0x5e2614?{'count':_0x103003,'rows':_0x5e2614}:null;}})[_0x239d('0x2f')](respondWithResult(_0x7a2475,null))['catch'](handleError(_0x7a2475,null));};exports['getMembers']=function(_0x4d0311,_0x5b4d92,_0x3ada1d){var _0x5577f2={};var _0x2d6e4={};var _0x194b87;var _0x104f7b;return db['VoiceQueue'][_0x239d('0x68')]({'where':{'id':_0x4d0311[_0x239d('0x53')]['id']}})['then'](handleEntityNotFound(_0x5b4d92,null))['then'](function(_0x2a0b9d){if(_0x2a0b9d){_0x194b87=_0x2a0b9d;_0x2d6e4[_0x239d('0x40')]=_[_0x239d('0x42')](db[_0x239d('0x7e')][_0x239d('0x3f')]);_0x2d6e4[_0x239d('0x41')]=_[_0x239d('0x42')](_0x4d0311['query']);_0x2d6e4['filters']=_[_0x239d('0x45')](_0x2d6e4[_0x239d('0x40')],_0x2d6e4[_0x239d('0x41')]);_0x5577f2['attributes']=_[_0x239d('0x45')](_0x2d6e4[_0x239d('0x40')],qs[_0x239d('0x46')](_0x4d0311[_0x239d('0x41')][_0x239d('0x46')]));_0x5577f2[_0x239d('0x44')]=_0x5577f2[_0x239d('0x44')][_0x239d('0x47')]?_0x5577f2[_0x239d('0x44')]:_0x2d6e4[_0x239d('0x40')];_0x5577f2['order']=qs[_0x239d('0x4b')](_0x4d0311['query'][_0x239d('0x4b')]);_0x5577f2[_0x239d('0x4c')]=qs['filters'](_[_0x239d('0x4d')](_0x4d0311[_0x239d('0x41')],_0x2d6e4[_0x239d('0x43')]));if(_0x4d0311['query'][_0x239d('0x4e')]){_0x5577f2[_0x239d('0x4c')]=_['merge'](_0x5577f2[_0x239d('0x4c')],{'$or':_[_0x239d('0x3d')](_0x5577f2[_0x239d('0x44')],function(_0x389414){var _0x2e2c08={};_0x2e2c08[_0x389414]={'$like':'%'+_0x4d0311[_0x239d('0x41')][_0x239d('0x4e')]+'%'};return _0x2e2c08;})});}_0x5577f2=_['merge']({},_0x5577f2,_0x4d0311[_0x239d('0x54')]);return _0x194b87['getMembers'](_0x5577f2);}})[_0x239d('0x2f')](function(_0x41b1f8){if(_0x41b1f8){_0x104f7b=_0x41b1f8['length'];if(!_0x4d0311[_0x239d('0x41')][_0x239d('0x48')]('nolimit')){_0x5577f2['limit']=qs[_0x239d('0x27')](_0x4d0311[_0x239d('0x41')][_0x239d('0x27')]);_0x5577f2['offset']=qs[_0x239d('0x25')](_0x4d0311['query'][_0x239d('0x25')]);}return _0x194b87[_0x239d('0xa0')](_0x5577f2);}})[_0x239d('0x2f')](function(_0x1c8528){return _0x1c8528?{'count':_0x104f7b,'rows':_0x1c8528}:null;})['then'](respondWithResult(_0x5b4d92,null))[_0x239d('0x52')](handleError(_0x5b4d92,null));};exports['getLists']=function(_0x53042d,_0x473edd,_0x28660a){var _0x9356f8={};var _0x2baa57={};var _0x30d8fb;var _0x5d153e;return db['VoiceQueue'][_0x239d('0x68')]({'where':{'id':_0x53042d[_0x239d('0x53')]['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0x473edd,null))[_0x239d('0x2f')](function(_0x544ef8){if(_0x544ef8){_0x30d8fb=_0x544ef8;_0x2baa57[_0x239d('0x40')]=_['keys'](db['CmList'][_0x239d('0x3f')]);_0x2baa57['query']=_['keys'](_0x53042d['query']);_0x2baa57[_0x239d('0x43')]=_[_0x239d('0x45')](_0x2baa57['model'],_0x2baa57[_0x239d('0x41')]);_0x9356f8[_0x239d('0x44')]=_[_0x239d('0x45')](_0x2baa57[_0x239d('0x40')],qs[_0x239d('0x46')](_0x53042d[_0x239d('0x41')]['fields']));_0x9356f8[_0x239d('0x44')]=_0x9356f8['attributes'][_0x239d('0x47')]?_0x9356f8[_0x239d('0x44')]:_0x2baa57[_0x239d('0x40')];_0x9356f8[_0x239d('0x4a')]=qs[_0x239d('0x4b')](_0x53042d[_0x239d('0x41')][_0x239d('0x4b')]);_0x9356f8[_0x239d('0x4c')]=qs['filters'](_[_0x239d('0x4d')](_0x53042d[_0x239d('0x41')],_0x2baa57[_0x239d('0x43')]));if(_0x53042d[_0x239d('0x41')][_0x239d('0x4e')]){_0x9356f8['where']=_[_0x239d('0x4f')](_0x9356f8[_0x239d('0x4c')],{'$or':_[_0x239d('0x3d')](_0x9356f8[_0x239d('0x44')],function(_0x3ca0bf){var _0x50a9ba={};_0x50a9ba[_0x3ca0bf]={'$like':'%'+_0x53042d[_0x239d('0x41')][_0x239d('0x4e')]+'%'};return _0x50a9ba;})});}_0x9356f8=_['merge']({},_0x9356f8,_0x53042d[_0x239d('0x54')]);return _0x30d8fb[_0x239d('0xa1')](_0x9356f8);}})['then'](function(_0x3133af){if(_0x3133af){_0x5d153e=_0x3133af['length'];if(!_0x53042d[_0x239d('0x41')][_0x239d('0x48')]('nolimit')){_0x9356f8[_0x239d('0x27')]=qs[_0x239d('0x27')](_0x53042d[_0x239d('0x41')]['limit']);_0x9356f8['offset']=qs[_0x239d('0x25')](_0x53042d[_0x239d('0x41')][_0x239d('0x25')]);}return _0x30d8fb[_0x239d('0xa1')](_0x9356f8);}})[_0x239d('0x2f')](function(_0x1f3648){if(_0x1f3648){return _0x1f3648?{'count':_0x5d153e,'rows':_0x1f3648}:null;}})[_0x239d('0x2f')](respondWithResult(_0x473edd,null))['catch'](handleError(_0x473edd,null));};exports[_0x239d('0xa2')]=function(_0x1201fe,_0x57e585,_0x1d9717){var _0x234097=moment()[_0x239d('0x81')](_0x239d('0xa3'));var _0xb9f926,_0x1597f5;return db['VoiceQueue'][_0x239d('0x35')]({'where':{'id':_0x1201fe[_0x239d('0x53')]['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0x57e585,null))['then'](function(_0x44cb3e){if(_0x44cb3e){_0x1597f5=_0x44cb3e;return _0x44cb3e[_0x239d('0xa2')](_0x1201fe[_0x239d('0x56')]['ids'],_[_0x239d('0x65')](_0x1201fe[_0x239d('0x56')],[_0x239d('0x99'),'id'])||{});}return null;})[_0x239d('0x9a')](function(_0x133f37){var _0x507f35;_0xb9f926=_0x133f37||[];var _0xa1dbde=[];if(_0x133f37){for(var _0x1aefbf=0x0;_0x1aefbf<_0x133f37[_0x239d('0x47')];_0x1aefbf+=0x1){var _0x52b97b=_0x133f37[_0x1aefbf][_0x239d('0x57')]({'plain':!![]});_0x1597f5[_0x239d('0xa4')]=_0x1201fe['body']['dialCheckDuplicateType']?_0x1201fe[_0x239d('0x56')][_0x239d('0xa4')]:_0x1597f5[_0x239d('0xa4')];switch(_0x1597f5[_0x239d('0xa4')]){case _0x239d('0xa5'):_0x507f35=squel[_0x239d('0xa6')]()[_0x239d('0xa7')](_0x239d('0xa8'))['fromQuery'](['phone',_0x239d('0xa9'),_0x239d('0xaa'),'ListId',_0x239d('0x6e'),_0x239d('0x63'),_0x239d('0x64')],squel[_0x239d('0x87')]()[_0x239d('0x88')]('phone',_0x239d('0xab'))[_0x239d('0x88')]('\x27'+_0x234097+'\x27',_0x239d('0xa9'))['field']('id',_0x239d('0xaa'))[_0x239d('0x88')](_0x52b97b['CmListId'][_0x239d('0x90')](),_0x239d('0xac'))[_0x239d('0x88')](_0x1201fe['params']['id'][_0x239d('0x90')](),_0x239d('0x6e'))[_0x239d('0x88')]('\x27'+_0x234097+'\x27',_0x239d('0x63'))['field']('\x27'+_0x234097+'\x27',_0x239d('0x64'))['from'](_0x239d('0xad'))[_0x239d('0x4c')](_0x239d('0xae'))[_0x239d('0x4c')](_0x239d('0xaf'),_0x52b97b['CmListId']['toString']())[_0x239d('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0x239d('0x4c')](_0x239d('0xb0'),squel[_0x239d('0x87')]()[_0x239d('0x88')]('COALESCE(calleridnum,\x27\x27)')[_0x239d('0x8a')](_0x239d('0xb1'))['where'](_0x239d('0xb2'),_0x1201fe[_0x239d('0x53')]['id'][_0x239d('0x90')]()))[_0x239d('0x4c')](_0x239d('0xb0'),squel[_0x239d('0x87')]()[_0x239d('0x88')](_0x239d('0xb3'))[_0x239d('0x8a')](_0x239d('0xa8'))[_0x239d('0x4c')](_0x239d('0xb2'),_0x1201fe[_0x239d('0x53')]['id']['toString']())))[_0x239d('0x90')]();break;case _0x239d('0xb4'):_0x507f35=squel[_0x239d('0xa6')]()['into']('cm_hopper')[_0x239d('0xb5')]([_0x239d('0xab'),_0x239d('0xa9'),'ContactId',_0x239d('0xac'),'VoiceQueueId',_0x239d('0x63'),_0x239d('0x64')],squel[_0x239d('0x87')]()[_0x239d('0x88')]('phone',_0x239d('0xab'))[_0x239d('0x88')]('\x27'+_0x234097+'\x27','scheduledAt')[_0x239d('0x88')]('id',_0x239d('0xaa'))[_0x239d('0x88')](_0x52b97b[_0x239d('0xb6')]['toString'](),'ListId')[_0x239d('0x88')](_0x1201fe['params']['id'][_0x239d('0x90')](),_0x239d('0x6e'))[_0x239d('0x88')]('\x27'+_0x234097+'\x27',_0x239d('0x63'))[_0x239d('0x88')]('\x27'+_0x234097+'\x27','updatedAt')[_0x239d('0x8a')](_0x239d('0xad'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x239d('0xaf'),_0x52b97b['CmListId'][_0x239d('0x90')]())[_0x239d('0x4c')](_0x239d('0xb7'))['where'](_0x239d('0xb0'),squel['select']()[_0x239d('0x88')](_0x239d('0xb3'))['from'](_0x239d('0xa8'))[_0x239d('0x4c')](_0x239d('0xb2'),_0x1201fe[_0x239d('0x53')]['id'][_0x239d('0x90')]())))['toString']();break;default:_0x507f35=squel[_0x239d('0xa6')]()[_0x239d('0xa7')](_0x239d('0xa8'))[_0x239d('0xb5')](['phone',_0x239d('0xa9'),_0x239d('0xaa'),_0x239d('0xac'),'VoiceQueueId',_0x239d('0x63'),_0x239d('0x64')],squel[_0x239d('0x87')]()[_0x239d('0x88')](_0x239d('0xab'),_0x239d('0xab'))[_0x239d('0x88')]('\x27'+_0x234097+'\x27',_0x239d('0xa9'))['field']('id',_0x239d('0xaa'))[_0x239d('0x88')](_0x52b97b[_0x239d('0xb6')]['toString'](),_0x239d('0xac'))[_0x239d('0x88')](_0x1201fe[_0x239d('0x53')]['id']['toString'](),_0x239d('0x6e'))[_0x239d('0x88')]('\x27'+_0x234097+'\x27','createdAt')[_0x239d('0x88')]('\x27'+_0x234097+'\x27','updatedAt')[_0x239d('0x8a')]('cm_contacts')[_0x239d('0x4c')](_0x239d('0xae'))[_0x239d('0x4c')](_0x239d('0xaf'),_0x52b97b[_0x239d('0xb6')][_0x239d('0x90')]())[_0x239d('0x4c')](_0x239d('0xb7')))[_0x239d('0x90')]();}_0xa1dbde[_0x239d('0x9b')](db[_0x239d('0x8f')][_0x239d('0x41')](_0x507f35));}return BPromise[_0x239d('0x93')](_0xa1dbde);}})[_0x239d('0x2f')](function(){var _0x3f4b12=[];var _0x2d06ef=squel[_0x239d('0xa6')]()[_0x239d('0xa7')](_0x239d('0xb8'))['fromQuery'](['CmHopperId',_0x239d('0xab'),_0x239d('0xb9'),'createdAt',_0x239d('0x64')],squel[_0x239d('0x87')]()[_0x239d('0x88')]('h.id')['field'](_0x239d('0xba'))[_0x239d('0x88')](_0x239d('0xbb'))[_0x239d('0x88')]('\x27'+_0x234097+'\x27','createdAt')['field']('\x27'+_0x234097+'\x27',_0x239d('0x64'))[_0x239d('0x8a')]('cm_contact_has_items','ci')[_0x239d('0x8c')](_0x239d('0xa8'),'h',_0x239d('0xbc'))[_0x239d('0x4c')](_0x239d('0xbd'),_0x234097)[_0x239d('0x4c')](_0x239d('0xbe'),_0x239d('0xbf')))[_0x239d('0x90')]();_0x3f4b12['push'](db[_0x239d('0x8f')][_0x239d('0x41')](_0x2d06ef));return BPromise[_0x239d('0x93')](_0x3f4b12);})[_0x239d('0x2f')](function(){return _0xb9f926;})[_0x239d('0x2f')](respondWithResult(_0x57e585,null))[_0x239d('0x52')](handleError(_0x57e585,null));};exports[_0x239d('0xc0')]=function(_0x4b6b7f,_0x1b1a6c,_0x3e1322){return db[_0x239d('0x3e')][_0x239d('0x35')]({'where':{'id':_0x4b6b7f['params']['id']}})['then'](handleEntityNotFound(_0x1b1a6c,null))['then'](function(_0x4b0f34){if(_0x4b0f34){return _0x4b0f34['removeLists'](_0x4b6b7f[_0x239d('0x41')][_0x239d('0x99')]);}})[_0x239d('0x2f')](function(_0x39054c){if(_0x39054c){return db[_0x239d('0x69')][_0x239d('0x37')]({'where':{'ListId':_0x4b6b7f['query'][_0x239d('0x99')],'VoiceQueueId':_0x4b6b7f['params']['id']}})['then'](function(){return _0x39054c;});}})[_0x239d('0x2f')](respondWithStatusCode(_0x1b1a6c,null))[_0x239d('0x52')](handleError(_0x1b1a6c,null));};exports[_0x239d('0xc1')]=function(_0x46e12d,_0x353b3f,_0x2ea719){var _0x3ada93={};var _0x5902f4={};var _0x1604c2;var _0x2d5584;return db[_0x239d('0x3e')][_0x239d('0x68')]({'where':{'id':_0x46e12d[_0x239d('0x53')]['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0x353b3f,null))[_0x239d('0x2f')](function(_0x1970a5){if(_0x1970a5){_0x1604c2=_0x1970a5;_0x5902f4['model']=_[_0x239d('0x42')](db[_0x239d('0xc2')]['rawAttributes']);_0x5902f4[_0x239d('0x41')]=_['keys'](_0x46e12d[_0x239d('0x41')]);_0x5902f4[_0x239d('0x43')]=_[_0x239d('0x45')](_0x5902f4[_0x239d('0x40')],_0x5902f4[_0x239d('0x41')]);_0x3ada93['attributes']=_[_0x239d('0x45')](_0x5902f4[_0x239d('0x40')],qs[_0x239d('0x46')](_0x46e12d[_0x239d('0x41')][_0x239d('0x46')]));_0x3ada93[_0x239d('0x44')]=_0x3ada93[_0x239d('0x44')][_0x239d('0x47')]?_0x3ada93[_0x239d('0x44')]:_0x5902f4[_0x239d('0x40')];_0x3ada93['order']=qs['sort'](_0x46e12d[_0x239d('0x41')][_0x239d('0x4b')]);_0x3ada93[_0x239d('0x4c')]=qs[_0x239d('0x43')](_[_0x239d('0x4d')](_0x46e12d['query'],_0x5902f4[_0x239d('0x43')]));if(_0x46e12d[_0x239d('0x41')]['filter']){_0x3ada93[_0x239d('0x4c')]=_[_0x239d('0x4f')](_0x3ada93['where'],{'$or':_[_0x239d('0x3d')](_0x3ada93[_0x239d('0x44')],function(_0x2a8c87){var _0x2f23dc={};_0x2f23dc[_0x2a8c87]={'$like':'%'+_0x46e12d[_0x239d('0x41')][_0x239d('0x4e')]+'%'};return _0x2f23dc;})});}_0x3ada93=_[_0x239d('0x4f')]({},_0x3ada93,_0x46e12d['options']);return _0x1604c2[_0x239d('0xc1')](_0x3ada93);}})[_0x239d('0x2f')](function(_0x2d3e6c){if(_0x2d3e6c){_0x2d5584=_0x2d3e6c['length'];if(!_0x46e12d['query'][_0x239d('0x48')]('nolimit')){_0x3ada93[_0x239d('0x27')]=qs[_0x239d('0x27')](_0x46e12d[_0x239d('0x41')][_0x239d('0x27')]);_0x3ada93[_0x239d('0x25')]=qs[_0x239d('0x25')](_0x46e12d['query'][_0x239d('0x25')]);}return _0x1604c2[_0x239d('0xc1')](_0x3ada93);}})[_0x239d('0x2f')](function(_0x5c9f10){if(_0x5c9f10){return _0x5c9f10?{'count':_0x2d5584,'rows':_0x5c9f10}:null;}})[_0x239d('0x2f')](respondWithResult(_0x353b3f,null))[_0x239d('0x52')](handleError(_0x353b3f,null));};exports[_0x239d('0xc3')]=function(_0x3b7d1c,_0x359ebd,_0xecd364){var _0x4d3a0d,_0xf895a8;return db['VoiceQueue'][_0x239d('0x35')]({'where':{'id':_0x3b7d1c[_0x239d('0x53')]['id']}})['then'](handleEntityNotFound(_0x359ebd,null))[_0x239d('0x2f')](function(_0x110f7e){if(_0x110f7e){_0xf895a8=_0x110f7e;return _0x110f7e[_0x239d('0xc3')](_0x3b7d1c['body']['ids'],_['omit'](_0x3b7d1c[_0x239d('0x56')],['ids','id'])||{});}return null;})[_0x239d('0x9a')](function(_0x56d4c4){var _0xc19232;_0x4d3a0d=_0x56d4c4||[];var _0x59de68=[];if(_0x56d4c4){for(var _0x5bcecc=0x0;_0x5bcecc<_0x56d4c4[_0x239d('0x47')];_0x5bcecc+=0x1){var _0x5139b1=_0x56d4c4[_0x5bcecc][_0x239d('0x57')]({'plain':!![]});_0xc19232=squel[_0x239d('0xa6')]()[_0x239d('0xa7')]('cm_hopper_black')[_0x239d('0xb5')]([_0x239d('0xab'),_0x239d('0xaa'),_0x239d('0xac'),_0x239d('0x6e'),_0x239d('0x63'),'updatedAt'],squel['select']()[_0x239d('0x88')]('phone',_0x239d('0xab'))[_0x239d('0x88')]('id',_0x239d('0xaa'))[_0x239d('0x88')](_0x5139b1['CmListId']['toString'](),'ListId')[_0x239d('0x88')](_0x3b7d1c[_0x239d('0x53')]['id'][_0x239d('0x90')](),_0x239d('0x6e'))['field'](_0x239d('0xc4'),_0x239d('0x63'))[_0x239d('0x88')](_0x239d('0xc4'),'updatedAt')[_0x239d('0x8a')](_0x239d('0xad'))[_0x239d('0x4c')](_0x239d('0xae'))[_0x239d('0x4c')](_0x239d('0xaf'),_0x5139b1[_0x239d('0xb6')][_0x239d('0x90')]())['where'](_0x239d('0xb7')))[_0x239d('0x90')]();_0x59de68[_0x239d('0x9b')](db[_0x239d('0x8f')][_0x239d('0x41')](_0xc19232));}return BPromise[_0x239d('0x93')](_0x59de68);}})[_0x239d('0x2f')](function(){return _0x4d3a0d;})[_0x239d('0x2f')](respondWithResult(_0x359ebd,null))[_0x239d('0x52')](handleError(_0x359ebd,null));};exports[_0x239d('0xc5')]=function(_0x4d12ed,_0x7611ca,_0x556d60){return db[_0x239d('0x3e')]['find']({'where':{'id':_0x4d12ed[_0x239d('0x53')]['id']}})[_0x239d('0x2f')](handleEntityNotFound(_0x7611ca,null))['then'](function(_0x2463ef){if(_0x2463ef){return _0x2463ef[_0x239d('0xc5')](_0x4d12ed[_0x239d('0x41')][_0x239d('0x99')]);}})['then'](function(_0x2d5624){if(_0x2d5624){return db['CmHopperBlack'][_0x239d('0x37')]({'where':{'ListId':_0x4d12ed[_0x239d('0x41')]['ids'],'VoiceQueueId':_0x4d12ed[_0x239d('0x53')]['id']}})[_0x239d('0x2f')](function(){return _0x2d5624;});}})[_0x239d('0x2f')](respondWithStatusCode(_0x7611ca,null))['catch'](handleError(_0x7611ca,null));}; \ No newline at end of file +var _0x44fe=['../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','filter','ignore','type','value','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','VoiceQueue','findAll','rows','show','params','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','include','updatedAt','omit','createdAt','getHoppers','findOne','CmHopper','getHopperHistories','order','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','User','online','voicePause','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','interface','userVoiceQueue:save','removeTeams','Team','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','compact','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','select','cm_hopper','onlyIfOpen','COALESCE(phone,\x27\x27)','cm_contacts','all','cm_hopper_additional_phones','CmHopperId','h.id','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1b4913,_0x4fbf17){var _0x1c6e02=function(_0x2825fe){while(--_0x2825fe){_0x1b4913['push'](_0x1b4913['shift']());}};_0x1c6e02(++_0x4fbf17);}(_0x44fe,0x16f));var _0xe44f=function(_0x3492c6,_0xf2e6d8){_0x3492c6=_0x3492c6-0x0;var _0x5ef20f=_0x44fe[_0x3492c6];return _0x5ef20f;};'use strict';var emlformat=require(_0xe44f('0x0'));var rimraf=require(_0xe44f('0x1'));var zipdir=require(_0xe44f('0x2'));var jsonpatch=require(_0xe44f('0x3'));var rp=require(_0xe44f('0x4'));var moment=require(_0xe44f('0x5'));var BPromise=require(_0xe44f('0x6'));var Mustache=require(_0xe44f('0x7'));var util=require(_0xe44f('0x8'));var path=require(_0xe44f('0x9'));var sox=require(_0xe44f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe44f('0xb'));var _=require(_0xe44f('0xc'));var squel=require('squel');var crypto=require(_0xe44f('0xd'));var jsforce=require(_0xe44f('0xe'));var deskjs=require(_0xe44f('0xf'));var toCsv=require(_0xe44f('0x10'));var querystring=require(_0xe44f('0x11'));var Papa=require('papaparse');var Redis=require(_0xe44f('0x12'));var authService=require(_0xe44f('0x13'));var qs=require(_0xe44f('0x14'));var as=require(_0xe44f('0x15'));var hardwareService=require(_0xe44f('0x16'));var logger=require(_0xe44f('0x17'))(_0xe44f('0x18'));var utils=require(_0xe44f('0x19'));var config=require(_0xe44f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe44f('0x1b'))['db'];config[_0xe44f('0x1c')]=_['defaults'](config[_0xe44f('0x1c')],{'host':_0xe44f('0x1d'),'port':0x18eb});var socket=require(_0xe44f('0x1e'))(new Redis(config[_0xe44f('0x1c')]));require(_0xe44f('0x1f'))[_0xe44f('0x20')](socket);function respondWithStatusCode(_0x3ec218,_0x626f8){_0x626f8=_0x626f8||0xcc;return function(_0x590d05){if(_0x590d05){return _0x3ec218[_0xe44f('0x21')](_0x626f8);}return _0x3ec218[_0xe44f('0x22')](_0x626f8)[_0xe44f('0x23')]();};}function respondWithResult(_0x190fec,_0x31175b){_0x31175b=_0x31175b||0xc8;return function(_0x3d334f){if(_0x3d334f){return _0x190fec[_0xe44f('0x22')](_0x31175b)[_0xe44f('0x24')](_0x3d334f);}};}function respondWithFilteredResult(_0x396c29,_0x1678e2){return function(_0x163af0){if(_0x163af0){var _0x3e7d5e=typeof _0x1678e2['offset']==='undefined'&&typeof _0x1678e2[_0xe44f('0x25')]===_0xe44f('0x26');var _0x2767ef=_0x163af0[_0xe44f('0x27')];var _0x467cda=_0x3e7d5e?0x0:_0x1678e2[_0xe44f('0x28')];var _0x42ed0a=_0x3e7d5e?_0x163af0[_0xe44f('0x27')]:_0x1678e2[_0xe44f('0x28')]+_0x1678e2['limit'];var _0x487bca;if(_0x42ed0a>=_0x2767ef){_0x42ed0a=_0x2767ef;_0x487bca=0xc8;}else{_0x487bca=0xce;}_0x396c29[_0xe44f('0x22')](_0x487bca);return _0x396c29[_0xe44f('0x29')](_0xe44f('0x2a'),_0x467cda+'-'+_0x42ed0a+'/'+_0x2767ef)[_0xe44f('0x24')](_0x163af0);}return null;};}function patchUpdates(_0xf3c259){return function(_0x538a03){try{jsonpatch['apply'](_0x538a03,_0xf3c259,!![]);}catch(_0x412b36){return BPromise[_0xe44f('0x2b')](_0x412b36);}return _0x538a03[_0xe44f('0x2c')]();};}function saveUpdates(_0x20c7aa,_0x55b679){return function(_0x1aa2cf){if(_0x1aa2cf){return _0x1aa2cf[_0xe44f('0x2d')](_0x20c7aa)[_0xe44f('0x2e')](function(_0x90d216){return _0x90d216;});}return null;};}function removeEntity(_0x59667c,_0x45a632){return function(_0x162443){if(_0x162443){return _0x162443[_0xe44f('0x2f')]()['then'](function(){var _0x4e3cce=_0x162443[_0xe44f('0x30')]({'plain':!![]});var _0x42f994=[{'name':_0xe44f('0x31'),'value':'inbound','ignore':![]},{'name':_0xe44f('0x32'),'value':'outbound','ignore':![]}];var _0x373d29=_(_0x42f994)[_0xe44f('0x33')](_0xe44f('0x34'))['map']('value')['value']();if(_['includes'](_0x373d29,_0x4e3cce[_0xe44f('0x35')])){return;}var _0x30ef3b=_['find'](_0x42f994,[_0xe44f('0x36'),_0x4e3cce[_0xe44f('0x35')]])[_0xe44f('0x37')];return db[_0xe44f('0x38')][_0xe44f('0x2f')]({'where':{'type':_0x30ef3b,'resourceId':_0x4e3cce['id']}})[_0xe44f('0x2e')](function(){return _0x162443;});})['then'](function(){_0x59667c[_0xe44f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x366f19,_0x2ba023){return function(_0x3724c5){if(!_0x3724c5){_0x366f19['sendStatus'](0x194);}return _0x3724c5;};}function handleError(_0x4532c8,_0x5f513a){_0x5f513a=_0x5f513a||0x1f4;return function(_0x54f0f){logger[_0xe44f('0x39')](_0x54f0f[_0xe44f('0x3a')]);if(_0x54f0f['name']){delete _0x54f0f['name'];}_0x4532c8[_0xe44f('0x22')](_0x5f513a)[_0xe44f('0x3b')](_0x54f0f);};}exports[_0xe44f('0x3c')]=function(_0x400747,_0x543b4b){var _0x444379={},_0x3bd36c={},_0x51febd={'count':0x0,'rows':[]};var _0x440c25=_[_0xe44f('0x3d')](db['VoiceQueue'][_0xe44f('0x3e')],function(_0x385161){return{'name':_0x385161[_0xe44f('0x3f')],'type':_0x385161[_0xe44f('0x35')][_0xe44f('0x40')]};});_0x3bd36c[_0xe44f('0x41')]=_['map'](_0x440c25,'name');_0x3bd36c[_0xe44f('0x42')]=_['keys'](_0x400747[_0xe44f('0x42')]);_0x3bd36c[_0xe44f('0x43')]=_['intersection'](_0x3bd36c[_0xe44f('0x41')],_0x3bd36c[_0xe44f('0x42')]);_0x444379[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x3bd36c[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x400747[_0xe44f('0x42')][_0xe44f('0x46')]));_0x444379[_0xe44f('0x44')]=_0x444379[_0xe44f('0x44')][_0xe44f('0x47')]?_0x444379[_0xe44f('0x44')]:_0x3bd36c[_0xe44f('0x41')];if(!_0x400747[_0xe44f('0x42')][_0xe44f('0x48')](_0xe44f('0x49'))){_0x444379[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x400747[_0xe44f('0x42')]['limit']);_0x444379['offset']=qs[_0xe44f('0x28')](_0x400747[_0xe44f('0x42')]['offset']);}_0x444379['order']=qs[_0xe44f('0x4a')](_0x400747[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x444379[_0xe44f('0x4b')]=qs['filters'](_[_0xe44f('0x4c')](_0x400747[_0xe44f('0x42')],_0x3bd36c[_0xe44f('0x43')]),_0x440c25);if(_0x400747[_0xe44f('0x42')][_0xe44f('0x33')]){_0x444379[_0xe44f('0x4b')]=_['merge'](_0x444379[_0xe44f('0x4b')],{'$or':_['map'](_0x440c25,function(_0x10afcb){if(_0x10afcb[_0xe44f('0x35')]!==_0xe44f('0x4d')){var _0x17dea7={};_0x17dea7[_0x10afcb['name']]={'$like':'%'+_0x400747['query'][_0xe44f('0x33')]+'%'};return _0x17dea7;}})});}_0x444379=_[_0xe44f('0x4e')]({},_0x444379,_0x400747['options']);var _0x5ea96c={'where':_0x444379['where']};return db[_0xe44f('0x4f')][_0xe44f('0x27')](_0x5ea96c)['then'](function(_0x28b920){_0x51febd['count']=_0x28b920;if(_0x400747[_0xe44f('0x42')]['includeAll']){_0x444379['include']=[{'all':!![]}];}return db[_0xe44f('0x4f')][_0xe44f('0x50')](_0x444379);})[_0xe44f('0x2e')](function(_0x14b760){_0x51febd[_0xe44f('0x51')]=_0x14b760;return _0x51febd;})[_0xe44f('0x2e')](respondWithFilteredResult(_0x543b4b,_0x444379))['catch'](handleError(_0x543b4b,null));};exports[_0xe44f('0x52')]=function(_0x4bcba8,_0x1177f4){var _0x39fe4f={'raw':![],'where':{'id':_0x4bcba8[_0xe44f('0x53')]['id']}},_0x250c9={};_0x250c9[_0xe44f('0x41')]=_['keys'](db[_0xe44f('0x4f')]['rawAttributes']);_0x250c9['query']=_['keys'](_0x4bcba8[_0xe44f('0x42')]);_0x250c9[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x250c9[_0xe44f('0x41')],_0x250c9['query']);_0x39fe4f[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x250c9['model'],qs[_0xe44f('0x46')](_0x4bcba8[_0xe44f('0x42')][_0xe44f('0x46')]));_0x39fe4f[_0xe44f('0x44')]=_0x39fe4f['attributes'][_0xe44f('0x47')]?_0x39fe4f[_0xe44f('0x44')]:_0x250c9[_0xe44f('0x41')];if(_0x4bcba8[_0xe44f('0x42')][_0xe44f('0x54')]){_0x39fe4f['include']=[{'all':!![]}];}_0x39fe4f=_[_0xe44f('0x4e')]({},_0x39fe4f,_0x4bcba8[_0xe44f('0x55')]);return db[_0xe44f('0x4f')][_0xe44f('0x56')](_0x39fe4f)[_0xe44f('0x2e')](handleEntityNotFound(_0x1177f4,null))[_0xe44f('0x2e')](respondWithResult(_0x1177f4,null))[_0xe44f('0x57')](handleError(_0x1177f4,null));};exports[_0xe44f('0x58')]=function(_0x5a4662,_0x10798b){return db[_0xe44f('0x4f')][_0xe44f('0x58')](_0x5a4662[_0xe44f('0x59')],{})[_0xe44f('0x2e')](function(_0x312ff5){var _0x2a0d2d=_0x5a4662[_0xe44f('0x5a')][_0xe44f('0x30')]({'plain':!![]});if(!_0x2a0d2d)throw new Error(_0xe44f('0x5b'));if(_0x2a0d2d[_0xe44f('0x5c')]==='user'){var _0x14c984=_0x312ff5[_0xe44f('0x30')]({'plain':!![]});var _0x46a505=[{'name':_0xe44f('0x31'),'value':_0xe44f('0x5d')},{'name':'QueueCampaigns','value':_0xe44f('0x5e')}];var _0x2ce4fc=_[_0xe44f('0x56')](_0x46a505,[_0xe44f('0x36'),_0x14c984[_0xe44f('0x35')]])[_0xe44f('0x37')];return db[_0xe44f('0x5f')][_0xe44f('0x56')]({'where':{'name':_0x2ce4fc,'userProfileId':_0x2a0d2d[_0xe44f('0x60')]},'raw':!![]})[_0xe44f('0x2e')](function(_0x37d01d){if(_0x37d01d&&_0x37d01d['autoAssociation']===0x0){return db[_0xe44f('0x38')][_0xe44f('0x58')]({'name':_0x14c984[_0xe44f('0x37')],'resourceId':_0x14c984['id'],'type':_0x37d01d[_0xe44f('0x37')],'sectionId':_0x37d01d['id']},{})['then'](function(){return _0x312ff5;});}else{return _0x312ff5;}})['catch'](function(_0x3ae248){logger[_0xe44f('0x39')](_0xe44f('0x61'),_0x3ae248);throw _0x3ae248;});}return _0x312ff5;})[_0xe44f('0x2e')](respondWithResult(_0x10798b,0xc9))['catch'](handleError(_0x10798b,null));};exports[_0xe44f('0x62')]=function(_0x106e02,_0x65b572){var _0x5b1e61={'where':{'id':_0x106e02[_0xe44f('0x53')]['id']}},_0x2abb2a={};_0x2abb2a[_0xe44f('0x41')]=_[_0xe44f('0x63')](db[_0xe44f('0x4f')][_0xe44f('0x3e')]);_0x5b1e61[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x2abb2a['model'],qs[_0xe44f('0x46')](_0x106e02['query']['fields']));_0x5b1e61[_0xe44f('0x44')]=_0x5b1e61[_0xe44f('0x44')][_0xe44f('0x47')]?_0x5b1e61['attributes']:_0x2abb2a['model'];if(_0x106e02['query'][_0xe44f('0x54')]){_0x5b1e61[_0xe44f('0x64')]=[{'all':!![]}];}_0x5b1e61=_['merge']({},_0x5b1e61,_0x106e02['options']);return db[_0xe44f('0x4f')][_0xe44f('0x56')](_0x5b1e61)[_0xe44f('0x2e')](handleEntityNotFound(_0x65b572,null))[_0xe44f('0x2e')](function(_0x4b14fa){if(_0x4b14fa){var _0x324f7f=_0x4b14fa[_0xe44f('0x30')]({'plain':!![]});_0x324f7f=qs['omit'](_0x324f7f,['id','createdAt',_0xe44f('0x65')]);_0x106e02['body']=_[_0xe44f('0x66')](_0x106e02['body'],['id',_0xe44f('0x67'),_0xe44f('0x65')]);return db[_0xe44f('0x4f')][_0xe44f('0x58')](_['merge'](_0x324f7f,_0x106e02[_0xe44f('0x59')]),{'include':_0x106e02['query'][_0xe44f('0x54')]?[{'all':!![]}]:undefined})['then'](function(_0x67c633){var _0x15097c=_0x106e02[_0xe44f('0x5a')][_0xe44f('0x30')]({'plain':!![]});if(!_0x15097c)throw new Error(_0xe44f('0x5b'));if(_0x15097c[_0xe44f('0x5c')]===_0xe44f('0x5a')){var _0x45ba2b=_0x67c633[_0xe44f('0x30')]({'plain':!![]});var _0x577bc4=[{'name':'VoiceQueues','value':_0xe44f('0x5d')},{'name':'QueueCampaigns','value':_0xe44f('0x5e')}];var _0x12da2c=_[_0xe44f('0x56')](_0x577bc4,['value',_0x45ba2b['type']])['name'];return db[_0xe44f('0x5f')][_0xe44f('0x56')]({'where':{'name':_0x12da2c,'userProfileId':_0x15097c['userProfileId']},'raw':!![]})[_0xe44f('0x2e')](function(_0x36796e){if(_0x36796e&&_0x36796e['autoAssociation']===0x0){return db[_0xe44f('0x38')]['create']({'name':_0x45ba2b[_0xe44f('0x37')],'resourceId':_0x45ba2b['id'],'type':_0x36796e['name'],'sectionId':_0x36796e['id']},{})['then'](function(){return _0x67c633;});}else{return _0x67c633;}})[_0xe44f('0x57')](function(_0x404dbc){logger[_0xe44f('0x39')](_0xe44f('0x61'),_0x404dbc);throw _0x404dbc;});}return _0x67c633;});}})[_0xe44f('0x2e')](respondWithResult(_0x65b572,0xc9))[_0xe44f('0x57')](handleError(_0x65b572,null));};exports['update']=function(_0xb5fa8d,_0x2249d9){if(_0xb5fa8d[_0xe44f('0x59')]['id']){delete _0xb5fa8d[_0xe44f('0x59')]['id'];}return db[_0xe44f('0x4f')][_0xe44f('0x56')]({'where':{'id':_0xb5fa8d['params']['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x2249d9,null))[_0xe44f('0x2e')](saveUpdates(_0xb5fa8d[_0xe44f('0x59')],null))[_0xe44f('0x2e')](respondWithResult(_0x2249d9,null))[_0xe44f('0x57')](handleError(_0x2249d9,null));};exports[_0xe44f('0x2f')]=function(_0x4aeda3,_0x2db23f){return db['VoiceQueue'][_0xe44f('0x56')]({'where':{'id':_0x4aeda3[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x2db23f,null))[_0xe44f('0x2e')](removeEntity(_0x2db23f,null))[_0xe44f('0x57')](handleError(_0x2db23f,null));};exports[_0xe44f('0x68')]=function(_0x580d92,_0x94f9bd,_0xf654c8){var _0x3dd3cd={'raw':![],'where':{}};var _0x3c37b3={};var _0x3de607={'count':0x0,'rows':[]};return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x580d92[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x94f9bd,null))[_0xe44f('0x2e')](function(_0x1b2eee){if(_0x1b2eee){_0x3c37b3[_0xe44f('0x41')]=_[_0xe44f('0x63')](db['CmHopper'][_0xe44f('0x3e')]);_0x3c37b3[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x580d92[_0xe44f('0x42')]);_0x3c37b3[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x3c37b3[_0xe44f('0x41')],_0x3c37b3['query']);_0x3dd3cd[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x3c37b3[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x580d92[_0xe44f('0x42')]['fields']));_0x3dd3cd['attributes']=_0x3dd3cd['attributes']['length']?_0x3dd3cd['attributes']:_0x3c37b3[_0xe44f('0x41')];if(!_0x580d92[_0xe44f('0x42')][_0xe44f('0x48')](_0xe44f('0x49'))){_0x3dd3cd[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x580d92[_0xe44f('0x42')]['limit']);_0x3dd3cd[_0xe44f('0x28')]=qs[_0xe44f('0x28')](_0x580d92[_0xe44f('0x42')]['offset']);}_0x3dd3cd['order']=qs[_0xe44f('0x4a')](_0x580d92[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x3dd3cd[_0xe44f('0x4b')]=qs[_0xe44f('0x43')](_[_0xe44f('0x4c')](_0x580d92[_0xe44f('0x42')],_0x3c37b3['filters']));_0x3dd3cd[_0xe44f('0x4b')]['VoiceQueueId']=_0x1b2eee['id'];if(_0x580d92[_0xe44f('0x42')]['filter']){_0x3dd3cd['where']=_[_0xe44f('0x4e')](_0x3dd3cd['where'],{'$or':_['map'](_0x3dd3cd[_0xe44f('0x44')],function(_0x31444e){var _0x2f0096={};_0x2f0096[_0x31444e]={'$like':'%'+_0x580d92['query']['filter']+'%'};return _0x2f0096;})});}_0x3dd3cd=_[_0xe44f('0x4e')]({},_0x3dd3cd,_0x580d92['options']);return db[_0xe44f('0x6a')][_0xe44f('0x27')]({'where':_0x3dd3cd[_0xe44f('0x4b')]})[_0xe44f('0x2e')](function(_0x2c14a4){_0x3de607['count']=_0x2c14a4;if(_0x580d92['query'][_0xe44f('0x54')]){_0x3dd3cd['include']=[{'all':!![]}];}return db[_0xe44f('0x6a')]['findAll'](_0x3dd3cd);})[_0xe44f('0x2e')](function(_0x36eb20){_0x3de607[_0xe44f('0x51')]=_0x36eb20;return _0x3de607;});}})[_0xe44f('0x2e')](respondWithFilteredResult(_0x94f9bd,_0x3dd3cd))['catch'](handleError(_0x94f9bd,null));};exports[_0xe44f('0x6b')]=function(_0x529069,_0x3017fb,_0x1fac7f){var _0x107f16={'raw':!![],'where':{}};var _0x10d45d={};var _0x4f643d={'count':0x0,'rows':[]};return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x529069[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x3017fb,null))[_0xe44f('0x2e')](function(_0x268486){if(_0x268486){_0x10d45d[_0xe44f('0x41')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x10d45d[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x529069['query']);_0x10d45d[_0xe44f('0x43')]=_['intersection'](_0x10d45d['model'],_0x10d45d['query']);_0x107f16[_0xe44f('0x44')]=_['intersection'](_0x10d45d[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x529069['query']['fields']));_0x107f16['attributes']=_0x107f16['attributes'][_0xe44f('0x47')]?_0x107f16[_0xe44f('0x44')]:_0x10d45d['model'];if(!_0x529069[_0xe44f('0x42')][_0xe44f('0x48')]('nolimit')){_0x107f16['limit']=qs['limit'](_0x529069[_0xe44f('0x42')][_0xe44f('0x25')]);_0x107f16[_0xe44f('0x28')]=qs['offset'](_0x529069[_0xe44f('0x42')][_0xe44f('0x28')]);}_0x107f16[_0xe44f('0x6c')]=qs['sort'](_0x529069[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x107f16[_0xe44f('0x4b')]=qs[_0xe44f('0x43')](_[_0xe44f('0x4c')](_0x529069['query'],_0x10d45d[_0xe44f('0x43')]));_0x107f16[_0xe44f('0x4b')][_0xe44f('0x6d')]=_0x268486['id'];if(_0x529069[_0xe44f('0x42')]['filter']){_0x107f16[_0xe44f('0x4b')]=_[_0xe44f('0x4e')](_0x107f16['where'],{'$or':_['map'](_0x107f16[_0xe44f('0x44')],function(_0x44ebb4){var _0xa5720a={};_0xa5720a[_0x44ebb4]={'$like':'%'+_0x529069['query'][_0xe44f('0x33')]+'%'};return _0xa5720a;})});}_0x107f16=_[_0xe44f('0x4e')]({},_0x107f16,_0x529069[_0xe44f('0x55')]);return db['CmHopperHistory'][_0xe44f('0x27')]({'where':_0x107f16[_0xe44f('0x4b')]})[_0xe44f('0x2e')](function(_0x5f49f0){_0x4f643d[_0xe44f('0x27')]=_0x5f49f0;if(_0x529069[_0xe44f('0x42')]['includeAll']){_0x107f16[_0xe44f('0x64')]=[{'all':!![]}];}return db[_0xe44f('0x6e')][_0xe44f('0x50')](_0x107f16);})['then'](function(_0x2702ab){_0x4f643d[_0xe44f('0x51')]=_0x2702ab;return _0x4f643d;});}})[_0xe44f('0x2e')](respondWithFilteredResult(_0x3017fb,_0x107f16))[_0xe44f('0x57')](handleError(_0x3017fb,null));};exports['getHopperFinals']=function(_0x42927b,_0x120bb3,_0x1d9921){var _0x42b38e={'raw':!![],'where':{}};var _0x1e7da6={};var _0x51c2d8={'count':0x0,'rows':[]};return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x42927b[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x120bb3,null))[_0xe44f('0x2e')](function(_0x3ef723){if(_0x3ef723){_0x1e7da6[_0xe44f('0x41')]=_[_0xe44f('0x63')](db[_0xe44f('0x6f')]['rawAttributes']);_0x1e7da6[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x42927b[_0xe44f('0x42')]);_0x1e7da6[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x1e7da6[_0xe44f('0x41')],_0x1e7da6[_0xe44f('0x42')]);_0x42b38e[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x1e7da6[_0xe44f('0x41')],qs['fields'](_0x42927b['query']['fields']));_0x42b38e[_0xe44f('0x44')]=_0x42b38e['attributes']['length']?_0x42b38e[_0xe44f('0x44')]:_0x1e7da6['model'];if(!_0x42927b[_0xe44f('0x42')][_0xe44f('0x48')]('nolimit')){_0x42b38e[_0xe44f('0x25')]=qs['limit'](_0x42927b[_0xe44f('0x42')][_0xe44f('0x25')]);_0x42b38e[_0xe44f('0x28')]=qs[_0xe44f('0x28')](_0x42927b[_0xe44f('0x42')][_0xe44f('0x28')]);}_0x42b38e[_0xe44f('0x6c')]=qs['sort'](_0x42927b[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x42b38e[_0xe44f('0x4b')]=qs['filters'](_[_0xe44f('0x4c')](_0x42927b['query'],_0x1e7da6[_0xe44f('0x43')]));_0x42b38e['where'][_0xe44f('0x6d')]=_0x3ef723['id'];if(_0x42927b[_0xe44f('0x42')][_0xe44f('0x33')]){_0x42b38e[_0xe44f('0x4b')]=_[_0xe44f('0x4e')](_0x42b38e[_0xe44f('0x4b')],{'$or':_[_0xe44f('0x3d')](_0x42b38e['attributes'],function(_0x3734ec){var _0x42487b={};_0x42487b[_0x3734ec]={'$like':'%'+_0x42927b[_0xe44f('0x42')][_0xe44f('0x33')]+'%'};return _0x42487b;})});}_0x42b38e=_[_0xe44f('0x4e')]({},_0x42b38e,_0x42927b[_0xe44f('0x55')]);return db[_0xe44f('0x6f')][_0xe44f('0x27')]({'where':_0x42b38e['where']})[_0xe44f('0x2e')](function(_0x4307d0){_0x51c2d8[_0xe44f('0x27')]=_0x4307d0;if(_0x42927b['query']['includeAll']){_0x42b38e[_0xe44f('0x64')]=[{'all':!![]}];}return db[_0xe44f('0x6f')][_0xe44f('0x50')](_0x42b38e);})['then'](function(_0x1dc1d7){_0x51c2d8['rows']=_0x1dc1d7;return _0x51c2d8;});}})[_0xe44f('0x2e')](respondWithFilteredResult(_0x120bb3,_0x42b38e))[_0xe44f('0x57')](handleError(_0x120bb3,null));};exports[_0xe44f('0x70')]=function(_0x51c000,_0x33df09,_0xc20beb){var _0x265f1d={'raw':!![],'where':{}};var _0x1c6676={};var _0x466c0c={'count':0x0,'rows':[]};return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x51c000['params']['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x33df09,null))[_0xe44f('0x2e')](function(_0x407622){if(_0x407622){_0x1c6676[_0xe44f('0x41')]=_[_0xe44f('0x63')](db['CmHopperBlack'][_0xe44f('0x3e')]);_0x1c6676[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x51c000[_0xe44f('0x42')]);_0x1c6676[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x1c6676['model'],_0x1c6676[_0xe44f('0x42')]);_0x265f1d[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x1c6676[_0xe44f('0x41')],qs['fields'](_0x51c000['query'][_0xe44f('0x46')]));_0x265f1d[_0xe44f('0x44')]=_0x265f1d['attributes'][_0xe44f('0x47')]?_0x265f1d[_0xe44f('0x44')]:_0x1c6676[_0xe44f('0x41')];if(!_0x51c000[_0xe44f('0x42')]['hasOwnProperty']('nolimit')){_0x265f1d[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x51c000[_0xe44f('0x42')][_0xe44f('0x25')]);_0x265f1d['offset']=qs[_0xe44f('0x28')](_0x51c000[_0xe44f('0x42')][_0xe44f('0x28')]);}_0x265f1d['order']=qs[_0xe44f('0x4a')](_0x51c000[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x265f1d['where']=qs[_0xe44f('0x43')](_[_0xe44f('0x4c')](_0x51c000[_0xe44f('0x42')],_0x1c6676[_0xe44f('0x43')]));_0x265f1d[_0xe44f('0x4b')]['VoiceQueueId']=_0x407622['id'];if(_0x51c000[_0xe44f('0x42')][_0xe44f('0x33')]){_0x265f1d[_0xe44f('0x4b')]=_[_0xe44f('0x4e')](_0x265f1d[_0xe44f('0x4b')],{'$or':_[_0xe44f('0x3d')](_0x265f1d[_0xe44f('0x44')],function(_0x595b75){var _0x55c57a={};_0x55c57a[_0x595b75]={'$like':'%'+_0x51c000[_0xe44f('0x42')]['filter']+'%'};return _0x55c57a;})});}_0x265f1d=_['merge']({},_0x265f1d,_0x51c000[_0xe44f('0x55')]);return db['CmHopperBlack'][_0xe44f('0x27')]({'where':_0x265f1d[_0xe44f('0x4b')]})[_0xe44f('0x2e')](function(_0x2a6a50){_0x466c0c[_0xe44f('0x27')]=_0x2a6a50;if(_0x51c000[_0xe44f('0x42')][_0xe44f('0x54')]){_0x265f1d[_0xe44f('0x64')]=[{'all':!![]}];}return db[_0xe44f('0x71')][_0xe44f('0x50')](_0x265f1d);})['then'](function(_0x16eba4){_0x466c0c[_0xe44f('0x51')]=_0x16eba4;return _0x466c0c;});}})[_0xe44f('0x2e')](respondWithFilteredResult(_0x33df09,_0x265f1d))[_0xe44f('0x57')](handleError(_0x33df09,null));};exports[_0xe44f('0x72')]=function(_0x3a27a3,_0x34566a,_0x50afe7){var _0x106adb={};var _0x20c633={};var _0x506ef2;var _0x58ee2c;return db['VoiceQueue']['findOne']({'where':{'id':_0x3a27a3[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x34566a,null))[_0xe44f('0x2e')](function(_0x2e7cb2){if(_0x2e7cb2){_0x506ef2=_0x2e7cb2;_0x20c633['model']=_['keys'](db['Team']['rawAttributes']);_0x20c633[_0xe44f('0x42')]=_['keys'](_0x3a27a3[_0xe44f('0x42')]);_0x20c633['filters']=_['intersection'](_0x20c633[_0xe44f('0x41')],_0x20c633['query']);_0x106adb[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x20c633[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x3a27a3[_0xe44f('0x42')][_0xe44f('0x46')]));_0x106adb[_0xe44f('0x44')]=_0x106adb['attributes'][_0xe44f('0x47')]?_0x106adb['attributes']:_0x20c633[_0xe44f('0x41')];_0x106adb[_0xe44f('0x6c')]=qs[_0xe44f('0x4a')](_0x3a27a3[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x106adb[_0xe44f('0x4b')]=qs[_0xe44f('0x43')](_[_0xe44f('0x4c')](_0x3a27a3[_0xe44f('0x42')],_0x20c633[_0xe44f('0x43')]));if(_0x3a27a3[_0xe44f('0x42')]['filter']){_0x106adb['where']=_[_0xe44f('0x4e')](_0x106adb[_0xe44f('0x4b')],{'$or':_[_0xe44f('0x3d')](_0x106adb[_0xe44f('0x44')],function(_0x1c00f8){var _0x28dbe9={};_0x28dbe9[_0x1c00f8]={'$like':'%'+_0x3a27a3['query']['filter']+'%'};return _0x28dbe9;})});}_0x106adb=_['merge']({},_0x106adb,_0x3a27a3['options']);return _0x506ef2[_0xe44f('0x72')](_0x106adb);}})['then'](function(_0x505435){if(_0x505435){_0x58ee2c=_0x505435['length'];if(!_0x3a27a3['query'][_0xe44f('0x48')](_0xe44f('0x49'))){_0x106adb[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x3a27a3[_0xe44f('0x42')][_0xe44f('0x25')]);_0x106adb[_0xe44f('0x28')]=qs['offset'](_0x3a27a3['query']['offset']);}return _0x506ef2[_0xe44f('0x72')](_0x106adb);}})[_0xe44f('0x2e')](function(_0x1e1fe7){if(_0x1e1fe7){return _0x1e1fe7?{'count':_0x58ee2c,'rows':_0x1e1fe7}:null;}})['then'](respondWithResult(_0x34566a,null))[_0xe44f('0x57')](handleError(_0x34566a,null));};exports[_0xe44f('0x73')]=function(_0xdd0765,_0x4aacc2,_0x2a188e){var _0x4e9e87=_0xdd0765['body'][_0xe44f('0x74')];var _0x594e8f=_['map'](_0x4e9e87,'id');return db['Team'][_0xe44f('0x50')]({'where':{'id':_0x594e8f},'attributes':['id'],'include':[{'model':db[_0xe44f('0x75')],'as':'Agents','attributes':['id',_0xe44f('0x37'),_0xe44f('0x76'),_0xe44f('0x77'),'interface'],'raw':!![]}]})[_0xe44f('0x2e')](function(_0x49185d){if(_0x49185d){var _0x49250a=_['flatMap'](_0x49185d,function(_0x33aad8){var _0x213106=_0x33aad8['get']({'plain':!![]});_0x213106[_0xe44f('0x78')][_0xe44f('0x79')](function(_0x5c6756){_0x5c6756['penalty']=_[_0xe44f('0x56')](_0x4e9e87,{'id':_0x213106['id']})[_0xe44f('0x7a')];});return _0x213106['Agents'];});return db[_0xe44f('0x4f')]['find']({'where':{'id':_0xdd0765[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](function(_0x5aef7b){return db[_0xe44f('0x7b')][_0xe44f('0x7c')](function(_0x2b8b8d){return _0x5aef7b[_0xe44f('0x73')](_0x594e8f,{'transaction':_0x2b8b8d})[_0xe44f('0x2e')](function(){return BPromise[_0xe44f('0x7d')](_0x4e9e87,function(_0x3f8a92){return db[_0xe44f('0x7e')][_0xe44f('0x7f')]({'TeamId':_0x3f8a92['id'],'VoiceQueueId':_0xdd0765[_0xe44f('0x53')]['id'],'penalty':_0x3f8a92[_0xe44f('0x7a')]},{'transaction':_0x2b8b8d});});})[_0xe44f('0x2e')](function(){return BPromise[_0xe44f('0x7d')](_0x49250a,function(_0x2858f0){return db['UserVoiceQueue'][_0xe44f('0x80')]({'where':{'UserId':_0x2858f0['id'],'VoiceQueueId':_0xdd0765[_0xe44f('0x53')]['id']},'defaults':{'penalty':_0x2858f0[_0xe44f('0x7a')]},'transaction':_0x2b8b8d});});})[_0xe44f('0x2e')](function(){return BPromise['each'](_[_0xe44f('0x33')](_0x49250a,{'online':!![]}),function(_0x2ea090){return db[_0xe44f('0x81')]['upsert']({'membername':_0x2ea090[_0xe44f('0x37')],'UserId':_0x2ea090['id'],'queue_name':_0x5aef7b['name'],'VoiceQueueId':_0x5aef7b['id'],'interface':_[_0xe44f('0x82')](_0x2ea090['interface'])?util[_0xe44f('0x83')]('SIP/%s',_0x2ea090[_0xe44f('0x37')]):_0x2ea090[_0xe44f('0x84')],'paused':_0x2ea090[_0xe44f('0x77')]||![],'penalty':_0x2ea090[_0xe44f('0x7a')]},{'transaction':_0x2b8b8d});});})[_0xe44f('0x2e')](function(){_0x49250a[_0xe44f('0x79')](function(_0x5c2f19){socket['emit'](_0xe44f('0x85'),{'UserId':_0x5c2f19['id'],'VoiceQueueId':_0x5aef7b['id']});});});});});}})[_0xe44f('0x2e')](respondWithStatusCode(_0x4aacc2,null))['catch'](handleError(_0x4aacc2,null));};exports[_0xe44f('0x86')]=function(_0x5e55d6,_0xc7a283,_0x4c2714){return db[_0xe44f('0x87')][_0xe44f('0x50')]({'where':{'id':_0x5e55d6[_0xe44f('0x42')][_0xe44f('0x88')]},'attributes':['id'],'include':[{'model':db[_0xe44f('0x75')],'as':_0xe44f('0x78'),'attributes':['id'],'raw':!![]}]})[_0xe44f('0x2e')](handleEntityNotFound(_0xc7a283,null))[_0xe44f('0x2e')](function(_0x1bb401){var _0x168014=_[_0xe44f('0x3d')](_0x1bb401,'id');var _0x50cb72=[];var _0x1d0ebd=[];var _0x16d9ca=squel['select']();_0x16d9ca[_0xe44f('0x89')](_0xe44f('0x8a'))[_0xe44f('0x8b')](_0xe44f('0x8c'),'tq')[_0xe44f('0x8d')](_0xe44f('0x8e'),'ut',_0xe44f('0x8f'))['where'](_0xe44f('0x90'),_0x5e55d6[_0xe44f('0x53')]['id']);for(var _0x5eaad2=0x0;_0x5eaad2<_0x1bb401['length'];_0x5eaad2+=0x1){let _0x2852d=_0x1bb401[_0x5eaad2];for(var _0xe81615=0x0;_0xe81615<_0x2852d[_0xe44f('0x78')][_0xe44f('0x47')];_0xe81615+=0x1){let _0x27556f=_0x2852d[_0xe44f('0x78')][_0xe81615];var _0x97e831=_0x16d9ca[_0xe44f('0x62')]();_0x97e831[_0xe44f('0x4b')](_0xe44f('0x91'),_0x27556f['id']);_0x1d0ebd[_0xe44f('0x92')](db[_0xe44f('0x7b')][_0xe44f('0x42')](_0x97e831[_0xe44f('0x93')](),{'type':db['sequelize'][_0xe44f('0x94')][_0xe44f('0x95')]})['then'](function(_0xd722cb){if(_0xd722cb['length']===0x1){return _0x27556f['id'];}else{var _0x5221e0=_['every'](_[_0xe44f('0x3d')](_0xd722cb,_0xe44f('0x96')),function(_0x4b1c3b){return _['includes'](_0x168014,_0x4b1c3b);});if(_0x5221e0){return _0x27556f['id'];}}}));}}return BPromise['all'](_0x1d0ebd)[_0xe44f('0x2e')](function(_0x5c2fd3){_0x50cb72=_(_0x50cb72)['union'](_0x5c2fd3)[_0xe44f('0x97')]()['value']();return db[_0xe44f('0x4f')]['find']({'where':{'id':_0x5e55d6[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](function(_0x392d9d){return db[_0xe44f('0x7b')][_0xe44f('0x7c')](function(_0x3b362a){return _0x392d9d['removeTeams'](_0x5e55d6[_0xe44f('0x42')]['ids'],{'transaction':_0x3b362a})[_0xe44f('0x2e')](function(){if(!_['isEmpty'](_0x50cb72)){return _0x392d9d[_0xe44f('0x98')](_0x50cb72,{'transaction':_0x3b362a})['then'](function(){return db[_0xe44f('0x81')][_0xe44f('0x2f')]({'where':{'VoiceQueueId':_0x5e55d6[_0xe44f('0x53')]['id'],'UserId':_0x50cb72},'transaction':_0x3b362a});});}})[_0xe44f('0x2e')](function(){_0x50cb72[_0xe44f('0x79')](function(_0x52d525){socket[_0xe44f('0x99')](_0xe44f('0x9a'),{'UserId':_0x52d525,'VoiceQueueId':_0x392d9d['id']});});});});});});})[_0xe44f('0x2e')](respondWithStatusCode(_0xc7a283,null))[_0xe44f('0x57')](handleError(_0xc7a283,null));};exports[_0xe44f('0x9b')]=function(_0x3cb252,_0x49dc2d,_0x2fe030){var _0x59fbb1,_0x1d6cea;return db['VoiceQueue'][_0xe44f('0x56')]({'where':{'id':_0x3cb252['params']['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x49dc2d,null))[_0xe44f('0x2e')](function(_0x36985e){if(_0x36985e){_0x1d6cea=_0x36985e;return _0x36985e[_0xe44f('0x9b')](_0x3cb252[_0xe44f('0x59')][_0xe44f('0x88')],_[_0xe44f('0x66')](_0x3cb252[_0xe44f('0x59')],['ids','id'])||{})[_0xe44f('0x9c')](function(_0x3fb087){for(var _0x195fed=0x0;_0x195fed<_0x3cb252[_0xe44f('0x59')][_0xe44f('0x88')][_0xe44f('0x47')];_0x195fed+=0x1){socket[_0xe44f('0x99')](_0xe44f('0x85'),{'UserId':Number(_0x3cb252['body']['ids'][_0x195fed]),'VoiceQueueId':Number(_0x3cb252[_0xe44f('0x53')]['id'])});}return _0x3fb087;});}})[_0xe44f('0x2e')](function(_0x4d04cc){_0x59fbb1=_0x4d04cc||[];if(_0x1d6cea){return db[_0xe44f('0x75')]['findAll']({'where':{'id':_0x3cb252[_0xe44f('0x59')][_0xe44f('0x88')]},'attributes':['id','name',_0xe44f('0x76'),_0xe44f('0x77'),'interface'],'raw':!![]});}})[_0xe44f('0x2e')](function(_0x2d863c){if(!_['isEmpty'](_0x2d863c)){var _0x2f0494=[];for(var _0x218cc7=0x0;_0x218cc7<_0x2d863c[_0xe44f('0x47')];_0x218cc7++){if(_0x2d863c[_0x218cc7]['online']){_0x2f0494['push'](db[_0xe44f('0x81')][_0xe44f('0x7f')]({'membername':_0x2d863c[_0x218cc7][_0xe44f('0x37')],'UserId':_0x2d863c[_0x218cc7]['id'],'queue_name':_0x1d6cea[_0xe44f('0x37')],'VoiceQueueId':_0x1d6cea['id'],'interface':_[_0xe44f('0x82')](_0x2d863c[_0x218cc7][_0xe44f('0x84')])?util[_0xe44f('0x83')]('SIP/%s',_0x2d863c[_0x218cc7]['name']):_0x2d863c[_0x218cc7][_0xe44f('0x84')],'paused':_0x2d863c[_0x218cc7][_0xe44f('0x77')]||![],'penalty':_0x3cb252[_0xe44f('0x59')]['penalty']||0x0}));}}return BPromise['all'](_0x2f0494);}})['then'](function(){return _0x59fbb1;})[_0xe44f('0x2e')](respondWithResult(_0x49dc2d,null))[_0xe44f('0x57')](handleError(_0x49dc2d,null));};exports[_0xe44f('0x98')]=function(_0x41ab34,_0x5eee9c,_0x272259){return db[_0xe44f('0x4f')]['find']({'where':{'id':_0x41ab34[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x5eee9c,null))[_0xe44f('0x2e')](function(_0x1dbc1e){if(_0x1dbc1e){return _0x1dbc1e[_0xe44f('0x98')](_0x41ab34[_0xe44f('0x42')][_0xe44f('0x88')])[_0xe44f('0x2e')](function(){if(_[_0xe44f('0x9d')](_0x41ab34['query']['ids'])){for(var _0x4167c8=0x0;_0x4167c8<_0x41ab34['query'][_0xe44f('0x88')][_0xe44f('0x47')];_0x4167c8+=0x1){socket[_0xe44f('0x99')]('userVoiceQueue:remove',{'UserId':Number(_0x41ab34[_0xe44f('0x42')][_0xe44f('0x88')][_0x4167c8]),'VoiceQueueId':Number(_0x41ab34[_0xe44f('0x53')]['id'])});}}else{socket[_0xe44f('0x99')](_0xe44f('0x9a'),{'UserId':Number(_0x41ab34[_0xe44f('0x42')]['ids']),'VoiceQueueId':Number(_0x41ab34['params']['id'])});}});}})[_0xe44f('0x2e')](function(_0x481b9a){return db['UserVoiceQueueRt'][_0xe44f('0x2f')]({'where':{'VoiceQueueId':_0x41ab34[_0xe44f('0x53')]['id'],'UserId':_0x41ab34['query'][_0xe44f('0x88')]}})[_0xe44f('0x2e')](function(){return _0x481b9a;});})[_0xe44f('0x2e')](respondWithStatusCode(_0x5eee9c,null))[_0xe44f('0x57')](handleError(_0x5eee9c,null));};exports[_0xe44f('0x9e')]=function(_0x21025e,_0x2c39b1,_0x2b9503){var _0xab3708={};var _0x161488={};var _0x5d2b1d;var _0x182c03;return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x21025e[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x2c39b1,null))[_0xe44f('0x2e')](function(_0x2c9cac){if(_0x2c9cac){_0x5d2b1d=_0x2c9cac;_0x161488[_0xe44f('0x41')]=_[_0xe44f('0x63')](db[_0xe44f('0x75')][_0xe44f('0x3e')]);_0x161488['query']=_['keys'](_0x21025e[_0xe44f('0x42')]);_0x161488[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x161488[_0xe44f('0x41')],_0x161488['query']);_0xab3708[_0xe44f('0x44')]=_['intersection'](_0x161488[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x21025e['query'][_0xe44f('0x46')]));_0xab3708[_0xe44f('0x44')]=_0xab3708[_0xe44f('0x44')][_0xe44f('0x47')]?_0xab3708[_0xe44f('0x44')]:_0x161488[_0xe44f('0x41')];_0xab3708[_0xe44f('0x6c')]=qs[_0xe44f('0x4a')](_0x21025e[_0xe44f('0x42')][_0xe44f('0x4a')]);_0xab3708['where']=qs['filters'](_[_0xe44f('0x4c')](_0x21025e[_0xe44f('0x42')],_0x161488[_0xe44f('0x43')]));if(_0x21025e[_0xe44f('0x42')]['filter']){_0xab3708['where']=_[_0xe44f('0x4e')](_0xab3708['where'],{'$or':_[_0xe44f('0x3d')](_0xab3708[_0xe44f('0x44')],function(_0x414fcb){var _0x5ed1bf={};_0x5ed1bf[_0x414fcb]={'$like':'%'+_0x21025e[_0xe44f('0x42')][_0xe44f('0x33')]+'%'};return _0x5ed1bf;})});}_0xab3708=_[_0xe44f('0x4e')]({},_0xab3708,_0x21025e[_0xe44f('0x55')]);return _0x5d2b1d['getAgents'](_0xab3708);}})[_0xe44f('0x2e')](function(_0x5958eb){if(_0x5958eb){_0x182c03=_0x5958eb[_0xe44f('0x47')];if(!_0x21025e[_0xe44f('0x42')][_0xe44f('0x48')](_0xe44f('0x49'))){_0xab3708[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x21025e[_0xe44f('0x42')]['limit']);_0xab3708['offset']=qs[_0xe44f('0x28')](_0x21025e[_0xe44f('0x42')]['offset']);}return _0x5d2b1d[_0xe44f('0x9e')](_0xab3708);}})[_0xe44f('0x2e')](function(_0x4a948b){if(_0x4a948b){return _0x4a948b?{'count':_0x182c03,'rows':_0x4a948b}:null;}})['then'](respondWithResult(_0x2c39b1,null))[_0xe44f('0x57')](handleError(_0x2c39b1,null));};exports[_0xe44f('0x9f')]=function(_0x4b2aa0,_0x390d0f,_0x47d131){var _0x189cdb={};var _0x3175a0={};var _0x459e51;var _0x33e243;return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x4b2aa0['params']['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x390d0f,null))[_0xe44f('0x2e')](function(_0xb88ccc){if(_0xb88ccc){_0x459e51=_0xb88ccc;_0x3175a0[_0xe44f('0x41')]=_[_0xe44f('0x63')](db[_0xe44f('0x81')]['rawAttributes']);_0x3175a0[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x4b2aa0[_0xe44f('0x42')]);_0x3175a0[_0xe44f('0x43')]=_['intersection'](_0x3175a0[_0xe44f('0x41')],_0x3175a0[_0xe44f('0x42')]);_0x189cdb['attributes']=_[_0xe44f('0x45')](_0x3175a0['model'],qs['fields'](_0x4b2aa0[_0xe44f('0x42')]['fields']));_0x189cdb[_0xe44f('0x44')]=_0x189cdb[_0xe44f('0x44')]['length']?_0x189cdb['attributes']:_0x3175a0[_0xe44f('0x41')];_0x189cdb[_0xe44f('0x6c')]=qs[_0xe44f('0x4a')](_0x4b2aa0[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x189cdb['where']=qs['filters'](_[_0xe44f('0x4c')](_0x4b2aa0[_0xe44f('0x42')],_0x3175a0['filters']));if(_0x4b2aa0['query'][_0xe44f('0x33')]){_0x189cdb[_0xe44f('0x4b')]=_[_0xe44f('0x4e')](_0x189cdb[_0xe44f('0x4b')],{'$or':_['map'](_0x189cdb['attributes'],function(_0x5cec58){var _0x4dbd8b={};_0x4dbd8b[_0x5cec58]={'$like':'%'+_0x4b2aa0['query']['filter']+'%'};return _0x4dbd8b;})});}_0x189cdb=_['merge']({},_0x189cdb,_0x4b2aa0[_0xe44f('0x55')]);return _0x459e51['getMembers'](_0x189cdb);}})[_0xe44f('0x2e')](function(_0x3399d0){if(_0x3399d0){_0x33e243=_0x3399d0['length'];if(!_0x4b2aa0['query'][_0xe44f('0x48')](_0xe44f('0x49'))){_0x189cdb['limit']=qs['limit'](_0x4b2aa0[_0xe44f('0x42')][_0xe44f('0x25')]);_0x189cdb['offset']=qs[_0xe44f('0x28')](_0x4b2aa0[_0xe44f('0x42')]['offset']);}return _0x459e51[_0xe44f('0x9f')](_0x189cdb);}})[_0xe44f('0x2e')](function(_0x13047c){return _0x13047c?{'count':_0x33e243,'rows':_0x13047c}:null;})[_0xe44f('0x2e')](respondWithResult(_0x390d0f,null))[_0xe44f('0x57')](handleError(_0x390d0f,null));};exports[_0xe44f('0xa0')]=function(_0x4863be,_0x302b0c,_0x39d94d){var _0x37216d={};var _0x3611f2={};var _0x14ab47;var _0x198e05;return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x4863be[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x302b0c,null))[_0xe44f('0x2e')](function(_0x13233e){if(_0x13233e){_0x14ab47=_0x13233e;_0x3611f2['model']=_['keys'](db[_0xe44f('0xa1')][_0xe44f('0x3e')]);_0x3611f2[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x4863be[_0xe44f('0x42')]);_0x3611f2[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x3611f2[_0xe44f('0x41')],_0x3611f2[_0xe44f('0x42')]);_0x37216d[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x3611f2[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x4863be[_0xe44f('0x42')][_0xe44f('0x46')]));_0x37216d[_0xe44f('0x44')]=_0x37216d[_0xe44f('0x44')][_0xe44f('0x47')]?_0x37216d['attributes']:_0x3611f2[_0xe44f('0x41')];_0x37216d[_0xe44f('0x6c')]=qs[_0xe44f('0x4a')](_0x4863be[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x37216d[_0xe44f('0x4b')]=qs['filters'](_[_0xe44f('0x4c')](_0x4863be[_0xe44f('0x42')],_0x3611f2['filters']));if(_0x4863be['query'][_0xe44f('0x33')]){_0x37216d[_0xe44f('0x4b')]=_[_0xe44f('0x4e')](_0x37216d[_0xe44f('0x4b')],{'$or':_[_0xe44f('0x3d')](_0x37216d[_0xe44f('0x44')],function(_0x4a9821){var _0x355cef={};_0x355cef[_0x4a9821]={'$like':'%'+_0x4863be[_0xe44f('0x42')][_0xe44f('0x33')]+'%'};return _0x355cef;})});}_0x37216d=_['merge']({},_0x37216d,_0x4863be['options']);return _0x14ab47[_0xe44f('0xa0')](_0x37216d);}})['then'](function(_0x1f984f){if(_0x1f984f){_0x198e05=_0x1f984f[_0xe44f('0x47')];if(!_0x4863be[_0xe44f('0x42')]['hasOwnProperty'](_0xe44f('0x49'))){_0x37216d[_0xe44f('0x25')]=qs['limit'](_0x4863be[_0xe44f('0x42')]['limit']);_0x37216d[_0xe44f('0x28')]=qs[_0xe44f('0x28')](_0x4863be[_0xe44f('0x42')]['offset']);}return _0x14ab47['getLists'](_0x37216d);}})[_0xe44f('0x2e')](function(_0x145074){if(_0x145074){return _0x145074?{'count':_0x198e05,'rows':_0x145074}:null;}})['then'](respondWithResult(_0x302b0c,null))[_0xe44f('0x57')](handleError(_0x302b0c,null));};exports['addLists']=function(_0x4fcd74,_0x1de813,_0x24881e){var _0x412e0c=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2c74c6,_0x1a8726;return db['VoiceQueue'][_0xe44f('0x56')]({'where':{'id':_0x4fcd74[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x1de813,null))[_0xe44f('0x2e')](function(_0x25bf51){if(_0x25bf51){_0x1a8726=_0x25bf51;return _0x25bf51['addLists'](_0x4fcd74[_0xe44f('0x59')][_0xe44f('0x88')],_[_0xe44f('0x66')](_0x4fcd74['body'],[_0xe44f('0x88'),'id'])||{});}return null;})[_0xe44f('0x9c')](function(_0x55ad98){var _0x299e92;_0x2c74c6=_0x55ad98||[];var _0x58fa64=[];if(_0x55ad98){for(var _0x2e5166=0x0;_0x2e5166<_0x55ad98[_0xe44f('0x47')];_0x2e5166+=0x1){var _0x1f453b=_0x55ad98[_0x2e5166][_0xe44f('0x30')]({'plain':!![]});_0x1a8726['dialCheckDuplicateType']=_0x4fcd74['body'][_0xe44f('0xa2')]?_0x4fcd74[_0xe44f('0x59')][_0xe44f('0xa2')]:_0x1a8726[_0xe44f('0xa2')];switch(_0x1a8726[_0xe44f('0xa2')]){case _0xe44f('0xa3'):_0x299e92=squel[_0xe44f('0xa4')]()[_0xe44f('0xa5')]('cm_hopper')[_0xe44f('0xa6')]([_0xe44f('0xa7'),_0xe44f('0xa8'),_0xe44f('0xa9'),_0xe44f('0xaa'),_0xe44f('0x6d'),_0xe44f('0x67'),'updatedAt'],squel['select']()['field'](_0xe44f('0xa7'),_0xe44f('0xa7'))['field']('\x27'+_0x412e0c+'\x27',_0xe44f('0xa8'))['field']('id',_0xe44f('0xa9'))[_0xe44f('0x89')](_0x1f453b[_0xe44f('0xab')]['toString'](),_0xe44f('0xaa'))[_0xe44f('0x89')](_0x4fcd74[_0xe44f('0x53')]['id'][_0xe44f('0x93')](),_0xe44f('0x6d'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x67'))['field']('\x27'+_0x412e0c+'\x27',_0xe44f('0x65'))[_0xe44f('0x8b')]('cm_contacts')[_0xe44f('0x4b')](_0xe44f('0xac'))['where'](_0xe44f('0xad'),_0x1f453b[_0xe44f('0xab')]['toString']())[_0xe44f('0x4b')](_0xe44f('0xae'))[_0xe44f('0x4b')](_0xe44f('0xaf'),squel['select']()[_0xe44f('0x89')](_0xe44f('0xb0'))['from'](_0xe44f('0xb1'))[_0xe44f('0x4b')]('VoiceQueueId\x20=\x20?',_0x4fcd74[_0xe44f('0x53')]['id']['toString']()))['where'](_0xe44f('0xaf'),squel[_0xe44f('0xb2')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0xe44f('0xb3'))[_0xe44f('0x4b')](_0xe44f('0x90'),_0x4fcd74['params']['id'][_0xe44f('0x93')]())))[_0xe44f('0x93')]();break;case _0xe44f('0xb4'):_0x299e92=squel[_0xe44f('0xa4')]()[_0xe44f('0xa5')]('cm_hopper')['fromQuery']([_0xe44f('0xa7'),_0xe44f('0xa8'),_0xe44f('0xa9'),'ListId',_0xe44f('0x6d'),_0xe44f('0x67'),_0xe44f('0x65')],squel[_0xe44f('0xb2')]()[_0xe44f('0x89')](_0xe44f('0xa7'),_0xe44f('0xa7'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0xa8'))[_0xe44f('0x89')]('id',_0xe44f('0xa9'))[_0xe44f('0x89')](_0x1f453b[_0xe44f('0xab')][_0xe44f('0x93')](),'ListId')[_0xe44f('0x89')](_0x4fcd74[_0xe44f('0x53')]['id'][_0xe44f('0x93')](),_0xe44f('0x6d'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27','createdAt')[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x65'))[_0xe44f('0x8b')]('cm_contacts')[_0xe44f('0x4b')](_0xe44f('0xac'))[_0xe44f('0x4b')]('ListId\x20=\x20?',_0x1f453b['CmListId'][_0xe44f('0x93')]())[_0xe44f('0x4b')](_0xe44f('0xae'))[_0xe44f('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe44f('0xb2')]()[_0xe44f('0x89')](_0xe44f('0xb5'))[_0xe44f('0x8b')](_0xe44f('0xb3'))['where'](_0xe44f('0x90'),_0x4fcd74[_0xe44f('0x53')]['id'][_0xe44f('0x93')]())))[_0xe44f('0x93')]();break;default:_0x299e92=squel[_0xe44f('0xa4')]()[_0xe44f('0xa5')](_0xe44f('0xb3'))['fromQuery'](['phone',_0xe44f('0xa8'),_0xe44f('0xa9'),_0xe44f('0xaa'),_0xe44f('0x6d'),_0xe44f('0x67'),_0xe44f('0x65')],squel[_0xe44f('0xb2')]()['field']('phone',_0xe44f('0xa7'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0xa8'))[_0xe44f('0x89')]('id',_0xe44f('0xa9'))[_0xe44f('0x89')](_0x1f453b[_0xe44f('0xab')][_0xe44f('0x93')](),_0xe44f('0xaa'))[_0xe44f('0x89')](_0x4fcd74['params']['id'][_0xe44f('0x93')](),_0xe44f('0x6d'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x67'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x65'))['from'](_0xe44f('0xb6'))[_0xe44f('0x4b')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x1f453b[_0xe44f('0xab')][_0xe44f('0x93')]())[_0xe44f('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0xe44f('0x93')]();}_0x58fa64['push'](db[_0xe44f('0x7b')][_0xe44f('0x42')](_0x299e92));}return BPromise[_0xe44f('0xb7')](_0x58fa64);}})['then'](function(){var _0x10d8e5=[];var _0x2399a1=squel['insert']()[_0xe44f('0xa5')](_0xe44f('0xb8'))[_0xe44f('0xa6')]([_0xe44f('0xb9'),'phone','OrderBy',_0xe44f('0x67'),'updatedAt'],squel[_0xe44f('0xb2')]()[_0xe44f('0x89')](_0xe44f('0xba'))['field']('ci.item')[_0xe44f('0x89')](_0xe44f('0xbb'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x67'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x65'))[_0xe44f('0x8b')](_0xe44f('0xbc'),'ci')[_0xe44f('0x8d')](_0xe44f('0xb3'),'h','h.ContactId=ci.CmContactId')['where'](_0xe44f('0xbd'),_0x412e0c)[_0xe44f('0x4b')](_0xe44f('0xbe'),_0xe44f('0xbf')))[_0xe44f('0x93')]();_0x10d8e5[_0xe44f('0x92')](db[_0xe44f('0x7b')][_0xe44f('0x42')](_0x2399a1));return BPromise[_0xe44f('0xb7')](_0x10d8e5);})[_0xe44f('0x2e')](function(){return _0x2c74c6;})[_0xe44f('0x2e')](respondWithResult(_0x1de813,null))['catch'](handleError(_0x1de813,null));};exports['removeLists']=function(_0xea3335,_0x18678b,_0x13a70a){return db[_0xe44f('0x4f')][_0xe44f('0x56')]({'where':{'id':_0xea3335[_0xe44f('0x53')]['id']}})['then'](handleEntityNotFound(_0x18678b,null))[_0xe44f('0x2e')](function(_0x268cef){if(_0x268cef){return _0x268cef['removeLists'](_0xea3335[_0xe44f('0x42')]['ids']);}})[_0xe44f('0x2e')](function(_0x1285bf){if(_0x1285bf){return db[_0xe44f('0x6a')][_0xe44f('0x2f')]({'where':{'ListId':_0xea3335[_0xe44f('0x42')][_0xe44f('0x88')],'VoiceQueueId':_0xea3335[_0xe44f('0x53')]['id']}})['then'](function(){return _0x1285bf;});}})[_0xe44f('0x2e')](respondWithStatusCode(_0x18678b,null))[_0xe44f('0x57')](handleError(_0x18678b,null));};exports['getBlackLists']=function(_0x11e034,_0x4fc730,_0x1e01d8){var _0x17a42f={};var _0x2b1953={};var _0x227daa;var _0x5d1b7e;return db['VoiceQueue']['findOne']({'where':{'id':_0x11e034[_0xe44f('0x53')]['id']}})['then'](handleEntityNotFound(_0x4fc730,null))['then'](function(_0x3f4f){if(_0x3f4f){_0x227daa=_0x3f4f;_0x2b1953[_0xe44f('0x41')]=_[_0xe44f('0x63')](db['CmList'][_0xe44f('0x3e')]);_0x2b1953[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x11e034[_0xe44f('0x42')]);_0x2b1953[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x2b1953[_0xe44f('0x41')],_0x2b1953[_0xe44f('0x42')]);_0x17a42f[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x2b1953['model'],qs[_0xe44f('0x46')](_0x11e034[_0xe44f('0x42')]['fields']));_0x17a42f['attributes']=_0x17a42f[_0xe44f('0x44')][_0xe44f('0x47')]?_0x17a42f[_0xe44f('0x44')]:_0x2b1953[_0xe44f('0x41')];_0x17a42f['order']=qs[_0xe44f('0x4a')](_0x11e034['query'][_0xe44f('0x4a')]);_0x17a42f[_0xe44f('0x4b')]=qs['filters'](_['pick'](_0x11e034[_0xe44f('0x42')],_0x2b1953[_0xe44f('0x43')]));if(_0x11e034['query'][_0xe44f('0x33')]){_0x17a42f[_0xe44f('0x4b')]=_['merge'](_0x17a42f[_0xe44f('0x4b')],{'$or':_[_0xe44f('0x3d')](_0x17a42f[_0xe44f('0x44')],function(_0x368934){var _0x305d62={};_0x305d62[_0x368934]={'$like':'%'+_0x11e034[_0xe44f('0x42')][_0xe44f('0x33')]+'%'};return _0x305d62;})});}_0x17a42f=_['merge']({},_0x17a42f,_0x11e034[_0xe44f('0x55')]);return _0x227daa[_0xe44f('0xc0')](_0x17a42f);}})[_0xe44f('0x2e')](function(_0x5b4fae){if(_0x5b4fae){_0x5d1b7e=_0x5b4fae[_0xe44f('0x47')];if(!_0x11e034['query'][_0xe44f('0x48')](_0xe44f('0x49'))){_0x17a42f[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x11e034[_0xe44f('0x42')][_0xe44f('0x25')]);_0x17a42f[_0xe44f('0x28')]=qs[_0xe44f('0x28')](_0x11e034[_0xe44f('0x42')][_0xe44f('0x28')]);}return _0x227daa[_0xe44f('0xc0')](_0x17a42f);}})['then'](function(_0x225b20){if(_0x225b20){return _0x225b20?{'count':_0x5d1b7e,'rows':_0x225b20}:null;}})['then'](respondWithResult(_0x4fc730,null))['catch'](handleError(_0x4fc730,null));};exports[_0xe44f('0xc1')]=function(_0x2b88f0,_0x11abbf,_0x45bf04){var _0x381cc2,_0x587492;return db[_0xe44f('0x4f')][_0xe44f('0x56')]({'where':{'id':_0x2b88f0[_0xe44f('0x53')]['id']}})['then'](handleEntityNotFound(_0x11abbf,null))['then'](function(_0x45ca00){if(_0x45ca00){_0x587492=_0x45ca00;return _0x45ca00[_0xe44f('0xc1')](_0x2b88f0[_0xe44f('0x59')][_0xe44f('0x88')],_[_0xe44f('0x66')](_0x2b88f0[_0xe44f('0x59')],[_0xe44f('0x88'),'id'])||{});}return null;})[_0xe44f('0x9c')](function(_0x47984f){var _0x408fbb;_0x381cc2=_0x47984f||[];var _0x39f07b=[];if(_0x47984f){for(var _0xcd315e=0x0;_0xcd315e<_0x47984f['length'];_0xcd315e+=0x1){var _0x448cd9=_0x47984f[_0xcd315e][_0xe44f('0x30')]({'plain':!![]});_0x408fbb=squel['insert']()[_0xe44f('0xa5')]('cm_hopper_black')[_0xe44f('0xa6')](['phone',_0xe44f('0xa9'),_0xe44f('0xaa'),_0xe44f('0x6d'),'createdAt','updatedAt'],squel[_0xe44f('0xb2')]()[_0xe44f('0x89')]('phone',_0xe44f('0xa7'))[_0xe44f('0x89')]('id','ContactId')[_0xe44f('0x89')](_0x448cd9[_0xe44f('0xab')][_0xe44f('0x93')](),'ListId')['field'](_0x2b88f0['params']['id'][_0xe44f('0x93')](),_0xe44f('0x6d'))['field']('NOW()',_0xe44f('0x67'))[_0xe44f('0x89')](_0xe44f('0xc2'),_0xe44f('0x65'))[_0xe44f('0x8b')](_0xe44f('0xb6'))[_0xe44f('0x4b')](_0xe44f('0xac'))['where']('ListId\x20=\x20?',_0x448cd9[_0xe44f('0xab')][_0xe44f('0x93')]())[_0xe44f('0x4b')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x39f07b['push'](db['sequelize'][_0xe44f('0x42')](_0x408fbb));}return BPromise[_0xe44f('0xb7')](_0x39f07b);}})[_0xe44f('0x2e')](function(){return _0x381cc2;})[_0xe44f('0x2e')](respondWithResult(_0x11abbf,null))[_0xe44f('0x57')](handleError(_0x11abbf,null));};exports[_0xe44f('0xc3')]=function(_0x439adf,_0x27480a,_0x1a1810){return db[_0xe44f('0x4f')][_0xe44f('0x56')]({'where':{'id':_0x439adf[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x27480a,null))[_0xe44f('0x2e')](function(_0x3f54a6){if(_0x3f54a6){return _0x3f54a6['removeBlackLists'](_0x439adf['query'][_0xe44f('0x88')]);}})['then'](function(_0x184667){if(_0x184667){return db[_0xe44f('0x71')][_0xe44f('0x2f')]({'where':{'ListId':_0x439adf['query'][_0xe44f('0x88')],'VoiceQueueId':_0x439adf[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](function(){return _0x184667;});}})[_0xe44f('0x2e')](respondWithStatusCode(_0x27480a,null))['catch'](handleError(_0x27480a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index de18d08..2c6a9f7 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 _0x0722=['events','../../mysqldb','setMaxListeners','update','remove','hasOwnProperty','hook','exports'];(function(_0xa2ac9,_0xf07f28){var _0x690e9b=function(_0x5b2582){while(--_0x5b2582){_0xa2ac9['push'](_0xa2ac9['shift']());}};_0x690e9b(++_0xf07f28);}(_0x0722,0x1b0));var _0x2072=function(_0x3d0dd5,_0x56279d){_0x3d0dd5=_0x3d0dd5-0x0;var _0x404dc2=_0x0722[_0x3d0dd5];return _0x404dc2;};'use strict';var EventEmitter=require(_0x2072('0x0'));var VoiceQueue=require(_0x2072('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2072('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2072('0x3'),'afterDestroy':_0x2072('0x4')};function emitEvent(_0x3e00d7){return function(_0x5c417e,_0x1f3a4a,_0x13c947){VoiceQueueEvents['emit'](_0x3e00d7+':'+_0x5c417e['id'],_0x5c417e);VoiceQueueEvents['emit'](_0x3e00d7,_0x5c417e);_0x13c947(null);};}for(var e in events){if(events[_0x2072('0x5')](e)){var event=events[e];VoiceQueue[_0x2072('0x6')](e,emitEvent(event));}}module[_0x2072('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xe559=['VoiceQueue','setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x43b150,_0x109558){var _0xe7aec9=function(_0x553c54){while(--_0x553c54){_0x43b150['push'](_0x43b150['shift']());}};_0xe7aec9(++_0x109558);}(_0xe559,0x8e));var _0x9e55=function(_0x4ae0ec,_0x589587){_0x4ae0ec=_0x4ae0ec-0x0;var _0x1ab6c5=_0xe559[_0x4ae0ec];return _0x1ab6c5;};'use strict';var EventEmitter=require(_0x9e55('0x0'));var VoiceQueue=require(_0x9e55('0x1'))['db'][_0x9e55('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9e55('0x3')](0x0);var events={'afterCreate':_0x9e55('0x4'),'afterUpdate':'update','afterDestroy':_0x9e55('0x5')};function emitEvent(_0x4eb62a){return function(_0x54b484,_0x1772ad,_0xff2780){VoiceQueueEvents[_0x9e55('0x6')](_0x4eb62a+':'+_0x54b484['id'],_0x54b484);VoiceQueueEvents[_0x9e55('0x6')](_0x4eb62a,_0x54b484);_0xff2780(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x9e55('0x7')](e,emitEvent(event));}}module[_0x9e55('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index a8f02f8..0757608 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0xbe2952,_0x2b75ce){var _0x24dad4=function(_0x343cb6){while(--_0x343cb6){_0xbe2952['push'](_0xbe2952['shift']());}};_0x24dad4(++_0x2b75ce);}(_0x70e0,0x17b));var _0x070e=function(_0x2a97ad,_0x42ac68){_0x2a97ad=_0x2a97ad-0x0;var _0x12bbe5=_0x70e0[_0x2a97ad];return _0x12bbe5;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x40fa00,_0x1fbb3f){var _0x2f2426=function(_0x18e6ee){while(--_0x18e6ee){_0x40fa00['push'](_0x40fa00['shift']());}};_0x2f2426(++_0x1fbb3f);}(_0x70e0,0x17b));var _0x070e=function(_0x185790,_0x5d0393){_0x185790=_0x185790-0x0;var _0x4e9074=_0x70e0[_0x185790];return _0x4e9074;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index b1cb7ea..77ae6a1 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 _0xafbf=['request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','include','model','attributes','map','then','find','raw','ShowVoiceQueue','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','VoiceQueue,\x20%s,\x20%s'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0xafbf,0x1cf));var _0xfafb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xafbf[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xfafb('0x0'));var moment=require(_0xfafb('0x1'));var BPromise=require(_0xfafb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfafb('0x3'));var db=require(_0xfafb('0x4'))['db'];var utils=require(_0xfafb('0x5'));var logger=require('../../config/logger')(_0xfafb('0x6'));var config=require(_0xfafb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfafb('0x8')][_0xfafb('0x9')]({'port':0x232a});config[_0xfafb('0xa')]=_[_0xfafb('0xb')](config['redis'],{'host':_0xfafb('0xc'),'port':0x18eb});var socket=require(_0xfafb('0xd'))(new Redis(config[_0xfafb('0xa')]));require('./voiceQueue.socket')[_0xfafb('0xe')](socket);function respondWithRpcPromise(_0x49b9c1,_0x1377da,_0x7e84de){return new BPromise(function(_0x350e7c,_0x55c3d9){return client['request'](_0x49b9c1,_0x7e84de)['then'](function(_0x10bd5c){logger[_0xfafb('0xf')](_0xfafb('0x10'),_0x1377da,_0xfafb('0x11'));logger['debug'](_0xfafb('0x12'),_0x1377da,'request\x20sent',JSON[_0xfafb('0x13')](_0x10bd5c));if(_0x10bd5c['error']){if(_0x10bd5c[_0xfafb('0x14')][_0xfafb('0x15')]===0x1f4){logger[_0xfafb('0x14')](_0xfafb('0x10'),_0x1377da,_0x10bd5c['error'][_0xfafb('0x16')]);return _0x55c3d9(_0x10bd5c[_0xfafb('0x14')][_0xfafb('0x16')]);}logger['error'](_0xfafb('0x10'),_0x1377da,_0x10bd5c[_0xfafb('0x14')][_0xfafb('0x16')]);return _0x350e7c(_0x10bd5c['error'][_0xfafb('0x16')]);}else{logger[_0xfafb('0xf')](_0xfafb('0x10'),_0x1377da,_0xfafb('0x11'));_0x350e7c(_0x10bd5c[_0xfafb('0x17')][_0xfafb('0x16')]);}})[_0xfafb('0x18')](function(_0x58c591){logger[_0xfafb('0x14')](_0xfafb('0x10'),_0x1377da,_0x58c591);_0x55c3d9(_0x58c591);});});}exports[_0xfafb('0x19')]=function(_0xc3ab76){var _0x1609db=this;return new Promise(function(_0x4a4333,_0x5e93e9){return db[_0xfafb('0x1a')][_0xfafb('0x1b')]({'raw':_0xc3ab76[_0xfafb('0x1c')]?_0xc3ab76[_0xfafb('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xc3ab76[_0xfafb('0x1c')]?_0xc3ab76[_0xfafb('0x1c')][_0xfafb('0x1d')]||null:null,'attributes':_0xc3ab76[_0xfafb('0x1c')]?_0xc3ab76[_0xfafb('0x1c')]['attributes']||null:null,'limit':_0xc3ab76[_0xfafb('0x1c')]?_0xc3ab76['options'][_0xfafb('0x1e')]||null:null,'include':_0xc3ab76[_0xfafb('0x1c')]?_0xc3ab76[_0xfafb('0x1c')][_0xfafb('0x1f')]?_['map'](_0xc3ab76[_0xfafb('0x1c')][_0xfafb('0x1f')],function(_0x394005){return{'model':db[_0x394005[_0xfafb('0x20')]],'as':_0x394005['as'],'attributes':_0x394005[_0xfafb('0x21')],'include':_0x394005[_0xfafb('0x1f')]?_['map'](_0x394005[_0xfafb('0x1f')],function(_0x58cd21){return{'model':db[_0x58cd21[_0xfafb('0x20')]],'as':_0x58cd21['as'],'attributes':_0x58cd21[_0xfafb('0x21')],'include':_0x58cd21[_0xfafb('0x1f')]?_[_0xfafb('0x22')](_0x58cd21['include'],function(_0x2f2694){return{'model':db[_0x2f2694[_0xfafb('0x20')]],'as':_0x2f2694['as'],'attributes':_0x2f2694['attributes']};}):[]};}):[]};}):[]:[]})[_0xfafb('0x23')](function(_0x41e1f6){logger[_0xfafb('0xf')](_0xfafb('0x19'),_0xc3ab76);logger['debug'](_0xfafb('0x19'),_0xc3ab76,JSON['stringify'](_0x41e1f6));_0x4a4333(_0x41e1f6);})[_0xfafb('0x18')](function(_0x2651e5){logger[_0xfafb('0x14')](_0xfafb('0x19'),_0x2651e5[_0xfafb('0x16')],_0xc3ab76);_0x5e93e9(_0x1609db[_0xfafb('0x14')](0x1f4,_0x2651e5['message']));});});};exports['ShowVoiceQueue']=function(_0x17c276){var _0x32f0a3=this;return new Promise(function(_0x131fea,_0x32a368){return db[_0xfafb('0x1a')][_0xfafb('0x24')]({'raw':_0x17c276[_0xfafb('0x1c')]?_0x17c276[_0xfafb('0x1c')][_0xfafb('0x25')]===undefined?!![]:![]:!![],'where':_0x17c276['options']?_0x17c276['options']['where']||null:null,'attributes':_0x17c276[_0xfafb('0x1c')]?_0x17c276[_0xfafb('0x1c')][_0xfafb('0x21')]||null:null,'include':_0x17c276['options']?_0x17c276[_0xfafb('0x1c')][_0xfafb('0x1f')]?_[_0xfafb('0x22')](_0x17c276[_0xfafb('0x1c')]['include'],function(_0x4c986e){return{'model':db[_0x4c986e['model']],'as':_0x4c986e['as'],'attributes':_0x4c986e['attributes'],'include':_0x4c986e[_0xfafb('0x1f')]?_[_0xfafb('0x22')](_0x4c986e[_0xfafb('0x1f')],function(_0x5ad1dc){return{'model':db[_0x5ad1dc[_0xfafb('0x20')]],'as':_0x5ad1dc['as'],'attributes':_0x5ad1dc['attributes'],'include':_0x5ad1dc[_0xfafb('0x1f')]?_[_0xfafb('0x22')](_0x5ad1dc[_0xfafb('0x1f')],function(_0x1b61af){return{'model':db[_0x1b61af[_0xfafb('0x20')]],'as':_0x1b61af['as'],'attributes':_0x1b61af['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41bc89){logger[_0xfafb('0xf')](_0xfafb('0x26'),_0x17c276);logger[_0xfafb('0x27')](_0xfafb('0x26'),_0x17c276,JSON[_0xfafb('0x13')](_0x41bc89));_0x131fea(_0x41bc89);})[_0xfafb('0x18')](function(_0x10f200){logger['error'](_0xfafb('0x26'),_0x10f200['message'],_0x17c276);_0x32a368(_0x32f0a3[_0xfafb('0x14')](0x1f4,_0x10f200['message']));});});}; \ No newline at end of file +var _0x8071=['model','GetVoiceQueue','debug','ShowVoiceQueue','find','where','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','request','then','info','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','include','map'];(function(_0x3dc85,_0x4f2d39){var _0x3e938e=function(_0xbd5b55){while(--_0xbd5b55){_0x3dc85['push'](_0x3dc85['shift']());}};_0x3e938e(++_0x4f2d39);}(_0x8071,0x1da));var _0x1807=function(_0x45ff2d,_0x4b785f){_0x45ff2d=_0x45ff2d-0x0;var _0x343f00=_0x8071[_0x45ff2d];return _0x343f00;};'use strict';var _=require(_0x1807('0x0'));var util=require(_0x1807('0x1'));var moment=require(_0x1807('0x2'));var BPromise=require(_0x1807('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1807('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1807('0x5'));var logger=require('../../config/logger')(_0x1807('0x6'));var config=require(_0x1807('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1807('0x8')][_0x1807('0x9')]({'port':0x232a});config['redis']=_[_0x1807('0xa')](config['redis'],{'host':_0x1807('0xb'),'port':0x18eb});var socket=require(_0x1807('0xc'))(new Redis(config[_0x1807('0xd')]));require(_0x1807('0xe'))[_0x1807('0xf')](socket);function respondWithRpcPromise(_0x51db72,_0x35d930,_0x4a9fb2){return new BPromise(function(_0x419bbb,_0x249b3f){return client[_0x1807('0x10')](_0x51db72,_0x4a9fb2)[_0x1807('0x11')](function(_0x4d603a){logger[_0x1807('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x35d930,_0x1807('0x13'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x35d930,_0x1807('0x13'),JSON[_0x1807('0x14')](_0x4d603a));if(_0x4d603a[_0x1807('0x15')]){if(_0x4d603a['error'][_0x1807('0x16')]===0x1f4){logger[_0x1807('0x15')](_0x1807('0x17'),_0x35d930,_0x4d603a[_0x1807('0x15')][_0x1807('0x18')]);return _0x249b3f(_0x4d603a[_0x1807('0x15')][_0x1807('0x18')]);}logger[_0x1807('0x15')](_0x1807('0x17'),_0x35d930,_0x4d603a['error'][_0x1807('0x18')]);return _0x419bbb(_0x4d603a[_0x1807('0x15')][_0x1807('0x18')]);}else{logger['info'](_0x1807('0x17'),_0x35d930,_0x1807('0x13'));_0x419bbb(_0x4d603a[_0x1807('0x19')][_0x1807('0x18')]);}})[_0x1807('0x1a')](function(_0x375cb3){logger[_0x1807('0x15')](_0x1807('0x17'),_0x35d930,_0x375cb3);_0x249b3f(_0x375cb3);});});}exports['GetVoiceQueue']=function(_0x36647e){var _0x51096f=this;return new Promise(function(_0x58bd35,_0x4664db){return db['VoiceQueue'][_0x1807('0x1b')]({'raw':_0x36647e[_0x1807('0x1c')]?_0x36647e[_0x1807('0x1c')][_0x1807('0x1d')]===undefined?!![]:![]:!![],'where':_0x36647e[_0x1807('0x1c')]?_0x36647e[_0x1807('0x1c')]['where']||null:null,'attributes':_0x36647e['options']?_0x36647e[_0x1807('0x1c')][_0x1807('0x1e')]||null:null,'limit':_0x36647e[_0x1807('0x1c')]?_0x36647e[_0x1807('0x1c')]['limit']||null:null,'include':_0x36647e['options']?_0x36647e[_0x1807('0x1c')][_0x1807('0x1f')]?_[_0x1807('0x20')](_0x36647e['options']['include'],function(_0x44b702){return{'model':db[_0x44b702[_0x1807('0x21')]],'as':_0x44b702['as'],'attributes':_0x44b702['attributes'],'include':_0x44b702[_0x1807('0x1f')]?_[_0x1807('0x20')](_0x44b702[_0x1807('0x1f')],function(_0x4cda5e){return{'model':db[_0x4cda5e[_0x1807('0x21')]],'as':_0x4cda5e['as'],'attributes':_0x4cda5e[_0x1807('0x1e')],'include':_0x4cda5e[_0x1807('0x1f')]?_[_0x1807('0x20')](_0x4cda5e[_0x1807('0x1f')],function(_0x10c180){return{'model':db[_0x10c180[_0x1807('0x21')]],'as':_0x10c180['as'],'attributes':_0x10c180[_0x1807('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1807('0x11')](function(_0x2c7b68){logger[_0x1807('0x12')](_0x1807('0x22'),_0x36647e);logger[_0x1807('0x23')](_0x1807('0x22'),_0x36647e,JSON[_0x1807('0x14')](_0x2c7b68));_0x58bd35(_0x2c7b68);})[_0x1807('0x1a')](function(_0x221816){logger[_0x1807('0x15')]('GetVoiceQueue',_0x221816[_0x1807('0x18')],_0x36647e);_0x4664db(_0x51096f[_0x1807('0x15')](0x1f4,_0x221816['message']));});});};exports[_0x1807('0x24')]=function(_0xa043c){var _0x8282d6=this;return new Promise(function(_0x2f1d86,_0x4a237a){return db['VoiceQueue'][_0x1807('0x25')]({'raw':_0xa043c[_0x1807('0x1c')]?_0xa043c[_0x1807('0x1c')][_0x1807('0x1d')]===undefined?!![]:![]:!![],'where':_0xa043c[_0x1807('0x1c')]?_0xa043c[_0x1807('0x1c')][_0x1807('0x26')]||null:null,'attributes':_0xa043c[_0x1807('0x1c')]?_0xa043c['options'][_0x1807('0x1e')]||null:null,'include':_0xa043c[_0x1807('0x1c')]?_0xa043c['options'][_0x1807('0x1f')]?_[_0x1807('0x20')](_0xa043c[_0x1807('0x1c')][_0x1807('0x1f')],function(_0xd1258c){return{'model':db[_0xd1258c['model']],'as':_0xd1258c['as'],'attributes':_0xd1258c[_0x1807('0x1e')],'include':_0xd1258c['include']?_[_0x1807('0x20')](_0xd1258c[_0x1807('0x1f')],function(_0x2ab1a3){return{'model':db[_0x2ab1a3[_0x1807('0x21')]],'as':_0x2ab1a3['as'],'attributes':_0x2ab1a3[_0x1807('0x1e')],'include':_0x2ab1a3[_0x1807('0x1f')]?_['map'](_0x2ab1a3[_0x1807('0x1f')],function(_0x3e1d43){return{'model':db[_0x3e1d43[_0x1807('0x21')]],'as':_0x3e1d43['as'],'attributes':_0x3e1d43[_0x1807('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1807('0x11')](function(_0x372a1f){logger[_0x1807('0x12')](_0x1807('0x24'),_0xa043c);logger['debug'](_0x1807('0x24'),_0xa043c,JSON['stringify'](_0x372a1f));_0x2f1d86(_0x372a1f);})['catch'](function(_0x5e017e){logger['error'](_0x1807('0x24'),_0x5e017e[_0x1807('0x18')],_0xa043c);_0x4a237a(_0x8282d6['error'](0x1f4,_0x5e017e[_0x1807('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 9490dd1..ccb009d 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 _0xd441=['remove','emit','length','./voiceQueue.events','save'];(function(_0x417aa6,_0x401f42){var _0x46e3bc=function(_0x361de5){while(--_0x361de5){_0x417aa6['push'](_0x417aa6['shift']());}};_0x46e3bc(++_0x401f42);}(_0xd441,0xfd));var _0x1d44=function(_0x5b8f2d,_0x34b6c9){_0x5b8f2d=_0x5b8f2d-0x0;var _0x4d7747=_0xd441[_0x5b8f2d];return _0x4d7747;};'use strict';var VoiceQueueEvents=require(_0x1d44('0x0'));var events=[_0x1d44('0x1'),_0x1d44('0x2'),'update'];function createListener(_0x1a308f,_0x245a5b){return function(_0x4d6e29){_0x245a5b[_0x1d44('0x3')](_0x1a308f,_0x4d6e29);};}function removeListener(_0x5a9746,_0x48f893){return function(){VoiceQueueEvents['removeListener'](_0x5a9746,_0x48f893);};}exports['register']=function(_0x4004bd){for(var _0x1051b3=0x0,_0x52e933=events[_0x1d44('0x4')];_0x1051b3<_0x52e933;_0x1051b3++){var _0x26431a=events[_0x1051b3];var _0x4958cc=createListener('voiceQueue:'+_0x26431a,_0x4004bd);VoiceQueueEvents['on'](_0x26431a,_0x4958cc);}}; \ No newline at end of file +var _0x4245=['./voiceQueue.events','save','remove','emit','removeListener','register','length','voiceQueue:'];(function(_0x29385e,_0x128792){var _0x15b273=function(_0x435639){while(--_0x435639){_0x29385e['push'](_0x29385e['shift']());}};_0x15b273(++_0x128792);}(_0x4245,0x1a0));var _0x5424=function(_0x5d2138,_0x2c9dde){_0x5d2138=_0x5d2138-0x0;var _0xb019f1=_0x4245[_0x5d2138];return _0xb019f1;};'use strict';var VoiceQueueEvents=require(_0x5424('0x0'));var events=[_0x5424('0x1'),_0x5424('0x2'),'update'];function createListener(_0x4ec21a,_0x7026a3){return function(_0x1d9a44){_0x7026a3[_0x5424('0x3')](_0x4ec21a,_0x1d9a44);};}function removeListener(_0x15f598,_0x535a1b){return function(){VoiceQueueEvents[_0x5424('0x4')](_0x15f598,_0x535a1b);};}exports[_0x5424('0x5')]=function(_0x4a5bbb){for(var _0x1b2062=0x0,_0x1ad055=events[_0x5424('0x6')];_0x1b2062<_0x1ad055;_0x1b2062++){var _0x4f7d72=events[_0x1b2062];var _0x40b52d=createListener(_0x5424('0x7')+_0x4f7d72,_0x4a5bbb);VoiceQueueEvents['on'](_0x4f7d72,_0x40b52d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index bddc01b..ec2ff27 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 _0xac9b=['../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','/describe','/index','get','/:id','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac9b,0x8d));var _0xbac9=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0xac9b[_0x13606d];return _0x1b85b0;};'use strict';var multer=require('multer');var util=require(_0xbac9('0x0'));var path=require(_0xbac9('0x1'));var timeout=require(_0xbac9('0x2'));var express=require(_0xbac9('0x3'));var router=express[_0xbac9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbac9('0x5'));var interaction=require(_0xbac9('0x6'));var config=require(_0xbac9('0x7'));var controller=require(_0xbac9('0x8'));router['get']('/',auth[_0xbac9('0x9')](),controller[_0xbac9('0xa')]);router['get'](_0xbac9('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xbac9('0xc'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0xbac9('0xd')](_0xbac9('0xe'),auth[_0xbac9('0x9')](),controller['show']);router[_0xbac9('0xf')]('/',auth[_0xbac9('0x9')](),controller['create']);router[_0xbac9('0x10')](_0xbac9('0xe'),auth[_0xbac9('0x9')](),controller[_0xbac9('0x11')]);router[_0xbac9('0x12')]('/:id',auth[_0xbac9('0x9')](),controller[_0xbac9('0x13')]);module[_0xbac9('0x14')]=router; \ No newline at end of file +var _0x9a90=['update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','/:id','show','post','create','put'];(function(_0x32367d,_0x348e13){var _0x2b119a=function(_0x316a8c){while(--_0x316a8c){_0x32367d['push'](_0x32367d['shift']());}};_0x2b119a(++_0x348e13);}(_0x9a90,0x13e));var _0x09a9=function(_0x13b4e1,_0x2757e0){_0x13b4e1=_0x13b4e1-0x0;var _0x3027ae=_0x9a90[_0x13b4e1];return _0x3027ae;};'use strict';var multer=require(_0x09a9('0x0'));var util=require(_0x09a9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09a9('0x2'));var router=express['Router']();var fs_extra=require(_0x09a9('0x3'));var auth=require(_0x09a9('0x4'));var interaction=require(_0x09a9('0x5'));var config=require('../../config/environment');var controller=require(_0x09a9('0x6'));router[_0x09a9('0x7')]('/',auth[_0x09a9('0x8')](),controller[_0x09a9('0x9')]);router['get'](_0x09a9('0xa'),auth[_0x09a9('0x8')](),controller[_0x09a9('0xb')]);router[_0x09a9('0x7')]('/index',auth['isAuthenticated'](),controller[_0x09a9('0xc')]);router['get'](_0x09a9('0xd'),auth[_0x09a9('0x8')](),controller[_0x09a9('0xe')]);router[_0x09a9('0xf')]('/',auth['isAuthenticated'](),controller[_0x09a9('0x10')]);router[_0x09a9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x09a9('0x12')]);router[_0x09a9('0x13')](_0x09a9('0xd'),auth[_0x09a9('0x8')](),controller[_0x09a9('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 7cacb11..b72080c 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 _0x1bb8=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE','getDataValue','format','seconds','setDataValue','queuecallerleaveAt'];(function(_0x16cfda,_0x229689){var _0xf8836=function(_0x58b062){while(--_0x58b062){_0x16cfda['push'](_0x16cfda['shift']());}};_0xf8836(++_0x229689);}(_0x1bb8,0x86));var _0x81bb=function(_0x15236b,_0x4d8dff){_0x15236b=_0x15236b-0x0;var _0x185546=_0x1bb8[_0x15236b];return _0x185546;};'use strict';var Sequelize=require(_0x81bb('0x0'));var moment=require('moment');module[_0x81bb('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x81bb('0x2')]},'calleridnum':{'type':Sequelize[_0x81bb('0x2')]},'calleridname':{'type':Sequelize[_0x81bb('0x2')]},'queue':{'type':Sequelize[_0x81bb('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x81bb('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x19bcba){var _0x589a9a=moment(_0x19bcba);var _0x414582=moment(this[_0x81bb('0x4')]('queuecallerjoinAt'))[_0x81bb('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x44a27e=_0x589a9a['diff'](_0x414582,_0x81bb('0x6'));this[_0x81bb('0x7')](_0x81bb('0x8'),_0x19bcba);this[_0x81bb('0x7')](_0x81bb('0x9'),_0x44a27e||null);}},'position':{'type':Sequelize[_0x81bb('0xa')]},'count':{'type':Sequelize[_0x81bb('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x81bb('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x81bb('0x3')]},'queuecallerexit':{'type':Sequelize[_0x81bb('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x81bb('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x81bb('0x2')],'comment':_0x81bb('0xc')},'originalposition':{'type':Sequelize[_0x81bb('0xa')]},'channel':{'type':Sequelize[_0x81bb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x81bb('0x2')]},'connectedlinename':{'type':Sequelize[_0x81bb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x81bb('0x2')]},'priority':{'type':Sequelize[_0x81bb('0x2')]},'holdtime':{'type':Sequelize[_0x81bb('0xa')]},'mohtime':{'type':Sequelize[_0x81bb('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x81bb('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x81bb('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x81bb('0x2')]},'transferuniqueid':{'type':Sequelize[_0x81bb('0x2')]},'disposition':{'type':Sequelize[_0x81bb('0x2')]},'secondDisposition':{'type':Sequelize[_0x81bb('0x2')]},'thirdDisposition':{'type':Sequelize[_0x81bb('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x81bb('0xa')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6949=['moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','sequelize'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0x6949,0xef));var _0x9694=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x6949[_0x5b740b];return _0x6f8f4e;};'use strict';var Sequelize=require(_0x9694('0x0'));var moment=require(_0x9694('0x1'));module[_0x9694('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9694('0x3')]},'calleridnum':{'type':Sequelize[_0x9694('0x3')]},'calleridname':{'type':Sequelize[_0x9694('0x3')]},'queue':{'type':Sequelize[_0x9694('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x9694('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x9694('0x4')],'set':function(_0x27a98f){var _0x5adf53=moment(_0x27a98f);var _0x5b0a52=moment(this[_0x9694('0x5')](_0x9694('0x6')))[_0x9694('0x7')](_0x9694('0x8'));var _0x4af954=_0x5adf53[_0x9694('0x9')](_0x5b0a52,_0x9694('0xa'));this[_0x9694('0xb')](_0x9694('0xc'),_0x27a98f);this['setDataValue'](_0x9694('0xd'),_0x4af954||null);}},'position':{'type':Sequelize[_0x9694('0xe')]},'count':{'type':Sequelize[_0x9694('0xe')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9694('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x9694('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9694('0x4')]},'queuecallerexit':{'type':Sequelize[_0x9694('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x9694('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9694('0x3')]},'context':{'type':Sequelize[_0x9694('0x3')]},'exten':{'type':Sequelize[_0x9694('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x9694('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9694('0x3')]},'transfer':{'type':Sequelize[_0x9694('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9694('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x9694('0x3')]},'transferuniqueid':{'type':Sequelize[_0x9694('0x3')]},'disposition':{'type':Sequelize[_0x9694('0x3')]},'secondDisposition':{'type':Sequelize[_0x9694('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9694('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x9694('0xe')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9694('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 2883465..54b8580 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 _0xddaf=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','map','VoiceQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','catch','describe','getVoiceQueuesReport','hasOwnProperty','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv'];(function(_0x2b5c7d,_0x21bbc8){var _0xd9cebb=function(_0x535306){while(--_0x535306){_0x2b5c7d['push'](_0x2b5c7d['shift']());}};_0xd9cebb(++_0x21bbc8);}(_0xddaf,0xf3));var _0xfdda=function(_0x58538e,_0xad8164){_0x58538e=_0x58538e-0x0;var _0x396f51=_0xddaf[_0x58538e];return _0x396f51;};'use strict';var emlformat=require(_0xfdda('0x0'));var rimraf=require(_0xfdda('0x1'));var zipdir=require(_0xfdda('0x2'));var jsonpatch=require(_0xfdda('0x3'));var rp=require('request-promise');var moment=require(_0xfdda('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfdda('0x5'));var path=require(_0xfdda('0x6'));var sox=require(_0xfdda('0x7'));var csv=require(_0xfdda('0x8'));var ejs=require(_0xfdda('0x9'));var fs=require('fs');var fs_extra=require(_0xfdda('0xa'));var _=require(_0xfdda('0xb'));var squel=require(_0xfdda('0xc'));var crypto=require(_0xfdda('0xd'));var jsforce=require(_0xfdda('0xe'));var deskjs=require(_0xfdda('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfdda('0x10'));var Redis=require(_0xfdda('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfdda('0x12'));var as=require(_0xfdda('0x13'));var hardwareService=require(_0xfdda('0x14'));var logger=require(_0xfdda('0x15'))(_0xfdda('0x16'));var utils=require('../../config/utils');var config=require(_0xfdda('0x17'));var licenseUtil=require(_0xfdda('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xfdda('0x19')](config[_0xfdda('0x1a')],{'host':_0xfdda('0x1b'),'port':0x18eb});var socket=require(_0xfdda('0x1c'))(new Redis(config['redis']));require(_0xfdda('0x1d'))[_0xfdda('0x1e')](socket);function respondWithStatusCode(_0x4a25fc,_0x32da90){_0x32da90=_0x32da90||0xcc;return function(_0x291840){if(_0x291840){return _0x4a25fc['sendStatus'](_0x32da90);}return _0x4a25fc[_0xfdda('0x1f')](_0x32da90)['end']();};}function respondWithResult(_0x380686,_0x246420){_0x246420=_0x246420||0xc8;return function(_0x41ae29){if(_0x41ae29){return _0x380686[_0xfdda('0x1f')](_0x246420)[_0xfdda('0x20')](_0x41ae29);}};}function respondWithFilteredResult(_0x516655,_0x98adac){return function(_0x379aea){if(_0x379aea){var _0x14b360=typeof _0x98adac[_0xfdda('0x21')]===_0xfdda('0x22')&&typeof _0x98adac[_0xfdda('0x23')]===_0xfdda('0x22');var _0x5d8323=_0x379aea[_0xfdda('0x24')];var _0x74b323=_0x14b360?0x0:_0x98adac[_0xfdda('0x21')];var _0x10bd65=_0x14b360?_0x379aea[_0xfdda('0x24')]:_0x98adac['offset']+_0x98adac[_0xfdda('0x23')];var _0x5ae42f;if(_0x10bd65>=_0x5d8323){_0x10bd65=_0x5d8323;_0x5ae42f=0xc8;}else{_0x5ae42f=0xce;}_0x516655['status'](_0x5ae42f);return _0x516655[_0xfdda('0x25')](_0xfdda('0x26'),_0x74b323+'-'+_0x10bd65+'/'+_0x5d8323)[_0xfdda('0x20')](_0x379aea);}return null;};}function patchUpdates(_0x189874){return function(_0x53eef1){try{jsonpatch[_0xfdda('0x27')](_0x53eef1,_0x189874,!![]);}catch(_0x1f7b92){return BPromise[_0xfdda('0x28')](_0x1f7b92);}return _0x53eef1[_0xfdda('0x29')]();};}function saveUpdates(_0x356a09,_0xac1a8c){return function(_0x56ce22){if(_0x56ce22){return _0x56ce22[_0xfdda('0x2a')](_0x356a09)['then'](function(_0x5ea016){return _0x5ea016;});}return null;};}function removeEntity(_0x5bdbc0,_0x33463d){return function(_0x3ccf3c){if(_0x3ccf3c){return _0x3ccf3c[_0xfdda('0x2b')]()[_0xfdda('0x2c')](function(){_0x5bdbc0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20025a,_0x173383){return function(_0x31c859){if(!_0x31c859){_0x20025a[_0xfdda('0x2d')](0x194);}return _0x31c859;};}function handleError(_0x46248b,_0x11a1f5){_0x11a1f5=_0x11a1f5||0x1f4;return function(_0x2282b6){logger[_0xfdda('0x2e')](_0x2282b6['stack']);if(_0x2282b6[_0xfdda('0x2f')]){delete _0x2282b6['name'];}_0x46248b[_0xfdda('0x1f')](_0x11a1f5)[_0xfdda('0x30')](_0x2282b6);};}exports['index']=function(_0x51c612,_0x38019e){var _0x336e80={},_0x1387e6={},_0x1b92ca={'count':0x0,'rows':[]};var _0xe98aa0=_[_0xfdda('0x31')](db[_0xfdda('0x32')][_0xfdda('0x33')],function(_0x2f211b){return{'name':_0x2f211b[_0xfdda('0x34')],'type':_0x2f211b['type'][_0xfdda('0x35')]};});_0x1387e6[_0xfdda('0x36')]=_[_0xfdda('0x31')](_0xe98aa0,_0xfdda('0x2f'));_0x1387e6['query']=_[_0xfdda('0x37')](_0x51c612[_0xfdda('0x38')]);_0x1387e6[_0xfdda('0x39')]=_[_0xfdda('0x3a')](_0x1387e6[_0xfdda('0x36')],_0x1387e6[_0xfdda('0x38')]);_0x336e80[_0xfdda('0x3b')]=_[_0xfdda('0x3a')](_0x1387e6['model'],qs[_0xfdda('0x3c')](_0x51c612[_0xfdda('0x38')][_0xfdda('0x3c')]));_0x336e80['attributes']=_0x336e80[_0xfdda('0x3b')][_0xfdda('0x3d')]?_0x336e80[_0xfdda('0x3b')]:_0x1387e6['model'];if(!_0x51c612['query']['hasOwnProperty'](_0xfdda('0x3e'))){_0x336e80[_0xfdda('0x23')]=qs[_0xfdda('0x23')](_0x51c612[_0xfdda('0x38')][_0xfdda('0x23')]);_0x336e80[_0xfdda('0x21')]=qs[_0xfdda('0x21')](_0x51c612['query'][_0xfdda('0x21')]);}_0x336e80[_0xfdda('0x3f')]=qs[_0xfdda('0x40')](_0x51c612[_0xfdda('0x38')][_0xfdda('0x40')]);_0x336e80[_0xfdda('0x41')]=qs[_0xfdda('0x39')](_['pick'](_0x51c612[_0xfdda('0x38')],_0x1387e6[_0xfdda('0x39')]),_0xe98aa0);if(_0x51c612[_0xfdda('0x38')][_0xfdda('0x42')]){_0x336e80[_0xfdda('0x41')]=_[_0xfdda('0x43')](_0x336e80[_0xfdda('0x41')],{'$or':_[_0xfdda('0x31')](_0xe98aa0,function(_0xea3171){if(_0xea3171[_0xfdda('0x44')]!==_0xfdda('0x45')){var _0x28f4f9={};_0x28f4f9[_0xea3171[_0xfdda('0x2f')]]={'$like':'%'+_0x51c612[_0xfdda('0x38')][_0xfdda('0x42')]+'%'};return _0x28f4f9;}})});}_0x336e80=_[_0xfdda('0x43')]({},_0x336e80,_0x51c612[_0xfdda('0x46')]);var _0x146734={'where':_0x336e80['where']};return db[_0xfdda('0x32')][_0xfdda('0x24')](_0x146734)[_0xfdda('0x2c')](function(_0x117c09){_0x1b92ca[_0xfdda('0x24')]=_0x117c09;if(_0x51c612[_0xfdda('0x38')][_0xfdda('0x47')]){_0x336e80[_0xfdda('0x48')]=[{'all':!![]}];}return db[_0xfdda('0x32')][_0xfdda('0x49')](_0x336e80);})[_0xfdda('0x2c')](function(_0x4d5531){_0x1b92ca['rows']=_0x4d5531;return _0x1b92ca;})[_0xfdda('0x2c')](respondWithFilteredResult(_0x38019e,_0x336e80))['catch'](handleError(_0x38019e,null));};exports[_0xfdda('0x4a')]=function(_0x1c79e3,_0xaa3ec9){var _0x35b608={'raw':![],'where':{'id':_0x1c79e3[_0xfdda('0x4b')]['id']}},_0x456b82={};_0x456b82['model']=_[_0xfdda('0x37')](db['VoiceQueueReport'][_0xfdda('0x33')]);_0x456b82[_0xfdda('0x38')]=_[_0xfdda('0x37')](_0x1c79e3[_0xfdda('0x38')]);_0x456b82['filters']=_[_0xfdda('0x3a')](_0x456b82[_0xfdda('0x36')],_0x456b82[_0xfdda('0x38')]);_0x35b608[_0xfdda('0x3b')]=_['intersection'](_0x456b82[_0xfdda('0x36')],qs[_0xfdda('0x3c')](_0x1c79e3[_0xfdda('0x38')]['fields']));_0x35b608[_0xfdda('0x3b')]=_0x35b608['attributes'][_0xfdda('0x3d')]?_0x35b608[_0xfdda('0x3b')]:_0x456b82['model'];if(_0x1c79e3[_0xfdda('0x38')][_0xfdda('0x47')]){_0x35b608[_0xfdda('0x48')]=[{'all':!![]}];}_0x35b608=_[_0xfdda('0x43')]({},_0x35b608,_0x1c79e3[_0xfdda('0x46')]);return db[_0xfdda('0x32')][_0xfdda('0x4c')](_0x35b608)[_0xfdda('0x2c')](handleEntityNotFound(_0xaa3ec9,null))[_0xfdda('0x2c')](respondWithResult(_0xaa3ec9,null))['catch'](handleError(_0xaa3ec9,null));};exports['create']=function(_0x4963c2,_0x5893db){return db[_0xfdda('0x32')][_0xfdda('0x4d')](_0x4963c2[_0xfdda('0x4e')],{})[_0xfdda('0x2c')](respondWithResult(_0x5893db,0xc9))[_0xfdda('0x4f')](handleError(_0x5893db,null));};exports['update']=function(_0x5813cb,_0x4695f0){if(_0x5813cb[_0xfdda('0x4e')]['id']){delete _0x5813cb[_0xfdda('0x4e')]['id'];}return db['VoiceQueueReport'][_0xfdda('0x4c')]({'where':{'id':_0x5813cb['params']['id']}})['then'](handleEntityNotFound(_0x4695f0,null))[_0xfdda('0x2c')](saveUpdates(_0x5813cb[_0xfdda('0x4e')],null))['then'](respondWithResult(_0x4695f0,null))['catch'](handleError(_0x4695f0,null));};exports['destroy']=function(_0x1c1b99,_0x1a7342){return db[_0xfdda('0x32')][_0xfdda('0x4c')]({'where':{'id':_0x1c1b99['params']['id']}})[_0xfdda('0x2c')](handleEntityNotFound(_0x1a7342,null))[_0xfdda('0x2c')](removeEntity(_0x1a7342,null))[_0xfdda('0x4f')](handleError(_0x1a7342,null));};exports[_0xfdda('0x50')]=function(_0x40d811,_0x36d88a){return db['VoiceQueueReport'][_0xfdda('0x50')]()['then'](respondWithResult(_0x36d88a,null))[_0xfdda('0x4f')](handleError(_0x36d88a,null));};exports[_0xfdda('0x51')]=function(_0x187634,_0x4e10e7){var _0x46f9f6={},_0x2dd3d1={},_0x2f4a54={'count':0x0,'rows':[]};_0x2dd3d1['model']=_[_0xfdda('0x37')](db[_0xfdda('0x32')][_0xfdda('0x33')]);_0x2dd3d1[_0xfdda('0x38')]=_[_0xfdda('0x37')](_0x187634[_0xfdda('0x38')]);_0x2dd3d1[_0xfdda('0x39')]=_['intersection'](_0x2dd3d1['model'],_0x2dd3d1[_0xfdda('0x38')]);_0x46f9f6[_0xfdda('0x3b')]=_[_0xfdda('0x3a')](_0x2dd3d1[_0xfdda('0x36')],qs['fields'](_0x187634[_0xfdda('0x38')]['fields']));_0x46f9f6['attributes']=_0x46f9f6[_0xfdda('0x3b')][_0xfdda('0x3d')]?_0x46f9f6['attributes']:_0x2dd3d1[_0xfdda('0x36')];if(!_0x187634[_0xfdda('0x38')][_0xfdda('0x52')](_0xfdda('0x3e'))){_0x46f9f6[_0xfdda('0x23')]=qs[_0xfdda('0x23')](_0x187634[_0xfdda('0x38')]['limit']);_0x46f9f6['offset']=qs[_0xfdda('0x21')](_0x187634['query']['offset']);}_0x46f9f6[_0xfdda('0x3f')]=qs['sort'](_0x187634[_0xfdda('0x38')][_0xfdda('0x40')]);_0x46f9f6[_0xfdda('0x41')]=qs[_0xfdda('0x39')](_[_0xfdda('0x53')](_0x187634[_0xfdda('0x38')],_0x2dd3d1['filters']));if(_0x187634[_0xfdda('0x38')][_0xfdda('0x42')]){_0x46f9f6[_0xfdda('0x41')]=_['merge'](_0x46f9f6[_0xfdda('0x41')],{'$or':_[_0xfdda('0x31')](_0x46f9f6[_0xfdda('0x3b')],function(_0x5b1afd){var _0x23a8c2={};_0x23a8c2[_0x5b1afd]={'$like':'%'+_0x187634[_0xfdda('0x38')]['filter']+'%'};return _0x23a8c2;})});}_0x46f9f6=_['merge']({},_0x46f9f6,_0x187634[_0xfdda('0x46')]);var _0x314158={'where':_0x46f9f6[_0xfdda('0x41')]};return db[_0xfdda('0x32')][_0xfdda('0x24')](_0x314158)[_0xfdda('0x2c')](function(_0x590254){_0x2f4a54[_0xfdda('0x24')]=_0x590254;if(_0x187634[_0xfdda('0x38')][_0xfdda('0x47')]){_0x46f9f6[_0xfdda('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xfdda('0x49')](_0x46f9f6);})[_0xfdda('0x2c')](function(_0x30ee76){_0x2f4a54['rows']=_0x30ee76;return _0x2f4a54;})[_0xfdda('0x2c')](respondWithFilteredResult(_0x4e10e7,_0x46f9f6,'getVoiceQueuesReport'))[_0xfdda('0x4f')](handleError(_0x4e10e7,null,_0xfdda('0x51')));}; \ No newline at end of file +var _0x7ca3=['params','rawAttributes','include','options','create','body','update','destroy','find','describe','getVoiceQueuesReport','length','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','error','name','index','VoiceQueueReport','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show'];(function(_0x4fba26,_0x2fa3ea){var _0x4f4de9=function(_0x7d89){while(--_0x7d89){_0x4fba26['push'](_0x4fba26['shift']());}};_0x4f4de9(++_0x2fa3ea);}(_0x7ca3,0x144));var _0x37ca=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x7ca3[_0x1daaa9];return _0x1dd221;};'use strict';var emlformat=require(_0x37ca('0x0'));var rimraf=require(_0x37ca('0x1'));var zipdir=require(_0x37ca('0x2'));var jsonpatch=require(_0x37ca('0x3'));var rp=require('request-promise');var moment=require(_0x37ca('0x4'));var BPromise=require(_0x37ca('0x5'));var Mustache=require(_0x37ca('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37ca('0x7'));var _=require(_0x37ca('0x8'));var squel=require(_0x37ca('0x9'));var crypto=require('crypto');var jsforce=require(_0x37ca('0xa'));var deskjs=require(_0x37ca('0xb'));var toCsv=require(_0x37ca('0xc'));var querystring=require(_0x37ca('0xd'));var Papa=require(_0x37ca('0xe'));var Redis=require(_0x37ca('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x37ca('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x37ca('0x11'));var utils=require(_0x37ca('0x12'));var config=require(_0x37ca('0x13'));var licenseUtil=require(_0x37ca('0x14'));var db=require(_0x37ca('0x15'))['db'];config[_0x37ca('0x16')]=_[_0x37ca('0x17')](config[_0x37ca('0x16')],{'host':_0x37ca('0x18'),'port':0x18eb});var socket=require(_0x37ca('0x19'))(new Redis(config[_0x37ca('0x16')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x4d6d3f,_0x4c8a83){_0x4c8a83=_0x4c8a83||0xcc;return function(_0x230f44){if(_0x230f44){return _0x4d6d3f[_0x37ca('0x1a')](_0x4c8a83);}return _0x4d6d3f[_0x37ca('0x1b')](_0x4c8a83)[_0x37ca('0x1c')]();};}function respondWithResult(_0x2145bc,_0x4223ce){_0x4223ce=_0x4223ce||0xc8;return function(_0x43df58){if(_0x43df58){return _0x2145bc['status'](_0x4223ce)[_0x37ca('0x1d')](_0x43df58);}};}function respondWithFilteredResult(_0xee494d,_0x186cc8){return function(_0x1f4755){if(_0x1f4755){var _0x1d06eb=typeof _0x186cc8[_0x37ca('0x1e')]==='undefined'&&typeof _0x186cc8[_0x37ca('0x1f')]===_0x37ca('0x20');var _0xdd5676=_0x1f4755['count'];var _0x27fdc9=_0x1d06eb?0x0:_0x186cc8[_0x37ca('0x1e')];var _0x443670=_0x1d06eb?_0x1f4755[_0x37ca('0x21')]:_0x186cc8[_0x37ca('0x1e')]+_0x186cc8[_0x37ca('0x1f')];var _0x50a542;if(_0x443670>=_0xdd5676){_0x443670=_0xdd5676;_0x50a542=0xc8;}else{_0x50a542=0xce;}_0xee494d[_0x37ca('0x1b')](_0x50a542);return _0xee494d[_0x37ca('0x22')](_0x37ca('0x23'),_0x27fdc9+'-'+_0x443670+'/'+_0xdd5676)[_0x37ca('0x1d')](_0x1f4755);}return null;};}function patchUpdates(_0x5ad476){return function(_0x214088){try{jsonpatch[_0x37ca('0x24')](_0x214088,_0x5ad476,!![]);}catch(_0x419a82){return BPromise['reject'](_0x419a82);}return _0x214088[_0x37ca('0x25')]();};}function saveUpdates(_0xc4f716,_0x3fbeb9){return function(_0x1c856a){if(_0x1c856a){return _0x1c856a['update'](_0xc4f716)[_0x37ca('0x26')](function(_0xfcdf6d){return _0xfcdf6d;});}return null;};}function removeEntity(_0x109616,_0x519470){return function(_0x538eaa){if(_0x538eaa){return _0x538eaa['destroy']()['then'](function(){_0x109616[_0x37ca('0x1b')](0xcc)[_0x37ca('0x1c')]();});}};}function handleEntityNotFound(_0xc4684e,_0x42fe68){return function(_0x2b27d3){if(!_0x2b27d3){_0xc4684e[_0x37ca('0x1a')](0x194);}return _0x2b27d3;};}function handleError(_0x5bae12,_0x84e675){_0x84e675=_0x84e675||0x1f4;return function(_0x53a002){logger[_0x37ca('0x27')](_0x53a002['stack']);if(_0x53a002[_0x37ca('0x28')]){delete _0x53a002[_0x37ca('0x28')];}_0x5bae12[_0x37ca('0x1b')](_0x84e675)['send'](_0x53a002);};}exports[_0x37ca('0x29')]=function(_0x37a583,_0x4dc683){var _0x2ae9bd={},_0x2b3004={},_0x273f60={'count':0x0,'rows':[]};var _0x4b61dc=_['map'](db[_0x37ca('0x2a')]['rawAttributes'],function(_0x1bed62){return{'name':_0x1bed62[_0x37ca('0x2b')],'type':_0x1bed62[_0x37ca('0x2c')][_0x37ca('0x2d')]};});_0x2b3004[_0x37ca('0x2e')]=_[_0x37ca('0x2f')](_0x4b61dc,'name');_0x2b3004[_0x37ca('0x30')]=_[_0x37ca('0x31')](_0x37a583[_0x37ca('0x30')]);_0x2b3004['filters']=_['intersection'](_0x2b3004[_0x37ca('0x2e')],_0x2b3004[_0x37ca('0x30')]);_0x2ae9bd[_0x37ca('0x32')]=_[_0x37ca('0x33')](_0x2b3004[_0x37ca('0x2e')],qs[_0x37ca('0x34')](_0x37a583['query'][_0x37ca('0x34')]));_0x2ae9bd[_0x37ca('0x32')]=_0x2ae9bd[_0x37ca('0x32')]['length']?_0x2ae9bd['attributes']:_0x2b3004['model'];if(!_0x37a583['query']['hasOwnProperty'](_0x37ca('0x35'))){_0x2ae9bd[_0x37ca('0x1f')]=qs[_0x37ca('0x1f')](_0x37a583[_0x37ca('0x30')][_0x37ca('0x1f')]);_0x2ae9bd[_0x37ca('0x1e')]=qs[_0x37ca('0x1e')](_0x37a583[_0x37ca('0x30')][_0x37ca('0x1e')]);}_0x2ae9bd[_0x37ca('0x36')]=qs[_0x37ca('0x37')](_0x37a583[_0x37ca('0x30')][_0x37ca('0x37')]);_0x2ae9bd[_0x37ca('0x38')]=qs[_0x37ca('0x39')](_[_0x37ca('0x3a')](_0x37a583[_0x37ca('0x30')],_0x2b3004[_0x37ca('0x39')]),_0x4b61dc);if(_0x37a583['query'][_0x37ca('0x3b')]){_0x2ae9bd[_0x37ca('0x38')]=_[_0x37ca('0x3c')](_0x2ae9bd[_0x37ca('0x38')],{'$or':_[_0x37ca('0x2f')](_0x4b61dc,function(_0x22840c){if(_0x22840c[_0x37ca('0x2c')]!==_0x37ca('0x3d')){var _0x504e98={};_0x504e98[_0x22840c[_0x37ca('0x28')]]={'$like':'%'+_0x37a583['query']['filter']+'%'};return _0x504e98;}})});}_0x2ae9bd=_['merge']({},_0x2ae9bd,_0x37a583['options']);var _0x46a7d0={'where':_0x2ae9bd[_0x37ca('0x38')]};return db[_0x37ca('0x2a')][_0x37ca('0x21')](_0x46a7d0)['then'](function(_0x331185){_0x273f60[_0x37ca('0x21')]=_0x331185;if(_0x37a583['query'][_0x37ca('0x3e')]){_0x2ae9bd['include']=[{'all':!![]}];}return db[_0x37ca('0x2a')][_0x37ca('0x3f')](_0x2ae9bd);})[_0x37ca('0x26')](function(_0x1a4a3b){_0x273f60['rows']=_0x1a4a3b;return _0x273f60;})['then'](respondWithFilteredResult(_0x4dc683,_0x2ae9bd))[_0x37ca('0x40')](handleError(_0x4dc683,null));};exports[_0x37ca('0x41')]=function(_0x1385d3,_0x125465){var _0x4be09f={'raw':![],'where':{'id':_0x1385d3[_0x37ca('0x42')]['id']}},_0xd9a3e6={};_0xd9a3e6[_0x37ca('0x2e')]=_['keys'](db[_0x37ca('0x2a')][_0x37ca('0x43')]);_0xd9a3e6[_0x37ca('0x30')]=_[_0x37ca('0x31')](_0x1385d3[_0x37ca('0x30')]);_0xd9a3e6[_0x37ca('0x39')]=_[_0x37ca('0x33')](_0xd9a3e6[_0x37ca('0x2e')],_0xd9a3e6[_0x37ca('0x30')]);_0x4be09f['attributes']=_[_0x37ca('0x33')](_0xd9a3e6[_0x37ca('0x2e')],qs['fields'](_0x1385d3[_0x37ca('0x30')][_0x37ca('0x34')]));_0x4be09f['attributes']=_0x4be09f[_0x37ca('0x32')]['length']?_0x4be09f['attributes']:_0xd9a3e6['model'];if(_0x1385d3[_0x37ca('0x30')][_0x37ca('0x3e')]){_0x4be09f[_0x37ca('0x44')]=[{'all':!![]}];}_0x4be09f=_[_0x37ca('0x3c')]({},_0x4be09f,_0x1385d3[_0x37ca('0x45')]);return db['VoiceQueueReport']['find'](_0x4be09f)[_0x37ca('0x26')](handleEntityNotFound(_0x125465,null))[_0x37ca('0x26')](respondWithResult(_0x125465,null))[_0x37ca('0x40')](handleError(_0x125465,null));};exports[_0x37ca('0x46')]=function(_0x443539,_0x4abf04){return db['VoiceQueueReport'][_0x37ca('0x46')](_0x443539[_0x37ca('0x47')],{})[_0x37ca('0x26')](respondWithResult(_0x4abf04,0xc9))['catch'](handleError(_0x4abf04,null));};exports[_0x37ca('0x48')]=function(_0x25e6ac,_0x475b55){if(_0x25e6ac[_0x37ca('0x47')]['id']){delete _0x25e6ac['body']['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x25e6ac['params']['id']}})[_0x37ca('0x26')](handleEntityNotFound(_0x475b55,null))[_0x37ca('0x26')](saveUpdates(_0x25e6ac['body'],null))[_0x37ca('0x26')](respondWithResult(_0x475b55,null))[_0x37ca('0x40')](handleError(_0x475b55,null));};exports[_0x37ca('0x49')]=function(_0x5391b1,_0x3db07e){return db[_0x37ca('0x2a')][_0x37ca('0x4a')]({'where':{'id':_0x5391b1['params']['id']}})['then'](handleEntityNotFound(_0x3db07e,null))[_0x37ca('0x26')](removeEntity(_0x3db07e,null))[_0x37ca('0x40')](handleError(_0x3db07e,null));};exports[_0x37ca('0x4b')]=function(_0x5e2882,_0x1fea20){return db[_0x37ca('0x2a')]['describe']()[_0x37ca('0x26')](respondWithResult(_0x1fea20,null))[_0x37ca('0x40')](handleError(_0x1fea20,null));};exports[_0x37ca('0x4c')]=function(_0x19756b,_0x1f701f){var _0x40001d={},_0x3f188d={},_0x7cbf6a={'count':0x0,'rows':[]};_0x3f188d[_0x37ca('0x2e')]=_[_0x37ca('0x31')](db['VoiceQueueReport'][_0x37ca('0x43')]);_0x3f188d[_0x37ca('0x30')]=_[_0x37ca('0x31')](_0x19756b['query']);_0x3f188d[_0x37ca('0x39')]=_[_0x37ca('0x33')](_0x3f188d['model'],_0x3f188d['query']);_0x40001d[_0x37ca('0x32')]=_['intersection'](_0x3f188d[_0x37ca('0x2e')],qs[_0x37ca('0x34')](_0x19756b[_0x37ca('0x30')]['fields']));_0x40001d[_0x37ca('0x32')]=_0x40001d[_0x37ca('0x32')][_0x37ca('0x4d')]?_0x40001d[_0x37ca('0x32')]:_0x3f188d['model'];if(!_0x19756b[_0x37ca('0x30')]['hasOwnProperty'](_0x37ca('0x35'))){_0x40001d['limit']=qs[_0x37ca('0x1f')](_0x19756b[_0x37ca('0x30')]['limit']);_0x40001d[_0x37ca('0x1e')]=qs[_0x37ca('0x1e')](_0x19756b[_0x37ca('0x30')]['offset']);}_0x40001d[_0x37ca('0x36')]=qs[_0x37ca('0x37')](_0x19756b[_0x37ca('0x30')][_0x37ca('0x37')]);_0x40001d[_0x37ca('0x38')]=qs[_0x37ca('0x39')](_['pick'](_0x19756b[_0x37ca('0x30')],_0x3f188d['filters']));if(_0x19756b[_0x37ca('0x30')]['filter']){_0x40001d[_0x37ca('0x38')]=_[_0x37ca('0x3c')](_0x40001d[_0x37ca('0x38')],{'$or':_['map'](_0x40001d[_0x37ca('0x32')],function(_0x31225e){var _0x407df0={};_0x407df0[_0x31225e]={'$like':'%'+_0x19756b[_0x37ca('0x30')][_0x37ca('0x3b')]+'%'};return _0x407df0;})});}_0x40001d=_[_0x37ca('0x3c')]({},_0x40001d,_0x19756b[_0x37ca('0x45')]);var _0x14cad9={'where':_0x40001d[_0x37ca('0x38')]};return db['VoiceQueueReport'][_0x37ca('0x21')](_0x14cad9)['then'](function(_0x535255){_0x7cbf6a[_0x37ca('0x21')]=_0x535255;if(_0x19756b[_0x37ca('0x30')]['includeAll']){_0x40001d['include']=[{'all':!![]}];}return db[_0x37ca('0x2a')][_0x37ca('0x3f')](_0x40001d);})['then'](function(_0x29e3e3){_0x7cbf6a['rows']=_0x29e3e3;return _0x7cbf6a;})[_0x37ca('0x26')](respondWithFilteredResult(_0x1f701f,_0x40001d,_0x37ca('0x4c')))[_0x37ca('0x40')](handleError(_0x1f701f,null,_0x37ca('0x4c')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 25c3300..7b06bf1 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 _0xd6ed=['emit','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x516aa5,_0x3931df){var _0x28c07a=function(_0x168908){while(--_0x168908){_0x516aa5['push'](_0x516aa5['shift']());}};_0x28c07a(++_0x3931df);}(_0xd6ed,0x1aa));var _0xdd6e=function(_0x1a0cbb,_0x159f6){_0x1a0cbb=_0x1a0cbb-0x0;var _0x32640f=_0xd6ed[_0x1a0cbb];return _0x32640f;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xdd6e('0x0'))['db'][_0xdd6e('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xdd6e('0x2')](0x0);var events={'afterCreate':_0xdd6e('0x3'),'afterUpdate':_0xdd6e('0x4'),'afterDestroy':_0xdd6e('0x5')};function emitEvent(_0x23c0ab){return function(_0xca297a,_0x2e62af,_0x2a80fb){VoiceQueueReportEvents[_0xdd6e('0x6')](_0x23c0ab+':'+_0xca297a['id'],_0xca297a);VoiceQueueReportEvents[_0xdd6e('0x6')](_0x23c0ab,_0xca297a);_0x2a80fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xdd6e('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xfa98=['hasOwnProperty','exports','events','setMaxListeners','save','update','emit'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0xfa98,0xf7));var _0x8fa9=function(_0x108949,_0x84b8a8){_0x108949=_0x108949-0x0;var _0x340504=_0xfa98[_0x108949];return _0x340504;};'use strict';var EventEmitter=require(_0x8fa9('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8fa9('0x1')](0x0);var events={'afterCreate':_0x8fa9('0x2'),'afterUpdate':_0x8fa9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x17bf23){return function(_0x59cf3d,_0x5dabf6,_0x176060){VoiceQueueReportEvents[_0x8fa9('0x4')](_0x17bf23+':'+_0x59cf3d['id'],_0x59cf3d);VoiceQueueReportEvents[_0x8fa9('0x4')](_0x17bf23,_0x59cf3d);_0x176060(null);};}for(var e in events){if(events[_0x8fa9('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x8fa9('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 da4a02d..05532a5 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 _0xa9ab=['report_queue','calleridnum','lodash','moment','request-promise','../../config/environment','./voiceQueueReport.attributes','exports','define'];(function(_0x7f9ef5,_0x427cf5){var _0x572f9f=function(_0x53103f){while(--_0x53103f){_0x7f9ef5['push'](_0x7f9ef5['shift']());}};_0x572f9f(++_0x427cf5);}(_0xa9ab,0x1f1));var _0xba9a=function(_0x1f6c90,_0x3b9c8c){_0x1f6c90=_0x1f6c90-0x0;var _0x147a1a=_0xa9ab[_0x1f6c90];return _0x147a1a;};'use strict';var _=require(_0xba9a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xba9a('0x1'));var BPromise=require('bluebird');var rp=require(_0xba9a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba9a('0x3'));var attributes=require(_0xba9a('0x4'));module[_0xba9a('0x5')]=function(_0x391c11,_0x1fbe24){return _0x391c11[_0xba9a('0x6')]('VoiceQueueReport',attributes,{'tableName':_0xba9a('0x7'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xba9a('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44d9=['define','report_queue','uniqueid','util','../../config/logger','api','moment','path','../../config/environment','./voiceQueueReport.attributes'];(function(_0x2ca2b3,_0x128eb5){var _0x4da45c=function(_0xe5726){while(--_0xe5726){_0x2ca2b3['push'](_0x2ca2b3['shift']());}};_0x4da45c(++_0x128eb5);}(_0x44d9,0x125));var _0x944d=function(_0x424d7c,_0x49abec){_0x424d7c=_0x424d7c-0x0;var _0xbb2c0=_0x44d9[_0x424d7c];return _0xbb2c0;};'use strict';var _=require('lodash');var util=require(_0x944d('0x0'));var logger=require(_0x944d('0x1'))(_0x944d('0x2'));var moment=require(_0x944d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x944d('0x4'));var rimraf=require('rimraf');var config=require(_0x944d('0x5'));var attributes=require(_0x944d('0x6'));module['exports']=function(_0x545026,_0x3613a2){return _0x545026[_0x944d('0x7')]('VoiceQueueReport',attributes,{'tableName':_0x944d('0x8'),'paranoid':![],'indexes':[{'fields':[_0x944d('0x9')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 88e258f..3e26a47 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 _0xebf8=['register','request','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','include','map','model','attributes','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x39694b,_0x50befc){var _0x195907=function(_0x3bb7d2){while(--_0x3bb7d2){_0x39694b['push'](_0x39694b['shift']());}};_0x195907(++_0x50befc);}(_0xebf8,0x159));var _0x8ebf=function(_0x1a740e,_0x1449d8){_0x1a740e=_0x1a740e-0x0;var _0x1e201c=_0xebf8[_0x1a740e];return _0x1e201c;};'use strict';var _=require(_0x8ebf('0x0'));var util=require(_0x8ebf('0x1'));var moment=require(_0x8ebf('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ebf('0x3'));var fs=require('fs');var Redis=require(_0x8ebf('0x4'));var db=require(_0x8ebf('0x5'))['db'];var utils=require(_0x8ebf('0x6'));var logger=require(_0x8ebf('0x7'))('rpc');var config=require(_0x8ebf('0x8'));var jayson=require(_0x8ebf('0x9'));var client=jayson[_0x8ebf('0xa')][_0x8ebf('0xb')]({'port':0x232a});config[_0x8ebf('0xc')]=_[_0x8ebf('0xd')](config[_0x8ebf('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ebf('0xe'))(new Redis(config[_0x8ebf('0xc')]));require('./voiceQueueReport.socket')[_0x8ebf('0xf')](socket);function respondWithRpcPromise(_0xb23321,_0x56dd3a,_0x1a0a6a){return new BPromise(function(_0x151029,_0x24adba){return client[_0x8ebf('0x10')](_0xb23321,_0x1a0a6a)[_0x8ebf('0x11')](function(_0x57a20d){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x56dd3a,_0x8ebf('0x12'));logger[_0x8ebf('0x13')](_0x8ebf('0x14'),_0x56dd3a,'request\x20sent',JSON[_0x8ebf('0x15')](_0x57a20d));if(_0x57a20d[_0x8ebf('0x16')]){if(_0x57a20d[_0x8ebf('0x16')][_0x8ebf('0x17')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x56dd3a,_0x57a20d[_0x8ebf('0x16')]['message']);return _0x24adba(_0x57a20d[_0x8ebf('0x16')][_0x8ebf('0x18')]);}logger['error'](_0x8ebf('0x19'),_0x56dd3a,_0x57a20d[_0x8ebf('0x16')][_0x8ebf('0x18')]);return _0x151029(_0x57a20d[_0x8ebf('0x16')][_0x8ebf('0x18')]);}else{logger[_0x8ebf('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x56dd3a,_0x8ebf('0x12'));_0x151029(_0x57a20d[_0x8ebf('0x1b')][_0x8ebf('0x18')]);}})[_0x8ebf('0x1c')](function(_0x5bb04e){logger[_0x8ebf('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x56dd3a,_0x5bb04e);_0x24adba(_0x5bb04e);});});}exports[_0x8ebf('0x1d')]=function(_0x4538a5){var _0x536c06=this;return new Promise(function(_0x2b8e00,_0x88a1e5){return db[_0x8ebf('0x1e')][_0x8ebf('0x1f')]({'raw':_0x4538a5['options']?_0x4538a5[_0x8ebf('0x20')][_0x8ebf('0x21')]===undefined?!![]:![]:!![],'where':_0x4538a5[_0x8ebf('0x20')]?_0x4538a5[_0x8ebf('0x20')][_0x8ebf('0x22')]||null:null,'attributes':_0x4538a5[_0x8ebf('0x20')]?_0x4538a5[_0x8ebf('0x20')]['attributes']||null:null,'limit':_0x4538a5['options']?_0x4538a5['options']['limit']||null:null,'include':_0x4538a5[_0x8ebf('0x20')]?_0x4538a5[_0x8ebf('0x20')][_0x8ebf('0x23')]?_[_0x8ebf('0x24')](_0x4538a5[_0x8ebf('0x20')]['include'],function(_0x310da9){return{'model':db[_0x310da9['model']],'as':_0x310da9['as'],'attributes':_0x310da9['attributes'],'include':_0x310da9['include']?_['map'](_0x310da9[_0x8ebf('0x23')],function(_0x39558c){return{'model':db[_0x39558c[_0x8ebf('0x25')]],'as':_0x39558c['as'],'attributes':_0x39558c[_0x8ebf('0x26')],'include':_0x39558c[_0x8ebf('0x23')]?_[_0x8ebf('0x24')](_0x39558c[_0x8ebf('0x23')],function(_0x45703d){return{'model':db[_0x45703d[_0x8ebf('0x25')]],'as':_0x45703d['as'],'attributes':_0x45703d[_0x8ebf('0x26')]};}):[]};}):[]};}):[]:[]})[_0x8ebf('0x11')](function(_0x1607e3){logger[_0x8ebf('0x1a')](_0x8ebf('0x1d'),_0x4538a5);logger[_0x8ebf('0x13')](_0x8ebf('0x1d'),_0x4538a5,JSON['stringify'](_0x1607e3));_0x2b8e00(_0x1607e3);})[_0x8ebf('0x1c')](function(_0x5c521b){logger[_0x8ebf('0x16')](_0x8ebf('0x1d'),_0x5c521b[_0x8ebf('0x18')],_0x4538a5);_0x88a1e5(_0x536c06[_0x8ebf('0x16')](0x1f4,_0x5c521b[_0x8ebf('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x362c64){var _0x2f2c07=this;return new Promise(function(_0x36be75,_0x27b62f){return db['VoiceQueueReport'][_0x8ebf('0x27')](_0x362c64[_0x8ebf('0x28')],{'raw':_0x362c64[_0x8ebf('0x20')]?_0x362c64[_0x8ebf('0x20')][_0x8ebf('0x21')]===undefined?!![]:![]:!![]})[_0x8ebf('0x11')](function(_0x395831){logger[_0x8ebf('0x1a')]('CreateVoiceQueueReport',_0x362c64);logger[_0x8ebf('0x13')](_0x8ebf('0x29'),_0x362c64,JSON['stringify'](_0x395831));_0x36be75(_0x395831);})[_0x8ebf('0x1c')](function(_0x229bb1){logger['error']('CreateVoiceQueueReport',_0x229bb1[_0x8ebf('0x18')],_0x362c64);_0x27b62f(_0x2f2c07[_0x8ebf('0x16')](0x1f4,_0x229bb1[_0x8ebf('0x18')]));});});};exports[_0x8ebf('0x2a')]=function(_0x346ae9){var _0x34d339=this;return new Promise(function(_0x1371a4,_0x293f8a){return db['VoiceQueueReport'][_0x8ebf('0x2b')](_0x346ae9[_0x8ebf('0x28')],{'raw':_0x346ae9['options']?_0x346ae9[_0x8ebf('0x20')][_0x8ebf('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x346ae9[_0x8ebf('0x20')]?_0x346ae9[_0x8ebf('0x20')]['where']||null:null,'attributes':_0x346ae9[_0x8ebf('0x20')]?_0x346ae9[_0x8ebf('0x20')][_0x8ebf('0x26')]||null:null,'limit':_0x346ae9[_0x8ebf('0x20')]?_0x346ae9['options'][_0x8ebf('0x2c')]||null:null})[_0x8ebf('0x11')](function(_0xfab1fc){logger[_0x8ebf('0x1a')]('UpdateVoiceQueueReport',_0x346ae9);logger[_0x8ebf('0x13')](_0x8ebf('0x2a'),_0x346ae9,JSON[_0x8ebf('0x15')](_0xfab1fc));_0x1371a4(_0xfab1fc);})[_0x8ebf('0x1c')](function(_0x2cc089){logger[_0x8ebf('0x16')](_0x8ebf('0x2a'),_0x2cc089[_0x8ebf('0x18')],_0x346ae9);_0x293f8a(_0x34d339[_0x8ebf('0x16')](0x1f4,_0x2cc089[_0x8ebf('0x18')]));});});}; \ No newline at end of file +var _0x20ab=['VoiceQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','map','include','model','debug','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','info'];(function(_0x1c84d0,_0x369a7a){var _0x39a7e1=function(_0x176172){while(--_0x176172){_0x1c84d0['push'](_0x1c84d0['shift']());}};_0x39a7e1(++_0x369a7a);}(_0x20ab,0x1d0));var _0xb20a=function(_0x54f01a,_0x12e01c){_0x54f01a=_0x54f01a-0x0;var _0x4787f1=_0x20ab[_0x54f01a];return _0x4787f1;};'use strict';var _=require(_0xb20a('0x0'));var util=require(_0xb20a('0x1'));var moment=require(_0xb20a('0x2'));var BPromise=require(_0xb20a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb20a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb20a('0x5'));var logger=require(_0xb20a('0x6'))(_0xb20a('0x7'));var config=require(_0xb20a('0x8'));var jayson=require(_0xb20a('0x9'));var client=jayson[_0xb20a('0xa')][_0xb20a('0xb')]({'port':0x232a});config[_0xb20a('0xc')]=_[_0xb20a('0xd')](config['redis'],{'host':_0xb20a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb20a('0xc')]));require(_0xb20a('0xf'))[_0xb20a('0x10')](socket);function respondWithRpcPromise(_0x36ce6d,_0x2ea506,_0x13d5e8){return new BPromise(function(_0x40c7e2,_0x1ff30f){return client[_0xb20a('0x11')](_0x36ce6d,_0x13d5e8)[_0xb20a('0x12')](function(_0x4475b9){logger[_0xb20a('0x13')](_0xb20a('0x14'),_0x2ea506,_0xb20a('0x15'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2ea506,_0xb20a('0x15'),JSON['stringify'](_0x4475b9));if(_0x4475b9[_0xb20a('0x16')]){if(_0x4475b9[_0xb20a('0x16')][_0xb20a('0x17')]===0x1f4){logger[_0xb20a('0x16')](_0xb20a('0x14'),_0x2ea506,_0x4475b9['error']['message']);return _0x1ff30f(_0x4475b9[_0xb20a('0x16')][_0xb20a('0x18')]);}logger[_0xb20a('0x16')](_0xb20a('0x14'),_0x2ea506,_0x4475b9['error'][_0xb20a('0x18')]);return _0x40c7e2(_0x4475b9[_0xb20a('0x16')][_0xb20a('0x18')]);}else{logger[_0xb20a('0x13')](_0xb20a('0x14'),_0x2ea506,_0xb20a('0x15'));_0x40c7e2(_0x4475b9[_0xb20a('0x19')][_0xb20a('0x18')]);}})[_0xb20a('0x1a')](function(_0x4c2755){logger['error'](_0xb20a('0x14'),_0x2ea506,_0x4c2755);_0x1ff30f(_0x4c2755);});});}exports[_0xb20a('0x1b')]=function(_0x49da48){var _0x51237e=this;return new Promise(function(_0x1dabd0,_0x44bfad){return db[_0xb20a('0x1c')][_0xb20a('0x1d')]({'raw':_0x49da48[_0xb20a('0x1e')]?_0x49da48[_0xb20a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x49da48['options']?_0x49da48[_0xb20a('0x1e')][_0xb20a('0x1f')]||null:null,'attributes':_0x49da48['options']?_0x49da48['options'][_0xb20a('0x20')]||null:null,'limit':_0x49da48[_0xb20a('0x1e')]?_0x49da48[_0xb20a('0x1e')][_0xb20a('0x21')]||null:null,'include':_0x49da48['options']?_0x49da48['options']['include']?_[_0xb20a('0x22')](_0x49da48[_0xb20a('0x1e')][_0xb20a('0x23')],function(_0x50976f){return{'model':db[_0x50976f[_0xb20a('0x24')]],'as':_0x50976f['as'],'attributes':_0x50976f[_0xb20a('0x20')],'include':_0x50976f[_0xb20a('0x23')]?_['map'](_0x50976f['include'],function(_0x2f8905){return{'model':db[_0x2f8905['model']],'as':_0x2f8905['as'],'attributes':_0x2f8905['attributes'],'include':_0x2f8905[_0xb20a('0x23')]?_['map'](_0x2f8905[_0xb20a('0x23')],function(_0x425ab9){return{'model':db[_0x425ab9['model']],'as':_0x425ab9['as'],'attributes':_0x425ab9[_0xb20a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51872e){logger[_0xb20a('0x13')](_0xb20a('0x1b'),_0x49da48);logger[_0xb20a('0x25')](_0xb20a('0x1b'),_0x49da48,JSON['stringify'](_0x51872e));_0x1dabd0(_0x51872e);})[_0xb20a('0x1a')](function(_0x36342e){logger[_0xb20a('0x16')]('GetVoiceQueueReport',_0x36342e['message'],_0x49da48);_0x44bfad(_0x51237e[_0xb20a('0x16')](0x1f4,_0x36342e['message']));});});};exports[_0xb20a('0x26')]=function(_0x115406){var _0x3bd915=this;return new Promise(function(_0x5c0fa2,_0x31f7bc){return db[_0xb20a('0x1c')][_0xb20a('0x27')](_0x115406[_0xb20a('0x28')],{'raw':_0x115406[_0xb20a('0x1e')]?_0x115406[_0xb20a('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xb20a('0x12')](function(_0x4e6428){logger[_0xb20a('0x13')](_0xb20a('0x26'),_0x115406);logger[_0xb20a('0x25')]('CreateVoiceQueueReport',_0x115406,JSON[_0xb20a('0x29')](_0x4e6428));_0x5c0fa2(_0x4e6428);})[_0xb20a('0x1a')](function(_0xc38bec){logger['error'](_0xb20a('0x26'),_0xc38bec[_0xb20a('0x18')],_0x115406);_0x31f7bc(_0x3bd915[_0xb20a('0x16')](0x1f4,_0xc38bec['message']));});});};exports[_0xb20a('0x2a')]=function(_0x5c0c74){var _0x48631a=this;return new Promise(function(_0x30b506,_0x1268ea){return db[_0xb20a('0x1c')][_0xb20a('0x2b')](_0x5c0c74[_0xb20a('0x28')],{'raw':_0x5c0c74[_0xb20a('0x1e')]?_0x5c0c74[_0xb20a('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c0c74[_0xb20a('0x1e')]?_0x5c0c74['options'][_0xb20a('0x1f')]||null:null,'attributes':_0x5c0c74[_0xb20a('0x1e')]?_0x5c0c74[_0xb20a('0x1e')]['attributes']||null:null,'limit':_0x5c0c74[_0xb20a('0x1e')]?_0x5c0c74['options'][_0xb20a('0x21')]||null:null})[_0xb20a('0x12')](function(_0x108f59){logger[_0xb20a('0x13')]('UpdateVoiceQueueReport',_0x5c0c74);logger[_0xb20a('0x25')](_0xb20a('0x2a'),_0x5c0c74,JSON[_0xb20a('0x29')](_0x108f59));_0x30b506(_0x108f59);})['catch'](function(_0x1393be){logger['error'](_0xb20a('0x2a'),_0x1393be['message'],_0x5c0c74);_0x1268ea(_0x48631a[_0xb20a('0x16')](0x1f4,_0x1393be[_0xb20a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index c1a1b96..47fe146 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 _0x92e0=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit'];(function(_0xbe2c1b,_0x15f55e){var _0x1adc30=function(_0x373f3c){while(--_0x373f3c){_0xbe2c1b['push'](_0xbe2c1b['shift']());}};_0x1adc30(++_0x15f55e);}(_0x92e0,0x154));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueReportEvents=require(_0x092e('0x0'));var events=['save',_0x092e('0x1'),_0x092e('0x2')];function createListener(_0x2e3997,_0x116cd1){return function(_0x10ccfe){_0x116cd1[_0x092e('0x3')](_0x2e3997,_0x10ccfe);};}function removeListener(_0x3756db,_0x416760){return function(){VoiceQueueReportEvents[_0x092e('0x4')](_0x3756db,_0x416760);};}exports[_0x092e('0x5')]=function(_0x51779f){for(var _0x48af76=0x0,_0x2f1f0b=events[_0x092e('0x6')];_0x48af76<_0x2f1f0b;_0x48af76++){var _0x1af53d=events[_0x48af76];var _0x4c73a9=createListener(_0x092e('0x7')+_0x1af53d,_0x51779f);VoiceQueueReportEvents['on'](_0x1af53d,_0x4c73a9);}}; \ No newline at end of file +var _0xbfda=['./voiceQueueReport.events','save','remove','emit','register','length','voiceQueueReport:'];(function(_0x25de33,_0x5006e7){var _0x3587b4=function(_0x10e95e){while(--_0x10e95e){_0x25de33['push'](_0x25de33['shift']());}};_0x3587b4(++_0x5006e7);}(_0xbfda,0x1dc));var _0xabfd=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xbfda[_0x251e8c];return _0x1e0c1d;};'use strict';var VoiceQueueReportEvents=require(_0xabfd('0x0'));var events=[_0xabfd('0x1'),_0xabfd('0x2'),'update'];function createListener(_0xafe249,_0x51bb8a){return function(_0x3ba7f2){_0x51bb8a[_0xabfd('0x3')](_0xafe249,_0x3ba7f2);};}function removeListener(_0x384d8e,_0x3818ef){return function(){VoiceQueueReportEvents['removeListener'](_0x384d8e,_0x3818ef);};}exports[_0xabfd('0x4')]=function(_0x4c306b){for(var _0x1dbf70=0x0,_0x537d54=events[_0xabfd('0x5')];_0x1dbf70<_0x537d54;_0x1dbf70++){var _0x49368e=events[_0x1dbf70];var _0x29d5b5=createListener(_0xabfd('0x6')+_0x49368e,_0x4c306b);VoiceQueueReportEvents['on'](_0x49368e,_0x29d5b5);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 0cc72b8..043eec5 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 _0x92e1=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','index','get','show','post','create','put','update','delete','/:id','destroy','multer','util','path'];(function(_0x39b4e6,_0x2eaa1e){var _0x2f75c8=function(_0x5c23db){while(--_0x5c23db){_0x39b4e6['push'](_0x39b4e6['shift']());}};_0x2f75c8(++_0x2eaa1e);}(_0x92e1,0xa8));var _0x192e=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x92e1[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x192e('0x0'));var util=require(_0x192e('0x1'));var path=require(_0x192e('0x2'));var timeout=require(_0x192e('0x3'));var express=require('express');var router=express[_0x192e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x192e('0x5'));var interaction=require(_0x192e('0x6'));var config=require('../../config/environment');var controller=require(_0x192e('0x7'));router['get']('/',auth[_0x192e('0x8')](),controller[_0x192e('0x9')]);router[_0x192e('0xa')]('/:id',auth[_0x192e('0x8')](),controller[_0x192e('0xb')]);router[_0x192e('0xc')]('/',auth[_0x192e('0x8')](),controller[_0x192e('0xd')]);router[_0x192e('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x192e('0xf')]);router[_0x192e('0x10')](_0x192e('0x11'),auth[_0x192e('0x8')](),controller[_0x192e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6865=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','exports','util','path','connect-timeout','Router'];(function(_0x5515d1,_0x40adf6){var _0x1c4c55=function(_0x13dec3){while(--_0x13dec3){_0x5515d1['push'](_0x5515d1['shift']());}};_0x1c4c55(++_0x40adf6);}(_0x6865,0xa7));var _0x5686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6865[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x5686('0x0'));var path=require(_0x5686('0x1'));var timeout=require(_0x5686('0x2'));var express=require('express');var router=express[_0x5686('0x3')]();var fs_extra=require(_0x5686('0x4'));var auth=require(_0x5686('0x5'));var interaction=require(_0x5686('0x6'));var config=require(_0x5686('0x7'));var controller=require(_0x5686('0x8'));router[_0x5686('0x9')]('/',auth[_0x5686('0xa')](),controller[_0x5686('0xb')]);router['get']('/:id',auth[_0x5686('0xa')](),controller[_0x5686('0xc')]);router[_0x5686('0xd')]('/',auth[_0x5686('0xa')](),controller[_0x5686('0xe')]);router[_0x5686('0xf')](_0x5686('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x5686('0x11')](_0x5686('0x10'),auth[_0x5686('0xa')](),controller['destroy']);module[_0x5686('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 ba9cb69..898c58e 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 _0x0b97=['STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports'];(function(_0x502643,_0x2a2900){var _0xd6c2ad=function(_0x8dd690){while(--_0x8dd690){_0x502643['push'](_0x502643['shift']());}};_0xd6c2ad(++_0x2a2900);}(_0x0b97,0x152));var _0x70b9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0b97[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x70b9('0x0'));module[_0x70b9('0x1')]={'time':{'type':Sequelize[_0x70b9('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x70b9('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x70b9('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x70b9('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x70b9('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x70b9('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x70b9('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x70b9('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal'](_0x70b9('0x3'))}}; \ No newline at end of file +var _0x4527=['sequelize','exports','STRING','literal'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x4527,0x1c0));var _0x7452=function(_0x19ff64,_0x19f359){_0x19ff64=_0x19ff64-0x0;var _0x2b677b=_0x4527[_0x19ff64];return _0x2b677b;};'use strict';var Sequelize=require(_0x7452('0x0'));var moment=require('moment');module[_0x7452('0x1')]={'time':{'type':Sequelize[_0x7452('0x2')]},'callid':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x7452('0x3')]('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 d034369..b3fda02 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 _0x3f71=['apply','save','update','then','destroy','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','limit','sort','where','merge','type','filter','includeAll','include','findAll','catch','show','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','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','count','set','Content-Range','json'];(function(_0x479f17,_0x3ddb13){var _0xba4508=function(_0x21eb51){while(--_0x21eb51){_0x479f17['push'](_0x479f17['shift']());}};_0xba4508(++_0x3ddb13);}(_0x3f71,0x1bc));var _0x13f7=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x3f71[_0x355ce8];return _0x1db8b8;};'use strict';var emlformat=require(_0x13f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x13f7('0x1'));var jsonpatch=require(_0x13f7('0x2'));var rp=require('request-promise');var moment=require(_0x13f7('0x3'));var BPromise=require(_0x13f7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x13f7('0x5'));var sox=require('sox');var csv=require(_0x13f7('0x6'));var ejs=require(_0x13f7('0x7'));var fs=require('fs');var fs_extra=require(_0x13f7('0x8'));var _=require('lodash');var squel=require(_0x13f7('0x9'));var crypto=require(_0x13f7('0xa'));var jsforce=require(_0x13f7('0xb'));var deskjs=require(_0x13f7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x13f7('0xd'));var Papa=require(_0x13f7('0xe'));var Redis=require(_0x13f7('0xf'));var authService=require(_0x13f7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13f7('0x11'));var logger=require(_0x13f7('0x12'))(_0x13f7('0x13'));var utils=require('../../config/utils');var config=require(_0x13f7('0x14'));var licenseUtil=require(_0x13f7('0x15'));var db=require(_0x13f7('0x16'))['db'];function respondWithStatusCode(_0x326185,_0x2b085c){_0x2b085c=_0x2b085c||0xcc;return function(_0x2cba0e){if(_0x2cba0e){return _0x326185[_0x13f7('0x17')](_0x2b085c);}return _0x326185[_0x13f7('0x18')](_0x2b085c)[_0x13f7('0x19')]();};}function respondWithResult(_0x578724,_0x257ef2){_0x257ef2=_0x257ef2||0xc8;return function(_0x5a7bc7){if(_0x5a7bc7){return _0x578724[_0x13f7('0x18')](_0x257ef2)['json'](_0x5a7bc7);}};}function respondWithFilteredResult(_0x193ded,_0x2f11cb){return function(_0x240f8f){if(_0x240f8f){var _0x375f19=typeof _0x2f11cb[_0x13f7('0x1a')]===_0x13f7('0x1b')&&typeof _0x2f11cb['limit']==='undefined';var _0x37f44f=_0x240f8f[_0x13f7('0x1c')];var _0x4b8d8b=_0x375f19?0x0:_0x2f11cb['offset'];var _0x202462=_0x375f19?_0x240f8f[_0x13f7('0x1c')]:_0x2f11cb[_0x13f7('0x1a')]+_0x2f11cb['limit'];var _0x470ee4;if(_0x202462>=_0x37f44f){_0x202462=_0x37f44f;_0x470ee4=0xc8;}else{_0x470ee4=0xce;}_0x193ded['status'](_0x470ee4);return _0x193ded[_0x13f7('0x1d')](_0x13f7('0x1e'),_0x4b8d8b+'-'+_0x202462+'/'+_0x37f44f)[_0x13f7('0x1f')](_0x240f8f);}return null;};}function patchUpdates(_0x24b2aa){return function(_0x1150dc){try{jsonpatch[_0x13f7('0x20')](_0x1150dc,_0x24b2aa,!![]);}catch(_0x7799a3){return BPromise['reject'](_0x7799a3);}return _0x1150dc[_0x13f7('0x21')]();};}function saveUpdates(_0x50a5f7,_0x549823){return function(_0x418e79){if(_0x418e79){return _0x418e79[_0x13f7('0x22')](_0x50a5f7)[_0x13f7('0x23')](function(_0x26f0aa){return _0x26f0aa;});}return null;};}function removeEntity(_0xce0d2c,_0x493c4d){return function(_0x59cd78){if(_0x59cd78){return _0x59cd78[_0x13f7('0x24')]()[_0x13f7('0x23')](function(){_0xce0d2c[_0x13f7('0x18')](0xcc)[_0x13f7('0x19')]();});}};}function handleEntityNotFound(_0x2b358c,_0x5bd994){return function(_0xdf994b){if(!_0xdf994b){_0x2b358c[_0x13f7('0x17')](0x194);}return _0xdf994b;};}function handleError(_0xc9d5a6,_0x41b0b3){_0x41b0b3=_0x41b0b3||0x1f4;return function(_0x3e537a){logger['error'](_0x3e537a[_0x13f7('0x25')]);if(_0x3e537a[_0x13f7('0x26')]){delete _0x3e537a['name'];}_0xc9d5a6['status'](_0x41b0b3)[_0x13f7('0x27')](_0x3e537a);};}exports[_0x13f7('0x28')]=function(_0x2650ad,_0x771eb1){var _0x1ac8c4={},_0x5e9b2d={},_0x1245a5={'count':0x0,'rows':[]};var _0x3b2801=_['map'](db[_0x13f7('0x29')][_0x13f7('0x2a')],function(_0x1e5fce){return{'name':_0x1e5fce[_0x13f7('0x2b')],'type':_0x1e5fce['type'][_0x13f7('0x2c')]};});_0x5e9b2d['model']=_[_0x13f7('0x2d')](_0x3b2801,'name');_0x5e9b2d[_0x13f7('0x2e')]=_[_0x13f7('0x2f')](_0x2650ad[_0x13f7('0x2e')]);_0x5e9b2d[_0x13f7('0x30')]=_[_0x13f7('0x31')](_0x5e9b2d['model'],_0x5e9b2d[_0x13f7('0x2e')]);_0x1ac8c4[_0x13f7('0x32')]=_[_0x13f7('0x31')](_0x5e9b2d[_0x13f7('0x33')],qs[_0x13f7('0x34')](_0x2650ad[_0x13f7('0x2e')]['fields']));_0x1ac8c4['attributes']=_0x1ac8c4[_0x13f7('0x32')]['length']?_0x1ac8c4[_0x13f7('0x32')]:_0x5e9b2d[_0x13f7('0x33')];if(!_0x2650ad[_0x13f7('0x2e')]['hasOwnProperty']('nolimit')){_0x1ac8c4[_0x13f7('0x35')]=qs[_0x13f7('0x35')](_0x2650ad[_0x13f7('0x2e')]['limit']);_0x1ac8c4[_0x13f7('0x1a')]=qs[_0x13f7('0x1a')](_0x2650ad[_0x13f7('0x2e')][_0x13f7('0x1a')]);}_0x1ac8c4['order']=qs[_0x13f7('0x36')](_0x2650ad['query'][_0x13f7('0x36')]);_0x1ac8c4[_0x13f7('0x37')]=qs['filters'](_['pick'](_0x2650ad[_0x13f7('0x2e')],_0x5e9b2d[_0x13f7('0x30')]),_0x3b2801);if(_0x2650ad['query']['filter']){_0x1ac8c4['where']=_[_0x13f7('0x38')](_0x1ac8c4[_0x13f7('0x37')],{'$or':_['map'](_0x3b2801,function(_0x3eafc1){if(_0x3eafc1[_0x13f7('0x39')]!=='VIRTUAL'){var _0x2e86a4={};_0x2e86a4[_0x3eafc1[_0x13f7('0x26')]]={'$like':'%'+_0x2650ad[_0x13f7('0x2e')][_0x13f7('0x3a')]+'%'};return _0x2e86a4;}})});}_0x1ac8c4=_[_0x13f7('0x38')]({},_0x1ac8c4,_0x2650ad['options']);var _0x31dd65={'where':_0x1ac8c4[_0x13f7('0x37')]};return db['VoiceQueuesLog'][_0x13f7('0x1c')](_0x31dd65)[_0x13f7('0x23')](function(_0x2569fe){_0x1245a5[_0x13f7('0x1c')]=_0x2569fe;if(_0x2650ad['query'][_0x13f7('0x3b')]){_0x1ac8c4[_0x13f7('0x3c')]=[{'all':!![]}];}return db[_0x13f7('0x29')][_0x13f7('0x3d')](_0x1ac8c4);})['then'](function(_0x455e61){_0x1245a5['rows']=_0x455e61;return _0x1245a5;})[_0x13f7('0x23')](respondWithFilteredResult(_0x771eb1,_0x1ac8c4))[_0x13f7('0x3e')](handleError(_0x771eb1,null));};exports[_0x13f7('0x3f')]=function(_0x233317,_0x2e8b7d){var _0x4a7856={'raw':!![],'where':{'id':_0x233317['params']['id']}},_0x141622={};_0x141622[_0x13f7('0x33')]=_[_0x13f7('0x2f')](db[_0x13f7('0x29')]['rawAttributes']);_0x141622[_0x13f7('0x2e')]=_['keys'](_0x233317[_0x13f7('0x2e')]);_0x141622[_0x13f7('0x30')]=_['intersection'](_0x141622['model'],_0x141622[_0x13f7('0x2e')]);_0x4a7856[_0x13f7('0x32')]=_['intersection'](_0x141622['model'],qs[_0x13f7('0x34')](_0x233317['query']['fields']));_0x4a7856[_0x13f7('0x32')]=_0x4a7856[_0x13f7('0x32')]['length']?_0x4a7856[_0x13f7('0x32')]:_0x141622[_0x13f7('0x33')];if(_0x233317[_0x13f7('0x2e')][_0x13f7('0x3b')]){_0x4a7856[_0x13f7('0x3c')]=[{'all':!![]}];}_0x4a7856=_[_0x13f7('0x38')]({},_0x4a7856,_0x233317['options']);return db[_0x13f7('0x29')][_0x13f7('0x40')](_0x4a7856)[_0x13f7('0x23')](handleEntityNotFound(_0x2e8b7d,null))[_0x13f7('0x23')](respondWithResult(_0x2e8b7d,null))['catch'](handleError(_0x2e8b7d,null));};exports[_0x13f7('0x41')]=function(_0x493e5c,_0x58b695){return db['VoiceQueuesLog']['create'](_0x493e5c['body'],{})[_0x13f7('0x23')](respondWithResult(_0x58b695,0xc9))[_0x13f7('0x3e')](handleError(_0x58b695,null));};exports[_0x13f7('0x22')]=function(_0x4b025d,_0x4a2005){if(_0x4b025d[_0x13f7('0x42')]['id']){delete _0x4b025d[_0x13f7('0x42')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x4b025d[_0x13f7('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a2005,null))[_0x13f7('0x23')](saveUpdates(_0x4b025d[_0x13f7('0x42')],null))[_0x13f7('0x23')](respondWithResult(_0x4a2005,null))['catch'](handleError(_0x4a2005,null));};exports['destroy']=function(_0x2d317f,_0x2a1475){return db[_0x13f7('0x29')]['find']({'where':{'id':_0x2d317f[_0x13f7('0x43')]['id']}})[_0x13f7('0x23')](handleEntityNotFound(_0x2a1475,null))[_0x13f7('0x23')](removeEntity(_0x2a1475,null))[_0x13f7('0x3e')](handleError(_0x2a1475,null));}; \ No newline at end of file +var _0x5829=['find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields'];(function(_0x4ea855,_0x342f7b){var _0x1fa24c=function(_0xda8bdf){while(--_0xda8bdf){_0x4ea855['push'](_0x4ea855['shift']());}};_0x1fa24c(++_0x342f7b);}(_0x5829,0x9e));var _0x9582=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x5829[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require(_0x9582('0x0'));var rimraf=require(_0x9582('0x1'));var zipdir=require(_0x9582('0x2'));var jsonpatch=require(_0x9582('0x3'));var rp=require(_0x9582('0x4'));var moment=require(_0x9582('0x5'));var BPromise=require(_0x9582('0x6'));var Mustache=require(_0x9582('0x7'));var util=require('util');var path=require(_0x9582('0x8'));var sox=require(_0x9582('0x9'));var csv=require(_0x9582('0xa'));var ejs=require(_0x9582('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9582('0xc'));var squel=require('squel');var crypto=require(_0x9582('0xd'));var jsforce=require(_0x9582('0xe'));var deskjs=require(_0x9582('0xf'));var toCsv=require(_0x9582('0xa'));var querystring=require('querystring');var Papa=require(_0x9582('0x10'));var Redis=require(_0x9582('0x11'));var authService=require(_0x9582('0x12'));var qs=require(_0x9582('0x13'));var as=require(_0x9582('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9582('0x15'));var utils=require(_0x9582('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9582('0x17'))['db'];function respondWithStatusCode(_0x4bb946,_0x35a246){_0x35a246=_0x35a246||0xcc;return function(_0x565898){if(_0x565898){return _0x4bb946[_0x9582('0x18')](_0x35a246);}return _0x4bb946[_0x9582('0x19')](_0x35a246)['end']();};}function respondWithResult(_0x152186,_0x5df377){_0x5df377=_0x5df377||0xc8;return function(_0xe57c99){if(_0xe57c99){return _0x152186[_0x9582('0x19')](_0x5df377)[_0x9582('0x1a')](_0xe57c99);}};}function respondWithFilteredResult(_0x16fb5b,_0x294d87){return function(_0x2c498a){if(_0x2c498a){var _0x5a4691=typeof _0x294d87[_0x9582('0x1b')]===_0x9582('0x1c')&&typeof _0x294d87[_0x9582('0x1d')]==='undefined';var _0x15718b=_0x2c498a[_0x9582('0x1e')];var _0x11753d=_0x5a4691?0x0:_0x294d87[_0x9582('0x1b')];var _0x3987b6=_0x5a4691?_0x2c498a[_0x9582('0x1e')]:_0x294d87[_0x9582('0x1b')]+_0x294d87[_0x9582('0x1d')];var _0x36b009;if(_0x3987b6>=_0x15718b){_0x3987b6=_0x15718b;_0x36b009=0xc8;}else{_0x36b009=0xce;}_0x16fb5b[_0x9582('0x19')](_0x36b009);return _0x16fb5b[_0x9582('0x1f')](_0x9582('0x20'),_0x11753d+'-'+_0x3987b6+'/'+_0x15718b)[_0x9582('0x1a')](_0x2c498a);}return null;};}function patchUpdates(_0x9741f0){return function(_0x57694a){try{jsonpatch[_0x9582('0x21')](_0x57694a,_0x9741f0,!![]);}catch(_0x117ffd){return BPromise[_0x9582('0x22')](_0x117ffd);}return _0x57694a[_0x9582('0x23')]();};}function saveUpdates(_0x4d78a0,_0x204551){return function(_0x1759ed){if(_0x1759ed){return _0x1759ed[_0x9582('0x24')](_0x4d78a0)[_0x9582('0x25')](function(_0x179f52){return _0x179f52;});}return null;};}function removeEntity(_0x40a001,_0x363af8){return function(_0x37af62){if(_0x37af62){return _0x37af62['destroy']()[_0x9582('0x25')](function(){_0x40a001['status'](0xcc)[_0x9582('0x26')]();});}};}function handleEntityNotFound(_0x15310f,_0x104299){return function(_0x145215){if(!_0x145215){_0x15310f[_0x9582('0x18')](0x194);}return _0x145215;};}function handleError(_0x5688d4,_0x2de839){_0x2de839=_0x2de839||0x1f4;return function(_0x5d5b0f){logger[_0x9582('0x27')](_0x5d5b0f[_0x9582('0x28')]);if(_0x5d5b0f[_0x9582('0x29')]){delete _0x5d5b0f[_0x9582('0x29')];}_0x5688d4[_0x9582('0x19')](_0x2de839)[_0x9582('0x2a')](_0x5d5b0f);};}exports[_0x9582('0x2b')]=function(_0x5b2ce0,_0x3f0ca3){var _0x5ee612={},_0x1836e1={},_0x2c40ae={'count':0x0,'rows':[]};var _0x547ccf=_[_0x9582('0x2c')](db[_0x9582('0x2d')][_0x9582('0x2e')],function(_0x580a30){return{'name':_0x580a30[_0x9582('0x2f')],'type':_0x580a30[_0x9582('0x30')][_0x9582('0x31')]};});_0x1836e1[_0x9582('0x32')]=_['map'](_0x547ccf,_0x9582('0x29'));_0x1836e1[_0x9582('0x33')]=_[_0x9582('0x34')](_0x5b2ce0[_0x9582('0x33')]);_0x1836e1[_0x9582('0x35')]=_['intersection'](_0x1836e1[_0x9582('0x32')],_0x1836e1[_0x9582('0x33')]);_0x5ee612[_0x9582('0x36')]=_[_0x9582('0x37')](_0x1836e1[_0x9582('0x32')],qs['fields'](_0x5b2ce0['query']['fields']));_0x5ee612[_0x9582('0x36')]=_0x5ee612[_0x9582('0x36')][_0x9582('0x38')]?_0x5ee612['attributes']:_0x1836e1[_0x9582('0x32')];if(!_0x5b2ce0[_0x9582('0x33')][_0x9582('0x39')](_0x9582('0x3a'))){_0x5ee612[_0x9582('0x1d')]=qs['limit'](_0x5b2ce0['query'][_0x9582('0x1d')]);_0x5ee612[_0x9582('0x1b')]=qs[_0x9582('0x1b')](_0x5b2ce0['query'][_0x9582('0x1b')]);}_0x5ee612['order']=qs[_0x9582('0x3b')](_0x5b2ce0['query'][_0x9582('0x3b')]);_0x5ee612[_0x9582('0x3c')]=qs[_0x9582('0x35')](_['pick'](_0x5b2ce0[_0x9582('0x33')],_0x1836e1[_0x9582('0x35')]),_0x547ccf);if(_0x5b2ce0[_0x9582('0x33')][_0x9582('0x3d')]){_0x5ee612['where']=_[_0x9582('0x3e')](_0x5ee612[_0x9582('0x3c')],{'$or':_['map'](_0x547ccf,function(_0xfcc33f){if(_0xfcc33f[_0x9582('0x30')]!==_0x9582('0x3f')){var _0x27a4c8={};_0x27a4c8[_0xfcc33f[_0x9582('0x29')]]={'$like':'%'+_0x5b2ce0['query'][_0x9582('0x3d')]+'%'};return _0x27a4c8;}})});}_0x5ee612=_[_0x9582('0x3e')]({},_0x5ee612,_0x5b2ce0[_0x9582('0x40')]);var _0xe98f76={'where':_0x5ee612['where']};return db['VoiceQueuesLog'][_0x9582('0x1e')](_0xe98f76)[_0x9582('0x25')](function(_0xfeb564){_0x2c40ae[_0x9582('0x1e')]=_0xfeb564;if(_0x5b2ce0[_0x9582('0x33')][_0x9582('0x41')]){_0x5ee612[_0x9582('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x9582('0x43')](_0x5ee612);})[_0x9582('0x25')](function(_0x3d51f4){_0x2c40ae[_0x9582('0x44')]=_0x3d51f4;return _0x2c40ae;})[_0x9582('0x25')](respondWithFilteredResult(_0x3f0ca3,_0x5ee612))[_0x9582('0x45')](handleError(_0x3f0ca3,null));};exports[_0x9582('0x46')]=function(_0x32800c,_0x13cdbd){var _0x4f3d51={'raw':!![],'where':{'id':_0x32800c[_0x9582('0x47')]['id']}},_0x1d0639={};_0x1d0639[_0x9582('0x32')]=_[_0x9582('0x34')](db[_0x9582('0x2d')]['rawAttributes']);_0x1d0639[_0x9582('0x33')]=_[_0x9582('0x34')](_0x32800c[_0x9582('0x33')]);_0x1d0639[_0x9582('0x35')]=_['intersection'](_0x1d0639['model'],_0x1d0639['query']);_0x4f3d51[_0x9582('0x36')]=_[_0x9582('0x37')](_0x1d0639[_0x9582('0x32')],qs['fields'](_0x32800c[_0x9582('0x33')][_0x9582('0x48')]));_0x4f3d51[_0x9582('0x36')]=_0x4f3d51[_0x9582('0x36')]['length']?_0x4f3d51['attributes']:_0x1d0639[_0x9582('0x32')];if(_0x32800c[_0x9582('0x33')][_0x9582('0x41')]){_0x4f3d51[_0x9582('0x42')]=[{'all':!![]}];}_0x4f3d51=_['merge']({},_0x4f3d51,_0x32800c[_0x9582('0x40')]);return db['VoiceQueuesLog'][_0x9582('0x49')](_0x4f3d51)['then'](handleEntityNotFound(_0x13cdbd,null))[_0x9582('0x25')](respondWithResult(_0x13cdbd,null))[_0x9582('0x45')](handleError(_0x13cdbd,null));};exports[_0x9582('0x4a')]=function(_0xc09a83,_0x4d0527){return db[_0x9582('0x2d')][_0x9582('0x4a')](_0xc09a83[_0x9582('0x4b')],{})['then'](respondWithResult(_0x4d0527,0xc9))['catch'](handleError(_0x4d0527,null));};exports[_0x9582('0x24')]=function(_0x1beb3f,_0x4dbe0e){if(_0x1beb3f[_0x9582('0x4b')]['id']){delete _0x1beb3f[_0x9582('0x4b')]['id'];}return db['VoiceQueuesLog'][_0x9582('0x49')]({'where':{'id':_0x1beb3f['params']['id']}})[_0x9582('0x25')](handleEntityNotFound(_0x4dbe0e,null))[_0x9582('0x25')](saveUpdates(_0x1beb3f[_0x9582('0x4b')],null))[_0x9582('0x25')](respondWithResult(_0x4dbe0e,null))[_0x9582('0x45')](handleError(_0x4dbe0e,null));};exports[_0x9582('0x4c')]=function(_0x130395,_0x1a3739){return db[_0x9582('0x2d')][_0x9582('0x49')]({'where':{'id':_0x130395[_0x9582('0x47')]['id']}})[_0x9582('0x25')](handleEntityNotFound(_0x1a3739,null))[_0x9582('0x25')](removeEntity(_0x1a3739,null))['catch'](handleError(_0x1a3739,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b660f7d..73ee32c 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 _0xf296=['define','voice_queues_log','event_dtm','event','dtm','lodash','util','api','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x16d24f,_0x1ae308){var _0x36986a=function(_0x2fb420){while(--_0x2fb420){_0x16d24f['push'](_0x16d24f['shift']());}};_0x36986a(++_0x1ae308);}(_0xf296,0x94));var _0x6f29=function(_0x245307,_0x12cbb9){_0x245307=_0x245307-0x0;var _0x4cf712=_0xf296[_0x245307];return _0x4cf712;};'use strict';var _=require(_0x6f29('0x0'));var util=require(_0x6f29('0x1'));var logger=require('../../config/logger')(_0x6f29('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6f29('0x3'));var fs=require('fs');var path=require(_0x6f29('0x4'));var rimraf=require('rimraf');var config=require(_0x6f29('0x5'));var attributes=require(_0x6f29('0x6'));module[_0x6f29('0x7')]=function(_0x4f0712,_0x1d9c3f){return _0x4f0712[_0x6f29('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x6f29('0x9'),'paranoid':![],'indexes':[{'name':_0x6f29('0xa'),'fields':[_0x6f29('0xb'),_0x6f29('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9f94=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger'];(function(_0x13282f,_0x5cd763){var _0x2c96c4=function(_0x2b4b24){while(--_0x2b4b24){_0x13282f['push'](_0x13282f['shift']());}};_0x2c96c4(++_0x5cd763);}(_0x9f94,0x1e7));var _0x49f9=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9f94[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x49f9('0x0'));var util=require(_0x49f9('0x1'));var logger=require(_0x49f9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x49f9('0x3'));var rp=require(_0x49f9('0x4'));var fs=require('fs');var path=require(_0x49f9('0x5'));var rimraf=require(_0x49f9('0x6'));var config=require(_0x49f9('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x49f9('0x8')]=function(_0x31a7fe,_0x3cd35a){return _0x31a7fe[_0x49f9('0x9')](_0x49f9('0xa'),attributes,{'tableName':_0x49f9('0xb'),'paranoid':![],'indexes':[{'name':_0x49f9('0xc'),'fields':[_0x49f9('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index ee5e382..bbff331 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 _0x2efa=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2efa,0x141));var _0xa2ef=function(_0x2e70af,_0x472b9c){_0x2e70af=_0x2e70af-0x0;var _0x3c5a4d=_0x2efa[_0x2e70af];return _0x3c5a4d;};'use strict';var _=require(_0xa2ef('0x0'));var util=require('util');var moment=require(_0xa2ef('0x1'));var BPromise=require('bluebird');var rs=require(_0xa2ef('0x2'));var fs=require('fs');var Redis=require(_0xa2ef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2ef('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa2ef('0x5'));var jayson=require(_0xa2ef('0x6'));var client=jayson[_0xa2ef('0x7')][_0xa2ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15475e,_0x3352e2,_0x3a14be){return new BPromise(function(_0x2a0778,_0x125f37){return client[_0xa2ef('0x9')](_0x15475e,_0x3a14be)[_0xa2ef('0xa')](function(_0x3f3613){logger[_0xa2ef('0xb')](_0xa2ef('0xc'),_0x3352e2,_0xa2ef('0xd'));logger[_0xa2ef('0xe')](_0xa2ef('0xf'),_0x3352e2,'request\x20sent',JSON[_0xa2ef('0x10')](_0x3f3613));if(_0x3f3613[_0xa2ef('0x11')]){if(_0x3f3613[_0xa2ef('0x11')][_0xa2ef('0x12')]===0x1f4){logger[_0xa2ef('0x11')](_0xa2ef('0xc'),_0x3352e2,_0x3f3613[_0xa2ef('0x11')][_0xa2ef('0x13')]);return _0x125f37(_0x3f3613[_0xa2ef('0x11')]['message']);}logger['error'](_0xa2ef('0xc'),_0x3352e2,_0x3f3613[_0xa2ef('0x11')][_0xa2ef('0x13')]);return _0x2a0778(_0x3f3613[_0xa2ef('0x11')]['message']);}else{logger['info'](_0xa2ef('0xc'),_0x3352e2,'request\x20sent');_0x2a0778(_0x3f3613[_0xa2ef('0x14')][_0xa2ef('0x13')]);}})['catch'](function(_0x4596ea){logger[_0xa2ef('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3352e2,_0x4596ea);_0x125f37(_0x4596ea);});});} \ No newline at end of file +var _0xfd8e=['randomstring','ioredis','../../config/logger','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x15029f,_0x58be73){var _0x36688c=function(_0xc6062){while(--_0xc6062){_0x15029f['push'](_0x15029f['shift']());}};_0x36688c(++_0x58be73);}(_0xfd8e,0xa4));var _0xefd8=function(_0x58998c,_0x2b9ab4){_0x58998c=_0x58998c-0x0;var _0x9789db=_0xfd8e[_0x58998c];return _0x9789db;};'use strict';var _=require(_0xefd8('0x0'));var util=require(_0xefd8('0x1'));var moment=require(_0xefd8('0x2'));var BPromise=require(_0xefd8('0x3'));var rs=require(_0xefd8('0x4'));var fs=require('fs');var Redis=require(_0xefd8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xefd8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xefd8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x112abd,_0x484397,_0x389311){return new BPromise(function(_0x5aaf2e,_0x667de6){return client[_0xefd8('0x8')](_0x112abd,_0x389311)[_0xefd8('0x9')](function(_0x1a3d1c){logger[_0xefd8('0xa')](_0xefd8('0xb'),_0x484397,_0xefd8('0xc'));logger[_0xefd8('0xd')](_0xefd8('0xe'),_0x484397,_0xefd8('0xc'),JSON[_0xefd8('0xf')](_0x1a3d1c));if(_0x1a3d1c[_0xefd8('0x10')]){if(_0x1a3d1c[_0xefd8('0x10')][_0xefd8('0x11')]===0x1f4){logger['error'](_0xefd8('0xb'),_0x484397,_0x1a3d1c[_0xefd8('0x10')]['message']);return _0x667de6(_0x1a3d1c[_0xefd8('0x10')][_0xefd8('0x12')]);}logger[_0xefd8('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x484397,_0x1a3d1c['error']['message']);return _0x5aaf2e(_0x1a3d1c[_0xefd8('0x10')][_0xefd8('0x12')]);}else{logger[_0xefd8('0xa')](_0xefd8('0xb'),_0x484397,_0xefd8('0xc'));_0x5aaf2e(_0x1a3d1c[_0xefd8('0x13')][_0xefd8('0x12')]);}})[_0xefd8('0x14')](function(_0x1c15d7){logger['error'](_0xefd8('0xb'),_0x484397,_0x1c15d7);_0x667de6(_0x1c15d7);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 2e15d1a..4921d91 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 _0xc875=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x2539b7,_0x4f9f50){var _0x1a2456=function(_0x228683){while(--_0x228683){_0x2539b7['push'](_0x2539b7['shift']());}};_0x1a2456(++_0x4f9f50);}(_0xc875,0x82));var _0x5c87=function(_0x5457ec,_0x1ddf31){_0x5457ec=_0x5457ec-0x0;var _0x3f04a7=_0xc875[_0x5457ec];return _0x3f04a7;};'use strict';var multer=require(_0x5c87('0x0'));var util=require(_0x5c87('0x1'));var path=require('path');var timeout=require(_0x5c87('0x2'));var express=require('express');var router=express[_0x5c87('0x3')]();var fs_extra=require(_0x5c87('0x4'));var auth=require(_0x5c87('0x5'));var interaction=require(_0x5c87('0x6'));var config=require(_0x5c87('0x7'));var controller=require('./voiceRecording.controller');router[_0x5c87('0x8')]('/',auth[_0x5c87('0x9')](),controller['index']);router[_0x5c87('0x8')](_0x5c87('0xa'),auth[_0x5c87('0x9')](),controller['describe']);router[_0x5c87('0x8')](_0x5c87('0xb'),auth[_0x5c87('0x9')](),controller[_0x5c87('0xc')]);router[_0x5c87('0x8')](_0x5c87('0xd'),auth['isAuthenticated'](),controller[_0x5c87('0xe')]);router[_0x5c87('0x8')](_0x5c87('0xf'),controller[_0x5c87('0x10')]);router['get'](_0x5c87('0x11'),auth[_0x5c87('0x9')](),controller[_0x5c87('0x12')]);router[_0x5c87('0x13')]('/',auth['isAuthenticated'](),controller[_0x5c87('0x14')]);router[_0x5c87('0x13')](_0x5c87('0x11'),auth[_0x5c87('0x9')](),controller[_0x5c87('0x15')]);router[_0x5c87('0x16')](_0x5c87('0xb'),auth[_0x5c87('0x9')](),controller[_0x5c87('0x17')]);router[_0x5c87('0x18')](_0x5c87('0xb'),auth[_0x5c87('0x9')](),controller[_0x5c87('0x19')]);module[_0x5c87('0x1a')]=router; \ No newline at end of file +var _0xede0=['put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xede0,0xa0));var _0x0ede=function(_0x5372e6,_0x38b930){_0x5372e6=_0x5372e6-0x0;var _0x4ea514=_0xede0[_0x5372e6];return _0x4ea514;};'use strict';var multer=require(_0x0ede('0x0'));var util=require('util');var path=require(_0x0ede('0x1'));var timeout=require(_0x0ede('0x2'));var express=require('express');var router=express[_0x0ede('0x3')]();var fs_extra=require(_0x0ede('0x4'));var auth=require(_0x0ede('0x5'));var interaction=require(_0x0ede('0x6'));var config=require(_0x0ede('0x7'));var controller=require('./voiceRecording.controller');router[_0x0ede('0x8')]('/',auth['isAuthenticated'](),controller[_0x0ede('0x9')]);router[_0x0ede('0x8')](_0x0ede('0xa'),auth[_0x0ede('0xb')](),controller[_0x0ede('0xc')]);router[_0x0ede('0x8')](_0x0ede('0xd'),auth[_0x0ede('0xb')](),controller[_0x0ede('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x0ede('0x8')](_0x0ede('0xf'),controller[_0x0ede('0x10')]);router[_0x0ede('0x8')](_0x0ede('0x11'),auth[_0x0ede('0xb')](),controller[_0x0ede('0x12')]);router[_0x0ede('0x13')]('/',auth['isAuthenticated'](),controller[_0x0ede('0x14')]);router[_0x0ede('0x13')](_0x0ede('0x11'),auth['isAuthenticated'](),controller[_0x0ede('0x15')]);router[_0x0ede('0x16')]('/:id',auth[_0x0ede('0xb')](),controller[_0x0ede('0x17')]);router['delete']('/:id',auth[_0x0ede('0xb')](),controller[_0x0ede('0x18')]);module[_0x0ede('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 436d8ff..3d90f34 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(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 10e6c7d..e590e39 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 _0xe2d8=['findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','bucket','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','VoiceRecording','fieldName','type','key','model','differenceBy','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','catch','find','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','secrets','recording','existsSync','Sequelize','filename','unlink','message','downloads','sequelize','MD5','col','token','$and','push','ValidationError','VoiceRecording\x20not\x20found','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','startTranscriptionJob','[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','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe'];(function(_0x428e44,_0x5caca9){var _0x29263e=function(_0x59a9a7){while(--_0x59a9a7){_0x428e44['push'](_0x428e44['shift']());}};_0x29263e(++_0x5caca9);}(_0xe2d8,0x1cf));var _0x8e2d=function(_0x421d0f,_0x14954c){_0x421d0f=_0x421d0f-0x0;var _0x1e520c=_0xe2d8[_0x421d0f];return _0x1e520c;};'use strict';var emlformat=require(_0x8e2d('0x0'));var rimraf=require(_0x8e2d('0x1'));var zipdir=require(_0x8e2d('0x2'));var jsonpatch=require(_0x8e2d('0x3'));var rp=require(_0x8e2d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8e2d('0x5'));var path=require('path');var sox=require(_0x8e2d('0x6'));var csv=require(_0x8e2d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e2d('0x8'));var _=require(_0x8e2d('0x9'));var squel=require(_0x8e2d('0xa'));var crypto=require(_0x8e2d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e2d('0x7'));var querystring=require(_0x8e2d('0xc'));var Papa=require(_0x8e2d('0xd'));var AWS=require(_0x8e2d('0xe'));var uuidv4=require(_0x8e2d('0xf'));var Redis=require(_0x8e2d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8e2d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e2d('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x8e2d('0x13'));var licenseUtil=require(_0x8e2d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58be8d,_0x139d1e){_0x139d1e=_0x139d1e||0xcc;return function(_0x3d21f9){if(_0x3d21f9){return _0x58be8d[_0x8e2d('0x15')](_0x139d1e);}return _0x58be8d[_0x8e2d('0x16')](_0x139d1e)[_0x8e2d('0x17')]();};}function respondWithResult(_0x2a9731,_0x23984d){_0x23984d=_0x23984d||0xc8;return function(_0x806b03){if(_0x806b03){return _0x2a9731['status'](_0x23984d)['json'](_0x806b03);}};}function respondWithFilteredResult(_0x331aca,_0x19069e){return function(_0x3d9e4c){if(_0x3d9e4c){var _0xd8df50=typeof _0x19069e[_0x8e2d('0x18')]==='undefined'&&typeof _0x19069e[_0x8e2d('0x19')]===_0x8e2d('0x1a');var _0xb82081=_0x3d9e4c[_0x8e2d('0x1b')];var _0x2c17b0=_0xd8df50?0x0:_0x19069e[_0x8e2d('0x18')];var _0x3c3443=_0xd8df50?_0x3d9e4c[_0x8e2d('0x1b')]:_0x19069e[_0x8e2d('0x18')]+_0x19069e['limit'];var _0x8c4f1f;if(_0x3c3443>=_0xb82081){_0x3c3443=_0xb82081;_0x8c4f1f=0xc8;}else{_0x8c4f1f=0xce;}_0x331aca[_0x8e2d('0x16')](_0x8c4f1f);return _0x331aca[_0x8e2d('0x1c')]('Content-Range',_0x2c17b0+'-'+_0x3c3443+'/'+_0xb82081)[_0x8e2d('0x1d')](_0x3d9e4c);}return null;};}function patchUpdates(_0x20bae9){return function(_0x3bee7c){try{jsonpatch[_0x8e2d('0x1e')](_0x3bee7c,_0x20bae9,!![]);}catch(_0x360a70){return BPromise[_0x8e2d('0x1f')](_0x360a70);}return _0x3bee7c[_0x8e2d('0x20')]();};}function saveUpdates(_0x430c90,_0x231c50){return function(_0x3672b4){if(_0x3672b4){return _0x3672b4[_0x8e2d('0x21')](_0x430c90)[_0x8e2d('0x22')](function(_0x4b72d8){return _0x4b72d8;});}return null;};}function removeEntity(_0x3f4801,_0x50cd88){return function(_0x2d8968){if(_0x2d8968){return _0x2d8968[_0x8e2d('0x23')]()[_0x8e2d('0x22')](function(){_0x3f4801[_0x8e2d('0x16')](0xcc)[_0x8e2d('0x17')]();});}};}function handleEntityNotFound(_0x949eec,_0x4a7ac2){return function(_0x29383f){if(!_0x29383f){_0x949eec['sendStatus'](0x194);}return _0x29383f;};}function handleError(_0x5dadb9,_0x39a13a){_0x39a13a=_0x39a13a||0x1f4;return function(_0x23c396){logger['error'](_0x23c396[_0x8e2d('0x24')]);if(_0x23c396[_0x8e2d('0x25')]){delete _0x23c396[_0x8e2d('0x25')];}_0x5dadb9['status'](_0x39a13a)[_0x8e2d('0x26')](_0x23c396);};}exports[_0x8e2d('0x27')]=function(_0x4ad8f4,_0x3c5578){var _0x3e6eae={},_0x1d16ea={},_0x3180ef={'count':0x0,'rows':[]};var _0x5ab41e=_['map'](db[_0x8e2d('0x28')]['rawAttributes'],function(_0x852b75){return{'name':_0x852b75[_0x8e2d('0x29')],'type':_0x852b75[_0x8e2d('0x2a')][_0x8e2d('0x2b')]};});_0x1d16ea[_0x8e2d('0x2c')]=_[_0x8e2d('0x2d')](_[_0x8e2d('0x2e')](_0x5ab41e,_0x8e2d('0x25')),['format']);_0x1d16ea[_0x8e2d('0x2f')]=_[_0x8e2d('0x30')](_0x4ad8f4['query']);_0x1d16ea['filters']=_['intersection'](_0x1d16ea[_0x8e2d('0x2c')],_0x1d16ea[_0x8e2d('0x2f')]);_0x3e6eae[_0x8e2d('0x31')]=_[_0x8e2d('0x32')](_0x1d16ea[_0x8e2d('0x2c')],qs[_0x8e2d('0x33')](_0x4ad8f4[_0x8e2d('0x2f')][_0x8e2d('0x33')]));_0x3e6eae[_0x8e2d('0x31')]=_0x3e6eae[_0x8e2d('0x31')][_0x8e2d('0x34')]?_0x3e6eae[_0x8e2d('0x31')]:_0x1d16ea[_0x8e2d('0x2c')];if(!_0x4ad8f4[_0x8e2d('0x2f')][_0x8e2d('0x35')]('nolimit')){_0x3e6eae[_0x8e2d('0x19')]=qs['limit'](_0x4ad8f4['query'][_0x8e2d('0x19')]);_0x3e6eae[_0x8e2d('0x18')]=qs[_0x8e2d('0x18')](_0x4ad8f4[_0x8e2d('0x2f')]['offset']);}_0x3e6eae['order']=qs['sort'](_0x4ad8f4[_0x8e2d('0x2f')]['sort']);_0x3e6eae[_0x8e2d('0x36')]=qs['filters'](_[_0x8e2d('0x37')](_0x4ad8f4['query'],_0x1d16ea[_0x8e2d('0x38')]),_0x5ab41e);if(_0x4ad8f4[_0x8e2d('0x2f')][_0x8e2d('0x39')]){_0x3e6eae[_0x8e2d('0x36')]=_['merge'](_0x3e6eae[_0x8e2d('0x36')],{'$or':_[_0x8e2d('0x2e')](_0x5ab41e,function(_0x4d1dfc){if(_0x4d1dfc['type']!==_0x8e2d('0x3a')){var _0x4dd3e5={};_0x4dd3e5[_0x4d1dfc[_0x8e2d('0x25')]]={'$like':'%'+_0x4ad8f4['query'][_0x8e2d('0x39')]+'%'};return _0x4dd3e5;}})});}_0x3e6eae=_[_0x8e2d('0x3b')]({},_0x3e6eae,_0x4ad8f4[_0x8e2d('0x3c')]);var _0xe1d193={'where':_0x3e6eae[_0x8e2d('0x36')]};return db['VoiceRecording'][_0x8e2d('0x1b')](_0xe1d193)[_0x8e2d('0x22')](function(_0x52c025){_0x3180ef[_0x8e2d('0x1b')]=_0x52c025;if(_0x4ad8f4[_0x8e2d('0x2f')][_0x8e2d('0x3d')]){_0x3e6eae[_0x8e2d('0x3e')]=[{'all':!![]}];}return db[_0x8e2d('0x28')][_0x8e2d('0x3f')](_0x3e6eae);})['then'](function(_0x104153){_0x3180ef[_0x8e2d('0x40')]=_0x104153;return _0x3180ef;})[_0x8e2d('0x22')](respondWithFilteredResult(_0x3c5578,_0x3e6eae))['catch'](handleError(_0x3c5578,null));};exports[_0x8e2d('0x41')]=function(_0x15d12c,_0x2d412d){var _0x2fb5b7={'raw':![],'where':{'id':_0x15d12c[_0x8e2d('0x42')]['id']}},_0x3dd225={};_0x3dd225['model']=_[_0x8e2d('0x30')](db[_0x8e2d('0x28')][_0x8e2d('0x43')]);_0x3dd225[_0x8e2d('0x2f')]=_[_0x8e2d('0x30')](_0x15d12c['query']);_0x3dd225[_0x8e2d('0x38')]=_[_0x8e2d('0x32')](_0x3dd225[_0x8e2d('0x2c')],_0x3dd225['query']);_0x2fb5b7[_0x8e2d('0x31')]=_[_0x8e2d('0x32')](_0x3dd225[_0x8e2d('0x2c')],qs[_0x8e2d('0x33')](_0x15d12c[_0x8e2d('0x2f')][_0x8e2d('0x33')]));_0x2fb5b7[_0x8e2d('0x31')]=_0x2fb5b7[_0x8e2d('0x31')][_0x8e2d('0x34')]?_0x2fb5b7[_0x8e2d('0x31')]:_0x3dd225['model'];if(_0x15d12c['query'][_0x8e2d('0x3d')]){_0x2fb5b7['include']=[{'all':!![]}];}_0x2fb5b7=_[_0x8e2d('0x3b')]({},_0x2fb5b7,_0x15d12c[_0x8e2d('0x3c')]);return db['VoiceRecording']['find'](_0x2fb5b7)[_0x8e2d('0x22')](handleEntityNotFound(_0x2d412d,null))[_0x8e2d('0x22')](respondWithResult(_0x2d412d,null))['catch'](handleError(_0x2d412d,null));};exports['create']=function(_0x30d1ce,_0x537db9){return db['VoiceRecording'][_0x8e2d('0x44')](_0x30d1ce[_0x8e2d('0x45')],{})[_0x8e2d('0x22')](respondWithResult(_0x537db9,0xc9))[_0x8e2d('0x46')](handleError(_0x537db9,null));};exports[_0x8e2d('0x21')]=function(_0x27658b,_0x7389af){if(_0x27658b[_0x8e2d('0x45')]['id']){delete _0x27658b['body']['id'];}return db[_0x8e2d('0x28')][_0x8e2d('0x47')]({'where':{'id':_0x27658b[_0x8e2d('0x42')]['id']}})[_0x8e2d('0x22')](handleEntityNotFound(_0x7389af,null))[_0x8e2d('0x22')](saveUpdates(_0x27658b[_0x8e2d('0x45')],null))['then'](respondWithResult(_0x7389af,null))['catch'](handleError(_0x7389af,null));};exports[_0x8e2d('0x48')]=function(_0x4334ae,_0x44f3ef){return db[_0x8e2d('0x28')][_0x8e2d('0x48')]()[_0x8e2d('0x22')](respondWithResult(_0x44f3ef,null))['catch'](handleError(_0x44f3ef,null));};exports[_0x8e2d('0x49')]=function(_0x327c56,_0x310c16,_0x42e4b0){var _0x524300=require(_0x8e2d('0x4a'));var _0x4c4a0f=![];var _0xdd089d={};if(_0x327c56[_0x8e2d('0x2f')][_0x8e2d('0x2a')]&&_0x327c56[_0x8e2d('0x2f')][_0x8e2d('0x2a')]===_0x8e2d('0x4b')){_0xdd089d[_0x8e2d('0x4b')]=_0x327c56['params']['id'];}else{_0xdd089d['id']=_0x327c56[_0x8e2d('0x42')]['id'];}return db[_0x8e2d('0x28')][_0x8e2d('0x47')]({'where':_0xdd089d,'attributes':['id','value'],'raw':!![]})[_0x8e2d('0x22')](handleEntityNotFound(_0x310c16,null))['then'](function(_0x4e4ef6){if(_0x4e4ef6){var _0x2cdffc=_0x4e4ef6[_0x8e2d('0x4c')];var _0x4b5681=util[_0x8e2d('0x4d')](_0x8e2d('0x4e'),_0x2cdffc);if(fs['existsSync'](_0x4b5681)){_0x4c4a0f=!![];return _0x524300['decryptFile'](_0x4b5681,_0x2cdffc,config[_0x8e2d('0x4f')][_0x8e2d('0x50')])['then'](function(){return _0x4e4ef6;});}return _0x4e4ef6;}})['then'](function(_0x53b206){if(_0x53b206){var _0x3c9a8c=_0x53b206[_0x8e2d('0x4c')];if(!fs[_0x8e2d('0x51')](_0x3c9a8c)){throw new db[(_0x8e2d('0x52'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x53b206['filename']){return _0x310c16[_0x8e2d('0x49')](_0x3c9a8c,_0x53b206[_0x8e2d('0x53')]+path['extname'](_0x3c9a8c),function(){if(_0x4c4a0f){fs[_0x8e2d('0x54')](_0x3c9a8c);}});}else{return _0x310c16[_0x8e2d('0x49')](_0x3c9a8c,function(_0x228bd2){if(_0x4c4a0f){fs[_0x8e2d('0x54')](_0x3c9a8c);}});}}})[_0x8e2d('0x46')](function(_0x4257aa){if(_0x4257aa[_0x8e2d('0x55')]==='VoiceRecording\x20not\x20found'){_0x310c16['status'](0x194)[_0x8e2d('0x26')]('Not\x20found');}else{return handleError(_0x310c16,null);}});};exports[_0x8e2d('0x56')]=function(_0x16366a,_0x921b3a,_0x225af0){var _0x137f3d=require(_0x8e2d('0x4a'));var _0xeea12f=![];var _0x1a2b60={'$and':[db[_0x8e2d('0x57')][_0x8e2d('0x36')](db[_0x8e2d('0x57')]['fn'](_0x8e2d('0x58'),db[_0x8e2d('0x57')][_0x8e2d('0x59')](_0x8e2d('0x4b'))),_0x16366a['query'][_0x8e2d('0x5a')])]};if(_0x16366a[_0x8e2d('0x2f')][_0x8e2d('0x2a')]&&_0x16366a[_0x8e2d('0x2f')]['type']===_0x8e2d('0x4b')){_0x1a2b60[_0x8e2d('0x5b')][_0x8e2d('0x5c')]({'uniqueid':_0x16366a['params']['id']});}else{_0x1a2b60[_0x8e2d('0x5b')][_0x8e2d('0x5c')]({'id':_0x16366a[_0x8e2d('0x42')]['id']});}return db[_0x8e2d('0x28')][_0x8e2d('0x47')]({'where':_0x1a2b60,'attributes':['id',_0x8e2d('0x4c')],'raw':!![]})[_0x8e2d('0x22')](handleEntityNotFound(_0x921b3a,null))[_0x8e2d('0x22')](function(_0x1c9c2b){if(_0x1c9c2b){var _0x1d35cd=util['format'](_0x8e2d('0x4e'),_0x1c9c2b[_0x8e2d('0x4c')]);if(fs[_0x8e2d('0x51')](_0x1d35cd)){_0xeea12f=!![];return _0x137f3d['decryptFile'](_0x1d35cd,_0x1c9c2b[_0x8e2d('0x4c')],config[_0x8e2d('0x4f')][_0x8e2d('0x50')])[_0x8e2d('0x22')](function(){return _0x1c9c2b;});}return _0x1c9c2b;}})[_0x8e2d('0x22')](function(_0x19716d){if(_0x19716d){if(!fs[_0x8e2d('0x51')](_0x19716d['value'])){throw new db[(_0x8e2d('0x52'))][(_0x8e2d('0x5d'))](_0x8e2d('0x5e'));}if(_0x19716d[_0x8e2d('0x53')]){return _0x921b3a['download'](_0x19716d[_0x8e2d('0x4c')],_0x19716d['filename']+path[_0x8e2d('0x5f')](_0x19716d[_0x8e2d('0x4c')]),function(){if(_0xeea12f){fs[_0x8e2d('0x54')](_0x19716d[_0x8e2d('0x4c')]);}});}else{return _0x921b3a[_0x8e2d('0x49')](_0x19716d[_0x8e2d('0x4c')],function(_0x44555d){if(_0xeea12f){fs[_0x8e2d('0x54')](_0x19716d[_0x8e2d('0x4c')]);}});}}})[_0x8e2d('0x46')](handleError(_0x921b3a,null));};exports[_0x8e2d('0x23')]=function(_0x45f95c,_0x42f4f1){return db[_0x8e2d('0x28')][_0x8e2d('0x47')]({'where':{'id':_0x45f95c[_0x8e2d('0x42')]['id']}})[_0x8e2d('0x22')](function(_0x1f95c9){if(_[_0x8e2d('0x60')](_0x1f95c9)){throw new ReferenceError(_0x8e2d('0x61'));}return _0x1f95c9;})[_0x8e2d('0x22')](function(_0x712d6d){var _0x3369f6=_0x712d6d[_0x8e2d('0x4c')];logger[_0x8e2d('0x62')](_0x8e2d('0x63'),_0x3369f6);if(!_[_0x8e2d('0x60')](_0x712d6d[_0x8e2d('0x4c')])&&fs[_0x8e2d('0x51')](_0x3369f6)){logger[_0x8e2d('0x62')](_0x8e2d('0x64')+_0x3369f6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3369f6);}_0x3369f6=_0x3369f6+_0x8e2d('0x65');if(!_[_0x8e2d('0x60')](_0x712d6d['value'])&&fs[_0x8e2d('0x51')](_0x3369f6)){logger['info'](_0x8e2d('0x64')+_0x3369f6+_0x8e2d('0x66'));fs['unlinkSync'](_0x3369f6);}return _0x712d6d;})[_0x8e2d('0x22')](function(_0x4e9c80){if(!_0x4e9c80)throw new InternalError();return _0x4e9c80[_0x8e2d('0x23')]();})['then'](function(){_0x42f4f1[_0x8e2d('0x16')](0xcc)[_0x8e2d('0x17')]();})[_0x8e2d('0x46')](handleError(_0x42f4f1,null));};function getBucketslist(_0x219c54,_0x5f3826,_0x168d72){return new Promise(function(_0x37cea9,_0x5512bf){var _0x22a10b=new AWS['S3']({'accessKeyId':_0x5f3826,'secretAccessKey':_0x219c54,'region':_0x168d72});_0x22a10b['listBuckets']({},function(_0x487420,_0x584442){if(_0x487420){return _0x5512bf(_0x487420);}else{return _0x37cea9(_0x584442);}});});}function createBucket(_0x3a42bb,_0x5b83a7,_0x44d971,_0x8e4144){return new Promise(function(_0x5419ec,_0xb5b74c){var _0x4c1be6=new AWS['S3']({'accessKeyId':_0x5b83a7,'secretAccessKey':_0x3a42bb,'region':_0x44d971});_0x4c1be6[_0x8e2d('0x67')]({'Bucket':_0x8e4144},function(_0x28c201,_0x5b8efb){if(_0x28c201){return _0xb5b74c(_0x28c201);}else{return _0x5419ec(_0x5b8efb);}});});}function uploadFile(_0x5eccf7,_0x3ff62e,_0x8b49f1,_0x542ccd,_0x569413,_0x52a0c8){return new Promise(function(_0x23962c,_0x655fbd){var _0x3b433b=new AWS['S3']({'accessKeyId':_0x3ff62e,'secretAccessKey':_0x5eccf7,'region':_0x8b49f1});_0x3b433b['upload']({'Bucket':_0x542ccd,'Key':_0x569413,'Body':_0x52a0c8},function(_0xab4331,_0x34bb65){if(_0xab4331){return _0x655fbd(_0xab4331);}else{return _0x23962c(_0x34bb65);}});});}function startTranscribe(_0x26796b,_0x334722,_0x21afb9,_0x373ba8,_0x4cd2e0,_0x5020ab){return new Promise(function(_0x284532,_0xa0135f){var _0x4ce123=new AWS['TranscribeService']({'accessKeyId':_0x334722,'secretAccessKey':_0x26796b,'region':_0x21afb9});_0x4ce123[_0x8e2d('0x68')]({'TranscriptionJobName':_0x373ba8,'LanguageCode':_0x4cd2e0,'Media':{'MediaFileUri':_0x5020ab}},function(_0x2293ba,_0x206c7b){if(_0x2293ba){return _0xa0135f(_0x2293ba);}else{return _0x284532(_0x206c7b);}});});}function transcribe(_0x149e10,_0x2ec5ee,_0x3f87f3,_0x2989c1,_0x4a7278,_0x416115,_0x3d61f3){return new Promise(function(_0x38bd49,_0x415c1e){var _0x589fd6={};logger[_0x8e2d('0x62')](util['format'](_0x8e2d('0x69'),_0x149e10,_0x4a7278));return uploadFile(_0x2ec5ee,_0x3f87f3,_0x2989c1,_0x4a7278,path[_0x8e2d('0x6a')](_0x416115),fs[_0x8e2d('0x6b')](_0x416115))['then'](function(_0x372cf7){logger[_0x8e2d('0x62')](util[_0x8e2d('0x4d')](_0x8e2d('0x6c'),_0x149e10,_0x4a7278,_0x372cf7[_0x8e2d('0x6d')]));_0x589fd6['bucket']=_0x372cf7[_0x8e2d('0x6e')];_0x589fd6['location']=_0x372cf7[_0x8e2d('0x6d')];logger['info'](util[_0x8e2d('0x4d')](_0x8e2d('0x6f'),_0x149e10));return startTranscribe(_0x2ec5ee,_0x3f87f3,_0x2989c1,uuidv4(),_0x3d61f3,_0x372cf7[_0x8e2d('0x6d')]);})[_0x8e2d('0x22')](function(_0x479bb1){logger[_0x8e2d('0x62')](util[_0x8e2d('0x4d')](_0x8e2d('0x70'),_0x149e10,_0x479bb1[_0x8e2d('0x71')]['TranscriptionJobName']));_0x589fd6['transcribeName']=_0x479bb1[_0x8e2d('0x71')][_0x8e2d('0x72')];_0x589fd6[_0x8e2d('0x73')]=_0x479bb1[_0x8e2d('0x71')]['TranscriptionJobStatus'];return _0x38bd49(_0x589fd6);})[_0x8e2d('0x46')](function(_0xb772ca){return _0x415c1e(_0xb772ca);});});}exports[_0x8e2d('0x74')]=function(_0x2fcb46,_0x1a0146,_0x351b66){var _0x1159b7;var _0x527d74;var _0x3dbb70;var _0x308712=require(_0x8e2d('0x4a'));return db['VoiceRecording'][_0x8e2d('0x75')]({'where':{'id':_0x2fcb46[_0x8e2d('0x42')]['id']}})[_0x8e2d('0x22')](function(_0x599aa5){if(_0x599aa5){var _0x56adcf=util['format'](_0x8e2d('0x4e'),_0x599aa5[_0x8e2d('0x4c')]);if(fs['existsSync'](_0x56adcf)){cypher=!![];return _0x308712['decryptFile'](_0x56adcf,_0x599aa5[_0x8e2d('0x4c')],config['secrets'][_0x8e2d('0x50')])[_0x8e2d('0x22')](function(){return _0x599aa5;});}return _0x599aa5;}})[_0x8e2d('0x22')](function(_0x364e1b){if(!_0x364e1b){throw new db['Sequelize'][(_0x8e2d('0x5d'))](_0x8e2d('0x76'));}_0x527d74=_0x364e1b;return db['Setting'][_0x8e2d('0x75')]({'where':{'id':0x1}});})[_0x8e2d('0x22')](handleEntityNotFound(_0x1a0146,null))[_0x8e2d('0x22')](function(_0x16551d){if(_0x16551d){_0x1159b7=_0x16551d;if(!_0x1159b7[_0x8e2d('0x77')]||!_0x1159b7[_0x8e2d('0x78')]||!_0x1159b7['transcribeRegion']||!_0x1159b7['language']||!_0x1159b7[_0x8e2d('0x79')]){throw new db[(_0x8e2d('0x52'))][(_0x8e2d('0x5d'))]('Transcribe\x20not\x20configured');}if(_0x2fcb46[_0x8e2d('0x45')][_0x8e2d('0x7a')]&&(!_0x1159b7[_0x8e2d('0x7b')]||!_0x1159b7[_0x8e2d('0x7c')]||!_0x1159b7[_0x8e2d('0x7d')]||!_0x1159b7['language']||!_0x1159b7[_0x8e2d('0x79')])){throw new db[(_0x8e2d('0x52'))][(_0x8e2d('0x5d'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x8e2d('0x75')]({'where':{'id':_0x1159b7[_0x8e2d('0x78')]}});}})[_0x8e2d('0x22')](function(_0x43abd3){if(!_0x43abd3){throw new db[(_0x8e2d('0x52'))][(_0x8e2d('0x5d'))](_0x8e2d('0x7e'));}if(!_0x43abd3[_0x8e2d('0x7f')]||!_0x43abd3['data2']){throw new db[(_0x8e2d('0x52'))]['ValidationError'](_0x8e2d('0x80'));}_0x3dbb70=_0x43abd3;return getBucketslist(_0x3dbb70[_0x8e2d('0x7f')],_0x3dbb70[_0x8e2d('0x81')],_0x1159b7['transcribeRegion']);})[_0x8e2d('0x22')](function(_0x1de11c){if(_0x1de11c&&_0x1de11c[_0x8e2d('0x82')]){var _0x2b5129=_[_0x8e2d('0x47')](_0x1de11c['Buckets'],function(_0x175ece){return _0x175ece[_0x8e2d('0x83')]===_0x1159b7['bucket'];});if(!_0x2b5129){logger[_0x8e2d('0x62')](util[_0x8e2d('0x4d')](_0x8e2d('0x84'),_0x2fcb46[_0x8e2d('0x42')]['id'],_0x1159b7[_0x8e2d('0x79')]));return createBucket(_0x3dbb70[_0x8e2d('0x7f')],_0x3dbb70[_0x8e2d('0x81')],_0x1159b7[_0x8e2d('0x85')],_0x1159b7[_0x8e2d('0x79')]);}logger[_0x8e2d('0x62')](util[_0x8e2d('0x4d')](_0x8e2d('0x86'),_0x2fcb46[_0x8e2d('0x42')]['id'],_0x1159b7[_0x8e2d('0x79')]));return;}})[_0x8e2d('0x22')](function(_0x561445){if(_0x527d74[_0x8e2d('0x73')]===_0x8e2d('0x87')){return transcribe(_0x2fcb46[_0x8e2d('0x42')]['id'],_0x3dbb70[_0x8e2d('0x7f')],_0x3dbb70[_0x8e2d('0x81')],_0x1159b7[_0x8e2d('0x85')],_0x1159b7[_0x8e2d('0x79')],_0x527d74[_0x8e2d('0x4c')],_0x1159b7['language']);}else{logger['info'](util[_0x8e2d('0x4d')](_0x8e2d('0x88'),_0x2fcb46[_0x8e2d('0x42')]['id']));return{'transcribeStatus':_0x8e2d('0x89')};}})[_0x8e2d('0x22')](function(_0x58b0ab){if(_0x58b0ab){_0x58b0ab[_0x8e2d('0x8a')]=_0x2fcb46[_0x8e2d('0x45')]['runSentiment'];return _0x527d74[_0x8e2d('0x8b')](_0x58b0ab);}})[_0x8e2d('0x22')](respondWithResult(_0x1a0146,null))[_0x8e2d('0x46')](handleError(_0x1a0146,null));};function writeFile(_0x358629,_0x1451e0){return new Promise(function(_0x4db639,_0x15aa4d){fs[_0x8e2d('0x8c')](_0x1451e0,_0x358629,function(_0x9bbc,_0x1194eb){if(_0x9bbc){return _0x15aa4d(_0x9bbc);}else{return _0x4db639(_0x1194eb);}});});}exports['downloadTranscribe']=function(_0x2c1970,_0x2a63be,_0x1b2fa4){return db['VoiceRecording'][_0x8e2d('0x75')]({'where':{'id':_0x2c1970['params']['id']}})[_0x8e2d('0x22')](handleEntityNotFound(_0x2a63be))[_0x8e2d('0x22')](function(_0x547801){if(_0x547801&&_0x547801[_0x8e2d('0x8d')]){var _0x4283f4=_0x547801['fileText'];var _0x5195e0=config[_0x8e2d('0x8e')]+'/server/files/transcribes/transcribe_'+_0x547801['id']+_0x8e2d('0x8f');if(fs['existsSync'](_0x5195e0)){return _0x5195e0;}return writeFile(_0x4283f4,_0x5195e0)['then'](function(){return _0x5195e0;});}else{throw new db['Sequelize']['ValidationError'](_0x8e2d('0x90'));}})[_0x8e2d('0x22')](function(_0x206ff8){return _0x2a63be[_0x8e2d('0x49')](_0x206ff8);})[_0x8e2d('0x46')](handleError(_0x2a63be));}; \ No newline at end of file +var _0x3508=['VoiceRecording','rawAttributes','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','options','find','create','body','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','secrets','Sequelize','ValidationError','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','extname','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','recording','Setting','transcribe','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map'];(function(_0x66ede1,_0x229cbc){var _0x446691=function(_0x47bff8){while(--_0x47bff8){_0x66ede1['push'](_0x66ede1['shift']());}};_0x446691(++_0x229cbc);}(_0x3508,0x1a5));var _0x8350=function(_0x5d76f4,_0x5017b3){_0x5d76f4=_0x5d76f4-0x0;var _0x43c615=_0x3508[_0x5d76f4];return _0x43c615;};'use strict';var emlformat=require(_0x8350('0x0'));var rimraf=require(_0x8350('0x1'));var zipdir=require(_0x8350('0x2'));var jsonpatch=require(_0x8350('0x3'));var rp=require(_0x8350('0x4'));var moment=require(_0x8350('0x5'));var BPromise=require(_0x8350('0x6'));var Mustache=require(_0x8350('0x7'));var util=require(_0x8350('0x8'));var path=require('path');var sox=require(_0x8350('0x9'));var csv=require(_0x8350('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8350('0xb'));var _=require('lodash');var squel=require(_0x8350('0xc'));var crypto=require(_0x8350('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8350('0xe'));var toCsv=require(_0x8350('0xa'));var querystring=require(_0x8350('0xf'));var Papa=require(_0x8350('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x8350('0x11'));var Redis=require(_0x8350('0x12'));var authService=require(_0x8350('0x13'));var qs=require(_0x8350('0x14'));var as=require(_0x8350('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8350('0x16'))('api');var utils=require(_0x8350('0x17'));var config=require(_0x8350('0x18'));var licenseUtil=require(_0x8350('0x19'));var db=require(_0x8350('0x1a'))['db'];function respondWithStatusCode(_0x52ef76,_0x14c8d0){_0x14c8d0=_0x14c8d0||0xcc;return function(_0x84c6fb){if(_0x84c6fb){return _0x52ef76[_0x8350('0x1b')](_0x14c8d0);}return _0x52ef76[_0x8350('0x1c')](_0x14c8d0)[_0x8350('0x1d')]();};}function respondWithResult(_0xc0e821,_0x582dbf){_0x582dbf=_0x582dbf||0xc8;return function(_0x1bad5b){if(_0x1bad5b){return _0xc0e821[_0x8350('0x1c')](_0x582dbf)[_0x8350('0x1e')](_0x1bad5b);}};}function respondWithFilteredResult(_0x5b25bf,_0x240ae5){return function(_0x20d705){if(_0x20d705){var _0x289b41=typeof _0x240ae5['offset']==='undefined'&&typeof _0x240ae5[_0x8350('0x1f')]===_0x8350('0x20');var _0x4c7d0e=_0x20d705['count'];var _0x147bf3=_0x289b41?0x0:_0x240ae5['offset'];var _0x2509f5=_0x289b41?_0x20d705[_0x8350('0x21')]:_0x240ae5[_0x8350('0x22')]+_0x240ae5[_0x8350('0x1f')];var _0xa25a08;if(_0x2509f5>=_0x4c7d0e){_0x2509f5=_0x4c7d0e;_0xa25a08=0xc8;}else{_0xa25a08=0xce;}_0x5b25bf[_0x8350('0x1c')](_0xa25a08);return _0x5b25bf[_0x8350('0x23')](_0x8350('0x24'),_0x147bf3+'-'+_0x2509f5+'/'+_0x4c7d0e)['json'](_0x20d705);}return null;};}function patchUpdates(_0x261924){return function(_0x4d5972){try{jsonpatch[_0x8350('0x25')](_0x4d5972,_0x261924,!![]);}catch(_0x432c47){return BPromise[_0x8350('0x26')](_0x432c47);}return _0x4d5972[_0x8350('0x27')]();};}function saveUpdates(_0x531710,_0x180464){return function(_0x274770){if(_0x274770){return _0x274770['update'](_0x531710)[_0x8350('0x28')](function(_0x49d9ac){return _0x49d9ac;});}return null;};}function removeEntity(_0x2ab375,_0x409550){return function(_0x10deb0){if(_0x10deb0){return _0x10deb0[_0x8350('0x29')]()[_0x8350('0x28')](function(){_0x2ab375[_0x8350('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeea37,_0x664abe){return function(_0x17aac0){if(!_0x17aac0){_0xeea37[_0x8350('0x1b')](0x194);}return _0x17aac0;};}function handleError(_0x3917e3,_0x5deda4){_0x5deda4=_0x5deda4||0x1f4;return function(_0x561f59){logger[_0x8350('0x2a')](_0x561f59['stack']);if(_0x561f59[_0x8350('0x2b')]){delete _0x561f59['name'];}_0x3917e3[_0x8350('0x1c')](_0x5deda4)[_0x8350('0x2c')](_0x561f59);};}exports[_0x8350('0x2d')]=function(_0x13b5d1,_0x2e441a){var _0x4aed0a={},_0x3cfed1={},_0x10576d={'count':0x0,'rows':[]};var _0x334ef9=_[_0x8350('0x2e')](db[_0x8350('0x2f')][_0x8350('0x30')],function(_0x34819a){return{'name':_0x34819a['fieldName'],'type':_0x34819a['type'][_0x8350('0x31')]};});_0x3cfed1[_0x8350('0x32')]=_[_0x8350('0x33')](_[_0x8350('0x2e')](_0x334ef9,_0x8350('0x2b')),[_0x8350('0x34')]);_0x3cfed1[_0x8350('0x35')]=_[_0x8350('0x36')](_0x13b5d1[_0x8350('0x35')]);_0x3cfed1['filters']=_[_0x8350('0x37')](_0x3cfed1[_0x8350('0x32')],_0x3cfed1[_0x8350('0x35')]);_0x4aed0a[_0x8350('0x38')]=_['intersection'](_0x3cfed1['model'],qs[_0x8350('0x39')](_0x13b5d1['query'][_0x8350('0x39')]));_0x4aed0a[_0x8350('0x38')]=_0x4aed0a['attributes'][_0x8350('0x3a')]?_0x4aed0a[_0x8350('0x38')]:_0x3cfed1[_0x8350('0x32')];if(!_0x13b5d1[_0x8350('0x35')][_0x8350('0x3b')](_0x8350('0x3c'))){_0x4aed0a['limit']=qs[_0x8350('0x1f')](_0x13b5d1[_0x8350('0x35')]['limit']);_0x4aed0a['offset']=qs[_0x8350('0x22')](_0x13b5d1[_0x8350('0x35')]['offset']);}_0x4aed0a[_0x8350('0x3d')]=qs[_0x8350('0x3e')](_0x13b5d1[_0x8350('0x35')][_0x8350('0x3e')]);_0x4aed0a['where']=qs[_0x8350('0x3f')](_[_0x8350('0x40')](_0x13b5d1[_0x8350('0x35')],_0x3cfed1[_0x8350('0x3f')]),_0x334ef9);if(_0x13b5d1['query'][_0x8350('0x41')]){_0x4aed0a[_0x8350('0x42')]=_['merge'](_0x4aed0a['where'],{'$or':_['map'](_0x334ef9,function(_0x20990b){if(_0x20990b['type']!==_0x8350('0x43')){var _0x42b329={};_0x42b329[_0x20990b['name']]={'$like':'%'+_0x13b5d1[_0x8350('0x35')][_0x8350('0x41')]+'%'};return _0x42b329;}})});}_0x4aed0a=_[_0x8350('0x44')]({},_0x4aed0a,_0x13b5d1['options']);var _0x3fe935={'where':_0x4aed0a['where']};return db[_0x8350('0x2f')]['count'](_0x3fe935)[_0x8350('0x28')](function(_0x12c56b){_0x10576d[_0x8350('0x21')]=_0x12c56b;if(_0x13b5d1['query'][_0x8350('0x45')]){_0x4aed0a['include']=[{'all':!![]}];}return db[_0x8350('0x2f')][_0x8350('0x46')](_0x4aed0a);})[_0x8350('0x28')](function(_0x4fe600){_0x10576d[_0x8350('0x47')]=_0x4fe600;return _0x10576d;})[_0x8350('0x28')](respondWithFilteredResult(_0x2e441a,_0x4aed0a))[_0x8350('0x48')](handleError(_0x2e441a,null));};exports[_0x8350('0x49')]=function(_0x41c862,_0x5da792){var _0xb0fc4c={'raw':![],'where':{'id':_0x41c862[_0x8350('0x4a')]['id']}},_0x38a545={};_0x38a545['model']=_['keys'](db[_0x8350('0x2f')][_0x8350('0x30')]);_0x38a545[_0x8350('0x35')]=_[_0x8350('0x36')](_0x41c862['query']);_0x38a545[_0x8350('0x3f')]=_['intersection'](_0x38a545[_0x8350('0x32')],_0x38a545['query']);_0xb0fc4c[_0x8350('0x38')]=_['intersection'](_0x38a545[_0x8350('0x32')],qs[_0x8350('0x39')](_0x41c862[_0x8350('0x35')]['fields']));_0xb0fc4c[_0x8350('0x38')]=_0xb0fc4c['attributes'][_0x8350('0x3a')]?_0xb0fc4c[_0x8350('0x38')]:_0x38a545[_0x8350('0x32')];if(_0x41c862[_0x8350('0x35')][_0x8350('0x45')]){_0xb0fc4c['include']=[{'all':!![]}];}_0xb0fc4c=_[_0x8350('0x44')]({},_0xb0fc4c,_0x41c862[_0x8350('0x4b')]);return db['VoiceRecording'][_0x8350('0x4c')](_0xb0fc4c)[_0x8350('0x28')](handleEntityNotFound(_0x5da792,null))['then'](respondWithResult(_0x5da792,null))[_0x8350('0x48')](handleError(_0x5da792,null));};exports['create']=function(_0xc2f44f,_0x55bb87){return db[_0x8350('0x2f')][_0x8350('0x4d')](_0xc2f44f[_0x8350('0x4e')],{})['then'](respondWithResult(_0x55bb87,0xc9))[_0x8350('0x48')](handleError(_0x55bb87,null));};exports['update']=function(_0x195c78,_0xb2b22e){if(_0x195c78[_0x8350('0x4e')]['id']){delete _0x195c78[_0x8350('0x4e')]['id'];}return db[_0x8350('0x2f')][_0x8350('0x4c')]({'where':{'id':_0x195c78[_0x8350('0x4a')]['id']}})[_0x8350('0x28')](handleEntityNotFound(_0xb2b22e,null))[_0x8350('0x28')](saveUpdates(_0x195c78['body'],null))['then'](respondWithResult(_0xb2b22e,null))['catch'](handleError(_0xb2b22e,null));};exports[_0x8350('0x4f')]=function(_0x2c9b67,_0x37879f){return db[_0x8350('0x2f')][_0x8350('0x4f')]()[_0x8350('0x28')](respondWithResult(_0x37879f,null))['catch'](handleError(_0x37879f,null));};exports[_0x8350('0x50')]=function(_0x5ca912,_0x3581e5,_0x3bc7ad){var _0xb0e9dc=require(_0x8350('0x51'));var _0x26c0e4=![];var _0x206838={};if(_0x5ca912[_0x8350('0x35')]['type']&&_0x5ca912['query'][_0x8350('0x52')]===_0x8350('0x53')){_0x206838[_0x8350('0x53')]=_0x5ca912['params']['id'];}else{_0x206838['id']=_0x5ca912['params']['id'];}return db[_0x8350('0x2f')][_0x8350('0x4c')]({'where':_0x206838,'attributes':['id',_0x8350('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x3581e5,null))[_0x8350('0x28')](function(_0x20afe0){if(_0x20afe0){var _0x591fc0=_0x20afe0[_0x8350('0x54')];var _0x3f2992=util[_0x8350('0x34')](_0x8350('0x55'),_0x591fc0);if(fs[_0x8350('0x56')](_0x3f2992)){_0x26c0e4=!![];return _0xb0e9dc['decryptFile'](_0x3f2992,_0x591fc0,config[_0x8350('0x57')]['recording'])[_0x8350('0x28')](function(){return _0x20afe0;});}return _0x20afe0;}})['then'](function(_0x2cec1d){if(_0x2cec1d){var _0x3f123a=_0x2cec1d[_0x8350('0x54')];if(!fs[_0x8350('0x56')](_0x3f123a)){throw new db[(_0x8350('0x58'))][(_0x8350('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x2cec1d['filename']){return _0x3581e5[_0x8350('0x50')](_0x3f123a,_0x2cec1d[_0x8350('0x5a')]+path['extname'](_0x3f123a),function(){if(_0x26c0e4){fs[_0x8350('0x5b')](_0x3f123a);}});}else{return _0x3581e5[_0x8350('0x50')](_0x3f123a,function(_0xd971ac){if(_0x26c0e4){fs[_0x8350('0x5b')](_0x3f123a);}});}}})['catch'](function(_0x1aaa80){if(_0x1aaa80[_0x8350('0x5c')]==='VoiceRecording\x20not\x20found'){_0x3581e5[_0x8350('0x1c')](0x194)[_0x8350('0x2c')](_0x8350('0x5d'));}else{return handleError(_0x3581e5,null);}});};exports[_0x8350('0x5e')]=function(_0x5ab01d,_0x21cbe4,_0x1ffb47){var _0x1d8a29=require(_0x8350('0x51'));var _0x5d51dd=![];var _0xdb287c={'$and':[db['sequelize'][_0x8350('0x42')](db[_0x8350('0x5f')]['fn'](_0x8350('0x60'),db[_0x8350('0x5f')][_0x8350('0x61')](_0x8350('0x53'))),_0x5ab01d[_0x8350('0x35')][_0x8350('0x62')])]};if(_0x5ab01d[_0x8350('0x35')][_0x8350('0x52')]&&_0x5ab01d[_0x8350('0x35')][_0x8350('0x52')]===_0x8350('0x53')){_0xdb287c[_0x8350('0x63')][_0x8350('0x64')]({'uniqueid':_0x5ab01d[_0x8350('0x4a')]['id']});}else{_0xdb287c[_0x8350('0x63')][_0x8350('0x64')]({'id':_0x5ab01d[_0x8350('0x4a')]['id']});}return db[_0x8350('0x2f')][_0x8350('0x4c')]({'where':_0xdb287c,'attributes':['id',_0x8350('0x54')],'raw':!![]})[_0x8350('0x28')](handleEntityNotFound(_0x21cbe4,null))['then'](function(_0x2d8d27){if(_0x2d8d27){var _0x5d3580=util[_0x8350('0x34')]('%s.cypher',_0x2d8d27['value']);if(fs[_0x8350('0x56')](_0x5d3580)){_0x5d51dd=!![];return _0x1d8a29[_0x8350('0x65')](_0x5d3580,_0x2d8d27[_0x8350('0x54')],config['secrets']['recording'])[_0x8350('0x28')](function(){return _0x2d8d27;});}return _0x2d8d27;}})[_0x8350('0x28')](function(_0x15b67f){if(_0x15b67f){if(!fs[_0x8350('0x56')](_0x15b67f[_0x8350('0x54')])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x15b67f[_0x8350('0x5a')]){return _0x21cbe4['download'](_0x15b67f[_0x8350('0x54')],_0x15b67f[_0x8350('0x5a')]+path[_0x8350('0x66')](_0x15b67f[_0x8350('0x54')]),function(){if(_0x5d51dd){fs[_0x8350('0x5b')](_0x15b67f[_0x8350('0x54')]);}});}else{return _0x21cbe4['download'](_0x15b67f[_0x8350('0x54')],function(_0x5696d8){if(_0x5d51dd){fs['unlink'](_0x15b67f[_0x8350('0x54')]);}});}}})[_0x8350('0x48')](handleError(_0x21cbe4,null));};exports[_0x8350('0x29')]=function(_0x12a465,_0x4aaaaf){return db[_0x8350('0x2f')][_0x8350('0x4c')]({'where':{'id':_0x12a465[_0x8350('0x4a')]['id']}})[_0x8350('0x28')](function(_0x1411b2){if(_[_0x8350('0x67')](_0x1411b2)){throw new ReferenceError(_0x8350('0x68'));}return _0x1411b2;})['then'](function(_0x2d68aa){var _0x1cc462=_0x2d68aa['value'];logger['info'](_0x8350('0x69'),_0x1cc462);if(!_['isNil'](_0x2d68aa[_0x8350('0x54')])&&fs[_0x8350('0x56')](_0x1cc462)){logger[_0x8350('0x6a')](_0x8350('0x6b')+_0x1cc462+_0x8350('0x6c'));fs[_0x8350('0x6d')](_0x1cc462);}_0x1cc462=_0x1cc462+_0x8350('0x6e');if(!_[_0x8350('0x67')](_0x2d68aa[_0x8350('0x54')])&&fs['existsSync'](_0x1cc462)){logger[_0x8350('0x6a')]('File:\x20\x22'+_0x1cc462+_0x8350('0x6c'));fs[_0x8350('0x6d')](_0x1cc462);}return _0x2d68aa;})[_0x8350('0x28')](function(_0x2d9758){if(!_0x2d9758)throw new InternalError();return _0x2d9758[_0x8350('0x29')]();})[_0x8350('0x28')](function(){_0x4aaaaf[_0x8350('0x1c')](0xcc)[_0x8350('0x1d')]();})[_0x8350('0x48')](handleError(_0x4aaaaf,null));};function getBucketslist(_0x2d2511,_0x425791,_0x5422de){return new Promise(function(_0x51c93e,_0x19c09f){var _0x453582=new AWS['S3']({'accessKeyId':_0x425791,'secretAccessKey':_0x2d2511,'region':_0x5422de});_0x453582[_0x8350('0x6f')]({},function(_0x1f4551,_0x342524){if(_0x1f4551){return _0x19c09f(_0x1f4551);}else{return _0x51c93e(_0x342524);}});});}function createBucket(_0x3e2ff6,_0x36f3dd,_0x18ff10,_0x712ff){return new Promise(function(_0x2f60fd,_0x9909e3){var _0x55eb52=new AWS['S3']({'accessKeyId':_0x36f3dd,'secretAccessKey':_0x3e2ff6,'region':_0x18ff10});_0x55eb52[_0x8350('0x70')]({'Bucket':_0x712ff},function(_0x4048dc,_0x3460d3){if(_0x4048dc){return _0x9909e3(_0x4048dc);}else{return _0x2f60fd(_0x3460d3);}});});}function uploadFile(_0x37acc7,_0x3c41b0,_0x2176c3,_0x27e1a3,_0x281c5e,_0x3bbf74){return new Promise(function(_0x471ee4,_0x5272e7){var _0x218d0a=new AWS['S3']({'accessKeyId':_0x3c41b0,'secretAccessKey':_0x37acc7,'region':_0x2176c3});_0x218d0a['upload']({'Bucket':_0x27e1a3,'Key':_0x281c5e,'Body':_0x3bbf74},function(_0x1fe1b3,_0x329bc6){if(_0x1fe1b3){return _0x5272e7(_0x1fe1b3);}else{return _0x471ee4(_0x329bc6);}});});}function startTranscribe(_0x5683db,_0x38ec3a,_0x5084a1,_0x384236,_0xdcef09,_0x1accf5){return new Promise(function(_0x9d3883,_0xb38328){var _0x2adc8c=new AWS[(_0x8350('0x71'))]({'accessKeyId':_0x38ec3a,'secretAccessKey':_0x5683db,'region':_0x5084a1});_0x2adc8c['startTranscriptionJob']({'TranscriptionJobName':_0x384236,'LanguageCode':_0xdcef09,'Media':{'MediaFileUri':_0x1accf5}},function(_0x338b5c,_0x25936e){if(_0x338b5c){return _0xb38328(_0x338b5c);}else{return _0x9d3883(_0x25936e);}});});}function transcribe(_0x573e4b,_0x1af752,_0x19a110,_0x3c32f1,_0x29c123,_0xb0280b,_0x8095c5){return new Promise(function(_0x1030b0,_0x4cf5a4){var _0xcf8eb3={};logger['info'](util[_0x8350('0x34')](_0x8350('0x72'),_0x573e4b,_0x29c123));return uploadFile(_0x1af752,_0x19a110,_0x3c32f1,_0x29c123,path[_0x8350('0x73')](_0xb0280b),fs[_0x8350('0x74')](_0xb0280b))[_0x8350('0x28')](function(_0xec06e0){logger['info'](util[_0x8350('0x34')](_0x8350('0x75'),_0x573e4b,_0x29c123,_0xec06e0[_0x8350('0x76')]));_0xcf8eb3[_0x8350('0x77')]=_0xec06e0[_0x8350('0x78')];_0xcf8eb3['location']=_0xec06e0['Location'];logger[_0x8350('0x6a')](util[_0x8350('0x34')](_0x8350('0x79'),_0x573e4b));return startTranscribe(_0x1af752,_0x19a110,_0x3c32f1,uuidv4(),_0x8095c5,_0xec06e0[_0x8350('0x76')]);})[_0x8350('0x28')](function(_0x513c39){logger['info'](util[_0x8350('0x34')](_0x8350('0x7a'),_0x573e4b,_0x513c39[_0x8350('0x7b')]['TranscriptionJobName']));_0xcf8eb3[_0x8350('0x7c')]=_0x513c39[_0x8350('0x7b')][_0x8350('0x7d')];_0xcf8eb3['transcribeStatus']=_0x513c39['TranscriptionJob'][_0x8350('0x7e')];return _0x1030b0(_0xcf8eb3);})['catch'](function(_0x2df712){return _0x4cf5a4(_0x2df712);});});}exports[_0x8350('0x7f')]=function(_0x2b9161,_0x5bf7eb,_0x1be195){var _0x523e8c;var _0x55f413;var _0x427b34;var _0x132ee6=require(_0x8350('0x51'));return db['VoiceRecording'][_0x8350('0x80')]({'where':{'id':_0x2b9161[_0x8350('0x4a')]['id']}})[_0x8350('0x28')](function(_0x1c4fce){if(_0x1c4fce){var _0x34cce3=util['format']('%s.cypher',_0x1c4fce[_0x8350('0x54')]);if(fs[_0x8350('0x56')](_0x34cce3)){cypher=!![];return _0x132ee6[_0x8350('0x65')](_0x34cce3,_0x1c4fce[_0x8350('0x54')],config[_0x8350('0x57')][_0x8350('0x81')])[_0x8350('0x28')](function(){return _0x1c4fce;});}return _0x1c4fce;}})[_0x8350('0x28')](function(_0x29ce07){if(!_0x29ce07){throw new db[(_0x8350('0x58'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x55f413=_0x29ce07;return db[_0x8350('0x82')][_0x8350('0x80')]({'where':{'id':0x1}});})[_0x8350('0x28')](handleEntityNotFound(_0x5bf7eb,null))['then'](function(_0x836a6e){if(_0x836a6e){_0x523e8c=_0x836a6e;if(!_0x523e8c[_0x8350('0x83')]||!_0x523e8c['transcribeAccountId']||!_0x523e8c[_0x8350('0x84')]||!_0x523e8c['language']||!_0x523e8c[_0x8350('0x77')]){throw new db[(_0x8350('0x58'))][(_0x8350('0x59'))](_0x8350('0x85'));}if(_0x2b9161[_0x8350('0x4e')][_0x8350('0x86')]&&(!_0x523e8c[_0x8350('0x87')]||!_0x523e8c['sentimentAccountId']||!_0x523e8c[_0x8350('0x88')]||!_0x523e8c['language']||!_0x523e8c['bucket'])){throw new db[(_0x8350('0x58'))][(_0x8350('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x8350('0x89')]['findOne']({'where':{'id':_0x523e8c['transcribeAccountId']}});}})[_0x8350('0x28')](function(_0x830b5c){if(!_0x830b5c){throw new db[(_0x8350('0x58'))][(_0x8350('0x59'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x830b5c[_0x8350('0x8a')]||!_0x830b5c[_0x8350('0x8b')]){throw new db[(_0x8350('0x58'))][(_0x8350('0x59'))](_0x8350('0x8c'));}_0x427b34=_0x830b5c;return getBucketslist(_0x427b34[_0x8350('0x8a')],_0x427b34[_0x8350('0x8b')],_0x523e8c[_0x8350('0x84')]);})[_0x8350('0x28')](function(_0x4d584b){if(_0x4d584b&&_0x4d584b[_0x8350('0x8d')]){var _0x1152bd=_[_0x8350('0x4c')](_0x4d584b[_0x8350('0x8d')],function(_0x157378){return _0x157378[_0x8350('0x8e')]===_0x523e8c['bucket'];});if(!_0x1152bd){logger[_0x8350('0x6a')](util['format'](_0x8350('0x8f'),_0x2b9161[_0x8350('0x4a')]['id'],_0x523e8c[_0x8350('0x77')]));return createBucket(_0x427b34['data1'],_0x427b34[_0x8350('0x8b')],_0x523e8c[_0x8350('0x84')],_0x523e8c[_0x8350('0x77')]);}logger['info'](util[_0x8350('0x34')](_0x8350('0x90'),_0x2b9161[_0x8350('0x4a')]['id'],_0x523e8c[_0x8350('0x77')]));return;}})[_0x8350('0x28')](function(_0x2da654){if(_0x55f413['transcribeStatus']===_0x8350('0x91')){return transcribe(_0x2b9161['params']['id'],_0x427b34[_0x8350('0x8a')],_0x427b34[_0x8350('0x8b')],_0x523e8c[_0x8350('0x84')],_0x523e8c[_0x8350('0x77')],_0x55f413[_0x8350('0x54')],_0x523e8c[_0x8350('0x92')]);}else{logger[_0x8350('0x6a')](util[_0x8350('0x34')](_0x8350('0x93'),_0x2b9161[_0x8350('0x4a')]['id']));return{'transcribeStatus':_0x8350('0x94')};}})[_0x8350('0x28')](function(_0x41f648){if(_0x41f648){_0x41f648[_0x8350('0x95')]=_0x2b9161['body'][_0x8350('0x86')];return _0x55f413[_0x8350('0x96')](_0x41f648);}})[_0x8350('0x28')](respondWithResult(_0x5bf7eb,null))[_0x8350('0x48')](handleError(_0x5bf7eb,null));};function writeFile(_0x27a2b7,_0x39524f){return new Promise(function(_0x4bd585,_0x462157){fs[_0x8350('0x97')](_0x39524f,_0x27a2b7,function(_0x1ba5e5,_0x18b34b){if(_0x1ba5e5){return _0x462157(_0x1ba5e5);}else{return _0x4bd585(_0x18b34b);}});});}exports[_0x8350('0x98')]=function(_0x45a394,_0x57d0f6,_0x59bdd4){return db['VoiceRecording'][_0x8350('0x80')]({'where':{'id':_0x45a394[_0x8350('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57d0f6))[_0x8350('0x28')](function(_0x41eeac){if(_0x41eeac&&_0x41eeac[_0x8350('0x99')]){var _0x1cb99e=_0x41eeac[_0x8350('0x99')];var _0x611fb6=config['root']+_0x8350('0x9a')+_0x41eeac['id']+_0x8350('0x9b');if(fs[_0x8350('0x56')](_0x611fb6)){return _0x611fb6;}return writeFile(_0x1cb99e,_0x611fb6)[_0x8350('0x28')](function(){return _0x611fb6;});}else{throw new db[(_0x8350('0x58'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x8350('0x28')](function(_0x245c06){return _0x57d0f6[_0x8350('0x50')](_0x245c06);})[_0x8350('0x48')](handleError(_0x57d0f6));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 3d56d64..db327f9 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 _0xb7c8=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','exports'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xb7c8,0x119));var _0x8b7c=function(_0xf87bbf,_0x3180af){_0xf87bbf=_0xf87bbf-0x0;var _0x322140=_0xb7c8[_0xf87bbf];return _0x322140;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x8b7c('0x0')]=function(_0x150db2,_0x15b7a3){return _0x150db2[_0x8b7c('0x1')](_0x8b7c('0x2'),attributes,{'tableName':_0x8b7c('0x3'),'paranoid':![],'indexes':[{'name':_0x8b7c('0x4'),'fields':['uniqueid']},{'name':_0x8b7c('0x5'),'fields':[_0x8b7c('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f90=['exports','define','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x219659,_0x2f3adf){var _0x42f32c=function(_0x3659e8){while(--_0x3659e8){_0x219659['push'](_0x219659['shift']());}};_0x42f32c(++_0x2f3adf);}(_0x7f90,0xf4));var _0x07f9=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0x7f90[_0xc0d9bc];return _0x32ff73;};'use strict';var attributes=require(_0x07f9('0x0'));module[_0x07f9('0x1')]=function(_0x43c91f,_0x1521eb){return _0x43c91f[_0x07f9('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x07f9('0x3'),'fields':[_0x07f9('0x3')]},{'name':'transcribeStatus','fields':[_0x07f9('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index afb5a6d..4ceb90b 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 _0x32f4=['unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','../../components/encryptor','findOne','callRecordingEncryption','existsSync','format','encryptFile','value','secrets','recording'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x32f4,0x154));var _0x432f=function(_0x2deff0,_0x162995){_0x2deff0=_0x2deff0-0x0;var _0x55fcac=_0x32f4[_0x2deff0];return _0x55fcac;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});}exports[_0x432f('0x16')]=function(_0x243cf){var _0x3cd5da=this;return new Promise(function(_0x129582,_0x5ae24e){return db[_0x432f('0x17')]['update'](_0x243cf[_0x432f('0x18')],{'raw':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')][_0x432f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')][_0x432f('0x1b')]||null:null,'attributes':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')][_0x432f('0x1c')]||null:null,'limit':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')]['limit']||null:null})['then'](function(_0x343d13){logger['info'](_0x432f('0x16'),_0x243cf);logger['debug'](_0x432f('0x16'),_0x243cf,JSON[_0x432f('0x10')](_0x343d13));_0x129582(_0x343d13);})[_0x432f('0x15')](function(_0x89ea50){logger[_0x432f('0x11')](_0x432f('0x16'),_0x89ea50['message'],_0x243cf);_0x5ae24e(_0x3cd5da[_0x432f('0x11')](0x1f4,_0x89ea50[_0x432f('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x2cbde9){var _0x3e37ec=this;return new Promise(function(_0x2bcbb4,_0x23347e){var _0x44839=require(_0x432f('0x1d'));var _0x138a6a;return db['Setting'][_0x432f('0x1e')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x432f('0xb')](function(_0x573cc5){_0x138a6a=_0x573cc5;return db[_0x432f('0x17')]['create'](_0x2cbde9[_0x432f('0x18')]);})['then'](function(_0x325a9c){if(_0x138a6a[_0x432f('0x1f')]&&fs[_0x432f('0x20')](_0x325a9c['value'])){var _0x6a116e=util[_0x432f('0x21')]('%s.cypher',_0x325a9c['value']);return _0x44839[_0x432f('0x22')](_0x325a9c[_0x432f('0x23')],_0x6a116e,config[_0x432f('0x24')][_0x432f('0x25')])[_0x432f('0xb')](function(){fs[_0x432f('0x26')](_0x325a9c['value']);logger['info'](_0x432f('0x27'));return _0x325a9c;});}return _0x325a9c;})[_0x432f('0xb')](function(_0x184203){logger['info'](_0x432f('0x28'),_0x2cbde9);logger[_0x432f('0x29')](_0x432f('0x28'),_0x2cbde9,JSON[_0x432f('0x10')](_0x184203));_0x2bcbb4(_0x184203);})[_0x432f('0x15')](function(_0x3ad632){logger[_0x432f('0x11')](_0x432f('0x28'),_0x3ad632['message'],_0x2cbde9);_0x23347e(_0x3e37ec['error'](0x1f4,_0x3ad632[_0x432f('0x13')]));});});}; \ No newline at end of file +var _0x430c=['../../components/encryptor','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','recording','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','body','options','raw','where','limit','UpdateVoiceRecording','catch','CreateVoiceRecording'];(function(_0x21dac0,_0x3760c1){var _0x1879a5=function(_0x5fe775){while(--_0x5fe775){_0x21dac0['push'](_0x21dac0['shift']());}};_0x1879a5(++_0x3760c1);}(_0x430c,0x1a1));var _0xc430=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x430c[_0x3d2e4b];return _0x509e78;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4de44f,_0x212354,_0x2e51c6){return new BPromise(function(_0x814a90,_0x13ae66){return client[_0xc430('0x7')](_0x4de44f,_0x2e51c6)[_0xc430('0x8')](function(_0x861581){logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');logger[_0xc430('0xb')](_0xc430('0xc'),_0x212354,'request\x20sent',JSON[_0xc430('0xd')](_0x861581));if(_0x861581['error']){if(_0x861581[_0xc430('0xe')]['code']===0x1f4){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x861581[_0xc430('0xe')][_0xc430('0xf')]);return _0x13ae66(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}logger[_0xc430('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x212354,_0x861581['error'][_0xc430('0xf')]);return _0x814a90(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}else{logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');_0x814a90(_0x861581[_0xc430('0x10')]['message']);}})['catch'](function(_0x2e7987){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x2e7987);_0x13ae66(_0x2e7987);});});}exports['UpdateVoiceRecording']=function(_0x5d3acc){var _0x36d112=this;return new Promise(function(_0x4c1937,_0x2bcb21){return db['VoiceRecording']['update'](_0x5d3acc[_0xc430('0x11')],{'raw':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')][_0xc430('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d3acc[_0xc430('0x12')]?_0x5d3acc[_0xc430('0x12')][_0xc430('0x14')]||null:null,'attributes':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')]['attributes']||null:null,'limit':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')][_0xc430('0x15')]||null:null})[_0xc430('0x8')](function(_0x56dd16){logger[_0xc430('0x9')]('UpdateVoiceRecording',_0x5d3acc);logger[_0xc430('0xb')](_0xc430('0x16'),_0x5d3acc,JSON['stringify'](_0x56dd16));_0x4c1937(_0x56dd16);})[_0xc430('0x17')](function(_0x3cdbd3){logger['error'](_0xc430('0x16'),_0x3cdbd3['message'],_0x5d3acc);_0x2bcb21(_0x36d112[_0xc430('0xe')](0x1f4,_0x3cdbd3['message']));});});};exports[_0xc430('0x18')]=function(_0x21e28a){var _0x50110b=this;return new Promise(function(_0x33433f,_0x2ec021){var _0x2c0422=require(_0xc430('0x19'));var _0x285407;return db['Setting'][_0xc430('0x1a')]({'attributes':['id',_0xc430('0x1b')],'where':{'id':0x1},'raw':!![]})[_0xc430('0x8')](function(_0x1591e3){_0x285407=_0x1591e3;return db['VoiceRecording'][_0xc430('0x1c')](_0x21e28a['body']);})[_0xc430('0x8')](function(_0x4ad29e){if(_0x285407[_0xc430('0x1b')]&&fs[_0xc430('0x1d')](_0x4ad29e[_0xc430('0x1e')])){var _0x3d7ccf=util['format'](_0xc430('0x1f'),_0x4ad29e[_0xc430('0x1e')]);return _0x2c0422[_0xc430('0x20')](_0x4ad29e[_0xc430('0x1e')],_0x3d7ccf,config['secrets'][_0xc430('0x21')])[_0xc430('0x8')](function(){fs['unlink'](_0x4ad29e[_0xc430('0x1e')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x4ad29e;});}return _0x4ad29e;})[_0xc430('0x8')](function(_0x973a39){logger[_0xc430('0x9')](_0xc430('0x18'),_0x21e28a);logger[_0xc430('0xb')](_0xc430('0x18'),_0x21e28a,JSON[_0xc430('0xd')](_0x973a39));_0x33433f(_0x973a39);})[_0xc430('0x17')](function(_0x47da0d){logger[_0xc430('0xe')]('CreateVoiceRecording',_0x47da0d[_0xc430('0xf')],_0x21e28a);_0x2ec021(_0x50110b[_0xc430('0xe')](0x1f4,_0x47da0d[_0xc430('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index dbcb4ce..4ddfe3e 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 _0x4982=['Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x37c076,_0x20d356){var _0x252ac2=function(_0x4246bb){while(--_0x4246bb){_0x37c076['push'](_0x37c076['shift']());}};_0x252ac2(++_0x20d356);}(_0x4982,0x188));var _0x2498=function(_0x5d90b8,_0x528b3a){_0x5d90b8=_0x5d90b8-0x0;var _0x5712b3=_0x4982[_0x5d90b8];return _0x5712b3;};'use strict';var multer=require(_0x2498('0x0'));var util=require(_0x2498('0x1'));var path=require(_0x2498('0x2'));var timeout=require('connect-timeout');var express=require(_0x2498('0x3'));var router=express[_0x2498('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2498('0x5'));var interaction=require(_0x2498('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x2498('0x7')](),controller[_0x2498('0x8')]);router[_0x2498('0x9')](_0x2498('0xa'),auth[_0x2498('0x7')](),controller['describe']);router['get'](_0x2498('0xb'),auth[_0x2498('0x7')](),controller['show']);router[_0x2498('0xc')]('/',auth[_0x2498('0x7')](),controller['create']);router[_0x2498('0xd')](_0x2498('0xb'),auth['isAuthenticated'](),controller[_0x2498('0xe')]);router[_0x2498('0xf')](_0x2498('0xb'),auth[_0x2498('0x7')](),controller[_0x2498('0x10')]);module[_0x2498('0x11')]=router; \ No newline at end of file +var _0x9095=['update','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','post','create','put'];(function(_0x3e9979,_0x3c7113){var _0x536f58=function(_0x543057){while(--_0x543057){_0x3e9979['push'](_0x3e9979['shift']());}};_0x536f58(++_0x3c7113);}(_0x9095,0xbe));var _0x5909=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x9095[_0x1e172a];return _0x96338b;};'use strict';var multer=require('multer');var util=require(_0x5909('0x0'));var path=require(_0x5909('0x1'));var timeout=require('connect-timeout');var express=require(_0x5909('0x2'));var router=express['Router']();var fs_extra=require(_0x5909('0x3'));var auth=require(_0x5909('0x4'));var interaction=require(_0x5909('0x5'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x5909('0x6')]('/',auth[_0x5909('0x7')](),controller[_0x5909('0x8')]);router[_0x5909('0x6')](_0x5909('0x9'),auth[_0x5909('0x7')](),controller[_0x5909('0xa')]);router[_0x5909('0x6')]('/:id',auth[_0x5909('0x7')](),controller['show']);router[_0x5909('0xb')]('/',auth[_0x5909('0x7')](),controller[_0x5909('0xc')]);router[_0x5909('0xd')]('/:id',auth[_0x5909('0x7')](),controller[_0x5909('0xe')]);router[_0x5909('0xf')]('/:id',auth[_0x5909('0x7')](),controller['destroy']);module[_0x5909('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 4202e3d..4ef00e3 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 _0xb88f=['exports','blind','attended','STRING','ENUM','sequelize','moment'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xb88f,0x18d));var _0xfb88=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0xb88f[_0xbc346f];return _0x9f9260;};'use strict';var Sequelize=require(_0xfb88('0x0'));var moment=require(_0xfb88('0x1'));module[_0xfb88('0x2')]={'type':{'type':Sequelize['ENUM'](_0xfb88('0x3'),_0xfb88('0x4'))},'result':{'type':Sequelize[_0xfb88('0x5')]},'transfererchannel':{'type':Sequelize[_0xfb88('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xfb88('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xfb88('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xfb88('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xfb88('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xfb88('0x5')]},'transfereechannel':{'type':Sequelize[_0xfb88('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xfb88('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xfb88('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xfb88('0x5')]},'transfereecontext':{'type':Sequelize[_0xfb88('0x5')]},'transfereeexten':{'type':Sequelize[_0xfb88('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xfb88('0x5')]},'isexternal':{'type':Sequelize[_0xfb88('0x6')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc60b=['attended','STRING','Yes','sequelize','exports','ENUM'];(function(_0x25310e,_0x519244){var _0x55e6c2=function(_0xa529b0){while(--_0xa529b0){_0x25310e['push'](_0x25310e['shift']());}};_0x55e6c2(++_0x519244);}(_0xc60b,0x10b));var _0xbc60=function(_0x2f83ae,_0x575ee0){_0x2f83ae=_0x2f83ae-0x0;var _0x43b987=_0xc60b[_0x2f83ae];return _0x43b987;};'use strict';var Sequelize=require(_0xbc60('0x0'));var moment=require('moment');module[_0xbc60('0x1')]={'type':{'type':Sequelize[_0xbc60('0x2')]('blind',_0xbc60('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xbc60('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xbc60('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xbc60('0x4')]},'transferercontext':{'type':Sequelize[_0xbc60('0x4')]},'transfererexten':{'type':Sequelize[_0xbc60('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xbc60('0x4')]},'transfereechannel':{'type':Sequelize[_0xbc60('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xbc60('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbc60('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xbc60('0x4')]},'transfereecontext':{'type':Sequelize[_0xbc60('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xbc60('0x4')]},'isexternal':{'type':Sequelize[_0xbc60('0x2')](_0xbc60('0x5'),'No')},'context':{'type':Sequelize[_0xbc60('0x4')]},'extension':{'type':Sequelize[_0xbc60('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0df1e8b..391516e 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 _0x5fbf=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','show','params','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','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'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0x5fbf,0x82));var _0xf5fb=function(_0x46acc1,_0x2cecc7){_0x46acc1=_0x46acc1-0x0;var _0x55b49b=_0x5fbf[_0x46acc1];return _0x55b49b;};'use strict';var emlformat=require(_0xf5fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf5fb('0x1'));var jsonpatch=require(_0xf5fb('0x2'));var rp=require('request-promise');var moment=require(_0xf5fb('0x3'));var BPromise=require(_0xf5fb('0x4'));var Mustache=require('mustache');var util=require(_0xf5fb('0x5'));var path=require(_0xf5fb('0x6'));var sox=require('sox');var csv=require(_0xf5fb('0x7'));var ejs=require(_0xf5fb('0x8'));var fs=require('fs');var fs_extra=require(_0xf5fb('0x9'));var _=require('lodash');var squel=require(_0xf5fb('0xa'));var crypto=require(_0xf5fb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf5fb('0xc'));var toCsv=require(_0xf5fb('0x7'));var querystring=require(_0xf5fb('0xd'));var Papa=require(_0xf5fb('0xe'));var Redis=require(_0xf5fb('0xf'));var authService=require(_0xf5fb('0x10'));var qs=require(_0xf5fb('0x11'));var as=require(_0xf5fb('0x12'));var hardwareService=require(_0xf5fb('0x13'));var logger=require(_0xf5fb('0x14'))(_0xf5fb('0x15'));var utils=require(_0xf5fb('0x16'));var config=require(_0xf5fb('0x17'));var licenseUtil=require(_0xf5fb('0x18'));var db=require(_0xf5fb('0x19'))['db'];function respondWithStatusCode(_0x2dfeaf,_0xa6a732){_0xa6a732=_0xa6a732||0xcc;return function(_0x76341b){if(_0x76341b){return _0x2dfeaf[_0xf5fb('0x1a')](_0xa6a732);}return _0x2dfeaf[_0xf5fb('0x1b')](_0xa6a732)[_0xf5fb('0x1c')]();};}function respondWithResult(_0x214a58,_0xc1653a){_0xc1653a=_0xc1653a||0xc8;return function(_0x5d1bab){if(_0x5d1bab){return _0x214a58['status'](_0xc1653a)[_0xf5fb('0x1d')](_0x5d1bab);}};}function respondWithFilteredResult(_0x98107d,_0x4d567b){return function(_0x424ada){if(_0x424ada){var _0xa40c62=typeof _0x4d567b[_0xf5fb('0x1e')]===_0xf5fb('0x1f')&&typeof _0x4d567b[_0xf5fb('0x20')]===_0xf5fb('0x1f');var _0x4b46b0=_0x424ada['count'];var _0x60c6cd=_0xa40c62?0x0:_0x4d567b['offset'];var _0xdf30ad=_0xa40c62?_0x424ada[_0xf5fb('0x21')]:_0x4d567b['offset']+_0x4d567b['limit'];var _0x322dbd;if(_0xdf30ad>=_0x4b46b0){_0xdf30ad=_0x4b46b0;_0x322dbd=0xc8;}else{_0x322dbd=0xce;}_0x98107d[_0xf5fb('0x1b')](_0x322dbd);return _0x98107d[_0xf5fb('0x22')]('Content-Range',_0x60c6cd+'-'+_0xdf30ad+'/'+_0x4b46b0)[_0xf5fb('0x1d')](_0x424ada);}return null;};}function patchUpdates(_0xc1e30f){return function(_0x5e5b57){try{jsonpatch[_0xf5fb('0x23')](_0x5e5b57,_0xc1e30f,!![]);}catch(_0x40cb8e){return BPromise[_0xf5fb('0x24')](_0x40cb8e);}return _0x5e5b57[_0xf5fb('0x25')]();};}function saveUpdates(_0x18cbc4,_0x7e7c56){return function(_0x4e75d1){if(_0x4e75d1){return _0x4e75d1[_0xf5fb('0x26')](_0x18cbc4)[_0xf5fb('0x27')](function(_0x75accf){return _0x75accf;});}return null;};}function removeEntity(_0x32be50,_0x145db7){return function(_0x47e678){if(_0x47e678){return _0x47e678[_0xf5fb('0x28')]()[_0xf5fb('0x27')](function(){_0x32be50['status'](0xcc)[_0xf5fb('0x1c')]();});}};}function handleEntityNotFound(_0x43900e,_0x190844){return function(_0x11703f){if(!_0x11703f){_0x43900e[_0xf5fb('0x1a')](0x194);}return _0x11703f;};}function handleError(_0x64f711,_0x5edd8f){_0x5edd8f=_0x5edd8f||0x1f4;return function(_0x1d41e2){logger[_0xf5fb('0x29')](_0x1d41e2['stack']);if(_0x1d41e2[_0xf5fb('0x2a')]){delete _0x1d41e2[_0xf5fb('0x2a')];}_0x64f711[_0xf5fb('0x1b')](_0x5edd8f)[_0xf5fb('0x2b')](_0x1d41e2);};}exports[_0xf5fb('0x2c')]=function(_0x158d49,_0x398ff9){var _0x2f3857={},_0x50bd36={},_0x128dad={'count':0x0,'rows':[]};var _0x2544f3=_[_0xf5fb('0x2d')](db['VoiceTransferReport'][_0xf5fb('0x2e')],function(_0x6f167){return{'name':_0x6f167[_0xf5fb('0x2f')],'type':_0x6f167[_0xf5fb('0x30')][_0xf5fb('0x31')]};});_0x50bd36[_0xf5fb('0x32')]=_[_0xf5fb('0x2d')](_0x2544f3,_0xf5fb('0x2a'));_0x50bd36[_0xf5fb('0x33')]=_[_0xf5fb('0x34')](_0x158d49[_0xf5fb('0x33')]);_0x50bd36[_0xf5fb('0x35')]=_[_0xf5fb('0x36')](_0x50bd36[_0xf5fb('0x32')],_0x50bd36[_0xf5fb('0x33')]);_0x2f3857[_0xf5fb('0x37')]=_[_0xf5fb('0x36')](_0x50bd36[_0xf5fb('0x32')],qs[_0xf5fb('0x38')](_0x158d49[_0xf5fb('0x33')]['fields']));_0x2f3857['attributes']=_0x2f3857[_0xf5fb('0x37')][_0xf5fb('0x39')]?_0x2f3857[_0xf5fb('0x37')]:_0x50bd36['model'];if(!_0x158d49[_0xf5fb('0x33')]['hasOwnProperty']('nolimit')){_0x2f3857[_0xf5fb('0x20')]=qs[_0xf5fb('0x20')](_0x158d49[_0xf5fb('0x33')]['limit']);_0x2f3857['offset']=qs['offset'](_0x158d49[_0xf5fb('0x33')][_0xf5fb('0x1e')]);}_0x2f3857['order']=qs[_0xf5fb('0x3a')](_0x158d49[_0xf5fb('0x33')][_0xf5fb('0x3a')]);_0x2f3857[_0xf5fb('0x3b')]=qs[_0xf5fb('0x35')](_[_0xf5fb('0x3c')](_0x158d49[_0xf5fb('0x33')],_0x50bd36[_0xf5fb('0x35')]),_0x2544f3);if(_0x158d49[_0xf5fb('0x33')][_0xf5fb('0x3d')]){_0x2f3857[_0xf5fb('0x3b')]=_[_0xf5fb('0x3e')](_0x2f3857[_0xf5fb('0x3b')],{'$or':_[_0xf5fb('0x2d')](_0x2544f3,function(_0x26e83c){if(_0x26e83c[_0xf5fb('0x30')]!==_0xf5fb('0x3f')){var _0x357733={};_0x357733[_0x26e83c[_0xf5fb('0x2a')]]={'$like':'%'+_0x158d49['query']['filter']+'%'};return _0x357733;}})});}_0x2f3857=_['merge']({},_0x2f3857,_0x158d49[_0xf5fb('0x40')]);var _0x5e5dc6={'where':_0x2f3857[_0xf5fb('0x3b')]};return db[_0xf5fb('0x41')][_0xf5fb('0x21')](_0x5e5dc6)['then'](function(_0x1d7db2){_0x128dad[_0xf5fb('0x21')]=_0x1d7db2;if(_0x158d49[_0xf5fb('0x33')][_0xf5fb('0x42')]){_0x2f3857[_0xf5fb('0x43')]=[{'all':!![]}];}return db[_0xf5fb('0x41')][_0xf5fb('0x44')](_0x2f3857);})[_0xf5fb('0x27')](function(_0x17784e){_0x128dad['rows']=_0x17784e;return _0x128dad;})[_0xf5fb('0x27')](respondWithFilteredResult(_0x398ff9,_0x2f3857))['catch'](handleError(_0x398ff9,null));};exports[_0xf5fb('0x45')]=function(_0x564b99,_0x2a6ba2){var _0x5a8c38={'raw':!![],'where':{'id':_0x564b99[_0xf5fb('0x46')]['id']}},_0x525d3f={};_0x525d3f[_0xf5fb('0x32')]=_[_0xf5fb('0x34')](db[_0xf5fb('0x41')][_0xf5fb('0x2e')]);_0x525d3f[_0xf5fb('0x33')]=_['keys'](_0x564b99[_0xf5fb('0x33')]);_0x525d3f[_0xf5fb('0x35')]=_[_0xf5fb('0x36')](_0x525d3f[_0xf5fb('0x32')],_0x525d3f[_0xf5fb('0x33')]);_0x5a8c38[_0xf5fb('0x37')]=_['intersection'](_0x525d3f[_0xf5fb('0x32')],qs[_0xf5fb('0x38')](_0x564b99['query'][_0xf5fb('0x38')]));_0x5a8c38[_0xf5fb('0x37')]=_0x5a8c38[_0xf5fb('0x37')][_0xf5fb('0x39')]?_0x5a8c38[_0xf5fb('0x37')]:_0x525d3f[_0xf5fb('0x32')];if(_0x564b99[_0xf5fb('0x33')][_0xf5fb('0x42')]){_0x5a8c38[_0xf5fb('0x43')]=[{'all':!![]}];}_0x5a8c38=_[_0xf5fb('0x3e')]({},_0x5a8c38,_0x564b99['options']);return db[_0xf5fb('0x41')][_0xf5fb('0x47')](_0x5a8c38)[_0xf5fb('0x27')](handleEntityNotFound(_0x2a6ba2,null))[_0xf5fb('0x27')](respondWithResult(_0x2a6ba2,null))[_0xf5fb('0x48')](handleError(_0x2a6ba2,null));};exports[_0xf5fb('0x49')]=function(_0x3811c6,_0x4f5ca5){return db[_0xf5fb('0x41')]['create'](_0x3811c6[_0xf5fb('0x4a')],{})[_0xf5fb('0x27')](respondWithResult(_0x4f5ca5,0xc9))['catch'](handleError(_0x4f5ca5,null));};exports[_0xf5fb('0x26')]=function(_0x449e93,_0x333956){if(_0x449e93[_0xf5fb('0x4a')]['id']){delete _0x449e93[_0xf5fb('0x4a')]['id'];}return db['VoiceTransferReport'][_0xf5fb('0x47')]({'where':{'id':_0x449e93[_0xf5fb('0x46')]['id']}})[_0xf5fb('0x27')](handleEntityNotFound(_0x333956,null))[_0xf5fb('0x27')](saveUpdates(_0x449e93[_0xf5fb('0x4a')],null))[_0xf5fb('0x27')](respondWithResult(_0x333956,null))[_0xf5fb('0x48')](handleError(_0x333956,null));};exports[_0xf5fb('0x28')]=function(_0x169166,_0x14a0fc){return db[_0xf5fb('0x41')][_0xf5fb('0x47')]({'where':{'id':_0x169166[_0xf5fb('0x46')]['id']}})[_0xf5fb('0x27')](handleEntityNotFound(_0x14a0fc,null))[_0xf5fb('0x27')](removeEntity(_0x14a0fc,null))[_0xf5fb('0x48')](handleError(_0x14a0fc,null));};exports[_0xf5fb('0x4b')]=function(_0x4cc7f3,_0x2c5bb0){return db[_0xf5fb('0x41')][_0xf5fb('0x4b')]()['then'](respondWithResult(_0x2c5bb0,null))[_0xf5fb('0x48')](handleError(_0x2c5bb0,null));}; \ No newline at end of file +var _0x6a06=['pick','filter','VIRTUAL','merge','options','count','includeAll','include','params','keys','rawAttributes','filters','find','catch','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','index','map','VoiceTransferReport','fieldName','type','model','name','query','attributes','intersection','fields','order','sort','where'];(function(_0x470be7,_0x181dfe){var _0x32063c=function(_0x3cda08){while(--_0x3cda08){_0x470be7['push'](_0x470be7['shift']());}};_0x32063c(++_0x181dfe);}(_0x6a06,0x174));var _0x66a0=function(_0x3f95f2,_0x307ecc){_0x3f95f2=_0x3f95f2-0x0;var _0x5a2a66=_0x6a06[_0x3f95f2];return _0x5a2a66;};'use strict';var emlformat=require(_0x66a0('0x0'));var rimraf=require(_0x66a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x66a0('0x2'));var moment=require(_0x66a0('0x3'));var BPromise=require(_0x66a0('0x4'));var Mustache=require(_0x66a0('0x5'));var util=require('util');var path=require(_0x66a0('0x6'));var sox=require(_0x66a0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66a0('0x8'));var _=require(_0x66a0('0x9'));var squel=require(_0x66a0('0xa'));var crypto=require(_0x66a0('0xb'));var jsforce=require(_0x66a0('0xc'));var deskjs=require(_0x66a0('0xd'));var toCsv=require(_0x66a0('0xe'));var querystring=require(_0x66a0('0xf'));var Papa=require(_0x66a0('0x10'));var Redis=require(_0x66a0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66a0('0x12'));var hardwareService=require(_0x66a0('0x13'));var logger=require(_0x66a0('0x14'))(_0x66a0('0x15'));var utils=require(_0x66a0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x66a0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e72f8,_0x303b5e){_0x303b5e=_0x303b5e||0xcc;return function(_0x118817){if(_0x118817){return _0x3e72f8[_0x66a0('0x18')](_0x303b5e);}return _0x3e72f8['status'](_0x303b5e)[_0x66a0('0x19')]();};}function respondWithResult(_0x592e21,_0x3b0e14){_0x3b0e14=_0x3b0e14||0xc8;return function(_0x390ac0){if(_0x390ac0){return _0x592e21[_0x66a0('0x1a')](_0x3b0e14)[_0x66a0('0x1b')](_0x390ac0);}};}function respondWithFilteredResult(_0x2dacf2,_0x4593ac){return function(_0x2d489d){if(_0x2d489d){var _0x5bfeca=typeof _0x4593ac[_0x66a0('0x1c')]===_0x66a0('0x1d')&&typeof _0x4593ac[_0x66a0('0x1e')]===_0x66a0('0x1d');var _0x2416d6=_0x2d489d['count'];var _0x4f9eaf=_0x5bfeca?0x0:_0x4593ac[_0x66a0('0x1c')];var _0x44749f=_0x5bfeca?_0x2d489d['count']:_0x4593ac[_0x66a0('0x1c')]+_0x4593ac['limit'];var _0x3c2235;if(_0x44749f>=_0x2416d6){_0x44749f=_0x2416d6;_0x3c2235=0xc8;}else{_0x3c2235=0xce;}_0x2dacf2[_0x66a0('0x1a')](_0x3c2235);return _0x2dacf2[_0x66a0('0x1f')](_0x66a0('0x20'),_0x4f9eaf+'-'+_0x44749f+'/'+_0x2416d6)[_0x66a0('0x1b')](_0x2d489d);}return null;};}function patchUpdates(_0x8b5c3e){return function(_0x4bd9d3){try{jsonpatch[_0x66a0('0x21')](_0x4bd9d3,_0x8b5c3e,!![]);}catch(_0x579d8c){return BPromise['reject'](_0x579d8c);}return _0x4bd9d3[_0x66a0('0x22')]();};}function saveUpdates(_0x1b667f,_0x1bc02b){return function(_0x45f2c5){if(_0x45f2c5){return _0x45f2c5[_0x66a0('0x23')](_0x1b667f)[_0x66a0('0x24')](function(_0x63f8dc){return _0x63f8dc;});}return null;};}function removeEntity(_0x129b9f,_0x3bbf83){return function(_0x332593){if(_0x332593){return _0x332593[_0x66a0('0x25')]()[_0x66a0('0x24')](function(){_0x129b9f[_0x66a0('0x1a')](0xcc)[_0x66a0('0x19')]();});}};}function handleEntityNotFound(_0xc6fb0d,_0x399ce0){return function(_0x3e5f0c){if(!_0x3e5f0c){_0xc6fb0d[_0x66a0('0x18')](0x194);}return _0x3e5f0c;};}function handleError(_0x3cab7c,_0x425d0b){_0x425d0b=_0x425d0b||0x1f4;return function(_0x5bc557){logger[_0x66a0('0x26')](_0x5bc557[_0x66a0('0x27')]);if(_0x5bc557['name']){delete _0x5bc557['name'];}_0x3cab7c[_0x66a0('0x1a')](_0x425d0b)['send'](_0x5bc557);};}exports[_0x66a0('0x28')]=function(_0x6a66f6,_0x253258){var _0x25fbeb={},_0x327eeb={},_0x5e8e39={'count':0x0,'rows':[]};var _0x20860e=_[_0x66a0('0x29')](db[_0x66a0('0x2a')]['rawAttributes'],function(_0x49adaf){return{'name':_0x49adaf[_0x66a0('0x2b')],'type':_0x49adaf[_0x66a0('0x2c')]['key']};});_0x327eeb[_0x66a0('0x2d')]=_[_0x66a0('0x29')](_0x20860e,_0x66a0('0x2e'));_0x327eeb['query']=_['keys'](_0x6a66f6[_0x66a0('0x2f')]);_0x327eeb['filters']=_['intersection'](_0x327eeb[_0x66a0('0x2d')],_0x327eeb[_0x66a0('0x2f')]);_0x25fbeb[_0x66a0('0x30')]=_[_0x66a0('0x31')](_0x327eeb[_0x66a0('0x2d')],qs[_0x66a0('0x32')](_0x6a66f6[_0x66a0('0x2f')]['fields']));_0x25fbeb['attributes']=_0x25fbeb[_0x66a0('0x30')]['length']?_0x25fbeb[_0x66a0('0x30')]:_0x327eeb[_0x66a0('0x2d')];if(!_0x6a66f6[_0x66a0('0x2f')]['hasOwnProperty']('nolimit')){_0x25fbeb[_0x66a0('0x1e')]=qs[_0x66a0('0x1e')](_0x6a66f6[_0x66a0('0x2f')]['limit']);_0x25fbeb['offset']=qs[_0x66a0('0x1c')](_0x6a66f6[_0x66a0('0x2f')][_0x66a0('0x1c')]);}_0x25fbeb[_0x66a0('0x33')]=qs[_0x66a0('0x34')](_0x6a66f6[_0x66a0('0x2f')]['sort']);_0x25fbeb[_0x66a0('0x35')]=qs['filters'](_[_0x66a0('0x36')](_0x6a66f6['query'],_0x327eeb['filters']),_0x20860e);if(_0x6a66f6[_0x66a0('0x2f')][_0x66a0('0x37')]){_0x25fbeb[_0x66a0('0x35')]=_['merge'](_0x25fbeb[_0x66a0('0x35')],{'$or':_[_0x66a0('0x29')](_0x20860e,function(_0x30a826){if(_0x30a826[_0x66a0('0x2c')]!==_0x66a0('0x38')){var _0x432fd0={};_0x432fd0[_0x30a826['name']]={'$like':'%'+_0x6a66f6[_0x66a0('0x2f')][_0x66a0('0x37')]+'%'};return _0x432fd0;}})});}_0x25fbeb=_[_0x66a0('0x39')]({},_0x25fbeb,_0x6a66f6[_0x66a0('0x3a')]);var _0x165b22={'where':_0x25fbeb[_0x66a0('0x35')]};return db[_0x66a0('0x2a')][_0x66a0('0x3b')](_0x165b22)[_0x66a0('0x24')](function(_0x346fa9){_0x5e8e39[_0x66a0('0x3b')]=_0x346fa9;if(_0x6a66f6['query'][_0x66a0('0x3c')]){_0x25fbeb[_0x66a0('0x3d')]=[{'all':!![]}];}return db[_0x66a0('0x2a')]['findAll'](_0x25fbeb);})[_0x66a0('0x24')](function(_0x3eaa78){_0x5e8e39['rows']=_0x3eaa78;return _0x5e8e39;})[_0x66a0('0x24')](respondWithFilteredResult(_0x253258,_0x25fbeb))['catch'](handleError(_0x253258,null));};exports['show']=function(_0xca3e34,_0x2ef735){var _0x13f27a={'raw':!![],'where':{'id':_0xca3e34[_0x66a0('0x3e')]['id']}},_0x376f9a={};_0x376f9a['model']=_[_0x66a0('0x3f')](db[_0x66a0('0x2a')][_0x66a0('0x40')]);_0x376f9a[_0x66a0('0x2f')]=_[_0x66a0('0x3f')](_0xca3e34[_0x66a0('0x2f')]);_0x376f9a[_0x66a0('0x41')]=_[_0x66a0('0x31')](_0x376f9a[_0x66a0('0x2d')],_0x376f9a[_0x66a0('0x2f')]);_0x13f27a['attributes']=_[_0x66a0('0x31')](_0x376f9a[_0x66a0('0x2d')],qs['fields'](_0xca3e34[_0x66a0('0x2f')][_0x66a0('0x32')]));_0x13f27a[_0x66a0('0x30')]=_0x13f27a[_0x66a0('0x30')]['length']?_0x13f27a[_0x66a0('0x30')]:_0x376f9a[_0x66a0('0x2d')];if(_0xca3e34[_0x66a0('0x2f')][_0x66a0('0x3c')]){_0x13f27a['include']=[{'all':!![]}];}_0x13f27a=_['merge']({},_0x13f27a,_0xca3e34['options']);return db['VoiceTransferReport'][_0x66a0('0x42')](_0x13f27a)['then'](handleEntityNotFound(_0x2ef735,null))[_0x66a0('0x24')](respondWithResult(_0x2ef735,null))[_0x66a0('0x43')](handleError(_0x2ef735,null));};exports[_0x66a0('0x44')]=function(_0x2a74fe,_0x4794e3){return db[_0x66a0('0x2a')]['create'](_0x2a74fe[_0x66a0('0x45')],{})[_0x66a0('0x24')](respondWithResult(_0x4794e3,0xc9))[_0x66a0('0x43')](handleError(_0x4794e3,null));};exports[_0x66a0('0x23')]=function(_0x1b32b6,_0x282800){if(_0x1b32b6[_0x66a0('0x45')]['id']){delete _0x1b32b6[_0x66a0('0x45')]['id'];}return db[_0x66a0('0x2a')]['find']({'where':{'id':_0x1b32b6[_0x66a0('0x3e')]['id']}})[_0x66a0('0x24')](handleEntityNotFound(_0x282800,null))[_0x66a0('0x24')](saveUpdates(_0x1b32b6[_0x66a0('0x45')],null))[_0x66a0('0x24')](respondWithResult(_0x282800,null))[_0x66a0('0x43')](handleError(_0x282800,null));};exports[_0x66a0('0x25')]=function(_0x543c51,_0x1b0bc5){return db[_0x66a0('0x2a')][_0x66a0('0x42')]({'where':{'id':_0x543c51[_0x66a0('0x3e')]['id']}})[_0x66a0('0x24')](handleEntityNotFound(_0x1b0bc5,null))[_0x66a0('0x24')](removeEntity(_0x1b0bc5,null))[_0x66a0('0x43')](handleError(_0x1b0bc5,null));};exports[_0x66a0('0x46')]=function(_0xd1fc41,_0x16d172){return db[_0x66a0('0x2a')][_0x66a0('0x46')]()[_0x66a0('0x24')](respondWithResult(_0x16d172,null))['catch'](handleError(_0x16d172,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1b34b6b..12afd1c 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 _0xd847=['bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','api','moment'];(function(_0x131ce,_0x540f85){var _0x56a158=function(_0x57d816){while(--_0x57d816){_0x131ce['push'](_0x131ce['shift']());}};_0x56a158(++_0x540f85);}(_0xd847,0x8c));var _0x7d84=function(_0x7418fa,_0x238bc5){_0x7418fa=_0x7418fa-0x0;var _0x47bb0e=_0xd847[_0x7418fa];return _0x47bb0e;};'use strict';var _=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var logger=require('../../config/logger')(_0x7d84('0x2'));var moment=require(_0x7d84('0x3'));var BPromise=require(_0x7d84('0x4'));var rp=require(_0x7d84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d84('0x6'));var config=require('../../config/environment');var attributes=require(_0x7d84('0x7'));module[_0x7d84('0x8')]=function(_0x27bcde,_0x5adfba){return _0x27bcde[_0x7d84('0x9')](_0x7d84('0xa'),attributes,{'tableName':_0x7d84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98fc=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x5c6fa0,_0x28d1b5){var _0x4c0ace=function(_0x20856c){while(--_0x20856c){_0x5c6fa0['push'](_0x5c6fa0['shift']());}};_0x4c0ace(++_0x28d1b5);}(_0x98fc,0x18d));var _0xc98f=function(_0x3c8832,_0x16e93e){_0x3c8832=_0x3c8832-0x0;var _0xacf303=_0x98fc[_0x3c8832];return _0xacf303;};'use strict';var _=require(_0xc98f('0x0'));var util=require('util');var logger=require(_0xc98f('0x1'))(_0xc98f('0x2'));var moment=require(_0xc98f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc98f('0x4'));var fs=require('fs');var path=require(_0xc98f('0x5'));var rimraf=require(_0xc98f('0x6'));var config=require(_0xc98f('0x7'));var attributes=require(_0xc98f('0x8'));module[_0xc98f('0x9')]=function(_0x18015c,_0x2c6cab){return _0x18015c[_0xc98f('0xa')](_0xc98f('0xb'),attributes,{'tableName':_0xc98f('0xc'),'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 a90bed6..089ebda 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 _0x79ed=['request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceTransferReport','create','options','CreateVoiceTransferReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3840b2,_0x36c09b){var _0x43b7fe=function(_0x2acdf8){while(--_0x2acdf8){_0x3840b2['push'](_0x3840b2['shift']());}};_0x43b7fe(++_0x36c09b);}(_0x79ed,0xb7));var _0xd79e=function(_0x31ab4f,_0x1f7ecc){_0x31ab4f=_0x31ab4f-0x0;var _0x37ece2=_0x79ed[_0x31ab4f];return _0x37ece2;};'use strict';var _=require('lodash');var util=require(_0xd79e('0x0'));var moment=require(_0xd79e('0x1'));var BPromise=require(_0xd79e('0x2'));var rs=require(_0xd79e('0x3'));var fs=require('fs');var Redis=require(_0xd79e('0x4'));var db=require(_0xd79e('0x5'))['db'];var utils=require(_0xd79e('0x6'));var logger=require(_0xd79e('0x7'))(_0xd79e('0x8'));var config=require(_0xd79e('0x9'));var jayson=require(_0xd79e('0xa'));var client=jayson[_0xd79e('0xb')][_0xd79e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f8a7a,_0x572a02,_0x40a56d){return new BPromise(function(_0x579d3a,_0x50cd5f){return client[_0xd79e('0xd')](_0x3f8a7a,_0x40a56d)['then'](function(_0x24af1f){logger[_0xd79e('0xe')](_0xd79e('0xf'),_0x572a02,_0xd79e('0x10'));logger[_0xd79e('0x11')](_0xd79e('0x12'),_0x572a02,'request\x20sent',JSON[_0xd79e('0x13')](_0x24af1f));if(_0x24af1f[_0xd79e('0x14')]){if(_0x24af1f[_0xd79e('0x14')]['code']===0x1f4){logger[_0xd79e('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x572a02,_0x24af1f[_0xd79e('0x14')]['message']);return _0x50cd5f(_0x24af1f[_0xd79e('0x14')]['message']);}logger[_0xd79e('0x14')](_0xd79e('0xf'),_0x572a02,_0x24af1f[_0xd79e('0x14')][_0xd79e('0x15')]);return _0x579d3a(_0x24af1f[_0xd79e('0x14')][_0xd79e('0x15')]);}else{logger[_0xd79e('0xe')](_0xd79e('0xf'),_0x572a02,_0xd79e('0x10'));_0x579d3a(_0x24af1f[_0xd79e('0x16')][_0xd79e('0x15')]);}})[_0xd79e('0x17')](function(_0x26868a){logger[_0xd79e('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x572a02,_0x26868a);_0x50cd5f(_0x26868a);});});}exports['CreateVoiceTransferReport']=function(_0x3fc349){var _0x3fe225=this;return new Promise(function(_0x5ad39d,_0x44551b){return db[_0xd79e('0x18')][_0xd79e('0x19')](_0x3fc349['body'],{'raw':_0x3fc349[_0xd79e('0x1a')]?_0x3fc349[_0xd79e('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x494b99){logger[_0xd79e('0xe')]('CreateVoiceTransferReport',_0x3fc349);logger[_0xd79e('0x11')](_0xd79e('0x1b'),_0x3fc349,JSON['stringify'](_0x494b99));_0x5ad39d(_0x494b99);})['catch'](function(_0x3a0674){logger[_0xd79e('0x14')](_0xd79e('0x1b'),_0x3a0674['message'],_0x3fc349);_0x44551b(_0x3fe225[_0xd79e('0x14')](0x1f4,_0x3a0674['message']));});});}; \ No newline at end of file +var _0xa79a=['result','catch','VoiceTransferReport','create','body','options','CreateVoiceTransferReport','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2ccfa3,_0x22bb44){var _0x1fb26b=function(_0x407fcd){while(--_0x407fcd){_0x2ccfa3['push'](_0x2ccfa3['shift']());}};_0x1fb26b(++_0x22bb44);}(_0xa79a,0x19b));var _0xaa79=function(_0x477300,_0x4f3069){_0x477300=_0x477300-0x0;var _0x246be6=_0xa79a[_0x477300];return _0x246be6;};'use strict';var _=require(_0xaa79('0x0'));var util=require(_0xaa79('0x1'));var moment=require(_0xaa79('0x2'));var BPromise=require(_0xaa79('0x3'));var rs=require(_0xaa79('0x4'));var fs=require('fs');var Redis=require(_0xaa79('0x5'));var db=require(_0xaa79('0x6'))['db'];var utils=require(_0xaa79('0x7'));var logger=require(_0xaa79('0x8'))(_0xaa79('0x9'));var config=require(_0xaa79('0xa'));var jayson=require(_0xaa79('0xb'));var client=jayson[_0xaa79('0xc')][_0xaa79('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2c7a53,_0x7a6c38,_0x86b964){return new BPromise(function(_0x3a1246,_0x1ae6c3){return client['request'](_0x2c7a53,_0x86b964)[_0xaa79('0xe')](function(_0x9aade3){logger[_0xaa79('0xf')](_0xaa79('0x10'),_0x7a6c38,_0xaa79('0x11'));logger['debug'](_0xaa79('0x12'),_0x7a6c38,_0xaa79('0x11'),JSON[_0xaa79('0x13')](_0x9aade3));if(_0x9aade3[_0xaa79('0x14')]){if(_0x9aade3['error'][_0xaa79('0x15')]===0x1f4){logger[_0xaa79('0x14')](_0xaa79('0x10'),_0x7a6c38,_0x9aade3[_0xaa79('0x14')][_0xaa79('0x16')]);return _0x1ae6c3(_0x9aade3[_0xaa79('0x14')]['message']);}logger['error'](_0xaa79('0x10'),_0x7a6c38,_0x9aade3[_0xaa79('0x14')][_0xaa79('0x16')]);return _0x3a1246(_0x9aade3['error'][_0xaa79('0x16')]);}else{logger[_0xaa79('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x7a6c38,_0xaa79('0x11'));_0x3a1246(_0x9aade3[_0xaa79('0x17')]['message']);}})[_0xaa79('0x18')](function(_0x686369){logger[_0xaa79('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x7a6c38,_0x686369);_0x1ae6c3(_0x686369);});});}exports['CreateVoiceTransferReport']=function(_0x13e104){var _0xf0ab8a=this;return new Promise(function(_0x46c89a,_0x2e9653){return db[_0xaa79('0x19')][_0xaa79('0x1a')](_0x13e104[_0xaa79('0x1b')],{'raw':_0x13e104[_0xaa79('0x1c')]?_0x13e104[_0xaa79('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xaa79('0xe')](function(_0x1a5c34){logger[_0xaa79('0xf')](_0xaa79('0x1d'),_0x13e104);logger[_0xaa79('0x1e')]('CreateVoiceTransferReport',_0x13e104,JSON[_0xaa79('0x13')](_0x1a5c34));_0x46c89a(_0x1a5c34);})[_0xaa79('0x18')](function(_0x2c6739){logger['error'](_0xaa79('0x1d'),_0x2c6739[_0xaa79('0x16')],_0x13e104);_0x2e9653(_0xf0ab8a[_0xaa79('0x14')](0x1f4,_0x2c6739['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 3a998b3..0529d47 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 _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x5ffa4b,_0x23f3e6){var _0x3af11c=function(_0x43c488){while(--_0x43c488){_0x5ffa4b['push'](_0x5ffa4b['shift']());}};_0x3af11c(++_0x23f3e6);}(_0xb821,0xa7));var _0x1b82=function(_0x4dcd34,_0xabecd0){_0x4dcd34=_0x4dcd34-0x0;var _0x3df6d9=_0xb821[_0x4dcd34];return _0x3df6d9;};'use strict';var express=require('express');var router=express[_0x1b82('0x0')]();var auth=require(_0x1b82('0x1'));var controller=require('./webbar.controller');router['post'](_0x1b82('0x2'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x1b82('0x3')]);router[_0x1b82('0x4')](_0x1b82('0x5'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x4')](_0x1b82('0x8'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x4')](_0x1b82('0xb'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0xc')]);router[_0x1b82('0x4')](_0x1b82('0xd'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0x4')](_0x1b82('0xf'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);router[_0x1b82('0x4')](_0x1b82('0x11'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0x750a=['Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/unhold','unhold','/calls','calls','/transfer','transfer','exports'];(function(_0x8ce506,_0x517f30){var _0x23c8e5=function(_0x1d048e){while(--_0x1d048e){_0x8ce506['push'](_0x8ce506['shift']());}};_0x23c8e5(++_0x517f30);}(_0x750a,0x140));var _0xa750=function(_0x2d8c5e,_0x5f1f60){_0x2d8c5e=_0x2d8c5e-0x0;var _0x2cd3f0=_0x750a[_0x2d8c5e];return _0x2cd3f0;};'use strict';var express=require('express');var router=express[_0xa750('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xa750('0x1')](_0xa750('0x2'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x5')]);router[_0xa750('0x1')](_0xa750('0x6'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x7')]);router[_0xa750('0x1')](_0xa750('0x8'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xa750('0x1')]('/hold',auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller['hold']);router[_0xa750('0x1')](_0xa750('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xa750('0xa')]);router['post'](_0xa750('0xb'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller[_0xa750('0xc')]);router[_0xa750('0x1')](_0xa750('0xd'),auth['isAuthenticated'](),auth[_0xa750('0x4')](),controller[_0xa750('0xe')]);module[_0xa750('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2b69256..6735de6 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 _0x049e=['ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','name','status','send','request','error','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','validate','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','hangup\x20executed!','answer','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger'];(function(_0x59c51c,_0x1472ac){var _0xd79a84=function(_0x4fc6ed){while(--_0x4fc6ed){_0x59c51c['push'](_0x59c51c['shift']());}};_0xd79a84(++_0x1472ac);}(_0x049e,0x16a));var _0xe049=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0x049e[_0x330723];return _0x60c546;};'use strict';var path=require(_0xe049('0x0'));var fs=require('fs');var _=require(_0xe049('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xe049('0x2'));var util=require('util');var BPromise=require(_0xe049('0x3'));var jayson=require(_0xe049('0x4'));var amiClient=jayson[_0xe049('0x5')][_0xe049('0x6')]({'port':0x232a});var logger=require(_0xe049('0x7'))('webbarapi');var Redis=require(_0xe049('0x8'));config[_0xe049('0x9')]=_[_0xe049('0xa')](config[_0xe049('0x9')],{'host':_0xe049('0xb'),'port':0x18eb});var io=require(_0xe049('0xc'))(new Redis(config[_0xe049('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xe049('0xd'),'required':[!![],_0xe049('0xe')]},'callNumber':{'type':_0xe049('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe049('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xe049('0xd'),'required':[!![],_0xe049('0xe')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe049('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe049('0xd'),'required':[!![],_0xe049('0xe')]},'sessionId':{'type':_0xe049('0xf'),'required':[!![],_0xe049('0x10')]},'transferNumber':{'type':_0xe049('0xf'),'required':[!![],_0xe049('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xe049('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe049('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe049('0xd'),'required':[!![],_0xe049('0xe')]},'sessionId':{'type':_0xe049('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe049('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xe049('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x388be0,_0x26b40c,_0x526d25){logger[_0xe049('0x12')](_0x388be0,_0x26b40c,JSON[_0xe049('0x13')](_0x526d25));io['to'](_0x388be0)['emit'](_0x26b40c,_0x526d25);}function handleError(_0x400a88){return function(_0x54c303){console['log'](_0xe049('0x14'),_0x54c303,_0x54c303 instanceof RangeError);logger['error'](_0x54c303['stack']);if(_0x54c303 instanceof RangeError){if(_0x54c303[_0xe049('0x15')]){delete _0x54c303[_0xe049('0x15')];}_0x400a88['status'](0x194)['send'](_0x54c303);}else{if(_0x54c303[_0xe049('0x15')]){delete _0x54c303[_0xe049('0x15')];}_0x400a88[_0xe049('0x16')](0x1f4)[_0xe049('0x17')](_0x54c303);}};}function checkError(){return function(_0x517aea){if(!_0x517aea){throw new RangeError('NotFound');}return _0x517aea;};}function respondWithRpcPromise(_0x11ceaa,_0x154fde){return new BPromise(function(_0x572a80,_0x36a03b){var _0x3f14eb=amiClient;return _0x3f14eb[_0xe049('0x18')](_0x11ceaa,_0x154fde)['then'](function(_0x197358){if(_0x197358[_0xe049('0x19')]){if(_0x197358['error']['code']===0x1f4){return _0x36a03b(_0x197358['error'][_0xe049('0x1a')]);}return _0x572a80(_0x197358['error']['message']);}else{_0x572a80(_0x197358[_0xe049('0x1b')]);}})[_0xe049('0x1c')](function(_0x53620b){_0x36a03b(_0x53620b);});});}function getAgent(_0x1f5233){return db[_0xe049('0x1d')][_0xe049('0x1e')]({'where':{'id':_0x1f5233,'role':_0xe049('0x1f')}})[_0xe049('0x20')](checkError());}function getAgentCheckSession(_0x1843b8,_0x5b0e64){return new BPromise(function(_0x50552d,_0x7f5538){var _0x542c7c=respondWithRpcPromise(_0xe049('0x21'));var _0x495d33=getAgent(_0x1843b8);Promise[_0xe049('0x22')]([_0x542c7c,_0x495d33])[_0xe049('0x20')](function(_0x5adcd6){var _0x432a6e=_0x5adcd6[0x0];var _0x364630=_0x5adcd6[0x1];var _0xb64700=_[_0xe049('0x23')](_0x432a6e[_0xe049('0x24')],function(_0x4055fc){return _0x4055fc[_0xe049('0x25')]==_0x364630['id']&&_0x4055fc[_0xe049('0x26')]==_0x5b0e64;});if(_0xb64700[_0xe049('0x27')]==0x1){_0x50552d(_0x364630);}else{_0x7f5538(new RangeError(_0xe049('0x28')+_0x5b0e64+_0xe049('0x29')));}});});}exports['originate']=function(_0x397dc3,_0x1e99c8){logger['info']('originate\x20fired:',_0x397dc3['body']);var _0x4c1499=originateValidation[_0xe049('0x2a')](_0x397dc3[_0xe049('0x2b')]);if(_0x4c1499[_0xe049('0x27')]>0x0){return _0x1e99c8[_0xe049('0x16')](0x190)[_0xe049('0x2c')](_0x4c1499);}var _0x5e2a91=_0x397dc3[_0xe049('0x2b')][_0xe049('0x2d')];var _0x2fd840=_0x397dc3[_0xe049('0x2b')][_0xe049('0x2e')];var _0x493844=_0x397dc3[_0xe049('0x2b')]['callerId'];var _0x1fc008=_0x397dc3['body'][_0xe049('0x2f')];return getAgent(_0x5e2a91)[_0xe049('0x20')](function(_0x2f8834){logger[_0xe049('0x12')](_0xe049('0x30'),_0x2f8834[_0xe049('0x15')]);emit(util[_0xe049('0x31')](_0xe049('0x32'),_0x2f8834[_0xe049('0x15')]),_0xe049('0x33'),{'callNumber':_0x2fd840,'callerId':_0x493844,'callbackUrl':_0x1fc008});return _0x1e99c8[_0xe049('0x16')](0xc8)['json']({'error':![],'message':_0xe049('0x34')});})[_0xe049('0x1c')](handleError(_0x1e99c8));};exports[_0xe049('0x35')]=function(_0x2abc8d,_0x3e042e){logger[_0xe049('0x12')](_0xe049('0x36'),_0x2abc8d[_0xe049('0x2b')]);var _0x54df1a=hangupValidation[_0xe049('0x2a')](_0x2abc8d[_0xe049('0x2b')]);if(_0x54df1a[_0xe049('0x27')]>0x0){return _0x3e042e[_0xe049('0x16')](0x190)[_0xe049('0x2c')](_0x54df1a);}var _0xe17673=_0x2abc8d[_0xe049('0x2b')][_0xe049('0x2d')];var _0x2a840f=_0x2abc8d[_0xe049('0x2b')]['sessionId'];return getAgent(_0xe17673)[_0xe049('0x20')](function(_0x176374){logger[_0xe049('0x12')]('entityFound:',_0x176374[_0xe049('0x15')]);emit(util['format']('user:%s',_0x176374[_0xe049('0x15')]),'webbar:hangup',{'sessionId':_0x2a840f});return _0x3e042e[_0xe049('0x16')](0xc8)[_0xe049('0x2c')]({'error':![],'message':_0xe049('0x37')});})[_0xe049('0x1c')](handleError(_0x3e042e));};exports[_0xe049('0x38')]=function(_0x587ea9,_0x4261da){logger[_0xe049('0x12')]('answer\x20fired:',_0x587ea9['body']);var _0x29915f=answerValidation[_0xe049('0x2a')](_0x587ea9[_0xe049('0x2b')]);if(_0x29915f[_0xe049('0x27')]>0x0){return _0x4261da[_0xe049('0x16')](0x190)[_0xe049('0x2c')](_0x29915f);}var _0x56a309=_0x587ea9[_0xe049('0x2b')][_0xe049('0x2d')];var _0x5c04f6=_0x587ea9[_0xe049('0x2b')][_0xe049('0x26')];return getAgent(_0x56a309)[_0xe049('0x20')](function(_0x2f5258){logger[_0xe049('0x12')]('entityFound:',_0x2f5258['name']);emit(util[_0xe049('0x31')](_0xe049('0x32'),_0x2f5258[_0xe049('0x15')]),_0xe049('0x39'),{'sessionId':_0x5c04f6});return _0x4261da[_0xe049('0x16')](0xc8)[_0xe049('0x2c')]({'error':![],'message':'answer\x20executed!'});})[_0xe049('0x1c')](handleError(_0x4261da));};exports[_0xe049('0x3a')]=function(_0x5dadbf,_0x374ce2){logger['info'](_0xe049('0x3b'),_0x5dadbf['body']);var _0x1112bf=holdValidation['validate'](_0x5dadbf[_0xe049('0x2b')]);if(_0x1112bf[_0xe049('0x27')]>0x0){return _0x374ce2[_0xe049('0x16')](0x190)[_0xe049('0x2c')](_0x1112bf);}var _0x22eeb1=_0x5dadbf['body'][_0xe049('0x2d')];var _0x2310ff=_0x5dadbf[_0xe049('0x2b')][_0xe049('0x26')];return getAgent(_0x22eeb1)[_0xe049('0x20')](function(_0x3c15a2){logger[_0xe049('0x12')](_0xe049('0x30'),_0x3c15a2[_0xe049('0x15')]);emit(util['format']('user:%s',_0x3c15a2[_0xe049('0x15')]),_0xe049('0x3c'),{'sessionId':_0x2310ff});return _0x374ce2[_0xe049('0x16')](0xc8)[_0xe049('0x2c')]({'error':![],'message':_0xe049('0x3d')});})[_0xe049('0x1c')](handleError(_0x374ce2));};exports[_0xe049('0x3e')]=function(_0x2e4dce,_0x23692f){logger[_0xe049('0x12')](_0xe049('0x3f'),_0x2e4dce['body']);var _0x36346a=unholdValidation[_0xe049('0x2a')](_0x2e4dce[_0xe049('0x2b')]);if(_0x36346a[_0xe049('0x27')]>0x0){return _0x23692f[_0xe049('0x16')](0x190)[_0xe049('0x2c')](_0x36346a);}var _0x373a49=_0x2e4dce['body']['userId'];var _0x57b3ff=_0x2e4dce[_0xe049('0x2b')][_0xe049('0x26')];return getAgent(_0x373a49)['then'](function(_0x2e361b){logger[_0xe049('0x12')](_0xe049('0x30'),_0x2e361b[_0xe049('0x15')]);emit(util['format']('user:%s',_0x2e361b[_0xe049('0x15')]),_0xe049('0x40'),{'sessionId':_0x57b3ff});return _0x23692f['status'](0xc8)['json']({'error':![],'message':_0xe049('0x41')});})['catch'](handleError(_0x23692f));};exports[_0xe049('0x42')]=function(_0x2a1e06,_0x567c52){logger[_0xe049('0x12')]('calls\x20fired:',_0x567c52[_0xe049('0x2b')]);var _0x3ec963=callsValidation['validate'](_0x2a1e06[_0xe049('0x2b')]);if(_0x3ec963[_0xe049('0x27')]>0x0){return _0x567c52[_0xe049('0x16')](0x190)[_0xe049('0x2c')](_0x3ec963);}var _0x421d54=_0x2a1e06[_0xe049('0x2b')][_0xe049('0x2d')];var _0x1be891=respondWithRpcPromise(_0xe049('0x21'));var _0x35f367=getAgent(_0x421d54);return Promise['all']([_0x1be891,_0x35f367])[_0xe049('0x20')](function(_0x47390a){var _0xa2a8e4=_0x47390a[0x0];var _0x4d2b67=_0x47390a[0x1];var _0x1434eb=_[_0xe049('0x23')](_0xa2a8e4[_0xe049('0x24')],function(_0x156f71){return _0x156f71[_0xe049('0x25')]==_0x4d2b67['id'];});return _0x567c52[_0xe049('0x16')](0xc8)[_0xe049('0x2c')]({'count':_0x1434eb['length'],'rows':_0x1434eb});})[_0xe049('0x1c')](handleError(_0x567c52));};exports['conference']=function(_0x440b63,_0x51f90a){logger[_0xe049('0x12')](_0xe049('0x43'),_0x440b63[_0xe049('0x2b')]);var _0x3646e9=conferenceValidation[_0xe049('0x2a')](_0x440b63['body']);if(_0x3646e9[_0xe049('0x27')]>0x0){return _0x51f90a[_0xe049('0x16')](0x190)[_0xe049('0x2c')](_0x3646e9);}var _0xad43b0=_0x440b63[_0xe049('0x2b')][_0xe049('0x2d')];return getAgent(_0xad43b0)[_0xe049('0x20')](function(_0x2e4e9f){logger['info']('entityFound:',_0x2e4e9f[_0xe049('0x15')]);emit(util[_0xe049('0x31')]('user:%s',_0x2e4e9f[_0xe049('0x15')]),_0xe049('0x44'));return _0x51f90a[_0xe049('0x16')](0xc8)[_0xe049('0x2c')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x51f90a));};exports[_0xe049('0x45')]=function(_0x57290e,_0x4386c5){logger[_0xe049('0x12')](_0xe049('0x46'),_0x57290e[_0xe049('0x2b')]);var _0x1ffabc=transferValidation[_0xe049('0x2a')](_0x57290e[_0xe049('0x2b')]);if(_0x1ffabc[_0xe049('0x27')]>0x0){return _0x4386c5['status'](0x190)[_0xe049('0x2c')](_0x1ffabc);}var _0x371b78=_0x57290e[_0xe049('0x2b')][_0xe049('0x2d')];var _0x3b002e=_0x57290e['body'][_0xe049('0x26')];var _0x236f0b=_0x57290e[_0xe049('0x2b')][_0xe049('0x47')];return getAgent(_0x371b78)['then'](function(_0x5511ac){logger[_0xe049('0x12')](_0xe049('0x30'),_0x5511ac[_0xe049('0x15')]);emit(util[_0xe049('0x31')](_0xe049('0x32'),_0x5511ac[_0xe049('0x15')]),_0xe049('0x48'),{'sessionId':_0x3b002e,'transferNumber':_0x236f0b});return _0x4386c5[_0xe049('0x16')](0xc8)[_0xe049('0x2c')]({'error':![],'message':_0xe049('0x49')});})[_0xe049('0x1c')](handleError(_0x4386c5));}; \ No newline at end of file +var _0x1bca=['NotFound','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','UserId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','sessionId','format','webbar:hangup','answer','webbar:answer','hold\x20fired:','webbar:hold','unhold','unhold\x20executed!','calls\x20fired:','rows','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','send'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1bca,0xb6));var _0xa1bc=function(_0x5e16f6,_0x499cad){_0x5e16f6=_0x5e16f6-0x0;var _0x2fc865=_0x1bca[_0x5e16f6];return _0x2fc865;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xa1bc('0x0'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0xa1bc('0x1'));var BPromise=require('bluebird');var jayson=require(_0xa1bc('0x2'));var amiClient=jayson[_0xa1bc('0x3')][_0xa1bc('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xa1bc('0x5'));var Redis=require(_0xa1bc('0x6'));config[_0xa1bc('0x7')]=_[_0xa1bc('0x8')](config['redis'],{'host':_0xa1bc('0x9'),'port':0x18eb});var io=require(_0xa1bc('0xa'))(new Redis(config[_0xa1bc('0x7')]));var Schema=require(_0xa1bc('0xb'));var originateValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],_0xa1bc('0xd')]},'callNumber':{'type':_0xa1bc('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xa1bc('0xe')},'callbackUrl':{'type':_0xa1bc('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],_0xa1bc('0xd')]},'sessionId':{'type':_0xa1bc('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],_0xa1bc('0xd')]},'sessionId':{'type':_0xa1bc('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa1bc('0xe'),'required':[!![],_0xa1bc('0xf')]},'transferNumber':{'type':_0xa1bc('0xe'),'required':[!![],_0xa1bc('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],_0xa1bc('0xd')]},'sessionId':{'type':_0xa1bc('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],_0xa1bc('0xd')]},'sessionId':{'type':_0xa1bc('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa1bc('0xd')]}});function emit(_0xf8c08e,_0x1b90e6,_0x47459f){logger[_0xa1bc('0x11')](_0xf8c08e,_0x1b90e6,JSON[_0xa1bc('0x12')](_0x47459f));io['to'](_0xf8c08e)[_0xa1bc('0x13')](_0x1b90e6,_0x47459f);}function handleError(_0x3d2bd4){return function(_0x4765be){console['log']('handleError:',_0x4765be,_0x4765be instanceof RangeError);logger[_0xa1bc('0x14')](_0x4765be[_0xa1bc('0x15')]);if(_0x4765be instanceof RangeError){if(_0x4765be[_0xa1bc('0x16')]){delete _0x4765be[_0xa1bc('0x16')];}_0x3d2bd4['status'](0x194)['send'](_0x4765be);}else{if(_0x4765be[_0xa1bc('0x16')]){delete _0x4765be[_0xa1bc('0x16')];}_0x3d2bd4[_0xa1bc('0x17')](0x1f4)[_0xa1bc('0x18')](_0x4765be);}};}function checkError(){return function(_0x428eb5){if(!_0x428eb5){throw new RangeError(_0xa1bc('0x19'));}return _0x428eb5;};}function respondWithRpcPromise(_0x49d1ab,_0x3cda63){return new BPromise(function(_0xc81195,_0x1e4f4e){var _0x4fdf7d=amiClient;return _0x4fdf7d[_0xa1bc('0x1a')](_0x49d1ab,_0x3cda63)['then'](function(_0x10636d){if(_0x10636d[_0xa1bc('0x14')]){if(_0x10636d[_0xa1bc('0x14')][_0xa1bc('0x1b')]===0x1f4){return _0x1e4f4e(_0x10636d[_0xa1bc('0x14')][_0xa1bc('0x1c')]);}return _0xc81195(_0x10636d['error']['message']);}else{_0xc81195(_0x10636d[_0xa1bc('0x1d')]);}})[_0xa1bc('0x1e')](function(_0x5eff38){_0x1e4f4e(_0x5eff38);});});}function getAgent(_0x41acbc){return db[_0xa1bc('0x1f')][_0xa1bc('0x20')]({'where':{'id':_0x41acbc,'role':_0xa1bc('0x21')}})[_0xa1bc('0x22')](checkError());}function getAgentCheckSession(_0x2a89ba,_0x5a579f){return new BPromise(function(_0x4fdfd7,_0x359b54){var _0xa2137e=respondWithRpcPromise(_0xa1bc('0x23'));var _0x1270f5=getAgent(_0x2a89ba);Promise[_0xa1bc('0x24')]([_0xa2137e,_0x1270f5])['then'](function(_0x228fc8){var _0x512608=_0x228fc8[0x0];var _0x332201=_0x228fc8[0x1];var _0x447fc7=_['filter'](_0x512608['rows'],function(_0x4a120c){return _0x4a120c[_0xa1bc('0x25')]==_0x332201['id']&&_0x4a120c['sessionId']==_0x5a579f;});if(_0x447fc7[_0xa1bc('0x26')]==0x1){_0x4fdfd7(_0x332201);}else{_0x359b54(new RangeError(_0xa1bc('0x27')+_0x5a579f+_0xa1bc('0x28')));}});});}exports['originate']=function(_0x5c5af9,_0x1e68ba){logger['info'](_0xa1bc('0x29'),_0x5c5af9[_0xa1bc('0x2a')]);var _0x268ca7=originateValidation['validate'](_0x5c5af9['body']);if(_0x268ca7['length']>0x0){return _0x1e68ba[_0xa1bc('0x17')](0x190)[_0xa1bc('0x2b')](_0x268ca7);}var _0x4a089d=_0x5c5af9[_0xa1bc('0x2a')][_0xa1bc('0x2c')];var _0xc92b07=_0x5c5af9['body'][_0xa1bc('0x2d')];var _0x431b47=_0x5c5af9[_0xa1bc('0x2a')]['callerId'];var _0x160bba=_0x5c5af9[_0xa1bc('0x2a')][_0xa1bc('0x2e')];return getAgent(_0x4a089d)[_0xa1bc('0x22')](function(_0x3d049c){logger[_0xa1bc('0x11')](_0xa1bc('0x2f'),_0x3d049c[_0xa1bc('0x16')]);emit(util['format'](_0xa1bc('0x30'),_0x3d049c[_0xa1bc('0x16')]),_0xa1bc('0x31'),{'callNumber':_0xc92b07,'callerId':_0x431b47,'callbackUrl':_0x160bba});return _0x1e68ba[_0xa1bc('0x17')](0xc8)['json']({'error':![],'message':_0xa1bc('0x32')});})[_0xa1bc('0x1e')](handleError(_0x1e68ba));};exports['hangup']=function(_0x10d6e7,_0xaa47fc){logger[_0xa1bc('0x11')](_0xa1bc('0x33'),_0x10d6e7[_0xa1bc('0x2a')]);var _0x5ad131=hangupValidation[_0xa1bc('0xb')](_0x10d6e7[_0xa1bc('0x2a')]);if(_0x5ad131[_0xa1bc('0x26')]>0x0){return _0xaa47fc[_0xa1bc('0x17')](0x190)[_0xa1bc('0x2b')](_0x5ad131);}var _0x48c721=_0x10d6e7[_0xa1bc('0x2a')][_0xa1bc('0x2c')];var _0x380d73=_0x10d6e7[_0xa1bc('0x2a')][_0xa1bc('0x34')];return getAgent(_0x48c721)['then'](function(_0x479438){logger['info'](_0xa1bc('0x2f'),_0x479438['name']);emit(util[_0xa1bc('0x35')](_0xa1bc('0x30'),_0x479438[_0xa1bc('0x16')]),_0xa1bc('0x36'),{'sessionId':_0x380d73});return _0xaa47fc['status'](0xc8)[_0xa1bc('0x2b')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0xaa47fc));};exports[_0xa1bc('0x37')]=function(_0x5571c3,_0x16514c){logger[_0xa1bc('0x11')]('answer\x20fired:',_0x5571c3[_0xa1bc('0x2a')]);var _0x5cd49d=answerValidation[_0xa1bc('0xb')](_0x5571c3[_0xa1bc('0x2a')]);if(_0x5cd49d[_0xa1bc('0x26')]>0x0){return _0x16514c[_0xa1bc('0x17')](0x190)['json'](_0x5cd49d);}var _0x2b0e95=_0x5571c3[_0xa1bc('0x2a')]['userId'];var _0x982b40=_0x5571c3[_0xa1bc('0x2a')][_0xa1bc('0x34')];return getAgent(_0x2b0e95)[_0xa1bc('0x22')](function(_0x77518a){logger[_0xa1bc('0x11')](_0xa1bc('0x2f'),_0x77518a[_0xa1bc('0x16')]);emit(util[_0xa1bc('0x35')](_0xa1bc('0x30'),_0x77518a[_0xa1bc('0x16')]),_0xa1bc('0x38'),{'sessionId':_0x982b40});return _0x16514c[_0xa1bc('0x17')](0xc8)[_0xa1bc('0x2b')]({'error':![],'message':'answer\x20executed!'});})[_0xa1bc('0x1e')](handleError(_0x16514c));};exports['hold']=function(_0x44a0a9,_0x33db19){logger[_0xa1bc('0x11')](_0xa1bc('0x39'),_0x44a0a9['body']);var _0x531c74=holdValidation['validate'](_0x44a0a9['body']);if(_0x531c74['length']>0x0){return _0x33db19[_0xa1bc('0x17')](0x190)['json'](_0x531c74);}var _0x2dfad5=_0x44a0a9[_0xa1bc('0x2a')][_0xa1bc('0x2c')];var _0x3a87cd=_0x44a0a9['body'][_0xa1bc('0x34')];return getAgent(_0x2dfad5)[_0xa1bc('0x22')](function(_0x3fa784){logger[_0xa1bc('0x11')](_0xa1bc('0x2f'),_0x3fa784['name']);emit(util[_0xa1bc('0x35')](_0xa1bc('0x30'),_0x3fa784[_0xa1bc('0x16')]),_0xa1bc('0x3a'),{'sessionId':_0x3a87cd});return _0x33db19['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0xa1bc('0x1e')](handleError(_0x33db19));};exports[_0xa1bc('0x3b')]=function(_0x5b3b1,_0x274684){logger[_0xa1bc('0x11')]('unhold\x20fired:',_0x5b3b1['body']);var _0x14a113=unholdValidation[_0xa1bc('0xb')](_0x5b3b1[_0xa1bc('0x2a')]);if(_0x14a113[_0xa1bc('0x26')]>0x0){return _0x274684[_0xa1bc('0x17')](0x190)[_0xa1bc('0x2b')](_0x14a113);}var _0x21fb6e=_0x5b3b1[_0xa1bc('0x2a')][_0xa1bc('0x2c')];var _0x49876b=_0x5b3b1[_0xa1bc('0x2a')][_0xa1bc('0x34')];return getAgent(_0x21fb6e)['then'](function(_0x1c0f31){logger[_0xa1bc('0x11')](_0xa1bc('0x2f'),_0x1c0f31[_0xa1bc('0x16')]);emit(util[_0xa1bc('0x35')]('user:%s',_0x1c0f31['name']),'webbar:unhold',{'sessionId':_0x49876b});return _0x274684[_0xa1bc('0x17')](0xc8)[_0xa1bc('0x2b')]({'error':![],'message':_0xa1bc('0x3c')});})[_0xa1bc('0x1e')](handleError(_0x274684));};exports['calls']=function(_0xd69ef3,_0x1a59cf){logger['info'](_0xa1bc('0x3d'),_0x1a59cf['body']);var _0x5c5719=callsValidation['validate'](_0xd69ef3[_0xa1bc('0x2a')]);if(_0x5c5719[_0xa1bc('0x26')]>0x0){return _0x1a59cf['status'](0x190)[_0xa1bc('0x2b')](_0x5c5719);}var _0x7124ab=_0xd69ef3[_0xa1bc('0x2a')][_0xa1bc('0x2c')];var _0x262fb3=respondWithRpcPromise(_0xa1bc('0x23'));var _0x45fa8c=getAgent(_0x7124ab);return Promise[_0xa1bc('0x24')]([_0x262fb3,_0x45fa8c])[_0xa1bc('0x22')](function(_0x1c0787){var _0x34c829=_0x1c0787[0x0];var _0x28a91c=_0x1c0787[0x1];var _0x16f9f1=_['filter'](_0x34c829[_0xa1bc('0x3e')],function(_0x5cccc9){return _0x5cccc9[_0xa1bc('0x25')]==_0x28a91c['id'];});return _0x1a59cf[_0xa1bc('0x17')](0xc8)[_0xa1bc('0x2b')]({'count':_0x16f9f1[_0xa1bc('0x26')],'rows':_0x16f9f1});})[_0xa1bc('0x1e')](handleError(_0x1a59cf));};exports['conference']=function(_0x8134b,_0x1a7673){logger[_0xa1bc('0x11')](_0xa1bc('0x3f'),_0x8134b[_0xa1bc('0x2a')]);var _0x503dbe=conferenceValidation[_0xa1bc('0xb')](_0x8134b['body']);if(_0x503dbe['length']>0x0){return _0x1a7673['status'](0x190)[_0xa1bc('0x2b')](_0x503dbe);}var _0x3ebe04=_0x8134b[_0xa1bc('0x2a')][_0xa1bc('0x2c')];return getAgent(_0x3ebe04)['then'](function(_0x4d5909){logger['info'](_0xa1bc('0x2f'),_0x4d5909[_0xa1bc('0x16')]);emit(util[_0xa1bc('0x35')](_0xa1bc('0x30'),_0x4d5909[_0xa1bc('0x16')]),'webbar:conference');return _0x1a7673['status'](0xc8)[_0xa1bc('0x2b')]({'error':![],'message':_0xa1bc('0x40')});})[_0xa1bc('0x1e')](handleError(_0x1a7673));};exports[_0xa1bc('0x41')]=function(_0x1d2c67,_0x46a7e7){logger[_0xa1bc('0x11')](_0xa1bc('0x42'),_0x1d2c67[_0xa1bc('0x2a')]);var _0x3e9637=transferValidation[_0xa1bc('0xb')](_0x1d2c67['body']);if(_0x3e9637[_0xa1bc('0x26')]>0x0){return _0x46a7e7[_0xa1bc('0x17')](0x190)[_0xa1bc('0x2b')](_0x3e9637);}var _0xaf15de=_0x1d2c67[_0xa1bc('0x2a')]['userId'];var _0x26056f=_0x1d2c67[_0xa1bc('0x2a')]['sessionId'];var _0x48d01e=_0x1d2c67[_0xa1bc('0x2a')][_0xa1bc('0x43')];return getAgent(_0xaf15de)[_0xa1bc('0x22')](function(_0x53bb07){logger[_0xa1bc('0x11')](_0xa1bc('0x2f'),_0x53bb07['name']);emit(util['format']('user:%s',_0x53bb07['name']),'webbar:transfer',{'sessionId':_0x26056f,'transferNumber':_0x48d01e});return _0x46a7e7[_0xa1bc('0x17')](0xc8)[_0xa1bc('0x2b')]({'error':![],'message':_0xa1bc('0x44')});})[_0xa1bc('0x1e')](handleError(_0x46a7e7));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 6471550..93ee06f 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 _0x9582=['destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addApplications','/:id/notify','/:id/send','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9582,0x95));var _0x2958=function(_0x47c5e6,_0x5b1c19){_0x47c5e6=_0x47c5e6-0x0;var _0x4cf794=_0x9582[_0x47c5e6];return _0x4cf794;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2958('0x6'));var interaction=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var controller=require(_0x2958('0x9'));router[_0x2958('0xa')]('/',auth[_0x2958('0xb')](),controller[_0x2958('0xc')]);router[_0x2958('0xa')](_0x2958('0xd'),auth[_0x2958('0xb')](),controller['describe']);router['get'](_0x2958('0xe'),auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['get'](_0x2958('0x10'),auth['isAuthenticated'](),controller[_0x2958('0x11')]);router[_0x2958('0xa')](_0x2958('0x12'),auth[_0x2958('0xb')](),controller[_0x2958('0x13')]);router['get'](_0x2958('0x14'),auth[_0x2958('0xb')](),controller[_0x2958('0x15')]);router[_0x2958('0xa')](_0x2958('0x16'),auth[_0x2958('0xb')](),controller[_0x2958('0x17')]);router[_0x2958('0x18')]('/',auth['isAuthenticated'](),controller[_0x2958('0x19')]);router[_0x2958('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2958('0x1a')]);router[_0x2958('0x18')]('/:id/canned_answers',auth[_0x2958('0xb')](),controller['addAnswer']);router['post'](_0x2958('0x14'),auth[_0x2958('0xb')](),controller['addAgents']);router['post'](_0x2958('0x16'),auth[_0x2958('0xb')](),controller[_0x2958('0x1b')]);router[_0x2958('0x18')](_0x2958('0x1c'),controller['notify']);router[_0x2958('0x18')](_0x2958('0x1d'),auth[_0x2958('0xb')](),controller['send']);router[_0x2958('0x1e')]('/:id',auth[_0x2958('0xb')](),controller['update']);router['delete'](_0x2958('0xe'),auth[_0x2958('0xb')](),controller[_0x2958('0x1f')]);router[_0x2958('0x20')](_0x2958('0x10'),auth[_0x2958('0xb')](),controller[_0x2958('0x21')]);router[_0x2958('0x20')](_0x2958('0x12'),auth[_0x2958('0xb')](),controller[_0x2958('0x22')]);router[_0x2958('0x20')](_0x2958('0x14'),auth[_0x2958('0xb')](),controller[_0x2958('0x23')]);module['exports']=router; \ No newline at end of file +var _0xe2fe=['removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./whatsappAccount.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xee2f('0x8')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);router[_0xee2f('0x7')](_0xee2f('0xe'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xf')]);router['post']('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0x10')](_0xee2f('0xc'),auth['isAuthenticated'](),controller[_0xee2f('0x11')]);router[_0xee2f('0x10')](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x13')]);router['post'](_0xee2f('0x14'),auth['isAuthenticated'](),controller[_0xee2f('0x15')]);router[_0xee2f('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0xee2f('0x16')]);router['post'](_0xee2f('0x17'),controller[_0xee2f('0x18')]);router[_0xee2f('0x10')]('/:id/send',auth[_0xee2f('0x8')](),controller[_0xee2f('0x19')]);router[_0xee2f('0x1a')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['update']);router['delete'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1b')]);router[_0xee2f('0x1c')](_0xee2f('0xc'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1d')]);router['delete'](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1e')]);router[_0xee2f('0x1c')](_0xee2f('0x14'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1f')]);module[_0xee2f('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 8004bf2..6a7689f 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 _0x5ddf=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM'];(function(_0x44073b,_0x53116c){var _0x3757d4=function(_0x1a7263){while(--_0x1a7263){_0x44073b['push'](_0x44073b['shift']());}};_0x3757d4(++_0x53116c);}(_0x5ddf,0x6a));var _0xf5dd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5ddf[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xf5dd('0x0'));var rs=require(_0xf5dd('0x1'));module[_0xf5dd('0x2')]={'name':{'type':Sequelize[_0xf5dd('0x3')],'unique':_0xf5dd('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xf5dd('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xf5dd('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xf5dd('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xf5dd('0x3')]},'type':{'type':Sequelize[_0xf5dd('0x5')]('twilio',_0xf5dd('0x6'))},'accountSid':{'type':Sequelize[_0xf5dd('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xf5dd('0x3')]},'notificationTemplate':{'type':Sequelize[_0xf5dd('0x7')],'defaultValue':function(){return _0xf5dd('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xf5dd('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf5dd('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf5dd('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf5dd('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf5dd('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf5dd('0xc'),'set':function(_0x45f909){if(!_0x45f909){this[_0xf5dd('0xd')](_0xf5dd('0xe'),null);}this[_0xf5dd('0xd')](_0xf5dd('0xf'),_0x45f909);}},'description':{'type':Sequelize[_0xf5dd('0x3')]}}; \ No newline at end of file +var _0xb130=['sinch','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','twilio'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb130,0xa4));var _0x0b13=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0xb130[_0x1dbaf7];return _0x593f05;};'use strict';var Sequelize=require(_0x0b13('0x0'));var rs=require('randomstring');module[_0x0b13('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0b13('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x0b13('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x0b13('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0b13('0x3')](_0x0b13('0x4'),_0x0b13('0x5'))},'accountSid':{'type':Sequelize[_0x0b13('0x2')]},'baseUrl':{'type':Sequelize[_0x0b13('0x2')]},'authToken':{'type':Sequelize[_0x0b13('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0b13('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0b13('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0b13('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0b13('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0b13('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0b13('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0b13('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0b13('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0b13('0x7')],'defaultValue':![],'comment':_0x0b13('0x9'),'set':function(_0x1f0292){if(!_0x1f0292){this['setDataValue'](_0x0b13('0xa'),null);}this[_0x0b13('0xb')](_0x0b13('0xc'),_0x1f0292);}},'description':{'type':Sequelize[_0x0b13('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8774696..8102c43 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 _0xbaf9=['include','rows','show','params','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','Applications','account','statuses','read','WhatsappMessage','message_id','orderBy','priority','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','From','messageId','MessageSid','sinch','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','to\x20is\x20mandatory','List','out','Messages','dataValues','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','rawAttributes','fieldName','type','model','map','query','keys','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','WhatsappAccount','includeAll'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xbaf9,0x6d));var _0x9baf=function(_0x4abbeb,_0x24cb71){_0x4abbeb=_0x4abbeb-0x0;var _0x3970c4=_0xbaf9[_0x4abbeb];return _0x3970c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9baf('0x0'));var jsonpatch=require(_0x9baf('0x1'));var rp=require(_0x9baf('0x2'));var moment=require(_0x9baf('0x3'));var BPromise=require(_0x9baf('0x4'));var Mustache=require('mustache');var util=require(_0x9baf('0x5'));var path=require(_0x9baf('0x6'));var sox=require('sox');var csv=require(_0x9baf('0x7'));var ejs=require(_0x9baf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9baf('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9baf('0xa'));var deskjs=require(_0x9baf('0xb'));var toCsv=require(_0x9baf('0x7'));var querystring=require(_0x9baf('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9baf('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9baf('0xe'));var hardwareService=require(_0x9baf('0xf'));var logger=require(_0x9baf('0x10'))('api');var utils=require(_0x9baf('0x11'));var config=require(_0x9baf('0x12'));var licenseUtil=require(_0x9baf('0x13'));var db=require('../../mysqldb')['db'];config[_0x9baf('0x14')]=_[_0x9baf('0x15')](config['redis'],{'host':_0x9baf('0x16'),'port':0x18eb});var socket=require(_0x9baf('0x17'))(new Redis(config[_0x9baf('0x14')]));require(_0x9baf('0x18'))[_0x9baf('0x19')](socket);var jayson=require(_0x9baf('0x1a'));var client=jayson[_0x9baf('0x1b')][_0x9baf('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x4741c6,_0xd3dbc1,_0x3375e7,_0x2ae39a){return new BPromise(function(_0x1d12fb,_0x4b2b42){var _0x36e025=_0x2ae39a||client;return _0x36e025[_0x9baf('0x1d')](_0x4741c6,_0x3375e7)[_0x9baf('0x1e')](function(_0x428dc9){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0xd3dbc1,_0x9baf('0x1f'));logger[_0x9baf('0x20')](_0x9baf('0x21'),_0xd3dbc1,'request\x20sent',JSON[_0x9baf('0x22')](_0x428dc9));if(_0x428dc9['error']){if(_0x428dc9[_0x9baf('0x23')]['code']===0x1f4){logger[_0x9baf('0x23')](_0x9baf('0x24'),_0xd3dbc1,_0x428dc9[_0x9baf('0x23')][_0x9baf('0x25')]);return _0x4b2b42(_0x428dc9[_0x9baf('0x23')][_0x9baf('0x25')]);}logger['error'](_0x9baf('0x24'),_0xd3dbc1,_0x428dc9['error'][_0x9baf('0x25')]);return _0x1d12fb(_0x428dc9[_0x9baf('0x23')]['message']);}else{logger['info'](_0x9baf('0x24'),_0xd3dbc1,_0x9baf('0x1f'));_0x1d12fb(_0x428dc9[_0x9baf('0x26')]['message']);}})[_0x9baf('0x27')](function(_0x130ebf){logger[_0x9baf('0x23')](_0x9baf('0x24'),_0xd3dbc1,_0x130ebf);_0x4b2b42(_0x130ebf);});});}function respondWithStatusCode(_0x1ca191,_0x19cb2a){_0x19cb2a=_0x19cb2a||0xcc;return function(_0x399f2c){if(_0x399f2c){return _0x1ca191[_0x9baf('0x28')](_0x19cb2a);}return _0x1ca191[_0x9baf('0x29')](_0x19cb2a)['end']();};}function respondWithResult(_0x2186b5,_0x267793){_0x267793=_0x267793||0xc8;return function(_0x10611c){if(_0x10611c){return _0x2186b5['status'](_0x267793)[_0x9baf('0x2a')](_0x10611c);}};}function respondWithFilteredResult(_0x22fba9,_0x5da014){return function(_0x419c3f){if(_0x419c3f){var _0x514904=typeof _0x5da014[_0x9baf('0x2b')]===_0x9baf('0x2c')&&typeof _0x5da014['limit']===_0x9baf('0x2c');var _0xf9d9a2=_0x419c3f[_0x9baf('0x2d')];var _0x21c6f6=_0x514904?0x0:_0x5da014['offset'];var _0x3558cf=_0x514904?_0x419c3f['count']:_0x5da014[_0x9baf('0x2b')]+_0x5da014[_0x9baf('0x2e')];var _0x27f6fb;if(_0x3558cf>=_0xf9d9a2){_0x3558cf=_0xf9d9a2;_0x27f6fb=0xc8;}else{_0x27f6fb=0xce;}_0x22fba9[_0x9baf('0x29')](_0x27f6fb);return _0x22fba9[_0x9baf('0x2f')](_0x9baf('0x30'),_0x21c6f6+'-'+_0x3558cf+'/'+_0xf9d9a2)['json'](_0x419c3f);}return null;};}function patchUpdates(_0x2d5522){return function(_0x4b3d32){try{jsonpatch[_0x9baf('0x31')](_0x4b3d32,_0x2d5522,!![]);}catch(_0x2ee0a2){return BPromise[_0x9baf('0x32')](_0x2ee0a2);}return _0x4b3d32[_0x9baf('0x33')]();};}function saveUpdates(_0xc5c6bd,_0x117d86){return function(_0x1cc82c){if(_0x1cc82c){return _0x1cc82c[_0x9baf('0x34')](_0xc5c6bd)[_0x9baf('0x1e')](function(_0x2580fa){return _0x2580fa;});}return null;};}function removeEntity(_0x8a5f29,_0x540655){return function(_0x2df43a){if(_0x2df43a){return _0x2df43a[_0x9baf('0x35')]()[_0x9baf('0x1e')](function(){var _0x4fed8c=_0x2df43a[_0x9baf('0x36')]({'plain':!![]});var _0x1195c1='WhatsappAccounts';return db[_0x9baf('0x37')][_0x9baf('0x35')]({'where':{'type':_0x1195c1,'resourceId':_0x4fed8c['id']}})[_0x9baf('0x1e')](function(){return _0x2df43a;});})[_0x9baf('0x1e')](function(){_0x8a5f29[_0x9baf('0x29')](0xcc)[_0x9baf('0x38')]();});}};}function handleEntityNotFound(_0x158cd6,_0x961580){return function(_0x1ad6a7){if(!_0x1ad6a7){_0x158cd6[_0x9baf('0x28')](0x194);}return _0x1ad6a7;};}function handleError(_0x53b665,_0xe8c9c6){_0xe8c9c6=_0xe8c9c6||0x1f4;return function(_0x2537f3){logger[_0x9baf('0x23')](_0x2537f3[_0x9baf('0x39')]);if(_0x2537f3[_0x9baf('0x3a')]){delete _0x2537f3[_0x9baf('0x3a')];}_0x53b665[_0x9baf('0x29')](_0xe8c9c6)[_0x9baf('0x3b')](_0x2537f3);};}exports[_0x9baf('0x3c')]=function(_0x2bbf12,_0x30f48f){var _0x114b81={'include':[{'model':db[_0x9baf('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5d7a6b={},_0x5d2b7f={'count':0x0,'rows':[]};var _0x5f4acb=_['map'](db['WhatsappAccount'][_0x9baf('0x3e')],function(_0x164d7c){return{'name':_0x164d7c[_0x9baf('0x3f')],'type':_0x164d7c[_0x9baf('0x40')]['key']};});_0x5d7a6b[_0x9baf('0x41')]=_[_0x9baf('0x42')](_0x5f4acb,_0x9baf('0x3a'));_0x5d7a6b[_0x9baf('0x43')]=_[_0x9baf('0x44')](_0x2bbf12[_0x9baf('0x43')]);_0x5d7a6b['filters']=_['intersection'](_0x5d7a6b[_0x9baf('0x41')],_0x5d7a6b[_0x9baf('0x43')]);_0x114b81['attributes']=_['intersection'](_0x5d7a6b['model'],qs[_0x9baf('0x45')](_0x2bbf12[_0x9baf('0x43')][_0x9baf('0x45')]));_0x114b81[_0x9baf('0x46')]=_0x114b81['attributes'][_0x9baf('0x47')]?_0x114b81['attributes']:_0x5d7a6b[_0x9baf('0x41')];if(!_0x2bbf12[_0x9baf('0x43')]['hasOwnProperty'](_0x9baf('0x48'))){_0x114b81[_0x9baf('0x2e')]=qs[_0x9baf('0x2e')](_0x2bbf12[_0x9baf('0x43')][_0x9baf('0x2e')]);_0x114b81[_0x9baf('0x2b')]=qs[_0x9baf('0x2b')](_0x2bbf12[_0x9baf('0x43')][_0x9baf('0x2b')]);}_0x114b81[_0x9baf('0x49')]=qs[_0x9baf('0x4a')](_0x2bbf12['query']['sort']);_0x114b81[_0x9baf('0x4b')]=qs[_0x9baf('0x4c')](_[_0x9baf('0x4d')](_0x2bbf12[_0x9baf('0x43')],_0x5d7a6b['filters']),_0x5f4acb);if(_0x2bbf12[_0x9baf('0x43')][_0x9baf('0x4e')]){_0x114b81[_0x9baf('0x4b')]=_[_0x9baf('0x4f')](_0x114b81[_0x9baf('0x4b')],{'$or':_[_0x9baf('0x42')](_0x5f4acb,function(_0x123865){if(_0x123865[_0x9baf('0x40')]!==_0x9baf('0x50')){var _0xd810d1={};_0xd810d1[_0x123865[_0x9baf('0x3a')]]={'$like':'%'+_0x2bbf12['query'][_0x9baf('0x4e')]+'%'};return _0xd810d1;}})});}_0x114b81=_[_0x9baf('0x4f')]({},_0x114b81,_0x2bbf12['options']);var _0x34f816={'where':_0x114b81['where']};return db[_0x9baf('0x51')][_0x9baf('0x2d')](_0x34f816)[_0x9baf('0x1e')](function(_0xb56e4b){_0x5d2b7f['count']=_0xb56e4b;if(_0x2bbf12[_0x9baf('0x43')][_0x9baf('0x52')]){_0x114b81[_0x9baf('0x53')]=[{'all':!![]}];}return db[_0x9baf('0x51')]['findAll'](_0x114b81);})[_0x9baf('0x1e')](function(_0xac25e4){_0x5d2b7f[_0x9baf('0x54')]=_0xac25e4;return _0x5d2b7f;})['then'](respondWithFilteredResult(_0x30f48f,_0x114b81))['catch'](handleError(_0x30f48f,null));};exports[_0x9baf('0x55')]=function(_0xdb31ad,_0x1011b9){var _0x392df8={'raw':![],'where':{'id':_0xdb31ad[_0x9baf('0x56')]['id']},'include':[{'model':db[_0x9baf('0x3d')],'as':'mandatoryDispositionPause'}]},_0xc6a8f6={};_0xc6a8f6[_0x9baf('0x41')]=_['keys'](db[_0x9baf('0x51')][_0x9baf('0x3e')]);_0xc6a8f6[_0x9baf('0x43')]=_['keys'](_0xdb31ad[_0x9baf('0x43')]);_0xc6a8f6['filters']=_[_0x9baf('0x57')](_0xc6a8f6[_0x9baf('0x41')],_0xc6a8f6[_0x9baf('0x43')]);_0x392df8[_0x9baf('0x46')]=_[_0x9baf('0x57')](_0xc6a8f6['model'],qs[_0x9baf('0x45')](_0xdb31ad[_0x9baf('0x43')]['fields']));_0x392df8[_0x9baf('0x46')]=_0x392df8[_0x9baf('0x46')][_0x9baf('0x47')]?_0x392df8[_0x9baf('0x46')]:_0xc6a8f6[_0x9baf('0x41')];if(_0xdb31ad[_0x9baf('0x43')]['includeAll']){_0x392df8['include']=[{'all':!![]}];}_0x392df8=_[_0x9baf('0x4f')]({},_0x392df8,_0xdb31ad[_0x9baf('0x58')]);return db[_0x9baf('0x51')][_0x9baf('0x59')](_0x392df8)['then'](handleEntityNotFound(_0x1011b9,null))[_0x9baf('0x1e')](respondWithResult(_0x1011b9,null))[_0x9baf('0x27')](handleError(_0x1011b9,null));};exports[_0x9baf('0x5a')]=function(_0x2a4c94,_0x39cbbf){return db[_0x9baf('0x51')][_0x9baf('0x5a')](_0x2a4c94[_0x9baf('0x5b')],{})[_0x9baf('0x1e')](function(_0x2a2227){var _0x5a1884=_0x2a4c94[_0x9baf('0x5c')][_0x9baf('0x36')]({'plain':!![]});if(!_0x5a1884)throw new Error(_0x9baf('0x5d'));if(_0x5a1884[_0x9baf('0x5e')]===_0x9baf('0x5c')){var _0x1ad4f0=_0x2a2227[_0x9baf('0x36')]({'plain':!![]});var _0x15ae4e='WhatsappAccounts';return db[_0x9baf('0x5f')][_0x9baf('0x59')]({'where':{'name':_0x15ae4e,'userProfileId':_0x5a1884[_0x9baf('0x60')]},'raw':!![]})['then'](function(_0x253200){if(_0x253200&&_0x253200[_0x9baf('0x61')]===0x0){return db[_0x9baf('0x37')][_0x9baf('0x5a')]({'name':_0x1ad4f0[_0x9baf('0x3a')],'resourceId':_0x1ad4f0['id'],'type':_0x253200[_0x9baf('0x3a')],'sectionId':_0x253200['id']},{})[_0x9baf('0x1e')](function(){return _0x2a2227;});}else{return _0x2a2227;}})[_0x9baf('0x27')](function(_0x437a77){logger[_0x9baf('0x23')](_0x9baf('0x62'),_0x437a77);throw _0x437a77;});}return _0x2a2227;})['then'](respondWithResult(_0x39cbbf,0xc9))[_0x9baf('0x27')](handleError(_0x39cbbf,null));};exports[_0x9baf('0x34')]=function(_0x251a22,_0x2285a7){if(_0x251a22[_0x9baf('0x5b')]['id']){delete _0x251a22['body']['id'];}return db[_0x9baf('0x51')][_0x9baf('0x59')]({'where':{'id':_0x251a22[_0x9baf('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x9baf('0x63')}]})['then'](handleEntityNotFound(_0x2285a7,null))[_0x9baf('0x1e')](saveUpdates(_0x251a22[_0x9baf('0x5b')],null))['then'](respondWithResult(_0x2285a7,null))[_0x9baf('0x27')](handleError(_0x2285a7,null));};exports[_0x9baf('0x35')]=function(_0x26de8d,_0x5364ac){return db[_0x9baf('0x51')][_0x9baf('0x59')]({'where':{'id':_0x26de8d[_0x9baf('0x56')]['id']}})['then'](handleEntityNotFound(_0x5364ac,null))[_0x9baf('0x1e')](removeEntity(_0x5364ac,null))[_0x9baf('0x27')](handleError(_0x5364ac,null));};exports[_0x9baf('0x64')]=function(_0x2d6227,_0x31fb52){return db[_0x9baf('0x51')][_0x9baf('0x64')]()['then'](respondWithResult(_0x31fb52,null))[_0x9baf('0x27')](handleError(_0x31fb52,null));};exports[_0x9baf('0x65')]=function(_0x2b2653,_0x44607f,_0x270d48){if(_0x2b2653[_0x9baf('0x5b')]['id']){delete _0x2b2653[_0x9baf('0x5b')]['id'];}return db[_0x9baf('0x51')]['find']({'where':{'id':_0x2b2653[_0x9baf('0x56')]['id']}})[_0x9baf('0x1e')](handleEntityNotFound(_0x44607f,null))[_0x9baf('0x1e')](function(_0x34d935){if(_0x34d935){_0x2b2653['body'][_0x9baf('0x66')]=_0x34d935['id'];return db[_0x9baf('0x67')][_0x9baf('0x5a')](_0x2b2653[_0x9baf('0x5b')]);}})[_0x9baf('0x1e')](respondWithResult(_0x44607f,null))[_0x9baf('0x27')](handleError(_0x44607f,null));};exports[_0x9baf('0x68')]=function(_0x5f4d88,_0x267c9,_0x582238){var _0x32a2cc={'raw':![],'where':{}};var _0x193e3c={};var _0x12561d={'count':0x0,'rows':[]};return db[_0x9baf('0x51')][_0x9baf('0x69')]({'where':{'id':_0x5f4d88[_0x9baf('0x56')]['id']}})[_0x9baf('0x1e')](handleEntityNotFound(_0x267c9,null))[_0x9baf('0x1e')](function(_0x9f32b6){if(_0x9f32b6){_0x193e3c[_0x9baf('0x41')]=_['keys'](db[_0x9baf('0x67')][_0x9baf('0x3e')]);_0x193e3c[_0x9baf('0x43')]=_[_0x9baf('0x44')](_0x5f4d88['query']);_0x193e3c['filters']=_[_0x9baf('0x57')](_0x193e3c[_0x9baf('0x41')],_0x193e3c[_0x9baf('0x43')]);_0x32a2cc[_0x9baf('0x46')]=_[_0x9baf('0x57')](_0x193e3c[_0x9baf('0x41')],qs[_0x9baf('0x45')](_0x5f4d88[_0x9baf('0x43')][_0x9baf('0x45')]));_0x32a2cc[_0x9baf('0x46')]=_0x32a2cc[_0x9baf('0x46')]['length']?_0x32a2cc[_0x9baf('0x46')]:_0x193e3c[_0x9baf('0x41')];if(!_0x5f4d88[_0x9baf('0x43')]['hasOwnProperty'](_0x9baf('0x48'))){_0x32a2cc[_0x9baf('0x2e')]=qs['limit'](_0x5f4d88[_0x9baf('0x43')][_0x9baf('0x2e')]);_0x32a2cc[_0x9baf('0x2b')]=qs[_0x9baf('0x2b')](_0x5f4d88[_0x9baf('0x43')]['offset']);}_0x32a2cc['order']=qs[_0x9baf('0x4a')](_0x5f4d88['query'][_0x9baf('0x4a')]);_0x32a2cc[_0x9baf('0x4b')]=qs[_0x9baf('0x4c')](_[_0x9baf('0x4d')](_0x5f4d88[_0x9baf('0x43')],_0x193e3c['filters']));_0x32a2cc[_0x9baf('0x4b')][_0x9baf('0x66')]=_0x9f32b6['id'];if(_0x5f4d88[_0x9baf('0x43')]['filter']){_0x32a2cc[_0x9baf('0x4b')]=_['merge'](_0x32a2cc[_0x9baf('0x4b')],{'$or':_[_0x9baf('0x42')](_0x32a2cc['attributes'],function(_0x1da48e){var _0x19e06a={};_0x19e06a[_0x1da48e]={'$like':'%'+_0x5f4d88['query'][_0x9baf('0x4e')]+'%'};return _0x19e06a;})});}_0x32a2cc=_[_0x9baf('0x4f')]({},_0x32a2cc,_0x5f4d88[_0x9baf('0x58')]);return db[_0x9baf('0x67')][_0x9baf('0x2d')]({'where':_0x32a2cc['where']})['then'](function(_0x1a0870){_0x12561d[_0x9baf('0x2d')]=_0x1a0870;if(_0x5f4d88[_0x9baf('0x43')]['includeAll']){_0x32a2cc[_0x9baf('0x53')]=[{'all':!![]}];}return db[_0x9baf('0x67')]['findAll'](_0x32a2cc);})[_0x9baf('0x1e')](function(_0x216b5d){_0x12561d['rows']=_0x216b5d;return _0x12561d;});}})[_0x9baf('0x1e')](respondWithFilteredResult(_0x267c9,_0x32a2cc))[_0x9baf('0x27')](handleError(_0x267c9,null));};exports[_0x9baf('0x6a')]=function(_0x4c3127,_0x309447,_0x54f793){return db[_0x9baf('0x51')]['find']({'where':{'id':_0x4c3127[_0x9baf('0x56')]['id']}})['then'](handleEntityNotFound(_0x309447,null))[_0x9baf('0x1e')](function(_0x3ff2e7){if(_0x3ff2e7){return _0x3ff2e7[_0x9baf('0x6a')](_0x4c3127[_0x9baf('0x43')]['ids']);}})[_0x9baf('0x1e')](respondWithStatusCode(_0x309447,null))['catch'](handleError(_0x309447,null));};exports[_0x9baf('0x6b')]=function(_0x5f44c2,_0x59a245,_0x33de19){if(_0x5f44c2[_0x9baf('0x5b')]['id']){delete _0x5f44c2['body']['id'];}return db[_0x9baf('0x51')][_0x9baf('0x59')]({'where':{'id':_0x5f44c2[_0x9baf('0x56')]['id']}})[_0x9baf('0x1e')](handleEntityNotFound(_0x59a245,null))[_0x9baf('0x1e')](function(_0x50112d){if(_0x50112d){_0x5f44c2['body'][_0x9baf('0x66')]=_0x50112d['id'];return db[_0x9baf('0x6c')][_0x9baf('0x5a')](_0x5f44c2['body']);}})['then'](respondWithResult(_0x59a245,null))[_0x9baf('0x27')](handleError(_0x59a245,null));};exports[_0x9baf('0x6d')]=function(_0x385bfc,_0x58a17d,_0x184c7b){var _0x6c715b={'raw':![],'where':{}};var _0x38eb7c={};var _0x9e48a3={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x9baf('0x69')]({'where':{'id':_0x385bfc['params']['id']}})[_0x9baf('0x1e')](handleEntityNotFound(_0x58a17d,null))[_0x9baf('0x1e')](function(_0x4b9adf){if(_0x4b9adf){_0x38eb7c[_0x9baf('0x41')]=_[_0x9baf('0x44')](db[_0x9baf('0x6c')][_0x9baf('0x3e')]);_0x38eb7c[_0x9baf('0x43')]=_[_0x9baf('0x44')](_0x385bfc[_0x9baf('0x43')]);_0x38eb7c[_0x9baf('0x4c')]=_[_0x9baf('0x57')](_0x38eb7c[_0x9baf('0x41')],_0x38eb7c[_0x9baf('0x43')]);_0x6c715b[_0x9baf('0x46')]=_[_0x9baf('0x57')](_0x38eb7c['model'],qs[_0x9baf('0x45')](_0x385bfc[_0x9baf('0x43')]['fields']));_0x6c715b['attributes']=_0x6c715b[_0x9baf('0x46')][_0x9baf('0x47')]?_0x6c715b['attributes']:_0x38eb7c[_0x9baf('0x41')];if(!_0x385bfc[_0x9baf('0x43')][_0x9baf('0x6e')](_0x9baf('0x48'))){_0x6c715b['limit']=qs['limit'](_0x385bfc['query'][_0x9baf('0x2e')]);_0x6c715b[_0x9baf('0x2b')]=qs[_0x9baf('0x2b')](_0x385bfc[_0x9baf('0x43')][_0x9baf('0x2b')]);}_0x6c715b[_0x9baf('0x49')]=qs[_0x9baf('0x4a')](_0x385bfc[_0x9baf('0x43')][_0x9baf('0x4a')]);_0x6c715b[_0x9baf('0x4b')]=qs[_0x9baf('0x4c')](_['pick'](_0x385bfc[_0x9baf('0x43')],_0x38eb7c['filters']));_0x6c715b['where'][_0x9baf('0x66')]=_0x4b9adf['id'];if(_0x385bfc[_0x9baf('0x43')]['filter']){_0x6c715b[_0x9baf('0x4b')]=_[_0x9baf('0x4f')](_0x6c715b[_0x9baf('0x4b')],{'$or':_[_0x9baf('0x42')](_0x6c715b[_0x9baf('0x46')],function(_0x1bac09){var _0x33c8fc={};_0x33c8fc[_0x1bac09]={'$like':'%'+_0x385bfc[_0x9baf('0x43')][_0x9baf('0x4e')]+'%'};return _0x33c8fc;})});}_0x6c715b=_['merge']({},_0x6c715b,_0x385bfc[_0x9baf('0x58')]);return db[_0x9baf('0x6c')]['count']({'where':_0x6c715b[_0x9baf('0x4b')]})[_0x9baf('0x1e')](function(_0x3f5656){_0x9e48a3[_0x9baf('0x2d')]=_0x3f5656;if(_0x385bfc[_0x9baf('0x43')][_0x9baf('0x52')]){_0x6c715b[_0x9baf('0x53')]=[{'all':!![]}];}return db[_0x9baf('0x6c')]['findAll'](_0x6c715b);})['then'](function(_0x1d14e2){_0x9e48a3[_0x9baf('0x54')]=_0x1d14e2;return _0x9e48a3;});}})[_0x9baf('0x1e')](respondWithFilteredResult(_0x58a17d,_0x6c715b))[_0x9baf('0x27')](handleError(_0x58a17d,null));};exports[_0x9baf('0x6f')]=function(_0xf3de2f,_0x2eb0e3,_0x45dc6a){return db['WhatsappAccount'][_0x9baf('0x59')]({'where':{'id':_0xf3de2f[_0x9baf('0x56')]['id']}})['then'](handleEntityNotFound(_0x2eb0e3,null))['then'](function(_0x167736){if(_0x167736){return _0x167736['removeAnswers'](_0xf3de2f['query'][_0x9baf('0x70')]);}})[_0x9baf('0x1e')](respondWithStatusCode(_0x2eb0e3,null))[_0x9baf('0x27')](handleError(_0x2eb0e3,null));};exports['addAgents']=function(_0x33a6ee,_0x54c914,_0x4ffddc){return db['WhatsappAccount'][_0x9baf('0x59')]({'where':{'id':_0x33a6ee[_0x9baf('0x56')]['id']}})[_0x9baf('0x1e')](handleEntityNotFound(_0x54c914,null))['then'](function(_0x528ff7){if(_0x528ff7){return _0x528ff7[_0x9baf('0x71')](_0x33a6ee[_0x9baf('0x5b')][_0x9baf('0x70')],_[_0x9baf('0x72')](_0x33a6ee[_0x9baf('0x5b')],[_0x9baf('0x70'),'id'])||{})[_0x9baf('0x73')](function(_0x4437f5){for(var _0x165d78=0x0;_0x165d78<_0x33a6ee[_0x9baf('0x5b')]['ids'][_0x9baf('0x47')];_0x165d78+=0x1){socket[_0x9baf('0x74')](_0x9baf('0x75'),{'UserId':Number(_0x33a6ee['body'][_0x9baf('0x70')][_0x165d78]),'WhatsappAccountId':Number(_0x33a6ee[_0x9baf('0x56')]['id'])});}return _0x4437f5;});}})[_0x9baf('0x1e')](respondWithResult(_0x54c914,null))[_0x9baf('0x27')](handleError(_0x54c914,null));};exports['removeAgents']=function(_0x502100,_0x82bf,_0x16c8eb){return db[_0x9baf('0x51')][_0x9baf('0x59')]({'where':{'id':_0x502100['params']['id']}})['then'](handleEntityNotFound(_0x82bf,null))[_0x9baf('0x1e')](function(_0x4db056){if(_0x4db056){return _0x4db056[_0x9baf('0x76')](_0x502100[_0x9baf('0x43')]['ids'])[_0x9baf('0x1e')](function(){if(_[_0x9baf('0x77')](_0x502100['query']['ids'])){for(var _0x509a93=0x0;_0x509a93<_0x502100[_0x9baf('0x43')][_0x9baf('0x70')][_0x9baf('0x47')];_0x509a93+=0x1){socket[_0x9baf('0x74')](_0x9baf('0x78'),{'UserId':Number(_0x502100[_0x9baf('0x43')][_0x9baf('0x70')][_0x509a93]),'WhatsappAccountId':Number(_0x502100[_0x9baf('0x56')]['id'])});}}else{socket[_0x9baf('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x502100[_0x9baf('0x43')][_0x9baf('0x70')]),'WhatsappAccountId':Number(_0x502100[_0x9baf('0x56')]['id'])});}});}})[_0x9baf('0x1e')](respondWithStatusCode(_0x82bf,null))[_0x9baf('0x27')](handleError(_0x82bf,null));};exports['getAgents']=function(_0x2aedf7,_0x1062af,_0x2dad01){var _0x3fd2ec={};var _0x64f028={};var _0x16bc02;var _0x1866f7;return db[_0x9baf('0x51')]['findOne']({'where':{'id':_0x2aedf7[_0x9baf('0x56')]['id']}})[_0x9baf('0x1e')](handleEntityNotFound(_0x1062af,null))[_0x9baf('0x1e')](function(_0x4c5135){if(_0x4c5135){_0x16bc02=_0x4c5135;_0x64f028[_0x9baf('0x41')]=_[_0x9baf('0x44')](db[_0x9baf('0x79')][_0x9baf('0x3e')]);_0x64f028[_0x9baf('0x43')]=_[_0x9baf('0x44')](_0x2aedf7[_0x9baf('0x43')]);_0x64f028[_0x9baf('0x4c')]=_[_0x9baf('0x57')](_0x64f028[_0x9baf('0x41')],_0x64f028[_0x9baf('0x43')]);_0x3fd2ec[_0x9baf('0x46')]=_[_0x9baf('0x57')](_0x64f028[_0x9baf('0x41')],qs[_0x9baf('0x45')](_0x2aedf7[_0x9baf('0x43')][_0x9baf('0x45')]));_0x3fd2ec[_0x9baf('0x46')]=_0x3fd2ec[_0x9baf('0x46')][_0x9baf('0x47')]?_0x3fd2ec[_0x9baf('0x46')]:_0x64f028[_0x9baf('0x41')];_0x3fd2ec['order']=qs['sort'](_0x2aedf7[_0x9baf('0x43')][_0x9baf('0x4a')]);_0x3fd2ec[_0x9baf('0x4b')]=qs[_0x9baf('0x4c')](_['pick'](_0x2aedf7[_0x9baf('0x43')],_0x64f028[_0x9baf('0x4c')]));if(_0x2aedf7[_0x9baf('0x43')][_0x9baf('0x4e')]){_0x3fd2ec[_0x9baf('0x4b')]=_[_0x9baf('0x4f')](_0x3fd2ec[_0x9baf('0x4b')],{'$or':_['map'](_0x3fd2ec[_0x9baf('0x46')],function(_0x57ede2){var _0x3e1c7d={};_0x3e1c7d[_0x57ede2]={'$like':'%'+_0x2aedf7['query'][_0x9baf('0x4e')]+'%'};return _0x3e1c7d;})});}_0x3fd2ec=_[_0x9baf('0x4f')]({},_0x3fd2ec,_0x2aedf7[_0x9baf('0x58')]);return _0x16bc02['getAgents'](_0x3fd2ec);}})[_0x9baf('0x1e')](function(_0x271be1){if(_0x271be1){_0x1866f7=_0x271be1['length'];if(!_0x2aedf7[_0x9baf('0x43')][_0x9baf('0x6e')](_0x9baf('0x48'))){_0x3fd2ec[_0x9baf('0x2e')]=qs['limit'](_0x2aedf7[_0x9baf('0x43')][_0x9baf('0x2e')]);_0x3fd2ec[_0x9baf('0x2b')]=qs[_0x9baf('0x2b')](_0x2aedf7[_0x9baf('0x43')][_0x9baf('0x2b')]);}return _0x16bc02[_0x9baf('0x7a')](_0x3fd2ec);}})[_0x9baf('0x1e')](function(_0x4cef63){if(_0x4cef63){return _0x4cef63?{'count':_0x1866f7,'rows':_0x4cef63}:null;}})[_0x9baf('0x1e')](respondWithResult(_0x1062af,null))[_0x9baf('0x27')](handleError(_0x1062af,null));};exports[_0x9baf('0x7b')]=function(_0x4f8dc1,_0xd17322){var _0x328d1c=_0x4f8dc1[_0x9baf('0x56')]['id'];var _0x5e3d9f=_0x4f8dc1[_0x9baf('0x5b')];var _0x414171=0xc8;var _0x1ffe02=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x9baf('0x7c')][_0x9baf('0x7d')][_0x9baf('0x7e')][_0x9baf('0x7f')]},function(_0x20c732){return db[_0x9baf('0x51')][_0x9baf('0x69')]({'where':{'id':_0x328d1c},'transaction':_0x20c732})['then'](function(_0x2a87fb){if(_0x2a87fb){return db[_0x9baf('0x80')][_0x9baf('0x35')]({'where':{'WhatsappAccountId':_0x328d1c},'transaction':_0x20c732})['then'](function(){var _0x257ac5=_[_0x9baf('0x42')](_0x5e3d9f,function(_0x1d8bb7){_0x1d8bb7[_0x9baf('0x66')]=_0x328d1c;return _0x1d8bb7;});return db[_0x9baf('0x80')][_0x9baf('0x81')](_0x257ac5,{'transaction':_0x20c732});});}else{_0x414171=0x194;_0x1ffe02=[];}});})[_0x9baf('0x1e')](function(){if(_0x414171!==0x194){return db[_0x9baf('0x80')][_0x9baf('0x82')]({'where':{'WhatsappAccountId':_0x328d1c},'order':'priority'})[_0x9baf('0x1e')](function(_0x50ac1f){_0x1ffe02=_0x50ac1f;});}})[_0x9baf('0x27')](function(_0x27b0bb){_0x414171=0x1f4;logger[_0x9baf('0x23')](_0x27b0bb[_0x9baf('0x39')]);if(_0x27b0bb[_0x9baf('0x3a')]){delete _0x27b0bb[_0x9baf('0x3a')];}_0x1ffe02=_0x27b0bb;})['finally'](function(){if(_0x1ffe02===null){_0xd17322[_0x9baf('0x28')](_0x414171);}else{if(_0x414171===0x1f4){_0xd17322['status'](_0x414171)[_0x9baf('0x3b')](_0x1ffe02);}else{_0xd17322[_0x9baf('0x29')](_0x414171)[_0x9baf('0x2a')](_0x1ffe02);}}});};exports[_0x9baf('0x83')]=function(_0x517ef6,_0x5c0930,_0x27549f){var _0x5ea070={};var _0x37449a={};var _0x4fcf9b;var _0x5604e5;return db[_0x9baf('0x51')][_0x9baf('0x69')]({'where':{'id':_0x517ef6['params']['id']}})[_0x9baf('0x1e')](handleEntityNotFound(_0x5c0930,null))[_0x9baf('0x1e')](function(_0xf1864b){if(_0xf1864b){_0x4fcf9b=_0xf1864b;_0x37449a[_0x9baf('0x41')]=_['keys'](db[_0x9baf('0x80')][_0x9baf('0x3e')]);_0x37449a['query']=_[_0x9baf('0x44')](_0x517ef6[_0x9baf('0x43')]);_0x37449a[_0x9baf('0x4c')]=_[_0x9baf('0x57')](_0x37449a[_0x9baf('0x41')],_0x37449a[_0x9baf('0x43')]);_0x5ea070['attributes']=_[_0x9baf('0x57')](_0x37449a[_0x9baf('0x41')],qs[_0x9baf('0x45')](_0x517ef6[_0x9baf('0x43')][_0x9baf('0x45')]));_0x5ea070[_0x9baf('0x46')]=_0x5ea070['attributes']['length']?_0x5ea070[_0x9baf('0x46')]:_0x37449a[_0x9baf('0x41')];_0x5ea070[_0x9baf('0x49')]=qs[_0x9baf('0x4a')](_0x517ef6['query'][_0x9baf('0x4a')]);_0x5ea070['where']=qs[_0x9baf('0x4c')](_[_0x9baf('0x4d')](_0x517ef6[_0x9baf('0x43')],_0x37449a[_0x9baf('0x4c')]));if(_0x517ef6[_0x9baf('0x43')][_0x9baf('0x4e')]){_0x5ea070[_0x9baf('0x4b')]=_['merge'](_0x5ea070[_0x9baf('0x4b')],{'$or':_[_0x9baf('0x42')](_0x5ea070[_0x9baf('0x46')],function(_0x41f365){var _0x12dc61={};_0x12dc61[_0x41f365]={'$like':'%'+_0x517ef6[_0x9baf('0x43')]['filter']+'%'};return _0x12dc61;})});}_0x5ea070=_['merge']({},_0x5ea070,_0x517ef6[_0x9baf('0x58')]);return _0x4fcf9b[_0x9baf('0x83')](_0x5ea070);}})[_0x9baf('0x1e')](function(_0x525448){if(_0x525448){_0x5604e5=_0x525448[_0x9baf('0x47')];if(!_0x517ef6[_0x9baf('0x43')]['hasOwnProperty']('nolimit')){_0x5ea070['limit']=qs[_0x9baf('0x2e')](_0x517ef6[_0x9baf('0x43')][_0x9baf('0x2e')]);_0x5ea070[_0x9baf('0x2b')]=qs['offset'](_0x517ef6[_0x9baf('0x43')][_0x9baf('0x2b')]);}return _0x4fcf9b[_0x9baf('0x83')](_0x5ea070);}})[_0x9baf('0x1e')](function(_0x10b7f3){if(_0x10b7f3){return _0x10b7f3?{'count':_0x5604e5,'rows':_0x10b7f3}:null;}})[_0x9baf('0x1e')](respondWithResult(_0x5c0930,null))['catch'](handleError(_0x5c0930,null));};exports[_0x9baf('0x84')]=function(_0x549d98,_0x16c9b8,_0x507817){var _0x6c4474={'channel':'whatsapp'};var _0x54bab1=[];var _0x32c9ef=[];var _0x3cb6d4={};return db['WhatsappAccount'][_0x9baf('0x59')]({'where':{'id':_0x549d98[_0x9baf('0x56')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x9baf('0x85')}]})[_0x9baf('0x1e')](handleEntityNotFound(_0x16c9b8,null))['then'](function(_0x1341e7){_0x6c4474[_0x9baf('0x86')]=_0x1341e7;if(_0x6c4474[_0x9baf('0x86')]&&_0x6c4474['account']['type']==='sinch'&&_0x549d98[_0x9baf('0x5b')][_0x9baf('0x87')]){if(_0x549d98['body'][_0x9baf('0x87')][_0x9baf('0x47')]===0x0)return;if(_0x549d98['body']['statuses'][0x0]['state']!==_0x9baf('0x88'))return;return db[_0x9baf('0x89')][_0x9baf('0x34')]({'read':!![],'readAt':_0x549d98[_0x9baf('0x5b')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x549d98[_0x9baf('0x5b')][_0x9baf('0x87')][0x0][_0x9baf('0x8a')]},'individualHooks':!![]})[_0x9baf('0x1e')](function(_0x56df7b){return _0x16c9b8['status'](0xc8)['json'](_0x56df7b);});}_0x6c4474['applications']=_[_0x9baf('0x8b')](_0x1341e7['Applications'],[_0x9baf('0x8c')],['asc']);if(_0x6c4474[_0x9baf('0x86')][_0x9baf('0x85')]){delete _0x6c4474[_0x9baf('0x86')]['Applications'];}return db[_0x9baf('0x8d')][_0x9baf('0x64')]()['then'](function(_0x1c1024){if(!_0x1c1024){throw new db['Sequelize'][(_0x9baf('0x8e'))](_0x9baf('0x8f'));}_0x54bab1=_['difference'](_['keys'](_0x1c1024),[_0x9baf('0x90'),_0x9baf('0x91')]);_0x32c9ef=_[_0x9baf('0x92')](_[_0x9baf('0x44')](_0x1c1024),[_0x9baf('0x90'),'updatedAt',_0x9baf('0x93'),'ListId']);_0x6c4474['body']={'mapKey':_0x9baf('0x94')};if(_0x6c4474[_0x9baf('0x86')]&&_0x6c4474[_0x9baf('0x86')][_0x9baf('0x40')]===_0x9baf('0x95')){_0x6c4474['body'][_0x9baf('0x96')]=_0x549d98[_0x9baf('0x5b')][_0x9baf('0x97')]['replace']('whatsapp:','');_0x6c4474[_0x9baf('0x5b')][_0x9baf('0x5b')]=_0x549d98[_0x9baf('0x5b')]['Body'];_0x6c4474[_0x9baf('0x5b')][_0x9baf('0x98')]=_0x549d98[_0x9baf('0x5b')][_0x9baf('0x99')];}if(_0x6c4474[_0x9baf('0x86')]&&_0x6c4474[_0x9baf('0x86')][_0x9baf('0x40')]===_0x9baf('0x9a')){_0x6c4474[_0x9baf('0x5b')][_0x9baf('0x96')]=_0x549d98['body']['notifications'][0x0][_0x9baf('0x96')];_0x6c4474['body'][_0x9baf('0x5b')]=_0x549d98[_0x9baf('0x5b')][_0x9baf('0x9b')][0x0][_0x9baf('0x25')][_0x9baf('0x5b')];_0x6c4474[_0x9baf('0x5b')][_0x9baf('0x98')]=_0x549d98[_0x9baf('0x5b')][_0x9baf('0x9b')][0x0]['message_id'];}if(_0x6c4474[_0x9baf('0x5b')]['id']){delete _0x6c4474['body']['id'];}if(_[_0x9baf('0x9c')](_0x6c4474[_0x9baf('0x5b')][_0x9baf('0x96')])){throw new db[(_0x9baf('0x9d'))][(_0x9baf('0x8e'))](_0x9baf('0x9e'));}if(_['isNil'](_0x6c4474[_0x9baf('0x5b')][_0x9baf('0x5b')])||_0x6c4474['body'][_0x9baf('0x5b')]===''){throw new db['Sequelize'][(_0x9baf('0x8e'))](_0x9baf('0x9f'));}if(_[_0x9baf('0x9c')](_0x6c4474[_0x9baf('0x5b')][_0x9baf('0xa0')])){throw new db['Sequelize']['ValidationError'](_0x9baf('0xa1')+_0x32c9ef);}if(!_['includes'](_0x32c9ef,_0x6c4474['body'][_0x9baf('0xa0')])){throw new db[(_0x9baf('0x9d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32c9ef);}_0x3cb6d4[_0x6c4474[_0x9baf('0x5b')][_0x9baf('0xa0')]]=_0x6c4474[_0x9baf('0x5b')][_0x9baf('0x96')];return db[_0x9baf('0xa2')][_0x9baf('0x59')]({'where':{'id':_0x6c4474[_0x9baf('0x86')][_0x9baf('0xa3')]},'include':[{'model':db[_0x9baf('0x8d')],'as':'Contacts','where':_0x3cb6d4,'limit':0x1,'order':[[_0x9baf('0x91'),_0x9baf('0xa4')]]}]});})['then'](handleEntityNotFound(_0x16c9b8,null))[_0x9baf('0x1e')](function(_0x591f38){if(_0x591f38){_0x6c4474['list']=_[_0x9baf('0x72')](_0x591f38,['Contacts']);if(_0x591f38[_0x9baf('0xa5')][_0x9baf('0x47')]){return _0x591f38['Contacts'][0x0];}var _0x1859ef=_['defaults'](_0x6c4474['body'],{'firstName':_0x6c4474[_0x9baf('0x5b')][_0x9baf('0x96')],'ListId':_0x591f38['id']});_0x1859ef[_0x6c4474[_0x9baf('0x5b')][_0x9baf('0xa0')]]=_0x6c4474['body'][_0x9baf('0x96')];return db['CmContact'][_0x9baf('0x5a')](_0x1859ef,{'fields':_0x54bab1,'raw':!![]});}})['then'](handleEntityNotFound(_0x16c9b8,null))[_0x9baf('0x1e')](function(_0x183c02){if(_0x183c02){_0x6c4474[_0x9baf('0xa6')]=_0x183c02;var _0x4e706c={'ContactId':_0x183c02['id'],'phone':_0x6c4474[_0x9baf('0x5b')]['from'],'WhatsappAccountId':_0x549d98['params']['id']};var _0x148a5c={'ContactId':_0x183c02['id'],'WhatsappAccountId':_0x549d98['params']['id'],'closed':![]};return db[_0x9baf('0xa7')][_0x9baf('0x59')]({'where':_0x148a5c})['then'](function(_0x3bdea1){if(_0x3bdea1){return[_0x3bdea1,![]];}return db[_0x9baf('0xa7')][_0x9baf('0x5a')](_0x4e706c)['then'](function(_0x348962){return[_0x348962,!![]];});});}})['spread'](function(_0x97116b,_0xca69a2){_0x6c4474[_0x9baf('0xa8')]=_0x97116b[_0x9baf('0x36')]({'plain':!![]});_0x6c4474[_0x9baf('0xa8')][_0x9baf('0xa9')]=![];if(_0xca69a2){if(_0x6c4474[_0x9baf('0x86')][_0x9baf('0xaa')]){_0x6c4474[_0x9baf('0xab')][_0x9baf('0xac')]({'id':0x0,'priority':_0x6c4474[_0x9baf('0xab')][_0x9baf('0x47')]+0x1,'app':_0x9baf('0xad'),'appdata':_0x9baf('0xae'),'interval':_0x9baf('0xaf')});}_0x6c4474[_0x9baf('0xa8')][_0x9baf('0xa9')]=!![];}return db[_0x9baf('0x89')][_0x9baf('0x5a')]({'phone':_0x6c4474['body'][_0x9baf('0x96')],'messageId':_0x6c4474[_0x9baf('0x5b')][_0x9baf('0x98')],'body':_0x6c4474[_0x9baf('0x5b')][_0x9baf('0x5b')],'WhatsappAccountId':_0x549d98[_0x9baf('0x56')]['id'],'WhatsappInteractionId':_0x97116b['id'],'direction':'in','ContactId':_0x97116b[_0x9baf('0xb0')],'AttachmentId':_0x6c4474[_0x9baf('0x5b')][_0x9baf('0xb1')]});})['then'](function(_0x10373d){_0x6c4474[_0x9baf('0x25')]=_0x10373d;if(_0x6c4474[_0x9baf('0xa8')][_0x9baf('0xb2')]){return db[_0x9baf('0x79')]['find']({'attributes':['id',_0x9baf('0x3a')],'where':{'id':_0x6c4474[_0x9baf('0xa8')][_0x9baf('0xb2')]}})[_0x9baf('0x1e')](function(_0x331c3e){if(_0x331c3e){_0x6c4474[_0x9baf('0xab')][_0x9baf('0xb3')]({'id':0x0,'priority':0x0,'app':_0x9baf('0xb4'),'appdata':_0x331c3e['name']+','+(_0x6c4474[_0x9baf('0x86')][_0x9baf('0xb5')]||0xa),'interval':_0x9baf('0xaf')});}return respondWithRpcPromise(_0x9baf('0xb6'),_0x9baf('0xb7'),_0x6c4474);});}return respondWithRpcPromise('Start',_0x9baf('0xb7'),_0x6c4474);})['then'](function(_0x488811){if(_0x488811){var _0x2dedd8=0xc8;var _0x4f3309='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4f3309,_0x2dedd8,_0x9baf('0xb8'));logger[_0x9baf('0x20')](_0x9baf('0xb9'),_0x4f3309,_0x2dedd8,_0x9baf('0xb8'),JSON[_0x9baf('0x22')](_0x488811));if(_0x6c4474[_0x9baf('0x86')][_0x9baf('0x40')]===_0x9baf('0x95')){return _0x16c9b8['status'](_0x2dedd8)['set'](_0x9baf('0xba'),'text/xml')[_0x9baf('0x3b')]('\x0a');}else{return _0x16c9b8[_0x9baf('0x29')](_0x2dedd8)[_0x9baf('0x2a')](_0x488811);}}});})['catch'](handleError(_0x16c9b8,null));};exports[_0x9baf('0x3b')]=function(_0xf61a4,_0x47cab6,_0x23eccd){var _0x55e195,_0x5a4bda,_0x352f9f;if(_[_0x9baf('0x9c')](_0xf61a4[_0x9baf('0x5b')]['body'])||_0xf61a4[_0x9baf('0x5b')][_0x9baf('0x5b')]===''){throw new db[(_0x9baf('0x9d'))][(_0x9baf('0x8e'))](_0x9baf('0x9f'));}if(_['isNil'](_0xf61a4['body']['to'])){throw new db[(_0x9baf('0x9d'))][(_0x9baf('0x8e'))](_0x9baf('0xbb'));}_0x55e195=_0xf61a4[_0x9baf('0x5b')]['to'];return db[_0x9baf('0x51')][_0x9baf('0x59')]({'where':{'id':_0xf61a4['params']['id']},'include':[{'model':db[_0x9baf('0xa2')],'as':'List','include':[{'model':db['CmContact'],'as':_0x9baf('0xa5'),'where':{'mobile':_0x55e195},'limit':0x1,'order':[[_0x9baf('0x91'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x47cab6,null))[_0x9baf('0x1e')](function(_0x1012b6){if(_0x1012b6&&_0x1012b6['List']){_0x5a4bda=_0x1012b6[_0x9baf('0x36')]({'plain':!![]});if(_0x5a4bda[_0x9baf('0xbc')]&&_0x5a4bda['List'][_0x9baf('0xa5')][_0x9baf('0x47')]){return _0x5a4bda[_0x9baf('0xbc')]['Contacts'][0x0];}return db[_0x9baf('0x8d')]['create'](_['defaults'](_0xf61a4[_0x9baf('0x5b')],{'firstName':_0x55e195,'mobile':_0x55e195,'phone':_0x55e195,'ListId':_0x5a4bda[_0x9baf('0xa3')]}));}})[_0x9baf('0x1e')](handleEntityNotFound(_0x47cab6,null))[_0x9baf('0x1e')](function(_0x4c144f){if(_0x4c144f){_0x352f9f=_0x4c144f;return db[_0x9baf('0xa7')][_0x9baf('0x59')]({'where':{'ContactId':_0x352f9f['id'],'closed':![],'WhatsappAccountId':_0x5a4bda['id']}})[_0x9baf('0x1e')](function(_0x33dbab){if(_0x33dbab){return[_0x33dbab,![]];}return db[_0x9baf('0xa7')][_0x9baf('0x5a')]({'UserId':_0xf61a4[_0x9baf('0x5c')]['id'],'ContactId':_0x352f9f['id'],'WhatsappAccountId':_0x5a4bda['id'],'phone':_0x55e195,'firstMsgDirection':_0x9baf('0xbd'),'Messages':[_[_0x9baf('0x4f')](_0xf61a4[_0x9baf('0x5b')],{'read':![],'body':_0xf61a4[_0x9baf('0x5b')][_0x9baf('0x5b')],'phone':_0x55e195,'WhatsappAccountId':_0x5a4bda['id'],'UserId':_0xf61a4['user']['id'],'ContactId':_0x352f9f['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x9baf('0xbe')}]})['then'](function(_0x18d283){return[_0x18d283,!![]];});});}})[_0x9baf('0x73')](function(_0x30c157,_0x11883e){if(_0x11883e){return _0x30c157;}return db[_0x9baf('0x89')][_0x9baf('0x5a')](_[_0x9baf('0x4f')](_0xf61a4[_0x9baf('0x5b')],{'read':![],'body':_0xf61a4[_0x9baf('0x5b')][_0x9baf('0x5b')],'phone':_0x55e195,'WhatsappAccountId':_0x5a4bda['id'],'WhatsappInteractionId':_0x30c157['id'],'UserId':_0xf61a4['user']['id'],'ContactId':_0x352f9f['id']}))[_0x9baf('0x1e')](function(_0x117705){_0x30c157[_0x9baf('0xbf')][_0x9baf('0xbe')]=[];_0x30c157[_0x9baf('0xbf')][_0x9baf('0xbe')][_0x9baf('0xac')](_0x117705['dataValues']);return _0x30c157;});})[_0x9baf('0x1e')](respondWithResult(_0x47cab6,null))[_0x9baf('0x27')](handleError(_0x47cab6,null));}; \ No newline at end of file +var _0xf4c1=['map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','model','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','isArray','emit','userWhatsappAccount:remove','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','*,*,*,*','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key'];(function(_0x4fadc6,_0x4a76ec){var _0x1ee63c=function(_0x43f485){while(--_0x43f485){_0x4fadc6['push'](_0x4fadc6['shift']());}};_0x1ee63c(++_0x4a76ec);}(_0xf4c1,0x82));var _0x1f4c=function(_0x5b2783,_0x1f3362){_0x5b2783=_0x5b2783-0x0;var _0x74bfee=_0xf4c1[_0x5b2783];return _0x74bfee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f4c('0x0'));var rp=require(_0x1f4c('0x1'));var moment=require(_0x1f4c('0x2'));var BPromise=require(_0x1f4c('0x3'));var Mustache=require(_0x1f4c('0x4'));var util=require(_0x1f4c('0x5'));var path=require(_0x1f4c('0x6'));var sox=require(_0x1f4c('0x7'));var csv=require(_0x1f4c('0x8'));var ejs=require(_0x1f4c('0x9'));var fs=require('fs');var fs_extra=require(_0x1f4c('0xa'));var _=require(_0x1f4c('0xb'));var squel=require(_0x1f4c('0xc'));var crypto=require(_0x1f4c('0xd'));var jsforce=require(_0x1f4c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1f4c('0xf'));var Papa=require(_0x1f4c('0x10'));var Redis=require(_0x1f4c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f4c('0x12'));var logger=require('../../config/logger')(_0x1f4c('0x13'));var utils=require(_0x1f4c('0x14'));var config=require(_0x1f4c('0x15'));var licenseUtil=require(_0x1f4c('0x16'));var db=require(_0x1f4c('0x17'))['db'];config[_0x1f4c('0x18')]=_['defaults'](config['redis'],{'host':_0x1f4c('0x19'),'port':0x18eb});var socket=require(_0x1f4c('0x1a'))(new Redis(config[_0x1f4c('0x18')]));require('./whatsappAccount.socket')[_0x1f4c('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1f4c('0x1c')][_0x1f4c('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x369225,_0x2ada7b,_0x53e6df,_0x3dd2b2){return new BPromise(function(_0x116d44,_0x1185ca){var _0x2272fc=_0x3dd2b2||client;return _0x2272fc[_0x1f4c('0x1e')](_0x369225,_0x53e6df)[_0x1f4c('0x1f')](function(_0x42c180){logger['info'](_0x1f4c('0x20'),_0x2ada7b,'request\x20sent');logger[_0x1f4c('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2ada7b,'request\x20sent',JSON[_0x1f4c('0x22')](_0x42c180));if(_0x42c180['error']){if(_0x42c180[_0x1f4c('0x23')][_0x1f4c('0x24')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2ada7b,_0x42c180[_0x1f4c('0x23')][_0x1f4c('0x25')]);return _0x1185ca(_0x42c180['error']['message']);}logger['error'](_0x1f4c('0x20'),_0x2ada7b,_0x42c180['error']['message']);return _0x116d44(_0x42c180[_0x1f4c('0x23')]['message']);}else{logger[_0x1f4c('0x26')](_0x1f4c('0x20'),_0x2ada7b,_0x1f4c('0x27'));_0x116d44(_0x42c180['result'][_0x1f4c('0x25')]);}})[_0x1f4c('0x28')](function(_0x24e98d){logger[_0x1f4c('0x23')](_0x1f4c('0x20'),_0x2ada7b,_0x24e98d);_0x1185ca(_0x24e98d);});});}function respondWithStatusCode(_0x3dc3e2,_0x265652){_0x265652=_0x265652||0xcc;return function(_0xfd72d0){if(_0xfd72d0){return _0x3dc3e2[_0x1f4c('0x29')](_0x265652);}return _0x3dc3e2['status'](_0x265652)[_0x1f4c('0x2a')]();};}function respondWithResult(_0xa8ae46,_0x50a324){_0x50a324=_0x50a324||0xc8;return function(_0x4f9382){if(_0x4f9382){return _0xa8ae46['status'](_0x50a324)[_0x1f4c('0x2b')](_0x4f9382);}};}function respondWithFilteredResult(_0x3ae511,_0x14091b){return function(_0x4d2f3f){if(_0x4d2f3f){var _0x433395=typeof _0x14091b[_0x1f4c('0x2c')]===_0x1f4c('0x2d')&&typeof _0x14091b[_0x1f4c('0x2e')]===_0x1f4c('0x2d');var _0x33d1a0=_0x4d2f3f[_0x1f4c('0x2f')];var _0x47aba4=_0x433395?0x0:_0x14091b['offset'];var _0x43fce7=_0x433395?_0x4d2f3f[_0x1f4c('0x2f')]:_0x14091b['offset']+_0x14091b[_0x1f4c('0x2e')];var _0x4fda29;if(_0x43fce7>=_0x33d1a0){_0x43fce7=_0x33d1a0;_0x4fda29=0xc8;}else{_0x4fda29=0xce;}_0x3ae511[_0x1f4c('0x30')](_0x4fda29);return _0x3ae511[_0x1f4c('0x31')](_0x1f4c('0x32'),_0x47aba4+'-'+_0x43fce7+'/'+_0x33d1a0)[_0x1f4c('0x2b')](_0x4d2f3f);}return null;};}function patchUpdates(_0x58f8a1){return function(_0x2e94d5){try{jsonpatch[_0x1f4c('0x33')](_0x2e94d5,_0x58f8a1,!![]);}catch(_0x11e3ea){return BPromise[_0x1f4c('0x34')](_0x11e3ea);}return _0x2e94d5[_0x1f4c('0x35')]();};}function saveUpdates(_0x5c286e,_0x57bcb3){return function(_0x3858cb){if(_0x3858cb){return _0x3858cb[_0x1f4c('0x36')](_0x5c286e)[_0x1f4c('0x1f')](function(_0xc5d5ec){return _0xc5d5ec;});}return null;};}function removeEntity(_0x3f1679,_0x48845b){return function(_0x57b829){if(_0x57b829){return _0x57b829[_0x1f4c('0x37')]()[_0x1f4c('0x1f')](function(){var _0x479dfe=_0x57b829[_0x1f4c('0x38')]({'plain':!![]});var _0x6523f1='WhatsappAccounts';return db[_0x1f4c('0x39')][_0x1f4c('0x37')]({'where':{'type':_0x6523f1,'resourceId':_0x479dfe['id']}})['then'](function(){return _0x57b829;});})[_0x1f4c('0x1f')](function(){_0x3f1679[_0x1f4c('0x30')](0xcc)[_0x1f4c('0x2a')]();});}};}function handleEntityNotFound(_0x3ef7d1,_0x35d2b4){return function(_0x323a10){if(!_0x323a10){_0x3ef7d1[_0x1f4c('0x29')](0x194);}return _0x323a10;};}function handleError(_0x157250,_0x1faad5){_0x1faad5=_0x1faad5||0x1f4;return function(_0x2c8aca){logger[_0x1f4c('0x23')](_0x2c8aca[_0x1f4c('0x3a')]);if(_0x2c8aca[_0x1f4c('0x3b')]){delete _0x2c8aca[_0x1f4c('0x3b')];}_0x157250[_0x1f4c('0x30')](_0x1faad5)[_0x1f4c('0x3c')](_0x2c8aca);};}exports[_0x1f4c('0x3d')]=function(_0x57207d,_0x26847c){var _0x1608d4={'include':[{'model':db[_0x1f4c('0x3e')],'as':_0x1f4c('0x3f')}]},_0x337464={},_0x4fd811={'count':0x0,'rows':[]};var _0x5b091d=_['map'](db[_0x1f4c('0x40')][_0x1f4c('0x41')],function(_0xb3e5b0){return{'name':_0xb3e5b0[_0x1f4c('0x42')],'type':_0xb3e5b0[_0x1f4c('0x43')][_0x1f4c('0x44')]};});_0x337464['model']=_[_0x1f4c('0x45')](_0x5b091d,_0x1f4c('0x3b'));_0x337464[_0x1f4c('0x46')]=_[_0x1f4c('0x47')](_0x57207d[_0x1f4c('0x46')]);_0x337464[_0x1f4c('0x48')]=_[_0x1f4c('0x49')](_0x337464['model'],_0x337464[_0x1f4c('0x46')]);_0x1608d4[_0x1f4c('0x4a')]=_['intersection'](_0x337464['model'],qs['fields'](_0x57207d[_0x1f4c('0x46')]['fields']));_0x1608d4['attributes']=_0x1608d4[_0x1f4c('0x4a')][_0x1f4c('0x4b')]?_0x1608d4[_0x1f4c('0x4a')]:_0x337464['model'];if(!_0x57207d[_0x1f4c('0x46')][_0x1f4c('0x4c')](_0x1f4c('0x4d'))){_0x1608d4[_0x1f4c('0x2e')]=qs[_0x1f4c('0x2e')](_0x57207d['query']['limit']);_0x1608d4[_0x1f4c('0x2c')]=qs[_0x1f4c('0x2c')](_0x57207d['query'][_0x1f4c('0x2c')]);}_0x1608d4[_0x1f4c('0x4e')]=qs[_0x1f4c('0x4f')](_0x57207d['query'][_0x1f4c('0x4f')]);_0x1608d4[_0x1f4c('0x50')]=qs['filters'](_[_0x1f4c('0x51')](_0x57207d[_0x1f4c('0x46')],_0x337464[_0x1f4c('0x48')]),_0x5b091d);if(_0x57207d[_0x1f4c('0x46')][_0x1f4c('0x52')]){_0x1608d4[_0x1f4c('0x50')]=_[_0x1f4c('0x53')](_0x1608d4[_0x1f4c('0x50')],{'$or':_[_0x1f4c('0x45')](_0x5b091d,function(_0x326cea){if(_0x326cea[_0x1f4c('0x43')]!==_0x1f4c('0x54')){var _0x36ae04={};_0x36ae04[_0x326cea[_0x1f4c('0x3b')]]={'$like':'%'+_0x57207d[_0x1f4c('0x46')][_0x1f4c('0x52')]+'%'};return _0x36ae04;}})});}_0x1608d4=_[_0x1f4c('0x53')]({},_0x1608d4,_0x57207d[_0x1f4c('0x55')]);var _0x86709={'where':_0x1608d4[_0x1f4c('0x50')]};return db['WhatsappAccount']['count'](_0x86709)[_0x1f4c('0x1f')](function(_0x5641bd){_0x4fd811[_0x1f4c('0x2f')]=_0x5641bd;if(_0x57207d[_0x1f4c('0x46')][_0x1f4c('0x56')]){_0x1608d4[_0x1f4c('0x57')]=[{'all':!![]}];}return db[_0x1f4c('0x40')][_0x1f4c('0x58')](_0x1608d4);})['then'](function(_0x1cd780){_0x4fd811[_0x1f4c('0x59')]=_0x1cd780;return _0x4fd811;})[_0x1f4c('0x1f')](respondWithFilteredResult(_0x26847c,_0x1608d4))[_0x1f4c('0x28')](handleError(_0x26847c,null));};exports['show']=function(_0xa5cd95,_0x222e46){var _0x2f27e5={'raw':![],'where':{'id':_0xa5cd95[_0x1f4c('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x1f4c('0x3f')}]},_0x3b7349={};_0x3b7349[_0x1f4c('0x5b')]=_[_0x1f4c('0x47')](db['WhatsappAccount'][_0x1f4c('0x41')]);_0x3b7349['query']=_[_0x1f4c('0x47')](_0xa5cd95['query']);_0x3b7349['filters']=_[_0x1f4c('0x49')](_0x3b7349['model'],_0x3b7349['query']);_0x2f27e5[_0x1f4c('0x4a')]=_[_0x1f4c('0x49')](_0x3b7349[_0x1f4c('0x5b')],qs[_0x1f4c('0x5c')](_0xa5cd95[_0x1f4c('0x46')]['fields']));_0x2f27e5['attributes']=_0x2f27e5['attributes'][_0x1f4c('0x4b')]?_0x2f27e5['attributes']:_0x3b7349[_0x1f4c('0x5b')];if(_0xa5cd95['query'][_0x1f4c('0x56')]){_0x2f27e5[_0x1f4c('0x57')]=[{'all':!![]}];}_0x2f27e5=_[_0x1f4c('0x53')]({},_0x2f27e5,_0xa5cd95[_0x1f4c('0x55')]);return db[_0x1f4c('0x40')][_0x1f4c('0x5d')](_0x2f27e5)['then'](handleEntityNotFound(_0x222e46,null))[_0x1f4c('0x1f')](respondWithResult(_0x222e46,null))[_0x1f4c('0x28')](handleError(_0x222e46,null));};exports[_0x1f4c('0x5e')]=function(_0x5e40e9,_0x1abdf2){return db[_0x1f4c('0x40')][_0x1f4c('0x5e')](_0x5e40e9['body'],{})[_0x1f4c('0x1f')](function(_0x4eae2d){var _0x3b3df8=_0x5e40e9['user'][_0x1f4c('0x38')]({'plain':!![]});if(!_0x3b3df8)throw new Error(_0x1f4c('0x5f'));if(_0x3b3df8[_0x1f4c('0x60')]===_0x1f4c('0x61')){var _0x4b794e=_0x4eae2d['get']({'plain':!![]});var _0x95a908=_0x1f4c('0x62');return db[_0x1f4c('0x63')]['find']({'where':{'name':_0x95a908,'userProfileId':_0x3b3df8[_0x1f4c('0x64')]},'raw':!![]})['then'](function(_0x359365){if(_0x359365&&_0x359365[_0x1f4c('0x65')]===0x0){return db[_0x1f4c('0x39')]['create']({'name':_0x4b794e[_0x1f4c('0x3b')],'resourceId':_0x4b794e['id'],'type':_0x359365[_0x1f4c('0x3b')],'sectionId':_0x359365['id']},{})[_0x1f4c('0x1f')](function(){return _0x4eae2d;});}else{return _0x4eae2d;}})[_0x1f4c('0x28')](function(_0x17a9c7){logger[_0x1f4c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17a9c7);throw _0x17a9c7;});}return _0x4eae2d;})[_0x1f4c('0x1f')](respondWithResult(_0x1abdf2,0xc9))[_0x1f4c('0x28')](handleError(_0x1abdf2,null));};exports[_0x1f4c('0x36')]=function(_0x509b3f,_0x591f75){if(_0x509b3f[_0x1f4c('0x66')]['id']){delete _0x509b3f[_0x1f4c('0x66')]['id'];}return db[_0x1f4c('0x40')][_0x1f4c('0x5d')]({'where':{'id':_0x509b3f[_0x1f4c('0x5a')]['id']},'include':[{'model':db[_0x1f4c('0x3e')],'as':_0x1f4c('0x3f')}]})[_0x1f4c('0x1f')](handleEntityNotFound(_0x591f75,null))[_0x1f4c('0x1f')](saveUpdates(_0x509b3f['body'],null))[_0x1f4c('0x1f')](respondWithResult(_0x591f75,null))[_0x1f4c('0x28')](handleError(_0x591f75,null));};exports[_0x1f4c('0x37')]=function(_0x48eb37,_0x5303a7){return db[_0x1f4c('0x40')][_0x1f4c('0x5d')]({'where':{'id':_0x48eb37[_0x1f4c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5303a7,null))[_0x1f4c('0x1f')](removeEntity(_0x5303a7,null))[_0x1f4c('0x28')](handleError(_0x5303a7,null));};exports[_0x1f4c('0x67')]=function(_0x22e568,_0x2d4b61){return db[_0x1f4c('0x40')][_0x1f4c('0x67')]()[_0x1f4c('0x1f')](respondWithResult(_0x2d4b61,null))[_0x1f4c('0x28')](handleError(_0x2d4b61,null));};exports[_0x1f4c('0x68')]=function(_0x1ea46e,_0x2260b8,_0x39b602){if(_0x1ea46e[_0x1f4c('0x66')]['id']){delete _0x1ea46e['body']['id'];}return db[_0x1f4c('0x40')]['find']({'where':{'id':_0x1ea46e[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x2260b8,null))[_0x1f4c('0x1f')](function(_0x1878e9){if(_0x1878e9){_0x1ea46e[_0x1f4c('0x66')][_0x1f4c('0x69')]=_0x1878e9['id'];return db[_0x1f4c('0x6a')]['create'](_0x1ea46e[_0x1f4c('0x66')]);}})['then'](respondWithResult(_0x2260b8,null))[_0x1f4c('0x28')](handleError(_0x2260b8,null));};exports[_0x1f4c('0x6b')]=function(_0x5ac8ad,_0x20aab6,_0x24e69e){var _0x20d23e={'raw':![],'where':{}};var _0x58a0c3={};var _0x1802f6={'count':0x0,'rows':[]};return db[_0x1f4c('0x40')][_0x1f4c('0x6c')]({'where':{'id':_0x5ac8ad[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x20aab6,null))['then'](function(_0x1f51d6){if(_0x1f51d6){_0x58a0c3[_0x1f4c('0x5b')]=_[_0x1f4c('0x47')](db[_0x1f4c('0x6a')][_0x1f4c('0x41')]);_0x58a0c3[_0x1f4c('0x46')]=_[_0x1f4c('0x47')](_0x5ac8ad[_0x1f4c('0x46')]);_0x58a0c3[_0x1f4c('0x48')]=_['intersection'](_0x58a0c3[_0x1f4c('0x5b')],_0x58a0c3[_0x1f4c('0x46')]);_0x20d23e[_0x1f4c('0x4a')]=_[_0x1f4c('0x49')](_0x58a0c3[_0x1f4c('0x5b')],qs[_0x1f4c('0x5c')](_0x5ac8ad[_0x1f4c('0x46')][_0x1f4c('0x5c')]));_0x20d23e[_0x1f4c('0x4a')]=_0x20d23e[_0x1f4c('0x4a')][_0x1f4c('0x4b')]?_0x20d23e[_0x1f4c('0x4a')]:_0x58a0c3[_0x1f4c('0x5b')];if(!_0x5ac8ad[_0x1f4c('0x46')]['hasOwnProperty'](_0x1f4c('0x4d'))){_0x20d23e['limit']=qs['limit'](_0x5ac8ad[_0x1f4c('0x46')]['limit']);_0x20d23e['offset']=qs['offset'](_0x5ac8ad['query'][_0x1f4c('0x2c')]);}_0x20d23e[_0x1f4c('0x4e')]=qs[_0x1f4c('0x4f')](_0x5ac8ad['query']['sort']);_0x20d23e[_0x1f4c('0x50')]=qs['filters'](_[_0x1f4c('0x51')](_0x5ac8ad['query'],_0x58a0c3['filters']));_0x20d23e['where'][_0x1f4c('0x69')]=_0x1f51d6['id'];if(_0x5ac8ad[_0x1f4c('0x46')][_0x1f4c('0x52')]){_0x20d23e[_0x1f4c('0x50')]=_[_0x1f4c('0x53')](_0x20d23e['where'],{'$or':_[_0x1f4c('0x45')](_0x20d23e['attributes'],function(_0x5d1c49){var _0xb478f6={};_0xb478f6[_0x5d1c49]={'$like':'%'+_0x5ac8ad[_0x1f4c('0x46')][_0x1f4c('0x52')]+'%'};return _0xb478f6;})});}_0x20d23e=_[_0x1f4c('0x53')]({},_0x20d23e,_0x5ac8ad[_0x1f4c('0x55')]);return db[_0x1f4c('0x6a')][_0x1f4c('0x2f')]({'where':_0x20d23e[_0x1f4c('0x50')]})[_0x1f4c('0x1f')](function(_0x413cdb){_0x1802f6['count']=_0x413cdb;if(_0x5ac8ad['query'][_0x1f4c('0x56')]){_0x20d23e[_0x1f4c('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x1f4c('0x58')](_0x20d23e);})[_0x1f4c('0x1f')](function(_0x3821e8){_0x1802f6[_0x1f4c('0x59')]=_0x3821e8;return _0x1802f6;});}})[_0x1f4c('0x1f')](respondWithFilteredResult(_0x20aab6,_0x20d23e))[_0x1f4c('0x28')](handleError(_0x20aab6,null));};exports[_0x1f4c('0x6d')]=function(_0x86dd27,_0x506f28,_0x317204){return db[_0x1f4c('0x40')][_0x1f4c('0x5d')]({'where':{'id':_0x86dd27[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x506f28,null))[_0x1f4c('0x1f')](function(_0x27adb8){if(_0x27adb8){return _0x27adb8['removeDispositions'](_0x86dd27[_0x1f4c('0x46')][_0x1f4c('0x6e')]);}})[_0x1f4c('0x1f')](respondWithStatusCode(_0x506f28,null))[_0x1f4c('0x28')](handleError(_0x506f28,null));};exports[_0x1f4c('0x6f')]=function(_0x2598bb,_0x540519,_0x52c5b5){if(_0x2598bb['body']['id']){delete _0x2598bb[_0x1f4c('0x66')]['id'];}return db[_0x1f4c('0x40')][_0x1f4c('0x5d')]({'where':{'id':_0x2598bb[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x540519,null))[_0x1f4c('0x1f')](function(_0x3b492a){if(_0x3b492a){_0x2598bb[_0x1f4c('0x66')]['WhatsappAccountId']=_0x3b492a['id'];return db[_0x1f4c('0x70')]['create'](_0x2598bb['body']);}})['then'](respondWithResult(_0x540519,null))['catch'](handleError(_0x540519,null));};exports[_0x1f4c('0x71')]=function(_0x60b6aa,_0x40a541,_0x50fe19){var _0x125d07={'raw':![],'where':{}};var _0x1431a3={};var _0x3ac5a2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x1f4c('0x6c')]({'where':{'id':_0x60b6aa[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x40a541,null))[_0x1f4c('0x1f')](function(_0x61e17e){if(_0x61e17e){_0x1431a3[_0x1f4c('0x5b')]=_['keys'](db[_0x1f4c('0x70')][_0x1f4c('0x41')]);_0x1431a3['query']=_[_0x1f4c('0x47')](_0x60b6aa[_0x1f4c('0x46')]);_0x1431a3[_0x1f4c('0x48')]=_[_0x1f4c('0x49')](_0x1431a3[_0x1f4c('0x5b')],_0x1431a3[_0x1f4c('0x46')]);_0x125d07[_0x1f4c('0x4a')]=_[_0x1f4c('0x49')](_0x1431a3[_0x1f4c('0x5b')],qs[_0x1f4c('0x5c')](_0x60b6aa['query'][_0x1f4c('0x5c')]));_0x125d07[_0x1f4c('0x4a')]=_0x125d07[_0x1f4c('0x4a')][_0x1f4c('0x4b')]?_0x125d07[_0x1f4c('0x4a')]:_0x1431a3[_0x1f4c('0x5b')];if(!_0x60b6aa[_0x1f4c('0x46')][_0x1f4c('0x4c')](_0x1f4c('0x4d'))){_0x125d07[_0x1f4c('0x2e')]=qs[_0x1f4c('0x2e')](_0x60b6aa[_0x1f4c('0x46')][_0x1f4c('0x2e')]);_0x125d07[_0x1f4c('0x2c')]=qs[_0x1f4c('0x2c')](_0x60b6aa['query'][_0x1f4c('0x2c')]);}_0x125d07[_0x1f4c('0x4e')]=qs[_0x1f4c('0x4f')](_0x60b6aa[_0x1f4c('0x46')][_0x1f4c('0x4f')]);_0x125d07['where']=qs[_0x1f4c('0x48')](_[_0x1f4c('0x51')](_0x60b6aa[_0x1f4c('0x46')],_0x1431a3[_0x1f4c('0x48')]));_0x125d07[_0x1f4c('0x50')]['WhatsappAccountId']=_0x61e17e['id'];if(_0x60b6aa[_0x1f4c('0x46')]['filter']){_0x125d07[_0x1f4c('0x50')]=_[_0x1f4c('0x53')](_0x125d07[_0x1f4c('0x50')],{'$or':_[_0x1f4c('0x45')](_0x125d07[_0x1f4c('0x4a')],function(_0x44ee47){var _0x52256a={};_0x52256a[_0x44ee47]={'$like':'%'+_0x60b6aa[_0x1f4c('0x46')][_0x1f4c('0x52')]+'%'};return _0x52256a;})});}_0x125d07=_[_0x1f4c('0x53')]({},_0x125d07,_0x60b6aa[_0x1f4c('0x55')]);return db[_0x1f4c('0x70')][_0x1f4c('0x2f')]({'where':_0x125d07[_0x1f4c('0x50')]})[_0x1f4c('0x1f')](function(_0x2d1f04){_0x3ac5a2[_0x1f4c('0x2f')]=_0x2d1f04;if(_0x60b6aa[_0x1f4c('0x46')]['includeAll']){_0x125d07[_0x1f4c('0x57')]=[{'all':!![]}];}return db[_0x1f4c('0x70')][_0x1f4c('0x58')](_0x125d07);})[_0x1f4c('0x1f')](function(_0x1c40eb){_0x3ac5a2[_0x1f4c('0x59')]=_0x1c40eb;return _0x3ac5a2;});}})[_0x1f4c('0x1f')](respondWithFilteredResult(_0x40a541,_0x125d07))['catch'](handleError(_0x40a541,null));};exports['removeAnswers']=function(_0x250958,_0x790731,_0x87a065){return db['WhatsappAccount'][_0x1f4c('0x5d')]({'where':{'id':_0x250958[_0x1f4c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x790731,null))[_0x1f4c('0x1f')](function(_0x2eb964){if(_0x2eb964){return _0x2eb964[_0x1f4c('0x72')](_0x250958['query'][_0x1f4c('0x6e')]);}})[_0x1f4c('0x1f')](respondWithStatusCode(_0x790731,null))['catch'](handleError(_0x790731,null));};exports[_0x1f4c('0x73')]=function(_0xaa05b,_0x3d577a,_0x1eb502){return db[_0x1f4c('0x40')]['find']({'where':{'id':_0xaa05b[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x3d577a,null))['then'](function(_0x4be1ce){if(_0x4be1ce){return _0x4be1ce['addAgents'](_0xaa05b[_0x1f4c('0x66')][_0x1f4c('0x6e')],_[_0x1f4c('0x74')](_0xaa05b[_0x1f4c('0x66')],[_0x1f4c('0x6e'),'id'])||{})[_0x1f4c('0x75')](function(_0x4a7e2f){for(var _0x2cd492=0x0;_0x2cd492<_0xaa05b[_0x1f4c('0x66')]['ids'][_0x1f4c('0x4b')];_0x2cd492+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0xaa05b[_0x1f4c('0x66')]['ids'][_0x2cd492]),'WhatsappAccountId':Number(_0xaa05b[_0x1f4c('0x5a')]['id'])});}return _0x4a7e2f;});}})[_0x1f4c('0x1f')](respondWithResult(_0x3d577a,null))[_0x1f4c('0x28')](handleError(_0x3d577a,null));};exports[_0x1f4c('0x76')]=function(_0x4a7c16,_0x4ffff3,_0x3d2cab){return db['WhatsappAccount'][_0x1f4c('0x5d')]({'where':{'id':_0x4a7c16['params']['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x4ffff3,null))['then'](function(_0x477f64){if(_0x477f64){return _0x477f64['removeAgents'](_0x4a7c16['query']['ids'])[_0x1f4c('0x1f')](function(){if(_[_0x1f4c('0x77')](_0x4a7c16[_0x1f4c('0x46')][_0x1f4c('0x6e')])){for(var _0x3f5b0d=0x0;_0x3f5b0d<_0x4a7c16[_0x1f4c('0x46')]['ids']['length'];_0x3f5b0d+=0x1){socket[_0x1f4c('0x78')](_0x1f4c('0x79'),{'UserId':Number(_0x4a7c16[_0x1f4c('0x46')]['ids'][_0x3f5b0d]),'WhatsappAccountId':Number(_0x4a7c16[_0x1f4c('0x5a')]['id'])});}}else{socket[_0x1f4c('0x78')]('userWhatsappAccount:remove',{'UserId':Number(_0x4a7c16['query']['ids']),'WhatsappAccountId':Number(_0x4a7c16[_0x1f4c('0x5a')]['id'])});}});}})[_0x1f4c('0x1f')](respondWithStatusCode(_0x4ffff3,null))[_0x1f4c('0x28')](handleError(_0x4ffff3,null));};exports['getAgents']=function(_0x350ca5,_0x10a101,_0x588772){var _0x5e882e={};var _0x3b4adb={};var _0x2bf970;var _0x1c9148;return db[_0x1f4c('0x40')][_0x1f4c('0x6c')]({'where':{'id':_0x350ca5[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x10a101,null))['then'](function(_0x3afb22){if(_0x3afb22){_0x2bf970=_0x3afb22;_0x3b4adb['model']=_[_0x1f4c('0x47')](db[_0x1f4c('0x7a')][_0x1f4c('0x41')]);_0x3b4adb[_0x1f4c('0x46')]=_[_0x1f4c('0x47')](_0x350ca5['query']);_0x3b4adb['filters']=_[_0x1f4c('0x49')](_0x3b4adb[_0x1f4c('0x5b')],_0x3b4adb[_0x1f4c('0x46')]);_0x5e882e[_0x1f4c('0x4a')]=_[_0x1f4c('0x49')](_0x3b4adb[_0x1f4c('0x5b')],qs['fields'](_0x350ca5['query'][_0x1f4c('0x5c')]));_0x5e882e[_0x1f4c('0x4a')]=_0x5e882e[_0x1f4c('0x4a')][_0x1f4c('0x4b')]?_0x5e882e[_0x1f4c('0x4a')]:_0x3b4adb['model'];_0x5e882e[_0x1f4c('0x4e')]=qs['sort'](_0x350ca5['query'][_0x1f4c('0x4f')]);_0x5e882e[_0x1f4c('0x50')]=qs['filters'](_[_0x1f4c('0x51')](_0x350ca5['query'],_0x3b4adb[_0x1f4c('0x48')]));if(_0x350ca5[_0x1f4c('0x46')][_0x1f4c('0x52')]){_0x5e882e[_0x1f4c('0x50')]=_[_0x1f4c('0x53')](_0x5e882e[_0x1f4c('0x50')],{'$or':_['map'](_0x5e882e[_0x1f4c('0x4a')],function(_0x14603a){var _0xd3fc36={};_0xd3fc36[_0x14603a]={'$like':'%'+_0x350ca5[_0x1f4c('0x46')][_0x1f4c('0x52')]+'%'};return _0xd3fc36;})});}_0x5e882e=_[_0x1f4c('0x53')]({},_0x5e882e,_0x350ca5[_0x1f4c('0x55')]);return _0x2bf970['getAgents'](_0x5e882e);}})[_0x1f4c('0x1f')](function(_0x2d5211){if(_0x2d5211){_0x1c9148=_0x2d5211[_0x1f4c('0x4b')];if(!_0x350ca5[_0x1f4c('0x46')][_0x1f4c('0x4c')](_0x1f4c('0x4d'))){_0x5e882e[_0x1f4c('0x2e')]=qs[_0x1f4c('0x2e')](_0x350ca5['query'][_0x1f4c('0x2e')]);_0x5e882e[_0x1f4c('0x2c')]=qs[_0x1f4c('0x2c')](_0x350ca5['query'][_0x1f4c('0x2c')]);}return _0x2bf970['getAgents'](_0x5e882e);}})[_0x1f4c('0x1f')](function(_0x53f69a){if(_0x53f69a){return _0x53f69a?{'count':_0x1c9148,'rows':_0x53f69a}:null;}})[_0x1f4c('0x1f')](respondWithResult(_0x10a101,null))[_0x1f4c('0x28')](handleError(_0x10a101,null));};exports[_0x1f4c('0x7b')]=function(_0xff36aa,_0x7075ff){var _0x3b3729=_0xff36aa['params']['id'];var _0x52e790=_0xff36aa[_0x1f4c('0x66')];var _0xbfa2b6=0xc8;var _0x5c2ac5=null;return db[_0x1f4c('0x7c')][_0x1f4c('0x7d')]({'isolationLevel':db['sequelize'][_0x1f4c('0x7e')]['ISOLATION_LEVELS'][_0x1f4c('0x7f')]},function(_0xbd0897){return db[_0x1f4c('0x40')][_0x1f4c('0x6c')]({'where':{'id':_0x3b3729},'transaction':_0xbd0897})[_0x1f4c('0x1f')](function(_0x3a2ad8){if(_0x3a2ad8){return db[_0x1f4c('0x80')]['destroy']({'where':{'WhatsappAccountId':_0x3b3729},'transaction':_0xbd0897})[_0x1f4c('0x1f')](function(){var _0x291490=_[_0x1f4c('0x45')](_0x52e790,function(_0xf704dd){_0xf704dd[_0x1f4c('0x69')]=_0x3b3729;return _0xf704dd;});return db[_0x1f4c('0x80')][_0x1f4c('0x81')](_0x291490,{'transaction':_0xbd0897});});}else{_0xbfa2b6=0x194;_0x5c2ac5=[];}});})['then'](function(){if(_0xbfa2b6!==0x194){return db[_0x1f4c('0x80')][_0x1f4c('0x82')]({'where':{'WhatsappAccountId':_0x3b3729},'order':_0x1f4c('0x83')})[_0x1f4c('0x1f')](function(_0x14756a){_0x5c2ac5=_0x14756a;});}})[_0x1f4c('0x28')](function(_0x5c350a){_0xbfa2b6=0x1f4;logger[_0x1f4c('0x23')](_0x5c350a[_0x1f4c('0x3a')]);if(_0x5c350a[_0x1f4c('0x3b')]){delete _0x5c350a[_0x1f4c('0x3b')];}_0x5c2ac5=_0x5c350a;})[_0x1f4c('0x84')](function(){if(_0x5c2ac5===null){_0x7075ff[_0x1f4c('0x29')](_0xbfa2b6);}else{if(_0xbfa2b6===0x1f4){_0x7075ff['status'](_0xbfa2b6)[_0x1f4c('0x3c')](_0x5c2ac5);}else{_0x7075ff['status'](_0xbfa2b6)[_0x1f4c('0x2b')](_0x5c2ac5);}}});};exports[_0x1f4c('0x85')]=function(_0x2de71b,_0x40fe91,_0x22c5ac){var _0x586c62={};var _0x3444a4={};var _0x23e7f2;var _0x5a5f51;return db[_0x1f4c('0x40')][_0x1f4c('0x6c')]({'where':{'id':_0x2de71b['params']['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x40fe91,null))[_0x1f4c('0x1f')](function(_0x37522c){if(_0x37522c){_0x23e7f2=_0x37522c;_0x3444a4[_0x1f4c('0x5b')]=_[_0x1f4c('0x47')](db[_0x1f4c('0x80')]['rawAttributes']);_0x3444a4[_0x1f4c('0x46')]=_[_0x1f4c('0x47')](_0x2de71b[_0x1f4c('0x46')]);_0x3444a4[_0x1f4c('0x48')]=_[_0x1f4c('0x49')](_0x3444a4[_0x1f4c('0x5b')],_0x3444a4[_0x1f4c('0x46')]);_0x586c62[_0x1f4c('0x4a')]=_['intersection'](_0x3444a4[_0x1f4c('0x5b')],qs[_0x1f4c('0x5c')](_0x2de71b[_0x1f4c('0x46')][_0x1f4c('0x5c')]));_0x586c62[_0x1f4c('0x4a')]=_0x586c62[_0x1f4c('0x4a')][_0x1f4c('0x4b')]?_0x586c62[_0x1f4c('0x4a')]:_0x3444a4[_0x1f4c('0x5b')];_0x586c62['order']=qs[_0x1f4c('0x4f')](_0x2de71b[_0x1f4c('0x46')]['sort']);_0x586c62[_0x1f4c('0x50')]=qs[_0x1f4c('0x48')](_[_0x1f4c('0x51')](_0x2de71b[_0x1f4c('0x46')],_0x3444a4[_0x1f4c('0x48')]));if(_0x2de71b[_0x1f4c('0x46')]['filter']){_0x586c62['where']=_['merge'](_0x586c62['where'],{'$or':_['map'](_0x586c62[_0x1f4c('0x4a')],function(_0x14a3d3){var _0x1d4aac={};_0x1d4aac[_0x14a3d3]={'$like':'%'+_0x2de71b[_0x1f4c('0x46')][_0x1f4c('0x52')]+'%'};return _0x1d4aac;})});}_0x586c62=_[_0x1f4c('0x53')]({},_0x586c62,_0x2de71b[_0x1f4c('0x55')]);return _0x23e7f2[_0x1f4c('0x85')](_0x586c62);}})[_0x1f4c('0x1f')](function(_0x304ef4){if(_0x304ef4){_0x5a5f51=_0x304ef4['length'];if(!_0x2de71b[_0x1f4c('0x46')][_0x1f4c('0x4c')](_0x1f4c('0x4d'))){_0x586c62['limit']=qs[_0x1f4c('0x2e')](_0x2de71b['query'][_0x1f4c('0x2e')]);_0x586c62['offset']=qs[_0x1f4c('0x2c')](_0x2de71b[_0x1f4c('0x46')][_0x1f4c('0x2c')]);}return _0x23e7f2[_0x1f4c('0x85')](_0x586c62);}})[_0x1f4c('0x1f')](function(_0x25b22f){if(_0x25b22f){return _0x25b22f?{'count':_0x5a5f51,'rows':_0x25b22f}:null;}})[_0x1f4c('0x1f')](respondWithResult(_0x40fe91,null))['catch'](handleError(_0x40fe91,null));};exports[_0x1f4c('0x86')]=function(_0x9279b5,_0x22cc62,_0x151129){var _0x34e44b={'channel':'whatsapp'};var _0x557226=[];var _0x20755d=[];var _0x186d58={};return db[_0x1f4c('0x40')]['find']({'where':{'id':_0x9279b5[_0x1f4c('0x5a')]['id']},'include':[{'model':db[_0x1f4c('0x80')],'as':_0x1f4c('0x87')}]})[_0x1f4c('0x1f')](handleEntityNotFound(_0x22cc62,null))[_0x1f4c('0x1f')](function(_0x446587){_0x34e44b[_0x1f4c('0x88')]=_0x446587;if(_0x34e44b['account']&&_0x34e44b[_0x1f4c('0x88')][_0x1f4c('0x43')]===_0x1f4c('0x89')&&_0x9279b5['body'][_0x1f4c('0x8a')]){if(_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0x8a')]['length']===0x0)return;if(_0x9279b5['body']['statuses'][0x0][_0x1f4c('0x8b')]!==_0x1f4c('0x8c'))return;return db[_0x1f4c('0x8d')][_0x1f4c('0x36')]({'read':!![],'readAt':_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0x8a')][0x0][_0x1f4c('0x8e')]},{'where':{'messageId':_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0x8a')][0x0][_0x1f4c('0x8f')]},'individualHooks':!![]})[_0x1f4c('0x1f')](function(_0x53bfee){return _0x22cc62[_0x1f4c('0x30')](0xc8)['json'](_0x53bfee);});}_0x34e44b[_0x1f4c('0x90')]=_[_0x1f4c('0x91')](_0x446587[_0x1f4c('0x87')],[_0x1f4c('0x83')],[_0x1f4c('0x92')]);if(_0x34e44b['account'][_0x1f4c('0x87')]){delete _0x34e44b['account']['Applications'];}return db[_0x1f4c('0x93')][_0x1f4c('0x67')]()['then'](function(_0x4504cc){if(!_0x4504cc){throw new db[(_0x1f4c('0x94'))][(_0x1f4c('0x95'))](_0x1f4c('0x96'));}_0x557226=_[_0x1f4c('0x97')](_[_0x1f4c('0x47')](_0x4504cc),[_0x1f4c('0x98'),_0x1f4c('0x99')]);_0x20755d=_[_0x1f4c('0x97')](_[_0x1f4c('0x47')](_0x4504cc),[_0x1f4c('0x98'),'updatedAt',_0x1f4c('0x9a'),'ListId']);_0x34e44b[_0x1f4c('0x66')]={'mapKey':_0x1f4c('0x9b')};if(_0x34e44b[_0x1f4c('0x88')]&&_0x34e44b['account'][_0x1f4c('0x43')]===_0x1f4c('0x9c')){_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x9d')]=_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0x9e')]['replace'](_0x1f4c('0x9f'),'');_0x34e44b['body']['body']=_0x9279b5[_0x1f4c('0x66')]['Body'];_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0xa0')]=_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0xa1')];}if(_0x34e44b['account']&&_0x34e44b[_0x1f4c('0x88')][_0x1f4c('0x43')]==='sinch'){_0x34e44b['body'][_0x1f4c('0x9d')]=_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0xa2')][0x0][_0x1f4c('0x9d')];_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x66')]=_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0xa2')][0x0][_0x1f4c('0x25')][_0x1f4c('0x66')];_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0xa0')]=_0x9279b5['body']['notifications'][0x0]['message_id'];}if(_0x34e44b[_0x1f4c('0x66')]['id']){delete _0x34e44b['body']['id'];}if(_[_0x1f4c('0xa3')](_0x34e44b[_0x1f4c('0x66')]['from'])){throw new db[(_0x1f4c('0x94'))]['ValidationError'](_0x1f4c('0xa4'));}if(_[_0x1f4c('0xa3')](_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x66')])||_0x34e44b[_0x1f4c('0x66')]['body']===''){throw new db['Sequelize'][(_0x1f4c('0x95'))](_0x1f4c('0xa5'));}if(_['isNil'](_0x34e44b['body'][_0x1f4c('0xa6')])){throw new db['Sequelize'][(_0x1f4c('0x95'))](_0x1f4c('0xa7')+_0x20755d);}if(!_[_0x1f4c('0xa8')](_0x20755d,_0x34e44b[_0x1f4c('0x66')]['mapKey'])){throw new db[(_0x1f4c('0x94'))]['ValidationError'](_0x1f4c('0xa9')+_0x20755d);}_0x186d58[_0x34e44b['body'][_0x1f4c('0xa6')]]=_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x9d')];return db[_0x1f4c('0xaa')][_0x1f4c('0x5d')]({'where':{'id':_0x34e44b['account'][_0x1f4c('0xab')]},'include':[{'model':db[_0x1f4c('0x93')],'as':_0x1f4c('0xac'),'where':_0x186d58,'limit':0x1,'order':[[_0x1f4c('0x99'),_0x1f4c('0xad')]]}]});})[_0x1f4c('0x1f')](handleEntityNotFound(_0x22cc62,null))['then'](function(_0x4616b6){if(_0x4616b6){_0x34e44b[_0x1f4c('0xae')]=_[_0x1f4c('0x74')](_0x4616b6,[_0x1f4c('0xac')]);if(_0x4616b6[_0x1f4c('0xac')][_0x1f4c('0x4b')]){return _0x4616b6['Contacts'][0x0];}var _0xbe2677=_['defaults'](_0x34e44b[_0x1f4c('0x66')],{'firstName':_0x34e44b[_0x1f4c('0x66')]['from'],'ListId':_0x4616b6['id']});_0xbe2677[_0x34e44b[_0x1f4c('0x66')]['mapKey']]=_0x34e44b[_0x1f4c('0x66')]['from'];return db[_0x1f4c('0x93')][_0x1f4c('0x5e')](_0xbe2677,{'fields':_0x557226,'raw':!![]});}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x22cc62,null))[_0x1f4c('0x1f')](function(_0x48e2f4){if(_0x48e2f4){_0x34e44b[_0x1f4c('0xaf')]=_0x48e2f4;var _0x436af7={'ContactId':_0x48e2f4['id'],'phone':_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x9d')],'WhatsappAccountId':_0x9279b5[_0x1f4c('0x5a')]['id']};var _0x522bc6={'ContactId':_0x48e2f4['id'],'WhatsappAccountId':_0x9279b5['params']['id'],'closed':![]};return db[_0x1f4c('0xb0')][_0x1f4c('0x5d')]({'where':_0x522bc6})[_0x1f4c('0x1f')](function(_0x141aa6){if(_0x141aa6){return[_0x141aa6,![]];}return db[_0x1f4c('0xb0')][_0x1f4c('0x5e')](_0x436af7)[_0x1f4c('0x1f')](function(_0x351d6c){return[_0x351d6c,!![]];});});}})[_0x1f4c('0x75')](function(_0x4db153,_0x5edd2c){_0x34e44b['interaction']=_0x4db153['get']({'plain':!![]});_0x34e44b[_0x1f4c('0xb1')]['created']=![];if(_0x5edd2c){if(_0x34e44b[_0x1f4c('0x88')][_0x1f4c('0xb2')]){_0x34e44b['applications'][_0x1f4c('0xb3')]({'id':0x0,'priority':_0x34e44b[_0x1f4c('0x90')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x1f4c('0xb4')});}_0x34e44b['interaction']['created']=!![];}return db['WhatsappMessage'][_0x1f4c('0x5e')]({'phone':_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x9d')],'messageId':_0x34e44b[_0x1f4c('0x66')]['messageId'],'body':_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x66')],'WhatsappAccountId':_0x9279b5[_0x1f4c('0x5a')]['id'],'WhatsappInteractionId':_0x4db153['id'],'direction':'in','ContactId':_0x4db153[_0x1f4c('0xb5')],'AttachmentId':_0x34e44b['body'][_0x1f4c('0xb6')]});})['then'](function(_0x5bd18b){_0x34e44b['message']=_0x5bd18b;if(_0x34e44b[_0x1f4c('0xb1')][_0x1f4c('0xb7')]){return db[_0x1f4c('0x7a')][_0x1f4c('0x5d')]({'attributes':['id',_0x1f4c('0x3b')],'where':{'id':_0x34e44b['interaction'][_0x1f4c('0xb7')]}})[_0x1f4c('0x1f')](function(_0x123e9d){if(_0x123e9d){_0x34e44b[_0x1f4c('0x90')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x123e9d['name']+','+(_0x34e44b[_0x1f4c('0x88')][_0x1f4c('0xb8')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1f4c('0xb9'),_0x1f4c('0xba'),_0x34e44b);});}return respondWithRpcPromise(_0x1f4c('0xb9'),_0x1f4c('0xba'),_0x34e44b);})[_0x1f4c('0x1f')](function(_0x4a414f){if(_0x4a414f){var _0x1d1d99=0xc8;var _0xd9eaa5=_0x1f4c('0xbb');logger[_0x1f4c('0x26')](_0x1f4c('0xbc'),_0xd9eaa5,_0x1d1d99,_0x1f4c('0xbd'));logger[_0x1f4c('0x21')](_0x1f4c('0xbe'),_0xd9eaa5,_0x1d1d99,_0x1f4c('0xbd'),JSON[_0x1f4c('0x22')](_0x4a414f));if(_0x34e44b[_0x1f4c('0x88')][_0x1f4c('0x43')]===_0x1f4c('0x9c')){return _0x22cc62[_0x1f4c('0x30')](_0x1d1d99)['set'](_0x1f4c('0xbf'),'text/xml')[_0x1f4c('0x3c')](_0x1f4c('0xc0'));}else{return _0x22cc62[_0x1f4c('0x30')](_0x1d1d99)[_0x1f4c('0x2b')](_0x4a414f);}}});})[_0x1f4c('0x28')](handleError(_0x22cc62,null));};exports[_0x1f4c('0x3c')]=function(_0x41f425,_0x53bcbf,_0x1d8cd7){var _0x225b92,_0x6f18a6,_0x1da88;if(_[_0x1f4c('0xa3')](_0x41f425[_0x1f4c('0x66')]['body'])||_0x41f425['body']['body']===''){throw new db['Sequelize'][(_0x1f4c('0x95'))](_0x1f4c('0xa5'));}if(_['isNil'](_0x41f425['body']['to'])){throw new db[(_0x1f4c('0x94'))][(_0x1f4c('0x95'))](_0x1f4c('0xc1'));}_0x225b92=_0x41f425[_0x1f4c('0x66')]['to'];return db[_0x1f4c('0x40')][_0x1f4c('0x5d')]({'where':{'id':_0x41f425[_0x1f4c('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x1f4c('0xc2'),'include':[{'model':db['CmContact'],'as':_0x1f4c('0xac'),'where':{'mobile':_0x225b92},'limit':0x1,'order':[[_0x1f4c('0x99'),_0x1f4c('0xad')]]}]}]})[_0x1f4c('0x1f')](handleEntityNotFound(_0x53bcbf,null))['then'](function(_0x35986e){if(_0x35986e&&_0x35986e['List']){_0x6f18a6=_0x35986e[_0x1f4c('0x38')]({'plain':!![]});if(_0x6f18a6[_0x1f4c('0xc2')]&&_0x6f18a6['List'][_0x1f4c('0xac')]['length']){return _0x6f18a6['List'][_0x1f4c('0xac')][0x0];}return db[_0x1f4c('0x93')][_0x1f4c('0x5e')](_[_0x1f4c('0xc3')](_0x41f425[_0x1f4c('0x66')],{'firstName':_0x225b92,'mobile':_0x225b92,'phone':_0x225b92,'ListId':_0x6f18a6[_0x1f4c('0xab')]}));}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x53bcbf,null))[_0x1f4c('0x1f')](function(_0x3d7c62){if(_0x3d7c62){_0x1da88=_0x3d7c62;return db[_0x1f4c('0xb0')][_0x1f4c('0x5d')]({'where':{'ContactId':_0x1da88['id'],'closed':![],'WhatsappAccountId':_0x6f18a6['id']}})[_0x1f4c('0x1f')](function(_0x134c05){if(_0x134c05){return[_0x134c05,![]];}return db[_0x1f4c('0xb0')]['create']({'UserId':_0x41f425[_0x1f4c('0x61')]['id'],'ContactId':_0x1da88['id'],'WhatsappAccountId':_0x6f18a6['id'],'phone':_0x225b92,'firstMsgDirection':_0x1f4c('0xc4'),'Messages':[_[_0x1f4c('0x53')](_0x41f425['body'],{'read':![],'body':_0x41f425[_0x1f4c('0x66')][_0x1f4c('0x66')],'phone':_0x225b92,'WhatsappAccountId':_0x6f18a6['id'],'UserId':_0x41f425[_0x1f4c('0x61')]['id'],'ContactId':_0x1da88['id']})]},{'include':[{'model':db[_0x1f4c('0x8d')],'as':_0x1f4c('0xc5')}]})[_0x1f4c('0x1f')](function(_0x36edac){return[_0x36edac,!![]];});});}})[_0x1f4c('0x75')](function(_0x3ec94a,_0x553d06){if(_0x553d06){return _0x3ec94a;}return db[_0x1f4c('0x8d')]['create'](_[_0x1f4c('0x53')](_0x41f425['body'],{'read':![],'body':_0x41f425['body'][_0x1f4c('0x66')],'phone':_0x225b92,'WhatsappAccountId':_0x6f18a6['id'],'WhatsappInteractionId':_0x3ec94a['id'],'UserId':_0x41f425[_0x1f4c('0x61')]['id'],'ContactId':_0x1da88['id']}))[_0x1f4c('0x1f')](function(_0x403ae8){_0x3ec94a[_0x1f4c('0xc6')]['Messages']=[];_0x3ec94a['dataValues'][_0x1f4c('0xc5')]['push'](_0x403ae8['dataValues']);return _0x3ec94a;});})['then'](respondWithResult(_0x53bcbf,null))['catch'](handleError(_0x53bcbf,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e150d97..3aba130 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 _0xcb4b=['emit','hasOwnProperty','hook','exports','WhatsappAccount','save','update','remove'];(function(_0x407b07,_0x525c69){var _0x2c9b12=function(_0x54b368){while(--_0x54b368){_0x407b07['push'](_0x407b07['shift']());}};_0x2c9b12(++_0x525c69);}(_0xcb4b,0x15c));var _0xbcb4=function(_0x21555b,_0x395b17){_0x21555b=_0x21555b-0x0;var _0x38b245=_0xcb4b[_0x21555b];return _0x38b245;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0xbcb4('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbcb4('0x1'),'afterUpdate':_0xbcb4('0x2'),'afterDestroy':_0xbcb4('0x3')};function emitEvent(_0x37944e){return function(_0x949cde,_0x238cb3,_0x82eee4){WhatsappAccountEvents[_0xbcb4('0x4')](_0x37944e+':'+_0x949cde['id'],_0x949cde);WhatsappAccountEvents['emit'](_0x37944e,_0x949cde);_0x82eee4(null);};}for(var e in events){if(events[_0xbcb4('0x5')](e)){var event=events[e];WhatsappAccount[_0xbcb4('0x6')](e,emitEvent(event));}}module[_0xbcb4('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x693a=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','WhatsappAccount'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x693a,0x75));var _0xa693=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x693a[_0x44d9ab];return _0x31485e;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xa693('0x0'))['db'][_0xa693('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa693('0x2'),'afterDestroy':_0xa693('0x3')};function emitEvent(_0x2d5f24){return function(_0x47f43b,_0x4fa51e,_0x3370d7){WhatsappAccountEvents[_0xa693('0x4')](_0x2d5f24+':'+_0x47f43b['id'],_0x47f43b);WhatsappAccountEvents['emit'](_0x2d5f24,_0x47f43b);_0x3370d7(null);};}for(var e in events){if(events[_0xa693('0x5')](e)){var event=events[e];WhatsappAccount[_0xa693('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index c9e360c..2d3a3ce 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 _0xb8fc=['./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4f56e9,_0x3b6f07){var _0x4a0927=function(_0x41a210){while(--_0x41a210){_0x4f56e9['push'](_0x4f56e9['shift']());}};_0x4a0927(++_0x3b6f07);}(_0xb8fc,0x133));var _0xcb8f=function(_0x3c95e5,_0x31bfb7){_0x3c95e5=_0x3c95e5-0x0;var _0x161528=_0xb8fc[_0x3c95e5];return _0x161528;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcb8f('0x0'))(_0xcb8f('0x1'));var moment=require(_0xcb8f('0x2'));var BPromise=require(_0xcb8f('0x3'));var rp=require(_0xcb8f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcb8f('0x5'));module['exports']=function(_0x300d7b,_0x4d69d3){return _0x300d7b['define'](_0xcb8f('0x6'),attributes,{'tableName':_0xcb8f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd404=['WhatsappAccount','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x552bd5,_0x3fe02a){var _0x32b19a=function(_0x49cfc0){while(--_0x49cfc0){_0x552bd5['push'](_0x552bd5['shift']());}};_0x32b19a(++_0x3fe02a);}(_0xd404,0x11f));var _0x4d40=function(_0x2524ef,_0x307a13){_0x2524ef=_0x2524ef-0x0;var _0x517910=_0xd404[_0x2524ef];return _0x517910;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var logger=require(_0x4d40('0x2'))(_0x4d40('0x3'));var moment=require('moment');var BPromise=require(_0x4d40('0x4'));var rp=require(_0x4d40('0x5'));var fs=require('fs');var path=require(_0x4d40('0x6'));var rimraf=require('rimraf');var config=require(_0x4d40('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x4d40('0x8')]=function(_0x4d4eae,_0x81b56b){return _0x4d4eae[_0x4d40('0x9')](_0x4d40('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 69f967f..d34b670 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 _0x560e=['redis','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','find','options','raw','where','include','map','model','attributes','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults'];(function(_0x502e15,_0x49ff8f){var _0xadd0c4=function(_0xa1776){while(--_0xa1776){_0x502e15['push'](_0x502e15['shift']());}};_0xadd0c4(++_0x49ff8f);}(_0x560e,0x1ee));var _0xe560=function(_0x42457c,_0x5a3e3c){_0x42457c=_0x42457c-0x0;var _0xbef868=_0x560e[_0x42457c];return _0xbef868;};'use strict';var _=require(_0xe560('0x0'));var util=require(_0xe560('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe560('0x2'))['db'];var utils=require(_0xe560('0x3'));var logger=require(_0xe560('0x4'))(_0xe560('0x5'));var config=require(_0xe560('0x6'));var jayson=require(_0xe560('0x7'));var client=jayson['client'][_0xe560('0x8')]({'port':0x232a});config['redis']=_[_0xe560('0x9')](config[_0xe560('0xa')],{'host':_0xe560('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe560('0xa')]));require(_0xe560('0xc'))[_0xe560('0xd')](socket);function respondWithRpcPromise(_0x4bd420,_0x3c324b,_0x290f5f){return new BPromise(function(_0xf1979d,_0x6e52b2){return client[_0xe560('0xe')](_0x4bd420,_0x290f5f)[_0xe560('0xf')](function(_0x58ea8c){logger[_0xe560('0x10')](_0xe560('0x11'),_0x3c324b,_0xe560('0x12'));logger[_0xe560('0x13')](_0xe560('0x14'),_0x3c324b,'request\x20sent',JSON[_0xe560('0x15')](_0x58ea8c));if(_0x58ea8c[_0xe560('0x16')]){if(_0x58ea8c[_0xe560('0x16')][_0xe560('0x17')]===0x1f4){logger[_0xe560('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x3c324b,_0x58ea8c['error'][_0xe560('0x18')]);return _0x6e52b2(_0x58ea8c['error'][_0xe560('0x18')]);}logger[_0xe560('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x3c324b,_0x58ea8c[_0xe560('0x16')][_0xe560('0x18')]);return _0xf1979d(_0x58ea8c['error'][_0xe560('0x18')]);}else{logger[_0xe560('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x3c324b,_0xe560('0x12'));_0xf1979d(_0x58ea8c[_0xe560('0x19')][_0xe560('0x18')]);}})['catch'](function(_0x9f83fe){logger[_0xe560('0x16')](_0xe560('0x11'),_0x3c324b,_0x9f83fe);_0x6e52b2(_0x9f83fe);});});}exports[_0xe560('0x1a')]=function(_0x24819e){var _0x12dde6=this;return new Promise(function(_0x2d0cea,_0x5e3832){return db['WhatsappAccount'][_0xe560('0x1b')]({'raw':_0x24819e['options']?_0x24819e[_0xe560('0x1c')][_0xe560('0x1d')]===undefined?!![]:![]:!![],'where':_0x24819e[_0xe560('0x1c')]?_0x24819e[_0xe560('0x1c')][_0xe560('0x1e')]||null:null,'attributes':_0x24819e[_0xe560('0x1c')]?_0x24819e[_0xe560('0x1c')]['attributes']||null:null,'include':_0x24819e[_0xe560('0x1c')]?_0x24819e[_0xe560('0x1c')][_0xe560('0x1f')]?_[_0xe560('0x20')](_0x24819e[_0xe560('0x1c')][_0xe560('0x1f')],function(_0x52b91e){return{'model':db[_0x52b91e[_0xe560('0x21')]],'as':_0x52b91e['as'],'attributes':_0x52b91e[_0xe560('0x22')],'include':_0x52b91e['include']?_[_0xe560('0x20')](_0x52b91e['include'],function(_0x1dd675){return{'model':db[_0x1dd675[_0xe560('0x21')]],'as':_0x1dd675['as'],'attributes':_0x1dd675['attributes'],'include':_0x1dd675[_0xe560('0x1f')]?_[_0xe560('0x20')](_0x1dd675[_0xe560('0x1f')],function(_0x4908ca){return{'model':db[_0x4908ca[_0xe560('0x21')]],'as':_0x4908ca['as'],'attributes':_0x4908ca['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x346c35){logger[_0xe560('0x10')]('ShowWhatsappAccount',_0x24819e);logger[_0xe560('0x13')](_0xe560('0x1a'),_0x24819e,JSON[_0xe560('0x15')](_0x346c35));_0x2d0cea(_0x346c35);})[_0xe560('0x23')](function(_0x3c5123){logger[_0xe560('0x16')]('ShowWhatsappAccount',_0x3c5123[_0xe560('0x18')],_0x24819e);_0x5e3832(_0x12dde6['error'](0x1f4,_0x3c5123[_0xe560('0x18')]));});});}; \ No newline at end of file +var _0x2000=['redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','map','model','include','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x35d5d5,_0x4a4775){var _0x58df05=function(_0x54b700){while(--_0x54b700){_0x35d5d5['push'](_0x35d5d5['shift']());}};_0x58df05(++_0x4a4775);}(_0x2000,0x68));var _0x0200=function(_0xaba441,_0x45dcf4){_0xaba441=_0xaba441-0x0;var _0x4a96dc=_0x2000[_0xaba441];return _0x4a96dc;};'use strict';var _=require(_0x0200('0x0'));var util=require(_0x0200('0x1'));var moment=require(_0x0200('0x2'));var BPromise=require(_0x0200('0x3'));var rs=require(_0x0200('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0200('0x5'))['db'];var utils=require(_0x0200('0x6'));var logger=require(_0x0200('0x7'))('rpc');var config=require(_0x0200('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0200('0x9')]({'port':0x232a});config[_0x0200('0xa')]=_[_0x0200('0xb')](config[_0x0200('0xa')],{'host':_0x0200('0xc'),'port':0x18eb});var socket=require(_0x0200('0xd'))(new Redis(config['redis']));require(_0x0200('0xe'))[_0x0200('0xf')](socket);function respondWithRpcPromise(_0x4e7f7f,_0x50bfc4,_0x1fae2d){return new BPromise(function(_0x13690e,_0x2f0f8a){return client[_0x0200('0x10')](_0x4e7f7f,_0x1fae2d)[_0x0200('0x11')](function(_0x10ac9c){logger[_0x0200('0x12')](_0x0200('0x13'),_0x50bfc4,_0x0200('0x14'));logger[_0x0200('0x15')](_0x0200('0x16'),_0x50bfc4,_0x0200('0x14'),JSON[_0x0200('0x17')](_0x10ac9c));if(_0x10ac9c['error']){if(_0x10ac9c['error'][_0x0200('0x18')]===0x1f4){logger['error'](_0x0200('0x13'),_0x50bfc4,_0x10ac9c[_0x0200('0x19')][_0x0200('0x1a')]);return _0x2f0f8a(_0x10ac9c[_0x0200('0x19')][_0x0200('0x1a')]);}logger[_0x0200('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x50bfc4,_0x10ac9c[_0x0200('0x19')][_0x0200('0x1a')]);return _0x13690e(_0x10ac9c[_0x0200('0x19')][_0x0200('0x1a')]);}else{logger[_0x0200('0x12')](_0x0200('0x13'),_0x50bfc4,_0x0200('0x14'));_0x13690e(_0x10ac9c[_0x0200('0x1b')][_0x0200('0x1a')]);}})[_0x0200('0x1c')](function(_0x3185ca){logger['error'](_0x0200('0x13'),_0x50bfc4,_0x3185ca);_0x2f0f8a(_0x3185ca);});});}exports[_0x0200('0x1d')]=function(_0x2c19d1){var _0x454b67=this;return new Promise(function(_0x2a60c6,_0x2910a2){return db[_0x0200('0x1e')]['find']({'raw':_0x2c19d1[_0x0200('0x1f')]?_0x2c19d1[_0x0200('0x1f')][_0x0200('0x20')]===undefined?!![]:![]:!![],'where':_0x2c19d1[_0x0200('0x1f')]?_0x2c19d1['options'][_0x0200('0x21')]||null:null,'attributes':_0x2c19d1[_0x0200('0x1f')]?_0x2c19d1['options'][_0x0200('0x22')]||null:null,'include':_0x2c19d1[_0x0200('0x1f')]?_0x2c19d1[_0x0200('0x1f')]['include']?_[_0x0200('0x23')](_0x2c19d1[_0x0200('0x1f')]['include'],function(_0x12176a){return{'model':db[_0x12176a[_0x0200('0x24')]],'as':_0x12176a['as'],'attributes':_0x12176a[_0x0200('0x22')],'include':_0x12176a['include']?_[_0x0200('0x23')](_0x12176a['include'],function(_0x4e5987){return{'model':db[_0x4e5987[_0x0200('0x24')]],'as':_0x4e5987['as'],'attributes':_0x4e5987[_0x0200('0x22')],'include':_0x4e5987[_0x0200('0x25')]?_[_0x0200('0x23')](_0x4e5987[_0x0200('0x25')],function(_0x580ca3){return{'model':db[_0x580ca3[_0x0200('0x24')]],'as':_0x580ca3['as'],'attributes':_0x580ca3['attributes']};}):[]};}):[]};}):[]:[]})[_0x0200('0x11')](function(_0x2ab6a7){logger[_0x0200('0x12')]('ShowWhatsappAccount',_0x2c19d1);logger[_0x0200('0x15')](_0x0200('0x1d'),_0x2c19d1,JSON[_0x0200('0x17')](_0x2ab6a7));_0x2a60c6(_0x2ab6a7);})['catch'](function(_0x303a38){logger[_0x0200('0x19')](_0x0200('0x1d'),_0x303a38[_0x0200('0x1a')],_0x2c19d1);_0x2910a2(_0x454b67['error'](0x1f4,_0x303a38[_0x0200('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 9b6ab67..b7e153f 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 _0xed27=['emit','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x104d11,_0x5021ef){var _0x589063=function(_0x42d576){while(--_0x42d576){_0x104d11['push'](_0x104d11['shift']());}};_0x589063(++_0x5021ef);}(_0xed27,0x160));var _0x7ed2=function(_0x4cfbba,_0x43955d){_0x4cfbba=_0x4cfbba-0x0;var _0x597047=_0xed27[_0x4cfbba];return _0x597047;};'use strict';var WhatsappAccountEvents=require(_0x7ed2('0x0'));var events=[_0x7ed2('0x1'),'remove','update'];function createListener(_0x3e4455,_0x152d43){return function(_0x3452b6){_0x152d43[_0x7ed2('0x2')](_0x3e4455,_0x3452b6);};}function removeListener(_0xefba4a,_0x44ea9c){return function(){WhatsappAccountEvents['removeListener'](_0xefba4a,_0x44ea9c);};}exports[_0x7ed2('0x3')]=function(_0x162fb6){for(var _0x3ddca2=0x0,_0x1f24ef=events[_0x7ed2('0x4')];_0x3ddca2<_0x1f24ef;_0x3ddca2++){var _0x252ca0=events[_0x3ddca2];var _0x1c11ff=createListener(_0x7ed2('0x5')+_0x252ca0,_0x162fb6);WhatsappAccountEvents['on'](_0x252ca0,_0x1c11ff);}}; \ No newline at end of file +var _0xe12b=['remove','update','removeListener','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x5c8108,_0x3bdf2b){var _0x31d609=function(_0x1e82b2){while(--_0x1e82b2){_0x5c8108['push'](_0x5c8108['shift']());}};_0x31d609(++_0x3bdf2b);}(_0xe12b,0xfb));var _0xbe12=function(_0x54cbab,_0x4b04ea){_0x54cbab=_0x54cbab-0x0;var _0x1df487=_0xe12b[_0x54cbab];return _0x1df487;};'use strict';var WhatsappAccountEvents=require(_0xbe12('0x0'));var events=['save',_0xbe12('0x1'),_0xbe12('0x2')];function createListener(_0x353476,_0x196b17){return function(_0x47ed54){_0x196b17['emit'](_0x353476,_0x47ed54);};}function removeListener(_0x40f159,_0x16ad44){return function(){WhatsappAccountEvents[_0xbe12('0x3')](_0x40f159,_0x16ad44);};}exports['register']=function(_0x3a07a6){for(var _0x5e9163=0x0,_0x5be8e8=events[_0xbe12('0x4')];_0x5e9163<_0x5be8e8;_0x5e9163++){var _0x52ff2b=events[_0x5e9163];var _0x16430f=createListener(_0xbe12('0x5')+_0x52ff2b,_0x3a07a6);WhatsappAccountEvents['on'](_0x52ff2b,_0x16430f);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 05f50f6..79ff202 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 _0x7e47=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x3cdd83,_0x4c9216){var _0x139a73=function(_0x26b975){while(--_0x26b975){_0x3cdd83['push'](_0x3cdd83['shift']());}};_0x139a73(++_0x4c9216);}(_0x7e47,0x1b9));var _0x77e4=function(_0x18bf12,_0x13f065){_0x18bf12=_0x18bf12-0x0;var _0x4b96a7=_0x7e47[_0x18bf12];return _0x4b96a7;};'use strict';var multer=require(_0x77e4('0x0'));var util=require('util');var path=require(_0x77e4('0x1'));var timeout=require(_0x77e4('0x2'));var express=require(_0x77e4('0x3'));var router=express[_0x77e4('0x4')]();var fs_extra=require(_0x77e4('0x5'));var auth=require(_0x77e4('0x6'));var interaction=require(_0x77e4('0x7'));var config=require(_0x77e4('0x8'));var controller=require('./whatsappApplication.controller');router[_0x77e4('0x9')]('/',auth['isAuthenticated'](),controller[_0x77e4('0xa')]);router[_0x77e4('0x9')](_0x77e4('0xb'),auth[_0x77e4('0xc')](),controller[_0x77e4('0xd')]);router[_0x77e4('0xe')]('/',auth[_0x77e4('0xc')](),controller[_0x77e4('0xf')]);router[_0x77e4('0x10')]('/:id',auth[_0x77e4('0xc')](),controller[_0x77e4('0x11')]);router[_0x77e4('0x12')]('/:id',auth[_0x77e4('0xc')](),controller[_0x77e4('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa3b3=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1513af,_0x2251b0){var _0x176187=function(_0x5c2de7){while(--_0x5c2de7){_0x1513af['push'](_0x1513af['shift']());}};_0x176187(++_0x2251b0);}(_0xa3b3,0x175));var _0x3a3b=function(_0x2fc3fb,_0xfd777b){_0x2fc3fb=_0x2fc3fb-0x0;var _0x502f26=_0xa3b3[_0x2fc3fb];return _0x502f26;};'use strict';var multer=require(_0x3a3b('0x0'));var util=require(_0x3a3b('0x1'));var path=require(_0x3a3b('0x2'));var timeout=require(_0x3a3b('0x3'));var express=require(_0x3a3b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3a3b('0x5'));var interaction=require(_0x3a3b('0x6'));var config=require(_0x3a3b('0x7'));var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3a3b('0x8')]);router[_0x3a3b('0x9')](_0x3a3b('0xa'),auth[_0x3a3b('0xb')](),controller['show']);router[_0x3a3b('0xc')]('/',auth[_0x3a3b('0xb')](),controller[_0x3a3b('0xd')]);router[_0x3a3b('0xe')](_0x3a3b('0xa'),auth[_0x3a3b('0xb')](),controller['update']);router[_0x3a3b('0xf')](_0x3a3b('0xa'),auth['isAuthenticated'](),controller[_0x3a3b('0x10')]);module[_0x3a3b('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 662db4a..7701b83 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 _0x8091=['INTEGER','TEXT','STRING','*,*,*,*','exports'];(function(_0x13c359,_0xa60cee){var _0x16b7c2=function(_0x548077){while(--_0x548077){_0x13c359['push'](_0x13c359['shift']());}};_0x16b7c2(++_0xa60cee);}(_0x8091,0x16c));var _0x1809=function(_0x20995b,_0x594b67){_0x20995b=_0x20995b-0x0;var _0x27fcb1=_0x8091[_0x20995b];return _0x27fcb1;};'use strict';var Sequelize=require('sequelize');module[_0x1809('0x0')]={'priority':{'type':Sequelize[_0x1809('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1809('0x2')]()},'description':{'type':Sequelize[_0x1809('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1809('0x4')}}; \ No newline at end of file +var _0x4bfb=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x4bfb,0xcc));var _0xb4bf=function(_0x13be43,_0x1261e8){_0x13be43=_0x13be43-0x0;var _0x2b5d2f=_0x4bfb[_0x13be43];return _0x2b5d2f;};'use strict';var Sequelize=require(_0xb4bf('0x0'));module[_0xb4bf('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb4bf('0x2')],'allowNull':![],'defaultValue':_0xb4bf('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb4bf('0x2')]},'interval':{'type':Sequelize[_0xb4bf('0x2')],'defaultValue':_0xb4bf('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 16a02ad..c6898d0 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 _0x980e=['catch','update','eml-format','fast-json-patch','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body'];(function(_0x5e08ae,_0x588248){var _0x4b4a55=function(_0x3a5fe8){while(--_0x3a5fe8){_0x5e08ae['push'](_0x5e08ae['shift']());}};_0x4b4a55(++_0x588248);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe980('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe980('0x1'));var rp=require('request-promise');var moment=require(_0xe980('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe980('0x3'));var util=require(_0xe980('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xe980('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe980('0x6'));var squel=require(_0xe980('0x7'));var crypto=require(_0xe980('0x8'));var jsforce=require(_0xe980('0x9'));var deskjs=require(_0xe980('0xa'));var toCsv=require(_0xe980('0x5'));var querystring=require('querystring');var Papa=require(_0xe980('0xb'));var Redis=require(_0xe980('0xc'));var authService=require(_0xe980('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe980('0xe'));var hardwareService=require(_0xe980('0xf'));var logger=require(_0xe980('0x10'))(_0xe980('0x11'));var utils=require(_0xe980('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23c9cc,_0x234b1b){_0x234b1b=_0x234b1b||0xcc;return function(_0x58c367){if(_0x58c367){return _0x23c9cc['sendStatus'](_0x234b1b);}return _0x23c9cc[_0xe980('0x13')](_0x234b1b)[_0xe980('0x14')]();};}function respondWithResult(_0x22dc7b,_0x278b95){_0x278b95=_0x278b95||0xc8;return function(_0x21c5ff){if(_0x21c5ff){return _0x22dc7b[_0xe980('0x13')](_0x278b95)[_0xe980('0x15')](_0x21c5ff);}};}function respondWithFilteredResult(_0x4c3661,_0x5e7691){return function(_0x49771e){if(_0x49771e){var _0x594116=typeof _0x5e7691[_0xe980('0x16')]===_0xe980('0x17')&&typeof _0x5e7691[_0xe980('0x18')]===_0xe980('0x17');var _0x551a2c=_0x49771e[_0xe980('0x19')];var _0x1c6354=_0x594116?0x0:_0x5e7691[_0xe980('0x16')];var _0x538d32=_0x594116?_0x49771e['count']:_0x5e7691[_0xe980('0x16')]+_0x5e7691[_0xe980('0x18')];var _0x13e839;if(_0x538d32>=_0x551a2c){_0x538d32=_0x551a2c;_0x13e839=0xc8;}else{_0x13e839=0xce;}_0x4c3661[_0xe980('0x13')](_0x13e839);return _0x4c3661[_0xe980('0x1a')](_0xe980('0x1b'),_0x1c6354+'-'+_0x538d32+'/'+_0x551a2c)[_0xe980('0x15')](_0x49771e);}return null;};}function patchUpdates(_0x2b4c75){return function(_0x5f4db2){try{jsonpatch['apply'](_0x5f4db2,_0x2b4c75,!![]);}catch(_0x12ddc4){return BPromise[_0xe980('0x1c')](_0x12ddc4);}return _0x5f4db2[_0xe980('0x1d')]();};}function saveUpdates(_0x4f929f,_0x399973){return function(_0x31916b){if(_0x31916b){return _0x31916b['update'](_0x4f929f)[_0xe980('0x1e')](function(_0x261931){return _0x261931;});}return null;};}function removeEntity(_0x190d12,_0x4b7888){return function(_0xb9e91d){if(_0xb9e91d){return _0xb9e91d['destroy']()[_0xe980('0x1e')](function(){_0x190d12[_0xe980('0x13')](0xcc)[_0xe980('0x14')]();});}};}function handleEntityNotFound(_0x40a34e,_0x533ed6){return function(_0x11e5dd){if(!_0x11e5dd){_0x40a34e[_0xe980('0x1f')](0x194);}return _0x11e5dd;};}function handleError(_0xdc9ad7,_0x4ac608){_0x4ac608=_0x4ac608||0x1f4;return function(_0x54e755){logger[_0xe980('0x20')](_0x54e755[_0xe980('0x21')]);if(_0x54e755['name']){delete _0x54e755[_0xe980('0x22')];}_0xdc9ad7['status'](_0x4ac608)[_0xe980('0x23')](_0x54e755);};}exports[_0xe980('0x24')]=function(_0x10f084,_0x3ef831){var _0x2a6e8a={},_0x43a7c2={},_0x4caf7c={'count':0x0,'rows':[]};var _0x36aa1d=_['map'](db[_0xe980('0x25')][_0xe980('0x26')],function(_0x421ef9){return{'name':_0x421ef9[_0xe980('0x27')],'type':_0x421ef9[_0xe980('0x28')]['key']};});_0x43a7c2['model']=_[_0xe980('0x29')](_0x36aa1d,_0xe980('0x22'));_0x43a7c2[_0xe980('0x2a')]=_[_0xe980('0x2b')](_0x10f084[_0xe980('0x2a')]);_0x43a7c2[_0xe980('0x2c')]=_[_0xe980('0x2d')](_0x43a7c2[_0xe980('0x2e')],_0x43a7c2[_0xe980('0x2a')]);_0x2a6e8a[_0xe980('0x2f')]=_[_0xe980('0x2d')](_0x43a7c2['model'],qs['fields'](_0x10f084[_0xe980('0x2a')][_0xe980('0x30')]));_0x2a6e8a[_0xe980('0x2f')]=_0x2a6e8a['attributes'][_0xe980('0x31')]?_0x2a6e8a[_0xe980('0x2f')]:_0x43a7c2[_0xe980('0x2e')];if(!_0x10f084[_0xe980('0x2a')][_0xe980('0x32')](_0xe980('0x33'))){_0x2a6e8a[_0xe980('0x18')]=qs[_0xe980('0x18')](_0x10f084[_0xe980('0x2a')][_0xe980('0x18')]);_0x2a6e8a['offset']=qs['offset'](_0x10f084[_0xe980('0x2a')][_0xe980('0x16')]);}_0x2a6e8a['order']=qs[_0xe980('0x34')](_0x10f084['query'][_0xe980('0x34')]);_0x2a6e8a[_0xe980('0x35')]=qs[_0xe980('0x2c')](_[_0xe980('0x36')](_0x10f084[_0xe980('0x2a')],_0x43a7c2[_0xe980('0x2c')]),_0x36aa1d);if(_0x10f084['query'][_0xe980('0x37')]){_0x2a6e8a[_0xe980('0x35')]=_[_0xe980('0x38')](_0x2a6e8a[_0xe980('0x35')],{'$or':_[_0xe980('0x29')](_0x36aa1d,function(_0x51cf67){if(_0x51cf67[_0xe980('0x28')]!==_0xe980('0x39')){var _0x1faffe={};_0x1faffe[_0x51cf67['name']]={'$like':'%'+_0x10f084[_0xe980('0x2a')]['filter']+'%'};return _0x1faffe;}})});}_0x2a6e8a=_[_0xe980('0x38')]({},_0x2a6e8a,_0x10f084[_0xe980('0x3a')]);var _0x577d17={'where':_0x2a6e8a['where']};return db[_0xe980('0x25')][_0xe980('0x19')](_0x577d17)[_0xe980('0x1e')](function(_0x1a1d1f){_0x4caf7c[_0xe980('0x19')]=_0x1a1d1f;if(_0x10f084[_0xe980('0x2a')]['includeAll']){_0x2a6e8a[_0xe980('0x3b')]=[{'all':!![]}];}return db[_0xe980('0x25')][_0xe980('0x3c')](_0x2a6e8a);})['then'](function(_0x8e9b17){_0x4caf7c[_0xe980('0x3d')]=_0x8e9b17;return _0x4caf7c;})[_0xe980('0x1e')](respondWithFilteredResult(_0x3ef831,_0x2a6e8a))['catch'](handleError(_0x3ef831,null));};exports[_0xe980('0x3e')]=function(_0x710f6a,_0x528161){var _0x110c26={'raw':!![],'where':{'id':_0x710f6a[_0xe980('0x3f')]['id']}},_0x27d09d={};_0x27d09d[_0xe980('0x2e')]=_[_0xe980('0x2b')](db[_0xe980('0x25')]['rawAttributes']);_0x27d09d[_0xe980('0x2a')]=_[_0xe980('0x2b')](_0x710f6a[_0xe980('0x2a')]);_0x27d09d[_0xe980('0x2c')]=_['intersection'](_0x27d09d[_0xe980('0x2e')],_0x27d09d[_0xe980('0x2a')]);_0x110c26[_0xe980('0x2f')]=_[_0xe980('0x2d')](_0x27d09d[_0xe980('0x2e')],qs[_0xe980('0x30')](_0x710f6a['query'][_0xe980('0x30')]));_0x110c26[_0xe980('0x2f')]=_0x110c26[_0xe980('0x2f')][_0xe980('0x31')]?_0x110c26[_0xe980('0x2f')]:_0x27d09d[_0xe980('0x2e')];if(_0x710f6a[_0xe980('0x2a')][_0xe980('0x40')]){_0x110c26[_0xe980('0x3b')]=[{'all':!![]}];}_0x110c26=_[_0xe980('0x38')]({},_0x110c26,_0x710f6a[_0xe980('0x3a')]);return db[_0xe980('0x25')][_0xe980('0x41')](_0x110c26)[_0xe980('0x1e')](handleEntityNotFound(_0x528161,null))['then'](respondWithResult(_0x528161,null))['catch'](handleError(_0x528161,null));};exports[_0xe980('0x42')]=function(_0x40b9da,_0x5b2b7d){return db['WhatsappApplication'][_0xe980('0x42')](_0x40b9da[_0xe980('0x43')],{})[_0xe980('0x1e')](respondWithResult(_0x5b2b7d,0xc9))[_0xe980('0x44')](handleError(_0x5b2b7d,null));};exports[_0xe980('0x45')]=function(_0x5e1b39,_0x146208){if(_0x5e1b39[_0xe980('0x43')]['id']){delete _0x5e1b39[_0xe980('0x43')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x5e1b39[_0xe980('0x3f')]['id']}})[_0xe980('0x1e')](handleEntityNotFound(_0x146208,null))['then'](saveUpdates(_0x5e1b39[_0xe980('0x43')],null))['then'](respondWithResult(_0x146208,null))[_0xe980('0x44')](handleError(_0x146208,null));};exports['destroy']=function(_0x52c1b3,_0x4096f2){return db[_0xe980('0x25')][_0xe980('0x41')]({'where':{'id':_0x52c1b3[_0xe980('0x3f')]['id']}})[_0xe980('0x1e')](handleEntityNotFound(_0x4096f2,null))[_0xe980('0x1e')](removeEntity(_0x4096f2,null))['catch'](handleError(_0x4096f2,null));}; \ No newline at end of file +var _0xa809=['to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','WhatsappApplication','findAll','rows','catch','show','keys','options','find','create','body','params','rimraf','request-promise','util','path','sox'];(function(_0x3522f2,_0x26c7f6){var _0x2ec865=function(_0x177086){while(--_0x177086){_0x3522f2['push'](_0x3522f2['shift']());}};_0x2ec865(++_0x26c7f6);}(_0xa809,0x1f3));var _0x9a80=function(_0x518f34,_0x18b5c3){_0x518f34=_0x518f34-0x0;var _0x5c046f=_0xa809[_0x518f34];return _0x5c046f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a80('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a80('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9a80('0x2'));var path=require(_0x9a80('0x3'));var sox=require(_0x9a80('0x4'));var csv=require(_0x9a80('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a80('0x6'));var _=require('lodash');var squel=require(_0x9a80('0x7'));var crypto=require(_0x9a80('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x9a80('0x9'));var toCsv=require(_0x9a80('0x5'));var querystring=require(_0x9a80('0xa'));var Papa=require(_0x9a80('0xb'));var Redis=require('ioredis');var authService=require(_0x9a80('0xc'));var qs=require(_0x9a80('0xd'));var as=require(_0x9a80('0xe'));var hardwareService=require(_0x9a80('0xf'));var logger=require(_0x9a80('0x10'))(_0x9a80('0x11'));var utils=require(_0x9a80('0x12'));var config=require(_0x9a80('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a80('0x14'))['db'];function respondWithStatusCode(_0x4dc0a5,_0x123cbd){_0x123cbd=_0x123cbd||0xcc;return function(_0x33170d){if(_0x33170d){return _0x4dc0a5[_0x9a80('0x15')](_0x123cbd);}return _0x4dc0a5[_0x9a80('0x16')](_0x123cbd)[_0x9a80('0x17')]();};}function respondWithResult(_0x20a68a,_0x5a6187){_0x5a6187=_0x5a6187||0xc8;return function(_0x16c1b5){if(_0x16c1b5){return _0x20a68a['status'](_0x5a6187)[_0x9a80('0x18')](_0x16c1b5);}};}function respondWithFilteredResult(_0x109066,_0x3625b0){return function(_0x5181b5){if(_0x5181b5){var _0x3f393c=typeof _0x3625b0[_0x9a80('0x19')]===_0x9a80('0x1a')&&typeof _0x3625b0[_0x9a80('0x1b')]===_0x9a80('0x1a');var _0x5a6efc=_0x5181b5[_0x9a80('0x1c')];var _0x4bfb77=_0x3f393c?0x0:_0x3625b0[_0x9a80('0x19')];var _0x281ca5=_0x3f393c?_0x5181b5[_0x9a80('0x1c')]:_0x3625b0[_0x9a80('0x19')]+_0x3625b0['limit'];var _0x47cfe4;if(_0x281ca5>=_0x5a6efc){_0x281ca5=_0x5a6efc;_0x47cfe4=0xc8;}else{_0x47cfe4=0xce;}_0x109066[_0x9a80('0x16')](_0x47cfe4);return _0x109066[_0x9a80('0x1d')](_0x9a80('0x1e'),_0x4bfb77+'-'+_0x281ca5+'/'+_0x5a6efc)[_0x9a80('0x18')](_0x5181b5);}return null;};}function patchUpdates(_0x42e054){return function(_0x5a244c){try{jsonpatch[_0x9a80('0x1f')](_0x5a244c,_0x42e054,!![]);}catch(_0x252fd6){return BPromise[_0x9a80('0x20')](_0x252fd6);}return _0x5a244c['save']();};}function saveUpdates(_0x55ce38,_0x28d895){return function(_0x5cc1b1){if(_0x5cc1b1){return _0x5cc1b1[_0x9a80('0x21')](_0x55ce38)['then'](function(_0x125731){return _0x125731;});}return null;};}function removeEntity(_0x5e164f,_0x2601c7){return function(_0x435b4b){if(_0x435b4b){return _0x435b4b[_0x9a80('0x22')]()[_0x9a80('0x23')](function(){_0x5e164f[_0x9a80('0x16')](0xcc)[_0x9a80('0x17')]();});}};}function handleEntityNotFound(_0x4546e6,_0x1ac84d){return function(_0x52ae41){if(!_0x52ae41){_0x4546e6[_0x9a80('0x15')](0x194);}return _0x52ae41;};}function handleError(_0x39b2a5,_0x5b7f91){_0x5b7f91=_0x5b7f91||0x1f4;return function(_0x3508d7){logger[_0x9a80('0x24')](_0x3508d7['stack']);if(_0x3508d7[_0x9a80('0x25')]){delete _0x3508d7[_0x9a80('0x25')];}_0x39b2a5[_0x9a80('0x16')](_0x5b7f91)[_0x9a80('0x26')](_0x3508d7);};}exports[_0x9a80('0x27')]=function(_0x341ae5,_0x5a86d1){var _0x15a185={},_0x40db09={},_0x2f8904={'count':0x0,'rows':[]};var _0x41c043=_[_0x9a80('0x28')](db['WhatsappApplication'][_0x9a80('0x29')],function(_0x364f32){return{'name':_0x364f32[_0x9a80('0x2a')],'type':_0x364f32[_0x9a80('0x2b')]['key']};});_0x40db09[_0x9a80('0x2c')]=_[_0x9a80('0x28')](_0x41c043,_0x9a80('0x25'));_0x40db09[_0x9a80('0x2d')]=_['keys'](_0x341ae5[_0x9a80('0x2d')]);_0x40db09[_0x9a80('0x2e')]=_['intersection'](_0x40db09[_0x9a80('0x2c')],_0x40db09[_0x9a80('0x2d')]);_0x15a185[_0x9a80('0x2f')]=_[_0x9a80('0x30')](_0x40db09['model'],qs[_0x9a80('0x31')](_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x31')]));_0x15a185[_0x9a80('0x2f')]=_0x15a185[_0x9a80('0x2f')][_0x9a80('0x32')]?_0x15a185[_0x9a80('0x2f')]:_0x40db09[_0x9a80('0x2c')];if(!_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x33')](_0x9a80('0x34'))){_0x15a185[_0x9a80('0x1b')]=qs[_0x9a80('0x1b')](_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x1b')]);_0x15a185['offset']=qs['offset'](_0x341ae5['query'][_0x9a80('0x19')]);}_0x15a185[_0x9a80('0x35')]=qs[_0x9a80('0x36')](_0x341ae5['query'][_0x9a80('0x36')]);_0x15a185[_0x9a80('0x37')]=qs[_0x9a80('0x2e')](_[_0x9a80('0x38')](_0x341ae5['query'],_0x40db09['filters']),_0x41c043);if(_0x341ae5['query']['filter']){_0x15a185[_0x9a80('0x37')]=_[_0x9a80('0x39')](_0x15a185[_0x9a80('0x37')],{'$or':_['map'](_0x41c043,function(_0x44b0aa){if(_0x44b0aa['type']!==_0x9a80('0x3a')){var _0x1ea1f2={};_0x1ea1f2[_0x44b0aa[_0x9a80('0x25')]]={'$like':'%'+_0x341ae5[_0x9a80('0x2d')]['filter']+'%'};return _0x1ea1f2;}})});}_0x15a185=_[_0x9a80('0x39')]({},_0x15a185,_0x341ae5['options']);var _0x44da37={'where':_0x15a185[_0x9a80('0x37')]};return db['WhatsappApplication']['count'](_0x44da37)['then'](function(_0x2d12d8){_0x2f8904['count']=_0x2d12d8;if(_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x3b')]){_0x15a185[_0x9a80('0x3c')]=[{'all':!![]}];}return db[_0x9a80('0x3d')][_0x9a80('0x3e')](_0x15a185);})[_0x9a80('0x23')](function(_0x15c750){_0x2f8904[_0x9a80('0x3f')]=_0x15c750;return _0x2f8904;})['then'](respondWithFilteredResult(_0x5a86d1,_0x15a185))[_0x9a80('0x40')](handleError(_0x5a86d1,null));};exports[_0x9a80('0x41')]=function(_0x2644b3,_0x554073){var _0x39cb75={'raw':!![],'where':{'id':_0x2644b3['params']['id']}},_0x52094e={};_0x52094e[_0x9a80('0x2c')]=_[_0x9a80('0x42')](db[_0x9a80('0x3d')][_0x9a80('0x29')]);_0x52094e[_0x9a80('0x2d')]=_[_0x9a80('0x42')](_0x2644b3[_0x9a80('0x2d')]);_0x52094e[_0x9a80('0x2e')]=_[_0x9a80('0x30')](_0x52094e[_0x9a80('0x2c')],_0x52094e['query']);_0x39cb75[_0x9a80('0x2f')]=_['intersection'](_0x52094e[_0x9a80('0x2c')],qs[_0x9a80('0x31')](_0x2644b3['query'][_0x9a80('0x31')]));_0x39cb75[_0x9a80('0x2f')]=_0x39cb75['attributes']['length']?_0x39cb75[_0x9a80('0x2f')]:_0x52094e[_0x9a80('0x2c')];if(_0x2644b3[_0x9a80('0x2d')][_0x9a80('0x3b')]){_0x39cb75['include']=[{'all':!![]}];}_0x39cb75=_['merge']({},_0x39cb75,_0x2644b3[_0x9a80('0x43')]);return db[_0x9a80('0x3d')][_0x9a80('0x44')](_0x39cb75)['then'](handleEntityNotFound(_0x554073,null))[_0x9a80('0x23')](respondWithResult(_0x554073,null))['catch'](handleError(_0x554073,null));};exports[_0x9a80('0x45')]=function(_0x1766b8,_0x5bec53){return db[_0x9a80('0x3d')][_0x9a80('0x45')](_0x1766b8[_0x9a80('0x46')],{})[_0x9a80('0x23')](respondWithResult(_0x5bec53,0xc9))[_0x9a80('0x40')](handleError(_0x5bec53,null));};exports['update']=function(_0x4790a7,_0x4a4fe6){if(_0x4790a7['body']['id']){delete _0x4790a7[_0x9a80('0x46')]['id'];}return db[_0x9a80('0x3d')][_0x9a80('0x44')]({'where':{'id':_0x4790a7[_0x9a80('0x47')]['id']}})[_0x9a80('0x23')](handleEntityNotFound(_0x4a4fe6,null))['then'](saveUpdates(_0x4790a7[_0x9a80('0x46')],null))[_0x9a80('0x23')](respondWithResult(_0x4a4fe6,null))[_0x9a80('0x40')](handleError(_0x4a4fe6,null));};exports[_0x9a80('0x22')]=function(_0x124e31,_0x4c742a){return db['WhatsappApplication'][_0x9a80('0x44')]({'where':{'id':_0x124e31[_0x9a80('0x47')]['id']}})[_0x9a80('0x23')](handleEntityNotFound(_0x4c742a,null))[_0x9a80('0x23')](removeEntity(_0x4c742a,null))[_0x9a80('0x40')](handleError(_0x4c742a,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index da8f84f..ba0c1f3 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 _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','WhatsappApplication','whatsapp_applications','lodash','../../config/logger','moment'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xa8eb,0x179));var _0xba8e=function(_0x2c98a0,_0x49f71c){_0x2c98a0=_0x2c98a0-0x0;var _0x4e58ac=_0xa8eb[_0x2c98a0];return _0x4e58ac;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./whatsappApplication.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc997=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x371844,_0x5916fb){var _0x56f7d6=function(_0x29000c){while(--_0x29000c){_0x371844['push'](_0x371844['shift']());}};_0x56f7d6(++_0x5916fb);}(_0xc997,0x1ac));var _0x7c99=function(_0x464694,_0x5cf71c){_0x464694=_0x464694-0x0;var _0x5590c4=_0xc997[_0x464694];return _0x5590c4;};'use strict';var _=require('lodash');var util=require(_0x7c99('0x0'));var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c99('0x5'));var rimraf=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var attributes=require(_0x7c99('0x8'));module[_0x7c99('0x9')]=function(_0x404ffb,_0x1a21e1){return _0x404ffb[_0x7c99('0xa')]('WhatsappApplication',attributes,{'tableName':_0x7c99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c99('0xc'),'collate':_0x7c99('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index cdf04f9..17a9340 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 _0xd2ea=['../../config/environment','jayson/promise','client','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x30f98d,_0x3e1e06){var _0x1bef3d=function(_0x17c814){while(--_0x17c814){_0x30f98d['push'](_0x30f98d['shift']());}};_0x1bef3d(++_0x3e1e06);}(_0xd2ea,0x15f));var _0xad2e=function(_0xd56921,_0x2dea77){_0xd56921=_0xd56921-0x0;var _0x1ac000=_0xd2ea[_0xd56921];return _0x1ac000;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file +var _0x33c5=['then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x33c5,0xe6));var _0x533c=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0x33c5[_0x3f59b1];return _0x11d2e8;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c608ed4..72b76b0 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 _0x9505=['describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index'];(function(_0x2eb542,_0x5387d3){var _0x15eb27=function(_0x1a4ac9){while(--_0x1a4ac9){_0x2eb542['push'](_0x2eb542['shift']());}};_0x15eb27(++_0x5387d3);}(_0x9505,0x1e5));var _0x5950=function(_0x2812fa,_0x4628e2){_0x2812fa=_0x2812fa-0x0;var _0x577c05=_0x9505[_0x2812fa];return _0x577c05;};'use strict';var multer=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var path=require('path');var timeout=require(_0x5950('0x2'));var express=require(_0x5950('0x3'));var router=express[_0x5950('0x4')]();var fs_extra=require(_0x5950('0x5'));var auth=require(_0x5950('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5950('0x7'));router[_0x5950('0x8')]('/',auth[_0x5950('0x9')](),controller[_0x5950('0xa')]);router['get']('/describe',auth[_0x5950('0x9')](),controller[_0x5950('0xb')]);router[_0x5950('0x8')](_0x5950('0xc'),auth[_0x5950('0x9')](),controller[_0x5950('0xd')]);router[_0x5950('0x8')](_0x5950('0xe'),auth[_0x5950('0x9')](),controller['getMessages']);router[_0x5950('0x8')](_0x5950('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x5950('0x10')]('/',auth[_0x5950('0x9')](),controller[_0x5950('0x11')]);router[_0x5950('0x10')](_0x5950('0xe'),auth[_0x5950('0x9')](),controller[_0x5950('0x12')]);router[_0x5950('0x10')](_0x5950('0x13'),auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x16')),controller[_0x5950('0x17')]);router[_0x5950('0x18')](_0x5950('0xc'),auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x19')),controller[_0x5950('0x1a')]);router['delete']('/:id',auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x1b')),controller[_0x5950('0x1c')]);router['delete']('/:id/tags',auth[_0x5950('0x9')](),controller[_0x5950('0x1d')]);module[_0x5950('0x1e')]=router; \ No newline at end of file +var _0xee14=['addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xee14,0x13a));var _0x4ee1=function(_0x1da760,_0x1e26a6){_0x1da760=_0x1da760-0x0;var _0x4f8b30=_0xee14[_0x1da760];return _0x4f8b30;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var fs_extra=require(_0x4ee1('0x4'));var auth=require(_0x4ee1('0x5'));var interaction=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var controller=require(_0x4ee1('0x8'));router['get']('/',auth[_0x4ee1('0x9')](),controller['index']);router[_0x4ee1('0xa')](_0x4ee1('0xb'),auth[_0x4ee1('0x9')](),controller[_0x4ee1('0xc')]);router[_0x4ee1('0xa')](_0x4ee1('0xd'),auth['isAuthenticated'](),controller[_0x4ee1('0xe')]);router[_0x4ee1('0xa')]('/:id/messages',auth[_0x4ee1('0x9')](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0xa')](_0x4ee1('0x10'),auth['isAuthenticated'](),controller[_0x4ee1('0x11')]);router[_0x4ee1('0x12')]('/',auth[_0x4ee1('0x9')](),controller[_0x4ee1('0x13')]);router[_0x4ee1('0x12')](_0x4ee1('0x14'),auth['isAuthenticated'](),controller[_0x4ee1('0x15')]);router[_0x4ee1('0x12')](_0x4ee1('0x16'),auth[_0x4ee1('0x9')](),interaction[_0x4ee1('0x17')](_0x4ee1('0x18'),_0x4ee1('0x19')),controller[_0x4ee1('0x1a')]);router[_0x4ee1('0x1b')]('/:id',auth[_0x4ee1('0x9')](),interaction[_0x4ee1('0x17')](_0x4ee1('0x18'),_0x4ee1('0x1c')),controller[_0x4ee1('0x1d')]);router[_0x4ee1('0x1e')](_0x4ee1('0xd'),auth[_0x4ee1('0x9')](),interaction[_0x4ee1('0x17')](_0x4ee1('0x18'),_0x4ee1('0x1f')),controller['destroy']);router[_0x4ee1('0x1e')](_0x4ee1('0x16'),auth[_0x4ee1('0x9')](),controller[_0x4ee1('0x20')]);module[_0x4ee1('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index cb92601..fa7fee0 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 _0x04f9=['STRING','DATE','out','ENUM','moment','exports','BOOLEAN'];(function(_0x10fafd,_0x45a4b9){var _0xfbee03=function(_0x2e8621){while(--_0x2e8621){_0x10fafd['push'](_0x10fafd['shift']());}};_0xfbee03(++_0x45a4b9);}(_0x04f9,0xb3));var _0x904f=function(_0x577558,_0x55959d){_0x577558=_0x577558-0x0;var _0x2fd1f2=_0x04f9[_0x577558];return _0x2fd1f2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x904f('0x0'));module[_0x904f('0x1')]={'closed':{'type':Sequelize[_0x904f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x904f('0x3')]},'secondDisposition':{'type':Sequelize[_0x904f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x904f('0x3')]},'note':{'type':Sequelize[_0x904f('0x3')]},'phone':{'type':Sequelize[_0x904f('0x3')]},'read1stAt':{'type':Sequelize[_0x904f('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x904f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x904f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x904f('0x6')]('in',_0x904f('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x904f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x5031=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x39a387,_0x496459){var _0x4d9420=function(_0x2b9cda){while(--_0x2b9cda){_0x39a387['push'](_0x39a387['shift']());}};_0x4d9420(++_0x496459);}(_0x5031,0x144));var _0x1503=function(_0xa226b0,_0x167a45){_0xa226b0=_0xa226b0-0x0;var _0x13c645=_0x5031[_0xa226b0];return _0x13c645;};'use strict';var Sequelize=require(_0x1503('0x0'));var moment=require(_0x1503('0x1'));module[_0x1503('0x2')]={'closed':{'type':Sequelize[_0x1503('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1503('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1503('0x5')]},'note':{'type':Sequelize[_0x1503('0x5')]},'phone':{'type':Sequelize[_0x1503('0x5')]},'read1stAt':{'type':Sequelize[_0x1503('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1503('0x6')]('in',_0x1503('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1503('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1503('0x6')]('in',_0x1503('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 9c5779f..d56742d 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 _0x0037=['addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','fullname','CmContact','firstName','Attachment','Messages','createdAt','secret','read','Account','User','Owner','get','N.A.','closed','toString','disposition','basename','createReadStream','createWriteStream','out','System','Contact','lastName','renderFile','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','undefined','limit','set','update','then','sendStatus','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','catch','show','params','model','filters','attributes','intersection','fields','length','include','merge','find','create','body','destroy','describe','addMessage','WhatsappMessage','ids','hasOwnProperty','nolimit','offset','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','count','includeAll'];(function(_0x24ed26,_0x90a05a){var _0x563455=function(_0x3489a7){while(--_0x3489a7){_0x24ed26['push'](_0x24ed26['shift']());}};_0x563455(++_0x90a05a);}(_0x0037,0x127));var _0x7003=function(_0x217892,_0x5ef80a){_0x217892=_0x217892-0x0;var _0x17a0ab=_0x0037[_0x217892];return _0x17a0ab;};'use strict';var rimraf=require(_0x7003('0x0'));var zipdir=require(_0x7003('0x1'));var moment=require(_0x7003('0x2'));var BPromise=require(_0x7003('0x3'));var util=require(_0x7003('0x4'));var path=require(_0x7003('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x7003('0x6'));var interaction=require(_0x7003('0x7'));var qs=require(_0x7003('0x8'));var pdf=require(_0x7003('0x9'));var logger=require(_0x7003('0xa'))(_0x7003('0xb'));var config=require(_0x7003('0xc'));var db=require(_0x7003('0xd'))['db'];config[_0x7003('0xe')]=_[_0x7003('0xf')](config[_0x7003('0xe')],{'host':_0x7003('0x10'),'port':0x18eb});var socket=require(_0x7003('0x11'))(new Redis(config[_0x7003('0xe')]));require(_0x7003('0x12'))[_0x7003('0x13')](socket);function respondWithStatusCode(_0x5d7db6,_0x2d1f76){_0x2d1f76=_0x2d1f76||0xcc;return function(_0x43b8d5){if(_0x43b8d5){return _0x5d7db6['sendStatus'](_0x2d1f76);}return _0x5d7db6[_0x7003('0x14')](_0x2d1f76)[_0x7003('0x15')]();};}function respondWithResult(_0x110580,_0x5d4ad9){_0x5d4ad9=_0x5d4ad9||0xc8;return function(_0xdc3547){if(_0xdc3547){return _0x110580['status'](_0x5d4ad9)['json'](_0xdc3547);}};}function respondWithFilteredResult(_0x53bce6,_0x316c88){return function(_0x566b5d){if(_0x566b5d){var _0x90e1ec=typeof _0x316c88['offset']===_0x7003('0x16')&&typeof _0x316c88[_0x7003('0x17')]===_0x7003('0x16');var _0x5d2c81=_0x566b5d['count'];var _0x36dd6b=_0x90e1ec?0x0:_0x316c88['offset'];var _0x170ea3=_0x90e1ec?_0x566b5d['count']:_0x316c88['offset']+_0x316c88[_0x7003('0x17')];var _0x5e00d1;if(_0x170ea3>=_0x5d2c81){_0x170ea3=_0x5d2c81;_0x5e00d1=0xc8;}else{_0x5e00d1=0xce;}_0x53bce6['status'](_0x5e00d1);return _0x53bce6[_0x7003('0x18')]('Content-Range',_0x36dd6b+'-'+_0x170ea3+'/'+_0x5d2c81)['json'](_0x566b5d);}return null;};}function saveUpdates(_0x12ef04){return function(_0x48333c){if(_0x48333c){return _0x48333c[_0x7003('0x19')](_0x12ef04)[_0x7003('0x1a')](function(_0x250aad){return _0x250aad;});}return null;};}function removeEntity(_0xf419af){return function(_0x42af42){if(_0x42af42){return _0x42af42['destroy']()[_0x7003('0x1a')](function(){_0xf419af[_0x7003('0x14')](0xcc)[_0x7003('0x15')]();});}};}function handleEntityNotFound(_0x16303){return function(_0x30a5d5){if(!_0x30a5d5){_0x16303[_0x7003('0x1b')](0x194);}return _0x30a5d5;};}function handleError(_0x25fb69,_0x2c2fe0){_0x2c2fe0=_0x2c2fe0||0x1f4;return function(_0x44971a){logger[_0x7003('0x1c')](_0x44971a[_0x7003('0x1d')]);if(_0x44971a[_0x7003('0x1e')]){delete _0x44971a[_0x7003('0x1e')];}_0x25fb69[_0x7003('0x14')](_0x2c2fe0)['send'](_0x44971a);};}exports[_0x7003('0x1f')]=function(_0x1c6c98,_0x5c5009){var _0x253569={};var _0x3a3dcd=_[_0x7003('0x20')](db[_0x7003('0x21')][_0x7003('0x22')],function(_0x1493d0){return{'name':_0x1493d0[_0x7003('0x23')],'type':_0x1493d0[_0x7003('0x24')][_0x7003('0x25')]};});_0x253569=qs[_0x7003('0x26')](_0x3a3dcd,_0x1c6c98);return interaction[_0x7003('0x27')](_0x7003('0x28'),_0x1c6c98[_0x7003('0x29')],_0x1c6c98[_0x7003('0x2a')],_0x253569,_0x3a3dcd)[_0x7003('0x1a')](respondWithFilteredResult(_0x5c5009,_0x253569))[_0x7003('0x2b')](handleError(_0x5c5009,null));};exports[_0x7003('0x2c')]=function(_0x4fc188,_0x4f1fa7){var _0x2a2ea7={'raw':![],'where':{'id':_0x4fc188[_0x7003('0x2d')]['id']}},_0x40aeca={};_0x40aeca[_0x7003('0x2e')]=_['keys'](db['WhatsappInteraction'][_0x7003('0x22')]);_0x40aeca['query']=_['keys'](_0x4fc188['query']);_0x40aeca[_0x7003('0x2f')]=_['intersection'](_0x40aeca['model'],_0x40aeca[_0x7003('0x29')]);_0x2a2ea7[_0x7003('0x30')]=_[_0x7003('0x31')](_0x40aeca[_0x7003('0x2e')],qs['fields'](_0x4fc188[_0x7003('0x29')][_0x7003('0x32')]));_0x2a2ea7['attributes']=_0x2a2ea7['attributes'][_0x7003('0x33')]?_0x2a2ea7[_0x7003('0x30')]:_0x40aeca[_0x7003('0x2e')];if(_0x4fc188[_0x7003('0x29')]['includeAll']){_0x2a2ea7[_0x7003('0x34')]=[{'all':!![]}];}_0x2a2ea7=_[_0x7003('0x35')]({},_0x2a2ea7,_0x4fc188['options']);return db[_0x7003('0x21')][_0x7003('0x36')](_0x2a2ea7)['then'](handleEntityNotFound(_0x4f1fa7,null))[_0x7003('0x1a')](respondWithResult(_0x4f1fa7,null))[_0x7003('0x2b')](handleError(_0x4f1fa7,null));};exports[_0x7003('0x37')]=function(_0x14c2de,_0xc1da33){return db[_0x7003('0x21')][_0x7003('0x37')](_0x14c2de['body'],{})[_0x7003('0x1a')](respondWithResult(_0xc1da33,0xc9))[_0x7003('0x2b')](handleError(_0xc1da33,null));};exports[_0x7003('0x19')]=function(_0x217da8,_0x1ff0ee){if(_0x217da8[_0x7003('0x38')]['id']){delete _0x217da8['body']['id'];}return db[_0x7003('0x21')][_0x7003('0x36')]({'where':{'id':_0x217da8[_0x7003('0x2d')]['id']}})[_0x7003('0x1a')](handleEntityNotFound(_0x1ff0ee,null))['then'](saveUpdates(_0x217da8['body'],null))[_0x7003('0x1a')](respondWithResult(_0x1ff0ee,null))[_0x7003('0x2b')](handleError(_0x1ff0ee,null));};exports[_0x7003('0x39')]=function(_0x3ae51d,_0xa1c992){return db[_0x7003('0x21')][_0x7003('0x36')]({'where':{'id':_0x3ae51d[_0x7003('0x2d')]['id']}})['then'](handleEntityNotFound(_0xa1c992,null))['then'](removeEntity(_0xa1c992,null))[_0x7003('0x2b')](handleError(_0xa1c992,null));};exports[_0x7003('0x3a')]=function(_0x3bf481,_0x3c7889){return db[_0x7003('0x21')][_0x7003('0x3a')]()[_0x7003('0x1a')](respondWithResult(_0x3c7889,null))['catch'](handleError(_0x3c7889,null));};exports[_0x7003('0x3b')]=function(_0x4aa7c7,_0x514f0a){return db[_0x7003('0x3c')][_0x7003('0x36')]({'where':{'id':_0x4aa7c7[_0x7003('0x2d')]['id']}})[_0x7003('0x1a')](handleEntityNotFound(_0x514f0a,null))[_0x7003('0x1a')](function(_0x5d1253){if(_0x5d1253){return _0x5d1253[_0x7003('0x3b')](_0x4aa7c7[_0x7003('0x38')][_0x7003('0x3d')],_['omit'](_0x4aa7c7[_0x7003('0x38')],[_0x7003('0x3d'),'id'])||{});}})[_0x7003('0x1a')](respondWithResult(_0x514f0a,null))[_0x7003('0x2b')](handleError(_0x514f0a,null));};exports['getMessages']=function(_0x932725,_0x4efc31){var _0x3df75b={'raw':![],'where':{}};var _0x5273c1={};var _0x5b9f7d={'count':0x0,'rows':[]};return db[_0x7003('0x21')]['findOne']({'where':{'id':_0x932725[_0x7003('0x2d')]['id']}})[_0x7003('0x1a')](handleEntityNotFound(_0x4efc31,null))[_0x7003('0x1a')](function(_0x36be46){if(_0x36be46){_0x5273c1[_0x7003('0x2e')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x5273c1[_0x7003('0x29')]=_['keys'](_0x932725[_0x7003('0x29')]);_0x5273c1['filters']=_[_0x7003('0x31')](_0x5273c1['model'],_0x5273c1['query']);_0x3df75b[_0x7003('0x30')]=_[_0x7003('0x31')](_0x5273c1['model'],qs[_0x7003('0x32')](_0x932725[_0x7003('0x29')][_0x7003('0x32')]));_0x3df75b['attributes']=_0x3df75b[_0x7003('0x30')][_0x7003('0x33')]?_0x3df75b[_0x7003('0x30')]:_0x5273c1['model'];if(!_0x932725[_0x7003('0x29')][_0x7003('0x3e')](_0x7003('0x3f'))){_0x3df75b[_0x7003('0x17')]=qs[_0x7003('0x17')](_0x932725[_0x7003('0x29')][_0x7003('0x17')]);_0x3df75b[_0x7003('0x40')]=qs[_0x7003('0x40')](_0x932725['query'][_0x7003('0x40')]);}_0x3df75b['order']=qs[_0x7003('0x41')](_0x932725['query'][_0x7003('0x41')]);_0x3df75b[_0x7003('0x42')]=qs[_0x7003('0x2f')](_[_0x7003('0x43')](_0x932725[_0x7003('0x29')],_0x5273c1['filters']));_0x3df75b[_0x7003('0x42')][_0x7003('0x44')]=_0x36be46['id'];if(_0x932725[_0x7003('0x29')][_0x7003('0x45')]){_0x3df75b['where']=_['merge'](_0x3df75b[_0x7003('0x42')],{'$or':_[_0x7003('0x20')](_0x3df75b[_0x7003('0x30')],function(_0xcee90c){var _0x5ad34a={};_0x5ad34a[_0xcee90c]={'$like':'%'+_0x932725[_0x7003('0x29')]['filter']+'%'};return _0x5ad34a;})});}if(_0x932725[_0x7003('0x29')]['$gte']){var _0x9f6067=_0x932725[_0x7003('0x29')][_0x7003('0x46')][_0x7003('0x47')](',');var _0x514aa3={};_0x514aa3[_0x9f6067[0x0]]={'$gte':moment(_0x9f6067[0x1])[_0x7003('0x48')](_0x7003('0x49'))};_0x3df75b[_0x7003('0x42')]=_[_0x7003('0x35')](_0x3df75b[_0x7003('0x42')],_0x514aa3);}_0x3df75b=_['merge']({},_0x3df75b,_0x932725[_0x7003('0x4a')]);return db[_0x7003('0x3c')][_0x7003('0x4b')]({'where':_0x3df75b[_0x7003('0x42')]})[_0x7003('0x1a')](function(_0x15aaf5){_0x5b9f7d[_0x7003('0x4b')]=_0x15aaf5;if(_0x932725[_0x7003('0x29')][_0x7003('0x4c')]){_0x3df75b[_0x7003('0x34')]=[{'all':!![]}];}return db[_0x7003('0x3c')][_0x7003('0x27')](_0x3df75b);})[_0x7003('0x1a')](function(_0x2f5b03){_0x5b9f7d['rows']=_0x2f5b03;return _0x5b9f7d;});}})['then'](respondWithFilteredResult(_0x4efc31,_0x3df75b))[_0x7003('0x2b')](handleError(_0x4efc31,null));};exports[_0x7003('0x4d')]=function(_0x4ccbef,_0x35af9a){return db[_0x7003('0x21')][_0x7003('0x36')]({'where':{'id':_0x4ccbef[_0x7003('0x2d')]['id']}})[_0x7003('0x1a')](handleEntityNotFound(_0x35af9a,null))[_0x7003('0x1a')](function(_0x4af23c){if(_0x4af23c){return _0x4af23c[_0x7003('0x4e')](_0x4ccbef[_0x7003('0x38')][_0x7003('0x3d')],_['omit'](_0x4ccbef[_0x7003('0x38')],[_0x7003('0x3d'),'id'])||{})[_0x7003('0x4f')](function(){return db[_0x7003('0x50')][_0x7003('0x27')]({'attributes':['id',_0x7003('0x1e'),'color'],'where':{'id':_0x4ccbef['body'][_0x7003('0x3d')]}});})[_0x7003('0x1a')](function(_0x45b981){socket[_0x7003('0x51')](_0x7003('0x52'),{'id':Number(_0x4ccbef['params']['id']),'tags':_0x45b981||[]});return{'id':Number(_0x4ccbef[_0x7003('0x2d')]['id']),'tags':_0x45b981||[]};});}})[_0x7003('0x1a')](respondWithResult(_0x35af9a,null))[_0x7003('0x2b')](handleError(_0x35af9a,null));};exports[_0x7003('0x53')]=function(_0x5c822a,_0x1c7a06){return db[_0x7003('0x21')][_0x7003('0x36')]({'where':{'id':_0x5c822a[_0x7003('0x2d')]['id']}})[_0x7003('0x1a')](handleEntityNotFound(_0x1c7a06,null))[_0x7003('0x1a')](function(_0x330211){if(_0x330211){return _0x330211['removeTags'](_0x5c822a['query'][_0x7003('0x3d')]);}})[_0x7003('0x1a')](respondWithStatusCode(_0x1c7a06,null))[_0x7003('0x2b')](handleError(_0x1c7a06,null));};exports[_0x7003('0x54')]=function(_0x548a19,_0x180f50){var _0x153250=moment()[_0x7003('0x55')]()['toString']();var _0x288f7e=path[_0x7003('0x56')](config[_0x7003('0x57')],_0x7003('0x58'),_0x7003('0x59'),_0x7003('0x5a'));var _0x2f1d59=path[_0x7003('0x56')](config[_0x7003('0x57')],'server',_0x7003('0x59'),_0x7003('0x5b'));var _0x19c9b9=path['join'](_0x288f7e,_0x153250);var _0x19a595=util['format'](_0x7003('0x5c'),_0x548a19[_0x7003('0x2d')]['id'],_0x153250);var _0x1c1071=path['join'](_0x288f7e,_0x19a595);var _0x3a7c0c=[];_0x3a7c0c[_0x7003('0x5d')]({'model':db['User'],'as':'User','attributes':['id',_0x7003('0x5e')],'raw':!![]});_0x3a7c0c[_0x7003('0x5d')]({'model':db[_0x7003('0x5f')],'as':'Contact','attributes':['id',_0x7003('0x60'),'lastName'],'raw':!![]});if(_0x548a19[_0x7003('0x29')]['attachments']){_0x3a7c0c[_0x7003('0x5d')]({'model':db[_0x7003('0x61')],'as':_0x7003('0x61'),'raw':!![]});}var _0x52bf54=[{'model':db[_0x7003('0x3c')],'as':_0x7003('0x62'),'attributes':['id',_0x7003('0x38'),_0x7003('0x63'),'direction',_0x7003('0x64'),_0x7003('0x65')],'include':_0x3a7c0c}];_0x52bf54['push']({'model':db['WhatsappAccount'],'as':_0x7003('0x66'),'attributes':['id',_0x7003('0x1e')]});_0x52bf54[_0x7003('0x5d')]({'model':db[_0x7003('0x67')],'as':_0x7003('0x68'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0x548a19[_0x7003('0x2d')]['id']},'include':_0x52bf54})[_0x7003('0x1a')](handleEntityNotFound(_0x180f50,null))[_0x7003('0x1a')](function(_0x4aecd7){if(_0x4aecd7){var _0x323334=_0x4aecd7[_0x7003('0x69')]({'plain':!![]});fs['mkdirSync'](_0x19c9b9);var _0x1ca5e4={'channel':'Whatsapp','account':_0x323334['Account']['name'],'agent':_0x323334[_0x7003('0x68')]?_0x323334[_0x7003('0x68')][_0x7003('0x5e')]:_0x7003('0x6a'),'createdAt':moment(_0x323334[_0x7003('0x63')])[_0x7003('0x48')](_0x7003('0x49'))['toString'](),'closedAt':_0x323334[_0x7003('0x6b')]?moment(_0x323334['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7003('0x6c')]():'','disposition':_0x323334[_0x7003('0x6d')],'messages':_(_0x323334[_0x7003('0x62')])[_0x7003('0x45')]({'secret':![]})[_0x7003('0x20')](function(_0x3a9cc8){if(_0x3a9cc8[_0x7003('0x61')]){var _0x2f867d=path[_0x7003('0x56')](_0x2f1d59,_0x3a9cc8[_0x7003('0x61')][_0x7003('0x6e')]);if(fs['existsSync'](_0x2f867d)){fs[_0x7003('0x6f')](_0x2f867d)['pipe'](fs[_0x7003('0x70')](path[_0x7003('0x56')](_0x19c9b9,_0x3a9cc8[_0x7003('0x61')][_0x7003('0x6e')])));}}return{'date':moment(_0x3a9cc8['createdAt'])['format'](_0x7003('0x49'))[_0x7003('0x6c')](),'sender':_0x3a9cc8['direction']===_0x7003('0x71')?_0x3a9cc8[_0x7003('0x67')]?_0x3a9cc8[_0x7003('0x67')]['fullname']:_0x7003('0x72'):_0x3a9cc8[_0x7003('0x73')]['firstName']+(_0x3a9cc8[_0x7003('0x73')]['lastName']?'\x20'+_0x3a9cc8[_0x7003('0x73')][_0x7003('0x74')]:''),'body':_0x3a9cc8[_0x7003('0x61')]?_0x3a9cc8[_0x7003('0x61')][_0x7003('0x6e')]:_0x3a9cc8[_0x7003('0x38')],'direction':_0x3a9cc8['direction']===_0x7003('0x71')?'A':'C','secret':_0x3a9cc8['secret'],'read':_0x3a9cc8['read'],'attachment':_0x3a9cc8['Attachment']};})['value']()};return ejs[_0x7003('0x75')](path[_0x7003('0x56')](config[_0x7003('0x57')],_0x7003('0x58'),'views','downloadInteraction.ejs'),{'interaction':_0x1ca5e4})[_0x7003('0x1a')](function(_0x357b2d){var _0x58b146=path[_0x7003('0x56')](_0x19c9b9,_0x7003('0x76')+_0x323334['id']+'-'+_0x153250+_0x7003('0x77'));var _0xc68d5c={'path':_0x58b146,'channel':_0x7003('0x78'),'interactionId':_0x323334['id']};return pdf[_0x7003('0x79')](_0x357b2d,_0xc68d5c);})[_0x7003('0x1a')](function(){return new BPromise(function(_0x5b281f,_0x150003){zipdir(_0x19c9b9,{'saveTo':_0x1c1071},function(_0x4da6f8,_0xc5ed78){if(_0x4da6f8)return _0x150003(_0x4da6f8);return _0x5b281f(_0xc5ed78);});})[_0x7003('0x1a')](function(){return new BPromise(function(_0x2c3ada,_0x2b2baf){rimraf(_0x19c9b9,function(_0x5b134a){if(_0x5b134a)_0x2b2baf(_0x5b134a);return _0x2c3ada();});});})[_0x7003('0x1a')](function(){return _0x180f50['download'](_0x1c1071,_0x19a595,function(_0x379413){if(_0x379413){console[_0x7003('0x7a')](_0x7003('0x7b'),_0x379413);}else{fs['unlinkSync'](_0x1c1071);}});});});}else{return _0x180f50[_0x7003('0x1b')](0xc8);}})[_0x7003('0x2b')](handleError(_0x180f50,null));}; \ No newline at end of file +var _0x79d7=['CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','toString','closed','disposition','basename','existsSync','createReadStream','createWriteStream','out','System','direction','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','redis','defaults','./whatsappInteraction.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','WhatsappInteraction','fieldName','type','getOptions','findAll','whatsapp','user','catch','show','params','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','WhatsappMessage','ids','hasOwnProperty','nolimit','sort','pick','where','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','omit','spread','color','removeTags','download','unix','server','tmp','root','files','join','transcript-%d-%s.zip','push','User','fullname'];(function(_0x1d686d,_0x570427){var _0x7e5e7=function(_0x1c44d3){while(--_0x1c44d3){_0x1d686d['push'](_0x1d686d['shift']());}};_0x7e5e7(++_0x570427);}(_0x79d7,0x9c));var _0x779d=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x79d7[_0x3511d3];return _0x5d6321;};'use strict';var rimraf=require(_0x779d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x779d('0x1'));var BPromise=require(_0x779d('0x2'));var util=require(_0x779d('0x3'));var path=require(_0x779d('0x4'));var ejs=require(_0x779d('0x5'));var fs=require('fs');var _=require(_0x779d('0x6'));var Redis=require('ioredis');var interaction=require(_0x779d('0x7'));var qs=require(_0x779d('0x8'));var pdf=require(_0x779d('0x9'));var logger=require('../../config/logger')('api');var config=require(_0x779d('0xa'));var db=require('../../mysqldb')['db'];config[_0x779d('0xb')]=_[_0x779d('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x779d('0xd'))[_0x779d('0xe')](socket);function respondWithStatusCode(_0x3c820b,_0x505e77){_0x505e77=_0x505e77||0xcc;return function(_0x19f327){if(_0x19f327){return _0x3c820b['sendStatus'](_0x505e77);}return _0x3c820b[_0x779d('0xf')](_0x505e77)['end']();};}function respondWithResult(_0x4af5ab,_0x3b9ca0){_0x3b9ca0=_0x3b9ca0||0xc8;return function(_0x25948b){if(_0x25948b){return _0x4af5ab['status'](_0x3b9ca0)[_0x779d('0x10')](_0x25948b);}};}function respondWithFilteredResult(_0x40495a,_0x41a740){return function(_0x409ab5){if(_0x409ab5){var _0x279153=typeof _0x41a740[_0x779d('0x11')]==='undefined'&&typeof _0x41a740[_0x779d('0x12')]===_0x779d('0x13');var _0x2a0678=_0x409ab5[_0x779d('0x14')];var _0x1c7ad7=_0x279153?0x0:_0x41a740['offset'];var _0x26dfa2=_0x279153?_0x409ab5[_0x779d('0x14')]:_0x41a740[_0x779d('0x11')]+_0x41a740['limit'];var _0x13c843;if(_0x26dfa2>=_0x2a0678){_0x26dfa2=_0x2a0678;_0x13c843=0xc8;}else{_0x13c843=0xce;}_0x40495a[_0x779d('0xf')](_0x13c843);return _0x40495a[_0x779d('0x15')](_0x779d('0x16'),_0x1c7ad7+'-'+_0x26dfa2+'/'+_0x2a0678)[_0x779d('0x10')](_0x409ab5);}return null;};}function saveUpdates(_0x21102d){return function(_0x428186){if(_0x428186){return _0x428186[_0x779d('0x17')](_0x21102d)[_0x779d('0x18')](function(_0x4192c){return _0x4192c;});}return null;};}function removeEntity(_0x2629b3){return function(_0x373abb){if(_0x373abb){return _0x373abb[_0x779d('0x19')]()['then'](function(){_0x2629b3[_0x779d('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e81b9){return function(_0x4d0f40){if(!_0x4d0f40){_0x2e81b9[_0x779d('0x1a')](0x194);}return _0x4d0f40;};}function handleError(_0x4173cb,_0xffa3e){_0xffa3e=_0xffa3e||0x1f4;return function(_0x2d4e36){logger['error'](_0x2d4e36[_0x779d('0x1b')]);if(_0x2d4e36[_0x779d('0x1c')]){delete _0x2d4e36[_0x779d('0x1c')];}_0x4173cb[_0x779d('0xf')](_0xffa3e)[_0x779d('0x1d')](_0x2d4e36);};}exports[_0x779d('0x1e')]=function(_0x2fca0a,_0x42bc01){var _0x1e2ab5={};var _0x347af8=_['map'](db[_0x779d('0x1f')]['rawAttributes'],function(_0x5d7ab5){return{'name':_0x5d7ab5[_0x779d('0x20')],'type':_0x5d7ab5[_0x779d('0x21')]['key']};});_0x1e2ab5=qs[_0x779d('0x22')](_0x347af8,_0x2fca0a);return interaction[_0x779d('0x23')](_0x779d('0x24'),_0x2fca0a['query'],_0x2fca0a[_0x779d('0x25')],_0x1e2ab5,_0x347af8)[_0x779d('0x18')](respondWithFilteredResult(_0x42bc01,_0x1e2ab5))[_0x779d('0x26')](handleError(_0x42bc01,null));};exports[_0x779d('0x27')]=function(_0x23d5ea,_0x882d18){var _0x5e1611={'raw':![],'where':{'id':_0x23d5ea[_0x779d('0x28')]['id']}},_0x12714c={};_0x12714c[_0x779d('0x29')]=_[_0x779d('0x2a')](db[_0x779d('0x1f')][_0x779d('0x2b')]);_0x12714c[_0x779d('0x2c')]=_[_0x779d('0x2a')](_0x23d5ea[_0x779d('0x2c')]);_0x12714c[_0x779d('0x2d')]=_['intersection'](_0x12714c[_0x779d('0x29')],_0x12714c[_0x779d('0x2c')]);_0x5e1611[_0x779d('0x2e')]=_[_0x779d('0x2f')](_0x12714c[_0x779d('0x29')],qs[_0x779d('0x30')](_0x23d5ea[_0x779d('0x2c')][_0x779d('0x30')]));_0x5e1611[_0x779d('0x2e')]=_0x5e1611['attributes'][_0x779d('0x31')]?_0x5e1611[_0x779d('0x2e')]:_0x12714c[_0x779d('0x29')];if(_0x23d5ea['query'][_0x779d('0x32')]){_0x5e1611[_0x779d('0x33')]=[{'all':!![]}];}_0x5e1611=_[_0x779d('0x34')]({},_0x5e1611,_0x23d5ea[_0x779d('0x35')]);return db[_0x779d('0x1f')][_0x779d('0x36')](_0x5e1611)[_0x779d('0x18')](handleEntityNotFound(_0x882d18,null))['then'](respondWithResult(_0x882d18,null))[_0x779d('0x26')](handleError(_0x882d18,null));};exports[_0x779d('0x37')]=function(_0x467755,_0x5a7c0b){return db[_0x779d('0x1f')]['create'](_0x467755[_0x779d('0x38')],{})[_0x779d('0x18')](respondWithResult(_0x5a7c0b,0xc9))[_0x779d('0x26')](handleError(_0x5a7c0b,null));};exports[_0x779d('0x17')]=function(_0x42457a,_0x154897){if(_0x42457a[_0x779d('0x38')]['id']){delete _0x42457a[_0x779d('0x38')]['id'];}return db[_0x779d('0x1f')][_0x779d('0x36')]({'where':{'id':_0x42457a[_0x779d('0x28')]['id']}})['then'](handleEntityNotFound(_0x154897,null))['then'](saveUpdates(_0x42457a['body'],null))[_0x779d('0x18')](respondWithResult(_0x154897,null))[_0x779d('0x26')](handleError(_0x154897,null));};exports['destroy']=function(_0xcba9b3,_0x248e5f){return db['WhatsappInteraction'][_0x779d('0x36')]({'where':{'id':_0xcba9b3[_0x779d('0x28')]['id']}})[_0x779d('0x18')](handleEntityNotFound(_0x248e5f,null))[_0x779d('0x18')](removeEntity(_0x248e5f,null))[_0x779d('0x26')](handleError(_0x248e5f,null));};exports[_0x779d('0x39')]=function(_0x52f87d,_0xda5dc6){return db['WhatsappInteraction'][_0x779d('0x39')]()[_0x779d('0x18')](respondWithResult(_0xda5dc6,null))[_0x779d('0x26')](handleError(_0xda5dc6,null));};exports[_0x779d('0x3a')]=function(_0x42e580,_0x5292e5){return db[_0x779d('0x3b')][_0x779d('0x36')]({'where':{'id':_0x42e580[_0x779d('0x28')]['id']}})[_0x779d('0x18')](handleEntityNotFound(_0x5292e5,null))[_0x779d('0x18')](function(_0x38813f){if(_0x38813f){return _0x38813f[_0x779d('0x3a')](_0x42e580['body'][_0x779d('0x3c')],_['omit'](_0x42e580[_0x779d('0x38')],[_0x779d('0x3c'),'id'])||{});}})[_0x779d('0x18')](respondWithResult(_0x5292e5,null))['catch'](handleError(_0x5292e5,null));};exports['getMessages']=function(_0xfc722e,_0x4ad582){var _0x59dc0c={'raw':![],'where':{}};var _0x311d6c={};var _0x5a78fd={'count':0x0,'rows':[]};return db[_0x779d('0x1f')]['findOne']({'where':{'id':_0xfc722e[_0x779d('0x28')]['id']}})['then'](handleEntityNotFound(_0x4ad582,null))[_0x779d('0x18')](function(_0x128d5a){if(_0x128d5a){_0x311d6c[_0x779d('0x29')]=_[_0x779d('0x2a')](db[_0x779d('0x3b')][_0x779d('0x2b')]);_0x311d6c[_0x779d('0x2c')]=_[_0x779d('0x2a')](_0xfc722e[_0x779d('0x2c')]);_0x311d6c[_0x779d('0x2d')]=_[_0x779d('0x2f')](_0x311d6c['model'],_0x311d6c[_0x779d('0x2c')]);_0x59dc0c[_0x779d('0x2e')]=_['intersection'](_0x311d6c['model'],qs[_0x779d('0x30')](_0xfc722e[_0x779d('0x2c')]['fields']));_0x59dc0c[_0x779d('0x2e')]=_0x59dc0c[_0x779d('0x2e')][_0x779d('0x31')]?_0x59dc0c['attributes']:_0x311d6c[_0x779d('0x29')];if(!_0xfc722e[_0x779d('0x2c')][_0x779d('0x3d')](_0x779d('0x3e'))){_0x59dc0c[_0x779d('0x12')]=qs[_0x779d('0x12')](_0xfc722e[_0x779d('0x2c')][_0x779d('0x12')]);_0x59dc0c[_0x779d('0x11')]=qs[_0x779d('0x11')](_0xfc722e[_0x779d('0x2c')][_0x779d('0x11')]);}_0x59dc0c['order']=qs['sort'](_0xfc722e[_0x779d('0x2c')][_0x779d('0x3f')]);_0x59dc0c['where']=qs['filters'](_[_0x779d('0x40')](_0xfc722e[_0x779d('0x2c')],_0x311d6c[_0x779d('0x2d')]));_0x59dc0c[_0x779d('0x41')][_0x779d('0x42')]=_0x128d5a['id'];if(_0xfc722e['query'][_0x779d('0x43')]){_0x59dc0c[_0x779d('0x41')]=_[_0x779d('0x34')](_0x59dc0c[_0x779d('0x41')],{'$or':_[_0x779d('0x44')](_0x59dc0c[_0x779d('0x2e')],function(_0x5bea8c){var _0x44e72b={};_0x44e72b[_0x5bea8c]={'$like':'%'+_0xfc722e[_0x779d('0x2c')][_0x779d('0x43')]+'%'};return _0x44e72b;})});}if(_0xfc722e[_0x779d('0x2c')][_0x779d('0x45')]){var _0xadd3cf=_0xfc722e['query'][_0x779d('0x45')][_0x779d('0x46')](',');var _0x393ea9={};_0x393ea9[_0xadd3cf[0x0]]={'$gte':moment(_0xadd3cf[0x1])[_0x779d('0x47')](_0x779d('0x48'))};_0x59dc0c[_0x779d('0x41')]=_[_0x779d('0x34')](_0x59dc0c[_0x779d('0x41')],_0x393ea9);}_0x59dc0c=_[_0x779d('0x34')]({},_0x59dc0c,_0xfc722e[_0x779d('0x35')]);return db[_0x779d('0x3b')]['count']({'where':_0x59dc0c[_0x779d('0x41')]})['then'](function(_0x2e83b0){_0x5a78fd[_0x779d('0x14')]=_0x2e83b0;if(_0xfc722e['query'][_0x779d('0x32')]){_0x59dc0c[_0x779d('0x33')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x779d('0x23')](_0x59dc0c);})[_0x779d('0x18')](function(_0x5ee710){_0x5a78fd[_0x779d('0x49')]=_0x5ee710;return _0x5a78fd;});}})[_0x779d('0x18')](respondWithFilteredResult(_0x4ad582,_0x59dc0c))['catch'](handleError(_0x4ad582,null));};exports['addTags']=function(_0x5e3256,_0x2779f9){return db[_0x779d('0x1f')][_0x779d('0x36')]({'where':{'id':_0x5e3256[_0x779d('0x28')]['id']}})[_0x779d('0x18')](handleEntityNotFound(_0x2779f9,null))[_0x779d('0x18')](function(_0x295f56){if(_0x295f56){return _0x295f56[_0x779d('0x4a')](_0x5e3256[_0x779d('0x38')][_0x779d('0x3c')],_[_0x779d('0x4b')](_0x5e3256[_0x779d('0x38')],[_0x779d('0x3c'),'id'])||{})[_0x779d('0x4c')](function(){return db['Tag'][_0x779d('0x23')]({'attributes':['id',_0x779d('0x1c'),_0x779d('0x4d')],'where':{'id':_0x5e3256[_0x779d('0x38')][_0x779d('0x3c')]}});})[_0x779d('0x18')](function(_0x448236){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x5e3256['params']['id']),'tags':_0x448236||[]});return{'id':Number(_0x5e3256['params']['id']),'tags':_0x448236||[]};});}})[_0x779d('0x18')](respondWithResult(_0x2779f9,null))['catch'](handleError(_0x2779f9,null));};exports[_0x779d('0x4e')]=function(_0xf37e24,_0x573618){return db['WhatsappInteraction'][_0x779d('0x36')]({'where':{'id':_0xf37e24[_0x779d('0x28')]['id']}})[_0x779d('0x18')](handleEntityNotFound(_0x573618,null))[_0x779d('0x18')](function(_0x59d699){if(_0x59d699){return _0x59d699[_0x779d('0x4e')](_0xf37e24['query'][_0x779d('0x3c')]);}})[_0x779d('0x18')](respondWithStatusCode(_0x573618,null))[_0x779d('0x26')](handleError(_0x573618,null));};exports[_0x779d('0x4f')]=function(_0x44a004,_0x46f6c5){var _0x3bfd90=moment()[_0x779d('0x50')]()['toString']();var _0x3d141c=path['join'](config['root'],_0x779d('0x51'),'files',_0x779d('0x52'));var _0x567a06=path['join'](config[_0x779d('0x53')],_0x779d('0x51'),_0x779d('0x54'),'attachments');var _0x42ecc1=path[_0x779d('0x55')](_0x3d141c,_0x3bfd90);var _0x1e789a=util['format'](_0x779d('0x56'),_0x44a004[_0x779d('0x28')]['id'],_0x3bfd90);var _0x295fd3=path[_0x779d('0x55')](_0x3d141c,_0x1e789a);var _0x3931c1=[];_0x3931c1[_0x779d('0x57')]({'model':db[_0x779d('0x58')],'as':_0x779d('0x58'),'attributes':['id',_0x779d('0x59')],'raw':!![]});_0x3931c1[_0x779d('0x57')]({'model':db[_0x779d('0x5a')],'as':_0x779d('0x5b'),'attributes':['id',_0x779d('0x5c'),_0x779d('0x5d')],'raw':!![]});if(_0x44a004[_0x779d('0x2c')][_0x779d('0x5e')]){_0x3931c1['push']({'model':db['Attachment'],'as':_0x779d('0x5f'),'raw':!![]});}var _0x3741a4=[{'model':db[_0x779d('0x3b')],'as':_0x779d('0x60'),'attributes':['id',_0x779d('0x38'),_0x779d('0x61'),'direction',_0x779d('0x62'),_0x779d('0x63')],'include':_0x3931c1}];_0x3741a4[_0x779d('0x57')]({'model':db[_0x779d('0x64')],'as':_0x779d('0x65'),'attributes':['id',_0x779d('0x1c')]});_0x3741a4[_0x779d('0x57')]({'model':db[_0x779d('0x58')],'as':_0x779d('0x66'),'attributes':['id',_0x779d('0x59')]});return db[_0x779d('0x1f')][_0x779d('0x36')]({'where':{'id':_0x44a004['params']['id']},'include':_0x3741a4})[_0x779d('0x18')](handleEntityNotFound(_0x46f6c5,null))[_0x779d('0x18')](function(_0x3dfe1e){if(_0x3dfe1e){var _0x2ee135=_0x3dfe1e[_0x779d('0x67')]({'plain':!![]});fs[_0x779d('0x68')](_0x42ecc1);var _0x3485a2={'channel':_0x779d('0x69'),'account':_0x2ee135[_0x779d('0x65')][_0x779d('0x1c')],'agent':_0x2ee135['Owner']?_0x2ee135[_0x779d('0x66')][_0x779d('0x59')]:'N.A.','createdAt':moment(_0x2ee135['createdAt'])['format'](_0x779d('0x48'))[_0x779d('0x6a')](),'closedAt':_0x2ee135[_0x779d('0x6b')]?moment(_0x2ee135['closedAt'])[_0x779d('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x779d('0x6a')]():'','disposition':_0x2ee135[_0x779d('0x6c')],'messages':_(_0x2ee135[_0x779d('0x60')])[_0x779d('0x43')]({'secret':![]})[_0x779d('0x44')](function(_0xa91bea){if(_0xa91bea[_0x779d('0x5f')]){var _0x58cdfc=path[_0x779d('0x55')](_0x567a06,_0xa91bea[_0x779d('0x5f')][_0x779d('0x6d')]);if(fs[_0x779d('0x6e')](_0x58cdfc)){fs[_0x779d('0x6f')](_0x58cdfc)['pipe'](fs[_0x779d('0x70')](path['join'](_0x42ecc1,_0xa91bea[_0x779d('0x5f')][_0x779d('0x6d')])));}}return{'date':moment(_0xa91bea[_0x779d('0x61')])[_0x779d('0x47')](_0x779d('0x48'))['toString'](),'sender':_0xa91bea['direction']===_0x779d('0x71')?_0xa91bea['User']?_0xa91bea[_0x779d('0x58')]['fullname']:_0x779d('0x72'):_0xa91bea['Contact'][_0x779d('0x5c')]+(_0xa91bea[_0x779d('0x5b')][_0x779d('0x5d')]?'\x20'+_0xa91bea[_0x779d('0x5b')][_0x779d('0x5d')]:''),'body':_0xa91bea[_0x779d('0x5f')]?_0xa91bea['Attachment'][_0x779d('0x6d')]:_0xa91bea[_0x779d('0x38')],'direction':_0xa91bea[_0x779d('0x73')]==='out'?'A':'C','secret':_0xa91bea[_0x779d('0x62')],'read':_0xa91bea['read'],'attachment':_0xa91bea[_0x779d('0x5f')]};})[_0x779d('0x74')]()};return ejs[_0x779d('0x75')](path['join'](config[_0x779d('0x53')],_0x779d('0x51'),'views',_0x779d('0x76')),{'interaction':_0x3485a2})['then'](function(_0x5aeece){var _0x4a203a=path[_0x779d('0x55')](_0x42ecc1,_0x779d('0x77')+_0x2ee135['id']+'-'+_0x3bfd90+_0x779d('0x78'));var _0x55d238={'path':_0x4a203a,'channel':_0x779d('0x69'),'interactionId':_0x2ee135['id']};return pdf[_0x779d('0x79')](_0x5aeece,_0x55d238);})[_0x779d('0x18')](function(){return new BPromise(function(_0x2e7ea2,_0x14b922){zipdir(_0x42ecc1,{'saveTo':_0x295fd3},function(_0x59ddf7,_0x4d7425){if(_0x59ddf7)return _0x14b922(_0x59ddf7);return _0x2e7ea2(_0x4d7425);});})['then'](function(){return new BPromise(function(_0xb13ee7,_0x510582){rimraf(_0x42ecc1,function(_0xd87557){if(_0xd87557)_0x510582(_0xd87557);return _0xb13ee7();});});})['then'](function(){return _0x46f6c5[_0x779d('0x4f')](_0x295fd3,_0x1e789a,function(_0x3b538b){if(_0x3b538b){console['log'](_0x779d('0x7a'),_0x3b538b);}else{fs['unlinkSync'](_0x295fd3);}});});});}else{return _0x46f6c5[_0x779d('0x1a')](0xc8);}})['catch'](handleError(_0x46f6c5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index c640b64..86ce956 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 _0xfdb5=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','getUsers','then','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','events'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xfdb5[_0x4c445a];return _0x2f611c;};'use strict';var EventEmitter=require(_0x5fdb('0x0'));var WhatsappInteraction=require(_0x5fdb('0x1'))['db'][_0x5fdb('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x5fdb('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5fdb('0x4')](0x0);var events={'afterCreate':_0x5fdb('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ff059){return function(_0x4e6ad9,_0xc837cf,_0x4a2149){_0x4e6ad9[_0x5fdb('0x6')]({'attributes':['id'],'raw':!![]})[_0x5fdb('0x7')](function(_0x4b6fe0){_0x4e6ad9['setDataValue']('Users',_0x4b6fe0[_0x5fdb('0x8')](function(_0x28ad92){return{'id':_0x28ad92['id']};}));return WhatsappMessage[_0x5fdb('0x9')]({'where':{'WhatsappInteractionId':_0x4e6ad9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5fdb('0x7')](function(_0x4034fd){_0x4e6ad9[_0x5fdb('0xa')](_0x5fdb('0xb'),_0x4034fd['length']);WhatsappInteractionEvents[_0x5fdb('0xc')](_0x3ff059+':'+_0x4e6ad9['id'],_0x4e6ad9);WhatsappInteractionEvents['emit'](_0x3ff059,_0x4e6ad9);_0x4a2149(null);})[_0x5fdb('0xd')](_0x4a2149(null));};}for(var e in events){if(events[_0x5fdb('0xe')](e)){var event=events[e];WhatsappInteraction[_0x5fdb('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xbdeb=['setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','../../mysqldb'];(function(_0x59a17e,_0x6885a9){var _0x1c2557=function(_0x16a8e){while(--_0x16a8e){_0x59a17e['push'](_0x59a17e['shift']());}};_0x1c2557(++_0x6885a9);}(_0xbdeb,0x6f));var _0xbbde=function(_0x4aeb38,_0x3fb7f4){_0x4aeb38=_0x4aeb38-0x0;var _0x5afbe1=_0xbdeb[_0x4aeb38];return _0x5afbe1;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xbbde('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xbbde('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbbde('0x1')](0x0);var events={'afterCreate':_0xbbde('0x2'),'afterUpdate':_0xbbde('0x3'),'afterDestroy':_0xbbde('0x4')};function emitEvent(_0x5362c3){return function(_0x56c2f0,_0x1037e6,_0x1d4042){_0x56c2f0[_0xbbde('0x5')]({'attributes':['id'],'raw':!![]})[_0xbbde('0x6')](function(_0x5e6273){_0x56c2f0['setDataValue'](_0xbbde('0x7'),_0x5e6273[_0xbbde('0x8')](function(_0x51706d){return{'id':_0x51706d['id']};}));return WhatsappMessage[_0xbbde('0x9')]({'where':{'WhatsappInteractionId':_0x56c2f0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbbde('0x6')](function(_0x3164f7){_0x56c2f0[_0xbbde('0xa')](_0xbbde('0xb'),_0x3164f7[_0xbbde('0xc')]);WhatsappInteractionEvents[_0xbbde('0xd')](_0x5362c3+':'+_0x56c2f0['id'],_0x56c2f0);WhatsappInteractionEvents[_0xbbde('0xd')](_0x5362c3,_0x56c2f0);_0x1d4042(null);})[_0xbbde('0xe')](_0x1d4042(null));};}for(var e in events){if(events[_0xbbde('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index c3771bb..06b2993 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 _0xf54e=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','WhatsappInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x3884ee,_0x6664ce){var _0x5c7eea=function(_0x234fd5){while(--_0x234fd5){_0x3884ee['push'](_0x3884ee['shift']());}};_0x5c7eea(++_0x6664ce);}(_0xf54e,0xec));var _0xef54=function(_0x58de4a,_0x564dbc){_0x58de4a=_0x58de4a-0x0;var _0x178820=_0xf54e[_0x58de4a];return _0x178820;};'use strict';var _=require(_0xef54('0x0'));var util=require(_0xef54('0x1'));var logger=require(_0xef54('0x2'))(_0xef54('0x3'));var moment=require(_0xef54('0x4'));var BPromise=require(_0xef54('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef54('0x6'));var rimraf=require(_0xef54('0x7'));var config=require(_0xef54('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0xef54('0x9')]=function(_0x184f33,_0x547c78){return _0x184f33['define'](_0xef54('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5eb729,_0x3fe6c9,_0xdbc634){if(_0x5eb729['changed']('closed')){_0x5eb729[_0xef54('0xb')]=moment()[_0xef54('0xc')](_0xef54('0xd'));}_0xdbc634(null,_0x5eb729);}}});}; \ No newline at end of file +var _0x7792=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x7792,0x131));var _0x2779=function(_0x48c998,_0x37d255){_0x48c998=_0x48c998-0x0;var _0x59c2a2=_0x7792[_0x48c998];return _0x59c2a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2779('0x0'))(_0x2779('0x1'));var moment=require(_0x2779('0x2'));var BPromise=require(_0x2779('0x3'));var rp=require(_0x2779('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2779('0x5'));var config=require(_0x2779('0x6'));var attributes=require(_0x2779('0x7'));module[_0x2779('0x8')]=function(_0x5ae4c4,_0x4a6692){return _0x5ae4c4[_0x2779('0x9')](_0x2779('0xa'),attributes,{'tableName':_0x2779('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f2717,_0x478e4b,_0x3cd5fd){if(_0x2f2717[_0x2779('0xc')](_0x2779('0xd'))){_0x2f2717[_0x2779('0xe')]=moment()[_0x2779('0xf')](_0x2779('0x10'));}_0x3cd5fd(null,_0x2f2717);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 44944da..0c4340d 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 _0xa311=['jayson/promise','client','http','defaults','redis','localhost','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','then','stringify','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','spread','AddTags','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x4f3a6a,_0x3fc1c2){var _0x1d2458=function(_0x3db9ad){while(--_0x3db9ad){_0x4f3a6a['push'](_0x4f3a6a['shift']());}};_0x1d2458(++_0x3fc1c2);}(_0xa311,0x193));var _0x1a31=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa311[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var util=require(_0x1a31('0x0'));var moment=require(_0x1a31('0x1'));var BPromise=require(_0x1a31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a31('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a31('0x4'));var logger=require('../../config/logger')(_0x1a31('0x5'));var config=require(_0x1a31('0x6'));var jayson=require(_0x1a31('0x7'));var client=jayson[_0x1a31('0x8')][_0x1a31('0x9')]({'port':0x232a});config['redis']=_[_0x1a31('0xa')](config[_0x1a31('0xb')],{'host':_0x1a31('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a31('0xb')]));require(_0x1a31('0xd'))[_0x1a31('0xe')](socket);function respondWithRpcPromise(_0x3e88ef,_0x4cc173,_0x226f2e){return new BPromise(function(_0x5bb589,_0x1bdd73){return client[_0x1a31('0xf')](_0x3e88ef,_0x226f2e)['then'](function(_0x21305a){logger[_0x1a31('0x10')](_0x1a31('0x11'),_0x4cc173,_0x1a31('0x12'));logger[_0x1a31('0x13')](_0x1a31('0x14'),_0x4cc173,_0x1a31('0x12'),JSON['stringify'](_0x21305a));if(_0x21305a[_0x1a31('0x15')]){if(_0x21305a[_0x1a31('0x15')][_0x1a31('0x16')]===0x1f4){logger[_0x1a31('0x15')](_0x1a31('0x11'),_0x4cc173,_0x21305a['error'][_0x1a31('0x17')]);return _0x1bdd73(_0x21305a[_0x1a31('0x15')][_0x1a31('0x17')]);}logger['error'](_0x1a31('0x11'),_0x4cc173,_0x21305a[_0x1a31('0x15')][_0x1a31('0x17')]);return _0x5bb589(_0x21305a[_0x1a31('0x15')][_0x1a31('0x17')]);}else{logger[_0x1a31('0x10')](_0x1a31('0x11'),_0x4cc173,'request\x20sent');_0x5bb589(_0x21305a[_0x1a31('0x18')][_0x1a31('0x17')]);}})['catch'](function(_0x48694f){logger[_0x1a31('0x15')](_0x1a31('0x11'),_0x4cc173,_0x48694f);_0x1bdd73(_0x48694f);});});}exports[_0x1a31('0x19')]=function(_0x3d9681){var _0x211be1=this;return new Promise(function(_0x570331,_0x2143ba){return db['WhatsappInteraction'][_0x1a31('0x1a')](_0x3d9681[_0x1a31('0x1b')],{'raw':_0x3d9681['options']?_0x3d9681[_0x1a31('0x1c')][_0x1a31('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d9681['options']?_0x3d9681[_0x1a31('0x1c')][_0x1a31('0x1e')]||null:null,'attributes':_0x3d9681[_0x1a31('0x1c')]?_0x3d9681[_0x1a31('0x1c')][_0x1a31('0x1f')]||null:null,'limit':_0x3d9681['options']?_0x3d9681[_0x1a31('0x1c')]['limit']||null:null})[_0x1a31('0x20')](function(_0x5b3abc){logger[_0x1a31('0x10')]('UpdateWhatsappInteraction',_0x3d9681);logger[_0x1a31('0x13')](_0x1a31('0x19'),_0x3d9681,JSON[_0x1a31('0x21')](_0x5b3abc));_0x570331(_0x5b3abc);})['catch'](function(_0x5cc610){logger[_0x1a31('0x15')](_0x1a31('0x19'),_0x5cc610['message'],_0x3d9681);_0x2143ba(_0x211be1[_0x1a31('0x15')](0x1f4,_0x5cc610['message']));});});};exports[_0x1a31('0x22')]=function(_0x107f18){return new Promise(function(_0x14ad84,_0x421cff){return db[_0x1a31('0x23')][_0x1a31('0x24')]({'where':_0x107f18[_0x1a31('0x1c')]?_0x107f18[_0x1a31('0x1c')]['where']||null:null})[_0x1a31('0x20')](function(_0x55b9f9){if(_0x55b9f9){return _0x55b9f9[_0x1a31('0x25')](_0x107f18[_0x1a31('0x1b')][_0x1a31('0x26')],_['omit'](_0x107f18[_0x1a31('0x1b')],[_0x1a31('0x26'),'id'])||{});}})[_0x1a31('0x27')](function(_0xf12cc3){logger['info'](_0x1a31('0x28'),_0x107f18);logger['debug'](_0x1a31('0x28'),_0x107f18,JSON[_0x1a31('0x21')](_0xf12cc3));_0x14ad84(_0xf12cc3);})['catch'](function(_0x5d80d9){logger['error'](_0x1a31('0x28'),_0x5d80d9[_0x1a31('0x17')],_0x107f18);_0x421cff(_this[_0x1a31('0x15')](0x1f4,_0x5d80d9[_0x1a31('0x17')]));});});}; \ No newline at end of file +var _0x4a7f=['stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','limit','catch','find','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x291c93,_0x536250){var _0x27d898=function(_0x4c708a){while(--_0x4c708a){_0x291c93['push'](_0x291c93['shift']());}};_0x27d898(++_0x536250);}(_0x4a7f,0x1f3));var _0xf4a7=function(_0x1f39fc,_0x2cae43){_0x1f39fc=_0x1f39fc-0x0;var _0x538504=_0x4a7f[_0x1f39fc];return _0x538504;};'use strict';var _=require('lodash');var util=require(_0xf4a7('0x0'));var moment=require(_0xf4a7('0x1'));var BPromise=require(_0xf4a7('0x2'));var rs=require(_0xf4a7('0x3'));var fs=require('fs');var Redis=require(_0xf4a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4a7('0x5'));var logger=require(_0xf4a7('0x6'))(_0xf4a7('0x7'));var config=require(_0xf4a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf4a7('0x9')][_0xf4a7('0xa')]({'port':0x232a});config[_0xf4a7('0xb')]=_[_0xf4a7('0xc')](config['redis'],{'host':_0xf4a7('0xd'),'port':0x18eb});var socket=require(_0xf4a7('0xe'))(new Redis(config['redis']));require(_0xf4a7('0xf'))['register'](socket);function respondWithRpcPromise(_0x653d5a,_0x14bbc6,_0x3a6e64){return new BPromise(function(_0x5089eb,_0x360cd3){return client['request'](_0x653d5a,_0x3a6e64)[_0xf4a7('0x10')](function(_0x57d9b9){logger[_0xf4a7('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x14bbc6,_0xf4a7('0x12'));logger[_0xf4a7('0x13')](_0xf4a7('0x14'),_0x14bbc6,_0xf4a7('0x12'),JSON[_0xf4a7('0x15')](_0x57d9b9));if(_0x57d9b9[_0xf4a7('0x16')]){if(_0x57d9b9['error'][_0xf4a7('0x17')]===0x1f4){logger[_0xf4a7('0x16')](_0xf4a7('0x18'),_0x14bbc6,_0x57d9b9[_0xf4a7('0x16')]['message']);return _0x360cd3(_0x57d9b9[_0xf4a7('0x16')]['message']);}logger[_0xf4a7('0x16')](_0xf4a7('0x18'),_0x14bbc6,_0x57d9b9['error'][_0xf4a7('0x19')]);return _0x5089eb(_0x57d9b9[_0xf4a7('0x16')][_0xf4a7('0x19')]);}else{logger[_0xf4a7('0x11')](_0xf4a7('0x18'),_0x14bbc6,_0xf4a7('0x12'));_0x5089eb(_0x57d9b9[_0xf4a7('0x1a')][_0xf4a7('0x19')]);}})['catch'](function(_0xba57f5){logger['error'](_0xf4a7('0x18'),_0x14bbc6,_0xba57f5);_0x360cd3(_0xba57f5);});});}exports[_0xf4a7('0x1b')]=function(_0x15799b){var _0x5ae04d=this;return new Promise(function(_0x5dc32b,_0x2f6f5d){return db[_0xf4a7('0x1c')][_0xf4a7('0x1d')](_0x15799b[_0xf4a7('0x1e')],{'raw':_0x15799b['options']?_0x15799b[_0xf4a7('0x1f')][_0xf4a7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15799b[_0xf4a7('0x1f')]?_0x15799b[_0xf4a7('0x1f')]['where']||null:null,'attributes':_0x15799b[_0xf4a7('0x1f')]?_0x15799b[_0xf4a7('0x1f')]['attributes']||null:null,'limit':_0x15799b[_0xf4a7('0x1f')]?_0x15799b[_0xf4a7('0x1f')][_0xf4a7('0x21')]||null:null})[_0xf4a7('0x10')](function(_0x40f5ff){logger[_0xf4a7('0x11')](_0xf4a7('0x1b'),_0x15799b);logger[_0xf4a7('0x13')](_0xf4a7('0x1b'),_0x15799b,JSON[_0xf4a7('0x15')](_0x40f5ff));_0x5dc32b(_0x40f5ff);})[_0xf4a7('0x22')](function(_0xae9189){logger[_0xf4a7('0x16')](_0xf4a7('0x1b'),_0xae9189[_0xf4a7('0x19')],_0x15799b);_0x2f6f5d(_0x5ae04d[_0xf4a7('0x16')](0x1f4,_0xae9189[_0xf4a7('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0xe4809d){return new Promise(function(_0x32c2d0,_0x51fbca){return db[_0xf4a7('0x1c')][_0xf4a7('0x23')]({'where':_0xe4809d[_0xf4a7('0x1f')]?_0xe4809d[_0xf4a7('0x1f')]['where']||null:null})[_0xf4a7('0x10')](function(_0xae575b){if(_0xae575b){return _0xae575b[_0xf4a7('0x24')](_0xe4809d[_0xf4a7('0x1e')][_0xf4a7('0x25')],_['omit'](_0xe4809d[_0xf4a7('0x1e')],['ids','id'])||{});}})[_0xf4a7('0x26')](function(_0x14fe60){logger[_0xf4a7('0x11')]('AddTags',_0xe4809d);logger[_0xf4a7('0x13')](_0xf4a7('0x27'),_0xe4809d,JSON[_0xf4a7('0x15')](_0x14fe60));_0x32c2d0(_0x14fe60);})[_0xf4a7('0x22')](function(_0x4c741f){logger[_0xf4a7('0x16')]('AddTags',_0x4c741f[_0xf4a7('0x19')],_0xe4809d);_0x51fbca(_this['error'](0x1f4,_0x4c741f[_0xf4a7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 6512930..b3bf331 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 _0xfae1=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x3651eb,_0xa10cb8){var _0x230cae=function(_0xf5e800){while(--_0xf5e800){_0x3651eb['push'](_0x3651eb['shift']());}};_0x230cae(++_0xa10cb8);}(_0xfae1,0xd5));var _0x1fae=function(_0x515219,_0x25a9db){_0x515219=_0x515219-0x0;var _0x1205ca=_0xfae1[_0x515219];return _0x1205ca;};'use strict';var WhatsappInteractionEvents=require(_0x1fae('0x0'));var events=[_0x1fae('0x1'),_0x1fae('0x2'),_0x1fae('0x3')];function createListener(_0x4ecca2,_0x80a854){return function(_0x236e9){_0x80a854[_0x1fae('0x4')](_0x4ecca2,_0x236e9);};}function removeListener(_0x1fd686,_0x6090c5){return function(){WhatsappInteractionEvents[_0x1fae('0x5')](_0x1fd686,_0x6090c5);};}exports[_0x1fae('0x6')]=function(_0x504255){for(var _0x31bf44=0x0,_0x4a05b0=events[_0x1fae('0x7')];_0x31bf44<_0x4a05b0;_0x31bf44++){var _0x520c60=events[_0x31bf44];var _0x14889f=createListener(_0x1fae('0x8')+_0x520c60,_0x504255);WhatsappInteractionEvents['on'](_0x520c60,_0x14889f);}}; \ No newline at end of file +var _0xeaf7=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x3bf9bc,_0x8ccd3f){var _0x2d270d=function(_0x6651bc){while(--_0x6651bc){_0x3bf9bc['push'](_0x3bf9bc['shift']());}};_0x2d270d(++_0x8ccd3f);}(_0xeaf7,0x102));var _0x7eaf=function(_0x2c347c,_0x5ba2dd){_0x2c347c=_0x2c347c-0x0;var _0x1aebab=_0xeaf7[_0x2c347c];return _0x1aebab;};'use strict';var WhatsappInteractionEvents=require(_0x7eaf('0x0'));var events=[_0x7eaf('0x1'),_0x7eaf('0x2'),_0x7eaf('0x3')];function createListener(_0x175e59,_0x20fd22){return function(_0x419636){_0x20fd22[_0x7eaf('0x4')](_0x175e59,_0x419636);};}function removeListener(_0x20a5a4,_0x3339ad){return function(){WhatsappInteractionEvents[_0x7eaf('0x5')](_0x20a5a4,_0x3339ad);};}exports['register']=function(_0x4ab83d){for(var _0x4b78ba=0x0,_0x2a515b=events[_0x7eaf('0x6')];_0x4b78ba<_0x2a515b;_0x4b78ba++){var _0x33713f=events[_0x4b78ba];var _0x19b4bf=createListener(_0x7eaf('0x7')+_0x33713f,_0x4ab83d);WhatsappInteractionEvents['on'](_0x33713f,_0x19b4bf);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index c910f01..35bf012 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 _0x6ea0=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','whatsapp','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports'];(function(_0x466b62,_0x3f9384){var _0x5dd5ad=function(_0x3a892d){while(--_0x3a892d){_0x466b62['push'](_0x466b62['shift']());}};_0x5dd5ad(++_0x3f9384);}(_0x6ea0,0x1c0));var _0x06ea=function(_0x3203ed,_0xb3a578){_0x3203ed=_0x3203ed-0x0;var _0x346e12=_0x6ea0[_0x3203ed];return _0x346e12;};'use strict';var multer=require(_0x06ea('0x0'));var util=require(_0x06ea('0x1'));var path=require(_0x06ea('0x2'));var timeout=require(_0x06ea('0x3'));var express=require(_0x06ea('0x4'));var router=express['Router']();var fs_extra=require(_0x06ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x06ea('0x6'));var config=require('../../config/environment');var controller=require(_0x06ea('0x7'));router[_0x06ea('0x8')]('/',auth[_0x06ea('0x9')](),controller[_0x06ea('0xa')]);router[_0x06ea('0x8')](_0x06ea('0xb'),auth['isAuthenticated'](),controller[_0x06ea('0xc')]);router[_0x06ea('0x8')](_0x06ea('0xd'),auth[_0x06ea('0x9')](),controller[_0x06ea('0xe')]);router[_0x06ea('0xf')]('/',auth[_0x06ea('0x9')](),interaction['tracked'](_0x06ea('0x10'),'whatsappmessage:create'),controller[_0x06ea('0x11')]);router[_0x06ea('0xf')](_0x06ea('0x12'),controller[_0x06ea('0x13')]);router[_0x06ea('0x14')](_0x06ea('0xd'),auth['isAuthenticated'](),controller[_0x06ea('0x15')]);router[_0x06ea('0x14')](_0x06ea('0x16'),auth[_0x06ea('0x9')](),controller[_0x06ea('0x17')]);router[_0x06ea('0x14')](_0x06ea('0x18'),auth[_0x06ea('0x9')](),controller[_0x06ea('0x19')]);router['delete']('/:id',auth[_0x06ea('0x9')](),controller[_0x06ea('0x1a')]);module[_0x06ea('0x1b')]=router; \ No newline at end of file +var _0xd2e1=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/:id','show','post','whatsapp','create','/:id/status','update','/:id/accept','/:id/reject'];(function(_0x5e5f9b,_0x508f99){var _0x1f8bfd=function(_0x54a566){while(--_0x54a566){_0x5e5f9b['push'](_0x5e5f9b['shift']());}};_0x1f8bfd(++_0x508f99);}(_0xd2e1,0x1d0));var _0x1d2e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xd2e1[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x1d2e('0x0'));var util=require(_0x1d2e('0x1'));var path=require(_0x1d2e('0x2'));var timeout=require(_0x1d2e('0x3'));var express=require('express');var router=express[_0x1d2e('0x4')]();var fs_extra=require(_0x1d2e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1d2e('0x6'));var config=require('../../config/environment');var controller=require(_0x1d2e('0x7'));router[_0x1d2e('0x8')]('/',auth[_0x1d2e('0x9')](),controller[_0x1d2e('0xa')]);router[_0x1d2e('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1d2e('0x8')](_0x1d2e('0xb'),auth[_0x1d2e('0x9')](),controller[_0x1d2e('0xc')]);router[_0x1d2e('0xd')]('/',auth[_0x1d2e('0x9')](),interaction['tracked'](_0x1d2e('0xe'),'whatsappmessage:create'),controller[_0x1d2e('0xf')]);router[_0x1d2e('0xd')](_0x1d2e('0x10'),controller['status']);router['put']('/:id',auth[_0x1d2e('0x9')](),controller[_0x1d2e('0x11')]);router['put'](_0x1d2e('0x12'),auth[_0x1d2e('0x9')](),controller['accept']);router['put'](_0x1d2e('0x13'),auth[_0x1d2e('0x9')](),controller['reject']);router[_0x1d2e('0x14')](_0x1d2e('0xb'),auth['isAuthenticated'](),controller[_0x1d2e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 309610a..3ac9475 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 _0x5f79=['out','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x27399f,_0x1076de){var _0x46aeb7=function(_0x2de2a1){while(--_0x2de2a1){_0x27399f['push'](_0x27399f['shift']());}};_0x46aeb7(++_0x1076de);}(_0x5f79,0x92));var _0x95f7=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x5f79[_0xd336fa];return _0x3370b1;};'use strict';var Sequelize=require('sequelize');module[_0x95f7('0x0')]={'body':{'type':Sequelize[_0x95f7('0x1')](_0x95f7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x95f7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x95f7('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x95f7('0x5')](0xbe)},'phone':{'type':Sequelize[_0x95f7('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x95f7('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x95f7('0x1')]}}; \ No newline at end of file +var _0x7136=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x236229,_0x2c2395){var _0x16cc71=function(_0x1c0f73){while(--_0x1c0f73){_0x236229['push'](_0x236229['shift']());}};_0x16cc71(++_0x2c2395);}(_0x7136,0x1c0));var _0x6713=function(_0x17c012,_0x581e0d){_0x17c012=_0x17c012-0x0;var _0x19e62c=_0x7136[_0x17c012];return _0x19e62c;};'use strict';var Sequelize=require(_0x6713('0x0'));module[_0x6713('0x1')]={'body':{'type':Sequelize[_0x6713('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6713('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6713('0x4')]('in',_0x6713('0x5')),'defaultValue':_0x6713('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x6713('0x6')]},'readAt':{'type':Sequelize[_0x6713('0x7')]},'secret':{'type':Sequelize[_0x6713('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6713('0x6')]},'providerResponse':{'type':Sequelize[_0x6713('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 08d4b35..ab5eb9b 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 _0x177b=['EventManager','acceptmessage','whatsapp-interactions','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','fullname','motionChannel','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','http','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','findAll','show','params','keys','include','create','body','find','describe','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','interface','SIP/%s','channel'];(function(_0x20cb8c,_0x3ad47c){var _0x25fae6=function(_0x1b504a){while(--_0x1b504a){_0x20cb8c['push'](_0x20cb8c['shift']());}};_0x25fae6(++_0x3ad47c);}(_0x177b,0xa1));var _0xb177=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0x177b[_0x4849f6];return _0x1a3dcd;};'use strict';var emlformat=require(_0xb177('0x0'));var rimraf=require(_0xb177('0x1'));var zipdir=require(_0xb177('0x2'));var jsonpatch=require(_0xb177('0x3'));var rp=require(_0xb177('0x4'));var moment=require(_0xb177('0x5'));var BPromise=require(_0xb177('0x6'));var Mustache=require(_0xb177('0x7'));var util=require(_0xb177('0x8'));var path=require(_0xb177('0x9'));var sox=require(_0xb177('0xa'));var csv=require(_0xb177('0xb'));var ejs=require(_0xb177('0xc'));var fs=require('fs');var fs_extra=require(_0xb177('0xd'));var _=require(_0xb177('0xe'));var squel=require(_0xb177('0xf'));var crypto=require('crypto');var jsforce=require(_0xb177('0x10'));var deskjs=require(_0xb177('0x11'));var toCsv=require(_0xb177('0xb'));var querystring=require(_0xb177('0x12'));var Papa=require(_0xb177('0x13'));var Redis=require(_0xb177('0x14'));var authService=require(_0xb177('0x15'));var qs=require(_0xb177('0x16'));var as=require(_0xb177('0x17'));var hardwareService=require(_0xb177('0x18'));var logger=require(_0xb177('0x19'))('api');var utils=require('../../config/utils');var config=require(_0xb177('0x1a'));var licenseUtil=require(_0xb177('0x1b'));var db=require('../../mysqldb')['db'];config[_0xb177('0x1c')]=_[_0xb177('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb177('0x1e'))(new Redis(config[_0xb177('0x1c')]));require('./whatsappMessage.socket')[_0xb177('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb177('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0cde,_0x273066,_0x447533,_0x45d5ff){return new BPromise(function(_0x2c7c6d,_0x22115a){var _0x33990a=_0x45d5ff||client;return _0x33990a['request'](_0x5a0cde,_0x447533)[_0xb177('0x21')](function(_0x952c23){logger['info'](_0xb177('0x22'),_0x273066,_0xb177('0x23'));logger[_0xb177('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x273066,_0xb177('0x23'),JSON[_0xb177('0x25')](_0x952c23));if(_0x952c23[_0xb177('0x26')]){if(_0x952c23[_0xb177('0x26')][_0xb177('0x27')]===0x1f4){logger[_0xb177('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x273066,_0x952c23['error'][_0xb177('0x28')]);return _0x22115a(_0x952c23[_0xb177('0x26')][_0xb177('0x28')]);}logger[_0xb177('0x26')](_0xb177('0x22'),_0x273066,_0x952c23[_0xb177('0x26')][_0xb177('0x28')]);return _0x2c7c6d(_0x952c23[_0xb177('0x26')][_0xb177('0x28')]);}else{logger[_0xb177('0x29')](_0xb177('0x22'),_0x273066,_0xb177('0x23'));_0x2c7c6d(_0x952c23[_0xb177('0x2a')][_0xb177('0x28')]);}})[_0xb177('0x2b')](function(_0x322c7b){logger[_0xb177('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x273066,_0x322c7b);_0x22115a(_0x322c7b);});});}function respondWithStatusCode(_0x46d921,_0x22bf85){_0x22bf85=_0x22bf85||0xcc;return function(_0x29cd0d){if(_0x29cd0d){return _0x46d921[_0xb177('0x2c')](_0x22bf85);}return _0x46d921[_0xb177('0x2d')](_0x22bf85)[_0xb177('0x2e')]();};}function respondWithResult(_0x10ffcc,_0x4c5df5){_0x4c5df5=_0x4c5df5||0xc8;return function(_0x19573b){if(_0x19573b){return _0x10ffcc[_0xb177('0x2d')](_0x4c5df5)[_0xb177('0x2f')](_0x19573b);}};}function respondWithFilteredResult(_0xc12a6f,_0x8db455){return function(_0x1a1ac6){if(_0x1a1ac6){var _0x4a9605=typeof _0x8db455['offset']===_0xb177('0x30')&&typeof _0x8db455[_0xb177('0x31')]==='undefined';var _0xabfca1=_0x1a1ac6[_0xb177('0x32')];var _0x1036c7=_0x4a9605?0x0:_0x8db455[_0xb177('0x33')];var _0x554ef5=_0x4a9605?_0x1a1ac6['count']:_0x8db455[_0xb177('0x33')]+_0x8db455[_0xb177('0x31')];var _0x2d4571;if(_0x554ef5>=_0xabfca1){_0x554ef5=_0xabfca1;_0x2d4571=0xc8;}else{_0x2d4571=0xce;}_0xc12a6f[_0xb177('0x2d')](_0x2d4571);return _0xc12a6f[_0xb177('0x34')](_0xb177('0x35'),_0x1036c7+'-'+_0x554ef5+'/'+_0xabfca1)[_0xb177('0x2f')](_0x1a1ac6);}return null;};}function patchUpdates(_0x42b334){return function(_0x39adc5){try{jsonpatch[_0xb177('0x36')](_0x39adc5,_0x42b334,!![]);}catch(_0x51f886){return BPromise[_0xb177('0x37')](_0x51f886);}return _0x39adc5[_0xb177('0x38')]();};}function saveUpdates(_0x56a6db,_0x335d2c){return function(_0xf8664e){if(_0xf8664e){return _0xf8664e[_0xb177('0x39')](_0x56a6db)[_0xb177('0x21')](function(_0x45ab6d){return _0x45ab6d;});}return null;};}function removeEntity(_0x1cf00e,_0x350f67){return function(_0x6f335a){if(_0x6f335a){return _0x6f335a[_0xb177('0x3a')]()[_0xb177('0x21')](function(){_0x1cf00e['status'](0xcc)[_0xb177('0x2e')]();});}};}function handleEntityNotFound(_0x407248,_0x1e844d){return function(_0x2e33d6){if(!_0x2e33d6){_0x407248[_0xb177('0x2c')](0x194);}return _0x2e33d6;};}function handleError(_0x3e57c7,_0x2d0f85){_0x2d0f85=_0x2d0f85||0x1f4;return function(_0x4c4e37){logger['error'](_0x4c4e37[_0xb177('0x3b')]);if(_0x4c4e37[_0xb177('0x3c')]){delete _0x4c4e37['name'];}_0x3e57c7[_0xb177('0x2d')](_0x2d0f85)['send'](_0x4c4e37);};}exports[_0xb177('0x3d')]=function(_0x516974,_0x248a3d){var _0x15898b={},_0x5bd3af={},_0x39dbaa={'count':0x0,'rows':[]};var _0x4d5e09=_[_0xb177('0x3e')](db['WhatsappMessage'][_0xb177('0x3f')],function(_0x50903d){return{'name':_0x50903d[_0xb177('0x40')],'type':_0x50903d[_0xb177('0x41')][_0xb177('0x42')]};});_0x5bd3af[_0xb177('0x43')]=_['map'](_0x4d5e09,'name');_0x5bd3af[_0xb177('0x44')]=_['keys'](_0x516974[_0xb177('0x44')]);_0x5bd3af[_0xb177('0x45')]=_['intersection'](_0x5bd3af['model'],_0x5bd3af['query']);_0x15898b[_0xb177('0x46')]=_[_0xb177('0x47')](_0x5bd3af[_0xb177('0x43')],qs[_0xb177('0x48')](_0x516974[_0xb177('0x44')][_0xb177('0x48')]));_0x15898b[_0xb177('0x46')]=_0x15898b[_0xb177('0x46')][_0xb177('0x49')]?_0x15898b[_0xb177('0x46')]:_0x5bd3af[_0xb177('0x43')];if(!_0x516974[_0xb177('0x44')][_0xb177('0x4a')](_0xb177('0x4b'))){_0x15898b[_0xb177('0x31')]=qs[_0xb177('0x31')](_0x516974[_0xb177('0x44')]['limit']);_0x15898b[_0xb177('0x33')]=qs['offset'](_0x516974['query'][_0xb177('0x33')]);}_0x15898b[_0xb177('0x4c')]=qs[_0xb177('0x4d')](_0x516974['query'][_0xb177('0x4d')]);_0x15898b[_0xb177('0x4e')]=qs[_0xb177('0x45')](_[_0xb177('0x4f')](_0x516974['query'],_0x5bd3af[_0xb177('0x45')]),_0x4d5e09);if(_0x516974['query'][_0xb177('0x50')]){_0x15898b[_0xb177('0x4e')]=_[_0xb177('0x51')](_0x15898b[_0xb177('0x4e')],{'$or':_['map'](_0x4d5e09,function(_0x5c446c){if(_0x5c446c['type']!==_0xb177('0x52')){var _0x398d79={};_0x398d79[_0x5c446c[_0xb177('0x3c')]]={'$like':'%'+_0x516974['query']['filter']+'%'};return _0x398d79;}})});}_0x15898b=_[_0xb177('0x51')]({},_0x15898b,_0x516974[_0xb177('0x53')]);var _0x247cff={'where':_0x15898b[_0xb177('0x4e')]};return db[_0xb177('0x54')][_0xb177('0x32')](_0x247cff)['then'](function(_0x2ce6f8){_0x39dbaa[_0xb177('0x32')]=_0x2ce6f8;if(_0x516974[_0xb177('0x44')][_0xb177('0x55')]){_0x15898b['include']=[{'all':!![]}];}return db[_0xb177('0x54')][_0xb177('0x56')](_0x15898b);})[_0xb177('0x21')](function(_0x15033b){_0x39dbaa['rows']=_0x15033b;return _0x39dbaa;})[_0xb177('0x21')](respondWithFilteredResult(_0x248a3d,_0x15898b))[_0xb177('0x2b')](handleError(_0x248a3d,null));};exports[_0xb177('0x57')]=function(_0x53bae8,_0x3edbac){var _0x480677={'raw':!![],'where':{'id':_0x53bae8[_0xb177('0x58')]['id']}},_0x5ddf97={};_0x5ddf97[_0xb177('0x43')]=_[_0xb177('0x59')](db[_0xb177('0x54')][_0xb177('0x3f')]);_0x5ddf97[_0xb177('0x44')]=_[_0xb177('0x59')](_0x53bae8[_0xb177('0x44')]);_0x5ddf97[_0xb177('0x45')]=_[_0xb177('0x47')](_0x5ddf97['model'],_0x5ddf97['query']);_0x480677[_0xb177('0x46')]=_[_0xb177('0x47')](_0x5ddf97[_0xb177('0x43')],qs[_0xb177('0x48')](_0x53bae8['query']['fields']));_0x480677[_0xb177('0x46')]=_0x480677[_0xb177('0x46')]['length']?_0x480677[_0xb177('0x46')]:_0x5ddf97[_0xb177('0x43')];if(_0x53bae8[_0xb177('0x44')][_0xb177('0x55')]){_0x480677[_0xb177('0x5a')]=[{'all':!![]}];}_0x480677=_[_0xb177('0x51')]({},_0x480677,_0x53bae8['options']);return db[_0xb177('0x54')]['find'](_0x480677)[_0xb177('0x21')](handleEntityNotFound(_0x3edbac,null))['then'](respondWithResult(_0x3edbac,null))['catch'](handleError(_0x3edbac,null));};exports[_0xb177('0x5b')]=function(_0x3b0f1a,_0x4d3001){return db[_0xb177('0x54')][_0xb177('0x5b')](_0x3b0f1a[_0xb177('0x5c')],{})[_0xb177('0x21')](respondWithResult(_0x4d3001,0xc9))[_0xb177('0x2b')](handleError(_0x4d3001,null));};exports[_0xb177('0x39')]=function(_0x26bc7d,_0x3b9ec3){if(_0x26bc7d[_0xb177('0x5c')]['id']){delete _0x26bc7d[_0xb177('0x5c')]['id'];}return db[_0xb177('0x54')][_0xb177('0x5d')]({'where':{'id':_0x26bc7d[_0xb177('0x58')]['id']}})[_0xb177('0x21')](handleEntityNotFound(_0x3b9ec3,null))[_0xb177('0x21')](saveUpdates(_0x26bc7d['body'],null))[_0xb177('0x21')](respondWithResult(_0x3b9ec3,null))[_0xb177('0x2b')](handleError(_0x3b9ec3,null));};exports[_0xb177('0x3a')]=function(_0x3c203d,_0x5e9c0d){return db['WhatsappMessage']['find']({'where':{'id':_0x3c203d['params']['id']}})[_0xb177('0x21')](handleEntityNotFound(_0x5e9c0d,null))[_0xb177('0x21')](removeEntity(_0x5e9c0d,null))[_0xb177('0x2b')](handleError(_0x5e9c0d,null));};exports['describe']=function(_0x312b64,_0x549bca){return db[_0xb177('0x54')][_0xb177('0x5e')]()[_0xb177('0x21')](respondWithResult(_0x549bca,null))[_0xb177('0x2b')](handleError(_0x549bca,null));};var interaction_log=require(_0xb177('0x19'))('whatsapp-interactions');exports[_0xb177('0x5f')]=function(_0x505d50,_0x33e4b4,_0x14747e){var _0x1f304e={'agent':{},'channel':_0xb177('0x60')};if(_0x505d50[_0xb177('0x5c')]['id']){delete _0x505d50['body']['id'];}_0x505d50[_0xb177('0x5c')][_0xb177('0x61')]=!![];_0x505d50[_0xb177('0x5c')]['readAt']=moment()[_0xb177('0x62')](_0xb177('0x63'));_0x505d50[_0xb177('0x5c')]['UserId']=_0x505d50['body'][_0xb177('0x64')]||_0x505d50['user']['id'];_0x1f304e['agent']['id']=_0x505d50[_0xb177('0x5c')]['UserId'];return db[_0xb177('0x54')][_0xb177('0x5d')]({'where':{'id':_0x505d50[_0xb177('0x58')]['id'],'UserId':null}})[_0xb177('0x21')](handleEntityNotFound(_0x33e4b4,null))[_0xb177('0x21')](saveUpdates(_0x505d50[_0xb177('0x5c')],null))[_0xb177('0x21')](function(_0xbcd6f2){if(_0xbcd6f2){_0x1f304e[_0xb177('0x28')]=_0xbcd6f2[_0xb177('0x65')]({'plain':!![]});return db[_0xb177('0x66')][_0xb177('0x5d')]({'where':{'id':_0xbcd6f2[_0xb177('0x67')]}});}return null;})[_0xb177('0x21')](handleEntityNotFound(_0x33e4b4,null))[_0xb177('0x21')](function(_0x151078){if(_0x151078){return _0x151078[_0xb177('0x39')]({'UserId':_0x505d50['body']['UserId'],'read1stAt':_[_0xb177('0x68')](_0x151078[_0xb177('0x69')])?moment()[_0xb177('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb177('0x21')](function(_0x486974){if(_0x486974){_0x1f304e['interaction']=_0x486974[_0xb177('0x65')]({'plain':!![]});interaction_log[_0xb177('0x29')](_0xb177('0x6a'),_0x505d50[_0xb177('0x6b')]['id'],_0x505d50[_0xb177('0x6b')][_0xb177('0x3c')],_0x505d50[_0xb177('0x6b')][_0xb177('0x6c')],_0x1f304e['interaction']['id'],_0x505d50[_0xb177('0x5c')]?JSON[_0xb177('0x25')](_0x505d50[_0xb177('0x5c')]):_0xb177('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xb177('0x6e'),_0x1f304e);}return null;})[_0xb177('0x21')](function(_0xf8a754){var _0xd3ae53=_0xb177('0x6f')+_0xf8a754[_0xb177('0x28')]['ContactId'];return db[_0xb177('0x70')][_0xb177('0x44')](_0xd3ae53,{'type':db[_0xb177('0x71')][_0xb177('0x72')][_0xb177('0x73')],'raw':!![]})['then'](function(_0x365d00){return _0x365d00;});})[_0xb177('0x21')](function(_0x2196b6){if(_0x2196b6){_0x1f304e[_0xb177('0x28')][_0xb177('0x74')]=_0x2196b6[0x0];if(!_0x505d50['body'][_0xb177('0x64')])return;return db[_0xb177('0x75')]['find']({'where':{'id':_0x505d50[_0xb177('0x5c')][_0xb177('0x64')],'role':_0xb177('0x76')},'attributes':['id','name','fullname',_0xb177('0x77'),_0xb177('0x78')],'raw':!![]});}return null;})[_0xb177('0x21')](function(_0x3ff98a){if(!_0x3ff98a)return null;_0x1f304e[_0xb177('0x28')][_0xb177('0x76')]=_0x3ff98a;return _0x1f304e;})[_0xb177('0x21')](function(_0x43f12c){if(_0x43f12c){if(_0x505d50[_0xb177('0x5c')][_0xb177('0x79')]){_0x1f304e[_0xb177('0x28')][_0xb177('0x7a')]=util[_0xb177('0x62')](_0xb177('0x7b'),_0x505d50[_0xb177('0x6b')][_0xb177('0x3c')]);_0x1f304e[_0xb177('0x28')][_0xb177('0x7c')]=_0x1f304e[_0xb177('0x7c')];_0x1f304e[_0xb177('0x28')]['motionChannel']=_0x1f304e[_0xb177('0x7c')];_0x1f304e[_0xb177('0x28')]['event']=_0xb177('0x5f');return respondWithRpcPromise(_0xb177('0x7d'),_0xb177('0x7d'),{'event':_0xb177('0x7e'),'message':_0x1f304e[_0xb177('0x28')]},client9002)[_0xb177('0x21')](function(){return _0x1f304e;});}return _0x1f304e;}return null;})['then'](respondWithResult(_0x33e4b4,null))[_0xb177('0x2b')](handleError(_0x33e4b4,null));};var interaction_log=require(_0xb177('0x19'))(_0xb177('0x7f'));exports['reject']=function(_0xa506b1,_0x3c52fe,_0x4c91f5){var _0x424634={'agent':{},'channel':_0xb177('0x60')};if(_0xa506b1[_0xb177('0x5c')]['id']){delete _0xa506b1['body']['id'];}_0xa506b1[_0xb177('0x5c')][_0xb177('0x64')]=_0xa506b1[_0xb177('0x5c')][_0xb177('0x64')]||_0xa506b1[_0xb177('0x6b')]['id'];_0x424634[_0xb177('0x76')]['id']=_0xa506b1['body'][_0xb177('0x64')];return db['WhatsappMessage'][_0xb177('0x5d')]({'where':{'id':_0xa506b1[_0xb177('0x58')]['id'],'UserId':null}})[_0xb177('0x21')](handleEntityNotFound(_0x3c52fe,null))[_0xb177('0x21')](function(_0x545d56){if(_0x545d56){_0x424634[_0xb177('0x28')]=_0x545d56['get']({'plain':!![]});return db[_0xb177('0x66')][_0xb177('0x5d')]({'where':{'id':_0x545d56[_0xb177('0x67')]}});}return null;})[_0xb177('0x21')](handleEntityNotFound(_0x3c52fe,null))['then'](function(_0x5c831a){if(_0x5c831a){_0x424634[_0xb177('0x80')]=_0x5c831a[_0xb177('0x65')]({'plain':!![]});interaction_log[_0xb177('0x29')](_0xb177('0x81'),_0xa506b1[_0xb177('0x6b')]['id'],_0xa506b1[_0xb177('0x6b')][_0xb177('0x3c')],_0xa506b1[_0xb177('0x6b')][_0xb177('0x6c')],_0x424634['interaction']['id'],_0xa506b1['body']?JSON[_0xb177('0x25')](_0xa506b1[_0xb177('0x5c')]):_0xb177('0x6d'));return respondWithRpcPromise(_0xb177('0x82'),'rejectMessage',_0x424634);}return null;})['then'](function(_0x5ab63a){var _0x164ec2=_0xb177('0x6f')+_0x5ab63a[_0xb177('0x28')]['ContactId'];return db[_0xb177('0x70')][_0xb177('0x44')](_0x164ec2,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xb177('0x21')](function(_0x5b7751){return _0x5b7751;});})[_0xb177('0x21')](function(_0x403808){if(_0x403808){_0x424634[_0xb177('0x28')][_0xb177('0x74')]=_0x403808[0x0];if(!_0xa506b1[_0xb177('0x5c')]['UserId'])return;return db[_0xb177('0x75')]['find']({'where':{'id':_0xa506b1['body'][_0xb177('0x64')],'role':'agent'},'attributes':['id',_0xb177('0x3c'),_0xb177('0x83'),_0xb177('0x77'),_0xb177('0x78')],'raw':!![]});}return null;})['then'](function(_0x2ff1cd){if(!_0x2ff1cd)return null;_0x424634[_0xb177('0x28')][_0xb177('0x76')]=_0x2ff1cd;return _0x424634;})[_0xb177('0x21')](function(_0x481c73){if(_0x481c73){_0x481c73[_0xb177('0x28')][_0xb177('0x7a')]=util['format'](_0xb177('0x7b'),_0xa506b1[_0xb177('0x6b')]['name']);_0x481c73[_0xb177('0x28')]['channel']=_0x424634['channel'];_0x481c73[_0xb177('0x28')][_0xb177('0x84')]=_0x424634[_0xb177('0x7c')];_0x481c73[_0xb177('0x28')]['event']=_0xb177('0x37');respondWithRpcPromise('EventManager',_0xb177('0x7d'),{'event':'rejectmessage','message':_0x481c73['message']},client9002);return _0x424634;}return null;})[_0xb177('0x21')](respondWithResult(_0x3c52fe,null))[_0xb177('0x2b')](handleError(_0x3c52fe,null));};exports[_0xb177('0x2d')]=function(_0x43de38,_0x553cde,_0x4eccd0){if(_0x43de38[_0xb177('0x5c')]['id']){delete _0x43de38[_0xb177('0x5c')]['id'];}var _0x2364b5;return db[_0xb177('0x54')][_0xb177('0x5d')]({'where':{'id':_0x43de38[_0xb177('0x58')]['id']}})['then'](handleEntityNotFound(_0x553cde,null))[_0xb177('0x21')](function(_0x287e31){if(_0x287e31){_0x2364b5=_0x287e31;return db[_0xb177('0x85')]['find']({'where':{'id':_0x287e31[_0xb177('0x86')]}});}})['then'](handleEntityNotFound(_0x553cde,null))['then'](function(_0x4a7589){if(_0x4a7589){logger[_0xb177('0x24')](_0xb177('0x87'),'status',_0xb177('0x88'),_0x4a7589['type'],util[_0xb177('0x89')](_0x43de38[_0xb177('0x5c')],{'showHidden':![],'depth':null}));switch(_0x4a7589[_0xb177('0x41')]){case _0xb177('0x8a'):if(_0x43de38[_0xb177('0x5c')][_0xb177('0x8b')]&&_0x43de38[_0xb177('0x5c')][_0xb177('0x8b')]===_0x2364b5[_0xb177('0x8c')]&&_0x43de38['body']['MessageStatus']&&_0x43de38['body'][_0xb177('0x8d')]===_0xb177('0x61')){return _0x2364b5[_0xb177('0x39')]({'read':!![]});}else{logger[_0xb177('0x26')](_0xb177('0x8e'),_0xb177('0x2d'),_0xb177('0x8a'),util[_0xb177('0x89')](_0x43de38[_0xb177('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x2364b5;}})['then'](respondWithResult(_0x553cde,null))[_0xb177('0x2b')](handleError(_0x553cde,null));}; \ No newline at end of file +var _0x838f=['keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','create','body','update','find','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','get','WhatsappInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','agent','WhatsappInteractionId','rejectMessage','event','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','MessageStatus','twilio','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key'];(function(_0x111215,_0x49f5aa){var _0x11ecfc=function(_0x398a6b){while(--_0x398a6b){_0x111215['push'](_0x111215['shift']());}};_0x11ecfc(++_0x49f5aa);}(_0x838f,0x162));var _0xf838=function(_0x14c06f,_0x18460b){_0x14c06f=_0x14c06f-0x0;var _0x2d54e2=_0x838f[_0x14c06f];return _0x2d54e2;};'use strict';var emlformat=require(_0xf838('0x0'));var rimraf=require(_0xf838('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf838('0x2'));var rp=require(_0xf838('0x3'));var moment=require(_0xf838('0x4'));var BPromise=require(_0xf838('0x5'));var Mustache=require(_0xf838('0x6'));var util=require(_0xf838('0x7'));var path=require('path');var sox=require(_0xf838('0x8'));var csv=require(_0xf838('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf838('0xa'));var _=require(_0xf838('0xb'));var squel=require('squel');var crypto=require(_0xf838('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf838('0x9'));var querystring=require(_0xf838('0xd'));var Papa=require(_0xf838('0xe'));var Redis=require(_0xf838('0xf'));var authService=require(_0xf838('0x10'));var qs=require(_0xf838('0x11'));var as=require(_0xf838('0x12'));var hardwareService=require(_0xf838('0x13'));var logger=require(_0xf838('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf838('0x15'));var licenseUtil=require(_0xf838('0x16'));var db=require(_0xf838('0x17'))['db'];config[_0xf838('0x18')]=_[_0xf838('0x19')](config[_0xf838('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xf838('0x1a'))(new Redis(config[_0xf838('0x18')]));require(_0xf838('0x1b'))['register'](socket);var jayson=require(_0xf838('0x1c'));var client=jayson[_0xf838('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xf838('0x1d')][_0xf838('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5b3fb0,_0x2702e2,_0x37af71,_0x475367){return new BPromise(function(_0x3d0bb1,_0x39d953){var _0x4e50bd=_0x475367||client;return _0x4e50bd[_0xf838('0x1f')](_0x5b3fb0,_0x37af71)[_0xf838('0x20')](function(_0x43ac44){logger[_0xf838('0x21')](_0xf838('0x22'),_0x2702e2,_0xf838('0x23'));logger['debug'](_0xf838('0x24'),_0x2702e2,_0xf838('0x23'),JSON[_0xf838('0x25')](_0x43ac44));if(_0x43ac44['error']){if(_0x43ac44[_0xf838('0x26')][_0xf838('0x27')]===0x1f4){logger['error'](_0xf838('0x22'),_0x2702e2,_0x43ac44[_0xf838('0x26')][_0xf838('0x28')]);return _0x39d953(_0x43ac44[_0xf838('0x26')][_0xf838('0x28')]);}logger[_0xf838('0x26')](_0xf838('0x22'),_0x2702e2,_0x43ac44[_0xf838('0x26')][_0xf838('0x28')]);return _0x3d0bb1(_0x43ac44[_0xf838('0x26')]['message']);}else{logger['info'](_0xf838('0x22'),_0x2702e2,_0xf838('0x23'));_0x3d0bb1(_0x43ac44[_0xf838('0x29')]['message']);}})[_0xf838('0x2a')](function(_0x318b14){logger[_0xf838('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x2702e2,_0x318b14);_0x39d953(_0x318b14);});});}function respondWithStatusCode(_0x14fbd9,_0x2fe0db){_0x2fe0db=_0x2fe0db||0xcc;return function(_0x70983a){if(_0x70983a){return _0x14fbd9[_0xf838('0x2b')](_0x2fe0db);}return _0x14fbd9[_0xf838('0x2c')](_0x2fe0db)['end']();};}function respondWithResult(_0x2fad7f,_0x4b888d){_0x4b888d=_0x4b888d||0xc8;return function(_0x4fbcdf){if(_0x4fbcdf){return _0x2fad7f['status'](_0x4b888d)[_0xf838('0x2d')](_0x4fbcdf);}};}function respondWithFilteredResult(_0x3e1552,_0xd51c8c){return function(_0xdce69b){if(_0xdce69b){var _0xdf30da=typeof _0xd51c8c['offset']===_0xf838('0x2e')&&typeof _0xd51c8c[_0xf838('0x2f')]===_0xf838('0x2e');var _0x36f12d=_0xdce69b[_0xf838('0x30')];var _0x1252dd=_0xdf30da?0x0:_0xd51c8c[_0xf838('0x31')];var _0x2ec838=_0xdf30da?_0xdce69b['count']:_0xd51c8c[_0xf838('0x31')]+_0xd51c8c[_0xf838('0x2f')];var _0x44c640;if(_0x2ec838>=_0x36f12d){_0x2ec838=_0x36f12d;_0x44c640=0xc8;}else{_0x44c640=0xce;}_0x3e1552[_0xf838('0x2c')](_0x44c640);return _0x3e1552[_0xf838('0x32')](_0xf838('0x33'),_0x1252dd+'-'+_0x2ec838+'/'+_0x36f12d)[_0xf838('0x2d')](_0xdce69b);}return null;};}function patchUpdates(_0x35025b){return function(_0x38ab09){try{jsonpatch['apply'](_0x38ab09,_0x35025b,!![]);}catch(_0x5abb11){return BPromise[_0xf838('0x34')](_0x5abb11);}return _0x38ab09[_0xf838('0x35')]();};}function saveUpdates(_0x4a86b8,_0x1dcebb){return function(_0xec9543){if(_0xec9543){return _0xec9543['update'](_0x4a86b8)[_0xf838('0x20')](function(_0x54ae52){return _0x54ae52;});}return null;};}function removeEntity(_0x43cdaa,_0x375ded){return function(_0x2d331b){if(_0x2d331b){return _0x2d331b['destroy']()['then'](function(){_0x43cdaa[_0xf838('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0f41,_0x50298e){return function(_0x13f95a){if(!_0x13f95a){_0x4f0f41[_0xf838('0x2b')](0x194);}return _0x13f95a;};}function handleError(_0x232645,_0x1ab593){_0x1ab593=_0x1ab593||0x1f4;return function(_0x2d036e){logger[_0xf838('0x26')](_0x2d036e[_0xf838('0x36')]);if(_0x2d036e[_0xf838('0x37')]){delete _0x2d036e[_0xf838('0x37')];}_0x232645[_0xf838('0x2c')](_0x1ab593)[_0xf838('0x38')](_0x2d036e);};}exports[_0xf838('0x39')]=function(_0x356298,_0x51c0d0){var _0x25b1c9={},_0x5cb7b3={},_0x889cd8={'count':0x0,'rows':[]};var _0x5a79bd=_[_0xf838('0x3a')](db[_0xf838('0x3b')][_0xf838('0x3c')],function(_0x560eab){return{'name':_0x560eab['fieldName'],'type':_0x560eab[_0xf838('0x3d')][_0xf838('0x3e')]};});_0x5cb7b3['model']=_[_0xf838('0x3a')](_0x5a79bd,_0xf838('0x37'));_0x5cb7b3['query']=_[_0xf838('0x3f')](_0x356298[_0xf838('0x40')]);_0x5cb7b3[_0xf838('0x41')]=_[_0xf838('0x42')](_0x5cb7b3[_0xf838('0x43')],_0x5cb7b3['query']);_0x25b1c9[_0xf838('0x44')]=_[_0xf838('0x42')](_0x5cb7b3[_0xf838('0x43')],qs['fields'](_0x356298[_0xf838('0x40')][_0xf838('0x45')]));_0x25b1c9['attributes']=_0x25b1c9[_0xf838('0x44')][_0xf838('0x46')]?_0x25b1c9[_0xf838('0x44')]:_0x5cb7b3[_0xf838('0x43')];if(!_0x356298[_0xf838('0x40')][_0xf838('0x47')](_0xf838('0x48'))){_0x25b1c9[_0xf838('0x2f')]=qs[_0xf838('0x2f')](_0x356298['query'][_0xf838('0x2f')]);_0x25b1c9['offset']=qs[_0xf838('0x31')](_0x356298['query'][_0xf838('0x31')]);}_0x25b1c9[_0xf838('0x49')]=qs['sort'](_0x356298['query'][_0xf838('0x4a')]);_0x25b1c9['where']=qs[_0xf838('0x41')](_[_0xf838('0x4b')](_0x356298[_0xf838('0x40')],_0x5cb7b3[_0xf838('0x41')]),_0x5a79bd);if(_0x356298[_0xf838('0x40')]['filter']){_0x25b1c9[_0xf838('0x4c')]=_[_0xf838('0x4d')](_0x25b1c9[_0xf838('0x4c')],{'$or':_[_0xf838('0x3a')](_0x5a79bd,function(_0x2d97bc){if(_0x2d97bc['type']!==_0xf838('0x4e')){var _0x48d6c4={};_0x48d6c4[_0x2d97bc[_0xf838('0x37')]]={'$like':'%'+_0x356298['query'][_0xf838('0x4f')]+'%'};return _0x48d6c4;}})});}_0x25b1c9=_[_0xf838('0x4d')]({},_0x25b1c9,_0x356298[_0xf838('0x50')]);var _0x531ee3={'where':_0x25b1c9['where']};return db[_0xf838('0x3b')][_0xf838('0x30')](_0x531ee3)[_0xf838('0x20')](function(_0x1dc810){_0x889cd8[_0xf838('0x30')]=_0x1dc810;if(_0x356298[_0xf838('0x40')][_0xf838('0x51')]){_0x25b1c9[_0xf838('0x52')]=[{'all':!![]}];}return db[_0xf838('0x3b')][_0xf838('0x53')](_0x25b1c9);})['then'](function(_0x979803){_0x889cd8[_0xf838('0x54')]=_0x979803;return _0x889cd8;})[_0xf838('0x20')](respondWithFilteredResult(_0x51c0d0,_0x25b1c9))[_0xf838('0x2a')](handleError(_0x51c0d0,null));};exports[_0xf838('0x55')]=function(_0x29de26,_0x1ef6ff){var _0x3131be={'raw':!![],'where':{'id':_0x29de26[_0xf838('0x56')]['id']}},_0x488369={};_0x488369[_0xf838('0x43')]=_[_0xf838('0x3f')](db[_0xf838('0x3b')][_0xf838('0x3c')]);_0x488369[_0xf838('0x40')]=_['keys'](_0x29de26[_0xf838('0x40')]);_0x488369[_0xf838('0x41')]=_[_0xf838('0x42')](_0x488369[_0xf838('0x43')],_0x488369[_0xf838('0x40')]);_0x3131be[_0xf838('0x44')]=_[_0xf838('0x42')](_0x488369[_0xf838('0x43')],qs['fields'](_0x29de26[_0xf838('0x40')][_0xf838('0x45')]));_0x3131be[_0xf838('0x44')]=_0x3131be[_0xf838('0x44')][_0xf838('0x46')]?_0x3131be['attributes']:_0x488369['model'];if(_0x29de26[_0xf838('0x40')][_0xf838('0x51')]){_0x3131be['include']=[{'all':!![]}];}_0x3131be=_[_0xf838('0x4d')]({},_0x3131be,_0x29de26[_0xf838('0x50')]);return db[_0xf838('0x3b')]['find'](_0x3131be)[_0xf838('0x20')](handleEntityNotFound(_0x1ef6ff,null))[_0xf838('0x20')](respondWithResult(_0x1ef6ff,null))[_0xf838('0x2a')](handleError(_0x1ef6ff,null));};exports[_0xf838('0x57')]=function(_0x526cb1,_0x34d6fb){return db[_0xf838('0x3b')][_0xf838('0x57')](_0x526cb1[_0xf838('0x58')],{})[_0xf838('0x20')](respondWithResult(_0x34d6fb,0xc9))['catch'](handleError(_0x34d6fb,null));};exports[_0xf838('0x59')]=function(_0x288d42,_0x55fc82){if(_0x288d42[_0xf838('0x58')]['id']){delete _0x288d42['body']['id'];}return db[_0xf838('0x3b')][_0xf838('0x5a')]({'where':{'id':_0x288d42[_0xf838('0x56')]['id']}})['then'](handleEntityNotFound(_0x55fc82,null))[_0xf838('0x20')](saveUpdates(_0x288d42[_0xf838('0x58')],null))[_0xf838('0x20')](respondWithResult(_0x55fc82,null))['catch'](handleError(_0x55fc82,null));};exports[_0xf838('0x5b')]=function(_0x38395f,_0x58dabc){return db['WhatsappMessage'][_0xf838('0x5a')]({'where':{'id':_0x38395f[_0xf838('0x56')]['id']}})[_0xf838('0x20')](handleEntityNotFound(_0x58dabc,null))['then'](removeEntity(_0x58dabc,null))[_0xf838('0x2a')](handleError(_0x58dabc,null));};exports[_0xf838('0x5c')]=function(_0x5dca8a,_0x2c9d00){return db[_0xf838('0x3b')]['describe']()[_0xf838('0x20')](respondWithResult(_0x2c9d00,null))[_0xf838('0x2a')](handleError(_0x2c9d00,null));};var interaction_log=require(_0xf838('0x14'))(_0xf838('0x5d'));exports[_0xf838('0x5e')]=function(_0x4a9cb1,_0x3ff985,_0xfbbde2){var _0x100f8c={'agent':{},'channel':_0xf838('0x5f')};if(_0x4a9cb1[_0xf838('0x58')]['id']){delete _0x4a9cb1[_0xf838('0x58')]['id'];}_0x4a9cb1[_0xf838('0x58')][_0xf838('0x60')]=!![];_0x4a9cb1[_0xf838('0x58')][_0xf838('0x61')]=moment()[_0xf838('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a9cb1[_0xf838('0x58')][_0xf838('0x63')]=_0x4a9cb1['body'][_0xf838('0x63')]||_0x4a9cb1[_0xf838('0x64')]['id'];_0x100f8c['agent']['id']=_0x4a9cb1[_0xf838('0x58')][_0xf838('0x63')];return db['WhatsappMessage'][_0xf838('0x5a')]({'where':{'id':_0x4a9cb1[_0xf838('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ff985,null))[_0xf838('0x20')](saveUpdates(_0x4a9cb1[_0xf838('0x58')],null))[_0xf838('0x20')](function(_0x563bf0){if(_0x563bf0){_0x100f8c[_0xf838('0x28')]=_0x563bf0[_0xf838('0x65')]({'plain':!![]});return db[_0xf838('0x66')][_0xf838('0x5a')]({'where':{'id':_0x563bf0['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3ff985,null))[_0xf838('0x20')](function(_0x475567){if(_0x475567){return _0x475567[_0xf838('0x59')]({'UserId':_0x4a9cb1[_0xf838('0x58')][_0xf838('0x63')],'read1stAt':_[_0xf838('0x67')](_0x475567['read1stAt'])?moment()['format'](_0xf838('0x68')):undefined});}return null;})[_0xf838('0x20')](function(_0x4973d4){if(_0x4973d4){_0x100f8c[_0xf838('0x69')]=_0x4973d4[_0xf838('0x65')]({'plain':!![]});interaction_log[_0xf838('0x21')](_0xf838('0x6a'),_0x4a9cb1[_0xf838('0x64')]['id'],_0x4a9cb1[_0xf838('0x64')][_0xf838('0x37')],_0x4a9cb1[_0xf838('0x64')][_0xf838('0x6b')],_0x100f8c[_0xf838('0x69')]['id'],_0x4a9cb1[_0xf838('0x58')]?JSON[_0xf838('0x25')](_0x4a9cb1[_0xf838('0x58')]):'null');return respondWithRpcPromise(_0xf838('0x6c'),_0xf838('0x6d'),_0x100f8c);}return null;})[_0xf838('0x20')](function(_0x3cb3b1){var _0x56f75c=_0xf838('0x6e')+_0x3cb3b1[_0xf838('0x28')][_0xf838('0x6f')];return db[_0xf838('0x70')][_0xf838('0x40')](_0x56f75c,{'type':db[_0xf838('0x71')]['QueryTypes'][_0xf838('0x72')],'raw':!![]})['then'](function(_0x45e51f){return _0x45e51f;});})['then'](function(_0x4b02b3){if(_0x4b02b3){_0x100f8c[_0xf838('0x28')][_0xf838('0x73')]=_0x4b02b3[0x0];if(!_0x4a9cb1[_0xf838('0x58')][_0xf838('0x63')])return;return db[_0xf838('0x74')]['find']({'where':{'id':_0x4a9cb1[_0xf838('0x58')][_0xf838('0x63')],'role':'agent'},'attributes':['id',_0xf838('0x37'),'fullname',_0xf838('0x75'),_0xf838('0x76')],'raw':!![]});}return null;})[_0xf838('0x20')](function(_0x2d0260){if(!_0x2d0260)return null;_0x100f8c[_0xf838('0x28')]['agent']=_0x2d0260;return _0x100f8c;})[_0xf838('0x20')](function(_0x3c7877){if(_0x3c7877){if(_0x4a9cb1[_0xf838('0x58')]['manual']){_0x100f8c[_0xf838('0x28')][_0xf838('0x77')]=util[_0xf838('0x62')](_0xf838('0x78'),_0x4a9cb1['user'][_0xf838('0x37')]);_0x100f8c[_0xf838('0x28')][_0xf838('0x79')]=_0x100f8c[_0xf838('0x79')];_0x100f8c[_0xf838('0x28')][_0xf838('0x7a')]=_0x100f8c[_0xf838('0x79')];_0x100f8c['message']['event']='accept';return respondWithRpcPromise(_0xf838('0x7b'),_0xf838('0x7b'),{'event':_0xf838('0x7c'),'message':_0x100f8c[_0xf838('0x28')]},client9002)[_0xf838('0x20')](function(){return _0x100f8c;});}return _0x100f8c;}return null;})[_0xf838('0x20')](respondWithResult(_0x3ff985,null))[_0xf838('0x2a')](handleError(_0x3ff985,null));};var interaction_log=require('../../config/logger')(_0xf838('0x5d'));exports[_0xf838('0x34')]=function(_0x24898e,_0x3e5513,_0x479fe6){var _0x151873={'agent':{},'channel':_0xf838('0x5f')};if(_0x24898e[_0xf838('0x58')]['id']){delete _0x24898e[_0xf838('0x58')]['id'];}_0x24898e[_0xf838('0x58')][_0xf838('0x63')]=_0x24898e[_0xf838('0x58')]['UserId']||_0x24898e['user']['id'];_0x151873[_0xf838('0x7d')]['id']=_0x24898e[_0xf838('0x58')][_0xf838('0x63')];return db[_0xf838('0x3b')][_0xf838('0x5a')]({'where':{'id':_0x24898e['params']['id'],'UserId':null}})[_0xf838('0x20')](handleEntityNotFound(_0x3e5513,null))[_0xf838('0x20')](function(_0x490b9e){if(_0x490b9e){_0x151873[_0xf838('0x28')]=_0x490b9e['get']({'plain':!![]});return db[_0xf838('0x66')][_0xf838('0x5a')]({'where':{'id':_0x490b9e[_0xf838('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x3e5513,null))['then'](function(_0x2ceec4){if(_0x2ceec4){_0x151873[_0xf838('0x69')]=_0x2ceec4[_0xf838('0x65')]({'plain':!![]});interaction_log[_0xf838('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x24898e[_0xf838('0x64')]['id'],_0x24898e['user'][_0xf838('0x37')],_0x24898e['user'][_0xf838('0x6b')],_0x151873[_0xf838('0x69')]['id'],_0x24898e[_0xf838('0x58')]?JSON['stringify'](_0x24898e[_0xf838('0x58')]):'null');return respondWithRpcPromise('RejectMessage',_0xf838('0x7f'),_0x151873);}return null;})[_0xf838('0x20')](function(_0x407b8e){var _0x386680=_0xf838('0x6e')+_0x407b8e[_0xf838('0x28')][_0xf838('0x6f')];return db[_0xf838('0x70')][_0xf838('0x40')](_0x386680,{'type':db[_0xf838('0x71')]['QueryTypes'][_0xf838('0x72')],'raw':!![]})[_0xf838('0x20')](function(_0x254ab7){return _0x254ab7;});})['then'](function(_0x18c77e){if(_0x18c77e){_0x151873[_0xf838('0x28')]['contact']=_0x18c77e[0x0];if(!_0x24898e[_0xf838('0x58')][_0xf838('0x63')])return;return db['User'][_0xf838('0x5a')]({'where':{'id':_0x24898e[_0xf838('0x58')][_0xf838('0x63')],'role':_0xf838('0x7d')},'attributes':['id',_0xf838('0x37'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xf838('0x20')](function(_0x5a54cd){if(!_0x5a54cd)return null;_0x151873[_0xf838('0x28')][_0xf838('0x7d')]=_0x5a54cd;return _0x151873;})[_0xf838('0x20')](function(_0x222794){if(_0x222794){_0x222794[_0xf838('0x28')][_0xf838('0x77')]=util[_0xf838('0x62')](_0xf838('0x78'),_0x24898e[_0xf838('0x64')][_0xf838('0x37')]);_0x222794[_0xf838('0x28')][_0xf838('0x79')]=_0x151873[_0xf838('0x79')];_0x222794[_0xf838('0x28')][_0xf838('0x7a')]=_0x151873['channel'];_0x222794['message'][_0xf838('0x80')]=_0xf838('0x34');respondWithRpcPromise(_0xf838('0x7b'),_0xf838('0x7b'),{'event':_0xf838('0x81'),'message':_0x222794[_0xf838('0x28')]},client9002);return _0x151873;}return null;})['then'](respondWithResult(_0x3e5513,null))[_0xf838('0x2a')](handleError(_0x3e5513,null));};exports[_0xf838('0x2c')]=function(_0x18de01,_0x41580c,_0x108208){if(_0x18de01[_0xf838('0x58')]['id']){delete _0x18de01[_0xf838('0x58')]['id'];}var _0x163c9e;return db['WhatsappMessage'][_0xf838('0x5a')]({'where':{'id':_0x18de01['params']['id']}})[_0xf838('0x20')](handleEntityNotFound(_0x41580c,null))[_0xf838('0x20')](function(_0x42a627){if(_0x42a627){_0x163c9e=_0x42a627;return db[_0xf838('0x82')]['find']({'where':{'id':_0x42a627[_0xf838('0x83')]}});}})[_0xf838('0x20')](handleEntityNotFound(_0x41580c,null))[_0xf838('0x20')](function(_0x2c862c){if(_0x2c862c){logger[_0xf838('0x84')](_0xf838('0x85'),_0xf838('0x2c'),_0xf838('0x86'),_0x2c862c[_0xf838('0x3d')],util[_0xf838('0x87')](_0x18de01['body'],{'showHidden':![],'depth':null}));switch(_0x2c862c[_0xf838('0x3d')]){case'twilio':if(_0x18de01[_0xf838('0x58')][_0xf838('0x88')]&&_0x18de01[_0xf838('0x58')][_0xf838('0x88')]===_0x163c9e['messageId']&&_0x18de01[_0xf838('0x58')]['MessageStatus']&&_0x18de01[_0xf838('0x58')][_0xf838('0x89')]===_0xf838('0x60')){return _0x163c9e[_0xf838('0x59')]({'read':!![]});}else{logger[_0xf838('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xf838('0x8a'),util[_0xf838('0x87')](_0x18de01[_0xf838('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x163c9e;}})[_0xf838('0x20')](respondWithResult(_0x41580c,null))[_0xf838('0x2a')](handleError(_0x41580c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 8b17a18..953501e 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 _0x6c76=['update','emit','hook','events','../../mysqldb','WhatsappMessage','save'];(function(_0x2dde07,_0x590b49){var _0xa4a1f8=function(_0x337f30){while(--_0x337f30){_0x2dde07['push'](_0x2dde07['shift']());}};_0xa4a1f8(++_0x590b49);}(_0x6c76,0x184));var _0x66c7=function(_0x4b67c0,_0x535c00){_0x4b67c0=_0x4b67c0-0x0;var _0x3cdf05=_0x6c76[_0x4b67c0];return _0x3cdf05;};'use strict';var EventEmitter=require(_0x66c7('0x0'));var WhatsappMessage=require(_0x66c7('0x1'))['db'][_0x66c7('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x66c7('0x3'),'afterUpdate':_0x66c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x572a2b){return function(_0x2f6db7,_0x2b7cf3,_0x49d437){WhatsappMessageEvents[_0x66c7('0x5')](_0x572a2b+':'+_0x2f6db7['id'],_0x2f6db7);WhatsappMessageEvents[_0x66c7('0x5')](_0x572a2b,_0x2f6db7);_0x49d437(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x66c7('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x98e5=['setMaxListeners','save','remove','emit','hook','exports'];(function(_0x58fd5c,_0x3cc7a8){var _0x104f5c=function(_0x8253bd){while(--_0x8253bd){_0x58fd5c['push'](_0x58fd5c['shift']());}};_0x104f5c(++_0x3cc7a8);}(_0x98e5,0x8a));var _0x598e=function(_0x1d7490,_0x24b525){_0x1d7490=_0x1d7490-0x0;var _0x53862c=_0x98e5[_0x1d7490];return _0x53862c;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x598e('0x0')](0x0);var events={'afterCreate':_0x598e('0x1'),'afterUpdate':'update','afterDestroy':_0x598e('0x2')};function emitEvent(_0xc090ec){return function(_0x5cc274,_0x3af01f,_0x5a876c){WhatsappMessageEvents['emit'](_0xc090ec+':'+_0x5cc274['id'],_0x5cc274);WhatsappMessageEvents[_0x598e('0x3')](_0xc090ec,_0x5cc274);_0x5a876c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x598e('0x4')](e,emitEvent(event));}}module[_0x598e('0x5')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index dcb19af..f18fce8 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 _0xe26c=['out','secret','findOne','WhatsappInteractionId','then','update','catch','WhatsappAccount','find','WhatsappAccountId','type','authToken','phone','accountSid','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','/whatsapp/v1/','text','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction'];(function(_0x3f17eb,_0xb66d06){var _0x4ed3b8=function(_0x4915ce){while(--_0x4915ce){_0x3f17eb['push'](_0x3f17eb['shift']());}};_0x4ed3b8(++_0xb66d06);}(_0xe26c,0x1b2));var _0xce26=function(_0x4fb401,_0x2af0b2){_0x4fb401=_0x4fb401-0x0;var _0x45e901=_0xe26c[_0x4fb401];return _0x45e901;};'use strict';var _=require(_0xce26('0x0'));var util=require(_0xce26('0x1'));var logger=require(_0xce26('0x2'))(_0xce26('0x3'));var moment=require(_0xce26('0x4'));var BPromise=require(_0xce26('0x5'));var rp=require(_0xce26('0x6'));var fetch=require(_0xce26('0x7'));var fs=require('fs');var path=require(_0xce26('0x8'));var rimraf=require('rimraf');var config=require(_0xce26('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0xce26('0xa')]=function(_0x51ca1a,_0x41d037){return _0x51ca1a[_0xce26('0xb')](_0xce26('0xc'),attributes,{'tableName':_0xce26('0xd'),'paranoid':![],'indexes':[{'name':_0xce26('0xe'),'fields':[_0xce26('0xe')]},{'name':_0xce26('0xf'),'fields':[_0xce26('0x10')],'type':_0xce26('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1dc892,_0x3f0a13,_0x4e6afb){var _0x222c6a=_0x51ca1a[_0xce26('0x12')];var _0x874c59=_0x1dc892[_0xce26('0x13')]({'plain':!![]});if(_0x874c59['direction'][_0xce26('0x14')]()==='in'||_0x874c59[_0xce26('0x15')]['toLowerCase']()===_0xce26('0x16')&&!_0x874c59[_0xce26('0x17')]&&!_['isNil'](_0x874c59['UserId'])){_0x222c6a['WhatsappInteraction'][_0xce26('0x18')]({'where':{'id':_0x874c59[_0xce26('0x19')]}})[_0xce26('0x1a')](function(_0x4defe1){if(_0x4defe1){_0x4defe1[_0xce26('0x1b')]({'lastMsgAt':_0x874c59['createdAt'],'lastMsgDirection':_0x874c59[_0xce26('0x15')][_0xce26('0x14')]()});}})[_0xce26('0x1c')](function(_0x2ef3d6){console['error'](_0x2ef3d6);});}if(_0x874c59[_0xce26('0x15')]===_0xce26('0x16')&&!_0x874c59[_0xce26('0x17')]){var _0x328542;_0x222c6a[_0xce26('0x1d')][_0xce26('0x1e')]({'where':{'id':_0x874c59[_0xce26('0x1f')]},'raw':!![]})[_0xce26('0x1a')](function(_0x262145){_0x328542=_0x262145;if(_0x328542&&_0x328542[_0xce26('0x20')]){switch(_0x328542[_0xce26('0x20')]){case'twilio':var _0xcbca82=require('twilio');if(_0x328542['accountSid']&&_0x328542[_0xce26('0x21')]&&_0x328542[_0xce26('0x22')]){var _0x4d7195=new _0xcbca82(_0x328542[_0xce26('0x23')],_0x328542[_0xce26('0x21')]);_0x4d7195[_0xce26('0x24')][_0xce26('0x25')]({'body':_0x874c59['body'],'to':_0xce26('0x26')+_0x874c59[_0xce26('0x22')],'from':_0xce26('0x26')+_0x328542[_0xce26('0x22')],'statusCallback':_0x328542[_0xce26('0x27')]+_0xce26('0x28')+_0x874c59['id']+_0xce26('0x29')+_0x328542[_0xce26('0x2a')]})[_0xce26('0x1a')](function(_0x245b60){if(_0x245b60[_0xce26('0x2b')]){return _0x1dc892[_0xce26('0x1b')]({'messageId':_0x245b60['sid']});}})[_0xce26('0x1c')](function(_0xcdc293){logger[_0xce26('0x2c')](_0xce26('0x2d'),_0xce26('0x2e'),'twilio',util[_0xce26('0x2f')](_0xcdc293,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xce26('0x2d'),_0xce26('0x2e'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x2ffb02=_0x328542[_0xce26('0x23')];var _0x4a282d=_0x328542[_0xce26('0x21')];var _0x106321=_0x328542['baseUrl']+_0xce26('0x30')+_0x2ffb02+'/messages/';var _0x5b2705={'to':[_0x874c59[_0xce26('0x22')]],'message':{'type':_0xce26('0x31'),'text':_0x874c59['body']}};var _0x28c020={'method':'POST','uri':_0x106321,'headers':{'Authorization':_0xce26('0x32')+_0x4a282d,'Content-Type':_0xce26('0x33')},'body':_0x5b2705,'json':!![]};rp(_0x28c020)[_0xce26('0x1a')](function(_0x231682){if(_0x231682[_0xce26('0x34')][0x0][_0xce26('0x35')]){return _0x1dc892[_0xce26('0x1b')]({'messageId':_0x231682['statuses'][0x0]['message_id']});}})[_0xce26('0x1c')](function(_0x24a8d2){logger[_0xce26('0x36')]('WhatsappMessage,\x20%s',_0x24a8d2);});break;}}})[_0xce26('0x37')](function(){_0x4e6afb();});}else{_0x4e6afb();}}},'charset':'utf8mb4','collate':_0xce26('0x38')});}; \ No newline at end of file +var _0x6f60=['get','direction','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','toLowerCase','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','node-fetch','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','body','FULLTEXT'];(function(_0x5c00d7,_0x272be2){var _0x2c4bad=function(_0x742e95){while(--_0x742e95){_0x5c00d7['push'](_0x5c00d7['shift']());}};_0x2c4bad(++_0x272be2);}(_0x6f60,0x116));var _0x06f6=function(_0xbd47fb,_0x3dbcfb){_0xbd47fb=_0xbd47fb-0x0;var _0x27b434=_0x6f60[_0xbd47fb];return _0x27b434;};'use strict';var _=require(_0x06f6('0x0'));var util=require(_0x06f6('0x1'));var logger=require('../../config/logger')(_0x06f6('0x2'));var moment=require(_0x06f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x06f6('0x4'));var fetch=require(_0x06f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x06f6('0x6'));module[_0x06f6('0x7')]=function(_0x4ebc1d,_0x1468ef){return _0x4ebc1d['define'](_0x06f6('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x06f6('0x9'),'fields':[_0x06f6('0x9')]},{'name':'fti_whatsapp_messages','fields':[_0x06f6('0xa')],'type':_0x06f6('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53d087,_0x4efa5b,_0x2befcf){var _0x2f2d8e=_0x4ebc1d['models'];var _0xa69e69=_0x53d087[_0x06f6('0xc')]({'plain':!![]});if(_0xa69e69[_0x06f6('0xd')]['toLowerCase']()==='in'||_0xa69e69[_0x06f6('0xd')]['toLowerCase']()==='out'&&!_0xa69e69[_0x06f6('0xe')]&&!_[_0x06f6('0xf')](_0xa69e69[_0x06f6('0x10')])){_0x2f2d8e[_0x06f6('0x11')]['findOne']({'where':{'id':_0xa69e69[_0x06f6('0x12')]}})[_0x06f6('0x13')](function(_0x3c114d){if(_0x3c114d){_0x3c114d[_0x06f6('0x14')]({'lastMsgAt':_0xa69e69[_0x06f6('0x15')],'lastMsgDirection':_0xa69e69[_0x06f6('0xd')][_0x06f6('0x16')]()});}})['catch'](function(_0x3640f4){console[_0x06f6('0x17')](_0x3640f4);});}if(_0xa69e69[_0x06f6('0xd')]===_0x06f6('0x18')&&!_0xa69e69[_0x06f6('0xe')]){var _0x5ac873;_0x2f2d8e[_0x06f6('0x19')][_0x06f6('0x1a')]({'where':{'id':_0xa69e69[_0x06f6('0x1b')]},'raw':!![]})[_0x06f6('0x13')](function(_0x193a38){_0x5ac873=_0x193a38;if(_0x5ac873&&_0x5ac873[_0x06f6('0x1c')]){switch(_0x5ac873[_0x06f6('0x1c')]){case _0x06f6('0x1d'):var _0x391de3=require(_0x06f6('0x1d'));if(_0x5ac873[_0x06f6('0x1e')]&&_0x5ac873['authToken']&&_0x5ac873[_0x06f6('0x1f')]){var _0x393377=new _0x391de3(_0x5ac873['accountSid'],_0x5ac873[_0x06f6('0x20')]);_0x393377[_0x06f6('0x21')][_0x06f6('0x22')]({'body':_0xa69e69[_0x06f6('0xa')],'to':_0x06f6('0x23')+_0xa69e69[_0x06f6('0x1f')],'from':'whatsapp:'+_0x5ac873['phone'],'statusCallback':_0x5ac873[_0x06f6('0x24')]+_0x06f6('0x25')+_0xa69e69['id']+'/status?token='+_0x5ac873[_0x06f6('0x26')]})[_0x06f6('0x13')](function(_0x4e0a4d){if(_0x4e0a4d[_0x06f6('0x27')]){return _0x53d087[_0x06f6('0x14')]({'messageId':_0x4e0a4d[_0x06f6('0x27')]});}})[_0x06f6('0x28')](function(_0x115eef){logger[_0x06f6('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0x06f6('0x29')](_0x115eef,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x06f6('0x2a'),_0x06f6('0x2b'),'twilio',_0x06f6('0x2c'));}break;case _0x06f6('0x2d'):var _0x21444d=_0x5ac873[_0x06f6('0x1e')];var _0x45e580=_0x5ac873['authToken'];var _0x53d0d2=_0x5ac873[_0x06f6('0x2e')]+_0x06f6('0x2f')+_0x21444d+_0x06f6('0x30');var _0x202174={'to':[_0xa69e69[_0x06f6('0x1f')]],'message':{'type':_0x06f6('0x31'),'text':_0xa69e69[_0x06f6('0xa')]}};var _0x33f51d={'method':_0x06f6('0x32'),'uri':_0x53d0d2,'headers':{'Authorization':_0x06f6('0x33')+_0x45e580,'Content-Type':'application/json'},'body':_0x202174,'json':!![]};rp(_0x33f51d)[_0x06f6('0x13')](function(_0x5d9741){if(_0x5d9741[_0x06f6('0x34')][0x0]['message_id']){return _0x53d087['update']({'messageId':_0x5d9741['statuses'][0x0][_0x06f6('0x35')]});}})[_0x06f6('0x28')](function(_0x410ed8){logger[_0x06f6('0x36')](_0x06f6('0x37'),_0x410ed8);});break;}}})[_0x06f6('0x38')](function(){_0x2befcf();});}else{_0x2befcf();}}},'charset':'utf8mb4','collate':_0x06f6('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 21a1438..b91e35b 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 _0x42fd=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','CreateWhatsappMessage','create','body','options','then','lodash','util'];(function(_0x390020,_0x3f8042){var _0x50f7d0=function(_0xe3b96e){while(--_0xe3b96e){_0x390020['push'](_0x390020['shift']());}};_0x50f7d0(++_0x3f8042);}(_0x42fd,0x134));var _0xd42f=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x42fd[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xd42f('0x0'));var util=require(_0xd42f('0x1'));var moment=require(_0xd42f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd42f('0x3'));var db=require(_0xd42f('0x4'))['db'];var utils=require(_0xd42f('0x5'));var logger=require(_0xd42f('0x6'))(_0xd42f('0x7'));var config=require('../../config/environment');var jayson=require(_0xd42f('0x8'));var client=jayson[_0xd42f('0x9')][_0xd42f('0xa')]({'port':0x232a});config[_0xd42f('0xb')]=_[_0xd42f('0xc')](config[_0xd42f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd42f('0xd'))(new Redis(config['redis']));require(_0xd42f('0xe'))[_0xd42f('0xf')](socket);function respondWithRpcPromise(_0x14364a,_0x17938c,_0x4283a2){return new BPromise(function(_0x595d66,_0x37b0d9){return client['request'](_0x14364a,_0x4283a2)['then'](function(_0x204273){logger[_0xd42f('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x17938c,_0xd42f('0x11'));logger[_0xd42f('0x12')](_0xd42f('0x13'),_0x17938c,_0xd42f('0x11'),JSON[_0xd42f('0x14')](_0x204273));if(_0x204273[_0xd42f('0x15')]){if(_0x204273['error'][_0xd42f('0x16')]===0x1f4){logger[_0xd42f('0x15')](_0xd42f('0x17'),_0x17938c,_0x204273[_0xd42f('0x15')][_0xd42f('0x18')]);return _0x37b0d9(_0x204273[_0xd42f('0x15')][_0xd42f('0x18')]);}logger[_0xd42f('0x15')](_0xd42f('0x17'),_0x17938c,_0x204273[_0xd42f('0x15')][_0xd42f('0x18')]);return _0x595d66(_0x204273[_0xd42f('0x15')]['message']);}else{logger[_0xd42f('0x10')](_0xd42f('0x17'),_0x17938c,'request\x20sent');_0x595d66(_0x204273['result'][_0xd42f('0x18')]);}})[_0xd42f('0x19')](function(_0x20baa3){logger[_0xd42f('0x15')](_0xd42f('0x17'),_0x17938c,_0x20baa3);_0x37b0d9(_0x20baa3);});});}exports[_0xd42f('0x1a')]=function(_0x19a9a0){var _0x59da13=this;return new Promise(function(_0x357ced,_0x4f7b9f){return db['WhatsappMessage'][_0xd42f('0x1b')](_0x19a9a0[_0xd42f('0x1c')],{'raw':_0x19a9a0[_0xd42f('0x1d')]?_0x19a9a0['options']['raw']===undefined?!![]:![]:!![]})[_0xd42f('0x1e')](function(_0x1b6cd8){logger[_0xd42f('0x10')]('CreateWhatsappMessage',_0x19a9a0);logger[_0xd42f('0x12')]('CreateWhatsappMessage',_0x19a9a0,JSON['stringify'](_0x1b6cd8));_0x357ced(_0x1b6cd8);})[_0xd42f('0x19')](function(_0x49940e){logger[_0xd42f('0x15')](_0xd42f('0x1a'),_0x49940e['message'],_0x19a9a0);_0x4f7b9f(_0x59da13[_0xd42f('0x15')](0x1f4,_0x49940e[_0xd42f('0x18')]));});});}; \ No newline at end of file +var _0x1407=['result','CreateWhatsappMessage','WhatsappMessage','raw','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x21795a,_0x26731f){var _0x6873a8=function(_0x7e5c1a){while(--_0x7e5c1a){_0x21795a['push'](_0x21795a['shift']());}};_0x6873a8(++_0x26731f);}(_0x1407,0x165));var _0x7140=function(_0x35e779,_0x366e51){_0x35e779=_0x35e779-0x0;var _0x5446a8=_0x1407[_0x35e779];return _0x5446a8;};'use strict';var _=require(_0x7140('0x0'));var util=require(_0x7140('0x1'));var moment=require(_0x7140('0x2'));var BPromise=require('bluebird');var rs=require(_0x7140('0x3'));var fs=require('fs');var Redis=require(_0x7140('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7140('0x5'));var logger=require(_0x7140('0x6'))(_0x7140('0x7'));var config=require(_0x7140('0x8'));var jayson=require(_0x7140('0x9'));var client=jayson[_0x7140('0xa')]['http']({'port':0x232a});config[_0x7140('0xb')]=_[_0x7140('0xc')](config[_0x7140('0xb')],{'host':_0x7140('0xd'),'port':0x18eb});var socket=require(_0x7140('0xe'))(new Redis(config[_0x7140('0xb')]));require('./whatsappMessage.socket')[_0x7140('0xf')](socket);function respondWithRpcPromise(_0x46e1af,_0x3e0873,_0xa2ae1a){return new BPromise(function(_0x221c20,_0x3d1bca){return client[_0x7140('0x10')](_0x46e1af,_0xa2ae1a)[_0x7140('0x11')](function(_0x1ec19d){logger['info'](_0x7140('0x12'),_0x3e0873,_0x7140('0x13'));logger[_0x7140('0x14')](_0x7140('0x15'),_0x3e0873,_0x7140('0x13'),JSON[_0x7140('0x16')](_0x1ec19d));if(_0x1ec19d[_0x7140('0x17')]){if(_0x1ec19d['error'][_0x7140('0x18')]===0x1f4){logger[_0x7140('0x17')](_0x7140('0x12'),_0x3e0873,_0x1ec19d[_0x7140('0x17')][_0x7140('0x19')]);return _0x3d1bca(_0x1ec19d[_0x7140('0x17')][_0x7140('0x19')]);}logger[_0x7140('0x17')](_0x7140('0x12'),_0x3e0873,_0x1ec19d[_0x7140('0x17')]['message']);return _0x221c20(_0x1ec19d[_0x7140('0x17')][_0x7140('0x19')]);}else{logger[_0x7140('0x1a')](_0x7140('0x12'),_0x3e0873,'request\x20sent');_0x221c20(_0x1ec19d[_0x7140('0x1b')]['message']);}})['catch'](function(_0x16da0d){logger[_0x7140('0x17')](_0x7140('0x12'),_0x3e0873,_0x16da0d);_0x3d1bca(_0x16da0d);});});}exports[_0x7140('0x1c')]=function(_0x4f19fb){var _0x40fde1=this;return new Promise(function(_0x1e2836,_0x466ca4){return db[_0x7140('0x1d')]['create'](_0x4f19fb['body'],{'raw':_0x4f19fb['options']?_0x4f19fb['options'][_0x7140('0x1e')]===undefined?!![]:![]:!![]})[_0x7140('0x11')](function(_0x2bec68){logger['info']('CreateWhatsappMessage',_0x4f19fb);logger[_0x7140('0x14')](_0x7140('0x1c'),_0x4f19fb,JSON[_0x7140('0x16')](_0x2bec68));_0x1e2836(_0x2bec68);})[_0x7140('0x1f')](function(_0x44c9df){logger[_0x7140('0x17')](_0x7140('0x1c'),_0x44c9df['message'],_0x4f19fb);_0x466ca4(_0x40fde1['error'](0x1f4,_0x44c9df[_0x7140('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b4c856c..7a1972f 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 _0x6d22=['whatsappMessage:','save','update','emit','removeListener','register','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d22,0x16d));var _0x26d2=function(_0x12d3cf,_0xfd1e86){_0x12d3cf=_0x12d3cf-0x0;var _0x340a3c=_0x6d22[_0x12d3cf];return _0x340a3c;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x26d2('0x0'),'remove',_0x26d2('0x1')];function createListener(_0x986354,_0x1cc7ed){return function(_0x74a56c){_0x1cc7ed[_0x26d2('0x2')](_0x986354,_0x74a56c);};}function removeListener(_0x3352c5,_0x2554be){return function(){WhatsappMessageEvents[_0x26d2('0x3')](_0x3352c5,_0x2554be);};}exports[_0x26d2('0x4')]=function(_0x3b95d5){for(var _0xe9dfe5=0x0,_0x3dbd18=events[_0x26d2('0x5')];_0xe9dfe5<_0x3dbd18;_0xe9dfe5++){var _0x30798d=events[_0xe9dfe5];var _0x14d60d=createListener(_0x26d2('0x6')+_0x30798d,_0x3b95d5);WhatsappMessageEvents['on'](_0x30798d,_0x14d60d);}}; \ No newline at end of file +var _0x284c=['./whatsappMessage.events','save','remove','whatsappMessage:'];(function(_0x2c095e,_0x23337f){var _0x1fbfab=function(_0x136dcb){while(--_0x136dcb){_0x2c095e['push'](_0x2c095e['shift']());}};_0x1fbfab(++_0x23337f);}(_0x284c,0x1c8));var _0xc284=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x284c[_0x397e5f];return _0x5302b8;};'use strict';var WhatsappMessageEvents=require(_0xc284('0x0'));var events=[_0xc284('0x1'),_0xc284('0x2'),'update'];function createListener(_0x307c94,_0x43dd0b){return function(_0x32615b){_0x43dd0b['emit'](_0x307c94,_0x32615b);};}function removeListener(_0xd02aa6,_0x4afff9){return function(){WhatsappMessageEvents['removeListener'](_0xd02aa6,_0x4afff9);};}exports['register']=function(_0x54df44){for(var _0x4a7df7=0x0,_0x567ec7=events['length'];_0x4a7df7<_0x567ec7;_0x4a7df7++){var _0xcd76c3=events[_0x4a7df7];var _0x1ba7ee=createListener(_0xc284('0x3')+_0xcd76c3,_0x54df44);WhatsappMessageEvents['on'](_0xcd76c3,_0x1ba7ee);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 69f6f14..fd788a3 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 _0x2d34=['isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x2d34,0x156));var _0x42d3=function(_0x5ef0c9,_0x5e3370){_0x5ef0c9=_0x5ef0c9-0x0;var _0x5658d8=_0x2d34[_0x5ef0c9];return _0x5658d8;};'use strict';var multer=require('multer');var util=require(_0x42d3('0x0'));var path=require(_0x42d3('0x1'));var timeout=require(_0x42d3('0x2'));var express=require(_0x42d3('0x3'));var router=express[_0x42d3('0x4')]();var fs_extra=require(_0x42d3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x42d3('0x6'));var controller=require('./whatsappQueue.controller');router[_0x42d3('0x7')]('/',auth['isAuthenticated'](),controller[_0x42d3('0x8')]);router['get']('/describe',auth[_0x42d3('0x9')](),controller[_0x42d3('0xa')]);router[_0x42d3('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x42d3('0xb')]);router[_0x42d3('0x7')](_0x42d3('0xc'),auth['isAuthenticated'](),controller[_0x42d3('0xd')]);router[_0x42d3('0x7')](_0x42d3('0xe'),auth[_0x42d3('0x9')](),controller[_0x42d3('0xf')]);router[_0x42d3('0x7')](_0x42d3('0x10'),auth[_0x42d3('0x9')](),controller[_0x42d3('0x11')]);router[_0x42d3('0x12')]('/',auth[_0x42d3('0x9')](),controller['create']);router[_0x42d3('0x12')](_0x42d3('0xe'),auth[_0x42d3('0x9')](),controller['addTeams']);router['post'](_0x42d3('0x10'),auth[_0x42d3('0x9')](),controller['addAgents']);router[_0x42d3('0x13')](_0x42d3('0x14'),auth[_0x42d3('0x9')](),controller[_0x42d3('0x15')]);router[_0x42d3('0x16')]('/:id',auth[_0x42d3('0x9')](),controller[_0x42d3('0x17')]);router[_0x42d3('0x16')](_0x42d3('0xe'),auth[_0x42d3('0x9')](),controller[_0x42d3('0x18')]);router[_0x42d3('0x16')](_0x42d3('0x10'),auth[_0x42d3('0x9')](),controller[_0x42d3('0x19')]);module[_0x42d3('0x1a')]=router; \ No newline at end of file +var _0x9d37=['update','destroy','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','create','post','/:id/teams','addTeams','addAgents'];(function(_0x13fb04,_0x5e536c){var _0x548f3e=function(_0x649f6e){while(--_0x649f6e){_0x13fb04['push'](_0x13fb04['shift']());}};_0x548f3e(++_0x5e536c);}(_0x9d37,0x18b));var _0x79d3=function(_0xb1465e,_0x25155a){_0xb1465e=_0xb1465e-0x0;var _0x2f78e9=_0x9d37[_0xb1465e];return _0x2f78e9;};'use strict';var multer=require(_0x79d3('0x0'));var util=require(_0x79d3('0x1'));var path=require(_0x79d3('0x2'));var timeout=require(_0x79d3('0x3'));var express=require(_0x79d3('0x4'));var router=express[_0x79d3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x79d3('0x6'));var interaction=require(_0x79d3('0x7'));var config=require(_0x79d3('0x8'));var controller=require(_0x79d3('0x9'));router[_0x79d3('0xa')]('/',auth[_0x79d3('0xb')](),controller[_0x79d3('0xc')]);router[_0x79d3('0xa')](_0x79d3('0xd'),auth[_0x79d3('0xb')](),controller['describe']);router[_0x79d3('0xa')](_0x79d3('0xe'),auth[_0x79d3('0xb')](),controller[_0x79d3('0xf')]);router[_0x79d3('0xa')](_0x79d3('0x10'),auth[_0x79d3('0xb')](),controller[_0x79d3('0x11')]);router[_0x79d3('0xa')]('/:id/teams',auth[_0x79d3('0xb')](),controller[_0x79d3('0x12')]);router[_0x79d3('0xa')](_0x79d3('0x13'),auth[_0x79d3('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x79d3('0x14')]);router[_0x79d3('0x15')](_0x79d3('0x16'),auth[_0x79d3('0xb')](),controller[_0x79d3('0x17')]);router[_0x79d3('0x15')](_0x79d3('0x13'),auth[_0x79d3('0xb')](),controller[_0x79d3('0x18')]);router['put'](_0x79d3('0xe'),auth['isAuthenticated'](),controller[_0x79d3('0x19')]);router['delete'](_0x79d3('0xe'),auth[_0x79d3('0xb')](),controller[_0x79d3('0x1a')]);router['delete'](_0x79d3('0x16'),auth[_0x79d3('0xb')](),controller['removeTeams']);router[_0x79d3('0x1b')](_0x79d3('0x13'),auth[_0x79d3('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 63c06d0..ef7eb6f 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 _0x9099=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0x9099,0x1ac));var _0x9909=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0x9099[_0x1dfa63];return _0x26f2a9;};'use strict';var Sequelize=require(_0x9909('0x0'));module['exports']={'name':{'type':Sequelize[_0x9909('0x1')],'unique':_0x9909('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9909('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9909('0x4')](_0x9909('0x5'),_0x9909('0x6'),_0x9909('0x7'))},'description':{'type':Sequelize[_0x9909('0x1')]}}; \ No newline at end of file +var _0x65d2=['sequelize','exports','name','INTEGER','ENUM','beepall','roundrobin','STRING'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0x65d2,0xb8));var _0x265d=function(_0x4209d9,_0x532066){_0x4209d9=_0x4209d9-0x0;var _0x5cc1df=_0x65d2[_0x4209d9];return _0x5cc1df;};'use strict';var Sequelize=require(_0x265d('0x0'));module[_0x265d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x265d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x265d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x265d('0x4')]('rrmemory',_0x265d('0x5'),_0x265d('0x6'))},'description':{'type':Sequelize[_0x265d('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 577b7e8..ece3175 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 _0x70ca=['WhatsappQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./whatsappQueue.socket','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','name','send','index','map','type','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','includeAll','include','WhatsappQueue','findAll','show','params','rawAttributes','merge','options','catch','create','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','WhatsappQueueId','UserWhatsappQueue','findAndCountAll','UserId','createdAt','rows','format','%s/%s','SIP','whatsappPause','getTeams','Team','nolimit','addTeams','User','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x70ca,0x12e));var _0xa70c=function(_0x5b6499,_0x121d1c){_0x5b6499=_0x5b6499-0x0;var _0x2e5b49=_0x70ca[_0x5b6499];return _0x2e5b49;};'use strict';var emlformat=require(_0xa70c('0x0'));var rimraf=require(_0xa70c('0x1'));var zipdir=require(_0xa70c('0x2'));var jsonpatch=require(_0xa70c('0x3'));var rp=require(_0xa70c('0x4'));var moment=require(_0xa70c('0x5'));var BPromise=require(_0xa70c('0x6'));var Mustache=require('mustache');var util=require(_0xa70c('0x7'));var path=require(_0xa70c('0x8'));var sox=require(_0xa70c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa70c('0xa'));var _=require(_0xa70c('0xb'));var squel=require(_0xa70c('0xc'));var crypto=require(_0xa70c('0xd'));var jsforce=require(_0xa70c('0xe'));var deskjs=require(_0xa70c('0xf'));var toCsv=require(_0xa70c('0x10'));var querystring=require(_0xa70c('0x11'));var Papa=require('papaparse');var Redis=require(_0xa70c('0x12'));var authService=require(_0xa70c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa70c('0x14'));var hardwareService=require(_0xa70c('0x15'));var logger=require(_0xa70c('0x16'))(_0xa70c('0x17'));var utils=require('../../config/utils');var config=require(_0xa70c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa70c('0x19'))['db'];config['redis']=_[_0xa70c('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa70c('0x1b'))(new Redis(config['redis']));require(_0xa70c('0x1c'))['register'](socket);function respondWithStatusCode(_0x30d4d7,_0x5d5d38){_0x5d5d38=_0x5d5d38||0xcc;return function(_0x508432){if(_0x508432){return _0x30d4d7[_0xa70c('0x1d')](_0x5d5d38);}return _0x30d4d7['status'](_0x5d5d38)[_0xa70c('0x1e')]();};}function respondWithResult(_0x2f639f,_0x274055){_0x274055=_0x274055||0xc8;return function(_0x2579ec){if(_0x2579ec){return _0x2f639f[_0xa70c('0x1f')](_0x274055)['json'](_0x2579ec);}};}function respondWithFilteredResult(_0x517ced,_0x40d877){return function(_0x1361c3){if(_0x1361c3){var _0x35021a=typeof _0x40d877[_0xa70c('0x20')]===_0xa70c('0x21')&&typeof _0x40d877[_0xa70c('0x22')]===_0xa70c('0x21');var _0x57cc6b=_0x1361c3[_0xa70c('0x23')];var _0xd01d74=_0x35021a?0x0:_0x40d877[_0xa70c('0x20')];var _0x5d839d=_0x35021a?_0x1361c3[_0xa70c('0x23')]:_0x40d877[_0xa70c('0x20')]+_0x40d877[_0xa70c('0x22')];var _0x409f80;if(_0x5d839d>=_0x57cc6b){_0x5d839d=_0x57cc6b;_0x409f80=0xc8;}else{_0x409f80=0xce;}_0x517ced[_0xa70c('0x1f')](_0x409f80);return _0x517ced[_0xa70c('0x24')]('Content-Range',_0xd01d74+'-'+_0x5d839d+'/'+_0x57cc6b)[_0xa70c('0x25')](_0x1361c3);}return null;};}function patchUpdates(_0x48dd93){return function(_0x28e2a5){try{jsonpatch[_0xa70c('0x26')](_0x28e2a5,_0x48dd93,!![]);}catch(_0x2693b4){return BPromise[_0xa70c('0x27')](_0x2693b4);}return _0x28e2a5[_0xa70c('0x28')]();};}function saveUpdates(_0x4bfa8c,_0x4d5a6e){return function(_0x35e471){if(_0x35e471){return _0x35e471[_0xa70c('0x29')](_0x4bfa8c)[_0xa70c('0x2a')](function(_0x30bf92){return _0x30bf92;});}return null;};}function removeEntity(_0x42b55e,_0x40e427){return function(_0x41e98f){if(_0x41e98f){return _0x41e98f['destroy']()['then'](function(){var _0x241b4d=_0x41e98f[_0xa70c('0x2b')]({'plain':!![]});var _0x44eb84=_0xa70c('0x2c');return db[_0xa70c('0x2d')][_0xa70c('0x2e')]({'where':{'type':_0x44eb84,'resourceId':_0x241b4d['id']}})[_0xa70c('0x2a')](function(){return _0x41e98f;});})[_0xa70c('0x2a')](function(){_0x42b55e[_0xa70c('0x1f')](0xcc)[_0xa70c('0x1e')]();});}};}function handleEntityNotFound(_0x3b9191,_0xde35e4){return function(_0x37fc57){if(!_0x37fc57){_0x3b9191[_0xa70c('0x1d')](0x194);}return _0x37fc57;};}function handleError(_0x42cd88,_0x451d3a){_0x451d3a=_0x451d3a||0x1f4;return function(_0x341c22){logger[_0xa70c('0x2f')](_0x341c22['stack']);if(_0x341c22[_0xa70c('0x30')]){delete _0x341c22[_0xa70c('0x30')];}_0x42cd88[_0xa70c('0x1f')](_0x451d3a)[_0xa70c('0x31')](_0x341c22);};}exports[_0xa70c('0x32')]=function(_0x3bb6a7,_0x10ac36){var _0x3e5cb3={},_0x15382d={},_0x464ce1={'count':0x0,'rows':[]};var _0x3d309c=_[_0xa70c('0x33')](db['WhatsappQueue']['rawAttributes'],function(_0x3194cb){return{'name':_0x3194cb['fieldName'],'type':_0x3194cb[_0xa70c('0x34')]['key']};});_0x15382d[_0xa70c('0x35')]=_[_0xa70c('0x33')](_0x3d309c,_0xa70c('0x30'));_0x15382d['query']=_[_0xa70c('0x36')](_0x3bb6a7['query']);_0x15382d[_0xa70c('0x37')]=_[_0xa70c('0x38')](_0x15382d[_0xa70c('0x35')],_0x15382d['query']);_0x3e5cb3[_0xa70c('0x39')]=_[_0xa70c('0x38')](_0x15382d[_0xa70c('0x35')],qs['fields'](_0x3bb6a7['query'][_0xa70c('0x3a')]));_0x3e5cb3[_0xa70c('0x39')]=_0x3e5cb3[_0xa70c('0x39')][_0xa70c('0x3b')]?_0x3e5cb3[_0xa70c('0x39')]:_0x15382d[_0xa70c('0x35')];if(!_0x3bb6a7[_0xa70c('0x3c')][_0xa70c('0x3d')]('nolimit')){_0x3e5cb3['limit']=qs[_0xa70c('0x22')](_0x3bb6a7[_0xa70c('0x3c')][_0xa70c('0x22')]);_0x3e5cb3[_0xa70c('0x20')]=qs[_0xa70c('0x20')](_0x3bb6a7[_0xa70c('0x3c')]['offset']);}_0x3e5cb3[_0xa70c('0x3e')]=qs[_0xa70c('0x3f')](_0x3bb6a7[_0xa70c('0x3c')][_0xa70c('0x3f')]);_0x3e5cb3[_0xa70c('0x40')]=qs['filters'](_[_0xa70c('0x41')](_0x3bb6a7[_0xa70c('0x3c')],_0x15382d[_0xa70c('0x37')]),_0x3d309c);if(_0x3bb6a7[_0xa70c('0x3c')]['filter']){_0x3e5cb3[_0xa70c('0x40')]=_['merge'](_0x3e5cb3[_0xa70c('0x40')],{'$or':_[_0xa70c('0x33')](_0x3d309c,function(_0x413862){if(_0x413862['type']!==_0xa70c('0x42')){var _0x4b3bac={};_0x4b3bac[_0x413862[_0xa70c('0x30')]]={'$like':'%'+_0x3bb6a7[_0xa70c('0x3c')][_0xa70c('0x43')]+'%'};return _0x4b3bac;}})});}_0x3e5cb3=_['merge']({},_0x3e5cb3,_0x3bb6a7['options']);var _0x1e6a1f={'where':_0x3e5cb3[_0xa70c('0x40')]};return db['WhatsappQueue'][_0xa70c('0x23')](_0x1e6a1f)[_0xa70c('0x2a')](function(_0x15119){_0x464ce1[_0xa70c('0x23')]=_0x15119;if(_0x3bb6a7[_0xa70c('0x3c')][_0xa70c('0x44')]){_0x3e5cb3[_0xa70c('0x45')]=[{'all':!![]}];}return db[_0xa70c('0x46')][_0xa70c('0x47')](_0x3e5cb3);})['then'](function(_0xf051b1){_0x464ce1['rows']=_0xf051b1;return _0x464ce1;})[_0xa70c('0x2a')](respondWithFilteredResult(_0x10ac36,_0x3e5cb3))['catch'](handleError(_0x10ac36,null));};exports[_0xa70c('0x48')]=function(_0x3aa3a4,_0x334676){var _0x43d976={'raw':!![],'where':{'id':_0x3aa3a4[_0xa70c('0x49')]['id']}},_0x4c5a5a={};_0x4c5a5a[_0xa70c('0x35')]=_[_0xa70c('0x36')](db['WhatsappQueue'][_0xa70c('0x4a')]);_0x4c5a5a[_0xa70c('0x3c')]=_[_0xa70c('0x36')](_0x3aa3a4[_0xa70c('0x3c')]);_0x4c5a5a[_0xa70c('0x37')]=_['intersection'](_0x4c5a5a[_0xa70c('0x35')],_0x4c5a5a[_0xa70c('0x3c')]);_0x43d976[_0xa70c('0x39')]=_[_0xa70c('0x38')](_0x4c5a5a[_0xa70c('0x35')],qs[_0xa70c('0x3a')](_0x3aa3a4[_0xa70c('0x3c')][_0xa70c('0x3a')]));_0x43d976[_0xa70c('0x39')]=_0x43d976['attributes'][_0xa70c('0x3b')]?_0x43d976[_0xa70c('0x39')]:_0x4c5a5a[_0xa70c('0x35')];if(_0x3aa3a4[_0xa70c('0x3c')][_0xa70c('0x44')]){_0x43d976[_0xa70c('0x45')]=[{'all':!![]}];}_0x43d976=_[_0xa70c('0x4b')]({},_0x43d976,_0x3aa3a4[_0xa70c('0x4c')]);return db[_0xa70c('0x46')]['find'](_0x43d976)['then'](handleEntityNotFound(_0x334676,null))[_0xa70c('0x2a')](respondWithResult(_0x334676,null))[_0xa70c('0x4d')](handleError(_0x334676,null));};exports[_0xa70c('0x4e')]=function(_0x4f48fc,_0xf42e64){return db['WhatsappQueue'][_0xa70c('0x4e')](_0x4f48fc['body'],{})[_0xa70c('0x2a')](function(_0x1d3f0e){var _0x2cb728=_0x4f48fc[_0xa70c('0x4f')]['get']({'plain':!![]});if(!_0x2cb728)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cb728[_0xa70c('0x50')]===_0xa70c('0x4f')){var _0x11148d=_0x1d3f0e[_0xa70c('0x2b')]({'plain':!![]});var _0x1e15df=_0xa70c('0x2c');return db[_0xa70c('0x51')][_0xa70c('0x52')]({'where':{'name':_0x1e15df,'userProfileId':_0x2cb728['userProfileId']},'raw':!![]})['then'](function(_0x1f5c77){if(_0x1f5c77&&_0x1f5c77[_0xa70c('0x53')]===0x0){return db[_0xa70c('0x2d')][_0xa70c('0x4e')]({'name':_0x11148d[_0xa70c('0x30')],'resourceId':_0x11148d['id'],'type':_0x1f5c77['name'],'sectionId':_0x1f5c77['id']},{})[_0xa70c('0x2a')](function(){return _0x1d3f0e;});}else{return _0x1d3f0e;}})['catch'](function(_0x3071df){logger[_0xa70c('0x2f')](_0xa70c('0x54'),_0x3071df);throw _0x3071df;});}return _0x1d3f0e;})[_0xa70c('0x2a')](respondWithResult(_0xf42e64,0xc9))[_0xa70c('0x4d')](handleError(_0xf42e64,null));};exports[_0xa70c('0x29')]=function(_0x22b752,_0x633974){if(_0x22b752[_0xa70c('0x55')]['id']){delete _0x22b752[_0xa70c('0x55')]['id'];}return db[_0xa70c('0x46')][_0xa70c('0x52')]({'where':{'id':_0x22b752['params']['id']}})[_0xa70c('0x2a')](handleEntityNotFound(_0x633974,null))[_0xa70c('0x2a')](saveUpdates(_0x22b752[_0xa70c('0x55')],null))[_0xa70c('0x2a')](respondWithResult(_0x633974,null))[_0xa70c('0x4d')](handleError(_0x633974,null));};exports[_0xa70c('0x2e')]=function(_0x57037e,_0x24563f){return db[_0xa70c('0x46')][_0xa70c('0x52')]({'where':{'id':_0x57037e[_0xa70c('0x49')]['id']}})['then'](handleEntityNotFound(_0x24563f,null))[_0xa70c('0x2a')](removeEntity(_0x24563f,null))['catch'](handleError(_0x24563f,null));};exports[_0xa70c('0x56')]=function(_0x3c2805,_0x50b656){return db[_0xa70c('0x46')][_0xa70c('0x56')]()[_0xa70c('0x2a')](respondWithResult(_0x50b656,null))[_0xa70c('0x4d')](handleError(_0x50b656,null));};exports['getMembers']=function(_0x810284,_0x3ce678,_0x56f3ed){var _0x306f34={'raw':!![],'where':{}},_0x127a20={},_0x14d03;return db[_0xa70c('0x46')][_0xa70c('0x57')]({'where':{'id':_0x810284[_0xa70c('0x49')]['id']}})[_0xa70c('0x2a')](handleEntityNotFound(_0x3ce678,null))[_0xa70c('0x2a')](function(_0x5f3ce6){if(_0x5f3ce6){_0x14d03=_0x5f3ce6[_0xa70c('0x2b')]({'plain':!![]});_0x127a20[_0xa70c('0x35')]=_[_0xa70c('0x36')](db['UserWhatsappQueue'][_0xa70c('0x4a')]);_0x127a20['query']=_[_0xa70c('0x36')](_0x810284[_0xa70c('0x3c')]);_0x127a20[_0xa70c('0x37')]=_['intersection'](_0x127a20[_0xa70c('0x35')],_0x127a20[_0xa70c('0x3c')]);_0x306f34['attributes']=_[_0xa70c('0x38')](_0x127a20[_0xa70c('0x35')],qs[_0xa70c('0x3a')](_0x810284[_0xa70c('0x3c')]['fields']));_0x306f34['attributes']=_0x306f34['attributes'][_0xa70c('0x3b')]?_0x306f34[_0xa70c('0x39')]:_0x127a20[_0xa70c('0x35')];if(!_0x810284['query'][_0xa70c('0x3d')]('nolimit')){_0x306f34['limit']=qs[_0xa70c('0x22')](_0x810284['query'][_0xa70c('0x22')]);_0x306f34[_0xa70c('0x20')]=qs[_0xa70c('0x20')](_0x810284['query'][_0xa70c('0x20')]);}_0x306f34[_0xa70c('0x3e')]=qs[_0xa70c('0x3f')](_0x810284[_0xa70c('0x3c')][_0xa70c('0x3f')]);_0x306f34['where']=qs[_0xa70c('0x37')](_[_0xa70c('0x41')](_0x810284[_0xa70c('0x3c')],_0x127a20['filters']));_0x306f34[_0xa70c('0x40')][_0xa70c('0x58')]=_0x5f3ce6['id'];if(_0x810284['query']['filter']){_0x306f34[_0xa70c('0x40')]=_[_0xa70c('0x4b')](_0x306f34['where'],{'$or':_[_0xa70c('0x33')](_0x306f34[_0xa70c('0x39')],function(_0x239a23){var _0x49d94c={};_0x49d94c[_0x239a23]={'$like':'%'+_0x810284['query'][_0xa70c('0x43')]+'%'};return _0x49d94c;})});}_0x306f34=_[_0xa70c('0x4b')]({},_0x306f34,_0x810284[_0xa70c('0x4c')]);return db[_0xa70c('0x59')]['findAll'](_0x306f34);}})['then'](function(_0x2866dc){if(_0x2866dc){return db['User'][_0xa70c('0x5a')]({'where':{'id':_[_0xa70c('0x33')](_0x2866dc,_0xa70c('0x5b')),'role':'agent'},'attributes':['id',_0xa70c('0x30'),'whatsappPause','updatedAt',_0xa70c('0x5c')]});}})[_0xa70c('0x2a')](function(_0x33eab4){if(_0x33eab4){return{'count':_0x33eab4[_0xa70c('0x23')],'rows':_[_0xa70c('0x33')](_0x33eab4[_0xa70c('0x5d')],function(_0x47f240){return{'membername':_0x47f240[_0xa70c('0x30')],'UserId':_0x47f240['id'],'queue_name':_0x14d03[_0xa70c('0x30')],'WhatsappQueueId':_0x14d03['id'],'interface':util[_0xa70c('0x5e')](_0xa70c('0x5f'),_0xa70c('0x60'),_0x47f240['name']),'penalty':0x0,'paused':_0x47f240[_0xa70c('0x61')],'createdAt':_0x47f240[_0xa70c('0x5c')],'updatedAt':_0x47f240['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa70c('0x2a')](respondWithFilteredResult(_0x3ce678,_0x306f34))[_0xa70c('0x4d')](handleError(_0x3ce678,null));};exports[_0xa70c('0x62')]=function(_0x18dfc6,_0xe596f0,_0xf8248e){var _0x280f3a={};var _0x5ea881={};var _0xa30095;var _0x17e225;return db[_0xa70c('0x46')][_0xa70c('0x57')]({'where':{'id':_0x18dfc6[_0xa70c('0x49')]['id']}})[_0xa70c('0x2a')](handleEntityNotFound(_0xe596f0,null))[_0xa70c('0x2a')](function(_0x54a25d){if(_0x54a25d){_0xa30095=_0x54a25d;_0x5ea881[_0xa70c('0x35')]=_['keys'](db[_0xa70c('0x63')][_0xa70c('0x4a')]);_0x5ea881[_0xa70c('0x3c')]=_[_0xa70c('0x36')](_0x18dfc6[_0xa70c('0x3c')]);_0x5ea881[_0xa70c('0x37')]=_['intersection'](_0x5ea881[_0xa70c('0x35')],_0x5ea881[_0xa70c('0x3c')]);_0x280f3a[_0xa70c('0x39')]=_[_0xa70c('0x38')](_0x5ea881[_0xa70c('0x35')],qs[_0xa70c('0x3a')](_0x18dfc6[_0xa70c('0x3c')][_0xa70c('0x3a')]));_0x280f3a[_0xa70c('0x39')]=_0x280f3a[_0xa70c('0x39')][_0xa70c('0x3b')]?_0x280f3a[_0xa70c('0x39')]:_0x5ea881['model'];_0x280f3a[_0xa70c('0x3e')]=qs['sort'](_0x18dfc6[_0xa70c('0x3c')][_0xa70c('0x3f')]);_0x280f3a[_0xa70c('0x40')]=qs[_0xa70c('0x37')](_[_0xa70c('0x41')](_0x18dfc6[_0xa70c('0x3c')],_0x5ea881[_0xa70c('0x37')]));if(_0x18dfc6[_0xa70c('0x3c')][_0xa70c('0x43')]){_0x280f3a[_0xa70c('0x40')]=_[_0xa70c('0x4b')](_0x280f3a[_0xa70c('0x40')],{'$or':_[_0xa70c('0x33')](_0x280f3a[_0xa70c('0x39')],function(_0x15af9f){var _0x57c643={};_0x57c643[_0x15af9f]={'$like':'%'+_0x18dfc6[_0xa70c('0x3c')][_0xa70c('0x43')]+'%'};return _0x57c643;})});}_0x280f3a=_['merge']({},_0x280f3a,_0x18dfc6['options']);return _0xa30095[_0xa70c('0x62')](_0x280f3a);}})[_0xa70c('0x2a')](function(_0x1b5e8e){if(_0x1b5e8e){_0x17e225=_0x1b5e8e[_0xa70c('0x3b')];if(!_0x18dfc6[_0xa70c('0x3c')][_0xa70c('0x3d')](_0xa70c('0x64'))){_0x280f3a[_0xa70c('0x22')]=qs[_0xa70c('0x22')](_0x18dfc6[_0xa70c('0x3c')][_0xa70c('0x22')]);_0x280f3a[_0xa70c('0x20')]=qs[_0xa70c('0x20')](_0x18dfc6[_0xa70c('0x3c')]['offset']);}return _0xa30095[_0xa70c('0x62')](_0x280f3a);}})['then'](function(_0x4f7e57){if(_0x4f7e57){return _0x4f7e57?{'count':_0x17e225,'rows':_0x4f7e57}:null;}})[_0xa70c('0x2a')](respondWithResult(_0xe596f0,null))[_0xa70c('0x4d')](handleError(_0xe596f0,null));};exports[_0xa70c('0x65')]=function(_0x17ef04,_0x23391f,_0x46585c){var _0x5b4efa=_0x17ef04[_0xa70c('0x55')]['ids'];return db[_0xa70c('0x63')][_0xa70c('0x47')]({'where':{'id':_0x5b4efa},'attributes':['id'],'include':[{'model':db[_0xa70c('0x66')],'as':_0xa70c('0x67'),'attributes':['id',_0xa70c('0x30'),_0xa70c('0x68'),_0xa70c('0x69'),_0xa70c('0x6a')],'raw':!![]}]})[_0xa70c('0x2a')](function(_0x1d39d0){if(_0x1d39d0){var _0x12deef=_[_0xa70c('0x6b')](_0x1d39d0,function(_0x35c599){var _0x1efffc=_0x35c599[_0xa70c('0x2b')]({'plain':!![]});return _0x1efffc['Agents'];});return db[_0xa70c('0x46')][_0xa70c('0x52')]({'where':{'id':_0x17ef04[_0xa70c('0x49')]['id']}})[_0xa70c('0x2a')](function(_0x38eb43){return db['sequelize']['transaction'](function(_0x1ef1b7){return _0x38eb43[_0xa70c('0x65')](_0x5b4efa,{'transaction':_0x1ef1b7})['then'](function(){return BPromise[_0xa70c('0x6c')](_0x12deef,function(_0x3df487){return db[_0xa70c('0x59')][_0xa70c('0x6d')]({'where':{'UserId':_0x3df487['id'],'WhatsappQueueId':_0x17ef04[_0xa70c('0x49')]['id']},'transaction':_0x1ef1b7});});})[_0xa70c('0x2a')](function(){_0x12deef[_0xa70c('0x6e')](function(_0x3dc9b4){socket[_0xa70c('0x6f')](_0xa70c('0x70'),{'UserId':_0x3dc9b4['id'],'WhatsappQueueId':_0x38eb43['id']});});});});});}})[_0xa70c('0x2a')](respondWithStatusCode(_0x23391f,null))['catch'](handleError(_0x23391f,null));};exports[_0xa70c('0x71')]=function(_0x15cbfd,_0x3eb46c,_0x364640){return db[_0xa70c('0x63')]['findAll']({'where':{'id':_0x15cbfd[_0xa70c('0x3c')][_0xa70c('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa70c('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3eb46c,null))[_0xa70c('0x2a')](function(_0x55c591){var _0x1c0f7f=_[_0xa70c('0x33')](_0x55c591,'id');var _0x283627=[];var _0x6d69f5=[];var _0x11ae86=squel[_0xa70c('0x73')]();_0x11ae86[_0xa70c('0x74')]('tq.TeamId')['from'](_0xa70c('0x75'),'tq')[_0xa70c('0x76')](_0xa70c('0x77'),'ut',_0xa70c('0x78'))[_0xa70c('0x40')](_0xa70c('0x79'),_0x15cbfd[_0xa70c('0x49')]['id']);for(var _0x22e119=0x0;_0x22e119<_0x55c591['length'];_0x22e119+=0x1){let _0x4ad1bb=_0x55c591[_0x22e119];for(var _0x3ca96e=0x0;_0x3ca96e<_0x4ad1bb[_0xa70c('0x67')][_0xa70c('0x3b')];_0x3ca96e+=0x1){let _0x26ce36=_0x4ad1bb[_0xa70c('0x67')][_0x3ca96e];var _0x176278=_0x11ae86['clone']();_0x176278[_0xa70c('0x40')]('ut.UserId\x20=\x20?',_0x26ce36['id']);_0x6d69f5[_0xa70c('0x7a')](db[_0xa70c('0x7b')][_0xa70c('0x3c')](_0x176278[_0xa70c('0x7c')](),{'type':db[_0xa70c('0x7b')][_0xa70c('0x7d')][_0xa70c('0x7e')]})[_0xa70c('0x2a')](function(_0x3b4714){if(_0x3b4714['length']===0x1){return _0x26ce36['id'];}else{var _0x161364=_[_0xa70c('0x7f')](_[_0xa70c('0x33')](_0x3b4714,'TeamId'),function(_0x180a6a){return _[_0xa70c('0x80')](_0x1c0f7f,_0x180a6a);});if(_0x161364){return _0x26ce36['id'];}}}));}}return BPromise[_0xa70c('0x81')](_0x6d69f5)[_0xa70c('0x2a')](function(_0x1a4b0f){_0x283627=_(_0x283627)[_0xa70c('0x82')](_0x1a4b0f)[_0xa70c('0x83')]()[_0xa70c('0x84')]();return db['WhatsappQueue'][_0xa70c('0x52')]({'where':{'id':_0x15cbfd[_0xa70c('0x49')]['id']}})['then'](function(_0x441727){return db[_0xa70c('0x7b')][_0xa70c('0x85')](function(_0x5059aa){return _0x441727[_0xa70c('0x71')](_0x15cbfd[_0xa70c('0x3c')][_0xa70c('0x72')],{'transaction':_0x5059aa})['then'](function(){if(!_[_0xa70c('0x86')](_0x283627)){return _0x441727[_0xa70c('0x87')](_0x283627,{'transaction':_0x5059aa});}})[_0xa70c('0x2a')](function(){_0x283627['forEach'](function(_0x440c0e){socket[_0xa70c('0x6f')](_0xa70c('0x88'),{'UserId':_0x440c0e,'WhatsappQueueId':_0x441727['id']});});});});});});})[_0xa70c('0x2a')](respondWithStatusCode(_0x3eb46c,null))[_0xa70c('0x4d')](handleError(_0x3eb46c,null));};exports[_0xa70c('0x89')]=function(_0x42707e,_0x5ee188,_0x4e7f49){return db['WhatsappQueue'][_0xa70c('0x52')]({'where':{'id':_0x42707e[_0xa70c('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ee188,null))[_0xa70c('0x2a')](function(_0x45c8ef){if(_0x45c8ef){return _0x45c8ef[_0xa70c('0x89')](_0x42707e[_0xa70c('0x55')][_0xa70c('0x72')],_['omit'](_0x42707e['body'],[_0xa70c('0x72'),'id'])||{})[_0xa70c('0x8a')](function(_0x14d4fd){for(var _0x4f82ce=0x0;_0x4f82ce<_0x42707e['body']['ids'][_0xa70c('0x3b')];_0x4f82ce+=0x1){socket[_0xa70c('0x6f')](_0xa70c('0x70'),{'UserId':Number(_0x42707e[_0xa70c('0x55')][_0xa70c('0x72')][_0x4f82ce]),'WhatsappQueueId':Number(_0x42707e['params']['id'])});}return _0x14d4fd;});}})['then'](respondWithResult(_0x5ee188,null))[_0xa70c('0x4d')](handleError(_0x5ee188,null));};exports[_0xa70c('0x87')]=function(_0x36994d,_0x1bd58e,_0x14b3cd){return db['WhatsappQueue'][_0xa70c('0x52')]({'where':{'id':_0x36994d[_0xa70c('0x49')]['id']}})[_0xa70c('0x2a')](handleEntityNotFound(_0x1bd58e,null))[_0xa70c('0x2a')](function(_0x585078){if(_0x585078){return _0x585078[_0xa70c('0x87')](_0x36994d[_0xa70c('0x3c')][_0xa70c('0x72')])['then'](function(){if(_[_0xa70c('0x8b')](_0x36994d[_0xa70c('0x3c')][_0xa70c('0x72')])){for(var _0x39656a=0x0;_0x39656a<_0x36994d['query'][_0xa70c('0x72')][_0xa70c('0x3b')];_0x39656a+=0x1){socket[_0xa70c('0x6f')](_0xa70c('0x88'),{'UserId':Number(_0x36994d[_0xa70c('0x3c')][_0xa70c('0x72')][_0x39656a]),'WhatsappQueueId':Number(_0x36994d[_0xa70c('0x49')]['id'])});}}else{socket[_0xa70c('0x6f')](_0xa70c('0x88'),{'UserId':Number(_0x36994d[_0xa70c('0x3c')][_0xa70c('0x72')]),'WhatsappQueueId':Number(_0x36994d[_0xa70c('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x1bd58e,null))[_0xa70c('0x4d')](handleError(_0x1bd58e,null));};exports[_0xa70c('0x8c')]=function(_0xfe81b4,_0x3448c0,_0x36276b){var _0x15b2d3={};var _0xc4b088={};var _0x5dbfe3;var _0x1ace35;return db[_0xa70c('0x46')][_0xa70c('0x57')]({'where':{'id':_0xfe81b4[_0xa70c('0x49')]['id']}})[_0xa70c('0x2a')](handleEntityNotFound(_0x3448c0,null))[_0xa70c('0x2a')](function(_0x46fef6){if(_0x46fef6){_0x5dbfe3=_0x46fef6;_0xc4b088[_0xa70c('0x35')]=_[_0xa70c('0x36')](db[_0xa70c('0x66')]['rawAttributes']);_0xc4b088[_0xa70c('0x3c')]=_[_0xa70c('0x36')](_0xfe81b4[_0xa70c('0x3c')]);_0xc4b088[_0xa70c('0x37')]=_[_0xa70c('0x38')](_0xc4b088[_0xa70c('0x35')],_0xc4b088[_0xa70c('0x3c')]);_0x15b2d3[_0xa70c('0x39')]=_[_0xa70c('0x38')](_0xc4b088[_0xa70c('0x35')],qs[_0xa70c('0x3a')](_0xfe81b4[_0xa70c('0x3c')][_0xa70c('0x3a')]));_0x15b2d3['attributes']=_0x15b2d3[_0xa70c('0x39')][_0xa70c('0x3b')]?_0x15b2d3[_0xa70c('0x39')]:_0xc4b088[_0xa70c('0x35')];_0x15b2d3[_0xa70c('0x3e')]=qs[_0xa70c('0x3f')](_0xfe81b4['query']['sort']);_0x15b2d3['where']=qs[_0xa70c('0x37')](_[_0xa70c('0x41')](_0xfe81b4['query'],_0xc4b088[_0xa70c('0x37')]));if(_0xfe81b4[_0xa70c('0x3c')][_0xa70c('0x43')]){_0x15b2d3[_0xa70c('0x40')]=_[_0xa70c('0x4b')](_0x15b2d3[_0xa70c('0x40')],{'$or':_[_0xa70c('0x33')](_0x15b2d3[_0xa70c('0x39')],function(_0x4e1f44){var _0x52f3c6={};_0x52f3c6[_0x4e1f44]={'$like':'%'+_0xfe81b4[_0xa70c('0x3c')]['filter']+'%'};return _0x52f3c6;})});}_0x15b2d3=_['merge']({},_0x15b2d3,_0xfe81b4[_0xa70c('0x4c')]);return _0x5dbfe3['getAgents'](_0x15b2d3);}})[_0xa70c('0x2a')](function(_0x271087){if(_0x271087){_0x1ace35=_0x271087['length'];if(!_0xfe81b4[_0xa70c('0x3c')]['hasOwnProperty'](_0xa70c('0x64'))){_0x15b2d3['limit']=qs[_0xa70c('0x22')](_0xfe81b4[_0xa70c('0x3c')]['limit']);_0x15b2d3[_0xa70c('0x20')]=qs['offset'](_0xfe81b4[_0xa70c('0x3c')][_0xa70c('0x20')]);}return _0x5dbfe3['getAgents'](_0x15b2d3);}})[_0xa70c('0x2a')](function(_0x21aae8){if(_0x21aae8){return _0x21aae8?{'count':_0x1ace35,'rows':_0x21aae8}:null;}})['then'](respondWithResult(_0x3448c0,null))[_0xa70c('0x4d')](handleError(_0x3448c0,null));}; \ No newline at end of file +var _0x001b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','pick','WhatsappQueueId','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','limit','undefined','count','offset','save','update','then','destroy','get','WhatsappQueues','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x492924,_0x244592){var _0x19a16e=function(_0x56f560){while(--_0x56f560){_0x492924['push'](_0x492924['shift']());}};_0x19a16e(++_0x244592);}(_0x001b,0x15c));var _0xb001=function(_0x23c2ca,_0x1eba00){_0x23c2ca=_0x23c2ca-0x0;var _0x1a4dd1=_0x001b[_0x23c2ca];return _0x1a4dd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb001('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb001('0x1'));var rp=require('request-promise');var moment=require(_0xb001('0x2'));var BPromise=require(_0xb001('0x3'));var Mustache=require('mustache');var util=require(_0xb001('0x4'));var path=require(_0xb001('0x5'));var sox=require(_0xb001('0x6'));var csv=require(_0xb001('0x7'));var ejs=require(_0xb001('0x8'));var fs=require('fs');var fs_extra=require(_0xb001('0x9'));var _=require(_0xb001('0xa'));var squel=require(_0xb001('0xb'));var crypto=require(_0xb001('0xc'));var jsforce=require(_0xb001('0xd'));var deskjs=require(_0xb001('0xe'));var toCsv=require(_0xb001('0x7'));var querystring=require('querystring');var Papa=require(_0xb001('0xf'));var Redis=require('ioredis');var authService=require(_0xb001('0x10'));var qs=require(_0xb001('0x11'));var as=require(_0xb001('0x12'));var hardwareService=require(_0xb001('0x13'));var logger=require(_0xb001('0x14'))(_0xb001('0x15'));var utils=require('../../config/utils');var config=require(_0xb001('0x16'));var licenseUtil=require(_0xb001('0x17'));var db=require(_0xb001('0x18'))['db'];config[_0xb001('0x19')]=_[_0xb001('0x1a')](config[_0xb001('0x19')],{'host':_0xb001('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb001('0x19')]));require(_0xb001('0x1c'))[_0xb001('0x1d')](socket);function respondWithStatusCode(_0x4e0bf0,_0x4f7b55){_0x4f7b55=_0x4f7b55||0xcc;return function(_0x52a535){if(_0x52a535){return _0x4e0bf0[_0xb001('0x1e')](_0x4f7b55);}return _0x4e0bf0[_0xb001('0x1f')](_0x4f7b55)[_0xb001('0x20')]();};}function respondWithResult(_0x218c91,_0x149150){_0x149150=_0x149150||0xc8;return function(_0x4dd066){if(_0x4dd066){return _0x218c91['status'](_0x149150)['json'](_0x4dd066);}};}function respondWithFilteredResult(_0x533b5e,_0x561133){return function(_0x2b41f8){if(_0x2b41f8){var _0x4f0609=typeof _0x561133['offset']==='undefined'&&typeof _0x561133[_0xb001('0x21')]===_0xb001('0x22');var _0x14945a=_0x2b41f8[_0xb001('0x23')];var _0x1fec8e=_0x4f0609?0x0:_0x561133['offset'];var _0x132e14=_0x4f0609?_0x2b41f8['count']:_0x561133[_0xb001('0x24')]+_0x561133[_0xb001('0x21')];var _0x38cd65;if(_0x132e14>=_0x14945a){_0x132e14=_0x14945a;_0x38cd65=0xc8;}else{_0x38cd65=0xce;}_0x533b5e[_0xb001('0x1f')](_0x38cd65);return _0x533b5e['set']('Content-Range',_0x1fec8e+'-'+_0x132e14+'/'+_0x14945a)['json'](_0x2b41f8);}return null;};}function patchUpdates(_0x28850e){return function(_0x45a9c5){try{jsonpatch['apply'](_0x45a9c5,_0x28850e,!![]);}catch(_0x1908e7){return BPromise['reject'](_0x1908e7);}return _0x45a9c5[_0xb001('0x25')]();};}function saveUpdates(_0x56de09,_0x2242a7){return function(_0x34280c){if(_0x34280c){return _0x34280c[_0xb001('0x26')](_0x56de09)[_0xb001('0x27')](function(_0x25def8){return _0x25def8;});}return null;};}function removeEntity(_0x5cfe99,_0x44ae35){return function(_0x4267a9){if(_0x4267a9){return _0x4267a9[_0xb001('0x28')]()[_0xb001('0x27')](function(){var _0x24d667=_0x4267a9[_0xb001('0x29')]({'plain':!![]});var _0x4f64fb=_0xb001('0x2a');return db['UserProfileResource'][_0xb001('0x28')]({'where':{'type':_0x4f64fb,'resourceId':_0x24d667['id']}})[_0xb001('0x27')](function(){return _0x4267a9;});})[_0xb001('0x27')](function(){_0x5cfe99[_0xb001('0x1f')](0xcc)[_0xb001('0x20')]();});}};}function handleEntityNotFound(_0x49d123,_0x13a42e){return function(_0x3d7cb5){if(!_0x3d7cb5){_0x49d123[_0xb001('0x1e')](0x194);}return _0x3d7cb5;};}function handleError(_0x4e9a45,_0xdc75d6){_0xdc75d6=_0xdc75d6||0x1f4;return function(_0x45a8b4){logger[_0xb001('0x2b')](_0x45a8b4[_0xb001('0x2c')]);if(_0x45a8b4[_0xb001('0x2d')]){delete _0x45a8b4[_0xb001('0x2d')];}_0x4e9a45['status'](_0xdc75d6)[_0xb001('0x2e')](_0x45a8b4);};}exports[_0xb001('0x2f')]=function(_0x3a701d,_0x37ba5f){var _0x229504={},_0x219d7d={},_0x334c63={'count':0x0,'rows':[]};var _0x550e9f=_[_0xb001('0x30')](db[_0xb001('0x31')][_0xb001('0x32')],function(_0x1fbbaf){return{'name':_0x1fbbaf[_0xb001('0x33')],'type':_0x1fbbaf[_0xb001('0x34')][_0xb001('0x35')]};});_0x219d7d[_0xb001('0x36')]=_['map'](_0x550e9f,'name');_0x219d7d[_0xb001('0x37')]=_['keys'](_0x3a701d[_0xb001('0x37')]);_0x219d7d['filters']=_['intersection'](_0x219d7d[_0xb001('0x36')],_0x219d7d['query']);_0x229504[_0xb001('0x38')]=_[_0xb001('0x39')](_0x219d7d[_0xb001('0x36')],qs[_0xb001('0x3a')](_0x3a701d[_0xb001('0x37')][_0xb001('0x3a')]));_0x229504[_0xb001('0x38')]=_0x229504[_0xb001('0x38')][_0xb001('0x3b')]?_0x229504['attributes']:_0x219d7d[_0xb001('0x36')];if(!_0x3a701d[_0xb001('0x37')][_0xb001('0x3c')](_0xb001('0x3d'))){_0x229504[_0xb001('0x21')]=qs['limit'](_0x3a701d['query']['limit']);_0x229504['offset']=qs[_0xb001('0x24')](_0x3a701d[_0xb001('0x37')][_0xb001('0x24')]);}_0x229504[_0xb001('0x3e')]=qs[_0xb001('0x3f')](_0x3a701d[_0xb001('0x37')]['sort']);_0x229504[_0xb001('0x40')]=qs[_0xb001('0x41')](_['pick'](_0x3a701d['query'],_0x219d7d[_0xb001('0x41')]),_0x550e9f);if(_0x3a701d['query'][_0xb001('0x42')]){_0x229504[_0xb001('0x40')]=_[_0xb001('0x43')](_0x229504[_0xb001('0x40')],{'$or':_[_0xb001('0x30')](_0x550e9f,function(_0x1ed67e){if(_0x1ed67e[_0xb001('0x34')]!==_0xb001('0x44')){var _0x2b534f={};_0x2b534f[_0x1ed67e[_0xb001('0x2d')]]={'$like':'%'+_0x3a701d[_0xb001('0x37')][_0xb001('0x42')]+'%'};return _0x2b534f;}})});}_0x229504=_[_0xb001('0x43')]({},_0x229504,_0x3a701d[_0xb001('0x45')]);var _0xb737fb={'where':_0x229504[_0xb001('0x40')]};return db['WhatsappQueue'][_0xb001('0x23')](_0xb737fb)[_0xb001('0x27')](function(_0x569a69){_0x334c63[_0xb001('0x23')]=_0x569a69;if(_0x3a701d[_0xb001('0x37')][_0xb001('0x46')]){_0x229504[_0xb001('0x47')]=[{'all':!![]}];}return db[_0xb001('0x31')][_0xb001('0x48')](_0x229504);})[_0xb001('0x27')](function(_0x86dd7b){_0x334c63[_0xb001('0x49')]=_0x86dd7b;return _0x334c63;})['then'](respondWithFilteredResult(_0x37ba5f,_0x229504))[_0xb001('0x4a')](handleError(_0x37ba5f,null));};exports['show']=function(_0x15955f,_0x43c648){var _0x39d0c5={'raw':!![],'where':{'id':_0x15955f[_0xb001('0x4b')]['id']}},_0xf60969={};_0xf60969[_0xb001('0x36')]=_[_0xb001('0x4c')](db[_0xb001('0x31')][_0xb001('0x32')]);_0xf60969[_0xb001('0x37')]=_['keys'](_0x15955f[_0xb001('0x37')]);_0xf60969[_0xb001('0x41')]=_['intersection'](_0xf60969[_0xb001('0x36')],_0xf60969['query']);_0x39d0c5[_0xb001('0x38')]=_['intersection'](_0xf60969['model'],qs['fields'](_0x15955f[_0xb001('0x37')]['fields']));_0x39d0c5['attributes']=_0x39d0c5[_0xb001('0x38')][_0xb001('0x3b')]?_0x39d0c5[_0xb001('0x38')]:_0xf60969[_0xb001('0x36')];if(_0x15955f[_0xb001('0x37')][_0xb001('0x46')]){_0x39d0c5[_0xb001('0x47')]=[{'all':!![]}];}_0x39d0c5=_['merge']({},_0x39d0c5,_0x15955f['options']);return db[_0xb001('0x31')][_0xb001('0x4d')](_0x39d0c5)['then'](handleEntityNotFound(_0x43c648,null))[_0xb001('0x27')](respondWithResult(_0x43c648,null))[_0xb001('0x4a')](handleError(_0x43c648,null));};exports[_0xb001('0x4e')]=function(_0x34c661,_0x17d555){return db[_0xb001('0x31')][_0xb001('0x4e')](_0x34c661[_0xb001('0x4f')],{})[_0xb001('0x27')](function(_0x658b30){var _0x3ef044=_0x34c661[_0xb001('0x50')][_0xb001('0x29')]({'plain':!![]});if(!_0x3ef044)throw new Error(_0xb001('0x51'));if(_0x3ef044[_0xb001('0x52')]===_0xb001('0x50')){var _0x254e5e=_0x658b30['get']({'plain':!![]});var _0x3dafb2='WhatsappQueues';return db[_0xb001('0x53')]['find']({'where':{'name':_0x3dafb2,'userProfileId':_0x3ef044[_0xb001('0x54')]},'raw':!![]})[_0xb001('0x27')](function(_0x371878){if(_0x371878&&_0x371878[_0xb001('0x55')]===0x0){return db[_0xb001('0x56')][_0xb001('0x4e')]({'name':_0x254e5e['name'],'resourceId':_0x254e5e['id'],'type':_0x371878[_0xb001('0x2d')],'sectionId':_0x371878['id']},{})[_0xb001('0x27')](function(){return _0x658b30;});}else{return _0x658b30;}})[_0xb001('0x4a')](function(_0x2db439){logger[_0xb001('0x2b')](_0xb001('0x57'),_0x2db439);throw _0x2db439;});}return _0x658b30;})['then'](respondWithResult(_0x17d555,0xc9))['catch'](handleError(_0x17d555,null));};exports['update']=function(_0x587d07,_0x15375b){if(_0x587d07[_0xb001('0x4f')]['id']){delete _0x587d07[_0xb001('0x4f')]['id'];}return db[_0xb001('0x31')][_0xb001('0x4d')]({'where':{'id':_0x587d07['params']['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x15375b,null))[_0xb001('0x27')](saveUpdates(_0x587d07[_0xb001('0x4f')],null))[_0xb001('0x27')](respondWithResult(_0x15375b,null))[_0xb001('0x4a')](handleError(_0x15375b,null));};exports['destroy']=function(_0x3971a0,_0x61efc6){return db['WhatsappQueue'][_0xb001('0x4d')]({'where':{'id':_0x3971a0[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x61efc6,null))[_0xb001('0x27')](removeEntity(_0x61efc6,null))[_0xb001('0x4a')](handleError(_0x61efc6,null));};exports[_0xb001('0x58')]=function(_0x3a0213,_0xe27353){return db['WhatsappQueue'][_0xb001('0x58')]()[_0xb001('0x27')](respondWithResult(_0xe27353,null))[_0xb001('0x4a')](handleError(_0xe27353,null));};exports[_0xb001('0x59')]=function(_0x22b3fb,_0x2c0cf9,_0x44cf60){var _0x3e3d41={'raw':!![],'where':{}},_0x576f3d={},_0xf2f7;return db[_0xb001('0x31')][_0xb001('0x5a')]({'where':{'id':_0x22b3fb[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x2c0cf9,null))[_0xb001('0x27')](function(_0xbde4bb){if(_0xbde4bb){_0xf2f7=_0xbde4bb[_0xb001('0x29')]({'plain':!![]});_0x576f3d['model']=_[_0xb001('0x4c')](db[_0xb001('0x5b')][_0xb001('0x32')]);_0x576f3d[_0xb001('0x37')]=_['keys'](_0x22b3fb[_0xb001('0x37')]);_0x576f3d['filters']=_['intersection'](_0x576f3d[_0xb001('0x36')],_0x576f3d[_0xb001('0x37')]);_0x3e3d41[_0xb001('0x38')]=_[_0xb001('0x39')](_0x576f3d[_0xb001('0x36')],qs[_0xb001('0x3a')](_0x22b3fb['query'][_0xb001('0x3a')]));_0x3e3d41[_0xb001('0x38')]=_0x3e3d41[_0xb001('0x38')][_0xb001('0x3b')]?_0x3e3d41[_0xb001('0x38')]:_0x576f3d['model'];if(!_0x22b3fb[_0xb001('0x37')][_0xb001('0x3c')](_0xb001('0x3d'))){_0x3e3d41[_0xb001('0x21')]=qs[_0xb001('0x21')](_0x22b3fb[_0xb001('0x37')]['limit']);_0x3e3d41['offset']=qs[_0xb001('0x24')](_0x22b3fb[_0xb001('0x37')]['offset']);}_0x3e3d41[_0xb001('0x3e')]=qs[_0xb001('0x3f')](_0x22b3fb[_0xb001('0x37')]['sort']);_0x3e3d41['where']=qs[_0xb001('0x41')](_[_0xb001('0x5c')](_0x22b3fb[_0xb001('0x37')],_0x576f3d[_0xb001('0x41')]));_0x3e3d41[_0xb001('0x40')][_0xb001('0x5d')]=_0xbde4bb['id'];if(_0x22b3fb[_0xb001('0x37')][_0xb001('0x42')]){_0x3e3d41['where']=_[_0xb001('0x43')](_0x3e3d41[_0xb001('0x40')],{'$or':_[_0xb001('0x30')](_0x3e3d41[_0xb001('0x38')],function(_0x4ef23c){var _0x564766={};_0x564766[_0x4ef23c]={'$like':'%'+_0x22b3fb[_0xb001('0x37')][_0xb001('0x42')]+'%'};return _0x564766;})});}_0x3e3d41=_[_0xb001('0x43')]({},_0x3e3d41,_0x22b3fb[_0xb001('0x45')]);return db[_0xb001('0x5b')][_0xb001('0x48')](_0x3e3d41);}})['then'](function(_0x4ca36d){if(_0x4ca36d){return db['User']['findAndCountAll']({'where':{'id':_[_0xb001('0x30')](_0x4ca36d,_0xb001('0x5e')),'role':_0xb001('0x5f')},'attributes':['id','name',_0xb001('0x60'),_0xb001('0x61'),_0xb001('0x62')]});}})['then'](function(_0x189648){if(_0x189648){return{'count':_0x189648[_0xb001('0x23')],'rows':_[_0xb001('0x30')](_0x189648[_0xb001('0x49')],function(_0x50c783){return{'membername':_0x50c783[_0xb001('0x2d')],'UserId':_0x50c783['id'],'queue_name':_0xf2f7[_0xb001('0x2d')],'WhatsappQueueId':_0xf2f7['id'],'interface':util[_0xb001('0x63')]('%s/%s',_0xb001('0x64'),_0x50c783[_0xb001('0x2d')]),'penalty':0x0,'paused':_0x50c783[_0xb001('0x60')],'createdAt':_0x50c783[_0xb001('0x62')],'updatedAt':_0x50c783[_0xb001('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb001('0x27')](respondWithFilteredResult(_0x2c0cf9,_0x3e3d41))['catch'](handleError(_0x2c0cf9,null));};exports[_0xb001('0x65')]=function(_0x3a1467,_0xdf1bab,_0x544588){var _0x14a4b3={};var _0x36484b={};var _0x42d23e;var _0x175cad;return db[_0xb001('0x31')][_0xb001('0x5a')]({'where':{'id':_0x3a1467[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0xdf1bab,null))['then'](function(_0x3624c4){if(_0x3624c4){_0x42d23e=_0x3624c4;_0x36484b[_0xb001('0x36')]=_[_0xb001('0x4c')](db[_0xb001('0x66')][_0xb001('0x32')]);_0x36484b[_0xb001('0x37')]=_['keys'](_0x3a1467[_0xb001('0x37')]);_0x36484b[_0xb001('0x41')]=_['intersection'](_0x36484b['model'],_0x36484b[_0xb001('0x37')]);_0x14a4b3[_0xb001('0x38')]=_[_0xb001('0x39')](_0x36484b[_0xb001('0x36')],qs['fields'](_0x3a1467[_0xb001('0x37')][_0xb001('0x3a')]));_0x14a4b3[_0xb001('0x38')]=_0x14a4b3[_0xb001('0x38')][_0xb001('0x3b')]?_0x14a4b3['attributes']:_0x36484b[_0xb001('0x36')];_0x14a4b3['order']=qs[_0xb001('0x3f')](_0x3a1467[_0xb001('0x37')][_0xb001('0x3f')]);_0x14a4b3[_0xb001('0x40')]=qs[_0xb001('0x41')](_[_0xb001('0x5c')](_0x3a1467[_0xb001('0x37')],_0x36484b[_0xb001('0x41')]));if(_0x3a1467[_0xb001('0x37')][_0xb001('0x42')]){_0x14a4b3['where']=_['merge'](_0x14a4b3[_0xb001('0x40')],{'$or':_[_0xb001('0x30')](_0x14a4b3[_0xb001('0x38')],function(_0x3df7d1){var _0x56a064={};_0x56a064[_0x3df7d1]={'$like':'%'+_0x3a1467[_0xb001('0x37')][_0xb001('0x42')]+'%'};return _0x56a064;})});}_0x14a4b3=_[_0xb001('0x43')]({},_0x14a4b3,_0x3a1467['options']);return _0x42d23e[_0xb001('0x65')](_0x14a4b3);}})[_0xb001('0x27')](function(_0x741747){if(_0x741747){_0x175cad=_0x741747['length'];if(!_0x3a1467['query']['hasOwnProperty'](_0xb001('0x3d'))){_0x14a4b3[_0xb001('0x21')]=qs[_0xb001('0x21')](_0x3a1467['query'][_0xb001('0x21')]);_0x14a4b3['offset']=qs[_0xb001('0x24')](_0x3a1467['query'][_0xb001('0x24')]);}return _0x42d23e[_0xb001('0x65')](_0x14a4b3);}})[_0xb001('0x27')](function(_0x2600c7){if(_0x2600c7){return _0x2600c7?{'count':_0x175cad,'rows':_0x2600c7}:null;}})['then'](respondWithResult(_0xdf1bab,null))['catch'](handleError(_0xdf1bab,null));};exports['addTeams']=function(_0x285bf5,_0x5c36ad,_0x414575){var _0x5a08b9=_0x285bf5[_0xb001('0x4f')][_0xb001('0x67')];return db[_0xb001('0x66')][_0xb001('0x48')]({'where':{'id':_0x5a08b9},'attributes':['id'],'include':[{'model':db[_0xb001('0x68')],'as':_0xb001('0x69'),'attributes':['id',_0xb001('0x2d'),_0xb001('0x6a'),_0xb001('0x6b'),_0xb001('0x6c')],'raw':!![]}]})['then'](function(_0x3346cd){if(_0x3346cd){var _0x5d7fe3=_[_0xb001('0x6d')](_0x3346cd,function(_0x2043e8){var _0x1f83dc=_0x2043e8['get']({'plain':!![]});return _0x1f83dc[_0xb001('0x69')];});return db[_0xb001('0x31')][_0xb001('0x4d')]({'where':{'id':_0x285bf5[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](function(_0x5f0ac2){return db[_0xb001('0x6e')]['transaction'](function(_0x122ce0){return _0x5f0ac2[_0xb001('0x6f')](_0x5a08b9,{'transaction':_0x122ce0})[_0xb001('0x27')](function(){return BPromise[_0xb001('0x70')](_0x5d7fe3,function(_0x5344b2){return db['UserWhatsappQueue'][_0xb001('0x71')]({'where':{'UserId':_0x5344b2['id'],'WhatsappQueueId':_0x285bf5['params']['id']},'transaction':_0x122ce0});});})[_0xb001('0x27')](function(){_0x5d7fe3['forEach'](function(_0x450b17){socket[_0xb001('0x72')](_0xb001('0x73'),{'UserId':_0x450b17['id'],'WhatsappQueueId':_0x5f0ac2['id']});});});});});}})[_0xb001('0x27')](respondWithStatusCode(_0x5c36ad,null))['catch'](handleError(_0x5c36ad,null));};exports[_0xb001('0x74')]=function(_0x172eff,_0x26ff8f,_0x446587){return db[_0xb001('0x66')][_0xb001('0x48')]({'where':{'id':_0x172eff[_0xb001('0x37')][_0xb001('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb001('0x27')](handleEntityNotFound(_0x26ff8f,null))['then'](function(_0x1dc250){var _0xd13f4c=_[_0xb001('0x30')](_0x1dc250,'id');var _0x33950a=[];var _0x20fe47=[];var _0x1fe216=squel[_0xb001('0x75')]();_0x1fe216[_0xb001('0x76')](_0xb001('0x77'))[_0xb001('0x78')](_0xb001('0x79'),'tq')[_0xb001('0x7a')](_0xb001('0x7b'),'ut',_0xb001('0x7c'))['where'](_0xb001('0x7d'),_0x172eff['params']['id']);for(var _0x190c9c=0x0;_0x190c9c<_0x1dc250[_0xb001('0x3b')];_0x190c9c+=0x1){let _0x3425ad=_0x1dc250[_0x190c9c];for(var _0x5e571d=0x0;_0x5e571d<_0x3425ad[_0xb001('0x69')]['length'];_0x5e571d+=0x1){let _0x3746a8=_0x3425ad[_0xb001('0x69')][_0x5e571d];var _0x27b7de=_0x1fe216[_0xb001('0x7e')]();_0x27b7de[_0xb001('0x40')](_0xb001('0x7f'),_0x3746a8['id']);_0x20fe47[_0xb001('0x80')](db[_0xb001('0x6e')][_0xb001('0x37')](_0x27b7de['toString'](),{'type':db[_0xb001('0x6e')]['QueryTypes']['SELECT']})[_0xb001('0x27')](function(_0xe8805a){if(_0xe8805a['length']===0x1){return _0x3746a8['id'];}else{var _0x33c985=_[_0xb001('0x81')](_[_0xb001('0x30')](_0xe8805a,_0xb001('0x82')),function(_0x4a72df){return _[_0xb001('0x83')](_0xd13f4c,_0x4a72df);});if(_0x33c985){return _0x3746a8['id'];}}}));}}return BPromise[_0xb001('0x84')](_0x20fe47)['then'](function(_0x5162e2){_0x33950a=_(_0x33950a)[_0xb001('0x85')](_0x5162e2)[_0xb001('0x86')]()[_0xb001('0x87')]();return db[_0xb001('0x31')]['find']({'where':{'id':_0x172eff[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](function(_0x3bb255){return db[_0xb001('0x6e')][_0xb001('0x88')](function(_0x53b96d){return _0x3bb255[_0xb001('0x74')](_0x172eff[_0xb001('0x37')][_0xb001('0x67')],{'transaction':_0x53b96d})[_0xb001('0x27')](function(){if(!_[_0xb001('0x89')](_0x33950a)){return _0x3bb255[_0xb001('0x8a')](_0x33950a,{'transaction':_0x53b96d});}})[_0xb001('0x27')](function(){_0x33950a[_0xb001('0x8b')](function(_0x4af48a){socket[_0xb001('0x72')](_0xb001('0x8c'),{'UserId':_0x4af48a,'WhatsappQueueId':_0x3bb255['id']});});});});});});})[_0xb001('0x27')](respondWithStatusCode(_0x26ff8f,null))[_0xb001('0x4a')](handleError(_0x26ff8f,null));};exports[_0xb001('0x8d')]=function(_0x243bf3,_0x2354a7,_0x5b71a8){return db[_0xb001('0x31')]['find']({'where':{'id':_0x243bf3[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x2354a7,null))[_0xb001('0x27')](function(_0x797436){if(_0x797436){return _0x797436[_0xb001('0x8d')](_0x243bf3['body'][_0xb001('0x67')],_['omit'](_0x243bf3[_0xb001('0x4f')],['ids','id'])||{})[_0xb001('0x8e')](function(_0x16543f){for(var _0x2980dc=0x0;_0x2980dc<_0x243bf3['body'][_0xb001('0x67')]['length'];_0x2980dc+=0x1){socket[_0xb001('0x72')](_0xb001('0x73'),{'UserId':Number(_0x243bf3['body'][_0xb001('0x67')][_0x2980dc]),'WhatsappQueueId':Number(_0x243bf3[_0xb001('0x4b')]['id'])});}return _0x16543f;});}})[_0xb001('0x27')](respondWithResult(_0x2354a7,null))[_0xb001('0x4a')](handleError(_0x2354a7,null));};exports[_0xb001('0x8a')]=function(_0x485ad9,_0x5a2f06,_0x238bc3){return db[_0xb001('0x31')]['find']({'where':{'id':_0x485ad9[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x5a2f06,null))[_0xb001('0x27')](function(_0x12a137){if(_0x12a137){return _0x12a137['removeAgents'](_0x485ad9[_0xb001('0x37')][_0xb001('0x67')])[_0xb001('0x27')](function(){if(_[_0xb001('0x8f')](_0x485ad9[_0xb001('0x37')]['ids'])){for(var _0x32ac96=0x0;_0x32ac96<_0x485ad9['query'][_0xb001('0x67')][_0xb001('0x3b')];_0x32ac96+=0x1){socket[_0xb001('0x72')](_0xb001('0x8c'),{'UserId':Number(_0x485ad9[_0xb001('0x37')]['ids'][_0x32ac96]),'WhatsappQueueId':Number(_0x485ad9[_0xb001('0x4b')]['id'])});}}else{socket[_0xb001('0x72')](_0xb001('0x8c'),{'UserId':Number(_0x485ad9['query'][_0xb001('0x67')]),'WhatsappQueueId':Number(_0x485ad9[_0xb001('0x4b')]['id'])});}});}})[_0xb001('0x27')](respondWithStatusCode(_0x5a2f06,null))['catch'](handleError(_0x5a2f06,null));};exports[_0xb001('0x90')]=function(_0x48e73d,_0x4a10dd,_0x2f3cd6){var _0x2139a1={};var _0xdac465={};var _0x125cea;var _0x304d98;return db['WhatsappQueue'][_0xb001('0x5a')]({'where':{'id':_0x48e73d[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x4a10dd,null))[_0xb001('0x27')](function(_0x1d03b5){if(_0x1d03b5){_0x125cea=_0x1d03b5;_0xdac465['model']=_[_0xb001('0x4c')](db[_0xb001('0x68')][_0xb001('0x32')]);_0xdac465[_0xb001('0x37')]=_[_0xb001('0x4c')](_0x48e73d[_0xb001('0x37')]);_0xdac465[_0xb001('0x41')]=_[_0xb001('0x39')](_0xdac465[_0xb001('0x36')],_0xdac465[_0xb001('0x37')]);_0x2139a1[_0xb001('0x38')]=_[_0xb001('0x39')](_0xdac465[_0xb001('0x36')],qs[_0xb001('0x3a')](_0x48e73d['query'][_0xb001('0x3a')]));_0x2139a1[_0xb001('0x38')]=_0x2139a1[_0xb001('0x38')][_0xb001('0x3b')]?_0x2139a1[_0xb001('0x38')]:_0xdac465[_0xb001('0x36')];_0x2139a1[_0xb001('0x3e')]=qs['sort'](_0x48e73d[_0xb001('0x37')][_0xb001('0x3f')]);_0x2139a1['where']=qs[_0xb001('0x41')](_[_0xb001('0x5c')](_0x48e73d[_0xb001('0x37')],_0xdac465[_0xb001('0x41')]));if(_0x48e73d['query'][_0xb001('0x42')]){_0x2139a1['where']=_[_0xb001('0x43')](_0x2139a1[_0xb001('0x40')],{'$or':_[_0xb001('0x30')](_0x2139a1['attributes'],function(_0x13bd49){var _0x11a31f={};_0x11a31f[_0x13bd49]={'$like':'%'+_0x48e73d['query'][_0xb001('0x42')]+'%'};return _0x11a31f;})});}_0x2139a1=_[_0xb001('0x43')]({},_0x2139a1,_0x48e73d[_0xb001('0x45')]);return _0x125cea[_0xb001('0x90')](_0x2139a1);}})[_0xb001('0x27')](function(_0x72ec9b){if(_0x72ec9b){_0x304d98=_0x72ec9b[_0xb001('0x3b')];if(!_0x48e73d[_0xb001('0x37')][_0xb001('0x3c')](_0xb001('0x3d'))){_0x2139a1[_0xb001('0x21')]=qs[_0xb001('0x21')](_0x48e73d[_0xb001('0x37')]['limit']);_0x2139a1[_0xb001('0x24')]=qs[_0xb001('0x24')](_0x48e73d[_0xb001('0x37')][_0xb001('0x24')]);}return _0x125cea[_0xb001('0x90')](_0x2139a1);}})[_0xb001('0x27')](function(_0xbdee06){if(_0xbdee06){return _0xbdee06?{'count':_0x304d98,'rows':_0xbdee06}:null;}})['then'](respondWithResult(_0x4a10dd,null))['catch'](handleError(_0x4a10dd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index fbc00c4..4bc7921 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 _0x241f=['../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hook','events'];(function(_0x4d7705,_0x5f3da8){var _0x4e0f51=function(_0x4b6a31){while(--_0x4b6a31){_0x4d7705['push'](_0x4d7705['shift']());}};_0x4e0f51(++_0x5f3da8);}(_0x241f,0x17f));var _0xf241=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x241f[_0x4d45c1];return _0x244478;};'use strict';var EventEmitter=require(_0xf241('0x0'));var WhatsappQueue=require(_0xf241('0x1'))['db'][_0xf241('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf241('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf241('0x4'),'afterDestroy':_0xf241('0x5')};function emitEvent(_0x3141e0){return function(_0x1b7e39,_0x140582,_0x57ca78){WhatsappQueueEvents[_0xf241('0x6')](_0x3141e0+':'+_0x1b7e39['id'],_0x1b7e39);WhatsappQueueEvents[_0xf241('0x6')](_0x3141e0,_0x1b7e39);_0x57ca78(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xf241('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xdc27=['exports','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x350ec3,_0x1dcb41){var _0x1eef31=function(_0x388869){while(--_0x388869){_0x350ec3['push'](_0x350ec3['shift']());}};_0x1eef31(++_0x1dcb41);}(_0xdc27,0x1ba));var _0x7dc2=function(_0x412158,_0xce52f1){_0x412158=_0x412158-0x0;var _0x1c496b=_0xdc27[_0x412158];return _0x1c496b;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x7dc2('0x0'))['db'][_0x7dc2('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7dc2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7dc2('0x3'),'afterDestroy':_0x7dc2('0x4')};function emitEvent(_0x5ae4f4){return function(_0xe722f3,_0x86fd03,_0x117941){WhatsappQueueEvents[_0x7dc2('0x5')](_0x5ae4f4+':'+_0xe722f3['id'],_0xe722f3);WhatsappQueueEvents['emit'](_0x5ae4f4,_0xe722f3);_0x117941(null);};}for(var e in events){if(events[_0x7dc2('0x6')](e)){var event=events[e];WhatsappQueue[_0x7dc2('0x7')](e,emitEvent(event));}}module[_0x7dc2('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 df6e508..6529ad5 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 _0x22a6=['../../config/environment','exports','WhatsappQueue','../../config/logger','api','request-promise','path','rimraf'];(function(_0x2647dc,_0x5e9a75){var _0x4f7e3e=function(_0x1af0c0){while(--_0x1af0c0){_0x2647dc['push'](_0x2647dc['shift']());}};_0x4f7e3e(++_0x5e9a75);}(_0x22a6,0xe3));var _0x622a=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0x22a6[_0x2a4095];return _0x52eeab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x622a('0x0'))(_0x622a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x622a('0x2'));var fs=require('fs');var path=require(_0x622a('0x3'));var rimraf=require(_0x622a('0x4'));var config=require(_0x622a('0x5'));var attributes=require('./whatsappQueue.attributes');module[_0x622a('0x6')]=function(_0x25e91f,_0xc7a7d3){return _0x25e91f['define'](_0x622a('0x7'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2680=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash'];(function(_0x9f064a,_0x56c7b3){var _0x253c68=function(_0x2b9c8c){while(--_0x2b9c8c){_0x9f064a['push'](_0x9f064a['shift']());}};_0x253c68(++_0x56c7b3);}(_0x2680,0x1c6));var _0x0268=function(_0x359541,_0x20bfa6){_0x359541=_0x359541-0x0;var _0x60a1eb=_0x2680[_0x359541];return _0x60a1eb;};'use strict';var _=require(_0x0268('0x0'));var util=require(_0x0268('0x1'));var logger=require(_0x0268('0x2'))(_0x0268('0x3'));var moment=require(_0x0268('0x4'));var BPromise=require(_0x0268('0x5'));var rp=require(_0x0268('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0268('0x7'));var config=require(_0x0268('0x8'));var attributes=require(_0x0268('0x9'));module[_0x0268('0xa')]=function(_0x1d87d1,_0x30cbb5){return _0x1d87d1[_0x0268('0xb')]('WhatsappQueue',attributes,{'tableName':_0x0268('0xc'),'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 f0b2009..b750e57 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 _0xfb04=['lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','include','map','model','debug','ShowWhatsappQueue','find','raw','then'];(function(_0xe6f29d,_0x26c220){var _0x19d116=function(_0xb2c9dc){while(--_0xb2c9dc){_0xe6f29d['push'](_0xe6f29d['shift']());}};_0x19d116(++_0x26c220);}(_0xfb04,0x197));var _0x4fb0=function(_0x4080e5,_0x4bf5e3){_0x4080e5=_0x4080e5-0x0;var _0x3f6564=_0xfb04[_0x4080e5];return _0x3f6564;};'use strict';var _=require(_0x4fb0('0x0'));var util=require(_0x4fb0('0x1'));var moment=require('moment');var BPromise=require(_0x4fb0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fb0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4fb0('0x4'));var logger=require('../../config/logger')(_0x4fb0('0x5'));var config=require(_0x4fb0('0x6'));var jayson=require(_0x4fb0('0x7'));var client=jayson[_0x4fb0('0x8')][_0x4fb0('0x9')]({'port':0x232a});config[_0x4fb0('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4fb0('0xb'))[_0x4fb0('0xc')](socket);function respondWithRpcPromise(_0x502fdb,_0xee74ba,_0x1b4fb6){return new BPromise(function(_0x519118,_0xd844d7){return client[_0x4fb0('0xd')](_0x502fdb,_0x1b4fb6)['then'](function(_0x1b6c8){logger[_0x4fb0('0xe')](_0x4fb0('0xf'),_0xee74ba,_0x4fb0('0x10'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0xee74ba,_0x4fb0('0x10'),JSON[_0x4fb0('0x11')](_0x1b6c8));if(_0x1b6c8[_0x4fb0('0x12')]){if(_0x1b6c8[_0x4fb0('0x12')][_0x4fb0('0x13')]===0x1f4){logger[_0x4fb0('0x12')](_0x4fb0('0xf'),_0xee74ba,_0x1b6c8[_0x4fb0('0x12')][_0x4fb0('0x14')]);return _0xd844d7(_0x1b6c8[_0x4fb0('0x12')][_0x4fb0('0x14')]);}logger[_0x4fb0('0x12')](_0x4fb0('0xf'),_0xee74ba,_0x1b6c8[_0x4fb0('0x12')][_0x4fb0('0x14')]);return _0x519118(_0x1b6c8[_0x4fb0('0x12')][_0x4fb0('0x14')]);}else{logger[_0x4fb0('0xe')](_0x4fb0('0xf'),_0xee74ba,_0x4fb0('0x10'));_0x519118(_0x1b6c8[_0x4fb0('0x15')][_0x4fb0('0x14')]);}})[_0x4fb0('0x16')](function(_0x450b67){logger[_0x4fb0('0x12')](_0x4fb0('0xf'),_0xee74ba,_0x450b67);_0xd844d7(_0x450b67);});});}exports[_0x4fb0('0x17')]=function(_0x1d8223){var _0x45c77a=this;return new Promise(function(_0x326685,_0x5117d6){return db[_0x4fb0('0x18')][_0x4fb0('0x19')]({'raw':_0x1d8223[_0x4fb0('0x1a')]?_0x1d8223[_0x4fb0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1d8223[_0x4fb0('0x1a')]?_0x1d8223[_0x4fb0('0x1a')][_0x4fb0('0x1b')]||null:null,'attributes':_0x1d8223['options']?_0x1d8223[_0x4fb0('0x1a')][_0x4fb0('0x1c')]||null:null,'limit':_0x1d8223[_0x4fb0('0x1a')]?_0x1d8223[_0x4fb0('0x1a')]['limit']||null:null,'include':_0x1d8223[_0x4fb0('0x1a')]?_0x1d8223['options'][_0x4fb0('0x1d')]?_[_0x4fb0('0x1e')](_0x1d8223[_0x4fb0('0x1a')][_0x4fb0('0x1d')],function(_0x2f1d15){return{'model':db[_0x2f1d15['model']],'as':_0x2f1d15['as'],'attributes':_0x2f1d15[_0x4fb0('0x1c')],'include':_0x2f1d15[_0x4fb0('0x1d')]?_[_0x4fb0('0x1e')](_0x2f1d15[_0x4fb0('0x1d')],function(_0x57b6ea){return{'model':db[_0x57b6ea[_0x4fb0('0x1f')]],'as':_0x57b6ea['as'],'attributes':_0x57b6ea[_0x4fb0('0x1c')],'include':_0x57b6ea[_0x4fb0('0x1d')]?_['map'](_0x57b6ea[_0x4fb0('0x1d')],function(_0x2f9f0d){return{'model':db[_0x2f9f0d[_0x4fb0('0x1f')]],'as':_0x2f9f0d['as'],'attributes':_0x2f9f0d[_0x4fb0('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4adf7f){logger[_0x4fb0('0xe')](_0x4fb0('0x17'),_0x1d8223);logger[_0x4fb0('0x20')]('GetWhatsappQueue',_0x1d8223,JSON[_0x4fb0('0x11')](_0x4adf7f));_0x326685(_0x4adf7f);})[_0x4fb0('0x16')](function(_0x21cddf){logger[_0x4fb0('0x12')](_0x4fb0('0x17'),_0x21cddf[_0x4fb0('0x14')],_0x1d8223);_0x5117d6(_0x45c77a[_0x4fb0('0x12')](0x1f4,_0x21cddf['message']));});});};exports[_0x4fb0('0x21')]=function(_0x56cad0){var _0x39a9f7=this;return new Promise(function(_0x298d46,_0x4af531){return db[_0x4fb0('0x18')][_0x4fb0('0x22')]({'raw':_0x56cad0[_0x4fb0('0x1a')]?_0x56cad0[_0x4fb0('0x1a')][_0x4fb0('0x23')]===undefined?!![]:![]:!![],'where':_0x56cad0[_0x4fb0('0x1a')]?_0x56cad0[_0x4fb0('0x1a')][_0x4fb0('0x1b')]||null:null,'attributes':_0x56cad0[_0x4fb0('0x1a')]?_0x56cad0[_0x4fb0('0x1a')][_0x4fb0('0x1c')]||null:null,'include':_0x56cad0['options']?_0x56cad0[_0x4fb0('0x1a')]['include']?_[_0x4fb0('0x1e')](_0x56cad0['options']['include'],function(_0x3d127c){return{'model':db[_0x3d127c[_0x4fb0('0x1f')]],'as':_0x3d127c['as'],'attributes':_0x3d127c['attributes'],'include':_0x3d127c[_0x4fb0('0x1d')]?_['map'](_0x3d127c[_0x4fb0('0x1d')],function(_0x183aa8){return{'model':db[_0x183aa8['model']],'as':_0x183aa8['as'],'attributes':_0x183aa8[_0x4fb0('0x1c')],'include':_0x183aa8[_0x4fb0('0x1d')]?_[_0x4fb0('0x1e')](_0x183aa8['include'],function(_0xb1b8c3){return{'model':db[_0xb1b8c3['model']],'as':_0xb1b8c3['as'],'attributes':_0xb1b8c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x4fb0('0x24')](function(_0x43c4aa){logger[_0x4fb0('0xe')](_0x4fb0('0x21'),_0x56cad0);logger['debug'](_0x4fb0('0x21'),_0x56cad0,JSON[_0x4fb0('0x11')](_0x43c4aa));_0x298d46(_0x43c4aa);})[_0x4fb0('0x16')](function(_0x346ec7){logger['error'](_0x4fb0('0x21'),_0x346ec7[_0x4fb0('0x14')],_0x56cad0);_0x4af531(_0x39a9f7['error'](0x1f4,_0x346ec7[_0x4fb0('0x14')]));});});}; \ No newline at end of file +var _0x4ee2=['raw','where','include','map','model','attributes','catch','ShowWhatsappQueue','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','result','message','GetWhatsappQueue','findAll','options'];(function(_0x5b0d0a,_0x5177c3){var _0x39b6f7=function(_0x47d86d){while(--_0x47d86d){_0x5b0d0a['push'](_0x5b0d0a['shift']());}};_0x39b6f7(++_0x5177c3);}(_0x4ee2,0xae));var _0x24ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4ee2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x24ee('0x0'));var util=require('util');var moment=require(_0x24ee('0x1'));var BPromise=require(_0x24ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24ee('0x3'));var db=require(_0x24ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x24ee('0x5'))(_0x24ee('0x6'));var config=require('../../config/environment');var jayson=require(_0x24ee('0x7'));var client=jayson[_0x24ee('0x8')]['http']({'port':0x232a});config[_0x24ee('0x9')]=_[_0x24ee('0xa')](config[_0x24ee('0x9')],{'host':_0x24ee('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24ee('0x9')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5375a4,_0x37f2c2,_0x41a86d){return new BPromise(function(_0x4c4256,_0x1ffefb){return client['request'](_0x5375a4,_0x41a86d)[_0x24ee('0xc')](function(_0x540a99){logger[_0x24ee('0xd')](_0x24ee('0xe'),_0x37f2c2,_0x24ee('0xf'));logger[_0x24ee('0x10')](_0x24ee('0x11'),_0x37f2c2,_0x24ee('0xf'),JSON['stringify'](_0x540a99));if(_0x540a99['error']){if(_0x540a99[_0x24ee('0x12')]['code']===0x1f4){logger[_0x24ee('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x37f2c2,_0x540a99[_0x24ee('0x12')]['message']);return _0x1ffefb(_0x540a99[_0x24ee('0x12')]['message']);}logger['error'](_0x24ee('0xe'),_0x37f2c2,_0x540a99[_0x24ee('0x12')]['message']);return _0x4c4256(_0x540a99['error']['message']);}else{logger[_0x24ee('0xd')](_0x24ee('0xe'),_0x37f2c2,_0x24ee('0xf'));_0x4c4256(_0x540a99[_0x24ee('0x13')][_0x24ee('0x14')]);}})['catch'](function(_0x47a0a0){logger['error'](_0x24ee('0xe'),_0x37f2c2,_0x47a0a0);_0x1ffefb(_0x47a0a0);});});}exports[_0x24ee('0x15')]=function(_0x5651f3){var _0xb8d47b=this;return new Promise(function(_0x6ff4de,_0x276861){return db['WhatsappQueue'][_0x24ee('0x16')]({'raw':_0x5651f3[_0x24ee('0x17')]?_0x5651f3[_0x24ee('0x17')][_0x24ee('0x18')]===undefined?!![]:![]:!![],'where':_0x5651f3['options']?_0x5651f3[_0x24ee('0x17')][_0x24ee('0x19')]||null:null,'attributes':_0x5651f3[_0x24ee('0x17')]?_0x5651f3[_0x24ee('0x17')]['attributes']||null:null,'limit':_0x5651f3[_0x24ee('0x17')]?_0x5651f3[_0x24ee('0x17')]['limit']||null:null,'include':_0x5651f3[_0x24ee('0x17')]?_0x5651f3['options'][_0x24ee('0x1a')]?_[_0x24ee('0x1b')](_0x5651f3[_0x24ee('0x17')][_0x24ee('0x1a')],function(_0x31f940){return{'model':db[_0x31f940[_0x24ee('0x1c')]],'as':_0x31f940['as'],'attributes':_0x31f940[_0x24ee('0x1d')],'include':_0x31f940[_0x24ee('0x1a')]?_['map'](_0x31f940['include'],function(_0x91c2b0){return{'model':db[_0x91c2b0[_0x24ee('0x1c')]],'as':_0x91c2b0['as'],'attributes':_0x91c2b0[_0x24ee('0x1d')],'include':_0x91c2b0[_0x24ee('0x1a')]?_[_0x24ee('0x1b')](_0x91c2b0[_0x24ee('0x1a')],function(_0xe6ca1f){return{'model':db[_0xe6ca1f[_0x24ee('0x1c')]],'as':_0xe6ca1f['as'],'attributes':_0xe6ca1f[_0x24ee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x24ee('0xc')](function(_0x13f552){logger[_0x24ee('0xd')](_0x24ee('0x15'),_0x5651f3);logger['debug'](_0x24ee('0x15'),_0x5651f3,JSON['stringify'](_0x13f552));_0x6ff4de(_0x13f552);})[_0x24ee('0x1e')](function(_0x18d130){logger[_0x24ee('0x12')](_0x24ee('0x15'),_0x18d130[_0x24ee('0x14')],_0x5651f3);_0x276861(_0xb8d47b[_0x24ee('0x12')](0x1f4,_0x18d130[_0x24ee('0x14')]));});});};exports[_0x24ee('0x1f')]=function(_0xaff33){var _0x4ec21f=this;return new Promise(function(_0x27f35f,_0x4a2356){return db['WhatsappQueue']['find']({'raw':_0xaff33[_0x24ee('0x17')]?_0xaff33[_0x24ee('0x17')][_0x24ee('0x18')]===undefined?!![]:![]:!![],'where':_0xaff33[_0x24ee('0x17')]?_0xaff33[_0x24ee('0x17')][_0x24ee('0x19')]||null:null,'attributes':_0xaff33['options']?_0xaff33['options'][_0x24ee('0x1d')]||null:null,'include':_0xaff33[_0x24ee('0x17')]?_0xaff33[_0x24ee('0x17')][_0x24ee('0x1a')]?_['map'](_0xaff33[_0x24ee('0x17')][_0x24ee('0x1a')],function(_0xfcb9ca){return{'model':db[_0xfcb9ca[_0x24ee('0x1c')]],'as':_0xfcb9ca['as'],'attributes':_0xfcb9ca[_0x24ee('0x1d')],'include':_0xfcb9ca[_0x24ee('0x1a')]?_[_0x24ee('0x1b')](_0xfcb9ca['include'],function(_0x5525ff){return{'model':db[_0x5525ff['model']],'as':_0x5525ff['as'],'attributes':_0x5525ff[_0x24ee('0x1d')],'include':_0x5525ff['include']?_[_0x24ee('0x1b')](_0x5525ff[_0x24ee('0x1a')],function(_0x35becc){return{'model':db[_0x35becc['model']],'as':_0x35becc['as'],'attributes':_0x35becc[_0x24ee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x24ee('0xc')](function(_0x15102e){logger[_0x24ee('0xd')](_0x24ee('0x1f'),_0xaff33);logger[_0x24ee('0x10')](_0x24ee('0x1f'),_0xaff33,JSON[_0x24ee('0x20')](_0x15102e));_0x27f35f(_0x15102e);})[_0x24ee('0x1e')](function(_0x65fe9d){logger[_0x24ee('0x12')]('ShowWhatsappQueue',_0x65fe9d[_0x24ee('0x14')],_0xaff33);_0x4a2356(_0x4ec21f[_0x24ee('0x12')](0x1f4,_0x65fe9d[_0x24ee('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 7d42078..d0904a2 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 _0x91f1=['save','update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x14dd26,_0x3cc881){var _0x4a7ab0=function(_0x15b151){while(--_0x15b151){_0x14dd26['push'](_0x14dd26['shift']());}};_0x4a7ab0(++_0x3cc881);}(_0x91f1,0x147));var _0x191f=function(_0x159bbd,_0x3fb13b){_0x159bbd=_0x159bbd-0x0;var _0x1093e7=_0x91f1[_0x159bbd];return _0x1093e7;};'use strict';var WhatsappQueueEvents=require(_0x191f('0x0'));var events=[_0x191f('0x1'),'remove',_0x191f('0x2')];function createListener(_0x4b6111,_0x2d6607){return function(_0x56ca49){_0x2d6607[_0x191f('0x3')](_0x4b6111,_0x56ca49);};}function removeListener(_0x5b6a74,_0x308e58){return function(){WhatsappQueueEvents[_0x191f('0x4')](_0x5b6a74,_0x308e58);};}exports[_0x191f('0x5')]=function(_0xf001c6){for(var _0x383d3b=0x0,_0x20f345=events[_0x191f('0x6')];_0x383d3b<_0x20f345;_0x383d3b++){var _0x14c1f6=events[_0x383d3b];var _0x5ad8a0=createListener(_0x191f('0x7')+_0x14c1f6,_0xf001c6);WhatsappQueueEvents['on'](_0x14c1f6,_0x5ad8a0);}}; \ No newline at end of file +var _0x4424=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener'];(function(_0x321d52,_0x69fd7f){var _0x390746=function(_0xaf45d9){while(--_0xaf45d9){_0x321d52['push'](_0x321d52['shift']());}};_0x390746(++_0x69fd7f);}(_0x4424,0x19b));var _0x4442=function(_0x5cd891,_0x2477d1){_0x5cd891=_0x5cd891-0x0;var _0x2c8b51=_0x4424[_0x5cd891];return _0x2c8b51;};'use strict';var WhatsappQueueEvents=require(_0x4442('0x0'));var events=[_0x4442('0x1'),_0x4442('0x2'),'update'];function createListener(_0x4c55ac,_0xeb1f93){return function(_0x514d20){_0xeb1f93[_0x4442('0x3')](_0x4c55ac,_0x514d20);};}function removeListener(_0x3d336a,_0xb63230){return function(){WhatsappQueueEvents[_0x4442('0x4')](_0x3d336a,_0xb63230);};}exports[_0x4442('0x5')]=function(_0x2129fd){for(var _0xe86480=0x0,_0x477e39=events[_0x4442('0x6')];_0xe86480<_0x477e39;_0xe86480++){var _0x44f767=events[_0xe86480];var _0x48eda8=createListener(_0x4442('0x7')+_0x44f767,_0x2129fd);WhatsappQueueEvents['on'](_0x44f767,_0x48eda8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 9d1afb5..3e0a376 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 _0x8fea=['get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','isAuthenticated','index'];(function(_0x25ad73,_0x109fad){var _0x46ade3=function(_0x8cc340){while(--_0x8cc340){_0x25ad73['push'](_0x25ad73['shift']());}};_0x46ade3(++_0x109fad);}(_0x8fea,0x14e));var _0xa8fe=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x8fea[_0x45c981];return _0x4f62c8;};'use strict';var multer=require(_0xa8fe('0x0'));var util=require('util');var path=require(_0xa8fe('0x1'));var timeout=require(_0xa8fe('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa8fe('0x3'));var interaction=require(_0xa8fe('0x4'));var config=require('../../config/environment');var controller=require(_0xa8fe('0x5'));router['get']('/',auth[_0xa8fe('0x6')](),controller[_0xa8fe('0x7')]);router[_0xa8fe('0x8')](_0xa8fe('0x9'),auth['isAuthenticated'](),controller[_0xa8fe('0xa')]);router['get'](_0xa8fe('0xb'),auth[_0xa8fe('0x6')](),controller[_0xa8fe('0xc')]);router[_0xa8fe('0xd')]('/',auth['isAuthenticated'](),controller[_0xa8fe('0xe')]);router[_0xa8fe('0xf')](_0xa8fe('0xb'),auth[_0xa8fe('0x6')](),controller[_0xa8fe('0x10')]);router['delete'](_0xa8fe('0xb'),auth['isAuthenticated'](),controller[_0xa8fe('0x11')]);module[_0xa8fe('0x12')]=router; \ No newline at end of file +var _0x4210=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','get','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x178f27,_0x26e5b0){var _0x1bef17=function(_0x32cf4d){while(--_0x32cf4d){_0x178f27['push'](_0x178f27['shift']());}};_0x1bef17(++_0x26e5b0);}(_0x4210,0x7a));var _0x0421=function(_0x2f7092,_0x5d2987){_0x2f7092=_0x2f7092-0x0;var _0x22f651=_0x4210[_0x2f7092];return _0x22f651;};'use strict';var multer=require(_0x0421('0x0'));var util=require(_0x0421('0x1'));var path=require(_0x0421('0x2'));var timeout=require(_0x0421('0x3'));var express=require(_0x0421('0x4'));var router=express[_0x0421('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0421('0x6'));var interaction=require(_0x0421('0x7'));var config=require(_0x0421('0x8'));var controller=require(_0x0421('0x9'));router['get']('/',auth[_0x0421('0xa')](),controller['index']);router['get']('/describe',auth[_0x0421('0xa')](),controller['describe']);router[_0x0421('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0421('0xa')](),controller[_0x0421('0xc')]);router['put'](_0x0421('0xd'),auth[_0x0421('0xa')](),controller[_0x0421('0xe')]);router[_0x0421('0xf')](_0x0421('0xd'),auth['isAuthenticated'](),controller[_0x0421('0x10')]);module[_0x0421('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e08d1e3..ab4bf33 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x177e2f,_0x291299){var _0x4f7d1b=function(_0x459f05){while(--_0x459f05){_0x177e2f['push'](_0x177e2f['shift']());}};_0x4f7d1b(++_0x291299);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x10235d,_0x42f7fe){var _0x3107ce=function(_0x4c0cf4){while(--_0x4c0cf4){_0x10235d['push'](_0x10235d['shift']());}};_0x3107ce(++_0x42f7fe);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index caf6471..85ecc50 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 _0x5ec6=['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','index','map','WhatsappQueueReport','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x56d5cf,_0x554f3c){var _0x1e0651=function(_0x3f016c){while(--_0x3f016c){_0x56d5cf['push'](_0x56d5cf['shift']());}};_0x1e0651(++_0x554f3c);}(_0x5ec6,0x7f));var _0x65ec=function(_0x43609d,_0x4d58d3){_0x43609d=_0x43609d-0x0;var _0x46bb59=_0x5ec6[_0x43609d];return _0x46bb59;};'use strict';var emlformat=require(_0x65ec('0x0'));var rimraf=require(_0x65ec('0x1'));var zipdir=require(_0x65ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65ec('0x3'));var moment=require('moment');var BPromise=require(_0x65ec('0x4'));var Mustache=require('mustache');var util=require(_0x65ec('0x5'));var path=require('path');var sox=require(_0x65ec('0x6'));var csv=require('to-csv');var ejs=require(_0x65ec('0x7'));var fs=require('fs');var fs_extra=require(_0x65ec('0x8'));var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0xc'));var querystring=require(_0x65ec('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xf'));var hardwareService=require(_0x65ec('0x10'));var logger=require('../../config/logger')(_0x65ec('0x11'));var utils=require(_0x65ec('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x65ec('0x13'));var db=require(_0x65ec('0x14'))['db'];function respondWithStatusCode(_0x53d62b,_0x3e52c8){_0x3e52c8=_0x3e52c8||0xcc;return function(_0x2af7d6){if(_0x2af7d6){return _0x53d62b[_0x65ec('0x15')](_0x3e52c8);}return _0x53d62b[_0x65ec('0x16')](_0x3e52c8)[_0x65ec('0x17')]();};}function respondWithResult(_0x434e20,_0x344724){_0x344724=_0x344724||0xc8;return function(_0x3edbfd){if(_0x3edbfd){return _0x434e20['status'](_0x344724)[_0x65ec('0x18')](_0x3edbfd);}};}function respondWithFilteredResult(_0x3ed6f7,_0x35d06b){return function(_0x4bbe88){if(_0x4bbe88){var _0x5a0442=typeof _0x35d06b[_0x65ec('0x19')]===_0x65ec('0x1a')&&typeof _0x35d06b[_0x65ec('0x1b')]==='undefined';var _0x25dae7=_0x4bbe88[_0x65ec('0x1c')];var _0x1254f8=_0x5a0442?0x0:_0x35d06b[_0x65ec('0x19')];var _0x29ebc4=_0x5a0442?_0x4bbe88[_0x65ec('0x1c')]:_0x35d06b[_0x65ec('0x19')]+_0x35d06b[_0x65ec('0x1b')];var _0x2127e2;if(_0x29ebc4>=_0x25dae7){_0x29ebc4=_0x25dae7;_0x2127e2=0xc8;}else{_0x2127e2=0xce;}_0x3ed6f7[_0x65ec('0x16')](_0x2127e2);return _0x3ed6f7[_0x65ec('0x1d')](_0x65ec('0x1e'),_0x1254f8+'-'+_0x29ebc4+'/'+_0x25dae7)[_0x65ec('0x18')](_0x4bbe88);}return null;};}function patchUpdates(_0x1467ac){return function(_0x3804a4){try{jsonpatch[_0x65ec('0x1f')](_0x3804a4,_0x1467ac,!![]);}catch(_0x15d4eb){return BPromise[_0x65ec('0x20')](_0x15d4eb);}return _0x3804a4[_0x65ec('0x21')]();};}function saveUpdates(_0x4ff93c,_0x170703){return function(_0x297fba){if(_0x297fba){return _0x297fba[_0x65ec('0x22')](_0x4ff93c)[_0x65ec('0x23')](function(_0x1d60fb){return _0x1d60fb;});}return null;};}function removeEntity(_0x163e55,_0x47288d){return function(_0x58239f){if(_0x58239f){return _0x58239f[_0x65ec('0x24')]()[_0x65ec('0x23')](function(){_0x163e55[_0x65ec('0x16')](0xcc)[_0x65ec('0x17')]();});}};}function handleEntityNotFound(_0x288e66,_0x156793){return function(_0x21426b){if(!_0x21426b){_0x288e66[_0x65ec('0x15')](0x194);}return _0x21426b;};}function handleError(_0x297e09,_0x4c846b){_0x4c846b=_0x4c846b||0x1f4;return function(_0x10baef){logger[_0x65ec('0x25')](_0x10baef[_0x65ec('0x26')]);if(_0x10baef[_0x65ec('0x27')]){delete _0x10baef['name'];}_0x297e09[_0x65ec('0x16')](_0x4c846b)['send'](_0x10baef);};}exports[_0x65ec('0x28')]=function(_0x1ada47,_0x1d0b5c){var _0x30366c={},_0x14431d={},_0x46d4c1={'count':0x0,'rows':[]};var _0x46bf66=_[_0x65ec('0x29')](db[_0x65ec('0x2a')][_0x65ec('0x2b')],function(_0x3c97e2){return{'name':_0x3c97e2['fieldName'],'type':_0x3c97e2['type'][_0x65ec('0x2c')]};});_0x14431d['model']=_[_0x65ec('0x29')](_0x46bf66,_0x65ec('0x27'));_0x14431d['query']=_[_0x65ec('0x2d')](_0x1ada47[_0x65ec('0x2e')]);_0x14431d[_0x65ec('0x2f')]=_[_0x65ec('0x30')](_0x14431d['model'],_0x14431d[_0x65ec('0x2e')]);_0x30366c[_0x65ec('0x31')]=_[_0x65ec('0x30')](_0x14431d[_0x65ec('0x32')],qs[_0x65ec('0x33')](_0x1ada47[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x30366c[_0x65ec('0x31')]=_0x30366c[_0x65ec('0x31')][_0x65ec('0x34')]?_0x30366c['attributes']:_0x14431d[_0x65ec('0x32')];if(!_0x1ada47[_0x65ec('0x2e')]['hasOwnProperty'](_0x65ec('0x35'))){_0x30366c[_0x65ec('0x1b')]=qs[_0x65ec('0x1b')](_0x1ada47[_0x65ec('0x2e')][_0x65ec('0x1b')]);_0x30366c[_0x65ec('0x19')]=qs[_0x65ec('0x19')](_0x1ada47['query'][_0x65ec('0x19')]);}_0x30366c[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x1ada47[_0x65ec('0x2e')]['sort']);_0x30366c[_0x65ec('0x38')]=qs[_0x65ec('0x2f')](_[_0x65ec('0x39')](_0x1ada47[_0x65ec('0x2e')],_0x14431d['filters']),_0x46bf66);if(_0x1ada47['query'][_0x65ec('0x3a')]){_0x30366c['where']=_[_0x65ec('0x3b')](_0x30366c[_0x65ec('0x38')],{'$or':_['map'](_0x46bf66,function(_0x16ef59){if(_0x16ef59[_0x65ec('0x3c')]!==_0x65ec('0x3d')){var _0x5357bf={};_0x5357bf[_0x16ef59[_0x65ec('0x27')]]={'$like':'%'+_0x1ada47[_0x65ec('0x2e')][_0x65ec('0x3a')]+'%'};return _0x5357bf;}})});}_0x30366c=_[_0x65ec('0x3b')]({},_0x30366c,_0x1ada47[_0x65ec('0x3e')]);var _0x2ce56f={'where':_0x30366c[_0x65ec('0x38')]};return db['WhatsappQueueReport'][_0x65ec('0x1c')](_0x2ce56f)['then'](function(_0x2654b2){_0x46d4c1[_0x65ec('0x1c')]=_0x2654b2;if(_0x1ada47[_0x65ec('0x2e')][_0x65ec('0x3f')]){_0x30366c[_0x65ec('0x40')]=[{'all':!![]}];}return db[_0x65ec('0x2a')]['findAll'](_0x30366c);})[_0x65ec('0x23')](function(_0x4ba7df){_0x46d4c1['rows']=_0x4ba7df;return _0x46d4c1;})[_0x65ec('0x23')](respondWithFilteredResult(_0x1d0b5c,_0x30366c))[_0x65ec('0x41')](handleError(_0x1d0b5c,null));};exports[_0x65ec('0x42')]=function(_0x143a11,_0x1d475e){var _0x524235={'raw':!![],'where':{'id':_0x143a11[_0x65ec('0x43')]['id']}},_0x4843ca={};_0x4843ca[_0x65ec('0x32')]=_[_0x65ec('0x2d')](db[_0x65ec('0x2a')][_0x65ec('0x2b')]);_0x4843ca['query']=_['keys'](_0x143a11[_0x65ec('0x2e')]);_0x4843ca[_0x65ec('0x2f')]=_[_0x65ec('0x30')](_0x4843ca[_0x65ec('0x32')],_0x4843ca[_0x65ec('0x2e')]);_0x524235[_0x65ec('0x31')]=_[_0x65ec('0x30')](_0x4843ca['model'],qs[_0x65ec('0x33')](_0x143a11[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x524235['attributes']=_0x524235[_0x65ec('0x31')][_0x65ec('0x34')]?_0x524235['attributes']:_0x4843ca[_0x65ec('0x32')];if(_0x143a11[_0x65ec('0x2e')][_0x65ec('0x3f')]){_0x524235[_0x65ec('0x40')]=[{'all':!![]}];}_0x524235=_[_0x65ec('0x3b')]({},_0x524235,_0x143a11['options']);return db[_0x65ec('0x2a')][_0x65ec('0x44')](_0x524235)[_0x65ec('0x23')](handleEntityNotFound(_0x1d475e,null))[_0x65ec('0x23')](respondWithResult(_0x1d475e,null))['catch'](handleError(_0x1d475e,null));};exports[_0x65ec('0x45')]=function(_0x509c28,_0x1ed0f9){return db[_0x65ec('0x2a')][_0x65ec('0x45')](_0x509c28['body'],{})['then'](respondWithResult(_0x1ed0f9,0xc9))[_0x65ec('0x41')](handleError(_0x1ed0f9,null));};exports[_0x65ec('0x22')]=function(_0xf5419,_0x2111af){if(_0xf5419[_0x65ec('0x46')]['id']){delete _0xf5419[_0x65ec('0x46')]['id'];}return db[_0x65ec('0x2a')][_0x65ec('0x44')]({'where':{'id':_0xf5419[_0x65ec('0x43')]['id']}})[_0x65ec('0x23')](handleEntityNotFound(_0x2111af,null))[_0x65ec('0x23')](saveUpdates(_0xf5419[_0x65ec('0x46')],null))[_0x65ec('0x23')](respondWithResult(_0x2111af,null))[_0x65ec('0x41')](handleError(_0x2111af,null));};exports[_0x65ec('0x24')]=function(_0x14eaef,_0x22c28c){return db['WhatsappQueueReport'][_0x65ec('0x44')]({'where':{'id':_0x14eaef[_0x65ec('0x43')]['id']}})['then'](handleEntityNotFound(_0x22c28c,null))[_0x65ec('0x23')](removeEntity(_0x22c28c,null))[_0x65ec('0x41')](handleError(_0x22c28c,null));};exports[_0x65ec('0x47')]=function(_0x528cfa,_0x3eee1e){return db[_0x65ec('0x2a')][_0x65ec('0x47')]()['then'](respondWithResult(_0x3eee1e,null))[_0x65ec('0x41')](handleError(_0x3eee1e,null));}; \ No newline at end of file +var _0xb62e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','show','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb62e,0x1de));var _0xeb62=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb62e[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422daf,_0xcc11c4){_0xcc11c4=_0xcc11c4||0xcc;return function(_0x27671e){if(_0x27671e){return _0x422daf[_0xeb62('0x1b')](_0xcc11c4);}return _0x422daf['status'](_0xcc11c4)[_0xeb62('0x1c')]();};}function respondWithResult(_0x2fbad2,_0x23fb15){_0x23fb15=_0x23fb15||0xc8;return function(_0x4da178){if(_0x4da178){return _0x2fbad2[_0xeb62('0x1d')](_0x23fb15)[_0xeb62('0x1e')](_0x4da178);}};}function respondWithFilteredResult(_0x2fd4c7,_0x4ce9fa){return function(_0x1f6a1f){if(_0x1f6a1f){var _0x15b3e8=typeof _0x4ce9fa[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x4ce9fa[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1fb460=_0x1f6a1f[_0xeb62('0x22')];var _0x39b138=_0x15b3e8?0x0:_0x4ce9fa[_0xeb62('0x1f')];var _0x27efc8=_0x15b3e8?_0x1f6a1f[_0xeb62('0x22')]:_0x4ce9fa[_0xeb62('0x1f')]+_0x4ce9fa['limit'];var _0x38c5e4;if(_0x27efc8>=_0x1fb460){_0x27efc8=_0x1fb460;_0x38c5e4=0xc8;}else{_0x38c5e4=0xce;}_0x2fd4c7[_0xeb62('0x1d')](_0x38c5e4);return _0x2fd4c7[_0xeb62('0x23')](_0xeb62('0x24'),_0x39b138+'-'+_0x27efc8+'/'+_0x1fb460)[_0xeb62('0x1e')](_0x1f6a1f);}return null;};}function patchUpdates(_0x24cbf3){return function(_0x2ed96d){try{jsonpatch['apply'](_0x2ed96d,_0x24cbf3,!![]);}catch(_0x599d0b){return BPromise[_0xeb62('0x25')](_0x599d0b);}return _0x2ed96d[_0xeb62('0x26')]();};}function saveUpdates(_0x11ed9c,_0x13243f){return function(_0x122b15){if(_0x122b15){return _0x122b15['update'](_0x11ed9c)['then'](function(_0x4664ce){return _0x4664ce;});}return null;};}function removeEntity(_0x132861,_0x182781){return function(_0x395b70){if(_0x395b70){return _0x395b70['destroy']()['then'](function(){_0x132861[_0xeb62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x448327,_0x4b0f46){return function(_0xfe3e16){if(!_0xfe3e16){_0x448327['sendStatus'](0x194);}return _0xfe3e16;};}function handleError(_0x3ac28c,_0x6bfbbc){_0x6bfbbc=_0x6bfbbc||0x1f4;return function(_0x46d1bb){logger['error'](_0x46d1bb[_0xeb62('0x27')]);if(_0x46d1bb[_0xeb62('0x28')]){delete _0x46d1bb[_0xeb62('0x28')];}_0x3ac28c[_0xeb62('0x1d')](_0x6bfbbc)[_0xeb62('0x29')](_0x46d1bb);};}exports[_0xeb62('0x2a')]=function(_0x511202,_0x192517){var _0x1616ee={},_0x57169a={},_0x157474={'count':0x0,'rows':[]};var _0x2b51b2=_[_0xeb62('0x2b')](db[_0xeb62('0x2c')][_0xeb62('0x2d')],function(_0x5195bf){return{'name':_0x5195bf['fieldName'],'type':_0x5195bf[_0xeb62('0x2e')][_0xeb62('0x2f')]};});_0x57169a[_0xeb62('0x30')]=_[_0xeb62('0x2b')](_0x2b51b2,_0xeb62('0x28'));_0x57169a[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x511202['query']);_0x57169a[_0xeb62('0x33')]=_['intersection'](_0x57169a['model'],_0x57169a[_0xeb62('0x31')]);_0x1616ee[_0xeb62('0x34')]=_['intersection'](_0x57169a[_0xeb62('0x30')],qs['fields'](_0x511202[_0xeb62('0x31')][_0xeb62('0x35')]));_0x1616ee['attributes']=_0x1616ee[_0xeb62('0x34')][_0xeb62('0x36')]?_0x1616ee['attributes']:_0x57169a[_0xeb62('0x30')];if(!_0x511202[_0xeb62('0x31')][_0xeb62('0x37')](_0xeb62('0x38'))){_0x1616ee['limit']=qs[_0xeb62('0x21')](_0x511202[_0xeb62('0x31')]['limit']);_0x1616ee['offset']=qs[_0xeb62('0x1f')](_0x511202[_0xeb62('0x31')]['offset']);}_0x1616ee[_0xeb62('0x39')]=qs[_0xeb62('0x3a')](_0x511202[_0xeb62('0x31')][_0xeb62('0x3a')]);_0x1616ee[_0xeb62('0x3b')]=qs[_0xeb62('0x33')](_[_0xeb62('0x3c')](_0x511202['query'],_0x57169a['filters']),_0x2b51b2);if(_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]){_0x1616ee[_0xeb62('0x3b')]=_[_0xeb62('0x3e')](_0x1616ee['where'],{'$or':_[_0xeb62('0x2b')](_0x2b51b2,function(_0x510c7d){if(_0x510c7d[_0xeb62('0x2e')]!==_0xeb62('0x3f')){var _0x2dac2f={};_0x2dac2f[_0x510c7d[_0xeb62('0x28')]]={'$like':'%'+_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]+'%'};return _0x2dac2f;}})});}_0x1616ee=_[_0xeb62('0x3e')]({},_0x1616ee,_0x511202[_0xeb62('0x40')]);var _0x5e8ef8={'where':_0x1616ee[_0xeb62('0x3b')]};return db[_0xeb62('0x2c')][_0xeb62('0x22')](_0x5e8ef8)[_0xeb62('0x41')](function(_0x5dd0e3){_0x157474['count']=_0x5dd0e3;if(_0x511202[_0xeb62('0x31')][_0xeb62('0x42')]){_0x1616ee['include']=[{'all':!![]}];}return db[_0xeb62('0x2c')][_0xeb62('0x43')](_0x1616ee);})['then'](function(_0x25e9f0){_0x157474['rows']=_0x25e9f0;return _0x157474;})[_0xeb62('0x41')](respondWithFilteredResult(_0x192517,_0x1616ee))['catch'](handleError(_0x192517,null));};exports[_0xeb62('0x44')]=function(_0x5dde1d,_0x2bf77f){var _0x609b2d={'raw':!![],'where':{'id':_0x5dde1d['params']['id']}},_0x317f50={};_0x317f50['model']=_[_0xeb62('0x32')](db[_0xeb62('0x2c')][_0xeb62('0x2d')]);_0x317f50[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x5dde1d['query']);_0x317f50[_0xeb62('0x33')]=_['intersection'](_0x317f50[_0xeb62('0x30')],_0x317f50['query']);_0x609b2d[_0xeb62('0x34')]=_['intersection'](_0x317f50[_0xeb62('0x30')],qs['fields'](_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x35')]));_0x609b2d[_0xeb62('0x34')]=_0x609b2d[_0xeb62('0x34')][_0xeb62('0x36')]?_0x609b2d[_0xeb62('0x34')]:_0x317f50['model'];if(_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x42')]){_0x609b2d['include']=[{'all':!![]}];}_0x609b2d=_['merge']({},_0x609b2d,_0x5dde1d['options']);return db['WhatsappQueueReport'][_0xeb62('0x45')](_0x609b2d)[_0xeb62('0x41')](handleEntityNotFound(_0x2bf77f,null))['then'](respondWithResult(_0x2bf77f,null))[_0xeb62('0x46')](handleError(_0x2bf77f,null));};exports[_0xeb62('0x47')]=function(_0x412e93,_0x16e262){return db[_0xeb62('0x2c')]['create'](_0x412e93[_0xeb62('0x48')],{})['then'](respondWithResult(_0x16e262,0xc9))[_0xeb62('0x46')](handleError(_0x16e262,null));};exports[_0xeb62('0x49')]=function(_0x7fb53f,_0x18c40d){if(_0x7fb53f[_0xeb62('0x48')]['id']){delete _0x7fb53f[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2c')][_0xeb62('0x45')]({'where':{'id':_0x7fb53f[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x18c40d,null))[_0xeb62('0x41')](saveUpdates(_0x7fb53f[_0xeb62('0x48')],null))['then'](respondWithResult(_0x18c40d,null))[_0xeb62('0x46')](handleError(_0x18c40d,null));};exports['destroy']=function(_0x4edd8c,_0x2dcb2d){return db[_0xeb62('0x2c')]['find']({'where':{'id':_0x4edd8c[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x2dcb2d,null))['then'](removeEntity(_0x2dcb2d,null))[_0xeb62('0x46')](handleError(_0x2dcb2d,null));};exports[_0xeb62('0x4b')]=function(_0x20b73b,_0x60617){return db[_0xeb62('0x2c')][_0xeb62('0x4b')]()[_0xeb62('0x41')](respondWithResult(_0x60617,null))[_0xeb62('0x46')](handleError(_0x60617,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 5416dc6..b9b03d3 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 _0xdcec=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0xd3ad1e,_0x2646c4){var _0x2e6c72=function(_0x34d399){while(--_0x34d399){_0xd3ad1e['push'](_0xd3ad1e['shift']());}};_0x2e6c72(++_0x2646c4);}(_0xdcec,0xfc));var _0xcdce=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0xdcec[_0x1b91c7];return _0xbbe014;};'use strict';var _=require(_0xcdce('0x0'));var util=require(_0xcdce('0x1'));var logger=require(_0xcdce('0x2'))(_0xcdce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcdce('0x4'));var fs=require('fs');var path=require(_0xcdce('0x5'));var rimraf=require(_0xcdce('0x6'));var config=require(_0xcdce('0x7'));var attributes=require(_0xcdce('0x8'));module['exports']=function(_0x75167d,_0x2dceb6){return _0x75167d['define'](_0xcdce('0x9'),attributes,{'tableName':_0xcdce('0xa'),'paranoid':![],'indexes':[{'name':_0xcdce('0xb'),'fields':[_0xcdce('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7dbc=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x1bba1a,_0xdb4f8b){var _0x4ed799=function(_0x2d523f){while(--_0x2d523f){_0x1bba1a['push'](_0x1bba1a['shift']());}};_0x4ed799(++_0xdb4f8b);}(_0x7dbc,0x1d9));var _0xc7db=function(_0x43212f,_0x554ee3){_0x43212f=_0x43212f-0x0;var _0x3a7fc1=_0x7dbc[_0x43212f];return _0x3a7fc1;};'use strict';var _=require('lodash');var util=require(_0xc7db('0x0'));var logger=require(_0xc7db('0x1'))(_0xc7db('0x2'));var moment=require(_0xc7db('0x3'));var BPromise=require(_0xc7db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc7db('0x5'));var config=require(_0xc7db('0x6'));var attributes=require(_0xc7db('0x7'));module['exports']=function(_0x4e3452,_0x5786df){return _0x4e3452[_0xc7db('0x8')](_0xc7db('0x9'),attributes,{'tableName':_0xc7db('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 5c95b50..d0ce83a 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 _0x53e8=['jayson/promise','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5f0f22,_0x4ff4e7){var _0x24b226=function(_0x5c2439){while(--_0x5c2439){_0x5f0f22['push'](_0x5f0f22['shift']());}};_0x24b226(++_0x4ff4e7);}(_0x53e8,0xb7));var _0x853e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x53e8[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x853e('0x0'));var util=require('util');var moment=require(_0x853e('0x1'));var BPromise=require(_0x853e('0x2'));var rs=require(_0x853e('0x3'));var fs=require('fs');var Redis=require(_0x853e('0x4'));var db=require(_0x853e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x853e('0x6'))(_0x853e('0x7'));var config=require(_0x853e('0x8'));var jayson=require(_0x853e('0x9'));var client=jayson['client'][_0x853e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bfe92,_0x346842,_0x342225){return new BPromise(function(_0x133dc5,_0x325731){return client[_0x853e('0xb')](_0x4bfe92,_0x342225)['then'](function(_0x2ac799){logger[_0x853e('0xc')](_0x853e('0xd'),_0x346842,'request\x20sent');logger[_0x853e('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x346842,'request\x20sent',JSON[_0x853e('0xf')](_0x2ac799));if(_0x2ac799[_0x853e('0x10')]){if(_0x2ac799[_0x853e('0x10')][_0x853e('0x11')]===0x1f4){logger[_0x853e('0x10')](_0x853e('0xd'),_0x346842,_0x2ac799[_0x853e('0x10')][_0x853e('0x12')]);return _0x325731(_0x2ac799[_0x853e('0x10')][_0x853e('0x12')]);}logger[_0x853e('0x10')](_0x853e('0xd'),_0x346842,_0x2ac799[_0x853e('0x10')][_0x853e('0x12')]);return _0x133dc5(_0x2ac799[_0x853e('0x10')][_0x853e('0x12')]);}else{logger[_0x853e('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x346842,_0x853e('0x13'));_0x133dc5(_0x2ac799['result'][_0x853e('0x12')]);}})[_0x853e('0x14')](function(_0x2ed43a){logger['error'](_0x853e('0xd'),_0x346842,_0x2ed43a);_0x325731(_0x2ed43a);});});}exports[_0x853e('0x15')]=function(_0x3bffc9){var _0x201d04=this;return new Promise(function(_0xad7174,_0x374e19){return db[_0x853e('0x16')][_0x853e('0x17')](_0x3bffc9[_0x853e('0x18')],{'raw':_0x3bffc9[_0x853e('0x19')]?_0x3bffc9[_0x853e('0x19')][_0x853e('0x1a')]===undefined?!![]:![]:!![]})[_0x853e('0x1b')](function(_0x5836a3){logger['info'](_0x853e('0x15'),_0x3bffc9);logger[_0x853e('0xe')](_0x853e('0x15'),_0x3bffc9,JSON[_0x853e('0xf')](_0x5836a3));_0xad7174(_0x5836a3);})['catch'](function(_0x11b261){logger['error'](_0x853e('0x15'),_0x11b261[_0x853e('0x12')],_0x3bffc9);_0x374e19(_0x201d04[_0x853e('0x10')](0x1f4,_0x11b261[_0x853e('0x12')]));});});};exports[_0x853e('0x1c')]=function(_0x4eb9f6){var _0x4cddc5=this;return new Promise(function(_0x59799d,_0x57bc11){return db[_0x853e('0x16')]['update'](_0x4eb9f6[_0x853e('0x18')],{'raw':_0x4eb9f6[_0x853e('0x19')]?_0x4eb9f6[_0x853e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eb9f6[_0x853e('0x19')]?_0x4eb9f6['options'][_0x853e('0x1d')]||null:null,'attributes':_0x4eb9f6[_0x853e('0x19')]?_0x4eb9f6['options'][_0x853e('0x1e')]||null:null,'limit':_0x4eb9f6[_0x853e('0x19')]?_0x4eb9f6[_0x853e('0x19')][_0x853e('0x1f')]||null:null})[_0x853e('0x1b')](function(_0x5d4ae0){logger[_0x853e('0xc')]('UpdateWhatsappQueueReport',_0x4eb9f6);logger[_0x853e('0xe')]('UpdateWhatsappQueueReport',_0x4eb9f6,JSON['stringify'](_0x5d4ae0));_0x59799d(_0x5d4ae0);})[_0x853e('0x14')](function(_0x52f230){logger[_0x853e('0x10')]('UpdateWhatsappQueueReport',_0x52f230[_0x853e('0x12')],_0x4eb9f6);_0x57bc11(_0x4cddc5[_0x853e('0x10')](0x1f4,_0x52f230['message']));});});}; \ No newline at end of file +var _0xcf24=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateWhatsappQueueReport','create','body','options','raw','then','catch','WhatsappQueueReport','where','attributes','UpdateWhatsappQueueReport','lodash','util','moment'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xcf24,0x189));var _0x4cf2=function(_0x2ae13d,_0x65c7a8){_0x2ae13d=_0x2ae13d-0x0;var _0x33bf5e=_0xcf24[_0x2ae13d];return _0x33bf5e;};'use strict';var _=require(_0x4cf2('0x0'));var util=require(_0x4cf2('0x1'));var moment=require(_0x4cf2('0x2'));var BPromise=require(_0x4cf2('0x3'));var rs=require(_0x4cf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4cf2('0x5'))['db'];var utils=require(_0x4cf2('0x6'));var logger=require('../../config/logger')(_0x4cf2('0x7'));var config=require(_0x4cf2('0x8'));var jayson=require(_0x4cf2('0x9'));var client=jayson[_0x4cf2('0xa')][_0x4cf2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a1c6d,_0x3d13b4,_0x504f13){return new BPromise(function(_0x21f778,_0x15a9a0){return client[_0x4cf2('0xc')](_0x1a1c6d,_0x504f13)['then'](function(_0x4b8300){logger[_0x4cf2('0xd')](_0x4cf2('0xe'),_0x3d13b4,_0x4cf2('0xf'));logger[_0x4cf2('0x10')](_0x4cf2('0x11'),_0x3d13b4,'request\x20sent',JSON[_0x4cf2('0x12')](_0x4b8300));if(_0x4b8300[_0x4cf2('0x13')]){if(_0x4b8300[_0x4cf2('0x13')][_0x4cf2('0x14')]===0x1f4){logger[_0x4cf2('0x13')](_0x4cf2('0xe'),_0x3d13b4,_0x4b8300[_0x4cf2('0x13')][_0x4cf2('0x15')]);return _0x15a9a0(_0x4b8300['error'][_0x4cf2('0x15')]);}logger[_0x4cf2('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3d13b4,_0x4b8300['error'][_0x4cf2('0x15')]);return _0x21f778(_0x4b8300[_0x4cf2('0x13')][_0x4cf2('0x15')]);}else{logger['info'](_0x4cf2('0xe'),_0x3d13b4,'request\x20sent');_0x21f778(_0x4b8300['result'][_0x4cf2('0x15')]);}})['catch'](function(_0x352d82){logger[_0x4cf2('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3d13b4,_0x352d82);_0x15a9a0(_0x352d82);});});}exports[_0x4cf2('0x16')]=function(_0x555e62){var _0x285526=this;return new Promise(function(_0x5b9341,_0x32f1b1){return db['WhatsappQueueReport'][_0x4cf2('0x17')](_0x555e62[_0x4cf2('0x18')],{'raw':_0x555e62[_0x4cf2('0x19')]?_0x555e62['options'][_0x4cf2('0x1a')]===undefined?!![]:![]:!![]})[_0x4cf2('0x1b')](function(_0x2d8e25){logger[_0x4cf2('0xd')](_0x4cf2('0x16'),_0x555e62);logger[_0x4cf2('0x10')](_0x4cf2('0x16'),_0x555e62,JSON[_0x4cf2('0x12')](_0x2d8e25));_0x5b9341(_0x2d8e25);})[_0x4cf2('0x1c')](function(_0x431392){logger[_0x4cf2('0x13')](_0x4cf2('0x16'),_0x431392[_0x4cf2('0x15')],_0x555e62);_0x32f1b1(_0x285526['error'](0x1f4,_0x431392[_0x4cf2('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x361775){var _0x5edfad=this;return new Promise(function(_0x11a7b2,_0x28280b){return db[_0x4cf2('0x1d')]['update'](_0x361775[_0x4cf2('0x18')],{'raw':_0x361775[_0x4cf2('0x19')]?_0x361775[_0x4cf2('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x361775[_0x4cf2('0x19')]?_0x361775['options'][_0x4cf2('0x1e')]||null:null,'attributes':_0x361775['options']?_0x361775[_0x4cf2('0x19')][_0x4cf2('0x1f')]||null:null,'limit':_0x361775[_0x4cf2('0x19')]?_0x361775[_0x4cf2('0x19')]['limit']||null:null})[_0x4cf2('0x1b')](function(_0x5bf9c9){logger[_0x4cf2('0xd')](_0x4cf2('0x20'),_0x361775);logger[_0x4cf2('0x10')](_0x4cf2('0x20'),_0x361775,JSON[_0x4cf2('0x12')](_0x5bf9c9));_0x11a7b2(_0x5bf9c9);})['catch'](function(_0x1425a0){logger[_0x4cf2('0x13')]('UpdateWhatsappQueueReport',_0x1425a0[_0x4cf2('0x15')],_0x361775);_0x28280b(_0x5edfad[_0x4cf2('0x13')](0x1f4,_0x1425a0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 37825cb..9c96387 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 _0xa15b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa15b,0xae));var _0xba15=function(_0x42136b,_0x283400){_0x42136b=_0x42136b-0x0;var _0x59b41f=_0xa15b[_0x42136b];return _0x59b41f;};'use strict';var multer=require('multer');var util=require(_0xba15('0x0'));var path=require(_0xba15('0x1'));var timeout=require(_0xba15('0x2'));var express=require(_0xba15('0x3'));var router=express[_0xba15('0x4')]();var fs_extra=require(_0xba15('0x5'));var auth=require(_0xba15('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xba15('0x7'));var controller=require(_0xba15('0x8'));router[_0xba15('0x9')]('/',auth[_0xba15('0xa')](),controller['index']);router[_0xba15('0x9')](_0xba15('0xb'),auth[_0xba15('0xa')](),controller[_0xba15('0xc')]);router['get']('/:id',auth[_0xba15('0xa')](),controller[_0xba15('0xd')]);router[_0xba15('0xe')]('/',auth[_0xba15('0xa')](),controller[_0xba15('0xf')]);router[_0xba15('0x10')](_0xba15('0x11'),auth[_0xba15('0xa')](),controller[_0xba15('0x12')]);router[_0xba15('0x13')]('/:id',auth[_0xba15('0xa')](),controller[_0xba15('0x14')]);module[_0xba15('0x15')]=router; \ No newline at end of file +var _0xb0c8=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4783e9,_0x2c38aa){var _0x1d8fd6=function(_0x16b2ab){while(--_0x16b2ab){_0x4783e9['push'](_0x4783e9['shift']());}};_0x1d8fd6(++_0x2c38aa);}(_0xb0c8,0x14c));var _0x8b0c=function(_0x2dacd3,_0x1fcde1){_0x2dacd3=_0x2dacd3-0x0;var _0x96b9ad=_0xb0c8[_0x2dacd3];return _0x96b9ad;};'use strict';var multer=require(_0x8b0c('0x0'));var util=require(_0x8b0c('0x1'));var path=require(_0x8b0c('0x2'));var timeout=require(_0x8b0c('0x3'));var express=require(_0x8b0c('0x4'));var router=express['Router']();var fs_extra=require(_0x8b0c('0x5'));var auth=require(_0x8b0c('0x6'));var interaction=require(_0x8b0c('0x7'));var config=require(_0x8b0c('0x8'));var controller=require(_0x8b0c('0x9'));router[_0x8b0c('0xa')]('/',auth[_0x8b0c('0xb')](),controller[_0x8b0c('0xc')]);router[_0x8b0c('0xa')](_0x8b0c('0xd'),auth[_0x8b0c('0xb')](),controller[_0x8b0c('0xe')]);router['get'](_0x8b0c('0xf'),auth[_0x8b0c('0xb')](),controller[_0x8b0c('0x10')]);router[_0x8b0c('0x11')]('/',auth[_0x8b0c('0xb')](),controller[_0x8b0c('0x12')]);router[_0x8b0c('0x13')]('/:id',auth[_0x8b0c('0xb')](),controller[_0x8b0c('0x14')]);router[_0x8b0c('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8b0c('0x16')]);module[_0x8b0c('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5d6ee78..3f2fa8f 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 _0x9a86=['agent','queue','DATE','sequelize','exports','ENUM','account'];(function(_0x5d83e4,_0x220d07){var _0x29faae=function(_0x1721e6){while(--_0x1721e6){_0x5d83e4['push'](_0x5d83e4['shift']());}};_0x29faae(++_0x220d07);}(_0x9a86,0x1ed));var _0x69a8=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0x9a86[_0x36fbef];return _0x45e270;};'use strict';var Sequelize=require(_0x69a8('0x0'));module[_0x69a8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x69a8('0x2')](_0x69a8('0x3'),_0x69a8('0x4'),_0x69a8('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x69a8('0x6')]}}; \ No newline at end of file +var _0x85cf=['STRING','ENUM','account','agent','queue','DATE','exports'];(function(_0x2b7669,_0xbe4013){var _0x3b42b3=function(_0x19967e){while(--_0x19967e){_0x2b7669['push'](_0x2b7669['shift']());}};_0x3b42b3(++_0xbe4013);}(_0x85cf,0x76));var _0xf85c=function(_0x345cb6,_0xeae5b1){_0x345cb6=_0x345cb6-0x0;var _0xcf2853=_0x85cf[_0x345cb6];return _0xcf2853;};'use strict';var Sequelize=require('sequelize');module[_0xf85c('0x0')]={'uniqueid':{'type':Sequelize[_0xf85c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf85c('0x2')](_0xf85c('0x3'),_0xf85c('0x4'),_0xf85c('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf85c('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 9c017c1..d50c641 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 _0xfc31=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','WhatsappTransferReport','includeAll','include','findAll','rows','show','params','intersection','create','body','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2574ba,_0x21aeba){var _0x224c6d=function(_0x11a534){while(--_0x11a534){_0x2574ba['push'](_0x2574ba['shift']());}};_0x224c6d(++_0x21aeba);}(_0xfc31,0x121));var _0x1fc3=function(_0x1365bf,_0x3e2106){_0x1365bf=_0x1365bf-0x0;var _0x413881=_0xfc31[_0x1365bf];return _0x413881;};'use strict';var emlformat=require(_0x1fc3('0x0'));var rimraf=require(_0x1fc3('0x1'));var zipdir=require(_0x1fc3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fc3('0x3'));var moment=require('moment');var BPromise=require(_0x1fc3('0x4'));var Mustache=require('mustache');var util=require(_0x1fc3('0x5'));var path=require('path');var sox=require(_0x1fc3('0x6'));var csv=require(_0x1fc3('0x7'));var ejs=require(_0x1fc3('0x8'));var fs=require('fs');var fs_extra=require(_0x1fc3('0x9'));var _=require(_0x1fc3('0xa'));var squel=require(_0x1fc3('0xb'));var crypto=require(_0x1fc3('0xc'));var jsforce=require(_0x1fc3('0xd'));var deskjs=require(_0x1fc3('0xe'));var toCsv=require(_0x1fc3('0x7'));var querystring=require(_0x1fc3('0xf'));var Papa=require(_0x1fc3('0x10'));var Redis=require(_0x1fc3('0x11'));var authService=require(_0x1fc3('0x12'));var qs=require(_0x1fc3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fc3('0x14'));var logger=require(_0x1fc3('0x15'))(_0x1fc3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1fc3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc62b43,_0x3c92d9){_0x3c92d9=_0x3c92d9||0xcc;return function(_0x3571ba){if(_0x3571ba){return _0xc62b43[_0x1fc3('0x18')](_0x3c92d9);}return _0xc62b43['status'](_0x3c92d9)['end']();};}function respondWithResult(_0x4aaf6d,_0x5d4d51){_0x5d4d51=_0x5d4d51||0xc8;return function(_0x46f04d){if(_0x46f04d){return _0x4aaf6d[_0x1fc3('0x19')](_0x5d4d51)[_0x1fc3('0x1a')](_0x46f04d);}};}function respondWithFilteredResult(_0x26349e,_0x95f1c0){return function(_0x51fc07){if(_0x51fc07){var _0x180650=typeof _0x95f1c0[_0x1fc3('0x1b')]===_0x1fc3('0x1c')&&typeof _0x95f1c0['limit']===_0x1fc3('0x1c');var _0x510058=_0x51fc07[_0x1fc3('0x1d')];var _0x27aaec=_0x180650?0x0:_0x95f1c0[_0x1fc3('0x1b')];var _0x79a674=_0x180650?_0x51fc07[_0x1fc3('0x1d')]:_0x95f1c0[_0x1fc3('0x1b')]+_0x95f1c0[_0x1fc3('0x1e')];var _0x3a426d;if(_0x79a674>=_0x510058){_0x79a674=_0x510058;_0x3a426d=0xc8;}else{_0x3a426d=0xce;}_0x26349e['status'](_0x3a426d);return _0x26349e[_0x1fc3('0x1f')](_0x1fc3('0x20'),_0x27aaec+'-'+_0x79a674+'/'+_0x510058)[_0x1fc3('0x1a')](_0x51fc07);}return null;};}function patchUpdates(_0x4107a4){return function(_0x523a22){try{jsonpatch[_0x1fc3('0x21')](_0x523a22,_0x4107a4,!![]);}catch(_0x53cad9){return BPromise[_0x1fc3('0x22')](_0x53cad9);}return _0x523a22[_0x1fc3('0x23')]();};}function saveUpdates(_0x3aa38d,_0x4b4608){return function(_0x208895){if(_0x208895){return _0x208895[_0x1fc3('0x24')](_0x3aa38d)['then'](function(_0x4b9c08){return _0x4b9c08;});}return null;};}function removeEntity(_0x5ae6e9,_0x46d5cb){return function(_0x25cf54){if(_0x25cf54){return _0x25cf54[_0x1fc3('0x25')]()[_0x1fc3('0x26')](function(){_0x5ae6e9[_0x1fc3('0x19')](0xcc)[_0x1fc3('0x27')]();});}};}function handleEntityNotFound(_0x1d1eb9,_0x4ef83e){return function(_0x591b7f){if(!_0x591b7f){_0x1d1eb9[_0x1fc3('0x18')](0x194);}return _0x591b7f;};}function handleError(_0x4cb69d,_0x5c4334){_0x5c4334=_0x5c4334||0x1f4;return function(_0x266aa7){logger[_0x1fc3('0x28')](_0x266aa7[_0x1fc3('0x29')]);if(_0x266aa7[_0x1fc3('0x2a')]){delete _0x266aa7[_0x1fc3('0x2a')];}_0x4cb69d[_0x1fc3('0x19')](_0x5c4334)[_0x1fc3('0x2b')](_0x266aa7);};}exports[_0x1fc3('0x2c')]=function(_0xb6d0bf,_0x1eaf3a){var _0x283788={},_0x31a7c9={},_0x4121df={'count':0x0,'rows':[]};var _0x448b65=_[_0x1fc3('0x2d')](db['WhatsappTransferReport'][_0x1fc3('0x2e')],function(_0x475430){return{'name':_0x475430[_0x1fc3('0x2f')],'type':_0x475430['type'][_0x1fc3('0x30')]};});_0x31a7c9['model']=_['map'](_0x448b65,'name');_0x31a7c9[_0x1fc3('0x31')]=_[_0x1fc3('0x32')](_0xb6d0bf[_0x1fc3('0x31')]);_0x31a7c9[_0x1fc3('0x33')]=_['intersection'](_0x31a7c9[_0x1fc3('0x34')],_0x31a7c9[_0x1fc3('0x31')]);_0x283788[_0x1fc3('0x35')]=_['intersection'](_0x31a7c9[_0x1fc3('0x34')],qs[_0x1fc3('0x36')](_0xb6d0bf[_0x1fc3('0x31')][_0x1fc3('0x36')]));_0x283788[_0x1fc3('0x35')]=_0x283788[_0x1fc3('0x35')][_0x1fc3('0x37')]?_0x283788['attributes']:_0x31a7c9[_0x1fc3('0x34')];if(!_0xb6d0bf[_0x1fc3('0x31')][_0x1fc3('0x38')](_0x1fc3('0x39'))){_0x283788['limit']=qs[_0x1fc3('0x1e')](_0xb6d0bf[_0x1fc3('0x31')]['limit']);_0x283788['offset']=qs[_0x1fc3('0x1b')](_0xb6d0bf['query'][_0x1fc3('0x1b')]);}_0x283788[_0x1fc3('0x3a')]=qs[_0x1fc3('0x3b')](_0xb6d0bf[_0x1fc3('0x31')][_0x1fc3('0x3b')]);_0x283788['where']=qs['filters'](_['pick'](_0xb6d0bf[_0x1fc3('0x31')],_0x31a7c9['filters']),_0x448b65);if(_0xb6d0bf['query'][_0x1fc3('0x3c')]){_0x283788[_0x1fc3('0x3d')]=_[_0x1fc3('0x3e')](_0x283788['where'],{'$or':_[_0x1fc3('0x2d')](_0x448b65,function(_0x23b798){if(_0x23b798[_0x1fc3('0x3f')]!==_0x1fc3('0x40')){var _0x43b704={};_0x43b704[_0x23b798['name']]={'$like':'%'+_0xb6d0bf['query'][_0x1fc3('0x3c')]+'%'};return _0x43b704;}})});}_0x283788=_[_0x1fc3('0x3e')]({},_0x283788,_0xb6d0bf[_0x1fc3('0x41')]);var _0x39c127={'where':_0x283788[_0x1fc3('0x3d')]};return db[_0x1fc3('0x42')][_0x1fc3('0x1d')](_0x39c127)['then'](function(_0x3f180d){_0x4121df[_0x1fc3('0x1d')]=_0x3f180d;if(_0xb6d0bf['query'][_0x1fc3('0x43')]){_0x283788[_0x1fc3('0x44')]=[{'all':!![]}];}return db[_0x1fc3('0x42')][_0x1fc3('0x45')](_0x283788);})['then'](function(_0x53d04b){_0x4121df[_0x1fc3('0x46')]=_0x53d04b;return _0x4121df;})[_0x1fc3('0x26')](respondWithFilteredResult(_0x1eaf3a,_0x283788))['catch'](handleError(_0x1eaf3a,null));};exports[_0x1fc3('0x47')]=function(_0x41edee,_0xf71435){var _0xa778c4={'raw':!![],'where':{'id':_0x41edee[_0x1fc3('0x48')]['id']}},_0x3c997b={};_0x3c997b[_0x1fc3('0x34')]=_['keys'](db['WhatsappTransferReport'][_0x1fc3('0x2e')]);_0x3c997b[_0x1fc3('0x31')]=_[_0x1fc3('0x32')](_0x41edee[_0x1fc3('0x31')]);_0x3c997b[_0x1fc3('0x33')]=_[_0x1fc3('0x49')](_0x3c997b['model'],_0x3c997b[_0x1fc3('0x31')]);_0xa778c4['attributes']=_[_0x1fc3('0x49')](_0x3c997b[_0x1fc3('0x34')],qs['fields'](_0x41edee['query'][_0x1fc3('0x36')]));_0xa778c4[_0x1fc3('0x35')]=_0xa778c4[_0x1fc3('0x35')][_0x1fc3('0x37')]?_0xa778c4[_0x1fc3('0x35')]:_0x3c997b[_0x1fc3('0x34')];if(_0x41edee[_0x1fc3('0x31')][_0x1fc3('0x43')]){_0xa778c4[_0x1fc3('0x44')]=[{'all':!![]}];}_0xa778c4=_[_0x1fc3('0x3e')]({},_0xa778c4,_0x41edee[_0x1fc3('0x41')]);return db[_0x1fc3('0x42')]['find'](_0xa778c4)['then'](handleEntityNotFound(_0xf71435,null))['then'](respondWithResult(_0xf71435,null))['catch'](handleError(_0xf71435,null));};exports['create']=function(_0x180d45,_0x590691){return db[_0x1fc3('0x42')][_0x1fc3('0x4a')](_0x180d45[_0x1fc3('0x4b')],{})['then'](respondWithResult(_0x590691,0xc9))[_0x1fc3('0x4c')](handleError(_0x590691,null));};exports[_0x1fc3('0x24')]=function(_0x5b8dd7,_0x59c615){if(_0x5b8dd7[_0x1fc3('0x4b')]['id']){delete _0x5b8dd7[_0x1fc3('0x4b')]['id'];}return db[_0x1fc3('0x42')]['find']({'where':{'id':_0x5b8dd7[_0x1fc3('0x48')]['id']}})[_0x1fc3('0x26')](handleEntityNotFound(_0x59c615,null))[_0x1fc3('0x26')](saveUpdates(_0x5b8dd7[_0x1fc3('0x4b')],null))['then'](respondWithResult(_0x59c615,null))[_0x1fc3('0x4c')](handleError(_0x59c615,null));};exports[_0x1fc3('0x25')]=function(_0x3255f8,_0x284e9d){return db[_0x1fc3('0x42')]['find']({'where':{'id':_0x3255f8[_0x1fc3('0x48')]['id']}})[_0x1fc3('0x26')](handleEntityNotFound(_0x284e9d,null))['then'](removeEntity(_0x284e9d,null))[_0x1fc3('0x4c')](handleError(_0x284e9d,null));};exports['describe']=function(_0x9baac1,_0x506c55){return db['WhatsappTransferReport']['describe']()[_0x1fc3('0x26')](respondWithResult(_0x506c55,null))['catch'](handleError(_0x506c55,null));}; \ No newline at end of file +var _0x9782=['fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','rows','catch','params','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','destroy','then','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport'];(function(_0x518b99,_0x4333e4){var _0x45faed=function(_0x48efa3){while(--_0x48efa3){_0x518b99['push'](_0x518b99['shift']());}};_0x45faed(++_0x4333e4);}(_0x9782,0xf6));var _0x2978=function(_0x578d84,_0x352aef){_0x578d84=_0x578d84-0x0;var _0x2c0cea=_0x9782[_0x578d84];return _0x2c0cea;};'use strict';var emlformat=require(_0x2978('0x0'));var rimraf=require(_0x2978('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2978('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2978('0x3'));var Mustache=require(_0x2978('0x4'));var util=require(_0x2978('0x5'));var path=require(_0x2978('0x6'));var sox=require(_0x2978('0x7'));var csv=require(_0x2978('0x8'));var ejs=require(_0x2978('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2978('0xa'));var squel=require('squel');var crypto=require(_0x2978('0xb'));var jsforce=require(_0x2978('0xc'));var deskjs=require(_0x2978('0xd'));var toCsv=require(_0x2978('0x8'));var querystring=require(_0x2978('0xe'));var Papa=require(_0x2978('0xf'));var Redis=require(_0x2978('0x10'));var authService=require(_0x2978('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2978('0x12'));var hardwareService=require(_0x2978('0x13'));var logger=require(_0x2978('0x14'))(_0x2978('0x15'));var utils=require(_0x2978('0x16'));var config=require(_0x2978('0x17'));var licenseUtil=require(_0x2978('0x18'));var db=require(_0x2978('0x19'))['db'];function respondWithStatusCode(_0x4bec06,_0x4944b8){_0x4944b8=_0x4944b8||0xcc;return function(_0x5315f5){if(_0x5315f5){return _0x4bec06['sendStatus'](_0x4944b8);}return _0x4bec06['status'](_0x4944b8)[_0x2978('0x1a')]();};}function respondWithResult(_0x648ed0,_0x213cf0){_0x213cf0=_0x213cf0||0xc8;return function(_0x1a6397){if(_0x1a6397){return _0x648ed0[_0x2978('0x1b')](_0x213cf0)[_0x2978('0x1c')](_0x1a6397);}};}function respondWithFilteredResult(_0x2aea84,_0x1ef1c3){return function(_0x1b7e53){if(_0x1b7e53){var _0x5a3947=typeof _0x1ef1c3[_0x2978('0x1d')]===_0x2978('0x1e')&&typeof _0x1ef1c3[_0x2978('0x1f')]==='undefined';var _0x3db1c6=_0x1b7e53[_0x2978('0x20')];var _0x4346be=_0x5a3947?0x0:_0x1ef1c3[_0x2978('0x1d')];var _0x32403c=_0x5a3947?_0x1b7e53['count']:_0x1ef1c3[_0x2978('0x1d')]+_0x1ef1c3[_0x2978('0x1f')];var _0x20be5c;if(_0x32403c>=_0x3db1c6){_0x32403c=_0x3db1c6;_0x20be5c=0xc8;}else{_0x20be5c=0xce;}_0x2aea84[_0x2978('0x1b')](_0x20be5c);return _0x2aea84[_0x2978('0x21')](_0x2978('0x22'),_0x4346be+'-'+_0x32403c+'/'+_0x3db1c6)['json'](_0x1b7e53);}return null;};}function patchUpdates(_0x22f53a){return function(_0x3691f0){try{jsonpatch['apply'](_0x3691f0,_0x22f53a,!![]);}catch(_0x16f59c){return BPromise['reject'](_0x16f59c);}return _0x3691f0[_0x2978('0x23')]();};}function saveUpdates(_0x5b7f3c,_0x362fd3){return function(_0x4d9ac7){if(_0x4d9ac7){return _0x4d9ac7['update'](_0x5b7f3c)['then'](function(_0x518199){return _0x518199;});}return null;};}function removeEntity(_0xa02362,_0x5286b4){return function(_0x8b6090){if(_0x8b6090){return _0x8b6090[_0x2978('0x24')]()[_0x2978('0x25')](function(){_0xa02362[_0x2978('0x1b')](0xcc)[_0x2978('0x1a')]();});}};}function handleEntityNotFound(_0x3faaad,_0x2ecf8d){return function(_0x3b49ea){if(!_0x3b49ea){_0x3faaad[_0x2978('0x26')](0x194);}return _0x3b49ea;};}function handleError(_0x4995fb,_0x37cb52){_0x37cb52=_0x37cb52||0x1f4;return function(_0x53947b){logger[_0x2978('0x27')](_0x53947b[_0x2978('0x28')]);if(_0x53947b[_0x2978('0x29')]){delete _0x53947b[_0x2978('0x29')];}_0x4995fb[_0x2978('0x1b')](_0x37cb52)[_0x2978('0x2a')](_0x53947b);};}exports[_0x2978('0x2b')]=function(_0x1e2d06,_0x9d3489){var _0x31e276={},_0x500958={},_0xcf78a0={'count':0x0,'rows':[]};var _0x467a71=_[_0x2978('0x2c')](db[_0x2978('0x2d')]['rawAttributes'],function(_0xe728a0){return{'name':_0xe728a0[_0x2978('0x2e')],'type':_0xe728a0['type'][_0x2978('0x2f')]};});_0x500958[_0x2978('0x30')]=_[_0x2978('0x2c')](_0x467a71,_0x2978('0x29'));_0x500958[_0x2978('0x31')]=_[_0x2978('0x32')](_0x1e2d06[_0x2978('0x31')]);_0x500958[_0x2978('0x33')]=_[_0x2978('0x34')](_0x500958[_0x2978('0x30')],_0x500958[_0x2978('0x31')]);_0x31e276['attributes']=_['intersection'](_0x500958['model'],qs[_0x2978('0x35')](_0x1e2d06[_0x2978('0x31')]['fields']));_0x31e276[_0x2978('0x36')]=_0x31e276[_0x2978('0x36')][_0x2978('0x37')]?_0x31e276[_0x2978('0x36')]:_0x500958['model'];if(!_0x1e2d06[_0x2978('0x31')][_0x2978('0x38')](_0x2978('0x39'))){_0x31e276[_0x2978('0x1f')]=qs['limit'](_0x1e2d06[_0x2978('0x31')][_0x2978('0x1f')]);_0x31e276[_0x2978('0x1d')]=qs['offset'](_0x1e2d06[_0x2978('0x31')]['offset']);}_0x31e276['order']=qs[_0x2978('0x3a')](_0x1e2d06['query'][_0x2978('0x3a')]);_0x31e276[_0x2978('0x3b')]=qs[_0x2978('0x33')](_[_0x2978('0x3c')](_0x1e2d06[_0x2978('0x31')],_0x500958['filters']),_0x467a71);if(_0x1e2d06[_0x2978('0x31')][_0x2978('0x3d')]){_0x31e276['where']=_[_0x2978('0x3e')](_0x31e276[_0x2978('0x3b')],{'$or':_[_0x2978('0x2c')](_0x467a71,function(_0xca42ed){if(_0xca42ed[_0x2978('0x3f')]!=='VIRTUAL'){var _0x5093ee={};_0x5093ee[_0xca42ed[_0x2978('0x29')]]={'$like':'%'+_0x1e2d06['query'][_0x2978('0x3d')]+'%'};return _0x5093ee;}})});}_0x31e276=_[_0x2978('0x3e')]({},_0x31e276,_0x1e2d06['options']);var _0x5438c8={'where':_0x31e276[_0x2978('0x3b')]};return db[_0x2978('0x2d')]['count'](_0x5438c8)[_0x2978('0x25')](function(_0x566b14){_0xcf78a0[_0x2978('0x20')]=_0x566b14;if(_0x1e2d06['query'][_0x2978('0x40')]){_0x31e276['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x31e276);})[_0x2978('0x25')](function(_0x46c4f3){_0xcf78a0[_0x2978('0x41')]=_0x46c4f3;return _0xcf78a0;})[_0x2978('0x25')](respondWithFilteredResult(_0x9d3489,_0x31e276))[_0x2978('0x42')](handleError(_0x9d3489,null));};exports['show']=function(_0x22f97c,_0x16f7f4){var _0x3f530a={'raw':!![],'where':{'id':_0x22f97c[_0x2978('0x43')]['id']}},_0x2461fd={};_0x2461fd['model']=_[_0x2978('0x32')](db[_0x2978('0x2d')]['rawAttributes']);_0x2461fd['query']=_['keys'](_0x22f97c[_0x2978('0x31')]);_0x2461fd['filters']=_[_0x2978('0x34')](_0x2461fd['model'],_0x2461fd[_0x2978('0x31')]);_0x3f530a['attributes']=_[_0x2978('0x34')](_0x2461fd[_0x2978('0x30')],qs['fields'](_0x22f97c[_0x2978('0x31')][_0x2978('0x35')]));_0x3f530a[_0x2978('0x36')]=_0x3f530a[_0x2978('0x36')]['length']?_0x3f530a['attributes']:_0x2461fd[_0x2978('0x30')];if(_0x22f97c[_0x2978('0x31')]['includeAll']){_0x3f530a['include']=[{'all':!![]}];}_0x3f530a=_[_0x2978('0x3e')]({},_0x3f530a,_0x22f97c[_0x2978('0x44')]);return db[_0x2978('0x2d')][_0x2978('0x45')](_0x3f530a)[_0x2978('0x25')](handleEntityNotFound(_0x16f7f4,null))[_0x2978('0x25')](respondWithResult(_0x16f7f4,null))[_0x2978('0x42')](handleError(_0x16f7f4,null));};exports[_0x2978('0x46')]=function(_0x2bdfb5,_0x4e8e22){return db[_0x2978('0x2d')][_0x2978('0x46')](_0x2bdfb5[_0x2978('0x47')],{})[_0x2978('0x25')](respondWithResult(_0x4e8e22,0xc9))[_0x2978('0x42')](handleError(_0x4e8e22,null));};exports['update']=function(_0x12535f,_0x3e717d){if(_0x12535f[_0x2978('0x47')]['id']){delete _0x12535f[_0x2978('0x47')]['id'];}return db['WhatsappTransferReport'][_0x2978('0x45')]({'where':{'id':_0x12535f[_0x2978('0x43')]['id']}})[_0x2978('0x25')](handleEntityNotFound(_0x3e717d,null))[_0x2978('0x25')](saveUpdates(_0x12535f['body'],null))[_0x2978('0x25')](respondWithResult(_0x3e717d,null))[_0x2978('0x42')](handleError(_0x3e717d,null));};exports[_0x2978('0x24')]=function(_0x4c190e,_0x29ec68){return db['WhatsappTransferReport'][_0x2978('0x45')]({'where':{'id':_0x4c190e[_0x2978('0x43')]['id']}})[_0x2978('0x25')](handleEntityNotFound(_0x29ec68,null))[_0x2978('0x25')](removeEntity(_0x29ec68,null))['catch'](handleError(_0x29ec68,null));};exports[_0x2978('0x48')]=function(_0x12f56d,_0x3bc4cd){return db[_0x2978('0x2d')][_0x2978('0x48')]()[_0x2978('0x25')](respondWithResult(_0x3bc4cd,null))[_0x2978('0x42')](handleError(_0x3bc4cd,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index b3a31ea..b03cfc6 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 _0x1b64=['uniqueid','lodash','util','api','moment','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x22ec1,_0xf71119){var _0x33a9e2=function(_0x44e100){while(--_0x44e100){_0x22ec1['push'](_0x22ec1['shift']());}};_0x33a9e2(++_0xf71119);}(_0x1b64,0x187));var _0x41b6=function(_0x45a89d,_0x1992d4){_0x45a89d=_0x45a89d-0x0;var _0x3fd181=_0x1b64[_0x45a89d];return _0x3fd181;};'use strict';var _=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var logger=require('../../config/logger')(_0x41b6('0x2'));var moment=require(_0x41b6('0x3'));var BPromise=require('bluebird');var rp=require(_0x41b6('0x4'));var fs=require('fs');var path=require(_0x41b6('0x5'));var rimraf=require('rimraf');var config=require(_0x41b6('0x6'));var attributes=require(_0x41b6('0x7'));module[_0x41b6('0x8')]=function(_0xc5f032,_0x279176){return _0xc5f032[_0x41b6('0x9')](_0x41b6('0xa'),attributes,{'tableName':_0x41b6('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x41b6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdbdf=['report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x155a36,_0x4bf39){var _0x3c99d0=function(_0x2ff601){while(--_0x2ff601){_0x155a36['push'](_0x155a36['shift']());}};_0x3c99d0(++_0x4bf39);}(_0xdbdf,0x122));var _0xfdbd=function(_0x566429,_0x1892bc){_0x566429=_0x566429-0x0;var _0xc2915f=_0xdbdf[_0x566429];return _0xc2915f;};'use strict';var _=require(_0xfdbd('0x0'));var util=require('util');var logger=require(_0xfdbd('0x1'))(_0xfdbd('0x2'));var moment=require(_0xfdbd('0x3'));var BPromise=require(_0xfdbd('0x4'));var rp=require(_0xfdbd('0x5'));var fs=require('fs');var path=require(_0xfdbd('0x6'));var rimraf=require('rimraf');var config=require(_0xfdbd('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0xfdbd('0x8')]=function(_0x4cafc9,_0x23b654){return _0x4cafc9[_0xfdbd('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0xfdbd('0xa'),'paranoid':![],'indexes':[{'name':_0xfdbd('0xb'),'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 1f2c2b4..53d7ff0 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 _0xfd9c=['../../config/logger','../../config/environment','jayson/promise','client','http','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0xfd9c,0x18a));var _0xcfd9=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xfd9c[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xcfd9('0x0'));var util=require(_0xcfd9('0x1'));var moment=require('moment');var BPromise=require(_0xcfd9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfd9('0x3'))['db'];var utils=require(_0xcfd9('0x4'));var logger=require(_0xcfd9('0x5'))('rpc');var config=require(_0xcfd9('0x6'));var jayson=require(_0xcfd9('0x7'));var client=jayson[_0xcfd9('0x8')][_0xcfd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5719e2,_0x1923dd,_0x216f15){return new BPromise(function(_0x5274fe,_0x1ee16e){return client['request'](_0x5719e2,_0x216f15)['then'](function(_0x1c9ce6){logger['info'](_0xcfd9('0xa'),_0x1923dd,_0xcfd9('0xb'));logger[_0xcfd9('0xc')](_0xcfd9('0xd'),_0x1923dd,_0xcfd9('0xb'),JSON[_0xcfd9('0xe')](_0x1c9ce6));if(_0x1c9ce6[_0xcfd9('0xf')]){if(_0x1c9ce6['error'][_0xcfd9('0x10')]===0x1f4){logger[_0xcfd9('0xf')](_0xcfd9('0xa'),_0x1923dd,_0x1c9ce6[_0xcfd9('0xf')][_0xcfd9('0x11')]);return _0x1ee16e(_0x1c9ce6[_0xcfd9('0xf')][_0xcfd9('0x11')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x1923dd,_0x1c9ce6['error'][_0xcfd9('0x11')]);return _0x5274fe(_0x1c9ce6[_0xcfd9('0xf')][_0xcfd9('0x11')]);}else{logger[_0xcfd9('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1923dd,'request\x20sent');_0x5274fe(_0x1c9ce6[_0xcfd9('0x13')][_0xcfd9('0x11')]);}})[_0xcfd9('0x14')](function(_0x2465fe){logger[_0xcfd9('0xf')](_0xcfd9('0xa'),_0x1923dd,_0x2465fe);_0x1ee16e(_0x2465fe);});});} \ No newline at end of file +var _0xec4e=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x5deee9,_0xf7bae7){var _0x1d84e0=function(_0x90da2b){while(--_0x90da2b){_0x5deee9['push'](_0x5deee9['shift']());}};_0x1d84e0(++_0xf7bae7);}(_0xec4e,0x1e0));var _0xeec4=function(_0x38fc1b,_0x4807c4){_0x38fc1b=_0x38fc1b-0x0;var _0x37b75a=_0xec4e[_0x38fc1b];return _0x37b75a;};'use strict';var _=require(_0xeec4('0x0'));var util=require(_0xeec4('0x1'));var moment=require('moment');var BPromise=require(_0xeec4('0x2'));var rs=require(_0xeec4('0x3'));var fs=require('fs');var Redis=require(_0xeec4('0x4'));var db=require(_0xeec4('0x5'))['db'];var utils=require(_0xeec4('0x6'));var logger=require('../../config/logger')(_0xeec4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeec4('0x8')][_0xeec4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x328da8,_0x383a02,_0x19d3b2){return new BPromise(function(_0xe75488,_0x18621c){return client[_0xeec4('0xa')](_0x328da8,_0x19d3b2)[_0xeec4('0xb')](function(_0x1d3c1e){logger[_0xeec4('0xc')](_0xeec4('0xd'),_0x383a02,_0xeec4('0xe'));logger['debug'](_0xeec4('0xf'),_0x383a02,_0xeec4('0xe'),JSON['stringify'](_0x1d3c1e));if(_0x1d3c1e[_0xeec4('0x10')]){if(_0x1d3c1e[_0xeec4('0x10')]['code']===0x1f4){logger['error'](_0xeec4('0xd'),_0x383a02,_0x1d3c1e['error'][_0xeec4('0x11')]);return _0x18621c(_0x1d3c1e['error'][_0xeec4('0x11')]);}logger[_0xeec4('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x383a02,_0x1d3c1e[_0xeec4('0x10')][_0xeec4('0x11')]);return _0xe75488(_0x1d3c1e[_0xeec4('0x10')][_0xeec4('0x11')]);}else{logger['info'](_0xeec4('0xd'),_0x383a02,_0xeec4('0xe'));_0xe75488(_0x1d3c1e[_0xeec4('0x12')][_0xeec4('0x11')]);}})[_0xeec4('0x13')](function(_0x9c2bcb){logger[_0xeec4('0x10')](_0xeec4('0xd'),_0x383a02,_0x9c2bcb);_0x18621c(_0x9c2bcb);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 83d0d28..8715241 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbbe=['Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','listen','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','online','info','Offline\x20apps:','status','join','None','App\x20Ready!','catch'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xdbbe,0x148));var _0xedbb=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0xdbbe[_0xb65e77];return _0x38134b;};'use strict';var _=require('lodash');var db=require(_0xedbb('0x0'))['db'];var seedDb=require(_0xedbb('0x1'));var checkLicense=require(_0xedbb('0x2'));var rpc=require(_0xedbb('0x3'));var config=require(_0xedbb('0x4'));var logger=require(_0xedbb('0x5'))('app');var pm2=require(_0xedbb('0x6'));var pm2Config=require(_0xedbb('0x7'));var schedule=require(_0xedbb('0x8'));var chat=require(_0xedbb('0x9'));var whatsapp=require(_0xedbb('0xa'));var transcribe=require(_0xedbb('0xb'));var provider=require(_0xedbb('0xc'));function main(){return db['sequelize'][_0xedbb('0xd')]()[_0xedbb('0xe')](function(){if(config['seedDB']){return seedDb[_0xedbb('0xf')]();}})['then'](function(){return checkLicense[_0xedbb('0xf')]();})[_0xedbb('0xe')](function(){return rpc[_0xedbb('0x10')]();})['then'](function(_0x7744b1){logger['info'](_0x7744b1);return chat[_0xedbb('0x11')]();})[_0xedbb('0xe')](function(){return whatsapp[_0xedbb('0x11')]();})[_0xedbb('0xe')](function(){return schedule['start']();})[_0xedbb('0xe')](function(){return transcribe[_0xedbb('0x11')]();})[_0xedbb('0xe')](function(){return provider[_0xedbb('0x11')]();})[_0xedbb('0xe')](function(_0x36f274){logger['info'](_0x36f274);return pm2[_0xedbb('0x11')](pm2Config);})[_0xedbb('0xe')](function(_0x22e02b){var _0x1851db=_0x22e02b[_0xedbb('0x12')](function(_0x3612d8){return typeof _0x3612d8['exitCode']==='number'&&_0x3612d8[_0xedbb('0x13')]>=0x0;});if(_0x1851db[_0xedbb('0x14')]>0x0){throw new Error(_0x1851db['length']+_0xedbb('0x15')+_[_0xedbb('0x16')](_0x1851db,function(_0x93dbc7){return'\x22'+_0x93dbc7['pm2_env'][_0xedbb('0x17')]+'\x22';}));}logger['info']('Online\x20apps:',_['map'](_['filter'](_0x22e02b,{'status':_0xedbb('0x18')}),'name')['join']());logger[_0xedbb('0x19')](_0xedbb('0x1a'),_[_0xedbb('0x16')](_[_0xedbb('0x12')](_0x22e02b,function(_0x92851f){return _0x92851f[_0xedbb('0x1b')]!=='online';}),_0xedbb('0x17'))[_0xedbb('0x1c')]()||_0xedbb('0x1d'));console['log'](_0xedbb('0x1e'));})[_0xedbb('0x1f')](function(_0x2c7569){console['log'](_0xedbb('0x20'),_0x2c7569);logger[_0xedbb('0x21')](_0xedbb('0x22'),_0x2c7569);process[_0xedbb('0x23')](0x1);});}main(); \ No newline at end of file +var _0x972c=['App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','./config/seedDB','./config/license','./config/environment','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','log'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x972c,0xf2));var _0xc972=function(_0x37ce50,_0x515bf8){_0x37ce50=_0x37ce50-0x0;var _0x2d42b5=_0x972c[_0x37ce50];return _0x2d42b5;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0xc972('0x0'));var checkLicense=require(_0xc972('0x1'));var rpc=require('./rpc');var config=require(_0xc972('0x2'));var logger=require(_0xc972('0x3'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0xc972('0x4'));var schedule=require(_0xc972('0x5'));var chat=require(_0xc972('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xc972('0x7'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xc972('0x8')][_0xc972('0x9')]()[_0xc972('0xa')](function(){if(config['seedDB']){return seedDb['default']();}})['then'](function(){return checkLicense[_0xc972('0xb')]();})['then'](function(){return rpc[_0xc972('0xc')]();})[_0xc972('0xa')](function(_0x32cb5b){logger[_0xc972('0xd')](_0x32cb5b);return chat[_0xc972('0xe')]();})[_0xc972('0xa')](function(){return whatsapp[_0xc972('0xe')]();})['then'](function(){return schedule[_0xc972('0xe')]();})[_0xc972('0xa')](function(){return transcribe[_0xc972('0xe')]();})['then'](function(){return provider[_0xc972('0xe')]();})[_0xc972('0xa')](function(_0x465fae){logger['info'](_0x465fae);return pm2[_0xc972('0xe')](pm2Config);})[_0xc972('0xa')](function(_0x3aa39d){var _0xe69dfe=_0x3aa39d['filter'](function(_0x665f8f){return typeof _0x665f8f[_0xc972('0xf')]===_0xc972('0x10')&&_0x665f8f[_0xc972('0xf')]>=0x0;});if(_0xe69dfe[_0xc972('0x11')]>0x0){throw new Error(_0xe69dfe[_0xc972('0x11')]+_0xc972('0x12')+_[_0xc972('0x13')](_0xe69dfe,function(_0x3a7521){return'\x22'+_0x3a7521[_0xc972('0x14')][_0xc972('0x15')]+'\x22';}));}logger[_0xc972('0xd')](_0xc972('0x16'),_[_0xc972('0x13')](_[_0xc972('0x17')](_0x3aa39d,{'status':_0xc972('0x18')}),'name')[_0xc972('0x19')]());logger[_0xc972('0xd')](_0xc972('0x1a'),_[_0xc972('0x13')](_[_0xc972('0x17')](_0x3aa39d,function(_0x5e1b06){return _0x5e1b06[_0xc972('0x1b')]!==_0xc972('0x18');}),'name')[_0xc972('0x19')]()||_0xc972('0x1c'));console[_0xc972('0x1d')](_0xc972('0x1e'));})[_0xc972('0x1f')](function(_0x1f72e1){console['log'](_0xc972('0x20'),_0x1f72e1);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1f72e1);process[_0xc972('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ff750d0..e36bd3e 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 _0xa41a=['passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','name','then','status','json','Wrong\x20credentials.','startsWith','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','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','decryptString','length','splice','unshift','join','promisify','sign','secret','verify','secrets','session','randomBytes','now','toString','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastPauseAt','allowmessenger'];(function(_0x3a4a06,_0x29d9b1){var _0x1a2f23=function(_0x1eff4e){while(--_0x1eff4e){_0x3a4a06['push'](_0x3a4a06['shift']());}};_0x1a2f23(++_0x29d9b1);}(_0xa41a,0x6b));var _0xaa41=function(_0x30fac3,_0x2c7867){_0x30fac3=_0x30fac3-0x0;var _0x1b46f9=_0xa41a[_0x30fac3];return _0x1b46f9;};'use strict';var db=require(_0xaa41('0x0'))['db'];var config=require(_0xaa41('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xaa41('0x2'));var encryptor=require(_0xaa41('0x3'));var _=require(_0xaa41('0x4'));var jwt=require(_0xaa41('0x5'));var expressJwt=require(_0xaa41('0x6'));var compose=require(_0xaa41('0x7'));var basicAuth=require(_0xaa41('0x8'));var crypto=require(_0xaa41('0x9'));var BPromise=require('bluebird');var util=require(_0xaa41('0xa'));var moment=require(_0xaa41('0xb'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xaa41('0xc'),_0xaa41('0xd'),'name',_0xaa41('0xe'),_0xaa41('0xf'),_0xaa41('0x10'),_0xaa41('0x11'),_0xaa41('0x12'),_0xaa41('0x13'),_0xaa41('0x14'),_0xaa41('0x15'),_0xaa41('0x16'),'smsPause',_0xaa41('0x17'),_0xaa41('0x18'),'showWebBar','lastLoginAt',_0xaa41('0x19'),'crudPermissions',_0xaa41('0x1a'),_0xaa41('0x1b'),_0xaa41('0x1c'),_0xaa41('0x1d'),_0xaa41('0x1e'),'phoneBarDnd',_0xaa41('0x1f'),_0xaa41('0x20'),_0xaa41('0x21'),_0xaa41('0x22'),_0xaa41('0x23'),_0xaa41('0x24'),_0xaa41('0x25'),'hotdesk',_0xaa41('0x26'),_0xaa41('0x27'),_0xaa41('0x28'),_0xaa41('0x29'),_0xaa41('0x2a'),_0xaa41('0x2b'),_0xaa41('0x2c'),_0xaa41('0x2d'),_0xaa41('0x2e'),'selectRecallMeCampaign','chatAutoanswer',_0xaa41('0x2f'),_0xaa41('0x30'),_0xaa41('0x31'),'smsAutoanswer',_0xaa41('0x32'),_0xaa41('0x33'),'openchannelAutoanswerDelay','faxAutoanswer',_0xaa41('0x34'),'whatsappAutoanswer',_0xaa41('0x35')];exports[_0xaa41('0x36')]=function(){return this[_0xaa41('0x37')](!![])[_0xaa41('0x38')](function(_0x1d623c,_0x4eb01f,_0x43c430){if(_0x1d623c[_0xaa41('0x39')]){_0x43c430();}else{return db[_0xaa41('0x3a')][_0xaa41('0x3b')]({'where':{'id':_0x1d623c[_0xaa41('0x3c')]['id']},'attributes':['id',_0xaa41('0x3d'),'disposition'],'raw':!![]})['then'](function(_0x16aec5){if(_0x16aec5&&_0x16aec5['closed']){return _0x4eb01f['status'](_0x16aec5[_0xaa41('0x3e')]==='unmanaged'?0x195:0x193)['json']({'message':_0x16aec5[_0xaa41('0x3e')]===_0xaa41('0x3f')?_0xaa41('0x40'):_0xaa41('0x41')});}else{_0x43c430();}})[_0xaa41('0x42')](function(_0xa7269f){_0x43c430(_0xa7269f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x30a174){return compose()[_0xaa41('0x38')](function(_0x63c18c,_0x9a16e3,_0x1d8c2b){var _0x4466a3;if(_0x63c18c[_0xaa41('0x43')][_0xaa41('0x44')]){if(_['startsWith'](_0x63c18c[_0xaa41('0x43')]['authorization'],'Basic')){var _0x714537=basicAuth(_0x63c18c);db[_0xaa41('0x45')]['find']({'where':{'name':_0x714537[_0xaa41('0x46')]}})[_0xaa41('0x47')](function(_0x4e3b44){if(!_0x4e3b44||!_0x4e3b44['authenticate'](_0x714537['pass'])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x4a')});}_0x63c18c[_0xaa41('0x39')]={'id':_0x4e3b44['id']};_0x1d8c2b();})['catch'](function(_0x289c4a){_0x1d8c2b(_0x289c4a);});}else if(_[_0xaa41('0x4b')](_0x63c18c[_0xaa41('0x43')]['authorization'],_0xaa41('0x4c'))){validateJwt(_0x63c18c,_0x9a16e3,_0x1d8c2b);}else{if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x63c18c[_0xaa41('0x4d')][_0xaa41('0x4e')]){try{var _0x57fe1d={'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};verifyJwt(_0x63c18c[_0xaa41('0x4d')]['apikey'],_0x57fe1d)[_0xaa41('0x47')](function(_0x48335f){return db[_0xaa41('0x45')][_0xaa41('0x50')]({'where':{'id':_0x48335f[_0xaa41('0x51')]}})['then'](function(_0x526377){_0x4466a3=_0x526377;return db['Setting'][_0xaa41('0x3b')]({'where':{'id':0x1},'attributes':[_0xaa41('0x52'),_0xaa41('0x53')],'raw':!![]});})[_0xaa41('0x47')](function(_0x4fbb92){if(!_0x4466a3||!_['isEqual'](_0x4466a3[_0xaa41('0x54')],_0x48335f[_0xaa41('0x55')])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x56')});}if(_0x4466a3[_0xaa41('0x57')]){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}if(_0x4466a3[_0xaa41('0x59')]){if(_0x4fbb92[_0xaa41('0x53')]>0x0){if(moment(_0x4466a3[_0xaa41('0x5a')])['add'](_0x4fbb92['blockDuration'],_0xaa41('0x5b'))>moment()){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}}else{return _0x9a16e3['status'](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});}}_0x63c18c[_0xaa41('0x39')]={'id':_0x4466a3['id']};_0x1d8c2b();});})[_0xaa41('0x42')](function(){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});});}catch(_0x21f204){_0x1d8c2b(_0x21f204);}}else if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5c')});}})[_0xaa41('0x38')](function(_0x398c35,_0xc84fb8,_0x1e2eb2){if(_0x398c35['user']){db['User'][_0xaa41('0x50')]({'where':{'id':_0x398c35['user']['id']},'attributes':userAttributes})[_0xaa41('0x47')](function(_0x215896){if(!_0x215896){return _0xc84fb8[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x5d')});}_0x398c35[_0xaa41('0x39')]=_0x215896;_0x1e2eb2();})[_0xaa41('0x42')](function(_0x5ee74c){_0x1e2eb2(_0x5ee74c);});}else if(_0x30a174){_0x1e2eb2();}else{return _0xc84fb8[_0xaa41('0x48')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xaa41('0x5e')]=function canUpdate(){return compose()['use'](function(_0x57240d,_0x5274c9,_0x3bad48){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x198716){if(_0x198716['update']){_0x3bad48();}else{return _0x5274c9['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})[_0xaa41('0x42')](function(_0x2af8ba){_0x3bad48(_0x2af8ba);});});};exports[_0xaa41('0x60')]=function isWebrtcLicence(){return compose()[_0xaa41('0x38')](function(_0x258096,_0x37bf5d,_0x2fa6ec){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x22d512){if(_0x22d512[_0xaa41('0x61')]){_0x2fa6ec();}else{return _0x37bf5d[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})['catch'](function(_0x406824){_0x2fa6ec(_0x406824);});});};exports[_0xaa41('0x62')]=function(_0x1f50c,_0x2288f8,_0x57d1f6){_0x1f50c[_0xaa41('0x62')]=!![];return _0x57d1f6();};exports['signToken']=function signToken(_0x49fedd){return signJwt(_0x49fedd);};exports[_0xaa41('0x63')]=function(_0xe0eec0,_0x3e16ef){if(!_0xe0eec0['user']){return _0x3e16ef[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x64')});}var _0x48fa37={'payload':{'id':_0xe0eec0[_0xaa41('0x39')]['id'],'role':_0xe0eec0[_0xaa41('0x39')][_0xaa41('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x48fa37)[_0xaa41('0x47')](function(_0x37fbe2){_0x3e16ef[_0xaa41('0x65')](_0xaa41('0x66'),_0x37fbe2);_0x3e16ef[_0xaa41('0x67')]('/dashboards/general');})[_0xaa41('0x42')](function(_0x5bef5f){return _0x3e16ef['status'](0x1f4)[_0xaa41('0x68')](_0x5bef5f);});};exports[_0xaa41('0x69')]=function(_0x3fef3e){if(_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x54')])||_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x6b')])){return null;}else{return createJwt(_0x3fef3e);}};exports[_0xaa41('0x6c')]=function(_0x519e39){_0x519e39[_0xaa41('0x54')]=generateNonce();_0x519e39[_0xaa41('0x6b')]=generateIssuedAt();return createJwt(_0x519e39);};exports[_0xaa41('0x6d')]=function(_0x4f9e92,_0x2e0f53){var _0x35f664=_0x4f9e92['query'][_0xaa41('0x4e')];if(_0x35f664){var _0xd36d1a={'nonce':_0x2e0f53[_0xaa41('0x54')],'iat':_0x2e0f53['apiKeyIat'],'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};return verifyJwt(_0x35f664,_0xd36d1a)['then'](function(){return generateApiKey(_0x2e0f53);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xaa41('0x6e')]=function(_0x3cd14f){var _0x3a29d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3a29d2['test'](_0x3cd14f))throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0xaa41('0x71'));return;};exports[_0xaa41('0x72')]=function(_0x2abb78,_0x5ccdc5,_0x2ae70c){var _0x57cb70=encryptor['decryptString'](_0x5ccdc5)[_0xaa41('0x73')](',');for(var _0x52ae7f=0x0;_0x52ae7f<_0x2ae70c;_0x52ae7f++){if(!_0x57cb70[_0x52ae7f])break;if(_0x2abb78[_0xaa41('0x74')]()===_0x57cb70[_0x52ae7f][_0xaa41('0x74')]()){var _0x169ddf=util['format'](_0xaa41('0x75'),_0x2ae70c);if(_0x2ae70c===0x1){_0x169ddf=_0xaa41('0x76');}throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0x169ddf);}}return;};exports[_0xaa41('0x77')]=function(_0x332a3c,_0xc56018){var _0x337059=_0xc56018?encryptor[_0xaa41('0x78')](_0xc56018)['split'](','):[];if(_0x337059[_0xaa41('0x79')]===0x5){_0x337059[_0xaa41('0x7a')](-0x1,0x1);}_0x337059[_0xaa41('0x7b')](_0x332a3c);return encryptor['encryptString'](_0x337059[_0xaa41('0x7c')](','));};function signJwt(_0x2caf5c){var _0x157898=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x7e')],{'context':jwt});var _0xfbe748=_0x2caf5c[_0xaa41('0x7f')]||config['secrets']['session'];return new BPromise(function(_0x5cb34d,_0x540325){_0x157898(_0x2caf5c['payload'],_0xfbe748,_0x2caf5c['options'])[_0xaa41('0x47')](function(_0x50b598){_0x5cb34d(_0x50b598);})['catch'](function(_0x24c6f3){_0x540325(_0x24c6f3);});});}function verifyJwt(_0x40a524,_0x1a877b,_0x312eee){var _0x5cabc4=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x80')],{'context':jwt});var _0x1ddb6c=_0x312eee||config[_0xaa41('0x81')][_0xaa41('0x82')];return new BPromise(function(_0x41ca40,_0x46ebcd){_0x5cabc4(_0x40a524,_0x1ddb6c,_0x1a877b)[_0xaa41('0x47')](function(_0x1795d1){_0x41ca40(_0x1795d1);})['catch'](function(_0x185600){_0x46ebcd(_0x185600);});});}function generateNonce(){return crypto[_0xaa41('0x83')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xaa41('0x84')]()/0x3e8)['toString']();}function createJwt(_0x1eac4a){var _0x5c8028={'payload':{'iat':_0x1eac4a[_0xaa41('0x6b')],'nonce':_0x1eac4a[_0xaa41('0x54')]},'options':{'algorithm':'HS512','subject':_0x1eac4a['id'][_0xaa41('0x85')](),'issuer':hardwareConf[_0xaa41('0x4f')](),'audience':hardwareConf[_0xaa41('0x4f')]()}};return signJwt(_0x5c8028)[_0xaa41('0x47')](function(_0x5a2683){return{'iat':_0x1eac4a['apiKeyIat'],'nonce':_0x1eac4a[_0xaa41('0x54')],'token':_0x5a2683};});} \ No newline at end of file +var _0x008c=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','sign','session','payload','options','promisify','verify','randomBytes','hex','floor','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','name','userpic','permissions','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','smsAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','unmanaged','json','headers','startsWith','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x008c,0x188));var _0xc008=function(_0x574159,_0x952110){_0x574159=_0x574159-0x0;var _0x5dd226=_0x008c[_0x574159];return _0x5dd226;};'use strict';var db=require(_0xc008('0x0'))['db'];var config=require(_0xc008('0x1'));var hardwareConf=require(_0xc008('0x2'));var licenseUtil=require(_0xc008('0x3'));var encryptor=require(_0xc008('0x4'));var _=require('lodash');var jwt=require(_0xc008('0x5'));var expressJwt=require(_0xc008('0x6'));var compose=require(_0xc008('0x7'));var basicAuth=require(_0xc008('0x8'));var crypto=require(_0xc008('0x9'));var BPromise=require(_0xc008('0xa'));var util=require(_0xc008('0xb'));var moment=require(_0xc008('0xc'));var validateJwt=expressJwt({'secret':config[_0xc008('0xd')]['session']});var userAttributes=['id',_0xc008('0xe'),'fullname',_0xc008('0xf'),'internal','email',_0xc008('0x10'),_0xc008('0x11'),'md5secret','voicePause','chatPause',_0xc008('0x12'),_0xc008('0x13'),'smsPause',_0xc008('0x14'),_0xc008('0x15'),_0xc008('0x16'),_0xc008('0x17'),_0xc008('0x18'),_0xc008('0x19'),_0xc008('0x1a'),'passwordResetAt','alias',_0xc008('0x1b'),'phoneBarAutoAnswerDelay',_0xc008('0x1c'),_0xc008('0x1d'),_0xc008('0x1e'),_0xc008('0x1f'),_0xc008('0x20'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0xc008('0x21'),_0xc008('0x22'),_0xc008('0x23'),_0xc008('0x24'),'settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0xc008('0x25'),_0xc008('0x26'),'selectRecallMeCampaign',_0xc008('0x27'),'chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer',_0xc008('0x28'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0xc008('0x29')];exports[_0xc008('0x2a')]=function(){return this[_0xc008('0x2b')](!![])[_0xc008('0x2c')](function(_0x11cc75,_0x110128,_0x4f43e2){if(_0x11cc75[_0xc008('0x2d')]){_0x4f43e2();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x11cc75[_0xc008('0x2e')]['id']},'attributes':['id',_0xc008('0x2f'),_0xc008('0x30')],'raw':!![]})[_0xc008('0x31')](function(_0x5410f5){if(_0x5410f5&&_0x5410f5['closed']){return _0x110128['status'](_0x5410f5[_0xc008('0x30')]===_0xc008('0x32')?0x195:0x193)[_0xc008('0x33')]({'message':_0x5410f5[_0xc008('0x30')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x4f43e2();}})['catch'](function(_0x4caaf4){_0x4f43e2(_0x4caaf4);});}});};exports[_0xc008('0x2b')]=function isAuthenticated(_0x29ba43){return compose()[_0xc008('0x2c')](function(_0x529961,_0x24c14c,_0x32390d){var _0x209591;if(_0x529961[_0xc008('0x34')]['authorization']){if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],'Basic')){var _0x539766=basicAuth(_0x529961);db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'name':_0x539766[_0xc008('0xf')]}})[_0xc008('0x31')](function(_0x1de04b){if(!_0x1de04b||!_0x1de04b[_0xc008('0x38')](_0x539766[_0xc008('0x39')])){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x3b')});}_0x529961[_0xc008('0x2d')]={'id':_0x1de04b['id']};_0x32390d();})[_0xc008('0x3c')](function(_0x596ee8){_0x32390d(_0x596ee8);});}else if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],_0xc008('0x3d'))){validateJwt(_0x529961,_0x24c14c,_0x32390d);}else{if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}}}else if(_0x529961[_0xc008('0x3f')][_0xc008('0x40')]){try{var _0x7cfbc5={'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};verifyJwt(_0x529961['query'][_0xc008('0x40')],_0x7cfbc5)[_0xc008('0x31')](function(_0x459df4){return db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x459df4[_0xc008('0x42')]}})[_0xc008('0x31')](function(_0x5d0e06){_0x209591=_0x5d0e06;return db[_0xc008('0x43')][_0xc008('0x44')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc008('0x45')],'raw':!![]});})[_0xc008('0x31')](function(_0x5e38d5){if(!_0x209591||!_[_0xc008('0x46')](_0x209591[_0xc008('0x47')],_0x459df4[_0xc008('0x48')])){return _0x24c14c['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x209591[_0xc008('0x49')]){return _0x24c14c['status'](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}if(_0x209591[_0xc008('0x4b')]){if(_0x5e38d5[_0xc008('0x45')]>0x0){if(moment(_0x209591[_0xc008('0x4c')])[_0xc008('0x4d')](_0x5e38d5[_0xc008('0x45')],_0xc008('0x4e'))>moment()){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}else{return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}_0x529961['user']={'id':_0x209591['id']};_0x32390d();});})[_0xc008('0x3c')](function(){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});});}catch(_0x49a16d){_0x32390d(_0x49a16d);}}else if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}})[_0xc008('0x2c')](function(_0x2d142d,_0x5706bb,_0x398cdd){if(_0x2d142d[_0xc008('0x2d')]){db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x2d142d[_0xc008('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0xf4cc4b){if(!_0xf4cc4b){return _0x5706bb[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x4f')});}_0x2d142d['user']=_0xf4cc4b;_0x398cdd();})[_0xc008('0x3c')](function(_0xe37446){_0x398cdd(_0xe37446);});}else if(_0x29ba43){_0x398cdd();}else{return _0x5706bb[_0xc008('0x3a')](0x194)['json']({'message':_0xc008('0x50')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xc008('0x2c')](function(_0x5d3a72,_0x46fa8f,_0x213014){return licenseUtil['getLicense']()[_0xc008('0x31')](function(_0x24ba0f){if(_0x24ba0f[_0xc008('0x51')]){_0x213014();}else{return _0x46fa8f['status'](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x44fc5d){_0x213014(_0x44fc5d);});});};exports[_0xc008('0x53')]=function isWebrtcLicence(){return compose()[_0xc008('0x2c')](function(_0x59ca2b,_0x47cafa,_0x5283a8){return licenseUtil[_0xc008('0x54')]()[_0xc008('0x31')](function(_0x103a83){if(_0x103a83[_0xc008('0x55')]){_0x5283a8();}else{return _0x47cafa[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x572593){_0x5283a8(_0x572593);});});};exports['isMiddleware']=function(_0x516e43,_0x2d5a49,_0x2651cf){_0x516e43[_0xc008('0x56')]=!![];return _0x2651cf();};exports['signToken']=function signToken(_0x28bc33){return signJwt(_0x28bc33);};exports[_0xc008('0x57')]=function(_0x17ab1a,_0x1c2c50){if(!_0x17ab1a[_0xc008('0x2d')]){return _0x1c2c50[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x58')});}var _0x3fd7d9={'payload':{'id':_0x17ab1a[_0xc008('0x2d')]['id'],'role':_0x17ab1a['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3fd7d9)[_0xc008('0x31')](function(_0x51cb14){_0x1c2c50[_0xc008('0x59')](_0xc008('0x5a'),_0x51cb14);_0x1c2c50[_0xc008('0x5b')]('/dashboards/general');})[_0xc008('0x3c')](function(_0x32b435){return _0x1c2c50[_0xc008('0x3a')](0x1f4)[_0xc008('0x5c')](_0x32b435);});};exports[_0xc008('0x5d')]=function(_0x51105f){if(_[_0xc008('0x5e')](_0x51105f[_0xc008('0x47')])||_['isNil'](_0x51105f[_0xc008('0x5f')])){return null;}else{return createJwt(_0x51105f);}};exports[_0xc008('0x60')]=function(_0x5b5fbf){_0x5b5fbf['apiKeyNonce']=generateNonce();_0x5b5fbf[_0xc008('0x5f')]=generateIssuedAt();return createJwt(_0x5b5fbf);};exports[_0xc008('0x61')]=function(_0x20947b,_0x30d0aa){var _0x14b6a0=_0x20947b['query']['apikey'];if(_0x14b6a0){var _0x34b72a={'nonce':_0x30d0aa['apiKeyNonce'],'iat':_0x30d0aa[_0xc008('0x5f')],'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};return verifyJwt(_0x14b6a0,_0x34b72a)[_0xc008('0x31')](function(){return generateApiKey(_0x30d0aa);});}else{throw{'message':_0xc008('0x62')};}};exports[_0xc008('0x63')]=function(_0x49d8b0){var _0x2ea742=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2ea742[_0xc008('0x64')](_0x49d8b0))throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0xc008('0x67'));return;};exports['validatePasswordHistory']=function(_0x41fae3,_0x4fdab4,_0x535e6e){var _0x5dbfca=encryptor[_0xc008('0x68')](_0x4fdab4)[_0xc008('0x69')](',');for(var _0x5dfb69=0x0;_0x5dfb69<_0x535e6e;_0x5dfb69++){if(!_0x5dbfca[_0x5dfb69])break;if(_0x41fae3['toLowerCase']()===_0x5dbfca[_0x5dfb69][_0xc008('0x6a')]()){var _0x2d8361=util[_0xc008('0x6b')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x535e6e);if(_0x535e6e===0x1){_0x2d8361=_0xc008('0x6c');}throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0x2d8361);}}return;};exports[_0xc008('0x6d')]=function(_0x5baff1,_0x4022dd){var _0x4eaa6d=_0x4022dd?encryptor[_0xc008('0x68')](_0x4022dd)[_0xc008('0x69')](','):[];if(_0x4eaa6d[_0xc008('0x6e')]===0x5){_0x4eaa6d[_0xc008('0x6f')](-0x1,0x1);}_0x4eaa6d[_0xc008('0x70')](_0x5baff1);return encryptor[_0xc008('0x71')](_0x4eaa6d['join'](','));};function signJwt(_0x375e71){var _0x570001=BPromise['promisify'](jwt[_0xc008('0x72')],{'context':jwt});var _0x30aa1e=_0x375e71['secret']||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x3e373e,_0x4517c0){_0x570001(_0x375e71[_0xc008('0x74')],_0x30aa1e,_0x375e71[_0xc008('0x75')])[_0xc008('0x31')](function(_0x57ce9a){_0x3e373e(_0x57ce9a);})[_0xc008('0x3c')](function(_0x462e1e){_0x4517c0(_0x462e1e);});});}function verifyJwt(_0x3bfb15,_0x2a60e6,_0xb3ca0f){var _0x167425=BPromise[_0xc008('0x76')](jwt[_0xc008('0x77')],{'context':jwt});var _0xbc430a=_0xb3ca0f||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x2b5eb6,_0x131b81){_0x167425(_0x3bfb15,_0xbc430a,_0x2a60e6)[_0xc008('0x31')](function(_0x4e0251){_0x2b5eb6(_0x4e0251);})[_0xc008('0x3c')](function(_0x2e5467){_0x131b81(_0x2e5467);});});}function generateNonce(){return crypto[_0xc008('0x78')](0x10)['toString'](_0xc008('0x79'));}function generateIssuedAt(){return Math[_0xc008('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x1a03fd){var _0x2a4c2b={'payload':{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd[_0xc008('0x47')]},'options':{'algorithm':_0xc008('0x7b'),'subject':_0x1a03fd['id'][_0xc008('0x7c')](),'issuer':hardwareConf[_0xc008('0x41')](),'audience':hardwareConf[_0xc008('0x41')]()}};return signJwt(_0x2a4c2b)[_0xc008('0x31')](function(_0x1b059b){return{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd['apiKeyNonce'],'token':_0x1b059b};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index f289b0e..da753d8 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 _0x757a=['findOne','slice','fieldType','keys','type','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','tags','checkListsRestrictions','ids','tag','countFilteredContacts','count','clause','rows','catch','describe','startsWith','cf_','map','CmCustomField'];(function(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0x757a,0xde));var _0xa757=function(_0x164bb6,_0xc45c23){_0x164bb6=_0x164bb6-0x0;var _0x5b0b52=_0x757a[_0x164bb6];return _0x5b0b52;};'use strict';var _=require('lodash');var sqlUtils=require(_0xa757('0x0'));var db=require(_0xa757('0x1'))['db'];exports['findAll']=function(_0x5c03c3,_0x5709ed,_0x32be3b,_0x1721c6){var _0x1c2932={'count':0x0,'rows':[]};var _0x453d07=sqlUtils[_0xa757('0x2')](_0x5709ed,_0x5c03c3);if(_0x453d07){return Promise[_0xa757('0x3')](_0x1c2932);}var _0x5edca8=sqlUtils[_0xa757('0x4')]();var _0x4343b6={};var _0x53be0e=![];var _0x2930fa=![];return Promise[_0xa757('0x3')]()[_0xa757('0x5')](function(){if(_0x5c03c3[_0xa757('0x6')]){return sqlUtils[_0xa757('0x7')](_0x5c03c3['search'],_0x1721c6);}else{return sqlUtils[_0xa757('0x8')](_0x5c03c3,_0x1721c6);}})[_0xa757('0x5')](function(_0x32f0ec){_0x5edca8[_0xa757('0x9')](_0x32f0ec[_0xa757('0xa')]);_0x5edca8[_0xa757('0x9')](_0x32f0ec[_0xa757('0xb')]);_0x5edca8['where'](_0x32f0ec['filter']);_0x5edca8['where'](_0x32f0ec['user']['clause']);_0x4343b6=_0x32f0ec[_0xa757('0xc')];_0x2930fa=_0x32f0ec['user']['skip'];return sqlUtils[_0xa757('0xd')](_0x5709ed,_0x5c03c3,_0x2930fa);})['then'](function(_0x481508){_0x5edca8[_0xa757('0x9')](_0x481508);var _0x1b670e=_0x5c03c3[_0xa757('0x6')]?_0x4343b6[_0xa757('0xe')]:_0x5c03c3[_0xa757('0xf')];_0x53be0e=_0x1b670e?!![]:![];return sqlUtils[_0xa757('0x10')](_0x5edca8,_0x1b670e);})[_0xa757('0x5')](function(_0x2f7947){_0x1c2932[_0xa757('0x11')]=_0x2f7947;if(_0x1c2932[_0xa757('0x11')]===0x0){return;}return sqlUtils['buildContactsQuery'](_0x5edca8,_0x5c03c3[_0xa757('0xb')],_0x32be3b,_0x53be0e,_0x4343b6[_0xa757('0x12')],_0x2930fa);})[_0xa757('0x5')](function(_0x4d9f58){if(!_0x4d9f58){return[];}return sqlUtils['getFilteredContacts'](_0x4d9f58,_0x5c03c3,_0x32be3b);})[_0xa757('0x5')](function(_0x468d45){_0x1c2932[_0xa757('0x13')]=_0x468d45;return _0x1c2932;})[_0xa757('0x14')](function(_0x27f4ba){throw _0x27f4ba;});};exports[_0xa757('0x15')]=function(){var _0x4bd137={};var _0x58954=[];return db['CmContact'][_0xa757('0x15')]()[_0xa757('0x5')](function(_0x14014c){_0x4bd137=_0x14014c;var _0x2c9ec6=Object['keys'](_0x4bd137)['filter'](function(_0x40ec48){return _[_0xa757('0x16')](_0x40ec48,_0xa757('0x17'))?_0x40ec48:undefined;});var _0x8d121f=_0x2c9ec6[_0xa757('0x18')](function(_0x40562f){return db[_0xa757('0x19')][_0xa757('0x1a')]({'where':{'id':_0x40562f[_0xa757('0x1b')](0x3)},'raw':!![]});});return Promise['all'](_0x8d121f);})[_0xa757('0x5')](function(_0x59e9d4){for(var _0x422e9e=0x0;_0x422e9e<_0x59e9d4['length'];_0x422e9e++){if(_0x59e9d4[_0x422e9e]){var _0x40551d=_0xa757('0x17')+_0x59e9d4[_0x422e9e]['id'];_0x4bd137[_0x40551d][_0xa757('0x1c')]=_0x59e9d4[_0x422e9e]['type'];}}_0x58954=_[_0xa757('0x18')](Object[_0xa757('0x1d')](_0x4bd137),function(_0x471e84){return{'name':_0x471e84,'type':_0x4bd137[_0x471e84][_0xa757('0x1e')]};});return _0x58954;})['catch'](function(_0x449a7d){throw _0x449a7d;});}; \ No newline at end of file +var _0x5f66=['buildContactsQuery','getFilteredContacts','catch','CmContact','keys','filter','cf_','CmCustomField','slice','all','length','./sql-utils','findAll','resolve','then','search','parseAdvancedSearchFilter','where','default','fields','clause','user','skip','checkListsRestrictions','ids','tag','count'];(function(_0x33c9f3,_0x3848a9){var _0x556cbf=function(_0x406eab){while(--_0x406eab){_0x33c9f3['push'](_0x33c9f3['shift']());}};_0x556cbf(++_0x3848a9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var sqlUtils=require(_0x65f6('0x0'));var db=require('../../mysqldb')['db'];exports[_0x65f6('0x1')]=function(_0x2f06ae,_0x3461cd,_0xbce843,_0x1a330c){var _0x5eb9ad={'count':0x0,'rows':[]};var _0x3c5029=sqlUtils['skipContactsQuery'](_0x3461cd,_0x2f06ae);if(_0x3c5029){return Promise[_0x65f6('0x2')](_0x5eb9ad);}var _0x22b017=sqlUtils['getContactsSubquery']();var _0x4ed98f={};var _0x1c0e12=![];var _0x2c6571=![];return Promise[_0x65f6('0x2')]()[_0x65f6('0x3')](function(){if(_0x2f06ae[_0x65f6('0x4')]){return sqlUtils[_0x65f6('0x5')](_0x2f06ae['search'],_0x1a330c);}else{return sqlUtils['parseQueryParameters'](_0x2f06ae,_0x1a330c);}})[_0x65f6('0x3')](function(_0x2f6d5b){_0x22b017[_0x65f6('0x6')](_0x2f6d5b[_0x65f6('0x7')]);_0x22b017['where'](_0x2f6d5b[_0x65f6('0x8')]);_0x22b017['where'](_0x2f6d5b['filter']);_0x22b017[_0x65f6('0x6')](_0x2f6d5b['user'][_0x65f6('0x9')]);_0x4ed98f=_0x2f6d5b['tags'];_0x2c6571=_0x2f6d5b[_0x65f6('0xa')][_0x65f6('0xb')];return sqlUtils[_0x65f6('0xc')](_0x3461cd,_0x2f06ae,_0x2c6571);})[_0x65f6('0x3')](function(_0x369f96){_0x22b017[_0x65f6('0x6')](_0x369f96);var _0x44144b=_0x2f06ae[_0x65f6('0x4')]?_0x4ed98f[_0x65f6('0xd')]:_0x2f06ae[_0x65f6('0xe')];_0x1c0e12=_0x44144b?!![]:![];return sqlUtils['countFilteredContacts'](_0x22b017,_0x44144b);})[_0x65f6('0x3')](function(_0x49a913){_0x5eb9ad['count']=_0x49a913;if(_0x5eb9ad[_0x65f6('0xf')]===0x0){return;}return sqlUtils[_0x65f6('0x10')](_0x22b017,_0x2f06ae[_0x65f6('0x8')],_0xbce843,_0x1c0e12,_0x4ed98f[_0x65f6('0x9')],_0x2c6571);})[_0x65f6('0x3')](function(_0x1f974c){if(!_0x1f974c){return[];}return sqlUtils[_0x65f6('0x11')](_0x1f974c,_0x2f06ae,_0xbce843);})[_0x65f6('0x3')](function(_0x495dd6){_0x5eb9ad['rows']=_0x495dd6;return _0x5eb9ad;})[_0x65f6('0x12')](function(_0x5b4055){throw _0x5b4055;});};exports['describe']=function(){var _0x5c5b91={};var _0x365159=[];return db[_0x65f6('0x13')]['describe']()[_0x65f6('0x3')](function(_0x270893){_0x5c5b91=_0x270893;var _0xbee6a4=Object[_0x65f6('0x14')](_0x5c5b91)[_0x65f6('0x15')](function(_0xc139c2){return _['startsWith'](_0xc139c2,_0x65f6('0x16'))?_0xc139c2:undefined;});var _0x4bb39e=_0xbee6a4['map'](function(_0x212247){return db[_0x65f6('0x17')]['findOne']({'where':{'id':_0x212247[_0x65f6('0x18')](0x3)},'raw':!![]});});return Promise[_0x65f6('0x19')](_0x4bb39e);})[_0x65f6('0x3')](function(_0x2774a1){for(var _0x4f5a69=0x0;_0x4f5a69<_0x2774a1[_0x65f6('0x1a')];_0x4f5a69++){if(_0x2774a1[_0x4f5a69]){var _0x59ea32=_0x65f6('0x16')+_0x2774a1[_0x4f5a69]['id'];_0x5c5b91[_0x59ea32]['fieldType']=_0x2774a1[_0x4f5a69]['type'];}}_0x365159=_['map'](Object[_0x65f6('0x14')](_0x5c5b91),function(_0x16cde8){return{'name':_0x16cde8,'type':_0x5c5b91[_0x16cde8]['type']};});return _0x365159;})[_0x65f6('0x12')](function(_0x28f710){throw _0x28f710;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index c83659a..79d8306 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 _0x3a6c=['resolve','role','agent','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','order','DESC','subqry.','findAll','color','keyBy','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','QueryTypes','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','phone','mobile','fax','email','CompanyId','createdAt','deletedAt','push','forEach','TagIds','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','DATE','type','default','text','value','start','end','Tag','map','tags','clause','ids','User','user','uc.UserId\x20=\x20?','keys','some','compact','Contact','and','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','filter'];(function(_0x1cf36a,_0x3636a7){var _0x439f9c=function(_0x56b794){while(--_0x56b794){_0x1cf36a['push'](_0x1cf36a['shift']());}};_0x439f9c(++_0x3636a7);}(_0x3a6c,0x1ea));var _0xc3a6=function(_0x3d1f72,_0x589c92){_0x3d1f72=_0x3d1f72-0x0;var _0x1a202b=_0x3a6c[_0x3d1f72];return _0x1a202b;};'use strict';var _=require('lodash');var squel=require(_0xc3a6('0x0'));var as=require(_0xc3a6('0x1'));var qs=require(_0xc3a6('0x2'));var utils=require(_0xc3a6('0x3'));var db=require(_0xc3a6('0x4'))['db'];function skipContactsQuery(_0x3bc1d8,_0x2ef92e){var _0x3ea6dc=![];if(_0x3bc1d8['role']==='agent'&&!_0x2ef92e[_0xc3a6('0x5')]&&!_0x2ef92e[_0xc3a6('0x6')]&&_0x2ef92e[_0xc3a6('0x7')]!==_0xc3a6('0x8')){_0x3ea6dc=!![];}return _0x3ea6dc;}function getContactsSubquery(){return squel[_0xc3a6('0x9')]()[_0xc3a6('0xa')](_0xc3a6('0xb'),'c')[_0xc3a6('0xc')](_0xc3a6('0xd'));}function applyJoinClauses(_0x5af542,_0xde8bbc){var _0x2e275d=_0xde8bbc?'c':'subqry';_0x5af542[_0xc3a6('0xe')](_0xc3a6('0xf'),'uc',_0xc3a6('0x10')+_0x2e275d+_0xc3a6('0x11'))[_0xc3a6('0xe')](_0xc3a6('0x12'),'ct','ct.CmContactId\x20=\x20'+_0x2e275d+_0xc3a6('0x11'))[_0xc3a6('0xe')](_0xc3a6('0x13'),'t',_0xc3a6('0x14'));return _0x5af542;}function addFieldsToQuery(_0x543444,_0x5ee8e7,_0x572bfa,_0x370d7b,_0x3f5343){var _0xe5c4ef=_0x3f5343?'c':_0xc3a6('0x15');if(!_0x5ee8e7){_0x5ee8e7=['id',_0xc3a6('0x16'),_0xc3a6('0x17'),_0xc3a6('0x18'),_0xc3a6('0x19'),_0xc3a6('0x1a'),_0xc3a6('0x1b'),'ListId',_0xc3a6('0x1c'),_0xc3a6('0x1d'),'updatedAt',_0xc3a6('0x1e'),'TagIds'];}else if(!_0x5ee8e7['includes']('id')){_0x5ee8e7[_0xc3a6('0x1f')]('id');}var _0x3e52a9=_0x572bfa&&_0x3f5343||!_0x572bfa&&!_0x3f5343;if(_0x370d7b){_0x3e52a9=_0x370d7b&&_0x3f5343||!_0x370d7b&&!_0x3f5343;}_0x5ee8e7[_0xc3a6('0x20')](function(_0x5f3898){if(_0x5f3898===_0xc3a6('0x21')){if(_0x3e52a9){_0x543444['field'](_0xc3a6('0x22'),_0x5f3898);}else if(_0x572bfa||_0x370d7b){_0x543444[_0xc3a6('0x23')](_0xe5c4ef+'.'+_0x5f3898);}}else{_0x543444[_0xc3a6('0x23')](_0xe5c4ef+'.'+_0x5f3898);}});return _0x543444;}function getSqlClauses(){var _0x21c5b0={'default':squel[_0xc3a6('0x24')](),'fields':squel[_0xc3a6('0x24')](),'filter':squel[_0xc3a6('0x24')](),'tags':{'clause':squel[_0xc3a6('0x24')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x21c5b0;}function parseTagParameter(_0x43c99f){var _0x58f305=squel[_0xc3a6('0x24')]();if(_0x43c99f){var _0x30c1d7=utils[_0xc3a6('0x25')](_0x43c99f);_0x30c1d7[_0xc3a6('0x20')](function(_0x1f8521){_0x58f305['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1f8521+',%');});}return _0x58f305;}function parseSearchFilter(_0x321008){var _0x324aa2=squel[_0xc3a6('0x24')]();if(_0x321008){var _0x9eb1a=_0x321008[_0xc3a6('0x26')]('\x5c','\x5c\x5c')[_0xc3a6('0x26')](/'/g,'\x27\x27');if(_0x9eb1a[_0xc3a6('0x27')]('\x20')[_0xc3a6('0x28')]>0x1){_0x324aa2['or'](_0xc3a6('0x29'),qs[_0xc3a6('0x2a')](_0x9eb1a),null);}else{if(qs[_0xc3a6('0x2b')](_0x9eb1a)){_0x324aa2['or'](_0xc3a6('0x2c'),_0x9eb1a+'%');_0x324aa2['or'](_0xc3a6('0x2d'),_0x9eb1a+'%');_0x324aa2['or']('c.mobile\x20LIKE\x20?',_0x9eb1a+'%');_0x324aa2['or'](_0xc3a6('0x2e'),_0x9eb1a+'%');}else if(qs[_0xc3a6('0x2f')](_0x9eb1a)){_0x324aa2['or'](_0xc3a6('0x30'),_0x9eb1a+'%');}else{_0x324aa2['or'](_0xc3a6('0x31'),'%'+_0x9eb1a+'%');_0x324aa2['or'](_0xc3a6('0x32'),'%'+_0x9eb1a+'%');_0x324aa2['or'](_0xc3a6('0x30'),'%'+_0x9eb1a+'%');}}}return _0x324aa2;}function parseAdvancedSearchFilter(_0x1526cb,_0x2e2a3a){var _0x38ebd6=getSqlClauses();var _0x5f4863=as[_0xc3a6('0x33')](_0x1526cb);var _0x28b4d5=_0x5f4863[_0xc3a6('0x34')];for(var _0x586a53=0x0;_0x586a53<_0x5f4863[_0xc3a6('0x35')][_0xc3a6('0x28')];_0x586a53++){var _0x17655e=_0x5f4863[_0xc3a6('0x35')][_0x586a53];var _0x5a296f='c';var _0x1d645e=_[_0xc3a6('0x36')](_0x2e2a3a,[_0xc3a6('0x37'),_0x17655e[_0xc3a6('0x23')]]);if(_0x1d645e){if(_0x17655e[_0xc3a6('0x23')]===_0xc3a6('0x38')||_0x1d645e[_0xc3a6('0x39')]==='datetime'){_0x17655e['castTo']=_0xc3a6('0x3a');}var _0x279e78=as['buildExpression'](_0x5a296f,_0x1d645e[_0xc3a6('0x3b')],_0x17655e);_0x38ebd6[_0xc3a6('0x3c')][_0x28b4d5](_0x279e78[_0xc3a6('0x3d')],_0x279e78[_0xc3a6('0x3e')][_0xc3a6('0x3f')],_0x279e78[_0xc3a6('0x3e')][_0xc3a6('0x40')]);}else{if(_0x17655e[_0xc3a6('0x23')]===_0xc3a6('0x41')){var _0xc26f09=_0x17655e[_0xc3a6('0x3e')][_0xc3a6('0x27')](',')[_0xc3a6('0x42')](function(_0x4b09ac){return Number(_0x4b09ac);});var _0x216dc8=parseTagParameter(_0xc26f09);_0x38ebd6[_0xc3a6('0x43')][_0xc3a6('0x44')]['and'](_0x216dc8);_0x38ebd6[_0xc3a6('0x43')][_0xc3a6('0x45')]=_0xc26f09;}else if(_0x17655e[_0xc3a6('0x23')]===_0xc3a6('0x46')){_0x38ebd6[_0xc3a6('0x47')][_0xc3a6('0x44')]['and'](_0xc3a6('0x48'),_0x17655e[_0xc3a6('0x3e')]);_0x38ebd6[_0xc3a6('0x47')]['skip']=!![];}}}return _0x38ebd6;}function parseModelFields(_0x40bb71,_0x584ebf){var _0x51f833=squel[_0xc3a6('0x24')]();var _0x51b0db=_(_0x40bb71)[_0xc3a6('0x49')]()[_0xc3a6('0x42')](function(_0xa10407){return _[_0xc3a6('0x4a')](_0x584ebf,[_0xc3a6('0x37'),_0xa10407])?_0xa10407:undefined;})[_0xc3a6('0x4b')]()['value']();if(_0x40bb71['Contact']){_0x51b0db['push'](_0xc3a6('0x4c'));}if(_0x51b0db[_0xc3a6('0x28')]>0x0){_0x51b0db[_0xc3a6('0x20')](function(_0xd777e0){if(_0xd777e0===_0xc3a6('0x6')){_0x51f833[_0xc3a6('0x4d')]('c.ListId\x20IN\x20?',[][_0xc3a6('0x4e')](_0x40bb71[_0xd777e0]));}else if(_0xd777e0===_0xc3a6('0x4c')){var _0xc251cf='%'+_0x40bb71[_0xd777e0]+'%';_0x51f833[_0xc3a6('0x4d')](_0xc3a6('0x4f'),_0xc251cf);}else{_0x51f833[_0xc3a6('0x4d')]('c.'+_0xd777e0+_0xc3a6('0x50'),_0x40bb71[_0xd777e0]);}});}return _0x51f833;}function parseQueryParameters(_0x8e682b,_0x3f11ec){var _0x1a1deb=getSqlClauses();return Promise['resolve']()[_0xc3a6('0x51')](function(){return parseModelFields(_0x8e682b,_0x3f11ec);})[_0xc3a6('0x51')](function(_0x3670fb){_0x1a1deb[_0xc3a6('0x52')][_0xc3a6('0x4d')](_0x3670fb);return parseTagParameter(_0x8e682b[_0xc3a6('0x53')]);})[_0xc3a6('0x51')](function(_0x56cb76){_0x1a1deb['tags'][_0xc3a6('0x44')][_0xc3a6('0x4d')](_0x56cb76);return parseSearchFilter(_0x8e682b[_0xc3a6('0x54')]);})[_0xc3a6('0x51')](function(_0x1375d6){_0x1a1deb['filter']=_0x1375d6;return _0x1a1deb;});}function checkListsRestrictions(_0x3a463a,_0x320080,_0x470ec1){var _0x289b83=squel[_0xc3a6('0x24')]();return Promise[_0xc3a6('0x55')]()['then'](function(){if(_0x320080[_0xc3a6('0x5')]&&_0x3a463a[_0xc3a6('0x56')]===_0xc3a6('0x57')&&!_0x470ec1){return _0x3a463a[_0xc3a6('0x58')]({'attributes':['id'],'raw':!![]});}})[_0xc3a6('0x51')](function(_0x5b9963){if(_0x5b9963){if(_0x5b9963[_0xc3a6('0x28')]===0x0){_0x289b83[_0xc3a6('0x4d')](_0xc3a6('0x59'));}else{_0x289b83[_0xc3a6('0x4d')](_0xc3a6('0x5a'),_[_0xc3a6('0x42')](_0x5b9963,'id'));}}})[_0xc3a6('0x51')](function(){return _0x289b83;});}function buildContactsQuery(_0x28964d,_0x5eb55e,_0x127631,_0x33a7e7,_0x3bd6ff,_0x24975a){if(_0x5eb55e){_0x5eb55e=_0x127631[_0xc3a6('0x5b')];}_0x28964d=addFieldsToQuery(_0x28964d,_0x5eb55e,_0x33a7e7,_0x24975a,!![]);var _0x158aa3=squel[_0xc3a6('0x9')]();_0x158aa3=addFieldsToQuery(_0x158aa3,_0x5eb55e,_0x33a7e7,_0x24975a,![]);if(_0x33a7e7||_0x24975a){_0x28964d=applyJoinClauses(_0x28964d,!![]);_0x28964d[_0xc3a6('0x5c')](_0xc3a6('0x5d'));if(_0x127631[_0xc3a6('0x5e')]){_0x158aa3[_0xc3a6('0x5e')](_0x127631[_0xc3a6('0x5e')]);}if(_0x127631['offset']){_0x158aa3[_0xc3a6('0x5f')](_0x127631[_0xc3a6('0x5f')]);}}else{_0x158aa3=applyJoinClauses(_0x158aa3,![]);_0x158aa3['group'](_0xc3a6('0x60'));if(_0x127631[_0xc3a6('0x5e')]){_0x28964d[_0xc3a6('0x5e')](_0x127631[_0xc3a6('0x5e')]);}if(_0x127631[_0xc3a6('0x5f')]){_0x28964d[_0xc3a6('0x5f')](_0x127631[_0xc3a6('0x5f')]);}}_0x158aa3['having'](_0x3bd6ff);if(_0x127631[_0xc3a6('0x61')]){_0x127631['order'][_0xc3a6('0x20')](function(_0x143b55){_0x28964d[_0xc3a6('0x61')]('c.'+_0x143b55[0x0],_0x143b55[0x1]===_0xc3a6('0x62')?![]:!![]);_0x158aa3['order'](_0xc3a6('0x63')+_0x143b55[0x0],_0x143b55[0x1]===_0xc3a6('0x62')?![]:!![]);});}_0x158aa3[_0xc3a6('0xa')](_0x28964d,'subqry');return _0x158aa3;}function getFilteredContacts(_0x4cab09){var _0x5816bf=[];return db['Tag'][_0xc3a6('0x64')]({'attributes':['id',_0xc3a6('0x37'),_0xc3a6('0x65')],'raw':!![]})[_0xc3a6('0x51')](function(_0x30d9da){_0x5816bf=_[_0xc3a6('0x66')](_0x30d9da,'id');var _0x400de6={'type':db['Sequelize']['QueryTypes'][_0xc3a6('0x67')],'model':db[_0xc3a6('0x68')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xc3a6('0x69')][_0xc3a6('0x6a')](_0x4cab09[_0xc3a6('0x6b')](),_0x400de6);})[_0xc3a6('0x51')](function(_0x2bc96b){_0x2bc96b[_0xc3a6('0x20')](function(_0x1a3aea){if(_0x1a3aea[_0xc3a6('0x21')]){_0x1a3aea[_0xc3a6('0x6c')]=[];_0x1a3aea[_0xc3a6('0x21')]['split'](',')['forEach'](function(_0x5aebff){_0x1a3aea['Tags'][_0xc3a6('0x1f')](_0x5816bf[_0x5aebff]);});}delete _0x1a3aea[_0xc3a6('0x21')];});return _0x2bc96b;});}function countFilteredContacts(_0x54b1b6,_0x40594c){var _0x701a80=_0x54b1b6[_0xc3a6('0x6d')]();_0x701a80['field'](_0xc3a6('0x6e'));_0x701a80=applyJoinClauses(_0x701a80,!![]);_0x54b1b6[_0xc3a6('0x5c')]('c.id');var _0x52d999=utils[_0xc3a6('0x25')](_0x40594c);if(!_[_0xc3a6('0x6f')](_0x52d999)){_0x701a80[_0xc3a6('0xc')](_0xc3a6('0x70'),_0x52d999);}var _0x19bb7a={'type':db[_0xc3a6('0x71')][_0xc3a6('0x72')][_0xc3a6('0x67')],'raw':!![]};return db[_0xc3a6('0x69')][_0xc3a6('0x6a')](_0x701a80[_0xc3a6('0x6b')](),_0x19bb7a)[_0xc3a6('0x51')](function(_0x279f0e){return _0x279f0e[0x0][_0xc3a6('0x6e')];});}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 _0x2ba8=['CmContact','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','sequelize','exports','lodash','../parsers/advancedSearch','../../mysqldb','agent','search','ListId','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','mobile','email','CompanyId','createdAt','deletedAt','TagIds','push','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','buildExpression','type','default','value','start','end','map','tags','clause','and','user','uc.UserId\x20=\x20?','skip','some','forEach','c.ListId\x20IN\x20?','concat','Contact','\x20=\x20?','resolve','then','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','Tag','findAll','color','keyBy','Sequelize','QueryTypes','SELECT'];(function(_0x58f1ed,_0x9666bb){var _0x65bc52=function(_0x229464){while(--_0x229464){_0x58f1ed['push'](_0x58f1ed['shift']());}};_0x65bc52(++_0x9666bb);}(_0x2ba8,0x14d));var _0x82ba=function(_0xb1b667,_0x416ddf){_0xb1b667=_0xb1b667-0x0;var _0xad0c7b=_0x2ba8[_0xb1b667];return _0xad0c7b;};'use strict';var _=require(_0x82ba('0x0'));var squel=require('squel');var as=require(_0x82ba('0x1'));var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0x82ba('0x2'))['db'];function skipContactsQuery(_0x55bdf4,_0x2150df){var _0x4faef7=![];if(_0x55bdf4['role']===_0x82ba('0x3')&&!_0x2150df[_0x82ba('0x4')]&&!_0x2150df[_0x82ba('0x5')]&&_0x2150df[_0x82ba('0x6')]!==_0x82ba('0x7')){_0x4faef7=!![];}return _0x4faef7;}function getContactsSubquery(){return squel['select']()[_0x82ba('0x8')](_0x82ba('0x9'),'c')[_0x82ba('0xa')](_0x82ba('0xb'));}function applyJoinClauses(_0x5a711b,_0x25b965){var _0x2fa1ba=_0x25b965?'c':_0x82ba('0xc');_0x5a711b[_0x82ba('0xd')](_0x82ba('0xe'),'uc',_0x82ba('0xf')+_0x2fa1ba+'.id')[_0x82ba('0xd')](_0x82ba('0x10'),'ct',_0x82ba('0x11')+_0x2fa1ba+_0x82ba('0x12'))[_0x82ba('0xd')](_0x82ba('0x13'),'t',_0x82ba('0x14'));return _0x5a711b;}function addFieldsToQuery(_0x71de03,_0x1b2984,_0x36eddd,_0x4076f7,_0x4f1de9){var _0x3cb1e9=_0x4f1de9?'c':_0x82ba('0xc');if(!_0x1b2984){_0x1b2984=['id',_0x82ba('0x15'),_0x82ba('0x16'),'phone',_0x82ba('0x17'),'fax',_0x82ba('0x18'),'ListId',_0x82ba('0x19'),_0x82ba('0x1a'),'updatedAt',_0x82ba('0x1b'),_0x82ba('0x1c')];}else if(!_0x1b2984['includes']('id')){_0x1b2984[_0x82ba('0x1d')]('id');}var _0x395aba=_0x36eddd&&_0x4f1de9||!_0x36eddd&&!_0x4f1de9;if(_0x4076f7){_0x395aba=_0x4076f7&&_0x4f1de9||!_0x4076f7&&!_0x4f1de9;}_0x1b2984['forEach'](function(_0x1deee3){if(_0x1deee3===_0x82ba('0x1c')){if(_0x395aba){_0x71de03['field'](_0x82ba('0x1e'),_0x1deee3);}else if(_0x36eddd||_0x4076f7){_0x71de03[_0x82ba('0x1f')](_0x3cb1e9+'.'+_0x1deee3);}}else{_0x71de03[_0x82ba('0x1f')](_0x3cb1e9+'.'+_0x1deee3);}});return _0x71de03;}function getSqlClauses(){var _0x32702b={'default':squel['expr'](),'fields':squel[_0x82ba('0x20')](),'filter':squel[_0x82ba('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x82ba('0x20')](),'skip':![]}};return _0x32702b;}function parseTagParameter(_0x307542){var _0x30f25c=squel[_0x82ba('0x20')]();if(_0x307542){var _0x12cb89=utils[_0x82ba('0x21')](_0x307542);_0x12cb89['forEach'](function(_0x49a3ec){_0x30f25c['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x49a3ec+',%');});}return _0x30f25c;}function parseSearchFilter(_0x59f3f8){var _0x4f3db8=squel[_0x82ba('0x20')]();if(_0x59f3f8){var _0x519cd4=_0x59f3f8[_0x82ba('0x22')]('\x5c','\x5c\x5c')[_0x82ba('0x22')](/'/g,'\x27\x27');if(_0x519cd4[_0x82ba('0x23')]('\x20')[_0x82ba('0x24')]>0x1){_0x4f3db8['or'](_0x82ba('0x25'),qs['getFullTextValue'](_0x519cd4),null);}else{if(qs[_0x82ba('0x26')](_0x519cd4)){_0x4f3db8['or'](_0x82ba('0x27'),_0x519cd4+'%');_0x4f3db8['or'](_0x82ba('0x28'),_0x519cd4+'%');_0x4f3db8['or'](_0x82ba('0x29'),_0x519cd4+'%');_0x4f3db8['or']('c.fax\x20LIKE\x20?',_0x519cd4+'%');}else if(qs[_0x82ba('0x2a')](_0x519cd4)){_0x4f3db8['or']('c.email\x20LIKE\x20?',_0x519cd4+'%');}else{_0x4f3db8['or'](_0x82ba('0x2b'),'%'+_0x519cd4+'%');_0x4f3db8['or'](_0x82ba('0x2c'),'%'+_0x519cd4+'%');_0x4f3db8['or'](_0x82ba('0x2d'),'%'+_0x519cd4+'%');}}}return _0x4f3db8;}function parseAdvancedSearchFilter(_0xb6e05,_0x17cd1e){var _0x66321a=getSqlClauses();var _0x5bde71=as[_0x82ba('0x2e')](_0xb6e05);var _0x18252e=_0x5bde71[_0x82ba('0x2f')];for(var _0x348deb=0x0;_0x348deb<_0x5bde71['conditions'][_0x82ba('0x24')];_0x348deb++){var _0x3f6e41=_0x5bde71[_0x82ba('0x30')][_0x348deb];var _0x29df75='c';var _0x455adb=_[_0x82ba('0x31')](_0x17cd1e,[_0x82ba('0x32'),_0x3f6e41[_0x82ba('0x1f')]]);if(_0x455adb){if(_0x3f6e41[_0x82ba('0x1f')]===_0x82ba('0x33')||_0x455adb[_0x82ba('0x34')]===_0x82ba('0x35')){_0x3f6e41['castTo']=_0x82ba('0x36');}var _0xcb559=as[_0x82ba('0x37')](_0x29df75,_0x455adb[_0x82ba('0x38')],_0x3f6e41);_0x66321a[_0x82ba('0x39')][_0x18252e](_0xcb559['text'],_0xcb559[_0x82ba('0x3a')][_0x82ba('0x3b')],_0xcb559['value'][_0x82ba('0x3c')]);}else{if(_0x3f6e41[_0x82ba('0x1f')]==='Tag'){var _0x209c5b=_0x3f6e41['value'][_0x82ba('0x23')](',')[_0x82ba('0x3d')](function(_0x42cc67){return Number(_0x42cc67);});var _0x3b2c5f=parseTagParameter(_0x209c5b);_0x66321a[_0x82ba('0x3e')][_0x82ba('0x3f')][_0x82ba('0x40')](_0x3b2c5f);_0x66321a[_0x82ba('0x3e')]['ids']=_0x209c5b;}else if(_0x3f6e41[_0x82ba('0x1f')]==='User'){_0x66321a[_0x82ba('0x41')][_0x82ba('0x3f')][_0x82ba('0x40')](_0x82ba('0x42'),_0x3f6e41['value']);_0x66321a[_0x82ba('0x41')][_0x82ba('0x43')]=!![];}}}return _0x66321a;}function parseModelFields(_0x3f7b7e,_0x168cfc){var _0x16d06b=squel[_0x82ba('0x20')]();var _0x2d1790=_(_0x3f7b7e)['keys']()['map'](function(_0x28f350){return _[_0x82ba('0x44')](_0x168cfc,['name',_0x28f350])?_0x28f350:undefined;})['compact']()['value']();if(_0x3f7b7e['Contact']){_0x2d1790[_0x82ba('0x1d')]('Contact');}if(_0x2d1790[_0x82ba('0x24')]>0x0){_0x2d1790[_0x82ba('0x45')](function(_0xf88ba5){if(_0xf88ba5===_0x82ba('0x5')){_0x16d06b[_0x82ba('0x40')](_0x82ba('0x46'),[][_0x82ba('0x47')](_0x3f7b7e[_0xf88ba5]));}else if(_0xf88ba5===_0x82ba('0x48')){var _0x55e7b5='%'+_0x3f7b7e[_0xf88ba5]+'%';_0x16d06b[_0x82ba('0x40')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x55e7b5);}else{_0x16d06b[_0x82ba('0x40')]('c.'+_0xf88ba5+_0x82ba('0x49'),_0x3f7b7e[_0xf88ba5]);}});}return _0x16d06b;}function parseQueryParameters(_0xbe58da,_0x40bfcd){var _0x6b00e8=getSqlClauses();return Promise[_0x82ba('0x4a')]()[_0x82ba('0x4b')](function(){return parseModelFields(_0xbe58da,_0x40bfcd);})[_0x82ba('0x4b')](function(_0x423104){_0x6b00e8['fields'][_0x82ba('0x40')](_0x423104);return parseTagParameter(_0xbe58da[_0x82ba('0x4c')]);})['then'](function(_0x415b49){_0x6b00e8['tags'][_0x82ba('0x3f')][_0x82ba('0x40')](_0x415b49);return parseSearchFilter(_0xbe58da[_0x82ba('0x4d')]);})[_0x82ba('0x4b')](function(_0x23c1cd){_0x6b00e8[_0x82ba('0x4d')]=_0x23c1cd;return _0x6b00e8;});}function checkListsRestrictions(_0x280bb0,_0x29fc61,_0x1837e3){var _0x2de94a=squel[_0x82ba('0x20')]();return Promise['resolve']()[_0x82ba('0x4b')](function(){if(_0x29fc61[_0x82ba('0x4')]&&_0x280bb0[_0x82ba('0x4e')]===_0x82ba('0x3')&&!_0x1837e3){return _0x280bb0[_0x82ba('0x4f')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x25bc75){if(_0x25bc75){if(_0x25bc75[_0x82ba('0x24')]===0x0){_0x2de94a[_0x82ba('0x40')](_0x82ba('0x50'));}else{_0x2de94a['and'](_0x82ba('0x46'),_[_0x82ba('0x3d')](_0x25bc75,'id'));}}})[_0x82ba('0x4b')](function(){return _0x2de94a;});}function buildContactsQuery(_0x3512bb,_0x2e98e7,_0x194443,_0x987271,_0x4a8e01,_0x2f80ef){if(_0x2e98e7){_0x2e98e7=_0x194443[_0x82ba('0x51')];}_0x3512bb=addFieldsToQuery(_0x3512bb,_0x2e98e7,_0x987271,_0x2f80ef,!![]);var _0x5e2c0c=squel[_0x82ba('0x52')]();_0x5e2c0c=addFieldsToQuery(_0x5e2c0c,_0x2e98e7,_0x987271,_0x2f80ef,![]);if(_0x987271||_0x2f80ef){_0x3512bb=applyJoinClauses(_0x3512bb,!![]);_0x3512bb[_0x82ba('0x53')](_0x82ba('0x54'));if(_0x194443['limit']){_0x5e2c0c[_0x82ba('0x55')](_0x194443[_0x82ba('0x55')]);}if(_0x194443[_0x82ba('0x56')]){_0x5e2c0c['offset'](_0x194443[_0x82ba('0x56')]);}}else{_0x5e2c0c=applyJoinClauses(_0x5e2c0c,![]);_0x5e2c0c[_0x82ba('0x53')](_0x82ba('0x57'));if(_0x194443[_0x82ba('0x55')]){_0x3512bb[_0x82ba('0x55')](_0x194443['limit']);}if(_0x194443[_0x82ba('0x56')]){_0x3512bb[_0x82ba('0x56')](_0x194443[_0x82ba('0x56')]);}}_0x5e2c0c[_0x82ba('0x58')](_0x4a8e01);if(_0x194443[_0x82ba('0x59')]){_0x194443['order'][_0x82ba('0x45')](function(_0x49e3a2){_0x3512bb[_0x82ba('0x59')]('c.'+_0x49e3a2[0x0],_0x49e3a2[0x1]===_0x82ba('0x5a')?![]:!![]);_0x5e2c0c['order'](_0x82ba('0x5b')+_0x49e3a2[0x0],_0x49e3a2[0x1]===_0x82ba('0x5a')?![]:!![]);});}_0x5e2c0c[_0x82ba('0x8')](_0x3512bb,'subqry');return _0x5e2c0c;}function getFilteredContacts(_0x220953){var _0x249190=[];return db[_0x82ba('0x5c')][_0x82ba('0x5d')]({'attributes':['id',_0x82ba('0x32'),_0x82ba('0x5e')],'raw':!![]})[_0x82ba('0x4b')](function(_0x56b666){_0x249190=_[_0x82ba('0x5f')](_0x56b666,'id');var _0x579792={'type':db[_0x82ba('0x60')][_0x82ba('0x61')][_0x82ba('0x62')],'model':db[_0x82ba('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x82ba('0x64')](_0x220953[_0x82ba('0x65')](),_0x579792);})[_0x82ba('0x4b')](function(_0xb2d33c){_0xb2d33c[_0x82ba('0x45')](function(_0x3a05c7){if(_0x3a05c7[_0x82ba('0x1c')]){_0x3a05c7['Tags']=[];_0x3a05c7['TagIds'][_0x82ba('0x23')](',')[_0x82ba('0x45')](function(_0x2aea58){_0x3a05c7[_0x82ba('0x66')][_0x82ba('0x1d')](_0x249190[_0x2aea58]);});}delete _0x3a05c7[_0x82ba('0x1c')];});return _0xb2d33c;});}function countFilteredContacts(_0x3d8015,_0x1cd46c){var _0xee6135=_0x3d8015['clone']();_0xee6135[_0x82ba('0x1f')](_0x82ba('0x67'));_0xee6135=applyJoinClauses(_0xee6135,!![]);_0x3d8015['group'](_0x82ba('0x54'));var _0x1acbad=utils[_0x82ba('0x21')](_0x1cd46c);if(!_[_0x82ba('0x68')](_0x1acbad)){_0xee6135['where'](_0x82ba('0x69'),_0x1acbad);}var _0x4d7cb2={'type':db[_0x82ba('0x60')][_0x82ba('0x61')][_0x82ba('0x62')],'raw':!![]};return db[_0x82ba('0x6a')]['query'](_0xee6135[_0x82ba('0x65')](),_0x4d7cb2)[_0x82ba('0x4b')](function(_0x43e8a5){return _0x43e8a5[0x0][_0x82ba('0x67')];});}module[_0x82ba('0x6b')]={'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 226b397..8bae089 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 _0x34ac=['hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','write','final','binary','close','unlink','decryptFile','createReadStream','createDecipher','end','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','secrets','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf'];(function(_0x203794,_0xbe425f){var _0x3b2011=function(_0xd2ca8d){while(--_0xd2ca8d){_0x203794['push'](_0x203794['shift']());}};_0x3b2011(++_0xbe425f);}(_0x34ac,0xe6));var _0xc34a=function(_0x59112e,_0x48a4d6){_0x59112e=_0x59112e-0x0;var _0x56cf0e=_0x34ac[_0x59112e];return _0x56cf0e;};'use strict';var crypto=require(_0xc34a('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xc34a('0x1'));var config=require(_0xc34a('0x2'));var logger=require(_0xc34a('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc34a('0x4')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xc34a('0x5')};if(config[_0xc34a('0x6')]&&config[_0xc34a('0x6')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xc34a('0x6')]['algorithm']);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0xc34a('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc34a('0x8')](',\x20');logger[_0xc34a('0x9')](config[_0xc34a('0x6')][_0xc34a('0x7')],_0xc34a('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x4f9922){return AES_SUPPORTED_RX[_0xc34a('0xb')](_0x4f9922);}function getSupportedCiphers(){return crypto[_0xc34a('0xc')]()[_0xc34a('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1167fc){return getSupportedCiphers()[_0xc34a('0xe')](_0x1167fc)>-0x1;}function combineOptions(_0x9ef368){var _0x3c9197={};for(var _0x89bca4 in fileOptions){if(fileOptions[_0xc34a('0xf')](_0x89bca4)){_0x3c9197[_0x89bca4]=fileOptions[_0x89bca4];}}if(_0x9ef368){for(var _0x3be447 in _0x9ef368){if(_0x9ef368['hasOwnProperty'](_0x3be447)){_0x3c9197[_0x3be447]=_0x9ef368[_0x3be447];}}}return _0x3c9197;}exports[_0xc34a('0x10')]=function(_0x35ea40,_0x30cbd4,_0x5b72e4,_0x19c7e2){return new BPromise(function(_0x20af6f,_0x42205d){_0x19c7e2=combineOptions(_0x19c7e2);var _0x3d47d7=new Buffer(_0x5b72e4);var _0x77a78b=fs['createReadStream'](_0x35ea40);var _0x36ce42=fs[_0xc34a('0x11')](_0x30cbd4);var _0x56546e=crypto[_0xc34a('0x12')](_0x19c7e2[_0xc34a('0x7')],_0x3d47d7);_0x77a78b['on'](_0xc34a('0x13'),function(_0x255824){var _0x2a4615=new Buffer(_0x56546e[_0xc34a('0x14')](_0x255824),'binary');_0x36ce42[_0xc34a('0x15')](_0x2a4615);});_0x77a78b['on']('end',function(){try{var _0x4a3ee1=new Buffer(_0x56546e[_0xc34a('0x16')]('binary'),_0xc34a('0x17'));_0x36ce42[_0xc34a('0x15')](_0x4a3ee1);_0x36ce42['end']();_0x36ce42['on'](_0xc34a('0x18'),function(){return _0x20af6f(_0x30cbd4);});}catch(_0x2d558d){fs[_0xc34a('0x19')](_0x30cbd4);return _0x42205d(_0x2d558d);}});});};exports[_0xc34a('0x1a')]=function(_0x51c14e,_0x490085,_0x5ef329,_0x107111){return new BPromise(function(_0x2ae435,_0x48594b){_0x107111=combineOptions(_0x107111);var _0x27ef3d=new Buffer(_0x5ef329);var _0x26f6cb=fs[_0xc34a('0x1b')](_0x51c14e);var _0x318362=fs['createWriteStream'](_0x490085);var _0x441776=crypto[_0xc34a('0x1c')](_0x107111[_0xc34a('0x7')],_0x27ef3d);_0x26f6cb['on'](_0xc34a('0x13'),function(_0x2e461e){var _0x4c7197=new Buffer(_0x441776[_0xc34a('0x14')](_0x2e461e),_0xc34a('0x17'));_0x318362['write'](_0x4c7197);});_0x26f6cb['on'](_0xc34a('0x1d'),function(){try{var _0x1d4e43=new Buffer(_0x441776[_0xc34a('0x16')](_0xc34a('0x17')),_0xc34a('0x17'));_0x318362['write'](_0x1d4e43);_0x318362[_0xc34a('0x1d')]();_0x318362['on'](_0xc34a('0x18'),function(){return _0x2ae435(_0x490085);});}catch(_0x501cb3){fs[_0xc34a('0x19')](_0x490085);return _0x48594b(_0x501cb3);}});});};exports[_0xc34a('0x1e')]=function(_0x4abebe,_0x42144e,_0x1f753e){var _0x50f947=_0x1f753e||stringOptions[_0xc34a('0x7')];var _0x3734c5=_0x42144e||stringOptions[_0xc34a('0x1f')];var _0x2be131=crypto[_0xc34a('0x12')](_0x50f947,_0x3734c5);var _0x3a0a05=_0x2be131[_0xc34a('0x14')](_0x4abebe,_0xc34a('0x20'),_0xc34a('0x21'));_0x3a0a05+=_0x2be131['final'](_0xc34a('0x21'));return _0x3a0a05;};exports[_0xc34a('0x22')]=function(_0x4ba1f6,_0x3fe9ba,_0x3d877f){var _0x406ebd=_0x3d877f||stringOptions['algorithm'];var _0x67878d=_0x3fe9ba||stringOptions[_0xc34a('0x1f')];var _0x2315c3=crypto[_0xc34a('0x1c')](_0x406ebd,_0x67878d);var _0x2255f0=_0x2315c3[_0xc34a('0x14')](_0x4ba1f6,_0xc34a('0x21'),_0xc34a('0x20'));_0x2255f0+=_0x2315c3[_0xc34a('0x16')]('utf8');return _0x2255f0;}; \ No newline at end of file +var _0xca9b=['app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher','data','update','binary','write','final','end','close','unlink','createReadStream','createWriteStream','createDecipher','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger'];(function(_0x1c6efe,_0x262d82){var _0x54d3cd=function(_0x56d365){while(--_0x56d365){_0x1c6efe['push'](_0x1c6efe['shift']());}};_0x54d3cd(++_0x262d82);}(_0xca9b,0x67));var _0xbca9=function(_0xf3ce91,_0xcaf56a){_0xf3ce91=_0xf3ce91-0x0;var _0x4088d9=_0xca9b[_0xf3ce91];return _0x4088d9;};'use strict';var crypto=require(_0xbca9('0x0'));var fs=require('fs');var BPromise=require(_0xbca9('0x1'));var _=require(_0xbca9('0x2'));var config=require(_0xbca9('0x3'));var logger=require(_0xbca9('0x4'))(_0xbca9('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xbca9('0x6')][_0xbca9('0x7')],'algorithm':_0xbca9('0x8')};const fileOptions={'algorithm':_0xbca9('0x9')};if(config[_0xbca9('0xa')]&&config[_0xbca9('0xa')][_0xbca9('0xb')]){var isSupported=isAlgorithmSupported(config[_0xbca9('0xa')][_0xbca9('0xb')]);if(isSupported){fileOptions[_0xbca9('0xb')]=config['encrypt'][_0xbca9('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xbca9('0xc')](',\x20');logger['error'](config[_0xbca9('0xa')][_0xbca9('0xb')],_0xbca9('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x2bf2cb){return AES_SUPPORTED_RX[_0xbca9('0xe')](_0x2bf2cb);}function getSupportedCiphers(){return crypto[_0xbca9('0xf')]()[_0xbca9('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x26bd86){return getSupportedCiphers()[_0xbca9('0x11')](_0x26bd86)>-0x1;}function combineOptions(_0x229619){var _0x3ab9e9={};for(var _0x2501cd in fileOptions){if(fileOptions[_0xbca9('0x12')](_0x2501cd)){_0x3ab9e9[_0x2501cd]=fileOptions[_0x2501cd];}}if(_0x229619){for(var _0x35320a in _0x229619){if(_0x229619['hasOwnProperty'](_0x35320a)){_0x3ab9e9[_0x35320a]=_0x229619[_0x35320a];}}}return _0x3ab9e9;}exports[_0xbca9('0x13')]=function(_0x7ef28b,_0x4745da,_0x2107a3,_0x435f33){return new BPromise(function(_0x38ca68,_0xc7e5bd){_0x435f33=combineOptions(_0x435f33);var _0x4858b1=new Buffer(_0x2107a3);var _0x1d9970=fs['createReadStream'](_0x7ef28b);var _0x1cc285=fs['createWriteStream'](_0x4745da);var _0x3a8c3f=crypto[_0xbca9('0x14')](_0x435f33[_0xbca9('0xb')],_0x4858b1);_0x1d9970['on'](_0xbca9('0x15'),function(_0x2b448){var _0x2063c2=new Buffer(_0x3a8c3f[_0xbca9('0x16')](_0x2b448),_0xbca9('0x17'));_0x1cc285[_0xbca9('0x18')](_0x2063c2);});_0x1d9970['on']('end',function(){try{var _0x317289=new Buffer(_0x3a8c3f[_0xbca9('0x19')](_0xbca9('0x17')),_0xbca9('0x17'));_0x1cc285[_0xbca9('0x18')](_0x317289);_0x1cc285[_0xbca9('0x1a')]();_0x1cc285['on'](_0xbca9('0x1b'),function(){return _0x38ca68(_0x4745da);});}catch(_0x4eb00c){fs[_0xbca9('0x1c')](_0x4745da);return _0xc7e5bd(_0x4eb00c);}});});};exports['decryptFile']=function(_0x3a5186,_0x545b88,_0x19abe5,_0x2f193f){return new BPromise(function(_0x24c168,_0x1bcab2){_0x2f193f=combineOptions(_0x2f193f);var _0x56d839=new Buffer(_0x19abe5);var _0x21a481=fs[_0xbca9('0x1d')](_0x3a5186);var _0x559817=fs[_0xbca9('0x1e')](_0x545b88);var _0x3d09b5=crypto[_0xbca9('0x1f')](_0x2f193f[_0xbca9('0xb')],_0x56d839);_0x21a481['on']('data',function(_0x2eeda4){var _0xf5539b=new Buffer(_0x3d09b5[_0xbca9('0x16')](_0x2eeda4),'binary');_0x559817['write'](_0xf5539b);});_0x21a481['on'](_0xbca9('0x1a'),function(){try{var _0x5aa700=new Buffer(_0x3d09b5[_0xbca9('0x19')]('binary'),_0xbca9('0x17'));_0x559817[_0xbca9('0x18')](_0x5aa700);_0x559817[_0xbca9('0x1a')]();_0x559817['on'](_0xbca9('0x1b'),function(){return _0x24c168(_0x545b88);});}catch(_0x2b458b){fs[_0xbca9('0x1c')](_0x545b88);return _0x1bcab2(_0x2b458b);}});});};exports['encryptString']=function(_0x5c01bf,_0x375143,_0x10fb2f){var _0x46d7a3=_0x10fb2f||stringOptions[_0xbca9('0xb')];var _0x3f9030=_0x375143||stringOptions[_0xbca9('0x20')];var _0x3ee4e6=crypto[_0xbca9('0x14')](_0x46d7a3,_0x3f9030);var _0x4d6dbf=_0x3ee4e6[_0xbca9('0x16')](_0x5c01bf,_0xbca9('0x21'),_0xbca9('0x22'));_0x4d6dbf+=_0x3ee4e6[_0xbca9('0x19')](_0xbca9('0x22'));return _0x4d6dbf;};exports[_0xbca9('0x23')]=function(_0x137eb0,_0x3be521,_0x167907){var _0x17cf8b=_0x167907||stringOptions[_0xbca9('0xb')];var _0x54ea0d=_0x3be521||stringOptions[_0xbca9('0x20')];var _0x3d4d1b=crypto[_0xbca9('0x1f')](_0x17cf8b,_0x54ea0d);var _0x8df03c=_0x3d4d1b[_0xbca9('0x16')](_0x137eb0,_0xbca9('0x22'),_0xbca9('0x21'));_0x8df03c+=_0x3d4d1b['final'](_0xbca9('0x21'));return _0x8df03c;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d340f54..ce8f9c1 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 _0x586f=['../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','range','num','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','dirname','basename','.csv','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','zip\x20finished','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0x586f,0x198));var _0xf586=function(_0x4ff24f,_0x5b177e){_0x4ff24f=_0x4ff24f-0x0;var _0x1413ab=_0x586f[_0x4ff24f];return _0x1413ab;};'use strict';var util=require(_0xf586('0x0'));var path=require('path');var _=require(_0xf586('0x1'));var csv=require(_0xf586('0x2'));var fs=require('fs');var BPromise=require(_0xf586('0x3'));var zipdir=require(_0xf586('0x4'));var rimraf=require(_0xf586('0x5'));var db=require(_0xf586('0x6'))['db'];var dbH=require('../../mysqldb')[_0xf586('0x7')];var logger=require(_0xf586('0x8'))(_0xf586('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf586('0xa')][0x3];var PATH=process[_0xf586('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1a071f,_0xdce3fa){var _0x282c84={'status':_0x1a071f};var _0x4c9031={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xdce3fa){_0x282c84[_0xf586('0xb')]=_0xdce3fa;}return db[_0xf586('0xc')][_0xf586('0xd')](_0x282c84,_0x4c9031);}function main(){var _0x154bb5=0x1388;var _0x299a8e;logger[_0xf586('0xe')](util[_0xf586('0xf')](_0xf586('0x10'),EXTRACTED_REPORT_ID,_0xf586('0x11')));return db[_0xf586('0x12')][_0xf586('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf586('0x14'),_0xf586('0x15')]})[_0xf586('0x16')](function(_0x29415d){if(_0x29415d){_0x299a8e=_0x29415d;_0x154bb5=_0x299a8e[_0xf586('0x15')]||0x1388;}})[_0xf586('0x16')](function(){return dbH[_0xf586('0x17')]['query'](util[_0xf586('0xf')](_0xf586('0x18'),QUERY),{'type':dbH[_0xf586('0x17')]['QueryTypes']['SELECT']});})[_0xf586('0x16')](function(_0x2921bc){if(!_0x2921bc[0x0]['num']){return analyticExtractedReport('Empty');}var _0x16bcce=[];var _0x21f6bd=0x0;if(_0x299a8e['split']){if(_0x2921bc&&_0x2921bc['length']){var _0x371932=_[_0xf586('0x19')](_0x2921bc[0x0][_0xf586('0x1a')]/_0x154bb5);var _0x463c96=Number[_0xf586('0x1b')](_0x2921bc[0x0][_0xf586('0x1a')]/_0x154bb5)?_0x2921bc[0x0][_0xf586('0x1a')]%_0x154bb5:0x0;_0x371932['forEach'](function(_0x2ff360){if(_0x2ff360>0x0){_0x21f6bd+=_0x154bb5;}_0x16bcce['push'](dbH[_0xf586('0x17')][_0xf586('0x1c')](util['format'](_0xf586('0x1d'),QUERY,_0x154bb5,_0x21f6bd),{'type':dbH[_0xf586('0x17')][_0xf586('0x1e')]['SELECT']}));});if(_0x463c96>0x0){_0x21f6bd+=_0x154bb5;_0x16bcce[_0xf586('0x1f')](dbH[_0xf586('0x17')][_0xf586('0x1c')](util['format'](_0xf586('0x1d'),QUERY,_0x463c96,_0x21f6bd),{'type':dbH[_0xf586('0x17')][_0xf586('0x1e')][_0xf586('0x20')]}));}}}else{_0x16bcce[_0xf586('0x1f')](dbH[_0xf586('0x17')]['query'](QUERY,{'type':dbH[_0xf586('0x17')][_0xf586('0x1e')][_0xf586('0x20')]}));}var _0x50bf3b=path[_0xf586('0x21')](PATH);var _0x305532=path[_0xf586('0x22')](PATH,_0xf586('0x23'));var _0x1da901=_0x299a8e[_0xf586('0x14')]&&_0x16bcce[_0xf586('0x24')]>0x1;var _0x431fc1=[];if(!fs[_0xf586('0x25')](path[_0xf586('0x26')](_0x50bf3b,_0x305532))&&_0x1da901){fs[_0xf586('0x27')](path['join'](_0x50bf3b,_0x305532));}return BPromise[_0xf586('0x28')](_0x16bcce,function(_0x2db8a1){_0x431fc1[_0xf586('0x1f')](_0x2db8a1);})[_0xf586('0x16')](function(){for(var _0x171c8d=0x0;_0x171c8d<_0x431fc1[_0xf586('0x24')];_0x171c8d+=0x1){var _0x345429;var _0x15220d=_0x431fc1[_0x171c8d];if(_0x1da901){_0x345429=path[_0xf586('0x26')](_0x50bf3b,_0x305532,util['format'](_0xf586('0x29'),_0x305532,_0x171c8d,_0xf586('0x2a')));}else{_0x345429=path[_0xf586('0x26')](_0x50bf3b,util['format']('%s.%s',_0x305532,'csv'));}fs[_0xf586('0x2b')](_0x345429,csv(_0x15220d));}})[_0xf586('0x16')](function(){if(_0x1da901){return new Promise(function(_0x14e252){zipdir(path['join'](_0x50bf3b,_0x305532),{'saveTo':path[_0xf586('0x26')](_0x50bf3b,util[_0xf586('0xf')]('%s.%s',_0x305532,'zip'))},function(_0x431110,_0x2f5beb){rimraf(path[_0xf586('0x26')](_0x50bf3b,_0x305532),function(){});_0x14e252(_0xf586('0x2c'));});});}})['then'](function(){logger[_0xf586('0xe')](util[_0xf586('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf586('0x11')));return analyticExtractedReport('Completed',_0x1da901?util[_0xf586('0xf')](_0xf586('0x2d'),_0x305532,_0x1da901?_0xf586('0x2e'):_0xf586('0x2a')):null);});})[_0xf586('0x2f')](function(_0x3be26c){logger['info'](util[_0xf586('0xf')](_0xf586('0x30'),EXTRACTED_REPORT_ID,'CSV'),util[_0xf586('0x31')](_0x3be26c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf586('0x32'));})['finally'](function(){process[_0xf586('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x40ea=['update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','push','dirname','basename','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport'];(function(_0x315239,_0x1bd801){var _0xa1e160=function(_0x425438){while(--_0x425438){_0x315239['push'](_0x315239['shift']());}};_0xa1e160(++_0x1bd801);}(_0x40ea,0x1c8));var _0xa40e=function(_0x12fc29,_0x3fcbd6){_0x12fc29=_0x12fc29-0x0;var _0x59076c=_0x40ea[_0x12fc29];return _0x59076c;};'use strict';var util=require(_0xa40e('0x0'));var path=require('path');var _=require(_0xa40e('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xa40e('0x2'));var zipdir=require(_0xa40e('0x3'));var rimraf=require(_0xa40e('0x4'));var db=require(_0xa40e('0x5'))['db'];var dbH=require('../../mysqldb')[_0xa40e('0x6')];var logger=require(_0xa40e('0x7'))(_0xa40e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xa40e('0x9')][0x2]);var QUERY=process[_0xa40e('0x9')][0x3];var PATH=process[_0xa40e('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1b4d0c,_0x279e33){var _0x33bccb={'status':_0x1b4d0c};var _0x478983={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x279e33){_0x33bccb[_0xa40e('0xa')]=_0x279e33;}return db[_0xa40e('0xb')][_0xa40e('0xc')](_0x33bccb,_0x478983);}function main(){var _0x5ae44c=0x1388;var _0x399b7a;logger[_0xa40e('0xd')](util[_0xa40e('0xe')](_0xa40e('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xa40e('0x10')][_0xa40e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa40e('0x12'),_0xa40e('0x13')]})[_0xa40e('0x14')](function(_0x5b9b19){if(_0x5b9b19){_0x399b7a=_0x5b9b19;_0x5ae44c=_0x399b7a[_0xa40e('0x13')]||0x1388;}})[_0xa40e('0x14')](function(){return dbH[_0xa40e('0x15')][_0xa40e('0x16')](util[_0xa40e('0xe')](_0xa40e('0x17'),QUERY),{'type':dbH[_0xa40e('0x15')]['QueryTypes']['SELECT']});})[_0xa40e('0x14')](function(_0x52acb1){if(!_0x52acb1[0x0][_0xa40e('0x18')]){return analyticExtractedReport(_0xa40e('0x19'));}var _0x305a22=[];var _0x3d7b01=0x0;if(_0x399b7a[_0xa40e('0x12')]){if(_0x52acb1&&_0x52acb1[_0xa40e('0x1a')]){var _0x4eb1e2=_[_0xa40e('0x1b')](_0x52acb1[0x0][_0xa40e('0x18')]/_0x5ae44c);var _0x551282=Number[_0xa40e('0x1c')](_0x52acb1[0x0]['num']/_0x5ae44c)?_0x52acb1[0x0][_0xa40e('0x18')]%_0x5ae44c:0x0;_0x4eb1e2[_0xa40e('0x1d')](function(_0x541c57){if(_0x541c57>0x0){_0x3d7b01+=_0x5ae44c;}_0x305a22['push'](dbH[_0xa40e('0x15')][_0xa40e('0x16')](util['format'](_0xa40e('0x1e'),QUERY,_0x5ae44c,_0x3d7b01),{'type':dbH[_0xa40e('0x15')][_0xa40e('0x1f')][_0xa40e('0x20')]}));});if(_0x551282>0x0){_0x3d7b01+=_0x5ae44c;_0x305a22[_0xa40e('0x21')](dbH[_0xa40e('0x15')][_0xa40e('0x16')](util[_0xa40e('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x551282,_0x3d7b01),{'type':dbH[_0xa40e('0x15')]['QueryTypes'][_0xa40e('0x20')]}));}}}else{_0x305a22[_0xa40e('0x21')](dbH[_0xa40e('0x15')][_0xa40e('0x16')](QUERY,{'type':dbH[_0xa40e('0x15')]['QueryTypes'][_0xa40e('0x20')]}));}var _0x48e928=path[_0xa40e('0x22')](PATH);var _0x53582b=path[_0xa40e('0x23')](PATH,'.csv');var _0x233c51=_0x399b7a[_0xa40e('0x12')]&&_0x305a22[_0xa40e('0x1a')]>0x1;var _0x4bff6c=[];if(!fs[_0xa40e('0x24')](path[_0xa40e('0x25')](_0x48e928,_0x53582b))&&_0x233c51){fs[_0xa40e('0x26')](path[_0xa40e('0x25')](_0x48e928,_0x53582b));}return BPromise[_0xa40e('0x27')](_0x305a22,function(_0x407200){_0x4bff6c[_0xa40e('0x21')](_0x407200);})[_0xa40e('0x14')](function(){for(var _0x596d68=0x0;_0x596d68<_0x4bff6c[_0xa40e('0x1a')];_0x596d68+=0x1){var _0x364a1b;var _0x611d8a=_0x4bff6c[_0x596d68];if(_0x233c51){_0x364a1b=path['join'](_0x48e928,_0x53582b,util[_0xa40e('0xe')]('%s%d.%s',_0x53582b,_0x596d68,_0xa40e('0x28')));}else{_0x364a1b=path[_0xa40e('0x25')](_0x48e928,util[_0xa40e('0xe')](_0xa40e('0x29'),_0x53582b,_0xa40e('0x28')));}fs[_0xa40e('0x2a')](_0x364a1b,csv(_0x611d8a));}})[_0xa40e('0x14')](function(){if(_0x233c51){return new Promise(function(_0x3d1aa9){zipdir(path[_0xa40e('0x25')](_0x48e928,_0x53582b),{'saveTo':path[_0xa40e('0x25')](_0x48e928,util['format'](_0xa40e('0x29'),_0x53582b,_0xa40e('0x2b')))},function(_0x1c9a2d,_0x44328b){rimraf(path[_0xa40e('0x25')](_0x48e928,_0x53582b),function(){});_0x3d1aa9(_0xa40e('0x2c'));});});}})[_0xa40e('0x14')](function(){logger['info'](util[_0xa40e('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa40e('0x2d')));return analyticExtractedReport(_0xa40e('0x2e'),_0x233c51?util[_0xa40e('0xe')](_0xa40e('0x29'),_0x53582b,_0x233c51?_0xa40e('0x2b'):'csv'):null);});})[_0xa40e('0x2f')](function(_0x11a56c){logger['info'](util['format'](_0xa40e('0x30'),EXTRACTED_REPORT_ID,_0xa40e('0x2d')),util[_0xa40e('0x31')](_0x11a56c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa40e('0x32')](function(){process[_0xa40e('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 622f14d..95ce702 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 _0x5b0f=['sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','basename','.pdf','split','existsSync','join','then','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','toString','center','Interaction\x20Transcript','pipe','createWriteStream','finish','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','body','push','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','pageBreak','before','margin','landscape','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','range','isInteger','forEach'];(function(_0x2321b9,_0x5071a2){var _0x15897f=function(_0x49e4d6){while(--_0x49e4d6){_0x2321b9['push'](_0x2321b9['shift']());}};_0x15897f(++_0x5071a2);}(_0x5b0f,0x1e2));var _0xf5b0=function(_0x3bcda9,_0x277f01){_0x3bcda9=_0x3bcda9-0x0;var _0x54991f=_0x5b0f[_0x3bcda9];return _0x54991f;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0xf5b0('0x0'));var moment=require(_0xf5b0('0x1'));var htmlToPdfmake=require(_0xf5b0('0x2'));var PdfPrinter=require(_0xf5b0('0x3'));var zipdir=require(_0xf5b0('0x4'));var rimraf=require(_0xf5b0('0x5'));var JSDOM=require(_0xf5b0('0x6'))[_0xf5b0('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0xf5b0('0x8'));var db=require(_0xf5b0('0x9'))['db'];var dbH=require('../../mysqldb')[_0xf5b0('0xa')];var logger=require(_0xf5b0('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf5b0('0xc')][0x3];var PATH=process[_0xf5b0('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5b0('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x360f29,_0x1518f3){var _0x9f7496={'status':_0x360f29};var _0x207c6b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1518f3){_0x9f7496[_0xf5b0('0xe')]=_0x1518f3;}return db[_0xf5b0('0xf')][_0xf5b0('0x10')](_0x9f7496,_0x207c6b);}function getHeaders(_0x20519b){return _[_0xf5b0('0x11')](_0x20519b,function(_0x3eaf60){return{'text':_0x3eaf60,'style':_0xf5b0('0x12')};});}function getRows(_0x10c6a3,_0x5c3484){return _[_0xf5b0('0x11')](_0x5c3484,function(_0x3c88b4){return _(_0x3c88b4)['pick'](_0x10c6a3)['map'](function(_0x358700){return _0x358700?_['toString'](_0x358700):'';})['value']();});}function createTable(_0x38c2e0,_0x336478){var _0x52911c={'widths':_['fill'](Array(_0x38c2e0['length']),0x91),'heights':function(_0x53551e){return _0x53551e===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x579f49=getHeaders(_0x38c2e0);_0x52911c[_0xf5b0('0x13')][_0xf5b0('0x14')](_0x579f49);var _0x45023f=getRows(_0x38c2e0,_0x336478);_0x52911c[_0xf5b0('0x13')]=_0x52911c[_0xf5b0('0x13')]['concat'](_0x45023f);return _0x52911c;}function createTables(_0x1dc581){var _0x55128f=[];var _0x2812e3=_[_0xf5b0('0x15')](Object[_0xf5b0('0x16')](_0x1dc581[0x0]),0x5);_0x2812e3['forEach'](function(_0x293258){_0x55128f[_0xf5b0('0x14')](createTable(_0x293258,_0x1dc581));});return _0x55128f;}function getPDFDocDefinition(_0x581db6){var _0x54f8c1=util[_0xf5b0('0x17')](_0xf5b0('0x18'),NAME,EXTRACTED_REPORT[_0xf5b0('0x19')],moment(EXTRACTED_REPORT[_0xf5b0('0x1a')])[_0xf5b0('0x17')](FORMAT),moment(EXTRACTED_REPORT[_0xf5b0('0x1b')])['format'](FORMAT));var _0x4523fc=[];for(var _0x4ed050=0x0;_0x4ed050<_0x581db6[_0xf5b0('0x1c')];_0x4ed050++){var _0x520601=[];if(_0x4ed050===0x0){_0x520601[_0xf5b0('0x14')]({'text':_0x54f8c1,'style':_0xf5b0('0x1d')});}var _0x103e18={'table':_0x581db6[_0x4ed050]};if(_0x4ed050>0x0){_0x103e18[_0xf5b0('0x1e')]=_0xf5b0('0x1f');_0x103e18[_0xf5b0('0x20')]=[0x0,0x46,0x0,0x0];}_0x520601[_0xf5b0('0x14')](_0x103e18);_0x4523fc[_0xf5b0('0x14')](_0x520601);}return{'pageSize':'A4','pageOrientation':_0xf5b0('0x21'),'content':_0x4523fc,'footer':function(_0x3377f9,_0x18d28e){return{'text':_0x3377f9['toString']()+'\x20/\x20'+_0x18d28e,'style':_0xf5b0('0x22')};},'defaultStyle':{'font':_0xf5b0('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf5b0('0x24')},'footer':{'alignment':_0xf5b0('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3bb376){var _0x5cafaa=0x1388;var _0x421b5f;if(!_0x3bb376[0x0][_0xf5b0('0x26')]){return analyticExtractedReport(_0xf5b0('0x27'));}return db[_0xf5b0('0x28')][_0xf5b0('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf5b0('0x2a')]})['then'](function(_0x121389){if(_0x121389){_0x421b5f=_0x121389;_0x5cafaa=_0x421b5f[_0xf5b0('0x2a')]||0x3e8;}})['then'](function(){var _0x30ffa1=[];var _0x344463=0x0;if(_0x421b5f['split']){if(_0x3bb376&&_0x3bb376[_0xf5b0('0x1c')]){var _0x6ede56=_[_0xf5b0('0x2b')](_0x3bb376[0x0][_0xf5b0('0x26')]/_0x5cafaa);var _0x23f3fe=Number[_0xf5b0('0x2c')](_0x3bb376[0x0][_0xf5b0('0x26')]/_0x5cafaa)?_0x3bb376[0x0][_0xf5b0('0x26')]%_0x5cafaa:0x0;_0x6ede56[_0xf5b0('0x2d')](function(_0x4baf03){if(_0x4baf03>0x0){_0x344463+=_0x5cafaa;}_0x30ffa1['push'](dbH[_0xf5b0('0x2e')]['query'](util['format'](_0xf5b0('0x2f'),QUERY,_0x5cafaa,_0x344463),{'type':dbH['sequelize'][_0xf5b0('0x30')]['SELECT']}));});if(_0x23f3fe>0x0){_0x344463+=_0x5cafaa;_0x30ffa1['push'](dbH['sequelize']['query'](util[_0xf5b0('0x17')](_0xf5b0('0x2f'),QUERY,_0x23f3fe,_0x344463),{'type':dbH[_0xf5b0('0x2e')][_0xf5b0('0x30')][_0xf5b0('0x31')]}));}}}else{_0x30ffa1[_0xf5b0('0x14')](dbH[_0xf5b0('0x2e')][_0xf5b0('0x32')](QUERY,{'type':dbH[_0xf5b0('0x2e')][_0xf5b0('0x30')]['SELECT']}));}var _0x27e8f8=path['dirname'](PATH);var _0x347d82=path[_0xf5b0('0x33')](PATH,_0xf5b0('0x34'));var _0x5df7bd=_0x421b5f[_0xf5b0('0x35')]&&_0x30ffa1[_0xf5b0('0x1c')]>0x1;var _0x300198=[];if(!fs[_0xf5b0('0x36')](path[_0xf5b0('0x37')](_0x27e8f8,_0x347d82))&&_0x5df7bd){fs['mkdirSync'](path[_0xf5b0('0x37')](_0x27e8f8,_0x347d82));}return BPromise['each'](_0x30ffa1,function(_0x56257d){_0x300198['push'](_0x56257d);})[_0xf5b0('0x38')](function(){var _0x3bf362=[];for(var _0x3925c2=0x0;_0x3925c2<_0x300198['length'];_0x3925c2+=0x1){var _0x41118e=_0x300198[_0x3925c2];var _0x3ff6aa=createTables(_[_0xf5b0('0x39')](_0x41118e));var _0x53faf7;var _0x22a065=getPDFDocDefinition(_0x3ff6aa);var _0xeb18e2=getPDFPrinter();var _0x286faa=_0xeb18e2[_0xf5b0('0x3a')](_0x22a065);if(_0x5df7bd){_0x53faf7=path[_0xf5b0('0x37')](_0x27e8f8,_0x347d82,util[_0xf5b0('0x17')](_0xf5b0('0x3b'),_0x347d82,_0x3925c2,_0xf5b0('0x3c')));}else{_0x53faf7=path[_0xf5b0('0x37')](_0x27e8f8,util[_0xf5b0('0x17')](_0xf5b0('0x3d'),_0x347d82,_0xf5b0('0x3c')));}_0x3bf362[_0xf5b0('0x14')](writePDFDocument(_0x286faa,_0x53faf7));}return Promise['all'](_0x3bf362);})[_0xf5b0('0x38')](function(){if(_0x5df7bd){return new Promise(function(_0x472380){zipdir(path['join'](_0x27e8f8,_0x347d82),{'saveTo':path[_0xf5b0('0x37')](_0x27e8f8,util['format']('%s.%s',_0x347d82,_0xf5b0('0x3e')))},function(){rimraf(path['join'](_0x27e8f8,_0x347d82),function(){});_0x472380(_0xf5b0('0x3f'));});});}})[_0xf5b0('0x38')](function(){if(!_0x5df7bd)return;rimraf(path[_0xf5b0('0x37')](_0x27e8f8,_0x347d82),function(){});})[_0xf5b0('0x38')](function(){logger[_0xf5b0('0x40')](util[_0xf5b0('0x17')](_0xf5b0('0x41'),EXTRACTED_REPORT_ID,_0xf5b0('0x42')));return analyticExtractedReport(_0xf5b0('0x43'),_0x5df7bd?util[_0xf5b0('0x17')](_0xf5b0('0x3d'),_0x347d82,_0x5df7bd?_0xf5b0('0x3e'):_0xf5b0('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xf5b0('0x17')](_0xf5b0('0x44'),EXTRACTED_REPORT_ID,_0xf5b0('0x42')));return db[_0xf5b0('0xf')][_0xf5b0('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5b0('0x38')](function(_0x1ba98b){EXTRACTED_REPORT=_0x1ba98b;return dbH['sequelize'][_0xf5b0('0x32')](util[_0xf5b0('0x17')](_0xf5b0('0x46'),QUERY),{'type':dbH[_0xf5b0('0x2e')]['QueryTypes'][_0xf5b0('0x31')]});})[_0xf5b0('0x38')](extractReport)[_0xf5b0('0x47')](function(_0x35e780){logger[_0xf5b0('0x40')](util[_0xf5b0('0x17')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf5b0('0x42')),util[_0xf5b0('0x48')](_0x35e780,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf5b0('0x49'));})[_0xf5b0('0x4a')](function(){process[_0xf5b0('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2b3a99=new PdfPrinter({'Arial':{'normal':__dirname+_0xf5b0('0x4c'),'bold':__dirname+_0xf5b0('0x4d'),'italics':__dirname+_0xf5b0('0x4e'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x2b3a99;}function getPDFDocDefinitionFromHTML(_0x9138f9,_0x29294b){var _0x4d6d78=util[_0xf5b0('0x17')](_0xf5b0('0x4f'),_0x29294b[_0xf5b0('0x50')],_0x29294b['interactionId']);var _0x1ea938=moment()[_0xf5b0('0x17')](_0xf5b0('0x51'))[_0xf5b0('0x52')]();var _0x321a4d=htmlToPdfmake(_0x9138f9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x321a4d],'defaultStyle':{'font':_0xf5b0('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf5b0('0x53'),'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':_0xf5b0('0x53')}},'header':function(){return[{'text':_0xf5b0('0x54'),'style':_0xf5b0('0x1d')}];},'footer':function(_0x4a079c,_0x15931a){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x4d6d78,_0x4a079c,_0x15931a,_0x1ea938),'style':_0xf5b0('0x22')}];}};}function writePDFDocument(_0x52cef0,_0x30bdb7){return new Promise(function(_0x493184,_0x100916){var _0x4c9382=_0x52cef0[_0xf5b0('0x55')](fs[_0xf5b0('0x56')](_0x30bdb7));_0x4c9382['on'](_0xf5b0('0x57'),function(){_0x493184('finish');});_0x4c9382['on']('error',function(_0x1e1eed){_0x100916(_0x1e1eed);});_0x52cef0['end']();});}exports['createPdfFromHTML']=function(_0x59ff39,_0x54381f){var _0x15afa8=getPDFPrinter();var _0x4c93f3=getPDFDocDefinitionFromHTML(_0x59ff39,_0x54381f);var _0x44a963=_0x15afa8[_0xf5b0('0x3a')](_0x4c93f3);return writePDFDocument(_0x44a963,_0x54381f[_0xf5b0('0x0')])[_0xf5b0('0x47')](function(_0x158e26){throw _0x158e26;});}; \ No newline at end of file +var _0x4194=['forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','mkdirSync','join','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','finish','path','util','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','pick','toString','value','fill','length','auto','body','push','chunk','keys','name','startDate','format','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','Empty','find','split','splitSizePdf','then','range','isInteger','num'];(function(_0x10c7a5,_0x261f71){var _0x50e807=function(_0x25a909){while(--_0x25a909){_0x10c7a5['push'](_0x10c7a5['shift']());}};_0x50e807(++_0x261f71);}(_0x4194,0x80));var _0x4419=function(_0x2242b9,_0x4b9e98){_0x2242b9=_0x2242b9-0x0;var _0x502439=_0x4194[_0x2242b9];return _0x502439;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x4419('0x0'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x4419('0x1'));var PdfPrinter=require(_0x4419('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x4419('0x3'));var JSDOM=require(_0x4419('0x4'))[_0x4419('0x5')];var window=new JSDOM('')[_0x4419('0x6')];var BPromise=require(_0x4419('0x7'));var db=require(_0x4419('0x8'))['db'];var dbH=require(_0x4419('0x8'))[_0x4419('0x9')];var logger=require(_0x4419('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x4419('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4419('0xb')][0x4];var NAME=process[_0x4419('0xb')][0x5];var FORMAT=_0x4419('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x46853a,_0x551818){var _0x3cd7cc={'status':_0x46853a};var _0xdcd125={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x551818){_0x3cd7cc[_0x4419('0xd')]=_0x551818;}return db['AnalyticExtractedReport']['update'](_0x3cd7cc,_0xdcd125);}function getHeaders(_0x249bd8){return _[_0x4419('0xe')](_0x249bd8,function(_0x3e279b){return{'text':_0x3e279b,'style':_0x4419('0xf')};});}function getRows(_0x55a00a,_0x2732ad){return _['map'](_0x2732ad,function(_0x561613){return _(_0x561613)[_0x4419('0x10')](_0x55a00a)[_0x4419('0xe')](function(_0x4cb73a){return _0x4cb73a?_[_0x4419('0x11')](_0x4cb73a):'';})[_0x4419('0x12')]();});}function createTable(_0x12bb13,_0x1f0f26){var _0x58f4e7={'widths':_[_0x4419('0x13')](Array(_0x12bb13[_0x4419('0x14')]),0x91),'heights':function(_0x3937ae){return _0x3937ae===0x0?_0x4419('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x42f08c=getHeaders(_0x12bb13);_0x58f4e7[_0x4419('0x16')][_0x4419('0x17')](_0x42f08c);var _0x19be18=getRows(_0x12bb13,_0x1f0f26);_0x58f4e7['body']=_0x58f4e7[_0x4419('0x16')]['concat'](_0x19be18);return _0x58f4e7;}function createTables(_0x3363f0){var _0x58618d=[];var _0x590a9f=_[_0x4419('0x18')](Object[_0x4419('0x19')](_0x3363f0[0x0]),0x5);_0x590a9f['forEach'](function(_0x17a037){_0x58618d[_0x4419('0x17')](createTable(_0x17a037,_0x3363f0));});return _0x58618d;}function getPDFDocDefinition(_0x5ab2cb){var _0x446bdb=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x4419('0x1a')],moment(EXTRACTED_REPORT[_0x4419('0x1b')])[_0x4419('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x4419('0x1d')])[_0x4419('0x1c')](FORMAT));var _0x75f551=[];for(var _0x2dab9a=0x0;_0x2dab9a<_0x5ab2cb['length'];_0x2dab9a++){var _0x4a3ca9=[];if(_0x2dab9a===0x0){_0x4a3ca9['push']({'text':_0x446bdb,'style':_0x4419('0x1e')});}var _0x481eb8={'table':_0x5ab2cb[_0x2dab9a]};if(_0x2dab9a>0x0){_0x481eb8[_0x4419('0x1f')]=_0x4419('0x20');_0x481eb8[_0x4419('0x21')]=[0x0,0x46,0x0,0x0];}_0x4a3ca9['push'](_0x481eb8);_0x75f551[_0x4419('0x17')](_0x4a3ca9);}return{'pageSize':'A4','pageOrientation':_0x4419('0x22'),'content':_0x75f551,'footer':function(_0x94f176,_0x57f681){return{'text':_0x94f176[_0x4419('0x11')]()+_0x4419('0x23')+_0x57f681,'style':_0x4419('0x24')};},'defaultStyle':{'font':_0x4419('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4419('0x26')},'footer':{'alignment':_0x4419('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x56f6f8){var _0x400650=0x1388;var _0x3ce3df;if(!_0x56f6f8[0x0]['num']){return analyticExtractedReport(_0x4419('0x28'));}return db['Setting'][_0x4419('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4419('0x2a'),_0x4419('0x2b')]})['then'](function(_0x4c586b){if(_0x4c586b){_0x3ce3df=_0x4c586b;_0x400650=_0x3ce3df[_0x4419('0x2b')]||0x3e8;}})[_0x4419('0x2c')](function(){var _0x4f7795=[];var _0x13e0b3=0x0;if(_0x3ce3df[_0x4419('0x2a')]){if(_0x56f6f8&&_0x56f6f8[_0x4419('0x14')]){var _0x45a0ee=_[_0x4419('0x2d')](_0x56f6f8[0x0]['num']/_0x400650);var _0x5d984a=Number[_0x4419('0x2e')](_0x56f6f8[0x0][_0x4419('0x2f')]/_0x400650)?_0x56f6f8[0x0][_0x4419('0x2f')]%_0x400650:0x0;_0x45a0ee[_0x4419('0x30')](function(_0x1ef6a0){if(_0x1ef6a0>0x0){_0x13e0b3+=_0x400650;}_0x4f7795[_0x4419('0x17')](dbH['sequelize']['query'](util[_0x4419('0x1c')](_0x4419('0x31'),QUERY,_0x400650,_0x13e0b3),{'type':dbH[_0x4419('0x32')][_0x4419('0x33')][_0x4419('0x34')]}));});if(_0x5d984a>0x0){_0x13e0b3+=_0x400650;_0x4f7795[_0x4419('0x17')](dbH['sequelize']['query'](util[_0x4419('0x1c')](_0x4419('0x31'),QUERY,_0x5d984a,_0x13e0b3),{'type':dbH['sequelize'][_0x4419('0x33')]['SELECT']}));}}}else{_0x4f7795['push'](dbH[_0x4419('0x32')]['query'](QUERY,{'type':dbH[_0x4419('0x32')]['QueryTypes'][_0x4419('0x34')]}));}var _0x3543ec=path[_0x4419('0x35')](PATH);var _0x4faae7=path[_0x4419('0x36')](PATH,_0x4419('0x37'));var _0x131db4=_0x3ce3df[_0x4419('0x2a')]&&_0x4f7795[_0x4419('0x14')]>0x1;var _0x514a22=[];if(!fs[_0x4419('0x38')](path['join'](_0x3543ec,_0x4faae7))&&_0x131db4){fs[_0x4419('0x39')](path[_0x4419('0x3a')](_0x3543ec,_0x4faae7));}return BPromise['each'](_0x4f7795,function(_0x3d8adc){_0x514a22[_0x4419('0x17')](_0x3d8adc);})[_0x4419('0x2c')](function(){var _0x5c84f4=[];for(var _0x18306a=0x0;_0x18306a<_0x514a22['length'];_0x18306a+=0x1){var _0x6fc2a5=_0x514a22[_0x18306a];var _0x31fd13=createTables(_['flatten'](_0x6fc2a5));var _0x489590;var _0x212d85=getPDFDocDefinition(_0x31fd13);var _0x32b44d=getPDFPrinter();var _0x17537c=_0x32b44d[_0x4419('0x3b')](_0x212d85);if(_0x131db4){_0x489590=path[_0x4419('0x3a')](_0x3543ec,_0x4faae7,util[_0x4419('0x1c')](_0x4419('0x3c'),_0x4faae7,_0x18306a,_0x4419('0x3d')));}else{_0x489590=path[_0x4419('0x3a')](_0x3543ec,util[_0x4419('0x1c')]('%s.%s',_0x4faae7,'pdf'));}_0x5c84f4[_0x4419('0x17')](writePDFDocument(_0x17537c,_0x489590));}return Promise[_0x4419('0x3e')](_0x5c84f4);})['then'](function(){if(_0x131db4){return new Promise(function(_0x55b1f6){zipdir(path[_0x4419('0x3a')](_0x3543ec,_0x4faae7),{'saveTo':path[_0x4419('0x3a')](_0x3543ec,util[_0x4419('0x1c')](_0x4419('0x3f'),_0x4faae7,_0x4419('0x40')))},function(){rimraf(path[_0x4419('0x3a')](_0x3543ec,_0x4faae7),function(){});_0x55b1f6(_0x4419('0x41'));});});}})[_0x4419('0x2c')](function(){if(!_0x131db4)return;rimraf(path[_0x4419('0x3a')](_0x3543ec,_0x4faae7),function(){});})[_0x4419('0x2c')](function(){logger[_0x4419('0x42')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x131db4?util[_0x4419('0x1c')](_0x4419('0x3f'),_0x4faae7,_0x131db4?_0x4419('0x40'):_0x4419('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4419('0x42')](util[_0x4419('0x1c')](_0x4419('0x43'),EXTRACTED_REPORT_ID,_0x4419('0x44')));return db[_0x4419('0x45')][_0x4419('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x2ebbca){EXTRACTED_REPORT=_0x2ebbca;return dbH[_0x4419('0x32')]['query'](util[_0x4419('0x1c')](_0x4419('0x47'),QUERY),{'type':dbH[_0x4419('0x32')][_0x4419('0x33')][_0x4419('0x34')]});})[_0x4419('0x2c')](extractReport)[_0x4419('0x48')](function(_0x4342cd){logger[_0x4419('0x42')](util[_0x4419('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4419('0x44')),util[_0x4419('0x49')](_0x4342cd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4419('0x4a'));})[_0x4419('0x4b')](function(){process[_0x4419('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x153726=new PdfPrinter({'Arial':{'normal':__dirname+_0x4419('0x4d'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x4419('0x4e'),'bolditalics':__dirname+_0x4419('0x4f')}});return _0x153726;}function getPDFDocDefinitionFromHTML(_0x8a51b7,_0x12e50b){var _0x39e757=util[_0x4419('0x1c')](_0x4419('0x50'),_0x12e50b['channel'],_0x12e50b['interactionId']);var _0x22448f=moment()[_0x4419('0x1c')](_0x4419('0x51'))['toString']();var _0xf80478=htmlToPdfmake(_0x8a51b7,{'window':window,'tableAutoSize':!![]});return{'content':[_0xf80478],'defaultStyle':{'font':_0x4419('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4419('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4419('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x4419('0x53'),'style':_0x4419('0x1e')}];},'footer':function(_0x4c5bb3,_0x8352be){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x39e757,_0x4c5bb3,_0x8352be,_0x22448f),'style':'footer'}];}};}function writePDFDocument(_0x5cb0fc,_0x15dd57){return new Promise(function(_0x26030a,_0x1669dd){var _0x25dcc0=_0x5cb0fc[_0x4419('0x54')](fs[_0x4419('0x55')](_0x15dd57));_0x25dcc0['on']('finish',function(){_0x26030a(_0x4419('0x56'));});_0x25dcc0['on']('error',function(_0x7d3ab3){_0x1669dd(_0x7d3ab3);});_0x5cb0fc['end']();});}exports['createPdfFromHTML']=function(_0xf1123d,_0x4ee432){var _0x35ceb1=getPDFPrinter();var _0x29b16c=getPDFDocDefinitionFromHTML(_0xf1123d,_0x4ee432);var _0x594ae5=_0x35ceb1[_0x4419('0x3b')](_0x29b16c);return writePDFDocument(_0x594ae5,_0x4ee432[_0x4419('0x57')])[_0x4419('0x48')](function(_0x54e9db){throw _0x54e9db;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 7c094fd..82e03fd 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 _0x6738=['argv','savename','update','info','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','existsSync','join','mkdirSync','length','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x27c94b,_0x337503){var _0x150d1b=function(_0x51e04d){while(--_0x51e04d){_0x27c94b['push'](_0x27c94b['shift']());}};_0x150d1b(++_0x337503);}(_0x6738,0x16f));var _0x8673=function(_0x42ec2f,_0x3fb472){_0x42ec2f=_0x42ec2f-0x0;var _0x2beb90=_0x6738[_0x42ec2f];return _0x2beb90;};'use strict';var util=require(_0x8673('0x0'));var path=require('path');var _=require(_0x8673('0x1'));var fs=require('fs');var json2xls=require(_0x8673('0x2'));var BPromise=require(_0x8673('0x3'));var zipdir=require(_0x8673('0x4'));var rimraf=require(_0x8673('0x5'));var db=require(_0x8673('0x6'))['db'];var dbH=require(_0x8673('0x6'))[_0x8673('0x7')];var logger=require(_0x8673('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8673('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x8673('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x28c699,_0xb0dd89){var _0xa06381={'status':_0x28c699};var _0x584593={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb0dd89){_0xa06381[_0x8673('0xa')]=_0xb0dd89;}return db['AnalyticExtractedReport'][_0x8673('0xb')](_0xa06381,_0x584593);}function main(){var _0x435099=0x1388;var _0x1e28df;logger[_0x8673('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8673('0xd')));return db[_0x8673('0xe')][_0x8673('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8673('0x10'),_0x8673('0x11')]})[_0x8673('0x12')](function(_0x3aea98){if(_0x3aea98){_0x1e28df=_0x3aea98;_0x435099=_0x1e28df[_0x8673('0x11')]||0x1388;}})['then'](function(){return dbH[_0x8673('0x13')][_0x8673('0x14')](util[_0x8673('0x15')](_0x8673('0x16'),QUERY),{'type':dbH[_0x8673('0x13')][_0x8673('0x17')]['SELECT']});})['then'](function(_0xf3794e){if(!_0xf3794e[0x0][_0x8673('0x18')]){return analyticExtractedReport('Empty');}var _0x1f61af=[];var _0x5324bf=0x0;if(_0x1e28df[_0x8673('0x10')]){if(_0xf3794e&&_0xf3794e['length']){var _0x27e82c=_['range'](_0xf3794e[0x0][_0x8673('0x18')]/_0x435099);var _0x2fe9ad=Number[_0x8673('0x19')](_0xf3794e[0x0][_0x8673('0x18')]/_0x435099)?_0xf3794e[0x0][_0x8673('0x18')]%_0x435099:0x0;_0x27e82c[_0x8673('0x1a')](function(_0x46e30a){if(_0x46e30a>0x0){_0x5324bf+=_0x435099;}_0x1f61af[_0x8673('0x1b')](dbH[_0x8673('0x13')]['query'](util['format'](_0x8673('0x1c'),QUERY,_0x435099,_0x5324bf),{'type':dbH[_0x8673('0x13')][_0x8673('0x17')]['SELECT']}));});if(_0x2fe9ad>0x0){_0x5324bf+=_0x435099;_0x1f61af[_0x8673('0x1b')](dbH[_0x8673('0x13')][_0x8673('0x14')](util[_0x8673('0x15')](_0x8673('0x1c'),QUERY,_0x2fe9ad,_0x5324bf),{'type':dbH[_0x8673('0x13')][_0x8673('0x17')][_0x8673('0x1d')]}));}}}else{_0x1f61af[_0x8673('0x1b')](dbH[_0x8673('0x13')]['query'](QUERY,{'type':dbH[_0x8673('0x13')][_0x8673('0x17')]['SELECT']}));}var _0x44e003=path[_0x8673('0x1e')](PATH);var _0x2ded3d=path[_0x8673('0x1f')](PATH,'.xlsx');var _0x3c0c48=_0x1e28df[_0x8673('0x10')]&&_0x1f61af['length']>0x1;var _0x23c581=[];if(!fs[_0x8673('0x20')](path[_0x8673('0x21')](_0x44e003,_0x2ded3d))&&_0x3c0c48){fs[_0x8673('0x22')](path[_0x8673('0x21')](_0x44e003,_0x2ded3d));}return BPromise['each'](_0x1f61af,function(_0x90ec4c){_0x23c581[_0x8673('0x1b')](_0x90ec4c);})[_0x8673('0x12')](function(){for(var _0x33cda1=0x0;_0x33cda1<_0x23c581[_0x8673('0x23')];_0x33cda1+=0x1){var _0x37a201;var _0x2485a8=_0x23c581[_0x33cda1];if(_0x3c0c48){_0x37a201=path[_0x8673('0x21')](_0x44e003,_0x2ded3d,util[_0x8673('0x15')](_0x8673('0x24'),_0x2ded3d,_0x33cda1,_0x8673('0x25')));}else{_0x37a201=path['join'](_0x44e003,util['format'](_0x8673('0x26'),_0x2ded3d,_0x8673('0x25')));}fs[_0x8673('0x27')](_0x37a201,json2xls(_0x2485a8),_0x8673('0x28'));}})[_0x8673('0x12')](function(){if(_0x3c0c48){return new Promise(function(_0x45ae86){zipdir(path[_0x8673('0x21')](_0x44e003,_0x2ded3d),{'saveTo':path[_0x8673('0x21')](_0x44e003,util[_0x8673('0x15')](_0x8673('0x26'),_0x2ded3d,_0x8673('0x29')))},function(_0x38f153,_0x5e8b03){rimraf(path[_0x8673('0x21')](_0x44e003,_0x2ded3d),function(){});_0x45ae86('zip\x20finished');});});}})[_0x8673('0x12')](function(){logger[_0x8673('0xc')](util[_0x8673('0x15')](_0x8673('0x2a'),EXTRACTED_REPORT_ID,_0x8673('0xd')));return analyticExtractedReport('Completed',_0x3c0c48?util['format']('%s.%s',_0x2ded3d,_0x3c0c48?_0x8673('0x29'):_0x8673('0x25')):null);});})[_0x8673('0x2b')](function(_0x3e8ede){logger['info'](util[_0x8673('0x15')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8673('0xd')),util[_0x8673('0x2c')](_0x3e8ede,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x8673('0x2d')](function(){process[_0x8673('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe03c=['SELECT','dirname','.xlsx','length','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Failed','exit','util','path','lodash','json2xls','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','find','then','splitSizeXlsx','query','sequelize','QueryTypes','split','range','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x3db3e9,_0xf948f8){var _0x5db23d=function(_0x214f3b){while(--_0x214f3b){_0x3db3e9['push'](_0x3db3e9['shift']());}};_0x5db23d(++_0xf948f8);}(_0xe03c,0x19e));var _0xce03=function(_0x5b19ae,_0x2fef9e){_0x5b19ae=_0x5b19ae-0x0;var _0x367f6a=_0xe03c[_0x5b19ae];return _0x367f6a;};'use strict';var util=require(_0xce03('0x0'));var path=require(_0xce03('0x1'));var _=require(_0xce03('0x2'));var fs=require('fs');var json2xls=require(_0xce03('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xce03('0x4'))[_0xce03('0x5')];var logger=require(_0xce03('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xce03('0x7')][0x3];var PATH=process[_0xce03('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x19274f,_0x26555f){var _0x18e535={'status':_0x19274f};var _0x1d581d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x26555f){_0x18e535[_0xce03('0x8')]=_0x26555f;}return db[_0xce03('0x9')][_0xce03('0xa')](_0x18e535,_0x1d581d);}function main(){var _0x3930ef=0x1388;var _0x119a4c;logger[_0xce03('0xb')](util[_0xce03('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xce03('0xd')));return db['Setting'][_0xce03('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xce03('0xf')](function(_0x4f6390){if(_0x4f6390){_0x119a4c=_0x4f6390;_0x3930ef=_0x119a4c[_0xce03('0x10')]||0x1388;}})[_0xce03('0xf')](function(){return dbH['sequelize'][_0xce03('0x11')](util[_0xce03('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xce03('0x12')][_0xce03('0x13')]['SELECT']});})[_0xce03('0xf')](function(_0x3ad5fb){if(!_0x3ad5fb[0x0]['num']){return analyticExtractedReport('Empty');}var _0x4c5e71=[];var _0x20f229=0x0;if(_0x119a4c[_0xce03('0x14')]){if(_0x3ad5fb&&_0x3ad5fb['length']){var _0x5c8411=_[_0xce03('0x15')](_0x3ad5fb[0x0][_0xce03('0x16')]/_0x3930ef);var _0x190a73=Number[_0xce03('0x17')](_0x3ad5fb[0x0][_0xce03('0x16')]/_0x3930ef)?_0x3ad5fb[0x0]['num']%_0x3930ef:0x0;_0x5c8411['forEach'](function(_0x9cc2d9){if(_0x9cc2d9>0x0){_0x20f229+=_0x3930ef;}_0x4c5e71[_0xce03('0x18')](dbH['sequelize']['query'](util[_0xce03('0xc')](_0xce03('0x19'),QUERY,_0x3930ef,_0x20f229),{'type':dbH[_0xce03('0x12')]['QueryTypes'][_0xce03('0x1a')]}));});if(_0x190a73>0x0){_0x20f229+=_0x3930ef;_0x4c5e71[_0xce03('0x18')](dbH[_0xce03('0x12')][_0xce03('0x11')](util[_0xce03('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x190a73,_0x20f229),{'type':dbH[_0xce03('0x12')][_0xce03('0x13')][_0xce03('0x1a')]}));}}}else{_0x4c5e71[_0xce03('0x18')](dbH[_0xce03('0x12')]['query'](QUERY,{'type':dbH['sequelize'][_0xce03('0x13')]['SELECT']}));}var _0xc626e7=path[_0xce03('0x1b')](PATH);var _0x3a02ae=path['basename'](PATH,_0xce03('0x1c'));var _0x5d5612=_0x119a4c[_0xce03('0x14')]&&_0x4c5e71[_0xce03('0x1d')]>0x1;var _0xb0988=[];if(!fs['existsSync'](path['join'](_0xc626e7,_0x3a02ae))&&_0x5d5612){fs[_0xce03('0x1e')](path[_0xce03('0x1f')](_0xc626e7,_0x3a02ae));}return BPromise[_0xce03('0x20')](_0x4c5e71,function(_0x3f8174){_0xb0988[_0xce03('0x18')](_0x3f8174);})[_0xce03('0xf')](function(){for(var _0x557001=0x0;_0x557001<_0xb0988['length'];_0x557001+=0x1){var _0x3673c4;var _0x874aee=_0xb0988[_0x557001];if(_0x5d5612){_0x3673c4=path[_0xce03('0x1f')](_0xc626e7,_0x3a02ae,util[_0xce03('0xc')](_0xce03('0x21'),_0x3a02ae,_0x557001,'xlsx'));}else{_0x3673c4=path[_0xce03('0x1f')](_0xc626e7,util[_0xce03('0xc')](_0xce03('0x22'),_0x3a02ae,_0xce03('0x23')));}fs[_0xce03('0x24')](_0x3673c4,json2xls(_0x874aee),_0xce03('0x25'));}})[_0xce03('0xf')](function(){if(_0x5d5612){return new Promise(function(_0x1903e8){zipdir(path[_0xce03('0x1f')](_0xc626e7,_0x3a02ae),{'saveTo':path['join'](_0xc626e7,util['format'](_0xce03('0x22'),_0x3a02ae,_0xce03('0x26')))},function(_0x52af5c,_0x42a75c){rimraf(path[_0xce03('0x1f')](_0xc626e7,_0x3a02ae),function(){});_0x1903e8(_0xce03('0x27'));});});}})[_0xce03('0xf')](function(){logger[_0xce03('0xb')](util[_0xce03('0xc')](_0xce03('0x28'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x5d5612?util[_0xce03('0xc')]('%s.%s',_0x3a02ae,_0x5d5612?'zip':_0xce03('0x23')):null);});})[_0xce03('0x29')](function(_0x499748){logger['info'](util[_0xce03('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xce03('0xd')),util['inspect'](_0x499748,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xce03('0x2a'));})['finally'](function(){process[_0xce03('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 9e8b8ae..068bc74 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 _0xc52d=['ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','context','outbound','CDR(destination)=','${EXTEN:','cutdigits'];(function(_0x3df15c,_0x4a36cc){var _0x545db6=function(_0x518212){while(--_0x518212){_0x3df15c['push'](_0x3df15c['shift']());}};_0x545db6(++_0x4a36cc);}(_0xc52d,0xfc));var _0xdc52=function(_0x2baf72,_0x2c32be){_0x2baf72=_0x2baf72-0x0;var _0x56cb44=_0xc52d[_0x2baf72];return _0x56cb44;};'use strict';var _=require(_0xdc52('0x0'));var util=require(_0xdc52('0x1'));function rewrite(_0x5dfe91,_0x314ea4){var _0x46cbbf=this;return _0x5dfe91[_0xdc52('0x2')][_0xdc52('0x3')][_0xdc52('0x4')]({'raw':!![]})[_0xdc52('0x5')](function(_0x2ea378){_0x46cbbf['intervals']=_0x2ea378;return _0x5dfe91['models'][_0xdc52('0x6')][_0xdc52('0x4')]({'where':{'IntervalId':_0x314ea4[_0xdc52('0x7')]},'raw':!![]});})[_0xdc52('0x5')](function(_0x439c1d){return _0x5dfe91[_0xdc52('0x2')][_0xdc52('0x6')][_0xdc52('0x4')]({'where':{'exten':{'$in':_[_0xdc52('0x8')](_[_0xdc52('0x9')](_0x439c1d,'exten'))}},'order':[{'raw':_0xdc52('0xa')}],'raw':!![]});})['then'](function(_0xccba8b){var _0x2497c9=_['filter'](_0xccba8b,{'priority':'1'});var _0xea9058=_[_0xdc52('0xb')](_0xccba8b,{'isApp':0x1});var _0x4987bb=_[_0xdc52('0xc')](_0xea9058,_0xdc52('0xd'));var _0x6b1282=[_0xdc52('0xe'),_0xdc52('0xf')];var _0x1c90b2=[];var _0x12d3ef=[];for(var _0x53a029 in _0x4987bb){if(_0x4987bb[_0xdc52('0x10')](_0x53a029)){_0x46cbbf[_0xdc52('0x11')]=0x2;_0x46cbbf['extensions']=[];_0x46cbbf[_0xdc52('0x12')]=_[_0xdc52('0x13')](_0x2497c9,{'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')]});_0x46cbbf[_0xdc52('0x14')][_0xdc52('0x15')]({'type':_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')],'app':_0xdc52('0x17'),'appdata':util[_0xdc52('0x18')](_0xdc52('0x19'),_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')]),'context':_0x4987bb[_0x53a029][0x0]['context'],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf[_0xdc52('0x11')]++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0]['VoiceExtensionId']});if(_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')]==='inbound'){_0x46cbbf[_0xdc52('0x14')]['push']({'type':_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')],'app':_0xdc52('0x17'),'appdata':'CDR(routeid)='+_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')],'context':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1b')],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf[_0xdc52('0x11')]++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});}else if(_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')]===_0xdc52('0x1c')){if(_0x46cbbf[_0xdc52('0x12')]){_0x46cbbf[_0xdc52('0x14')][_0xdc52('0x15')]({'type':_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')],'app':_0xdc52('0x17'),'appdata':_0xdc52('0x1d')+(_0x46cbbf[_0xdc52('0x12')]['cutdigits']?_0xdc52('0x1e')+_0x46cbbf[_0xdc52('0x12')][_0xdc52('0x1f')]+'}':'${EXTEN}'),'context':_0x4987bb[_0x53a029][0x0]['context'],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf[_0xdc52('0x11')]++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});}_0x46cbbf['extensions'][_0xdc52('0x15')]({'type':_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')],'app':'Set','appdata':'CDR(routeid)='+_0x4987bb[_0x53a029][0x0]['VoiceExtensionId'],'context':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1b')],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf[_0xdc52('0x11')]++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});var _0x55bffb=_0x46cbbf['priority']++;_0x46cbbf[_0xdc52('0x14')][_0xdc52('0x15')]({'type':_0x4987bb[_0x53a029][0x0]['type'],'app':_0xdc52('0x20'),'appdata':_0xdc52('0x21')+(_0x55bffb+0x2)+_0xdc52('0x22')+(_0x55bffb+0x1)+')','context':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1b')],'exten':_0x4987bb[_0x53a029][0x0]['exten'],'priority':_0x55bffb,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});if(_0x46cbbf['extension']){_0x46cbbf[_0xdc52('0x14')][_0xdc52('0x15')]({'type':_0x4987bb[_0x53a029][0x0]['type'],'app':_0xdc52('0x17'),'appdata':_0x46cbbf['extension']['cutdigits']?_0xdc52('0x23')+_0x46cbbf[_0xdc52('0x12')][_0xdc52('0x1f')]+'}':_0xdc52('0x24'),'context':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1b')],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf[_0xdc52('0x11')]++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});}_0x46cbbf[_0xdc52('0x14')][_0xdc52('0x15')]({'type':_0x4987bb[_0x53a029][0x0]['type'],'app':_0xdc52('0x17'),'appdata':_0xdc52('0x25')+_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')],'context':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1b')],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf[_0xdc52('0x11')]++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});if(_0x46cbbf[_0xdc52('0x12')]&&_0x46cbbf[_0xdc52('0x12')][_0xdc52('0x10')](_0xdc52('0x26'))&&_0x46cbbf['extension'][_0xdc52('0x26')]!=='none'){_0x46cbbf[_0xdc52('0x14')]['push']({'type':_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4987bb[_0x53a029][0x0]['context'],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf[_0xdc52('0x11')]++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});_0x46cbbf[_0xdc52('0x14')][_0xdc52('0x15')]({'type':_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')],'app':'Set','appdata':_0xdc52('0x27')+_0x46cbbf['extension']['recordingFormat']||_0xdc52('0x28'),'context':_0x4987bb[_0x53a029][0x0]['context'],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf[_0xdc52('0x11')]++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});}}_0x46cbbf['extensions'][_0xdc52('0x15')]({'type':_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')],'app':_0xdc52('0x17'),'appdata':_0xdc52('0x29'),'context':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1b')],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf['priority']++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});_0x46cbbf[_0xdc52('0x14')]['push']({'type':_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')],'app':'Set','appdata':_0xdc52('0x2a'),'context':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1b')],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf[_0xdc52('0x11')]++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});_0x46cbbf[_0xdc52('0x14')][_0xdc52('0x15')]({'type':_0x4987bb[_0x53a029][0x0][_0xdc52('0x16')],'app':_0xdc52('0x17'),'appdata':_0xdc52('0x2b'),'context':_0x4987bb[_0x53a029][0x0]['context'],'exten':_0x4987bb[_0x53a029][0x0][_0xdc52('0xd')],'priority':_0x46cbbf['priority']++,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});for(var _0xe89a1d=0x0,_0x28bae8=0x0;_0xe89a1d<_0x4987bb[_0x53a029][_0xdc52('0x2c')];_0xe89a1d+=0x1,_0x28bae8=0x0){var _0x493fb4=_0x4987bb[_0x53a029][_0xe89a1d];if(_0x493fb4[_0xdc52('0x16')]){_0x493fb4[_0xdc52('0x16')]=_0x493fb4[_0xdc52('0x16')]['toLowerCase']();}var _0x587d1b=[];var _0x6e226c=[];delete _0x493fb4['id'];delete _0x493fb4[_0xdc52('0x2d')];delete _0x493fb4[_0xdc52('0x2e')];var _0x192f6f=_0x493fb4[_0xdc52('0x2f')]!==_0xdc52('0x30')?[_0x493fb4['interval']]:_0x493fb4[_0xdc52('0x7')]?_['map'](_[_0xdc52('0xb')](_0x46cbbf[_0xdc52('0x31')],{'IntervalId':_0x493fb4[_0xdc52('0x7')]}),_0xdc52('0x2f')):[];if(_0x493fb4['hasOwnProperty'](_0xdc52('0x32'))){if(_0x493fb4[_0xdc52('0x32')]&&_0x493fb4['tag']!=='--'){_0x587d1b[_0xdc52('0x15')]({'type':_0x493fb4['type'],'app':'Set','appdata':_0xdc52('0x33')+_0x493fb4['tag'],'context':_0x493fb4['context'],'exten':_0x493fb4[_0xdc52('0xd')],'priority':_0x192f6f[_0xdc52('0x2c')]+_0x46cbbf['priority']+_0x28bae8++,'VoiceExtensionId':_0x493fb4['VoiceExtensionId']});}}if(_0x493fb4[_0xdc52('0x16')]===_0xdc52('0x1c')&&_0x493fb4[_0xdc52('0x10')](_0xdc52('0x34'))){if(_0x493fb4[_0xdc52('0x34')]){_0x587d1b[_0xdc52('0x15')]({'type':_0x493fb4['type'],'app':_0xdc52('0x20'),'appdata':_0xdc52('0x35')+_0x493fb4['callerID']+')','context':_0x493fb4['context'],'exten':_0x493fb4[_0xdc52('0xd')],'priority':_0x192f6f['length']+_0x46cbbf[_0xdc52('0x11')]+_0x28bae8++,'VoiceExtensionId':_0x493fb4[_0xdc52('0x1a')]});}else{_0x587d1b['push']({'type':_0x493fb4['type'],'app':_0xdc52('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x493fb4[_0xdc52('0x1b')],'exten':_0x493fb4['exten'],'priority':_0x192f6f['length']+_0x46cbbf[_0xdc52('0x11')]+_0x28bae8++,'VoiceExtensionId':_0x493fb4['VoiceExtensionId']});}}if(_0x493fb4['hasOwnProperty']('answer')){if(_0x6b1282[_0xdc52('0x36')](_0x493fb4['app'][_0xdc52('0x37')]())>=0x0&&_0x493fb4[_0xdc52('0x38')]!==_0xdc52('0x39')){if(_0x493fb4['answer']){_0x587d1b['push']({'type':_0x493fb4['type'],'app':_0xdc52('0x20'),'appdata':_0xdc52('0x3a'),'context':_0x493fb4['context'],'exten':_0x493fb4[_0xdc52('0xd')],'priority':_0x192f6f[_0xdc52('0x2c')]+_0x46cbbf[_0xdc52('0x11')]+_0x28bae8++,'VoiceExtensionId':_0x493fb4['VoiceExtensionId']});_0x587d1b[_0xdc52('0x15')]({'type':_0x493fb4[_0xdc52('0x16')],'app':_0xdc52('0x17'),'appdata':_0xdc52('0x3b'),'context':_0x493fb4[_0xdc52('0x1b')],'exten':_0x493fb4[_0xdc52('0xd')],'priority':_0x192f6f[_0xdc52('0x2c')]+_0x46cbbf['priority']+_0x28bae8++,'VoiceExtensionId':_0x493fb4[_0xdc52('0x1a')]});}else{_0x587d1b[_0xdc52('0x15')]({'type':_0x493fb4['type'],'app':'ExecIf','appdata':_0xdc52('0x3c'),'context':_0x493fb4['context'],'exten':_0x493fb4[_0xdc52('0xd')],'priority':_0x192f6f['length']+_0x46cbbf['priority']+_0x28bae8++,'VoiceExtensionId':_0x493fb4['VoiceExtensionId']});_0x587d1b[_0xdc52('0x15')]({'type':_0x493fb4[_0xdc52('0x16')],'app':_0xdc52('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x493fb4[_0xdc52('0x1b')],'exten':_0x493fb4['exten'],'priority':_0x192f6f[_0xdc52('0x2c')]+_0x46cbbf['priority']+_0x28bae8++,'VoiceExtensionId':_0x493fb4[_0xdc52('0x1a')]});}}}for(var _0x1f91ae=0x0;_0x1f91ae<_0x192f6f[_0xdc52('0x2c')];_0x1f91ae+=0x1){var _0xfae308=_0x46cbbf[_0xdc52('0x11')]+_0x192f6f[_0xdc52('0x2c')];var _0x3837a0=_0x1f91ae===_0x192f6f[_0xdc52('0x2c')]-0x1?_0x46cbbf[_0xdc52('0x11')]+_0x587d1b[_0xdc52('0x2c')]+_0x6e226c['length']+0x2:_0x46cbbf[_0xdc52('0x11')]+_0x1f91ae+0x1;_0x587d1b[_0xdc52('0x3d')](_0x1f91ae,0x0,{'type':_0x493fb4['type'],'app':'GotoIfTime','appdata':_0x192f6f[_0x1f91ae]+'?'+_0x493fb4[_0xdc52('0x1b')]+_0xdc52('0x3e')+_0xfae308+':'+_0x493fb4[_0xdc52('0x1b')]+_0xdc52('0x3e')+_0x3837a0,'exten':_0x493fb4['exten'],'context':_0x493fb4[_0xdc52('0x1b')],'priority':_0x46cbbf['priority']+_0x1f91ae,'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});}_0x493fb4['priority']=_0x587d1b[_0xdc52('0x2c')]?_['last'](_0x587d1b)['priority']+0x1:_0x46cbbf[_0xdc52('0x11')];_0x46cbbf[_0xdc52('0x11')]=(_0x6e226c['length']?_[_0xdc52('0x3f')](_0x6e226c)[_0xdc52('0x11')]:_0x493fb4[_0xdc52('0x11')])+0x1;_0x46cbbf[_0xdc52('0x14')]=_[_0xdc52('0x40')](_0x46cbbf[_0xdc52('0x14')],_0x587d1b,[_0x493fb4],_0x6e226c);}_0x46cbbf['extensions'][_0xdc52('0x15')]({'type':_0x4987bb[_0x53a029][0x0]['type'],'app':_0xdc52('0x41'),'exten':_0x4987bb[_0x53a029][0x0]['exten'],'context':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1b')],'priority':_0x46cbbf['priority'],'VoiceExtensionId':_0x4987bb[_0x53a029][0x0][_0xdc52('0x1a')]});_0x1c90b2[_0xdc52('0x15')](_0x4987bb[_0x53a029][0x0]['VoiceExtensionId']);_0x12d3ef=_['concat'](_0x12d3ef,_0x46cbbf[_0xdc52('0x14')]);}}return _0x5dfe91[_0xdc52('0x42')](function(_0x43858e){return _0x5dfe91['models'][_0xdc52('0x6')][_0xdc52('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x1c90b2}},'transaction':_0x43858e})[_0xdc52('0x5')](function(_0x4dcb52){return _0x5dfe91[_0xdc52('0x2')][_0xdc52('0x6')]['bulkCreate'](_[_0xdc52('0x44')](_0x12d3ef,_0xdc52('0x11')),{'transaction':_0x43858e});});});})[_0xdc52('0x45')](function(_0x5de7d8){console['error'](_0x5de7d8);});}exports[_0xdc52('0x46')]=rewrite; \ No newline at end of file +var _0x6dd7=['cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','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)','answer','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)='];(function(_0x53c92c,_0x462b9c){var _0x4f69cb=function(_0x2d75ac){while(--_0x2d75ac){_0x53c92c['push'](_0x53c92c['shift']());}};_0x4f69cb(++_0x462b9c);}(_0x6dd7,0x6e));var _0x76dd=function(_0x4b64a4,_0x1bdc50){_0x4b64a4=_0x4b64a4-0x0;var _0xd19b0e=_0x6dd7[_0x4b64a4];return _0xd19b0e;};'use strict';var _=require(_0x76dd('0x0'));var util=require(_0x76dd('0x1'));function rewrite(_0x2dd206,_0x5a735a){var _0x19b43f=this;return _0x2dd206[_0x76dd('0x2')][_0x76dd('0x3')][_0x76dd('0x4')]({'raw':!![]})['then'](function(_0x561be8){_0x19b43f[_0x76dd('0x5')]=_0x561be8;return _0x2dd206[_0x76dd('0x2')][_0x76dd('0x6')][_0x76dd('0x4')]({'where':{'IntervalId':_0x5a735a[_0x76dd('0x7')]},'raw':!![]});})['then'](function(_0x5c7aa1){return _0x2dd206[_0x76dd('0x2')][_0x76dd('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x76dd('0x8')](_['map'](_0x5c7aa1,_0x76dd('0x9')))}},'order':[{'raw':_0x76dd('0xa')}],'raw':!![]});})[_0x76dd('0xb')](function(_0x53a2ba){var _0x396034=_[_0x76dd('0xc')](_0x53a2ba,{'priority':'1'});var _0x5c4041=_['filter'](_0x53a2ba,{'isApp':0x1});var _0x2ec00f=_[_0x76dd('0xd')](_0x5c4041,_0x76dd('0x9'));var _0x1b495b=['queue',_0x76dd('0xe')];var _0x3eca65=[];var _0x515c3b=[];for(var _0x166faa in _0x2ec00f){if(_0x2ec00f[_0x76dd('0xf')](_0x166faa)){_0x19b43f[_0x76dd('0x10')]=0x2;_0x19b43f[_0x76dd('0x11')]=[];_0x19b43f[_0x76dd('0x12')]=_[_0x76dd('0x13')](_0x396034,{'exten':_0x2ec00f[_0x166faa][0x0]['exten']});_0x19b43f['extensions'][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':util[_0x76dd('0x17')]('CDR(type)=%s',_0x2ec00f[_0x166faa][0x0]['type']),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0]['exten'],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});if(_0x2ec00f[_0x166faa][0x0]['type']===_0x76dd('0x1a')){_0x19b43f['extensions'][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x1b')+_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')],'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f['priority']++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});}else if(_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')]===_0x76dd('0x1c')){if(_0x19b43f[_0x76dd('0x12')]){_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x1d')+(_0x19b43f[_0x76dd('0x12')][_0x76dd('0x1e')]?'${EXTEN:'+_0x19b43f[_0x76dd('0x12')]['cutdigits']+'}':'${EXTEN}'),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});}_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x1b')+_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')],'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0]['exten'],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});var _0x60edbb=_0x19b43f['priority']++;_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':'ExecIf','appdata':_0x76dd('0x1f')+(_0x60edbb+0x2)+_0x76dd('0x20')+(_0x60edbb+0x1)+')','context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x60edbb,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});if(_0x19b43f[_0x76dd('0x12')]){_0x19b43f[_0x76dd('0x11')]['push']({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x19b43f[_0x76dd('0x12')][_0x76dd('0x1e')]?_0x76dd('0x21')+_0x19b43f['extension'][_0x76dd('0x1e')]+'}':'CDR(prefix)=noprefix','context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f['priority']++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});}_0x19b43f[_0x76dd('0x11')]['push']({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x22')+_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')],'context':_0x2ec00f[_0x166faa][0x0]['context'],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});if(_0x19b43f[_0x76dd('0x12')]&&_0x19b43f[_0x76dd('0x12')]['hasOwnProperty'](_0x76dd('0x23'))&&_0x19b43f['extension']['recordingFormat']!==_0x76dd('0x24')){_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0]['type'],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x25'),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0]['type'],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x26')+_0x19b43f[_0x76dd('0x12')]['recordingFormat']||_0x76dd('0x27'),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});}}_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x28'),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});_0x19b43f['extensions'][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2ec00f[_0x166faa][0x0]['context'],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x29'),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0]['VoiceExtensionId']});for(var _0xb55111=0x0,_0x3cc48d=0x0;_0xb55111<_0x2ec00f[_0x166faa][_0x76dd('0x2a')];_0xb55111+=0x1,_0x3cc48d=0x0){var _0x382d40=_0x2ec00f[_0x166faa][_0xb55111];if(_0x382d40[_0x76dd('0x15')]){_0x382d40['type']=_0x382d40[_0x76dd('0x15')][_0x76dd('0x2b')]();}var _0x45bfd8=[];var _0x5b2d59=[];delete _0x382d40['id'];delete _0x382d40[_0x76dd('0x2c')];delete _0x382d40[_0x76dd('0x2d')];var _0x280cb5=_0x382d40[_0x76dd('0x2e')]!==_0x76dd('0x2f')?[_0x382d40[_0x76dd('0x2e')]]:_0x382d40[_0x76dd('0x7')]?_[_0x76dd('0x30')](_[_0x76dd('0xc')](_0x19b43f['intervals'],{'IntervalId':_0x382d40[_0x76dd('0x7')]}),'interval'):[];if(_0x382d40['hasOwnProperty'](_0x76dd('0x31'))){if(_0x382d40[_0x76dd('0x31')]&&_0x382d40['tag']!=='--'){_0x45bfd8[_0x76dd('0x14')]({'type':_0x382d40['type'],'app':_0x76dd('0x16'),'appdata':'CDR(tag)='+_0x382d40[_0x76dd('0x31')],'context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40['exten'],'priority':_0x280cb5['length']+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40[_0x76dd('0x19')]});}}if(_0x382d40[_0x76dd('0x15')]==='outbound'&&_0x382d40[_0x76dd('0xf')]('callerID')){if(_0x382d40[_0x76dd('0x32')]){_0x45bfd8['push']({'type':_0x382d40[_0x76dd('0x15')],'app':_0x76dd('0x33'),'appdata':_0x76dd('0x34')+_0x382d40[_0x76dd('0x32')]+')','context':_0x382d40['context'],'exten':_0x382d40[_0x76dd('0x9')],'priority':_0x280cb5[_0x76dd('0x2a')]+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40['VoiceExtensionId']});}else{_0x45bfd8['push']({'type':_0x382d40[_0x76dd('0x15')],'app':_0x76dd('0x33'),'appdata':_0x76dd('0x35'),'context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40[_0x76dd('0x9')],'priority':_0x280cb5[_0x76dd('0x2a')]+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40[_0x76dd('0x19')]});}}if(_0x382d40['hasOwnProperty'](_0x76dd('0x36'))){if(_0x1b495b['indexOf'](_0x382d40['app'][_0x76dd('0x2b')]())>=0x0&&_0x382d40[_0x76dd('0x37')]!=='custom'){if(_0x382d40['answer']){_0x45bfd8[_0x76dd('0x14')]({'type':_0x382d40[_0x76dd('0x15')],'app':_0x76dd('0x33'),'appdata':_0x76dd('0x38'),'context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40['exten'],'priority':_0x280cb5['length']+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40['VoiceExtensionId']});_0x45bfd8[_0x76dd('0x14')]({'type':_0x382d40['type'],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x39'),'context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40['exten'],'priority':_0x280cb5['length']+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40['VoiceExtensionId']});}else{_0x45bfd8[_0x76dd('0x14')]({'type':_0x382d40[_0x76dd('0x15')],'app':_0x76dd('0x33'),'appdata':_0x76dd('0x3a'),'context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40['exten'],'priority':_0x280cb5[_0x76dd('0x2a')]+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40[_0x76dd('0x19')]});_0x45bfd8[_0x76dd('0x14')]({'type':_0x382d40['type'],'app':_0x76dd('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40[_0x76dd('0x9')],'priority':_0x280cb5['length']+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40[_0x76dd('0x19')]});}}}for(var _0x62d43b=0x0;_0x62d43b<_0x280cb5[_0x76dd('0x2a')];_0x62d43b+=0x1){var _0x5ebc00=_0x19b43f[_0x76dd('0x10')]+_0x280cb5['length'];var _0x43a5af=_0x62d43b===_0x280cb5[_0x76dd('0x2a')]-0x1?_0x19b43f['priority']+_0x45bfd8[_0x76dd('0x2a')]+_0x5b2d59[_0x76dd('0x2a')]+0x2:_0x19b43f[_0x76dd('0x10')]+_0x62d43b+0x1;_0x45bfd8[_0x76dd('0x3b')](_0x62d43b,0x0,{'type':_0x382d40[_0x76dd('0x15')],'app':_0x76dd('0x3c'),'appdata':_0x280cb5[_0x62d43b]+'?'+_0x382d40[_0x76dd('0x18')]+_0x76dd('0x3d')+_0x5ebc00+':'+_0x382d40[_0x76dd('0x18')]+',${EXTEN},'+_0x43a5af,'exten':_0x382d40['exten'],'context':_0x382d40['context'],'priority':_0x19b43f[_0x76dd('0x10')]+_0x62d43b,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});}_0x382d40[_0x76dd('0x10')]=_0x45bfd8[_0x76dd('0x2a')]?_[_0x76dd('0x3e')](_0x45bfd8)[_0x76dd('0x10')]+0x1:_0x19b43f[_0x76dd('0x10')];_0x19b43f[_0x76dd('0x10')]=(_0x5b2d59['length']?_['last'](_0x5b2d59)[_0x76dd('0x10')]:_0x382d40[_0x76dd('0x10')])+0x1;_0x19b43f[_0x76dd('0x11')]=_['concat'](_0x19b43f[_0x76dd('0x11')],_0x45bfd8,[_0x382d40],_0x5b2d59);}_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x3f'),'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'priority':_0x19b43f[_0x76dd('0x10')],'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});_0x3eca65[_0x76dd('0x14')](_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]);_0x515c3b=_[_0x76dd('0x40')](_0x515c3b,_0x19b43f[_0x76dd('0x11')]);}}return _0x2dd206[_0x76dd('0x41')](function(_0x1aa902){return _0x2dd206['models'][_0x76dd('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3eca65}},'transaction':_0x1aa902})[_0x76dd('0xb')](function(_0x2601be){return _0x2dd206['models'][_0x76dd('0x6')]['bulkCreate'](_[_0x76dd('0x42')](_0x515c3b,'priority'),{'transaction':_0x1aa902});});});})[_0x76dd('0x43')](function(_0x3a497d){console[_0x76dd('0x44')](_0x3a497d);});}exports[_0x76dd('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 9fd744a..682b121 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 _0x97a5=['cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','stringify','exit','SIGINT','info','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','join','hasOwnProperty','data','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','inspect','insert','into','fromQuery','phone','scheduledAt','createdAt','field','toString','NOW()','updatedAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','ContactId','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','cm_contacts','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','CmList','Campaign','get','CampaignId','BlackLists'];(function(_0x3490a8,_0x164729){var _0x14dc7a=function(_0x46cbdc){while(--_0x46cbdc){_0x3490a8['push'](_0x3490a8['shift']());}};_0x14dc7a(++_0x164729);}(_0x97a5,0xf0));var _0x597a=function(_0x2a9ccc,_0xb277e3){_0x2a9ccc=_0x2a9ccc-0x0;var _0x24344e=_0x97a5[_0x2a9ccc];return _0x24344e;};'use strict';var BPromise=require(_0x597a('0x0'));var util=require(_0x597a('0x1'));var _=require(_0x597a('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x597a('0x3'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x597a('0x4'))(_0x597a('0x5'));config[_0x597a('0x6')]=_['defaults'](config[_0x597a('0x6')],{'host':_0x597a('0x7'),'port':0x18eb});var socket=require(_0x597a('0x8'))(new Redis(config['redis']));require(_0x597a('0x9'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x597a('0xa')][0x2]===_0x597a('0xb')||process[_0x597a('0xa')][0x2]===_0x597a('0xc')){throw new Error(_0x597a('0xd'));}var FILEPATH=process[_0x597a('0xa')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0x597a('0xb')||process[_0x597a('0xa')][0x3]===_0x597a('0xc')||!process['argv'][0x4]||process[_0x597a('0xa')][0x4]===_0x597a('0xb')||process[_0x597a('0xa')][0x4]===_0x597a('0xc')){throw new Error(_0x597a('0xe'));}var FIELDS=_[_0x597a('0xf')](process[_0x597a('0xa')][0x3]['split'](','),process['argv'][0x4][_0x597a('0x10')](','));if(!process['argv'][0x5]||process[_0x597a('0xa')][0x5]==='undefined'||process[_0x597a('0xa')][0x5]===_0x597a('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x597a('0xa')][0x6]&&process[_0x597a('0xa')][0x6]!==_0x597a('0xb')&&process['argv'][0x6]!=='null'?process[_0x597a('0xa')][0x6]:null;var DUPLICATES=process[_0x597a('0xa')][0x7]&&process[_0x597a('0xa')][0x7]!==_0x597a('0xb')&&process['argv'][0x7]!==_0x597a('0xc')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x597a('0xa')][0x8]===_0x597a('0xb')||process[_0x597a('0xa')][0x8]==='null'){throw new Error(_0x597a('0x11'));}var SOCKET_TIMESTAMP=process[_0x597a('0xa')][0x8];}catch(_0x2ad3f5){logger[_0x597a('0x12')](_0x2ad3f5);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(_0x7c13c4,_0x331295,_0x11628d,_0x22d866){var _0x11c0c3={'message':_0x331295};_0x11c0c3[_0x7c13c4]=!![];if(_0x11628d){_0x11c0c3[_0x597a('0x13')]=_0x11628d;}if(_0x22d866){_0x11c0c3[_0x597a('0x14')]=_0x22d866;}return _0x11c0c3;}function isEmail(_0x39713e){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))*$/[_0x597a('0x15')](_0x39713e);}function checkRow(_0x2c8381,_0x56d8f4,_0x418536){return new BPromise(function(_0x32d686,_0x4974a0){if(_[_0x597a('0x16')](_0x2c8381)){return _0x4974a0(handleCheckRowError('error',_0x597a('0x17'),null,_0x418536));}if(_0x2c8381[_0x597a('0x18')]&&_0x2c8381[_0x597a('0x18')]['length']){var _0x41ada6=_['map'](_0x2c8381[_0x597a('0x18')],_0x597a('0x19'))[_0x597a('0x1a')](';');return _0x4974a0(handleCheckRowError(_0x597a('0x12'),_0x41ada6,null,_0x418536));}var _0x41f6b2={};for(var _0x46c5d9 in FIELDS){if(FIELDS[_0x597a('0x1b')](_0x46c5d9)&&FIELDS[_0x46c5d9]){_0x41f6b2[_0x46c5d9]=_0x2c8381['data'][0x0][FIELDS[_0x46c5d9]]||_0x2c8381[_0x597a('0x1c')][0x0]['\ufeff'+FIELDS[_0x46c5d9]];}}if(!_0x41f6b2['firstName']){return _0x4974a0(handleCheckRowError(_0x597a('0x12'),'firstName\x20not\x20specified!',null,_0x418536));}if(!_0x41f6b2['phone']){return _0x4974a0(handleCheckRowError(_0x597a('0x12'),_0x597a('0x1d'),null,_0x418536));}if(_0x41f6b2[_0x597a('0x1e')]){var _0x24d317=moment(_0x41f6b2[_0x597a('0x1e')],_0x597a('0x1f'));if(!_0x24d317[_0x597a('0x20')]()){return _0x4974a0(handleCheckRowError(_0x597a('0x12'),_0x597a('0x21'),null,_0x418536));}}if(_0x41f6b2[_0x597a('0x22')]){if(!isEmail(_0x41f6b2['email'])){return _0x4974a0(handleCheckRowError(_0x597a('0x12'),_0x597a('0x23'),null,_0x418536));}}_0x41f6b2[_0x597a('0x24')]=LISTID;_0x41f6b2[_0x597a('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x597a('0x26')]&&_0x56d8f4){var _0x5cf5d0={};for(var _0x8a725c=0x0,_0x328210=DUPLICATES['length'];_0x8a725c<_0x328210;_0x8a725c+=0x1){_0x5cf5d0[DUPLICATES[_0x8a725c]]=_0x41f6b2[DUPLICATES[_0x8a725c]];}var _0x2c3f20=_['find'](_0x56d8f4,_0x5cf5d0);if(_0x2c3f20){return _0x4974a0(handleCheckRowError('duplicate',_0x597a('0x27'),_0x2c3f20,_0x418536));}}return db[_0x597a('0x28')][_0x597a('0x29')](_0x41f6b2,{'raw':!![],'hooks':![],'fields':_[_0x597a('0x2a')](_0x41f6b2)})[_0x597a('0x2b')](function(_0x4dc42b){if(DUPLICATES&&DUPLICATES['length']&&_0x56d8f4){_0x56d8f4[_0x597a('0x2c')](_['pick'](_0x41f6b2,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4dc42b['id'];return _0x32d686();})[_0x597a('0x2d')](function(_0x30f2eb){return _0x4974a0(handleCheckRowError('error',_0x597a('0x2e')+(_0x30f2eb[_0x597a('0x19')]||JSON['stringify'](_0x30f2eb)),null,_0x418536));});});}function checkHopper(){function _0x595d13(){return function(_0x296c5c){logger[_0x597a('0x12')]('cmContact','checkHopper',util[_0x597a('0x2f')](_0x296c5c,{'showHidden':![],'depth':null}));};}var _0x196aed=function(_0x30a851,_0x5bffc4){var _0x17b332=squel[_0x597a('0x30')]()[_0x597a('0x31')]('cm_hopper')[_0x597a('0x32')]([_0x597a('0x33'),_0x597a('0x34'),'ContactId',_0x597a('0x24'),_0x5bffc4,_0x597a('0x35'),'updatedAt'],squel['select']()[_0x597a('0x36')]('phone',_0x597a('0x33'))[_0x597a('0x36')]('NOW()',_0x597a('0x34'))['field']('id','ContactId')[_0x597a('0x36')](LISTID['toString'](),'ListId')[_0x597a('0x36')](_0x30a851['id'][_0x597a('0x37')](),_0x5bffc4)[_0x597a('0x36')]('NOW()','createdAt')[_0x597a('0x36')](_0x597a('0x38'),_0x597a('0x39'))[_0x597a('0x3a')]('cm_contacts')[_0x597a('0x3b')](_0x597a('0x3c'))[_0x597a('0x3b')](_0x597a('0x3d'),LISTID[_0x597a('0x37')]())['where'](_0x597a('0x3e'))['where'](_0x597a('0x3f'),squel[_0x597a('0x40')]()[_0x597a('0x36')](_0x597a('0x33'))['from'](_0x597a('0x41'))[_0x597a('0x3b')](_0x5bffc4+'\x20=\x20?',_0x30a851['id'][_0x597a('0x37')]())))[_0x597a('0x37')]();return _0x17b332;};var _0x1db8d2=function(_0x2b10d4,_0xfa8da1){var _0x360283=squel[_0x597a('0x30')]()[_0x597a('0x31')](_0x597a('0x41'))['fromQuery']([_0x597a('0x33'),_0x597a('0x34'),_0x597a('0x42'),_0x597a('0x24'),_0xfa8da1,'createdAt',_0x597a('0x39')],squel['select']()[_0x597a('0x36')](_0x597a('0x33'),_0x597a('0x33'))['field'](_0x597a('0x38'),_0x597a('0x34'))[_0x597a('0x36')]('id',_0x597a('0x42'))['field'](LISTID['toString'](),_0x597a('0x24'))[_0x597a('0x36')](_0x2b10d4['id']['toString'](),_0xfa8da1)[_0x597a('0x36')]('NOW()',_0x597a('0x35'))[_0x597a('0x36')](_0x597a('0x38'),'updatedAt')['from']('cm_contacts')[_0x597a('0x3b')](_0x597a('0x3c'))['where'](_0x597a('0x3d'),LISTID[_0x597a('0x37')]())[_0x597a('0x3b')](_0x597a('0x43'),squel[_0x597a('0x44')](hopperContacts))[_0x597a('0x3b')](_0x597a('0x3e'))[_0x597a('0x3b')](_0x597a('0x3f'),squel['select']()['field'](_0x597a('0x45'))[_0x597a('0x3a')](_0x597a('0x46'))[_0x597a('0x3b')](_0xfa8da1+_0x597a('0x47'),_0x2b10d4['id']['toString']()))[_0x597a('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x597a('0x40')]()['field'](_0x597a('0x33'))[_0x597a('0x3a')]('cm_hopper')['where'](_0xfa8da1+_0x597a('0x47'),_0x2b10d4['id'][_0x597a('0x37')]())))[_0x597a('0x37')]();return _0x360283;};function _0x65953e(_0x17e43d,_0x19487f){var _0x5bd0b7=squel[_0x597a('0x30')]()[_0x597a('0x31')](_0x597a('0x41'))[_0x597a('0x32')]([_0x597a('0x33'),_0x597a('0x34'),_0x597a('0x42'),_0x597a('0x24'),_0x19487f,_0x597a('0x35'),_0x597a('0x39')],squel['select']()['field']('phone','phone')[_0x597a('0x36')](_0x597a('0x38'),'scheduledAt')['field']('id',_0x597a('0x42'))[_0x597a('0x36')](LISTID['toString'](),_0x597a('0x24'))[_0x597a('0x36')](_0x17e43d['id'][_0x597a('0x37')](),_0x19487f)[_0x597a('0x36')](_0x597a('0x38'),_0x597a('0x35'))[_0x597a('0x36')](_0x597a('0x38'),_0x597a('0x39'))[_0x597a('0x3a')](_0x597a('0x48'))['where']('deletedAt\x20IS\x20NULL')[_0x597a('0x3b')](_0x597a('0x3d'),LISTID['toString']())[_0x597a('0x3b')]('id\x20IN\x20?',squel[_0x597a('0x44')](hopperContacts))[_0x597a('0x3b')](_0x597a('0x3e')))[_0x597a('0x37')]();return _0x5bd0b7;}function _0xa00331(_0x2214e8,_0x394210){var _0x3a3b43=squel[_0x597a('0x30')]()['into'](_0x597a('0x49'))[_0x597a('0x32')]([_0x597a('0x33'),_0x597a('0x42'),'ListId',_0x394210,_0x597a('0x35'),_0x597a('0x39')],squel[_0x597a('0x40')]()[_0x597a('0x36')](_0x597a('0x33'),'phone')[_0x597a('0x36')]('id','ContactId')['field'](LISTID['toString'](),_0x597a('0x24'))[_0x597a('0x36')](_0x2214e8['id'][_0x597a('0x37')](),_0x394210)[_0x597a('0x36')](_0x597a('0x38'),_0x597a('0x35'))[_0x597a('0x36')]('NOW()',_0x597a('0x39'))[_0x597a('0x3a')]('cm_contacts')[_0x597a('0x3b')]('deletedAt\x20IS\x20NULL')['where'](_0x597a('0x3d'),LISTID[_0x597a('0x37')]())[_0x597a('0x3b')]('id\x20IN\x20?',squel[_0x597a('0x44')](hopperContacts))[_0x597a('0x3b')](_0x597a('0x3e')))[_0x597a('0x37')]();return _0x3a3b43;}return db[_0x597a('0x4a')][_0x597a('0x4b')]({'where':{'type':_0x597a('0x4c')},'attributes':['id',_0x597a('0x4d')],'include':[{'model':db['CmList'],'as':_0x597a('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0xb3158d){var _0x15ec7c=[];if(_0xb3158d){var _0x2a78d2;for(var _0x2b40ac=0x0,_0x4d4fec;_0x2b40ac<_0xb3158d[_0x597a('0x26')];_0x2b40ac+=0x1){_0x4d4fec=_0xb3158d[_0x2b40ac]['get']({'plain':!![]});switch(_0x4d4fec['dialCheckDuplicateType']){case _0x597a('0x4f'):_0x15ec7c[_0x597a('0x2c')](db[_0x597a('0x50')][_0x597a('0x51')](_0x1db8d2(_0x4d4fec,'VoiceQueueId'))[_0x597a('0x2b')](function(){})[_0x597a('0x2d')](_0x595d13()));break;case _0x597a('0x52'):_0x15ec7c[_0x597a('0x2c')](db[_0x597a('0x50')][_0x597a('0x51')](_0x196aed(_0x4d4fec,_0x597a('0x53')))[_0x597a('0x2b')](function(){})[_0x597a('0x2d')](_0x595d13()));break;default:_0x15ec7c['push'](db[_0x597a('0x50')]['query'](_0x65953e(_0x4d4fec,_0x597a('0x53')))['then'](function(){})[_0x597a('0x2d')](_0x595d13()));}}}return _0x15ec7c;})[_0x597a('0x54')]()[_0x597a('0x2b')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x597a('0x4c')},'attributes':['id'],'include':[{'model':db[_0x597a('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x597a('0x2b')](function(_0x37e2ec){var _0x86b158=[];if(_0x37e2ec){var _0x5437f5;for(var _0x286681=0x0,_0x5b7a2d;_0x286681<_0x37e2ec[_0x597a('0x26')];_0x286681+=0x1){_0x5b7a2d=_0x37e2ec[_0x286681]['get']({'plain':!![]});_0x86b158['push'](db[_0x597a('0x50')][_0x597a('0x51')](_0xa00331(_0x5b7a2d,_0x597a('0x53')))[_0x597a('0x2b')](function(){})['catch'](_0x595d13()));}}return _0x86b158;})['all']();})[_0x597a('0x2b')](function(){return db[_0x597a('0x56')][_0x597a('0x4b')]({'attributes':['id',_0x597a('0x4d')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x3da572){var _0x5e8702=[];if(_0x3da572){for(var _0x14a205=0x0,_0x5d1a69;_0x14a205<_0x3da572[_0x597a('0x26')];_0x14a205+=0x1){_0x5d1a69=_0x3da572[_0x14a205][_0x597a('0x57')]({'plain':!![]});switch(_0x5d1a69[_0x597a('0x4d')]){case'always':_0x5e8702[_0x597a('0x2c')](db[_0x597a('0x50')][_0x597a('0x51')](_0x1db8d2(_0x5d1a69,_0x597a('0x58')))[_0x597a('0x2b')](function(){})[_0x597a('0x2d')](_0x595d13()));break;case _0x597a('0x52'):_0x5e8702[_0x597a('0x2c')](db[_0x597a('0x50')][_0x597a('0x51')](_0x196aed(_0x5d1a69,_0x597a('0x58')))[_0x597a('0x2b')](function(){})[_0x597a('0x2d')](_0x595d13()));break;default:_0x5e8702[_0x597a('0x2c')](db[_0x597a('0x50')][_0x597a('0x51')](_0x65953e(_0x5d1a69,_0x597a('0x58')))[_0x597a('0x2b')](function(){})[_0x597a('0x2d')](_0x595d13()));}}}return _0x5e8702;})[_0x597a('0x54')]();})[_0x597a('0x2b')](function(){return db[_0x597a('0x56')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x597a('0x55')],'as':_0x597a('0x59'),'where':{'id':LISTID}}]})[_0x597a('0x2b')](function(_0x4958ca){var _0x14556a=[];if(_0x4958ca){for(var _0x370fb0=0x0,_0x1fa527;_0x370fb0<_0x4958ca[_0x597a('0x26')];_0x370fb0+=0x1){_0x1fa527=_0x4958ca[_0x370fb0][_0x597a('0x57')]({'plain':!![]});_0x14556a['push'](db[_0x597a('0x50')][_0x597a('0x51')](_0xa00331(_0x1fa527,_0x597a('0x58')))[_0x597a('0x2b')](function(){})['catch'](_0x595d13()));}}return _0x14556a;})[_0x597a('0x54')]();})['catch'](function(_0x18605c){logger['error'](_0x597a('0x5a'),_0x597a('0x5b'),_0x18605c['message']);});}var processPromises=function(_0x251bde){return BPromise[_0x597a('0x54')](promises)['then'](function(_0x138e41){})[_0x597a('0x2d')](function(_0x31b429){logger[_0x597a('0x12')](_0x597a('0x5c'),JSON['stringify'](_0x31b429));})[_0x597a('0x5d')](function(){socket['emit'](_0x597a('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x251bde){return _0x251bde[_0x597a('0x5f')]();}});};var endCsv=function(){return BPromise[_0x597a('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x597a('0x2b')](function(){socket['emit'](_0x597a('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x597a('0x61')](FILEPATH);}catch(_0x4a1816){logger[_0x597a('0x12')](_0x597a('0x62'),JSON[_0x597a('0x63')](_0x4a1816));}finally{process[_0x597a('0x64')](0x0);}});};process['on'](_0x597a('0x65'),function(){logger[_0x597a('0x66')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x597a('0x60')]()[_0x597a('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x597a('0x10')](',');return db[_0x597a('0x28')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x127439){var _0x269538=fs[_0x597a('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x597a('0x68')](_0x269538,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5b57db,_0x38d04f){total+=0x1;var _0x54aa9b=total;promises[_0x597a('0x2c')](checkRow(_0x5b57db,_0x127439,_0x54aa9b)[_0x597a('0x2b')](function(){success+=0x1;})[_0x597a('0x2d')](function(_0x1c06be){if(_0x1c06be['error']){errors+=0x1;delete _0x1c06be[_0x597a('0x12')];}else if(_0x1c06be[_0x597a('0x69')]){duplicates+=0x1;delete _0x1c06be[_0x597a('0x69')];}rows[_0x597a('0x2c')](_0x1c06be);}));if(total%0xc8===0x0){_0x38d04f[_0x597a('0x6a')]();return processPromises(_0x38d04f);}},'complete':function(){return processPromises()[_0x597a('0x2b')](function(){logger[_0x597a('0x66')](_0x597a('0x6b'));endCsv();});},'error':function(_0x1a6b13,_0x55d30e){logger[_0x597a('0x66')](_0x597a('0x6c'),JSON[_0x597a('0x63')](_0x1a6b13));endCsv();}});})[_0x597a('0x2d')](function(_0x436f44){logger['error'](_0x597a('0x6d'),JSON[_0x597a('0x63')](_0x436f44));});}main(); \ No newline at end of file +var _0x2ba8=['argv','undefined','null','split','Missing\x20ListId\x20parameter!','error','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName\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','find','duplicate','CmContact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','updatedAt','select','field','NOW()','ContactId','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','createdAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','then','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','findAll','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','message','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x1e6766,_0x38810d){var _0x56df5e=function(_0x25cd44){while(--_0x25cd44){_0x1e6766['push'](_0x1e6766['shift']());}};_0x56df5e(++_0x38810d);}(_0x2ba8,0x1a2));var _0x82ba=function(_0x16b683,_0x1de3db){_0x16b683=_0x16b683-0x0;var _0x25c35c=_0x2ba8[_0x16b683];return _0x25c35c;};'use strict';var BPromise=require(_0x82ba('0x0'));var util=require('util');var _=require(_0x82ba('0x1'));var fs=require('fs');var squel=require(_0x82ba('0x2'));var Papa=require(_0x82ba('0x3'));var Redis=require(_0x82ba('0x4'));var db=require(_0x82ba('0x5'))['db'];var config=require(_0x82ba('0x6'));var logger=require(_0x82ba('0x7'))(_0x82ba('0x8'));config['redis']=_[_0x82ba('0x9')](config[_0x82ba('0xa')],{'host':_0x82ba('0xb'),'port':0x18eb});var socket=require(_0x82ba('0xc'))(new Redis(config[_0x82ba('0xa')]));require('../../../api/cmContact/cmContact.socket')[_0x82ba('0xd')](socket);try{if(!process[_0x82ba('0xe')][0x2]||process[_0x82ba('0xe')][0x2]===_0x82ba('0xf')||process[_0x82ba('0xe')][0x2]===_0x82ba('0x10')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x82ba('0xe')][0x2];if(!process[_0x82ba('0xe')][0x3]||process[_0x82ba('0xe')][0x3]===_0x82ba('0xf')||process['argv'][0x3]===_0x82ba('0x10')||!process[_0x82ba('0xe')][0x4]||process[_0x82ba('0xe')][0x4]===_0x82ba('0xf')||process[_0x82ba('0xe')][0x4]===_0x82ba('0x10')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0x82ba('0xe')][0x3][_0x82ba('0x11')](','),process[_0x82ba('0xe')][0x4]['split'](','));if(!process[_0x82ba('0xe')][0x5]||process[_0x82ba('0xe')][0x5]===_0x82ba('0xf')||process[_0x82ba('0xe')][0x5]===_0x82ba('0x10')){throw new Error(_0x82ba('0x12'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x82ba('0xe')][0x6]&&process['argv'][0x6]!==_0x82ba('0xf')&&process[_0x82ba('0xe')][0x6]!==_0x82ba('0x10')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x82ba('0xe')][0x7]!==_0x82ba('0xf')&&process[_0x82ba('0xe')][0x7]!==_0x82ba('0x10')?process[_0x82ba('0xe')][0x7]:null;if(!process[_0x82ba('0xe')][0x8]||process['argv'][0x8]===_0x82ba('0xf')||process[_0x82ba('0xe')][0x8]===_0x82ba('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x52bf3f){logger[_0x82ba('0x13')](_0x52bf3f);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(_0x1b9f33,_0x13e63d,_0xc60c5c,_0x1ece90){var _0x5d0447={'message':_0x13e63d};_0x5d0447[_0x1b9f33]=!![];if(_0xc60c5c){_0x5d0447['contact']=_0xc60c5c;}if(_0x1ece90){_0x5d0447['index']=_0x1ece90;}return _0x5d0447;}function isEmail(_0x34ec9f){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x34ec9f);}function checkRow(_0xab23e0,_0x5ac9b8,_0x17e7c4){return new BPromise(function(_0x109049,_0x25c861){if(_[_0x82ba('0x14')](_0xab23e0)){return _0x25c861(handleCheckRowError('error',_0x82ba('0x15'),null,_0x17e7c4));}if(_0xab23e0[_0x82ba('0x16')]&&_0xab23e0['errors'][_0x82ba('0x17')]){var _0x69dd53=_[_0x82ba('0x18')](_0xab23e0[_0x82ba('0x16')],'message')[_0x82ba('0x19')](';');return _0x25c861(handleCheckRowError('error',_0x69dd53,null,_0x17e7c4));}var _0x41160d={};for(var _0x53356e in FIELDS){if(FIELDS[_0x82ba('0x1a')](_0x53356e)&&FIELDS[_0x53356e]){_0x41160d[_0x53356e]=_0xab23e0[_0x82ba('0x1b')][0x0][FIELDS[_0x53356e]]||_0xab23e0[_0x82ba('0x1b')][0x0]['\ufeff'+FIELDS[_0x53356e]];}}if(!_0x41160d['firstName']){return _0x25c861(handleCheckRowError(_0x82ba('0x13'),_0x82ba('0x1c'),null,_0x17e7c4));}if(!_0x41160d['phone']){return _0x25c861(handleCheckRowError(_0x82ba('0x13'),'phone\x20not\x20specified!',null,_0x17e7c4));}if(_0x41160d['birthDate']){var _0x520e78=moment(_0x41160d[_0x82ba('0x1d')],_0x82ba('0x1e'));if(!_0x520e78[_0x82ba('0x1f')]()){return _0x25c861(handleCheckRowError(_0x82ba('0x13'),_0x82ba('0x20'),null,_0x17e7c4));}}if(_0x41160d[_0x82ba('0x21')]){if(!isEmail(_0x41160d['email'])){return _0x25c861(handleCheckRowError('error',_0x82ba('0x22'),null,_0x17e7c4));}}_0x41160d[_0x82ba('0x23')]=LISTID;_0x41160d[_0x82ba('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x82ba('0x17')]&&_0x5ac9b8){var _0x328d42={};for(var _0x12ed9a=0x0,_0x469920=DUPLICATES['length'];_0x12ed9a<_0x469920;_0x12ed9a+=0x1){_0x328d42[DUPLICATES[_0x12ed9a]]=_0x41160d[DUPLICATES[_0x12ed9a]];}var _0x42421f=_[_0x82ba('0x25')](_0x5ac9b8,_0x328d42);if(_0x42421f){return _0x25c861(handleCheckRowError(_0x82ba('0x26'),'Duplicate\x20Contact',_0x42421f,_0x17e7c4));}}return db[_0x82ba('0x27')][_0x82ba('0x28')](_0x41160d,{'raw':!![],'hooks':![],'fields':_[_0x82ba('0x29')](_0x41160d)})['then'](function(_0x4f736f){if(DUPLICATES&&DUPLICATES[_0x82ba('0x17')]&&_0x5ac9b8){_0x5ac9b8[_0x82ba('0x2a')](_[_0x82ba('0x2b')](_0x41160d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4f736f['id'];return _0x109049();})[_0x82ba('0x2c')](function(_0x2f50d9){return _0x25c861(handleCheckRowError(_0x82ba('0x13'),_0x82ba('0x2d')+(_0x2f50d9['message']||JSON[_0x82ba('0x2e')](_0x2f50d9)),null,_0x17e7c4));});});}function checkHopper(){function _0x3c93da(){return function(_0x14512f){logger[_0x82ba('0x13')](_0x82ba('0x2f'),'checkHopper',util[_0x82ba('0x30')](_0x14512f,{'showHidden':![],'depth':null}));};}var _0x442f86=function(_0x3d136a,_0x5d2d43){var _0x59628f=squel[_0x82ba('0x31')]()[_0x82ba('0x32')](_0x82ba('0x33'))[_0x82ba('0x34')]([_0x82ba('0x35'),_0x82ba('0x36'),'ContactId',_0x82ba('0x23'),_0x5d2d43,'createdAt',_0x82ba('0x37')],squel[_0x82ba('0x38')]()[_0x82ba('0x39')](_0x82ba('0x35'),_0x82ba('0x35'))[_0x82ba('0x39')](_0x82ba('0x3a'),_0x82ba('0x36'))[_0x82ba('0x39')]('id',_0x82ba('0x3b'))[_0x82ba('0x39')](LISTID['toString'](),'ListId')[_0x82ba('0x39')](_0x3d136a['id']['toString'](),_0x5d2d43)[_0x82ba('0x39')]('NOW()','createdAt')[_0x82ba('0x39')]('NOW()',_0x82ba('0x37'))[_0x82ba('0x3c')](_0x82ba('0x3d'))[_0x82ba('0x3e')](_0x82ba('0x3f'))[_0x82ba('0x3e')](_0x82ba('0x40'),LISTID[_0x82ba('0x41')]())[_0x82ba('0x3e')](_0x82ba('0x42'))[_0x82ba('0x3e')](_0x82ba('0x43'),squel['select']()[_0x82ba('0x39')]('phone')['from'](_0x82ba('0x33'))[_0x82ba('0x3e')](_0x5d2d43+_0x82ba('0x44'),_0x3d136a['id'][_0x82ba('0x41')]())))['toString']();return _0x59628f;};var _0x3795d4=function(_0x3053be,_0x1a1c64){var _0x5973be=squel['insert']()['into'](_0x82ba('0x33'))['fromQuery']([_0x82ba('0x35'),_0x82ba('0x36'),_0x82ba('0x3b'),'ListId',_0x1a1c64,'createdAt',_0x82ba('0x37')],squel[_0x82ba('0x38')]()[_0x82ba('0x39')](_0x82ba('0x35'),_0x82ba('0x35'))[_0x82ba('0x39')](_0x82ba('0x3a'),_0x82ba('0x36'))[_0x82ba('0x39')]('id',_0x82ba('0x3b'))[_0x82ba('0x39')](LISTID[_0x82ba('0x41')](),_0x82ba('0x23'))[_0x82ba('0x39')](_0x3053be['id'][_0x82ba('0x41')](),_0x1a1c64)['field']('NOW()',_0x82ba('0x45'))[_0x82ba('0x39')](_0x82ba('0x3a'),'updatedAt')[_0x82ba('0x3c')](_0x82ba('0x3d'))[_0x82ba('0x3e')](_0x82ba('0x3f'))[_0x82ba('0x3e')](_0x82ba('0x40'),LISTID[_0x82ba('0x41')]())[_0x82ba('0x3e')](_0x82ba('0x46'),squel[_0x82ba('0x47')](hopperContacts))[_0x82ba('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x82ba('0x3e')](_0x82ba('0x43'),squel[_0x82ba('0x38')]()[_0x82ba('0x39')](_0x82ba('0x48'))[_0x82ba('0x3c')](_0x82ba('0x49'))[_0x82ba('0x3e')](_0x1a1c64+'\x20=\x20?',_0x3053be['id'][_0x82ba('0x41')]()))[_0x82ba('0x3e')](_0x82ba('0x43'),squel[_0x82ba('0x38')]()[_0x82ba('0x39')]('phone')[_0x82ba('0x3c')]('cm_hopper')[_0x82ba('0x3e')](_0x1a1c64+_0x82ba('0x44'),_0x3053be['id'][_0x82ba('0x41')]())))[_0x82ba('0x41')]();return _0x5973be;};function _0x2c7ef3(_0x42dac8,_0x3513ff){var _0x9bf345=squel[_0x82ba('0x31')]()[_0x82ba('0x32')](_0x82ba('0x33'))[_0x82ba('0x34')](['phone',_0x82ba('0x36'),'ContactId','ListId',_0x3513ff,_0x82ba('0x45'),_0x82ba('0x37')],squel['select']()['field'](_0x82ba('0x35'),_0x82ba('0x35'))[_0x82ba('0x39')](_0x82ba('0x3a'),'scheduledAt')['field']('id',_0x82ba('0x3b'))[_0x82ba('0x39')](LISTID['toString'](),_0x82ba('0x23'))[_0x82ba('0x39')](_0x42dac8['id'][_0x82ba('0x41')](),_0x3513ff)['field'](_0x82ba('0x3a'),_0x82ba('0x45'))['field'](_0x82ba('0x3a'),_0x82ba('0x37'))[_0x82ba('0x3c')]('cm_contacts')['where'](_0x82ba('0x3f'))[_0x82ba('0x3e')](_0x82ba('0x40'),LISTID[_0x82ba('0x41')]())[_0x82ba('0x3e')](_0x82ba('0x46'),squel[_0x82ba('0x47')](hopperContacts))[_0x82ba('0x3e')](_0x82ba('0x42')))[_0x82ba('0x41')]();return _0x9bf345;}function _0x4ed2bc(_0x13a370,_0x472f90){var _0x16cb28=squel[_0x82ba('0x31')]()[_0x82ba('0x32')](_0x82ba('0x4a'))[_0x82ba('0x34')]([_0x82ba('0x35'),_0x82ba('0x3b'),_0x82ba('0x23'),_0x472f90,_0x82ba('0x45'),'updatedAt'],squel[_0x82ba('0x38')]()['field'](_0x82ba('0x35'),_0x82ba('0x35'))[_0x82ba('0x39')]('id','ContactId')[_0x82ba('0x39')](LISTID[_0x82ba('0x41')](),'ListId')[_0x82ba('0x39')](_0x13a370['id']['toString'](),_0x472f90)['field'](_0x82ba('0x3a'),_0x82ba('0x45'))['field'](_0x82ba('0x3a'),_0x82ba('0x37'))[_0x82ba('0x3c')](_0x82ba('0x3d'))['where'](_0x82ba('0x3f'))[_0x82ba('0x3e')](_0x82ba('0x40'),LISTID[_0x82ba('0x41')]())[_0x82ba('0x3e')](_0x82ba('0x46'),squel[_0x82ba('0x47')](hopperContacts))[_0x82ba('0x3e')](_0x82ba('0x42')))[_0x82ba('0x41')]();return _0x16cb28;}return db[_0x82ba('0x4b')]['findAll']({'where':{'type':_0x82ba('0x4c')},'attributes':['id',_0x82ba('0x4d')],'include':[{'model':db[_0x82ba('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0x82ba('0x4f')](function(_0xfe40f8){var _0x49ddcb=[];if(_0xfe40f8){var _0x471a55;for(var _0x4a485b=0x0,_0x4e9b53;_0x4a485b<_0xfe40f8[_0x82ba('0x17')];_0x4a485b+=0x1){_0x4e9b53=_0xfe40f8[_0x4a485b][_0x82ba('0x50')]({'plain':!![]});switch(_0x4e9b53['dialCheckDuplicateType']){case _0x82ba('0x51'):_0x49ddcb[_0x82ba('0x2a')](db[_0x82ba('0x52')]['query'](_0x3795d4(_0x4e9b53,_0x82ba('0x53')))['then'](function(){})[_0x82ba('0x2c')](_0x3c93da()));break;case _0x82ba('0x54'):_0x49ddcb[_0x82ba('0x2a')](db[_0x82ba('0x52')][_0x82ba('0x55')](_0x442f86(_0x4e9b53,_0x82ba('0x53')))['then'](function(){})[_0x82ba('0x2c')](_0x3c93da()));break;default:_0x49ddcb[_0x82ba('0x2a')](db[_0x82ba('0x52')][_0x82ba('0x55')](_0x2c7ef3(_0x4e9b53,_0x82ba('0x53')))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));}}}return _0x49ddcb;})[_0x82ba('0x56')]()['then'](function(){return db[_0x82ba('0x4b')][_0x82ba('0x57')]({'where':{'type':_0x82ba('0x4c')},'attributes':['id'],'include':[{'model':db[_0x82ba('0x4e')],'as':_0x82ba('0x58'),'where':{'id':LISTID}}]})[_0x82ba('0x4f')](function(_0x23d766){var _0x283df3=[];if(_0x23d766){var _0x10ff84;for(var _0x5f1851=0x0,_0x308efc;_0x5f1851<_0x23d766[_0x82ba('0x17')];_0x5f1851+=0x1){_0x308efc=_0x23d766[_0x5f1851][_0x82ba('0x50')]({'plain':!![]});_0x283df3[_0x82ba('0x2a')](db['sequelize'][_0x82ba('0x55')](_0x4ed2bc(_0x308efc,_0x82ba('0x53')))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));}}return _0x283df3;})[_0x82ba('0x56')]();})['then'](function(){return db[_0x82ba('0x59')][_0x82ba('0x57')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x82ba('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0x82ba('0x4f')](function(_0xcc78f9){var _0x2a2161=[];if(_0xcc78f9){for(var _0x150920=0x0,_0x19aa0e;_0x150920<_0xcc78f9[_0x82ba('0x17')];_0x150920+=0x1){_0x19aa0e=_0xcc78f9[_0x150920][_0x82ba('0x50')]({'plain':!![]});switch(_0x19aa0e[_0x82ba('0x4d')]){case'always':_0x2a2161[_0x82ba('0x2a')](db[_0x82ba('0x52')][_0x82ba('0x55')](_0x3795d4(_0x19aa0e,_0x82ba('0x5a')))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));break;case _0x82ba('0x54'):_0x2a2161[_0x82ba('0x2a')](db['sequelize']['query'](_0x442f86(_0x19aa0e,_0x82ba('0x5a')))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));break;default:_0x2a2161[_0x82ba('0x2a')](db[_0x82ba('0x52')]['query'](_0x2c7ef3(_0x19aa0e,_0x82ba('0x5a')))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));}}}return _0x2a2161;})['all']();})[_0x82ba('0x4f')](function(){return db[_0x82ba('0x59')][_0x82ba('0x57')]({'attributes':['id'],'include':[{'model':db[_0x82ba('0x4e')],'as':_0x82ba('0x58'),'where':{'id':LISTID}}]})['then'](function(_0xacf681){var _0x375752=[];if(_0xacf681){for(var _0x49f987=0x0,_0x4ad992;_0x49f987<_0xacf681[_0x82ba('0x17')];_0x49f987+=0x1){_0x4ad992=_0xacf681[_0x49f987]['get']({'plain':!![]});_0x375752[_0x82ba('0x2a')](db[_0x82ba('0x52')][_0x82ba('0x55')](_0x4ed2bc(_0x4ad992,'CampaignId'))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));}}return _0x375752;})[_0x82ba('0x56')]();})[_0x82ba('0x2c')](function(_0x3a2e71){logger[_0x82ba('0x13')](_0x82ba('0x5b'),'generalCheckHopper',_0x3a2e71[_0x82ba('0x5c')]);});}var processPromises=function(_0xe7893d){return BPromise['all'](promises)[_0x82ba('0x4f')](function(_0x5b147c){})[_0x82ba('0x2c')](function(_0x664e8e){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x82ba('0x2e')](_0x664e8e));})[_0x82ba('0x5d')](function(){socket[_0x82ba('0x5e')](_0x82ba('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xe7893d){return _0xe7893d[_0x82ba('0x60')]();}});};var endCsv=function(){return BPromise[_0x82ba('0x61')]()[_0x82ba('0x4f')](function(){if(hopperContacts){return checkHopper();}})[_0x82ba('0x4f')](function(){socket['emit'](_0x82ba('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x82ba('0x62')](FILEPATH);}catch(_0x4e3a59){logger['error'](_0x82ba('0x63'),JSON[_0x82ba('0x2e')](_0x4e3a59));}finally{process['exit'](0x0);}});};process['on'](_0x82ba('0x64'),function(){logger['info'](_0x82ba('0x65'));endCsv();});function main(){return BPromise[_0x82ba('0x61')]()[_0x82ba('0x4f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x82ba('0x11')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1dbae5){var _0x2d8c02=fs[_0x82ba('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x82ba('0x67')](_0x2d8c02,{'header':!![],'skipEmptyLines':!![],'step':function(_0x26d146,_0x1debe6){total+=0x1;var _0x13c6cd=total;promises[_0x82ba('0x2a')](checkRow(_0x26d146,_0x1dbae5,_0x13c6cd)[_0x82ba('0x4f')](function(){success+=0x1;})[_0x82ba('0x2c')](function(_0x3f10e5){if(_0x3f10e5[_0x82ba('0x13')]){errors+=0x1;delete _0x3f10e5[_0x82ba('0x13')];}else if(_0x3f10e5[_0x82ba('0x26')]){duplicates+=0x1;delete _0x3f10e5[_0x82ba('0x26')];}rows[_0x82ba('0x2a')](_0x3f10e5);}));if(total%0xc8===0x0){_0x1debe6[_0x82ba('0x68')]();return processPromises(_0x1debe6);}},'complete':function(){return processPromises()[_0x82ba('0x4f')](function(){logger[_0x82ba('0x69')](_0x82ba('0x6a'));endCsv();});},'error':function(_0x9b1984,_0x39afff){logger[_0x82ba('0x69')]('CSV\x20parse\x20error',JSON[_0x82ba('0x2e')](_0x9b1984));endCsv();}});})[_0x82ba('0x2c')](function(_0x2b1701){logger[_0x82ba('0x13')](_0x82ba('0x6b'),JSON[_0x82ba('0x2e')](_0x2b1701));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 67ba49e..cb2bb63 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 _0xb0ca=['cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','group','info','message','exit','code','sequelize','spread','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','catch','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','offset','dialTimezone','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','keys','ContactItemType','name','header','data','rows','errors','find','_description','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','parse','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','ioredis','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','field','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','isNil','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','createdAt','updatedAt','priority','UserId','fields','from','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper_black','ContactId','select','cm_contacts','.CmListId','.CmListId\x20=\x20?','ListId\x20=\x20?','toString','cm_contacts.priority','ListId','recallme','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId'];(function(_0x5b4b3e,_0x2dd356){var _0x589d5a=function(_0x201d8e){while(--_0x201d8e){_0x5b4b3e['push'](_0x5b4b3e['shift']());}};_0x589d5a(++_0x2dd356);}(_0xb0ca,0x11e));var _0xab0c=function(_0x2579a6,_0x1955a3){_0x2579a6=_0x2579a6-0x0;var _0x5bb1c4=_0xb0ca[_0x2579a6];return _0x5bb1c4;};'use strict';var fs=require('fs');var path=require(_0xab0c('0x0'));var _=require('lodash');var Papa=require(_0xab0c('0x1'));var util=require(_0xab0c('0x2'));var BPromise=require(_0xab0c('0x3'));var moment=require(_0xab0c('0x4'));var squel=require('squel');var Redis=require(_0xab0c('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xab0c('0x6'));var shared=require(_0xab0c('0x7'));var logger=require('../../../config/logger')(_0xab0c('0x8'));config[_0xab0c('0x9')]=_[_0xab0c('0xa')](config['redis'],{'host':_0xab0c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab0c('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xab0c('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xab0c('0xd'));function isEmail(_0x4917a8){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))*$/[_0xab0c('0xe')](_0x4917a8);}function selectNotIn(_0x49956b,_0x4a9e3c,_0x1c1e6c,_0x1f40c2,_0xbff488){return squel['select']()[_0xab0c('0xf')]('phone')['from'](_0x1f40c2)[_0xab0c('0x10')](_0x4a9e3c,null,_0x4a9e3c+_0xab0c('0x11')+_0x1f40c2+'.'+_0x1c1e6c)[_0xab0c('0x12')](_0x1f40c2+'.'+_0x1c1e6c+_0xab0c('0x13')+_0x49956b+'.'+_0x1c1e6c)[_0xab0c('0x12')](_0x4a9e3c+_0xab0c('0x14')+_0xbff488[_0xab0c('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x36f296,_0x1cb06f){promisesAdditionalPhones=[];return db['CmContact'][_0xab0c('0x15')]({'raw':!![],'attributes':['id',_0xab0c('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xab0c('0x17')](function(_0x3d3765){if(_0x3d3765!==null){var _0x156501=[];for(var _0x1a9247=0x0;_0x1a9247<_0x3d3765[_0xab0c('0x18')];_0x1a9247++){var _0x34ffc8=_0x3d3765[_0x1a9247];_0x156501[_0xab0c('0x19')](insertAdditionalPhones(_0x34ffc8));}}Promise[_0xab0c('0x1a')](_0x156501)[_0xab0c('0x17')](function(){_0x36f296({'val':0x1});});});});}function insertAdditionalPhones(_0x21910d){return new Promise(function(_0x25490e,_0x88ab72){var _0x569533=_0x21910d[_0xab0c('0x16')];var _0xcfc091=_0x569533['split'](';');var _0x314502=[];orderBy=0x0;for(var _0x17b3ff=0x0;_0x17b3ff<_0xcfc091[_0xab0c('0x18')];_0x17b3ff++){_0x314502[_0xab0c('0x19')](splitAdditionalPhone(_0x21910d['id'],_0xcfc091[_0x17b3ff]));}Promise[_0xab0c('0x1a')](_0x314502)[_0xab0c('0x17')](function(){_0x25490e({'val':_0xcfc091['length']});});});}function splitAdditionalPhone(_0x16cec9,_0x27b52d){return new Promise(function(_0x316b5b,_0x3f49c0){var _0x2dd227=_0x27b52d['split'](':');var _0x5403fb=_0x2dd227[0x0];var _0x4898b3=_0x2dd227[0x1];if(!_[_0xab0c('0x1b')](_0x4898b3)){var _0x876931=_0x4898b3[_0xab0c('0x1c')]('|');var _0x1f8edd=[];for(var _0x1c2380=0x0;_0x1c2380<_0x876931[_0xab0c('0x18')];_0x1c2380++){if(_0x876931[_0x1c2380]!==''){var _0x4380b7=_[_0xab0c('0x1d')](promisesAdditionalPhones,{'contactId':_0x16cec9,'phone':_0x876931[_0x1c2380]});if(_0x4380b7['length']==0x0){orderBy++;promisesAdditionalPhones[_0xab0c('0x19')]({'contactId':_0x16cec9,'contactTypeId':_0x5403fb,'phone':_0x876931[_0x1c2380],'orderBy':orderBy});}}}_0x316b5b({'ok':0x1});}else _0x316b5b({'res':0x0});});}function createAdditionalPhone(_0x16b103,_0xc4f81c,_0x3a098e,_0x3726c9){var _0x3be16c='';var _0x4075ce='';var _0x2977ef=_0x3a098e[_0xab0c('0x1c')]('§');_0x3be16c=_0x2977ef[0x0];if(_0x2977ef[_0xab0c('0x18')]==0x2)_0x4075ce=_0x2977ef[0x1];return new Promise(function(_0x6f9ab,_0x28ed35){return db[_0xab0c('0x1e')][_0xab0c('0x1f')]({'where':{'CmContactId':_0x16b103,'item':_0x3be16c}})[_0xab0c('0x17')](function(_0x3d68f8){if(_0x3d68f8){return db[_0xab0c('0x1e')][_0xab0c('0x20')]({'ItemTypeId':_0xc4f81c,'description':_0x4075ce,'OrderBy':_0x3726c9},{'where':{'CmContactId':_0x16b103,'item':_0x3be16c}})[_0xab0c('0x17')](function(_0x3fe97e){_0x6f9ab({'res':_0xab0c('0x21')});});}else{return db['CmContactHasItem'][_0xab0c('0x22')]({'CmContactId':_0x16b103,'item':_0x3be16c,'description':_0x4075ce,'ItemTypeId':_0xc4f81c,'OrderBy':_0x3726c9,'ItemClass':_0xab0c('0x23')})['then'](function(_0x3d0793){_0x6f9ab({'res':_0xab0c('0x24')});});}});});}function insertCmHopper(_0x5bc2c4,_0x212faa,_0x29c767,_0x478303,_0x539c9b){var _0x2a76e2=[_0xab0c('0x25'),_0xab0c('0x26'),_0xab0c('0x27'),_0xab0c('0x28'),_0x212faa+'.'+_0x478303,_0xab0c('0x29'),_0xab0c('0x2a'),'cm_contacts.priority',_0xab0c('0x2b'),'\x22'+_0x539c9b+'\x22'];return squel[_0xab0c('0x2c')]()[_0xab0c('0x2d')](_0xab0c('0x2e'))[_0xab0c('0x2f')]([_0xab0c('0x30'),_0xab0c('0x31'),'ContactId','ListId',_0x478303,_0xab0c('0x32'),_0xab0c('0x33'),_0xab0c('0x34'),_0xab0c('0x35'),'recallme'],squel['select']()[_0xab0c('0x36')](_0x2a76e2)[_0xab0c('0x37')](_0x212faa)[_0xab0c('0x10')]('cm_contacts',null,_0xab0c('0x38')+_0x212faa+'.CmListId')[_0xab0c('0x10')](_0x29c767,null,_0x29c767+_0xab0c('0x11')+_0x212faa+'.'+_0x478303)['where'](_0x212faa+'.CmListId\x20=\x20?',_0x5bc2c4)[_0xab0c('0x12')](_0xab0c('0x39'),NOW)[_0xab0c('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x212faa,_0x29c767,_0x478303,_0xab0c('0x2e'),[_0xab0c('0x3a'),_0xab0c('0x3b')]))[_0xab0c('0x12')](_0xab0c('0x3c'),selectNotIn(_0x212faa,_0x29c767,_0x478303,'cm_hopper',[_0xab0c('0x3a')])))['toString']();}function insertCmHopperBlack(_0x424d9f,_0x85503,_0x19e7fe,_0x3bd996){var _0x47dab7=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x85503+'.'+_0x3bd996,_0xab0c('0x29'),_0xab0c('0x2a')];return squel[_0xab0c('0x2c')]()[_0xab0c('0x2d')](_0xab0c('0x3d'))[_0xab0c('0x2f')]([_0xab0c('0x30'),_0xab0c('0x3e'),'ListId',_0x3bd996,_0xab0c('0x32'),'updatedAt'],squel[_0xab0c('0x3f')]()[_0xab0c('0x36')](_0x47dab7)[_0xab0c('0x37')](_0x85503)['join'](_0xab0c('0x40'),null,_0xab0c('0x38')+_0x85503+_0xab0c('0x41'))[_0xab0c('0x10')](_0x19e7fe,null,_0x19e7fe+_0xab0c('0x11')+_0x85503+'.'+_0x3bd996)[_0xab0c('0x12')](_0x85503+_0xab0c('0x42'),_0x424d9f)[_0xab0c('0x12')](_0xab0c('0x39'),NOW)[_0xab0c('0x12')](_0xab0c('0x3c'),squel['select']()[_0xab0c('0xf')](_0xab0c('0x30'))[_0xab0c('0x37')](_0xab0c('0x3d'))[_0xab0c('0x12')](_0xab0c('0x43'),_0x424d9f)[_0xab0c('0x12')](_0x3bd996+_0xab0c('0x13')+_0x85503+'.'+_0x3bd996)))[_0xab0c('0x44')]();}function insertTzCmHopper(_0x4188bf,_0x3ad1cc,_0x7d6a9b,_0x5bb2a7,_0x75b9b0,_0x4a04af){var _0x419ce5=[_0xab0c('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x4a04af+'.offset-cm_contacts.utcOffset\x20minute)',_0xab0c('0x27'),_0xab0c('0x28'),_0x3ad1cc+'.'+_0x5bb2a7,_0xab0c('0x29'),'cm_contacts.updatedAt',_0xab0c('0x45'),_0xab0c('0x2b'),'\x22'+_0x75b9b0+'\x22'];var _0x527274=squel[_0xab0c('0x2c')]()[_0xab0c('0x2d')](_0xab0c('0x2e'))['fromQuery']([_0xab0c('0x30'),_0xab0c('0x31'),_0xab0c('0x3e'),_0xab0c('0x46'),_0x5bb2a7,_0xab0c('0x32'),'updatedAt','priority','UserId',_0xab0c('0x47')],squel[_0xab0c('0x3f')]()[_0xab0c('0x36')](_0x419ce5)[_0xab0c('0x37')](_0x3ad1cc)[_0xab0c('0x10')](_0xab0c('0x40'),null,_0xab0c('0x38')+_0x3ad1cc+_0xab0c('0x41'))[_0xab0c('0x10')](_0x7d6a9b,null,_0x7d6a9b+_0xab0c('0x11')+_0x3ad1cc+'.'+_0x5bb2a7)['join'](_0x4a04af,null,_0x4a04af+_0xab0c('0x11')+_0x3ad1cc+'.'+_0x5bb2a7)[_0xab0c('0x12')](_0x3ad1cc+_0xab0c('0x42'),_0x4188bf)[_0xab0c('0x12')](_0xab0c('0x39'),NOW)[_0xab0c('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3ad1cc,_0x7d6a9b,_0x5bb2a7,_0xab0c('0x2e'),[_0xab0c('0x3a'),_0xab0c('0x3b')]))[_0xab0c('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3ad1cc,_0x7d6a9b,_0x5bb2a7,'cm_hopper',['\x22always\x22'])))[_0xab0c('0x44')]();return _0x527274;}function insertTzCmHopperBlack(_0x2863e0,_0x495717,_0x54c86d,_0x440f56){var _0x12323d=['cm_contacts.phone',_0xab0c('0x27'),_0xab0c('0x28'),_0x495717+'.'+_0x440f56,_0xab0c('0x29'),_0xab0c('0x2a')];return squel[_0xab0c('0x2c')]()[_0xab0c('0x2d')](_0xab0c('0x3d'))[_0xab0c('0x2f')](['phone','ContactId',_0xab0c('0x46'),_0x440f56,_0xab0c('0x32'),_0xab0c('0x33')],squel['select']()[_0xab0c('0x36')](_0x12323d)[_0xab0c('0x37')](_0x495717)[_0xab0c('0x10')](_0xab0c('0x40'),null,_0xab0c('0x38')+_0x495717+'.CmListId')[_0xab0c('0x10')](_0x54c86d,null,_0x54c86d+'.id\x20=\x20'+_0x495717+'.'+_0x440f56)[_0xab0c('0x12')](_0x495717+'.CmListId\x20=\x20?',_0x2863e0)[_0xab0c('0x12')](_0xab0c('0x39'),NOW)[_0xab0c('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xab0c('0x30'))[_0xab0c('0x37')](_0xab0c('0x3d'))[_0xab0c('0x12')](_0xab0c('0x43'),_0x2863e0)[_0xab0c('0x12')](_0x440f56+_0xab0c('0x13')+_0x495717+'.'+_0x440f56)))[_0xab0c('0x44')]();}function insertCmHopperAdditionalPhones(_0x54756d){var _0x538e97=[_0xab0c('0x48'),_0xab0c('0x49'),'cm_contact_has_items.OrderBy',_0xab0c('0x4a'),_0xab0c('0x4b')];return squel[_0xab0c('0x2c')]()[_0xab0c('0x2d')](_0xab0c('0x4c'))['fromQuery']([_0xab0c('0x4d'),_0xab0c('0x30'),_0xab0c('0x4e'),'createdAt',_0xab0c('0x33')],squel['select']()[_0xab0c('0x36')](_0x538e97)['from'](_0xab0c('0x2e'))[_0xab0c('0x10')](_0xab0c('0x40'),null,_0xab0c('0x4f'))[_0xab0c('0x10')](_0xab0c('0x50'),null,_0xab0c('0x51'))[_0xab0c('0x12')](_0xab0c('0x52'),_0x54756d)[_0xab0c('0x12')](_0xab0c('0x39'),NOW))['toString']();}function insertCmContact(_0x5c334d,_0x37293d,_0x5ba395,_0x5d353b){var _0x2c0698=_['concat'](_['keys'](_0x5d353b),[_0xab0c('0x46'),_0xab0c('0x53'),_0xab0c('0x32'),_0xab0c('0x33')]);return squel[_0xab0c('0x2c')]()[_0xab0c('0x2d')](_0xab0c('0x40'))['fromQuery'](_0x2c0698,squel['select']()[_0xab0c('0x36')](_0x2c0698)[_0xab0c('0x37')](_0x37293d)[_0xab0c('0x12')]('('+_0x5ba395[_0xab0c('0x10')](',')+_0xab0c('0x54'),squel['select']()[_0xab0c('0x36')](_0x5ba395)[_0xab0c('0x37')](_0xab0c('0x40'))['where']('ListId\x20=\x20?',_0x5c334d)[_0xab0c('0x12')]('deletedAt\x20IS\x20NULL'))[_0xab0c('0x12')](_0xab0c('0x55'),squel[_0xab0c('0x3f')]()[_0xab0c('0xf')]('MIN(id)','min_id')[_0xab0c('0x37')](_0x37293d)[_0xab0c('0x56')](_0x5ba395[_0xab0c('0x10')](','))))['toString']();}function handleStop(){logger[_0xab0c('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x911980){logger['error'](_0x911980[_0xab0c('0x58')]);process[_0xab0c('0x59')](0x1);}function handleError(_0x399a99,_0x2ec2ef){stats['errors'][_0xab0c('0x19')]({'name':_0x2ec2ef[_0xab0c('0x5a')],'message':_0x2ec2ef[_0xab0c('0x58')],'row':_0x399a99});}function handleQuery(_0x515912){logger[_0xab0c('0x57')](_0x515912);return db[_0xab0c('0x5b')]['query'](_0x515912)[_0xab0c('0x5c')](function(_0x100133){results['push'](_0x100133);})['catch'](function(_0x189637){logger[_0xab0c('0x5d')](_0x189637['message']);});}function updateTzCampaigns(_0x33fd1f){return new Promise(function(_0x146b8,_0x10c4c0){var _0x3d7519=squel[_0xab0c('0x3f')]()[_0xab0c('0x36')]([_0xab0c('0x5e'),_0xab0c('0x5f')])[_0xab0c('0x37')](_0xab0c('0x60'))[_0xab0c('0x10')](_0xab0c('0x61'),null,_0xab0c('0x62'))[_0xab0c('0x12')](_0xab0c('0x63')+_0x33fd1f);db[_0xab0c('0x5b')][_0xab0c('0x64')](_0x3d7519['toString']())['spread'](function(_0x908154){var _0x283fe7=[];for(var _0x29e3ec=0x0;_0x29e3ec<_0x908154[_0xab0c('0x18')];_0x29e3ec++){_0x283fe7[_0xab0c('0x19')](getTimezoneData(_0x908154[_0x29e3ec],tmp_campaigns));}BPromise['all'](_0x283fe7)['then'](function(){_0x146b8({'val':0x1});});})[_0xab0c('0x65')](function(_0x12d066){logger[_0xab0c('0x5d')](_0x12d066[_0xab0c('0x58')]);_0x146b8({'val':0x0});});});}function updateTzVoiceQueues(_0x95275e){return new Promise(function(_0x18a60c,_0x572a0b){var _0x4a3406=squel[_0xab0c('0x3f')]()[_0xab0c('0x36')](['voice_queues.id',_0xab0c('0x66')])[_0xab0c('0x37')](_0xab0c('0x67'))[_0xab0c('0x10')](_0xab0c('0x68'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xab0c('0x12')](_0xab0c('0x69')+_0x95275e);db['sequelize']['query'](_0x4a3406[_0xab0c('0x44')]())[_0xab0c('0x5c')](function(_0x58fe3a){var _0x4ad1b5=[];for(var _0x58fc37=0x0;_0x58fc37<_0x58fe3a['length'];_0x58fc37++){_0x4ad1b5[_0xab0c('0x19')](getTimezoneData(_0x58fe3a[_0x58fc37],tmp_voice_queues));}BPromise[_0xab0c('0x1a')](_0x4ad1b5)[_0xab0c('0x17')](function(){_0x18a60c({'val':0x1});});})['catch'](function(_0x11e641){logger[_0xab0c('0x5d')](_0x11e641[_0xab0c('0x58')]);_0x18a60c({'val':0x0});});});}function getTimezoneData(_0x19aff5,_0x597323){return new Promise(function(_0x1bb0fc,_0x5035f4){var _0x16d13a=shared[_0xab0c('0x6a')];var _0x58c004=_0x16d13a[_0x19aff5['dialTimezone']];if(_[_0xab0c('0x1b')](_0x58c004)){_0x1bb0fc({'ret':0x1});}else{var _0x35858e=_0x58c004[_0xab0c('0x6b')];var _0x528fe6=squel['insert']()[_0xab0c('0x2d')](_0x597323)['set']('id',_0x19aff5['id'])[_0xab0c('0x6c')](_0xab0c('0x6d'),_0x35858e)[_0xab0c('0x6c')]('dialTimezone',_0x19aff5[_0xab0c('0x6e')])[_0xab0c('0x44')]();return db['sequelize'][_0xab0c('0x64')](_0x528fe6)['spread'](function(_0x68436a){_0x1bb0fc({'ret':0x1});})[_0xab0c('0x65')](function(_0x2fa1a3){logger['error'](_0x2fa1a3[_0xab0c('0x58')]);_0x5035f4({'ret':0x1});});}});}function handleTZQuery(_0x1d66b4){logger['info'](_0x1d66b4);return db['sequelize'][_0xab0c('0x64')](_0x1d66b4)[_0xab0c('0x5c')](function(_0x5514b9){})[_0xab0c('0x65')](function(_0x2e14e6){logger['error'](_0x2e14e6[_0xab0c('0x58')]);});}function main(_0x21f013,_0x4f45fb,_0x579ea6,_0x5544e2){logger[_0xab0c('0x57')](_0xab0c('0x6f'),_0x21f013,JSON[_0xab0c('0x70')](_0x4f45fb));process[_0xab0c('0x71')](_0xab0c('0x72'));var _0x4960ef=_0x4f45fb[_0xab0c('0x73')];var _0x1893a5=_[_0xab0c('0x74')](_0x4960ef);var _0x4d6821=_0x4f45fb[_0xab0c('0x75')];var _0x19a408=path[_0xab0c('0x10')](config[_0xab0c('0x76')],_0xab0c('0x77'),_0x4d6821+_0xab0c('0x78'));hasTZ=_['keys'](_0x4960ef)[_0xab0c('0x79')](_0xab0c('0x6e'));var _0x5956e9=_[_0xab0c('0x7a')](_0x4960ef)['join']();logger['info']('header',_0x5956e9);db[_0xab0c('0x7b')]['findAll']({'raw':!![],'attributes':['id',_0xab0c('0x7c')]})[_0xab0c('0x17')](function(_0x215ab2){for(var _0x47291b=0x0;_0x47291b<_0x215ab2[_0xab0c('0x18')];_0x47291b++){if(_0x215ab2[_0x47291b][_0xab0c('0x7c')]in _0x4960ef){contactItemTypes['push'](_0x215ab2[_0x47291b]);delete _0x1893a5[_0x215ab2[_0x47291b][_0xab0c('0x7c')]];hasAdditionalPhones=!![];}for(var _0x1d4186 in _0x4960ef){if(_0x215ab2[_0x47291b][_0xab0c('0x7c')]+'_description'===_0x1d4186){phoneDescriptions[_0xab0c('0x19')]({'itemTypeId':_0x215ab2[_0x47291b]['id'],'description':_0x1d4186});delete _0x1893a5[_0x1d4186];}}}if(hasAdditionalPhones)_0x1893a5['AdditionalPhones']='';var _0x547083=_[_0xab0c('0x7a')](_0x1893a5)['join']();logger[_0xab0c('0x57')](_0xab0c('0x7d'),_0x547083);fs['writeFileSync'](_0x19a408,_0x547083+'\x0a');Papa['parse'](fs['createReadStream'](_0x21f013),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5799f0,_0x5b6571){try{for(var _0x2362ed=0x0,_0x4f1087=[];_0x2362ed<_0x5799f0[_0xab0c('0x7e')][_0xab0c('0x18')];_0x2362ed++){stats[_0xab0c('0x7f')]+=0x1;if(_0x5799f0[_0xab0c('0x80')][_0x2362ed]){handleError(_0x5799f0[_0xab0c('0x7e')][_0x2362ed],_0x5799f0[_0xab0c('0x80')][_0x2362ed]);}else{var _0x14a8d1=[];var _0x16c993=[];var _0x460cf1={};for(var _0x551a2d in _0x4960ef){let _0x5e71de=contactItemTypes[_0xab0c('0x81')](_0x4886eb=>_0x4886eb['name']===_0x551a2d);let _0x4e7ae2=contactItemTypes[_0xab0c('0x81')](_0x54d5ef=>_0x54d5ef[_0xab0c('0x7c')]+_0xab0c('0x82')===_0x551a2d);if(_[_0xab0c('0x1b')](_0x5e71de)&&_[_0xab0c('0x1b')](_0x4e7ae2)){if(_0x4960ef[_0xab0c('0x83')](_0x551a2d)){if(_0x5799f0[_0xab0c('0x7e')][_0x2362ed][_0x4960ef[_0x551a2d]]){var _0x1e7132=_[_0xab0c('0x84')](_0x5799f0[_0xab0c('0x7e')][_0x2362ed][_0x4960ef[_0x551a2d]][_0xab0c('0x85')](/"/g,'\x27'));switch(_0x551a2d){case'scheduledat':var _0x1861f9=moment(_0x1e7132,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1861f9['isValid']()){_0x4f1087['push']('\x22'+_0x1e7132+'\x22');}else{_0x14a8d1[_0xab0c('0x19')](_0xab0c('0x86'));}break;case _0xab0c('0x34'):var _0x3ac03c=parseInt(_0x1e7132);_0x1e7132=_[_0xab0c('0x87')](_0x3ac03c)||_0x3ac03c<0x0||_0x3ac03c>0x4?_0x5544e2?0x3:0x2:_0x3ac03c;_0x4f1087[_0xab0c('0x19')]('\x22'+_0x1e7132+'\x22');break;case _0xab0c('0x35'):var _0x290ed3=parseInt(_0x1e7132);if(_[_0xab0c('0x88')](_0x290ed3)&&_[_0xab0c('0x79')](_0x579ea6,_0x290ed3)){_0x4f1087[_0xab0c('0x19')]('\x22'+_0x290ed3+'\x22');}else{_0x14a8d1[_0xab0c('0x19')](_0xab0c('0x89'));}break;case _0xab0c('0x8a'):if(isEmail(_0x1e7132)){_0x4f1087['push']('\x22'+_0x1e7132+'\x22');}else{_0x14a8d1['push'](_0xab0c('0x8b'));}break;case _0xab0c('0x8c'):var _0x3559d3=moment(_0x1e7132,_0xab0c('0x8d'),!![]);if(_0x3559d3['isValid']()){_0x4f1087[_0xab0c('0x19')]('\x22'+_0x1e7132+'\x22');}else{_0x14a8d1['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xab0c('0x6e'):var _0x44d8fc=shared[_0xab0c('0x6a')];var _0x47a871=_0x44d8fc[_0x1e7132];if(!_[_0xab0c('0x1b')](_0x47a871)){var _0x34fdf8=_0x47a871[_0xab0c('0x6b')];_0x4f1087[_0xab0c('0x19')]('\x22'+_0x1e7132+'\x22');_0x4f1087[_0xab0c('0x19')]('\x22'+_0x34fdf8+'\x22');}break;default:_0x4f1087[_0xab0c('0x19')]('\x22'+_0x1e7132+'\x22');}}else{switch(_0x551a2d){case _0xab0c('0x8e'):case'phone':_0x14a8d1[_0xab0c('0x19')](_0x551a2d+'\x20not\x20specified');break;default:_0x4f1087['push']('\x22\x22');}}}}else{var _0x13a0d3='';if(!_[_0xab0c('0x1b')](_0x5e71de)){if(!_0x460cf1['hasOwnProperty'](_0x5e71de['id'])){if(!_['isNil'](_0x5799f0[_0xab0c('0x7e')][_0x2362ed][_0x4960ef[_0x551a2d]])){var _0x1e7132=_[_0xab0c('0x84')](_0x5799f0[_0xab0c('0x7e')][_0x2362ed][_0x4960ef[_0x551a2d]][_0xab0c('0x85')](/"/g,'\x27'));var _0x4daa05=phoneDescriptions[_0xab0c('0x81')](_0x3f369c=>_0x3f369c['itemTypeId']===_0x5e71de['id']);if(!_['isNil'](_0x4daa05)){var _0x5ecd2b=_[_0xab0c('0x84')](_0x5799f0[_0xab0c('0x7e')][_0x2362ed][_0x4960ef[_0x4daa05['description']]][_0xab0c('0x85')](/"/g,'\x27'));if(!_['isNil'](_0x5ecd2b))_0x1e7132=_0x1e7132+'§'+_0x5ecd2b;}if(_0x13a0d3=='')_0x13a0d3=_0x1e7132;else _0x13a0d3+='|'+_0x1e7132;}_0x16c993[_0xab0c('0x19')](_0x5e71de['id']+':'+_0x13a0d3);_0x460cf1[_0x5e71de['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4f1087['push']('\x22'+_0x16c993[_0xab0c('0x10')](';')+'\x22');}if(_0x14a8d1[_0xab0c('0x18')]){handleError(_0x5799f0[_0xab0c('0x7e')][_0x2362ed],{'code':_0xab0c('0x8f'),'message':_0x14a8d1[_0xab0c('0x10')]()});}else{fs[_0xab0c('0x90')](_0x19a408,_0x4f1087[_0xab0c('0x10')]()+'\x0a');}_0x4f1087=[];}if(!(stats[_0xab0c('0x7f')]%0xc8)){socket[_0xab0c('0x91')]('contact:import:'+_0x4d6821,stats);stats[_0xab0c('0x80')]=[];}}if(stopped){logger[_0xab0c('0x57')](_0xab0c('0x92'));_0x5b6571[_0xab0c('0x93')]();}}catch(_0x255b43){handleError(_0x5799f0[_0xab0c('0x7e')][_0x2362ed],{'code':_0xab0c('0x94'),'message':_0x255b43[_0xab0c('0x58')]});logger[_0xab0c('0x5d')](_0xab0c('0x95'),_0x255b43[_0xab0c('0x58')]);}},'complete':function(){try{var _0x5e276b=[];var _0x175d20=[];var _0x40d110='cm_contacts';if(_0x4f45fb[_0xab0c('0x96')]&&_0x4f45fb['duplicates'][_0xab0c('0x18')]){_0x40d110=_0xab0c('0x97')+_0x4d6821;_0x5e276b['push']('CREATE\x20TABLE\x20'+_0x40d110+_0xab0c('0x98'));}tmp_campaigns=_0xab0c('0x99')+_0x4d6821;tmp_voice_queues=_0xab0c('0x9a')+_0x4d6821;_0x175d20[_0xab0c('0x19')](_0xab0c('0x9b')+tmp_campaigns+_0xab0c('0x9c'));_0x175d20[_0xab0c('0x19')](_0xab0c('0x9b')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x175d20,handleTZQuery)[_0xab0c('0x17')](function(_0x2d3390){updateTzCampaigns(_0x4f45fb['ListId'])['then'](function(_0x2e454d){updateTzVoiceQueues(_0x4f45fb['ListId'])['then'](function(_0x21ae09){if(hasTZ)_0x547083=_0x547083[_0xab0c('0x85')]('dialTimezone','dialTimezone,utcOffset');var _0x2f28dc=util[_0xab0c('0xc')](_0xab0c('0x9d'),_0x19a408,_0x40d110,_0x547083,_0x4f45fb['ListId'],_0x4f45fb['CompanyId']||null,NOW,NOW);if(_[_0xab0c('0x1b')](_0x4960ef[_0xab0c('0x31')])){_0x2f28dc+=_0xab0c('0x9e');}_0x5e276b[_0xab0c('0x19')](_0x2f28dc);if(_0x4f45fb[_0xab0c('0x96')]&&_0x4f45fb['duplicates']['length']){_0x5e276b['push'](insertCmContact(_0x4f45fb['ListId'],_0x40d110,_0x4f45fb[_0xab0c('0x96')],_0x4960ef));_0x5e276b[_0xab0c('0x19')]('DROP\x20TABLE\x20'+_0x40d110+';');}BPromise[_0xab0c('0x9f')](_0x5e276b,handleQuery)['then'](function(_0x465486){BPromise[_0xab0c('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x5e276b=[];for(var _0x1e6dca=0x0;_0x1e6dca\x20\x20');}var _0x29997b=path[_0xab0c('0x10')](config[_0xab0c('0x76')],_0xab0c('0x77'),process[_0xab0c('0xab')][0x2]);if(!fs[_0xab0c('0xac')](_0x29997b)){throw new Error(_0xab0c('0xad'));}var _0x4a2ea9={};try{_0x4a2ea9=JSON[_0xab0c('0xae')](process[_0xab0c('0xab')][0x3]);if(!_0x4a2ea9[_0xab0c('0x73')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x4a2ea9[_0xab0c('0x73')][_0xab0c('0x30')]){throw new Error(_0xab0c('0xaf'));}if(!_0x4a2ea9[_0xab0c('0x73')]['firstName']){throw new Error(_0xab0c('0xb0'));}var _0x1f5430=0x0;if(_0x4a2ea9[_0xab0c('0x73')][_0xab0c('0x35')]){_0x1f5430=0x1;}if(!_0x4a2ea9[_0xab0c('0x46')]){throw new Error(_0xab0c('0xb1'));}}catch(_0x45aca2){throw new Error(_0xab0c('0xb2'));}var _0x4a64a9=[];try{_0x4a64a9=_[_0xab0c('0xb3')](JSON[_0xab0c('0xae')](process['argv'][0x4]),'id');}catch(_0x2c964d){logger[_0xab0c('0x57')](_0xab0c('0xb4'));}main(_0x29997b,_0x4a2ea9,_0x4a64a9,_0x1f5430);}validate();process['on'](_0xab0c('0xb5'),handleStop);process['on'](_0xab0c('0xb6'),handleUncaughtException); \ No newline at end of file +var _0x37f6=['timezones','utcOffset','\x20not\x20specified','itemTypeId','trim','SystemRow','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','ioredis','../../../config/environment','../../../config/environment/shared','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','push','all','AdditionalPhones','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','join','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','into','cm_hopper_black','ContactId','cm_contacts','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','fromQuery','field','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','code','info','sequelize','query','campaigns.id','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','set','offset','dialTimezone','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','parse','createReadStream','data','rows','find','_description','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','email','dateOfBirth','YYYY-MM-DD'];(function(_0x264e7f,_0x4b8f91){var _0x173e6e=function(_0x525cfc){while(--_0x525cfc){_0x264e7f['push'](_0x264e7f['shift']());}};_0x173e6e(++_0x4b8f91);}(_0x37f6,0x19b));var _0x637f=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0x37f6[_0x3e0191];return _0xf2ae83;};'use strict';var fs=require('fs');var path=require(_0x637f('0x0'));var _=require('lodash');var Papa=require(_0x637f('0x1'));var util=require(_0x637f('0x2'));var BPromise=require(_0x637f('0x3'));var moment=require(_0x637f('0x4'));var squel=require('squel');var Redis=require(_0x637f('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x637f('0x6'));var shared=require(_0x637f('0x7'));var logger=require('../../../config/logger')(_0x637f('0x8'));config['redis']=_[_0x637f('0x9')](config[_0x637f('0xa')],{'host':_0x637f('0xb'),'port':0x18eb});var socket=require(_0x637f('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x637f('0xd')](_0x637f('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x637f('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x164e2d){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))*$/[_0x637f('0xf')](_0x164e2d);}function selectNotIn(_0x45b04c,_0x502725,_0x25b737,_0x40d172,_0x1362ee){return squel[_0x637f('0x10')]()['field'](_0x637f('0x11'))['from'](_0x40d172)['join'](_0x502725,null,_0x502725+'.id\x20=\x20'+_0x40d172+'.'+_0x25b737)[_0x637f('0x12')](_0x40d172+'.'+_0x25b737+_0x637f('0x13')+_0x45b04c+'.'+_0x25b737)[_0x637f('0x12')](_0x502725+_0x637f('0x14')+_0x1362ee['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x476461,_0xdabbd){promisesAdditionalPhones=[];return db[_0x637f('0x15')][_0x637f('0x16')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x637f('0x17')](function(_0x8c63be){if(_0x8c63be!==null){var _0x539274=[];for(var _0x642187=0x0;_0x642187<_0x8c63be[_0x637f('0x18')];_0x642187++){var _0x22040c=_0x8c63be[_0x642187];_0x539274[_0x637f('0x19')](insertAdditionalPhones(_0x22040c));}}Promise[_0x637f('0x1a')](_0x539274)[_0x637f('0x17')](function(){_0x476461({'val':0x1});});});});}function insertAdditionalPhones(_0x3325fc){return new Promise(function(_0x12bc21,_0x287392){var _0x1b50ff=_0x3325fc[_0x637f('0x1b')];var _0x23b36c=_0x1b50ff[_0x637f('0x1c')](';');var _0x224779=[];orderBy=0x0;for(var _0x1b2c4e=0x0;_0x1b2c4e<_0x23b36c['length'];_0x1b2c4e++){_0x224779[_0x637f('0x19')](splitAdditionalPhone(_0x3325fc['id'],_0x23b36c[_0x1b2c4e]));}Promise[_0x637f('0x1a')](_0x224779)[_0x637f('0x17')](function(){_0x12bc21({'val':_0x23b36c[_0x637f('0x18')]});});});}function splitAdditionalPhone(_0x57fd60,_0x396b46){return new Promise(function(_0x4198cf,_0xcb67cf){var _0x71518a=_0x396b46['split'](':');var _0x219703=_0x71518a[0x0];var _0x5ad842=_0x71518a[0x1];if(!_[_0x637f('0x1d')](_0x5ad842)){var _0x35ad4c=_0x5ad842['split']('|');var _0x55dae3=[];for(var _0x1b6d52=0x0;_0x1b6d52<_0x35ad4c[_0x637f('0x18')];_0x1b6d52++){if(_0x35ad4c[_0x1b6d52]!==''){var _0x2ea6a0=_[_0x637f('0x1e')](promisesAdditionalPhones,{'contactId':_0x57fd60,'phone':_0x35ad4c[_0x1b6d52]});if(_0x2ea6a0['length']==0x0){orderBy++;promisesAdditionalPhones[_0x637f('0x19')]({'contactId':_0x57fd60,'contactTypeId':_0x219703,'phone':_0x35ad4c[_0x1b6d52],'orderBy':orderBy});}}}_0x4198cf({'ok':0x1});}else _0x4198cf({'res':0x0});});}function createAdditionalPhone(_0x2b152e,_0x48380f,_0x4b4a8a,_0x312031){var _0x4c53ec='';var _0x5c1b03='';var _0x5791ab=_0x4b4a8a[_0x637f('0x1c')]('§');_0x4c53ec=_0x5791ab[0x0];if(_0x5791ab['length']==0x2)_0x5c1b03=_0x5791ab[0x1];return new Promise(function(_0x5ab060,_0x2da915){return db[_0x637f('0x1f')][_0x637f('0x20')]({'where':{'CmContactId':_0x2b152e,'item':_0x4c53ec}})['then'](function(_0x430b31){if(_0x430b31){return db[_0x637f('0x1f')][_0x637f('0x21')]({'ItemTypeId':_0x48380f,'description':_0x5c1b03,'OrderBy':_0x312031},{'where':{'CmContactId':_0x2b152e,'item':_0x4c53ec}})[_0x637f('0x17')](function(_0x2bb181){_0x5ab060({'res':_0x637f('0x22')});});}else{return db[_0x637f('0x1f')][_0x637f('0x23')]({'CmContactId':_0x2b152e,'item':_0x4c53ec,'description':_0x5c1b03,'ItemTypeId':_0x48380f,'OrderBy':_0x312031,'ItemClass':'PHONE'})[_0x637f('0x17')](function(_0x52063c){_0x5ab060({'res':'inserted'});});}});});}function insertCmHopper(_0x280104,_0x301b03,_0x45c240,_0x39a26c,_0x49f9f4){var _0x3871ae=[_0x637f('0x24'),_0x637f('0x25'),_0x637f('0x26'),'cm_contacts.ListId',_0x301b03+'.'+_0x39a26c,_0x637f('0x27'),_0x637f('0x28'),'cm_contacts.priority',_0x637f('0x29'),'\x22'+_0x49f9f4+'\x22'];return squel[_0x637f('0x2a')]()['into'](_0x637f('0x2b'))['fromQuery']([_0x637f('0x11'),_0x637f('0x2c'),'ContactId',_0x637f('0x2d'),_0x39a26c,_0x637f('0x2e'),_0x637f('0x2f'),_0x637f('0x30'),_0x637f('0x31'),_0x637f('0x32')],squel[_0x637f('0x10')]()[_0x637f('0x33')](_0x3871ae)[_0x637f('0x34')](_0x301b03)[_0x637f('0x35')]('cm_contacts',null,_0x637f('0x36')+_0x301b03+_0x637f('0x37'))[_0x637f('0x35')](_0x45c240,null,_0x45c240+_0x637f('0x38')+_0x301b03+'.'+_0x39a26c)[_0x637f('0x12')](_0x301b03+_0x637f('0x39'),_0x280104)[_0x637f('0x12')](_0x637f('0x3a'),NOW)[_0x637f('0x12')](_0x637f('0x3b'),selectNotIn(_0x301b03,_0x45c240,_0x39a26c,_0x637f('0x2b'),[_0x637f('0x3c'),_0x637f('0x3d')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x301b03,_0x45c240,_0x39a26c,_0x637f('0x2b'),[_0x637f('0x3c')])))[_0x637f('0x3e')]();}function insertCmHopperBlack(_0x408b34,_0x445306,_0x37fde3,_0x371932){var _0x27e2bf=['cm_contacts.phone',_0x637f('0x26'),_0x637f('0x3f'),_0x445306+'.'+_0x371932,_0x637f('0x27'),_0x637f('0x28')];return squel[_0x637f('0x2a')]()[_0x637f('0x40')](_0x637f('0x41'))['fromQuery']([_0x637f('0x11'),_0x637f('0x42'),_0x637f('0x2d'),_0x371932,_0x637f('0x2e'),'updatedAt'],squel[_0x637f('0x10')]()['fields'](_0x27e2bf)[_0x637f('0x34')](_0x445306)[_0x637f('0x35')](_0x637f('0x43'),null,_0x637f('0x36')+_0x445306+_0x637f('0x37'))['join'](_0x37fde3,null,_0x37fde3+_0x637f('0x38')+_0x445306+'.'+_0x371932)[_0x637f('0x12')](_0x445306+_0x637f('0x39'),_0x408b34)[_0x637f('0x12')](_0x637f('0x3a'),NOW)['where'](_0x637f('0x3b'),squel[_0x637f('0x10')]()['field'](_0x637f('0x11'))[_0x637f('0x34')]('cm_hopper_black')[_0x637f('0x12')](_0x637f('0x44'),_0x408b34)[_0x637f('0x12')](_0x371932+_0x637f('0x13')+_0x445306+'.'+_0x371932)))[_0x637f('0x3e')]();}function insertTzCmHopper(_0x15942d,_0x3ed546,_0x175a85,_0x210f64,_0xeb588b,_0x47b09a){var _0x4e77bd=[_0x637f('0x24'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x47b09a+_0x637f('0x45'),_0x637f('0x26'),'cm_contacts.ListId',_0x3ed546+'.'+_0x210f64,_0x637f('0x27'),_0x637f('0x28'),_0x637f('0x46'),_0x637f('0x29'),'\x22'+_0xeb588b+'\x22'];var _0x3c9fc3=squel['insert']()['into'](_0x637f('0x2b'))['fromQuery']([_0x637f('0x11'),'scheduledat',_0x637f('0x42'),_0x637f('0x2d'),_0x210f64,'createdAt','updatedAt',_0x637f('0x30'),'UserId',_0x637f('0x32')],squel['select']()['fields'](_0x4e77bd)['from'](_0x3ed546)['join'](_0x637f('0x43'),null,'cm_contacts.ListId\x20=\x20'+_0x3ed546+_0x637f('0x37'))[_0x637f('0x35')](_0x175a85,null,_0x175a85+_0x637f('0x38')+_0x3ed546+'.'+_0x210f64)[_0x637f('0x35')](_0x47b09a,null,_0x47b09a+_0x637f('0x38')+_0x3ed546+'.'+_0x210f64)[_0x637f('0x12')](_0x3ed546+'.CmListId\x20=\x20?',_0x15942d)[_0x637f('0x12')](_0x637f('0x3a'),NOW)[_0x637f('0x12')](_0x637f('0x3b'),selectNotIn(_0x3ed546,_0x175a85,_0x210f64,_0x637f('0x2b'),['\x22always\x22',_0x637f('0x3d')]))[_0x637f('0x12')](_0x637f('0x3b'),selectNotIn(_0x3ed546,_0x175a85,_0x210f64,'cm_hopper',[_0x637f('0x3c')])))[_0x637f('0x3e')]();return _0x3c9fc3;}function insertTzCmHopperBlack(_0x58f350,_0x4dc695,_0x2a9de0,_0x30ecb3){var _0x7a8f2f=[_0x637f('0x24'),'cm_contacts.id',_0x637f('0x3f'),_0x4dc695+'.'+_0x30ecb3,'cm_contacts.createdAt',_0x637f('0x28')];return squel[_0x637f('0x2a')]()[_0x637f('0x40')](_0x637f('0x41'))[_0x637f('0x47')]([_0x637f('0x11'),_0x637f('0x42'),_0x637f('0x2d'),_0x30ecb3,'createdAt',_0x637f('0x2f')],squel[_0x637f('0x10')]()['fields'](_0x7a8f2f)[_0x637f('0x34')](_0x4dc695)[_0x637f('0x35')](_0x637f('0x43'),null,_0x637f('0x36')+_0x4dc695+_0x637f('0x37'))['join'](_0x2a9de0,null,_0x2a9de0+_0x637f('0x38')+_0x4dc695+'.'+_0x30ecb3)[_0x637f('0x12')](_0x4dc695+_0x637f('0x39'),_0x58f350)['where'](_0x637f('0x3a'),NOW)[_0x637f('0x12')](_0x637f('0x3b'),squel[_0x637f('0x10')]()[_0x637f('0x48')]('phone')[_0x637f('0x34')](_0x637f('0x41'))[_0x637f('0x12')](_0x637f('0x44'),_0x58f350)['where'](_0x30ecb3+_0x637f('0x13')+_0x4dc695+'.'+_0x30ecb3)))[_0x637f('0x3e')]();}function insertCmHopperAdditionalPhones(_0x1034be){var _0x46ada8=[_0x637f('0x49'),_0x637f('0x4a'),'cm_contact_has_items.OrderBy',_0x637f('0x4b'),'cm_contact_has_items.updatedAt'];return squel[_0x637f('0x2a')]()[_0x637f('0x40')](_0x637f('0x4c'))[_0x637f('0x47')]([_0x637f('0x4d'),_0x637f('0x11'),_0x637f('0x4e'),_0x637f('0x2e'),_0x637f('0x2f')],squel[_0x637f('0x10')]()['fields'](_0x46ada8)[_0x637f('0x34')](_0x637f('0x2b'))[_0x637f('0x35')](_0x637f('0x43'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x637f('0x35')]('cm_contact_has_items',null,_0x637f('0x4f'))[_0x637f('0x12')](_0x637f('0x50'),_0x1034be)[_0x637f('0x12')](_0x637f('0x3a'),NOW))[_0x637f('0x3e')]();}function insertCmContact(_0xe83c0a,_0x4851c2,_0x10d8f7,_0x44abc2){var _0x16b954=_['concat'](_[_0x637f('0x51')](_0x44abc2),[_0x637f('0x2d'),'CompanyId',_0x637f('0x2e'),_0x637f('0x2f')]);return squel[_0x637f('0x2a')]()[_0x637f('0x40')]('cm_contacts')['fromQuery'](_0x16b954,squel[_0x637f('0x10')]()[_0x637f('0x33')](_0x16b954)[_0x637f('0x34')](_0x4851c2)[_0x637f('0x12')]('('+_0x10d8f7[_0x637f('0x35')](',')+_0x637f('0x52'),squel[_0x637f('0x10')]()[_0x637f('0x33')](_0x10d8f7)[_0x637f('0x34')](_0x637f('0x43'))[_0x637f('0x12')](_0x637f('0x44'),_0xe83c0a)[_0x637f('0x12')]('deletedAt\x20IS\x20NULL'))['where']('id\x20IN\x20?',squel[_0x637f('0x10')]()[_0x637f('0x48')](_0x637f('0x53'),_0x637f('0x54'))[_0x637f('0x34')](_0x4851c2)[_0x637f('0x55')](_0x10d8f7[_0x637f('0x35')](','))))[_0x637f('0x3e')]();}function handleStop(){logger['info'](_0x637f('0x56'));stopped=!![];}function handleUncaughtException(_0xbfdba1){logger[_0x637f('0x57')](_0xbfdba1[_0x637f('0x58')]);process[_0x637f('0x59')](0x1);}function handleError(_0x3b86cc,_0x72a631){stats[_0x637f('0x5a')][_0x637f('0x19')]({'name':_0x72a631[_0x637f('0x5b')],'message':_0x72a631[_0x637f('0x58')],'row':_0x3b86cc});}function handleQuery(_0x5c67fa){logger[_0x637f('0x5c')](_0x5c67fa);return db[_0x637f('0x5d')][_0x637f('0x5e')](_0x5c67fa)['spread'](function(_0x160927){results[_0x637f('0x19')](_0x160927);})['catch'](function(_0xa1541a){logger[_0x637f('0x57')](_0xa1541a[_0x637f('0x58')]);});}function updateTzCampaigns(_0xdae07){return new Promise(function(_0x52c7e5,_0x3ea598){var _0x4c6c69=squel['select']()[_0x637f('0x33')]([_0x637f('0x5f'),'campaigns.dialTimezone'])[_0x637f('0x34')]('campaigns')['join'](_0x637f('0x60'),null,_0x637f('0x61'))[_0x637f('0x12')](_0x637f('0x62')+_0xdae07);db[_0x637f('0x5d')][_0x637f('0x5e')](_0x4c6c69[_0x637f('0x3e')]())[_0x637f('0x63')](function(_0x385407){var _0x59681b=[];for(var _0x5828b9=0x0;_0x5828b9<_0x385407['length'];_0x5828b9++){_0x59681b[_0x637f('0x19')](getTimezoneData(_0x385407[_0x5828b9],tmp_campaigns));}BPromise[_0x637f('0x1a')](_0x59681b)[_0x637f('0x17')](function(){_0x52c7e5({'val':0x1});});})[_0x637f('0x64')](function(_0x2f6a55){logger[_0x637f('0x57')](_0x2f6a55[_0x637f('0x58')]);_0x52c7e5({'val':0x0});});});}function updateTzVoiceQueues(_0xd37b3a){return new Promise(function(_0x468888,_0x1c931a){var _0x481568=squel[_0x637f('0x10')]()[_0x637f('0x33')]([_0x637f('0x65'),_0x637f('0x66')])[_0x637f('0x34')](_0x637f('0x67'))[_0x637f('0x35')]('voice_queues_has_cm_lists',null,_0x637f('0x68'))[_0x637f('0x12')]('voice_queues_has_cm_lists.CmListId='+_0xd37b3a);db[_0x637f('0x5d')][_0x637f('0x5e')](_0x481568[_0x637f('0x3e')]())[_0x637f('0x63')](function(_0x4d36e5){var _0x55bc0e=[];for(var _0x824a7e=0x0;_0x824a7e<_0x4d36e5[_0x637f('0x18')];_0x824a7e++){_0x55bc0e[_0x637f('0x19')](getTimezoneData(_0x4d36e5[_0x824a7e],tmp_voice_queues));}BPromise[_0x637f('0x1a')](_0x55bc0e)[_0x637f('0x17')](function(){_0x468888({'val':0x1});});})[_0x637f('0x64')](function(_0x560099){logger[_0x637f('0x57')](_0x560099[_0x637f('0x58')]);_0x468888({'val':0x0});});});}function getTimezoneData(_0x5ab82d,_0x463b5a){return new Promise(function(_0x1e83a1,_0x4a8cba){var _0x43e9ba=shared['timezones'];var _0x551a09=_0x43e9ba[_0x5ab82d['dialTimezone']];if(_[_0x637f('0x1d')](_0x551a09)){_0x1e83a1({'ret':0x1});}else{var _0x5afe62=_0x551a09['utcOffset'];var _0x557772=squel['insert']()[_0x637f('0x40')](_0x463b5a)[_0x637f('0x69')]('id',_0x5ab82d['id'])[_0x637f('0x69')](_0x637f('0x6a'),_0x5afe62)[_0x637f('0x69')](_0x637f('0x6b'),_0x5ab82d[_0x637f('0x6b')])[_0x637f('0x3e')]();return db[_0x637f('0x5d')][_0x637f('0x5e')](_0x557772)['spread'](function(_0x7e00ad){_0x1e83a1({'ret':0x1});})[_0x637f('0x64')](function(_0x2078bd){logger[_0x637f('0x57')](_0x2078bd[_0x637f('0x58')]);_0x4a8cba({'ret':0x1});});}});}function handleTZQuery(_0x49871a){logger['info'](_0x49871a);return db[_0x637f('0x5d')][_0x637f('0x5e')](_0x49871a)['spread'](function(_0x54d5a1){})[_0x637f('0x64')](function(_0x526bcb){logger[_0x637f('0x57')](_0x526bcb[_0x637f('0x58')]);});}function main(_0x5576c8,_0x47900e,_0x5ba677,_0x37610d){logger[_0x637f('0x5c')](_0x637f('0x6c'),_0x5576c8,JSON[_0x637f('0x6d')](_0x47900e));process[_0x637f('0x6e')](_0x637f('0x6f'));var _0x27a832=_0x47900e['binding'];var _0x477e94=_[_0x637f('0x70')](_0x27a832);var _0x1ec0eb=_0x47900e[_0x637f('0x71')];var _0x549020=path[_0x637f('0x35')](config[_0x637f('0x72')],_0x637f('0x73'),_0x1ec0eb+_0x637f('0x74'));hasTZ=_['keys'](_0x27a832)[_0x637f('0x75')]('dialTimezone');var _0xd3608d=_[_0x637f('0x51')](_0x27a832)[_0x637f('0x35')]();logger[_0x637f('0x5c')](_0x637f('0x76'),_0xd3608d);db[_0x637f('0x77')][_0x637f('0x16')]({'raw':!![],'attributes':['id',_0x637f('0x78')]})['then'](function(_0x5e47ab){for(var _0x387482=0x0;_0x387482<_0x5e47ab['length'];_0x387482++){if(_0x5e47ab[_0x387482]['name']in _0x27a832){contactItemTypes[_0x637f('0x19')](_0x5e47ab[_0x387482]);delete _0x477e94[_0x5e47ab[_0x387482][_0x637f('0x78')]];hasAdditionalPhones=!![];}for(var _0x2cbe50 in _0x27a832){if(_0x5e47ab[_0x387482][_0x637f('0x78')]+'_description'===_0x2cbe50){phoneDescriptions[_0x637f('0x19')]({'itemTypeId':_0x5e47ab[_0x387482]['id'],'description':_0x2cbe50});delete _0x477e94[_0x2cbe50];}}}if(hasAdditionalPhones)_0x477e94[_0x637f('0x1b')]='';var _0x3fb611=_['keys'](_0x477e94)[_0x637f('0x35')]();logger[_0x637f('0x5c')]('header',_0x3fb611);fs['writeFileSync'](_0x549020,_0x3fb611+'\x0a');Papa[_0x637f('0x79')](fs[_0x637f('0x7a')](_0x5576c8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4afd44,_0x1c4441){try{for(var _0x298c49=0x0,_0x1699e0=[];_0x298c49<_0x4afd44[_0x637f('0x7b')][_0x637f('0x18')];_0x298c49++){stats[_0x637f('0x7c')]+=0x1;if(_0x4afd44[_0x637f('0x5a')][_0x298c49]){handleError(_0x4afd44['data'][_0x298c49],_0x4afd44[_0x637f('0x5a')][_0x298c49]);}else{var _0x233216=[];var _0x433bb4=[];var _0xe10b37={};for(var _0x216dd5 in _0x27a832){let _0x3b8202=contactItemTypes[_0x637f('0x7d')](_0x704fdf=>_0x704fdf[_0x637f('0x78')]===_0x216dd5);let _0x4f80fe=contactItemTypes[_0x637f('0x7d')](_0x508f5a=>_0x508f5a[_0x637f('0x78')]+_0x637f('0x7e')===_0x216dd5);if(_[_0x637f('0x1d')](_0x3b8202)&&_[_0x637f('0x1d')](_0x4f80fe)){if(_0x27a832[_0x637f('0x7f')](_0x216dd5)){if(_0x4afd44[_0x637f('0x7b')][_0x298c49][_0x27a832[_0x216dd5]]){var _0x232a05=_['trim'](_0x4afd44['data'][_0x298c49][_0x27a832[_0x216dd5]][_0x637f('0x80')](/"/g,'\x27'));switch(_0x216dd5){case _0x637f('0x2c'):var _0x1695af=moment(_0x232a05,_0x637f('0xe'),!![]);if(_0x1695af[_0x637f('0x81')]()){_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');}else{_0x233216['push'](_0x637f('0x82'));}break;case _0x637f('0x30'):var _0x5037db=parseInt(_0x232a05);_0x232a05=_[_0x637f('0x83')](_0x5037db)||_0x5037db<0x0||_0x5037db>0x4?_0x37610d?0x3:0x2:_0x5037db;_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');break;case _0x637f('0x31'):var _0x3afd3b=parseInt(_0x232a05);if(_['isNumber'](_0x3afd3b)&&_[_0x637f('0x75')](_0x5ba677,_0x3afd3b)){_0x1699e0[_0x637f('0x19')]('\x22'+_0x3afd3b+'\x22');}else{_0x233216[_0x637f('0x19')]('agent\x20not\x20exists');}break;case _0x637f('0x84'):if(isEmail(_0x232a05)){_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');}else{_0x233216[_0x637f('0x19')]('email\x20wrong\x20format');}break;case _0x637f('0x85'):var _0x20f5ba=moment(_0x232a05,_0x637f('0x86'),!![]);if(_0x20f5ba[_0x637f('0x81')]()){_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');}else{_0x233216['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x637f('0x6b'):var _0x124c5f=shared[_0x637f('0x87')];var _0x34f267=_0x124c5f[_0x232a05];if(!_[_0x637f('0x1d')](_0x34f267)){var _0x44469e=_0x34f267[_0x637f('0x88')];_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');_0x1699e0['push']('\x22'+_0x44469e+'\x22');}break;default:_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');}}else{switch(_0x216dd5){case'firstName':case _0x637f('0x11'):_0x233216[_0x637f('0x19')](_0x216dd5+_0x637f('0x89'));break;default:_0x1699e0[_0x637f('0x19')]('\x22\x22');}}}}else{var _0x327580='';if(!_[_0x637f('0x1d')](_0x3b8202)){if(!_0xe10b37['hasOwnProperty'](_0x3b8202['id'])){if(!_[_0x637f('0x1d')](_0x4afd44[_0x637f('0x7b')][_0x298c49][_0x27a832[_0x216dd5]])){var _0x232a05=_['trim'](_0x4afd44['data'][_0x298c49][_0x27a832[_0x216dd5]][_0x637f('0x80')](/"/g,'\x27'));var _0x2e65be=phoneDescriptions[_0x637f('0x7d')](_0xf9e3db=>_0xf9e3db[_0x637f('0x8a')]===_0x3b8202['id']);if(!_['isNil'](_0x2e65be)){var _0x543e8b=_[_0x637f('0x8b')](_0x4afd44[_0x637f('0x7b')][_0x298c49][_0x27a832[_0x2e65be['description']]]['replace'](/"/g,'\x27'));if(!_[_0x637f('0x1d')](_0x543e8b))_0x232a05=_0x232a05+'§'+_0x543e8b;}if(_0x327580=='')_0x327580=_0x232a05;else _0x327580+='|'+_0x232a05;}_0x433bb4[_0x637f('0x19')](_0x3b8202['id']+':'+_0x327580);_0xe10b37[_0x3b8202['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1699e0['push']('\x22'+_0x433bb4[_0x637f('0x35')](';')+'\x22');}if(_0x233216['length']){handleError(_0x4afd44[_0x637f('0x7b')][_0x298c49],{'code':_0x637f('0x8c'),'message':_0x233216[_0x637f('0x35')]()});}else{fs['appendFileSync'](_0x549020,_0x1699e0[_0x637f('0x35')]()+'\x0a');}_0x1699e0=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x1ec0eb,stats);stats[_0x637f('0x5a')]=[];}}if(stopped){logger[_0x637f('0x5c')]('Abort\x20parser');_0x1c4441[_0x637f('0x8d')]();}}catch(_0x182753){handleError(_0x4afd44[_0x637f('0x7b')][_0x298c49],{'code':_0x637f('0x8e'),'message':_0x182753['message']});logger[_0x637f('0x57')](_0x637f('0x8f'),_0x182753[_0x637f('0x58')]);}},'complete':function(){try{var _0x157483=[];var _0x204db5=[];var _0x16c5ea=_0x637f('0x43');if(_0x47900e[_0x637f('0x90')]&&_0x47900e[_0x637f('0x90')][_0x637f('0x18')]){_0x16c5ea=_0x637f('0x91')+_0x1ec0eb;_0x157483[_0x637f('0x19')](_0x637f('0x92')+_0x16c5ea+_0x637f('0x93'));}tmp_campaigns=_0x637f('0x94')+_0x1ec0eb;tmp_voice_queues=_0x637f('0x95')+_0x1ec0eb;_0x204db5[_0x637f('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x637f('0x96'));_0x204db5['push'](_0x637f('0x92')+tmp_voice_queues+_0x637f('0x96'));BPromise['each'](_0x204db5,handleTZQuery)[_0x637f('0x17')](function(_0x2e2365){updateTzCampaigns(_0x47900e[_0x637f('0x2d')])[_0x637f('0x17')](function(_0x133c29){updateTzVoiceQueues(_0x47900e[_0x637f('0x2d')])[_0x637f('0x17')](function(_0x5643d6){if(hasTZ)_0x3fb611=_0x3fb611[_0x637f('0x80')]('dialTimezone',_0x637f('0x97'));var _0x56a1eb=util[_0x637f('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\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x549020,_0x16c5ea,_0x3fb611,_0x47900e[_0x637f('0x2d')],_0x47900e[_0x637f('0x98')]||null,NOW,NOW);if(_[_0x637f('0x1d')](_0x27a832[_0x637f('0x2c')])){_0x56a1eb+=_0x637f('0x99');}_0x157483[_0x637f('0x19')](_0x56a1eb);if(_0x47900e['duplicates']&&_0x47900e['duplicates'][_0x637f('0x18')]){_0x157483[_0x637f('0x19')](insertCmContact(_0x47900e[_0x637f('0x2d')],_0x16c5ea,_0x47900e[_0x637f('0x90')],_0x27a832));_0x157483[_0x637f('0x19')]('DROP\x20TABLE\x20'+_0x16c5ea+';');}BPromise[_0x637f('0x9a')](_0x157483,handleQuery)[_0x637f('0x17')](function(_0x102401){BPromise[_0x637f('0x1a')]([handleAdditionalPhones()])[_0x637f('0x17')](function(){_0x157483=[];for(var _0x47a618=0x0;_0x47a618\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','ioredis'];(function(_0x47e946,_0x19d63b){var _0x480bc1=function(_0x52b261){while(--_0x52b261){_0x47e946['push'](_0x47e946['shift']());}};_0x480bc1(++_0x19d63b);}(_0xd6dc,0x1d7));var _0xcd6d=function(_0x57468c,_0x12f5c4){_0x57468c=_0x57468c-0x0;var _0x462533=_0xd6dc[_0x57468c];return _0x462533;};'use strict';var fs=require('fs');var path=require(_0xcd6d('0x0'));var _=require('lodash');var Papa=require(_0xcd6d('0x1'));var util=require(_0xcd6d('0x2'));var BPromise=require(_0xcd6d('0x3'));var moment=require(_0xcd6d('0x4'));var squel=require('squel');var Redis=require(_0xcd6d('0x5'));var db=require(_0xcd6d('0x6'))['db'];var config=require(_0xcd6d('0x7'));var logger=require(_0xcd6d('0x8'))(_0xcd6d('0x9'));config[_0xcd6d('0xa')]=_[_0xcd6d('0xb')](config[_0xcd6d('0xa')],{'host':_0xcd6d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd6d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0xcd6d('0xd')](_0xcd6d('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x566380){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))*$/[_0xcd6d('0xf')](_0x566380);}function selectNotIn(_0x3ae3fb,_0x5097be,_0x2541b4,_0x31a8cc,_0x147b1a){return squel['select']()[_0xcd6d('0x10')]('phone')['from'](_0x31a8cc)[_0xcd6d('0x11')](_0x5097be,null,_0x5097be+_0xcd6d('0x12')+_0x31a8cc+'.'+_0x2541b4)[_0xcd6d('0x13')](_0x31a8cc+'.'+_0x2541b4+_0xcd6d('0x14')+_0x3ae3fb+'.'+_0x2541b4)[_0xcd6d('0x13')](_0x5097be+_0xcd6d('0x15')+_0x147b1a[_0xcd6d('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1d2f8b,_0x2328f6){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xcd6d('0x16')](_0xcd6d('0x17')+tempTableName)[_0xcd6d('0x18')](function(_0x4afafb){if(_0x4afafb!==null){var _0x107354=[];for(var _0x5aabbe=0x0;_0x5aabbe<_0x4afafb[_0xcd6d('0x19')];_0x5aabbe++){var _0x55fccd=_0x4afafb[_0x5aabbe];if(!_[_0xcd6d('0x1a')](_0x55fccd['phone'])){if(!_['isNil'](_0x55fccd[_0xcd6d('0x1b')]))_0x107354[_0xcd6d('0x1c')](insertAdditionalPhones(_0x55fccd));promisesContact[_0xcd6d('0x1c')]({'contact':_0x55fccd});}}}Promise[_0xcd6d('0x1d')](_0x107354)[_0xcd6d('0x1e')](function(){_0x1d2f8b({'val':0x1});});})['catch'](function(_0x5de23c){logger[_0xcd6d('0x1f')](_0x5de23c[_0xcd6d('0x20')]);});});}function insertAdditionalPhones(_0x5d959a){return new Promise(function(_0xb88ec1,_0x22e7e0){var _0x40d02a=_0x5d959a['AdditionalPhones'];if(_['isNil'](_0x40d02a))_0x22e7e0({'val':0x0});else{var _0xda5b8=_0x40d02a[_0xcd6d('0x21')](';');var _0x3bde73=[];orderBy=0x0;for(var _0x4001fb=0x0;_0x4001fb<_0xda5b8[_0xcd6d('0x19')];_0x4001fb++){_0x3bde73[_0xcd6d('0x1c')](splitAdditionalPhone(_0x5d959a['id'],_0xda5b8[_0x4001fb]));}Promise[_0xcd6d('0x1d')](_0x3bde73)['then'](function(){_0xb88ec1({'val':_0xda5b8['length']});});}});}function splitAdditionalPhone(_0x234ae3,_0x45eb2d){return new Promise(function(_0x38ee46,_0x220152){var _0x25d0fe=_0x45eb2d[_0xcd6d('0x21')](':');var _0x223681=_0x25d0fe[0x0];var _0x323587=_0x25d0fe[0x1];if(_0x323587!==''){var _0x157c6c=_0x323587[_0xcd6d('0x21')]('|');var _0xf9b6ee=[];for(var _0x26fdca=0x0;_0x26fdca<_0x157c6c[_0xcd6d('0x19')];_0x26fdca++){if(_0x157c6c[_0x26fdca]!==''){var _0x4d0595=_[_0xcd6d('0x22')](promisesAdditionalPhones,{'contactId':_0x234ae3,'phone':_0x157c6c[_0x26fdca]});if(_0x4d0595[_0xcd6d('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xcd6d('0x1c')]({'contactId':_0x234ae3,'contactTypeId':_0x223681,'phone':_0x157c6c[_0x26fdca],'orderBy':orderBy});}}}_0x38ee46({'ok':0x1});}else _0x38ee46({'res':0x0});});}function createAdditionalPhone(_0x4b0b17,_0x37e0dd,_0x5a30ba,_0x507490){var _0x30730a='';var _0x1939e9='';var _0x485663=_0x5a30ba[_0xcd6d('0x21')]('§');_0x30730a=_0x485663[0x0];if(_0x485663[_0xcd6d('0x19')]==0x2)_0x1939e9=_0x485663[0x1];return new Promise(function(_0x410765,_0x45db3a){return db[_0xcd6d('0x23')]['findOne']({'where':{'CmContactId':_0x4b0b17,'item':_0x30730a}})[_0xcd6d('0x1e')](function(_0x423141){if(_0x423141){return db[_0xcd6d('0x23')][_0xcd6d('0x24')]({'ItemTypeId':_0x37e0dd,'description':_0x1939e9,'OrderBy':_0x507490},{'where':{'CmContactId':_0x4b0b17,'item':_0x30730a}})[_0xcd6d('0x1e')](function(_0x27b52d){_0x410765({'res':_0xcd6d('0x25')});});}else{return db[_0xcd6d('0x23')][_0xcd6d('0x26')]({'CmContactId':_0x4b0b17,'item':_0x30730a,'ItemTypeId':_0x37e0dd,'description':_0x1939e9,'OrderBy':_0x507490,'ItemClass':_0xcd6d('0x27')})[_0xcd6d('0x1e')](function(_0x3b752b){_0x410765({'res':'inserted'});});}});});}function updateContact(_0x25d04b){return new Promise(function(_0x5e9c9e,_0x37375b){var _0x237629=_0x25d04b['id'];delete _0x25d04b['id'];return db[_0xcd6d('0x28')][_0xcd6d('0x24')](_0x25d04b,{'where':{'id':_0x237629}})[_0xcd6d('0x1e')](function(_0x10c7bd){updatedRows+=0x1;return db[_0xcd6d('0x29')][_0xcd6d('0x24')]({'phone':_0x25d04b['phone']},{'where':{'ContactId':_0x237629}})[_0xcd6d('0x1e')](function(_0x101b44){_0x5e9c9e({'ret':'OK'});});});});}function insertCmHopper(_0x59f9a5,_0x5412eb,_0x51654d,_0x5af0c5,_0x6f5e6b){var _0x4c0ce7=['cm_contacts.phone',_0xcd6d('0x2a'),_0xcd6d('0x2b'),_0xcd6d('0x2c'),_0x5412eb+'.'+_0x5af0c5,_0xcd6d('0x2d'),_0xcd6d('0x2e'),_0xcd6d('0x2f'),_0xcd6d('0x30'),'\x22'+_0x6f5e6b+'\x22'];return squel[_0xcd6d('0x31')]()['into']('cm_hopper')[_0xcd6d('0x32')]([_0xcd6d('0x33'),_0xcd6d('0x34'),_0xcd6d('0x35'),_0xcd6d('0x36'),_0x5af0c5,_0xcd6d('0x37'),_0xcd6d('0x38'),_0xcd6d('0x39'),_0xcd6d('0x3a'),_0xcd6d('0x3b')],squel['select']()[_0xcd6d('0x3c')](_0x4c0ce7)[_0xcd6d('0x3d')](_0x5412eb)['join'](_0xcd6d('0x3e'),null,_0xcd6d('0x3f')+_0x5412eb+'.CmListId')[_0xcd6d('0x11')](_0x51654d,null,_0x51654d+_0xcd6d('0x12')+_0x5412eb+'.'+_0x5af0c5)[_0xcd6d('0x13')](_0x5412eb+_0xcd6d('0x40'),_0x59f9a5)[_0xcd6d('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xcd6d('0x13')](_0xcd6d('0x41'),selectNotIn(_0x5412eb,_0x51654d,_0x5af0c5,_0xcd6d('0x42'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xcd6d('0x13')](_0xcd6d('0x41'),selectNotIn(_0x5412eb,_0x51654d,_0x5af0c5,_0xcd6d('0x42'),[_0xcd6d('0x43')])))[_0xcd6d('0x44')]();}function insertCmHopperBlack(_0x836924,_0x5e8d35,_0x1e0493,_0x392ea2){var _0x2a7829=[_0xcd6d('0x45'),_0xcd6d('0x2b'),_0xcd6d('0x2c'),_0x5e8d35+'.'+_0x392ea2,_0xcd6d('0x2d'),_0xcd6d('0x2e')];return squel[_0xcd6d('0x31')]()['into'](_0xcd6d('0x46'))[_0xcd6d('0x32')](['phone','ContactId',_0xcd6d('0x36'),_0x392ea2,_0xcd6d('0x37'),'updatedAt'],squel[_0xcd6d('0x47')]()[_0xcd6d('0x3c')](_0x2a7829)['from'](_0x5e8d35)[_0xcd6d('0x11')](_0xcd6d('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x5e8d35+_0xcd6d('0x48'))[_0xcd6d('0x11')](_0x1e0493,null,_0x1e0493+_0xcd6d('0x12')+_0x5e8d35+'.'+_0x392ea2)[_0xcd6d('0x13')](_0x5e8d35+'.CmListId\x20=\x20?',_0x836924)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xcd6d('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xcd6d('0x47')]()[_0xcd6d('0x10')](_0xcd6d('0x33'))[_0xcd6d('0x3d')](_0xcd6d('0x46'))[_0xcd6d('0x13')](_0xcd6d('0x49'),_0x836924)[_0xcd6d('0x13')](_0x392ea2+_0xcd6d('0x4a'),_0x5e8d35+'.'+_0x392ea2)))[_0xcd6d('0x44')]();}function insertCmHopperAdditionalPhones(_0xe50fe1){var _0x4ebd1c=[_0xcd6d('0x4b'),'cm_contact_has_items.item',_0xcd6d('0x4c'),_0xcd6d('0x4d'),_0xcd6d('0x4e')];return squel[_0xcd6d('0x31')]()[_0xcd6d('0x4f')](_0xcd6d('0x50'))[_0xcd6d('0x32')]([_0xcd6d('0x51'),_0xcd6d('0x33'),_0xcd6d('0x52'),_0xcd6d('0x37'),_0xcd6d('0x38')],squel[_0xcd6d('0x47')]()[_0xcd6d('0x3c')](_0x4ebd1c)[_0xcd6d('0x3d')](_0xcd6d('0x42'))['join'](_0xcd6d('0x3e'),null,_0xcd6d('0x53'))[_0xcd6d('0x11')](_0xcd6d('0x54'),null,_0xcd6d('0x55'))[_0xcd6d('0x13')](_0xcd6d('0x56'),_0xe50fe1)[_0xcd6d('0x13')](_0xcd6d('0x57'),NOW))[_0xcd6d('0x44')]();}function insertCmContact(_0x193295,_0x14ccc6,_0x230e35,_0x50d749){var _0xea18e8=_[_0xcd6d('0x58')](_[_0xcd6d('0x59')](_0x50d749),[_0xcd6d('0x36'),'CompanyId',_0xcd6d('0x37'),_0xcd6d('0x38')]);return squel['insert']()[_0xcd6d('0x4f')]('cm_contacts')['fromQuery'](_0xea18e8,squel['select']()[_0xcd6d('0x3c')](_0xea18e8)[_0xcd6d('0x3d')](_0x14ccc6)[_0xcd6d('0x13')]('('+_0x230e35[_0xcd6d('0x11')](',')+_0xcd6d('0x5a'),squel[_0xcd6d('0x47')]()[_0xcd6d('0x3c')](_0x230e35)['from']('cm_contacts')[_0xcd6d('0x13')](_0xcd6d('0x49'),_0x193295))[_0xcd6d('0x13')]('id\x20IN\x20?',squel['select']()[_0xcd6d('0x10')](_0xcd6d('0x5b'),'min_id')['from'](_0x14ccc6)[_0xcd6d('0x5c')](_0x230e35[_0xcd6d('0x11')](','))))['toString']();}function handleStop(){logger['info'](_0xcd6d('0x5d'));stopped=!![];}function handleUncaughtException(_0x5ea7a3){logger[_0xcd6d('0x1f')](_0x5ea7a3['message']);process[_0xcd6d('0x5e')](0x1);}function handleError(_0x21a7e7,_0x466033){stats[_0xcd6d('0x5f')][_0xcd6d('0x1c')]({'name':_0x466033[_0xcd6d('0x60')],'message':_0x466033[_0xcd6d('0x20')],'row':_0x21a7e7});}function handleQuery(_0x4a5d15){logger['info'](_0x4a5d15);return db[_0xcd6d('0x61')]['query'](_0x4a5d15)[_0xcd6d('0x18')](function(_0x70f704){results[_0xcd6d('0x1c')](_0x70f704);})[_0xcd6d('0x62')](function(_0x549b72){logger[_0xcd6d('0x1f')](_0x549b72['message']);});}function main(_0x2f089b,_0xabb96f,_0x5e9f7f,_0x6a97dd){logger[_0xcd6d('0x63')](_0xcd6d('0x64'),_0x2f089b,JSON[_0xcd6d('0x65')](_0xabb96f));process[_0xcd6d('0x66')](_0xcd6d('0x67'));var _0xc6ae53=_0xabb96f[_0xcd6d('0x68')];var _0x4a4e66=_[_0xcd6d('0x69')](_0xc6ae53);var _0x20d2c1=_0xabb96f[_0xcd6d('0x6a')];var _0x36734c=path[_0xcd6d('0x11')](config['root'],_0xcd6d('0x6b'),_0x20d2c1+'.csv');logger[_0xcd6d('0x63')]('body',_0xabb96f);db['ContactItemType'][_0xcd6d('0x6c')]({'raw':!![],'attributes':['id',_0xcd6d('0x6d')]})[_0xcd6d('0x1e')](function(_0x37edb4){for(var _0x4387cb=0x0;_0x4387cb<_0x37edb4['length'];_0x4387cb++){if(_0x37edb4[_0x4387cb][_0xcd6d('0x6d')]in _0xc6ae53){contactItemTypes[_0xcd6d('0x1c')](_0x37edb4[_0x4387cb]);delete _0x4a4e66[_0x37edb4[_0x4387cb][_0xcd6d('0x6d')]];hasAdditionalPhones=!![];}for(var _0x170c20 in _0xc6ae53){if(_0x37edb4[_0x4387cb][_0xcd6d('0x6d')]+_0xcd6d('0x6e')===_0x170c20){phoneDescriptions['push']({'itemTypeId':_0x37edb4[_0x4387cb]['id'],'description':_0x170c20});delete _0x4a4e66[_0x170c20];}}}if(hasAdditionalPhones)_0x4a4e66[_0xcd6d('0x1b')]='';var _0x3f8a75=_[_0xcd6d('0x59')](_0x4a4e66)[_0xcd6d('0x11')]();logger[_0xcd6d('0x63')]('header',_0x3f8a75);fs['writeFileSync'](_0x36734c,_0x3f8a75+'\x0a');Papa[_0xcd6d('0x6f')](fs[_0xcd6d('0x70')](_0x2f089b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x12fe1,_0x1143d0){try{for(var _0x5e69cb=0x0,_0x49a9ee=[];_0x5e69cb<_0x12fe1[_0xcd6d('0x71')][_0xcd6d('0x19')];_0x5e69cb++){stats[_0xcd6d('0x72')]+=0x1;if(_0x12fe1[_0xcd6d('0x5f')][_0x5e69cb]){handleError(_0x12fe1[_0xcd6d('0x71')][_0x5e69cb],_0x12fe1[_0xcd6d('0x5f')][_0x5e69cb]);}else{var _0x42e115=[];var _0x5a225e=[];var _0x3cfa85={};for(var _0x3e6279 in _0xc6ae53){let _0x5d74e7=contactItemTypes['find'](_0x187d58=>_0x187d58[_0xcd6d('0x6d')]===_0x3e6279);let _0xea5fd1=contactItemTypes['find'](_0x5ce476=>_0x5ce476[_0xcd6d('0x6d')]+_0xcd6d('0x6e')===_0x3e6279);if(_[_0xcd6d('0x1a')](_0x5d74e7)&&_[_0xcd6d('0x1a')](_0xea5fd1)){if(_0xc6ae53[_0xcd6d('0x73')](_0x3e6279)){if(_0x12fe1[_0xcd6d('0x71')][_0x5e69cb][_0xc6ae53[_0x3e6279]]){var _0x2990a6=_[_0xcd6d('0x74')](_0x12fe1[_0xcd6d('0x71')][_0x5e69cb][_0xc6ae53[_0x3e6279]][_0xcd6d('0x75')](/"/g,'\x27'));switch(_0x3e6279){case _0xcd6d('0x34'):var _0x3e8efb=moment(_0x2990a6,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3e8efb['isValid']()){_0x49a9ee[_0xcd6d('0x1c')]('\x22'+_0x2990a6+'\x22');}else{_0x42e115[_0xcd6d('0x1c')](_0xcd6d('0x76'));}break;case'priority':var _0x593fdd=parseInt(_0x2990a6);_0x2990a6=_[_0xcd6d('0x77')](_0x593fdd)||_0x593fdd<0x0||_0x593fdd>0x4?_0x6a97dd?0x3:0x2:_0x593fdd;_0x49a9ee[_0xcd6d('0x1c')]('\x22'+_0x2990a6+'\x22');break;case _0xcd6d('0x3a'):var _0x181b66=parseInt(_0x2990a6);if(_['isNumber'](_0x181b66)&&_[_0xcd6d('0x78')](_0x5e9f7f,_0x181b66)){_0x49a9ee[_0xcd6d('0x1c')]('\x22'+_0x181b66+'\x22');}else{_0x42e115['push'](_0xcd6d('0x79'));}break;case _0xcd6d('0x7a'):if(isEmail(_0x2990a6)){_0x49a9ee['push']('\x22'+_0x2990a6+'\x22');}else{_0x42e115[_0xcd6d('0x1c')]('email\x20wrong\x20format');}break;case _0xcd6d('0x7b'):var _0x4d17d9=moment(_0x2990a6,'YYYY-MM-DD',!![]);if(_0x4d17d9[_0xcd6d('0x7c')]()){_0x49a9ee[_0xcd6d('0x1c')]('\x22'+_0x2990a6+'\x22');}else{_0x42e115['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x49a9ee['push']('\x22'+_0x2990a6+'\x22');}}else{switch(_0x3e6279){case _0xcd6d('0x7d'):case _0xcd6d('0x33'):_0x42e115[_0xcd6d('0x1c')](_0x3e6279+_0xcd6d('0x7e'));break;default:_0x49a9ee[_0xcd6d('0x1c')]('\x22\x22');}}}}else{var _0xe43ee4='';if(!_[_0xcd6d('0x1a')](_0x5d74e7)){if(!_0x3cfa85[_0xcd6d('0x73')](_0x5d74e7['id'])){for(var _0x3a8f88=0x0;_0x3a8f88<_0xc6ae53[_0x3e6279][_0xcd6d('0x19')];_0x3a8f88++){var _0x2990a6=_[_0xcd6d('0x74')](_0x12fe1[_0xcd6d('0x71')][_0x5e69cb][_0xc6ae53[_0x3e6279][_0x3a8f88]][_0xcd6d('0x75')](/"/g,'\x27'));var _0x24a419=phoneDescriptions[_0xcd6d('0x7f')](_0x5b208b=>_0x5b208b['itemTypeId']===_0x5d74e7['id']);if(!_['isNil'](_0x24a419)){var _0x45177a=_[_0xcd6d('0x74')](_0x12fe1[_0xcd6d('0x71')][_0x5e69cb][_0xc6ae53[_0x24a419[_0xcd6d('0x80')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x45177a))_0x2990a6=_0x2990a6+'§'+_0x45177a;}if(_0xe43ee4=='')_0xe43ee4=_0x2990a6;else _0xe43ee4+='|'+_0x2990a6;}_0x5a225e[_0xcd6d('0x1c')](_0x5d74e7['id']+':'+_0xe43ee4);_0x3cfa85[_0x5d74e7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x49a9ee['push']('\x22'+_0x5a225e[_0xcd6d('0x11')](';')+'\x22');}if(_0x42e115[_0xcd6d('0x19')]){handleError(_0x12fe1[_0xcd6d('0x71')][_0x5e69cb],{'code':_0xcd6d('0x81'),'message':_0x42e115[_0xcd6d('0x11')]()});}else{fs[_0xcd6d('0x82')](_0x36734c,_0x49a9ee['join']()+'\x0a');}_0x49a9ee=[];}if(!(stats[_0xcd6d('0x72')]%0xc8)){socket[_0xcd6d('0x83')](_0xcd6d('0x84')+_0x20d2c1,stats);stats[_0xcd6d('0x5f')]=[];}}if(stopped){logger[_0xcd6d('0x63')](_0xcd6d('0x85'));_0x1143d0[_0xcd6d('0x86')]();}}catch(_0x594816){handleError(_0x12fe1[_0xcd6d('0x71')][_0x5e69cb],{'code':_0xcd6d('0x87'),'message':_0x594816[_0xcd6d('0x20')]});logger[_0xcd6d('0x1f')](_0xcd6d('0x88'),_0x594816[_0xcd6d('0x20')]);}},'complete':function(){try{var _0x2a1ea3=[];var _0xcf42a3=tempTableName;_0x2a1ea3['push']('CREATE\x20TABLE\x20'+_0xcf42a3+'\x20LIKE\x20cm_contacts;');logger['info']('CIS\x20len',contactItemTypes[_0xcd6d('0x19')]);var _0x14e0c3=util[_0xcd6d('0xd')](_0xcd6d('0x89'),_0x36734c,_0xcf42a3,_0x3f8a75,_0xabb96f[_0xcd6d('0x36')],_0xabb96f[_0xcd6d('0x8a')]||null,NOW,NOW);if(_[_0xcd6d('0x1a')](_0xc6ae53[_0xcd6d('0x34')])){_0x14e0c3+=_0xcd6d('0x8b');}_0x2a1ea3['push'](_0x14e0c3);BPromise[_0xcd6d('0x8c')](_0x2a1ea3,handleQuery)[_0xcd6d('0x1e')](function(_0x3d6f7d){BPromise[_0xcd6d('0x1d')]([handleAdditionalPhones()])[_0xcd6d('0x1e')](function(){_0x2a1ea3=[];for(var _0x4c9ef5=0x0;_0x4c9ef5\x20\x20','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','field','phone','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','then','catch','error','message','split','filter','CmContactHasItem','update','updated','create','PHONE','inserted','CmHopper','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','fields','from','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','cm_contacts.updatedAt','cm_hopper_black','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_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','group','Received\x20SIGINT','exit','code','spread','info','main','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','body','findAll','name','_description','header','writeFileSync','parse','createReadStream','errors','data','find','hasOwnProperty','trim','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','\x20LIKE\x20cm_contacts;','CIS\x20len','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',',\x20scheduledAt\x20=\x20NOW()','each','all','contactTypeId','orderBy','DROP\x20TABLE\x20','finish'];(function(_0x4b53c0,_0x1bdfd6){var _0x1282b2=function(_0x4a5224){while(--_0x4a5224){_0x4b53c0['push'](_0x4b53c0['shift']());}};_0x1282b2(++_0x1bdfd6);}(_0xb396,0x1e8));var _0x6b39=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb396[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0x6b39('0x0'));var _=require(_0x6b39('0x1'));var Papa=require(_0x6b39('0x2'));var util=require(_0x6b39('0x3'));var BPromise=require('bluebird');var moment=require(_0x6b39('0x4'));var squel=require(_0x6b39('0x5'));var Redis=require(_0x6b39('0x6'));var db=require(_0x6b39('0x7'))['db'];var config=require(_0x6b39('0x8'));var logger=require(_0x6b39('0x9'))('import');config[_0x6b39('0xa')]=_['defaults'](config[_0x6b39('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b39('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6b39('0xb')](_0x6b39('0xc'));var tempTableName=_0x6b39('0xd')+moment()[_0x6b39('0xb')](_0x6b39('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x32c7b2){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x32c7b2);}function selectNotIn(_0x4a1b39,_0x5c098a,_0x4f1e2e,_0x5db762,_0x5ba3af){return squel['select']()[_0x6b39('0xf')](_0x6b39('0x10'))['from'](_0x5db762)['join'](_0x5c098a,null,_0x5c098a+_0x6b39('0x11')+_0x5db762+'.'+_0x4f1e2e)[_0x6b39('0x12')](_0x5db762+'.'+_0x4f1e2e+_0x6b39('0x13')+_0x4a1b39+'.'+_0x4f1e2e)[_0x6b39('0x12')](_0x5c098a+_0x6b39('0x14')+_0x5ba3af['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3d12b0,_0x47f61f){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6b39('0x15')][_0x6b39('0x16')](_0x6b39('0x17')+tempTableName)['spread'](function(_0x84b853){if(_0x84b853!==null){var _0x5426f5=[];for(var _0x27cf58=0x0;_0x27cf58<_0x84b853[_0x6b39('0x18')];_0x27cf58++){var _0x1032b1=_0x84b853[_0x27cf58];if(!_[_0x6b39('0x19')](_0x1032b1[_0x6b39('0x10')])){if(!_[_0x6b39('0x19')](_0x1032b1[_0x6b39('0x1a')]))_0x5426f5[_0x6b39('0x1b')](insertAdditionalPhones(_0x1032b1));promisesContact['push']({'contact':_0x1032b1});}}}Promise['all'](_0x5426f5)[_0x6b39('0x1c')](function(){_0x3d12b0({'val':0x1});});})[_0x6b39('0x1d')](function(_0x6b9cde){logger[_0x6b39('0x1e')](_0x6b9cde[_0x6b39('0x1f')]);});});}function insertAdditionalPhones(_0x299538){return new Promise(function(_0x458e7d,_0x560024){var _0x30f50a=_0x299538[_0x6b39('0x1a')];if(_['isNil'](_0x30f50a))_0x560024({'val':0x0});else{var _0x187ab1=_0x30f50a[_0x6b39('0x20')](';');var _0x3b7250=[];orderBy=0x0;for(var _0x19e40f=0x0;_0x19e40f<_0x187ab1['length'];_0x19e40f++){_0x3b7250[_0x6b39('0x1b')](splitAdditionalPhone(_0x299538['id'],_0x187ab1[_0x19e40f]));}Promise['all'](_0x3b7250)['then'](function(){_0x458e7d({'val':_0x187ab1[_0x6b39('0x18')]});});}});}function splitAdditionalPhone(_0x2e4fbf,_0x1f70bd){return new Promise(function(_0x5183cc,_0x4ebc33){var _0x503d6f=_0x1f70bd['split'](':');var _0xd3a560=_0x503d6f[0x0];var _0x2423bb=_0x503d6f[0x1];if(_0x2423bb!==''){var _0x176d42=_0x2423bb['split']('|');var _0x8a5812=[];for(var _0x517d16=0x0;_0x517d16<_0x176d42[_0x6b39('0x18')];_0x517d16++){if(_0x176d42[_0x517d16]!==''){var _0x4f0c90=_[_0x6b39('0x21')](promisesAdditionalPhones,{'contactId':_0x2e4fbf,'phone':_0x176d42[_0x517d16]});if(_0x4f0c90[_0x6b39('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x6b39('0x1b')]({'contactId':_0x2e4fbf,'contactTypeId':_0xd3a560,'phone':_0x176d42[_0x517d16],'orderBy':orderBy});}}}_0x5183cc({'ok':0x1});}else _0x5183cc({'res':0x0});});}function createAdditionalPhone(_0x478821,_0x240333,_0x26ef5b,_0x2e2e8d){var _0x47bad3='';var _0x1689fb='';var _0x2fa81a=_0x26ef5b[_0x6b39('0x20')]('§');_0x47bad3=_0x2fa81a[0x0];if(_0x2fa81a['length']==0x2)_0x1689fb=_0x2fa81a[0x1];return new Promise(function(_0x2f0b4e,_0x2b708d){return db[_0x6b39('0x22')]['findOne']({'where':{'CmContactId':_0x478821,'item':_0x47bad3}})[_0x6b39('0x1c')](function(_0x99624a){if(_0x99624a){return db[_0x6b39('0x22')][_0x6b39('0x23')]({'ItemTypeId':_0x240333,'description':_0x1689fb,'OrderBy':_0x2e2e8d},{'where':{'CmContactId':_0x478821,'item':_0x47bad3}})[_0x6b39('0x1c')](function(_0x1ed454){_0x2f0b4e({'res':_0x6b39('0x24')});});}else{return db['CmContactHasItem'][_0x6b39('0x25')]({'CmContactId':_0x478821,'item':_0x47bad3,'ItemTypeId':_0x240333,'description':_0x1689fb,'OrderBy':_0x2e2e8d,'ItemClass':_0x6b39('0x26')})['then'](function(_0x3d3f98){_0x2f0b4e({'res':_0x6b39('0x27')});});}});});}function updateContact(_0x1fd3ca){return new Promise(function(_0x464b49,_0x415e3c){var _0xe1e73a=_0x1fd3ca['id'];delete _0x1fd3ca['id'];return db['CmContact'][_0x6b39('0x23')](_0x1fd3ca,{'where':{'id':_0xe1e73a}})[_0x6b39('0x1c')](function(_0xd0f0bd){updatedRows+=0x1;return db[_0x6b39('0x28')]['update']({'phone':_0x1fd3ca[_0x6b39('0x10')]},{'where':{'ContactId':_0xe1e73a}})[_0x6b39('0x1c')](function(_0x407d10){_0x464b49({'ret':'OK'});});});});}function insertCmHopper(_0xae010e,_0x3d6faa,_0x449afc,_0x31766f,_0x19269e){var _0x2dbc7f=['cm_contacts.phone','cm_contacts.scheduledat',_0x6b39('0x29'),_0x6b39('0x2a'),_0x3d6faa+'.'+_0x31766f,_0x6b39('0x2b'),'cm_contacts.updatedAt','cm_contacts.priority',_0x6b39('0x2c'),'\x22'+_0x19269e+'\x22'];return squel[_0x6b39('0x2d')]()[_0x6b39('0x2e')](_0x6b39('0x2f'))[_0x6b39('0x30')]([_0x6b39('0x10'),'scheduledat',_0x6b39('0x31'),_0x6b39('0x32'),_0x31766f,_0x6b39('0x33'),_0x6b39('0x34'),'priority',_0x6b39('0x35'),_0x6b39('0x36')],squel[_0x6b39('0x37')]()[_0x6b39('0x38')](_0x2dbc7f)[_0x6b39('0x39')](_0x3d6faa)[_0x6b39('0x3a')](_0x6b39('0x3b'),null,_0x6b39('0x3c')+_0x3d6faa+'.CmListId')['join'](_0x449afc,null,_0x449afc+_0x6b39('0x11')+_0x3d6faa+'.'+_0x31766f)['where'](_0x3d6faa+_0x6b39('0x3d'),_0xae010e)[_0x6b39('0x12')](_0x6b39('0x3e'),NOW)[_0x6b39('0x12')](_0x6b39('0x3f'),selectNotIn(_0x3d6faa,_0x449afc,_0x31766f,_0x6b39('0x2f'),[_0x6b39('0x40'),'\x22onlyIfOpen\x22']))[_0x6b39('0x12')](_0x6b39('0x3f'),selectNotIn(_0x3d6faa,_0x449afc,_0x31766f,_0x6b39('0x2f'),[_0x6b39('0x40')])))[_0x6b39('0x41')]();}function insertCmHopperBlack(_0x198eae,_0x1e94a8,_0x4d7390,_0x45c70b){var _0x32cca6=[_0x6b39('0x42'),'cm_contacts.id',_0x6b39('0x2a'),_0x1e94a8+'.'+_0x45c70b,_0x6b39('0x2b'),_0x6b39('0x43')];return squel[_0x6b39('0x2d')]()[_0x6b39('0x2e')](_0x6b39('0x44'))[_0x6b39('0x30')]([_0x6b39('0x10'),'ContactId',_0x6b39('0x32'),_0x45c70b,_0x6b39('0x33'),_0x6b39('0x34')],squel[_0x6b39('0x37')]()[_0x6b39('0x38')](_0x32cca6)[_0x6b39('0x39')](_0x1e94a8)['join'](_0x6b39('0x3b'),null,_0x6b39('0x3c')+_0x1e94a8+'.CmListId')['join'](_0x4d7390,null,_0x4d7390+_0x6b39('0x11')+_0x1e94a8+'.'+_0x45c70b)[_0x6b39('0x12')](_0x1e94a8+_0x6b39('0x3d'),_0x198eae)[_0x6b39('0x12')](_0x6b39('0x3e'),NOW)[_0x6b39('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6b39('0x37')]()['field'](_0x6b39('0x10'))['from'](_0x6b39('0x44'))[_0x6b39('0x12')]('ListId\x20=\x20?',_0x198eae)['where'](_0x45c70b+'\x20=\x20?',_0x1e94a8+'.'+_0x45c70b)))['toString']();}function insertCmHopperAdditionalPhones(_0xc8a66b){var _0x499657=[_0x6b39('0x45'),_0x6b39('0x46'),_0x6b39('0x47'),_0x6b39('0x48'),_0x6b39('0x49')];return squel[_0x6b39('0x2d')]()['into'](_0x6b39('0x4a'))[_0x6b39('0x30')]([_0x6b39('0x4b'),_0x6b39('0x10'),_0x6b39('0x4c'),'createdAt','updatedAt'],squel[_0x6b39('0x37')]()[_0x6b39('0x38')](_0x499657)[_0x6b39('0x39')](_0x6b39('0x2f'))[_0x6b39('0x3a')](_0x6b39('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6b39('0x3a')](_0x6b39('0x4d'),null,_0x6b39('0x4e'))[_0x6b39('0x12')]('cm_hopper.ListId\x20=\x20?',_0xc8a66b)['where'](_0x6b39('0x3e'),NOW))[_0x6b39('0x41')]();}function insertCmContact(_0x1a3867,_0xbc53b9,_0x2b50ba,_0x37e2ef){var _0x841aa6=_[_0x6b39('0x4f')](_[_0x6b39('0x50')](_0x37e2ef),[_0x6b39('0x32'),_0x6b39('0x51'),'createdAt',_0x6b39('0x34')]);return squel[_0x6b39('0x2d')]()[_0x6b39('0x2e')]('cm_contacts')[_0x6b39('0x30')](_0x841aa6,squel[_0x6b39('0x37')]()['fields'](_0x841aa6)[_0x6b39('0x39')](_0xbc53b9)['where']('('+_0x2b50ba[_0x6b39('0x3a')](',')+_0x6b39('0x52'),squel[_0x6b39('0x37')]()[_0x6b39('0x38')](_0x2b50ba)[_0x6b39('0x39')]('cm_contacts')[_0x6b39('0x12')]('ListId\x20=\x20?',_0x1a3867))[_0x6b39('0x12')]('id\x20IN\x20?',squel['select']()[_0x6b39('0xf')](_0x6b39('0x53'),'min_id')[_0x6b39('0x39')](_0xbc53b9)[_0x6b39('0x54')](_0x2b50ba[_0x6b39('0x3a')](','))))['toString']();}function handleStop(){logger['info'](_0x6b39('0x55'));stopped=!![];}function handleUncaughtException(_0x13f439){logger[_0x6b39('0x1e')](_0x13f439[_0x6b39('0x1f')]);process[_0x6b39('0x56')](0x1);}function handleError(_0x54dea6,_0x438008){stats['errors'][_0x6b39('0x1b')]({'name':_0x438008[_0x6b39('0x57')],'message':_0x438008[_0x6b39('0x1f')],'row':_0x54dea6});}function handleQuery(_0x458596){logger['info'](_0x458596);return db[_0x6b39('0x15')][_0x6b39('0x16')](_0x458596)[_0x6b39('0x58')](function(_0x277017){results[_0x6b39('0x1b')](_0x277017);})[_0x6b39('0x1d')](function(_0x47801e){logger[_0x6b39('0x1e')](_0x47801e[_0x6b39('0x1f')]);});}function main(_0x176cf0,_0x481167,_0x387ea9,_0x295657){logger[_0x6b39('0x59')](_0x6b39('0x5a'),_0x176cf0,JSON[_0x6b39('0x5b')](_0x481167));process[_0x6b39('0x5c')](_0x6b39('0x5d'));var _0x3e8aa6=_0x481167['binding'];var _0x1aeb70=_['clone'](_0x3e8aa6);var _0x2aa853=_0x481167[_0x6b39('0x5e')];var _0x387115=path[_0x6b39('0x3a')](config[_0x6b39('0x5f')],_0x6b39('0x60'),_0x2aa853+_0x6b39('0x61'));logger[_0x6b39('0x59')](_0x6b39('0x62'),_0x481167);db['ContactItemType'][_0x6b39('0x63')]({'raw':!![],'attributes':['id',_0x6b39('0x64')]})[_0x6b39('0x1c')](function(_0x13d6e0){for(var _0x59cd04=0x0;_0x59cd04<_0x13d6e0[_0x6b39('0x18')];_0x59cd04++){if(_0x13d6e0[_0x59cd04][_0x6b39('0x64')]in _0x3e8aa6){contactItemTypes['push'](_0x13d6e0[_0x59cd04]);delete _0x1aeb70[_0x13d6e0[_0x59cd04][_0x6b39('0x64')]];hasAdditionalPhones=!![];}for(var _0x5f3378 in _0x3e8aa6){if(_0x13d6e0[_0x59cd04][_0x6b39('0x64')]+_0x6b39('0x65')===_0x5f3378){phoneDescriptions[_0x6b39('0x1b')]({'itemTypeId':_0x13d6e0[_0x59cd04]['id'],'description':_0x5f3378});delete _0x1aeb70[_0x5f3378];}}}if(hasAdditionalPhones)_0x1aeb70[_0x6b39('0x1a')]='';var _0x32acea=_[_0x6b39('0x50')](_0x1aeb70)[_0x6b39('0x3a')]();logger[_0x6b39('0x59')](_0x6b39('0x66'),_0x32acea);fs[_0x6b39('0x67')](_0x387115,_0x32acea+'\x0a');Papa[_0x6b39('0x68')](fs[_0x6b39('0x69')](_0x176cf0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x58e50e,_0x3d467e){try{for(var _0x55955a=0x0,_0x17e995=[];_0x55955a<_0x58e50e['data'][_0x6b39('0x18')];_0x55955a++){stats['rows']+=0x1;if(_0x58e50e[_0x6b39('0x6a')][_0x55955a]){handleError(_0x58e50e[_0x6b39('0x6b')][_0x55955a],_0x58e50e['errors'][_0x55955a]);}else{var _0x1f7f88=[];var _0x33a746=[];var _0x14b5ba={};for(var _0x31e804 in _0x3e8aa6){let _0x224e41=contactItemTypes[_0x6b39('0x6c')](_0xe74424=>_0xe74424['name']===_0x31e804);let _0x405d6d=contactItemTypes[_0x6b39('0x6c')](_0x579cd1=>_0x579cd1[_0x6b39('0x64')]+_0x6b39('0x65')===_0x31e804);if(_['isNil'](_0x224e41)&&_[_0x6b39('0x19')](_0x405d6d)){if(_0x3e8aa6[_0x6b39('0x6d')](_0x31e804)){if(_0x58e50e['data'][_0x55955a][_0x3e8aa6[_0x31e804]]){var _0x2e448e=_[_0x6b39('0x6e')](_0x58e50e[_0x6b39('0x6b')][_0x55955a][_0x3e8aa6[_0x31e804]][_0x6b39('0x6f')](/"/g,'\x27'));switch(_0x31e804){case _0x6b39('0x70'):var _0x92d331=moment(_0x2e448e,_0x6b39('0xc'),!![]);if(_0x92d331['isValid']()){_0x17e995[_0x6b39('0x1b')]('\x22'+_0x2e448e+'\x22');}else{_0x1f7f88[_0x6b39('0x1b')](_0x6b39('0x71'));}break;case _0x6b39('0x72'):var _0x30e3bc=parseInt(_0x2e448e);_0x2e448e=_['isNaN'](_0x30e3bc)||_0x30e3bc<0x0||_0x30e3bc>0x4?_0x295657?0x3:0x2:_0x30e3bc;_0x17e995[_0x6b39('0x1b')]('\x22'+_0x2e448e+'\x22');break;case _0x6b39('0x35'):var _0x134a4b=parseInt(_0x2e448e);if(_[_0x6b39('0x73')](_0x134a4b)&&_[_0x6b39('0x74')](_0x387ea9,_0x134a4b)){_0x17e995[_0x6b39('0x1b')]('\x22'+_0x134a4b+'\x22');}else{_0x1f7f88[_0x6b39('0x1b')](_0x6b39('0x75'));}break;case _0x6b39('0x76'):if(isEmail(_0x2e448e)){_0x17e995[_0x6b39('0x1b')]('\x22'+_0x2e448e+'\x22');}else{_0x1f7f88[_0x6b39('0x1b')]('email\x20wrong\x20format');}break;case _0x6b39('0x77'):var _0x3c4a5c=moment(_0x2e448e,_0x6b39('0x78'),!![]);if(_0x3c4a5c[_0x6b39('0x79')]()){_0x17e995[_0x6b39('0x1b')]('\x22'+_0x2e448e+'\x22');}else{_0x1f7f88['push'](_0x6b39('0x7a'));}break;default:_0x17e995[_0x6b39('0x1b')]('\x22'+_0x2e448e+'\x22');}}else{switch(_0x31e804){case _0x6b39('0x7b'):case _0x6b39('0x10'):_0x1f7f88[_0x6b39('0x1b')](_0x31e804+_0x6b39('0x7c'));break;default:_0x17e995['push']('\x22\x22');}}}}else{var _0xdd0122='';if(!_['isNil'](_0x224e41)){if(!_0x14b5ba['hasOwnProperty'](_0x224e41['id'])){for(var _0x4e407b=0x0;_0x4e407b<_0x3e8aa6[_0x31e804][_0x6b39('0x18')];_0x4e407b++){var _0x2e448e=_[_0x6b39('0x6e')](_0x58e50e['data'][_0x55955a][_0x3e8aa6[_0x31e804][_0x4e407b]][_0x6b39('0x6f')](/"/g,'\x27'));var _0x4cc24c=phoneDescriptions[_0x6b39('0x6c')](_0x5de53b=>_0x5de53b[_0x6b39('0x7d')]===_0x224e41['id']);if(!_['isNil'](_0x4cc24c)){var _0x84653f=_[_0x6b39('0x6e')](_0x58e50e[_0x6b39('0x6b')][_0x55955a][_0x3e8aa6[_0x4cc24c[_0x6b39('0x7e')]][0x0]][_0x6b39('0x6f')](/"/g,'\x27'));if(!_['isNil'](_0x84653f))_0x2e448e=_0x2e448e+'§'+_0x84653f;}if(_0xdd0122=='')_0xdd0122=_0x2e448e;else _0xdd0122+='|'+_0x2e448e;}_0x33a746[_0x6b39('0x1b')](_0x224e41['id']+':'+_0xdd0122);_0x14b5ba[_0x224e41['id']]=0x1;}}}}if(hasAdditionalPhones){_0x17e995[_0x6b39('0x1b')]('\x22'+_0x33a746[_0x6b39('0x3a')](';')+'\x22');}if(_0x1f7f88['length']){handleError(_0x58e50e['data'][_0x55955a],{'code':_0x6b39('0x7f'),'message':_0x1f7f88[_0x6b39('0x3a')]()});}else{fs[_0x6b39('0x80')](_0x387115,_0x17e995['join']()+'\x0a');}_0x17e995=[];}if(!(stats['rows']%0xc8)){socket[_0x6b39('0x81')](_0x6b39('0x82')+_0x2aa853,stats);stats['errors']=[];}}if(stopped){logger[_0x6b39('0x59')](_0x6b39('0x83'));_0x3d467e[_0x6b39('0x84')]();}}catch(_0x28b314){handleError(_0x58e50e[_0x6b39('0x6b')][_0x55955a],{'code':'SystemError','message':_0x28b314[_0x6b39('0x1f')]});logger[_0x6b39('0x1e')](_0x6b39('0x85'),_0x28b314[_0x6b39('0x1f')]);}},'complete':function(){try{var _0x3b0c4c=[];var _0x16488c=tempTableName;_0x3b0c4c[_0x6b39('0x1b')]('CREATE\x20TABLE\x20'+_0x16488c+_0x6b39('0x86'));logger[_0x6b39('0x59')](_0x6b39('0x87'),contactItemTypes[_0x6b39('0x18')]);var _0x38ca13=util[_0x6b39('0xb')](_0x6b39('0x88'),_0x387115,_0x16488c,_0x32acea,_0x481167['ListId'],_0x481167['CompanyId']||null,NOW,NOW);if(_[_0x6b39('0x19')](_0x3e8aa6[_0x6b39('0x70')])){_0x38ca13+=_0x6b39('0x89');}_0x3b0c4c[_0x6b39('0x1b')](_0x38ca13);BPromise[_0x6b39('0x8a')](_0x3b0c4c,handleQuery)[_0x6b39('0x1c')](function(_0x523406){BPromise[_0x6b39('0x8b')]([handleAdditionalPhones()])[_0x6b39('0x1c')](function(){_0x3b0c4c=[];for(var _0xe9c994=0x0;_0xe9c994\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','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.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','exports','lodash','squel','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','color','from','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','map','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.'];(function(_0x54ba26,_0x301c1f){var _0x36ce4e=function(_0x227ccb){while(--_0x227ccb){_0x54ba26['push'](_0x54ba26['shift']());}};_0x36ce4e(++_0x301c1f);}(_0x24cd,0x83));var _0xd24c=function(_0x359520,_0x48ebad){_0x359520=_0x359520-0x0;var _0x4651dd=_0x24cd[_0x359520];return _0x4651dd;};'use strict';var _=require(_0xd24c('0x0'));var squel=require(_0xd24c('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xd24c('0x2'));var updateInteraction=require('./update-interaction')[_0xd24c('0x3')];var utils=require(_0xd24c('0x4'));var db=require(_0xd24c('0x5'))['db'];function skipInteractionsQuery(_0x4d515c,_0x21a58c,_0x32001a){var _0x47c9ea=![];var _0x1c30fc=utils[_0xd24c('0x6')](_0x4d515c);if(_0x21a58c[_0xd24c('0x7')]===_0xd24c('0x8')&&!_0x32001a[_0xd24c('0x9')]&&!_0x32001a[_0x1c30fc]){_0x47c9ea=!![];}return _0x47c9ea;}function getTagsQuery(){return squel[_0xd24c('0xa')]()[_0xd24c('0xb')]('id')[_0xd24c('0xb')]('name')['field'](_0xd24c('0xc'))[_0xd24c('0xd')](_0xd24c('0xe'));}function getUsersQuery(_0x43ab46,_0x225c20){var _0x1aa701=utils[_0xd24c('0xf')](_0x43ab46);var _0x453907='user_has_'+_0x43ab46+_0xd24c('0x10');var _0x5a7556=squel['select']()[_0xd24c('0xb')](_0xd24c('0x11'))[_0xd24c('0xb')](_0xd24c('0x12'))[_0xd24c('0xb')](_0xd24c('0x13')+_0x1aa701)[_0xd24c('0xd')](_0x453907,'ui')[_0xd24c('0x14')]('users','u',_0xd24c('0x15'));if(_0x225c20[_0xd24c('0x16')]>0x0){_0x5a7556['where'](_0xd24c('0x13')+_0x1aa701+_0xd24c('0x17'),_[_0xd24c('0x18')](_0x225c20,'id'));}return _0x5a7556;}function getInteractionsQuery(_0x3221a8){var _0x509992=utils['getInteractionsTables'](_0x3221a8);var _0xc87bb7=utils[_0xd24c('0x6')](_0x3221a8);var _0x170d59=utils['getInteractionFK'](_0x3221a8);return squel[_0xd24c('0xa')]()[_0xd24c('0xd')](_0x509992[_0xd24c('0x19')],'i')[_0xd24c('0x14')]('cm_contacts','c',_0xd24c('0x1a'))['left_join'](_0xd24c('0x1b'),'o',_0xd24c('0x1c'))[_0xd24c('0x14')](_0x509992[_0xd24c('0x1d')],'a',_0xd24c('0x1e')+_0xc87bb7)[_0xd24c('0x14')](_0x509992[_0xd24c('0x1f')],'me',_0xd24c('0x20')+_0x170d59+_0xd24c('0x21'))[_0xd24c('0x14')](_0x509992['interactionsTags'],'it',_0xd24c('0x22')+_0x170d59+_0xd24c('0x21'))[_0xd24c('0x14')]('tools_tags','t',_0xd24c('0x23'));}function getSqlClauses(){var _0x2c3328={'body':squel[_0xd24c('0x24')](),'contact':squel['expr'](),'default':squel[_0xd24c('0x24')](),'fields':squel[_0xd24c('0x24')](),'filter':squel[_0xd24c('0x24')](),'read':squel[_0xd24c('0x24')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel['expr']()};return _0x2c3328;}function parseTagParameter(_0x32d310){var _0x4d56f4=squel[_0xd24c('0x24')]();if(_0x32d310){var _0xaf8b16=utils[_0xd24c('0x25')](_0x32d310);_0xaf8b16['forEach'](function(_0x4cb1b3){_0x4d56f4['or'](_0xd24c('0x26'),'%,'+_0x4cb1b3+',%');});}return _0x4d56f4;}function parseReadParameter(_0x14d44a){var _0x1a18b7='';if(_0x14d44a){_0x1a18b7=_0xd24c('0x27');if(_0x14d44a==='1'){_0x1a18b7=_0x1a18b7[_0xd24c('0x28')](_0xd24c('0x29'),'=');}else{_0x1a18b7=_0x1a18b7[_0xd24c('0x28')](_0xd24c('0x29'),'>');}}return _0x1a18b7;}function parseSearchFilter(_0x1c48d6,_0x3b14c7){var _0x2586d7=squel['expr']();if(_0x3b14c7){var _0x4e128b=_0x3b14c7[_0xd24c('0x28')]('\x5c','\x5c\x5c')[_0xd24c('0x28')](/'/g,'\x27\x27');if(qs[_0xd24c('0x2a')](_0x4e128b)){_0x2586d7['or']('i.id\x20LIKE\x20?',_0x4e128b+'%');if(['sms',_0xd24c('0x2b')][_0xd24c('0x2c')](_0x1c48d6)){_0x2586d7['or'](_0xd24c('0x2d'),_0x4e128b+'%');}else if(_0x1c48d6===_0xd24c('0x2e')){_0x2586d7['or']('i.fax\x20LIKE\x20?',_0x4e128b+'%');}else if(_0x1c48d6===_0xd24c('0x2f')){_0x2586d7['or'](_0xd24c('0x30'),_0x4e128b+'%');}}else if(_0x1c48d6===_0xd24c('0x31')&&qs[_0xd24c('0x32')](_0x4e128b)){_0x2586d7['or'](_0xd24c('0x33'),_0x4e128b+'%');}else{if(_0x1c48d6===_0xd24c('0x31')){_0x2586d7['or'](_0xd24c('0x34'),qs[_0xd24c('0x35')](_0x4e128b))['or'](_0xd24c('0x36'),qs['getFullTextValue'](_0x4e128b));}else{if(_0x1c48d6!==_0xd24c('0x2e')){_0x2586d7['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4e128b));}_0x2586d7['or'](_0xd24c('0x37'),_0x4e128b+'%');}}}return _0x2586d7;}function parseAdvancedSearchFilter(_0x44fab7,_0x24f1a9){var _0x1113a6=getSqlClauses();var _0x7d11e5=as[_0xd24c('0x38')](_0x44fab7);var _0x4526e3=_0x7d11e5['sqlOperator'];for(var _0x3a0043=0x0;_0x3a0043<_0x7d11e5[_0xd24c('0x39')][_0xd24c('0x16')];_0x3a0043++){var _0x241102=_0x7d11e5[_0xd24c('0x39')][_0x3a0043];var _0x356557='i';var _0x54cce4=_[_0xd24c('0x3a')](_0x24f1a9,[_0xd24c('0x3b'),_0x241102['field']]);if(_0x54cce4){var _0x100553=as[_0xd24c('0x3c')](_0x356557,_0x54cce4['type'],_0x241102);_0x1113a6[_0xd24c('0x3d')][_0x4526e3](_0x100553[_0xd24c('0x3e')],_0x100553['value'][_0xd24c('0x3f')],_0x100553[_0xd24c('0x40')][_0xd24c('0x41')]);}else{switch(_0x241102[_0xd24c('0xb')]){case'unreadMessages':var _0x11ab7b=parseReadParameter(_0x241102['value']);_0x1113a6[_0xd24c('0x42')]['and'](_0x11ab7b);break;case'Contact':if(_0x241102['operator']===_0xd24c('0x43')){if(_0x241102['value']['split']('\x20')[_0xd24c('0x16')]>0x1){_0x1113a6[_0xd24c('0x44')][_0x4526e3](_0xd24c('0x45'),qs[_0xd24c('0x35')](_0x241102['value']),null);}else{var _0xe5fe3a='%'+_0x241102['value']+'%';_0x1113a6[_0xd24c('0x44')][_0x4526e3](_0xd24c('0x46'),_0xe5fe3a,_0xe5fe3a,_0xe5fe3a);}}else{_0x54cce4=_[_0xd24c('0x3a')](_0x24f1a9,[_0xd24c('0x3b'),_0xd24c('0x47')]);_0x241102[_0xd24c('0xb')]=_0xd24c('0x47');_0x100553=as[_0xd24c('0x3c')](_0x356557,_0x54cce4[_0xd24c('0x48')],_0x241102);_0x1113a6[_0xd24c('0x44')][_0x4526e3](_0x100553['text'],_0x100553[_0xd24c('0x40')][_0xd24c('0x3f')],_0x100553['value'][_0xd24c('0x41')]);}break;case _0xd24c('0x49'):var _0x49053b=_0x241102[_0xd24c('0x40')]['split'](',')[_0xd24c('0x18')](function(_0x2d46b8){return Number(_0x2d46b8);});var _0x969fa0=parseTagParameter(_0x49053b);_0x1113a6[_0xd24c('0x4a')][_0xd24c('0x4b')]['and'](_0x969fa0);_0x1113a6[_0xd24c('0x4a')]['ids']=_0x49053b;break;case _0xd24c('0x4c'):if(_0x241102['operator']===_0xd24c('0x43')){_0x1113a6[_0xd24c('0x4d')][_0x4526e3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x241102[_0xd24c('0x40')]+'%',null);}else{_0x54cce4=_[_0xd24c('0x3a')](_0x24f1a9,['name',_0xd24c('0x4e')]);_0x241102['field']='UserId';_0x100553=as['buildExpression'](_0x356557,_0x54cce4[_0xd24c('0x48')],_0x241102);_0x1113a6[_0xd24c('0x4d')][_0x4526e3](_0x100553['text'],_0x100553['value'][_0xd24c('0x3f')],_0x100553[_0xd24c('0x40')][_0xd24c('0x41')]);}break;case _0xd24c('0x4f'):case'plainBody':_0x100553=as[_0xd24c('0x3c')]('me',null,_0x241102);_0x1113a6[_0xd24c('0x4f')][_0x4526e3](_0x100553['text'],_0x100553[_0xd24c('0x40')][_0xd24c('0x3f')],_0x100553[_0xd24c('0x40')]['end']);break;}}}return _0x1113a6;}function parseModelFields(_0x3039aa,_0x4b10c6,_0x26c1d0){var _0x33cb6f=utils[_0xd24c('0x6')](_0x3039aa);var _0x1c594d=squel['expr']();var _0x14684c=_(_0x4b10c6)[_0xd24c('0x50')]()[_0xd24c('0x18')](function(_0x1a4549){return _[_0xd24c('0x51')](_0x26c1d0,[_0xd24c('0x3b'),_0x1a4549])?_0x1a4549:undefined;})[_0xd24c('0x52')]()[_0xd24c('0x40')]();if(_0x14684c[_0xd24c('0x16')]>0x0){_0x14684c[_0xd24c('0x53')](function(_0x131e14){if(_0x131e14===_0x33cb6f){_0x1c594d['and']('i.'+_0x33cb6f+_0xd24c('0x17'),[][_0xd24c('0x54')](_0x4b10c6[_0x131e14]));}else if(_0x131e14==='createdAt'){var _0x5bb14f=JSON['parse'](_0x4b10c6[_0x131e14])[_0xd24c('0x55')];var _0x4273d2=JSON[_0xd24c('0x56')](_0x4b10c6[_0x131e14])[_0xd24c('0x57')];_0x1c594d[_0xd24c('0x58')](_0xd24c('0x59'),_0x5bb14f,_0x4273d2);}else{if(_0x4b10c6[_0x131e14]===_0xd24c('0x5a')){_0x1c594d[_0xd24c('0x58')]('i.'+_0x131e14+_0xd24c('0x5b'));}else{_0x1c594d[_0xd24c('0x58')]('i.'+_0x131e14+_0xd24c('0x5c'),_0x4b10c6[_0x131e14]);}}});}return _0x1c594d;}function parseQueryParameters(_0x4fbb0b,_0x3a8e76,_0x3ac5ca){var _0x49eee7=getSqlClauses();return Promise[_0xd24c('0x5d')]()[_0xd24c('0x5e')](function(){return parseModelFields(_0x4fbb0b,_0x3a8e76,_0x3ac5ca);})[_0xd24c('0x5e')](function(_0x5d525d){_0x49eee7['fields'][_0xd24c('0x58')](_0x5d525d);return parseReadParameter(_0x3a8e76[_0xd24c('0x42')]);})[_0xd24c('0x5e')](function(_0x1be98f){_0x49eee7[_0xd24c('0x42')][_0xd24c('0x58')](_0x1be98f);return parseTagParameter(_0x3a8e76[_0xd24c('0x5f')]);})[_0xd24c('0x5e')](function(_0x5ba7ab){_0x49eee7[_0xd24c('0x4a')]['clause']['and'](_0x5ba7ab);return parseSearchFilter(_0x4fbb0b,_0x3a8e76[_0xd24c('0x60')]);})['then'](function(_0x4f6b11){_0x49eee7[_0xd24c('0x60')]=_0x4f6b11;return _0x49eee7;});}function checkAccountsRestrictions(_0x1b649e,_0x1b1b0e,_0x7e4f1){var _0x4890d6=utils[_0xd24c('0x6')](_0x1b649e);var _0x1e99e7=_0xd24c('0x61')+_[_0xd24c('0x62')](_0x1b649e)+(_0x1b649e===_0xd24c('0x63')?_0xd24c('0x64'):_0xd24c('0x65'));var _0x5f17e3=squel['expr']();return Promise['resolve']()[_0xd24c('0x5e')](function(){if(_0x7e4f1[_0xd24c('0x9')]&&_0x1b1b0e[_0xd24c('0x7')]===_0xd24c('0x8')){return _0x1b1b0e[_0x1e99e7]({'attributes':['id'],'raw':!![]});}})[_0xd24c('0x5e')](function(_0x39f5eb){if(_0x39f5eb){if(_0x39f5eb['length']===0x0){_0x5f17e3[_0xd24c('0x58')]('i.'+_0x4890d6+_0xd24c('0x5b'));}else{_0x5f17e3['and']('i.'+_0x4890d6+_0xd24c('0x17'),_[_0xd24c('0x18')](_0x39f5eb,'id'));}}else if(!_0x7e4f1[_0x4890d6]){_0x5f17e3[_0xd24c('0x58')]('i.'+_0x4890d6+_0xd24c('0x66'));}})[_0xd24c('0x5e')](function(){return _0x5f17e3;});}function getClosedOrderClause(_0x50ef46,_0x59bfe0){var _0x2a6d13='';var _0x22c469=['i.thirdDisposition',_0xd24c('0x67'),_0xd24c('0x68')];if(_0x50ef46==='mail'){_0x22c469[_0xd24c('0x69')](_0xd24c('0x6a'));}if(_0x59bfe0[_0xd24c('0x6b')]==='0'&&_0x50ef46===_0xd24c('0x31')){_0x2a6d13=_0xd24c('0x6a');}else{if(_0x59bfe0[_0xd24c('0x6b')]==='1'){_0x22c469[_0xd24c('0x6c')]();}_0x2a6d13='CONCAT_WS(\x27\x27,\x20'+_0x22c469['join'](',\x20')+')';}return _0x2a6d13;}function getFilteredInteractions(_0x5a45db,_0x1f0b87,_0x492f5c,_0x5293b4){var _0x55fb1d=utils[_0xd24c('0xf')](_0x5a45db);var _0x29ace6=_[_0xd24c('0x62')](_0x5a45db)+'Interaction';var _0x312c4c=[];var _0xef4950=getTagsQuery();var _0x424680={'type':db[_0xd24c('0x6d')][_0xd24c('0x6e')][_0xd24c('0x6f')],'raw':!![]};var _0x52567d=[];var _0x8a7fa8=[];return db[_0xd24c('0x70')]['query'](_0xef4950[_0xd24c('0x71')](),_0x424680)[_0xd24c('0x5e')](function(_0x30ca13){_0x312c4c=_[_0xd24c('0x72')](_0x30ca13,'id');_0x424680=_[_0xd24c('0x73')](_0x424680,{'model':db[_0x29ace6],'mapToModel':!![],'nest':!![]});if(_0x492f5c[_0xd24c('0x74')]){_0x5293b4[_0xd24c('0x75')][_0xd24c('0x53')](function(_0x4628aa){_0x1f0b87[_0xd24c('0xb')]('i.'+_0x4628aa);});}else{_0x1f0b87['field'](_0xd24c('0x76'),_0xd24c('0x77'));_0x1f0b87['field']('a.key',_0xd24c('0x78'));_0x1f0b87['field'](_0xd24c('0x79'),_0xd24c('0x7a'));if(_0x5a45db===_0xd24c('0x31')){_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x7b'),_0xd24c('0x7c'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x7d'),_0xd24c('0x7e'));_0x1f0b87[_0xd24c('0xb')]('i.id');_0x1f0b87[_0xd24c('0xb')]('i.createdAt');_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x7f'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x80'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x81'));_0x1f0b87[_0xd24c('0xb')]('i.attach');_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x82'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x83'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x84'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x68'));_0x1f0b87[_0xd24c('0xb')]('i.secondDisposition');_0x1f0b87[_0xd24c('0xb')]('i.thirdDisposition');_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x6a'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x85'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x86'));_0x1f0b87[_0xd24c('0xb')]('i.MailAccountId');_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x87'));}else if(_0x5a45db===_0xd24c('0x2f')){_0x1f0b87['field'](_0xd24c('0x88'),_0xd24c('0x7e'));}else{_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x89'),_0xd24c('0x7e'));}if(_0x5a45db!==_0xd24c('0x31')){_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x8a'));}_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x8b'),_0xd24c('0x8c'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x8d'),_0xd24c('0x8e'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x8f'),_0xd24c('0x90'));_0x1f0b87[_0xd24c('0xb')]('c.phone','Contact.phone');_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x91'),_0xd24c('0x92'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x93'),_0xd24c('0x94'));_0x1f0b87[_0xd24c('0xb')](_0xd24c('0x95'),'Owner.fullname');_0x1f0b87[_0xd24c('0xb')]('o.internal','Owner.internal');_0x1f0b87['field'](_0xd24c('0x96'),_0xd24c('0x97'));}if(_0x5293b4['limit']){_0x1f0b87['limit'](_0x5293b4[_0xd24c('0x98')]);}if(_0x5293b4[_0xd24c('0x99')]){_0x1f0b87[_0xd24c('0x99')](_0x5293b4[_0xd24c('0x99')]);}return db['sequelize']['query'](_0x1f0b87[_0xd24c('0x71')](),_0x424680);})['then'](function(_0x3a00a0){_0x52567d=_0x3a00a0;var _0x2cdc42=getUsersQuery(_0x5a45db,_0x52567d);return db[_0xd24c('0x70')][_0xd24c('0x9a')](_0x2cdc42[_0xd24c('0x71')](),_0x424680);})[_0xd24c('0x5e')](function(_0xdee697){_0x8a7fa8=_['groupBy'](_0xdee697,_0x55fb1d);if(_0x5a45db==='mail'){return db['Setting'][_0xd24c('0x9b')]({'attributes':[_0xd24c('0x9c')],'raw':!![]});}})[_0xd24c('0x5e')](function(_0x18cf30){var _0x320a2b=_0x18cf30?_0x18cf30[_0xd24c('0x9c')]:undefined;var _0x4843ed=_0x52567d[_0xd24c('0x18')](function(_0x1d75a9){return updateInteraction(_0x1d75a9,_0x312c4c,_0x8a7fa8,_0x320a2b);});return Promise[_0xd24c('0x9d')](_0x4843ed);});}function countFilteredInteractions(_0x3eae0c,_0x37329f){var _0x39c952=_0x3eae0c[_0xd24c('0x9e')]();_0x39c952[_0xd24c('0xb')](_0xd24c('0x9f'));_0x39c952[_0xd24c('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd24c('0x77'));var _0x496929=utils[_0xd24c('0x25')](_0x37329f);if(!_[_0xd24c('0xa0')](_0x496929)){_0x39c952[_0xd24c('0xa1')](_0xd24c('0xa2'),_0x496929);}var _0x52e4a9={'type':db[_0xd24c('0x6d')]['QueryTypes'][_0xd24c('0x6f')],'raw':!![]};return db[_0xd24c('0x70')][_0xd24c('0x9a')](_0x39c952[_0xd24c('0x71')](),_0x52e4a9);}module[_0xd24c('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xde2c=['includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','buildExpression','type','default','text','value','start','end','unreadMessages','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','map','and','User','user','UserId','body','plainBody','keys','some','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','then','read','tag','tags','clause','filter','get','capitalize','chat','Accounts','resolve','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','getInteractionFK','Sequelize','QueryTypes','SELECT','toString','keyBy','merge','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','sequelize','query','groupBy','Setting','findOne','enableEmailPreview','all','clone','getSelectedTags','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','name','field','from','tools_tags','user_has_','_interactions','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','interactions','cm_contacts','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xde2c,0x7f));var _0xcde2=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0xde2c[_0x519c88];return _0x4668d7;};'use strict';var _=require(_0xcde2('0x0'));var squel=require(_0xcde2('0x1'));var as=require(_0xcde2('0x2'));var qs=require(_0xcde2('0x3'));var updateInteraction=require(_0xcde2('0x4'))[_0xcde2('0x5')];var utils=require(_0xcde2('0x6'));var db=require(_0xcde2('0x7'))['db'];function skipInteractionsQuery(_0x55c175,_0x4353c8,_0x196898){var _0x141f4b=![];var _0x1398de=utils[_0xcde2('0x8')](_0x55c175);if(_0x4353c8['role']===_0xcde2('0x9')&&!_0x196898[_0xcde2('0xa')]&&!_0x196898[_0x1398de]){_0x141f4b=!![];}return _0x141f4b;}function getTagsQuery(){return squel[_0xcde2('0xb')]()['field']('id')['field'](_0xcde2('0xc'))[_0xcde2('0xd')]('color')[_0xcde2('0xe')](_0xcde2('0xf'));}function getUsersQuery(_0x12a287,_0x127358){var _0x54b7c5=utils['getInteractionFK'](_0x12a287);var _0x25677f=_0xcde2('0x10')+_0x12a287+_0xcde2('0x11');var _0x39a973=squel[_0xcde2('0xb')]()[_0xcde2('0xd')]('u.id')[_0xcde2('0xd')]('u.fullname')[_0xcde2('0xd')]('ui.'+_0x54b7c5)['from'](_0x25677f,'ui')[_0xcde2('0x12')](_0xcde2('0x13'),'u',_0xcde2('0x14'));if(_0x127358[_0xcde2('0x15')]>0x0){_0x39a973[_0xcde2('0x16')]('ui.'+_0x54b7c5+_0xcde2('0x17'),_['map'](_0x127358,'id'));}return _0x39a973;}function getInteractionsQuery(_0x31b4a7){var _0x198840=utils[_0xcde2('0x18')](_0x31b4a7);var _0x1f1858=utils['getAccountFK'](_0x31b4a7);var _0x4fd5aa=utils['getInteractionFK'](_0x31b4a7);return squel[_0xcde2('0xb')]()['from'](_0x198840[_0xcde2('0x19')],'i')[_0xcde2('0x12')](_0xcde2('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xcde2('0x12')](_0xcde2('0x13'),'o',_0xcde2('0x1b'))[_0xcde2('0x12')](_0x198840[_0xcde2('0x1c')],'a','a.id\x20=\x20i.'+_0x1f1858)['left_join'](_0x198840['messages'],'me',_0xcde2('0x1d')+_0x4fd5aa+_0xcde2('0x1e'))[_0xcde2('0x12')](_0x198840[_0xcde2('0x1f')],'it',_0xcde2('0x20')+_0x4fd5aa+'\x20=\x20i.id')[_0xcde2('0x12')]('tools_tags','t',_0xcde2('0x21'));}function getSqlClauses(){var _0xb2123c={'body':squel[_0xcde2('0x22')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0xcde2('0x22')](),'filter':squel[_0xcde2('0x22')](),'read':squel[_0xcde2('0x22')](),'tags':{'clause':squel[_0xcde2('0x22')](),'ids':null},'user':squel[_0xcde2('0x22')]()};return _0xb2123c;}function parseTagParameter(_0x5a5b92){var _0x2d1d17=squel[_0xcde2('0x22')]();if(_0x5a5b92){var _0x1dce65=utils['getSelectedTags'](_0x5a5b92);_0x1dce65[_0xcde2('0x23')](function(_0x348ca1){_0x2d1d17['or'](_0xcde2('0x24'),'%,'+_0x348ca1+',%');});}return _0x2d1d17;}function parseReadParameter(_0x40309d){var _0xd7019='';if(_0x40309d){_0xd7019=_0xcde2('0x25');if(_0x40309d==='1'){_0xd7019=_0xd7019[_0xcde2('0x26')](_0xcde2('0x27'),'=');}else{_0xd7019=_0xd7019['replace'](_0xcde2('0x27'),'>');}}return _0xd7019;}function parseSearchFilter(_0x4a0826,_0x141072){var _0xb87851=squel[_0xcde2('0x22')]();if(_0x141072){var _0x49cb58=_0x141072[_0xcde2('0x26')]('\x5c','\x5c\x5c')[_0xcde2('0x26')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x49cb58)){_0xb87851['or'](_0xcde2('0x28'),_0x49cb58+'%');if([_0xcde2('0x29'),_0xcde2('0x2a')][_0xcde2('0x2b')](_0x4a0826)){_0xb87851['or'](_0xcde2('0x2c'),_0x49cb58+'%');}else if(_0x4a0826===_0xcde2('0x2d')){_0xb87851['or'](_0xcde2('0x2e'),_0x49cb58+'%');}else if(_0x4a0826===_0xcde2('0x2f')){_0xb87851['or']('i.from\x20LIKE\x20?',_0x49cb58+'%');}}else if(_0x4a0826===_0xcde2('0x30')&&qs[_0xcde2('0x31')](_0x49cb58)){_0xb87851['or'](_0xcde2('0x32'),_0x49cb58+'%');}else{if(_0x4a0826===_0xcde2('0x30')){_0xb87851['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcde2('0x33')](_0x49cb58))['or'](_0xcde2('0x34'),qs[_0xcde2('0x33')](_0x49cb58));}else{if(_0x4a0826!==_0xcde2('0x2d')){_0xb87851['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcde2('0x33')](_0x49cb58));}_0xb87851['or'](_0xcde2('0x35'),_0x49cb58+'%');}}}return _0xb87851;}function parseAdvancedSearchFilter(_0x29e3e0,_0x303d45){var _0x54ae78=getSqlClauses();var _0xb9c8d2=as[_0xcde2('0x36')](_0x29e3e0);var _0xbde4f4=_0xb9c8d2[_0xcde2('0x37')];for(var _0x1646a6=0x0;_0x1646a6<_0xb9c8d2['conditions'][_0xcde2('0x15')];_0x1646a6++){var _0x31feeb=_0xb9c8d2[_0xcde2('0x38')][_0x1646a6];var _0xa3d79c='i';var _0x4a64c1=_['find'](_0x303d45,[_0xcde2('0xc'),_0x31feeb[_0xcde2('0xd')]]);if(_0x4a64c1){var _0x40e1e2=as[_0xcde2('0x39')](_0xa3d79c,_0x4a64c1[_0xcde2('0x3a')],_0x31feeb);_0x54ae78[_0xcde2('0x3b')][_0xbde4f4](_0x40e1e2[_0xcde2('0x3c')],_0x40e1e2[_0xcde2('0x3d')][_0xcde2('0x3e')],_0x40e1e2['value'][_0xcde2('0x3f')]);}else{switch(_0x31feeb[_0xcde2('0xd')]){case _0xcde2('0x40'):var _0x51a0a6=parseReadParameter(_0x31feeb[_0xcde2('0x3d')]);_0x54ae78['read']['and'](_0x51a0a6);break;case _0xcde2('0x41'):if(_0x31feeb[_0xcde2('0x42')]===_0xcde2('0x43')){if(_0x31feeb[_0xcde2('0x3d')][_0xcde2('0x44')]('\x20')[_0xcde2('0x15')]>0x1){_0x54ae78['contact'][_0xbde4f4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x31feeb[_0xcde2('0x3d')]),null);}else{var _0x41a037='%'+_0x31feeb[_0xcde2('0x3d')]+'%';_0x54ae78[_0xcde2('0x45')][_0xbde4f4](_0xcde2('0x46'),_0x41a037,_0x41a037,_0x41a037);}}else{_0x4a64c1=_[_0xcde2('0x47')](_0x303d45,[_0xcde2('0xc'),'ContactId']);_0x31feeb['field']=_0xcde2('0x48');_0x40e1e2=as['buildExpression'](_0xa3d79c,_0x4a64c1[_0xcde2('0x3a')],_0x31feeb);_0x54ae78['contact'][_0xbde4f4](_0x40e1e2[_0xcde2('0x3c')],_0x40e1e2[_0xcde2('0x3d')][_0xcde2('0x3e')],_0x40e1e2['value'][_0xcde2('0x3f')]);}break;case'Tag':var _0x889aef=_0x31feeb[_0xcde2('0x3d')][_0xcde2('0x44')](',')[_0xcde2('0x49')](function(_0xcafd7){return Number(_0xcafd7);});var _0x27b64f=parseTagParameter(_0x889aef);_0x54ae78['tags']['clause'][_0xcde2('0x4a')](_0x27b64f);_0x54ae78['tags']['ids']=_0x889aef;break;case _0xcde2('0x4b'):if(_0x31feeb['operator']===_0xcde2('0x43')){_0x54ae78[_0xcde2('0x4c')][_0xbde4f4]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x31feeb[_0xcde2('0x3d')]+'%',null);}else{_0x4a64c1=_['find'](_0x303d45,['name',_0xcde2('0x4d')]);_0x31feeb[_0xcde2('0xd')]='UserId';_0x40e1e2=as[_0xcde2('0x39')](_0xa3d79c,_0x4a64c1['type'],_0x31feeb);_0x54ae78[_0xcde2('0x4c')][_0xbde4f4](_0x40e1e2[_0xcde2('0x3c')],_0x40e1e2[_0xcde2('0x3d')][_0xcde2('0x3e')],_0x40e1e2[_0xcde2('0x3d')]['end']);}break;case _0xcde2('0x4e'):case _0xcde2('0x4f'):_0x40e1e2=as[_0xcde2('0x39')]('me',null,_0x31feeb);_0x54ae78[_0xcde2('0x4e')][_0xbde4f4](_0x40e1e2['text'],_0x40e1e2['value'][_0xcde2('0x3e')],_0x40e1e2['value'][_0xcde2('0x3f')]);break;}}}return _0x54ae78;}function parseModelFields(_0x3e9e79,_0x381bd4,_0x16675f){var _0x1ce210=utils[_0xcde2('0x8')](_0x3e9e79);var _0x5220bd=squel[_0xcde2('0x22')]();var _0x5b996d=_(_0x381bd4)[_0xcde2('0x50')]()['map'](function(_0x112a9f){return _[_0xcde2('0x51')](_0x16675f,[_0xcde2('0xc'),_0x112a9f])?_0x112a9f:undefined;})[_0xcde2('0x52')]()[_0xcde2('0x3d')]();if(_0x5b996d[_0xcde2('0x15')]>0x0){_0x5b996d['forEach'](function(_0x3adc5b){if(_0x3adc5b===_0x1ce210){_0x5220bd['and']('i.'+_0x1ce210+_0xcde2('0x17'),[][_0xcde2('0x53')](_0x381bd4[_0x3adc5b]));}else if(_0x3adc5b===_0xcde2('0x54')){var _0x428a55=JSON[_0xcde2('0x55')](_0x381bd4[_0x3adc5b])[_0xcde2('0x56')];var _0x3a0760=JSON[_0xcde2('0x55')](_0x381bd4[_0x3adc5b])[_0xcde2('0x57')];_0x5220bd[_0xcde2('0x4a')](_0xcde2('0x58'),_0x428a55,_0x3a0760);}else{if(_0x381bd4[_0x3adc5b]===_0xcde2('0x59')){_0x5220bd['and']('i.'+_0x3adc5b+'\x20IS\x20NULL');}else{_0x5220bd['and']('i.'+_0x3adc5b+_0xcde2('0x5a'),_0x381bd4[_0x3adc5b]);}}});}return _0x5220bd;}function parseQueryParameters(_0x59a64d,_0x1751dd,_0x3b9724){var _0x340ae6=getSqlClauses();return Promise['resolve']()[_0xcde2('0x5b')](function(){return parseModelFields(_0x59a64d,_0x1751dd,_0x3b9724);})['then'](function(_0x2ccfe9){_0x340ae6['fields'][_0xcde2('0x4a')](_0x2ccfe9);return parseReadParameter(_0x1751dd[_0xcde2('0x5c')]);})['then'](function(_0x418dd1){_0x340ae6['read']['and'](_0x418dd1);return parseTagParameter(_0x1751dd[_0xcde2('0x5d')]);})[_0xcde2('0x5b')](function(_0x8eddd4){_0x340ae6[_0xcde2('0x5e')][_0xcde2('0x5f')][_0xcde2('0x4a')](_0x8eddd4);return parseSearchFilter(_0x59a64d,_0x1751dd['filter']);})[_0xcde2('0x5b')](function(_0x44b3fb){_0x340ae6[_0xcde2('0x60')]=_0x44b3fb;return _0x340ae6;});}function checkAccountsRestrictions(_0x145b4a,_0x349818,_0x541a70){var _0x50892c=utils['getAccountFK'](_0x145b4a);var _0x30dee3=_0xcde2('0x61')+_[_0xcde2('0x62')](_0x145b4a)+(_0x145b4a===_0xcde2('0x63')?'Websites':_0xcde2('0x64'));var _0x345210=squel[_0xcde2('0x22')]();return Promise[_0xcde2('0x65')]()[_0xcde2('0x5b')](function(){if(_0x541a70[_0xcde2('0xa')]&&_0x349818['role']===_0xcde2('0x9')){return _0x349818[_0x30dee3]({'attributes':['id'],'raw':!![]});}})[_0xcde2('0x5b')](function(_0x585165){if(_0x585165){if(_0x585165[_0xcde2('0x15')]===0x0){_0x345210[_0xcde2('0x4a')]('i.'+_0x50892c+_0xcde2('0x66'));}else{_0x345210[_0xcde2('0x4a')]('i.'+_0x50892c+_0xcde2('0x17'),_[_0xcde2('0x49')](_0x585165,'id'));}}else if(!_0x541a70[_0x50892c]){_0x345210[_0xcde2('0x4a')]('i.'+_0x50892c+_0xcde2('0x67'));}})[_0xcde2('0x5b')](function(){return _0x345210;});}function getClosedOrderClause(_0x3ae71d,_0x5a9f19){var _0x223cb0='';var _0x33d76a=['i.thirdDisposition',_0xcde2('0x68'),_0xcde2('0x69')];if(_0x3ae71d===_0xcde2('0x30')){_0x33d76a['unshift'](_0xcde2('0x6a'));}if(_0x5a9f19[_0xcde2('0x6b')]==='0'&&_0x3ae71d===_0xcde2('0x30')){_0x223cb0=_0xcde2('0x6a');}else{if(_0x5a9f19[_0xcde2('0x6b')]==='1'){_0x33d76a[_0xcde2('0x6c')]();}_0x223cb0=_0xcde2('0x6d')+_0x33d76a[_0xcde2('0x6e')](',\x20')+')';}return _0x223cb0;}function getFilteredInteractions(_0x857e85,_0x34e72a,_0x3b0961,_0x5d42f8){var _0x5bd1bd=utils[_0xcde2('0x6f')](_0x857e85);var _0xd28773=_[_0xcde2('0x62')](_0x857e85)+'Interaction';var _0x485a79=[];var _0x5652a7=getTagsQuery();var _0x1341d0={'type':db[_0xcde2('0x70')][_0xcde2('0x71')][_0xcde2('0x72')],'raw':!![]};var _0x325b51=[];var _0x333cbb=[];return db['sequelize']['query'](_0x5652a7[_0xcde2('0x73')](),_0x1341d0)[_0xcde2('0x5b')](function(_0x8c9a24){_0x485a79=_[_0xcde2('0x74')](_0x8c9a24,'id');_0x1341d0=_[_0xcde2('0x75')](_0x1341d0,{'model':db[_0xd28773],'mapToModel':!![],'nest':!![]});if(_0x3b0961[_0xcde2('0x76')]){_0x5d42f8[_0xcde2('0x77')][_0xcde2('0x23')](function(_0x3f0b7c){_0x34e72a[_0xcde2('0xd')]('i.'+_0x3f0b7c);});}else{_0x34e72a[_0xcde2('0xd')](_0xcde2('0x78'),_0xcde2('0x40'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x79'),_0xcde2('0x7a'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x7b'),_0xcde2('0x7c'));if(_0x857e85===_0xcde2('0x30')){_0x34e72a['field'](_0xcde2('0x7d'),_0xcde2('0x7e'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x7f'),_0xcde2('0x80'));_0x34e72a['field'](_0xcde2('0x81'));_0x34e72a['field'](_0xcde2('0x82'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x83'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x84'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x85'));_0x34e72a['field']('i.attach');_0x34e72a[_0xcde2('0xd')]('i.lastMsgAt');_0x34e72a[_0xcde2('0xd')](_0xcde2('0x86'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x87'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x69'));_0x34e72a[_0xcde2('0xd')]('i.secondDisposition');_0x34e72a[_0xcde2('0xd')](_0xcde2('0x88'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x6a'));_0x34e72a['field'](_0xcde2('0x89'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8a'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8b'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8c'));}else if(_0x857e85===_0xcde2('0x2f')){_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8d'),_0xcde2('0x80'));}else{_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8e'),'contactName');}if(_0x857e85!==_0xcde2('0x30')){_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8f'));}_0x34e72a[_0xcde2('0xd')](_0xcde2('0x90'),_0xcde2('0x91'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x92'),_0xcde2('0x93'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x94'),_0xcde2('0x95'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x96'),_0xcde2('0x97'));_0x34e72a[_0xcde2('0xd')]('c.mobile','Contact.mobile');_0x34e72a[_0xcde2('0xd')](_0xcde2('0x98'),_0xcde2('0x99'));_0x34e72a[_0xcde2('0xd')]('o.fullname',_0xcde2('0x9a'));_0x34e72a['field'](_0xcde2('0x9b'),'Owner.internal');_0x34e72a[_0xcde2('0xd')](_0xcde2('0x9c'),'TagIds');}if(_0x5d42f8[_0xcde2('0x9d')]){_0x34e72a[_0xcde2('0x9d')](_0x5d42f8[_0xcde2('0x9d')]);}if(_0x5d42f8['offset']){_0x34e72a[_0xcde2('0x9e')](_0x5d42f8[_0xcde2('0x9e')]);}return db[_0xcde2('0x9f')][_0xcde2('0xa0')](_0x34e72a['toString'](),_0x1341d0);})['then'](function(_0xc70ceb){_0x325b51=_0xc70ceb;var _0x3fa065=getUsersQuery(_0x857e85,_0x325b51);return db[_0xcde2('0x9f')][_0xcde2('0xa0')](_0x3fa065[_0xcde2('0x73')](),_0x1341d0);})[_0xcde2('0x5b')](function(_0x4be3c3){_0x333cbb=_[_0xcde2('0xa1')](_0x4be3c3,_0x5bd1bd);if(_0x857e85===_0xcde2('0x30')){return db[_0xcde2('0xa2')][_0xcde2('0xa3')]({'attributes':[_0xcde2('0xa4')],'raw':!![]});}})[_0xcde2('0x5b')](function(_0x113478){var _0x5e58fa=_0x113478?_0x113478[_0xcde2('0xa4')]:undefined;var _0x4ea322=_0x325b51['map'](function(_0x55757e){return updateInteraction(_0x55757e,_0x485a79,_0x333cbb,_0x5e58fa);});return Promise[_0xcde2('0xa5')](_0x4ea322);});}function countFilteredInteractions(_0x2b4b1f,_0x55c35f){var _0x2e0684=_0x2b4b1f[_0xcde2('0xa6')]();_0x2e0684['field']('COUNT(*)');_0x2e0684['field'](_0xcde2('0x78'),_0xcde2('0x40'));var _0x5acf6e=utils[_0xcde2('0xa7')](_0x55c35f);if(!_['isEmpty'](_0x5acf6e)){_0x2e0684['where'](_0xcde2('0xa8'),_0x5acf6e);}var _0x243504={'type':db[_0xcde2('0x70')]['QueryTypes'][_0xcde2('0x72')],'raw':!![]};return db[_0xcde2('0x9f')][_0xcde2('0xa0')](_0x2e0684[_0xcde2('0x73')](),_0x243504);}module[_0xcde2('0xa9')]={'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 d72acc4..ec9d5d4 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 _0x0de0=['TagIds','Tags','lodash','../../mysqldb','map','split','forEach','push','waiting','talking','unmanaged','abandoned','total','closed','answered','disposition','UserId','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0x0de0,0xe2));var _0x00de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0de0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x00de('0x0'));var db=require(_0x00de('0x1'))['db'];function getInteractionUsers(_0x2302da,_0x552a9e){return new Promise(function(_0x4112ad,_0x1c70f3){try{var _0x16bbdc=[];if(_0x552a9e[_0x2302da]){_0x16bbdc=_0x552a9e[_0x2302da][_0x00de('0x2')](function(_0x3812ce){return{'id':_0x3812ce['id'],'fullname':_0x3812ce['fullname']};});}return _0x4112ad(_0x16bbdc);}catch(_0x4c483d){_0x1c70f3(_0x4c483d);}});}function getInteractionTags(_0xc3b306,_0x18a9ff){var _0x3d1c2d=[];if(_0xc3b306){_0xc3b306[_0x00de('0x3')](',')[_0x00de('0x4')](function(_0x29d441){_0x3d1c2d[_0x00de('0x5')](_0x18a9ff[_0x29d441]);});}return _0x3d1c2d;}function updateWaitingCounter(_0x41ef14){if(_0x41ef14[_0x00de('0x6')]){_0x41ef14[_0x00de('0x6')]-=0x1;}}function updateInteractionCounters(_0x2085d6){_0x2085d6[_0x00de('0x6')]=0x0;_0x2085d6[_0x00de('0x7')]=0x0;_0x2085d6['answered']=0x0;_0x2085d6[_0x00de('0x8')]=0x0;_0x2085d6[_0x00de('0x9')]=0x0;_0x2085d6[_0x00de('0xa')]=0x0;if(_0x2085d6[_0x00de('0xb')]){if(_0x2085d6['disposition']===_0x00de('0x9')){_0x2085d6[_0x00de('0x9')]+=0x1;updateWaitingCounter(_0x2085d6);}if(_0x2085d6['UserId']){_0x2085d6[_0x00de('0xc')]+=0x1;if(_0x2085d6[_0x00de('0x7')]){_0x2085d6[_0x00de('0x7')]-=0x1;}}else{if(_0x2085d6[_0x00de('0xd')]){_0x2085d6['unmanaged']+=0x1;updateWaitingCounter(_0x2085d6);}}}else{if(!_0x2085d6[_0x00de('0xe')]){_0x2085d6[_0x00de('0x6')]+=0x1;}if(_0x2085d6[_0x00de('0xe')]){_0x2085d6[_0x00de('0x7')]+=0x1;updateWaitingCounter(_0x2085d6);}}_0x2085d6[_0x00de('0xa')]+=0x1;return _0x2085d6;}function getLastMessageText(_0x909248){return db[_0x00de('0xf')][_0x00de('0x10')]({'where':{'$and':[{'MailInteractionId':_0x909248['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x00de('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x00de('0x12')],'order':_0x00de('0x13'),'raw':!![]})[_0x00de('0x14')](function(_0x57e653){if(_0x57e653&&_0x57e653[_0x00de('0x12')]){_0x909248[_0x00de('0x15')]=_[_0x00de('0x16')](_0x57e653[_0x00de('0x12')]);}return _0x909248;})[_0x00de('0x17')](function(_0x47de75){throw _0x47de75;});}exports[_0x00de('0x18')]=function(_0x557de1,_0x4f901c,_0x135fc9,_0x4f8f01){return new Promise(function(_0x15bdf0,_0x1f6b99){return getInteractionUsers(_0x557de1['id'],_0x135fc9)[_0x00de('0x14')](function(_0x55ee58){_0x557de1[_0x00de('0x19')]=_0x55ee58;return getInteractionTags(_0x557de1[_0x00de('0x1a')],_0x4f901c);})['then'](function(_0x4e3dab){_0x557de1[_0x00de('0x1b')]=_0x4e3dab;delete _0x557de1[_0x00de('0x1a')];return updateInteractionCounters(_0x557de1);})[_0x00de('0x14')](function(_0x5ad76a){if(_0x4f8f01){return getLastMessageText(_0x5ad76a);}else{return _0x5ad76a;}})[_0x00de('0x14')](function(_0x42deaa){_0x15bdf0(_0x42deaa);})['catch'](function(_0x123cd7){_0x1f6b99(_0x123cd7);});});}; \ No newline at end of file +var _0xeb67=['TagIds','Tags','lodash','fullname','split','forEach','waiting','total','disposition','abandoned','UserId','answered','talking','MailMessage','out','plainBody','-id','then','trimStart','catch','Users'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0xeb67,0x113));var _0x7eb6=function(_0x3695a5,_0x2d678a){_0x3695a5=_0x3695a5-0x0;var _0x4baedf=_0xeb67[_0x3695a5];return _0x4baedf;};'use strict';var _=require(_0x7eb6('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x5ce6af,_0x410451){return new Promise(function(_0x25d838,_0x598ff8){try{var _0x5a1a24=[];if(_0x410451[_0x5ce6af]){_0x5a1a24=_0x410451[_0x5ce6af]['map'](function(_0x547a5b){return{'id':_0x547a5b['id'],'fullname':_0x547a5b[_0x7eb6('0x1')]};});}return _0x25d838(_0x5a1a24);}catch(_0x24fc6e){_0x598ff8(_0x24fc6e);}});}function getInteractionTags(_0x4fef74,_0x410966){var _0x3821d6=[];if(_0x4fef74){_0x4fef74[_0x7eb6('0x2')](',')[_0x7eb6('0x3')](function(_0x43ee16){_0x3821d6['push'](_0x410966[_0x43ee16]);});}return _0x3821d6;}function updateWaitingCounter(_0x541e2f){if(_0x541e2f['waiting']){_0x541e2f[_0x7eb6('0x4')]-=0x1;}}function updateInteractionCounters(_0x1fe383){_0x1fe383[_0x7eb6('0x4')]=0x0;_0x1fe383['talking']=0x0;_0x1fe383['answered']=0x0;_0x1fe383['unmanaged']=0x0;_0x1fe383['abandoned']=0x0;_0x1fe383[_0x7eb6('0x5')]=0x0;if(_0x1fe383['closed']){if(_0x1fe383[_0x7eb6('0x6')]==='abandoned'){_0x1fe383[_0x7eb6('0x7')]+=0x1;updateWaitingCounter(_0x1fe383);}if(_0x1fe383[_0x7eb6('0x8')]){_0x1fe383[_0x7eb6('0x9')]+=0x1;if(_0x1fe383['talking']){_0x1fe383[_0x7eb6('0xa')]-=0x1;}}else{if(_0x1fe383[_0x7eb6('0x6')]){_0x1fe383['unmanaged']+=0x1;updateWaitingCounter(_0x1fe383);}}}else{if(!_0x1fe383['UserId']){_0x1fe383[_0x7eb6('0x4')]+=0x1;}if(_0x1fe383['UserId']){_0x1fe383[_0x7eb6('0xa')]+=0x1;updateWaitingCounter(_0x1fe383);}}_0x1fe383['total']+=0x1;return _0x1fe383;}function getLastMessageText(_0x4ca1c7){return db[_0x7eb6('0xb')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4ca1c7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7eb6('0xc')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x7eb6('0xd')],'order':_0x7eb6('0xe'),'raw':!![]})[_0x7eb6('0xf')](function(_0xdbe83f){if(_0xdbe83f&&_0xdbe83f[_0x7eb6('0xd')]){_0x4ca1c7['lastMsgText']=_[_0x7eb6('0x10')](_0xdbe83f[_0x7eb6('0xd')]);}return _0x4ca1c7;})[_0x7eb6('0x11')](function(_0x1077b8){throw _0x1077b8;});}exports['updateInteraction']=function(_0xd7de97,_0x3d0ad7,_0x2a5dc5,_0x3f7723){return new Promise(function(_0x3f48d1,_0x58557c){return getInteractionUsers(_0xd7de97['id'],_0x2a5dc5)['then'](function(_0x5114ec){_0xd7de97[_0x7eb6('0x12')]=_0x5114ec;return getInteractionTags(_0xd7de97[_0x7eb6('0x13')],_0x3d0ad7);})[_0x7eb6('0xf')](function(_0x21162b){_0xd7de97[_0x7eb6('0x14')]=_0x21162b;delete _0xd7de97[_0x7eb6('0x13')];return updateInteractionCounters(_0xd7de97);})['then'](function(_0x7da6f9){if(_0x3f7723){return getLastMessageText(_0x7da6f9);}else{return _0x7da6f9;}})[_0x7eb6('0xf')](function(_0x166699){_0x3f48d1(_0x166699);})[_0x7eb6('0x11')](function(_0x206317){_0x58557c(_0x206317);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 2ac559f..dba063e 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 _0x74f9=['InteractionId','unknown','chat','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','upperFirst'];(function(_0x4b1a71,_0x34910e){var _0x57fa7b=function(_0x377421){while(--_0x377421){_0x4b1a71['push'](_0x4b1a71['shift']());}};_0x57fa7b(++_0x34910e);}(_0x74f9,0x11e));var _0x974f=function(_0x59eeaf,_0x56e107){_0x59eeaf=_0x59eeaf-0x0;var _0x119d61=_0x74f9[_0x59eeaf];return _0x119d61;};'use strict';var _=require(_0x974f('0x0'));var db=require(_0x974f('0x1'))['db'];var loggers={'openchannel':require(_0x974f('0x2'))('openchannel-interactions'),'mail':require(_0x974f('0x2'))(_0x974f('0x3')),'fax':require(_0x974f('0x2'))(_0x974f('0x4')),'sms':require(_0x974f('0x2'))('sms-interactions'),'chat':require(_0x974f('0x2'))(_0x974f('0x5')),'whatsapp':require('../../config/logger')(_0x974f('0x6'))};function getAccountFK(_0x5ee536){return _[_0x974f('0x7')](_0x5ee536)+(_0x5ee536==='chat'?_0x974f('0x8'):_0x974f('0x9'))+'Id';}function getInteractionFK(_0x55f285){return _['capitalize'](_0x55f285)+'InteractionId';}function getInteractionId(_0x4653a7,_0x49096d,_0x4c5fc6){if(_0x4653a7&&_0x4653a7[_[_0x974f('0xa')](_0x4c5fc6)+_0x974f('0xb')]){return _0x4653a7[_[_0x974f('0xa')](_0x4c5fc6)+_0x974f('0xb')];}else if(_0x4653a7&&_0x4653a7['id']){return _0x4653a7['id'];}else if(_0x49096d&&_0x49096d['id']){return _0x49096d['id'];}else{return _0x974f('0xc');}}function getInteractionsTables(_0x2d7dac){return{'accounts':_0x2d7dac+'_'+(_0x2d7dac===_0x974f('0xd')?_0x974f('0xe'):_0x974f('0xf')),'interactions':_0x2d7dac+_0x974f('0x10'),'interactionsTags':_0x2d7dac+_0x974f('0x11'),'messages':_0x2d7dac+_0x974f('0x12'),'userInteractions':_0x974f('0x13')+_0x2d7dac+_0x974f('0x10')};}function getSelectedTags(_0x456c1d){var _0x342843=[];if(_0x456c1d){_0x342843=Array[_0x974f('0x14')](_0x456c1d)?_0x456c1d:[_0x456c1d];}return _0x342843;}function log(_0x55ec91,_0x1fa23c,_0x1a4998,_0x1fe257,_0x1d29e3,_0x1f1b14){loggers[_0x1d29e3['toLowerCase']()][_0x55ec91]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f1b14[_0x974f('0x15')](),_0x1fa23c?_0x1fa23c['id']:null,_0x1fa23c?_0x1fa23c[_0x974f('0x16')]:null,_0x1fa23c?_0x1fa23c[_0x974f('0x17')]:null,getInteractionId(_0x1a4998,_0x1fe257,_0x1d29e3),_0x1a4998?JSON[_0x974f('0x18')](_0x1a4998):_0x974f('0x19'));}function updateUser(_0x5e8439,_0x478a2e,_0x45bc80,_0x4ee622,_0x206331){db[_[_0x974f('0xa')](_0x4ee622)+_0x974f('0x1a')][_0x974f('0x1b')]({'where':{'id':getInteractionId(_0x478a2e,_0x45bc80,_0x4ee622)}})[_0x974f('0x1c')](function(_0x45d056){if(_0x45d056){return _0x45d056[_0x974f('0x1d')]({'UserId':_0x5e8439?_0x5e8439['id']:null});}})['then'](function(_0x1f76e8){if(_0x1f76e8){log(_0x974f('0x1e'),_0x5e8439,_0x478a2e,_0x45bc80,_0x4ee622,_0x206331);}})[_0x974f('0x1f')](function(){log(_0x974f('0x20'),_0x5e8439,_0x478a2e,_0x45bc80,_0x4ee622,_0x206331);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xa73d=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','findOne','then','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Account','InteractionId','upperFirst','chat','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','toLowerCase'];(function(_0x30ad90,_0x2803b5){var _0x5cc517=function(_0x53a962){while(--_0x53a962){_0x30ad90['push'](_0x30ad90['shift']());}};_0x5cc517(++_0x2803b5);}(_0xa73d,0xc5));var _0xda73=function(_0xdb5493,_0x284696){_0xdb5493=_0xdb5493-0x0;var _0x47d622=_0xa73d[_0xdb5493];return _0x47d622;};'use strict';var _=require(_0xda73('0x0'));var db=require(_0xda73('0x1'))['db'];var loggers={'openchannel':require(_0xda73('0x2'))(_0xda73('0x3')),'mail':require(_0xda73('0x2'))(_0xda73('0x4')),'fax':require(_0xda73('0x2'))('fax-interactions'),'sms':require('../../config/logger')(_0xda73('0x5')),'chat':require(_0xda73('0x2'))(_0xda73('0x6')),'whatsapp':require('../../config/logger')(_0xda73('0x7'))};function getAccountFK(_0x11cbd2){return _[_0xda73('0x8')](_0x11cbd2)+(_0x11cbd2==='chat'?'Website':_0xda73('0x9'))+'Id';}function getInteractionFK(_0xcd397a){return _[_0xda73('0x8')](_0xcd397a)+_0xda73('0xa');}function getInteractionId(_0x270665,_0x451d92,_0x8e1187){if(_0x270665&&_0x270665[_[_0xda73('0xb')](_0x8e1187)+_0xda73('0xa')]){return _0x270665[_[_0xda73('0xb')](_0x8e1187)+_0xda73('0xa')];}else if(_0x270665&&_0x270665['id']){return _0x270665['id'];}else if(_0x451d92&&_0x451d92['id']){return _0x451d92['id'];}else{return'unknown';}}function getInteractionsTables(_0xeeb747){return{'accounts':_0xeeb747+'_'+(_0xeeb747===_0xda73('0xc')?_0xda73('0xd'):_0xda73('0xe')),'interactions':_0xeeb747+_0xda73('0xf'),'interactionsTags':_0xeeb747+_0xda73('0x10'),'messages':_0xeeb747+'_messages','userInteractions':_0xda73('0x11')+_0xeeb747+'_interactions'};}function getSelectedTags(_0x5126cc){var _0x4b20c7=[];if(_0x5126cc){_0x4b20c7=Array[_0xda73('0x12')](_0x5126cc)?_0x5126cc:[_0x5126cc];}return _0x4b20c7;}function log(_0x338770,_0x554fbb,_0x2d7a9d,_0x1d51ee,_0x392eb7,_0x4e12d9){loggers[_0x392eb7[_0xda73('0x13')]()][_0x338770](_0xda73('0x14'),_0x4e12d9[_0xda73('0x15')](),_0x554fbb?_0x554fbb['id']:null,_0x554fbb?_0x554fbb[_0xda73('0x16')]:null,_0x554fbb?_0x554fbb['role']:null,getInteractionId(_0x2d7a9d,_0x1d51ee,_0x392eb7),_0x2d7a9d?JSON[_0xda73('0x17')](_0x2d7a9d):_0xda73('0x18'));}function updateUser(_0x26743b,_0x47a7b2,_0x32be03,_0x5e39d3,_0x2f5ef4){db[_[_0xda73('0xb')](_0x5e39d3)+'Interaction'][_0xda73('0x19')]({'where':{'id':getInteractionId(_0x47a7b2,_0x32be03,_0x5e39d3)}})[_0xda73('0x1a')](function(_0x1502ad){if(_0x1502ad){return _0x1502ad['update']({'UserId':_0x26743b?_0x26743b['id']:null});}})[_0xda73('0x1a')](function(_0xf8a662){if(_0xf8a662){log(_0xda73('0x1b'),_0x26743b,_0x47a7b2,_0x32be03,_0x5e39d3,_0x2f5ef4);}})[_0xda73('0x1c')](function(){log(_0xda73('0x1d'),_0x26743b,_0x47a7b2,_0x32be03,_0x5e39d3,_0x2f5ef4);});}module[_0xda73('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 0179a5f..c2d234c 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 _0xf641=['User','admin','user','crypto','data1','license','%s:%s:%s','utf8','final','parse','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users'];(function(_0x223147,_0x363953){var _0x16471d=function(_0xabf6c5){while(--_0xabf6c5){_0x223147['push'](_0x223147['shift']());}};_0x16471d(++_0x363953);}(_0xf641,0x193));var _0x1f64=function(_0x9d2d2,_0x1c1c2c){_0x9d2d2=_0x9d2d2-0x0;var _0x488242=_0xf641[_0x9d2d2];return _0x488242;};'use strict';var crypto=require(_0x1f64('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x415b2d,_0x5e1573){if(_0x415b2d&&_0x5e1573){if(_0x5e1573['data1']&&_0x5e1573['license']){var _0x1fa9d8=_0x5e1573[_0x1f64('0x1')];var _0x35dfba=_0x5e1573[_0x1f64('0x2')];var _0x4d87b1=_0x1fa9d8['split']('-')[0x4];var _0xac1e0=_0x1fa9d8['split']('-')[0x0];var _0x5c3d66=crypto['createDecipher']('aes-256-ctr',util['format'](_0x1f64('0x3'),_0x4d87b1,_0x1fa9d8,_0xac1e0));var _0xfe1cc1=_0x5c3d66['update'](_0x35dfba,'base64',_0x1f64('0x4'));_0xfe1cc1+=_0x5c3d66[_0x1f64('0x5')]('utf8');var _0x7a1933=JSON[_0x1f64('0x6')](_0xfe1cc1);return _0x7a1933['hasOwnProperty'](_0x415b2d)?_0x7a1933[_0x415b2d]:null;}}return null;}function isLimit(_0x1c29e5,_0x121d38,_0x19f2e0,_0x30486b){var _0x9ced6f=_0x121d38;return compose()[_0x1f64('0x7')](function(_0x27c7b6,_0x55e5f3,_0x33a99b){return db[_0x1f64('0x8')][_0x1f64('0x9')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x19bb01){var _0x9ee14d=getValueFromLicense(_0x1c29e5,_0x19bb01);return _0x9ee14d?_0x9ee14d:_0x9ced6f;})[_0x1f64('0xa')](function(_0x23a61b){_0x9ced6f=_0x23a61b;return _0x19f2e0[_0x1f64('0xb')](_0x30486b);})[_0x1f64('0xa')](function(_0x1f9d59){if(_0x1f9d59>=_0x9ced6f){return _0x55e5f3[_0x1f64('0xc')](0x193)[_0x1f64('0xd')]({'message':util['format'](_0x1f64('0xe'),_0x1c29e5)});}_0x33a99b();})[_0x1f64('0xf')](function(_0x10b23f){_0x33a99b(_0x10b23f);});});}function isUserLimit(){return isLimit(_0x1f64('0x10'),0x1,db[_0x1f64('0x11')],{'where':{'$or':[{'role':_0x1f64('0x12')},{'role':_0x1f64('0x13')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xe34f=['License','findOne','then','count','users','User','admin','user','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','parse','hasOwnProperty','use'];(function(_0x4e5d16,_0x3eb062){var _0x111845=function(_0xe956f4){while(--_0xe956f4){_0x4e5d16['push'](_0x4e5d16['shift']());}};_0x111845(++_0x3eb062);}(_0xe34f,0xbc));var _0xfe34=function(_0x5e24bc,_0x3f3c8e){_0x5e24bc=_0x5e24bc-0x0;var _0x2ecc20=_0xe34f[_0x5e24bc];return _0x2ecc20;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xfe34('0x0'));function getValueFromLicense(_0x43eb44,_0x3378ed){if(_0x43eb44&&_0x3378ed){if(_0x3378ed[_0xfe34('0x1')]&&_0x3378ed[_0xfe34('0x2')]){var _0x123f0e=_0x3378ed[_0xfe34('0x1')];var _0x57c220=_0x3378ed[_0xfe34('0x2')];var _0x24e8cb=_0x123f0e[_0xfe34('0x3')]('-')[0x4];var _0x3fe816=_0x123f0e[_0xfe34('0x3')]('-')[0x0];var _0x4fa1cd=crypto['createDecipher'](_0xfe34('0x4'),util[_0xfe34('0x5')](_0xfe34('0x6'),_0x24e8cb,_0x123f0e,_0x3fe816));var _0x3eac84=_0x4fa1cd[_0xfe34('0x7')](_0x57c220,_0xfe34('0x8'),'utf8');_0x3eac84+=_0x4fa1cd['final']('utf8');var _0x4b67e6=JSON[_0xfe34('0x9')](_0x3eac84);return _0x4b67e6[_0xfe34('0xa')](_0x43eb44)?_0x4b67e6[_0x43eb44]:null;}}return null;}function isLimit(_0x53faa7,_0x431e54,_0x2fbadd,_0x17906a){var _0x30ea37=_0x431e54;return compose()[_0xfe34('0xb')](function(_0x3b00b9,_0x48e845,_0x193eeb){return db[_0xfe34('0xc')][_0xfe34('0xd')]({'where':{'id':0x1},'raw':!![]})[_0xfe34('0xe')](function(_0x2a7790){var _0x5c599c=getValueFromLicense(_0x53faa7,_0x2a7790);return _0x5c599c?_0x5c599c:_0x30ea37;})[_0xfe34('0xe')](function(_0x3acbda){_0x30ea37=_0x3acbda;return _0x2fbadd[_0xfe34('0xf')](_0x17906a);})[_0xfe34('0xe')](function(_0x53099b){if(_0x53099b>=_0x30ea37){return _0x48e845['status'](0x193)['json']({'message':util[_0xfe34('0x5')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x53faa7)});}_0x193eeb();})['catch'](function(_0x495b48){_0x193eeb(_0x495b48);});});}function isUserLimit(){return isLimit(_0xfe34('0x10'),0x1,db[_0xfe34('0x11')],{'where':{'$or':[{'role':_0xfe34('0x12')},{'role':_0xfe34('0x13')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 7962c8c..5a28d40 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 _0x6130=['DATE','utcOffset','add','hours','minutes','seconds','lodash','parseSearch','startsWith','[$or]','[$and]','replace','split','length','slice','forEach','shift','match','indexOf','map','conditions','push','buildExpression','operator','$eq','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','$startsWith'];(function(_0x293caa,_0x10c8a3){var _0x5ec971=function(_0x3b3bc7){while(--_0x3b3bc7){_0x293caa['push'](_0x293caa['shift']());}};_0x5ec971(++_0x10c8a3);}(_0x6130,0x156));var _0x0613=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x6130[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x0613('0x0'));var moment=require('moment');exports[_0x0613('0x1')]=function(_0x528a5e){var _0x56a27c={'conditions':[]};_0x56a27c['sqlOperator']=_[_0x0613('0x2')](_0x528a5e,_0x0613('0x3'))?'or':'and';var _0x8a64d4=_0x528a5e['replace'](_0x0613('0x4'),'')[_0x0613('0x5')](_0x0613('0x3'),'')[_0x0613('0x6')]('||');for(var _0xe876fa=0x0;_0xe876fa<_0x8a64d4[_0x0613('0x7')];_0xe876fa++){var _0x157329=_0x8a64d4[_0xe876fa]['split'](':=');var _0x543060=_0x157329[0x0];var _0x3c8e2c=_0x157329[_0x0613('0x8')](0x1);_0x3c8e2c[_0x0613('0x9')](function(_0x3121d5){var _0xaf32f2=_0x3121d5[_0x0613('0x6')]('[')[_0x0613('0xa')]();var _0x234644=_0x3121d5[_0x0613('0xb')](/\[(.*?)\]/g);_0x234644['forEach'](function(_0x55b466){var _0x5911a3=_0x55b466[_0x0613('0x6')]('[')['filter'](function(_0x49c622){return _0x49c622[_0x0613('0xc')](']')>-0x1;})[_0x0613('0xd')](function(_0x120d0a){return _0x120d0a['split'](']')[0x0];})[0x0];_0x56a27c[_0x0613('0xe')][_0x0613('0xf')]({'field':_0x543060,'operator':_0xaf32f2,'value':_0x5911a3});});});}return _0x56a27c;};exports[_0x0613('0x10')]=function(_0x30b0eb,_0x540c68,_0x1d2952){var _0x3fd236={};if(_0x540c68==='DATE'){if(_0x1d2952[_0x0613('0x11')]===_0x0613('0x12')){_0x1d2952['operator']='$between';_0x1d2952[_0x0613('0x13')]+=','+_0x1d2952['value'];}else if(_[_0x0613('0x14')]([_0x0613('0x15'),_0x0613('0x16')],_0x1d2952[_0x0613('0x11')])){_0x1d2952[_0x0613('0x13')]=moment(_0x1d2952[_0x0613('0x13')])['add'](0x1,_0x0613('0x17'))[_0x0613('0x18')](_0x0613('0x19'));}}if(_0x1d2952[_0x0613('0x1a')]){_0x540c68=_0x1d2952[_0x0613('0x1a')];_0x3fd236[_0x0613('0x1b')]=_0x0613('0x1c')+_0x30b0eb+'.'+_0x1d2952[_0x0613('0x1d')]+_0x0613('0x1e')+_0x1d2952[_0x0613('0x1a')]+')\x20'+parseOperator(_0x1d2952[_0x0613('0x11')]);}else{_0x3fd236[_0x0613('0x1b')]=_0x30b0eb+'.'+_0x1d2952[_0x0613('0x1d')]+'\x20'+parseOperator(_0x1d2952['operator']);}if(_['includes']([_0x0613('0x1f'),_0x0613('0x20')],_0x1d2952[_0x0613('0x11')]))_0x3fd236[_0x0613('0x1b')]='('+_0x3fd236[_0x0613('0x1b')]+_0x0613('0x21')+_0x30b0eb+'.'+_0x1d2952[_0x0613('0x1d')]+_0x0613('0x22');_0x3fd236[_0x0613('0x13')]=parseValue(_0x540c68,_0x1d2952[_0x0613('0x11')],_0x1d2952['value']);return _0x3fd236;};function parseOperator(_0x328a0d){var _0x502a92;switch(_0x328a0d){case _0x0613('0x23'):_0x502a92=_0x0613('0x24');break;case _0x0613('0x20'):_0x502a92='NOT\x20IN\x20?';break;case _0x0613('0x12'):_0x502a92=_0x0613('0x25');break;case _0x0613('0x1f'):_0x502a92=_0x0613('0x26');break;case _0x0613('0x27'):case'$startsWith':case _0x0613('0x28'):_0x502a92='LIKE\x20?';break;case _0x0613('0x29'):_0x502a92=_0x0613('0x2a');break;case _0x0613('0x15'):_0x502a92=_0x0613('0x2b');break;case _0x0613('0x16'):_0x502a92=_0x0613('0x2c');break;case _0x0613('0x2d'):_0x502a92='>=\x20?';break;case _0x0613('0x2e'):_0x502a92=_0x0613('0x2f');break;}return _0x502a92;}function parseValue(_0x4cda5a,_0x3d9ebd,_0x4fe7a6){var _0x3ade4a={'start':undefined,'end':undefined};switch(_0x3d9ebd){case _0x0613('0x23'):case'$notIn':_0x3ade4a[_0x0613('0x30')]=_0x4fe7a6[_0x0613('0x6')](',');break;case _0x0613('0x27'):_0x3ade4a[_0x0613('0x30')]='%'+_0x4fe7a6+'%';break;case _0x0613('0x31'):_0x3ade4a[_0x0613('0x30')]=_0x4fe7a6+'%';break;case _0x0613('0x28'):_0x3ade4a[_0x0613('0x30')]='%'+_0x4fe7a6;break;case _0x0613('0x2e'):var _0x270c35=_0x4fe7a6[_0x0613('0x6')](',');var _0x4fe7a6=_0x270c35[_0x0613('0xa')]();var _0x6e78be=_0x270c35['pop']();if(_0x4cda5a===_0x0613('0x32')){_0x4fe7a6=moment(_0x4fe7a6)['utcOffset'](0x0,!![])['format']();_0x6e78be=moment(_0x6e78be)[_0x0613('0x33')](0x0,!![])[_0x0613('0x34')](0x17,_0x0613('0x35'))[_0x0613('0x34')](0x3b,_0x0613('0x36'))['add'](0x3b,_0x0613('0x37'))[_0x0613('0x18')]();}_0x3ade4a={'start':_0x4fe7a6,'end':_0x6e78be};break;default:_0x3ade4a[_0x0613('0x30')]=_0x4fe7a6;break;}return _0x3ade4a;} \ No newline at end of file +var _0x5ca7=['$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','$eq','$between','value','includes','$gt','$lte','operator','add','format','YYYY-MM-DD','castTo','field','\x20AS\x20','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?'];(function(_0x1b959e,_0x5b2d5f){var _0xa5ecea=function(_0x447b07){while(--_0x447b07){_0x1b959e['push'](_0x1b959e['shift']());}};_0xa5ecea(++_0x5b2d5f);}(_0x5ca7,0x1e7));var _0x75ca=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x5ca7[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var moment=require(_0x75ca('0x0'));exports[_0x75ca('0x1')]=function(_0x5b7829){var _0x547044={'conditions':[]};_0x547044[_0x75ca('0x2')]=_[_0x75ca('0x3')](_0x5b7829,_0x75ca('0x4'))?'or':_0x75ca('0x5');var _0x10a051=_0x5b7829[_0x75ca('0x6')](_0x75ca('0x7'),'')[_0x75ca('0x6')](_0x75ca('0x4'),'')[_0x75ca('0x8')]('||');for(var _0x3a5895=0x0;_0x3a5895<_0x10a051[_0x75ca('0x9')];_0x3a5895++){var _0x293376=_0x10a051[_0x3a5895][_0x75ca('0x8')](':=');var _0x313f6e=_0x293376[0x0];var _0x10e9c6=_0x293376[_0x75ca('0xa')](0x1);_0x10e9c6[_0x75ca('0xb')](function(_0x448d26){var _0xb76ef0=_0x448d26[_0x75ca('0x8')]('[')[_0x75ca('0xc')]();var _0x122b38=_0x448d26[_0x75ca('0xd')](/\[(.*?)\]/g);_0x122b38[_0x75ca('0xb')](function(_0x2ecb13){var _0x2cb959=_0x2ecb13[_0x75ca('0x8')]('[')[_0x75ca('0xe')](function(_0x6ab3ec){return _0x6ab3ec[_0x75ca('0xf')](']')>-0x1;})[_0x75ca('0x10')](function(_0x41c017){return _0x41c017[_0x75ca('0x8')](']')[0x0];})[0x0];_0x547044[_0x75ca('0x11')][_0x75ca('0x12')]({'field':_0x313f6e,'operator':_0xb76ef0,'value':_0x2cb959});});});}return _0x547044;};exports[_0x75ca('0x13')]=function(_0x5661f5,_0x4d2bcc,_0x947b3f){var _0x4b80d0={};if(_0x4d2bcc===_0x75ca('0x14')){if(_0x947b3f['operator']===_0x75ca('0x15')){_0x947b3f['operator']=_0x75ca('0x16');_0x947b3f[_0x75ca('0x17')]+=','+_0x947b3f['value'];}else if(_[_0x75ca('0x18')]([_0x75ca('0x19'),_0x75ca('0x1a')],_0x947b3f[_0x75ca('0x1b')])){_0x947b3f['value']=moment(_0x947b3f['value'])[_0x75ca('0x1c')](0x1,'days')[_0x75ca('0x1d')](_0x75ca('0x1e'));}}if(_0x947b3f[_0x75ca('0x1f')]){_0x4d2bcc=_0x947b3f['castTo'];_0x4b80d0['text']='CAST('+_0x5661f5+'.'+_0x947b3f[_0x75ca('0x20')]+_0x75ca('0x21')+_0x947b3f[_0x75ca('0x1f')]+')\x20'+parseOperator(_0x947b3f[_0x75ca('0x1b')]);}else{_0x4b80d0['text']=_0x5661f5+'.'+_0x947b3f[_0x75ca('0x20')]+'\x20'+parseOperator(_0x947b3f[_0x75ca('0x1b')]);}if(_['includes']([_0x75ca('0x22'),_0x75ca('0x23')],_0x947b3f[_0x75ca('0x1b')]))_0x4b80d0[_0x75ca('0x24')]='('+_0x4b80d0[_0x75ca('0x24')]+_0x75ca('0x25')+_0x5661f5+'.'+_0x947b3f[_0x75ca('0x20')]+_0x75ca('0x26');_0x4b80d0[_0x75ca('0x17')]=parseValue(_0x4d2bcc,_0x947b3f[_0x75ca('0x1b')],_0x947b3f['value']);return _0x4b80d0;};function parseOperator(_0x1ad212){var _0x2882aa;switch(_0x1ad212){case _0x75ca('0x27'):_0x2882aa=_0x75ca('0x28');break;case _0x75ca('0x23'):_0x2882aa=_0x75ca('0x29');break;case _0x75ca('0x15'):_0x2882aa=_0x75ca('0x2a');break;case _0x75ca('0x22'):_0x2882aa=_0x75ca('0x2b');break;case _0x75ca('0x2c'):case _0x75ca('0x2d'):case _0x75ca('0x2e'):_0x2882aa=_0x75ca('0x2f');break;case _0x75ca('0x30'):_0x2882aa='<\x20?';break;case'$gt':_0x2882aa=_0x75ca('0x31');break;case _0x75ca('0x1a'):_0x2882aa=_0x75ca('0x32');break;case _0x75ca('0x33'):_0x2882aa=_0x75ca('0x34');break;case'$between':_0x2882aa=_0x75ca('0x35');break;}return _0x2882aa;}function parseValue(_0x465f18,_0x1893e8,_0x324ca1){var _0x19b474={'start':undefined,'end':undefined};switch(_0x1893e8){case _0x75ca('0x27'):case _0x75ca('0x23'):_0x19b474[_0x75ca('0x36')]=_0x324ca1[_0x75ca('0x8')](',');break;case _0x75ca('0x2c'):_0x19b474['start']='%'+_0x324ca1+'%';break;case _0x75ca('0x2d'):_0x19b474[_0x75ca('0x36')]=_0x324ca1+'%';break;case _0x75ca('0x2e'):_0x19b474[_0x75ca('0x36')]='%'+_0x324ca1;break;case _0x75ca('0x16'):var _0x532357=_0x324ca1[_0x75ca('0x8')](',');var _0x324ca1=_0x532357[_0x75ca('0xc')]();var _0x5b90f8=_0x532357[_0x75ca('0x37')]();if(_0x465f18===_0x75ca('0x14')){_0x324ca1=moment(_0x324ca1)[_0x75ca('0x38')](0x0,!![])[_0x75ca('0x1d')]();_0x5b90f8=moment(_0x5b90f8)[_0x75ca('0x38')](0x0,!![])[_0x75ca('0x1c')](0x17,'hours')[_0x75ca('0x1c')](0x3b,_0x75ca('0x39'))[_0x75ca('0x1c')](0x3b,_0x75ca('0x3a'))[_0x75ca('0x1d')]();}_0x19b474={'start':_0x324ca1,'end':_0x5b90f8};break;default:_0x19b474[_0x75ca('0x36')]=_0x324ca1;break;}return _0x19b474;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 9c631a6..5062657 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 _0xb4c7=['unsigned','substr','DESC','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','getOptions','$id','query','map','intersection','model','attributes','nolimit','where','pick','object','filter','columns','value','VIRTUAL','lower','merge','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','col'];(function(_0x42004d,_0x127961){var _0xb47cd4=function(_0x5a3b8d){while(--_0x5a3b8d){_0x42004d['push'](_0x42004d['shift']());}};_0xb47cd4(++_0x127961);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3b3735,_0x22b63b){_0x3b3735=_0x3b3735-0x0;var _0x114c8e=_0xb4c7[_0x3b3735];return _0x114c8e;};'use strict';var _=require(_0x7b4c('0x0'));var sequelize=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xa0d9f1){var _0x286a79=['ne'];try{var _0x4bef48=JSON[_0x7b4c('0x3')](_0xa0d9f1);var _0x149d55=Object[_0x7b4c('0x4')](_0x4bef48)[0x0];return _0x286a79[_0x7b4c('0x5')](_0x149d55);}catch(_0x2d9945){return![];}}function getOperatorValue(_0x5adec9){var _0x1b0f57=JSON[_0x7b4c('0x3')](_0x5adec9);var _0x2dd5c7=Object['keys'](_0x1b0f57)[0x0];var _0x2d7b7e=_0x1b0f57[_0x2dd5c7];return{['$'+_0x2dd5c7]:_0x2d7b7e};}exports[_0x7b4c('0x6')]=function(_0x570daa){var _0x433aa2=null;if(_0x570daa){_0x433aa2=_0x570daa[_0x7b4c('0x7')](',');}return _0x433aa2;};exports[_0x7b4c('0x8')]=function(_0x237e28,_0x365225){var _0x93d013={};if(!_[_0x7b4c('0x9')](_0x237e28)){_[_0x7b4c('0xa')](_0x237e28,function(_0xa9814e,_0x2adb51){try{if(_0x365225){var _0x5d5bc3=_['find'](_0x365225,{'name':_0x2adb51})||{};if(hasSequelizeOperator(_0xa9814e)){_0x93d013[_0x2adb51]=getOperatorValue(_0xa9814e);}else if(_0x5d5bc3[_0x7b4c('0xb')]===_0x7b4c('0xc')&&_[_0x7b4c('0xd')](_0xa9814e)){var _0x1722ad=JSON[_0x7b4c('0x3')](_0xa9814e);var _0x341d36={'$gte':moment(moment(_0x1722ad[_0x7b4c('0xe')])[_0x7b4c('0xf')](_0x7b4c('0x10')))[_0x7b4c('0x11')]()['format'](),'$lte':moment(moment(_0x1722ad[_0x7b4c('0x12')])[_0x7b4c('0xf')](_0x7b4c('0x10')))[_0x7b4c('0x11')]()[_0x7b4c('0x13')](0x1,'s')[_0x7b4c('0xf')]()};_0x93d013[_0x2adb51]=_0x341d36;}else if(_0x5d5bc3[_0x7b4c('0x14')]===_0x7b4c('0x15')){_0x93d013[_0x2adb51]=_0xa9814e;}else{_0x93d013[_0x2adb51]=_['isArray'](_0xa9814e)?_0xa9814e:JSON[_0x7b4c('0x3')](_0xa9814e);}}else{_0x93d013[_0x2adb51]=_[_0x7b4c('0x16')](_0xa9814e)?_0xa9814e:JSON[_0x7b4c('0x3')](_0xa9814e);}}catch(_0x36c02a){_0x93d013[_0x2adb51]=_0xa9814e['split'](',');}});}return _0x93d013;};exports[_0x7b4c('0x17')]=function(_0x3d314d){_0x3d314d=parseInt(_0x3d314d,0xa);if(!_0x3d314d||_0x3d314d<0x0){_0x3d314d=LIMIT_VALUE;}return _0x3d314d;};exports[_0x7b4c('0x18')]=function(_0x380b79){_0x380b79=parseInt(_0x380b79,0xa);if(!_0x380b79||_0x380b79<0x0){_0x380b79=0x0;}return _0x380b79;};exports[_0x7b4c('0x19')]=function(_0x1363b4){var _0x237110,_0x445281=null;if(_0x1363b4){_0x237110=_0x1363b4[_0x7b4c('0x7')](',');_0x445281=_['map'](_0x237110,function(_0x1f06ec){if(_0x1f06ec[_0x7b4c('0x1a')]('-')===0x0){return[_0x1f06ec===_0x7b4c('0x1b')?sequelize[_0x7b4c('0x1c')](sequelize[_0x7b4c('0x1d')](_0x7b4c('0x1b')),_0x7b4c('0x1e')):_0x1f06ec[_0x7b4c('0x1f')](0x1),_0x7b4c('0x20')];}else{return[_0x1f06ec===_0x7b4c('0x1b')?sequelize['cast'](sequelize[_0x7b4c('0x1d')](_0x7b4c('0x1b')),_0x7b4c('0x1e')):_0x1f06ec,_0x7b4c('0x21')];}});}return _0x445281;};exports[_0x7b4c('0x22')]=function(_0x2bdc4d,_0x37c059){if(_[_0x7b4c('0x9')](_0x2bdc4d)){return _0x2bdc4d;}if(_[_0x7b4c('0x16')](_0x2bdc4d)){for(var _0x1a69db=0x0;_0x1a69db<_0x2bdc4d[_0x7b4c('0x23')];_0x1a69db+=0x1){_0x2bdc4d[_0x1a69db]=this[_0x7b4c('0x22')](_0x2bdc4d[_0x1a69db],_0x37c059);}return _0x2bdc4d;}if(!_[_0x7b4c('0x24')](_0x2bdc4d)){return _0x2bdc4d;}if(_['isString'](_0x37c059)){_0x37c059=[_0x37c059];}if(!_[_0x7b4c('0x16')](_0x37c059)){return _0x2bdc4d;}for(var _0x3ab614=0x0;_0x3ab614<_0x37c059[_0x7b4c('0x23')];_0x3ab614+=0x1){_[_0x7b4c('0x25')](_0x2bdc4d,_0x37c059[_0x3ab614]);}for(var _0x207c2f in _0x2bdc4d){if(_0x2bdc4d[_0x7b4c('0x26')](_0x207c2f)){_0x2bdc4d[_0x207c2f]=this[_0x7b4c('0x22')](_0x2bdc4d[_0x207c2f],_0x37c059);}}return _0x2bdc4d;};exports[_0x7b4c('0x27')]=function(_0x3e4a46){return _0x3e4a46[_0x7b4c('0x28')](RegExp(_0x7b4c('0x29')))?!![]:![];};exports[_0x7b4c('0x2a')]=function(_0x3544bc){return _0x3544bc[_0x7b4c('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x7b4c('0x2b')]=function(_0x3e5bdd){var _0x1d0724=[];_0x3e5bdd[_0x7b4c('0x7')](/[ ,]+/)[_0x7b4c('0x2c')](function(_0x4f0d33){_0x4f0d33=_0x4f0d33['replace'](/([^:]")"+/g,'$1');_0x4f0d33='+'+_0x4f0d33+'*';var _0x511f21=/[ `!@#$%^&*()_\-?~]/;if(_0x4f0d33[_0x7b4c('0x28')](_0x511f21))_0x4f0d33='\x22'+_0x4f0d33+'\x22';_0x1d0724[_0x7b4c('0x2d')](_0x4f0d33);});return _0x1d0724[_0x7b4c('0x2e')]('\x20');};exports[_0x7b4c('0x2f')]=function(_0x498391,_0x6e66e3,_0x344325){var _0x5d728b={},_0x647978={};if(_0x6e66e3['query'][_0x7b4c('0x30')]){_0x6e66e3[_0x7b4c('0x31')]['id']=_0x6e66e3[_0x7b4c('0x31')]['$id'];delete _0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x30')];}_0x5d728b['model']=_[_0x7b4c('0x32')](_0x498391,_0x7b4c('0x14'));_0x5d728b[_0x7b4c('0x31')]=_[_0x7b4c('0x4')](_0x6e66e3['query']);_0x5d728b['filters']=_[_0x7b4c('0x33')](_0x5d728b[_0x7b4c('0x34')],_0x5d728b['query']);_0x647978[_0x7b4c('0x35')]=_['intersection'](_0x5d728b['model'],this[_0x7b4c('0x6')](_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x6')]));_0x647978[_0x7b4c('0x35')]=_0x647978['attributes'][_0x7b4c('0x23')]?_0x647978[_0x7b4c('0x35')]:_0x5d728b[_0x7b4c('0x34')];if(!_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x26')](_0x7b4c('0x36'))){_0x647978[_0x7b4c('0x17')]=this['limit'](_0x6e66e3['query'][_0x7b4c('0x17')]);_0x647978[_0x7b4c('0x18')]=this[_0x7b4c('0x18')](_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x18')]);}_0x647978['order']=this[_0x7b4c('0x19')](_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x19')]);_0x647978[_0x7b4c('0x37')]=this[_0x7b4c('0x8')](_[_0x7b4c('0x38')](_0x6e66e3[_0x7b4c('0x31')],_0x5d728b[_0x7b4c('0x8')]),_0x498391);if(_0x6e66e3[_0x7b4c('0x31')]['filter']){var _0x2a4085=_0x498391;var _0x562838=_0x6e66e3[_0x7b4c('0x31')]['filter'];if(typeof _0x562838===_0x7b4c('0x39')){_0x2a4085=_[_0x7b4c('0x3a')](_0x498391,function(_0x5bb6d0){return _['includes'](_0x562838[_0x7b4c('0x3b')],_0x5bb6d0[_0x7b4c('0x14')]);});_0x562838=_0x562838[_0x7b4c('0x3c')];}_0x647978[_0x7b4c('0x37')]=_['merge'](_0x647978[_0x7b4c('0x37')],{'$or':_[_0x7b4c('0x32')](_0x2a4085,function(_0x100774){if(_0x100774['type']!==_0x7b4c('0x3d')){if(_0x344325){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x7b4c('0x1d')](_0x100774['name'])),{'$like':sequelize['fn'](_0x7b4c('0x3e'),'%'+_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x3a')]+'%')});}else{var _0x301935={};_0x301935[_0x100774[_0x7b4c('0x14')]]={'$like':'%'+_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x3a')]+'%'};return _0x301935;}}})});}_0x647978=_[_0x7b4c('0x3f')]({},_0x647978,_0x6e66e3[_0x7b4c('0x40')]);return _0x647978;}; \ No newline at end of file +var _0xac31=['object','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','unset','hasOwnProperty','omit','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','map','intersection','attributes','fields','length','nolimit','order','where','pick','filter'];(function(_0x1d86de,_0x752a4a){var _0x4dfd1f=function(_0x1513f1){while(--_0x1513f1){_0x1d86de['push'](_0x1d86de['shift']());}};_0x4dfd1f(++_0x752a4a);}(_0xac31,0xca));var _0x1ac3=function(_0x57698e,_0x40cf01){_0x57698e=_0x57698e-0x0;var _0x59f299=_0xac31[_0x57698e];return _0x59f299;};'use strict';var _=require(_0x1ac3('0x0'));var sequelize=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3086c0){var _0xd6934=['ne'];try{var _0x11dd6d=JSON[_0x1ac3('0x3')](_0x3086c0);var _0x59b42c=Object[_0x1ac3('0x4')](_0x11dd6d)[0x0];return _0xd6934[_0x1ac3('0x5')](_0x59b42c);}catch(_0x4dcc96){return![];}}function getOperatorValue(_0x5ef1b6){var _0xbe22b7=JSON[_0x1ac3('0x3')](_0x5ef1b6);var _0x2bf9b1=Object[_0x1ac3('0x4')](_0xbe22b7)[0x0];var _0x157604=_0xbe22b7[_0x2bf9b1];return{['$'+_0x2bf9b1]:_0x157604};}exports['fields']=function(_0x2d17de){var _0x4d7695=null;if(_0x2d17de){_0x4d7695=_0x2d17de[_0x1ac3('0x6')](',');}return _0x4d7695;};exports[_0x1ac3('0x7')]=function(_0x344674,_0x53500b){var _0xa26c88={};if(!_[_0x1ac3('0x8')](_0x344674)){_[_0x1ac3('0x9')](_0x344674,function(_0x24f0d2,_0x2a8dc7){try{if(_0x53500b){var _0x422d19=_['find'](_0x53500b,{'name':_0x2a8dc7})||{};if(hasSequelizeOperator(_0x24f0d2)){_0xa26c88[_0x2a8dc7]=getOperatorValue(_0x24f0d2);}else if(_0x422d19[_0x1ac3('0xa')]===_0x1ac3('0xb')&&_[_0x1ac3('0xc')](_0x24f0d2)){var _0x2338b9=JSON['parse'](_0x24f0d2);var _0x88ed7c={'$gte':moment(moment(_0x2338b9[_0x1ac3('0xd')])[_0x1ac3('0xe')](_0x1ac3('0xf')))['utc']()[_0x1ac3('0xe')](),'$lte':moment(moment(_0x2338b9[_0x1ac3('0x10')])['format'](_0x1ac3('0xf')))[_0x1ac3('0x11')]()[_0x1ac3('0x12')](0x1,'s')['format']()};_0xa26c88[_0x2a8dc7]=_0x88ed7c;}else if(_0x422d19[_0x1ac3('0x13')]===_0x1ac3('0x14')){_0xa26c88[_0x2a8dc7]=_0x24f0d2;}else{_0xa26c88[_0x2a8dc7]=_[_0x1ac3('0x15')](_0x24f0d2)?_0x24f0d2:JSON['parse'](_0x24f0d2);}}else{_0xa26c88[_0x2a8dc7]=_[_0x1ac3('0x15')](_0x24f0d2)?_0x24f0d2:JSON['parse'](_0x24f0d2);}}catch(_0x291616){_0xa26c88[_0x2a8dc7]=_0x24f0d2[_0x1ac3('0x6')](',');}});}return _0xa26c88;};exports[_0x1ac3('0x16')]=function(_0x3b7e51){_0x3b7e51=parseInt(_0x3b7e51,0xa);if(!_0x3b7e51||_0x3b7e51<0x0){_0x3b7e51=LIMIT_VALUE;}return _0x3b7e51;};exports[_0x1ac3('0x17')]=function(_0x557076){_0x557076=parseInt(_0x557076,0xa);if(!_0x557076||_0x557076<0x0){_0x557076=0x0;}return _0x557076;};exports[_0x1ac3('0x18')]=function(_0x2ea481){var _0x296abf,_0x257f60=null;if(_0x2ea481){_0x296abf=_0x2ea481['split'](',');_0x257f60=_['map'](_0x296abf,function(_0x2879d8){if(_0x2879d8[_0x1ac3('0x19')]('-')===0x0){return[_0x2879d8===_0x1ac3('0x1a')?sequelize[_0x1ac3('0x1b')](sequelize[_0x1ac3('0x1c')](_0x1ac3('0x1a')),_0x1ac3('0x1d')):_0x2879d8[_0x1ac3('0x1e')](0x1),_0x1ac3('0x1f')];}else{return[_0x2879d8==='priority'?sequelize[_0x1ac3('0x1b')](sequelize[_0x1ac3('0x1c')]('priority'),_0x1ac3('0x1d')):_0x2879d8,_0x1ac3('0x20')];}});}return _0x257f60;};exports['omit']=function(_0xf9affb,_0x2f65e8){if(_[_0x1ac3('0x8')](_0xf9affb)){return _0xf9affb;}if(_[_0x1ac3('0x15')](_0xf9affb)){for(var _0x10db3d=0x0;_0x10db3d<_0xf9affb['length'];_0x10db3d+=0x1){_0xf9affb[_0x10db3d]=this['omit'](_0xf9affb[_0x10db3d],_0x2f65e8);}return _0xf9affb;}if(!_['isObject'](_0xf9affb)){return _0xf9affb;}if(_['isString'](_0x2f65e8)){_0x2f65e8=[_0x2f65e8];}if(!_['isArray'](_0x2f65e8)){return _0xf9affb;}for(var _0x3ea482=0x0;_0x3ea482<_0x2f65e8['length'];_0x3ea482+=0x1){_[_0x1ac3('0x21')](_0xf9affb,_0x2f65e8[_0x3ea482]);}for(var _0x3e4a4e in _0xf9affb){if(_0xf9affb[_0x1ac3('0x22')](_0x3e4a4e)){_0xf9affb[_0x3e4a4e]=this[_0x1ac3('0x23')](_0xf9affb[_0x3e4a4e],_0x2f65e8);}}return _0xf9affb;};exports['isNumeric']=function(_0x61441d){return _0x61441d['match'](RegExp(_0x1ac3('0x24')))?!![]:![];};exports[_0x1ac3('0x25')]=function(_0x440aed){return _0x440aed[_0x1ac3('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x1ac3('0x27')]=function(_0xc3f097){var _0x9c17c2=[];_0xc3f097['split'](/[ ,]+/)[_0x1ac3('0x28')](function(_0x3b4c65){_0x3b4c65=_0x3b4c65[_0x1ac3('0x29')](/([^:]")"+/g,'$1');_0x3b4c65='+'+_0x3b4c65+'*';var _0x47437c=/[ `!@#$%^&*()_\-?~]/;if(_0x3b4c65['match'](_0x47437c))_0x3b4c65='\x22'+_0x3b4c65+'\x22';_0x9c17c2[_0x1ac3('0x2a')](_0x3b4c65);});return _0x9c17c2[_0x1ac3('0x2b')]('\x20');};exports[_0x1ac3('0x2c')]=function(_0x294513,_0x204d78,_0x479b42){var _0xbeed18={},_0x760b65={};if(_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x2e')]){_0x204d78[_0x1ac3('0x2d')]['id']=_0x204d78[_0x1ac3('0x2d')]['$id'];delete _0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x2e')];}_0xbeed18[_0x1ac3('0x2f')]=_[_0x1ac3('0x30')](_0x294513,'name');_0xbeed18[_0x1ac3('0x2d')]=_[_0x1ac3('0x4')](_0x204d78[_0x1ac3('0x2d')]);_0xbeed18[_0x1ac3('0x7')]=_[_0x1ac3('0x31')](_0xbeed18[_0x1ac3('0x2f')],_0xbeed18[_0x1ac3('0x2d')]);_0x760b65[_0x1ac3('0x32')]=_[_0x1ac3('0x31')](_0xbeed18['model'],this[_0x1ac3('0x33')](_0x204d78[_0x1ac3('0x2d')]['fields']));_0x760b65[_0x1ac3('0x32')]=_0x760b65[_0x1ac3('0x32')][_0x1ac3('0x34')]?_0x760b65[_0x1ac3('0x32')]:_0xbeed18[_0x1ac3('0x2f')];if(!_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x22')](_0x1ac3('0x35'))){_0x760b65['limit']=this[_0x1ac3('0x16')](_0x204d78['query'][_0x1ac3('0x16')]);_0x760b65[_0x1ac3('0x17')]=this[_0x1ac3('0x17')](_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x17')]);}_0x760b65[_0x1ac3('0x36')]=this['sort'](_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x18')]);_0x760b65[_0x1ac3('0x37')]=this['filters'](_[_0x1ac3('0x38')](_0x204d78[_0x1ac3('0x2d')],_0xbeed18['filters']),_0x294513);if(_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x39')]){var _0xb4664e=_0x294513;var _0x1b0099=_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x39')];if(typeof _0x1b0099===_0x1ac3('0x3a')){_0xb4664e=_[_0x1ac3('0x39')](_0x294513,function(_0x48a0a2){return _[_0x1ac3('0x5')](_0x1b0099[_0x1ac3('0x3b')],_0x48a0a2[_0x1ac3('0x13')]);});_0x1b0099=_0x1b0099[_0x1ac3('0x3c')];}_0x760b65[_0x1ac3('0x37')]=_[_0x1ac3('0x3d')](_0x760b65[_0x1ac3('0x37')],{'$or':_['map'](_0xb4664e,function(_0x4edc4d){if(_0x4edc4d[_0x1ac3('0xa')]!==_0x1ac3('0x3e')){if(_0x479b42){return sequelize['where'](sequelize['fn'](_0x1ac3('0x3f'),sequelize[_0x1ac3('0x1c')](_0x4edc4d['name'])),{'$like':sequelize['fn'](_0x1ac3('0x3f'),'%'+_0x204d78['query'][_0x1ac3('0x39')]+'%')});}else{var _0x406f0d={};_0x406f0d[_0x4edc4d[_0x1ac3('0x13')]]={'$like':'%'+_0x204d78[_0x1ac3('0x2d')]['filter']+'%'};return _0x406f0d;}}})});}_0x760b65=_[_0x1ac3('0x3d')]({},_0x760b65,_0x204d78[_0x1ac3('0x40')]);return _0x760b65;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 2f5ad6a..654dd51 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 _0x90e1=['every','length','idle','unknown','unavailable','voiceStatus','voicePause','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','*pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','uniq','value','getAgentIdsByQueues','filter','includes','busy','getAgentIdsByStatus','resolve','findAll','fullname','pauseType','globalStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','openchannelPause','chatCapacity','openchannelCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','whatsappPause'];(function(_0x1b3a5c,_0x2f9d5f){var _0x2ae8cb=function(_0x549ab8){while(--_0x549ab8){_0x1b3a5c['push'](_0x1b3a5c['shift']());}};_0x2ae8cb(++_0x2f9d5f);}(_0x90e1,0x1c2));var _0x190e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x90e1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x190e('0x0'));var jayson=require(_0x190e('0x1'));var db=require(_0x190e('0x2'))['db'];var amiClient=jayson[_0x190e('0x3')][_0x190e('0x4')]({'port':0x232a});var routingClient=jayson[_0x190e('0x3')][_0x190e('0x4')]({'port':0x232c});function isAgentPaused(_0x9d40c3,_0x28cafb){var _0x83fb06=[_0x9d40c3[_0x190e('0x5')],_0x9d40c3[_0x190e('0x6')],_0x9d40c3[_0x190e('0x7')],_0x9d40c3['openchannelPause'],_0x9d40c3[_0x190e('0x8')],_0x9d40c3['voicePause'],_0x9d40c3[_0x190e('0x9')]];if(!_0x28cafb)return _[_0x190e('0xa')](_0x83fb06);var _0x1f0e4c=_['filter'](_0x83fb06);return _0x1f0e4c[_0x190e('0xb')]>0x0&&_0x1f0e4c[_0x190e('0xb')]<_0x83fb06['length']?!![]:![];}function isIdle(_0x20d6f6){return _0x20d6f6===_0x190e('0xc')||_0x20d6f6===_0x190e('0xd')||_0x20d6f6===_0x190e('0xe')||_0x20d6f6==='ringing'||_['isNil'](_0x20d6f6);}function isAgentIdle(_0xb1ae0d){if(_0xb1ae0d[_0x190e('0xf')]!==_0x190e('0xc')&&_0xb1ae0d[_0x190e('0x10')]){_0xb1ae0d['voiceStatus']=_0x190e('0x11');return![];}return _[_0x190e('0xa')]([_0xb1ae0d[_0x190e('0x12')],_0xb1ae0d[_0x190e('0x13')],_0xb1ae0d['mailStatus'],_0xb1ae0d[_0x190e('0x14')],_0xb1ae0d[_0x190e('0x15')],_0xb1ae0d['voiceStatus'],_0xb1ae0d[_0x190e('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x190e('0x17'),{})[_0x190e('0x18')](function(_0x447bf2){if(_0x447bf2[_0x190e('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x24a4b6=_0x447bf2[_0x190e('0x1a')];return routingClient['request'](_0x190e('0x17'),{})[_0x190e('0x18')](function(_0x57fb3c){if(_0x57fb3c[_0x190e('0x19')]){throw new Error(_0x190e('0x1b'));}var _0x318fb3=_0x57fb3c[_0x190e('0x1a')];return _[_0x190e('0x1c')]({},_0x24a4b6,_0x318fb3);});})[_0x190e('0x1d')](function(_0x2f4333){throw _0x2f4333;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x4a6ceb){var _0x2afe8c='unknown';if(isAgentPaused(_0x4a6ceb))_0x2afe8c=_0x190e('0x11');else if(isAgentPaused(_0x4a6ceb,!![]))_0x2afe8c=_0x190e('0x1e');else if(isAgentIdle(_0x4a6ceb))_0x2afe8c=_0x190e('0xc');else _0x2afe8c='busy';return _0x2afe8c;}exports[_0x190e('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x51149f,_0x100c38){var _0xb3534a=_[_0x190e('0x20')](_0x51149f)?_0x51149f:[_0x51149f];var _0x38d96b=_[_0x190e('0x21')](_0x100c38)+_0x190e('0x22');var _0x1e8eba=_[_0x190e('0x23')](_0xb3534a,function(_0x46de73){return db[_0x38d96b][_0x190e('0x24')]({'where':{'id':_0x46de73}})[_0x190e('0x18')](function(_0x35f5d1){if(!_0x35f5d1)return[];return _0x35f5d1[_0x190e('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x190e('0x26')](_0x1e8eba)[_0x190e('0x18')](function(_0x1e19f0){var _0x4e3262=_(_0x1e19f0)['flatten']()[_0x190e('0x23')]('id')[_0x190e('0x27')]()[_0x190e('0x28')]();return _0x4e3262;});}exports[_0x190e('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x445bd7,_0x25f1de,_0x576be2){try{if(_0x25f1de['length']>0x0){_0x445bd7=_0x445bd7[_0x190e('0x2a')](function(_0x5e462c){return _0x25f1de[_0x190e('0x2b')](_0x5e462c['id']);});}var _0x59d9d9=_0x445bd7[_0x190e('0x2a')](function(_0x520c16){var _0x10e516=_0x190e('0x2c');if(isAgentIdle(_0x520c16)){_0x10e516='idle';}return _0x10e516===_0x576be2;});return _[_0x190e('0x23')](_0x59d9d9,'id');}catch(_0xade915){throw _0xade915;}}exports[_0x190e('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x23ea94,_0x249806,_0x5eb90e){return Promise[_0x190e('0x2e')]()[_0x190e('0x18')](function(){if(_0x249806['length']>0x0){_0x23ea94=_0x23ea94['filter'](function(_0x45c5ad){return _0x249806[_0x190e('0x2b')](_0x45c5ad['id']);});}return _0x23ea94;})['then'](function(){return db['User'][_0x190e('0x2f')]({'attributes':['id','name',_0x190e('0x30'),_0x190e('0x5'),_0x190e('0x6'),_0x190e('0x7'),'openchannelPause',_0x190e('0x8'),'voicePause',_0x190e('0x9'),_0x190e('0x31')],'where':{'id':{'$in':_[_0x190e('0x23')](_0x23ea94,'id')}},'raw':!![]});})[_0x190e('0x18')](function(_0x26ffa7){return _0x26ffa7[_0x190e('0x23')](function(_0x58fe54){var _0x1173d1=_['find'](_0x23ea94,['id',_0x58fe54['id']]);var _0x513fd7=filterAgentAttributes(_0x1173d1);_[_0x190e('0x1c')](_0x58fe54,_0x513fd7);_0x58fe54[_0x190e('0x32')]=getAgentStatus(_0x58fe54);return _0x58fe54;});})[_0x190e('0x18')](function(_0x228823){var _0x112559=sortAgentsByStatus(_0x228823,_0x5eb90e);return _[_0x190e('0x23')](_0x112559,'id');})[_0x190e('0x1d')](function(_0x1b41dc){throw _0x1b41dc;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x60fa9b){var _0x2e37fa={'fields':[],'order':null};var _0x3def38=_0x60fa9b[_0x190e('0x33')](',');_0x2e37fa[_0x190e('0x34')]=_[_0x190e('0x2a')](_0x3def38,function(_0xd62fee){if(!_0xd62fee[_0x190e('0x2b')](_0x190e('0x32'))){return!![];}_0x2e37fa[_0x190e('0x35')]=_[_0x190e('0x36')](_0xd62fee,'-')?_0x190e('0x37'):_0x190e('0x38');return![];});return _0x2e37fa;}exports[_0x190e('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x226d72){if(_0x226d72[_0x190e('0x2b')]('fullname')&&!_0x226d72[_0x190e('0x2b')](_0x190e('0x3a'))){var _0x16142b=_0x226d72[_0x190e('0x3b')](0x0,_0x226d72['indexOf'](_0x190e('0x30')));_0x226d72+=','+_0x16142b+_0x190e('0x3a');}return _0x226d72;}exports[_0x190e('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0xca9ef3,_0x21dc7a){var _0x175faa=_0xca9ef3[_0x190e('0x3d')](function(_0x2cd5d3,_0x26f9d1){if(_0x2cd5d3[_0x190e('0x32')]===_0x26f9d1[_0x190e('0x32')]){if(_0x2cd5d3['globalStatus']===_0x190e('0x11')){if(_0x21dc7a==='DESC'){return(_0x2cd5d3['pauseType']||'')<(_0x26f9d1['pauseType']||'')||_0x2cd5d3[_0x190e('0x30')][_0x190e('0x3e')]()>_0x26f9d1['fullname'][_0x190e('0x3e')]()?0x1:-0x1;}else{return(_0x2cd5d3['pauseType']||'')<(_0x26f9d1[_0x190e('0x31')]||'')||_0x2cd5d3[_0x190e('0x30')][_0x190e('0x3e')]()>_0x26f9d1[_0x190e('0x30')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x21dc7a===_0x190e('0x37')){return _0x2cd5d3['fullname'][_0x190e('0x3e')]()<_0x26f9d1[_0x190e('0x30')][_0x190e('0x3e')]()?0x1:-0x1;}else{return _0x2cd5d3[_0x190e('0x30')]['toLowerCase']()<_0x26f9d1[_0x190e('0x30')][_0x190e('0x3e')]()?-0x1:0x1;}}}else{if(_0x21dc7a===_0x190e('0x37')){return _0x2cd5d3['globalStatus']<_0x26f9d1[_0x190e('0x32')]?0x1:-0x1;}else{return _0x2cd5d3[_0x190e('0x32')]<_0x26f9d1[_0x190e('0x32')]?-0x1:0x1;}}});return _0x175faa;}exports[_0x190e('0x3f')]=sortAgentsByStatus;function filterAgentAttributes(_0x23879e){var _0x3bbb27=[_0x190e('0x40'),'online',_0x190e('0x41'),_0x190e('0x42'),_0x190e('0x31'),_0x190e('0x42'),_0x190e('0x3a'),_0x190e('0x43'),_0x190e('0x5'),_0x190e('0x44'),_0x190e('0x7'),_0x190e('0x8'),_0x190e('0x9'),'faxPause',_0x190e('0x10'),_0x190e('0x45'),_0x190e('0x46'),'mailCapacity','smsCapacity',_0x190e('0x47'),_0x190e('0x48'),'chatCurrentCapacity',_0x190e('0x49'),_0x190e('0x4a'),_0x190e('0x4b'),'whatsappCurrentCapacity','faxCurrentCapacity',_0x190e('0x12'),'openchannelStatus',_0x190e('0x4c'),_0x190e('0x15'),_0x190e('0x16'),'faxStatus',_0x190e('0xf'),_0x190e('0x4d'),_0x190e('0x4e'),_0x190e('0x4f'),'smsStatusTime',_0x190e('0x50'),_0x190e('0x51'),_0x190e('0x52'),_0x190e('0x53'),_0x190e('0x54'),_0x190e('0x55'),_0x190e('0x56'),_0x190e('0x57'),_0x190e('0x58')];var _0x475a46=[_0x190e('0x5'),'openchannelPause',_0x190e('0x7'),_0x190e('0x8'),_0x190e('0x9'),_0x190e('0x6'),'voicePause','online'];var _0x475a4a=_(_0x23879e)[_0x190e('0x59')](_0x475a46)[_0x190e('0x5a')](_0x3bbb27)[_0x190e('0x28')]();return _0x475a4a;}exports[_0x190e('0x5b')]=filterAgentAttributes; \ No newline at end of file +var _0x087b=['mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','lodash','jayson/promise','../../mysqldb','client','http','chatPause','mailPause','openchannelPause','whatsappPause','length','idle','unknown','ringing','voicePause','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','voiceStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','then','getAgents','flatten','uniq','value','filter','includes','getAgentIdsByStatus','resolve','findAll','fullname','faxPause','smsPause','pauseType','find','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','DESC','ASC','getUpdatedSortOptions','internal','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','online','lastPauseAt','openchannelCapacity'];(function(_0x846f06,_0x4b9509){var _0x20a953=function(_0x419d22){while(--_0x419d22){_0x846f06['push'](_0x846f06['shift']());}};_0x20a953(++_0x4b9509);}(_0x087b,0x167));var _0xb087=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x087b[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xb087('0x0'));var jayson=require(_0xb087('0x1'));var db=require(_0xb087('0x2'))['db'];var amiClient=jayson[_0xb087('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xb087('0x3')][_0xb087('0x4')]({'port':0x232c});function isAgentPaused(_0x469891,_0x2e8eea){var _0x95d09d=[_0x469891[_0xb087('0x5')],_0x469891['faxPause'],_0x469891[_0xb087('0x6')],_0x469891[_0xb087('0x7')],_0x469891['smsPause'],_0x469891['voicePause'],_0x469891[_0xb087('0x8')]];if(!_0x2e8eea)return _['every'](_0x95d09d);var _0x346988=_['filter'](_0x95d09d);return _0x346988[_0xb087('0x9')]>0x0&&_0x346988[_0xb087('0x9')]<_0x95d09d['length']?!![]:![];}function isIdle(_0x430ad3){return _0x430ad3===_0xb087('0xa')||_0x430ad3===_0xb087('0xb')||_0x430ad3==='unavailable'||_0x430ad3===_0xb087('0xc')||_['isNil'](_0x430ad3);}function isAgentIdle(_0x402036){if(_0x402036['voiceStatus']!==_0xb087('0xa')&&_0x402036[_0xb087('0xd')]){_0x402036['voiceStatus']=_0xb087('0xe');return![];}return _[_0xb087('0xf')]([_0x402036[_0xb087('0x10')],_0x402036[_0xb087('0x11')],_0x402036[_0xb087('0x12')],_0x402036[_0xb087('0x13')],_0x402036[_0xb087('0x14')],_0x402036[_0xb087('0x15')],_0x402036[_0xb087('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xb087('0x17')](_0xb087('0x18'),{})['then'](function(_0x1e07dd){if(_0x1e07dd[_0xb087('0x19')]){throw new Error(_0xb087('0x1a'));}var _0x2ffb06=_0x1e07dd[_0xb087('0x1b')];return routingClient['request']('Agents',{})['then'](function(_0x2f6de7){if(_0x2f6de7[_0xb087('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x5d97ba=_0x2f6de7[_0xb087('0x1b')];return _[_0xb087('0x1c')]({},_0x2ffb06,_0x5d97ba);});})[_0xb087('0x1d')](function(_0x326b3c){throw _0x326b3c;});}exports[_0xb087('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x3ec487){var _0x161675=_0xb087('0xb');if(isAgentPaused(_0x3ec487))_0x161675='pause';else if(isAgentPaused(_0x3ec487,!![]))_0x161675=_0xb087('0x1f');else if(isAgentIdle(_0x3ec487))_0x161675=_0xb087('0xa');else _0x161675=_0xb087('0x20');return _0x161675;}exports[_0xb087('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x1125c0,_0x2fc20d){var _0x1ee210=_[_0xb087('0x22')](_0x1125c0)?_0x1125c0:[_0x1125c0];var _0x5998f9=_[_0xb087('0x23')](_0x2fc20d)+_0xb087('0x24');var _0x7c0f44=_[_0xb087('0x25')](_0x1ee210,function(_0x190a84){return db[_0x5998f9][_0xb087('0x26')]({'where':{'id':_0x190a84}})[_0xb087('0x27')](function(_0x586449){if(!_0x586449)return[];return _0x586449[_0xb087('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x7c0f44)[_0xb087('0x27')](function(_0x87297){var _0x42d898=_(_0x87297)[_0xb087('0x29')]()[_0xb087('0x25')]('id')[_0xb087('0x2a')]()[_0xb087('0x2b')]();return _0x42d898;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x58224f,_0x2479d4,_0x29b7fb){try{if(_0x2479d4['length']>0x0){_0x58224f=_0x58224f[_0xb087('0x2c')](function(_0x1ef1b4){return _0x2479d4[_0xb087('0x2d')](_0x1ef1b4['id']);});}var _0x2af00c=_0x58224f[_0xb087('0x2c')](function(_0x1e5e87){var _0x5a16ae=_0xb087('0x20');if(isAgentIdle(_0x1e5e87)){_0x5a16ae=_0xb087('0xa');}return _0x5a16ae===_0x29b7fb;});return _[_0xb087('0x25')](_0x2af00c,'id');}catch(_0x5604cf){throw _0x5604cf;}}exports[_0xb087('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2ab60d,_0x5cf563,_0x782e07){return Promise[_0xb087('0x2f')]()[_0xb087('0x27')](function(){if(_0x5cf563[_0xb087('0x9')]>0x0){_0x2ab60d=_0x2ab60d[_0xb087('0x2c')](function(_0x2bdc8a){return _0x5cf563['includes'](_0x2bdc8a['id']);});}return _0x2ab60d;})['then'](function(){return db['User'][_0xb087('0x30')]({'attributes':['id','name',_0xb087('0x31'),_0xb087('0x5'),_0xb087('0x32'),_0xb087('0x6'),'openchannelPause',_0xb087('0x33'),_0xb087('0xd'),_0xb087('0x8'),_0xb087('0x34')],'where':{'id':{'$in':_[_0xb087('0x25')](_0x2ab60d,'id')}},'raw':!![]});})[_0xb087('0x27')](function(_0x2390a0){return _0x2390a0[_0xb087('0x25')](function(_0x3eb953){var _0x584f2d=_[_0xb087('0x35')](_0x2ab60d,['id',_0x3eb953['id']]);var _0x1537ff=filterAgentAttributes(_0x584f2d);_['merge'](_0x3eb953,_0x1537ff);_0x3eb953['globalStatus']=getAgentStatus(_0x3eb953);return _0x3eb953;});})['then'](function(_0x6fb7ec){var _0x1bb2d8=sortAgentsByStatus(_0x6fb7ec,_0x782e07);return _[_0xb087('0x25')](_0x1bb2d8,'id');})[_0xb087('0x1d')](function(_0x4b4c4c){throw _0x4b4c4c;});}exports[_0xb087('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x7e32e1){var _0x50b304={'fields':[],'order':null};var _0x491a2b=_0x7e32e1[_0xb087('0x37')](',');_0x50b304[_0xb087('0x38')]=_['filter'](_0x491a2b,function(_0x156e19){if(!_0x156e19[_0xb087('0x2d')](_0xb087('0x39'))){return!![];}_0x50b304[_0xb087('0x3a')]=_['startsWith'](_0x156e19,'-')?_0xb087('0x3b'):_0xb087('0x3c');return![];});return _0x50b304;}exports[_0xb087('0x3d')]=getUpdatedSortOptions;function validateSortParameter(_0x4b15bc){if(_0x4b15bc[_0xb087('0x2d')](_0xb087('0x31'))&&!_0x4b15bc['includes'](_0xb087('0x3e'))){var _0x2ae84e=_0x4b15bc['substring'](0x0,_0x4b15bc[_0xb087('0x3f')](_0xb087('0x31')));_0x4b15bc+=','+_0x2ae84e+_0xb087('0x3e');}return _0x4b15bc;}exports[_0xb087('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x3e034f,_0x4322dc){var _0x496af9=_0x3e034f[_0xb087('0x41')](function(_0x1b6f59,_0x59c369){if(_0x1b6f59[_0xb087('0x39')]===_0x59c369[_0xb087('0x39')]){if(_0x1b6f59[_0xb087('0x39')]==='pause'){if(_0x4322dc===_0xb087('0x3b')){return(_0x1b6f59[_0xb087('0x34')]||'')<(_0x59c369['pauseType']||'')||_0x1b6f59[_0xb087('0x31')]['toLowerCase']()>_0x59c369[_0xb087('0x31')][_0xb087('0x42')]()?0x1:-0x1;}else{return(_0x1b6f59[_0xb087('0x34')]||'')<(_0x59c369[_0xb087('0x34')]||'')||_0x1b6f59['fullname'][_0xb087('0x42')]()>_0x59c369[_0xb087('0x31')][_0xb087('0x42')]()?-0x1:0x1;}}else{if(_0x4322dc===_0xb087('0x3b')){return _0x1b6f59[_0xb087('0x31')][_0xb087('0x42')]()<_0x59c369[_0xb087('0x31')]['toLowerCase']()?0x1:-0x1;}else{return _0x1b6f59[_0xb087('0x31')][_0xb087('0x42')]()<_0x59c369[_0xb087('0x31')][_0xb087('0x42')]()?-0x1:0x1;}}}else{if(_0x4322dc===_0xb087('0x3b')){return _0x1b6f59[_0xb087('0x39')]<_0x59c369[_0xb087('0x39')]?0x1:-0x1;}else{return _0x1b6f59[_0xb087('0x39')]<_0x59c369[_0xb087('0x39')]?-0x1:0x1;}}});return _0x496af9;}exports[_0xb087('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x145962){var _0x2eaaee=['userpic',_0xb087('0x44'),'lastLoginAt',_0xb087('0x45'),_0xb087('0x34'),_0xb087('0x45'),_0xb087('0x3e'),'address',_0xb087('0x5'),'openchannelPause',_0xb087('0x6'),_0xb087('0x33'),'whatsappPause',_0xb087('0x32'),'voicePause','chatCapacity',_0xb087('0x46'),_0xb087('0x47'),_0xb087('0x48'),_0xb087('0x49'),'faxCapacity','chatCurrentCapacity',_0xb087('0x4a'),_0xb087('0x4b'),'smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity',_0xb087('0x10'),'openchannelStatus',_0xb087('0x12'),'smsStatus','whatsappStatus','faxStatus',_0xb087('0x15'),_0xb087('0x4c'),_0xb087('0x4d'),'mailStatusTime',_0xb087('0x4e'),_0xb087('0x4f'),'faxStatusTime',_0xb087('0x50'),_0xb087('0x51'),'destconnectedlinenum',_0xb087('0x52'),'phoneBarEnableScreenRecordingByAgent',_0xb087('0x53'),'routealias'];var _0xb199de=[_0xb087('0x5'),_0xb087('0x7'),_0xb087('0x6'),_0xb087('0x33'),'whatsappPause','faxPause',_0xb087('0xd'),_0xb087('0x44')];var _0x5eb38b=_(_0x145962)[_0xb087('0x54')](_0xb199de)[_0xb087('0x55')](_0x2eaaee)[_0xb087('0x2b')]();return _0x5eb38b;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 0f0c8bd..bed17b7 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 _0x42ec=['map','get','loggedInDb','find','lodash','jayson/promise','util','client','available','loggedIn','paused','waiting','busy','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound'];(function(_0xf4add4,_0x5b9cc1){var _0x1c42fb=function(_0x2674c1){while(--_0x2674c1){_0xf4add4['push'](_0xf4add4['shift']());}};_0x1c42fb(++_0x5b9cc1);}(_0x42ec,0x169));var _0xc42e=function(_0x38c9b0,_0x11b555){_0x38c9b0=_0x38c9b0-0x0;var _0x306434=_0x42ec[_0x38c9b0];return _0x306434;};'use strict';var _=require(_0xc42e('0x0'));var jayson=require(_0xc42e('0x1'));var util=require(_0xc42e('0x2'));var amiClient=jayson[_0xc42e('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xc42e('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xc42e('0x4'),_0xc42e('0x5'),_0xc42e('0x6'),_0xc42e('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xc42e('0x8'),_0xc42e('0x9'),_0xc42e('0xa'),'loggedInDb',_0xc42e('0xb'),_0xc42e('0xc'),_0xc42e('0xd'),_0xc42e('0xe'),_0xc42e('0xf'),_0xc42e('0x10'),_0xc42e('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xc42e('0x12'),_0xc42e('0x13'),_0xc42e('0x14'),_0xc42e('0x15'),_0xc42e('0x16'),_0xc42e('0x17'),_0xc42e('0x18'),'startPredictive',_0xc42e('0x19'),_0xc42e('0x1a'),'erlangCallToSecond',_0xc42e('0x1b'),'erlangBusyFactor',_0xc42e('0x1c'),_0xc42e('0x1d'),_0xc42e('0x1e'),_0xc42e('0x1f'),_0xc42e('0x20'),_0xc42e('0x21'),_0xc42e('0x22'),'predictiveIntervalDroppedCallsCallersExit',_0xc42e('0x23'),_0xc42e('0x24')];function getRealtimeQueues(_0x1058d6,_0x218801){var _0x4a1e16=_0x218801===_0xc42e('0x25')?amiClient:routingClient;return _0x4a1e16['request'](_[_0xc42e('0x26')](_0x218801)+_0xc42e('0x27'),_0x1058d6)[_0xc42e('0x28')](function(_0x5033f2){if(_0x5033f2['error'])throw new Error(util['format'](_0xc42e('0x29'),_0x218801));return _0x5033f2[_0xc42e('0x2a')];})[_0xc42e('0x2b')](function(_0x3aa15e){throw _0x3aa15e;});}exports[_0xc42e('0x2c')]=getRealtimeQueues;function initializeQueues(_0x182220,_0x1884de,_0x4d7c9e,_0x137b32){var _0xfb761f=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4d7c9e===_0xc42e('0x25')){if(_0x137b32==='inbound'){_0xfb761f=_0xfb761f[_0xc42e('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x137b32===_0xc42e('0x2e')){_0xfb761f=_0xfb761f[_0xc42e('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x182220[_0xc42e('0x2f')](function(_0x4240d9){var _0x469375=_0x4240d9[_0xc42e('0x30')]({'plain':!![]});_0x469375[_0xc42e('0x6')]=0x0;_0x469375[_0xc42e('0x31')]=0x0;_0x469375[_0xc42e('0x5')]=0x0;_0x469375[_0xc42e('0x4')]=0x0;_0x469375['waiting']=0x0;if(_0x4d7c9e===_0xc42e('0x25')){_0x469375[_0xc42e('0xf')]=0x0;_0x469375[_0xc42e('0x8')]=0x0;if(_0x137b32===_0xc42e('0x2e')){_0x469375[_0xc42e('0x12')]=0x0;_0x469375['originated']=0x0;}}var _0x4dae48=_[_0xc42e('0x32')](_0x1884de,['id',_0x469375['id']]);if(_0x4dae48){_['merge'](_0x469375,_['pick'](_0x4dae48,_0xfb761f));}return _0x469375;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x8d82=['catch','getRealtimeQueues','inbound','concat','outbound','map','get','waiting','originated','find','merge','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unknown','pTalking','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0x8d82,0xb4));var _0x28d8=function(_0x11918a,_0x3af520){_0x11918a=_0x11918a-0x0;var _0xcd30eb=_0x8d82[_0x11918a];return _0xcd30eb;};'use strict';var _=require(_0x28d8('0x0'));var jayson=require(_0x28d8('0x1'));var util=require(_0x28d8('0x2'));var amiClient=jayson[_0x28d8('0x3')][_0x28d8('0x4')]({'port':0x232a});var routingClient=jayson[_0x28d8('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x28d8('0x5'),_0x28d8('0x6'),_0x28d8('0x7'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x28d8('0x8'),_0x28d8('0x9'),_0x28d8('0xa'),_0x28d8('0xb'),'notInUse',_0x28d8('0xc'),_0x28d8('0xd'),_0x28d8('0xe'),_0x28d8('0xf'),'unavailable',_0x28d8('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x28d8('0x11'),'originated',_0x28d8('0x12'),'statusMessage',_0x28d8('0x13'),_0x28d8('0x14'),_0x28d8('0x15'),_0x28d8('0x16'),_0x28d8('0x17'),_0x28d8('0x18'),_0x28d8('0x19'),_0x28d8('0x1a'),_0x28d8('0x1b'),_0x28d8('0x1c'),_0x28d8('0x1d'),'dialPredictiveIntervalMinThreshold',_0x28d8('0x1e'),_0x28d8('0x1f'),_0x28d8('0x20'),_0x28d8('0x21'),_0x28d8('0x22'),'predictiveIntervalAvgHoldtime',_0x28d8('0x23')];function getRealtimeQueues(_0x2f2c6e,_0x2c4e9){var _0x147614=_0x2c4e9===_0x28d8('0x24')?amiClient:routingClient;return _0x147614[_0x28d8('0x25')](_[_0x28d8('0x26')](_0x2c4e9)+_0x28d8('0x27'),_0x2f2c6e)[_0x28d8('0x28')](function(_0x3da300){if(_0x3da300[_0x28d8('0x29')])throw new Error(util[_0x28d8('0x2a')](_0x28d8('0x2b'),_0x2c4e9));return _0x3da300['result'];})[_0x28d8('0x2c')](function(_0x4d5bb4){throw _0x4d5bb4;});}exports[_0x28d8('0x2d')]=getRealtimeQueues;function initializeQueues(_0x3c07db,_0x3bab27,_0x34c968,_0x47c651){var _0x1a2561=DEFAULT_QUEUE_ATTRIBUTES;if(_0x34c968===_0x28d8('0x24')){if(_0x47c651===_0x28d8('0x2e')){_0x1a2561=_0x1a2561[_0x28d8('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x47c651===_0x28d8('0x30')){_0x1a2561=_0x1a2561['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3c07db[_0x28d8('0x31')](function(_0x200ccd){var _0x2ee96d=_0x200ccd[_0x28d8('0x32')]({'plain':!![]});_0x2ee96d[_0x28d8('0x7')]=0x0;_0x2ee96d[_0x28d8('0xb')]=0x0;_0x2ee96d[_0x28d8('0x6')]=0x0;_0x2ee96d[_0x28d8('0x5')]=0x0;_0x2ee96d[_0x28d8('0x33')]=0x0;if(_0x34c968===_0x28d8('0x24')){_0x2ee96d[_0x28d8('0xf')]=0x0;_0x2ee96d['busy']=0x0;if(_0x47c651===_0x28d8('0x30')){_0x2ee96d[_0x28d8('0x11')]=0x0;_0x2ee96d[_0x28d8('0x34')]=0x0;}}var _0x5353a0=_[_0x28d8('0x35')](_0x3bab27,['id',_0x2ee96d['id']]);if(_0x5353a0){_[_0x28d8('0x36')](_0x2ee96d,_['pick'](_0x5353a0,_0x1a2561));}return _0x2ee96d;});}exports[_0x28d8('0x37')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 703b144..5de7d4b 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(_0x2ed88f,_0x5bc5ae){var _0x17ca96=function(_0x2be0dc){while(--_0x2be0dc){_0x2ed88f['push'](_0x2ed88f['shift']());}};_0x17ca96(++_0x5bc5ae);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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(_0x544ec1,_0x2814eb){var _0x31e735=function(_0x45f226){while(--_0x45f226){_0x544ec1['push'](_0x544ec1['shift']());}};_0x31e735(++_0x2814eb);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 f0d8352..b3232af 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 _0x1966=['family','internal','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','../environment','orderBy','keys','length','filter'];(function(_0x501e6d,_0x43ce8e){var _0x545ff9=function(_0x5e0bf2){while(--_0x5e0bf2){_0x501e6d['push'](_0x501e6d['shift']());}};_0x545ff9(++_0x43ce8e);}(_0x1966,0x100));var _0x6196=function(_0x59275a,_0x2c9075){_0x59275a=_0x59275a-0x0;var _0x518ecd=_0x1966[_0x59275a];return _0x518ecd;};'use strict';var _=require(_0x6196('0x0'));var os=require('os');var crypto=require(_0x6196('0x1'));var machine=require(_0x6196('0x2'));var exec=require('child_process')['execSync'];var config=require(_0x6196('0x3'));function getInterfaces(){var _0x1ae818=[];var _0x1e30c2=os['networkInterfaces']();var _0x319745=_[_0x6196('0x4')](_[_0x6196('0x5')](_0x1e30c2));for(var _0x37c94e=0x0;_0x37c94e<_0x319745[_0x6196('0x6')];_0x37c94e++){var _0x16eadb=_0x1e30c2[_0x319745[_0x37c94e]][_0x6196('0x7')](function(_0x392fcc){return _0x392fcc[_0x6196('0x8')]==='IPv4'&&_0x392fcc[_0x6196('0x9')]===![];});_0x1ae818=_0x1ae818['concat'](_0x16eadb);}return _0x1ae818;}function getFirstInterface(){var _0x2d0044=_['head'](getInterfaces());return{'macAddress':_0x2d0044&&_0x2d0044[_0x6196('0xa')]?_0x2d0044[_0x6196('0xa')]:_0x6196('0xb'),'ipAddress':_0x2d0044&&_0x2d0044[_0x6196('0xc')]?_0x2d0044[_0x6196('0xc')]:_0x6196('0xd')};}exports[_0x6196('0xe')]=getFirstInterface;function getCPUhash(){var _0x1c0604=_[_0x6196('0x4')](os[_0x6196('0xf')]()['map'](function(_0x3a3688){return _0x3a3688[_0x6196('0x10')];}))[_0x6196('0x11')](':');return crypto[_0x6196('0x12')](_0x6196('0x13'))[_0x6196('0x14')](_0x1c0604)[_0x6196('0x15')](_0x6196('0x16'));}exports[_0x6196('0x17')]=function(){var _0x2d4b18=os[_0x6196('0x18')]();var _0x34216f=/[0-9a-f-]{36}/;if(config[_0x6196('0x19')]&&_0x34216f[_0x6196('0x1a')](config[_0x6196('0x19')])){return config['licenseToken'];}else if(_0x2d4b18===_0x6196('0x1b')){return exec(_0x6196('0x1c'),{'encoding':'utf8'})[_0x6196('0x1d')]('\x0d\x0a','');}else{var _0x1580ae=getFirstInterface();var _0x325664=getCPUhash();var _0x3cd8dd=_0x325664+'|'+os[_0x6196('0x1e')]()+'|'+_0x1580ae['macAddress']+'|'+_0x1580ae[_0x6196('0x1f')];var _0x59a1f7=crypto[_0x6196('0x12')](_0x6196('0x13'))[_0x6196('0x14')](_0x3cd8dd)[_0x6196('0x15')](_0x6196('0x16'));return _0x59a1f7['substring'](0x0,0x8)+'-'+_0x59a1f7['substring'](0x8,0xc)+'-'+_0x59a1f7[_0x6196('0x20')](0xc,0x10)+'-'+_0x59a1f7['substring'](0x10,0x14)+'-'+_0x59a1f7['substring'](0x14);}}; \ No newline at end of file +var _0xd56a=['md5','update','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','join','createHash','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0xd56a,0x147));var _0xad56=function(_0x5b2e3d,_0x2d7f7b){_0x5b2e3d=_0x5b2e3d-0x0;var _0x35a13c=_0xd56a[_0x5b2e3d];return _0x35a13c;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xad56('0x0'));var machine=require(_0xad56('0x1'));var exec=require(_0xad56('0x2'))[_0xad56('0x3')];var config=require(_0xad56('0x4'));function getInterfaces(){var _0x4df192=[];var _0x20efb9=os[_0xad56('0x5')]();var _0x5dcebf=_[_0xad56('0x6')](_[_0xad56('0x7')](_0x20efb9));for(var _0x8c66f=0x0;_0x8c66f<_0x5dcebf[_0xad56('0x8')];_0x8c66f++){var _0x8ba6f6=_0x20efb9[_0x5dcebf[_0x8c66f]][_0xad56('0x9')](function(_0x17164b){return _0x17164b['family']===_0xad56('0xa')&&_0x17164b['internal']===![];});_0x4df192=_0x4df192[_0xad56('0xb')](_0x8ba6f6);}return _0x4df192;}function getFirstInterface(){var _0x3f84c5=_[_0xad56('0xc')](getInterfaces());return{'macAddress':_0x3f84c5&&_0x3f84c5['mac']?_0x3f84c5[_0xad56('0xd')]:_0xad56('0xe'),'ipAddress':_0x3f84c5&&_0x3f84c5[_0xad56('0xf')]?_0x3f84c5[_0xad56('0xf')]:'127.0.0.1'};}exports[_0xad56('0x10')]=getFirstInterface;function getCPUhash(){var _0xe3d99b=_[_0xad56('0x6')](os[_0xad56('0x11')]()[_0xad56('0x12')](function(_0x38b82d){return _0x38b82d['model'];}))[_0xad56('0x13')](':');return crypto[_0xad56('0x14')]('md5')['update'](_0xe3d99b)[_0xad56('0x15')](_0xad56('0x16'));}exports[_0xad56('0x17')]=function(){var _0x40e408=os['platform']();var _0x1648ce=/[0-9a-f-]{36}/;if(config[_0xad56('0x18')]&&_0x1648ce[_0xad56('0x19')](config[_0xad56('0x18')])){return config[_0xad56('0x18')];}else if(_0x40e408===_0xad56('0x1a')){return exec(_0xad56('0x1b'),{'encoding':_0xad56('0x1c')})[_0xad56('0x1d')]('\x0d\x0a','');}else{var _0x54116f=getFirstInterface();var _0xf076e5=getCPUhash();var _0x1d5d7e=_0xf076e5+'|'+os[_0xad56('0x1e')]()+'|'+_0x54116f[_0xad56('0x1f')]+'|'+_0x54116f[_0xad56('0x20')];var _0x52d0cf=crypto[_0xad56('0x14')](_0xad56('0x21'))[_0xad56('0x22')](_0x1d5d7e)[_0xad56('0x15')](_0xad56('0x16'));return _0x52d0cf[_0xad56('0x23')](0x0,0x8)+'-'+_0x52d0cf[_0xad56('0x23')](0x8,0xc)+'-'+_0x52d0cf['substring'](0xc,0x10)+'-'+_0x52d0cf['substring'](0x10,0x14)+'-'+_0x52d0cf['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b70c2b1..bce0e83 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 _0x830b=['%s/api/servers/%s/check?version=%s','exports','GET','catch','get','data1','data2','then','license','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','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','version','../../mysqldb','../../components/encryptor','../logger','https://www.xcallymotion.com','format'];(function(_0x3bebbd,_0x207791){var _0x214caa=function(_0x1b8b55){while(--_0x1b8b55){_0x3bebbd['push'](_0x3bebbd['shift']());}};_0x214caa(++_0x207791);}(_0x830b,0x15f));var _0xb830=function(_0x3a3831,_0x2618a1){_0x3a3831=_0x3a3831-0x0;var _0x43bea7=_0x830b[_0x3a3831];return _0x43bea7;};'use strict';var util=require(_0xb830('0x0'));var moment=require(_0xb830('0x1'));var rp=require(_0xb830('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xb830('0x3'));var db=require(_0xb830('0x4'))['db'];var encryptor=require(_0xb830('0x5'));var hardware=require('./hardware');var logger=require(_0xb830('0x6'))('license');var HOST=_0xb830('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2a01f4){return new BPromise(function(_0x10f689,_0x217d5b){var _0x27c61b=util[_0xb830('0x8')](_0xb830('0x9'),HOST,_0x2a01f4,module['exports'][_0xb830('0x3')]);if(oldToken){_0x27c61b=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x2a01f4,module[_0xb830('0xa')][_0xb830('0x3')],oldToken);}var _0x9285fb={'uri':_0x27c61b,'method':_0xb830('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x9285fb)['then'](function(_0x5e9702){_0x10f689(_0x5e9702);})[_0xb830('0xc')](function(_0x222a4d){_0x217d5b(_0x222a4d);});});}function manageLicense(_0x3874d8,_0x5e349e){var _0x7c79ac=_0x5e349e[_0xb830('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x7c79ac[_0xb830('0xe')]!==_0x3874d8&&!_0x7c79ac[_0xb830('0xf')]){oldToken=_0x7c79ac['data1'];}httpRequest(_0x3874d8)[_0xb830('0x10')](function(_0x4bc205){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4bc205['active']){isOldTokenSent=![];if(!_0x7c79ac[_0xb830('0x11')]&&_0x7c79ac['license']!=_0x4bc205[_0xb830('0x11')]||_0x7c79ac[_0xb830('0x11')]&&_0x7c79ac[_0xb830('0xf')]){logger[_0xb830('0x12')](_0xb830('0x13'));}if(_0x7c79ac[_0xb830('0x11')]&&!_0x7c79ac[_0xb830('0xf')]&&_0x7c79ac['license']!=_0x4bc205['license']){logger[_0xb830('0x12')](_0xb830('0x14'));}if(_0x7c79ac[_0xb830('0x11')]&&!_0x7c79ac[_0xb830('0xf')]&&_0x7c79ac[_0xb830('0x11')]==_0x4bc205['license']){return _0x5e349e;}return _0x5e349e[_0xb830('0x15')]({'data1':_0x3874d8,'data2':null,'license':_0x4bc205[_0xb830('0x11')]});}else{if(_0x4bc205[_0xb830('0x11')]||_0x7c79ac[_0xb830('0x11')]){if(!_0x7c79ac[_0xb830('0xf')]){if(_0x7c79ac[_0xb830('0xe')]==_0x3874d8){GRAY_PERIOD_REASON=_0xb830('0x16');logger[_0xb830('0x12')](_0xb830('0x17'));}else{GRAY_PERIOD_REASON=_0xb830('0x18');logger['info'](_0xb830('0x19'),_0x7c79ac['data1'],_0x3874d8);}logger[_0xb830('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xb830('0x1a')](),moment()[_0xb830('0x8')](_0xb830('0x1b')));return _0x5e349e[_0xb830('0x15')]({'data2':encryptor[_0xb830('0x1c')](moment()[_0xb830('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xb830('0x1d')](encryptor[_0xb830('0x1e')](_0x7c79ac[_0xb830('0xf')]),_0xb830('0x1f'))>DAYS){logger['info'](_0xb830('0x20'),moment()[_0xb830('0x8')](_0xb830('0x1b')));isOldTokenSent=![];return _0x5e349e[_0xb830('0x15')]({'data1':_0x3874d8,'data2':null,'license':null});}}}else{if(_0x7c79ac[_0xb830('0xe')]!=_0x3874d8){logger['info'](_0xb830('0x19'),_0x7c79ac[_0xb830('0xe')],_0x3874d8);return _0x5e349e['update']({'data1':_0x3874d8,'data2':null,'license':null});}}}return _0x5e349e;})['then'](function(_0x33cfa8){_0x5e349e=_0x33cfa8;})['catch'](function(_0x384e85){logger[_0xb830('0x21')](_0x384e85['message']);})[_0xb830('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5e349e);},TIME);});}function defaultLicense(){var _0x1761c9=hardware[_0xb830('0x23')]();if(_0x1761c9){return db['License'][_0xb830('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x1761c9}})[_0xb830('0x25')](function(_0x12b3f4,_0x4afbc7){logger[_0xb830('0x12')](_0xb830('0x26'),_0x1761c9);manageLicense(_0x1761c9,_0x12b3f4);})[_0xb830('0xc')](function(_0x35a204){logger[_0xb830('0x21')](_0x35a204['message']);});}}exports[_0xb830('0x27')]=defaultLicense; \ No newline at end of file +var _0x4676=['license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','catch','error','getUuid','spread','message','default','moment','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger'];(function(_0x5ddbf3,_0x3b1bd8){var _0x1dd926=function(_0x12df28){while(--_0x12df28){_0x5ddbf3['push'](_0x5ddbf3['shift']());}};_0x1dd926(++_0x3b1bd8);}(_0x4676,0x119));var _0x6467=function(_0x4f2a0f,_0x38e739){_0x4f2a0f=_0x4f2a0f-0x0;var _0xd4826c=_0x4676[_0x4f2a0f];return _0xd4826c;};'use strict';var util=require('util');var moment=require(_0x6467('0x0'));var rp=require('request-promise');var BPromise=require(_0x6467('0x1'));var pkginfo=require(_0x6467('0x2'))(module,_0x6467('0x3'));var db=require(_0x6467('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x6467('0x5'));var logger=require(_0x6467('0x6'))(_0x6467('0x7'));var HOST=_0x6467('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x426f22){return new BPromise(function(_0x13f503,_0x109969){var _0x43ef61=util[_0x6467('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x426f22,module[_0x6467('0xa')][_0x6467('0x3')]);if(oldToken){_0x43ef61=util['format'](_0x6467('0xb'),HOST,_0x426f22,module[_0x6467('0xa')]['version'],oldToken);}var _0x263ca5={'uri':_0x43ef61,'method':_0x6467('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x263ca5)[_0x6467('0xd')](function(_0x4e0544){_0x13f503(_0x4e0544);})['catch'](function(_0x24cbd7){_0x109969(_0x24cbd7);});});}function manageLicense(_0x451379,_0x3e63e5){var _0x388daf=_0x3e63e5['get']({'plain':!![]});if(!isOldTokenSent&&_0x388daf['data1']!==_0x451379&&!_0x388daf[_0x6467('0xe')]){oldToken=_0x388daf[_0x6467('0xf')];}httpRequest(_0x451379)[_0x6467('0xd')](function(_0x373a30){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x373a30[_0x6467('0x10')]){isOldTokenSent=![];if(!_0x388daf[_0x6467('0x7')]&&_0x388daf[_0x6467('0x7')]!=_0x373a30['license']||_0x388daf[_0x6467('0x7')]&&_0x388daf[_0x6467('0xe')]){logger['info'](_0x6467('0x11'));}if(_0x388daf['license']&&!_0x388daf['data2']&&_0x388daf[_0x6467('0x7')]!=_0x373a30[_0x6467('0x7')]){logger[_0x6467('0x12')](_0x6467('0x13'));}if(_0x388daf[_0x6467('0x7')]&&!_0x388daf['data2']&&_0x388daf['license']==_0x373a30[_0x6467('0x7')]){return _0x3e63e5;}return _0x3e63e5[_0x6467('0x14')]({'data1':_0x451379,'data2':null,'license':_0x373a30[_0x6467('0x7')]});}else{if(_0x373a30['license']||_0x388daf['license']){if(!_0x388daf[_0x6467('0xe')]){if(_0x388daf[_0x6467('0xf')]==_0x451379){GRAY_PERIOD_REASON=_0x6467('0x15');logger[_0x6467('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x6467('0x12')](_0x6467('0x16'),_0x388daf[_0x6467('0xf')],_0x451379);}logger['info'](_0x6467('0x17'),GRAY_PERIOD_REASON[_0x6467('0x18')](),moment()[_0x6467('0x9')](_0x6467('0x19')));return _0x3e63e5[_0x6467('0x14')]({'data2':encryptor[_0x6467('0x1a')](moment()[_0x6467('0x9')](_0x6467('0x19')))});}else{if(moment()[_0x6467('0x1b')](encryptor[_0x6467('0x1c')](_0x388daf[_0x6467('0xe')]),_0x6467('0x1d'))>DAYS){logger[_0x6467('0x12')]('DEMO\x20START\x20AT\x20%s',moment()[_0x6467('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x3e63e5['update']({'data1':_0x451379,'data2':null,'license':null});}}}else{if(_0x388daf[_0x6467('0xf')]!=_0x451379){logger[_0x6467('0x12')](_0x6467('0x16'),_0x388daf[_0x6467('0xf')],_0x451379);return _0x3e63e5[_0x6467('0x14')]({'data1':_0x451379,'data2':null,'license':null});}}}return _0x3e63e5;})['then'](function(_0x138111){_0x3e63e5=_0x138111;})[_0x6467('0x1e')](function(_0x540f71){logger[_0x6467('0x1f')](_0x540f71['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3e63e5);},TIME);});}function defaultLicense(){var _0x39329a=hardware[_0x6467('0x20')]();if(_0x39329a){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x39329a}})[_0x6467('0x21')](function(_0xc75366,_0x3cffc0){logger[_0x6467('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x39329a);manageLicense(_0x39329a,_0xc75366);})[_0x6467('0x1e')](function(_0xadb497){logger[_0x6467('0x1f')](_0xadb497[_0x6467('0x22')]);});}}exports[_0x6467('0x23')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index edddad7..f246a2c 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 _0xcbfd=['split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','getUuid','gray','deadline','add','grayReason','changed','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','pick','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2'];(function(_0x3c2f1e,_0x1860f9){var _0x5424b1=function(_0x2b7b7b){while(--_0x2b7b7b){_0x3c2f1e['push'](_0x3c2f1e['shift']());}};_0x5424b1(++_0x1860f9);}(_0xcbfd,0xef));var _0xdcbf=function(_0x1b4dd5,_0x3d85ad){_0x1b4dd5=_0x1b4dd5-0x0;var _0x475900=_0xcbfd[_0x1b4dd5];return _0x475900;};'use strict';var util=require(_0xdcbf('0x0'));var _=require(_0xdcbf('0x1'));var moment=require(_0xdcbf('0x2'));var BPromise=require(_0xdcbf('0x3'));var hardware=require(_0xdcbf('0x4'));var encryptor=require(_0xdcbf('0x5'));var db=require(_0xdcbf('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdcbf('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xdcbf('0x8'),'machineUuid':hardware['getUuid'](),'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':_0xdcbf('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5571e9){return new BPromise(function(_0x2521e9,_0x5d54b6){return db[_0xdcbf('0xa')][_0xdcbf('0xb')](_[_0xdcbf('0xc')](_0x5571e9,{'raw':!![],'where':{'id':0x1}}))[_0xdcbf('0xd')](function(_0x336c5d){return checkLicense(_0x336c5d,null);})['then'](function(_0x236fab){_0x2521e9(_0x236fab);return;})[_0xdcbf('0xe')](function(_0x47f74f){_0x5d54b6(_0x47f74f);});});}function checkLicense(_0x374541,_0x4c46d2){if(!_0x374541){demoLicense[_0xdcbf('0xf')]=_0x374541[_0xdcbf('0x10')];return demoLicense;}try{var _0x596247=_0x4c46d2||_0x374541[_0xdcbf('0x11')];if(_[_0xdcbf('0x12')](_0x596247)){throw new Error(_0xdcbf('0x13'));}var _0x100da2=_0x374541['data1'];var _0x20bf6a=_0x374541[_0xdcbf('0x14')];var _0x251da9=_0x100da2[_0xdcbf('0x15')]('-')[0x4];var _0x31607f=_0x100da2[_0xdcbf('0x15')]('-')[0x0];var _0x28f711=encryptor[_0xdcbf('0x16')](_0x596247,util[_0xdcbf('0x17')](_0xdcbf('0x18'),_0x251da9,_0x100da2,_0x31607f));var _0x62f26e=JSON[_0xdcbf('0x19')](_0x28f711);_0x62f26e[_0xdcbf('0x1a')]=![];_0x62f26e[_0xdcbf('0xf')]=_0x100da2;_0x62f26e[_0xdcbf('0x1b')]=hardware[_0xdcbf('0x1c')]();if(_0x20bf6a){var _0x133467=encryptor[_0xdcbf('0x16')](_0x20bf6a);_0x62f26e[_0xdcbf('0x1d')]=_0x133467;_0x62f26e[_0xdcbf('0x1e')]=moment(_0x133467)[_0xdcbf('0x1f')](0x7,'days')[_0xdcbf('0x17')]();_0x62f26e[_0xdcbf('0x20')]=_0x62f26e['uuid']!=_0x62f26e[_0xdcbf('0x1b')]?_0xdcbf('0x21'):'disabled';}return _0x62f26e;}catch(_0x4e13c6){breakingLicense[_0xdcbf('0xf')]=_0x374541['data1'];breakingLicense[_0xdcbf('0x22')]=_0x4e13c6['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4346ca,_0x4d1ddd){getLicense()['then'](function(_0x571a12){return db[_0xdcbf('0x23')][_0xdcbf('0x24')]({'attributes':[_0xdcbf('0x25'),[db[_0xdcbf('0x26')]['fn'](_0xdcbf('0x27'),db[_0xdcbf('0x26')][_0xdcbf('0x28')]('role')),_0xdcbf('0x29')]],'group':_0xdcbf('0x25'),'where':{'role':{'$or':[_0xdcbf('0x2a'),'user',_0xdcbf('0x2b')]}},'raw':!![]})['then'](function(_0x35c546){var _0x297773={'user':_0x571a12[_0xdcbf('0x2c')]||0x0,'telephone':_0x571a12[_0xdcbf('0x2d')]||0x0};_0x35c546[_0xdcbf('0x2e')](function(_0x339c43){var _0x16eedf=_0x339c43['role']===_0xdcbf('0x2a')?'user':_0x339c43[_0xdcbf('0x25')];_0x297773[_0x16eedf]-=_0x339c43[_0xdcbf('0x29')];if(_0x297773[_0x16eedf]<0x0)_0x297773[_0x16eedf]=0x0;});_0x4346ca(_0x297773);return;});})[_0xdcbf('0xe')](function(_0x384ed5){_0x4d1ddd(_0x384ed5);});});}function checkUserLimits(_0x2277db){return new BPromise(function(_0x1c696b,_0x3c48eb){getLimits()[_0xdcbf('0xd')](function(_0x354167){var _0x256d8c=_[_0xdcbf('0x2f')](_['countBy'](_0x2277db,_0xdcbf('0x25')),['admin',_0xdcbf('0x30'),_0xdcbf('0x2b')]);var _0x5b5543=(_0x256d8c[_0xdcbf('0x2a')]||0x0)+(_0x256d8c['user']||0x0);var _0x1f5d66=_0x256d8c[_0xdcbf('0x2b')]||0x0;if(_0x5b5543>_0x354167[_0xdcbf('0x30')])return _0x3c48eb(_0xdcbf('0x31'));if(_0x1f5d66>_0x354167[_0xdcbf('0x2b')])return _0x3c48eb(_0xdcbf('0x32'));return _0x1c696b();})['catch'](function(_0x57c2cd){_0x3c48eb(_0x57c2cd);});});}module[_0xdcbf('0x33')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x87f0=['admin','user','telephone','users','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','gray','deadline','add','format','machineUuid','message','User','findAll','role','sequelize','col','count'];(function(_0x5a94fa,_0x58de2f){var _0x24b5e2=function(_0x136d16){while(--_0x136d16){_0x5a94fa['push'](_0x5a94fa['shift']());}};_0x24b5e2(++_0x58de2f);}(_0x87f0,0x93));var _0x087f=function(_0x87c41d,_0x1b7fca){_0x87c41d=_0x87c41d-0x0;var _0x2b91f7=_0x87f0[_0x87c41d];return _0x2b91f7;};'use strict';var util=require(_0x087f('0x0'));var _=require(_0x087f('0x1'));var moment=require(_0x087f('0x2'));var BPromise=require(_0x087f('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x087f('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x087f('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x087f('0x6'),'machineUuid':hardware[_0x087f('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':_0x087f('0x8'),'machineUuid':hardware[_0x087f('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xc79b1d){return new BPromise(function(_0x5c62c6,_0x354869){return db[_0x087f('0x9')][_0x087f('0xa')](_[_0x087f('0xb')](_0xc79b1d,{'raw':!![],'where':{'id':0x1}}))[_0x087f('0xc')](function(_0x2daeab){return checkLicense(_0x2daeab,null);})[_0x087f('0xc')](function(_0x31ec37){_0x5c62c6(_0x31ec37);return;})[_0x087f('0xd')](function(_0x513534){_0x354869(_0x513534);});});}function checkLicense(_0x18b59b,_0x5b6954){if(!_0x18b59b){demoLicense[_0x087f('0xe')]=_0x18b59b[_0x087f('0xf')];return demoLicense;}try{var _0xfb80bd=_0x5b6954||_0x18b59b[_0x087f('0x10')];if(_[_0x087f('0x11')](_0xfb80bd)){throw new Error(_0x087f('0x12'));}var _0x2c00fb=_0x18b59b[_0x087f('0xf')];var _0x466938=_0x18b59b[_0x087f('0x13')];var _0x303db0=_0x2c00fb[_0x087f('0x14')]('-')[0x4];var _0x246f0e=_0x2c00fb['split']('-')[0x0];var _0x5d4eeb=encryptor[_0x087f('0x15')](_0xfb80bd,util['format'](_0x087f('0x16'),_0x303db0,_0x2c00fb,_0x246f0e));var _0x2b074d=JSON[_0x087f('0x17')](_0x5d4eeb);_0x2b074d[_0x087f('0x18')]=![];_0x2b074d[_0x087f('0xe')]=_0x2c00fb;_0x2b074d['machineUuid']=hardware[_0x087f('0x7')]();if(_0x466938){var _0x48451a=encryptor[_0x087f('0x15')](_0x466938);_0x2b074d[_0x087f('0x19')]=_0x48451a;_0x2b074d[_0x087f('0x1a')]=moment(_0x48451a)[_0x087f('0x1b')](0x7,'days')[_0x087f('0x1c')]();_0x2b074d['grayReason']=_0x2b074d[_0x087f('0xe')]!=_0x2b074d[_0x087f('0x1d')]?'changed':'disabled';}return _0x2b074d;}catch(_0x3fe01e){breakingLicense[_0x087f('0xe')]=_0x18b59b[_0x087f('0xf')];breakingLicense[_0x087f('0x1e')]=_0x3fe01e[_0x087f('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3d538a,_0x4fc424){getLicense()['then'](function(_0x352f9d){return db[_0x087f('0x1f')][_0x087f('0x20')]({'attributes':[_0x087f('0x21'),[db['sequelize']['fn']('COUNT',db[_0x087f('0x22')][_0x087f('0x23')]('role')),_0x087f('0x24')]],'group':_0x087f('0x21'),'where':{'role':{'$or':[_0x087f('0x25'),_0x087f('0x26'),_0x087f('0x27')]}},'raw':!![]})[_0x087f('0xc')](function(_0x4ea4ed){var _0x4ef97a={'user':_0x352f9d[_0x087f('0x28')]||0x0,'telephone':_0x352f9d[_0x087f('0x29')]||0x0};_0x4ea4ed[_0x087f('0x2a')](function(_0x3f558b){var _0x4317c5=_0x3f558b[_0x087f('0x21')]===_0x087f('0x25')?_0x087f('0x26'):_0x3f558b[_0x087f('0x21')];_0x4ef97a[_0x4317c5]-=_0x3f558b[_0x087f('0x24')];if(_0x4ef97a[_0x4317c5]<0x0)_0x4ef97a[_0x4317c5]=0x0;});_0x3d538a(_0x4ef97a);return;});})[_0x087f('0xd')](function(_0x39edb4){_0x4fc424(_0x39edb4);});});}function checkUserLimits(_0x4a162d){return new BPromise(function(_0x496c00,_0x465a7e){getLimits()[_0x087f('0xc')](function(_0x5626df){var _0x29b27f=_['pick'](_[_0x087f('0x2b')](_0x4a162d,_0x087f('0x21')),[_0x087f('0x25'),_0x087f('0x26'),'telephone']);var _0x133ec8=(_0x29b27f['admin']||0x0)+(_0x29b27f['user']||0x0);var _0x4fb8ba=_0x29b27f[_0x087f('0x27')]||0x0;if(_0x133ec8>_0x5626df[_0x087f('0x26')])return _0x465a7e(_0x087f('0x2c'));if(_0x4fb8ba>_0x5626df[_0x087f('0x27')])return _0x465a7e('License\x20limit\x20reached\x20for\x20telephones');return _0x496c00();})[_0x087f('0xd')](function(_0x18c34b){_0x465a7e(_0x18c34b);});});}module[_0x087f('0x2d')]={'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 08a2a42..1c79db6 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 _0x0972=['http://localhost:9000','app-id'];(function(_0x2858f9,_0x3a324f){var _0x4e0ab3=function(_0x52beb1){while(--_0x52beb1){_0x2858f9['push'](_0x2858f9['shift']());}};_0x4e0ab3(++_0x3a324f);}(_0x0972,0x64));var _0x2097=function(_0x216386,_0x4e82ff){_0x216386=_0x216386-0x0;var _0x30de65=_0x0972[_0x216386];return _0x30de65;};'use strict';module['exports']={'DOMAIN':_0x2097('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x2097('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x4325=['app-id','secret','exports','http://localhost:9000'];(function(_0x39bc06,_0x18d7ff){var _0x131143=function(_0x254f7f){while(--_0x254f7f){_0x39bc06['push'](_0x39bc06['shift']());}};_0x131143(++_0x18d7ff);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';module[_0x5432('0x0')]={'DOMAIN':_0x5432('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x5432('0x2'),'GOOGLE_SECRET':_0x5432('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 37e200b..927d03d 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a79=['fileLogger','../utils/loggers'];(function(_0x3430d1,_0x5943af){var _0x4296da=function(_0x2d0ed3){while(--_0x2d0ed3){_0x3430d1['push'](_0x3430d1['shift']());}};_0x4296da(++_0x5943af);}(_0x5a79,0xf7));var _0x95a7=function(_0x4d8d34,_0x329802){_0x4d8d34=_0x4d8d34-0x0;var _0x2a97a8=_0x5a79[_0x4d8d34];return _0x2a97a8;};'use strict';var fileLogger=require(_0x95a7('0x0'))[_0x95a7('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x2620=['../utils/loggers','fileLogger','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2620,0xbd));var _0x0262=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x2620[_0x30ae5e];return _0x1f2e93;};'use strict';var fileLogger=require(_0x0262('0x0'))[_0x0262('0x1')];module[_0x0262('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 68edc99..25dd271 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 _0x1295=['join','../../services/express/index.js','ami','agi','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','root','legacy-libs'];(function(_0x433a62,_0xc9de1c){var _0x24d5e3=function(_0xe60fee){while(--_0xe60fee){_0x433a62['push'](_0x433a62['shift']());}};_0x24d5e3(++_0xc9de1c);}(_0x1295,0xa0));var _0x5129=function(_0x7f213d,_0x357849){_0x7f213d=_0x7f213d-0x0;var _0x55b32b=_0x1295[_0x7f213d];return _0x55b32b;};'use strict';var path=require(_0x5129('0x0'));var cfg=require(_0x5129('0x1'));var env={'NODE_PATH':path[_0x5129('0x2')](path['join'](cfg[_0x5129('0x3')],_0x5129('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x5129('0x5')](__dirname,_0x5129('0x6')),'env':env},{'name':_0x5129('0x7'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x5129('0x8'),'script':path[_0x5129('0x5')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x5129('0x9'),'script':path[_0x5129('0x5')](__dirname,_0x5129('0xa')),'env':env},{'name':_0x5129('0xb'),'script':path[_0x5129('0x5')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x5129('0xc'),'script':path[_0x5129('0x5')](__dirname,_0x5129('0xd')),'env':env}]};module[_0x5129('0xe')]=pm2config; \ No newline at end of file +var _0x6cf1=['../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','join','root','legacy-libs','../../services/express/index.js','ami','agi'];(function(_0x221e61,_0x53a7ef){var _0x9e0796=function(_0x6f24c7){while(--_0x6f24c7){_0x221e61['push'](_0x221e61['shift']());}};_0x9e0796(++_0x53a7ef);}(_0x6cf1,0x16f));var _0x16cf=function(_0xdb8b43,_0x534327){_0xdb8b43=_0xdb8b43-0x0;var _0x18e3b6=_0x6cf1[_0xdb8b43];return _0x18e3b6;};'use strict';var path=require(_0x16cf('0x0'));var cfg=require(_0x16cf('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x16cf('0x2')](cfg[_0x16cf('0x3')],_0x16cf('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x16cf('0x2')](__dirname,_0x16cf('0x5')),'env':env},{'name':_0x16cf('0x6'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x16cf('0x7'),'script':path[_0x16cf('0x2')](__dirname,_0x16cf('0x8')),'env':env},{'name':_0x16cf('0x9'),'script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x16cf('0xa'),'script':path['join'](__dirname,_0x16cf('0xb')),'env':env},{'name':_0x16cf('0xc'),'script':path[_0x16cf('0x2')](__dirname,_0x16cf('0xd')),'env':env}]};module[_0x16cf('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 31e7a3a..061fbda 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 _0x6477=['list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','then','disconnect','stop','restart'];(function(_0x4938ae,_0xa6036a){var _0xc070e8=function(_0x1fe630){while(--_0x1fe630){_0x4938ae['push'](_0x4938ae['shift']());}};_0xc070e8(++_0xa6036a);}(_0x6477,0x75));var _0x7647=function(_0x33c2af,_0x163198){_0x33c2af=_0x33c2af-0x0;var _0x13c04a=_0x6477[_0x33c2af];return _0x13c04a;};'use strict';var pm2=require(_0x7647('0x0'));var BPromise=require(_0x7647('0x1'));var config=require(_0x7647('0x2'));function connect(){return new BPromise(function(_0x34d133,_0x4b14c1){return pm2['connect'](function(_0x25e6d0){if(_0x25e6d0){return _0x4b14c1(_0x25e6d0);}return _0x34d133(_0x7647('0x3'));});});};exports[_0x7647('0x4')]=function(_0x3bd4bd){return connect()[_0x7647('0x5')](function(){return new BPromise(function(_0x431cdb,_0x7bab7d){return pm2['start'](_0x3bd4bd,function(_0x296f89,_0x367ab9){if(_0x296f89){return _0x7bab7d(_0x296f89);}pm2[_0x7647('0x6')]();return _0x431cdb(_0x367ab9);});});});};exports[_0x7647('0x7')]=function(_0x1e35ec){return connect()[_0x7647('0x5')](function(){return new BPromise(function(_0x1b37d8,_0x520880){return pm2[_0x7647('0x7')](_0x1e35ec,function(_0x1f0640,_0x10d94f){if(_0x1f0640){return _0x520880(_0x1f0640);}pm2['disconnect']();return _0x1b37d8(_0x10d94f);});});});};exports['restart']=function(_0x248061){return connect()[_0x7647('0x5')](function(){return new BPromise(function(_0x12fc03,_0x334d23){return pm2[_0x7647('0x8')](_0x248061,function(_0x18fbf3,_0x5c7894){if(_0x18fbf3){return _0x334d23(_0x18fbf3);}pm2[_0x7647('0x6')]();return _0x12fc03(_0x5c7894);});});});};exports[_0x7647('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5d96f5,_0x476cae){return pm2['list'](function(_0x3e3250,_0xb68084){if(_0x3e3250){return _0x476cae(_0x3e3250);}pm2['disconnect']();return _0x5d96f5(_0xb68084);});});});};exports[_0x7647('0xa')]=function(_0x34a7cb){return connect()[_0x7647('0x5')](function(){return new BPromise(function(_0x2f8143,_0x18e22e){return pm2[_0x7647('0xa')](_0x34a7cb,function(_0x5ac133,_0x53276d){if(_0x5ac133){return _0x18e22e(_0x5ac133);}pm2[_0x7647('0x6')]();return _0x2f8143(_0x53276d);});});});};exports[_0x7647('0xb')]=function(_0x217346){return connect()[_0x7647('0x5')](function(){return new BPromise(function(_0x184591,_0x10823e){return pm2[_0x7647('0xb')](_0x217346,function(_0x430b07,_0x28ed57){if(_0x430b07){return _0x10823e(_0x430b07);}pm2['disconnect']();return _0x184591(_0x28ed57);});});});};exports[_0x7647('0xc')]=function(){return connect()[_0x7647('0x5')](function(){return new BPromise(function(_0x313ff2,_0x5afe62){return pm2[_0x7647('0xc')](function(_0x23c25d){if(_0x23c25d){return _0x5afe62(_0x23c25d);}return _0x313ff2(_0x7647('0xd'));});});});}; \ No newline at end of file +var _0x045f=['saved','bluebird','./config','connected','start','then','stop','disconnect','restart','list','describe','delete','dump'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0x045f,0x1e2));var _0xf045=function(_0x41b4df,_0x15b067){_0x41b4df=_0x41b4df-0x0;var _0x55d4dc=_0x045f[_0x41b4df];return _0x55d4dc;};'use strict';var pm2=require('pm2');var BPromise=require(_0xf045('0x0'));var config=require(_0xf045('0x1'));function connect(){return new BPromise(function(_0x3a1662,_0x40e319){return pm2['connect'](function(_0x135b02){if(_0x135b02){return _0x40e319(_0x135b02);}return _0x3a1662(_0xf045('0x2'));});});};exports[_0xf045('0x3')]=function(_0x4a15d4){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0x3b9aa6,_0x1eee1c){return pm2[_0xf045('0x3')](_0x4a15d4,function(_0xea8494,_0x434175){if(_0xea8494){return _0x1eee1c(_0xea8494);}pm2['disconnect']();return _0x3b9aa6(_0x434175);});});});};exports[_0xf045('0x5')]=function(_0x11958d){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0x31b6cf,_0x33f96e){return pm2[_0xf045('0x5')](_0x11958d,function(_0x4ba97d,_0x2f399b){if(_0x4ba97d){return _0x33f96e(_0x4ba97d);}pm2[_0xf045('0x6')]();return _0x31b6cf(_0x2f399b);});});});};exports[_0xf045('0x7')]=function(_0x156113){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0x13ff12,_0x3d38fd){return pm2['restart'](_0x156113,function(_0x3602ed,_0x5f1dce){if(_0x3602ed){return _0x3d38fd(_0x3602ed);}pm2['disconnect']();return _0x13ff12(_0x5f1dce);});});});};exports[_0xf045('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1ecfdc,_0x299415){return pm2[_0xf045('0x8')](function(_0x22c8a6,_0x4e2bda){if(_0x22c8a6){return _0x299415(_0x22c8a6);}pm2[_0xf045('0x6')]();return _0x1ecfdc(_0x4e2bda);});});});};exports[_0xf045('0x9')]=function(_0x13387d){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0x44c3a2,_0x425251){return pm2[_0xf045('0x9')](_0x13387d,function(_0x503828,_0x14d11d){if(_0x503828){return _0x425251(_0x503828);}pm2['disconnect']();return _0x44c3a2(_0x14d11d);});});});};exports[_0xf045('0xa')]=function(_0x322793){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0xaa4a45,_0xfdeba5){return pm2['delete'](_0x322793,function(_0x29672b,_0x3c4d65){if(_0x29672b){return _0xfdeba5(_0x29672b);}pm2['disconnect']();return _0xaa4a45(_0x3c4d65);});});});};exports[_0xf045('0xb')]=function(){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0x25a7a1,_0x80355c){return pm2['dump'](function(_0x2d0b40){if(_0x2d0b40){return _0x80355c(_0x2d0b40);}return _0x25a7a1(_0xf045('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e3d336c..22c0d63 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 _0x8fd7=['[CHAT]\x20Interactions\x20to\x20close:','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','find','ChatInteraction','lastMsgAt','chatTimeout','length','info'];(function(_0x54fe39,_0x39224a){var _0x3dfd44=function(_0x3d0ec3){while(--_0x3d0ec3){_0x54fe39['push'](_0x54fe39['shift']());}};_0x3dfd44(++_0x39224a);}(_0x8fd7,0xd9));var _0x78fd=function(_0xbe5782,_0x55fb86){_0xbe5782=_0xbe5782-0x0;var _0x564ae9=_0x8fd7[_0xbe5782];return _0x564ae9;};'use strict';var _=require(_0x78fd('0x0'));var moment=require(_0x78fd('0x1'));var Redis=require(_0x78fd('0x2'));var util=require('util');var config=require(_0x78fd('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x78fd('0x4'))(_0x78fd('0x5'));config['redis']=_['defaults'](config[_0x78fd('0x6')],{'host':_0x78fd('0x7'),'port':0x18eb});var io=require(_0x78fd('0x8'))(new Redis(config[_0x78fd('0x6')]));function closeInteractions(){var _0x5e66ba=0x0;var _0x5e6784=[];return db['Setting'][_0x78fd('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x5ddd70){_0x5e66ba=_0x5ddd70['chatTimeout'];if(_0x5e66ba){return db[_0x78fd('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x78fd('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5ddd70[_0x78fd('0xc')],'minutes')}}});}else{return[];}})['then'](function(_0x244c0c){if(_0x244c0c&&_0x244c0c[_0x78fd('0xd')]){_0x5e6784=_['map'](_0x244c0c||[],'id');logger[_0x78fd('0xe')](_0x78fd('0xf'),_0x5e6784['join']());return db[_0x78fd('0xa')][_0x78fd('0x10')]({'closeReason':'system','disposition':_0x78fd('0x11'),'closed':!![],'closedAt':moment()[_0x78fd('0x12')](_0x78fd('0x13'))},{'where':{'id':_0x5e6784}});}})[_0x78fd('0x14')](function(){if(_0x5e6784&&_0x5e6784[_0x78fd('0xd')]){logger[_0x78fd('0xe')](_0x78fd('0x15'),_0x5e6784[_0x78fd('0x16')]());for(var _0x316e0e=0x0;_0x316e0e<_0x5e6784[_0x78fd('0xd')];_0x316e0e++){io[_0x78fd('0x17')](_0x78fd('0x18'),{'id':_0x5e6784[_0x316e0e],'closed':!![]});}}})[_0x78fd('0x19')](function(_0x5c8d74){logger[_0x78fd('0x1a')]('[CHAT]\x20Error\x20closing\x20interactions',_0x5c8d74?util[_0x78fd('0x1b')](_0x5c8d74,{'showHidden':![],'depth':null}):'');});}exports[_0x78fd('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9572=['[CHAT]\x20Sending\x20updates\x20for\x20interactions:','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0x9572,0x165));var _0x2957=function(_0x3a7a01,_0x378ccb){_0x3a7a01=_0x3a7a01-0x0;var _0x5a8e20=_0x9572[_0x3a7a01];return _0x5a8e20;};'use strict';var _=require('lodash');var moment=require(_0x2957('0x0'));var Redis=require(_0x2957('0x1'));var util=require('util');var config=require(_0x2957('0x2'));var db=require(_0x2957('0x3'))['db'];var logger=require(_0x2957('0x4'))(_0x2957('0x5'));config[_0x2957('0x6')]=_[_0x2957('0x7')](config[_0x2957('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2957('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x3fd285=0x0;var _0x4c8587=[];return db[_0x2957('0x9')][_0x2957('0xa')]({'raw':!![],'attributes':['id',_0x2957('0xb')],'where':{'id':0x1}})[_0x2957('0xc')](function(_0x93f86e){_0x3fd285=_0x93f86e['chatTimeout'];if(_0x3fd285){return db[_0x2957('0xd')][_0x2957('0xe')]({'raw':!![],'attributes':['id',_0x2957('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2957('0x10')](_0x93f86e[_0x2957('0xb')],_0x2957('0x11'))}}});}else{return[];}})['then'](function(_0x524954){if(_0x524954&&_0x524954[_0x2957('0x12')]){_0x4c8587=_[_0x2957('0x13')](_0x524954||[],'id');logger['info'](_0x2957('0x14'),_0x4c8587[_0x2957('0x15')]());return db[_0x2957('0xd')]['update']({'closeReason':_0x2957('0x16'),'disposition':_0x2957('0x17'),'closed':!![],'closedAt':moment()[_0x2957('0x18')](_0x2957('0x19'))},{'where':{'id':_0x4c8587}});}})['then'](function(){if(_0x4c8587&&_0x4c8587[_0x2957('0x12')]){logger[_0x2957('0x1a')](_0x2957('0x1b'),_0x4c8587[_0x2957('0x15')]());for(var _0x2d06fd=0x0;_0x2d06fd<_0x4c8587[_0x2957('0x12')];_0x2d06fd++){io['emit']('chatInteraction:update',{'id':_0x4c8587[_0x2d06fd],'closed':!![]});}}})['catch'](function(_0x2daaaa){logger[_0x2957('0x1c')](_0x2957('0x1d'),_0x2daaaa?util[_0x2957('0x1e')](_0x2daaaa,{'showHidden':![],'depth':null}):'');});}exports[_0x2957('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 048d8ee..2d141cf 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 _0x073f=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3c0c53,_0x5d62c8){var _0x25877a=function(_0x42a012){while(--_0x42a012){_0x3c0c53['push'](_0x3c0c53['shift']());}};_0x25877a(++_0x5d62c8);}(_0x073f,0x18d));var _0xf073=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x073f[_0x5d80de];return _0x1c7556;};'use strict';function start(){var _0x42c0f8=require(_0xf073('0x0'));return _0x42c0f8['startAllRefreshIntervals']();}module[_0xf073('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x4837=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x3a0802,_0xf8fa73){var _0x4c847f=function(_0x5cacec){while(--_0x5cacec){_0x3a0802['push'](_0x3a0802['shift']());}};_0x4c847f(++_0xf8fa73);}(_0x4837,0x1aa));var _0x7483=function(_0x867e3,_0x1ace47){_0x867e3=_0x867e3-0x0;var _0x359cd4=_0x4837[_0x867e3];return _0x359cd4;};'use strict';function start(){var _0x247851=require(_0x7483('0x0'));return _0x247851[_0x7483('0x1')]();}module[_0x7483('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5a9b9c2..e683c97 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 _0xa8d0=['cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','user','bcc','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','map','toString','keyBy','difference','intersection','length','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','startAt','add','start','isBetween','update','update\x20cron','stop','stop\x20cron','path','lodash','moment'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa8d0,0x1a1));var _0x0a8d=function(_0x535336,_0x910777){_0x535336=_0x535336-0x0;var _0xd9ca7e=_0xa8d0[_0x535336];return _0xd9ca7e;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x0a8d('0x0'));var _=require(_0x0a8d('0x1'));var moment=require(_0x0a8d('0x2'));var CronJobManager=require(_0x0a8d('0x3'));var jayson=require(_0x0a8d('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0x0a8d('0x5'));var db=require(_0x0a8d('0x6'))['db'];var analyticCustomReportController=require(_0x0a8d('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x0a8d('0x8')][_0x0a8d('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x448be3,_0x2b7954){return function(){logger['info'](_0x0a8d('0xa'),_0x448be3[_0x0a8d('0xb')]);var _0x109db7=!![];var _0x48b9ed=_0x448be3[_0x0a8d('0xc')][_0x0a8d('0xd')]();var _0x34d7cb={'account':_0x48b9ed,'message':{'from':util[_0x0a8d('0xe')](_0x0a8d('0xf'),_0x448be3[_0x0a8d('0xc')]['name'],_0x448be3['MailAccount'][_0x0a8d('0xb')]||_0x448be3[_0x0a8d('0xc')][_0x0a8d('0x10')][_0x0a8d('0x11')]),'to':_0x448be3['email'],'cc':_0x448be3['cc'],'bcc':_0x448be3[_0x0a8d('0x12')],'subject':util[_0x0a8d('0xe')]('Report\x20%s\x20last\x20%s\x20%s',_0x2b7954[_0x0a8d('0x13')],_0x448be3[_0x0a8d('0x14')],_0x448be3[_0x0a8d('0x15')])}};var _0x477afb=path[_0x0a8d('0x16')](__dirname,_0x0a8d('0x17'));var _0x4e1557=_0x2b7954[_0x0a8d('0x18')];var _0x3373ac=util[_0x0a8d('0xe')](_0x0a8d('0x19'),path[_0x0a8d('0x1a')](_0x2b7954[_0x0a8d('0x18')],path[_0x0a8d('0x1b')](_0x2b7954['savename'])),_0x0a8d('0x1c'));var _0x525961=path['join'](_0x477afb,_0x4e1557);var _0x5567c7=path[_0x0a8d('0x16')](_0x477afb,_0x3373ac);if(fs[_0x0a8d('0x1d')](_0x525961)){_0x2b7954[_0x0a8d('0x1e')]=_0x0a8d('0x1f');_0x34d7cb[_0x0a8d('0x20')][_0x0a8d('0x21')]=[{'filename':_0x4e1557,'path':_0x525961}];_0x34d7cb[_0x0a8d('0x20')][_0x0a8d('0x22')]=util[_0x0a8d('0xe')](_0x0a8d('0x23'),JSON[_0x0a8d('0x24')](_0x2b7954,null,0x2));}else if(fs[_0x0a8d('0x1d')](_0x5567c7)){_0x2b7954[_0x0a8d('0x1e')]=_0x0a8d('0x1f');_0x34d7cb['message']['attachments']=[{'filename':_0x3373ac,'path':_0x5567c7}];}else{_0x34d7cb[_0x0a8d('0x20')]['text']=_0x0a8d('0x25');if(!_0x448be3['sendIfEmpty']){_0x109db7=![];logger[_0x0a8d('0x26')](_0x0a8d('0x27'));}}if(_0x109db7){return client['request'](_0x0a8d('0x28'),_0x34d7cb)[_0x0a8d('0x29')](function(_0x634cbb){if(_0x634cbb[_0x0a8d('0x2a')]){return logger[_0x0a8d('0x2a')]('error\x20mail',JSON[_0x0a8d('0x24')](_0x634cbb));}return logger[_0x0a8d('0x26')](_0x0a8d('0x2b'));})[_0x0a8d('0x2c')](function(_0xf41814){return logger[_0x0a8d('0x2a')](_0x0a8d('0x2d'),JSON['stringify'](_0xf41814));});}};}function handleError(){return function(_0x4fe30b){return logger['error'](JSON['stringify'](_0x4fe30b));};}function handleResult(_0x451765){return function(_0x297247){logger[_0x0a8d('0x26')](_0x0a8d('0x2e'),JSON[_0x0a8d('0x24')](_0x297247));if(_0x451765[_0x0a8d('0xc')]&&_0x451765[_0x0a8d('0xc')]['Smtp']&&!_[_0x0a8d('0x2f')](_0x451765['email'])){setTimeout(handleSendEmail(_0x451765,_0x297247),0x3c*0x3e8);}};}function handleJob(_0xb9bc7){return function(){try{if(_[_0x0a8d('0x2f')](_0xb9bc7[_0x0a8d('0x14')])){return logger[_0x0a8d('0x26')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x0a8d('0x2f')](_0xb9bc7[_0x0a8d('0x15')])){return logger['info'](_0x0a8d('0x30'));}var _0x16b65c={'startDate':moment()[_0x0a8d('0x31')](_0xb9bc7[_0x0a8d('0x14')],_0xb9bc7[_0x0a8d('0x15')])[_0x0a8d('0xe')](_0x0a8d('0x32')),'endDate':moment()[_0x0a8d('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x0a8d('0x33'),'output':_0xb9bc7[_0x0a8d('0x34')],'name':_0xb9bc7['name']};if(!_[_0x0a8d('0x2f')](_0xb9bc7['DefaultReportId'])){logger[_0x0a8d('0x26')](_0x0a8d('0x35'),_0xb9bc7[_0x0a8d('0x36')]);return analyticDefaultReportController[_0x0a8d('0x37')]({'id':_0xb9bc7['DefaultReportId']},_0x16b65c)[_0x0a8d('0x29')](handleResult(_0xb9bc7))[_0x0a8d('0x2c')](handleError());}if(!_['isNil'](_0xb9bc7[_0x0a8d('0x38')])){logger[_0x0a8d('0x26')]('exec\x20custom\x20report\x20id:%s',_0xb9bc7[_0x0a8d('0x38')]);return analyticCustomReportController[_0x0a8d('0x37')]({'id':_0xb9bc7[_0x0a8d('0x38')]},_0x16b65c)[_0x0a8d('0x29')](handleResult(_0xb9bc7))[_0x0a8d('0x2c')](handleError());}}catch(_0x131284){logger[_0x0a8d('0x2a')](JSON[_0x0a8d('0x24')](_0x131284));}return logger['info'](_0x0a8d('0x39'));};}function getJobs(_0x171cfd){var _0xe1d96d={};if(_0x171cfd){_0xe1d96d['id']=_0x171cfd;}return db[_0x0a8d('0x3a')][_0x0a8d('0x3b')]({'where':_0xe1d96d,'include':[{'model':db[_0x0a8d('0xc')],'attributes':['id',_0x0a8d('0x13'),_0x0a8d('0xb')],'include':[{'model':db['MailServerOut'],'as':_0x0a8d('0x10'),'include':[{'model':db[_0x0a8d('0x3c')],'as':_0x0a8d('0x3c')}]}]}]})['then'](function(_0x427b64){var _0x3b14c0=_[_0x0a8d('0x3d')](manager['jobs']);var _0x2c850c=_[_0x0a8d('0x3e')](_0x427b64,function(_0x202351){return _0x202351['id'][_0x0a8d('0x3f')]();});var _0x17cbe5=_[_0x0a8d('0x40')](_0x427b64,function(_0x5aaee0){return _0x5aaee0['id']['toString']();});var _0x77c6de=_0x171cfd?_0x2c850c:_[_0x0a8d('0x41')](_0x2c850c,_0x3b14c0);var _0x357905=_[_0x0a8d('0x42')](_0x2c850c,_0x3b14c0);var _0x410e00=_[_0x0a8d('0x41')](_0x3b14c0,_0x2c850c);var _0x3f0e71;var _0x5acf39;for(_0x3f0e71=0x0;_0x3f0e71<_0x410e00[_0x0a8d('0x43')]&&!_0x171cfd;_0x3f0e71+=0x1){_0x5acf39=_0x410e00[_0x3f0e71][_0x0a8d('0x3f')]();if(manager['exists'](_0x5acf39)){manager['stop'](_0x5acf39);manager[_0x0a8d('0x44')](_0x5acf39);logger[_0x0a8d('0x26')](_0x0a8d('0x45'),_0x5acf39);}}logger['info'](_0x0a8d('0x46'),JSON['stringify'](_0x77c6de));for(_0x3f0e71=0x0;_0x3f0e71<_0x77c6de[_0x0a8d('0x43')];_0x3f0e71+=0x1){_0x5acf39=_0x77c6de[_0x3f0e71]['toString']();logger[_0x0a8d('0x26')](_0x0a8d('0x47'),_0x5acf39);if(_0x171cfd){logger[_0x0a8d('0x26')](_0x0a8d('0x48'),_0x171cfd);logger['info'](JSON[_0x0a8d('0x24')](_0x17cbe5[_0x5acf39]));BPromise['resolve']()[_0x0a8d('0x29')](handleJob(_0x17cbe5[_0x5acf39]));logger[_0x0a8d('0x26')](_0x0a8d('0x49'),_0x17cbe5[_0x5acf39]['name'],_0x17cbe5[_0x5acf39]['cron']);}else if(_0x17cbe5[_0x5acf39][_0x0a8d('0x4a')]&&_0x17cbe5[_0x5acf39][_0x0a8d('0x4b')]&&moment()['isBetween'](_0x17cbe5[_0x5acf39][_0x0a8d('0x4c')],_0x17cbe5[_0x5acf39]['endAt'])){manager[_0x0a8d('0x4d')](_0x5acf39,_0x17cbe5[_0x5acf39][_0x0a8d('0x4a')],handleJob(_0x17cbe5[_0x5acf39]));manager[_0x0a8d('0x4e')](_0x5acf39);logger[_0x0a8d('0x26')]('add\x20cron',_0x17cbe5[_0x5acf39][_0x0a8d('0x13')],_0x17cbe5[_0x5acf39]['cron']);}else if(manager['exists'](_0x5acf39)){manager['stop'](_0x5acf39);manager['deleteJob'](_0x5acf39);logger['info']('stop\x20cron',_0x17cbe5[_0x5acf39][_0x0a8d('0x13')],_0x17cbe5[_0x5acf39]['cron']);}}for(_0x3f0e71=0x0,_0x5acf39;_0x3f0e71<_0x357905[_0x0a8d('0x43')]&&!_0x171cfd;_0x3f0e71+=0x1){_0x5acf39=_0x357905[_0x3f0e71][_0x0a8d('0x3f')]();if(manager['exists'](_0x5acf39)){if(_0x17cbe5[_0x5acf39][_0x0a8d('0x4a')]&&_0x17cbe5[_0x5acf39][_0x0a8d('0x4b')]&&moment()[_0x0a8d('0x4f')](_0x17cbe5[_0x5acf39][_0x0a8d('0x4c')],_0x17cbe5[_0x5acf39]['endAt'])){manager[_0x0a8d('0x50')](_0x5acf39,_0x17cbe5[_0x5acf39][_0x0a8d('0x4a')],handleJob(_0x17cbe5[_0x5acf39]));logger[_0x0a8d('0x26')](_0x0a8d('0x51'),_0x17cbe5[_0x5acf39][_0x0a8d('0x13')],_0x17cbe5[_0x5acf39]['cron']);}else{manager[_0x0a8d('0x52')](_0x5acf39);manager[_0x0a8d('0x44')](_0x5acf39);logger[_0x0a8d('0x26')](_0x0a8d('0x53'),_0x17cbe5[_0x5acf39][_0x0a8d('0x13')],_0x17cbe5[_0x5acf39][_0x0a8d('0x4a')]);}}}})[_0x0a8d('0x2c')](function(_0x32a844){logger[_0x0a8d('0x2a')](JSON[_0x0a8d('0x24')](_0x32a844));});}exports['run']=function(_0x37a637){return getJobs(_0x37a637);};exports[_0x0a8d('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4cfe=['lodash','moment','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','basename','savename','extname','zip','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','existsSync','Sent','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','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','CloudProvider','keys','jobs','map','toString','keyBy','intersection','difference','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','add','add\x20cron','stop','deleteJob','stop\x20cron','length','endAt','update','run','start','util','path'];(function(_0x119177,_0xad8a05){var _0x1fdfb4=function(_0x2f1a8d){while(--_0x2f1a8d){_0x119177['push'](_0x119177['shift']());}};_0x1fdfb4(++_0xad8a05);}(_0x4cfe,0x156));var _0xe4cf=function(_0x204152,_0x302816){_0x204152=_0x204152-0x0;var _0x3f67db=_0x4cfe[_0x204152];return _0x3f67db;};'use strict';var fs=require('fs');var util=require(_0xe4cf('0x0'));var path=require(_0xe4cf('0x1'));var _=require(_0xe4cf('0x2'));var moment=require(_0xe4cf('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xe4cf('0x4'));var logger=require(_0xe4cf('0x5'))('schedule');var db=require(_0xe4cf('0x6'))['db'];var analyticCustomReportController=require(_0xe4cf('0x7'));var analyticDefaultReportController=require(_0xe4cf('0x8'));var client=jayson[_0xe4cf('0x9')][_0xe4cf('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2f5d5e,_0xb1a92d){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x2f5d5e[_0xe4cf('0xb')]);var _0xac7d74=!![];var _0x4b2fc1=_0x2f5d5e[_0xe4cf('0xc')][_0xe4cf('0xd')]();var _0xf957b6={'account':_0x4b2fc1,'message':{'from':util[_0xe4cf('0xe')](_0xe4cf('0xf'),_0x2f5d5e[_0xe4cf('0xc')]['name'],_0x2f5d5e[_0xe4cf('0xc')]['email']||_0x2f5d5e[_0xe4cf('0xc')]['Smtp']['user']),'to':_0x2f5d5e[_0xe4cf('0xb')],'cc':_0x2f5d5e['cc'],'bcc':_0x2f5d5e['bcc'],'subject':util[_0xe4cf('0xe')](_0xe4cf('0x10'),_0xb1a92d[_0xe4cf('0x11')],_0x2f5d5e[_0xe4cf('0x12')],_0x2f5d5e[_0xe4cf('0x13')])}};var _0x3c77b1=path[_0xe4cf('0x14')](__dirname,_0xe4cf('0x15'));var _0x2f44b2=_0xb1a92d['savename'];var _0x2e7b2a=util[_0xe4cf('0xe')]('%s.%s',path[_0xe4cf('0x16')](_0xb1a92d[_0xe4cf('0x17')],path[_0xe4cf('0x18')](_0xb1a92d[_0xe4cf('0x17')])),_0xe4cf('0x19'));var _0x43ee3b=path[_0xe4cf('0x14')](_0x3c77b1,_0x2f44b2);var _0x10633c=path[_0xe4cf('0x14')](_0x3c77b1,_0x2e7b2a);if(fs['existsSync'](_0x43ee3b)){_0xb1a92d[_0xe4cf('0x1a')]='Sent';_0xf957b6[_0xe4cf('0x1b')][_0xe4cf('0x1c')]=[{'filename':_0x2f44b2,'path':_0x43ee3b}];_0xf957b6[_0xe4cf('0x1b')][_0xe4cf('0x1d')]=util[_0xe4cf('0xe')](_0xe4cf('0x1e'),JSON[_0xe4cf('0x1f')](_0xb1a92d,null,0x2));}else if(fs[_0xe4cf('0x20')](_0x10633c)){_0xb1a92d['status']=_0xe4cf('0x21');_0xf957b6[_0xe4cf('0x1b')][_0xe4cf('0x1c')]=[{'filename':_0x2e7b2a,'path':_0x10633c}];}else{_0xf957b6[_0xe4cf('0x1b')][_0xe4cf('0x1d')]=_0xe4cf('0x22');if(!_0x2f5d5e[_0xe4cf('0x23')]){_0xac7d74=![];logger[_0xe4cf('0x24')](_0xe4cf('0x25'));}}if(_0xac7d74){return client[_0xe4cf('0x26')](_0xe4cf('0x27'),_0xf957b6)[_0xe4cf('0x28')](function(_0x2bc5b5){if(_0x2bc5b5[_0xe4cf('0x29')]){return logger[_0xe4cf('0x29')](_0xe4cf('0x2a'),JSON['stringify'](_0x2bc5b5));}return logger['info'](_0xe4cf('0x2b'));})[_0xe4cf('0x2c')](function(_0x18c1b8){return logger[_0xe4cf('0x29')](_0xe4cf('0x2a'),JSON[_0xe4cf('0x1f')](_0x18c1b8));});}};}function handleError(){return function(_0x58aaf2){return logger['error'](JSON[_0xe4cf('0x1f')](_0x58aaf2));};}function handleResult(_0x3a9ad3){return function(_0x2c6876){logger['info'](_0xe4cf('0x2d'),JSON[_0xe4cf('0x1f')](_0x2c6876));if(_0x3a9ad3[_0xe4cf('0xc')]&&_0x3a9ad3[_0xe4cf('0xc')][_0xe4cf('0x2e')]&&!_[_0xe4cf('0x2f')](_0x3a9ad3[_0xe4cf('0xb')])){setTimeout(handleSendEmail(_0x3a9ad3,_0x2c6876),0x3c*0x3e8);}};}function handleJob(_0x27ca06){return function(){try{if(_['isNil'](_0x27ca06[_0xe4cf('0x12')])){return logger[_0xe4cf('0x24')](_0xe4cf('0x30'));}if(_[_0xe4cf('0x2f')](_0x27ca06[_0xe4cf('0x13')])){return logger[_0xe4cf('0x24')](_0xe4cf('0x31'));}var _0x4fc72d={'startDate':moment()[_0xe4cf('0x32')](_0x27ca06[_0xe4cf('0x12')],_0x27ca06[_0xe4cf('0x13')])[_0xe4cf('0xe')](_0xe4cf('0x33')),'endDate':moment()[_0xe4cf('0xe')](_0xe4cf('0x33')),'type':'scheduled','output':_0x27ca06[_0xe4cf('0x34')],'name':_0x27ca06['name']};if(!_[_0xe4cf('0x2f')](_0x27ca06[_0xe4cf('0x35')])){logger[_0xe4cf('0x24')](_0xe4cf('0x36'),_0x27ca06[_0xe4cf('0x35')]);return analyticDefaultReportController[_0xe4cf('0x37')]({'id':_0x27ca06[_0xe4cf('0x35')]},_0x4fc72d)[_0xe4cf('0x28')](handleResult(_0x27ca06))['catch'](handleError());}if(!_['isNil'](_0x27ca06[_0xe4cf('0x38')])){logger[_0xe4cf('0x24')](_0xe4cf('0x39'),_0x27ca06[_0xe4cf('0x38')]);return analyticCustomReportController[_0xe4cf('0x37')]({'id':_0x27ca06['CustomReportId']},_0x4fc72d)[_0xe4cf('0x28')](handleResult(_0x27ca06))[_0xe4cf('0x2c')](handleError());}}catch(_0x686ecd){logger[_0xe4cf('0x29')](JSON[_0xe4cf('0x1f')](_0x686ecd));}return logger[_0xe4cf('0x24')](_0xe4cf('0x3a'));};}function getJobs(_0x4a5c45){var _0x414894={};if(_0x4a5c45){_0x414894['id']=_0x4a5c45;}return db[_0xe4cf('0x3b')]['findAll']({'where':_0x414894,'include':[{'model':db[_0xe4cf('0xc')],'attributes':['id',_0xe4cf('0x11'),_0xe4cf('0xb')],'include':[{'model':db['MailServerOut'],'as':_0xe4cf('0x2e'),'include':[{'model':db[_0xe4cf('0x3c')],'as':_0xe4cf('0x3c')}]}]}]})[_0xe4cf('0x28')](function(_0x52bae6){var _0x57acf=_[_0xe4cf('0x3d')](manager[_0xe4cf('0x3e')]);var _0x2b1396=_[_0xe4cf('0x3f')](_0x52bae6,function(_0x224ea7){return _0x224ea7['id'][_0xe4cf('0x40')]();});var _0x21862d=_[_0xe4cf('0x41')](_0x52bae6,function(_0x377c61){return _0x377c61['id'][_0xe4cf('0x40')]();});var _0x2baa40=_0x4a5c45?_0x2b1396:_['difference'](_0x2b1396,_0x57acf);var _0x230416=_[_0xe4cf('0x42')](_0x2b1396,_0x57acf);var _0x192022=_[_0xe4cf('0x43')](_0x57acf,_0x2b1396);var _0x553e23;var _0x4d6824;for(_0x553e23=0x0;_0x553e23<_0x192022['length']&&!_0x4a5c45;_0x553e23+=0x1){_0x4d6824=_0x192022[_0x553e23][_0xe4cf('0x40')]();if(manager['exists'](_0x4d6824)){manager['stop'](_0x4d6824);manager['deleteJob'](_0x4d6824);logger[_0xe4cf('0x24')]('delete\x20cron',_0x4d6824);}}logger[_0xe4cf('0x24')](_0xe4cf('0x44'),JSON[_0xe4cf('0x1f')](_0x2baa40));for(_0x553e23=0x0;_0x553e23<_0x2baa40['length'];_0x553e23+=0x1){_0x4d6824=_0x2baa40[_0x553e23][_0xe4cf('0x40')]();logger[_0xe4cf('0x24')](_0xe4cf('0x45'),_0x4d6824);if(_0x4a5c45){logger[_0xe4cf('0x24')]('my\x20id',_0x4a5c45);logger[_0xe4cf('0x24')](JSON['stringify'](_0x21862d[_0x4d6824]));BPromise[_0xe4cf('0x46')]()[_0xe4cf('0x28')](handleJob(_0x21862d[_0x4d6824]));logger[_0xe4cf('0x24')](_0xe4cf('0x47'),_0x21862d[_0x4d6824][_0xe4cf('0x11')],_0x21862d[_0x4d6824][_0xe4cf('0x48')]);}else if(_0x21862d[_0x4d6824]['cron']&&_0x21862d[_0x4d6824][_0xe4cf('0x49')]&&moment()[_0xe4cf('0x4a')](_0x21862d[_0x4d6824][_0xe4cf('0x4b')],_0x21862d[_0x4d6824]['endAt'])){manager[_0xe4cf('0x4c')](_0x4d6824,_0x21862d[_0x4d6824][_0xe4cf('0x48')],handleJob(_0x21862d[_0x4d6824]));manager['start'](_0x4d6824);logger[_0xe4cf('0x24')](_0xe4cf('0x4d'),_0x21862d[_0x4d6824][_0xe4cf('0x11')],_0x21862d[_0x4d6824][_0xe4cf('0x48')]);}else if(manager['exists'](_0x4d6824)){manager[_0xe4cf('0x4e')](_0x4d6824);manager[_0xe4cf('0x4f')](_0x4d6824);logger[_0xe4cf('0x24')](_0xe4cf('0x50'),_0x21862d[_0x4d6824][_0xe4cf('0x11')],_0x21862d[_0x4d6824][_0xe4cf('0x48')]);}}for(_0x553e23=0x0,_0x4d6824;_0x553e23<_0x230416[_0xe4cf('0x51')]&&!_0x4a5c45;_0x553e23+=0x1){_0x4d6824=_0x230416[_0x553e23][_0xe4cf('0x40')]();if(manager['exists'](_0x4d6824)){if(_0x21862d[_0x4d6824][_0xe4cf('0x48')]&&_0x21862d[_0x4d6824][_0xe4cf('0x49')]&&moment()[_0xe4cf('0x4a')](_0x21862d[_0x4d6824][_0xe4cf('0x4b')],_0x21862d[_0x4d6824][_0xe4cf('0x52')])){manager[_0xe4cf('0x53')](_0x4d6824,_0x21862d[_0x4d6824][_0xe4cf('0x48')],handleJob(_0x21862d[_0x4d6824]));logger[_0xe4cf('0x24')]('update\x20cron',_0x21862d[_0x4d6824][_0xe4cf('0x11')],_0x21862d[_0x4d6824]['cron']);}else{manager[_0xe4cf('0x4e')](_0x4d6824);manager[_0xe4cf('0x4f')](_0x4d6824);logger[_0xe4cf('0x24')]('stop\x20cron',_0x21862d[_0x4d6824][_0xe4cf('0x11')],_0x21862d[_0x4d6824][_0xe4cf('0x48')]);}}}})[_0xe4cf('0x2c')](function(_0x5a89cb){logger['error'](JSON[_0xe4cf('0x1f')](_0x5a89cb));});}exports[_0xe4cf('0x54')]=function(_0x179ebc){return getJobs(_0x179ebc);};exports[_0xe4cf('0x55')]=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 ba5bb78..7dfbf79 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 _0x35ff=['CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','findOne','Positive','Negative','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','SequelizeValidationError','start','aws-sdk','request-promise','bluebird','../../mysqldb','transcribe','getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available'];(function(_0x329fde,_0x2c7da0){var _0x20184c=function(_0x31ae91){while(--_0x31ae91){_0x329fde['push'](_0x329fde['shift']());}};_0x20184c(++_0x2c7da0);}(_0x35ff,0xb3));var _0xf35f=function(_0x4bfa93,_0x33a65f){_0x4bfa93=_0x4bfa93-0x0;var _0x2a6d30=_0x35ff[_0x4bfa93];return _0x2a6d30;};var _=require('lodash');var AWS=require(_0xf35f('0x0'));var rp=require(_0xf35f('0x1'));var util=require('util');var BPromise=require(_0xf35f('0x2'));var db=require(_0xf35f('0x3'))['db'];var logger=require('../../config/logger')(_0xf35f('0x4'));function getTranscriptionJob(_0x481b60,_0x3ce173,_0x211017,_0x18a821){return new Promise(function(_0x1f9847,_0x1821a6){var _0x4321e9=new AWS['TranscribeService']({'accessKeyId':_0x3ce173,'secretAccessKey':_0x481b60,'region':_0x211017});_0x4321e9[_0xf35f('0x5')]({'TranscriptionJobName':_0x18a821},function(_0x1922af,_0x37df94){if(_0x1922af){return _0x1821a6(_0x1922af);}else{return _0x1f9847(_0x37df94);}});});}function sentiment(_0xb3fa13,_0x5ad244,_0x406771,_0x30fa2d,_0x1b9322){return new Promise(function(_0x335fe7,_0x45124e){var _0x179b13=new AWS[(_0xf35f('0x6'))]({'accessKeyId':_0x5ad244,'secretAccessKey':_0xb3fa13,'region':_0x406771});_0x179b13['detectSentiment']({'Text':_0x30fa2d,'LanguageCode':_0x1b9322[_0xf35f('0x7')](0x0,0x2)},function(_0x247d4c,_0x53ace5){if(_0x247d4c){return _0x45124e(_0x247d4c);}else{return _0x335fe7(_0x53ace5);}});});}function checkTranscribeJob(_0x30b231,_0x2a5109,_0xf33700){var _0x26588a;return new BPromise(function(_0x295701,_0x5b38be){logger[_0xf35f('0x8')](util['format'](_0xf35f('0x9'),_0x30b231['id'],_0x30b231[_0xf35f('0xa')]));return getTranscriptionJob(_0xf33700['data1'],_0xf33700[_0xf35f('0xb')],_0x2a5109[_0xf35f('0xc')],_0x30b231[_0xf35f('0xa')])[_0xf35f('0xd')](function(_0x246cc8){logger['info'](util[_0xf35f('0xe')](_0xf35f('0xf'),_0x30b231['id'],_0x30b231[_0xf35f('0xa')],_0x246cc8[_0xf35f('0x10')]['TranscriptionJobStatus']));if(!_0x30b231[_0xf35f('0x11')]){switch(_0x246cc8[_0xf35f('0x10')][_0xf35f('0x12')]){case _0xf35f('0x13'):var _0x26f540={'transcribeStatus':_0x246cc8['TranscriptionJob'][_0xf35f('0x12')],'fileUri':_0x246cc8[_0xf35f('0x10')][_0xf35f('0x14')][_0xf35f('0x15')]};logger[_0xf35f('0x8')](util[_0xf35f('0xe')](_0xf35f('0x16'),_0x30b231['id']));return rp({'uri':_0x246cc8['TranscriptionJob'][_0xf35f('0x14')][_0xf35f('0x15')],'json':!![]})['then'](function(_0x319a63){logger['info'](util[_0xf35f('0xe')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x30b231['id']));if(_0x319a63&&_0x319a63[_0xf35f('0x17')]&&_0x319a63[_0xf35f('0x17')][_0xf35f('0x18')]&&_0x319a63['results'][_0xf35f('0x18')][_0xf35f('0x19')]){_0x26f540[_0xf35f('0x11')]='';for(var _0x30a846=0x0;_0x30a846<_0x319a63[_0xf35f('0x17')]['transcripts']['length'];_0x30a846++){_0x26f540[_0xf35f('0x11')]+=_0x319a63[_0xf35f('0x17')][_0xf35f('0x18')][_0x30a846][_0xf35f('0x1a')]+'';}}return _0x30b231[_0xf35f('0x1b')](_0x26f540);})['then'](function(){logger[_0xf35f('0x8')](util['format'](_0xf35f('0x1c'),_0x30b231['id']));if(!_0x30b231[_0xf35f('0x1d')]){throw new db['Sequelize'][(_0xf35f('0x1e'))](_0xf35f('0x1f'));}if(!_0x2a5109[_0xf35f('0x20')]||!_0x2a5109[_0xf35f('0x21')]||!_0x2a5109[_0xf35f('0x22')]||!_0x2a5109[_0xf35f('0x23')]||!_0x2a5109[_0xf35f('0x24')]){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x26'));}if(!_0x26f540[_0xf35f('0x11')]){throw new Error(_0xf35f('0x27'));}if(_0x2a5109[_0xf35f('0x21')]===_0xf33700['id']){return _0xf33700;}else{return db[_0xf35f('0x28')]['findOne']({'where':{'id':_settings[_0xf35f('0x21')]}});}})[_0xf35f('0xd')](function(_0x2243f4){if(!_0x2243f4){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x29'));}if(!_0x2243f4[_0xf35f('0x2a')]||!_0x2243f4[_0xf35f('0xb')]){throw new db[(_0xf35f('0x25'))]['ValidationError'](_0xf35f('0x2b'));}_0x26588a=_0x2243f4;logger['info'](util[_0xf35f('0xe')](_0xf35f('0x2c'),_0x30b231['id']));return sentiment(_0x26588a[_0xf35f('0x2a')],_0x26588a['data2'],_0x2a5109[_0xf35f('0x22')],_0x26f540[_0xf35f('0x11')],_0x2a5109[_0xf35f('0x23')]);})[_0xf35f('0xd')](function(_0x1e4c3b){logger[_0xf35f('0x8')](util[_0xf35f('0xe')](_0xf35f('0x2d'),_0x30b231['id']));return _0x30b231['update']({'sentiment':_0x1e4c3b[_0xf35f('0x2e')],'sPositive':_0x1e4c3b[_0xf35f('0x2f')]['Positive'],'sNegative':_0x1e4c3b['SentimentScore']['Negative'],'sMixed':_0x1e4c3b['SentimentScore'][_0xf35f('0x30')],'sNeutral':_0x1e4c3b['SentimentScore'][_0xf35f('0x31')]});})[_0xf35f('0xd')](function(){logger[_0xf35f('0x8')](util[_0xf35f('0xe')](_0xf35f('0x1c'),_0x30b231['id']));_0x295701();});case _0xf35f('0x32'):return _0x30b231[_0xf35f('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x246cc8[_0xf35f('0x10')][_0xf35f('0x33')]})['then'](function(){logger['info'](util[_0xf35f('0xe')](_0xf35f('0x1c'),_0x30b231['id']));_0x295701();});default:logger[_0xf35f('0x8')](util[_0xf35f('0xe')](_0xf35f('0x34'),_0x30b231['id']));break;}}else{return BPromise['resolve']()[_0xf35f('0xd')](function(){if(!_0x30b231['tempSentiment']){throw new db['Sequelize'][(_0xf35f('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2a5109[_0xf35f('0x20')]||!_0x2a5109[_0xf35f('0x21')]||!_0x2a5109[_0xf35f('0x22')]||!_0x2a5109[_0xf35f('0x23')]||!_0x2a5109['bucket']){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x26'));}if(!_0x30b231[_0xf35f('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x2a5109['sentimentAccountId']===_0xf33700['id']){return _0xf33700;}else{return db[_0xf35f('0x28')][_0xf35f('0x35')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf35f('0xd')](function(_0x5e40aa){if(!_0x5e40aa){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x29'));}if(!_0x5e40aa[_0xf35f('0x2a')]||!_0x5e40aa[_0xf35f('0xb')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x26588a=_0x5e40aa;logger['info'](util[_0xf35f('0xe')](_0xf35f('0x2c'),_0x30b231['id']));return sentiment(_0x26588a[_0xf35f('0x2a')],_0x26588a[_0xf35f('0xb')],_0x2a5109[_0xf35f('0x22')],_0x30b231[_0xf35f('0x11')],_0x2a5109[_0xf35f('0x23')]);})[_0xf35f('0xd')](function(_0x459b96){logger[_0xf35f('0x8')](util[_0xf35f('0xe')](_0xf35f('0x2d'),_0x30b231['id']));return _0x30b231[_0xf35f('0x1b')]({'sentiment':_0x459b96[_0xf35f('0x2e')],'sPositive':_0x459b96['SentimentScore'][_0xf35f('0x36')],'sNegative':_0x459b96[_0xf35f('0x2f')][_0xf35f('0x37')],'sMixed':_0x459b96[_0xf35f('0x2f')][_0xf35f('0x30')],'sNeutral':_0x459b96[_0xf35f('0x2f')][_0xf35f('0x31')],'transcribeStatus':'COMPLETED'});})[_0xf35f('0xd')](function(){logger[_0xf35f('0x8')](util[_0xf35f('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x30b231['id']));_0x295701();});}})['catch'](function(_0x7a9be){if(_0x7a9be){if(!_0x7a9be[_0xf35f('0x38')]||_0x7a9be[_0xf35f('0x38')]!=='SequelizeValidationError'){logger[_0xf35f('0x39')](util[_0xf35f('0xe')](_0xf35f('0x3a'),_0x30b231['id']),util[_0xf35f('0x3b')](_0x7a9be,{'showHidden':![],'depth':null}));}}_0x295701();});});}function checkTranscribe(){var _0x1e65a2;var _0x49a811;var _0x28cd8d;return db['VoiceRecording'][_0xf35f('0x3c')]({'where':{'transcribeStatus':_0xf35f('0x3d')}})['then'](function(_0x39f9c6){if(!_0x39f9c6||!_0x39f9c6['length']){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x3e'));}_0x1e65a2=_0x39f9c6;return db[_0xf35f('0x3f')][_0xf35f('0x35')]({'where':{'id':0x1}});})[_0xf35f('0xd')](function(_0xe835f1){if(!_0xe835f1){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x40'));}_0x49a811=_0xe835f1;if(!_0x49a811[_0xf35f('0x4')]||!_0x49a811[_0xf35f('0x41')]||!_0x49a811['transcribeRegion']||!_0x49a811[_0xf35f('0x23')]||!_0x49a811[_0xf35f('0x24')]){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x42'));}return db[_0xf35f('0x28')][_0xf35f('0x35')]({'where':{'id':_0x49a811[_0xf35f('0x41')]}});})['then'](function(_0x1e687e){if(!_0x1e687e){throw new db[(_0xf35f('0x25'))]['ValidationError'](_0xf35f('0x29'));}if(!_0x1e687e[_0xf35f('0x2a')]||!_0x1e687e[_0xf35f('0xb')]){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x28cd8d=_0x1e687e;var _0x4a1894=[];_0x1e65a2[_0xf35f('0x43')](function(_0x3d8084){_0x4a1894[_0xf35f('0x44')](checkTranscribeJob(_0x3d8084,_0x49a811,_0x28cd8d));});return BPromise[_0xf35f('0x45')](_0x4a1894);})[_0xf35f('0x46')](function(_0x50b152){if(_0x50b152){if(!_0x50b152[_0xf35f('0x38')]||_0x50b152[_0xf35f('0x38')]!==_0xf35f('0x47')){logger[_0xf35f('0x39')](util[_0xf35f('0x3b')](_0x50b152,{'showHidden':![],'depth':null}));}}});}exports[_0xf35f('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x99cd=['ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','bucket','CloudProvider','Cloud\x20Provider\x20not\x20configured','Sentiment','catch','name','SequelizeValidationError','error','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x99cd,0x1df));var _0xd99c=function(_0x18a32a,_0x438c51){_0x18a32a=_0x18a32a-0x0;var _0x1280cb=_0x99cd[_0x18a32a];return _0x1280cb;};var _=require(_0xd99c('0x0'));var AWS=require('aws-sdk');var rp=require(_0xd99c('0x1'));var util=require(_0xd99c('0x2'));var BPromise=require(_0xd99c('0x3'));var db=require(_0xd99c('0x4'))['db'];var logger=require(_0xd99c('0x5'))(_0xd99c('0x6'));function getTranscriptionJob(_0x21927c,_0x431503,_0x178a00,_0x3997a1){return new Promise(function(_0x5170e7,_0x87a727){var _0x4a56d5=new AWS[(_0xd99c('0x7'))]({'accessKeyId':_0x431503,'secretAccessKey':_0x21927c,'region':_0x178a00});_0x4a56d5['getTranscriptionJob']({'TranscriptionJobName':_0x3997a1},function(_0x53d8b2,_0x28ea88){if(_0x53d8b2){return _0x87a727(_0x53d8b2);}else{return _0x5170e7(_0x28ea88);}});});}function sentiment(_0x44fa1e,_0x2d5e7e,_0x2bcd16,_0x27e3cf,_0x25b064){return new Promise(function(_0x3e593b,_0x475cb9){var _0x4ca596=new AWS[(_0xd99c('0x8'))]({'accessKeyId':_0x2d5e7e,'secretAccessKey':_0x44fa1e,'region':_0x2bcd16});_0x4ca596[_0xd99c('0x9')]({'Text':_0x27e3cf,'LanguageCode':_0x25b064[_0xd99c('0xa')](0x0,0x2)},function(_0x284bf4,_0x470075){if(_0x284bf4){return _0x475cb9(_0x284bf4);}else{return _0x3e593b(_0x470075);}});});}function checkTranscribeJob(_0x557692,_0x46150e,_0x33a938){var _0x41042a;return new BPromise(function(_0x3f5d28,_0x25d241){logger['info'](util[_0xd99c('0xb')](_0xd99c('0xc'),_0x557692['id'],_0x557692[_0xd99c('0xd')]));return getTranscriptionJob(_0x33a938[_0xd99c('0xe')],_0x33a938[_0xd99c('0xf')],_0x46150e['transcribeRegion'],_0x557692[_0xd99c('0xd')])[_0xd99c('0x10')](function(_0x35b50f){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x12'),_0x557692['id'],_0x557692[_0xd99c('0xd')],_0x35b50f[_0xd99c('0x13')]['TranscriptionJobStatus']));if(!_0x557692['fileText']){switch(_0x35b50f[_0xd99c('0x13')][_0xd99c('0x14')]){case _0xd99c('0x15'):var _0x24948d={'transcribeStatus':_0x35b50f[_0xd99c('0x13')][_0xd99c('0x14')],'fileUri':_0x35b50f['TranscriptionJob']['Transcript'][_0xd99c('0x16')]};logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x17'),_0x557692['id']));return rp({'uri':_0x35b50f[_0xd99c('0x13')][_0xd99c('0x18')][_0xd99c('0x16')],'json':!![]})[_0xd99c('0x10')](function(_0x39c705){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x19'),_0x557692['id']));if(_0x39c705&&_0x39c705['results']&&_0x39c705[_0xd99c('0x1a')]['transcripts']&&_0x39c705['results'][_0xd99c('0x1b')][_0xd99c('0x1c')]){_0x24948d['fileText']='';for(var _0x4af932=0x0;_0x4af932<_0x39c705['results'][_0xd99c('0x1b')]['length'];_0x4af932++){_0x24948d[_0xd99c('0x1d')]+=_0x39c705[_0xd99c('0x1a')][_0xd99c('0x1b')][_0x4af932]['transcript']+'';}}return _0x557692[_0xd99c('0x1e')](_0x24948d);})['then'](function(){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x1f'),_0x557692['id']));if(!_0x557692['tempSentiment']){throw new db['Sequelize'][(_0xd99c('0x20'))](_0xd99c('0x21'));}if(!_0x46150e[_0xd99c('0x22')]||!_0x46150e[_0xd99c('0x23')]||!_0x46150e[_0xd99c('0x24')]||!_0x46150e[_0xd99c('0x25')]||!_0x46150e['bucket']){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))](_0xd99c('0x27'));}if(!_0x24948d['fileText']){throw new Error(_0xd99c('0x28'));}if(_0x46150e[_0xd99c('0x23')]===_0x33a938['id']){return _0x33a938;}else{return db['CloudProvider'][_0xd99c('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xd99c('0x10')](function(_0x4c4405){if(!_0x4c4405){throw new db['Sequelize']['ValidationError'](_0xd99c('0x2a'));}if(!_0x4c4405[_0xd99c('0xe')]||!_0x4c4405['data2']){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x41042a=_0x4c4405;logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x2b'),_0x557692['id']));return sentiment(_0x41042a['data1'],_0x41042a[_0xd99c('0xf')],_0x46150e[_0xd99c('0x24')],_0x24948d[_0xd99c('0x1d')],_0x46150e[_0xd99c('0x25')]);})['then'](function(_0x44bf0e){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x2c'),_0x557692['id']));return _0x557692['update']({'sentiment':_0x44bf0e['Sentiment'],'sPositive':_0x44bf0e['SentimentScore'][_0xd99c('0x2d')],'sNegative':_0x44bf0e[_0xd99c('0x2e')][_0xd99c('0x2f')],'sMixed':_0x44bf0e[_0xd99c('0x2e')][_0xd99c('0x30')],'sNeutral':_0x44bf0e['SentimentScore'][_0xd99c('0x31')]});})['then'](function(){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x1f'),_0x557692['id']));_0x3f5d28();});case _0xd99c('0x32'):return _0x557692['update']({'transcribeStatus':_0xd99c('0x32'),'failureReason':_0x35b50f[_0xd99c('0x13')][_0xd99c('0x33')]})['then'](function(){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x1f'),_0x557692['id']));_0x3f5d28();});default:logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x34'),_0x557692['id']));break;}}else{return BPromise['resolve']()[_0xd99c('0x10')](function(){if(!_0x557692[_0xd99c('0x35')]){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x46150e[_0xd99c('0x22')]||!_0x46150e[_0xd99c('0x23')]||!_0x46150e[_0xd99c('0x24')]||!_0x46150e[_0xd99c('0x25')]||!_0x46150e[_0xd99c('0x36')]){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x557692[_0xd99c('0x1d')]){throw new Error(_0xd99c('0x28'));}if(_0x46150e['sentimentAccountId']===_0x33a938['id']){return _0x33a938;}else{return db[_0xd99c('0x37')][_0xd99c('0x29')]({'where':{'id':_settings[_0xd99c('0x23')]}});}})[_0xd99c('0x10')](function(_0x17c189){if(!_0x17c189){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x17c189[_0xd99c('0xe')]||!_0x17c189[_0xd99c('0xf')]){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))](_0xd99c('0x38'));}_0x41042a=_0x17c189;logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x2b'),_0x557692['id']));return sentiment(_0x41042a[_0xd99c('0xe')],_0x41042a[_0xd99c('0xf')],_0x46150e[_0xd99c('0x24')],_0x557692[_0xd99c('0x1d')],_0x46150e[_0xd99c('0x25')]);})[_0xd99c('0x10')](function(_0x2b836f){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x2c'),_0x557692['id']));return _0x557692[_0xd99c('0x1e')]({'sentiment':_0x2b836f[_0xd99c('0x39')],'sPositive':_0x2b836f['SentimentScore'][_0xd99c('0x2d')],'sNegative':_0x2b836f[_0xd99c('0x2e')][_0xd99c('0x2f')],'sMixed':_0x2b836f[_0xd99c('0x2e')][_0xd99c('0x30')],'sNeutral':_0x2b836f[_0xd99c('0x2e')]['Neutral'],'transcribeStatus':_0xd99c('0x15')});})[_0xd99c('0x10')](function(){logger['info'](util['format'](_0xd99c('0x1f'),_0x557692['id']));_0x3f5d28();});}})[_0xd99c('0x3a')](function(_0x559670){if(_0x559670){if(!_0x559670[_0xd99c('0x3b')]||_0x559670[_0xd99c('0x3b')]!==_0xd99c('0x3c')){logger[_0xd99c('0x3d')](util[_0xd99c('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x557692['id']),util[_0xd99c('0x3e')](_0x559670,{'showHidden':![],'depth':null}));}}_0x3f5d28();});});}function checkTranscribe(){var _0x16a0cd;var _0x5e2550;var _0x2c92d1;return db['VoiceRecording'][_0xd99c('0x3f')]({'where':{'transcribeStatus':_0xd99c('0x40')}})[_0xd99c('0x10')](function(_0x1da7e3){if(!_0x1da7e3||!_0x1da7e3[_0xd99c('0x1c')]){throw new db[(_0xd99c('0x26'))]['ValidationError'](_0xd99c('0x41'));}_0x16a0cd=_0x1da7e3;return db['Setting'][_0xd99c('0x29')]({'where':{'id':0x1}});})[_0xd99c('0x10')](function(_0x3d55f4){if(!_0x3d55f4){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))](_0xd99c('0x42'));}_0x5e2550=_0x3d55f4;if(!_0x5e2550['transcribe']||!_0x5e2550[_0xd99c('0x43')]||!_0x5e2550['transcribeRegion']||!_0x5e2550[_0xd99c('0x25')]||!_0x5e2550[_0xd99c('0x36')]){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))](_0xd99c('0x44'));}return db['CloudProvider'][_0xd99c('0x29')]({'where':{'id':_0x5e2550[_0xd99c('0x43')]}});})[_0xd99c('0x10')](function(_0x251312){if(!_0x251312){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))](_0xd99c('0x2a'));}if(!_0x251312[_0xd99c('0xe')]||!_0x251312[_0xd99c('0xf')]){throw new db['Sequelize'][(_0xd99c('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x2c92d1=_0x251312;var _0x32cbaa=[];_0x16a0cd[_0xd99c('0x45')](function(_0x17ad69){_0x32cbaa[_0xd99c('0x46')](checkTranscribeJob(_0x17ad69,_0x5e2550,_0x2c92d1));});return BPromise[_0xd99c('0x47')](_0x32cbaa);})[_0xd99c('0x3a')](function(_0x4851d5){if(_0x4851d5){if(!_0x4851d5['name']||_0x4851d5['name']!==_0xd99c('0x3c')){logger[_0xd99c('0x3d')](util[_0xd99c('0x3e')](_0x4851d5,{'showHidden':![],'depth':null}));}}});}exports[_0xd99c('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 8da4a0c..1b343eb 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 _0x88a3=['subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','WhatsappInteraction','findAll'];(function(_0xc4bda1,_0x15b608){var _0x15828a=function(_0x513c62){while(--_0x513c62){_0xc4bda1['push'](_0xc4bda1['shift']());}};_0x15828a(++_0x15b608);}(_0x88a3,0x1e1));var _0x388a=function(_0x4c3afd,_0x3e7a45){_0x4c3afd=_0x4c3afd-0x0;var _0x4e2ef3=_0x88a3[_0x4c3afd];return _0x4e2ef3;};'use strict';var _=require(_0x388a('0x0'));var moment=require(_0x388a('0x1'));var Redis=require(_0x388a('0x2'));var util=require(_0x388a('0x3'));var config=require(_0x388a('0x4'));var db=require(_0x388a('0x5'))['db'];var logger=require(_0x388a('0x6'))(_0x388a('0x7'));config[_0x388a('0x8')]=_['defaults'](config['redis'],{'host':_0x388a('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x2ce7eb=[];return db[_0x388a('0xa')][_0x388a('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x388a('0xc')](0x18,_0x388a('0xd'))}}})[_0x388a('0xe')](function(_0x1b5d65){if(_0x1b5d65&&_0x1b5d65[_0x388a('0xf')]){_0x2ce7eb=_[_0x388a('0x10')](_0x1b5d65||[],'id');logger[_0x388a('0x11')](_0x388a('0x12'),_0x2ce7eb[_0x388a('0x13')]());return db[_0x388a('0xa')][_0x388a('0x14')]({'closeReason':_0x388a('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2ce7eb}});}})[_0x388a('0xe')](function(){if(_0x2ce7eb&&_0x2ce7eb[_0x388a('0xf')]){logger[_0x388a('0x11')](_0x388a('0x16'),_0x2ce7eb[_0x388a('0x13')]());for(var _0x6241d3=0x0;_0x6241d3<_0x2ce7eb['length'];_0x6241d3++){io[_0x388a('0x17')](_0x388a('0x18'),{'id':_0x2ce7eb[_0x6241d3],'closed':!![]});}}})[_0x388a('0x19')](function(_0x1eb797){logger['error'](_0x388a('0x1a'),_0x1eb797?util[_0x388a('0x1b')](_0x1eb797,{'showHidden':![],'depth':null}):'');});}exports[_0x388a('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbf91=['lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../mysqldb','../logger','redis','defaults','WhatsappInteraction'];(function(_0x3a67bb,_0x58d761){var _0x314c35=function(_0x572862){while(--_0x572862){_0x3a67bb['push'](_0x3a67bb['shift']());}};_0x314c35(++_0x58d761);}(_0xbf91,0xc1));var _0x1bf9=function(_0x777a68,_0x526ba2){_0x777a68=_0x777a68-0x0;var _0x5796e6=_0xbf91[_0x777a68];return _0x5796e6;};'use strict';var _=require(_0x1bf9('0x0'));var moment=require('moment');var Redis=require(_0x1bf9('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0x1bf9('0x2'))['db'];var logger=require(_0x1bf9('0x3'))('schedule');config[_0x1bf9('0x4')]=_[_0x1bf9('0x5')](config[_0x1bf9('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1bf9('0x4')]));function closeInteractions(){var _0x507cfb=[];return db[_0x1bf9('0x6')]['findAll']({'raw':!![],'attributes':['id',_0x1bf9('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1bf9('0x8')](0x18,_0x1bf9('0x9'))}}})[_0x1bf9('0xa')](function(_0x5ae2d3){if(_0x5ae2d3&&_0x5ae2d3[_0x1bf9('0xb')]){_0x507cfb=_['map'](_0x5ae2d3||[],'id');logger[_0x1bf9('0xc')](_0x1bf9('0xd'),_0x507cfb[_0x1bf9('0xe')]());return db[_0x1bf9('0x6')][_0x1bf9('0xf')]({'closeReason':_0x1bf9('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x1bf9('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x507cfb}});}})['then'](function(){if(_0x507cfb&&_0x507cfb[_0x1bf9('0xb')]){logger[_0x1bf9('0xc')](_0x1bf9('0x12'),_0x507cfb[_0x1bf9('0xe')]());for(var _0x4bd07e=0x0;_0x4bd07e<_0x507cfb[_0x1bf9('0xb')];_0x4bd07e++){io[_0x1bf9('0x13')](_0x1bf9('0x14'),{'id':_0x507cfb[_0x4bd07e],'closed':!![]});}}})[_0x1bf9('0x15')](function(_0x3a96ba){logger['error'](_0x1bf9('0x16'),_0x3a96ba?util[_0x1bf9('0x17')](_0x3a96ba,{'showHidden':![],'depth':null}):'');});}exports[_0x1bf9('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index d38796a..7056686 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x709b=['then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy'];(function(_0x387fbf,_0x23a6e7){var _0xcd3df2=function(_0x23e049){while(--_0x23e049){_0x387fbf['push'](_0x387fbf['shift']());}};_0xcd3df2(++_0x23a6e7);}(_0x709b,0xc8));var _0xb709=function(_0x28f537,_0x2299c2){_0x28f537=_0x28f537-0x0;var _0x4f4951=_0x709b[_0x28f537];return _0x4f4951;};'use strict';var util=require('util');var db=require(_0xb709('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb709('0x1')]({'id':i,'firstName':_0xb709('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xb709('0x3')+i+_0xb709('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb709('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xb709('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xb709('0x2')+i,'lastName':_0xb709('0x6')+i,'phone':0xf879fb460+i,'email':_0xb709('0x3')+i+_0xb709('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb709('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xb709('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb709('0x5')](),'updatedAt':Date[_0xb709('0x5')]()});}db[_0xb709('0x7')][_0xb709('0x8')]({'where':{}})[_0xb709('0x9')](function(){return db[_0xb709('0x7')][_0xb709('0xa')](contacts);})['then'](function(){console[_0xb709('0xb')](_0xb709('0xc'),_0xb709('0xd'));return db[_0xb709('0xe')][_0xb709('0x8')]({'where':{}});})[_0xb709('0x9')](function(){return db['CmHopper'][_0xb709('0xa')](hopper);})['then'](function(){console[_0xb709('0xb')]('finished\x20populating',_0xb709('0xf'));return db[_0xb709('0x7')]['bulkCreate'](contacts2);})[_0xb709('0x9')](function(){console[_0xb709('0xb')](_0xb709('0xc'),_0xb709('0x10'));return db[_0xb709('0xe')][_0xb709('0xa')](hopper2);})['then'](function(){console[_0xb709('0xb')]('finished\x20populating',_0xb709('0x11'));})[_0xb709('0x12')](function(_0x2d06f2){console['log'](_0x2d06f2);}); \ No newline at end of file +var _0xd6d4=['finished\x20populating','CmHopper','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log'];(function(_0x3faba7,_0x78fd2d){var _0x591777=function(_0xf15b91){while(--_0xf15b91){_0x3faba7['push'](_0x3faba7['shift']());}};_0x591777(++_0x78fd2d);}(_0xd6d4,0x1e0));var _0x4d6d=function(_0x53465e,_0x19bf54){_0x53465e=_0x53465e-0x0;var _0x47b1e8=_0xd6d4[_0x53465e];return _0x47b1e8;};'use strict';var util=require(_0x4d6d('0x0'));var db=require(_0x4d6d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4d6d('0x2')]({'id':i,'firstName':_0x4d6d('0x3')+i,'lastName':_0x4d6d('0x4')+i,'phone':0xf879fb460+i,'email':_0x4d6d('0x5')+i+_0x4d6d('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4d6d('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x4d6d('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4d6d('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4d6d('0x2')]({'id':i,'firstName':_0x4d6d('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4d6d('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4d6d('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x4d6d('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4d6d('0x7')]()});}db[_0x4d6d('0x8')][_0x4d6d('0x9')]({'where':{}})[_0x4d6d('0xa')](function(){return db[_0x4d6d('0x8')][_0x4d6d('0xb')](contacts);})[_0x4d6d('0xa')](function(){console[_0x4d6d('0xc')](_0x4d6d('0xd'),'contacts1');return db['CmHopper']['destroy']({'where':{}});})['then'](function(){return db[_0x4d6d('0xe')][_0x4d6d('0xb')](hopper);})['then'](function(){console['log'](_0x4d6d('0xd'),'hopper1');return db[_0x4d6d('0x8')][_0x4d6d('0xb')](contacts2);})[_0x4d6d('0xa')](function(){console['log']('finished\x20populating','contacts2');return db[_0x4d6d('0xe')]['bulkCreate'](hopper2);})['then'](function(){console[_0x4d6d('0xc')](_0x4d6d('0xd'),_0x4d6d('0xf'));})[_0x4d6d('0x10')](function(_0x5b3db6){console[_0x4d6d('0xc')](_0x5b3db6);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 5d603e8..a2bc102 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f0e=['util','push','format','agent','%s%s','wss','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log'];(function(_0x4b5b90,_0x25f0f5){var _0x1ad181=function(_0x45d59c){while(--_0x45d59c){_0x4b5b90['push'](_0x4b5b90['shift']());}};_0x1ad181(++_0x25f0f5);}(_0x2f0e,0x69));var _0xe2f0=function(_0x5b3f52,_0x550380){_0x5b3f52=_0x5b3f52-0x0;var _0x976a58=_0x2f0e[_0x5b3f52];return _0x976a58;};'use strict';var util=require(_0xe2f0('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe2f0('0x1')]({'name':util[_0xe2f0('0x2')]('%s%s',_0xe2f0('0x3'),i),'fullname':util[_0xe2f0('0x2')](_0xe2f0('0x4'),_0xe2f0('0x3'),i),'email':util[_0xe2f0('0x2')]('%s%s@xcally.com',_0xe2f0('0x3'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0xe2f0('0x5')],'disallow':[_0xe2f0('0x6')],'allow':[_0xe2f0('0x7')],'defaultuser':util['format'](_0xe2f0('0x4'),'agent',i),'encryption':_0xe2f0('0x8'),'avpf':_0xe2f0('0x8'),'force_avp':_0xe2f0('0x8'),'icesupport':_0xe2f0('0x8'),'dtlsenable':_0xe2f0('0x8'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xe2f0('0x9'),'callerid':util['format'](_0xe2f0('0xa'),util[_0xe2f0('0x2')](_0xe2f0('0x4'),_0xe2f0('0x3'),i),0xfa0+i)});}db[_0xe2f0('0xb')][_0xe2f0('0xc')](users)[_0xe2f0('0xd')](function(){console[_0xe2f0('0xe')]('add\x20user');})['catch'](function(_0x58f7eb){console['log'](_0x58f7eb);}); \ No newline at end of file +var _0x9c86=['%s%s','agent','password','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','catch','log','util','../mysqldb','push','format'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x9c86,0x13c));var _0x69c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c86[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x69c8('0x0'));var db=require(_0x69c8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x69c8('0x2')]({'name':util[_0x69c8('0x3')](_0x69c8('0x4'),'agent',i),'fullname':util['format'](_0x69c8('0x4'),'agent',i),'email':util[_0x69c8('0x3')]('%s%s@xcally.com',_0x69c8('0x5'),i),'role':_0x69c8('0x5'),'password':_0x69c8('0x6'),'internal':0xfa0+i,'type':_0x69c8('0x7'),'transport':[_0x69c8('0x8'),'ws',_0x69c8('0x9')],'disallow':[_0x69c8('0xa')],'allow':['ulaw'],'defaultuser':util[_0x69c8('0x3')](_0x69c8('0x4'),'agent',i),'encryption':_0x69c8('0xb'),'avpf':_0x69c8('0xb'),'force_avp':_0x69c8('0xb'),'icesupport':_0x69c8('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x69c8('0xc'),'dtlsprivatekey':_0x69c8('0xd'),'dtlssetup':_0x69c8('0xe'),'callerid':util[_0x69c8('0x3')](_0x69c8('0xf'),util[_0x69c8('0x3')](_0x69c8('0x4'),_0x69c8('0x5'),i),0xfa0+i)});}db[_0x69c8('0x10')][_0x69c8('0x11')](users)['then'](function(){console['log']('add\x20user');})[_0x69c8('0x12')](function(_0x1d2959){console[_0x69c8('0x13')](_0x1d2959);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3bb2ee1..05e4739 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce08=['WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','Campaign','format','%s:queue:%s','user:%s','find','userProfileId','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','ChatQueue','Trunk','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','emit','removeMailInteractions','length','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xce08,0xb4));var _0x8ce0=function(_0x28e3bd,_0x4f241e){_0x28e3bd=_0x28e3bd-0x0;var _0xec5ecf=_0xce08[_0x28e3bd];return _0xec5ecf;};'use strict';var _=require(_0x8ce0('0x0'));var util=require(_0x8ce0('0x1'));var BPromise=require(_0x8ce0('0x2'));var db=require(_0x8ce0('0x3'))['db'];var config=require(_0x8ce0('0x4'));var queryQueues={'attributes':['id',_0x8ce0('0x5')],'include':[{'as':_0x8ce0('0x6'),'model':db[_0x8ce0('0x7')],'attributes':['id','name',_0x8ce0('0x8')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8ce0('0x5')],'where':{'role':_0x8ce0('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8ce0('0xa')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8ce0('0x5'),_0x8ce0('0xb')],'where':{'type':_0x8ce0('0xc')}};function getAssociatedResources(_0xbd08b6,_0x733de3,_0x2b5fa9){return db[_0x8ce0('0xd')][_0x8ce0('0xe')]({'where':{'name':_0xbd08b6,'userProfileId':_0x733de3},'raw':!![]})[_0x8ce0('0xf')](function(_0x57133f){if(_0x57133f){if(_0x57133f[_0x8ce0('0x10')]){switch(_0xbd08b6){case _0x8ce0('0x11'):case _0x8ce0('0x12'):case _0x8ce0('0x13'):case _0x8ce0('0x14'):case _0x8ce0('0x15'):case'OpenchannelQueues':case _0x8ce0('0x16'):return db[_0x2b5fa9][_0x8ce0('0x17')](queryQueues);case _0x8ce0('0x18'):return db[_0x2b5fa9]['findAll'](queryTelephones);case _0x8ce0('0x19'):return db[_0x2b5fa9]['findAll'](queryTrunks);case _0x8ce0('0x1a'):return db[_0x2b5fa9][_0x8ce0('0x17')](queryCampaigns);}}else{return db['UserProfileResource'][_0x8ce0('0x17')]({'attributes':[_0x8ce0('0x1b')],'where':{'sectionId':_0x57133f['id']},'raw':!![]})[_0x8ce0('0xf')](function(_0x2f961c){if(_0x2f961c){var _0x88994a={'where':{'id':_[_0x8ce0('0x1c')](_0x2f961c,'resourceId')},'raw':!![]};switch(_0x2b5fa9){case _0x8ce0('0x7'):_0x88994a[_0x8ce0('0x1d')][_0x8ce0('0x8')]=_0x8ce0('0x9');break;case _0x8ce0('0x1e'):_0x88994a[_0x8ce0('0x1d')][_0x8ce0('0xb')]=_0x8ce0('0xc');break;}return db[_0x2b5fa9][_0x8ce0('0x17')](_0x88994a);}else{return[];}});}}else{return[];}})[_0x8ce0('0xf')](function(_0x53d980){return _0x53d980;});}function joinOrLeaveQueues(_0x184f6e,_0x353b9f,_0x2ecdb3,_0x3a97b9){_0x184f6e[_0x353b9f](util[_0x8ce0('0x1f')](_0x8ce0('0x20'),_0x2ecdb3,_0x3a97b9[_0x8ce0('0x5')]));if(_0x3a97b9[_0x8ce0('0x6')]){for(var _0x3d3d6a=0x0;_0x3d3d6a<_0x3a97b9[_0x8ce0('0x6')]['length'];_0x3d3d6a+=0x1){_0x184f6e[_0x353b9f](util[_0x8ce0('0x1f')](_0x8ce0('0x21'),_0x3a97b9[_0x8ce0('0x6')][_0x3d3d6a][_0x8ce0('0x5')]));}}}function joinOrLeave(_0x11c68d,_0x521d6a,_0x9d940){var _0x3b8553;if(_0x11c68d['handshake']['query']['id']){db[_0x8ce0('0x7')][_0x8ce0('0x22')]({'attributes':['id',_0x8ce0('0x5'),_0x8ce0('0x8'),_0x8ce0('0x23')],'where':{'id':_0x11c68d[_0x8ce0('0x24')][_0x8ce0('0x25')]['id']},'include':[{'model':db[_0x8ce0('0x26')],'as':_0x8ce0('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ce0('0x28')],'as':_0x8ce0('0x29'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x8ce0('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ce0('0x2b')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8ce0('0x2c')],'as':_0x8ce0('0x2d'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x8ce0('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x8ce0('0xf')](function(_0x9ac201){if(_0x9ac201){_0x3b8553=_0x9ac201;_0x11c68d[_0x521d6a](util['format'](_0x8ce0('0x21'),_0x9ac201[_0x8ce0('0x5')]));var _0x389138=[];switch(_0x9ac201['role']){case _0x8ce0('0x2f'):_0x11c68d[_0x521d6a](_0x8ce0('0x30'));_0x11c68d[_0x521d6a](_0x8ce0('0x31'));if(queryQueues[_0x8ce0('0x32')](_0x8ce0('0x33'))){delete queryQueues[_0x8ce0('0x33')];}_0x389138['push'](db[_0x8ce0('0x34')][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db['ChatQueue'][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x36')][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x37')][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x38')][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x39')]['findAll'](queryQueues));_0x389138['push'](db[_0x8ce0('0x3a')][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db['User'][_0x8ce0('0x17')](queryTelephones));_0x389138[_0x8ce0('0x35')](db['Trunk'][_0x8ce0('0x17')](queryTrunks));_0x389138[_0x8ce0('0x35')](db['Campaign'][_0x8ce0('0x17')](queryCampaigns));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x7')][_0x8ce0('0x17')](queryAgents));break;case _0x8ce0('0x3b'):_0x11c68d[_0x521d6a](_0x8ce0('0x30'));_0x11c68d[_0x521d6a](_0x8ce0('0x31'));_0x389138['push'](getAssociatedResources('VoiceQueues',_0x9ac201['userProfileId'],_0x8ce0('0x34')));_0x389138['push'](getAssociatedResources(_0x8ce0('0x12'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x3c')));_0x389138['push'](getAssociatedResources(_0x8ce0('0x13'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x36')));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x14'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x37')));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x15'),_0x9ac201[_0x8ce0('0x23')],'MailQueue'));_0x389138['push'](getAssociatedResources('OpenchannelQueues',_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x39')));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x16'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x3a')));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x18'),_0x9ac201[_0x8ce0('0x23')],'User'));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x19'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x3d')));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x1a'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x1e')));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x7')][_0x8ce0('0x17')](queryAgents));break;case'agent':_0x11c68d[_0x521d6a](_0x8ce0('0x30'));_0x11c68d[_0x521d6a]('voice:outbound');_0x389138['push'](_0x9ac201[_0x8ce0('0x3e')]({'attributes':['id',_0x8ce0('0x5')]}));_0x389138['push'](_0x9ac201[_0x8ce0('0x3f')]({'attributes':['id',_0x8ce0('0x5')]}));_0x389138[_0x8ce0('0x35')](_0x9ac201['getFaxQueues']({'attributes':['id','name']}));_0x389138['push'](_0x9ac201[_0x8ce0('0x40')]({'attributes':['id',_0x8ce0('0x5')]}));_0x389138[_0x8ce0('0x35')](_0x9ac201[_0x8ce0('0x41')]({'attributes':['id',_0x8ce0('0x5')]}));_0x389138[_0x8ce0('0x35')](_0x9ac201[_0x8ce0('0x42')]({'attributes':['id',_0x8ce0('0x5')]}));_0x389138[_0x8ce0('0x35')](_0x9ac201[_0x8ce0('0x43')]({'attributes':['id',_0x8ce0('0x5')]}));break;}return BPromise[_0x8ce0('0x44')](_0x389138);}})[_0x8ce0('0xf')](function(_0x1fe6b9){if(_0x1fe6b9&&_0x1fe6b9['length']){for(var _0x14d95a=0x0;_0x14d95a<_0x1fe6b9['length'];_0x14d95a+=0x1){for(var _0x123b4d=0x0;_0x123b4d<_0x1fe6b9[_0x14d95a]['length'];_0x123b4d+=0x1){switch(_0x14d95a){case 0x0:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x45'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x1:joinOrLeaveQueues(_0x11c68d,_0x521d6a,'chat',_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x2:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x46'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x3:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x47'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x4:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x48'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x5:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x49'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x6:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x4a'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x7:if(_0x3b8553[_0x8ce0('0x8')]!==_0x8ce0('0xa'))_0x11c68d[_0x521d6a](util[_0x8ce0('0x1f')](_0x8ce0('0x4b'),_0x1fe6b9[_0x14d95a][_0x123b4d][_0x8ce0('0x5')]));break;case 0x8:if(_0x3b8553[_0x8ce0('0x8')]!==_0x8ce0('0xa'))_0x11c68d[_0x521d6a](util[_0x8ce0('0x1f')]('trunk:%s',_0x1fe6b9[_0x14d95a][_0x123b4d][_0x8ce0('0x5')]));break;case 0x9:if(_0x3b8553[_0x8ce0('0x8')]!==_0x8ce0('0xa'))_0x11c68d[_0x521d6a](util['format'](_0x8ce0('0x4c'),_0x1fe6b9[_0x14d95a][_0x123b4d][_0x8ce0('0xb')],_0x1fe6b9[_0x14d95a][_0x123b4d][_0x8ce0('0x5')]));break;case 0xa:_0x11c68d[_0x521d6a](util[_0x8ce0('0x1f')](_0x8ce0('0x21'),_0x1fe6b9[_0x14d95a][_0x123b4d][_0x8ce0('0x5')]));break;}}}}})['then'](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x53c673=_['map'](_0x3b8553[_0x8ce0('0x27')],'id');return _0x3b8553['removeChatInteractions'](_0x53c673)[_0x8ce0('0xf')](function(){for(var _0x3a1bba=0x0;_0x3a1bba<_0x53c673['length'];_0x3a1bba+=0x1){_0x9d940[_0x8ce0('0x4e')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x53c673[_0x3a1bba]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0xf')](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x83eb79=_[_0x8ce0('0x1c')](_0x3b8553['MailInteractions'],'id');return _0x3b8553[_0x8ce0('0x4f')](_0x83eb79)['then'](function(){for(var _0x31f73d=0x0;_0x31f73d<_0x83eb79[_0x8ce0('0x50')];_0x31f73d+=0x1){_0x9d940[_0x8ce0('0x4e')](_0x8ce0('0x51'),{'MailInteractionId':Number(_0x83eb79[_0x31f73d]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0xf')](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x202226=_[_0x8ce0('0x1c')](_0x3b8553[_0x8ce0('0x2a')],'id');return _0x3b8553[_0x8ce0('0x52')](_0x202226)['then'](function(){for(var _0x451acb=0x0;_0x451acb<_0x202226['length'];_0x451acb+=0x1){_0x9d940[_0x8ce0('0x4e')](_0x8ce0('0x53'),{'FaxInteractionId':Number(_0x202226[_0x451acb]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0xf')](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x5b1cec=_[_0x8ce0('0x1c')](_0x3b8553[_0x8ce0('0x54')],'id');return _0x3b8553[_0x8ce0('0x55')](_0x5b1cec)[_0x8ce0('0xf')](function(){for(var _0x3fc49=0x0;_0x3fc49<_0x5b1cec[_0x8ce0('0x50')];_0x3fc49+=0x1){_0x9d940[_0x8ce0('0x4e')](_0x8ce0('0x56'),{'SmsInteractionId':Number(_0x5b1cec[_0x3fc49]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0xf')](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x21db0c=_[_0x8ce0('0x1c')](_0x3b8553['OpenchannelInteractions'],'id');return _0x3b8553['removeOpenchannelInteractions'](_0x21db0c)[_0x8ce0('0xf')](function(){for(var _0x271886=0x0;_0x271886<_0x21db0c['length'];_0x271886+=0x1){_0x9d940['emit'](_0x8ce0('0x57'),{'OpenchannelInteractionId':Number(_0x21db0c[_0x271886]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0xf')](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x182f63=_['map'](_0x3b8553[_0x8ce0('0x2e')],'id');return _0x3b8553[_0x8ce0('0x58')](_0x182f63)['then'](function(){for(var _0x59f8c2=0x0;_0x59f8c2<_0x182f63[_0x8ce0('0x50')];_0x59f8c2+=0x1){_0x9d940[_0x8ce0('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x182f63[_0x59f8c2]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0x59')](function(_0xf74cc2){_0x11c68d[_0x8ce0('0x5a')](_0xf74cc2);});}}function onDisconnect(_0x16d505,_0x1395b8){joinOrLeave(_0x16d505,_0x8ce0('0x4d'),_0x1395b8);}function onConnect(_0xb00c6f){joinOrLeave(_0xb00c6f,_0x8ce0('0x5b'));}exports[_0x8ce0('0x5c')]=function(_0x5475e6){_0x5475e6['on'](_0x8ce0('0x5d'),function(_0x1c82e9){_0x1c82e9[_0x8ce0('0x5e')](0x0);_0x1c82e9[_0x8ce0('0x5f')]=_0x1c82e9['request'][_0x8ce0('0x5d')][_0x8ce0('0x60')]+':'+_0x1c82e9[_0x8ce0('0x61')][_0x8ce0('0x5d')][_0x8ce0('0x62')];_0x1c82e9[_0x8ce0('0x63')]=new Date();_0x1c82e9[_0x8ce0('0x5a')]=function(_0x32be39){console[_0x8ce0('0x5a')](_0x8ce0('0x64')+_0x1c82e9['nsp'][_0x8ce0('0x5')]+'['+_0x1c82e9[_0x8ce0('0x5f')]+']',_0x32be39);};_0x1c82e9['on']('disconnect',function(){onDisconnect(_0x1c82e9,_0x5475e6);_0x1c82e9[_0x8ce0('0x5a')]('DISCONNECTED');});onConnect(_0x1c82e9);_0x1c82e9[_0x8ce0('0x5a')]('CONNECTED');});}; \ No newline at end of file +var _0xaa56=['SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','length','voice','chat','fax','mail','openchannel','telephone:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','request','remotePort','connectedAt','SocketIO\x20','address','DISCONNECTED','CONNECTED','util','bluebird','./environment','name','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','role','where','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','FaxInteractions'];(function(_0x42b5f2,_0x27e355){var _0x500768=function(_0x341d9c){while(--_0x341d9c){_0x42b5f2['push'](_0x42b5f2['shift']());}};_0x500768(++_0x27e355);}(_0xaa56,0x1ac));var _0x6aa5=function(_0x1a4da1,_0x500266){_0x1a4da1=_0x1a4da1-0x0;var _0x28b9f3=_0xaa56[_0x1a4da1];return _0x28b9f3;};'use strict';var _=require('lodash');var util=require(_0x6aa5('0x0'));var BPromise=require(_0x6aa5('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x6aa5('0x2'));var queryQueues={'attributes':['id',_0x6aa5('0x3')],'include':[{'as':'Agents','model':db[_0x6aa5('0x4')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x6aa5('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6aa5('0x3')],'where':{'role':_0x6aa5('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6aa5('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x6aa5('0x7')],'where':{'type':_0x6aa5('0x8')}};function getAssociatedResources(_0x4e1cf5,_0x33e5ea,_0x3f7863){return db[_0x6aa5('0x9')][_0x6aa5('0xa')]({'where':{'name':_0x4e1cf5,'userProfileId':_0x33e5ea},'raw':!![]})[_0x6aa5('0xb')](function(_0x2c689f){if(_0x2c689f){if(_0x2c689f[_0x6aa5('0xc')]){switch(_0x4e1cf5){case _0x6aa5('0xd'):case _0x6aa5('0xe'):case _0x6aa5('0xf'):case _0x6aa5('0x10'):case'MailQueues':case _0x6aa5('0x11'):case _0x6aa5('0x12'):return db[_0x3f7863][_0x6aa5('0x13')](queryQueues);case'Telephones':return db[_0x3f7863][_0x6aa5('0x13')](queryTelephones);case _0x6aa5('0x14'):return db[_0x3f7863][_0x6aa5('0x13')](queryTrunks);case _0x6aa5('0x15'):return db[_0x3f7863][_0x6aa5('0x13')](queryCampaigns);}}else{return db[_0x6aa5('0x16')][_0x6aa5('0x13')]({'attributes':[_0x6aa5('0x17')],'where':{'sectionId':_0x2c689f['id']},'raw':!![]})[_0x6aa5('0xb')](function(_0x53254d){if(_0x53254d){var _0x33a636={'where':{'id':_['map'](_0x53254d,_0x6aa5('0x17'))},'raw':!![]};switch(_0x3f7863){case _0x6aa5('0x4'):_0x33a636['where'][_0x6aa5('0x18')]=_0x6aa5('0x6');break;case'Campaign':_0x33a636[_0x6aa5('0x19')][_0x6aa5('0x7')]=_0x6aa5('0x8');break;}return db[_0x3f7863][_0x6aa5('0x13')](_0x33a636);}else{return[];}});}}else{return[];}})[_0x6aa5('0xb')](function(_0x4cd123){return _0x4cd123;});}function joinOrLeaveQueues(_0xae4948,_0x20fe4c,_0x1f6458,_0x1e0b1a){_0xae4948[_0x20fe4c](util[_0x6aa5('0x1a')](_0x6aa5('0x1b'),_0x1f6458,_0x1e0b1a['name']));if(_0x1e0b1a['Agents']){for(var _0x5cf787=0x0;_0x5cf787<_0x1e0b1a[_0x6aa5('0x1c')]['length'];_0x5cf787+=0x1){_0xae4948[_0x20fe4c](util[_0x6aa5('0x1a')](_0x6aa5('0x1d'),_0x1e0b1a['Agents'][_0x5cf787][_0x6aa5('0x3')]));}}}function joinOrLeave(_0x80a99,_0x2087d5,_0x40f719){var _0x4bcb11;if(_0x80a99[_0x6aa5('0x1e')][_0x6aa5('0x1f')]['id']){db[_0x6aa5('0x4')][_0x6aa5('0x20')]({'attributes':['id',_0x6aa5('0x3'),_0x6aa5('0x18'),_0x6aa5('0x21')],'where':{'id':_0x80a99[_0x6aa5('0x1e')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x6aa5('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x6aa5('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x6aa5('0x24'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x6aa5('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x6aa5('0x26')],'as':_0x6aa5('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x6aa5('0x28'),'attributes':['id'],'raw':!![]}]})[_0x6aa5('0xb')](function(_0x4b54e0){if(_0x4b54e0){_0x4bcb11=_0x4b54e0;_0x80a99[_0x2087d5](util[_0x6aa5('0x1a')](_0x6aa5('0x1d'),_0x4b54e0[_0x6aa5('0x3')]));var _0x1aff4f=[];switch(_0x4b54e0[_0x6aa5('0x18')]){case _0x6aa5('0x29'):_0x80a99[_0x2087d5](_0x6aa5('0x2a'));_0x80a99[_0x2087d5](_0x6aa5('0x2b'));if(queryQueues[_0x6aa5('0x2c')](_0x6aa5('0x2d'))){delete queryQueues[_0x6aa5('0x2d')];}_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x2f')][_0x6aa5('0x13')](queryQueues));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x30')][_0x6aa5('0x13')](queryQueues));_0x1aff4f['push'](db[_0x6aa5('0x31')]['findAll'](queryQueues));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x32')]['findAll'](queryQueues));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x33')][_0x6aa5('0x13')](queryQueues));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x34')][_0x6aa5('0x13')](queryQueues));_0x1aff4f['push'](db['WhatsappQueue'][_0x6aa5('0x13')](queryQueues));_0x1aff4f[_0x6aa5('0x2e')](db['User'][_0x6aa5('0x13')](queryTelephones));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x35')][_0x6aa5('0x13')](queryTrunks));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x36')]['findAll'](queryCampaigns));_0x1aff4f['push'](db[_0x6aa5('0x4')][_0x6aa5('0x13')](queryAgents));break;case'user':_0x80a99[_0x2087d5]('voice:inbound');_0x80a99[_0x2087d5]('voice:outbound');_0x1aff4f['push'](getAssociatedResources(_0x6aa5('0xd'),_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x2f')));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0xe'),_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x30')));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0xf'),_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x31')));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0x10'),_0x4b54e0['userProfileId'],_0x6aa5('0x32')));_0x1aff4f['push'](getAssociatedResources('MailQueues',_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x33')));_0x1aff4f['push'](getAssociatedResources('OpenchannelQueues',_0x4b54e0['userProfileId'],'OpenchannelQueue'));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0x12'),_0x4b54e0[_0x6aa5('0x21')],'WhatsappQueue'));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources('Telephones',_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x4')));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0x14'),_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x35')));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0x15'),_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x36')));_0x1aff4f['push'](db[_0x6aa5('0x4')][_0x6aa5('0x13')](queryAgents));break;case _0x6aa5('0x5'):_0x80a99[_0x2087d5](_0x6aa5('0x2a'));_0x80a99[_0x2087d5](_0x6aa5('0x2b'));_0x1aff4f[_0x6aa5('0x2e')](_0x4b54e0[_0x6aa5('0x37')]({'attributes':['id',_0x6aa5('0x3')]}));_0x1aff4f[_0x6aa5('0x2e')](_0x4b54e0[_0x6aa5('0x38')]({'attributes':['id','name']}));_0x1aff4f['push'](_0x4b54e0[_0x6aa5('0x39')]({'attributes':['id',_0x6aa5('0x3')]}));_0x1aff4f['push'](_0x4b54e0[_0x6aa5('0x3a')]({'attributes':['id','name']}));_0x1aff4f['push'](_0x4b54e0['getMailQueues']({'attributes':['id',_0x6aa5('0x3')]}));_0x1aff4f[_0x6aa5('0x2e')](_0x4b54e0[_0x6aa5('0x3b')]({'attributes':['id',_0x6aa5('0x3')]}));_0x1aff4f[_0x6aa5('0x2e')](_0x4b54e0['getWhatsappQueues']({'attributes':['id',_0x6aa5('0x3')]}));break;}return BPromise['all'](_0x1aff4f);}})[_0x6aa5('0xb')](function(_0x1b450d){if(_0x1b450d&&_0x1b450d[_0x6aa5('0x3c')]){for(var _0x3386fc=0x0;_0x3386fc<_0x1b450d[_0x6aa5('0x3c')];_0x3386fc+=0x1){for(var _0x51408f=0x0;_0x51408f<_0x1b450d[_0x3386fc][_0x6aa5('0x3c')];_0x51408f+=0x1){switch(_0x3386fc){case 0x0:joinOrLeaveQueues(_0x80a99,_0x2087d5,_0x6aa5('0x3d'),_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x1:joinOrLeaveQueues(_0x80a99,_0x2087d5,_0x6aa5('0x3e'),_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x2:joinOrLeaveQueues(_0x80a99,_0x2087d5,_0x6aa5('0x3f'),_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x3:joinOrLeaveQueues(_0x80a99,_0x2087d5,'sms',_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x4:joinOrLeaveQueues(_0x80a99,_0x2087d5,_0x6aa5('0x40'),_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x5:joinOrLeaveQueues(_0x80a99,_0x2087d5,_0x6aa5('0x41'),_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x6:joinOrLeaveQueues(_0x80a99,_0x2087d5,'whatsapp',_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x7:if(_0x4bcb11[_0x6aa5('0x18')]!==_0x6aa5('0x5'))_0x80a99[_0x2087d5](util['format'](_0x6aa5('0x42'),_0x1b450d[_0x3386fc][_0x51408f][_0x6aa5('0x3')]));break;case 0x8:if(_0x4bcb11[_0x6aa5('0x18')]!==_0x6aa5('0x5'))_0x80a99[_0x2087d5](util[_0x6aa5('0x1a')]('trunk:%s',_0x1b450d[_0x3386fc][_0x51408f][_0x6aa5('0x3')]));break;case 0x9:if(_0x4bcb11[_0x6aa5('0x18')]!=='agent')_0x80a99[_0x2087d5](util[_0x6aa5('0x1a')]('campaign:%s:%s',_0x1b450d[_0x3386fc][_0x51408f][_0x6aa5('0x7')],_0x1b450d[_0x3386fc][_0x51408f]['name']));break;case 0xa:_0x80a99[_0x2087d5](util[_0x6aa5('0x1a')](_0x6aa5('0x1d'),_0x1b450d[_0x3386fc][_0x51408f][_0x6aa5('0x3')]));break;}}}}})[_0x6aa5('0xb')](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0xf55ee4=_[_0x6aa5('0x44')](_0x4bcb11[_0x6aa5('0x22')],'id');return _0x4bcb11[_0x6aa5('0x45')](_0xf55ee4)[_0x6aa5('0xb')](function(){for(var _0x4f2bf7=0x0;_0x4f2bf7<_0xf55ee4[_0x6aa5('0x3c')];_0x4f2bf7+=0x1){_0x40f719[_0x6aa5('0x46')](_0x6aa5('0x47'),{'ChatInteractionId':Number(_0xf55ee4[_0x4f2bf7]),'UserId':Number(_0x4bcb11['id'])});}});}})[_0x6aa5('0xb')](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0x3a72ed=_['map'](_0x4bcb11[_0x6aa5('0x48')],'id');return _0x4bcb11['removeMailInteractions'](_0x3a72ed)[_0x6aa5('0xb')](function(){for(var _0x579e5f=0x0;_0x579e5f<_0x3a72ed['length'];_0x579e5f+=0x1){_0x40f719[_0x6aa5('0x46')](_0x6aa5('0x49'),{'MailInteractionId':Number(_0x3a72ed[_0x579e5f]),'UserId':Number(_0x4bcb11['id'])});}});}})[_0x6aa5('0xb')](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0x21af0b=_['map'](_0x4bcb11[_0x6aa5('0x24')],'id');return _0x4bcb11[_0x6aa5('0x4a')](_0x21af0b)[_0x6aa5('0xb')](function(){for(var _0x1a35e4=0x0;_0x1a35e4<_0x21af0b[_0x6aa5('0x3c')];_0x1a35e4+=0x1){_0x40f719[_0x6aa5('0x46')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x21af0b[_0x1a35e4]),'UserId':Number(_0x4bcb11['id'])});}});}})[_0x6aa5('0xb')](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0x5bbc51=_[_0x6aa5('0x44')](_0x4bcb11[_0x6aa5('0x25')],'id');return _0x4bcb11[_0x6aa5('0x4b')](_0x5bbc51)[_0x6aa5('0xb')](function(){for(var _0x236fcd=0x0;_0x236fcd<_0x5bbc51[_0x6aa5('0x3c')];_0x236fcd+=0x1){_0x40f719[_0x6aa5('0x46')](_0x6aa5('0x4c'),{'SmsInteractionId':Number(_0x5bbc51[_0x236fcd]),'UserId':Number(_0x4bcb11['id'])});}});}})['then'](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0x31babd=_[_0x6aa5('0x44')](_0x4bcb11['OpenchannelInteractions'],'id');return _0x4bcb11[_0x6aa5('0x4d')](_0x31babd)['then'](function(){for(var _0x39ce6b=0x0;_0x39ce6b<_0x31babd['length'];_0x39ce6b+=0x1){_0x40f719[_0x6aa5('0x46')](_0x6aa5('0x4e'),{'OpenchannelInteractionId':Number(_0x31babd[_0x39ce6b]),'UserId':Number(_0x4bcb11['id'])});}});}})[_0x6aa5('0xb')](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0x545cd8=_['map'](_0x4bcb11[_0x6aa5('0x28')],'id');return _0x4bcb11[_0x6aa5('0x4f')](_0x545cd8)[_0x6aa5('0xb')](function(){for(var _0x2cdb57=0x0;_0x2cdb57<_0x545cd8[_0x6aa5('0x3c')];_0x2cdb57+=0x1){_0x40f719[_0x6aa5('0x46')](_0x6aa5('0x50'),{'WhatsappInteractionId':Number(_0x545cd8[_0x2cdb57]),'UserId':Number(_0x4bcb11['id'])});}});}})['catch'](function(_0x591534){_0x80a99[_0x6aa5('0x51')](_0x591534);});}}function onDisconnect(_0x4d5a0f,_0x1a1743){joinOrLeave(_0x4d5a0f,_0x6aa5('0x43'),_0x1a1743);}function onConnect(_0x371622){joinOrLeave(_0x371622,_0x6aa5('0x52'));}exports[_0x6aa5('0x53')]=function(_0x1b29cd){_0x1b29cd['on'](_0x6aa5('0x54'),function(_0xe5cb41){_0xe5cb41[_0x6aa5('0x55')](0x0);_0xe5cb41['address']=_0xe5cb41[_0x6aa5('0x56')][_0x6aa5('0x54')]['remoteAddress']+':'+_0xe5cb41[_0x6aa5('0x56')][_0x6aa5('0x54')][_0x6aa5('0x57')];_0xe5cb41[_0x6aa5('0x58')]=new Date();_0xe5cb41[_0x6aa5('0x51')]=function(_0xb9a370){console[_0x6aa5('0x51')](_0x6aa5('0x59')+_0xe5cb41['nsp'][_0x6aa5('0x3')]+'['+_0xe5cb41[_0x6aa5('0x5a')]+']',_0xb9a370);};_0xe5cb41['on']('disconnect',function(){onDisconnect(_0xe5cb41,_0x1b29cd);_0xe5cb41[_0x6aa5('0x51')](_0x6aa5('0x5b'));});onConnect(_0xe5cb41);_0xe5cb41[_0x6aa5('0x51')](_0x6aa5('0x5c'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index bdc1ae8..418a3f8 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 _0x2ae6=['email','default','hasOwnProperty','model','hook','toLowerCase','util','../../mysqldb','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','info','Trigger,\x20%s','error','code','EventManager','get','channel','motionChannel','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','UserId','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','catch','AfterCreateMessage','opened','SELECT','contact','name','changed','closed','substatus','AfterUpdate','User','find','fullname'];(function(_0x237fe6,_0x4149e2){var _0x584854=function(_0x11a5c2){while(--_0x11a5c2){_0x237fe6['push'](_0x237fe6['shift']());}};_0x584854(++_0x4149e2);}(_0x2ae6,0x9c));var _0x62ae=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x2ae6[_0x1969a7];return _0x3d665f;};'use strict';var util=require(_0x62ae('0x0'));var db=require(_0x62ae('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x62ae('0x2'))(_0x62ae('0x3'));var client=jayson[_0x62ae('0x4')][_0x62ae('0x5')]({'port':0x232a});var triggers=[{'channel':_0x62ae('0x6'),'model':_0x62ae('0x7'),'event':_0x62ae('0x8'),'condition':_0x62ae('0x9'),'callback':afterCreate},{'channel':'Chat','model':_0x62ae('0x7'),'event':_0x62ae('0xa'),'condition':_0x62ae('0xb'),'callback':afterUpdate},{'channel':_0x62ae('0x6'),'model':_0x62ae('0xc'),'event':_0x62ae('0x8'),'condition':_0x62ae('0xd'),'callback':afterCreateMessage},{'channel':_0x62ae('0x6'),'model':_0x62ae('0xe'),'event':_0x62ae('0x8'),'condition':_0x62ae('0xd'),'callback':afterCreateOfflineMessage},{'channel':_0x62ae('0xf'),'model':_0x62ae('0x10'),'event':_0x62ae('0x8'),'condition':_0x62ae('0x9'),'callback':afterCreate},{'channel':_0x62ae('0xf'),'model':_0x62ae('0x10'),'event':'afterUpdate','condition':_0x62ae('0xb'),'callback':afterUpdate},{'channel':_0x62ae('0xf'),'model':_0x62ae('0x11'),'event':_0x62ae('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x62ae('0x12'),'model':_0x62ae('0x13'),'event':_0x62ae('0x8'),'condition':_0x62ae('0x9'),'callback':afterCreate},{'channel':_0x62ae('0x12'),'model':_0x62ae('0x13'),'event':'afterUpdate','condition':_0x62ae('0xb'),'callback':afterUpdate},{'channel':_0x62ae('0x12'),'model':_0x62ae('0x14'),'event':'afterCreate','condition':_0x62ae('0xd'),'callback':afterCreateMessage},{'channel':_0x62ae('0x15'),'model':_0x62ae('0x16'),'event':_0x62ae('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x62ae('0x15'),'model':_0x62ae('0x16'),'event':_0x62ae('0xa'),'condition':_0x62ae('0xb'),'callback':afterUpdate},{'channel':_0x62ae('0x15'),'model':'FaxMessage','event':'afterCreate','condition':_0x62ae('0xd'),'callback':afterCreateMessage},{'channel':_0x62ae('0x17'),'model':_0x62ae('0x18'),'event':_0x62ae('0x8'),'condition':_0x62ae('0x9'),'callback':afterCreate},{'channel':'Mail','model':_0x62ae('0x18'),'event':_0x62ae('0xa'),'condition':_0x62ae('0xb'),'callback':afterUpdate},{'channel':_0x62ae('0x17'),'model':_0x62ae('0x19'),'event':'afterCreate','condition':_0x62ae('0xd'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x62ae('0x1a'),'event':_0x62ae('0x8'),'condition':_0x62ae('0x9'),'callback':afterCreate},{'channel':'Openchannel','model':_0x62ae('0x1a'),'event':_0x62ae('0xa'),'condition':_0x62ae('0xb'),'callback':afterUpdate},{'channel':_0x62ae('0x1b'),'model':_0x62ae('0x1c'),'event':_0x62ae('0x8'),'condition':_0x62ae('0xd'),'callback':afterCreateMessage}];function request(_0x3849ca){return client[_0x62ae('0x1d')]('EventManager',_0x3849ca)['then'](function(_0xe05daa){logger[_0x62ae('0x1e')](_0x62ae('0x1f'),'EventManager',_0xe05daa);if(_0xe05daa[_0x62ae('0x20')]){if(_0xe05daa[_0x62ae('0x20')][_0x62ae('0x21')]===0x1f4){logger[_0x62ae('0x20')]('Trigger,\x20%s',_0x62ae('0x22'),_0xe05daa[_0x62ae('0x20')]);}}})['catch'](function(_0x4ac270){logger[_0x62ae('0x20')](_0x62ae('0x1f'),_0x62ae('0x22'),_0x4ac270);});}function afterCreateMessage(_0x733a07){return function(_0x2e8dae){_0x2e8dae=_0x2e8dae[_0x62ae('0x23')]({'plain':!![]});_0x2e8dae[_0x62ae('0x24')]=_0x733a07;_0x2e8dae[_0x62ae('0x25')]=_0x733a07;_0x2e8dae[_0x62ae('0x26')]=_0x2e8dae[_0x62ae('0x27')];Promise[_0x62ae('0x28')]()[_0x62ae('0x29')](function(){if(typeof _0x2e8dae[_0x62ae('0x2a')]===_0x62ae('0x2b'))return null;var _0x34c3d8=_0x62ae('0x2c')+_0x2e8dae[_0x62ae('0x2a')];return db[_0x62ae('0x2d')][_0x62ae('0x2e')](_0x34c3d8,{'type':db[_0x62ae('0x2f')][_0x62ae('0x30')]['SELECT'],'raw':!![]});})[_0x62ae('0x29')](function(_0x5ae924){if(_0x5ae924){_0x2e8dae['contact']=_0x5ae924[0x0];}if(typeof _0x2e8dae[_0x62ae('0x31')]===_0x62ae('0x2b'))return;return getAgent(_0x2e8dae[_0x62ae('0x31')]);})[_0x62ae('0x29')](function(_0x21a0c9){if(_0x21a0c9){_0x2e8dae[_0x62ae('0x32')]=util[_0x62ae('0x33')](_0x62ae('0x34'),_0x21a0c9['name']);_0x2e8dae[_0x62ae('0x35')]=_0x21a0c9;_0x2e8dae[_0x62ae('0x24')]=_0x733a07;return request({'event':_0x62ae('0x36'),'message':_0x2e8dae});}else{return request({'event':_0x62ae('0x37'),'message':_0x2e8dae});}})[_0x62ae('0x38')](function(_0x5289c7){logger[_0x62ae('0x20')](_0x62ae('0x1f'),_0x62ae('0x39'),_0x5289c7);});};}function afterCreateOfflineMessage(_0x5ba4c5){return function(_0x163e63){_0x163e63=_0x163e63[_0x62ae('0x23')]({'plain':!![]});_0x163e63[_0x62ae('0x24')]=_0x5ba4c5;_0x163e63[_0x62ae('0x25')]=_0x5ba4c5;_0x163e63[_0x62ae('0x26')]='offlineMessage';return request({'event':_0x163e63[_0x62ae('0x26')],'message':_0x163e63});};}function afterCreate(_0x2a3e53,_0x3d8c71){return function(_0x32db22){_0x32db22=_0x32db22['get']({'plain':!![]});_0x32db22[_0x62ae('0x24')]=_0x2a3e53;_0x32db22['motionChannel']=_0x2a3e53;_0x32db22[_0x62ae('0x26')]=_0x62ae('0x3a');Promise[_0x62ae('0x28')]()[_0x62ae('0x29')](function(){var _0x1afef6=_0x62ae('0x2c')+_0x32db22[_0x62ae('0x2a')];return db['sequelize']['query'](_0x1afef6,{'type':db[_0x62ae('0x2f')][_0x62ae('0x30')][_0x62ae('0x3b')],'raw':!![]});})[_0x62ae('0x29')](function(_0x2ebc1a){if(_0x2ebc1a){_0x32db22[_0x62ae('0x3c')]=_0x2ebc1a[0x0];}if(typeof _0x32db22[_0x62ae('0x31')]===_0x62ae('0x2b'))return;return getAgent(_0x32db22['UserId']);})[_0x62ae('0x29')](function(_0x2aecdb){if(_0x2aecdb){_0x32db22['interface']=util[_0x62ae('0x33')](_0x62ae('0x34'),_0x2aecdb[_0x62ae('0x3d')]);_0x32db22[_0x62ae('0x35')]=_0x2aecdb;}return request({'event':_0x3d8c71,'message':_0x32db22});})[_0x62ae('0x38')](function(_0x47d8b6){logger[_0x62ae('0x20')](_0x62ae('0x1f'),'AfterCreate',_0x47d8b6);});};}function afterUpdate(_0x2523b4){return function(_0x26d78c){var _0x56630e=_0x26d78c[_0x62ae('0x3e')](_0x62ae('0x3f'))&&_0x26d78c['closed'];var _0x328799=_0x26d78c[_0x62ae('0x3e')](_0x62ae('0x40'));if(_0x56630e||_0x328799){var _0x1ca37b=_0x56630e?'closedinteraction':'substatus';var _0x85ced8=_0x26d78c['get']({'plain':!![]});_0x85ced8[_0x62ae('0x24')]=_0x2523b4;_0x85ced8['motionChannel']=_0x2523b4;_0x85ced8[_0x62ae('0x26')]=_0x56630e?'closed':'substatus';var _0x21d886=_0x62ae('0x2c')+_0x85ced8[_0x62ae('0x2a')];return db[_0x62ae('0x2d')][_0x62ae('0x2e')](_0x21d886,{'type':db['Sequelize'][_0x62ae('0x30')][_0x62ae('0x3b')],'raw':!![]})[_0x62ae('0x29')](function(_0x6237d4){if(_0x6237d4){_0x85ced8[_0x62ae('0x3c')]=_0x6237d4[0x0];}if(typeof _0x85ced8['UserId']===_0x62ae('0x2b'))return;return getAgent(_0x85ced8[_0x62ae('0x31')]);})[_0x62ae('0x29')](function(_0x2599f7){if(_0x2599f7){_0x85ced8['interface']=util[_0x62ae('0x33')](_0x62ae('0x34'),_0x2599f7[_0x62ae('0x3d')]);_0x85ced8[_0x62ae('0x35')]=_0x2599f7;}return request({'event':_0x1ca37b,'message':_0x85ced8});})[_0x62ae('0x38')](function(_0x1e29e0){logger[_0x62ae('0x20')](_0x62ae('0x1f'),_0x62ae('0x41'),_0x1e29e0);});}};}function getAgent(_0x51ab7d){return db[_0x62ae('0x42')][_0x62ae('0x43')]({'where':{'id':_0x51ab7d},'attributes':['id',_0x62ae('0x3d'),_0x62ae('0x44'),_0x62ae('0x45'),'internal'],'raw':!![]})[_0x62ae('0x29')](function(_0x1e4bde){return _0x1e4bde;});}exports[_0x62ae('0x46')]=function(){for(var _0x606254=0x0;_0x606254=_0x59c909[_0x6635('0x17')]){throw Error(_0x6635('0x18'));}_0x2164c2(_0x40786b);})[_0x6635('0x19')](function(_0x37e6b1){_0x5b1ecb(_0x37e6b1);});});}; \ No newline at end of file +var _0xf0b5=['voice','chat','fax','sms','whatsapp','openchannel','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','getLicense','role','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','./license/util'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0xf0b5,0x149));var _0x5f0b=function(_0x19dfc4,_0x4ee46c){_0x19dfc4=_0x19dfc4-0x0;var _0x454c9d=_0xf0b5[_0x19dfc4];return _0x454c9d;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x5f0b('0x0'));var channels=[_0x5f0b('0x1'),'mail',_0x5f0b('0x2'),_0x5f0b('0x3'),_0x5f0b('0x4'),_0x5f0b('0x5'),_0x5f0b('0x6')];exports['getChannels']=function(){return channels;};exports[_0x5f0b('0x7')]=function(_0x3c356f){_0x3c356f=_0x3c356f[_0x5f0b('0x8')]();return _[_0x5f0b('0x9')](channels,_0x3c356f);};exports[_0x5f0b('0xa')]=function(_0x2e650e,_0x5dbb2f,_0x492522,_0x2ba52a){var _0xa82264={'loginAttempts':_0x5dbb2f,'blocked':_0x492522};if(!_[_0x5f0b('0xb')](_0x2ba52a)){_0xa82264[_0x5f0b('0xc')]=_0x2ba52a;}return _0x2e650e['updateAttributes'](_0xa82264);};exports[_0x5f0b('0xd')]=function(_0x114969){return new BPromise(function(_0x593da4,_0x59bee5){var _0x3f6117=0x0;if(_0x114969[_0x5f0b('0xe')]!=='agent'){_0x593da4(_0x114969);}db[_0x5f0b('0xf')][_0x5f0b('0x10')]({'where':{'role':_0x5f0b('0x11'),'online':!![],'id':{'$ne':_0x114969['id']}}})[_0x5f0b('0x12')](function(_0x4c40fe){_0x3f6117=_0x4c40fe;return util[_0x5f0b('0xd')]();})['then'](function(_0x1cae31){if(_0x1cae31&&_0x1cae31[_0x5f0b('0x13')]&&_0x3f6117>=_0x1cae31[_0x5f0b('0x13')]){throw Error(_0x5f0b('0x14'));}_0x593da4(_0x114969);})[_0x5f0b('0x15')](function(_0x59f480){_0x59bee5(_0x59f480);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index b8602c2..9587ab3 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['exports','../config/logger','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','OutOfInterval','error','stack','send'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4873f5,_0x43c409){_0x4873f5=_0x4873f5-0x0;var _0x1402d2=_0x9bde[_0x4873f5];return _0x1402d2;};'use strict';var util=require('util');var logger=require(_0xe9bd('0x0'))('api');var APIError=function(_0xc79e0b,_0x4c63ca){this[_0xe9bd('0x1')]=_0xc79e0b||_0xe9bd('0x2');this[_0xe9bd('0x3')]=_0x4c63ca||_0xe9bd('0x4');util[_0xe9bd('0x5')](APIError,Error);};var APIBadRequestError=function(_0x1a4d14){this[_0xe9bd('0x1')]=_0x1a4d14||'Bad\x20Request';this[_0xe9bd('0x3')]=_0xe9bd('0x6');util[_0xe9bd('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xa66ae2){this[_0xe9bd('0x1')]=_0xa66ae2||_0xe9bd('0x7');this[_0xe9bd('0x3')]=_0xe9bd('0x8');util[_0xe9bd('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x45c7ba){switch(_0x45c7ba){case'Bad\x20Request':return 0x190;case'Forbidden',_0xe9bd('0x9'):return 0x193;case _0xe9bd('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x2601ac){return function(_0x581ab9){logger[_0xe9bd('0xa')](_0x581ab9[_0xe9bd('0xb')]);var _0x3339f9=getStatusCode(_0x581ab9[_0xe9bd('0x3')]);if(_0x581ab9['name'])delete _0x581ab9[_0xe9bd('0x3')];return _0x2601ac['status'](_0x3339f9)[_0xe9bd('0xc')](_0x581ab9);};}module[_0xe9bd('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x878f=['Bad\x20Request','Forbidden','Not\x20Found','error','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x878f,0x173));var _0xf878=function(_0x4fc508,_0x37bd1d){_0x4fc508=_0x4fc508-0x0;var _0x437160=_0x878f[_0x4fc508];return _0x437160;};'use strict';var util=require('util');var logger=require(_0xf878('0x0'))(_0xf878('0x1'));var APIError=function(_0x2e1d23,_0x12df2b){this[_0xf878('0x2')]=_0x2e1d23||_0xf878('0x3');this[_0xf878('0x4')]=_0x12df2b||_0xf878('0x5');util[_0xf878('0x6')](APIError,Error);};var APIBadRequestError=function(_0xcf1927){this[_0xf878('0x2')]=_0xcf1927||'Bad\x20Request';this['name']=_0xf878('0x7');util[_0xf878('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x59e564){this['message']=_0x59e564||'Entity\x20not\x20found';this[_0xf878('0x4')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x307653){switch(_0x307653){case _0xf878('0x7'):return 0x190;case _0xf878('0x8'),'OutOfInterval':return 0x193;case _0xf878('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x1399a3){return function(_0x531b9c){logger[_0xf878('0xa')](_0x531b9c['stack']);var _0x31d3d2=getStatusCode(_0x531b9c[_0xf878('0x4')]);if(_0x531b9c[_0xf878('0x4')])delete _0x531b9c['name'];return _0x1399a3[_0xf878('0xb')](_0x31d3d2)[_0xf878('0xc')](_0x531b9c);};}module[_0xf878('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 0dea5a9..a88aa80 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf79b=['404','status','render','json','send'];(function(_0xc2efdb,_0xf7047){var _0x4c98c4=function(_0x16c6a2){while(--_0x16c6a2){_0xc2efdb['push'](_0xc2efdb['shift']());}};_0x4c98c4(++_0xf7047);}(_0xf79b,0xa0));var _0xbf79=function(_0x2da485,_0x45b3f2){_0x2da485=_0x2da485-0x0;var _0x33a0ec=_0xf79b[_0x2da485];return _0x33a0ec;};'use strict';module['exports'][0x194]=function pageNotFound(_0x2ac377,_0x15d780){var _0x5389ed=_0xbf79('0x0');var _0x157ab6=0x194;var _0x1a53e4={'status':_0x157ab6};_0x15d780['status'](_0x1a53e4[_0xbf79('0x1')]);_0x15d780[_0xbf79('0x2')](_0x5389ed,{},function(_0x238ca0,_0x106e28){if(_0x238ca0){return _0x15d780[_0xbf79('0x1')](_0x1a53e4[_0xbf79('0x1')])[_0xbf79('0x3')](_0x1a53e4);}_0x15d780[_0xbf79('0x4')](_0x106e28);});}; \ No newline at end of file +var _0xd57b=['send','exports','status','render','json'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xd57b,0x1be));var _0xbd57=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xd57b[_0x5627e1];return _0x2f013f;};'use strict';module[_0xbd57('0x0')][0x194]=function pageNotFound(_0x4a638e,_0x5c869b){var _0x4c253e='404';var _0x179012=0x194;var _0x98d4c4={'status':_0x179012};_0x5c869b[_0xbd57('0x1')](_0x98d4c4['status']);_0x5c869b[_0xbd57('0x2')](_0x4c253e,{},function(_0x590dc4,_0x169563){if(_0x590dc4){return _0x5c869b['status'](_0x98d4c4[_0xbd57('0x1')])[_0xbd57('0x3')](_0x98d4c4);}_0x5c869b[_0xbd57('0x4')](_0x169563);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e9d39b7..6c7f8d0 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dca=['UserFaxQueue','SmsQueues','OpenchannelQueue','UserOpenchannelQueue','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','uniqueid','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','Smtp','CannedAnswer','Answers','Interactions','Applications','List','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','Contact','Owner','mail_interaction_has_tags','Users','MailInteractionId','Attachments','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','Dashboard','Items','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Interaction','Attachment','AttachmentId','team_has_fax_queues','Dispositions','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','Tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','OpenchannelQueueReport','ChatApplication','Agent','Queue','Website','chat_interaction_has_tags','ChatInteractionId','ChatMessage','ChatGroupId','Contacts','CompanyId','ChatInteractions','Company','cm_contact_has_tags','CmHopperId','CampaignId','OwnerId','Automation','Condition','All','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticCustomReport','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','AnalyticMetric','Fields','MetricId','Configurations','AccountId','Subjects','Descriptions','FieldId','Subject','SubjectId','Description','DescriptionId','VariableId','Field','int_desk_configuration_has_tags','ZohoField','ZendeskConfiguration','ZendeskField','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Account','FromId','ToId','SessionId','JscriptyAnswerReport','ProjectId','team_has_chat_queues','ChatQueues','OpenchannelQueues','team_has_whatsapp_queues','WhatsappQueues','VoicePrefix','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','exports','../config/environment','sequelize','lodash','jstz','determine','xcall','xC@LL1234','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','mysql','name','database','password','options','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperHistory','ReportAgentPreview','CmCustomField','Action','../api/action/action.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','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','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','CmHopperFinal','HopperFinals','OpenchannelInteractions','ChatInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','Team','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','FaxQueue','FaxQueues'];(function(_0x3e1fc4,_0x5dd8e2){var _0x2e4405=function(_0xb15d38){while(--_0xb15d38){_0x3e1fc4['push'](_0x3e1fc4['shift']());}};_0x2e4405(++_0x5dd8e2);}(_0x7dca,0xd2));var _0xa7dc=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x7dca[_0x101e7b];return _0x4995c0;};'use strict';var config=require(_0xa7dc('0x0'));var Sequelize=require(_0xa7dc('0x1'));var _=require(_0xa7dc('0x2'));var jstz=require(_0xa7dc('0x3'));var timezone=jstz[_0xa7dc('0x4')]();config[_0xa7dc('0x1')]=_['defaultsDeep'](config[_0xa7dc('0x1')],{'database':'motion2','username':_0xa7dc('0x5'),'password':_0xa7dc('0x6'),'options':{'host':_0xa7dc('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xa7dc('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xa7dc('0x9'),'collate':_0xa7dc('0xa')}}});config[_0xa7dc('0xb')]=_[_0xa7dc('0xc')](config[_0xa7dc('0xb')],{'database':_0xa7dc('0xd'),'username':_0xa7dc('0x5'),'password':_0xa7dc('0x6'),'options':{'host':_0xa7dc('0x7'),'port':0xcea,'dialect':_0xa7dc('0xe'),'dialectOptions':{'charset':_0xa7dc('0x8')},'logging':![],'timezone':timezone[_0xa7dc('0xf')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xa7dc('0x10')],config[_0xa7dc('0x1')]['username'],config[_0xa7dc('0x1')][_0xa7dc('0x11')],config[_0xa7dc('0x1')][_0xa7dc('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa7dc('0xb')][_0xa7dc('0x10')],config[_0xa7dc('0xb')]['username'],config[_0xa7dc('0xb')][_0xa7dc('0x11')],config['sequelizeHistory'][_0xa7dc('0x12')])};db[_0xa7dc('0x13')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x14'));db[_0xa7dc('0x15')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x17'));db[_0xa7dc('0x18')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x19'));db['VoiceExtension']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x1a'));db[_0xa7dc('0x1b')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x1c'));db[_0xa7dc('0x1d')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x1e'));db[_0xa7dc('0x1f')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x20'));db[_0xa7dc('0x21')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/screenRecording/screenRecording.model');db[_0xa7dc('0x22')]=db['sequelize']['import']('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x23'));db[_0xa7dc('0x24')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x25'));db[_0xa7dc('0x26')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x27'));db[_0xa7dc('0x28')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x29'));db[_0xa7dc('0x2a')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x2b'));db[_0xa7dc('0x2c')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x2d'));db['Trunk']=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x2e'));db[_0xa7dc('0x2f')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize'][_0xa7dc('0x16')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xa7dc('0x30')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x31'));db[_0xa7dc('0x32')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x33'));db[_0xa7dc('0x34')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x35'));db['UserFaxQueue']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x36'));db[_0xa7dc('0x37')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x38'));db['UserOpenchannelQueue']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x39'));db[_0xa7dc('0x3a')]=db['sequelize'][_0xa7dc('0x16')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x3b'));db[_0xa7dc('0x3c')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/mailServerOut/mailServerOut.model');db[_0xa7dc('0x3d')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x3e'));db[_0xa7dc('0x3f')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/mailQueue/mailQueue.model');db[_0xa7dc('0x40')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x41'));db[_0xa7dc('0x42')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/mailInteraction/mailInteraction.model');db[_0xa7dc('0x43')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x44'));db[_0xa7dc('0x45')]=db['sequelize']['import'](_0xa7dc('0x46'));db['MailQueueReport']=db['sequelize']['import'](_0xa7dc('0x47'));db['Dashboard']=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/dashboard/dashboard.model');db[_0xa7dc('0x48')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x49'));db['FaxAccount']=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/faxAccount/faxAccount.model');db[_0xa7dc('0x4a')]=db['sequelize']['import']('../api/faxApplication/faxApplication.model');db[_0xa7dc('0x4b')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x4c'));db['FaxMessage']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x4d'));db['FaxQueue']=db[_0xa7dc('0x1')]['import']('../api/faxQueue/faxQueue.model');db[_0xa7dc('0x4e')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x4f'));db[_0xa7dc('0x50')]=db['sequelize']['import'](_0xa7dc('0x51'));db[_0xa7dc('0x52')]=db['sequelize']['import']('../api/smsApplication/smsApplication.model');db[_0xa7dc('0x53')]=db['sequelize'][_0xa7dc('0x16')]('../api/smsInteraction/smsInteraction.model');db[_0xa7dc('0x54')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/smsMessage/smsMessage.model');db[_0xa7dc('0x55')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x56'));db[_0xa7dc('0x57')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x58'));db[_0xa7dc('0x59')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x5a'));db[_0xa7dc('0x5b')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x5c'));db[_0xa7dc('0x5d')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x5e'));db['OpenchannelQueue']=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x5f'));db[_0xa7dc('0x60')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x61'));db['OpenchannelQueueReport']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x62'));db['ChatApplication']=db['sequelize'][_0xa7dc('0x16')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x63'));db['ChatMessage']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x64'));db[_0xa7dc('0x65')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x66'));db[_0xa7dc('0x67')]=db['sequelize']['import'](_0xa7dc('0x68'));db[_0xa7dc('0x69')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x6a'));db['ChatProactiveAction']=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x6b'));db['CmCompany']=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x6c'));db[_0xa7dc('0x6d')]=db[_0xa7dc('0x1')]['import']('../api/cmContact/cmContact.model');db[_0xa7dc('0x6e')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x6f'));db['CmHopperBlack']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x70'));db['CmHopperFinal']=db['sequelize'][_0xa7dc('0x16')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xa7dc('0x71')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xa7dc('0x72')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xa7dc('0x73')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/cmCustomField/cmCustomField.model');db[_0xa7dc('0x74')]=db['sequelize']['import'](_0xa7dc('0x75'));db['Automation']=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x76'));db['CannedAnswer']=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x77'));db[_0xa7dc('0x78')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x79'));db['Condition']=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x7a'));db[_0xa7dc('0x7b')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x7c'));db[_0xa7dc('0x7d')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x7e'));db[_0xa7dc('0x7f')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x80'));db[_0xa7dc('0x81')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x82'));db[_0xa7dc('0x83')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x84'));db[_0xa7dc('0x85')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x86'));db[_0xa7dc('0x87')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/tag/tag.model');db[_0xa7dc('0x88')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x89'));db[_0xa7dc('0x8a')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x8b'));db[_0xa7dc('0x8c')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x8d'));db[_0xa7dc('0x8e')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x8f'));db[_0xa7dc('0x90')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x91'));db[_0xa7dc('0x92')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x93'));db[_0xa7dc('0x94')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x95'));db['IntegrationReport']=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x96'));db['AnalyticCustomReport']=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xa7dc('0x97')]=db['sequelize']['import'](_0xa7dc('0x98'));db['AnalyticExtractedReport']=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x99'));db['AnalyticMetric']=db['sequelize']['import'](_0xa7dc('0x9a'));db['AnalyticFieldReport']=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x9b'));db[_0xa7dc('0x9c')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x9d'));db[_0xa7dc('0x9e')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x9f'));db[_0xa7dc('0xa0')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/intSalesforceField/intSalesforceField.model');db[_0xa7dc('0xa1')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xa2'));db[_0xa7dc('0xa3')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xa4'));db[_0xa7dc('0xa5')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xa7dc('0xa6')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xa7'));db[_0xa7dc('0xa8')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xa9'));db[_0xa7dc('0xaa')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0xab'));db[_0xa7dc('0xac')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xad'));db[_0xa7dc('0xae')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/intZohoField/intZohoField.model');db[_0xa7dc('0xaf')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xb0'));db['ZendeskConfiguration']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xb1'));db['ZendeskField']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xb2'));db[_0xa7dc('0xb3')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xb4'));db['FreshdeskConfiguration']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xb5'));db[_0xa7dc('0xb6')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xa7dc('0xb7')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xb8'));db[_0xa7dc('0xb9')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xba'));db[_0xa7dc('0xbb')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0xbc'));db['ServicenowAccount']=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xbd'));db[_0xa7dc('0xbe')]=db[_0xa7dc('0x1')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xa7dc('0xbf')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xc0'));db['Dynamics365Account']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xc1'));db[_0xa7dc('0xc2')]=db['sequelize'][_0xa7dc('0x16')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xa7dc('0xc3')]=db['sequelize'][_0xa7dc('0x16')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xa7dc('0xc4')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xa7dc('0xc5')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xc6'));db[_0xa7dc('0xc7')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xc8'));db[_0xa7dc('0x94')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0x95'));db[_0xa7dc('0xc9')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xca'));db[_0xa7dc('0xcb')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xcc'));db[_0xa7dc('0xcd')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0xce'));db['JscriptyAnswerReport']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xcf'));db[_0xa7dc('0xd0')]=db['sequelize'][_0xa7dc('0x16')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xd1'));db[_0xa7dc('0xd2')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0xd3'));db['SquareReport']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xd4'));db[_0xa7dc('0xd5')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/squareReportDetail/squareReportDetail.model');db[_0xa7dc('0xd6')]=db['sequelize'][_0xa7dc('0x16')]('../api/jscriptyProject/jscriptyProject.model');db[_0xa7dc('0xd7')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xd8'));db[_0xa7dc('0xd9')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xda'));db[_0xa7dc('0xdb')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/squareProject/squareProject.model');db[_0xa7dc('0xdc')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/squareRecording/squareRecording.model');db[_0xa7dc('0xdd')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xde'));db['Team']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xdf'));db[_0xa7dc('0xe0')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xe1'));db[_0xa7dc('0xe2')]=db['sequelize']['import'](_0xa7dc('0xe3'));db[_0xa7dc('0xe4')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0xe5'));db['Attachment']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xe6'));db[_0xa7dc('0xe7')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/plugin/plugin.model');db[_0xa7dc('0xe8')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xe9'));db[_0xa7dc('0xea')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xeb'));db[_0xa7dc('0xec')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xed'));db['OpenchannelTransferReport']=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0xee'));db[_0xa7dc('0xef')]=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xf0'));db[_0xa7dc('0xf1')]=db['sequelize'][_0xa7dc('0x16')]('../api/cmList/cmList.model');db['VoicePrefix']=db['sequelize']['import'](_0xa7dc('0xf2'));db['UserProfile']=db[_0xa7dc('0x1')]['import'](_0xa7dc('0xf3'));db[_0xa7dc('0xf4')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xf5'));db['UserProfileResource']=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xf6'));db[_0xa7dc('0xf7')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xf8'));db[_0xa7dc('0xf9')]=db[_0xa7dc('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0xa7dc('0xfa')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0xfb'));db[_0xa7dc('0xfc')]=db[_0xa7dc('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xa7dc('0xfd')]=db['sequelize'][_0xa7dc('0x16')]('../api/whatsappMessage/whatsappMessage.model');db[_0xa7dc('0xfe')]=db[_0xa7dc('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xa7dc('0xff')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x100'));db[_0xa7dc('0x101')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x102'));db[_0xa7dc('0x103')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0xa7dc('0x1')][_0xa7dc('0x16')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xa7dc('0x104')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x105'));db[_0xa7dc('0x106')]=db[_0xa7dc('0x1')][_0xa7dc('0x16')](_0xa7dc('0x107'));db[_0xa7dc('0x108')]=db['sequelize'][_0xa7dc('0x16')](_0xa7dc('0x109'));db['User'][_0xa7dc('0x10a')](db[_0xa7dc('0x22')],{'as':'VoiceMail','onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x10c')});db['User'][_0xa7dc('0x10a')](db[_0xa7dc('0x108')],{'as':_0xa7dc('0x10d'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x13')][_0xa7dc('0x10e')](db[_0xa7dc('0x1f')],{'as':_0xa7dc('0x10f'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x13')][_0xa7dc('0x10e')](db['UserVoiceQueueRt'],{'as':_0xa7dc('0x110'),'foreignKey':'UserId'});db[_0xa7dc('0x13')][_0xa7dc('0x10e')](db[_0xa7dc('0x111')],{'as':_0xa7dc('0x112'),'onDelete':_0xa7dc('0x10b'),'hooks':!![]});db['User'][_0xa7dc('0x10e')](db[_0xa7dc('0x113')],{'as':_0xa7dc('0x114'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x13')]['hasMany'](db[_0xa7dc('0x71')],{'as':'HopperHistory','foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x13')][_0xa7dc('0x10e')](db[_0xa7dc('0x72')],{'as':_0xa7dc('0x72'),'foreignKey':_0xa7dc('0x10c')});db['User'][_0xa7dc('0x10e')](db['OpenchannelInteraction'],{'as':_0xa7dc('0x115'),'foreignKey':_0xa7dc('0x10c')});db['User']['hasMany'](db[_0xa7dc('0x116')],{'as':'ChatInteractions','foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x13')][_0xa7dc('0x10e')](db['SmsInteraction'],{'as':_0xa7dc('0x117'),'foreignKey':'UserId'});db['User'][_0xa7dc('0x10e')](db[_0xa7dc('0x4b')],{'as':_0xa7dc('0x118'),'foreignKey':_0xa7dc('0x10c')});db['User']['hasMany'](db[_0xa7dc('0x42')],{'as':_0xa7dc('0x119'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x13')][_0xa7dc('0x10e')](db[_0xa7dc('0xfc')],{'as':_0xa7dc('0x11a'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x13')][_0xa7dc('0x10e')](db[_0xa7dc('0xf7')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0xa7dc('0x13')][_0xa7dc('0x11b')](db[_0xa7dc('0x11c')],{'as':_0xa7dc('0x11c'),'foreignKey':_0xa7dc('0x11d')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x69')],{'as':_0xa7dc('0x11f'),'through':_0xa7dc('0x120')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x6d')],{'as':'Contacts','through':_0xa7dc('0x121')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x122'),'through':'cm_user_has_lists'});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x123')],{'through':'user_has_teams'});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x42')],{'as':'MailInteractions','through':_0xa7dc('0x124')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0xa7dc('0x125')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0xa7dc('0x126')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x53')],{'as':_0xa7dc('0x117'),'through':'user_has_sms_interactions'});db['User'][_0xa7dc('0x11e')](db[_0xa7dc('0x5b')],{'as':_0xa7dc('0x115'),'through':_0xa7dc('0x127')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0xfc')],{'as':_0xa7dc('0x11a'),'through':_0xa7dc('0x128')});db['User']['belongsToMany'](db[_0xa7dc('0x1d')],{'as':_0xa7dc('0x129'),'through':'UserVoiceQueue','required':![]});db['User'][_0xa7dc('0x11e')](db['VoicePrefix'],{'as':_0xa7dc('0x12a'),'through':_0xa7dc('0x106'),'required':![]});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x3f')],{'as':_0xa7dc('0x12b'),'through':'UserMailQueue','required':![]});db['User'][_0xa7dc('0x11e')](db[_0xa7dc('0x67')],{'as':'ChatQueues','through':_0xa7dc('0x32'),'required':![],'hooks':!![]});db['User'][_0xa7dc('0x11e')](db[_0xa7dc('0x12c')],{'as':_0xa7dc('0x12d'),'through':_0xa7dc('0x12e'),'required':![]});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x55')],{'as':_0xa7dc('0x12f'),'through':'UserSmsQueue','required':![]});db[_0xa7dc('0x13')]['belongsToMany'](db[_0xa7dc('0x130')],{'as':'OpenchannelQueues','through':_0xa7dc('0x131'),'required':![]});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x101')],{'as':'WhatsappQueues','through':_0xa7dc('0x3a'),'required':![]});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0xf1')],{'through':_0xa7dc('0x132')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x60')],{'as':_0xa7dc('0x133'),'through':_0xa7dc('0x134')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x135')],{'as':_0xa7dc('0x136'),'through':_0xa7dc('0x137')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db[_0xa7dc('0x3d')],{'as':'MailAccounts','through':_0xa7dc('0x138')});db['User'][_0xa7dc('0x11e')](db[_0xa7dc('0x57')],{'as':'OpenchannelAccounts','through':_0xa7dc('0x139')});db['User'][_0xa7dc('0x11e')](db[_0xa7dc('0x50')],{'as':_0xa7dc('0x13a'),'through':_0xa7dc('0x13b')});db[_0xa7dc('0x13')][_0xa7dc('0x11e')](db['WhatsappAccount'],{'as':_0xa7dc('0x13c'),'through':'user_has_whatsapp_accounts'});db['VoiceChanSpy'][_0xa7dc('0x10e')](db[_0xa7dc('0x111')],{'as':_0xa7dc('0x13d'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x13e')});db[_0xa7dc('0x18')][_0xa7dc('0x10e')](db[_0xa7dc('0x111')],{'onDelete':_0xa7dc('0x10b')});db['VoiceExtension'][_0xa7dc('0x10e')](db[_0xa7dc('0x111')],{'as':'Applications','onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x1b')][_0xa7dc('0x11e')](db[_0xa7dc('0x85')],{'as':_0xa7dc('0x13f'),'through':_0xa7dc('0x140')});db[_0xa7dc('0x1d')][_0xa7dc('0x10e')](db[_0xa7dc('0x141')],{'as':_0xa7dc('0x142'),'foreignKey':_0xa7dc('0x143')});db[_0xa7dc('0x1d')][_0xa7dc('0x10e')](db[_0xa7dc('0x6e')],{'as':_0xa7dc('0x144'),'foreignKey':_0xa7dc('0x143')});db[_0xa7dc('0x1d')][_0xa7dc('0x10e')](db['CmHopperFinal'],{'as':_0xa7dc('0x114'),'foreignKey':_0xa7dc('0x143')});db['VoiceQueue']['hasMany'](db['CmHopperHistory'],{'as':_0xa7dc('0x145'),'foreignKey':_0xa7dc('0x143')});db[_0xa7dc('0x1d')][_0xa7dc('0x10e')](db['ReportAgentPreview'],{'as':_0xa7dc('0x72'),'foreignKey':'VoiceQueueId'});db[_0xa7dc('0x1d')][_0xa7dc('0x10e')](db[_0xa7dc('0x146')],{'as':_0xa7dc('0x147'),'foreignKey':_0xa7dc('0x143')});db[_0xa7dc('0x1d')][_0xa7dc('0x10e')](db[_0xa7dc('0x148')],{'as':_0xa7dc('0x149'),'foreignKey':_0xa7dc('0x143')});db[_0xa7dc('0x1d')][_0xa7dc('0x11b')](db[_0xa7dc('0x14a')],{'as':_0xa7dc('0x14a'),'foreignKey':_0xa7dc('0x14b')});db[_0xa7dc('0x1d')][_0xa7dc('0x11b')](db[_0xa7dc('0x14a')],{'as':_0xa7dc('0x14c'),'foreignKey':_0xa7dc('0x14d')});db[_0xa7dc('0x1d')]['belongsTo'](db[_0xa7dc('0x7b')],{'as':'Interval','foreignKey':_0xa7dc('0x14e')});db['VoiceQueue'][_0xa7dc('0x11b')](db[_0xa7dc('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xa7dc('0x11e')](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x122'),'through':_0xa7dc('0x14f')});db[_0xa7dc('0x1d')][_0xa7dc('0x11e')](db['User'],{'as':_0xa7dc('0x150'),'through':_0xa7dc('0x30')});db[_0xa7dc('0x1d')][_0xa7dc('0x11e')](db[_0xa7dc('0x123')],{'as':_0xa7dc('0x151'),'through':_0xa7dc('0x152')});db[_0xa7dc('0x1d')][_0xa7dc('0x11e')](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x153'),'through':_0xa7dc('0x154')});db[_0xa7dc('0x1f')][_0xa7dc('0x11b')](db['User'],{'as':_0xa7dc('0x13'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x21')]['belongsTo'](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x13'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x22')][_0xa7dc('0x10e')](db[_0xa7dc('0x155')],{'as':_0xa7dc('0x156'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x157'),'sourceKey':_0xa7dc('0x158')});db[_0xa7dc('0x155')][_0xa7dc('0x11b')](db[_0xa7dc('0x22')],{'foreignKey':_0xa7dc('0x157'),'targetKey':'mailbox'});db[_0xa7dc('0x24')][_0xa7dc('0x10e')](db[_0xa7dc('0x2a')],{'as':'QueueCalls','foreignKey':_0xa7dc('0x159'),'constraints':![]});db[_0xa7dc('0x24')][_0xa7dc('0x10e')](db[_0xa7dc('0x28')],{'as':'AgentReports','foreignKey':_0xa7dc('0x159'),'constraints':![]});db[_0xa7dc('0x24')][_0xa7dc('0x11b')](db['User'],{'as':'User','foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x24')]['belongsTo'](db[_0xa7dc('0x6d')],{'as':'Contact','foreignKey':_0xa7dc('0x15a')});db[_0xa7dc('0x15b')][_0xa7dc('0x11b')](db[_0xa7dc('0x3d')],{'as':_0xa7dc('0x3d'),'foreignKey':_0xa7dc('0x15c')});db[_0xa7dc('0x15b')]['belongsTo'](db[_0xa7dc('0x103')],{'as':'CloudProvider','foreignKey':_0xa7dc('0x15d'),'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x3c')][_0xa7dc('0x11b')](db['MailAccount'],{'as':_0xa7dc('0x3d'),'foreignKey':_0xa7dc('0x15c')});db['MailServerOut']['belongsTo'](db[_0xa7dc('0x103')],{'as':_0xa7dc('0x103'),'foreignKey':'CloudProviderId','onDelete':_0xa7dc('0x15e')});db['MailAccount']['hasOne'](db['MailServerIn'],{'as':_0xa7dc('0x15f'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x3d')][_0xa7dc('0x10a')](db[_0xa7dc('0x3c')],{'as':_0xa7dc('0x160'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x3d')][_0xa7dc('0x10e')](db[_0xa7dc('0x78')],{'as':'Dispositions','foreignKey':_0xa7dc('0x15c'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x3d')][_0xa7dc('0x10e')](db[_0xa7dc('0x161')],{'as':_0xa7dc('0x162'),'foreignKey':'MailAccountId'});db[_0xa7dc('0x3d')][_0xa7dc('0x10e')](db[_0xa7dc('0x43')],{'as':_0xa7dc('0x156'),'foreignKey':_0xa7dc('0x15c')});db[_0xa7dc('0x3d')][_0xa7dc('0x10e')](db['MailInteraction'],{'as':_0xa7dc('0x163')});db[_0xa7dc('0x3d')]['hasMany'](db['MailApplication'],{'as':_0xa7dc('0x164')});db['MailAccount']['belongsTo'](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x165'),'foreignKey':_0xa7dc('0x166')});db['MailAccount'][_0xa7dc('0x11b')](db[_0xa7dc('0x8e')],{'as':_0xa7dc('0x8e'),'foreignKey':_0xa7dc('0x167')});db[_0xa7dc('0x3d')][_0xa7dc('0x11b')](db[_0xa7dc('0x7d')],{'as':_0xa7dc('0x168'),'foreignKey':_0xa7dc('0x169')});db[_0xa7dc('0x3d')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x150'),'through':_0xa7dc('0x138')});db[_0xa7dc('0x3f')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':'Agents','through':_0xa7dc('0x34')});db[_0xa7dc('0x3f')]['belongsToMany'](db[_0xa7dc('0x123')],{'through':_0xa7dc('0x16a'),'as':_0xa7dc('0x151')});db[_0xa7dc('0x42')][_0xa7dc('0x10e')](db[_0xa7dc('0x43')],{'as':'Messages','onDelete':_0xa7dc('0x10b'),'foreignKey':'MailInteractionId'});db[_0xa7dc('0x42')]['belongsTo'](db[_0xa7dc('0x3d')],{'as':'Account','foreignKey':_0xa7dc('0x15c')});db[_0xa7dc('0x42')]['belongsTo'](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':'ContactId'});db[_0xa7dc('0x42')][_0xa7dc('0x11b')](db['User'],{'as':_0xa7dc('0x16c'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x42')][_0xa7dc('0x11e')](db['Tag'],{'through':_0xa7dc('0x16d'),'as':'Tags'});db['MailInteraction'][_0xa7dc('0x11e')](db[_0xa7dc('0x87')],{'through':_0xa7dc('0x16d'),'as':'ThroughTags'});db[_0xa7dc('0x42')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x16e'),'through':_0xa7dc('0x124'),'foreignKey':_0xa7dc('0x16f')});db[_0xa7dc('0x43')][_0xa7dc('0x10e')](db['Attachment'],{'as':_0xa7dc('0x170'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x43')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'as':'User'});db[_0xa7dc('0x43')]['belongsTo'](db[_0xa7dc('0x6d')],{'onDelete':_0xa7dc('0x10b'),'as':'Contact'});db[_0xa7dc('0x43')][_0xa7dc('0x11b')](db[_0xa7dc('0x42')],{'as':'Interaction','foreignKey':_0xa7dc('0x16f')});db[_0xa7dc('0x43')][_0xa7dc('0x11b')](db[_0xa7dc('0x3d')],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x15c')});db['MailMessage'][_0xa7dc('0x11b')](db[_0xa7dc('0x60')],{'as':_0xa7dc('0x60'),'foreignKey':_0xa7dc('0x172')});db[_0xa7dc('0x43')][_0xa7dc('0x11b')](db['ChatOfflineMessage'],{'as':_0xa7dc('0x65'),'foreignKey':_0xa7dc('0x173')});db['MailApplication'][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'onDelete':'restrict'});db[_0xa7dc('0x45')][_0xa7dc('0x11b')](db['MailQueue'],{'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x45')][_0xa7dc('0x11b')](db[_0xa7dc('0x3d')],{'onDelete':_0xa7dc('0x15e')});db['MailApplication']['belongsTo'](db['Interval'],{'onDelete':_0xa7dc('0x15e'),'foreignKey':_0xa7dc('0x14e')});db['MailApplication'][_0xa7dc('0x11b')](db[_0xa7dc('0x87')],{'onDelete':_0xa7dc('0x15e'),'foreignKey':_0xa7dc('0x174')});db[_0xa7dc('0x175')][_0xa7dc('0x11b')](db[_0xa7dc('0x3d')],{});db[_0xa7dc('0x175')][_0xa7dc('0x11b')](db[_0xa7dc('0xf1')],{'as':'List','foreignKey':_0xa7dc('0x166')});db[_0xa7dc('0x175')]['belongsTo'](db[_0xa7dc('0x6d')],{'as':'Contact','foreignKey':'ContactId'});db[_0xa7dc('0x175')]['belongsTo'](db[_0xa7dc('0x42')],{});db[_0xa7dc('0x175')][_0xa7dc('0x11b')](db[_0xa7dc('0x43')],{});db[_0xa7dc('0x175')]['belongsTo'](db[_0xa7dc('0x13')],{});db[_0xa7dc('0x175')][_0xa7dc('0x11b')](db[_0xa7dc('0x3f')],{});db[_0xa7dc('0x176')][_0xa7dc('0x10e')](db[_0xa7dc('0x48')],{'as':_0xa7dc('0x177'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x135')][_0xa7dc('0x10e')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xa7dc('0x178'),'onDelete':_0xa7dc('0x10b')});db['FaxAccount'][_0xa7dc('0x10e')](db[_0xa7dc('0x161')],{'as':'Answers','foreignKey':_0xa7dc('0x178')});db['FaxAccount'][_0xa7dc('0x10e')](db[_0xa7dc('0x4b')],{'as':_0xa7dc('0x163')});db['FaxAccount'][_0xa7dc('0x10e')](db[_0xa7dc('0x4a')],{'as':_0xa7dc('0x164')});db[_0xa7dc('0x135')][_0xa7dc('0x10e')](db['VoiceExtension'],{'as':_0xa7dc('0x179'),'onDelete':_0xa7dc('0x10b')});db['FaxAccount'][_0xa7dc('0x10e')](db[_0xa7dc('0x17a')],{'as':_0xa7dc('0x156')});db['FaxAccount'][_0xa7dc('0x11b')](db[_0xa7dc('0x14a')],{'as':_0xa7dc('0x14a')});db[_0xa7dc('0x135')][_0xa7dc('0x11b')](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x165'),'foreignKey':_0xa7dc('0x166')});db[_0xa7dc('0x135')][_0xa7dc('0x11b')](db[_0xa7dc('0x7d')],{'as':_0xa7dc('0x168'),'foreignKey':_0xa7dc('0x169')});db['FaxAccount'][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x150'),'through':_0xa7dc('0x137')});db[_0xa7dc('0x4a')][_0xa7dc('0x11b')](db['User'],{'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x4a')][_0xa7dc('0x11b')](db[_0xa7dc('0x12c')],{'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x4a')]['belongsTo'](db[_0xa7dc('0x135')],{'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x4a')][_0xa7dc('0x11b')](db[_0xa7dc('0x87')],{'onDelete':_0xa7dc('0x15e'),'foreignKey':_0xa7dc('0x174')});db['FaxInteraction']['hasMany'](db[_0xa7dc('0x17a')],{'as':_0xa7dc('0x156'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x17b')});db[_0xa7dc('0x4b')][_0xa7dc('0x11b')](db[_0xa7dc('0x135')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xa7dc('0x4b')][_0xa7dc('0x11b')](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':'ContactId'});db['FaxInteraction'][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x16c'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x4b')][_0xa7dc('0x11e')](db[_0xa7dc('0x87')],{'through':_0xa7dc('0x17c'),'as':'Tags'});db['FaxInteraction'][_0xa7dc('0x11e')](db[_0xa7dc('0x87')],{'through':'fax_interaction_has_tags','as':_0xa7dc('0x17d')});db['FaxInteraction'][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x16e'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0xa7dc('0x17a')][_0xa7dc('0x11b')](db['User'],{'onDelete':_0xa7dc('0x10b'),'as':_0xa7dc('0x13')});db[_0xa7dc('0x17a')]['belongsTo'](db[_0xa7dc('0x4b')],{'as':_0xa7dc('0x17e'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0xa7dc('0x11b')](db[_0xa7dc('0x6d')],{'onDelete':_0xa7dc('0x10b'),'as':_0xa7dc('0x16b')});db[_0xa7dc('0x17a')][_0xa7dc('0x11b')](db[_0xa7dc('0x17f')],{'as':_0xa7dc('0x17f'),'foreignKey':_0xa7dc('0x180')});db[_0xa7dc('0x17a')][_0xa7dc('0x11b')](db[_0xa7dc('0x135')],{'as':_0xa7dc('0x171'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x150'),'through':_0xa7dc('0x12e')});db['FaxQueue']['belongsToMany'](db[_0xa7dc('0x123')],{'through':_0xa7dc('0x181'),'as':_0xa7dc('0x151')});db['FaxQueueReport']['belongsTo'](db[_0xa7dc('0x135')],{});db[_0xa7dc('0x4e')]['belongsTo'](db[_0xa7dc('0xf1')],{'as':'List','foreignKey':_0xa7dc('0x166')});db['FaxQueueReport']['belongsTo'](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':'ContactId'});db[_0xa7dc('0x4e')][_0xa7dc('0x11b')](db[_0xa7dc('0x4b')],{});db[_0xa7dc('0x4e')]['belongsTo'](db[_0xa7dc('0x17a')],{});db[_0xa7dc('0x4e')][_0xa7dc('0x11b')](db['User'],{});db['FaxQueueReport']['belongsTo'](db['FaxQueue'],{});db[_0xa7dc('0x50')]['hasMany'](db['Disposition'],{'as':_0xa7dc('0x182'),'foreignKey':_0xa7dc('0x183'),'onDelete':_0xa7dc('0x10b')});db['SmsAccount'][_0xa7dc('0x10e')](db[_0xa7dc('0x161')],{'as':_0xa7dc('0x162'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xa7dc('0x10e')](db[_0xa7dc('0x54')],{'as':_0xa7dc('0x156'),'foreignKey':'SmsAccountId'});db[_0xa7dc('0x50')]['hasMany'](db[_0xa7dc('0x53')],{'as':'Interactions'});db['SmsAccount'][_0xa7dc('0x10e')](db[_0xa7dc('0x52')],{'as':_0xa7dc('0x164')});db[_0xa7dc('0x50')][_0xa7dc('0x11b')](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x165'),'foreignKey':_0xa7dc('0x166')});db[_0xa7dc('0x50')][_0xa7dc('0x11b')](db[_0xa7dc('0x7d')],{'as':_0xa7dc('0x168'),'foreignKey':_0xa7dc('0x169')});db['SmsAccount'][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x150'),'through':'user_has_sms_accounts'});db[_0xa7dc('0x52')]['belongsTo'](db[_0xa7dc('0x13')],{'onDelete':_0xa7dc('0x15e')});db['SmsApplication'][_0xa7dc('0x11b')](db[_0xa7dc('0x55')],{'onDelete':'restrict'});db[_0xa7dc('0x52')][_0xa7dc('0x11b')](db[_0xa7dc('0x50')],{'onDelete':_0xa7dc('0x15e')});db['SmsApplication']['belongsTo'](db['Interval'],{'onDelete':_0xa7dc('0x15e'),'foreignKey':_0xa7dc('0x14e')});db[_0xa7dc('0x52')][_0xa7dc('0x11b')](db[_0xa7dc('0x87')],{'onDelete':_0xa7dc('0x15e'),'foreignKey':_0xa7dc('0x174')});db[_0xa7dc('0x53')]['hasMany'](db['SmsMessage'],{'as':_0xa7dc('0x156'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x184')});db[_0xa7dc('0x53')][_0xa7dc('0x11b')](db[_0xa7dc('0x50')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xa7dc('0x53')][_0xa7dc('0x11b')](db[_0xa7dc('0x6d')],{'as':'Contact','foreignKey':_0xa7dc('0x15a')});db[_0xa7dc('0x53')][_0xa7dc('0x11b')](db['User'],{'as':_0xa7dc('0x16c'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x53')]['belongsToMany'](db[_0xa7dc('0x87')],{'through':_0xa7dc('0x185'),'as':_0xa7dc('0x186')});db[_0xa7dc('0x53')][_0xa7dc('0x11e')](db['Tag'],{'through':_0xa7dc('0x185'),'as':_0xa7dc('0x17d')});db[_0xa7dc('0x53')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':'Users','through':_0xa7dc('0x187'),'foreignKey':_0xa7dc('0x184')});db[_0xa7dc('0x54')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x13')});db[_0xa7dc('0x54')][_0xa7dc('0x11b')](db[_0xa7dc('0x6d')],{'onDelete':_0xa7dc('0x10b'),'as':_0xa7dc('0x16b')});db[_0xa7dc('0x54')]['belongsTo'](db[_0xa7dc('0x53')],{'onDelete':'cascade','as':_0xa7dc('0x17e'),'foreignKey':_0xa7dc('0x184')});db[_0xa7dc('0x54')][_0xa7dc('0x11b')](db['SmsAccount'],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x183')});db[_0xa7dc('0x55')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x150'),'through':_0xa7dc('0x37'),'foreignKey':_0xa7dc('0x188')});db[_0xa7dc('0x55')][_0xa7dc('0x11e')](db['Team'],{'through':_0xa7dc('0x189'),'as':_0xa7dc('0x151')});db[_0xa7dc('0x57')][_0xa7dc('0x10e')](db[_0xa7dc('0x78')],{'as':'Dispositions','foreignKey':_0xa7dc('0x18a'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x57')][_0xa7dc('0x10e')](db['CannedAnswer'],{'as':_0xa7dc('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0xa7dc('0x57')][_0xa7dc('0x10e')](db['OpenchannelInteraction'],{'as':_0xa7dc('0x163'),'foreignKey':_0xa7dc('0x18a')});db[_0xa7dc('0x57')][_0xa7dc('0x10e')](db[_0xa7dc('0x5d')],{'as':_0xa7dc('0x156'),'foreignKey':_0xa7dc('0x18a')});db[_0xa7dc('0x57')]['hasMany'](db[_0xa7dc('0x59')],{'as':'Applications','foreignKey':_0xa7dc('0x18a')});db[_0xa7dc('0x57')][_0xa7dc('0x11b')](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x165'),'foreignKey':_0xa7dc('0x166')});db[_0xa7dc('0x57')][_0xa7dc('0x11b')](db[_0xa7dc('0x7d')],{'as':_0xa7dc('0x168'),'foreignKey':_0xa7dc('0x169')});db[_0xa7dc('0x57')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':'Agents','through':_0xa7dc('0x139')});db[_0xa7dc('0x59')][_0xa7dc('0x11b')](db['User'],{'onDelete':'restrict'});db[_0xa7dc('0x59')][_0xa7dc('0x11b')](db[_0xa7dc('0x130')],{'onDelete':_0xa7dc('0x15e'),'foreignKey':_0xa7dc('0x18b')});db[_0xa7dc('0x59')][_0xa7dc('0x11b')](db[_0xa7dc('0x57')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xa7dc('0x59')][_0xa7dc('0x11b')](db[_0xa7dc('0x7b')],{'onDelete':_0xa7dc('0x15e'),'foreignKey':_0xa7dc('0x14e')});db[_0xa7dc('0x59')]['belongsTo'](db['Tag'],{'onDelete':_0xa7dc('0x15e'),'foreignKey':'TagId'});db['OpenchannelInteraction']['hasMany'](db[_0xa7dc('0x5d')],{'as':_0xa7dc('0x156'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x18c')});db['OpenchannelInteraction'][_0xa7dc('0x11b')](db['OpenchannelAccount'],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x18a')});db['OpenchannelInteraction'][_0xa7dc('0x11b')](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':_0xa7dc('0x15a')});db['OpenchannelInteraction'][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x16c'),'foreignKey':'UserId'});db[_0xa7dc('0x5b')][_0xa7dc('0x11e')](db[_0xa7dc('0x87')],{'through':_0xa7dc('0x18d'),'as':_0xa7dc('0x186')});db[_0xa7dc('0x5b')]['belongsToMany'](db[_0xa7dc('0x87')],{'through':'openchannel_interaction_has_tags','as':_0xa7dc('0x17d')});db[_0xa7dc('0x5b')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x16e'),'through':'user_has_openchannel_interactions','foreignKey':_0xa7dc('0x18c')});db[_0xa7dc('0x5d')][_0xa7dc('0x11b')](db['User'],{'onDelete':_0xa7dc('0x10b'),'as':'User'});db[_0xa7dc('0x5d')][_0xa7dc('0x11b')](db['CmContact'],{'onDelete':_0xa7dc('0x10b'),'as':_0xa7dc('0x16b')});db[_0xa7dc('0x5d')][_0xa7dc('0x11b')](db['OpenchannelInteraction'],{'onDelete':_0xa7dc('0x10b'),'as':_0xa7dc('0x17e'),'foreignKey':_0xa7dc('0x18c')});db[_0xa7dc('0x5d')][_0xa7dc('0x11b')](db[_0xa7dc('0x17f')],{'as':'Attachment','foreignKey':_0xa7dc('0x180')});db[_0xa7dc('0x5d')][_0xa7dc('0x11b')](db[_0xa7dc('0x57')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xa7dc('0x130')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':'Agents','through':_0xa7dc('0x131'),'foreignKey':_0xa7dc('0x18b')});db[_0xa7dc('0x130')][_0xa7dc('0x11e')](db[_0xa7dc('0x123')],{'through':_0xa7dc('0x18e'),'as':'Teams'});db['ChatWebsite'][_0xa7dc('0x10e')](db['Disposition'],{'as':_0xa7dc('0x182'),'foreignKey':_0xa7dc('0x172'),'onDelete':_0xa7dc('0x10b')});db['ChatWebsite'][_0xa7dc('0x10e')](db[_0xa7dc('0x161')],{'as':_0xa7dc('0x162'),'foreignKey':'ChatWebsiteId'});db[_0xa7dc('0x60')][_0xa7dc('0x10e')](db[_0xa7dc('0x18f')],{'as':_0xa7dc('0x190')});db[_0xa7dc('0x60')][_0xa7dc('0x10e')](db[_0xa7dc('0x116')],{'as':_0xa7dc('0x163')});db[_0xa7dc('0x60')][_0xa7dc('0x10e')](db['ChatApplication'],{'as':_0xa7dc('0x164')});db[_0xa7dc('0x60')][_0xa7dc('0x10e')](db['ChatMessage'],{'as':'Messages'});db[_0xa7dc('0x60')][_0xa7dc('0x11b')](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x165'),'foreignKey':_0xa7dc('0x166')});db[_0xa7dc('0x60')][_0xa7dc('0x11b')](db['Interval'],{'as':_0xa7dc('0x7b'),'foreignKey':_0xa7dc('0x14e')});db['ChatWebsite']['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xa7dc('0x60')][_0xa7dc('0x11b')](db[_0xa7dc('0x7d')],{'as':_0xa7dc('0x168'),'foreignKey':_0xa7dc('0x169')});db[_0xa7dc('0x60')][_0xa7dc('0x11e')](db['User'],{'as':_0xa7dc('0x150'),'through':_0xa7dc('0x134')});db['OpenchannelQueueReport'][_0xa7dc('0x11b')](db[_0xa7dc('0x57')],{});db[_0xa7dc('0x191')][_0xa7dc('0x11b')](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x165'),'foreignKey':'ListId'});db[_0xa7dc('0x191')]['belongsTo'](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':_0xa7dc('0x15a')});db[_0xa7dc('0x191')][_0xa7dc('0x11b')](db[_0xa7dc('0x5b')],{});db[_0xa7dc('0x191')][_0xa7dc('0x11b')](db[_0xa7dc('0x5d')],{});db['OpenchannelQueueReport'][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{});db[_0xa7dc('0x191')]['belongsTo'](db[_0xa7dc('0x130')],{});db[_0xa7dc('0x192')]['belongsTo'](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x193'),'foreignKey':_0xa7dc('0x10c'),'onDelete':_0xa7dc('0x15e')});db['ChatApplication'][_0xa7dc('0x11b')](db[_0xa7dc('0x67')],{'as':_0xa7dc('0x194'),'foreignKey':'ChatQueueId','onDelete':_0xa7dc('0x15e')});db['ChatApplication']['belongsTo'](db[_0xa7dc('0x60')],{'as':_0xa7dc('0x195'),'foreignKey':_0xa7dc('0x172'),'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x192')][_0xa7dc('0x11b')](db['Tag'],{'onDelete':_0xa7dc('0x15e'),'foreignKey':_0xa7dc('0x174')});db[_0xa7dc('0x116')][_0xa7dc('0x10e')](db['ChatMessage'],{'as':_0xa7dc('0x156'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0xa7dc('0x116')]['belongsTo'](db[_0xa7dc('0x60')],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x172')});db[_0xa7dc('0x116')][_0xa7dc('0x11b')](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':'ContactId'});db['ChatInteraction'][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'as':'Owner','foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x116')][_0xa7dc('0x11e')](db[_0xa7dc('0x87')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0xa7dc('0x116')]['belongsToMany'](db[_0xa7dc('0x87')],{'through':_0xa7dc('0x196'),'as':_0xa7dc('0x17d')});db['ChatInteraction'][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0xa7dc('0x197')});db[_0xa7dc('0x198')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'onDelete':'cascade','as':_0xa7dc('0x13')});db[_0xa7dc('0x198')]['belongsTo'](db[_0xa7dc('0x6d')],{'onDelete':_0xa7dc('0x10b'),'as':_0xa7dc('0x16b'),'foreignKey':'ContactId'});db['ChatMessage'][_0xa7dc('0x11b')](db[_0xa7dc('0x116')],{'onDelete':'cascade','as':'Interaction','foreignKey':'ChatInteractionId'});db[_0xa7dc('0x198')][_0xa7dc('0x11b')](db[_0xa7dc('0x17f')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xa7dc('0x198')][_0xa7dc('0x11b')](db[_0xa7dc('0x60')],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x172')});db[_0xa7dc('0x65')][_0xa7dc('0x10e')](db['Attachment'],{'as':_0xa7dc('0x170'),'foreignKey':_0xa7dc('0x173'),'onDelete':_0xa7dc('0x10b'),'hooks':!![]});db[_0xa7dc('0x65')]['belongsTo'](db[_0xa7dc('0x6d')],{'onDelete':_0xa7dc('0x10b'),'as':'Contact','foreignKey':_0xa7dc('0x15a')});db[_0xa7dc('0x65')][_0xa7dc('0x11b')](db['ChatWebsite'],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x172')});db['ChatQueue'][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x150'),'through':_0xa7dc('0x32'),'hooks':!![]});db[_0xa7dc('0x67')]['belongsToMany'](db[_0xa7dc('0x123')],{'through':'team_has_chat_queues','as':_0xa7dc('0x151')});db[_0xa7dc('0x69')][_0xa7dc('0x10e')](db[_0xa7dc('0xcd')],{'as':'Messages','foreignKey':_0xa7dc('0x199'),'onDelete':'cascade'});db[_0xa7dc('0x69')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':'Members','through':_0xa7dc('0x120')});db[_0xa7dc('0x18f')][_0xa7dc('0x11b')](db['ChatWebsite'],{'as':_0xa7dc('0x195'),'foreignKey':_0xa7dc('0x172')});db['CmCompany'][_0xa7dc('0x10e')](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x19a'),'foreignKey':_0xa7dc('0x19b')});db['CmContact'][_0xa7dc('0x10e')](db[_0xa7dc('0x8a')],{'as':'Phones','foreignKey':'CmContactId'});db[_0xa7dc('0x6d')][_0xa7dc('0x10e')](db[_0xa7dc('0x6e')],{'as':'Hoppers','foreignKey':_0xa7dc('0x15a')});db[_0xa7dc('0x6d')][_0xa7dc('0x10e')](db[_0xa7dc('0x113')],{'as':_0xa7dc('0x114'),'foreignKey':_0xa7dc('0x15a')});db['CmContact'][_0xa7dc('0x10e')](db[_0xa7dc('0x71')],{'as':_0xa7dc('0x145'),'foreignKey':'ContactId'});db[_0xa7dc('0x6d')][_0xa7dc('0x10e')](db['ReportAgentPreview'],{'as':_0xa7dc('0x72'),'foreignKey':_0xa7dc('0x15a')});db[_0xa7dc('0x6d')][_0xa7dc('0x10e')](db[_0xa7dc('0x148')],{'as':'JscriptySessions','foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xa7dc('0x5b')],{'as':_0xa7dc('0x115'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xa7dc('0x6d')][_0xa7dc('0x10e')](db[_0xa7dc('0x116')],{'as':_0xa7dc('0x19c'),'foreignKey':_0xa7dc('0x15a'),'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x6d')][_0xa7dc('0x10e')](db[_0xa7dc('0x53')],{'as':_0xa7dc('0x117'),'foreignKey':'ContactId','onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x6d')][_0xa7dc('0x10e')](db[_0xa7dc('0x4b')],{'as':_0xa7dc('0x118'),'foreignKey':_0xa7dc('0x15a'),'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x6d')]['hasMany'](db[_0xa7dc('0x42')],{'as':_0xa7dc('0x119'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xa7dc('0x6d')][_0xa7dc('0x11b')](db['CmCompany'],{'as':_0xa7dc('0x19d'),'foreignKey':_0xa7dc('0x19b')});db[_0xa7dc('0x6d')][_0xa7dc('0x11b')](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x165'),'foreignKey':_0xa7dc('0x166'),'onDelete':'cascade'});db[_0xa7dc('0x6d')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x16e'),'through':_0xa7dc('0x121')});db['CmContact'][_0xa7dc('0x11e')](db['Tag'],{'as':'Tags','through':_0xa7dc('0x19e')});db['CmContact'][_0xa7dc('0x11e')](db[_0xa7dc('0x87')],{'through':_0xa7dc('0x19e'),'as':_0xa7dc('0x17d')});db[_0xa7dc('0x6e')][_0xa7dc('0x10e')](db[_0xa7dc('0x8c')],{'as':'AdditionalPhones','foreignKey':_0xa7dc('0x19f')});db['CmHopper'][_0xa7dc('0x11b')](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':_0xa7dc('0x15a'),'onDelete':_0xa7dc('0x10b')});db['CmHopper']['belongsTo'](db['CmList'],{'as':_0xa7dc('0x165'),'foreignKey':_0xa7dc('0x166'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x6e')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x193'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0x6e')][_0xa7dc('0x11b')](db[_0xa7dc('0x1d')],{'as':'Queue','foreignKey':_0xa7dc('0x143'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x6e')]['belongsTo'](db['Campaign'],{'as':_0xa7dc('0xe2'),'foreignKey':_0xa7dc('0x1a0'),'onDelete':'cascade'});db[_0xa7dc('0x6e')]['belongsTo'](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x16c'),'foreignKey':_0xa7dc('0x1a1')});db[_0xa7dc('0x146')][_0xa7dc('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0xa7dc('0x15a'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x146')][_0xa7dc('0x11b')](db[_0xa7dc('0xf1')],{'as':'List','foreignKey':_0xa7dc('0x166'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x146')]['belongsTo'](db[_0xa7dc('0x1d')],{'as':'Queue','foreignKey':_0xa7dc('0x143'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x146')][_0xa7dc('0x11b')](db[_0xa7dc('0xe2')],{'as':_0xa7dc('0xe2'),'foreignKey':_0xa7dc('0x1a0'),'onDelete':'cascade'});db[_0xa7dc('0x1a2')][_0xa7dc('0x10e')](db[_0xa7dc('0x1a3')],{'as':{'plural':_0xa7dc('0x1a4'),'singular':_0xa7dc('0x1a5')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db['Automation'][_0xa7dc('0x10e')](db['Condition'],{'as':{'plural':_0xa7dc('0x1a6'),'singular':_0xa7dc('0x1a7')},'foreignKey':_0xa7dc('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0xa7dc('0x1a2')][_0xa7dc('0x10e')](db[_0xa7dc('0x74')],{'as':_0xa7dc('0x1a9'),'foreignKey':_0xa7dc('0x1aa'),'onDelete':_0xa7dc('0x10b'),'hooks':!![]});db[_0xa7dc('0x78')][_0xa7dc('0x10e')](db[_0xa7dc('0x78')],{'as':_0xa7dc('0x182'),'foreignKey':_0xa7dc('0x1ab'),'onDelete':'cascade'});db[_0xa7dc('0x7b')][_0xa7dc('0x10e')](db[_0xa7dc('0x7b')],{'as':'Intervals','foreignKey':_0xa7dc('0x14e'),'onDelete':_0xa7dc('0x10b'),'hooks':!![],'required':![]});db[_0xa7dc('0x7b')][_0xa7dc('0x10e')](db[_0xa7dc('0x111')],{'as':_0xa7dc('0x112'),'foreignKey':'IntervalId','onDelete':_0xa7dc('0x15e')});db['Interval'][_0xa7dc('0x10e')](db[_0xa7dc('0x45')],{'as':_0xa7dc('0x1ac'),'foreignKey':'IntervalId'});db[_0xa7dc('0x7b')][_0xa7dc('0x10e')](db['ChatApplication'],{'as':_0xa7dc('0x1ad'),'foreignKey':_0xa7dc('0x14e')});db[_0xa7dc('0x7b')][_0xa7dc('0x10e')](db[_0xa7dc('0x4a')],{'as':_0xa7dc('0x1ae'),'foreignKey':_0xa7dc('0x14e')});db[_0xa7dc('0x7b')]['hasMany'](db[_0xa7dc('0x52')],{'as':_0xa7dc('0x1af'),'foreignKey':_0xa7dc('0x14e')});db['Schedule'][_0xa7dc('0x11b')](db[_0xa7dc('0x3d')],{});db['Schedule'][_0xa7dc('0x11b')](db[_0xa7dc('0x97')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0xa7dc('0x11b')](db[_0xa7dc('0x1b0')],{'foreignKey':'CustomReportId'});db['Sound'][_0xa7dc('0x11e')](db[_0xa7dc('0x1b')],{'as':_0xa7dc('0x1b1'),'through':_0xa7dc('0x140'),'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x87')][_0xa7dc('0x11e')](db[_0xa7dc('0x6d')],{'through':_0xa7dc('0x19e')});db['Tag'][_0xa7dc('0x11e')](db[_0xa7dc('0x116')],{'through':_0xa7dc('0x196')});db[_0xa7dc('0x87')]['belongsToMany'](db['MailInteraction'],{'through':_0xa7dc('0x16d')});db[_0xa7dc('0x87')][_0xa7dc('0x11e')](db['SmsInteraction'],{'through':_0xa7dc('0x185')});db[_0xa7dc('0x87')][_0xa7dc('0x11e')](db[_0xa7dc('0x4b')],{'through':_0xa7dc('0x17c')});db[_0xa7dc('0x87')][_0xa7dc('0x11e')](db['OpenchannelInteraction'],{'through':_0xa7dc('0x18d')});db['Tag'][_0xa7dc('0x11e')](db[_0xa7dc('0xfc')],{'through':_0xa7dc('0x1b2')});db[_0xa7dc('0x8a')][_0xa7dc('0x11b')](db[_0xa7dc('0x88')],{'as':_0xa7dc('0x1b3'),'foreignKey':_0xa7dc('0x1b4')});db[_0xa7dc('0x8c')][_0xa7dc('0x11b')](db[_0xa7dc('0x6e')],{'as':_0xa7dc('0x1b5'),'foreignKey':'CmHopperId'});db[_0xa7dc('0x8a')][_0xa7dc('0x11b')](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':_0xa7dc('0x1b6')});db[_0xa7dc('0x90')][_0xa7dc('0x10e')](db['Condition'],{'as':{'plural':_0xa7dc('0x1b7'),'singular':_0xa7dc('0x1b8')},'foreignKey':_0xa7dc('0x1b9'),'onDelete':_0xa7dc('0x10b'),'hooks':!![]});db[_0xa7dc('0x90')]['hasMany'](db[_0xa7dc('0x1a3')],{'as':{'plural':_0xa7dc('0x1ba'),'singular':_0xa7dc('0x1bb')},'foreignKey':_0xa7dc('0x1bc'),'onDelete':_0xa7dc('0x10b'),'hooks':!![]});db[_0xa7dc('0x90')][_0xa7dc('0x10e')](db[_0xa7dc('0x74')],{'as':'Actions','foreignKey':_0xa7dc('0x1bd'),'onDelete':_0xa7dc('0x10b'),'hooks':!![]});db['AnalyticCustomReport'][_0xa7dc('0x10e')](db[_0xa7dc('0x1be')],{'as':'Fields','onDelete':_0xa7dc('0x10b'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xa7dc('0x97')][_0xa7dc('0x10e')](db[_0xa7dc('0x1be')],{'as':'Fields','onDelete':_0xa7dc('0x10b'),'foreignKey':'DefaultReportId'});db[_0xa7dc('0x1bf')][_0xa7dc('0x10e')](db[_0xa7dc('0x1be')],{'as':_0xa7dc('0x1c0'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c1')});db[_0xa7dc('0x1be')][_0xa7dc('0x11b')](db[_0xa7dc('0x1bf')],{'foreignKey':'MetricId'});db[_0xa7dc('0x9c')][_0xa7dc('0x10e')](db[_0xa7dc('0x9e')],{'as':_0xa7dc('0x1c2'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0x9e')]['hasMany'](db[_0xa7dc('0xa0')],{'as':_0xa7dc('0x1c4'),'onDelete':_0xa7dc('0x10b'),'foreignKey':'SubjectId'});db[_0xa7dc('0x9e')]['hasMany'](db[_0xa7dc('0xa0')],{'as':_0xa7dc('0x1c5'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xa7dc('0x9e')][_0xa7dc('0x10e')](db[_0xa7dc('0xa0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xa7dc('0x1c6')});db['SalesforceConfiguration']['belongsTo'](db[_0xa7dc('0x9c')],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0xa0')][_0xa7dc('0x10e')](db[_0xa7dc('0xa0')],{'as':_0xa7dc('0x1c7'),'foreignKey':_0xa7dc('0x1c8')});db['SalesforceField'][_0xa7dc('0x10e')](db[_0xa7dc('0xa0')],{'as':_0xa7dc('0x1c9'),'foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xa0')][_0xa7dc('0x10e')](db[_0xa7dc('0xa0')],{'as':'Field','foreignKey':_0xa7dc('0x1c6')});db['SalesforceField'][_0xa7dc('0x11b')](db['Variable'],{'as':'Variable','foreignKey':_0xa7dc('0x1cb')});db[_0xa7dc('0xa1')][_0xa7dc('0x10e')](db[_0xa7dc('0xa3')],{'as':_0xa7dc('0x1c2'),'onDelete':'cascade','foreignKey':_0xa7dc('0x1c3')});db['SugarcrmConfiguration'][_0xa7dc('0x10e')](db[_0xa7dc('0xa5')],{'as':_0xa7dc('0x1c4'),'onDelete':_0xa7dc('0x10b'),'foreignKey':'SubjectId'});db[_0xa7dc('0xa3')][_0xa7dc('0x10e')](db[_0xa7dc('0xa5')],{'as':_0xa7dc('0x1c5'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xa3')][_0xa7dc('0x10e')](db[_0xa7dc('0xa5')],{'as':_0xa7dc('0x1c0'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c6')});db[_0xa7dc('0xa3')][_0xa7dc('0x11b')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xa7dc('0x1c3')});db['SugarcrmField'][_0xa7dc('0x10e')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0xa7dc('0x1c8')});db['SugarcrmField'][_0xa7dc('0x10e')](db[_0xa7dc('0xa5')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0xa7dc('0x10e')](db[_0xa7dc('0xa5')],{'as':_0xa7dc('0x1cc'),'foreignKey':_0xa7dc('0x1c6')});db[_0xa7dc('0xa5')][_0xa7dc('0x11b')](db[_0xa7dc('0x92')],{'as':_0xa7dc('0x92'),'foreignKey':_0xa7dc('0x1cb')});db[_0xa7dc('0xa6')][_0xa7dc('0x10e')](db[_0xa7dc('0xa8')],{'as':'Configurations','onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c3')});db['DeskConfiguration']['hasMany'](db[_0xa7dc('0xaa')],{'as':_0xa7dc('0x1c4'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0xa8')][_0xa7dc('0x10e')](db[_0xa7dc('0xaa')],{'as':_0xa7dc('0x1c5'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xa8')]['hasMany'](db[_0xa7dc('0xaa')],{'as':'Fields','onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c6')});db['DeskConfiguration'][_0xa7dc('0x11b')](db[_0xa7dc('0xa6')],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0xa8')]['belongsToMany'](db[_0xa7dc('0x87')],{'through':_0xa7dc('0x1cd')});db['DeskField'][_0xa7dc('0x10e')](db['DeskField'],{'as':'Subject','foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0xaa')][_0xa7dc('0x10e')](db[_0xa7dc('0xaa')],{'as':'Description','foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xaa')][_0xa7dc('0x10e')](db['DeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xa7dc('0xaa')][_0xa7dc('0x11b')](db[_0xa7dc('0x92')],{'as':_0xa7dc('0x92'),'foreignKey':'VariableId'});db['ZohoAccount']['hasMany'](db[_0xa7dc('0xae')],{'as':'Configurations','onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0xae')]['hasMany'](db[_0xa7dc('0x1ce')],{'as':_0xa7dc('0x1c4'),'onDelete':'cascade','foreignKey':_0xa7dc('0x1c8')});db['ZohoConfiguration'][_0xa7dc('0x10e')](db[_0xa7dc('0x1ce')],{'as':_0xa7dc('0x1c5'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xae')][_0xa7dc('0x10e')](db[_0xa7dc('0x1ce')],{'as':_0xa7dc('0x1c0'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c6')});db['ZohoConfiguration'][_0xa7dc('0x11b')](db[_0xa7dc('0xac')],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0x1ce')]['hasMany'](db[_0xa7dc('0x1ce')],{'as':_0xa7dc('0x1c7'),'foreignKey':_0xa7dc('0x1c8')});db['ZohoField'][_0xa7dc('0x10e')](db[_0xa7dc('0x1ce')],{'as':_0xa7dc('0x1c9'),'foreignKey':'DescriptionId'});db[_0xa7dc('0x1ce')]['hasMany'](db[_0xa7dc('0x1ce')],{'as':_0xa7dc('0x1cc'),'foreignKey':_0xa7dc('0x1c6')});db['ZohoField'][_0xa7dc('0x11b')](db[_0xa7dc('0x92')],{'as':'Variable','foreignKey':'VariableId'});db[_0xa7dc('0xaf')]['hasMany'](db[_0xa7dc('0x1cf')],{'as':_0xa7dc('0x1c2'),'onDelete':'cascade','foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0x1cf')][_0xa7dc('0x10e')](db[_0xa7dc('0x1d0')],{'as':_0xa7dc('0x1c4'),'foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0x1cf')]['hasMany'](db['ZendeskField'],{'as':_0xa7dc('0x1c5'),'foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0x1cf')][_0xa7dc('0x10e')](db[_0xa7dc('0x1d0')],{'as':_0xa7dc('0x1c0'),'foreignKey':_0xa7dc('0x1c6')});db[_0xa7dc('0x1cf')][_0xa7dc('0x11b')](db[_0xa7dc('0xaf')],{'as':'Account','foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0x1cf')][_0xa7dc('0x11e')](db[_0xa7dc('0x87')],{'through':'int_zendesk_configuration_has_tags'});db[_0xa7dc('0x1d0')]['hasMany'](db[_0xa7dc('0x1d0')],{'as':_0xa7dc('0x1c7'),'foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0x1d0')][_0xa7dc('0x10e')](db[_0xa7dc('0x1d0')],{'as':_0xa7dc('0x1c9'),'foreignKey':'DescriptionId'});db['ZendeskField']['hasMany'](db[_0xa7dc('0x1d0')],{'as':_0xa7dc('0x1cc'),'foreignKey':_0xa7dc('0x1c6')});db[_0xa7dc('0x1d0')][_0xa7dc('0x11b')](db[_0xa7dc('0x92')],{'as':_0xa7dc('0x92'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0xa7dc('0x10e')](db[_0xa7dc('0x1d1')],{'as':'Configurations','onDelete':_0xa7dc('0x10b'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xa7dc('0x10e')](db[_0xa7dc('0xb6')],{'as':_0xa7dc('0x1c4'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0x1d1')]['hasMany'](db[_0xa7dc('0xb6')],{'as':_0xa7dc('0x1c5'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0x1d1')][_0xa7dc('0x10e')](db[_0xa7dc('0xb6')],{'as':_0xa7dc('0x1c0'),'onDelete':'cascade','foreignKey':_0xa7dc('0x1c6')});db[_0xa7dc('0x1d1')][_0xa7dc('0x11b')](db[_0xa7dc('0xb3')],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0x1d1')][_0xa7dc('0x11e')](db[_0xa7dc('0x87')],{'through':_0xa7dc('0x1d2')});db[_0xa7dc('0xb6')]['hasMany'](db[_0xa7dc('0xb6')],{'as':_0xa7dc('0x1c7'),'foreignKey':'SubjectId'});db['FreshdeskField']['hasMany'](db[_0xa7dc('0xb6')],{'as':'Description','foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xb6')][_0xa7dc('0x10e')](db[_0xa7dc('0xb6')],{'as':_0xa7dc('0x1cc'),'foreignKey':_0xa7dc('0x1c6')});db[_0xa7dc('0xb6')][_0xa7dc('0x11b')](db[_0xa7dc('0x92')],{'as':_0xa7dc('0x92'),'foreignKey':_0xa7dc('0x1cb')});db[_0xa7dc('0xb7')][_0xa7dc('0x10e')](db['VtigerConfiguration'],{'as':_0xa7dc('0x1c2'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0xb9')][_0xa7dc('0x10e')](db[_0xa7dc('0xbb')],{'as':_0xa7dc('0x1c4'),'foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0xb9')]['hasMany'](db[_0xa7dc('0xbb')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xa7dc('0xb9')][_0xa7dc('0x10e')](db[_0xa7dc('0xbb')],{'as':_0xa7dc('0x1c0'),'foreignKey':_0xa7dc('0x1c6')});db[_0xa7dc('0xb9')][_0xa7dc('0x11b')](db[_0xa7dc('0xb7')],{'as':'Account','foreignKey':'AccountId'});db[_0xa7dc('0xbb')]['hasMany'](db[_0xa7dc('0xbb')],{'as':_0xa7dc('0x1c7'),'foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0xbb')][_0xa7dc('0x10e')](db[_0xa7dc('0xbb')],{'as':_0xa7dc('0x1c9'),'foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xbb')][_0xa7dc('0x10e')](db[_0xa7dc('0xbb')],{'as':_0xa7dc('0x1cc'),'foreignKey':'FieldId'});db[_0xa7dc('0xbb')][_0xa7dc('0x11b')](db[_0xa7dc('0x92')],{'as':_0xa7dc('0x92'),'foreignKey':'VariableId'});db[_0xa7dc('0x1d3')][_0xa7dc('0x10e')](db[_0xa7dc('0xbe')],{'as':_0xa7dc('0x1c2'),'onDelete':_0xa7dc('0x10b'),'foreignKey':'AccountId'});db[_0xa7dc('0xbe')][_0xa7dc('0x10e')](db[_0xa7dc('0xbf')],{'as':_0xa7dc('0x1c4'),'foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0xbe')]['hasMany'](db[_0xa7dc('0xbf')],{'as':_0xa7dc('0x1c5'),'foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xbe')][_0xa7dc('0x10e')](db[_0xa7dc('0xbf')],{'as':'Fields','foreignKey':'FieldId'});db[_0xa7dc('0xbe')][_0xa7dc('0x11b')](db[_0xa7dc('0x1d3')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0xa7dc('0x10e')](db[_0xa7dc('0xbf')],{'as':_0xa7dc('0x1c7'),'foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0xbf')][_0xa7dc('0x10e')](db[_0xa7dc('0xbf')],{'as':_0xa7dc('0x1c9'),'foreignKey':'DescriptionId'});db[_0xa7dc('0xbf')][_0xa7dc('0x10e')](db[_0xa7dc('0xbf')],{'as':_0xa7dc('0x1cc'),'foreignKey':'FieldId'});db[_0xa7dc('0xbf')]['belongsTo'](db[_0xa7dc('0x92')],{'as':_0xa7dc('0x92'),'foreignKey':_0xa7dc('0x1cb')});db[_0xa7dc('0x1d4')][_0xa7dc('0x10e')](db[_0xa7dc('0xc2')],{'as':_0xa7dc('0x1c2'),'onDelete':'cascade','foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0x1d4')][_0xa7dc('0x11b')](db[_0xa7dc('0x103')],{'as':_0xa7dc('0x103'),'foreignKey':_0xa7dc('0x15d')});db[_0xa7dc('0xc2')]['hasMany'](db[_0xa7dc('0xc3')],{'as':'Subjects','onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0xc2')][_0xa7dc('0x10e')](db[_0xa7dc('0xc3')],{'as':_0xa7dc('0x1c5'),'onDelete':'cascade','foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xc2')]['hasMany'](db[_0xa7dc('0xc3')],{'as':_0xa7dc('0x1c0'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c6')});db['Dynamics365Configuration'][_0xa7dc('0x11b')](db[_0xa7dc('0x1d4')],{'as':'Account','foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0xc3')][_0xa7dc('0x10e')](db[_0xa7dc('0xc3')],{'as':_0xa7dc('0x1c7'),'foreignKey':'SubjectId'});db[_0xa7dc('0xc3')][_0xa7dc('0x10e')](db['Dynamics365Field'],{'as':_0xa7dc('0x1c9'),'foreignKey':_0xa7dc('0x1ca')});db['Dynamics365Field'][_0xa7dc('0x10e')](db[_0xa7dc('0xc3')],{'as':_0xa7dc('0x1cc'),'foreignKey':'FieldId'});db[_0xa7dc('0xc3')][_0xa7dc('0x11b')](db[_0xa7dc('0x92')],{'as':_0xa7dc('0x92'),'foreignKey':'VariableId'});db[_0xa7dc('0xc4')][_0xa7dc('0x10e')](db[_0xa7dc('0xc5')],{'as':_0xa7dc('0x1c2'),'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1c3')});db[_0xa7dc('0xc5')][_0xa7dc('0x10e')](db[_0xa7dc('0xc7')],{'as':_0xa7dc('0x1c4'),'foreignKey':_0xa7dc('0x1c8')});db['FreshsalesConfiguration'][_0xa7dc('0x10e')](db['FreshsalesField'],{'as':_0xa7dc('0x1c5'),'foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xc5')][_0xa7dc('0x10e')](db[_0xa7dc('0xc7')],{'as':'Fields','foreignKey':_0xa7dc('0x1c6')});db[_0xa7dc('0xc5')][_0xa7dc('0x11b')](db[_0xa7dc('0xc4')],{'as':_0xa7dc('0x171'),'foreignKey':'AccountId'});db[_0xa7dc('0xc7')]['hasMany'](db[_0xa7dc('0xc7')],{'as':_0xa7dc('0x1c7'),'foreignKey':_0xa7dc('0x1c8')});db[_0xa7dc('0xc7')][_0xa7dc('0x10e')](db['FreshsalesField'],{'as':_0xa7dc('0x1c9'),'foreignKey':_0xa7dc('0x1ca')});db[_0xa7dc('0xc7')]['hasMany'](db['FreshsalesField'],{'as':'Field','foreignKey':_0xa7dc('0x1c6')});db[_0xa7dc('0xc7')][_0xa7dc('0x11b')](db['Variable'],{'as':'Variable','foreignKey':_0xa7dc('0x1cb')});db[_0xa7dc('0xcb')]['belongsTo'](db['ChatWebsite'],{});db['ChatQueueReport'][_0xa7dc('0x11b')](db['CmList'],{'as':_0xa7dc('0x165'),'foreignKey':_0xa7dc('0x166')});db[_0xa7dc('0xcb')]['belongsTo'](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':'ContactId'});db[_0xa7dc('0xcb')]['belongsTo'](db[_0xa7dc('0x116')],{});db[_0xa7dc('0xcb')][_0xa7dc('0x11b')](db[_0xa7dc('0x198')],{});db[_0xa7dc('0xcb')][_0xa7dc('0x11b')](db['User'],{});db[_0xa7dc('0xcb')][_0xa7dc('0x11b')](db[_0xa7dc('0x67')],{});db[_0xa7dc('0xcd')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1d5')});db['ChatInternalMessage']['belongsTo'](db[_0xa7dc('0x13')],{'onDelete':_0xa7dc('0x10b'),'foreignKey':_0xa7dc('0x1d6')});db[_0xa7dc('0x148')][_0xa7dc('0x10e')](db[_0xa7dc('0xd0')],{'foreignKey':_0xa7dc('0x1d7'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x148')][_0xa7dc('0x10e')](db[_0xa7dc('0x1d8')],{'foreignKey':'SessionId','onDelete':_0xa7dc('0x10b')});db['SmsQueueReport'][_0xa7dc('0x11b')](db['SmsAccount'],{});db[_0xa7dc('0xd2')][_0xa7dc('0x11b')](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x165'),'foreignKey':'ListId'});db[_0xa7dc('0xd2')][_0xa7dc('0x11b')](db['CmContact'],{'as':_0xa7dc('0x16b'),'foreignKey':_0xa7dc('0x15a')});db[_0xa7dc('0xd2')][_0xa7dc('0x11b')](db[_0xa7dc('0x53')],{});db[_0xa7dc('0xd2')][_0xa7dc('0x11b')](db[_0xa7dc('0x54')],{});db[_0xa7dc('0xd2')][_0xa7dc('0x11b')](db['User'],{});db[_0xa7dc('0xd2')]['belongsTo'](db[_0xa7dc('0x55')],{});db[_0xa7dc('0xd6')][_0xa7dc('0x10e')](db[_0xa7dc('0x148')],{'foreignKey':_0xa7dc('0x1d9')});db['JscriptyProject']['hasMany'](db[_0xa7dc('0xd0')],{'foreignKey':_0xa7dc('0x1d9')});db[_0xa7dc('0xd6')][_0xa7dc('0x10e')](db[_0xa7dc('0x1d8')],{'foreignKey':_0xa7dc('0x1d9')});db['Team']['belongsToMany'](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x150'),'through':'user_has_teams'});db['Team'][_0xa7dc('0x11e')](db[_0xa7dc('0x1d')],{'through':_0xa7dc('0x152'),'as':_0xa7dc('0x129')});db[_0xa7dc('0x123')]['belongsToMany'](db[_0xa7dc('0x3f')],{'through':_0xa7dc('0x16a'),'as':_0xa7dc('0x12b')});db[_0xa7dc('0x123')][_0xa7dc('0x11e')](db[_0xa7dc('0x67')],{'through':_0xa7dc('0x1da'),'as':_0xa7dc('0x1db')});db['Team']['belongsToMany'](db[_0xa7dc('0x12c')],{'through':_0xa7dc('0x181'),'as':_0xa7dc('0x12d')});db[_0xa7dc('0x123')]['belongsToMany'](db[_0xa7dc('0x55')],{'through':_0xa7dc('0x189'),'as':_0xa7dc('0x12f')});db[_0xa7dc('0x123')]['belongsToMany'](db[_0xa7dc('0x130')],{'through':_0xa7dc('0x18e'),'as':_0xa7dc('0x1dc')});db[_0xa7dc('0x123')][_0xa7dc('0x11e')](db['WhatsappQueue'],{'through':_0xa7dc('0x1dd'),'as':_0xa7dc('0x1de')});db[_0xa7dc('0x123')][_0xa7dc('0x11e')](db[_0xa7dc('0x1df')],{'through':_0xa7dc('0x104'),'as':_0xa7dc('0x12a')});db[_0xa7dc('0xe2')][_0xa7dc('0x10e')](db[_0xa7dc('0x6e')],{'as':_0xa7dc('0x144'),'foreignKey':_0xa7dc('0x1a0')});db[_0xa7dc('0xe2')][_0xa7dc('0x10e')](db['CmHopperFinal'],{'as':_0xa7dc('0x114'),'foreignKey':_0xa7dc('0x1a0')});db[_0xa7dc('0xe2')][_0xa7dc('0x10e')](db[_0xa7dc('0x71')],{'as':_0xa7dc('0x145'),'foreignKey':'CampaignId'});db[_0xa7dc('0xe2')]['hasMany'](db[_0xa7dc('0x146')],{'as':_0xa7dc('0x147'),'foreignKey':_0xa7dc('0x1a0')});db['Campaign'][_0xa7dc('0x11b')](db['Trunk'],{'as':_0xa7dc('0x14a'),'foreignKey':'TrunkId'});db[_0xa7dc('0xe2')][_0xa7dc('0x11b')](db[_0xa7dc('0x14a')],{'as':'TrunkBackup','foreignKey':_0xa7dc('0x14d')});db[_0xa7dc('0xe2')][_0xa7dc('0x11b')](db[_0xa7dc('0x7b')],{'as':_0xa7dc('0x7b'),'foreignKey':_0xa7dc('0x14e')});db[_0xa7dc('0xe2')]['belongsTo'](db['SquareProject'],{'as':_0xa7dc('0xdb'),'foreignKey':'SquareProjectId'});db[_0xa7dc('0xe2')][_0xa7dc('0x11e')](db[_0xa7dc('0xf1')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xa7dc('0xe2')]['belongsToMany'](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x153'),'through':_0xa7dc('0x1e0')});db[_0xa7dc('0x17f')][_0xa7dc('0x11b')](db['ChatOfflineMessage'],{'as':_0xa7dc('0x65'),'foreignKey':_0xa7dc('0x173')});db[_0xa7dc('0xe8')][_0xa7dc('0x11b')](db['MailMessage'],{});db[_0xa7dc('0xe8')]['belongsTo'](db[_0xa7dc('0x42')],{});db[_0xa7dc('0xe8')][_0xa7dc('0x11b')](db[_0xa7dc('0x3d')],{'foreignKey':_0xa7dc('0x1e1'),'as':_0xa7dc('0x1e2')});db[_0xa7dc('0xe8')]['belongsTo'](db[_0xa7dc('0x13')],{'foreignKey':_0xa7dc('0x1e3'),'as':_0xa7dc('0x1e4')});db[_0xa7dc('0xe8')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db['MailTransferReport']['belongsTo'](db['MailQueue'],{'foreignKey':_0xa7dc('0x1e5'),'as':'ToQueue'});db[_0xa7dc('0xe8')][_0xa7dc('0x11b')](db['MailAccount'],{'foreignKey':_0xa7dc('0x1e6'),'as':_0xa7dc('0x1e7')});db[_0xa7dc('0xea')]['belongsTo'](db[_0xa7dc('0x198')],{});db['ChatTransferReport'][_0xa7dc('0x11b')](db[_0xa7dc('0x116')],{});db[_0xa7dc('0xea')]['belongsTo'](db[_0xa7dc('0x60')],{'foreignKey':_0xa7dc('0x1e8'),'as':_0xa7dc('0x1e2')});db[_0xa7dc('0xea')]['belongsTo'](db[_0xa7dc('0x13')],{'foreignKey':_0xa7dc('0x1e3'),'as':_0xa7dc('0x1e4')});db[_0xa7dc('0xea')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'foreignKey':_0xa7dc('0x1e9'),'as':_0xa7dc('0x1ea')});db[_0xa7dc('0xea')]['belongsTo'](db[_0xa7dc('0x67')],{'foreignKey':_0xa7dc('0x1eb'),'as':_0xa7dc('0x1ec')});db[_0xa7dc('0xea')][_0xa7dc('0x11b')](db[_0xa7dc('0x60')],{'foreignKey':_0xa7dc('0x1ed'),'as':_0xa7dc('0x1e7')});db['FaxTransferReport'][_0xa7dc('0x11b')](db['FaxMessage'],{});db['FaxTransferReport'][_0xa7dc('0x11b')](db['FaxInteraction'],{});db[_0xa7dc('0xec')]['belongsTo'](db[_0xa7dc('0x135')],{'foreignKey':_0xa7dc('0x1ee'),'as':_0xa7dc('0x1e2')});db[_0xa7dc('0xec')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'foreignKey':_0xa7dc('0x1e3'),'as':_0xa7dc('0x1e4')});db[_0xa7dc('0xec')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'foreignKey':_0xa7dc('0x1e9'),'as':_0xa7dc('0x1ea')});db[_0xa7dc('0xec')][_0xa7dc('0x11b')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0xa7dc('0xec')][_0xa7dc('0x11b')](db[_0xa7dc('0x135')],{'foreignKey':_0xa7dc('0x1ef'),'as':_0xa7dc('0x1e7')});db[_0xa7dc('0x1f0')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xa7dc('0x1f0')][_0xa7dc('0x11b')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xa7dc('0x11b')](db['OpenchannelAccount'],{'foreignKey':_0xa7dc('0x1f1'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'foreignKey':_0xa7dc('0x1e3'),'as':'FromAgent'});db[_0xa7dc('0x1f0')]['belongsTo'](db[_0xa7dc('0x13')],{'foreignKey':_0xa7dc('0x1e9'),'as':_0xa7dc('0x1ea')});db['OpenchannelTransferReport']['belongsTo'](db[_0xa7dc('0x130')],{'foreignKey':_0xa7dc('0x1f2'),'as':_0xa7dc('0x1ec')});db[_0xa7dc('0x1f0')][_0xa7dc('0x11b')](db[_0xa7dc('0x57')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport'][_0xa7dc('0x11b')](db[_0xa7dc('0x54')],{});db[_0xa7dc('0xef')]['belongsTo'](db['SmsInteraction'],{});db[_0xa7dc('0xef')][_0xa7dc('0x11b')](db[_0xa7dc('0x50')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db['SmsTransferReport'][_0xa7dc('0x11b')](db['User'],{'foreignKey':'FromUserId','as':_0xa7dc('0x1e4')});db[_0xa7dc('0xef')][_0xa7dc('0x11b')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db[_0xa7dc('0x55')],{'foreignKey':'ToSmsQueueId','as':_0xa7dc('0x1ec')});db[_0xa7dc('0xef')]['belongsTo'](db[_0xa7dc('0x50')],{'foreignKey':_0xa7dc('0x1f3'),'as':'ToAccount'});db['CmList'][_0xa7dc('0x10e')](db[_0xa7dc('0x78')],{'as':_0xa7dc('0x182'),'foreignKey':_0xa7dc('0x166'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0xf1')]['hasMany'](db[_0xa7dc('0x73')],{'as':_0xa7dc('0x1f4'),'foreignKey':'ListId'});db[_0xa7dc('0xf1')][_0xa7dc('0x10e')](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x19a'),'onDelete':'cascade','foreignKey':_0xa7dc('0x166')});db[_0xa7dc('0xf1')][_0xa7dc('0x10e')](db[_0xa7dc('0x113')],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList'][_0xa7dc('0x10e')](db['CmHopperHistory'],{'as':_0xa7dc('0x1f5'),'foreignKey':'ListId'});db['CmList'][_0xa7dc('0x10e')](db[_0xa7dc('0x72')],{'as':'ReportAgentPreview','foreignKey':_0xa7dc('0x166')});db[_0xa7dc('0xf1')][_0xa7dc('0x11e')](db[_0xa7dc('0x1d')],{'as':_0xa7dc('0x1f6'),'through':_0xa7dc('0x14f')});db['CmList'][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':'Agents','through':_0xa7dc('0x132')});db['VoicePrefix'][_0xa7dc('0x10e')](db[_0xa7dc('0x111')],{'as':_0xa7dc('0x112'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0x1df')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x150'),'through':_0xa7dc('0x106')});db[_0xa7dc('0x1df')][_0xa7dc('0x11e')](db['Team'],{'through':'TeamVoicePrefix','as':_0xa7dc('0x151')});db[_0xa7dc('0x11c')][_0xa7dc('0x10e')](db[_0xa7dc('0x13')],{'as':'Users','foreignKey':'userProfileId'});db[_0xa7dc('0x11c')][_0xa7dc('0x10e')](db[_0xa7dc('0xf4')],{'as':_0xa7dc('0x1f7'),'foreignKey':_0xa7dc('0x11d'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0xf4')][_0xa7dc('0x10e')](db[_0xa7dc('0x1f8')],{'as':_0xa7dc('0x1f9'),'foreignKey':_0xa7dc('0x1fa'),'onDelete':_0xa7dc('0x10b')});db['WhatsappAccount']['hasMany'](db[_0xa7dc('0x78')],{'as':_0xa7dc('0x182'),'foreignKey':_0xa7dc('0x1fb'),'onDelete':_0xa7dc('0x10b')});db[_0xa7dc('0xf9')][_0xa7dc('0x10e')](db['CannedAnswer'],{'as':_0xa7dc('0x162'),'foreignKey':_0xa7dc('0x1fb')});db[_0xa7dc('0xf9')][_0xa7dc('0x10e')](db['WhatsappMessage'],{'as':_0xa7dc('0x156'),'foreignKey':'WhatsappAccountId'});db[_0xa7dc('0xf9')][_0xa7dc('0x10e')](db[_0xa7dc('0xfc')],{'as':_0xa7dc('0x163')});db['WhatsappAccount']['hasMany'](db[_0xa7dc('0xfa')],{'as':_0xa7dc('0x164')});db['WhatsappAccount'][_0xa7dc('0x11b')](db['CmList'],{'as':_0xa7dc('0x165'),'foreignKey':_0xa7dc('0x166')});db[_0xa7dc('0xf9')][_0xa7dc('0x11b')](db[_0xa7dc('0x7d')],{'as':_0xa7dc('0x168'),'foreignKey':_0xa7dc('0x169')});db[_0xa7dc('0xf9')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x150'),'through':'user_has_whatsapp_accounts'});db[_0xa7dc('0xfa')]['belongsTo'](db[_0xa7dc('0x13')],{'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0xfa')][_0xa7dc('0x11b')](db[_0xa7dc('0x101')],{'onDelete':_0xa7dc('0x15e')});db['WhatsappApplication'][_0xa7dc('0x11b')](db[_0xa7dc('0xf9')],{'onDelete':'restrict'});db[_0xa7dc('0xfa')][_0xa7dc('0x11b')](db[_0xa7dc('0x7b')],{'onDelete':_0xa7dc('0x15e'),'foreignKey':_0xa7dc('0x14e')});db['WhatsappApplication'][_0xa7dc('0x11b')](db['Tag'],{'onDelete':_0xa7dc('0x15e'),'foreignKey':'TagId'});db[_0xa7dc('0xfc')][_0xa7dc('0x10e')](db[_0xa7dc('0xfd')],{'as':_0xa7dc('0x156'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0xa7dc('0x11b')](db[_0xa7dc('0xf9')],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x1fb')});db['WhatsappInteraction'][_0xa7dc('0x11b')](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':_0xa7dc('0x15a')});db[_0xa7dc('0xfc')][_0xa7dc('0x11b')](db['User'],{'as':_0xa7dc('0x16c'),'foreignKey':_0xa7dc('0x10c')});db[_0xa7dc('0xfc')][_0xa7dc('0x11e')](db[_0xa7dc('0x87')],{'through':_0xa7dc('0x1b2'),'as':_0xa7dc('0x186')});db[_0xa7dc('0xfc')]['belongsToMany'](db[_0xa7dc('0x87')],{'through':_0xa7dc('0x1b2'),'as':_0xa7dc('0x17d')});db[_0xa7dc('0xfc')][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x16e'),'through':_0xa7dc('0x128'),'foreignKey':_0xa7dc('0x1fc')});db[_0xa7dc('0xfd')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x13')});db['WhatsappMessage'][_0xa7dc('0x11b')](db[_0xa7dc('0x6d')],{'onDelete':'cascade','as':_0xa7dc('0x16b')});db[_0xa7dc('0xfd')][_0xa7dc('0x11b')](db[_0xa7dc('0xfc')],{'onDelete':_0xa7dc('0x10b'),'as':_0xa7dc('0x17e'),'foreignKey':_0xa7dc('0x1fc')});db[_0xa7dc('0xfd')][_0xa7dc('0x11b')](db[_0xa7dc('0xf9')],{'as':_0xa7dc('0x171'),'foreignKey':_0xa7dc('0x1fb')});db['WhatsappQueueReport']['belongsTo'](db[_0xa7dc('0xf9')],{});db[_0xa7dc('0xfe')]['belongsTo'](db[_0xa7dc('0xf1')],{'as':_0xa7dc('0x165'),'foreignKey':_0xa7dc('0x166')});db['WhatsappQueueReport']['belongsTo'](db[_0xa7dc('0x6d')],{'as':_0xa7dc('0x16b'),'foreignKey':_0xa7dc('0x15a')});db['WhatsappQueueReport']['belongsTo'](db[_0xa7dc('0xfc')],{});db[_0xa7dc('0xfe')][_0xa7dc('0x11b')](db[_0xa7dc('0x101')],{});db[_0xa7dc('0xfe')][_0xa7dc('0x11b')](db[_0xa7dc('0xfd')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xa7dc('0x13')],{});db[_0xa7dc('0xff')][_0xa7dc('0x11b')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0xa7dc('0x11b')](db[_0xa7dc('0xfc')],{});db[_0xa7dc('0xff')][_0xa7dc('0x11b')](db[_0xa7dc('0xf9')],{'foreignKey':_0xa7dc('0x1fd'),'as':_0xa7dc('0x1e2')});db[_0xa7dc('0xff')]['belongsTo'](db[_0xa7dc('0xf9')],{'foreignKey':_0xa7dc('0x1fe'),'as':_0xa7dc('0x1e7')});db[_0xa7dc('0xff')]['belongsTo'](db[_0xa7dc('0x101')],{'foreignKey':'ToQueueId','as':_0xa7dc('0x1ec')});db[_0xa7dc('0xff')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'foreignKey':_0xa7dc('0x1e3'),'as':'FromAgent'});db[_0xa7dc('0xff')][_0xa7dc('0x11b')](db['User'],{'foreignKey':_0xa7dc('0x1e9'),'as':'ToAgent'});db['WhatsappQueue'][_0xa7dc('0x11e')](db[_0xa7dc('0x13')],{'as':_0xa7dc('0x150'),'through':_0xa7dc('0x3a'),'foreignKey':'WhatsappQueueId'});db[_0xa7dc('0x101')][_0xa7dc('0x11e')](db[_0xa7dc('0x123')],{'through':'team_has_whatsapp_queues','as':_0xa7dc('0x151')});db[_0xa7dc('0x108')][_0xa7dc('0x11b')](db[_0xa7dc('0x13')],{'as':'user','foreignKey':_0xa7dc('0x10c'),'onDelete':_0xa7dc('0x10b'),'hooks':!![]});db[_0xa7dc('0x103')][_0xa7dc('0x10a')](db[_0xa7dc('0x1d4')],{'as':_0xa7dc('0x1d4'),'onDelete':_0xa7dc('0x15e')});db[_0xa7dc('0x103')][_0xa7dc('0x10a')](db[_0xa7dc('0x15b')],{'as':_0xa7dc('0x15f'),'onDelete':_0xa7dc('0x15e')});db['CloudProvider'][_0xa7dc('0x10a')](db['MailServerOut'],{'as':_0xa7dc('0x160'),'onDelete':'restrict'});module[_0xa7dc('0x1ff')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x8e19=['../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','CmList','VoicePrefix','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','hasOne','cascade','UserId','userSetting','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','OpenchannelQueues','UserOpenchannelQueue','cm_user_has_lists','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','belongsTo','IntervalId','mandatoryDispositionPause','Agents','Teams','BlackLists','VoiceMailMessage','mailbox','mailboxuser','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccount','MailAccountId','restrict','MailServerOut','CloudProviderId','Imap','Smtp','Dispositions','Messages','Interactions','Applications','ListId','TemplateId','mandatoryDispositionPauseId','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tag','Attachment','Attachments','Interaction','ChatOfflineMessageId','TagId','MailQueueReport','List','Dashboard','Items','FaxAccountId','fax_interaction_has_tags','Tags','ThroughTags','user_has_fax_interactions','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccount','Answers','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','Users','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatGroupId','CompanyId','CmContactId','CmCompany','Company','cm_contact_has_tags','CmHopperId','CampaignId','All','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','FaxApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ContactItemType','ItemType','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SalesforceConfiguration','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','SugarcrmField','int_desk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','FreshsalesConfiguration','FreshsalesField','FromId','SessionId','SmsQueueReport','ProjectId','team_has_mail_queues','team_has_chat_queues','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','lodash','jstz','determine','defaultsDeep','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','database','sequelize','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn'];(function(_0x370411,_0x3bbd23){var _0x121901=function(_0x251d7b){while(--_0x251d7b){_0x370411['push'](_0x370411['shift']());}};_0x121901(++_0x3bbd23);}(_0x8e19,0x1c8));var _0x98e1=function(_0x4143d1,_0x4716d0){_0x4143d1=_0x4143d1-0x0;var _0x28d009=_0x8e19[_0x4143d1];return _0x28d009;};'use strict';var config=require(_0x98e1('0x0'));var Sequelize=require('sequelize');var _=require(_0x98e1('0x1'));var jstz=require(_0x98e1('0x2'));var timezone=jstz[_0x98e1('0x3')]();config['sequelize']=_[_0x98e1('0x4')](config['sequelize'],{'database':'motion2','username':_0x98e1('0x5'),'password':'xC@LL1234','options':{'host':_0x98e1('0x6'),'port':0xcea,'dialect':_0x98e1('0x7'),'dialectOptions':{'charset':_0x98e1('0x8')},'logging':![],'timezone':timezone[_0x98e1('0x9')](),'define':{'charset':_0x98e1('0xa'),'collate':_0x98e1('0xb')}}});config[_0x98e1('0xc')]=_[_0x98e1('0x4')](config[_0x98e1('0xc')],{'database':'motion2','username':'xcall','password':_0x98e1('0xd'),'options':{'host':_0x98e1('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x98e1('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x98e1('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x98e1('0xe')],config['sequelize']['username'],config[_0x98e1('0xf')][_0x98e1('0x10')],config[_0x98e1('0xf')][_0x98e1('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x98e1('0xe')],config[_0x98e1('0xc')]['username'],config['sequelizeHistory'][_0x98e1('0x10')],config[_0x98e1('0xc')][_0x98e1('0x11')])};db[_0x98e1('0x12')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/user/user.model');db[_0x98e1('0x14')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x15'));db[_0x98e1('0x16')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x98e1('0x17')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x98e1('0x18')]=db['sequelize']['import'](_0x98e1('0x19'));db['VoiceRecording']=db[_0x98e1('0xf')]['import'](_0x98e1('0x1a'));db[_0x98e1('0x1b')]=db['sequelize'][_0x98e1('0x13')]('../api/screenRecording/screenRecording.model');db[_0x98e1('0x1c')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x1d'));db['VoiceMailMessage']=db[_0x98e1('0xf')]['import'](_0x98e1('0x1e'));db[_0x98e1('0x1f')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x20'));db['VoiceAgentReport']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x21'));db[_0x98e1('0x22')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x23'));db['MemberReport']=db[_0x98e1('0xf')]['import'](_0x98e1('0x24'));db[_0x98e1('0x25')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x26'));db[_0x98e1('0x27')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x28'));db[_0x98e1('0x29')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x2a'));db[_0x98e1('0x2b')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x2c'));db[_0x98e1('0x2d')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x2e'));db[_0x98e1('0x2f')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x98e1('0x30')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x31'));db[_0x98e1('0x32')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x33'));db['UserOpenchannelQueue']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x34'));db[_0x98e1('0x35')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x36'));db[_0x98e1('0x37')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x38'));db['MailServerOut']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x39'));db['MailAccount']=db[_0x98e1('0xf')]['import'](_0x98e1('0x3a'));db[_0x98e1('0x3b')]=db['sequelize']['import'](_0x98e1('0x3c'));db[_0x98e1('0x3d')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x3e'));db[_0x98e1('0x3f')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x40'));db[_0x98e1('0x41')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x42'));db[_0x98e1('0x43')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x44'));db['MailQueueReport']=db[_0x98e1('0xf')]['import'](_0x98e1('0x45'));db['Dashboard']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x46'));db[_0x98e1('0x47')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x48'));db[_0x98e1('0x49')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x4a'));db[_0x98e1('0x4b')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x4c'));db[_0x98e1('0x4d')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x4e'));db[_0x98e1('0x4f')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x50'));db[_0x98e1('0x51')]=db[_0x98e1('0xf')]['import']('../api/faxQueue/faxQueue.model');db[_0x98e1('0x52')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x53'));db[_0x98e1('0x54')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x55'));db[_0x98e1('0x56')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x57'));db[_0x98e1('0x58')]=db[_0x98e1('0xf')]['import']('../api/smsMessage/smsMessage.model');db[_0x98e1('0x59')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x5a'));db[_0x98e1('0x5b')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x98e1('0x5c')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x5d'));db[_0x98e1('0x5e')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x5f'));db[_0x98e1('0x60')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x61'));db[_0x98e1('0x62')]=db['sequelize']['import'](_0x98e1('0x63'));db[_0x98e1('0x64')]=db['sequelize'][_0x98e1('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x98e1('0x65')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x66'));db[_0x98e1('0x67')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x68'));db['ChatInteraction']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x69'));db[_0x98e1('0x6a')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x6b'));db[_0x98e1('0x6c')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x6d'));db[_0x98e1('0x6e')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/chatQueue/chatQueue.model');db[_0x98e1('0x6f')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x70'));db[_0x98e1('0x71')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x72'));db['CmCompany']=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x73'));db[_0x98e1('0x74')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x75'));db[_0x98e1('0x76')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x77'));db['CmHopperBlack']=db[_0x98e1('0xf')]['import'](_0x98e1('0x78'));db[_0x98e1('0x79')]=db['sequelize']['import'](_0x98e1('0x7a'));db[_0x98e1('0x7b')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x7c'));db[_0x98e1('0x7d')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x7e'));db['CmCustomField']=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x7f'));db[_0x98e1('0x80')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x81'));db[_0x98e1('0x82')]=db['sequelize'][_0x98e1('0x13')]('../api/automation/automation.model');db[_0x98e1('0x83')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x84'));db[_0x98e1('0x85')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/disposition/disposition.model');db[_0x98e1('0x86')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/condition/condition.model');db[_0x98e1('0x87')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x88'));db[_0x98e1('0x89')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x8a'));db[_0x98e1('0x8b')]=db['sequelize']['import'](_0x98e1('0x8c'));db['VoiceQueuesLog']=db['sequelize']['import'](_0x98e1('0x8d'));db[_0x98e1('0x8e')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x8f'));db[_0x98e1('0x90')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x91'));db['Tag']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x92'));db['ContactItemType']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x93'));db[_0x98e1('0x94')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x95'));db[_0x98e1('0x96')]=db['sequelize']['import'](_0x98e1('0x97'));db[_0x98e1('0x98')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x99'));db['Trigger']=db['sequelize']['import'](_0x98e1('0x9a'));db[_0x98e1('0x9b')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x9c'));db[_0x98e1('0x9d')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x9e'));db['IntegrationReport']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x9f'));db['AnalyticCustomReport']=db[_0x98e1('0xf')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x98e1('0xa0')]=db['sequelize']['import'](_0x98e1('0xa1'));db['AnalyticExtractedReport']=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db['sequelize'][_0x98e1('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x98e1('0xa2')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xa3'));db[_0x98e1('0xa4')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xa5'));db['SalesforceConfiguration']=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xa6'));db['SalesforceField']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xa7'));db[_0x98e1('0xa8')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xa9'));db[_0x98e1('0xaa')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xab'));db['SugarcrmField']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xac'));db[_0x98e1('0xad')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xae'));db[_0x98e1('0xaf')]=db['sequelize'][_0x98e1('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x98e1('0xb0')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xb1'));db[_0x98e1('0xb2')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xb3'));db[_0x98e1('0xb4')]=db['sequelize'][_0x98e1('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x98e1('0xb5')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xb6'));db[_0x98e1('0xb7')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xb8'));db[_0x98e1('0xb9')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xba'));db[_0x98e1('0xbb')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xbc'));db['FreshdeskAccount']=db['sequelize'][_0x98e1('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x98e1('0xbd')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xbe'));db[_0x98e1('0xbf')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xc0'));db[_0x98e1('0xc1')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xc2'));db['VtigerConfiguration']=db[_0x98e1('0xf')]['import'](_0x98e1('0xc3'));db['VtigerField']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xc4'));db[_0x98e1('0xc5')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xc6'));db[_0x98e1('0xc7')]=db['sequelize']['import'](_0x98e1('0xc8'));db[_0x98e1('0xc9')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xca'));db[_0x98e1('0xcb')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xcc'));db[_0x98e1('0xcd')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x98e1('0xce')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xcf'));db[_0x98e1('0xd0')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xd1'));db['FreshsalesConfiguration']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xd2'));db['FreshsalesField']=db[_0x98e1('0xf')]['import'](_0x98e1('0xd3'));db[_0x98e1('0x9d')]=db[_0x98e1('0xf')]['import']('../api/integration/integration.model');db['Network']=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xd4'));db[_0x98e1('0xd5')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x98e1('0xd6')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xd7'));db['JscriptyAnswerReport']=db[_0x98e1('0xf')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x98e1('0xd8')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xd9'));db[_0x98e1('0xda')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db['sequelize']['import'](_0x98e1('0xdb'));db[_0x98e1('0xdc')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/squareReport/squareReport.model');db[_0x98e1('0xdd')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x98e1('0xde')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/jscriptyProject/jscriptyProject.model');db[_0x98e1('0xdf')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xe0'));db[_0x98e1('0xe1')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x98e1('0xe2')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xe3'));db[_0x98e1('0xe4')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xe5'));db[_0x98e1('0xe6')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xe7'));db[_0x98e1('0xe8')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xe9'));db[_0x98e1('0xea')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/license/license.model');db[_0x98e1('0xeb')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xec'));db[_0x98e1('0xed')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xee'));db['Attachment']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xef'));db[_0x98e1('0xf0')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xf1'));db[_0x98e1('0xf2')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xf3'));db[_0x98e1('0xf4')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xf5'));db[_0x98e1('0xf6')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xf7'));db[_0x98e1('0xf8')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x98e1('0xf9')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x98e1('0xfa')]=db['sequelize']['import']('../api/cmList/cmList.model');db[_0x98e1('0xfb')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0x98e1('0xfc')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/userProfile/userProfile.model');db[_0x98e1('0xfd')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xfe'));db['UserProfileResource']=db[_0x98e1('0xf')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x98e1('0xff')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x100'));db[_0x98e1('0x101')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x102'));db[_0x98e1('0x103')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x104'));db[_0x98e1('0x105')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x106'));db[_0x98e1('0x107')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x98e1('0x108')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x109'));db[_0x98e1('0x10a')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x10b'));db[_0x98e1('0x10c')]=db[_0x98e1('0xf')]['import']('../api/cloudProvider/cloudProvider.model');db[_0x98e1('0x10d')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x10e'));db[_0x98e1('0x10f')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x110'));db[_0x98e1('0x111')]=db[_0x98e1('0xf')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0x98e1('0x112')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/user-setting/user-setting.model');db['User'][_0x98e1('0x113')](db[_0x98e1('0x1c')],{'as':'VoiceMail','onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')]['hasOne'](db[_0x98e1('0x112')],{'as':_0x98e1('0x116'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x118')],{'as':_0x98e1('0x119'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x29')],{'as':_0x98e1('0x11a'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':_0x98e1('0x11c'),'onDelete':_0x98e1('0x114'),'hooks':!![]});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x79')],{'as':_0x98e1('0x11d'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x7b')],{'as':_0x98e1('0x11e'),'foreignKey':'UserId'});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x7d')],{'as':_0x98e1('0x7d'),'foreignKey':_0x98e1('0x115')});db['User'][_0x98e1('0x117')](db[_0x98e1('0x5e')],{'as':_0x98e1('0x11f'),'foreignKey':_0x98e1('0x115')});db['User'][_0x98e1('0x117')](db[_0x98e1('0x120')],{'as':_0x98e1('0x121'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')]['hasMany'](db['SmsInteraction'],{'as':_0x98e1('0x122'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x4d')],{'as':_0x98e1('0x123'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x3f')],{'as':_0x98e1('0x124'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x125')],{'as':'WhatsappInteractions','foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db['UserNotification'],{'as':_0x98e1('0x126'),'foreignKey':_0x98e1('0x127')});db[_0x98e1('0x12')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x98e1('0x128')});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0x6f')],{'as':_0x98e1('0x12a'),'through':_0x98e1('0x12b')});db['User']['belongsToMany'](db[_0x98e1('0x74')],{'as':_0x98e1('0x12c'),'through':_0x98e1('0x12d')});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x12e'),'through':'cm_user_has_lists'});db['User'][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':_0x98e1('0x12f')});db['User'][_0x98e1('0x129')](db['MailInteraction'],{'as':_0x98e1('0x124'),'through':_0x98e1('0x130')});db[_0x98e1('0x12')][_0x98e1('0x129')](db['ChatInteraction'],{'as':_0x98e1('0x121'),'through':_0x98e1('0x131')});db['User'][_0x98e1('0x129')](db[_0x98e1('0x4d')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x98e1('0x12')]['belongsToMany'](db[_0x98e1('0x56')],{'as':_0x98e1('0x122'),'through':'user_has_sms_interactions'});db[_0x98e1('0x12')][_0x98e1('0x129')](db['OpenchannelInteraction'],{'as':_0x98e1('0x11f'),'through':_0x98e1('0x132')});db[_0x98e1('0x12')][_0x98e1('0x129')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x98e1('0x12')][_0x98e1('0x129')](db['VoiceQueue'],{'as':_0x98e1('0x133'),'through':_0x98e1('0x2b'),'required':![]});db['User']['belongsToMany'](db[_0x98e1('0xfb')],{'as':_0x98e1('0x134'),'through':_0x98e1('0x111'),'required':![]});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0x3b')],{'as':_0x98e1('0x135'),'through':_0x98e1('0x2f'),'required':![]});db['User'][_0x98e1('0x129')](db['ChatQueue'],{'as':_0x98e1('0x136'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x98e1('0x12')][_0x98e1('0x129')](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0x59')],{'as':'SmsQueues','through':_0x98e1('0x32'),'required':![]});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0x62')],{'as':_0x98e1('0x137'),'through':_0x98e1('0x138'),'required':![]});db['User']['belongsToMany'](db[_0x98e1('0x10a')],{'as':'WhatsappQueues','through':_0x98e1('0x35'),'required':![]});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0xfa')],{'through':_0x98e1('0x139')});db['User'][_0x98e1('0x129')](db['ChatWebsite'],{'as':_0x98e1('0x13a'),'through':_0x98e1('0x13b')});db[_0x98e1('0x12')][_0x98e1('0x129')](db['FaxAccount'],{'as':'FaxAccounts','through':_0x98e1('0x13c')});db[_0x98e1('0x12')][_0x98e1('0x129')](db['MailAccount'],{'as':_0x98e1('0x13d'),'through':_0x98e1('0x13e')});db['User'][_0x98e1('0x129')](db[_0x98e1('0x5b')],{'as':_0x98e1('0x13f'),'through':_0x98e1('0x140')});db['User'][_0x98e1('0x129')](db['SmsAccount'],{'as':_0x98e1('0x141'),'through':_0x98e1('0x142')});db['User'][_0x98e1('0x129')](db[_0x98e1('0x101')],{'as':_0x98e1('0x143'),'through':_0x98e1('0x144')});db[_0x98e1('0x14')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':_0x98e1('0x145'),'onDelete':_0x98e1('0x114'),'foreignKey':'ChanSpyId'});db[_0x98e1('0x16')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'onDelete':_0x98e1('0x114')});db[_0x98e1('0x11b')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':'Applications','onDelete':'cascade'});db[_0x98e1('0x17')][_0x98e1('0x129')](db[_0x98e1('0x90')],{'as':_0x98e1('0x146'),'through':_0x98e1('0x147')});db[_0x98e1('0x18')][_0x98e1('0x117')](db[_0x98e1('0x29')],{'as':_0x98e1('0x148'),'foreignKey':_0x98e1('0x149')});db[_0x98e1('0x18')][_0x98e1('0x117')](db['CmHopper'],{'as':_0x98e1('0x14a'),'foreignKey':_0x98e1('0x149')});db['VoiceQueue'][_0x98e1('0x117')](db[_0x98e1('0x79')],{'as':_0x98e1('0x11d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x98e1('0x117')](db[_0x98e1('0x7b')],{'as':_0x98e1('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x98e1('0x18')][_0x98e1('0x117')](db[_0x98e1('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0x98e1('0x149')});db[_0x98e1('0x18')][_0x98e1('0x117')](db[_0x98e1('0x14c')],{'as':_0x98e1('0x14d'),'foreignKey':'VoiceQueueId'});db[_0x98e1('0x18')][_0x98e1('0x117')](db['JscriptySessionReport'],{'as':_0x98e1('0x14e'),'foreignKey':_0x98e1('0x149')});db['VoiceQueue']['belongsTo'](db[_0x98e1('0x25')],{'as':_0x98e1('0x25'),'foreignKey':_0x98e1('0x14f')});db[_0x98e1('0x18')]['belongsTo'](db[_0x98e1('0x25')],{'as':_0x98e1('0x150'),'foreignKey':'TrunkBackupId'});db[_0x98e1('0x18')][_0x98e1('0x151')](db[_0x98e1('0x87')],{'as':_0x98e1('0x87'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0x18')][_0x98e1('0x151')](db['Pause'],{'as':_0x98e1('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x98e1('0x18')][_0x98e1('0x129')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x12e'),'through':'voice_queues_has_cm_lists'});db[_0x98e1('0x18')][_0x98e1('0x129')](db['User'],{'as':_0x98e1('0x154'),'through':_0x98e1('0x2b')});db[_0x98e1('0x18')][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'as':_0x98e1('0x155'),'through':_0x98e1('0x10d')});db[_0x98e1('0x18')][_0x98e1('0x129')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x156'),'through':'voice_queues_has_cm_blacklists'});db[_0x98e1('0x118')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x12'),'foreignKey':'UserId'});db['ScreenRecording'][_0x98e1('0x151')](db['User'],{'as':_0x98e1('0x12'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x1c')][_0x98e1('0x117')](db[_0x98e1('0x157')],{'as':'Messages','onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x98e1('0x158')});db[_0x98e1('0x157')][_0x98e1('0x151')](db[_0x98e1('0x1c')],{'foreignKey':_0x98e1('0x159'),'targetKey':'mailbox'});db[_0x98e1('0x1f')][_0x98e1('0x117')](db['VoiceQueueReport'],{'as':_0x98e1('0x15a'),'foreignKey':_0x98e1('0x15b'),'constraints':![]});db[_0x98e1('0x1f')][_0x98e1('0x117')](db[_0x98e1('0x15c')],{'as':_0x98e1('0x15d'),'foreignKey':'uniqueid','constraints':![]});db[_0x98e1('0x1f')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':'User','foreignKey':_0x98e1('0x115')});db['VoiceCallReport'][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x37')][_0x98e1('0x151')](db[_0x98e1('0x160')],{'as':_0x98e1('0x160'),'foreignKey':_0x98e1('0x161')});db[_0x98e1('0x37')][_0x98e1('0x151')](db[_0x98e1('0x10c')],{'as':_0x98e1('0x10c'),'foreignKey':'CloudProviderId','onDelete':_0x98e1('0x162')});db[_0x98e1('0x163')][_0x98e1('0x151')](db[_0x98e1('0x160')],{'as':'MailAccount','foreignKey':_0x98e1('0x161')});db[_0x98e1('0x163')][_0x98e1('0x151')](db[_0x98e1('0x10c')],{'as':_0x98e1('0x10c'),'foreignKey':_0x98e1('0x164'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x160')][_0x98e1('0x113')](db[_0x98e1('0x37')],{'as':_0x98e1('0x165'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x160')][_0x98e1('0x113')](db[_0x98e1('0x163')],{'as':_0x98e1('0x166'),'onDelete':'cascade'});db[_0x98e1('0x160')]['hasMany'](db['Disposition'],{'as':_0x98e1('0x167'),'foreignKey':'MailAccountId','onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x98e1('0x83')],{'as':'Answers','foreignKey':_0x98e1('0x161')});db['MailAccount']['hasMany'](db[_0x98e1('0x41')],{'as':_0x98e1('0x168'),'foreignKey':'MailAccountId'});db[_0x98e1('0x160')][_0x98e1('0x117')](db['MailInteraction'],{'as':_0x98e1('0x169')});db[_0x98e1('0x160')][_0x98e1('0x117')](db['MailApplication'],{'as':_0x98e1('0x16a')});db[_0x98e1('0x160')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x98e1('0x16b')});db['MailAccount'][_0x98e1('0x151')](db[_0x98e1('0x98')],{'as':_0x98e1('0x98'),'foreignKey':_0x98e1('0x16c')});db['MailAccount'][_0x98e1('0x151')](db[_0x98e1('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x98e1('0x16d')});db[_0x98e1('0x160')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x13e')});db[_0x98e1('0x3b')][_0x98e1('0x129')](db['User'],{'as':'Agents','through':_0x98e1('0x2f')});db[_0x98e1('0x3b')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db['MailInteraction'][_0x98e1('0x117')](db[_0x98e1('0x41')],{'as':_0x98e1('0x168'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x16e')});db[_0x98e1('0x3f')][_0x98e1('0x151')](db['MailAccount'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x161')});db['MailInteraction'][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x3f')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x170'),'foreignKey':_0x98e1('0x115')});db['MailInteraction'][_0x98e1('0x129')](db['Tag'],{'through':_0x98e1('0x171'),'as':'Tags'});db[_0x98e1('0x3f')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x171'),'as':'ThroughTags'});db[_0x98e1('0x3f')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':'Users','through':_0x98e1('0x130'),'foreignKey':_0x98e1('0x16e')});db['MailMessage'][_0x98e1('0x117')](db[_0x98e1('0x173')],{'as':_0x98e1('0x174'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x41')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x12')});db['MailMessage'][_0x98e1('0x151')](db[_0x98e1('0x74')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x15e')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':_0x98e1('0x175'),'foreignKey':_0x98e1('0x16e')});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':_0x98e1('0x161')});db[_0x98e1('0x41')]['belongsTo'](db[_0x98e1('0x64')],{'as':_0x98e1('0x64'),'foreignKey':'ChatWebsiteId'});db[_0x98e1('0x41')]['belongsTo'](db[_0x98e1('0x6c')],{'as':_0x98e1('0x6c'),'foreignKey':_0x98e1('0x176')});db[_0x98e1('0x43')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':'restrict'});db[_0x98e1('0x43')][_0x98e1('0x151')](db[_0x98e1('0x3b')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x43')]['belongsTo'](db[_0x98e1('0x160')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x43')][_0x98e1('0x151')](db[_0x98e1('0x87')],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0x43')][_0x98e1('0x151')](db[_0x98e1('0x172')],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x177')});db[_0x98e1('0x178')][_0x98e1('0x151')](db[_0x98e1('0x160')],{});db['MailQueueReport'][_0x98e1('0x151')](db['CmList'],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x178')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x178')][_0x98e1('0x151')](db[_0x98e1('0x3f')],{});db[_0x98e1('0x178')][_0x98e1('0x151')](db[_0x98e1('0x41')],{});db[_0x98e1('0x178')][_0x98e1('0x151')](db['User'],{});db['MailQueueReport'][_0x98e1('0x151')](db['MailQueue'],{});db[_0x98e1('0x17a')][_0x98e1('0x117')](db['DashboardItem'],{'as':_0x98e1('0x17b'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x49')][_0x98e1('0x117')](db[_0x98e1('0x85')],{'as':_0x98e1('0x167'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x98e1('0x49')][_0x98e1('0x117')](db[_0x98e1('0x83')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x98e1('0x49')]['hasMany'](db[_0x98e1('0x4d')],{'as':_0x98e1('0x169')});db[_0x98e1('0x49')]['hasMany'](db[_0x98e1('0x4b')],{'as':'Applications'});db[_0x98e1('0x49')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':'Exntensions','onDelete':_0x98e1('0x114')});db[_0x98e1('0x49')][_0x98e1('0x117')](db[_0x98e1('0x4f')],{'as':_0x98e1('0x168')});db['FaxAccount'][_0x98e1('0x151')](db[_0x98e1('0x25')],{'as':'Trunk'});db[_0x98e1('0x49')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x49')]['belongsTo'](db[_0x98e1('0x89')],{'as':_0x98e1('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x98e1('0x49')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':'Agents','through':_0x98e1('0x13c')});db[_0x98e1('0x4b')][_0x98e1('0x151')](db['User'],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x4b')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x4b')][_0x98e1('0x151')](db[_0x98e1('0x49')],{'onDelete':'restrict'});db[_0x98e1('0x4b')][_0x98e1('0x151')](db[_0x98e1('0x172')],{'onDelete':_0x98e1('0x162'),'foreignKey':'TagId'});db[_0x98e1('0x4d')][_0x98e1('0x117')](db[_0x98e1('0x4f')],{'as':_0x98e1('0x168'),'onDelete':_0x98e1('0x114'),'foreignKey':'FaxInteractionId'});db[_0x98e1('0x4d')][_0x98e1('0x151')](db[_0x98e1('0x49')],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x17c')});db[_0x98e1('0x4d')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x4d')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x170'),'foreignKey':'UserId'});db[_0x98e1('0x4d')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x17d'),'as':_0x98e1('0x17e')});db[_0x98e1('0x4d')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x17d'),'as':_0x98e1('0x17f')});db['FaxInteraction'][_0x98e1('0x129')](db['User'],{'as':'Users','through':_0x98e1('0x180'),'foreignKey':'FaxInteractionId'});db[_0x98e1('0x4f')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x12')});db[_0x98e1('0x4f')][_0x98e1('0x151')](db[_0x98e1('0x4d')],{'as':_0x98e1('0x175'),'foreignKey':_0x98e1('0x181')});db[_0x98e1('0x4f')][_0x98e1('0x151')](db['CmContact'],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x15e')});db['FaxMessage'][_0x98e1('0x151')](db['Attachment'],{'as':'Attachment','foreignKey':_0x98e1('0x182')});db[_0x98e1('0x4f')]['belongsTo'](db['FaxAccount'],{'as':_0x98e1('0x16f'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x30')});db['FaxQueue'][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':_0x98e1('0x183'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0x98e1('0x49')],{});db[_0x98e1('0x52')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x52')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':'ContactId'});db[_0x98e1('0x52')][_0x98e1('0x151')](db[_0x98e1('0x4d')],{});db[_0x98e1('0x52')][_0x98e1('0x151')](db[_0x98e1('0x4f')],{});db[_0x98e1('0x52')]['belongsTo'](db[_0x98e1('0x12')],{});db['FaxQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x51')],{});db[_0x98e1('0x184')][_0x98e1('0x117')](db['Disposition'],{'as':_0x98e1('0x167'),'foreignKey':'SmsAccountId','onDelete':_0x98e1('0x114')});db[_0x98e1('0x184')][_0x98e1('0x117')](db[_0x98e1('0x83')],{'as':_0x98e1('0x185'),'foreignKey':_0x98e1('0x186')});db[_0x98e1('0x184')]['hasMany'](db[_0x98e1('0x58')],{'as':_0x98e1('0x168'),'foreignKey':_0x98e1('0x186')});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0x98e1('0x169')});db['SmsAccount'][_0x98e1('0x117')](db['SmsApplication'],{'as':_0x98e1('0x16a')});db[_0x98e1('0x184')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':'ListId'});db[_0x98e1('0x184')][_0x98e1('0x151')](db['Pause'],{'as':_0x98e1('0x153'),'foreignKey':_0x98e1('0x16d')});db[_0x98e1('0x184')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x142')});db[_0x98e1('0x54')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x54')]['belongsTo'](db[_0x98e1('0x59')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x54')][_0x98e1('0x151')](db[_0x98e1('0x184')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x54')][_0x98e1('0x151')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x98e1('0x152')});db[_0x98e1('0x54')]['belongsTo'](db['Tag'],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x177')});db[_0x98e1('0x56')][_0x98e1('0x117')](db[_0x98e1('0x58')],{'as':_0x98e1('0x168'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x187')});db[_0x98e1('0x56')][_0x98e1('0x151')](db[_0x98e1('0x184')],{'as':_0x98e1('0x16f'),'foreignKey':'SmsAccountId'});db[_0x98e1('0x56')][_0x98e1('0x151')](db['CmContact'],{'as':'Contact','foreignKey':_0x98e1('0x15f')});db['SmsInteraction'][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':'Owner','foreignKey':_0x98e1('0x115')});db[_0x98e1('0x56')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x188'),'as':_0x98e1('0x17e')});db[_0x98e1('0x56')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x188'),'as':_0x98e1('0x17f')});db[_0x98e1('0x56')][_0x98e1('0x129')](db['User'],{'as':'Users','through':_0x98e1('0x189'),'foreignKey':_0x98e1('0x187')});db[_0x98e1('0x58')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':'User'});db[_0x98e1('0x58')]['belongsTo'](db['CmContact'],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x15e')});db[_0x98e1('0x58')][_0x98e1('0x151')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x98e1('0x175'),'foreignKey':_0x98e1('0x187')});db[_0x98e1('0x58')][_0x98e1('0x151')](db[_0x98e1('0x184')],{'as':_0x98e1('0x16f'),'foreignKey':'SmsAccountId'});db[_0x98e1('0x59')][_0x98e1('0x129')](db['User'],{'as':_0x98e1('0x154'),'through':_0x98e1('0x32'),'foreignKey':_0x98e1('0x18a')});db[_0x98e1('0x59')][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':_0x98e1('0x18b'),'as':'Teams'});db[_0x98e1('0x5b')][_0x98e1('0x117')](db[_0x98e1('0x85')],{'as':_0x98e1('0x167'),'foreignKey':_0x98e1('0x18c'),'onDelete':_0x98e1('0x114')});db['OpenchannelAccount'][_0x98e1('0x117')](db[_0x98e1('0x83')],{'as':_0x98e1('0x185'),'foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x5b')][_0x98e1('0x117')](db[_0x98e1('0x5e')],{'as':_0x98e1('0x169'),'foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x5b')][_0x98e1('0x117')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x5b')][_0x98e1('0x117')](db[_0x98e1('0x5c')],{'as':'Applications','foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x5b')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db['OpenchannelAccount'][_0x98e1('0x151')](db[_0x98e1('0x89')],{'as':_0x98e1('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x98e1('0x5b')]['belongsToMany'](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x140')});db[_0x98e1('0x5c')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x5c')][_0x98e1('0x151')](db[_0x98e1('0x62')],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x18d')});db[_0x98e1('0x5c')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x98e1('0x162'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x98e1('0x151')](db[_0x98e1('0x87')],{'onDelete':'restrict','foreignKey':_0x98e1('0x152')});db['OpenchannelApplication'][_0x98e1('0x151')](db['Tag'],{'onDelete':_0x98e1('0x162'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0x98e1('0x117')](db[_0x98e1('0x60')],{'as':_0x98e1('0x168'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x18e')});db[_0x98e1('0x5e')][_0x98e1('0x151')](db[_0x98e1('0x5b')],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x5e')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':'Contact','foreignKey':_0x98e1('0x15f')});db['OpenchannelInteraction'][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x170'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x98e1('0x129')](db['Tag'],{'through':_0x98e1('0x18f'),'as':'Tags'});db[_0x98e1('0x5e')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x18f'),'as':_0x98e1('0x17f')});db[_0x98e1('0x5e')]['belongsToMany'](db[_0x98e1('0x12')],{'as':_0x98e1('0x190'),'through':'user_has_openchannel_interactions','foreignKey':_0x98e1('0x18e')});db[_0x98e1('0x60')]['belongsTo'](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x114'),'as':'User'});db[_0x98e1('0x60')][_0x98e1('0x151')](db['CmContact'],{'onDelete':'cascade','as':_0x98e1('0x15e')});db['OpenchannelMessage']['belongsTo'](db[_0x98e1('0x5e')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x175'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db['Attachment'],{'as':_0x98e1('0x173'),'foreignKey':_0x98e1('0x182')});db['OpenchannelMessage'][_0x98e1('0x151')](db[_0x98e1('0x5b')],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x62')][_0x98e1('0x129')](db['User'],{'as':_0x98e1('0x154'),'through':_0x98e1('0x138'),'foreignKey':_0x98e1('0x18d')});db[_0x98e1('0x62')][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':'team_has_openchannel_queues','as':'Teams'});db['ChatWebsite'][_0x98e1('0x117')](db[_0x98e1('0x85')],{'as':_0x98e1('0x167'),'foreignKey':_0x98e1('0x191'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x64')][_0x98e1('0x117')](db['CannedAnswer'],{'as':_0x98e1('0x185'),'foreignKey':'ChatWebsiteId'});db[_0x98e1('0x64')][_0x98e1('0x117')](db[_0x98e1('0x71')],{'as':_0x98e1('0x192')});db[_0x98e1('0x64')][_0x98e1('0x117')](db[_0x98e1('0x120')],{'as':'Interactions'});db['ChatWebsite'][_0x98e1('0x117')](db[_0x98e1('0x67')],{'as':_0x98e1('0x16a')});db[_0x98e1('0x64')]['hasMany'](db['ChatMessage'],{'as':'Messages'});db[_0x98e1('0x64')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x64')][_0x98e1('0x151')](db[_0x98e1('0x87')],{'as':_0x98e1('0x87'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0x64')][_0x98e1('0x151')](db['MailAccount'],{'as':_0x98e1('0x160'),'foreignKey':_0x98e1('0x161')});db[_0x98e1('0x64')][_0x98e1('0x151')](db[_0x98e1('0x89')],{'as':_0x98e1('0x153'),'foreignKey':_0x98e1('0x16d')});db[_0x98e1('0x64')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x13b')});db[_0x98e1('0x65')][_0x98e1('0x151')](db['OpenchannelAccount'],{});db[_0x98e1('0x65')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x65')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x98e1('0x65')][_0x98e1('0x151')](db['OpenchannelInteraction'],{});db[_0x98e1('0x65')][_0x98e1('0x151')](db[_0x98e1('0x60')],{});db[_0x98e1('0x65')][_0x98e1('0x151')](db[_0x98e1('0x12')],{});db[_0x98e1('0x65')][_0x98e1('0x151')](db[_0x98e1('0x62')],{});db[_0x98e1('0x67')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x193'),'foreignKey':_0x98e1('0x115'),'onDelete':'restrict'});db[_0x98e1('0x67')][_0x98e1('0x151')](db[_0x98e1('0x6e')],{'as':_0x98e1('0x194'),'foreignKey':_0x98e1('0x195'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x67')][_0x98e1('0x151')](db[_0x98e1('0x64')],{'as':_0x98e1('0x196'),'foreignKey':_0x98e1('0x191'),'onDelete':_0x98e1('0x162')});db['ChatApplication'][_0x98e1('0x151')](db[_0x98e1('0x172')],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x177')});db['ChatInteraction']['hasMany'](db[_0x98e1('0x6a')],{'as':_0x98e1('0x168'),'onDelete':_0x98e1('0x114'),'foreignKey':'ChatInteractionId'});db[_0x98e1('0x120')][_0x98e1('0x151')](db['ChatWebsite'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x191')});db[_0x98e1('0x120')][_0x98e1('0x151')](db['CmContact'],{'as':_0x98e1('0x15e'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x170'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x120')][_0x98e1('0x129')](db['Tag'],{'through':_0x98e1('0x197'),'as':'Tags'});db['ChatInteraction'][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x197'),'as':_0x98e1('0x17f')});db[_0x98e1('0x120')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':'Users','through':_0x98e1('0x131'),'foreignKey':_0x98e1('0x198')});db[_0x98e1('0x6a')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':'cascade','as':_0x98e1('0x12')});db[_0x98e1('0x6a')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'onDelete':'cascade','as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x6a')][_0x98e1('0x151')](db[_0x98e1('0x120')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x175'),'foreignKey':_0x98e1('0x198')});db['ChatMessage'][_0x98e1('0x151')](db[_0x98e1('0x173')],{'as':'Attachment','foreignKey':_0x98e1('0x182')});db[_0x98e1('0x6a')][_0x98e1('0x151')](db[_0x98e1('0x64')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x98e1('0x6c')][_0x98e1('0x117')](db[_0x98e1('0x173')],{'as':_0x98e1('0x174'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x98e1('0x114'),'hooks':!![]});db[_0x98e1('0x6c')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x6c')][_0x98e1('0x151')](db[_0x98e1('0x64')],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x191')});db[_0x98e1('0x6e')]['belongsToMany'](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':'team_has_chat_queues','as':_0x98e1('0x155')});db['ChatGroup'][_0x98e1('0x117')](db[_0x98e1('0xd6')],{'as':'Messages','foreignKey':_0x98e1('0x199'),'onDelete':'cascade'});db[_0x98e1('0x6f')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':'Members','through':'chat_group_has_users'});db[_0x98e1('0x71')][_0x98e1('0x151')](db[_0x98e1('0x64')],{'as':_0x98e1('0x196'),'foreignKey':_0x98e1('0x191')});db['CmCompany'][_0x98e1('0x117')](db[_0x98e1('0x74')],{'as':_0x98e1('0x12c'),'foreignKey':_0x98e1('0x19a')});db[_0x98e1('0x74')][_0x98e1('0x117')](db[_0x98e1('0x94')],{'as':'Phones','foreignKey':_0x98e1('0x19b')});db[_0x98e1('0x74')][_0x98e1('0x117')](db[_0x98e1('0x76')],{'as':_0x98e1('0x14a'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x74')]['hasMany'](db[_0x98e1('0x79')],{'as':_0x98e1('0x11d'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x74')][_0x98e1('0x117')](db[_0x98e1('0x7b')],{'as':_0x98e1('0x14b'),'foreignKey':'ContactId'});db[_0x98e1('0x74')][_0x98e1('0x117')](db[_0x98e1('0x7d')],{'as':_0x98e1('0x7d'),'foreignKey':_0x98e1('0x15f')});db['CmContact'][_0x98e1('0x117')](db[_0x98e1('0xda')],{'as':_0x98e1('0x14e'),'foreignKey':'ContactId'});db['CmContact'][_0x98e1('0x117')](db[_0x98e1('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0x98e1('0x15f'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x74')][_0x98e1('0x117')](db[_0x98e1('0x120')],{'as':_0x98e1('0x121'),'foreignKey':'ContactId','onDelete':_0x98e1('0x162')});db[_0x98e1('0x74')]['hasMany'](db['SmsInteraction'],{'as':_0x98e1('0x122'),'foreignKey':_0x98e1('0x15f'),'onDelete':_0x98e1('0x162')});db['CmContact'][_0x98e1('0x117')](db['FaxInteraction'],{'as':_0x98e1('0x123'),'foreignKey':_0x98e1('0x15f'),'onDelete':'restrict'});db[_0x98e1('0x74')][_0x98e1('0x117')](db['MailInteraction'],{'as':_0x98e1('0x124'),'foreignKey':'ContactId','onDelete':_0x98e1('0x162')});db[_0x98e1('0x74')][_0x98e1('0x151')](db[_0x98e1('0x19c')],{'as':_0x98e1('0x19d'),'foreignKey':'CompanyId'});db[_0x98e1('0x74')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':'List','foreignKey':_0x98e1('0x16b'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x74')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x190'),'through':_0x98e1('0x12d')});db[_0x98e1('0x74')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'as':_0x98e1('0x17e'),'through':_0x98e1('0x19e')});db[_0x98e1('0x74')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':'cm_contact_has_tags','as':_0x98e1('0x17f')});db['CmHopper'][_0x98e1('0x117')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x98e1('0x19f')});db[_0x98e1('0x76')][_0x98e1('0x151')](db['CmContact'],{'as':'Contact','foreignKey':_0x98e1('0x15f'),'onDelete':_0x98e1('0x114')});db['CmHopper'][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':'List','foreignKey':_0x98e1('0x16b'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x76')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x193'),'foreignKey':'UserId'});db['CmHopper'][_0x98e1('0x151')](db[_0x98e1('0x18')],{'as':_0x98e1('0x194'),'foreignKey':_0x98e1('0x149'),'onDelete':'cascade'});db[_0x98e1('0x76')]['belongsTo'](db[_0x98e1('0xeb')],{'as':_0x98e1('0xeb'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x98e1('0x76')]['belongsTo'](db[_0x98e1('0x12')],{'as':_0x98e1('0x170'),'foreignKey':'OwnerId'});db['CmHopperBlack']['belongsTo'](db[_0x98e1('0x74')],{'as':'Contact','foreignKey':_0x98e1('0x15f'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x14c')][_0x98e1('0x151')](db['CmList'],{'as':_0x98e1('0x179'),'foreignKey':'ListId','onDelete':_0x98e1('0x114')});db[_0x98e1('0x14c')][_0x98e1('0x151')](db[_0x98e1('0x18')],{'as':_0x98e1('0x194'),'foreignKey':_0x98e1('0x149'),'onDelete':'cascade'});db[_0x98e1('0x14c')][_0x98e1('0x151')](db[_0x98e1('0xeb')],{'as':_0x98e1('0xeb'),'foreignKey':_0x98e1('0x1a0'),'onDelete':_0x98e1('0x114')});db['Automation'][_0x98e1('0x117')](db['Condition'],{'as':{'plural':_0x98e1('0x1a1'),'singular':_0x98e1('0x1a2')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x98e1('0x82')][_0x98e1('0x117')](db[_0x98e1('0x86')],{'as':{'plural':_0x98e1('0x1a3'),'singular':_0x98e1('0x1a4')},'foreignKey':_0x98e1('0x1a5'),'onDelete':_0x98e1('0x114'),'hooks':!![]});db['Automation'][_0x98e1('0x117')](db[_0x98e1('0x80')],{'as':_0x98e1('0x1a6'),'foreignKey':_0x98e1('0x1a7'),'onDelete':'cascade','hooks':!![]});db['Disposition']['hasMany'](db['Disposition'],{'as':_0x98e1('0x167'),'foreignKey':'ParentId','onDelete':_0x98e1('0x114')});db[_0x98e1('0x87')][_0x98e1('0x117')](db[_0x98e1('0x87')],{'as':_0x98e1('0x1a8'),'foreignKey':_0x98e1('0x152'),'onDelete':_0x98e1('0x114'),'hooks':!![],'required':![]});db[_0x98e1('0x87')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':_0x98e1('0x11c'),'foreignKey':_0x98e1('0x152'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x87')][_0x98e1('0x117')](db['MailApplication'],{'as':_0x98e1('0x1a9'),'foreignKey':_0x98e1('0x152')});db['Interval'][_0x98e1('0x117')](db[_0x98e1('0x67')],{'as':'ChatApplications','foreignKey':_0x98e1('0x152')});db[_0x98e1('0x87')][_0x98e1('0x117')](db['FaxApplication'],{'as':_0x98e1('0x1aa'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0x87')][_0x98e1('0x117')](db[_0x98e1('0x54')],{'as':'SmsApplications','foreignKey':_0x98e1('0x152')});db[_0x98e1('0x8e')][_0x98e1('0x151')](db[_0x98e1('0x160')],{});db['Schedule'][_0x98e1('0x151')](db[_0x98e1('0xa0')],{'foreignKey':_0x98e1('0x1ab')});db[_0x98e1('0x8e')][_0x98e1('0x151')](db[_0x98e1('0x1ac')],{'foreignKey':_0x98e1('0x1ad')});db[_0x98e1('0x90')][_0x98e1('0x129')](db['VoiceMusicOnHold'],{'as':_0x98e1('0x1ae'),'through':_0x98e1('0x147'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x172')][_0x98e1('0x129')](db[_0x98e1('0x74')],{'through':_0x98e1('0x19e')});db[_0x98e1('0x172')][_0x98e1('0x129')](db[_0x98e1('0x120')],{'through':_0x98e1('0x197')});db['Tag'][_0x98e1('0x129')](db['MailInteraction'],{'through':_0x98e1('0x171')});db[_0x98e1('0x172')]['belongsToMany'](db[_0x98e1('0x56')],{'through':_0x98e1('0x188')});db[_0x98e1('0x172')][_0x98e1('0x129')](db[_0x98e1('0x4d')],{'through':_0x98e1('0x17d')});db[_0x98e1('0x172')][_0x98e1('0x129')](db[_0x98e1('0x5e')],{'through':_0x98e1('0x18f')});db[_0x98e1('0x172')][_0x98e1('0x129')](db[_0x98e1('0x125')],{'through':_0x98e1('0x1af')});db[_0x98e1('0x94')][_0x98e1('0x151')](db[_0x98e1('0x1b0')],{'as':_0x98e1('0x1b1'),'foreignKey':'ItemTypeId'});db[_0x98e1('0x96')][_0x98e1('0x151')](db[_0x98e1('0x76')],{'as':_0x98e1('0x1b2'),'foreignKey':'CmHopperId'});db['CmContactHasItem'][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':'CmContactId'});db[_0x98e1('0x1b3')][_0x98e1('0x117')](db['Condition'],{'as':{'plural':_0x98e1('0x1b4'),'singular':_0x98e1('0x1b5')},'foreignKey':_0x98e1('0x1b6'),'onDelete':_0x98e1('0x114'),'hooks':!![]});db['Trigger'][_0x98e1('0x117')](db[_0x98e1('0x86')],{'as':{'plural':_0x98e1('0x1b7'),'singular':_0x98e1('0x1b8')},'foreignKey':_0x98e1('0x1b9'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x98e1('0x117')](db[_0x98e1('0x80')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x98e1('0x114'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x98e1('0x1ba')],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x98e1('0xa0')][_0x98e1('0x117')](db[_0x98e1('0x1ba')],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1ab')});db[_0x98e1('0x1bc')][_0x98e1('0x117')](db[_0x98e1('0x1ba')],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bd')});db[_0x98e1('0x1ba')][_0x98e1('0x151')](db[_0x98e1('0x1bc')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x98e1('0x117')](db['SalesforceConfiguration'],{'as':_0x98e1('0x1be'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0x1c0')][_0x98e1('0x117')](db[_0x98e1('0x1c1')],{'as':_0x98e1('0x1c2'),'onDelete':_0x98e1('0x114'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x98e1('0x117')](db['SalesforceField'],{'as':_0x98e1('0x1c3'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c4')});db['SalesforceConfiguration'][_0x98e1('0x117')](db[_0x98e1('0x1c1')],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0x1c0')]['belongsTo'](db[_0x98e1('0xa4')],{'as':_0x98e1('0x16f'),'foreignKey':'AccountId'});db[_0x98e1('0x1c1')][_0x98e1('0x117')](db[_0x98e1('0x1c1')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db['SalesforceField'][_0x98e1('0x117')](db[_0x98e1('0x1c1')],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0x1c1')][_0x98e1('0x117')](db[_0x98e1('0x1c1')],{'as':_0x98e1('0x1c9'),'foreignKey':'FieldId'});db[_0x98e1('0x1c1')]['belongsTo'](db[_0x98e1('0x9b')],{'as':'Variable','foreignKey':_0x98e1('0x1ca')});db[_0x98e1('0xa8')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0x98e1('0x1be'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xaa')][_0x98e1('0x117')](db[_0x98e1('0x1cb')],{'as':_0x98e1('0x1c2'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xaa')][_0x98e1('0x117')](db[_0x98e1('0x1cb')],{'as':'Descriptions','onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c4')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x98e1('0xaa')][_0x98e1('0x151')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0x98e1('0x1bf')});db['SugarcrmField'][_0x98e1('0x117')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0x1cb')][_0x98e1('0x117')](db['SugarcrmField'],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0x1cb')][_0x98e1('0x117')](db[_0x98e1('0x1cb')],{'as':_0x98e1('0x1c9'),'foreignKey':'FieldId'});db[_0x98e1('0x1cb')]['belongsTo'](db['Variable'],{'as':_0x98e1('0x9b'),'foreignKey':_0x98e1('0x1ca')});db['DeskAccount'][_0x98e1('0x117')](db[_0x98e1('0xaf')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x98e1('0x1bf')});db['DeskConfiguration'][_0x98e1('0x117')](db[_0x98e1('0xb0')],{'as':_0x98e1('0x1c2'),'onDelete':'cascade','foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xaf')][_0x98e1('0x117')](db[_0x98e1('0xb0')],{'as':'Descriptions','onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xaf')][_0x98e1('0x117')](db[_0x98e1('0xb0')],{'as':_0x98e1('0x1bb'),'onDelete':'cascade','foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xaf')][_0x98e1('0x151')](db[_0x98e1('0xad')],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xaf')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x1cc')});db[_0x98e1('0xb0')][_0x98e1('0x117')](db['DeskField'],{'as':'Subject','foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xb0')]['hasMany'](db[_0x98e1('0xb0')],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xb0')][_0x98e1('0x117')](db['DeskField'],{'as':_0x98e1('0x1c9'),'foreignKey':'FieldId'});db[_0x98e1('0xb0')][_0x98e1('0x151')](db['Variable'],{'as':_0x98e1('0x9b'),'foreignKey':_0x98e1('0x1ca')});db[_0x98e1('0xb2')][_0x98e1('0x117')](db[_0x98e1('0xb4')],{'as':_0x98e1('0x1be'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xb4')][_0x98e1('0x117')](db['ZohoField'],{'as':'Subjects','onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xb4')][_0x98e1('0x117')](db[_0x98e1('0xb5')],{'as':_0x98e1('0x1c3'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xb4')][_0x98e1('0x117')](db['ZohoField'],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xb4')][_0x98e1('0x151')](db[_0x98e1('0xb2')],{'as':_0x98e1('0x16f'),'foreignKey':'AccountId'});db[_0x98e1('0xb5')][_0x98e1('0x117')](db[_0x98e1('0xb5')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xb5')]['hasMany'](db[_0x98e1('0xb5')],{'as':'Description','foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xb5')][_0x98e1('0x117')](db[_0x98e1('0xb5')],{'as':_0x98e1('0x1c9'),'foreignKey':'FieldId'});db[_0x98e1('0xb5')][_0x98e1('0x151')](db['Variable'],{'as':_0x98e1('0x9b'),'foreignKey':'VariableId'});db['ZendeskAccount']['hasMany'](db[_0x98e1('0xb9')],{'as':_0x98e1('0x1be'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xb9')][_0x98e1('0x117')](db[_0x98e1('0xbb')],{'as':_0x98e1('0x1c2'),'foreignKey':_0x98e1('0x1c7')});db['ZendeskConfiguration']['hasMany'](db[_0x98e1('0xbb')],{'as':_0x98e1('0x1c3'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xb9')]['hasMany'](db['ZendeskField'],{'as':_0x98e1('0x1bb'),'foreignKey':'FieldId'});db[_0x98e1('0xb9')][_0x98e1('0x151')](db[_0x98e1('0xb7')],{'as':'Account','foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xb9')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x98e1('0x117')](db[_0x98e1('0xbb')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x98e1('0xbb')][_0x98e1('0x117')](db[_0x98e1('0xbb')],{'as':_0x98e1('0x1c8'),'foreignKey':'DescriptionId'});db[_0x98e1('0xbb')][_0x98e1('0x117')](db[_0x98e1('0xbb')],{'as':_0x98e1('0x1c9'),'foreignKey':_0x98e1('0x1c5')});db['ZendeskField']['belongsTo'](db[_0x98e1('0x9b')],{'as':_0x98e1('0x9b'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x98e1('0x117')](db[_0x98e1('0xbd')],{'as':_0x98e1('0x1be'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1c2'),'onDelete':'cascade','foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xbd')][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1c3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x98e1('0xbd')][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xbd')][_0x98e1('0x151')](db['FreshdeskAccount'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xbd')][_0x98e1('0x129')](db['Tag'],{'through':_0x98e1('0x1cd')});db[_0x98e1('0xbf')][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xbf')][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xbf')][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1c9'),'foreignKey':_0x98e1('0x1c5')});db['FreshdeskField'][_0x98e1('0x151')](db[_0x98e1('0x9b')],{'as':_0x98e1('0x9b'),'foreignKey':_0x98e1('0x1ca')});db[_0x98e1('0xc1')][_0x98e1('0x117')](db[_0x98e1('0x1ce')],{'as':_0x98e1('0x1be'),'onDelete':'cascade','foreignKey':_0x98e1('0x1bf')});db['VtigerConfiguration'][_0x98e1('0x117')](db[_0x98e1('0x1cf')],{'as':'Subjects','foreignKey':'SubjectId'});db['VtigerConfiguration'][_0x98e1('0x117')](db[_0x98e1('0x1cf')],{'as':_0x98e1('0x1c3'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0x1ce')]['hasMany'](db[_0x98e1('0x1cf')],{'as':_0x98e1('0x1bb'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0x1ce')][_0x98e1('0x151')](db[_0x98e1('0xc1')],{'as':_0x98e1('0x16f'),'foreignKey':'AccountId'});db[_0x98e1('0x1cf')][_0x98e1('0x117')](db['VtigerField'],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0x1cf')][_0x98e1('0x117')](db['VtigerField'],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0x1cf')][_0x98e1('0x117')](db['VtigerField'],{'as':'Field','foreignKey':_0x98e1('0x1c5')});db['VtigerField'][_0x98e1('0x151')](db[_0x98e1('0x9b')],{'as':_0x98e1('0x9b'),'foreignKey':_0x98e1('0x1ca')});db[_0x98e1('0xc5')]['hasMany'](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x98e1('0x114'),'foreignKey':'AccountId'});db[_0x98e1('0xc7')][_0x98e1('0x117')](db[_0x98e1('0xc9')],{'as':_0x98e1('0x1c2'),'foreignKey':_0x98e1('0x1c7')});db['ServicenowConfiguration'][_0x98e1('0x117')](db[_0x98e1('0xc9')],{'as':_0x98e1('0x1c3'),'foreignKey':_0x98e1('0x1c4')});db['ServicenowConfiguration'][_0x98e1('0x117')](db[_0x98e1('0xc9')],{'as':'Fields','foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xc7')][_0x98e1('0x151')](db['ServicenowAccount'],{'as':_0x98e1('0x16f'),'foreignKey':'AccountId'});db[_0x98e1('0xc9')][_0x98e1('0x117')](db[_0x98e1('0xc9')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xc9')][_0x98e1('0x117')](db['ServicenowField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x98e1('0xc9')][_0x98e1('0x117')](db[_0x98e1('0xc9')],{'as':_0x98e1('0x1c9'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xc9')]['belongsTo'](db[_0x98e1('0x9b')],{'as':'Variable','foreignKey':'VariableId'});db[_0x98e1('0xcb')][_0x98e1('0x117')](db['Dynamics365Configuration'],{'as':_0x98e1('0x1be'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bf')});db['Dynamics365Account'][_0x98e1('0x151')](db[_0x98e1('0x10c')],{'as':_0x98e1('0x10c'),'foreignKey':_0x98e1('0x164')});db['Dynamics365Configuration']['hasMany'](db[_0x98e1('0xce')],{'as':_0x98e1('0x1c2'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xcd')][_0x98e1('0x117')](db['Dynamics365Field'],{'as':_0x98e1('0x1c3'),'onDelete':_0x98e1('0x114'),'foreignKey':'DescriptionId'});db[_0x98e1('0xcd')][_0x98e1('0x117')](db[_0x98e1('0xce')],{'as':_0x98e1('0x1bb'),'onDelete':'cascade','foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xcd')][_0x98e1('0x151')](db['Dynamics365Account'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xce')][_0x98e1('0x117')](db[_0x98e1('0xce')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xce')][_0x98e1('0x117')](db['Dynamics365Field'],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db['Dynamics365Field'][_0x98e1('0x117')](db[_0x98e1('0xce')],{'as':'Field','foreignKey':_0x98e1('0x1c5')});db['Dynamics365Field']['belongsTo'](db[_0x98e1('0x9b')],{'as':_0x98e1('0x9b'),'foreignKey':_0x98e1('0x1ca')});db[_0x98e1('0xd0')][_0x98e1('0x117')](db[_0x98e1('0x1d0')],{'as':_0x98e1('0x1be'),'onDelete':'cascade','foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0x1d0')][_0x98e1('0x117')](db['FreshsalesField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x98e1('0x1d0')][_0x98e1('0x117')](db[_0x98e1('0x1d1')],{'as':_0x98e1('0x1c3'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0x1d0')][_0x98e1('0x117')](db[_0x98e1('0x1d1')],{'as':_0x98e1('0x1bb'),'foreignKey':'FieldId'});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0x1d1')][_0x98e1('0x117')](db[_0x98e1('0x1d1')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0x1d1')]['hasMany'](db[_0x98e1('0x1d1')],{'as':'Description','foreignKey':_0x98e1('0x1c4')});db['FreshsalesField'][_0x98e1('0x117')](db[_0x98e1('0x1d1')],{'as':_0x98e1('0x1c9'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0x1d1')][_0x98e1('0x151')](db[_0x98e1('0x9b')],{'as':'Variable','foreignKey':_0x98e1('0x1ca')});db['ChatQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x64')],{});db[_0x98e1('0xd5')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':'List','foreignKey':_0x98e1('0x16b')});db[_0x98e1('0xd5')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db['ChatQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x120')],{});db['ChatQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x6a')],{});db[_0x98e1('0xd5')][_0x98e1('0x151')](db[_0x98e1('0x12')],{});db[_0x98e1('0xd5')]['belongsTo'](db['ChatQueue'],{});db[_0x98e1('0xd6')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1d2')});db[_0x98e1('0xd6')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x114'),'foreignKey':'ToId'});db[_0x98e1('0xda')][_0x98e1('0x117')](db[_0x98e1('0xd8')],{'foreignKey':_0x98e1('0x1d3'),'onDelete':_0x98e1('0x114')});db['JscriptySessionReport'][_0x98e1('0x117')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x98e1('0x114')});db['SmsQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x184')],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x1d4')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x1d4')][_0x98e1('0x151')](db[_0x98e1('0x56')],{});db[_0x98e1('0x1d4')][_0x98e1('0x151')](db[_0x98e1('0x58')],{});db[_0x98e1('0x1d4')][_0x98e1('0x151')](db[_0x98e1('0x12')],{});db[_0x98e1('0x1d4')][_0x98e1('0x151')](db[_0x98e1('0x59')],{});db[_0x98e1('0xde')]['hasMany'](db[_0x98e1('0xda')],{'foreignKey':_0x98e1('0x1d5')});db['JscriptyProject']['hasMany'](db[_0x98e1('0xd8')],{'foreignKey':'ProjectId'});db[_0x98e1('0xde')][_0x98e1('0x117')](db['JscriptyAnswerReport'],{'foreignKey':_0x98e1('0x1d5')});db['Team'][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x12f')});db[_0x98e1('0xe8')][_0x98e1('0x129')](db['VoiceQueue'],{'through':_0x98e1('0x10d'),'as':_0x98e1('0x133')});db[_0x98e1('0xe8')][_0x98e1('0x129')](db['MailQueue'],{'through':_0x98e1('0x1d6'),'as':_0x98e1('0x135')});db[_0x98e1('0xe8')]['belongsToMany'](db['ChatQueue'],{'through':_0x98e1('0x1d7'),'as':_0x98e1('0x136')});db[_0x98e1('0xe8')]['belongsToMany'](db['FaxQueue'],{'through':_0x98e1('0x183'),'as':_0x98e1('0x1d8')});db[_0x98e1('0xe8')][_0x98e1('0x129')](db[_0x98e1('0x59')],{'through':_0x98e1('0x18b'),'as':'SmsQueues'});db[_0x98e1('0xe8')][_0x98e1('0x129')](db[_0x98e1('0x62')],{'through':_0x98e1('0x1d9'),'as':'OpenchannelQueues'});db[_0x98e1('0xe8')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x98e1('0x1da'),'as':'WhatsappQueues'});db['Team'][_0x98e1('0x129')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0x98e1('0x134')});db[_0x98e1('0xeb')][_0x98e1('0x117')](db[_0x98e1('0x76')],{'as':_0x98e1('0x14a'),'foreignKey':'CampaignId'});db[_0x98e1('0xeb')]['hasMany'](db[_0x98e1('0x79')],{'as':'HopperFinals','foreignKey':_0x98e1('0x1a0')});db[_0x98e1('0xeb')][_0x98e1('0x117')](db['CmHopperHistory'],{'as':_0x98e1('0x14b'),'foreignKey':_0x98e1('0x1a0')});db[_0x98e1('0xeb')][_0x98e1('0x117')](db[_0x98e1('0x14c')],{'as':_0x98e1('0x14d'),'foreignKey':_0x98e1('0x1a0')});db['Campaign'][_0x98e1('0x151')](db[_0x98e1('0x25')],{'as':'Trunk','foreignKey':_0x98e1('0x14f')});db[_0x98e1('0xeb')][_0x98e1('0x151')](db[_0x98e1('0x25')],{'as':_0x98e1('0x150'),'foreignKey':_0x98e1('0x1db')});db[_0x98e1('0xeb')]['belongsTo'](db[_0x98e1('0x87')],{'as':_0x98e1('0x87'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0xeb')]['belongsTo'](db['SquareProject'],{'as':_0x98e1('0xe2'),'foreignKey':_0x98e1('0x1dc')});db[_0x98e1('0xeb')]['belongsToMany'](db[_0x98e1('0xfa')],{'as':_0x98e1('0x12e'),'through':'campaigns_has_cm_lists'});db[_0x98e1('0xeb')]['belongsToMany'](db['CmList'],{'as':_0x98e1('0x156'),'through':_0x98e1('0x1dd')});db[_0x98e1('0x173')][_0x98e1('0x151')](db[_0x98e1('0x6c')],{'as':_0x98e1('0x6c'),'foreignKey':_0x98e1('0x176')});db[_0x98e1('0xf2')][_0x98e1('0x151')](db[_0x98e1('0x41')],{});db[_0x98e1('0xf2')][_0x98e1('0x151')](db['MailInteraction'],{});db['MailTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x160')],{'foreignKey':_0x98e1('0x1de'),'as':_0x98e1('0x1df')});db['MailTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e0'),'as':_0x98e1('0x1e1')});db[_0x98e1('0xf2')]['belongsTo'](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e2'),'as':'ToAgent'});db[_0x98e1('0xf2')][_0x98e1('0x151')](db[_0x98e1('0x3b')],{'foreignKey':_0x98e1('0x1e3'),'as':_0x98e1('0x1e4')});db[_0x98e1('0xf2')][_0x98e1('0x151')](db[_0x98e1('0x160')],{'foreignKey':_0x98e1('0x1e5'),'as':_0x98e1('0x1e6')});db[_0x98e1('0xf4')]['belongsTo'](db[_0x98e1('0x6a')],{});db['ChatTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x120')],{});db['ChatTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x64')],{'foreignKey':'FromChatWebsiteId','as':_0x98e1('0x1df')});db[_0x98e1('0xf4')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e0'),'as':'FromAgent'});db[_0x98e1('0xf4')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e2'),'as':_0x98e1('0x1e7')});db['ChatTransferReport'][_0x98e1('0x151')](db['ChatQueue'],{'foreignKey':_0x98e1('0x1e8'),'as':_0x98e1('0x1e4')});db['ChatTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x64')],{'foreignKey':_0x98e1('0x1e9'),'as':_0x98e1('0x1e6')});db['FaxTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x4f')],{});db['FaxTransferReport'][_0x98e1('0x151')](db['FaxInteraction'],{});db[_0x98e1('0xf6')]['belongsTo'](db[_0x98e1('0x49')],{'foreignKey':_0x98e1('0x1ea'),'as':_0x98e1('0x1df')});db[_0x98e1('0xf6')][_0x98e1('0x151')](db['User'],{'foreignKey':_0x98e1('0x1e0'),'as':_0x98e1('0x1e1')});db[_0x98e1('0xf6')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e2'),'as':_0x98e1('0x1e7')});db[_0x98e1('0xf6')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x98e1('0x1eb'),'as':_0x98e1('0x1e4')});db[_0x98e1('0xf6')][_0x98e1('0x151')](db[_0x98e1('0x49')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x98e1('0xf8')][_0x98e1('0x151')](db[_0x98e1('0x60')],{});db[_0x98e1('0xf8')]['belongsTo'](db[_0x98e1('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x98e1('0x5b')],{'foreignKey':_0x98e1('0x1ec'),'as':_0x98e1('0x1df')});db[_0x98e1('0xf8')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e0'),'as':_0x98e1('0x1e1')});db[_0x98e1('0xf8')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e2'),'as':_0x98e1('0x1e7')});db['OpenchannelTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x62')],{'foreignKey':_0x98e1('0x1ed'),'as':'ToQueue'});db[_0x98e1('0xf8')][_0x98e1('0x151')](db['OpenchannelAccount'],{'foreignKey':_0x98e1('0x1ee'),'as':_0x98e1('0x1e6')});db[_0x98e1('0xf9')]['belongsTo'](db[_0x98e1('0x58')],{});db[_0x98e1('0xf9')]['belongsTo'](db[_0x98e1('0x56')],{});db[_0x98e1('0xf9')][_0x98e1('0x151')](db[_0x98e1('0x184')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db['SmsTransferReport'][_0x98e1('0x151')](db['User'],{'foreignKey':_0x98e1('0x1e0'),'as':_0x98e1('0x1e1')});db[_0x98e1('0xf9')]['belongsTo'](db['User'],{'foreignKey':_0x98e1('0x1e2'),'as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db[_0x98e1('0x59')],{'foreignKey':_0x98e1('0x1ef'),'as':_0x98e1('0x1e4')});db[_0x98e1('0xf9')][_0x98e1('0x151')](db[_0x98e1('0x184')],{'foreignKey':_0x98e1('0x1f0'),'as':_0x98e1('0x1e6')});db[_0x98e1('0xfa')][_0x98e1('0x117')](db[_0x98e1('0x85')],{'as':_0x98e1('0x167'),'foreignKey':'ListId','onDelete':_0x98e1('0x114')});db[_0x98e1('0xfa')]['hasMany'](db[_0x98e1('0x1f1')],{'as':_0x98e1('0x1f2'),'foreignKey':'ListId'});db[_0x98e1('0xfa')][_0x98e1('0x117')](db['CmContact'],{'as':_0x98e1('0x12c'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0xfa')][_0x98e1('0x117')](db[_0x98e1('0x79')],{'as':_0x98e1('0x11d'),'foreignKey':_0x98e1('0x16b')});db['CmList'][_0x98e1('0x117')](db[_0x98e1('0x7b')],{'as':_0x98e1('0x11e'),'foreignKey':'ListId'});db['CmList'][_0x98e1('0x117')](db[_0x98e1('0x7d')],{'as':_0x98e1('0x7d'),'foreignKey':'ListId'});db['CmList'][_0x98e1('0x129')](db[_0x98e1('0x18')],{'as':_0x98e1('0x1f3'),'through':_0x98e1('0x1f4')});db[_0x98e1('0xfa')][_0x98e1('0x129')](db['User'],{'as':_0x98e1('0x154'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':'Extensions','onDelete':'cascade'});db['VoicePrefix'][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x111')});db[_0x98e1('0xfb')][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':'TeamVoicePrefix','as':_0x98e1('0x155')});db[_0x98e1('0xfc')][_0x98e1('0x117')](db[_0x98e1('0x12')],{'as':_0x98e1('0x190'),'foreignKey':_0x98e1('0x128')});db[_0x98e1('0xfc')]['hasMany'](db[_0x98e1('0xfd')],{'as':_0x98e1('0x1f5'),'foreignKey':_0x98e1('0x128'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0xfd')]['hasMany'](db['UserProfileResource'],{'as':_0x98e1('0x1f6'),'foreignKey':_0x98e1('0x1f7'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x101')][_0x98e1('0x117')](db['Disposition'],{'as':_0x98e1('0x167'),'foreignKey':'WhatsappAccountId','onDelete':_0x98e1('0x114')});db[_0x98e1('0x101')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x98e1('0x1f8')});db[_0x98e1('0x101')][_0x98e1('0x117')](db['WhatsappMessage'],{'as':_0x98e1('0x168'),'foreignKey':_0x98e1('0x1f8')});db['WhatsappAccount'][_0x98e1('0x117')](db[_0x98e1('0x125')],{'as':_0x98e1('0x169')});db[_0x98e1('0x101')]['hasMany'](db[_0x98e1('0x103')],{'as':_0x98e1('0x16a')});db[_0x98e1('0x101')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x101')]['belongsTo'](db['Pause'],{'as':_0x98e1('0x153'),'foreignKey':_0x98e1('0x16d')});db[_0x98e1('0x101')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x144')});db[_0x98e1('0x103')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x162')});db['WhatsappApplication']['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x103')][_0x98e1('0x151')](db[_0x98e1('0x101')],{'onDelete':_0x98e1('0x162')});db['WhatsappApplication'][_0x98e1('0x151')](db[_0x98e1('0x87')],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0x103')]['belongsTo'](db[_0x98e1('0x172')],{'onDelete':_0x98e1('0x162'),'foreignKey':'TagId'});db[_0x98e1('0x125')][_0x98e1('0x117')](db[_0x98e1('0x105')],{'as':_0x98e1('0x168'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0x98e1('0x125')][_0x98e1('0x151')](db[_0x98e1('0x101')],{'as':'Account','foreignKey':_0x98e1('0x1f8')});db[_0x98e1('0x125')]['belongsTo'](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x125')][_0x98e1('0x151')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x98e1('0x125')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x1af'),'as':_0x98e1('0x17e')});db[_0x98e1('0x125')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x1af'),'as':'ThroughTags'});db[_0x98e1('0x125')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':'Users','through':_0x98e1('0x1f9'),'foreignKey':'WhatsappInteractionId'});db[_0x98e1('0x105')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x12')});db[_0x98e1('0x105')]['belongsTo'](db['CmContact'],{'onDelete':_0x98e1('0x114'),'as':'Contact'});db[_0x98e1('0x105')]['belongsTo'](db[_0x98e1('0x125')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x175'),'foreignKey':_0x98e1('0x1fa')});db['WhatsappMessage'][_0x98e1('0x151')](db['WhatsappAccount'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x1f8')});db[_0x98e1('0x107')]['belongsTo'](db[_0x98e1('0x101')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db['WhatsappQueueReport'][_0x98e1('0x151')](db['CmContact'],{'as':_0x98e1('0x15e'),'foreignKey':'ContactId'});db[_0x98e1('0x107')][_0x98e1('0x151')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x10a')],{});db[_0x98e1('0x107')]['belongsTo'](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x12')],{});db[_0x98e1('0x108')][_0x98e1('0x151')](db[_0x98e1('0x105')],{});db['WhatsappTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x125')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x98e1('0x101')],{'foreignKey':_0x98e1('0x1fb'),'as':_0x98e1('0x1df')});db[_0x98e1('0x108')][_0x98e1('0x151')](db['WhatsappAccount'],{'foreignKey':_0x98e1('0x1fc'),'as':'ToAccount'});db[_0x98e1('0x108')][_0x98e1('0x151')](db[_0x98e1('0x10a')],{'foreignKey':_0x98e1('0x1fd'),'as':_0x98e1('0x1e4')});db[_0x98e1('0x108')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e0'),'as':_0x98e1('0x1e1')});db[_0x98e1('0x108')][_0x98e1('0x151')](db['User'],{'foreignKey':_0x98e1('0x1e2'),'as':'ToAgent'});db[_0x98e1('0x10a')]['belongsToMany'](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x98e1('0x10a')]['belongsToMany'](db[_0x98e1('0xe8')],{'through':_0x98e1('0x1da'),'as':_0x98e1('0x155')});db['UserSetting']['belongsTo'](db['User'],{'as':_0x98e1('0x1fe'),'foreignKey':_0x98e1('0x115'),'onDelete':_0x98e1('0x114'),'hooks':!![]});db[_0x98e1('0x10c')][_0x98e1('0x113')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':'restrict'});db['CloudProvider'][_0x98e1('0x113')](db[_0x98e1('0x37')],{'as':_0x98e1('0x165'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x10c')][_0x98e1('0x113')](db[_0x98e1('0x163')],{'as':'Smtp','onDelete':_0x98e1('0x162')});module[_0x98e1('0x1ff')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8985527..8f22feb 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec59=['/api/system','./api/system','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./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/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/realtime','./api/realtime','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/version'];(function(_0x28457e,_0x3cb435){var _0x288c29=function(_0x1434e2){while(--_0x1434e2){_0x28457e['push'](_0x28457e['shift']());}};_0x288c29(++_0x3cb435);}(_0xec59,0x121));var _0x9ec5=function(_0x1a212a,_0x64496b){_0x1a212a=_0x1a212a-0x0;var _0x22d075=_0xec59[_0x1a212a];return _0x22d075;};'use strict';var path=require('path');var express=require(_0x9ec5('0x0'));var errors=require(_0x9ec5('0x1'));var config=require(_0x9ec5('0x2'));var setupLoggers=require(_0x9ec5('0x3'))[_0x9ec5('0x4')];var clientSideLogs=require(_0x9ec5('0x5'));exports[_0x9ec5('0x6')]=function(_0x534bdc){return setupLoggers(_0x534bdc)['then'](function(){_0x534bdc[_0x9ec5('0x7')]('/api/users',require(_0x9ec5('0x8')));_0x534bdc['use'](_0x9ec5('0x9'),require(_0x9ec5('0xa')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xb'),require(_0x9ec5('0xc')));_0x534bdc['use'](_0x9ec5('0xd'),require(_0x9ec5('0xe')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xf'),require('./api/voiceMusicOnHold'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x10'),require(_0x9ec5('0x11')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x12'),require('./api/voiceRecording'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x13'),require(_0x9ec5('0x14')));_0x534bdc['use']('/api/voice/mails',require(_0x9ec5('0x15')));_0x534bdc[_0x9ec5('0x7')]('/api/voice/mails/messages',require(_0x9ec5('0x16')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x17'),require(_0x9ec5('0x18')));_0x534bdc[_0x9ec5('0x7')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x19'),require('./api/voiceAgentReport'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x1a'),require(_0x9ec5('0x1b')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x1c'),require(_0x9ec5('0x1d')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x1e'),require('./api/trunk'));_0x534bdc['use']('/api/voice/transfers/reports',require(_0x9ec5('0x1f')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x20'),require('./api/mailServerOut'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x21'),require(_0x9ec5('0x22')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x23'),require(_0x9ec5('0x24')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x25'),require(_0x9ec5('0x26')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x27'),require('./api/mailInteraction'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x28'),require(_0x9ec5('0x29')));_0x534bdc[_0x9ec5('0x7')]('/api/mail/applications',require('./api/mailApplication'));_0x534bdc['use']('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x534bdc[_0x9ec5('0x7')]('/api/dashboards',require('./api/dashboard'));_0x534bdc['use'](_0x9ec5('0x2a'),require(_0x9ec5('0x2b')));_0x534bdc['use'](_0x9ec5('0x2c'),require(_0x9ec5('0x2d')));_0x534bdc['use'](_0x9ec5('0x2e'),require(_0x9ec5('0x2f')));_0x534bdc[_0x9ec5('0x7')]('/api/fax/interactions',require(_0x9ec5('0x30')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x31'),require(_0x9ec5('0x32')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x33'),require('./api/faxQueue'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x34'),require('./api/faxQueueReport'));_0x534bdc[_0x9ec5('0x7')]('/api/sms/accounts',require(_0x9ec5('0x35')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x36'),require('./api/smsApplication'));_0x534bdc['use'](_0x9ec5('0x37'),require(_0x9ec5('0x38')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x39'),require(_0x9ec5('0x3a')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x3b'),require(_0x9ec5('0x3c')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x3d'),require(_0x9ec5('0x3e')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x3f'),require(_0x9ec5('0x40')));_0x534bdc['use']('/api/openchannel/interactions',require(_0x9ec5('0x41')));_0x534bdc[_0x9ec5('0x7')]('/api/openchannel/messages',require(_0x9ec5('0x42')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x43'),require(_0x9ec5('0x44')));_0x534bdc['use']('/api/chat/websites',require(_0x9ec5('0x45')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x46'),require(_0x9ec5('0x47')));_0x534bdc[_0x9ec5('0x7')]('/api/chat/applications',require(_0x9ec5('0x48')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x49'),require(_0x9ec5('0x4a')));_0x534bdc['use']('/api/chat/messages',require('./api/chatMessage'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x4b'),require('./api/chatOfflineMessage'));_0x534bdc[_0x9ec5('0x7')]('/api/chat/queues',require(_0x9ec5('0x4c')));_0x534bdc['use'](_0x9ec5('0x4d'),require('./api/chatGroup'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x4e'),require(_0x9ec5('0x4f')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x50'),require(_0x9ec5('0x51')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x52'),require(_0x9ec5('0x53')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x54'),require(_0x9ec5('0x55')));_0x534bdc[_0x9ec5('0x7')]('/api/cm/hopper_black',require(_0x9ec5('0x56')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x57'),require('./api/cmHopperFinal'));_0x534bdc[_0x9ec5('0x7')]('/api/cm/hopper_history',require(_0x9ec5('0x58')));_0x534bdc['use'](_0x9ec5('0x59'),require('./api/cmCustomField'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x5a'),require(_0x9ec5('0x5b')));_0x534bdc['use'](_0x9ec5('0x5c'),require(_0x9ec5('0x5d')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x5e'),require(_0x9ec5('0x5f')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x60'),require(_0x9ec5('0x61')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x62'),require(_0x9ec5('0x63')));_0x534bdc[_0x9ec5('0x7')]('/api/intervals',require(_0x9ec5('0x64')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x65'),require('./api/pause'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x66'),require(_0x9ec5('0x67')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x68'),require(_0x9ec5('0x69')));_0x534bdc[_0x9ec5('0x7')]('/api/schedules',require('./api/schedule'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x6a'),require('./api/sound'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x6b'),require(_0x9ec5('0x6c')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x6d'),require(_0x9ec5('0x6e')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x6f'),require(_0x9ec5('0x70')));_0x534bdc[_0x9ec5('0x7')]('/api/cm_hopper_additional_phones',require(_0x9ec5('0x71')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x72'),require(_0x9ec5('0x73')));_0x534bdc[_0x9ec5('0x7')]('/api/triggers',require('./api/trigger'));_0x534bdc['use'](_0x9ec5('0x74'),require(_0x9ec5('0x75')));_0x534bdc['use']('/api/integrations',require(_0x9ec5('0x76')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x77'),require('./api/integrationReport'));_0x534bdc[_0x9ec5('0x7')]('/api/analytics/custom_reports',require(_0x9ec5('0x78')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x79'),require('./api/analyticDefaultReport'));_0x534bdc['use'](_0x9ec5('0x7a'),require(_0x9ec5('0x7b')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x7c'),require(_0x9ec5('0x7d')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x7e'),require('./api/analyticFieldReport'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x7f'),require(_0x9ec5('0x80')));_0x534bdc[_0x9ec5('0x7')]('/api/integrations/salesforce/accounts',require(_0x9ec5('0x81')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x82'),require('./api/intSalesforceConfiguration'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x83'),require(_0x9ec5('0x84')));_0x534bdc[_0x9ec5('0x7')]('/api/integrations/sugarcrm/accounts',require(_0x9ec5('0x85')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x86'),require(_0x9ec5('0x87')));_0x534bdc['use']('/api/integrations/sugarcrm/fields',require(_0x9ec5('0x88')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x89'),require('./api/intDeskAccount'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x8a'),require(_0x9ec5('0x8b')));_0x534bdc[_0x9ec5('0x7')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x8c'),require(_0x9ec5('0x8d')));_0x534bdc['use'](_0x9ec5('0x8e'),require(_0x9ec5('0x8f')));_0x534bdc[_0x9ec5('0x7')]('/api/integrations/zoho/fields',require(_0x9ec5('0x90')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x91'),require(_0x9ec5('0x92')));_0x534bdc['use'](_0x9ec5('0x93'),require(_0x9ec5('0x94')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x95'),require('./api/intZendeskField'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x96'),require(_0x9ec5('0x97')));_0x534bdc[_0x9ec5('0x7')]('/api/integrations/freshdesk/configurations',require(_0x9ec5('0x98')));_0x534bdc[_0x9ec5('0x7')]('/api/integrations/freshdesk/fields',require(_0x9ec5('0x99')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x9a'),require('./api/intVtigerAccount'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x9b'),require(_0x9ec5('0x9c')));_0x534bdc[_0x9ec5('0x7')]('/api/integrations/vtiger/fields',require(_0x9ec5('0x9d')));_0x534bdc[_0x9ec5('0x7')]('/api/integrations/servicenow/accounts',require(_0x9ec5('0x9e')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x9f'),require(_0x9ec5('0xa0')));_0x534bdc[_0x9ec5('0x7')]('/api/integrations/servicenow/fields',require(_0x9ec5('0xa1')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xa2'),require(_0x9ec5('0xa3')));_0x534bdc['use'](_0x9ec5('0xa4'),require(_0x9ec5('0xa5')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xa6'),require(_0x9ec5('0xa7')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xa8'),require(_0x9ec5('0xa9')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xaa'),require('./api/intFreshsalesConfiguration'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xab'),require(_0x9ec5('0xac')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xad'),require(_0x9ec5('0xae')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xaf'),require(_0x9ec5('0xb0')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xb1'),require(_0x9ec5('0xb2')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xb3'),require(_0x9ec5('0xb4')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xb5'),require('./api/jscriptyQuestionReport'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xb6'),require('./api/jscriptySessionReport'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xb7'),require(_0x9ec5('0xb8')));_0x534bdc[_0x9ec5('0x7')]('/api/square/reports',require(_0x9ec5('0xb9')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xba'),require(_0x9ec5('0xbb')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xbc'),require(_0x9ec5('0xbd')));_0x534bdc['use']('/api/settings',require(_0x9ec5('0xbe')));_0x534bdc['use']('/api/square/odbc',require(_0x9ec5('0xbf')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xc0'),require(_0x9ec5('0xc1')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xc2'),require(_0x9ec5('0xc3')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xc4'),require(_0x9ec5('0xc5')));_0x534bdc['use'](_0x9ec5('0xc6'),require('./api/team'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xc7'),require(_0x9ec5('0xc8')));_0x534bdc[_0x9ec5('0x7')]('/api/campaigns',require(_0x9ec5('0xc9')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xca'),require(_0x9ec5('0xcb')));_0x534bdc['use'](_0x9ec5('0xcc'),require('./api/attachment'));_0x534bdc['use'](_0x9ec5('0xcd'),require(_0x9ec5('0xce')));_0x534bdc['use'](_0x9ec5('0xcf'),require('./api/mailTransferReport'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xd0'),require(_0x9ec5('0xd1')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xd2'),require(_0x9ec5('0xd3')));_0x534bdc[_0x9ec5('0x7')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x534bdc[_0x9ec5('0x7')]('/api/sms/reports/transfer',require(_0x9ec5('0xd4')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xd5'),require(_0x9ec5('0xd6')));_0x534bdc['use']('/api/voice/prefixes',require('./api/voicePrefix'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xd7'),require(_0x9ec5('0xd8')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xd9'),require(_0x9ec5('0xda')));_0x534bdc[_0x9ec5('0x7')]('/api/userProfile/resources',require(_0x9ec5('0xdb')));_0x534bdc[_0x9ec5('0x7')]('/api/userNotifications',require(_0x9ec5('0xdc')));_0x534bdc[_0x9ec5('0x7')]('/api/whatsapp/accounts',require(_0x9ec5('0xdd')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xde'),require(_0x9ec5('0xdf')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xe0'),require(_0x9ec5('0xe1')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xe2'),require(_0x9ec5('0xe3')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xe4'),require('./api/whatsappQueueReport'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xe5'),require(_0x9ec5('0xe6')));_0x534bdc[_0x9ec5('0x7')]('/api/whatsapp/queues',require(_0x9ec5('0xe7')));_0x534bdc['use']('/api/cloudProviders',require('./api/cloudProvider'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xe8'),require(_0x9ec5('0xe9')));_0x534bdc[_0x9ec5('0x7')]('/api/user-settings',require(_0x9ec5('0xea')));_0x534bdc[_0x9ec5('0x7')]('/api/auth/local',require(_0x9ec5('0xeb')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xec'),require(_0x9ec5('0xed')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xee'),require(_0x9ec5('0xef')));_0x534bdc['use'](_0x9ec5('0xf0'),require(_0x9ec5('0xf1')));_0x534bdc['use']('/api/rpc',require('./api/rpc'));_0x534bdc['use']('/api/version',require(_0x9ec5('0xf2')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xf3'),require(_0x9ec5('0xf4')));_0x534bdc['use']('/api/pm2',require('./api/pm2'));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xf5'),require(_0x9ec5('0xf6')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xf7'),clientSideLogs);_0x534bdc['use'](_0x9ec5('0xf8'),express[_0x9ec5('0xf9')](path[_0x9ec5('0xfa')](config[_0x9ec5('0xfb')],'/apidoc')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xfc'),express[_0x9ec5('0xf9')](path['join'](config[_0x9ec5('0xfb')],'/www')));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xfd'),express['static'](path['join'](config['root'],_0x9ec5('0xfd'))));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0xfe'),express[_0x9ec5('0xf9')](path[_0x9ec5('0xfa')](config['root'],_0x9ec5('0xff'),_0x9ec5('0x100'))));_0x534bdc[_0x9ec5('0x7')](_0x9ec5('0x101'),express[_0x9ec5('0xf9')](path[_0x9ec5('0xfa')](config['root'],_0x9ec5('0x102'))));_0x534bdc[_0x9ec5('0x103')](_0x9ec5('0x104'))[_0x9ec5('0x105')](errors[0x194]);_0x534bdc[_0x9ec5('0x103')]('/*')['get'](function(_0x1f8781,_0x33e268){_0x33e268[_0x9ec5('0x106')](path[_0x9ec5('0x107')](_0x534bdc[_0x9ec5('0x105')](_0x9ec5('0x108'))+_0x9ec5('0x109')));});return _0x534bdc;});}; \ No newline at end of file +var _0xce31=['./api/webbar','/api/logs','static','join','root','/www','/demo','snippet','3.1.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/triggers','./api/trigger','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','./api/system','/api/pm2','./api/pm2','/api/webbar'];(function(_0x21feca,_0x165ecf){var _0x5f4d98=function(_0x2db50a){while(--_0x2db50a){_0x21feca['push'](_0x21feca['shift']());}};_0x5f4d98(++_0x165ecf);}(_0xce31,0x12a));var _0x1ce3=function(_0x4d4e4d,_0xd39cba){_0x4d4e4d=_0x4d4e4d-0x0;var _0x478f6b=_0xce31[_0x4d4e4d];return _0x478f6b;};'use strict';var path=require(_0x1ce3('0x0'));var express=require(_0x1ce3('0x1'));var errors=require(_0x1ce3('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x1ce3('0x3'))[_0x1ce3('0x4')];var clientSideLogs=require(_0x1ce3('0x5'));exports[_0x1ce3('0x6')]=function(_0x4a8dd0){return setupLoggers(_0x4a8dd0)[_0x1ce3('0x7')](function(){_0x4a8dd0[_0x1ce3('0x8')]('/api/users',require(_0x1ce3('0x9')));_0x4a8dd0['use'](_0x1ce3('0xa'),require('./api/voiceChanSpy'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xb'),require(_0x1ce3('0xc')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xd'),require('./api/voiceExtension'));_0x4a8dd0['use'](_0x1ce3('0xe'),require('./api/voiceMusicOnHold'));_0x4a8dd0['use'](_0x1ce3('0xf'),require(_0x1ce3('0x10')));_0x4a8dd0['use'](_0x1ce3('0x11'),require(_0x1ce3('0x12')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x13'),require('./api/screenRecording'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x14'),require(_0x1ce3('0x15')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x16'),require(_0x1ce3('0x17')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x18'),require('./api/voiceCallReport'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x19'),require(_0x1ce3('0x1a')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x1b'),require(_0x1ce3('0x1c')));_0x4a8dd0[_0x1ce3('0x8')]('/api/voice/queues/reports',require(_0x1ce3('0x1d')));_0x4a8dd0[_0x1ce3('0x8')]('/api/members/reports',require(_0x1ce3('0x1e')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x1f'),require(_0x1ce3('0x20')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x21'),require(_0x1ce3('0x22')));_0x4a8dd0['use'](_0x1ce3('0x23'),require(_0x1ce3('0x24')));_0x4a8dd0['use'](_0x1ce3('0x25'),require(_0x1ce3('0x26')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x27'),require(_0x1ce3('0x28')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x29'),require(_0x1ce3('0x2a')));_0x4a8dd0['use'](_0x1ce3('0x2b'),require(_0x1ce3('0x2c')));_0x4a8dd0[_0x1ce3('0x8')]('/api/mail/messages',require('./api/mailMessage'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x2d'),require(_0x1ce3('0x2e')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x2f'),require(_0x1ce3('0x30')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x31'),require(_0x1ce3('0x32')));_0x4a8dd0['use'](_0x1ce3('0x33'),require(_0x1ce3('0x34')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x35'),require(_0x1ce3('0x36')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x37'),require(_0x1ce3('0x38')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x39'),require(_0x1ce3('0x3a')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x3b'),require(_0x1ce3('0x3c')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x3d'),require(_0x1ce3('0x3e')));_0x4a8dd0[_0x1ce3('0x8')]('/api/fax/reports/queue',require(_0x1ce3('0x3f')));_0x4a8dd0[_0x1ce3('0x8')]('/api/sms/accounts',require('./api/smsAccount'));_0x4a8dd0[_0x1ce3('0x8')]('/api/sms/applications',require('./api/smsApplication'));_0x4a8dd0[_0x1ce3('0x8')]('/api/sms/interactions',require(_0x1ce3('0x40')));_0x4a8dd0[_0x1ce3('0x8')]('/api/sms/messages',require('./api/smsMessage'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x41'),require(_0x1ce3('0x42')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x43'),require(_0x1ce3('0x44')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x45'),require('./api/openchannelApplication'));_0x4a8dd0['use'](_0x1ce3('0x46'),require(_0x1ce3('0x47')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x48'),require(_0x1ce3('0x49')));_0x4a8dd0['use'](_0x1ce3('0x4a'),require(_0x1ce3('0x4b')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x4c'),require(_0x1ce3('0x4d')));_0x4a8dd0[_0x1ce3('0x8')]('/api/openchannel/reports/queue',require(_0x1ce3('0x4e')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x4f'),require(_0x1ce3('0x50')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x51'),require(_0x1ce3('0x52')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x53'),require('./api/chatMessage'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x54'),require(_0x1ce3('0x55')));_0x4a8dd0['use']('/api/chat/queues',require('./api/chatQueue'));_0x4a8dd0['use'](_0x1ce3('0x56'),require(_0x1ce3('0x57')));_0x4a8dd0[_0x1ce3('0x8')]('/api/chat/proactive_actions',require(_0x1ce3('0x58')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x59'),require(_0x1ce3('0x5a')));_0x4a8dd0[_0x1ce3('0x8')]('/api/cm/contacts',require('./api/cmContact'));_0x4a8dd0['use'](_0x1ce3('0x5b'),require(_0x1ce3('0x5c')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x5d'),require('./api/cmHopperBlack'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x5e'),require('./api/cmHopperFinal'));_0x4a8dd0['use'](_0x1ce3('0x5f'),require(_0x1ce3('0x60')));_0x4a8dd0['use'](_0x1ce3('0x61'),require(_0x1ce3('0x62')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x63'),require(_0x1ce3('0x64')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x65'),require(_0x1ce3('0x66')));_0x4a8dd0[_0x1ce3('0x8')]('/api/canned_answers',require(_0x1ce3('0x67')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x68'),require(_0x1ce3('0x69')));_0x4a8dd0['use']('/api/conditions',require(_0x1ce3('0x6a')));_0x4a8dd0['use']('/api/intervals',require(_0x1ce3('0x6b')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x6c'),require('./api/pause'));_0x4a8dd0['use'](_0x1ce3('0x6d'),require(_0x1ce3('0x6e')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x6f'),require('./api/voiceQueuesLog'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x70'),require(_0x1ce3('0x71')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x72'),require(_0x1ce3('0x73')));_0x4a8dd0[_0x1ce3('0x8')]('/api/tags',require('./api/tag'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x74'),require('./api/contactItemType'));_0x4a8dd0['use'](_0x1ce3('0x75'),require(_0x1ce3('0x76')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x77'),require(_0x1ce3('0x78')));_0x4a8dd0[_0x1ce3('0x8')]('/api/templates',require('./api/template'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x79'),require(_0x1ce3('0x7a')));_0x4a8dd0[_0x1ce3('0x8')]('/api/variables',require(_0x1ce3('0x7b')));_0x4a8dd0['use']('/api/integrations',require(_0x1ce3('0x7c')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x7d'),require(_0x1ce3('0x7e')));_0x4a8dd0[_0x1ce3('0x8')]('/api/analytics/custom_reports',require(_0x1ce3('0x7f')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x80'),require('./api/analyticDefaultReport'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x81'),require(_0x1ce3('0x82')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x83'),require(_0x1ce3('0x84')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x85'),require(_0x1ce3('0x86')));_0x4a8dd0['use'](_0x1ce3('0x87'),require(_0x1ce3('0x88')));_0x4a8dd0['use'](_0x1ce3('0x89'),require('./api/intSalesforceAccount'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x8a'),require(_0x1ce3('0x8b')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x8c'),require(_0x1ce3('0x8d')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x8e'),require('./api/intSugarcrmAccount'));_0x4a8dd0['use'](_0x1ce3('0x8f'),require(_0x1ce3('0x90')));_0x4a8dd0[_0x1ce3('0x8')]('/api/integrations/sugarcrm/fields',require(_0x1ce3('0x91')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x92'),require(_0x1ce3('0x93')));_0x4a8dd0['use']('/api/integrations/desk/configurations',require(_0x1ce3('0x94')));_0x4a8dd0[_0x1ce3('0x8')]('/api/integrations/desk/fields',require(_0x1ce3('0x95')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x96'),require(_0x1ce3('0x97')));_0x4a8dd0['use'](_0x1ce3('0x98'),require(_0x1ce3('0x99')));_0x4a8dd0[_0x1ce3('0x8')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x9a'),require(_0x1ce3('0x9b')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x9c'),require(_0x1ce3('0x9d')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x9e'),require(_0x1ce3('0x9f')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xa0'),require(_0x1ce3('0xa1')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xa2'),require(_0x1ce3('0xa3')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xa4'),require(_0x1ce3('0xa5')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xa6'),require(_0x1ce3('0xa7')));_0x4a8dd0['use']('/api/integrations/vtiger/configurations',require(_0x1ce3('0xa8')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xa9'),require(_0x1ce3('0xaa')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xab'),require('./api/intServicenowAccount'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xac'),require(_0x1ce3('0xad')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xae'),require('./api/intServicenowField'));_0x4a8dd0['use']('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xaf'),require(_0x1ce3('0xb0')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xb1'),require(_0x1ce3('0xb2')));_0x4a8dd0[_0x1ce3('0x8')]('/api/integrations/freshsales/accounts',require(_0x1ce3('0xb3')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xb4'),require(_0x1ce3('0xb5')));_0x4a8dd0['use']('/api/integrations/freshsales/fields',require(_0x1ce3('0xb6')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xb7'),require(_0x1ce3('0xb8')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xb9'),require('./api/chatQueueReport'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xba'),require(_0x1ce3('0xbb')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xbc'),require(_0x1ce3('0xbd')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xbe'),require(_0x1ce3('0xbf')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xc0'),require(_0x1ce3('0xc1')));_0x4a8dd0[_0x1ce3('0x8')]('/api/sms/reports/queue',require(_0x1ce3('0xc2')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xc3'),require(_0x1ce3('0xc4')));_0x4a8dd0['use'](_0x1ce3('0xc5'),require(_0x1ce3('0xc6')));_0x4a8dd0['use']('/api/jscripty/projects',require(_0x1ce3('0xc7')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xc8'),require(_0x1ce3('0xc9')));_0x4a8dd0['use'](_0x1ce3('0xca'),require(_0x1ce3('0xcb')));_0x4a8dd0['use'](_0x1ce3('0xcc'),require(_0x1ce3('0xcd')));_0x4a8dd0['use'](_0x1ce3('0xce'),require(_0x1ce3('0xcf')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xd0'),require('./api/squareMessage'));_0x4a8dd0['use'](_0x1ce3('0xd1'),require(_0x1ce3('0xd2')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xd3'),require(_0x1ce3('0xd4')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xd5'),require(_0x1ce3('0xd6')));_0x4a8dd0['use'](_0x1ce3('0xd7'),require('./api/migration'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xd8'),require(_0x1ce3('0xd9')));_0x4a8dd0[_0x1ce3('0x8')]('/api/plugins',require(_0x1ce3('0xda')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xdb'),require(_0x1ce3('0xdc')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xdd'),require(_0x1ce3('0xde')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xdf'),require(_0x1ce3('0xe0')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xe1'),require(_0x1ce3('0xe2')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xe3'),require(_0x1ce3('0xe4')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xe5'),require(_0x1ce3('0xe6')));_0x4a8dd0['use'](_0x1ce3('0xe7'),require(_0x1ce3('0xe8')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xe9'),require('./api/userProfile'));_0x4a8dd0[_0x1ce3('0x8')]('/api/userProfile/sections',require(_0x1ce3('0xea')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xeb'),require(_0x1ce3('0xec')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xed'),require(_0x1ce3('0xee')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xef'),require(_0x1ce3('0xf0')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xf1'),require('./api/whatsappApplication'));_0x4a8dd0['use'](_0x1ce3('0xf2'),require(_0x1ce3('0xf3')));_0x4a8dd0[_0x1ce3('0x8')]('/api/whatsapp/messages',require(_0x1ce3('0xf4')));_0x4a8dd0['use'](_0x1ce3('0xf5'),require(_0x1ce3('0xf6')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xf7'),require('./api/whatsappTransferReport'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xf8'),require(_0x1ce3('0xf9')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xfa'),require(_0x1ce3('0xfb')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xfc'),require('./api/realtime'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xfd'),require(_0x1ce3('0xfe')));_0x4a8dd0[_0x1ce3('0x8')]('/api/auth/local',require(_0x1ce3('0xff')));_0x4a8dd0[_0x1ce3('0x8')]('/api/auth/google',require('./api/authGoogle'));_0x4a8dd0[_0x1ce3('0x8')]('/api/auth/activedirectory',require(_0x1ce3('0x100')));_0x4a8dd0['use']('/api/jira',require('./api/jira'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x101'),require(_0x1ce3('0x102')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x103'),require('./api/version'));_0x4a8dd0[_0x1ce3('0x8')]('/api/system',require(_0x1ce3('0x104')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x105'),require(_0x1ce3('0x106')));_0x4a8dd0['use'](_0x1ce3('0x107'),require(_0x1ce3('0x108')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x109'),clientSideLogs);_0x4a8dd0['use']('/apidoc',express[_0x1ce3('0x10a')](path[_0x1ce3('0x10b')](config[_0x1ce3('0x10c')],'/apidoc')));_0x4a8dd0[_0x1ce3('0x8')]('/www',express[_0x1ce3('0x10a')](path[_0x1ce3('0x10b')](config['root'],_0x1ce3('0x10d'))));_0x4a8dd0[_0x1ce3('0x8')]('/demo',express['static'](path[_0x1ce3('0x10b')](config[_0x1ce3('0x10c')],_0x1ce3('0x10e'))));_0x4a8dd0['use']('/snippet',express[_0x1ce3('0x10a')](path['join'](config[_0x1ce3('0x10c')],_0x1ce3('0x10f'),_0x1ce3('0x110'))));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x111'),express[_0x1ce3('0x10a')](path[_0x1ce3('0x10b')](config[_0x1ce3('0x10c')],_0x1ce3('0x112'))));_0x4a8dd0[_0x1ce3('0x113')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x1ce3('0x114')](errors[0x194]);_0x4a8dd0[_0x1ce3('0x113')]('/*')['get'](function(_0x16b661,_0xec8cb2){_0xec8cb2[_0x1ce3('0x115')](path[_0x1ce3('0x116')](_0x4a8dd0[_0x1ce3('0x114')](_0x1ce3('0x117'))+_0x1ce3('0x118')));});return _0x4a8dd0;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index b6a0529..17240a6 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x889e=['../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.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/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc'];(function(_0x21c068,_0x369d6a){var _0x5cf199=function(_0x2c0159){while(--_0x2c0159){_0x21c068['push'](_0x21c068['shift']());}};_0x5cf199(++_0x369d6a);}(_0x889e,0x77));var _0xe889=function(_0x20b0fb,_0xcba57d){_0x20b0fb=_0x20b0fb-0x0;var _0x14cce6=_0x889e[_0x20b0fb];return _0x14cce6;};'use strict';var jayson=require(_0xe889('0x0'));var _=require(_0xe889('0x1'));var config=require('../config/environment');exports[_0xe889('0x2')]=function(){return new Promise(function(_0x53be95,_0xd27c39){var _0x3f57da={};_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x4')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require('../api/voiceExtension/voiceExtension.rpc'));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x5')));_0x3f57da=_['merge'](_0x3f57da,require('../api/voiceRecording/voiceRecording.rpc'));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x6')));_0x3f57da=_['merge'](_0x3f57da,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x7')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x8')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x9')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0xa')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0xb')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0xc')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require('../api/mailServerIn/mailServerIn.rpc'));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0xd')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0xe')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0xf')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x10')));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x11')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x12')));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x13')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x14')));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x15')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require('../api/faxMessage/faxMessage.rpc'));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x16')));_0x3f57da=_['merge'](_0x3f57da,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x17')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x18')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x19')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x1a')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x1b')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x1c')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x1d')));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x1e')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x1f')));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x20')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x21')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x22')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x23')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x24')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x25')));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x26')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require('../api/interval/interval.rpc'));_0x3f57da=_['merge'](_0x3f57da,require('../api/pause/pause.rpc'));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x27')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x28')));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x29')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x2a')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require('../api/variable/variable.rpc'));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x2b')));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x2c')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x2d')));_0x3f57da=_['merge'](_0x3f57da,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x2e')));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x2f')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x30')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x31')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x32')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x33')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x34')));_0x3f57da=_['merge'](_0x3f57da,require(_0xe889('0x35')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x36')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x37')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x38')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x39')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x3a')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x3b')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x3c')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x3d')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x3e')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x3f')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x40')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require(_0xe889('0x41')));_0x3f57da=_[_0xe889('0x3')](_0x3f57da,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3f7828=jayson[_0xe889('0x42')](_0x3f57da)[_0xe889('0x43')]();var _0x2ee86e=config[_0xe889('0x44')][_0xe889('0x45')]||config[_0xe889('0x45')]+0x1;var _0x78961e=config[_0xe889('0x44')]['ip']||_0xe889('0x46');_0x3f7828['on'](_0xe889('0x47'),function(_0x287e0e){return _0xd27c39(_0x287e0e);});_0x3f7828[_0xe889('0x2')](_0x2ee86e,_0x78961e,function(){console[_0xe889('0x48')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x78961e,_0x2ee86e);require('../config/triggers')['default']();return _0x53be95(_0xe889('0x49')+_0x78961e+':'+_0x2ee86e);});});}; \ No newline at end of file +var _0x0d64=['../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.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/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.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/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc'];(function(_0xc54587,_0x2cb1d8){var _0x464a37=function(_0x23b6a3){while(--_0x23b6a3){_0xc54587['push'](_0xc54587['shift']());}};_0x464a37(++_0x2cb1d8);}(_0x0d64,0x1c4));var _0x40d6=function(_0x2ea74f,_0x358a70){_0x2ea74f=_0x2ea74f-0x0;var _0x448bdc=_0x0d64[_0x2ea74f];return _0x448bdc;};'use strict';var jayson=require('jayson/promise');var _=require(_0x40d6('0x0'));var config=require(_0x40d6('0x1'));exports['listen']=function(){return new Promise(function(_0x5cfba2,_0x330f0a){var _0x306594={};_0x306594=_['merge'](_0x306594,require(_0x40d6('0x2')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/voiceExtension/voiceExtension.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x4')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/voiceRecording/voiceRecording.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x5')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x6')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x7')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x8')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/memberReport/memberReport.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/trunk/trunk.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x9')));_0x306594=_['merge'](_0x306594,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0xa')));_0x306594=_['merge'](_0x306594,require('../api/mailAccount/mailAccount.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0xb')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0xc')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0xd')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0xe')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0xf')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x10')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x11')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x12')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/faxMessage/faxMessage.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x13')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x14')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x15')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x16')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x17')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x18')));_0x306594=_['merge'](_0x306594,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x19')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1a')));_0x306594=_['merge'](_0x306594,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1b')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1c')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1d')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/chatQueue/chatQueue.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1e')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1f')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x20')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x21')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x22')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x23')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x24')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x25')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/sound/sound.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x26')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x27')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/trigger/trigger.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x28')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x29')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x2a')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x2b')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x2c')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x2d')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x2e')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x2f')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x30')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x31')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x32')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x33')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x34')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x35')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/squareRecording/squareRecording.rpc'));_0x306594=_['merge'](_0x306594,require('../api/squareMessage/squareMessage.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x36')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x37')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x38')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x39')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x3a')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x3b')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x3c')));var _0x1d6642=jayson[_0x40d6('0x3d')](_0x306594)[_0x40d6('0x3e')]();var _0x33f292=config[_0x40d6('0x3f')][_0x40d6('0x40')]||config[_0x40d6('0x40')]+0x1;var _0x141281=config[_0x40d6('0x3f')]['ip']||_0x40d6('0x41');_0x1d6642['on'](_0x40d6('0x42'),function(_0x2a7404){return _0x330f0a(_0x2a7404);});_0x1d6642[_0x40d6('0x43')](_0x33f292,_0x141281,function(){console[_0x40d6('0x44')](_0x40d6('0x45'),_0x141281,_0x33f292);require(_0x40d6('0x46'))[_0x40d6('0x47')]();return _0x5cfba2(_0x40d6('0x48')+_0x141281+':'+_0x33f292);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d888f7c..bc9cdeb 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 _0xa816=['./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','destroy','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setContext','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./reply'];(function(_0x3b2919,_0xe974ed){var _0x4a7dbf=function(_0x2d16c8){while(--_0x2d16c8){_0x3b2919['push'](_0x3b2919['shift']());}};_0x4a7dbf(++_0xe974ed);}(_0xa816,0xd7));var _0x6a81=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0xa816[_0x500c0];return _0xdd146f;};'use strict';var util=require(_0x6a81('0x0'));var _=require(_0x6a81('0x1'));var EventEmitter=require(_0x6a81('0x2'))['EventEmitter'];var AGIReply=require(_0x6a81('0x3'));var AGIError=require(_0x6a81('0x4'));function AGIChannel(_0x21eb62){var _0xda4528=this,_0x5c72cc=new AGIReply(),_0x399baa=![],_0x34267c={};EventEmitter['call'](_0xda4528);_0x21eb62[_0x6a81('0x5')](_0x6a81('0x6'));_0x21eb62[_0x6a81('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5c72cc[_0x6a81('0x5')](_0x6a81('0x6'));_0x5c72cc['on']('headers',function(_0x48b70b){for(var _0x51b34f in _0x48b70b){_0xda4528[_0x51b34f]=_0x48b70b[_0x51b34f];}_0xda4528[_0x6a81('0x8')](_0x6a81('0x9'));});_0x5c72cc['on']('line',function(_0x47ce17){if(_0x47ce17[_0x6a81('0xa')]()==_0x6a81('0xb')){_0xda4528['emit']('hangup');return;}if(_0x47ce17[_0x6a81('0xc')](0x0,0xb)==_0x6a81('0xd')){_0x399baa=!![];}if(_0x399baa){_0x34267c['rx']+=_0x47ce17+'\x0a';if(_0x47ce17[_0x6a81('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x399baa=![];}}else{_0x34267c['rx']=_0x47ce17;}if(_0x399baa){return;}if(typeof _0x34267c['cb']==_0x6a81('0xf')){var _0x1e8a59=_0x34267c['rx']['substring'](0x0,0x3),_0xe09ec5=null,_0x549eff=null;_0x1e8a59=parseInt(_0x1e8a59);if(isNaN(_0x1e8a59)){_0x34267c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6a81('0x10')});return;}if(_0x1e8a59!=0xc8){_0x34267c['cb'](null,{'code':_0x1e8a59,'result':-0x1,'extra':'KO'});return;}_0xe09ec5=_0x34267c['rx'][_0x6a81('0xc')](0x4)[_0x6a81('0x11')](_0x6a81('0x12'),'');if(_0xe09ec5[_0x6a81('0x13')]('\x20')!=-0x1){_0xe09ec5=_0xe09ec5[_0x6a81('0x14')](0x0,_0xe09ec5[_0x6a81('0x13')]('\x20'));}if(_[_0x6a81('0x15')](_0xe09ec5,'-1')){_0xe09ec5=parseInt(_0xe09ec5);}_0x549eff=_0x34267c['rx']['split']('\x20');if(_0x549eff[_0x6a81('0x16')]==0x3){_0x549eff=_0x549eff[0x2][_0x6a81('0xc')](0x1,_0x549eff[0x2][_0x6a81('0x16')]-0x1);}else if(_0x549eff['length']>0x3){var _0x1b1be9=/\((.+)\)/;var _0x2cb692=_0x34267c['rx'][_0x6a81('0x17')](_0x1b1be9);if(_0x2cb692){_0x549eff=_0x2cb692[0x1];}else{_0x549eff=null;}}else{_0x549eff=null;}_0x34267c['cb'](null,{'code':_0x1e8a59,'result':_0xe09ec5,'extra':_0x549eff});}});_0x21eb62['on'](_0x6a81('0x18'),function(_0x337a5c){_0xda4528[_0x6a81('0x8')](_0x6a81('0x18'),new AGIError(_0x6a81('0x19'),_0x337a5c['code']));});_0x21eb62['on'](_0x6a81('0x1a'),function(){_0xda4528[_0x6a81('0x8')](_0x6a81('0x1a'),new AGIError(_0x6a81('0x1b')));});_0x21eb62['on']('timeout',function(){_0xda4528['emit'](_0x6a81('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x21eb62[_0x6a81('0x1d')]();});_0x21eb62['pipe'](_0x5c72cc);this[_0x6a81('0x1e')]=function(_0x9eb1f3,_0x240197){var _0x9eb1f3=_0x9eb1f3||'',_0x240197=typeof _0x240197==_0x6a81('0xf')?_0x240197:new Function();_0x34267c={'tx':_0x9eb1f3,'rx':'','cb':_0x240197};_0x21eb62[_0x6a81('0x1f')](_0x9eb1f3+'\x0a');},this['close']=function(){_0x21eb62[_0x6a81('0x1d')]();};}util[_0x6a81('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x6a81('0x21')][_0x6a81('0x22')]=function(_0x364fe7){return this[_0x6a81('0x1e')][_0x6a81('0x23')](this,_0x364fe7);};AGIChannel[_0x6a81('0x21')][_0x6a81('0x24')]=function(){return this[_0x6a81('0x22')](_0x6a81('0x25'));};AGIChannel[_0x6a81('0x21')]['getData']=function(_0xffd727,_0x46c188,_0x1bc4f1){_0xffd727=_0xffd727===undefined?_0x6a81('0x26'):_0xffd727;_0x46c188=_0x46c188===undefined?'5':_0x46c188;_0x1bc4f1=_0x1bc4f1===undefined?'1':_0x1bc4f1;return this['sendRequest'](util[_0x6a81('0x27')](_0x6a81('0x28'),_0xffd727,_0x46c188*0x3e8,_0x1bc4f1));};AGIChannel['prototype'][_0x6a81('0x29')]=function(_0x20fb95){_0x20fb95=_0x20fb95||_0x6a81('0x2a');return this[_0x6a81('0x22')](util[_0x6a81('0x27')](_0x6a81('0x2b'),_0x20fb95));};AGIChannel[_0x6a81('0x21')][_0x6a81('0x2c')]=function(_0x5cfd39,_0x5dfb72){if(_[_0x6a81('0x2d')](_0x5dfb72)){return this[_0x6a81('0x22')](util['format'](_0x6a81('0x2e'),_0x5cfd39,_0x5dfb72[_0x6a81('0x2f')](',')));}return this[_0x6a81('0x22')](util[_0x6a81('0x27')]('EXEC\x20%s\x20%s',_0x5cfd39,_0x5dfb72));};AGIChannel[_0x6a81('0x21')]['setContext']=function(_0x1f936b){return this[_0x6a81('0x22')](util[_0x6a81('0x27')](_0x6a81('0x30'),_0x1f936b));};AGIChannel[_0x6a81('0x21')][_0x6a81('0x31')]=function(_0x1d5cfd){return this[_0x6a81('0x22')](util[_0x6a81('0x27')](_0x6a81('0x32'),_0x1d5cfd));};AGIChannel[_0x6a81('0x21')][_0x6a81('0x33')]=function(_0x26d46a){return this[_0x6a81('0x22')](util['format']('SET\x20PRIORITY\x20%s',_0x26d46a));};AGIChannel[_0x6a81('0x21')][_0x6a81('0xb')]=function(){return this[_0x6a81('0x22')](_0x6a81('0x34'));};AGIChannel[_0x6a81('0x21')][_0x6a81('0x35')]=function(_0x53945c,_0x24a07f){var _0x2198dc=_['isBoolean'](_0x24a07f)||_[_0x6a81('0x36')](_0x24a07f)?_0x24a07f['toString']():_0x24a07f;return this[_0x6a81('0x22')](util[_0x6a81('0x27')](_0x6a81('0x37'),_0x53945c,_0x2198dc?_0x2198dc[_0x6a81('0x38')]()[_0x6a81('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6a81('0x21')][_0x6a81('0x39')]=function(_0x2285bb,_0x52d759){return this[_0x6a81('0x22')](util[_0x6a81('0x27')](_0x6a81('0x3a'),_0x2285bb,_0x52d759));};AGIChannel[_0x6a81('0x21')][_0x6a81('0x3b')]=function(_0x329226,_0x35896e){return this[_0x6a81('0x22')](util[_0x6a81('0x27')]('SAY\x20DIGITS\x20%s\x20%s',_0x329226,_0x35896e));};AGIChannel[_0x6a81('0x21')][_0x6a81('0x3c')]=function(_0x4bb70e,_0x49a27e){return this[_0x6a81('0x22')](util[_0x6a81('0x27')](_0x6a81('0x3d'),_0x4bb70e,_0x49a27e));};AGIChannel[_0x6a81('0x21')]['continueAt']=function(_0x31545a,_0x3cb25c,_0x517603){_0x3cb25c=_0x3cb25c||this[_0x6a81('0x3e')];_0x517603=_0x517603||0x1;this[_0x6a81('0x3f')](_0x31545a);this[_0x6a81('0x31')](_0x3cb25c);this[_0x6a81('0x33')](_0x517603);return this[_0x6a81('0x29')](util[_0x6a81('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x31545a,_0x3cb25c,_0x517603));};AGIChannel[_0x6a81('0x21')][_0x6a81('0x40')]=function(_0x3fdb5f){return this[_0x6a81('0x22')](util[_0x6a81('0x27')](_0x6a81('0x41'),_0x3fdb5f));};AGIChannel[_0x6a81('0x21')]['recordFile']=function(_0x22920d,_0x362f82,_0x7d07b0,_0x523b5d,_0x382e3a,_0x1c7161){_0x362f82=_0x362f82||_0x6a81('0x42');_0x7d07b0=_0x7d07b0||'';_0x523b5d=_0x523b5d===undefined?-0x1:_0x523b5d==='-1'?-0x1:_0x523b5d*0x3e8;_0x382e3a=_0x382e3a===undefined?'':'s='+_0x382e3a;_0x1c7161=_0x1c7161?'BEEP':'';return this[_0x6a81('0x22')](util[_0x6a81('0x27')](_0x6a81('0x43'),_0x22920d,_0x362f82,_0x7d07b0,_0x523b5d,_0x1c7161,_0x382e3a));};AGIChannel[_0x6a81('0x21')][_0x6a81('0x44')]=function(_0x1aba23,_0x1a6fe0){_0x1a6fe0=_0x1a6fe0||'';return this['sendRequest'](util[_0x6a81('0x27')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x1aba23,_0x1a6fe0));};AGIChannel['prototype'][_0x6a81('0x45')]=function(_0x472d85){return this[_0x6a81('0x2c')]('AGI',_0x472d85);};AGIChannel[_0x6a81('0x21')]['wait']=function(_0x772d7f){return this[_0x6a81('0x2c')]('WAIT',_0x772d7f);};AGIChannel[_0x6a81('0x21')][_0x6a81('0x18')]=function(_0x2befe1,_0x555548){this['noop'](util[_0x6a81('0x27')](_0x6a81('0x46'),_0x2befe1['id'],_0x2befe1[_0x6a81('0x47')],_0x555548));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6a81('0x48')]=AGIChannel; \ No newline at end of file +var _0x9a0d=['toString','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','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','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','emit','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','command','write','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','SET\x20VARIABLE\x20%s\x20\x22%s\x22'];(function(_0x209d12,_0x8597c5){var _0x46c291=function(_0x20667d){while(--_0x20667d){_0x209d12['push'](_0x209d12['shift']());}};_0x46c291(++_0x8597c5);}(_0x9a0d,0x1ee));var _0xd9a0=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x9a0d[_0x46cf00];return _0x3974dc;};'use strict';var util=require(_0xd9a0('0x0'));var _=require('lodash');var EventEmitter=require(_0xd9a0('0x1'))[_0xd9a0('0x2')];var AGIReply=require(_0xd9a0('0x3'));var AGIError=require(_0xd9a0('0x4'));function AGIChannel(_0x179d5c){var _0x1b5b4c=this,_0x603e=new AGIReply(),_0x519df1=![],_0x31c6ce={};EventEmitter[_0xd9a0('0x5')](_0x1b5b4c);_0x179d5c[_0xd9a0('0x6')](_0xd9a0('0x7'));_0x179d5c[_0xd9a0('0x8')](0x8*0x3c*0x3c*0x3e8);_0x603e[_0xd9a0('0x6')](_0xd9a0('0x7'));_0x603e['on'](_0xd9a0('0x9'),function(_0x17e5fc){for(var _0x1e079c in _0x17e5fc){_0x1b5b4c[_0x1e079c]=_0x17e5fc[_0x1e079c];}_0x1b5b4c['emit'](_0xd9a0('0xa'));});_0x603e['on'](_0xd9a0('0xb'),function(_0x1f5d6d){if(_0x1f5d6d[_0xd9a0('0xc')]()==_0xd9a0('0xd')){_0x1b5b4c['emit'](_0xd9a0('0xd'));return;}if(_0x1f5d6d['substring'](0x0,0xb)=='520-Invalid'){_0x519df1=!![];}if(_0x519df1){_0x31c6ce['rx']+=_0x1f5d6d+'\x0a';if(_0x1f5d6d[_0xd9a0('0xe')](_0xd9a0('0xf'))!=-0x1){_0x519df1=![];}}else{_0x31c6ce['rx']=_0x1f5d6d;}if(_0x519df1){return;}if(typeof _0x31c6ce['cb']==_0xd9a0('0x10')){var _0x4a2ec9=_0x31c6ce['rx'][_0xd9a0('0x11')](0x0,0x3),_0x4d7c8a=null,_0x302a08=null;_0x4a2ec9=parseInt(_0x4a2ec9);if(isNaN(_0x4a2ec9)){_0x31c6ce['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xd9a0('0x12')});return;}if(_0x4a2ec9!=0xc8){_0x31c6ce['cb'](null,{'code':_0x4a2ec9,'result':-0x1,'extra':'KO'});return;}_0x4d7c8a=_0x31c6ce['rx'][_0xd9a0('0x11')](0x4)[_0xd9a0('0x13')](_0xd9a0('0x14'),'');if(_0x4d7c8a[_0xd9a0('0x15')]('\x20')!=-0x1){_0x4d7c8a=_0x4d7c8a[_0xd9a0('0x16')](0x0,_0x4d7c8a[_0xd9a0('0x15')]('\x20'));}if(_[_0xd9a0('0x17')](_0x4d7c8a,'-1')){_0x4d7c8a=parseInt(_0x4d7c8a);}_0x302a08=_0x31c6ce['rx'][_0xd9a0('0x18')]('\x20');if(_0x302a08[_0xd9a0('0x19')]==0x3){_0x302a08=_0x302a08[0x2][_0xd9a0('0x11')](0x1,_0x302a08[0x2][_0xd9a0('0x19')]-0x1);}else if(_0x302a08[_0xd9a0('0x19')]>0x3){var _0x50b08c=/\((.+)\)/;var _0x52d93d=_0x31c6ce['rx'][_0xd9a0('0x1a')](_0x50b08c);if(_0x52d93d){_0x302a08=_0x52d93d[0x1];}else{_0x302a08=null;}}else{_0x302a08=null;}_0x31c6ce['cb'](null,{'code':_0x4a2ec9,'result':_0x4d7c8a,'extra':_0x302a08});}});_0x179d5c['on'](_0xd9a0('0x1b'),function(_0x3448f2){_0x1b5b4c[_0xd9a0('0x1c')]('error',new AGIError(_0xd9a0('0x1d'),_0x3448f2[_0xd9a0('0x1e')]));});_0x179d5c['on'](_0xd9a0('0x1f'),function(){_0x1b5b4c['emit'](_0xd9a0('0x1f'),new AGIError(_0xd9a0('0x20')));});_0x179d5c['on']('timeout',function(){_0x1b5b4c['emit']('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x179d5c[_0xd9a0('0x21')]();});_0x179d5c[_0xd9a0('0x22')](_0x603e);this[_0xd9a0('0x23')]=function(_0x2fea9b,_0x1bcbb2){var _0x2fea9b=_0x2fea9b||'',_0x1bcbb2=typeof _0x1bcbb2=='function'?_0x1bcbb2:new Function();_0x31c6ce={'tx':_0x2fea9b,'rx':'','cb':_0x1bcbb2};_0x179d5c[_0xd9a0('0x24')](_0x2fea9b+'\x0a');},this[_0xd9a0('0x1f')]=function(){_0x179d5c[_0xd9a0('0x21')]();};}util[_0xd9a0('0x25')](AGIChannel,EventEmitter);AGIChannel[_0xd9a0('0x26')]['sendRequest']=function(_0x4de39a){return this[_0xd9a0('0x23')][_0xd9a0('0x27')](this,_0x4de39a);};AGIChannel['prototype'][_0xd9a0('0x28')]=function(){return this[_0xd9a0('0x29')](_0xd9a0('0x2a'));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x2b')]=function(_0x37c7ed,_0x589d12,_0x2e6f4e){_0x37c7ed=_0x37c7ed===undefined?'beep':_0x37c7ed;_0x589d12=_0x589d12===undefined?'5':_0x589d12;_0x2e6f4e=_0x2e6f4e===undefined?'1':_0x2e6f4e;return this['sendRequest'](util[_0xd9a0('0x2c')](_0xd9a0('0x2d'),_0x37c7ed,_0x589d12*0x3e8,_0x2e6f4e));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x2e')]=function(_0x1c2a20){_0x1c2a20=_0x1c2a20||'NO\x20MESSAGE';return this[_0xd9a0('0x29')](util['format'](_0xd9a0('0x2f'),_0x1c2a20));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x30')]=function(_0x4cf4ad,_0x2d619c){if(_[_0xd9a0('0x31')](_0x2d619c)){return this[_0xd9a0('0x29')](util['format']('EXEC\x20%s\x20%s',_0x4cf4ad,_0x2d619c[_0xd9a0('0x32')](',')));}return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x33'),_0x4cf4ad,_0x2d619c));};AGIChannel['prototype'][_0xd9a0('0x34')]=function(_0xea605b){return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x35'),_0xea605b));};AGIChannel[_0xd9a0('0x26')]['setExtension']=function(_0x2bd4c4){return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x36'),_0x2bd4c4));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x37')]=function(_0x4c07ea){return this['sendRequest'](util['format'](_0xd9a0('0x38'),_0x4c07ea));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0xd')]=function(){return this[_0xd9a0('0x29')](_0xd9a0('0x39'));};AGIChannel['prototype']['setVariable']=function(_0x8c93e6,_0x4b3408){var _0x4008e6=_['isBoolean'](_0x4b3408)||_['isNumber'](_0x4b3408)?_0x4b3408['toString']():_0x4b3408;return this['sendRequest'](util[_0xd9a0('0x2c')](_0xd9a0('0x3a'),_0x8c93e6,_0x4008e6?_0x4008e6[_0xd9a0('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x3c')]=function(_0x334f52,_0xd00a59){return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')]('SAY\x20NUMBER\x20%s\x20%s',_0x334f52,_0xd00a59));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x3d')]=function(_0x243336,_0x50110c){return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x3e'),_0x243336,_0x50110c));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x3f')]=function(_0x69fbd5,_0x475535){return this['sendRequest'](util[_0xd9a0('0x2c')](_0xd9a0('0x40'),_0x69fbd5,_0x475535));};AGIChannel['prototype'][_0xd9a0('0x41')]=function(_0x17c497,_0x271888,_0x2e83fd){_0x271888=_0x271888||this[_0xd9a0('0x42')];_0x2e83fd=_0x2e83fd||0x1;this[_0xd9a0('0x34')](_0x17c497);this[_0xd9a0('0x43')](_0x271888);this['setPriority'](_0x2e83fd);return this[_0xd9a0('0x2e')](util['format'](_0xd9a0('0x44'),_0x17c497,_0x271888,_0x2e83fd));};AGIChannel[_0xd9a0('0x26')]['getVariable']=function(_0x3d21a2){return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x45'),_0x3d21a2));};AGIChannel['prototype'][_0xd9a0('0x46')]=function(_0x3a0ff5,_0x1a5669,_0xb2f25a,_0x4572f1,_0x40ea37,_0x4c44ec){_0x1a5669=_0x1a5669||_0xd9a0('0x47');_0xb2f25a=_0xb2f25a||'';_0x4572f1=_0x4572f1===undefined?-0x1:_0x4572f1==='-1'?-0x1:_0x4572f1*0x3e8;_0x40ea37=_0x40ea37===undefined?'':'s='+_0x40ea37;_0x4c44ec=_0x4c44ec?'BEEP':'';return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3a0ff5,_0x1a5669,_0xb2f25a,_0x4572f1,_0x4c44ec,_0x40ea37));};AGIChannel['prototype'][_0xd9a0('0x48')]=function(_0x5c7b64,_0x5a6c41){_0x5a6c41=_0x5a6c41||'';return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x49'),_0x5c7b64,_0x5a6c41));};AGIChannel[_0xd9a0('0x26')]['agi']=function(_0x51d5dc){return this[_0xd9a0('0x30')](_0xd9a0('0x4a'),_0x51d5dc);};AGIChannel['prototype'][_0xd9a0('0x4b')]=function(_0x162472){return this[_0xd9a0('0x30')](_0xd9a0('0x4c'),_0x162472);};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x1b')]=function(_0x57b225,_0x345e18){this[_0xd9a0('0x2e')](util['format'](_0xd9a0('0x4d'),_0x57b225['id'],_0x57b225[_0xd9a0('0x4e')],_0x345e18));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 5076080..ffc6a28 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 _0x3d06=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','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','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x71ac1a,_0xe9a4b0){var _0x54103c=function(_0x448482){while(--_0x448482){_0x71ac1a['push'](_0x71ac1a['shift']());}};_0x54103c(++_0xe9a4b0);}(_0x3d06,0x13f));var _0x63d0=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x3d06[_0x37a79c];return _0x561d89;};'use strict';var util=require(_0x63d0('0x0'));var error={'E_AGI_UNDEFINED':_0x63d0('0x1'),'E_AGI_ARGUMENT_PORT':_0x63d0('0x2'),'E_AGI_SERVER_ERROR':_0x63d0('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x63d0('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x63d0('0x5'),'E_AGI_SOCKET_CLOSE':_0x63d0('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x63d0('0x7'),'E_AGI_COMMAND_EMPTY':_0x63d0('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x63d0('0x9'),'E_AGI_IVR_ENTRY':_0x63d0('0xa')};function AGIError(_0x57a678){var _0x57a678=_0x57a678||null,_0x12e3df=_0x12e3df||[],_0x7d678d=0x1,_0x57e478='';if(!error[_0x57a678]){_0x57a678=_0x63d0('0xb');}_0x12e3df[_0x63d0('0xc')](error[_0x57a678]);while(arguments[_0x7d678d]){_0x12e3df[_0x63d0('0xc')](arguments[_0x7d678d]);_0x7d678d++;}_0x57e478=util['format'][_0x63d0('0xd')](util,_0x12e3df);this[_0x63d0('0xe')]=_0x57e478;this[_0x63d0('0xf')]=_0x57a678;}module[_0x63d0('0x10')]=AGIError; \ No newline at end of file +var _0x293c=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util'];(function(_0x582fb8,_0x420a67){var _0x359409=function(_0xc5d208){while(--_0xc5d208){_0x582fb8['push'](_0x582fb8['shift']());}};_0x359409(++_0x420a67);}(_0x293c,0x1c1));var _0xc293=function(_0x4edcdf,_0x388d17){_0x4edcdf=_0x4edcdf-0x0;var _0x5b96f8=_0x293c[_0x4edcdf];return _0x5b96f8;};'use strict';var util=require(_0xc293('0x0'));var error={'E_AGI_UNDEFINED':_0xc293('0x1'),'E_AGI_ARGUMENT_PORT':_0xc293('0x2'),'E_AGI_SERVER_ERROR':_0xc293('0x3'),'E_AGI_SERVER_CLOSE':_0xc293('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xc293('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xc293('0x6'),'E_AGI_SOCKET_ERROR':_0xc293('0x7'),'E_AGI_SOCKET_CLOSE':_0xc293('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xc293('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc293('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2e6473){var _0x2e6473=_0x2e6473||null,_0x23f892=_0x23f892||[],_0x8944c1=0x1,_0x5b1d70='';if(!error[_0x2e6473]){_0x2e6473=_0xc293('0xb');}_0x23f892[_0xc293('0xc')](error[_0x2e6473]);while(arguments[_0x8944c1]){_0x23f892['push'](arguments[_0x8944c1]);_0x8944c1++;}_0x5b1d70=util[_0xc293('0xd')][_0xc293('0xe')](util,_0x23f892);this[_0xc293('0xf')]=_0x5b1d70;this[_0xc293('0x10')]=_0x2e6473;}module[_0xc293('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 272b4f3..23d369d 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 _0xb826=['redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','projectUpdate','lodash','events','EventEmitter','ioredis','./error','../../config/environment'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb826,0x72));var _0x6b82=function(_0x246a2c,_0x1b1130){_0x246a2c=_0x246a2c-0x0;var _0x53ec57=_0xb826[_0x246a2c];return _0x53ec57;};'use strict';var _=require(_0x6b82('0x0'));var EventEmitter=require(_0x6b82('0x1'))[_0x6b82('0x2')];var Redis=require(_0x6b82('0x3'));var AGIError=require(_0x6b82('0x4'));var config=require(_0x6b82('0x5'));config[_0x6b82('0x6')]=_['defaults'](config[_0x6b82('0x6')],{'host':_0x6b82('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x6b82('0x8')](_0x6b82('0x9'),function(_0x2c4c66){if(_0x2c4c66)return eventEmitter[_0x6b82('0xa')](_0x6b82('0xb'),new AGIError(_0x6b82('0xc'),_0x2c4c66));});sub['on'](_0x6b82('0xd'),function(_0x2b7469,_0x18ad77){if(_0x2b7469!==_0x6b82('0x9'))return;try{var _0x767b39=JSON['parse'](_0x18ad77);eventEmitter[_0x6b82('0xa')](_0x6b82('0xe'),_0x767b39);}catch(_0x4fe5ff){eventEmitter[_0x6b82('0xa')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x4fe5ff));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x3d59=['emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','lodash','events','EventEmitter','../../config/environment','redis','defaults','subscribe','agi'];(function(_0x5321ab,_0x519cb9){var _0x4866b1=function(_0x427199){while(--_0x427199){_0x5321ab['push'](_0x5321ab['shift']());}};_0x4866b1(++_0x519cb9);}(_0x3d59,0x102));var _0x93d5=function(_0x1290dd,_0x2c4021){_0x1290dd=_0x1290dd-0x0;var _0x3739e6=_0x3d59[_0x1290dd];return _0x3739e6;};'use strict';var _=require(_0x93d5('0x0'));var EventEmitter=require(_0x93d5('0x1'))[_0x93d5('0x2')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x93d5('0x3'));config[_0x93d5('0x4')]=_[_0x93d5('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x93d5('0x4')]);sub[_0x93d5('0x6')](_0x93d5('0x7'),function(_0x9bf482){if(_0x9bf482)return eventEmitter[_0x93d5('0x8')](_0x93d5('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x9bf482));});sub['on'](_0x93d5('0xa'),function(_0x28d92b,_0x3030b3){if(_0x28d92b!==_0x93d5('0x7'))return;try{var _0x28ab1a=JSON[_0x93d5('0xb')](_0x3030b3);eventEmitter[_0x93d5('0x8')](_0x93d5('0xc'),_0x28ab1a);}catch(_0x5dcaf2){eventEmitter[_0x93d5('0x8')]('error',new AGIError(_0x93d5('0xd'),_0x5dcaf2));}});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 98162db..2206109 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 _0x1519=['condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex','prototype','addEdge','push','size','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','target','default','invalid','vswitch','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0x1519,0xd4));var _0x9151=function(_0x1aa988,_0x3b5e3c){_0x1aa988=_0x1aa988-0x0;var _0x266bec=_0x1519[_0x1aa988];return _0x266bec;};'use strict';var _=require(_0x9151('0x0'));var logger=require(_0x9151('0x1'))(_0x9151('0x2'));var verticesWithRetry=['menu',_0x9151('0x3'),_0x9151('0x4')];var Graph=function(){this[_0x9151('0x5')]={};this[_0x9151('0x6')]={};this[_0x9151('0x7')]=0x0;};Graph['prototype'][_0x9151('0x8')]=function(_0x2725d3){this['vertices'][_0x2725d3['id']]=_0x2725d3;this['edges'][_0x2725d3['id']]=[];};Graph[_0x9151('0x9')][_0x9151('0xa')]=function(_0x340823,_0x4f5d1f,_0x2aceac){this[_0x9151('0x6')][_0x340823][_0x9151('0xb')]({'target':_0x4f5d1f,'condition':_0x2aceac});this['numberOfEdges']+=0x1;};Graph[_0x9151('0x9')][_0x9151('0xc')]=function(){return _[_0x9151('0xc')](this[_0x9151('0x5')]);};Graph[_0x9151('0x9')]['relations']=function(){return this[_0x9151('0x7')];};Graph[_0x9151('0x9')][_0x9151('0xd')]=function(_0x507046){return this[_0x9151('0x5')][_0x507046];};Graph[_0x9151('0x9')][_0x9151('0xe')]=function(_0x1cde5e,_0x2d62c7){if(!this[_0x9151('0x5')][_0x1cde5e]){return logger[_0x9151('0xf')]('no\x20vertex\x20found');}var _0x1cd096=_0x2d62c7(this['vertices'][_0x1cde5e]);if(!_0x1cd096){return logger[_0x9151('0xf')](_0x9151('0x10'));}if(this[_0x9151('0x6')][_0x1cde5e][_0x9151('0x11')]===0x0){return logger[_0x9151('0xf')](_0x9151('0x12'));}for(var _0x223a80=0x0,_0x36f0f0=[],_0x2b5aaf=![];_0x223a80\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','handleNotFound','handleUnpublished','initialize','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','[%s]\x20%s','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x8ced,0x192));var _0xd8ce=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0x8ced[_0xdb01a];return _0x107ede;};'use strict';var _=require(_0xd8ce('0x0'));var syncho=require(_0xd8ce('0x1'));var util=require(_0xd8ce('0x2'));var config=require(_0xd8ce('0x3'));var logger=require(_0xd8ce('0x4'))(_0xd8ce('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xd8ce('0x6'));var Project=require(_0xd8ce('0x7'));var AGIEmitter=require(_0xd8ce('0x8'))[_0xd8ce('0x9')];var projects=[];config[_0xd8ce('0x5')]=_[_0xd8ce('0xa')](config[_0xd8ce('0x5')],{'ip':_0xd8ce('0xb'),'port':0x11dd});AGIEmitter['on'](_0xd8ce('0xc'),projectUpdateHandler);function connectionHandler(_0x5cf81a){process[_0xd8ce('0xd')](function(){syncho(function(){try{setChannelVariables(_0x5cf81a);agiHandler(_0x5cf81a);}catch(_0x4c745f){logger[_0xd8ce('0xe')](_0x4c745f[_0xd8ce('0xf')]);}});});}function projectUpdateHandler(_0x900b28){try{var _0x4e7b6b=_['findIndex'](projects,['id',_0x900b28['id']]);if(_0x4e7b6b>-0x1){if(_0x900b28[_0xd8ce('0x10')]===!![]){projects[_0xd8ce('0x11')](_0x4e7b6b,0x1);}else{projects[_0x4e7b6b]=_0x900b28;}}else{projects[_0xd8ce('0x12')](_0x900b28);}}catch(_0x578934){logger[_0xd8ce('0xe')](_0x578934['stack']);}}function listeningHandler(){console[_0xd8ce('0x13')](_0xd8ce('0x14'),config['agi'][_0xd8ce('0x15')]);logger[_0xd8ce('0x16')](util['format'](_0xd8ce('0x17'),config[_0xd8ce('0x5')]['ip'],config[_0xd8ce('0x5')]['port']));}function errorHandler(_0x20f4f3){if(_0x20f4f3&&_0x20f4f3[_0xd8ce('0x18')]&&_0x20f4f3['message']){logger[_0xd8ce('0xe')](util[_0xd8ce('0x19')](_0xd8ce('0x1a'),_0x20f4f3[_0xd8ce('0x18')],_0x20f4f3[_0xd8ce('0x1b')]));}else{logger[_0xd8ce('0xe')](util['format']('[ERROR]\x20%s',_0x20f4f3[_0xd8ce('0xf')]));}}function closeHandler(){logger['info'](util[_0xd8ce('0x19')](_0xd8ce('0x1c'),this['arg_1'],this['calleridname'],this[_0xd8ce('0x1d')],this[_0xd8ce('0x1e')],this[_0xd8ce('0x1f')]));try{createSquareReport(this);}catch(_0x474fe7){logger[_0xd8ce('0xe')](_0x474fe7[_0xd8ce('0xf')]);}}function timeoutHandler(){logger[_0xd8ce('0x16')](util[_0xd8ce('0x19')](_0xd8ce('0x20'),this[_0xd8ce('0x21')],this[_0xd8ce('0x22')],this['callerid'],this['dnid'],this[_0xd8ce('0x1f')]));}function hangupHandler(){logger[_0xd8ce('0x16')](util[_0xd8ce('0x19')](_0xd8ce('0x23'),this[_0xd8ce('0x21')],this[_0xd8ce('0x22')],this[_0xd8ce('0x1d')],this['dnid'],this['uniqueid']));this[_0xd8ce('0x24')]=!![];}function createSquareReport(_0x423ccf,_0x4b45f1){rpc[_0xd8ce('0x25')](_0x423ccf)[_0xd8ce('0x26')](function(_0x14549f){if(_0x4b45f1){_0x4b45f1(null,_0x14549f);}})[_0xd8ce('0x27')](function(_0x18efc3){if(_0x4b45f1){_0x4b45f1(null,_0x18efc3);}});}function setChannelVariables(_0x1e9a94){for(var _0x1f033d in _0x1e9a94){if(_0x1e9a94[_0xd8ce('0x28')](_0x1f033d)){if(_0x1f033d[_0xd8ce('0x29')](_0xd8ce('0x2a'))===0x0){_0x1e9a94[_0x1f033d[_0xd8ce('0x2b')](0x4)]=_0x1e9a94[_0x1f033d];delete _0x1e9a94[_0x1f033d];}}}}function agiHandler(_0x928489){logger[_0xd8ce('0x2c')](_0xd8ce('0x2d'),JSON[_0xd8ce('0x2e')](_0x928489,null,0x2));logger[_0xd8ce('0x16')](util[_0xd8ce('0x19')](_0xd8ce('0x2f'),_0x928489[_0xd8ce('0x21')],_0x928489[_0xd8ce('0x22')],_0x928489[_0xd8ce('0x1d')],_0x928489[_0xd8ce('0x1e')],_0x928489['uniqueid']));_0x928489['on'](_0xd8ce('0xe'),errorHandler);_0x928489['on'](_0xd8ce('0x30'),closeHandler);_0x928489['on']('timeout',timeoutHandler);_0x928489['evtHangup']=![];_0x928489['on'](_0xd8ce('0x31'),hangupHandler);var _0x43a74b=_[_0xd8ce('0x32')](projects,[_0xd8ce('0x18'),_0x928489[_0xd8ce('0x21')]]);if(!_0x43a74b)return Project[_0xd8ce('0x33')](_0x928489);if(!_0x43a74b['production'])return Project[_0xd8ce('0x34')](_0x928489);return Project[_0xd8ce('0x35')](_0x43a74b,_0x928489);}function main(){var _0x381dd5;return utilLicense['getLicense']()[_0xd8ce('0x26')](function(_0x3be593){if(!_0x3be593)return;if(_0x3be593['voice']){if(_0x3be593['callysquare']&&_0x3be593['callysquare']>0x0){logger[_0xd8ce('0x16')](util[_0xd8ce('0x19')](_0xd8ce('0x36'),_0x3be593[_0xd8ce('0x37')]));_0x381dd5=_0x3be593[_0xd8ce('0x37')];}else{logger[_0xd8ce('0x16')](_0xd8ce('0x38'));}}else{logger[_0xd8ce('0x16')](_0xd8ce('0x39'));_0x381dd5=-0x1;}})[_0xd8ce('0x26')](function(){return Project[_0xd8ce('0x3a')]();})[_0xd8ce('0x26')](function(_0xb9bb8f){projects=_0xb9bb8f;return;})[_0xd8ce('0x27')](function(_0x3358c4){logger[_0xd8ce('0xe')]('[LICENSE]',_0x3358c4[_0xd8ce('0xf')]);})[_0xd8ce('0x3b')](function(){var _0x1fe568=require(_0xd8ce('0x3c'))(config[_0xd8ce('0x5')]['port'],config['agi']['ip'],_0x381dd5);_0x1fe568['on']('error',errorHandler);_0x1fe568['on'](_0xd8ce('0x3d'),listeningHandler);_0x1fe568['on'](_0xd8ce('0x3e'),connectionHandler);_0x1fe568['on'](_0xd8ce('0x30'),closeHandler);});}main(); \ No newline at end of file +var _0x6823=['nextTick','error','findIndex','splice','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','info','[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','then','catch','hasOwnProperty','indexOf','variables','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server','listening','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./project','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6823,0x1bb));var _0x3682=function(_0x257f33,_0x1f577c){_0x257f33=_0x257f33-0x0;var _0xd4b42c=_0x6823[_0x257f33];return _0xd4b42c;};'use strict';var _=require('lodash');var syncho=require(_0x3682('0x0'));var util=require(_0x3682('0x1'));var config=require(_0x3682('0x2'));var logger=require(_0x3682('0x3'))('agi');var utilLicense=require(_0x3682('0x4'));var rpc=require(_0x3682('0x5'));var Project=require(_0x3682('0x6'));var AGIEmitter=require(_0x3682('0x7'))[_0x3682('0x8')];var projects=[];config[_0x3682('0x9')]=_[_0x3682('0xa')](config[_0x3682('0x9')],{'ip':_0x3682('0xb'),'port':0x11dd});AGIEmitter['on'](_0x3682('0xc'),projectUpdateHandler);function connectionHandler(_0xbebc55){process[_0x3682('0xd')](function(){syncho(function(){try{setChannelVariables(_0xbebc55);agiHandler(_0xbebc55);}catch(_0x8b86ef){logger[_0x3682('0xe')](_0x8b86ef['stack']);}});});}function projectUpdateHandler(_0x55ddac){try{var _0x5a3af5=_[_0x3682('0xf')](projects,['id',_0x55ddac['id']]);if(_0x5a3af5>-0x1){if(_0x55ddac['deleted']===!![]){projects[_0x3682('0x10')](_0x5a3af5,0x1);}else{projects[_0x5a3af5]=_0x55ddac;}}else{projects['push'](_0x55ddac);}}catch(_0x5e5ed0){logger[_0x3682('0xe')](_0x5e5ed0[_0x3682('0x11')]);}}function listeningHandler(){console[_0x3682('0x12')](_0x3682('0x13'),config[_0x3682('0x9')][_0x3682('0x14')]);logger['info'](util[_0x3682('0x15')](_0x3682('0x16'),config[_0x3682('0x9')]['ip'],config[_0x3682('0x9')][_0x3682('0x14')]));}function errorHandler(_0x23af11){if(_0x23af11&&_0x23af11['name']&&_0x23af11[_0x3682('0x17')]){logger[_0x3682('0xe')](util[_0x3682('0x15')]('[%s]\x20%s',_0x23af11[_0x3682('0x18')],_0x23af11[_0x3682('0x17')]));}else{logger[_0x3682('0xe')](util[_0x3682('0x15')](_0x3682('0x19'),_0x23af11[_0x3682('0x11')]));}}function closeHandler(){logger['info'](util[_0x3682('0x15')](_0x3682('0x1a'),this[_0x3682('0x1b')],this[_0x3682('0x1c')],this[_0x3682('0x1d')],this[_0x3682('0x1e')],this[_0x3682('0x1f')]));try{createSquareReport(this);}catch(_0x38d872){logger['error'](_0x38d872['stack']);}}function timeoutHandler(){logger[_0x3682('0x20')](util[_0x3682('0x15')](_0x3682('0x21'),this[_0x3682('0x1b')],this[_0x3682('0x1c')],this[_0x3682('0x1d')],this['dnid'],this[_0x3682('0x1f')]));}function hangupHandler(){logger[_0x3682('0x20')](util[_0x3682('0x15')](_0x3682('0x22'),this['arg_1'],this[_0x3682('0x1c')],this[_0x3682('0x1d')],this['dnid'],this['uniqueid']));this[_0x3682('0x23')]=!![];}function createSquareReport(_0x2aabb7,_0x272aee){rpc['createSquareReport'](_0x2aabb7)[_0x3682('0x24')](function(_0x584b49){if(_0x272aee){_0x272aee(null,_0x584b49);}})[_0x3682('0x25')](function(_0x156336){if(_0x272aee){_0x272aee(null,_0x156336);}});}function setChannelVariables(_0x4b1d88){for(var _0x52a128 in _0x4b1d88){if(_0x4b1d88[_0x3682('0x26')](_0x52a128)){if(_0x52a128[_0x3682('0x27')]('agi_')===0x0){_0x4b1d88[_0x52a128['substring'](0x4)]=_0x4b1d88[_0x52a128];delete _0x4b1d88[_0x52a128];}}}}function agiHandler(_0x5dfd4f){logger['debug'](_0x3682('0x28'),JSON['stringify'](_0x5dfd4f,null,0x2));logger['info'](util[_0x3682('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5dfd4f[_0x3682('0x1b')],_0x5dfd4f[_0x3682('0x1c')],_0x5dfd4f[_0x3682('0x1d')],_0x5dfd4f[_0x3682('0x1e')],_0x5dfd4f[_0x3682('0x1f')]));_0x5dfd4f['on'](_0x3682('0xe'),errorHandler);_0x5dfd4f['on'](_0x3682('0x29'),closeHandler);_0x5dfd4f['on'](_0x3682('0x2a'),timeoutHandler);_0x5dfd4f[_0x3682('0x23')]=![];_0x5dfd4f['on'](_0x3682('0x2b'),hangupHandler);var _0x2d0987=_[_0x3682('0x2c')](projects,[_0x3682('0x18'),_0x5dfd4f['arg_1']]);if(!_0x2d0987)return Project[_0x3682('0x2d')](_0x5dfd4f);if(!_0x2d0987[_0x3682('0x2e')])return Project[_0x3682('0x2f')](_0x5dfd4f);return Project['initialize'](_0x2d0987,_0x5dfd4f);}function main(){var _0x9080f0;return utilLicense[_0x3682('0x30')]()[_0x3682('0x24')](function(_0x5392fa){if(!_0x5392fa)return;if(_0x5392fa[_0x3682('0x31')]){if(_0x5392fa[_0x3682('0x32')]&&_0x5392fa['callysquare']>0x0){logger[_0x3682('0x20')](util[_0x3682('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5392fa[_0x3682('0x32')]));_0x9080f0=_0x5392fa['callysquare'];}else{logger[_0x3682('0x20')](_0x3682('0x33'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x9080f0=-0x1;}})[_0x3682('0x24')](function(){return Project[_0x3682('0x34')]();})[_0x3682('0x24')](function(_0x350528){projects=_0x350528;return;})[_0x3682('0x25')](function(_0x1130f3){logger[_0x3682('0xe')](_0x3682('0x35'),_0x1130f3[_0x3682('0x11')]);})[_0x3682('0x36')](function(){var _0x49f0ef=require(_0x3682('0x37'))(config[_0x3682('0x9')]['port'],config[_0x3682('0x9')]['ip'],_0x9080f0);_0x49f0ef['on'](_0x3682('0xe'),errorHandler);_0x49f0ef['on'](_0x3682('0x38'),listeningHandler);_0x49f0ef['on']('connection',connectionHandler);_0x49f0ef['on'](_0x3682('0x29'),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 0fdfeb1..7a18f5e 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 _0x8b8a=['catch','jayson/promise','client','http','request','then','message','result'];(function(_0x4697bc,_0x405144){var _0x514e25=function(_0x380189){while(--_0x380189){_0x4697bc['push'](_0x4697bc['shift']());}};_0x514e25(++_0x405144);}(_0x8b8a,0x1f1));var _0xa8b8=function(_0x3ac054,_0x3607d2){_0x3ac054=_0x3ac054-0x0;var _0x275fde=_0x8b8a[_0x3ac054];return _0x275fde;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa8b8('0x0'));var client=jayson[_0xa8b8('0x1')][_0xa8b8('0x2')]({'port':0x232b});function request(_0x407df8,_0x42cb84){return new BPromise(function(_0x46ca2c,_0x56e741){return client[_0xa8b8('0x3')](_0x407df8,_0x42cb84)[_0xa8b8('0x4')](function(_0x440ae8){if(_0x440ae8['error']){return _0x56e741(_0x440ae8['error'][_0xa8b8('0x5')]);}else{return _0x46ca2c(_0x440ae8[_0xa8b8('0x6')]);}})[_0xa8b8('0x7')](function(_0x4e1518){return _0x56e741(_0x4e1518);});});}exports['sendMailMessage']=function(_0x34fbd0,_0x1acd5a){return request('SendMail',{'account':_0x34fbd0,'message':_0x1acd5a});}; \ No newline at end of file +var _0xc083=['jayson/promise','client','http','request','then','error','message','result','sendMailMessage','SendMail','bluebird'];(function(_0x59831f,_0x5154ca){var _0x11f70c=function(_0x3e7adf){while(--_0x3e7adf){_0x59831f['push'](_0x59831f['shift']());}};_0x11f70c(++_0x5154ca);}(_0xc083,0x83));var _0x3c08=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc083[_0x1cc8fe];return _0x230054;};'use strict';var BPromise=require(_0x3c08('0x0'));var jayson=require(_0x3c08('0x1'));var client=jayson[_0x3c08('0x2')][_0x3c08('0x3')]({'port':0x232b});function request(_0xc1baa6,_0x5a9f40){return new BPromise(function(_0x5d2af0,_0x4cd441){return client[_0x3c08('0x4')](_0xc1baa6,_0x5a9f40)[_0x3c08('0x5')](function(_0x2f3fcf){if(_0x2f3fcf[_0x3c08('0x6')]){return _0x4cd441(_0x2f3fcf[_0x3c08('0x6')][_0x3c08('0x7')]);}else{return _0x5d2af0(_0x2f3fcf[_0x3c08('0x8')]);}})['catch'](function(_0x1d5571){return _0x4cd441(_0x1d5571);});});}exports[_0x3c08('0x9')]=function(_0x21a988,_0x57e473){return request(_0x3c08('0xa'),{'account':_0x21a988,'message':_0x57e473});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index ade4478..cb78789 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 _0x78aa=['maxRetry','addVertex','omit','mxCell','length','source','addEdge','value','toJson','mxGraphModel','production','debug','root','stringify','joinAt','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','start','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','../../config/logger','./rpc','./mailRpc','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry'];(function(_0x3d14f8,_0x4f3d1b){var _0x5a870f=function(_0x520f01){while(--_0x520f01){_0x3d14f8['push'](_0x3d14f8['shift']());}};_0x5a870f(++_0x4f3d1b);}(_0x78aa,0x9e));var _0xa78a=function(_0x562013,_0x440669){_0x562013=_0x562013-0x0;var _0x25b999=_0x78aa[_0x562013];return _0x25b999;};'use strict';var _=require(_0xa78a('0x0'));var moment=require(_0xa78a('0x1'));var parser=require(_0xa78a('0x2'));var util=require('util');var logger=require(_0xa78a('0x3'))('agi');var rpc=require(_0xa78a('0x4'));var mailRpc=require(_0xa78a('0x5'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xa78a('0x6')]()['catch'](function(_0x30bb41){logger[_0xa78a('0x7')](_0xa78a('0x8'),_0x30bb41[_0xa78a('0x9')]);return[];});}function addVertex(_0x597e61,_0x2d5c60,_0x1ecf02){_0x2d5c60[_0xa78a('0xa')]=_0x1ecf02;if(_0x2d5c60[_0xa78a('0xb')](_0xa78a('0xc'))){_0x2d5c60[_0xa78a('0xd')]=parseInt(_0x2d5c60[_0xa78a('0xc')],0xa);}_0x597e61[_0xa78a('0xe')](_[_0xa78a('0xf')](_0x2d5c60,_0xa78a('0x10')));}function initGraph(_0x39879e,_0x44ee02){var _0x311a9c=new Graph();for(var _0x54b3da in _0x39879e){if(_0x39879e[_0xa78a('0xb')](_0x54b3da)){if(_['isArray'](_0x39879e[_0x54b3da])){for(var _0x2f50fa=0x0;_0x2f50fa<_0x39879e[_0x54b3da][_0xa78a('0x11')];_0x2f50fa+=0x1){addVertex(_0x311a9c,_0x39879e[_0x54b3da][_0x2f50fa],_0x54b3da);}}else{addVertex(_0x311a9c,_0x39879e[_0x54b3da],_0x54b3da);}}}for(var _0x44af07=0x0;_0x44af07<_0x44ee02[_0xa78a('0x11')];_0x44af07+=0x1){if(_0x44ee02[_0x44af07][_0xa78a('0x12')]&&_0x44ee02[_0x44af07]['target']){_0x311a9c[_0xa78a('0x13')](_0x44ee02[_0x44af07][_0xa78a('0x12')],_0x44ee02[_0x44af07]['target'],_0x44ee02[_0x44af07][_0xa78a('0x14')]);}}return _0x311a9c;}function getRoot(_0x1fea62){return parser[_0xa78a('0x15')](_0x1fea62,{'object':!![]})[_0xa78a('0x16')]['root'];}function inspect(_0x615849){return util['inspect'](_0x615849,{'showHidden':![],'depth':null});}function initialize(_0x4b0bae,_0xbc95e7){var _0x3917ea=getRoot(_0x4b0bae[_0xa78a('0x17')]);if(!_0x3917ea||!_0x3917ea['start'])return;var _0x4c3633,_0x4638ca,_0x4079c9;logger[_0xa78a('0x18')](_0xa78a('0x19'),JSON[_0xa78a('0x1a')](_0x3917ea,null,0x2));_0xbc95e7[_0xa78a('0x1b')]=moment()[_0xa78a('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c3633=initGraph(_[_0xa78a('0xf')](_0x3917ea,'mxCell'),_0x3917ea['mxCell']);_0x4638ca=new Vertices(_0xbc95e7,rpc,mailRpc);logger[_0xa78a('0x1d')](util['format'](_0xa78a('0x1e'),_0xbc95e7[_0xa78a('0x1f')],_0xbc95e7[_0xa78a('0x20')],_0xbc95e7[_0xa78a('0x21')],_0xbc95e7[_0xa78a('0x22')],_0xbc95e7[_0xa78a('0x23')]));_0x4c3633[_0xa78a('0x24')](_0x3917ea[_0xa78a('0x25')]['id'],function(_0x4e520a){try{_0x4e520a=_0x4638ca[_0xa78a('0x26')](_0x4e520a);logger[_0xa78a('0x18')](_0xa78a('0x27'),JSON[_0xa78a('0x1a')](_0x4e520a,null,0x2));if(_0x4e520a[_0xa78a('0xa')]==='gotoc'){logger[_0xa78a('0x1d')](_0xa78a('0x28'));_0xbc95e7[_0xa78a('0x29')]=_0x4e520a[_0xa78a('0x29')]||_0xbc95e7[_0xa78a('0x29')];_0xbc95e7[_0xa78a('0x2a')]=_0x4e520a[_0xa78a('0x2a')];_0xbc95e7[_0xa78a('0x2b')]=_0x4e520a['priority']?_0x4e520a['priority']-0x1:0x1;return null;}else if(_0x4e520a&&_0x4638ca[_0x4e520a['agicommand']]){_0x4079c9=_0x4638ca[_0x4e520a['agicommand']](_0x4e520a);logger[_0xa78a('0x1d')]('response',JSON[_0xa78a('0x1a')](_0x4079c9,null,0x2));if(_0x4079c9&&_0x4079c9[_0xa78a('0x2c')]===AGI_CODE_SUCCESS&&_0x4079c9[_0xa78a('0x2d')]!==AGI_RESULT_ERROR&&!_0xbc95e7[_0xa78a('0x2e')]){logger[_0xa78a('0x18')](_0xa78a('0x2f'),inspect(_0x4079c9));return _['isUndefined'](_0x4079c9[_0xa78a('0x2d')])?null:_0x4079c9[_0xa78a('0x2d')][_0xa78a('0x30')]();}else{logger['error'](_0xa78a('0x2f'),inspect(_0x4079c9));return null;}}else{logger[_0xa78a('0x7')](_0xa78a('0x31'));return null;}}catch(_0x5b0567){logger[_0xa78a('0x7')](_0x5b0567['stack']);return null;}});if(_0x3917ea[_0xa78a('0x32')]){logger[_0xa78a('0x1d')](util[_0xa78a('0x1c')](_0xa78a('0x33'),_0xbc95e7[_0xa78a('0x1f')],_0xbc95e7[_0xa78a('0x20')],_0xbc95e7[_0xa78a('0x21')],_0xbc95e7[_0xa78a('0x22')],_0xbc95e7[_0xa78a('0x23')]));_0x4c3633[_0xa78a('0x24')](_0x3917ea[_0xa78a('0x32')]['id'],function(_0x4ea8d9){try{_0x4ea8d9=_0x4638ca[_0xa78a('0x26')](_0x4ea8d9);logger[_0xa78a('0x18')](_0xa78a('0x27'),JSON[_0xa78a('0x1a')](_0x4ea8d9,null,0x2));if(_0x4ea8d9&&_0x4638ca[_0x4ea8d9[_0xa78a('0xa')]]){_0x4079c9=_0x4638ca[_0x4ea8d9['agicommand']](_0x4ea8d9);if(_0x4079c9){logger['debug'](_0xa78a('0x2f'),inspect(_0x4079c9));return _['isUndefined'](_0x4079c9['result'])?null:_0x4079c9[_0xa78a('0x2d')]['toString']();}else{logger['error'](_0xa78a('0x2f'),inspect(_0x4079c9));return null;}}else{logger['error'](_0xa78a('0x31'));return null;}}catch(_0x5e380a){logger[_0xa78a('0x7')](_0x5e380a[_0xa78a('0x9')]);return null;}});}logger['info'](util[_0xa78a('0x1c')](_0xa78a('0x34'),_0xbc95e7[_0xa78a('0x1f')],_0xbc95e7[_0xa78a('0x20')],_0xbc95e7[_0xa78a('0x21')],_0xbc95e7[_0xa78a('0x22')],_0xbc95e7['uniqueid']));logger['info'](util[_0xa78a('0x1c')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xbc95e7[_0xa78a('0x29')],_0xbc95e7[_0xa78a('0x2a')],parseInt(_0xbc95e7['priority'],0xa)+0x1));_0xbc95e7['continueAt'](_0xbc95e7[_0xa78a('0x29')],_0xbc95e7['extension'],parseInt(_0xbc95e7[_0xa78a('0x2b')],0xa)+0x1);_0xbc95e7[_0xa78a('0x35')]();}function handleNotFound(_0x1abf88){logger[_0xa78a('0x7')](util[_0xa78a('0x1c')]('Project\x20%s\x20not\x20found',_0x1abf88[_0xa78a('0x1f')]));_0x1abf88[_0xa78a('0x36')](_0x1abf88[_0xa78a('0x29')],_0x1abf88[_0xa78a('0x2a')],parseInt(_0x1abf88[_0xa78a('0x2b')],0xa)+0x1);_0x1abf88['close']();}function handleUnpublished(_0x141c46){logger[_0xa78a('0x7')](util[_0xa78a('0x1c')](_0xa78a('0x37'),_0x141c46[_0xa78a('0x1f')]));_0x141c46[_0xa78a('0x36')](_0x141c46['context'],_0x141c46[_0xa78a('0x2a')],parseInt(_0x141c46[_0xa78a('0x2b')],0xa)+0x1);_0x141c46['close']();}module[_0xa78a('0x38')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xb359=['vertex','toString','agicommand\x20not\x20found','[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','Project\x20%s\x20not\x20found','continueAt','close','Project\x20%s\x20not\x20published','lodash','moment','xml2json','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','mxCell','length','addEdge','source','toJson','mxGraphModel','root','production','start','debug','stringify','joinAt','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','uniqueid','traverseBFS','clear','context','extension','priority','response','code','result','evtHangup','isUndefined','finally','info','dnid'];(function(_0x1f812,_0x455a7b){var _0x1f6547=function(_0x4c95b4){while(--_0x4c95b4){_0x1f812['push'](_0x1f812['shift']());}};_0x1f6547(++_0x455a7b);}(_0xb359,0xb1));var _0x9b35=function(_0x149f48,_0x534714){_0x149f48=_0x149f48-0x0;var _0x3577d9=_0xb359[_0x149f48];return _0x3577d9;};'use strict';var _=require(_0x9b35('0x0'));var moment=require(_0x9b35('0x1'));var parser=require(_0x9b35('0x2'));var util=require('util');var logger=require('../../config/logger')(_0x9b35('0x3'));var rpc=require(_0x9b35('0x4'));var mailRpc=require(_0x9b35('0x5'));var Graph=require(_0x9b35('0x6'));var Vertices=require(_0x9b35('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x9b35('0x8')](function(_0xd763ad){logger[_0x9b35('0x9')](_0x9b35('0xa'),_0xd763ad[_0x9b35('0xb')]);return[];});}function addVertex(_0x94d9c4,_0x9c8b9d,_0x2a7bba){_0x9c8b9d[_0x9b35('0xc')]=_0x2a7bba;if(_0x9c8b9d[_0x9b35('0xd')](_0x9b35('0xe'))){_0x9c8b9d['maxRetry']=parseInt(_0x9c8b9d[_0x9b35('0xe')],0xa);}_0x94d9c4['addVertex'](_[_0x9b35('0xf')](_0x9c8b9d,_0x9b35('0x10')));}function initGraph(_0x1053f7,_0x24dc51){var _0x60ecb9=new Graph();for(var _0x5036b8 in _0x1053f7){if(_0x1053f7[_0x9b35('0xd')](_0x5036b8)){if(_['isArray'](_0x1053f7[_0x5036b8])){for(var _0x485845=0x0;_0x485845<_0x1053f7[_0x5036b8][_0x9b35('0x11')];_0x485845+=0x1){addVertex(_0x60ecb9,_0x1053f7[_0x5036b8][_0x485845],_0x5036b8);}}else{addVertex(_0x60ecb9,_0x1053f7[_0x5036b8],_0x5036b8);}}}for(var _0x5d1738=0x0;_0x5d1738<_0x24dc51[_0x9b35('0x11')];_0x5d1738+=0x1){if(_0x24dc51[_0x5d1738]['source']&&_0x24dc51[_0x5d1738]['target']){_0x60ecb9[_0x9b35('0x12')](_0x24dc51[_0x5d1738][_0x9b35('0x13')],_0x24dc51[_0x5d1738]['target'],_0x24dc51[_0x5d1738]['value']);}}return _0x60ecb9;}function getRoot(_0x37cfd9){return parser[_0x9b35('0x14')](_0x37cfd9,{'object':!![]})[_0x9b35('0x15')][_0x9b35('0x16')];}function inspect(_0x13d9b8){return util['inspect'](_0x13d9b8,{'showHidden':![],'depth':null});}function initialize(_0x4a1190,_0x1320b3){var _0x19250c=getRoot(_0x4a1190[_0x9b35('0x17')]);if(!_0x19250c||!_0x19250c[_0x9b35('0x18')])return;var _0x58ac89,_0x4c6e4c,_0x4f925a;logger[_0x9b35('0x19')](_0x9b35('0x16'),JSON[_0x9b35('0x1a')](_0x19250c,null,0x2));_0x1320b3[_0x9b35('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58ac89=initGraph(_[_0x9b35('0xf')](_0x19250c,'mxCell'),_0x19250c[_0x9b35('0x10')]);_0x4c6e4c=new Vertices(_0x1320b3,rpc,mailRpc);logger['info'](util[_0x9b35('0x1c')](_0x9b35('0x1d'),_0x1320b3[_0x9b35('0x1e')],_0x1320b3[_0x9b35('0x1f')],_0x1320b3[_0x9b35('0x20')],_0x1320b3['dnid'],_0x1320b3[_0x9b35('0x21')]));_0x58ac89[_0x9b35('0x22')](_0x19250c[_0x9b35('0x18')]['id'],function(_0x72d841){try{_0x72d841=_0x4c6e4c[_0x9b35('0x23')](_0x72d841);logger[_0x9b35('0x19')]('vertex',JSON['stringify'](_0x72d841,null,0x2));if(_0x72d841[_0x9b35('0xc')]==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1320b3[_0x9b35('0x24')]=_0x72d841[_0x9b35('0x24')]||_0x1320b3['context'];_0x1320b3[_0x9b35('0x25')]=_0x72d841[_0x9b35('0x25')];_0x1320b3['priority']=_0x72d841[_0x9b35('0x26')]?_0x72d841[_0x9b35('0x26')]-0x1:0x1;return null;}else if(_0x72d841&&_0x4c6e4c[_0x72d841[_0x9b35('0xc')]]){_0x4f925a=_0x4c6e4c[_0x72d841[_0x9b35('0xc')]](_0x72d841);logger['info'](_0x9b35('0x27'),JSON[_0x9b35('0x1a')](_0x4f925a,null,0x2));if(_0x4f925a&&_0x4f925a[_0x9b35('0x28')]===AGI_CODE_SUCCESS&&_0x4f925a[_0x9b35('0x29')]!==AGI_RESULT_ERROR&&!_0x1320b3[_0x9b35('0x2a')]){logger['debug'](_0x9b35('0x27'),inspect(_0x4f925a));return _[_0x9b35('0x2b')](_0x4f925a[_0x9b35('0x29')])?null:_0x4f925a[_0x9b35('0x29')]['toString']();}else{logger[_0x9b35('0x9')](_0x9b35('0x27'),inspect(_0x4f925a));return null;}}else{logger[_0x9b35('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x5d04c9){logger[_0x9b35('0x9')](_0x5d04c9['stack']);return null;}});if(_0x19250c[_0x9b35('0x2c')]){logger[_0x9b35('0x2d')](util[_0x9b35('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1320b3[_0x9b35('0x1e')],_0x1320b3[_0x9b35('0x1f')],_0x1320b3[_0x9b35('0x20')],_0x1320b3[_0x9b35('0x2e')],_0x1320b3[_0x9b35('0x21')]));_0x58ac89[_0x9b35('0x22')](_0x19250c[_0x9b35('0x2c')]['id'],function(_0x1b7f5f){try{_0x1b7f5f=_0x4c6e4c[_0x9b35('0x23')](_0x1b7f5f);logger[_0x9b35('0x19')](_0x9b35('0x2f'),JSON[_0x9b35('0x1a')](_0x1b7f5f,null,0x2));if(_0x1b7f5f&&_0x4c6e4c[_0x1b7f5f[_0x9b35('0xc')]]){_0x4f925a=_0x4c6e4c[_0x1b7f5f[_0x9b35('0xc')]](_0x1b7f5f);if(_0x4f925a){logger[_0x9b35('0x19')]('response',inspect(_0x4f925a));return _['isUndefined'](_0x4f925a[_0x9b35('0x29')])?null:_0x4f925a[_0x9b35('0x29')][_0x9b35('0x30')]();}else{logger[_0x9b35('0x9')](_0x9b35('0x27'),inspect(_0x4f925a));return null;}}else{logger[_0x9b35('0x9')](_0x9b35('0x31'));return null;}}catch(_0x465175){logger[_0x9b35('0x9')](_0x465175[_0x9b35('0xb')]);return null;}});}logger[_0x9b35('0x2d')](util[_0x9b35('0x1c')](_0x9b35('0x32'),_0x1320b3[_0x9b35('0x1e')],_0x1320b3[_0x9b35('0x1f')],_0x1320b3['callerid'],_0x1320b3[_0x9b35('0x2e')],_0x1320b3[_0x9b35('0x21')]));logger[_0x9b35('0x2d')](util['format'](_0x9b35('0x33'),_0x1320b3[_0x9b35('0x24')],_0x1320b3[_0x9b35('0x25')],parseInt(_0x1320b3[_0x9b35('0x26')],0xa)+0x1));_0x1320b3['continueAt'](_0x1320b3[_0x9b35('0x24')],_0x1320b3[_0x9b35('0x25')],parseInt(_0x1320b3['priority'],0xa)+0x1);_0x1320b3['close']();}function handleNotFound(_0x4ebccd){logger['error'](util[_0x9b35('0x1c')](_0x9b35('0x34'),_0x4ebccd[_0x9b35('0x1e')]));_0x4ebccd[_0x9b35('0x35')](_0x4ebccd[_0x9b35('0x24')],_0x4ebccd[_0x9b35('0x25')],parseInt(_0x4ebccd['priority'],0xa)+0x1);_0x4ebccd[_0x9b35('0x36')]();}function handleUnpublished(_0x25a237){logger[_0x9b35('0x9')](util['format'](_0x9b35('0x37'),_0x25a237['arg_1']));_0x25a237[_0x9b35('0x35')](_0x25a237['context'],_0x25a237[_0x9b35('0x25')],parseInt(_0x25a237[_0x9b35('0x26')],0xa)+0x1);_0x25a237[_0x9b35('0x36')]();}module['exports']={'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 17d74de..f02dffd 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 _0x1b1d=['trim','emit','line','exports','util','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','toString','substring','length','indexOf','slice'];(function(_0x5a42f3,_0x17b7db){var _0x1085fa=function(_0x169725){while(--_0x169725){_0x5a42f3['push'](_0x5a42f3['shift']());}};_0x1085fa(++_0x17b7db);}(_0x1b1d,0x19c));var _0xd1b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b1d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xd1b1('0x0'));var Transform=require(_0xd1b1('0x1'))[_0xd1b1('0x2')];function AGIReply(_0x6ed995){Transform['call'](this,_0x6ed995);this[_0xd1b1('0x3')]='';this[_0xd1b1('0x4')]=![];}util[_0xd1b1('0x5')](AGIReply,Transform);AGIReply[_0xd1b1('0x6')][_0xd1b1('0x7')]=function(_0x246c9c,_0x546d7e,_0x13eef2){var _0x34e530='\x0a',_0x1d2465=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x4ed4d2=-0x1,_0x52f3b9=-0x1,_0x4e4760='',_0x208314=0x0,_0x4c6810='',_0x4121a1='';this[_0xd1b1('0x3')]+=_0x246c9c[_0xd1b1('0x8')]();_0x4c6810=this['_localBuffer'];if(!this[_0xd1b1('0x4')]){_0x208314=0x0;while(_0x1d2465[_0x208314]){while((_0x52f3b9=_0x4c6810['indexOf'](_0x1d2465[_0x208314]))!=-0x1){_0x4e4760=_0x1d2465[_0x208314];_0x4121a1=_0x4c6810[_0xd1b1('0x9')](0x0,_0x52f3b9);_0x4c6810=_0x4c6810['substring'](_0x52f3b9+_0x4e4760[_0xd1b1('0xa')]);var _0x38f8c8=_0x4121a1['split'](_0x34e530),_0x138751=0x0,_0x488af8={},_0x27933d='',_0x462ac8='',_0x4b90a8=-0x1;while(_0x38f8c8[_0x138751]){_0x4b90a8=_0x38f8c8[_0x138751][_0xd1b1('0xb')](':');if(_0x4b90a8!=-0x1){_0x27933d=_0x38f8c8[_0x138751][_0xd1b1('0xc')](0x0,_0x4b90a8)['trim']();_0x462ac8=_0x38f8c8[_0x138751][_0xd1b1('0xc')](_0x4b90a8+0x1)[_0xd1b1('0xd')]();if(_0x27933d[_0xd1b1('0xa')]>0x0){_0x488af8[_0x27933d]=_0x462ac8;}}else{}_0x138751++;}this[_0xd1b1('0xe')]('headers',_0x488af8);this[_0xd1b1('0x4')]=!![];}_0x208314++;}this[_0xd1b1('0x3')]=_0x4c6810;}else{while((_0x4ed4d2=_0x4c6810[_0xd1b1('0xb')](_0x34e530))!=-0x1){_0x4121a1=_0x4c6810[_0xd1b1('0x9')](0x0,_0x4ed4d2);this[_0xd1b1('0xe')](_0xd1b1('0xf'),_0x4121a1);_0x4c6810=_0x4c6810[_0xd1b1('0x9')](_0x4ed4d2+_0x34e530[_0xd1b1('0xa')]);}this[_0xd1b1('0x3')]=_0x4c6810;}_0x13eef2();};module[_0xd1b1('0x10')]=AGIReply; \ No newline at end of file +var _0x04f1=['_inBody','line','exports','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','indexOf','substring','slice','trim','length','emit','headers'];(function(_0x3f4fb5,_0x238e15){var _0x20bc31=function(_0x557221){while(--_0x557221){_0x3f4fb5['push'](_0x3f4fb5['shift']());}};_0x20bc31(++_0x238e15);}(_0x04f1,0xc1));var _0x104f=function(_0x39e7e7,_0x39694f){_0x39e7e7=_0x39e7e7-0x0;var _0x568aa0=_0x04f1[_0x39e7e7];return _0x568aa0;};'use strict';var util=require(_0x104f('0x0'));var Transform=require(_0x104f('0x1'))[_0x104f('0x2')];function AGIReply(_0xc5a5f4){Transform[_0x104f('0x3')](this,_0xc5a5f4);this[_0x104f('0x4')]='';this['_inBody']=![];}util[_0x104f('0x5')](AGIReply,Transform);AGIReply[_0x104f('0x6')][_0x104f('0x7')]=function(_0x36508b,_0x54c6a5,_0x347f10){var _0x51cffa='\x0a',_0x10a9ed=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xa6dd14=-0x1,_0x235367=-0x1,_0x117bd1='',_0x2097da=0x0,_0x3235a9='',_0x5fb224='';this['_localBuffer']+=_0x36508b[_0x104f('0x8')]();_0x3235a9=this[_0x104f('0x4')];if(!this['_inBody']){_0x2097da=0x0;while(_0x10a9ed[_0x2097da]){while((_0x235367=_0x3235a9[_0x104f('0x9')](_0x10a9ed[_0x2097da]))!=-0x1){_0x117bd1=_0x10a9ed[_0x2097da];_0x5fb224=_0x3235a9[_0x104f('0xa')](0x0,_0x235367);_0x3235a9=_0x3235a9[_0x104f('0xa')](_0x235367+_0x117bd1['length']);var _0x1e505b=_0x5fb224['split'](_0x51cffa),_0x381e6d=0x0,_0x350b79={},_0x53d126='',_0x5de83f='',_0x3d7255=-0x1;while(_0x1e505b[_0x381e6d]){_0x3d7255=_0x1e505b[_0x381e6d]['indexOf'](':');if(_0x3d7255!=-0x1){_0x53d126=_0x1e505b[_0x381e6d][_0x104f('0xb')](0x0,_0x3d7255)[_0x104f('0xc')]();_0x5de83f=_0x1e505b[_0x381e6d][_0x104f('0xb')](_0x3d7255+0x1)['trim']();if(_0x53d126[_0x104f('0xd')]>0x0){_0x350b79[_0x53d126]=_0x5de83f;}}else{}_0x381e6d++;}this[_0x104f('0xe')](_0x104f('0xf'),_0x350b79);this[_0x104f('0x10')]=!![];}_0x2097da++;}this['_localBuffer']=_0x3235a9;}else{while((_0xa6dd14=_0x3235a9[_0x104f('0x9')](_0x51cffa))!=-0x1){_0x5fb224=_0x3235a9[_0x104f('0xa')](0x0,_0xa6dd14);this[_0x104f('0xe')](_0x104f('0x11'),_0x5fb224);_0x3235a9=_0x3235a9[_0x104f('0xa')](_0xa6dd14+_0x51cffa[_0x104f('0xd')]);}this[_0x104f('0x4')]=_0x3235a9;}_0x347f10();};module[_0x104f('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 449009e..521481e 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 _0x4abf=['CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','client','error','message','catch','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4abf,0xac));var _0xf4ab=function(_0x4580b0,_0x1f3173){_0x4580b0=_0x4580b0-0x0;var _0x5464f6=_0x4abf[_0x4580b0];return _0x5464f6;};'use strict';var _=require(_0xf4ab('0x0'));var moment=require(_0xf4ab('0x1'));var jayson=require('jayson/promise');var client=jayson[_0xf4ab('0x2')]['http']({'port':0x2329});function request(_0x486ba3,_0x505988){return new Promise(function(_0xd3da82,_0x4599f6){return client['request'](_0x486ba3,_0x505988)['then'](function(_0x1f141a){if(_0x1f141a[_0xf4ab('0x3')]){return _0x4599f6(_0x1f141a[_0xf4ab('0x3')][_0xf4ab('0x4')]);}else{return _0xd3da82(_0x1f141a['result']);}})[_0xf4ab('0x5')](function(_0x3c7b8b){return _0x4599f6(_0x3c7b8b);});});}exports['getSquareProjects']=function(){return request(_0xf4ab('0x6'),{'options':{'raw':![],'attributes':['id','name',_0xf4ab('0x7')]}});};exports[_0xf4ab('0x8')]=function(_0x17a9a3){return request(_0xf4ab('0x9'),{'options':{'raw':![],'where':{'name':_0x17a9a3},'attributes':[_0xf4ab('0x7')]}});};exports[_0xf4ab('0xa')]=function(_0x4516bf){return request(_0xf4ab('0xb'),{'options':{'raw':![],'where':{'id':_0x4516bf},'include':[{'model':_0xf4ab('0xc'),'as':_0xf4ab('0xd'),'include':[{'model':_0xf4ab('0xe'),'as':_0xf4ab('0xe')}]}],'attributes':['id',_0xf4ab('0xf'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x17181a){return request(_0xf4ab('0x9'),{'options':{'where':{'id':_0x17181a},'attributes':[_0xf4ab('0xf')]}});};exports[_0xf4ab('0x10')]=function(_0x141d64){return request(_0xf4ab('0x11'),{'options':{'where':{'id':_0x141d64},'attributes':[_0xf4ab('0xf')]}});};exports[_0xf4ab('0x12')]=function(_0x47abb8){return request(_0xf4ab('0x13'),{'options':{'where':{'id':_0x47abb8},'attributes':[_0xf4ab('0xf')]}});};exports[_0xf4ab('0x14')]=function(_0x5d50cb){return request(_0xf4ab('0x15'),{'options':{'where':{'id':_0x5d50cb},'attributes':[_0xf4ab('0x16')]}});};exports['getUserById']=function(_0x196ea7){return request(_0xf4ab('0x17'),{'options':{'where':{'id':_0x196ea7},'attributes':[_0xf4ab('0xf')]}});};exports[_0xf4ab('0x18')]=function(_0x2d0d4d){return request(_0xf4ab('0x19'),{'options':{'where':{'phone':_0x2d0d4d[_0xf4ab('0x1a')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x4d8753){return request(_0xf4ab('0x1b'),{'options':{'where':{'id':_0x4d8753},'attributes':['name']}});};exports[_0xf4ab('0x1c')]=function(_0x1727af){return request(_0xf4ab('0x1d'),{'options':{'where':{'id':_0x1727af},'attributes':['save_name']}});};exports[_0xf4ab('0x1e')]=function(_0x2fb02d){return request(_0xf4ab('0x1f'),{'options':{'raw':![],'where':{'id':_0x2fb02d},'include':[{'model':_0xf4ab('0x20'),'as':_0xf4ab('0x21')}]}});};exports['getSmsAccountById']=function(_0xf1998f){return request(_0xf4ab('0x22'),{'options':{'where':{'id':_0xf1998f},'attributes':['id',_0xf4ab('0xf')]}});};exports[_0xf4ab('0x23')]=function(_0x152d48){return request(_0xf4ab('0x24'),{'body':_0x152d48});};exports[_0xf4ab('0x25')]=function(_0x5e4442){return request(_0xf4ab('0x26'),{'body':_0x5e4442});};exports['createSquareReport']=function(_0x1fc4b2){return request('CreateSquareReport',{'body':_['merge'](_0x1fc4b2,{'project_name':_0x1fc4b2['arg_1'],'prev_project_name':_0x1fc4b2['arg_2']||'','is_subproject':_0x1fc4b2['arg_2']?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xf4ab('0x27')]=function(_0x9863d1){return request(_0xf4ab('0x28'),{'body':_0x9863d1});};exports[_0xf4ab('0x29')]=function(_0x1efb48){return request('CreateSquareMessage',{'body':_0x1efb48});};exports['createCmContact']=function(_0x325b38){return request(_0xf4ab('0x2a'),{'options':{'raw':![],'where':{'phone':_0x325b38['phone'],'ListId':_0x325b38[_0xf4ab('0x2b')]}}})['then'](function(_0x20482c){if(_0x20482c){return _0x20482c;}return request(_0xf4ab('0x2c'),{'body':_0x325b38});});};exports[_0xf4ab('0x2d')]=function(_0x3d195b){return request(_0xf4ab('0x2e'),{'options':{'where':{'id':_0x3d195b},'attributes':[_0xf4ab('0xf')]}});};exports[_0xf4ab('0x2f')]=function(_0x25d68f,_0x3e49f2){return request(_0xf4ab('0x30'),{'body':{'interface':_0x3e49f2},'options':{'where':_0x25d68f}});};exports[_0xf4ab('0x31')]=function(_0x495612,_0x392417,_0x57a2f5){return request(_0xf4ab('0x32'),{'body':{'type':_0x392417,'uniqueid':_0x57a2f5},'options':{'where':_0x495612}});};exports[_0xf4ab('0x33')]=function(_0x4cad6b){return request('UnpauseUser',{'body':{},'options':{'where':_0x4cad6b}});};exports[_0xf4ab('0x34')]=function(_0x3e1bb5){return request(_0xf4ab('0x35'),{'body':{},'options':{'where':_0x3e1bb5}});}; \ No newline at end of file +var _0x47d6=['CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x47d6,0x1de));var _0x647d=function(_0x61a175,_0x410e43){_0x61a175=_0x61a175-0x0;var _0x1b066b=_0x47d6[_0x61a175];return _0x1b066b;};'use strict';var _=require(_0x647d('0x0'));var moment=require(_0x647d('0x1'));var jayson=require(_0x647d('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x3cd782,_0x1517be){return new Promise(function(_0x3c145f,_0x583a19){return client[_0x647d('0x3')](_0x3cd782,_0x1517be)[_0x647d('0x4')](function(_0x302936){if(_0x302936['error']){return _0x583a19(_0x302936[_0x647d('0x5')][_0x647d('0x6')]);}else{return _0x3c145f(_0x302936[_0x647d('0x7')]);}})[_0x647d('0x8')](function(_0x2a9508){return _0x583a19(_0x2a9508);});});}exports[_0x647d('0x9')]=function(){return request(_0x647d('0xa'),{'options':{'raw':![],'attributes':['id',_0x647d('0xb'),_0x647d('0xc')]}});};exports[_0x647d('0xd')]=function(_0x32bb36){return request(_0x647d('0xe'),{'options':{'raw':![],'where':{'name':_0x32bb36},'attributes':['production']}});};exports[_0x647d('0xf')]=function(_0x21aded){return request(_0x647d('0x10'),{'options':{'raw':![],'where':{'id':_0x21aded},'include':[{'model':_0x647d('0x11'),'as':_0x647d('0x12'),'include':[{'model':_0x647d('0x13'),'as':_0x647d('0x13')}]}],'attributes':['id',_0x647d('0xb'),_0x647d('0x14')],'smtp':!![]}});};exports[_0x647d('0x15')]=function(_0x328d38){return request(_0x647d('0xe'),{'options':{'where':{'id':_0x328d38},'attributes':[_0x647d('0xb')]}});};exports['getVoiceQueueById']=function(_0x18ef9e){return request(_0x647d('0x16'),{'options':{'where':{'id':_0x18ef9e},'attributes':[_0x647d('0xb')]}});};exports['getVariableById']=function(_0x25fa4a){return request('ShowVariable',{'options':{'where':{'id':_0x25fa4a},'attributes':[_0x647d('0xb')]}});};exports['getSquareOdbcById']=function(_0xb14b1e){return request(_0x647d('0x17'),{'options':{'where':{'id':_0xb14b1e},'attributes':['dsn']}});};exports[_0x647d('0x18')]=function(_0x539fe4){return request(_0x647d('0x19'),{'options':{'where':{'id':_0x539fe4},'attributes':[_0x647d('0xb')]}});};exports[_0x647d('0x1a')]=function(_0x407788){return request(_0x647d('0x1b'),{'options':{'where':{'phone':_0x407788[_0x647d('0x1c')]},'attributes':['id']}});};exports[_0x647d('0x1d')]=function(_0x29168d){return request(_0x647d('0x1e'),{'options':{'where':{'id':_0x29168d},'attributes':[_0x647d('0xb')]}});};exports[_0x647d('0x1f')]=function(_0x2fe974){return request(_0x647d('0x20'),{'options':{'where':{'id':_0x2fe974},'attributes':[_0x647d('0x21')]}});};exports[_0x647d('0x22')]=function(_0x40484c){return request(_0x647d('0x23'),{'options':{'raw':![],'where':{'id':_0x40484c},'include':[{'model':_0x647d('0x24'),'as':_0x647d('0x25')}]}});};exports['getSmsAccountById']=function(_0x417a03){return request(_0x647d('0x26'),{'options':{'where':{'id':_0x417a03},'attributes':['id','name']}});};exports[_0x647d('0x27')]=function(_0x3d8e69){return request(_0x647d('0x28'),{'body':_0x3d8e69});};exports[_0x647d('0x29')]=function(_0x5019c2){return request(_0x647d('0x2a'),{'body':_0x5019c2});};exports[_0x647d('0x2b')]=function(_0xe87980){return request(_0x647d('0x2c'),{'body':_[_0x647d('0x2d')](_0xe87980,{'project_name':_0xe87980['arg_1'],'prev_project_name':_0xe87980[_0x647d('0x2e')]||'','is_subproject':_0xe87980[_0x647d('0x2e')]?!![]:![],'leaveAt':moment()[_0x647d('0x2f')](_0x647d('0x30'))})});};exports[_0x647d('0x31')]=function(_0xee7626){return request(_0x647d('0x32'),{'body':_0xee7626});};exports[_0x647d('0x33')]=function(_0x5f18d7){return request('CreateSquareMessage',{'body':_0x5f18d7});};exports[_0x647d('0x34')]=function(_0x20d08d){return request(_0x647d('0x35'),{'options':{'raw':![],'where':{'phone':_0x20d08d[_0x647d('0x1c')],'ListId':_0x20d08d[_0x647d('0x36')]}}})[_0x647d('0x4')](function(_0x344fb5){if(_0x344fb5){return _0x344fb5;}return request(_0x647d('0x37'),{'body':_0x20d08d});});};exports[_0x647d('0x38')]=function(_0xe3983e){return request(_0x647d('0x39'),{'options':{'where':{'id':_0xe3983e},'attributes':[_0x647d('0xb')]}});};exports[_0x647d('0x3a')]=function(_0x135932,_0x2945f4){return request(_0x647d('0x3b'),{'body':{'interface':_0x2945f4},'options':{'where':_0x135932}});};exports['agentPause']=function(_0x16e563,_0x2197b6,_0x3ae6d2){return request(_0x647d('0x3c'),{'body':{'type':_0x2197b6,'uniqueid':_0x3ae6d2},'options':{'where':_0x16e563}});};exports[_0x647d('0x3d')]=function(_0x16387a){return request(_0x647d('0x3e'),{'body':{},'options':{'where':_0x16387a}});};exports[_0x647d('0x3f')]=function(_0x4a33b8){return request(_0x647d('0x40'),{'body':{},'options':{'where':_0x4a33b8}});}; \ 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 8463c01..a1e29f9 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 _0x39e6=['./polly','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39e6,0x9e));var _0x639e=function(_0x5c97c1,_0x682ad4){_0x5c97c1=_0x5c97c1-0x0;var _0x4b4f51=_0x39e6[_0x5c97c1];return _0x4b4f51;};var polly=require(_0x639e('0x0'));var lex=require('./lex');module[_0x639e('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x03db=['./polly','./lex','exports'];(function(_0x1d745e,_0x144daf){var _0x259f61=function(_0x3f5bd7){while(--_0x3f5bd7){_0x1d745e['push'](_0x1d745e['shift']());}};_0x259f61(++_0x144daf);}(_0x03db,0x156));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};var polly=require(_0xb03d('0x0'));var lex=require(_0xb03d('0x1'));module[_0xb03d('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 22515b4..b925ad5 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb){return lex(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f){return lex(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f);}; \ 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 4e82fd8..0c8c13e 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(_0x15a4cf,_0x50a55a){var _0x465668=function(_0x11d002){while(--_0x11d002){_0x15a4cf['push'](_0x15a4cf['shift']());}};_0x465668(++_0x50a55a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x6a41d1,_0x402efe){var _0x468262=function(_0x6d0ed8){while(--_0x6d0ed8){_0x6a41d1['push'](_0x6a41d1['shift']());}};_0x468262(++_0x402efe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 94cb6a8..0f565b5 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 _0x9130=['./lib/api'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x9130,0xef));var _0x0913=function(_0x515b35,_0x49fdd1){_0x515b35=_0x515b35-0x0;var _0x228874=_0x9130[_0x515b35];return _0x228874;};'use strict';var polly=require(_0x0913('0x0'));module['exports']=function(_0x278f1e,_0x5be011,_0x214873,_0x40aef7,_0x5aafb7,_0xa7ae0f,_0x37469b){return polly(_0x278f1e,_0x5be011,_0x214873,_0x40aef7,_0x5aafb7,_0xa7ae0f,_0x37469b);}; \ No newline at end of file +var _0x0184=['exports','./lib/api'];(function(_0x5e5c6f,_0x29fc48){var _0x1ecf46=function(_0x14bf3b){while(--_0x14bf3b){_0x5e5c6f['push'](_0x5e5c6f['shift']());}};_0x1ecf46(++_0x29fc48);}(_0x0184,0x103));var _0x4018=function(_0x3af955,_0x21431c){_0x3af955=_0x3af955-0x0;var _0x167de5=_0x0184[_0x3af955];return _0x167de5;};'use strict';var polly=require(_0x4018('0x0'));module[_0x4018('0x1')]=function(_0x3bd14,_0x1a7e31,_0x1f4740,_0x5bf14d,_0x461c5b,_0x53a831,_0xc02f49){return polly(_0x3bd14,_0x1a7e31,_0x1f4740,_0x5bf14d,_0x461c5b,_0x53a831,_0xc02f49);}; \ 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 3bf3455..d2e45e6 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 _0x9af6=['bluebird','aws-sdk','synthesizeSpeech','writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path'];(function(_0x16ea0e,_0x2e3a5e){var _0x211292=function(_0x1683dd){while(--_0x1683dd){_0x16ea0e['push'](_0x16ea0e['shift']());}};_0x211292(++_0x2e3a5e);}(_0x9af6,0x18b));var _0x69af=function(_0x457681,_0x263f93){_0x457681=_0x457681-0x0;var _0x5b955a=_0x9af6[_0x457681];return _0x5b955a;};'use strict';var fs=require('fs');var path=require(_0x69af('0x0'));var BPromise=require(_0x69af('0x1'));var rs=require('randomstring');var AWS=require(_0x69af('0x2'));function pollyResult(_0x17574e,_0x5eb311,_0x1489cd){return new BPromise(function(_0x5766f7,_0x2602d1){_0x17574e[_0x69af('0x3')](_0x5eb311,function(_0x413157,_0x3b782a){if(_0x413157){_0x2602d1(_0x413157);}else if(_0x3b782a){if(_0x3b782a['AudioStream']instanceof Buffer){fs[_0x69af('0x4')](_0x1489cd,_0x3b782a[_0x69af('0x5')],function(_0x50366b){if(_0x50366b){_0x2602d1(_0x50366b);}else{_0x5766f7();}});}else{_0x2602d1(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2602d1(new Error(_0x69af('0x6')));}});});}module[_0x69af('0x7')]=function(_0x2a4a5f,_0x460d2d,_0x31ac83,_0x5bbc83,_0x4f7c62,_0x1e3ad5,_0x414e4e){var _0x49db91=new AWS[(_0x69af('0x8'))]({'accessKeyId':_0x2a4a5f,'secretAccessKey':_0x460d2d,'region':_0x31ac83});var _0x45b245={'Text':_0x4f7c62,'TextType':_0x1e3ad5||_0x69af('0x9'),'OutputFormat':_0x69af('0xa'),'VoiceId':_0x5bbc83};return pollyResult(_0x49db91,_0x45b245,_0x414e4e);}; \ No newline at end of file +var _0xba39=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','mp3','bluebird'];(function(_0x32806e,_0x84d48f){var _0x564c55=function(_0xf5cd34){while(--_0xf5cd34){_0x32806e['push'](_0x32806e['shift']());}};_0x564c55(++_0x84d48f);}(_0xba39,0x110));var _0x9ba3=function(_0x4b63fb,_0x27beba){_0x4b63fb=_0x4b63fb-0x0;var _0x1e4b79=_0xba39[_0x4b63fb];return _0x1e4b79;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9ba3('0x0'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x501ad5,_0x2362d0,_0xd27e80){return new BPromise(function(_0x170cce,_0x24438e){_0x501ad5[_0x9ba3('0x1')](_0x2362d0,function(_0x5e8ed3,_0x4ae216){if(_0x5e8ed3){_0x24438e(_0x5e8ed3);}else if(_0x4ae216){if(_0x4ae216[_0x9ba3('0x2')]instanceof Buffer){fs[_0x9ba3('0x3')](_0xd27e80,_0x4ae216['AudioStream'],function(_0x595c2b){if(_0x595c2b){_0x24438e(_0x595c2b);}else{_0x170cce();}});}else{_0x24438e(new Error(_0x9ba3('0x4')));}}else{_0x24438e(new Error(_0x9ba3('0x5')));}});});}module['exports']=function(_0x27bd99,_0x8228f5,_0x11bc53,_0x36db47,_0xae386a,_0x30a8c4,_0x13ae90){var _0xda1093=new AWS['Polly']({'accessKeyId':_0x27bd99,'secretAccessKey':_0x8228f5,'region':_0x11bc53});var _0xf0ac4b={'Text':_0xae386a,'TextType':_0x30a8c4||'text','OutputFormat':_0x9ba3('0x6'),'VoiceId':_0x36db47};return pollyResult(_0xda1093,_0xf0ac4b,_0x13ae90);}; \ 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 6dad708..1ac5ccb 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 _0xe154=['./lib/api'];(function(_0x73e4cf,_0x2a8375){var _0x1e1bf8=function(_0xca0967){while(--_0xca0967){_0x73e4cf['push'](_0x73e4cf['shift']());}};_0x1e1bf8(++_0x2a8375);}(_0xe154,0x8d));var _0x4e15=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0xe154[_0x47623f];return _0x282ce8;};'use strict';var asr=require(_0x4e15('0x0'));module['exports']=function(_0x14fa29,_0x592805,_0x1b5761,_0x3a2d5f){return asr(_0x14fa29,_0x592805,_0x1b5761);}; \ No newline at end of file +var _0xf5c6=['./lib/api','exports'];(function(_0x55c7a3,_0x32621e){var _0x582832=function(_0x6adceb){while(--_0x6adceb){_0x55c7a3['push'](_0x55c7a3['shift']());}};_0x582832(++_0x32621e);}(_0xf5c6,0x172));var _0x6f5c=function(_0x4337d2,_0x189a48){_0x4337d2=_0x4337d2-0x0;var _0xe7b989=_0xf5c6[_0x4337d2];return _0xe7b989;};'use strict';var asr=require(_0x6f5c('0x0'));module[_0x6f5c('0x1')]=function(_0x2f5259,_0x459627,_0x1e188b,_0x6cdd67){return asr(_0x2f5259,_0x459627,_0x1e188b);}; \ 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 7d569e6..84d489a 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 _0x851e=['key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string','string'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0x851e,0x1e8));var _0xe851=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0x851e[_0x5f42f1];return _0x5534ee;};'use strict';var url=require(_0xe851('0x0'));var BPromise=require(_0xe851('0x1'));var fs=require('fs');var host=_0xe851('0x2');module['exports']=function(_0x506932,_0x122708,_0x11f06b){return new BPromise(function(_0x16b38a,_0x326b34){var _0xe50306;if(typeof _0x506932!=='string'||_0x506932[_0xe851('0x3')]===0x0){return _0x326b34(_0xe851('0x4'));}if(typeof _0x122708!==_0xe851('0x5')||_0x122708[_0xe851('0x3')]===0x0){return _0x326b34(_0xe851('0x6'));}if(typeof _0x11f06b!=='undefined'&&(typeof _0x11f06b!==_0xe851('0x5')||_0x11f06b['length']===0x0)){return _0x326b34('lang\x20should\x20be\x20a\x20string');}try{_0xe50306=fs[_0xe851('0x7')](_0x506932)[_0xe851('0x8')](_0xe851('0x9'));}catch(_0xe0cb8d){return _0x326b34(_0xe0cb8d);}return _0x16b38a({'method':'POST','uri':host+_0xe851('0xa')+_0x122708,'body':{'config':{'encoding':_0xe851('0xb'),'sampleRateHertz':_0xe851('0xc'),'languageCode':_0x11f06b},'audio':{'content':_0xe50306}},'json':!![]});});}; \ No newline at end of file +var _0xfc4c=['undefined','length','base64','/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com','string','key\x20should\x20be\x20a\x20string'];(function(_0x262bff,_0x5cba81){var _0x52cf9d=function(_0x3d659a){while(--_0x3d659a){_0x262bff['push'](_0x262bff['shift']());}};_0x52cf9d(++_0x5cba81);}(_0xfc4c,0xca));var _0xcfc4=function(_0x259b0c,_0x242d07){_0x259b0c=_0x259b0c-0x0;var _0x4a1841=_0xfc4c[_0x259b0c];return _0x4a1841;};'use strict';var url=require(_0xcfc4('0x0'));var BPromise=require(_0xcfc4('0x1'));var fs=require('fs');var host=_0xcfc4('0x2');module['exports']=function(_0x29323d,_0xb8f67b,_0x3a0bd9){return new BPromise(function(_0x54bee8,_0x57bf8a){var _0x436d9b;if(typeof _0x29323d!==_0xcfc4('0x3')||_0x29323d['length']===0x0){return _0x57bf8a('filepath\x20should\x20be\x20a\x20string');}if(typeof _0xb8f67b!==_0xcfc4('0x3')||_0xb8f67b['length']===0x0){return _0x57bf8a(_0xcfc4('0x4'));}if(typeof _0x3a0bd9!==_0xcfc4('0x5')&&(typeof _0x3a0bd9!=='string'||_0x3a0bd9[_0xcfc4('0x6')]===0x0)){return _0x57bf8a('lang\x20should\x20be\x20a\x20string');}try{_0x436d9b=fs['readFileSync'](_0x29323d)['toString'](_0xcfc4('0x7'));}catch(_0x2d8256){return _0x57bf8a(_0x2d8256);}return _0x54bee8({'method':'POST','uri':host+_0xcfc4('0x8')+_0xb8f67b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x3a0bd9},'audio':{'content':_0x436d9b}},'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 7117471..919e330 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 _0x766a=['./asr','exports'];(function(_0x2919d0,_0x40f836){var _0x1db86a=function(_0x4d062e){while(--_0x4d062e){_0x2919d0['push'](_0x2919d0['shift']());}};_0x1db86a(++_0x40f836);}(_0x766a,0xaa));var _0xa766=function(_0x51c52b,_0x147712){_0x51c52b=_0x51c52b-0x0;var _0x581ce3=_0x766a[_0x51c52b];return _0x581ce3;};var asr=require(_0xa766('0x0'));module[_0xa766('0x1')]={'asr':asr}; \ No newline at end of file +var _0xd7ca=['exports'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xd7ca,0x9f));var _0xad7c=function(_0xd25678,_0x5880ab){_0xd25678=_0xd25678-0x0;var _0x5966e0=_0xd7ca[_0xd25678];return _0x5966e0;};var asr=require('./asr');module[_0xad7c('0x0')]={'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 3219192..80b7462 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 _0x2d64=['host','path','data','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','from','audioContent','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','info','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','https','md5','randomstring','google-tts-api','url','util','./google','./sestek','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish\x20download\x20file','close','unlink','download\x20error','end','protocol'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2d64,0x1e2));var _0x42d6=function(_0x5c1e52,_0x283789){_0x5c1e52=_0x5c1e52-0x0;var _0x11e2c4=_0x2d64[_0x5c1e52];return _0x11e2c4;};'use strict';var apiai=require(_0x42d6('0x0'));var BPromise=require(_0x42d6('0x1'));var dialogflow=require(_0x42d6('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x42d6('0x3'));var md5=require(_0x42d6('0x4'));var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x42d6('0x5'));var sox=require('sox');var tts=require(_0x42d6('0x6'));var urlParse=require(_0x42d6('0x7'))['parse'];var util=require(_0x42d6('0x8'));var aws=require('./aws');var google=require(_0x42d6('0x9'));var sestek=require(_0x42d6('0xa'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x42d6('0xb'));var ISPEECH_API=_0x42d6('0xc');function downloadFile(_0x3d9967,_0x30c565){return new BPromise(function(_0x5af652,_0x4fe37c){var _0x1128c4=urlParse(_0x3d9967);var _0x5af9f1=_0x1128c4['protocol']===_0x42d6('0xd')?https:http;var _0x5aad40={'host':_0x1128c4['host'],'path':_0x1128c4['path'],'headers':{'user-agent':_0x42d6('0xe')}};_0x5af9f1[_0x42d6('0xf')](_0x5aad40,function(_0x1d84f7){if(_0x1d84f7[_0x42d6('0x10')]!==0xc8){logger[_0x42d6('0x11')]('request\x20to\x20'+_0x3d9967+_0x42d6('0x12')+_0x1d84f7[_0x42d6('0x10')]+'\x20('+_0x1d84f7['statusMessage']+')');_0x4fe37c(new Error('request\x20to\x20'+_0x3d9967+_0x42d6('0x12')+_0x1d84f7[_0x42d6('0x10')]+'\x20('+_0x1d84f7[_0x42d6('0x13')]+')'));return;}var _0x3f8722=fs['createWriteStream'](_0x30c565);_0x3f8722['on']('finish',function(){logger['info'](_0x42d6('0x14'));_0x3f8722[_0x42d6('0x15')](_0x5af652);});_0x3f8722['on'](_0x42d6('0x11'),function(_0x25ee83){fs[_0x42d6('0x16')](_0x30c565);logger[_0x42d6('0x11')](_0x42d6('0x17'),_0x25ee83);_0x4fe37c(_0x25ee83);});_0x1d84f7['pipe'](_0x3f8722);})['on']('error',function(_0x41a47c){logger[_0x42d6('0x11')](_0x41a47c);_0x4fe37c(_0x41a47c);})[_0x42d6('0x18')]();});}function uploadFile(_0x4aa35c){return new BPromise(function(_0x1eb26c,_0x55e906){var _0x3f1e52=urlParse(_0x4aa35c);var _0x9184fd=_0x3f1e52[_0x42d6('0x19')]===_0x42d6('0xd')?https:http;var _0x2814b7={'host':_0x3f1e52[_0x42d6('0x1a')],'path':_0x3f1e52[_0x42d6('0x1b')],'headers':{'user-agent':_0x42d6('0xe')}};_0x9184fd[_0x42d6('0xf')](_0x2814b7,function(_0x5cd931){if(_0x5cd931[_0x42d6('0x10')]!==0xc8){_0x55e906(new Error('request\x20to\x20'+_0x4aa35c+_0x42d6('0x12')+_0x5cd931[_0x42d6('0x10')]+'\x20('+_0x5cd931[_0x42d6('0x13')]+')'));return;}var _0x3e2d64='';_0x5cd931['on'](_0x42d6('0x1c'),function(_0x43b83f){_0x3e2d64+=_0x43b83f;});_0x5cd931['on']('end',function(){_0x1eb26c(_0x3e2d64);});})['on'](_0x42d6('0x11'),function(_0x57664b){_0x55e906(_0x57664b);})[_0x42d6('0x18')]();});}function convertFile(_0x6f3606,_0x12ac26){return new BPromise(function(_0x2aee4e,_0x108c07){var _0x3bb078=sox['transcode'](_0x6f3606,_0x12ac26,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3bb078['on'](_0x42d6('0x11'),function(_0x23a739){logger[_0x42d6('0x11')]('error\x20convert',_0x23a739);_0x108c07(_0x23a739);});_0x3bb078['on'](_0x42d6('0x18'),function(){logger['info'](_0x42d6('0x1d'));_0x2aee4e();});_0x3bb078['start']();});}function base64Decode(_0x33f98f,_0x4781c7){var _0x1e103c=path[_0x42d6('0x1e')](__dirname,'tmp',rs[_0x42d6('0x1f')](0x4)+_0x42d6('0x20'));fs[_0x42d6('0x21')](_0x1e103c,_0x33f98f,_0x42d6('0x22'));return convertFile(_0x1e103c,_0x4781c7)[_0x42d6('0x23')](function(){try{fs[_0x42d6('0x16')](_0x1e103c);fs[_0x42d6('0x24')](_0x4781c7,_0x42d6('0x25'));}catch(_0xd17eeb){logger[_0x42d6('0x11')](_0xd17eeb);}return _0x4781c7[_0x42d6('0x26')]('.')[0x0];});}function base64Encode(_0x2e1d3f){var _0x44e7ec=fs[_0x42d6('0x27')](_0x2e1d3f);return new Buffer(_0x44e7ec)[_0x42d6('0x28')]('base64');}exports['googleCloudTTS']=function(_0x40a419,_0x28029c,_0x42de9b,_0xef573b,_0x51a345,_0x13348b){var _0x4e9b8b,_0xf595e;var _0x5e9704=_0x42d6('0x29');var _0x36afb4=_0x42d6('0x2a')+_0x40a419;var _0x2490ed={};if(_0x28029c===_0x42d6('0x2b')){_0x2490ed[_0x42d6('0x2c')]={'ssml':_0x42de9b};}else{_0x2490ed[_0x42d6('0x2c')]={'text':_0x42de9b};};_0x2490ed[_0x42d6('0x2d')]={'languageCode':_0xef573b,'ssmlGender':_0x51a345};_0x2490ed[_0x42d6('0x2e')]={'audioEncoding':_0x42d6('0x2f'),'sampleRateHertz':0x1f40};var _0x5f5169={'url':_0x5e9704+_0x42d6('0x30')+_0x36afb4,'method':_0x42d6('0x31'),'json':!![],'body':_0x2490ed};return rp(_0x5f5169)[_0x42d6('0x23')](function(_0x3faf4a){return new BPromise(function(_0x586956,_0x2140f0){_0x4e9b8b=path[_0x42d6('0x1e')](__dirname,_0x42d6('0x32'),rs[_0x42d6('0x1f')](0x4)+_0x42d6('0x33'));var _0x32f897=Buffer[_0x42d6('0x34')](_0x3faf4a[_0x42d6('0x35')],_0x42d6('0x22'));return fs['writeFile'](_0x4e9b8b,_0x32f897,function(_0x21b97e){_0x2140f0(_0x21b97e);},function(_0x2d5620){fs[_0x42d6('0x24')](_0x4e9b8b,'777');_0x586956(_0x2d5620);});});})[_0x42d6('0x23')](function(_0x31d1cf){_0xf595e=path[_0x42d6('0x1e')](__dirname,_0x42d6('0x32'),rs[_0x42d6('0x1f')](0x4)+_0x42d6('0x20'));return convertFile(_0x4e9b8b,_0xf595e);})['then'](function(){try{fs['unlink'](_0x4e9b8b);fs[_0x42d6('0x24')](_0xf595e,_0x42d6('0x25'));}catch(_0x293727){logger[_0x42d6('0x11')](_0x293727);}logger['info']('googleCloudTTS\x20path',_0xf595e[_0x42d6('0x26')]('.')[0x0]);return _0xf595e[_0x42d6('0x26')]('.')[0x0];});};exports[_0x42d6('0x36')]=function(_0x5f0eee,_0x298726){var _0x53b1c1=_0x42d6('0x37');var _0x8bd502,_0x3d0a89;var _0x16e046;var _0x2ac953={'encoding':_0x42d6('0x38'),'method':_0x42d6('0x31'),'timeout':0x2710,'url':_0x53b1c1,'headers':{'Content-Type':_0x42d6('0x39')},'body':_0x42d6('0x3a')+encodeURIComponent(JSON[_0x42d6('0x3b')]([[['jQ1olc',JSON[_0x42d6('0x3b')]([_0x5f0eee,_0x298726||'en',![],_0x42d6('0x3c')]),null,'generic']]]))};return rp(_0x2ac953)[_0x42d6('0x23')](function(_0x3c14e1){try{_0x16e046=eval(_0x3c14e1[_0x42d6('0x3d')](0x5))[0x0][0x2];}catch(_0x5bfaf1){throw new Error(_0x42d6('0x3e')+_0x3c14e1[_0x42d6('0x1c')]);}if(!_0x16e046){if(_0x5f0eee['length']>0xc8){throw new Error(_0x42d6('0x3f'));}else{throw new Error(_0x42d6('0x40')+_0x298726+'\x22\x20might\x20not\x20exist');}}try{_0x16e046=eval(_0x16e046)[0x0];}catch(_0x508214){throw new Error(_0x42d6('0x3e')+res[_0x42d6('0x1c')]);}const _0x3dbc19=_0x16e046;_0x8bd502=path[_0x42d6('0x1e')](__dirname,_0x42d6('0x32'),rs[_0x42d6('0x1f')](0x4)+_0x42d6('0x33'));fs[_0x42d6('0x21')](_0x8bd502,_0x16e046,{'encoding':_0x42d6('0x22')});_0x3d0a89=path['resolve'](__dirname,_0x42d6('0x32'),rs['generate'](0x4)+'.wav');return convertFile(_0x8bd502,_0x3d0a89);})[_0x42d6('0x23')](function(){try{fs[_0x42d6('0x16')](_0x8bd502);fs['chmodSync'](_0x3d0a89,_0x42d6('0x25'));}catch(_0x2d6bc8){logger[_0x42d6('0x11')](_0x2d6bc8);}logger[_0x42d6('0x41')]('goggleTTS\x20path',_0x3d0a89[_0x42d6('0x26')]('.')[0x0]);return _0x3d0a89['split']('.')[0x0];});};exports[_0x42d6('0x42')]=function(_0x30e68d,_0x37ab7c,_0x1d9f13){return google[_0x42d6('0x43')](_0x30e68d,_0x37ab7c,_0x1d9f13)[_0x42d6('0x23')](function(_0x22807b){logger[_0x42d6('0x41')](_0x22807b[_0x42d6('0x44')]);return rp(_0x22807b);})['then'](function(_0x1cf8b8){var _0x524268='';var _0x16728c=0x0;try{fs['unlink'](_0x30e68d);}catch(_0x382367){logger[_0x42d6('0x11')](_0x382367);}if(_0x1cf8b8&&_0x1cf8b8['results']){_0x524268=_0x1cf8b8[_0x42d6('0x45')][_0x42d6('0x46')](function(_0x58a272){return _0x58a272&&_0x58a272[_0x42d6('0x47')][0x0]&&_0x58a272[_0x42d6('0x47')][0x0][_0x42d6('0x48')]?_0x58a272[_0x42d6('0x47')][0x0]['transcript']:'';})['join']('\x0a');_0x16728c=_0x1cf8b8[_0x42d6('0x45')]['map'](function(_0x47cda9){return _0x47cda9&&_0x47cda9[_0x42d6('0x47')][0x0]&&_0x47cda9[_0x42d6('0x47')][0x0]['confidence']?_0x47cda9[_0x42d6('0x47')][0x0][_0x42d6('0x49')]:0x0;})[_0x42d6('0x4a')]('\x0a');}logger[_0x42d6('0x41')](_0x42d6('0x4b'),_0x524268);logger['info'](_0x42d6('0x4c'),_0x16728c);return{'transcript':_0x524268,'confidence':_0x16728c};})[_0x42d6('0x4d')](function(_0x457f6f){logger[_0x42d6('0x11')](_0x42d6('0x4e'),_0x457f6f[_0x42d6('0x10')],_0x457f6f[_0x42d6('0x4f')],_0x457f6f['message']);});};exports[_0x42d6('0x50')]=function(_0x1cf4e9,_0xe1d35d,_0x4952c9,_0x59219f){var _0xf3f32e=apiai(_0xe1d35d,{'language':_0x59219f||'en'});return _0xf3f32e[_0x42d6('0x51')](_0x4952c9,{'sessionId':md5(_0x1cf4e9)})[_0x42d6('0x23')](function(_0x31b3ab){logger[_0x42d6('0x41')](JSON['stringify'](_0x31b3ab));return{'source':_0x31b3ab[_0x42d6('0x52')][_0x42d6('0x53')],'resolvedQuery':_0x31b3ab[_0x42d6('0x52')][_0x42d6('0x54')],'action':_0x31b3ab[_0x42d6('0x52')]['action'],'actionIncomplete':_0x31b3ab[_0x42d6('0x52')]['actionIncomplete'],'speech':_0x31b3ab[_0x42d6('0x52')]['fulfillment']['speech'],'score':_0x31b3ab[_0x42d6('0x52')]['score'],'statusCode':_0x31b3ab['status'][_0x42d6('0x55')],'endConversation':_0x31b3ab[_0x42d6('0x52')]['metadata'][_0x42d6('0x56')]||![],'isFallbackIntent':_0x31b3ab['result'][_0x42d6('0x57')][_0x42d6('0x58')]};});};exports[_0x42d6('0x59')]=function(_0x54dbc2,_0x7b242,_0x3310c5,_0x2e060c,_0x1e2090,_0x382e14){var _0xc9c7b3=_0x2e060c[_0x42d6('0x5a')](/\\n/g,'\x0a');var _0x565371={'credentials':{'private_key':_0xc9c7b3,'client_email':_0x3310c5}};var _0x46a12b=new dialogflow[(_0x42d6('0x5b'))](_0x565371);var _0x5827a7=_0x46a12b['sessionPath'](_0x7b242,md5(_0x54dbc2));var _0x25a29f={'session':_0x5827a7,'queryInput':{'text':{'text':_0x1e2090,'languageCode':_0x382e14}}};return _0x46a12b[_0x42d6('0x5c')](_0x25a29f)['then'](function(_0x1d45f3){if(_0x1d45f3&&_0x1d45f3[_0x42d6('0x5d')]){logger['info'](_0x42d6('0x5e'),JSON['stringify'](_0x1d45f3));var _0x2c49b8=_0x1d45f3[0x0];if(_0x2c49b8){var _0x4f9ce0={'action':_0x2c49b8['queryResult'][_0x42d6('0x5f')],'allRequiredParamsPresent':_0x2c49b8[_0x42d6('0x60')][_0x42d6('0x61')],'endConversation':_0x2c49b8[_0x42d6('0x60')][_0x42d6('0x62')]&&_0x2c49b8['queryResult'][_0x42d6('0x62')][_0x42d6('0x63')]?_0x2c49b8[_0x42d6('0x60')][_0x42d6('0x62')][_0x42d6('0x63')]['end_conversation'][_0x42d6('0x64')]:![],'fulfillmentText':_0x2c49b8['queryResult'][_0x42d6('0x65')],'intentName':_0x2c49b8[_0x42d6('0x60')][_0x42d6('0x66')][_0x42d6('0x4f')],'intentDisplayName':_0x2c49b8[_0x42d6('0x60')][_0x42d6('0x66')][_0x42d6('0x67')],'isFallbackIntent':_0x2c49b8[_0x42d6('0x60')][_0x42d6('0x66')][_0x42d6('0x68')],'languageCode':_0x2c49b8[_0x42d6('0x60')][_0x42d6('0x69')],'queryText':_0x2c49b8[_0x42d6('0x60')][_0x42d6('0x6a')],'responseId':_0x2c49b8[_0x42d6('0x6b')],'score':_0x2c49b8[_0x42d6('0x60')][_0x42d6('0x6c')],'speech':_0x2c49b8['queryResult'][_0x42d6('0x65')],'providerResponse':JSON['stringify'](_0x1d45f3)};return _0x4f9ce0;}}});};exports['tildeASR']=function(_0x543595,_0x4a00b1,_0x31adcf,_0x3f491e){return tilde['asr'](_0x543595,_0x4a00b1,_0x31adcf,_0x3f491e)[_0x42d6('0x23')](function(_0x16dbcf){try{fs[_0x42d6('0x16')](_0x543595);}catch(_0x1e41f9){logger['error'](_0x1e41f9);}logger[_0x42d6('0x41')]('Tilde\x20ASR\x20transcription',_0x16dbcf['transcript']);logger[_0x42d6('0x41')](_0x42d6('0x6d'),_0x16dbcf[_0x42d6('0x49')]);return _0x16dbcf;});};exports[_0x42d6('0x6e')]=function(_0x3fc6e1,_0x3326db,_0x1b72f8,_0x13b2f,_0x3be34a,_0x31dcd5){var _0xeb0ace=path['resolve'](__dirname,_0x42d6('0x32'),rs['generate'](0x4)+_0x42d6('0x33'));var _0x5bd16c;return aws['polly'](_0x3fc6e1,_0x3326db,_0x1b72f8,_0x13b2f,_0x3be34a,_0x31dcd5,_0xeb0ace)[_0x42d6('0x23')](function(){_0x5bd16c=path['resolve'](__dirname,'tmp',rs[_0x42d6('0x1f')](0x4)+_0x42d6('0x20'));return convertFile(_0xeb0ace,_0x5bd16c);})[_0x42d6('0x23')](function(){try{fs['unlink'](_0xeb0ace);fs['chmodSync'](_0x5bd16c,_0x42d6('0x25'));}catch(_0x5aee9d){logger[_0x42d6('0x11')](_0x5aee9d);}return _0x5bd16c[_0x42d6('0x26')]('.')[0x0];});};exports[_0x42d6('0x6f')]=function(_0x27daa9,_0xe15450,_0x339a5f,_0x10a60e,_0x380711,_0x2c37ba){return aws[_0x42d6('0x70')](_0x27daa9,_0xe15450,_0x339a5f,_0x10a60e,_0x380711,_0x2c37ba)[_0x42d6('0x23')](function(_0x3201ca){logger['info'](JSON[_0x42d6('0x3b')](_0x3201ca));return _0x3201ca;});};exports['ispeechTTS']=function(_0x1e9d85,_0x4313cd,_0x4c60cb,_0x1e8761){var _0x3a7e93=util[_0x42d6('0x71')](_0x42d6('0x72'),ISPEECH_API,_0x1e9d85,encodeURIComponent(_0x4313cd),_0x4c60cb,_0x1e8761);var _0x2255e9=path['resolve'](__dirname,'tmp',rs[_0x42d6('0x1f')](0x4)+_0x42d6('0x33'));var _0x357965;return downloadFile(_0x3a7e93,_0x2255e9)[_0x42d6('0x23')](function(){_0x357965=path['resolve'](__dirname,_0x42d6('0x32'),rs[_0x42d6('0x1f')](0x4)+'.wav');return convertFile(_0x2255e9,_0x357965);})[_0x42d6('0x23')](function(){try{fs['unlink'](_0x2255e9);fs[_0x42d6('0x24')](_0x357965,_0x42d6('0x25'));}catch(_0x361df5){logger['error'](_0x361df5);}return _0x357965[_0x42d6('0x26')]('.')[0x0];});};exports[_0x42d6('0x73')]=function(_0x526478,_0x46883b,_0x32ace9,_0x12813c){var _0x581aca=util[_0x42d6('0x71')](_0x42d6('0x74'),ISPEECH_API,_0x46883b,_0x32ace9,base64Encode(_0x526478),_0x12813c?util[_0x42d6('0x71')](_0x42d6('0x75'),encodeURIComponent(_0x12813c)):_0x42d6('0x76'));return uploadFile(_0x581aca)[_0x42d6('0x23')](function(_0x1e8bc9){return querystring['parse'](_0x1e8bc9);});};exports[_0x42d6('0x77')]=function(_0x144086,_0x97165c){return sestek[_0x42d6('0x78')](_0x144086,_0x97165c)['then'](function(_0x1df082){logger[_0x42d6('0x41')](JSON['stringify'](_0x1df082));var _0x3dca90={'speech':_0x1df082[_0x42d6('0x79')],'action':_0x1df082[_0x42d6('0x7a')]?_0x1df082[_0x42d6('0x7a')]['CustomAction']:undefined,'actiondata':_0x1df082[_0x42d6('0x7a')]?_0x1df082[_0x42d6('0x7a')][_0x42d6('0x7b')]:undefined};if(_0x1df082['channelData']&&_0x1df082[_0x42d6('0x7a')][_0x42d6('0x7c')]){return base64Decode(_0x1df082[_0x42d6('0x7a')]['AudioFromTts'][_0x42d6('0x7d')],path[_0x42d6('0x1e')](__dirname,_0x42d6('0x32'),rs[_0x42d6('0x1f')](0x4)+'.wav'))[_0x42d6('0x23')](function(_0x35c246){_0x3dca90['audiofile']=_0x35c246;return _0x3dca90;});}return _0x3dca90;});};exports[_0x42d6('0x7e')]=function(){return __dirname;}; \ No newline at end of file +var _0x1274=['tmp','generate','writeFileSync','base64','then','777','split','toString','https://texttospeech.googleapis.com/v1/','input','voice','MP3','POST','audioContent','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','.mp3','.wav','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','sox','google-tts-api','parse','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','get','transcode','wav','finish\x20to\x20convert','resolve'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x1274,0x165));var _0x4127=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1274[_0x3dd15e];return _0x231fd0;};'use strict';var apiai=require(_0x4127('0x0'));var BPromise=require(_0x4127('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x4127('0x2'));var https=require(_0x4127('0x3'));var md5=require(_0x4127('0x4'));var path=require(_0x4127('0x5'));var querystring=require(_0x4127('0x6'));var rp=require(_0x4127('0x7'));var rs=require('randomstring');var sox=require(_0x4127('0x8'));var tts=require(_0x4127('0x9'));var urlParse=require('url')[_0x4127('0xa')];var util=require('util');var aws=require(_0x4127('0xb'));var google=require(_0x4127('0xc'));var sestek=require(_0x4127('0xd'));var tilde=require('./tilde');var logger=require(_0x4127('0xe'))(_0x4127('0xf'));var ISPEECH_API=_0x4127('0x10');function downloadFile(_0x513ae8,_0x383135){return new BPromise(function(_0x3d6f6e,_0x51bb59){var _0x25b67f=urlParse(_0x513ae8);var _0x41835c=_0x25b67f[_0x4127('0x11')]===_0x4127('0x12')?https:http;var _0x1d6385={'host':_0x25b67f[_0x4127('0x13')],'path':_0x25b67f[_0x4127('0x5')],'headers':{'user-agent':_0x4127('0x14')}};_0x41835c['get'](_0x1d6385,function(_0x351ec0){if(_0x351ec0[_0x4127('0x15')]!==0xc8){logger['error']('request\x20to\x20'+_0x513ae8+_0x4127('0x16')+_0x351ec0[_0x4127('0x15')]+'\x20('+_0x351ec0[_0x4127('0x17')]+')');_0x51bb59(new Error(_0x4127('0x18')+_0x513ae8+_0x4127('0x16')+_0x351ec0[_0x4127('0x15')]+'\x20('+_0x351ec0[_0x4127('0x17')]+')'));return;}var _0x249325=fs['createWriteStream'](_0x383135);_0x249325['on'](_0x4127('0x19'),function(){logger[_0x4127('0x1a')](_0x4127('0x1b'));_0x249325[_0x4127('0x1c')](_0x3d6f6e);});_0x249325['on'](_0x4127('0x1d'),function(_0x3a7460){fs[_0x4127('0x1e')](_0x383135);logger['error'](_0x4127('0x1f'),_0x3a7460);_0x51bb59(_0x3a7460);});_0x351ec0[_0x4127('0x20')](_0x249325);})['on']('error',function(_0x341649){logger[_0x4127('0x1d')](_0x341649);_0x51bb59(_0x341649);})[_0x4127('0x21')]();});}function uploadFile(_0x30a793){return new BPromise(function(_0x595669,_0x1ad885){var _0x241e75=urlParse(_0x30a793);var _0x4dee14=_0x241e75[_0x4127('0x11')]===_0x4127('0x12')?https:http;var _0x127aa8={'host':_0x241e75[_0x4127('0x13')],'path':_0x241e75[_0x4127('0x5')],'headers':{'user-agent':_0x4127('0x14')}};_0x4dee14[_0x4127('0x22')](_0x127aa8,function(_0x285be6){if(_0x285be6[_0x4127('0x15')]!==0xc8){_0x1ad885(new Error(_0x4127('0x18')+_0x30a793+'\x20failed,\x20status\x20code\x20=\x20'+_0x285be6[_0x4127('0x15')]+'\x20('+_0x285be6[_0x4127('0x17')]+')'));return;}var _0x351711='';_0x285be6['on']('data',function(_0x507f88){_0x351711+=_0x507f88;});_0x285be6['on'](_0x4127('0x21'),function(){_0x595669(_0x351711);});})['on'](_0x4127('0x1d'),function(_0x18151c){_0x1ad885(_0x18151c);})[_0x4127('0x21')]();});}function convertFile(_0x2c8e3b,_0x510396){return new BPromise(function(_0x2d4c9e,_0x5b801c){var _0x235d11=sox[_0x4127('0x23')](_0x2c8e3b,_0x510396,{'sampleRate':0x1f40,'format':_0x4127('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x235d11['on']('error',function(_0x89ed21){logger[_0x4127('0x1d')]('error\x20convert',_0x89ed21);_0x5b801c(_0x89ed21);});_0x235d11['on'](_0x4127('0x21'),function(){logger['info'](_0x4127('0x25'));_0x2d4c9e();});_0x235d11['start']();});}function base64Decode(_0x4013ba,_0x2612c9){var _0x54d956=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+'.wav');fs[_0x4127('0x29')](_0x54d956,_0x4013ba,_0x4127('0x2a'));return convertFile(_0x54d956,_0x2612c9)[_0x4127('0x2b')](function(){try{fs[_0x4127('0x1e')](_0x54d956);fs['chmodSync'](_0x2612c9,_0x4127('0x2c'));}catch(_0x568396){logger[_0x4127('0x1d')](_0x568396);}return _0x2612c9[_0x4127('0x2d')]('.')[0x0];});}function base64Encode(_0x26e145){var _0x708c1=fs['readFileSync'](_0x26e145);return new Buffer(_0x708c1)[_0x4127('0x2e')](_0x4127('0x2a'));}exports['googleCloudTTS']=function(_0x134fd7,_0x2d5344,_0x5b6f26,_0x37117b,_0x3152a1,_0x31097a){var _0x5db766,_0x50e5fd;var _0x7bbdae=_0x4127('0x2f');var _0x13f924='?key='+_0x134fd7;var _0x350962={};if(_0x2d5344==='ssml'){_0x350962[_0x4127('0x30')]={'ssml':_0x5b6f26};}else{_0x350962['input']={'text':_0x5b6f26};};_0x350962[_0x4127('0x31')]={'languageCode':_0x37117b,'ssmlGender':_0x3152a1};_0x350962['audioConfig']={'audioEncoding':_0x4127('0x32'),'sampleRateHertz':0x1f40};var _0x388e67={'url':_0x7bbdae+'text:synthesize'+_0x13f924,'method':_0x4127('0x33'),'json':!![],'body':_0x350962};return rp(_0x388e67)['then'](function(_0x4cd010){return new BPromise(function(_0x43ee1e,_0x43ecec){_0x5db766=path['resolve'](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+'.mp3');var _0x29a2c4=Buffer['from'](_0x4cd010[_0x4127('0x34')],_0x4127('0x2a'));return fs['writeFile'](_0x5db766,_0x29a2c4,function(_0x438765){_0x43ecec(_0x438765);},function(_0x17892b){fs['chmodSync'](_0x5db766,_0x4127('0x2c'));_0x43ee1e(_0x17892b);});});})['then'](function(_0x2a7e5a){_0x50e5fd=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+'.wav');return convertFile(_0x5db766,_0x50e5fd);})[_0x4127('0x2b')](function(){try{fs[_0x4127('0x1e')](_0x5db766);fs[_0x4127('0x35')](_0x50e5fd,_0x4127('0x2c'));}catch(_0x49fd9d){logger[_0x4127('0x1d')](_0x49fd9d);}logger[_0x4127('0x1a')](_0x4127('0x36'),_0x50e5fd[_0x4127('0x2d')]('.')[0x0]);return _0x50e5fd[_0x4127('0x2d')]('.')[0x0];});};exports[_0x4127('0x37')]=function(_0x52dd67,_0x16a27a){var _0x18931c=_0x4127('0x38');var _0x535b77,_0x398f6e;var _0x11a4c7;var _0x1bda5a={'encoding':_0x4127('0x39'),'method':_0x4127('0x33'),'timeout':0x2710,'url':_0x18931c,'headers':{'Content-Type':_0x4127('0x3a')},'body':_0x4127('0x3b')+encodeURIComponent(JSON[_0x4127('0x3c')]([[[_0x4127('0x3d'),JSON['stringify']([_0x52dd67,_0x16a27a||'en',![],'null']),null,'generic']]]))};return rp(_0x1bda5a)['then'](function(_0x49a51b){try{_0x11a4c7=eval(_0x49a51b['slice'](0x5))[0x0][0x2];}catch(_0x30bf9b){throw new Error(_0x4127('0x3e')+_0x49a51b[_0x4127('0x3f')]);}if(!_0x11a4c7){if(_0x52dd67[_0x4127('0x40')]>0xc8){throw new Error(_0x4127('0x41'));}else{throw new Error(_0x4127('0x42')+_0x16a27a+'\x22\x20might\x20not\x20exist');}}try{_0x11a4c7=eval(_0x11a4c7)[0x0];}catch(_0x1aff83){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x4127('0x3f')]);}const _0x1deec9=_0x11a4c7;_0x535b77=path[_0x4127('0x26')](__dirname,'tmp',rs[_0x4127('0x28')](0x4)+_0x4127('0x43'));fs['writeFileSync'](_0x535b77,_0x11a4c7,{'encoding':'base64'});_0x398f6e=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+_0x4127('0x44'));return convertFile(_0x535b77,_0x398f6e);})[_0x4127('0x2b')](function(){try{fs['unlink'](_0x535b77);fs[_0x4127('0x35')](_0x398f6e,'777');}catch(_0x567ff3){logger[_0x4127('0x1d')](_0x567ff3);}logger[_0x4127('0x1a')](_0x4127('0x45'),_0x398f6e[_0x4127('0x2d')]('.')[0x0]);return _0x398f6e[_0x4127('0x2d')]('.')[0x0];});};exports[_0x4127('0x46')]=function(_0xa3faac,_0x48bfc4,_0x37335e){return google[_0x4127('0x47')](_0xa3faac,_0x48bfc4,_0x37335e)['then'](function(_0x433f7f){logger[_0x4127('0x1a')](_0x433f7f['uri']);return rp(_0x433f7f);})[_0x4127('0x2b')](function(_0x1f5f47){var _0x5c021f='';var _0x69f2db=0x0;try{fs['unlink'](_0xa3faac);}catch(_0xeb7e8a){logger[_0x4127('0x1d')](_0xeb7e8a);}if(_0x1f5f47&&_0x1f5f47[_0x4127('0x48')]){_0x5c021f=_0x1f5f47[_0x4127('0x48')][_0x4127('0x49')](function(_0x24c12b){return _0x24c12b&&_0x24c12b[_0x4127('0x4a')][0x0]&&_0x24c12b['alternatives'][0x0]['transcript']?_0x24c12b[_0x4127('0x4a')][0x0][_0x4127('0x4b')]:'';})[_0x4127('0x4c')]('\x0a');_0x69f2db=_0x1f5f47[_0x4127('0x48')][_0x4127('0x49')](function(_0x5a287b){return _0x5a287b&&_0x5a287b['alternatives'][0x0]&&_0x5a287b[_0x4127('0x4a')][0x0][_0x4127('0x4d')]?_0x5a287b['alternatives'][0x0][_0x4127('0x4d')]:0x0;})[_0x4127('0x4c')]('\x0a');}logger['info'](_0x4127('0x4e'),_0x5c021f);logger[_0x4127('0x1a')]('googleASR\x20confidence',_0x69f2db);return{'transcript':_0x5c021f,'confidence':_0x69f2db};})[_0x4127('0x4f')](function(_0x473e36){logger[_0x4127('0x1d')](_0x4127('0x50'),_0x473e36[_0x4127('0x15')],_0x473e36[_0x4127('0x51')],_0x473e36[_0x4127('0x52')]);});};exports[_0x4127('0x53')]=function(_0x29354f,_0x5e73eb,_0x47d3da,_0x1363f2){var _0x4a6704=apiai(_0x5e73eb,{'language':_0x1363f2||'en'});return _0x4a6704[_0x4127('0x54')](_0x47d3da,{'sessionId':md5(_0x29354f)})[_0x4127('0x2b')](function(_0x2fc196){logger[_0x4127('0x1a')](JSON['stringify'](_0x2fc196));return{'source':_0x2fc196[_0x4127('0x55')][_0x4127('0x56')],'resolvedQuery':_0x2fc196[_0x4127('0x55')][_0x4127('0x57')],'action':_0x2fc196['result'][_0x4127('0x58')],'actionIncomplete':_0x2fc196[_0x4127('0x55')]['actionIncomplete'],'speech':_0x2fc196[_0x4127('0x55')]['fulfillment']['speech'],'score':_0x2fc196[_0x4127('0x55')][_0x4127('0x59')],'statusCode':_0x2fc196[_0x4127('0x5a')][_0x4127('0x5b')],'endConversation':_0x2fc196[_0x4127('0x55')][_0x4127('0x5c')][_0x4127('0x5d')]||![],'isFallbackIntent':_0x2fc196['result'][_0x4127('0x5c')][_0x4127('0x5e')]};});};exports[_0x4127('0x5f')]=function(_0x250336,_0x3a5557,_0xfa3ead,_0x4e87a6,_0xd2b973,_0x209ce0){var _0x5f1c89=_0x4e87a6[_0x4127('0x60')](/\\n/g,'\x0a');var _0x29aee4={'credentials':{'private_key':_0x5f1c89,'client_email':_0xfa3ead}};var _0x20cd7b=new dialogflow[(_0x4127('0x61'))](_0x29aee4);var _0xe8116b=_0x20cd7b['sessionPath'](_0x3a5557,md5(_0x250336));var _0x14d659={'session':_0xe8116b,'queryInput':{'text':{'text':_0xd2b973,'languageCode':_0x209ce0}}};return _0x20cd7b[_0x4127('0x62')](_0x14d659)[_0x4127('0x2b')](function(_0x45d309){if(_0x45d309&&_0x45d309['length']){logger[_0x4127('0x1a')](_0x4127('0x63'),JSON[_0x4127('0x3c')](_0x45d309));var _0x3ef909=_0x45d309[0x0];if(_0x3ef909){var _0x724c8d={'action':_0x3ef909[_0x4127('0x64')]['action'],'allRequiredParamsPresent':_0x3ef909[_0x4127('0x64')][_0x4127('0x65')],'endConversation':_0x3ef909[_0x4127('0x64')]['diagnosticInfo']&&_0x3ef909['queryResult'][_0x4127('0x66')]['fields']?_0x3ef909[_0x4127('0x64')]['diagnosticInfo'][_0x4127('0x67')][_0x4127('0x68')]['boolValue']:![],'fulfillmentText':_0x3ef909[_0x4127('0x64')][_0x4127('0x69')],'intentName':_0x3ef909['queryResult'][_0x4127('0x6a')][_0x4127('0x51')],'intentDisplayName':_0x3ef909['queryResult'][_0x4127('0x6a')]['displayName'],'isFallbackIntent':_0x3ef909[_0x4127('0x64')]['intent'][_0x4127('0x6b')],'languageCode':_0x3ef909[_0x4127('0x64')][_0x4127('0x6c')],'queryText':_0x3ef909['queryResult'][_0x4127('0x6d')],'responseId':_0x3ef909[_0x4127('0x6e')],'score':_0x3ef909['queryResult']['intentDetectionConfidence'],'speech':_0x3ef909[_0x4127('0x64')][_0x4127('0x69')],'providerResponse':JSON[_0x4127('0x3c')](_0x45d309)};return _0x724c8d;}}});};exports[_0x4127('0x6f')]=function(_0x56c9f9,_0x5dacbb,_0x1a3596,_0x1d62ed){return tilde['asr'](_0x56c9f9,_0x5dacbb,_0x1a3596,_0x1d62ed)['then'](function(_0x2cb0b2){try{fs['unlink'](_0x56c9f9);}catch(_0x42341f){logger[_0x4127('0x1d')](_0x42341f);}logger[_0x4127('0x1a')](_0x4127('0x70'),_0x2cb0b2[_0x4127('0x4b')]);logger['info'](_0x4127('0x71'),_0x2cb0b2[_0x4127('0x4d')]);return _0x2cb0b2;});};exports[_0x4127('0x72')]=function(_0x1a6966,_0x331b66,_0x583645,_0x4737dd,_0x37dc86,_0x4b63f8){var _0x42890b=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs['generate'](0x4)+_0x4127('0x43'));var _0x354f1c;return aws[_0x4127('0x73')](_0x1a6966,_0x331b66,_0x583645,_0x4737dd,_0x37dc86,_0x4b63f8,_0x42890b)[_0x4127('0x2b')](function(){_0x354f1c=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+_0x4127('0x44'));return convertFile(_0x42890b,_0x354f1c);})[_0x4127('0x2b')](function(){try{fs[_0x4127('0x1e')](_0x42890b);fs['chmodSync'](_0x354f1c,'777');}catch(_0xd9a7ae){logger[_0x4127('0x1d')](_0xd9a7ae);}return _0x354f1c['split']('.')[0x0];});};exports[_0x4127('0x74')]=function(_0x5088ad,_0x56ec08,_0xd1323d,_0x30ec65,_0x2d8ed4,_0x3dbda4){return aws['lex'](_0x5088ad,_0x56ec08,_0xd1323d,_0x30ec65,_0x2d8ed4,_0x3dbda4)[_0x4127('0x2b')](function(_0x5c552b){logger['info'](JSON[_0x4127('0x3c')](_0x5c552b));return _0x5c552b;});};exports[_0x4127('0x75')]=function(_0x4a3010,_0x3883c0,_0x3caed9,_0x28f351){var _0x25b022=util[_0x4127('0x76')](_0x4127('0x77'),ISPEECH_API,_0x4a3010,encodeURIComponent(_0x3883c0),_0x3caed9,_0x28f351);var _0x1ee8f7=path['resolve'](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+_0x4127('0x43'));var _0x1bc408;return downloadFile(_0x25b022,_0x1ee8f7)[_0x4127('0x2b')](function(){_0x1bc408=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+_0x4127('0x44'));return convertFile(_0x1ee8f7,_0x1bc408);})[_0x4127('0x2b')](function(){try{fs[_0x4127('0x1e')](_0x1ee8f7);fs[_0x4127('0x35')](_0x1bc408,'777');}catch(_0x33be32){logger[_0x4127('0x1d')](_0x33be32);}return _0x1bc408['split']('.')[0x0];});};exports[_0x4127('0x78')]=function(_0x52cb27,_0x6044e8,_0x196586,_0x5cb035){var _0x3742e1=util[_0x4127('0x76')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x6044e8,_0x196586,base64Encode(_0x52cb27),_0x5cb035?util[_0x4127('0x76')](_0x4127('0x79'),encodeURIComponent(_0x5cb035)):_0x4127('0x7a'));return uploadFile(_0x3742e1)[_0x4127('0x2b')](function(_0x22eec4){return querystring[_0x4127('0xa')](_0x22eec4);});};exports['sestekNDA']=function(_0x1541ba,_0x56d3dd){return sestek[_0x4127('0x7b')](_0x1541ba,_0x56d3dd)['then'](function(_0x39f323){logger['info'](JSON['stringify'](_0x39f323));var _0x8874e6={'speech':_0x39f323[_0x4127('0x7c')],'action':_0x39f323[_0x4127('0x7d')]?_0x39f323['channelData'][_0x4127('0x7e')]:undefined,'actiondata':_0x39f323[_0x4127('0x7d')]?_0x39f323[_0x4127('0x7d')][_0x4127('0x7f')]:undefined};if(_0x39f323[_0x4127('0x7d')]&&_0x39f323[_0x4127('0x7d')]['AudioFromTts']){return base64Decode(_0x39f323[_0x4127('0x7d')][_0x4127('0x80')][_0x4127('0x81')],path['resolve'](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+_0x4127('0x44')))[_0x4127('0x2b')](function(_0x2fff7c){_0x8874e6[_0x4127('0x82')]=_0x2fff7c;return _0x8874e6;});}return _0x8874e6;});};exports[_0x4127('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 979d65a..610287a 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 _0xdc18=['exports'];(function(_0x5a15d7,_0x2f68ae){var _0x2e7101=function(_0xedd477){while(--_0xedd477){_0x5a15d7['push'](_0x5a15d7['shift']());}};_0x2e7101(++_0x2f68ae);}(_0xdc18,0x95));var _0x8dc1=function(_0x2b8a59,_0x4c49c1){_0x2b8a59=_0x2b8a59-0x0;var _0x51ad76=_0xdc18[_0x2b8a59];return _0x51ad76;};var nda=require('./nda');module[_0x8dc1('0x0')]={'nda':nda}; \ No newline at end of file +var _0x5a2d=['exports','./nda'];(function(_0xb53fb1,_0x58a815){var _0x5579b5=function(_0x2d8572){while(--_0x2d8572){_0xb53fb1['push'](_0xb53fb1['shift']());}};_0x5579b5(++_0x58a815);}(_0x5a2d,0xa9));var _0xd5a2=function(_0x1aa049,_0x9ae13c){_0x1aa049=_0x1aa049-0x0;var _0x357f29=_0x5a2d[_0x1aa049];return _0x357f29;};var nda=require(_0xd5a2('0x0'));module[_0xd5a2('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 68b8cdd..3520933 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 _0xae60=['request-promise','url','../../../../../config/logger','exports','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify'];(function(_0x37222f,_0x25a5ab){var _0x5c5a6d=function(_0x27218b){while(--_0x27218b){_0x37222f['push'](_0x37222f['shift']());}};_0x5c5a6d(++_0x25a5ab);}(_0xae60,0x1c7));var _0x0ae6=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xae60[_0x62c958];return _0x57ec61;};'use strict';var rp=require(_0x0ae6('0x0'));var url=require(_0x0ae6('0x1'));var logger=require(_0x0ae6('0x2'))('agi');module[_0x0ae6('0x3')]=function(_0x46c07f,_0x2d388d){var _0x568a7f={'method':_0x0ae6('0x4'),'uri':url[_0x0ae6('0x5')](_0x2d388d['ndauth_url'],_0x0ae6('0x6')),'form':{'grant_type':_0x0ae6('0x7'),'username':_0x2d388d[_0x0ae6('0x8')],'password':_0x2d388d[_0x0ae6('0x7')]},'json':!![]};return rp(_0x568a7f)[_0x0ae6('0x9')](function(_0x447a1d){var _0x120910={'method':_0x0ae6('0x4'),'uri':url['resolve'](_0x2d388d[_0x0ae6('0xa')],_0x0ae6('0xb')),'body':{'type':_0x2d388d[_0x0ae6('0xc')]||_0x0ae6('0xd'),'channelId':'Nda','conversation':{'id':_0x46c07f[_0x0ae6('0xe')]},'from':{'id':_0x46c07f[_0x0ae6('0xf')],'name':_0x46c07f[_0x0ae6('0x10')]},'recipient':{'id':_0x46c07f[_0x0ae6('0x11')],'name':_0x46c07f[_0x0ae6('0x12')]},'text':_0x2d388d[_0x0ae6('0x13')],'channelData':{}},'headers':{'Authorization':_0x0ae6('0x14')+_0x447a1d[_0x0ae6('0x15')]},'json':!![]};if(_0x2d388d[_0x0ae6('0x16')]){_0x120910[_0x0ae6('0x17')][_0x0ae6('0x18')][_0x0ae6('0x19')]=_0x2d388d[_0x0ae6('0x16')];}if(_0x2d388d[_0x0ae6('0x1a')]=='1'){_0x120910['body'][_0x0ae6('0x18')][_0x0ae6('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0ae6('0x1c')};}if(_0x2d388d[_0x0ae6('0x1d')]){_0x120910[_0x0ae6('0x17')][_0x0ae6('0x18')][_0x0ae6('0x1e')]=_0x2d388d[_0x0ae6('0x1d')];if(_0x2d388d[_0x0ae6('0x1f')]){_0x120910[_0x0ae6('0x17')][_0x0ae6('0x18')][_0x0ae6('0x20')]=_0x2d388d[_0x0ae6('0x1f')];}}logger[_0x0ae6('0x21')](JSON[_0x0ae6('0x22')](_0x120910));return rp(_0x120910);});}; \ No newline at end of file +var _0x2c6a=['audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','calleridname','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings'];(function(_0x2efb0d,_0x264636){var _0x475eda=function(_0x43c6b3){while(--_0x43c6b3){_0x2efb0d['push'](_0x2efb0d['shift']());}};_0x475eda(++_0x264636);}(_0x2c6a,0xa7));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xa2c6('0x0'));var url=require(_0xa2c6('0x1'));var logger=require(_0xa2c6('0x2'))(_0xa2c6('0x3'));module['exports']=function(_0x54904b,_0x1909fb){var _0x5cae61={'method':_0xa2c6('0x4'),'uri':url[_0xa2c6('0x5')](_0x1909fb[_0xa2c6('0x6')],_0xa2c6('0x7')),'form':{'grant_type':'password','username':_0x1909fb['username'],'password':_0x1909fb[_0xa2c6('0x8')]},'json':!![]};return rp(_0x5cae61)[_0xa2c6('0x9')](function(_0x3d1aa0){var _0x11aa17={'method':_0xa2c6('0x4'),'uri':url[_0xa2c6('0x5')](_0x1909fb[_0xa2c6('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1909fb[_0xa2c6('0xb')]||_0xa2c6('0xc'),'channelId':_0xa2c6('0xd'),'conversation':{'id':_0x54904b[_0xa2c6('0xe')]},'from':{'id':_0x54904b['callerid'],'name':_0x54904b[_0xa2c6('0xf')]},'recipient':{'id':_0x54904b['dnid'],'name':_0x54904b[_0xa2c6('0x10')]},'text':_0x1909fb[_0xa2c6('0x11')],'channelData':{}},'headers':{'Authorization':_0xa2c6('0x12')+_0x3d1aa0[_0xa2c6('0x13')]},'json':!![]};if(_0x1909fb['project']){_0x11aa17[_0xa2c6('0x14')][_0xa2c6('0x15')][_0xa2c6('0x16')]=_0x1909fb['project'];}if(_0x1909fb[_0xa2c6('0x17')]=='1'){_0x11aa17[_0xa2c6('0x14')][_0xa2c6('0x15')][_0xa2c6('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa2c6('0x19')};}if(_0x1909fb['custom_action']){_0x11aa17[_0xa2c6('0x14')][_0xa2c6('0x15')][_0xa2c6('0x1a')]=_0x1909fb[_0xa2c6('0x1b')];if(_0x1909fb[_0xa2c6('0x1c')]){_0x11aa17[_0xa2c6('0x14')]['channelData'][_0xa2c6('0x1d')]=_0x1909fb['custom_action_data'];}}logger[_0xa2c6('0x1e')](JSON[_0xa2c6('0x1f')](_0x11aa17));return rp(_0x11aa17);});}; \ 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 5652706..429de3b 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 _0x9830=['./lib/api','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x9830,0x19a));var _0x0983=function(_0x223b71,_0x597bfb){_0x223b71=_0x223b71-0x0;var _0x4131e4=_0x9830[_0x223b71];return _0x4131e4;};'use strict';var asr=require(_0x0983('0x0'));module[_0x0983('0x1')]=function(_0x10413f,_0x302a5e,_0x3e44b0,_0xe93843){return asr(_0x10413f,_0x302a5e,_0x3e44b0,_0xe93843);}; \ No newline at end of file +var _0xdb4c=['./lib/api'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xdb4c,0xc0));var _0xcdb4=function(_0x1e9d33,_0x1c3e5e){_0x1e9d33=_0x1e9d33-0x0;var _0x149b05=_0xdb4c[_0x1e9d33];return _0x149b05;};'use strict';var asr=require(_0xcdb4('0x0'));module['exports']=function(_0x16a9fb,_0x1d8769,_0x17df5b,_0x2333b2){return asr(_0x16a9fb,_0x1d8769,_0x17df5b,_0x2333b2);}; \ 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 04c51f9..1966139 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 _0x636b=['Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','info'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x636b,0x1b4));var _0xb636=function(_0x34eec8,_0x47ae64){_0x34eec8=_0x34eec8-0x0;var _0x4d2948=_0x636b[_0x34eec8];return _0x4d2948;};'use strict';var BPromise=require(_0xb636('0x0'));var _=require(_0xb636('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb636('0x2'));var crypto=require(_0xb636('0x3'));var logger=require(_0xb636('0x4'))(_0xb636('0x5'));module[_0xb636('0x6')]=function(_0xb7558e,_0x318192,_0xf0c539,_0x16da75){return new BPromise(function(_0x1f2733,_0x4cdf7a){logger['info'](_0xb636('0x7'),_0x16da75||_0xb636('0x8'));var _0x251896=new WebSocket(_0x16da75||_0xb636('0x8'),{'perMessageDeflate':![]});var _0x5ac565='';var _0x1aa434='0';var _0x7fbde4='1';var _0x2a782b=_0xb636('0x9');function _0x5be68e(_0xe26796){var _0x47b03b=crypto[_0xb636('0xa')](_0xb636('0xb'));_0x47b03b[_0xb636('0xc')](_0xe26796);return _0x47b03b['digest'](_0xb636('0xd'));}function _0x38751(){try{logger[_0xb636('0xe')](_0xb636('0xf'));var _0x1c149e=moment()[_0xb636('0x10')]();var _0x4c5dd7=_0x5be68e(_0x1c149e+_0x318192+_0xf0c539);_0x251896['send'](JSON[_0xb636('0x11')]({'appID':_0x318192,'timestamp':_0x1c149e,'appKey':_0x4c5dd7}));var _0x1e98be=fs['createReadStream'](_0xb7558e);_0x1e98be['on'](_0xb636('0x12'),function(_0x17fae8){_0x251896[_0xb636('0x13')](_0x17fae8);});_0x1e98be['on'](_0xb636('0x14'),function(){_0x251896[_0xb636('0x13')](_0xb636('0x15'));});}catch(_0x537d21){logger[_0xb636('0x16')](_0xb636('0x17'),JSON[_0xb636('0x11')](_0x537d21));_0x251896[_0xb636('0x18')]();}}function _0xca86ef(_0x2502c4){try{if(_0x2502c4){var _0x3bbfe9=JSON[_0xb636('0x19')](_0x2502c4);switch(_0x3bbfe9[_0xb636('0x1a')]){case 0x0:if(_0x3bbfe9[_0xb636('0x1b')]){if(_0x3bbfe9[_0xb636('0x1b')][_0xb636('0x1c')]){logger[_0xb636('0xe')](_0xb636('0x1d'),JSON[_0xb636('0x11')](_0x3bbfe9['result'][_0xb636('0x1e')]));_0x5ac565=_0x3bbfe9[_0xb636('0x1b')]['hypotheses'][0x0][_0xb636('0x1f')];_0x1aa434=_0x3bbfe9[_0xb636('0x1b')][_0xb636('0x1e')][0x0]['likelihood'];_0x7fbde4='0';_0x2a782b=_0xb636('0x20');_0x251896[_0xb636('0x18')]();}}break;case 0x1:logger[_0xb636('0xe')](_0xb636('0x9'));_0x7fbde4='1';_0x2a782b=_0xb636('0x9');break;case 0x2:logger[_0xb636('0xe')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x7fbde4='2';_0x2a782b=_0xb636('0x21');break;case 0x9:logger[_0xb636('0xe')](_0xb636('0x22'));_0x7fbde4='9';_0x2a782b='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x7fbde4='10';_0x2a782b=_0xb636('0x23');break;case 0xb:logger[_0xb636('0xe')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x7fbde4='11';_0x2a782b=_0xb636('0x24');}}}catch(_0x4f996e){logger[_0xb636('0x16')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xb636('0x11')](_0x4f996e));_0x251896[_0xb636('0x18')]();}}function _0x14e2f2(){logger[_0xb636('0xe')](_0xb636('0x25'));_0x1f2733({'transcript':_0x5ac565,'confidence':_0x1aa434,'status':_0x7fbde4,'status_message':_0x2a782b});}function _0x106fb1(_0x35e404){logger['error'](_0xb636('0x26'));if(!_[_0xb636('0x27')](_0x35e404)){logger['error'](_[_0xb636('0x28')](_0x35e404)?JSON[_0xb636('0x11')](_0x35e404):_0x35e404);}}_0x251896['on']('open',_0x38751);_0x251896['on']('message',_0xca86ef);_0x251896['on'](_0xb636('0x14'),_0x14e2f2);_0x251896['on'](_0xb636('0x16'),_0x106fb1);});}; \ No newline at end of file +var _0xda61=['Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','lodash','crypto','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex'];(function(_0x51b169,_0x5efbc2){var _0x12605a=function(_0x570f5e){while(--_0x570f5e){_0x51b169['push'](_0x51b169['shift']());}};_0x12605a(++_0x5efbc2);}(_0xda61,0x197));var _0x1da6=function(_0x543bbb,_0x58b3a9){_0x543bbb=_0x543bbb-0x0;var _0x14dbb3=_0xda61[_0x543bbb];return _0x14dbb3;};'use strict';var BPromise=require('bluebird');var _=require(_0x1da6('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x1da6('0x1'));var logger=require('../../../../../../config/logger')(_0x1da6('0x2'));module[_0x1da6('0x3')]=function(_0x127246,_0x234588,_0x3daf00,_0x19819e){return new BPromise(function(_0x24c8dd,_0x2fbcc6){logger[_0x1da6('0x4')]('Tilde\x20URI',_0x19819e||_0x1da6('0x5'));var _0x3d039a=new WebSocket(_0x19819e||_0x1da6('0x5'),{'perMessageDeflate':![]});var _0x15eee7='';var _0x2ea9ef='0';var _0x25a531='1';var _0x31a617=_0x1da6('0x6');function _0x3f7230(_0x2e0c64){var _0x554649=crypto['createHash'](_0x1da6('0x7'));_0x554649[_0x1da6('0x8')](_0x2e0c64);return _0x554649[_0x1da6('0x9')](_0x1da6('0xa'));}function _0x239af3(){try{logger[_0x1da6('0x4')](_0x1da6('0xb'));var _0x3be5a0=moment()[_0x1da6('0xc')]();var _0x41a622=_0x3f7230(_0x3be5a0+_0x234588+_0x3daf00);_0x3d039a[_0x1da6('0xd')](JSON[_0x1da6('0xe')]({'appID':_0x234588,'timestamp':_0x3be5a0,'appKey':_0x41a622}));var _0x424f35=fs[_0x1da6('0xf')](_0x127246);_0x424f35['on']('data',function(_0x39a953){_0x3d039a[_0x1da6('0xd')](_0x39a953);});_0x424f35['on'](_0x1da6('0x10'),function(){_0x3d039a[_0x1da6('0xd')](_0x1da6('0x11'));});}catch(_0x32c946){logger[_0x1da6('0x12')](_0x1da6('0x13'),JSON['stringify'](_0x32c946));_0x3d039a[_0x1da6('0x14')]();}}function _0x48eb02(_0x3333bb){try{if(_0x3333bb){var _0x2ccee2=JSON[_0x1da6('0x15')](_0x3333bb);switch(_0x2ccee2[_0x1da6('0x16')]){case 0x0:if(_0x2ccee2[_0x1da6('0x17')]){if(_0x2ccee2[_0x1da6('0x17')][_0x1da6('0x18')]){logger['info'](_0x1da6('0x19'),JSON[_0x1da6('0xe')](_0x2ccee2[_0x1da6('0x17')][_0x1da6('0x1a')]));_0x15eee7=_0x2ccee2[_0x1da6('0x17')][_0x1da6('0x1a')][0x0][_0x1da6('0x1b')];_0x2ea9ef=_0x2ccee2[_0x1da6('0x17')]['hypotheses'][0x0][_0x1da6('0x1c')];_0x25a531='0';_0x31a617='Success.';_0x3d039a[_0x1da6('0x14')]();}}break;case 0x1:logger['info'](_0x1da6('0x6'));_0x25a531='1';_0x31a617=_0x1da6('0x6');break;case 0x2:logger[_0x1da6('0x4')](_0x1da6('0x1d'));_0x25a531='2';_0x31a617=_0x1da6('0x1d');break;case 0x9:logger[_0x1da6('0x4')](_0x1da6('0x1e'));_0x25a531='9';_0x31a617=_0x1da6('0x1e');break;case 0xa:logger[_0x1da6('0x4')](_0x1da6('0x1f'));_0x25a531='10';_0x31a617=_0x1da6('0x1f');break;case 0xb:logger[_0x1da6('0x4')](_0x1da6('0x20'));_0x25a531='11';_0x31a617=_0x1da6('0x20');}}}catch(_0x30babd){logger[_0x1da6('0x12')](_0x1da6('0x21'),JSON[_0x1da6('0xe')](_0x30babd));_0x3d039a[_0x1da6('0x14')]();}}function _0x4a7f76(){logger[_0x1da6('0x4')](_0x1da6('0x22'));_0x24c8dd({'transcript':_0x15eee7,'confidence':_0x2ea9ef,'status':_0x25a531,'status_message':_0x31a617});}function _0x103f4a(_0x3f5530){logger['error'](_0x1da6('0x23'));if(!_['isNil'](_0x3f5530)){logger[_0x1da6('0x12')](_[_0x1da6('0x24')](_0x3f5530)?JSON[_0x1da6('0xe')](_0x3f5530):_0x3f5530);}}_0x3d039a['on'](_0x1da6('0x25'),_0x239af3);_0x3d039a['on']('message',_0x48eb02);_0x3d039a['on'](_0x1da6('0x10'),_0x4a7f76);_0x3d039a['on'](_0x1da6('0x12'),_0x103f4a);});}; \ 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 3af6e08..804094c 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 _0x312f=['exports'];(function(_0x3c492b,_0x4861e2){var _0x4371cf=function(_0x5dc311){while(--_0x5dc311){_0x3c492b['push'](_0x3c492b['shift']());}};_0x4371cf(++_0x4861e2);}(_0x312f,0x11f));var _0xf312=function(_0x36e4d7,_0x38a9fe){_0x36e4d7=_0x36e4d7-0x0;var _0xbcfd3a=_0x312f[_0x36e4d7];return _0xbcfd3a;};var asr=require('./asr');module[_0xf312('0x0')]={'asr':asr}; \ No newline at end of file +var _0xb048=['./asr','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb048,0x160));var _0x8b04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb048[_0x321bb2];return _0x9c12ed;};var asr=require(_0x8b04('0x0'));module[_0x8b04('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 32b4133..191495c 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x233dc0,_0x2866ad){var _0x1fc160=function(_0x51e38b){while(--_0x51e38b){_0x233dc0['push'](_0x233dc0['shift']());}};_0x1fc160(++_0x2866ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4c493c8..95376fa 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 _0x3070=['Trying\x20ispeech\x20TTS\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','email','user','subject','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','getTrunkById','getSound','getSoundById','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','agicommand','createSquareRecording','uniqueid','calleridname','context','priority','accountcode','arg_1','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','callerid','isNil','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','replace','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','method','timeout','includes','POST','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','isArray','length','%s.%s','stringify','split','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','mrcpsynth','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','result','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','label','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','opts','url','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','out','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','DIAL','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block'];(function(_0x41f4e8,_0x55b05a){var _0x8a0693=function(_0x12e7d0){while(--_0x12e7d0){_0x41f4e8['push'](_0x41f4e8['shift']());}};_0x8a0693(++_0x55b05a);}(_0x3070,0x75));var _0x0307=function(_0x26b814,_0x12071e){_0x26b814=_0x26b814-0x0;var _0x4f4b2c=_0x3070[_0x26b814];return _0x4f4b2c;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x0307('0x0'));var sh=require('shelljs');var odbc=require(_0x0307('0x1'))();var rs=require(_0x0307('0x2'));var moment=require(_0x0307('0x3'));var Mustache=require(_0x0307('0x4'));var rp=require(_0x0307('0x5'));var logger=require(_0x0307('0x6'))('agi');var config=require('../../config/environment');var shared=require(_0x0307('0x7'));var scripts=require(_0x0307('0x8'));var FILES_PATH=_0x0307('0x9');var recursiveMapAttributes=[_0x0307('0xa'),'rawBody'];var verticesWithRetry=[_0x0307('0xb'),_0x0307('0xc'),'getsecretdigits'];var AGIVertices=function(_0x13a24d,_0x4553f4,_0x187fb3){this[_0x0307('0xd')]=_0x13a24d;this[_0x0307('0xe')]=_0x4553f4;this[_0x0307('0xf')]=_0x187fb3;};AGIVertices[_0x0307('0x10')][_0x0307('0x11')]=function(_0x233966,_0x5905cc){this[_0x0307('0xe')]['getVariableById'](_0x233966)[_0x0307('0x12')](function(_0x224226){_0x5905cc(null,_0x224226?_0x224226[_0x0307('0x13')]:![]);})[_0x0307('0x14')](function(_0x161f31){_0x5905cc(_0x161f31);});};AGIVertices[_0x0307('0x10')][_0x0307('0x15')]=function(_0x39af75,_0x42d7c9){this[_0x0307('0xe')][_0x0307('0x16')](_0x39af75)[_0x0307('0x12')](function(_0x131320){_0x42d7c9(null,_0x131320?_0x131320[_0x0307('0x13')]:![]);})[_0x0307('0x14')](function(_0x546c92){_0x42d7c9(_0x546c92);});};AGIVertices[_0x0307('0x10')][_0x0307('0x17')]=function(_0x286f72,_0x5f11a5){this['rpc'][_0x0307('0x18')](_0x286f72)[_0x0307('0x12')](function(_0x38dfd6){_0x5f11a5(null,_0x38dfd6?_0x38dfd6[_0x0307('0x13')]:![]);})[_0x0307('0x14')](function(_0x16433e){_0x5f11a5(_0x16433e);});};AGIVertices[_0x0307('0x10')]['getSquareOdbc']=function(_0x3782a1,_0x53da8f){this[_0x0307('0xe')][_0x0307('0x19')](_0x3782a1)[_0x0307('0x12')](function(_0x31ac5){_0x53da8f(null,_0x31ac5?_0x31ac5['dsn']:![]);})[_0x0307('0x14')](function(_0x20c1c1){_0x53da8f(_0x20c1c1);});};AGIVertices[_0x0307('0x10')]['getUser']=function(_0x57ee29,_0x9c1223){this[_0x0307('0xe')]['getUserById'](_0x57ee29)[_0x0307('0x12')](function(_0x5f17ff){_0x9c1223(null,_0x5f17ff?_0x5f17ff[_0x0307('0x13')]:![]);})[_0x0307('0x14')](function(_0x34c776){_0x9c1223(_0x34c776);});};AGIVertices[_0x0307('0x10')]['getTrunk']=function(_0x49c3d7,_0xd0c3de){this[_0x0307('0xe')][_0x0307('0x1a')](_0x49c3d7)[_0x0307('0x12')](function(_0x3fde2f){_0xd0c3de(null,_0x3fde2f?_0x3fde2f[_0x0307('0x13')]:![]);})['catch'](function(_0x6de0d1){_0xd0c3de(_0x6de0d1);});};AGIVertices['prototype'][_0x0307('0x1b')]=function(_0x438ed4,_0x14e909){var _0x5b2f5f=this;this[_0x0307('0xe')][_0x0307('0x1c')](_0x438ed4)[_0x0307('0x12')](function(_0x46c723){_0x14e909(null,_0x46c723?_0x5b2f5f['getSoundPath'](_0x46c723[_0x0307('0x1d')]):![]);})['catch'](function(_0x319766){_0x14e909(_0x319766);});};AGIVertices[_0x0307('0x10')][_0x0307('0x1e')]=function(_0x57701c,_0x4d6db9){this[_0x0307('0xe')]['getMailAccountById'](_0x57701c)[_0x0307('0x12')](function(_0x1e0d07){_0x4d6db9(null,_0x1e0d07?_0x1e0d07:![]);})['catch'](function(_0x1363b1){_0x4d6db9(_0x1363b1);});};AGIVertices['prototype'][_0x0307('0x1f')]=function(_0x57c259,_0xf4e315,_0x297119){this[_0x0307('0xf')][_0x0307('0x1f')](_0x57c259,_0xf4e315)[_0x0307('0x12')](function(){_0x297119(null);})[_0x0307('0x14')](function(_0x3129ba){_0x297119(_0x3129ba);});};AGIVertices['prototype'][_0x0307('0x20')]=function(_0x798089,_0x5c46c6){this['rpc'][_0x0307('0x21')](_0x798089)['then'](function(_0x365b85){if(_0x365b85){if(_0x365b85[_0x0307('0x22')]){_0x5c46c6(null,[_0x365b85[_0x0307('0x23')]]);}else{_0x5c46c6(null,_[_0x0307('0x24')](_0x365b85[_0x0307('0x25')],_0x0307('0x23')));}}else{_0x5c46c6(null,![]);}})[_0x0307('0x14')](function(_0x5eabf0){_0x5c46c6(_0x5eabf0);});};AGIVertices[_0x0307('0x10')][_0x0307('0x26')]=function(_0x3cfb42){return util[_0x0307('0x27')](_0x0307('0x28'),FILES_PATH,_0x3cfb42);};AGIVertices[_0x0307('0x10')][_0x0307('0x29')]=function(_0x2e65d6,_0x318d95,_0x78873d){odbc[_0x0307('0x2a')](_0x2e65d6,function(_0x127172){if(_0x127172){logger[_0x0307('0x2b')](_0x0307('0x2c'),_0x127172);_0x78873d(_0x127172);}else{logger[_0x0307('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0x0307('0x2e')](_0x318d95,function(_0x3b67c5,_0x5b0a3d){if(_0x3b67c5){logger[_0x0307('0x2d')](_0x0307('0x2f'),_0x318d95);_0x78873d(_0x3b67c5);}else{logger[_0x0307('0x2d')](_0x0307('0x30'),_0x318d95);odbc['close'](function(_0x4eabf2){if(_0x4eabf2){logger[_0x0307('0x2b')](_0x0307('0x31'),_0x4eabf2);}_0x78873d(null,_0x5b0a3d);});}});}});};AGIVertices[_0x0307('0x10')]['getSmsAccount']=function(_0x247eea,_0x5aa127){this[_0x0307('0xe')]['getSmsAccountById'](_0x247eea)[_0x0307('0x12')](function(_0x5c1b91){_0x5aa127(null,_0x5c1b91?_0x5c1b91:![]);})[_0x0307('0x14')](function(_0x504672){_0x5aa127(_0x504672);});};AGIVertices[_0x0307('0x10')][_0x0307('0x32')]=function(_0x1c019c,_0x2937bb){this[_0x0307('0xe')][_0x0307('0x32')](_0x1c019c)[_0x0307('0x12')](function(_0x4be9ac){_0x2937bb(null,_0x4be9ac);})[_0x0307('0x14')](function(_0x1296b8){_0x2937bb(_0x1296b8);});};AGIVertices['prototype'][_0x0307('0x33')]=function(_0x418ebf,_0x40d54c,_0x4ac849){this['rpc'][_0x0307('0x33')]({'uniqueid':this[_0x0307('0xd')]['uniqueid'],'node':_0x418ebf['label'],'application':_0x418ebf[_0x0307('0x34')],'data':_0x40d54c||null,'project_name':this[_0x0307('0xd')]['arg_1'],'callerid':this[_0x0307('0xd')]['callerid']})[_0x0307('0x12')](function(_0x529600){if(_0x4ac849){_0x4ac849(null,_0x529600);}})[_0x0307('0x14')](function(_0x7f6f54){if(_0x4ac849){_0x4ac849(_0x7f6f54);}});};AGIVertices[_0x0307('0x10')][_0x0307('0x35')]=function(_0x2cd252,_0x5a7084,_0xa925ef,_0x22a420){this['rpc'][_0x0307('0x35')]({'uniqueid':this['channel'][_0x0307('0x36')],'callerid':this[_0x0307('0xd')]['callerid'],'calleridname':this[_0x0307('0xd')][_0x0307('0x37')],'context':this[_0x0307('0xd')][_0x0307('0x38')],'extension':this[_0x0307('0xd')]['extension'],'priority':this[_0x0307('0xd')][_0x0307('0x39')],'accountcode':this[_0x0307('0xd')][_0x0307('0x3a')],'dnid':this[_0x0307('0xd')]['dnid'],'projectName':this[_0x0307('0xd')][_0x0307('0x3b')],'saveName':_0x5a7084,'filename':_0x2cd252['file']||_0x5a7084,'savePath':_0xa925ef})[_0x0307('0x12')](function(_0x310a99){_0x22a420(null,_0x310a99);})[_0x0307('0x14')](function(_0xe11ab5){_0x22a420(_0xe11ab5);});};AGIVertices[_0x0307('0x10')][_0x0307('0x3c')]=function(_0x39232a,_0x300d04,_0x4f62b1,_0x5b802d,_0x5567d5){this[_0x0307('0xe')]['createSquareMessage']({'uniqueid':this[_0x0307('0xd')][_0x0307('0x36')],'body':_0x39232a,'direction':_0x300d04,'providerName':_0x4f62b1,'providerResponse':_0x5b802d})['then'](function(_0x463047){if(_0x5567d5){_0x5567d5(null,_0x463047);}})[_0x0307('0x14')](function(_0x4f4e1f){if(_0x5567d5){_0x5567d5(_0x4f4e1f);}});};AGIVertices['prototype'][_0x0307('0x3d')]=function(_0xdb258d,_0x895c88){this[_0x0307('0xe')]['createCmContact']({'firstName':_[_0x0307('0x3e')](_0xdb258d[_0x0307('0x13')])||_['isNil'](_0xdb258d[_0x0307('0x13')])?_0x0307('0x3f')+Math[_0x0307('0x40')]():_0xdb258d[_0x0307('0x13')],'lastName':_[_0x0307('0x3e')](_0xdb258d['lastName'])||_['isNil'](_0xdb258d['lastName'])?null:_0xdb258d[_0x0307('0x41')],'phone':_0xdb258d['phone'],'ListId':_0xdb258d[_0x0307('0x42')],'scheduledat':_0xdb258d[_0x0307('0x43')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x0307('0x44'),'description':_0x0307('0x45')+_0xdb258d[_0x0307('0x43')][_0x0307('0x46')](),'priority':_0xdb258d[_0x0307('0x47')]})['then'](function(_0x3d195a){_0x895c88(null,_0x3d195a);})['catch'](function(_0x55ea23){_0x895c88(_0x55ea23);});};AGIVertices['prototype'][_0x0307('0x48')]=function(_0x2de5c8,_0xb38b24){this[_0x0307('0xe')][_0x0307('0x49')](_0x2de5c8)[_0x0307('0x12')](function(_0x103da3){_0xb38b24(null,_0x103da3?_0x103da3['name']:![]);})[_0x0307('0x14')](function(_0x222a4c){_0xb38b24(_0x222a4c);});};AGIVertices['prototype'][_0x0307('0x4a')]=function(_0xef2b6c,_0x1d3e36,_0xa67646){var _0x4139d4={'role':'agent'};_0x4139d4[_0xef2b6c]=this[_0x0307('0xd')]['callerid'];this[_0x0307('0xe')][_0x0307('0x4a')](_0x4139d4,_0x1d3e36,this[_0x0307('0xd')]['uniqueid'])[_0x0307('0x12')](function(_0x547e1b){_0xa67646(null,_['isNil'](_0x547e1b)?![]:!![]);})[_0x0307('0x14')](function(_0x5f2a0f){logger[_0x0307('0x2b')](_0x5f2a0f);_0xa67646(null,![]);});};AGIVertices[_0x0307('0x10')][_0x0307('0x4b')]=function(_0x1a25f2,_0x284686){var _0x53f7e7={'role':_0x0307('0x4c')};_0x53f7e7[_0x1a25f2]=this[_0x0307('0xd')][_0x0307('0x4d')];this[_0x0307('0xe')][_0x0307('0x4b')](_0x53f7e7)['then'](function(_0x2f0234){_0x284686(null,_[_0x0307('0x4e')](_0x2f0234)?![]:!![]);})[_0x0307('0x14')](function(_0x525dec){logger['error'](_0x525dec);_0x284686(null,![]);});};AGIVertices[_0x0307('0x10')][_0x0307('0x4f')]=function(_0x577670,_0x3e9e37){var _0x51d7a5={'role':_0x0307('0x4c')};_0x51d7a5[_0x577670]=this[_0x0307('0xd')][_0x0307('0x4d')];this['rpc']['agentLogout'](_0x51d7a5)[_0x0307('0x12')](function(_0x57f4b5){_0x3e9e37(null,_[_0x0307('0x4e')](_0x57f4b5)?![]:!![]);})[_0x0307('0x14')](function(_0x46ce1d){logger[_0x0307('0x2b')](_0x46ce1d);_0x3e9e37(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x5bf15b,_0x5e698f){var _0x3bad90={'role':'agent'};_0x3bad90[_0x5bf15b]=this[_0x0307('0xd')][_0x0307('0x4d')];var _0x2918cc=_0x5bf15b!=_0x0307('0x50')?util['format'](_0x0307('0x51'),_0x0307('0x52'),this['channel']['callerid']):undefined;this[_0x0307('0xe')][_0x0307('0x53')](_0x3bad90,_0x2918cc)[_0x0307('0x12')](function(_0x9fe9b5){_0x5e698f(null,_['isNil'](_0x9fe9b5)?![]:!![]);})[_0x0307('0x14')](function(_0x426418){logger[_0x0307('0x2b')](_0x426418);_0x5e698f(null,![]);});};AGIVertices[_0x0307('0x10')][_0x0307('0x54')]=function(_0x4ec703,_0xa9acdb){sh['exec'](_['trim'](_0x4ec703),function(_0xb65b98,_0x5f2152){var _0x102a14=_0x5f2152[_0x0307('0x55')](/(\r\n|\n|\r)/gm,'');_0xa9acdb(null,_0x102a14);});};AGIVertices[_0x0307('0x10')]['googleCloudTTS']=function(_0x29b930,_0x287dec){scripts['googleCloudTTS'](_0x29b930[_0x0307('0x56')],_0x29b930[_0x0307('0x57')]||_0x0307('0x58'),_0x29b930['text'],_0x29b930[_0x0307('0x59')]||_0x0307('0x5a'),_0x29b930[_0x0307('0x5b')]||_0x0307('0x5c'),_0x29b930[_0x0307('0x5d')]||'MP3')['then'](function(_0x36d7a1){_0x287dec(null,_0x36d7a1);})['catch'](function(_0x41d915){_0x287dec(_0x41d915);});};AGIVertices[_0x0307('0x10')][_0x0307('0x5e')]=function(_0x5d8a3b,_0x1eceec){scripts[_0x0307('0x5e')](_0x5d8a3b[_0x0307('0x58')],_0x5d8a3b[_0x0307('0x5f')]||'en',0x1)[_0x0307('0x12')](function(_0x2c7f84){_0x1eceec(null,_0x2c7f84);})['catch'](function(_0xf44895){_0x1eceec(_0xf44895);});};AGIVertices[_0x0307('0x10')][_0x0307('0x60')]=function(_0x37fce5,_0x3ecdaf){var _0x2574dd={'uri':_0x37fce5['url'],'method':_0x37fce5[_0x0307('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x37fce5[_0x0307('0x62')])==='number'&&parseInt(_0x37fce5['timeout'])>=0x1?parseInt(_0x37fce5['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x0307('0x63')]([_0x0307('0x64'),'PUT'],_0x2574dd[_0x0307('0x61')]['toUpperCase']())){try{_0x2574dd[_0x0307('0x65')]=_0x37fce5[_0x0307('0x66')]?JSON[_0x0307('0x67')](_0x37fce5[_0x0307('0x66')]):{};}catch(_0x5f9fc2){logger['error'](_0x0307('0x68'),_0x5f9fc2);}}try{_0x2574dd[_0x0307('0x69')]=_0x37fce5[_0x0307('0xa')]?JSON[_0x0307('0x67')](_0x37fce5[_0x0307('0xa')]):{};}catch(_0xc49e5e){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0xc49e5e);}if(_0x37fce5[_0x0307('0x6a')]){try{var _0x2ebed5=require(_0x37fce5[_0x0307('0x6a')])[_0x0307('0x6b')](this,_0x2574dd);_0x2574dd[_0x0307('0x6c')]=Mustache[_0x0307('0x6d')](_0x37fce5['url'],_0x2ebed5,{},['$$','$$']);if(_0x2574dd['headers']){_0x2574dd[_0x0307('0x69')]=JSON[_0x0307('0x67')](Mustache[_0x0307('0x6d')](JSON['stringify'](_0x2574dd[_0x0307('0x69')]),_0x2ebed5,{},['$$','$$']));}if(_0x2574dd[_0x0307('0x65')]){_0x2574dd['body']=JSON['parse'](Mustache[_0x0307('0x6d')](JSON['stringify'](_0x2574dd['body']),_0x2ebed5,{},['$$','$$']));}}catch(_0x1134a2){logger[_0x0307('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1134a2);}}rp(_0x2574dd)[_0x0307('0x12')](function(_0x109765){var _0x3ab192={'statusCode':_0x109765['statusCode']||0xc8,'statusMessage':_0x109765['statusMessage']||'OK','headers':_0x109765[_0x0307('0x69')]||{},'body':_0x109765[_0x0307('0x65')]||{}};_0x3ecdaf(null,_0x3ab192);})[_0x0307('0x14')](function(_0x2144f9){var _0x166f32={'statusCode':_0x2144f9[_0x0307('0x6e')]||0x1f4,'statusMessage':_0x2144f9['message']||_0x0307('0x6f'),'headers':_0x2144f9[_0x0307('0x70')][_0x0307('0x69')]||{},'body':_0x2144f9['options'][_0x0307('0x65')]||{}};_0x3ecdaf(null,_0x166f32);});};AGIVertices[_0x0307('0x10')][_0x0307('0x71')]=function(_0xdb2a90,_0x313480){scripts[_0x0307('0x71')](this[_0x0307('0xd')][_0x0307('0x36')],_0xdb2a90[_0x0307('0x72')],_0xdb2a90[_0x0307('0x58')],_0xdb2a90[_0x0307('0x73')]||'en')[_0x0307('0x12')](function(_0x5ce8ae){_0x313480(null,_0x5ce8ae);})['catch'](function(_0x459fa6){_0x313480(_0x459fa6);});};AGIVertices['prototype'][_0x0307('0x74')]=function(_0x22beb6,_0x46e356){scripts[_0x0307('0x74')](this[_0x0307('0xd')][_0x0307('0x36')],_0x22beb6[_0x0307('0x75')],_0x22beb6[_0x0307('0x76')],_0x22beb6['private_key'],_0x22beb6[_0x0307('0x58')],_0x22beb6[_0x0307('0x77')]||'en')[_0x0307('0x12')](function(_0x28a2a4){_0x46e356(null,_0x28a2a4);})[_0x0307('0x14')](function(_0xae1334){_0x46e356(_0xae1334);});};AGIVertices[_0x0307('0x10')]['sestekNDA']=function(_0x5bbab0,_0x263d58){scripts[_0x0307('0x78')](this[_0x0307('0xd')],_0x5bbab0)[_0x0307('0x12')](function(_0xfacd2e){_0x263d58(null,_0xfacd2e);})[_0x0307('0x14')](function(_0x1e0b8c){_0x263d58(_0x1e0b8c);});};AGIVertices[_0x0307('0x10')][_0x0307('0x79')]=function(_0x1eab13,_0x38d543){scripts[_0x0307('0x79')](_0x1eab13[_0x0307('0x72')],_0x1eab13[_0x0307('0x58')],_0x1eab13[_0x0307('0x7a')]||'en-US',_0x1eab13[_0x0307('0x7b')])[_0x0307('0x12')](function(_0x468c18){_0x38d543(null,_0x468c18);})[_0x0307('0x14')](function(_0x2cc9e3){_0x38d543(_0x2cc9e3);});};AGIVertices[_0x0307('0x10')][_0x0307('0x7c')]=function(_0x5bbe17,_0x2e9659,_0x587472){scripts[_0x0307('0x7c')](_0x2e9659,_0x5bbe17[_0x0307('0x72')],_0x5bbe17[_0x0307('0x7d')]||_0x0307('0x5a'),this[_0x0307('0x7e')](_0x5bbe17[_0x0307('0x7f')])?_0x5bbe17[_0x0307('0x7f')]:undefined)[_0x0307('0x12')](function(_0x3ed5de){_0x587472(null,_0x3ed5de);})['catch'](function(_0x17a9e6){_0x587472(_0x17a9e6);});};AGIVertices[_0x0307('0x10')]['awsPolly']=function(_0x1aa6ee,_0x1521a1){scripts[_0x0307('0x80')](_0x1aa6ee['aws_access_key_id'],_0x1aa6ee[_0x0307('0x81')],_0x1aa6ee[_0x0307('0x82')],_0x1aa6ee[_0x0307('0x83')]||_0x0307('0x84'),_0x1aa6ee[_0x0307('0x58')],_0x1aa6ee[_0x0307('0x85')]||_0x0307('0x58'))[_0x0307('0x12')](function(_0x426e77){_0x1521a1(null,_0x426e77);})[_0x0307('0x14')](function(_0xa3c2cb){_0x1521a1(_0xa3c2cb);});};AGIVertices['prototype'][_0x0307('0x86')]=function(_0x3641cd,_0x212384){scripts['awsLex'](this['channel'][_0x0307('0x36')],_0x3641cd[_0x0307('0x87')],_0x3641cd[_0x0307('0x81')],_0x3641cd['aws_lex_region'],_0x3641cd[_0x0307('0x58')],_0x3641cd[_0x0307('0x88')])[_0x0307('0x12')](function(_0x38c64f){_0x212384(null,_0x38c64f);})['catch'](function(_0xce7b7){_0x212384(_0xce7b7);});};AGIVertices[_0x0307('0x10')][_0x0307('0x89')]=function(_0x300673,_0x27db20,_0x57c605){scripts[_0x0307('0x89')](_0x27db20,_0x300673[_0x0307('0x72')],_0x300673[_0x0307('0x8a')]||_0x0307('0x5a'))[_0x0307('0x12')](function(_0x5bbf14){_0x57c605(null,_0x5bbf14);})[_0x0307('0x14')](function(_0x1c0b7b){_0x57c605(_0x1c0b7b);});};AGIVertices[_0x0307('0x10')][_0x0307('0x8b')]=function(_0x9ec3ec,_0x451a89,_0x1512e8){scripts[_0x0307('0x8b')](_0x451a89,_0x9ec3ec[_0x0307('0x8c')],_0x9ec3ec[_0x0307('0x8d')],_0x9ec3ec['uri'])[_0x0307('0x12')](function(_0x43a2be){_0x1512e8(null,_0x43a2be);})[_0x0307('0x14')](function(_0x11be4d){_0x1512e8(_0x11be4d);});};AGIVertices[_0x0307('0x10')][_0x0307('0x8e')]=function(_0x3d739e){var _0x56ba66=_['includes'](verticesWithRetry,_0x3d739e[_0x0307('0x34')])?_0x3d739e:_[_0x0307('0x8f')](_0x3d739e);for(var _0x2e3d12 in _0x56ba66){if(_0x56ba66[_0x0307('0x90')](_0x2e3d12)){if(_0x56ba66[_0x2e3d12]&&_[_0x0307('0x91')](_0x56ba66[_0x2e3d12])){if(_['includes'](recursiveMapAttributes,_0x2e3d12)){_0x56ba66[_0x2e3d12]=this[_0x0307('0x92')](_0x56ba66[_0x2e3d12]);}else{_0x56ba66[_0x2e3d12]=this[_0x0307('0x93')](_0x56ba66[_0x2e3d12]);}}}}return _0x56ba66;};AGIVertices['prototype'][_0x0307('0x94')]=function(_0x2feb52){for(var _0x2f4f7b in _0x2feb52){if(_0x2feb52['hasOwnProperty'](_0x2f4f7b)){if(_['isPlainObject'](_0x2feb52[_0x2f4f7b])){this[_0x0307('0x94')](_0x2feb52[_0x2f4f7b]);}else if(_['isArray'](_0x2feb52[_0x2f4f7b])){for(var _0x229407=0x0;_0x229407<_0x2feb52[_0x2f4f7b]['length'];_0x229407++){this[_0x0307('0x94')](_0x2feb52[_0x2f4f7b][_0x229407]);}}else if(_['isString'](_0x2feb52[_0x2f4f7b])){_0x2feb52[_0x2f4f7b]=this[_0x0307('0x93')](_0x2feb52[_0x2f4f7b]);}}}};AGIVertices[_0x0307('0x10')]['saveRestApiResult']=function(_0x26042d,_0x43fb58){for(var _0x377c27 in _0x26042d){if(_0x26042d[_0x0307('0x90')](_0x377c27)){if(_[_0x0307('0x95')](_0x26042d[_0x377c27])){if(!_[_0x0307('0x3e')](_0x26042d[_0x377c27])){this[_0x0307('0x96')](_0x26042d[_0x377c27],util[_0x0307('0x27')]('%s.%s',_0x43fb58,_0x377c27));}}else if(_[_0x0307('0x97')](_0x26042d[_0x377c27])){for(var _0x38aaf8=0x0;_0x38aaf8<_0x26042d[_0x377c27][_0x0307('0x98')];_0x38aaf8++){this['saveRestApiResult'](_0x26042d[_0x377c27][_0x38aaf8],util['format']('%s.%s',_0x43fb58,_0x377c27+'['+_0x38aaf8+']'));}}else{if(!_[_0x0307('0x4e')](_0x26042d[_0x377c27])){this['channel']['setVariable'](util[_0x0307('0x27')](_0x0307('0x99'),_0x43fb58,_0x377c27),_0x26042d[_0x377c27]);}}}}};AGIVertices[_0x0307('0x10')][_0x0307('0x92')]=function(_0x5cba52){try{var _0x6159b8=JSON['parse'](_0x5cba52);this[_0x0307('0x94')](_0x6159b8);return JSON[_0x0307('0x9a')](_0x6159b8);}catch(_0x4adb3f){return this[_0x0307('0x93')](_0x5cba52);}};AGIVertices['prototype'][_0x0307('0x93')]=function(_0xb3e2de){var _0x7ad89f=_0xb3e2de[_0x0307('0x9b')]('{');for(var _0x52bc02=0x1;_0x52bc02<_0x7ad89f[_0x0307('0x98')];_0x52bc02+=0x1){var _0x2838b3=_0x7ad89f[_0x52bc02][_0x0307('0x9b')]('}');if(_0x2838b3[_0x0307('0x98')]>0x1){_0xb3e2de=_0xb3e2de['replaceAll']('{'+_0x2838b3[0x0]+'}',this['channel'][_0x0307('0x11')](_0x2838b3[0x0])[_0x0307('0x9c')]||_0x2838b3[0x0]);}}if(_0x7ad89f['length']===0x1){return _0xb3e2de[_0x0307('0x46')]();}return this[_0x0307('0x93')](_0xb3e2de);};AGIVertices[_0x0307('0x10')][_0x0307('0x9d')]=function(_0x4355eb,_0x50f648){var _0x35a06c=this[_0x0307('0xd')][_0x0307('0x11')](_0x4355eb);if(_0x35a06c['result']===-0x1){return _0x35a06c;}logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x9e'),_0x50f648,_0x35a06c['extra']));return this[_0x0307('0xd')][_0x0307('0x9f')](_0x50f648,_0x35a06c[_0x0307('0x9c')]);};AGIVertices[_0x0307('0x10')][_0x0307('0x7e')]=function(_0x25899e){return _0x25899e&&_0x25899e!=='0'&&_0x25899e!=='-1'&&_0x25899e!=='';};AGIVertices[_0x0307('0x10')][_0x0307('0xa0')]=function(_0x5629a7){this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x5629a7,'-');_0x5629a7['retry']=_0x5629a7['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0307('0x10')][_0x0307('0xa1')]=function(_0x9ea1af){logger[_0x0307('0x2d')](util[_0x0307('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x9ea1af['label']));if(!this[_0x0307('0x7e')](_0x9ea1af[_0x0307('0x58')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xa3'));}var _0x5bf919='\x22'+_0x9ea1af[_0x0307('0x58')]+'\x22';if(this['isConfigured'](_0x9ea1af['options'])){_0x5bf919+=','+_0x9ea1af[_0x0307('0x70')];}var _0x116a20=this[_0x0307('0xd')][_0x0307('0xa4')](_0x0307('0xa5'),_0x5bf919);if(_0x116a20['result']===-0x1){return _0x116a20;}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0xa6'),_0x5bf919));};AGIVertices[_0x0307('0x10')]['mrcprecog']=function(_0x3c7c13){logger['info'](util[_0x0307('0x27')](_0x0307('0xa7'),_0x3c7c13['label']));if(!this['isConfigured'](_0x3c7c13[_0x0307('0xa8')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xa9'));}var _0x434d83=_0x3c7c13[_0x0307('0xa8')];if(this['isConfigured'](_0x3c7c13[_0x0307('0x70')])){_0x434d83+=','+_0x3c7c13['options'];}var _0x5d4724=this[_0x0307('0xd')]['exec']('MRCPRecog',_0x434d83);if(_0x5d4724[_0x0307('0xaa')]===-0x1){return _0x5d4724;}var _0x99a9af=this[_0x0307('0x9d')](_0x0307('0xab'),_0x0307('0xac'));if(_0x99a9af['result']===-0x1){return _0x99a9af;}var _0x3569dd=this[_0x0307('0x9d')](_0x0307('0xad'),_0x0307('0xae'));if(_0x3569dd[_0x0307('0xaa')]===-0x1){return _0x3569dd;}var _0x5cf230=this[_0x0307('0x9d')](_0x0307('0xaf'),'MRCP_RECOG_INSTANCE');if(_0x5cf230[_0x0307('0xaa')]===-0x1){return _0x5cf230;}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0xb0'),_0x434d83));};AGIVertices[_0x0307('0x10')][_0x0307('0xb1')]=function(_0x409111){logger[_0x0307('0x2d')](util['format'](_0x0307('0xb2'),_0x409111[_0x0307('0xb3')]));return this[_0x0307('0xd')]['agi']([_0x409111[_0x0307('0xb4')],_0x409111['args']]);};AGIVertices[_0x0307('0x10')]['answer']=function(_0x4bb33c){logger['info'](util[_0x0307('0x27')](_0x0307('0xb5'),_0x4bb33c[_0x0307('0xb3')]));if(this[_0x0307('0x7e')](_0x4bb33c[_0x0307('0x62')])){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0xb6'),_0x4bb33c[_0x0307('0x62')]));var _0x4b3787=this[_0x0307('0xd')]['wait'](_0x4bb33c['timeout']);if(_0x4b3787[_0x0307('0xaa')]===-0x1){return _0x4b3787;}}return this[_0x0307('0xd')][_0x0307('0xb7')]();};AGIVertices[_0x0307('0x10')][_0x0307('0x44')]=function(_0xc8ff65){logger[_0x0307('0x2d')](util['format'](_0x0307('0xb8'),_0xc8ff65[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0xc8ff65[_0x0307('0x42')])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0xc8ff65,_0x0307('0xb9'));}_0xc8ff65[_0x0307('0x43')]=moment();if(this[_0x0307('0x7e')](_0xc8ff65[_0x0307('0xba')])){_0xc8ff65[_0x0307('0x43')]=moment()[_0x0307('0xbb')](_0xc8ff65[_0x0307('0xba')],'minutes');}if(!this[_0x0307('0x7e')](_0xc8ff65[_0x0307('0x47')])){_0xc8ff65['callback_priority']=0x2;}this[_0x0307('0x3d')][_0x0307('0x6b')](this,_0xc8ff65);return this[_0x0307('0xd')]['noop'](util[_0x0307('0x27')](_0x0307('0xbc'),_0xc8ff65[_0x0307('0xbd')],_0xc8ff65['list_id'],_0xc8ff65[_0x0307('0x43')]));};AGIVertices[_0x0307('0x10')][_0x0307('0xbe')]=function(_0x9f69e8){logger[_0x0307('0x2d')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x9f69e8[_0x0307('0xb3')]));var _0x3bbd62=this['channel']['exec'](_0x9f69e8[_0x0307('0xbf')],_0x9f69e8[_0x0307('0x70')]);if(_0x3bbd62[_0x0307('0xaa')]===-0x1){return _0x3bbd62;}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')]('Executed\x20command\x20%s\x20%s',_0x9f69e8['application'],_0x9f69e8[_0x0307('0x70')]));};AGIVertices[_0x0307('0x10')][_0x0307('0xc0')]=function(_0x35ebda){logger['info'](util['format'](_0x0307('0xc1'),_0x35ebda[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x35ebda['text'])){return this['channel'][_0x0307('0xa2')](_0x0307('0xa3'));}var _0x3cd2ab='\x22'+_0x35ebda[_0x0307('0x58')]+'\x22';if(this['isConfigured'](_0x35ebda['options'])){_0x3cd2ab+=','+_0x35ebda[_0x0307('0x70')];}var _0x178cae=this[_0x0307('0xd')][_0x0307('0xa4')]('MRCPSynth',_0x3cd2ab);if(_0x178cae[_0x0307('0xaa')]===-0x1){return _0x178cae;}return this[_0x0307('0xd')]['noop'](util[_0x0307('0x27')](_0x0307('0xa6'),_0x3cd2ab));};AGIVertices['prototype'][_0x0307('0xc2')]=function(_0x617809){logger['info'](util[_0x0307('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x617809['label']));if(!this[_0x0307('0x7e')](_0x617809['text'])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xa3'));}var _0x264c08='\x22'+_0x617809[_0x0307('0x58')]+'\x22';if(this[_0x0307('0x7e')](_0x617809[_0x0307('0x70')])){_0x264c08+=','+_0x617809[_0x0307('0x70')];}var _0x4ac891=this[_0x0307('0xd')]['exec'](_0x0307('0xa5'),_0x264c08);if(_0x4ac891[_0x0307('0xaa')]===-0x1){return _0x4ac891;}return this[_0x0307('0xd')]['noop'](util[_0x0307('0x27')](_0x0307('0xa6'),_0x264c08));};AGIVertices[_0x0307('0x10')][_0x0307('0xc3')]=function(_0x55047e){logger['info'](util[_0x0307('0x27')](_0x0307('0xc4'),_0x55047e[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x55047e['grammar'])){return this[_0x0307('0xd')][_0x0307('0xa2')]('no\x20grammar\x20configured');}var _0x36d410=_0x55047e['grammar'];if(this['isConfigured'](_0x55047e[_0x0307('0x70')])){_0x36d410+=','+_0x55047e[_0x0307('0x70')];}var _0x4c07af=this[_0x0307('0xd')]['exec'](_0x0307('0xc5'),_0x36d410);if(_0x4c07af[_0x0307('0xaa')]===-0x1){return _0x4c07af;}var _0x391ae0=this[_0x0307('0x9d')](_0x0307('0xab'),_0x0307('0xc6'));if(_0x391ae0[_0x0307('0xaa')]===-0x1){return _0x391ae0;}var _0x555ff8=this[_0x0307('0x9d')]('RECOG_INPUT()',_0x0307('0xc7'));if(_0x555ff8['result']===-0x1){return _0x555ff8;}var _0x1a16f1=this[_0x0307('0x9d')]('RECOG_INSTANCE()',_0x0307('0xc8'));if(_0x1a16f1[_0x0307('0xaa')]===-0x1){return _0x1a16f1;}return this['channel'][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0xb0'),_0x36d410));};AGIVertices[_0x0307('0x10')][_0x0307('0xc9')]=function(_0x29df95){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0xca'),_0x29df95['label']));if(!this[_0x0307('0x7e')](_0x29df95[_0x0307('0xa8')])){return this[_0x0307('0xd')][_0x0307('0xa2')]('no\x20grammar\x20configured');}var _0x62518f=_0x29df95[_0x0307('0xa8')];if(this[_0x0307('0x7e')](_0x29df95[_0x0307('0x70')])){_0x62518f+=','+_0x29df95[_0x0307('0x70')];}var _0x4a8fe0=this[_0x0307('0xd')][_0x0307('0xa4')](_0x0307('0xc5'),_0x62518f);if(_0x4a8fe0[_0x0307('0xaa')]===-0x1){return _0x4a8fe0;}var _0x58e496=this[_0x0307('0x9d')](_0x0307('0xab'),_0x0307('0xcb'));if(_0x58e496['result']===-0x1){return _0x58e496;}var _0xb79acd=this[_0x0307('0x9d')]('RECOG_INPUT()',_0x0307('0xcc'));if(_0xb79acd['result']===-0x1){return _0xb79acd;}var _0xf36092=this[_0x0307('0x9d')](_0x0307('0xaf'),_0x0307('0xcd'));if(_0xf36092[_0x0307('0xaa')]===-0x1){return _0xf36092;}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0xb0'),_0x62518f));};AGIVertices[_0x0307('0x10')]['database']=function(_0x2cba30){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0xce'),_0x2cba30[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x2cba30['odbc_id'])){return this['channel'][_0x0307('0x2b')](_0x2cba30,_0x0307('0xcf'));}var _0x2a0c22=this[_0x0307('0xd0')]['sync'](this,_0x2cba30[_0x0307('0xd1')]);if(!_0x2a0c22){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x2cba30,'no\x20odbc\x20database\x20found');}if(!this[_0x0307('0x7e')](_0x2cba30['query'])){return this[_0x0307('0xd')]['error'](_0x2cba30,_0x0307('0xd2'));}var _0x53538a=_0x2cba30[_0x0307('0x2e')][_0x0307('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x0307('0xd')][_0x0307('0xa2')](util['format'](_0x0307('0xd3'),_0x53538a));var _0x3342fc=this['getQueryOdbc'][_0x0307('0x6b')](this,_0x2a0c22,_0x53538a);this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x2cba30,_0x53538a);if(!this[_0x0307('0x7e')](_0x2cba30['variable_id'])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xd4'));}var _0x5b9cc8=this['getVariable'][_0x0307('0x6b')](this,_0x2cba30[_0x0307('0xd5')]);if(!_0x5b9cc8){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x2cba30,_0x0307('0xd6'));}var _0x4e601f=this;_0x3342fc['forEach'](function(_0x4a4987,_0x5182c0){Object[_0x0307('0xd7')](_0x4a4987)[_0x0307('0xd8')](function(_0x59abba){_0x4e601f[_0x0307('0xd')]['setVariable'](util[_0x0307('0x27')](_0x0307('0xd9'),_0x5b9cc8,_0x5182c0,_0x59abba),_0x4a4987[_0x59abba]);});});this[_0x0307('0xd')][_0x0307('0x9f')](util[_0x0307('0x27')](_0x0307('0xda'),_0x5b9cc8),_0x3342fc[_0x0307('0x98')]);return this[_0x0307('0xd')][_0x0307('0xa2')](util['format']('variable\x20%s\x20set',_0x5b9cc8));};AGIVertices[_0x0307('0x10')][_0x0307('0xdb')]=function(_0x9d2fbc){logger['debug'](util[_0x0307('0x27')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x9d2fbc[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x9d2fbc['sip_id'])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x9d2fbc,_0x0307('0xdc'));}var _0xee1597=this[_0x0307('0xdd')]['sync'](this,_0x9d2fbc[_0x0307('0xde')]);if(!_0xee1597){return this[_0x0307('0xd')]['error'](_0x9d2fbc,_0x0307('0xdf'));}var _0x52cf30=this[_0x0307('0xd')][_0x0307('0xa4')]('DIAL',[util[_0x0307('0x27')]('SIP/%s',_0xee1597),_0x9d2fbc[_0x0307('0x62')],_0x9d2fbc[_0x0307('0xe0')],_0x9d2fbc[_0x0307('0xe1')]]);if(_0x52cf30[_0x0307('0xaa')]===-0x1){return _0x52cf30;}return this[_0x0307('0xd')][_0x0307('0xa2')](util['format'](_0x0307('0xe2'),'DIAL'));};AGIVertices[_0x0307('0x10')][_0x0307('0xe3')]=function(_0x45577d){logger[_0x0307('0x2d')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x45577d[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x45577d['key'])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xe4'));}if(!this[_0x0307('0x7e')](_0x45577d[_0x0307('0x58')])){return this[_0x0307('0xd')][_0x0307('0xa2')]('no\x20text\x20configured');}this['channel'][_0x0307('0xe5')]=!![];this[_0x0307('0x33')](_0x45577d);this[_0x0307('0x3c')](_0x45577d['text'],'in','','');this[_0x0307('0xd')]['noop'](util[_0x0307('0x27')](_0x0307('0xe6'),_0x45577d[_0x0307('0x58')]));var _0x62ff84=this['googleDialogflow']['sync'](this,_0x45577d);if(_0x62ff84){for(var _0x2d2c26 in _0x62ff84){if(_0x62ff84['hasOwnProperty'](_0x2d2c26)){this[_0x0307('0xd')]['setVariable'](util['format'](_0x0307('0xe7'),_0x2d2c26[_0x0307('0xe8')]()),_0x62ff84[_0x2d2c26]);}}this[_0x0307('0x3c')](_0x62ff84['speech'],_0x0307('0xe9'),'dialogflow','');return this[_0x0307('0xd')][_0x0307('0xa2')](util['format']('Dialogflow\x20Result\x20%s',_0x62ff84[_0x0307('0xea')]));}return this[_0x0307('0xd')][_0x0307('0x2b')](_0x45577d,_0x0307('0xeb'));};AGIVertices['prototype'][_0x0307('0xec')]=function(_0xabd63b){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0xed'),_0xabd63b[_0x0307('0xb3')]));if(!this['isConfigured'](_0xabd63b[_0x0307('0x75')])){return this[_0x0307('0xd')]['noop']('no\x20project_id\x20configured');}if(!this['isConfigured'](_0xabd63b[_0x0307('0x76')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xee'));}if(!this['isConfigured'](_0xabd63b[_0x0307('0xef')])){return this['channel'][_0x0307('0xa2')](_0x0307('0xf0'));}if(!this['isConfigured'](_0xabd63b[_0x0307('0x77')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xf1'));}if(!this[_0x0307('0x7e')](_0xabd63b[_0x0307('0x58')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xa3'));}this[_0x0307('0xd')][_0x0307('0xe5')]=!![];this[_0x0307('0x33')](_0xabd63b);this[_0x0307('0x3c')](_0xabd63b['text'],'in','','');this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')]('Trying\x20DialogflowV2:\x20%s',_0xabd63b[_0x0307('0x58')]));var _0x385c26=this['googleDialogflowV2'][_0x0307('0x6b')](this,_0xabd63b);if(_0x385c26){for(var _0x510291 in _0x385c26){if(_0x385c26[_0x0307('0x90')](_0x510291)){if(_0x510291!==_0x0307('0xf2')){this['channel'][_0x0307('0x9f')](util[_0x0307('0x27')](_0x0307('0xe7'),_0x510291[_0x0307('0xe8')]()),_0x385c26[_0x510291]);}}}this[_0x0307('0x3c')](_0x385c26[_0x0307('0xea')],_0x0307('0xe9'),_0x0307('0xec'),_0x385c26[_0x0307('0xf2')]);return this[_0x0307('0xd')][_0x0307('0xa2')](util['format'](_0x0307('0xf3'),_0x385c26[_0x0307('0xea')]));}return this['channel'][_0x0307('0x2b')](_0xabd63b,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x0307('0x10')][_0x0307('0xf4')]=function(_0x2b8594){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0xf5'),_0x2b8594[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x2b8594[_0x0307('0xf6')])){return this[_0x0307('0xd')]['noop'](_0x0307('0xf7'));}if(!this[_0x0307('0x7e')](_0x2b8594[_0x0307('0xf8')])){return this[_0x0307('0xd')]['noop']('no\x20username\x20configured');}if(!this['isConfigured'](_0x2b8594[_0x0307('0xf9')])){return this[_0x0307('0xd')][_0x0307('0xa2')]('no\x20password\x20configured');}if(!this[_0x0307('0x7e')](_0x2b8594[_0x0307('0xfa')])){return this[_0x0307('0xd')][_0x0307('0xa2')]('no\x20text\x20configured');}this['channel'][_0x0307('0xe5')]=!![];this[_0x0307('0x33')](_0x2b8594);this['createSquareMessage'](_0x2b8594[_0x0307('0x58')],'in','','');this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')]('Trying\x20SestekNDA:\x20%s',_0x2b8594[_0x0307('0x58')]));var _0x398fcd=this['sestekNDA'][_0x0307('0x6b')](this,_0x2b8594);if(_0x398fcd){for(var _0x3875ce in _0x398fcd){if(_0x398fcd[_0x0307('0x90')](_0x3875ce)){this['channel'][_0x0307('0x9f')](util[_0x0307('0x27')](_0x0307('0xfb'),_0x3875ce[_0x0307('0xe8')]()),_0x398fcd[_0x3875ce]);}}this[_0x0307('0x3c')](_0x398fcd['speech'],_0x0307('0xe9'),_0x0307('0xf4'),'');if(_0x398fcd[_0x0307('0xfc')]){this[_0x0307('0xd')]['noop'](util['format'](_0x0307('0xfd'),_0x398fcd[_0x0307('0xfc')]));var _0x1db99b=this[_0x0307('0xd')][_0x0307('0xfe')](_0x398fcd[_0x0307('0xfc')]);try{fs[_0x0307('0xff')](_0x398fcd[_0x0307('0xfc')]+_0x0307('0x100'));}catch(_0xf02f2f){logger['error'](_0xf02f2f);}return _0x1db99b;}else{return this[_0x0307('0xd')]['noop'](util['format'](_0x0307('0x101'),_0x398fcd['speech']));}}return this[_0x0307('0xd')]['error'](_0x2b8594,_0x0307('0x102'));};AGIVertices['prototype'][_0x0307('0x103')]=function(_0x42fe0e){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x104'),_0x42fe0e[_0x0307('0xb3')]));return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0x103'));};AGIVertices['prototype'][_0x0307('0x105')]=function(_0x330b85){logger[_0x0307('0x2d')](util[_0x0307('0x27')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x330b85[_0x0307('0xb3')]));var _0x23aaf2='';if(_0x330b85['trunk_id']){if(!this[_0x0307('0x7e')](_0x330b85[_0x0307('0x106')])){return this['channel']['error'](_0x330b85,_0x0307('0x107'));}else{var _0x57f6db=parseInt(_0x330b85['trunk_id'],0xa);if(isNaN(_0x57f6db)){_0x23aaf2=_0x330b85[_0x0307('0x106')];}else{_0x23aaf2=this['getTrunk'][_0x0307('0x6b')](this,_0x330b85[_0x0307('0x106')]);if(!_0x23aaf2){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x330b85,_0x0307('0x108'));}}}}else if(_0x330b85[_0x0307('0x109')]){_0x23aaf2=_0x330b85[_0x0307('0x109')];}else{return this[_0x0307('0xd')]['error'](_0x330b85,'no\x20trunk\x20selected');}var _0x33d44d=this[_0x0307('0xd')][_0x0307('0xa4')](_0x0307('0x10a'),[util[_0x0307('0x27')]('SIP/%s/%s',_0x23aaf2,_0x330b85[_0x0307('0xbd')]),_0x330b85['timeout'],_0x330b85['opts'],_0x330b85['url']]);if(_0x33d44d[_0x0307('0xaa')]===-0x1){return _0x33d44d;}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0xe2'),'DIAL'));};AGIVertices[_0x0307('0x10')][_0x0307('0x10b')]=function(_0x39b488){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x10c'),_0x39b488['label']));return this['channel'][_0x0307('0xa2')]('finally');};AGIVertices['prototype']['getdigits']=function(_0x16bb1e){logger['info'](util['format'](_0x0307('0x10d'),_0x16bb1e[_0x0307('0xb3')]));if(_0x16bb1e[_0x0307('0x10e')]===0x0){return this[_0x0307('0xa0')](_0x16bb1e);}_0x16bb1e['retry']-=0x1;if(!this[_0x0307('0x7e')](_0x16bb1e[_0x0307('0x10f')])){return this['channel'][_0x0307('0x2b')](_0x16bb1e,_0x0307('0x110'));}var _0x1eb532=this[_0x0307('0x1b')][_0x0307('0x6b')](this,_0x16bb1e[_0x0307('0x10f')]);if(!_0x1eb532){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x16bb1e,_0x0307('0x111'));}if(!this[_0x0307('0x7e')](_0x16bb1e['variable_id'])){return this[_0x0307('0xd')][_0x0307('0x2b')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x16597d=this[_0x0307('0xd')][_0x0307('0x112')](_0x1eb532,_0x16bb1e['response'],_0x16bb1e['maxdigit']);var _0x55b068=_0x16597d[_0x0307('0xaa')]?_0x16597d[_0x0307('0xaa')][_0x0307('0x46')]():'';logger[_0x0307('0x2d')]('test',JSON['stringify'](_0x16597d));if(_0x16597d['result']===-0x1){this['createSquareDetailsReport'][_0x0307('0x6b')](this,_0x16bb1e,_0x55b068);return _0x16597d;}else if(_0x16597d[_0x0307('0x9c')]==='timeout'){_0x16597d['result']=_0x55b068[_0x0307('0x98')]>=parseInt(_0x16bb1e[_0x0307('0x113')])?'x':'i';}else{_0x16597d[_0x0307('0xaa')]=_0x55b068[_0x0307('0x98')]>=parseInt(_0x16bb1e['mindigit'])&&_0x55b068[_0x0307('0x98')]<=parseInt(_0x16bb1e['maxdigit'])?'x':'i';}var _0x1c553c=this['getVariable']['sync'](this,_0x16bb1e[_0x0307('0xd5')]);if(!_0x1c553c){return this['channel']['error'](_0x16bb1e,_0x0307('0xd6'));}this[_0x0307('0xd')][_0x0307('0x9f')](_0x1c553c,_0x55b068);if(this['isConfigured'](_0x16bb1e[_0x0307('0x114')])){var _0x34cd86=parseInt(_0x16bb1e[_0x0307('0x114')],0xa);var _0x4cdea6=rs[_0x0307('0x115')]({'charset':'*','length':_0x34cd86});var _0x7dfb71=_0x55b068[_0x0307('0x98')];if(_0x7dfb71>0x0){if(_0x7dfb71>_0x34cd86){this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x16bb1e,_0x16bb1e[_0x0307('0x116')]===_0x0307('0x117')?_0x4cdea6+_0x55b068[_0x0307('0x118')](_0x34cd86):_0x55b068[_0x0307('0x118')](0x0,_0x7dfb71-_0x34cd86)+_0x4cdea6);}else{this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x16bb1e,rs[_0x0307('0x115')]({'charset':'*','length':_0x7dfb71}));}}else{this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x16bb1e,'');}}else{this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x16bb1e,_0x55b068);}return _0x16597d;};AGIVertices[_0x0307('0x10')][_0x0307('0x119')]=function(_0x367396){logger[_0x0307('0x2d')](util[_0x0307('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x367396[_0x0307('0xb3')]));return this['getdigits'](_0x367396);};AGIVertices['prototype']['goal']=function(_0x17cfe0){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x11a'),_0x17cfe0[_0x0307('0xb3')]));this['createSquareDetailsReport'][_0x0307('0x6b')](this,_0x17cfe0,_0x17cfe0[_0x0307('0x11b')]);return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x11c'),_0x17cfe0[_0x0307('0x11b')]));};AGIVertices[_0x0307('0x10')]['awspolly']=function(_0x521733){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x11d'),_0x521733[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x521733[_0x0307('0x87')])||!this[_0x0307('0x7e')](_0x521733[_0x0307('0x81')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0x11e'));}if(!this[_0x0307('0x7e')](_0x521733[_0x0307('0x58')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xa3'));}this[_0x0307('0xd')]['noop'](util['format'](_0x0307('0x11f'),_0x521733[_0x0307('0x58')]));var _0x2565c4=this['awsPolly']['sync'](this,_0x521733);if(_0x2565c4){this['channel'][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x120'),_0x2565c4));var _0x509be5=this[_0x0307('0xd')]['streamFile'](_0x2565c4);try{fs['unlink'](_0x2565c4+_0x0307('0x100'));}catch(_0x3bbdd3){logger[_0x0307('0x2b')](_0x3bbdd3);}return _0x509be5;}return this[_0x0307('0xd')]['error'](_0x521733,_0x0307('0x121'));};AGIVertices[_0x0307('0x10')][_0x0307('0x122')]=function(_0x53e3a8){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x123'),_0x53e3a8[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x53e3a8[_0x0307('0x87')])||!this[_0x0307('0x7e')](_0x53e3a8['aws_secret_access_key'])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0x11e'));}if(!this[_0x0307('0x7e')](_0x53e3a8['aws_bot_name'])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0x124'));}if(!this['isConfigured'](_0x53e3a8[_0x0307('0x58')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xa3'));}this[_0x0307('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x53e3a8);this[_0x0307('0x3c')](_0x53e3a8[_0x0307('0x58')],'in','','');this[_0x0307('0xd')]['noop'](util[_0x0307('0x27')](_0x0307('0x125'),_0x53e3a8[_0x0307('0x58')]));var _0x4279f4=this[_0x0307('0x86')][_0x0307('0x6b')](this,_0x53e3a8);if(_0x4279f4){for(var _0x2a9371 in _0x4279f4){if(_0x4279f4[_0x0307('0x90')](_0x2a9371)&&_[_0x0307('0x91')](_0x4279f4[_0x2a9371])){this[_0x0307('0xd')][_0x0307('0x9f')](util['format']('AWS_LEX_%s',_0x2a9371[_0x0307('0xe8')]()),_0x4279f4[_0x2a9371]);}}if(_[_0x0307('0x4e')](_0x4279f4['message'])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0x126'));}else{this[_0x0307('0x3c')](_0x4279f4['message'],'out',_0x0307('0x127'),'');return this['channel'][_0x0307('0xa2')](util['format'](_0x0307('0x128'),_0x4279f4['message']));}}return this['channel'][_0x0307('0x2b')](_0x53e3a8,_0x0307('0x129'));};AGIVertices[_0x0307('0x10')][_0x0307('0x12a')]=function(_0x58276d){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x12b'),_0x58276d[_0x0307('0xb3')],_0x58276d['timeout']));if(!this[_0x0307('0x7e')](_0x58276d['key'])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xe4'));}var _0x1f56f7=_0x0307('0x12c');var _0x589b7f=util['format'](_0x0307('0x12d'),FILES_PATH,rs[_0x0307('0x115')](0x4));var _0x8c86c0=util[_0x0307('0x27')]('%s.%s',_0x589b7f,_0x1f56f7);var _0x14ee94=!![];if(_0x58276d['beep']===_0x0307('0x12e')){_0x14ee94=![];}var _0x993f7=this[_0x0307('0xd')][_0x0307('0x12f')](_0x589b7f,_0x1f56f7,_0x58276d[_0x0307('0x130')],_0x58276d[_0x0307('0x62')],undefined,_0x14ee94);if(_0x993f7['result']!==-0x1){this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x131'),_0x8c86c0));var _0x324744=this['googleASR'][_0x0307('0x6b')](this,_0x58276d,_0x8c86c0);if(_0x324744){for(var _0x4420bc in _0x324744){if(_0x324744[_0x0307('0x90')](_0x4420bc)){this[_0x0307('0xd')][_0x0307('0x9f')](util[_0x0307('0x27')](_0x0307('0x132'),_0x4420bc[_0x0307('0xe8')]()),_0x324744[_0x4420bc]);}}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x324744)));}}return _0x993f7;};AGIVertices[_0x0307('0x10')][_0x0307('0x133')]=function(_0x2b76f0){logger[_0x0307('0x2d')](util[_0x0307('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x2b76f0[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x2b76f0[_0x0307('0x8c')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0x134'));}if(!this[_0x0307('0x7e')](_0x2b76f0['appsecret'])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0x135'));}var _0x208aea=_0x0307('0x12c');var _0x4be3de=util[_0x0307('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x0307('0x115')](0x4));var _0x4e0fc2=util[_0x0307('0x27')](_0x0307('0x99'),_0x4be3de,_0x208aea);var _0x5ec8ff=!![];if(_0x2b76f0['beep']===_0x0307('0x12e')){_0x5ec8ff=![];}var _0x2d8faf=this[_0x0307('0xd')][_0x0307('0x12f')](_0x4be3de,_0x208aea,_0x2b76f0['intKey'],_0x2b76f0[_0x0307('0x62')],undefined,_0x5ec8ff);if(_0x2d8faf['result']!==-0x1){this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')]('tilde\x20%s\x20file\x20created',_0x4e0fc2));var _0x19056e=this[_0x0307('0x8b')][_0x0307('0x6b')](this,_0x2b76f0,_0x4e0fc2);if(_0x19056e){for(var _0x25dde2 in _0x19056e){if(_0x19056e[_0x0307('0x90')](_0x25dde2)){this['channel'][_0x0307('0x9f')](util[_0x0307('0x27')]('TILDE_ASR_%s',_0x25dde2[_0x0307('0xe8')]()),_0x19056e[_0x25dde2]);}}return this[_0x0307('0xd')][_0x0307('0xa2')](util['format'](_0x0307('0x136'),JSON['stringify'](_0x19056e)));}}return _0x2d8faf;};AGIVertices[_0x0307('0x10')][_0x0307('0x137')]=function(_0x31b0a0){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x138'),_0x31b0a0['label']));return this['channel'][_0x0307('0x139')](_0x31b0a0[_0x0307('0x38')],_0x31b0a0[_0x0307('0x13a')],_0x31b0a0['priority']);};AGIVertices[_0x0307('0x10')][_0x0307('0x13b')]=function(_0x56f21c){logger['info'](util[_0x0307('0x27')](_0x0307('0x13c'),_0x56f21c[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x56f21c[_0x0307('0x13d')])){return this[_0x0307('0xd')]['error'](_0x56f21c,_0x0307('0x13e'));}try{var _0x2d17df=eval(_0x56f21c[_0x0307('0x13d')])?'true':_0x0307('0x13f');this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x140'),_0x56f21c['condition'],_0x2d17df));return{'code':0xc8,'result':_0x2d17df};}catch(_0x3949e1){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x0307('0x10')]['gotoiftime']=function(_0x4e6100){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x141'),_0x4e6100['label']));if(!this['isConfigured'](_0x4e6100[_0x0307('0x142')])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x4e6100,_0x0307('0x143'));}var _0x6453c2=this[_0x0307('0x20')][_0x0307('0x6b')](this,_0x4e6100[_0x0307('0x142')]);if(!_0x6453c2){return this['channel'][_0x0307('0x2b')](_0x4e6100,_0x0307('0x144'));}for(var _0xe564b7=0x0;_0xe564b7<_0x6453c2[_0x0307('0x98')];_0xe564b7+=0x1){var _0x6fd4a8=this[_0x0307('0xd')][_0x0307('0x11')](util[_0x0307('0x27')](_0x0307('0x145'),_0x6453c2[_0xe564b7]));if(_0x6fd4a8[_0x0307('0xaa')]===-0x1){return _0x6fd4a8;}logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x146'),_0x6453c2[_0xe564b7],_0x6fd4a8[_0x0307('0x9c')]));if(_0x6fd4a8[_0x0307('0x9c')]===_0x0307('0x147')){logger['info'](util[_0x0307('0x27')](_0x0307('0x146'),_0x6453c2[_0xe564b7],_0x0307('0x147')));this[_0x0307('0xd')]['noop'](util['format'](_0x0307('0x146'),_0x6453c2[_0xe564b7],_0x0307('0x147')));return{'code':0xc8,'result':_0x0307('0x147')};}else{logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x146'),_0x6453c2[_0xe564b7],_0x0307('0x13f')));this[_0x0307('0xd')]['noop'](util[_0x0307('0x27')](_0x0307('0x146'),_0x6453c2[_0xe564b7],_0x0307('0x13f')));}}return{'code':0xc8,'result':_0x0307('0x13f')};};AGIVertices[_0x0307('0x10')]['hangup']=function(_0x216e27){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x148'),_0x216e27['label']));return this[_0x0307('0xd')][_0x0307('0x149')]();};AGIVertices[_0x0307('0x10')][_0x0307('0x14a')]=function(_0x20dbe2){logger[_0x0307('0x2d')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x20dbe2['label']));if(!this['isConfigured'](_0x20dbe2[_0x0307('0x72')])){return this['channel']['noop'](_0x0307('0xe4'));}var _0x1d7810=_0x0307('0x12c');var _0x5c2e70=util[_0x0307('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x0307('0x115')](0x4));var _0x2e9afc=util[_0x0307('0x27')](_0x0307('0x99'),_0x5c2e70,_0x1d7810);var _0x49cab1=!![];if(_0x20dbe2['beep']===_0x0307('0x12e')){_0x49cab1=![];}var _0x140bdd=this[_0x0307('0xd')][_0x0307('0x12f')](_0x5c2e70,_0x1d7810,_0x20dbe2[_0x0307('0x130')],_0x20dbe2[_0x0307('0x62')],undefined,_0x49cab1);if(_0x140bdd[_0x0307('0xaa')]!==-0x1){this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x14b'),_0x2e9afc));var _0x2ed0c5=this[_0x0307('0x7c')][_0x0307('0x6b')](this,_0x20dbe2,_0x2e9afc);if(_0x2ed0c5){for(var _0x1a4fd8 in _0x2ed0c5){if(_0x2ed0c5[_0x0307('0x90')](_0x1a4fd8)){this[_0x0307('0xd')][_0x0307('0x9f')](util[_0x0307('0x27')](_0x0307('0x14c'),_0x1a4fd8['toUpperCase']()),_0x2ed0c5[_0x1a4fd8]);}}return this[_0x0307('0xd')]['noop'](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x0307('0x9a')](_0x2ed0c5)));}}return _0x140bdd;};AGIVertices['prototype'][_0x0307('0x14d')]=function(_0x52ad78){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x14e'),_0x52ad78[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x52ad78[_0x0307('0x72')])){return this['channel']['noop'](_0x0307('0xe4'));}if(!this[_0x0307('0x7e')](_0x52ad78[_0x0307('0x58')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xa3'));}this[_0x0307('0xd')][_0x0307('0xa2')](util['format'](_0x0307('0x14f'),_0x52ad78[_0x0307('0x58')]));var _0x5660c9=this[_0x0307('0x79')]['sync'](this,_0x52ad78);if(_0x5660c9){this[_0x0307('0xd')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x5660c9));var _0x25d00f=this[_0x0307('0xd')][_0x0307('0xfe')](_0x5660c9,_0x52ad78['intKey']);try{fs['unlink'](_0x5660c9+_0x0307('0x100'));}catch(_0x3a73a9){logger[_0x0307('0x2b')](_0x3a73a9);}return _0x25d00f;}return this[_0x0307('0xd')][_0x0307('0x2b')](_0x52ad78,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x0307('0x10')]['login']=function(_0xa19011){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x150'),_0xa19011[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0xa19011['findBy'])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0xa19011,_0x0307('0x151'));}logger[_0x0307('0x2d')](util[_0x0307('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0307('0xd')][_0x0307('0x4d')],_0xa19011['findBy']));var _0x4edc66=this[_0x0307('0x53')][_0x0307('0x6b')](this,_0xa19011[_0x0307('0x152')]);if(_0x4edc66){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x153'),this[_0x0307('0xd')][_0x0307('0x4d')],_0xa19011[_0x0307('0x152')]));this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x153'),this[_0x0307('0xd')][_0x0307('0x4d')],_0xa19011['findBy']));return{'code':0xc8,'result':_0x0307('0x154')};}else{logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x155'),this[_0x0307('0xd')][_0x0307('0x4d')],_0xa19011['findBy']));this[_0x0307('0xd')][_0x0307('0xa2')](util['format'](_0x0307('0x155'),this['channel']['callerid'],_0xa19011[_0x0307('0x152')]));return{'code':0xc8,'result':_0x0307('0x156')};}};AGIVertices[_0x0307('0x10')][_0x0307('0x157')]=function(_0x2f2fe9){logger['info'](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x2f2fe9[_0x0307('0xb3')]));if(!this['isConfigured'](_0x2f2fe9[_0x0307('0x152')])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x2f2fe9,'no\x20find\x20by\x20configured');}logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x158'),this[_0x0307('0xd')][_0x0307('0x4d')],_0x2f2fe9[_0x0307('0x152')]));var _0x1e817b=this[_0x0307('0x4f')][_0x0307('0x6b')](this,_0x2f2fe9[_0x0307('0x152')]);if(_0x1e817b){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x153'),this[_0x0307('0xd')][_0x0307('0x4d')],_0x2f2fe9[_0x0307('0x152')]));this[_0x0307('0xd')]['noop'](util[_0x0307('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0307('0xd')][_0x0307('0x4d')],_0x2f2fe9[_0x0307('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0307('0x2d')](util['format'](_0x0307('0x155'),this['channel'][_0x0307('0x4d')],_0x2f2fe9[_0x0307('0x152')]));this['channel']['noop'](util[_0x0307('0x27')](_0x0307('0x155'),this[_0x0307('0xd')][_0x0307('0x4d')],_0x2f2fe9['findBy']));return{'code':0xc8,'result':_0x0307('0x156')};}};AGIVertices[_0x0307('0x10')][_0x0307('0x159')]=function(_0x29d171){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x15a'),_0x29d171[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x29d171[_0x0307('0x15b')])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x29d171,_0x0307('0x15c'));}this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x15d'),_0x29d171[_0x0307('0x15b')]));var _0x39c7ec=eval(_0x29d171[_0x0307('0x15b')]);if(!this[_0x0307('0x7e')](_0x29d171[_0x0307('0xd5')])){return this[_0x0307('0xd')][_0x0307('0xa2')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4edd39=this[_0x0307('0x11')][_0x0307('0x6b')](this,_0x29d171[_0x0307('0xd5')]);if(!_0x4edd39){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x29d171,_0x0307('0xd6'));}if(_[_0x0307('0x97')](_0x39c7ec)){var _0x5d1468=this;_0x39c7ec[_0x0307('0xd8')](function(_0x40dced,_0x9dcb28){_0x5d1468[_0x0307('0xd')][_0x0307('0x9f')](util[_0x0307('0x27')](_0x0307('0x15e'),_0x4edd39,_0x9dcb28),_0x40dced);});return this['channel']['noop'](util['format'](_0x0307('0x15f'),_0x4edd39));}else{return this[_0x0307('0xd')][_0x0307('0x9f')](_0x4edd39,_0x39c7ec);}};AGIVertices[_0x0307('0x10')][_0x0307('0xb')]=function(_0x145809){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x160'),_0x145809[_0x0307('0xb3')]));if(_0x145809[_0x0307('0x10e')]===0x0){return this[_0x0307('0xa0')](_0x145809);}_0x145809[_0x0307('0x10e')]-=0x1;if(!this[_0x0307('0x7e')](_0x145809[_0x0307('0x10f')])){return this['channel'][_0x0307('0x2b')](_0x145809,_0x0307('0x110'));}var _0x19da29=this[_0x0307('0x1b')][_0x0307('0x6b')](this,_0x145809[_0x0307('0x10f')]);if(!_0x19da29){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x145809,_0x0307('0x111'));}var _0x3ea0a1=this[_0x0307('0xd')][_0x0307('0x112')](_0x19da29,_0x145809[_0x0307('0x161')],_0x145809[_0x0307('0x162')]);var _0x5e4f24=_0x3ea0a1[_0x0307('0xaa')];if(_0x3ea0a1[_0x0307('0xaa')]===-0x1){this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x145809,'-1');return _0x3ea0a1;}else if(_0x3ea0a1[_0x0307('0x9c')]===_0x0307('0x62')){_0x3ea0a1['result']=_0x3ea0a1[_0x0307('0xaa')][_0x0307('0x98')]>0x0?_0x3ea0a1[_0x0307('0xaa')]:'t';}else if(_[_0x0307('0x3e')](_0x3ea0a1[_0x0307('0xaa')])){_0x3ea0a1[_0x0307('0xaa')]='#';_0x5e4f24='#';}if(!this['isConfigured'](_0x145809[_0x0307('0xd5')])){this[_0x0307('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x18f653=this[_0x0307('0x11')]['sync'](this,_0x145809[_0x0307('0xd5')]);if(!_0x18f653){return this['channel'][_0x0307('0x2b')](_0x145809,_0x0307('0xd6'));}this[_0x0307('0xd')][_0x0307('0x9f')](_0x18f653,_0x5e4f24);}this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x145809,_0x5e4f24);return _0x3ea0a1;};AGIVertices[_0x0307('0x10')]['noop']=function(_0x590944){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x163'),_0x590944[_0x0307('0xb3')]));return this['channel'][_0x0307('0xa2')](_0x590944[_0x0307('0x164')]||_0x590944[_0x0307('0xb3')]);};AGIVertices[_0x0307('0x10')][_0x0307('0x165')]=function(_0x215467){logger[_0x0307('0x2d')](util['format'](_0x0307('0x166'),_0x215467[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x215467[_0x0307('0x152')])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x215467,_0x0307('0x151'));}logger['info'](util[_0x0307('0x27')](_0x0307('0x158'),this[_0x0307('0xd')][_0x0307('0x4d')],_0x215467[_0x0307('0x152')]));var _0x1462a4=this[_0x0307('0x48')][_0x0307('0x6b')](this,_0x215467[_0x0307('0x167')]);var _0x246c83=this[_0x0307('0x4a')][_0x0307('0x6b')](this,_0x215467[_0x0307('0x152')],_0x1462a4);if(_0x246c83){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x153'),this[_0x0307('0xd')][_0x0307('0x4d')],_0x215467[_0x0307('0x152')]));this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x153'),this[_0x0307('0xd')][_0x0307('0x4d')],_0x215467[_0x0307('0x152')]));return{'code':0xc8,'result':_0x0307('0x154')};}else{logger[_0x0307('0x2d')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x215467[_0x0307('0x152')]));this[_0x0307('0xd')]['noop'](util['format'](_0x0307('0x153'),this['channel'][_0x0307('0x4d')],_0x215467[_0x0307('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0307('0x10')]['playback']=function(_0x3cd8f1){logger[_0x0307('0x2d')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3cd8f1[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x3cd8f1['file_id'])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x3cd8f1,_0x0307('0x110'));}var _0x2292bd=this['getSound'][_0x0307('0x6b')](this,_0x3cd8f1[_0x0307('0x10f')]);if(!_0x2292bd){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x3cd8f1,_0x0307('0x111'));}var _0x25d955=this[_0x0307('0xd')][_0x0307('0xa4')](_0x0307('0x168'),[_0x2292bd,_0x3cd8f1[_0x0307('0xe0')]]);if(_0x25d955['result']===-0x1){return _0x25d955;}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x169'),'PLAYBACK',_0x2292bd));};AGIVertices[_0x0307('0x10')][_0x0307('0x16a')]=function(_0x45db10){logger['info'](util['format'](_0x0307('0x16b'),_0x45db10['label']));if(!this[_0x0307('0x7e')](_0x45db10[_0x0307('0x16c')])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x45db10,_0x0307('0x16d'));}var _0x4d9bc7='';var _0x4609b2=parseInt(_0x45db10[_0x0307('0x16c')],0xa);if(isNaN(_0x4609b2)){_0x4d9bc7=_0x45db10['queue_id'];}else{_0x4d9bc7=this[_0x0307('0x15')][_0x0307('0x6b')](this,_0x45db10[_0x0307('0x16c')]);if(!_0x4d9bc7){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x45db10,'no\x20queue\x20found');}}var _0x2c023a='';if(this[_0x0307('0x7e')](_0x45db10[_0x0307('0x10f')])){var _0x5aaebf=this[_0x0307('0x1b')][_0x0307('0x6b')](this,_0x45db10[_0x0307('0x10f')]);if(_0x5aaebf){_0x2c023a=_0x5aaebf;}}this['createSquareDetailsReport'][_0x0307('0x6b')](this,_0x45db10,_0x4d9bc7);if(_0x45db10[_0x0307('0xe0')][_0x0307('0x16e')]('x')<0x0){_0x45db10[_0x0307('0xe0')]+='x';}if(_0x45db10[_0x0307('0xe0')][_0x0307('0x16e')]('X')<0x0){_0x45db10[_0x0307('0xe0')]+='X';}this[_0x0307('0xd')][_0x0307('0x9f')](_0x0307('0x16f'),_0x4d9bc7?_0x4d9bc7[_0x0307('0x170')]():'');var _0x3fc12f=this[_0x0307('0xd')][_0x0307('0xa4')](_0x0307('0x171'),[_0x4d9bc7,_0x45db10[_0x0307('0xe0')],_0x45db10['url'],_0x2c023a,_0x45db10[_0x0307('0x62')],_0x45db10[_0x0307('0xb1')],_0x45db10['macro'],_0x45db10[_0x0307('0x172')],'',_0x45db10[_0x0307('0x173')]]);if(_0x3fc12f[_0x0307('0xaa')]===-0x1){return _0x3fc12f;}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')]('Executed\x20command\x20%s\x20%s',_0x0307('0x171'),_0x4d9bc7));};AGIVertices['prototype'][_0x0307('0x174')]=function(_0x5f099c){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x175'),_0x5f099c['label']));var _0x3b421a=_0x5f099c[_0x0307('0x176')]||'wav';var _0x2f3fb4=util[_0x0307('0x27')](_0x0307('0x177'),this['channel']['uniqueid'],rs[_0x0307('0x115')](0x5));var _0x75871e=util[_0x0307('0x27')](_0x0307('0x178'),FILES_PATH,_0x2f3fb4,_0x3b421a);var _0x482058=util[_0x0307('0x27')](_0x0307('0x12d'),FILES_PATH,_0x2f3fb4);this['createSquareRecording'][_0x0307('0x6b')](this,_0x5f099c,_0x2f3fb4,_0x75871e);this[_0x0307('0xd')][_0x0307('0x9f')](_0x0307('0x179'),_0x2f3fb4);logger[_0x0307('0x2d')](_0x0307('0x17a'),_0x482058,_0x3b421a,_0x5f099c[_0x0307('0x17b')],_0x5f099c[_0x0307('0x62')]);return this['channel'][_0x0307('0x12f')](_0x482058,_0x3b421a,_0x5f099c[_0x0307('0x17b')],_0x5f099c['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x0307('0x17c')]=function(_0x1c0e99){logger[_0x0307('0x2d')](util['format'](_0x0307('0x17d'),_0x1c0e99['label']));if(!this['isConfigured'](_0x1c0e99[_0x0307('0xe1')])){return this[_0x0307('0xd')][_0x0307('0xa2')]('no\x20url\x20configured');}var _0x10091e=this[_0x0307('0x60')]['sync'](this,_0x1c0e99);logger[_0x0307('0x2d')](util[_0x0307('0x27')]('Response:',util[_0x0307('0x17e')](_0x10091e,{'showHidden':![],'depth':null})));if(!this[_0x0307('0x7e')](_0x1c0e99['variable_id'])){return this[_0x0307('0xd')]['noop'](_0x0307('0x17f'));}var _0x3cf949=this['getVariable'][_0x0307('0x6b')](this,_0x1c0e99[_0x0307('0xd5')]);if(!_0x3cf949){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x1c0e99,'no\x20variable\x20found');}this[_0x0307('0xd')][_0x0307('0x9f')](util['format']('%s_STATUS_CODE',_0x3cf949),_0x10091e[_0x0307('0x6e')]?_0x10091e[_0x0307('0x6e')]:_0x0307('0x180'));this[_0x0307('0xd')][_0x0307('0x9f')](util[_0x0307('0x27')]('%s_STATUS_MESSAGE',_0x3cf949),_0x10091e[_0x0307('0x181')]?_0x10091e['statusMessage']:'OK');if(_0x10091e[_0x0307('0x65')]){try{this[_0x0307('0x96')](_0x10091e[_0x0307('0x65')],_0x3cf949);}catch(_0x1b0e40){logger[_0x0307('0x2b')](util[_0x0307('0x27')](_0x0307('0x182'),_0x3cf949));}}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x183'),_0x3cf949));};AGIVertices[_0x0307('0x10')][_0x0307('0x184')]=function(_0x4db42e){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x185'),_0x4db42e[_0x0307('0xb3')]));return this[_0x0307('0xd')][_0x0307('0x186')](_0x4db42e[_0x0307('0x187')][_0x0307('0x55')](/\s+/g,''),_0x4db42e[_0x0307('0x17b')]);};AGIVertices[_0x0307('0x10')][_0x0307('0x188')]=function(_0x27b63f){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x189'),_0x27b63f[_0x0307('0xb3')]));return this[_0x0307('0xd')][_0x0307('0x18a')](_0x27b63f['number'][_0x0307('0x55')](/\s+/g,''),_0x27b63f[_0x0307('0x17b')]);};AGIVertices[_0x0307('0x10')][_0x0307('0x18b')]=function(_0x273a96){logger[_0x0307('0x2d')](util[_0x0307('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x273a96[_0x0307('0xb3')]));return this['channel'][_0x0307('0x18c')](_0x273a96[_0x0307('0x58')],_0x273a96[_0x0307('0x17b')]);};AGIVertices[_0x0307('0x10')][_0x0307('0x18d')]=function(_0x144321){logger['info'](util[_0x0307('0x27')](_0x0307('0x18e'),_0x144321[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x144321['account_id'])){return this[_0x0307('0xd')]['noop']('no\x20mail\x20account\x20configured');}var _0x5f47b3=this[_0x0307('0x1e')]['sync'](this,_0x144321[_0x0307('0x18f')]);if(!_0x5f47b3||!_0x5f47b3[_0x0307('0x190')]){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x144321,_0x0307('0x191'));}var _0x30549a={'from':util[_0x0307('0x27')]('\x22%s\x22\x20<%s>',_0x5f47b3[_0x0307('0x13')],_0x5f47b3[_0x0307('0x192')]||_0x5f47b3[_0x0307('0x190')][_0x0307('0x193')]),'to':_0x144321['to']||'','cc':_0x144321['cc']||'','bcc':_0x144321['bcc']||'','subject':_0x144321[_0x0307('0x194')],'html':_0x144321[_0x0307('0x58')],'text':_0x144321[_0x0307('0x58')]};if(this[_0x0307('0x7e')](_0x144321[_0x0307('0x195')])){}logger[_0x0307('0x196')]('sendMail\x20message',JSON[_0x0307('0x9a')](_0x30549a));this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x144321,_0x144321['account_id']);this[_0x0307('0xd')][_0x0307('0xa2')](util['format'](_0x0307('0x197'),_0x5f47b3[_0x0307('0x13')]));this[_0x0307('0x1f')]['sync'](this,_0x5f47b3['smtpOptions'],_0x30549a);return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0x198'));};AGIVertices[_0x0307('0x10')]['sendFax']=function(_0x17945f){logger['info'](util['format'](_0x0307('0x199'),_0x17945f[_0x0307('0xb3')]));return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0x19a'));};AGIVertices[_0x0307('0x10')][_0x0307('0x19b')]=function(_0x116b8a){logger[_0x0307('0x2d')](util['format'](_0x0307('0x19c'),_0x116b8a[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x116b8a[_0x0307('0x19d')])){return this['channel'][_0x0307('0xa2')](_0x0307('0x19e'));}var _0x2ddc06=this[_0x0307('0x19f')]['sync'](this,_0x116b8a[_0x0307('0x19d')]);if(!_0x2ddc06){return this['channel'][_0x0307('0x2b')](_0x116b8a,'no\x20sms\x20account\x20found');}var _0x5b4cf1={'body':_0x116b8a[_0x0307('0x1a0')],'phone':_0x116b8a['to']||'','SmsAccountId':_0x2ddc06['id']};logger[_0x0307('0x196')](_0x0307('0x1a1'),JSON[_0x0307('0x9a')](_0x5b4cf1));this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x116b8a,_0x116b8a[_0x0307('0x19d')]);this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x1a2'),_0x2ddc06[_0x0307('0x13')]));this[_0x0307('0x32')]['sync'](this,_0x5b4cf1);return this['channel']['noop'](_0x0307('0x1a3'));};AGIVertices[_0x0307('0x10')][_0x0307('0x1a4')]=function(_0x258dd2){logger[_0x0307('0x2d')](util[_0x0307('0x27')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x258dd2[_0x0307('0xb3')]));if(!this[_0x0307('0x7e')](_0x258dd2[_0x0307('0xd5')])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x258dd2,_0x0307('0x1a5'));}var _0x352f02=this['getVariable'][_0x0307('0x6b')](this,_0x258dd2[_0x0307('0xd5')]);if(!_0x352f02){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x258dd2,_0x0307('0xd6'));}return this[_0x0307('0xd')][_0x0307('0x9f')](_0x352f02,_0x258dd2[_0x0307('0x1a6')]);};AGIVertices['prototype'][_0x0307('0x1a7')]=function(_0x25e81a){logger['info'](util['format'](_0x0307('0x1a8'),_0x25e81a[_0x0307('0xb3')]));this[_0x0307('0xd')]['noop'](_0x0307('0x1a9'));if(_0x25e81a[_0x0307('0xb7')]===_0x0307('0x1aa')){this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0x1ab'));return this[_0x0307('0xd')][_0x0307('0xb7')]();}return this[_0x0307('0xd')][_0x0307('0xa2')]('Skipped\x20Answer');};AGIVertices[_0x0307('0x10')]['subproject']=function(_0x1c2d69){logger[_0x0307('0x2d')](util['format'](_0x0307('0x1ac'),_0x1c2d69['label']));if(!this[_0x0307('0x7e')](_0x1c2d69[_0x0307('0x1ad')])){return this[_0x0307('0xd')]['error'](_0x1c2d69,_0x0307('0x1ae'));}var _0xb745fd=this[_0x0307('0x17')][_0x0307('0x6b')](this,_0x1c2d69['project_id']);if(!this['isConfigured'](_0xb745fd)){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x1c2d69,util[_0x0307('0x27')](_0x0307('0x1af'),_0x1c2d69[_0x0307('0x1ad')]));}if(_0xb745fd===this['channel'][_0x0307('0x3b')]){return this['channel'][_0x0307('0x2b')](_0x1c2d69,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x0307('0x33')]['sync'](this,_0x1c2d69,_0xb745fd);var _0xc0761d=this[_0x0307('0xd')][_0x0307('0xa4')]('AGI',util[_0x0307('0x27')](_0x0307('0x1b0'),config[_0x0307('0xb1')]['host']||'127.0.0.1',_0xb745fd,this[_0x0307('0xd')][_0x0307('0x3b')]));if(_0xc0761d[_0x0307('0xaa')]===-0x1){return _0xc0761d;}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')]('Executed\x20command\x20%s\x20%s',_0x0307('0x1b1'),_0xb745fd));};AGIVertices[_0x0307('0x10')]['system']=function(_0x13de35){logger[_0x0307('0x2d')](util['format'](_0x0307('0x1b2'),_0x13de35[_0x0307('0xb3')]));var _0x179286=this[_0x0307('0x54')][_0x0307('0x6b')](this,_0x13de35[_0x0307('0xb4')]);this[_0x0307('0x33')][_0x0307('0x6b')](this,_0x13de35,_0x13de35[_0x0307('0xb4')]);if(this[_0x0307('0x7e')](_0x13de35['variable_id'])){var _0xdd0ec8=this['getVariable'][_0x0307('0x6b')](this,_0x13de35[_0x0307('0xd5')]);if(_0xdd0ec8){this[_0x0307('0xd')][_0x0307('0x9f')](_0xdd0ec8,_0x179286);return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x1b3'),_0x13de35[_0x0307('0xb4')],_0xdd0ec8));}}return this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x13de35[_0x0307('0xb4')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0xa7964d){logger['info'](util[_0x0307('0x27')](_0x0307('0x1b4'),_0xa7964d[_0x0307('0xb3')]));_0xa7964d['text']=_0xa7964d[_0x0307('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0307('0x7e')](_0xa7964d[_0x0307('0x56')])){return this[_0x0307('0xd')]['noop'](_0x0307('0x1b5'));}if(!this[_0x0307('0x7e')](_0xa7964d[_0x0307('0x58')])){return this[_0x0307('0xd')][_0x0307('0xa2')](_0x0307('0xa3'));}this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x1b6'),_0xa7964d[_0x0307('0x58')]));var _0x4b9dcb=this[_0x0307('0x1b7')][_0x0307('0x6b')](this,_0xa7964d);if(_0x4b9dcb){this[_0x0307('0xd')][_0x0307('0xa2')](util['format'](_0x0307('0x1b8'),_0x4b9dcb));var _0x458e34=this[_0x0307('0xd')][_0x0307('0xfe')](_0x4b9dcb);try{fs[_0x0307('0xff')](_0x4b9dcb+'.wav');}catch(_0x67b47e){logger['error'](_0x67b47e);}return _0x458e34;}return this[_0x0307('0xd')][_0x0307('0x2b')](_0xa7964d,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x0307('0x1b9')]=function(_0x2c659d){logger[_0x0307('0x2d')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2c659d[_0x0307('0xb3')]));_0x2c659d[_0x0307('0x58')]=_0x2c659d[_0x0307('0x58')][_0x0307('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0307('0x7e')](_0x2c659d['text'])){return this[_0x0307('0xd')]['noop'](_0x0307('0xa3'));}this[_0x0307('0xd')][_0x0307('0xa2')](util[_0x0307('0x27')]('Trying\x20Google\x20TTS\x20%s',_0x2c659d[_0x0307('0x58')]));var _0x48ea80=this[_0x0307('0x5e')][_0x0307('0x6b')](this,_0x2c659d);if(_0x48ea80){this['channel'][_0x0307('0xa2')](util[_0x0307('0x27')](_0x0307('0x1ba'),_0x48ea80));var _0x3ee5c1=this[_0x0307('0xd')][_0x0307('0xfe')](_0x48ea80);try{fs[_0x0307('0xff')](_0x48ea80+'.wav');}catch(_0x441165){logger[_0x0307('0x2b')](_0x441165);}return _0x3ee5c1;}return this[_0x0307('0xd')][_0x0307('0x2b')](_0x2c659d,_0x0307('0x1bb'));};AGIVertices[_0x0307('0x10')][_0x0307('0x1bc')]=function(_0x233e83){logger['info'](util['format'](_0x0307('0x1bd'),_0x233e83['label']));if(!this[_0x0307('0x7e')](_0x233e83[_0x0307('0x152')])){return this['channel'][_0x0307('0x2b')](_0x233e83,_0x0307('0x151'));}logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x158'),this[_0x0307('0xd')][_0x0307('0x4d')],_0x233e83[_0x0307('0x152')]));var _0x36b631=this[_0x0307('0x4b')][_0x0307('0x6b')](this,_0x233e83[_0x0307('0x152')]);if(_0x36b631){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x153'),this[_0x0307('0xd')]['callerid'],_0x233e83[_0x0307('0x152')]));this[_0x0307('0xd')][_0x0307('0xa2')](util['format'](_0x0307('0x153'),this[_0x0307('0xd')][_0x0307('0x4d')],_0x233e83['findBy']));return{'code':0xc8,'result':_0x0307('0x154')};}else{logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x155'),this[_0x0307('0xd')][_0x0307('0x4d')],_0x233e83[_0x0307('0x152')]));this[_0x0307('0xd')]['noop'](util['format'](_0x0307('0x155'),this[_0x0307('0xd')][_0x0307('0x4d')],_0x233e83[_0x0307('0x152')]));return{'code':0xc8,'result':_0x0307('0x156')};}};AGIVertices['prototype']['voicemail']=function(_0x3921d6){logger['info'](util[_0x0307('0x27')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x3921d6[_0x0307('0xb3')]));var _0x11eb6e=this['channel']['exec'](_0x0307('0x1be'),[_0x3921d6[_0x0307('0x1bf')],_0x3921d6[_0x0307('0x70')]]);if(_0x11eb6e[_0x0307('0xaa')]===-0x1){return _0x11eb6e;}return this[_0x0307('0xd')]['noop'](util[_0x0307('0x27')]('Executed\x20command\x20%s\x20%s',_0x0307('0x1be'),_0x3921d6['mailbox']));};AGIVertices['prototype'][_0x0307('0x1c0')]=function(_0x5179ad){logger[_0x0307('0x2d')](util[_0x0307('0x27')](_0x0307('0x1c1'),_0x5179ad[_0x0307('0xb3')]));if(!this['isConfigured'](_0x5179ad['variable_id'])){return this[_0x0307('0xd')][_0x0307('0x2b')](_0x5179ad,'no\x20variable\x20selected');}var _0x11745b=this['getVariable'][_0x0307('0x6b')](this,_0x5179ad[_0x0307('0xd5')]);if(!_0x11745b){return this['channel']['error'](_0x5179ad,_0x0307('0xd6'));}var _0x153868=this[_0x0307('0xd')][_0x0307('0x11')](_0x11745b);return{'code':0xc8,'result':_0x153868['extra']?_0x153868[_0x0307('0x9c')]:'-'};};String['prototype'][_0x0307('0x1c2')]=function(_0x13b2f8,_0x3c8be5){return this['split'](_0x13b2f8)[_0x0307('0x1c3')](_0x3c8be5);};module['exports']=AGIVertices; \ No newline at end of file +var _0x7894=['audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','text','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','result','maxRetry','sync','retry','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','delay','add','minutes','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','query','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','DialogflowV2\x20is\x20unreachable','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','getdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','getData','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','opts','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','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\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','join','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','channel','rpc','prototype','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','name','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','en-US','MALE'];(function(_0x3de0d9,_0x2ccb8f){var _0x161cd9=function(_0x8e23e7){while(--_0x8e23e7){_0x3de0d9['push'](_0x3de0d9['shift']());}};_0x161cd9(++_0x2ccb8f);}(_0x7894,0x170));var _0x4789=function(_0x359c97,_0x3bf6a1){_0x359c97=_0x359c97-0x0;var _0x449d33=_0x7894[_0x359c97];return _0x449d33;};'use strict';var fs=require('fs');var util=require(_0x4789('0x0'));var _=require(_0x4789('0x1'));var sh=require(_0x4789('0x2'));var odbc=require(_0x4789('0x3'))();var rs=require(_0x4789('0x4'));var moment=require(_0x4789('0x5'));var Mustache=require('mustache');var rp=require(_0x4789('0x6'));var logger=require(_0x4789('0x7'))('agi');var config=require(_0x4789('0x8'));var shared=require(_0x4789('0x9'));var scripts=require(_0x4789('0xa'));var FILES_PATH=_0x4789('0xb');var recursiveMapAttributes=[_0x4789('0xc'),_0x4789('0xd')];var verticesWithRetry=[_0x4789('0xe'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x6dce84,_0x53a3af,_0x2e8038){this[_0x4789('0xf')]=_0x6dce84;this[_0x4789('0x10')]=_0x53a3af;this['mailRpc']=_0x2e8038;};AGIVertices[_0x4789('0x11')]['getVariable']=function(_0x231db9,_0x335f0f){this[_0x4789('0x10')]['getVariableById'](_0x231db9)['then'](function(_0x216c80){_0x335f0f(null,_0x216c80?_0x216c80['name']:![]);})[_0x4789('0x12')](function(_0x58743a){_0x335f0f(_0x58743a);});};AGIVertices[_0x4789('0x11')][_0x4789('0x13')]=function(_0x515a8d,_0x37a816){this['rpc'][_0x4789('0x14')](_0x515a8d)[_0x4789('0x15')](function(_0x5162bd){_0x37a816(null,_0x5162bd?_0x5162bd['name']:![]);})[_0x4789('0x12')](function(_0x364280){_0x37a816(_0x364280);});};AGIVertices['prototype'][_0x4789('0x16')]=function(_0x527656,_0x118f97){this[_0x4789('0x10')]['getSquareProjectById'](_0x527656)[_0x4789('0x15')](function(_0x5af7b3){_0x118f97(null,_0x5af7b3?_0x5af7b3[_0x4789('0x17')]:![]);})['catch'](function(_0x19dc59){_0x118f97(_0x19dc59);});};AGIVertices[_0x4789('0x11')]['getSquareOdbc']=function(_0x9034c9,_0x245f63){this[_0x4789('0x10')][_0x4789('0x18')](_0x9034c9)[_0x4789('0x15')](function(_0x3a707d){_0x245f63(null,_0x3a707d?_0x3a707d[_0x4789('0x19')]:![]);})[_0x4789('0x12')](function(_0x117a1c){_0x245f63(_0x117a1c);});};AGIVertices[_0x4789('0x11')][_0x4789('0x1a')]=function(_0x125285,_0x4f7ceb){this[_0x4789('0x10')][_0x4789('0x1b')](_0x125285)['then'](function(_0x20841e){_0x4f7ceb(null,_0x20841e?_0x20841e[_0x4789('0x17')]:![]);})['catch'](function(_0xff56dd){_0x4f7ceb(_0xff56dd);});};AGIVertices[_0x4789('0x11')]['getTrunk']=function(_0xd8601e,_0x50d00f){this[_0x4789('0x10')][_0x4789('0x1c')](_0xd8601e)[_0x4789('0x15')](function(_0x13a69c){_0x50d00f(null,_0x13a69c?_0x13a69c[_0x4789('0x17')]:![]);})[_0x4789('0x12')](function(_0x182958){_0x50d00f(_0x182958);});};AGIVertices[_0x4789('0x11')][_0x4789('0x1d')]=function(_0xaa1cbb,_0x29a4bb){var _0x33a7bb=this;this[_0x4789('0x10')][_0x4789('0x1e')](_0xaa1cbb)[_0x4789('0x15')](function(_0x3095a1){_0x29a4bb(null,_0x3095a1?_0x33a7bb[_0x4789('0x1f')](_0x3095a1[_0x4789('0x20')]):![]);})['catch'](function(_0x59de58){_0x29a4bb(_0x59de58);});};AGIVertices[_0x4789('0x11')]['getMailAccount']=function(_0x490ea3,_0x5894f8){this[_0x4789('0x10')][_0x4789('0x21')](_0x490ea3)[_0x4789('0x15')](function(_0x4547f7){_0x5894f8(null,_0x4547f7?_0x4547f7:![]);})[_0x4789('0x12')](function(_0x1f72ee){_0x5894f8(_0x1f72ee);});};AGIVertices[_0x4789('0x11')][_0x4789('0x22')]=function(_0x208469,_0x4cf167,_0x45e379){this[_0x4789('0x23')][_0x4789('0x22')](_0x208469,_0x4cf167)[_0x4789('0x15')](function(){_0x45e379(null);})[_0x4789('0x12')](function(_0x15660e){_0x45e379(_0x15660e);});};AGIVertices[_0x4789('0x11')][_0x4789('0x24')]=function(_0x33b4bb,_0x409af2){this[_0x4789('0x10')][_0x4789('0x25')](_0x33b4bb)[_0x4789('0x15')](function(_0x188b1b){if(_0x188b1b){if(_0x188b1b[_0x4789('0x26')]){_0x409af2(null,[_0x188b1b['interval']]);}else{_0x409af2(null,_[_0x4789('0x27')](_0x188b1b[_0x4789('0x28')],_0x4789('0x29')));}}else{_0x409af2(null,![]);}})[_0x4789('0x12')](function(_0x45785a){_0x409af2(_0x45785a);});};AGIVertices[_0x4789('0x11')][_0x4789('0x1f')]=function(_0x5486c6){return util[_0x4789('0x2a')](_0x4789('0x2b'),FILES_PATH,_0x5486c6);};AGIVertices['prototype']['getQueryOdbc']=function(_0x43ecc4,_0x430381,_0x24f47c){odbc[_0x4789('0x2c')](_0x43ecc4,function(_0x30fdd8){if(_0x30fdd8){logger[_0x4789('0x2d')](_0x4789('0x2e'),_0x30fdd8);_0x24f47c(_0x30fdd8);}else{logger['info']('ODBC\x20connection\x20successfully');odbc['query'](_0x430381,function(_0x2415e1,_0x105cea){if(_0x2415e1){logger[_0x4789('0x2f')](_0x4789('0x30'),_0x430381);_0x24f47c(_0x2415e1);}else{logger[_0x4789('0x2f')](_0x4789('0x31'),_0x430381);odbc[_0x4789('0x32')](function(_0x4bdd65){if(_0x4bdd65){logger[_0x4789('0x2d')](_0x4789('0x33'),_0x4bdd65);}_0x24f47c(null,_0x105cea);});}});}});};AGIVertices[_0x4789('0x11')]['getSmsAccount']=function(_0x3e7459,_0x19a986){this[_0x4789('0x10')][_0x4789('0x34')](_0x3e7459)[_0x4789('0x15')](function(_0x484354){_0x19a986(null,_0x484354?_0x484354:![]);})[_0x4789('0x12')](function(_0x522dd5){_0x19a986(_0x522dd5);});};AGIVertices[_0x4789('0x11')][_0x4789('0x35')]=function(_0x37b804,_0x21f7fd){this[_0x4789('0x10')]['createSmsMessage'](_0x37b804)[_0x4789('0x15')](function(_0x5356ae){_0x21f7fd(null,_0x5356ae);})[_0x4789('0x12')](function(_0xd43903){_0x21f7fd(_0xd43903);});};AGIVertices['prototype'][_0x4789('0x36')]=function(_0x4c30e8,_0x446713,_0x312872){this[_0x4789('0x10')][_0x4789('0x36')]({'uniqueid':this['channel'][_0x4789('0x37')],'node':_0x4c30e8[_0x4789('0x38')],'application':_0x4c30e8['agicommand'],'data':_0x446713||null,'project_name':this[_0x4789('0xf')][_0x4789('0x39')],'callerid':this[_0x4789('0xf')]['callerid']})['then'](function(_0x2620a5){if(_0x312872){_0x312872(null,_0x2620a5);}})['catch'](function(_0x3382eb){if(_0x312872){_0x312872(_0x3382eb);}});};AGIVertices['prototype'][_0x4789('0x3a')]=function(_0x91e8d,_0x147d09,_0x469aea,_0x43c349){this[_0x4789('0x10')][_0x4789('0x3a')]({'uniqueid':this['channel'][_0x4789('0x37')],'callerid':this[_0x4789('0xf')][_0x4789('0x3b')],'calleridname':this[_0x4789('0xf')][_0x4789('0x3c')],'context':this[_0x4789('0xf')][_0x4789('0x3d')],'extension':this[_0x4789('0xf')][_0x4789('0x3e')],'priority':this[_0x4789('0xf')]['priority'],'accountcode':this[_0x4789('0xf')][_0x4789('0x3f')],'dnid':this['channel'][_0x4789('0x40')],'projectName':this[_0x4789('0xf')][_0x4789('0x39')],'saveName':_0x147d09,'filename':_0x91e8d[_0x4789('0x41')]||_0x147d09,'savePath':_0x469aea})[_0x4789('0x15')](function(_0x4d0f56){_0x43c349(null,_0x4d0f56);})[_0x4789('0x12')](function(_0x2ec868){_0x43c349(_0x2ec868);});};AGIVertices[_0x4789('0x11')][_0x4789('0x42')]=function(_0x14c193,_0x2e206f,_0x2ae91d,_0x18b4f7,_0x1736e2){this[_0x4789('0x10')][_0x4789('0x42')]({'uniqueid':this['channel'][_0x4789('0x37')],'body':_0x14c193,'direction':_0x2e206f,'providerName':_0x2ae91d,'providerResponse':_0x18b4f7})[_0x4789('0x15')](function(_0x2e305b){if(_0x1736e2){_0x1736e2(null,_0x2e305b);}})[_0x4789('0x12')](function(_0x3a3d10){if(_0x1736e2){_0x1736e2(_0x3a3d10);}});};AGIVertices['prototype'][_0x4789('0x43')]=function(_0x5e6740,_0x5744bd){this[_0x4789('0x10')][_0x4789('0x43')]({'firstName':_[_0x4789('0x44')](_0x5e6740[_0x4789('0x17')])||_[_0x4789('0x45')](_0x5e6740[_0x4789('0x17')])?_0x4789('0x46')+Math[_0x4789('0x47')]():_0x5e6740['name'],'lastName':_[_0x4789('0x44')](_0x5e6740['lastName'])||_['isNil'](_0x5e6740[_0x4789('0x48')])?null:_0x5e6740['lastName'],'phone':_0x5e6740[_0x4789('0x49')],'ListId':_0x5e6740[_0x4789('0x4a')],'scheduledat':_0x5e6740[_0x4789('0x4b')],'callbackUniqueid':this['channel'][_0x4789('0x37')],'tags':'callback','description':_0x4789('0x4c')+_0x5e6740['scheduledAt'][_0x4789('0x4d')](),'priority':_0x5e6740[_0x4789('0x4e')]})[_0x4789('0x15')](function(_0x1f0610){_0x5744bd(null,_0x1f0610);})[_0x4789('0x12')](function(_0x62453c){_0x5744bd(_0x62453c);});};AGIVertices[_0x4789('0x11')][_0x4789('0x4f')]=function(_0x27cb96,_0x4901f2){this[_0x4789('0x10')]['getPauseById'](_0x27cb96)[_0x4789('0x15')](function(_0xa04ff5){_0x4901f2(null,_0xa04ff5?_0xa04ff5['name']:![]);})[_0x4789('0x12')](function(_0x1f247c){_0x4901f2(_0x1f247c);});};AGIVertices[_0x4789('0x11')][_0x4789('0x50')]=function(_0x33fdd3,_0x21ab9e,_0x2abbae){var _0x10cf2b={'role':_0x4789('0x51')};_0x10cf2b[_0x33fdd3]=this[_0x4789('0xf')][_0x4789('0x3b')];this[_0x4789('0x10')]['agentPause'](_0x10cf2b,_0x21ab9e,this['channel'][_0x4789('0x37')])['then'](function(_0x3fa9f2){_0x2abbae(null,_[_0x4789('0x45')](_0x3fa9f2)?![]:!![]);})[_0x4789('0x12')](function(_0x22820d){logger[_0x4789('0x2d')](_0x22820d);_0x2abbae(null,![]);});};AGIVertices[_0x4789('0x11')][_0x4789('0x52')]=function(_0x451bcd,_0x4ca8cf){var _0x16cd71={'role':_0x4789('0x51')};_0x16cd71[_0x451bcd]=this['channel'][_0x4789('0x3b')];this[_0x4789('0x10')][_0x4789('0x52')](_0x16cd71)[_0x4789('0x15')](function(_0x485521){_0x4ca8cf(null,_[_0x4789('0x45')](_0x485521)?![]:!![]);})['catch'](function(_0x4afba4){logger[_0x4789('0x2d')](_0x4afba4);_0x4ca8cf(null,![]);});};AGIVertices[_0x4789('0x11')][_0x4789('0x53')]=function(_0x3c0947,_0x1ffe59){var _0x38ba84={'role':_0x4789('0x51')};_0x38ba84[_0x3c0947]=this[_0x4789('0xf')][_0x4789('0x3b')];this[_0x4789('0x10')]['agentLogout'](_0x38ba84)[_0x4789('0x15')](function(_0x2f860d){_0x1ffe59(null,_[_0x4789('0x45')](_0x2f860d)?![]:!![]);})['catch'](function(_0x40d6a6){logger[_0x4789('0x2d')](_0x40d6a6);_0x1ffe59(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x57ffdb,_0xf5c2e3){var _0x5ba004={'role':_0x4789('0x51')};_0x5ba004[_0x57ffdb]=this[_0x4789('0xf')][_0x4789('0x3b')];var _0x56bcbb=_0x57ffdb!=_0x4789('0x54')?util[_0x4789('0x2a')]('%s/%s@from-sip/n','LOCAL',this[_0x4789('0xf')][_0x4789('0x3b')]):undefined;this['rpc'][_0x4789('0x55')](_0x5ba004,_0x56bcbb)['then'](function(_0x3457c1){_0xf5c2e3(null,_[_0x4789('0x45')](_0x3457c1)?![]:!![]);})[_0x4789('0x12')](function(_0x316c40){logger['error'](_0x316c40);_0xf5c2e3(null,![]);});};AGIVertices[_0x4789('0x11')][_0x4789('0x56')]=function(_0x327003,_0x9d5a36){sh['exec'](_[_0x4789('0x57')](_0x327003),function(_0x2f99ad,_0x8d827e){var _0x267021=_0x8d827e[_0x4789('0x58')](/(\r\n|\n|\r)/gm,'');_0x9d5a36(null,_0x267021);});};AGIVertices[_0x4789('0x11')][_0x4789('0x59')]=function(_0x392387,_0x165001){scripts[_0x4789('0x59')](_0x392387[_0x4789('0x5a')],_0x392387['google_cloud_tts_text_type']||'text',_0x392387['text'],_0x392387['languageCode']||_0x4789('0x5b'),_0x392387['ssmlGender']||_0x4789('0x5c'),_0x392387[_0x4789('0x5d')]||_0x4789('0x5e'))[_0x4789('0x15')](function(_0x3aa580){_0x165001(null,_0x3aa580);})[_0x4789('0x12')](function(_0x57f8a6){_0x165001(_0x57f8a6);});};AGIVertices[_0x4789('0x11')][_0x4789('0x5f')]=function(_0x444260,_0x424d72){scripts['googleTTS'](_0x444260['text'],_0x444260['google_tts_language']||'en',0x1)[_0x4789('0x15')](function(_0xdf9cba){_0x424d72(null,_0xdf9cba);})[_0x4789('0x12')](function(_0x1a2569){_0x424d72(_0x1a2569);});};AGIVertices[_0x4789('0x11')][_0x4789('0x60')]=function(_0x29104d,_0x154e0b){var _0x49ef89={'uri':_0x29104d[_0x4789('0x61')],'method':_0x29104d[_0x4789('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x29104d[_0x4789('0x63')])===_0x4789('0x64')&&parseInt(_0x29104d[_0x4789('0x63')])>=0x1?parseInt(_0x29104d[_0x4789('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x4789('0x65')]([_0x4789('0x66'),_0x4789('0x67')],_0x49ef89[_0x4789('0x62')][_0x4789('0x68')]())){try{_0x49ef89[_0x4789('0x69')]=_0x29104d[_0x4789('0xd')]?JSON['parse'](_0x29104d[_0x4789('0xd')]):{};}catch(_0x121ca3){logger[_0x4789('0x2d')](_0x4789('0x6a'),_0x121ca3);}}try{_0x49ef89[_0x4789('0x6b')]=_0x29104d[_0x4789('0xc')]?JSON[_0x4789('0x6c')](_0x29104d[_0x4789('0xc')]):{};}catch(_0x45bdc2){logger[_0x4789('0x2d')](_0x4789('0x6d'),_0x45bdc2);}if(_0x29104d['computedVariables']){try{var _0x234088=require(_0x29104d[_0x4789('0x6e')])['sync'](this,_0x49ef89);_0x49ef89['uri']=Mustache[_0x4789('0x6f')](_0x29104d[_0x4789('0x61')],_0x234088,{},['$$','$$']);if(_0x49ef89[_0x4789('0x6b')]){_0x49ef89[_0x4789('0x6b')]=JSON[_0x4789('0x6c')](Mustache['render'](JSON[_0x4789('0x70')](_0x49ef89[_0x4789('0x6b')]),_0x234088,{},['$$','$$']));}if(_0x49ef89[_0x4789('0x69')]){_0x49ef89[_0x4789('0x69')]=JSON[_0x4789('0x6c')](Mustache[_0x4789('0x6f')](JSON['stringify'](_0x49ef89['body']),_0x234088,{},['$$','$$']));}}catch(_0xa062c8){logger[_0x4789('0x2d')](_0x4789('0x71'),_0xa062c8);}}rp(_0x49ef89)[_0x4789('0x15')](function(_0x39e5cf){var _0x5dc404={'statusCode':_0x39e5cf[_0x4789('0x72')]||0xc8,'statusMessage':_0x39e5cf[_0x4789('0x73')]||'OK','headers':_0x39e5cf[_0x4789('0x6b')]||{},'body':_0x39e5cf[_0x4789('0x69')]||{}};_0x154e0b(null,_0x5dc404);})[_0x4789('0x12')](function(_0x5aa8ee){var _0x1d4319={'statusCode':_0x5aa8ee[_0x4789('0x72')]||0x1f4,'statusMessage':_0x5aa8ee[_0x4789('0x74')]||_0x4789('0x75'),'headers':_0x5aa8ee[_0x4789('0x76')][_0x4789('0x6b')]||{},'body':_0x5aa8ee[_0x4789('0x76')][_0x4789('0x69')]||{}};_0x154e0b(null,_0x1d4319);});};AGIVertices[_0x4789('0x11')]['googleDialogflow']=function(_0xfd3b6a,_0x1d4a0c){scripts['googleDialogflow'](this[_0x4789('0xf')][_0x4789('0x37')],_0xfd3b6a[_0x4789('0x77')],_0xfd3b6a[_0x4789('0x78')],_0xfd3b6a[_0x4789('0x79')]||'en')['then'](function(_0x2c6faf){_0x1d4a0c(null,_0x2c6faf);})['catch'](function(_0x5d3792){_0x1d4a0c(_0x5d3792);});};AGIVertices['prototype'][_0x4789('0x7a')]=function(_0x1dbaaf,_0x165995){scripts[_0x4789('0x7a')](this[_0x4789('0xf')][_0x4789('0x37')],_0x1dbaaf[_0x4789('0x7b')],_0x1dbaaf[_0x4789('0x7c')],_0x1dbaaf[_0x4789('0x7d')],_0x1dbaaf[_0x4789('0x78')],_0x1dbaaf[_0x4789('0x7e')]||'en')[_0x4789('0x15')](function(_0x3af7fc){_0x165995(null,_0x3af7fc);})[_0x4789('0x12')](function(_0x4522e7){_0x165995(_0x4522e7);});};AGIVertices['prototype'][_0x4789('0x7f')]=function(_0x3948ca,_0x3b62a2){scripts[_0x4789('0x7f')](this[_0x4789('0xf')],_0x3948ca)[_0x4789('0x15')](function(_0x1e0a52){_0x3b62a2(null,_0x1e0a52);})[_0x4789('0x12')](function(_0x373247){_0x3b62a2(_0x373247);});};AGIVertices[_0x4789('0x11')][_0x4789('0x80')]=function(_0x360d78,_0x35687b){scripts[_0x4789('0x80')](_0x360d78[_0x4789('0x77')],_0x360d78[_0x4789('0x78')],_0x360d78[_0x4789('0x81')]||_0x4789('0x5b'),_0x360d78[_0x4789('0x82')])[_0x4789('0x15')](function(_0x292204){_0x35687b(null,_0x292204);})[_0x4789('0x12')](function(_0x1aa2e3){_0x35687b(_0x1aa2e3);});};AGIVertices[_0x4789('0x11')][_0x4789('0x83')]=function(_0x4b33a6,_0x320109,_0x12e47d){scripts['ispeechASR'](_0x320109,_0x4b33a6[_0x4789('0x77')],_0x4b33a6['ispeech_asr_language']||_0x4789('0x5b'),this[_0x4789('0x84')](_0x4b33a6[_0x4789('0x85')])?_0x4b33a6['model']:undefined)['then'](function(_0x1c6f58){_0x12e47d(null,_0x1c6f58);})[_0x4789('0x12')](function(_0x254a4f){_0x12e47d(_0x254a4f);});};AGIVertices['prototype'][_0x4789('0x86')]=function(_0x18baf9,_0x272ff9){scripts['awsPolly'](_0x18baf9[_0x4789('0x87')],_0x18baf9[_0x4789('0x88')],_0x18baf9[_0x4789('0x89')],_0x18baf9[_0x4789('0x8a')]||_0x4789('0x8b'),_0x18baf9[_0x4789('0x78')],_0x18baf9[_0x4789('0x8c')]||_0x4789('0x78'))['then'](function(_0x9d5f82){_0x272ff9(null,_0x9d5f82);})[_0x4789('0x12')](function(_0x2ab7db){_0x272ff9(_0x2ab7db);});};AGIVertices[_0x4789('0x11')]['awsLex']=function(_0x291fcf,_0x50f053){scripts['awsLex'](this[_0x4789('0xf')][_0x4789('0x37')],_0x291fcf['aws_access_key_id'],_0x291fcf[_0x4789('0x88')],_0x291fcf[_0x4789('0x8d')],_0x291fcf['text'],_0x291fcf[_0x4789('0x8e')])[_0x4789('0x15')](function(_0x5aa1f9){_0x50f053(null,_0x5aa1f9);})[_0x4789('0x12')](function(_0x473394){_0x50f053(_0x473394);});};AGIVertices[_0x4789('0x11')][_0x4789('0x8f')]=function(_0xff015e,_0x3579d6,_0x3ced35){scripts['googleASR'](_0x3579d6,_0xff015e['key'],_0xff015e['google_asr_language']||'en-US')[_0x4789('0x15')](function(_0x5368c1){_0x3ced35(null,_0x5368c1);})['catch'](function(_0x24a933){_0x3ced35(_0x24a933);});};AGIVertices[_0x4789('0x11')][_0x4789('0x90')]=function(_0x24e6ab,_0x554044,_0x1eae09){scripts[_0x4789('0x90')](_0x554044,_0x24e6ab[_0x4789('0x91')],_0x24e6ab[_0x4789('0x92')],_0x24e6ab[_0x4789('0x93')])[_0x4789('0x15')](function(_0x530bf9){_0x1eae09(null,_0x530bf9);})[_0x4789('0x12')](function(_0x19c172){_0x1eae09(_0x19c172);});};AGIVertices[_0x4789('0x11')][_0x4789('0x94')]=function(_0x200e4f){var _0x13e2d7=_[_0x4789('0x65')](verticesWithRetry,_0x200e4f[_0x4789('0x95')])?_0x200e4f:_[_0x4789('0x96')](_0x200e4f);for(var _0x30f086 in _0x13e2d7){if(_0x13e2d7[_0x4789('0x97')](_0x30f086)){if(_0x13e2d7[_0x30f086]&&_['isString'](_0x13e2d7[_0x30f086])){if(_[_0x4789('0x65')](recursiveMapAttributes,_0x30f086)){_0x13e2d7[_0x30f086]=this[_0x4789('0x98')](_0x13e2d7[_0x30f086]);}else{_0x13e2d7[_0x30f086]=this['replaceAllVariables'](_0x13e2d7[_0x30f086]);}}}}return _0x13e2d7;};AGIVertices[_0x4789('0x11')][_0x4789('0x99')]=function(_0x33ec90){for(var _0x490d70 in _0x33ec90){if(_0x33ec90[_0x4789('0x97')](_0x490d70)){if(_[_0x4789('0x9a')](_0x33ec90[_0x490d70])){this[_0x4789('0x99')](_0x33ec90[_0x490d70]);}else if(_[_0x4789('0x9b')](_0x33ec90[_0x490d70])){for(var _0x1f097c=0x0;_0x1f097c<_0x33ec90[_0x490d70][_0x4789('0x9c')];_0x1f097c++){this[_0x4789('0x99')](_0x33ec90[_0x490d70][_0x1f097c]);}}else if(_[_0x4789('0x9d')](_0x33ec90[_0x490d70])){_0x33ec90[_0x490d70]=this[_0x4789('0x9e')](_0x33ec90[_0x490d70]);}}}};AGIVertices[_0x4789('0x11')][_0x4789('0x9f')]=function(_0x2b2ac2,_0x205c47){for(var _0x241e9f in _0x2b2ac2){if(_0x2b2ac2[_0x4789('0x97')](_0x241e9f)){if(_[_0x4789('0x9a')](_0x2b2ac2[_0x241e9f])){if(!_[_0x4789('0x44')](_0x2b2ac2[_0x241e9f])){this[_0x4789('0x9f')](_0x2b2ac2[_0x241e9f],util[_0x4789('0x2a')](_0x4789('0xa0'),_0x205c47,_0x241e9f));}}else if(_['isArray'](_0x2b2ac2[_0x241e9f])){for(var _0x3ff751=0x0;_0x3ff751<_0x2b2ac2[_0x241e9f][_0x4789('0x9c')];_0x3ff751++){this[_0x4789('0x9f')](_0x2b2ac2[_0x241e9f][_0x3ff751],util['format'](_0x4789('0xa0'),_0x205c47,_0x241e9f+'['+_0x3ff751+']'));}}else{if(!_['isNil'](_0x2b2ac2[_0x241e9f])){this[_0x4789('0xf')][_0x4789('0xa1')](util[_0x4789('0x2a')](_0x4789('0xa0'),_0x205c47,_0x241e9f),_0x2b2ac2[_0x241e9f]);}}}}};AGIVertices['prototype'][_0x4789('0x98')]=function(_0x2d4bbd){try{var _0xd6f74f=JSON[_0x4789('0x6c')](_0x2d4bbd);this['recursiveNodeIndex'](_0xd6f74f);return JSON[_0x4789('0x70')](_0xd6f74f);}catch(_0x5bcaa4){return this['replaceAllVariables'](_0x2d4bbd);}};AGIVertices['prototype'][_0x4789('0x9e')]=function(_0x27b3da){var _0x1acb98=_0x27b3da[_0x4789('0xa2')]('{');for(var _0x29c1b5=0x1;_0x29c1b5<_0x1acb98[_0x4789('0x9c')];_0x29c1b5+=0x1){var _0x4c90a2=_0x1acb98[_0x29c1b5][_0x4789('0xa2')]('}');if(_0x4c90a2['length']>0x1){_0x27b3da=_0x27b3da[_0x4789('0xa3')]('{'+_0x4c90a2[0x0]+'}',this[_0x4789('0xf')][_0x4789('0xa4')](_0x4c90a2[0x0])[_0x4789('0xa5')]||_0x4c90a2[0x0]);}}if(_0x1acb98[_0x4789('0x9c')]===0x1){return _0x27b3da[_0x4789('0x4d')]();}return this[_0x4789('0x9e')](_0x27b3da);};AGIVertices['prototype']['getAndSetVariable']=function(_0x3d4c60,_0x568186){var _0x14d05e=this[_0x4789('0xf')][_0x4789('0xa4')](_0x3d4c60);if(_0x14d05e[_0x4789('0xa6')]===-0x1){return _0x14d05e;}logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x568186,_0x14d05e[_0x4789('0xa5')]));return this[_0x4789('0xf')]['setVariable'](_0x568186,_0x14d05e[_0x4789('0xa5')]);};AGIVertices[_0x4789('0x11')][_0x4789('0x84')]=function(_0x1ee600){return _0x1ee600&&_0x1ee600!=='0'&&_0x1ee600!=='-1'&&_0x1ee600!=='';};AGIVertices['prototype'][_0x4789('0xa7')]=function(_0x5cda88){this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x5cda88,'-');_0x5cda88[_0x4789('0xa9')]=_0x5cda88['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x3ed9e6){logger[_0x4789('0x2f')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x3ed9e6['label']));if(!this['isConfigured'](_0x3ed9e6[_0x4789('0x78')])){return this['channel'][_0x4789('0xaa')](_0x4789('0xab'));}var _0x1c287c='\x22'+_0x3ed9e6['text']+'\x22';if(this[_0x4789('0x84')](_0x3ed9e6[_0x4789('0x76')])){_0x1c287c+=','+_0x3ed9e6['options'];}var _0x4921cb=this['channel'][_0x4789('0xac')](_0x4789('0xad'),_0x1c287c);if(_0x4921cb['result']===-0x1){return _0x4921cb;}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1c287c));};AGIVertices[_0x4789('0x11')][_0x4789('0xae')]=function(_0xc0bc93){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0xc0bc93['label']));if(!this['isConfigured'](_0xc0bc93[_0x4789('0xaf')])){return this[_0x4789('0xf')]['noop'](_0x4789('0xb0'));}var _0x36bc2a=_0xc0bc93[_0x4789('0xaf')];if(this[_0x4789('0x84')](_0xc0bc93[_0x4789('0x76')])){_0x36bc2a+=','+_0xc0bc93[_0x4789('0x76')];}var _0x2b4e83=this['channel'][_0x4789('0xac')](_0x4789('0xb1'),_0x36bc2a);if(_0x2b4e83['result']===-0x1){return _0x2b4e83;}var _0x49819f=this[_0x4789('0xb2')]('RECOG_CONFIDENCE()',_0x4789('0xb3'));if(_0x49819f['result']===-0x1){return _0x49819f;}var _0x2df330=this[_0x4789('0xb2')](_0x4789('0xb4'),_0x4789('0xb5'));if(_0x2df330[_0x4789('0xa6')]===-0x1){return _0x2df330;}var _0x15bfd1=this[_0x4789('0xb2')](_0x4789('0xb6'),_0x4789('0xb7'));if(_0x15bfd1[_0x4789('0xa6')]===-0x1){return _0x15bfd1;}return this['channel']['noop'](util[_0x4789('0x2a')](_0x4789('0xb8'),_0x36bc2a));};AGIVertices[_0x4789('0x11')][_0x4789('0xb9')]=function(_0x32ad35){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x32ad35[_0x4789('0x38')]));return this[_0x4789('0xf')][_0x4789('0xb9')]([_0x32ad35['command'],_0x32ad35[_0x4789('0xba')]]);};AGIVertices[_0x4789('0x11')][_0x4789('0xbb')]=function(_0xcff7c6){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0xbc'),_0xcff7c6[_0x4789('0x38')]));if(this[_0x4789('0x84')](_0xcff7c6['timeout'])){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0xbd'),_0xcff7c6[_0x4789('0x63')]));var _0xefba38=this[_0x4789('0xf')][_0x4789('0xbe')](_0xcff7c6['timeout']);if(_0xefba38[_0x4789('0xa6')]===-0x1){return _0xefba38;}}return this['channel'][_0x4789('0xbb')]();};AGIVertices['prototype'][_0x4789('0xbf')]=function(_0x1b9fb4){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x1b9fb4[_0x4789('0x38')]));if(!this['isConfigured'](_0x1b9fb4[_0x4789('0x4a')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x1b9fb4,'no\x20list\x20selected');}_0x1b9fb4[_0x4789('0x4b')]=moment();if(this[_0x4789('0x84')](_0x1b9fb4[_0x4789('0xc0')])){_0x1b9fb4[_0x4789('0x4b')]=moment()[_0x4789('0xc1')](_0x1b9fb4[_0x4789('0xc0')],_0x4789('0xc2'));}if(!this[_0x4789('0x84')](_0x1b9fb4['callback_priority'])){_0x1b9fb4[_0x4789('0x4e')]=0x2;}this[_0x4789('0x43')][_0x4789('0xa8')](this,_0x1b9fb4);return this[_0x4789('0xf')][_0x4789('0xaa')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1b9fb4[_0x4789('0x49')],_0x1b9fb4[_0x4789('0x4a')],_0x1b9fb4[_0x4789('0x4b')]));};AGIVertices[_0x4789('0x11')][_0x4789('0xc3')]=function(_0xc6076b){logger['info'](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0xc6076b['label']));var _0xa4e816=this[_0x4789('0xf')][_0x4789('0xac')](_0xc6076b[_0x4789('0xc4')],_0xc6076b[_0x4789('0x76')]);if(_0xa4e816[_0x4789('0xa6')]===-0x1){return _0xa4e816;}return this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xc5'),_0xc6076b[_0x4789('0xc4')],_0xc6076b[_0x4789('0x76')]));};AGIVertices[_0x4789('0x11')][_0x4789('0xc6')]=function(_0x5e0c5f){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0xc7'),_0x5e0c5f['label']));if(!this[_0x4789('0x84')](_0x5e0c5f[_0x4789('0x78')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xab'));}var _0x2be8be='\x22'+_0x5e0c5f['text']+'\x22';if(this[_0x4789('0x84')](_0x5e0c5f[_0x4789('0x76')])){_0x2be8be+=','+_0x5e0c5f[_0x4789('0x76')];}var _0x217b60=this[_0x4789('0xf')][_0x4789('0xac')]('MRCPSynth',_0x2be8be);if(_0x217b60['result']===-0x1){return _0x217b60;}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xc8'),_0x2be8be));};AGIVertices[_0x4789('0x11')][_0x4789('0xc9')]=function(_0x59c422){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x59c422[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x59c422[_0x4789('0x78')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20text\x20configured');}var _0x22b466='\x22'+_0x59c422[_0x4789('0x78')]+'\x22';if(this[_0x4789('0x84')](_0x59c422[_0x4789('0x76')])){_0x22b466+=','+_0x59c422[_0x4789('0x76')];}var _0x3c341b=this['channel'][_0x4789('0xac')](_0x4789('0xad'),_0x22b466);if(_0x3c341b[_0x4789('0xa6')]===-0x1){return _0x3c341b;}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x22b466));};AGIVertices[_0x4789('0x11')][_0x4789('0xca')]=function(_0x5e92aa){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0xcb'),_0x5e92aa[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x5e92aa[_0x4789('0xaf')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xb0'));}var _0x5c64ca=_0x5e92aa['grammar'];if(this['isConfigured'](_0x5e92aa[_0x4789('0x76')])){_0x5c64ca+=','+_0x5e92aa['options'];}var _0x20bd4d=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0xb1'),_0x5c64ca);if(_0x20bd4d[_0x4789('0xa6')]===-0x1){return _0x20bd4d;}var _0x1b2ff5=this[_0x4789('0xb2')](_0x4789('0xcc'),_0x4789('0xcd'));if(_0x1b2ff5[_0x4789('0xa6')]===-0x1){return _0x1b2ff5;}var _0x5e4376=this[_0x4789('0xb2')](_0x4789('0xb4'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x5e4376[_0x4789('0xa6')]===-0x1){return _0x5e4376;}var _0x3171e4=this[_0x4789('0xb2')](_0x4789('0xb6'),_0x4789('0xce'));if(_0x3171e4[_0x4789('0xa6')]===-0x1){return _0x3171e4;}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xb8'),_0x5c64ca));};AGIVertices[_0x4789('0x11')][_0x4789('0xcf')]=function(_0x310db3){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x310db3[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x310db3[_0x4789('0xaf')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20grammar\x20configured');}var _0x272d92=_0x310db3[_0x4789('0xaf')];if(this[_0x4789('0x84')](_0x310db3['options'])){_0x272d92+=','+_0x310db3[_0x4789('0x76')];}var _0x4c84d9=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0xb1'),_0x272d92);if(_0x4c84d9['result']===-0x1){return _0x4c84d9;}var _0x11a357=this[_0x4789('0xb2')](_0x4789('0xcc'),_0x4789('0xd0'));if(_0x11a357[_0x4789('0xa6')]===-0x1){return _0x11a357;}var _0x3a5f40=this[_0x4789('0xb2')](_0x4789('0xb4'),'SESTEK_ASR_TRANSCRIPT');if(_0x3a5f40[_0x4789('0xa6')]===-0x1){return _0x3a5f40;}var _0x52691c=this[_0x4789('0xb2')](_0x4789('0xb6'),_0x4789('0xd1'));if(_0x52691c[_0x4789('0xa6')]===-0x1){return _0x52691c;}return this['channel']['noop'](util[_0x4789('0x2a')](_0x4789('0xb8'),_0x272d92));};AGIVertices[_0x4789('0x11')]['database']=function(_0x2b9ef2){logger[_0x4789('0x2f')](util['format'](_0x4789('0xd2'),_0x2b9ef2['label']));if(!this['isConfigured'](_0x2b9ef2[_0x4789('0xd3')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2b9ef2,'no\x20database\x20selected');}var _0x27abf2=this[_0x4789('0xd4')][_0x4789('0xa8')](this,_0x2b9ef2[_0x4789('0xd3')]);if(!_0x27abf2){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2b9ef2,'no\x20odbc\x20database\x20found');}if(!this[_0x4789('0x84')](_0x2b9ef2[_0x4789('0xd5')])){return this['channel']['error'](_0x2b9ef2,'no\x20query\x20configured');}var _0xe39997=_0x2b9ef2[_0x4789('0xd5')][_0x4789('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0xd6'),_0xe39997));var _0x5ddae1=this[_0x4789('0xd7')][_0x4789('0xa8')](this,_0x27abf2,_0xe39997);this[_0x4789('0x36')]['sync'](this,_0x2b9ef2,_0xe39997);if(!this[_0x4789('0x84')](_0x2b9ef2[_0x4789('0xd8')])){return this[_0x4789('0xf')]['noop'](_0x4789('0xd9'));}var _0x59794a=this[_0x4789('0xa4')][_0x4789('0xa8')](this,_0x2b9ef2[_0x4789('0xd8')]);if(!_0x59794a){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2b9ef2,_0x4789('0xda'));}var _0x200b96=this;_0x5ddae1[_0x4789('0xdb')](function(_0x89aebf,_0x317985){Object[_0x4789('0xdc')](_0x89aebf)['forEach'](function(_0x111ce7){_0x200b96[_0x4789('0xf')]['setVariable'](util[_0x4789('0x2a')]('%s[%s][%s]',_0x59794a,_0x317985,_0x111ce7),_0x89aebf[_0x111ce7]);});});this[_0x4789('0xf')][_0x4789('0xa1')](util[_0x4789('0x2a')]('%s_ROWS_COUNT',_0x59794a),_0x5ddae1[_0x4789('0x9c')]);return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xdd'),_0x59794a));};AGIVertices[_0x4789('0x11')][_0x4789('0xde')]=function(_0x30a5b2){logger['debug'](util[_0x4789('0x2a')](_0x4789('0xdf'),_0x30a5b2['label']));if(!this[_0x4789('0x84')](_0x30a5b2[_0x4789('0xe0')])){return this[_0x4789('0xf')]['error'](_0x30a5b2,_0x4789('0xe1'));}var _0x435d59=this[_0x4789('0x1a')][_0x4789('0xa8')](this,_0x30a5b2[_0x4789('0xe0')]);if(!_0x435d59){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x30a5b2,_0x4789('0xe2'));}var _0x8d0c95=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0xe3'),[util[_0x4789('0x2a')](_0x4789('0xe4'),_0x435d59),_0x30a5b2[_0x4789('0x63')],_0x30a5b2['opts'],_0x30a5b2[_0x4789('0x61')]]);if(_0x8d0c95[_0x4789('0xa6')]===-0x1){return _0x8d0c95;}return this[_0x4789('0xf')][_0x4789('0xaa')](util['format']('Executed\x20command\x20%s',_0x4789('0xe3')));};AGIVertices[_0x4789('0x11')]['dialogflow']=function(_0x4f6abc){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4f6abc[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x4f6abc[_0x4789('0x77')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xe5'));}if(!this[_0x4789('0x84')](_0x4f6abc[_0x4789('0x78')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20text\x20configured');}this['channel'][_0x4789('0xe6')]=!![];this['createSquareDetailsReport'](_0x4f6abc);this['createSquareMessage'](_0x4f6abc[_0x4789('0x78')],'in','','');this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xe7'),_0x4f6abc[_0x4789('0x78')]));var _0x55ffad=this['googleDialogflow'][_0x4789('0xa8')](this,_0x4f6abc);if(_0x55ffad){for(var _0x1c9103 in _0x55ffad){if(_0x55ffad['hasOwnProperty'](_0x1c9103)){this['channel'][_0x4789('0xa1')](util[_0x4789('0x2a')](_0x4789('0xe8'),_0x1c9103[_0x4789('0x68')]()),_0x55ffad[_0x1c9103]);}}this[_0x4789('0x42')](_0x55ffad['speech'],_0x4789('0xe9'),_0x4789('0xea'),'');return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xeb'),_0x55ffad['speech']));}return this[_0x4789('0xf')][_0x4789('0x2d')](_0x4f6abc,_0x4789('0xec'));};AGIVertices[_0x4789('0x11')][_0x4789('0xed')]=function(_0x5b23b1){logger['info'](util[_0x4789('0x2a')](_0x4789('0xee'),_0x5b23b1[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x5b23b1[_0x4789('0x7b')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xef'));}if(!this[_0x4789('0x84')](_0x5b23b1['client_email'])){return this[_0x4789('0xf')]['noop'](_0x4789('0xf0'));}if(!this['isConfigured'](_0x5b23b1[_0x4789('0x7d')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20private_key\x20configured');}if(!this[_0x4789('0x84')](_0x5b23b1[_0x4789('0x7e')])){return this['channel'][_0x4789('0xaa')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x5b23b1['text'])){return this[_0x4789('0xf')]['noop'](_0x4789('0xab'));}this['channel'][_0x4789('0xe6')]=!![];this['createSquareDetailsReport'](_0x5b23b1);this[_0x4789('0x42')](_0x5b23b1[_0x4789('0x78')],'in','','');this['channel']['noop'](util[_0x4789('0x2a')](_0x4789('0xf1'),_0x5b23b1[_0x4789('0x78')]));var _0x998edc=this['googleDialogflowV2'][_0x4789('0xa8')](this,_0x5b23b1);if(_0x998edc){for(var _0x55eb80 in _0x998edc){if(_0x998edc['hasOwnProperty'](_0x55eb80)){if(_0x55eb80!==_0x4789('0xf2')){this[_0x4789('0xf')][_0x4789('0xa1')](util['format'](_0x4789('0xe8'),_0x55eb80[_0x4789('0x68')]()),_0x998edc[_0x55eb80]);}}}this['createSquareMessage'](_0x998edc[_0x4789('0xf3')],_0x4789('0xe9'),_0x4789('0xed'),_0x998edc[_0x4789('0xf2')]);return this['channel'][_0x4789('0xaa')](util['format']('DialogflowV2\x20Result\x20%s',_0x998edc[_0x4789('0xf3')]));}return this['channel'][_0x4789('0x2d')](_0x5b23b1,_0x4789('0xf4'));};AGIVertices['prototype']['sesteknda']=function(_0x198330){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x198330[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x198330[_0x4789('0xf5')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x4789('0x84')](_0x198330[_0x4789('0xf6')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xf7'));}if(!this['isConfigured'](_0x198330[_0x4789('0xf8')])){return this[_0x4789('0xf')]['noop'](_0x4789('0xf9'));}if(!this[_0x4789('0x84')](_0x198330[_0x4789('0xfa')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xab'));}this[_0x4789('0xf')][_0x4789('0xe6')]=!![];this['createSquareDetailsReport'](_0x198330);this[_0x4789('0x42')](_0x198330[_0x4789('0x78')],'in','','');this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xfb'),_0x198330[_0x4789('0x78')]));var _0x3f3e6e=this[_0x4789('0x7f')]['sync'](this,_0x198330);if(_0x3f3e6e){for(var _0x6d1f38 in _0x3f3e6e){if(_0x3f3e6e[_0x4789('0x97')](_0x6d1f38)){this[_0x4789('0xf')]['setVariable'](util[_0x4789('0x2a')](_0x4789('0xfc'),_0x6d1f38[_0x4789('0x68')]()),_0x3f3e6e[_0x6d1f38]);}}this[_0x4789('0x42')](_0x3f3e6e[_0x4789('0xf3')],_0x4789('0xe9'),_0x4789('0xfd'),'');if(_0x3f3e6e[_0x4789('0xfe')]){this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xff'),_0x3f3e6e['audiofile']));var _0x575ed2=this['channel'][_0x4789('0x100')](_0x3f3e6e[_0x4789('0xfe')]);try{fs['unlink'](_0x3f3e6e[_0x4789('0xfe')]+'.wav');}catch(_0x5ee945){logger['error'](_0x5ee945);}return _0x575ed2;}else{return this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x101'),_0x3f3e6e[_0x4789('0xf3')]));}}return this['channel']['error'](_0x198330,_0x4789('0x102'));};AGIVertices[_0x4789('0x11')]['end']=function(_0x7ebf30){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x7ebf30['label']));return this['channel'][_0x4789('0xaa')](_0x4789('0x103'));};AGIVertices[_0x4789('0x11')][_0x4789('0x104')]=function(_0x15349e){logger[_0x4789('0x2f')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x15349e[_0x4789('0x38')]));var _0xc242c0='';if(_0x15349e['trunk_id']){if(!this[_0x4789('0x84')](_0x15349e[_0x4789('0x105')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x15349e,_0x4789('0x106'));}else{var _0x1b82a9=parseInt(_0x15349e[_0x4789('0x105')],0xa);if(isNaN(_0x1b82a9)){_0xc242c0=_0x15349e[_0x4789('0x105')];}else{_0xc242c0=this[_0x4789('0x107')][_0x4789('0xa8')](this,_0x15349e[_0x4789('0x105')]);if(!_0xc242c0){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x15349e,'no\x20trunk\x20found');}}}}else if(_0x15349e[_0x4789('0x108')]){_0xc242c0=_0x15349e[_0x4789('0x108')];}else{return this[_0x4789('0xf')][_0x4789('0x2d')](_0x15349e,_0x4789('0x106'));}var _0x5529f9=this[_0x4789('0xf')]['exec'](_0x4789('0xe3'),[util[_0x4789('0x2a')]('SIP/%s/%s',_0xc242c0,_0x15349e[_0x4789('0x49')]),_0x15349e[_0x4789('0x63')],_0x15349e['opts'],_0x15349e[_0x4789('0x61')]]);if(_0x5529f9[_0x4789('0xa6')]===-0x1){return _0x5529f9;}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('Executed\x20command\x20%s',_0x4789('0xe3')));};AGIVertices['prototype'][_0x4789('0x109')]=function(_0x5163e0){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x10a'),_0x5163e0['label']));return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x109'));};AGIVertices[_0x4789('0x11')]['getdigits']=function(_0x3e3457){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3e3457[_0x4789('0x38')]));if(_0x3e3457['retry']===0x0){return this[_0x4789('0xa7')](_0x3e3457);}_0x3e3457['retry']-=0x1;if(!this['isConfigured'](_0x3e3457['file_id'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x3e3457,_0x4789('0x10b'));}var _0x367eb0=this[_0x4789('0x1d')]['sync'](this,_0x3e3457[_0x4789('0x10c')]);if(!_0x367eb0){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x3e3457,_0x4789('0x10d'));}if(!this[_0x4789('0x84')](_0x3e3457['variable_id'])){return this[_0x4789('0xf')][_0x4789('0x2d')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x30db41=this[_0x4789('0xf')]['getData'](_0x367eb0,_0x3e3457['response'],_0x3e3457[_0x4789('0x10e')]);var _0x54faab=_0x30db41[_0x4789('0xa6')]?_0x30db41['result'][_0x4789('0x4d')]():'';logger[_0x4789('0x2f')](_0x4789('0x10f'),JSON['stringify'](_0x30db41));if(_0x30db41['result']===-0x1){this[_0x4789('0x36')]['sync'](this,_0x3e3457,_0x54faab);return _0x30db41;}else if(_0x30db41['extra']===_0x4789('0x63')){_0x30db41[_0x4789('0xa6')]=_0x54faab[_0x4789('0x9c')]>=parseInt(_0x3e3457[_0x4789('0x110')])?'x':'i';}else{_0x30db41['result']=_0x54faab['length']>=parseInt(_0x3e3457[_0x4789('0x110')])&&_0x54faab[_0x4789('0x9c')]<=parseInt(_0x3e3457[_0x4789('0x10e')])?'x':'i';}var _0x229d47=this[_0x4789('0xa4')]['sync'](this,_0x3e3457[_0x4789('0xd8')]);if(!_0x229d47){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x3e3457,'no\x20variable\x20found');}this[_0x4789('0xf')][_0x4789('0xa1')](_0x229d47,_0x54faab);if(this[_0x4789('0x84')](_0x3e3457[_0x4789('0x111')])){var _0x11bb05=parseInt(_0x3e3457[_0x4789('0x111')],0xa);var _0x1e100e=rs[_0x4789('0x112')]({'charset':'*','length':_0x11bb05});var _0x32c678=_0x54faab['length'];if(_0x32c678>0x0){if(_0x32c678>_0x11bb05){this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x3e3457,_0x3e3457[_0x4789('0x113')]===_0x4789('0x114')?_0x1e100e+_0x54faab[_0x4789('0x115')](_0x11bb05):_0x54faab[_0x4789('0x115')](0x0,_0x32c678-_0x11bb05)+_0x1e100e);}else{this['createSquareDetailsReport'][_0x4789('0xa8')](this,_0x3e3457,rs[_0x4789('0x112')]({'charset':'*','length':_0x32c678}));}}else{this['createSquareDetailsReport'][_0x4789('0xa8')](this,_0x3e3457,'');}}else{this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x3e3457,_0x54faab);}return _0x30db41;};AGIVertices[_0x4789('0x11')][_0x4789('0x116')]=function(_0x71810a){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x71810a[_0x4789('0x38')]));return this[_0x4789('0x117')](_0x71810a);};AGIVertices[_0x4789('0x11')][_0x4789('0x118')]=function(_0x59265a){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x119'),_0x59265a[_0x4789('0x38')]));this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x59265a,_0x59265a[_0x4789('0x11a')]);return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x11b'),_0x59265a[_0x4789('0x11a')]));};AGIVertices[_0x4789('0x11')]['awspolly']=function(_0x1b1af6){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x11c'),_0x1b1af6[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x1b1af6[_0x4789('0x87')])||!this['isConfigured'](_0x1b1af6[_0x4789('0x88')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x11d'));}if(!this[_0x4789('0x84')](_0x1b1af6[_0x4789('0x78')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xab'));}this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x11e'),_0x1b1af6['text']));var _0x24b7df=this[_0x4789('0x86')][_0x4789('0xa8')](this,_0x1b1af6);if(_0x24b7df){this['channel']['noop'](util['format'](_0x4789('0x11f'),_0x24b7df));var _0x1ff03f=this[_0x4789('0xf')][_0x4789('0x100')](_0x24b7df);try{fs[_0x4789('0x120')](_0x24b7df+_0x4789('0x121'));}catch(_0x353a14){logger['error'](_0x353a14);}return _0x1ff03f;}return this['channel'][_0x4789('0x2d')](_0x1b1af6,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x4789('0x122')]=function(_0x4d897c){logger[_0x4789('0x2f')](util['format'](_0x4789('0x123'),_0x4d897c[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x4d897c[_0x4789('0x87')])||!this['isConfigured'](_0x4d897c['aws_secret_access_key'])){return this['channel'][_0x4789('0xaa')](_0x4789('0x11d'));}if(!this['isConfigured'](_0x4d897c[_0x4789('0x8e')])){return this[_0x4789('0xf')]['noop'](_0x4789('0x124'));}if(!this[_0x4789('0x84')](_0x4d897c[_0x4789('0x78')])){return this['channel'][_0x4789('0xaa')]('no\x20text\x20configured');}this[_0x4789('0xf')][_0x4789('0xe6')]=!![];this['createSquareDetailsReport'](_0x4d897c);this[_0x4789('0x42')](_0x4d897c[_0x4789('0x78')],'in','','');this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x125'),_0x4d897c[_0x4789('0x78')]));var _0x1cb930=this[_0x4789('0x126')][_0x4789('0xa8')](this,_0x4d897c);if(_0x1cb930){for(var _0x3af07a in _0x1cb930){if(_0x1cb930[_0x4789('0x97')](_0x3af07a)&&_[_0x4789('0x9d')](_0x1cb930[_0x3af07a])){this[_0x4789('0xf')]['setVariable'](util['format'](_0x4789('0x127'),_0x3af07a[_0x4789('0x68')]()),_0x1cb930[_0x3af07a]);}}if(_[_0x4789('0x45')](_0x1cb930[_0x4789('0x74')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x1cb930[_0x4789('0x74')],_0x4789('0xe9'),_0x4789('0x128'),'');return this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x129'),_0x1cb930[_0x4789('0x74')]));}}return this['channel'][_0x4789('0x2d')](_0x4d897c,_0x4789('0x12a'));};AGIVertices[_0x4789('0x11')][_0x4789('0x12b')]=function(_0xe260cd){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x12c'),_0xe260cd[_0x4789('0x38')],_0xe260cd[_0x4789('0x63')]));if(!this[_0x4789('0x84')](_0xe260cd[_0x4789('0x77')])){return this['channel'][_0x4789('0xaa')]('no\x20key\x20configured');}var _0x198b0e=_0x4789('0x12d');var _0x31d314=util[_0x4789('0x2a')](_0x4789('0x12e'),FILES_PATH,rs[_0x4789('0x112')](0x4));var _0x1f9055=util[_0x4789('0x2a')](_0x4789('0xa0'),_0x31d314,_0x198b0e);var _0x87df35=!![];if(_0xe260cd['beep']===_0x4789('0x12f')){_0x87df35=![];}var _0x27ba4c=this[_0x4789('0xf')][_0x4789('0x130')](_0x31d314,_0x198b0e,_0xe260cd[_0x4789('0x131')],_0xe260cd['timeout'],undefined,_0x87df35);if(_0x27ba4c[_0x4789('0xa6')]!==-0x1){this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x132'),_0x1f9055));var _0x105c4e=this[_0x4789('0x8f')][_0x4789('0xa8')](this,_0xe260cd,_0x1f9055);if(_0x105c4e){for(var _0x3c32fa in _0x105c4e){if(_0x105c4e['hasOwnProperty'](_0x3c32fa)){this['channel']['setVariable'](util[_0x4789('0x2a')](_0x4789('0x133'),_0x3c32fa['toUpperCase']()),_0x105c4e[_0x3c32fa]);}}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x134'),JSON['stringify'](_0x105c4e)));}}return _0x27ba4c;};AGIVertices[_0x4789('0x11')][_0x4789('0x135')]=function(_0x574934){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x136'),_0x574934[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x574934[_0x4789('0x91')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x137'));}if(!this['isConfigured'](_0x574934[_0x4789('0x92')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x138'));}var _0x5c6a13=_0x4789('0x12d');var _0x2f287f=util[_0x4789('0x2a')](_0x4789('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x4ee8c6=util[_0x4789('0x2a')](_0x4789('0xa0'),_0x2f287f,_0x5c6a13);var _0x123dcd=!![];if(_0x574934[_0x4789('0x139')]===_0x4789('0x12f')){_0x123dcd=![];}var _0x52d97b=this['channel']['recordFile'](_0x2f287f,_0x5c6a13,_0x574934[_0x4789('0x131')],_0x574934[_0x4789('0x63')],undefined,_0x123dcd);if(_0x52d97b[_0x4789('0xa6')]!==-0x1){this[_0x4789('0xf')]['noop'](util['format'](_0x4789('0x13a'),_0x4ee8c6));var _0x4413e3=this[_0x4789('0x90')][_0x4789('0xa8')](this,_0x574934,_0x4ee8c6);if(_0x4413e3){for(var _0x721e24 in _0x4413e3){if(_0x4413e3[_0x4789('0x97')](_0x721e24)){this['channel'][_0x4789('0xa1')](util['format'](_0x4789('0x13b'),_0x721e24[_0x4789('0x68')]()),_0x4413e3[_0x721e24]);}}return this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x13c'),JSON[_0x4789('0x70')](_0x4413e3)));}}return _0x52d97b;};AGIVertices[_0x4789('0x11')][_0x4789('0x13d')]=function(_0x5acb3c){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5acb3c[_0x4789('0x38')]));return this[_0x4789('0xf')][_0x4789('0x13e')](_0x5acb3c[_0x4789('0x3d')],_0x5acb3c[_0x4789('0x3e')],_0x5acb3c[_0x4789('0x13f')]);};AGIVertices[_0x4789('0x11')]['gotoif']=function(_0x453814){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x140'),_0x453814['label']));if(!this[_0x4789('0x84')](_0x453814[_0x4789('0x141')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x453814,_0x4789('0x142'));}try{var _0x7ed925=eval(_0x453814['condition'])?_0x4789('0x143'):_0x4789('0x144');this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x145'),_0x453814[_0x4789('0x141')],_0x7ed925));return{'code':0xc8,'result':_0x7ed925};}catch(_0x45dd83){return{'code':0xc8,'result':_0x4789('0x144')};}};AGIVertices[_0x4789('0x11')][_0x4789('0x146')]=function(_0x105d2b){logger['info'](util[_0x4789('0x2a')](_0x4789('0x147'),_0x105d2b['label']));if(!this[_0x4789('0x84')](_0x105d2b[_0x4789('0x148')])){return this['channel'][_0x4789('0x2d')](_0x105d2b,_0x4789('0x149'));}var _0x199b67=this[_0x4789('0x24')][_0x4789('0xa8')](this,_0x105d2b['interval_id']);if(!_0x199b67){return this[_0x4789('0xf')]['error'](_0x105d2b,_0x4789('0x14a'));}for(var _0x5f40f8=0x0;_0x5f40f8<_0x199b67[_0x4789('0x9c')];_0x5f40f8+=0x1){var _0x315cde=this['channel'][_0x4789('0xa4')](util['format'](_0x4789('0x14b'),_0x199b67[_0x5f40f8]));if(_0x315cde[_0x4789('0xa6')]===-0x1){return _0x315cde;}logger[_0x4789('0x2f')](util['format'](_0x4789('0x14c'),_0x199b67[_0x5f40f8],_0x315cde[_0x4789('0xa5')]));if(_0x315cde[_0x4789('0xa5')]==='true'){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x14c'),_0x199b67[_0x5f40f8],_0x4789('0x143')));this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('IFTIME\x20%s\x20%s',_0x199b67[_0x5f40f8],_0x4789('0x143')));return{'code':0xc8,'result':_0x4789('0x143')};}else{logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x14c'),_0x199b67[_0x5f40f8],_0x4789('0x144')));this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x14c'),_0x199b67[_0x5f40f8],_0x4789('0x144')));}}return{'code':0xc8,'result':_0x4789('0x144')};};AGIVertices['prototype'][_0x4789('0x14d')]=function(_0x10dc8d){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x14e'),_0x10dc8d[_0x4789('0x38')]));return this[_0x4789('0xf')]['hangup']();};AGIVertices[_0x4789('0x11')][_0x4789('0x14f')]=function(_0x5a78b0){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x150'),_0x5a78b0[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x5a78b0[_0x4789('0x77')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xe5'));}var _0x3977aa=_0x4789('0x12d');var _0x562b7b=util[_0x4789('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1c15ce=util['format'](_0x4789('0xa0'),_0x562b7b,_0x3977aa);var _0x3a4829=!![];if(_0x5a78b0['beep']===_0x4789('0x12f')){_0x3a4829=![];}var _0x2dd24c=this[_0x4789('0xf')][_0x4789('0x130')](_0x562b7b,_0x3977aa,_0x5a78b0[_0x4789('0x131')],_0x5a78b0['timeout'],undefined,_0x3a4829);if(_0x2dd24c[_0x4789('0xa6')]!==-0x1){this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x151'),_0x1c15ce));var _0xeee4f9=this[_0x4789('0x83')][_0x4789('0xa8')](this,_0x5a78b0,_0x1c15ce);if(_0xeee4f9){for(var _0x17bcc4 in _0xeee4f9){if(_0xeee4f9[_0x4789('0x97')](_0x17bcc4)){this[_0x4789('0xf')][_0x4789('0xa1')](util[_0x4789('0x2a')](_0x4789('0x152'),_0x17bcc4[_0x4789('0x68')]()),_0xeee4f9[_0x17bcc4]);}}return this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x153'),JSON[_0x4789('0x70')](_0xeee4f9)));}}return _0x2dd24c;};AGIVertices[_0x4789('0x11')][_0x4789('0x154')]=function(_0x2143a9){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x2143a9[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x2143a9[_0x4789('0x77')])){return this['channel'][_0x4789('0xaa')](_0x4789('0xe5'));}if(!this[_0x4789('0x84')](_0x2143a9[_0x4789('0x78')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xab'));}this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x155'),_0x2143a9['text']));var _0x1e03ec=this['ispeechTTS'][_0x4789('0xa8')](this,_0x2143a9);if(_0x1e03ec){this[_0x4789('0xf')]['noop'](util[_0x4789('0x2a')](_0x4789('0x151'),_0x1e03ec));var _0x391ec4=this['channel']['streamFile'](_0x1e03ec,_0x2143a9[_0x4789('0x131')]);try{fs[_0x4789('0x120')](_0x1e03ec+'.wav');}catch(_0x5590d4){logger[_0x4789('0x2d')](_0x5590d4);}return _0x391ec4;}return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2143a9,_0x4789('0x156'));};AGIVertices[_0x4789('0x11')][_0x4789('0x157')]=function(_0x1f4083){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1f4083[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x1f4083['findBy'])){return this['channel'][_0x4789('0x2d')](_0x1f4083,_0x4789('0x158'));}logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x159'),this['channel']['callerid'],_0x1f4083[_0x4789('0x15a')]));var _0x3f50ff=this[_0x4789('0x55')][_0x4789('0xa8')](this,_0x1f4083[_0x4789('0x15a')]);if(_0x3f50ff){logger['info'](util['format'](_0x4789('0x15b'),this['channel'][_0x4789('0x3b')],_0x1f4083[_0x4789('0x15a')]));this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4789('0xf')][_0x4789('0x3b')],_0x1f4083[_0x4789('0x15a')]));return{'code':0xc8,'result':_0x4789('0x15c')};}else{logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4789('0xf')]['callerid'],_0x1f4083[_0x4789('0x15a')]));this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x15d'),this[_0x4789('0xf')]['callerid'],_0x1f4083[_0x4789('0x15a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4789('0x11')]['logout']=function(_0xa3a49c){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x15e'),_0xa3a49c[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0xa3a49c[_0x4789('0x15a')])){return this[_0x4789('0xf')]['error'](_0xa3a49c,'no\x20find\x20by\x20configured');}logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x159'),this[_0x4789('0xf')]['callerid'],_0xa3a49c[_0x4789('0x15a')]));var _0x28f246=this[_0x4789('0x53')][_0x4789('0xa8')](this,_0xa3a49c[_0x4789('0x15a')]);if(_0x28f246){logger['info'](util[_0x4789('0x2a')](_0x4789('0x15b'),this[_0x4789('0xf')]['callerid'],_0xa3a49c[_0x4789('0x15a')]));this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x15b'),this['channel']['callerid'],_0xa3a49c[_0x4789('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x4789('0x2a')](_0x4789('0x15d'),this['channel'][_0x4789('0x3b')],_0xa3a49c[_0x4789('0x15a')]));this['channel']['noop'](util[_0x4789('0x2a')](_0x4789('0x15d'),this[_0x4789('0xf')][_0x4789('0x3b')],_0xa3a49c['findBy']));return{'code':0xc8,'result':_0x4789('0x15f')};}};AGIVertices[_0x4789('0x11')][_0x4789('0x160')]=function(_0x5e589f){logger['info'](util[_0x4789('0x2a')](_0x4789('0x161'),_0x5e589f['label']));if(!this[_0x4789('0x84')](_0x5e589f['operation'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x5e589f,'no\x20operation\x20configured');}this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x162'),_0x5e589f[_0x4789('0x163')]));var _0x52778e=eval(_0x5e589f[_0x4789('0x163')]);if(!this[_0x4789('0x84')](_0x5e589f[_0x4789('0xd8')])){return this[_0x4789('0xf')]['noop'](_0x4789('0xd9'));}var _0x2647be=this[_0x4789('0xa4')][_0x4789('0xa8')](this,_0x5e589f[_0x4789('0xd8')]);if(!_0x2647be){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x5e589f,'no\x20variable\x20found');}if(_[_0x4789('0x9b')](_0x52778e)){var _0x5f2fe8=this;_0x52778e[_0x4789('0xdb')](function(_0x1bec53,_0x4eb71f){_0x5f2fe8[_0x4789('0xf')]['setVariable'](util['format'](_0x4789('0x164'),_0x2647be,_0x4eb71f),_0x1bec53);});return this[_0x4789('0xf')]['noop'](util['format']('variable\x20%s[key]\x20set',_0x2647be));}else{return this[_0x4789('0xf')][_0x4789('0xa1')](_0x2647be,_0x52778e);}};AGIVertices[_0x4789('0x11')][_0x4789('0xe')]=function(_0x36332e){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x36332e[_0x4789('0x38')]));if(_0x36332e['retry']===0x0){return this[_0x4789('0xa7')](_0x36332e);}_0x36332e[_0x4789('0xa9')]-=0x1;if(!this['isConfigured'](_0x36332e['file_id'])){return this['channel'][_0x4789('0x2d')](_0x36332e,_0x4789('0x10b'));}var _0x5baf76=this[_0x4789('0x1d')][_0x4789('0xa8')](this,_0x36332e[_0x4789('0x10c')]);if(!_0x5baf76){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x36332e,'no\x20file\x20audio\x20found');}var _0x45de9e=this[_0x4789('0xf')][_0x4789('0x165')](_0x5baf76,_0x36332e[_0x4789('0x166')],_0x36332e[_0x4789('0x167')]);var _0x5b6880=_0x45de9e[_0x4789('0xa6')];if(_0x45de9e['result']===-0x1){this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x36332e,'-1');return _0x45de9e;}else if(_0x45de9e[_0x4789('0xa5')]===_0x4789('0x63')){_0x45de9e[_0x4789('0xa6')]=_0x45de9e[_0x4789('0xa6')][_0x4789('0x9c')]>0x0?_0x45de9e[_0x4789('0xa6')]:'t';}else if(_[_0x4789('0x44')](_0x45de9e[_0x4789('0xa6')])){_0x45de9e['result']='#';_0x5b6880='#';}if(!this[_0x4789('0x84')](_0x36332e[_0x4789('0xd8')])){this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x53cdaf=this['getVariable'][_0x4789('0xa8')](this,_0x36332e[_0x4789('0xd8')]);if(!_0x53cdaf){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x36332e,_0x4789('0xda'));}this[_0x4789('0xf')]['setVariable'](_0x53cdaf,_0x5b6880);}this[_0x4789('0x36')]['sync'](this,_0x36332e,_0x5b6880);return _0x45de9e;};AGIVertices[_0x4789('0x11')]['noop']=function(_0x4334b9){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x168'),_0x4334b9[_0x4789('0x38')]));return this['channel']['noop'](_0x4334b9[_0x4789('0x169')]||_0x4334b9['label']);};AGIVertices[_0x4789('0x11')][_0x4789('0x16a')]=function(_0x234984){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x16b'),_0x234984['label']));if(!this[_0x4789('0x84')](_0x234984['findBy'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x234984,_0x4789('0x158'));}logger['info'](util[_0x4789('0x2a')](_0x4789('0x159'),this[_0x4789('0xf')][_0x4789('0x3b')],_0x234984[_0x4789('0x15a')]));var _0x22b0ce=this[_0x4789('0x4f')][_0x4789('0xa8')](this,_0x234984['pause_id']);var _0x27455d=this['agentPause'][_0x4789('0xa8')](this,_0x234984[_0x4789('0x15a')],_0x22b0ce);if(_0x27455d){logger['info'](util[_0x4789('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4789('0xf')][_0x4789('0x3b')],_0x234984['findBy']));this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x15b'),this['channel'][_0x4789('0x3b')],_0x234984['findBy']));return{'code':0xc8,'result':_0x4789('0x15c')};}else{logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x15d'),this[_0x4789('0xf')][_0x4789('0x3b')],_0x234984[_0x4789('0x15a')]));this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x15b'),this[_0x4789('0xf')][_0x4789('0x3b')],_0x234984['findBy']));return{'code':0xc8,'result':_0x4789('0x15f')};}};AGIVertices[_0x4789('0x11')][_0x4789('0x16c')]=function(_0x337e7a){logger[_0x4789('0x2f')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x337e7a[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x337e7a['file_id'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x337e7a,_0x4789('0x10b'));}var _0x28dca6=this[_0x4789('0x1d')][_0x4789('0xa8')](this,_0x337e7a[_0x4789('0x10c')]);if(!_0x28dca6){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x337e7a,_0x4789('0x10d'));}var _0x34911b=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0x16d'),[_0x28dca6,_0x337e7a['opts']]);if(_0x34911b[_0x4789('0xa6')]===-0x1){return _0x34911b;}return this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')]('Executed\x20command\x20%s\x20%s',_0x4789('0x16d'),_0x28dca6));};AGIVertices[_0x4789('0x11')][_0x4789('0x16e')]=function(_0x4b948f){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x16f'),_0x4b948f[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x4b948f[_0x4789('0x170')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x4b948f,_0x4789('0x171'));}var _0x1ae166='';var _0x2efcf7=parseInt(_0x4b948f['queue_id'],0xa);if(isNaN(_0x2efcf7)){_0x1ae166=_0x4b948f[_0x4789('0x170')];}else{_0x1ae166=this['getVoiceQueue'][_0x4789('0xa8')](this,_0x4b948f[_0x4789('0x170')]);if(!_0x1ae166){return this['channel'][_0x4789('0x2d')](_0x4b948f,_0x4789('0x172'));}}var _0x5096c2='';if(this[_0x4789('0x84')](_0x4b948f[_0x4789('0x10c')])){var _0x39d9a2=this['getSound'][_0x4789('0xa8')](this,_0x4b948f['file_id']);if(_0x39d9a2){_0x5096c2=_0x39d9a2;}}this[_0x4789('0x36')]['sync'](this,_0x4b948f,_0x1ae166);if(_0x4b948f[_0x4789('0x173')][_0x4789('0x174')]('x')<0x0){_0x4b948f[_0x4789('0x173')]+='x';}if(_0x4b948f[_0x4789('0x173')]['indexOf']('X')<0x0){_0x4b948f['opts']+='X';}this[_0x4789('0xf')][_0x4789('0xa1')](_0x4789('0x175'),_0x1ae166?_0x1ae166[_0x4789('0x176')]():'');var _0x5b53b9=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0x177'),[_0x1ae166,_0x4b948f[_0x4789('0x173')],_0x4b948f[_0x4789('0x61')],_0x5096c2,_0x4b948f[_0x4789('0x63')],_0x4b948f[_0x4789('0xb9')],_0x4b948f[_0x4789('0x178')],_0x4b948f[_0x4789('0x179')],'',_0x4b948f[_0x4789('0x17a')]]);if(_0x5b53b9['result']===-0x1){return _0x5b53b9;}return this[_0x4789('0xf')]['noop'](util[_0x4789('0x2a')](_0x4789('0xc5'),_0x4789('0x177'),_0x1ae166));};AGIVertices[_0x4789('0x11')][_0x4789('0x17b')]=function(_0x570cd2){logger[_0x4789('0x2f')](util['format'](_0x4789('0x17c'),_0x570cd2[_0x4789('0x38')]));var _0x4a8b02=_0x570cd2[_0x4789('0x17d')]||_0x4789('0x12d');var _0x48cf87=util['format'](_0x4789('0x17e'),this['channel']['uniqueid'],rs[_0x4789('0x112')](0x5));var _0x2826fe=util[_0x4789('0x2a')](_0x4789('0x17f'),FILES_PATH,_0x48cf87,_0x4a8b02);var _0xf15cb5=util['format'](_0x4789('0x12e'),FILES_PATH,_0x48cf87);this[_0x4789('0x3a')]['sync'](this,_0x570cd2,_0x48cf87,_0x2826fe);this[_0x4789('0xf')][_0x4789('0xa1')](_0x4789('0x180'),_0x48cf87);logger['info'](_0x4789('0x181'),_0xf15cb5,_0x4a8b02,_0x570cd2['escape_digits'],_0x570cd2[_0x4789('0x63')]);return this[_0x4789('0xf')]['recordFile'](_0xf15cb5,_0x4a8b02,_0x570cd2[_0x4789('0x182')],_0x570cd2[_0x4789('0x63')],undefined,!![]);};AGIVertices[_0x4789('0x11')]['restapi']=function(_0xa0d247){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0xa0d247[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0xa0d247['url'])){return this[_0x4789('0xf')]['noop'](_0x4789('0x183'));}var _0x3f7fa3=this[_0x4789('0x60')][_0x4789('0xa8')](this,_0xa0d247);logger['info'](util[_0x4789('0x2a')]('Response:',util[_0x4789('0x184')](_0x3f7fa3,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xa0d247['variable_id'])){return this[_0x4789('0xf')]['noop'](_0x4789('0x185'));}var _0x137797=this[_0x4789('0xa4')][_0x4789('0xa8')](this,_0xa0d247[_0x4789('0xd8')]);if(!_0x137797){return this['channel'][_0x4789('0x2d')](_0xa0d247,_0x4789('0xda'));}this[_0x4789('0xf')][_0x4789('0xa1')](util[_0x4789('0x2a')](_0x4789('0x186'),_0x137797),_0x3f7fa3['statusCode']?_0x3f7fa3[_0x4789('0x72')]:_0x4789('0x187'));this[_0x4789('0xf')][_0x4789('0xa1')](util['format'](_0x4789('0x188'),_0x137797),_0x3f7fa3['statusMessage']?_0x3f7fa3['statusMessage']:'OK');if(_0x3f7fa3['body']){try{this[_0x4789('0x9f')](_0x3f7fa3[_0x4789('0x69')],_0x137797);}catch(_0x15afd9){logger['error'](util['format'](_0x4789('0x189'),_0x137797));}}return this[_0x4789('0xf')]['noop'](util['format']('variable\x20%s\x20set',_0x137797));};AGIVertices[_0x4789('0x11')][_0x4789('0x18a')]=function(_0x9c90da){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x18b'),_0x9c90da[_0x4789('0x38')]));return this[_0x4789('0xf')][_0x4789('0x18c')](_0x9c90da[_0x4789('0x18d')][_0x4789('0x58')](/\s+/g,''),_0x9c90da[_0x4789('0x182')]);};AGIVertices[_0x4789('0x11')]['saynumber']=function(_0x35feea){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x35feea[_0x4789('0x38')]));return this[_0x4789('0xf')][_0x4789('0x18e')](_0x35feea['number']['replace'](/\s+/g,''),_0x35feea['escape_digits']);};AGIVertices[_0x4789('0x11')][_0x4789('0x18f')]=function(_0x6feea6){logger['info'](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x6feea6[_0x4789('0x38')]));return this[_0x4789('0xf')][_0x4789('0x190')](_0x6feea6[_0x4789('0x78')],_0x6feea6[_0x4789('0x182')]);};AGIVertices[_0x4789('0x11')][_0x4789('0x191')]=function(_0x4a14e9){logger['info'](util[_0x4789('0x2a')](_0x4789('0x192'),_0x4a14e9[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x4a14e9[_0x4789('0x193')])){return this[_0x4789('0xf')]['noop'](_0x4789('0x194'));}var _0x1a160c=this[_0x4789('0x195')]['sync'](this,_0x4a14e9[_0x4789('0x193')]);if(!_0x1a160c||!_0x1a160c['Smtp']){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x4a14e9,_0x4789('0x196'));}var _0x43f73a={'from':util[_0x4789('0x2a')](_0x4789('0x197'),_0x1a160c[_0x4789('0x17')],_0x1a160c[_0x4789('0x198')]||_0x1a160c['Smtp']['user']),'to':_0x4a14e9['to']||'','cc':_0x4a14e9['cc']||'','bcc':_0x4a14e9[_0x4789('0x199')]||'','subject':_0x4a14e9[_0x4789('0x19a')],'html':_0x4a14e9[_0x4789('0x78')],'text':_0x4a14e9[_0x4789('0x78')]};if(this[_0x4789('0x84')](_0x4a14e9[_0x4789('0x19b')])){}logger[_0x4789('0x19c')]('sendMail\x20message',JSON[_0x4789('0x70')](_0x43f73a));this['createSquareDetailsReport'][_0x4789('0xa8')](this,_0x4a14e9,_0x4a14e9[_0x4789('0x193')]);this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x19d'),_0x1a160c[_0x4789('0x17')]));this[_0x4789('0x22')]['sync'](this,_0x1a160c[_0x4789('0x19e')],_0x43f73a);return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x19f'));};AGIVertices[_0x4789('0x11')][_0x4789('0x1a0')]=function(_0x363853){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x1a1'),_0x363853['label']));return this[_0x4789('0xf')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x4789('0x11')]['sendSMS']=function(_0x16ef3c){logger['info'](util[_0x4789('0x2a')](_0x4789('0x1a2'),_0x16ef3c[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x16ef3c[_0x4789('0x1a3')])){return this['channel'][_0x4789('0xaa')](_0x4789('0x1a4'));}var _0x31bc6c=this['getSmsAccount'][_0x4789('0xa8')](this,_0x16ef3c[_0x4789('0x1a3')]);if(!_0x31bc6c){return this['channel'][_0x4789('0x2d')](_0x16ef3c,_0x4789('0x1a5'));}var _0x2850d7={'body':_0x16ef3c['sms_text'],'phone':_0x16ef3c['to']||'','SmsAccountId':_0x31bc6c['id']};logger[_0x4789('0x19c')](_0x4789('0x1a6'),JSON[_0x4789('0x70')](_0x2850d7));this[_0x4789('0x36')]['sync'](this,_0x16ef3c,_0x16ef3c['sms_account_id']);this['channel'][_0x4789('0xaa')](util['format'](_0x4789('0x1a7'),_0x31bc6c['name']));this[_0x4789('0x35')]['sync'](this,_0x2850d7);return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x1a8'));};AGIVertices[_0x4789('0x11')][_0x4789('0x1a9')]=function(_0x405851){logger['info'](util[_0x4789('0x2a')](_0x4789('0x1aa'),_0x405851[_0x4789('0x38')]));if(!this['isConfigured'](_0x405851[_0x4789('0xd8')])){return this[_0x4789('0xf')]['error'](_0x405851,_0x4789('0x1ab'));}var _0x5ca924=this['getVariable'][_0x4789('0xa8')](this,_0x405851[_0x4789('0xd8')]);if(!_0x5ca924){return this['channel'][_0x4789('0x2d')](_0x405851,'no\x20variable\x20found');}return this[_0x4789('0xf')][_0x4789('0xa1')](_0x5ca924,_0x405851['variable_value']);};AGIVertices['prototype'][_0x4789('0x1ac')]=function(_0x1fdb2d){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20START\x20(%s)\x20block',_0x1fdb2d[_0x4789('0x38')]));this['channel'][_0x4789('0xaa')](_0x4789('0x1ad'));if(_0x1fdb2d[_0x4789('0xbb')]===_0x4789('0x1ae')){this['channel']['noop'](_0x4789('0x1af'));return this[_0x4789('0xf')][_0x4789('0xbb')]();}return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x1b0'));};AGIVertices['prototype'][_0x4789('0x1b1')]=function(_0x2eed16){logger[_0x4789('0x2f')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2eed16[_0x4789('0x38')]));if(!this['isConfigured'](_0x2eed16[_0x4789('0x1b2')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2eed16,'no\x20subproject\x20selected');}var _0x15d315=this[_0x4789('0x16')]['sync'](this,_0x2eed16[_0x4789('0x1b2')]);if(!this[_0x4789('0x84')](_0x15d315)){return this[_0x4789('0xf')]['error'](_0x2eed16,util[_0x4789('0x2a')](_0x4789('0x1b3'),_0x2eed16[_0x4789('0x1b2')]));}if(_0x15d315===this[_0x4789('0xf')][_0x4789('0x39')]){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2eed16,_0x4789('0x1b4'));}this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x2eed16,_0x15d315);var _0xea740e=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0x1b5'),util[_0x4789('0x2a')](_0x4789('0x1b6'),config[_0x4789('0xb9')]['host']||_0x4789('0x1b7'),_0x15d315,this[_0x4789('0xf')][_0x4789('0x39')]));if(_0xea740e['result']===-0x1){return _0xea740e;}return this[_0x4789('0xf')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x4789('0x1b5'),_0x15d315));};AGIVertices['prototype'][_0x4789('0x1b8')]=function(_0x2154ac){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x1b9'),_0x2154ac[_0x4789('0x38')]));var _0x543ccd=this['shellCommand']['sync'](this,_0x2154ac[_0x4789('0x1ba')]);this['createSquareDetailsReport'][_0x4789('0xa8')](this,_0x2154ac,_0x2154ac[_0x4789('0x1ba')]);if(this['isConfigured'](_0x2154ac[_0x4789('0xd8')])){var _0x19dfc3=this[_0x4789('0xa4')][_0x4789('0xa8')](this,_0x2154ac[_0x4789('0xd8')]);if(_0x19dfc3){this[_0x4789('0xf')][_0x4789('0xa1')](_0x19dfc3,_0x543ccd);return this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2154ac[_0x4789('0x1ba')],_0x19dfc3));}}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x1bb'),_0x2154ac[_0x4789('0x1ba')]));};AGIVertices[_0x4789('0x11')][_0x4789('0x1bc')]=function(_0x524edb){logger['info'](util[_0x4789('0x2a')](_0x4789('0x1bd'),_0x524edb['label']));_0x524edb[_0x4789('0x78')]=_0x524edb[_0x4789('0x78')][_0x4789('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4789('0x84')](_0x524edb['apiKey'])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x1be'));}if(!this[_0x4789('0x84')](_0x524edb['text'])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20text\x20configured');}this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x1bf'),_0x524edb['text']));var _0x52e312=this[_0x4789('0x59')][_0x4789('0xa8')](this,_0x524edb);if(_0x52e312){this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x52e312));var _0x3d4f14=this[_0x4789('0xf')]['streamFile'](_0x52e312);try{fs[_0x4789('0x120')](_0x52e312+_0x4789('0x121'));}catch(_0x1083ae){logger[_0x4789('0x2d')](_0x1083ae);}return _0x3d4f14;}return this['channel'][_0x4789('0x2d')](_0x524edb,_0x4789('0x1c0'));};AGIVertices[_0x4789('0x11')][_0x4789('0x1c1')]=function(_0x36962d){logger['info'](util[_0x4789('0x2a')](_0x4789('0x1c2'),_0x36962d[_0x4789('0x38')]));_0x36962d[_0x4789('0x78')]=_0x36962d[_0x4789('0x78')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4789('0x84')](_0x36962d['text'])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xab'));}this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x1c3'),_0x36962d[_0x4789('0x78')]));var _0x5d7a7f=this[_0x4789('0x5f')][_0x4789('0xa8')](this,_0x36962d);if(_0x5d7a7f){this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x1c4'),_0x5d7a7f));var _0x5e2cec=this[_0x4789('0xf')][_0x4789('0x100')](_0x5d7a7f);try{fs['unlink'](_0x5d7a7f+_0x4789('0x121'));}catch(_0x54a49a){logger[_0x4789('0x2d')](_0x54a49a);}return _0x5e2cec;}return this[_0x4789('0xf')][_0x4789('0x2d')](_0x36962d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x4789('0x11')][_0x4789('0x1c5')]=function(_0x389021){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x1c6'),_0x389021['label']));if(!this['isConfigured'](_0x389021['findBy'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x389021,'no\x20find\x20by\x20configured');}logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x159'),this[_0x4789('0xf')][_0x4789('0x3b')],_0x389021[_0x4789('0x15a')]));var _0x205ccc=this[_0x4789('0x52')]['sync'](this,_0x389021[_0x4789('0x15a')]);if(_0x205ccc){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4789('0xf')][_0x4789('0x3b')],_0x389021[_0x4789('0x15a')]));this['channel']['noop'](util['format'](_0x4789('0x15b'),this[_0x4789('0xf')][_0x4789('0x3b')],_0x389021[_0x4789('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x15d'),this['channel'][_0x4789('0x3b')],_0x389021[_0x4789('0x15a')]));this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x15d'),this['channel'][_0x4789('0x3b')],_0x389021['findBy']));return{'code':0xc8,'result':_0x4789('0x15f')};}};AGIVertices[_0x4789('0x11')][_0x4789('0x1c7')]=function(_0x5b9eb7){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x1c8'),_0x5b9eb7['label']));var _0xc0d504=this['channel'][_0x4789('0xac')]('VOICEMAIL',[_0x5b9eb7[_0x4789('0x1c9')],_0x5b9eb7[_0x4789('0x76')]]);if(_0xc0d504[_0x4789('0xa6')]===-0x1){return _0xc0d504;}return this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')]('Executed\x20command\x20%s\x20%s',_0x4789('0x1ca'),_0x5b9eb7[_0x4789('0x1c9')]));};AGIVertices[_0x4789('0x11')][_0x4789('0x1cb')]=function(_0x462311){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x462311[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x462311['variable_id'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x462311,_0x4789('0x1ab'));}var _0x7d3c63=this[_0x4789('0xa4')]['sync'](this,_0x462311['variable_id']);if(!_0x7d3c63){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x462311,_0x4789('0xda'));}var _0x5d4b3c=this[_0x4789('0xf')][_0x4789('0xa4')](_0x7d3c63);return{'code':0xc8,'result':_0x5d4b3c[_0x4789('0xa5')]?_0x5d4b3c[_0x4789('0xa5')]:'-'};};String['prototype'][_0x4789('0xa3')]=function(_0x36a561,_0x253fa8){return this[_0x4789('0xa2')](_0x36a561)[_0x4789('0x1cc')](_0x253fa8);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 56d707a..e7603b7 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 _0x10ed=['syncBlindTransfer','milliseconds','diff','seconds','prototype','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','stopAcw','saveUnpause','[%s][UPDATE][ERRORS:%s]','stringify','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','bind','attendedtransfer','syncAttendedTransfer','blindtransfer'];(function(_0x4de359,_0x29422b){var _0x30dfda=function(_0x895f89){while(--_0x895f89){_0x4de359['push'](_0x4de359['shift']());}};_0x30dfda(++_0x29422b);}(_0x10ed,0x1a2));var _0xd10e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x10ed[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd10e('0x0'));var moment=require(_0xd10e('0x1'));var ami=require(_0xd10e('0x2'));var logger=require(_0xd10e('0x3'))(_0xd10e('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xd10e('0x5'));function Acw(_0x309982){this[_0xd10e('0x6')]=_0x309982[_0xd10e('0x6')];this[_0xd10e('0x7')]=_0x309982[_0xd10e('0x7')];this[_0xd10e('0x8')]=_0x309982[_0xd10e('0x8')];this[_0xd10e('0x9')]={};ami['on'](_0xd10e('0xa'),this[_0xd10e('0xb')]['bind'](this));ami['on'](_0xd10e('0xc'),this[_0xd10e('0xd')]['bind'](this));ami['on'](_0xd10e('0xe'),this[_0xd10e('0xf')]['bind'](this));ami['on'](_0xd10e('0x10'),this[_0xd10e('0x11')][_0xd10e('0x12')](this));ami['on'](_0xd10e('0x13'),this[_0xd10e('0x14')]['bind'](this));ami['on'](_0xd10e('0x15'),this[_0xd10e('0x16')][_0xd10e('0x12')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xd10e('0x12')](this));}function getDiff(_0xd94194){var _0x3329d9=moment()[_0xd10e('0x17')](0x0);var _0x207d42=moment(_0xd94194)[_0xd10e('0x17')](0x0);return _0x3329d9[_0xd10e('0x18')](_0x207d42,_0xd10e('0x19'));}Acw[_0xd10e('0x1a')][_0xd10e('0x1b')]=function(_0x323d0d){try{var _0xb535a8=this;var _0x1f290a=this['channels'][_0x323d0d]['interface'];var _0x1e362c=this['channels'][_0x323d0d]['queue'];var _0x2459cd=this[_0xd10e('0x6')][_0x1e362c];var _0x499f9e=![];var _0x5a0d0d=_0xd10e('0x1c');if(_0x2459cd[_0xd10e('0x1d')]){if(_0x2459cd[_0xd10e('0x1e')][_0xd10e('0x1f')]){_0x499f9e=!![];_0x5a0d0d=_0x2459cd[_0xd10e('0x1e')][_0xd10e('0x1f')];}}return ami[_0xd10e('0x20')]({'action':_0xd10e('0x21'),'interface':_0x1f290a,'paused':!![],'reason':_0x5a0d0d})['then'](function(){if(_0xb535a8['agents'][_0x1f290a]){return RpcUser[_0xd10e('0x22')](_0xb535a8[_0xd10e('0x7')][_0x1f290a]['id'])[_0xd10e('0x23')](function(_0x4496ed){if(_0x4496ed&&!_0x4496ed[_0xd10e('0x24')]){logger[_0xd10e('0x25')](_0xd10e('0x26'),_0x323d0d,_0x1f290a,_0x1e362c);var _0xbab4ff=_0xb535a8[_0xd10e('0x9')][_0x323d0d][_0xd10e('0x27')]&&_0xb535a8[_0xd10e('0x9')][_0x323d0d]['destlinkedid']?_0xb535a8[_0xd10e('0x9')][_0x323d0d][_0xd10e('0x28')]:_0x323d0d;return RpcUser[_0xd10e('0x29')](_0xb535a8[_0xd10e('0x7')][_0x1f290a],_0x5a0d0d,_0xbab4ff)[_0xd10e('0x23')](function(){if(!_0x499f9e){_0xb535a8[_0xd10e('0x8')][_0x1f290a]={};logger[_0xd10e('0x25')](_0xd10e('0x2a'),_0x323d0d,_0xb535a8[_0xd10e('0x6')][_0x1e362c]['acwTimeout'],_0x1f290a,_0x1e362c);_0xb535a8[_0xd10e('0x8')][_0x1f290a][_0xd10e('0x2b')]=setTimeout(_0xb535a8['stopAcw']['bind'](_0xb535a8,_0x1f290a),_0xb535a8['voiceQueues'][_0x1e362c][_0xd10e('0x2c')]*0x3e8);_0xb535a8[_0xd10e('0x8')][_0x1f290a][_0xd10e('0x2d')]=moment()[_0xd10e('0x2e')](_0xd10e('0x2f'));_0xb535a8[_0xd10e('0x8')][_0x1f290a][_0xd10e('0x30')]=_0x323d0d;_0xb535a8[_0xd10e('0x8')][_0x1f290a][_0xd10e('0x31')]=_0x1e362c;_0xb535a8['timers'][_0x1f290a][_0xd10e('0x32')]=function(){var _0x26f011=getDiff(_0xb535a8[_0xd10e('0x8')][_0x1f290a]['lastPauseAt']);clearTimeout(_0xb535a8[_0xd10e('0x8')][_0x1f290a][_0xd10e('0x2b')]);_0xb535a8[_0xd10e('0x8')][_0x1f290a][_0xd10e('0x2b')]=![];RpcVoiceAgentReport[_0xd10e('0x33')]({'acwtime':_0x26f011},_0xb535a8[_0xd10e('0x8')][_0x1f290a]['uniqueid'],_0x1f290a)[_0xd10e('0x23')](function(_0x52bcda){logger[_0xd10e('0x25')](_0xd10e('0x34'),_0x323d0d,_0x26f011,_0x52bcda);})[_0xd10e('0x35')](function(_0x2340f2){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x323d0d,_0x2340f2);});delete _0xb535a8[_0xd10e('0x8')][_0x1f290a];};}});}else{logger[_0xd10e('0x25')](_0xd10e('0x36'),_0x323d0d,_0x1f290a,_0x1e362c);}});}})[_0xd10e('0x35')](function(){logger[_0xd10e('0x37')](_0xd10e('0x2a'),_0x323d0d,_0xb535a8[_0xd10e('0x6')][_0x1e362c][_0xd10e('0x2c')],_0x1f290a,_0x1e362c);})[_0xd10e('0x38')](function(){delete _0xb535a8['channels'][_0x323d0d];});}catch(_0x3616c2){logger['error'](_0xd10e('0x39'),_0x3616c2[_0xd10e('0x3a')]);}};Acw[_0xd10e('0x1a')][_0xd10e('0x3b')]=function(_0x64f43c){try{var _0x1c90cb=this;if(_0x1c90cb[_0xd10e('0x8')][_0x64f43c]){_0x1c90cb[_0xd10e('0x8')][_0x64f43c][_0xd10e('0x2b')]=![];var _0x307dbc=_0x1c90cb[_0xd10e('0x8')][_0x64f43c][_0xd10e('0x30')];var _0x1e7adf=_0x1c90cb['timers'][_0x64f43c][_0xd10e('0x31')];var _0x57f46b=_0x1c90cb[_0xd10e('0x6')][_0x1e7adf]['acwTimeout'];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x307dbc,_0x64f43c);RpcUser[_0xd10e('0x3c')](this[_0xd10e('0x7')][_0x64f43c]);RpcVoiceAgentReport['update']({'acwtime':_0x57f46b,'agentacw':!![]},_0x307dbc,_0x64f43c)['then'](function(_0x17a907){logger[_0xd10e('0x25')](_0xd10e('0x34'),_0x307dbc,_0x57f46b,_0x17a907);})['catch'](function(_0x1a38e1){logger[_0xd10e('0x37')](_0xd10e('0x3d'),_0x307dbc,_0x1a38e1);});}else{logger[_0xd10e('0x37')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x64f43c);if(_0x1c90cb[_0xd10e('0x8')]){logger['info']('[ACW][TIMERS]',JSON[_0xd10e('0x3e')](_0x1c90cb['timers']));}}}catch(_0x5ed6f8){logger[_0xd10e('0x37')]('[ACW][STOP]\x20%s',_0x5ed6f8[_0xd10e('0x3a')]);}};Acw[_0xd10e('0x1a')][_0xd10e('0xb')]=function(_0x14f894){try{if(this[_0xd10e('0x6')][_0x14f894[_0xd10e('0x31')]]&&(this[_0xd10e('0x6')][_0x14f894['queue']][_0xd10e('0x4')]||this[_0xd10e('0x6')][_0x14f894['queue']][_0xd10e('0x1d')])){if(this['agents'][_0x14f894[_0xd10e('0x3f')]]){this[_0xd10e('0x9')][_0x14f894[_0xd10e('0x30')]]={'queue':_0x14f894['queue'],'interface':_0x14f894[_0xd10e('0x3f')],'destlinkedid':_0x14f894[_0xd10e('0x28')]};}}}catch(_0x5698b9){logger[_0xd10e('0x37')](_0xd10e('0x40'),_0x5698b9[_0xd10e('0x3a')]);}};Acw[_0xd10e('0x1a')][_0xd10e('0x41')]=function(_0x751a53){try{if(this['voiceQueues'][_0x751a53[_0xd10e('0x31')]]&&(this[_0xd10e('0x6')][_0x751a53[_0xd10e('0x31')]][_0xd10e('0x4')]||this[_0xd10e('0x6')][_0x751a53[_0xd10e('0x31')]][_0xd10e('0x1d')])){if(this[_0xd10e('0x7')][_0x751a53[_0xd10e('0x3f')]]){this[_0xd10e('0x9')][_0x751a53['uniqueid']]={'queue':_0x751a53['queue'],'interface':_0x751a53['interface']};}}}catch(_0x26244a){logger[_0xd10e('0x37')](_0xd10e('0x42'),_0x26244a[_0xd10e('0x3a')]);}};Acw[_0xd10e('0x1a')][_0xd10e('0xd')]=function(_0x5229d3){try{if(this[_0xd10e('0x9')][_0x5229d3[_0xd10e('0x30')]]&&_[_0xd10e('0x43')](this[_0xd10e('0x9')][_0x5229d3[_0xd10e('0x30')]][_0xd10e('0x27')])){logger[_0xd10e('0x25')](_0xd10e('0x44'),_0x5229d3[_0xd10e('0x30')]);this[_0xd10e('0x1b')](_0x5229d3[_0xd10e('0x30')]);}else if(this[_0xd10e('0x9')][_0x5229d3[_0xd10e('0x45')]]&&_['isUndefined'](this[_0xd10e('0x9')][_0x5229d3[_0xd10e('0x45')]][_0xd10e('0x27')])){logger['info'](_0xd10e('0x46'),_0x5229d3[_0xd10e('0x45')]);this[_0xd10e('0x1b')](_0x5229d3[_0xd10e('0x45')]);}}catch(_0x33b255){logger[_0xd10e('0x37')](_0xd10e('0x47'),_0x33b255[_0xd10e('0x3a')]);}};Acw[_0xd10e('0x1a')][_0xd10e('0xf')]=function(_0x359672){try{if(this['channels'][_0x359672[_0xd10e('0x30')]]&&this[_0xd10e('0x9')][_0x359672[_0xd10e('0x30')]][_0xd10e('0x27')]){logger[_0xd10e('0x25')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x359672[_0xd10e('0x30')]);this[_0xd10e('0x1b')](_0x359672[_0xd10e('0x30')]);}else if(this[_0xd10e('0x9')][_0x359672[_0xd10e('0x45')]]&&this[_0xd10e('0x9')][_0x359672[_0xd10e('0x45')]]['attended']){logger[_0xd10e('0x25')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x359672[_0xd10e('0x45')]);this['startAcw'](_0x359672[_0xd10e('0x45')]);}}catch(_0x5d3b39){logger[_0xd10e('0x37')](_0xd10e('0x48'),_0x5d3b39[_0xd10e('0x3a')]);}};Acw[_0xd10e('0x1a')][_0xd10e('0x14')]=function(_0x96d7af){try{if(!_[_0xd10e('0x49')](this[_0xd10e('0x9')][_0x96d7af[_0xd10e('0x4a')]])){this[_0xd10e('0x1b')](_0x96d7af[_0xd10e('0x4a')]);if(this['channels'][_0x96d7af[_0xd10e('0x4b')]]){this['channels'][_0x96d7af[_0xd10e('0x4b')]][_0xd10e('0x27')]=!![];this[_0xd10e('0x9')][_0x96d7af['transfertargetuniqueid']]=this[_0xd10e('0x9')][_0x96d7af['secondtransfereruniqueid']];delete this[_0xd10e('0x9')][_0x96d7af[_0xd10e('0x4b')]];}}else if(!_[_0xd10e('0x49')](this[_0xd10e('0x9')][_0x96d7af['transfertargetuniqueid']])){this[_0xd10e('0x1b')](_0x96d7af['transfertargetuniqueid']);if(this['channels'][_0x96d7af['origtransfereruniqueid']]){this[_0xd10e('0x9')][_0x96d7af[_0xd10e('0x4c')]]['attended']=!![];this['channels'][_0x96d7af['transfereeuniqueid']]=this['channels'][_0x96d7af[_0xd10e('0x4c')]];delete this['channels'][_0x96d7af[_0xd10e('0x4c')]];}}}catch(_0x272ff5){logger[_0xd10e('0x37')](_0xd10e('0x4d'),_0x272ff5['message']);}};Acw[_0xd10e('0x1a')]['syncBlindTransfer']=function(_0x173ae8){try{if(this[_0xd10e('0x9')][_0x173ae8[_0xd10e('0x4e')]]){logger[_0xd10e('0x25')](_0xd10e('0x4f'),JSON[_0xd10e('0x3e')](_0x173ae8['transfereruniqueid']));this[_0xd10e('0x1b')](_0x173ae8[_0xd10e('0x4e')]);}else if(this['channels'][_0x173ae8[_0xd10e('0x50')]]){logger[_0xd10e('0x25')](_0xd10e('0x51'),JSON[_0xd10e('0x3e')](_0x173ae8[_0xd10e('0x50')]));this[_0xd10e('0x1b')](_0x173ae8['transfererlinkedid']);}}catch(_0x291da0){logger[_0xd10e('0x37')](_0xd10e('0x52'),_0x291da0['message']);}};Acw[_0xd10e('0x1a')][_0xd10e('0x11')]=function(_0x3f38f4){try{if(this[_0xd10e('0x6')][_0x3f38f4['queue']]&&this[_0xd10e('0x6')][_0x3f38f4[_0xd10e('0x31')]][_0xd10e('0x53')]===_0xd10e('0x54')){if(this[_0xd10e('0x7')][_0x3f38f4[_0xd10e('0x3f')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3f38f4['uniqueid'],_0x3f38f4[_0xd10e('0x3f')],_0x3f38f4[_0xd10e('0x31')]);return RpcUser[_0xd10e('0x29')](this['agents'][_0x3f38f4[_0xd10e('0x3f')]],_0xd10e('0x55'),_0x3f38f4[_0xd10e('0x30')]);}}}catch(_0x28de45){logger[_0xd10e('0x37')](_0xd10e('0x56'),_0x28de45[_0xd10e('0x3a')]);}};module[_0xd10e('0x57')]=Acw; \ No newline at end of file +var _0x2a85=['error','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]'];(function(_0x198480,_0x574b93){var _0x58dff5=function(_0x370701){while(--_0x370701){_0x198480['push'](_0x198480['shift']());}};_0x58dff5(++_0x574b93);}(_0x2a85,0x1c5));var _0x52a8=function(_0x20c692,_0x454166){_0x20c692=_0x20c692-0x0;var _0x23d380=_0x2a85[_0x20c692];return _0x23d380;};'use strict';var _=require(_0x52a8('0x0'));var moment=require('moment');var ami=require(_0x52a8('0x1'));var logger=require(_0x52a8('0x2'))(_0x52a8('0x3'));var RpcUser=require(_0x52a8('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1d3f7e){this[_0x52a8('0x5')]=_0x1d3f7e[_0x52a8('0x5')];this[_0x52a8('0x6')]=_0x1d3f7e[_0x52a8('0x6')];this[_0x52a8('0x7')]=_0x1d3f7e[_0x52a8('0x7')];this[_0x52a8('0x8')]={};ami['on']('agentconnect',this[_0x52a8('0x9')][_0x52a8('0xa')](this));ami['on'](_0x52a8('0xb'),this['syncHangupRequest'][_0x52a8('0xa')](this));ami['on'](_0x52a8('0xc'),this[_0x52a8('0xd')][_0x52a8('0xa')](this));ami['on'](_0x52a8('0xe'),this['syncAgentRingNoAnswer'][_0x52a8('0xa')](this));ami['on'](_0x52a8('0xf'),this[_0x52a8('0x10')][_0x52a8('0xa')](this));ami['on'](_0x52a8('0x11'),this[_0x52a8('0x12')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0x52a8('0x13')][_0x52a8('0xa')](this));}function getDiff(_0x15a801){var _0x3181f6=moment()['milliseconds'](0x0);var _0x435d04=moment(_0x15a801)[_0x52a8('0x14')](0x0);return _0x3181f6[_0x52a8('0x15')](_0x435d04,_0x52a8('0x16'));}Acw[_0x52a8('0x17')]['startAcw']=function(_0x1a3d7c){try{var _0x50c45e=this;var _0x105d7d=this[_0x52a8('0x8')][_0x1a3d7c][_0x52a8('0x18')];var _0xd88948=this[_0x52a8('0x8')][_0x1a3d7c][_0x52a8('0x19')];var _0x197e88=this[_0x52a8('0x5')][_0xd88948];var _0x19dc78=![];var _0x2d256b=_0x52a8('0x1a');if(_0x197e88[_0x52a8('0x1b')]){if(_0x197e88[_0x52a8('0x1c')][_0x52a8('0x1d')]){_0x19dc78=!![];_0x2d256b=_0x197e88[_0x52a8('0x1c')][_0x52a8('0x1d')];}}return ami['Action']({'action':'QueuePause','interface':_0x105d7d,'paused':!![],'reason':_0x2d256b})[_0x52a8('0x1e')](function(){if(_0x50c45e[_0x52a8('0x6')][_0x105d7d]){return RpcUser[_0x52a8('0x1f')](_0x50c45e[_0x52a8('0x6')][_0x105d7d]['id'])['then'](function(_0x5eb085){if(_0x5eb085&&!_0x5eb085[_0x52a8('0x20')]){logger[_0x52a8('0x21')](_0x52a8('0x22'),_0x1a3d7c,_0x105d7d,_0xd88948);var _0xf312dc=_0x50c45e[_0x52a8('0x8')][_0x1a3d7c][_0x52a8('0x23')]&&_0x50c45e[_0x52a8('0x8')][_0x1a3d7c][_0x52a8('0x24')]?_0x50c45e[_0x52a8('0x8')][_0x1a3d7c][_0x52a8('0x24')]:_0x1a3d7c;return RpcUser[_0x52a8('0x25')](_0x50c45e[_0x52a8('0x6')][_0x105d7d],_0x2d256b,_0xf312dc)[_0x52a8('0x1e')](function(){if(!_0x19dc78){_0x50c45e[_0x52a8('0x7')][_0x105d7d]={};logger[_0x52a8('0x21')](_0x52a8('0x26'),_0x1a3d7c,_0x50c45e[_0x52a8('0x5')][_0xd88948][_0x52a8('0x27')],_0x105d7d,_0xd88948);_0x50c45e['timers'][_0x105d7d][_0x52a8('0x28')]=setTimeout(_0x50c45e[_0x52a8('0x29')][_0x52a8('0xa')](_0x50c45e,_0x105d7d),_0x50c45e[_0x52a8('0x5')][_0xd88948]['acwTimeout']*0x3e8);_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x2a')]=moment()[_0x52a8('0x2b')](_0x52a8('0x2c'));_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x2d')]=_0x1a3d7c;_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x19')]=_0xd88948;_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x2e')]=function(){var _0xb1e440=getDiff(_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x2a')]);clearTimeout(_0x50c45e['timers'][_0x105d7d][_0x52a8('0x28')]);_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0xb1e440},_0x50c45e[_0x52a8('0x7')][_0x105d7d]['uniqueid'],_0x105d7d)[_0x52a8('0x1e')](function(_0x1be118){logger[_0x52a8('0x21')](_0x52a8('0x2f'),_0x1a3d7c,_0xb1e440,_0x1be118);})[_0x52a8('0x30')](function(_0x193063){logger['error'](_0x52a8('0x31'),_0x1a3d7c,_0x193063);});delete _0x50c45e[_0x52a8('0x7')][_0x105d7d];};}});}else{logger[_0x52a8('0x21')](_0x52a8('0x32'),_0x1a3d7c,_0x105d7d,_0xd88948);}});}})[_0x52a8('0x30')](function(){logger[_0x52a8('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1a3d7c,_0x50c45e[_0x52a8('0x5')][_0xd88948][_0x52a8('0x27')],_0x105d7d,_0xd88948);})[_0x52a8('0x34')](function(){delete _0x50c45e[_0x52a8('0x8')][_0x1a3d7c];});}catch(_0x5867e2){logger['error'](_0x52a8('0x35'),_0x5867e2[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')][_0x52a8('0x29')]=function(_0x5ea77d){try{var _0x3efa43=this;if(_0x3efa43['timers'][_0x5ea77d]){_0x3efa43[_0x52a8('0x7')][_0x5ea77d][_0x52a8('0x28')]=![];var _0x5d13b1=_0x3efa43[_0x52a8('0x7')][_0x5ea77d]['uniqueid'];var _0x262599=_0x3efa43[_0x52a8('0x7')][_0x5ea77d][_0x52a8('0x19')];var _0x36d6ea=_0x3efa43[_0x52a8('0x5')][_0x262599][_0x52a8('0x27')];logger[_0x52a8('0x21')](_0x52a8('0x37'),_0x5d13b1,_0x5ea77d);RpcUser[_0x52a8('0x38')](this[_0x52a8('0x6')][_0x5ea77d]);RpcVoiceAgentReport[_0x52a8('0x39')]({'acwtime':_0x36d6ea,'agentacw':!![]},_0x5d13b1,_0x5ea77d)[_0x52a8('0x1e')](function(_0x338cb0){logger[_0x52a8('0x21')](_0x52a8('0x2f'),_0x5d13b1,_0x36d6ea,_0x338cb0);})['catch'](function(_0x503bdf){logger[_0x52a8('0x33')](_0x52a8('0x31'),_0x5d13b1,_0x503bdf);});}else{logger[_0x52a8('0x33')](_0x52a8('0x3a'),_0x5ea77d);if(_0x3efa43[_0x52a8('0x7')]){logger[_0x52a8('0x21')](_0x52a8('0x3b'),JSON[_0x52a8('0x3c')](_0x3efa43[_0x52a8('0x7')]));}}}catch(_0x55eead){logger['error'](_0x52a8('0x3d'),_0x55eead[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')][_0x52a8('0x9')]=function(_0x40ff3e){try{if(this['voiceQueues'][_0x40ff3e['queue']]&&(this['voiceQueues'][_0x40ff3e[_0x52a8('0x19')]]['acw']||this[_0x52a8('0x5')][_0x40ff3e[_0x52a8('0x19')]][_0x52a8('0x1b')])){if(this[_0x52a8('0x6')][_0x40ff3e['interface']]){this[_0x52a8('0x8')][_0x40ff3e[_0x52a8('0x2d')]]={'queue':_0x40ff3e[_0x52a8('0x19')],'interface':_0x40ff3e[_0x52a8('0x18')],'destlinkedid':_0x40ff3e[_0x52a8('0x24')]};}}}catch(_0x215ab3){logger['error'](_0x52a8('0x3e'),_0x215ab3[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')]['syncAgentConnectPreview']=function(_0x2965ba){try{if(this[_0x52a8('0x5')][_0x2965ba[_0x52a8('0x19')]]&&(this['voiceQueues'][_0x2965ba[_0x52a8('0x19')]]['acw']||this[_0x52a8('0x5')][_0x2965ba[_0x52a8('0x19')]][_0x52a8('0x1b')])){if(this['agents'][_0x2965ba[_0x52a8('0x18')]]){this[_0x52a8('0x8')][_0x2965ba[_0x52a8('0x2d')]]={'queue':_0x2965ba[_0x52a8('0x19')],'interface':_0x2965ba[_0x52a8('0x18')]};}}}catch(_0x1c2ccf){logger[_0x52a8('0x33')](_0x52a8('0x3f'),_0x1c2ccf[_0x52a8('0x36')]);}};Acw['prototype'][_0x52a8('0x40')]=function(_0xb4a40e){try{if(this[_0x52a8('0x8')][_0xb4a40e['uniqueid']]&&_[_0x52a8('0x41')](this[_0x52a8('0x8')][_0xb4a40e[_0x52a8('0x2d')]][_0x52a8('0x23')])){logger[_0x52a8('0x21')](_0x52a8('0x42'),_0xb4a40e[_0x52a8('0x2d')]);this['startAcw'](_0xb4a40e[_0x52a8('0x2d')]);}else if(this[_0x52a8('0x8')][_0xb4a40e[_0x52a8('0x43')]]&&_[_0x52a8('0x41')](this[_0x52a8('0x8')][_0xb4a40e['linkedid']][_0x52a8('0x23')])){logger[_0x52a8('0x21')](_0x52a8('0x44'),_0xb4a40e['linkedid']);this[_0x52a8('0x45')](_0xb4a40e['linkedid']);}}catch(_0x5d8728){logger['error'](_0x52a8('0x46'),_0x5d8728[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')][_0x52a8('0xd')]=function(_0x2b0aef){try{if(this[_0x52a8('0x8')][_0x2b0aef['uniqueid']]&&this[_0x52a8('0x8')][_0x2b0aef['uniqueid']][_0x52a8('0x23')]){logger[_0x52a8('0x21')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2b0aef[_0x52a8('0x2d')]);this['startAcw'](_0x2b0aef[_0x52a8('0x2d')]);}else if(this['channels'][_0x2b0aef['linkedid']]&&this['channels'][_0x2b0aef[_0x52a8('0x43')]][_0x52a8('0x23')]){logger[_0x52a8('0x21')](_0x52a8('0x47'),_0x2b0aef[_0x52a8('0x43')]);this[_0x52a8('0x45')](_0x2b0aef['linkedid']);}}catch(_0x1b3bce){logger[_0x52a8('0x33')]('[ACW][syncHangup]\x20%s',_0x1b3bce[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')]['syncAttendedTransfer']=function(_0x4164b6){try{if(!_['isNil'](this[_0x52a8('0x8')][_0x4164b6[_0x52a8('0x48')]])){this['startAcw'](_0x4164b6['transfereeuniqueid']);if(this['channels'][_0x4164b6[_0x52a8('0x49')]]){this[_0x52a8('0x8')][_0x4164b6[_0x52a8('0x49')]]['attended']=!![];this[_0x52a8('0x8')][_0x4164b6[_0x52a8('0x4a')]]=this['channels'][_0x4164b6[_0x52a8('0x49')]];delete this[_0x52a8('0x8')][_0x4164b6[_0x52a8('0x49')]];}}else if(!_['isNil'](this[_0x52a8('0x8')][_0x4164b6['transfertargetuniqueid']])){this[_0x52a8('0x45')](_0x4164b6[_0x52a8('0x4a')]);if(this[_0x52a8('0x8')][_0x4164b6[_0x52a8('0x4b')]]){this['channels'][_0x4164b6[_0x52a8('0x4b')]][_0x52a8('0x23')]=!![];this[_0x52a8('0x8')][_0x4164b6['transfereeuniqueid']]=this[_0x52a8('0x8')][_0x4164b6['origtransfereruniqueid']];delete this[_0x52a8('0x8')][_0x4164b6['origtransfereruniqueid']];}}}catch(_0x125db2){logger['error'](_0x52a8('0x4c'),_0x125db2[_0x52a8('0x36')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x469a9f){try{if(this[_0x52a8('0x8')][_0x469a9f[_0x52a8('0x4d')]]){logger[_0x52a8('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x52a8('0x3c')](_0x469a9f[_0x52a8('0x4d')]));this['startAcw'](_0x469a9f['transfereruniqueid']);}else if(this[_0x52a8('0x8')][_0x469a9f[_0x52a8('0x4e')]]){logger['info'](_0x52a8('0x4f'),JSON[_0x52a8('0x3c')](_0x469a9f[_0x52a8('0x4e')]));this[_0x52a8('0x45')](_0x469a9f['transfererlinkedid']);}}catch(_0x5d0e40){logger[_0x52a8('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x5d0e40[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')]['syncAgentRingNoAnswer']=function(_0x2a69ea){try{if(this[_0x52a8('0x5')][_0x2a69ea['queue']]&&this['voiceQueues'][_0x2a69ea[_0x52a8('0x19')]][_0x52a8('0x50')]==='all'){if(this['agents'][_0x2a69ea[_0x52a8('0x18')]]){logger['info'](_0x52a8('0x51'),_0x2a69ea[_0x52a8('0x2d')],_0x2a69ea['interface'],_0x2a69ea[_0x52a8('0x19')]);return RpcUser[_0x52a8('0x25')](this[_0x52a8('0x6')][_0x2a69ea[_0x52a8('0x18')]],_0x52a8('0x52'),_0x2a69ea[_0x52a8('0x2d')]);}}}catch(_0x42d6d3){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x42d6d3[_0x52a8('0x36')]);}};module[_0x52a8('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index add60db..9b32114 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 _0xb0f2=['asterisk-manager','util','../../config/logger','../../config/environment','asterisk','port','username','password','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','actionSipShowRegistry','then','catch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb0f2,0x1ea));var _0x2b0f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb0f2[_0x321bb2];return _0x9c12ed;};'use strict';var Manager=require(_0x2b0f('0x0'));var BPromise=require('bluebird');var util=require(_0x2b0f('0x1'));var logger=require(_0x2b0f('0x2'))('ami');var config=require(_0x2b0f('0x3'));var ami=new Manager(config[_0x2b0f('0x4')][_0x2b0f('0x5')],config[_0x2b0f('0x4')]['ip'],config['asterisk'][_0x2b0f('0x6')],config[_0x2b0f('0x4')][_0x2b0f('0x7')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0x2b0f('0x8')](ami[_0x2b0f('0x9')]);function error(_0x5237b0){logger['error'](util[_0x2b0f('0xa')](_0x2b0f('0xb'),config[_0x2b0f('0x4')][_0x2b0f('0x6')],config['asterisk']['ip'],config[_0x2b0f('0x4')]['port'],util['inspect'](_0x5237b0,![],null)));}function close(){logger[_0x2b0f('0xc')](util[_0x2b0f('0xa')](_0x2b0f('0xd'),config['asterisk'][_0x2b0f('0x6')],config[_0x2b0f('0x4')]['ip'],config[_0x2b0f('0x4')]['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0x2b0f('0xe')});};};ami[_0x2b0f('0xf')]=function(){return function(){return ami[_0x2b0f('0x10')]({'action':_0x2b0f('0x11')});};};ami[_0x2b0f('0x12')]=function(){return function(){return ami[_0x2b0f('0x10')]({'action':_0x2b0f('0x13')});};};ami[_0x2b0f('0x14')]=function(){return function(){return ami['Action']({'action':_0x2b0f('0x15')});};};ami[_0x2b0f('0x16')]=function(){return function(){return ami[_0x2b0f('0x10')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x2b0f('0xa')](_0x2b0f('0x17'),config[_0x2b0f('0x4')][_0x2b0f('0x6')],config[_0x2b0f('0x4')]['ip'],config[_0x2b0f('0x4')][_0x2b0f('0x5')]));ami[_0x2b0f('0x18')](_0x2b0f('0xc'),error);ami['once'](_0x2b0f('0x19'),close);}ami['on'](_0x2b0f('0x1a'),connect);ami['on']('shutdown',function(_0x35ef16){logger[_0x2b0f('0x1b')](util[_0x2b0f('0xa')](_0x2b0f('0x1c'),config[_0x2b0f('0x4')][_0x2b0f('0x6')],config[_0x2b0f('0x4')]['ip'],config[_0x2b0f('0x4')][_0x2b0f('0x5')],util[_0x2b0f('0x1d')](_0x35ef16,![],null)));});ami['on'](_0x2b0f('0x1e'),function(){logger[_0x2b0f('0x1b')](util[_0x2b0f('0xa')](_0x2b0f('0x1f'),config[_0x2b0f('0x4')]['username'],config[_0x2b0f('0x4')]['ip'],config['asterisk'][_0x2b0f('0x5')]));return Promise['resolve']()['then'](ami[_0x2b0f('0x20')]())[_0x2b0f('0x21')](ami[_0x2b0f('0xf')]())['then'](ami[_0x2b0f('0x12')]())[_0x2b0f('0x21')](ami['actionQueueSummary']())['then'](ami[_0x2b0f('0x16')]())[_0x2b0f('0x22')](function(_0x3edd9c){logger[_0x2b0f('0xc')]('[ami.js][fullybooted]',util[_0x2b0f('0x1d')](_0x3edd9c,{'showHidden':![],'depth':null}));});});ami[_0x2b0f('0x18')](_0x2b0f('0xc'),error);ami[_0x2b0f('0x18')](_0x2b0f('0x19'),close);module['exports']=ami; \ No newline at end of file +var _0xb3ed=['../../config/logger','../../config/environment','asterisk','username','password','Action','promisify','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','port','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionCoreShowChannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','actionQueueSummary','asterisk-manager','bluebird','util'];(function(_0x2cccd2,_0x21654c){var _0x9e9cf1=function(_0x232600){while(--_0x232600){_0x2cccd2['push'](_0x2cccd2['shift']());}};_0x9e9cf1(++_0x21654c);}(_0xb3ed,0x13d));var _0xdb3e=function(_0x57be54,_0x5d087b){_0x57be54=_0x57be54-0x0;var _0x5f5893=_0xb3ed[_0x57be54];return _0x5f5893;};'use strict';var Manager=require(_0xdb3e('0x0'));var BPromise=require(_0xdb3e('0x1'));var util=require(_0xdb3e('0x2'));var logger=require(_0xdb3e('0x3'))('ami');var config=require(_0xdb3e('0x4'));var ami=new Manager(config[_0xdb3e('0x5')]['port'],config['asterisk']['ip'],config[_0xdb3e('0x5')][_0xdb3e('0x6')],config['asterisk'][_0xdb3e('0x7')],!![]);ami['keepConnected']();ami[_0xdb3e('0x8')]=BPromise[_0xdb3e('0x9')](ami['action']);function error(_0x35247d){logger[_0xdb3e('0xa')](util['format'](_0xdb3e('0xb'),config[_0xdb3e('0x5')][_0xdb3e('0x6')],config['asterisk']['ip'],config[_0xdb3e('0x5')]['port'],util[_0xdb3e('0xc')](_0x35247d,![],null)));}function close(){logger[_0xdb3e('0xa')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xdb3e('0x5')]['ip'],config[_0xdb3e('0x5')][_0xdb3e('0xd')]));}ami[_0xdb3e('0xe')]=function(){return function(){return ami[_0xdb3e('0x8')]({'action':_0xdb3e('0xf')});};};ami[_0xdb3e('0x10')]=function(){return function(){return ami['Action']({'action':_0xdb3e('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xdb3e('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0xdb3e('0x13')]=function(){return function(){return ami[_0xdb3e('0x8')]({'action':'coreshowchannels'});};};function connect(){logger[_0xdb3e('0x14')](util[_0xdb3e('0x15')](_0xdb3e('0x16'),config['asterisk'][_0xdb3e('0x6')],config[_0xdb3e('0x5')]['ip'],config['asterisk']['port']));ami[_0xdb3e('0x17')](_0xdb3e('0xa'),error);ami[_0xdb3e('0x17')](_0xdb3e('0x18'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0xf24f6b){logger[_0xdb3e('0x14')](util[_0xdb3e('0x15')](_0xdb3e('0x19'),config[_0xdb3e('0x5')][_0xdb3e('0x6')],config[_0xdb3e('0x5')]['ip'],config[_0xdb3e('0x5')][_0xdb3e('0xd')],util[_0xdb3e('0xc')](_0xf24f6b,![],null)));});ami['on'](_0xdb3e('0x1a'),function(){logger[_0xdb3e('0x14')](util[_0xdb3e('0x15')](_0xdb3e('0x1b'),config[_0xdb3e('0x5')][_0xdb3e('0x6')],config[_0xdb3e('0x5')]['ip'],config[_0xdb3e('0x5')][_0xdb3e('0xd')]));return Promise[_0xdb3e('0x1c')]()['then'](ami[_0xdb3e('0xe')]())[_0xdb3e('0x1d')](ami[_0xdb3e('0x10')]())['then'](ami[_0xdb3e('0x1e')]())['then'](ami[_0xdb3e('0x1f')]())['then'](ami[_0xdb3e('0x13')]())['catch'](function(_0x1181f1){logger[_0xdb3e('0xa')]('[ami.js][fullybooted]',util[_0xdb3e('0xc')](_0x1181f1,{'showHidden':![],'depth':null}));});});ami['once'](_0xdb3e('0xa'),error);ami[_0xdb3e('0x17')](_0xdb3e('0x18'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 79d337f..803cc35 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(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xcb91[_0x1afabf];return _0x497ff1;};'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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x32e783,_0x192094){var _0x283241=function(_0x435eb5){while(--_0x435eb5){_0x32e783['push'](_0x32e783['shift']());}};_0x283241(++_0x192094);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xa1b0d4,_0xbeba0){_0xa1b0d4=_0xa1b0d4-0x0;var _0x19f06c=_0xbdb7[_0xa1b0d4];return _0x19f06c;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 50c3719..c195632 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 _0x7ff1=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','buildObj','dialNoSuchNumberRetryFrequency','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','outboundRejectCallsDay','AgentReject','reason\x2020\x20agentreject','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','agentBusyFactor','loggedIn','[CatchErlangB]','check\x20failure','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','temp','getContactDialerIvr','dialOrderByScheduledAt','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','reachable','getContactDialer','countReScheduled','[countReScheduled]\x20','tryOriginatePredictive','[actionOriginatePredictive]\x20','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/setting','./models/action','./models/history','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncVarSet','syncQueueMember','loopCampaigns','loopClearZombieChannels','then','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','---------------------------','getSeconds','startProgressive','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','message','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','Interval','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Failure','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','content','catch','indexOf','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','checkIfTimeIntervals','dialTimezone','launchHandleIvr','[syncCampaigns]','predictive','dialMethod','progressive','power','handlePower','dialPowerLevel','Queue','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','TIMEOUT','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ListId','VoiceQueueId','[rescheduleContact][Drop]','Drop','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','CampaignId','calleridname','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','isNil','locked','paused','agents','stateinterface','merge','syncQueueStatusComplete','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','run','contactAgent-idHopper:\x20','[booked][unlock]','ContactId','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','amdstatus','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','countmachineretry','reason\x2019\x20machine....','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','dialQueueProject','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','user:%s','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialQueueTimeout','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-CAMPAIGNID','Contact','tags','%s%s','XMD-','toUpper','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','trim','from-sip','dialOriginateTimeout','[originateError]:\x20%s','[originate][error]','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialMachineRetryFrequency'];(function(_0x2ac407,_0x4892c6){var _0x3d55be=function(_0x31a0d1){while(--_0x31a0d1){_0x2ac407['push'](_0x2ac407['shift']());}};_0x3d55be(++_0x4892c6);}(_0x7ff1,0x80));var _0x17ff=function(_0x5ca353,_0x21eb37){_0x5ca353=_0x5ca353-0x0;var _0x4f2fe5=_0x7ff1[_0x5ca353];return _0x4f2fe5;};'use strict';var util=require(_0x17ff('0x0'));var _=require(_0x17ff('0x1'));var uuid=require(_0x17ff('0x2'));var moment=require(_0x17ff('0x3'));var rr=require('rr');var Redis=require(_0x17ff('0x4'));var utils=require(_0x17ff('0x5'));var hopperUtils=require('./utils/hopper');var ut=require('../preview/util/util');var config=require(_0x17ff('0x6'));var logger=require(_0x17ff('0x7'))(_0x17ff('0x8'));var loggerBooked=require(_0x17ff('0x7'))(_0x17ff('0x9'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x17ff('0x7'))(_0x17ff('0xa'));var loggerSyncQueueSummary=require(_0x17ff('0x7'))('syncQueueSummary');var ami=require(_0x17ff('0xb'));config[_0x17ff('0xc')]=_[_0x17ff('0xd')](config[_0x17ff('0xc')],{'host':_0x17ff('0xe'),'port':0x18eb});var io=require(_0x17ff('0xf'))(new Redis(config[_0x17ff('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x17ff('0x10'));var Interval=require('../rpc/interval');var Action=require(_0x17ff('0x11'));var History=require(_0x17ff('0x12'));var Final=require('./models/final');var AgentComplete=require(_0x17ff('0x13'));var QueueCallerAbandon=require(_0x17ff('0x14'));var Hangup=require(_0x17ff('0x15'));var ipAgi=process[_0x17ff('0x16')][_0x17ff('0x17')]||_0x17ff('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x17ff('0x19')]['enqueue']=function(_0x4f83f3){this[_0x17ff('0x1a')]=this['tail']?this[_0x17ff('0x1a')][_0x17ff('0x1b')](_0x4f83f3):_0x4f83f3();};function Dialer(_0x29a843,_0x1941ed){this[_0x17ff('0x1c')]=new Sequence();this[_0x17ff('0x1d')]=_0x1941ed;this[_0x17ff('0x1e')]=_0x29a843[_0x17ff('0x1e')];this[_0x17ff('0x1f')]=_0x29a843['campaigns'];this['agents']=_0x29a843['agents'];this[_0x17ff('0x20')]=_0x29a843['trunks'];this[_0x17ff('0x21')]=config[_0x17ff('0x21')]||0x2;this['channels']={};this[_0x17ff('0x22')]={};this[_0x17ff('0x23')]={};this[_0x17ff('0x24')]={};this[_0x17ff('0x25')]={};this[_0x17ff('0x26')]={};this['startProgressive']={};this[_0x17ff('0x27')]={};this[_0x17ff('0x28')]={};this[_0x17ff('0x29')]={};this[_0x17ff('0x2a')]={};ami['on'](_0x17ff('0x2b'),this['syncAgentConnect'][_0x17ff('0x2c')](this));ami['on'](_0x17ff('0x2d'),this[_0x17ff('0x2e')][_0x17ff('0x2c')](this));ami['on']('originateresponse',this[_0x17ff('0x2f')]['bind'](this));ami['on'](_0x17ff('0x30'),this['syncAgentComplete'][_0x17ff('0x2c')](this));ami['on']('custom:queuesummary',this[_0x17ff('0x31')][_0x17ff('0x2c')](this));ami['on'](_0x17ff('0x32'),this[_0x17ff('0x33')]['bind'](this));ami['on'](_0x17ff('0x34'),this[_0x17ff('0x35')][_0x17ff('0x2c')](this));ami['on'](_0x17ff('0x36'),this['syncNewExten'][_0x17ff('0x2c')](this));ami['on']('varset',this[_0x17ff('0x37')][_0x17ff('0x2c')](this));ami['on']('queuemember',this[_0x17ff('0x38')]['bind'](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x17ff('0x2c')](this));this[_0x17ff('0x39')]();this[_0x17ff('0x3a')]();RpcSetting['getSettings']()[_0x17ff('0x3b')](function(_0x4c78cb){previewRecallmeReminderInterval=_0x4c78cb['previewRecallmeReminderInterval'];});}function isNotNull(_0x53aee8){return _0x53aee8!==null&&!_[_0x17ff('0x3c')](_0x53aee8);}function msgResponse(_0x24a39f,_0x14c2c3,_0x3cd575){return{'action':_0x24a39f,'response':_0x14c2c3,'message':_0x3cd575,'stack':_0x3cd575};}function emit(_0x263c8d,_0x5a4ef9,_0x4011c3){io['to'](_0x263c8d)[_0x17ff('0x3d')](_0x5a4ef9,_0x4011c3);}function emitOutboundVoiceQueueSummary(_0x1a393c){if(_0x1a393c[_0x17ff('0x3e')]==='outbound'){logger[_0x17ff('0x3f')](_0x17ff('0x40'),util['inspect'](_0x1a393c,{'showHidden':![],'depth':null}));emit(util[_0x17ff('0x41')](_0x17ff('0x42'),_0x1a393c[_0x17ff('0x43')]),'voice_queue:save',_0x1a393c);}}function checkGetDataPredictive(_0x1025b7){if(isNotNull(_0x1025b7)&&!_[_0x17ff('0x44')](_0x1025b7)){loggerPredictive[_0x17ff('0x45')](_0x17ff('0x46'));loggerPredictive[_0x17ff('0x45')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1025b7[_0x17ff('0x47')]);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x48'),_0x1025b7[_0x17ff('0x49')]);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x4a'),_0x1025b7[_0x17ff('0x4b')]);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x4c'),_0x1025b7[_0x17ff('0x4d')]);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x4e'),_0x1025b7['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x4f'),_0x1025b7[_0x17ff('0x50')]);loggerPredictive[_0x17ff('0x45')]('---------------------------');if(_0x1025b7[_0x17ff('0x47')]>0x0){if(!_[_0x17ff('0x3c')](_0x1025b7[_0x17ff('0x50')])&&_0x1025b7[_0x17ff('0x50')]>0x0){return!![];}loggerPredictive[_0x17ff('0x45')](_0x17ff('0x51'));if(!_[_0x17ff('0x3c')](_0x1025b7[_0x17ff('0x52')])&&_0x1025b7[_0x17ff('0x52')]>0x0){return!![];}loggerPredictive['info'](_0x17ff('0x53'));}else{loggerPredictive['info'](_0x17ff('0x54'));}}else{loggerPredictive['info'](_0x17ff('0x55'));}return![];}function mergeDataErlangB(_0x14fbee){return function(_0xcd6bb6){loggerPredictive[_0x17ff('0x45')](_0x17ff('0x56'));loggerPredictive['info'](_0x17ff('0x57'),_0xcd6bb6[_0x17ff('0x58')]);loggerPredictive[_0x17ff('0x45')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xcd6bb6[_0x17ff('0x59')]);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x5a'),_0xcd6bb6[_0x17ff('0x5b')]);loggerPredictive[_0x17ff('0x45')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xcd6bb6[_0x17ff('0x5c')]);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x5a'),_0xcd6bb6[_0x17ff('0x5b')]);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x5d'));_['merge'](_0x14fbee,_0xcd6bb6);};}function ifInterval(_0x3f41ae,_0x5622f3){if(_['isUndefined'](_0x5622f3)){return![];}return utils[_0x17ff('0x5e')](undefined,_0x5622f3)<_0x3f41ae*0x3c;}function clearPredictiveAttributes(_0x57c64a){if(_0x57c64a[_0x17ff('0x5f')]){_0x57c64a[_0x17ff('0x5f')]=undefined;loggerPredictive['debug'](_0x57c64a[_0x17ff('0x43')],_0x17ff('0x60'));}if(_0x57c64a[_0x17ff('0x26')]){_0x57c64a[_0x17ff('0x26')]=undefined;loggerPredictive[_0x17ff('0x3f')](_0x57c64a[_0x17ff('0x43')],'startPredictive\x20value\x20cleared');}if(_0x57c64a[_0x17ff('0x61')]){clearInterval(_0x57c64a[_0x17ff('0x61')]);_0x57c64a[_0x17ff('0x61')]=undefined;loggerPredictive[_0x17ff('0x3f')](_0x57c64a[_0x17ff('0x43')],_0x17ff('0x62'));}}function loggerCatchPredictive(_0xd51bf8,_0x5ca41d){return function(_0x466b04){loggerPredictive[_0x17ff('0x63')](_0x5ca41d[_0x17ff('0x43')],_0xd51bf8);loggerPredictive[_0x17ff('0x63')](_0x466b04[_0x17ff('0x64')]);clearPredictiveAttributes(_0x5ca41d);};}function loggerCatch(_0x4250c1){return function(_0x5f1f51){logger[_0x17ff('0x63')](_0x4250c1,util[_0x17ff('0x65')](_0x5f1f51,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x17a7a4,_0x5a7438,_0x1d6599){return function(_0xc267b2){utils[_0x17ff('0x66')](_0x5a7438,_0x1d6599,0x0);logger['error'](_0x17a7a4,util['inspect'](_0xc267b2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x54a315){return function(_0x4c9a54){if(isNotNull(_0x4c9a54)&&isNotNull(_0x4c9a54[0x0])){if(_0x4c9a54[0x0][_0x17ff('0x67')]>0x0){_0x54a315['message']=utils[_0x17ff('0x68')][_0x17ff('0x69')];logger[_0x17ff('0x45')]('[getContactDialer2][ReScheduled]'+_0x54a315[_0x17ff('0x43')],_0x4c9a54[0x0][_0x17ff('0x67')],'contacts');}else{_0x54a315['message']=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x17ff('0x45')]('[getContactDialer2][Empty]'+_0x54a315[_0x17ff('0x43')]);}}};}function createObjHistory(_0x3ec221,_0x303767,_0x350f33,_0x506df2,_0x4dfa73){_0x3ec221[_0x17ff('0x6a')]=_0x350f33;var _0x51a51a=new Action(_0x3ec221,_0x303767);var _0x312865=new History(_0x51a51a);_0x312865[_0x17ff('0x6b')]=_0x506df2;_0x312865[_0x17ff('0x6c')]=_0x4dfa73;_0x312865[_0x17ff('0x6d')]=_0x51a51a[_0x17ff('0x6e')];return _0x312865;}function unlockQueueStatus(_0x5049bb,_0x58d88d){setTimeout(function(){if(_[_0x17ff('0x3c')](_0x5049bb[_0x17ff('0x6f')])){loggerBooked[_0x17ff('0x63')](_0x17ff('0x70'),_0x58d88d);}_0x5049bb[_0x17ff('0x6f')]=!![];loggerBooked[_0x17ff('0x45')](_0x17ff('0x71'),_0x58d88d,JSON[_0x17ff('0x72')](_[_0x17ff('0x73')](_0x5049bb,[_0x17ff('0x43'),_0x17ff('0x6f')])));},0x1f3);}function checkInterval(_0x5801a3){return function(){if(!isNotNull(_0x5801a3['Interval'])){_0x5801a3[_0x17ff('0x6a')]=utils['CAMPAIGN_STATUS'][_0x17ff('0x74')];throw _0x5801a3['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x5801a3[_0x17ff('0x75')]['Intervals'])){_0x5801a3[_0x17ff('0x6a')]=utils[_0x17ff('0x68')]['NULL_INTERVAL'];throw _0x5801a3['name']+_0x17ff('0x76');}if(!isNotNull(_[_0x17ff('0x44')](_0x5801a3['Interval'][_0x17ff('0x77')]))){_0x5801a3['message']=utils[_0x17ff('0x68')]['NULL_INTERVAL'];throw _0x5801a3[_0x17ff('0x43')]+_0x17ff('0x76');}};}function checkIsIVRCampaignActive(_0x1d0f7e){return function(){if(!utils[_0x17ff('0x78')](_0x1d0f7e)){_0x1d0f7e[_0x17ff('0x6a')]=utils[_0x17ff('0x68')][_0x17ff('0x79')];throw _0x1d0f7e[_0x17ff('0x43')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x20627f){if(utils[_0x17ff('0x7a')](_0x20627f)){emit(util[_0x17ff('0x41')](_0x17ff('0x7b'),_0x20627f['name']),'campaign:save',_0x20627f);}}function loggerCatchQueueSummary(_0x373dfe,_0x156443){return function(_0x584a00){clearPredictiveAttributes(_0x156443);emitCampaignSummary(_0x156443);loggerSyncQueueSummary[_0x17ff('0x3f')](_0x373dfe,util[_0x17ff('0x65')](_0x584a00,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4f1ada){if(_0x4f1ada[_0x17ff('0x7c')]){if(_0x4f1ada[_0x17ff('0x7d')]===0x0){_0x4f1ada['sendMessageOneNotActive']=![];_0x4f1ada[_0x17ff('0x6a')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0x17ff('0x3f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4f1ada[_0x17ff('0x43')],'is\x20not\x20active');}else{_0x4f1ada[_0x17ff('0x6a')]=utils['CAMPAIGN_STATUS'][_0x17ff('0x7e')];loggerSyncQueueSummary[_0x17ff('0x3f')](_0x17ff('0x7f'),_0x4f1ada[_0x17ff('0x43')],'is\x20disactive');}emitCampaignSummary(_0x4f1ada);}}function myreject(_0x55a60e){return function(_0x4878c6){return _0x55a60e(msgResponse(_0x17ff('0x80'),_0x17ff('0x81'),JSON['stringify'](_0x4878c6)));};}Dialer[_0x17ff('0x19')][_0x17ff('0x82')]=function(_0x25aa5b){return!_[_0x17ff('0x3c')](_0x25aa5b)&&_0x25aa5b&&!_[_0x17ff('0x3c')](_0x25aa5b[_0x17ff('0x43')])&&!_[_0x17ff('0x3c')](_0x25aa5b[_0x17ff('0x83')])&&_0x25aa5b['active']&&(this[_0x17ff('0x20')][util[_0x17ff('0x41')](_0x17ff('0x84'),_0x25aa5b[_0x17ff('0x43')])][_0x17ff('0x85')]==='reachable'||this[_0x17ff('0x20')][util[_0x17ff('0x41')](_0x17ff('0x84'),_0x25aa5b['name'])]['status']==='unmonitored');};Dialer['prototype']['checkIsTrunkReachable']=function(_0x3c523f){var _0x35d07e=this;return function(){if(!_0x35d07e['isTrunkReachable'](_0x3c523f[_0x17ff('0x86')])){if(!_0x35d07e['isTrunkReachable'](_0x3c523f[_0x17ff('0x87')])){_0x3c523f[_0x17ff('0x6a')]=utils[_0x17ff('0x68')][_0x17ff('0x88')];throw _0x3c523f['name']+_0x17ff('0x89');}}};};Dialer['prototype'][_0x17ff('0x8a')]=function(_0x29f93c,_0x496fdc,_0x10ea0f,_0x4e82d5){var _0x262e9e=this;return function(){var _0x24ae74=!![];return _0x262e9e[_0x17ff('0x8b')](_0x29f93c,_0x496fdc,_0x10ea0f,_0x4e82d5,_0x24ae74);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x3197fd,_0x56a203,_0x291da2,_0x11e508){var _0x4356ea=this;return function(){var _0x598bf7=![];return _0x4356ea[_0x17ff('0x8b')](_0x3197fd[_0x17ff('0x77')],_0x56a203,_0x291da2,_0x11e508,_0x598bf7);};};Dialer[_0x17ff('0x19')][_0x17ff('0x8b')]=function(_0x35acf0,_0x1f5e5f,_0x277187,_0x119648,_0x3512b2){var _0x4e07f1=[];return new Promise(function(_0x6d9d29,_0x57e692){if(!isNotNull(_0x35acf0)){_0x119648[_0x17ff('0x6a')]=utils[_0x17ff('0x68')][_0x17ff('0x74')];return _0x57e692(msgResponse('ifTime',_0x17ff('0x8c'),_0x277187+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x17ff('0x44')](_0x35acf0)){_0x119648['message']=utils[_0x17ff('0x68')][_0x17ff('0x8d')];return _0x57e692(msgResponse(_0x17ff('0x8e'),_0x17ff('0x8c'),_0x277187+_0x17ff('0x8f')));}if(_0x1f5e5f&&_[_0x17ff('0x3c')](config[_0x17ff('0x90')][_0x1f5e5f])){_0x119648[_0x17ff('0x6a')]=utils[_0x17ff('0x68')][_0x17ff('0x91')];return _0x57e692(msgResponse(_0x17ff('0x8e'),_0x17ff('0x8c'),_0x277187+_0x17ff('0x92')+_0x1f5e5f));}if(_[_0x17ff('0x93')](_0x35acf0)){for(var _0x289ebd=0x0;_0x289ebd<_0x35acf0[_0x17ff('0x94')];_0x289ebd+=0x1){_0x4e07f1[_0x17ff('0x95')](ami[_0x17ff('0x96')]({'action':_0x17ff('0x97'),'command':util[_0x17ff('0x41')](_0x17ff('0x98'),_0x35acf0[_0x289ebd]['interval'],!_[_0x17ff('0x3c')](config[_0x17ff('0x90')][_0x1f5e5f])?_0x1f5e5f:'')})[_0x17ff('0x3b')](function(_0x169742){return _0x169742[_0x17ff('0x99')]['indexOf']('true')>=0x0;})[_0x17ff('0x9a')](myreject(_0x57e692)));}}else{_0x4e07f1[_0x17ff('0x95')](ami['Action']({'action':_0x17ff('0x97'),'command':util['format'](_0x17ff('0x98'),_0x35acf0,!_[_0x17ff('0x3c')](config[_0x17ff('0x90')][_0x1f5e5f])?_0x1f5e5f:'')})[_0x17ff('0x3b')](function(_0x37a837){return _0x37a837['content'][_0x17ff('0x9b')]('true')>=0x0;})[_0x17ff('0x9a')](myreject(_0x57e692)));}Promise[_0x17ff('0x9c')](_0x4e07f1)[_0x17ff('0x3b')](function(_0x3fbaf9){var _0x52f2f5=_[_0x17ff('0x9d')](_0x3fbaf9);if(_0x52f2f5){return _0x6d9d29(_0x52f2f5);}else{_0x119648[_0x17ff('0x6a')]=_0x3512b2?utils[_0x17ff('0x68')][_0x17ff('0x9e')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x57e692(msgResponse(_0x17ff('0x9f'),_0x17ff('0x8c'),_0x17ff('0xa0')+_0x3512b2+'\x20'+_0x277187+'\x20Interval\x20is\x20overtime:\x20'+util[_0x17ff('0x65')](_0x35acf0,{'showHidden':![],'depth':null})+_0x17ff('0xa1')+_0x1f5e5f));}})['catch'](function(_0x583518){return _0x57e692(msgResponse(_0x17ff('0x8e'),_0x17ff('0x8c'),JSON[_0x17ff('0x72')](_0x583518)));});});};Dialer['prototype'][_0x17ff('0x39')]=function(){var _0x5060ab=this;return cmHopper[_0x17ff('0xa2')]({'active':![]},{'where':{'active':!![]}})[_0x17ff('0x3b')](function(){setInterval(function(){_0x5060ab[_0x17ff('0xa3')]();},0x3e8);});};Dialer[_0x17ff('0x19')][_0x17ff('0xa3')]=function(){var _0x2a4f59=this;var _0x216caa;for(var _0xd13f3b in this[_0x17ff('0x1f')]){if(typeof this[_0x17ff('0x1f')][_0xd13f3b]!==_0x17ff('0xa4')){_0x216caa=this[_0x17ff('0x1f')][_0xd13f3b];if(utils[_0x17ff('0x7a')](_0x216caa)&&utils['isIVRCampaignActive'](_0x216caa)){_0x216caa[_0x17ff('0x7c')]=!![];Promise[_0x17ff('0xa5')]()[_0x17ff('0x3b')](checkIsIVRCampaignActive(_0x216caa))[_0x17ff('0x3b')](checkInterval(_0x216caa))[_0x17ff('0x3b')](_0x2a4f59[_0x17ff('0xa6')](_0x216caa))[_0x17ff('0x3b')](_0x2a4f59[_0x17ff('0x8a')](_0x216caa['dialGlobalInterval'],_0x216caa['dialTimezone'],_0x216caa[_0x17ff('0x43')],_0x216caa))[_0x17ff('0x3b')](_0x2a4f59[_0x17ff('0xa7')](_0x216caa[_0x17ff('0x75')],_0x216caa[_0x17ff('0xa8')],_0x216caa[_0x17ff('0x43')],_0x216caa))['then'](_0x2a4f59[_0x17ff('0xa9')](_0x216caa))['catch'](loggerCatchQueueSummary(_0x17ff('0xaa'),_0x216caa));}else{notSendMessagesCampaign(_0x216caa);}}}};Dialer[_0x17ff('0x19')]['checkDialMethod']=function(_0x10b22e){if(_0x10b22e['dialMethod']!==_0x17ff('0xab')){clearPredictiveAttributes(_0x10b22e);}switch(_0x10b22e[_0x17ff('0xac')]){case _0x17ff('0xad'):this['handlePower'](_0x10b22e,0x1);break;case _0x17ff('0xae'):this[_0x17ff('0xaf')](_0x10b22e,_0x10b22e[_0x17ff('0xb0')]);break;case _0x17ff('0xab'):this[_0x17ff('0xab')](_0x10b22e);break;case _0x17ff('0x9'):this[_0x17ff('0xaf')](_0x10b22e,0x1);break;default:logger[_0x17ff('0x63')](_0x17ff('0xb1'),_0x10b22e[_0x17ff('0x43')],'method\x20not\x20recognized');}};Dialer[_0x17ff('0x19')][_0x17ff('0x8e')]=function(_0xc9a92b,_0x671c07){var _0x4a9d26=_0xc9a92b[_0x17ff('0xa8')];var _0x3e404c=_0x671c07?_0xc9a92b[_0x17ff('0xb2')]:_0xc9a92b[_0x17ff('0x75')][_0x17ff('0x77')];logger['silly'](_0x17ff('0xb3'),_0x3e404c,_0x4a9d26,_0xc9a92b[_0x17ff('0x43')],util[_0x17ff('0x41')](_0x17ff('0xb4'),_0xc9a92b['name'],_0xc9a92b['id']));var _0x11af91=null;return Interval[_0x17ff('0xb5')](_0x3e404c,_0x4a9d26)[_0x17ff('0x3b')](function(_0x525a60){if(_0x525a60===!![]){return _0x525a60;}else{_0xc9a92b[_0x17ff('0x6a')]=_0x671c07?utils['CAMPAIGN_STATUS'][_0x17ff('0x9e')]:utils[_0x17ff('0x68')][_0x17ff('0xb6')];_0x11af91=msgResponse('[ifTime][promiseAll]',_0x17ff('0x8c'),_0x17ff('0xa0')+_0x671c07+'\x20'+_0xc9a92b[_0x17ff('0x43')]+_0x17ff('0xb7')+util['inspect'](_0x3e404c,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4a9d26);}if(_0x11af91!==null){logger['silly'](_0x17ff('0xb8'),_0x11af91);_0x11af91[_0x17ff('0xb9')]=_0x671c07;throw _0x11af91;}})['catch'](function(_0x5590e5){logger[_0x17ff('0x63')](_0x17ff('0xba'),_0x5590e5);throw msgResponse(_0x17ff('0x80'),_0x17ff('0x81'),util[_0x17ff('0x65')](_0x5590e5,{'showHidden':![],'depth':null}));});};Dialer[_0x17ff('0x19')]['syncAgentConnect']=function(_0xd32024){if(this[_0x17ff('0x1e')][_0xd32024[_0x17ff('0xbb')]]){if(this[_0x17ff('0x24')][_0xd32024[_0x17ff('0xbc')]]&&this[_0x17ff('0x24')][_0xd32024['uniqueid']][_0x17ff('0x3e')]!==_0x17ff('0xbd')){this['updateOriginated'](this[_0x17ff('0x1e')][_0xd32024['queue']]);this[_0x17ff('0x24')][_0xd32024[_0x17ff('0xbc')]][_0x17ff('0xbe')]=moment()['format'](_0x17ff('0xbf'));}}};Dialer[_0x17ff('0x19')][_0x17ff('0xc0')]=function(_0x2acf1d){var _0x24cf92=this[_0x17ff('0x24')][_0x2acf1d[_0x17ff('0xbc')]];if(this[_0x17ff('0x1e')][_0x2acf1d['queue']]){if(_0x24cf92&&_0x24cf92['type']!==_0x17ff('0xbd')){delete this[_0x17ff('0x24')][_0x2acf1d[_0x17ff('0xbc')]];this[_0x17ff('0x1e')][_0x2acf1d[_0x17ff('0xbb')]][_0x17ff('0xc1')]+=0x1;var _0x515c40=new AgentComplete(_0x24cf92,_0x2acf1d);if(_0x2acf1d[_0x17ff('0xc2')]===_0x17ff('0xc3')){_0x515c40[_0x17ff('0xc4')]=this[_0x17ff('0x1e')][_0x2acf1d[_0x17ff('0xbb')]]['dialQueueProject2']&&this['voiceQueues'][_0x2acf1d['queue']][_0x17ff('0xc5')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x17ff('0xc6')](_0x515c40)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0xc7')));hopperUtils[_0x17ff('0xc8')](_0x515c40)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0xc9')));}}};Dialer['prototype'][_0x17ff('0x2e')]=function(_0x13d99e){var _0x377276=this['uniqueId'][_0x13d99e[_0x17ff('0xbc')]];var _0x4c2206=this;var _0x83db54=![];var _0xdaa14e;var _0x5aef53;if(this[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]]){if(_0x377276&&_0x377276[_0x17ff('0x3e')]!==_0x17ff('0xbd')){delete this[_0x17ff('0x24')][_0x13d99e['uniqueid']];this[_0x17ff('0xca')](this[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]]);_0x377276[_0x17ff('0xcb')]=moment()[_0x17ff('0x41')](_0x17ff('0xbf'));var _0x426765=new QueueCallerAbandon(_0x377276,_0x13d99e);if(utils[_0x17ff('0x5e')](_0x377276[_0x17ff('0xcb')],_0x377276[_0x17ff('0xcc')])>=_0x377276['dialQueueTimeout']){this['voiceQueues'][_0x13d99e[_0x17ff('0xbb')]][_0x17ff('0x4b')]+=0x1;this[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x17ff('0x1e')][_0x13d99e['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x426765[_0x17ff('0x6b')]=0xa;_0x426765[_0x17ff('0x6c')]='Drop';_0x426765['dropreason']=_0x17ff('0xcd');_0x426765[_0x17ff('0xc4')]=this[_0x17ff('0x1e')][_0x13d99e['queue']][_0x17ff('0xce')]?moment()[_0x17ff('0x41')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x426765[_0x17ff('0xcf')]+=0x1;_0x426765[_0x17ff('0xd0')]+=0x1;_0xdaa14e=this[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]][_0x17ff('0xd1')];_0x5aef53=this[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x17ff('0xd2')](_0x426765,_0x426765['state'],_0x377276['voiceQueue'])[_0x17ff('0x3b')](function(_0x176b81){_0x83db54=_0x176b81[_0x17ff('0xd3')]==0x1;if(_0x426765[_0x17ff('0xcf')]>=_0x4c2206[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]][_0x17ff('0xd4')]){_0x4c2206[_0x17ff('0xd5')](_0x426765,_0x176b81[_0x17ff('0xd3')]);}else{hopperUtils[_0x17ff('0xd6')]({'active':![],'countdropretry':_0x426765[_0x17ff('0xcf')],'scheduledat':moment()[_0x17ff('0xd7')](_0x4c2206[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]][_0x17ff('0xd1')],_0x17ff('0xd8'))[_0x17ff('0x41')](_0x17ff('0xbf')),'ContactId':_0x377276['ContactId'],'ListId':_0x377276[_0x17ff('0xd9')],'VoiceQueueId':_0x377276[_0x17ff('0xda')]||undefined,'CampaignId':_0x377276['CampaignId']||undefined})[_0x17ff('0x9a')](loggerCatch(_0x17ff('0xdb')));var _0x347060=new History(_0x426765);_0x347060['state']=0xa;_0x347060[_0x17ff('0x6c')]=_0x17ff('0xdc');_0x347060[_0x17ff('0x6e')]=moment()[_0x17ff('0x41')](_0x17ff('0xbf'));_0x347060[_0x17ff('0x6d')]=_0x347060[_0x17ff('0x6e')];_0x347060['calleridname']=_0x426765['calleridname'];_0x347060[_0x17ff('0xdd')]=_0x426765[_0x17ff('0xdd')];hopperUtils['createHistory'](_0x347060)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0xde')));}})['then'](function(){if(_0x83db54)hopperUtils[_0x17ff('0xdf')](_0x426765,_0xdaa14e,_0x5aef53)[_0x17ff('0x3b')](function(){return 0x1;});});}else{this[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]]['outboundDropCallsDayCallersExit']+=0x1;_0x426765[_0x17ff('0x6b')]=0xb;_0x426765['statedesc']=_0x17ff('0xe0');_0x426765[_0x17ff('0xe1')]=_0x17ff('0xe2');_0x426765[_0x17ff('0xe3')]+=0x1;_0x426765[_0x17ff('0xd0')]+=0x1;_0xdaa14e=this[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]][_0x17ff('0xe4')];_0x5aef53=this[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]][_0x17ff('0xe5')];hopperUtils[_0x17ff('0xd2')](_0x426765,_0x426765[_0x17ff('0x6b')],_0x377276['voiceQueue'])['then'](function(_0x2d2a1c){if(_0x426765['countabandonedretry']>=_0x4c2206['voiceQueues'][_0x13d99e[_0x17ff('0xbb')]]['dialAbandonedMaxRetry']){_0x4c2206[_0x17ff('0xd5')](_0x426765,_0x2d2a1c['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x426765[_0x17ff('0xe3')],'scheduledat':moment()[_0x17ff('0xd7')](_0x4c2206[_0x17ff('0x1e')][_0x13d99e[_0x17ff('0xbb')]][_0x17ff('0xe4')],_0x17ff('0xd8'))['format'](_0x17ff('0xbf')),'ContactId':_0x377276['ContactId'],'ListId':_0x377276[_0x17ff('0xd9')],'VoiceQueueId':_0x377276[_0x17ff('0xda')]||undefined,'CampaignId':_0x377276[_0x17ff('0xe6')]||undefined})[_0x17ff('0x9a')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3e5afa=new History(_0x426765);_0x3e5afa['state']=0xb;_0x3e5afa[_0x17ff('0x6c')]=_0x17ff('0xe0');_0x3e5afa['starttime']=moment()[_0x17ff('0x41')](_0x17ff('0xbf'));_0x3e5afa[_0x17ff('0x6d')]=_0x3e5afa['starttime'];_0x3e5afa[_0x17ff('0xe7')]=_0x426765[_0x17ff('0xe7')];_0x3e5afa['calleridnum']=_0x426765['calleridnum'];hopperUtils['createHistory'](_0x3e5afa)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0xe8')));}})[_0x17ff('0x3b')](function(){if(_0x83db54)hopperUtils[_0x17ff('0xdf')](_0x426765,_0xdaa14e,_0x5aef53)[_0x17ff('0x3b')](function(){return 0x1;});});}}}};Dialer[_0x17ff('0x19')]['syncNewExten']=function(_0x252973){if(this['actions'][_0x252973[_0x17ff('0xbc')]]){this[_0x17ff('0x22')][_0x252973[_0x17ff('0xbc')]]['channel']=_0x252973[_0x17ff('0xe9')];}if(this['uniqueId'][_0x252973[_0x17ff('0xbc')]]){this[_0x17ff('0x24')][_0x252973[_0x17ff('0xbc')]][_0x17ff('0xe9')]=_0x252973[_0x17ff('0xe9')];}};Dialer['prototype'][_0x17ff('0x38')]=function(_0x1abf8a){if(!this['actions'][_0x1abf8a[_0x17ff('0xea')]]){return;}var _0xca9bc0=this[_0x17ff('0x1e')][this[_0x17ff('0x22')][_0x1abf8a[_0x17ff('0xea')]]['queue']][_0x17ff('0xeb')]||_0x17ff('0xec');if(_0xca9bc0==='roundrobin'){if(this[_0x17ff('0x22')][_0x1abf8a[_0x17ff('0xea')]]&&_[_0x17ff('0xed')](this[_0x17ff('0x22')][_0x1abf8a[_0x17ff('0xea')]][_0x17ff('0xee')])&&_0x1abf8a[_0x17ff('0x85')]==='1'&&_0x1abf8a[_0x17ff('0xef')]==='0'){if(this[_0x17ff('0xf0')][_0x1abf8a[_0x17ff('0xf1')]]){if(!this[_0x17ff('0xf0')][_0x1abf8a[_0x17ff('0xf1')]]['locked']){this[_0x17ff('0xf0')][_0x1abf8a[_0x17ff('0xf1')]][_0x17ff('0xee')]=!![];this[_0x17ff('0x22')][_0x1abf8a[_0x17ff('0xea')]][_0x17ff('0xee')]=!![];this[_0x17ff('0x22')][_0x1abf8a[_0x17ff('0xea')]][_0x17ff('0xf1')]=_0x1abf8a['stateinterface'];}}}}else if(_0xca9bc0===_0x17ff('0xec')){if(this[_0x17ff('0x22')][_0x1abf8a[_0x17ff('0xea')]]){if(this['agents'][_0x1abf8a[_0x17ff('0xf1')]]){this[_0x17ff('0x22')][_0x1abf8a['actionid']][_0x17ff('0xf1')]=_0x1abf8a['stateinterface'];if(_[_0x17ff('0xed')](this['queueBooked'][this[_0x17ff('0x22')][_0x1abf8a[_0x17ff('0xea')]][_0x17ff('0xbb')]])){this[_0x17ff('0x28')][this[_0x17ff('0x22')][_0x1abf8a[_0x17ff('0xea')]][_0x17ff('0xbb')]]=[];}this[_0x17ff('0x28')][this[_0x17ff('0x22')][_0x1abf8a[_0x17ff('0xea')]][_0x17ff('0xbb')]][_0x17ff('0x95')](_[_0x17ff('0xf2')](_[_0x17ff('0x73')](this[_0x17ff('0x22')][_0x1abf8a['actionid']],['idHopper',_0x17ff('0xf1')]),{'status':_0x1abf8a[_0x17ff('0x85')],'paused':_0x1abf8a[_0x17ff('0xef')]}));}}}};Dialer['prototype'][_0x17ff('0xf3')]=function(_0x2afc07){if(!this['actions'][_0x2afc07[_0x17ff('0xea')]]){return;}var _0x639e82=this;var _0x3b56ac=this[_0x17ff('0x1e')][this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xbb')]];var _0x1a5fcd=_0x3b56ac[_0x17ff('0xeb')]||_0x17ff('0xec');if(_0x1a5fcd==='roundrobin'){if(this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]]&&this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xf1')]){this[_0x17ff('0x1d')]['run'](this[_0x17ff('0x22')][_0x2afc07['actionid']][_0x17ff('0xf4')],this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]]['stateinterface'])[_0x17ff('0x9a')](function(_0x4317de){logger[_0x17ff('0x63')](_0x17ff('0xf5'),util['inspect'](_0x4317de,{'showHidden':![],'depth':null}));})[_0x17ff('0x1b')](function(){_0x639e82[_0x17ff('0xca')](_0x639e82[_0x17ff('0x1e')][_0x639e82[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xbb')]]);_0x639e82[_0x17ff('0xf0')][_0x639e82[_0x17ff('0x22')][_0x2afc07['actionid']][_0x17ff('0xf1')]]['locked']=![];delete _0x639e82[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]];unlockQueueStatus(_0x3b56ac);});}else{this['updateOriginated'](this[_0x17ff('0x1e')][this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xbb')]]);hopperUtils[_0x17ff('0xd6')]({'active':![],'ContactId':this[_0x17ff('0x22')][_0x2afc07['actionid']]['ContactId'],'ListId':this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xd9')],'VoiceQueueId':this[_0x17ff('0x22')][_0x2afc07['actionid']][_0x17ff('0xda')]||undefined,'CampaignId':this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xe6')]||undefined})['catch'](loggerCatch(_0x17ff('0xf6')));delete this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]];unlockQueueStatus(_0x3b56ac);}}else if(_0x1a5fcd===_0x17ff('0xec')){var _0x82f8c0;if(this['actions'][_0x2afc07['actionid']]&&!_['isEmpty'](this['queueBooked'][this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xbb')]])){if(this[_0x17ff('0x29')][_0x639e82[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xbb')]]){this[_0x17ff('0x29')][_0x639e82['actions'][_0x2afc07['actionid']]['queue']]=this[_0x17ff('0x29')][this['actions'][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xbb')]]?this[_0x17ff('0x29')][this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xbb')]]:this[_0x17ff('0x28')][this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xbb')]]?this[_0x17ff('0x28')][this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xbb')]][_0x17ff('0xf7')]||0x0:0x0;}this['queueBooked'][this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]]['queue']][_0x17ff('0xf7')]=this[_0x17ff('0x29')][this[_0x17ff('0x22')][_0x2afc07[_0x17ff('0xea')]][_0x17ff('0xbb')]];for(var _0xebd3c7=0x0;_0xebd3c7=_0x1a3ce2[_0x17ff('0x119')]){_0x15b3f1[_0x17ff('0x11a')](_0x381585,_0x53a9e2,_0x4b7a3f,_0x17ff('0x11b'));}else{if(_0x381585['countmachineretry']>=_0x1a3ce2[_0x17ff('0x11c')]){_0x15b3f1[_0x17ff('0x11d')](_0x381585,_0x53a9e2,_0x4b7a3f,'reason\x2019\x20machine....');}else{hopperUtils[_0x17ff('0xd6')]({'active':![],'countmachineretry':_0x381585['countmachineretry'],'scheduledat':moment()[_0x17ff('0xd7')](_0x1a3ce2['dialMachineRetryFrequency'],_0x17ff('0xd8'))[_0x17ff('0x41')](_0x17ff('0xbf')),'ContactId':_0x381585['ContactId'],'ListId':_0x381585[_0x17ff('0xd9')],'VoiceQueueId':_0x381585[_0x17ff('0xda')]||undefined,'CampaignId':_0x381585[_0x17ff('0xe6')]||undefined})['catch'](loggerCatch(_0x17ff('0x11e')));_0x53a9e2({'reschedule':0x1});}}});}if(_0x4fb77c[_0x17ff('0x3e')]==='ivr'&&this['campaigns'][_0x4fb77c[_0x17ff('0xbb')]][_0x17ff('0x107')]&&_0x52bf6f[_0x17ff('0x108')]==='HANGUP'){delete this[_0x17ff('0x24')][_0x52bf6f[_0x17ff('0xbc')]];this[_0x17ff('0xca')](this[_0x17ff('0x1f')][_0x4fb77c[_0x17ff('0xbb')]]);_0x2480ad=new Hangup(_0x4fb77c,_0x52bf6f);_0x2480ad['state']=0x12;_0x2480ad[_0x17ff('0x6c')]=_0x17ff('0x10a');_0x2480ad[_0x17ff('0x10b')]=_0x17ff('0x10c');ami[_0x17ff('0x3d')](_0x17ff('0x10d'),ut['buildObj'](_0x2480ad,_0x17ff('0x10e')));this[_0x17ff('0x10f')](_0x2480ad,'[syncHangupInAMDIvr][createHistory]',_0x17ff('0x11f'));}if(_0x4fb77c[_0x17ff('0x3e')]===_0x17ff('0xbd')&&this['campaigns'][_0x4fb77c[_0x17ff('0xbb')]][_0x17ff('0x107')]&&_0x52bf6f['value']==='MACHINE'){return new Promise(function(_0x632c61,_0x39211c){delete _0x15b3f1['uniqueId'][_0x52bf6f[_0x17ff('0xbc')]];_0x15b3f1[_0x17ff('0xca')](_0x15b3f1[_0x17ff('0x1f')][_0x4fb77c[_0x17ff('0xbb')]]);_0x15b3f1['campaigns'][_0x4fb77c[_0x17ff('0xbb')]][_0x17ff('0xc1')]+=0x1;_0x15b3f1[_0x17ff('0x1f')][_0x4fb77c[_0x17ff('0xbb')]][_0x17ff('0x109')]+=0x1;var _0x1ecf9b=_0x15b3f1['campaigns'][_0x4fb77c[_0x17ff('0xbb')]];var _0x57a6a9=new Hangup(_0x4fb77c,_0x52bf6f);_0x57a6a9['state']=0x13;_0x57a6a9[_0x17ff('0x6c')]=_0x17ff('0x112');_0x57a6a9[_0x17ff('0x10b')]=_0x17ff('0x10c');_0x57a6a9['countmachineretry']+=0x1;_0x57a6a9['countglobal']+=0x1;_0x57a6a9[_0x17ff('0x10e')]=!![];ami['emit']('custom:amd',ut['buildObj'](_0x57a6a9,_0x17ff('0x10e')));hopperUtils[_0x17ff('0xc6')](_0x57a6a9)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x113')));if(_0x57a6a9[_0x17ff('0x114')]+_0x57a6a9[_0x17ff('0x115')]+_0x57a6a9[_0x17ff('0x116')]+_0x57a6a9[_0x17ff('0x117')]+_0x57a6a9[_0x17ff('0xcf')]+_0x57a6a9[_0x17ff('0xe3')]+_0x57a6a9[_0x17ff('0x120')]+_0x57a6a9[_0x17ff('0x118')]>=_0x1ecf9b['dialGlobalMaxRetry']){_0x15b3f1[_0x17ff('0x11a')](_0x57a6a9,_0x632c61,_0x39211c,_0x17ff('0x11b'));}else{if(_0x57a6a9[_0x17ff('0x120')]>=_0x1ecf9b[_0x17ff('0x11c')]){_0x15b3f1['createStateFinal'](_0x57a6a9,_0x632c61,_0x39211c,_0x17ff('0x121'));}else{hopperUtils[_0x17ff('0xd6')]({'active':![],'countmachineretry':_0x57a6a9[_0x17ff('0x120')],'scheduledat':moment()['add'](_0x1ecf9b['dialMachineRetryFrequency'],_0x17ff('0xd8'))[_0x17ff('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x57a6a9['ContactId'],'ListId':_0x57a6a9[_0x17ff('0xd9')],'VoiceQueueId':_0x57a6a9[_0x17ff('0xda')]||undefined,'CampaignId':_0x57a6a9[_0x17ff('0xe6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x632c61({'reschedule':0x1});}}});}}};Dialer[_0x17ff('0x19')][_0x17ff('0x35')]=function(_0x3022ac){var _0x2a5e47=this[_0x17ff('0x24')][_0x3022ac[_0x17ff('0xbc')]];var _0x207fac;if(_0x2a5e47&&_0x2a5e47['type']===_0x17ff('0xbd')){delete this[_0x17ff('0x24')][_0x3022ac[_0x17ff('0xbc')]];this[_0x17ff('0xca')](this[_0x17ff('0x1f')][_0x2a5e47[_0x17ff('0xbb')]]);this['campaigns'][_0x2a5e47[_0x17ff('0xbb')]]['ivrAnswerCallsDay']+=0x1;_0x207fac=new Hangup(_0x2a5e47,_0x3022ac);hopperUtils[_0x17ff('0xc6')](_0x207fac)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x122')));hopperUtils[_0x17ff('0xc8')](_0x207fac)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x123')));}if(_0x2a5e47&&_0x2a5e47[_0x17ff('0x3e')]!==_0x17ff('0xbd')&&isNotNull(this['voiceQueues'][_0x2a5e47[_0x17ff('0xbb')]]['dialQueueProject'])){delete this['uniqueId'][_0x3022ac[_0x17ff('0xbc')]];this[_0x17ff('0xca')](this[_0x17ff('0x1e')][_0x2a5e47['queue']]);this[_0x17ff('0x1e')][_0x2a5e47[_0x17ff('0xbb')]][_0x17ff('0xc1')]+=0x1;this[_0x17ff('0x1e')][_0x2a5e47[_0x17ff('0xbb')]][_0x17ff('0x109')]+=0x1;_0x207fac=new Hangup(_0x2a5e47,_0x3022ac);_0x207fac[_0x17ff('0x6b')]=0x10;_0x207fac[_0x17ff('0x6c')]=_0x17ff('0x124');_0x207fac[_0x17ff('0x10b')]='AGI';hopperUtils[_0x17ff('0xc6')](_0x207fac)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x122')));hopperUtils['moveContactManagedDialer'](_0x207fac)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x123')));}if(_0x2a5e47&&_0x2a5e47[_0x17ff('0x3e')]!==_0x17ff('0xbd')&&!isNotNull(this[_0x17ff('0x1e')][_0x2a5e47['queue']][_0x17ff('0x125')])){delete this[_0x17ff('0x24')][_0x3022ac['uniqueid']];this[_0x17ff('0xca')](this[_0x17ff('0x1e')][_0x2a5e47[_0x17ff('0xbb')]]);this[_0x17ff('0x1e')][_0x2a5e47[_0x17ff('0xbb')]][_0x17ff('0x126')]+=0x1;_0x207fac=new Hangup(_0x2a5e47,_0x3022ac);_0x207fac[_0x17ff('0x6b')]=0xc;_0x207fac[_0x17ff('0x6c')]=_0x3022ac[_0x17ff('0x127')];_0x207fac[_0x17ff('0x10b')]=_0x17ff('0x128');hopperUtils[_0x17ff('0xc6')](_0x207fac)[_0x17ff('0x9a')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x17ff('0xc8')](_0x207fac)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x123')));}};Dialer[_0x17ff('0x19')]['syncQueueSummary']=function(_0x59ee29){var _0x3f47e8=this;if(!_0x3f47e8[_0x17ff('0x2a')][_0x59ee29[_0x17ff('0x43')]]){_0x3f47e8[_0x17ff('0x2a')][_0x59ee29[_0x17ff('0x43')]]={'running':![]};}else if(_0x3f47e8['queuesSummary'][_0x59ee29[_0x17ff('0x43')]][_0x17ff('0x129')]===!![]){return;}else if(_0x3f47e8[_0x17ff('0x2a')][_0x59ee29['name']][_0x17ff('0x129')]===![]){_0x3f47e8[_0x17ff('0x2a')][_0x59ee29[_0x17ff('0x43')]][_0x17ff('0x129')]=!![];}var _0x3fcbcc=_0x3f47e8[_0x17ff('0x1e')][_0x59ee29['name']];var _0x51e629=_0x3fcbcc[_0x17ff('0x6a')]!==utils['CAMPAIGN_STATUS'][_0x17ff('0x79')];var _0x33860c=utils[_0x17ff('0x12a')](_0x3fcbcc);_0x3fcbcc[_0x17ff('0x12b')]=utils[_0x17ff('0x12c')](_0x3fcbcc,_0x3f47e8[_0x17ff('0x20')]);Promise['resolve']()['then'](function(){if(_0x3fcbcc[_0x17ff('0x12b')]===utils[_0x17ff('0x68')][_0x17ff('0x79')]){if(_0x51e629){clearPredictiveAttributes(_0x3fcbcc);_0x59ee29[_0x17ff('0x26')]=undefined;_0x59ee29[_0x17ff('0x5f')]=undefined;}if(_0x3fcbcc['statusMessage']===utils[_0x17ff('0x68')][_0x17ff('0x79')]){_0x59ee29[_0x17ff('0x12d')]=0x0;_0x59ee29[_0x17ff('0xef')]=0x0;_0x59ee29[_0x17ff('0x12e')]=0x0;_0x59ee29[_0x17ff('0x12f')]=0x0;_0x59ee29['pTalking']=0x0;}}else if(_0x3fcbcc[_0x17ff('0x12b')]===utils[_0x17ff('0x68')][_0x17ff('0x130')]&&!_0x33860c){return _0x3f47e8[_0x17ff('0x8e')](_0x3fcbcc,!![])[_0x17ff('0x3b')](function(){return _0x3f47e8[_0x17ff('0x8e')](_0x3fcbcc,![]);})[_0x17ff('0x3b')](function(){return _0x3f47e8[_0x17ff('0x131')](_0x3fcbcc);})[_0x17ff('0x9a')](function(_0x5abbed){loggerSyncQueueSummary[_0x17ff('0x3f')](_0x17ff('0x132'),util[_0x17ff('0x65')](_0x5abbed,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3fcbcc);});}else{clearPredictiveAttributes(_0x3fcbcc);}})[_0x17ff('0x3b')](function(){var _0xd31ea7=_0x59ee29[_0x17ff('0x133')](_0x3fcbcc);if(_0xd31ea7||_0x3fcbcc['queueSummaryCountersUpdated']){_0x3fcbcc[_0x17ff('0x134')]=![];_0x59ee29[_0x17ff('0x135')](_0x3fcbcc);Object[_0x17ff('0x136')](_0x3fcbcc,_0x59ee29);emitOutboundVoiceQueueSummary(_0x59ee29);}_0x3f47e8[_0x17ff('0x2a')][_0x3fcbcc[_0x17ff('0x43')]]['running']=![];})['catch'](function(_0x10f2d2){logger[_0x17ff('0x63')](_0x17ff('0x132'),util[_0x17ff('0x65')](_0x10f2d2,{'showHidden':![],'depth':null}));_0x3f47e8[_0x17ff('0x2a')][_0x3fcbcc[_0x17ff('0x43')]][_0x17ff('0x129')]=![];});};Dialer[_0x17ff('0x19')][_0x17ff('0x33')]=_['throttle'](function(){var _0x1dc2cb=_[_0x17ff('0x137')](this[_0x17ff('0x1e')],function(_0x59c739){return _0x59c739[_0x17ff('0x138')];});var _0x13312c=_['filter'](this['agents'],function(_0x561834){return _0x561834['online']&&_0x561834['status']==='reachable';});if(_0x1dc2cb[_0x17ff('0x94')]>0x0&&_0x13312c['length']>0x0){return Promise[_0x17ff('0xa5')]()[_0x17ff('0x3b')](cmHopper[_0x17ff('0x139')](_[_0x17ff('0x13a')](_0x1dc2cb,'id'),previewRecallmeReminderInterval,_['map'](_0x13312c,'id')))[_0x17ff('0x3b')](function(_0x59e51f){for(var _0x27e971=0x0;_0x27e971<_0x59e51f[_0x17ff('0x94')];_0x27e971++){var _0x210688=_0x59e51f[_0x27e971][_0x17ff('0x13b')][_0x17ff('0x43')];if(_0x210688)io['to'](util[_0x17ff('0x41')]('user:%s',_0x210688))['emit'](_0x17ff('0x13c'),{'hopper':_0x59e51f[_0x27e971]});}})['catch'](function(_0x5aeab4){logger[_0x17ff('0x63')]('checkPreviewRecallReminder',_0x5aeab4);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x17ff('0x19')]['loopClearZombieChannels']=function(){var _0x49765=this;setInterval(function(){_0x49765[_0x17ff('0x13d')](_0x49765[_0x17ff('0x24')],_0x17ff('0x13e'));_0x49765[_0x17ff('0x13d')](_0x49765[_0x17ff('0x22')],_0x17ff('0x13f'));},0x32c8);};Dialer[_0x17ff('0x19')][_0x17ff('0x13d')]=function(_0x526ea3,_0x2f9b19){var _0x54e2c3=this;for(var _0x29e25b in _0x526ea3){if(typeof _0x526ea3[_0x29e25b]!==_0x17ff('0xa4')){this[_0x17ff('0x1c')][_0x17ff('0x140')](function(){if(!_['isNil'](_0x526ea3[_0x29e25b])){return ami[_0x17ff('0x96')]({'action':_0x17ff('0x85'),'channel':_0x526ea3[_0x29e25b][_0x17ff('0xe9')]})[_0x17ff('0x9a')](function(_0x29498a){if(_0x29498a[_0x17ff('0x6a')]===_0x17ff('0x141')){setTimeout(function(){if(_0x526ea3[_0x29e25b]&&_0x526ea3[_0x29e25b][_0x17ff('0x3e')]!==_0x17ff('0xbd')){_0x54e2c3['updateOriginated'](_0x54e2c3[_0x17ff('0x1e')][_0x526ea3[_0x29e25b][_0x17ff('0xbb')]]);logger[_0x17ff('0x63')](_0x17ff('0x142'),_0x2f9b19,_0x29e25b,_0x526ea3[_0x29e25b][_0x17ff('0xbb')]);delete _0x526ea3[_0x29e25b];}if(_0x526ea3[_0x29e25b]&&_0x526ea3[_0x29e25b][_0x17ff('0x3e')]==='ivr'){_0x54e2c3[_0x17ff('0xca')](_0x54e2c3['campaigns'][_0x526ea3[_0x29e25b][_0x17ff('0xbb')]]);logger[_0x17ff('0x63')](_0x17ff('0x143'),_0x2f9b19,_0x29e25b,_0x526ea3[_0x29e25b]['queue']);delete _0x526ea3[_0x29e25b];}},0x2328);}});}});}}};Dialer[_0x17ff('0x19')]['getVoiceQueueRtPauses']=function(_0x9f5ef9){return Promise['resolve']()['then'](voiceQueueRt[_0x17ff('0x144')](_0x9f5ef9))[_0x17ff('0x9a')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x17ff('0x19')][_0x17ff('0xca')]=function(_0x1df038){if(!_['isUndefined'](_0x1df038)&&_0x1df038!==null){if(typeof _0x1df038[_0x17ff('0x7d')]!==_0x17ff('0xa4')){if(_0x1df038[_0x17ff('0x7d')]>0x0){_0x1df038[_0x17ff('0x7d')]-=0x1;}else{logger['error'](_0x17ff('0x145'));}}}else{logger[_0x17ff('0x63')](_0x17ff('0x146'));}};Dialer[_0x17ff('0x19')]['loggerHandler']=function(_0x37252e,_0x321a2a){var _0x16241a=this;return function(_0x2fd7aa){_0x16241a[_0x17ff('0xca')](_0x321a2a);logger[_0x17ff('0x63')](_0x37252e,util['inspect'](_0x2fd7aa,{'showHidden':![],'depth':null}));};};Dialer[_0x17ff('0x19')][_0x17ff('0x147')]=function(_0x8c0fcb,_0x3937da,_0xd91d36){var _0x16940d={'state':0x19,'statedesc':'notFound'};this[_0x17ff('0xca')](_0x3937da);this[_0x17ff('0x10f')](_[_0x17ff('0xf2')](_0x16940d,_[_0x17ff('0x73')](_0xd91d36,['ContactId','ListId',_0x17ff('0x148'),_0x17ff('0xda'),_0x17ff('0xe6')])),'[emptyContact][createHistory]',_0x17ff('0x149'));logger['error'](_0x8c0fcb);};Dialer[_0x17ff('0x19')][_0x17ff('0x10f')]=function(_0x2cad18,_0xdd2af8,_0x3b7123){hopperUtils['createHistory'](_0x2cad18)[_0x17ff('0x9a')](loggerCatch(_0xdd2af8));hopperUtils[_0x17ff('0xc8')](_0x2cad18)[_0x17ff('0x9a')](loggerCatch(_0x3b7123));};Dialer['prototype'][_0x17ff('0xd5')]=function(_0x51a8b6,_0x2e85d5){hopperUtils['createHistory'](_0x51a8b6)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0xc7')));if(_0x2e85d5==0x0){hopperUtils[_0x17ff('0xc8')](_0x51a8b6)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x14a')));}};Dialer[_0x17ff('0x19')][_0x17ff('0x14b')]=function(_0x59fd2d){return Promise[_0x17ff('0xa5')]()['then'](cmHopper[_0x17ff('0x139')](_0x59fd2d['id'],previewRecallmeReminderInterval))['then'](function(_0x391abe){for(var _0x4c0127=0x0;_0x4c0127<_0x391abe[_0x17ff('0x94')];_0x4c0127++){var _0x450e16=_0x391abe[_0x4c0127][_0x17ff('0x13b')][_0x17ff('0x43')];if(_0x450e16)io['to'](util[_0x17ff('0x41')](_0x17ff('0x14c'),_0x450e16))[_0x17ff('0x3d')](_0x17ff('0x13c'),{'hopper':_0x391abe[_0x4c0127]});}})['catch'](function(){});};Dialer[_0x17ff('0x19')][_0x17ff('0xa9')]=function(_0x107eb6){var _0x384767=this;return function(){_0x384767[_0x17ff('0x14d')](_0x107eb6);};};Dialer[_0x17ff('0x19')][_0x17ff('0x14e')]=function(_0x5402f5,_0x1e83ce){var _0x5e5bd3=this;var _0x3d9bc2=uuid['v4']();this['actions'][_0x3d9bc2]=new Action(_0x5402f5,_0x1e83ce,_0x3d9bc2);return new Promise(function(_0x8cd3ef,_0xc9f77b){if(_[_0x17ff('0x3c')](_0x5402f5)&&typeof _0x5402f5!==_0x17ff('0x14f')){return _0xc9f77b(msgResponse(_0x17ff('0x150'),'Failure',_0x17ff('0x151')));}if(_[_0x17ff('0x3c')](_0x1e83ce[_0x17ff('0x152')])||_0x1e83ce[_0x17ff('0x152')]===null){return _0xc9f77b(msgResponse('originate',_0x17ff('0x8c'),_0x17ff('0x153')));}var _0x55eee5={'XMD-CALLERID':_0x5e5bd3[_0x17ff('0x22')][_0x3d9bc2][_0x17ff('0x154')](),'XMD-AGI':_0x5402f5[_0x17ff('0x125')]?util[_0x17ff('0x41')](_0x17ff('0x155'),ipAgi,_0x5402f5['dialQueueProject']):_0x17ff('0x156'),'XMD-AGIAFTER':_0x5402f5['dialQueueProject2']?util['format'](_0x17ff('0x155'),ipAgi,_0x5402f5[_0x17ff('0xce')]):_0x17ff('0x156'),'XMD-QUEUE':utils['isOutboundQueue'](_0x5402f5)?util['format']('\x22%s,%s%s,,,%s\x22',_0x5402f5[_0x17ff('0x43')],_0x5402f5[_0x17ff('0x157')]||'',_0x5402f5[_0x17ff('0xc5')]?'c':'',_0x5402f5[_0x17ff('0x158')]||0x3):_0x17ff('0x156'),'XMD-CONTACTID':_0x1e83ce[_0x17ff('0xfe')],'XMD-CDRTYPE':_0x17ff('0x8'),'CALLERID(all)':_0x5e5bd3['actions'][_0x3d9bc2][_0x17ff('0x154')](),'XMD-AMD':_0x5402f5[_0x17ff('0x107')]?_0x17ff('0x130'):_0x17ff('0x156'),'XMD-DESTINATION':_0x17ff('0x106')};if(_0x5402f5[_0x17ff('0x107')]){_0x55eee5['XMD-AMDINITIALSILENCE']=_0x5402f5['dialAMDInitialSilence']||0x9c4;_0x55eee5['XMD-AMDGREETING']=_0x5402f5[_0x17ff('0x159')]||0x5dc;_0x55eee5[_0x17ff('0x15a')]=_0x5402f5[_0x17ff('0x15b')]||0x320;_0x55eee5['XMD-AMDTOTALANALYSISTIME']=_0x5402f5[_0x17ff('0x15c')]||0x1388;_0x55eee5[_0x17ff('0x15d')]=_0x5402f5[_0x17ff('0x15e')]||0x64;_0x55eee5[_0x17ff('0x15f')]=_0x5402f5[_0x17ff('0x160')]||0x32;_0x55eee5[_0x17ff('0x161')]=_0x5402f5['dialAMDMaximumNumberOfWords']||0x3;_0x55eee5['XMD-AMDSILENCETHRESHOLD']=_0x5402f5[_0x17ff('0x162')]||0x100;_0x55eee5[_0x17ff('0x163')]=_0x5402f5[_0x17ff('0x164')]||0x1388;}if(utils[_0x17ff('0x165')](_0x5402f5)){_0x55eee5['XMD-VOICEQUEUEID']=_0x1e83ce['VoiceQueueId'];}else{_0x55eee5[_0x17ff('0x166')]=_0x1e83ce[_0x17ff('0xe6')];}for(var _0x11a93e in _0x1e83ce[_0x17ff('0x167')]){if(typeof _0x1e83ce[_0x17ff('0x167')][_0x11a93e]!==_0x17ff('0xa4')){if(isNotNull(_0x1e83ce[_0x17ff('0x167')][_0x11a93e])&&_0x11a93e!=='id'&&_0x11a93e!==_0x17ff('0x168')&&_0x11a93e!=='createdAt'&&_0x11a93e!=='updatedAt'){_0x55eee5[util[_0x17ff('0x41')](_0x17ff('0x169'),_0x17ff('0x16a'),_[_0x17ff('0x16b')](_0x11a93e))]=_0x1e83ce['Contact'][_0x11a93e];}}}var _0x304434=_0x5e5bd3[_0x17ff('0x82')](_0x5402f5[_0x17ff('0x86')])?utils['getCallerId'](_0x5402f5[_0x17ff('0x86')][_0x17ff('0x16c')],_0x5402f5[_0x17ff('0x16d')],_0x5402f5[_0x17ff('0x16e')]>0x0?utils[_0x17ff('0x16f')](_0x5402f5[_0x17ff('0x170')],_0x5402f5['dialRandomLastDigitCallerIdNumber']):_0x5402f5[_0x17ff('0x170')]):utils['getCallerId'](_[_0x17ff('0xed')](_0x5402f5[_0x17ff('0x87')])?_0x5402f5[_0x17ff('0x86')]['callerid']:_0x5402f5[_0x17ff('0x87')][_0x17ff('0x16c')],_0x5402f5[_0x17ff('0x16d')],_0x5402f5[_0x17ff('0x16e')]>0x0?utils[_0x17ff('0x16f')](_0x5402f5['dialOriginateCallerIdNumber'],_0x5402f5[_0x17ff('0x16e')]):_0x5402f5['dialOriginateCallerIdNumber']);if(_0x304434){_0x55eee5[_0x17ff('0x171')]=_0x5e5bd3['actions'][_0x3d9bc2]['originatecalleridname']=utils['extractCalleridName'](_0x304434);_0x55eee5[_0x17ff('0x172')]=_0x1e83ce['phone'];}_0x5402f5['variables']=_0x55eee5;return ami[_0x17ff('0x96')]({'actionid':_0x3d9bc2,'action':'originate','channel':_0x5e5bd3[_0x17ff('0x82')](_0x5402f5[_0x17ff('0x86')])?util[_0x17ff('0x41')](_0x17ff('0x173'),_0x5402f5[_0x17ff('0x86')][_0x17ff('0x43')],isNotNull(_0x5402f5[_0x17ff('0x174')])?_0x5402f5[_0x17ff('0x174')]['trim']()||'':'',_0x5402f5[_0x17ff('0x175')]>0x0?_0x1e83ce['phone']['substring'](_0x5402f5[_0x17ff('0x175')]):_0x1e83ce['phone']):util[_0x17ff('0x41')](_0x17ff('0x173'),_['isNil'](_0x5402f5[_0x17ff('0x87')])?_0x5402f5[_0x17ff('0x86')]['name']:_0x5402f5[_0x17ff('0x87')]['name'],isNotNull(_0x5402f5[_0x17ff('0x174')])?_0x5402f5[_0x17ff('0x174')][_0x17ff('0x176')]()||'':'',_0x5402f5['dialCutDigit']>0x0?_0x1e83ce[_0x17ff('0x152')]['substring'](_0x5402f5[_0x17ff('0x175')]):_0x1e83ce[_0x17ff('0x152')]),'callerid':_0x304434,'Exten':'xcally-motion-dialer','Context':_0x17ff('0x177'),'Priority':'1','variable':_0x55eee5,'timeout':(_0x5402f5[_0x17ff('0x178')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3d9bc2})['then'](function(_0x574a15){return _0x8cd3ef(_0x574a15);})['catch'](function(_0x16e7b2){_0x5402f5['outboundOriginateFailureCallsDay']+=0x1;var _0x3006bd=new History(_0x5e5bd3['actions'][_0x3d9bc2]);logger[_0x17ff('0x63')](util['format'](_0x17ff('0x179'),JSON['stringify'](_0x16e7b2)));_0x3006bd[_0x17ff('0x6b')]=0xe;_0x3006bd[_0x17ff('0x6c')]='OriginateError';_0x3006bd[_0x17ff('0x6e')]=moment()['format'](_0x17ff('0xbf'));_0x3006bd[_0x17ff('0x6d')]=_0x3006bd[_0x17ff('0x6e')];hopperUtils['createHistory'](_0x3006bd)['catch'](loggerCatch(_0x17ff('0x17a')));_0x5e5bd3['moveContactManagedDialer'](_0x3006bd)['catch'](loggerCatch(_0x17ff('0x17a')))['finally'](function(){delete _0x5e5bd3[_0x17ff('0x22')][_0x3d9bc2];return _0xc9f77b(msgResponse(_0x17ff('0x150'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x17ff('0x19')]['checkRetriveMax']=function(_0xdb764d,_0x1274bb,_0x2d3f63){var _0x22df19=new History(_0x1274bb);if(_0x22df19[_0x17ff('0x114')]+_0x22df19[_0x17ff('0x115')]+_0x22df19[_0x17ff('0x116')]+_0x22df19[_0x17ff('0x117')]+_0x22df19[_0x17ff('0xcf')]+_0x22df19[_0x17ff('0xe3')]+_0x22df19[_0x17ff('0x120')]+_0x22df19[_0x17ff('0x118')]>=_0x2d3f63[_0x17ff('0x119')]-0x1){return!![];}switch(_0xdb764d){case 0x3:if(_0x22df19[_0x17ff('0x116')]>=_0x2d3f63['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x17ff('0xd6')]({'active':![],'countnoanswerretry':_0x22df19['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x2d3f63[_0x17ff('0x17b')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x22df19[_0x17ff('0xfe')],'ListId':_0x22df19[_0x17ff('0xd9')],'VoiceQueueId':_0x22df19[_0x17ff('0xda')]||undefined,'CampaignId':_0x22df19[_0x17ff('0xe6')]||undefined})[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x17c')));break;case 0x5:if(_0x22df19['countbusyretry']>=_0x2d3f63['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x22df19[_0x17ff('0x114')]+=0x1,'scheduledat':moment()[_0x17ff('0xd7')](_0x2d3f63['dialBusyRetryFrequency'],_0x17ff('0xd8'))[_0x17ff('0x41')](_0x17ff('0xbf')),'ContactId':_0x22df19[_0x17ff('0xfe')],'ListId':_0x22df19[_0x17ff('0xd9')],'VoiceQueueId':_0x22df19[_0x17ff('0xda')]||undefined,'CampaignId':_0x22df19[_0x17ff('0xe6')]||undefined})[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x17d')));break;case 0x8:if(_0x22df19['countcongestionretry']>=_0x2d3f63[_0x17ff('0x17e')]-0x1){return!![];}hopperUtils[_0x17ff('0xd6')]({'active':![],'countcongestionretry':_0x22df19[_0x17ff('0x115')]+=0x1,'scheduledat':moment()['add'](_0x2d3f63[_0x17ff('0x17f')],'minutes')[_0x17ff('0x41')](_0x17ff('0xbf')),'ContactId':_0x22df19[_0x17ff('0xfe')],'ListId':_0x22df19['ListId'],'VoiceQueueId':_0x22df19[_0x17ff('0xda')]||undefined,'CampaignId':_0x22df19[_0x17ff('0xe6')]||undefined})['catch'](loggerCatch(_0x17ff('0x180')));break;case 0x0:if(_0x22df19[_0x17ff('0x117')]>=_0x2d3f63[_0x17ff('0x181')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x22df19[_0x17ff('0x117')]+=0x1,'scheduledat':moment()[_0x17ff('0xd7')](_0x2d3f63['dialNoSuchNumberRetryFrequency'],'minutes')[_0x17ff('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x22df19['ContactId'],'ListId':_0x22df19[_0x17ff('0xd9')],'VoiceQueueId':_0x22df19['VoiceQueueId']||undefined,'CampaignId':_0x22df19[_0x17ff('0xe6')]||undefined})[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x182')));}break;case 0xa:if(_0x22df19[_0x17ff('0xcf')]>=_0x2d3f63[_0x17ff('0xd4')]-0x1){return!![];}hopperUtils[_0x17ff('0xd6')]({'active':![],'countdropretry':_0x22df19[_0x17ff('0xcf')]+=0x1,'scheduledat':moment()[_0x17ff('0xd7')](_0x2d3f63[_0x17ff('0xd1')],'minutes')[_0x17ff('0x41')](_0x17ff('0xbf')),'ContactId':_0x22df19['ContactId'],'ListId':_0x22df19[_0x17ff('0xd9')],'VoiceQueueId':_0x22df19['VoiceQueueId']||undefined,'CampaignId':_0x22df19[_0x17ff('0xe6')]||undefined})['catch'](loggerCatch(_0x17ff('0xdb')));break;case 0xb:if(_0x22df19[_0x17ff('0xe3')]>=_0x2d3f63[_0x17ff('0x183')]-0x1){return!![];}hopperUtils[_0x17ff('0xd6')]({'active':![],'countabandonedretry':_0x22df19['countabandonedretry']+=0x1,'scheduledat':moment()[_0x17ff('0xd7')](_0x2d3f63[_0x17ff('0xe4')],_0x17ff('0xd8'))[_0x17ff('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x22df19['ContactId'],'ListId':_0x22df19[_0x17ff('0xd9')],'VoiceQueueId':_0x22df19['VoiceQueueId']||undefined,'CampaignId':_0x22df19[_0x17ff('0xe6')]||undefined})['catch'](loggerCatch(_0x17ff('0x184')));break;case 0x13:if(_0x22df19['countmachineretry']>=_0x2d3f63[_0x17ff('0x11c')]-0x1){return!![];}hopperUtils[_0x17ff('0xd6')]({'active':![],'countmachineretry':_0x22df19[_0x17ff('0x120')]+=0x1,'scheduledat':moment()[_0x17ff('0xd7')](_0x2d3f63[_0x17ff('0x185')],_0x17ff('0xd8'))[_0x17ff('0x41')](_0x17ff('0xbf')),'ContactId':_0x22df19[_0x17ff('0xfe')],'ListId':_0x22df19[_0x17ff('0xd9')],'VoiceQueueId':_0x22df19[_0x17ff('0xda')]||undefined,'CampaignId':_0x22df19['CampaignId']||undefined})[_0x17ff('0x9a')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x22df19[_0x17ff('0x118')]>=_0x2d3f63[_0x17ff('0x186')]-0x1){return!![];}hopperUtils[_0x17ff('0xd6')]({'active':![],'countagentrejectretry':_0x22df19[_0x17ff('0x118')]+=0x1,'scheduledat':moment()[_0x17ff('0xd7')](_0x2d3f63[_0x17ff('0x187')],_0x17ff('0xd8'))[_0x17ff('0x41')](_0x17ff('0xbf')),'ContactId':_0x22df19['ContactId'],'ListId':_0x22df19[_0x17ff('0xd9')],'VoiceQueueId':_0x22df19[_0x17ff('0xda')]||undefined,'CampaignId':_0x22df19[_0x17ff('0xe6')]||undefined})[_0x17ff('0x9a')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x17ff('0x19')][_0x17ff('0x104')]=function(_0x39747c,_0xd27ed4,_0x3c2e82){var _0x86c992=this;var _0x1d3215=new History(_0x39747c);var _0x1073b9=![];var _0x4331a2;var _0x2ce755;return new Promise(function(_0x387c50,_0x180810){if(_['isUndefined'](_0xd27ed4)&&typeof _0xd27ed4!==_0x17ff('0x14f')){return _0x180810(msgResponse(_0x17ff('0x188'),'Failure','entity\x20is\x20undefine'));}if(_[_0x17ff('0x3c')](_0x3c2e82)&&typeof _0x3c2e82!==_0x17ff('0x14f')){return _0x180810(msgResponse(_0x17ff('0x188'),'Failure',_0x17ff('0x189')));}hopperUtils[_0x17ff('0xd2')](_0x1d3215,_0x3c2e82[_0x17ff('0xc2')],_0xd27ed4)[_0x17ff('0x3b')](function(_0x555579){if(_0x555579[_0x17ff('0xd3')]==0x1)_0x1073b9=!![];switch(_0x3c2e82[_0x17ff('0xc2')]){case'0':_0xd27ed4[_0x17ff('0x18a')]+=0x1;_0x1d3215[_0x17ff('0x6b')]=0x0;_0x1d3215[_0x17ff('0x6c')]=_0x17ff('0x18b');_0x1d3215[_0x17ff('0x117')]+=0x1;_0x1d3215[_0x17ff('0xd0')]+=0x1;ami[_0x17ff('0x3d')](_0x17ff('0x18c'),ut[_0x17ff('0x18d')](_0x39747c,'nosuchnumber'));_0x4331a2=_0xd27ed4[_0x17ff('0x18e')];_0x2ce755=_0xd27ed4[_0x17ff('0xe5')];hopperUtils[_0x17ff('0xc6')](_0x1d3215)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x113')));if(_0x86c992[_0x17ff('0x18f')](0x0,_0x39747c,_0xd27ed4)&&!_0x1073b9){if(_0x1d3215['countnosuchnumberretry']>=_0xd27ed4[_0x17ff('0x181')]){_0x86c992['createStateFinal'](_0x1d3215,_0x387c50,_0x180810,_0x17ff('0x190'));}else{_0x86c992[_0x17ff('0x11a')](_0x1d3215,_0x387c50,_0x180810,_0x17ff('0x190'));}}break;case'3':_0xd27ed4[_0x17ff('0x191')]+=0x1;_0x1d3215[_0x17ff('0x6b')]=0x3;_0x1d3215[_0x17ff('0x6c')]='NoAnswer';_0x1d3215[_0x17ff('0x116')]+=0x1;_0x1d3215['countglobal']+=0x1;var _0x28fa97=ut['buildNoAnswerEventPayload'](_0x39747c,_0xd27ed4);ami[_0x17ff('0x3d')](_0x17ff('0x192'),_0x28fa97);_0x4331a2=_0xd27ed4[_0x17ff('0x17b')];_0x2ce755=_0xd27ed4[_0x17ff('0xe5')];hopperUtils[_0x17ff('0xc6')](_0x1d3215)[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x193')));if(_0x86c992[_0x17ff('0x18f')](0x3,_0x39747c,_0xd27ed4)&&!_0x1073b9){if(_0x1d3215[_0x17ff('0x116')]>=_0xd27ed4['dialNoAnswerMaxRetry']){_0x86c992['createStateFinal'](_0x1d3215,_0x387c50,_0x180810,_0x17ff('0x194'));}else{_0x86c992['stateGlobal'](_0x1d3215,_0x387c50,_0x180810,_0x17ff('0x194'));}}break;case'5':_0xd27ed4[_0x17ff('0x195')]+=0x1;_0x1d3215[_0x17ff('0x6b')]=0x5;_0x1d3215[_0x17ff('0x6c')]=_0x17ff('0x196');_0x1d3215[_0x17ff('0x114')]+=0x1;_0x1d3215[_0x17ff('0xd0')]+=0x1;ami[_0x17ff('0x3d')](_0x17ff('0x197'),ut[_0x17ff('0x18d')](_0x39747c,'busy'));_0x4331a2=_0xd27ed4['dialBusyRetryFrequency'];_0x2ce755=_0xd27ed4['callAdditionalPhoneAfterMin'];hopperUtils[_0x17ff('0xc6')](_0x1d3215)[_0x17ff('0x9a')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x86c992[_0x17ff('0x18f')](0x5,_0x39747c,_0xd27ed4)&&!_0x1073b9){if(_0x1d3215[_0x17ff('0x114')]>=_0xd27ed4[_0x17ff('0x198')]){_0x86c992[_0x17ff('0x11d')](_0x1d3215,_0x387c50,_0x180810,_0x17ff('0x199'));}else{_0x86c992[_0x17ff('0x11a')](_0x1d3215,_0x387c50,_0x180810,_0x17ff('0x199'));}}break;case'8':_0xd27ed4[_0x17ff('0x19a')]+=0x1;_0x1d3215[_0x17ff('0x6b')]=0x8;_0x1d3215[_0x17ff('0x6c')]=_0x17ff('0x19b');_0x1d3215['countcongestionretry']+=0x1;_0x1d3215[_0x17ff('0xd0')]+=0x1;_0x4331a2=_0xd27ed4[_0x17ff('0x17f')];_0x2ce755=_0xd27ed4[_0x17ff('0xe5')];ami[_0x17ff('0x3d')]('custom:agentcongestion',ut[_0x17ff('0x18d')](_0x39747c,_0x17ff('0x19c')));hopperUtils[_0x17ff('0xc6')](_0x1d3215)['catch'](loggerCatch(_0x17ff('0x19d')));if(_0x86c992[_0x17ff('0x18f')](0x8,_0x39747c,_0xd27ed4)&&!_0x1073b9){if(_0x1d3215[_0x17ff('0x115')]>=_0xd27ed4['dialCongestionMaxRetry']){_0x86c992['createStateFinal'](_0x1d3215,_0x387c50,_0x180810,'reason\x208\x20congestion');}else{_0x86c992[_0x17ff('0x11a')](_0x1d3215,_0x387c50,_0x180810,_0x17ff('0x19e'));}}break;case'11':_0xd27ed4[_0x17ff('0x19f')]+=0x1;_0x1d3215['state']=0xb;_0x1d3215[_0x17ff('0x6c')]=_0x17ff('0xe0');_0x1d3215[_0x17ff('0xe3')]+=0x1;_0x1d3215[_0x17ff('0xd0')]+=0x1;_0x4331a2=_0xd27ed4[_0x17ff('0xe4')];_0x2ce755=_0xd27ed4[_0x17ff('0xe5')];hopperUtils[_0x17ff('0xc6')](_0x1d3215)['catch'](loggerCatch(_0x17ff('0xe8')));if(_0x86c992[_0x17ff('0x18f')](0xb,_0x39747c,_0xd27ed4)&&!_0x1073b9){if(_0x1d3215[_0x17ff('0xe3')]>=_0xd27ed4[_0x17ff('0x183')]){_0x86c992[_0x17ff('0x11d')](_0x1d3215,_0x387c50,_0x180810,'reason\x2011\x20abandoned');}else{_0x86c992[_0x17ff('0x11a')](_0x1d3215,_0x387c50,_0x180810,'reason\x2011\x20abandoned');}}break;case'20':_0xd27ed4[_0x17ff('0x1a0')]+=0x1;_0x1d3215['state']=0x14;_0x1d3215['statedesc']=_0x17ff('0x1a1');_0x1d3215[_0x17ff('0x118')]+=0x1;_0x1d3215[_0x17ff('0xd0')]+=0x1;_0x4331a2=_0xd27ed4['dialAgentRejectRetryFrequency'];_0x2ce755=_0xd27ed4[_0x17ff('0xe5')];ami['emit']('custom:agentreject',ut[_0x17ff('0x18d')](_0x39747c,'agentreject'));hopperUtils[_0x17ff('0xc6')](_0x1d3215)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x86c992[_0x17ff('0x18f')](0x14,_0x39747c,_0xd27ed4)&&!_0x1073b9){if(_0x1d3215[_0x17ff('0x118')]>=_0xd27ed4[_0x17ff('0x186')]){_0x86c992[_0x17ff('0x11d')](_0x1d3215,_0x387c50,_0x180810,_0x17ff('0x1a2'));}else{_0x86c992[_0x17ff('0x11a')](_0x1d3215,_0x387c50,_0x180810,_0x17ff('0x1a2'));}}break;default:_0xd27ed4['outboundUnknownCallsDay']+=0x1;_0x1d3215[_0x17ff('0x6b')]=0xc;_0x1d3215[_0x17ff('0x6c')]=_0x3c2e82['reason'];_0x4331a2=_0xd27ed4[_0x17ff('0x187')];_0x2ce755=_0xd27ed4[_0x17ff('0xe5')];hopperUtils[_0x17ff('0xc6')](_0x1d3215)[_0x17ff('0x9a')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x86c992['checkRetriveMax'](_0x3c2e82[_0x17ff('0xc2')],_0x39747c,_0xd27ed4)&&!_0x1073b9){if(_0x1d3215[_0x17ff('0x114')]+_0x1d3215[_0x17ff('0x115')]+_0x1d3215[_0x17ff('0x116')]+_0x1d3215[_0x17ff('0x117')]+_0x1d3215[_0x17ff('0xcf')]+_0x1d3215[_0x17ff('0xe3')]+_0x1d3215[_0x17ff('0x120')]+_0x1d3215[_0x17ff('0x118')]>=_0xd27ed4[_0x17ff('0x119')]){_0x86c992[_0x17ff('0x11a')](_0x1d3215,_0x387c50,_0x180810,_0x3c2e82['reason']);}else{_0x86c992[_0x17ff('0x11d')](_0x1d3215,_0x387c50,_0x180810,_0x3c2e82[_0x17ff('0xc2')]);}}}})[_0x17ff('0x3b')](function(){if(_0x1073b9){hopperUtils[_0x17ff('0xdf')](_0x1d3215,_0x4331a2,_0x2ce755)[_0x17ff('0x3b')](function(){return _0x387c50(0x1);});}});});};Dialer[_0x17ff('0x19')][_0x17ff('0x11a')]=function(_0x361851,_0x2ef43b,_0x52881a,_0x1f0f4e){var _0x25052c=new Final(_0x361851);_0x25052c[_0x17ff('0x6b')]=0xf;_0x25052c[_0x17ff('0x6c')]='Global';this[_0x17ff('0x11d')](_0x25052c,_0x2ef43b,_0x52881a,_0x1f0f4e);};Dialer[_0x17ff('0x19')][_0x17ff('0x11d')]=function(_0x152e3b,_0xda24f7,_0x2834d7,_0x194a81){hopperUtils[_0x17ff('0xc8')](_0x152e3b)['then'](function(){return _0xda24f7(msgResponse(_0x17ff('0x188'),_0x17ff('0x1a3'),_0x194a81));})['catch'](function(){return _0x2834d7(msgResponse('[moveContactManagedDialer][0]','Failure',_0x17ff('0x1a4')));});};Dialer[_0x17ff('0x19')][_0x17ff('0xab')]=function(_0x23415b){var _0xad5f02=_0x23415b[_0x17ff('0x1a5')]/0x64;var _0x4b9ff8=_0x23415b[_0x17ff('0x1a6')]/(_0x23415b[_0x17ff('0x1a6')]+_0x23415b[_0x17ff('0xc1')]);var _0x17ef9c=Math[_0x17ff('0x1a7')](_0x23415b['predictiveIntervalAvailable']*(_0x23415b[_0x17ff('0x1a8')]/0x64));var _0x1d2869=Math[_0x17ff('0x1a7')](_0x23415b['predictiveIntervalAvailable']*(_0x23415b['predictiveIntervalMinThreshold']/0x64));var _0x1effb5=_0x23415b[_0x17ff('0x12d')]+_0x23415b[_0x17ff('0x12f')];var _0x5e4c4f=Math[_0x17ff('0x1a9')](_0x23415b[_0x17ff('0x58')]*_0x23415b[_0x17ff('0x5b')]*_0x23415b[_0x17ff('0x1aa')]*_0x23415b[_0x17ff('0x1ab')]);if(_[_0x17ff('0x3c')](_0x23415b[_0x17ff('0x5f')])){if(!_[_0x17ff('0x3c')](_0x23415b[_0x17ff('0x26')])){_0x23415b[_0x17ff('0x26')]=undefined;loggerPredictive['error'](_0x17ff('0x1ac'),_0x17ff('0x1ad'));}if(!_[_0x17ff('0x3c')](_0x23415b[_0x17ff('0x61')])){loggerPredictive[_0x17ff('0x63')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x23415b[_0x17ff('0x61')]);_0x23415b[_0x17ff('0x61')]=undefined;}_0x23415b[_0x17ff('0x5f')]=moment()[_0x17ff('0x41')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x17ff('0x45')](_0x23415b[_0x17ff('0x43')],_0x17ff('0x1ae'),_0x23415b[_0x17ff('0x5f')]);this[_0x17ff('0xaf')](_0x23415b,0x1);}else if(ifInterval(_0x23415b[_0x17ff('0x1af')],_0x23415b[_0x17ff('0x5f')])){this['handlePower'](_0x23415b,0x1);loggerPredictiveCalls[_0x17ff('0x45')]('[startMethodPredictive][StartProgressive][Loop]',_0x23415b[_0x17ff('0x5f')],_0x23415b[_0x17ff('0x43')]);_0x23415b[_0x17ff('0x58')]=0x0;_0x23415b[_0x17ff('0x1b0')]=0x0;}else if(_0xad5f02<_0x4b9ff8&&_0x23415b[_0x17ff('0x1b1')]==='dropRate'){clearPredictiveAttributes(_0x23415b);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x17ff('0x1b2'),_0x4b9ff8,_0x17ff('0x5f'),_0x23415b[_0x17ff('0x43')]);}else if(_0x5e4c4f<_0x23415b[_0x17ff('0x1b0')]&&_0x23415b[_0x17ff('0x1b1')]===_0x17ff('0x1b3')){clearPredictiveAttributes(_0x23415b);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x1b4'),_0x17ff('0x1b5'),_0x5e4c4f,_0x17ff('0x1b6'),_0x23415b[_0x17ff('0x1b0')],_0x17ff('0x5f'),_0x23415b[_0x17ff('0x43')]);}else if(!ifInterval(_0x23415b['dialPredictiveInterval'],_0x23415b[_0x17ff('0x5f')])&&_[_0x17ff('0x3c')](_0x23415b[_0x17ff('0x26')])&&!_[_0x17ff('0x3c')](_0x23415b[_0x17ff('0x5f')])){_0x23415b['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x17ff('0x45')](_0x23415b[_0x17ff('0x43')],'started\x20in\x20predictive\x20at',_0x23415b[_0x17ff('0x26')]);hopperUtils['avgHandleTime'](_0x23415b[_0x17ff('0x1af')])[_0x17ff('0x3b')](this[_0x17ff('0x1b7')](_0x23415b))[_0x17ff('0x3b')](mergeDataErlangB(_0x23415b))[_0x17ff('0x3b')](this[_0x17ff('0x1b8')](_0x23415b))[_0x17ff('0x9a')](loggerCatchPredictive(_0x17ff('0x1b9'),_0x23415b));}else if(!ifInterval(_0x23415b[_0x17ff('0x1af')],_0x23415b[_0x17ff('0x26')])){_0x23415b[_0x17ff('0x1b0')]=0x0;_0x23415b['startPredictive']=moment()[_0x17ff('0x41')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x23415b['name'],_0x17ff('0x1ba'),_0x23415b['startPredictive']);clearInterval(_0x23415b[_0x17ff('0x61')]);_0x23415b[_0x17ff('0x61')]=undefined;hopperUtils['avgHandleTime'](_0x23415b[_0x17ff('0x1af')])['then'](this[_0x17ff('0x1b7')](_0x23415b))[_0x17ff('0x3b')](mergeDataErlangB(_0x23415b))[_0x17ff('0x3b')](this[_0x17ff('0x1b8')](_0x23415b))[_0x17ff('0x9a')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x23415b));}else if(_0x23415b[_0x17ff('0x1bb')]&&_0x1effb5<_0x23415b['predictiveIntervalAvailable']-_0x1d2869){clearPredictiveAttributes(_0x23415b);loggerPredictive[_0x17ff('0x45')](_0x23415b[_0x17ff('0x43')],_0x17ff('0x1bc'),_0x1effb5,_0x17ff('0x1bd'),_0x23415b['predictiveIntervalAvailable'],'-',_0x1d2869,'=',_0x23415b[_0x17ff('0x1bb')]-_0x1d2869,')');}else if(_0x23415b[_0x17ff('0x1bb')]&&_0x1effb5>_0x23415b['predictiveIntervalAvailable']+_0x17ef9c){clearPredictiveAttributes(_0x23415b);loggerPredictive['info'](_0x23415b['name'],_0x17ff('0x1bc'),_0x1effb5,_0x17ff('0x1be'),_0x23415b[_0x17ff('0x1bb')],'+',_0x17ef9c,'=',_0x23415b[_0x17ff('0x1bb')]+_0x17ef9c,')');}};Dialer[_0x17ff('0x19')][_0x17ff('0x1b7')]=function(_0xac0226){var _0x2915e2=this;return function(_0x397bcf){return new Promise(function(_0x4533af,_0x19dffb){_[_0x17ff('0xf2')](_0xac0226,_0x397bcf[0x0]);if(checkGetDataPredictive(_0x397bcf[0x0])){var _0x146f8d=_0xac0226[_0x17ff('0x1bb')]=_0xac0226[_0x17ff('0x12f')]+_0xac0226[_0x17ff('0x12d')];var _0x12974e=_0xac0226[_0x17ff('0x1af')]*0x3c;var _0x2b3efd=_0x397bcf[0x0][_0x17ff('0x50')]+_0x397bcf[0x0][_0x17ff('0x52')];var _0x7c9c2a=(_0x397bcf[0x0]['predictiveIntervalAnsweredCalls']+_0x397bcf[0x0][_0x17ff('0x4b')]+_0x397bcf[0x0][_0x17ff('0x4d')])/_0x397bcf[0x0][_0x17ff('0x47')];_0xac0226[_0x17ff('0x1aa')]=_0x7c9c2a>0x0?_0x7c9c2a:0x1;switch(_0xac0226[_0x17ff('0x1b1')]){case _0x17ff('0x1b3'):var _0x2be4f3=_0xac0226[_0x17ff('0x1a5')]/0x64;return _0x2915e2['abandonmentRate'](_0x146f8d,_0x12974e,_0x2b3efd,_0x7c9c2a,_0x2be4f3)[_0x17ff('0x3b')](function(_0xfef73d){return _0x4533af(_0xfef73d);});case'agentBusyFactor':var _0x1d083f=_0xac0226['dialPredictiveOptimizationPercentage']/0x64;return _0x2915e2[_0x17ff('0x1bf')](_0x146f8d,_0x12974e,_0x2b3efd,_0x7c9c2a,_0x1d083f)[_0x17ff('0x3b')](function(_0x108a3b){return _0x4533af(_0x108a3b);});default:return _0x19dffb(msgResponse(_0x17ff('0x1c0'),'Failure',_0x17ff('0x1c1')));}}else{return _0x19dffb(msgResponse(_0x17ff('0x1c0'),_0x17ff('0x8c'),'check\x20failure'));}});};};Dialer[_0x17ff('0x19')][_0x17ff('0x1c2')]=function(_0x5ae18e){var _0x5c7a7c=this;return function(_0x38f119){return new Promise(function(_0x53dc8f,_0x2ce6f6){_[_0x17ff('0xf2')](_0x5ae18e,_0x38f119[0x0]);if(checkGetDataPredictive(_0x38f119[0x0])){loggerPredictive[_0x17ff('0x45')](JSON[_0x17ff('0x72')](_0x38f119[0x0]));if(_0x5ae18e[_0x17ff('0x1b1')]==='dropRate'){return _0x5c7a7c[_0x17ff('0x144')](_0x5ae18e['id'])[_0x17ff('0x3b')](function(_0x47b588){var _0x25ded3=_0x5ae18e['loggedIn']-_0x47b588[0x0][_0x17ff('0x1c3')];var _0x29b583=_0x5ae18e[_0x17ff('0x1af')]*0x3c;var _0xc41ce1=_0x38f119[0x0]['predictiveIntervalAvgTalktime']+_0x38f119[0x0][_0x17ff('0x52')];var _0x44c74f=(_0x38f119[0x0][_0x17ff('0x49')]+_0x38f119[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x38f119[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x38f119[0x0][_0x17ff('0x47')];var _0x4d0f35=_0x5ae18e['dialPredictiveOptimizationPercentage']/0x64;_0x5ae18e['predictiveIntervalPauses']=_0x47b588[0x0][_0x17ff('0x1c3')]||0x0;_0x5ae18e[_0x17ff('0x1aa')]=_0x44c74f>0x0?_0x44c74f:0x1;return _0x5c7a7c['abandonmentRate'](_0x25ded3,_0x29b583,_0xc41ce1,_0x44c74f,_0x4d0f35);})[_0x17ff('0x3b')](function(_0xe24d99){return _0x53dc8f(_0xe24d99);})[_0x17ff('0x9a')](function(_0xa29714){return _0x2ce6f6(msgResponse('[CatchErlangB]','Failure',JSON[_0x17ff('0x72')](_0xa29714)));});}if(_0x5ae18e[_0x17ff('0x1b1')]===_0x17ff('0x1c4')){return _0x5c7a7c['getVoiceQueueRtPauses'](_0x5ae18e['id'])[_0x17ff('0x3b')](function(_0x47a7ab){var _0x42b7c3=_0x5ae18e[_0x17ff('0x1c5')]-_0x47a7ab[0x0][_0x17ff('0x1c3')];var _0x209496=_0x5ae18e[_0x17ff('0x1af')]*0x3c;var _0xb2f2b=_0x38f119[0x0]['predictiveIntervalAvgTalktime']+_0x38f119[0x0][_0x17ff('0x52')];var _0x1eb10b=(_0x38f119[0x0][_0x17ff('0x49')]+_0x38f119[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x38f119[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x38f119[0x0][_0x17ff('0x47')];var _0x3da206=_0x5ae18e[_0x17ff('0x1a5')]/0x64;_0x5ae18e['predictiveIntervalPauses']=_0x47a7ab[0x0]['outboundQueuePauses']||0x0;_0x5ae18e['predictiveIntervalHitRate']=_0x1eb10b>0x0?_0x1eb10b:0x1;return _0x5c7a7c[_0x17ff('0x1bf')](_0x42b7c3,_0x209496,_0xb2f2b,_0x1eb10b,_0x3da206);})[_0x17ff('0x3b')](function(_0x298346){return _0x53dc8f(_0x298346);})['catch'](function(_0x5c1590){return _0x2ce6f6(msgResponse(_0x17ff('0x1c6'),_0x17ff('0x8c'),JSON[_0x17ff('0x72')](_0x5c1590)));});}}else{return _0x2ce6f6(msgResponse(_0x17ff('0x1c0'),_0x17ff('0x8c'),_0x17ff('0x1c7')));}});};};Dialer[_0x17ff('0x19')][_0x17ff('0x1b8')]=function(_0x4d7c1e){var _0x12efea=this;return function(){var _0x390b04=0x0;var _0x18ee7e=Math[_0x17ff('0x1a9')](_0x4d7c1e[_0x17ff('0x59')]*0x3e8);if(_0x18ee7e>0x0){_0x18ee7e=_0x18ee7e<0x64?0x64:_0x18ee7e;loggerPredictive[_0x17ff('0x45')](_0x4d7c1e[_0x17ff('0x43')],_0x17ff('0x1c8'),_0x18ee7e,'milliseconds');_0x4d7c1e[_0x17ff('0x61')]=setInterval(function(){_0x12efea[_0x17ff('0x61')](_0x4d7c1e);loggerPredictiveCalls[_0x17ff('0x45')]('[handlePredictive]',_0x390b04+=0x1);},_0x18ee7e);}else{loggerPredictive['info'](_0x4d7c1e[_0x17ff('0x43')],_0x17ff('0x1c9'));}};};Dialer[_0x17ff('0x19')][_0x17ff('0x1ca')]=function(_0x3c4b1f,_0x1cdb78){var _0x23dfc3=this;return function(_0x5e7f1c){if(_['isEmpty'](_0x5e7f1c)){if(_[_0x17ff('0xed')](_0x1cdb78[_0x17ff('0x148')])||!_0x1cdb78['recallme']){if(_0x3c4b1f[_0x17ff('0xac')]==='booked'){_0x3c4b1f[_0x17ff('0x6f')]=_[_0x17ff('0x3c')](_0x3c4b1f[_0x17ff('0x6f')])?!![]:_0x3c4b1f['queueStatusComplete'];var _0x2e5682=uuid['v4']();_0x23dfc3['actions'][_0x2e5682]=new Action(_0x3c4b1f,_0x1cdb78,_0x2e5682);loggerBooked['info'](_0x17ff('0x1cb'),_0x2e5682,_0x17ff('0x1cc'),JSON[_0x17ff('0x72')](_0x3c4b1f[_0x17ff('0x6f')]),_0x17ff('0x1cd'),_0x3c4b1f[_0x17ff('0x43')]);if(_0x3c4b1f[_0x17ff('0x6f')]){_0x3c4b1f[_0x17ff('0x6f')]=![];_0x23dfc3['queueBooked'][_0x23dfc3[_0x17ff('0x22')][_0x2e5682][_0x17ff('0xbb')]]=[];ami[_0x17ff('0x96')]({'actionid':_0x2e5682,'action':'queuestatus','queue':_0x3c4b1f['name']})['catch'](function(){_0x23dfc3['updateOriginated'](_0x3c4b1f);hopperUtils[_0x17ff('0xd6')]({'active':![],'ContactId':_0x23dfc3[_0x17ff('0x22')][_0x2e5682][_0x17ff('0xfe')],'ListId':_0x23dfc3[_0x17ff('0x22')][_0x2e5682]['ListId'],'VoiceQueueId':_0x23dfc3[_0x17ff('0x22')][_0x2e5682][_0x17ff('0xda')]||undefined,'CampaignId':_0x23dfc3[_0x17ff('0x22')][_0x2e5682][_0x17ff('0xe6')]||undefined})[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x1ce')));delete _0x23dfc3[_0x17ff('0x22')][_0x2e5682];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x17ff('0x72')](_0x3c4b1f[_0x17ff('0x6f')]),'Queue:\x20',_0x3c4b1f['name']);_0x23dfc3[_0x17ff('0xca')](_0x3c4b1f);hopperUtils[_0x17ff('0xd6')]({'active':![],'ContactId':_0x23dfc3[_0x17ff('0x22')][_0x2e5682][_0x17ff('0xfe')],'ListId':_0x23dfc3[_0x17ff('0x22')][_0x2e5682][_0x17ff('0xd9')],'VoiceQueueId':_0x23dfc3[_0x17ff('0x22')][_0x2e5682]['VoiceQueueId']||undefined,'CampaignId':_0x23dfc3[_0x17ff('0x22')][_0x2e5682][_0x17ff('0xe6')]||undefined})[_0x17ff('0x9a')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x23dfc3[_0x17ff('0x22')][_0x2e5682];}}else{return _0x23dfc3[_0x17ff('0x14e')](_0x3c4b1f,_0x1cdb78);}}else{if(utils[_0x17ff('0x5e')](undefined,_0x1cdb78[_0x17ff('0x1cf')])<_0x3c4b1f[_0x17ff('0x1d0')]*0x3c){if(_0x1cdb78[_0x17ff('0x13b')]&&!_0x1cdb78[_0x17ff('0x13b')][_0x17ff('0x1d1')]){_0x23dfc3['preview']['run'](_0x1cdb78['id'])['finally'](function(){_0x23dfc3[_0x17ff('0xca')](_0x3c4b1f);});}else{hopperUtils[_0x17ff('0x1d2')]({'active':![]},_0x1cdb78['id'],0x1)[_0x17ff('0x1b')](function(){_0x23dfc3[_0x17ff('0xca')](_0x3c4b1f);});}}else{_0x3c4b1f['outboundReCallsDay']+=0x1;_0x23dfc3[_0x17ff('0xca')](_0x3c4b1f);if(_0x3c4b1f['dialRecallInQueue']){hopperUtils[_0x17ff('0xd6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1cdb78[_0x17ff('0xfe')],'ListId':_0x1cdb78[_0x17ff('0xd9')],'VoiceQueueId':_0x1cdb78[_0x17ff('0xda')]||undefined,'CampaignId':_0x1cdb78[_0x17ff('0xe6')]||undefined})[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x1d3')));hopperUtils['createHistory'](createObjHistory(_0x3c4b1f,_0x1cdb78,utils[_0x17ff('0x68')][_0x17ff('0x1d4')],0x17,_0x17ff('0x1d5')))[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x1d6')));}else{_0x23dfc3[_0x17ff('0x10f')](createObjHistory(_0x3c4b1f,_0x1cdb78,utils[_0x17ff('0x68')][_0x17ff('0x1d7')],0x16,_0x17ff('0x1d8')),'[Originate][HistoryRecallClose][historyCatch]',_0x17ff('0x1d9'));}}}}else{_0x3c4b1f[_0x17ff('0x1da')]+=0x1;_0x23dfc3[_0x17ff('0x10f')](createObjHistory(_0x3c4b1f,_0x1cdb78,utils[_0x17ff('0x68')][_0x17ff('0x1db')],0xd,_0x17ff('0x1dc')),_0x17ff('0x1dd'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x17ff('0x19')]['handleIvr']=function(_0x2aeb18){var _0x4c12b2=this;var _0x4371d2=_0x2aeb18['limitCalls']-_0x2aeb18['originated']-_0x2aeb18[_0x17ff('0x1de')];emitCampaignSummary(_0x2aeb18);if(_0x4371d2>0x0){if(_0x4371d2>this['maxNumberOriginate']){_0x4371d2=this[_0x17ff('0x21')];}_0x2aeb18[_0x17ff('0x1de')]+=_0x4371d2;hopperUtils[_0x17ff('0x1df')](_0x2aeb18['id'],_0x4371d2,_0x2aeb18[_0x17ff('0x1e0')],_0x2aeb18)['then'](function(_0x5e9929){_0x2aeb18['temp']-=_0x4371d2;_0x2aeb18['temp']=_0x2aeb18['temp']>0x0?_0x2aeb18[_0x17ff('0x1de')]:0x0;if(!utils[_0x17ff('0x1e1')](_0x5e9929)){_0x2aeb18[_0x17ff('0x6a')]=utils['CAMPAIGN_STATUS'][_0x17ff('0x1e2')];logger[_0x17ff('0x45')](_0x17ff('0x1e3')+_0x2aeb18[_0x17ff('0x43')]);}else{_0x2aeb18['originated']+=_0x5e9929[_0x17ff('0x94')];_0x2aeb18[_0x17ff('0x6a')]=utils[_0x17ff('0x68')][_0x17ff('0x1e4')];for(var _0x5dbd67=0x0;_0x5dbd67<_0x5e9929[_0x17ff('0x94')];_0x5dbd67+=0x1){_0x2aeb18[_0x17ff('0x1e5')]+=0x1;if(_['isNil'](_0x5e9929[_0x5dbd67])||_['isNil'](_0x5e9929[_0x5dbd67][_0x17ff('0x167')])||_['isNil'](_0x5e9929[_0x5dbd67][_0x17ff('0x152')])){_0x4c12b2['emptyContact'](_0x17ff('0x1e6'),_0x2aeb18,_0x5e9929[_0x5dbd67]);}else{hopperUtils[_0x17ff('0x1e7')](_[_0x17ff('0x73')](_0x5e9929[_0x5dbd67],[_0x17ff('0xe6'),_0x17ff('0x152')]))['then'](_0x4c12b2[_0x17ff('0x1ca')](_0x2aeb18,_0x5e9929[_0x5dbd67]))['catch'](_0x4c12b2[_0x17ff('0x1e8')](_0x17ff('0x1e9'),_0x2aeb18));}}}})[_0x17ff('0x9a')](loggerGetContactDialer(_0x17ff('0x1ea'),_0x2aeb18,_0x4371d2));}};Dialer[_0x17ff('0x19')][_0x17ff('0xaf')]=function(_0xe88b78,_0x1e589f){var _0x307ac7=this;var _0xb648af=[];if(_0x1e589f<0x1||_0xe88b78[_0x17ff('0xac')]===_0x17ff('0x9')){_0x1e589f=0x1;}var _0x6a68e5=Math[_0x17ff('0x1a9')](_0xe88b78['available']*_0x1e589f)-_0xe88b78['originated']-_0xe88b78[_0x17ff('0x1de')];if(_0xe88b78[_0x17ff('0x1eb')]>0x0){var _0x29d2cc=_0xe88b78[_0x17ff('0x1eb')]-_0xe88b78[_0x17ff('0x7d')]-_0xe88b78[_0x17ff('0x12f')]-_0xe88b78[_0x17ff('0x1de')]-_0xe88b78[_0x17ff('0x1ec')];if(_0x6a68e5>_0x29d2cc){_0x6a68e5=_0x29d2cc;}}if(_0x6a68e5>0x0){if(_0xe88b78['dialMethod']===_0x17ff('0x9')){_0x6a68e5=0x1;}if(_0x6a68e5>this[_0x17ff('0x21')]){_0x6a68e5=this['maxNumberOriginate'];}_0xe88b78[_0x17ff('0x1de')]+=_0x6a68e5;for(var _0x235b52 in this[_0x17ff('0xf0')]){if(typeof this['agents'][_0x235b52]!=='undefined'){if(this[_0x17ff('0xf0')][_0x235b52][_0x17ff('0x6b')]===_0x17ff('0x1ed')&&this[_0x17ff('0xf0')][_0x235b52][_0x17ff('0x85')]===_0x17ff('0x1ee')){_0xb648af[_0x17ff('0x95')](this[_0x17ff('0xf0')][_0x235b52]['id']);}}}hopperUtils[_0x17ff('0x1ef')](_0xe88b78,_0xb648af,_0x6a68e5)[_0x17ff('0x3b')](function(_0x1379b3){_0xe88b78['temp']-=_0x6a68e5;_0xe88b78[_0x17ff('0x1de')]=_0xe88b78[_0x17ff('0x1de')]>0x0?_0xe88b78[_0x17ff('0x1de')]:0x0;if(!utils[_0x17ff('0x1e1')](_0x1379b3)){hopperUtils[_0x17ff('0x1f0')](_0xe88b78)[_0x17ff('0x3b')](sendMessageReschedule(_0xe88b78))[_0x17ff('0x9a')](loggerCatch(_0x17ff('0x1f1')));}else{_0xe88b78[_0x17ff('0x7d')]+=_0x1379b3[_0x17ff('0x94')];_0xe88b78[_0x17ff('0x6a')]=_0xe88b78[_0x17ff('0xac')]===_0x17ff('0x9')?utils[_0x17ff('0x68')][_0x17ff('0x130')]:utils[_0x17ff('0x68')][_0x17ff('0x1e4')];for(var _0x2500c7=0x0;_0x2500c7<_0x1379b3[_0x17ff('0x94')];_0x2500c7+=0x1){if(_[_0x17ff('0xed')](_0x1379b3[_0x2500c7])||_[_0x17ff('0xed')](_0x1379b3[_0x2500c7]['Contact'])||_['isNil'](_0x1379b3[_0x2500c7][_0x17ff('0x152')])){_0x307ac7[_0x17ff('0x147')](_0x17ff('0x1e6'),_0xe88b78,_0x1379b3[_0x2500c7]);}else{hopperUtils['checkIsBlackList'](_[_0x17ff('0x73')](_0x1379b3[_0x2500c7],['VoiceQueueId',_0x17ff('0x152')]))[_0x17ff('0x3b')](_0x307ac7[_0x17ff('0x1ca')](_0xe88b78,_0x1379b3[_0x2500c7]))[_0x17ff('0x9a')](_0x307ac7['loggerHandler'](_0x17ff('0x1e6'),_0xe88b78));}}}})[_0x17ff('0x9a')](loggerGetContactDialer('[getContactDialer2]',_0xe88b78,_0x6a68e5));}};Dialer[_0x17ff('0x19')][_0x17ff('0x61')]=function(_0x3f7b88){if(_0x3f7b88[_0x17ff('0x1eb')]>0x0){var _0x170c45=_0x3f7b88['dialLimitQueue']-_0x3f7b88[_0x17ff('0x7d')]-_0x3f7b88[_0x17ff('0x12f')];if(_0x170c45>0x0){this[_0x17ff('0x1f2')](_0x3f7b88);}else{loggerPredictiveCalls[_0x17ff('0x45')]('[handlePredictive][limitChannel]');}}else{this[_0x17ff('0x1f2')](_0x3f7b88);}};Dialer[_0x17ff('0x19')][_0x17ff('0x1f2')]=function(_0x482339){var _0xa0c00f=this;var _0x2f5ecd=[];_0x482339[_0x17ff('0x7d')]+=0x1;for(var _0x5c6aa0 in this[_0x17ff('0xf0')]){if(typeof this[_0x17ff('0xf0')][_0x5c6aa0]!==_0x17ff('0xa4')){if(this['agents'][_0x5c6aa0][_0x17ff('0x6b')]==='not_inuse'&&this[_0x17ff('0xf0')][_0x5c6aa0][_0x17ff('0x85')]==='reachable'){_0x2f5ecd[_0x17ff('0x95')](this[_0x17ff('0xf0')][_0x5c6aa0]['id']);}}}return this[_0x17ff('0x1ef')](_0x482339['id'],_0x2f5ecd,0x1,_0x482339['dialOrderByScheduledAt'],_0x482339)[_0x17ff('0x3b')](function(_0x1ee684){if(!utils[_0x17ff('0x1e1')](_0x1ee684)){utils[_0x17ff('0x66')](_0x482339,0x1,0x0);return hopperUtils[_0x17ff('0x1f0')](_0x482339)[_0x17ff('0x3b')](sendMessageReschedule(_0x482339))['catch'](loggerCatch(_0x17ff('0x1f1')));}else{_0x482339[_0x17ff('0x6a')]=utils[_0x17ff('0x68')][_0x17ff('0x1e4')];if(_['isNil'](_0x1ee684[0x0])||_['isNil'](_0x1ee684[0x0]['Contact'])||_[_0x17ff('0xed')](_0x1ee684[0x0][_0x17ff('0x152')])){_0xa0c00f[_0x17ff('0x147')]('[actionOriginate]\x20',_0x482339,_0x1ee684[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x17ff('0x73')](_0x1ee684[0x0],[_0x17ff('0xda'),'phone']))[_0x17ff('0x3b')](_0xa0c00f[_0x17ff('0x1ca')](_0x482339,_0x1ee684[0x0]))[_0x17ff('0x9a')](_0xa0c00f['loggerHandler'](_0x17ff('0x1f3'),_0x482339));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x482339,0x1));};Dialer[_0x17ff('0x19')][_0x17ff('0x1f4')]=function(_0x4bcfb1,_0x5416f9,_0x29abe7,_0x2fc90e,_0x57fd1c,_0x3974d4){loggerPredictive['info'](_0x17ff('0x1f5'));loggerPredictive[_0x17ff('0x45')](_0x17ff('0x1f6'),_0x4bcfb1);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x1f7'),_0x5416f9);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x1f8'),_0x29abe7);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x1f9'),_0x2fc90e);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x1fa'),_0x57fd1c);loggerPredictive['info'](_0x17ff('0x5d'));return new Promise(function(_0x5175b4,_0x4a3594){if(_0x4bcfb1<=0x0||isNaN(_0x4bcfb1)){return _0x4a3594(msgResponse(_0x17ff('0x1fb'),'Error',_0x17ff('0x1fc')+_0x4bcfb1));}if(_0x29abe7<=0x0||isNaN(_0x29abe7)){return _0x4a3594(msgResponse('[abandonmentRate]',_0x17ff('0x81'),_0x17ff('0x1fd')+_0x29abe7));}if(_0x2fc90e<=0x0||isNaN(_0x2fc90e)){return _0x4a3594(msgResponse(_0x17ff('0x1fb'),'Error',_0x17ff('0x1fe')+_0x2fc90e));}if(_0x5416f9<=0x0||isNaN(_0x5416f9)){return _0x4a3594(msgResponse(_0x17ff('0x1fb'),_0x17ff('0x81'),_0x17ff('0x1ff')+_0x5416f9));}if(_0x57fd1c<=0x0||isNaN(_0x57fd1c)){return _0x4a3594(msgResponse(_0x17ff('0x1fb'),_0x17ff('0x81'),_0x17ff('0x200')+_0x57fd1c));}_0x3974d4=_0x3974d4||0x0;var _0x55853d=0x1/_0x29abe7;var _0x3fdfea=0x0;var _0x108a27=0x0;var _0x2208f9=0x0;var _0x325e34=0x0;for(var _0x27f827=0x0;_0x2208f9<_0x57fd1c;_0x27f827+=0x1){_0x108a27=_0x27f827/_0x5416f9;_0x3fdfea=(_0x2fc90e*_0x108a27+_0x3974d4)/_0x55853d;_0x2208f9=utils[_0x17ff('0x201')](_0x3fdfea,_0x4bcfb1);_0x325e34=_0x3fdfea/_0x4bcfb1*(0x1-utils[_0x17ff('0x201')](_0x3fdfea,_0x4bcfb1));}return _0x5175b4({'erlangCalls':_0x27f827,'erlangCallToSecond':_0x5416f9/_0x27f827,'erlangAbandonmentRate':_0x2208f9,'erlangBusyFactor':_0x325e34});});};Dialer[_0x17ff('0x19')][_0x17ff('0x1bf')]=function(_0x20bf2c,_0x56819d,_0x39e388,_0x3d06ec,_0x51a8ca,_0xfefbc9){loggerPredictive[_0x17ff('0x45')](_0x17ff('0x202'));loggerPredictive[_0x17ff('0x45')](_0x17ff('0x1f6'),_0x20bf2c);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x1f7'),_0x56819d);loggerPredictive[_0x17ff('0x45')]('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',_0x39e388);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x1f9'),_0x3d06ec);loggerPredictive[_0x17ff('0x45')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x51a8ca);loggerPredictive[_0x17ff('0x45')](_0x17ff('0x5d'));return new Promise(function(_0x361990,_0x496587){if(_0x20bf2c<=0x0||isNaN(_0x20bf2c)){return _0x496587(msgResponse(_0x17ff('0x203'),_0x17ff('0x81'),_0x17ff('0x1fc')+_0x20bf2c));}if(_0x39e388<=0x0||isNaN(_0x39e388)){return _0x496587(msgResponse(_0x17ff('0x203'),_0x17ff('0x81'),'Ts\x20=\x20'+_0x39e388));}if(_0x3d06ec<=0x0||isNaN(_0x3d06ec)){return _0x496587(msgResponse(_0x17ff('0x203'),_0x17ff('0x81'),_0x17ff('0x1fe')+_0x3d06ec));}if(_0x56819d<=0x0||isNaN(_0x56819d)){return _0x496587(msgResponse(_0x17ff('0x203'),'Error',_0x17ff('0x1ff')+_0x56819d));}if(_0x51a8ca<=0x0||isNaN(_0x51a8ca)){return _0x496587(msgResponse(_0x17ff('0x203'),'Error',_0x17ff('0x204')+_0x51a8ca));}_0xfefbc9=_0xfefbc9||0x0;var _0x1c09af=0x1/_0x39e388;var _0x398672=0x0;var _0x41e1bb=0x0;var _0x30a622=0x0;var _0x99b296=0x0;for(var _0x164f9d=0x0;_0x99b296<_0x51a8ca;_0x164f9d+=0x1){_0x41e1bb=_0x164f9d/_0x56819d;_0x398672=(_0x3d06ec*_0x41e1bb+_0xfefbc9)/_0x1c09af;_0x30a622=utils[_0x17ff('0x201')](_0x398672,_0x20bf2c);_0x99b296=_0x398672/_0x20bf2c*(0x1-utils[_0x17ff('0x201')](_0x398672,_0x20bf2c));}return _0x361990({'erlangCalls':_0x164f9d,'erlangCallToSecond':_0x56819d/_0x164f9d,'erlangAbandonmentRate':_0x30a622,'erlangBusyFactor':_0x99b296});});};module[_0x17ff('0x205')]=Dialer; \ No newline at end of file +var _0x7f37=['checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','Failure','timezones','isArray','command','iftime\x20%s,%s','interval','content','indexOf','catch','Action','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','isGlobal','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','createHistory','moveContactManagedDialer','[syncAgentComplete]','type','droptime','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','dropreason','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','dialAbandonedMaxRetry','rescheduleContact','ContactId','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','roundrobin','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','contactAgent-idHopper:\x20','isNil','run','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','custom:amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','outboundAnswerAgiCallsDay','Machine','AMD','countmachineretry','amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','value','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','countnoanswerretry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','UserId','[emptyContact][createHistory]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','object','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','getCallerId','Trunk','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','[rescheduleContact][Machine]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','dialNoSuchNumberRetryFrequency','checkRetriveMax','reason\x200\x20no\x20such\x20number....','stateGlobal','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','loggedIn','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','checkContactEmpty','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','getContactDialer','RUNNING','[getContactDialer2]','tryOriginatePredictive','not_inuse','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\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]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/queueCallerAbandon','env','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startProgressive','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','stack','checkContactLowerLimitOriginate','error','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','prototype','active','SIP/%s','status','reachable','unmonitored'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7f37,0x197));var _0x77f3=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7f37[_0x5d6456];return _0x4d66c1;};'use strict';var util=require(_0x77f3('0x0'));var _=require(_0x77f3('0x1'));var uuid=require(_0x77f3('0x2'));var moment=require(_0x77f3('0x3'));var rr=require('rr');var Redis=require(_0x77f3('0x4'));var utils=require(_0x77f3('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0x77f3('0x6'));var config=require(_0x77f3('0x7'));var logger=require(_0x77f3('0x8'))(_0x77f3('0x9'));var loggerBooked=require(_0x77f3('0x8'))(_0x77f3('0xa'));var loggerPredictive=require(_0x77f3('0x8'))(_0x77f3('0xb'));var loggerPredictiveCalls=require(_0x77f3('0x8'))(_0x77f3('0xc'));var loggerSyncQueueSummary=require(_0x77f3('0x8'))('syncQueueSummary');var ami=require(_0x77f3('0xd'));config[_0x77f3('0xe')]=_[_0x77f3('0xf')](config[_0x77f3('0xe')],{'host':_0x77f3('0x10'),'port':0x18eb});var io=require(_0x77f3('0x11'))(new Redis(config[_0x77f3('0xe')]));var cmHopper=require(_0x77f3('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x77f3('0x13'));var Interval=require(_0x77f3('0x14'));var Action=require(_0x77f3('0x15'));var History=require(_0x77f3('0x16'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x77f3('0x17'));var Hangup=require('./models/hangup');var ipAgi=process[_0x77f3('0x18')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x77f3('0x19')]=function(_0x14765a){this[_0x77f3('0x1a')]=this['tail']?this[_0x77f3('0x1a')][_0x77f3('0x1b')](_0x14765a):_0x14765a();};function Dialer(_0x209c59,_0x4548f2){this[_0x77f3('0x1c')]=new Sequence();this[_0x77f3('0x1d')]=_0x4548f2;this[_0x77f3('0x1e')]=_0x209c59[_0x77f3('0x1e')];this[_0x77f3('0x1f')]=_0x209c59[_0x77f3('0x1f')];this[_0x77f3('0x20')]=_0x209c59[_0x77f3('0x20')];this[_0x77f3('0x21')]=_0x209c59[_0x77f3('0x21')];this[_0x77f3('0x22')]=config[_0x77f3('0x22')]||0x2;this[_0x77f3('0x23')]={};this[_0x77f3('0x24')]={};this[_0x77f3('0x25')]={};this[_0x77f3('0x26')]={};this[_0x77f3('0x27')]={};this['startPredictive']={};this['startProgressive']={};this[_0x77f3('0x28')]={};this[_0x77f3('0x29')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on'](_0x77f3('0x2a'),this[_0x77f3('0x2b')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x2d'),this[_0x77f3('0x2e')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x2f'),this[_0x77f3('0x30')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x31'),this[_0x77f3('0x32')]['bind'](this));ami['on'](_0x77f3('0x33'),this[_0x77f3('0x34')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x35'),this[_0x77f3('0x36')][_0x77f3('0x2c')](this));ami['on']('hangup',this[_0x77f3('0x37')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x38'),this[_0x77f3('0x39')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x3a'),this[_0x77f3('0x3b')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x3c'),this[_0x77f3('0x3d')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x3e'),this[_0x77f3('0x3f')][_0x77f3('0x2c')](this));this[_0x77f3('0x40')]();this[_0x77f3('0x41')]();RpcSetting[_0x77f3('0x42')]()[_0x77f3('0x43')](function(_0x54e992){previewRecallmeReminderInterval=_0x54e992[_0x77f3('0x44')];});}function isNotNull(_0x5da540){return _0x5da540!==null&&!_[_0x77f3('0x45')](_0x5da540);}function msgResponse(_0x613154,_0x938054,_0x15718c){return{'action':_0x613154,'response':_0x938054,'message':_0x15718c,'stack':_0x15718c};}function emit(_0x430e14,_0x22a069,_0x940c25){io['to'](_0x430e14)[_0x77f3('0x46')](_0x22a069,_0x940c25);}function emitOutboundVoiceQueueSummary(_0x2ba8e2){if(_0x2ba8e2['type']===_0x77f3('0x47')){logger['debug'](_0x77f3('0x48'),util[_0x77f3('0x49')](_0x2ba8e2,{'showHidden':![],'depth':null}));emit(util[_0x77f3('0x4a')](_0x77f3('0x4b'),_0x2ba8e2[_0x77f3('0x4c')]),'voice_queue:save',_0x2ba8e2);}}function checkGetDataPredictive(_0x187727){if(isNotNull(_0x187727)&&!_[_0x77f3('0x4d')](_0x187727)){loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x4f'));loggerPredictive[_0x77f3('0x4e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x187727[_0x77f3('0x50')]);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x51'),_0x187727[_0x77f3('0x52')]);loggerPredictive[_0x77f3('0x4e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x187727[_0x77f3('0x53')]);loggerPredictive[_0x77f3('0x4e')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x187727[_0x77f3('0x54')]);loggerPredictive['info'](_0x77f3('0x55'),_0x187727[_0x77f3('0x56')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x187727[_0x77f3('0x57')]);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x58'));if(_0x187727[_0x77f3('0x50')]>0x0){if(!_[_0x77f3('0x45')](_0x187727['predictiveIntervalAvgTalktime'])&&_0x187727[_0x77f3('0x57')]>0x0){return!![];}loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x59'));if(!_[_0x77f3('0x45')](_0x187727[_0x77f3('0x56')])&&_0x187727[_0x77f3('0x56')]>0x0){return!![];}loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x5a'));}else{loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x5b'));}}else{loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x5c'));}return![];}function mergeDataErlangB(_0x578390){return function(_0x36b711){loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x5d'));loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x5e'),_0x36b711[_0x77f3('0x5f')]);loggerPredictive['info'](_0x77f3('0x60'),_0x36b711[_0x77f3('0x61')]);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x62'),_0x36b711[_0x77f3('0x63')]);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x64'),_0x36b711[_0x77f3('0x65')]);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x62'),_0x36b711[_0x77f3('0x63')]);loggerPredictive[_0x77f3('0x4e')]('---------------------------');_[_0x77f3('0x66')](_0x578390,_0x36b711);};}function ifInterval(_0x4b5582,_0x3b980e){if(_[_0x77f3('0x45')](_0x3b980e)){return![];}return utils['getSeconds'](undefined,_0x3b980e)<_0x4b5582*0x3c;}function clearPredictiveAttributes(_0x5007fe){if(_0x5007fe[_0x77f3('0x67')]){_0x5007fe['startProgressive']=undefined;loggerPredictive[_0x77f3('0x68')](_0x5007fe[_0x77f3('0x4c')],_0x77f3('0x69'));}if(_0x5007fe['startPredictive']){_0x5007fe[_0x77f3('0x6a')]=undefined;loggerPredictive[_0x77f3('0x68')](_0x5007fe[_0x77f3('0x4c')],_0x77f3('0x6b'));}if(_0x5007fe[_0x77f3('0x6c')]){clearInterval(_0x5007fe[_0x77f3('0x6c')]);_0x5007fe[_0x77f3('0x6c')]=undefined;loggerPredictive[_0x77f3('0x68')](_0x5007fe[_0x77f3('0x4c')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x207226,_0x23c4bd){return function(_0x496e15){loggerPredictive['error'](_0x23c4bd[_0x77f3('0x4c')],_0x207226);loggerPredictive['error'](_0x496e15[_0x77f3('0x6d')]);clearPredictiveAttributes(_0x23c4bd);};}function loggerCatch(_0x534e53){return function(_0xb9bdb0){logger['error'](_0x534e53,util[_0x77f3('0x49')](_0xb9bdb0,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x38820c,_0x5c599e,_0x1aa7a7){return function(_0x1170bc){utils[_0x77f3('0x6e')](_0x5c599e,_0x1aa7a7,0x0);logger[_0x77f3('0x6f')](_0x38820c,util[_0x77f3('0x49')](_0x1170bc,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x14f29b){return function(_0x276f0e){if(isNotNull(_0x276f0e)&&isNotNull(_0x276f0e[0x0])){if(_0x276f0e[0x0][_0x77f3('0x70')]>0x0){_0x14f29b[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x73')];logger[_0x77f3('0x4e')](_0x77f3('0x74')+_0x14f29b[_0x77f3('0x4c')],_0x276f0e[0x0][_0x77f3('0x70')],_0x77f3('0x75'));}else{_0x14f29b[_0x77f3('0x71')]=utils['CAMPAIGN_STATUS'][_0x77f3('0x76')];logger[_0x77f3('0x4e')](_0x77f3('0x77')+_0x14f29b[_0x77f3('0x4c')]);}}};}function createObjHistory(_0x32c0f7,_0x2c4bd3,_0x22acca,_0x3a10e9,_0x4c489d){_0x32c0f7[_0x77f3('0x71')]=_0x22acca;var _0x2a04f2=new Action(_0x32c0f7,_0x2c4bd3);var _0x4a76da=new History(_0x2a04f2);_0x4a76da[_0x77f3('0x78')]=_0x3a10e9;_0x4a76da[_0x77f3('0x79')]=_0x4c489d;_0x4a76da[_0x77f3('0x7a')]=_0x2a04f2[_0x77f3('0x7b')];return _0x4a76da;}function unlockQueueStatus(_0x13da1d,_0x151433){setTimeout(function(){if(_[_0x77f3('0x45')](_0x13da1d[_0x77f3('0x7c')])){loggerBooked[_0x77f3('0x6f')](_0x77f3('0x7d'),_0x151433);}_0x13da1d['queueStatusComplete']=!![];loggerBooked[_0x77f3('0x4e')](_0x77f3('0x7e'),_0x151433,JSON[_0x77f3('0x7f')](_[_0x77f3('0x80')](_0x13da1d,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0x7462ee){return function(){if(!isNotNull(_0x7462ee['Interval'])){_0x7462ee[_0x77f3('0x71')]=utils[_0x77f3('0x72')]['NULL_INTERVAL'];throw _0x7462ee['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x7462ee['Interval']['Intervals'])){_0x7462ee[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x81')];throw _0x7462ee[_0x77f3('0x4c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x7462ee[_0x77f3('0x82')][_0x77f3('0x83')]))){_0x7462ee[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x81')];throw _0x7462ee[_0x77f3('0x4c')]+_0x77f3('0x84');}};}function checkIsIVRCampaignActive(_0x49552e){return function(){if(!utils[_0x77f3('0x85')](_0x49552e)){_0x49552e[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x86')];throw _0x49552e[_0x77f3('0x4c')]+_0x77f3('0x87');}};}function emitCampaignSummary(_0x357290){if(utils['isIVRCampaign'](_0x357290)){emit(util[_0x77f3('0x4a')](_0x77f3('0x88'),_0x357290['name']),_0x77f3('0x89'),_0x357290);}}function loggerCatchQueueSummary(_0x1c1da7,_0x526f0c){return function(_0x57aab4){clearPredictiveAttributes(_0x526f0c);emitCampaignSummary(_0x526f0c);loggerSyncQueueSummary['debug'](_0x1c1da7,util[_0x77f3('0x49')](_0x57aab4,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x6e47b2){if(_0x6e47b2['sendMessageOneNotActive']){if(_0x6e47b2['originated']===0x0){_0x6e47b2[_0x77f3('0x8a')]=![];_0x6e47b2[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x86')];loggerSyncQueueSummary[_0x77f3('0x68')](_0x77f3('0x8b'),_0x6e47b2[_0x77f3('0x4c')],_0x77f3('0x8c'));}else{_0x6e47b2[_0x77f3('0x71')]=utils[_0x77f3('0x72')]['DISACTIVED'];loggerSyncQueueSummary[_0x77f3('0x68')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x6e47b2[_0x77f3('0x4c')],_0x77f3('0x8d'));}emitCampaignSummary(_0x6e47b2);}}function myreject(_0x3220ea){return function(_0x2d3951){return _0x3220ea(msgResponse(_0x77f3('0x8e'),_0x77f3('0x8f'),JSON[_0x77f3('0x7f')](_0x2d3951)));};}Dialer[_0x77f3('0x90')]['isTrunkReachable']=function(_0x3f94fa){return!_['isUndefined'](_0x3f94fa)&&_0x3f94fa&&!_[_0x77f3('0x45')](_0x3f94fa['name'])&&!_['isUndefined'](_0x3f94fa[_0x77f3('0x91')])&&_0x3f94fa['active']&&(this[_0x77f3('0x21')][util[_0x77f3('0x4a')](_0x77f3('0x92'),_0x3f94fa[_0x77f3('0x4c')])][_0x77f3('0x93')]===_0x77f3('0x94')||this[_0x77f3('0x21')][util['format']('SIP/%s',_0x3f94fa[_0x77f3('0x4c')])][_0x77f3('0x93')]===_0x77f3('0x95'));};Dialer[_0x77f3('0x90')][_0x77f3('0x96')]=function(_0x48efdb){var _0x59bdad=this;return function(){if(!_0x59bdad[_0x77f3('0x97')](_0x48efdb['Trunk'])){if(!_0x59bdad[_0x77f3('0x97')](_0x48efdb[_0x77f3('0x98')])){_0x48efdb[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x99')];throw _0x48efdb['name']+_0x77f3('0x9a');}}};};Dialer[_0x77f3('0x90')][_0x77f3('0x9b')]=function(_0x934dfb,_0x2fb5b6,_0x2064b4,_0x212017){var _0x46aabe=this;return function(){var _0x3fe874=!![];return _0x46aabe[_0x77f3('0x9c')](_0x934dfb,_0x2fb5b6,_0x2064b4,_0x212017,_0x3fe874);};};Dialer[_0x77f3('0x90')]['checkIfTimeIntervals']=function(_0x18e5de,_0x25f66a,_0x47387a,_0xf58cc3){var _0x338ae2=this;return function(){var _0x3934f6=![];return _0x338ae2['ifTimeIvr'](_0x18e5de[_0x77f3('0x83')],_0x25f66a,_0x47387a,_0xf58cc3,_0x3934f6);};};Dialer[_0x77f3('0x90')][_0x77f3('0x9c')]=function(_0x592757,_0x500ec7,_0x1a0d46,_0x475a0c,_0x377d89){var _0x18c7cc=[];return new Promise(function(_0x2b7ca6,_0x2abcfa){if(!isNotNull(_0x592757)){_0x475a0c['message']=utils[_0x77f3('0x72')][_0x77f3('0x81')];return _0x2abcfa(msgResponse('ifTime','Failure',_0x1a0d46+_0x77f3('0x9d')));}if(_[_0x77f3('0x4d')](_0x592757)){_0x475a0c[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x9e')];return _0x2abcfa(msgResponse(_0x77f3('0x9f'),_0x77f3('0xa0'),_0x1a0d46+'\x20Intervals\x20is\x20empty\x20'));}if(_0x500ec7&&_[_0x77f3('0x45')](config[_0x77f3('0xa1')][_0x500ec7])){_0x475a0c[_0x77f3('0x71')]=utils[_0x77f3('0x72')]['UNKNOWN_TIMEZONE'];return _0x2abcfa(msgResponse('ifTime',_0x77f3('0xa0'),_0x1a0d46+'\x20Timezone\x20unknow\x20'+_0x500ec7));}if(_[_0x77f3('0xa2')](_0x592757)){for(var _0x234ed3=0x0;_0x234ed3<_0x592757['length'];_0x234ed3+=0x1){_0x18c7cc['push'](ami['Action']({'action':_0x77f3('0xa3'),'command':util[_0x77f3('0x4a')](_0x77f3('0xa4'),_0x592757[_0x234ed3][_0x77f3('0xa5')],!_[_0x77f3('0x45')](config[_0x77f3('0xa1')][_0x500ec7])?_0x500ec7:'')})[_0x77f3('0x43')](function(_0x18a4b1){return _0x18a4b1[_0x77f3('0xa6')][_0x77f3('0xa7')]('true')>=0x0;})[_0x77f3('0xa8')](myreject(_0x2abcfa)));}}else{_0x18c7cc['push'](ami[_0x77f3('0xa9')]({'action':_0x77f3('0xa3'),'command':util['format']('iftime\x20%s,%s',_0x592757,!_[_0x77f3('0x45')](config[_0x77f3('0xa1')][_0x500ec7])?_0x500ec7:'')})[_0x77f3('0x43')](function(_0x578b7f){return _0x578b7f['content'][_0x77f3('0xa7')](_0x77f3('0xaa'))>=0x0;})['catch'](myreject(_0x2abcfa)));}Promise[_0x77f3('0xab')](_0x18c7cc)[_0x77f3('0x43')](function(_0x561e41){var _0x3a58a7=_[_0x77f3('0xac')](_0x561e41);if(_0x3a58a7){return _0x2b7ca6(_0x3a58a7);}else{_0x475a0c[_0x77f3('0x71')]=_0x377d89?utils[_0x77f3('0x72')][_0x77f3('0xad')]:utils[_0x77f3('0x72')][_0x77f3('0xae')];return _0x2abcfa(msgResponse('[ifTime][promiseAll]',_0x77f3('0xa0'),'Global:\x20'+_0x377d89+'\x20'+_0x1a0d46+_0x77f3('0xaf')+util['inspect'](_0x592757,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x500ec7));}})['catch'](function(_0x556140){return _0x2abcfa(msgResponse('ifTime',_0x77f3('0xa0'),JSON[_0x77f3('0x7f')](_0x556140)));});});};Dialer['prototype'][_0x77f3('0x40')]=function(){var _0x2efb40=this;return cmHopper[_0x77f3('0xb0')]({'active':![]},{'where':{'active':!![]}})[_0x77f3('0x43')](function(){setInterval(function(){_0x2efb40[_0x77f3('0xb1')]();},0x3e8);});};Dialer[_0x77f3('0x90')][_0x77f3('0xb1')]=function(){var _0x1eb01b=this;var _0x534ab5;for(var _0x346622 in this['campaigns']){if(typeof this['campaigns'][_0x346622]!==_0x77f3('0xb2')){_0x534ab5=this[_0x77f3('0x1f')][_0x346622];if(utils[_0x77f3('0xb3')](_0x534ab5)&&utils[_0x77f3('0x85')](_0x534ab5)){_0x534ab5[_0x77f3('0x8a')]=!![];Promise[_0x77f3('0xb4')]()[_0x77f3('0x43')](checkIsIVRCampaignActive(_0x534ab5))[_0x77f3('0x43')](checkInterval(_0x534ab5))[_0x77f3('0x43')](_0x1eb01b[_0x77f3('0x96')](_0x534ab5))[_0x77f3('0x43')](_0x1eb01b[_0x77f3('0x9b')](_0x534ab5[_0x77f3('0xb5')],_0x534ab5[_0x77f3('0xb6')],_0x534ab5['name'],_0x534ab5))[_0x77f3('0x43')](_0x1eb01b[_0x77f3('0xb7')](_0x534ab5['Interval'],_0x534ab5[_0x77f3('0xb6')],_0x534ab5[_0x77f3('0x4c')],_0x534ab5))[_0x77f3('0x43')](_0x1eb01b[_0x77f3('0xb8')](_0x534ab5))[_0x77f3('0xa8')](loggerCatchQueueSummary('[syncCampaigns]',_0x534ab5));}else{notSendMessagesCampaign(_0x534ab5);}}}};Dialer['prototype'][_0x77f3('0xb9')]=function(_0x363935){if(_0x363935[_0x77f3('0xba')]!==_0x77f3('0xb')){clearPredictiveAttributes(_0x363935);}switch(_0x363935[_0x77f3('0xba')]){case _0x77f3('0xbb'):this[_0x77f3('0xbc')](_0x363935,0x1);break;case _0x77f3('0xbd'):this[_0x77f3('0xbc')](_0x363935,_0x363935[_0x77f3('0xbe')]);break;case _0x77f3('0xb'):this[_0x77f3('0xb')](_0x363935);break;case _0x77f3('0xa'):this[_0x77f3('0xbc')](_0x363935,0x1);break;default:logger[_0x77f3('0x6f')](_0x77f3('0xbf'),_0x363935['name'],_0x77f3('0xc0'));}};Dialer[_0x77f3('0x90')]['ifTime']=function(_0x4b81cf,_0x503c42){var _0x533612=_0x4b81cf['dialTimezone'];var _0x42faed=_0x503c42?_0x4b81cf['dialGlobalInterval']:_0x4b81cf['Interval'][_0x77f3('0x83')];logger[_0x77f3('0xc1')](_0x77f3('0xc2'),_0x42faed,_0x533612,_0x4b81cf[_0x77f3('0x4c')],util[_0x77f3('0x4a')](_0x77f3('0xc3'),_0x4b81cf['name'],_0x4b81cf['id']));var _0x47052c=null;return Interval[_0x77f3('0xc4')](_0x42faed,_0x533612)[_0x77f3('0x43')](function(_0x45b58a){if(_0x45b58a===!![]){return _0x45b58a;}else{_0x4b81cf['message']=_0x503c42?utils['CAMPAIGN_STATUS'][_0x77f3('0xad')]:utils[_0x77f3('0x72')]['OVERTIME_INTERVAL'];_0x47052c=msgResponse(_0x77f3('0xc5'),_0x77f3('0xa0'),_0x77f3('0xc6')+_0x503c42+'\x20'+_0x4b81cf[_0x77f3('0x4c')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x77f3('0x49')](_0x42faed,{'showHidden':![],'depth':null})+_0x77f3('0xc7')+_0x533612);}if(_0x47052c!==null){logger[_0x77f3('0xc1')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x47052c);_0x47052c[_0x77f3('0xc8')]=_0x503c42;throw _0x47052c;}})[_0x77f3('0xa8')](function(_0x3e8d86){logger[_0x77f3('0x6f')]('AMI\x20IfTime',_0x3e8d86);throw msgResponse('[ifTime][Action]',_0x77f3('0x8f'),util[_0x77f3('0x49')](_0x3e8d86,{'showHidden':![],'depth':null}));});};Dialer[_0x77f3('0x90')][_0x77f3('0x2b')]=function(_0x3cfa6f){if(this['voiceQueues'][_0x3cfa6f[_0x77f3('0xc9')]]){if(this[_0x77f3('0x26')][_0x3cfa6f[_0x77f3('0xca')]]&&this[_0x77f3('0x26')][_0x3cfa6f[_0x77f3('0xca')]]['type']!==_0x77f3('0xcb')){this[_0x77f3('0xcc')](this[_0x77f3('0x1e')][_0x3cfa6f[_0x77f3('0xc9')]]);this['uniqueId'][_0x3cfa6f[_0x77f3('0xca')]][_0x77f3('0xcd')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));}}};Dialer[_0x77f3('0x90')]['syncAgentComplete']=function(_0xed0fb7){var _0x29b71c=this[_0x77f3('0x26')][_0xed0fb7[_0x77f3('0xca')]];if(this[_0x77f3('0x1e')][_0xed0fb7['queue']]){if(_0x29b71c&&_0x29b71c['type']!==_0x77f3('0xcb')){delete this[_0x77f3('0x26')][_0xed0fb7[_0x77f3('0xca')]];this[_0x77f3('0x1e')][_0xed0fb7[_0x77f3('0xc9')]][_0x77f3('0xcf')]+=0x1;var _0x14f3d1=new AgentComplete(_0x29b71c,_0xed0fb7);if(_0xed0fb7[_0x77f3('0xd0')]===_0x77f3('0xd1')){_0x14f3d1[_0x77f3('0xd2')]=this['voiceQueues'][_0xed0fb7['queue']]['dialQueueProject2']&&this[_0x77f3('0x1e')][_0xed0fb7[_0x77f3('0xc9')]]['dialAgiAfterHangupAgent']?moment()[_0x77f3('0x4a')](_0x77f3('0xce')):undefined;}hopperUtils[_0x77f3('0xd3')](_0x14f3d1)[_0x77f3('0xa8')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x77f3('0xd4')](_0x14f3d1)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0xd5')));}}};Dialer[_0x77f3('0x90')][_0x77f3('0x2e')]=function(_0x33bc6f){var _0x2d27b7=this['uniqueId'][_0x33bc6f[_0x77f3('0xca')]];var _0x5d014e=this;var _0x59b083=![];var _0x2bc91e;var _0x38fe1b;if(this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]]){if(_0x2d27b7&&_0x2d27b7[_0x77f3('0xd6')]!=='ivr'){delete this[_0x77f3('0x26')][_0x33bc6f[_0x77f3('0xca')]];this[_0x77f3('0xcc')](this['voiceQueues'][_0x33bc6f[_0x77f3('0xc9')]]);_0x2d27b7[_0x77f3('0xd7')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));var _0x272d80=new QueueCallerAbandon(_0x2d27b7,_0x33bc6f);if(utils[_0x77f3('0xd8')](_0x2d27b7['droptime'],_0x2d27b7[_0x77f3('0xd9')])>=_0x2d27b7[_0x77f3('0xda')]){this[_0x77f3('0x1e')][_0x33bc6f['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xdb')]+=0x1;this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x272d80[_0x77f3('0x78')]=0xa;_0x272d80['statedesc']=_0x77f3('0xdc');_0x272d80['dropreason']=_0x77f3('0xdd');_0x272d80['agiafterat']=this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]]['dialQueueProject2']?moment()[_0x77f3('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x272d80[_0x77f3('0xde')]+=0x1;_0x272d80[_0x77f3('0xdf')]+=0x1;_0x2bc91e=this[_0x77f3('0x1e')][_0x33bc6f['queue']]['dialDropRetryFrequency'];_0x38fe1b=this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xe0')];hopperUtils['verifyAdditionalPhones'](_0x272d80,_0x272d80[_0x77f3('0x78')],_0x2d27b7[_0x77f3('0xe1')])[_0x77f3('0x43')](function(_0x4cba4b){_0x59b083=_0x4cba4b[_0x77f3('0xe2')]==0x1;if(_0x272d80['countdropretry']>=_0x5d014e[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xe3')]){_0x5d014e[_0x77f3('0xe4')](_0x272d80,_0x4cba4b[_0x77f3('0xe2')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x272d80[_0x77f3('0xde')],'scheduledat':moment()[_0x77f3('0xe5')](_0x5d014e[_0x77f3('0x1e')][_0x33bc6f['queue']]['dialDropRetryFrequency'],_0x77f3('0xe6'))[_0x77f3('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d27b7['ContactId'],'ListId':_0x2d27b7[_0x77f3('0xe7')],'VoiceQueueId':_0x2d27b7[_0x77f3('0xe8')]||undefined,'CampaignId':_0x2d27b7[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact][Drop]'));var _0x42d420=new History(_0x272d80);_0x42d420['state']=0xa;_0x42d420[_0x77f3('0x79')]='Drop';_0x42d420[_0x77f3('0x7b')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));_0x42d420[_0x77f3('0x7a')]=_0x42d420[_0x77f3('0x7b')];_0x42d420['calleridname']=_0x272d80[_0x77f3('0xea')];_0x42d420[_0x77f3('0xeb')]=_0x272d80[_0x77f3('0xeb')];hopperUtils[_0x77f3('0xd3')](_0x42d420)[_0x77f3('0xa8')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x77f3('0x43')](function(){if(_0x59b083)hopperUtils[_0x77f3('0xec')](_0x272d80,_0x2bc91e,_0x38fe1b)[_0x77f3('0x43')](function(){return 0x1;});});}else{this['voiceQueues'][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0x54')]+=0x1;this[_0x77f3('0x1e')][_0x33bc6f['queue']][_0x77f3('0xed')]+=0x1;_0x272d80[_0x77f3('0x78')]=0xb;_0x272d80[_0x77f3('0x79')]='Abandoned';_0x272d80[_0x77f3('0xee')]='CALLEREXIT';_0x272d80[_0x77f3('0xef')]+=0x1;_0x272d80[_0x77f3('0xdf')]+=0x1;_0x2bc91e=this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xf0')];_0x38fe1b=this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xe0')];hopperUtils[_0x77f3('0xf1')](_0x272d80,_0x272d80[_0x77f3('0x78')],_0x2d27b7[_0x77f3('0xe1')])[_0x77f3('0x43')](function(_0x2e78fa){if(_0x272d80['countabandonedretry']>=_0x5d014e['voiceQueues'][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xf2')]){_0x5d014e['queueCallerAbandonCreateState'](_0x272d80,_0x2e78fa[_0x77f3('0xe2')]);}else{hopperUtils[_0x77f3('0xf3')]({'active':![],'countabandonedretry':_0x272d80[_0x77f3('0xef')],'scheduledat':moment()[_0x77f3('0xe5')](_0x5d014e[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]]['dialAbandonedRetryFrequency'],'minutes')[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x2d27b7[_0x77f3('0xf4')],'ListId':_0x2d27b7[_0x77f3('0xe7')],'VoiceQueueId':_0x2d27b7[_0x77f3('0xe8')]||undefined,'CampaignId':_0x2d27b7['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x204c2c=new History(_0x272d80);_0x204c2c['state']=0xb;_0x204c2c[_0x77f3('0x79')]=_0x77f3('0xf5');_0x204c2c[_0x77f3('0x7b')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));_0x204c2c[_0x77f3('0x7a')]=_0x204c2c[_0x77f3('0x7b')];_0x204c2c[_0x77f3('0xea')]=_0x272d80['calleridname'];_0x204c2c[_0x77f3('0xeb')]=_0x272d80[_0x77f3('0xeb')];hopperUtils[_0x77f3('0xd3')](_0x204c2c)['catch'](loggerCatch(_0x77f3('0xf6')));}})[_0x77f3('0x43')](function(){if(_0x59b083)hopperUtils[_0x77f3('0xec')](_0x272d80,_0x2bc91e,_0x38fe1b)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x77f3('0x39')]=function(_0x65494b){if(this[_0x77f3('0x24')][_0x65494b[_0x77f3('0xca')]]){this[_0x77f3('0x24')][_0x65494b[_0x77f3('0xca')]]['channel']=_0x65494b[_0x77f3('0xf7')];}if(this[_0x77f3('0x26')][_0x65494b[_0x77f3('0xca')]]){this['uniqueId'][_0x65494b['uniqueid']][_0x77f3('0xf7')]=_0x65494b[_0x77f3('0xf7')];}};Dialer[_0x77f3('0x90')][_0x77f3('0x3d')]=function(_0x492977){if(!this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]]){return;}var _0x3a83ce=this[_0x77f3('0x1e')][this[_0x77f3('0x24')][_0x492977['actionid']]['queue']]['strategy']||'rrmemory';if(_0x3a83ce==='roundrobin'){if(this['actions'][_0x492977[_0x77f3('0xf8')]]&&_['isNil'](this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xf9')])&&_0x492977[_0x77f3('0x93')]==='1'&&_0x492977[_0x77f3('0xfa')]==='0'){if(this[_0x77f3('0x20')][_0x492977[_0x77f3('0xfb')]]){if(!this['agents'][_0x492977[_0x77f3('0xfb')]]['locked']){this['agents'][_0x492977[_0x77f3('0xfb')]][_0x77f3('0xf9')]=!![];this['actions'][_0x492977['actionid']][_0x77f3('0xf9')]=!![];this['actions'][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xfb')]=_0x492977[_0x77f3('0xfb')];}}}}else if(_0x3a83ce===_0x77f3('0xfc')){if(this[_0x77f3('0x24')][_0x492977['actionid']]){if(this[_0x77f3('0x20')][_0x492977[_0x77f3('0xfb')]]){this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xfb')]=_0x492977[_0x77f3('0xfb')];if(_['isNil'](this[_0x77f3('0x29')][this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xc9')]])){this['queueBooked'][this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xc9')]]=[];}this['queueBooked'][this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xc9')]][_0x77f3('0xfd')](_[_0x77f3('0x66')](_['pick'](this['actions'][_0x492977[_0x77f3('0xf8')]],[_0x77f3('0xfe'),'stateinterface']),{'status':_0x492977['status'],'paused':_0x492977[_0x77f3('0xfa')]}));}}}};Dialer[_0x77f3('0x90')][_0x77f3('0x3f')]=function(_0x3cc9c1){if(!this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]){return;}var _0x583ce3=this;var _0x42da4c=this[_0x77f3('0x1e')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]['queue']];var _0x13b11a=_0x42da4c['strategy']||'rrmemory';if(_0x13b11a===_0x77f3('0xff')){if(this[_0x77f3('0x24')][_0x3cc9c1['actionid']]&&this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xfb')]){this[_0x77f3('0x1d')]['run'](this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xfe')],this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xfb')])[_0x77f3('0xa8')](function(_0xa47fc2){logger[_0x77f3('0x6f')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0xa47fc2,{'showHidden':![],'depth':null}));})[_0x77f3('0x1b')](function(){_0x583ce3[_0x77f3('0xcc')](_0x583ce3[_0x77f3('0x1e')][_0x583ce3[_0x77f3('0x24')][_0x3cc9c1['actionid']]['queue']]);_0x583ce3[_0x77f3('0x20')][_0x583ce3[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xfb')]][_0x77f3('0xf9')]=![];delete _0x583ce3['actions'][_0x3cc9c1[_0x77f3('0xf8')]];unlockQueueStatus(_0x42da4c);});}else{this[_0x77f3('0xcc')](this[_0x77f3('0x1e')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xc9')]]);hopperUtils[_0x77f3('0xf3')]({'active':![],'ContactId':this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]['ContactId'],'ListId':this['actions'][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xe7')],'VoiceQueueId':this['actions'][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xe8')]||undefined,'CampaignId':this['actions'][_0x3cc9c1['actionid']][_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x100')));delete this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]];unlockQueueStatus(_0x42da4c);}}else if(_0x13b11a===_0x77f3('0xfc')){var _0x12c1bc;if(this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]&&!_[_0x77f3('0x4d')](this[_0x77f3('0x29')][this['actions'][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xc9')]])){if(this[_0x77f3('0x101')][_0x583ce3['actions'][_0x3cc9c1[_0x77f3('0xf8')]]['queue']]){this[_0x77f3('0x101')][_0x583ce3[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]['queue']]=this[_0x77f3('0x101')][this['actions'][_0x3cc9c1['actionid']][_0x77f3('0xc9')]]?this[_0x77f3('0x101')][this[_0x77f3('0x24')][_0x3cc9c1['actionid']][_0x77f3('0xc9')]]:this[_0x77f3('0x29')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]['queue']]?this[_0x77f3('0x29')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xc9')]][_0x77f3('0x102')]||0x0:0x0;}this[_0x77f3('0x29')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]['queue']][_0x77f3('0x102')]=this[_0x77f3('0x101')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xc9')]];for(var _0xc71861=0x0;_0xc71861=_0x2eb36c[_0x77f3('0x129')]){_0x54bf70['stateGlobal'](_0x5cb990,_0x3cf55f,_0xc8af5d,_0x77f3('0x12a'));}else{if(_0x5cb990['countmachineretry']>=_0x2eb36c[_0x77f3('0x12b')]){_0x54bf70['createStateFinal'](_0x5cb990,_0x3cf55f,_0xc8af5d,_0x77f3('0x12c'));}else{hopperUtils[_0x77f3('0xf3')]({'active':![],'countmachineretry':_0x5cb990[_0x77f3('0x123')],'scheduledat':moment()[_0x77f3('0xe5')](_0x2eb36c[_0x77f3('0x12d')],'minutes')['format'](_0x77f3('0xce')),'ContactId':_0x5cb990[_0x77f3('0xf4')],'ListId':_0x5cb990[_0x77f3('0xe7')],'VoiceQueueId':_0x5cb990[_0x77f3('0xe8')]||undefined,'CampaignId':_0x5cb990[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact][Machine]'));_0x3cf55f({'reschedule':0x1});}}});}if(_0x48e07a[_0x77f3('0xd6')]===_0x77f3('0xcb')&&this[_0x77f3('0x1f')][_0x48e07a[_0x77f3('0xc9')]][_0x77f3('0x118')]&&_0x44593d[_0x77f3('0x12e')]===_0x77f3('0x119')){delete this[_0x77f3('0x26')][_0x44593d[_0x77f3('0xca')]];this[_0x77f3('0xcc')](this[_0x77f3('0x1f')][_0x48e07a['queue']]);_0x1d448f=new Hangup(_0x48e07a,_0x44593d);_0x1d448f[_0x77f3('0x78')]=0x12;_0x1d448f[_0x77f3('0x79')]=_0x77f3('0x11a');_0x1d448f[_0x77f3('0x11b')]=_0x77f3('0x122');ami['emit'](_0x77f3('0x11c'),ut[_0x77f3('0x125')](_0x1d448f,_0x77f3('0x124')));this[_0x77f3('0x11d')](_0x1d448f,_0x77f3('0x12f'),_0x77f3('0x130'));}if(_0x48e07a['type']==='ivr'&&this['campaigns'][_0x48e07a[_0x77f3('0xc9')]]['dialAMDActive']&&_0x44593d[_0x77f3('0x12e')]===_0x77f3('0x11f')){return new Promise(function(_0x398b5a,_0x188320){delete _0x54bf70[_0x77f3('0x26')][_0x44593d[_0x77f3('0xca')]];_0x54bf70[_0x77f3('0xcc')](_0x54bf70[_0x77f3('0x1f')][_0x48e07a[_0x77f3('0xc9')]]);_0x54bf70[_0x77f3('0x1f')][_0x48e07a['queue']][_0x77f3('0xcf')]+=0x1;_0x54bf70['campaigns'][_0x48e07a[_0x77f3('0xc9')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3d42fd=_0x54bf70[_0x77f3('0x1f')][_0x48e07a[_0x77f3('0xc9')]];var _0x43005e=new Hangup(_0x48e07a,_0x44593d);_0x43005e[_0x77f3('0x78')]=0x13;_0x43005e[_0x77f3('0x79')]='Machine';_0x43005e[_0x77f3('0x11b')]=_0x77f3('0x122');_0x43005e[_0x77f3('0x123')]+=0x1;_0x43005e['countglobal']+=0x1;_0x43005e['amd']=!![];ami[_0x77f3('0x46')](_0x77f3('0x11c'),ut[_0x77f3('0x125')](_0x43005e,_0x77f3('0x124')));hopperUtils[_0x77f3('0xd3')](_0x43005e)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x126')));if(_0x43005e['countbusyretry']+_0x43005e[_0x77f3('0x131')]+_0x43005e[_0x77f3('0x132')]+_0x43005e['countnosuchnumberretry']+_0x43005e[_0x77f3('0xde')]+_0x43005e[_0x77f3('0xef')]+_0x43005e[_0x77f3('0x123')]+_0x43005e[_0x77f3('0x128')]>=_0x3d42fd[_0x77f3('0x129')]){_0x54bf70['stateGlobal'](_0x43005e,_0x398b5a,_0x188320,_0x77f3('0x12a'));}else{if(_0x43005e['countmachineretry']>=_0x3d42fd[_0x77f3('0x12b')]){_0x54bf70[_0x77f3('0x133')](_0x43005e,_0x398b5a,_0x188320,_0x77f3('0x12c'));}else{hopperUtils[_0x77f3('0xf3')]({'active':![],'countmachineretry':_0x43005e[_0x77f3('0x123')],'scheduledat':moment()[_0x77f3('0xe5')](_0x3d42fd[_0x77f3('0x12d')],_0x77f3('0xe6'))[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x43005e[_0x77f3('0xf4')],'ListId':_0x43005e['ListId'],'VoiceQueueId':_0x43005e[_0x77f3('0xe8')]||undefined,'CampaignId':_0x43005e['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact][Machine]'));_0x398b5a({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x77f3('0x37')]=function(_0x1b3b34){var _0x19be2c=this[_0x77f3('0x26')][_0x1b3b34[_0x77f3('0xca')]];var _0x1c1c4a;if(_0x19be2c&&_0x19be2c['type']===_0x77f3('0xcb')){delete this[_0x77f3('0x26')][_0x1b3b34[_0x77f3('0xca')]];this[_0x77f3('0xcc')](this['campaigns'][_0x19be2c[_0x77f3('0xc9')]]);this[_0x77f3('0x1f')][_0x19be2c['queue']][_0x77f3('0x134')]+=0x1;_0x1c1c4a=new Hangup(_0x19be2c,_0x1b3b34);hopperUtils['createHistory'](_0x1c1c4a)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x135')));hopperUtils[_0x77f3('0xd4')](_0x1c1c4a)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x136')));}if(_0x19be2c&&_0x19be2c['type']!==_0x77f3('0xcb')&&isNotNull(this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]][_0x77f3('0x137')])){delete this[_0x77f3('0x26')][_0x1b3b34[_0x77f3('0xca')]];this['updateOriginated'](this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]]);this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]][_0x77f3('0xcf')]+=0x1;this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]][_0x77f3('0x120')]+=0x1;_0x1c1c4a=new Hangup(_0x19be2c,_0x1b3b34);_0x1c1c4a[_0x77f3('0x78')]=0x10;_0x1c1c4a[_0x77f3('0x79')]=_0x77f3('0x138');_0x1c1c4a['membername']=_0x77f3('0x139');hopperUtils[_0x77f3('0xd3')](_0x1c1c4a)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x1c1c4a)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x136')));}if(_0x19be2c&&_0x19be2c[_0x77f3('0xd6')]!==_0x77f3('0xcb')&&!isNotNull(this['voiceQueues'][_0x19be2c['queue']][_0x77f3('0x137')])){delete this['uniqueId'][_0x1b3b34[_0x77f3('0xca')]];this[_0x77f3('0xcc')](this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]]);this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]][_0x77f3('0x13a')]+=0x1;_0x1c1c4a=new Hangup(_0x19be2c,_0x1b3b34);_0x1c1c4a[_0x77f3('0x78')]=0xc;_0x1c1c4a['statedesc']=_0x1b3b34[_0x77f3('0x13b')];_0x1c1c4a[_0x77f3('0x11b')]=_0x77f3('0x13c');hopperUtils[_0x77f3('0xd3')](_0x1c1c4a)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x135')));hopperUtils['moveContactManagedDialer'](_0x1c1c4a)['catch'](loggerCatch(_0x77f3('0x136')));}};Dialer['prototype'][_0x77f3('0x34')]=function(_0xce0cb4){var _0x52da46=this;if(!_0x52da46['queuesSummary'][_0xce0cb4[_0x77f3('0x4c')]]){_0x52da46[_0x77f3('0x13d')][_0xce0cb4['name']]={'running':![]};}else if(_0x52da46[_0x77f3('0x13d')][_0xce0cb4['name']][_0x77f3('0x13e')]===!![]){return;}else if(_0x52da46[_0x77f3('0x13d')][_0xce0cb4[_0x77f3('0x4c')]][_0x77f3('0x13e')]===![]){_0x52da46['queuesSummary'][_0xce0cb4[_0x77f3('0x4c')]][_0x77f3('0x13e')]=!![];}var _0x441cba=_0x52da46['voiceQueues'][_0xce0cb4['name']];var _0x907927=_0x441cba[_0x77f3('0x71')]!==utils[_0x77f3('0x72')][_0x77f3('0x86')];var _0x498b9d=utils[_0x77f3('0x13f')](_0x441cba);_0x441cba['statusMessage']=utils[_0x77f3('0x140')](_0x441cba,_0x52da46['trunks']);Promise[_0x77f3('0xb4')]()[_0x77f3('0x43')](function(){if(_0x441cba[_0x77f3('0x141')]===utils[_0x77f3('0x72')][_0x77f3('0x86')]){if(_0x907927){clearPredictiveAttributes(_0x441cba);_0xce0cb4[_0x77f3('0x6a')]=undefined;_0xce0cb4[_0x77f3('0x67')]=undefined;}if(_0x441cba['statusMessage']===utils[_0x77f3('0x72')][_0x77f3('0x86')]){_0xce0cb4[_0x77f3('0x142')]=0x0;_0xce0cb4[_0x77f3('0xfa')]=0x0;_0xce0cb4[_0x77f3('0x143')]=0x0;_0xce0cb4[_0x77f3('0x144')]=0x0;_0xce0cb4[_0x77f3('0x145')]=0x0;}}else if(_0x441cba[_0x77f3('0x141')]===utils['CAMPAIGN_STATUS'][_0x77f3('0x146')]&&!_0x498b9d){return _0x52da46[_0x77f3('0x9f')](_0x441cba,!![])[_0x77f3('0x43')](function(){return _0x52da46[_0x77f3('0x9f')](_0x441cba,![]);})[_0x77f3('0x43')](function(){return _0x52da46[_0x77f3('0xb9')](_0x441cba);})[_0x77f3('0xa8')](function(_0x231b52){loggerSyncQueueSummary[_0x77f3('0x68')](_0x77f3('0x147'),util['inspect'](_0x231b52,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x441cba);});}else{clearPredictiveAttributes(_0x441cba);}})[_0x77f3('0x43')](function(){var _0x185854=_0xce0cb4['compareToOutboundQueue'](_0x441cba);if(_0x185854||_0x441cba[_0x77f3('0x148')]){_0x441cba[_0x77f3('0x148')]=![];_0xce0cb4[_0x77f3('0x149')](_0x441cba);Object[_0x77f3('0x14a')](_0x441cba,_0xce0cb4);emitOutboundVoiceQueueSummary(_0xce0cb4);}_0x52da46[_0x77f3('0x13d')][_0x441cba['name']][_0x77f3('0x13e')]=![];})[_0x77f3('0xa8')](function(_0x382fdd){logger[_0x77f3('0x6f')](_0x77f3('0x147'),util['inspect'](_0x382fdd,{'showHidden':![],'depth':null}));_0x52da46[_0x77f3('0x13d')][_0x441cba['name']]['running']=![];});};Dialer['prototype'][_0x77f3('0x36')]=_[_0x77f3('0x14b')](function(){var _0x303572=_[_0x77f3('0x14c')](this[_0x77f3('0x1e')],function(_0x17ea0b){return _0x17ea0b[_0x77f3('0x14d')];});var _0x2714a7=_[_0x77f3('0x14c')](this[_0x77f3('0x20')],function(_0x5154ef){return _0x5154ef[_0x77f3('0x14e')]&&_0x5154ef[_0x77f3('0x93')]===_0x77f3('0x94');});if(_0x303572[_0x77f3('0x103')]>0x0&&_0x2714a7['length']>0x0){return Promise['resolve']()[_0x77f3('0x43')](cmHopper[_0x77f3('0x14f')](_['map'](_0x303572,'id'),previewRecallmeReminderInterval,_[_0x77f3('0x150')](_0x2714a7,'id')))[_0x77f3('0x43')](function(_0x4a1502){for(var _0x1b1a35=0x0;_0x1b1a35<_0x4a1502[_0x77f3('0x103')];_0x1b1a35++){var _0x1e0ed9=_0x4a1502[_0x1b1a35][_0x77f3('0x151')]['name'];if(_0x1e0ed9)io['to'](util[_0x77f3('0x4a')](_0x77f3('0x152'),_0x1e0ed9))[_0x77f3('0x46')](_0x77f3('0x153'),{'hopper':_0x4a1502[_0x1b1a35]});}})['catch'](function(_0x3a5405){logger[_0x77f3('0x6f')](_0x77f3('0x154'),_0x3a5405);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x77f3('0x90')]['loopClearZombieChannels']=function(){var _0x408cab=this;setInterval(function(){_0x408cab[_0x77f3('0x155')](_0x408cab['uniqueId'],_0x77f3('0x156'));_0x408cab['clearZombieChannels'](_0x408cab[_0x77f3('0x24')],_0x77f3('0x157'));},0x32c8);};Dialer['prototype'][_0x77f3('0x155')]=function(_0x2edd04,_0x324f7f){var _0x4242f8=this;for(var _0x1276c3 in _0x2edd04){if(typeof _0x2edd04[_0x1276c3]!==_0x77f3('0xb2')){this[_0x77f3('0x1c')][_0x77f3('0x19')](function(){if(!_[_0x77f3('0x106')](_0x2edd04[_0x1276c3])){return ami[_0x77f3('0xa9')]({'action':'status','channel':_0x2edd04[_0x1276c3][_0x77f3('0xf7')]})[_0x77f3('0xa8')](function(_0x45df39){if(_0x45df39['message']===_0x77f3('0x158')){setTimeout(function(){if(_0x2edd04[_0x1276c3]&&_0x2edd04[_0x1276c3][_0x77f3('0xd6')]!==_0x77f3('0xcb')){_0x4242f8[_0x77f3('0xcc')](_0x4242f8[_0x77f3('0x1e')][_0x2edd04[_0x1276c3]['queue']]);logger[_0x77f3('0x6f')](_0x77f3('0x159'),_0x324f7f,_0x1276c3,_0x2edd04[_0x1276c3][_0x77f3('0xc9')]);delete _0x2edd04[_0x1276c3];}if(_0x2edd04[_0x1276c3]&&_0x2edd04[_0x1276c3][_0x77f3('0xd6')]==='ivr'){_0x4242f8[_0x77f3('0xcc')](_0x4242f8[_0x77f3('0x1f')][_0x2edd04[_0x1276c3][_0x77f3('0xc9')]]);logger[_0x77f3('0x6f')]('[Dialer][checkChannel][ivr]',_0x324f7f,_0x1276c3,_0x2edd04[_0x1276c3]['queue']);delete _0x2edd04[_0x1276c3];}},0x2328);}});}});}}};Dialer['prototype'][_0x77f3('0x15a')]=function(_0x4320da){return Promise[_0x77f3('0xb4')]()['then'](voiceQueueRt[_0x77f3('0x15a')](_0x4320da))['catch'](loggerCatch(_0x77f3('0x15b')));};Dialer['prototype'][_0x77f3('0xcc')]=function(_0xe162e5){if(!_[_0x77f3('0x45')](_0xe162e5)&&_0xe162e5!==null){if(typeof _0xe162e5[_0x77f3('0x15c')]!==_0x77f3('0xb2')){if(_0xe162e5[_0x77f3('0x15c')]>0x0){_0xe162e5[_0x77f3('0x15c')]-=0x1;}else{logger[_0x77f3('0x6f')](_0x77f3('0x15d'));}}}else{logger[_0x77f3('0x6f')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x77f3('0x90')][_0x77f3('0x15e')]=function(_0x17b327,_0x18865e){var _0x14d657=this;return function(_0x283a2a){_0x14d657[_0x77f3('0xcc')](_0x18865e);logger['error'](_0x17b327,util[_0x77f3('0x49')](_0x283a2a,{'showHidden':![],'depth':null}));};};Dialer[_0x77f3('0x90')][_0x77f3('0x15f')]=function(_0x564b65,_0x22fd52,_0x3bb2f7){var _0x188041={'state':0x19,'statedesc':'notFound'};this[_0x77f3('0xcc')](_0x22fd52);this[_0x77f3('0x11d')](_[_0x77f3('0x66')](_0x188041,_[_0x77f3('0x80')](_0x3bb2f7,[_0x77f3('0xf4'),'ListId',_0x77f3('0x160'),_0x77f3('0xe8'),_0x77f3('0xe9')])),_0x77f3('0x161'),'[emptyContact]');logger[_0x77f3('0x6f')](_0x564b65);};Dialer[_0x77f3('0x90')][_0x77f3('0x11d')]=function(_0x109c38,_0x3d389b,_0x4dadde){hopperUtils['createHistory'](_0x109c38)[_0x77f3('0xa8')](loggerCatch(_0x3d389b));hopperUtils['moveContactManagedDialer'](_0x109c38)['catch'](loggerCatch(_0x4dadde));};Dialer[_0x77f3('0x90')][_0x77f3('0xe4')]=function(_0x3fbb83,_0x406421){hopperUtils[_0x77f3('0xd3')](_0x3fbb83)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x162')));if(_0x406421==0x0){hopperUtils['moveContactManagedDialer'](_0x3fbb83)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x163')));}};Dialer[_0x77f3('0x90')][_0x77f3('0x154')]=function(_0x259f37){return Promise['resolve']()['then'](cmHopper[_0x77f3('0x14f')](_0x259f37['id'],previewRecallmeReminderInterval))[_0x77f3('0x43')](function(_0xad7ccc){for(var _0x1b499d=0x0;_0x1b499d<_0xad7ccc[_0x77f3('0x103')];_0x1b499d++){var _0xee8296=_0xad7ccc[_0x1b499d][_0x77f3('0x151')][_0x77f3('0x4c')];if(_0xee8296)io['to'](util[_0x77f3('0x4a')]('user:%s',_0xee8296))[_0x77f3('0x46')](_0x77f3('0x153'),{'hopper':_0xad7ccc[_0x1b499d]});}})[_0x77f3('0xa8')](function(){});};Dialer['prototype'][_0x77f3('0xb8')]=function(_0x20c898){var _0x3230f3=this;return function(){_0x3230f3[_0x77f3('0x164')](_0x20c898);};};Dialer['prototype']['actionOriginate']=function(_0x5d6042,_0x158a2e){var _0x43e16d=this;var _0x136aec=uuid['v4']();this['actions'][_0x136aec]=new Action(_0x5d6042,_0x158a2e,_0x136aec);return new Promise(function(_0x1cc894,_0x4c501d){if(_[_0x77f3('0x45')](_0x5d6042)&&typeof _0x5d6042!==_0x77f3('0x165')){return _0x4c501d(msgResponse('originate',_0x77f3('0xa0'),_0x77f3('0x166')));}if(_[_0x77f3('0x45')](_0x158a2e[_0x77f3('0x167')])||_0x158a2e[_0x77f3('0x167')]===null){return _0x4c501d(msgResponse('originate','Failure',_0x77f3('0x168')));}var _0x49d165={'XMD-CALLERID':_0x43e16d[_0x77f3('0x24')][_0x136aec][_0x77f3('0x169')](),'XMD-AGI':_0x5d6042[_0x77f3('0x137')]?util['format'](_0x77f3('0x16a'),ipAgi,_0x5d6042['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x5d6042[_0x77f3('0x16b')]?util[_0x77f3('0x4a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5d6042[_0x77f3('0x16b')]):_0x77f3('0x16c'),'XMD-QUEUE':utils['isOutboundQueue'](_0x5d6042)?util[_0x77f3('0x4a')](_0x77f3('0x16d'),_0x5d6042[_0x77f3('0x4c')],_0x5d6042[_0x77f3('0x16e')]||'',_0x5d6042[_0x77f3('0x16f')]?'c':'',_0x5d6042[_0x77f3('0xda')]||0x3):_0x77f3('0x16c'),'XMD-CONTACTID':_0x158a2e[_0x77f3('0xf4')],'XMD-CDRTYPE':_0x77f3('0x9'),'CALLERID(all)':_0x43e16d['actions'][_0x136aec][_0x77f3('0x169')](),'XMD-AMD':_0x5d6042[_0x77f3('0x118')]?'ACTIVE':_0x77f3('0x16c'),'XMD-DESTINATION':_0x77f3('0x117')};if(_0x5d6042[_0x77f3('0x118')]){_0x49d165[_0x77f3('0x170')]=_0x5d6042[_0x77f3('0x171')]||0x9c4;_0x49d165[_0x77f3('0x172')]=_0x5d6042[_0x77f3('0x173')]||0x5dc;_0x49d165['XMD-AMDAFTERGREETINGSILENCE']=_0x5d6042[_0x77f3('0x174')]||0x320;_0x49d165[_0x77f3('0x175')]=_0x5d6042[_0x77f3('0x176')]||0x1388;_0x49d165[_0x77f3('0x177')]=_0x5d6042[_0x77f3('0x178')]||0x64;_0x49d165[_0x77f3('0x179')]=_0x5d6042[_0x77f3('0x17a')]||0x32;_0x49d165[_0x77f3('0x17b')]=_0x5d6042[_0x77f3('0x17c')]||0x3;_0x49d165[_0x77f3('0x17d')]=_0x5d6042[_0x77f3('0x17e')]||0x100;_0x49d165[_0x77f3('0x17f')]=_0x5d6042[_0x77f3('0x180')]||0x1388;}if(utils['isOutboundQueue'](_0x5d6042)){_0x49d165['XMD-VOICEQUEUEID']=_0x158a2e['VoiceQueueId'];}else{_0x49d165[_0x77f3('0x181')]=_0x158a2e[_0x77f3('0xe9')];}for(var _0x231c2e in _0x158a2e[_0x77f3('0x182')]){if(typeof _0x158a2e['Contact'][_0x231c2e]!==_0x77f3('0xb2')){if(isNotNull(_0x158a2e[_0x77f3('0x182')][_0x231c2e])&&_0x231c2e!=='id'&&_0x231c2e!==_0x77f3('0x183')&&_0x231c2e!==_0x77f3('0x184')&&_0x231c2e!==_0x77f3('0x185')){_0x49d165[util[_0x77f3('0x4a')]('%s%s',_0x77f3('0x186'),_['toUpper'](_0x231c2e))]=_0x158a2e[_0x77f3('0x182')][_0x231c2e];}}}var _0x486c56=_0x43e16d['isTrunkReachable'](_0x5d6042['Trunk'])?utils[_0x77f3('0x187')](_0x5d6042[_0x77f3('0x188')][_0x77f3('0x189')],_0x5d6042[_0x77f3('0x18a')],_0x5d6042[_0x77f3('0x18b')]>0x0?utils[_0x77f3('0x18c')](_0x5d6042['dialOriginateCallerIdNumber'],_0x5d6042[_0x77f3('0x18b')]):_0x5d6042[_0x77f3('0x18d')]):utils[_0x77f3('0x187')](_[_0x77f3('0x106')](_0x5d6042[_0x77f3('0x98')])?_0x5d6042[_0x77f3('0x188')][_0x77f3('0x189')]:_0x5d6042['TrunkBackup'][_0x77f3('0x189')],_0x5d6042[_0x77f3('0x18a')],_0x5d6042[_0x77f3('0x18b')]>0x0?utils['getCallerIdRandom'](_0x5d6042[_0x77f3('0x18d')],_0x5d6042['dialRandomLastDigitCallerIdNumber']):_0x5d6042[_0x77f3('0x18d')]);if(_0x486c56){_0x49d165[_0x77f3('0x18e')]=_0x43e16d[_0x77f3('0x24')][_0x136aec][_0x77f3('0x18f')]=utils['extractCalleridName'](_0x486c56);_0x49d165[_0x77f3('0x190')]=_0x158a2e[_0x77f3('0x167')];}_0x5d6042['variables']=_0x49d165;return ami[_0x77f3('0xa9')]({'actionid':_0x136aec,'action':'originate','channel':_0x43e16d[_0x77f3('0x97')](_0x5d6042[_0x77f3('0x188')])?util[_0x77f3('0x4a')]('SIP/%s/%s%s',_0x5d6042[_0x77f3('0x188')][_0x77f3('0x4c')],isNotNull(_0x5d6042[_0x77f3('0x191')])?_0x5d6042[_0x77f3('0x191')]['trim']()||'':'',_0x5d6042[_0x77f3('0x192')]>0x0?_0x158a2e[_0x77f3('0x167')][_0x77f3('0x193')](_0x5d6042[_0x77f3('0x192')]):_0x158a2e[_0x77f3('0x167')]):util['format'](_0x77f3('0x194'),_['isNil'](_0x5d6042[_0x77f3('0x98')])?_0x5d6042[_0x77f3('0x188')][_0x77f3('0x4c')]:_0x5d6042[_0x77f3('0x98')][_0x77f3('0x4c')],isNotNull(_0x5d6042['dialPrefix'])?_0x5d6042[_0x77f3('0x191')]['trim']()||'':'',_0x5d6042[_0x77f3('0x192')]>0x0?_0x158a2e['phone'][_0x77f3('0x193')](_0x5d6042['dialCutDigit']):_0x158a2e['phone']),'callerid':_0x486c56,'Exten':_0x77f3('0x117'),'Context':_0x77f3('0x195'),'Priority':'1','variable':_0x49d165,'timeout':(_0x5d6042[_0x77f3('0x196')]||0x1e)*0x3e8,'async':!![],'channelid':_0x136aec})['then'](function(_0xb8aad9){return _0x1cc894(_0xb8aad9);})[_0x77f3('0xa8')](function(_0x439394){_0x5d6042[_0x77f3('0x197')]+=0x1;var _0x2a2662=new History(_0x43e16d[_0x77f3('0x24')][_0x136aec]);logger[_0x77f3('0x6f')](util['format'](_0x77f3('0x198'),JSON[_0x77f3('0x7f')](_0x439394)));_0x2a2662[_0x77f3('0x78')]=0xe;_0x2a2662[_0x77f3('0x79')]=_0x77f3('0x199');_0x2a2662[_0x77f3('0x7b')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));_0x2a2662['endtime']=_0x2a2662['starttime'];hopperUtils[_0x77f3('0xd3')](_0x2a2662)['catch'](loggerCatch(_0x77f3('0x19a')));_0x43e16d['moveContactManagedDialer'](_0x2a2662)[_0x77f3('0xa8')](loggerCatch('[originate][error]'))[_0x77f3('0x1b')](function(){delete _0x43e16d['actions'][_0x136aec];return _0x4c501d(msgResponse(_0x77f3('0x19b'),_0x77f3('0x8f'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x21a48d,_0x2af4c1,_0x312c04){var _0x1ceb66=new History(_0x2af4c1);if(_0x1ceb66[_0x77f3('0x127')]+_0x1ceb66[_0x77f3('0x131')]+_0x1ceb66[_0x77f3('0x132')]+_0x1ceb66[_0x77f3('0x19c')]+_0x1ceb66['countdropretry']+_0x1ceb66['countabandonedretry']+_0x1ceb66['countmachineretry']+_0x1ceb66[_0x77f3('0x128')]>=_0x312c04['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x21a48d){case 0x3:if(_0x1ceb66[_0x77f3('0x132')]>=_0x312c04[_0x77f3('0x19d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x1ceb66[_0x77f3('0x132')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04[_0x77f3('0x19e')],_0x77f3('0xe6'))[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66[_0x77f3('0xe7')],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x1ceb66[_0x77f3('0x127')]>=_0x312c04['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x77f3('0xf3')]({'active':![],'countbusyretry':_0x1ceb66[_0x77f3('0x127')]+=0x1,'scheduledat':moment()['add'](_0x312c04[_0x77f3('0x19f')],'minutes')[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66['ContactId'],'ListId':_0x1ceb66[_0x77f3('0xe7')],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1a0')));break;case 0x8:if(_0x1ceb66[_0x77f3('0x131')]>=_0x312c04[_0x77f3('0x1a1')]-0x1){return!![];}hopperUtils[_0x77f3('0xf3')]({'active':![],'countcongestionretry':_0x1ceb66[_0x77f3('0x131')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04[_0x77f3('0x1a2')],'minutes')[_0x77f3('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66['ListId'],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1ceb66[_0x77f3('0x19c')]>=_0x312c04[_0x77f3('0x1a3')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1ceb66[_0x77f3('0x19c')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04['dialNoSuchNumberRetryFrequency'],_0x77f3('0xe6'))[_0x77f3('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66['ListId'],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1a4')));}break;case 0xa:if(_0x1ceb66[_0x77f3('0xde')]>=_0x312c04[_0x77f3('0xe3')]-0x1){return!![];}hopperUtils[_0x77f3('0xf3')]({'active':![],'countdropretry':_0x1ceb66[_0x77f3('0xde')]+=0x1,'scheduledat':moment()['add'](_0x312c04[_0x77f3('0x1a5')],_0x77f3('0xe6'))[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66[_0x77f3('0xe7')],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1ceb66['countabandonedretry']>=_0x312c04[_0x77f3('0xf2')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1ceb66[_0x77f3('0xef')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04[_0x77f3('0xf0')],_0x77f3('0xe6'))[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66['ContactId'],'ListId':_0x1ceb66['ListId'],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1a6')));break;case 0x13:if(_0x1ceb66[_0x77f3('0x123')]>=_0x312c04[_0x77f3('0x12b')]-0x1){return!![];}hopperUtils[_0x77f3('0xf3')]({'active':![],'countmachineretry':_0x1ceb66[_0x77f3('0x123')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04[_0x77f3('0x12d')],_0x77f3('0xe6'))[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66[_0x77f3('0xe7')],'VoiceQueueId':_0x1ceb66['VoiceQueueId']||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1a7')));break;case 0x14:if(_0x1ceb66[_0x77f3('0x128')]>=_0x312c04['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x77f3('0xf3')]({'active':![],'countagentrejectretry':_0x1ceb66[_0x77f3('0x128')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04[_0x77f3('0x1a8')],'minutes')[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66['ListId'],'VoiceQueueId':_0x1ceb66['VoiceQueueId']||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})['catch'](loggerCatch(_0x77f3('0x1a9')));break;default:return!![];}};Dialer[_0x77f3('0x90')][_0x77f3('0x112')]=function(_0x4e3136,_0x3808ab,_0x2fb640){var _0x547a0e=this;var _0x547451=new History(_0x4e3136);var _0x48e120=![];var _0x41c4fd;var _0x3e609a;return new Promise(function(_0x4c551a,_0x454eac){if(_[_0x77f3('0x45')](_0x3808ab)&&typeof _0x3808ab!==_0x77f3('0x165')){return _0x454eac(msgResponse(_0x77f3('0x1aa'),_0x77f3('0xa0'),_0x77f3('0x1ab')));}if(_[_0x77f3('0x45')](_0x2fb640)&&typeof _0x2fb640!==_0x77f3('0x165')){return _0x454eac(msgResponse(_0x77f3('0x1aa'),'Failure',_0x77f3('0x1ac')));}hopperUtils[_0x77f3('0xf1')](_0x547451,_0x2fb640[_0x77f3('0xd0')],_0x3808ab)['then'](function(_0x22e4e5){if(_0x22e4e5['additional']==0x1)_0x48e120=!![];switch(_0x2fb640[_0x77f3('0xd0')]){case'0':_0x3808ab['outboundNoSuchCallsDay']+=0x1;_0x547451[_0x77f3('0x78')]=0x0;_0x547451['statedesc']=_0x77f3('0x1ad');_0x547451[_0x77f3('0x19c')]+=0x1;_0x547451[_0x77f3('0xdf')]+=0x1;ami[_0x77f3('0x46')]('custom:agentnosuchnumber',ut[_0x77f3('0x125')](_0x4e3136,'nosuchnumber'));_0x41c4fd=_0x3808ab[_0x77f3('0x1ae')];_0x3e609a=_0x3808ab[_0x77f3('0xe0')];hopperUtils[_0x77f3('0xd3')](_0x547451)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x126')));if(_0x547a0e[_0x77f3('0x1af')](0x0,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451[_0x77f3('0x19c')]>=_0x3808ab[_0x77f3('0x1a3')]){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1b0'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1b0'));}}break;case'3':_0x3808ab[_0x77f3('0x1b2')]+=0x1;_0x547451[_0x77f3('0x78')]=0x3;_0x547451[_0x77f3('0x79')]=_0x77f3('0x1b3');_0x547451['countnoanswerretry']+=0x1;_0x547451[_0x77f3('0xdf')]+=0x1;var _0x2a2122=ut['buildNoAnswerEventPayload'](_0x4e3136,_0x3808ab);ami[_0x77f3('0x46')](_0x77f3('0x1b4'),_0x2a2122);_0x41c4fd=_0x3808ab[_0x77f3('0x19e')];_0x3e609a=_0x3808ab[_0x77f3('0xe0')];hopperUtils[_0x77f3('0xd3')](_0x547451)['catch'](loggerCatch(_0x77f3('0x1b5')));if(_0x547a0e[_0x77f3('0x1af')](0x3,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451[_0x77f3('0x132')]>=_0x3808ab['dialNoAnswerMaxRetry']){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1b6'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1b6'));}}break;case'5':_0x3808ab[_0x77f3('0x1b7')]+=0x1;_0x547451[_0x77f3('0x78')]=0x5;_0x547451['statedesc']=_0x77f3('0x1b8');_0x547451[_0x77f3('0x127')]+=0x1;_0x547451[_0x77f3('0xdf')]+=0x1;ami[_0x77f3('0x46')]('custom:agentbusy',ut[_0x77f3('0x125')](_0x4e3136,_0x77f3('0x1b9')));_0x41c4fd=_0x3808ab[_0x77f3('0x19f')];_0x3e609a=_0x3808ab[_0x77f3('0xe0')];hopperUtils[_0x77f3('0xd3')](_0x547451)[_0x77f3('0xa8')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x547a0e[_0x77f3('0x1af')](0x5,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451['countbusyretry']>=_0x3808ab[_0x77f3('0x1ba')]){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1bb'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1bb'));}}break;case'8':_0x3808ab[_0x77f3('0x1bc')]+=0x1;_0x547451['state']=0x8;_0x547451[_0x77f3('0x79')]=_0x77f3('0x1bd');_0x547451[_0x77f3('0x131')]+=0x1;_0x547451[_0x77f3('0xdf')]+=0x1;_0x41c4fd=_0x3808ab[_0x77f3('0x1a2')];_0x3e609a=_0x3808ab[_0x77f3('0xe0')];ami[_0x77f3('0x46')]('custom:agentcongestion',ut[_0x77f3('0x125')](_0x4e3136,_0x77f3('0x1be')));hopperUtils['createHistory'](_0x547451)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1bf')));if(_0x547a0e[_0x77f3('0x1af')](0x8,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451[_0x77f3('0x131')]>=_0x3808ab[_0x77f3('0x1a1')]){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c0'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c0'));}}break;case'11':_0x3808ab['outboundAbandonedCallsDay']+=0x1;_0x547451[_0x77f3('0x78')]=0xb;_0x547451[_0x77f3('0x79')]=_0x77f3('0xf5');_0x547451['countabandonedretry']+=0x1;_0x547451[_0x77f3('0xdf')]+=0x1;_0x41c4fd=_0x3808ab[_0x77f3('0xf0')];_0x3e609a=_0x3808ab['callAdditionalPhoneAfterMin'];hopperUtils[_0x77f3('0xd3')](_0x547451)['catch'](loggerCatch(_0x77f3('0xf6')));if(_0x547a0e[_0x77f3('0x1af')](0xb,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451['countabandonedretry']>=_0x3808ab[_0x77f3('0xf2')]){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c1'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c1'));}}break;case'20':_0x3808ab[_0x77f3('0x1c2')]+=0x1;_0x547451[_0x77f3('0x78')]=0x14;_0x547451[_0x77f3('0x79')]=_0x77f3('0x1c3');_0x547451[_0x77f3('0x128')]+=0x1;_0x547451['countglobal']+=0x1;_0x41c4fd=_0x3808ab[_0x77f3('0x1a8')];_0x3e609a=_0x3808ab[_0x77f3('0xe0')];ami[_0x77f3('0x46')](_0x77f3('0x1c4'),ut['buildObj'](_0x4e3136,'agentreject'));hopperUtils['createHistory'](_0x547451)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1c5')));if(_0x547a0e[_0x77f3('0x1af')](0x14,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451[_0x77f3('0x128')]>=_0x3808ab[_0x77f3('0x1c6')]){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c7'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c7'));}}break;default:_0x3808ab[_0x77f3('0x13a')]+=0x1;_0x547451[_0x77f3('0x78')]=0xc;_0x547451[_0x77f3('0x79')]=_0x2fb640[_0x77f3('0xd0')];_0x41c4fd=_0x3808ab[_0x77f3('0x1a8')];_0x3e609a=_0x3808ab['callAdditionalPhoneAfterMin'];hopperUtils[_0x77f3('0xd3')](_0x547451)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1c8')));if(_0x547a0e[_0x77f3('0x1af')](_0x2fb640['reason'],_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451[_0x77f3('0x127')]+_0x547451[_0x77f3('0x131')]+_0x547451['countnoanswerretry']+_0x547451[_0x77f3('0x19c')]+_0x547451[_0x77f3('0xde')]+_0x547451['countabandonedretry']+_0x547451[_0x77f3('0x123')]+_0x547451[_0x77f3('0x128')]>=_0x3808ab[_0x77f3('0x129')]){_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x2fb640[_0x77f3('0xd0')]);}else{_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x2fb640[_0x77f3('0xd0')]);}}}})[_0x77f3('0x43')](function(){if(_0x48e120){hopperUtils[_0x77f3('0xec')](_0x547451,_0x41c4fd,_0x3e609a)[_0x77f3('0x43')](function(){return _0x4c551a(0x1);});}});});};Dialer['prototype'][_0x77f3('0x1b1')]=function(_0x175ffe,_0x2134b0,_0x434577,_0x4e1536){var _0x3ae7d4=new Final(_0x175ffe);_0x3ae7d4[_0x77f3('0x78')]=0xf;_0x3ae7d4[_0x77f3('0x79')]='Global';this['createStateFinal'](_0x3ae7d4,_0x2134b0,_0x434577,_0x4e1536);};Dialer[_0x77f3('0x90')]['createStateFinal']=function(_0x5a95a8,_0x72acdd,_0x190c62,_0x40a57e){hopperUtils['moveContactManagedDialer'](_0x5a95a8)[_0x77f3('0x43')](function(){return _0x72acdd(msgResponse(_0x77f3('0x1aa'),_0x77f3('0x111'),_0x40a57e));})['catch'](function(){return _0x190c62(msgResponse(_0x77f3('0x1c9'),_0x77f3('0xa0'),_0x77f3('0x1ca')));});};Dialer[_0x77f3('0x90')]['predictive']=function(_0x5cb8e1){var _0x3e756b=_0x5cb8e1['dialPredictiveOptimizationPercentage']/0x64;var _0x27e13e=_0x5cb8e1[_0x77f3('0xdb')]/(_0x5cb8e1['outboundDropCallsDayTimeout']+_0x5cb8e1[_0x77f3('0xcf')]);var _0x31a395=Math[_0x77f3('0x1cb')](_0x5cb8e1[_0x77f3('0x1cc')]*(_0x5cb8e1[_0x77f3('0x1cd')]/0x64));var _0x1bfb99=Math[_0x77f3('0x1cb')](_0x5cb8e1[_0x77f3('0x1cc')]*(_0x5cb8e1[_0x77f3('0x1ce')]/0x64));var _0x4b78df=_0x5cb8e1['available']+_0x5cb8e1['talking'];var _0x132f4e=Math[_0x77f3('0x1cf')](_0x5cb8e1[_0x77f3('0x5f')]*_0x5cb8e1[_0x77f3('0x63')]*_0x5cb8e1[_0x77f3('0x1d0')]*_0x5cb8e1[_0x77f3('0x1d1')]);if(_[_0x77f3('0x45')](_0x5cb8e1[_0x77f3('0x67')])){if(!_['isUndefined'](_0x5cb8e1[_0x77f3('0x6a')])){_0x5cb8e1[_0x77f3('0x6a')]=undefined;loggerPredictive[_0x77f3('0x6f')](_0x77f3('0x1d2'),_0x77f3('0x1d3'));}if(!_[_0x77f3('0x45')](_0x5cb8e1[_0x77f3('0x6c')])){loggerPredictive[_0x77f3('0x6f')](_0x77f3('0x1d2'),_0x77f3('0x1d4'));clearInterval(_0x5cb8e1[_0x77f3('0x6c')]);_0x5cb8e1[_0x77f3('0x6c')]=undefined;}_0x5cb8e1[_0x77f3('0x67')]=moment()['format'](_0x77f3('0xce'));loggerPredictive[_0x77f3('0x4e')](_0x5cb8e1[_0x77f3('0x4c')],_0x77f3('0x1d5'),_0x5cb8e1[_0x77f3('0x67')]);this[_0x77f3('0xbc')](_0x5cb8e1,0x1);}else if(ifInterval(_0x5cb8e1[_0x77f3('0x1d6')],_0x5cb8e1[_0x77f3('0x67')])){this['handlePower'](_0x5cb8e1,0x1);loggerPredictiveCalls['info'](_0x77f3('0x1d7'),_0x5cb8e1[_0x77f3('0x67')],_0x5cb8e1[_0x77f3('0x4c')]);_0x5cb8e1[_0x77f3('0x5f')]=0x0;_0x5cb8e1[_0x77f3('0x1d8')]=0x0;}else if(_0x3e756b<_0x27e13e&&_0x5cb8e1[_0x77f3('0x1d9')]===_0x77f3('0x1da')){clearPredictiveAttributes(_0x5cb8e1);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x1db'),_0x77f3('0x1dc'),_0x27e13e,'startProgressive',_0x5cb8e1[_0x77f3('0x4c')]);}else if(_0x132f4e<_0x5cb8e1[_0x77f3('0x1d8')]&&_0x5cb8e1['dialPredictiveOptimization']===_0x77f3('0x1da')){clearPredictiveAttributes(_0x5cb8e1);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x77f3('0x1dd'),_0x132f4e,'Drop\x20in\x20this\x20interval',_0x5cb8e1[_0x77f3('0x1d8')],_0x77f3('0x67'),_0x5cb8e1[_0x77f3('0x4c')]);}else if(!ifInterval(_0x5cb8e1[_0x77f3('0x1d6')],_0x5cb8e1[_0x77f3('0x67')])&&_[_0x77f3('0x45')](_0x5cb8e1[_0x77f3('0x6a')])&&!_[_0x77f3('0x45')](_0x5cb8e1[_0x77f3('0x67')])){_0x5cb8e1['startPredictive']=moment()[_0x77f3('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5cb8e1['name'],'started\x20in\x20predictive\x20at',_0x5cb8e1[_0x77f3('0x6a')]);hopperUtils['avgHandleTime'](_0x5cb8e1[_0x77f3('0x1d6')])[_0x77f3('0x43')](this[_0x77f3('0x1de')](_0x5cb8e1))[_0x77f3('0x43')](mergeDataErlangB(_0x5cb8e1))[_0x77f3('0x43')](this[_0x77f3('0x1df')](_0x5cb8e1))[_0x77f3('0xa8')](loggerCatchPredictive(_0x77f3('0x1e0'),_0x5cb8e1));}else if(!ifInterval(_0x5cb8e1[_0x77f3('0x1d6')],_0x5cb8e1['startPredictive'])){_0x5cb8e1[_0x77f3('0x1d8')]=0x0;_0x5cb8e1[_0x77f3('0x6a')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));loggerPredictive['info'](_0x5cb8e1[_0x77f3('0x4c')],_0x77f3('0x1e1'),_0x5cb8e1[_0x77f3('0x6a')]);clearInterval(_0x5cb8e1[_0x77f3('0x6c')]);_0x5cb8e1[_0x77f3('0x6c')]=undefined;hopperUtils['avgHandleTime'](_0x5cb8e1[_0x77f3('0x1d6')])[_0x77f3('0x43')](this['getDataPredictive'](_0x5cb8e1))[_0x77f3('0x43')](mergeDataErlangB(_0x5cb8e1))[_0x77f3('0x43')](this[_0x77f3('0x1df')](_0x5cb8e1))[_0x77f3('0xa8')](loggerCatchPredictive(_0x77f3('0x1e2'),_0x5cb8e1));}else if(_0x5cb8e1[_0x77f3('0x1cc')]&&_0x4b78df<_0x5cb8e1[_0x77f3('0x1cc')]-_0x1bfb99){clearPredictiveAttributes(_0x5cb8e1);loggerPredictive[_0x77f3('0x4e')](_0x5cb8e1[_0x77f3('0x4c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4b78df,_0x77f3('0x1e3'),_0x5cb8e1[_0x77f3('0x1cc')],'-',_0x1bfb99,'=',_0x5cb8e1[_0x77f3('0x1cc')]-_0x1bfb99,')');}else if(_0x5cb8e1[_0x77f3('0x1cc')]&&_0x4b78df>_0x5cb8e1[_0x77f3('0x1cc')]+_0x31a395){clearPredictiveAttributes(_0x5cb8e1);loggerPredictive[_0x77f3('0x4e')](_0x5cb8e1[_0x77f3('0x4c')],_0x77f3('0x1e4'),_0x4b78df,_0x77f3('0x1e5'),_0x5cb8e1[_0x77f3('0x1cc')],'+',_0x31a395,'=',_0x5cb8e1[_0x77f3('0x1cc')]+_0x31a395,')');}};Dialer['prototype']['getDataPredictive']=function(_0x42cc68){var _0x1bcbfd=this;return function(_0x1fe0bb){return new Promise(function(_0x7d71a9,_0x2e650c){_[_0x77f3('0x66')](_0x42cc68,_0x1fe0bb[0x0]);if(checkGetDataPredictive(_0x1fe0bb[0x0])){var _0x177520=_0x42cc68['predictiveIntervalAvailable']=_0x42cc68[_0x77f3('0x144')]+_0x42cc68[_0x77f3('0x142')];var _0xa747bf=_0x42cc68[_0x77f3('0x1d6')]*0x3c;var _0x60fc3c=_0x1fe0bb[0x0][_0x77f3('0x57')]+_0x1fe0bb[0x0][_0x77f3('0x56')];var _0x1c9219=(_0x1fe0bb[0x0][_0x77f3('0x52')]+_0x1fe0bb[0x0][_0x77f3('0x53')]+_0x1fe0bb[0x0][_0x77f3('0x54')])/_0x1fe0bb[0x0][_0x77f3('0x50')];_0x42cc68[_0x77f3('0x1d0')]=_0x1c9219>0x0?_0x1c9219:0x1;switch(_0x42cc68[_0x77f3('0x1d9')]){case'dropRate':var _0x5a71dd=_0x42cc68[_0x77f3('0x1e6')]/0x64;return _0x1bcbfd[_0x77f3('0x1e7')](_0x177520,_0xa747bf,_0x60fc3c,_0x1c9219,_0x5a71dd)['then'](function(_0x2a5c7f){return _0x7d71a9(_0x2a5c7f);});case _0x77f3('0x1e8'):var _0x24b3de=_0x42cc68[_0x77f3('0x1e6')]/0x64;return _0x1bcbfd[_0x77f3('0x1e9')](_0x177520,_0xa747bf,_0x60fc3c,_0x1c9219,_0x24b3de)[_0x77f3('0x43')](function(_0x8a2aec){return _0x7d71a9(_0x8a2aec);});default:return _0x2e650c(msgResponse('[getDataPredictive]',_0x77f3('0xa0'),_0x77f3('0x1ea')));}}else{return _0x2e650c(msgResponse(_0x77f3('0x1eb'),_0x77f3('0xa0'),_0x77f3('0x1ec')));}});};};Dialer['prototype'][_0x77f3('0x1ed')]=function(_0x334316){var _0x514080=this;return function(_0x2a8132){return new Promise(function(_0x4f51c5,_0x3633f6){_['merge'](_0x334316,_0x2a8132[0x0]);if(checkGetDataPredictive(_0x2a8132[0x0])){loggerPredictive[_0x77f3('0x4e')](JSON['stringify'](_0x2a8132[0x0]));if(_0x334316[_0x77f3('0x1d9')]===_0x77f3('0x1da')){return _0x514080[_0x77f3('0x15a')](_0x334316['id'])[_0x77f3('0x43')](function(_0x418487){var _0x472bd5=_0x334316['loggedIn']-_0x418487[0x0][_0x77f3('0x1ee')];var _0x41f23d=_0x334316['dialPredictiveInterval']*0x3c;var _0xf299ba=_0x2a8132[0x0][_0x77f3('0x57')]+_0x2a8132[0x0][_0x77f3('0x56')];var _0xf252ba=(_0x2a8132[0x0]['predictiveIntervalAnsweredCalls']+_0x2a8132[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2a8132[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2a8132[0x0]['predictiveIntervalTotalCalls'];var _0x5cfdda=_0x334316[_0x77f3('0x1e6')]/0x64;_0x334316[_0x77f3('0x1ef')]=_0x418487[0x0]['outboundQueuePauses']||0x0;_0x334316[_0x77f3('0x1d0')]=_0xf252ba>0x0?_0xf252ba:0x1;return _0x514080[_0x77f3('0x1e7')](_0x472bd5,_0x41f23d,_0xf299ba,_0xf252ba,_0x5cfdda);})[_0x77f3('0x43')](function(_0x342222){return _0x4f51c5(_0x342222);})[_0x77f3('0xa8')](function(_0x49f9be){return _0x3633f6(msgResponse(_0x77f3('0x1f0'),_0x77f3('0xa0'),JSON[_0x77f3('0x7f')](_0x49f9be)));});}if(_0x334316['dialPredictiveOptimization']===_0x77f3('0x1e8')){return _0x514080['getVoiceQueueRtPauses'](_0x334316['id'])[_0x77f3('0x43')](function(_0xeda09){var _0x115f93=_0x334316[_0x77f3('0x1f1')]-_0xeda09[0x0][_0x77f3('0x1ee')];var _0x59f6d8=_0x334316['dialPredictiveInterval']*0x3c;var _0x55df45=_0x2a8132[0x0][_0x77f3('0x57')]+_0x2a8132[0x0][_0x77f3('0x56')];var _0x1d444d=(_0x2a8132[0x0][_0x77f3('0x52')]+_0x2a8132[0x0][_0x77f3('0x53')]+_0x2a8132[0x0][_0x77f3('0x54')])/_0x2a8132[0x0][_0x77f3('0x50')];var _0x2bd8ef=_0x334316[_0x77f3('0x1e6')]/0x64;_0x334316[_0x77f3('0x1ef')]=_0xeda09[0x0]['outboundQueuePauses']||0x0;_0x334316['predictiveIntervalHitRate']=_0x1d444d>0x0?_0x1d444d:0x1;return _0x514080[_0x77f3('0x1e9')](_0x115f93,_0x59f6d8,_0x55df45,_0x1d444d,_0x2bd8ef);})[_0x77f3('0x43')](function(_0x487f50){return _0x4f51c5(_0x487f50);})['catch'](function(_0xe3280c){return _0x3633f6(msgResponse(_0x77f3('0x1f0'),'Failure',JSON[_0x77f3('0x7f')](_0xe3280c)));});}}else{return _0x3633f6(msgResponse(_0x77f3('0x1eb'),_0x77f3('0xa0'),_0x77f3('0x1ec')));}});};};Dialer[_0x77f3('0x90')][_0x77f3('0x1df')]=function(_0x50a673){var _0xe717ce=this;return function(){var _0x12df1e=0x0;var _0x29835c=Math[_0x77f3('0x1cf')](_0x50a673[_0x77f3('0x61')]*0x3e8);if(_0x29835c>0x0){_0x29835c=_0x29835c<0x64?0x64:_0x29835c;loggerPredictive[_0x77f3('0x4e')](_0x50a673[_0x77f3('0x4c')],_0x77f3('0x1f2'),_0x29835c,_0x77f3('0x1f3'));_0x50a673['handlePredictive']=setInterval(function(){_0xe717ce[_0x77f3('0x6c')](_0x50a673);loggerPredictiveCalls[_0x77f3('0x4e')](_0x77f3('0x1f4'),_0x12df1e+=0x1);},_0x29835c);}else{loggerPredictive[_0x77f3('0x4e')](_0x50a673['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x77f3('0x1f5')]=function(_0x403cf7,_0x1c890a){var _0x3d5640=this;return function(_0x275edf){if(_[_0x77f3('0x4d')](_0x275edf)){if(_[_0x77f3('0x106')](_0x1c890a[_0x77f3('0x160')])||!_0x1c890a[_0x77f3('0x1f6')]){if(_0x403cf7[_0x77f3('0xba')]===_0x77f3('0xa')){_0x403cf7[_0x77f3('0x7c')]=_[_0x77f3('0x45')](_0x403cf7[_0x77f3('0x7c')])?!![]:_0x403cf7[_0x77f3('0x7c')];var _0x32e8f9=uuid['v4']();_0x3d5640[_0x77f3('0x24')][_0x32e8f9]=new Action(_0x403cf7,_0x1c890a,_0x32e8f9);loggerBooked[_0x77f3('0x4e')](_0x77f3('0x1f7'),_0x32e8f9,_0x77f3('0x1f8'),JSON[_0x77f3('0x7f')](_0x403cf7[_0x77f3('0x7c')]),'Queue:\x20',_0x403cf7[_0x77f3('0x4c')]);if(_0x403cf7[_0x77f3('0x7c')]){_0x403cf7['queueStatusComplete']=![];_0x3d5640['queueBooked'][_0x3d5640['actions'][_0x32e8f9]['queue']]=[];ami[_0x77f3('0xa9')]({'actionid':_0x32e8f9,'action':'queuestatus','queue':_0x403cf7[_0x77f3('0x4c')]})['catch'](function(){_0x3d5640['updateOriginated'](_0x403cf7);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x3d5640[_0x77f3('0x24')][_0x32e8f9]['ContactId'],'ListId':_0x3d5640[_0x77f3('0x24')][_0x32e8f9][_0x77f3('0xe7')],'VoiceQueueId':_0x3d5640['actions'][_0x32e8f9]['VoiceQueueId']||undefined,'CampaignId':_0x3d5640[_0x77f3('0x24')][_0x32e8f9]['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1f9')));delete _0x3d5640[_0x77f3('0x24')][_0x32e8f9];});}else{loggerBooked[_0x77f3('0x4e')](_0x77f3('0x1fa'),JSON[_0x77f3('0x7f')](_0x403cf7[_0x77f3('0x7c')]),'Queue:\x20',_0x403cf7[_0x77f3('0x4c')]);_0x3d5640[_0x77f3('0xcc')](_0x403cf7);hopperUtils[_0x77f3('0xf3')]({'active':![],'ContactId':_0x3d5640['actions'][_0x32e8f9][_0x77f3('0xf4')],'ListId':_0x3d5640[_0x77f3('0x24')][_0x32e8f9][_0x77f3('0xe7')],'VoiceQueueId':_0x3d5640[_0x77f3('0x24')][_0x32e8f9][_0x77f3('0xe8')]||undefined,'CampaignId':_0x3d5640['actions'][_0x32e8f9]['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1f9')));delete _0x3d5640[_0x77f3('0x24')][_0x32e8f9];}}else{return _0x3d5640[_0x77f3('0x1fb')](_0x403cf7,_0x1c890a);}}else{if(utils['getSeconds'](undefined,_0x1c890a[_0x77f3('0x1fc')])<_0x403cf7[_0x77f3('0x1fd')]*0x3c){if(_0x1c890a[_0x77f3('0x151')]&&!_0x1c890a[_0x77f3('0x151')][_0x77f3('0x1fe')]){_0x3d5640[_0x77f3('0x1d')][_0x77f3('0x107')](_0x1c890a['id'])[_0x77f3('0x1b')](function(){_0x3d5640[_0x77f3('0xcc')](_0x403cf7);});}else{hopperUtils[_0x77f3('0x1ff')]({'active':![]},_0x1c890a['id'],0x1)['finally'](function(){_0x3d5640['updateOriginated'](_0x403cf7);});}}else{_0x403cf7['outboundReCallsDay']+=0x1;_0x3d5640[_0x77f3('0xcc')](_0x403cf7);if(_0x403cf7[_0x77f3('0x200')]){hopperUtils[_0x77f3('0xf3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1c890a[_0x77f3('0xf4')],'ListId':_0x1c890a[_0x77f3('0xe7')],'VoiceQueueId':_0x1c890a['VoiceQueueId']||undefined,'CampaignId':_0x1c890a[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x201')));hopperUtils[_0x77f3('0xd3')](createObjHistory(_0x403cf7,_0x1c890a,utils[_0x77f3('0x72')][_0x77f3('0x202')],0x17,_0x77f3('0x203')))[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x204')));}else{_0x3d5640[_0x77f3('0x11d')](createObjHistory(_0x403cf7,_0x1c890a,utils[_0x77f3('0x72')][_0x77f3('0x205')],0x16,'RecallFailedTimeout'),_0x77f3('0x206'),_0x77f3('0x207'));}}}}else{_0x403cf7['outboundBlacklistCallsDay']+=0x1;_0x3d5640['saveInDb'](createObjHistory(_0x403cf7,_0x1c890a,utils[_0x77f3('0x72')]['BLACKLIST'],0xd,_0x77f3('0x208')),_0x77f3('0x209'),_0x77f3('0x20a'));throw _0x77f3('0x20b');}};};Dialer[_0x77f3('0x90')]['handleIvr']=function(_0x8c0398){var _0x79c5c4=this;var _0x39a93f=_0x8c0398[_0x77f3('0x20c')]-_0x8c0398['originated']-_0x8c0398[_0x77f3('0x20d')];emitCampaignSummary(_0x8c0398);if(_0x39a93f>0x0){if(_0x39a93f>this[_0x77f3('0x22')]){_0x39a93f=this['maxNumberOriginate'];}_0x8c0398[_0x77f3('0x20d')]+=_0x39a93f;hopperUtils['getContactDialerIvr'](_0x8c0398['id'],_0x39a93f,_0x8c0398[_0x77f3('0x20e')],_0x8c0398)[_0x77f3('0x43')](function(_0x47090b){_0x8c0398[_0x77f3('0x20d')]-=_0x39a93f;_0x8c0398[_0x77f3('0x20d')]=_0x8c0398[_0x77f3('0x20d')]>0x0?_0x8c0398[_0x77f3('0x20d')]:0x0;if(!utils[_0x77f3('0x20f')](_0x47090b)){_0x8c0398[_0x77f3('0x71')]=utils[_0x77f3('0x72')]['NO_AVAILABLE_CONTACTS'];logger[_0x77f3('0x4e')]('[getContactCampaign2][Empty]'+_0x8c0398[_0x77f3('0x4c')]);}else{_0x8c0398['originated']+=_0x47090b[_0x77f3('0x103')];_0x8c0398[_0x77f3('0x71')]=utils[_0x77f3('0x72')]['RUNNING'];for(var _0x43e13e=0x0;_0x43e13e<_0x47090b['length'];_0x43e13e+=0x1){_0x8c0398['ivrTotalCallsDays']+=0x1;if(_[_0x77f3('0x106')](_0x47090b[_0x43e13e])||_[_0x77f3('0x106')](_0x47090b[_0x43e13e][_0x77f3('0x182')])||_['isNil'](_0x47090b[_0x43e13e][_0x77f3('0x167')])){_0x79c5c4[_0x77f3('0x15f')](_0x77f3('0x210'),_0x8c0398,_0x47090b[_0x43e13e]);}else{hopperUtils[_0x77f3('0x211')](_[_0x77f3('0x80')](_0x47090b[_0x43e13e],['CampaignId',_0x77f3('0x167')]))[_0x77f3('0x43')](_0x79c5c4[_0x77f3('0x1f5')](_0x8c0398,_0x47090b[_0x43e13e]))[_0x77f3('0xa8')](_0x79c5c4[_0x77f3('0x15e')](_0x77f3('0x212'),_0x8c0398));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x8c0398,_0x39a93f));}};Dialer[_0x77f3('0x90')][_0x77f3('0xbc')]=function(_0x5201e6,_0x3ed15e){var _0x488242=this;var _0x41eff5=[];if(_0x3ed15e<0x1||_0x5201e6[_0x77f3('0xba')]===_0x77f3('0xa')){_0x3ed15e=0x1;}var _0x58b7b3=Math['floor'](_0x5201e6['available']*_0x3ed15e)-_0x5201e6[_0x77f3('0x15c')]-_0x5201e6[_0x77f3('0x20d')];if(_0x5201e6[_0x77f3('0x213')]>0x0){var _0x307954=_0x5201e6[_0x77f3('0x213')]-_0x5201e6[_0x77f3('0x15c')]-_0x5201e6[_0x77f3('0x144')]-_0x5201e6['temp']-_0x5201e6[_0x77f3('0x145')];if(_0x58b7b3>_0x307954){_0x58b7b3=_0x307954;}}if(_0x58b7b3>0x0){if(_0x5201e6['dialMethod']===_0x77f3('0xa')){_0x58b7b3=0x1;}if(_0x58b7b3>this[_0x77f3('0x22')]){_0x58b7b3=this['maxNumberOriginate'];}_0x5201e6['temp']+=_0x58b7b3;for(var _0x19d883 in this[_0x77f3('0x20')]){if(typeof this[_0x77f3('0x20')][_0x19d883]!==_0x77f3('0xb2')){if(this[_0x77f3('0x20')][_0x19d883][_0x77f3('0x78')]==='not_inuse'&&this[_0x77f3('0x20')][_0x19d883][_0x77f3('0x93')]===_0x77f3('0x94')){_0x41eff5[_0x77f3('0xfd')](this['agents'][_0x19d883]['id']);}}}hopperUtils[_0x77f3('0x214')](_0x5201e6,_0x41eff5,_0x58b7b3)[_0x77f3('0x43')](function(_0x4036c5){_0x5201e6['temp']-=_0x58b7b3;_0x5201e6[_0x77f3('0x20d')]=_0x5201e6[_0x77f3('0x20d')]>0x0?_0x5201e6[_0x77f3('0x20d')]:0x0;if(!utils[_0x77f3('0x20f')](_0x4036c5)){hopperUtils['countReScheduled'](_0x5201e6)[_0x77f3('0x43')](sendMessageReschedule(_0x5201e6))[_0x77f3('0xa8')](loggerCatch('[countReScheduled]\x20'));}else{_0x5201e6['originated']+=_0x4036c5['length'];_0x5201e6['message']=_0x5201e6['dialMethod']===_0x77f3('0xa')?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0x77f3('0x72')][_0x77f3('0x215')];for(var _0xfaeafa=0x0;_0xfaeafa<_0x4036c5[_0x77f3('0x103')];_0xfaeafa+=0x1){if(_[_0x77f3('0x106')](_0x4036c5[_0xfaeafa])||_['isNil'](_0x4036c5[_0xfaeafa]['Contact'])||_[_0x77f3('0x106')](_0x4036c5[_0xfaeafa][_0x77f3('0x167')])){_0x488242[_0x77f3('0x15f')](_0x77f3('0x210'),_0x5201e6,_0x4036c5[_0xfaeafa]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x4036c5[_0xfaeafa],[_0x77f3('0xe8'),_0x77f3('0x167')]))['then'](_0x488242[_0x77f3('0x1f5')](_0x5201e6,_0x4036c5[_0xfaeafa]))[_0x77f3('0xa8')](_0x488242['loggerHandler'](_0x77f3('0x210'),_0x5201e6));}}}})[_0x77f3('0xa8')](loggerGetContactDialer(_0x77f3('0x216'),_0x5201e6,_0x58b7b3));}};Dialer[_0x77f3('0x90')]['handlePredictive']=function(_0x176090){if(_0x176090[_0x77f3('0x213')]>0x0){var _0x6af9c7=_0x176090['dialLimitQueue']-_0x176090[_0x77f3('0x15c')]-_0x176090[_0x77f3('0x144')];if(_0x6af9c7>0x0){this['tryOriginatePredictive'](_0x176090);}else{loggerPredictiveCalls[_0x77f3('0x4e')]('[handlePredictive][limitChannel]');}}else{this[_0x77f3('0x217')](_0x176090);}};Dialer[_0x77f3('0x90')][_0x77f3('0x217')]=function(_0x395a41){var _0x13c39a=this;var _0x570d0e=[];_0x395a41[_0x77f3('0x15c')]+=0x1;for(var _0x205e2c in this[_0x77f3('0x20')]){if(typeof this['agents'][_0x205e2c]!==_0x77f3('0xb2')){if(this['agents'][_0x205e2c][_0x77f3('0x78')]===_0x77f3('0x218')&&this['agents'][_0x205e2c][_0x77f3('0x93')]===_0x77f3('0x94')){_0x570d0e[_0x77f3('0xfd')](this[_0x77f3('0x20')][_0x205e2c]['id']);}}}return this[_0x77f3('0x214')](_0x395a41['id'],_0x570d0e,0x1,_0x395a41[_0x77f3('0x20e')],_0x395a41)[_0x77f3('0x43')](function(_0x4ffe87){if(!utils[_0x77f3('0x20f')](_0x4ffe87)){utils[_0x77f3('0x6e')](_0x395a41,0x1,0x0);return hopperUtils[_0x77f3('0x219')](_0x395a41)['then'](sendMessageReschedule(_0x395a41))['catch'](loggerCatch(_0x77f3('0x21a')));}else{_0x395a41[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x215')];if(_[_0x77f3('0x106')](_0x4ffe87[0x0])||_[_0x77f3('0x106')](_0x4ffe87[0x0][_0x77f3('0x182')])||_[_0x77f3('0x106')](_0x4ffe87[0x0][_0x77f3('0x167')])){_0x13c39a[_0x77f3('0x15f')](_0x77f3('0x210'),_0x395a41,_0x4ffe87[0x0]);}else{return hopperUtils[_0x77f3('0x21b')](_['pick'](_0x4ffe87[0x0],[_0x77f3('0xe8'),_0x77f3('0x167')]))[_0x77f3('0x43')](_0x13c39a[_0x77f3('0x1f5')](_0x395a41,_0x4ffe87[0x0]))[_0x77f3('0xa8')](_0x13c39a[_0x77f3('0x15e')](_0x77f3('0x21c'),_0x395a41));}}})[_0x77f3('0xa8')](loggerGetContactDialer(_0x77f3('0x21d'),_0x395a41,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x4616ae,_0x3298df,_0x13b613,_0x8b74be,_0x41d311,_0x1c3000){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x21e'),_0x4616ae);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3298df);loggerPredictive['info'](_0x77f3('0x21f'),_0x13b613);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x220'),_0x8b74be);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x221'),_0x41d311);loggerPredictive['info'](_0x77f3('0x58'));return new Promise(function(_0xffec5c,_0x1b0dfc){if(_0x4616ae<=0x0||isNaN(_0x4616ae)){return _0x1b0dfc(msgResponse(_0x77f3('0x222'),_0x77f3('0x8f'),_0x77f3('0x223')+_0x4616ae));}if(_0x13b613<=0x0||isNaN(_0x13b613)){return _0x1b0dfc(msgResponse(_0x77f3('0x222'),_0x77f3('0x8f'),'Ts\x20=\x20'+_0x13b613));}if(_0x8b74be<=0x0||isNaN(_0x8b74be)){return _0x1b0dfc(msgResponse(_0x77f3('0x222'),_0x77f3('0x8f'),'p\x20=\x20'+_0x8b74be));}if(_0x3298df<=0x0||isNaN(_0x3298df)){return _0x1b0dfc(msgResponse('[abandonmentRate]',_0x77f3('0x8f'),_0x77f3('0x224')+_0x3298df));}if(_0x41d311<=0x0||isNaN(_0x41d311)){return _0x1b0dfc(msgResponse(_0x77f3('0x222'),_0x77f3('0x8f'),'Amax\x20=\x20'+_0x41d311));}_0x1c3000=_0x1c3000||0x0;var _0x5e22ca=0x1/_0x13b613;var _0x16d120=0x0;var _0x10ba6c=0x0;var _0x3bce73=0x0;var _0x5ba4e9=0x0;for(var _0x1b7757=0x0;_0x3bce73<_0x41d311;_0x1b7757+=0x1){_0x10ba6c=_0x1b7757/_0x3298df;_0x16d120=(_0x8b74be*_0x10ba6c+_0x1c3000)/_0x5e22ca;_0x3bce73=utils[_0x77f3('0x225')](_0x16d120,_0x4616ae);_0x5ba4e9=_0x16d120/_0x4616ae*(0x1-utils[_0x77f3('0x225')](_0x16d120,_0x4616ae));}return _0xffec5c({'erlangCalls':_0x1b7757,'erlangCallToSecond':_0x3298df/_0x1b7757,'erlangAbandonmentRate':_0x3bce73,'erlangBusyFactor':_0x5ba4e9});});};Dialer[_0x77f3('0x90')][_0x77f3('0x1e9')]=function(_0x3eb854,_0x2e7188,_0x4cc632,_0x70607c,_0x53a424,_0xd99ac6){loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x226'));loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x21e'),_0x3eb854);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x227'),_0x2e7188);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x21f'),_0x4cc632);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x220'),_0x70607c);loggerPredictive['info'](_0x77f3('0x228'),_0x53a424);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x58'));return new Promise(function(_0x3335b9,_0x18b9aa){if(_0x3eb854<=0x0||isNaN(_0x3eb854)){return _0x18b9aa(msgResponse(_0x77f3('0x229'),_0x77f3('0x8f'),_0x77f3('0x223')+_0x3eb854));}if(_0x4cc632<=0x0||isNaN(_0x4cc632)){return _0x18b9aa(msgResponse(_0x77f3('0x229'),'Error','Ts\x20=\x20'+_0x4cc632));}if(_0x70607c<=0x0||isNaN(_0x70607c)){return _0x18b9aa(msgResponse(_0x77f3('0x229'),_0x77f3('0x8f'),_0x77f3('0x22a')+_0x70607c));}if(_0x2e7188<=0x0||isNaN(_0x2e7188)){return _0x18b9aa(msgResponse(_0x77f3('0x229'),_0x77f3('0x8f'),_0x77f3('0x224')+_0x2e7188));}if(_0x53a424<=0x0||isNaN(_0x53a424)){return _0x18b9aa(msgResponse('[busyFactor]',_0x77f3('0x8f'),_0x77f3('0x22b')+_0x53a424));}_0xd99ac6=_0xd99ac6||0x0;var _0x545065=0x1/_0x4cc632;var _0x1680b4=0x0;var _0x4d945a=0x0;var _0x3246a3=0x0;var _0x215fbd=0x0;for(var _0x1decbf=0x0;_0x215fbd<_0x53a424;_0x1decbf+=0x1){_0x4d945a=_0x1decbf/_0x2e7188;_0x1680b4=(_0x70607c*_0x4d945a+_0xd99ac6)/_0x545065;_0x3246a3=utils[_0x77f3('0x225')](_0x1680b4,_0x3eb854);_0x215fbd=_0x1680b4/_0x3eb854*(0x1-utils['erlangb'](_0x1680b4,_0x3eb854));}return _0x3335b9({'erlangCalls':_0x1decbf,'erlangCallToSecond':_0x2e7188/_0x1decbf,'erlangAbandonmentRate':_0x3246a3,'erlangBusyFactor':_0x215fbd});});};module[_0x77f3('0x22c')]=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 f5c602e..e61189e 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 _0xecb8=['number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','dialCutDigit','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName'];(function(_0x4545aa,_0x4d736a){var _0x157a0a=function(_0x2cb60b){while(--_0x2cb60b){_0x4545aa['push'](_0x4545aa['shift']());}};_0x157a0a(++_0x4d736a);}(_0xecb8,0x14e));var _0x8ecb=function(_0x4414c6,_0x17302d){_0x4414c6=_0x4414c6-0x0;var _0x3eff5d=_0xecb8[_0x4414c6];return _0x3eff5d;};'use strict';var util=require('util');var _=require(_0x8ecb('0x0'));var moment=require(_0x8ecb('0x1'));function checkNameSurname(_0x77b7a1,_0x46bbe4,_0x41e9f6){var _0x206150='';if(!_[_0x8ecb('0x2')](_0x46bbe4)&&_0x8ecb('0x3')===typeof _0x46bbe4){_0x206150+=_0x46bbe4;}if(!_[_0x8ecb('0x2')](_0x41e9f6)&&_0x8ecb('0x3')===typeof _0x41e9f6){_0x206150+='\x20'+_0x41e9f6;}if(_0x206150!==''){return _0x206150;}return _0x77b7a1;}function Action(_0x49f803,_0x35ee12,_0x1430b){this[_0x8ecb('0x4')]=_0x49f803;this[_0x8ecb('0x5')]=_0x1430b||undefined;this['name']=checkNameSurname(_0x35ee12[_0x8ecb('0x6')][_0x8ecb('0x7')],_0x35ee12['Contact'][_0x8ecb('0x8')],_0x35ee12[_0x8ecb('0x6')][_0x8ecb('0x9')]);this[_0x8ecb('0xa')]=_0x35ee12['phone'];this[_0x8ecb('0xb')]=_0x49f803[_0x8ecb('0xc')];this[_0x8ecb('0xd')]=_0x35ee12[_0x8ecb('0xd')]||![];this[_0x8ecb('0xe')]=_0x49f803['type'];this[_0x8ecb('0xf')]=_0x49f803[_0x8ecb('0xf')]||0x3;this[_0x8ecb('0x10')]=_0x35ee12[_0x8ecb('0x10')];this[_0x8ecb('0x11')]=_0x35ee12[_0x8ecb('0x11')];this[_0x8ecb('0x12')]=_0x35ee12[_0x8ecb('0x12')];this[_0x8ecb('0x13')]=_0x35ee12[_0x8ecb('0x13')];this[_0x8ecb('0x14')]=_0x35ee12['countnosuchnumberretry'];this[_0x8ecb('0x15')]=_0x35ee12[_0x8ecb('0x15')];this[_0x8ecb('0x16')]=_0x35ee12[_0x8ecb('0x16')];this['countmachineretry']=_0x35ee12[_0x8ecb('0x17')];this['countagentrejectretry']=_0x35ee12[_0x8ecb('0x18')];this[_0x8ecb('0x19')]=_0x35ee12['ContactId'];this[_0x8ecb('0x1a')]=_0x35ee12[_0x8ecb('0x1a')];this[_0x8ecb('0x1b')]=_0x35ee12[_0x8ecb('0x1b')];this[_0x8ecb('0x1c')]=_0x35ee12['VoiceQueueId'];this[_0x8ecb('0x1d')]=_0x35ee12[_0x8ecb('0x1d')];this[_0x8ecb('0x1e')]=_0x35ee12['id'];this[_0x8ecb('0x1f')]=_0x35ee12['Contact'][_0x8ecb('0x8')]||'';this[_0x8ecb('0x20')]=moment()[_0x8ecb('0x21')](_0x8ecb('0x22'));this[_0x8ecb('0x23')]=_0x35ee12['callback'];this['callbackuniqueid']=_0x35ee12[_0x8ecb('0x24')];this[_0x8ecb('0x25')]=_0x35ee12[_0x8ecb('0x25')];this[_0x8ecb('0x26')]=_0x35ee12[_0x8ecb('0x26')];this[_0x8ecb('0x27')]='';this['originatecalleridname']='';}Action[_0x8ecb('0x28')]['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue'][_0x8ecb('0x29')]>0x0?this[_0x8ecb('0xa')]['substring'](this[_0x8ecb('0x4')][_0x8ecb('0x29')]):this[_0x8ecb('0xa')]);};Action[_0x8ecb('0x28')]['getQueue']=function(){return this[_0x8ecb('0xb')];};module[_0x8ecb('0x2a')]=Action; \ No newline at end of file +var _0x71e9=['uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','voiceQueue','dialCutDigit','getQueue','exports','util','lodash','moment','isNil','string'];(function(_0x30c8af,_0x465307){var _0x1b8e52=function(_0x18f4ab){while(--_0x18f4ab){_0x30c8af['push'](_0x30c8af['shift']());}};_0x1b8e52(++_0x465307);}(_0x71e9,0x14b));var _0x971e=function(_0x13dba2,_0x24b605){_0x13dba2=_0x13dba2-0x0;var _0x2bac53=_0x71e9[_0x13dba2];return _0x2bac53;};'use strict';var util=require(_0x971e('0x0'));var _=require(_0x971e('0x1'));var moment=require(_0x971e('0x2'));function checkNameSurname(_0x5b537b,_0x8c2d26,_0x6da22d){var _0x521ffc='';if(!_[_0x971e('0x3')](_0x8c2d26)&&_0x971e('0x4')===typeof _0x8c2d26){_0x521ffc+=_0x8c2d26;}if(!_[_0x971e('0x3')](_0x6da22d)&&'string'===typeof _0x6da22d){_0x521ffc+='\x20'+_0x6da22d;}if(_0x521ffc!==''){return _0x521ffc;}return _0x5b537b;}function Action(_0x3c3afb,_0x2717be,_0x3ae854){this['voiceQueue']=_0x3c3afb;this[_0x971e('0x5')]=_0x3ae854||undefined;this[_0x971e('0x6')]=checkNameSurname(_0x2717be[_0x971e('0x7')][_0x971e('0x8')],_0x2717be['Contact']['firstName'],_0x2717be[_0x971e('0x7')][_0x971e('0x9')]);this[_0x971e('0xa')]=_0x2717be['phone'];this[_0x971e('0xb')]=_0x3c3afb['name'];this[_0x971e('0xc')]=_0x2717be[_0x971e('0xc')]||![];this[_0x971e('0xd')]=_0x3c3afb[_0x971e('0xd')];this[_0x971e('0xe')]=_0x3c3afb[_0x971e('0xe')]||0x3;this[_0x971e('0xf')]=_0x2717be[_0x971e('0xf')];this[_0x971e('0x10')]=_0x2717be[_0x971e('0x10')];this[_0x971e('0x11')]=_0x2717be['countcongestionretry'];this[_0x971e('0x12')]=_0x2717be[_0x971e('0x12')];this['countnosuchnumberretry']=_0x2717be[_0x971e('0x13')];this['countdropretry']=_0x2717be[_0x971e('0x14')];this[_0x971e('0x15')]=_0x2717be[_0x971e('0x15')];this[_0x971e('0x16')]=_0x2717be[_0x971e('0x16')];this[_0x971e('0x17')]=_0x2717be[_0x971e('0x17')];this[_0x971e('0x18')]=_0x2717be[_0x971e('0x18')];this[_0x971e('0x19')]=_0x2717be[_0x971e('0x19')];this[_0x971e('0x1a')]=_0x2717be[_0x971e('0x1a')];this[_0x971e('0x1b')]=_0x2717be[_0x971e('0x1b')];this[_0x971e('0x1c')]=_0x2717be['CampaignId'];this['idHopper']=_0x2717be['id'];this['ContactFirstName']=_0x2717be['Contact']['firstName']||'';this[_0x971e('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x2717be['callback'];this[_0x971e('0x1e')]=_0x2717be[_0x971e('0x1e')];this['callbackat']=_0x2717be[_0x971e('0x1f')];this[_0x971e('0x20')]=_0x2717be['recallme'];this['originatecalleridnum']='';this[_0x971e('0x21')]='';}Action[_0x971e('0x22')][_0x971e('0x23')]=function(){return util['format'](_0x971e('0x24'),this[_0x971e('0x6')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x971e('0xa')][_0x971e('0x25')](this[_0x971e('0x26')][_0x971e('0x27')]):this[_0x971e('0xa')]);};Action[_0x971e('0x22')][_0x971e('0x28')]=function(){return this['queue'];};module[_0x971e('0x29')]=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 16395f9..e8453b3 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 _0x9e24=['starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','answertime','membername','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number'];(function(_0x39afcc,_0x33331d){var _0x4021ee=function(_0x112c57){while(--_0x112c57){_0x39afcc['push'](_0x39afcc['shift']());}};_0x4021ee(++_0x33331d);}(_0x9e24,0x118));var _0x49e2=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x9e24[_0x46cf00];return _0x3974dc;};'use strict';var moment=require('moment');var utils=require(_0x49e2('0x0'));function AgentComplete(_0x1359a9,_0x2e451f){this[_0x49e2('0x1')]=0x4;this[_0x49e2('0x2')]=_0x49e2('0x3');this['scheduledat']=_0x1359a9[_0x49e2('0x4')];this[_0x49e2('0x5')]=_0x1359a9[_0x49e2('0x5')];this[_0x49e2('0x6')]=_0x1359a9['type']==='outbound'?_0x49e2('0x7'):_0x1359a9['type'];this[_0x49e2('0x8')]=_0x1359a9[_0x49e2('0x8')];this[_0x49e2('0x9')]=_0x1359a9[_0x49e2('0x9')];this[_0x49e2('0xa')]=_0x1359a9[_0x49e2('0xa')];this[_0x49e2('0xb')]=_0x1359a9[_0x49e2('0x8')]+_0x1359a9[_0x49e2('0x9')]+_0x1359a9['countnoanswerretry']+_0x1359a9['countnosuchnumberretry']+_0x1359a9[_0x49e2('0xc')]+_0x1359a9[_0x49e2('0xd')]+_0x1359a9[_0x49e2('0xe')]+_0x1359a9[_0x49e2('0xf')];this[_0x49e2('0x10')]=_0x1359a9['countnosuchnumberretry'];this[_0x49e2('0xc')]=_0x1359a9[_0x49e2('0xc')];this['countabandonedretry']=_0x1359a9['countabandonedretry'];this[_0x49e2('0xe')]=_0x1359a9[_0x49e2('0xe')];this[_0x49e2('0xf')]=_0x1359a9['countagentrejectretry'];this['uniqueid']=_0x2e451f['uniqueid'];this[_0x49e2('0x11')]=_0x1359a9[_0x49e2('0x12')];this[_0x49e2('0x13')]=_0x1359a9[_0x49e2('0x14')];this['starttime']=_0x1359a9[_0x49e2('0x15')];this[_0x49e2('0x16')]=_0x1359a9['responsetime'];this['answertime']=_0x1359a9['answertime'];this[_0x49e2('0x17')]=moment()[_0x49e2('0x18')](_0x49e2('0x19'));this['ringtime']=utils[_0x49e2('0x1a')](_0x1359a9[_0x49e2('0x16')],_0x1359a9[_0x49e2('0x15')]);this[_0x49e2('0x1b')]=utils[_0x49e2('0x1a')](_0x1359a9['answertime'],_0x1359a9['responsetime']);this[_0x49e2('0x1c')]=utils['getSeconds'](this['endtime'],_0x1359a9[_0x49e2('0x1d')]);this[_0x49e2('0x7')]=_0x2e451f[_0x49e2('0x7')];this[_0x49e2('0x1e')]=_0x2e451f['membername'];this['reason']=_0x2e451f['reason'];this[_0x49e2('0x1f')]=_0x1359a9[_0x49e2('0x1f')];this[_0x49e2('0x20')]=_0x1359a9[_0x49e2('0x20')];this['callbackat']=_0x1359a9['callbackat'];this[_0x49e2('0x21')]=_0x1359a9[_0x49e2('0x21')];this[_0x49e2('0x22')]=_0x1359a9[_0x49e2('0x22')];this[_0x49e2('0x23')]=_0x1359a9[_0x49e2('0x23')];this[_0x49e2('0x24')]=_0x1359a9[_0x49e2('0x24')];this['VoiceQueueId']=_0x1359a9[_0x49e2('0x25')];this[_0x49e2('0x26')]=_0x1359a9[_0x49e2('0x26')];this[_0x49e2('0x27')]=_0x1359a9[_0x49e2('0x27')]||'';this[_0x49e2('0x28')]=_0x1359a9[_0x49e2('0x28')]||'';this['agiafterat']=_0x1359a9[_0x49e2('0x29')];}module[_0x49e2('0x2a')]=AgentComplete; \ No newline at end of file +var _0x2930=['UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x1fc7b5,_0x5d4779){var _0x3ef5db=function(_0x1622cf){while(--_0x1622cf){_0x1fc7b5['push'](_0x1fc7b5['shift']());}};_0x3ef5db(++_0x5d4779);}(_0x2930,0x8a));var _0x0293=function(_0x3f91ca,_0x4a3fdf){_0x3f91ca=_0x3f91ca-0x0;var _0x695dbb=_0x2930[_0x3f91ca];return _0x695dbb;};'use strict';var moment=require(_0x0293('0x0'));var utils=require('../utils');function AgentComplete(_0x102c90,_0x4c8e2e){this['state']=0x4;this[_0x0293('0x1')]=_0x0293('0x2');this['scheduledat']=_0x102c90[_0x0293('0x3')];this[_0x0293('0x4')]=_0x102c90['type'];this[_0x0293('0x5')]=_0x102c90[_0x0293('0x4')]===_0x0293('0x6')?_0x0293('0x7'):_0x102c90['type'];this[_0x0293('0x8')]=_0x102c90[_0x0293('0x8')];this['countcongestionretry']=_0x102c90[_0x0293('0x9')];this[_0x0293('0xa')]=_0x102c90[_0x0293('0xa')];this[_0x0293('0xb')]=_0x102c90[_0x0293('0x8')]+_0x102c90[_0x0293('0x9')]+_0x102c90[_0x0293('0xa')]+_0x102c90[_0x0293('0xc')]+_0x102c90[_0x0293('0xd')]+_0x102c90[_0x0293('0xe')]+_0x102c90[_0x0293('0xf')]+_0x102c90['countagentrejectretry'];this[_0x0293('0xc')]=_0x102c90[_0x0293('0xc')];this['countdropretry']=_0x102c90[_0x0293('0xd')];this[_0x0293('0xe')]=_0x102c90['countabandonedretry'];this['countmachineretry']=_0x102c90[_0x0293('0xf')];this[_0x0293('0x10')]=_0x102c90[_0x0293('0x10')];this['uniqueid']=_0x4c8e2e[_0x0293('0x11')];this[_0x0293('0x12')]=_0x102c90[_0x0293('0x13')];this[_0x0293('0x14')]=_0x102c90[_0x0293('0x15')];this[_0x0293('0x16')]=_0x102c90[_0x0293('0x16')];this['responsetime']=_0x102c90[_0x0293('0x17')];this[_0x0293('0x18')]=_0x102c90[_0x0293('0x18')];this[_0x0293('0x19')]=moment()[_0x0293('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0x0293('0x1b')](_0x102c90[_0x0293('0x17')],_0x102c90[_0x0293('0x16')]);this[_0x0293('0x1c')]=utils[_0x0293('0x1b')](_0x102c90[_0x0293('0x18')],_0x102c90['responsetime']);this[_0x0293('0x1d')]=utils[_0x0293('0x1b')](this[_0x0293('0x19')],_0x102c90[_0x0293('0x18')]);this[_0x0293('0x7')]=_0x4c8e2e['queue'];this[_0x0293('0x1e')]=_0x4c8e2e[_0x0293('0x1e')];this[_0x0293('0x1f')]=_0x4c8e2e[_0x0293('0x1f')];this[_0x0293('0x20')]=_0x102c90[_0x0293('0x20')];this['callbackuniqueid']=_0x102c90[_0x0293('0x21')];this[_0x0293('0x22')]=_0x102c90['callbackat'];this[_0x0293('0x23')]=_0x102c90[_0x0293('0x23')];this[_0x0293('0x24')]=_0x102c90[_0x0293('0x24')];this['ListId']=_0x102c90[_0x0293('0x25')];this[_0x0293('0x26')]=_0x102c90[_0x0293('0x26')];this['VoiceQueueId']=_0x102c90['VoiceQueueId'];this['CampaignId']=_0x102c90[_0x0293('0x27')];this[_0x0293('0x28')]=_0x102c90[_0x0293('0x28')]||'';this[_0x0293('0x29')]=_0x102c90[_0x0293('0x29')]||'';this['agiafterat']=_0x102c90[_0x0293('0x2a')];}module[_0x0293('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 39e3399..9d8a75b 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 _0xe3b9=['countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x2682a4,_0x871085){var _0x9002f8=function(_0x3ef482){while(--_0x3ef482){_0x2682a4['push'](_0x2682a4['shift']());}};_0x9002f8(++_0x871085);}(_0xe3b9,0x83));var _0x9e3b=function(_0x527b43,_0x3190fa){_0x527b43=_0x527b43-0x0;var _0x108b37=_0xe3b9[_0x527b43];return _0x108b37;};'use strict';function Final(_0x59b9e0){this[_0x9e3b('0x0')]=_0x59b9e0[_0x9e3b('0x0')];this[_0x9e3b('0x1')]=_0x59b9e0[_0x9e3b('0x1')];this[_0x9e3b('0x2')]=_0x59b9e0[_0x9e3b('0x2')];this[_0x9e3b('0x3')]=_0x59b9e0[_0x9e3b('0x2')]===_0x9e3b('0x4')?_0x9e3b('0x5'):_0x59b9e0[_0x9e3b('0x2')];this[_0x9e3b('0x6')]=_0x59b9e0[_0x9e3b('0x6')];this['countcongestionretry']=_0x59b9e0[_0x9e3b('0x7')];this[_0x9e3b('0x8')]=_0x59b9e0[_0x9e3b('0x8')];this[_0x9e3b('0x9')]=_0x59b9e0[_0x9e3b('0x6')]+_0x59b9e0[_0x9e3b('0x7')]+_0x59b9e0['countnoanswerretry']+_0x59b9e0[_0x9e3b('0xa')]+_0x59b9e0[_0x9e3b('0xb')]+_0x59b9e0['countabandonedretry']+_0x59b9e0[_0x9e3b('0xc')]+_0x59b9e0['countagentrejectretry'];this['countnosuchnumberretry']=_0x59b9e0['countnosuchnumberretry'];this[_0x9e3b('0xb')]=_0x59b9e0[_0x9e3b('0xb')];this['countabandonedretry']=_0x59b9e0[_0x9e3b('0xd')];this[_0x9e3b('0xc')]=_0x59b9e0['countmachineretry'];this[_0x9e3b('0xe')]=_0x59b9e0[_0x9e3b('0xe')];this[_0x9e3b('0x5')]=_0x59b9e0[_0x9e3b('0x5')];this[_0x9e3b('0xf')]=_0x59b9e0['calleridname'];this[_0x9e3b('0x10')]=_0x59b9e0[_0x9e3b('0x10')];this[_0x9e3b('0x11')]=_0x59b9e0[_0x9e3b('0x11')];this[_0x9e3b('0x12')]=_0x59b9e0[_0x9e3b('0x12')];this[_0x9e3b('0x13')]=_0x59b9e0[_0x9e3b('0x12')];this[_0x9e3b('0x14')]=_0x59b9e0[_0x9e3b('0x14')]||0x0;this[_0x9e3b('0x15')]=_0x59b9e0[_0x9e3b('0x15')]||0x0;this[_0x9e3b('0x16')]=_0x59b9e0[_0x9e3b('0x16')]||0x0;this['callback']=_0x59b9e0[_0x9e3b('0x17')];this[_0x9e3b('0x18')]=_0x59b9e0[_0x9e3b('0x18')];this[_0x9e3b('0x19')]=_0x59b9e0[_0x9e3b('0x19')];this[_0x9e3b('0x1a')]=_0x59b9e0[_0x9e3b('0x1a')];this[_0x9e3b('0x1b')]=_0x59b9e0[_0x9e3b('0x1b')];this['ListId']=_0x59b9e0['ListId'];this['UserId']=_0x59b9e0[_0x9e3b('0x1c')];this[_0x9e3b('0x1d')]=_0x59b9e0[_0x9e3b('0x1d')];this['CampaignId']=_0x59b9e0['CampaignId'];this['originatecalleridnum']=_0x59b9e0[_0x9e3b('0x1e')]||'';this['originatecalleridname']=_0x59b9e0[_0x9e3b('0x1f')]||'';this['state']=_0x59b9e0[_0x9e3b('0x20')];this[_0x9e3b('0x21')]=_0x59b9e0[_0x9e3b('0x21')];}module[_0x9e3b('0x22')]=Final; \ No newline at end of file +var _0x8fe9=['originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8fe9,0x11d));var _0x98fe=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x8fe9[_0x45313f];return _0x402910;};'use strict';function Final(_0x58c7f8){this[_0x98fe('0x0')]=_0x58c7f8[_0x98fe('0x0')];this[_0x98fe('0x1')]=_0x58c7f8[_0x98fe('0x1')];this[_0x98fe('0x2')]=_0x58c7f8['type'];this[_0x98fe('0x3')]=_0x58c7f8[_0x98fe('0x2')]===_0x98fe('0x4')?_0x98fe('0x5'):_0x58c7f8['type'];this['countbusyretry']=_0x58c7f8[_0x98fe('0x6')];this['countcongestionretry']=_0x58c7f8[_0x98fe('0x7')];this[_0x98fe('0x8')]=_0x58c7f8[_0x98fe('0x8')];this[_0x98fe('0x9')]=_0x58c7f8[_0x98fe('0x6')]+_0x58c7f8[_0x98fe('0x7')]+_0x58c7f8[_0x98fe('0x8')]+_0x58c7f8[_0x98fe('0xa')]+_0x58c7f8[_0x98fe('0xb')]+_0x58c7f8[_0x98fe('0xc')]+_0x58c7f8[_0x98fe('0xd')]+_0x58c7f8['countagentrejectretry'];this['countnosuchnumberretry']=_0x58c7f8[_0x98fe('0xa')];this[_0x98fe('0xb')]=_0x58c7f8[_0x98fe('0xb')];this[_0x98fe('0xc')]=_0x58c7f8[_0x98fe('0xc')];this[_0x98fe('0xd')]=_0x58c7f8[_0x98fe('0xd')];this[_0x98fe('0xe')]=_0x58c7f8[_0x98fe('0xe')];this[_0x98fe('0x5')]=_0x58c7f8['queue'];this['calleridname']=_0x58c7f8['calleridname'];this[_0x98fe('0xf')]=_0x58c7f8[_0x98fe('0xf')];this[_0x98fe('0x10')]=_0x58c7f8[_0x98fe('0x10')];this['responsetime']=_0x58c7f8[_0x98fe('0x11')];this[_0x98fe('0x12')]=_0x58c7f8[_0x98fe('0x11')];this[_0x98fe('0x13')]=_0x58c7f8['ringtime']||0x0;this['holdtime']=_0x58c7f8[_0x98fe('0x14')]||0x0;this[_0x98fe('0x15')]=_0x58c7f8['talktime']||0x0;this['callback']=_0x58c7f8[_0x98fe('0x16')];this[_0x98fe('0x17')]=_0x58c7f8['callbackuniqueid'];this['callbackat']=_0x58c7f8[_0x98fe('0x18')];this[_0x98fe('0x19')]=_0x58c7f8[_0x98fe('0x19')];this[_0x98fe('0x1a')]=_0x58c7f8[_0x98fe('0x1a')];this['ListId']=_0x58c7f8['ListId'];this[_0x98fe('0x1b')]=_0x58c7f8[_0x98fe('0x1b')];this['VoiceQueueId']=_0x58c7f8[_0x98fe('0x1c')];this[_0x98fe('0x1d')]=_0x58c7f8[_0x98fe('0x1d')];this[_0x98fe('0x1e')]=_0x58c7f8[_0x98fe('0x1e')]||'';this[_0x98fe('0x1f')]=_0x58c7f8[_0x98fe('0x1f')]||'';this[_0x98fe('0x20')]=_0x58c7f8[_0x98fe('0x20')];this[_0x98fe('0x21')]=_0x58c7f8[_0x98fe('0x21')];}module[_0x98fe('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 7a872c6..baa34f9 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 _0x616f=['getSeconds','holdtime','talktime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x356e20,_0x7a51eb){var _0x1a43dd=function(_0x2228d3){while(--_0x2228d3){_0x356e20['push'](_0x356e20['shift']());}};_0x1a43dd(++_0x7a51eb);}(_0x616f,0x1e9));var _0xf616=function(_0x335d2d,_0x26e065){_0x335d2d=_0x335d2d-0x0;var _0x379073=_0x616f[_0x335d2d];return _0x379073;};'use strict';var moment=require(_0xf616('0x0'));var utils=require(_0xf616('0x1'));function Hangup(_0x2debfa,_0x28dd0e){this['state']=0x4;this[_0xf616('0x2')]=_0xf616('0x3');this[_0xf616('0x4')]=_0x2debfa['scheduledat'];this[_0xf616('0x5')]=_0x2debfa[_0xf616('0x5')];this[_0xf616('0x6')]=_0x2debfa[_0xf616('0x5')]==='outbound'?'queue':_0x2debfa[_0xf616('0x5')];this[_0xf616('0x7')]=_0x2debfa[_0xf616('0x7')]||![];this['countbusyretry']=_0x2debfa[_0xf616('0x8')];this[_0xf616('0x9')]=_0x2debfa['countcongestionretry'];this['countnoanswerretry']=_0x2debfa['countnoanswerretry'];this['countglobal']=_0x2debfa['countbusyretry']+_0x2debfa[_0xf616('0x9')]+_0x2debfa[_0xf616('0xa')]+_0x2debfa[_0xf616('0xb')]+_0x2debfa[_0xf616('0xc')]+_0x2debfa['countabandonedretry']+_0x2debfa['countmachineretry']+_0x2debfa[_0xf616('0xd')];this[_0xf616('0xb')]=_0x2debfa[_0xf616('0xb')];this[_0xf616('0xc')]=_0x2debfa[_0xf616('0xc')];this[_0xf616('0xe')]=_0x2debfa[_0xf616('0xe')];this[_0xf616('0xf')]=_0x2debfa['countmachineretry'];this[_0xf616('0xd')]=_0x2debfa[_0xf616('0xd')];this[_0xf616('0x10')]=_0x28dd0e[_0xf616('0x10')];this[_0xf616('0x11')]=_0x2debfa[_0xf616('0x12')];this[_0xf616('0x13')]=_0x2debfa[_0xf616('0x14')];this[_0xf616('0x15')]=_0x2debfa[_0xf616('0x15')];this['responsetime']=_0x2debfa[_0xf616('0x16')];this[_0xf616('0x17')]=moment()[_0xf616('0x18')](_0xf616('0x19'));this[_0xf616('0x1a')]=utils[_0xf616('0x1b')](_0x2debfa[_0xf616('0x16')],_0x2debfa[_0xf616('0x15')]);this[_0xf616('0x1c')]=0x0;this[_0xf616('0x1d')]=utils[_0xf616('0x1b')](this[_0xf616('0x17')],_0x2debfa['responsetime']);this[_0xf616('0x1e')]=_0x2debfa[_0xf616('0x1e')];this['membername']=_0xf616('0x1f');this[_0xf616('0x20')]=_0x28dd0e[_0xf616('0x21')];this[_0xf616('0x22')]=_0x2debfa['callback'];this['callbackuniqueid']=_0x2debfa[_0xf616('0x23')];this[_0xf616('0x24')]=_0x2debfa[_0xf616('0x24')];this['recallme']=_0x2debfa[_0xf616('0x25')];this['ContactId']=_0x2debfa[_0xf616('0x26')];this[_0xf616('0x27')]=_0x2debfa[_0xf616('0x27')];this['UserId']=_0x2debfa['UserId'];this[_0xf616('0x28')]=_0x2debfa['VoiceQueueId'];this['CampaignId']=_0x2debfa[_0xf616('0x29')];}module[_0xf616('0x2a')]=Hangup; \ No newline at end of file +var _0xc3b2=['ListId','UserId','VoiceQueueId','CampaignId','exports','state','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','getSeconds','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x22491d,_0x3bad40){var _0x431173=function(_0x4fba3f){while(--_0x4fba3f){_0x22491d['push'](_0x22491d['shift']());}};_0x431173(++_0x3bad40);}(_0xc3b2,0xd7));var _0x2c3b=function(_0x5678ff,_0x55635c){_0x5678ff=_0x5678ff-0x0;var _0x2c1db9=_0xc3b2[_0x5678ff];return _0x2c1db9;};'use strict';var moment=require('moment');var utils=require('../utils');function Hangup(_0x1cee35,_0x1a8ca2){this[_0x2c3b('0x0')]=0x4;this['statedesc']=_0x2c3b('0x1');this[_0x2c3b('0x2')]=_0x1cee35[_0x2c3b('0x2')];this[_0x2c3b('0x3')]=_0x1cee35[_0x2c3b('0x3')];this[_0x2c3b('0x4')]=_0x1cee35[_0x2c3b('0x3')]===_0x2c3b('0x5')?'queue':_0x1cee35[_0x2c3b('0x3')];this[_0x2c3b('0x6')]=_0x1cee35['amd']||![];this[_0x2c3b('0x7')]=_0x1cee35[_0x2c3b('0x7')];this[_0x2c3b('0x8')]=_0x1cee35[_0x2c3b('0x8')];this[_0x2c3b('0x9')]=_0x1cee35[_0x2c3b('0x9')];this[_0x2c3b('0xa')]=_0x1cee35[_0x2c3b('0x7')]+_0x1cee35[_0x2c3b('0x8')]+_0x1cee35[_0x2c3b('0x9')]+_0x1cee35[_0x2c3b('0xb')]+_0x1cee35[_0x2c3b('0xc')]+_0x1cee35[_0x2c3b('0xd')]+_0x1cee35[_0x2c3b('0xe')]+_0x1cee35[_0x2c3b('0xf')];this['countnosuchnumberretry']=_0x1cee35[_0x2c3b('0xb')];this['countdropretry']=_0x1cee35[_0x2c3b('0xc')];this[_0x2c3b('0xd')]=_0x1cee35[_0x2c3b('0xd')];this[_0x2c3b('0xe')]=_0x1cee35[_0x2c3b('0xe')];this[_0x2c3b('0xf')]=_0x1cee35[_0x2c3b('0xf')];this['uniqueid']=_0x1a8ca2[_0x2c3b('0x10')];this[_0x2c3b('0x11')]=_0x1cee35[_0x2c3b('0x12')];this[_0x2c3b('0x13')]=_0x1cee35['number'];this[_0x2c3b('0x14')]=_0x1cee35[_0x2c3b('0x14')];this['responsetime']=_0x1cee35[_0x2c3b('0x15')];this['endtime']=moment()[_0x2c3b('0x16')](_0x2c3b('0x17'));this[_0x2c3b('0x18')]=utils['getSeconds'](_0x1cee35[_0x2c3b('0x15')],_0x1cee35[_0x2c3b('0x14')]);this['holdtime']=0x0;this[_0x2c3b('0x19')]=utils[_0x2c3b('0x1a')](this[_0x2c3b('0x1b')],_0x1cee35[_0x2c3b('0x15')]);this['queue']=_0x1cee35['queue'];this[_0x2c3b('0x1c')]=_0x2c3b('0x1d');this[_0x2c3b('0x1e')]=_0x1a8ca2[_0x2c3b('0x1f')];this[_0x2c3b('0x20')]=_0x1cee35[_0x2c3b('0x20')];this[_0x2c3b('0x21')]=_0x1cee35['callbackuniqueid'];this[_0x2c3b('0x22')]=_0x1cee35['callbackat'];this[_0x2c3b('0x23')]=_0x1cee35[_0x2c3b('0x23')];this[_0x2c3b('0x24')]=_0x1cee35[_0x2c3b('0x24')];this[_0x2c3b('0x25')]=_0x1cee35[_0x2c3b('0x25')];this[_0x2c3b('0x26')]=_0x1cee35[_0x2c3b('0x26')];this[_0x2c3b('0x27')]=_0x1cee35[_0x2c3b('0x27')];this[_0x2c3b('0x28')]=_0x1cee35['CampaignId'];}module[_0x2c3b('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 5cdf485..a0b1f79 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 _0x4887=['countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x157642,_0x1835f4){var _0x55bbb5=function(_0x282d5d){while(--_0x282d5d){_0x157642['push'](_0x157642['shift']());}};_0x55bbb5(++_0x1835f4);}(_0x4887,0x64));var _0x7488=function(_0x151cf6,_0x39b26e){_0x151cf6=_0x151cf6-0x0;var _0x3d461d=_0x4887[_0x151cf6];return _0x3d461d;};'use strict';var utils=require('../utils');function History(_0x2edb32){this[_0x7488('0x0')]=_0x2edb32['uniqueid'];this['scheduledat']=_0x2edb32['scheduledat']||undefined;this[_0x7488('0x1')]=_0x2edb32[_0x7488('0x1')];this[_0x7488('0x2')]=_0x2edb32[_0x7488('0x1')]===_0x7488('0x3')?_0x7488('0x4'):_0x2edb32[_0x7488('0x1')];this[_0x7488('0x5')]=_0x2edb32[_0x7488('0x5')];this[_0x7488('0x6')]=_0x2edb32['countcongestionretry'];this[_0x7488('0x7')]=_0x2edb32['countnoanswerretry'];this[_0x7488('0x8')]=_0x2edb32[_0x7488('0x5')]+_0x2edb32[_0x7488('0x6')]+_0x2edb32['countnoanswerretry']+_0x2edb32[_0x7488('0x9')]+_0x2edb32[_0x7488('0xa')]+_0x2edb32[_0x7488('0xb')]+_0x2edb32[_0x7488('0xc')]+_0x2edb32[_0x7488('0xd')];this[_0x7488('0x9')]=_0x2edb32[_0x7488('0x9')];this[_0x7488('0xa')]=_0x2edb32[_0x7488('0xa')];this[_0x7488('0xb')]=_0x2edb32['countabandonedretry'];this[_0x7488('0xc')]=_0x2edb32[_0x7488('0xc')];this['countagentrejectretry']=_0x2edb32['countagentrejectretry'];this['queue']=_0x2edb32[_0x7488('0x4')];this[_0x7488('0xe')]=_0x2edb32[_0x7488('0xf')];this[_0x7488('0x10')]=_0x2edb32['number'];this[_0x7488('0x11')]=_0x2edb32['starttime'];this[_0x7488('0x12')]=_0x2edb32['responsetime'];this[_0x7488('0x13')]=_0x2edb32[_0x7488('0x12')];this[_0x7488('0x14')]=utils[_0x7488('0x15')](_0x2edb32['responsetime'],_0x2edb32['starttime']);this[_0x7488('0x16')]=0x0;this[_0x7488('0x17')]=0x0;this[_0x7488('0x18')]=_0x2edb32[_0x7488('0x18')];this['callbackuniqueid']=_0x2edb32[_0x7488('0x19')];this[_0x7488('0x1a')]=_0x2edb32[_0x7488('0x1a')];this[_0x7488('0x1b')]=_0x2edb32['recallme'];this[_0x7488('0x1c')]=_0x2edb32[_0x7488('0x1c')];this[_0x7488('0x1d')]=_0x2edb32[_0x7488('0x1d')];this[_0x7488('0x1e')]=_0x2edb32[_0x7488('0x1e')];this[_0x7488('0x1f')]=_0x2edb32['VoiceQueueId'];this[_0x7488('0x20')]=_0x2edb32[_0x7488('0x20')];this[_0x7488('0x21')]=_0x2edb32[_0x7488('0x21')]||'';this[_0x7488('0x22')]=_0x2edb32['originatecalleridname']||'';this['state']=_0x2edb32[_0x7488('0x23')];this[_0x7488('0x24')]=_0x2edb32[_0x7488('0x24')];}module['exports']=History; \ No newline at end of file +var _0x0000=['endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','name','number','starttime','responsetime'];(function(_0x3ac618,_0x28bf7a){var _0xa0f924=function(_0x3dd115){while(--_0x3dd115){_0x3ac618['push'](_0x3ac618['shift']());}};_0xa0f924(++_0x28bf7a);}(_0x0000,0xa4));var _0x0000=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0000[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0x0000('0x0'));function History(_0xd48641){this[_0x0000('0x1')]=_0xd48641[_0x0000('0x1')];this[_0x0000('0x2')]=_0xd48641['scheduledat']||undefined;this[_0x0000('0x3')]=_0xd48641['type'];this[_0x0000('0x4')]=_0xd48641['type']===_0x0000('0x5')?'queue':_0xd48641['type'];this['countbusyretry']=_0xd48641[_0x0000('0x6')];this[_0x0000('0x7')]=_0xd48641[_0x0000('0x7')];this[_0x0000('0x8')]=_0xd48641[_0x0000('0x8')];this[_0x0000('0x9')]=_0xd48641[_0x0000('0x6')]+_0xd48641[_0x0000('0x7')]+_0xd48641[_0x0000('0x8')]+_0xd48641[_0x0000('0xa')]+_0xd48641['countdropretry']+_0xd48641[_0x0000('0xb')]+_0xd48641[_0x0000('0xc')]+_0xd48641[_0x0000('0xd')];this[_0x0000('0xa')]=_0xd48641[_0x0000('0xa')];this[_0x0000('0xe')]=_0xd48641[_0x0000('0xe')];this[_0x0000('0xb')]=_0xd48641[_0x0000('0xb')];this[_0x0000('0xc')]=_0xd48641['countmachineretry'];this[_0x0000('0xd')]=_0xd48641[_0x0000('0xd')];this['queue']=_0xd48641[_0x0000('0xf')];this[_0x0000('0x10')]=_0xd48641[_0x0000('0x11')];this['calleridnum']=_0xd48641[_0x0000('0x12')];this[_0x0000('0x13')]=_0xd48641[_0x0000('0x13')];this[_0x0000('0x14')]=_0xd48641[_0x0000('0x14')];this[_0x0000('0x15')]=_0xd48641['responsetime'];this['ringtime']=utils['getSeconds'](_0xd48641['responsetime'],_0xd48641[_0x0000('0x13')]);this['holdtime']=0x0;this[_0x0000('0x16')]=0x0;this[_0x0000('0x17')]=_0xd48641['callback'];this[_0x0000('0x18')]=_0xd48641[_0x0000('0x18')];this['callbackat']=_0xd48641[_0x0000('0x19')];this[_0x0000('0x1a')]=_0xd48641['recallme'];this[_0x0000('0x1b')]=_0xd48641[_0x0000('0x1b')];this[_0x0000('0x1c')]=_0xd48641['ListId'];this[_0x0000('0x1d')]=_0xd48641[_0x0000('0x1d')];this[_0x0000('0x1e')]=_0xd48641[_0x0000('0x1e')];this[_0x0000('0x1f')]=_0xd48641[_0x0000('0x1f')];this[_0x0000('0x20')]=_0xd48641[_0x0000('0x20')]||'';this[_0x0000('0x21')]=_0xd48641['originatecalleridname']||'';this[_0x0000('0x22')]=_0xd48641[_0x0000('0x22')];this[_0x0000('0x23')]=_0xd48641[_0x0000('0x23')];}module[_0x0000('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index a29b5f8..c33ea62 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 _0x458c=['droptime','dropreason','endtime','ringtime','getSeconds','responsetime','holdtime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','name','calleridnum','starttime'];(function(_0x295081,_0x2828d4){var _0x3c0f4d=function(_0x39def4){while(--_0x39def4){_0x295081['push'](_0x295081['shift']());}};_0x3c0f4d(++_0x2828d4);}(_0x458c,0x13e));var _0xc458=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x458c[_0x616290];return _0x453879;};'use strict';var utils=require(_0xc458('0x0'));function QueueCallerAbandon(_0x291d62,_0x15916e){this[_0xc458('0x1')]=_0x291d62['scheduledat'];this['type']=_0x291d62[_0xc458('0x2')];this[_0xc458('0x3')]=_0x291d62[_0xc458('0x2')]===_0xc458('0x4')?'queue':_0x291d62[_0xc458('0x2')];this[_0xc458('0x5')]=_0x291d62['countbusyretry'];this[_0xc458('0x6')]=_0x291d62[_0xc458('0x6')];this[_0xc458('0x7')]=_0x291d62[_0xc458('0x7')];this[_0xc458('0x8')]=_0x291d62[_0xc458('0x5')]+_0x291d62[_0xc458('0x6')]+_0x291d62[_0xc458('0x7')]+_0x291d62[_0xc458('0x9')]+_0x291d62['countdropretry']+_0x291d62[_0xc458('0xa')]+_0x291d62['countmachineretry']+_0x291d62[_0xc458('0xb')];this['countnosuchnumberretry']=_0x291d62[_0xc458('0x9')];this[_0xc458('0xc')]=_0x291d62['countdropretry'];this['countabandonedretry']=_0x291d62[_0xc458('0xa')];this[_0xc458('0xd')]=_0x291d62[_0xc458('0xd')];this[_0xc458('0xb')]=_0x291d62[_0xc458('0xb')];this[_0xc458('0xe')]=_0x15916e[_0xc458('0xe')];this['calleridname']=_0x291d62[_0xc458('0xf')];this[_0xc458('0x10')]=_0x291d62['number'];this[_0xc458('0x11')]=_0x291d62[_0xc458('0x11')];this['responsetime']=_0x291d62['responsetime'];this[_0xc458('0x12')]=_0x291d62['droptime'];this['dropreason']=_0x291d62[_0xc458('0x13')];this[_0xc458('0x14')]=this[_0xc458('0x12')];this[_0xc458('0x15')]=utils[_0xc458('0x16')](_0x291d62[_0xc458('0x17')],_0x291d62[_0xc458('0x11')]);this[_0xc458('0x18')]=utils[_0xc458('0x16')](this[_0xc458('0x12')],_0x291d62[_0xc458('0x17')]);this['talktime']=0x0;this[_0xc458('0x19')]=_0x15916e['queue'];this['membername']=_0x15916e[_0xc458('0x1a')];this[_0xc458('0x1b')]=_0x15916e['reason'];this[_0xc458('0x1c')]=_0x291d62[_0xc458('0x1c')];this[_0xc458('0x1d')]=_0x291d62[_0xc458('0x1d')];this[_0xc458('0x1e')]=_0x291d62['callbackat'];this[_0xc458('0x1f')]=_0x291d62[_0xc458('0x1f')];this[_0xc458('0x20')]=_0x291d62[_0xc458('0x20')];this[_0xc458('0x21')]=_0x291d62[_0xc458('0x21')];this[_0xc458('0x22')]=_0x291d62[_0xc458('0x22')];this[_0xc458('0x23')]=_0x291d62['VoiceQueueId'];this[_0xc458('0x24')]=_0x291d62[_0xc458('0x24')];this['originatecalleridnum']=_0x291d62['originatecalleridnum']||'';this['originatecalleridname']=_0x291d62[_0xc458('0x25')]||'';this['agiafterat']=_0x291d62[_0xc458('0x26')];this[_0xc458('0x27')]=_0x291d62['state'];this[_0xc458('0x28')]=_0x291d62[_0xc458('0x28')];}module[_0xc458('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xfdd3=['originatecalleridnum','state','statedesc','exports','../utils','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','ringtime','holdtime','getSeconds','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xfdd3,0x107));var _0x3fdd=function(_0x3b0c84,_0x35dc7a){_0x3b0c84=_0x3b0c84-0x0;var _0x241515=_0xfdd3[_0x3b0c84];return _0x241515;};'use strict';var utils=require(_0x3fdd('0x0'));function QueueCallerAbandon(_0x337405,_0x5cdd64){this[_0x3fdd('0x1')]=_0x337405[_0x3fdd('0x1')];this['type']=_0x337405[_0x3fdd('0x2')];this['campaigntype']=_0x337405[_0x3fdd('0x2')]===_0x3fdd('0x3')?_0x3fdd('0x4'):_0x337405[_0x3fdd('0x2')];this['countbusyretry']=_0x337405['countbusyretry'];this[_0x3fdd('0x5')]=_0x337405[_0x3fdd('0x5')];this[_0x3fdd('0x6')]=_0x337405['countnoanswerretry'];this[_0x3fdd('0x7')]=_0x337405['countbusyretry']+_0x337405['countcongestionretry']+_0x337405['countnoanswerretry']+_0x337405[_0x3fdd('0x8')]+_0x337405[_0x3fdd('0x9')]+_0x337405[_0x3fdd('0xa')]+_0x337405['countmachineretry']+_0x337405['countagentrejectretry'];this['countnosuchnumberretry']=_0x337405[_0x3fdd('0x8')];this[_0x3fdd('0x9')]=_0x337405[_0x3fdd('0x9')];this[_0x3fdd('0xa')]=_0x337405['countabandonedretry'];this[_0x3fdd('0xb')]=_0x337405[_0x3fdd('0xb')];this['countagentrejectretry']=_0x337405[_0x3fdd('0xc')];this[_0x3fdd('0xd')]=_0x5cdd64[_0x3fdd('0xd')];this[_0x3fdd('0xe')]=_0x337405[_0x3fdd('0xf')];this[_0x3fdd('0x10')]=_0x337405['number'];this[_0x3fdd('0x11')]=_0x337405[_0x3fdd('0x11')];this['responsetime']=_0x337405[_0x3fdd('0x12')];this['droptime']=_0x337405['droptime'];this['dropreason']=_0x337405['dropreason'];this['endtime']=this[_0x3fdd('0x13')];this[_0x3fdd('0x14')]=utils['getSeconds'](_0x337405['responsetime'],_0x337405[_0x3fdd('0x11')]);this[_0x3fdd('0x15')]=utils[_0x3fdd('0x16')](this[_0x3fdd('0x13')],_0x337405['responsetime']);this['talktime']=0x0;this[_0x3fdd('0x4')]=_0x5cdd64[_0x3fdd('0x4')];this['membername']=_0x5cdd64['connectedlinename'];this[_0x3fdd('0x17')]=_0x5cdd64[_0x3fdd('0x17')];this[_0x3fdd('0x18')]=_0x337405['callback'];this['callbackuniqueid']=_0x337405[_0x3fdd('0x19')];this['callbackat']=_0x337405[_0x3fdd('0x1a')];this[_0x3fdd('0x1b')]=_0x337405['recallme'];this[_0x3fdd('0x1c')]=_0x337405[_0x3fdd('0x1c')];this[_0x3fdd('0x1d')]=_0x337405[_0x3fdd('0x1d')];this[_0x3fdd('0x1e')]=_0x337405[_0x3fdd('0x1e')];this[_0x3fdd('0x1f')]=_0x337405['VoiceQueueId'];this['CampaignId']=_0x337405[_0x3fdd('0x20')];this['originatecalleridnum']=_0x337405[_0x3fdd('0x21')]||'';this['originatecalleridname']=_0x337405['originatecalleridname']||'';this['agiafterat']=_0x337405['agiafterat'];this[_0x3fdd('0x22')]=_0x337405[_0x3fdd('0x22')];this['statedesc']=_0x337405[_0x3fdd('0x23')];}module[_0x3fdd('0x24')]=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 04235f7..7d89e01 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 _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x30f64d,_0x40f95e){var _0x191c46=function(_0x1091d5){while(--_0x1091d5){_0x30f64d['push'](_0x30f64d['shift']());}};_0x191c46(++_0x40f95e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0xf86327,_0x593328){var _0x5af202=function(_0x3ffaab){while(--_0x3ffaab){_0xf86327['push'](_0xf86327['shift']());}};_0x5af202(++_0x593328);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=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 02b087c..2a97e84 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 _0xbee6=['active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','TrunkBackup','status','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','CAMPAIGN_STATUS','preview','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive'];(function(_0x1e5169,_0x3b177a){var _0x259d2a=function(_0xc95827){while(--_0xc95827){_0x1e5169['push'](_0x1e5169['shift']());}};_0x259d2a(++_0x3b177a);}(_0xbee6,0x134));var _0x6bee=function(_0x1bba3f,_0x2a314b){_0x1bba3f=_0x1bba3f-0x0;var _0x278bf8=_0xbee6[_0x1bba3f];return _0x278bf8;};'use strict';var _=require(_0x6bee('0x0'));var moment=require(_0x6bee('0x1'));var util=require('util');var logger=require(_0x6bee('0x2'))(_0x6bee('0x3'));var timezones=require(_0x6bee('0x4'))[_0x6bee('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x6bee('0x6'),'CONTACTS_RESCHEDULED':_0x6bee('0x7'),'DEACTIVATED':_0x6bee('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x6bee('0x9'),'INACTIVE':_0x6bee('0xa'),'NO_AGENTS_LOGGED':_0x6bee('0xb'),'NO_AVAILABLE_CONTACTS':_0x6bee('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x6bee('0xd'),'QUEUE_RECALL':_0x6bee('0xe'),'RECALL_TIMEOUT':_0x6bee('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x6bee('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3251eb){return _0x3251eb['dialMethod']===_0x6bee('0x11');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x1eadf8){return _0x1eadf8[_0x6bee('0x12')]===_0x6bee('0x13');}exports[_0x6bee('0x14')]=isIVRCampaign;function isOutboundQueue(_0x53b823){return _0x53b823['type']==='outbound';}exports[_0x6bee('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0xb2e944){return _0xb2e944[_0x6bee('0x16')];}exports[_0x6bee('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x26cd5d){return _0x26cd5d[_0x6bee('0x18')];}exports[_0x6bee('0x19')]=isIVRCampaignActive;function getSeconds(_0x22ca1c,_0x34a79b){var _0x1a844a=moment(_0x22ca1c)[_0x6bee('0x1a')](0x0);var _0x63210=moment(_0x34a79b)[_0x6bee('0x1a')](0x0);return _0x1a844a[_0x6bee('0x1b')](_0x63210,_0x6bee('0x1c'));}exports[_0x6bee('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x1b198f,_0x541aa8){var _0x2d8e52=![];var _0x2fd8b2=_0x1b198f[_0x6bee('0x1e')]!==_0x541aa8[_0x6bee('0x1e')]||_0x1b198f[_0x6bee('0x16')]!==_0x541aa8[_0x6bee('0x16')]||_0x1b198f[_0x6bee('0x1f')]!==_0x541aa8[_0x6bee('0x1f')];var _0x40a5d5=_0x1b198f['available']!==_0x541aa8[_0x6bee('0x20')]||_0x1b198f[_0x6bee('0x21')]!==_0x541aa8[_0x6bee('0x21')]||_0x1b198f['loggedInDb']!==_0x541aa8[_0x6bee('0x22')]||_0x1b198f['paused']!==_0x541aa8[_0x6bee('0x23')]||_0x1b198f[_0x6bee('0x24')]!==_0x541aa8['talking']||_0x1b198f['pTalking']!==_0x541aa8[_0x6bee('0x25')]||_0x1b198f[_0x6bee('0x26')]!==_0x541aa8[_0x6bee('0x26')]||_0x1b198f[_0x6bee('0x27')]!==_0x541aa8[_0x6bee('0x27')]||_0x1b198f[_0x6bee('0x28')]!==_0x541aa8[_0x6bee('0x28')];if(_0x1b198f[_0x6bee('0x29')]&&_0x541aa8[_0x6bee('0x29')]){_0x2d8e52=_0x1b198f[_0x6bee('0x29')][_0x6bee('0x2a')]!==_0x541aa8['Trunk'][_0x6bee('0x2a')]||_0x1b198f[_0x6bee('0x29')][_0x6bee('0x18')]!==_0x541aa8['Trunk']['active'];}return _0x2fd8b2||_0x40a5d5||_0x2d8e52;}exports[_0x6bee('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x99f288){var _0x4c5eb9=null;var _0x254a22=_0x99f288[_0x6bee('0x2c')];if(_[_0x6bee('0x2d')](_0x99f288[_0x6bee('0x2e')])||_[_0x6bee('0x2d')](_0x99f288[_0x6bee('0x2f')])||_['isNil'](_0x99f288[_0x6bee('0x2f')][_0x6bee('0x30')])){_0x4c5eb9=CAMPAIGN_STATUS[_0x6bee('0x31')];}else if(_[_0x6bee('0x32')](_0x99f288[_0x6bee('0x2e')])||_[_0x6bee('0x32')](_0x99f288[_0x6bee('0x2f')][_0x6bee('0x30')])){_0x4c5eb9=CAMPAIGN_STATUS[_0x6bee('0x33')];}else if(_0x254a22&&!timezones[_0x254a22]){_0x4c5eb9=CAMPAIGN_STATUS[_0x6bee('0x34')];}return _0x4c5eb9;}function checkAnyValidTrunk(_0x3e6542,_0x5da329){var _0x6e2d16=null;var _0x3b7475='SIP/';var _0x42118b=[_0x6bee('0x35'),_0x6bee('0x36')];var _0x5e33fe=!![];if(_0x3e6542[_0x6bee('0x29')]&&_0x3e6542[_0x6bee('0x29')][_0x6bee('0x18')]){_0x3b7475+=_0x3e6542['Trunk'][_0x6bee('0x2a')];_0x6e2d16=_0x5da329[_0x3b7475];_0x5e33fe=_0x42118b[_0x6bee('0x37')](_0x6e2d16['status']);}else if(_0x3e6542[_0x6bee('0x38')]&&_0x3e6542[_0x6bee('0x38')][_0x6bee('0x18')]){_0x3b7475+=_0x3e6542[_0x6bee('0x38')][_0x6bee('0x2a')];_0x6e2d16=_0x5da329[_0x3b7475];_0x5e33fe=_0x42118b[_0x6bee('0x37')](_0x6e2d16[_0x6bee('0x39')]);}return _0x5e33fe;}function getQueueCampaignStatusMessage(_0x4e22d9,_0x2abb3b){var _0x5af5a7=CAMPAIGN_STATUS[_0x6bee('0x3a')];var _0xc30bce=isPreviewCampaign(_0x4e22d9);if(!isQueueCampaignActive(_0x4e22d9)){if(_0xc30bce){_0x5af5a7=CAMPAIGN_STATUS[_0x6bee('0x3b')];}else{if(_0x4e22d9[_0x6bee('0x28')]===0x0&&_0x4e22d9['talking']===0x0&&_0x4e22d9[_0x6bee('0x26')]===0x0&&(_0x4e22d9[_0x6bee('0x25')]||0x0)===0x0){_0x5af5a7=CAMPAIGN_STATUS['INACTIVE'];}else{_0x5af5a7=CAMPAIGN_STATUS[_0x6bee('0x3c')];}}}else if(_0x4e22d9[_0x6bee('0x21')]===0x0){_0x5af5a7=CAMPAIGN_STATUS[_0x6bee('0x3d')];}else if(!checkAnyValidTrunk(_0x4e22d9,_0x2abb3b)){_0x5af5a7=CAMPAIGN_STATUS[_0x6bee('0x3e')];}else if(!isPreviewCampaign(_0x4e22d9)){var _0x21e506=checkAnyValidQueueCampaignInterval(_0x4e22d9);if(_0x21e506){_0x5af5a7=_0x21e506;}}return _0x5af5a7;}exports[_0x6bee('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x55e928){var _0x297b75=CAMPAIGN_STATUS[_0x6bee('0x3c')];if(_0x55e928[_0x6bee('0x28')]===0x0&&_0x55e928[_0x6bee('0x24')]===0x0&&_0x55e928['waiting']===0x0&&(_0x55e928['pTalking']||0x0)===0x0){_0x297b75=CAMPAIGN_STATUS[_0x6bee('0x3b')];}return _0x297b75;}exports[_0x6bee('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3f338b){var _0x185f58=_0x3f338b[_0x6bee('0x41')](/"(.*?)"/);return _0x185f58?_0x185f58[0x1]:_0x3f338b;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x5b642d,_0x6953e3,_0x2267cc){if(!_[_0x6bee('0x42')](_0x2267cc)&&typeof _0x2267cc==='string'&&!_[_0x6bee('0x32')](_0x2267cc)){if(!_[_0x6bee('0x42')](_0x6953e3)&&typeof _0x6953e3==='string'&&!_[_0x6bee('0x32')](_0x6953e3)){return util['format']('\x22%s\x22\x20<%s>',_0x6953e3,_0x2267cc);}return util['format'](_0x6bee('0x43'),_0x2267cc,_0x2267cc);}if(!_['isUndefined'](_0x5b642d)&&typeof _0x5b642d===_0x6bee('0x44')&&!_[_0x6bee('0x32')](_0x5b642d)){return _0x5b642d;}return _0x6bee('0x45');}exports[_0x6bee('0x46')]=getCallerId;function getCallerIdRandom(_0x56bfff,_0x5ba6e8){var _0x36e7b6;var _0x4d9d37;var _0x33a7aa;if(_0x5ba6e8<=0x0){_0x5ba6e8=0x1;}_0x36e7b6=new RegExp(_0x6bee('0x47')+_0x5ba6e8+'}$');_0x4d9d37=Math[_0x6bee('0x48')](0xa,_0x5ba6e8-0x1);_0x33a7aa=Math[_0x6bee('0x48')](0xa,_0x5ba6e8)-0x1;return util['format']('%s',_[_0x6bee('0x49')](_0x56bfff,_0x36e7b6,_[_0x6bee('0x4a')](_0x4d9d37,_0x33a7aa)[_0x6bee('0x4b')]()));}exports[_0x6bee('0x4c')]=getCallerIdRandom;function decrementOriginate(_0x40c2b5){if(_0x40c2b5[_0x6bee('0x28')]&&_0x40c2b5['originated']>0x0){_0x40c2b5[_0x6bee('0x28')]-=0x1;}else{logger[_0x6bee('0x4d')](_0x6bee('0x4e'));}}exports[_0x6bee('0x4f')]=decrementOriginate;function checkContactEmpty(_0x239177){return _0x239177&&_0x239177['length']>0x0;}exports[_0x6bee('0x50')]=checkContactEmpty;function erlangb(_0x154f2a,_0x5de4cf){if(_0x5de4cf===0x0){return 0x0;}var _0x18d709=0x1;for(var _0x1efc42=0x1;_0x1efc42<=_0x5de4cf;_0x1efc42+=0x1){_0x18d709=0x1+_0x18d709*_0x1efc42/_0x154f2a;}return 0x1/_0x18d709;}exports[_0x6bee('0x51')]=erlangb;function checkContactLowerLimitOriginate(_0x30e5f2,_0x57f2ad,_0x3c355b){if(_0x57f2ad>_0x3c355b){for(var _0x473e0d=0x0;_0x473e0d<_0x57f2ad-_0x3c355b;_0x473e0d+=0x1){decrementOriginate(_0x30e5f2);}}}exports[_0x6bee('0x52')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x4a7b=['getSeconds','message','available','loggedIn','loggedInDb','paused','pTalking','waiting','inUse','originated','Trunk','name','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','TrunkBackup','INACTIVE','talking','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds'];(function(_0x595064,_0x2e5665){var _0x2b4122=function(_0x351236){while(--_0x351236){_0x595064['push'](_0x595064['shift']());}};_0x2b4122(++_0x2e5665);}(_0x4a7b,0x16c));var _0xb4a7=function(_0x3fb8e6,_0x3e20e2){_0x3fb8e6=_0x3fb8e6-0x0;var _0x116329=_0x4a7b[_0x3fb8e6];return _0x116329;};'use strict';var _=require(_0xb4a7('0x0'));var moment=require(_0xb4a7('0x1'));var util=require(_0xb4a7('0x2'));var logger=require(_0xb4a7('0x3'))(_0xb4a7('0x4'));var timezones=require(_0xb4a7('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xb4a7('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xb4a7('0x7'),'DEACTIVATED':_0xb4a7('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xb4a7('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xb4a7('0xa'),'NO_AVAILABLE_CONTACTS':_0xb4a7('0xb'),'NULL_INTERVAL':_0xb4a7('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xb4a7('0xd'),'QUEUE_RECALL':_0xb4a7('0xe'),'RECALL_TIMEOUT':_0xb4a7('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xb4a7('0x10'),'UNREACHABLE_TRUNK':_0xb4a7('0x11')};exports[_0xb4a7('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3320cc){return _0x3320cc[_0xb4a7('0x13')]===_0xb4a7('0x14');}exports[_0xb4a7('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x316869){return _0x316869['type']==='ivr';}exports[_0xb4a7('0x16')]=isIVRCampaign;function isOutboundQueue(_0x1138a5){return _0x1138a5['type']===_0xb4a7('0x17');}exports[_0xb4a7('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x19c850){return _0x19c850[_0xb4a7('0x19')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x4a6781){return _0x4a6781[_0xb4a7('0x1a')];}exports[_0xb4a7('0x1b')]=isIVRCampaignActive;function getSeconds(_0x111711,_0x42266c){var _0x339224=moment(_0x111711)[_0xb4a7('0x1c')](0x0);var _0x309578=moment(_0x42266c)['milliseconds'](0x0);return _0x339224[_0xb4a7('0x1d')](_0x309578,_0xb4a7('0x1e'));}exports[_0xb4a7('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x576e40,_0x3dfc07){var _0x1fc8eb=![];var _0x5a1db0=_0x576e40[_0xb4a7('0x13')]!==_0x3dfc07[_0xb4a7('0x13')]||_0x576e40['dialActive']!==_0x3dfc07['dialActive']||_0x576e40['message']!==_0x3dfc07[_0xb4a7('0x20')];var _0x1f2b6a=_0x576e40[_0xb4a7('0x21')]!==_0x3dfc07[_0xb4a7('0x21')]||_0x576e40[_0xb4a7('0x22')]!==_0x3dfc07[_0xb4a7('0x22')]||_0x576e40['loggedInDb']!==_0x3dfc07[_0xb4a7('0x23')]||_0x576e40['paused']!==_0x3dfc07[_0xb4a7('0x24')]||_0x576e40['talking']!==_0x3dfc07['talking']||_0x576e40[_0xb4a7('0x25')]!==_0x3dfc07[_0xb4a7('0x25')]||_0x576e40[_0xb4a7('0x26')]!==_0x3dfc07['waiting']||_0x576e40[_0xb4a7('0x27')]!==_0x3dfc07[_0xb4a7('0x27')]||_0x576e40[_0xb4a7('0x28')]!==_0x3dfc07['originated'];if(_0x576e40[_0xb4a7('0x29')]&&_0x3dfc07[_0xb4a7('0x29')]){_0x1fc8eb=_0x576e40[_0xb4a7('0x29')][_0xb4a7('0x2a')]!==_0x3dfc07[_0xb4a7('0x29')][_0xb4a7('0x2a')]||_0x576e40[_0xb4a7('0x29')][_0xb4a7('0x1a')]!==_0x3dfc07['Trunk']['active'];}return _0x5a1db0||_0x1f2b6a||_0x1fc8eb;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x106cfc){var _0x50cda0=null;var _0x1f1c46=_0x106cfc['dialTimezone'];if(_[_0xb4a7('0x2b')](_0x106cfc['dialGlobalInterval'])||_[_0xb4a7('0x2b')](_0x106cfc[_0xb4a7('0x2c')])||_[_0xb4a7('0x2b')](_0x106cfc[_0xb4a7('0x2c')][_0xb4a7('0x2d')])){_0x50cda0=CAMPAIGN_STATUS[_0xb4a7('0x2e')];}else if(_[_0xb4a7('0x2f')](_0x106cfc['dialGlobalInterval'])||_['isEmpty'](_0x106cfc[_0xb4a7('0x2c')]['Intervals'])){_0x50cda0=CAMPAIGN_STATUS[_0xb4a7('0x30')];}else if(_0x1f1c46&&!timezones[_0x1f1c46]){_0x50cda0=CAMPAIGN_STATUS[_0xb4a7('0x31')];}return _0x50cda0;}function checkAnyValidTrunk(_0x2a18ff,_0x1a4669){var _0x1d5e8f=null;var _0x3a0ac3=_0xb4a7('0x32');var _0x5d8d6d=[_0xb4a7('0x33'),_0xb4a7('0x34')];var _0x1a41ab=!![];if(_0x2a18ff[_0xb4a7('0x29')]&&_0x2a18ff[_0xb4a7('0x29')][_0xb4a7('0x1a')]){_0x3a0ac3+=_0x2a18ff[_0xb4a7('0x29')][_0xb4a7('0x2a')];_0x1d5e8f=_0x1a4669[_0x3a0ac3];_0x1a41ab=_0x5d8d6d[_0xb4a7('0x35')](_0x1d5e8f['status']);}else if(_0x2a18ff[_0xb4a7('0x36')]&&_0x2a18ff[_0xb4a7('0x36')][_0xb4a7('0x1a')]){_0x3a0ac3+=_0x2a18ff[_0xb4a7('0x36')][_0xb4a7('0x2a')];_0x1d5e8f=_0x1a4669[_0x3a0ac3];_0x1a41ab=_0x5d8d6d[_0xb4a7('0x35')](_0x1d5e8f['status']);}return _0x1a41ab;}function getQueueCampaignStatusMessage(_0x110af6,_0x4186d2){var _0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x6')];var _0x8a4284=isPreviewCampaign(_0x110af6);if(!isQueueCampaignActive(_0x110af6)){if(_0x8a4284){_0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x37')];}else{if(_0x110af6[_0xb4a7('0x28')]===0x0&&_0x110af6[_0xb4a7('0x38')]===0x0&&_0x110af6[_0xb4a7('0x26')]===0x0&&(_0x110af6['pTalking']||0x0)===0x0){_0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x37')];}else{_0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x39')];}}}else if(_0x110af6['loggedIn']===0x0){_0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x3a')];}else if(!checkAnyValidTrunk(_0x110af6,_0x4186d2)){_0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x3b')];}else if(!isPreviewCampaign(_0x110af6)){var _0x170d94=checkAnyValidQueueCampaignInterval(_0x110af6);if(_0x170d94){_0xc5bebb=_0x170d94;}}return _0xc5bebb;}exports[_0xb4a7('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x11db7d){var _0x339172=CAMPAIGN_STATUS[_0xb4a7('0x39')];if(_0x11db7d[_0xb4a7('0x28')]===0x0&&_0x11db7d[_0xb4a7('0x38')]===0x0&&_0x11db7d['waiting']===0x0&&(_0x11db7d[_0xb4a7('0x25')]||0x0)===0x0){_0x339172=CAMPAIGN_STATUS[_0xb4a7('0x37')];}return _0x339172;}exports[_0xb4a7('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4c0ec3){var _0x5b4f7d=_0x4c0ec3[_0xb4a7('0x3e')](/"(.*?)"/);return _0x5b4f7d?_0x5b4f7d[0x1]:_0x4c0ec3;}exports[_0xb4a7('0x3f')]=extractCalleridName;function getCallerId(_0x831c47,_0x34ca9d,_0xa16fd8){if(!_['isUndefined'](_0xa16fd8)&&typeof _0xa16fd8===_0xb4a7('0x40')&&!_['isEmpty'](_0xa16fd8)){if(!_[_0xb4a7('0x41')](_0x34ca9d)&&typeof _0x34ca9d===_0xb4a7('0x40')&&!_[_0xb4a7('0x2f')](_0x34ca9d)){return util[_0xb4a7('0x42')]('\x22%s\x22\x20<%s>',_0x34ca9d,_0xa16fd8);}return util['format']('\x22%s\x22\x20<%s>',_0xa16fd8,_0xa16fd8);}if(!_[_0xb4a7('0x41')](_0x831c47)&&typeof _0x831c47==='string'&&!_[_0xb4a7('0x2f')](_0x831c47)){return _0x831c47;}return _0xb4a7('0x43');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x407646,_0x30126f){var _0x188489;var _0x3b0d18;var _0x5657eb;if(_0x30126f<=0x0){_0x30126f=0x1;}_0x188489=new RegExp(_0xb4a7('0x44')+_0x30126f+'}$');_0x3b0d18=Math[_0xb4a7('0x45')](0xa,_0x30126f-0x1);_0x5657eb=Math['pow'](0xa,_0x30126f)-0x1;return util[_0xb4a7('0x42')]('%s',_[_0xb4a7('0x46')](_0x407646,_0x188489,_[_0xb4a7('0x47')](_0x3b0d18,_0x5657eb)[_0xb4a7('0x48')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0xc01531){if(_0xc01531[_0xb4a7('0x28')]&&_0xc01531['originated']>0x0){_0xc01531[_0xb4a7('0x28')]-=0x1;}else{logger[_0xb4a7('0x49')](_0xb4a7('0x4a'));}}exports[_0xb4a7('0x4b')]=decrementOriginate;function checkContactEmpty(_0x171627){return _0x171627&&_0x171627['length']>0x0;}exports[_0xb4a7('0x4c')]=checkContactEmpty;function erlangb(_0x13663f,_0x59ecad){if(_0x59ecad===0x0){return 0x0;}var _0x278364=0x1;for(var _0x307681=0x1;_0x307681<=_0x59ecad;_0x307681+=0x1){_0x278364=0x1+_0x278364*_0x307681/_0x13663f;}return 0x1/_0x278364;}exports[_0xb4a7('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x53b67e,_0x4c6211,_0xce5835){if(_0x4c6211>_0xce5835){for(var _0x16bea7=0x0;_0x16bea7<_0x4c6211-_0xce5835;_0x16bea7+=0x1){decrementOriginate(_0x53b67e);}}}exports[_0xb4a7('0x4e')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index f2bf9ae..4be44ea 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(_0x365c8e,_0x1fbc99){var _0x241576=function(_0xb1d763){while(--_0xb1d763){_0x365c8e['push'](_0x365c8e['shift']());}};_0x241576(++_0x1fbc99);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x29d7fe,_0x80a093){var _0x20c127=function(_0x2ca2ef){while(--_0x2ca2ef){_0x29d7fe['push'](_0x29d7fe['shift']());}};_0x20c127(++_0x80a093);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 065a77b..4cc24a7 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 _0x8234=['then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','actions','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','name','parse','.pdf','application/pdf'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x8234,0xc3));var _0x4823=function(_0x4b287d,_0x2ea048){_0x4b287d=_0x4b287d-0x0;var _0x563b27=_0x8234[_0x4b287d];return _0x563b27;};'use strict';var util=require(_0x4823('0x0'));var _=require(_0x4823('0x1'));var BPromise=require(_0x4823('0x2'));var uuid=require(_0x4823('0x3'));var moment=require(_0x4823('0x4'));var path=require(_0x4823('0x5'));var tiff2pdf=require(_0x4823('0x6'));var gs=require('./util/gs');var logger=require(_0x4823('0x7'))(_0x4823('0x8'));var ami=require(_0x4823('0x9'));var rpcDb=require(_0x4823('0xa'));var Channel=require('./channel');var ut=require(_0x4823('0xb'));var Action=require(_0x4823('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x4823('0xd'));var faxMessage=require(_0x4823('0xe'));function Fax(_0x4f543d){this[_0x4823('0xf')]={};this[_0x4823('0x10')]=_0x4f543d[_0x4823('0x10')];this[_0x4823('0x11')]=_0x4f543d['trunks'];this['actions']={};ami['on'](_0x4823('0x12'),this[_0x4823('0x13')]['bind'](this));ami['on']('varset',this[_0x4823('0x14')][_0x4823('0x15')](this));ami['on'](_0x4823('0x16'),this[_0x4823('0x17')][_0x4823('0x15')](this));ami['on'](_0x4823('0x18'),this[_0x4823('0x19')]['bind'](this));ami['on']('faxstatus',this[_0x4823('0x1a')][_0x4823('0x15')](this));ami['on'](_0x4823('0x1b'),this[_0x4823('0x1c')][_0x4823('0x15')](this));ami['on'](_0x4823('0x1d'),this[_0x4823('0x1e')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x4823('0x15')](this));}Fax[_0x4823('0x1f')][_0x4823('0x13')]=function(_0x41e70a){if(_0x41e70a[_0x4823('0x20')]===_0x4823('0x21')){for(var _0x431ac9 in this['faxAccounts']){if(this[_0x4823('0x10')][_0x4823('0x22')](_0x431ac9)){if(_0x41e70a[_0x4823('0x23')]===this[_0x4823('0x10')][_0x431ac9][_0x4823('0x24')]){this['channels'][_0x41e70a[_0x4823('0x25')]]={};this[_0x4823('0xf')][_0x41e70a[_0x4823('0x25')]][_0x4823('0x26')]=_0x41e70a[_0x4823('0x26')];this[_0x4823('0xf')][_0x41e70a[_0x4823('0x25')]]['id']=this[_0x4823('0x10')][_0x431ac9]['id'];this['channels'][_0x41e70a[_0x4823('0x25')]]['name']=this['faxAccounts'][_0x431ac9]['name'];logger[_0x4823('0x27')](_0x41e70a[_0x4823('0x25')],_0x4823('0x28'));}}}}if(this['actions'][_0x41e70a[_0x4823('0x25')]]){this['channels'][_0x41e70a['uniqueid']]={};this[_0x4823('0xf')][_0x41e70a[_0x4823('0x25')]][_0x4823('0x26')]=_0x41e70a[_0x4823('0x26')];logger[_0x4823('0x27')](_0x41e70a['uniqueid'],_0x4823('0x28'));}};Fax[_0x4823('0x1f')][_0x4823('0x14')]=function(_0x573610){if(this['channels'][_0x573610['uniqueid']]){for(var _0x59770c in _0x573610[_0x4823('0x29')]){if(_0x573610['variable'][_0x4823('0x22')](_0x59770c)){this[_0x4823('0xf')][_0x573610[_0x4823('0x25')]][_0x59770c]=_0x573610[_0x4823('0x2a')];}}}};Fax['prototype']['syncNewState']=function(_0x5df55c){if(this[_0x4823('0xf')][_0x5df55c[_0x4823('0x25')]]){this['channels'][_0x5df55c[_0x4823('0x25')]][_0x4823('0x2b')]=_0x5df55c[_0x4823('0x2b')];this[_0x4823('0xf')][_0x5df55c[_0x4823('0x25')]][_0x4823('0x2c')]=_0x5df55c[_0x4823('0x2c')];}};Fax[_0x4823('0x1f')][_0x4823('0x19')]=function(_0x2a7fa4){if(this['channels'][_0x2a7fa4[_0x4823('0x25')]]){for(var _0x12af2a in _0x2a7fa4[_0x4823('0x29')]){if(_0x2a7fa4[_0x4823('0x29')]['hasOwnProperty'](_0x12af2a)){this[_0x4823('0xf')][_0x2a7fa4[_0x4823('0x25')]][_0x12af2a]=_0x2a7fa4[_0x4823('0x2a')];}}}};Fax[_0x4823('0x1f')]['syncFaxStatus']=function(_0x3d83e9){if(this['channels'][_0x3d83e9[_0x4823('0x25')]]){this[_0x4823('0xf')][_0x3d83e9[_0x4823('0x25')]]['operation']=_0x3d83e9[_0x4823('0x2d')];this['channels'][_0x3d83e9['uniqueid']]['status']=_0x3d83e9[_0x4823('0x2e')];this[_0x4823('0xf')][_0x3d83e9[_0x4823('0x25')]][_0x4823('0x24')]=_0x3d83e9['localstationid'];this[_0x4823('0xf')][_0x3d83e9[_0x4823('0x25')]][_0x4823('0x2f')]=_0x3d83e9[_0x4823('0x2f')];logger['info'](_0x3d83e9[_0x4823('0x25')],_0x4823('0x30'));}};Fax['prototype'][_0x4823('0x1c')]=function(_0x1a5418){var _0x394a15=this;if(this[_0x4823('0xf')][_0x1a5418[_0x4823('0x25')]]){var _0x4c3b86=this['channels'][_0x1a5418[_0x4823('0x25')]]['id'];this['channels'][_0x1a5418[_0x4823('0x25')]][_0x4823('0x31')]=_0x1a5418[_0x4823('0x31')];this[_0x4823('0xf')][_0x1a5418[_0x4823('0x25')]][_0x4823('0x32')]=_0x1a5418[_0x4823('0x32')];this[_0x4823('0xf')][_0x1a5418[_0x4823('0x25')]][_0x4823('0x24')]=_0x1a5418[_0x4823('0x24')];this[_0x4823('0xf')][_0x1a5418[_0x4823('0x25')]][_0x4823('0x33')]=_0x1a5418[_0x4823('0x33')];this['channels'][_0x1a5418[_0x4823('0x25')]]['transferrate']=_0x1a5418[_0x4823('0x34')];this[_0x4823('0xf')][_0x1a5418[_0x4823('0x25')]][_0x4823('0x2f')]=_0x1a5418[_0x4823('0x2f')];this['channels'][_0x1a5418[_0x4823('0x25')]][_0x4823('0x35')]=_0x1a5418['calleridnum'];if(this[_0x4823('0xf')][_0x1a5418['uniqueid']][_0x4823('0x32')]>0x0){tiff2pdf(_0x1a5418[_0x4823('0x2f')],_0x4823('0x36'),function(_0x4242fe){logger[_0x4823('0x27')](_0x1a5418[_0x4823('0x25')],_0x4823('0x37'),_0x4242fe['message']);attachment[_0x4823('0x38')]({'name':path['parse'](_0x1a5418[_0x4823('0x2f')])[_0x4823('0x39')],'basename':path[_0x4823('0x3a')](_0x1a5418[_0x4823('0x2f')])[_0x4823('0x39')]+_0x4823('0x3b'),'type':_0x4823('0x3c')})[_0x4823('0x3d')](function(_0xd8ec74){faxAccount[_0x4823('0x3e')](_0x4c3b86,{'from':_0x1a5418[_0x4823('0x35')],'mapKey':'fax','body':path[_0x4823('0x3a')](_0x1a5418[_0x4823('0x2f')])[_0x4823('0x39')]+_0x4823('0x3b'),'AttachmentId':_0xd8ec74['id']})[_0x4823('0x3f')](function(_0x46e284){logger[_0x4823('0x40')](_0x1a5418[_0x4823('0x25')],_0x4823('0x41'),JSON[_0x4823('0x42')](_0x46e284));});})['catch'](function(_0xdfa61e){logger[_0x4823('0x40')](_0x1a5418[_0x4823('0x25')],_0x4823('0x43'),JSON[_0x4823('0x42')](_0xdfa61e));});});}logger['info'](_0x1a5418[_0x4823('0x25')],'\x20receiveFax\x20');}};Fax[_0x4823('0x1f')][_0x4823('0x44')]=function(_0x12ece6){if(this[_0x4823('0x45')][_0x12ece6['uniqueid']]){_[_0x4823('0x46')](this['channels'][_0x12ece6[_0x4823('0x25')]],_[_0x4823('0x47')](_0x12ece6,[_0x4823('0x48'),_0x4823('0x49')]));}};function updateStatus(_0x52d634){if(_0x52d634[_0x4823('0x4a')]){faxMessage[_0x4823('0x4b')](_0x52d634['AttachmentId'],{'failMessage':_0x4823('0x4c')})['then'](function(_0x3fc1a3){ut['logger'](_0x4823('0x4d'),_0x3fc1a3);})[_0x4823('0x3f')](function(_0x1b0fcb){ut[_0x4823('0x4e')]('[Fax][Message][Error][NoUpdate1]',_0x1b0fcb);});}else{ut[_0x4823('0x4e')](_0x4823('0x4f'));}}Fax[_0x4823('0x1f')]['updateStatus']=function(_0x83b880,_0x3e5eb9,_0x23ec80){var _0x46294b=this;var _0x4e535e={};if(_0x3e5eb9){_0x4e535e={'read':_0x3e5eb9};}else{_0x4e535e={'failMessage':_0x23ec80};}if(this['actions'][_0x83b880]['AttachmentId']){faxMessage[_0x4823('0x4b')](this[_0x4823('0x45')][_0x83b880]['AttachmentId'],_0x4e535e)[_0x4823('0x3d')](function(_0x188b6c){ut[_0x4823('0x4e')](_0x4823('0x50'),_0x188b6c);})['catch'](function(_0x5bca82){ut[_0x4823('0x4e')](_0x4823('0x51'),_0x5bca82);})[_0x4823('0x52')](function(){delete _0x46294b[_0x4823('0xf')][_0x83b880];delete _0x46294b['actions'][_0x83b880];});}else{ut[_0x4823('0x4e')](_0x4823('0x53'));delete this[_0x4823('0xf')][_0x83b880];delete this[_0x4823('0x45')][_0x83b880];}};Fax['prototype'][_0x4823('0x1e')]=function(_0x52efca){var _0x136e09=this;if(this[_0x4823('0xf')][_0x52efca['uniqueid']]){if(this[_0x4823('0x45')][_0x52efca[_0x4823('0x25')]]){this[_0x4823('0xf')][_0x52efca[_0x4823('0x25')]]['id']=this[_0x4823('0x45')][_0x52efca['uniqueid']]['id'];this[_0x4823('0xf')][_0x52efca[_0x4823('0x25')]][_0x4823('0x39')]=this[_0x4823('0x45')][_0x52efca['uniqueid']]['name'];}logger['info'](_0x52efca[_0x4823('0x25')],this[_0x4823('0x45')][_0x52efca[_0x4823('0x25')]]?_0x4823('0x54'):_0x4823('0x55'),JSON[_0x4823('0x42')](this[_0x4823('0xf')][_0x52efca[_0x4823('0x25')]]));if(this['actions'][_0x52efca[_0x4823('0x25')]]){if(this[_0x4823('0xf')][_0x52efca[_0x4823('0x25')]][_0x4823('0x56')]>0x0&&this[_0x4823('0xf')][_0x52efca[_0x4823('0x25')]][_0x4823('0x57')]===_0x4823('0x58')){this[_0x4823('0x59')](_0x52efca[_0x4823('0x25')],!![]);}else{this['updateStatus'](_0x52efca[_0x4823('0x25')],![],this[_0x4823('0xf')][_0x52efca[_0x4823('0x25')]][_0x4823('0x5a')]?_0x4823('0x5b')+this[_0x4823('0xf')][_0x52efca[_0x4823('0x25')]][_0x4823('0x5a')]:_0x4823('0x5c'));}}}};Fax['prototype']['send']=function(_0x5ba080){var _0x30191f=this;return new BPromise(function(_0x3a7c92,_0x459a22){_0x30191f[_0x4823('0x5d')](_0x5ba080,_0x30191f['faxAccounts'][_0x5ba080[_0x4823('0x5e')]])[_0x4823('0x3d')](function(_0x362397){ut[_0x4823('0x4e')](_0x4823('0x5f'),_0x362397);_0x3a7c92(ut[_0x4823('0x60')](_0x4823('0x61')));})[_0x4823('0x3f')](function(_0x2d1c76){ut['logger'](_0x4823('0x62'),_0x2d1c76);updateStatus(_0x5ba080);_0x459a22(ut[_0x4823('0x60')](_0x4823('0x63')));});});};Fax[_0x4823('0x1f')][_0x4823('0x64')]=function(_0x4bc06a){var _0x57a376=this;return new BPromise(function(_0x1ab986,_0x59e665){var _0x474dc3=_0x57a376[_0x4823('0x65')](_0x57a376[_0x4823('0x10')][_0x4bc06a[_0x4823('0x5e')]]['Trunk'],_0x4bc06a);if(_0x474dc3[_0x4823('0x66')]){_0x1ab986(ut['message'](_0x4823('0x67')));}else{_0x59e665(ut['message'](_0x474dc3['message']));}});};function originate(_0x388671,_0x14dc26,_0x10bf58){return new BPromise(function(_0x28458a,_0x128569){if(_0x10bf58){var _0x12159c=util[_0x4823('0x68')](_0x4823('0x69'),path[_0x4823('0x3a')](_0x388671[_0x4823('0x5')])['name'],_0x388671[_0x4823('0x5')]);gs[_0x4823('0x6a')](_0x12159c)[_0x4823('0x3d')](function(){_0x388671[_0x4823('0x5')]=util[_0x4823('0x68')](_0x4823('0x6b'),path['parse'](_0x388671[_0x4823('0x5')])[_0x4823('0x6c')],path['parse'](_0x388671[_0x4823('0x5')])[_0x4823('0x39')]);_0x14dc26[_0x4823('0x6d')]=_0x388671[_0x4823('0x5')];ut[_0x4823('0x4e')](_0x4823('0x6e'),'');ami[_0x4823('0x6f')](ut['variablesAction'](_0x388671,_0x14dc26))[_0x4823('0x3d')](function(_0x114ba7){_0x28458a(_0x114ba7);})[_0x4823('0x3f')](function(_0xb81251){_0x128569(_0xb81251);});})[_0x4823('0x3f')](function(_0x2d8e15){_0x128569(_0x2d8e15);});}else{ami[_0x4823('0x6f')](ut[_0x4823('0x70')](_0x388671,_0x14dc26))[_0x4823('0x3d')](function(_0x1e5056){_0x28458a(_0x1e5056);})[_0x4823('0x3f')](function(_0x14aa1d){_0x128569(_0x14aa1d);});}});}Fax[_0x4823('0x1f')][_0x4823('0x5d')]=function(_0x3599c4,_0x1234fd){var _0x5107e5=this;return new BPromise(function(_0x932a67,_0x392488){var _0x2642be=uuid['v4']();var _0x4ab6f8=ut[_0x4823('0x71')](_0x3599c4,_0x1234fd);_0x5107e5[_0x4823('0x45')][_0x2642be]=new Action(_0x2642be,_0x1234fd,_0x3599c4);var _0x48cf3f=_0x5107e5[_0x4823('0x45')][_0x2642be];if(path[_0x4823('0x3a')](_0x3599c4['path'])[_0x4823('0x72')]==='.pdf'){originate(_0x48cf3f,_0x4ab6f8,!![])[_0x4823('0x3d')](function(_0x32677d){_0x932a67(_0x32677d);})['catch'](function(_0x5f39ae){_0x392488(_0x5f39ae);});}else{originate(_0x48cf3f,_0x4ab6f8,![])[_0x4823('0x3d')](function(_0x3c7b5c){_0x932a67(_0x3c7b5c);})[_0x4823('0x3f')](function(_0x40d419){_0x392488(_0x40d419);});}});};Fax[_0x4823('0x1f')][_0x4823('0x73')]=function(_0x58c197){return!_['isNil'](_0x58c197)&&!_[_0x4823('0x74')](_0x58c197['name'])&&!_[_0x4823('0x74')](_0x58c197[_0x4823('0x75')])&&_0x58c197[_0x4823('0x75')]&&!_[_0x4823('0x74')](this[_0x4823('0x11')][util[_0x4823('0x68')](_0x4823('0x76'),_0x58c197[_0x4823('0x39')])])&&!_['isNil'](this[_0x4823('0x11')][util[_0x4823('0x68')](_0x4823('0x76'),_0x58c197[_0x4823('0x39')])][_0x4823('0x2e')])&&(this[_0x4823('0x11')][util['format'](_0x4823('0x76'),_0x58c197[_0x4823('0x39')])]['status']===_0x4823('0x77')||this[_0x4823('0x11')][util['format'](_0x4823('0x76'),_0x58c197[_0x4823('0x39')])][_0x4823('0x2e')]==='unmonitored');};Fax[_0x4823('0x1f')]['checkTrunk']=function(_0x1ec49f,_0x1de47b){if(!this[_0x4823('0x73')](_0x1ec49f)){ut[_0x4823('0x4e')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x4823('0x74')](_0x1ec49f)?'':_0x1ec49f[_0x4823('0x39')]+_0x4823('0x78'));return{'isValid':![],'message':_0x4823('0x79')};}if(_[_0x4823('0x74')](_0x1de47b[_0x4823('0x8')])){ut[_0x4823('0x4e')](_0x4823('0x7a'),JSON[_0x4823('0x42')](_0x1de47b));return{'isValid':![],'message':_0x4823('0x7b')};}if(_[_0x4823('0x74')](_0x1de47b[_0x4823('0x5')])){ut['logger'](_0x4823('0x7c'),JSON[_0x4823('0x42')](_0x1de47b));return{'isValid':![],'message':_0x4823('0x7d')};}return{'isValid':!![],'message':_0x4823('0x7e')};};module[_0x4823('0x7f')]=Fax; \ No newline at end of file +var _0x57df=['originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup'];(function(_0x251646,_0x547f01){var _0x514c78=function(_0x232293){while(--_0x232293){_0x251646['push'](_0x251646['shift']());}};_0x514c78(++_0x547f01);}(_0x57df,0xd4));var _0xf57d=function(_0x3d7087,_0x26ab40){_0x3d7087=_0x3d7087-0x0;var _0x21d7c0=_0x57df[_0x3d7087];return _0x21d7c0;};'use strict';var util=require(_0xf57d('0x0'));var _=require('lodash');var BPromise=require(_0xf57d('0x1'));var uuid=require('uuid');var moment=require(_0xf57d('0x2'));var path=require(_0xf57d('0x3'));var tiff2pdf=require(_0xf57d('0x4'));var gs=require(_0xf57d('0x5'));var logger=require('../../../config/logger')('fax');var ami=require(_0xf57d('0x6'));var rpcDb=require(_0xf57d('0x7'));var Channel=require(_0xf57d('0x8'));var ut=require(_0xf57d('0x9'));var Action=require(_0xf57d('0xa'));var faxAccount=require(_0xf57d('0xb'));var attachment=require(_0xf57d('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x17ce6c){this[_0xf57d('0xd')]={};this[_0xf57d('0xe')]=_0x17ce6c[_0xf57d('0xe')];this['trunks']=_0x17ce6c[_0xf57d('0xf')];this[_0xf57d('0x10')]={};ami['on'](_0xf57d('0x11'),this[_0xf57d('0x12')][_0xf57d('0x13')](this));ami['on']('varset',this[_0xf57d('0x14')][_0xf57d('0x13')](this));ami['on'](_0xf57d('0x15'),this[_0xf57d('0x16')][_0xf57d('0x13')](this));ami['on'](_0xf57d('0x17'),this[_0xf57d('0x18')][_0xf57d('0x13')](this));ami['on'](_0xf57d('0x19'),this[_0xf57d('0x1a')]['bind'](this));ami['on'](_0xf57d('0x1b'),this[_0xf57d('0x1c')][_0xf57d('0x13')](this));ami['on'](_0xf57d('0x1d'),this['syncHangup']['bind'](this));ami['on'](_0xf57d('0x1e'),this[_0xf57d('0x1f')][_0xf57d('0x13')](this));}Fax[_0xf57d('0x20')]['syncNewchannel']=function(_0x497608){if(_0x497608[_0xf57d('0x21')]===_0xf57d('0x22')){for(var _0x5971d3 in this[_0xf57d('0xe')]){if(this['faxAccounts']['hasOwnProperty'](_0x5971d3)){if(_0x497608[_0xf57d('0x23')]===this[_0xf57d('0xe')][_0x5971d3][_0xf57d('0x24')]){this['channels'][_0x497608[_0xf57d('0x25')]]={};this[_0xf57d('0xd')][_0x497608[_0xf57d('0x25')]][_0xf57d('0x26')]=_0x497608[_0xf57d('0x26')];this['channels'][_0x497608[_0xf57d('0x25')]]['id']=this[_0xf57d('0xe')][_0x5971d3]['id'];this['channels'][_0x497608[_0xf57d('0x25')]][_0xf57d('0x27')]=this[_0xf57d('0xe')][_0x5971d3][_0xf57d('0x27')];logger[_0xf57d('0x28')](_0x497608[_0xf57d('0x25')],_0xf57d('0x29'));}}}}if(this['actions'][_0x497608[_0xf57d('0x25')]]){this[_0xf57d('0xd')][_0x497608['uniqueid']]={};this[_0xf57d('0xd')][_0x497608[_0xf57d('0x25')]]['channel']=_0x497608[_0xf57d('0x26')];logger[_0xf57d('0x28')](_0x497608[_0xf57d('0x25')],'\x20syncNewchannel\x20');}};Fax[_0xf57d('0x20')][_0xf57d('0x14')]=function(_0x376cf0){if(this[_0xf57d('0xd')][_0x376cf0['uniqueid']]){for(var _0x1a1bac in _0x376cf0['variable']){if(_0x376cf0[_0xf57d('0x2a')]['hasOwnProperty'](_0x1a1bac)){this[_0xf57d('0xd')][_0x376cf0['uniqueid']][_0x1a1bac]=_0x376cf0[_0xf57d('0x2b')];}}}};Fax['prototype'][_0xf57d('0x16')]=function(_0x466bb7){if(this[_0xf57d('0xd')][_0x466bb7[_0xf57d('0x25')]]){this[_0xf57d('0xd')][_0x466bb7[_0xf57d('0x25')]][_0xf57d('0x2c')]=_0x466bb7[_0xf57d('0x2c')];this[_0xf57d('0xd')][_0x466bb7[_0xf57d('0x25')]][_0xf57d('0x2d')]=_0x466bb7['channelstatedesc'];}};Fax[_0xf57d('0x20')][_0xf57d('0x18')]=function(_0x5c7deb){if(this[_0xf57d('0xd')][_0x5c7deb[_0xf57d('0x25')]]){for(var _0x537d8a in _0x5c7deb[_0xf57d('0x2a')]){if(_0x5c7deb['variable'][_0xf57d('0x2e')](_0x537d8a)){this['channels'][_0x5c7deb[_0xf57d('0x25')]][_0x537d8a]=_0x5c7deb['value'];}}}};Fax[_0xf57d('0x20')][_0xf57d('0x1a')]=function(_0x3418b6){if(this['channels'][_0x3418b6['uniqueid']]){this[_0xf57d('0xd')][_0x3418b6[_0xf57d('0x25')]][_0xf57d('0x2f')]=_0x3418b6['operation'];this[_0xf57d('0xd')][_0x3418b6[_0xf57d('0x25')]][_0xf57d('0x30')]=_0x3418b6[_0xf57d('0x30')];this[_0xf57d('0xd')][_0x3418b6[_0xf57d('0x25')]][_0xf57d('0x24')]=_0x3418b6[_0xf57d('0x24')];this[_0xf57d('0xd')][_0x3418b6[_0xf57d('0x25')]][_0xf57d('0x31')]=_0x3418b6[_0xf57d('0x31')];logger[_0xf57d('0x28')](_0x3418b6[_0xf57d('0x25')],_0xf57d('0x32'));}};Fax[_0xf57d('0x20')]['syncReceiveFax']=function(_0x4d38a0){var _0x573a21=this;if(this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]]){var _0x54394a=this[_0xf57d('0xd')][_0x4d38a0['uniqueid']]['id'];this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]]['remotestationid']=_0x4d38a0[_0xf57d('0x33')];this['channels'][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x34')]=_0x4d38a0[_0xf57d('0x34')];this['channels'][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x24')]=_0x4d38a0[_0xf57d('0x24')];this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x35')]=_0x4d38a0[_0xf57d('0x35')];this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x36')]=_0x4d38a0[_0xf57d('0x36')];this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x31')]=_0x4d38a0['filename'];this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]]['calleridnum']=_0x4d38a0[_0xf57d('0x37')];if(this['channels'][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x34')]>0x0){tiff2pdf(_0x4d38a0[_0xf57d('0x31')],_0xf57d('0x38'),function(_0x9b8fed){logger['info'](_0x4d38a0[_0xf57d('0x25')],'\x20result\x20conversion\x20file\x20',_0x9b8fed[_0xf57d('0x39')]);attachment[_0xf57d('0x3a')]({'name':path['parse'](_0x4d38a0[_0xf57d('0x31')])[_0xf57d('0x27')],'basename':path[_0xf57d('0x3b')](_0x4d38a0['filename'])['name']+'.pdf','type':_0xf57d('0x3c')})[_0xf57d('0x3d')](function(_0x57b686){faxAccount[_0xf57d('0x3e')](_0x54394a,{'from':_0x4d38a0[_0xf57d('0x37')],'mapKey':'fax','body':path[_0xf57d('0x3b')](_0x4d38a0[_0xf57d('0x31')])[_0xf57d('0x27')]+_0xf57d('0x3f'),'AttachmentId':_0x57b686['id']})[_0xf57d('0x40')](function(_0x4267d9){logger[_0xf57d('0x41')](_0x4d38a0['uniqueid'],_0xf57d('0x42'),JSON[_0xf57d('0x43')](_0x4267d9));});})[_0xf57d('0x40')](function(_0x56697d){logger['error'](_0x4d38a0['uniqueid'],_0xf57d('0x44'),JSON[_0xf57d('0x43')](_0x56697d));});});}logger[_0xf57d('0x28')](_0x4d38a0[_0xf57d('0x25')],_0xf57d('0x44'));}};Fax[_0xf57d('0x20')][_0xf57d('0x1f')]=function(_0x293d98){if(this['actions'][_0x293d98[_0xf57d('0x25')]]){_[_0xf57d('0x45')](this[_0xf57d('0xd')][_0x293d98[_0xf57d('0x25')]],_[_0xf57d('0x46')](_0x293d98,[_0xf57d('0x47'),_0xf57d('0x48')]));}};function updateStatus(_0xc10cbb){if(_0xc10cbb[_0xf57d('0x49')]){faxMessage['update'](_0xc10cbb[_0xf57d('0x49')],{'failMessage':_0xf57d('0x4a')})[_0xf57d('0x3d')](function(_0x1bfc95){ut[_0xf57d('0x4b')](_0xf57d('0x4c'),_0x1bfc95);})[_0xf57d('0x40')](function(_0x216448){ut[_0xf57d('0x4b')](_0xf57d('0x4d'),_0x216448);});}else{ut[_0xf57d('0x4b')](_0xf57d('0x4e'));}}Fax[_0xf57d('0x20')][_0xf57d('0x4f')]=function(_0xe591c2,_0x4a2384,_0x4f6cab){var _0x365a19=this;var _0x5723eb={};if(_0x4a2384){_0x5723eb={'read':_0x4a2384};}else{_0x5723eb={'failMessage':_0x4f6cab};}if(this['actions'][_0xe591c2][_0xf57d('0x49')]){faxMessage[_0xf57d('0x50')](this[_0xf57d('0x10')][_0xe591c2]['AttachmentId'],_0x5723eb)[_0xf57d('0x3d')](function(_0x481a56){ut[_0xf57d('0x4b')]('[Fax][Message][Updated]',_0x481a56);})[_0xf57d('0x40')](function(_0x1f9c65){ut[_0xf57d('0x4b')]('[Fax][Message][NoUpdate1]',_0x1f9c65);})['finally'](function(){delete _0x365a19[_0xf57d('0xd')][_0xe591c2];delete _0x365a19['actions'][_0xe591c2];});}else{ut['logger'](_0xf57d('0x51'));delete this['channels'][_0xe591c2];delete this[_0xf57d('0x10')][_0xe591c2];}};Fax['prototype'][_0xf57d('0x52')]=function(_0x2a3144){var _0x499de0=this;if(this['channels'][_0x2a3144[_0xf57d('0x25')]]){if(this[_0xf57d('0x10')][_0x2a3144[_0xf57d('0x25')]]){this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]]['id']=this[_0xf57d('0x10')][_0x2a3144['uniqueid']]['id'];this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]][_0xf57d('0x27')]=this[_0xf57d('0x10')][_0x2a3144[_0xf57d('0x25')]][_0xf57d('0x27')];}logger[_0xf57d('0x28')](_0x2a3144[_0xf57d('0x25')],this[_0xf57d('0x10')][_0x2a3144[_0xf57d('0x25')]]?_0xf57d('0x53'):_0xf57d('0x54'),JSON[_0xf57d('0x43')](this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]]));if(this[_0xf57d('0x10')][_0x2a3144['uniqueid']]){if(this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]][_0xf57d('0x55')]>0x0&&this['channels'][_0x2a3144['uniqueid']]['faxstatus']==='SUCCESS'){this[_0xf57d('0x4f')](_0x2a3144[_0xf57d('0x25')],!![]);}else{this[_0xf57d('0x4f')](_0x2a3144[_0xf57d('0x25')],![],this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]][_0xf57d('0x56')]?'SENDING\x20FAILED:\x20'+this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]][_0xf57d('0x56')]:'SENDING\x20FAILED');}}}};Fax[_0xf57d('0x20')][_0xf57d('0x57')]=function(_0x59bbb2){var _0x4dd4cf=this;return new BPromise(function(_0x5232aa,_0x1ebf2f){_0x4dd4cf[_0xf57d('0x58')](_0x59bbb2,_0x4dd4cf[_0xf57d('0xe')][_0x59bbb2[_0xf57d('0x59')]])[_0xf57d('0x3d')](function(_0x9fca0a){ut[_0xf57d('0x4b')]('[Fax][execOriginate][success]',_0x9fca0a);_0x5232aa(ut[_0xf57d('0x39')](_0xf57d('0x5a')));})[_0xf57d('0x40')](function(_0x9112b5){ut[_0xf57d('0x4b')](_0xf57d('0x5b'),_0x9112b5);updateStatus(_0x59bbb2);_0x1ebf2f(ut[_0xf57d('0x39')](_0xf57d('0x5c')));});});};Fax['prototype'][_0xf57d('0x5d')]=function(_0x11b8bd){var _0x2e7b2f=this;return new BPromise(function(_0xe1cac2,_0x3283e1){var _0x3f4f7d=_0x2e7b2f[_0xf57d('0x5e')](_0x2e7b2f[_0xf57d('0xe')][_0x11b8bd[_0xf57d('0x59')]][_0xf57d('0x5f')],_0x11b8bd);if(_0x3f4f7d['isValid']){_0xe1cac2(ut[_0xf57d('0x39')](_0xf57d('0x60')));}else{_0x3283e1(ut[_0xf57d('0x39')](_0x3f4f7d[_0xf57d('0x39')]));}});};function originate(_0x2d144d,_0xc433c3,_0x54e0d1){return new BPromise(function(_0xb18458,_0x208a6d){if(_0x54e0d1){var _0x2f164b=util[_0xf57d('0x61')](_0xf57d('0x62'),path[_0xf57d('0x3b')](_0x2d144d[_0xf57d('0x3')])['name'],_0x2d144d[_0xf57d('0x3')]);gs[_0xf57d('0x63')](_0x2f164b)[_0xf57d('0x3d')](function(){_0x2d144d['path']=util[_0xf57d('0x61')](_0xf57d('0x64'),path[_0xf57d('0x3b')](_0x2d144d['path'])['dir'],path['parse'](_0x2d144d['path'])[_0xf57d('0x27')]);_0xc433c3[_0xf57d('0x65')]=_0x2d144d[_0xf57d('0x3')];ut[_0xf57d('0x4b')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0xf57d('0x66')](_0x2d144d,_0xc433c3))[_0xf57d('0x3d')](function(_0x3c113b){_0xb18458(_0x3c113b);})['catch'](function(_0x4fa15d){_0x208a6d(_0x4fa15d);});})['catch'](function(_0x3e4c6f){_0x208a6d(_0x3e4c6f);});}else{ami['Action'](ut[_0xf57d('0x66')](_0x2d144d,_0xc433c3))['then'](function(_0x2449f2){_0xb18458(_0x2449f2);})['catch'](function(_0x326a24){_0x208a6d(_0x326a24);});}});}Fax[_0xf57d('0x20')]['execOriginate']=function(_0x3878e2,_0x155030){var _0x409466=this;return new BPromise(function(_0x1c423c,_0x245ea1){var _0x3343bb=uuid['v4']();var _0x10fbc7=ut[_0xf57d('0x67')](_0x3878e2,_0x155030);_0x409466[_0xf57d('0x10')][_0x3343bb]=new Action(_0x3343bb,_0x155030,_0x3878e2);var _0x29d908=_0x409466[_0xf57d('0x10')][_0x3343bb];if(path[_0xf57d('0x3b')](_0x3878e2[_0xf57d('0x3')])[_0xf57d('0x68')]===_0xf57d('0x3f')){originate(_0x29d908,_0x10fbc7,!![])['then'](function(_0x1a6edd){_0x1c423c(_0x1a6edd);})[_0xf57d('0x40')](function(_0x4029bc){_0x245ea1(_0x4029bc);});}else{originate(_0x29d908,_0x10fbc7,![])[_0xf57d('0x3d')](function(_0x2c50e5){_0x1c423c(_0x2c50e5);})[_0xf57d('0x40')](function(_0xbcf780){_0x245ea1(_0xbcf780);});}});};Fax[_0xf57d('0x20')][_0xf57d('0x69')]=function(_0x14f343){return!_[_0xf57d('0x6a')](_0x14f343)&&!_['isNil'](_0x14f343[_0xf57d('0x27')])&&!_['isNil'](_0x14f343[_0xf57d('0x6b')])&&_0x14f343[_0xf57d('0x6b')]&&!_[_0xf57d('0x6a')](this[_0xf57d('0xf')][util[_0xf57d('0x61')]('SIP/%s',_0x14f343[_0xf57d('0x27')])])&&!_['isNil'](this[_0xf57d('0xf')][util[_0xf57d('0x61')]('SIP/%s',_0x14f343[_0xf57d('0x27')])][_0xf57d('0x30')])&&(this[_0xf57d('0xf')][util[_0xf57d('0x61')](_0xf57d('0x6c'),_0x14f343[_0xf57d('0x27')])][_0xf57d('0x30')]===_0xf57d('0x6d')||this[_0xf57d('0xf')][util['format']('SIP/%s',_0x14f343[_0xf57d('0x27')])]['status']===_0xf57d('0x6e'));};Fax['prototype']['checkTrunk']=function(_0x4c3e80,_0xf4fd66){if(!this[_0xf57d('0x69')](_0x4c3e80)){ut[_0xf57d('0x4b')](_0xf57d('0x6f'),_[_0xf57d('0x6a')](_0x4c3e80)?'':_0x4c3e80['name']+_0xf57d('0x70'));return{'isValid':![],'message':_0xf57d('0x71')};}if(_[_0xf57d('0x6a')](_0xf4fd66[_0xf57d('0x72')])){ut[_0xf57d('0x4b')](_0xf57d('0x73'),JSON['stringify'](_0xf4fd66));return{'isValid':![],'message':_0xf57d('0x74')};}if(_[_0xf57d('0x6a')](_0xf4fd66[_0xf57d('0x3')])){ut[_0xf57d('0x4b')](_0xf57d('0x75'),JSON['stringify'](_0xf4fd66));return{'isValid':![],'message':_0xf57d('0x76')};}return{'isValid':!![],'message':_0xf57d('0x77')};};module[_0xf57d('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 85eaeb2..ebe7a4b 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 _0x159d=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','notify','resolve','then','catch'];(function(_0x2e9c5e,_0x2ca9bf){var _0x1b9616=function(_0x34f70f){while(--_0x34f70f){_0x2e9c5e['push'](_0x2e9c5e['shift']());}};_0x1b9616(++_0x2ca9bf);}(_0x159d,0x19a));var _0xd159=function(_0x2629f2,_0x2ac3de){_0x2629f2=_0x2629f2-0x0;var _0x5a59e4=_0x159d[_0x2629f2];return _0x5a59e4;};'use strict';var util=require(_0xd159('0x0'));var BPromise=require(_0xd159('0x1'));var logger=require(_0xd159('0x2'))(_0xd159('0x3'));var _=require(_0xd159('0x4'));var faxAccount=require(_0xd159('0x5'));function loggerCatch(_0x3c9d60){return function(_0x408e8e){logger['error'](_0x3c9d60,util['inspect'](_0x408e8e,{'showHidden':![],'depth':null}));};}exports[_0xd159('0x6')]=function(_0x501705,_0x1fef16){return BPromise[_0xd159('0x7')]()[_0xd159('0x8')](faxAccount['notify'](_0x501705,_0x1fef16))[_0xd159('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x0321=['then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','notify','resolve'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0x0321,0x116));var _0x1032=function(_0x3342de,_0x5cb38b){_0x3342de=_0x3342de-0x0;var _0x5b2749=_0x0321[_0x3342de];return _0x5b2749;};'use strict';var util=require(_0x1032('0x0'));var BPromise=require(_0x1032('0x1'));var logger=require(_0x1032('0x2'))(_0x1032('0x3'));var _=require(_0x1032('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x510e23){return function(_0x3e2402){logger[_0x1032('0x5')](_0x510e23,util['inspect'](_0x3e2402,{'showHidden':![],'depth':null}));};}exports[_0x1032('0x6')]=function(_0x493e5b,_0x63644c){return BPromise[_0x1032('0x7')]()[_0x1032('0x8')](faxAccount['notify'](_0x493e5b,_0x63644c))[_0x1032('0x9')](loggerCatch(_0x1032('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 3e55c61..077bf43 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 _0x3f99=['execute','info','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x2e6200,_0x579b30){var _0x4520d1=function(_0x404bbe){while(--_0x404bbe){_0x2e6200['push'](_0x2e6200['shift']());}};_0x4520d1(++_0x579b30);}(_0x3f99,0xa2));var _0x93f9=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x3f99[_0x1a0600];return _0x734670;};'use strict';var util=require(_0x93f9('0x0'));var logger=require(_0x93f9('0x1'))(_0x93f9('0x2'));var BPromise=require(_0x93f9('0x3'));var exec=require(_0x93f9('0x4'))[_0x93f9('0x5')];exports[_0x93f9('0x6')]=function(_0x95993a){return new BPromise(function(_0x3f3dde,_0x154cbf){exec(_0x95993a,function(_0x5a5f5f,_0x20a0e4,_0x4e088a){logger['info']('Exec\x20gs',_0x20a0e4);if(_0x5a5f5f){logger[_0x93f9('0x7')]('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x5a5f5f,{'showHidden':![],'depth':null}),_0x20a0e4,_0x4e088a);_0x154cbf(_0x5a5f5f);}_0x3f3dde(_0x20a0e4);});});}; \ No newline at end of file +var _0x57b5=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','child_process'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x57b5,0x12f));var _0x557b=function(_0x396b44,_0x53777a){_0x396b44=_0x396b44-0x0;var _0x170b96=_0x57b5[_0x396b44];return _0x170b96;};'use strict';var util=require(_0x557b('0x0'));var logger=require(_0x557b('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0x557b('0x2'))[_0x557b('0x3')];exports[_0x557b('0x4')]=function(_0x34794b){return new BPromise(function(_0x17eafc,_0x2920e0){exec(_0x34794b,function(_0x2aa281,_0x4c8c9f,_0x38b107){logger[_0x557b('0x5')](_0x557b('0x6'),_0x4c8c9f);if(_0x2aa281){logger[_0x557b('0x5')]('Exec\x20gs',_0x557b('0x7'),util[_0x557b('0x8')](_0x2aa281,{'showHidden':![],'depth':null}),_0x4c8c9f,_0x38b107);_0x2920e0(_0x2aa281);}_0x17eafc(_0x4c8c9f);});});}; \ 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 5b8baf4..39c3b41 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 _0x7115=['\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip'];(function(_0x40a4a1,_0x4d3316){var _0x2be62d=function(_0x1c58d6){while(--_0x1c58d6){_0x40a4a1['push'](_0x40a4a1['shift']());}};_0x2be62d(++_0x4d3316);}(_0x7115,0x17b));var _0x5711=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x7115[_0x3de7e0];return _0x11d0b3;};'use strict';var util=require(_0x5711('0x0'));var _=require(_0x5711('0x1'));var moment=require(_0x5711('0x2'));var logger=require(_0x5711('0x3'))(_0x5711('0x4'));exports[_0x5711('0x5')]=function(_0x1280cf){return{'message':_0x1280cf};};exports[_0x5711('0x6')]=function(_0x4bfe9c,_0x48fda4){logger[_0x5711('0x7')](_0x4bfe9c,util[_0x5711('0x8')](_0x48fda4,{'showHidden':![],'depth':null}));};exports[_0x5711('0x9')]=function(_0x5d3689,_0x3d01ec){var _0x329c1f={'XMF-ECM':_0x3d01ec[_0x5711('0xa')],'XMF-HEADERINFO':_0x3d01ec[_0x5711('0xb')],'XMF-MINRATE':_0x3d01ec[_0x5711('0xc')],'XMF-MAXRATE':_0x3d01ec[_0x5711('0xd')],'XMF-MODEM':util[_0x5711('0xe')](_0x5711('0xf'),_0x3d01ec['modem']),'XMF-GATEWAY':_0x3d01ec[_0x5711('0x10')],'XMF-FAXDETECT':_0x3d01ec[_0x5711('0x11')],'XMF-T38TIMEOUT':_0x3d01ec[_0x5711('0x12')],'XMF-LOCALSTATIONID':_0x3d01ec[_0x5711('0x13')],'XMF-PATH':_0x5d3689[_0x5711('0x14')]};return _0x329c1f;};exports[_0x5711('0x15')]=function(_0x564a0c,_0x5bd729){return{'actionid':_0x564a0c[_0x5711('0x16')],'action':'originate','channel':_0x564a0c[_0x5711('0x17')],'Exten':_0x5711('0x18'),'Context':_0x5711('0x19'),'Priority':'1','callerid':util[_0x5711('0xe')](_0x5711('0x1a'),_0x564a0c[_0x5711('0xb')]?_0x564a0c[_0x5711('0xb')]:'',_0x564a0c[_0x5711('0x13')]),'variable':_0x5bd729,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x564a0c[_0x5711('0x16')]};}; \ No newline at end of file +var _0xe70c=['maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','minrate'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe70c,0x145));var _0xce70=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe70c[_0x4154a6];return _0x3b2786;};'use strict';var util=require(_0xce70('0x0'));var _=require(_0xce70('0x1'));var moment=require(_0xce70('0x2'));var logger=require(_0xce70('0x3'))(_0xce70('0x4'));exports[_0xce70('0x5')]=function(_0x381f6f){return{'message':_0x381f6f};};exports[_0xce70('0x6')]=function(_0x22f68c,_0x38fb61){logger[_0xce70('0x7')](_0x22f68c,util[_0xce70('0x8')](_0x38fb61,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x25d099,_0x848e29){var _0x1703fc={'XMF-ECM':_0x848e29[_0xce70('0x9')],'XMF-HEADERINFO':_0x848e29['headerinfo'],'XMF-MINRATE':_0x848e29[_0xce70('0xa')],'XMF-MAXRATE':_0x848e29[_0xce70('0xb')],'XMF-MODEM':util[_0xce70('0xc')]('\x22%s\x22',_0x848e29[_0xce70('0xd')]),'XMF-GATEWAY':_0x848e29[_0xce70('0xe')],'XMF-FAXDETECT':_0x848e29[_0xce70('0xf')],'XMF-T38TIMEOUT':_0x848e29[_0xce70('0x10')],'XMF-LOCALSTATIONID':_0x848e29[_0xce70('0x11')],'XMF-PATH':_0x25d099[_0xce70('0x12')]};return _0x1703fc;};exports[_0xce70('0x13')]=function(_0x12101b,_0x171a41){return{'actionid':_0x12101b[_0xce70('0x14')],'action':_0xce70('0x15'),'channel':_0x12101b['channel'],'Exten':'xcally-motion-fax','Context':_0xce70('0x16'),'Priority':'1','callerid':util[_0xce70('0xc')](_0xce70('0x17'),_0x12101b['headerinfo']?_0x12101b['headerinfo']:'',_0x12101b['localstationid']),'variable':_0x171a41,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x12101b[_0xce70('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 11936ce..b1aa1bd 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 _0xdb16=['listen','error','[index.js][main]','util','moment','./report','./acw','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','[index.js][initParams]','inspect'];(function(_0x3e8861,_0x35e7c5){var _0x3e6958=function(_0x22de31){while(--_0x22de31){_0x3e8861['push'](_0x3e8861['shift']());}};_0x3e6958(++_0x35e7c5);}(_0xdb16,0x1b3));var _0x6db1=function(_0x560232,_0x3d3008){_0x560232=_0x560232-0x0;var _0x478ab6=_0xdb16[_0x560232];return _0x478ab6;};'use strict';var util=require(_0x6db1('0x0'));var moment=require(_0x6db1('0x1'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x6db1('0x2'));var Acw=require(_0x6db1('0x3'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x6db1('0x4'));var Fax=require(_0x6db1('0x5'));var user=require(_0x6db1('0x6'));var voiceQueue=require(_0x6db1('0x7'));var voiceQueueReport=require(_0x6db1('0x8'));var voiceCallReport=require(_0x6db1('0x9'));var trunk=require(_0x6db1('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x6db1('0xb'));var cmHopperHistory=require(_0x6db1('0xc'));var campaign=require(_0x6db1('0xd'));var voiceExtension=require(_0x6db1('0xe'));var faxAccount=require(_0x6db1('0xf'));var zendesk=require(_0x6db1('0x10'));var salesforce=require(_0x6db1('0x11'));var sugarcrm=require(_0x6db1('0x12'));var freshdesk=require(_0x6db1('0x13'));var desk=require(_0x6db1('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x6db1('0x15'));var freshsales=require(_0x6db1('0x16'));var servicenow=require(_0x6db1('0x17'));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(_0x6db1('0x18'))(_0x6db1('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6db1('0x1a')](_0x6db1('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x6db1('0x1c')]()[_0x6db1('0x1d')](user[_0x6db1('0x1e')]())['then'](realtime[_0x6db1('0x1f')]())[_0x6db1('0x1d')](user['getTelephones']())[_0x6db1('0x1d')](realtime[_0x6db1('0x20')]())[_0x6db1('0x1d')](trunk['getTrunks']())[_0x6db1('0x1d')](realtime[_0x6db1('0x21')]())[_0x6db1('0x1d')](voiceQueue[_0x6db1('0x22')]())['then'](realtime['initVoiceQueues']())[_0x6db1('0x1d')](trigger[_0x6db1('0x23')]())['then'](realtime['initTriggers']())[_0x6db1('0x1d')](template[_0x6db1('0x24')]())['then'](realtime[_0x6db1('0x25')]())[_0x6db1('0x1d')](zendesk[_0x6db1('0x26')]())[_0x6db1('0x1d')](realtime[_0x6db1('0x27')]())[_0x6db1('0x1d')](salesforce[_0x6db1('0x28')]())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x6db1('0x29')]())[_0x6db1('0x1d')](realtime[_0x6db1('0x2a')]())[_0x6db1('0x1d')](freshdesk[_0x6db1('0x2b')]())[_0x6db1('0x1d')](realtime[_0x6db1('0x2c')]())['then'](desk[_0x6db1('0x2d')]())[_0x6db1('0x1d')](realtime[_0x6db1('0x2e')]())[_0x6db1('0x1d')](zoho[_0x6db1('0x2f')]())['then'](realtime[_0x6db1('0x30')]())[_0x6db1('0x1d')](vtiger[_0x6db1('0x31')]())[_0x6db1('0x1d')](realtime[_0x6db1('0x32')]())[_0x6db1('0x1d')](freshsales['getFreshsalesAccounts']())[_0x6db1('0x1d')](realtime[_0x6db1('0x33')]())[_0x6db1('0x1d')](servicenow[_0x6db1('0x34')]())[_0x6db1('0x1d')](realtime[_0x6db1('0x35')]())['then'](dynamics365[_0x6db1('0x36')]())[_0x6db1('0x1d')](realtime['initDynamics365Accounts']())[_0x6db1('0x1d')](campaign[_0x6db1('0x37')]())['then'](realtime['initCampaigns']())[_0x6db1('0x1d')](voiceExtension[_0x6db1('0x38')]())[_0x6db1('0x1d')](realtime[_0x6db1('0x39')]())[_0x6db1('0x1d')](faxAccount[_0x6db1('0x3a')]())[_0x6db1('0x1d')](realtime[_0x6db1('0x3b')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x6db1('0x1c')]()['then'](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x6db1('0x3c')]())[_0x6db1('0x1d')](cmHopperHistory[_0x6db1('0x3d')]())[_0x6db1('0x1d')](realtime[_0x6db1('0x3e')]())[_0x6db1('0x1d')](cmHopperHistory[_0x6db1('0x3f')]())[_0x6db1('0x1d')](realtime[_0x6db1('0x40')]())[_0x6db1('0x1d')](voiceCallReport[_0x6db1('0x41')]())[_0x6db1('0x1d')](realtime['initVoiceCallReports']())[_0x6db1('0x42')](function(_0x13f0f2){logger['error'](_0x6db1('0x43'),util[_0x6db1('0x44')](_0x13f0f2,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6db1('0x45')](realtime,preview,fax)[_0x6db1('0x1d')](function(){return initRealtime();})[_0x6db1('0x1d')](function(){return initParams();})[_0x6db1('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x3e583e){logger[_0x6db1('0x46')](_0x6db1('0x47'),util[_0x6db1('0x44')](_0x3e583e,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x86f6=['get','hour','then','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','inspect','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami'];(function(_0x480eb,_0x3f012c){var _0x3a4b72=function(_0x2948db){while(--_0x2948db){_0x480eb['push'](_0x480eb['shift']());}};_0x3a4b72(++_0x3f012c);}(_0x86f6,0x146));var _0x686f=function(_0x59394c,_0x1c325f){_0x59394c=_0x59394c-0x0;var _0x3668ad=_0x86f6[_0x59394c];return _0x3668ad;};'use strict';var util=require(_0x686f('0x0'));var moment=require('moment');var server=require(_0x686f('0x1'));var Realtime=require(_0x686f('0x2'));var Report=require(_0x686f('0x3'));var Acw=require(_0x686f('0x4'));var Trigger=require(_0x686f('0x5'));var Dialer=require(_0x686f('0x6'));var Preview=require(_0x686f('0x7'));var Fax=require('./fax');var user=require(_0x686f('0x8'));var voiceQueue=require(_0x686f('0x9'));var voiceQueueReport=require(_0x686f('0xa'));var voiceCallReport=require(_0x686f('0xb'));var trunk=require(_0x686f('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x686f('0xd'));var cmHopperHistory=require(_0x686f('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x686f('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x686f('0x10'));var salesforce=require(_0x686f('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x686f('0x12'));var desk=require(_0x686f('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x686f('0x14'));var dynamics365=require(_0x686f('0x15'));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(_0x686f('0x16'))(_0x686f('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x686f('0x18')](_0x686f('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x686f('0x18')](_0x686f('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x686f('0x1a')](user['getAgents']())[_0x686f('0x1a')](realtime[_0x686f('0x1b')]())[_0x686f('0x1a')](user['getTelephones']())[_0x686f('0x1a')](realtime[_0x686f('0x1c')]())[_0x686f('0x1a')](trunk[_0x686f('0x1d')]())[_0x686f('0x1a')](realtime[_0x686f('0x1e')]())[_0x686f('0x1a')](voiceQueue[_0x686f('0x1f')]())[_0x686f('0x1a')](realtime[_0x686f('0x20')]())[_0x686f('0x1a')](trigger[_0x686f('0x21')]())['then'](realtime['initTriggers']())['then'](template[_0x686f('0x22')]())['then'](realtime[_0x686f('0x23')]())['then'](zendesk['getZendeskAccounts']())[_0x686f('0x1a')](realtime[_0x686f('0x24')]())['then'](salesforce[_0x686f('0x25')]())['then'](realtime[_0x686f('0x26')]())[_0x686f('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x686f('0x1a')](realtime['initSugarcrmAccounts']())[_0x686f('0x1a')](freshdesk[_0x686f('0x27')]())[_0x686f('0x1a')](realtime[_0x686f('0x28')]())[_0x686f('0x1a')](desk[_0x686f('0x29')]())['then'](realtime['initDeskAccounts']())[_0x686f('0x1a')](zoho[_0x686f('0x2a')]())[_0x686f('0x1a')](realtime[_0x686f('0x2b')]())[_0x686f('0x1a')](vtiger[_0x686f('0x2c')]())[_0x686f('0x1a')](realtime['initVtigerAccounts']())['then'](freshsales[_0x686f('0x2d')]())[_0x686f('0x1a')](realtime[_0x686f('0x2e')]())['then'](servicenow[_0x686f('0x2f')]())[_0x686f('0x1a')](realtime[_0x686f('0x30')]())[_0x686f('0x1a')](dynamics365[_0x686f('0x31')]())[_0x686f('0x1a')](realtime[_0x686f('0x32')]())[_0x686f('0x1a')](campaign['getCampaigns']())[_0x686f('0x1a')](realtime[_0x686f('0x33')]())[_0x686f('0x1a')](voiceExtension[_0x686f('0x34')]())['then'](realtime[_0x686f('0x35')]())[_0x686f('0x1a')](faxAccount[_0x686f('0x36')]())[_0x686f('0x1a')](realtime[_0x686f('0x37')]())[_0x686f('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x686f('0x38')]()['then'](voiceQueueReport[_0x686f('0x39')]())[_0x686f('0x1a')](realtime[_0x686f('0x3a')]())['then'](cmHopperHistory[_0x686f('0x3b')]())['then'](realtime[_0x686f('0x3c')]())[_0x686f('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0x686f('0x1a')](realtime[_0x686f('0x3d')]())[_0x686f('0x1a')](voiceCallReport[_0x686f('0x3e')]())[_0x686f('0x1a')](realtime['initVoiceCallReports']())[_0x686f('0x3f')](function(_0x32c44c){logger[_0x686f('0x40')](_0x686f('0x41'),util['inspect'](_0x32c44c,{'showHidden':![],'depth':null}));});}function main(){return server[_0x686f('0x42')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x686f('0x1a')](function(){return initParams();})['then'](function(){report[_0x686f('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x53ce93){logger[_0x686f('0x40')](_0x686f('0x44'),util[_0x686f('0x45')](_0x53ce93,{'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 e173a32..964895d 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 _0x9dff=['fullname','state','unknown','stateTime','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','toLowerCase','inuse','talking','statePause','toNumber','format','address','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','redis','defaults','socket.io-emitter','name','email','accountcode'];(function(_0x22708b,_0x2bee57){var _0x3e0055=function(_0x2215a2){while(--_0x2215a2){_0x22708b['push'](_0x22708b['shift']());}};_0x3e0055(++_0x2bee57);}(_0x9dff,0x117));var _0xf9df=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x9dff[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf9df('0x0'));var md5=require(_0xf9df('0x1'));var Redis=require(_0xf9df('0x2'));var config=require('../../../config/environment');config[_0xf9df('0x3')]=_[_0xf9df('0x4')](config[_0xf9df('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xf9df('0x5'))(new Redis(config[_0xf9df('0x3')]));function Agent(_0xf8f095){this['id']=_0xf8f095['id']||0x0;this['name']=_0xf8f095[_0xf9df('0x6')]||'';this[_0xf9df('0x7')]=_0xf8f095['email']||'';this[_0xf9df('0x8')]=_0xf8f095['accountcode']||'';this[_0xf9df('0x9')]=_0xf8f095[_0xf9df('0x9')]||'';this[_0xf9df('0xa')]=_0xf9df('0xb');this[_0xf9df('0xc')]=0x0;this['status']=_0xf9df('0xb');this['address']='';this[_0xf9df('0xd')]='';this[_0xf9df('0xe')]='';this[_0xf9df('0xf')]='';this[_0xf9df('0x10')]=_0xf8f095[_0xf9df('0x10')]||![];this[_0xf9df('0x11')]=_0xf9df('0xb');this[_0xf9df('0x12')]=0x0;this[_0xf9df('0x13')]='';this[_0xf9df('0x14')]='';this[_0xf9df('0x15')]=![];this['local']=![];this['md5']='';}Agent[_0xf9df('0x16')][_0xf9df('0x17')]=function(_0x3424ff){var _0x385a55;if(_0x3424ff&&_0x3424ff[_0xf9df('0xa')]){_0x385a55=_0x3424ff[_0xf9df('0xa')][_0xf9df('0x18')]();switch(_0x385a55){case'not_inuse':_0x385a55='idle';break;case _0xf9df('0x19'):_0x385a55=_0xf9df('0x1a');break;}}if(_0x385a55&&this['voiceStatus']!==_0x385a55||_0x3424ff[_0xf9df('0x1b')]){this['voiceStatusTime']=_[_0xf9df('0x1c')](moment()[_0xf9df('0x1d')]('x'));}if(_0x385a55){this['voiceStatus']=_0x385a55;}var _0x1c9b1f={'id':this['id'],'name':this[_0xf9df('0x6')],'email':this[_0xf9df('0x7')],'accountcode':this[_0xf9df('0x8')],'fullname':this[_0xf9df('0x9')],'state':this[_0xf9df('0xa')],'stateTime':this[_0xf9df('0xc')],'status':this['status'],'address':this[_0xf9df('0x1e')],'online':this[_0xf9df('0x10')],'voiceStatus':this[_0xf9df('0x11')],'voiceStatusTime':this[_0xf9df('0x12')],'voiceStatusCallerIdNumber':this[_0xf9df('0x13')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xf9df('0xf')],'onhold':this[_0xf9df('0x15')]};var _0xdf0000=md5(JSON['stringify'](_0x1c9b1f));if(this[_0xf9df('0x1')]!==_0xdf0000){this[_0xf9df('0x1')]=_0xdf0000;io['to'](util[_0xf9df('0x1d')](_0xf9df('0x1f'),_0x1c9b1f[_0xf9df('0x6')]))[_0xf9df('0x20')](_0xf9df('0x21'),_0x1c9b1f);io[_0xf9df('0x20')](_0xf9df('0x22'),_0x1c9b1f);}};module[_0xf9df('0x23')]=Agent; \ No newline at end of file +var _0x69bd=['user:%s','emit','user:save','util','moment','md5','../../../config/environment','defaults','redis','name','email','accountcode','fullname','state','unknown','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','updateStatusRealtime','toLowerCase','not_inuse','talking','toNumber','format','stateTime','onhold','stringify'];(function(_0x35709d,_0x5ceef3){var _0x547f64=function(_0x476aaf){while(--_0x476aaf){_0x35709d['push'](_0x35709d['shift']());}};_0x547f64(++_0x5ceef3);}(_0x69bd,0x11b));var _0xd69b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x69bd[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xd69b('0x0'));var moment=require(_0xd69b('0x1'));var md5=require(_0xd69b('0x2'));var Redis=require('ioredis');var config=require(_0xd69b('0x3'));config['redis']=_[_0xd69b('0x4')](config[_0xd69b('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd69b('0x5')]));function Agent(_0x16f2dc){this['id']=_0x16f2dc['id']||0x0;this[_0xd69b('0x6')]=_0x16f2dc[_0xd69b('0x6')]||'';this[_0xd69b('0x7')]=_0x16f2dc[_0xd69b('0x7')]||'';this[_0xd69b('0x8')]=_0x16f2dc[_0xd69b('0x8')]||'';this[_0xd69b('0x9')]=_0x16f2dc['fullname']||'';this[_0xd69b('0xa')]=_0xd69b('0xb');this['stateTime']=0x0;this[_0xd69b('0xc')]=_0xd69b('0xb');this[_0xd69b('0xd')]='';this[_0xd69b('0xe')]='';this[_0xd69b('0xf')]='';this[_0xd69b('0x10')]='';this[_0xd69b('0x11')]=_0x16f2dc[_0xd69b('0x11')]||![];this[_0xd69b('0x12')]=_0xd69b('0xb');this[_0xd69b('0x13')]=0x0;this[_0xd69b('0x14')]='';this[_0xd69b('0x15')]='';this['onhold']=![];this['local']=![];this[_0xd69b('0x2')]='';}Agent[_0xd69b('0x16')][_0xd69b('0x17')]=function(_0x55393f){var _0x653073;if(_0x55393f&&_0x55393f[_0xd69b('0xa')]){_0x653073=_0x55393f[_0xd69b('0xa')][_0xd69b('0x18')]();switch(_0x653073){case _0xd69b('0x19'):_0x653073='idle';break;case'inuse':_0x653073=_0xd69b('0x1a');break;}}if(_0x653073&&this[_0xd69b('0x12')]!==_0x653073||_0x55393f['statePause']){this[_0xd69b('0x13')]=_[_0xd69b('0x1b')](moment()[_0xd69b('0x1c')]('x'));}if(_0x653073){this[_0xd69b('0x12')]=_0x653073;}var _0x9762a={'id':this['id'],'name':this[_0xd69b('0x6')],'email':this[_0xd69b('0x7')],'accountcode':this[_0xd69b('0x8')],'fullname':this[_0xd69b('0x9')],'state':this['state'],'stateTime':this[_0xd69b('0x1d')],'status':this[_0xd69b('0xc')],'address':this[_0xd69b('0xd')],'online':this[_0xd69b('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xd69b('0x13')],'voiceStatusCallerIdNumber':this[_0xd69b('0x14')],'voiceStatusQueue':this[_0xd69b('0x15')],'interface':this[_0xd69b('0x10')],'onhold':this[_0xd69b('0x1e')]};var _0x2e9af4=md5(JSON[_0xd69b('0x1f')](_0x9762a));if(this[_0xd69b('0x2')]!==_0x2e9af4){this[_0xd69b('0x2')]=_0x2e9af4;io['to'](util[_0xd69b('0x1c')](_0xd69b('0x20'),_0x9762a['name']))[_0xd69b('0x21')](_0xd69b('0x22'),_0x9762a);io[_0xd69b('0x21')]('user:presence',_0x9762a);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 0d21552..b7feb49 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 _0x51b5=['campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type'];(function(_0x431ae1,_0x385f06){var _0x27fcbd=function(_0x16e71f){while(--_0x16e71f){_0x431ae1['push'](_0x431ae1['shift']());}};_0x27fcbd(++_0x385f06);}(_0x51b5,0x66));var _0x551b=function(_0x40c88f,_0x160997){_0x40c88f=_0x40c88f-0x0;var _0x343443=_0x51b5[_0x40c88f];return _0x343443;};'use strict';function Campaign(_0x51bc4a){this['id']=_0x51bc4a['id']||0x0;this['name']=_0x51bc4a[_0x551b('0x0')]||'';this[_0x551b('0x1')]=_0x51bc4a[_0x551b('0x1')]||_0x551b('0x2');this[_0x551b('0x3')]=0x0;this[_0x551b('0x4')]=0x0;this[_0x551b('0x5')]=0x0;this[_0x551b('0x6')]=0x0;this[_0x551b('0x7')]='';this[_0x551b('0x8')]=!![];this[_0x551b('0x9')]=_0x51bc4a[_0x551b('0x9')];this[_0x551b('0xa')]=_0x51bc4a[_0x551b('0xa')];this[_0x551b('0xb')]=_0x51bc4a[_0x551b('0xb')]||null;this[_0x551b('0xc')]=_0x51bc4a['dialGlobalInterval']?_0x51bc4a[_0x551b('0xc')]:null;this[_0x551b('0xd')]=_0x51bc4a[_0x551b('0xd')];this[_0x551b('0xe')]=_0x51bc4a[_0x551b('0xe')];this['dialOriginateTimeout']=_0x51bc4a[_0x551b('0xf')]||0x1e;this[_0x551b('0x10')]=_0x51bc4a['dialCongestionMaxRetry'];this[_0x551b('0x11')]=_0x51bc4a['dialCongestionRetryFrequency'];this[_0x551b('0x12')]=_0x51bc4a['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x51bc4a[_0x551b('0x13')];this[_0x551b('0x14')]=_0x51bc4a['dialNoAnswerMaxRetry'];this[_0x551b('0x15')]=_0x51bc4a[_0x551b('0x15')];this['dialGlobalMaxRetry']=_0x51bc4a['dialGlobalMaxRetry'];this[_0x551b('0x16')]=_0x51bc4a[_0x551b('0x16')]||0x3;this[_0x551b('0x17')]=_0x51bc4a['dialNoSuchNumberRetryFrequency']||0x96;this[_0x551b('0x18')]=_0x51bc4a[_0x551b('0x18')]||0x3;this['dialDropRetryFrequency']=_0x51bc4a[_0x551b('0x19')]||0x96;this[_0x551b('0x1a')]=_0x51bc4a[_0x551b('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x51bc4a[_0x551b('0x1b')]||0x96;this[_0x551b('0x1c')]=_0x51bc4a['dialMachineMaxRetry']||0x3;this[_0x551b('0x1d')]=_0x51bc4a['dialMachineRetryFrequency']||0x96;this[_0x551b('0x1e')]=_0x51bc4a['dialAgentRejectMaxRetry']||0x3;this[_0x551b('0x1f')]=_0x51bc4a['dialAgentRejectRetryFrequency']||0x96;this[_0x551b('0x20')]=_0x51bc4a['dialOrderByScheduledAt']||_0x551b('0x21');this[_0x551b('0x22')]=_0x51bc4a[_0x551b('0x22')]||undefined;this[_0x551b('0x23')]=_0x51bc4a[_0x551b('0x23')]||undefined;this[_0x551b('0x24')]=_0x51bc4a[_0x551b('0x24')]||undefined;this[_0x551b('0x25')]=_0x51bc4a[_0x551b('0x25')]?_0x51bc4a[_0x551b('0x25')]:undefined;this[_0x551b('0x26')]=_0x51bc4a[_0x551b('0x26')]?_0x51bc4a['Trunk']:undefined;this[_0x551b('0x27')]=_0x51bc4a[_0x551b('0x27')]?_0x51bc4a['Interval']:undefined;this[_0x551b('0x28')]=_0x51bc4a[_0x551b('0x28')]?_0x51bc4a[_0x551b('0x28')]:undefined;this['dialQueueProject']=_0x51bc4a['SquareProject']?_0x51bc4a[_0x551b('0x28')][_0x551b('0x0')]:undefined;this[_0x551b('0x29')]=_0x51bc4a[_0x551b('0x29')]||![];this['dialAMDInitialSilence']=_0x51bc4a[_0x551b('0x2a')];this['dialAMDGreeting']=_0x51bc4a[_0x551b('0x2b')];this[_0x551b('0x2c')]=_0x51bc4a[_0x551b('0x2c')];this[_0x551b('0x2d')]=_0x51bc4a[_0x551b('0x2d')];this[_0x551b('0x2e')]=_0x51bc4a[_0x551b('0x2e')];this[_0x551b('0x2f')]=_0x51bc4a[_0x551b('0x2f')];this[_0x551b('0x30')]=_0x51bc4a[_0x551b('0x30')];this['dialAMDSilenceThreshold']=_0x51bc4a[_0x551b('0x31')];this['dialAMDMaximumWordLength']=_0x51bc4a[_0x551b('0x32')];}module[_0x551b('0x33')]=Campaign; \ No newline at end of file +var _0x1771=['campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type'];(function(_0x4349fc,_0x522ce2){var _0x18cdf3=function(_0x5225a0){while(--_0x5225a0){_0x4349fc['push'](_0x4349fc['shift']());}};_0x18cdf3(++_0x522ce2);}(_0x1771,0xf8));var _0x1177=function(_0x262ea9,_0x1f95ec){_0x262ea9=_0x262ea9-0x0;var _0x4dfe10=_0x1771[_0x262ea9];return _0x4dfe10;};'use strict';function Campaign(_0x48815b){this['id']=_0x48815b['id']||0x0;this[_0x1177('0x0')]=_0x48815b[_0x1177('0x0')]||'';this['type']=_0x48815b[_0x1177('0x1')]||_0x1177('0x2');this[_0x1177('0x3')]=0x0;this[_0x1177('0x4')]=0x0;this[_0x1177('0x5')]=0x0;this[_0x1177('0x6')]=0x0;this[_0x1177('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x1177('0x8')]=_0x48815b[_0x1177('0x8')];this[_0x1177('0x9')]=_0x48815b[_0x1177('0x9')];this[_0x1177('0xa')]=_0x48815b['dialTimezone']||null;this[_0x1177('0xb')]=_0x48815b[_0x1177('0xb')]?_0x48815b[_0x1177('0xb')]:null;this[_0x1177('0xc')]=_0x48815b[_0x1177('0xc')];this[_0x1177('0xd')]=_0x48815b['dialOriginateCallerIdNumber'];this[_0x1177('0xe')]=_0x48815b[_0x1177('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x48815b[_0x1177('0xf')];this[_0x1177('0x10')]=_0x48815b[_0x1177('0x10')];this['dialBusyMaxRetry']=_0x48815b[_0x1177('0x11')];this[_0x1177('0x12')]=_0x48815b[_0x1177('0x12')];this[_0x1177('0x13')]=_0x48815b[_0x1177('0x13')];this[_0x1177('0x14')]=_0x48815b[_0x1177('0x14')];this[_0x1177('0x15')]=_0x48815b[_0x1177('0x15')];this[_0x1177('0x16')]=_0x48815b[_0x1177('0x16')]||0x3;this[_0x1177('0x17')]=_0x48815b['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x48815b[_0x1177('0x18')]||0x3;this[_0x1177('0x19')]=_0x48815b['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x48815b['dialAbandonedMaxRetry']||0x3;this[_0x1177('0x1a')]=_0x48815b[_0x1177('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x48815b[_0x1177('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x48815b['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x48815b[_0x1177('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x48815b[_0x1177('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x48815b[_0x1177('0x1e')]||_0x1177('0x1f');this[_0x1177('0x20')]=_0x48815b[_0x1177('0x20')]||undefined;this[_0x1177('0x21')]=_0x48815b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x1177('0x22')]=_0x48815b[_0x1177('0x22')]||undefined;this[_0x1177('0x23')]=_0x48815b[_0x1177('0x23')]?_0x48815b[_0x1177('0x23')]:undefined;this[_0x1177('0x24')]=_0x48815b['Trunk']?_0x48815b[_0x1177('0x24')]:undefined;this[_0x1177('0x25')]=_0x48815b[_0x1177('0x25')]?_0x48815b['Interval']:undefined;this['SquareProject']=_0x48815b[_0x1177('0x26')]?_0x48815b[_0x1177('0x26')]:undefined;this[_0x1177('0x27')]=_0x48815b[_0x1177('0x26')]?_0x48815b[_0x1177('0x26')][_0x1177('0x0')]:undefined;this[_0x1177('0x28')]=_0x48815b[_0x1177('0x28')]||![];this['dialAMDInitialSilence']=_0x48815b[_0x1177('0x29')];this[_0x1177('0x2a')]=_0x48815b[_0x1177('0x2a')];this['dialAMDAfterGreetingSilence']=_0x48815b['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x48815b[_0x1177('0x2b')];this[_0x1177('0x2c')]=_0x48815b[_0x1177('0x2c')];this[_0x1177('0x2d')]=_0x48815b[_0x1177('0x2d')];this[_0x1177('0x2e')]=_0x48815b[_0x1177('0x2e')];this[_0x1177('0x2f')]=_0x48815b[_0x1177('0x2f')];this[_0x1177('0x30')]=_0x48815b['dialAMDMaximumWordLength'];}module[_0x1177('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 7844813..1dc61e1 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 _0x4329=['disposition','monitorFilename','queue','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','lastapplication','lastdata','billableseconds','holdtime','type','tag'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4329,0x13b));var _0x9432=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x4329[_0x297fd3];return _0x2af381;};'use strict';function Channel(){this[_0x9432('0x0')]=null;this[_0x9432('0x1')]='';this[_0x9432('0x2')]='';this[_0x9432('0x3')]=0x0;this[_0x9432('0x4')]='';this[_0x9432('0x5')]=undefined;this[_0x9432('0x6')]=undefined;this[_0x9432('0x7')]=0x0;this[_0x9432('0x8')]='';this[_0x9432('0x9')]=0x0;this[_0x9432('0xa')]=0x0;this[_0x9432('0xb')]=0x0;this[_0x9432('0xc')]=![];this[_0x9432('0xd')]=null;this['endtime']=null;this[_0x9432('0xe')]=![];this['abandoned']=![];this[_0x9432('0xf')]='';this[_0x9432('0x10')]='';this['duration']=0x0;this[_0x9432('0x11')]=0x0;this[_0x9432('0x12')]=0x0;this[_0x9432('0x13')]=null;this[_0x9432('0x14')]=null;this[_0x9432('0x15')]=null;this['monitor']=![];this[_0x9432('0x16')]=null;this[_0x9432('0x17')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x9432('0x18')]=undefined;this[_0x9432('0x19')]=undefined;this[_0x9432('0x1a')]=0x0;}module[_0x9432('0x1b')]=Channel; \ No newline at end of file +var _0x30fc=['unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime'];(function(_0x3a96cd,_0x1095ad){var _0x5c4f4a=function(_0x2fab3c){while(--_0x2fab3c){_0x3a96cd['push'](_0x3a96cd['shift']());}};_0x5c4f4a(++_0x1095ad);}(_0x30fc,0x64));var _0xc30f=function(_0x25e9de,_0x4a1674){_0x25e9de=_0x25e9de-0x0;var _0x797945=_0x30fc[_0x25e9de];return _0x797945;};'use strict';function Channel(){this[_0xc30f('0x0')]=null;this[_0xc30f('0x1')]='';this['destinationchannel']='';this[_0xc30f('0x2')]=0x0;this[_0xc30f('0x3')]='';this[_0xc30f('0x4')]=undefined;this[_0xc30f('0x5')]=undefined;this['accountcode']=0x0;this[_0xc30f('0x6')]='';this[_0xc30f('0x7')]=0x0;this[_0xc30f('0x8')]=0x0;this[_0xc30f('0x9')]=0x0;this[_0xc30f('0xa')]=![];this[_0xc30f('0xb')]=null;this['endtime']=null;this[_0xc30f('0xc')]=![];this[_0xc30f('0xd')]=![];this[_0xc30f('0xe')]='';this[_0xc30f('0xf')]='';this[_0xc30f('0x10')]=0x0;this[_0xc30f('0x11')]=0x0;this[_0xc30f('0x12')]=0x0;this[_0xc30f('0x13')]=null;this[_0xc30f('0x14')]=null;this['disposition']=null;this[_0xc30f('0x15')]=![];this['monitorFilename']=null;this[_0xc30f('0x16')]=null;this[_0xc30f('0x17')]=[];this[_0xc30f('0x18')]=undefined;this[_0xc30f('0x19')]=undefined;this[_0xc30f('0x1a')]=undefined;this[_0xc30f('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 3a77103..1341843 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 _0x5ac5=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x371eae,_0x35ad44){var _0x1e0533=function(_0x3bd427){while(--_0x3bd427){_0x371eae['push'](_0x371eae['shift']());}};_0x1e0533(++_0x35ad44);}(_0x5ac5,0x196));var _0x55ac=function(_0x383cad,_0x133407){_0x383cad=_0x383cad-0x0;var _0x1e8934=_0x5ac5[_0x383cad];return _0x1e8934;};'use strict';function DeskAccount(_0x248cef){this['id']=_0x248cef['id']||0x0;this[_0x55ac('0x0')]=_0x248cef[_0x55ac('0x0')]||'';this[_0x55ac('0x1')]=_0x248cef[_0x55ac('0x1')]||'';this[_0x55ac('0x2')]=_0x248cef[_0x55ac('0x2')]||'';this[_0x55ac('0x3')]=_0x248cef[_0x55ac('0x3')]||'';this[_0x55ac('0x4')]=_0x248cef[_0x55ac('0x4')]||'';this[_0x55ac('0x5')]=_0x248cef[_0x55ac('0x5')]||'';this[_0x55ac('0x6')]=_0x248cef[_0x55ac('0x6')]||'';this[_0x55ac('0x7')]=_0x248cef[_0x55ac('0x7')]||'';this['tokenSecret']=_0x248cef[_0x55ac('0x8')]||'';this[_0x55ac('0x9')]=_0x248cef['type']||'';this['serverUrl']=_0x248cef[_0x55ac('0xa')]||'';this[_0x55ac('0xb')]=_0x248cef[_0x55ac('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xc2d7=['password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xc2d7,0x15c));var _0x7c2d=function(_0x4a23c1,_0x52c02e){_0x4a23c1=_0x4a23c1-0x0;var _0x27a476=_0xc2d7[_0x4a23c1];return _0x27a476;};'use strict';function DeskAccount(_0x4f3da3){this['id']=_0x4f3da3['id']||0x0;this[_0x7c2d('0x0')]=_0x4f3da3[_0x7c2d('0x0')]||'';this[_0x7c2d('0x1')]=_0x4f3da3[_0x7c2d('0x1')]||'';this[_0x7c2d('0x2')]=_0x4f3da3[_0x7c2d('0x2')]||'';this[_0x7c2d('0x3')]=_0x4f3da3['authType']||'';this['password']=_0x4f3da3[_0x7c2d('0x4')]||'';this['consumerKey']=_0x4f3da3['consumerKey']||'';this['consumerSecret']=_0x4f3da3[_0x7c2d('0x5')]||'';this['token']=_0x4f3da3[_0x7c2d('0x6')]||'';this[_0x7c2d('0x7')]=_0x4f3da3[_0x7c2d('0x7')]||'';this['type']=_0x4f3da3[_0x7c2d('0x8')]||'';this[_0x7c2d('0x9')]=_0x4f3da3[_0x7c2d('0x9')]||'';this[_0x7c2d('0xa')]=_0x4f3da3[_0x7c2d('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 0e229c2..83351e0 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 _0xe4dd=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','name','username','password'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xe4dd,0x9d));var _0xde4d=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0xe4dd[_0x17406e];return _0x2bfc5a;};'use strict';function Dynamics365Account(_0x25e5e8){this['id']=_0x25e5e8['id']||0x0;this[_0xde4d('0x0')]=_0x25e5e8[_0xde4d('0x0')]||'';this['username']=_0x25e5e8[_0xde4d('0x1')]||'';this[_0xde4d('0x2')]=_0x25e5e8[_0xde4d('0x2')]||'';this[_0xde4d('0x3')]=_0x25e5e8[_0xde4d('0x3')]||'';this[_0xde4d('0x4')]=_0x25e5e8[_0xde4d('0x4')]||'';this['clientId']=_0x25e5e8[_0xde4d('0x5')]||'';this[_0xde4d('0x6')]=_0x25e5e8[_0xde4d('0x6')]||{};this[_0xde4d('0x7')]=_0x25e5e8[_0xde4d('0x7')]||'';this[_0xde4d('0x8')]=_0x25e5e8[_0xde4d('0x8')]||![];this[_0xde4d('0x9')]=_0x25e5e8[_0xde4d('0x9')]||{};this['CloudProvider']=_0x25e5e8['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xa494=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','tenantId','clientId'];(function(_0x3139de,_0x57e4ab){var _0x2b4de3=function(_0x349ce0){while(--_0x349ce0){_0x3139de['push'](_0x3139de['shift']());}};_0x2b4de3(++_0x57e4ab);}(_0xa494,0x15b));var _0x4a49=function(_0xa01338,_0x91aff){_0xa01338=_0xa01338-0x0;var _0x3ac3cc=_0xa494[_0xa01338];return _0x3ac3cc;};'use strict';function Dynamics365Account(_0x59facd){this['id']=_0x59facd['id']||0x0;this[_0x4a49('0x0')]=_0x59facd[_0x4a49('0x0')]||'';this[_0x4a49('0x1')]=_0x59facd['username']||'';this[_0x4a49('0x2')]=_0x59facd['password']||'';this['remoteUri']=_0x59facd['remoteUri']||'';this[_0x4a49('0x3')]=_0x59facd[_0x4a49('0x3')]||'';this['clientId']=_0x59facd[_0x4a49('0x4')]||'';this[_0x4a49('0x5')]=_0x59facd[_0x4a49('0x5')]||{};this[_0x4a49('0x6')]=_0x59facd[_0x4a49('0x6')]||'';this[_0x4a49('0x7')]=_0x59facd[_0x4a49('0x7')]||![];this[_0x4a49('0x8')]=_0x59facd[_0x4a49('0x8')]||{};this['CloudProvider']=_0x59facd[_0x4a49('0x9')]||{};}module[_0x4a49('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d376282..c3218c5 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 _0x954c=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x141352,_0x5aa338){var _0x3d8110=function(_0x4f0508){while(--_0x4f0508){_0x141352['push'](_0x141352['shift']());}};_0x3d8110(++_0x5aa338);}(_0x954c,0x155));var _0xc954=function(_0x590bfd,_0x1a7794){_0x590bfd=_0x590bfd-0x0;var _0x23d75f=_0x954c[_0x590bfd];return _0x23d75f;};'use strict';function FaxAccount(_0x5d1dc2){this['id']=_0x5d1dc2['id']||0x0;this[_0xc954('0x0')]=_0x5d1dc2[_0xc954('0x0')]||'';this[_0xc954('0x1')]=_0x5d1dc2[_0xc954('0x1')];this['ecm']=_0x5d1dc2[_0xc954('0x2')];this[_0xc954('0x3')]=_0x5d1dc2['headerinfo'];this[_0xc954('0x4')]=_0x5d1dc2[_0xc954('0x4')];this['minrate']=_0x5d1dc2[_0xc954('0x5')]||0x960;this[_0xc954('0x6')]=_0x5d1dc2['maxrate']||0x3840;this[_0xc954('0x7')]=_0x5d1dc2[_0xc954('0x7')]||'v17,v27,v29';this['gateway']=_0x5d1dc2[_0xc954('0x8')]||'no';this[_0xc954('0x9')]=_0x5d1dc2[_0xc954('0x9')]||'no';this[_0xc954('0xa')]=_0x5d1dc2[_0xc954('0xa')]||0x1388;this[_0xc954('0xb')]=_0x5d1dc2['tech']||_0xc954('0xc');this['Trunk']=_0x5d1dc2[_0xc954('0xd')]?_0x5d1dc2[_0xc954('0xd')]:undefined;this[_0xc954('0xe')]=_0x5d1dc2[_0xc954('0xe')];this[_0xc954('0xf')]=_0x5d1dc2[_0xc954('0xf')];}module[_0xc954('0x10')]=FaxAccount; \ No newline at end of file +var _0xb82b=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x22e345,_0x376766){var _0xcc3698=function(_0x478495){while(--_0x478495){_0x22e345['push'](_0x22e345['shift']());}};_0xcc3698(++_0x376766);}(_0xb82b,0x1b0));var _0xbb82=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb82b[_0x501510];return _0x1e6ee5;};'use strict';function FaxAccount(_0x364920){this['id']=_0x364920['id']||0x0;this[_0xbb82('0x0')]=_0x364920['name']||'';this['description']=_0x364920[_0xbb82('0x1')];this[_0xbb82('0x2')]=_0x364920[_0xbb82('0x2')];this[_0xbb82('0x3')]=_0x364920['headerinfo'];this['localstationid']=_0x364920['localstationid'];this['minrate']=_0x364920[_0xbb82('0x4')]||0x960;this[_0xbb82('0x5')]=_0x364920[_0xbb82('0x5')]||0x3840;this['modem']=_0x364920[_0xbb82('0x6')]||_0xbb82('0x7');this['gateway']=_0x364920[_0xbb82('0x8')]||'no';this[_0xbb82('0x9')]=_0x364920[_0xbb82('0x9')]||'no';this[_0xbb82('0xa')]=_0x364920['t38timeout']||0x1388;this['tech']=_0x364920[_0xbb82('0xb')]||_0xbb82('0xc');this[_0xbb82('0xd')]=_0x364920[_0xbb82('0xd')]?_0x364920[_0xbb82('0xd')]:undefined;this[_0xbb82('0xe')]=_0x364920[_0xbb82('0xe')];this[_0xbb82('0xf')]=_0x364920['key'];}module[_0xbb82('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 9056a44..bef3434 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 _0x92aa=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xac8c5a,_0x1063a8){var _0x5a56d9=function(_0x5bd26e){while(--_0x5bd26e){_0xac8c5a['push'](_0xac8c5a['shift']());}};_0x5a56d9(++_0x1063a8);}(_0x92aa,0x1b1));var _0xa92a=function(_0x12da58,_0x3b4d58){_0x12da58=_0x12da58-0x0;var _0x103843=_0x92aa[_0x12da58];return _0x103843;};'use strict';function FreshdeskAccount(_0x44a214){this['id']=_0x44a214['id']||0x0;this[_0xa92a('0x0')]=_0x44a214[_0xa92a('0x0')]||'';this[_0xa92a('0x1')]=_0x44a214[_0xa92a('0x1')]||'';this['apiKey']=_0x44a214[_0xa92a('0x2')]||'';this[_0xa92a('0x3')]=_0x44a214[_0xa92a('0x3')]||'';this[_0xa92a('0x4')]=_0x44a214[_0xa92a('0x4')]||'';this[_0xa92a('0x5')]=_0x44a214[_0xa92a('0x5')]||{};}module[_0xa92a('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x9ee1=['username','apiKey','remoteUri','serverUrl','name'];(function(_0x4bbf2f,_0x3b6f97){var _0x4891a2=function(_0x279b9e){while(--_0x279b9e){_0x4bbf2f['push'](_0x4bbf2f['shift']());}};_0x4891a2(++_0x3b6f97);}(_0x9ee1,0x199));var _0x19ee=function(_0x72e690,_0x13b5cb){_0x72e690=_0x72e690-0x0;var _0x425547=_0x9ee1[_0x72e690];return _0x425547;};'use strict';function FreshdeskAccount(_0x3f02d0){this['id']=_0x3f02d0['id']||0x0;this[_0x19ee('0x0')]=_0x3f02d0[_0x19ee('0x0')]||'';this[_0x19ee('0x1')]=_0x3f02d0['username']||'';this[_0x19ee('0x2')]=_0x3f02d0['token']||'';this[_0x19ee('0x3')]=_0x3f02d0[_0x19ee('0x3')]||'';this['serverUrl']=_0x3f02d0[_0x19ee('0x4')]||'';this['Configurations']=_0x3f02d0['Configurations']||{};}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 f80ed9e..7cc5f3d 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 _0x0f9f=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0x0f9f,0xae));var _0xf0f9=function(_0x2b92d2,_0x4e8ded){_0x2b92d2=_0x2b92d2-0x0;var _0x133446=_0x0f9f[_0x2b92d2];return _0x133446;};'use strict';function FreshsalesAccount(_0xbbc735){this['id']=_0xbbc735['id']||0x0;this[_0xf0f9('0x0')]=_0xbbc735[_0xf0f9('0x0')]||'';this[_0xf0f9('0x1')]=_0xbbc735[_0xf0f9('0x1')]||'';this[_0xf0f9('0x2')]=_0xbbc735[_0xf0f9('0x3')]||'';this[_0xf0f9('0x4')]=_0xbbc735[_0xf0f9('0x4')]||'';this[_0xf0f9('0x5')]=_0xbbc735[_0xf0f9('0x5')]||'';this['Configurations']=_0xbbc735[_0xf0f9('0x6')]||{};}module[_0xf0f9('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x9879=['serverUrl','Configurations','name','username','token','remoteUri'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x9879,0x98));var _0x9987=function(_0x220d6b,_0x565112){_0x220d6b=_0x220d6b-0x0;var _0x70dab7=_0x9879[_0x220d6b];return _0x70dab7;};'use strict';function FreshsalesAccount(_0x1f7c5f){this['id']=_0x1f7c5f['id']||0x0;this[_0x9987('0x0')]=_0x1f7c5f[_0x9987('0x0')]||'';this['username']=_0x1f7c5f[_0x9987('0x1')]||'';this['apiKey']=_0x1f7c5f[_0x9987('0x2')]||'';this[_0x9987('0x3')]=_0x1f7c5f[_0x9987('0x3')]||'';this[_0x9987('0x4')]=_0x1f7c5f[_0x9987('0x4')]||'';this[_0x9987('0x5')]=_0x1f7c5f[_0x9987('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5cdc02a..01abd67 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 _0x1cec=['position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x4230ac,_0x570039){var _0x1abfdb=function(_0x3d69ad){while(--_0x3d69ad){_0x4230ac['push'](_0x4230ac['shift']());}};_0x1abfdb(++_0x570039);}(_0x1cec,0x85));var _0xc1ce=function(_0x48f8c4,_0x4e3dba){_0x48f8c4=_0x48f8c4-0x0;var _0x118849=_0x1cec[_0x48f8c4];return _0x118849;};'use strict';function QueueReport(){this[_0xc1ce('0x0')]='inbound';this[_0xc1ce('0x1')]='';this[_0xc1ce('0x2')]='';this[_0xc1ce('0x3')]='';this[_0xc1ce('0x4')]='';this[_0xc1ce('0x5')]=null;this[_0xc1ce('0x6')]=null;this[_0xc1ce('0x7')]=0x1;this[_0xc1ce('0x8')]=0x1;this[_0xc1ce('0x9')]=![];this['queuecallerabandonAt']=null;this[_0xc1ce('0xa')]=![];this[_0xc1ce('0xb')]=null;this[_0xc1ce('0xc')]=![];this[_0xc1ce('0xd')]=null;this[_0xc1ce('0xe')]=0x1;this[_0xc1ce('0xf')]='';this[_0xc1ce('0x10')]='';this[_0xc1ce('0x11')]='';this[_0xc1ce('0x12')]='';this['context']='';this[_0xc1ce('0x13')]='';this[_0xc1ce('0x14')]='';this[_0xc1ce('0x15')]=0x0;this[_0xc1ce('0x16')]=![];this[_0xc1ce('0x17')]='';this[_0xc1ce('0x18')]=_0xc1ce('0x19');this[_0xc1ce('0x1a')]=null;this['mohtime']=0x0;this['variables']={};}module[_0xc1ce('0x1b')]=QueueReport; \ No newline at end of file +var _0x9360=['channel','connectedlinenum','connectedlinename','accountcode','context','exten','assigned','lastAssignedTo','voice','routealias','mohtime','variables','type','inbound','calleridnum','calleridname','queue','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt'];(function(_0x54d84a,_0x34ed3f){var _0x59b491=function(_0x50f4d6){while(--_0x50f4d6){_0x54d84a['push'](_0x54d84a['shift']());}};_0x59b491(++_0x34ed3f);}(_0x9360,0x17c));var _0x0936=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9360[_0x4565bf];return _0x5610ba;};'use strict';function QueueReport(){this[_0x0936('0x0')]=_0x0936('0x1');this['uniqueid']='';this[_0x0936('0x2')]='';this[_0x0936('0x3')]='';this[_0x0936('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x0936('0x5')]=0x1;this[_0x0936('0x6')]=0x1;this[_0x0936('0x7')]=![];this[_0x0936('0x8')]=null;this[_0x0936('0x9')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x0936('0xa')]=null;this['originalposition']=0x1;this[_0x0936('0xb')]='';this[_0x0936('0xc')]='';this[_0x0936('0xd')]='';this[_0x0936('0xe')]='';this[_0x0936('0xf')]='';this[_0x0936('0x10')]='';this['priority']='';this['holdtime']=0x0;this[_0x0936('0x11')]=![];this[_0x0936('0x12')]='';this['motionChannel']=_0x0936('0x13');this[_0x0936('0x14')]=null;this[_0x0936('0x15')]=0x0;this[_0x0936('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index e7baf8b..14b0923 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 _0x2de3=['clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x58ed81,_0x10fd16){var _0x10f036=function(_0x3a55a4){while(--_0x3a55a4){_0x58ed81['push'](_0x58ed81['shift']());}};_0x10f036(++_0x10fd16);}(_0x2de3,0x150));var _0x32de=function(_0x359cbf,_0x566ce3){_0x359cbf=_0x359cbf-0x0;var _0x3e4c50=_0x2de3[_0x359cbf];return _0x3e4c50;};'use strict';function SalesforceAccount(_0x4f82a7){this['id']=_0x4f82a7['id']||0x0;this[_0x32de('0x0')]=_0x4f82a7[_0x32de('0x0')]||'';this[_0x32de('0x1')]=_0x4f82a7[_0x32de('0x1')]||'';this[_0x32de('0x2')]=_0x4f82a7[_0x32de('0x2')]||'';this[_0x32de('0x3')]=_0x4f82a7['password']||'';this[_0x32de('0x4')]=_0x4f82a7[_0x32de('0x4')]||'';this[_0x32de('0x5')]=_0x4f82a7['clientSecret']||'';this['securityToken']=_0x4f82a7[_0x32de('0x6')]||'';this[_0x32de('0x7')]=_0x4f82a7['type']||'integrationTab';this[_0x32de('0x8')]=_0x4f82a7['serverUrl']||'';this[_0x32de('0x9')]=_0x4f82a7['Configurations']||{};}module[_0x32de('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x3b77=['clientId','type','integrationTab','serverUrl','exports','name','username','remoteUri','password'];(function(_0x5585d5,_0x4a1047){var _0x36da9a=function(_0x2ac8a9){while(--_0x2ac8a9){_0x5585d5['push'](_0x5585d5['shift']());}};_0x36da9a(++_0x4a1047);}(_0x3b77,0x188));var _0x73b7=function(_0x4ecb89,_0x24a675){_0x4ecb89=_0x4ecb89-0x0;var _0x51c6ef=_0x3b77[_0x4ecb89];return _0x51c6ef;};'use strict';function SalesforceAccount(_0x4fb1a6){this['id']=_0x4fb1a6['id']||0x0;this[_0x73b7('0x0')]=_0x4fb1a6[_0x73b7('0x0')]||'';this[_0x73b7('0x1')]=_0x4fb1a6[_0x73b7('0x1')]||'';this[_0x73b7('0x2')]=_0x4fb1a6['remoteUri']||'';this['password']=_0x4fb1a6[_0x73b7('0x3')]||'';this[_0x73b7('0x4')]=_0x4fb1a6[_0x73b7('0x4')]||'';this['clientSecret']=_0x4fb1a6['clientSecret']||'';this['securityToken']=_0x4fb1a6['securityToken']||'';this[_0x73b7('0x5')]=_0x4fb1a6[_0x73b7('0x5')]||_0x73b7('0x6');this['serverUrl']=_0x4fb1a6[_0x73b7('0x7')]||'';this['Configurations']=_0x4fb1a6['Configurations']||{};}module[_0x73b7('0x8')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 3d020ba..0d403f0 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 _0xa928=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x168506,_0x2a2915){var _0x1562e7=function(_0x53368d){while(--_0x53368d){_0x168506['push'](_0x168506['shift']());}};_0x1562e7(++_0x2a2915);}(_0xa928,0x154));var _0x8a92=function(_0x508cbd,_0x55834d){_0x508cbd=_0x508cbd-0x0;var _0x3e4ac7=_0xa928[_0x508cbd];return _0x3e4ac7;};'use strict';function ServicenowAccount(_0x3ad0a9){this['id']=_0x3ad0a9['id']||0x0;this[_0x8a92('0x0')]=_0x3ad0a9[_0x8a92('0x0')]||'';this[_0x8a92('0x1')]=_0x3ad0a9[_0x8a92('0x1')]||'';this[_0x8a92('0x2')]=_0x3ad0a9[_0x8a92('0x2')]||'';this[_0x8a92('0x3')]=_0x3ad0a9[_0x8a92('0x3')]||'';this[_0x8a92('0x4')]=_0x3ad0a9[_0x8a92('0x4')]||'';this[_0x8a92('0x5')]=_0x3ad0a9['Configurations']||{};}module[_0x8a92('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x8cd8=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8cd8,0x14f));var _0x88cd=function(_0x354394,_0x33cc20){_0x354394=_0x354394-0x0;var _0x3f86c0=_0x8cd8[_0x354394];return _0x3f86c0;};'use strict';function ServicenowAccount(_0x458870){this['id']=_0x458870['id']||0x0;this[_0x88cd('0x0')]=_0x458870[_0x88cd('0x0')]||'';this['username']=_0x458870[_0x88cd('0x1')]||'';this[_0x88cd('0x2')]=_0x458870['password']||'';this[_0x88cd('0x3')]=_0x458870[_0x88cd('0x3')]||'';this['serverUrl']=_0x458870[_0x88cd('0x4')]||'';this[_0x88cd('0x5')]=_0x458870[_0x88cd('0x5')]||{};}module[_0x88cd('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 e9643e5..0199a95 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 _0x7d17=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x4a85a6,_0x2bda1c){var _0x5b7080=function(_0xc4b84e){while(--_0xc4b84e){_0x4a85a6['push'](_0x4a85a6['shift']());}};_0x5b7080(++_0x2bda1c);}(_0x7d17,0x129));var _0x77d1=function(_0x38d3fc,_0x24613f){_0x38d3fc=_0x38d3fc-0x0;var _0x4defca=_0x7d17[_0x38d3fc];return _0x4defca;};'use strict';function SugarcrmAccount(_0x47cf2b){this['id']=_0x47cf2b['id']||0x0;this[_0x77d1('0x0')]=_0x47cf2b[_0x77d1('0x0')]||'';this[_0x77d1('0x1')]=_0x47cf2b['username']||'';this['password']=_0x47cf2b[_0x77d1('0x2')]||'';this['remoteUri']=_0x47cf2b[_0x77d1('0x3')]||'';this[_0x77d1('0x4')]=_0x47cf2b[_0x77d1('0x4')]||'';this[_0x77d1('0x5')]=_0x47cf2b[_0x77d1('0x5')]||{};}module[_0x77d1('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x0855=['serverUrl','exports','name','username','password','remoteUri'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0855,0x7a));var _0x5085=function(_0x30b994,_0xb5453b){_0x30b994=_0x30b994-0x0;var _0x1b3ca4=_0x0855[_0x30b994];return _0x1b3ca4;};'use strict';function SugarcrmAccount(_0x1890d5){this['id']=_0x1890d5['id']||0x0;this[_0x5085('0x0')]=_0x1890d5[_0x5085('0x0')]||'';this[_0x5085('0x1')]=_0x1890d5[_0x5085('0x1')]||'';this[_0x5085('0x2')]=_0x1890d5[_0x5085('0x2')]||'';this[_0x5085('0x3')]=_0x1890d5[_0x5085('0x3')]||'';this[_0x5085('0x4')]=_0x1890d5[_0x5085('0x4')]||'';this['Configurations']=_0x1890d5['Configurations']||{};}module[_0x5085('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 9e0604d..ac91398 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 _0x2aa2=['status','unknown','name','accountcode','stateTime'];(function(_0x5d40f6,_0x841268){var _0x1cc25a=function(_0x149ac6){while(--_0x149ac6){_0x5d40f6['push'](_0x5d40f6['shift']());}};_0x1cc25a(++_0x841268);}(_0x2aa2,0x75));var _0x22aa=function(_0x36b539,_0x50c9fd){_0x36b539=_0x36b539-0x0;var _0x4fc67d=_0x2aa2[_0x36b539];return _0x4fc67d;};'use strict';function Telephone(_0x59ba7b){this['id']=_0x59ba7b['id']||0x0;this[_0x22aa('0x0')]=_0x59ba7b[_0x22aa('0x0')]||'';this[_0x22aa('0x1')]=_0x59ba7b[_0x22aa('0x1')]||'';this['state']='unknown';this[_0x22aa('0x2')]=0x0;this[_0x22aa('0x3')]=_0x22aa('0x4');this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0x4eab=['state','unknown','status','address','exports','name','accountcode'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4eab,0x194));var _0xb4ea=function(_0x238e6f,_0x3c7e70){_0x238e6f=_0x238e6f-0x0;var _0x488045=_0x4eab[_0x238e6f];return _0x488045;};'use strict';function Telephone(_0x4d34e8){this['id']=_0x4d34e8['id']||0x0;this[_0xb4ea('0x0')]=_0x4d34e8[_0xb4ea('0x0')]||'';this[_0xb4ea('0x1')]=_0x4d34e8[_0xb4ea('0x1')]||'';this[_0xb4ea('0x2')]=_0xb4ea('0x3');this['stateTime']=0x0;this[_0xb4ea('0x4')]=_0xb4ea('0x3');this[_0xb4ea('0x5')]='';}module[_0xb4ea('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 0286b58..63a5e30 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0xbabd92,_0x392abf){var _0x1d5b0f=function(_0x5b4058){while(--_0x5b4058){_0xbabd92['push'](_0xbabd92['shift']());}};_0x1d5b0f(++_0x392abf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x7df02,_0x45ca25){var _0x56d5ad=function(_0x5e90bc){while(--_0x5e90bc){_0x7df02['push'](_0x7df02['shift']());}};_0x56d5ad(++_0x45ca25);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0xb10b[_0x3b0912];return _0xa8f339;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 7ecf184..af6ee6b 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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x3dcdea,_0x5abbea){var _0x50a73c=function(_0x215a76){while(--_0x215a76){_0x3dcdea['push'](_0x3dcdea['shift']());}};_0x50a73c(++_0x5abbea);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1885d1,_0x31ae31){_0x1885d1=_0x1885d1-0x0;var _0x3c0204=_0x9ffd[_0x1885d1];return _0x3c0204;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x4b35fd,_0x311d49){var _0x32b6e1=function(_0x692227){while(--_0x692227){_0x4b35fd['push'](_0x4b35fd['shift']());}};_0x32b6e1(++_0x311d49);}(_0x8603,0x190));var _0x3860=function(_0x563a31,_0x506f0f){_0x563a31=_0x563a31-0x0;var _0x350821=_0x8603[_0x563a31];return _0x350821;};'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 b9e81bb..42bbe70 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 _0x318f=['exports','active','name','state','unknown','registry','indexOf','split','port','domain','domainport','registrationtime','address','defaultuser'];(function(_0x32d0f8,_0x3742cd){var _0x5f1d4a=function(_0x5b30b8){while(--_0x5b30b8){_0x32d0f8['push'](_0x32d0f8['shift']());}};_0x5f1d4a(++_0x3742cd);}(_0x318f,0x16d));var _0xf318=function(_0x13bf20,_0x3d2df9){_0x13bf20=_0x13bf20-0x0;var _0x44b644=_0x318f[_0x13bf20];return _0x44b644;};'use strict';function Trunk(_0x6e9d58){this['id']=_0x6e9d58['id']||0x0;this[_0xf318('0x0')]=_0x6e9d58['active']||![];this['name']=_0x6e9d58[_0xf318('0x1')]||'';this[_0xf318('0x2')]=_0xf318('0x3');this['stateTime']=0x0;this['status']='unknown';this[_0xf318('0x4')]=_0x6e9d58[_0xf318('0x4')]&&_0x6e9d58[_0xf318('0x4')][_0xf318('0x5')](':')?_0x6e9d58['registry'][_0xf318('0x6')](':')[0x0]:'';this['host']='';this[_0xf318('0x7')]='';this[_0xf318('0x8')]='';this[_0xf318('0x9')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0xf318('0xa')]='';this[_0xf318('0xb')]='';this[_0xf318('0xc')]=_0x6e9d58[_0xf318('0xc')]||'';}module[_0xf318('0xd')]=Trunk; \ No newline at end of file +var _0x15b9=['defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host','port','refresh','stateRegistry','registrationtime','address'];(function(_0x56bd9d,_0x488a26){var _0x2f5a58=function(_0x359301){while(--_0x359301){_0x56bd9d['push'](_0x56bd9d['shift']());}};_0x2f5a58(++_0x488a26);}(_0x15b9,0x172));var _0x915b=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x15b9[_0x29d623];return _0x242e59;};'use strict';function Trunk(_0xdec3d){this['id']=_0xdec3d['id']||0x0;this[_0x915b('0x0')]=_0xdec3d[_0x915b('0x0')]||![];this[_0x915b('0x1')]=_0xdec3d[_0x915b('0x1')]||'';this['state']=_0x915b('0x2');this[_0x915b('0x3')]=0x0;this[_0x915b('0x4')]=_0x915b('0x2');this[_0x915b('0x5')]=_0xdec3d['registry']&&_0xdec3d[_0x915b('0x5')][_0x915b('0x6')](':')?_0xdec3d[_0x915b('0x5')][_0x915b('0x7')](':')[0x0]:'';this[_0x915b('0x8')]='';this[_0x915b('0x9')]='';this['domain']='';this['domainport']='';this[_0x915b('0xa')]='';this[_0x915b('0xb')]='unknown';this[_0x915b('0xc')]='';this[_0x915b('0xd')]='';this[_0x915b('0xe')]=_0xdec3d[_0x915b('0xe')]||'';}module[_0x915b('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index fa93d6d..bf922ef 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 _0x11d6=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x40676d,_0x531472){var _0x4623eb=function(_0x5b98a0){while(--_0x5b98a0){_0x40676d['push'](_0x40676d['shift']());}};_0x4623eb(++_0x531472);}(_0x11d6,0x1c4));var _0x611d=function(_0x21c052,_0x2454f4){_0x21c052=_0x21c052-0x0;var _0x314dc6=_0x11d6[_0x21c052];return _0x314dc6;};'use strict';function voiceExtension(_0x340ca7){this['id']=_0x340ca7['id']||0x0;this[_0x611d('0x0')]=_0x340ca7[_0x611d('0x0')]||'';this[_0x611d('0x1')]=_0x340ca7[_0x611d('0x1')]||_0x611d('0x2');this[_0x611d('0x3')]=_0x340ca7[_0x611d('0x3')]||![];}module[_0x611d('0x4')]=voiceExtension; \ No newline at end of file +var _0x0a56=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x403282,_0x39ab19){var _0x41f290=function(_0x34f4c0){while(--_0x34f4c0){_0x403282['push'](_0x403282['shift']());}};_0x41f290(++_0x39ab19);}(_0x0a56,0x1d8));var _0x60a5=function(_0x1a32ee,_0x4654f7){_0x1a32ee=_0x1a32ee-0x0;var _0x5e6299=_0x0a56[_0x1a32ee];return _0x5e6299;};'use strict';function voiceExtension(_0x4b138e){this['id']=_0x4b138e['id']||0x0;this['exten']=_0x4b138e[_0x60a5('0x0')]||'';this[_0x60a5('0x1')]=_0x4b138e[_0x60a5('0x1')]||_0x60a5('0x2');this[_0x60a5('0x3')]=_0x4b138e[_0x60a5('0x3')]||![];}module[_0x60a5('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index cade952..913789d 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 _0x3c0d=['predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','leastrecent','random','ringall','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','total','sumDuration','sumBillable','available','inUse','invalid','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive'];(function(_0x5f48bc,_0x320199){var _0xea6625=function(_0x13f6bf){while(--_0x13f6bf){_0x5f48bc['push'](_0x5f48bc['shift']());}};_0xea6625(++_0x320199);}(_0x3c0d,0x98));var _0xd3c0=function(_0x52f3fa,_0x432d38){_0x52f3fa=_0x52f3fa-0x0;var _0x240e29=_0x3c0d[_0x52f3fa];return _0x240e29;};'use strict';var monitorFormat={'wav':_0xd3c0('0x0'),'wav49':'wav49','gsm':_0xd3c0('0x1')};var strategy={'fewestcalls':_0xd3c0('0x2'),'leastrecent':_0xd3c0('0x3'),'linear':'linear','random':_0xd3c0('0x4'),'ringall':_0xd3c0('0x5'),'rr':_0xd3c0('0x6'),'rrmemory':_0xd3c0('0x7'),'rrordered':'rrordered','wrandom':_0xd3c0('0x8')};function VoiceQueue(_0x3abae0){this['id']=_0x3abae0['id']||0x0;this[_0xd3c0('0x9')]=_0x3abae0['name']||'';this[_0xd3c0('0xa')]=_0x3abae0[_0xd3c0('0xa')]||'';this[_0xd3c0('0xb')]=_0x3abae0[_0xd3c0('0xb')]||_0xd3c0('0xc');this[_0xd3c0('0xd')]=0x0;this[_0xd3c0('0xe')]=0x0;this['answered']=0x0;this[_0xd3c0('0xf')]=0x0;this['sumHoldTime']=0x0;this[_0xd3c0('0x10')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xd3c0('0x11')]=0x0;this['busy']=0x0;this[_0xd3c0('0x12')]=0x0;this[_0xd3c0('0x13')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0xd3c0('0x14')]=0x0;this[_0xd3c0('0x15')]=0x0;this[_0xd3c0('0x16')]=0x0;this[_0xd3c0('0x17')]=0x0;this[_0xd3c0('0x18')]=0x0;this[_0xd3c0('0x19')]=0x0;this[_0xd3c0('0x1a')]=0x0;this[_0xd3c0('0x1b')]=_0x3abae0[_0xd3c0('0x1b')]||![];this['acwTimeout']=_0x3abae0[_0xd3c0('0x1c')]||0xa;this[_0xd3c0('0x1d')]=_0x3abae0[_0xd3c0('0x1d')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0xd3c0('0x1e')]='';this['originated']=0x0;this[_0xd3c0('0x1f')]=0x0;this[_0xd3c0('0x20')]=_0x3abae0[_0xd3c0('0x20')]||null;this[_0xd3c0('0x21')]=_0x3abae0[_0xd3c0('0x21')]?_0x3abae0['dialGlobalInterval']:null;this[_0xd3c0('0x22')]=_0x3abae0[_0xd3c0('0x22')];this['dialMethod']=_0x3abae0['dialMethod']||'progressive';this[_0xd3c0('0x23')]=_0x3abae0[_0xd3c0('0x23')]||0x0;this[_0xd3c0('0x24')]=_0x3abae0[_0xd3c0('0x24')]||0x0;this[_0xd3c0('0x25')]=_0x3abae0[_0xd3c0('0x25')]||0x1;this['dialPredictiveOptimization']=_0x3abae0[_0xd3c0('0x26')]||_0xd3c0('0x27');this['dialPredictiveOptimizationPercentage']=_0x3abae0['dialPredictiveOptimizationPercentage']||0.03;this[_0xd3c0('0x28')]=_0x3abae0[_0xd3c0('0x28')]||0x258;this[_0xd3c0('0x29')]=_0x3abae0[_0xd3c0('0x29')]||_0xd3c0('0x2a');this['dialOriginateCallerIdNumber']=_0x3abae0['dialOriginateCallerIdNumber']||_0xd3c0('0x2a');this[_0xd3c0('0x2b')]=_0x3abae0['dialOriginateTimeout']||0x1e;this[_0xd3c0('0x2c')]=_0x3abae0[_0xd3c0('0x2c')]||_0xd3c0('0x2d');this[_0xd3c0('0x2e')]=_0x3abae0[_0xd3c0('0x2e')]||0x3;this['dialQueueProject']=_0x3abae0[_0xd3c0('0x2f')]||undefined;this[_0xd3c0('0x30')]=_0x3abae0['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x3abae0[_0xd3c0('0x31')]||0x96;this['dialBusyMaxRetry']=_0x3abae0[_0xd3c0('0x32')]||0x3;this['dialBusyRetryFrequency']=_0x3abae0['dialBusyRetryFrequency']||0x96;this[_0xd3c0('0x33')]=_0x3abae0[_0xd3c0('0x33')]||0x3;this[_0xd3c0('0x34')]=_0x3abae0['dialNoAnswerRetryFrequency']||0x96;this[_0xd3c0('0x35')]=_0x3abae0[_0xd3c0('0x35')]||0x3;this[_0xd3c0('0x36')]=_0x3abae0['dialNoSuchNumberRetryFrequency']||0x96;this[_0xd3c0('0x37')]=_0x3abae0[_0xd3c0('0x37')]||0x3;this['dialDropRetryFrequency']=_0x3abae0[_0xd3c0('0x38')]||0x96;this[_0xd3c0('0x39')]=_0x3abae0[_0xd3c0('0x39')]||0x3;this[_0xd3c0('0x3a')]=_0x3abae0[_0xd3c0('0x3a')]||0x96;this[_0xd3c0('0x3b')]=_0x3abae0[_0xd3c0('0x3b')]||0x3;this[_0xd3c0('0x3c')]=_0x3abae0[_0xd3c0('0x3c')]||0x96;this[_0xd3c0('0x3d')]=_0x3abae0[_0xd3c0('0x3d')]||0x3;this[_0xd3c0('0x3e')]=_0x3abae0[_0xd3c0('0x3e')]||0x96;this[_0xd3c0('0x3f')]=_0x3abae0['callAdditionalPhoneAfterMin']||0x3;this[_0xd3c0('0x40')]=_0x3abae0[_0xd3c0('0x40')]||0x4;this[_0xd3c0('0x41')]=_0x3abae0[_0xd3c0('0x41')]?_0x3abae0[_0xd3c0('0x41')]:undefined;this[_0xd3c0('0x42')]=_0x3abae0[_0xd3c0('0x42')]?_0x3abae0[_0xd3c0('0x42')]:undefined;this['dialPrefix']=_0x3abae0['dialPrefix']||undefined;this[_0xd3c0('0x43')]=_0x3abae0[_0xd3c0('0x43')]?_0x3abae0[_0xd3c0('0x43')]:undefined;this[_0xd3c0('0x44')]=_0x3abae0[_0xd3c0('0x44')]||_0xd3c0('0x45');this[_0xd3c0('0x46')]=_0x3abae0[_0xd3c0('0x46')]||undefined;this[_0xd3c0('0x47')]=_0x3abae0['dialCutDigit']||undefined;this['strategy']=strategy[_0x3abae0[_0xd3c0('0x48')]];this['queueStatusComplete']=!![];this[_0xd3c0('0x49')]=_0x3abae0['dialAMDActive']||![];this[_0xd3c0('0x4a')]=_0x3abae0['dialAMDInitialSilence'];this[_0xd3c0('0x4b')]=_0x3abae0['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x3abae0[_0xd3c0('0x4c')];this[_0xd3c0('0x4d')]=_0x3abae0['dialAMDTotalAnalysisTime'];this[_0xd3c0('0x4e')]=_0x3abae0[_0xd3c0('0x4e')];this[_0xd3c0('0x4f')]=_0x3abae0[_0xd3c0('0x4f')];this[_0xd3c0('0x50')]=_0x3abae0[_0xd3c0('0x50')];this[_0xd3c0('0x51')]=_0x3abae0['dialAMDSilenceThreshold'];this[_0xd3c0('0x52')]=_0x3abae0[_0xd3c0('0x52')];this[_0xd3c0('0x53')]=0x0;this[_0xd3c0('0x54')]=0x0;this[_0xd3c0('0x55')]=_0x3abae0[_0xd3c0('0x55')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xd3c0('0x56')]=0x0;this[_0xd3c0('0x57')]=0x0;this[_0xd3c0('0x58')]=0x0;this[_0xd3c0('0x59')]=0x0;this[_0xd3c0('0x5a')]=0x0;this[_0xd3c0('0x5b')]=0x0;this[_0xd3c0('0x5c')]=0x0;this[_0xd3c0('0x5d')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xd3c0('0x5e')]=0x0;this[_0xd3c0('0x5f')]=0x0;this[_0xd3c0('0x60')]=undefined;this['startPredictive']=undefined;this[_0xd3c0('0x61')]=undefined;this[_0xd3c0('0x62')]=1.05;this[_0xd3c0('0x63')]=0x0;this[_0xd3c0('0x64')]=0x0;this[_0xd3c0('0x65')]=0x0;this[_0xd3c0('0x66')]=0x0;this[_0xd3c0('0x67')]=0x0;this[_0xd3c0('0x68')]=0x0;this[_0xd3c0('0x69')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xd3c0('0x6a')]=_0x3abae0[_0xd3c0('0x6b')]||0x14;this[_0xd3c0('0x6c')]=_0x3abae0[_0xd3c0('0x6b')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xd3c0('0x6d')]=0x0;this[_0xd3c0('0x6e')]=0x1;this[_0xd3c0('0x6f')]=0x0;this[_0xd3c0('0x70')]=0x0;this[_0xd3c0('0x71')]=0x0;this[_0xd3c0('0x72')]=0x0;this[_0xd3c0('0x73')]=_0x3abae0[_0xd3c0('0x73')]||0x1e;this['dialRecallInQueue']=_0x3abae0[_0xd3c0('0x74')]||![];this['dialPreviewAutoRecallMe']=!!_0x3abae0['dialPreviewAutoRecallMe']||![];this[_0xd3c0('0x75')]=!!_0x3abae0[_0xd3c0('0x75')]||![];this[_0xd3c0('0x76')]=_0x3abae0[_0xd3c0('0x76')]||undefined;this[_0xd3c0('0x77')]=_0x3abae0[_0xd3c0('0x77')]||![];this[_0xd3c0('0x78')]=_0x3abae0[_0xd3c0('0x78')]||![];this[_0xd3c0('0xa')]=monitorFormat[_0x3abae0[_0xd3c0('0xa')]]?monitorFormat[_0x3abae0[_0xd3c0('0xa')]]:undefined;this[_0xd3c0('0x79')]=_0x3abae0[_0xd3c0('0x79')]||![];this['mandatoryDispositionPause']=_0x3abae0[_0xd3c0('0x7a')]?_0x3abae0[_0xd3c0('0x7a')]:undefined;this[_0xd3c0('0x7b')]=![];}module[_0xd3c0('0x7c')]=VoiceQueue; \ No newline at end of file +var _0x1305=['dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','abandoned','available','busy','inUse','invalid','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','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','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0x1a7abc,_0x3e6918){var _0x419b20=function(_0x5f0d3a){while(--_0x5f0d3a){_0x1a7abc['push'](_0x1a7abc['shift']());}};_0x419b20(++_0x3e6918);}(_0x1305,0x8d));var _0x5130=function(_0x461642,_0x52ba94){_0x461642=_0x461642-0x0;var _0x10847d=_0x1305[_0x461642];return _0x10847d;};'use strict';var monitorFormat={'wav':_0x5130('0x0'),'wav49':_0x5130('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x5130('0x2'),'leastrecent':_0x5130('0x3'),'linear':_0x5130('0x4'),'random':_0x5130('0x5'),'ringall':_0x5130('0x6'),'rr':_0x5130('0x7'),'rrmemory':_0x5130('0x8'),'rrordered':_0x5130('0x9'),'wrandom':_0x5130('0xa')};function VoiceQueue(_0x25e347){this['id']=_0x25e347['id']||0x0;this[_0x5130('0xb')]=_0x25e347[_0x5130('0xb')]||'';this[_0x5130('0xc')]=_0x25e347['monitor_format']||'';this['type']=_0x25e347[_0x5130('0xd')]||_0x5130('0xe');this[_0x5130('0xf')]=0x0;this[_0x5130('0x10')]=0x0;this[_0x5130('0x11')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x5130('0x12')]=0x0;this[_0x5130('0x13')]=0x0;this[_0x5130('0x14')]=0x0;this[_0x5130('0x15')]=0x0;this[_0x5130('0x16')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x5130('0x17')]=0x0;this[_0x5130('0x18')]=0x0;this[_0x5130('0x19')]=0x0;this[_0x5130('0x1a')]=0x0;this[_0x5130('0x1b')]=0x0;this[_0x5130('0x1c')]=0x0;this['acw']=_0x25e347[_0x5130('0x1d')]||![];this[_0x5130('0x1e')]=_0x25e347['acwTimeout']||0xa;this['autopause']=_0x25e347[_0x5130('0x1f')]||'no';this[_0x5130('0x20')]=!![];this[_0x5130('0x21')]='';this['statusMessage']='';this['originated']=0x0;this[_0x5130('0x22')]=0x0;this[_0x5130('0x23')]=_0x25e347[_0x5130('0x23')]||null;this[_0x5130('0x24')]=_0x25e347[_0x5130('0x24')]?_0x25e347[_0x5130('0x24')]:null;this['dialActive']=_0x25e347[_0x5130('0x25')];this[_0x5130('0x26')]=_0x25e347['dialMethod']||_0x5130('0x27');this['dialLimitChannel']=_0x25e347[_0x5130('0x28')]||0x0;this['dialLimitQueue']=_0x25e347[_0x5130('0x29')]||0x0;this[_0x5130('0x2a')]=_0x25e347[_0x5130('0x2a')]||0x1;this['dialPredictiveOptimization']=_0x25e347[_0x5130('0x2b')]||_0x5130('0x2c');this[_0x5130('0x2d')]=_0x25e347['dialPredictiveOptimizationPercentage']||0.03;this[_0x5130('0x2e')]=_0x25e347[_0x5130('0x2e')]||0x258;this[_0x5130('0x2f')]=_0x25e347[_0x5130('0x2f')]||'anonymous';this[_0x5130('0x30')]=_0x25e347['dialOriginateCallerIdNumber']||_0x5130('0x31');this['dialOriginateTimeout']=_0x25e347['dialOriginateTimeout']||0x1e;this[_0x5130('0x32')]=_0x25e347[_0x5130('0x32')]||_0x5130('0x33');this[_0x5130('0x34')]=_0x25e347['dialQueueTimeout']||0x3;this[_0x5130('0x35')]=_0x25e347['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x25e347[_0x5130('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x25e347[_0x5130('0x37')]||0x96;this['dialBusyMaxRetry']=_0x25e347['dialBusyMaxRetry']||0x3;this[_0x5130('0x38')]=_0x25e347['dialBusyRetryFrequency']||0x96;this[_0x5130('0x39')]=_0x25e347[_0x5130('0x39')]||0x3;this[_0x5130('0x3a')]=_0x25e347[_0x5130('0x3a')]||0x96;this[_0x5130('0x3b')]=_0x25e347[_0x5130('0x3b')]||0x3;this[_0x5130('0x3c')]=_0x25e347['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x25e347[_0x5130('0x3d')]||0x3;this[_0x5130('0x3e')]=_0x25e347[_0x5130('0x3e')]||0x96;this[_0x5130('0x3f')]=_0x25e347['dialAbandonedMaxRetry']||0x3;this[_0x5130('0x40')]=_0x25e347['dialAbandonedRetryFrequency']||0x96;this[_0x5130('0x41')]=_0x25e347[_0x5130('0x41')]||0x3;this[_0x5130('0x42')]=_0x25e347['dialMachineRetryFrequency']||0x96;this[_0x5130('0x43')]=_0x25e347['dialAgentRejectMaxRetry']||0x3;this[_0x5130('0x44')]=_0x25e347[_0x5130('0x44')]||0x96;this[_0x5130('0x45')]=_0x25e347[_0x5130('0x45')]||0x3;this[_0x5130('0x46')]=_0x25e347[_0x5130('0x46')]||0x4;this[_0x5130('0x47')]=_0x25e347['Trunk']?_0x25e347['Trunk']:undefined;this['TrunkBackup']=_0x25e347[_0x5130('0x48')]?_0x25e347[_0x5130('0x48')]:undefined;this[_0x5130('0x49')]=_0x25e347[_0x5130('0x49')]||undefined;this['Interval']=_0x25e347[_0x5130('0x4a')]?_0x25e347[_0x5130('0x4a')]:undefined;this[_0x5130('0x4b')]=_0x25e347['dialOrderByScheduledAt']||'DESC';this[_0x5130('0x4c')]=_0x25e347['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x5130('0x4d')]=_0x25e347[_0x5130('0x4d')]||undefined;this[_0x5130('0x4e')]=strategy[_0x25e347[_0x5130('0x4e')]];this[_0x5130('0x4f')]=!![];this[_0x5130('0x50')]=_0x25e347[_0x5130('0x50')]||![];this['dialAMDInitialSilence']=_0x25e347[_0x5130('0x51')];this[_0x5130('0x52')]=_0x25e347[_0x5130('0x52')];this[_0x5130('0x53')]=_0x25e347['dialAMDAfterGreetingSilence'];this[_0x5130('0x54')]=_0x25e347['dialAMDTotalAnalysisTime'];this[_0x5130('0x55')]=_0x25e347['dialAMDMinWordLength'];this[_0x5130('0x56')]=_0x25e347[_0x5130('0x56')];this['dialAMDMaximumNumberOfWords']=_0x25e347[_0x5130('0x57')];this[_0x5130('0x58')]=_0x25e347[_0x5130('0x58')];this[_0x5130('0x59')]=_0x25e347[_0x5130('0x59')];this[_0x5130('0x5a')]=0x0;this[_0x5130('0x5b')]=0x0;this[_0x5130('0x5c')]=_0x25e347[_0x5130('0x5c')];this['outboundAnswerCallsDay']=0x0;this[_0x5130('0x5d')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x5130('0x5e')]=0x0;this[_0x5130('0x5f')]=0x0;this[_0x5130('0x60')]=0x0;this[_0x5130('0x61')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x5130('0x62')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x5130('0x63')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x5130('0x64')]=0x0;this[_0x5130('0x65')]=0x0;this[_0x5130('0x66')]=undefined;this['startPredictive']=undefined;this[_0x5130('0x67')]=undefined;this[_0x5130('0x68')]=1.05;this[_0x5130('0x69')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5130('0x6a')]=0x0;this[_0x5130('0x6b')]=0x0;this[_0x5130('0x6c')]=0x0;this[_0x5130('0x6d')]=0x0;this[_0x5130('0x6e')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x25e347[_0x5130('0x6f')]||0x14;this[_0x5130('0x70')]=_0x25e347[_0x5130('0x6f')]||0xa;this[_0x5130('0x71')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x5130('0x72')]=0x1;this[_0x5130('0x73')]=0x0;this[_0x5130('0x74')]=0x0;this[_0x5130('0x75')]=0x0;this[_0x5130('0x76')]=0x0;this[_0x5130('0x77')]=_0x25e347['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x25e347[_0x5130('0x78')]||![];this['dialPreviewAutoRecallMe']=!!_0x25e347[_0x5130('0x79')]||![];this[_0x5130('0x7a')]=!!_0x25e347[_0x5130('0x7a')]||![];this[_0x5130('0x7b')]=_0x25e347[_0x5130('0x7b')]||undefined;this[_0x5130('0x7c')]=_0x25e347[_0x5130('0x7c')]||![];this[_0x5130('0x7d')]=_0x25e347[_0x5130('0x7d')]||![];this[_0x5130('0xc')]=monitorFormat[_0x25e347[_0x5130('0xc')]]?monitorFormat[_0x25e347['monitor_format']]:undefined;this[_0x5130('0x7e')]=_0x25e347[_0x5130('0x7e')]||![];this[_0x5130('0x7f')]=_0x25e347[_0x5130('0x7f')]?_0x25e347[_0x5130('0x7f')]:undefined;this[_0x5130('0x80')]=![];}module[_0x5130('0x81')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 7868dcc..a7339ba 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 _0xe599=['outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','unknown','loggedin','callers','SIP/','online','includes','status','onHold','booked','keys','length','queue','dialer','exten','xcally-motion-preview','pTalking','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0xe599,0x1e5));var _0x9e59=function(_0x4f1bbe,_0x28a443){_0x4f1bbe=_0x4f1bbe-0x0;var _0x5d1330=_0xe599[_0x4f1bbe];return _0x5d1330;};'use strict';var INBOUND_COUNTERS=[_0x9e59('0x0'),_0x9e59('0x1'),_0x9e59('0x2'),_0x9e59('0x3'),_0x9e59('0x4'),_0x9e59('0x5'),_0x9e59('0x6')];var OUTBOUND_COUNTERS=[_0x9e59('0x0'),_0x9e59('0x7'),'inUse',_0x9e59('0x1'),_0x9e59('0x2'),'originated',_0x9e59('0x8'),'outboundAnswerCallsDay',_0x9e59('0x9'),_0x9e59('0xa'),'outboundCongestionCallsDay',_0x9e59('0xb'),_0x9e59('0xc'),_0x9e59('0xd'),_0x9e59('0xe'),_0x9e59('0xf'),_0x9e59('0x3'),'pTalking',_0x9e59('0x5'),'sumBillable',_0x9e59('0x10'),_0x9e59('0x11'),_0x9e59('0x6')];function VoiceQueueSummary(_0x77f87e){this['id']=_0x77f87e['id'];this['name']=_0x77f87e[_0x9e59('0x12')];this[_0x9e59('0x13')]=_0x77f87e['strategy'];this[_0x9e59('0x14')]=_0x77f87e[_0x9e59('0x14')]||0x0;this[_0x9e59('0x7')]=_0x77f87e[_0x9e59('0x7')]||0x0;this['available']=_0x77f87e[_0x9e59('0x0')]||0x0;this[_0x9e59('0x15')]=_0x77f87e[_0x9e59('0x15')]||0x0;this[_0x9e59('0x16')]=_0x77f87e[_0x9e59('0x16')]||0x0;this[_0x9e59('0x17')]=_0x77f87e[_0x9e59('0x17')]||0x0;this[_0x9e59('0x1')]=_0x77f87e['loggedIn']||0x0;this[_0x9e59('0x2')]=_0x77f87e['loggedInDb']||0x0;this['onHold']=_0x77f87e['onHold']||0x0;this[_0x9e59('0x18')]=_0x77f87e[_0x9e59('0x18')]||0x0;this['paused']=_0x77f87e[_0x9e59('0x3')]||0x0;this[_0x9e59('0x4')]=_0x77f87e[_0x9e59('0x4')]||0x0;this[_0x9e59('0x19')]=_0x77f87e[_0x9e59('0x19')];this[_0x9e59('0x1a')]=_0x77f87e[_0x9e59('0x1a')];this['sumDuration']=_0x77f87e[_0x9e59('0x10')];this[_0x9e59('0x1b')]=_0x77f87e['sumHoldTime']||0x0;this['talking']=_0x77f87e[_0x9e59('0x5')]||0x0;this[_0x9e59('0x11')]=_0x77f87e[_0x9e59('0x11')]||0x0;this['type']=_0x77f87e[_0x9e59('0x1c')];this[_0x9e59('0x1d')]=_0x77f87e['unavailable']||0x0;this['unknown']=_0x77f87e['unknown']||0x0;this[_0x9e59('0x1e')]=_0x77f87e[_0x9e59('0x1e')]||0x0;this[_0x9e59('0x6')]=_0x77f87e[_0x9e59('0x6')]||0x0;if(_0x77f87e[_0x9e59('0x1c')]==='outbound'){this['pTalking']=_0x77f87e['pTalking']||0x0;this[_0x9e59('0x1f')]=_0x77f87e[_0x9e59('0x1f')];this[_0x9e59('0x20')]=_0x77f87e[_0x9e59('0x20')];this[_0x9e59('0x21')]=_0x77f87e[_0x9e59('0x21')];this['dialOriginateCallerIdNumber']=_0x77f87e['dialOriginateCallerIdNumber'];this[_0x9e59('0x22')]=_0x77f87e[_0x9e59('0x22')];this[_0x9e59('0x23')]=_0x77f87e[_0x9e59('0x23')];this[_0x9e59('0x24')]=_0x77f87e[_0x9e59('0x24')];this[_0x9e59('0x25')]=_0x77f87e[_0x9e59('0x25')];this[_0x9e59('0x26')]=_0x77f87e[_0x9e59('0x26')];this[_0x9e59('0x9')]=_0x77f87e[_0x9e59('0x9')];this[_0x9e59('0xa')]=_0x77f87e['outboundBusyCallsDay'];this[_0x9e59('0x27')]=_0x77f87e[_0x9e59('0x27')];this[_0x9e59('0x28')]=_0x77f87e[_0x9e59('0x28')];this[_0x9e59('0x29')]=_0x77f87e[_0x9e59('0x29')];this[_0x9e59('0x2a')]=_0x77f87e[_0x9e59('0x2a')];this[_0x9e59('0xb')]=_0x77f87e['outboundNoAnswerCallsDay'];this[_0x9e59('0xc')]=_0x77f87e['outboundNoSuchCallsDay'];this[_0x9e59('0x2b')]=_0x77f87e[_0x9e59('0x2b')];this[_0x9e59('0xd')]=_0x77f87e[_0x9e59('0xd')];this[_0x9e59('0xe')]=_0x77f87e[_0x9e59('0xe')];this[_0x9e59('0xf')]=_0x77f87e[_0x9e59('0xf')];this[_0x9e59('0x2c')]=_0x77f87e[_0x9e59('0x2c')];this[_0x9e59('0x2d')]=_0x77f87e[_0x9e59('0x2d')];this[_0x9e59('0x2e')]=_0x77f87e[_0x9e59('0x2e')];this['predictiveIntervalDroppedCallsCallersExit']=_0x77f87e[_0x9e59('0x2f')];this['predictiveIntervalDroppedCallsTimeout']=_0x77f87e[_0x9e59('0x30')];this[_0x9e59('0x31')]=_0x77f87e[_0x9e59('0x31')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x77f87e['predictiveIntervalErlangCallsDroppedCalls'];this[_0x9e59('0x32')]=_0x77f87e['predictiveIntervalHitRate'];this[_0x9e59('0x33')]=_0x77f87e['predictiveIntervalMultiplicativeFactor'];this[_0x9e59('0x34')]=_0x77f87e[_0x9e59('0x34')];this['predictiveIntervalAvailable']=_0x77f87e['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x77f87e[_0x9e59('0x35')];this['originated']=_0x77f87e[_0x9e59('0x36')];this[_0x9e59('0x37')]=_0x77f87e[_0x9e59('0x37')];this[_0x9e59('0x38')]=_0x77f87e['erlangCallToSecond'];this[_0x9e59('0x39')]=_0x77f87e[_0x9e59('0x39')];this[_0x9e59('0x3a')]=_0x77f87e[_0x9e59('0x3a')];this[_0x9e59('0x3b')]=_0x77f87e[_0x9e59('0x3b')];this[_0x9e59('0x3c')]=_0x77f87e[_0x9e59('0x3c')];this[_0x9e59('0x3d')]=_0x77f87e[_0x9e59('0x3d')];this[_0x9e59('0x3e')]=_0x77f87e[_0x9e59('0x3e')];}if(_0x77f87e[_0x9e59('0x3f')]){this['Trunk']={'id':_0x77f87e['Trunk']['id'],'name':_0x77f87e[_0x9e59('0x3f')]['name'],'active':_0x77f87e[_0x9e59('0x3f')]['active'],'callerid':_0x77f87e[_0x9e59('0x3f')][_0x9e59('0x40')]};}}VoiceQueueSummary[_0x9e59('0x41')][_0x9e59('0x42')]=function(_0x107e6c,_0x13e0d2,_0x35ce84,_0x5853fd){this[_0x9e59('0x2')]=0x0;this[_0x9e59('0x5')]=0x0;this['paused']=0x0;this[_0x9e59('0x43')]=0x0;this[_0x9e59('0x18')]=0x0;this[_0x9e59('0x16')]=0x0;this['busy']=0x0;this[_0x9e59('0x17')]=0x0;this[_0x9e59('0x1d')]=0x0;this[_0x9e59('0x4')]=0x0;this[_0x9e59('0x19')]=0x0;this['onHold']=0x0;if(_0x35ce84){if(_0x35ce84[_0x9e59('0x0')]){this[_0x9e59('0x0')]=Number(_0x35ce84['available']);}if(_0x35ce84[_0x9e59('0x44')]){this['loggedIn']=Number(_0x35ce84[_0x9e59('0x44')]);}if(_0x35ce84[_0x9e59('0x45')]){this[_0x9e59('0x6')]=Number(_0x35ce84[_0x9e59('0x45')]);}}for(var _0x349cdb=0x0;_0x349cdb<_0x107e6c['length'];_0x349cdb++){var _0x5053ab=_0x13e0d2[_0x9e59('0x46')+_0x107e6c[_0x349cdb][_0x9e59('0x12')]];if(_0x5053ab&&_0x5053ab[_0x9e59('0x47')]){this['loggedInDb']+=0x1;}if(_0x107e6c[_0x349cdb]['incall']==='1'){this[_0x9e59('0x5')]+=0x1;}if(_0x107e6c[_0x349cdb][_0x9e59('0x3')]==='1'&&!['2','7','8'][_0x9e59('0x48')](_0x107e6c[_0x349cdb][_0x9e59('0x49')])){this[_0x9e59('0x3')]+=0x1;}switch(_0x107e6c[_0x349cdb]['status']){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x9e59('0x15')]+=0x1;break;case'4':this[_0x9e59('0x17')]+=0x1;break;case'5':this[_0x9e59('0x1d')]+=0x1;break;case'6':this[_0x9e59('0x4')]+=0x1;break;case'7':this[_0x9e59('0x19')]+=0x1;break;case'8':this[_0x9e59('0x4a')]+=0x1;break;}}if(this[_0x9e59('0x20')]===_0x9e59('0x4b')){var _0x3b54fb=Object[_0x9e59('0x4c')](_0x5853fd);for(var _0x3a26c3=0x0;_0x3a26c3<_0x3b54fb[_0x9e59('0x4d')];_0x3a26c3++){var _0x5bea4e=_0x3b54fb[_0x3a26c3];var _0x313ac2=_0x5853fd[_0x5bea4e];if(_0x313ac2[_0x9e59('0x4e')]===this['name']&&_0x313ac2['type']===_0x9e59('0x4f')&&_0x313ac2[_0x9e59('0x50')]===_0x9e59('0x51')){this[_0x9e59('0x5')]+=0x1;}}if(this[_0x9e59('0x5')]>this[_0x9e59('0x16')]){this[_0x9e59('0x5')]=this[_0x9e59('0x16')];}this[_0x9e59('0x52')]=0x0;}return this;};VoiceQueueSummary[_0x9e59('0x41')]['compareToInboundQueue']=function(_0x16b42c){var _0x14c967=![];if(_0x16b42c){_0x14c967=INBOUND_COUNTERS[_0x9e59('0x53')](function(_0xf699f4){return this[_0xf699f4]!==_0x16b42c[_0xf699f4];},this);}return _0x14c967;};VoiceQueueSummary[_0x9e59('0x41')][_0x9e59('0x54')]=function(_0x5ef8fb){var _0x33f776=![];var _0x44a92d=![];var _0x1204d0=![];if(_0x5ef8fb){_0x33f776=this[_0x9e59('0x20')]!==_0x5ef8fb[_0x9e59('0x20')]||this['dialActive']!==_0x5ef8fb[_0x9e59('0x1f')]||this['message']!==_0x5ef8fb[_0x9e59('0x3d')]||this[_0x9e59('0x3e')]!==_0x5ef8fb[_0x9e59('0x3e')];_0x44a92d=OUTBOUND_COUNTERS['some'](function(_0x526b74){return this[_0x526b74]!==_0x5ef8fb[_0x526b74];},this);if(this['Trunk']&&_0x5ef8fb['Trunk']){_0x1204d0=this[_0x9e59('0x3f')][_0x9e59('0x12')]!==_0x5ef8fb[_0x9e59('0x3f')][_0x9e59('0x12')]||this[_0x9e59('0x3f')][_0x9e59('0x55')]!==_0x5ef8fb[_0x9e59('0x3f')]['active'];}}return _0x33f776||_0x44a92d||_0x1204d0;};VoiceQueueSummary[_0x9e59('0x41')][_0x9e59('0x56')]=function(_0x522224){this['answered']=_0x522224[_0x9e59('0x7')];this[_0x9e59('0x3d')]=_0x522224[_0x9e59('0x3d')];this['statusMessage']=_0x522224[_0x9e59('0x3e')];this[_0x9e59('0x36')]=_0x522224[_0x9e59('0x36')];this['outboundAbandonedCallsDay']=_0x522224[_0x9e59('0x8')];this[_0x9e59('0x26')]=_0x522224['outboundAnswerCallsDay'];this[_0x9e59('0x9')]=_0x522224[_0x9e59('0x9')];this[_0x9e59('0xa')]=_0x522224[_0x9e59('0xa')];this[_0x9e59('0x27')]=_0x522224[_0x9e59('0x27')];this[_0x9e59('0xb')]=_0x522224[_0x9e59('0xb')];this[_0x9e59('0xc')]=_0x522224[_0x9e59('0xc')];this[_0x9e59('0xd')]=_0x522224[_0x9e59('0xd')];this[_0x9e59('0xe')]=_0x522224[_0x9e59('0xe')];this[_0x9e59('0xf')]=_0x522224[_0x9e59('0xf')];this[_0x9e59('0x1a')]=_0x522224['sumBillable'];this['sumDuration']=_0x522224[_0x9e59('0x10')];this[_0x9e59('0x11')]=_0x522224['total'];if(this['dialMethod']==='preview'){this['pTalking']=_0x522224[_0x9e59('0x52')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xdbbe=['abandoned','available','busy','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','loggedin','callers','SIP/','online','incall','includes','status','invalid','length','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumDuration','total','name','strategy'];(function(_0x4875cb,_0x257624){var _0x39a78e=function(_0x4c290b){while(--_0x4c290b){_0x4875cb['push'](_0x4875cb['shift']());}};_0x39a78e(++_0x257624);}(_0xdbbe,0x148));var _0xedbb=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xdbbe[_0x50aa2e];return _0x5e07f0;};'use strict';var INBOUND_COUNTERS=['available',_0xedbb('0x0'),_0xedbb('0x1'),_0xedbb('0x2'),_0xedbb('0x3'),_0xedbb('0x4'),_0xedbb('0x5')];var OUTBOUND_COUNTERS=['available',_0xedbb('0x6'),_0xedbb('0x7'),_0xedbb('0x0'),_0xedbb('0x1'),_0xedbb('0x8'),_0xedbb('0x9'),_0xedbb('0xa'),'outboundBlacklistCallsDay',_0xedbb('0xb'),_0xedbb('0xc'),'outboundNoAnswerCallsDay',_0xedbb('0xd'),'outboundReCallsDay',_0xedbb('0xe'),_0xedbb('0xf'),_0xedbb('0x2'),'pTalking',_0xedbb('0x4'),'sumBillable',_0xedbb('0x10'),_0xedbb('0x11'),_0xedbb('0x5')];function VoiceQueueSummary(_0x41d163){this['id']=_0x41d163['id'];this['name']=_0x41d163[_0xedbb('0x12')];this[_0xedbb('0x13')]=_0x41d163[_0xedbb('0x13')];this[_0xedbb('0x14')]=_0x41d163[_0xedbb('0x14')]||0x0;this[_0xedbb('0x6')]=_0x41d163['answered']||0x0;this[_0xedbb('0x15')]=_0x41d163[_0xedbb('0x15')]||0x0;this[_0xedbb('0x16')]=_0x41d163[_0xedbb('0x16')]||0x0;this[_0xedbb('0x7')]=_0x41d163[_0xedbb('0x7')]||0x0;this['invalid']=_0x41d163['invalid']||0x0;this[_0xedbb('0x0')]=_0x41d163[_0xedbb('0x0')]||0x0;this['loggedInDb']=_0x41d163[_0xedbb('0x1')]||0x0;this[_0xedbb('0x17')]=_0x41d163[_0xedbb('0x17')]||0x0;this['notInUse']=_0x41d163[_0xedbb('0x18')]||0x0;this['paused']=_0x41d163['paused']||0x0;this['ringing']=_0x41d163['ringing']||0x0;this[_0xedbb('0x19')]=_0x41d163['ringInUse'];this['sumBillable']=_0x41d163[_0xedbb('0x1a')];this[_0xedbb('0x10')]=_0x41d163[_0xedbb('0x10')];this[_0xedbb('0x1b')]=_0x41d163[_0xedbb('0x1b')]||0x0;this[_0xedbb('0x4')]=_0x41d163['talking']||0x0;this[_0xedbb('0x11')]=_0x41d163[_0xedbb('0x11')]||0x0;this[_0xedbb('0x1c')]=_0x41d163['type'];this[_0xedbb('0x1d')]=_0x41d163[_0xedbb('0x1d')]||0x0;this[_0xedbb('0x1e')]=_0x41d163['unknown']||0x0;this[_0xedbb('0x1f')]=_0x41d163[_0xedbb('0x1f')]||0x0;this[_0xedbb('0x5')]=_0x41d163[_0xedbb('0x5')]||0x0;if(_0x41d163[_0xedbb('0x1c')]===_0xedbb('0x20')){this[_0xedbb('0x21')]=_0x41d163[_0xedbb('0x21')]||0x0;this[_0xedbb('0x22')]=_0x41d163['dialActive'];this[_0xedbb('0x23')]=_0x41d163[_0xedbb('0x23')];this[_0xedbb('0x24')]=_0x41d163['dialOriginateCallerIdName'];this[_0xedbb('0x25')]=_0x41d163[_0xedbb('0x25')];this['dialOriginateTimeout']=_0x41d163['dialOriginateTimeout'];this['dialPrefix']=_0x41d163[_0xedbb('0x26')];this[_0xedbb('0x27')]=_0x41d163[_0xedbb('0x27')];this[_0xedbb('0x28')]=_0x41d163[_0xedbb('0x28')];this['outboundAnswerCallsDay']=_0x41d163[_0xedbb('0xa')];this[_0xedbb('0x29')]=_0x41d163[_0xedbb('0x29')];this[_0xedbb('0xb')]=_0x41d163[_0xedbb('0xb')];this['outboundCongestionCallsDay']=_0x41d163[_0xedbb('0xc')];this[_0xedbb('0x2a')]=_0x41d163[_0xedbb('0x2a')];this[_0xedbb('0x2b')]=_0x41d163[_0xedbb('0x2b')];this[_0xedbb('0x2c')]=_0x41d163[_0xedbb('0x2c')];this['outboundNoAnswerCallsDay']=_0x41d163[_0xedbb('0x2d')];this[_0xedbb('0xd')]=_0x41d163[_0xedbb('0xd')];this['outboundOriginateFailureCallsDay']=_0x41d163['outboundOriginateFailureCallsDay'];this[_0xedbb('0x2e')]=_0x41d163['outboundReCallsDay'];this[_0xedbb('0xe')]=_0x41d163[_0xedbb('0xe')];this[_0xedbb('0xf')]=_0x41d163[_0xedbb('0xf')];this['predictiveIntervalAnsweredCalls']=_0x41d163[_0xedbb('0x2f')];this[_0xedbb('0x30')]=_0x41d163['predictiveIntervalAvgHoldtime'];this[_0xedbb('0x31')]=_0x41d163[_0xedbb('0x31')];this['predictiveIntervalDroppedCallsCallersExit']=_0x41d163[_0xedbb('0x32')];this['predictiveIntervalDroppedCallsTimeout']=_0x41d163[_0xedbb('0x33')];this[_0xedbb('0x34')]=_0x41d163['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x41d163['predictiveIntervalErlangCallsDroppedCalls'];this[_0xedbb('0x35')]=_0x41d163['predictiveIntervalHitRate'];this[_0xedbb('0x36')]=_0x41d163[_0xedbb('0x36')];this[_0xedbb('0x37')]=_0x41d163['predictiveIntervalPauses'];this[_0xedbb('0x38')]=_0x41d163[_0xedbb('0x38')];this[_0xedbb('0x39')]=_0x41d163[_0xedbb('0x39')];this[_0xedbb('0x8')]=_0x41d163[_0xedbb('0x8')];this[_0xedbb('0x3a')]=_0x41d163[_0xedbb('0x3a')];this['erlangCallToSecond']=_0x41d163[_0xedbb('0x3b')];this[_0xedbb('0x3c')]=_0x41d163['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x41d163[_0xedbb('0x3d')];this[_0xedbb('0x3e')]=_0x41d163[_0xedbb('0x3e')];this[_0xedbb('0x3f')]=_0x41d163[_0xedbb('0x3f')];this[_0xedbb('0x40')]=_0x41d163['message'];this[_0xedbb('0x41')]=_0x41d163[_0xedbb('0x41')];}if(_0x41d163[_0xedbb('0x42')]){this[_0xedbb('0x42')]={'id':_0x41d163['Trunk']['id'],'name':_0x41d163[_0xedbb('0x42')][_0xedbb('0x12')],'active':_0x41d163[_0xedbb('0x42')]['active'],'callerid':_0x41d163['Trunk'][_0xedbb('0x43')]};}}VoiceQueueSummary[_0xedbb('0x44')]['createReport']=function(_0x25998c,_0x2c99a9,_0x3fc00d,_0x42a555){this[_0xedbb('0x1')]=0x0;this[_0xedbb('0x4')]=0x0;this[_0xedbb('0x2')]=0x0;this['unknown']=0x0;this[_0xedbb('0x18')]=0x0;this['inUse']=0x0;this[_0xedbb('0x16')]=0x0;this['invalid']=0x0;this[_0xedbb('0x1d')]=0x0;this[_0xedbb('0x3')]=0x0;this[_0xedbb('0x19')]=0x0;this[_0xedbb('0x17')]=0x0;if(_0x3fc00d){if(_0x3fc00d[_0xedbb('0x15')]){this['available']=Number(_0x3fc00d[_0xedbb('0x15')]);}if(_0x3fc00d[_0xedbb('0x45')]){this[_0xedbb('0x0')]=Number(_0x3fc00d[_0xedbb('0x45')]);}if(_0x3fc00d[_0xedbb('0x46')]){this[_0xedbb('0x5')]=Number(_0x3fc00d[_0xedbb('0x46')]);}}for(var _0x42f8a9=0x0;_0x42f8a9<_0x25998c['length'];_0x42f8a9++){var _0x1390ec=_0x2c99a9[_0xedbb('0x47')+_0x25998c[_0x42f8a9][_0xedbb('0x12')]];if(_0x1390ec&&_0x1390ec[_0xedbb('0x48')]){this[_0xedbb('0x1')]+=0x1;}if(_0x25998c[_0x42f8a9][_0xedbb('0x49')]==='1'){this[_0xedbb('0x4')]+=0x1;}if(_0x25998c[_0x42f8a9]['paused']==='1'&&!['2','7','8'][_0xedbb('0x4a')](_0x25998c[_0x42f8a9][_0xedbb('0x4b')])){this['paused']+=0x1;}switch(_0x25998c[_0x42f8a9]['status']){case'0':this[_0xedbb('0x1e')]+=0x1;break;case'1':this[_0xedbb('0x18')]+=0x1;break;case'2':this[_0xedbb('0x7')]+=0x1;break;case'3':this[_0xedbb('0x16')]+=0x1;break;case'4':this[_0xedbb('0x4c')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xedbb('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xedbb('0x17')]+=0x1;break;}}if(this[_0xedbb('0x23')]==='booked'){var _0x3f3f36=Object['keys'](_0x42a555);for(var _0x4f330a=0x0;_0x4f330a<_0x3f3f36[_0xedbb('0x4d')];_0x4f330a++){var _0xee17f6=_0x3f3f36[_0x4f330a];var _0x362295=_0x42a555[_0xee17f6];if(_0x362295[_0xedbb('0x4e')]===this[_0xedbb('0x12')]&&_0x362295['type']===_0xedbb('0x4f')&&_0x362295[_0xedbb('0x50')]==='xcally-motion-preview'){this[_0xedbb('0x4')]+=0x1;}}if(this['talking']>this[_0xedbb('0x7')]){this['talking']=this[_0xedbb('0x7')];}this[_0xedbb('0x21')]=0x0;}return this;};VoiceQueueSummary[_0xedbb('0x44')][_0xedbb('0x51')]=function(_0xae7e4f){var _0x2a4b51=![];if(_0xae7e4f){_0x2a4b51=INBOUND_COUNTERS[_0xedbb('0x52')](function(_0xa50c1c){return this[_0xa50c1c]!==_0xae7e4f[_0xa50c1c];},this);}return _0x2a4b51;};VoiceQueueSummary[_0xedbb('0x44')][_0xedbb('0x53')]=function(_0x1830c8){var _0x22e2de=![];var _0x29dc68=![];var _0x1005c7=![];if(_0x1830c8){_0x22e2de=this[_0xedbb('0x23')]!==_0x1830c8[_0xedbb('0x23')]||this[_0xedbb('0x22')]!==_0x1830c8['dialActive']||this[_0xedbb('0x40')]!==_0x1830c8[_0xedbb('0x40')]||this[_0xedbb('0x41')]!==_0x1830c8[_0xedbb('0x41')];_0x29dc68=OUTBOUND_COUNTERS[_0xedbb('0x52')](function(_0x3daa09){return this[_0x3daa09]!==_0x1830c8[_0x3daa09];},this);if(this[_0xedbb('0x42')]&&_0x1830c8[_0xedbb('0x42')]){_0x1005c7=this['Trunk'][_0xedbb('0x12')]!==_0x1830c8[_0xedbb('0x42')][_0xedbb('0x12')]||this[_0xedbb('0x42')][_0xedbb('0x54')]!==_0x1830c8['Trunk'][_0xedbb('0x54')];}}return _0x22e2de||_0x29dc68||_0x1005c7;};VoiceQueueSummary[_0xedbb('0x44')][_0xedbb('0x55')]=function(_0x387756){this[_0xedbb('0x6')]=_0x387756[_0xedbb('0x6')];this[_0xedbb('0x40')]=_0x387756[_0xedbb('0x40')];this[_0xedbb('0x41')]=_0x387756[_0xedbb('0x41')];this[_0xedbb('0x8')]=_0x387756[_0xedbb('0x8')];this['outboundAbandonedCallsDay']=_0x387756[_0xedbb('0x9')];this[_0xedbb('0xa')]=_0x387756[_0xedbb('0xa')];this[_0xedbb('0x29')]=_0x387756[_0xedbb('0x29')];this[_0xedbb('0xb')]=_0x387756[_0xedbb('0xb')];this[_0xedbb('0xc')]=_0x387756[_0xedbb('0xc')];this['outboundNoAnswerCallsDay']=_0x387756[_0xedbb('0x2d')];this[_0xedbb('0xd')]=_0x387756['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x387756['outboundReCallsDay'];this[_0xedbb('0xe')]=_0x387756[_0xedbb('0xe')];this['outboundUnknownCallsDay']=_0x387756[_0xedbb('0xf')];this['sumBillable']=_0x387756[_0xedbb('0x1a')];this[_0xedbb('0x10')]=_0x387756[_0xedbb('0x10')];this[_0xedbb('0x11')]=_0x387756[_0xedbb('0x11')];if(this[_0xedbb('0x23')]==='preview'){this[_0xedbb('0x21')]=_0x387756['pTalking'];}};module[_0xedbb('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f15c676..df8ec1d 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 _0x0d01=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4c42ff,_0x3d3d75){var _0x27387f=function(_0x2b0971){while(--_0x2b0971){_0x4c42ff['push'](_0x4c42ff['shift']());}};_0x27387f(++_0x3d3d75);}(_0x0d01,0x76));var _0x10d0=function(_0x5912f5,_0x5cbcb9){_0x5912f5=_0x5912f5-0x0;var _0x174e22=_0x0d01[_0x5912f5];return _0x174e22;};'use strict';function VtigerAccount(_0x157ec0){this['id']=_0x157ec0['id']||0x0;this['name']=_0x157ec0[_0x10d0('0x0')]||'';this[_0x10d0('0x1')]=_0x157ec0[_0x10d0('0x1')]||'';this[_0x10d0('0x2')]=_0x157ec0[_0x10d0('0x2')]||'';this[_0x10d0('0x3')]=_0x157ec0[_0x10d0('0x3')]||'';this['serverUrl']=_0x157ec0[_0x10d0('0x4')]||'';this['Configurations']=_0x157ec0[_0x10d0('0x5')]||{};}module[_0x10d0('0x6')]=VtigerAccount; \ No newline at end of file +var _0xac2c=['accessKey','remoteUri','serverUrl','exports','username'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xac2c,0x16c));var _0xcac2=function(_0x5a452e,_0x355a90){_0x5a452e=_0x5a452e-0x0;var _0x2c4c43=_0xac2c[_0x5a452e];return _0x2c4c43;};'use strict';function VtigerAccount(_0x299008){this['id']=_0x299008['id']||0x0;this['name']=_0x299008['name']||'';this[_0xcac2('0x0')]=_0x299008['username']||'';this['accessKey']=_0x299008[_0xcac2('0x1')]||'';this['remoteUri']=_0x299008[_0xcac2('0x2')]||'';this['serverUrl']=_0x299008[_0xcac2('0x3')]||'';this['Configurations']=_0x299008['Configurations']||{};}module[_0xcac2('0x4')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index cbe0333..2dcd236 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 _0xf923=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x3aa13a,_0x4a9168){var _0xbb0bf7=function(_0x10d1f0){while(--_0x10d1f0){_0x3aa13a['push'](_0x3aa13a['shift']());}};_0xbb0bf7(++_0x4a9168);}(_0xf923,0x79));var _0x3f92=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xf923[_0x2132a3];return _0x21890c;};'use strict';function ZendeskAccount(_0x295d85){this['id']=_0x295d85['id']||0x0;this[_0x3f92('0x0')]=_0x295d85[_0x3f92('0x0')]||'';this[_0x3f92('0x1')]=_0x295d85[_0x3f92('0x1')]||'';this['password']=_0x295d85[_0x3f92('0x2')]||'';this[_0x3f92('0x3')]=_0x295d85[_0x3f92('0x3')]||'';this['remoteUri']=_0x295d85[_0x3f92('0x4')]||'';this[_0x3f92('0x5')]=_0x295d85[_0x3f92('0x5')]||'';this[_0x3f92('0x6')]=_0x295d85[_0x3f92('0x6')]||_0x3f92('0x7');this[_0x3f92('0x8')]=_0x295d85[_0x3f92('0x8')]||'';this[_0x3f92('0x9')]=_0x295d85[_0x3f92('0x9')]||{};}module[_0x3f92('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x4ec2=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x5a07f4,_0x5dd927){var _0xaa5dc2=function(_0x1d6d82){while(--_0x1d6d82){_0x5a07f4['push'](_0x5a07f4['shift']());}};_0xaa5dc2(++_0x5dd927);}(_0x4ec2,0x13d));var _0x24ec=function(_0x2f6396,_0x50df65){_0x2f6396=_0x2f6396-0x0;var _0x16bcc1=_0x4ec2[_0x2f6396];return _0x16bcc1;};'use strict';function ZendeskAccount(_0x28e252){this['id']=_0x28e252['id']||0x0;this[_0x24ec('0x0')]=_0x28e252[_0x24ec('0x0')]||'';this[_0x24ec('0x1')]=_0x28e252[_0x24ec('0x1')]||'';this[_0x24ec('0x2')]=_0x28e252['password']||'';this[_0x24ec('0x3')]=_0x28e252['token']||'';this[_0x24ec('0x4')]=_0x28e252[_0x24ec('0x4')]||'';this[_0x24ec('0x5')]=_0x28e252['authType']||'';this[_0x24ec('0x6')]=_0x28e252[_0x24ec('0x6')]||_0x24ec('0x7');this[_0x24ec('0x8')]=_0x28e252[_0x24ec('0x8')]||'';this['Configurations']=_0x28e252[_0x24ec('0x9')]||{};}module[_0x24ec('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 51ef3cc..99766c9 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 _0x97da=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x473738,_0x15ea31){var _0x1df4ae=function(_0x417a72){while(--_0x417a72){_0x473738['push'](_0x473738['shift']());}};_0x1df4ae(++_0x15ea31);}(_0x97da,0x12e));var _0xa97d=function(_0x96ef0,_0x374394){_0x96ef0=_0x96ef0-0x0;var _0x40ff53=_0x97da[_0x96ef0];return _0x40ff53;};'use strict';function ZohoAccount(_0x4641a8){this['id']=_0x4641a8['id']||0x0;this[_0xa97d('0x0')]=_0x4641a8[_0xa97d('0x0')]||'';this[_0xa97d('0x1')]=_0x4641a8[_0xa97d('0x1')]||'';this[_0xa97d('0x2')]=_0x4641a8[_0xa97d('0x2')]||'';this[_0xa97d('0x3')]=_0x4641a8['zone']||'';this[_0xa97d('0x4')]=_0x4641a8['clientId']||'';this['clientSecret']=_0x4641a8[_0xa97d('0x5')]||'';this[_0xa97d('0x6')]=_0x4641a8['serverUrl']||'';this[_0xa97d('0x7')]=_0x4641a8['code']||'';this[_0xa97d('0x8')]=_0x4641a8[_0xa97d('0x8')]||'';this['Configurations']=_0x4641a8[_0xa97d('0x9')]||{};}module[_0xa97d('0xa')]=ZohoAccount; \ No newline at end of file +var _0x6c33=['clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId'];(function(_0x5e129c,_0x34efa1){var _0x1a599a=function(_0x40322f){while(--_0x40322f){_0x5e129c['push'](_0x5e129c['shift']());}};_0x1a599a(++_0x34efa1);}(_0x6c33,0x18b));var _0x36c3=function(_0x5d09d9,_0x181abf){_0x5d09d9=_0x5d09d9-0x0;var _0x7ce182=_0x6c33[_0x5d09d9];return _0x7ce182;};'use strict';function ZohoAccount(_0x573729){this['id']=_0x573729['id']||0x0;this[_0x36c3('0x0')]=_0x573729[_0x36c3('0x0')]||'';this['description']=_0x573729[_0x36c3('0x1')]||'';this['host']=_0x573729[_0x36c3('0x2')]||'';this['zone']=_0x573729[_0x36c3('0x3')]||'';this[_0x36c3('0x4')]=_0x573729['clientId']||'';this[_0x36c3('0x5')]=_0x573729[_0x36c3('0x5')]||'';this[_0x36c3('0x6')]=_0x573729[_0x36c3('0x6')]||'';this[_0x36c3('0x7')]=_0x573729[_0x36c3('0x7')]||'';this[_0x36c3('0x8')]=_0x573729[_0x36c3('0x8')]||'';this[_0x36c3('0x9')]=_0x573729['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 66df1df..edca4d8 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 _0xef0f=['dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','idContact','name','type','campaigntype','queue'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0xef0f,0x168));var _0xfef0=function(_0x436989,_0x307d89){_0x436989=_0x436989-0x0;var _0x2e9ce5=_0xef0f[_0x436989];return _0x2e9ce5;};'use strict';var util=require(_0xfef0('0x0'));var _=require('lodash');var moment=require(_0xfef0('0x1'));function checkNameSurname(_0x22a6a3,_0x19f865,_0x4d29e5){var _0x3fc3a1='';if(!_[_0xfef0('0x2')](_0x19f865)&&_0xfef0('0x3')===typeof _0x19f865){_0x3fc3a1+=_0x19f865;}if(!_['isNil'](_0x4d29e5)&&_0xfef0('0x3')===typeof _0x4d29e5){_0x3fc3a1+='\x20'+_0x4d29e5;}if(_0x3fc3a1!==''){return _0x3fc3a1;}return _0x22a6a3;}function Action(_0x9b8b9e,_0x2697df,_0x315a8c,_0xad43e,_0x11dfd7){this['uniqueid']=_0x315a8c||undefined;this[_0xfef0('0x4')]=_0x9b8b9e['id'];this['queue']=_0x2697df[_0xfef0('0x5')];this[_0xfef0('0x6')]=_0x2697df[_0xfef0('0x6')];this[_0xfef0('0x7')]=_0xfef0('0x8');this[_0xfef0('0x9')]=![];this[_0xfef0('0xa')]=_[_0xfef0('0x2')](_0x9b8b9e[_0xfef0('0xb')])?undefined:_0x9b8b9e[_0xfef0('0xb')][_0xfef0('0x5')];this[_0xfef0('0xc')]=this[_0xfef0('0xa')]?util[_0xfef0('0xd')]('SIP/%s',this[_0xfef0('0xa')]):_0xad43e||undefined;this[_0xfef0('0xe')]=checkNameSurname(_0x9b8b9e[_0xfef0('0xf')][_0xfef0('0x10')],_0x9b8b9e[_0xfef0('0xf')][_0xfef0('0x11')],_0x9b8b9e[_0xfef0('0xf')]['lastName']);this[_0xfef0('0x12')]=_0x9b8b9e['active']||![];this['calleridnum']=_0x9b8b9e['phone'];this[_0xfef0('0x13')]=_0x9b8b9e[_0xfef0('0x13')];this[_0xfef0('0x14')]=_0x9b8b9e[_0xfef0('0x14')]||0x0;this[_0xfef0('0x15')]=_0x9b8b9e[_0xfef0('0x15')]||0x0;this[_0xfef0('0x16')]=_0x9b8b9e[_0xfef0('0x16')]||0x0;this['countglobal']=(_0x9b8b9e[_0xfef0('0x14')]||0x0)+(_0x9b8b9e[_0xfef0('0x15')]||0x0)+(_0x9b8b9e[_0xfef0('0x16')]||0x0)+(_0x9b8b9e[_0xfef0('0x17')]||0x0)+(_0x9b8b9e[_0xfef0('0x18')]||0x0)+(_0x9b8b9e['countabandonedretry']||0x0)+(_0x9b8b9e[_0xfef0('0x19')]||0x0)+(_0x9b8b9e['countagentrejectretry']||0x0);this[_0xfef0('0x17')]=_0x9b8b9e[_0xfef0('0x17')]||0x0;this[_0xfef0('0x18')]=_0x9b8b9e['countdropretry']||0x0;this[_0xfef0('0x1a')]=_0x9b8b9e['countabandonedretry']||0x0;this[_0xfef0('0x19')]=_0x9b8b9e[_0xfef0('0x19')]||0x0;this['countagentrejectretry']=_0x9b8b9e['countagentrejectretry']||0x0;this['callback']=_0x9b8b9e[_0xfef0('0x1b')];this['callbackuniqueid']=_0x9b8b9e[_0xfef0('0x1c')];this[_0xfef0('0x1d')]=_0x9b8b9e[_0xfef0('0x1d')];this[_0xfef0('0x1e')]=_0x9b8b9e[_0xfef0('0x1e')];this[_0xfef0('0x1f')]=_0x9b8b9e['ContactId'];this['ListId']=_0x9b8b9e[_0xfef0('0x20')];this[_0xfef0('0x21')]=_[_0xfef0('0x2')](_0x9b8b9e[_0xfef0('0xb')])?_0x9b8b9e[_0xfef0('0x21')]:_0x9b8b9e[_0xfef0('0xb')]['id'];this[_0xfef0('0x22')]=_0x9b8b9e[_0xfef0('0x22')];this[_0xfef0('0x23')]='';this['originatecalleridname']='';}Action[_0xfef0('0x24')][_0xfef0('0x25')]=function(){return util[_0xfef0('0xd')](_0xfef0('0x26'),this[_0xfef0('0xe')],this[_0xfef0('0x27')]);};module[_0xfef0('0x28')]=Action; \ No newline at end of file +var _0x6a55=['countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','util','isNil','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry'];(function(_0x5d054e,_0x19c2e0){var _0x28db29=function(_0x55886e){while(--_0x55886e){_0x5d054e['push'](_0x5d054e['shift']());}};_0x28db29(++_0x19c2e0);}(_0x6a55,0xdb));var _0x56a5=function(_0x16e9b5,_0x192142){_0x16e9b5=_0x16e9b5-0x0;var _0x206df0=_0x6a55[_0x16e9b5];return _0x206df0;};'use strict';var util=require(_0x56a5('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x4ec858,_0x173b37,_0x47b337){var _0x561353='';if(!_[_0x56a5('0x1')](_0x173b37)&&'string'===typeof _0x173b37){_0x561353+=_0x173b37;}if(!_[_0x56a5('0x1')](_0x47b337)&&'string'===typeof _0x47b337){_0x561353+='\x20'+_0x47b337;}if(_0x561353!==''){return _0x561353;}return _0x4ec858;}function Action(_0x28bb2b,_0x380b1b,_0x42d164,_0x293ea1,_0x444c65){this[_0x56a5('0x2')]=_0x42d164||undefined;this[_0x56a5('0x3')]=_0x28bb2b['id'];this[_0x56a5('0x4')]=_0x380b1b['name'];this[_0x56a5('0x5')]=_0x380b1b[_0x56a5('0x5')];this[_0x56a5('0x6')]=_0x56a5('0x4');this[_0x56a5('0x7')]=![];this[_0x56a5('0x8')]=_[_0x56a5('0x1')](_0x28bb2b[_0x56a5('0x9')])?undefined:_0x28bb2b[_0x56a5('0x9')]['name'];this['channelAgent']=this[_0x56a5('0x8')]?util[_0x56a5('0xa')](_0x56a5('0xb'),this[_0x56a5('0x8')]):_0x293ea1||undefined;this[_0x56a5('0xc')]=checkNameSurname(_0x28bb2b[_0x56a5('0xd')]['phone'],_0x28bb2b['Contact'][_0x56a5('0xe')],_0x28bb2b[_0x56a5('0xd')][_0x56a5('0xf')]);this[_0x56a5('0x10')]=_0x28bb2b[_0x56a5('0x10')]||![];this[_0x56a5('0x11')]=_0x28bb2b[_0x56a5('0x12')];this['scheduledat']=_0x28bb2b[_0x56a5('0x13')];this['countbusyretry']=_0x28bb2b[_0x56a5('0x14')]||0x0;this['countcongestionretry']=_0x28bb2b[_0x56a5('0x15')]||0x0;this[_0x56a5('0x16')]=_0x28bb2b[_0x56a5('0x16')]||0x0;this[_0x56a5('0x17')]=(_0x28bb2b[_0x56a5('0x14')]||0x0)+(_0x28bb2b[_0x56a5('0x15')]||0x0)+(_0x28bb2b[_0x56a5('0x16')]||0x0)+(_0x28bb2b['countnosuchnumberretry']||0x0)+(_0x28bb2b[_0x56a5('0x18')]||0x0)+(_0x28bb2b[_0x56a5('0x19')]||0x0)+(_0x28bb2b[_0x56a5('0x1a')]||0x0)+(_0x28bb2b[_0x56a5('0x1b')]||0x0);this['countnosuchnumberretry']=_0x28bb2b[_0x56a5('0x1c')]||0x0;this[_0x56a5('0x18')]=_0x28bb2b[_0x56a5('0x18')]||0x0;this[_0x56a5('0x19')]=_0x28bb2b[_0x56a5('0x19')]||0x0;this['countmachineretry']=_0x28bb2b['countmachineretry']||0x0;this[_0x56a5('0x1b')]=_0x28bb2b[_0x56a5('0x1b')]||0x0;this['callback']=_0x28bb2b[_0x56a5('0x1d')];this[_0x56a5('0x1e')]=_0x28bb2b[_0x56a5('0x1e')];this[_0x56a5('0x1f')]=_0x28bb2b[_0x56a5('0x1f')];this[_0x56a5('0x20')]=_0x28bb2b[_0x56a5('0x20')];this[_0x56a5('0x21')]=_0x28bb2b[_0x56a5('0x21')];this[_0x56a5('0x22')]=_0x28bb2b[_0x56a5('0x22')];this[_0x56a5('0x23')]=_[_0x56a5('0x1')](_0x28bb2b['Agent'])?_0x28bb2b[_0x56a5('0x23')]:_0x28bb2b[_0x56a5('0x9')]['id'];this[_0x56a5('0x24')]=_0x28bb2b[_0x56a5('0x24')];this[_0x56a5('0x25')]='';this['originatecalleridname']='';}Action[_0x56a5('0x26')]['getCaller']=function(){return util[_0x56a5('0xa')](_0x56a5('0x27'),this[_0x56a5('0xc')],this[_0x56a5('0x28')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index f6f5cde..c3ac597 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 _0x54ef=['DEACTIVATED','\x20is\x20deactivated','syncCampaigns','campaignsPreview','hasOwnProperty','dialMethod','booked','type','clearZombieChannels','outbound','recallMe','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','dialActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','custom:agentConnectPreview','custom:agentcomplete','complete','total','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','incrementPreviewCounters','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','additional','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','cause-txt','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','isNil','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','trunks','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','variablesAction','[originateFailure][logOriginateFailure]','logLookAgent','clone','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','addVariable','variables','filterKey','keys','variable','error','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','../dialer/utils','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20'];(function(_0x4e2aed,_0x29773b){var _0x591983=function(_0x4a8fd4){while(--_0x4a8fd4){_0x4e2aed['push'](_0x4e2aed['shift']());}};_0x591983(++_0x29773b);}(_0x54ef,0x112));var _0xf54e=function(_0x13a660,_0x41a343){_0x13a660=_0x13a660-0x0;var _0x323095=_0x54ef[_0x13a660];return _0x323095;};'use strict';var util=require(_0xf54e('0x0'));var _=require(_0xf54e('0x1'));var uuid=require(_0xf54e('0x2'));var moment=require('moment');var Redis=require(_0xf54e('0x3'));var config=require(_0xf54e('0x4'));var logger=require(_0xf54e('0x5'))(_0xf54e('0x6'));var loggerAction=require(_0xf54e('0x5'))(_0xf54e('0x7'));var ami=require(_0xf54e('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xf54e('0x9'));var ut=require(_0xf54e('0xa'));var utils=require(_0xf54e('0xb'));config['redis']=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var io=require(_0xf54e('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xf54e('0xf')][_0xf54e('0x10')]=function(_0x6b9e61){this[_0xf54e('0x11')]=this['tail']?this[_0xf54e('0x11')][_0xf54e('0x12')](_0x6b9e61):_0x6b9e61();};function Preview(_0x143d66){this[_0xf54e('0x13')]=new Sequence();this['campaignsPreview']=_0x143d66[_0xf54e('0x14')];this['trunks']=_0x143d66['trunks'];this[_0xf54e('0x15')]={};this[_0xf54e('0x16')]=_0x143d66[_0xf54e('0x16')];this[_0xf54e('0x17')]=0x0;ami['on']('originateresponse',this[_0xf54e('0x18')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x1a'),this[_0xf54e('0x1b')]['bind'](this));ami['on'](_0xf54e('0x1c'),this[_0xf54e('0x1d')][_0xf54e('0x19')](this));ami['on']('dialend',this['syncDialEnd'][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x1e'),this[_0xf54e('0x1f')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x20'),this[_0xf54e('0x21')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x22'),this[_0xf54e('0x23')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x24'),this['syncBlindTransfer']['bind'](this));this[_0xf54e('0x25')](this['campaignsPreview']);}function emit(_0x3e1556,_0x1bfe99,_0x106362){io['to'](_0x3e1556)[_0xf54e('0x26')](_0x1bfe99,_0x106362);}function emitVoiceQueueChannelRemove(_0xf64f12){logger[_0xf54e('0x27')](_0xf54e('0x28'),JSON[_0xf54e('0x29')](_0xf64f12));emit(util[_0xf54e('0x2a')](_0xf54e('0x2b'),_0xf64f12[_0xf54e('0x2c')]),'voice_queue_channel:remove',_0xf64f12);io[_0xf54e('0x26')]('voice_queue_presence:remove',_0xf64f12);}function notSendMessagesQueue(_0x264a8f){if(_0x264a8f[_0xf54e('0x2d')]){if(_0x264a8f[_0xf54e('0x2e')]===0x0&&_0x264a8f[_0xf54e('0x2f')]===0x0){_0x264a8f[_0xf54e('0x2d')]=![];_0x264a8f[_0xf54e('0x30')]=0x0;_0x264a8f[_0xf54e('0x31')]=0x0;_0x264a8f[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x34')];ut[_0xf54e('0x35')](_0xf54e('0x36'),_0x264a8f[_0xf54e('0x2c')]+'\x20is\x20not\x20active');}else{_0x264a8f[_0xf54e('0x32')]=utils['CAMPAIGN_STATUS'][_0xf54e('0x37')];ut['logger'](_0xf54e('0x36'),_0x264a8f[_0xf54e('0x2c')]+_0xf54e('0x38'));}}}Preview[_0xf54e('0xf')][_0xf54e('0x25')]=function(){var _0x3993e4=this;setInterval(function(){_0x3993e4[_0xf54e('0x39')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x2f96b1=this[_0xf54e('0x3a')];this[_0xf54e('0x17')]+=0x1;for(var _0x16d00f in _0x2f96b1){if(_0x2f96b1[_0xf54e('0x3b')](_0x16d00f)&&(_0x2f96b1[_0x16d00f][_0xf54e('0x3c')]===_0xf54e('0x6')||_0x2f96b1[_0x16d00f][_0xf54e('0x3c')]===_0xf54e('0x3d'))&&_0x2f96b1[_0x16d00f][_0xf54e('0x3e')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xf54e('0x17')]=0x0;this[_0xf54e('0x3f')]();}}if(_0x2f96b1['hasOwnProperty'](_0x16d00f)&&_0x2f96b1[_0x16d00f][_0xf54e('0x3c')]===_0xf54e('0x6')&&_0x2f96b1[_0x16d00f][_0xf54e('0x3e')]===_0xf54e('0x40')){if(_0x2f96b1[_0x16d00f]['dialActive']){this['setMessage'](_0x2f96b1[_0x16d00f]);if(_0x2f96b1[_0x16d00f]['dialPreviewAutoRecallMe'])this[_0xf54e('0x41')](_0x2f96b1[_0x16d00f]);}else{notSendMessagesQueue(_0x2f96b1[_0x16d00f]);}}}};Preview[_0xf54e('0xf')][_0xf54e('0x42')]=function(_0x399e68){var _0x29dc39=this;this[_0xf54e('0x13')]['enqueue'](function(){if(!_['isNil'](_0x29dc39['actions'][_0x399e68])){loggerAction[_0xf54e('0x27')](_0xf54e('0x43'),_0x399e68,'Queue',_0x29dc39['actions'][_0x399e68][_0xf54e('0x44')],_0xf54e('0x45'),JSON[_0xf54e('0x29')](_0x29dc39['campaignsPreview'][_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]]['originated']),_0xf54e('0x46'),JSON[_0xf54e('0x29')](_0x29dc39[_0xf54e('0x3a')][_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]][_0xf54e('0x2f')]),JSON['stringify'](_0x29dc39['actions'][_0x399e68][_0xf54e('0x47')]),JSON[_0xf54e('0x29')](_[_0xf54e('0x48')](_0x29dc39['actions'][_0x399e68],[_0xf54e('0x49'),_0xf54e('0x4a'),_0xf54e('0x4b'),_0xf54e('0x4c')])));return ami[_0xf54e('0x4d')]({'action':_0xf54e('0x4e'),'channel':_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x4f')]})[_0xf54e('0x50')](function(_0x2087b3){if(_0x2087b3[_0xf54e('0x32')]===_0xf54e('0x51')){setTimeout(function(){if(_0x29dc39[_0xf54e('0x15')][_0x399e68]){ut[_0xf54e('0x52')](_0x29dc39[_0xf54e('0x3a')][_0x29dc39['actions'][_0x399e68]['queue']],'[clearZombieChannel]');if(_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x47')]===!![]){ut['decrementTalkink'](_0x29dc39[_0xf54e('0x3a')][_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]],'[clearZombieChannel]');ut[_0xf54e('0x53')](_0xf54e('0x54')+_0x399e68,_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]);}ut[_0xf54e('0x53')](_0xf54e('0x55')+_0x399e68,_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]);delete _0x29dc39[_0xf54e('0x15')][_0x399e68];}},0x2328);}});}});};Preview['prototype'][_0xf54e('0x3f')]=function(){var _0x3447fd=this;loggerAction[_0xf54e('0x27')](_0xf54e('0x56'),_[_0xf54e('0x57')](this[_0xf54e('0x15')]));for(var _0x52c47d in this[_0xf54e('0x15')]){if(_0x3447fd['actions'][_0xf54e('0x3b')](_0x52c47d)){_0x3447fd['clearZombieChannel'](_0x52c47d);}}};Preview[_0xf54e('0xf')][_0xf54e('0x41')]=function(_0x2e08b4){var _0x57371d=this;rpcDb[_0xf54e('0x58')](_0x2e08b4['id'],ut[_0xf54e('0x59')](this[_0xf54e('0x16')]))[_0xf54e('0x5a')](function(_0x3a5a87){if(!_['isNil'](_0x3a5a87)){for(var _0x427799=0x0;_0x427799<_0x3a5a87[_0xf54e('0x5b')];_0x427799+=0x1){if(ut[_0xf54e('0x5c')](_0x3a5a87[_0x427799][_0xf54e('0x5d')])<_0x2e08b4['dialRecallMeTimeout']*0x3c){if(_0x3a5a87[_0x427799][_0xf54e('0x5e')]&&!_0x3a5a87[_0x427799][_0xf54e('0x5e')]['voicePause']){_0x57371d[_0xf54e('0x5f')](_0x3a5a87[_0x427799]['id'])[_0xf54e('0x5a')](ut[_0xf54e('0x60')](_0xf54e('0x61')))['catch'](ut[_0xf54e('0x60')](_0xf54e('0x61')));}else{rpcDb[_0xf54e('0x62')](_0x3a5a87[_0x427799]['id']);}}else{var _0xb4654f=new Action(_0x3a5a87[_0x427799],_0x2e08b4);_0xb4654f[_0xf54e('0x63')]=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));_0x2e08b4[_0xf54e('0x65')]+=0x1;ut[_0xf54e('0x66')](_0xb4654f,0x17,_0xf54e('0x67'));if(_0x2e08b4[_0xf54e('0x68')]){rpcDb[_0xf54e('0x69')](ut[_0xf54e('0x6a')](_0x3a5a87[_0x427799]));rpcDb[_0xf54e('0x6b')](_0xb4654f,_0xf54e('0x6c'));}else{ut[_0xf54e('0x66')](_0xb4654f,0x16,_0xf54e('0x6d'));rpcDb[_0xf54e('0x6b')](_0xb4654f,_0xf54e('0x6e'));rpcDb[_0xf54e('0x6f')](_0xb4654f,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xf54e('0x60')](_0xf54e('0x70')));};Preview[_0xf54e('0xf')][_0xf54e('0x71')]=function(_0xba297c){_0xba297c[_0xf54e('0x2d')]=!![];if(ut[_0xf54e('0x72')](_0xba297c[_0xf54e('0x73')])){_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x74')];}else if(!ut['isActive'](_0xba297c[_0xf54e('0x75')])){_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x34')];}else if(!this[_0xf54e('0x76')](_0xba297c[_0xf54e('0x77')])){if(!this[_0xf54e('0x76')](_0xba297c['TrunkBackup'])){_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x78')];}else{_0xba297c['message']=utils[_0xf54e('0x33')]['ACTIVE'];}}else{_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x79')];}};Preview['prototype'][_0xf54e('0x7a')]=function(_0x30d10d,_0x2096e5,_0x4e5059){var _0x3744a4=this;var _0x2ec72a=this[_0xf54e('0x15')][_0x2096e5];var _0x55d57f=this['campaignsPreview'][_0x2ec72a[_0xf54e('0x44')]];var _0x9ab4c4;var _0x4f17dd=![];var _0x29743e=0x2;var _0x49fd97=0x3;if(_0x55d57f){switch(_0x4e5059){case'1':_0x55d57f[_0xf54e('0x7b')]+=0x1;_0x2ec72a['countnosuchnumberretry']+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x0,_0xf54e('0x7e'));ami[_0xf54e('0x26')](_0xf54e('0x7f'),ut['buildObj'](_0x2ec72a,'nosuchnumber'));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0x80'));_0x3744a4['verifyAdditionalPhones'](_0x2ec72a,'0',_0x55d57f)['then'](function(_0x2a5e54){_0x4f17dd=_0x2a5e54['additional']==0x1;_0x29743e=_0x55d57f[_0xf54e('0x81')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0x86'));}else{if(_0x2ec72a[_0xf54e('0x87')]>=_0x55d57f[_0xf54e('0x88')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0x86'));}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,'countnosuchnumberretry',_0x55d57f[_0xf54e('0x81')]),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a[_0xf54e('0x8c')]);}}delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];}else{_0x2ec72a['countnosuchnumberretry']++;logger[_0xf54e('0x27')](_0xf54e('0x8e'),_0x2ec72a['countnosuchnumberretry']);logger['info']('id',_0x2ec72a[_0xf54e('0x8f')]);_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnosuchnumberretry':_0x2ec72a[_0xf54e('0x87')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)['then'](function(){});});}});break;case _0xf54e('0x91'):var _0x5cdb8c=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));_0x2ec72a[_0xf54e('0x92')]=_0x5cdb8c;_0x2ec72a['answertime']=_0x5cdb8c;_0x2ec72a[_0xf54e('0x47')]=!![];_0x55d57f['pTalking']+=0x1;logger[_0xf54e('0x27')](_0xf54e('0x93'),_0x2ec72a['uniqueid'],_0xf54e('0x94'),_0x55d57f['name'],_0xf54e('0x46'),_0x55d57f[_0xf54e('0x2f')]);ami[_0xf54e('0x26')](_0xf54e('0x95'),ut[_0xf54e('0x96')](_0x2ec72a,'connect',this[_0xf54e('0x3a')][_0x2ec72a[_0xf54e('0x44')]]));if(_0x55d57f['acw']){ami[_0xf54e('0x26')](_0xf54e('0x97'),ut['buildAcw'](_0x2ec72a));}break;case'16':ami[_0xf54e('0x26')](_0xf54e('0x98'),ut[_0xf54e('0x96')](_0x2ec72a,'complete',this[_0xf54e('0x3a')][_0x2ec72a['queue']]));emitVoiceQueueChannelRemove(ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0x99')));_0x55d57f['outboundAnswerCallsDay']+=0x1;_0x55d57f[_0xf54e('0x9a')]+=0x1;_0x55d57f[_0xf54e('0x9b')]+=0x1;ut[_0xf54e('0x9c')](_0x55d57f,_0xf54e('0x9d'));_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x4,_0xf54e('0x9e'));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0x9f'));rpcDb[_0xf54e('0x6f')](_0x2ec72a,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xf54e('0xa0')](_0x2ec72a);_0x55d57f[_0xf54e('0xa1')]+=_0x2ec72a[_0xf54e('0xa2')];_0x55d57f['sumBillable']+=_0x2ec72a[_0xf54e('0xa2')];logger[_0xf54e('0x27')](_0xf54e('0xa3'),_0x2ec72a[_0xf54e('0xa4')],_0xf54e('0x94'),_0x55d57f[_0xf54e('0x2c')],_0xf54e('0x46'),_0x55d57f['pTalking']);delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];break;case _0xf54e('0xa5'):_0x55d57f['outboundBusyCallsDay']+=0x1;_0x2ec72a[_0xf54e('0xa6')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x5,'Busy');_0x29743e=_0x55d57f['dialBusyRetryFrequency'];_0x49fd97=_0x55d57f[_0xf54e('0x82')];ami[_0xf54e('0x26')](_0xf54e('0xa7'),ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xa8')));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0xa9'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'5',_0x55d57f)[_0xf54e('0x5a')](function(_0x205b47){_0x4f17dd=_0x205b47['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb['createCustomerFinal'](_0x9ab4c4,_0xf54e('0xab'));}else{if(_0x2ec72a[_0xf54e('0xa6')]>=_0x55d57f[_0xf54e('0xac')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xa6'),_0x55d57f['dialBusyRetryFrequency']),_0x2ec72a['unlockAgent'],_0x2ec72a[_0xf54e('0x8c')]);}}}else{_0x2ec72a[_0xf54e('0xa6')]++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countbusyretry':_0x2ec72a[_0xf54e('0xa6')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case _0xf54e('0xae'):_0x55d57f['outboundNoAnswerCallsDay']+=0x1;_0x2ec72a[_0xf54e('0xaf')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x3,_0xf54e('0xb0'));_0x29743e=_0x55d57f[_0xf54e('0xb1')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];var _0x9a8f4f=ut[_0xf54e('0xb2')](_0x2ec72a,_0x55d57f);ami[_0xf54e('0x26')](_0xf54e('0xb3'),_0x9a8f4f);rpcDb[_0xf54e('0x6b')](_0x2ec72a,'[callProgressDetectingCustomer][logNoAnswer]');_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'3',_0x55d57f)[_0xf54e('0x5a')](function(_0x59acbc){_0x4f17dd=_0x59acbc['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xb4'));}else{if(_0x2ec72a[_0xf54e('0xaf')]>=_0x55d57f[_0xf54e('0xb5')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xaf'),_0x55d57f['dialNoAnswerRetryFrequency']),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a['activeContact']);}}}else{_0x2ec72a[_0xf54e('0xaf')]++;_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})['then'](function(){_0x3744a4['swapAdditionalPhones'](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case _0xf54e('0xb6'):_0x55d57f[_0xf54e('0xb7')]+=0x1;_0x2ec72a[_0xf54e('0xb8')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut['totalGlobal'](_0x2ec72a);ut['logCustomer'](_0x2ec72a,0x8,_0xf54e('0xb9'));_0x29743e=_0x55d57f[_0xf54e('0xba')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];ami[_0xf54e('0x26')](_0xf54e('0xbb'),ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xbc')));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0xbd'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'8',_0x55d57f)['then'](function(_0x31e699){_0x4f17dd=_0x31e699[_0xf54e('0xbe')]==0x1;if(!_0x4f17dd){if(ut['totalGlobal'](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xbf'));}else{if(_0x2ec72a[_0xf54e('0xb8')]>=_0x55d57f['dialCongestionMaxRetry']){rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0xbd'));}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,'countcongestionretry',_0x55d57f[_0xf54e('0xc0')]),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a[_0xf54e('0x8c')]);}}}else{_0x2ec72a[_0xf54e('0xb8')]++;_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countcongestionretry':_0x2ec72a[_0xf54e('0xb8')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case'CANCEL':_0x55d57f[_0xf54e('0xc1')]+=0x1;_0x2ec72a['countagentrejectretry']+=0x1;_0x2ec72a['countglobal']=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x14,_0xf54e('0xc2'));_0x29743e=_0x55d57f[_0xf54e('0xc3')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];ami[_0xf54e('0x26')](_0xf54e('0xc4'),ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xc5')));rpcDb['createCustomerHistory'](_0x2ec72a,_0xf54e('0xc6'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'20',_0x55d57f)[_0xf54e('0x5a')](function(_0x971a3e){_0x4f17dd=_0x971a3e[_0xf54e('0xbe')]==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0x14,_0xf54e('0xc2'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xc7'));}else{if(_0x2ec72a[_0xf54e('0xc8')]>=_0x55d57f[_0xf54e('0xc9')]){rpcDb['createCustomerFinal'](_0x2ec72a,_0xf54e('0xc7'));}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xc8'),_0x55d57f['dialAgentRejectRetryFrequency']),_0x2ec72a['unlockAgent'],_0x2ec72a[_0xf54e('0x8c')]);}}}else{_0x2ec72a[_0xf54e('0xaf')]++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4['swapAdditionalPhones'](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case _0xf54e('0xca'):_0x55d57f[_0xf54e('0xcb')]+=0x1;_0x2ec72a[_0xf54e('0xcc')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut['logCustomer'](_0x2ec72a,0xb,_0xf54e('0xcd'));rpcDb['createCustomerHistory'](_0x2ec72a,_0xf54e('0xce'));_0x3744a4['verifyAdditionalPhones'](_0x2ec72a,'11',_0x55d57f)[_0xf54e('0x5a')](function(_0x27c584){_0x4f17dd=_0x27c584[_0xf54e('0xbe')]==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut['cloneAction'](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2ec72a[_0xf54e('0xcf')]>=_0x55d57f[_0xf54e('0xd0')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0xce'));}else{rpcDb['rescheduleContact'](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xcc'),_0x55d57f['dialAbandonedRetryFrequency']),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a['activeContact']);}}}else{_0x2ec72a['countnoanswerretry']++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a['idContact'],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case'18':_0x55d57f[_0xf54e('0xd1')]+=0x1;_0x2ec72a['countmachineretry']+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x12,_0x30d10d[_0xf54e('0xd2')]||_0x30d10d['dialstatus']);ami[_0xf54e('0x26')]('custom:amd',ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xd3')));rpcDb['createCustomerHistory'](_0x2ec72a,_0xf54e('0xd4'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'18',_0x55d57f)[_0xf54e('0x5a')](function(_0x23a151){_0x4f17dd=_0x23a151['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0x12,'Global');rpcDb['createCustomerFinal'](_0x9ab4c4,_0xf54e('0xd4'));}else{rpcDb['createCustomerFinal'](_0x2ec72a,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x2ec72a['countnoanswerretry']++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];break;case'19':_0x55d57f[_0xf54e('0xd1')]+=0x1;_0x2ec72a['countglobal']=ut[_0xf54e('0x7d')](_0x2ec72a);ut['logCustomer'](_0x2ec72a,0x13,_0x30d10d[_0xf54e('0xd2')]||_0x30d10d[_0xf54e('0xd5')]);ami['emit'](_0xf54e('0xd6'),ut['buildObj'](_0x2ec72a,_0xf54e('0xd3')));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0xd7'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'18',_0x55d57f)[_0xf54e('0x5a')](function(_0x3c499e){_0x4f17dd=_0x3c499e['additional']==0x1;if(!_0x4f17dd){if(ut['totalGlobal'](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,'Global');rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xd7'));}else{rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0xd7'));}}else{_0x2ec72a[_0xf54e('0xaf')]++;_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});delete this[_0xf54e('0x15')][_0x30d10d['linkedid']];break;default:if(_0x2ec72a[_0xf54e('0x47')]){ut[_0xf54e('0x9c')](_0x55d57f,_0xf54e('0xd8'));ut[_0xf54e('0x53')](_0xf54e('0xd9')+_0x55d57f['name'],_0x30d10d);}_0x55d57f[_0xf54e('0xd1')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0xc,_0x30d10d[_0xf54e('0xd2')]||_0x30d10d[_0xf54e('0xd5')]);_0x29743e=_0x55d57f[_0xf54e('0xc3')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];rpcDb[_0xf54e('0x6b')](_0x2ec72a,'[callProgressDetectingCustomer][logUnknown]');_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'20',_0x55d57f)[_0xf54e('0x5a')](function(_0x47d309){_0x4f17dd=_0x47d309['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xda'));}else{rpcDb['createCustomerFinal'](_0x2ec72a,_0xf54e('0xda'));}delete this[_0xf54e('0x15')][_0x30d10d['linkedid']];}else{_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});}});}if(!(_0x2ec72a[_0xf54e('0x47')]&&_0x4e5059==='16')){ut[_0xf54e('0x52')](_0x55d57f,_0xf54e('0xdb'));logger[_0xf54e('0x27')](_0xf54e('0xdc'),_0x2ec72a[_0xf54e('0xa4')],_0xf54e('0x94'),_0x55d57f[_0xf54e('0x2c')],_0xf54e('0x45'),_0x55d57f['originated']);}if(_0x4e5059!=='ANSWER'){delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0xdd')]];}_0x55d57f[_0xf54e('0xde')]=!![];}};Preview['prototype'][_0xf54e('0xdf')]=function(_0x24b324,_0x3a9def,_0x213dc5){if(_['isUndefined'](_0x3a9def)&&_0xf54e('0xe0')!==typeof _0x3a9def){return;}if(_[_0xf54e('0xe1')](_0x213dc5)&&_0xf54e('0xe0')!==typeof _0x213dc5){return;}switch(_0x213dc5[_0xf54e('0xe2')]){case'0':ut[_0xf54e('0xe3')](_0x24b324,0x0,_0xf54e('0x7e'));rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe5'));break;case'3':ut[_0xf54e('0xe3')](_0x24b324,0x3,_0xf54e('0xb0'));rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe6'));break;case'5':ut[_0xf54e('0xe3')](_0x24b324,0x5,_0xf54e('0xe7'));rpcDb['createAgentHistory'](_0x24b324,_0xf54e('0xe8'));break;case'8':ut['logAgent'](_0x24b324,0x8,'Congestion');rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe9'));break;case'22':ut[_0xf54e('0xe3')](_0x24b324,0x16,_0xf54e('0xea'));rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xeb'));break;default:ut[_0xf54e('0xe3')](_0x24b324,0xc,_0x213dc5[_0xf54e('0xe2')]);rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe9'));}ut[_0xf54e('0x52')](_0x3a9def,_0xf54e('0xec'));logger[_0xf54e('0x27')]('[originated][decrement][callProgressDetectingAgent]',_0x24b324[_0xf54e('0xa4')],_0xf54e('0x94'),_0x3a9def[_0xf54e('0x2c')],_0xf54e('0x45'),_0x3a9def[_0xf54e('0x2e')]);delete this['actions'][_0x24b324['uniqueid']];};Preview[_0xf54e('0xf')][_0xf54e('0xaa')]=function(_0x4b6f61,_0x5f0853,_0x3250d0){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x4b6f61,_0x5f0853,_0x3250d0)[_0xf54e('0x50')](logger[_0xf54e('0x27')](_0xf54e('0xed')));};Preview[_0xf54e('0xf')][_0xf54e('0x90')]=function(_0x1f9d18,_0x50bff9,_0x39fc7d){return cmHopperAdditionalPhone[_0xf54e('0x90')](_0x1f9d18,_0x50bff9,_0x39fc7d)['catch'](logger[_0xf54e('0x27')](_0xf54e('0xee')));};Preview['prototype'][_0xf54e('0xad')]=function(_0x44b7bd){return Promise[_0xf54e('0xef')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x44b7bd))[_0xf54e('0x50')](logger[_0xf54e('0x27')]('[incrementPreviewCounters]\x20'));};Preview['prototype']['checkInBlack']=function(_0x39027b,_0x32b55f,_0x11fb0c,_0x5072aa,_0x187b1c){var _0x459172=this;return new Promise(function(_0x28d019,_0x3da354){if(_[_0xf54e('0xf0')](_0x32b55f)||_['isNil'](_0x32b55f['Contact'])||_['isNil'](_0x32b55f['phone'])||_['isNil'](_0x32b55f[_0xf54e('0x4b')])){_0x3da354(ut['message'](_0xf54e('0xf1'),_0x5072aa,_0x187b1c));return;}var _0x3e0b67=uuid['v4']();var _0x484691=_0x459172[_0xf54e('0x3a')][_0x32b55f['Queue'][_0xf54e('0x2c')]];var _0x400dc6=_0x11fb0c?_0x459172[_0xf54e('0x16')][_0x11fb0c]['id']:undefined;_0x459172[_0xf54e('0x15')][_0x3e0b67]=new Action(_0x32b55f,_0x484691,_0x3e0b67,_0x11fb0c,_0x400dc6);var _0x3c0755=_0x459172[_0xf54e('0x15')][_0x3e0b67];_0x3c0755[_0xf54e('0x8b')]=_0x5072aa;_0x3c0755['activeContact']=_0x187b1c;_0x3c0755[_0xf54e('0xf2')]=_0x11fb0c;if(_[_0xf54e('0xf3')](_0x39027b)){_0x459172[_0xf54e('0xf4')](_0x3c0755,_0x484691,_0x32b55f,_0x11fb0c)[_0xf54e('0x5a')](function(_0x3733f5){logger['info'](_0xf54e('0xf5'),_0xf54e('0xf6')+_0x3c0755[_0xf54e('0x44')]+_0xf54e('0xf7')+_0x3c0755[_0xf54e('0x8f')],JSON[_0xf54e('0x29')](_0x3733f5));ami['emit']('custom:agentcalled',ut['buildObj'](_0x3c0755,_0xf54e('0xf8'),_0x459172[_0xf54e('0x3a')][_0x3c0755[_0xf54e('0x44')]]));_0x28d019(ut[_0xf54e('0x32')](_0xf54e('0xf9')));})['catch'](function(_0x31b2d6){ut[_0xf54e('0x35')]('[Preview][execCall][failure]',_0x31b2d6);_0x3da354(ut[_0xf54e('0x32')](_0xf54e('0xfa'),_0x5072aa,_0x187b1c));});}else{_0x484691[_0xf54e('0xfb')]+=0x1;ut['logBlacklist'](_0x3c0755);rpcDb[_0xf54e('0xfc')](_0x3c0755,_0xf54e('0xfd'));delete _0x459172[_0xf54e('0x15')][_0x3e0b67];_0x3da354(ut[_0xf54e('0x32')](_0xf54e('0xfe'),_0x5072aa,_0x187b1c));}});};Preview[_0xf54e('0xf')][_0xf54e('0x76')]=function(_0x370e59){return!_['isNil'](_0x370e59)&&!_[_0xf54e('0xf0')](_0x370e59['name'])&&!_[_0xf54e('0xf0')](_0x370e59[_0xf54e('0xff')])&&_0x370e59[_0xf54e('0xff')]&&!_[_0xf54e('0xf0')](this[_0xf54e('0x100')][util[_0xf54e('0x2a')](_0xf54e('0x101'),_0x370e59['name'])])&&!_['isNil'](this['trunks'][util[_0xf54e('0x2a')]('SIP/%s',_0x370e59[_0xf54e('0x2c')])]['status'])&&(this[_0xf54e('0x100')][util[_0xf54e('0x2a')]('SIP/%s',_0x370e59[_0xf54e('0x2c')])][_0xf54e('0x4e')]===_0xf54e('0x102')||this[_0xf54e('0x100')][util[_0xf54e('0x2a')](_0xf54e('0x101'),_0x370e59[_0xf54e('0x2c')])][_0xf54e('0x4e')]===_0xf54e('0x103'));};Preview[_0xf54e('0xf')][_0xf54e('0x5f')]=function(_0x5bc7ed,_0x26e18f){return this[_0xf54e('0x104')](_0x5bc7ed,_0x26e18f)[_0xf54e('0x5a')](function(_0x52226a){return _[_0xf54e('0x48')](_0x52226a,['message']);})[_0xf54e('0x50')](function(_0xc0d72a){if(_0xc0d72a[_0xf54e('0x105')]){rpcDb[_0xf54e('0x106')](_0x5bc7ed);}if(_0xc0d72a[_0xf54e('0xff')]){rpcDb[_0xf54e('0x62')](_0x5bc7ed);}throw _[_0xf54e('0x48')](_0xc0d72a,[_0xf54e('0x32')]);});};Preview[_0xf54e('0xf')][_0xf54e('0x104')]=function(_0x215277,_0x4a2222){var _0x50c424=this;var _0x47e3ae,_0x2bee3e;return rpcDb[_0xf54e('0x107')](_0x215277)[_0xf54e('0x5a')](function(_0x4c249a){if(!_[_0xf54e('0xf0')](_0x4c249a[0x0])){_0x2bee3e=_0x4c249a[0x0][_0xf54e('0x108')]?![]:!![];_0x47e3ae=_0x4c249a[0x0]['recallme']?!![]:![];_0x47e3ae=_0x4a2222?!![]:_0x47e3ae;}var _0x405254=_0x50c424[_0xf54e('0x109')](_0x4c249a);if(_0x405254[_0xf54e('0x10a')]){rpcDb[_0xf54e('0x10b')](_[_0xf54e('0x48')](_0x4c249a[0x0],[_0xf54e('0x4b'),_0xf54e('0x10c')]))['then'](function(_0x5369cd){_0x50c424[_0xf54e('0x10d')](_0x5369cd,_0x4c249a[0x0],_0x4a2222,_0x2bee3e,_0x47e3ae)[_0xf54e('0x5a')](function(_0x2ac04e){return _0x2ac04e;})[_0xf54e('0x50')](function(_0x53ae5c){throw _0x53ae5c;});})[_0xf54e('0x50')](function(_0x37c370){ut['logger'](_0xf54e('0x10e'),_0x37c370);throw ut['message'](_0xf54e('0x10f'),_0x2bee3e,_0x47e3ae);});}else{throw ut[_0xf54e('0x32')](_0x405254[_0xf54e('0x32')],_0x2bee3e,_0x47e3ae);}})[_0xf54e('0x50')](function(_0x4fb1ab){ut[_0xf54e('0x35')]('[Preview][getContactPreview]',_0x4fb1ab);throw ut[_0xf54e('0x32')](_0xf54e('0x10f'),![],!![]);});};Preview[_0xf54e('0xf')][_0xf54e('0x109')]=function(_0x5221d0){if(_['isNil'](_0x5221d0)||_[_0xf54e('0xf3')](_0x5221d0)||!_[_0xf54e('0xf0')](_0x5221d0[0x0][_0xf54e('0x5e')])&&_['isNil'](_0x5221d0[0x0][_0xf54e('0x5e')][_0xf54e('0x2c')])){ut['logger'](_0xf54e('0x110'),_0x5221d0);return{'isValid':![],'message':_0xf54e('0x111')};}var _0x3ea69c=this[_0xf54e('0x3a')][_0x5221d0[0x0][_0xf54e('0x112')][_0xf54e('0x2c')]];_0x3ea69c['message']=utils[_0xf54e('0x33')][_0xf54e('0x79')];if(_[_0xf54e('0xf0')](_0x3ea69c)){ut[_0xf54e('0x35')](_0xf54e('0x113'),_0x3ea69c);return{'isValid':![],'message':_0xf54e('0x114')};}if(!this[_0xf54e('0x76')](_0x3ea69c[_0xf54e('0x77')])){ut[_0xf54e('0x35')](_0xf54e('0x115'),_0xf54e('0x116')+_0x3ea69c[_0xf54e('0x2c')]+_0xf54e('0x117'));if(!this[_0xf54e('0x76')](_0x3ea69c[_0xf54e('0x118')])){ut[_0xf54e('0x35')](_0xf54e('0x115'),_0x3ea69c['name']+_0xf54e('0x119'));return{'isValid':![],'message':_0xf54e('0x11a')};}}if(!ut[_0xf54e('0x11b')](_0x3ea69c['dialActive'])){ut[_0xf54e('0x35')](_0xf54e('0x11c'),_0x3ea69c[_0xf54e('0x2c')]+_0xf54e('0x11d'));return{'isValid':![],'message':_0xf54e('0x116')+_0x3ea69c['name']+_0xf54e('0x11d')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xf54e('0xf')][_0xf54e('0xf4')]=function(_0x505c0f,_0xcdc5ec,_0x171516,_0x2df876){var _0x4026ea=this;return new Promise(function(_0x1a0fc0,_0x459bbb){var _0x3770f3=_0x505c0f[_0xf54e('0xa4')];var _0x1ad56e=_0x4026ea['isTrunkReachable'](_0xcdc5ec[_0xf54e('0x77')])?util['format'](_0xf54e('0x11e'),_0xcdc5ec[_0xf54e('0x77')]['name'],_[_0xf54e('0xf0')](_0xcdc5ec['dialPrefix'])?'':_0xcdc5ec[_0xf54e('0x11f')][_0xf54e('0x120')]()||'',_0xcdc5ec['dialCutDigit']>0x0?_0x171516[_0xf54e('0x10c')][_0xf54e('0x121')](_0xcdc5ec['dialCutDigit']):_0x171516['phone']):util['format'](_0xf54e('0x11e'),_[_0xf54e('0xf0')](_0xcdc5ec[_0xf54e('0x118')])?_0xcdc5ec[_0xf54e('0x77')][_0xf54e('0x2c')]:_0xcdc5ec[_0xf54e('0x118')][_0xf54e('0x2c')],_[_0xf54e('0xf0')](_0xcdc5ec['dialPrefix'])?'':_0xcdc5ec['dialPrefix'][_0xf54e('0x120')]()||'',_0xcdc5ec[_0xf54e('0x122')]>0x0?_0x171516[_0xf54e('0x10c')][_0xf54e('0x121')](_0xcdc5ec[_0xf54e('0x122')]):_0x171516['phone']);var _0x3aa45f=_0x4026ea['isTrunkReachable'](_0xcdc5ec['Trunk'])?ut[_0xf54e('0x123')](_0xcdc5ec[_0xf54e('0x77')][_0xf54e('0x124')],_0xcdc5ec[_0xf54e('0x125')],_0xcdc5ec[_0xf54e('0x126')]>0x0?ut[_0xf54e('0x127')](_0xcdc5ec[_0xf54e('0x128')],_0xcdc5ec['dialRandomLastDigitCallerIdNumber']):_0xcdc5ec[_0xf54e('0x128')]):ut[_0xf54e('0x123')](_[_0xf54e('0xf0')](_0xcdc5ec[_0xf54e('0x118')])?_0xcdc5ec[_0xf54e('0x77')]['callerid']:_0xcdc5ec[_0xf54e('0x118')][_0xf54e('0x124')],_0xcdc5ec[_0xf54e('0x125')],_0xcdc5ec[_0xf54e('0x126')]>0x0?ut[_0xf54e('0x127')](_0xcdc5ec['dialOriginateCallerIdNumber'],_0xcdc5ec['dialRandomLastDigitCallerIdNumber']):_0xcdc5ec[_0xf54e('0x128')]);if(_0x3aa45f){_0x505c0f[_0xf54e('0x129')]=ut[_0xf54e('0x12a')](_0x3aa45f);_0x505c0f['originatecalleridnum']=ut[_0xf54e('0x12b')](_0x3aa45f);}var _0x2c2833=ut[_0xf54e('0x12c')](_0xcdc5ec,_0x171516,_0x1ad56e,_0x3aa45f,_0x3770f3,_0x505c0f);_[_0xf54e('0x12d')](_0x505c0f,ut['toLowerVariables'](_0x2c2833));_0x505c0f[_0xf54e('0x63')]=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));_0xcdc5ec['variables']=_0x2c2833;var _0x34db40=ut[_0xf54e('0x12e')](_0x505c0f,_0xcdc5ec,_0x2c2833,_0x505c0f[_0xf54e('0x8c')],_0x2df876);return ami[_0xf54e('0x4d')](_0x34db40)[_0xf54e('0x5a')](function(_0x123f93){_0xcdc5ec[_0xf54e('0x2e')]+=0x1;logger[_0xf54e('0x27')]('[originated][increment]',_0x3770f3,_0xf54e('0x94'),_0xcdc5ec[_0xf54e('0x2c')],_0xf54e('0x45'),_0xcdc5ec[_0xf54e('0x2e')]);_0x1a0fc0(_0x123f93);})['catch'](function(_0x47b07a){ut['logAgent'](_0x505c0f,0xe,'OriginateError');rpcDb[_0xf54e('0xe4')](_0x505c0f,_0xf54e('0x12f'));_0x459bbb(_0x47b07a);});});};Preview[_0xf54e('0xf')]['syncNewExten']=function(_0x5a84b8){if(this[_0xf54e('0x15')][_0x5a84b8['linkedid']]){this[_0xf54e('0x15')][_0x5a84b8['linkedid']][_0xf54e('0x4f')]=_0x5a84b8[_0xf54e('0x4f')];}};Preview[_0xf54e('0xf')]['syncOriginateResponse']=function(_0x14ead8){var _0x260b7a=this;var _0x1487be=this[_0xf54e('0x15')][_0x14ead8['actionid']];if(_0x1487be){if(_0x1487be[_0xf54e('0xf2')]&&this[_0xf54e('0x16')][_0x1487be[_0xf54e('0xf2')]]){ut[_0xf54e('0x130')](_0x1487be,this[_0xf54e('0x16')][_0x1487be[_0xf54e('0xf2')]]['name'],this[_0xf54e('0x16')][_0x1487be['lookAgent']]['id']);}var _0x4d406a=_[_0xf54e('0x131')](_0x1487be);_0x4d406a['responsetime']=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));var _0x56411c=_0x260b7a['campaignsPreview'][_0x1487be[_0xf54e('0x44')]];if(ut['isFailure'](_0x14ead8[_0xf54e('0x132')])){if(_0x1487be[_0xf54e('0x8b')]){rpcDb['unlockContact'](_0x1487be[_0xf54e('0x8f')]);}if(_0x1487be['activeContact']){rpcDb[_0xf54e('0x62')](_0x1487be[_0xf54e('0x8f')]);}ami['emit'](_0xf54e('0x133'),ut[_0xf54e('0x96')](_0x1487be,_0xf54e('0x134'),this[_0xf54e('0x3a')][_0x1487be[_0xf54e('0x44')]]));this[_0xf54e('0xdf')](_0x4d406a,_0x56411c,_0x14ead8);}else{_0x1487be[_0xf54e('0x63')]=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));ut['logAgent'](_0x4d406a,0x4,'Answer');rpcDb[_0xf54e('0xe4')](_0x4d406a,_0xf54e('0x135'));}}};Preview[_0xf54e('0xf')][_0xf54e('0x1b')]=function(_0x53d6cb){var _0x143b50=this[_0xf54e('0x15')][_0x53d6cb['linkedid']];var _0x3b25f4;if(_0x143b50){_0x3b25f4=this[_0xf54e('0x3a')][_0x143b50[_0xf54e('0x44')]];logger[_0xf54e('0x27')](_0xf54e('0x136'),_0x53d6cb[_0xf54e('0x8d')],_0xf54e('0x94'),_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);}if(this[_0xf54e('0x15')][_0x53d6cb['linkedid']]&&_0x53d6cb['linkedid']!==_0x53d6cb[_0xf54e('0xa4')]){if(_0x53d6cb[_0xf54e('0x137')]==='16'&&this[_0xf54e('0x15')][_0x53d6cb[_0xf54e('0x8d')]][_0xf54e('0x47')]){this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb['linkedid'],_0x53d6cb[_0xf54e('0x137')]);}else if(this[_0xf54e('0x15')][_0x53d6cb['linkedid']][_0xf54e('0x47')]){logger[_0xf54e('0x27')](_0xf54e('0x138'),_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb['cause'],'\x20Queue',_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb['linkedid'],_0x53d6cb['cause']);}}else if(_0x143b50&&_[_0xf54e('0xf0')](_0x143b50[_0xf54e('0x139')])&&_0x3b25f4[_0xf54e('0x13a')]&&_0x53d6cb['linkedid']===_0x53d6cb[_0xf54e('0xa4')]&&_[_0xf54e('0xf0')](_0x53d6cb[_0xf54e('0xe2')])&&_0x53d6cb[_0xf54e('0x137')]==='16'&&_0x53d6cb['channelstate']==='6'&&_[_0xf54e('0xe1')](_0x143b50['transfer'])){if(_0x143b50[_0xf54e('0x8b')]){rpcDb[_0xf54e('0x106')](_0x143b50[_0xf54e('0x8f')]);}if(_0x143b50[_0xf54e('0x8c')]){rpcDb['disableContact'](_0x143b50[_0xf54e('0x8f')]);}_0x53d6cb[_0xf54e('0xe2')]='22';this[_0xf54e('0xdf')](_0x143b50,_0x3b25f4,_0x53d6cb);}else if(_0x143b50&&_0x143b50['transfer']){if(_0x53d6cb[_0xf54e('0x137')]==='16'&&this[_0xf54e('0x15')][_0x53d6cb[_0xf54e('0x8d')]]['dialAnswer']){logger[_0xf54e('0x27')](_0xf54e('0x13b'),_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')],_0xf54e('0x94'),_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')]);}else if(this[_0xf54e('0x15')][_0x53d6cb[_0xf54e('0x8d')]][_0xf54e('0x47')]){logger[_0xf54e('0x27')](_0xf54e('0x138'),_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')],'\x20Queue',_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')]);}}};Preview[_0xf54e('0xf')][_0xf54e('0x13c')]=function(_0x429793){if(this[_0xf54e('0x15')][_0x429793[_0xf54e('0xdd')]]&&_0x429793[_0xf54e('0xdd')]!==_0x429793[_0xf54e('0x13d')]){this[_0xf54e('0x7a')](_0x429793,_0x429793[_0xf54e('0xdd')],_0x429793[_0xf54e('0xd5')]);}};Preview['prototype'][_0xf54e('0x1d')]=function(_0x28a3f8){if(this[_0xf54e('0x15')][_0x28a3f8[_0xf54e('0x8d')]]&&_0x28a3f8['linkedid']!==_0x28a3f8[_0xf54e('0xa4')]&&!this[_0xf54e('0x15')][_0x28a3f8['linkedid']][_0xf54e('0x47')]){if(_0x28a3f8[_0xf54e('0x137')]==='1'){this[_0xf54e('0x7a')](_0x28a3f8,_0x28a3f8[_0xf54e('0x8d')],_0x28a3f8[_0xf54e('0x137')]);}}};Preview[_0xf54e('0xf')][_0xf54e('0x13e')]=function(_0x22f8ad,_0x269670,_0x17801c){if(this['actions'][_0x22f8ad]){if(_[_0xf54e('0xf0')](this[_0xf54e('0x15')][_0x22f8ad][_0xf54e('0x13f')])){this[_0xf54e('0x15')][_0x22f8ad][_0xf54e('0x13f')]={};}this[_0xf54e('0x15')][_0x22f8ad][_0xf54e('0x13f')][_0x269670]=_0x17801c;}};Preview['prototype'][_0xf54e('0x21')]=function(_0x397e6c){try{if(!_[_0xf54e('0xf0')](_0x397e6c)){if(ut[_0xf54e('0x140')](_[_0xf54e('0x141')](_0x397e6c[_0xf54e('0x142')])[0x0])){this[_0xf54e('0x13e')](_0x397e6c[_0xf54e('0xa4')],_[_0xf54e('0x141')](_0x397e6c[_0xf54e('0x142')])[0x0],_0x397e6c['value']);}}}catch(_0xb1e536){logger[_0xf54e('0x143')]('[syncVarSet][Preview]',util['inspect'](_0xb1e536,{'showHidden':![],'depth':null}));}};Preview[_0xf54e('0xf')][_0xf54e('0x23')]=function(_0x232195){if(_0x232195){if(this[_0xf54e('0x15')][_0x232195[_0xf54e('0x144')]]){this[_0xf54e('0x15')][_0x232195[_0xf54e('0x144')]][_0xf54e('0x145')]=!![];}}};Preview[_0xf54e('0xf')][_0xf54e('0x146')]=function(_0x56b18a){if(_0x56b18a){if(this[_0xf54e('0x15')][_0x56b18a[_0xf54e('0x147')]]){this['actions'][_0x56b18a['transfererlinkedid']][_0xf54e('0x145')]=!![];}}};module[_0xf54e('0x148')]=Preview; \ No newline at end of file +var _0x00bb=['swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','Contact','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','active','SIP/%s','status','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','syncVarSet','filterKey','keys','variable','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','ioredis','../../../config/logger','preview','actionPreview','../ami','./util/util','../dialer/utils','redis','defaults','localhost','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','syncHangupRequest','syncDialEnd','bind','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','available','paused','INACTIVE','\x20is\x20not\x20active','message','CAMPAIGN_STATUS','DEACTIVATED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','Queue','queue','originated:\x20','stringify','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','catch','loggedIn','NO_AGENTS_LOGGED','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','custom:agentconnect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','\x20Queue','pTalking:\x20','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'use strict';var util=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var uuid=require(_0xb00b('0x2'));var moment=require('moment');var Redis=require(_0xb00b('0x3'));var config=require('../../../config/environment');var logger=require(_0xb00b('0x4'))(_0xb00b('0x5'));var loggerAction=require('../../../config/logger')(_0xb00b('0x6'));var ami=require(_0xb00b('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xb00b('0x8'));var utils=require(_0xb00b('0x9'));config[_0xb00b('0xa')]=_[_0xb00b('0xb')](config[_0xb00b('0xa')],{'host':_0xb00b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb00b('0xd')][_0xb00b('0xe')]=function(_0x5851d4){this[_0xb00b('0xf')]=this[_0xb00b('0xf')]?this['tail'][_0xb00b('0x10')](_0x5851d4):_0x5851d4();};function Preview(_0x5a63ed){this['sequence']=new Sequence();this['campaignsPreview']=_0x5a63ed[_0xb00b('0x11')];this[_0xb00b('0x12')]=_0x5a63ed[_0xb00b('0x12')];this[_0xb00b('0x13')]={};this[_0xb00b('0x14')]=_0x5a63ed[_0xb00b('0x14')];this['clockClearZombieChannels']=0x0;ami['on'](_0xb00b('0x15'),this[_0xb00b('0x16')]['bind'](this));ami['on'](_0xb00b('0x17'),this[_0xb00b('0x18')]['bind'](this));ami['on']('hanguprequest',this[_0xb00b('0x19')]['bind'](this));ami['on']('dialend',this[_0xb00b('0x1a')][_0xb00b('0x1b')](this));ami['on'](_0xb00b('0x1c'),this[_0xb00b('0x1d')]['bind'](this));ami['on'](_0xb00b('0x1e'),this['syncVarSet'][_0xb00b('0x1b')](this));ami['on']('attendedtransfer',this[_0xb00b('0x1f')]['bind'](this));ami['on'](_0xb00b('0x20'),this[_0xb00b('0x21')]['bind'](this));this['loopCampaigns'](this[_0xb00b('0x22')]);}function emit(_0x4a334b,_0x1344c4,_0x43da66){io['to'](_0x4a334b)[_0xb00b('0x23')](_0x1344c4,_0x43da66);}function emitVoiceQueueChannelRemove(_0x3501af){logger['info'](_0xb00b('0x24'),JSON['stringify'](_0x3501af));emit(util[_0xb00b('0x25')](_0xb00b('0x26'),_0x3501af['name']),_0xb00b('0x27'),_0x3501af);io[_0xb00b('0x23')]('voice_queue_presence:remove',_0x3501af);}function notSendMessagesQueue(_0x3ab3cc){if(_0x3ab3cc[_0xb00b('0x28')]){if(_0x3ab3cc['originated']===0x0&&_0x3ab3cc[_0xb00b('0x29')]===0x0){_0x3ab3cc[_0xb00b('0x28')]=![];_0x3ab3cc[_0xb00b('0x2a')]=0x0;_0x3ab3cc[_0xb00b('0x2b')]=0x0;_0x3ab3cc['message']=utils['CAMPAIGN_STATUS'][_0xb00b('0x2c')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3ab3cc['name']+_0xb00b('0x2d'));}else{_0x3ab3cc[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x30')];ut[_0xb00b('0x31')](_0xb00b('0x32'),_0x3ab3cc[_0xb00b('0x33')]+'\x20is\x20deactivated');}}}Preview[_0xb00b('0xd')]['loopCampaigns']=function(){var _0x450129=this;setInterval(function(){_0x450129[_0xb00b('0x34')]();},0x7cf);};Preview[_0xb00b('0xd')]['syncCampaigns']=function(){var _0x2fc11a=this[_0xb00b('0x22')];this[_0xb00b('0x35')]+=0x1;for(var _0x183233 in _0x2fc11a){if(_0x2fc11a[_0xb00b('0x36')](_0x183233)&&(_0x2fc11a[_0x183233][_0xb00b('0x37')]===_0xb00b('0x5')||_0x2fc11a[_0x183233][_0xb00b('0x37')]===_0xb00b('0x38'))&&_0x2fc11a[_0x183233]['type']===_0xb00b('0x39')){if(this[_0xb00b('0x35')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xb00b('0x3a')]();}}if(_0x2fc11a[_0xb00b('0x36')](_0x183233)&&_0x2fc11a[_0x183233]['dialMethod']===_0xb00b('0x5')&&_0x2fc11a[_0x183233]['type']===_0xb00b('0x39')){if(_0x2fc11a[_0x183233][_0xb00b('0x3b')]){this[_0xb00b('0x3c')](_0x2fc11a[_0x183233]);if(_0x2fc11a[_0x183233][_0xb00b('0x3d')])this[_0xb00b('0x3e')](_0x2fc11a[_0x183233]);}else{notSendMessagesQueue(_0x2fc11a[_0x183233]);}}}};Preview[_0xb00b('0xd')][_0xb00b('0x3f')]=function(_0x594840){var _0x57e8f9=this;this['sequence'][_0xb00b('0xe')](function(){if(!_[_0xb00b('0x40')](_0x57e8f9[_0xb00b('0x13')][_0x594840])){loggerAction[_0xb00b('0x41')]('[clearZombieChannels][talking]',_0x594840,_0xb00b('0x42'),_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')],_0xb00b('0x44'),JSON[_0xb00b('0x45')](_0x57e8f9[_0xb00b('0x22')][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]]['originated']),'pTalking:\x20',JSON[_0xb00b('0x45')](_0x57e8f9['campaignsPreview'][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]][_0xb00b('0x29')]),JSON[_0xb00b('0x45')](_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x46')]),JSON[_0xb00b('0x45')](_['pick'](_0x57e8f9[_0xb00b('0x13')][_0x594840],[_0xb00b('0x47'),_0xb00b('0x48'),_0xb00b('0x49'),_0xb00b('0x4a')])));return ami[_0xb00b('0x4b')]({'action':'status','channel':_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x4c')]})['catch'](function(_0x17ff34){if(_0x17ff34[_0xb00b('0x2e')]===_0xb00b('0x4d')){setTimeout(function(){if(_0x57e8f9[_0xb00b('0x13')][_0x594840]){ut[_0xb00b('0x4e')](_0x57e8f9['campaignsPreview'][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]],_0xb00b('0x4f'));if(_0x57e8f9[_0xb00b('0x13')][_0x594840]['dialAnswer']===!![]){ut['decrementTalkink'](_0x57e8f9[_0xb00b('0x22')][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]],_0xb00b('0x4f'));ut[_0xb00b('0x50')](_0xb00b('0x51')+_0x594840,_0x57e8f9[_0xb00b('0x13')][_0x594840]['queue']);}ut[_0xb00b('0x50')](_0xb00b('0x52')+_0x594840,_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]);delete _0x57e8f9[_0xb00b('0x13')][_0x594840];}},0x2328);}});}});};Preview[_0xb00b('0xd')][_0xb00b('0x3a')]=function(){var _0x974a29=this;loggerAction[_0xb00b('0x41')](_0xb00b('0x53'),_[_0xb00b('0x54')](this[_0xb00b('0x13')]));for(var _0x577bad in this[_0xb00b('0x13')]){if(_0x974a29[_0xb00b('0x13')][_0xb00b('0x36')](_0x577bad)){_0x974a29[_0xb00b('0x3f')](_0x577bad);}}};Preview[_0xb00b('0xd')][_0xb00b('0x3e')]=function(_0xd97f49){var _0x1b4f09=this;rpcDb[_0xb00b('0x55')](_0xd97f49['id'],ut[_0xb00b('0x56')](this[_0xb00b('0x14')]))[_0xb00b('0x57')](function(_0x5dbe00){if(!_['isNil'](_0x5dbe00)){for(var _0x47c6c0=0x0;_0x47c6c0<_0x5dbe00[_0xb00b('0x58')];_0x47c6c0+=0x1){if(ut[_0xb00b('0x59')](_0x5dbe00[_0x47c6c0]['scheduledat'])<_0xd97f49[_0xb00b('0x5a')]*0x3c){if(_0x5dbe00[_0x47c6c0][_0xb00b('0x5b')]&&!_0x5dbe00[_0x47c6c0][_0xb00b('0x5b')][_0xb00b('0x5c')]){_0x1b4f09['run'](_0x5dbe00[_0x47c6c0]['id'])['then'](ut[_0xb00b('0x5d')](_0xb00b('0x5e')))['catch'](ut['logger2'](_0xb00b('0x5e')));}else{rpcDb[_0xb00b('0x5f')](_0x5dbe00[_0x47c6c0]['id']);}}else{var _0x4e0be4=new Action(_0x5dbe00[_0x47c6c0],_0xd97f49);_0x4e0be4[_0xb00b('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xd97f49['outboundReCallsDay']+=0x1;ut[_0xb00b('0x61')](_0x4e0be4,0x17,'RecallInQueue');if(_0xd97f49[_0xb00b('0x62')]){rpcDb[_0xb00b('0x63')](ut[_0xb00b('0x64')](_0x5dbe00[_0x47c6c0]));rpcDb[_0xb00b('0x65')](_0x4e0be4,_0xb00b('0x66'));}else{ut[_0xb00b('0x61')](_0x4e0be4,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x4e0be4,_0xb00b('0x67'));rpcDb[_0xb00b('0x68')](_0x4e0be4,'[HistoryRecallClose]');}}}}})[_0xb00b('0x69')](ut[_0xb00b('0x5d')]('[getContactRecallMe]'));};Preview[_0xb00b('0xd')][_0xb00b('0x3c')]=function(_0x3b5d82){_0x3b5d82['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x3b5d82[_0xb00b('0x6a')])){_0x3b5d82[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x6b')];}else if(!ut['isActive'](_0x3b5d82[_0xb00b('0x3b')])){_0x3b5d82[_0xb00b('0x2e')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0xb00b('0x6c')](_0x3b5d82['Trunk'])){if(!this[_0xb00b('0x6c')](_0x3b5d82[_0xb00b('0x6d')])){_0x3b5d82[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x6e')];}else{_0x3b5d82[_0xb00b('0x2e')]=utils['CAMPAIGN_STATUS'][_0xb00b('0x6f')];}}else{_0x3b5d82['message']=utils[_0xb00b('0x2f')][_0xb00b('0x6f')];}};Preview[_0xb00b('0xd')]['callProgressDetectingCustomer']=function(_0x248335,_0x25f1f6,_0x4ba53a){var _0x598a55=this;var _0x24e826=this[_0xb00b('0x13')][_0x25f1f6];var _0x219b74=this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]];var _0x279467;var _0x347949=![];var _0x3a0b90=0x2;var _0x4c3067=0x3;if(_0x219b74){switch(_0x4ba53a){case'1':_0x219b74[_0xb00b('0x70')]+=0x1;_0x24e826[_0xb00b('0x71')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x0,_0xb00b('0x73'));ami[_0xb00b('0x23')](_0xb00b('0x74'),ut[_0xb00b('0x75')](_0x24e826,'nosuchnumber'));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0x76'));_0x598a55[_0xb00b('0x77')](_0x24e826,'0',_0x219b74)[_0xb00b('0x57')](function(_0x4b1e5f){_0x347949=_0x4b1e5f[_0xb00b('0x78')]==0x1;_0x3a0b90=_0x219b74[_0xb00b('0x79')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb['createCustomerFinal'](_0x279467,_0xb00b('0x7f'));}else{if(_0x24e826['countnosuchnumberretry']>=_0x219b74[_0xb00b('0x80')]){rpcDb['createCustomerFinal'](_0x24e826,_0xb00b('0x7f'));}else{rpcDb['rescheduleContact'](ut[_0xb00b('0x81')](_0x24e826,'countnosuchnumberretry',_0x219b74[_0xb00b('0x79')]),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}delete this['actions'][_0x248335['linkedid']];}else{_0x24e826['countnosuchnumberretry']++;logger[_0xb00b('0x41')](_0xb00b('0x84'),_0x24e826[_0xb00b('0x71')]);logger['info']('id',_0x24e826[_0xb00b('0x85')]);_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnosuchnumberretry':_0x24e826[_0xb00b('0x71')]}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0x87'):var _0x5622a4=moment()[_0xb00b('0x25')](_0xb00b('0x88'));_0x24e826[_0xb00b('0x89')]=_0x5622a4;_0x24e826['answertime']=_0x5622a4;_0x24e826['dialAnswer']=!![];_0x219b74[_0xb00b('0x29')]+=0x1;logger[_0xb00b('0x41')](_0xb00b('0x8a'),_0x24e826['uniqueid'],'\x20Queue',_0x219b74['name'],'pTalking:\x20',_0x219b74[_0xb00b('0x29')]);ami['emit'](_0xb00b('0x8b'),ut[_0xb00b('0x75')](_0x24e826,'connect',this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]]));if(_0x219b74[_0xb00b('0x8c')]){ami[_0xb00b('0x23')](_0xb00b('0x8d'),ut['buildAcw'](_0x24e826));}break;case'16':ami[_0xb00b('0x23')](_0xb00b('0x8e'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0x8f'),this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]]));emitVoiceQueueChannelRemove(ut[_0xb00b('0x75')](_0x24e826,'complete'));_0x219b74[_0xb00b('0x90')]+=0x1;_0x219b74[_0xb00b('0x91')]+=0x1;_0x219b74[_0xb00b('0x92')]+=0x1;ut[_0xb00b('0x93')](_0x219b74,_0xb00b('0x94'));_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x4,'Answer');rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0x95'));rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0x96'));rpcDb[_0xb00b('0x97')](_0x24e826);_0x219b74[_0xb00b('0x98')]+=_0x24e826[_0xb00b('0x99')];_0x219b74[_0xb00b('0x9a')]+=_0x24e826['talktime'];logger[_0xb00b('0x41')](_0xb00b('0x9b'),_0x24e826[_0xb00b('0x9c')],_0xb00b('0x9d'),_0x219b74[_0xb00b('0x33')],_0xb00b('0x9e'),_0x219b74[_0xb00b('0x29')]);delete this['actions'][_0x248335[_0xb00b('0x9f')]];break;case _0xb00b('0xa0'):_0x219b74[_0xb00b('0xa1')]+=0x1;_0x24e826[_0xb00b('0xa2')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut['logCustomer'](_0x24e826,0x5,_0xb00b('0xa3'));_0x3a0b90=_0x219b74['dialBusyRetryFrequency'];_0x4c3067=_0x219b74[_0xb00b('0x7a')];ami['emit'](_0xb00b('0xa4'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xa5')));rpcDb['createCustomerHistory'](_0x24e826,'[callProgressDetectingCustomer][logBusy]');_0x598a55[_0xb00b('0x77')](_0x24e826,'5',_0x219b74)[_0xb00b('0x57')](function(_0x33a483){_0x347949=_0x33a483[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xa6'));}else{if(_0x24e826[_0xb00b('0xa2')]>=_0x219b74[_0xb00b('0xa7')]){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xa8'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x24e826,_0xb00b('0xa2'),_0x219b74[_0xb00b('0xa9')]),_0x24e826['unlockAgent'],_0x24e826['activeContact']);}}}else{_0x24e826[_0xb00b('0xa2')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countbusyretry':_0x24e826['countbusyretry']}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xab'):_0x219b74[_0xb00b('0xac')]+=0x1;_0x24e826[_0xb00b('0xad')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x3,'NoAnswer');_0x3a0b90=_0x219b74[_0xb00b('0xae')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];var _0x545dfd=ut[_0xb00b('0xaf')](_0x24e826,_0x219b74);ami[_0xb00b('0x23')](_0xb00b('0xb0'),_0x545dfd);rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xb1'));_0x598a55[_0xb00b('0x77')](_0x24e826,'3',_0x219b74)[_0xb00b('0x57')](function(_0x2423b2){_0x347949=_0x2423b2[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,'Global');rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xb2'));}else{if(_0x24e826[_0xb00b('0xad')]>=_0x219b74[_0xb00b('0xb3')]){rpcDb['createCustomerFinal'](_0x24e826,_0xb00b('0xb1'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xad'),_0x219b74[_0xb00b('0xae')]),_0x24e826['unlockAgent'],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826['countnoanswerretry']}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xb5'):_0x219b74[_0xb00b('0xb6')]+=0x1;_0x24e826[_0xb00b('0xb7')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x8,_0xb00b('0xb8'));_0x3a0b90=_0x219b74[_0xb00b('0xb9')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];ami[_0xb00b('0x23')]('custom:agentcongestion',ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xba')));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xbb'));_0x598a55['verifyAdditionalPhones'](_0x24e826,'8',_0x219b74)[_0xb00b('0x57')](function(_0xb27b8b){_0x347949=_0xb27b8b['additional']==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74['dialGlobalMaxRetry']){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x24e826[_0xb00b('0xb7')]>=_0x219b74[_0xb00b('0xbc')]){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xbb'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xb7'),_0x219b74[_0xb00b('0xa9')]),_0x24e826[_0xb00b('0x82')],_0x24e826['activeContact']);}}}else{_0x24e826['countcongestionretry']++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countcongestionretry':_0x24e826[_0xb00b('0xb7')]}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xbd'):_0x219b74['outboundRejectCallsDay']+=0x1;_0x24e826[_0xb00b('0xbe')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut['logCustomer'](_0x24e826,0x14,_0xb00b('0xbf'));_0x3a0b90=_0x219b74[_0xb00b('0xc0')];_0x4c3067=_0x219b74['callAdditionalPhoneAfterMin'];ami[_0xb00b('0x23')](_0xb00b('0xc1'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xc2')));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xc3'));_0x598a55[_0xb00b('0x77')](_0x24e826,'20',_0x219b74)[_0xb00b('0x57')](function(_0x55ea09){_0x347949=_0x55ea09[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0x14,'AgentReject');rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x24e826[_0xb00b('0xbe')]>=_0x219b74['dialAgentRejectMaxRetry']){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xc4'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xbe'),_0x219b74['dialAgentRejectRetryFrequency']),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826['countnoanswerretry']++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826['idContact'],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case'ABANDONED':_0x219b74[_0xb00b('0xc5')]+=0x1;_0x24e826[_0xb00b('0xc6')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x24e826,_0xb00b('0xc7'));_0x598a55[_0xb00b('0x77')](_0x24e826,'11',_0x219b74)[_0xb00b('0x57')](function(_0x2d5652){_0x347949=_0x2d5652[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut['totalGlobal'](_0x24e826)>=_0x219b74['dialGlobalMaxRetry']){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xc7'));}else{if(_0x24e826[_0xb00b('0xc8')]>=_0x219b74[_0xb00b('0xc9')]){rpcDb[_0xb00b('0x68')](_0x24e826,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xb00b('0xb4')](ut['scheduledAt'](_0x24e826,_0xb00b('0xc6'),_0x219b74['dialAbandonedRetryFrequency']),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case'18':_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0xcb')]+=0x1;_0x24e826['countglobal']=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x12,_0x248335[_0xb00b('0xcc')]||_0x248335[_0xb00b('0xcd')]);ami['emit'](_0xb00b('0xce'),ut[_0xb00b('0x75')](_0x24e826,'amd'));rpcDb[_0xb00b('0x65')](_0x24e826,'[callProgressDetectingCustomer][hangupInAMD]');_0x598a55[_0xb00b('0x77')](_0x24e826,'18',_0x219b74)[_0xb00b('0x57')](function(_0x49fe3f){_0x347949=_0x49fe3f[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0x12,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xb00b('0x68')](_0x24e826,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})['then'](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});delete this[_0xb00b('0x13')][_0x248335['linkedid']];break;case'19':_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x13,_0x248335['cause-txt']||_0x248335[_0xb00b('0xcd')]);ami[_0xb00b('0x23')](_0xb00b('0xce'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xcf')));rpcDb[_0xb00b('0x65')](_0x24e826,'[callProgressDetectingCustomer][machine]');_0x598a55['verifyAdditionalPhones'](_0x24e826,'18',_0x219b74)[_0xb00b('0x57')](function(_0x23d306){_0x347949=_0x23d306[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut['cloneAction'](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xd0'));}else{rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xd0'));}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55['incrementPreviewCounters']({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0x9f')]];break;default:if(_0x24e826[_0xb00b('0x46')]){ut[_0xb00b('0x93')](_0x219b74,_0xb00b('0xd1'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x219b74[_0xb00b('0x33')],_0x248335);}_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut['logCustomer'](_0x24e826,0xc,_0x248335['cause-txt']||_0x248335[_0xb00b('0xcd')]);_0x3a0b90=_0x219b74[_0xb00b('0xc0')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];rpcDb['createCustomerHistory'](_0x24e826,_0xb00b('0xd2'));_0x598a55[_0xb00b('0x77')](_0x24e826,'20',_0x219b74)[_0xb00b('0x57')](function(_0x142674){_0x347949=_0x142674['additional']==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xd3'));}else{rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xd3'));}delete this['actions'][_0x248335[_0xb00b('0x9f')]];}else{_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});}});}if(!(_0x24e826[_0xb00b('0x46')]&&_0x4ba53a==='16')){ut[_0xb00b('0x4e')](_0x219b74,_0xb00b('0xd4'));logger[_0xb00b('0x41')](_0xb00b('0xd5'),_0x24e826['uniqueid'],_0xb00b('0x9d'),_0x219b74[_0xb00b('0x33')],_0xb00b('0x44'),_0x219b74[_0xb00b('0xd6')]);}if(_0x4ba53a!=='ANSWER'){delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0x9f')]];delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0xd7')]];}_0x219b74[_0xb00b('0xd8')]=!![];}};Preview[_0xb00b('0xd')][_0xb00b('0xd9')]=function(_0x3184de,_0x48ac4b,_0x5f0fab){if(_[_0xb00b('0xda')](_0x48ac4b)&&_0xb00b('0xdb')!==typeof _0x48ac4b){return;}if(_[_0xb00b('0xda')](_0x5f0fab)&&'object'!==typeof _0x5f0fab){return;}switch(_0x5f0fab[_0xb00b('0xdc')]){case'0':ut[_0xb00b('0xdd')](_0x3184de,0x0,_0xb00b('0x73'));rpcDb['createAgentHistory'](_0x3184de,_0xb00b('0xde'));break;case'3':ut[_0xb00b('0xdd')](_0x3184de,0x3,_0xb00b('0xdf'));rpcDb['createAgentHistory'](_0x3184de,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xb00b('0xdd')](_0x3184de,0x5,'Busy');rpcDb[_0xb00b('0xe0')](_0x3184de,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3184de,0x8,_0xb00b('0xb8'));rpcDb[_0xb00b('0xe0')](_0x3184de,_0xb00b('0xe1'));break;case'22':ut[_0xb00b('0xdd')](_0x3184de,0x16,_0xb00b('0xe2'));rpcDb['createAgentHistory'](_0x3184de,_0xb00b('0xe3'));break;default:ut['logAgent'](_0x3184de,0xc,_0x5f0fab['reason']);rpcDb[_0xb00b('0xe0')](_0x3184de,_0xb00b('0xe1'));}ut[_0xb00b('0x4e')](_0x48ac4b,_0xb00b('0xe4'));logger[_0xb00b('0x41')](_0xb00b('0xe5'),_0x3184de['uniqueid'],_0xb00b('0x9d'),_0x48ac4b['name'],_0xb00b('0x44'),_0x48ac4b[_0xb00b('0xd6')]);delete this[_0xb00b('0x13')][_0x3184de['uniqueid']];};Preview[_0xb00b('0xd')][_0xb00b('0x77')]=function(_0x20790f,_0x3dc8d2,_0x5d224c){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x20790f,_0x3dc8d2,_0x5d224c)[_0xb00b('0x69')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0xb00b('0xd')]['swapAdditionalPhones']=function(_0x505ae2,_0x2fecca,_0x330bc7){return cmHopperAdditionalPhone[_0xb00b('0xaa')](_0x505ae2,_0x2fecca,_0x330bc7)[_0xb00b('0x69')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0xb00b('0xd')][_0xb00b('0x86')]=function(_0x9facaf){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0xb00b('0x86')](_0x9facaf))['catch'](logger['info'](_0xb00b('0xe6')));};Preview['prototype'][_0xb00b('0xe7')]=function(_0x481671,_0x1b751e,_0x5712fd,_0x3de808,_0x3289aa){var _0x1ec560=this;return new Promise(function(_0x54498c,_0x442b28){if(_['isNil'](_0x1b751e)||_[_0xb00b('0x40')](_0x1b751e[_0xb00b('0xe8')])||_['isNil'](_0x1b751e['phone'])||_['isNil'](_0x1b751e['VoiceQueueId'])){_0x442b28(ut[_0xb00b('0x2e')]('Contact\x20is\x20undefined',_0x3de808,_0x3289aa));return;}var _0x134d17=uuid['v4']();var _0x5ad4d4=_0x1ec560[_0xb00b('0x22')][_0x1b751e[_0xb00b('0x42')][_0xb00b('0x33')]];var _0x44b2f1=_0x5712fd?_0x1ec560[_0xb00b('0x14')][_0x5712fd]['id']:undefined;_0x1ec560['actions'][_0x134d17]=new Action(_0x1b751e,_0x5ad4d4,_0x134d17,_0x5712fd,_0x44b2f1);var _0x8292fe=_0x1ec560[_0xb00b('0x13')][_0x134d17];_0x8292fe[_0xb00b('0x82')]=_0x3de808;_0x8292fe[_0xb00b('0x83')]=_0x3289aa;_0x8292fe['lookAgent']=_0x5712fd;if(_['isEmpty'](_0x481671)){_0x1ec560[_0xb00b('0xe9')](_0x8292fe,_0x5ad4d4,_0x1b751e,_0x5712fd)[_0xb00b('0x57')](function(_0x181393){logger[_0xb00b('0x41')](_0xb00b('0xea'),_0xb00b('0xeb')+_0x8292fe[_0xb00b('0x43')]+_0xb00b('0xec')+_0x8292fe[_0xb00b('0x85')],JSON['stringify'](_0x181393));ami[_0xb00b('0x23')](_0xb00b('0xed'),ut['buildObj'](_0x8292fe,_0xb00b('0xee'),_0x1ec560['campaignsPreview'][_0x8292fe[_0xb00b('0x43')]]));_0x54498c(ut[_0xb00b('0x2e')]('Calling'));})['catch'](function(_0x32264a){ut[_0xb00b('0x31')](_0xb00b('0xef'),_0x32264a);_0x442b28(ut['message'](_0xb00b('0xf0'),_0x3de808,_0x3289aa));});}else{_0x5ad4d4[_0xb00b('0xf1')]+=0x1;ut[_0xb00b('0xf2')](_0x8292fe);rpcDb['createHistory'](_0x8292fe,_0xb00b('0xf3'));delete _0x1ec560['actions'][_0x134d17];_0x442b28(ut['message']('Contact\x20in\x20black\x20List',_0x3de808,_0x3289aa));}});};Preview[_0xb00b('0xd')]['isTrunkReachable']=function(_0x1b8d45){return!_[_0xb00b('0x40')](_0x1b8d45)&&!_['isNil'](_0x1b8d45['name'])&&!_[_0xb00b('0x40')](_0x1b8d45[_0xb00b('0xf4')])&&_0x1b8d45['active']&&!_[_0xb00b('0x40')](this[_0xb00b('0x12')][util[_0xb00b('0x25')](_0xb00b('0xf5'),_0x1b8d45[_0xb00b('0x33')])])&&!_[_0xb00b('0x40')](this['trunks'][util[_0xb00b('0x25')](_0xb00b('0xf5'),_0x1b8d45['name'])][_0xb00b('0xf6')])&&(this['trunks'][util['format'](_0xb00b('0xf5'),_0x1b8d45['name'])][_0xb00b('0xf6')]===_0xb00b('0xf7')||this[_0xb00b('0x12')][util['format']('SIP/%s',_0x1b8d45['name'])][_0xb00b('0xf6')]===_0xb00b('0xf8'));};Preview['prototype'][_0xb00b('0xf9')]=function(_0x18e86f,_0x3aa8c0){return this[_0xb00b('0xfa')](_0x18e86f,_0x3aa8c0)[_0xb00b('0x57')](function(_0x166ff5){return _[_0xb00b('0xfb')](_0x166ff5,[_0xb00b('0x2e')]);})['catch'](function(_0x1b097a){if(_0x1b097a[_0xb00b('0xfc')]){rpcDb[_0xb00b('0xfd')](_0x18e86f);}if(_0x1b097a['active']){rpcDb['disableContact'](_0x18e86f);}throw _['pick'](_0x1b097a,[_0xb00b('0x2e')]);});};Preview[_0xb00b('0xd')][_0xb00b('0xfa')]=function(_0x4bc6df,_0x399902){var _0x34985d=this;var _0x2057d1,_0xdee547;return rpcDb[_0xb00b('0xfe')](_0x4bc6df)['then'](function(_0x1674ab){if(!_['isNil'](_0x1674ab[0x0])){_0xdee547=_0x1674ab[0x0][_0xb00b('0xff')]?![]:!![];_0x2057d1=_0x1674ab[0x0][_0xb00b('0xff')]?!![]:![];_0x2057d1=_0x399902?!![]:_0x2057d1;}var _0xde6b5=_0x34985d[_0xb00b('0x100')](_0x1674ab);if(_0xde6b5[_0xb00b('0x101')]){rpcDb[_0xb00b('0x102')](_['pick'](_0x1674ab[0x0],[_0xb00b('0x49'),_0xb00b('0x103')]))[_0xb00b('0x57')](function(_0x278d9e){_0x34985d[_0xb00b('0xe7')](_0x278d9e,_0x1674ab[0x0],_0x399902,_0xdee547,_0x2057d1)[_0xb00b('0x57')](function(_0x26cd15){return _0x26cd15;})[_0xb00b('0x69')](function(_0xd2f1ba){throw _0xd2f1ba;});})[_0xb00b('0x69')](function(_0x5f1258){ut[_0xb00b('0x31')](_0xb00b('0x104'),_0x5f1258);throw ut['message'](_0xb00b('0x105'),_0xdee547,_0x2057d1);});}else{throw ut['message'](_0xde6b5['message'],_0xdee547,_0x2057d1);}})['catch'](function(_0x384a16){ut['logger'](_0xb00b('0x106'),_0x384a16);throw ut[_0xb00b('0x2e')](_0xb00b('0x105'),![],!![]);});};Preview[_0xb00b('0xd')][_0xb00b('0x100')]=function(_0x116ced){if(_[_0xb00b('0x40')](_0x116ced)||_[_0xb00b('0x107')](_0x116ced)||!_[_0xb00b('0x40')](_0x116ced[0x0][_0xb00b('0x5b')])&&_[_0xb00b('0x40')](_0x116ced[0x0][_0xb00b('0x5b')][_0xb00b('0x33')])){ut[_0xb00b('0x31')]('[Preview][validateContact][Empty\x20Contact]',_0x116ced);return{'isValid':![],'message':_0xb00b('0x108')};}var _0x15f9cd=this[_0xb00b('0x22')][_0x116ced[0x0][_0xb00b('0x42')][_0xb00b('0x33')]];_0x15f9cd['message']=utils[_0xb00b('0x2f')][_0xb00b('0x6f')];if(_['isNil'](_0x15f9cd)){ut['logger'](_0xb00b('0x109'),_0x15f9cd);return{'isValid':![],'message':_0xb00b('0x10a')};}if(!this[_0xb00b('0x6c')](_0x15f9cd[_0xb00b('0x10b')])){ut[_0xb00b('0x31')](_0xb00b('0x10c'),_0xb00b('0x10d')+_0x15f9cd[_0xb00b('0x33')]+_0xb00b('0x10e'));if(!this[_0xb00b('0x6c')](_0x15f9cd[_0xb00b('0x6d')])){ut['logger'](_0xb00b('0x10c'),_0x15f9cd['name']+_0xb00b('0x10f'));return{'isValid':![],'message':_0xb00b('0x110')};}}if(!ut[_0xb00b('0x111')](_0x15f9cd[_0xb00b('0x3b')])){ut[_0xb00b('0x31')](_0xb00b('0x112'),_0x15f9cd['name']+_0xb00b('0x113'));return{'isValid':![],'message':_0xb00b('0x10d')+_0x15f9cd[_0xb00b('0x33')]+_0xb00b('0x113')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xb00b('0xd')][_0xb00b('0xe9')]=function(_0x58dbf6,_0x199ba1,_0x16cca9,_0x3c57b2){var _0xca4a87=this;return new Promise(function(_0x456515,_0x26145a){var _0x31fa5b=_0x58dbf6[_0xb00b('0x9c')];var _0x1ba141=_0xca4a87['isTrunkReachable'](_0x199ba1[_0xb00b('0x10b')])?util[_0xb00b('0x25')]('SIP/%s/%s%s',_0x199ba1[_0xb00b('0x10b')][_0xb00b('0x33')],_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x114')])?'':_0x199ba1[_0xb00b('0x114')][_0xb00b('0x115')]()||'',_0x199ba1[_0xb00b('0x116')]>0x0?_0x16cca9[_0xb00b('0x103')][_0xb00b('0x117')](_0x199ba1[_0xb00b('0x116')]):_0x16cca9[_0xb00b('0x103')]):util['format'](_0xb00b('0x118'),_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x6d')])?_0x199ba1['Trunk'][_0xb00b('0x33')]:_0x199ba1[_0xb00b('0x6d')][_0xb00b('0x33')],_[_0xb00b('0x40')](_0x199ba1['dialPrefix'])?'':_0x199ba1[_0xb00b('0x114')][_0xb00b('0x115')]()||'',_0x199ba1['dialCutDigit']>0x0?_0x16cca9['phone'][_0xb00b('0x117')](_0x199ba1[_0xb00b('0x116')]):_0x16cca9['phone']);var _0x1256a8=_0xca4a87['isTrunkReachable'](_0x199ba1['Trunk'])?ut[_0xb00b('0x119')](_0x199ba1['Trunk']['callerid'],_0x199ba1[_0xb00b('0x11a')],_0x199ba1[_0xb00b('0x11b')]>0x0?ut[_0xb00b('0x11c')](_0x199ba1[_0xb00b('0x11d')],_0x199ba1[_0xb00b('0x11b')]):_0x199ba1[_0xb00b('0x11d')]):ut[_0xb00b('0x119')](_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x6d')])?_0x199ba1[_0xb00b('0x10b')][_0xb00b('0x11e')]:_0x199ba1[_0xb00b('0x6d')][_0xb00b('0x11e')],_0x199ba1[_0xb00b('0x11a')],_0x199ba1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb00b('0x11c')](_0x199ba1[_0xb00b('0x11d')],_0x199ba1['dialRandomLastDigitCallerIdNumber']):_0x199ba1[_0xb00b('0x11d')]);if(_0x1256a8){_0x58dbf6['originatecalleridname']=ut[_0xb00b('0x11f')](_0x1256a8);_0x58dbf6[_0xb00b('0x120')]=ut[_0xb00b('0x121')](_0x1256a8);}var _0x5657ee=ut[_0xb00b('0x122')](_0x199ba1,_0x16cca9,_0x1ba141,_0x1256a8,_0x31fa5b,_0x58dbf6);_[_0xb00b('0x123')](_0x58dbf6,ut['toLowerVariables'](_0x5657ee));_0x58dbf6[_0xb00b('0x60')]=moment()[_0xb00b('0x25')](_0xb00b('0x88'));_0x199ba1[_0xb00b('0x124')]=_0x5657ee;var _0x57bfab=ut[_0xb00b('0x125')](_0x58dbf6,_0x199ba1,_0x5657ee,_0x58dbf6[_0xb00b('0x83')],_0x3c57b2);return ami[_0xb00b('0x4b')](_0x57bfab)['then'](function(_0x571811){_0x199ba1['originated']+=0x1;logger[_0xb00b('0x41')](_0xb00b('0x126'),_0x31fa5b,_0xb00b('0x9d'),_0x199ba1[_0xb00b('0x33')],_0xb00b('0x44'),_0x199ba1[_0xb00b('0xd6')]);_0x456515(_0x571811);})[_0xb00b('0x69')](function(_0x39b4c6){ut[_0xb00b('0xdd')](_0x58dbf6,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x58dbf6,_0xb00b('0x127'));_0x26145a(_0x39b4c6);});});};Preview[_0xb00b('0xd')]['syncNewExten']=function(_0x42fdce){if(this['actions'][_0x42fdce[_0xb00b('0x9f')]]){this['actions'][_0x42fdce[_0xb00b('0x9f')]][_0xb00b('0x4c')]=_0x42fdce['channel'];}};Preview[_0xb00b('0xd')][_0xb00b('0x16')]=function(_0x5573c9){var _0x44767a=this;var _0x4d4dbe=this[_0xb00b('0x13')][_0x5573c9[_0xb00b('0x128')]];if(_0x4d4dbe){if(_0x4d4dbe[_0xb00b('0x129')]&&this[_0xb00b('0x14')][_0x4d4dbe[_0xb00b('0x129')]]){ut[_0xb00b('0x12a')](_0x4d4dbe,this[_0xb00b('0x14')][_0x4d4dbe[_0xb00b('0x129')]][_0xb00b('0x33')],this[_0xb00b('0x14')][_0x4d4dbe['lookAgent']]['id']);}var _0x4cff99=_[_0xb00b('0x12b')](_0x4d4dbe);_0x4cff99['responsetime']=moment()[_0xb00b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');var _0x198536=_0x44767a[_0xb00b('0x22')][_0x4d4dbe['queue']];if(ut[_0xb00b('0x12c')](_0x5573c9['response'])){if(_0x4d4dbe[_0xb00b('0x82')]){rpcDb[_0xb00b('0xfd')](_0x4d4dbe['idContact']);}if(_0x4d4dbe[_0xb00b('0x83')]){rpcDb[_0xb00b('0x5f')](_0x4d4dbe[_0xb00b('0x85')]);}ami[_0xb00b('0x23')](_0xb00b('0x12d'),ut['buildObj'](_0x4d4dbe,_0xb00b('0x12e'),this[_0xb00b('0x22')][_0x4d4dbe['queue']]));this['callProgressDetectingAgent'](_0x4cff99,_0x198536,_0x5573c9);}else{_0x4d4dbe[_0xb00b('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x4cff99,0x4,_0xb00b('0x12f'));rpcDb[_0xb00b('0xe0')](_0x4cff99,_0xb00b('0x130'));}}};Preview[_0xb00b('0xd')]['syncHangup']=function(_0xcaefbd){var _0x482fc4=this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]];var _0x22f2f6;if(_0x482fc4){_0x22f2f6=this[_0xb00b('0x22')][_0x482fc4['queue']];logger[_0xb00b('0x41')](_0xb00b('0x131'),_0xcaefbd['linkedid'],_0xb00b('0x9d'),_0x22f2f6[_0xb00b('0x33')],_0xb00b('0x9e'),_0x22f2f6['pTalking']);}if(this['actions'][_0xcaefbd[_0xb00b('0x9f')]]&&_0xcaefbd[_0xb00b('0x9f')]!==_0xcaefbd[_0xb00b('0x9c')]){if(_0xcaefbd[_0xb00b('0x132')]==='16'&&this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]][_0xb00b('0x46')]){this['callProgressDetectingCustomer'](_0xcaefbd,_0xcaefbd['linkedid'],_0xcaefbd[_0xb00b('0x132')]);}else if(this['actions'][_0xcaefbd['linkedid']][_0xb00b('0x46')]){logger[_0xb00b('0x41')]('[syncHangup][talking][cause]',_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')],_0xb00b('0x9d'),_0x22f2f6['name'],_0xb00b('0x9e'),_0x22f2f6[_0xb00b('0x29')]);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')]);}}else if(_0x482fc4&&_[_0xb00b('0x40')](_0x482fc4[_0xb00b('0x134')])&&_0x22f2f6['dialQueueProject']&&_0xcaefbd[_0xb00b('0x9f')]===_0xcaefbd[_0xb00b('0x9c')]&&_['isNil'](_0xcaefbd['reason'])&&_0xcaefbd['cause']==='16'&&_0xcaefbd[_0xb00b('0x135')]==='6'&&_[_0xb00b('0xda')](_0x482fc4[_0xb00b('0x136')])){if(_0x482fc4[_0xb00b('0x82')]){rpcDb[_0xb00b('0xfd')](_0x482fc4[_0xb00b('0x85')]);}if(_0x482fc4[_0xb00b('0x83')]){rpcDb['disableContact'](_0x482fc4['idContact']);}_0xcaefbd[_0xb00b('0xdc')]='22';this[_0xb00b('0xd9')](_0x482fc4,_0x22f2f6,_0xcaefbd);}else if(_0x482fc4&&_0x482fc4['transfer']){if(_0xcaefbd[_0xb00b('0x132')]==='16'&&this[_0xb00b('0x13')][_0xcaefbd['linkedid']][_0xb00b('0x46')]){logger['info'](_0xb00b('0x137'),_0xcaefbd['linkedid'],_0xcaefbd['cause'],'\x20Queue',_0x22f2f6[_0xb00b('0x33')],_0xb00b('0x9e'),_0x22f2f6[_0xb00b('0x29')]);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd['linkedid'],_0xcaefbd[_0xb00b('0x132')]);}else if(this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]][_0xb00b('0x46')]){logger[_0xb00b('0x41')](_0xb00b('0x138'),_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')],_0xb00b('0x9d'),_0x22f2f6[_0xb00b('0x33')],'pTalking:\x20',_0x22f2f6['pTalking']);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')]);}}};Preview[_0xb00b('0xd')][_0xb00b('0x1a')]=function(_0x1e0206){if(this[_0xb00b('0x13')][_0x1e0206[_0xb00b('0xd7')]]&&_0x1e0206[_0xb00b('0xd7')]!==_0x1e0206['destuniqueid']){this[_0xb00b('0x133')](_0x1e0206,_0x1e0206[_0xb00b('0xd7')],_0x1e0206[_0xb00b('0xcd')]);}};Preview[_0xb00b('0xd')]['syncHangupRequest']=function(_0x45ad1f){if(this[_0xb00b('0x13')][_0x45ad1f[_0xb00b('0x9f')]]&&_0x45ad1f[_0xb00b('0x9f')]!==_0x45ad1f[_0xb00b('0x9c')]&&!this[_0xb00b('0x13')][_0x45ad1f[_0xb00b('0x9f')]][_0xb00b('0x46')]){if(_0x45ad1f[_0xb00b('0x132')]==='1'){this['callProgressDetectingCustomer'](_0x45ad1f,_0x45ad1f['linkedid'],_0x45ad1f[_0xb00b('0x132')]);}}};Preview[_0xb00b('0xd')][_0xb00b('0x139')]=function(_0x121451,_0x2e9604,_0x19fce8){if(this[_0xb00b('0x13')][_0x121451]){if(_['isNil'](this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')])){this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')]={};}this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')][_0x2e9604]=_0x19fce8;}};Preview['prototype'][_0xb00b('0x13a')]=function(_0x1ec1c7){try{if(!_['isNil'](_0x1ec1c7)){if(ut[_0xb00b('0x13b')](_[_0xb00b('0x13c')](_0x1ec1c7[_0xb00b('0x13d')])[0x0])){this[_0xb00b('0x139')](_0x1ec1c7[_0xb00b('0x9c')],_[_0xb00b('0x13c')](_0x1ec1c7['variable'])[0x0],_0x1ec1c7['value']);}}}catch(_0x465238){logger['error']('[syncVarSet][Preview]',util['inspect'](_0x465238,{'showHidden':![],'depth':null}));}};Preview[_0xb00b('0xd')][_0xb00b('0x1f')]=function(_0x5a400c){if(_0x5a400c){if(this['actions'][_0x5a400c[_0xb00b('0x13e')]]){this[_0xb00b('0x13')][_0x5a400c[_0xb00b('0x13e')]][_0xb00b('0x136')]=!![];}}};Preview[_0xb00b('0xd')][_0xb00b('0x21')]=function(_0x3fd141){if(_0x3fd141){if(this[_0xb00b('0x13')][_0x3fd141[_0xb00b('0x13f')]]){this[_0xb00b('0x13')][_0x3fd141[_0xb00b('0x13f')]]['transfer']=!![];}}};module[_0xb00b('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index ae25bdb..82ab220 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 _0x4823=['disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','preview','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','catch','resolve','then','createHistory','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20'];(function(_0x5b4b91,_0x2e5311){var _0x695013=function(_0x17111e){while(--_0x17111e){_0x5b4b91['push'](_0x5b4b91['shift']());}};_0x695013(++_0x2e5311);}(_0x4823,0x1cc));var _0x3482=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0x4823[_0x13c70c];return _0x50f0f2;};'use strict';var util=require(_0x3482('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x3482('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x3482('0x2'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x3482('0x3'));function loggerCatch(_0x41eed4){return function(_0x585f81){logger[_0x3482('0x4')](_0x41eed4,util[_0x3482('0x5')](_0x585f81,{'showHidden':![],'depth':null}));};}function create(_0x48b887){return cmHopperHistory['createHistory'](_0x48b887)[_0x3482('0x6')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x3e3fd7){return BPromise[_0x3482('0x7')]()[_0x3482('0x8')](agentReportPreview[_0x3482('0x9')](_0x3e3fd7))[_0x3482('0x6')](loggerCatch(_0x3482('0xa')));}function moveContact(_0x17d63e){return cmHopper[_0x3482('0xb')](_0x17d63e,!![])[_0x3482('0x6')](loggerCatch(_0x3482('0xc')));}exports[_0x3482('0xd')]=function(_0x2b3a77){return cmHopperBlack[_0x3482('0xd')](_0x2b3a77)['catch'](loggerCatch(_0x3482('0xe')));};exports['getContactPreview']=function(_0x251679){return BPromise[_0x3482('0x7')]()[_0x3482('0x8')](cmHopper[_0x3482('0xf')](_0x251679))['catch'](loggerCatch(_0x3482('0x10')));};exports[_0x3482('0x9')]=function(_0x1c25a5,_0x4c5a8a){create(_0x1c25a5)[_0x3482('0x6')](loggerCatch(_0x4c5a8a));moveContact(_0x1c25a5)[_0x3482('0x6')](loggerCatch(_0x4c5a8a));};exports[_0x3482('0x11')]=function(_0x53cf1b,_0x31dd4c){createAgent(_0x53cf1b)[_0x3482('0x6')](loggerCatch(_0x31dd4c));};exports['createCustomerHistory']=function(_0x4cdfef,_0x3f328a){create(_0x4cdfef)[_0x3482('0x6')](loggerCatch(_0x3f328a));};exports[_0x3482('0x12')]=function(_0x1f1569,_0x5b6658){moveContact(_0x1f1569)['catch'](loggerCatch(_0x5b6658));};exports[_0x3482('0x13')]=function(_0x1c660e,_0x2bd82a,_0x189e7b){if(_0x2bd82a){_0x1c660e['UserId']=null;}if(_0x189e7b){_0x1c660e[_0x3482('0x14')]=![];}return cmHopper[_0x3482('0x13')](_0x1c660e)[_0x3482('0x6')](loggerCatch(_0x3482('0x15')));};exports[_0x3482('0x16')]=function(_0x5c4c8a){return cmHopper[_0x3482('0x16')](_0x5c4c8a)[_0x3482('0x6')](loggerCatch(_0x3482('0x17')));};exports[_0x3482('0x18')]=function(_0x429ae8){return cmHopper['unlockContact']({'UserId':null},_0x429ae8,0x1)[_0x3482('0x6')](loggerCatch(_0x3482('0x19')));};exports[_0x3482('0x1a')]=function(_0x26f989){return cmHopper['unlockContact']({'active':![]},_0x26f989,0x1)[_0x3482('0x6')](loggerCatch(_0x3482('0x1b')));};exports[_0x3482('0x1c')]=function(_0x4ba8f9){var _0x3e7b3e={};_0x3e7b3e[_0x3482('0x1d')]=_0x4ba8f9['type'];_0x3e7b3e[_0x3482('0x1e')]=_0x4ba8f9[_0x3482('0x1e')];_0x3e7b3e['calleridnum']=_0x4ba8f9[_0x3482('0x1f')];_0x3e7b3e[_0x3482('0x20')]=_0x4ba8f9['calleridname'];_0x3e7b3e[_0x3482('0x21')]=_0x4ba8f9[_0x3482('0x21')];_0x3e7b3e[_0x3482('0x22')]=_0x4ba8f9[_0x3482('0x23')];_0x3e7b3e['queuecallerleaveAt']=_0x4ba8f9['answertime'];_0x3e7b3e['queuecallercomplete']=0x1;_0x3e7b3e[_0x3482('0x24')]=_0x4ba8f9[_0x3482('0x25')];_0x3e7b3e[_0x3482('0x26')]=_0x4ba8f9[_0x3482('0x27')];_0x3e7b3e[_0x3482('0x28')]=_0x3482('0x29');_0x3e7b3e[_0x3482('0x2a')]=_0x3482('0x2b');_0x3e7b3e[_0x3482('0x2c')]=0x0;_0x3e7b3e[_0x3482('0x2d')]=0x1;_0x3e7b3e[_0x3482('0x2e')]=_0x4ba8f9[_0x3482('0x27')];_0x3e7b3e[_0x3482('0x2f')]=_0x3482('0x30');return BPromise[_0x3482('0x7')]()[_0x3482('0x8')](voiceQueueReport[_0x3482('0x31')](_0x3e7b3e))['catch'](loggerCatch(_0x3482('0x32')));};exports[_0x3482('0x33')]=function(_0x48fe52,_0x49a156){return BPromise[_0x3482('0x7')]()[_0x3482('0x8')](cmHopper[_0x3482('0x33')](_0x48fe52,_0x49a156))[_0x3482('0x6')](loggerCatch(_0x3482('0x34')));};exports['rescheduleContactInQueue']=function(_0x13b0ae){return cmHopper[_0x3482('0x13')](_0x13b0ae,!![],!![])[_0x3482('0x6')](loggerCatch(_0x3482('0x35')));}; \ No newline at end of file +var _0xb7c6=['getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','membername','exten','holdtime','assigned','lastAssignedTo','COMPLETED','resolve','create','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','then','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0xb7c6,0xe2));var _0x6b7c=function(_0x4425e6,_0x5da50d){_0x4425e6=_0x4425e6-0x0;var _0x5d15d6=_0xb7c6[_0x4425e6];return _0x5d15d6;};'use strict';var util=require(_0x6b7c('0x0'));var BPromise=require(_0x6b7c('0x1'));var logger=require(_0x6b7c('0x2'))(_0x6b7c('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x6b7c('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x6b7c('0x5'));function loggerCatch(_0x5f3f14){return function(_0x38f78b){logger[_0x6b7c('0x6')](_0x5f3f14,util[_0x6b7c('0x7')](_0x38f78b,{'showHidden':![],'depth':null}));};}function create(_0x3fbadb){return cmHopperHistory['createHistory'](_0x3fbadb)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1decee){return BPromise['resolve']()[_0x6b7c('0x8')](agentReportPreview['createHistory'](_0x1decee))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0xa36241){return cmHopper[_0x6b7c('0x9')](_0xa36241,!![])[_0x6b7c('0xa')](loggerCatch(_0x6b7c('0xb')));}exports[_0x6b7c('0xc')]=function(_0x44a623){return cmHopperBlack[_0x6b7c('0xc')](_0x44a623)['catch'](loggerCatch(_0x6b7c('0xd')));};exports[_0x6b7c('0xe')]=function(_0x492078){return BPromise['resolve']()[_0x6b7c('0x8')](cmHopper[_0x6b7c('0xe')](_0x492078))['catch'](loggerCatch(_0x6b7c('0xf')));};exports['createHistory']=function(_0xf779d2,_0x3715b8){create(_0xf779d2)['catch'](loggerCatch(_0x3715b8));moveContact(_0xf779d2)[_0x6b7c('0xa')](loggerCatch(_0x3715b8));};exports['createAgentHistory']=function(_0x3919cf,_0xd73569){createAgent(_0x3919cf)[_0x6b7c('0xa')](loggerCatch(_0xd73569));};exports['createCustomerHistory']=function(_0x50baa1,_0x3177e1){create(_0x50baa1)[_0x6b7c('0xa')](loggerCatch(_0x3177e1));};exports[_0x6b7c('0x10')]=function(_0x52c609,_0x266538){moveContact(_0x52c609)['catch'](loggerCatch(_0x266538));};exports[_0x6b7c('0x11')]=function(_0x2fdd41,_0x32a375,_0x166b06){if(_0x32a375){_0x2fdd41[_0x6b7c('0x12')]=null;}if(_0x166b06){_0x2fdd41[_0x6b7c('0x13')]=![];}return cmHopper[_0x6b7c('0x11')](_0x2fdd41)[_0x6b7c('0xa')](loggerCatch(_0x6b7c('0x14')));};exports['countReScheduled']=function(_0x71d2cf){return cmHopper[_0x6b7c('0x15')](_0x71d2cf)[_0x6b7c('0xa')](loggerCatch(_0x6b7c('0x16')));};exports[_0x6b7c('0x17')]=function(_0x4e116d){return cmHopper[_0x6b7c('0x17')]({'UserId':null},_0x4e116d,0x1)[_0x6b7c('0xa')](loggerCatch(_0x6b7c('0x18')));};exports[_0x6b7c('0x19')]=function(_0x49bec5){return cmHopper[_0x6b7c('0x17')]({'active':![]},_0x49bec5,0x1)['catch'](loggerCatch(_0x6b7c('0x1a')));};exports[_0x6b7c('0x1b')]=function(_0x290d75){var _0x248734={};_0x248734[_0x6b7c('0x1c')]=_0x290d75[_0x6b7c('0x1c')];_0x248734[_0x6b7c('0x1d')]=_0x290d75[_0x6b7c('0x1d')];_0x248734[_0x6b7c('0x1e')]=_0x290d75[_0x6b7c('0x1e')];_0x248734[_0x6b7c('0x1f')]=_0x290d75[_0x6b7c('0x1f')];_0x248734[_0x6b7c('0x20')]=_0x290d75[_0x6b7c('0x20')];_0x248734[_0x6b7c('0x21')]=_0x290d75[_0x6b7c('0x22')];_0x248734[_0x6b7c('0x23')]=_0x290d75[_0x6b7c('0x22')];_0x248734['queuecallercomplete']=0x1;_0x248734[_0x6b7c('0x24')]=_0x290d75[_0x6b7c('0x25')];_0x248734['connectedlinename']=_0x290d75[_0x6b7c('0x26')];_0x248734['context']='from-sip';_0x248734[_0x6b7c('0x27')]='xcally-motion-preview';_0x248734[_0x6b7c('0x28')]=0x0;_0x248734[_0x6b7c('0x29')]=0x1;_0x248734[_0x6b7c('0x2a')]=_0x290d75['membername'];_0x248734['queuecallerexitreason']=_0x6b7c('0x2b');return BPromise[_0x6b7c('0x2c')]()[_0x6b7c('0x8')](voiceQueueReport[_0x6b7c('0x2d')](_0x248734))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x1fba4e,_0x28f0dc){return BPromise[_0x6b7c('0x2c')]()[_0x6b7c('0x8')](cmHopper[_0x6b7c('0x2e')](_0x1fba4e,_0x28f0dc))[_0x6b7c('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x5a1ca6){return cmHopper['rescheduleContact'](_0x5a1ca6,!![],!![])[_0x6b7c('0xa')](loggerCatch(_0x6b7c('0x2f')));}; \ 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 ec00197..3849d3f 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 _0xa72b=['agentReadyId','not_inuse','status','reachable','push','milliseconds','diff','seconds','createBody','VoiceQueueId','CampaignId','filterKey','idContact','campaigntype','dialAnswer','scheduledat','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','noanswer','variables','keys','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','info','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','logAgent','responsetime','getSeconds','starttime','membername','UserId','logCustomer','statedesc','endtime','ringtime','talktime','answertime','isFailure','variablesAction','BOOKED','channelAgent','from-sip','uniqueid','totalGlobal','countbusyretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','add','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','interface','mandatoryDisposition','buildObj','buildAcw','queue'];(function(_0x372129,_0x539547){var _0x2385b4=function(_0x17969f){while(--_0x17969f){_0x372129['push'](_0x372129['shift']());}};_0x2385b4(++_0x539547);}(_0xa72b,0x14c));var _0xba72=function(_0xf3e375,_0x5dc1c9){_0xf3e375=_0xf3e375-0x0;var _0x27027b=_0xa72b[_0xf3e375];return _0x27027b;};'use strict';var util=require(_0xba72('0x0'));var _=require(_0xba72('0x1'));var moment=require(_0xba72('0x2'));var logger=require(_0xba72('0x3'))(_0xba72('0x4'));var ipAgi=process[_0xba72('0x5')][_0xba72('0x6')]||_0xba72('0x7');var utils=require('../../dialer/utils');exports[_0xba72('0x8')]=function(_0xa42506){return function(_0x20781b){logger[_0xba72('0x9')](_0xa42506,util[_0xba72('0xa')](_0x20781b,{'showHidden':![],'depth':null}));};};exports[_0xba72('0xb')]=function(_0x20a53b,_0x2c3bfd){logger['info'](_0x20a53b,util['inspect'](_0x2c3bfd,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x26c97f,_0x57212a){logger[_0xba72('0x9')](_0x26c97f,util[_0xba72('0xa')](_0x57212a,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3268bf){return function(_0x12090c){logger[_0xba72('0xc')](_0x3268bf,util['inspect'](_0x12090c,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x38937e,_0x4ea988,_0x5677a3){return{'message':_0x38937e,'unlock':_0x4ea988,'active':_0x5677a3};};exports[_0xba72('0xd')]=function(_0x85d09f,_0x3d0b64,_0x2ff90f){if(!_[_0xba72('0xe')](_0x2ff90f)&&'string'===typeof _0x2ff90f&&!_['isEmpty'](_0x2ff90f)){if(!_[_0xba72('0xe')](_0x3d0b64)&&'string'===typeof _0x3d0b64&&!_[_0xba72('0xf')](_0x3d0b64)){return util[_0xba72('0x10')](_0xba72('0x11'),_0x3d0b64,_0x2ff90f);}return util['format'](_0xba72('0x11'),_0x2ff90f,_0x2ff90f);}if(!_[_0xba72('0xe')](_0x85d09f)&&_0xba72('0x12')===typeof _0x85d09f&&!_['isEmpty'](_0x85d09f)){return _0x85d09f;}return _0xba72('0x13');};exports[_0xba72('0x14')]=function(_0x1536db){if(_['isNil'](_0x1536db)){return![];}return _0x1536db;};exports[_0xba72('0x15')]=function(_0x470cfa,_0x5550e1,_0x3d0222,_0xf10a56,_0x2da2af,_0x28c433){var _0x8688ab={'XMD-QUEUE':_0x5550e1['Queue']?_0x5550e1[_0xba72('0x16')][_0xba72('0x17')]:'','XMD-CALLERID':_0xf10a56,'XMD-CALLERID-PREVIEW':_0x28c433?util[_0xba72('0x10')](_0xba72('0x11'),_0x28c433[_0xba72('0x18')],_0x28c433['calleridnum']):_0xf10a56,'XMD-DIALID':_0x2da2af,'XMD-CONTACTID':_0x5550e1[_0xba72('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xf10a56,'XMD-VOICEQUEUEID':_0x5550e1['VoiceQueueId'],'XMD-DIALCHANNEL':_0x3d0222,'XMD-DIALTIMEOUT':_0x470cfa[_0xba72('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0xba72('0x10')](_0xba72('0x1b'),_0x470cfa['dialQueueProject2']?'g':'',_['isEmpty'](_0x470cfa[_0xba72('0x1c')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x470cfa['dialPreviewUrl']||'','XMD-AGI':_0x470cfa[_0xba72('0x1d')]?util['format'](_0xba72('0x1e'),ipAgi,_0x470cfa[_0xba72('0x1d')]):_0xba72('0x1f'),'XMD-AGIAFTER':_0x470cfa['dialQueueProject2']?util[_0xba72('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x470cfa[_0xba72('0x20')]):_0xba72('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x28c433?_0x28c433[_0xba72('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x28c433?_0x28c433[_0xba72('0x22')]:'','XMD-DESTINATION':_0xba72('0x23'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x470cfa['monitor_format'])){_0x8688ab[util[_0xba72('0x10')]('%s',_0xba72('0x24'))]=_0x470cfa['monitor_format'];_0x8688ab[util['format']('%s',_0xba72('0x25'))]=_0x2da2af;}if(_0x5550e1&&_0x5550e1['Contact']){for(var _0x580a5a in _0x5550e1['Contact']){if(_0x5550e1[_0xba72('0x26')]['hasOwnProperty'](_0x580a5a)){if(!_[_0xba72('0x27')](_0x5550e1[_0xba72('0x26')][_0x580a5a])&&_0x580a5a!=='id'&&_0x580a5a!==_0xba72('0x28')&&_0x580a5a!==_0xba72('0x29')&&_0x580a5a!==_0xba72('0x2a')){_0x8688ab[util['format'](_0xba72('0x2b'),_0xba72('0x2c'),_[_0xba72('0x2d')](_0x580a5a))]=_0x5550e1[_0xba72('0x26')][_0x580a5a];}}}}return _0x8688ab;};exports[_0xba72('0x2e')]=function(_0x59edc0){var _0x222d19={};for(var _0xc561bd in _0x59edc0){if(_0x59edc0[_0xba72('0x2f')](_0xc561bd)){_0x222d19[util[_0xba72('0x10')]('%s',_['toLower'](_0xc561bd))]=_0x59edc0[_0xc561bd];}}return{'variables':_0x222d19};};exports[_0xba72('0x30')]=function(_0x287aec,_0xdf5bb6){if(!_[_0xba72('0x27')](_0x287aec)){if(_0x287aec[_0xba72('0x2f')](_0xba72('0x31'))){if(_0x287aec[_0xba72('0x31')]>0x0){_0x287aec[_0xba72('0x31')]-=0x1;}else{logger[_0xba72('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0xdf5bb6);}}}else{logger['error'](_0xba72('0x32'),_0xdf5bb6);}};exports[_0xba72('0x33')]=function(_0x5b5cc1){var _0x995e31=moment()['format'](_0xba72('0x34'));_0x5b5cc1[_0xba72('0x35')]=0xd;_0x5b5cc1['statedesc']=_0xba72('0x36');_0x5b5cc1['starttime']=_0x995e31;_0x5b5cc1['responsetime']=_0x995e31;_0x5b5cc1['endtime']=_0x995e31;};exports[_0xba72('0x37')]=function(_0x141670,_0x343784,_0x28ed32){var _0x1ead95=moment()['format'](_0xba72('0x34'));_0x141670[_0xba72('0x35')]=_0x343784;_0x141670['statedesc']=_0x28ed32;_0x141670[_0xba72('0x38')]=_0x1ead95;_0x141670['ringtime']=utils[_0xba72('0x39')](_0x141670[_0xba72('0x38')],_0x141670[_0xba72('0x3a')]);};exports['logLookAgent']=function(_0x370524,_0x1da85b,_0x3f7851){_0x370524[_0xba72('0x3b')]=_0x1da85b;_0x370524[_0xba72('0x3c')]=_0x3f7851;};exports[_0xba72('0x3d')]=function(_0x139835,_0x568fa3,_0x570eb0){var _0x525878=moment()[_0xba72('0x10')](_0xba72('0x34'));_0x139835[_0xba72('0x35')]=_0x568fa3;_0x139835[_0xba72('0x3e')]=_0x570eb0;_0x139835['responsetime']=_0x139835[_0xba72('0x38')]?_0x139835[_0xba72('0x38')]:_0x525878;_0x139835[_0xba72('0x3f')]=_0x139835['endtime']?_0x139835[_0xba72('0x3f')]:_0x525878;_0x139835[_0xba72('0x40')]=utils[_0xba72('0x39')](_0x139835[_0xba72('0x38')]||0x0,_0x139835[_0xba72('0x3a')]||0x0);_0x139835[_0xba72('0x41')]=_0x139835[_0xba72('0x42')]?utils[_0xba72('0x39')](_0x139835['endtime'],_0x139835[_0xba72('0x42')]):0x0;};exports[_0xba72('0x43')]=function(_0x23cdbb){return _0x23cdbb==='Failure';};exports[_0xba72('0x44')]=function(_0x13f120,_0x448902,_0x40fd70,_0x406c49,_0x2192fa){var _0x476dab=_0x406c49?'RECALL':_0x13f120[_0xba72('0x18')];_0x476dab=_0x2192fa?_0xba72('0x45'):_0x476dab;return{'actionid':_0x13f120['uniqueid'],'action':'originate','channel':_0x13f120[_0xba72('0x46')],'callerid':util[_0xba72('0x10')]('\x22%s\x22\x20<%s>',_0x476dab,_0x13f120['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xba72('0x47'),'Priority':'1','variable':_0x40fd70,'timeout':(_0x448902['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x13f120[_0xba72('0x48')]};};exports[_0xba72('0x49')]=function(_0x3f2295){return _0x3f2295[_0xba72('0x4a')]+_0x3f2295['countcongestionretry']+_0x3f2295['countnoanswerretry']+_0x3f2295[_0xba72('0x4b')]+_0x3f2295[_0xba72('0x4c')];};exports[_0xba72('0x4d')]=function(_0x6f4506){var _0xde3936=_[_0xba72('0x4e')](_0x6f4506);_0xde3936['state']=0xf;_0xde3936[_0xba72('0x3e')]='Global';return _0xde3936;};exports[_0xba72('0x4f')]=function(_0x208b12,_0xf7eb05,_0x5e0ef8){var _0x5b764a={};_0x5b764a[_0xf7eb05]=_0x208b12[_0xf7eb05];_0x5b764a['active']=![];_0x5b764a['scheduledat']=moment()[_0xba72('0x50')](_0x5e0ef8,_0xba72('0x51'))[_0xba72('0x10')](_0xba72('0x34'));_0x5b764a[_0xba72('0x19')]=_0x208b12['ContactId'];_0x5b764a[_0xba72('0x52')]=_0x208b12[_0xba72('0x52')];_0x5b764a['VoiceQueueId']=_0x208b12['VoiceQueueId']||undefined;return _0x5b764a;};exports['decrementTalkink']=function(_0x48500f,_0x1da73c){if(!_[_0xba72('0x27')](_0x48500f)){if(_0x48500f[_0xba72('0x53')]>0x0){_0x48500f[_0xba72('0x53')]-=0x1;}else{logger[_0xba72('0x9')](_0x1da73c,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xba72('0x9')](_0x1da73c,_0xba72('0x54'));}};exports['IsNotLoggedIn']=function(_0x2577f3){if(_0x2577f3<=0x0){return!![];}return![];};function buildObj(_0x59e6dc,_0x9af84c,_0x3be77){_0x59e6dc[_0xba72('0x55')]=_0x9af84c;_0x59e6dc[_0xba72('0x17')]=_0x59e6dc['queue'];_0x59e6dc[_0xba72('0x56')]=_0x59e6dc['channelAgent'];_0x59e6dc['motionChannel']='voice';if(_0x3be77){_0x59e6dc['mandatoryDisposition']=_0x3be77[_0xba72('0x57')];}return _0x59e6dc;}exports[_0xba72('0x58')]=buildObj;exports[_0xba72('0x59')]=function(_0x1d67ba){var _0x2c7eee={};_0x2c7eee[_0xba72('0x5a')]=_0x1d67ba['queue'];_0x2c7eee[_0xba72('0x56')]=_0x1d67ba[_0xba72('0x46')];_0x2c7eee['uniqueid']=_0x1d67ba['uniqueid'];return _0x2c7eee;};exports[_0xba72('0x5b')]=function(_0x46b521){var _0x1a341f=[];for(var _0x1348b0 in _0x46b521){if(_0x46b521['hasOwnProperty'](_0x1348b0)){if(!_[_0xba72('0x27')](_0x46b521[_0x1348b0])&&_0x46b521[_0x1348b0][_0xba72('0x35')]===_0xba72('0x5c')&&_0x46b521[_0x1348b0][_0xba72('0x5d')]===_0xba72('0x5e')){_0x1a341f[_0xba72('0x5f')](_0x46b521[_0x1348b0]['id']);}}}return _0x1a341f;};exports['getDiff']=function(_0x8c4206){var _0x185ca1=moment()['milliseconds'](0x0);var _0x111789=moment(_0x8c4206)[_0xba72('0x60')](0x0);return _0x185ca1[_0xba72('0x61')](_0x111789,_0xba72('0x62'));};exports[_0xba72('0x63')]=function(_0x4ae512){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4ae512['ContactId'],'ListId':_0x4ae512[_0xba72('0x52')],'VoiceQueueId':_0x4ae512[_0xba72('0x64')]||undefined,'CampaignId':_0x4ae512[_0xba72('0x65')]||undefined};};exports[_0xba72('0x66')]=function(_0x45b19a){if(_0x45b19a===_0xba72('0x48')||_0x45b19a===_0xba72('0x67')||_0x45b19a===_0xba72('0x5a')||_0x45b19a==='type'||_0x45b19a===_0xba72('0x68')||_0x45b19a===_0xba72('0x69')||_0x45b19a===_0xba72('0x3b')||_0x45b19a===_0xba72('0x46')||_0x45b19a===_0xba72('0x18')||_0x45b19a==='active'||_0x45b19a==='calleridnum'||_0x45b19a===_0xba72('0x6a')||_0x45b19a===_0xba72('0x4a')||_0x45b19a===_0xba72('0x6b')||_0x45b19a==='countnoanswerretry'||_0x45b19a===_0xba72('0x6c')||_0x45b19a===_0xba72('0x6d')||_0x45b19a===_0xba72('0x6e')||_0x45b19a===_0xba72('0x6f')||_0x45b19a===_0xba72('0x70')||_0x45b19a===_0xba72('0x19')||_0x45b19a===_0xba72('0x52')||_0x45b19a===_0xba72('0x3c')||_0x45b19a===_0xba72('0x64')||_0x45b19a==='sipcallid'||_0x45b19a===_0xba72('0x71')||_0x45b19a===_0xba72('0x72')||_0x45b19a===_0xba72('0x73')||_0x45b19a===_0xba72('0x74')||_0x45b19a==='xmd-dialurl'||_0x45b19a==='xmd-dialtimeout'||_0x45b19a===_0xba72('0x75')||_0x45b19a===_0xba72('0x76')||_0x45b19a===_0xba72('0x77')||_0x45b19a===_0xba72('0x78')||_0x45b19a==='xmd-cdrtype'||_0x45b19a===_0xba72('0x79')||_0x45b19a===_0xba72('0x7a')||_0x45b19a==='xmd-agi'||_0x45b19a===_0xba72('0x7b')||_0x45b19a===_0xba72('0x7c')||_0x45b19a==='rtpaudioqosjitter'||_0x45b19a===_0xba72('0x7d')||_0x45b19a===_0xba72('0x7e')||_0x45b19a==='rtpaudioqoslossbridged'||_0x45b19a==='rtpaudioqosrtt'||_0x45b19a==='rtpaudioqosrttbridged'||_0x45b19a===_0xba72('0x7b')||_0x45b19a===_0xba72('0x7c')||_0x45b19a==='rtpaudioqosjitter'||_0x45b19a===_0xba72('0x7d')||_0x45b19a===_0xba72('0x7e')||_0x45b19a===_0xba72('0x7f')||_0x45b19a==='rtpaudioqosrtt'||_0x45b19a===_0xba72('0x80')||_0x45b19a==='bridgepeer'||_0x45b19a===_0xba72('0x81')||_0x45b19a==='state'||_0x45b19a===_0xba72('0x3e')){return![];}return!![];};exports[_0xba72('0x82')]=function(_0xb97e19,_0x238593){var _0x207245,_0xbdcfa0,_0x12ed4b;if(_0x238593<=0x0){_0x238593=0x1;}_0x207245=new RegExp(_0xba72('0x83')+_0x238593+'}$');_0xbdcfa0=Math[_0xba72('0x84')](0xa,_0x238593-0x1);_0x12ed4b=Math[_0xba72('0x84')](0xa,_0x238593)-0x1;return util['format']('%s',_[_0xba72('0x85')](_0xb97e19,_0x207245,_[_0xba72('0x86')](_0xbdcfa0,_0x12ed4b)));};exports[_0xba72('0x87')]=function(_0x3dbcde){var _0x3ce403=_0x3dbcde[_0xba72('0x88')](/"(.*?)"/);return _0x3ce403?_0x3ce403[0x1]:_0x3dbcde;};exports['extractCalleridNumber']=function(_0x26ab12){var _0x3c0749=_0x26ab12['match'](/<(.*?)>/);return _0x3c0749?_0x3c0749[0x1]:_0x26ab12;};function buildNoAnswerEventPayload(_0x5e6ede,_0x451791){var _0x247805=buildObj(_0x5e6ede,_0xba72('0x89'));if(!_[_0xba72('0xf')](_0x451791[_0xba72('0x8a')])){Object[_0xba72('0x8b')](_0x451791[_0xba72('0x8a')])['forEach'](function(_0x140890){_0x247805[_0x140890['toLowerCase']()]=_0x451791['variables'][_0x140890];});}return _0x247805;}exports[_0xba72('0x8c')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x72e0=['monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','state','ringtime','getSeconds','logLookAgent','UserId','logCustomer','talktime','answertime','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','reachable','push','milliseconds','diff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','membername','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ListId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','util','lodash','moment','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','logger','info','inspect','loggerError','error','logger2','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x72e0,0x1af));var _0x072e=function(_0x4b925b,_0x578e4f){_0x4b925b=_0x4b925b-0x0;var _0x1d9b54=_0x72e0[_0x4b925b];return _0x1d9b54;};'use strict';var util=require(_0x072e('0x0'));var _=require(_0x072e('0x1'));var moment=require(_0x072e('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process['env'][_0x072e('0x3')]||_0x072e('0x4');var utils=require(_0x072e('0x5'));exports[_0x072e('0x6')]=function(_0x2abc24){return function(_0x2ec2e9){logger['error'](_0x2abc24,util['inspect'](_0x2ec2e9,{'showHidden':![],'depth':null}));};};exports[_0x072e('0x7')]=function(_0x40a755,_0x3f79f3){logger[_0x072e('0x8')](_0x40a755,util[_0x072e('0x9')](_0x3f79f3,{'showHidden':![],'depth':null}));};exports[_0x072e('0xa')]=function(_0x18f787,_0x21a0cc){logger[_0x072e('0xb')](_0x18f787,util[_0x072e('0x9')](_0x21a0cc,{'showHidden':![],'depth':null}));};exports[_0x072e('0xc')]=function(_0x4ead31){return function(_0x5e2699){logger[_0x072e('0x8')](_0x4ead31,util['inspect'](_0x5e2699,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x169391,_0x15acb5,_0x263241){return{'message':_0x169391,'unlock':_0x15acb5,'active':_0x263241};};exports[_0x072e('0xd')]=function(_0x266c57,_0x18b73e,_0x2ca277){if(!_['isUndefined'](_0x2ca277)&&_0x072e('0xe')===typeof _0x2ca277&&!_[_0x072e('0xf')](_0x2ca277)){if(!_[_0x072e('0x10')](_0x18b73e)&&_0x072e('0xe')===typeof _0x18b73e&&!_[_0x072e('0xf')](_0x18b73e)){return util[_0x072e('0x11')]('\x22%s\x22\x20<%s>',_0x18b73e,_0x2ca277);}return util[_0x072e('0x11')](_0x072e('0x12'),_0x2ca277,_0x2ca277);}if(!_[_0x072e('0x10')](_0x266c57)&&_0x072e('0xe')===typeof _0x266c57&&!_[_0x072e('0xf')](_0x266c57)){return _0x266c57;}return _0x072e('0x13');};exports[_0x072e('0x14')]=function(_0x21d298){if(_['isNil'](_0x21d298)){return![];}return _0x21d298;};exports[_0x072e('0x15')]=function(_0x133b69,_0x4c874b,_0x4707a8,_0x6c6d13,_0xbc8cd2,_0x1dde72){var _0x4a5126={'XMD-QUEUE':_0x4c874b['Queue']?_0x4c874b['Queue'][_0x072e('0x16')]:'','XMD-CALLERID':_0x6c6d13,'XMD-CALLERID-PREVIEW':_0x1dde72?util[_0x072e('0x11')](_0x072e('0x12'),_0x1dde72[_0x072e('0x17')],_0x1dde72[_0x072e('0x18')]):_0x6c6d13,'XMD-DIALID':_0xbc8cd2,'XMD-CONTACTID':_0x4c874b[_0x072e('0x19')],'XMD-CDRTYPE':_0x072e('0x1a'),'CALLERID(all)':_0x6c6d13,'XMD-VOICEQUEUEID':_0x4c874b[_0x072e('0x1b')],'XMD-DIALCHANNEL':_0x4707a8,'XMD-DIALTIMEOUT':_0x133b69[_0x072e('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x072e('0x11')](_0x072e('0x1d'),_0x133b69[_0x072e('0x1e')]?'g':'',_[_0x072e('0xf')](_0x133b69[_0x072e('0x1f')])?'':_0x072e('0x20')),'XMD-DIALURL':_0x133b69[_0x072e('0x21')]||'','XMD-AGI':_0x133b69[_0x072e('0x22')]?util[_0x072e('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x133b69[_0x072e('0x22')]):'NONE','XMD-AGIAFTER':_0x133b69[_0x072e('0x1e')]?util[_0x072e('0x11')](_0x072e('0x23'),ipAgi,_0x133b69[_0x072e('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1dde72?_0x1dde72[_0x072e('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x1dde72?_0x1dde72[_0x072e('0x25')]:'','XMD-DESTINATION':_0x072e('0x26'),'SIPADDHEADER':_0x072e('0x27')};if(!_[_0x072e('0xf')](_0x133b69[_0x072e('0x1f')])){_0x4a5126[util[_0x072e('0x11')]('%s',_0x072e('0x28'))]=_0x133b69[_0x072e('0x1f')];_0x4a5126[util[_0x072e('0x11')]('%s',_0x072e('0x29'))]=_0xbc8cd2;}if(_0x4c874b&&_0x4c874b[_0x072e('0x2a')]){for(var _0x40d7a7 in _0x4c874b['Contact']){if(_0x4c874b[_0x072e('0x2a')][_0x072e('0x2b')](_0x40d7a7)){if(!_[_0x072e('0x2c')](_0x4c874b[_0x072e('0x2a')][_0x40d7a7])&&_0x40d7a7!=='id'&&_0x40d7a7!=='tags'&&_0x40d7a7!==_0x072e('0x2d')&&_0x40d7a7!==_0x072e('0x2e')){_0x4a5126[util[_0x072e('0x11')]('%s%s',_0x072e('0x2f'),_[_0x072e('0x30')](_0x40d7a7))]=_0x4c874b[_0x072e('0x2a')][_0x40d7a7];}}}}return _0x4a5126;};exports[_0x072e('0x31')]=function(_0x4f1b96){var _0x1a7449={};for(var _0x5113a4 in _0x4f1b96){if(_0x4f1b96[_0x072e('0x2b')](_0x5113a4)){_0x1a7449[util['format']('%s',_[_0x072e('0x32')](_0x5113a4))]=_0x4f1b96[_0x5113a4];}}return{'variables':_0x1a7449};};exports[_0x072e('0x33')]=function(_0x4dab3b,_0x2a5521){if(!_[_0x072e('0x2c')](_0x4dab3b)){if(_0x4dab3b[_0x072e('0x2b')](_0x072e('0x34'))){if(_0x4dab3b['originated']>0x0){_0x4dab3b[_0x072e('0x34')]-=0x1;}else{logger[_0x072e('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2a5521);}}}else{logger[_0x072e('0xb')](_0x072e('0x35'),_0x2a5521);}};exports[_0x072e('0x36')]=function(_0x5e843d){var _0x1abacb=moment()['format'](_0x072e('0x37'));_0x5e843d['state']=0xd;_0x5e843d[_0x072e('0x38')]=_0x072e('0x39');_0x5e843d[_0x072e('0x3a')]=_0x1abacb;_0x5e843d[_0x072e('0x3b')]=_0x1abacb;_0x5e843d[_0x072e('0x3c')]=_0x1abacb;};exports[_0x072e('0x3d')]=function(_0x23f350,_0x5b2d16,_0x1c79f2){var _0x3cb5d0=moment()['format'](_0x072e('0x37'));_0x23f350[_0x072e('0x3e')]=_0x5b2d16;_0x23f350[_0x072e('0x38')]=_0x1c79f2;_0x23f350[_0x072e('0x3b')]=_0x3cb5d0;_0x23f350[_0x072e('0x3f')]=utils[_0x072e('0x40')](_0x23f350[_0x072e('0x3b')],_0x23f350[_0x072e('0x3a')]);};exports[_0x072e('0x41')]=function(_0x48652f,_0x288259,_0x1cff29){_0x48652f['membername']=_0x288259;_0x48652f[_0x072e('0x42')]=_0x1cff29;};exports[_0x072e('0x43')]=function(_0xda0eed,_0x1aa77c,_0x353189){var _0x322b2c=moment()[_0x072e('0x11')](_0x072e('0x37'));_0xda0eed[_0x072e('0x3e')]=_0x1aa77c;_0xda0eed['statedesc']=_0x353189;_0xda0eed[_0x072e('0x3b')]=_0xda0eed[_0x072e('0x3b')]?_0xda0eed[_0x072e('0x3b')]:_0x322b2c;_0xda0eed[_0x072e('0x3c')]=_0xda0eed[_0x072e('0x3c')]?_0xda0eed['endtime']:_0x322b2c;_0xda0eed[_0x072e('0x3f')]=utils[_0x072e('0x40')](_0xda0eed[_0x072e('0x3b')]||0x0,_0xda0eed['starttime']||0x0);_0xda0eed[_0x072e('0x44')]=_0xda0eed[_0x072e('0x45')]?utils[_0x072e('0x40')](_0xda0eed['endtime'],_0xda0eed[_0x072e('0x45')]):0x0;};exports['isFailure']=function(_0x4d8a88){return _0x4d8a88===_0x072e('0x46');};exports[_0x072e('0x47')]=function(_0x3c5327,_0x198ceb,_0x5fc3e5,_0x3e8f18,_0x46d4b4){var _0x3e9599=_0x3e8f18?'RECALL':_0x3c5327['calleridname'];_0x3e9599=_0x46d4b4?_0x072e('0x48'):_0x3e9599;return{'actionid':_0x3c5327[_0x072e('0x49')],'action':_0x072e('0x4a'),'channel':_0x3c5327[_0x072e('0x4b')],'callerid':util[_0x072e('0x11')](_0x072e('0x12'),_0x3e9599,_0x3c5327[_0x072e('0x18')]),'Exten':_0x072e('0x26'),'Context':_0x072e('0x4c'),'Priority':'1','variable':_0x5fc3e5,'timeout':(_0x198ceb[_0x072e('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3c5327[_0x072e('0x49')]};};exports[_0x072e('0x4e')]=function(_0x2692ac){return _0x2692ac[_0x072e('0x4f')]+_0x2692ac[_0x072e('0x50')]+_0x2692ac['countnoanswerretry']+_0x2692ac[_0x072e('0x51')]+_0x2692ac['countnosuchnumberretry'];};exports[_0x072e('0x52')]=function(_0x25bb94){var _0x8cb449=_[_0x072e('0x53')](_0x25bb94);_0x8cb449[_0x072e('0x3e')]=0xf;_0x8cb449[_0x072e('0x38')]=_0x072e('0x54');return _0x8cb449;};exports[_0x072e('0x55')]=function(_0xf1e4f1,_0x2fb06f,_0xa37e58){var _0x1cc61e={};_0x1cc61e[_0x2fb06f]=_0xf1e4f1[_0x2fb06f];_0x1cc61e[_0x072e('0x56')]=![];_0x1cc61e[_0x072e('0x57')]=moment()['add'](_0xa37e58,'minutes')[_0x072e('0x11')](_0x072e('0x37'));_0x1cc61e[_0x072e('0x19')]=_0xf1e4f1['ContactId'];_0x1cc61e['ListId']=_0xf1e4f1['ListId'];_0x1cc61e[_0x072e('0x1b')]=_0xf1e4f1[_0x072e('0x1b')]||undefined;return _0x1cc61e;};exports[_0x072e('0x58')]=function(_0x201d07,_0x47ee86){if(!_[_0x072e('0x2c')](_0x201d07)){if(_0x201d07[_0x072e('0x59')]>0x0){_0x201d07[_0x072e('0x59')]-=0x1;}else{logger[_0x072e('0xb')](_0x47ee86,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x072e('0xb')](_0x47ee86,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x072e('0x5a')]=function(_0x2c0744){if(_0x2c0744<=0x0){return!![];}return![];};function buildObj(_0x545819,_0x222cd2,_0x403943){_0x545819[_0x072e('0x5b')]=_0x222cd2;_0x545819[_0x072e('0x16')]=_0x545819[_0x072e('0x5c')];_0x545819[_0x072e('0x5d')]=_0x545819[_0x072e('0x4b')];_0x545819[_0x072e('0x5e')]=_0x072e('0x5f');if(_0x403943){_0x545819[_0x072e('0x60')]=_0x403943[_0x072e('0x60')];}return _0x545819;}exports[_0x072e('0x61')]=buildObj;exports[_0x072e('0x62')]=function(_0x24f7b4){var _0x594958={};_0x594958[_0x072e('0x5c')]=_0x24f7b4['queue'];_0x594958[_0x072e('0x5d')]=_0x24f7b4[_0x072e('0x4b')];_0x594958[_0x072e('0x49')]=_0x24f7b4['uniqueid'];return _0x594958;};exports[_0x072e('0x63')]=function(_0x4d80b3){var _0x5e7d69=[];for(var _0x2c7c74 in _0x4d80b3){if(_0x4d80b3[_0x072e('0x2b')](_0x2c7c74)){if(!_[_0x072e('0x2c')](_0x4d80b3[_0x2c7c74])&&_0x4d80b3[_0x2c7c74][_0x072e('0x3e')]==='not_inuse'&&_0x4d80b3[_0x2c7c74]['status']===_0x072e('0x64')){_0x5e7d69[_0x072e('0x65')](_0x4d80b3[_0x2c7c74]['id']);}}}return _0x5e7d69;};exports['getDiff']=function(_0x4dd326){var _0x5e425a=moment()[_0x072e('0x66')](0x0);var _0x2532f9=moment(_0x4dd326)[_0x072e('0x66')](0x0);return _0x5e425a[_0x072e('0x67')](_0x2532f9,'seconds');};exports[_0x072e('0x68')]=function(_0x5d098b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5d098b['ContactId'],'ListId':_0x5d098b['ListId'],'VoiceQueueId':_0x5d098b['VoiceQueueId']||undefined,'CampaignId':_0x5d098b[_0x072e('0x69')]||undefined};};exports[_0x072e('0x6a')]=function(_0x1407bb){if(_0x1407bb===_0x072e('0x49')||_0x1407bb==='idContact'||_0x1407bb===_0x072e('0x5c')||_0x1407bb===_0x072e('0x6b')||_0x1407bb===_0x072e('0x6c')||_0x1407bb===_0x072e('0x6d')||_0x1407bb===_0x072e('0x6e')||_0x1407bb===_0x072e('0x4b')||_0x1407bb===_0x072e('0x17')||_0x1407bb===_0x072e('0x56')||_0x1407bb==='calleridnum'||_0x1407bb==='scheduledat'||_0x1407bb===_0x072e('0x4f')||_0x1407bb===_0x072e('0x50')||_0x1407bb===_0x072e('0x6f')||_0x1407bb===_0x072e('0x70')||_0x1407bb===_0x072e('0x71')||_0x1407bb===_0x072e('0x72')||_0x1407bb===_0x072e('0x73')||_0x1407bb===_0x072e('0x74')||_0x1407bb===_0x072e('0x19')||_0x1407bb===_0x072e('0x75')||_0x1407bb===_0x072e('0x42')||_0x1407bb==='VoiceQueueId'||_0x1407bb===_0x072e('0x76')||_0x1407bb===_0x072e('0x77')||_0x1407bb===_0x072e('0x78')||_0x1407bb===_0x072e('0x79')||_0x1407bb===_0x072e('0x7a')||_0x1407bb===_0x072e('0x7b')||_0x1407bb===_0x072e('0x7c')||_0x1407bb===_0x072e('0x7d')||_0x1407bb===_0x072e('0x7e')||_0x1407bb===_0x072e('0x7f')||_0x1407bb===_0x072e('0x80')||_0x1407bb===_0x072e('0x81')||_0x1407bb===_0x072e('0x82')||_0x1407bb===_0x072e('0x83')||_0x1407bb===_0x072e('0x84')||_0x1407bb===_0x072e('0x85')||_0x1407bb===_0x072e('0x86')||_0x1407bb==='rtpaudioqosjitter'||_0x1407bb==='rtpaudioqosjitterbridged'||_0x1407bb===_0x072e('0x87')||_0x1407bb===_0x072e('0x88')||_0x1407bb===_0x072e('0x89')||_0x1407bb===_0x072e('0x8a')||_0x1407bb===_0x072e('0x85')||_0x1407bb===_0x072e('0x86')||_0x1407bb===_0x072e('0x8b')||_0x1407bb===_0x072e('0x8c')||_0x1407bb===_0x072e('0x87')||_0x1407bb===_0x072e('0x88')||_0x1407bb===_0x072e('0x89')||_0x1407bb===_0x072e('0x8a')||_0x1407bb===_0x072e('0x8d')||_0x1407bb==='bridgepvtcallid'||_0x1407bb===_0x072e('0x3e')||_0x1407bb===_0x072e('0x38')){return![];}return!![];};exports[_0x072e('0x8e')]=function(_0x2119a0,_0x5233f3){var _0x262332,_0xcda63d,_0x19bf5c;if(_0x5233f3<=0x0){_0x5233f3=0x1;}_0x262332=new RegExp(_0x072e('0x8f')+_0x5233f3+'}$');_0xcda63d=Math[_0x072e('0x90')](0xa,_0x5233f3-0x1);_0x19bf5c=Math[_0x072e('0x90')](0xa,_0x5233f3)-0x1;return util[_0x072e('0x11')]('%s',_['replace'](_0x2119a0,_0x262332,_[_0x072e('0x91')](_0xcda63d,_0x19bf5c)));};exports[_0x072e('0x92')]=function(_0x49b175){var _0x51ccf6=_0x49b175[_0x072e('0x93')](/"(.*?)"/);return _0x51ccf6?_0x51ccf6[0x1]:_0x49b175;};exports[_0x072e('0x94')]=function(_0x14e749){var _0x29dcf3=_0x14e749['match'](/<(.*?)>/);return _0x29dcf3?_0x29dcf3[0x1]:_0x14e749;};function buildNoAnswerEventPayload(_0x34b282,_0xb7a05f){var _0x311e7d=buildObj(_0x34b282,_0x072e('0x95'));if(!_[_0x072e('0xf')](_0xb7a05f[_0x072e('0x96')])){Object[_0x072e('0x97')](_0xb7a05f['variables'])[_0x072e('0x98')](function(_0x2ba894){_0x311e7d[_0x2ba894[_0x072e('0x99')]()]=_0xb7a05f[_0x072e('0x96')][_0x2ba894];});}return _0x311e7d;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 9184a13..4497093 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 _0xbc2f=['boolean','queueremove','queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbc2f,0x1d3));var _0xfbc2=function(_0x4be16c,_0x400092){_0x4be16c=_0x4be16c-0x0;var _0x2c780a=_0xbc2f[_0x4be16c];return _0x2c780a;};'use strict';exports[_0xfbc2('0x0')]={'queue':{'type':_0xfbc2('0x1'),'required':!![]},'interface':{'type':_0xfbc2('0x1'),'required':!![]},'membername':{'type':_0xfbc2('0x1'),'required':!![]},'penalty':{'type':_0xfbc2('0x2'),'required':![]},'paused':{'type':_0xfbc2('0x3'),'required':![]}};exports[_0xfbc2('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xfbc2('0x1'),'required':!![]}};exports[_0xfbc2('0x5')]={'interface':{'type':_0xfbc2('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0xfbc2('0x6')]={'module':{'type':_0xfbc2('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xfbc2('0x1'),'required':!![]}};exports[_0xfbc2('0x7')]={'uniqueid':{'type':_0xfbc2('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xfbc2('0x1')},'mixmonitorid':{'type':_0xfbc2('0x1')}};exports[_0xfbc2('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xfbc2('0x9')]={'uniqueid':{'type':_0xfbc2('0x1'),'required':!![]},'exten':{'type':_0xfbc2('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xcc70=['number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x51361c,_0x3ac7f6){var _0xafa94b=function(_0x2886ba){while(--_0x2886ba){_0x51361c['push'](_0x51361c['shift']());}};_0xafa94b(++_0x3ac7f6);}(_0xcc70,0x17f));var _0x0cc7=function(_0xb03f9,_0x588391){_0xb03f9=_0xb03f9-0x0;var _0x3ec30a=_0xcc70[_0xb03f9];return _0x3ec30a;};'use strict';exports[_0x0cc7('0x0')]={'queue':{'type':_0x0cc7('0x1'),'required':!![]},'interface':{'type':_0x0cc7('0x1'),'required':!![]},'membername':{'type':_0x0cc7('0x1'),'required':!![]},'penalty':{'type':_0x0cc7('0x2'),'required':![]},'paused':{'type':_0x0cc7('0x3'),'required':![]}};exports[_0x0cc7('0x4')]={'queue':{'type':_0x0cc7('0x1'),'required':!![]},'interface':{'type':_0x0cc7('0x1'),'required':!![]}};exports[_0x0cc7('0x5')]={'interface':{'type':_0x0cc7('0x1'),'required':!![]},'paused':{'type':_0x0cc7('0x3')},'reason':{'type':'string','required':![]}};exports[_0x0cc7('0x6')]={'module':{'type':_0x0cc7('0x1'),'required':![]}};exports[_0x0cc7('0x7')]={'uniqueid':{'type':_0x0cc7('0x1'),'required':!![]}};exports[_0x0cc7('0x8')]={'uniqueid':{'type':_0x0cc7('0x1'),'required':!![]},'filename':{'type':_0x0cc7('0x1')},'format':{'type':_0x0cc7('0x1')},'mixmonitorid':{'type':_0x0cc7('0x1')}};exports[_0x0cc7('0x9')]={'uniqueid':{'type':_0x0cc7('0x1'),'required':!![]}};exports[_0x0cc7('0xa')]={'uniqueid':{'type':_0x0cc7('0x1'),'required':!![]},'exten':{'type':_0x0cc7('0x1'),'required':!![]},'context':{'type':_0x0cc7('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 2b64893..8e88829 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 _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2032,0xd9));var _0x2203=function(_0x2c56ae,_0x4a1101){_0x2c56ae=_0x2c56ae-0x0;var _0xc3e332=_0x2032[_0x2c56ae];return _0xc3e332;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file +var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0xd19d9b,_0xaef32f){var _0xc26cb3=function(_0x16f1cc){while(--_0x16f1cc){_0xd19d9b['push'](_0xd19d9b['shift']());}};_0xc26cb3(++_0xaef32f);}(_0x757a,0xde));var _0xa757=function(_0x3fa3a6,_0x1aad10){_0x3fa3a6=_0x3fa3a6-0x0;var _0x5aa8f8=_0x757a[_0x3fa3a6];return _0x5aa8f8;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 997975e..0777e74 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 _0x037e=['hasOwnProperty'];(function(_0x2f50b6,_0xd09fe3){var _0x54b027=function(_0x680941){while(--_0x680941){_0x2f50b6['push'](_0x2f50b6['shift']());}};_0x54b027(++_0xd09fe3);}(_0x037e,0xe7));var _0xe037=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x037e[_0x20a584];return _0x4b41a8;};'use strict';function mergeDBDataToRealtime(_0x41d888,_0x1b0051){var _0x553d02=Object['assign']({},_0x41d888);for(var _0x96ff34 in _0x1b0051){if(_0x553d02[_0xe037('0x0')](_0x96ff34)){_0x553d02[_0x96ff34]=_0x1b0051[_0x96ff34];}}return _0x553d02;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x2449=['assign','mergeDBDataToRealtime'];(function(_0x25e761,_0x24c218){var _0x190dfb=function(_0x5f2a26){while(--_0x5f2a26){_0x25e761['push'](_0x25e761['shift']());}};_0x190dfb(++_0x24c218);}(_0x2449,0xce));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';function mergeDBDataToRealtime(_0x581d18,_0x218267){var _0x350db7=Object[_0x9244('0x0')]({},_0x581d18);for(var _0xebb259 in _0x218267){if(_0x350db7['hasOwnProperty'](_0xebb259)){_0x350db7[_0xebb259]=_0x218267[_0xebb259];}}return _0x350db7;}exports[_0x9244('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 8dc4b80..05193a6 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 _0xd3da=['custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedTransfer','find','accountcode','name','isNil','interface','SIP/%s','length','assigned','lastAssignedTo','format','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','split','calleridnum','outbound','internal','voiceCallReport','destination','exten','type','dialer','queue','context','callerid','channel','destinationchannel','calleridpreview','originatecalleridnum','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','calleridname','connectedlinename','forEach','voiceDialReport','startsWith','substring','indexOf','phone','lastIndexOf','findAgent','transfererlinkedid','lodash','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled'];(function(_0x5d8792,_0x4f5438){var _0x986d0e=function(_0x1d4b83){while(--_0x1d4b83){_0x5d8792['push'](_0x5d8792['shift']());}};_0x986d0e(++_0x4f5438);}(_0xd3da,0x151));var _0xad3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3da[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xad3d('0x0'));var moment=require('moment');var util=require('util');var config=require(_0xad3d('0x1'));var ami=require(_0xad3d('0x2'));var RpcVoiceAgentReport=require(_0xad3d('0x3'));var RpcVoiceCallReport=require(_0xad3d('0x4'));var RpcVoiceDialReport=require(_0xad3d('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xad3d('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xad3d('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xad3d('0x8'));var VoiceAgentReport=require(_0xad3d('0x9'));var VoiceDialReport=require(_0xad3d('0xa'));var UserReport=require(_0xad3d('0xb'));function Report(_0x1164eb){this[_0xad3d('0xc')]=_0x1164eb;this[_0xad3d('0xd')]=_0x1164eb[_0xad3d('0xd')];this[_0xad3d('0xe')]=_0x1164eb[_0xad3d('0xe')];}Report[_0xad3d('0xf')][_0xad3d('0x10')]=function(_0x3805eb){var _0x42f811=new VoiceQueueReport(this['realtime']);var _0x1ce196=new VoiceAgentReport(this[_0xad3d('0xc')]);var _0x2e01da=new VoiceDialReport(this['realtime']);var _0x5a8e45=new VoiceCallReport(this[_0xad3d('0xc')]);var _0x3776cb=new UserReport(this[_0xad3d('0xc')]);if(config[_0xad3d('0x11')]&&config['xdr'][_0xad3d('0x12')]){ami['on'](_0xad3d('0x13'),this[_0xad3d('0x14')][_0xad3d('0x15')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0xad3d('0x15')](this));ami['on'](_0xad3d('0x16'),this[_0xad3d('0x17')][_0xad3d('0x15')](this));ami['on'](_0xad3d('0x18'),this['voiceDialReport'][_0xad3d('0x15')](this));ami['on'](_0xad3d('0x19'),this['blindTransfer'][_0xad3d('0x15')](this));ami['on']('attendedtransfer',this[_0xad3d('0x1a')]['bind'](this));}};Report['prototype']['findAgent']=function(_0x1ed1b1){var _0x2818ca;_0x2818ca=_[_0xad3d('0x1b')](this[_0xad3d('0xd')],function(_0xf107a1){return _0xf107a1[_0xad3d('0x1c')]==_0x1ed1b1||_0xf107a1[_0xad3d('0x1d')]==_0x1ed1b1;});if(_[_0xad3d('0x1e')](_0x2818ca)){var _0x58d9f6=_['find'](this[_0xad3d('0xe')],function(_0x4fb962){return _0x4fb962[_0xad3d('0x1c')]==_0x1ed1b1||_0x4fb962[_0xad3d('0x1d')]==_0x1ed1b1;});if(_0x58d9f6){_0x2818ca=_[_0xad3d('0x1b')](this[_0xad3d('0xd')],function(_0x3a5889){return _0x3a5889[_0xad3d('0x1f')]==util['format'](_0xad3d('0x20'),_0x58d9f6['name']);});}}return _0x2818ca;};Report[_0xad3d('0xf')][_0xad3d('0x14')]=function(_0x1f0a80){for(var _0x121761=0x0;_0x121761<_0x1f0a80[_0xad3d('0x21')];_0x121761+=0x1){var _0x415d81=this['findAgent'](_0x1f0a80[_0x121761]['connectedlinenum']);if(_0x415d81){_0x1f0a80[_0x121761]['accountcode']=_0x415d81[_0xad3d('0x1c')];_0x1f0a80[_0x121761][_0xad3d('0x22')]=!![];_0x1f0a80[_0x121761][_0xad3d('0x23')]=_0x415d81[_0xad3d('0x1d')];_0x1f0a80[_0x121761][_0xad3d('0x1f')]=_[_0xad3d('0x1e')](_0x415d81[_0xad3d('0x1f')])?util[_0xad3d('0x24')](_0xad3d('0x20'),_0x415d81[_0xad3d('0x1d')]):_0x415d81['interface'];if(_0x1f0a80[_0x121761]['queuecallercomplete']){_0x1f0a80[_0x121761][_0xad3d('0x25')]=moment()['format'](_0xad3d('0x26'));}if(_0x1f0a80[_0x121761]['queuecallerexit']){_0x1f0a80[_0x121761][_0xad3d('0x27')]=moment()['format'](_0xad3d('0x26'));}RpcMemberReport[_0xad3d('0x14')](_0x1f0a80[_0x121761]);}RpcVoiceQueueReport[_0xad3d('0x28')](_0x1f0a80[_0x121761]);}};function extractCalleridNumber(_0x3b971b){var _0x5890d4=_0x3b971b[_0xad3d('0x29')](/<(.*?)>/);return _0x5890d4?_0x5890d4[0x1]:_0x3b971b;}Report[_0xad3d('0xf')][_0xad3d('0x2a')]=function(_0x11812e){for(var _0x565192=0x0;_0x565192','transfers','linkedid','transfereelinkedid','getAgentByInternal','UserId','monitor','monitors','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','substring','indexOf','phone','transfererlinkedid','exports','lodash','moment','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','length'];(function(_0x5ed5fd,_0x1e3a06){var _0x37564c=function(_0x40a6b7){while(--_0x40a6b7){_0x5ed5fd['push'](_0x5ed5fd['shift']());}};_0x37564c(++_0x1e3a06);}(_0x3cb7,0x88));var _0x73cb=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0x3cb7[_0xab2afb];return _0x25262b;};'use strict';var _=require(_0x73cb('0x0'));var moment=require(_0x73cb('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x73cb('0x2'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x73cb('0x3'));var RpcMemberReport=require(_0x73cb('0x4'));var RpcVoiceQueueReport=require(_0x73cb('0x5'));var RpcVoiceRecording=require(_0x73cb('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x73cb('0x7'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x73cb('0x8'));var UserReport=require(_0x73cb('0x9'));function Report(_0x528948){this[_0x73cb('0xa')]=_0x528948;this[_0x73cb('0xb')]=_0x528948[_0x73cb('0xb')];this[_0x73cb('0xc')]=_0x528948[_0x73cb('0xc')];}Report[_0x73cb('0xd')][_0x73cb('0xe')]=function(_0x37430b){var _0x266099=new VoiceQueueReport(this[_0x73cb('0xa')]);var _0x94dd2a=new VoiceAgentReport(this[_0x73cb('0xa')]);var _0x5844ef=new VoiceDialReport(this['realtime']);var _0x3c263d=new VoiceCallReport(this[_0x73cb('0xa')]);var _0x36d222=new UserReport(this[_0x73cb('0xa')]);if(config[_0x73cb('0xf')]&&config['xdr'][_0x73cb('0x10')]){ami['on'](_0x73cb('0x11'),this[_0x73cb('0x12')]['bind'](this));ami['on'](_0x73cb('0x13'),this[_0x73cb('0x14')][_0x73cb('0x15')](this));ami['on'](_0x73cb('0x16'),this[_0x73cb('0x17')][_0x73cb('0x15')](this));ami['on'](_0x73cb('0x18'),this['voiceDialReport'][_0x73cb('0x15')](this));ami['on'](_0x73cb('0x19'),this[_0x73cb('0x1a')][_0x73cb('0x15')](this));ami['on'](_0x73cb('0x1b'),this[_0x73cb('0x1c')][_0x73cb('0x15')](this));}};Report[_0x73cb('0xd')][_0x73cb('0x1d')]=function(_0xa08067){var _0x337544;_0x337544=_['find'](this['agents'],function(_0x50457c){return _0x50457c[_0x73cb('0x1e')]==_0xa08067||_0x50457c[_0x73cb('0x1f')]==_0xa08067;});if(_[_0x73cb('0x20')](_0x337544)){var _0x21c3d6=_[_0x73cb('0x21')](this[_0x73cb('0xc')],function(_0x40a7e2){return _0x40a7e2[_0x73cb('0x1e')]==_0xa08067||_0x40a7e2['name']==_0xa08067;});if(_0x21c3d6){_0x337544=_[_0x73cb('0x21')](this[_0x73cb('0xb')],function(_0x7873a9){return _0x7873a9[_0x73cb('0x22')]==util[_0x73cb('0x23')](_0x73cb('0x24'),_0x21c3d6[_0x73cb('0x1f')]);});}}return _0x337544;};Report[_0x73cb('0xd')][_0x73cb('0x12')]=function(_0x220f9f){for(var _0x5a70d6=0x0;_0x5a70d6<_0x220f9f[_0x73cb('0x25')];_0x5a70d6+=0x1){var _0x2f968e=this['findAgent'](_0x220f9f[_0x5a70d6][_0x73cb('0x26')]);if(_0x2f968e){_0x220f9f[_0x5a70d6][_0x73cb('0x1e')]=_0x2f968e['accountcode'];_0x220f9f[_0x5a70d6]['assigned']=!![];_0x220f9f[_0x5a70d6][_0x73cb('0x27')]=_0x2f968e[_0x73cb('0x1f')];_0x220f9f[_0x5a70d6][_0x73cb('0x22')]=_[_0x73cb('0x20')](_0x2f968e[_0x73cb('0x22')])?util[_0x73cb('0x23')](_0x73cb('0x24'),_0x2f968e['name']):_0x2f968e[_0x73cb('0x22')];if(_0x220f9f[_0x5a70d6][_0x73cb('0x28')]){_0x220f9f[_0x5a70d6][_0x73cb('0x29')]=moment()[_0x73cb('0x23')](_0x73cb('0x2a'));}if(_0x220f9f[_0x5a70d6][_0x73cb('0x2b')]){_0x220f9f[_0x5a70d6][_0x73cb('0x2c')]=moment()[_0x73cb('0x23')](_0x73cb('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x220f9f[_0x5a70d6]);}RpcVoiceQueueReport[_0x73cb('0x2d')](_0x220f9f[_0x5a70d6]);}};function extractCalleridNumber(_0x35582e){var _0x278520=_0x35582e['match'](/<(.*?)>/);return _0x278520?_0x278520[0x1]:_0x35582e;}Report['prototype']['getAgentByInternal']=function(_0x51bb02){for(var _0x3945bc=0x0;_0x3945bc0x0?!![]:![];if(!_0x3f1f58){return this['syncQueueSummaryComplete'](this['summary'][_0x1166('0x6d')]);}};VoiceQueueReport['prototype'][_0x1166('0x6e')]=function(_0x5d71db){var _0x4e56d9=this[_0x1166('0x14')]['id'];if(this[_0x1166('0x14')]['queuestatus'][_0x4e56d9]&&this[_0x1166('0x14')][_0x1166('0x62')][_0x4e56d9][_0x5d71db[_0x1166('0x61')]]){this['summary']['queuestatus'][_0x4e56d9][_0x5d71db['actionid']][_0x1166('0x10')]['push'](_0x5d71db);}};VoiceQueueReport[_0x1166('0x36')][_0x1166('0x16')]=function(_0x172a5a){var _0x4a2935=this;try{if(this['isNotNull'](_0x172a5a)&&this['isNotNull'](_0x172a5a['queue'])){logger['debug'](_0x1166('0x6f'),util['inspect'](_0x172a5a,{'showHidden':![],'depth':null}));var _0xc435b2=this[_0x1166('0x12')][_0x172a5a['queue']];if(_0xc435b2){logger[_0x1166('0x70')]('[voiceQueueReport][queuesummary]\x20name:%s',_0xc435b2[_0x1166('0x5a')]);this[_0x1166('0x14')][_0x1166('0x5d')][_0xc435b2[_0x1166('0x5a')]]={'summaryEvent':_0x172a5a};this[_0x1166('0x14')]['statusRequests']+=0x1;return ami[_0x1166('0x3a')]({'action':_0x1166('0x62'),'queue':_0xc435b2[_0x1166('0x5a')]})[_0x1166('0x60')](function(_0xaab1a8){if(!_0x4a2935[_0x1166('0x14')][_0x1166('0x62')][_0x172a5a[_0x1166('0x61')]]){_0x4a2935[_0x1166('0x14')]['queuestatus'][_0x172a5a[_0x1166('0x61')]]={};}_0x4a2935[_0x1166('0x14')][_0x1166('0x62')][_0x172a5a[_0x1166('0x61')]][_0xaab1a8[_0x1166('0x61')]]={'queue':_0xc435b2[_0x1166('0x5a')],'agents':[]};})['catch'](function(_0x3c0701){throw _0x3c0701;});}}}catch(_0x3a5314){logger['error'](_0x1166('0x63'),util[_0x1166('0x42')](_0x3a5314,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1166('0x18')]=function(_0x18758b){if(this['summary'][_0x1166('0x6c')]>0x0){this[_0x1166('0x14')][_0x1166('0x6d')]=_0x18758b;return;}logger[_0x1166('0x4b')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x1166('0x42')](_0x18758b,{'showHidden':![],'depth':null}));this[_0x1166('0x14')]=initializeSummary();ami[_0x1166('0x49')](_0x1166('0x71'),{});};VoiceQueueReport[_0x1166('0x36')][_0x1166('0x1b')]=function(_0xcf4604){try{if(this['isNotNull'](_0xcf4604)){logger[_0x1166('0x4b')](_0x1166('0x72'),_0xcf4604['uniqueid'],util[_0x1166('0x42')](_0xcf4604,{'showHidden':![],'depth':null}));if(_[_0x1166('0x73')](this['queueReports'][_0xcf4604[_0x1166('0x4e')]])){this[_0x1166('0x45')][_0xcf4604[_0x1166('0x4e')]]=[];}if(_[_0x1166('0x73')](this['channels'][_0xcf4604[_0x1166('0x4e')]])){this['channels'][_0xcf4604[_0x1166('0x4e')]]={};}var _0x5187cf=new QueueReport();_0x5187cf[_0x1166('0x55')]=_0xcf4604[_0x1166('0x55')];_0x5187cf['type']=this[_0x1166('0x12')][_0x5187cf[_0x1166('0x55')]]&&this[_0x1166('0x12')][_0x5187cf[_0x1166('0x55')]][_0x1166('0x58')]?this[_0x1166('0x12')][_0x5187cf[_0x1166('0x55')]]['type']||_0x1166('0x74'):_0x1166('0x74');_0x5187cf[_0x1166('0x75')]=moment()[_0x1166('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x5187cf['position']=_0xcf4604[_0x1166('0x76')];_0x5187cf[_0x1166('0x77')]=_0xcf4604['count'];_0x5187cf[_0x1166('0x4e')]=_0xcf4604[_0x1166('0x4e')];_0x5187cf[_0x1166('0x78')]=this[_0x1166('0x11')][_0xcf4604[_0x1166('0x4e')]][_0x1166('0x78')];logger[_0x1166('0x70')](_0x1166('0x79'),_0x5187cf[_0x1166('0x55')],_0x5187cf['type']);_[_0x1166('0x7a')](_0x5187cf,_[_0x1166('0x7b')](_0xcf4604,_['keys'](_0x5187cf)));this['queueReports'][_0xcf4604['uniqueid']][_0x1166('0x7c')](_0x5187cf);this['channels'][_0xcf4604[_0x1166('0x4e')]]=_0x5187cf;this[_0x1166('0x4a')](_0x5187cf,_0x1166('0x7d'));}}catch(_0x52064d){logger[_0x1166('0x40')](_0x1166('0x72'),_0xcf4604['uniqueid'],util['inspect'](_0x52064d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1166('0x36')][_0x1166('0x1d')]=function(_0x4c2b21){try{if(this['isNotNull'](_0x4c2b21)){logger[_0x1166('0x4b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4c2b21[_0x1166('0x4e')],util[_0x1166('0x42')](_0x4c2b21,{'showHidden':![],'depth':null}));if(this[_0x1166('0x45')][_0x4c2b21[_0x1166('0x4e')]]){var _0x192976=_['last'](this['queueReports'][_0x4c2b21['uniqueid']]);_0x192976[_0x1166('0x7e')]=![];_0x192976['queuecallercompleteAt']=null;_0x192976[_0x1166('0x7f')]=_0x4c2b21[_0x1166('0x7f')];_0x192976[_0x1166('0x80')]=_0x4c2b21[_0x1166('0x80')];_0x192976[_0x1166('0x1c')]=!![];_0x192976[_0x1166('0x81')]=moment()[_0x1166('0x4f')](_0x1166('0x82'));_0x192976[_0x1166('0x53')]='ABANDONED';_0x192976[_0x1166('0x83')]=null;logger['info'](_0x1166('0x84'),_0x192976[_0x1166('0x55')],_0x192976['type']);this['channels'][_0x4c2b21[_0x1166('0x4e')]]=_0x192976;this[_0x1166('0x47')](_0x192976,_0x1166('0x1c'));}}}catch(_0xc8391d){logger[_0x1166('0x40')](_0x1166('0x85'),_0x4c2b21['uniqueid'],util[_0x1166('0x42')](_0xc8391d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x1dd3e6){try{if(this['isNotNull'](_0x1dd3e6)){logger['debug'](_0x1166('0x86'),_0x1dd3e6[_0x1166('0x4e')],util[_0x1166('0x42')](_0x1dd3e6,{'showHidden':![],'depth':null}));if(this[_0x1166('0x45')][_0x1dd3e6['uniqueid']]){var _0x545ffd=_['last'](this[_0x1166('0x45')][_0x1dd3e6[_0x1166('0x4e')]]);_0x545ffd[_0x1166('0x87')]=moment()[_0x1166('0x4f')](_0x1166('0x82'));_0x545ffd[_0x1166('0x88')]=_0x1dd3e6[_0x1166('0x88')];_0x545ffd[_0x1166('0x89')]=_0x1dd3e6[_0x1166('0x89')];logger['info'](_0x1166('0x8a'),_0x545ffd[_0x1166('0x55')],_0x545ffd['type'],_0x1dd3e6['connectedlinenum'],_0x1dd3e6['connectedlinename']);this[_0x1166('0x11')][_0x1dd3e6[_0x1166('0x4e')]]=_0x545ffd;this[_0x1166('0x4a')](_0x545ffd,_0x1166('0x8b'));}}}catch(_0x43a253){logger[_0x1166('0x40')](_0x1166('0x86'),_0x1dd3e6['uniqueid'],util[_0x1166('0x42')](_0x43a253,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1166('0x36')][_0x1166('0x21')]=function(_0x12c853){try{if(this[_0x1166('0x5c')](_0x12c853)){logger[_0x1166('0x4b')](_0x1166('0x8c'),_0x12c853[_0x1166('0x4e')],util[_0x1166('0x42')](_0x12c853,{'showHidden':![],'depth':null}));if(this[_0x1166('0x45')][_0x12c853['uniqueid']]){var _0x5137c5=_[_0x1166('0x8d')](this[_0x1166('0x45')][_0x12c853[_0x1166('0x4e')]]);_0x5137c5['queuecallercomplete']=!![];_0x5137c5['queuecallerexitreason']=_0x1166('0x8e');logger[_0x1166('0x70')](_0x1166('0x8f'),_0x5137c5[_0x1166('0x55')],_0x5137c5['type']);}}}catch(_0x34ffaf){logger['error'](_0x1166('0x8c'),_0x12c853[_0x1166('0x4e')],util[_0x1166('0x42')](_0x34ffaf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1166('0x36')][_0x1166('0x1f')]=function(_0x23f86b){try{if(this[_0x1166('0x5c')](_0x23f86b)){logger[_0x1166('0x4b')]('[%s][voiceQueueReport][agentcomplete]',_0x23f86b[_0x1166('0x4e')],util[_0x1166('0x42')](_0x23f86b,{'showHidden':![],'depth':null}));if(this[_0x1166('0x45')][_0x23f86b[_0x1166('0x4e')]]){var _0x456c67=_[_0x1166('0x8d')](this['queueReports'][_0x23f86b[_0x1166('0x4e')]]);_0x456c67['queuecallerabandon']=![];_0x456c67['queuecallerabandonAt']=null;_0x456c67['assigned']=!![];_0x456c67[_0x1166('0x83')]=_0x23f86b['membername'];_0x456c67[_0x1166('0x7f')]=_0x23f86b[_0x1166('0x7f')];_0x456c67[_0x1166('0x7e')]=!![];_0x456c67[_0x1166('0x90')]=![];_0x456c67['queuecallerexitAt']=null;if(!_0x456c67[_0x1166('0x91')]){if(_0x23f86b[_0x1166('0x92')]==_0x1166('0x91')){_0x456c67[_0x1166('0x53')]=_0x1166('0x93');logger[_0x1166('0x70')](_0x1166('0x94'),_0x456c67[_0x1166('0x55')],_0x456c67[_0x1166('0x58')]);}else{if(_[_0x1166('0x95')](_0x23f86b[_0x1166('0x3c')][_0x1166('0x96')](),'local/')){if(this[_0x1166('0x45')][_0x23f86b[_0x1166('0x97')]]){var _0x1c6372=_[_0x1166('0x8d')](this[_0x1166('0x45')][_0x23f86b[_0x1166('0x97')]]);_0x1c6372[_0x1166('0x7e')]=![];_0x1c6372[_0x1166('0x90')]=!![];_0x1c6372['queuecallerexitAt']=moment(_0x456c67[_0x1166('0x75')])[_0x1166('0x98')](_0x23f86b[_0x1166('0x7f')],_0x1166('0x99'))[_0x1166('0x4f')](_0x1166('0x82'));_0x1c6372[_0x1166('0x53')]=_0x1166('0x9a');_0x1c6372[_0x1166('0x91')]=!![];_0x1c6372['transfertype']='FORWARD';_0x1c6372[_0x1166('0x9b')]=_0x23f86b[_0x1166('0x9c')];_0x1c6372[_0x1166('0x9d')]=_0x23f86b[_0x1166('0x4e')];logger[_0x1166('0x70')](_0x1166('0x9e'),_0x1c6372[_0x1166('0x55')],_0x1c6372['type']);var _0x4dfa30=this[_0x1166('0x45')][_0x23f86b[_0x1166('0x97')]];this[_0x1166('0x45')][_0x23f86b[_0x1166('0x97')]]=this[_0x1166('0x45')][_0x23f86b['uniqueid']];this['queueReports'][_0x23f86b['uniqueid']]=_0x4dfa30;}}else{_0x456c67[_0x1166('0x53')]=_0x1166('0x9f')+_0x23f86b[_0x1166('0x92')][_0x1166('0xa0')]();logger[_0x1166('0x70')](_0x1166('0xa1'),_0x456c67[_0x1166('0x55')],_0x456c67[_0x1166('0x58')],_0x456c67[_0x1166('0x53')]);}}}this['channels'][_0x23f86b['uniqueid']]=_0x456c67;}}}catch(_0x1fc5ed){logger[_0x1166('0x40')](_0x1166('0xa2'),_0x23f86b[_0x1166('0x4e')],util[_0x1166('0x42')](_0x1fc5ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1166('0x36')]['syncVarSet']=function(_0x27ff77){try{if(this[_0x1166('0x5c')](_0x27ff77)){logger[_0x1166('0x4b')](_0x1166('0xa3'),_0x27ff77['uniqueid'],util['inspect'](_0x27ff77,{'showHidden':![],'depth':null}));this[_0x1166('0xa4')](_0x27ff77[_0x1166('0x4e')],_['keys'](_0x27ff77[_0x1166('0xa5')])[0x0],_0x27ff77[_0x1166('0xa6')]);if(this[_0x1166('0x45')][_0x27ff77[_0x1166('0x4e')]]){var _0x12409d=_[_0x1166('0x8d')](this[_0x1166('0x45')][_0x27ff77[_0x1166('0x4e')]]);if(_0x12409d){if(this[_0x1166('0x5c')](_0x27ff77[_0x1166('0xa5')])&&this['isNotNull'](_0x27ff77[_0x1166('0xa5')][_0x1166('0x62')])){switch(_0x27ff77[_0x1166('0xa6')]){case _0x1166('0xa7'):_0x12409d[_0x1166('0x90')]=![];_0x12409d[_0x1166('0xa8')]=null;break;case _0x1166('0xa9'):_0x12409d[_0x1166('0xaa')]=_0x1166('0xab');_0x12409d[_0x1166('0x90')]=!![];_0x12409d[_0x1166('0xa8')]=moment()[_0x1166('0x4f')](_0x1166('0x82'));_0x12409d[_0x1166('0x87')]=moment()[_0x1166('0x4f')](_0x1166('0x82'));logger[_0x1166('0x4b')](_0x1166('0xac'),_0x27ff77[_0x1166('0x4e')],util[_0x1166('0x42')](_0x12409d,{'showHidden':![],'depth':null}));ami[_0x1166('0x49')]('custom:timeout',_0x12409d);break;default:_0x12409d['queuecallerexit']=!![];_0x12409d['queuecallerexitAt']=moment()[_0x1166('0x4f')](_0x1166('0x82'));_0x12409d[_0x1166('0x87')]=moment()[_0x1166('0x4f')](_0x1166('0x82'));}_0x12409d[_0x1166('0x1c')]=![];_0x12409d[_0x1166('0x81')]=null;_0x12409d[_0x1166('0x53')]=_0x27ff77[_0x1166('0xa6')];this[_0x1166('0x11')][_0x27ff77[_0x1166('0x4e')]]=_0x12409d;this[_0x1166('0x47')](_0x12409d,_0x1166('0x22'));}else if(this['isNotNull'](_0x27ff77[_0x1166('0xa5')])&&this[_0x1166('0x5c')](_0x27ff77[_0x1166('0xa5')][_0x1166('0xad')])){if(!_0x12409d['queuecallerabandon']){_0x12409d[_0x1166('0x90')]=!![];_0x12409d[_0x1166('0xa8')]=moment()[_0x1166('0x4f')](_0x1166('0x82'));_0x12409d[_0x1166('0x53')]=_0x1166('0xae');_0x12409d[_0x1166('0x87')]=moment()[_0x1166('0x4f')](_0x1166('0x82'));this[_0x1166('0x11')][_0x27ff77[_0x1166('0x4e')]]=_0x12409d;}}logger[_0x1166('0x70')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x27ff77['uniqueid'],_0x12409d[_0x1166('0x55')],_0x12409d[_0x1166('0x58')],_[_0x1166('0xaf')](_0x27ff77[_0x1166('0xa5')])[0x0],_0x27ff77[_0x1166('0xa6')]);_0x12409d[_0x1166('0x43')]=this['variables'][_0x27ff77[_0x1166('0x4e')]];}}}}catch(_0x44b96f){logger[_0x1166('0x40')](_0x1166('0xa3'),_0x27ff77[_0x1166('0x4e')],util[_0x1166('0x42')](_0x44b96f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1166('0x36')][_0x1166('0xa4')]=function(_0x1975fd,_0x6f7f62,_0x12f9f6){var _0x4a3324=['rtpaudioqos','rtpaudioqosbridged',_0x1166('0xb0'),'rtpaudioqosjitterbridged',_0x1166('0xb1'),'rtpaudioqoslossbridged',_0x1166('0xb2'),_0x1166('0xb3'),'sipcallid',_0x1166('0xb4'),_0x1166('0xb5'),_0x1166('0xb6'),_0x1166('0xb7'),_0x1166('0xb8'),_0x1166('0xb9'),'memberlastcall',_0x1166('0xba'),_0x1166('0xbb'),_0x1166('0xbc')];if(!_['isNil'](_0x6f7f62)&&!_[_0x1166('0xbd')](_0x4a3324,_0x6f7f62)){if(_[_0x1166('0x73')](this[_0x1166('0x43')][_0x1975fd])){this[_0x1166('0x43')][_0x1975fd]={};}this['variables'][_0x1975fd][_0x6f7f62]=_0x12f9f6;}};VoiceQueueReport['prototype'][_0x1166('0xbe')]=function(_0x163936,_0x6e6cab,_0x2ccd05){var _0x3e15d2={};for(var _0x3083ec=0x0;_0x3083ec0x0?!![]:![];if(!_0xb754fe){return this[_0xb13d('0x18')](this[_0xb13d('0x13')]['completeEvent']);}};VoiceQueueReport[_0xb13d('0x9')]['syncQueueMember']=function(_0xf75778){var _0x559072=this[_0xb13d('0x13')]['id'];if(this[_0xb13d('0x13')][_0xb13d('0x65')][_0x559072]&&this['summary'][_0xb13d('0x65')][_0x559072][_0xf75778['actionid']]){this[_0xb13d('0x13')][_0xb13d('0x65')][_0x559072][_0xf75778[_0xb13d('0x66')]][_0xb13d('0xf')]['push'](_0xf75778);}};VoiceQueueReport[_0xb13d('0x9')]['syncQueueSummary']=function(_0x3578ba){var _0x238c2a=this;try{if(this['isNotNull'](_0x3578ba)&&this[_0xb13d('0x5f')](_0x3578ba['queue'])){logger[_0xb13d('0x54')](_0xb13d('0x71'),util[_0xb13d('0x44')](_0x3578ba,{'showHidden':![],'depth':null}));var _0x37def3=this[_0xb13d('0x11')][_0x3578ba['queue']];if(_0x37def3){logger[_0xb13d('0x72')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x37def3[_0xb13d('0x69')]);this[_0xb13d('0x13')][_0xb13d('0x68')][_0x37def3[_0xb13d('0x69')]]={'summaryEvent':_0x3578ba};this['summary'][_0xb13d('0x70')]+=0x1;return ami[_0xb13d('0x3e')]({'action':_0xb13d('0x65'),'queue':_0x37def3[_0xb13d('0x69')]})[_0xb13d('0x73')](function(_0x1b3b46){if(!_0x238c2a[_0xb13d('0x13')][_0xb13d('0x65')][_0x3578ba[_0xb13d('0x66')]]){_0x238c2a[_0xb13d('0x13')][_0xb13d('0x65')][_0x3578ba['actionid']]={};}_0x238c2a['summary'][_0xb13d('0x65')][_0x3578ba[_0xb13d('0x66')]][_0x1b3b46['actionid']]={'queue':_0x37def3[_0xb13d('0x69')],'agents':[]};})[_0xb13d('0x41')](function(_0x9b0e7a){throw _0x9b0e7a;});}}}catch(_0x3c1b90){logger[_0xb13d('0x46')](_0xb13d('0x74'),util[_0xb13d('0x44')](_0x3c1b90,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')]['syncQueueSummaryComplete']=function(_0x4fc1c2){if(this[_0xb13d('0x13')][_0xb13d('0x70')]>0x0){this['summary'][_0xb13d('0x75')]=_0x4fc1c2;return;}logger[_0xb13d('0x54')](_0xb13d('0x76'),util[_0xb13d('0x44')](_0x4fc1c2,{'showHidden':![],'depth':null}));this[_0xb13d('0x13')]=initializeSummary();ami[_0xb13d('0x4c')](_0xb13d('0x77'),{});};VoiceQueueReport['prototype'][_0xb13d('0x78')]=function(_0x2fccec){try{if(this['isNotNull'](_0x2fccec)){logger['debug'](_0xb13d('0x79'),_0x2fccec[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x2fccec,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xb13d('0x45')][_0x2fccec[_0xb13d('0x4f')]])){this[_0xb13d('0x45')][_0x2fccec['uniqueid']]=[];}if(_[_0xb13d('0x60')](this[_0xb13d('0x3c')][_0x2fccec[_0xb13d('0x4f')]])){this[_0xb13d('0x3c')][_0x2fccec[_0xb13d('0x4f')]]={};}var _0xa683cb=new QueueReport();_0xa683cb[_0xb13d('0x52')]=_0x2fccec['queue'];_0xa683cb[_0xb13d('0x6e')]=this[_0xb13d('0x11')][_0xa683cb[_0xb13d('0x52')]]&&this['voiceQueues'][_0xa683cb['queue']][_0xb13d('0x6e')]?this['voiceQueues'][_0xa683cb[_0xb13d('0x52')]][_0xb13d('0x6e')]||_0xb13d('0x5c'):_0xb13d('0x5c');_0xa683cb[_0xb13d('0x7a')]=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0xa683cb[_0xb13d('0x7c')]=_0x2fccec['position'];_0xa683cb[_0xb13d('0x7d')]=_0x2fccec['count'];_0xa683cb[_0xb13d('0x4f')]=_0x2fccec['uniqueid'];_0xa683cb[_0xb13d('0x7e')]=this[_0xb13d('0x3c')][_0x2fccec['uniqueid']][_0xb13d('0x7e')];logger[_0xb13d('0x72')](_0xb13d('0x7f'),_0xa683cb[_0xb13d('0x52')],_0xa683cb[_0xb13d('0x6e')]);_['merge'](_0xa683cb,_[_0xb13d('0x80')](_0x2fccec,_['keys'](_0xa683cb)));this[_0xb13d('0x45')][_0x2fccec['uniqueid']][_0xb13d('0x81')](_0xa683cb);this[_0xb13d('0x3c')][_0x2fccec[_0xb13d('0x4f')]]=_0xa683cb;this[_0xb13d('0x4d')](_0xa683cb,_0xb13d('0x82'));}}catch(_0x2837be){logger[_0xb13d('0x46')](_0xb13d('0x79'),_0x2fccec[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x2837be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')][_0xb13d('0x1e')]=function(_0x4820cb){try{if(this[_0xb13d('0x5f')](_0x4820cb)){logger[_0xb13d('0x54')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4820cb[_0xb13d('0x4f')],util['inspect'](_0x4820cb,{'showHidden':![],'depth':null}));if(this[_0xb13d('0x45')][_0x4820cb[_0xb13d('0x4f')]]){var _0x48a143=_[_0xb13d('0x83')](this[_0xb13d('0x45')][_0x4820cb[_0xb13d('0x4f')]]);_0x48a143[_0xb13d('0x84')]=![];_0x48a143['queuecallercompleteAt']=null;_0x48a143[_0xb13d('0x85')]=_0x4820cb[_0xb13d('0x85')];_0x48a143[_0xb13d('0x86')]=_0x4820cb[_0xb13d('0x86')];_0x48a143['queuecallerabandon']=!![];_0x48a143[_0xb13d('0x87')]=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0x48a143[_0xb13d('0x57')]=_0xb13d('0x88');_0x48a143[_0xb13d('0x89')]=null;logger['info'](_0xb13d('0x8a'),_0x48a143['queue'],_0x48a143['type']);this[_0xb13d('0x3c')][_0x4820cb[_0xb13d('0x4f')]]=_0x48a143;this[_0xb13d('0x4a')](_0x48a143,'queuecallerabandon');}}}catch(_0x1e6f1b){logger[_0xb13d('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4820cb[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x1e6f1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')][_0xb13d('0x20')]=function(_0x5ece51){try{if(this[_0xb13d('0x5f')](_0x5ece51)){logger[_0xb13d('0x54')](_0xb13d('0x8b'),_0x5ece51[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x5ece51,{'showHidden':![],'depth':null}));if(this[_0xb13d('0x45')][_0x5ece51['uniqueid']]){var _0x443298=_[_0xb13d('0x83')](this[_0xb13d('0x45')][_0x5ece51[_0xb13d('0x4f')]]);_0x443298[_0xb13d('0x8c')]=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0x443298[_0xb13d('0x8d')]=_0x5ece51['connectedlinenum'];_0x443298['connectedlinename']=_0x5ece51[_0xb13d('0x8e')];logger[_0xb13d('0x72')](_0xb13d('0x8f'),_0x443298[_0xb13d('0x52')],_0x443298['type'],_0x5ece51['connectedlinenum'],_0x5ece51[_0xb13d('0x8e')]);this['channels'][_0x5ece51['uniqueid']]=_0x443298;this[_0xb13d('0x4d')](_0x443298,_0xb13d('0x1f'));}}}catch(_0x469b5a){logger[_0xb13d('0x46')](_0xb13d('0x8b'),_0x5ece51[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x469b5a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')]['syncAgentConnect']=function(_0x4b3e47){try{if(this[_0xb13d('0x5f')](_0x4b3e47)){logger['debug'](_0xb13d('0x90'),_0x4b3e47[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x4b3e47,{'showHidden':![],'depth':null}));if(this[_0xb13d('0x45')][_0x4b3e47[_0xb13d('0x4f')]]){var _0x3b2cdb=_[_0xb13d('0x83')](this[_0xb13d('0x45')][_0x4b3e47[_0xb13d('0x4f')]]);_0x3b2cdb['queuecallercomplete']=!![];_0x3b2cdb['queuecallerexitreason']=_0xb13d('0x91');logger[_0xb13d('0x72')](_0xb13d('0x92'),_0x3b2cdb[_0xb13d('0x52')],_0x3b2cdb[_0xb13d('0x6e')]);}}}catch(_0x4fb42e){logger[_0xb13d('0x46')](_0xb13d('0x90'),_0x4b3e47[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x4fb42e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')][_0xb13d('0x22')]=function(_0x14bd9a){try{if(this[_0xb13d('0x5f')](_0x14bd9a)){logger['debug'](_0xb13d('0x93'),_0x14bd9a['uniqueid'],util[_0xb13d('0x44')](_0x14bd9a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x14bd9a[_0xb13d('0x4f')]]){var _0x38c561=_[_0xb13d('0x83')](this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x4f')]]);_0x38c561[_0xb13d('0x1d')]=![];_0x38c561['queuecallerabandonAt']=null;_0x38c561[_0xb13d('0x94')]=!![];_0x38c561[_0xb13d('0x89')]=_0x14bd9a[_0xb13d('0x95')];_0x38c561['holdtime']=_0x14bd9a['holdtime'];_0x38c561[_0xb13d('0x84')]=!![];_0x38c561[_0xb13d('0x96')]=![];_0x38c561[_0xb13d('0x97')]=null;if(!_0x38c561['transfer']){if(_0x14bd9a['reason']==_0xb13d('0x98')){_0x38c561[_0xb13d('0x57')]='COMPLETED';logger[_0xb13d('0x72')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x38c561[_0xb13d('0x52')],_0x38c561['type']);}else{if(_[_0xb13d('0x99')](_0x14bd9a[_0xb13d('0x40')][_0xb13d('0x9a')](),'local/')){if(this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x9b')]]){var _0x2cf408=_[_0xb13d('0x83')](this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x9b')]]);_0x2cf408[_0xb13d('0x84')]=![];_0x2cf408[_0xb13d('0x96')]=!![];_0x2cf408['queuecallerexitAt']=moment(_0x38c561['queuecallerjoinAt'])[_0xb13d('0x9c')](_0x14bd9a['holdtime'],'seconds')[_0xb13d('0x50')](_0xb13d('0x7b'));_0x2cf408[_0xb13d('0x57')]=_0xb13d('0x9d');_0x2cf408[_0xb13d('0x98')]=!![];_0x2cf408[_0xb13d('0x9e')]='FORWARD';_0x2cf408[_0xb13d('0x9f')]=_0x14bd9a[_0xb13d('0xa0')];_0x2cf408[_0xb13d('0xa1')]=_0x14bd9a[_0xb13d('0x4f')];logger['info'](_0xb13d('0xa2'),_0x2cf408[_0xb13d('0x52')],_0x2cf408[_0xb13d('0x6e')]);var _0x2866ce=this[_0xb13d('0x45')][_0x14bd9a['linkedid']];this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x9b')]]=this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x4f')]];this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x4f')]]=_0x2866ce;}}else{_0x38c561[_0xb13d('0x57')]=_0xb13d('0xa3')+_0x14bd9a['reason'][_0xb13d('0xa4')]();logger[_0xb13d('0x72')](_0xb13d('0xa5'),_0x38c561[_0xb13d('0x52')],_0x38c561[_0xb13d('0x6e')],_0x38c561['queuecallerexitreason']);}}}this[_0xb13d('0x3c')][_0x14bd9a['uniqueid']]=_0x38c561;}}}catch(_0x504254){logger[_0xb13d('0x46')](_0xb13d('0x93'),_0x14bd9a[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x504254,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')][_0xb13d('0x26')]=function(_0x228582){try{if(this[_0xb13d('0x5f')](_0x228582)){logger[_0xb13d('0x54')]('[%s][voiceQueueReport][varset]',_0x228582[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x228582,{'showHidden':![],'depth':null}));this['addVariable'](_0x228582[_0xb13d('0x4f')],_[_0xb13d('0xa6')](_0x228582[_0xb13d('0xa7')])[0x0],_0x228582[_0xb13d('0xa8')]);if(this[_0xb13d('0x45')][_0x228582['uniqueid']]){var _0x5b79a6=_['last'](this[_0xb13d('0x45')][_0x228582[_0xb13d('0x4f')]]);if(_0x5b79a6){if(this[_0xb13d('0x5f')](_0x228582['variable'])&&this[_0xb13d('0x5f')](_0x228582[_0xb13d('0xa7')][_0xb13d('0x65')])){switch(_0x228582[_0xb13d('0xa8')]){case _0xb13d('0xa9'):_0x5b79a6['queuecallerexit']=![];_0x5b79a6[_0xb13d('0x97')]=null;break;case _0xb13d('0xaa'):_0x5b79a6[_0xb13d('0xab')]=_0xb13d('0xac');_0x5b79a6['queuecallerexit']=!![];_0x5b79a6['queuecallerexitAt']=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0x5b79a6[_0xb13d('0x8c')]=moment()['format'](_0xb13d('0x7b'));logger[_0xb13d('0x54')](_0xb13d('0xad'),_0x228582['uniqueid'],util[_0xb13d('0x44')](_0x5b79a6,{'showHidden':![],'depth':null}));ami['emit'](_0xb13d('0xae'),_0x5b79a6);break;default:_0x5b79a6[_0xb13d('0x96')]=!![];_0x5b79a6[_0xb13d('0x97')]=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0x5b79a6['queuecallerleaveAt']=moment()['format'](_0xb13d('0x7b'));}_0x5b79a6['queuecallerabandon']=![];_0x5b79a6['queuecallerabandonAt']=null;_0x5b79a6['queuecallerexitreason']=_0x228582[_0xb13d('0xa8')];this[_0xb13d('0x3c')][_0x228582['uniqueid']]=_0x5b79a6;this[_0xb13d('0x4a')](_0x5b79a6,_0xb13d('0x25'));}else if(this[_0xb13d('0x5f')](_0x228582[_0xb13d('0xa7')])&&this['isNotNull'](_0x228582['variable']['queueposition'])){if(!_0x5b79a6[_0xb13d('0x1d')]){_0x5b79a6[_0xb13d('0x96')]=!![];_0x5b79a6[_0xb13d('0x97')]=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0x5b79a6[_0xb13d('0x57')]=_0xb13d('0xaf');_0x5b79a6['queuecallerleaveAt']=moment()['format'](_0xb13d('0x7b'));this[_0xb13d('0x3c')][_0x228582[_0xb13d('0x4f')]]=_0x5b79a6;}}logger[_0xb13d('0x72')](_0xb13d('0xb0'),_0x228582[_0xb13d('0x4f')],_0x5b79a6[_0xb13d('0x52')],_0x5b79a6['type'],_[_0xb13d('0xa6')](_0x228582[_0xb13d('0xa7')])[0x0],_0x228582[_0xb13d('0xa8')]);_0x5b79a6[_0xb13d('0x14')]=this[_0xb13d('0x14')][_0x228582[_0xb13d('0x4f')]];}}}}catch(_0x458f76){logger[_0xb13d('0x46')]('[%s][voiceQueueReport][varset]',_0x228582['uniqueid'],util[_0xb13d('0x44')](_0x458f76,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb13d('0xb1')]=function(_0x313f4c,_0x571106,_0xf24ddf){var _0x43e9e1=[_0xb13d('0xb2'),_0xb13d('0xb3'),_0xb13d('0xb4'),_0xb13d('0xb5'),_0xb13d('0xb6'),_0xb13d('0xb7'),_0xb13d('0xb8'),_0xb13d('0xb9'),_0xb13d('0xba'),_0xb13d('0xbb'),_0xb13d('0xbc'),'bridgepvtcallid',_0xb13d('0xbd'),'memberdynamic','memberinterface',_0xb13d('0xbe'),_0xb13d('0x95'),_0xb13d('0xbf'),_0xb13d('0xc0')];if(!_[_0xb13d('0xc1')](_0x571106)&&!_[_0xb13d('0xc2')](_0x43e9e1,_0x571106)){if(_[_0xb13d('0x60')](this['variables'][_0x313f4c])){this[_0xb13d('0x14')][_0x313f4c]={};}this['variables'][_0x313f4c][_0x571106]=_0xf24ddf;}};VoiceQueueReport[_0xb13d('0x9')][_0xb13d('0xc3')]=function(_0x3bb992,_0x59b303,_0x4bd980){var _0x137e37={};for(var _0x388262=0x0;_0x388262=0x0?moment(_0x207361[_0xa639('0x17')])[_0xa639('0x9')](_0x207361[_0xa639('0x16')],'seconds'):null,'data1':_0xa639('0x18'),'data2':_0x207361['accountcode'],'data3':_0x207361[_0xa639('0xd')],'data4':_0x207361[_0xa639('0x19')]||null,'role':_0xa639('0x1a'),'internal':_0x207361['accountcode']?_[_0xa639('0xf')](_0x207361['accountcode']):undefined,'uniqueid':_0x207361['uniqueid']},'log':_0xa639('0x11')});}; \ No newline at end of file +var _0x7cf6=['Request','CreateMemberReport','format','SIP/%s','lastAssignedTo','interface','TALKING','diff','queuecallerleaveAt','seconds','inbound','queue','agent','toNumber','accountcode','uniqueid','voiceDialReport','voice','membername','starttime','endtime','exten','dialstring','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt'];(function(_0x86337d,_0x2b57c3){var _0x22b2c6=function(_0x180d16){while(--_0x180d16){_0x86337d['push'](_0x86337d['shift']());}};_0x22b2c6(++_0x2b57c3);}(_0x7cf6,0x11c));var _0x67cf=function(_0xb83a1e,_0x375442){_0xb83a1e=_0xb83a1e-0x0;var _0x582a5b=_0x7cf6[_0xb83a1e];return _0x582a5b;};'use strict';var moment=require(_0x67cf('0x0'));var _=require(_0x67cf('0x1'));var util=require('util');var client=require(_0x67cf('0x2'));exports[_0x67cf('0x3')]=function(_0x20445d){var _0x1d5044=_0x20445d[_0x67cf('0x4')]||_0x20445d[_0x67cf('0x5')];return client[_0x67cf('0x6')](_0x67cf('0x7'),{'body':{'channel':'voice','membername':_0x20445d['lastAssignedTo'],'interface':_['isNil'](_0x20445d['interface'])?util[_0x67cf('0x8')](_0x67cf('0x9'),_0x20445d[_0x67cf('0xa')]):_0x20445d[_0x67cf('0xb')],'type':_0x67cf('0xc'),'enterAt':_0x20445d['queuecallerleaveAt'],'exitAt':_0x1d5044,'duration':moment(_0x1d5044)[_0x67cf('0xd')](_0x20445d[_0x67cf('0xe')],_0x67cf('0xf')),'data1':_0x67cf('0x10'),'data2':_0x20445d['calleridnum'],'data3':_0x20445d['exten'],'data4':null,'data5':_0x20445d[_0x67cf('0x11')],'role':_0x67cf('0x12'),'internal':_0x20445d['accountcode']?_[_0x67cf('0x13')](_0x20445d[_0x67cf('0x14')]):undefined,'uniqueid':_0x20445d[_0x67cf('0x15')]},'log':'CreateMemberReport'});};exports[_0x67cf('0x16')]=function(_0x37ae74){return client['Request'](_0x67cf('0x7'),{'body':{'channel':_0x67cf('0x17'),'membername':_0x37ae74[_0x67cf('0x18')],'interface':_0x37ae74[_0x67cf('0xb')],'type':_0x67cf('0xc'),'enterAt':_0x37ae74[_0x67cf('0x19')],'exitAt':_0x37ae74['endtime'],'duration':moment(_0x37ae74['endtime'])[_0x67cf('0xd')](_0x37ae74[_0x67cf('0x19')],_0x67cf('0xf'))>=0x0?moment(_0x37ae74[_0x67cf('0x1a')])[_0x67cf('0xd')](_0x37ae74['starttime'],'seconds'):null,'data1':'outbound','data2':_0x37ae74[_0x67cf('0x14')],'data3':_0x37ae74[_0x67cf('0x1b')],'data4':_0x37ae74[_0x67cf('0x1c')]||null,'role':'agent','internal':_0x37ae74[_0x67cf('0x14')]?_['toNumber'](_0x37ae74[_0x67cf('0x14')]):undefined,'uniqueid':_0x37ae74[_0x67cf('0x15')]},'log':_0x67cf('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index ef49a03..4496fcd 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 _0xc3b7=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x3c471d,_0x39fc0d){var _0x58b92=function(_0x35ef52){while(--_0x35ef52){_0x3c471d['push'](_0x3c471d['shift']());}};_0x58b92(++_0x39fc0d);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x2c99c6,_0x141321){_0x2c99c6=_0x2c99c6-0x0;var _0x33610f=_0xc3b7[_0x2c99c6];return _0x33610f;};'use strict';var client=require('../client');exports[_0x7c3b('0x0')]=function(){return client[_0x7c3b('0x1')](_0x7c3b('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7c3b('0x3'),_0x7c3b('0x4')]},'log':_0x7c3b('0x5')});}; \ No newline at end of file +var _0x5b1c=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request','ShowSetting'];(function(_0x3226f9,_0x114317){var _0x28ec11=function(_0x3e6f38){while(--_0x3e6f38){_0x3226f9['push'](_0x3226f9['shift']());}};_0x28ec11(++_0x114317);}(_0x5b1c,0x1b9));var _0xc5b1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5b1c[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0xc5b1('0x0'));exports['getSettings']=function(){return client[_0xc5b1('0x1')](_0xc5b1('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc5b1('0x3'),_0xc5b1('0x4')]},'log':_0xc5b1('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index cf28010..d3c2dee 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 _0x0273=['Request','GetTemplate','html','getTemplates'];(function(_0x37f906,_0x3ae89f){var _0x529bbe=function(_0x317c56){while(--_0x317c56){_0x37f906['push'](_0x37f906['shift']());}};_0x529bbe(++_0x3ae89f);}(_0x0273,0x1af));var _0x3027=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0273[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x3027('0x0')]=function(_0x2f76a3){return function(_0x5cf9af){return client[_0x3027('0x1')](_0x3027('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x3027('0x3')]},'log':_0x3027('0x2')});};}; \ No newline at end of file +var _0x50d5=['name','html','../client','GetTemplate'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0x50d5,0x166));var _0x550d=function(_0x2f0b1c,_0x336074){_0x2f0b1c=_0x2f0b1c-0x0;var _0x491ac9=_0x50d5[_0x2f0b1c];return _0x491ac9;};'use strict';var client=require(_0x550d('0x0'));exports['getTemplates']=function(_0x27a5b2){return function(_0x5b4edf){return client['Request'](_0x550d('0x1'),{'options':{'raw':!![],'attributes':['id',_0x550d('0x2'),_0x550d('0x3')]},'log':_0x550d('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c8eeca6..274eb78 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 _0x0cdf=['data3','data4','data5','data7','getTriggers','Request','GetTrigger','channel','Condition','AllConditions','field','value','Actions','action','data1','data2'];(function(_0xe45c3a,_0x183904){var _0x1bc5e8=function(_0x1c084b){while(--_0x1c084b){_0xe45c3a['push'](_0xe45c3a['shift']());}};_0x1bc5e8(++_0x183904);}(_0x0cdf,0x124));var _0xf0cd=function(_0x39fe3f,_0x38b8eb){_0x39fe3f=_0x39fe3f-0x0;var _0x50d483=_0x0cdf[_0x39fe3f];return _0x50d483;};'use strict';var client=require('../client');exports[_0xf0cd('0x0')]=function(_0x278068){return function(_0x11e007){return client[_0xf0cd('0x1')](_0xf0cd('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xf0cd('0x3'),'status'],'include':[{'model':_0xf0cd('0x4'),'as':_0xf0cd('0x5'),'attributes':['id',_0xf0cd('0x6'),'operator','value']},{'model':_0xf0cd('0x4'),'as':'AnyConditions','attributes':['id',_0xf0cd('0x6'),'operator',_0xf0cd('0x7')]},{'model':'Action','as':_0xf0cd('0x8'),'attributes':['id',_0xf0cd('0x9'),_0xf0cd('0xa'),_0xf0cd('0xb'),_0xf0cd('0xc'),_0xf0cd('0xd'),_0xf0cd('0xe'),'data6',_0xf0cd('0xf')]}]},'log':_0xf0cd('0x2')});};}; \ No newline at end of file +var _0xb1c8=['Condition','AllConditions','field','value','AnyConditions','operator','Action','action','data2','data3','data4','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0xb1c8,0x99));var _0x8b1c=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0xb1c8[_0x3a99f4];return _0xea0b42;};'use strict';var client=require(_0x8b1c('0x0'));exports[_0x8b1c('0x1')]=function(_0x3dd41a){return function(_0x2d7fdc){return client[_0x8b1c('0x2')](_0x8b1c('0x3'),{'options':{'raw':![],'attributes':['id',_0x8b1c('0x4'),_0x8b1c('0x5'),_0x8b1c('0x6')],'include':[{'model':_0x8b1c('0x7'),'as':_0x8b1c('0x8'),'attributes':['id',_0x8b1c('0x9'),'operator',_0x8b1c('0xa')]},{'model':_0x8b1c('0x7'),'as':_0x8b1c('0xb'),'attributes':['id',_0x8b1c('0x9'),_0x8b1c('0xc'),_0x8b1c('0xa')]},{'model':_0x8b1c('0xd'),'as':'Actions','attributes':['id',_0x8b1c('0xe'),'data1',_0x8b1c('0xf'),_0x8b1c('0x10'),_0x8b1c('0x11'),'data5',_0x8b1c('0x12'),_0x8b1c('0x13')]}]},'log':_0x8b1c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index a44b4cf..80541c7 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 _0x2227=['Request','name','registry','defaultuser','getTrunks'];(function(_0x32d316,_0x4dc4d0){var _0x4ac3c8=function(_0x55ed1a){while(--_0x55ed1a){_0x32d316['push'](_0x32d316['shift']());}};_0x4ac3c8(++_0x4dc4d0);}(_0x2227,0x103));var _0x7222=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0x2227[_0x58eec7];return _0x25c5d3;};'use strict';var client=require('../client');exports[_0x7222('0x0')]=function(_0x446f63){return function(_0x195491){return client[_0x7222('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7222('0x2'),_0x7222('0x3'),_0x7222('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xfdcb=['Request','GetTrunk','name','../client','getTrunks'];(function(_0x35cc3c,_0x514401){var _0x2ca231=function(_0x5052ce){while(--_0x5052ce){_0x35cc3c['push'](_0x35cc3c['shift']());}};_0x2ca231(++_0x514401);}(_0xfdcb,0x134));var _0xbfdc=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0xfdcb[_0x163691];return _0x543ae5;};'use strict';var client=require(_0xbfdc('0x0'));exports[_0xbfdc('0x1')]=function(_0x28d1bb){return function(_0x443da1){return client[_0xbfdc('0x2')](_0xbfdc('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xbfdc('0x4'),'registry','defaultuser']},'log':_0xbfdc('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 11aaad5..481fbeb 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x1c3e6a,_0x50907c){var _0x22b96b=function(_0xe89f7a){while(--_0xe89f7a){_0x1c3e6a['push'](_0x1c3e6a['shift']());}};_0x22b96b(++_0x50907c);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x2c5b6f,_0xcb883f){var _0x44c49e=function(_0x31c6ae){while(--_0x31c6ae){_0x2c5b6f['push'](_0x2c5b6f['shift']());}};_0x44c49e(++_0xcb883f);}(_0x70e0,0x17b));var _0x070e=function(_0xf661c7,_0x15ef19){_0xf661c7=_0xf661c7-0x0;var _0x323193=_0x70e0[_0xf661c7];return _0x323193;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index d67c16d..457a1a1 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 _0xbc76=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x290507,_0x1b343){var _0x15d699=function(_0x4447b4){while(--_0x4447b4){_0x290507['push'](_0x290507['shift']());}};_0x15d699(++_0x1b343);}(_0xbc76,0x1cc));var _0x6bc7=function(_0x35fe51,_0x2bd43a){_0x35fe51=_0x35fe51-0x0;var _0x282dd5=_0xbc76[_0x35fe51];return _0x282dd5;};'use strict';var client=require('../client');exports[_0x6bc7('0x0')]=function(_0x3c9836){return client[_0x6bc7('0x1')]('CreateVoiceAgentReport',{'body':_0x3c9836,'log':_0x6bc7('0x2')});};exports[_0x6bc7('0x3')]=function(_0x3662be,_0x51e5fe,_0x112694){return client['Request'](_0x6bc7('0x4'),{'body':_0x3662be,'options':{'where':{'uniqueid':_0x51e5fe,'interface':_0x112694,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x9861=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9861,0xd1));var _0x1986=function(_0x1a19b4,_0x43523f){_0x1a19b4=_0x1a19b4-0x0;var _0xe548fb=_0x9861[_0x1a19b4];return _0xe548fb;};'use strict';var client=require('../client');exports[_0x1986('0x0')]=function(_0xb5e90d){return client[_0x1986('0x1')](_0x1986('0x2'),{'body':_0xb5e90d,'log':_0x1986('0x2')});};exports[_0x1986('0x3')]=function(_0x2fdd55,_0xb43e77,_0x44245b){return client[_0x1986('0x1')]('UpdateVoiceAgentReport',{'body':_0x2fdd55,'options':{'where':{'uniqueid':_0xb43e77,'interface':_0x44245b,'agentcomplete':!![]}},'log':_0x1986('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7707a2e..170cbe6 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 _0xf1eb=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','billableseconds','GetVoiceCallReports','moment','util','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','GetVoiceCallReport'];(function(_0x37daef,_0x4e5352){var _0x57cfb6=function(_0x22f357){while(--_0x22f357){_0x37daef['push'](_0x37daef['shift']());}};_0x57cfb6(++_0x4e5352);}(_0xf1eb,0xce));var _0xbf1e=function(_0x483cab,_0x578035){_0x483cab=_0x483cab-0x0;var _0xe1859=_0xf1eb[_0x483cab];return _0xe1859;};'use strict';var moment=require(_0xbf1e('0x0'));var util=require(_0xbf1e('0x1'));var _=require('lodash');var client=require('../client');exports[_0xbf1e('0x2')]=function(_0x315421){return client[_0xbf1e('0x3')](_0xbf1e('0x4'),{'body':_[_0xbf1e('0x5')](_0x315421,{'source':_0x315421[_0xbf1e('0x6')],'destinationcontext':_0x315421['context'],'callerid':_0x315421[_0xbf1e('0x7')],'amaflags':_0xbf1e('0x8')}),'log':_0xbf1e('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xbf1e('0x3')](_0xbf1e('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xbf1e('0xa')](_0xbf1e('0xb'))[_0xbf1e('0xc')](_0xbf1e('0xd')),moment()[_0xbf1e('0xe')](_0xbf1e('0xb'))['format'](_0xbf1e('0xd'))]}},'attributes':[_0xbf1e('0xf'),'disposition','duration',_0xbf1e('0x10')]},'log':_0xbf1e('0x11')});};}; \ No newline at end of file +var _0x847a=['day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','moment','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x35282c,_0x7eba5e){var _0x267b6d=function(_0x441ba2){while(--_0x441ba2){_0x35282c['push'](_0x35282c['shift']());}};_0x267b6d(++_0x7eba5e);}(_0x847a,0x137));var _0xa847=function(_0xf0f6fb,_0x1c3ea1){_0xf0f6fb=_0xf0f6fb-0x0;var _0x122bfa=_0x847a[_0xf0f6fb];return _0x122bfa;};'use strict';var moment=require(_0xa847('0x0'));var util=require('util');var _=require(_0xa847('0x1'));var client=require(_0xa847('0x2'));exports[_0xa847('0x3')]=function(_0x357968){return client[_0xa847('0x4')](_0xa847('0x5'),{'body':_['merge'](_0x357968,{'source':_0x357968[_0xa847('0x6')],'destinationcontext':_0x357968[_0xa847('0x7')],'callerid':_0x357968['callerid'],'amaflags':_0xa847('0x8')}),'log':_0xa847('0x5')});};exports[_0xa847('0x9')]=function(){return function(){return client[_0xa847('0x4')](_0xa847('0xa'),{'options':{'where':{'type':[_0xa847('0xb')],'createdAt':{'$between':[moment()['startOf'](_0xa847('0xc'))[_0xa847('0xd')](_0xa847('0xe')),moment()['endOf']('day')[_0xa847('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xa847('0xf'),_0xa847('0x10'),_0xa847('0x11'),_0xa847('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 147f664..3004394 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 _0xfd4b=['CreateVoiceDialReport','create','Request'];(function(_0x576190,_0x2b5637){var _0x120902=function(_0x327018){while(--_0x327018){_0x576190['push'](_0x576190['shift']());}};_0x120902(++_0x2b5637);}(_0xfd4b,0x10c));var _0xbfd4=function(_0x221459,_0x498c42){_0x221459=_0x221459-0x0;var _0x4ee988=_0xfd4b[_0x221459];return _0x4ee988;};'use strict';var client=require('../client');exports[_0xbfd4('0x0')]=function(_0x19878e){return client[_0xbfd4('0x1')](_0xbfd4('0x2'),{'body':_0x19878e,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x85cf=['../client','create','Request'];(function(_0xa88b45,_0x12160b){var _0x4fdc72=function(_0x5ba09d){while(--_0x5ba09d){_0xa88b45['push'](_0xa88b45['shift']());}};_0x4fdc72(++_0x12160b);}(_0x85cf,0x153));var _0xf85c=function(_0x4ee8be,_0x1c06c6){_0x4ee8be=_0x4ee8be-0x0;var _0x2b6758=_0x85cf[_0x4ee8be];return _0x2b6758;};'use strict';var client=require(_0xf85c('0x0'));exports[_0xf85c('0x1')]=function(_0x533f3f){return client[_0xf85c('0x2')]('CreateVoiceDialReport',{'body':_0x533f3f,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 97548e6..f0e4b9c 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 _0xb58b=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x3dadde,_0x128400){var _0x2454fb=function(_0x45f6de){while(--_0x45f6de){_0x3dadde['push'](_0x3dadde['shift']());}};_0x2454fb(++_0x128400);}(_0xb58b,0x1f1));var _0xbb58=function(_0x1503f0,_0x59c1dc){_0x1503f0=_0x1503f0-0x0;var _0x1424a1=_0xb58b[_0x1503f0];return _0x1424a1;};'use strict';var client=require('../client');exports[_0xbb58('0x0')]=function(){return function(){return client[_0xbb58('0x1')](_0xbb58('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xbb58('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xbb58('0x0')});};}; \ No newline at end of file +var _0x9348=['getVoiceExtensions','Request','GetVoiceExtension','exten','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9348,0x10d));var _0x8934=function(_0x242883,_0x3c8a9d){_0x242883=_0x242883-0x0;var _0x560b46=_0x9348[_0x242883];return _0x560b46;};'use strict';var client=require(_0x8934('0x0'));exports[_0x8934('0x1')]=function(){return function(){return client[_0x8934('0x2')](_0x8934('0x3'),{'options':{'raw':!![],'attributes':['id',_0x8934('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x8934('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index b39cada..22943ac 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 _0x09b2=['dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type'];(function(_0x575ff2,_0x53b37c){var _0x3cf813=function(_0x468db1){while(--_0x468db1){_0x575ff2['push'](_0x575ff2['shift']());}};_0x3cf813(++_0x53b37c);}(_0x09b2,0x150));var _0x209b=function(_0x59e881,_0xdd09a0){_0x59e881=_0x59e881-0x0;var _0x4ca66f=_0x09b2[_0x59e881];return _0x4ca66f;};'use strict';var client=require(_0x209b('0x0'));exports[_0x209b('0x1')]=function(){return function(){return client[_0x209b('0x2')](_0x209b('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x209b('0x4'),_0x209b('0x5'),_0x209b('0x6'),_0x209b('0x7'),_0x209b('0x8'),_0x209b('0x9'),_0x209b('0xa'),_0x209b('0xb'),'dialLimitQueue',_0x209b('0xc'),_0x209b('0xd'),_0x209b('0xe'),'dialPredictiveInterval',_0x209b('0xf'),_0x209b('0x10'),_0x209b('0x11'),_0x209b('0x12'),_0x209b('0x13'),_0x209b('0x14'),_0x209b('0x15'),_0x209b('0x16'),_0x209b('0x17'),_0x209b('0x18'),_0x209b('0x19'),_0x209b('0x1a'),_0x209b('0x1b'),_0x209b('0x1c'),_0x209b('0x1d'),_0x209b('0x1e'),_0x209b('0x1f'),_0x209b('0x20'),_0x209b('0x21'),_0x209b('0x22'),_0x209b('0x23'),_0x209b('0x24'),_0x209b('0x25'),'dialAMDBetweenWordsSilence',_0x209b('0x26'),_0x209b('0x27'),_0x209b('0x28'),'timeout',_0x209b('0x29'),_0x209b('0x2a'),_0x209b('0x2b'),'dialAgiAfterHangupAgent',_0x209b('0x2c'),_0x209b('0x2d'),_0x209b('0x7'),'strategy',_0x209b('0x2e'),_0x209b('0x2f'),_0x209b('0x30'),_0x209b('0x31'),_0x209b('0x32'),'dialDropRetryFrequency',_0x209b('0x33'),_0x209b('0x34'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x209b('0x35'),_0x209b('0x36'),_0x209b('0x37'),_0x209b('0x38'),_0x209b('0x39'),_0x209b('0x3a'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x209b('0x3b'),'as':_0x209b('0x3b'),'attributes':['id',_0x209b('0x3c'),_0x209b('0x3d'),_0x209b('0x3e')]},{'model':_0x209b('0x3f'),'as':_0x209b('0x40'),'attributes':['id',_0x209b('0x3c')]},{'model':_0x209b('0x3b'),'as':_0x209b('0x41'),'attributes':['id',_0x209b('0x3c'),_0x209b('0x3d'),_0x209b('0x3e')]},{'model':_0x209b('0x42'),'as':_0x209b('0x42'),'attributes':['id',_0x209b('0x3c')],'include':[{'model':_0x209b('0x42'),'as':_0x209b('0x43'),'attributes':['id',_0x209b('0x3c'),_0x209b('0x44')]}]}]},'log':_0x209b('0x1')});};}; \ No newline at end of file +var _0x0c3b=['dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0c3b,0x10b));var _0xb0c3=function(_0x351909,_0x1c723b){_0x351909=_0x351909-0x0;var _0xb70af9=_0x0c3b[_0x351909];return _0xb70af9;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0xb0c3('0x0')](_0xb0c3('0x1'),{'options':{'raw':![],'attributes':['id',_0xb0c3('0x2'),_0xb0c3('0x3'),_0xb0c3('0x4'),_0xb0c3('0x5'),_0xb0c3('0x6'),_0xb0c3('0x7'),_0xb0c3('0x8'),'dialMethod',_0xb0c3('0x9'),_0xb0c3('0xa'),_0xb0c3('0xb'),_0xb0c3('0xc'),'dialPredictiveOptimizationPercentage',_0xb0c3('0xd'),_0xb0c3('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xb0c3('0xf'),_0xb0c3('0x10'),_0xb0c3('0x11'),_0xb0c3('0x12'),_0xb0c3('0x13'),'dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xb0c3('0x14'),'dialGlobalMaxRetry',_0xb0c3('0x15'),_0xb0c3('0x16'),_0xb0c3('0x17'),_0xb0c3('0x18'),_0xb0c3('0x19'),_0xb0c3('0x1a'),_0xb0c3('0x1b'),_0xb0c3('0x1c'),_0xb0c3('0x1d'),_0xb0c3('0x1e'),_0xb0c3('0x1f'),_0xb0c3('0x20'),_0xb0c3('0x21'),_0xb0c3('0x22'),_0xb0c3('0x23'),_0xb0c3('0x24'),'dialRecallInQueue',_0xb0c3('0x25'),_0xb0c3('0x26'),_0xb0c3('0x27'),_0xb0c3('0x28'),_0xb0c3('0x6'),_0xb0c3('0x29'),'dialRandomLastDigitCallerIdNumber',_0xb0c3('0x2a'),_0xb0c3('0x2b'),'dialNoSuchNumberRetryFrequency',_0xb0c3('0x2c'),_0xb0c3('0x2d'),_0xb0c3('0x2e'),_0xb0c3('0x2f'),_0xb0c3('0x30'),_0xb0c3('0x31'),_0xb0c3('0x32'),_0xb0c3('0x33'),_0xb0c3('0x34'),'dialPredictiveIntervalMaxThreshold',_0xb0c3('0x35'),_0xb0c3('0x36'),_0xb0c3('0x37')],'include':[{'model':'Trunk','as':_0xb0c3('0x38'),'attributes':['id',_0xb0c3('0x2'),_0xb0c3('0x39'),_0xb0c3('0x3a')]},{'model':_0xb0c3('0x3b'),'as':_0xb0c3('0x3c'),'attributes':['id',_0xb0c3('0x2')]},{'model':_0xb0c3('0x38'),'as':'TrunkBackup','attributes':['id',_0xb0c3('0x2'),_0xb0c3('0x39'),'active']},{'model':_0xb0c3('0x3d'),'as':_0xb0c3('0x3d'),'attributes':['id',_0xb0c3('0x2')],'include':[{'model':_0xb0c3('0x3d'),'as':_0xb0c3('0x3e'),'attributes':['id',_0xb0c3('0x2'),'interval']}]}]},'log':_0xb0c3('0x3f')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 3ecc728..1cdb669 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(_0x2e55eb,_0x3c90b1){var _0x4d033d=function(_0x58d5cc){while(--_0x58d5cc){_0x2e55eb['push'](_0x2e55eb['shift']());}};_0x4d033d(++_0x3c90b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x35752a,_0x20a551){var _0x333bd4=function(_0x4c1554){while(--_0x4c1554){_0x35752a['push'](_0x35752a['shift']());}};_0x333bd4(++_0x20a551);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 de7409d..173c29c 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 _0x6c0e=['getVoiceQueueRtPauses','Request','../client'];(function(_0x54f92b,_0x40bfa1){var _0x50f4fa=function(_0x4cdc53){while(--_0x4cdc53){_0x54f92b['push'](_0x54f92b['shift']());}};_0x50f4fa(++_0x40bfa1);}(_0x6c0e,0x101));var _0xe6c0=function(_0x549422,_0x32e69a){_0x549422=_0x549422-0x0;var _0x8d20e2=_0x6c0e[_0x549422];return _0x8d20e2;};'use strict';var client=require(_0xe6c0('0x0'));exports[_0xe6c0('0x1')]=function(_0xd7b2b5){return function(){return client[_0xe6c0('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0xd7b2b5,'paused':!![]},'raw':!![]},'log':_0xe6c0('0x1')});};}; \ No newline at end of file +var _0xf434=['getVoiceQueueRtPauses','Request','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf434,0x10d));var _0x4f43=function(_0x1ef708,_0x15ef44){_0x1ef708=_0x1ef708-0x0;var _0x517c62=_0xf434[_0x1ef708];return _0x517c62;};'use strict';var client=require(_0x4f43('0x0'));exports[_0x4f43('0x1')]=function(_0x59574f){return function(){return client[_0x4f43('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x59574f,'paused':!![]},'raw':!![]},'log':_0x4f43('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 24da97b..58c2dd2 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x508804,_0x30eb17){var _0x24b96b=function(_0xe08252){while(--_0xe08252){_0x508804['push'](_0x508804['shift']());}};_0x24b96b(++_0x30eb17);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2e6475,_0x51725e){var _0x330757=function(_0x259257){while(--_0x259257){_0x2e6475['push'](_0x2e6475['shift']());}};_0x330757(++_0x51725e);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 872f636..dbf84ea 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 _0x3358=['Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer'];(function(_0x5273eb,_0x56b67a){var _0x155970=function(_0x1b66fe){while(--_0x1b66fe){_0x5273eb['push'](_0x5273eb['shift']());}};_0x155970(++_0x56b67a);}(_0x3358,0x72));var _0x8335=function(_0x3568a2,_0x420aa7){_0x3568a2=_0x3568a2-0x0;var _0x44baaf=_0x3358[_0x3568a2];return _0x44baaf;};'use strict';var client=require(_0x8335('0x0'));exports[_0x8335('0x1')]={};exports[_0x8335('0x2')]=function(_0x10897e){return client[_0x8335('0x3')](_0x8335('0x4'),{'body':{'result':_0x10897e[_0x8335('0x5')],'transfererchannel':_0x10897e[_0x8335('0x6')],'transferercalleridnum':_0x10897e[_0x8335('0x7')],'transferercalleridname':_0x10897e[_0x8335('0x8')],'transfererconnectedlinenum':_0x10897e['transfererconnectedlinenum'],'transfererconnectedlinename':_0x10897e[_0x8335('0x9')],'transfereraccountcode':_0x10897e[_0x8335('0xa')],'transferercontext':_0x10897e['transferercontext'],'transfererexten':_0x10897e[_0x8335('0xb')],'transfererlinkedid':_0x10897e[_0x8335('0xc')],'transfereechannel':_0x10897e[_0x8335('0xd')],'transfereecalleridnum':_0x10897e[_0x8335('0xe')],'transfereecalleridname':_0x10897e['transfereecalleridname'],'transfereeconnectedlinenum':_0x10897e[_0x8335('0xf')],'transfereeconnectedlinename':_0x10897e[_0x8335('0x10')],'transfereeaccountcode':_0x10897e[_0x8335('0x11')],'transfereecontext':_0x10897e['transfereecontext'],'transfereeexten':_0x10897e[_0x8335('0x12')],'transfereelinkedid':_0x10897e[_0x8335('0x13')],'isexternal':_0x10897e['isexternal'],'context':_0x10897e['context'],'extension':_0x10897e[_0x8335('0x14')],'type':_0x8335('0x15')},'log':_0x8335('0x4')});};exports[_0x8335('0x16')]=function(_0x92b6af){return client[_0x8335('0x3')](_0x8335('0x4'),{'body':{'result':_0x92b6af['result'],'transfererchannel':_0x92b6af[_0x8335('0x17')],'transferercalleridnum':_0x92b6af[_0x8335('0x18')],'transferercalleridname':_0x92b6af['origtransferercalleridname'],'transfererconnectedlinenum':_0x92b6af['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x92b6af[_0x8335('0x19')],'transfereraccountcode':_0x92b6af[_0x8335('0x1a')],'transferercontext':_0x92b6af['secondtransferercontext'],'transfererexten':_0x92b6af[_0x8335('0x1b')],'transfererlinkedid':_0x92b6af[_0x8335('0x1c')],'transfereechannel':_0x92b6af[_0x8335('0x1d')],'transfereecalleridnum':_0x92b6af[_0x8335('0x1e')],'transfereecalleridname':_0x92b6af['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x92b6af['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x92b6af[_0x8335('0x1f')],'transfereeaccountcode':_0x92b6af[_0x8335('0x20')],'transfereecontext':_0x92b6af[_0x8335('0x21')],'transfereeexten':_0x92b6af[_0x8335('0x22')],'transfereelinkedid':_0x92b6af[_0x8335('0x23')],'isexternal':_0x92b6af['isexternal'],'context':_0x92b6af[_0x8335('0x24')],'extension':_0x92b6af[_0x8335('0x25')],'type':_0x8335('0x26')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x689c=['attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x689c,0x1b3));var _0xc689=function(_0x2157de,_0x10347c){_0x2157de=_0x2157de-0x0;var _0x35f6e5=_0x689c[_0x2157de];return _0x35f6e5;};'use strict';var client=require(_0xc689('0x0'));exports[_0xc689('0x1')]={};exports[_0xc689('0x2')]=function(_0x303876){return client[_0xc689('0x3')](_0xc689('0x4'),{'body':{'result':_0x303876[_0xc689('0x5')],'transfererchannel':_0x303876[_0xc689('0x6')],'transferercalleridnum':_0x303876[_0xc689('0x7')],'transferercalleridname':_0x303876[_0xc689('0x8')],'transfererconnectedlinenum':_0x303876[_0xc689('0x9')],'transfererconnectedlinename':_0x303876['transfererconnectedlinename'],'transfereraccountcode':_0x303876[_0xc689('0xa')],'transferercontext':_0x303876['transferercontext'],'transfererexten':_0x303876[_0xc689('0xb')],'transfererlinkedid':_0x303876[_0xc689('0xc')],'transfereechannel':_0x303876[_0xc689('0xd')],'transfereecalleridnum':_0x303876[_0xc689('0xe')],'transfereecalleridname':_0x303876[_0xc689('0xf')],'transfereeconnectedlinenum':_0x303876[_0xc689('0x10')],'transfereeconnectedlinename':_0x303876[_0xc689('0x11')],'transfereeaccountcode':_0x303876[_0xc689('0x12')],'transfereecontext':_0x303876[_0xc689('0x13')],'transfereeexten':_0x303876[_0xc689('0x14')],'transfereelinkedid':_0x303876[_0xc689('0x15')],'isexternal':_0x303876[_0xc689('0x16')],'context':_0x303876[_0xc689('0x17')],'extension':_0x303876[_0xc689('0x18')],'type':'blind'},'log':_0xc689('0x4')});};exports[_0xc689('0x19')]=function(_0x10d8c3){return client[_0xc689('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x10d8c3['result'],'transfererchannel':_0x10d8c3[_0xc689('0x1a')],'transferercalleridnum':_0x10d8c3[_0xc689('0x1b')],'transferercalleridname':_0x10d8c3[_0xc689('0x1c')],'transfererconnectedlinenum':_0x10d8c3[_0xc689('0x1d')],'transfererconnectedlinename':_0x10d8c3[_0xc689('0x1e')],'transfereraccountcode':_0x10d8c3[_0xc689('0x1f')],'transferercontext':_0x10d8c3[_0xc689('0x20')],'transfererexten':_0x10d8c3[_0xc689('0x21')],'transfererlinkedid':_0x10d8c3['origtransfererlinkedid'],'transfereechannel':_0x10d8c3[_0xc689('0x22')],'transfereecalleridnum':_0x10d8c3[_0xc689('0x23')],'transfereecalleridname':_0x10d8c3[_0xc689('0x24')],'transfereeconnectedlinenum':_0x10d8c3[_0xc689('0x25')],'transfereeconnectedlinename':_0x10d8c3[_0xc689('0x26')],'transfereeaccountcode':_0x10d8c3[_0xc689('0x27')],'transfereecontext':_0x10d8c3[_0xc689('0x28')],'transfereeexten':_0x10d8c3[_0xc689('0x29')],'transfereelinkedid':_0x10d8c3[_0xc689('0x2a')],'isexternal':_0x10d8c3[_0xc689('0x16')],'context':_0x10d8c3[_0xc689('0x2b')],'extension':_0x10d8c3[_0xc689('0x2c')],'type':_0xc689('0x2d')},'log':_0xc689('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1aef70f..3c81311 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 _0xb4c7=['emit','custom:','event','faxAccounts','send','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','reload','module','action','Action','then','message','command','Command','content','catch','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','count','rows','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','exten','context','agents','telephones','campaigns','run','Event\x20name\x20mandatory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x525d20,_0x215fa8){_0x525d20=_0x525d20-0x0;var _0x3c0981=_0xb4c7[_0x525d20];return _0x3c0981;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var jayson=require(_0x7b4c('0x2'));var schema=require(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var config=require('../../../config/environment');var properties=require(_0x7b4c('0x5'));var ami=require(_0x7b4c('0x6'));var VoiceQueueSummary=require(_0x7b4c('0x7'));exports[_0x7b4c('0x8')]=function(_0x2d9945,_0x5adec9,_0x1b0f57){return new Promise(function(_0x10e197,_0x2dd5c7){var _0x4bf85d={'QueuePause':function(_0x2d7b7e){return new Promise(function(_0x21687f){var _0x570daa=util[_0x7b4c('0x9')](_0x7b4c('0xa'),_0x7b4c('0xb'),_0x2d7b7e[_0x7b4c('0xc')]);if(_0x2d9945[_0x7b4c('0xd')]&&_0x2d9945[_0x7b4c('0xd')][_0x570daa]&&_0x2d9945[_0x7b4c('0xd')][_0x570daa][_0x7b4c('0xe')]){_0x2d9945[_0x7b4c('0xd')][_0x570daa][_0x7b4c('0xf')]();}if(_0x2d9945['agents'][_0x570daa]){_0x2d9945['agents'][_0x570daa][_0x7b4c('0x10')]({'statePause':_0x2d7b7e[_0x7b4c('0x11')]?!![]:![]});}_0x21687f({'code':0xc8,'message':_0x7b4c('0x12')});});},'Reload':function(_0x1722ad){var _0x3e1558=this;return new Promise(function(_0x341d36,_0x3ea0da){if(ami[_0x7b4c('0x13')]()==![]){return _0x3ea0da(_0x3e1558[_0x7b4c('0x14')](0x1f4,[config[_0x7b4c('0x15')]['ip'],config['asterisk'][_0x7b4c('0x16')],_0x7b4c('0x17')][_0x7b4c('0x18')]('\x20')));}_0x1722ad=_[_0x7b4c('0x19')](_0x1722ad,_[_0x7b4c('0x1a')](properties[_0x7b4c('0x1b')][_0x7b4c('0x1c')]));_0x1722ad[_0x7b4c('0x1d')]='Reload';return ami[_0x7b4c('0x1e')](_0x1722ad)[_0x7b4c('0x1f')](function(_0x15a5a9){_0x341d36({'code':0xc8,'message':_0x15a5a9[_0x7b4c('0x20')]});})['catch'](function(_0x3ce10c){_0x3ea0da(_0x3e1558[_0x7b4c('0x14')](0x1f5,_0x3ce10c[_0x7b4c('0x20')]));});});},'Command':function(_0x380b79){var _0x2d4c72=this;return new Promise(function(_0x1363b4,_0x237110){if(ami[_0x7b4c('0x13')]()==![]){return _0x237110(_0x2d4c72[_0x7b4c('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x7b4c('0x15')][_0x7b4c('0x16')],_0x7b4c('0x17')][_0x7b4c('0x18')]('\x20')));}_0x380b79=_[_0x7b4c('0x19')](_0x380b79,_0x7b4c('0x21'));_0x380b79[_0x7b4c('0x1d')]=_0x7b4c('0x22');return ami[_0x7b4c('0x1e')](_0x380b79)[_0x7b4c('0x1f')](function(_0x5eec1e){_0x1363b4({'code':0xc8,'message':_0x5eec1e[_0x7b4c('0x23')]});})[_0x7b4c('0x24')](function(_0x276271){_0x237110(_0x2d4c72[_0x7b4c('0x14')](0x1f5,_0x276271[_0x7b4c('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x2bdc4d){var _0x37c059=[];for(var _0x459eb4 in _0x2d9945[_0x7b4c('0x25')]){if(_0x2d9945[_0x7b4c('0x25')][_0x7b4c('0x26')](_0x459eb4)){var _0x257da2=_0x2d9945[_0x7b4c('0x25')][_0x459eb4];var _0x501f75=new VoiceQueueSummary(_0x257da2);_0x37c059[_0x7b4c('0x27')](_0x501f75);}}_0x2bdc4d({'count':_0x37c059[_0x7b4c('0x28')],'rows':_0x37c059});});},'UpdateVoiceQueue':function(_0x1fe0f5){return new Promise(function(_0x3671c4,_0x207c2f){var _0x4ce02c=_[_0x7b4c('0x29')](_0x2d9945[_0x7b4c('0x25')],{'id':parseInt(_0x1fe0f5['id'])});var _0x3e4a46=_[_0x7b4c('0x2a')](_0x1fe0f5,['id']);if(_0x4ce02c){for(var _0x3585cd in _0x3e4a46){if(typeof _0x3e4a46[_0x3585cd]!==_0x7b4c('0x2b')&&typeof _0x4ce02c[_0x3585cd]!==_0x7b4c('0x2b')){_0x4ce02c[_0x3585cd]=_0x3e4a46[_0x3585cd];}}_0x3671c4(_0x4ce02c);}else{_0x207c2f();}});},'VoiceChannels':function(){return new Promise(function(_0x3c7eb3){var _0x435543=_[_0x7b4c('0x2c')](_0x2d9945[_0x7b4c('0x2d')]);_0x3c7eb3({'count':_0x435543[_0x7b4c('0x28')],'rows':_0x435543});});},'VoiceChannelMixMonitor':function(_0x9d3d31){var _0x4f0d33=this;return new Promise(function(_0x59874f,_0x511f21){if(ami[_0x7b4c('0x13')]()==![]){return _0x511f21(_0x4f0d33[_0x7b4c('0x14')](0x1f4,[config[_0x7b4c('0x15')]['ip'],config[_0x7b4c('0x15')]['username'],_0x7b4c('0x17')][_0x7b4c('0x18')]('\x20')));}var _0x5d728b=schema(properties[_0x7b4c('0x2e')])['validate'](_0x9d3d31);if(_0x5d728b[_0x7b4c('0x28')]>0x0){return _0x511f21(_0x4f0d33[_0x7b4c('0x14')](0x1f4,_[_0x7b4c('0x2f')](_0x5d728b,'message')[_0x7b4c('0x18')](',\x20')));}var _0x1b9e6c=_['find'](_0x2d9945[_0x7b4c('0x2d')],{'uniqueid':_0x9d3d31[_0x7b4c('0x30')]});if(_0x1b9e6c&&_0x1b9e6c[_0x7b4c('0x31')]){var _0x2e0835=util['format']('%s.%s',_0x9d3d31[_0x7b4c('0x32')]||_0x9d3d31[_0x7b4c('0x30')],_0x9d3d31['format']||_0x7b4c('0x33'));return ami['Action']({'action':'MixMonitor','channel':_0x1b9e6c[_0x7b4c('0x31')],'file':_0x2e0835,'options':_0x7b4c('0x34')})[_0x7b4c('0x1f')](function(_0x250901){var _0x5ba56a=_[_0x7b4c('0x29')](_0x1b9e6c[_0x7b4c('0x35')],{'filename':_0x7b4c('0x36')+_0x2e0835[_0x7b4c('0x37')]()});if(_[_0x7b4c('0x38')](_0x5ba56a)){_0x1b9e6c[_0x7b4c('0x35')][_0x7b4c('0x27')]({'filename':'/var/spool/asterisk/monitor/'+_0x2e0835['toLowerCase'](),'createdAt':moment()[_0x7b4c('0x9')](_0x7b4c('0x39')),'mixmonitorid':_0x250901[_0x7b4c('0x3a')],'status':_0x7b4c('0x3b')});}else{_0x5ba56a[_0x7b4c('0x3a')]=_0x250901['mixmonitorid'];_0x5ba56a[_0x7b4c('0x3c')]=_0x7b4c('0x3b');}_0x59874f({'code':0xc8,'message':[_0x9d3d31[_0x7b4c('0x30')],_0x7b4c('0x3d'),_0x250901[_0x7b4c('0x3a')]][_0x7b4c('0x18')]('\x20'),'mixmonitorid':_0x250901[_0x7b4c('0x3a')]});})[_0x7b4c('0x24')](function(_0x3d8126){_0x511f21(_0x4f0d33['error'](0x1f5,[_0x9d3d31[_0x7b4c('0x30')],_0x3d8126['message'][_0x7b4c('0x37')]()]['join']('\x20')));});}else{return _0x511f21(_0x4f0d33[_0x7b4c('0x14')](0x1f5,_0x7b4c('0x3e')));}});},'VoiceChannelStopMixMonitor':function(_0x5bb6d0){var _0x50f2ed=this;return new Promise(function(_0x354578,_0x4314b6){if(ami[_0x7b4c('0x13')]()==![]){return _0x4314b6(_0x50f2ed[_0x7b4c('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x7b4c('0x15')][_0x7b4c('0x16')],_0x7b4c('0x17')]['join']('\x20')));}var _0x45ad59=schema(properties['voicechannel'])['validate'](_0x5bb6d0);if(_0x45ad59[_0x7b4c('0x28')]>0x0){return _0x4314b6(_0x50f2ed['error'](0x1f4,_[_0x7b4c('0x2f')](_0x45ad59,_0x7b4c('0x20'))[_0x7b4c('0x18')](',\x20')));}var _0x301935=_[_0x7b4c('0x29')](_0x2d9945[_0x7b4c('0x2d')],{'uniqueid':_0x5bb6d0[_0x7b4c('0x30')]});if(_0x301935){return Promise[_0x7b4c('0x3f')]()[_0x7b4c('0x1f')](function(){if(_0x301935['channel']){return ami[_0x7b4c('0x1e')]({'action':'StopMixMonitor','channel':_0x301935['channel'],'mixmonitorid':_0x5bb6d0[_0x7b4c('0x3a')]})[_0x7b4c('0x24')](function(){});}})['then'](function(){if(_0x301935['destinationchannel']){return ami[_0x7b4c('0x1e')]({'action':_0x7b4c('0x40'),'channel':_0x301935[_0x7b4c('0x41')],'mixmonitorid':_0x5bb6d0[_0x7b4c('0x3a')]})[_0x7b4c('0x24')](function(){});}})[_0x7b4c('0x1f')](function(){var _0x336796=_[_0x7b4c('0x29')](_0x301935['monitors'],{'mixmonitorid':_0x5bb6d0[_0x7b4c('0x3a')]});if(_0x336796){_0x336796[_0x7b4c('0x3c')]=_0x7b4c('0x42');}})[_0x7b4c('0x1f')](function(){var _0xc76435=util[_0x7b4c('0x9')](_0x7b4c('0x43'),_0x5bb6d0[_0x7b4c('0x32')]||_0x5bb6d0[_0x7b4c('0x30')],_0x5bb6d0['format']||'wav');var _0x1884a4=_[_0x7b4c('0x29')](_0x301935[_0x7b4c('0x35')],{'filename':'/var/spool/asterisk/monitor/'+_0xc76435[_0x7b4c('0x37')]()});if(_0x1884a4){_0x1884a4[_0x7b4c('0x3c')]='stop';}})[_0x7b4c('0x1f')](function(){_0x354578({'code':0xc8,'message':[_0x5bb6d0['uniqueid'],_0x7b4c('0x44')]['join']('\x20')});})[_0x7b4c('0x24')](function(_0x53a7c0){_0x4314b6(_0x50f2ed[_0x7b4c('0x14')](0x1f5,[_0x5bb6d0[_0x7b4c('0x30')],_0x53a7c0['message']['toLowerCase']()][_0x7b4c('0x18')]('\x20')));});}else{return _0x4314b6(_0x50f2ed[_0x7b4c('0x14')](0x1f5,_0x7b4c('0x3e')));}});},'VoiceQueuesChannels':function(_0x4fd536){var _0x56233b=this;return new Promise(function(_0x2fc5b5){var _0x1c118a=_['values'](_0x2d9945['queueChannels']);var _0x14bf3f={'count':_0x1c118a[_0x7b4c('0x28')],'rows':_0x1c118a};if(_0x4fd536&&_0x4fd536[_0x7b4c('0x45')]){if(!['inbound',_0x7b4c('0x46')][_0x7b4c('0x47')](_0x4fd536['type'])){return _0x2dd5c7(_0x56233b['error'](0x190,_0x7b4c('0x48')));}var _0x4d8491=_['filter'](_0x1c118a,function(_0xeefd36){return _0xeefd36['type']===_0x4fd536['type'];});_0x14bf3f[_0x7b4c('0x49')]=_0x4d8491[_0x7b4c('0x28')];_0x14bf3f[_0x7b4c('0x4a')]=_0x4d8491;}_0x2fc5b5(_0x14bf3f);});},'VoiceQueuesChannel':function(_0x17af17){var _0x4895dd=this;return new Promise(function(_0x4946bb,_0xc9a255){var _0x6c226d=schema(properties[_0x7b4c('0x4b')])['validate'](_0x17af17);if(_0x6c226d[_0x7b4c('0x28')]>0x0){return _0xc9a255(_0x4895dd[_0x7b4c('0x14')](0x1f4,_[_0x7b4c('0x2f')](_0x6c226d,'message')[_0x7b4c('0x18')](',\x20')));}var _0x366102=_['find'](_0x2d9945[_0x7b4c('0x4c')],{'uniqueid':_0x17af17[_0x7b4c('0x30')]});if(_0x366102){_0x4946bb(_0x366102);}else{return _0xc9a255(_0x4895dd[_0x7b4c('0x14')](0x1f5,_0x7b4c('0x3e')));}});},'VoiceQueuesChannelHangup':function(_0x381232){var _0x254aeb=this;return new Promise(function(_0x1a1718,_0x58b77c){if(ami[_0x7b4c('0x13')]()==![]){return _0x58b77c(_0x254aeb[_0x7b4c('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x7b4c('0x15')][_0x7b4c('0x16')],_0x7b4c('0x17')][_0x7b4c('0x18')]('\x20')));}var _0x596efc=schema(properties[_0x7b4c('0x4d')])['validate'](_0x381232);if(_0x596efc['length']>0x0){return _0x58b77c(_0x254aeb[_0x7b4c('0x14')](0x1f4,_[_0x7b4c('0x2f')](_0x596efc,_0x7b4c('0x20'))[_0x7b4c('0x18')](',\x20')));}var _0x6956f7=_['find'](_0x2d9945['queueChannels'],{'uniqueid':_0x381232[_0x7b4c('0x30')]});if(_0x6956f7&&_0x6956f7[_0x7b4c('0x31')]){return ami[_0x7b4c('0x1e')]({'action':'Hangup','channel':_0x6956f7[_0x7b4c('0x31')]})[_0x7b4c('0x1f')](function(_0x36fc5d){_0x1a1718({'code':0xc8,'message':[_0x381232['uniqueid'],_0x36fc5d[_0x7b4c('0x20')][_0x7b4c('0x37')]()][_0x7b4c('0x18')]('\x20')});})['catch'](function(_0x257e56){_0x58b77c(_0x254aeb[_0x7b4c('0x14')](0x1f5,[_0x381232['uniqueid'],_0x257e56[_0x7b4c('0x20')]['toLowerCase']()][_0x7b4c('0x18')]('\x20')));});}else{return _0x58b77c(_0x254aeb[_0x7b4c('0x14')](0x1f5,_0x7b4c('0x3e')));}});},'VoiceQueuesChannelRedirect':function(_0x5d123a){var _0x5af2af=this;return new Promise(function(_0x237921,_0x401c4b){if(ami[_0x7b4c('0x13')]()==![]){return _0x401c4b(_0x5af2af['error'](0x1f4,[config[_0x7b4c('0x15')]['ip'],config['asterisk'][_0x7b4c('0x16')],_0x7b4c('0x17')][_0x7b4c('0x18')]('\x20')));}var _0x5f3ed5=schema(properties[_0x7b4c('0x4e')])['validate'](_0x5d123a);if(_0x5f3ed5[_0x7b4c('0x28')]>0x0){return _0x401c4b(_0x5af2af[_0x7b4c('0x14')](0x1f4,_['map'](_0x5f3ed5,_0x7b4c('0x20'))[_0x7b4c('0x18')](',\x20')));}var _0x41a321=_[_0x7b4c('0x29')](_0x2d9945[_0x7b4c('0x4c')],{'uniqueid':_0x5d123a[_0x7b4c('0x30')]});if(_0x41a321&&_0x41a321[_0x7b4c('0x31')]){return ami[_0x7b4c('0x1e')]({'action':'Redirect','channel':_0x41a321[_0x7b4c('0x31')],'exten':_0x5d123a[_0x7b4c('0x4f')],'context':_0x5d123a[_0x7b4c('0x50')]||_0x41a321[_0x7b4c('0x50')],'priority':0x1})[_0x7b4c('0x1f')](function(_0x3cbf32){_0x237921({'code':0xc8,'message':[_0x5d123a[_0x7b4c('0x30')],_0x3cbf32[_0x7b4c('0x20')][_0x7b4c('0x37')]()][_0x7b4c('0x18')]('\x20')});})[_0x7b4c('0x24')](function(_0x2be22d){_0x401c4b(_0x5af2af[_0x7b4c('0x14')](0x1f5,[_0x5d123a[_0x7b4c('0x30')],_0x2be22d[_0x7b4c('0x20')][_0x7b4c('0x37')]()][_0x7b4c('0x18')]('\x20')));});}else{return _0x401c4b(_0x5af2af[_0x7b4c('0x14')](0x1f5,_0x7b4c('0x3e')));}});},'Agents':function(_0x3b4fda){return new Promise(function(_0x520df0){var _0x58a4b7=_[_0x7b4c('0x2c')](_0x2d9945[_0x7b4c('0x51')]);if(_0x3b4fda&&_0x3b4fda['id']){var _0x50069b=_[_0x7b4c('0x29')](_0x58a4b7,function(_0x25bbde){return _0x25bbde['id']===_0x3b4fda['id'];});_0x520df0(_0x50069b);}else{_0x520df0({'count':_0x58a4b7[_0x7b4c('0x28')],'rows':_0x58a4b7});}});},'Telephones':function(){return new Promise(function(_0xc214ce){var _0x20b72e=_[_0x7b4c('0x2c')](_0x2d9945[_0x7b4c('0x52')]);_0xc214ce({'count':_0x20b72e[_0x7b4c('0x28')],'rows':_0x20b72e});});},'Trunks':function(){return new Promise(function(_0x40edf1){var _0x4ff33f=_[_0x7b4c('0x2c')](_0x2d9945['trunks']);_0x40edf1({'count':_0x4ff33f[_0x7b4c('0x28')],'rows':_0x4ff33f});});},'OutboundChannels':function(){return new Promise(function(_0x5477e3){var _0x5f3070=_[_0x7b4c('0x2c')](_0x2d9945['outboundChannels']);_0x5477e3({'count':_0x5f3070['length'],'rows':_0x5f3070});});},'Outbound':function(){return new Promise(function(_0xe46a1e){_0xe46a1e(_0x2d9945[_0x7b4c('0x46')]);});},'Campaigns':function(){return new Promise(function(_0x328948){var _0x530979=_[_0x7b4c('0x2c')](_0x2d9945[_0x7b4c('0x53')]);_0x328948({'count':_0x530979[_0x7b4c('0x28')],'rows':_0x530979});});},'VoiceQueuesPreview':function(_0x29987e){var _0x1b4883=this;return new Promise(function(_0x2837aa,_0x2f58bf){_0x5adec9[_0x7b4c('0x54')](_0x29987e['id'])[_0x7b4c('0x1f')](function(_0x4777b5){_0x2837aa({'code':0xc8,'message':_0x4777b5[_0x7b4c('0x20')]});})[_0x7b4c('0x24')](function(_0x190548){_0x2f58bf(_0x1b4883[_0x7b4c('0x14')](0x1f4,_0x190548['message']));});});},'EventManager':function(_0x1df6f1){var _0x2732a2=this;return new Promise(function(_0x35e94a,_0x1cc380){if(!_0x1df6f1['event']){return _0x1cc380(_0x2732a2[_0x7b4c('0x14')](0x1f4,_0x7b4c('0x55')));}ami[_0x7b4c('0x56')](_0x7b4c('0x57')+_0x1df6f1[_0x7b4c('0x58')],_0x1df6f1[_0x7b4c('0x20')]);_0x35e94a({'code':0xc8,'message':_0x1df6f1});});},'FaxAccounts':function(){return new Promise(function(_0x766818){var _0x53bd8f=_[_0x7b4c('0x2c')](_0x2d9945[_0x7b4c('0x59')]);_0x766818({'count':_0x53bd8f['length'],'rows':_0x53bd8f});});},'SendFax':function(_0x4a9cf6){var _0x5ce786=this;return new Promise(function(_0x36ff91,_0x3e44af){_0x1b0f57[_0x7b4c('0x5a')](_0x4a9cf6)[_0x7b4c('0x1f')](function(_0xccdf59){_0x36ff91({'code':0xc8,'message':_0xccdf59[_0x7b4c('0x20')]});})[_0x7b4c('0x24')](function(_0x200c98){_0x3e44af(_0x5ce786[_0x7b4c('0x14')](0x1f4,_0x200c98[_0x7b4c('0x20')]));});});},'CheckAfterSend':function(_0x83e8bb){var _0x257fae=this;return new Promise(function(_0x2cd8a4,_0x4ccf5d){_0x1b0f57[_0x7b4c('0x5b')](_0x83e8bb)[_0x7b4c('0x1f')](function(_0x2afaa0){_0x2cd8a4({'code':0xc8,'message':_0x2afaa0['message']});})[_0x7b4c('0x24')](function(_0x392656){_0x4ccf5d(_0x257fae[_0x7b4c('0x14')](0x1f4,_0x392656[_0x7b4c('0x20')]));});});}};var _0x2b789e=jayson['server'](_0x4bf85d)[_0x7b4c('0x5c')]();_0x2b789e['on'](_0x7b4c('0x14'),function(_0x34abb1){return _0x2dd5c7(_0x34abb1);});_0x2b789e[_0x7b4c('0x8')](0x232a,'127.0.0.1',function(){console[_0x7b4c('0x5d')](_0x7b4c('0x5e'),0x232a);return _0x10e197(_0x7b4c('0x5f')+0x232a);});});}; \ No newline at end of file +var _0x9fd4=['updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','reload','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','map','channel','%s.%s','uniqueid','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','Redirect','exten','context','trunks','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','format','%s/%s','name','timers','timer','updateAcw','agents'];(function(_0x3f7844,_0x145dd1){var _0x8a5a0b=function(_0x5ede7a){while(--_0x5ede7a){_0x3f7844['push'](_0x3f7844['shift']());}};_0x8a5a0b(++_0x145dd1);}(_0x9fd4,0x16c));var _0x49fd=function(_0x4ff2a7,_0x46fbd1){_0x4ff2a7=_0x4ff2a7-0x0;var _0x562f6e=_0x9fd4[_0x4ff2a7];return _0x562f6e;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var jayson=require(_0x49fd('0x2'));var schema=require(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var config=require(_0x49fd('0x5'));var properties=require(_0x49fd('0x6'));var ami=require(_0x49fd('0x7'));var VoiceQueueSummary=require(_0x49fd('0x8'));exports['listen']=function(_0x481f6a,_0x3b4b46,_0x42fdc7){return new Promise(function(_0x1bc16e,_0x9353cd){var _0x48b999={'QueuePause':function(_0x14bb94){return new Promise(function(_0x461ac1){var _0x36f605=util[_0x49fd('0x9')](_0x49fd('0xa'),'SIP',_0x14bb94[_0x49fd('0xb')]);if(_0x481f6a[_0x49fd('0xc')]&&_0x481f6a[_0x49fd('0xc')][_0x36f605]&&_0x481f6a[_0x49fd('0xc')][_0x36f605][_0x49fd('0xd')]){_0x481f6a[_0x49fd('0xc')][_0x36f605][_0x49fd('0xe')]();}if(_0x481f6a['agents'][_0x36f605]){_0x481f6a[_0x49fd('0xf')][_0x36f605][_0x49fd('0x10')]({'statePause':_0x14bb94[_0x49fd('0x11')]?!![]:![]});}_0x461ac1({'code':0xc8,'message':_0x49fd('0x12')});});},'Reload':function(_0x15dabd){var _0x206bd8=this;return new Promise(function(_0x26f2c1,_0x3fa518){if(ami[_0x49fd('0x13')]()==![]){return _0x3fa518(_0x206bd8[_0x49fd('0x14')](0x1f4,[config[_0x49fd('0x15')]['ip'],config[_0x49fd('0x15')][_0x49fd('0x16')],_0x49fd('0x17')][_0x49fd('0x18')]('\x20')));}_0x15dabd=_[_0x49fd('0x19')](_0x15dabd,_[_0x49fd('0x1a')](properties[_0x49fd('0x1b')][_0x49fd('0x1c')]));_0x15dabd[_0x49fd('0x1d')]=_0x49fd('0x1e');return ami[_0x49fd('0x1f')](_0x15dabd)[_0x49fd('0x20')](function(_0x475eee){_0x26f2c1({'code':0xc8,'message':_0x475eee[_0x49fd('0x21')]});})[_0x49fd('0x22')](function(_0x598793){_0x3fa518(_0x206bd8[_0x49fd('0x14')](0x1f5,_0x598793[_0x49fd('0x21')]));});});},'Command':function(_0x59a407){var _0x5c323a=this;return new Promise(function(_0x449c9a,_0x53cbd1){if(ami[_0x49fd('0x13')]()==![]){return _0x53cbd1(_0x5c323a[_0x49fd('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x49fd('0x15')][_0x49fd('0x16')],'ami\x20disconnected'][_0x49fd('0x18')]('\x20')));}_0x59a407=_[_0x49fd('0x19')](_0x59a407,_0x49fd('0x23'));_0x59a407[_0x49fd('0x1d')]=_0x49fd('0x24');return ami[_0x49fd('0x1f')](_0x59a407)['then'](function(_0x46019d){_0x449c9a({'code':0xc8,'message':_0x46019d[_0x49fd('0x25')]});})[_0x49fd('0x22')](function(_0x4bf811){_0x53cbd1(_0x5c323a[_0x49fd('0x14')](0x1f5,_0x4bf811[_0x49fd('0x21')]));});});},'VoiceQueues':function(){return new Promise(function(_0x146d55){var _0x4bff4c=[];for(var _0x597161 in _0x481f6a['voiceQueues']){if(_0x481f6a[_0x49fd('0x26')][_0x49fd('0x27')](_0x597161)){var _0x4ec190=_0x481f6a[_0x49fd('0x26')][_0x597161];var _0x9587b9=new VoiceQueueSummary(_0x4ec190);_0x4bff4c[_0x49fd('0x28')](_0x9587b9);}}_0x146d55({'count':_0x4bff4c[_0x49fd('0x29')],'rows':_0x4bff4c});});},'UpdateVoiceQueue':function(_0x9afc1c){return new Promise(function(_0x54c8bb,_0x2b2710){var _0x52b35d=_[_0x49fd('0x2a')](_0x481f6a[_0x49fd('0x26')],{'id':parseInt(_0x9afc1c['id'])});var _0x54acb5=_[_0x49fd('0x2b')](_0x9afc1c,['id']);if(_0x52b35d){for(var _0x2c8568 in _0x54acb5){if(typeof _0x54acb5[_0x2c8568]!==_0x49fd('0x2c')&&typeof _0x52b35d[_0x2c8568]!==_0x49fd('0x2c')){_0x52b35d[_0x2c8568]=_0x54acb5[_0x2c8568];}}_0x54c8bb(_0x52b35d);}else{_0x2b2710();}});},'VoiceChannels':function(){return new Promise(function(_0x404bc1){var _0x12dc3d=_[_0x49fd('0x2d')](_0x481f6a[_0x49fd('0x2e')]);_0x404bc1({'count':_0x12dc3d['length'],'rows':_0x12dc3d});});},'VoiceChannelMixMonitor':function(_0x42181b){var _0x4869fc=this;return new Promise(function(_0x1952d0,_0x4ca49c){if(ami[_0x49fd('0x13')]()==![]){return _0x4ca49c(_0x4869fc[_0x49fd('0x14')](0x1f4,[config[_0x49fd('0x15')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x49fd('0x18')]('\x20')));}var _0x831002=schema(properties['voicechannel'])[_0x49fd('0x3')](_0x42181b);if(_0x831002['length']>0x0){return _0x4ca49c(_0x4869fc['error'](0x1f4,_[_0x49fd('0x2f')](_0x831002,_0x49fd('0x21'))[_0x49fd('0x18')](',\x20')));}var _0x373f1f=_[_0x49fd('0x2a')](_0x481f6a['channels'],{'uniqueid':_0x42181b['uniqueid']});if(_0x373f1f&&_0x373f1f[_0x49fd('0x30')]){var _0x13d03b=util[_0x49fd('0x9')](_0x49fd('0x31'),_0x42181b['filename']||_0x42181b[_0x49fd('0x32')],_0x42181b[_0x49fd('0x9')]||_0x49fd('0x33'));return ami[_0x49fd('0x1f')]({'action':_0x49fd('0x34'),'channel':_0x373f1f[_0x49fd('0x30')],'file':_0x13d03b,'options':_0x49fd('0x35')})[_0x49fd('0x20')](function(_0x98571b){var _0x89f196=_[_0x49fd('0x2a')](_0x373f1f['monitors'],{'filename':_0x49fd('0x36')+_0x13d03b[_0x49fd('0x37')]()});if(_[_0x49fd('0x38')](_0x89f196)){_0x373f1f[_0x49fd('0x39')][_0x49fd('0x28')]({'filename':_0x49fd('0x36')+_0x13d03b[_0x49fd('0x37')](),'createdAt':moment()[_0x49fd('0x9')](_0x49fd('0x3a')),'mixmonitorid':_0x98571b['mixmonitorid'],'status':_0x49fd('0x3b')});}else{_0x89f196['mixmonitorid']=_0x98571b[_0x49fd('0x3c')];_0x89f196[_0x49fd('0x3d')]='rec';}_0x1952d0({'code':0xc8,'message':[_0x42181b[_0x49fd('0x32')],_0x49fd('0x3e'),_0x98571b['mixmonitorid']][_0x49fd('0x18')]('\x20'),'mixmonitorid':_0x98571b['mixmonitorid']});})['catch'](function(_0x5f56f8){_0x4ca49c(_0x4869fc[_0x49fd('0x14')](0x1f5,[_0x42181b[_0x49fd('0x32')],_0x5f56f8[_0x49fd('0x21')][_0x49fd('0x37')]()]['join']('\x20')));});}else{return _0x4ca49c(_0x4869fc[_0x49fd('0x14')](0x1f5,_0x49fd('0x3f')));}});},'VoiceChannelStopMixMonitor':function(_0x42c130){var _0x42c537=this;return new Promise(function(_0x115c5a,_0x28d7ea){if(ami[_0x49fd('0x13')]()==![]){return _0x28d7ea(_0x42c537[_0x49fd('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x49fd('0x15')][_0x49fd('0x16')],'ami\x20disconnected'][_0x49fd('0x18')]('\x20')));}var _0x237050=schema(properties['voicechannel'])[_0x49fd('0x3')](_0x42c130);if(_0x237050['length']>0x0){return _0x28d7ea(_0x42c537[_0x49fd('0x14')](0x1f4,_[_0x49fd('0x2f')](_0x237050,_0x49fd('0x21'))[_0x49fd('0x18')](',\x20')));}var _0x4f6902=_['find'](_0x481f6a[_0x49fd('0x2e')],{'uniqueid':_0x42c130['uniqueid']});if(_0x4f6902){return Promise[_0x49fd('0x40')]()[_0x49fd('0x20')](function(){if(_0x4f6902[_0x49fd('0x30')]){return ami[_0x49fd('0x1f')]({'action':'StopMixMonitor','channel':_0x4f6902[_0x49fd('0x30')],'mixmonitorid':_0x42c130[_0x49fd('0x3c')]})[_0x49fd('0x22')](function(){});}})[_0x49fd('0x20')](function(){if(_0x4f6902[_0x49fd('0x41')]){return ami[_0x49fd('0x1f')]({'action':_0x49fd('0x42'),'channel':_0x4f6902[_0x49fd('0x41')],'mixmonitorid':_0x42c130[_0x49fd('0x3c')]})[_0x49fd('0x22')](function(){});}})[_0x49fd('0x20')](function(){var _0x312344=_[_0x49fd('0x2a')](_0x4f6902[_0x49fd('0x39')],{'mixmonitorid':_0x42c130['mixmonitorid']});if(_0x312344){_0x312344['status']=_0x49fd('0x43');}})[_0x49fd('0x20')](function(){var _0x42287e=util[_0x49fd('0x9')]('%s.%s',_0x42c130[_0x49fd('0x44')]||_0x42c130[_0x49fd('0x32')],_0x42c130['format']||_0x49fd('0x33'));var _0x270360=_[_0x49fd('0x2a')](_0x4f6902[_0x49fd('0x39')],{'filename':_0x49fd('0x36')+_0x42287e[_0x49fd('0x37')]()});if(_0x270360){_0x270360[_0x49fd('0x3d')]=_0x49fd('0x43');}})[_0x49fd('0x20')](function(){_0x115c5a({'code':0xc8,'message':[_0x42c130[_0x49fd('0x32')],_0x49fd('0x45')]['join']('\x20')});})[_0x49fd('0x22')](function(_0x3a4677){_0x28d7ea(_0x42c537[_0x49fd('0x14')](0x1f5,[_0x42c130[_0x49fd('0x32')],_0x3a4677[_0x49fd('0x21')][_0x49fd('0x37')]()]['join']('\x20')));});}else{return _0x28d7ea(_0x42c537['error'](0x1f5,_0x49fd('0x3f')));}});},'VoiceQueuesChannels':function(_0x765bca){var _0x3f11d4=this;return new Promise(function(_0x5c34c0){var _0x31783f=_[_0x49fd('0x2d')](_0x481f6a['queueChannels']);var _0x501a05={'count':_0x31783f['length'],'rows':_0x31783f};if(_0x765bca&&_0x765bca[_0x49fd('0x46')]){if(!['inbound','outbound']['includes'](_0x765bca[_0x49fd('0x46')])){return _0x9353cd(_0x3f11d4[_0x49fd('0x14')](0x190,_0x49fd('0x47')));}var _0x2df12b=_[_0x49fd('0x48')](_0x31783f,function(_0x37e47d){return _0x37e47d[_0x49fd('0x46')]===_0x765bca[_0x49fd('0x46')];});_0x501a05[_0x49fd('0x49')]=_0x2df12b[_0x49fd('0x29')];_0x501a05['rows']=_0x2df12b;}_0x5c34c0(_0x501a05);});},'VoiceQueuesChannel':function(_0x444a0e){var _0x202a86=this;return new Promise(function(_0x1560c6,_0x3deda9){var _0x7e201c=schema(properties[_0x49fd('0x4a')])['validate'](_0x444a0e);if(_0x7e201c[_0x49fd('0x29')]>0x0){return _0x3deda9(_0x202a86[_0x49fd('0x14')](0x1f4,_['map'](_0x7e201c,'message')[_0x49fd('0x18')](',\x20')));}var _0x52c0b9=_[_0x49fd('0x2a')](_0x481f6a['queueChannels'],{'uniqueid':_0x444a0e[_0x49fd('0x32')]});if(_0x52c0b9){_0x1560c6(_0x52c0b9);}else{return _0x3deda9(_0x202a86['error'](0x1f5,_0x49fd('0x3f')));}});},'VoiceQueuesChannelHangup':function(_0x3e5609){var _0x4fe873=this;return new Promise(function(_0x2e4f29,_0xc34aed){if(ami[_0x49fd('0x13')]()==![]){return _0xc34aed(_0x4fe873[_0x49fd('0x14')](0x1f4,[config[_0x49fd('0x15')]['ip'],config[_0x49fd('0x15')][_0x49fd('0x16')],_0x49fd('0x17')]['join']('\x20')));}var _0x1428b3=schema(properties[_0x49fd('0x4b')])[_0x49fd('0x3')](_0x3e5609);if(_0x1428b3['length']>0x0){return _0xc34aed(_0x4fe873[_0x49fd('0x14')](0x1f4,_[_0x49fd('0x2f')](_0x1428b3,_0x49fd('0x21'))[_0x49fd('0x18')](',\x20')));}var _0x13e752=_[_0x49fd('0x2a')](_0x481f6a[_0x49fd('0x4c')],{'uniqueid':_0x3e5609[_0x49fd('0x32')]});if(_0x13e752&&_0x13e752[_0x49fd('0x30')]){return ami['Action']({'action':_0x49fd('0x4d'),'channel':_0x13e752[_0x49fd('0x30')]})['then'](function(_0x24b65e){_0x2e4f29({'code':0xc8,'message':[_0x3e5609[_0x49fd('0x32')],_0x24b65e['message']['toLowerCase']()]['join']('\x20')});})[_0x49fd('0x22')](function(_0x25cba9){_0xc34aed(_0x4fe873[_0x49fd('0x14')](0x1f5,[_0x3e5609[_0x49fd('0x32')],_0x25cba9[_0x49fd('0x21')]['toLowerCase']()][_0x49fd('0x18')]('\x20')));});}else{return _0xc34aed(_0x4fe873['error'](0x1f5,_0x49fd('0x3f')));}});},'VoiceQueuesChannelRedirect':function(_0x4eec73){var _0x1e5279=this;return new Promise(function(_0x1a8da2,_0x234e2a){if(ami[_0x49fd('0x13')]()==![]){return _0x234e2a(_0x1e5279['error'](0x1f4,[config[_0x49fd('0x15')]['ip'],config[_0x49fd('0x15')]['username'],_0x49fd('0x17')][_0x49fd('0x18')]('\x20')));}var _0xc3cddd=schema(properties['voicequeuechannelredirect'])[_0x49fd('0x3')](_0x4eec73);if(_0xc3cddd[_0x49fd('0x29')]>0x0){return _0x234e2a(_0x1e5279[_0x49fd('0x14')](0x1f4,_[_0x49fd('0x2f')](_0xc3cddd,_0x49fd('0x21'))[_0x49fd('0x18')](',\x20')));}var _0x59281f=_['find'](_0x481f6a[_0x49fd('0x4c')],{'uniqueid':_0x4eec73[_0x49fd('0x32')]});if(_0x59281f&&_0x59281f[_0x49fd('0x30')]){return ami[_0x49fd('0x1f')]({'action':_0x49fd('0x4e'),'channel':_0x59281f[_0x49fd('0x30')],'exten':_0x4eec73[_0x49fd('0x4f')],'context':_0x4eec73[_0x49fd('0x50')]||_0x59281f[_0x49fd('0x50')],'priority':0x1})[_0x49fd('0x20')](function(_0x39164b){_0x1a8da2({'code':0xc8,'message':[_0x4eec73[_0x49fd('0x32')],_0x39164b[_0x49fd('0x21')]['toLowerCase']()][_0x49fd('0x18')]('\x20')});})[_0x49fd('0x22')](function(_0x365bc3){_0x234e2a(_0x1e5279['error'](0x1f5,[_0x4eec73['uniqueid'],_0x365bc3[_0x49fd('0x21')][_0x49fd('0x37')]()][_0x49fd('0x18')]('\x20')));});}else{return _0x234e2a(_0x1e5279['error'](0x1f5,_0x49fd('0x3f')));}});},'Agents':function(_0x161767){return new Promise(function(_0x162b84){var _0x3ce72c=_[_0x49fd('0x2d')](_0x481f6a[_0x49fd('0xf')]);if(_0x161767&&_0x161767['id']){var _0x4169e9=_['find'](_0x3ce72c,function(_0x58eecf){return _0x58eecf['id']===_0x161767['id'];});_0x162b84(_0x4169e9);}else{_0x162b84({'count':_0x3ce72c[_0x49fd('0x29')],'rows':_0x3ce72c});}});},'Telephones':function(){return new Promise(function(_0x53185f){var _0x3b94e1=_['values'](_0x481f6a['telephones']);_0x53185f({'count':_0x3b94e1['length'],'rows':_0x3b94e1});});},'Trunks':function(){return new Promise(function(_0x240616){var _0x355c5e=_['values'](_0x481f6a[_0x49fd('0x51')]);_0x240616({'count':_0x355c5e[_0x49fd('0x29')],'rows':_0x355c5e});});},'OutboundChannels':function(){return new Promise(function(_0x4c3a12){var _0x67f0f5=_[_0x49fd('0x2d')](_0x481f6a['outboundChannels']);_0x4c3a12({'count':_0x67f0f5[_0x49fd('0x29')],'rows':_0x67f0f5});});},'Outbound':function(){return new Promise(function(_0x50d846){_0x50d846(_0x481f6a[_0x49fd('0x52')]);});},'Campaigns':function(){return new Promise(function(_0x148ff2){var _0x52ad1c=_[_0x49fd('0x2d')](_0x481f6a[_0x49fd('0x53')]);_0x148ff2({'count':_0x52ad1c['length'],'rows':_0x52ad1c});});},'VoiceQueuesPreview':function(_0x219152){var _0x12a2f8=this;return new Promise(function(_0x2e4f40,_0x194ded){_0x3b4b46[_0x49fd('0x54')](_0x219152['id'])[_0x49fd('0x20')](function(_0x1ffd5f){_0x2e4f40({'code':0xc8,'message':_0x1ffd5f[_0x49fd('0x21')]});})['catch'](function(_0x4cdc4c){_0x194ded(_0x12a2f8[_0x49fd('0x14')](0x1f4,_0x4cdc4c[_0x49fd('0x21')]));});});},'EventManager':function(_0x555a87){var _0x2ca980=this;return new Promise(function(_0xb42ebc,_0x5a2794){if(!_0x555a87[_0x49fd('0x55')]){return _0x5a2794(_0x2ca980[_0x49fd('0x14')](0x1f4,_0x49fd('0x56')));}ami[_0x49fd('0x57')]('custom:'+_0x555a87[_0x49fd('0x55')],_0x555a87[_0x49fd('0x21')]);_0xb42ebc({'code':0xc8,'message':_0x555a87});});},'FaxAccounts':function(){return new Promise(function(_0x1bf4b8){var _0x2f0e97=_[_0x49fd('0x2d')](_0x481f6a[_0x49fd('0x58')]);_0x1bf4b8({'count':_0x2f0e97[_0x49fd('0x29')],'rows':_0x2f0e97});});},'SendFax':function(_0x545740){var _0x1d04d5=this;return new Promise(function(_0x31dec5,_0x3c86dc){_0x42fdc7[_0x49fd('0x59')](_0x545740)[_0x49fd('0x20')](function(_0x3166e5){_0x31dec5({'code':0xc8,'message':_0x3166e5[_0x49fd('0x21')]});})[_0x49fd('0x22')](function(_0xe96b86){_0x3c86dc(_0x1d04d5[_0x49fd('0x14')](0x1f4,_0xe96b86[_0x49fd('0x21')]));});});},'CheckAfterSend':function(_0x40c089){var _0x23a779=this;return new Promise(function(_0x3c96e8,_0x14fcf7){_0x42fdc7[_0x49fd('0x5a')](_0x40c089)[_0x49fd('0x20')](function(_0xf1aee0){_0x3c96e8({'code':0xc8,'message':_0xf1aee0[_0x49fd('0x21')]});})[_0x49fd('0x22')](function(_0x57aeb8){_0x14fcf7(_0x23a779[_0x49fd('0x14')](0x1f4,_0x57aeb8['message']));});});}};var _0x181f12=jayson[_0x49fd('0x5b')](_0x48b999)['http']();_0x181f12['on']('error',function(_0x4138a8){return _0x9353cd(_0x4138a8);});_0x181f12[_0x49fd('0x5c')](0x232a,_0x49fd('0x5d'),function(){console['log'](_0x49fd('0x5e'),0x232a);return _0x1bc16e('RPC\x20listening\x20on\x20port:'+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 bc7fc2f..7b91a5f 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 _0x8646=['[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','destcalleridname','Unknown','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','calleridnum','mobile','fax','union','resolve','then','isEmpty','length','info'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x8646,0x1c4));var _0x6864=function(_0x3339a0,_0x55503e){_0x3339a0=_0x3339a0-0x0;var _0x163186=_0x8646[_0x3339a0];return _0x163186;};'use strict';var _=require(_0x6864('0x0'));var BPromise=require(_0x6864('0x1'));var Redis=require(_0x6864('0x2'));var util=require(_0x6864('0x3'));var config=require(_0x6864('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x6864('0x5'));config[_0x6864('0x6')]=_['defaults'](config[_0x6864('0x6')],{'host':_0x6864('0x7'),'port':0x18eb});var io=require(_0x6864('0x8'))(new Redis(config[_0x6864('0x6')]));function emit(_0x3aaa67,_0x4daff9,_0x24c362,_0x433853,_0x46da3f){logger['info'](_0x6864('0x9'),_0x3aaa67,_0x4daff9['id'],_0x24c362,_0x433853,JSON[_0x6864('0xa')](_0x46da3f));io['to'](_0x24c362)[_0x6864('0xb')](_0x433853,_0x46da3f);}exports[_0x6864('0xc')]=function(_0x16ec3d,_0xc1d259,_0x13c6bf,_0x367bf0){var _0x2836fb,_0x394c7e;var _0x27e653={};var _0x95d610;var _0x1f0a24=Number(_0x13c6bf[_0x6864('0xd')]);var _0x3f5b6c=_0x13c6bf[_0x6864('0xe')]?Boolean(Number(_0x13c6bf['data2'])):![];var _0x23bf4f;var _0x1fab09=![];if(!_[_0x6864('0xf')](_0x13c6bf[_0x6864('0x10')])){if(_0x13c6bf[_0x6864('0x10')]=='1')_0x1fab09=!![];}if(!_0x1fab09){if(_0x367bf0[_0x6864('0x11')]){_0x27e653['id']=_0x367bf0['xmd-contactid'];}}if(!_0x27e653['id']){_0x27e653[_0x6864('0x12')]=_0x1f0a24;_0x23bf4f=_0x13c6bf[_0x6864('0x13')]&&_0x13c6bf[_0x6864('0x13')]!=='0'?_0x13c6bf[_0x6864('0x13')][_0x6864('0x14')](','):[_0x6864('0x15')];_0x27e653['$or']=_[_0x6864('0x16')](_0x23bf4f,function(_0x25d79d){var _0x4cb97a={};_0x4cb97a[_0x25d79d]=_0x367bf0[_0x6864('0x17')]?_0x367bf0[_0x6864('0x18')]:_0x367bf0[_0x6864('0x19')];return _0x4cb97a;});_0x95d610=_0x367bf0[_0x6864('0x17')]?_0x367bf0[_0x6864('0x18')]:_0x367bf0[_0x6864('0x19')];}var _0x374d55=['id','firstName','lastName','phone',_0x6864('0x1a'),_0x6864('0x1b'),_0x6864('0x12'),'createdAt','scheduledAt','updatedAt'];var _0x42d200=_[_0x6864('0x1c')](_0x374d55,_0x23bf4f);BPromise[_0x6864('0x1d')]()[_0x6864('0x1e')](cmContactRpc['getContacts']({'attributes':_0x42d200,'where':_0x27e653,'phone':_0x95d610}))[_0x6864('0x1e')](function(_0x477a17){_0x394c7e=_0x477a17;if(!_[_0x6864('0x1f')](_0x394c7e)){if(_0x394c7e[_0x6864('0x20')]===0x1){_0x2836fb=_0x394c7e[0x0];logger[_0x6864('0x21')](_0x6864('0x22'),_0x367bf0[_0x6864('0x23')],_0xc1d259['id'],_0x2836fb['id']);}else{logger[_0x6864('0x21')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x367bf0['uniqueid'],_0xc1d259['id'],_[_0x6864('0x16')](_0x394c7e,'id')[_0x6864('0x24')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x367bf0[_0x6864('0x23')],_0xc1d259['id']);var _0x28ef11={'ListId':_0x1f0a24};var _0x358fc3=_0x13c6bf[_0x6864('0x25')]&&_0x13c6bf['data4']!=='0'?_0x13c6bf['data4']:'phone';if(_0x3f5b6c){logger[_0x6864('0x21')](_0x6864('0x26'),_0x367bf0[_0x6864('0x23')],_0xc1d259['id']);_0x28ef11[_0x358fc3]=_[_0x6864('0xf')](_0x367bf0[_0x6864('0x17')])?_0x367bf0[_0x6864('0x19')]:_0x367bf0[_0x6864('0x18')];if(_['isNil'](_0x367bf0[_0x6864('0x17')])){_0x28ef11[_0x6864('0x27')]=_0x367bf0['calleridname']&&_0x367bf0[_0x6864('0x28')]!==_0x6864('0x29')?_0x367bf0[_0x6864('0x28')]:'Unknown';}else{_0x28ef11[_0x6864('0x27')]=_0x367bf0[_0x6864('0x2a')]&&_0x367bf0[_0x6864('0x2a')]!==_0x6864('0x29')?_0x367bf0[_0x6864('0x2a')]:_0x6864('0x2b');}return BPromise['resolve']()[_0x6864('0x1e')](cmContactRpc[_0x6864('0x2c')](_0x28ef11))[_0x6864('0x1e')](function(_0x553e7f){_0x2836fb=_0x553e7f;_0x394c7e['push'](_0x553e7f);if(_0x2836fb){logger[_0x6864('0x21')](_0x6864('0x2d'),_0x367bf0['uniqueid'],_0xc1d259['id'],_0x2836fb['id']);}return;});}else{logger[_0x6864('0x21')](_0x6864('0x2e'),_0x367bf0[_0x6864('0x23')],_0xc1d259['id']);_0x28ef11[_0x358fc3]=_[_0x6864('0xf')](_0x367bf0[_0x6864('0x17')])?_0x367bf0[_0x6864('0x19')]:_0x367bf0[_0x6864('0x18')];if(_['isNil'](_0x367bf0[_0x6864('0x17')])){_0x28ef11[_0x6864('0x27')]=_0x367bf0[_0x6864('0x28')]&&_0x367bf0[_0x6864('0x28')]!==_0x6864('0x29')?_0x367bf0[_0x6864('0x28')]:_0x6864('0x2b');}else{_0x28ef11[_0x6864('0x27')]=_0x367bf0[_0x6864('0x2a')]&&_0x367bf0[_0x6864('0x2a')]!==_0x6864('0x29')?_0x367bf0['destcalleridname']:_0x6864('0x2b');}_0x2836fb=_0x28ef11;_0x394c7e[_0x6864('0x2f')](_0x28ef11);return;}}})[_0x6864('0x1e')](function(){if(_0x16ec3d){emit(_0x367bf0[_0x6864('0x23')],_0xc1d259,util[_0x6864('0x30')](_0x6864('0x31'),_0x16ec3d['name']),util[_0x6864('0x30')](_0x6864('0x32'),_0x13c6bf[_0x6864('0x33')][_0x6864('0x34')]()),{'evt':_[_0x6864('0x35')](_0x367bf0,{'autoCreate':_0x3f5b6c}),'contact':_0x2836fb===undefined?{}:_0x2836fb,'contacts':_0x394c7e[_0x6864('0x20')]===0x0?undefined:_0x394c7e});}});}; \ No newline at end of file +var _0x47b3=['action','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','localhost','redis','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name'];(function(_0x4b4535,_0x256290){var _0x3d32a8=function(_0x55fa0f){while(--_0x55fa0f){_0x4b4535['push'](_0x4b4535['shift']());}};_0x3d32a8(++_0x256290);}(_0x47b3,0xee));var _0x347b=function(_0x48e0de,_0x25e7f8){_0x48e0de=_0x48e0de-0x0;var _0x38697c=_0x47b3[_0x48e0de];return _0x38697c;};'use strict';var _=require(_0x347b('0x0'));var BPromise=require(_0x347b('0x1'));var Redis=require(_0x347b('0x2'));var util=require('util');var config=require(_0x347b('0x3'));var logger=require(_0x347b('0x4'))(_0x347b('0x5'));var cmContactRpc=require(_0x347b('0x6'));config['redis']=_[_0x347b('0x7')](config['redis'],{'host':_0x347b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x347b('0x9')]));function emit(_0x500fdd,_0x1c4869,_0x445534,_0x3fe99f,_0x526cbc){logger[_0x347b('0xa')](_0x347b('0xb'),_0x500fdd,_0x1c4869['id'],_0x445534,_0x3fe99f,JSON[_0x347b('0xc')](_0x526cbc));io['to'](_0x445534)[_0x347b('0xd')](_0x3fe99f,_0x526cbc);}exports[_0x347b('0xe')]=function(_0x46affd,_0x209acf,_0x11bb35,_0x1a8d41){var _0x1a868d,_0x4b2ac8;var _0x1b3e83={};var _0x2d4102;var _0x1694f4=Number(_0x11bb35[_0x347b('0xf')]);var _0x53ff03=_0x11bb35[_0x347b('0x10')]?Boolean(Number(_0x11bb35['data2'])):![];var _0x36a499;var _0x24566a=![];if(!_[_0x347b('0x11')](_0x11bb35[_0x347b('0x12')])){if(_0x11bb35['data5']=='1')_0x24566a=!![];}if(!_0x24566a){if(_0x1a8d41[_0x347b('0x13')]){_0x1b3e83['id']=_0x1a8d41[_0x347b('0x13')];}}if(!_0x1b3e83['id']){_0x1b3e83[_0x347b('0x14')]=_0x1694f4;_0x36a499=_0x11bb35[_0x347b('0x15')]&&_0x11bb35[_0x347b('0x15')]!=='0'?_0x11bb35[_0x347b('0x15')][_0x347b('0x16')](','):[_0x347b('0x17')];_0x1b3e83['$or']=_[_0x347b('0x18')](_0x36a499,function(_0x17fe87){var _0x123718={};_0x123718[_0x17fe87]=_0x1a8d41[_0x347b('0x19')]?_0x1a8d41[_0x347b('0x1a')]:_0x1a8d41[_0x347b('0x1b')];return _0x123718;});_0x2d4102=_0x1a8d41[_0x347b('0x19')]?_0x1a8d41[_0x347b('0x1a')]:_0x1a8d41['calleridnum'];}var _0x4adf1d=['id','firstName',_0x347b('0x1c'),_0x347b('0x17'),_0x347b('0x1d'),_0x347b('0x1e'),_0x347b('0x14'),_0x347b('0x1f'),_0x347b('0x20'),_0x347b('0x21')];var _0x55b293=_[_0x347b('0x22')](_0x4adf1d,_0x36a499);BPromise[_0x347b('0x23')]()['then'](cmContactRpc[_0x347b('0x24')]({'attributes':_0x55b293,'where':_0x1b3e83,'phone':_0x2d4102}))[_0x347b('0x25')](function(_0x518c4e){_0x4b2ac8=_0x518c4e;if(!_[_0x347b('0x26')](_0x4b2ac8)){if(_0x4b2ac8[_0x347b('0x27')]===0x1){_0x1a868d=_0x4b2ac8[0x0];logger[_0x347b('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1a8d41[_0x347b('0x28')],_0x209acf['id'],_0x1a868d['id']);}else{logger[_0x347b('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1a8d41['uniqueid'],_0x209acf['id'],_[_0x347b('0x18')](_0x4b2ac8,'id')[_0x347b('0x29')](','));}return;}else{logger['info'](_0x347b('0x2a'),_0x1a8d41[_0x347b('0x28')],_0x209acf['id']);var _0x3765ff={'ListId':_0x1694f4};var _0x2c59ca=_0x11bb35[_0x347b('0x2b')]&&_0x11bb35[_0x347b('0x2b')]!=='0'?_0x11bb35[_0x347b('0x2b')]:_0x347b('0x17');if(_0x53ff03){logger[_0x347b('0xa')](_0x347b('0x2c'),_0x1a8d41['uniqueid'],_0x209acf['id']);_0x3765ff[_0x2c59ca]=_[_0x347b('0x11')](_0x1a8d41[_0x347b('0x19')])?_0x1a8d41['calleridnum']:_0x1a8d41['destcalleridnum'];if(_[_0x347b('0x11')](_0x1a8d41['routeId'])){_0x3765ff[_0x347b('0x2d')]=_0x1a8d41[_0x347b('0x2e')]&&_0x1a8d41['calleridname']!==_0x347b('0x2f')?_0x1a8d41[_0x347b('0x2e')]:'Unknown';}else{_0x3765ff[_0x347b('0x2d')]=_0x1a8d41['destcalleridname']&&_0x1a8d41['destcalleridname']!==''?_0x1a8d41[_0x347b('0x30')]:_0x347b('0x31');}return BPromise['resolve']()[_0x347b('0x25')](cmContactRpc[_0x347b('0x32')](_0x3765ff))[_0x347b('0x25')](function(_0x33f0c7){_0x1a868d=_0x33f0c7;_0x4b2ac8[_0x347b('0x33')](_0x33f0c7);if(_0x1a868d){logger[_0x347b('0xa')](_0x347b('0x34'),_0x1a8d41[_0x347b('0x28')],_0x209acf['id'],_0x1a868d['id']);}return;});}else{logger[_0x347b('0xa')](_0x347b('0x35'),_0x1a8d41[_0x347b('0x28')],_0x209acf['id']);_0x3765ff[_0x2c59ca]=_['isNil'](_0x1a8d41[_0x347b('0x19')])?_0x1a8d41[_0x347b('0x1b')]:_0x1a8d41['destcalleridnum'];if(_['isNil'](_0x1a8d41[_0x347b('0x19')])){_0x3765ff[_0x347b('0x2d')]=_0x1a8d41[_0x347b('0x2e')]&&_0x1a8d41[_0x347b('0x2e')]!==_0x347b('0x2f')?_0x1a8d41[_0x347b('0x2e')]:_0x347b('0x31');}else{_0x3765ff[_0x347b('0x2d')]=_0x1a8d41['destcalleridname']&&_0x1a8d41[_0x347b('0x30')]!==''?_0x1a8d41['destcalleridname']:'Unknown';}_0x1a868d=_0x3765ff;_0x4b2ac8[_0x347b('0x33')](_0x3765ff);return;}}})[_0x347b('0x25')](function(){if(_0x46affd){emit(_0x1a8d41[_0x347b('0x28')],_0x209acf,util[_0x347b('0x36')](_0x347b('0x37'),_0x46affd[_0x347b('0x38')]),util[_0x347b('0x36')]('trigger:%s',_0x11bb35[_0x347b('0x39')]['toLowerCase']()),{'evt':_[_0x347b('0x3a')](_0x1a8d41,{'autoCreate':_0x53ff03}),'contact':_0x1a868d===undefined?{}:_0x1a868d,'contacts':_0x4b2ac8[_0x347b('0x27')]===0x0?undefined:_0x4b2ac8});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ca22a54..9e97d15 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 _0x80e0=['queue','urlforward','parse','query','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','account','chat','ChatWebsiteId','operator','AccountId','value','interaction','event','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','equals','exports','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/logger','trigger','../ami','localhost','redis','popup','triggers','agents','templates','voiceExtensions','zendeskAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','zohoAccounts','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','html','render','data2','template\x20not\x20found','uri','buildUri','data3','data4','location','uriLocation','windowWidth','isNil','800','data5','data6','winapp','winApplication','winArguments','name','format','trigger:%s:%s','jscripty','user:%s','trigger:%s','merge','integration','exec','voiceQueues'];(function(_0x8abefb,_0x131231){var _0xdbc099=function(_0x3fddfa){while(--_0x3fddfa){_0x8abefb['push'](_0x8abefb['shift']());}};_0xdbc099(++_0x131231);}(_0x80e0,0x9d));var _0x080e=function(_0x384b0a,_0x4aff7c){_0x384b0a=_0x384b0a-0x0;var _0x10a10b=_0x80e0[_0x384b0a];return _0x10a10b;};'use strict';var util=require('util');var _=require('lodash');var url=require(_0x080e('0x0'));var Mustache=require(_0x080e('0x1'));var Redis=require(_0x080e('0x2'));var urlforward=require('./urlforward');var integration=require(_0x080e('0x3'));var cmContact=require(_0x080e('0x4'));var script=require(_0x080e('0x5'));var config=require('../../../config/environment');var logger=require(_0x080e('0x6'))(_0x080e('0x7'));var ami=require(_0x080e('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x080e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x080e('0xa')]));var operators={'equals':function(_0x5d48f0,_0x3e45de){return _0x5d48f0==_0x3e45de;},'not_equals':function(_0x1241ec,_0x15ce45){return _0x1241ec!=_0x15ce45;}};var barAndWebActions=[_0x080e('0xb'),_0x080e('0x0'),'winapp'];function Trigger(_0x498a67){this[_0x080e('0xc')]=_0x498a67[_0x080e('0xc')];this[_0x080e('0xd')]=_0x498a67[_0x080e('0xd')];this['voiceQueues']=_0x498a67['voiceQueues'];this[_0x080e('0xe')]=_0x498a67[_0x080e('0xe')];this[_0x080e('0xf')]=_0x498a67['voiceExtensions'];this[_0x080e('0x10')]=_0x498a67[_0x080e('0x10')];this['freshdeskAccounts']=_0x498a67['freshdeskAccounts'];this['salesforceAccounts']=_0x498a67['salesforceAccounts'];this[_0x080e('0x11')]=_0x498a67[_0x080e('0x11')];this['zohoAccounts']=_0x498a67['zohoAccounts'];this[_0x080e('0x12')]=_0x498a67['deskAccounts'];this['vtigerAccounts']=_0x498a67[_0x080e('0x13')];this['servicenowAccounts']=_0x498a67[_0x080e('0x14')];this[_0x080e('0x15')]=_0x498a67[_0x080e('0x15')];this[_0x080e('0x16')]=_0x498a67['freshsalesAccounts'];this[_0x080e('0x17')]={'zendesk':this[_0x080e('0x10')],'salesforce':this[_0x080e('0x18')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x080e('0x11')],'zoho':this[_0x080e('0x19')],'desk':this[_0x080e('0x12')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x080e('0x15')],'freshsales':this[_0x080e('0x16')],'servicenow':this[_0x080e('0x14')]};ami['on']('custom:agentcalled',this[_0x080e('0x1a')]['bind'](this));ami['on'](_0x080e('0x1b'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x1d'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x1e'),this['syncCustomEvent'][_0x080e('0x1c')](this));ami['on'](_0x080e('0x1f'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x20'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x21'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x22'),this['syncCustomEvent'][_0x080e('0x1c')](this));ami['on']('custom:agentreject',this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on']('custom:amd',this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x23'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x24'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x25'),this['syncAgentDial']['bind'](this));ami['on'](_0x080e('0x26'),this[_0x080e('0x27')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x28'),this[_0x080e('0x27')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x29'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x2a'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x2b'),this['syncCustomEvent'][_0x080e('0x1c')](this));ami['on']('custom:incomingmessage',this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x2c'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x2d'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x2e'),this[_0x080e('0x1a')][_0x080e('0x1c')](this));ami['on'](_0x080e('0x2f'),this[_0x080e('0x1a')]['bind'](this));}Trigger[_0x080e('0x30')][_0x080e('0x31')]=function(_0x451d6c,_0x5f24ea,_0x39f2db){logger[_0x080e('0x32')](_0x451d6c,_0x5f24ea,JSON[_0x080e('0x33')](_0x39f2db));io['to'](_0x451d6c)[_0x080e('0x31')](_0x5f24ea,_0x39f2db);};Trigger[_0x080e('0x30')]['syncCustomEvent']=function(_0x509412){var _0x3d6641=_[_0x080e('0x34')](_0x509412);if(typeof _0x3d6641[_0x080e('0x35')]===_0x080e('0x36')){_0x3d6641[_0x080e('0x35')]=_0x080e('0x37');}this[_0x080e('0x38')](_0x3d6641);};Trigger[_0x080e('0x30')]['syncAgentDial']=function(_0xa978d1){if(this['agents'][_0xa978d1[_0x080e('0x39')]]){this[_0x080e('0x1a')](_0xa978d1);}};Trigger[_0x080e('0x30')][_0x080e('0x38')]=function(_0x214a7e){var _0x157a1f;for(var _0xbfe084 in this[_0x080e('0xc')]){if(this[_0x080e('0xc')][_0x080e('0x3a')](_0xbfe084)){if(this[_0x080e('0xc')][_0xbfe084][_0x080e('0x3b')]){_0x157a1f=this[_0x080e('0x3c')](this[_0x080e('0xc')][_0xbfe084],_0x214a7e);if(_0x157a1f){_['merge'](_0x214a7e,_0x214a7e[_0x080e('0x3d')]);for(var _0xdd9563=0x0,_0x4e50c4,_0x361d44,_0x549bdb;_0xdd95630x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ 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(_0x19cc25,_0x2c0f1f){var _0x1060aa=function(_0x95d2a){while(--_0x95d2a){_0x19cc25['push'](_0x19cc25['shift']());}};_0x1060aa(++_0x2c0f1f);}(_0x7217,0x19e));var _0x7721=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7217[_0x8de54f];return _0x14cba4;};'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 c80fb8a..904e140 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 _0x5bdc=['Subjects','/contacts(','phonecall','callDirection','queue','Descriptions','Fields','format','emit','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','then','access_token','catch','error','toUpperCase','message','GET','Bearer\x20','4.0','value','isNil','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','lastIndexOf','enduserId','outbound','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','idField','substring','indexOf','content','ticketType','incident','incidents','assign','getString'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x5bdc,0x1c1));var _0xc5bd=function(_0x576ec1,_0x47559b){_0x576ec1=_0x576ec1-0x0;var _0x4be026=_0x5bdc[_0x576ec1];return _0x4be026;};'use strict';var _=require(_0xc5bd('0x0'));var rp=require(_0xc5bd('0x1'));var util=require(_0xc5bd('0x2'));var intUtil=require('./util');var md5=require(_0xc5bd('0x3'));var Redis=require(_0xc5bd('0x4'));var logger=require(_0xc5bd('0x5'))(_0xc5bd('0x6'));var config=require(_0xc5bd('0x7'));config[_0xc5bd('0x8')]=_[_0xc5bd('0x9')](config[_0xc5bd('0x8')],{'host':_0xc5bd('0xa'),'port':0x18eb});var io=require(_0xc5bd('0xb'))(new Redis(config[_0xc5bd('0x8')]));function getAuthToken(_0x2bb41e,_0xc8ee67,_0x55d4bd){if(_0x2bb41e[_0xc5bd('0xc')]){_0x2bb41e[_0xc5bd('0xd')]=_0x2bb41e[_0xc5bd('0xe')][_0xc5bd('0xf')];_0x2bb41e[_0xc5bd('0x10')]=_0x2bb41e['CloudProvider'][_0xc5bd('0x11')];return Promise[_0xc5bd('0x12')](_0x2bb41e['CloudProvider'][_0xc5bd('0x13')]);}var _0x466ae7={'method':_0xc5bd('0x14'),'uri':_0xc8ee67,'form':{'client_id':_0x2bb41e[_0xc5bd('0x15')],'resource':_0x2bb41e[_0xc5bd('0xd')],'username':_0x2bb41e[_0xc5bd('0x16')],'password':_0x2bb41e[_0xc5bd('0x17')],'grant_type':_0xc5bd('0x17'),'client_secret':_0x2bb41e['clientSecret']},'json':!![]};return rp(_0x466ae7)[_0xc5bd('0x18')](function(_0x5b4475){return _0x5b4475[_0xc5bd('0x19')];})[_0xc5bd('0x1a')](function(_0x520c8a){logger[_0xc5bd('0x1b')]('['+[_0x55d4bd[_0xc5bd('0x1c')]()]+']\x20Wrong\x20credentials!');return _0x520c8a[_0xc5bd('0x1d')];});}function getUser(_0x53ab6b,_0x1e96b0,_0x183d50,_0x4c1b5e,_0x21576e,_0xb4d389){return new Promise(function(_0x5b01a3,_0x4f92ab){return getAuthToken(_0x1e96b0,_0x4c1b5e,_0xb4d389)['then'](function(_0x40736f){var _0x3f1981={'method':_0xc5bd('0x1e'),'uri':_0x21576e+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xc5bd('0x1f')+_0x40736f,'OData-Version':_0xc5bd('0x20')},'json':!![]};return rp(_0x3f1981);})[_0xc5bd('0x18')](function(_0x38a557){var _0x554dc2=_0x38a557[_0xc5bd('0x21')];var _0x29a1ce=![];var _0x33b44a=null;if(!_[_0xc5bd('0x22')](_0x183d50)){if(intUtil['validateEmail'](_0x183d50[_0xc5bd('0x23')])){_0x53ab6b['userEmail']=_0x183d50[_0xc5bd('0x23')];for(_0x33b44a=0x0;_0x33b44a<_0x554dc2[_0xc5bd('0x24')];_0x33b44a++){if(_0x554dc2[_0x33b44a][_0xc5bd('0x25')]===_0x183d50[_0xc5bd('0x23')]&&!_0x554dc2[_0x33b44a]['isdisabled']){_0x29a1ce=!![];logger[_0xc5bd('0x26')]('['+[_0xb4d389[_0xc5bd('0x1c')]()]+_0xc5bd('0x27')+_0x554dc2[_0x33b44a][_0xc5bd('0x28')]+'!');_0x53ab6b[_0xc5bd('0x29')]=_0x554dc2[_0x33b44a][_0xc5bd('0x28')];}}}}if(!_0x29a1ce){logger[_0xc5bd('0x26')]('['+[_0xb4d389['toUpperCase']()]+_0xc5bd('0x2a'));_0x53ab6b[_0xc5bd('0x2b')]=_0x1e96b0[_0xc5bd('0x16')];for(_0x33b44a=0x0;_0x33b44a<_0x554dc2[_0xc5bd('0x24')];_0x33b44a++){if(_0x554dc2[_0x33b44a][_0xc5bd('0x25')]===_0x1e96b0['username']){_0x53ab6b[_0xc5bd('0x29')]=_0x554dc2[_0x33b44a][_0xc5bd('0x28')];}}}_0x5b01a3(_0x53ab6b);})[_0xc5bd('0x1a')](function(_0x1d3b36){_0x4f92ab(_0x1d3b36['message']);});});}function createEndUser(_0x12c223,_0x5c8567,_0x2c316e,_0x1f1067,_0x3d6aa3,_0x53276d,_0x38443f){return new Promise(function(_0x21fb8c,_0x4d3273){return getAuthToken(_0x5c8567,_0x2c316e,_0x53276d)['then'](function(_0x52564d){var _0x9959c0=_0x53276d[_0xc5bd('0x2c')]()==='outbound'?_0x3d6aa3[_0xc5bd('0x2d')]:_0x3d6aa3[_0xc5bd('0x2e')];var _0x229438={'method':_0xc5bd('0x14'),'uri':_0x1f1067+_0xc5bd('0x2f'),'body':{'fullname':_0x9959c0,'firstname':_0x9959c0,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc5bd('0x30')+_0x12c223[_0xc5bd('0x29')]+')'},'headers':{'Authorization':_0xc5bd('0x1f')+_0x52564d,'OData-Version':_0xc5bd('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x229438[_0xc5bd('0x31')][_0x38443f]=_0x9959c0;return rp(_0x229438);})['then'](function(_0x58a0a0){var _0x4baa49=_0x58a0a0[_0xc5bd('0x32')][_0xc5bd('0x33')];var _0x3c5b90=_0x4baa49['substring'](_0x4baa49[_0xc5bd('0x34')]('(')+0x1,_0x4baa49[_0xc5bd('0x34')](')'));_0x12c223[_0xc5bd('0x35')]=_0x3c5b90;_0x21fb8c(_0x12c223);})[_0xc5bd('0x1a')](function(_0x102010){_0x4d3273(_0x102010[_0xc5bd('0x1d')]);});});}function getEndUser(_0x2553cb,_0x3576d2,_0x3e954b,_0x3b4c94,_0x5d3249,_0x2ad5d8,_0x14236b,_0x5793e2){var _0xd820a3=_0x2ad5d8[_0xc5bd('0x2c')]()===_0xc5bd('0x36')?_0x5d3249[_0xc5bd('0x2d')]:_0x5d3249[_0xc5bd('0x2e')];return getAuthToken(_0x3576d2,_0x3e954b,_0x2ad5d8)[_0xc5bd('0x18')](function(_0x23fabf){_0x5793e2=_0x5793e2?_0x5793e2:_0xc5bd('0x37');var _0x3c07e8={'method':_0xc5bd('0x1e'),'uri':_0x3b4c94+_0xc5bd('0x38')+_0x5793e2+_0xc5bd('0x39')+_0x5793e2+_0xc5bd('0x3a')+_0xd820a3[_0xc5bd('0x3b')]('+','%2b')+'\x27','headers':{'Authorization':_0xc5bd('0x1f')+_0x23fabf,'If-None-Match':null,'OData-Version':_0xc5bd('0x20')},'json':!![]};return rp(_0x3c07e8);})[_0xc5bd('0x18')](function(_0x511606){var _0x4b7ce8=![];if(!_0x511606)return _0x4b7ce8;var _0x18af53=_0x511606['value'];for(var _0x14de3b=0x0;_0x14de3b<_0x18af53[_0xc5bd('0x24')];_0x14de3b++){if(_0x18af53[_0x14de3b][_0x5793e2]===_0xd820a3){_0x4b7ce8=!![];_0x2553cb['enduserId']=_0x18af53[_0x14de3b][_0xc5bd('0x3c')];}}return _0x4b7ce8;})[_0xc5bd('0x18')](function(_0x56c79f){if(_0x56c79f)return _0x2553cb;if(_0x14236b===_0xc5bd('0x3d')){logger[_0xc5bd('0x26')]('['+[_0x2ad5d8[_0xc5bd('0x1c')]()]+_0xc5bd('0x3e'));return _0x2553cb;}return createEndUser(_0x2553cb,_0x3576d2,_0x3e954b,_0x3b4c94,_0x5d3249,_0x2ad5d8,_0x5793e2)[_0xc5bd('0x18')](function(_0x34e8e3){logger['info']('['+[_0x2ad5d8[_0xc5bd('0x1c')]()]+_0xc5bd('0x3f'),_0x34e8e3[_0xc5bd('0x35')]);return _0x34e8e3;});});}function getCustomFields(_0x1c0d6c,_0x15f10d,_0x213d86){var _0x4465ba={};if(_0x1c0d6c['length']>0x0){_[_0xc5bd('0x40')](_0x1c0d6c,function(_0x6d630f){if(_[_0xc5bd('0x41')]([_0xc5bd('0x42'),'picklist'],_0x6d630f['type'])&&_0x6d630f['nameField']&&!_0x6d630f['customField']){var _0x2982c1=_0x6d630f[_0xc5bd('0x43')][_0xc5bd('0x2c')]();var _0x327144=_0x2982c1[_0xc5bd('0x44')](0x0,_0x2982c1[_0xc5bd('0x45')]('_'));var _0x2d9808=_0x2982c1[_0xc5bd('0x44')](_0x2982c1[_0xc5bd('0x45')]('_')+0x1);if(_0x327144===_0x213d86){_0x4465ba[_0x2d9808]=_0x6d630f[_0xc5bd('0x46')];}}});}return _0x4465ba;}function getTicket(_0x35cb1e,_0x169c80,_0x4c6640,_0x47de63,_0x27b51a,_0xb677a4,_0x53924a){return new Promise(function(_0x4b7399,_0x14d7f1){var _0x573803;return getAuthToken(_0x169c80,_0x4c6640,_0x53924a)[_0xc5bd('0x18')](function(_0x15eff3){if(_0xb677a4[_0xc5bd('0x47')]===_0xc5bd('0x48')){_0x573803={'method':_0xc5bd('0x14'),'uri':_0x47de63+_0xc5bd('0x49'),'body':Object[_0xc5bd('0x4a')]({},{'title':intUtil[_0xc5bd('0x4b')](_0xb677a4[_0xc5bd('0x4c')],_0x27b51a,'\x20'),'description':intUtil[_0xc5bd('0x4b')](_0xb677a4['Descriptions'],_0x27b51a,'\x0a'),'customerid_contact@odata.bind':_0x35cb1e[_0xc5bd('0x35')]?_0xc5bd('0x4d')+_0x35cb1e[_0xc5bd('0x35')]+')':undefined,'ownerid@odata.bind':_0xc5bd('0x30')+_0x35cb1e[_0xc5bd('0x29')]+')','caseorigincode':'1'},getCustomFields(_0xb677a4['Fields'],_0x27b51a,_0xb677a4[_0xc5bd('0x47')])),'headers':{'Authorization':_0xc5bd('0x1f')+_0x15eff3,'OData-Version':_0xc5bd('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xb677a4['ticketType']===_0xc5bd('0x4e')){var _0x3a5245=_0x35cb1e[_0xc5bd('0x35')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x35cb1e[_0xc5bd('0x29')]+')','participationtypemask':_0x35cb1e[_0xc5bd('0x4f')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xc5bd('0x4d')+_0x35cb1e[_0xc5bd('0x35')]+')','participationtypemask':_0x35cb1e[_0xc5bd('0x4f')]===_0xc5bd('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x35cb1e[_0xc5bd('0x29')]+')','participationtypemask':_0x35cb1e[_0xc5bd('0x4f')]===_0xc5bd('0x50')?0x2:0x1}];_0x573803={'method':_0xc5bd('0x14'),'uri':_0x47de63+'phonecalls','body':Object[_0xc5bd('0x4a')]({},{'subject':intUtil[_0xc5bd('0x4b')](_0xb677a4['Subjects'],_0x27b51a,'\x20'),'phonenumber':String(_0x27b51a['calleridnum']),'description':intUtil[_0xc5bd('0x4b')](_0xb677a4[_0xc5bd('0x51')],_0x27b51a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x35cb1e[_0xc5bd('0x35')]?_0xc5bd('0x4d')+_0x35cb1e[_0xc5bd('0x35')]+')':undefined,'ownerid@odata.bind':_0xc5bd('0x30')+_0x35cb1e[_0xc5bd('0x29')]+')','directioncode':_0x35cb1e['callDirection']===_0xc5bd('0x50')?![]:!![],'phonecall_activity_parties':_0x3a5245},getCustomFields(_0xb677a4[_0xc5bd('0x52')],_0x27b51a,_0xb677a4[_0xc5bd('0x47')])),'headers':{'Authorization':_0xc5bd('0x1f')+_0x15eff3,'OData-Version':_0xc5bd('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x573803);})[_0xc5bd('0x18')](function(_0x2854f0){var _0x2ce991=_0x2854f0[_0xc5bd('0x32')]['odata-entityid'];var _0x52e3ab=_0x2ce991[_0xc5bd('0x44')](_0x2ce991[_0xc5bd('0x34')]('(')+0x1,_0x2ce991[_0xc5bd('0x34')](')'));_0x35cb1e['ticketId']=_0x52e3ab;_0x4b7399(_0x35cb1e);})['catch'](function(_0x58ee31){_0x14d7f1(_0x58ee31[_0xc5bd('0x1d')]);});});}function emit(_0x2272c7,_0x4081db,_0x169a14,_0xf37c90){var _0x8c845e={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x2272c7,_0x169a14,_0xf37c90)};io['to'](util[_0xc5bd('0x53')]('user:%s',_0x4081db))[_0xc5bd('0x54')]('trigger:browser:url',_0x8c845e);}exports['cs']=function(_0x4b7079,_0x82c231,_0x5978a6,_0x247e4e,_0x543a7e,_0x33751e,_0x3aa1e9,_0x58806a){var _0x2b2e7f={};_0x33751e[_0xc5bd('0xd')]=_0x33751e['modernAuthentication']?intUtil[_0xc5bd('0x55')](_0x33751e[_0xc5bd('0xe')][_0xc5bd('0xf')]):intUtil[_0xc5bd('0x55')](_0x33751e['remoteUri']);_0x33751e[_0xc5bd('0x56')]=intUtil[_0xc5bd('0x55')](_0x33751e[_0xc5bd('0x56')]);_0x2b2e7f[_0xc5bd('0x4f')]=_0x58806a===_0xc5bd('0x50')||_0x58806a==='unmanaged'?'queue':_0xc5bd('0x36');var _0x39f3b4=_0x33751e[_0xc5bd('0xc')]?util[_0xc5bd('0x53')]('%s/api/data/v9.0/',_0x33751e[_0xc5bd('0xe')]['data7']):util['format']('%s/api/data/v9.0/',_0x33751e[_0xc5bd('0xd')]);var _0xd2286a=util[_0xc5bd('0x53')](_0xc5bd('0x57'),_0x33751e['tenantId']);var _0x2c39ec=util[_0xc5bd('0x53')](_0xc5bd('0x58'),_0x33751e[_0xc5bd('0x56')],_0x82c231[_0xc5bd('0x59')],md5(_0x82c231[_0xc5bd('0x59')]));if(_0x543a7e&&_0x543a7e['monitor_format']){logger['info'](_0xc5bd('0x5a'),_0xc5bd('0x5b'));_0x82c231[_0xc5bd('0x5c')]=_0x2c39ec;}else if(_0x3aa1e9&&_0x3aa1e9[_0xc5bd('0x5d')]&&_0x3aa1e9[_0xc5bd('0x5d')]!=='none'){logger['info'](_0xc5bd('0x5e'),_0xc5bd('0x5b'));_0x82c231['recordingURL']=_0x2c39ec;}else{_0x82c231[_0xc5bd('0x5c')]='';}return getUser(_0x2b2e7f,_0x33751e,_0x247e4e,_0xd2286a,_0x39f3b4,_0x58806a)[_0xc5bd('0x18')](function(_0x83b1fe){logger[_0xc5bd('0x26')]('['+_0x58806a[_0xc5bd('0x1c')]()+_0xc5bd('0x5f'),_0x83b1fe[_0xc5bd('0x29')]);logger[_0xc5bd('0x26')]('['+_0x58806a[_0xc5bd('0x1c')]()+']\x20The\x20User\x20email\x20is:',_0x83b1fe[_0xc5bd('0x2b')]);return getEndUser(_0x83b1fe,_0x33751e,_0xd2286a,_0x39f3b4,_0x82c231,_0x58806a,_0x5978a6[_0xc5bd('0x60')],_0x5978a6[_0xc5bd('0x61')]);})[_0xc5bd('0x18')](function(_0x674b0e){logger[_0xc5bd('0x26')]('['+_0x58806a['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x674b0e[_0xc5bd('0x35')]);logger[_0xc5bd('0x26')]('['+_0x58806a[_0xc5bd('0x1c')]()+_0xc5bd('0x62'),_0x82c231[_0xc5bd('0x2e')]);return getTicket(_0x674b0e,_0x33751e,_0xd2286a,_0x39f3b4,_0x82c231,_0x5978a6,_0x58806a);})['then'](function(_0x44c8b3){logger['info'](util[_0xc5bd('0x53')]('['+_0x58806a[_0xc5bd('0x1c')]()+_0xc5bd('0x63'),_0x5978a6[_0xc5bd('0x47')],_0x44c8b3['ticketId']));logger['info'](util[_0xc5bd('0x53')]('['+_0x58806a[_0xc5bd('0x1c')]()+_0xc5bd('0x64'),_0x58806a));if(_0x58806a!=='unmanaged'&&_0x5978a6['openNewTab']){logger[_0xc5bd('0x26')]('['+_0x58806a[_0xc5bd('0x1c')]()+']',_0xc5bd('0x65'));emit(_0x33751e[_0xc5bd('0xd')],_0x247e4e[_0xc5bd('0x66')],_0x5978a6[_0xc5bd('0x47')],_0x44c8b3[_0xc5bd('0x67')]);}})[_0xc5bd('0x1a')](function(_0x1ba0ed){logger[_0xc5bd('0x1b')]('['+_0x58806a[_0xc5bd('0x1c')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x1ba0ed[_0xc5bd('0x1d')]);console[_0xc5bd('0x1b')](_0xc5bd('0x68'),_0x1ba0ed);});}; \ No newline at end of file +var _0x3bfb=[']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','GET','Bearer\x20','value','isNil','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','systemuserid','message','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','4.0','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','nameField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','phonecall','callDirection','queue','phonecalls','Fields','ticketId','format','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','tenantId','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name'];(function(_0x2ea1d6,_0x3d6da4){var _0x238aad=function(_0x4c01ba){while(--_0x4c01ba){_0x2ea1d6['push'](_0x2ea1d6['shift']());}};_0x238aad(++_0x3d6da4);}(_0x3bfb,0x6d));var _0xb3bf=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0x3bfb[_0x5b26cb];return _0x563d12;};'use strict';var _=require(_0xb3bf('0x0'));var rp=require(_0xb3bf('0x1'));var util=require('util');var intUtil=require(_0xb3bf('0x2'));var md5=require(_0xb3bf('0x3'));var Redis=require(_0xb3bf('0x4'));var logger=require(_0xb3bf('0x5'))('dynamics365');var config=require(_0xb3bf('0x6'));config[_0xb3bf('0x7')]=_['defaults'](config[_0xb3bf('0x7')],{'host':_0xb3bf('0x8'),'port':0x18eb});var io=require(_0xb3bf('0x9'))(new Redis(config[_0xb3bf('0x7')]));function getAuthToken(_0x3a832b,_0x6eedb,_0x3c0b22){if(_0x3a832b[_0xb3bf('0xa')]){_0x3a832b['remoteUri']=_0x3a832b[_0xb3bf('0xb')][_0xb3bf('0xc')];_0x3a832b['tenantId']=_0x3a832b[_0xb3bf('0xb')][_0xb3bf('0xd')];return Promise[_0xb3bf('0xe')](_0x3a832b[_0xb3bf('0xb')][_0xb3bf('0xf')]);}var _0x39f780={'method':_0xb3bf('0x10'),'uri':_0x6eedb,'form':{'client_id':_0x3a832b[_0xb3bf('0x11')],'resource':_0x3a832b[_0xb3bf('0x12')],'username':_0x3a832b[_0xb3bf('0x13')],'password':_0x3a832b[_0xb3bf('0x14')],'grant_type':'password','client_secret':_0x3a832b[_0xb3bf('0x15')]},'json':!![]};return rp(_0x39f780)['then'](function(_0x342389){return _0x342389['access_token'];})[_0xb3bf('0x16')](function(_0x54175c){logger[_0xb3bf('0x17')]('['+[_0x3c0b22[_0xb3bf('0x18')]()]+_0xb3bf('0x19'));return _0x54175c['message'];});}function getUser(_0x53c2b9,_0x41c3cf,_0x5d7e2e,_0x3cbfac,_0x5b6295,_0x5e7433){return new Promise(function(_0x350c50,_0x286f06){return getAuthToken(_0x41c3cf,_0x3cbfac,_0x5e7433)[_0xb3bf('0x1a')](function(_0x411ce4){var _0x4c648f={'method':_0xb3bf('0x1b'),'uri':_0x5b6295+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xb3bf('0x1c')+_0x411ce4,'OData-Version':'4.0'},'json':!![]};return rp(_0x4c648f);})['then'](function(_0x7e6b4c){var _0x170fc3=_0x7e6b4c[_0xb3bf('0x1d')];var _0x26f568=![];var _0x5d31c9=null;if(!_[_0xb3bf('0x1e')](_0x5d7e2e)){if(intUtil['validateEmail'](_0x5d7e2e[_0xb3bf('0x1f')])){_0x53c2b9[_0xb3bf('0x20')]=_0x5d7e2e['email'];for(_0x5d31c9=0x0;_0x5d31c9<_0x170fc3[_0xb3bf('0x21')];_0x5d31c9++){if(_0x170fc3[_0x5d31c9][_0xb3bf('0x22')]===_0x5d7e2e[_0xb3bf('0x1f')]&&!_0x170fc3[_0x5d31c9][_0xb3bf('0x23')]){_0x26f568=!![];logger['info']('['+[_0x5e7433[_0xb3bf('0x18')]()]+_0xb3bf('0x24')+_0x170fc3[_0x5d31c9]['systemuserid']+'!');_0x53c2b9['userId']=_0x170fc3[_0x5d31c9]['systemuserid'];}}}}if(!_0x26f568){logger[_0xb3bf('0x25')]('['+[_0x5e7433[_0xb3bf('0x18')]()]+_0xb3bf('0x26'));_0x53c2b9['userEmail']=_0x41c3cf[_0xb3bf('0x13')];for(_0x5d31c9=0x0;_0x5d31c9<_0x170fc3[_0xb3bf('0x21')];_0x5d31c9++){if(_0x170fc3[_0x5d31c9][_0xb3bf('0x22')]===_0x41c3cf[_0xb3bf('0x13')]){_0x53c2b9[_0xb3bf('0x27')]=_0x170fc3[_0x5d31c9][_0xb3bf('0x28')];}}}_0x350c50(_0x53c2b9);})[_0xb3bf('0x16')](function(_0x5702a3){_0x286f06(_0x5702a3[_0xb3bf('0x29')]);});});}function createEndUser(_0xcfc4cd,_0x1fa976,_0x39f3f0,_0x33c07f,_0x3267df,_0x161ce4,_0x3bf9f4){return new Promise(function(_0x171d56,_0x2d14ac){return getAuthToken(_0x1fa976,_0x39f3f0,_0x161ce4)[_0xb3bf('0x1a')](function(_0x5ce2fb){var _0x10a4d3=_0x161ce4[_0xb3bf('0x2a')]()==='outbound'?_0x3267df[_0xb3bf('0x2b')]:_0x3267df[_0xb3bf('0x2c')];var _0xe6b37d={'method':_0xb3bf('0x10'),'uri':_0x33c07f+_0xb3bf('0x2d'),'body':{'fullname':_0x10a4d3,'firstname':_0x10a4d3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb3bf('0x2e')+_0xcfc4cd[_0xb3bf('0x27')]+')'},'headers':{'Authorization':_0xb3bf('0x1c')+_0x5ce2fb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0xe6b37d[_0xb3bf('0x2f')][_0x3bf9f4]=_0x10a4d3;return rp(_0xe6b37d);})[_0xb3bf('0x1a')](function(_0x54838a){var _0x207ce9=_0x54838a[_0xb3bf('0x30')][_0xb3bf('0x31')];var _0x16da92=_0x207ce9[_0xb3bf('0x32')](_0x207ce9[_0xb3bf('0x33')]('(')+0x1,_0x207ce9[_0xb3bf('0x33')](')'));_0xcfc4cd[_0xb3bf('0x34')]=_0x16da92;_0x171d56(_0xcfc4cd);})[_0xb3bf('0x16')](function(_0x48fedf){_0x2d14ac(_0x48fedf[_0xb3bf('0x29')]);});});}function getEndUser(_0x28ad01,_0x315d45,_0x2741c7,_0x149dd4,_0x51716a,_0x4e6077,_0x2129f2,_0x31a9ea){var _0x221a5e=_0x4e6077[_0xb3bf('0x2a')]()===_0xb3bf('0x35')?_0x51716a[_0xb3bf('0x2b')]:_0x51716a['calleridnum'];return getAuthToken(_0x315d45,_0x2741c7,_0x4e6077)[_0xb3bf('0x1a')](function(_0x1dbd37){_0x31a9ea=_0x31a9ea?_0x31a9ea:_0xb3bf('0x36');var _0x21e71a={'method':_0xb3bf('0x1b'),'uri':_0x149dd4+'contacts?$select='+_0x31a9ea+_0xb3bf('0x37')+_0x31a9ea+_0xb3bf('0x38')+_0x221a5e[_0xb3bf('0x39')]('+',_0xb3bf('0x3a'))+'\x27','headers':{'Authorization':_0xb3bf('0x1c')+_0x1dbd37,'If-None-Match':null,'OData-Version':_0xb3bf('0x3b')},'json':!![]};return rp(_0x21e71a);})[_0xb3bf('0x1a')](function(_0x5ad681){var _0x53169f=![];if(!_0x5ad681)return _0x53169f;var _0x55cdb5=_0x5ad681[_0xb3bf('0x1d')];for(var _0x5b079c=0x0;_0x5b079c<_0x55cdb5[_0xb3bf('0x21')];_0x5b079c++){if(_0x55cdb5[_0x5b079c][_0x31a9ea]===_0x221a5e){_0x53169f=!![];_0x28ad01[_0xb3bf('0x34')]=_0x55cdb5[_0x5b079c][_0xb3bf('0x3c')];}}return _0x53169f;})[_0xb3bf('0x1a')](function(_0x26243b){if(_0x26243b)return _0x28ad01;if(_0x2129f2===_0xb3bf('0x3d')){logger[_0xb3bf('0x25')]('['+[_0x4e6077[_0xb3bf('0x18')]()]+_0xb3bf('0x3e'));return _0x28ad01;}return createEndUser(_0x28ad01,_0x315d45,_0x2741c7,_0x149dd4,_0x51716a,_0x4e6077,_0x31a9ea)[_0xb3bf('0x1a')](function(_0x10ee25){logger[_0xb3bf('0x25')]('['+[_0x4e6077[_0xb3bf('0x18')]()]+_0xb3bf('0x3f'),_0x10ee25[_0xb3bf('0x34')]);return _0x10ee25;});});}function getCustomFields(_0x3b806c,_0x289cde,_0x31b997){var _0xe31e33={};if(_0x3b806c[_0xb3bf('0x21')]>0x0){_[_0xb3bf('0x40')](_0x3b806c,function(_0x4ae393){if(_[_0xb3bf('0x41')](['string','picklist'],_0x4ae393['type'])&&_0x4ae393[_0xb3bf('0x42')]&&!_0x4ae393['customField']){var _0x77c0c5=_0x4ae393[_0xb3bf('0x43')][_0xb3bf('0x2a')]();var _0x3475ae=_0x77c0c5['substring'](0x0,_0x77c0c5[_0xb3bf('0x44')]('_'));var _0x1ccf3c=_0x77c0c5[_0xb3bf('0x32')](_0x77c0c5[_0xb3bf('0x44')]('_')+0x1);if(_0x3475ae===_0x31b997){_0xe31e33[_0x1ccf3c]=_0x4ae393[_0xb3bf('0x45')];}}});}return _0xe31e33;}function getTicket(_0x544e7e,_0x1bc006,_0x5bda56,_0x2ce0e8,_0x3b2b7c,_0x2304ed,_0x585cd3){return new Promise(function(_0x4ff700,_0x1922ef){var _0x3d66aa;return getAuthToken(_0x1bc006,_0x5bda56,_0x585cd3)[_0xb3bf('0x1a')](function(_0x29e1c0){if(_0x2304ed[_0xb3bf('0x46')]===_0xb3bf('0x47')){_0x3d66aa={'method':_0xb3bf('0x10'),'uri':_0x2ce0e8+_0xb3bf('0x48'),'body':Object['assign']({},{'title':intUtil[_0xb3bf('0x49')](_0x2304ed[_0xb3bf('0x4a')],_0x3b2b7c,'\x20'),'description':intUtil[_0xb3bf('0x49')](_0x2304ed[_0xb3bf('0x4b')],_0x3b2b7c,'\x0a'),'customerid_contact@odata.bind':_0x544e7e['enduserId']?_0xb3bf('0x4c')+_0x544e7e[_0xb3bf('0x34')]+')':undefined,'ownerid@odata.bind':_0xb3bf('0x2e')+_0x544e7e[_0xb3bf('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x2304ed['Fields'],_0x3b2b7c,_0x2304ed['ticketType'])),'headers':{'Authorization':_0xb3bf('0x1c')+_0x29e1c0,'OData-Version':_0xb3bf('0x3b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2304ed['ticketType']===_0xb3bf('0x4d')){var _0x2aebec=_0x544e7e[_0xb3bf('0x34')]?[{'partyid_systemuser@odata.bind':_0xb3bf('0x2e')+_0x544e7e[_0xb3bf('0x27')]+')','participationtypemask':_0x544e7e[_0xb3bf('0x4e')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xb3bf('0x4c')+_0x544e7e[_0xb3bf('0x34')]+')','participationtypemask':_0x544e7e[_0xb3bf('0x4e')]===_0xb3bf('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb3bf('0x2e')+_0x544e7e['userId']+')','participationtypemask':_0x544e7e[_0xb3bf('0x4e')]==='queue'?0x2:0x1}];_0x3d66aa={'method':_0xb3bf('0x10'),'uri':_0x2ce0e8+_0xb3bf('0x50'),'body':Object['assign']({},{'subject':intUtil[_0xb3bf('0x49')](_0x2304ed[_0xb3bf('0x4a')],_0x3b2b7c,'\x20'),'phonenumber':String(_0x3b2b7c[_0xb3bf('0x2c')]),'description':intUtil[_0xb3bf('0x49')](_0x2304ed[_0xb3bf('0x4b')],_0x3b2b7c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x544e7e[_0xb3bf('0x34')]?_0xb3bf('0x4c')+_0x544e7e[_0xb3bf('0x34')]+')':undefined,'ownerid@odata.bind':_0xb3bf('0x2e')+_0x544e7e[_0xb3bf('0x27')]+')','directioncode':_0x544e7e[_0xb3bf('0x4e')]===_0xb3bf('0x4f')?![]:!![],'phonecall_activity_parties':_0x2aebec},getCustomFields(_0x2304ed[_0xb3bf('0x51')],_0x3b2b7c,_0x2304ed[_0xb3bf('0x46')])),'headers':{'Authorization':_0xb3bf('0x1c')+_0x29e1c0,'OData-Version':_0xb3bf('0x3b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3d66aa);})['then'](function(_0xa65dc5){var _0xafd5b9=_0xa65dc5[_0xb3bf('0x30')][_0xb3bf('0x31')];var _0x5c06e1=_0xafd5b9[_0xb3bf('0x32')](_0xafd5b9[_0xb3bf('0x33')]('(')+0x1,_0xafd5b9[_0xb3bf('0x33')](')'));_0x544e7e[_0xb3bf('0x52')]=_0x5c06e1;_0x4ff700(_0x544e7e);})[_0xb3bf('0x16')](function(_0x48d3cd){_0x1922ef(_0x48d3cd[_0xb3bf('0x29')]);});});}function emit(_0x285cc0,_0x3db70a,_0x3615e5,_0x42f0eb){var _0x5c0fb0={'uri':util[_0xb3bf('0x53')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x285cc0,_0x3615e5,_0x42f0eb)};io['to'](util[_0xb3bf('0x53')]('user:%s',_0x3db70a))['emit'](_0xb3bf('0x54'),_0x5c0fb0);}exports['cs']=function(_0x38ac9e,_0x30b49d,_0x42398f,_0x4950c7,_0x3d8edf,_0x3c78c2,_0x146156,_0x332f70){var _0x13b003={};_0x3c78c2[_0xb3bf('0x12')]=_0x3c78c2['modernAuthentication']?intUtil[_0xb3bf('0x55')](_0x3c78c2['CloudProvider']['data7']):intUtil[_0xb3bf('0x55')](_0x3c78c2[_0xb3bf('0x12')]);_0x3c78c2['serverUrl']=intUtil[_0xb3bf('0x55')](_0x3c78c2[_0xb3bf('0x56')]);_0x13b003[_0xb3bf('0x4e')]=_0x332f70===_0xb3bf('0x4f')||_0x332f70==='unmanaged'?_0xb3bf('0x4f'):_0xb3bf('0x35');var _0xf1ad08=_0x3c78c2[_0xb3bf('0xa')]?util[_0xb3bf('0x53')](_0xb3bf('0x57'),_0x3c78c2[_0xb3bf('0xb')][_0xb3bf('0xc')]):util['format'](_0xb3bf('0x57'),_0x3c78c2[_0xb3bf('0x12')]);var _0x2c85bc=util[_0xb3bf('0x53')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3c78c2[_0xb3bf('0x58')]);var _0x3f3b67=util[_0xb3bf('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c78c2['serverUrl'],_0x30b49d['uniqueid'],md5(_0x30b49d['uniqueid']));if(_0x3d8edf&&_0x3d8edf[_0xb3bf('0x59')]){logger[_0xb3bf('0x25')](_0xb3bf('0x5a'),_0xb3bf('0x5b'));_0x30b49d[_0xb3bf('0x5c')]=_0x3f3b67;}else if(_0x146156&&_0x146156[_0xb3bf('0x5d')]&&_0x146156[_0xb3bf('0x5d')]!==_0xb3bf('0x5e')){logger[_0xb3bf('0x25')](_0xb3bf('0x5f'),_0xb3bf('0x5b'));_0x30b49d[_0xb3bf('0x5c')]=_0x3f3b67;}else{_0x30b49d['recordingURL']='';}return getUser(_0x13b003,_0x3c78c2,_0x4950c7,_0x2c85bc,_0xf1ad08,_0x332f70)[_0xb3bf('0x1a')](function(_0x168a4c){logger[_0xb3bf('0x25')]('['+_0x332f70[_0xb3bf('0x18')]()+_0xb3bf('0x60'),_0x168a4c[_0xb3bf('0x27')]);logger['info']('['+_0x332f70[_0xb3bf('0x18')]()+_0xb3bf('0x61'),_0x168a4c[_0xb3bf('0x20')]);return getEndUser(_0x168a4c,_0x3c78c2,_0x2c85bc,_0xf1ad08,_0x30b49d,_0x332f70,_0x42398f[_0xb3bf('0x62')],_0x42398f[_0xb3bf('0x63')]);})[_0xb3bf('0x1a')](function(_0x109f39){logger[_0xb3bf('0x25')]('['+_0x332f70['toUpperCase']()+_0xb3bf('0x64'),_0x109f39['enduserId']);logger[_0xb3bf('0x25')]('['+_0x332f70[_0xb3bf('0x18')]()+_0xb3bf('0x65'),_0x30b49d[_0xb3bf('0x2c')]);return getTicket(_0x109f39,_0x3c78c2,_0x2c85bc,_0xf1ad08,_0x30b49d,_0x42398f,_0x332f70);})[_0xb3bf('0x1a')](function(_0x2c1180){logger[_0xb3bf('0x25')](util['format']('['+_0x332f70['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x42398f['ticketType'],_0x2c1180['ticketId']));logger[_0xb3bf('0x25')](util[_0xb3bf('0x53')]('['+_0x332f70[_0xb3bf('0x18')]()+']\x20Call\x20direction:\x20%s',_0x332f70));if(_0x332f70!==_0xb3bf('0x66')&&_0x42398f['openNewTab']){logger[_0xb3bf('0x25')]('['+_0x332f70['toUpperCase']()+']',_0xb3bf('0x67'));emit(_0x3c78c2['remoteUri'],_0x4950c7[_0xb3bf('0x68')],_0x42398f['ticketType'],_0x2c1180['ticketId']);}})[_0xb3bf('0x16')](function(_0x2f88a2){logger[_0xb3bf('0x17')]('['+_0x332f70[_0xb3bf('0x18')]()+_0xb3bf('0x69'),_0x2f88a2[_0xb3bf('0x29')]);console['error'](_0xb3bf('0x6a'),_0x2f88a2);});}; \ 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 d0ce791..b625761 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 _0x6aed=['./util','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','name','Fields','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','customField','nameField','idField','push','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','The\x20Ticket\x20ID\x20is:','unmanaged','toUpperCase','lastevent','request-promise','md5','util','ioredis'];(function(_0x51ab40,_0x44a12d){var _0x21ab1a=function(_0x1430c1){while(--_0x1430c1){_0x51ab40['push'](_0x51ab40['shift']());}};_0x21ab1a(++_0x44a12d);}(_0x6aed,0xb0));var _0xd6ae=function(_0xee5d0d,_0x362125){_0xee5d0d=_0xee5d0d-0x0;var _0x48f7b2=_0x6aed[_0xee5d0d];return _0x48f7b2;};'use strict';var _=require('lodash');var rp=require(_0xd6ae('0x0'));var md5=require(_0xd6ae('0x1'));var util=require(_0xd6ae('0x2'));var Redis=require(_0xd6ae('0x3'));var intUtil=require(_0xd6ae('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xd6ae('0x5'));config[_0xd6ae('0x6')]=_[_0xd6ae('0x7')](config[_0xd6ae('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xd6ae('0x8'))(new Redis(config[_0xd6ae('0x6')]));var headers={'Content-Type':_0xd6ae('0x9'),'Accept':'application/json'};function emit(_0x54f90d,_0x2f6541,_0x23695b){io['to'](_0x54f90d)[_0xd6ae('0xa')](_0x2f6541,_0x23695b);}function getTicket(_0x4ac540,_0x2c5af5,_0x3fd87b,_0x49ebb9,_0x1c2091){logger[_0xd6ae('0xb')](_0xd6ae('0xc'));var _0x10a139=_[_0xd6ae('0xd')]({'responder_id':_0x2c5af5['id'],'requester_id':_0x3fd87b['id'],'name':util[_0xd6ae('0xe')](_0xd6ae('0xf'),_0x1c2091[_0xd6ae('0x10')]),'phone':_0x1c2091[_0xd6ae('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd6ae('0x12')](_0x49ebb9[_0xd6ae('0x13')],_0x1c2091,'\x20'),'description':intUtil[_0xd6ae('0x12')](_0x49ebb9['Descriptions'],_0x1c2091,_0xd6ae('0x14')),'tags':getTags(_0x49ebb9['Tags'],_0xd6ae('0x15'))},getCustomFields(_0x49ebb9[_0xd6ae('0x16')],_0x1c2091));_0x10a139[_0xd6ae('0x17')]=_[_0xd6ae('0x18')](_['keyBy'](_0x10a139['custom_fields'],'id'),'value');return request({'uri':util[_0xd6ae('0xe')](_0xd6ae('0x19'),_0x4ac540[_0xd6ae('0x1a')]),'method':_0xd6ae('0x1b'),'body':_0x10a139})[_0xd6ae('0x1c')](function(_0x2eb507){logger['info'](_0xd6ae('0x1d'));return _0x2eb507;});}function getUser(_0x15e83f,_0x2550bf){if(intUtil[_0xd6ae('0x1e')](_0x2550bf)){return request({'uri':util[_0xd6ae('0xe')](_0xd6ae('0x1f'),_0x15e83f[_0xd6ae('0x1a')]),'qs':{'email':_0x2550bf}})[_0xd6ae('0x1c')](function(_0xff24c){if(_0xff24c[_0xd6ae('0x20')]){logger[_0xd6ae('0xb')](_0xd6ae('0x21'));return _[_0xd6ae('0x22')](_0xff24c,function(_0x415a0c){return _0x415a0c['contact'][_0xd6ae('0x23')]===_0x2550bf;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd6ae('0xe')](_0xd6ae('0x24'),_0x15e83f[_0xd6ae('0x1a')])})['then'](function(_0x5f4923){logger[_0xd6ae('0xb')]('Admin\x20account\x20selected.');return _0x5f4923;});}});}else{logger[_0xd6ae('0xb')](_0xd6ae('0x25'));return request({'uri':util[_0xd6ae('0xe')](_0xd6ae('0x24'),_0x15e83f[_0xd6ae('0x1a')])})['then'](function(_0x403ae8){logger[_0xd6ae('0xb')](_0xd6ae('0x26'));return _0x403ae8;});}}function getEndUser(_0x1306af,_0x26e98d,_0x2ec689){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2ec689);return request({'uri':util['format']('%s/api/v2/contacts',_0x1306af[_0xd6ae('0x1a')]),'qs':{'phone':_0x2ec689}})[_0xd6ae('0x1c')](function(_0x17b564){if(_0x17b564[_0xd6ae('0x20')]){logger[_0xd6ae('0xb')](_0xd6ae('0x27'));return _[_0xd6ae('0x22')](_0x17b564,{'phone':_0x2ec689});}else{logger[_0xd6ae('0xb')](_0xd6ae('0x28'));return request({'uri':util[_0xd6ae('0xe')]('%s/api/v2/contacts',_0x1306af[_0xd6ae('0x1a')]),'method':'POST','body':{'name':_0x26e98d,'phone':_0x2ec689}})['then'](function(_0x20fb84){logger['info'](_0xd6ae('0x29'));return _0x20fb84;});}});}function getAuth(_0x33f849){return util['format'](_0xd6ae('0x2a'),new Buffer(_0x33f849[_0xd6ae('0x2b')]+':X')[_0xd6ae('0x2c')](_0xd6ae('0x2d')));}function request(_0x5b599d){logger[_0xd6ae('0x2e')](_0xd6ae('0x2f'),JSON[_0xd6ae('0x30')](_0x5b599d));return rp(_[_0xd6ae('0x7')](_0x5b599d,{'method':_0xd6ae('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x53f11f,_0xdcb27){var _0x2515ba=[];if(_0x53f11f&&_0x53f11f['length']>0x0){_0x2515ba=_[_0xd6ae('0x32')](_0x53f11f,_0xdcb27);}return _0x2515ba;}function getCustomFields(_0x2a40c9,_0x2d3e9b){var _0x60efdd=[];var _0x4aacee={'custom_fields':[]};if(_0x2a40c9['length']>0x0){_[_0xd6ae('0x33')](_0x2a40c9,function(_0x1beff8){if(_[_0xd6ae('0x34')]([_0xd6ae('0x35'),_0xd6ae('0x36')],_0x1beff8[_0xd6ae('0x37')])&&_0x1beff8['nameField']&&!_0x1beff8[_0xd6ae('0x38')]){_0x4aacee[_0x1beff8[_0xd6ae('0x39')]['toLowerCase']()]=_0x1beff8['content'][_0xd6ae('0x2c')]();}else if(_[_0xd6ae('0x34')](['string',_0xd6ae('0x36')],_0x1beff8[_0xd6ae('0x37')])&&_0x1beff8[_0xd6ae('0x3a')]&&_0x1beff8[_0xd6ae('0x38')]){_0x4aacee[_0xd6ae('0x17')][_0xd6ae('0x3b')]({'id':_0x1beff8['idField'],'value':_0x1beff8['content'][_0xd6ae('0x2c')]()});}else if(_0x1beff8[_0xd6ae('0x37')]==='variable'&&_0x1beff8[_0xd6ae('0x3c')]&&_0x1beff8['idField']&&_0x1beff8[_0xd6ae('0x38')]){_0x2d3e9b[_0x1beff8['variableName']]&&_0x4aacee['custom_fields']['push']({'id':_0x1beff8[_0xd6ae('0x3a')],'value':_0x2d3e9b[_0x1beff8['variableName']][_0xd6ae('0x2c')]()});}else if(_0x1beff8[_0xd6ae('0x37')]===_0xd6ae('0x3d')&&_0x1beff8[_0xd6ae('0x3e')]&&_0x1beff8[_0xd6ae('0x3e')][_0xd6ae('0x15')]&&_0x1beff8[_0xd6ae('0x3a')]&&_0x1beff8[_0xd6ae('0x38')]){_0x2d3e9b[_0x1beff8['Variable'][_0xd6ae('0x15')]['toLowerCase']()]&&_0x4aacee[_0xd6ae('0x17')][_0xd6ae('0x3b')]({'id':_0x1beff8[_0xd6ae('0x3a')],'value':_0x2d3e9b[_0x1beff8[_0xd6ae('0x3e')][_0xd6ae('0x15')][_0xd6ae('0x3f')]()][_0xd6ae('0x2c')]()});}});}return _0x4aacee;}exports[_0xd6ae('0x40')]=function(_0x2d3dc8,_0xdd289c,_0x2a6b29,_0x50b6c4,_0x50530b,_0x136dac){var _0x208d32,_0x17ecc3;_0x136dac[_0xd6ae('0x1a')]=intUtil[_0xd6ae('0x41')](_0x136dac[_0xd6ae('0x1a')]);_0x136dac[_0xd6ae('0x42')]=intUtil[_0xd6ae('0x41')](_0x136dac[_0xd6ae('0x42')]);if(_0x50530b&&_0x50530b['monitor_format']){logger[_0xd6ae('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0xdd289c[_0xd6ae('0x43')]=util['format'](_0xd6ae('0x44'),_0x136dac[_0xd6ae('0x42')],_0xdd289c[_0xd6ae('0x45')],md5(_0xdd289c[_0xd6ae('0x45')]));}else{_0xdd289c['recordingURL']='';}headers[_0xd6ae('0x46')]=getAuth(_0x136dac);return getUser(_0x136dac,_0x50b6c4['email'])[_0xd6ae('0x1c')](function(_0x4ae2b8){_0x208d32=_0x4ae2b8;logger[_0xd6ae('0xb')](_0xd6ae('0x47'),_0x208d32['id']);return getEndUser(_0x136dac,_0xdd289c[_0xd6ae('0x10')],_0xdd289c['calleridnum']);})[_0xd6ae('0x1c')](function(_0x191aca){_0x17ecc3=_0x191aca;logger['info'](_0xd6ae('0x48'),_0x17ecc3['id']);return getTicket(_0x136dac,_0x208d32,_0x17ecc3,_0x2a6b29,_0xdd289c);})[_0xd6ae('0x1c')](function(_0x554336){if(_0x554336&&_0x554336['id']){logger[_0xd6ae('0xb')]('Ticket\x20created!');logger[_0xd6ae('0xb')]('The\x20Ticket\x20ID\x20is:',_0x554336['id']);logger[_0xd6ae('0xb')](_0xd6ae('0x49'),_0xd6ae('0x4a'));emit(util[_0xd6ae('0xe')](_0xd6ae('0x4b'),_0x50b6c4[_0xd6ae('0x15')]),_0xd6ae('0x4c'),{'uri':util[_0xd6ae('0xe')](_0xd6ae('0x4d'),_0x136dac[_0xd6ae('0x1a')],_0x554336['id'])});}})[_0xd6ae('0x4e')](function(_0x385744){logger[_0xd6ae('0x4f')](_0xd6ae('0x49'),JSON['stringify'](_0x385744));});};exports[_0xd6ae('0x50')]=function(_0x14cbcc,_0x362bf0,_0x4c1ee1,_0x2fd37a,_0x527b8f,_0x38117c,_0x1fa32d){var _0x394d27,_0x364ade;_0x38117c[_0xd6ae('0x1a')]=intUtil[_0xd6ae('0x41')](_0x38117c[_0xd6ae('0x1a')]);_0x38117c['serverUrl']=intUtil['stripTrailingSlash'](_0x38117c[_0xd6ae('0x42')]);if(_0x1fa32d&&_0x1fa32d[_0xd6ae('0x51')]&&_0x1fa32d[_0xd6ae('0x51')]!==_0xd6ae('0x52')){logger[_0xd6ae('0xb')](_0xd6ae('0x53'),_0xd6ae('0x54'));_0x362bf0[_0xd6ae('0x43')]=util[_0xd6ae('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38117c[_0xd6ae('0x42')],_0x362bf0['uniqueid'],md5(_0x362bf0[_0xd6ae('0x45')]));}headers[_0xd6ae('0x46')]=getAuth(_0x38117c);return getUser(_0x38117c,_0x2fd37a[_0xd6ae('0x23')])[_0xd6ae('0x1c')](function(_0x39a793){_0x394d27=_0x39a793;logger[_0xd6ae('0xb')](_0xd6ae('0x47'),_0x394d27['id']);return getEndUser(_0x38117c,_0x362bf0[_0xd6ae('0x55')],_0x362bf0['destcalleridnum']);})[_0xd6ae('0x1c')](function(_0x95b29){_0x364ade=_0x95b29;logger[_0xd6ae('0xb')](_0xd6ae('0x48'),_0x364ade['id']);return getTicket(_0x38117c,_0x394d27,_0x364ade,_0x4c1ee1,_0x362bf0);})[_0xd6ae('0x1c')](function(_0x507fac){if(_0x507fac&&_0x507fac['id']){logger['info']('Ticket\x20created!');logger[_0xd6ae('0xb')](_0xd6ae('0x56'),_0x507fac['id']);logger[_0xd6ae('0xb')]('[OUTBOUND]',_0xd6ae('0x4a'));emit(util[_0xd6ae('0xe')](_0xd6ae('0x4b'),_0x2fd37a[_0xd6ae('0x15')]),_0xd6ae('0x4c'),{'uri':util[_0xd6ae('0xe')](_0xd6ae('0x4d'),_0x38117c[_0xd6ae('0x1a')],_0x507fac['id'])});}})[_0xd6ae('0x4e')](function(_0x5c609e){logger[_0xd6ae('0x4f')]('[OUTBOUND]',JSON[_0xd6ae('0x30')](_0x5c609e));});};exports[_0xd6ae('0x57')]=function(_0x2aa8f0,_0x5a4b65,_0x1412ba,_0x251fcb,_0x3dcb3,_0x517fe4){var _0xdadcd,_0x5748ab;_0x517fe4[_0xd6ae('0x1a')]=intUtil[_0xd6ae('0x41')](_0x517fe4[_0xd6ae('0x1a')]);_0x517fe4['serverUrl']=intUtil['stripTrailingSlash'](_0x517fe4[_0xd6ae('0x42')]);if(_0x3dcb3&&_0x3dcb3['monitor_format']){logger[_0xd6ae('0xb')]('['+_0x5a4b65['lastevent'][_0xd6ae('0x58')]()+']',_0xd6ae('0x54'));_0x5a4b65['recordingURL']=util[_0xd6ae('0xe')](_0xd6ae('0x44'),_0x517fe4[_0xd6ae('0x42')],_0x5a4b65[_0xd6ae('0x45')],md5(_0x5a4b65[_0xd6ae('0x45')]));}else{_0x5a4b65[_0xd6ae('0x43')]='';}headers[_0xd6ae('0x46')]=getAuth(_0x517fe4);return getUser(_0x517fe4,'')[_0xd6ae('0x1c')](function(_0x310186){_0xdadcd=_0x310186;logger[_0xd6ae('0xb')](_0xd6ae('0x47'),_0xdadcd['id']);return getEndUser(_0x517fe4,_0x5a4b65['calleridname'],_0x5a4b65[_0xd6ae('0x11')]);})[_0xd6ae('0x1c')](function(_0x175ff3){_0x5748ab=_0x175ff3;logger[_0xd6ae('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5748ab['id']);return getTicket(_0x517fe4,_0xdadcd,_0x5748ab,_0x1412ba,_0x5a4b65);})[_0xd6ae('0x1c')](function(_0x29152b){if(_0x29152b){logger['info'](_0xd6ae('0x1d'));logger[_0xd6ae('0xb')]('The\x20Ticket\x20ID\x20is:',_0x29152b['id']);}})['catch'](function(_0x2ef87){logger[_0xd6ae('0x4f')]('['+_0x5a4b65[_0xd6ae('0x59')][_0xd6ae('0x58')]()+']',JSON['stringify'](_0x2ef87));});}; \ No newline at end of file +var _0x2d64=['custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','type','nameField','customField','content','idField','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','error','unmanaged','toUpperCase','The\x20Ticket\x20ID\x20is:','lastevent','lodash','request-promise','md5','ioredis','./util','defaults','localhost','socket.io-emitter','redis','application/json','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','Tags','name','Fields'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x2d64,0x15b));var _0x42d6=function(_0x4ca0c8,_0x579226){_0x4ca0c8=_0x4ca0c8-0x0;var _0x522a89=_0x2d64[_0x4ca0c8];return _0x522a89;};'use strict';var _=require(_0x42d6('0x0'));var rp=require(_0x42d6('0x1'));var md5=require(_0x42d6('0x2'));var util=require('util');var Redis=require(_0x42d6('0x3'));var intUtil=require(_0x42d6('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshdesk');config['redis']=_[_0x42d6('0x5')](config['redis'],{'host':_0x42d6('0x6'),'port':0x18eb});var io=require(_0x42d6('0x7'))(new Redis(config[_0x42d6('0x8')]));var headers={'Content-Type':_0x42d6('0x9'),'Accept':_0x42d6('0x9')};function emit(_0xea8ff2,_0x55ecbe,_0x2be571){io['to'](_0xea8ff2)['emit'](_0x55ecbe,_0x2be571);}function getTicket(_0x3b881d,_0x595607,_0x52043e,_0x1c33b1,_0x3e952d){logger[_0x42d6('0xa')](_0x42d6('0xb'));var _0x2a500d=_['merge']({'responder_id':_0x595607['id'],'requester_id':_0x52043e['id'],'name':util[_0x42d6('0xc')](_0x42d6('0xd'),_0x3e952d[_0x42d6('0xe')]),'phone':_0x3e952d['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x42d6('0xf')](_0x1c33b1[_0x42d6('0x10')],_0x3e952d,'\x20'),'description':intUtil[_0x42d6('0xf')](_0x1c33b1[_0x42d6('0x11')],_0x3e952d,'
'),'tags':getTags(_0x1c33b1[_0x42d6('0x12')],_0x42d6('0x13'))},getCustomFields(_0x1c33b1[_0x42d6('0x14')],_0x3e952d));_0x2a500d[_0x42d6('0x15')]=_[_0x42d6('0x16')](_[_0x42d6('0x17')](_0x2a500d[_0x42d6('0x15')],'id'),_0x42d6('0x18'));return request({'uri':util[_0x42d6('0xc')](_0x42d6('0x19'),_0x3b881d[_0x42d6('0x1a')]),'method':_0x42d6('0x1b'),'body':_0x2a500d})['then'](function(_0x1a10d2){logger[_0x42d6('0xa')](_0x42d6('0x1c'));return _0x1a10d2;});}function getUser(_0x41f3e8,_0x394c93){if(intUtil[_0x42d6('0x1d')](_0x394c93)){return request({'uri':util['format']('%s/api/v2/agents',_0x41f3e8[_0x42d6('0x1a')]),'qs':{'email':_0x394c93}})[_0x42d6('0x1e')](function(_0x24c503){if(_0x24c503[_0x42d6('0x1f')]){logger['info'](_0x42d6('0x20'));return _['find'](_0x24c503,function(_0x43214a){return _0x43214a[_0x42d6('0x21')]['email']===_0x394c93;});}else{logger[_0x42d6('0xa')](_0x42d6('0x22'));return request({'uri':util[_0x42d6('0xc')](_0x42d6('0x23'),_0x41f3e8[_0x42d6('0x1a')])})['then'](function(_0x5e2c02){logger[_0x42d6('0xa')](_0x42d6('0x24'));return _0x5e2c02;});}});}else{logger[_0x42d6('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x42d6('0xc')](_0x42d6('0x23'),_0x41f3e8[_0x42d6('0x1a')])})[_0x42d6('0x1e')](function(_0x3712f7){logger[_0x42d6('0xa')]('Admin\x20account\x20selected.');return _0x3712f7;});}}function getEndUser(_0x55aa4a,_0x23363f,_0x47e3f2){logger[_0x42d6('0xa')](_0x42d6('0x25'),_0x47e3f2);return request({'uri':util[_0x42d6('0xc')]('%s/api/v2/contacts',_0x55aa4a[_0x42d6('0x1a')]),'qs':{'phone':_0x47e3f2}})[_0x42d6('0x1e')](function(_0xbf421a){if(_0xbf421a[_0x42d6('0x1f')]){logger[_0x42d6('0xa')]('Enduser\x20found!');return _[_0x42d6('0x26')](_0xbf421a,{'phone':_0x47e3f2});}else{logger[_0x42d6('0xa')](_0x42d6('0x27'));return request({'uri':util[_0x42d6('0xc')](_0x42d6('0x28'),_0x55aa4a[_0x42d6('0x1a')]),'method':'POST','body':{'name':_0x23363f,'phone':_0x47e3f2}})['then'](function(_0x4baff7){logger['info']('Enduser\x20created.');return _0x4baff7;});}});}function getAuth(_0x3640dc){return util[_0x42d6('0xc')](_0x42d6('0x29'),new Buffer(_0x3640dc[_0x42d6('0x2a')]+':X')['toString'](_0x42d6('0x2b')));}function request(_0x26c176){logger[_0x42d6('0x2c')](_0x42d6('0x2d'),JSON[_0x42d6('0x2e')](_0x26c176));return rp(_['defaults'](_0x26c176,{'method':_0x42d6('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0xae869a,_0x1fbcaf){var _0x74ee93=[];if(_0xae869a&&_0xae869a[_0x42d6('0x1f')]>0x0){_0x74ee93=_[_0x42d6('0x30')](_0xae869a,_0x1fbcaf);}return _0x74ee93;}function getCustomFields(_0x3fab88,_0x51eeea){var _0x3b9032=[];var _0x5adbb4={'custom_fields':[]};if(_0x3fab88['length']>0x0){_['forEach'](_0x3fab88,function(_0x34ed1e){if(_[_0x42d6('0x31')]([_0x42d6('0x32'),_0x42d6('0x33')],_0x34ed1e[_0x42d6('0x34')])&&_0x34ed1e[_0x42d6('0x35')]&&!_0x34ed1e[_0x42d6('0x36')]){_0x5adbb4[_0x34ed1e[_0x42d6('0x35')]['toLowerCase']()]=_0x34ed1e[_0x42d6('0x37')]['toString']();}else if(_[_0x42d6('0x31')]([_0x42d6('0x32'),_0x42d6('0x33')],_0x34ed1e[_0x42d6('0x34')])&&_0x34ed1e['idField']&&_0x34ed1e[_0x42d6('0x36')]){_0x5adbb4[_0x42d6('0x15')]['push']({'id':_0x34ed1e[_0x42d6('0x38')],'value':_0x34ed1e[_0x42d6('0x37')]['toString']()});}else if(_0x34ed1e['type']===_0x42d6('0x39')&&_0x34ed1e[_0x42d6('0x3a')]&&_0x34ed1e['idField']&&_0x34ed1e[_0x42d6('0x36')]){_0x51eeea[_0x34ed1e[_0x42d6('0x3a')]]&&_0x5adbb4['custom_fields'][_0x42d6('0x3b')]({'id':_0x34ed1e[_0x42d6('0x38')],'value':_0x51eeea[_0x34ed1e[_0x42d6('0x3a')]]['toString']()});}else if(_0x34ed1e[_0x42d6('0x34')]===_0x42d6('0x3c')&&_0x34ed1e[_0x42d6('0x3d')]&&_0x34ed1e[_0x42d6('0x3d')][_0x42d6('0x13')]&&_0x34ed1e[_0x42d6('0x38')]&&_0x34ed1e[_0x42d6('0x36')]){_0x51eeea[_0x34ed1e[_0x42d6('0x3d')][_0x42d6('0x13')]['toLowerCase']()]&&_0x5adbb4[_0x42d6('0x15')]['push']({'id':_0x34ed1e[_0x42d6('0x38')],'value':_0x51eeea[_0x34ed1e[_0x42d6('0x3d')][_0x42d6('0x13')][_0x42d6('0x3e')]()]['toString']()});}});}return _0x5adbb4;}exports[_0x42d6('0x3f')]=function(_0x466fd7,_0x4f68a4,_0x3b7218,_0x5ba8f2,_0x11e143,_0x5d1903){var _0x18538d,_0x418fbd;_0x5d1903[_0x42d6('0x1a')]=intUtil[_0x42d6('0x40')](_0x5d1903['remoteUri']);_0x5d1903[_0x42d6('0x41')]=intUtil[_0x42d6('0x40')](_0x5d1903[_0x42d6('0x41')]);if(_0x11e143&&_0x11e143[_0x42d6('0x42')]){logger[_0x42d6('0xa')](_0x42d6('0x43'),_0x42d6('0x44'));_0x4f68a4[_0x42d6('0x45')]=util[_0x42d6('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d1903['serverUrl'],_0x4f68a4['uniqueid'],md5(_0x4f68a4[_0x42d6('0x46')]));}else{_0x4f68a4[_0x42d6('0x45')]='';}headers[_0x42d6('0x47')]=getAuth(_0x5d1903);return getUser(_0x5d1903,_0x5ba8f2['email'])['then'](function(_0x44101c){_0x18538d=_0x44101c;logger[_0x42d6('0xa')](_0x42d6('0x48'),_0x18538d['id']);return getEndUser(_0x5d1903,_0x4f68a4[_0x42d6('0xe')],_0x4f68a4[_0x42d6('0x49')]);})[_0x42d6('0x1e')](function(_0x1315f0){_0x418fbd=_0x1315f0;logger[_0x42d6('0xa')]('The\x20Enduser\x20ID\x20is:',_0x418fbd['id']);return getTicket(_0x5d1903,_0x18538d,_0x418fbd,_0x3b7218,_0x4f68a4);})['then'](function(_0x3c3bbd){if(_0x3c3bbd&&_0x3c3bbd['id']){logger['info']('Ticket\x20created!');logger[_0x42d6('0xa')]('The\x20Ticket\x20ID\x20is:',_0x3c3bbd['id']);logger[_0x42d6('0xa')](_0x42d6('0x43'),_0x42d6('0x4a'));emit(util[_0x42d6('0xc')](_0x42d6('0x4b'),_0x5ba8f2['name']),'trigger:browser:url',{'uri':util[_0x42d6('0xc')]('%s/helpdesk/tickets/%d',_0x5d1903[_0x42d6('0x1a')],_0x3c3bbd['id'])});}})[_0x42d6('0x4c')](function(_0x10bc44){logger['error'](_0x42d6('0x43'),JSON[_0x42d6('0x2e')](_0x10bc44));});};exports[_0x42d6('0x4d')]=function(_0x3bb6d4,_0x417a90,_0x35baa6,_0x26f94c,_0x49fb1a,_0x2d3fd4,_0x490b7e){var _0x4460e1,_0x537a9b;_0x2d3fd4[_0x42d6('0x1a')]=intUtil['stripTrailingSlash'](_0x2d3fd4['remoteUri']);_0x2d3fd4[_0x42d6('0x41')]=intUtil[_0x42d6('0x40')](_0x2d3fd4['serverUrl']);if(_0x490b7e&&_0x490b7e[_0x42d6('0x4e')]&&_0x490b7e[_0x42d6('0x4e')]!==_0x42d6('0x4f')){logger[_0x42d6('0xa')](_0x42d6('0x50'),'Recording\x20is\x20enabled!');_0x417a90[_0x42d6('0x45')]=util[_0x42d6('0xc')](_0x42d6('0x51'),_0x2d3fd4[_0x42d6('0x41')],_0x417a90[_0x42d6('0x46')],md5(_0x417a90[_0x42d6('0x46')]));}headers[_0x42d6('0x47')]=getAuth(_0x2d3fd4);return getUser(_0x2d3fd4,_0x26f94c['email'])[_0x42d6('0x1e')](function(_0x5083c6){_0x4460e1=_0x5083c6;logger[_0x42d6('0xa')](_0x42d6('0x48'),_0x4460e1['id']);return getEndUser(_0x2d3fd4,_0x417a90[_0x42d6('0x52')],_0x417a90[_0x42d6('0x53')]);})[_0x42d6('0x1e')](function(_0xd87292){_0x537a9b=_0xd87292;logger[_0x42d6('0xa')](_0x42d6('0x54'),_0x537a9b['id']);return getTicket(_0x2d3fd4,_0x4460e1,_0x537a9b,_0x35baa6,_0x417a90);})[_0x42d6('0x1e')](function(_0x4db027){if(_0x4db027&&_0x4db027['id']){logger[_0x42d6('0xa')]('Ticket\x20created!');logger[_0x42d6('0xa')]('The\x20Ticket\x20ID\x20is:',_0x4db027['id']);logger[_0x42d6('0xa')](_0x42d6('0x50'),_0x42d6('0x4a'));emit(util[_0x42d6('0xc')](_0x42d6('0x4b'),_0x26f94c['name']),_0x42d6('0x55'),{'uri':util['format'](_0x42d6('0x56'),_0x2d3fd4[_0x42d6('0x1a')],_0x4db027['id'])});}})[_0x42d6('0x4c')](function(_0x511a4e){logger[_0x42d6('0x57')](_0x42d6('0x50'),JSON[_0x42d6('0x2e')](_0x511a4e));});};exports[_0x42d6('0x58')]=function(_0x24c817,_0x5620d5,_0x592ae7,_0x210898,_0xc9fde,_0x1f140d){var _0x357066,_0x202d6d;_0x1f140d['remoteUri']=intUtil[_0x42d6('0x40')](_0x1f140d[_0x42d6('0x1a')]);_0x1f140d[_0x42d6('0x41')]=intUtil[_0x42d6('0x40')](_0x1f140d[_0x42d6('0x41')]);if(_0xc9fde&&_0xc9fde[_0x42d6('0x42')]){logger['info']('['+_0x5620d5['lastevent'][_0x42d6('0x59')]()+']',_0x42d6('0x44'));_0x5620d5[_0x42d6('0x45')]=util[_0x42d6('0xc')](_0x42d6('0x51'),_0x1f140d['serverUrl'],_0x5620d5['uniqueid'],md5(_0x5620d5[_0x42d6('0x46')]));}else{_0x5620d5[_0x42d6('0x45')]='';}headers['Authorization']=getAuth(_0x1f140d);return getUser(_0x1f140d,'')[_0x42d6('0x1e')](function(_0x1a2db0){_0x357066=_0x1a2db0;logger[_0x42d6('0xa')](_0x42d6('0x48'),_0x357066['id']);return getEndUser(_0x1f140d,_0x5620d5[_0x42d6('0xe')],_0x5620d5['calleridnum']);})[_0x42d6('0x1e')](function(_0x3d7953){_0x202d6d=_0x3d7953;logger['info'](_0x42d6('0x54'),_0x202d6d['id']);return getTicket(_0x1f140d,_0x357066,_0x202d6d,_0x592ae7,_0x5620d5);})[_0x42d6('0x1e')](function(_0x1dc2a0){if(_0x1dc2a0){logger['info']('Ticket\x20created!');logger['info'](_0x42d6('0x5a'),_0x1dc2a0['id']);}})[_0x42d6('0x4c')](function(_0x2461dd){logger[_0x42d6('0x57')]('['+_0x5620d5[_0x42d6('0x5b')][_0x42d6('0x59')]()+']',JSON[_0x42d6('0x2e')](_0x2461dd));});}; \ 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 f2ab7fe..b1d394c 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 _0xc729=['message','agentEmail','userEmail','User\x20found:','userId','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','task','Task\x20created:','ticketId','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','adminEmail','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','Getting\x20admin\x20information','then','users','length','email','info','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase'];(function(_0x409ba7,_0x4ae8eb){var _0x5f3382=function(_0x4ffbec){while(--_0x4ffbec){_0x409ba7['push'](_0x409ba7['shift']());}};_0x5f3382(++_0x4ae8eb);}(_0xc729,0x8c));var _0x9c72=function(_0x46d92b,_0x360cc3){_0x46d92b=_0x46d92b-0x0;var _0xd8ff70=_0xc729[_0x46d92b];return _0xd8ff70;};'use strict';var _=require(_0x9c72('0x0'));var rp=require(_0x9c72('0x1'));var md5=require(_0x9c72('0x2'));var util=require('util');var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x9c72('0x3'));var logger=require('../../../../config/logger')(_0x9c72('0x4'));config[_0x9c72('0x5')]=_[_0x9c72('0x6')](config['redis'],{'host':_0x9c72('0x7'),'port':0x18eb});var io=require(_0x9c72('0x8'))(new Redis(config[_0x9c72('0x5')]));function getAdminId(_0x1ad5b0,_0x2f3807,_0x70cddb,_0x2f3021){return new Promise(function(_0x3ff5c4,_0x4a6280){var _0x2c6a1e=![];var _0x36ce57={'method':_0x9c72('0x9'),'uri':_0x2f3021+'/api/selector/owners','json':!![]};_0x36ce57[_0x9c72('0xa')]=_0x70cddb;logger['info'](_0x9c72('0xb'));return rp(_0x36ce57)[_0x9c72('0xc')](function(_0x48fedc){if(_0x48fedc){var _0x2e3e1a=_0x48fedc[_0x9c72('0xd')];var _0x99c266=null;for(_0x99c266=0x0;_0x99c266<_0x2e3e1a[_0x9c72('0xe')];_0x99c266++){if(_0x2e3e1a[_0x99c266][_0x9c72('0xf')]===_0x1ad5b0['adminEmail']){_0x1ad5b0['adminId']=_0x2e3e1a[_0x99c266]['id'];_0x2c6a1e=!![];}}if(_0x2c6a1e){logger[_0x9c72('0x10')]('Admin\x20found:',_0x1ad5b0[_0x9c72('0x11')]);_0x3ff5c4(_0x1ad5b0);}else{_0x4a6280({'statusCode':0x194,'message':_0x9c72('0x12')});}}else{_0x4a6280({'statusCode':0x194,'message':_0x9c72('0x12')});}})[_0x9c72('0x13')](function(_0x5868b2){logger[_0x9c72('0x14')]('['+[_0x2f3807[_0x9c72('0x15')]()]+']',_0x5868b2[_0x9c72('0x16')]);_0x4a6280(_0x5868b2);});});}function getUser(_0x2e8ebb,_0x126f38,_0x3cfba9){return function(_0x5952d5){return new Promise(function(_0x33a620,_0x3d6856){var _0x3af71b={'method':_0x9c72('0x9'),'uri':_0x3cfba9+'/api/selector/owners','json':!![]};_0x3af71b[_0x9c72('0xa')]=_0x126f38;logger['info']('Getting\x20user\x20list');return rp(_0x3af71b)[_0x9c72('0xc')](function(_0x45c999){if(_0x45c999){var _0x152de4=_0x45c999['users'];var _0x46b7c4=![];var _0x378e5f=null;if(_0x5952d5[_0x9c72('0x17')]!==null){logger[_0x9c72('0x10')]('Getting\x20user\x20with\x20email',_0x5952d5[_0x9c72('0x17')]);_0x5952d5[_0x9c72('0x18')]=_0x5952d5['agentEmail'];for(_0x378e5f=0x0;_0x378e5f<_0x152de4[_0x9c72('0xe')];_0x378e5f++){if(_0x152de4[_0x378e5f][_0x9c72('0xf')]===_0x5952d5[_0x9c72('0x17')]){_0x46b7c4=!![];_0x5952d5['userId']=_0x152de4[_0x378e5f]['id'];logger[_0x9c72('0x10')](_0x9c72('0x19'),_0x5952d5[_0x9c72('0x1a')]);}}}if(!_0x46b7c4){logger[_0x9c72('0x10')]('Admin\x20selected');_0x5952d5[_0x9c72('0x18')]=_0x5952d5['adminEmail'];_0x5952d5[_0x9c72('0x1a')]=_0x5952d5[_0x9c72('0x11')];_0x46b7c4=!![];}if(_0x46b7c4){_0x33a620(_0x5952d5);}else{_0x3d6856({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3d6856({'statusCode':0x194,'message':_0x9c72('0x12')});}})[_0x9c72('0x13')](function(_0x5a0478){logger['error']('['+[_0x2e8ebb[_0x9c72('0x15')]()]+']',_0x5a0478[_0x9c72('0x16')]);_0x3d6856(_0x5a0478);});});};}function searchContact(_0x2ac8d9,_0x15dfac,_0x11f284,_0xa78e6d){return new Promise(function(_0x4c43dc,_0x246ae9){var _0x5c63e5={'method':_0x9c72('0x9'),'headers':_0x15dfac,'uri':_0x2ac8d9+_0x9c72('0x1b')+_0xa78e6d+_0x9c72('0x1c')+_0x11f284+_0x9c72('0x1d'),'json':!![]};rp(_0x5c63e5)[_0x9c72('0xc')](function(_0x477980){var _0x5a1f7e=_[_0x9c72('0x1e')](_0x477980['contacts'][_0x9c72('0x1f')],[_0x11f284,_0xa78e6d]);_0x4c43dc(_0x5a1f7e);})['catch'](function(_0xeffa8c){_0x246ae9(_0xeffa8c);});});}function getEndUser(_0x480181,_0x7f0ed,_0x2a631e){return function(_0x2621e4){return new Promise(function(_0x5b727e,_0x113f71){logger[_0x9c72('0x10')](util[_0x9c72('0x20')](_0x9c72('0x21'),_0x2621e4[_0x9c72('0x22')]));searchContact(_0x2a631e,_0x7f0ed,_0x9c72('0x23'),_0x2621e4[_0x9c72('0x22')])[_0x9c72('0xc')](function(_0x5542c7){if(_0x5542c7){_0x2621e4['endUserId']=_0x5542c7['id'];logger[_0x9c72('0x10')](_0x9c72('0x24'),_0x2621e4[_0x9c72('0x25')]);return _0x5b727e(_0x2621e4);}searchContact(_0x2a631e,_0x7f0ed,_0x9c72('0x26'),_0x2621e4[_0x9c72('0x22')])[_0x9c72('0xc')](function(_0x410116){if(_0x410116){_0x2621e4['endUserId']=_0x410116['id'];logger[_0x9c72('0x10')](_0x9c72('0x27'),_0x2621e4[_0x9c72('0x25')]);return _0x5b727e(_0x2621e4);}createEndUser(_0x2621e4,_0x480181,_0x7f0ed,_0x2a631e)[_0x9c72('0xc')](function(_0x1c4a58){logger['info']('Contact\x20created:',_0x1c4a58[_0x9c72('0x25')]);return _0x5b727e(_0x1c4a58);});});})[_0x9c72('0x13')](function(_0x4b7f92){_0x113f71(_0x4b7f92);});});};}function createEndUser(_0x3686a4,_0x8c47d5,_0x3db694,_0x539dd8){return new Promise(function(_0x3e3917,_0x14484f){var _0x141c1d=moment();var _0x31f45a={'method':_0x9c72('0x28'),'uri':_0x539dd8+_0x9c72('0x29'),'body':{'contact':{'last_name':_0x3686a4[_0x9c72('0x22')],'work_number':_0x3686a4[_0x9c72('0x22')],'mobile_number':_0x3686a4[_0x9c72('0x22')],'owner_id':_0x3686a4[_0x9c72('0x1a')],'created_at':_0x141c1d['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x31f45a[_0x9c72('0xa')]=_0x3db694;logger[_0x9c72('0x10')](_0x9c72('0x2a'));return rp(_0x31f45a)[_0x9c72('0xc')](function(_0x12f773){_0x3686a4[_0x9c72('0x25')]=_0x12f773['contact']['id'];_0x3e3917(_0x3686a4);})[_0x9c72('0x13')](function(_0x18e97b){logger[_0x9c72('0x14')]('['+[_0x8c47d5['toUpperCase']()]+']',_0x18e97b[_0x9c72('0x16')]);_0x14484f(_0x18e97b[_0x9c72('0x16')]);});});}function getTicket(_0xeb1442,_0x3fad28,_0x40ddcc,_0x1397c4,_0x2e1517){return function(_0x207f4d){logger[_0x9c72('0x10')](_0x9c72('0x2b'));return new Promise(function(_0x54bf8b,_0x35a194){var _0x1e6a64=moment();var _0x3336de={'method':_0x9c72('0x28'),'uri':_0x40ddcc+_0x9c72('0x2c'),'body':{'title':intUtil[_0x9c72('0x2d')](_0x1397c4['Subjects'],_0x2e1517,'\x20'),'description':intUtil['getString'](_0x1397c4[_0x9c72('0x2e')],_0x2e1517,'\x0a'),'owner_id':_0x207f4d[_0x9c72('0x1a')],'creater_id':_0x207f4d[_0x9c72('0x11')],'targetable_id':_0x207f4d[_0x9c72('0x25')],'targetable_type':_0x9c72('0x2f'),'created_at':_0x1e6a64[_0x9c72('0x20')](_0x9c72('0x30')),'due_date':_0x1e6a64[_0x9c72('0x31')](0x1e,'m')[_0x9c72('0x20')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3336de[_0x9c72('0xa')]=_0x3fad28;return rp(_0x3336de)[_0x9c72('0xc')](function(_0x46edc1){_0x207f4d['ticketId']=_0x46edc1[_0x9c72('0x32')]['id'];logger[_0x9c72('0x10')](_0x9c72('0x33'),_0x207f4d[_0x9c72('0x34')]);_0x54bf8b(_0x207f4d);})[_0x9c72('0x13')](function(_0x571d6b){logger['error']('['+[_0xeb1442['toUpperCase']()]+']',_0x571d6b[_0x9c72('0x16')]);_0x35a194(_0x571d6b['message']);});});};}function emit(_0x433a52,_0x8a2363,_0x5971bc){var _0x4fbd05={'uri':_0x433a52+'/contacts/'+_0x5971bc};io['to'](util[_0x9c72('0x20')](_0x9c72('0x35'),_0x8a2363))[_0x9c72('0x36')]('trigger:browser:url',_0x4fbd05);}exports['cs']=function(_0x53635a,_0x22a602,_0xbef83b,_0xd827d0,_0x5ec0aa,_0x196a96,_0x980801,_0x1d32f6){var _0x32b3f3={};var _0x36a61b={'Authorization':_0x9c72('0x37')+_0x196a96[_0x9c72('0x38')]};_0x196a96[_0x9c72('0x39')]=intUtil[_0x9c72('0x3a')](_0x196a96[_0x9c72('0x39')]);_0x196a96['serverUrl']=intUtil['stripTrailingSlash'](_0x196a96[_0x9c72('0x3b')]);var _0x2a587b=_0x196a96['remoteUri'];_0x32b3f3[_0x9c72('0x3c')]=_0x196a96[_0x9c72('0x3d')];_0x32b3f3[_0x9c72('0x22')]=_0x1d32f6[_0x9c72('0x3e')]()===_0x9c72('0x3f')?_0x22a602[_0x9c72('0x40')]:_0x22a602[_0x9c72('0x41')];_0x32b3f3[_0x9c72('0x42')]=_0x1d32f6==='queue'||_0x1d32f6===_0x9c72('0x43')?'queue':_0x9c72('0x3f');if(_0xd827d0){_0x32b3f3[_0x9c72('0x17')]=_0xd827d0[_0x9c72('0xf')];}var _0x551322=util['format'](_0x9c72('0x44'),_0x196a96[_0x9c72('0x3b')],_0x22a602[_0x9c72('0x45')],md5(_0x22a602['uniqueid']));if(_0x5ec0aa&&_0x5ec0aa[_0x9c72('0x46')]){logger['info'](_0x9c72('0x47'),_0x9c72('0x48'));_0x22a602[_0x9c72('0x49')]=_0x551322;}else if(_0x980801&&_0x980801['recordingFormat']&&_0x980801[_0x9c72('0x4a')]!==_0x9c72('0x4b')){logger[_0x9c72('0x10')](_0x9c72('0x4c'),_0x9c72('0x48'));_0x22a602[_0x9c72('0x49')]=_0x551322;}else{_0x22a602[_0x9c72('0x49')]='';}return getAdminId(_0x32b3f3,_0x1d32f6,_0x36a61b,_0x2a587b)[_0x9c72('0xc')](getUser(_0x1d32f6,_0x36a61b,_0x2a587b))[_0x9c72('0xc')](getEndUser(_0x1d32f6,_0x36a61b,_0x2a587b))['then'](getTicket(_0x1d32f6,_0x36a61b,_0x2a587b,_0xbef83b,_0x22a602))[_0x9c72('0xc')](function(_0x2d8332){logger[_0x9c72('0x10')](util[_0x9c72('0x20')](_0x9c72('0x4d'),_0x2d8332['ticketId']));if(_0x1d32f6!==_0x9c72('0x43')){logger[_0x9c72('0x10')]('['+[_0x1d32f6[_0x9c72('0x15')]()]+']',_0x9c72('0x4e'));emit(_0x2a587b,_0xd827d0[_0x9c72('0x4f')],_0x2d8332[_0x9c72('0x25')]);}})[_0x9c72('0x13')](function(_0x1c56a8){logger['error']('['+[_0x1d32f6[_0x9c72('0x15')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x9c72('0x50')](_0x1c56a8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf318=['Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','message','Creating\x20new\x20task','/api/tasks','Subjects','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','Getting\x20user\x20list','users','Getting\x20user\x20with\x20email','agentEmail','email','userId','User\x20found:','Admin\x20selected','userEmail','catch','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','then'];(function(_0x314721,_0x38929f){var _0x4c09b3=function(_0x5c6f2e){while(--_0x5c6f2e){_0x314721['push'](_0x314721['shift']());}};_0x4c09b3(++_0x38929f);}(_0xf318,0xcf));var _0x8f31=function(_0x1bb398,_0x16ed5b){_0x1bb398=_0x1bb398-0x0;var _0x7414cb=_0xf318[_0x1bb398];return _0x7414cb;};'use strict';var _=require(_0x8f31('0x0'));var rp=require(_0x8f31('0x1'));var md5=require(_0x8f31('0x2'));var util=require(_0x8f31('0x3'));var moment=require(_0x8f31('0x4'));var Promise=require(_0x8f31('0x5'));var Redis=require(_0x8f31('0x6'));var intUtil=require(_0x8f31('0x7'));var config=require('../../../../config/environment');var logger=require(_0x8f31('0x8'))(_0x8f31('0x9'));config[_0x8f31('0xa')]=_[_0x8f31('0xb')](config[_0x8f31('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x8f31('0xc'))(new Redis(config['redis']));function getAdminId(_0x57619c,_0x293a66,_0x5225ea,_0x362e3c){return new Promise(function(_0x17a4cf,_0x237cdf){var _0x4d6f34=![];var _0x420dc6={'method':_0x8f31('0xd'),'uri':_0x362e3c+_0x8f31('0xe'),'json':!![]};_0x420dc6[_0x8f31('0xf')]=_0x5225ea;logger[_0x8f31('0x10')]('Getting\x20admin\x20information');return rp(_0x420dc6)['then'](function(_0x52a50e){if(_0x52a50e){var _0x1a776c=_0x52a50e['users'];var _0xa2d20d=null;for(_0xa2d20d=0x0;_0xa2d20d<_0x1a776c[_0x8f31('0x11')];_0xa2d20d++){if(_0x1a776c[_0xa2d20d]['email']===_0x57619c[_0x8f31('0x12')]){_0x57619c[_0x8f31('0x13')]=_0x1a776c[_0xa2d20d]['id'];_0x4d6f34=!![];}}if(_0x4d6f34){logger[_0x8f31('0x10')](_0x8f31('0x14'),_0x57619c[_0x8f31('0x13')]);_0x17a4cf(_0x57619c);}else{_0x237cdf({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x237cdf({'statusCode':0x194,'message':_0x8f31('0x15')});}})['catch'](function(_0x28a8de){logger[_0x8f31('0x16')]('['+[_0x293a66[_0x8f31('0x17')]()]+']',_0x28a8de['message']);_0x237cdf(_0x28a8de);});});}function getUser(_0x1ec640,_0x416d51,_0x58561c){return function(_0x111418){return new Promise(function(_0x25731a,_0x296b1f){var _0x417dc0={'method':_0x8f31('0xd'),'uri':_0x58561c+_0x8f31('0xe'),'json':!![]};_0x417dc0[_0x8f31('0xf')]=_0x416d51;logger[_0x8f31('0x10')](_0x8f31('0x18'));return rp(_0x417dc0)['then'](function(_0x11a1f3){if(_0x11a1f3){var _0x1850c4=_0x11a1f3[_0x8f31('0x19')];var _0x3491dc=![];var _0x1b2140=null;if(_0x111418['agentEmail']!==null){logger[_0x8f31('0x10')](_0x8f31('0x1a'),_0x111418[_0x8f31('0x1b')]);_0x111418['userEmail']=_0x111418[_0x8f31('0x1b')];for(_0x1b2140=0x0;_0x1b2140<_0x1850c4['length'];_0x1b2140++){if(_0x1850c4[_0x1b2140][_0x8f31('0x1c')]===_0x111418[_0x8f31('0x1b')]){_0x3491dc=!![];_0x111418[_0x8f31('0x1d')]=_0x1850c4[_0x1b2140]['id'];logger[_0x8f31('0x10')](_0x8f31('0x1e'),_0x111418['userId']);}}}if(!_0x3491dc){logger[_0x8f31('0x10')](_0x8f31('0x1f'));_0x111418[_0x8f31('0x20')]=_0x111418[_0x8f31('0x12')];_0x111418[_0x8f31('0x1d')]=_0x111418[_0x8f31('0x13')];_0x3491dc=!![];}if(_0x3491dc){_0x25731a(_0x111418);}else{_0x296b1f({'statusCode':0x194,'message':_0x8f31('0x15')});}}else{_0x296b1f({'statusCode':0x194,'message':_0x8f31('0x15')});}})[_0x8f31('0x21')](function(_0x152642){logger['error']('['+[_0x1ec640['toUpperCase']()]+']',_0x152642['message']);_0x296b1f(_0x152642);});});};}function searchContact(_0x321ece,_0x4b371a,_0x442797,_0x1cacea){return new Promise(function(_0x440b76,_0x3f4c33){var _0x4827f2={'method':_0x8f31('0xd'),'headers':_0x4b371a,'uri':_0x321ece+'/api/lookup?q='+_0x1cacea+'&f='+_0x442797+_0x8f31('0x22'),'json':!![]};rp(_0x4827f2)['then'](function(_0xb3dfac){var _0x5b5f77=_[_0x8f31('0x23')](_0xb3dfac[_0x8f31('0x24')]['contacts'],[_0x442797,_0x1cacea]);_0x440b76(_0x5b5f77);})[_0x8f31('0x21')](function(_0x57e7ac){_0x3f4c33(_0x57e7ac);});});}function getEndUser(_0x398c6a,_0x1f76a8,_0x174ddc){return function(_0x29388d){return new Promise(function(_0x304bc5,_0x47dba2){logger[_0x8f31('0x10')](util[_0x8f31('0x25')](_0x8f31('0x26'),_0x29388d['contactNumber']));searchContact(_0x174ddc,_0x1f76a8,_0x8f31('0x27'),_0x29388d[_0x8f31('0x28')])[_0x8f31('0x29')](function(_0x26ee6f){if(_0x26ee6f){_0x29388d['endUserId']=_0x26ee6f['id'];logger[_0x8f31('0x10')](_0x8f31('0x2a'),_0x29388d[_0x8f31('0x2b')]);return _0x304bc5(_0x29388d);}searchContact(_0x174ddc,_0x1f76a8,_0x8f31('0x2c'),_0x29388d['contactNumber'])['then'](function(_0x59a7b3){if(_0x59a7b3){_0x29388d[_0x8f31('0x2b')]=_0x59a7b3['id'];logger[_0x8f31('0x10')](_0x8f31('0x2d'),_0x29388d[_0x8f31('0x2b')]);return _0x304bc5(_0x29388d);}createEndUser(_0x29388d,_0x398c6a,_0x1f76a8,_0x174ddc)[_0x8f31('0x29')](function(_0x4c9634){logger[_0x8f31('0x10')]('Contact\x20created:',_0x4c9634[_0x8f31('0x2b')]);return _0x304bc5(_0x4c9634);});});})[_0x8f31('0x21')](function(_0x1e1f03){_0x47dba2(_0x1e1f03);});});};}function createEndUser(_0x1a8f43,_0x26bc96,_0x527df,_0x5dbcd1){return new Promise(function(_0x15eb37,_0x544c94){var _0x348690=moment();var _0x510d46={'method':_0x8f31('0x2e'),'uri':_0x5dbcd1+_0x8f31('0x2f'),'body':{'contact':{'last_name':_0x1a8f43[_0x8f31('0x28')],'work_number':_0x1a8f43[_0x8f31('0x28')],'mobile_number':_0x1a8f43[_0x8f31('0x28')],'owner_id':_0x1a8f43[_0x8f31('0x1d')],'created_at':_0x348690[_0x8f31('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x510d46[_0x8f31('0xf')]=_0x527df;logger[_0x8f31('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x510d46)[_0x8f31('0x29')](function(_0x15f016){_0x1a8f43['endUserId']=_0x15f016['contact']['id'];_0x15eb37(_0x1a8f43);})[_0x8f31('0x21')](function(_0x21c375){logger[_0x8f31('0x16')]('['+[_0x26bc96[_0x8f31('0x17')]()]+']',_0x21c375[_0x8f31('0x30')]);_0x544c94(_0x21c375[_0x8f31('0x30')]);});});}function getTicket(_0x445ba3,_0x1abf35,_0x11706a,_0x3e486a,_0x1808d1){return function(_0x2bd94a){logger[_0x8f31('0x10')](_0x8f31('0x31'));return new Promise(function(_0x491439,_0x3e4e1a){var _0x3d9a86=moment();var _0x22a77c={'method':_0x8f31('0x2e'),'uri':_0x11706a+_0x8f31('0x32'),'body':{'title':intUtil['getString'](_0x3e486a[_0x8f31('0x33')],_0x1808d1,'\x20'),'description':intUtil['getString'](_0x3e486a['Descriptions'],_0x1808d1,'\x0a'),'owner_id':_0x2bd94a[_0x8f31('0x1d')],'creater_id':_0x2bd94a[_0x8f31('0x13')],'targetable_id':_0x2bd94a[_0x8f31('0x2b')],'targetable_type':_0x8f31('0x34'),'created_at':_0x3d9a86['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x3d9a86[_0x8f31('0x35')](0x1e,'m')[_0x8f31('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x22a77c[_0x8f31('0xf')]=_0x1abf35;return rp(_0x22a77c)[_0x8f31('0x29')](function(_0x3a1c91){_0x2bd94a[_0x8f31('0x36')]=_0x3a1c91[_0x8f31('0x37')]['id'];logger[_0x8f31('0x10')](_0x8f31('0x38'),_0x2bd94a[_0x8f31('0x36')]);_0x491439(_0x2bd94a);})[_0x8f31('0x21')](function(_0x6a5d86){logger[_0x8f31('0x16')]('['+[_0x445ba3[_0x8f31('0x17')]()]+']',_0x6a5d86[_0x8f31('0x30')]);_0x3e4e1a(_0x6a5d86[_0x8f31('0x30')]);});});};}function emit(_0x5b09ac,_0x3d04af,_0x56a702){var _0xd7681f={'uri':_0x5b09ac+_0x8f31('0x39')+_0x56a702};io['to'](util[_0x8f31('0x25')](_0x8f31('0x3a'),_0x3d04af))[_0x8f31('0x3b')](_0x8f31('0x3c'),_0xd7681f);}exports['cs']=function(_0x29f145,_0x42a1e9,_0xb314fd,_0x1b12d4,_0x302afd,_0x712fd5,_0x507305,_0xf7c80e){var _0xdf119a={};var _0x2ac17e={'Authorization':_0x8f31('0x3d')+_0x712fd5[_0x8f31('0x3e')]};_0x712fd5[_0x8f31('0x3f')]=intUtil[_0x8f31('0x40')](_0x712fd5[_0x8f31('0x3f')]);_0x712fd5['serverUrl']=intUtil[_0x8f31('0x40')](_0x712fd5[_0x8f31('0x41')]);var _0x26fd03=_0x712fd5[_0x8f31('0x3f')];_0xdf119a[_0x8f31('0x12')]=_0x712fd5[_0x8f31('0x42')];_0xdf119a[_0x8f31('0x28')]=_0xf7c80e[_0x8f31('0x43')]()===_0x8f31('0x44')?_0x42a1e9['destcalleridnum']:_0x42a1e9['calleridnum'];_0xdf119a['callDirection']=_0xf7c80e==='queue'||_0xf7c80e===_0x8f31('0x45')?_0x8f31('0x46'):_0x8f31('0x44');if(_0x1b12d4){_0xdf119a[_0x8f31('0x1b')]=_0x1b12d4[_0x8f31('0x1c')];}var _0x12b213=util[_0x8f31('0x25')](_0x8f31('0x47'),_0x712fd5[_0x8f31('0x41')],_0x42a1e9['uniqueid'],md5(_0x42a1e9[_0x8f31('0x48')]));if(_0x302afd&&_0x302afd[_0x8f31('0x49')]){logger[_0x8f31('0x10')]('[QUEUE]',_0x8f31('0x4a'));_0x42a1e9[_0x8f31('0x4b')]=_0x12b213;}else if(_0x507305&&_0x507305[_0x8f31('0x4c')]&&_0x507305[_0x8f31('0x4c')]!==_0x8f31('0x4d')){logger['info'](_0x8f31('0x4e'),_0x8f31('0x4a'));_0x42a1e9[_0x8f31('0x4b')]=_0x12b213;}else{_0x42a1e9[_0x8f31('0x4b')]='';}return getAdminId(_0xdf119a,_0xf7c80e,_0x2ac17e,_0x26fd03)[_0x8f31('0x29')](getUser(_0xf7c80e,_0x2ac17e,_0x26fd03))[_0x8f31('0x29')](getEndUser(_0xf7c80e,_0x2ac17e,_0x26fd03))['then'](getTicket(_0xf7c80e,_0x2ac17e,_0x26fd03,_0xb314fd,_0x42a1e9))[_0x8f31('0x29')](function(_0x30bb5f){logger[_0x8f31('0x10')](util[_0x8f31('0x25')](_0x8f31('0x4f'),_0x30bb5f[_0x8f31('0x36')]));if(_0xf7c80e!==_0x8f31('0x45')){logger['info']('['+[_0xf7c80e[_0x8f31('0x17')]()]+']',_0x8f31('0x50'));emit(_0x26fd03,_0x1b12d4['name'],_0x30bb5f[_0x8f31('0x2b')]);}})[_0x8f31('0x21')](function(_0x1fda63){logger[_0x8f31('0x16')]('['+[_0xf7c80e[_0x8f31('0x17')]()]+_0x8f31('0x51'),util[_0x8f31('0x52')](_0x1fda63,{'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 c2edea7..7e96fa4 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 _0xb509=['EVENT\x20UNKNOWN','desk','unknown\x20integration','../../../../config/logger','format','data3','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','queue','routeId','outbound','log'];(function(_0x28d1d2,_0x3d3738){var _0x64847e=function(_0x31c5b2){while(--_0x31c5b2){_0x28d1d2['push'](_0x28d1d2['shift']());}};_0x64847e(++_0x3d3738);}(_0xb509,0x1c5));var _0x9b50=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb509[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x9b50('0x0'));var util=require(_0x9b50('0x1'));var zendesk=require(_0x9b50('0x2'));var salesforce=require(_0x9b50('0x3'));var sugarcrm=require(_0x9b50('0x4'));var freshdesk=require(_0x9b50('0x5'));var zoho=require(_0x9b50('0x6'));var desk=require('./desk');var vtiger=require(_0x9b50('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0x9b50('0x8'));var freshsales=require(_0x9b50('0x9'));var integrations=[_0x9b50('0xa'),_0x9b50('0xb'),_0x9b50('0xc'),_0x9b50('0xd'),_0x9b50('0xe'),'desk','vtiger',_0x9b50('0xf'),_0x9b50('0x10'),_0x9b50('0x11')];exports[_0x9b50('0x12')]=function(_0x157833,_0x4157d4,_0x16fa77,_0x121c33,_0x4946b7,_0x551bbf){if(_0x16fa77){if(_[_0x9b50('0x13')](integrations,_0x157833[_0x9b50('0x14')][_0x9b50('0x15')]())){try{var _0x27c7ca=null;var _0x2ef79c='';var _0x45e789=_0x16fa77[_0x157833[_0x9b50('0x14')][_0x9b50('0x15')]()];if(_0x45e789){var _0x26bab6=_0x45e789[_0x157833[_0x9b50('0x16')]];if(_0x26bab6){var _0x55c76d=_['find'](_0x26bab6[_0x9b50('0x17')],{'id':parseInt(_0x157833['data3'],0xa)});if(_0x55c76d){if(_0x121c33){if(_0x4946b7&&_0x4157d4[_0x9b50('0x18')]){_0x2ef79c='queue';}else if(_0x4157d4[_0x9b50('0x19')]){_0x2ef79c=_0x9b50('0x1a');}else{console[_0x9b50('0x1b')](_0x9b50('0x1c'),_0x4157d4);}}else{_0x2ef79c='unmanaged';}switch(_0x157833[_0x9b50('0x14')][_0x9b50('0x15')]()){case _0x9b50('0xa'):zendesk[_0x2ef79c](_0x157833,_0x4157d4,_0x55c76d,_0x121c33,_0x4946b7,_0x26bab6,_0x551bbf);break;case'salesforce':salesforce[_0x2ef79c](_0x157833,_0x4157d4,_0x55c76d,_0x121c33,_0x4946b7,_0x26bab6,_0x551bbf);break;case'sugarcrm':sugarcrm[_0x2ef79c](_0x157833,_0x4157d4,_0x55c76d,_0x121c33,_0x4946b7,_0x26bab6,_0x551bbf);break;case'freshdesk':freshdesk[_0x2ef79c](_0x157833,_0x4157d4,_0x55c76d,_0x121c33,_0x4946b7,_0x26bab6,_0x551bbf);break;case _0x9b50('0xe'):zoho[_0x2ef79c](_0x157833,_0x4157d4,_0x55c76d,_0x121c33,_0x4946b7,_0x26bab6,_0x551bbf);break;case _0x9b50('0x1d'):desk[_0x2ef79c](_0x157833,_0x4157d4,_0x55c76d,_0x121c33,_0x4946b7,_0x26bab6,_0x551bbf);break;case'vtiger':vtiger[_0x2ef79c](_0x157833,_0x4157d4,_0x55c76d,_0x121c33,_0x4946b7,_0x26bab6,_0x551bbf);break;case'freshsales':freshsales['cs'](_0x157833,_0x4157d4,_0x55c76d,_0x121c33,_0x4946b7,_0x26bab6,_0x551bbf,_0x2ef79c);break;case'servicenow':servicenow['cs'](_0x157833,_0x4157d4,_0x55c76d,_0x121c33,_0x4946b7,_0x26bab6,_0x551bbf,_0x2ef79c);break;case _0x9b50('0xf'):dynamics365['cs'](_0x157833,_0x4157d4,_0x55c76d,_0x121c33,_0x4946b7,_0x26bab6,_0x551bbf,_0x2ef79c);break;default:console[_0x9b50('0x1b')](_0x9b50('0x1e'));}}else{_0x27c7ca=require(_0x9b50('0x1f'))(_0x157833[_0x9b50('0x14')][_0x9b50('0x15')]());_0x27c7ca['error']('[EXEC]',util[_0x9b50('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0x157833[_0x9b50('0x14')][_0x9b50('0x15')](),_0x157833[_0x9b50('0x21')]));}}else{_0x27c7ca=require(_0x9b50('0x1f'))(_0x157833[_0x9b50('0x14')]['toLowerCase']());_0x27c7ca[_0x9b50('0x22')](_0x9b50('0x23'),util['format'](_0x9b50('0x24'),_0x157833['data1'][_0x9b50('0x15')](),_0x157833['data2']));}}else{}}catch(_0xbc9ca6){console[_0x9b50('0x22')](_0xbc9ca6);}}}}; \ No newline at end of file +var _0xc91b=['log','unknown\x20integration','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','freshsales'];(function(_0x13271d,_0x58f9d3){var _0x5a7675=function(_0x4870be){while(--_0x4870be){_0x13271d['push'](_0x13271d['shift']());}};_0x5a7675(++_0x58f9d3);}(_0xc91b,0x118));var _0xbc91=function(_0x2e7446,_0x1faf52){_0x2e7446=_0x2e7446-0x0;var _0x432e4b=_0xc91b[_0x2e7446];return _0x432e4b;};'use strict';var _=require(_0xbc91('0x0'));var util=require(_0xbc91('0x1'));var zendesk=require(_0xbc91('0x2'));var salesforce=require(_0xbc91('0x3'));var sugarcrm=require(_0xbc91('0x4'));var freshdesk=require(_0xbc91('0x5'));var zoho=require('./zoho');var desk=require(_0xbc91('0x6'));var vtiger=require(_0xbc91('0x7'));var servicenow=require(_0xbc91('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xbc91('0x9'));var integrations=['zendesk',_0xbc91('0xa'),_0xbc91('0xb'),_0xbc91('0xc'),_0xbc91('0xd'),'desk',_0xbc91('0xe'),_0xbc91('0xf'),'freshsales',_0xbc91('0x10')];exports[_0xbc91('0x11')]=function(_0x32e7e5,_0x12757a,_0x31a520,_0xfe71d8,_0x228d1c,_0x266e32){if(_0x31a520){if(_[_0xbc91('0x12')](integrations,_0x32e7e5[_0xbc91('0x13')][_0xbc91('0x14')]())){try{var _0x74cabd=null;var _0x39762b='';var _0x596a61=_0x31a520[_0x32e7e5['data1'][_0xbc91('0x14')]()];if(_0x596a61){var _0xd2be63=_0x596a61[_0x32e7e5[_0xbc91('0x15')]];if(_0xd2be63){var _0x3b3580=_[_0xbc91('0x16')](_0xd2be63[_0xbc91('0x17')],{'id':parseInt(_0x32e7e5[_0xbc91('0x18')],0xa)});if(_0x3b3580){if(_0xfe71d8){if(_0x228d1c&&_0x12757a[_0xbc91('0x19')]){_0x39762b=_0xbc91('0x19');}else if(_0x12757a[_0xbc91('0x1a')]){_0x39762b=_0xbc91('0x1b');}else{console['log'](_0xbc91('0x1c'),_0x12757a);}}else{_0x39762b=_0xbc91('0x1d');}switch(_0x32e7e5[_0xbc91('0x13')][_0xbc91('0x14')]()){case _0xbc91('0x1e'):zendesk[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case'salesforce':salesforce[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case'sugarcrm':sugarcrm[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case'freshdesk':freshdesk[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case _0xbc91('0xd'):zoho[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case'desk':desk[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case'vtiger':vtiger[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case _0xbc91('0x1f'):freshsales['cs'](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32,_0x39762b);break;case _0xbc91('0x10'):servicenow['cs'](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32,_0x39762b);break;case _0xbc91('0xf'):dynamics365['cs'](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32,_0x39762b);break;default:console[_0xbc91('0x20')](_0xbc91('0x21'));}}else{_0x74cabd=require('../../../../config/logger')(_0x32e7e5[_0xbc91('0x13')]['toLowerCase']());_0x74cabd[_0xbc91('0x22')](_0xbc91('0x23'),util['format'](_0xbc91('0x24'),_0x32e7e5[_0xbc91('0x13')][_0xbc91('0x14')](),_0x32e7e5[_0xbc91('0x18')]));}}else{_0x74cabd=require(_0xbc91('0x25'))(_0x32e7e5[_0xbc91('0x13')][_0xbc91('0x14')]());_0x74cabd[_0xbc91('0x22')](_0xbc91('0x23'),util[_0xbc91('0x26')]('%s\x20account\x20#%s\x20not\x20found',_0x32e7e5[_0xbc91('0x13')][_0xbc91('0x14')](),_0x32e7e5[_0xbc91('0x15')]));}}else{}}catch(_0x119b5b){console[_0xbc91('0x22')](_0x119b5b);}}}}; \ 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 890931a..1b91258 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 _0xa812=['socket.io-emitter','assign','getString','Subjects','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','lead','WhoId','account','WhatId','ticketType','AccountId','leadId','info','sobject','create','isNil','validateEmail','User','find','length','Email','Agent\x20%s\x20found.','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','execute','additionalSearchLead','additionalSearchAccount','merge','$or','Account','Contact','Lead','Name','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','picklist','idField','content','toString','variable','variableName','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','email','destcalleridnum','outbound','newTab','%s/%s/e','error','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','bluebird','md5','jsforce','ioredis','./util','../../../../config/logger','redis','localhost'];(function(_0x2e1293,_0xd9db95){var _0x183870=function(_0x23d60b){while(--_0x23d60b){_0x2e1293['push'](_0x2e1293['shift']());}};_0x183870(++_0xd9db95);}(_0xa812,0x15e));var _0x2a81=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa812[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x2a81('0x0'));var rp=require(_0x2a81('0x1'));var moment=require('moment');var BPromise=require(_0x2a81('0x2'));var md5=require(_0x2a81('0x3'));var jsforce=require(_0x2a81('0x4'));var util=require('util');var Redis=require(_0x2a81('0x5'));var intUtil=require(_0x2a81('0x6'));var config=require('../../../../config/environment');var logger=require(_0x2a81('0x7'))('salesforce');config[_0x2a81('0x8')]=_['defaults'](config[_0x2a81('0x8')],{'host':_0x2a81('0x9'),'port':0x18eb});var io=require(_0x2a81('0xa'))(new Redis(config[_0x2a81('0x8')]));function emit(_0x4b320a,_0x201fc3,_0x2190a7){io['to'](_0x4b320a)['emit'](_0x201fc3,_0x2190a7);}function getTicket(_0x4c63f5,_0x36a7ba,_0xa5d8a4,_0x296b18,_0x138665,_0x55a400,_0x5e5bd7,_0x41bbc7){var _0x16d776=Object[_0x2a81('0xb')]({},{'OwnerId':_0x36a7ba['id'],'Subject':intUtil[_0x2a81('0xc')](_0x296b18[_0x2a81('0xd')],_0x138665,'\x20'),'Description':intUtil['getString'](_0x296b18['Descriptions'],_0x138665,'\x0a')},getCustomFields(_0x55a400,_0x138665));if(_0xa5d8a4){if(_0x296b18['ticketType']===_0x2a81('0xe')){_0x16d776[_0x2a81('0xf')]=moment[_0x2a81('0x10')]();_0x16d776[_0x2a81('0x11')]=![];_0x16d776['IsRecurrence']=![];if(_0xa5d8a4[_0x2a81('0x12')]===_0x2a81('0x13')||_0xa5d8a4[_0x2a81('0x12')]===_0x2a81('0x14')){_0x16d776[_0x2a81('0x15')]=_0xa5d8a4['id'];}else if(_0xa5d8a4[_0x2a81('0x12')]===_0x2a81('0x16')){_0x16d776[_0x2a81('0x17')]=_0xa5d8a4['id'];}}else if(_0x296b18[_0x2a81('0x18')]==='Case'){if(_0xa5d8a4['endUserType']===_0x2a81('0x13')){_0x16d776['ContactId']=_0xa5d8a4['id'];}else if(_0xa5d8a4[_0x2a81('0x12')]==='account'){_0x16d776[_0x2a81('0x19')]=_0xa5d8a4['id'];}else if(_0xa5d8a4[_0x2a81('0x12')]===_0x2a81('0x14')&&_0x296b18[_0x2a81('0x1a')]){_0x16d776[_0x296b18[_0x2a81('0x1a')]]=_0xa5d8a4['id'];}else{logger[_0x2a81('0x1b')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x5e5bd7[_0x2a81('0x1c')](_0x296b18[_0x2a81('0x18')])[_0x2a81('0x1d')](_0x16d776);}function getUser(_0x118197,_0x225843,_0x518cf9){if(!_[_0x2a81('0x1e')](_0x225843)&&intUtil[_0x2a81('0x1f')](_0x225843)){var _0x1207a1={'Email':_0x225843};var _0x1ba8bd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x518cf9['sobject'](_0x2a81('0x20'))[_0x2a81('0x21')](_0x1207a1,_0x1ba8bd)['execute']()['then'](function(_0x52945c){if(_0x52945c[_0x2a81('0x22')]){var _0x3e37e4=_[_0x2a81('0x21')](_0x52945c,function(_0x3f9bc2){return _0x3f9bc2[_0x2a81('0x23')]===_0x225843;});if(_0x3e37e4){logger[_0x2a81('0x1b')](_0x2a81('0x24'),_0x225843);return BPromise[_0x2a81('0x25')]({'id':_0x3e37e4['Id'],'name':_0x3e37e4['Name']});}}else{logger[_0x2a81('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x225843);return _0x518cf9['identity']()['then'](function(_0x237eba){return BPromise[_0x2a81('0x25')]({'id':_0x237eba[_0x2a81('0x26')],'name':_0x237eba[_0x2a81('0x27')]});});}});}else{logger[_0x2a81('0x1b')](_0x2a81('0x28'),_0x225843);return _0x518cf9['identity']()[_0x2a81('0x29')](function(_0x377f94){return BPromise[_0x2a81('0x25')]({'id':_0x377f94['user_id'],'name':_0x377f94['display_name']});});}}function getEndUser(_0x28f3d5,_0x177459,_0x12ee5d,_0x4711ca,_0x368969){var _0x31f961={'$or':{'Phone':_0x4711ca}};var _0x10a9fa={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2a81('0x25')]()['then'](function(){logger['info'](_0x2a81('0x2a'),_0x4711ca,_0x177459[_0x2a81('0x2b')]);switch(_0x177459[_0x2a81('0x2b')]){case _0x2a81('0x2c'):var _0x179a6b=_[_0x2a81('0x2d')](_0x31f961);if(_0x177459[_0x2a81('0x2e')]){var _0x42de24={};_0x42de24[_0x177459[_0x2a81('0x2e')]]=_0x4711ca;_['merge'](_0x179a6b['$or'],_0x42de24);}return _0x368969[_0x2a81('0x1c')]('Contact')['find'](_0x179a6b,_0x10a9fa)[_0x2a81('0x2f')]()['then'](function(_0x4e19cd){if(_0x4e19cd&&_0x4e19cd[_0x2a81('0x22')]){return _0x4e19cd;}else{var _0x1549a3=_[_0x2a81('0x2d')](_0x31f961);if(_0x177459[_0x2a81('0x30')]){var _0x34910c={};_0x34910c[_0x177459[_0x2a81('0x30')]]=_0x4711ca;_['merge'](_0x1549a3['$or'],_0x34910c);}return _0x368969[_0x2a81('0x1c')]('Lead')[_0x2a81('0x21')](_0x1549a3,_0x10a9fa);}});case'account_contact_lead':var _0x5dc4ea=_[_0x2a81('0x2d')](_0x31f961);if(_0x177459[_0x2a81('0x31')]){var _0x42de24={};_0x42de24[_0x177459[_0x2a81('0x31')]]=_0x4711ca;_[_0x2a81('0x32')](_0x5dc4ea[_0x2a81('0x33')],_0x42de24);}return _0x368969[_0x2a81('0x1c')](_0x2a81('0x34'))[_0x2a81('0x21')](_0x5dc4ea,_0x10a9fa)['execute']()[_0x2a81('0x29')](function(_0x134fae){if(_0x134fae&&_0x134fae[_0x2a81('0x22')]){return _0x134fae;}else{var _0x3f9ebd=_['cloneDeep'](_0x31f961);if(_0x177459[_0x2a81('0x2e')]){var _0x3bf542={};_0x3bf542[_0x177459[_0x2a81('0x2e')]]=_0x4711ca;_[_0x2a81('0x32')](_0x3f9ebd[_0x2a81('0x33')],_0x3bf542);}return _0x368969[_0x2a81('0x1c')](_0x2a81('0x35'))[_0x2a81('0x21')](_0x3f9ebd,_0x10a9fa)[_0x2a81('0x29')](function(_0x52242b){if(_0x52242b&&_0x52242b['length']){return _0x52242b;}else{var _0x3df545=_[_0x2a81('0x2d')](_0x31f961);if(_0x177459[_0x2a81('0x30')]){var _0x1c11d5={};_0x1c11d5[_0x177459[_0x2a81('0x30')]]=_0x4711ca;_[_0x2a81('0x32')](_0x3df545['$or'],_0x1c11d5);}return _0x368969[_0x2a81('0x1c')](_0x2a81('0x36'))[_0x2a81('0x21')](_0x3df545,_0x10a9fa);}});}});case _0x2a81('0x13'):var _0x179a6b=_[_0x2a81('0x2d')](_0x31f961);if(_0x177459[_0x2a81('0x2e')]){var _0x42de24={};_0x42de24[_0x177459[_0x2a81('0x2e')]]=_0x4711ca;_[_0x2a81('0x32')](_0x179a6b[_0x2a81('0x33')],_0x42de24);}return _0x368969[_0x2a81('0x1c')](_0x2a81('0x35'))[_0x2a81('0x21')](_0x179a6b,_0x10a9fa)[_0x2a81('0x2f')]();case _0x2a81('0x14'):var _0x234147=_[_0x2a81('0x2d')](_0x31f961);if(_0x177459['additionalSearchLead']){var _0x42de24={};_0x42de24[_0x177459['additionalSearchLead']]=_0x4711ca;_['merge'](_0x234147[_0x2a81('0x33')],_0x42de24);}return _0x368969[_0x2a81('0x1c')](_0x2a81('0x36'))[_0x2a81('0x21')](_0x234147,_0x10a9fa);case'account':var _0x5dc4ea=_[_0x2a81('0x2d')](_0x31f961);if(_0x177459['additionalSearchAccount']){var _0x42de24={};_0x42de24[_0x177459[_0x2a81('0x31')]]=_0x4711ca;_[_0x2a81('0x32')](_0x5dc4ea['$or'],_0x42de24);}return _0x368969[_0x2a81('0x1c')](_0x2a81('0x34'))[_0x2a81('0x21')](_0x5dc4ea,_0x10a9fa);default:return null;}})[_0x2a81('0x29')](function(_0x5ed0c6){if(_0x5ed0c6&&_0x5ed0c6[_0x2a81('0x22')]){var _0x4033f5=_['first'](_0x5ed0c6);if(_0x4033f5){return BPromise['resolve']({'id':_0x4033f5['Id'],'name':_0x4033f5[_0x2a81('0x37')],'phone':_0x4033f5['Phone'],'endUserType':_0x4033f5[_0x2a81('0x38')][_0x2a81('0x39')][_0x2a81('0x3a')]()});}}})['then'](function(_0x437580){if(_0x437580){logger['info'](_0x2a81('0x3b'),_0x437580[_0x2a81('0x12')],_0x4711ca);return BPromise[_0x2a81('0x25')](_0x437580);}else{logger[_0x2a81('0x1b')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4711ca);var _0xd3003d={'Phone':_0x4711ca};if(_0x177459[_0x2a81('0x3c')]){if(_0x177459['moduleCreate']===_0x2a81('0x13')){logger[_0x2a81('0x1b')](_0x2a81('0x3d'),_0x4711ca,_0x177459[_0x2a81('0x3c')]);_0xd3003d[_0x2a81('0x3e')]=_0x12ee5d!==_0x2a81('0x3f')?_0x12ee5d:util[_0x2a81('0x40')](_0x2a81('0x41'),_0x4711ca);}else if(_0x177459[_0x2a81('0x3c')]==='lead'){logger[_0x2a81('0x1b')](_0x2a81('0x3d'),_0x4711ca,_0x177459['moduleCreate']);_0xd3003d['LastName']=_0x12ee5d!==_0x2a81('0x3f')?_0x12ee5d:util['format'](_0x2a81('0x41'),_0x4711ca);_0xd3003d[_0x2a81('0x42')]='No\x20Company';}else if(_0x177459[_0x2a81('0x3c')]===_0x2a81('0x16')){logger['info'](_0x2a81('0x3d'),_0x4711ca,_0x177459[_0x2a81('0x3c')]);_0xd3003d['Name']=_0x12ee5d!==_0x2a81('0x3f')?_0x12ee5d:util['format'](_0x2a81('0x41'),_0x4711ca);}else{return null;}}return _0x368969['sobject'](_[_0x2a81('0x43')](_0x177459[_0x2a81('0x3c')]))[_0x2a81('0x1d')](_0xd3003d)['then'](function(_0x4357e9){return BPromise['resolve']({'id':_0x4357e9['id'],'endUserType':_0x177459[_0x2a81('0x3c')]});});}});}function getCustomFields(_0x1c1eb2,_0x444ebd){var _0x490f82={};if(_0x1c1eb2['length']>0x0){_[_0x2a81('0x44')](_0x1c1eb2,function(_0x2ee0c5){if(_[_0x2a81('0x45')](['string',_0x2a81('0x46')],_0x2ee0c5[_0x2a81('0x39')])&&_0x2ee0c5[_0x2a81('0x47')]){_0x490f82[_0x2ee0c5['idField']]=_0x2ee0c5[_0x2a81('0x48')][_0x2a81('0x49')]();}else if(_0x2ee0c5[_0x2a81('0x39')]===_0x2a81('0x4a')&&_0x2ee0c5[_0x2a81('0x4b')]&&_0x2ee0c5[_0x2a81('0x47')]){_0x444ebd[_0x2ee0c5[_0x2a81('0x4b')]]&&(_0x490f82[_0x2ee0c5[_0x2a81('0x47')]]=_0x444ebd[_0x2ee0c5[_0x2a81('0x4b')]][_0x2a81('0x49')]());}else if(_0x2ee0c5[_0x2a81('0x39')]==='customVariable'&&_0x2ee0c5[_0x2a81('0x4c')]&&_0x2ee0c5[_0x2a81('0x4c')][_0x2a81('0x4d')]&&_0x2ee0c5[_0x2a81('0x47')]){_0x444ebd[_0x2ee0c5[_0x2a81('0x4c')][_0x2a81('0x4d')]['toLowerCase']()]&&(_0x490f82[_0x2ee0c5['idField']]=_0x444ebd[_0x2ee0c5['Variable'][_0x2a81('0x4d')]['toLowerCase']()][_0x2a81('0x49')]());}});}return _0x490f82;}function getConnection(_0x33e82c){var _0x389889=_0x33e82c['password']['concat'](_0x33e82c[_0x2a81('0x4e')]);var _0x2baf11=new jsforce[(_0x2a81('0x4f'))]({'oauth2':{'loginUrl':_0x33e82c[_0x2a81('0x50')]||_0x2a81('0x51'),'clientId':_0x33e82c[_0x2a81('0x52')],'clientSecret':_0x33e82c[_0x2a81('0x53')]}});return _0x2baf11[_0x2a81('0x54')](_0x33e82c[_0x2a81('0x55')],_0x389889)[_0x2a81('0x29')](function(){logger[_0x2a81('0x1b')](_0x2a81('0x56'));return _0x2baf11;});}exports[_0x2a81('0x57')]=function(_0x433b90,_0x1e12be,_0x3aa3f7,_0x5aa937,_0x55a577,_0x198b0b){var _0x260f43,_0x11f47f,_0x4e2149,_0x449c75;_0x198b0b['serverUrl']=intUtil[_0x2a81('0x58')](_0x198b0b[_0x2a81('0x59')]);_0x198b0b[_0x2a81('0x50')]=intUtil[_0x2a81('0x58')](_0x198b0b[_0x2a81('0x50')]);if(_0x55a577&&_0x55a577['monitor_format']){logger[_0x2a81('0x1b')](_0x2a81('0x5a'),_0x2a81('0x5b'));_0x1e12be[_0x2a81('0x5c')]=util[_0x2a81('0x40')](_0x2a81('0x5d'),_0x198b0b[_0x2a81('0x59')],_0x1e12be[_0x2a81('0x5e')],md5(_0x1e12be[_0x2a81('0x5e')]));}else{_0x1e12be[_0x2a81('0x5c')]='';}return getConnection(_0x198b0b)[_0x2a81('0x29')](function(_0x32efa6){_0x449c75=_0x32efa6;return getUser(_0x198b0b,_0x5aa937['email'],_0x449c75);})[_0x2a81('0x29')](function(_0x54fac9){_0x260f43=_0x54fac9;return getEndUser(_0x198b0b,_0x3aa3f7,_0x1e12be[_0x2a81('0x5f')],_0x1e12be[_0x2a81('0x60')],_0x449c75);})[_0x2a81('0x29')](function(_0x3213c0){_0x11f47f=_0x3213c0;return getTicket(_0x198b0b,_0x260f43,_0x11f47f,_0x3aa3f7,_0x1e12be,_0x3aa3f7[_0x2a81('0x61')],_0x449c75,_0x2a81('0x57'));})['then'](function(_0x4867e1){_0x4e2149=_0x4867e1;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x4e2149['id']);logger[_0x2a81('0x1b')](_0x2a81('0x62'),_0x4e2149['id'],_0x5aa937[_0x2a81('0x4d')],_0x198b0b[_0x2a81('0x39')]);switch(_0x198b0b[_0x2a81('0x39')]){case _0x2a81('0x63'):emit(util[_0x2a81('0x40')]('user:%s',_0x5aa937[_0x2a81('0x4d')]),_0x2a81('0x64'),{'recordId':_0x4e2149['id']});break;case'newTab':emit(util[_0x2a81('0x40')](_0x2a81('0x65'),_0x5aa937[_0x2a81('0x4d')]),_0x2a81('0x66'),{'uri':util['format']('%s/%s/e',_0x449c75[_0x2a81('0x67')],_0x4e2149['id'])});break;default:logger['error'](_0x2a81('0x68'));}})[_0x2a81('0x69')](function(_0x4ac918){logger['error'](_0x2a81('0x5a'),_0x4ac918);});};exports['outbound']=function(_0x23184c,_0x200e61,_0xd6744c,_0x135ecc,_0x4bfd4d,_0x4469f5,_0x5c9b4f){var _0x5b7cb8,_0x2c6970,_0x5b170c,_0x20cf8a;_0x4469f5[_0x2a81('0x59')]=intUtil['stripTrailingSlash'](_0x4469f5[_0x2a81('0x59')]);_0x4469f5[_0x2a81('0x50')]=intUtil[_0x2a81('0x58')](_0x4469f5[_0x2a81('0x50')]);if(_0x5c9b4f&&_0x5c9b4f[_0x2a81('0x6a')]&&_0x5c9b4f[_0x2a81('0x6a')]!=='none'){logger[_0x2a81('0x1b')]('[OUTBOUND]',_0x2a81('0x5b'));_0x200e61['recordingURL']=util[_0x2a81('0x40')](_0x2a81('0x5d'),_0x4469f5[_0x2a81('0x59')],_0x200e61[_0x2a81('0x5e')],md5(_0x200e61[_0x2a81('0x5e')]));}return getConnection(_0x4469f5)[_0x2a81('0x29')](function(_0x12352c){_0x20cf8a=_0x12352c;return getUser(_0x4469f5,_0x135ecc[_0x2a81('0x6b')],_0x20cf8a);})['then'](function(_0xd24013){_0x5b7cb8=_0xd24013;return getEndUser(_0x4469f5,_0xd6744c,_0x200e61['destcalleridname'],_0x200e61[_0x2a81('0x6c')],_0x20cf8a);})['then'](function(_0x4bf130){_0x2c6970=_0x4bf130;return getTicket(_0x4469f5,_0x5b7cb8,_0x2c6970,_0xd6744c,_0x200e61,_0xd6744c['Fields'],_0x20cf8a,_0x2a81('0x6d'));})[_0x2a81('0x29')](function(_0x6d6bc3){_0x5b170c=_0x6d6bc3;logger[_0x2a81('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5b170c['id']);logger[_0x2a81('0x1b')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5b170c['id'],_0x135ecc[_0x2a81('0x4d')],_0x4469f5[_0x2a81('0x39')]);switch(_0x4469f5[_0x2a81('0x39')]){case'integrationTab':emit(util[_0x2a81('0x40')](_0x2a81('0x65'),_0x135ecc[_0x2a81('0x4d')]),'trigger:salesforce:display',{'recordId':_0x5b170c['id']});break;case _0x2a81('0x6e'):emit(util['format'](_0x2a81('0x65'),_0x135ecc[_0x2a81('0x4d')]),_0x2a81('0x66'),{'uri':util[_0x2a81('0x40')](_0x2a81('0x6f'),_0x20cf8a[_0x2a81('0x67')],_0x5b170c['id'])});break;default:logger[_0x2a81('0x70')](_0x2a81('0x71'),_0x2a81('0x72'));}})['catch'](function(_0x4a2fb8){logger[_0x2a81('0x70')](_0x2a81('0x71'),_0x4a2fb8);});};exports[_0x2a81('0x73')]=function(_0xd69830,_0x34f335,_0x1fa8dd,_0x18fca9,_0xdd4dc6,_0x4f339d){var _0x27848a,_0x5adf22,_0x52c217,_0x262c0b;_0x4f339d[_0x2a81('0x59')]=intUtil[_0x2a81('0x58')](_0x4f339d[_0x2a81('0x59')]);_0x4f339d[_0x2a81('0x50')]=intUtil['stripTrailingSlash'](_0x4f339d['remoteUri']);if(_0xdd4dc6&&_0xdd4dc6[_0x2a81('0x74')]){logger[_0x2a81('0x1b')]('['+_0x34f335[_0x2a81('0x75')][_0x2a81('0x76')]()+']',_0x2a81('0x5b'));_0x34f335[_0x2a81('0x5c')]=util['format'](_0x2a81('0x5d'),_0x4f339d[_0x2a81('0x59')],_0x34f335['uniqueid'],md5(_0x34f335[_0x2a81('0x5e')]));}else{_0x34f335[_0x2a81('0x5c')]='';}return getConnection(_0x4f339d)[_0x2a81('0x29')](function(_0x33e90a){_0x262c0b=_0x33e90a;if(!_[_0x2a81('0x1e')](_0x18fca9)){return getUser(_0x4f339d,_0x18fca9['name'],_0x262c0b);}else{return getUser(_0x4f339d,null,_0x262c0b);}})[_0x2a81('0x29')](function(_0x3f75f8){_0x27848a=_0x3f75f8;return getEndUser(_0x4f339d,_0x1fa8dd,_0x34f335['calleridname'],_0x34f335[_0x2a81('0x60')],_0x262c0b);})[_0x2a81('0x29')](function(_0x176ba0){_0x5adf22=_0x176ba0;return getTicket(_0x4f339d,_0x27848a,_0x5adf22,_0x1fa8dd,_0x34f335,_0x1fa8dd[_0x2a81('0x61')],_0x262c0b);})['then'](function(_0xe99cca){_0x52c217=_0xe99cca;logger[_0x2a81('0x1b')]('['+_0x34f335[_0x2a81('0x75')]['toUpperCase']()+_0x2a81('0x77'),_0x52c217['id']);logger[_0x2a81('0x1b')]('['+_0x34f335[_0x2a81('0x75')][_0x2a81('0x76')]()+']\x20Integration\x20account\x20type\x20%s.',_0x4f339d[_0x2a81('0x39')]);})['catch'](function(_0x5e48dd){logger['error']('['+_0x34f335[_0x2a81('0x75')]['toUpperCase']()+']',_0x5e48dd);});}; \ No newline at end of file +var _0x4a3c=['string','picklist','type','idField','toString','variable','variableName','customVariable','name','Variable','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','isNil','calleridname','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','account','WhatId','Case','contact','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','sobject','find','execute','then','length','Email','Agent\x20%s\x20found.','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','additionalSearchLead','merge','$or','Lead','additionalSearchAccount','Contact','Account','first','Name','Phone','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','','format','Caller\x20-\x20%s','LastName','Company','upperFirst','includes'];(function(_0xbf089a,_0x2e4466){var _0xd2369a=function(_0x2c1bc7){while(--_0x2c1bc7){_0xbf089a['push'](_0xbf089a['shift']());}};_0xd2369a(++_0x2e4466);}(_0x4a3c,0x141));var _0xc4a3=function(_0x4accd7,_0x4979c3){_0x4accd7=_0x4accd7-0x0;var _0x14dd90=_0x4a3c[_0x4accd7];return _0x14dd90;};'use strict';var _=require(_0xc4a3('0x0'));var rp=require('request-promise');var moment=require(_0xc4a3('0x1'));var BPromise=require(_0xc4a3('0x2'));var md5=require(_0xc4a3('0x3'));var jsforce=require(_0xc4a3('0x4'));var util=require(_0xc4a3('0x5'));var Redis=require(_0xc4a3('0x6'));var intUtil=require(_0xc4a3('0x7'));var config=require(_0xc4a3('0x8'));var logger=require(_0xc4a3('0x9'))(_0xc4a3('0xa'));config[_0xc4a3('0xb')]=_[_0xc4a3('0xc')](config[_0xc4a3('0xb')],{'host':_0xc4a3('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x16d9da,_0x34ad69,_0x14ca0f){io['to'](_0x16d9da)[_0xc4a3('0xe')](_0x34ad69,_0x14ca0f);}function getTicket(_0x3c7215,_0x3b2a1b,_0x19a172,_0x1d41f7,_0x119198,_0x27ce2,_0x228b71,_0x3d07d6){var _0x18e597=Object[_0xc4a3('0xf')]({},{'OwnerId':_0x3b2a1b['id'],'Subject':intUtil['getString'](_0x1d41f7[_0xc4a3('0x10')],_0x119198,'\x20'),'Description':intUtil['getString'](_0x1d41f7[_0xc4a3('0x11')],_0x119198,'\x0a')},getCustomFields(_0x27ce2,_0x119198));if(_0x19a172){if(_0x1d41f7[_0xc4a3('0x12')]===_0xc4a3('0x13')){_0x18e597[_0xc4a3('0x14')]=moment[_0xc4a3('0x15')]();_0x18e597[_0xc4a3('0x16')]=![];_0x18e597[_0xc4a3('0x17')]=![];if(_0x19a172[_0xc4a3('0x18')]==='contact'||_0x19a172[_0xc4a3('0x18')]==='lead'){_0x18e597[_0xc4a3('0x19')]=_0x19a172['id'];}else if(_0x19a172[_0xc4a3('0x18')]===_0xc4a3('0x1a')){_0x18e597[_0xc4a3('0x1b')]=_0x19a172['id'];}}else if(_0x1d41f7['ticketType']===_0xc4a3('0x1c')){if(_0x19a172[_0xc4a3('0x18')]===_0xc4a3('0x1d')){_0x18e597[_0xc4a3('0x1e')]=_0x19a172['id'];}else if(_0x19a172['endUserType']===_0xc4a3('0x1a')){_0x18e597['AccountId']=_0x19a172['id'];}else if(_0x19a172[_0xc4a3('0x18')]===_0xc4a3('0x1f')&&_0x1d41f7[_0xc4a3('0x20')]){_0x18e597[_0x1d41f7[_0xc4a3('0x20')]]=_0x19a172['id'];}else{logger[_0xc4a3('0x21')](_0xc4a3('0x22'));}}}return _0x228b71['sobject'](_0x1d41f7[_0xc4a3('0x12')])[_0xc4a3('0x23')](_0x18e597);}function getUser(_0x3c9f03,_0x15ba61,_0x149772){if(!_['isNil'](_0x15ba61)&&intUtil['validateEmail'](_0x15ba61)){var _0x4d72ad={'Email':_0x15ba61};var _0x15b47d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x149772[_0xc4a3('0x24')]('User')[_0xc4a3('0x25')](_0x4d72ad,_0x15b47d)[_0xc4a3('0x26')]()[_0xc4a3('0x27')](function(_0xdcdc19){if(_0xdcdc19[_0xc4a3('0x28')]){var _0x21c40e=_[_0xc4a3('0x25')](_0xdcdc19,function(_0x27df19){return _0x27df19[_0xc4a3('0x29')]===_0x15ba61;});if(_0x21c40e){logger[_0xc4a3('0x21')](_0xc4a3('0x2a'),_0x15ba61);return BPromise['resolve']({'id':_0x21c40e['Id'],'name':_0x21c40e['Name']});}}else{logger[_0xc4a3('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x15ba61);return _0x149772[_0xc4a3('0x2b')]()[_0xc4a3('0x27')](function(_0x584e65){return BPromise['resolve']({'id':_0x584e65[_0xc4a3('0x2c')],'name':_0x584e65[_0xc4a3('0x2d')]});});}});}else{logger[_0xc4a3('0x21')](_0xc4a3('0x2e'),_0x15ba61);return _0x149772[_0xc4a3('0x2b')]()[_0xc4a3('0x27')](function(_0x3b7073){return BPromise[_0xc4a3('0x2f')]({'id':_0x3b7073[_0xc4a3('0x2c')],'name':_0x3b7073[_0xc4a3('0x2d')]});});}}function getEndUser(_0x58a1e0,_0x430cbc,_0x23dd05,_0x315b46,_0x5d2595){var _0x4639dd={'$or':{'Phone':_0x315b46}};var _0x4a90da={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc4a3('0x2f')]()[_0xc4a3('0x27')](function(){logger['info'](_0xc4a3('0x30'),_0x315b46,_0x430cbc[_0xc4a3('0x31')]);switch(_0x430cbc[_0xc4a3('0x31')]){case _0xc4a3('0x32'):var _0x4f16ae=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc['additionalSearchContact']){var _0x1de9a2={};_0x1de9a2[_0x430cbc[_0xc4a3('0x34')]]=_0x315b46;_['merge'](_0x4f16ae['$or'],_0x1de9a2);}return _0x5d2595[_0xc4a3('0x24')]('Contact')[_0xc4a3('0x25')](_0x4f16ae,_0x4a90da)[_0xc4a3('0x26')]()[_0xc4a3('0x27')](function(_0x2dd954){if(_0x2dd954&&_0x2dd954[_0xc4a3('0x28')]){return _0x2dd954;}else{var _0x923d5=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc[_0xc4a3('0x35')]){var _0x3671df={};_0x3671df[_0x430cbc[_0xc4a3('0x35')]]=_0x315b46;_[_0xc4a3('0x36')](_0x923d5[_0xc4a3('0x37')],_0x3671df);}return _0x5d2595[_0xc4a3('0x24')](_0xc4a3('0x38'))[_0xc4a3('0x25')](_0x923d5,_0x4a90da);}});case'account_contact_lead':var _0x33a09f=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc['additionalSearchAccount']){var _0x1de9a2={};_0x1de9a2[_0x430cbc[_0xc4a3('0x39')]]=_0x315b46;_[_0xc4a3('0x36')](_0x33a09f[_0xc4a3('0x37')],_0x1de9a2);}return _0x5d2595[_0xc4a3('0x24')]('Account')['find'](_0x33a09f,_0x4a90da)[_0xc4a3('0x26')]()[_0xc4a3('0x27')](function(_0x20afe9){if(_0x20afe9&&_0x20afe9['length']){return _0x20afe9;}else{var _0x584dcd=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc['additionalSearchContact']){var _0x4269f2={};_0x4269f2[_0x430cbc['additionalSearchContact']]=_0x315b46;_[_0xc4a3('0x36')](_0x584dcd[_0xc4a3('0x37')],_0x4269f2);}return _0x5d2595[_0xc4a3('0x24')]('Contact')[_0xc4a3('0x25')](_0x584dcd,_0x4a90da)[_0xc4a3('0x27')](function(_0xd73bce){if(_0xd73bce&&_0xd73bce[_0xc4a3('0x28')]){return _0xd73bce;}else{var _0x379ad3=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc[_0xc4a3('0x35')]){var _0x3edf8={};_0x3edf8[_0x430cbc[_0xc4a3('0x35')]]=_0x315b46;_[_0xc4a3('0x36')](_0x379ad3[_0xc4a3('0x37')],_0x3edf8);}return _0x5d2595[_0xc4a3('0x24')](_0xc4a3('0x38'))['find'](_0x379ad3,_0x4a90da);}});}});case _0xc4a3('0x1d'):var _0x4f16ae=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc[_0xc4a3('0x34')]){var _0x1de9a2={};_0x1de9a2[_0x430cbc[_0xc4a3('0x34')]]=_0x315b46;_[_0xc4a3('0x36')](_0x4f16ae[_0xc4a3('0x37')],_0x1de9a2);}return _0x5d2595[_0xc4a3('0x24')](_0xc4a3('0x3a'))[_0xc4a3('0x25')](_0x4f16ae,_0x4a90da)[_0xc4a3('0x26')]();case'lead':var _0x15ed3c=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc[_0xc4a3('0x35')]){var _0x1de9a2={};_0x1de9a2[_0x430cbc['additionalSearchLead']]=_0x315b46;_['merge'](_0x15ed3c[_0xc4a3('0x37')],_0x1de9a2);}return _0x5d2595[_0xc4a3('0x24')](_0xc4a3('0x38'))['find'](_0x15ed3c,_0x4a90da);case _0xc4a3('0x1a'):var _0x33a09f=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc[_0xc4a3('0x39')]){var _0x1de9a2={};_0x1de9a2[_0x430cbc[_0xc4a3('0x39')]]=_0x315b46;_[_0xc4a3('0x36')](_0x33a09f[_0xc4a3('0x37')],_0x1de9a2);}return _0x5d2595[_0xc4a3('0x24')](_0xc4a3('0x3b'))['find'](_0x33a09f,_0x4a90da);default:return null;}})[_0xc4a3('0x27')](function(_0x54ef6d){if(_0x54ef6d&&_0x54ef6d[_0xc4a3('0x28')]){var _0x536a6d=_[_0xc4a3('0x3c')](_0x54ef6d);if(_0x536a6d){return BPromise[_0xc4a3('0x2f')]({'id':_0x536a6d['Id'],'name':_0x536a6d[_0xc4a3('0x3d')],'phone':_0x536a6d[_0xc4a3('0x3e')],'endUserType':_0x536a6d['attributes']['type'][_0xc4a3('0x3f')]()});}}})[_0xc4a3('0x27')](function(_0x434030){if(_0x434030){logger['info'](_0xc4a3('0x40'),_0x434030[_0xc4a3('0x18')],_0x315b46);return BPromise['resolve'](_0x434030);}else{logger['info'](_0xc4a3('0x41'),_0x315b46);var _0x2de73e={'Phone':_0x315b46};if(_0x430cbc['moduleCreate']){if(_0x430cbc['moduleCreate']===_0xc4a3('0x1d')){logger[_0xc4a3('0x21')](_0xc4a3('0x42'),_0x315b46,_0x430cbc[_0xc4a3('0x43')]);_0x2de73e['LastName']=_0x23dd05!==_0xc4a3('0x44')?_0x23dd05:util[_0xc4a3('0x45')](_0xc4a3('0x46'),_0x315b46);}else if(_0x430cbc[_0xc4a3('0x43')]==='lead'){logger[_0xc4a3('0x21')](_0xc4a3('0x42'),_0x315b46,_0x430cbc[_0xc4a3('0x43')]);_0x2de73e[_0xc4a3('0x47')]=_0x23dd05!==_0xc4a3('0x44')?_0x23dd05:util['format'](_0xc4a3('0x46'),_0x315b46);_0x2de73e[_0xc4a3('0x48')]='No\x20Company';}else if(_0x430cbc[_0xc4a3('0x43')]===_0xc4a3('0x1a')){logger[_0xc4a3('0x21')](_0xc4a3('0x42'),_0x315b46,_0x430cbc[_0xc4a3('0x43')]);_0x2de73e[_0xc4a3('0x3d')]=_0x23dd05!==_0xc4a3('0x44')?_0x23dd05:util[_0xc4a3('0x45')](_0xc4a3('0x46'),_0x315b46);}else{return null;}}return _0x5d2595[_0xc4a3('0x24')](_[_0xc4a3('0x49')](_0x430cbc[_0xc4a3('0x43')]))['create'](_0x2de73e)[_0xc4a3('0x27')](function(_0x37dfbe){return BPromise[_0xc4a3('0x2f')]({'id':_0x37dfbe['id'],'endUserType':_0x430cbc['moduleCreate']});});}});}function getCustomFields(_0xc9ca0,_0x732c18){var _0x2bebb7={};if(_0xc9ca0[_0xc4a3('0x28')]>0x0){_['forEach'](_0xc9ca0,function(_0x575fa0){if(_[_0xc4a3('0x4a')]([_0xc4a3('0x4b'),_0xc4a3('0x4c')],_0x575fa0[_0xc4a3('0x4d')])&&_0x575fa0[_0xc4a3('0x4e')]){_0x2bebb7[_0x575fa0['idField']]=_0x575fa0['content'][_0xc4a3('0x4f')]();}else if(_0x575fa0[_0xc4a3('0x4d')]===_0xc4a3('0x50')&&_0x575fa0[_0xc4a3('0x51')]&&_0x575fa0['idField']){_0x732c18[_0x575fa0[_0xc4a3('0x51')]]&&(_0x2bebb7[_0x575fa0[_0xc4a3('0x4e')]]=_0x732c18[_0x575fa0[_0xc4a3('0x51')]]['toString']());}else if(_0x575fa0['type']===_0xc4a3('0x52')&&_0x575fa0['Variable']&&_0x575fa0['Variable'][_0xc4a3('0x53')]&&_0x575fa0[_0xc4a3('0x4e')]){_0x732c18[_0x575fa0['Variable'][_0xc4a3('0x53')][_0xc4a3('0x3f')]()]&&(_0x2bebb7[_0x575fa0['idField']]=_0x732c18[_0x575fa0[_0xc4a3('0x54')][_0xc4a3('0x53')][_0xc4a3('0x3f')]()][_0xc4a3('0x4f')]());}});}return _0x2bebb7;}function getConnection(_0x153c10){var _0xe93d3=_0x153c10[_0xc4a3('0x55')][_0xc4a3('0x56')](_0x153c10[_0xc4a3('0x57')]);var _0x310dda=new jsforce[(_0xc4a3('0x58'))]({'oauth2':{'loginUrl':_0x153c10[_0xc4a3('0x59')]||_0xc4a3('0x5a'),'clientId':_0x153c10[_0xc4a3('0x5b')],'clientSecret':_0x153c10[_0xc4a3('0x5c')]}});return _0x310dda[_0xc4a3('0x5d')](_0x153c10['username'],_0xe93d3)['then'](function(){logger[_0xc4a3('0x21')](_0xc4a3('0x5e'));return _0x310dda;});}exports[_0xc4a3('0x5f')]=function(_0x5c1832,_0x7d354a,_0x3a5f60,_0x449994,_0x4fbb9b,_0x607fb2){var _0x3cb273,_0x23f04d,_0x56128a,_0x38107a;_0x607fb2[_0xc4a3('0x60')]=intUtil[_0xc4a3('0x61')](_0x607fb2[_0xc4a3('0x60')]);_0x607fb2[_0xc4a3('0x59')]=intUtil['stripTrailingSlash'](_0x607fb2[_0xc4a3('0x59')]);if(_0x4fbb9b&&_0x4fbb9b[_0xc4a3('0x62')]){logger[_0xc4a3('0x21')]('[QUEUE]',_0xc4a3('0x63'));_0x7d354a[_0xc4a3('0x64')]=util[_0xc4a3('0x45')](_0xc4a3('0x65'),_0x607fb2['serverUrl'],_0x7d354a['uniqueid'],md5(_0x7d354a[_0xc4a3('0x66')]));}else{_0x7d354a[_0xc4a3('0x64')]='';}return getConnection(_0x607fb2)[_0xc4a3('0x27')](function(_0xea7784){_0x38107a=_0xea7784;return getUser(_0x607fb2,_0x449994[_0xc4a3('0x67')],_0x38107a);})[_0xc4a3('0x27')](function(_0x33790d){_0x3cb273=_0x33790d;return getEndUser(_0x607fb2,_0x3a5f60,_0x7d354a['calleridname'],_0x7d354a[_0xc4a3('0x68')],_0x38107a);})[_0xc4a3('0x27')](function(_0x51dba4){_0x23f04d=_0x51dba4;return getTicket(_0x607fb2,_0x3cb273,_0x23f04d,_0x3a5f60,_0x7d354a,_0x3a5f60['Fields'],_0x38107a,_0xc4a3('0x5f'));})[_0xc4a3('0x27')](function(_0x9f8c4c){_0x56128a=_0x9f8c4c;logger[_0xc4a3('0x21')](_0xc4a3('0x69'),_0x56128a['id']);logger[_0xc4a3('0x21')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x56128a['id'],_0x449994[_0xc4a3('0x53')],_0x607fb2['type']);switch(_0x607fb2['type']){case _0xc4a3('0x6a'):emit(util[_0xc4a3('0x45')]('user:%s',_0x449994[_0xc4a3('0x53')]),_0xc4a3('0x6b'),{'recordId':_0x56128a['id']});break;case _0xc4a3('0x6c'):emit(util[_0xc4a3('0x45')](_0xc4a3('0x6d'),_0x449994[_0xc4a3('0x53')]),_0xc4a3('0x6e'),{'uri':util[_0xc4a3('0x45')](_0xc4a3('0x6f'),_0x38107a[_0xc4a3('0x70')],_0x56128a['id'])});break;default:logger[_0xc4a3('0x71')](_0xc4a3('0x72'));}})[_0xc4a3('0x73')](function(_0x48c30e){logger[_0xc4a3('0x71')](_0xc4a3('0x74'),_0x48c30e);});};exports[_0xc4a3('0x75')]=function(_0x20edbd,_0x2b21c6,_0x2cc4e8,_0xe48494,_0x113834,_0x28a861,_0xc4bbb6){var _0x36844d,_0x54aaac,_0x4fd1cc,_0x2a1417;_0x28a861[_0xc4a3('0x60')]=intUtil[_0xc4a3('0x61')](_0x28a861['serverUrl']);_0x28a861[_0xc4a3('0x59')]=intUtil[_0xc4a3('0x61')](_0x28a861[_0xc4a3('0x59')]);if(_0xc4bbb6&&_0xc4bbb6['recordingFormat']&&_0xc4bbb6['recordingFormat']!==_0xc4a3('0x76')){logger[_0xc4a3('0x21')](_0xc4a3('0x77'),'Recording\x20is\x20enabled!');_0x2b21c6[_0xc4a3('0x64')]=util['format'](_0xc4a3('0x65'),_0x28a861[_0xc4a3('0x60')],_0x2b21c6[_0xc4a3('0x66')],md5(_0x2b21c6['uniqueid']));}return getConnection(_0x28a861)['then'](function(_0x49485d){_0x2a1417=_0x49485d;return getUser(_0x28a861,_0xe48494[_0xc4a3('0x67')],_0x2a1417);})[_0xc4a3('0x27')](function(_0x4f2ccd){_0x36844d=_0x4f2ccd;return getEndUser(_0x28a861,_0x2cc4e8,_0x2b21c6[_0xc4a3('0x78')],_0x2b21c6[_0xc4a3('0x79')],_0x2a1417);})[_0xc4a3('0x27')](function(_0x117506){_0x54aaac=_0x117506;return getTicket(_0x28a861,_0x36844d,_0x54aaac,_0x2cc4e8,_0x2b21c6,_0x2cc4e8[_0xc4a3('0x7a')],_0x2a1417,_0xc4a3('0x75'));})[_0xc4a3('0x27')](function(_0x573cdd){_0x4fd1cc=_0x573cdd;logger[_0xc4a3('0x21')](_0xc4a3('0x7b'),_0x4fd1cc['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4fd1cc['id'],_0xe48494[_0xc4a3('0x53')],_0x28a861['type']);switch(_0x28a861['type']){case _0xc4a3('0x6a'):emit(util[_0xc4a3('0x45')](_0xc4a3('0x6d'),_0xe48494['name']),_0xc4a3('0x6b'),{'recordId':_0x4fd1cc['id']});break;case'newTab':emit(util[_0xc4a3('0x45')](_0xc4a3('0x6d'),_0xe48494[_0xc4a3('0x53')]),_0xc4a3('0x6e'),{'uri':util[_0xc4a3('0x45')](_0xc4a3('0x6f'),_0x2a1417[_0xc4a3('0x70')],_0x4fd1cc['id'])});break;default:logger[_0xc4a3('0x71')](_0xc4a3('0x77'),_0xc4a3('0x7c'));}})[_0xc4a3('0x73')](function(_0xdd4d47){logger['error'](_0xc4a3('0x77'),_0xdd4d47);});};exports[_0xc4a3('0x7d')]=function(_0x22a7e7,_0x47b7a5,_0x1384ff,_0x248fcc,_0x4d0fde,_0x2c2f53){var _0x57b7c5,_0x5428f7,_0x23a153,_0x1d6e53;_0x2c2f53['serverUrl']=intUtil['stripTrailingSlash'](_0x2c2f53[_0xc4a3('0x60')]);_0x2c2f53[_0xc4a3('0x59')]=intUtil[_0xc4a3('0x61')](_0x2c2f53[_0xc4a3('0x59')]);if(_0x4d0fde&&_0x4d0fde[_0xc4a3('0x62')]){logger[_0xc4a3('0x21')]('['+_0x47b7a5['lastevent']['toUpperCase']()+']',_0xc4a3('0x63'));_0x47b7a5['recordingURL']=util[_0xc4a3('0x45')](_0xc4a3('0x65'),_0x2c2f53[_0xc4a3('0x60')],_0x47b7a5[_0xc4a3('0x66')],md5(_0x47b7a5[_0xc4a3('0x66')]));}else{_0x47b7a5[_0xc4a3('0x64')]='';}return getConnection(_0x2c2f53)['then'](function(_0x546cfa){_0x1d6e53=_0x546cfa;if(!_[_0xc4a3('0x7e')](_0x248fcc)){return getUser(_0x2c2f53,_0x248fcc[_0xc4a3('0x53')],_0x1d6e53);}else{return getUser(_0x2c2f53,null,_0x1d6e53);}})[_0xc4a3('0x27')](function(_0x3f61dd){_0x57b7c5=_0x3f61dd;return getEndUser(_0x2c2f53,_0x1384ff,_0x47b7a5[_0xc4a3('0x7f')],_0x47b7a5[_0xc4a3('0x68')],_0x1d6e53);})['then'](function(_0x1e7638){_0x5428f7=_0x1e7638;return getTicket(_0x2c2f53,_0x57b7c5,_0x5428f7,_0x1384ff,_0x47b7a5,_0x1384ff[_0xc4a3('0x7a')],_0x1d6e53);})[_0xc4a3('0x27')](function(_0x229665){_0x23a153=_0x229665;logger[_0xc4a3('0x21')]('['+_0x47b7a5[_0xc4a3('0x80')][_0xc4a3('0x81')]()+_0xc4a3('0x82'),_0x23a153['id']);logger[_0xc4a3('0x21')]('['+_0x47b7a5['lastevent'][_0xc4a3('0x81')]()+_0xc4a3('0x83'),_0x2c2f53[_0xc4a3('0x4d')]);})['catch'](function(_0x37ccb9){logger[_0xc4a3('0x71')]('['+_0x47b7a5[_0xc4a3('0x80')][_0xc4a3('0x81')]()+']',_0x37ccb9);});}; \ 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 1459642..7b4a05f 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 _0xe69b=['content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','forEach','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','sys_id','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','toLowerCase'];(function(_0x27f8b8,_0x3f669c){var _0x387713=function(_0x5225fd){while(--_0x5225fd){_0x27f8b8['push'](_0x27f8b8['shift']());}};_0x387713(++_0x3f669c);}(_0xe69b,0x18f));var _0xbe69=function(_0x1c940f,_0x2e8e86){_0x1c940f=_0x1c940f-0x0;var _0x1517fd=_0xe69b[_0x1c940f];return _0x1517fd;};'use strict';var _=require(_0xbe69('0x0'));var Promise=require(_0xbe69('0x1'));var rp=require(_0xbe69('0x2'));var util=require(_0xbe69('0x3'));var md5=require(_0xbe69('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xbe69('0x5'));var logger=require(_0xbe69('0x6'))(_0xbe69('0x7'));config[_0xbe69('0x8')]=_[_0xbe69('0x9')](config[_0xbe69('0x8')],{'host':_0xbe69('0xa'),'port':0x18eb});var io=require(_0xbe69('0xb'))(new Redis(config['redis']));function getAdminUser(_0x11d7c4,_0x5cd9cf,_0x4fbc13,_0x1fbbb1,_0x4a9dce,_0x5ba6e6){return new Promise(function(_0x490ed4,_0x57783f){var _0x857829={'method':_0xbe69('0xc'),'uri':_0x1fbbb1+_0xbe69('0xd')+'&'+_0x4a9dce+'&'+_0x5ba6e6,'auth':_0x5cd9cf,'json':!![]};return rp(_0x857829)[_0xbe69('0xe')](function(_0x4e2369){if(_0x4e2369[_0xbe69('0xf')][_0xbe69('0x10')]>0x0){_0x4fbc13[_0xbe69('0x11')]=_0x4e2369[_0xbe69('0xf')][0x0]['sys_id'];}logger['info']('['+[_0x11d7c4[_0xbe69('0x12')]()]+_0xbe69('0x13'),_0x4fbc13);_0x490ed4(_0x4fbc13);})[_0xbe69('0x14')](function(_0x4d3e47){logger[_0xbe69('0x15')]('['+[_0x11d7c4[_0xbe69('0x12')]()]+']',_0x4d3e47[_0xbe69('0x16')]);_0x57783f(_0x4d3e47[_0xbe69('0x16')]);});});}function getUser(_0x4b3700,_0xb7dbb3,_0x490c0d,_0x487520,_0x2afb87){return function(_0x3f78f0){logger[_0xbe69('0x17')]('['+[_0x4b3700[_0xbe69('0x12')]()]+_0xbe69('0x18'),_0x3f78f0);return new Promise(function(_0x578c6d,_0x242c46){if(intUtil[_0xbe69('0x19')](_0x3f78f0[_0xbe69('0x1a')])){var _0x583728={'method':_0xbe69('0xc'),'uri':_0x490c0d+'sys_user?sysparm_query=email%3D'+_0x3f78f0[_0xbe69('0x1a')]+'&'+_0x487520+'&'+_0x2afb87,'auth':_0xb7dbb3,'json':!![]};logger[_0xbe69('0x17')]('['+[_0x4b3700[_0xbe69('0x12')]()]+_0xbe69('0x1b'),_0x583728);return rp(_0x583728)['then'](function(_0x553c73){logger[_0xbe69('0x17')]('['+[_0x4b3700[_0xbe69('0x12')]()]+_0xbe69('0x1c'),_0x553c73);if(_0x553c73[_0xbe69('0xf')]['length']>0x0&&String(_0x553c73[_0xbe69('0xf')][0x0]['active'])===_0xbe69('0x1d')){_0x3f78f0['userId']=_0x553c73[_0xbe69('0xf')][0x0][_0xbe69('0x1e')];}else{_0x3f78f0[_0xbe69('0x1f')]=_0x3f78f0['adminId'];_0x3f78f0[_0xbe69('0x1a')]=_0x3f78f0[_0xbe69('0x20')];}logger[_0xbe69('0x17')]('['+[_0x4b3700[_0xbe69('0x12')]()]+_0xbe69('0x21'),_0x3f78f0);_0x578c6d(_0x3f78f0);})[_0xbe69('0x14')](function(_0x1f6450){logger[_0xbe69('0x15')]('['+[_0x4b3700[_0xbe69('0x12')]()]+']',_0x1f6450[_0xbe69('0x16')]);_0x242c46(_0x1f6450[_0xbe69('0x16')]);});}else{logger[_0xbe69('0x17')]('['+[_0x4b3700['toUpperCase']()]+_0xbe69('0x22'));_0x3f78f0[_0xbe69('0x1f')]=_0x3f78f0[_0xbe69('0x11')];_0x3f78f0[_0xbe69('0x1a')]=_0x3f78f0[_0xbe69('0x20')];_0x578c6d(_0x3f78f0);}});};}function createEndUser(_0x523663,_0x21afb9,_0x3c3c0f,_0x18fbf2,_0x5aa9dc){logger[_0xbe69('0x17')]('['+[_0x523663[_0xbe69('0x12')]()]+'],\x20createEndUser\x20input\x20crm',_0x3c3c0f);return new Promise(function(_0x44517f,_0x31875a){var _0x25221d={'method':_0xbe69('0x23'),'uri':_0x18fbf2+_0xbe69('0x24')+_0x5aa9dc,'body':{'user_name':_0x3c3c0f[_0xbe69('0x25')],'roles':_0xbe69('0x26'),'first_name':_0x3c3c0f[_0xbe69('0x25')],'active':_0xbe69('0x1d'),'date_format':_0xbe69('0x27'),'phone':_0x3c3c0f[_0xbe69('0x25')]},'auth':_0x21afb9,'json':!![]};return rp(_0x25221d)[_0xbe69('0xe')](function(_0x60eea7){logger[_0xbe69('0x17')]('['+[_0x523663[_0xbe69('0x12')]()]+_0xbe69('0x28'),_0x60eea7[_0xbe69('0xf')]);_0x3c3c0f[_0xbe69('0x29')]=_0x60eea7[_0xbe69('0xf')][_0xbe69('0x1e')];_0x44517f(_0x3c3c0f);})[_0xbe69('0x14')](function(_0x4976a8){logger[_0xbe69('0x15')]('['+[_0x523663[_0xbe69('0x12')]()]+']',_0x4976a8[_0xbe69('0x16')]);_0x31875a(_0x4976a8[_0xbe69('0x16')]);});});}function getEndUser(_0xa480c4,_0x2316b4,_0xd574ee,_0x2532e6,_0x4bd8bf){return function(_0x2e005b){logger[_0xbe69('0x17')]('['+[_0xa480c4[_0xbe69('0x12')]()]+_0xbe69('0x2a'),_0x2e005b);return new Promise(function(_0x5eca9d,_0x50ebb0){var _0x5c1512={'method':'GET','uri':_0xd574ee+_0xbe69('0x2b')+_0x2e005b[_0xbe69('0x25')]+'&'+_0x2532e6+'&'+_0x4bd8bf,'auth':_0x2316b4,'json':!![]};return rp(_0x5c1512)[_0xbe69('0xe')](function(_0xc70ecd){if(_0xc70ecd[_0xbe69('0xf')][_0xbe69('0x10')]>0x0){_0x2e005b['endUserId']=_0xc70ecd[_0xbe69('0xf')][0x0][_0xbe69('0x1e')];logger[_0xbe69('0x17')]('['+[_0xa480c4[_0xbe69('0x12')]()]+_0xbe69('0x2c'),_0x2e005b);_0x5eca9d(_0x2e005b);}else{return createEndUser(_0xa480c4,_0x2316b4,_0x2e005b,_0xd574ee,_0x2532e6)['then'](function(_0x4686f4){logger[_0xbe69('0x17')]('['+[_0xa480c4[_0xbe69('0x12')]()]+_0xbe69('0x2d'),_0x4686f4);_0x5eca9d(_0x4686f4);});}})[_0xbe69('0x14')](function(_0x5c3bbe){logger['error']('['+[_0xa480c4[_0xbe69('0x12')]()]+']',_0x5c3bbe['message']);_0x50ebb0(_0x5c3bbe[_0xbe69('0x16')]);});});};}function getCustomFields(_0x34ee78,_0x3468ef){var _0x375461={};if(_0x34ee78[_0xbe69('0x10')]>0x0){_['forEach'](_0x34ee78,function(_0x1b62db){if(_[_0xbe69('0x2e')]([_0xbe69('0x2f'),_0xbe69('0x30')],_0x1b62db[_0xbe69('0x31')])&&_0x1b62db[_0xbe69('0x32')]&&!_0x1b62db[_0xbe69('0x33')]){_0x375461[_0x1b62db['nameField'][_0xbe69('0x34')]()]=_0x1b62db[_0xbe69('0x35')][_0xbe69('0x36')]();}else if(_['includes']([_0xbe69('0x2f'),'picklist'],_0x1b62db[_0xbe69('0x31')])&&_0x1b62db[_0xbe69('0x37')]&&_0x1b62db['customField']){_0x375461[_0x1b62db[_0xbe69('0x37')][_0xbe69('0x34')]()]=_0x1b62db['content']['toString']();}else if(_0x1b62db[_0xbe69('0x31')]===_0xbe69('0x38')&&_0x1b62db[_0xbe69('0x39')]&&_0x1b62db['idField']&&_0x1b62db['customField']){_0x375461[_0x1b62db[_0xbe69('0x37')][_0xbe69('0x34')]()]=_0x3468ef[_0x1b62db[_0xbe69('0x39')]][_0xbe69('0x36')]();}else if(_0x1b62db[_0xbe69('0x31')]===_0xbe69('0x3a')&&_0x1b62db[_0xbe69('0x3b')]&&_0x1b62db['Variable'][_0xbe69('0x3c')]&&_0x1b62db[_0xbe69('0x37')]&&_0x1b62db['customField']){_0x375461[_0x1b62db[_0xbe69('0x37')][_0xbe69('0x34')]()]=_0x3468ef[_0x1b62db['Variable'][_0xbe69('0x3c')]['toLowerCase']()]['toString']();}});}return _0x375461;}function getTicket(_0x2897d7,_0x158b4c,_0x45e367,_0x2ea784,_0x4f2867,_0x451fba){return function(_0x2114e6){logger[_0xbe69('0x17')]('['+[_0x2897d7[_0xbe69('0x12')]()]+_0xbe69('0x3d'),_0x2114e6);return new Promise(function(_0x35148e,_0x5152ae){var _0x1344d2=_0x2897d7[_0xbe69('0x34')]()===_0xbe69('0x3e')?_0x2114e6[_0xbe69('0x1f')]:_0x2114e6[_0xbe69('0x29')];var _0xb482e8={'method':_0xbe69('0x23'),'uri':_0x45e367+_0xbe69('0x3f')+'?'+_0x451fba,'body':Object[_0xbe69('0x40')]({},{'active':_0xbe69('0x1d'),'caller_id':_0x1344d2,'assigned_to':_0x2114e6[_0xbe69('0x1f')],'short_description':intUtil[_0xbe69('0x41')](_0x2ea784[_0xbe69('0x42')],_0x4f2867,'\x20'),'description':intUtil[_0xbe69('0x41')](_0x2ea784[_0xbe69('0x43')],_0x4f2867,'\x0a')},getCustomFields(_0x2ea784[_0xbe69('0x44')],_0x4f2867)),'auth':_0x158b4c,'json':!![]};return rp(_0xb482e8)[_0xbe69('0xe')](function(_0x2de1e8){logger[_0xbe69('0x17')]('['+[_0x2897d7[_0xbe69('0x12')]()]+_0xbe69('0x45'),_0x2de1e8[_0xbe69('0xf')]);_0x2114e6[_0xbe69('0x46')]=_0x2de1e8[_0xbe69('0xf')]['sys_id'];_0x2114e6[_0xbe69('0x47')]=_0x2de1e8[_0xbe69('0xf')][_0xbe69('0x48')];logger[_0xbe69('0x17')]('['+[_0x2897d7['toUpperCase']()]+_0xbe69('0x49'),_0x2114e6);_0x35148e(_0x2114e6);})[_0xbe69('0x14')](function(_0x357da6){logger[_0xbe69('0x15')]('['+[_0x2897d7['toUpperCase']()]+']',_0x357da6[_0xbe69('0x16')]);_0x5152ae(_0x357da6['message']);});});};}function createRemoteTag(_0x50a6e8,_0x7a7e79,_0x4fafc2,_0x434857){return new Promise(function(_0x151b46,_0x1754b3){var _0x8e187d={'method':_0xbe69('0x23'),'uri':_0x4fafc2+_0xbe69('0x4a')+'?'+_0x434857,'body':{'short_description':_0x50a6e8,'global':!![],'active':!![],'name':_0x50a6e8},'auth':_0x7a7e79,'json':!![]};return rp(_0x8e187d)[_0xbe69('0xe')](function(_0x44f1d7){var _0x36f7fc=_0x44f1d7[_0xbe69('0xf')][_0xbe69('0x1e')];_0x151b46(_0x36f7fc);});});}function getRemoteTag(_0x298274,_0x168518,_0x25a12a,_0x20ce8c,_0x2575f9){return new Promise(function(_0x551071,_0x51f576){var _0xf63e09={'method':_0xbe69('0xc'),'uri':_0x25a12a+'label'+_0xbe69('0x4b')+_0x298274+'&'+_0x20ce8c,'auth':_0x168518,'json':!![]};return rp(_0xf63e09)[_0xbe69('0xe')](function(_0xcca426){if(_0xcca426[_0xbe69('0xf')][_0xbe69('0x10')]>0x0){var _0x34b319=_0xcca426['result'][0x0]['sys_id'];_0x551071(_0x34b319);}else{return createRemoteTag(_0x298274,_0x168518,_0x25a12a,_0x20ce8c)[_0xbe69('0xe')](function(_0x247ad0){_0x551071(_0x247ad0);});}});});}function assignTagToIncident(_0x3f6c7a,_0x2e5397,_0x2b430d,_0x11cc86,_0xd2798e){return new Promise(function(_0x17dc6b,_0x1ce189){var _0x10e249={'method':_0xbe69('0x23'),'uri':_0x2b430d+_0xbe69('0x4c')+'?'+_0xd2798e,'body':{'label':_0x3f6c7a,'table':_0xbe69('0x3f'),'id_type':'Incident','table_key':_0x11cc86['ticketId'],'title':_0xbe69('0x4d')+_0x11cc86[_0xbe69('0x47')],'id_display':_0x11cc86[_0xbe69('0x47')]},'auth':_0x2e5397,'json':!![]};return rp(_0x10e249)[_0xbe69('0xe')](function(_0x2c2146){_0x17dc6b();})['catch'](function(){_0x17dc6b();});});}function manageTags(_0x477c28,_0x27fbfd,_0x1136eb,_0x122e8c,_0x234220,_0x171846,_0x5286cf){return new Promise(function(_0x1c6f29,_0x1b79d2){var _0x20944b=[];_0x27fbfd[_0xbe69('0x4e')](function(_0x5d8cf5){_0x20944b[_0xbe69('0x4f')](getRemoteTag(_0x5d8cf5,_0x1136eb,_0x122e8c,_0x171846,_0x5286cf));});return Promise['all'](_0x20944b)[_0xbe69('0xe')](function(_0xa5f703){if(_0xa5f703[_0xbe69('0x10')]){logger[_0xbe69('0x17')]('['+[_0x477c28['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0xa5f703);var _0x3b3384=[];_0xa5f703[_0xbe69('0x4e')](function(_0x2d40e5){_0x3b3384[_0xbe69('0x4f')](assignTagToIncident(_0x2d40e5,_0x1136eb,_0x122e8c,_0x234220,_0x171846));});return Promise[_0xbe69('0x50')](_0x3b3384)[_0xbe69('0xe')](function(){_0x1c6f29();})[_0xbe69('0x14')](function(){_0x1c6f29();});}else{_0x1c6f29();}});});}function getTags(_0x11d45c,_0xf124bc,_0x4e2e01,_0x59f699,_0xb85ab,_0x1a93cc){return function(_0x1761ab){return new Promise(function(_0x2d806c,_0x333d50){var _0x42d675=[];var _0x1093c3=_0x59f699[_0xbe69('0x51')];if(_0x1093c3&&_0x1093c3[_0xbe69('0x10')]>0x0){_0x42d675=_[_0xbe69('0x52')](_0x1093c3,'name');}if(_0x42d675[_0xbe69('0x10')]>0x0){return manageTags(_0x11d45c,_0x42d675,_0xf124bc,_0x4e2e01,_0x1761ab,_0xb85ab,_0x1a93cc)[_0xbe69('0xe')](function(){_0x2d806c(_0x1761ab);});}else{_0x2d806c(_0x1761ab);}});};}function emit(_0x4a7613,_0x416bba,_0x3099a8){var _0x4d66f7=_0xbe69('0x53')+_0xbe69('0x54')+_0xbe69('0x55')+'%255EORDERBYDESCnumber';var _0x1e2466={'uri':_0x4a7613+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x3099a8+_0x4d66f7};io['to'](util['format']('user:%s',_0x416bba))[_0xbe69('0x56')](_0xbe69('0x57'),_0x1e2466);}exports['cs']=function(_0x3d6806,_0x4c9884,_0x1dac6b,_0xae8f7e,_0x5c42b9,_0x45ed2b,_0x224776,_0xae71d5){var _0x46fb5a={};var _0x42e640={'user':_0x45ed2b[_0xbe69('0x58')],'pass':_0x45ed2b[_0xbe69('0x59')]};var _0x16e0d1='sysparm_limit=1';var _0x2c4454=_0xbe69('0x5a');_0x45ed2b[_0xbe69('0x5b')]=intUtil['stripTrailingSlash'](_0x45ed2b[_0xbe69('0x5b')]);_0x45ed2b[_0xbe69('0x5c')]=intUtil[_0xbe69('0x5d')](_0x45ed2b[_0xbe69('0x5c')]);var _0x153a80=util[_0xbe69('0x5e')](_0xbe69('0x5f'),_0x45ed2b[_0xbe69('0x5b')]);_0x46fb5a[_0xbe69('0x1a')]=!_[_0xbe69('0x60')](_0xae8f7e)?_0xae8f7e[_0xbe69('0x61')]:null;_0x46fb5a[_0xbe69('0x20')]=_0x45ed2b[_0xbe69('0x61')];_0x46fb5a[_0xbe69('0x25')]=_0xae71d5['toLowerCase']()===_0xbe69('0x3e')?_0x4c9884[_0xbe69('0x62')]:_0x4c9884['calleridnum'];_0x46fb5a[_0xbe69('0x63')]=_0xae71d5===_0xbe69('0x64')||_0xae71d5===_0xbe69('0x65')?'queue':_0xbe69('0x3e');var _0x10295e=util[_0xbe69('0x5e')](_0xbe69('0x66'),_0x45ed2b[_0xbe69('0x5c')],_0x4c9884[_0xbe69('0x67')],md5(_0x4c9884[_0xbe69('0x67')]));if(_0x5c42b9&&_0x5c42b9[_0xbe69('0x68')]){logger[_0xbe69('0x17')](_0xbe69('0x69'),_0xbe69('0x6a'));_0x4c9884[_0xbe69('0x6b')]=_0x10295e;}else if(_0x224776&&_0x224776[_0xbe69('0x6c')]&&_0x224776['recordingFormat']!=='none'){logger[_0xbe69('0x17')]('[OUTBOUND]',_0xbe69('0x6a'));_0x4c9884[_0xbe69('0x6b')]=_0x10295e;}else{_0x4c9884[_0xbe69('0x6b')]='';}return getAdminUser(_0xae71d5,_0x42e640,_0x46fb5a,_0x153a80,_0x2c4454,_0x16e0d1)[_0xbe69('0xe')](getUser(_0xae71d5,_0x42e640,_0x153a80,_0x2c4454,_0x16e0d1))[_0xbe69('0xe')](getEndUser(_0xae71d5,_0x42e640,_0x153a80,_0x2c4454,_0x16e0d1))[_0xbe69('0xe')](getTicket(_0xae71d5,_0x42e640,_0x153a80,_0x1dac6b,_0x4c9884,_0x2c4454))[_0xbe69('0xe')](function(_0x5e827c){logger['info'](util[_0xbe69('0x5e')](_0xbe69('0x6d'),_0x5e827c['ticketId']));logger['info'](util[_0xbe69('0x5e')](_0xbe69('0x6e'),_0xae71d5));if(_0xae71d5!==_0xbe69('0x65')){logger[_0xbe69('0x17')]('['+[_0xae71d5['toUpperCase']()]+']',_0xbe69('0x6f'));emit(_0x45ed2b[_0xbe69('0x5b')],_0xae8f7e[_0xbe69('0x3c')],_0x5e827c['ticketId']);}})[_0xbe69('0x14')](function(_0x34d84a){logger['error']('['+[_0xae71d5[_0xbe69('0x12')]()]+_0xbe69('0x70'),util['inspect'](_0x34d84a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2b56=['nameField','toLowerCase','toString','string','idField','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','Subjects','Descriptions','Fields','ticketId',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','userId','adminEmail',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','true','System','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','GET','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','type','customField'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2b56,0x184));var _0x62b5=function(_0x586f48,_0x3d1aec){_0x586f48=_0x586f48-0x0;var _0x5c51ae=_0x2b56[_0x586f48];return _0x5c51ae;};'use strict';var _=require('lodash');var Promise=require(_0x62b5('0x0'));var rp=require(_0x62b5('0x1'));var util=require(_0x62b5('0x2'));var md5=require('md5');var Redis=require(_0x62b5('0x3'));var intUtil=require(_0x62b5('0x4'));var config=require('../../../../config/environment');var logger=require(_0x62b5('0x5'))(_0x62b5('0x6'));config[_0x62b5('0x7')]=_[_0x62b5('0x8')](config[_0x62b5('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x62b5('0x9'))(new Redis(config[_0x62b5('0x7')]));function getAdminUser(_0x370ed1,_0x51480b,_0x7a6f43,_0x2a8095,_0x104cbf,_0x1f4339){return new Promise(function(_0x1af12a,_0x2c580b){var _0x51c1dc={'method':'GET','uri':_0x2a8095+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x104cbf+'&'+_0x1f4339,'auth':_0x51480b,'json':!![]};return rp(_0x51c1dc)['then'](function(_0x3c8072){if(_0x3c8072[_0x62b5('0xa')][_0x62b5('0xb')]>0x0){_0x7a6f43[_0x62b5('0xc')]=_0x3c8072['result'][0x0][_0x62b5('0xd')];}logger[_0x62b5('0xe')]('['+[_0x370ed1[_0x62b5('0xf')]()]+_0x62b5('0x10'),_0x7a6f43);_0x1af12a(_0x7a6f43);})[_0x62b5('0x11')](function(_0x418b40){logger[_0x62b5('0x12')]('['+[_0x370ed1['toUpperCase']()]+']',_0x418b40[_0x62b5('0x13')]);_0x2c580b(_0x418b40[_0x62b5('0x13')]);});});}function getUser(_0x17c42c,_0x573194,_0x25e05a,_0x579750,_0x1057ab){return function(_0x1b57bc){logger['info']('['+[_0x17c42c[_0x62b5('0xf')]()]+_0x62b5('0x14'),_0x1b57bc);return new Promise(function(_0x4831ef,_0x31bf8a){if(intUtil[_0x62b5('0x15')](_0x1b57bc[_0x62b5('0x16')])){var _0x26a0d5={'method':'GET','uri':_0x25e05a+_0x62b5('0x17')+_0x1b57bc[_0x62b5('0x16')]+'&'+_0x579750+'&'+_0x1057ab,'auth':_0x573194,'json':!![]};logger[_0x62b5('0xe')]('['+[_0x17c42c['toUpperCase']()]+_0x62b5('0x18'),_0x26a0d5);return rp(_0x26a0d5)['then'](function(_0x3c90be){logger[_0x62b5('0xe')]('['+[_0x17c42c[_0x62b5('0xf')]()]+'],\x20getUser\x20entity',_0x3c90be);if(_0x3c90be[_0x62b5('0xa')][_0x62b5('0xb')]>0x0&&String(_0x3c90be[_0x62b5('0xa')][0x0]['active'])==='true'){_0x1b57bc[_0x62b5('0x19')]=_0x3c90be['result'][0x0][_0x62b5('0xd')];}else{_0x1b57bc[_0x62b5('0x19')]=_0x1b57bc[_0x62b5('0xc')];_0x1b57bc[_0x62b5('0x16')]=_0x1b57bc[_0x62b5('0x1a')];}logger[_0x62b5('0xe')]('['+[_0x17c42c[_0x62b5('0xf')]()]+'],\x20getUser\x20crm',_0x1b57bc);_0x4831ef(_0x1b57bc);})[_0x62b5('0x11')](function(_0x17934d){logger[_0x62b5('0x12')]('['+[_0x17c42c[_0x62b5('0xf')]()]+']',_0x17934d['message']);_0x31bf8a(_0x17934d[_0x62b5('0x13')]);});}else{logger[_0x62b5('0xe')]('['+[_0x17c42c['toUpperCase']()]+_0x62b5('0x1b'));_0x1b57bc[_0x62b5('0x19')]=_0x1b57bc[_0x62b5('0xc')];_0x1b57bc[_0x62b5('0x16')]=_0x1b57bc[_0x62b5('0x1a')];_0x4831ef(_0x1b57bc);}});};}function createEndUser(_0x2ccec8,_0x55d85c,_0x868e5d,_0x2b00ac,_0x13e0b0){logger[_0x62b5('0xe')]('['+[_0x2ccec8[_0x62b5('0xf')]()]+'],\x20createEndUser\x20input\x20crm',_0x868e5d);return new Promise(function(_0x1a34c0,_0x46f920){var _0x4c2ec5={'method':_0x62b5('0x1c'),'uri':_0x2b00ac+_0x62b5('0x1d')+_0x13e0b0,'body':{'user_name':_0x868e5d[_0x62b5('0x1e')],'roles':_0x62b5('0x1f'),'first_name':_0x868e5d[_0x62b5('0x1e')],'active':_0x62b5('0x20'),'date_format':_0x62b5('0x21'),'phone':_0x868e5d[_0x62b5('0x1e')]},'auth':_0x55d85c,'json':!![]};return rp(_0x4c2ec5)[_0x62b5('0x22')](function(_0x5bdd3a){logger['info']('['+[_0x2ccec8[_0x62b5('0xf')]()]+_0x62b5('0x23'),_0x5bdd3a[_0x62b5('0xa')]);_0x868e5d[_0x62b5('0x24')]=_0x5bdd3a[_0x62b5('0xa')][_0x62b5('0xd')];_0x1a34c0(_0x868e5d);})[_0x62b5('0x11')](function(_0xf12262){logger[_0x62b5('0x12')]('['+[_0x2ccec8[_0x62b5('0xf')]()]+']',_0xf12262[_0x62b5('0x13')]);_0x46f920(_0xf12262['message']);});});}function getEndUser(_0xba546d,_0x13b49e,_0x3a2cdd,_0x15bddc,_0x4cdca8){return function(_0x18fe2a){logger[_0x62b5('0xe')]('['+[_0xba546d[_0x62b5('0xf')]()]+_0x62b5('0x25'),_0x18fe2a);return new Promise(function(_0x1a51d5,_0x1458e4){var _0x13a503={'method':_0x62b5('0x26'),'uri':_0x3a2cdd+'sys_user?sysparm_query=phone%3D'+_0x18fe2a[_0x62b5('0x1e')]+'&'+_0x15bddc+'&'+_0x4cdca8,'auth':_0x13b49e,'json':!![]};return rp(_0x13a503)[_0x62b5('0x22')](function(_0x1d74bb){if(_0x1d74bb[_0x62b5('0xa')][_0x62b5('0xb')]>0x0){_0x18fe2a[_0x62b5('0x24')]=_0x1d74bb[_0x62b5('0xa')][0x0][_0x62b5('0xd')];logger['info']('['+[_0xba546d[_0x62b5('0xf')]()]+_0x62b5('0x27'),_0x18fe2a);_0x1a51d5(_0x18fe2a);}else{return createEndUser(_0xba546d,_0x13b49e,_0x18fe2a,_0x3a2cdd,_0x15bddc)[_0x62b5('0x22')](function(_0xa89e50){logger[_0x62b5('0xe')]('['+[_0xba546d[_0x62b5('0xf')]()]+_0x62b5('0x28'),_0xa89e50);_0x1a51d5(_0xa89e50);});}})[_0x62b5('0x11')](function(_0xe72eb7){logger[_0x62b5('0x12')]('['+[_0xba546d['toUpperCase']()]+']',_0xe72eb7[_0x62b5('0x13')]);_0x1458e4(_0xe72eb7['message']);});});};}function getCustomFields(_0x1a2bfd,_0x15f331){var _0x54f11e={};if(_0x1a2bfd[_0x62b5('0xb')]>0x0){_['forEach'](_0x1a2bfd,function(_0x21d2ef){if(_[_0x62b5('0x29')](['string','picklist'],_0x21d2ef[_0x62b5('0x2a')])&&_0x21d2ef['nameField']&&!_0x21d2ef[_0x62b5('0x2b')]){_0x54f11e[_0x21d2ef[_0x62b5('0x2c')][_0x62b5('0x2d')]()]=_0x21d2ef['content'][_0x62b5('0x2e')]();}else if(_[_0x62b5('0x29')]([_0x62b5('0x2f'),'picklist'],_0x21d2ef[_0x62b5('0x2a')])&&_0x21d2ef[_0x62b5('0x30')]&&_0x21d2ef[_0x62b5('0x2b')]){_0x54f11e[_0x21d2ef[_0x62b5('0x30')][_0x62b5('0x2d')]()]=_0x21d2ef[_0x62b5('0x31')]['toString']();}else if(_0x21d2ef[_0x62b5('0x2a')]===_0x62b5('0x32')&&_0x21d2ef[_0x62b5('0x33')]&&_0x21d2ef[_0x62b5('0x30')]&&_0x21d2ef['customField']){_0x54f11e[_0x21d2ef[_0x62b5('0x30')][_0x62b5('0x2d')]()]=_0x15f331[_0x21d2ef[_0x62b5('0x33')]][_0x62b5('0x2e')]();}else if(_0x21d2ef[_0x62b5('0x2a')]===_0x62b5('0x34')&&_0x21d2ef['Variable']&&_0x21d2ef[_0x62b5('0x35')][_0x62b5('0x36')]&&_0x21d2ef[_0x62b5('0x30')]&&_0x21d2ef[_0x62b5('0x2b')]){_0x54f11e[_0x21d2ef[_0x62b5('0x30')][_0x62b5('0x2d')]()]=_0x15f331[_0x21d2ef[_0x62b5('0x35')][_0x62b5('0x36')][_0x62b5('0x2d')]()]['toString']();}});}return _0x54f11e;}function getTicket(_0x29ae27,_0x408246,_0x4303d6,_0x55631c,_0x2519b0,_0x18590e){return function(_0x112869){logger[_0x62b5('0xe')]('['+[_0x29ae27[_0x62b5('0xf')]()]+_0x62b5('0x37'),_0x112869);return new Promise(function(_0x3ee8e0,_0x17a75a){var _0x3a4a29=_0x29ae27[_0x62b5('0x2d')]()==='outbound'?_0x112869['userId']:_0x112869[_0x62b5('0x24')];var _0x8a13ed={'method':_0x62b5('0x1c'),'uri':_0x4303d6+'incident'+'?'+_0x18590e,'body':Object[_0x62b5('0x38')]({},{'active':'true','caller_id':_0x3a4a29,'assigned_to':_0x112869[_0x62b5('0x19')],'short_description':intUtil[_0x62b5('0x39')](_0x55631c[_0x62b5('0x3a')],_0x2519b0,'\x20'),'description':intUtil[_0x62b5('0x39')](_0x55631c[_0x62b5('0x3b')],_0x2519b0,'\x0a')},getCustomFields(_0x55631c[_0x62b5('0x3c')],_0x2519b0)),'auth':_0x408246,'json':!![]};return rp(_0x8a13ed)['then'](function(_0x3aef27){logger[_0x62b5('0xe')]('['+[_0x29ae27[_0x62b5('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x3aef27[_0x62b5('0xa')]);_0x112869[_0x62b5('0x3d')]=_0x3aef27['result'][_0x62b5('0xd')];_0x112869['ticketNumber']=_0x3aef27['result']['number'];logger['info']('['+[_0x29ae27[_0x62b5('0xf')]()]+_0x62b5('0x3e'),_0x112869);_0x3ee8e0(_0x112869);})[_0x62b5('0x11')](function(_0x49bf46){logger[_0x62b5('0x12')]('['+[_0x29ae27[_0x62b5('0xf')]()]+']',_0x49bf46[_0x62b5('0x13')]);_0x17a75a(_0x49bf46[_0x62b5('0x13')]);});});};}function createRemoteTag(_0x8a9111,_0x174ee2,_0x329494,_0x903f69){return new Promise(function(_0x27b2b7,_0x1e8233){var _0x33334f={'method':'POST','uri':_0x329494+_0x62b5('0x3f')+'?'+_0x903f69,'body':{'short_description':_0x8a9111,'global':!![],'active':!![],'name':_0x8a9111},'auth':_0x174ee2,'json':!![]};return rp(_0x33334f)[_0x62b5('0x22')](function(_0x5bc164){var _0x3578cc=_0x5bc164[_0x62b5('0xa')][_0x62b5('0xd')];_0x27b2b7(_0x3578cc);});});}function getRemoteTag(_0x4a75df,_0x588ace,_0x57b5ee,_0x3e548b,_0x33534c){return new Promise(function(_0x5ecb75,_0x57301b){var _0x3e3457={'method':_0x62b5('0x26'),'uri':_0x57b5ee+_0x62b5('0x3f')+_0x62b5('0x40')+_0x4a75df+'&'+_0x3e548b,'auth':_0x588ace,'json':!![]};return rp(_0x3e3457)[_0x62b5('0x22')](function(_0x23ee2e){if(_0x23ee2e[_0x62b5('0xa')][_0x62b5('0xb')]>0x0){var _0x5090a5=_0x23ee2e[_0x62b5('0xa')][0x0]['sys_id'];_0x5ecb75(_0x5090a5);}else{return createRemoteTag(_0x4a75df,_0x588ace,_0x57b5ee,_0x3e548b)[_0x62b5('0x22')](function(_0x13769a){_0x5ecb75(_0x13769a);});}});});}function assignTagToIncident(_0x52fdb4,_0x2e5025,_0x59f4e6,_0x33de98,_0x34bd76){return new Promise(function(_0xa3b1e6,_0x40a100){var _0x565acf={'method':_0x62b5('0x1c'),'uri':_0x59f4e6+_0x62b5('0x41')+'?'+_0x34bd76,'body':{'label':_0x52fdb4,'table':'incident','id_type':_0x62b5('0x42'),'table_key':_0x33de98[_0x62b5('0x3d')],'title':_0x62b5('0x43')+_0x33de98[_0x62b5('0x44')],'id_display':_0x33de98[_0x62b5('0x44')]},'auth':_0x2e5025,'json':!![]};return rp(_0x565acf)[_0x62b5('0x22')](function(_0x4c95f1){_0xa3b1e6();})[_0x62b5('0x11')](function(){_0xa3b1e6();});});}function manageTags(_0x87c828,_0x413b58,_0x4961d0,_0x3b5591,_0x5c10d8,_0x543ead,_0x3cf37b){return new Promise(function(_0x1e8dca,_0xe6bf94){var _0x1036c9=[];_0x413b58['forEach'](function(_0x2bf7df){_0x1036c9[_0x62b5('0x45')](getRemoteTag(_0x2bf7df,_0x4961d0,_0x3b5591,_0x543ead,_0x3cf37b));});return Promise[_0x62b5('0x46')](_0x1036c9)[_0x62b5('0x22')](function(_0x1d5373){if(_0x1d5373[_0x62b5('0xb')]){logger[_0x62b5('0xe')]('['+[_0x87c828['toUpperCase']()]+_0x62b5('0x47'),_0x1d5373);var _0x5df0f8=[];_0x1d5373['forEach'](function(_0x47ebfa){_0x5df0f8[_0x62b5('0x45')](assignTagToIncident(_0x47ebfa,_0x4961d0,_0x3b5591,_0x5c10d8,_0x543ead));});return Promise['all'](_0x5df0f8)[_0x62b5('0x22')](function(){_0x1e8dca();})[_0x62b5('0x11')](function(){_0x1e8dca();});}else{_0x1e8dca();}});});}function getTags(_0x554509,_0x5048d7,_0x12c864,_0x4482b8,_0x59ee3f,_0xd2dd85){return function(_0x218ed1){return new Promise(function(_0x4cea14,_0x33fa38){var _0x21337c=[];var _0x4c4ee3=_0x4482b8[_0x62b5('0x48')];if(_0x4c4ee3&&_0x4c4ee3[_0x62b5('0xb')]>0x0){_0x21337c=_['map'](_0x4c4ee3,_0x62b5('0x36'));}if(_0x21337c['length']>0x0){return manageTags(_0x554509,_0x21337c,_0x5048d7,_0x12c864,_0x218ed1,_0x59ee3f,_0xd2dd85)['then'](function(){_0x4cea14(_0x218ed1);});}else{_0x4cea14(_0x218ed1);}});};}function emit(_0x148493,_0x32c8e0,_0x48b2fc){var _0x2116bd=_0x62b5('0x49')+_0x62b5('0x4a')+_0x62b5('0x4b')+_0x62b5('0x4c');var _0xdf52ed={'uri':_0x148493+_0x62b5('0x4d')+_0x48b2fc+_0x2116bd};io['to'](util['format']('user:%s',_0x32c8e0))['emit'](_0x62b5('0x4e'),_0xdf52ed);}exports['cs']=function(_0x2f542c,_0x339d8c,_0x33c171,_0x49e176,_0x320711,_0x1ab29a,_0x453c7e,_0x34bd6b){var _0x34e327={};var _0x2f7439={'user':_0x1ab29a[_0x62b5('0x4f')],'pass':_0x1ab29a[_0x62b5('0x50')]};var _0x3d6ff6=_0x62b5('0x51');var _0x1ddd2a=_0x62b5('0x52');_0x1ab29a[_0x62b5('0x53')]=intUtil[_0x62b5('0x54')](_0x1ab29a[_0x62b5('0x53')]);_0x1ab29a[_0x62b5('0x55')]=intUtil[_0x62b5('0x54')](_0x1ab29a[_0x62b5('0x55')]);var _0x229fe8=util[_0x62b5('0x56')]('%s/api/now/table/',_0x1ab29a[_0x62b5('0x53')]);_0x34e327[_0x62b5('0x16')]=!_[_0x62b5('0x57')](_0x49e176)?_0x49e176[_0x62b5('0x58')]:null;_0x34e327[_0x62b5('0x1a')]=_0x1ab29a[_0x62b5('0x58')];_0x34e327[_0x62b5('0x1e')]=_0x34bd6b['toLowerCase']()==='outbound'?_0x339d8c[_0x62b5('0x59')]:_0x339d8c[_0x62b5('0x5a')];_0x34e327[_0x62b5('0x5b')]=_0x34bd6b===_0x62b5('0x5c')||_0x34bd6b===_0x62b5('0x5d')?_0x62b5('0x5c'):_0x62b5('0x5e');var _0x5072cd=util['format'](_0x62b5('0x5f'),_0x1ab29a[_0x62b5('0x55')],_0x339d8c[_0x62b5('0x60')],md5(_0x339d8c[_0x62b5('0x60')]));if(_0x320711&&_0x320711['monitor_format']){logger[_0x62b5('0xe')](_0x62b5('0x61'),_0x62b5('0x62'));_0x339d8c['recordingURL']=_0x5072cd;}else if(_0x453c7e&&_0x453c7e[_0x62b5('0x63')]&&_0x453c7e[_0x62b5('0x63')]!==_0x62b5('0x64')){logger[_0x62b5('0xe')](_0x62b5('0x65'),_0x62b5('0x62'));_0x339d8c[_0x62b5('0x66')]=_0x5072cd;}else{_0x339d8c['recordingURL']='';}return getAdminUser(_0x34bd6b,_0x2f7439,_0x34e327,_0x229fe8,_0x1ddd2a,_0x3d6ff6)[_0x62b5('0x22')](getUser(_0x34bd6b,_0x2f7439,_0x229fe8,_0x1ddd2a,_0x3d6ff6))[_0x62b5('0x22')](getEndUser(_0x34bd6b,_0x2f7439,_0x229fe8,_0x1ddd2a,_0x3d6ff6))[_0x62b5('0x22')](getTicket(_0x34bd6b,_0x2f7439,_0x229fe8,_0x33c171,_0x339d8c,_0x1ddd2a))['then'](function(_0x3ed57e){logger[_0x62b5('0xe')](util[_0x62b5('0x56')](_0x62b5('0x67'),_0x3ed57e[_0x62b5('0x3d')]));logger[_0x62b5('0xe')](util[_0x62b5('0x56')](_0x62b5('0x68'),_0x34bd6b));if(_0x34bd6b!=='unmanaged'){logger['info']('['+[_0x34bd6b[_0x62b5('0xf')]()]+']',_0x62b5('0x69'));emit(_0x1ab29a[_0x62b5('0x53')],_0x49e176[_0x62b5('0x36')],_0x3ed57e[_0x62b5('0x3d')]);}})[_0x62b5('0x11')](function(_0x284b04){logger[_0x62b5('0x12')]('['+[_0x34bd6b[_0x62b5('0xf')]()]+_0x62b5('0x6a'),util[_0x62b5('0x6b')](_0x284b04,{'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 a45a1af..99f45d3 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 _0x405c=['sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','direction','length','variableName','push','set_entry','JSON','stringify','Calls','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','user_name','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','format','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','first_name','debug','[HTTP]','map','forEach','type','string','customField','nameField','idField','custom_fields','content','variable','Variable','toLowerCase','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]','Recording\x20is\x20enabled!','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger'];(function(_0x4da7a7,_0x2bb063){var _0x16799b=function(_0x55a4d5){while(--_0x55a4d5){_0x4da7a7['push'](_0x4da7a7['shift']());}};_0x16799b(++_0x2bb063);}(_0x405c,0x70));var _0xc405=function(_0x1c7478,_0x371ca5){_0x1c7478=_0x1c7478-0x0;var _0x599ba7=_0x405c[_0x1c7478];return _0x599ba7;};'use strict';var _=require('lodash');var rp=require(_0xc405('0x0'));var BPromise=require(_0xc405('0x1'));var md5=require(_0xc405('0x2'));var util=require(_0xc405('0x3'));var Redis=require(_0xc405('0x4'));var intUtil=require(_0xc405('0x5'));var config=require(_0xc405('0x6'));var logger=require(_0xc405('0x7'))(_0xc405('0x8'));config[_0xc405('0x9')]=_[_0xc405('0xa')](config['redis'],{'host':_0xc405('0xb'),'port':0x18eb});var io=require(_0xc405('0xc'))(new Redis(config['redis']));var def={'method':_0xc405('0xd'),'json':!![]};function emit(_0x1f6225,_0x37aa71,_0xdca799){io['to'](_0x1f6225)[_0xc405('0xe')](_0x37aa71,_0xdca799);}function getTicket(_0x3a1e77,_0x17c2d4,_0x46c976,_0x2f8bd5,_0x5aad41,_0x438a63,_0x5888f7,_0x207849){logger[_0xc405('0xf')](_0xc405('0x10'));var _0x167f19=new Date();var _0x5670e1=[{'name':_0xc405('0x11'),'value':intUtil[_0xc405('0x12')](_0x2f8bd5[_0xc405('0x13')],_0x5aad41,'\x20')},{'name':_0xc405('0x14'),'value':_0x17c2d4['id']},{'name':_0xc405('0x15'),'value':_0x17c2d4['id']},{'name':'description','value':intUtil[_0xc405('0x12')](_0x2f8bd5[_0xc405('0x16')],_0x5aad41,'\x0a')},{'name':'date_start','value':_0x167f19[_0xc405('0x17')]()[_0xc405('0x18')](0x0,0x13)[_0xc405('0x19')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xc405('0x1a'),'value':'15'},{'name':_0xc405('0x1b'),'value':_0x46c976['id']},{'name':_0xc405('0x1c'),'value':_0xc405('0x1d')},{'name':'parent_name','value':_0x46c976[_0xc405('0x11')]},{'name':_0xc405('0x1e'),'value':_0x207849}];if(_0x438a63[_0xc405('0x1f')]){_['forEach'](_0x438a63,function(_0x21ffaa){if(_0x5aad41[_0x21ffaa[_0xc405('0x20')]]){_0x5670e1[_0xc405('0x21')]({'name':_0x21ffaa['idField'],'value':_0x5aad41[_0x21ffaa[_0xc405('0x20')]]});}});}return request({'form':{'method':_0xc405('0x22'),'input_type':_0xc405('0x23'),'response_type':_0xc405('0x23'),'rest_data':JSON[_0xc405('0x24')]({'session':_0x5888f7['id'],'module_name':_0xc405('0x25'),'name_value_list':_0x5670e1})}});}function getAuth(_0x2b7acb){return util['format']('Basic\x20%s',new Buffer(_0x2b7acb[_0xc405('0x26')]+':X')[_0xc405('0x27')](_0xc405('0x28')));}function getServerInfo(_0x31e53e){return request({'form':{'method':_0xc405('0x29'),'input_type':'JSON','response_type':_0xc405('0x23'),'rest_data':JSON['stringify']({'session':_0x31e53e['id']})}});}function getUser(_0xd5cade,_0x21c255,_0xc31d1d){if(!_['isNil'](_0x21c255)){logger[_0xc405('0xf')](_0xc405('0x2a'),_0x21c255);return request({'form':{'method':_0xc405('0x2b'),'input_type':_0xc405('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xc31d1d['id'],'module_name':'Employees','query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x21c255),'order_by':'','offset':'0','select_fields':['id','name',_0xc405('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x42108f){if(_0x42108f[_0xc405('0x2d')][_0xc405('0x1f')]){var _0xa508e=_['find'](_0x42108f[_0xc405('0x2d')],function(_0x539c0e){return _0x539c0e['name_value_list'][_0xc405('0x2c')][_0xc405('0x2e')]===_0x21c255;});if(_0xa508e){logger[_0xc405('0xf')](_0xc405('0x2f'));return BPromise[_0xc405('0x30')]({'id':_0xa508e[_0xc405('0x31')]['id'][_0xc405('0x2e')],'name':_0xa508e[_0xc405('0x31')][_0xc405('0x11')]['value']});}}logger[_0xc405('0xf')](_0xc405('0x32'));return BPromise[_0xc405('0x30')]({'id':_0xc31d1d['name_value_list']['user_id']['value'],'name':_0xc31d1d[_0xc405('0x31')][_0xc405('0x2c')][_0xc405('0x2e')]});});}else{logger[_0xc405('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc405('0x30')]({'id':_0xc31d1d[_0xc405('0x31')][_0xc405('0x33')][_0xc405('0x2e')],'name':_0xc31d1d[_0xc405('0x31')][_0xc405('0x2c')]['value']});}}function getEndUser(_0x424f28,_0xe32e7e,_0x38f201,_0x2b3ca8){logger[_0xc405('0xf')](_0xc405('0x34'),_0x38f201);return request({'form':{'method':_0xc405('0x2b'),'input_type':_0xc405('0x23'),'response_type':_0xc405('0x23'),'rest_data':JSON[_0xc405('0x24')]({'session':_0x2b3ca8['id'],'module_name':_0xc405('0x1d'),'query':util[_0xc405('0x35')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x38f201),'order_by':'','offset':'0','select_fields':['id',_0xc405('0x11'),_0xc405('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc405('0x37')](function(_0x406050){if(_0x406050[_0xc405('0x2d')][_0xc405('0x1f')]){var _0x4d686a=_[_0xc405('0x38')](_0x406050['entry_list'],function(_0x1da61e){return _0x1da61e['name_value_list'][_0xc405('0x36')][_0xc405('0x2e')]===_0x38f201;});if(_0x4d686a){logger['info'](_0xc405('0x39'));return BPromise[_0xc405('0x30')]({'id':_0x4d686a[_0xc405('0x31')]['id'][_0xc405('0x2e')],'name':_0x4d686a['name_value_list'][_0xc405('0x11')][_0xc405('0x2e')],'phone':_0x4d686a[_0xc405('0x31')]['phone_home'][_0xc405('0x2e')]});}}else{logger[_0xc405('0xf')](_0xc405('0x3a'));return request({'form':{'method':_0xc405('0x22'),'input_type':_0xc405('0x23'),'response_type':_0xc405('0x23'),'rest_data':JSON[_0xc405('0x24')]({'session':_0x2b3ca8['id'],'module_name':_0xc405('0x1d'),'name_value_list':[{'name':'first_name','value':_0xe32e7e!==_0xc405('0x3b')?_0xe32e7e:util[_0xc405('0x35')](_0xc405('0x3c'),_0x38f201)},{'name':_0xc405('0x36'),'value':_0x38f201}]})}})[_0xc405('0x37')](function(_0x413ae2){logger[_0xc405('0xf')]('Enduser\x20created.');return BPromise[_0xc405('0x30')]({'id':_0x413ae2['id'],'name':_0x413ae2[_0xc405('0x2d')][_0xc405('0x3d')][_0xc405('0x2e')],'phone':_0x413ae2[_0xc405('0x2d')][_0xc405('0x36')][_0xc405('0x2e')]});});}});}function request(_0x1f5823){logger[_0xc405('0x3e')](_0xc405('0x3f'),JSON[_0xc405('0x24')](_0x1f5823));return rp(_['merge'](def,_0x1f5823));}function getTags(_0x25fc40,_0x3bc9ad){var _0x3e5d48=[];if(_0x25fc40&&_0x25fc40[_0xc405('0x1f')]>0x0){_0x3e5d48=_[_0xc405('0x40')](_0x25fc40,_0x3bc9ad);}return _0x3e5d48;}function getCustomFields(_0x5497df,_0x1e32f6){var _0xedd0ff=[];var _0x29d8a0={'custom_fields':[]};if(_0x5497df['length']>0x0){_[_0xc405('0x41')](_0x5497df,function(_0xb817d0){if(_0xb817d0[_0xc405('0x42')]===_0xc405('0x43')&&_0xb817d0['nameField']&&!_0xb817d0[_0xc405('0x44')]){_0x29d8a0[_0xb817d0[_0xc405('0x45')]['toLowerCase']()]=_0xb817d0['content'][_0xc405('0x27')]();}else if(_0xb817d0['type']===_0xc405('0x43')&&_0xb817d0[_0xc405('0x46')]&&_0xb817d0[_0xc405('0x44')]){_0x29d8a0[_0xc405('0x47')]['push']({'id':_0xb817d0[_0xc405('0x46')],'value':_0xb817d0[_0xc405('0x48')][_0xc405('0x27')]()});}else if(_0xb817d0['type']===_0xc405('0x49')&&_0xb817d0[_0xc405('0x20')]&&_0xb817d0[_0xc405('0x46')]&&_0xb817d0[_0xc405('0x44')]){_0x1e32f6[_0xb817d0[_0xc405('0x20')]]&&_0x29d8a0[_0xc405('0x47')][_0xc405('0x21')]({'id':_0xb817d0[_0xc405('0x46')],'value':_0x1e32f6[_0xb817d0[_0xc405('0x20')]][_0xc405('0x27')]()});}else if(_0xb817d0[_0xc405('0x42')]==='customVariable'&&_0xb817d0[_0xc405('0x4a')]&&_0xb817d0[_0xc405('0x4a')][_0xc405('0x11')]&&_0xb817d0['idField']&&_0xb817d0['customField']){_0x1e32f6[_0xb817d0[_0xc405('0x4a')][_0xc405('0x11')][_0xc405('0x4b')]()]&&_0x29d8a0[_0xc405('0x47')][_0xc405('0x21')]({'id':_0xb817d0[_0xc405('0x46')],'value':_0x1e32f6[_0xb817d0[_0xc405('0x4a')][_0xc405('0x11')][_0xc405('0x4b')]()]['toString']()});}});}return _0x29d8a0;}function getConnection(_0x4d7a1f){return request({'method':_0xc405('0xd'),'form':{'method':_0xc405('0x4c'),'input_type':_0xc405('0x23'),'response_type':_0xc405('0x23'),'rest_data':JSON[_0xc405('0x24')]({'user_auth':{'user_name':_0x4d7a1f[_0xc405('0x4d')],'password':_0x4d7a1f[_0xc405('0x4e')],'encryption':_0xc405('0x4f')},'application':_0xc405('0x50')})}})[_0xc405('0x37')](function(_0x5f1205){var _0x169697=_0x5f1205;if(_0x169697['id']){def[_0xc405('0x51')]=_0x169697['id'];return BPromise[_0xc405('0x30')](_0x169697);}else{throw new Error(util[_0xc405('0x35')](_0xc405('0x52'),_0x4d7a1f['id']));}});}function setRelationship(_0x3afe22,_0x11c878,_0x107fb4,_0x55877e){return request({'form':{'method':_0xc405('0x53'),'input_type':'JSON','response_type':_0xc405('0x23'),'rest_data':JSON['stringify']({'session':_0x3afe22['id'],'module_name':_0xc405('0x25'),'module_id':_0x107fb4['id'],'link_field_name':_0x55877e,'related_ids':[_0x11c878['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0xe43db2,_0x48f664,_0x462111,_0x35311f,_0x2ac4c0,_0x4efb09){var _0x1ececf,_0x352b61,_0xba9c1d,_0x5084f7;_0x4efb09[_0xc405('0x54')]=intUtil[_0xc405('0x55')](_0x4efb09[_0xc405('0x54')]);_0x4efb09[_0xc405('0x56')]=intUtil[_0xc405('0x55')](_0x4efb09[_0xc405('0x56')]);def[_0xc405('0x57')]=util[_0xc405('0x35')](_0xc405('0x58'),_0x4efb09[_0xc405('0x54')]);if(_0x2ac4c0&&_0x2ac4c0[_0xc405('0x59')]){logger[_0xc405('0xf')](_0xc405('0x5a'),_0xc405('0x5b'));_0x48f664[_0xc405('0x5c')]=util[_0xc405('0x35')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4efb09[_0xc405('0x56')],_0x48f664['uniqueid'],md5(_0x48f664['uniqueid']));}else{_0x48f664[_0xc405('0x5c')]='';}return getConnection(_0x4efb09)[_0xc405('0x37')](function(_0x2cf5ba){_0x5084f7=_0x2cf5ba;return getUser(_0x4efb09,_0x35311f['name'],_0x5084f7);})[_0xc405('0x37')](function(_0x3ea271){_0x1ececf=_0x3ea271;logger['info']('The\x20User\x20ID\x20is:',_0x1ececf['id']);return getEndUser(_0x4efb09,_0x48f664[_0xc405('0x5d')],_0x48f664[_0xc405('0x5e')],_0x5084f7);})[_0xc405('0x37')](function(_0x351e1f){_0x352b61=_0x351e1f;logger[_0xc405('0xf')](_0xc405('0x5f'),_0x352b61['id']);return getTicket(_0x4efb09,_0x1ececf,_0x352b61,_0x462111,_0x48f664,_0x462111[_0xc405('0x60')],_0x5084f7,'Inbound');})[_0xc405('0x37')](function(_0x2a00ec){_0xba9c1d=_0x2a00ec;logger[_0xc405('0xf')](_0xc405('0x61'));logger[_0xc405('0xf')](_0xc405('0x62'),_0xba9c1d['id']);return setRelationship(_0x5084f7,_0x1ececf,_0xba9c1d,_0xc405('0x63'));})[_0xc405('0x37')](function(){return setRelationship(_0x5084f7,_0x352b61,_0xba9c1d,_0xc405('0x64'));})[_0xc405('0x37')](function(){return getServerInfo(_0x5084f7);})[_0xc405('0x37')](function(_0x22dd35){var _0x16bf09=parseInt(_0x22dd35['version'][_0xc405('0x65')](0x0));var _0x4810d8=util[_0xc405('0x35')](_0xc405('0x66'),_0x4efb09['remoteUri'],_0xba9c1d['id']);if(_0x16bf09>0x6){_0x4810d8=util[_0xc405('0x35')](_0xc405('0x67'),_0x4efb09[_0xc405('0x54')],_0xba9c1d['id']);}logger[_0xc405('0xf')](_0xc405('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x35311f['name']),_0xc405('0x68'),{'uri':_0x4810d8});})[_0xc405('0x69')](function(_0x1aa68a){logger[_0xc405('0x6a')](_0xc405('0x5a'),JSON[_0xc405('0x24')](_0x1aa68a));});};exports[_0xc405('0x6b')]=function(_0x2fb6e6,_0x4705be,_0x46721e,_0x1b366c,_0x42f031,_0x4a8034,_0x2a8a89){var _0x5bfbdc,_0xa74f43,_0x4a7fbd,_0x4c7d91;_0x4a8034[_0xc405('0x54')]=intUtil[_0xc405('0x55')](_0x4a8034['remoteUri']);_0x4a8034[_0xc405('0x56')]=intUtil[_0xc405('0x55')](_0x4a8034[_0xc405('0x56')]);def[_0xc405('0x57')]=util[_0xc405('0x35')](_0xc405('0x58'),_0x4a8034[_0xc405('0x54')]);if(_0x2a8a89&&_0x2a8a89['recordingFormat']&&_0x2a8a89[_0xc405('0x6c')]!==_0xc405('0x6d')){logger[_0xc405('0xf')]('[OUTBOUND]',_0xc405('0x5b'));_0x4705be[_0xc405('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a8034[_0xc405('0x56')],_0x4705be[_0xc405('0x6e')],md5(_0x4705be[_0xc405('0x6e')]));}return getConnection(_0x4a8034)[_0xc405('0x37')](function(_0x3c7819){_0x4c7d91=_0x3c7819;return getUser(_0x4a8034,_0x1b366c[_0xc405('0x11')],_0x4c7d91);})['then'](function(_0x54f52f){_0x5bfbdc=_0x54f52f;logger['info'](_0xc405('0x6f'),_0x5bfbdc['id']);return getEndUser(_0x4a8034,_0x4705be[_0xc405('0x70')],_0x4705be[_0xc405('0x71')],_0x4c7d91);})['then'](function(_0x3ede97){_0xa74f43=_0x3ede97;logger[_0xc405('0xf')]('The\x20Enduser\x20ID\x20is:',_0xa74f43['id']);return getTicket(_0x4a8034,_0x5bfbdc,_0xa74f43,_0x46721e,_0x4705be,_0x46721e[_0xc405('0x60')],_0x4c7d91,'Outbound');})[_0xc405('0x37')](function(_0x4effd2){_0x4a7fbd=_0x4effd2;logger['info'](_0xc405('0x61'));logger[_0xc405('0xf')](_0xc405('0x62'),_0x4a7fbd['id']);return setRelationship(_0x4c7d91,_0x5bfbdc,_0x4a7fbd,'users');})[_0xc405('0x37')](function(){return setRelationship(_0x4c7d91,_0xa74f43,_0x4a7fbd,_0xc405('0x64'));})[_0xc405('0x37')](function(){return getServerInfo(_0x4c7d91);})['then'](function(_0x463044){var _0x1bc586=parseInt(_0x463044['version'][_0xc405('0x65')](0x0));var _0x4cd36a=util['format'](_0xc405('0x66'),_0x4a8034[_0xc405('0x54')],_0x4a7fbd['id']);if(_0x1bc586>0x6){_0x4cd36a=util['format'](_0xc405('0x67'),_0x4a8034[_0xc405('0x54')],_0x4a7fbd['id']);}logger['info'](_0xc405('0x72'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc405('0x35')](_0xc405('0x73'),_0x1b366c['name']),_0xc405('0x68'),{'uri':_0x4cd36a});})['catch'](function(_0xf30764){logger[_0xc405('0x6a')](_0xc405('0x72'),JSON[_0xc405('0x24')](_0xf30764));});};exports[_0xc405('0x74')]=function(_0x12b9ad,_0x49641d,_0x285817,_0xb01d1e,_0x67353c,_0xda9679){var _0x7ae14c,_0x133ba0,_0x2249aa,_0x57574d;_0xda9679['remoteUri']=intUtil[_0xc405('0x55')](_0xda9679[_0xc405('0x54')]);_0xda9679[_0xc405('0x56')]=intUtil['stripTrailingSlash'](_0xda9679[_0xc405('0x56')]);def[_0xc405('0x57')]=util[_0xc405('0x35')](_0xc405('0x58'),_0xda9679[_0xc405('0x54')]);if(_0x67353c&&_0x67353c[_0xc405('0x59')]){logger[_0xc405('0xf')]('['+_0x49641d[_0xc405('0x75')][_0xc405('0x76')]()+']',_0xc405('0x5b'));_0x49641d[_0xc405('0x5c')]=util[_0xc405('0x35')](_0xc405('0x77'),_0xda9679[_0xc405('0x56')],_0x49641d[_0xc405('0x6e')],md5(_0x49641d[_0xc405('0x6e')]));}else{_0x49641d[_0xc405('0x5c')]='';}return getConnection(_0xda9679)[_0xc405('0x37')](function(_0x24e3e0){_0x57574d=_0x24e3e0;if(!_['isNil'](_0xb01d1e)){return getUser(_0xda9679,_0xb01d1e[_0xc405('0x11')],_0x57574d);}else{return getUser(_0xda9679,null,_0x57574d);}})[_0xc405('0x37')](function(_0x19bdcc){_0x7ae14c=_0x19bdcc;logger['info'](_0xc405('0x6f'),_0x7ae14c['id']);return getEndUser(_0xda9679,_0x49641d[_0xc405('0x5d')],_0x49641d[_0xc405('0x5e')],_0x57574d);})[_0xc405('0x37')](function(_0x1eda27){_0x133ba0=_0x1eda27;logger[_0xc405('0xf')](_0xc405('0x5f'),_0x133ba0['id']);return getTicket(_0xda9679,_0x7ae14c,_0x133ba0,_0x285817,_0x49641d,_0x285817[_0xc405('0x60')],_0x57574d,'Inbound');})['then'](function(_0x27884a){_0x2249aa=_0x27884a;logger['info'](_0xc405('0x61'));logger[_0xc405('0xf')](_0xc405('0x62'),_0x2249aa['id']);return setRelationship(_0x57574d,_0x7ae14c,_0x2249aa,_0xc405('0x63'));})[_0xc405('0x37')](function(){return setRelationship(_0x57574d,_0x133ba0,_0x2249aa,'contacts');})[_0xc405('0x37')](function(){return getServerInfo(_0x57574d);})[_0xc405('0x69')](function(_0x1cec94){logger[_0xc405('0x6a')]('['+_0x49641d[_0xc405('0x75')][_0xc405('0x76')]()+']',JSON[_0xc405('0x24')](_0x1cec94));});}; \ No newline at end of file +var _0x458f=['parent_id','parent_type','Contacts','parent_name','name','forEach','variableName','push','set_entry','stringify','Calls','apiKey','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','length','find','name_value_list','Agent\x20found!','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','then','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','map','type','nameField','customField','toLowerCase','content','toString','string','idField','custom_fields','customVariable','Variable','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','uri','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','Outbound','Ticket\x20created!','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','monitor_format','lastevent','contacts','lodash','request-promise','bluebird','md5','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','info','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours'];(function(_0x375b4f,_0x73421e){var _0x1ac303=function(_0x5ce2c7){while(--_0x5ce2c7){_0x375b4f['push'](_0x375b4f['shift']());}};_0x1ac303(++_0x73421e);}(_0x458f,0x14e));var _0xf458=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x458f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf458('0x0'));var rp=require(_0xf458('0x1'));var BPromise=require(_0xf458('0x2'));var md5=require(_0xf458('0x3'));var util=require('util');var Redis=require(_0xf458('0x4'));var intUtil=require('./util');var config=require(_0xf458('0x5'));var logger=require(_0xf458('0x6'))(_0xf458('0x7'));config['redis']=_[_0xf458('0x8')](config[_0xf458('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf458('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x305b52,_0x2092fa,_0x42ba33){io['to'](_0x305b52)['emit'](_0x2092fa,_0x42ba33);}function getTicket(_0xe2246c,_0x320474,_0x275371,_0x2ddece,_0x572751,_0x11bc25,_0x4b900c,_0x1a6882){logger[_0xf458('0xa')](_0xf458('0xb'));var _0x4fba37=new Date();var _0x12b3b8=[{'name':'name','value':intUtil['getString'](_0x2ddece[_0xf458('0xc')],_0x572751,'\x20')},{'name':_0xf458('0xd'),'value':_0x320474['id']},{'name':_0xf458('0xe'),'value':_0x320474['id']},{'name':_0xf458('0xf'),'value':intUtil[_0xf458('0x10')](_0x2ddece[_0xf458('0x11')],_0x572751,'\x0a')},{'name':_0xf458('0x12'),'value':_0x4fba37[_0xf458('0x13')]()[_0xf458('0x14')](0x0,0x13)[_0xf458('0x15')]('T','\x20')},{'name':_0xf458('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xf458('0x17'),'value':_0x275371['id']},{'name':_0xf458('0x18'),'value':_0xf458('0x19')},{'name':_0xf458('0x1a'),'value':_0x275371[_0xf458('0x1b')]},{'name':'direction','value':_0x1a6882}];if(_0x11bc25['length']){_[_0xf458('0x1c')](_0x11bc25,function(_0x2b9b6f){if(_0x572751[_0x2b9b6f[_0xf458('0x1d')]]){_0x12b3b8[_0xf458('0x1e')]({'name':_0x2b9b6f['idField'],'value':_0x572751[_0x2b9b6f[_0xf458('0x1d')]]});}});}return request({'form':{'method':_0xf458('0x1f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf458('0x20')]({'session':_0x4b900c['id'],'module_name':_0xf458('0x21'),'name_value_list':_0x12b3b8})}});}function getAuth(_0x304d2b){return util['format']('Basic\x20%s',new Buffer(_0x304d2b[_0xf458('0x22')]+':X')['toString'](_0xf458('0x23')));}function getServerInfo(_0xcce493){return request({'form':{'method':_0xf458('0x24'),'input_type':_0xf458('0x25'),'response_type':_0xf458('0x25'),'rest_data':JSON[_0xf458('0x20')]({'session':_0xcce493['id']})}});}function getUser(_0x30bcda,_0x4ae392,_0x24c278){if(!_[_0xf458('0x26')](_0x4ae392)){logger['info'](_0xf458('0x27'),_0x4ae392);return request({'form':{'method':'get_entry_list','input_type':_0xf458('0x25'),'response_type':_0xf458('0x25'),'rest_data':JSON[_0xf458('0x20')]({'session':_0x24c278['id'],'module_name':_0xf458('0x28'),'query':util[_0xf458('0x29')](_0xf458('0x2a'),_0x4ae392),'order_by':'','offset':'0','select_fields':['id',_0xf458('0x1b'),_0xf458('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x267038){if(_0x267038[_0xf458('0x2c')][_0xf458('0x2d')]){var _0x39271f=_[_0xf458('0x2e')](_0x267038['entry_list'],function(_0x4be3ea){return _0x4be3ea[_0xf458('0x2f')][_0xf458('0x2b')]['value']===_0x4ae392;});if(_0x39271f){logger[_0xf458('0xa')](_0xf458('0x30'));return BPromise['resolve']({'id':_0x39271f[_0xf458('0x2f')]['id'][_0xf458('0x31')],'name':_0x39271f['name_value_list'][_0xf458('0x1b')][_0xf458('0x31')]});}}logger[_0xf458('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf458('0x32')]({'id':_0x24c278[_0xf458('0x2f')][_0xf458('0x33')]['value'],'name':_0x24c278['name_value_list'][_0xf458('0x2b')]['value']});});}else{logger['info'](_0xf458('0x34'));return BPromise['resolve']({'id':_0x24c278[_0xf458('0x2f')][_0xf458('0x33')]['value'],'name':_0x24c278[_0xf458('0x2f')][_0xf458('0x2b')][_0xf458('0x31')]});}}function getEndUser(_0x19d665,_0x212a90,_0x22290e,_0x4eef8e){logger[_0xf458('0xa')](_0xf458('0x35'),_0x22290e);return request({'form':{'method':_0xf458('0x36'),'input_type':'JSON','response_type':_0xf458('0x25'),'rest_data':JSON['stringify']({'session':_0x4eef8e['id'],'module_name':_0xf458('0x19'),'query':util['format'](_0xf458('0x37'),_0x22290e),'order_by':'','offset':'0','select_fields':['id',_0xf458('0x1b'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf458('0x38')](function(_0x620fb5){if(_0x620fb5[_0xf458('0x2c')]['length']){var _0x1bfee9=_['find'](_0x620fb5[_0xf458('0x2c')],function(_0x278386){return _0x278386[_0xf458('0x2f')][_0xf458('0x39')][_0xf458('0x31')]===_0x22290e;});if(_0x1bfee9){logger[_0xf458('0xa')](_0xf458('0x3a'));return BPromise['resolve']({'id':_0x1bfee9['name_value_list']['id'][_0xf458('0x31')],'name':_0x1bfee9[_0xf458('0x2f')][_0xf458('0x1b')][_0xf458('0x31')],'phone':_0x1bfee9['name_value_list'][_0xf458('0x39')][_0xf458('0x31')]});}}else{logger[_0xf458('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0xf458('0x25'),'response_type':_0xf458('0x25'),'rest_data':JSON['stringify']({'session':_0x4eef8e['id'],'module_name':_0xf458('0x19'),'name_value_list':[{'name':_0xf458('0x3b'),'value':_0x212a90!==_0xf458('0x3c')?_0x212a90:util[_0xf458('0x29')](_0xf458('0x3d'),_0x22290e)},{'name':_0xf458('0x39'),'value':_0x22290e}]})}})['then'](function(_0x1e0059){logger['info'](_0xf458('0x3e'));return BPromise[_0xf458('0x32')]({'id':_0x1e0059['id'],'name':_0x1e0059[_0xf458('0x2c')][_0xf458('0x3b')][_0xf458('0x31')],'phone':_0x1e0059[_0xf458('0x2c')][_0xf458('0x39')][_0xf458('0x31')]});});}});}function request(_0x248815){logger['debug']('[HTTP]',JSON[_0xf458('0x20')](_0x248815));return rp(_['merge'](def,_0x248815));}function getTags(_0xfb31cf,_0x5e043f){var _0x2a8d67=[];if(_0xfb31cf&&_0xfb31cf[_0xf458('0x2d')]>0x0){_0x2a8d67=_[_0xf458('0x3f')](_0xfb31cf,_0x5e043f);}return _0x2a8d67;}function getCustomFields(_0xb16014,_0x1cc5ff){var _0x1c8a88=[];var _0x560a60={'custom_fields':[]};if(_0xb16014[_0xf458('0x2d')]>0x0){_[_0xf458('0x1c')](_0xb16014,function(_0x358931){if(_0x358931[_0xf458('0x40')]==='string'&&_0x358931[_0xf458('0x41')]&&!_0x358931[_0xf458('0x42')]){_0x560a60[_0x358931[_0xf458('0x41')][_0xf458('0x43')]()]=_0x358931[_0xf458('0x44')][_0xf458('0x45')]();}else if(_0x358931[_0xf458('0x40')]===_0xf458('0x46')&&_0x358931[_0xf458('0x47')]&&_0x358931[_0xf458('0x42')]){_0x560a60[_0xf458('0x48')][_0xf458('0x1e')]({'id':_0x358931[_0xf458('0x47')],'value':_0x358931[_0xf458('0x44')]['toString']()});}else if(_0x358931[_0xf458('0x40')]==='variable'&&_0x358931[_0xf458('0x1d')]&&_0x358931[_0xf458('0x47')]&&_0x358931[_0xf458('0x42')]){_0x1cc5ff[_0x358931[_0xf458('0x1d')]]&&_0x560a60[_0xf458('0x48')]['push']({'id':_0x358931['idField'],'value':_0x1cc5ff[_0x358931[_0xf458('0x1d')]][_0xf458('0x45')]()});}else if(_0x358931['type']===_0xf458('0x49')&&_0x358931[_0xf458('0x4a')]&&_0x358931[_0xf458('0x4a')][_0xf458('0x1b')]&&_0x358931[_0xf458('0x47')]&&_0x358931[_0xf458('0x42')]){_0x1cc5ff[_0x358931[_0xf458('0x4a')][_0xf458('0x1b')][_0xf458('0x43')]()]&&_0x560a60['custom_fields'][_0xf458('0x1e')]({'id':_0x358931[_0xf458('0x47')],'value':_0x1cc5ff[_0x358931[_0xf458('0x4a')][_0xf458('0x1b')][_0xf458('0x43')]()][_0xf458('0x45')]()});}});}return _0x560a60;}function getConnection(_0x1d2304){return request({'method':'POST','form':{'method':'login','input_type':_0xf458('0x25'),'response_type':_0xf458('0x25'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1d2304[_0xf458('0x4b')],'password':_0x1d2304['password'],'encryption':_0xf458('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xf458('0x38')](function(_0xb58b32){var _0x2c0c87=_0xb58b32;if(_0x2c0c87['id']){def[_0xf458('0x4d')]=_0x2c0c87['id'];return BPromise[_0xf458('0x32')](_0x2c0c87);}else{throw new Error(util[_0xf458('0x29')](_0xf458('0x4e'),_0x1d2304['id']));}});}function setRelationship(_0x29ecf9,_0x571647,_0x59040e,_0x56cec4){return request({'form':{'method':_0xf458('0x4f'),'input_type':_0xf458('0x25'),'response_type':_0xf458('0x25'),'rest_data':JSON['stringify']({'session':_0x29ecf9['id'],'module_name':_0xf458('0x21'),'module_id':_0x59040e['id'],'link_field_name':_0x56cec4,'related_ids':[_0x571647['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf458('0x50')]=function(_0x305cd9,_0x2f32f9,_0x142edd,_0x51f3bf,_0x11fd49,_0x39ff80){var _0x7cf80d,_0xd5e8b2,_0x583341,_0x292dac;_0x39ff80[_0xf458('0x51')]=intUtil['stripTrailingSlash'](_0x39ff80[_0xf458('0x51')]);_0x39ff80[_0xf458('0x52')]=intUtil['stripTrailingSlash'](_0x39ff80[_0xf458('0x52')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x39ff80[_0xf458('0x51')]);if(_0x11fd49&&_0x11fd49['monitor_format']){logger[_0xf458('0xa')](_0xf458('0x53'),_0xf458('0x54'));_0x2f32f9[_0xf458('0x55')]=util[_0xf458('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39ff80[_0xf458('0x52')],_0x2f32f9[_0xf458('0x56')],md5(_0x2f32f9[_0xf458('0x56')]));}else{_0x2f32f9[_0xf458('0x55')]='';}return getConnection(_0x39ff80)[_0xf458('0x38')](function(_0x162bb8){_0x292dac=_0x162bb8;return getUser(_0x39ff80,_0x51f3bf[_0xf458('0x1b')],_0x292dac);})['then'](function(_0x5562d9){_0x7cf80d=_0x5562d9;logger['info'](_0xf458('0x57'),_0x7cf80d['id']);return getEndUser(_0x39ff80,_0x2f32f9[_0xf458('0x58')],_0x2f32f9[_0xf458('0x59')],_0x292dac);})['then'](function(_0x11c6bf){_0xd5e8b2=_0x11c6bf;logger[_0xf458('0xa')](_0xf458('0x5a'),_0xd5e8b2['id']);return getTicket(_0x39ff80,_0x7cf80d,_0xd5e8b2,_0x142edd,_0x2f32f9,_0x142edd[_0xf458('0x5b')],_0x292dac,_0xf458('0x5c'));})[_0xf458('0x38')](function(_0x27728b){_0x583341=_0x27728b;logger[_0xf458('0xa')]('Ticket\x20created!');logger['info'](_0xf458('0x5d'),_0x583341['id']);return setRelationship(_0x292dac,_0x7cf80d,_0x583341,_0xf458('0x5e'));})[_0xf458('0x38')](function(){return setRelationship(_0x292dac,_0xd5e8b2,_0x583341,'contacts');})['then'](function(){return getServerInfo(_0x292dac);})[_0xf458('0x38')](function(_0x55b22a){var _0x3ba4eb=parseInt(_0x55b22a[_0xf458('0x5f')][_0xf458('0x60')](0x0));var _0x1432b3=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x39ff80['remoteUri'],_0x583341['id']);if(_0x3ba4eb>0x6){_0x1432b3=util[_0xf458('0x29')](_0xf458('0x61'),_0x39ff80[_0xf458('0x51')],_0x583341['id']);}logger['info']('[QUEUE]',_0xf458('0x62'));emit(util['format'](_0xf458('0x63'),_0x51f3bf[_0xf458('0x1b')]),_0xf458('0x64'),{'uri':_0x1432b3});})[_0xf458('0x65')](function(_0x1c4c6f){logger[_0xf458('0x66')](_0xf458('0x53'),JSON[_0xf458('0x20')](_0x1c4c6f));});};exports[_0xf458('0x67')]=function(_0x302ea4,_0x5a6de1,_0x5d9540,_0x288f3f,_0x397ee6,_0x121d8f,_0x55175c){var _0xbd5866,_0x2aa08e,_0x46ad0e,_0xe5fbab;_0x121d8f['remoteUri']=intUtil['stripTrailingSlash'](_0x121d8f[_0xf458('0x51')]);_0x121d8f['serverUrl']=intUtil[_0xf458('0x68')](_0x121d8f[_0xf458('0x52')]);def[_0xf458('0x69')]=util[_0xf458('0x29')](_0xf458('0x6a'),_0x121d8f[_0xf458('0x51')]);if(_0x55175c&&_0x55175c[_0xf458('0x6b')]&&_0x55175c[_0xf458('0x6b')]!==_0xf458('0x6c')){logger[_0xf458('0xa')](_0xf458('0x6d'),_0xf458('0x54'));_0x5a6de1[_0xf458('0x55')]=util[_0xf458('0x29')](_0xf458('0x6e'),_0x121d8f['serverUrl'],_0x5a6de1[_0xf458('0x56')],md5(_0x5a6de1[_0xf458('0x56')]));}return getConnection(_0x121d8f)['then'](function(_0x40c42d){_0xe5fbab=_0x40c42d;return getUser(_0x121d8f,_0x288f3f['name'],_0xe5fbab);})[_0xf458('0x38')](function(_0x36b0c7){_0xbd5866=_0x36b0c7;logger[_0xf458('0xa')](_0xf458('0x57'),_0xbd5866['id']);return getEndUser(_0x121d8f,_0x5a6de1[_0xf458('0x6f')],_0x5a6de1['destcalleridnum'],_0xe5fbab);})[_0xf458('0x38')](function(_0x2c9076){_0x2aa08e=_0x2c9076;logger[_0xf458('0xa')](_0xf458('0x5a'),_0x2aa08e['id']);return getTicket(_0x121d8f,_0xbd5866,_0x2aa08e,_0x5d9540,_0x5a6de1,_0x5d9540[_0xf458('0x5b')],_0xe5fbab,_0xf458('0x70'));})[_0xf458('0x38')](function(_0x642c5a){_0x46ad0e=_0x642c5a;logger[_0xf458('0xa')](_0xf458('0x71'));logger[_0xf458('0xa')](_0xf458('0x5d'),_0x46ad0e['id']);return setRelationship(_0xe5fbab,_0xbd5866,_0x46ad0e,_0xf458('0x5e'));})[_0xf458('0x38')](function(){return setRelationship(_0xe5fbab,_0x2aa08e,_0x46ad0e,'contacts');})[_0xf458('0x38')](function(){return getServerInfo(_0xe5fbab);})[_0xf458('0x38')](function(_0x4155b3){var _0x3a7357=parseInt(_0x4155b3[_0xf458('0x5f')][_0xf458('0x60')](0x0));var _0x529365=util[_0xf458('0x29')](_0xf458('0x72'),_0x121d8f[_0xf458('0x51')],_0x46ad0e['id']);if(_0x3a7357>0x6){_0x529365=util[_0xf458('0x29')](_0xf458('0x61'),_0x121d8f[_0xf458('0x51')],_0x46ad0e['id']);}logger[_0xf458('0xa')]('[OUTBOUND]',_0xf458('0x62'));emit(util[_0xf458('0x29')](_0xf458('0x63'),_0x288f3f[_0xf458('0x1b')]),_0xf458('0x64'),{'uri':_0x529365});})[_0xf458('0x65')](function(_0x4536b2){logger[_0xf458('0x66')](_0xf458('0x6d'),JSON[_0xf458('0x20')](_0x4536b2));});};exports[_0xf458('0x73')]=function(_0x9d1911,_0x116930,_0x395b81,_0x5ed47b,_0x31eb1c,_0x40cfa4){var _0x586b80,_0x3c5cec,_0x1ddeaf,_0x4957cf;_0x40cfa4[_0xf458('0x51')]=intUtil[_0xf458('0x68')](_0x40cfa4[_0xf458('0x51')]);_0x40cfa4[_0xf458('0x52')]=intUtil[_0xf458('0x68')](_0x40cfa4[_0xf458('0x52')]);def[_0xf458('0x69')]=util[_0xf458('0x29')](_0xf458('0x6a'),_0x40cfa4[_0xf458('0x51')]);if(_0x31eb1c&&_0x31eb1c[_0xf458('0x74')]){logger['info']('['+_0x116930[_0xf458('0x75')]['toUpperCase']()+']',_0xf458('0x54'));_0x116930[_0xf458('0x55')]=util[_0xf458('0x29')](_0xf458('0x6e'),_0x40cfa4[_0xf458('0x52')],_0x116930[_0xf458('0x56')],md5(_0x116930[_0xf458('0x56')]));}else{_0x116930['recordingURL']='';}return getConnection(_0x40cfa4)[_0xf458('0x38')](function(_0x4705b4){_0x4957cf=_0x4705b4;if(!_[_0xf458('0x26')](_0x5ed47b)){return getUser(_0x40cfa4,_0x5ed47b[_0xf458('0x1b')],_0x4957cf);}else{return getUser(_0x40cfa4,null,_0x4957cf);}})[_0xf458('0x38')](function(_0x269b7e){_0x586b80=_0x269b7e;logger['info'](_0xf458('0x57'),_0x586b80['id']);return getEndUser(_0x40cfa4,_0x116930['calleridname'],_0x116930[_0xf458('0x59')],_0x4957cf);})[_0xf458('0x38')](function(_0x5ef792){_0x3c5cec=_0x5ef792;logger[_0xf458('0xa')]('The\x20Enduser\x20ID\x20is:',_0x3c5cec['id']);return getTicket(_0x40cfa4,_0x586b80,_0x3c5cec,_0x395b81,_0x116930,_0x395b81[_0xf458('0x5b')],_0x4957cf,_0xf458('0x5c'));})[_0xf458('0x38')](function(_0xa364ad){_0x1ddeaf=_0xa364ad;logger[_0xf458('0xa')](_0xf458('0x71'));logger[_0xf458('0xa')](_0xf458('0x5d'),_0x1ddeaf['id']);return setRelationship(_0x4957cf,_0x586b80,_0x1ddeaf,_0xf458('0x5e'));})[_0xf458('0x38')](function(){return setRelationship(_0x4957cf,_0x3c5cec,_0x1ddeaf,_0xf458('0x76'));})[_0xf458('0x38')](function(){return getServerInfo(_0x4957cf);})[_0xf458('0x65')](function(_0x1b824e){logger[_0xf458('0x66')]('['+_0x116930[_0xf458('0x75')]['toUpperCase']()+']',JSON[_0xf458('0x20')](_0x1b824e));});}; \ 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 8ff58a3..d8630ed 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 _0xf461=['toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','keyContent','keyType','%s:\x20%s','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','content','type','variable','variableName','push'];(function(_0x34fabf,_0xc40e2f){var _0x40b3ad=function(_0x2700fd){while(--_0x2700fd){_0x34fabf['push'](_0x34fabf['shift']());}};_0x40b3ad(++_0xc40e2f);}(_0xf461,0x18a));var _0x1f46=function(_0x3973d5,_0x12ed21){_0x3973d5=_0x3973d5-0x0;var _0x3dcd50=_0xf461[_0x3973d5];return _0x3dcd50;};'use strict';var _=require(_0x1f46('0x0'));var util=require(_0x1f46('0x1'));exports[_0x1f46('0x2')]=function(_0x44600a,_0x4a0374,_0x539b5a){var _0x1fd155=[];if(_0x44600a[_0x1f46('0x3')]>0x0){var _0x521973=_[_0x1f46('0x4')](_0x44600a,['id']);for(var _0x374b29=0x0;_0x374b29<_0x521973['length'];_0x374b29++){var _0x169635=_0x521973[_0x374b29];if(_0x169635['type']===_0x1f46('0x5')){_0x1fd155['push'](_0x169635[_0x1f46('0x6')]);}else if(_0x169635[_0x1f46('0x7')]===_0x1f46('0x8')&&_0x169635[_0x1f46('0x9')]){_0x4a0374[_0x169635[_0x1f46('0x9')]]&&_0x1fd155[_0x1f46('0xa')](_0x4a0374[_0x169635[_0x1f46('0x9')]][_0x1f46('0xb')]());}else if(_0x169635[_0x1f46('0x7')]===_0x1f46('0xc')&&_0x169635[_0x1f46('0xd')]&&_0x169635[_0x1f46('0xd')][_0x1f46('0xe')]){_0x4a0374[_0x169635[_0x1f46('0xd')]['name'][_0x1f46('0xf')]()]&&_0x1fd155[_0x1f46('0xa')](_0x4a0374[_0x169635[_0x1f46('0xd')][_0x1f46('0xe')][_0x1f46('0xf')]()]['toString']());}else if(_0x169635[_0x1f46('0x7')]===_0x1f46('0x10')){if(_0x169635['keyType']===_0x1f46('0x5')&&_0x169635[_0x1f46('0x11')]){_0x1fd155[_0x1f46('0xa')](util[_0x1f46('0x12')]('%s:\x20%s',_0x169635[_0x1f46('0x11')],_0x169635[_0x1f46('0x13')]));}else if(_0x169635[_0x1f46('0x14')]===_0x1f46('0x8')&&_0x169635[_0x1f46('0x9')]&&_0x169635[_0x1f46('0x11')]){_0x4a0374[_0x169635[_0x1f46('0x9')]]&&_0x1fd155['push'](util[_0x1f46('0x12')](_0x1f46('0x15'),_0x169635['key'],_0x4a0374[_0x169635[_0x1f46('0x9')]]));}else if(_0x169635['keyType']===_0x1f46('0xc')&&_0x169635['Variable']&&_0x169635[_0x1f46('0xd')][_0x1f46('0xe')]&&_0x169635[_0x1f46('0x11')]){_0x4a0374[_0x169635[_0x1f46('0xd')][_0x1f46('0xe')][_0x1f46('0xf')]()]&&_0x1fd155[_0x1f46('0xa')](util[_0x1f46('0x12')](_0x1f46('0x15'),_0x169635[_0x1f46('0x11')],_0x4a0374[_0x169635[_0x1f46('0xd')][_0x1f46('0xe')][_0x1f46('0xf')]()]));}}}}return _0x1fd155['join'](_0x539b5a);};exports['stripTrailingSlash']=function(_0x1ab4b1){var _0x2bb067=_0x1ab4b1[_0x1f46('0x16')](-0x1);if(_0x2bb067==='/'){_0x1ab4b1=_0x1ab4b1['substring'](0x0,_0x1ab4b1[_0x1f46('0x17')](_0x2bb067));}return _0x1ab4b1;};exports[_0x1f46('0x18')]=function(_0x1b4818){if(!_[_0x1f46('0x19')](_0x1b4818)&&_0x1b4818!==''){var _0x2ea620=/^(([^<>()\[\]\\.,;:\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 _0x2ea620[_0x1f46('0x1a')](String(_0x1b4818)[_0x1f46('0xf')]());}else{return![];}}; \ No newline at end of file +var _0x1b9e=['lastIndexOf','validateEmail','isNil','lodash','util','getString','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','stripTrailingSlash','slice','substring'];(function(_0x3537a8,_0x4793c7){var _0x36ecb4=function(_0x2eb963){while(--_0x2eb963){_0x3537a8['push'](_0x3537a8['shift']());}};_0x36ecb4(++_0x4793c7);}(_0x1b9e,0x6f));var _0xe1b9=function(_0x48a556,_0xae59b3){_0x48a556=_0x48a556-0x0;var _0x41d6f2=_0x1b9e[_0x48a556];return _0x41d6f2;};'use strict';var _=require(_0xe1b9('0x0'));var util=require(_0xe1b9('0x1'));exports[_0xe1b9('0x2')]=function(_0x4544eb,_0xc3522c,_0x44860d){var _0x5c1863=[];if(_0x4544eb[_0xe1b9('0x3')]>0x0){var _0x212379=_['sortBy'](_0x4544eb,['id']);for(var _0x29bdb3=0x0;_0x29bdb3<_0x212379[_0xe1b9('0x3')];_0x29bdb3++){var _0x11595b=_0x212379[_0x29bdb3];if(_0x11595b[_0xe1b9('0x4')]===_0xe1b9('0x5')){_0x5c1863[_0xe1b9('0x6')](_0x11595b[_0xe1b9('0x7')]);}else if(_0x11595b['type']===_0xe1b9('0x8')&&_0x11595b[_0xe1b9('0x9')]){_0xc3522c[_0x11595b[_0xe1b9('0x9')]]&&_0x5c1863[_0xe1b9('0x6')](_0xc3522c[_0x11595b[_0xe1b9('0x9')]][_0xe1b9('0xa')]());}else if(_0x11595b[_0xe1b9('0x4')]===_0xe1b9('0xb')&&_0x11595b['Variable']&&_0x11595b['Variable']['name']){_0xc3522c[_0x11595b[_0xe1b9('0xc')][_0xe1b9('0xd')]['toLowerCase']()]&&_0x5c1863[_0xe1b9('0x6')](_0xc3522c[_0x11595b[_0xe1b9('0xc')][_0xe1b9('0xd')][_0xe1b9('0xe')]()]['toString']());}else if(_0x11595b['type']===_0xe1b9('0xf')){if(_0x11595b[_0xe1b9('0x10')]==='string'&&_0x11595b[_0xe1b9('0x11')]){_0x5c1863[_0xe1b9('0x6')](util[_0xe1b9('0x12')]('%s:\x20%s',_0x11595b['key'],_0x11595b[_0xe1b9('0x13')]));}else if(_0x11595b[_0xe1b9('0x10')]===_0xe1b9('0x8')&&_0x11595b[_0xe1b9('0x9')]&&_0x11595b['key']){_0xc3522c[_0x11595b[_0xe1b9('0x9')]]&&_0x5c1863[_0xe1b9('0x6')](util[_0xe1b9('0x12')](_0xe1b9('0x14'),_0x11595b[_0xe1b9('0x11')],_0xc3522c[_0x11595b[_0xe1b9('0x9')]]));}else if(_0x11595b[_0xe1b9('0x10')]===_0xe1b9('0xb')&&_0x11595b['Variable']&&_0x11595b['Variable'][_0xe1b9('0xd')]&&_0x11595b['key']){_0xc3522c[_0x11595b[_0xe1b9('0xc')][_0xe1b9('0xd')][_0xe1b9('0xe')]()]&&_0x5c1863[_0xe1b9('0x6')](util['format']('%s:\x20%s',_0x11595b[_0xe1b9('0x11')],_0xc3522c[_0x11595b['Variable'][_0xe1b9('0xd')][_0xe1b9('0xe')]()]));}}}}return _0x5c1863['join'](_0x44860d);};exports[_0xe1b9('0x15')]=function(_0x1a055e){var _0x15116c=_0x1a055e[_0xe1b9('0x16')](-0x1);if(_0x15116c==='/'){_0x1a055e=_0x1a055e[_0xe1b9('0x17')](0x0,_0x1a055e[_0xe1b9('0x18')](_0x15116c));}return _0x1a055e;};exports[_0xe1b9('0x19')]=function(_0x3b7f02){if(!_[_0xe1b9('0x1a')](_0x3b7f02)&&_0x3b7f02!==''){var _0x41aefb=/^(([^<>()\[\]\\.,;:\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 _0x41aefb['test'](String(_0x3b7f02)['toLowerCase']());}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 69383d9..538ecc8 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 _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(_0x1d2b4b,_0x1b8974){var _0x54d25f=function(_0x1008e2){while(--_0x1008e2){_0x1d2b4b['push'](_0x1d2b4b['shift']());}};_0x54d25f(++_0x1b8974);}(_0xe706,0xa3));var _0x6e70=function(_0x13651c,_0x1b81c5){_0x13651c=_0x13651c-0x0;var _0xc6ea66=_0xe706[_0x13651c];return _0xc6ea66;};'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 +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x47c2a2,_0x196f83){var _0x46db37=function(_0x52c829){while(--_0x52c829){_0x47c2a2['push'](_0x47c2a2['shift']());}};_0x46db37(++_0x196f83);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 477c025..fe70c9d 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 _0x53e7=['push','toString','variable','variableName','customVariable','Variable','custom_fields','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','../../../../config/logger','zendesk','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/users/me.json','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','stringify','defaults','GET','includes','string','picklist','type','nameField','content','idField','customField'];(function(_0x27f7d9,_0x5cccfe){var _0x160d76=function(_0x2501ac){while(--_0x2501ac){_0x27f7d9['push'](_0x27f7d9['shift']());}};_0x160d76(++_0x5cccfe);}(_0x53e7,0x1da));var _0x753e=function(_0x4e7490,_0x4b26ae){_0x4e7490=_0x4e7490-0x0;var _0x3622d0=_0x53e7[_0x4e7490];return _0x3622d0;};'use strict';var _=require(_0x753e('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x753e('0x1'));var Redis=require(_0x753e('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x753e('0x3'))(_0x753e('0x4'));config[_0x753e('0x5')]=_['defaults'](config[_0x753e('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x753e('0x6'))(new Redis(config[_0x753e('0x5')]));function emit(_0x2752a1,_0x1b3efd,_0x42978b){io['to'](_0x2752a1)[_0x753e('0x7')](_0x1b3efd,_0x42978b);}var headers={'Content-Type':_0x753e('0x8'),'Accept':_0x753e('0x8')};function getTicket(_0x42bf42,_0x4e9d85,_0x2ab5d9,_0x12eda9,_0x10427b){logger[_0x753e('0x9')](_0x753e('0xa'));return request({'uri':util[_0x753e('0xb')](_0x753e('0xc'),_0x42bf42[_0x753e('0xd')]),'method':_0x753e('0xe'),'body':{'ticket':_[_0x753e('0xf')]({'requester_id':_0x2ab5d9['id'],'submitter_id':_0x4e9d85?_0x4e9d85['id']:undefined,'assignee_id':_0x4e9d85?_0x4e9d85['id']:undefined,'tags':getTags(_0x12eda9['Tags'],_0x753e('0x10')),'subject':intUtil[_0x753e('0x11')](_0x12eda9[_0x753e('0x12')],_0x10427b,'\x20'),'description':intUtil['getString'](_0x12eda9[_0x753e('0x13')],_0x10427b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x753e('0x11')](_0x12eda9['Descriptions'],_0x10427b,'\x0a')}},getCustomFields(_0x12eda9[_0x753e('0x14')],_0x10427b))}})[_0x753e('0x15')](function(_0x2c7eb8){logger[_0x753e('0x9')](_0x753e('0x16'));return _0x2c7eb8[_0x753e('0x17')];});}function getUser(_0x30537b,_0x2da3f4){if(intUtil[_0x753e('0x18')](_0x2da3f4)){logger['info']('Getting\x20agent\x20with\x20email',_0x2da3f4);return request({'uri':util[_0x753e('0xb')]('%s/search.json',_0x30537b[_0x753e('0xd')]),'qs':{'query':util[_0x753e('0xb')](_0x753e('0x19'),_0x2da3f4)}})[_0x753e('0x15')](function(_0x1fe668){if(_0x1fe668['count']){logger[_0x753e('0x9')](_0x753e('0x1a'));return _[_0x753e('0x1b')](_0x1fe668[_0x753e('0x1c')],{'email':_0x2da3f4,'role':_0x753e('0x1d')});}else{logger['info'](_0x753e('0x1e'));return request({'uri':util[_0x753e('0xb')]('%s/users/me.json',_0x30537b[_0x753e('0xd')])})[_0x753e('0x15')](function(_0x3e2b2e){logger[_0x753e('0x9')](_0x753e('0x1f'));return _0x3e2b2e['user'];});}});}else{logger[_0x753e('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x753e('0x20'),_0x30537b[_0x753e('0xd')])})[_0x753e('0x15')](function(_0x13b2c2){logger[_0x753e('0x9')](_0x753e('0x1f'));return _0x13b2c2['user'];});}}function getEndUser(_0x573266,_0x3f4b0f,_0x294d7c){logger[_0x753e('0x9')]('Searching\x20enduser\x20with\x20phone',_0x294d7c);return request({'uri':util[_0x753e('0xb')]('%s/search.json',_0x573266[_0x753e('0xd')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x294d7c)}})['then'](function(_0x5151a4){var _0x4bda0b;if(_0x5151a4['results'][_0x753e('0x21')]){_0x5151a4[_0x753e('0x1c')]=_[_0x753e('0x22')](_0x5151a4['results'],{'suspended':![],'role':_0x753e('0x23')});if(_0x5151a4[_0x753e('0x1c')][_0x753e('0x21')]){_0x4bda0b=_[_0x753e('0x24')](_0x5151a4['results']);}}if(_0x4bda0b){logger[_0x753e('0x9')](_0x753e('0x25'));return _0x4bda0b;}else{logger[_0x753e('0x9')](_0x753e('0x26'));return request({'uri':util[_0x753e('0xb')](_0x753e('0x27'),_0x573266[_0x753e('0xd')]),'method':'POST','body':{'user':{'role':_0x753e('0x23'),'name':util['format']('Caller\x20-\x20%s',_0x3f4b0f||_0x294d7c),'phone':_0x294d7c}}})[_0x753e('0x15')](function(_0x331628){logger[_0x753e('0x9')](_0x753e('0x28'));return _0x331628['user'];});}});}function getAuth(_0x21c6db){var _0x10bf73;if(_0x21c6db[_0x753e('0x29')]===_0x753e('0x2a')){_0x10bf73=util[_0x753e('0xb')](_0x753e('0x2b'),_0x21c6db[_0x753e('0x2c')],_0x21c6db['password']);}else if(_0x21c6db['authType']===_0x753e('0x2d')){_0x10bf73=util['format'](_0x753e('0x2e'),_0x21c6db[_0x753e('0x2c')],_0x21c6db[_0x753e('0x2d')]);}return util[_0x753e('0xb')](_0x753e('0x2f'),new Buffer(_0x10bf73)['toString'](_0x753e('0x30')));}function request(_0x1e9b15){logger[_0x753e('0x31')]('[HTTP]',JSON[_0x753e('0x32')](_0x1e9b15));return rp(_[_0x753e('0x33')](_0x1e9b15,{'method':_0x753e('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x37c06b,_0x1862f6){var _0x1b9b15=[];if(_0x37c06b&&_0x37c06b[_0x753e('0x21')]>0x0){_0x1b9b15=_['map'](_0x37c06b,_0x1862f6);}return _0x1b9b15;}function getCustomFields(_0x4e758b,_0x2b1829){var _0x247c64=[];var _0x3a87ff={'custom_fields':[]};if(_0x4e758b[_0x753e('0x21')]>0x0){_['forEach'](_0x4e758b,function(_0x47840e){if(_[_0x753e('0x35')]([_0x753e('0x36'),_0x753e('0x37')],_0x47840e[_0x753e('0x38')])&&_0x47840e[_0x753e('0x39')]&&!_0x47840e['customField']){_0x3a87ff[_0x47840e[_0x753e('0x39')]['toLowerCase']()]=_0x47840e[_0x753e('0x3a')]['toString']();}else if(_['includes']([_0x753e('0x36'),_0x753e('0x37')],_0x47840e[_0x753e('0x38')])&&_0x47840e[_0x753e('0x3b')]&&_0x47840e[_0x753e('0x3c')]){_0x3a87ff['custom_fields'][_0x753e('0x3d')]({'id':_0x47840e['idField'],'value':_0x47840e[_0x753e('0x3a')][_0x753e('0x3e')]()});}else if(_0x47840e['type']===_0x753e('0x3f')&&_0x47840e['variableName']&&_0x47840e['idField']&&_0x47840e['customField']){_0x2b1829[_0x47840e[_0x753e('0x40')]]&&_0x3a87ff['custom_fields'][_0x753e('0x3d')]({'id':_0x47840e[_0x753e('0x3b')],'value':_0x2b1829[_0x47840e[_0x753e('0x40')]][_0x753e('0x3e')]()});}else if(_0x47840e[_0x753e('0x38')]===_0x753e('0x41')&&_0x47840e[_0x753e('0x42')]&&_0x47840e['Variable'][_0x753e('0x10')]&&_0x47840e[_0x753e('0x3b')]&&_0x47840e['customField']){_0x2b1829[_0x47840e[_0x753e('0x42')][_0x753e('0x10')]['toLowerCase']()]&&_0x3a87ff[_0x753e('0x43')][_0x753e('0x3d')]({'id':_0x47840e[_0x753e('0x3b')],'value':_0x2b1829[_0x47840e[_0x753e('0x42')][_0x753e('0x10')]['toLowerCase']()][_0x753e('0x3e')]()});}});}return _0x3a87ff;}exports['queue']=function(_0x437167,_0x17d166,_0xfb971e,_0xdaab09,_0x4898ec,_0x38b72a){var _0x3ef972,_0x170330;_0x38b72a[_0x753e('0xd')]=intUtil['stripTrailingSlash'](_0x38b72a[_0x753e('0xd')]);_0x38b72a[_0x753e('0x44')]=intUtil[_0x753e('0x45')](_0x38b72a[_0x753e('0x44')]);if(_0x4898ec&&_0x4898ec['monitor_format']){logger['info'](_0x753e('0x46'),'Recording\x20is\x20enabled!');_0x17d166[_0x753e('0x47')]=util[_0x753e('0xb')](_0x753e('0x48'),_0x38b72a[_0x753e('0x44')],_0x17d166[_0x753e('0x49')],md5(_0x17d166['uniqueid']));}else{_0x17d166[_0x753e('0x47')]='';}headers[_0x753e('0x4a')]=getAuth(_0x38b72a);return getUser(_0x38b72a,_0xdaab09[_0x753e('0x4b')])[_0x753e('0x15')](function(_0x1ea720){_0x3ef972=_0x1ea720;logger[_0x753e('0x9')](_0x753e('0x4c'),_0x3ef972['id']);return getEndUser(_0x38b72a,_0x17d166[_0x753e('0x4d')],_0x17d166[_0x753e('0x4e')]);})[_0x753e('0x15')](function(_0x106d5e){_0x170330=_0x106d5e;logger[_0x753e('0x9')](_0x753e('0x4f'),_0x170330['id']);return getTicket(_0x38b72a,_0x3ef972,_0x170330,_0xfb971e,_0x17d166);})['then'](function(_0x3ea226){if(_0x3ea226){logger[_0x753e('0x9')]('The\x20Ticket\x20ID\x20is:',_0x3ea226['id']);switch(_0x38b72a[_0x753e('0x38')]){case'integrationTab':logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x753e('0xb')](_0x753e('0x50'),_0x38b72a[_0x753e('0xd')],_0x3ef972['id'],_0x3ea226['id']),'method':'POST'});case _0x753e('0x51'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x753e('0x52'),_0xdaab09['name']),_0x753e('0x53'),{'uri':util[_0x753e('0xb')](_0x753e('0x54'),_0x38b72a['remoteUri'][_0x753e('0x55')](_0x753e('0x56'),''),_0x3ea226['id'])});break;default:logger[_0x753e('0x57')](_0x753e('0x46'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x753e('0x58')](function(_0x4e24c6){logger[_0x753e('0x57')](_0x753e('0x59'),util['inspect'](_0x4e24c6,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x768fd7,_0x4444c4,_0x46f136,_0x447422,_0x5185e5,_0x297c68,_0x2363d8){var _0x1566a7,_0xea78c6;_0x297c68[_0x753e('0xd')]=intUtil[_0x753e('0x45')](_0x297c68['remoteUri']);_0x297c68[_0x753e('0x44')]=intUtil[_0x753e('0x45')](_0x297c68[_0x753e('0x44')]);if(_0x2363d8&&_0x2363d8[_0x753e('0x5a')]&&_0x2363d8[_0x753e('0x5a')]!==_0x753e('0x5b')){logger[_0x753e('0x9')](_0x753e('0x5c'),_0x753e('0x5d'));_0x4444c4['recordingURL']=util[_0x753e('0xb')](_0x753e('0x48'),_0x297c68[_0x753e('0x44')],_0x4444c4[_0x753e('0x49')],md5(_0x4444c4[_0x753e('0x49')]));}headers[_0x753e('0x4a')]=getAuth(_0x297c68);return getUser(_0x297c68,_0x447422[_0x753e('0x4b')])[_0x753e('0x15')](function(_0x3371df){_0x1566a7=_0x3371df;logger[_0x753e('0x9')]('The\x20User\x20ID\x20is:',_0x1566a7['id']);return getEndUser(_0x297c68,_0x4444c4[_0x753e('0x5e')],_0x4444c4[_0x753e('0x5f')]);})[_0x753e('0x15')](function(_0x4c4246){_0xea78c6=_0x4c4246;logger[_0x753e('0x9')](_0x753e('0x4f'),_0xea78c6['id']);return getTicket(_0x297c68,_0x1566a7,_0xea78c6,_0x46f136,_0x4444c4);})[_0x753e('0x15')](function(_0x5a4d1f){if(_0x5a4d1f){logger[_0x753e('0x9')](_0x753e('0x60'),_0x5a4d1f['id']);switch(_0x297c68[_0x753e('0x38')]){case _0x753e('0x61'):logger[_0x753e('0x9')](_0x753e('0x5c'),_0x753e('0x62'));return request({'uri':util[_0x753e('0xb')](_0x753e('0x50'),_0x297c68[_0x753e('0xd')],_0x1566a7['id'],_0x5a4d1f['id']),'method':_0x753e('0xe')});case _0x753e('0x51'):logger[_0x753e('0x9')]('[OUTBOUND]',_0x753e('0x63'));emit(util['format'](_0x753e('0x52'),_0x447422['name']),_0x753e('0x53'),{'uri':util[_0x753e('0xb')](_0x753e('0x54'),_0x297c68['remoteUri'][_0x753e('0x55')](_0x753e('0x56'),''),_0x5a4d1f['id'])});break;default:logger[_0x753e('0x57')](_0x753e('0x5c'),_0x753e('0x64'));}}})[_0x753e('0x58')](function(_0x49eec1){logger[_0x753e('0x57')](_0x753e('0x65'),util[_0x753e('0x66')](_0x49eec1,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x2d3dfd,_0x50b87a,_0x3aff02,_0xdaf675,_0x35c58d,_0x2fa73e){var _0x3a5c2e,_0x2e292e;_0x2fa73e['remoteUri']=intUtil[_0x753e('0x45')](_0x2fa73e[_0x753e('0xd')]);_0x2fa73e[_0x753e('0x44')]=intUtil[_0x753e('0x45')](_0x2fa73e[_0x753e('0x44')]);if(_0x35c58d&&_0x35c58d[_0x753e('0x67')]){logger[_0x753e('0x9')]('['+_0x50b87a[_0x753e('0x68')][_0x753e('0x69')]()+']',_0x753e('0x5d'));_0x50b87a['recordingURL']=util[_0x753e('0xb')](_0x753e('0x48'),_0x2fa73e[_0x753e('0x44')],_0x50b87a[_0x753e('0x49')],md5(_0x50b87a[_0x753e('0x49')]));}else{_0x50b87a[_0x753e('0x47')]='';}headers['Authorization']=getAuth(_0x2fa73e);return getUser(_0x2fa73e)[_0x753e('0x15')](function(_0x133b3e){_0x3a5c2e=_0x133b3e;logger['info'](_0x753e('0x4c'),_0x3a5c2e['id']);return getEndUser(_0x2fa73e,_0x50b87a[_0x753e('0x4d')],_0x50b87a[_0x753e('0x4e')]);})[_0x753e('0x15')](function(_0x407d3a){_0x2e292e=_0x407d3a;logger['info'](_0x753e('0x4f'),_0x2e292e['id']);return getTicket(_0x2fa73e,_0x3a5c2e,_0x2e292e,_0x3aff02,_0x50b87a);})['then'](function(_0x30baf8){if(_0x30baf8){logger[_0x753e('0x9')]('The\x20Ticket\x20ID\x20is:',_0x30baf8['id']);}})['catch'](function(_0x28ffa2){logger['error']('['+_0x50b87a['lastevent'][_0x753e('0x69')]()+']'+_0x753e('0x6a'),util[_0x753e('0x66')](_0x28ffa2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcd97=['The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','error','[QUEUE]','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','serverUrl','stripTrailingSlash','recordingFormat','none','destcalleridname','integrationTab','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','socket.io-emitter','emit','application/json','format','%s/tickets.json','POST','Tags','getString','Subjects','Fields','Ticket\x20created!','ticket','info','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','user','then','Admin\x20account\x20selected.','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','forEach','string','picklist','nameField','toLowerCase','content','includes','type','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:'];(function(_0xf852,_0x4ddd76){var _0x5b2550=function(_0x4811b1){while(--_0x4811b1){_0xf852['push'](_0xf852['shift']());}};_0x5b2550(++_0x4ddd76);}(_0xcd97,0xfa));var _0x7cd9=function(_0x59a1d9,_0x181115){_0x59a1d9=_0x59a1d9-0x0;var _0x577f9c=_0xcd97[_0x59a1d9];return _0x577f9c;};'use strict';var _=require(_0x7cd9('0x0'));var rp=require(_0x7cd9('0x1'));var md5=require('md5');var util=require(_0x7cd9('0x2'));var Redis=require(_0x7cd9('0x3'));var intUtil=require(_0x7cd9('0x4'));var config=require(_0x7cd9('0x5'));var logger=require(_0x7cd9('0x6'))(_0x7cd9('0x7'));config[_0x7cd9('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7cd9('0x9'))(new Redis(config[_0x7cd9('0x8')]));function emit(_0x801c2e,_0x4fbcc5,_0x41aa8e){io['to'](_0x801c2e)[_0x7cd9('0xa')](_0x4fbcc5,_0x41aa8e);}var headers={'Content-Type':_0x7cd9('0xb'),'Accept':_0x7cd9('0xb')};function getTicket(_0x297b9a,_0x4c4837,_0x5509f2,_0x4678dd,_0x124042){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x7cd9('0xc')](_0x7cd9('0xd'),_0x297b9a['remoteUri']),'method':_0x7cd9('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x5509f2['id'],'submitter_id':_0x4c4837?_0x4c4837['id']:undefined,'assignee_id':_0x4c4837?_0x4c4837['id']:undefined,'tags':getTags(_0x4678dd[_0x7cd9('0xf')],'name'),'subject':intUtil[_0x7cd9('0x10')](_0x4678dd[_0x7cd9('0x11')],_0x124042,'\x20'),'description':intUtil[_0x7cd9('0x10')](_0x4678dd['Descriptions'],_0x124042,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7cd9('0x10')](_0x4678dd['Descriptions'],_0x124042,'\x0a')}},getCustomFields(_0x4678dd[_0x7cd9('0x12')],_0x124042))}})['then'](function(_0x10f734){logger['info'](_0x7cd9('0x13'));return _0x10f734[_0x7cd9('0x14')];});}function getUser(_0x501714,_0x3a394b){if(intUtil['validateEmail'](_0x3a394b)){logger[_0x7cd9('0x15')](_0x7cd9('0x16'),_0x3a394b);return request({'uri':util[_0x7cd9('0xc')](_0x7cd9('0x17'),_0x501714['remoteUri']),'qs':{'query':util['format'](_0x7cd9('0x18'),_0x3a394b)}})['then'](function(_0x53b433){if(_0x53b433['count']){logger[_0x7cd9('0x15')](_0x7cd9('0x19'));return _['find'](_0x53b433[_0x7cd9('0x1a')],{'email':_0x3a394b,'role':'agent'});}else{logger[_0x7cd9('0x15')](_0x7cd9('0x1b'));return request({'uri':util[_0x7cd9('0xc')](_0x7cd9('0x1c'),_0x501714[_0x7cd9('0x1d')])})['then'](function(_0x4e3f2d){logger[_0x7cd9('0x15')]('Admin\x20account\x20selected.');return _0x4e3f2d[_0x7cd9('0x1e')];});}});}else{logger['info'](_0x7cd9('0x1b'));return request({'uri':util[_0x7cd9('0xc')]('%s/users/me.json',_0x501714[_0x7cd9('0x1d')])})[_0x7cd9('0x1f')](function(_0x118f45){logger['info'](_0x7cd9('0x20'));return _0x118f45[_0x7cd9('0x1e')];});}}function getEndUser(_0xeff0f,_0x682b15,_0x329936){logger[_0x7cd9('0x15')]('Searching\x20enduser\x20with\x20phone',_0x329936);return request({'uri':util[_0x7cd9('0xc')]('%s/search.json',_0xeff0f[_0x7cd9('0x1d')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x329936)}})['then'](function(_0x313338){var _0x3da95e;if(_0x313338['results'][_0x7cd9('0x21')]){_0x313338[_0x7cd9('0x1a')]=_[_0x7cd9('0x22')](_0x313338[_0x7cd9('0x1a')],{'suspended':![],'role':_0x7cd9('0x23')});if(_0x313338[_0x7cd9('0x1a')]['length']){_0x3da95e=_[_0x7cd9('0x24')](_0x313338[_0x7cd9('0x1a')]);}}if(_0x3da95e){logger[_0x7cd9('0x15')](_0x7cd9('0x25'));return _0x3da95e;}else{logger[_0x7cd9('0x15')](_0x7cd9('0x26'));return request({'uri':util['format'](_0x7cd9('0x27'),_0xeff0f[_0x7cd9('0x1d')]),'method':_0x7cd9('0xe'),'body':{'user':{'role':'end-user','name':util[_0x7cd9('0xc')](_0x7cd9('0x28'),_0x682b15||_0x329936),'phone':_0x329936}}})['then'](function(_0x4c9279){logger[_0x7cd9('0x15')](_0x7cd9('0x29'));return _0x4c9279[_0x7cd9('0x1e')];});}});}function getAuth(_0xf252a7){var _0x1fa73c;if(_0xf252a7['authType']===_0x7cd9('0x2a')){_0x1fa73c=util[_0x7cd9('0xc')](_0x7cd9('0x2b'),_0xf252a7['username'],_0xf252a7[_0x7cd9('0x2a')]);}else if(_0xf252a7[_0x7cd9('0x2c')]===_0x7cd9('0x2d')){_0x1fa73c=util[_0x7cd9('0xc')](_0x7cd9('0x2e'),_0xf252a7['username'],_0xf252a7['token']);}return util['format'](_0x7cd9('0x2f'),new Buffer(_0x1fa73c)[_0x7cd9('0x30')](_0x7cd9('0x31')));}function request(_0x13c78f){logger[_0x7cd9('0x32')](_0x7cd9('0x33'),JSON[_0x7cd9('0x34')](_0x13c78f));return rp(_[_0x7cd9('0x35')](_0x13c78f,{'method':_0x7cd9('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x4e7e52,_0x277800){var _0x31d96f=[];if(_0x4e7e52&&_0x4e7e52[_0x7cd9('0x21')]>0x0){_0x31d96f=_['map'](_0x4e7e52,_0x277800);}return _0x31d96f;}function getCustomFields(_0x3801c0,_0x4dea4a){var _0x485d77=[];var _0x1919a8={'custom_fields':[]};if(_0x3801c0['length']>0x0){_[_0x7cd9('0x37')](_0x3801c0,function(_0x452724){if(_['includes']([_0x7cd9('0x38'),_0x7cd9('0x39')],_0x452724['type'])&&_0x452724[_0x7cd9('0x3a')]&&!_0x452724['customField']){_0x1919a8[_0x452724[_0x7cd9('0x3a')][_0x7cd9('0x3b')]()]=_0x452724[_0x7cd9('0x3c')]['toString']();}else if(_[_0x7cd9('0x3d')]([_0x7cd9('0x38'),'picklist'],_0x452724[_0x7cd9('0x3e')])&&_0x452724[_0x7cd9('0x3f')]&&_0x452724[_0x7cd9('0x40')]){_0x1919a8[_0x7cd9('0x41')][_0x7cd9('0x42')]({'id':_0x452724[_0x7cd9('0x3f')],'value':_0x452724[_0x7cd9('0x3c')]['toString']()});}else if(_0x452724[_0x7cd9('0x3e')]===_0x7cd9('0x43')&&_0x452724[_0x7cd9('0x44')]&&_0x452724[_0x7cd9('0x3f')]&&_0x452724[_0x7cd9('0x40')]){_0x4dea4a[_0x452724[_0x7cd9('0x44')]]&&_0x1919a8['custom_fields'][_0x7cd9('0x42')]({'id':_0x452724[_0x7cd9('0x3f')],'value':_0x4dea4a[_0x452724[_0x7cd9('0x44')]][_0x7cd9('0x30')]()});}else if(_0x452724[_0x7cd9('0x3e')]===_0x7cd9('0x45')&&_0x452724[_0x7cd9('0x46')]&&_0x452724[_0x7cd9('0x46')]['name']&&_0x452724[_0x7cd9('0x3f')]&&_0x452724['customField']){_0x4dea4a[_0x452724[_0x7cd9('0x46')][_0x7cd9('0x47')][_0x7cd9('0x3b')]()]&&_0x1919a8[_0x7cd9('0x41')][_0x7cd9('0x42')]({'id':_0x452724[_0x7cd9('0x3f')],'value':_0x4dea4a[_0x452724[_0x7cd9('0x46')]['name'][_0x7cd9('0x3b')]()][_0x7cd9('0x30')]()});}});}return _0x1919a8;}exports[_0x7cd9('0x48')]=function(_0x1b5a6c,_0x5c0c12,_0x2e6693,_0x39bd6b,_0x4634e8,_0x4530a6){var _0x2dfa95,_0x3d9b57;_0x4530a6['remoteUri']=intUtil['stripTrailingSlash'](_0x4530a6['remoteUri']);_0x4530a6['serverUrl']=intUtil['stripTrailingSlash'](_0x4530a6['serverUrl']);if(_0x4634e8&&_0x4634e8[_0x7cd9('0x49')]){logger[_0x7cd9('0x15')]('[QUEUE]',_0x7cd9('0x4a'));_0x5c0c12[_0x7cd9('0x4b')]=util[_0x7cd9('0xc')](_0x7cd9('0x4c'),_0x4530a6['serverUrl'],_0x5c0c12['uniqueid'],md5(_0x5c0c12[_0x7cd9('0x4d')]));}else{_0x5c0c12['recordingURL']='';}headers[_0x7cd9('0x4e')]=getAuth(_0x4530a6);return getUser(_0x4530a6,_0x39bd6b[_0x7cd9('0x4f')])['then'](function(_0x214ec2){_0x2dfa95=_0x214ec2;logger[_0x7cd9('0x15')](_0x7cd9('0x50'),_0x2dfa95['id']);return getEndUser(_0x4530a6,_0x5c0c12[_0x7cd9('0x51')],_0x5c0c12['calleridnum']);})[_0x7cd9('0x1f')](function(_0x17f45d){_0x3d9b57=_0x17f45d;logger[_0x7cd9('0x15')](_0x7cd9('0x52'),_0x3d9b57['id']);return getTicket(_0x4530a6,_0x2dfa95,_0x3d9b57,_0x2e6693,_0x5c0c12);})[_0x7cd9('0x1f')](function(_0x206ff6){if(_0x206ff6){logger[_0x7cd9('0x15')](_0x7cd9('0x53'),_0x206ff6['id']);switch(_0x4530a6[_0x7cd9('0x3e')]){case'integrationTab':logger[_0x7cd9('0x15')]('[QUEUE]',_0x7cd9('0x54'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4530a6[_0x7cd9('0x1d')],_0x2dfa95['id'],_0x206ff6['id']),'method':_0x7cd9('0xe')});case _0x7cd9('0x55'):logger[_0x7cd9('0x15')]('[QUEUE]',_0x7cd9('0x56'));emit(util[_0x7cd9('0xc')]('user:%s',_0x39bd6b['name']),_0x7cd9('0x57'),{'uri':util[_0x7cd9('0xc')]('%s/agent/tickets/%s',_0x4530a6[_0x7cd9('0x1d')][_0x7cd9('0x58')]('/api/v2',''),_0x206ff6['id'])});break;default:logger[_0x7cd9('0x59')](_0x7cd9('0x5a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x3c79b1){logger['error'](_0x7cd9('0x5b'),util[_0x7cd9('0x5c')](_0x3c79b1,{'showHidden':!![],'depth':null}));});};exports[_0x7cd9('0x5d')]=function(_0x21c7be,_0x27e69f,_0x1d75a7,_0x13dc7a,_0x10e79b,_0x4a559d,_0x369c9f){var _0x3bedb2,_0xb98700;_0x4a559d[_0x7cd9('0x1d')]=intUtil['stripTrailingSlash'](_0x4a559d[_0x7cd9('0x1d')]);_0x4a559d[_0x7cd9('0x5e')]=intUtil[_0x7cd9('0x5f')](_0x4a559d[_0x7cd9('0x5e')]);if(_0x369c9f&&_0x369c9f['recordingFormat']&&_0x369c9f[_0x7cd9('0x60')]!==_0x7cd9('0x61')){logger['info']('[OUTBOUND]',_0x7cd9('0x4a'));_0x27e69f[_0x7cd9('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a559d[_0x7cd9('0x5e')],_0x27e69f['uniqueid'],md5(_0x27e69f[_0x7cd9('0x4d')]));}headers[_0x7cd9('0x4e')]=getAuth(_0x4a559d);return getUser(_0x4a559d,_0x13dc7a[_0x7cd9('0x4f')])[_0x7cd9('0x1f')](function(_0x88215b){_0x3bedb2=_0x88215b;logger['info'](_0x7cd9('0x50'),_0x3bedb2['id']);return getEndUser(_0x4a559d,_0x27e69f[_0x7cd9('0x62')],_0x27e69f['destcalleridnum']);})['then'](function(_0x3f45ee){_0xb98700=_0x3f45ee;logger['info'](_0x7cd9('0x52'),_0xb98700['id']);return getTicket(_0x4a559d,_0x3bedb2,_0xb98700,_0x1d75a7,_0x27e69f);})[_0x7cd9('0x1f')](function(_0x1c4e81){if(_0x1c4e81){logger[_0x7cd9('0x15')]('The\x20Ticket\x20ID\x20is:',_0x1c4e81['id']);switch(_0x4a559d[_0x7cd9('0x3e')]){case _0x7cd9('0x63'):logger[_0x7cd9('0x15')](_0x7cd9('0x64'),_0x7cd9('0x54'));return request({'uri':util['format'](_0x7cd9('0x65'),_0x4a559d[_0x7cd9('0x1d')],_0x3bedb2['id'],_0x1c4e81['id']),'method':'POST'});case _0x7cd9('0x55'):logger[_0x7cd9('0x15')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7cd9('0xc')](_0x7cd9('0x66'),_0x13dc7a[_0x7cd9('0x47')]),_0x7cd9('0x57'),{'uri':util[_0x7cd9('0xc')](_0x7cd9('0x67'),_0x4a559d['remoteUri'][_0x7cd9('0x58')](_0x7cd9('0x68'),''),_0x1c4e81['id'])});break;default:logger[_0x7cd9('0x59')](_0x7cd9('0x64'),_0x7cd9('0x69'));}}})[_0x7cd9('0x6a')](function(_0x26706c){logger['error'](_0x7cd9('0x6b'),util[_0x7cd9('0x5c')](_0x26706c,{'showHidden':!![],'depth':null}));});};exports[_0x7cd9('0x6c')]=function(_0x46bd0a,_0x7c261d,_0x899e9a,_0x24a050,_0x5944c5,_0x4adc27){var _0x3ac144,_0x2adf39;_0x4adc27['remoteUri']=intUtil['stripTrailingSlash'](_0x4adc27['remoteUri']);_0x4adc27['serverUrl']=intUtil[_0x7cd9('0x5f')](_0x4adc27[_0x7cd9('0x5e')]);if(_0x5944c5&&_0x5944c5['monitor_format']){logger['info']('['+_0x7c261d['lastevent']['toUpperCase']()+']',_0x7cd9('0x4a'));_0x7c261d[_0x7cd9('0x4b')]=util[_0x7cd9('0xc')](_0x7cd9('0x4c'),_0x4adc27[_0x7cd9('0x5e')],_0x7c261d[_0x7cd9('0x4d')],md5(_0x7c261d['uniqueid']));}else{_0x7c261d[_0x7cd9('0x4b')]='';}headers[_0x7cd9('0x4e')]=getAuth(_0x4adc27);return getUser(_0x4adc27)[_0x7cd9('0x1f')](function(_0x2a186f){_0x3ac144=_0x2a186f;logger[_0x7cd9('0x15')](_0x7cd9('0x50'),_0x3ac144['id']);return getEndUser(_0x4adc27,_0x7c261d['calleridname'],_0x7c261d['calleridnum']);})['then'](function(_0x3663db){_0x2adf39=_0x3663db;logger[_0x7cd9('0x15')](_0x7cd9('0x52'),_0x2adf39['id']);return getTicket(_0x4adc27,_0x3ac144,_0x2adf39,_0x899e9a,_0x7c261d);})['then'](function(_0x420d15){if(_0x420d15){logger['info'](_0x7cd9('0x53'),_0x420d15['id']);}})[_0x7cd9('0x6a')](function(_0x4b4c43){logger[_0x7cd9('0x59')]('['+_0x7c261d[_0x7cd9('0x6d')][_0x7cd9('0x6e')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x7cd9('0x5c')](_0x4b4c43,{'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 77129f6..7529aca 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 _0x2227=['unmanaged','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','socket.io-emitter','redis','emit','debug','[HTTP]','stringify','length','forEach','string','picklist','type','idField','content','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','data','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','uri','https://www.zohoapis.','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','connect','Call_Result','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','com','destcalleridname','destcalleridnum','https://crm.'];(function(_0x31ce32,_0x3870a8){var _0x40958b=function(_0x533129){while(--_0x533129){_0x31ce32['push'](_0x31ce32['shift']());}};_0x40958b(++_0x3870a8);}(_0x2227,0x147));var _0x7222=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x2227[_0x4a6cf8];return _0x22205e;};'use strict';var _=require(_0x7222('0x0'));var rp=require(_0x7222('0x1'));var md5=require(_0x7222('0x2'));var util=require('util');var intUtil=require(_0x7222('0x3'));var moment=require(_0x7222('0x4'));var Redis=require(_0x7222('0x5'));var BPromise=require(_0x7222('0x6'));var config=require(_0x7222('0x7'));var logger=require(_0x7222('0x8'))(_0x7222('0x9'));config['redis']=_[_0x7222('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7222('0xb'))(new Redis(config[_0x7222('0xc')]));function emit(_0x1d25ac,_0x23761e,_0x51bbe2){io['to'](_0x1d25ac)[_0x7222('0xd')](_0x23761e,_0x51bbe2);}function request(_0x107d00){logger[_0x7222('0xe')](_0x7222('0xf'),JSON[_0x7222('0x10')](_0x107d00));return rp(_0x107d00);}function getCustomFields(_0x2a240a,_0x1dc31b){var _0x3a1e52={};if(_0x2a240a[_0x7222('0x11')]>0x0){_[_0x7222('0x12')](_0x2a240a,function(_0x238aed){if(_['includes']([_0x7222('0x13'),_0x7222('0x14')],_0x238aed[_0x7222('0x15')])&&_0x238aed[_0x7222('0x16')]){_0x3a1e52[_0x238aed[_0x7222('0x16')]]=_0x238aed[_0x7222('0x17')]['toString']();}else if(_0x238aed[_0x7222('0x15')]==='variable'&&_0x238aed[_0x7222('0x18')]&&_0x238aed[_0x7222('0x16')]&&_0x1dc31b[_0x238aed[_0x7222('0x18')]]){_0x3a1e52[_0x238aed[_0x7222('0x16')]]=_0x1dc31b[_0x238aed[_0x7222('0x18')]][_0x7222('0x19')]();}else if(_0x238aed[_0x7222('0x15')]===_0x7222('0x1a')&&_0x238aed[_0x7222('0x1b')]&&_0x238aed[_0x7222('0x1b')][_0x7222('0x1c')]&&_0x238aed[_0x7222('0x16')]&&_0x1dc31b[_0x238aed[_0x7222('0x1b')]['name'][_0x7222('0x1d')]()]){_0x3a1e52[_0x238aed[_0x7222('0x16')]]=_0x1dc31b[_0x238aed['Variable']['name']['toLowerCase']()]['toString']();}});}return _0x3a1e52;}function getName(_0x151ad3){if(_0x151ad3[_0x7222('0x1e')]('\x20')>0x0){var _0x5b3bae=_0x151ad3[_0x7222('0x1f')](/ (.+)/);if(_0x5b3bae[0x1]){return _0x5b3bae;}}return[_0x151ad3,_0x151ad3];}var accountsTokens={};function getAccessToken(_0x41a30b){return new Promise(function(_0xb0c88c,_0x8a902a){if(!_[_0x7222('0x20')](accountsTokens[_0x41a30b['id']])&&!_[_0x7222('0x20')](accountsTokens[_0x41a30b['id']][_0x7222('0x21')])){if(moment()[_0x7222('0x22')](accountsTokens[_0x41a30b['id']][_0x7222('0x23')])){_0xb0c88c(accountsTokens[_0x41a30b['id']][_0x7222('0x21')]);}}var _0x2c681b;switch(_0x41a30b[_0x7222('0x24')]){case'US':_0x2c681b=_0x7222('0x25');break;case'AU':_0x2c681b=_0x7222('0x26');break;case'EU':_0x2c681b=_0x7222('0x27');break;case'IN':_0x2c681b=_0x7222('0x28');break;case'CN':_0x2c681b=_0x7222('0x29');break;default:_0x2c681b=_0x7222('0x27');break;}var _0x14e8ac={'method':_0x7222('0x2a'),'uri':_0x2c681b+_0x7222('0x2b'),'qs':{'refresh_token':_0x41a30b[_0x7222('0x2c')],'client_id':_0x41a30b[_0x7222('0x2d')],'client_secret':_0x41a30b[_0x7222('0x2e')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x14e8ac)[_0x7222('0x2f')](function(_0x58727c){accountsTokens[_0x41a30b['id']]={'access_token':_0x58727c[_0x7222('0x21')],'expires_in':moment()[_0x7222('0x30')](_0x58727c[_0x7222('0x23')],_0x7222('0x31'))};_0xb0c88c(_0x58727c['access_token']);})[_0x7222('0x32')](function(_0x282170){logger[_0x7222('0x33')](_0x7222('0x34'),_0x282170[_0x7222('0x35')]);_0x8a902a(_0x282170);});});}function getUser(_0x59f145,_0x4f425e,_0x4b0871,_0x5901a5){logger[_0x7222('0x36')]('Search\x20user');return request({'method':_0x7222('0x37'),'uri':util['format'](_0x7222('0x38'),_0x4f425e),'qs':{'type':_0x7222('0x39')},'headers':{'Authorization':_0x7222('0x3a')+_0x59f145},'json':!![]})[_0x7222('0x2f')](function(_0x5c44b7){if(_0x5c44b7[_0x7222('0x3b')]){var _0x3e183d=-0x1;if(_[_0x7222('0x3c')](_0x5c44b7['users'])){if(!_['isNil'](_0x5901a5)){_0x3e183d=_[_0x7222('0x3d')](_0x5c44b7[_0x7222('0x3b')],function(_0x384d54){return _0x384d54[_0x7222('0x3e')]===_0x5901a5;});}if(_0x3e183d>=0x0){logger[_0x7222('0x36')](_0x7222('0x3f'));}else{logger[_0x7222('0x36')](_0x7222('0x40'));_0x3e183d=_['findIndex'](_0x5c44b7[_0x7222('0x3b')],function(_0x55e66c){return _0x55e66c['profile'][_0x7222('0x1c')]===_0x7222('0x41');});}return _0x5c44b7[_0x7222('0x3b')][_0x3e183d];}else{if(_0x5c44b7[_0x7222('0x42')]['profile'][_0x7222('0x1c')]===_0x7222('0x41')){logger[_0x7222('0x36')]('Using\x20the\x20admin\x20account!');user=_0x5c44b7[_0x7222('0x42')];return user;}else{logger[_0x7222('0x33')]('The\x20failing\x20result\x20is',JSON[_0x7222('0x10')](_0x5c44b7));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x5c44b7));}}}else{logger[_0x7222('0x33')](_0x7222('0x43'),JSON[_0x7222('0x10')](_0x5c44b7));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x5c44b7));}})[_0x7222('0x32')](function(_0x496440){console[_0x7222('0x33')](_0x496440);});}function getZohoUser(_0x290282,_0x27d275){return new BPromise(function(_0x1a4e7a,_0x308b5c){request(_0x290282)['then'](function(_0x5c8a14){var _0x121c3d=null;if(_0x5c8a14){_0x121c3d=_0x5c8a14['data'][0x0];_0x121c3d[_0x7222('0x44')]=_0x27d275;}_0x1a4e7a(_0x121c3d);})[_0x7222('0x32')](function(_0x5082e2){_0x308b5c(_0x5082e2);});});}function createEndUser(_0x38e255,_0x3f4b02,_0x493436,_0x48f510,_0x21ead7,_0x4ce9c2){var _0x493436=getName(_0x493436);return request({'method':_0x7222('0x2a'),'uri':'https://www.zohoapis.'+_0x3f4b02+_0x7222('0x45')+_[_0x7222('0x46')](_0x4ce9c2[_0x7222('0x47')])+'s','body':{'data':[{'Last_Name':_0x493436[0x1],'First_Name':_0x493436[0x0],'Phone':_0x48f510,'Owner':{'name':!_[_0x7222('0x20')](_0x21ead7[_0x7222('0x48')][_0x7222('0x1c')])?_0x21ead7[_0x7222('0x48')][_0x7222('0x1c')]:!_[_0x7222('0x20')](_0x21ead7[_0x7222('0x49')])?_0x21ead7[_0x7222('0x49')]+'\x20'+_0x21ead7[_0x7222('0x4a')]:_0x21ead7[_0x7222('0x4a')],'id':_0x21ead7['id']}}]},'headers':{'Authorization':_0x7222('0x3a')+_0x38e255},'json':!![]})['then'](function(_0x4bc385){if(_0x4bc385&&_0x4bc385['data'][0x0][_0x7222('0x4b')]===_0x7222('0x4c')){var _0x5c9b45=_0x4bc385[_0x7222('0x4d')][0x0]['details'];_0x5c9b45[_0x7222('0x44')]=_[_0x7222('0x46')](_0x4ce9c2['moduleCreate'])+'s';return _0x5c9b45;}logger['error'](_0x7222('0x43'),JSON[_0x7222('0x10')](data));throw new Error(_0x7222('0x4e')+JSON[_0x7222('0x10')](data));})[_0x7222('0x32')](function(_0x7175c0){console[_0x7222('0x4f')](_0x7222('0x50'),_0x7175c0);});}function getEndUser(_0x1fb424,_0x533500,_0x49ad5d,_0x36a287,_0x1ea3ec,_0x10f605,_0x2b0815){var _0x52d93c={'method':_0x7222('0x37'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1fb424},'json':!![]};switch(_0x2b0815[_0x7222('0x51')]){case _0x7222('0x52'):_0x52d93c['uri']='https://www.zohoapis.'+_0x533500+_0x7222('0x53')+_0x1ea3ec+'))';return getZohoUser(_0x52d93c,_0x7222('0x54'))[_0x7222('0x2f')](function(_0x341a57){if(_0x341a57)return _0x341a57;_0x52d93c['uri']='https://www.zohoapis.'+_0x533500+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1ea3ec+'))';return getZohoUser(_0x52d93c,_0x7222('0x55'))['then'](function(_0xc9512e){if(_0xc9512e)return _0xc9512e;if(_0x2b0815[_0x7222('0x47')]!=_0x7222('0x56')){return createEndUser(_0x1fb424,_0x533500,_0x36a287,_0x1ea3ec,_0x10f605,_0x2b0815);}else{return{};}});});break;case _0x7222('0x57'):_0x52d93c[_0x7222('0x58')]=_0x7222('0x59')+_0x533500+_0x7222('0x53')+_0x1ea3ec+'))';return getZohoUser(_0x52d93c,'Contacts')[_0x7222('0x2f')](function(_0x4f6af8){if(_0x4f6af8)return _0x4f6af8;if(_0x2b0815[_0x7222('0x47')]!='nothing'){return createEndUser(_0x1fb424,_0x533500,_0x36a287,_0x1ea3ec,_0x10f605,_0x2b0815);}else{return{};}});break;case _0x7222('0x5a'):_0x52d93c[_0x7222('0x58')]=_0x7222('0x59')+_0x533500+_0x7222('0x5b')+_0x1ea3ec+'))';return getZohoUser(_0x52d93c,_0x7222('0x55'))[_0x7222('0x2f')](function(_0x29d27f){if(_0x29d27f)return _0x29d27f;if(_0x2b0815['moduleCreate']!=_0x7222('0x56')){return createEndUser(_0x1fb424,_0x533500,_0x36a287,_0x1ea3ec,_0x10f605,_0x2b0815);}else{return{};}});break;}}function getCall(_0x9e334b,_0x3f736a,_0x476089,_0x2b9969,_0x237292,_0x517b47,_0x4ed6a3,_0x4a8248){logger[_0x7222('0x36')](_0x7222('0x5c'));var _0x46006b={};_0x46006b[_0x7222('0x5d')]={'name':!_[_0x7222('0x20')](_0x2b9969['role'][_0x7222('0x1c')])&&!_[_0x7222('0x20')](_0x2b9969[_0x7222('0x5e')]['name'])&&_0x2b9969[_0x7222('0x5e')][_0x7222('0x1c')]===_0x7222('0x5f')?_0x2b9969[_0x7222('0x48')][_0x7222('0x1c')]:!_[_0x7222('0x20')](_0x2b9969[_0x7222('0x49')])?_0x2b9969[_0x7222('0x49')]+'\x20'+_0x2b9969[_0x7222('0x4a')]:_0x2b9969[_0x7222('0x4a')],'id':_0x2b9969['id']};_0x46006b[_0x7222('0x60')]=intUtil[_0x7222('0x61')](_0x517b47[_0x7222('0x62')],_0x4ed6a3,'\x20');_0x46006b[_0x7222('0x63')]=intUtil[_0x7222('0x61')](_0x517b47[_0x7222('0x64')],_0x4ed6a3,'\x0a');if(_0x237292['enduserType']===_0x7222('0x54')){_0x46006b[_0x7222('0x65')]={'name':!_[_0x7222('0x20')](_0x237292[_0x7222('0x66')])?_0x237292[_0x7222('0x66')]:!_[_0x7222('0x20')](_0x237292[_0x7222('0x67')])?_0x237292[_0x7222('0x67')]+'\x20'+_0x237292[_0x7222('0x68')]:_0x237292[_0x7222('0x68')],'id':_0x237292['id']};}if(_0x237292['enduserType']===_0x7222('0x55')){_0x46006b[_0x7222('0x69')]={'name':!_[_0x7222('0x20')](_0x237292[_0x7222('0x66')])?_0x237292[_0x7222('0x66')]:!_[_0x7222('0x20')](_0x237292[_0x7222('0x67')])?_0x237292['First_Name']+'\x20'+_0x237292[_0x7222('0x68')]:_0x237292['Last_Name'],'id':_0x237292['id']};_0x46006b['$se_module']=_[_0x7222('0x46')](_0x237292['enduserType']);}if(_0x4ed6a3[_0x7222('0x6a')]){_0x46006b[_0x7222('0x6b')]=moment[_0x7222('0x6c')](parseInt(_0x4ed6a3[_0x7222('0x6a')])*0x3e8)[_0x7222('0x6d')](_0x7222('0x6e'));}else if(_0x4ed6a3[_0x7222('0x6f')]&&_0x4ed6a3['endtime']){_0x46006b['Call_Duration']=moment[_0x7222('0x6c')](moment(_0x4ed6a3[_0x7222('0x70')],_0x7222('0x71'))[_0x7222('0x72')](moment(_0x4ed6a3[_0x7222('0x73')],_0x7222('0x71'))))[_0x7222('0x6d')](_0x7222('0x6e'));}switch(_0x4ed6a3[_0x7222('0x74')]){case'called':_0x46006b['Call_Result']='Called';break;case'complete':case _0x7222('0x75'):_0x46006b['Call_Result']='Answered';break;case'rejected':_0x46006b[_0x7222('0x76')]=_0x7222('0x77');break;case'abandoned':_0x46006b[_0x7222('0x76')]=_0x7222('0x78');break;case _0x7222('0x79'):_0x46006b['Call_Result']=_0x7222('0x7a');default:}_0x46006b[_0x7222('0x7b')]=(_0x4a8248===_0x7222('0x7c')?moment(_0x4ed6a3[_0x7222('0x73')])['format'](_0x7222('0x71')):moment(_0x4ed6a3[_0x7222('0x7d')])[_0x7222('0x6d')](_0x7222('0x71')))||moment()[_0x7222('0x6d')](_0x7222('0x71'));_0x46006b[_0x7222('0x7e')]=_0x4a8248||'Inbound';_0x46006b=_[_0x7222('0x7f')](_0x46006b,getCustomFields(_0x517b47[_0x7222('0x80')],_0x4ed6a3));return request({'method':'POST','uri':_0x7222('0x59')+_0x3f736a+_0x7222('0x81'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x9e334b},'body':{'data':[_0x46006b]},'json':!![]})['then'](function(_0x30a848){if(_0x30a848&&_0x30a848[_0x7222('0x4d')][0x0]['code']===_0x7222('0x4c')){logger[_0x7222('0x36')](_0x7222('0x82'));return{'id':_0x30a848[_0x7222('0x4d')][0x0]['details']['id']};}})[_0x7222('0x32')](function(_0x5dc62e){logger[_0x7222('0x36')](_0x7222('0x83'),_0x5dc62e[_0x7222('0x35')]);console['log'](_0x7222('0x83'),_0x5dc62e);});}exports[_0x7222('0x84')]=function(_0x44e5ff,_0x2693cd,_0x73d14d,_0x4844b5,_0x46e60,_0x5d3d32){var _0x47b3f3,_0x154867,_0x52a442;_0x5d3d32[_0x7222('0x85')]=intUtil[_0x7222('0x86')](_0x5d3d32['host']);_0x5d3d32[_0x7222('0x87')]=intUtil['stripTrailingSlash'](_0x5d3d32[_0x7222('0x87')]);if(_0x46e60&&_0x46e60[_0x7222('0x88')]){logger[_0x7222('0x36')](_0x7222('0x89'),_0x7222('0x8a'));_0x2693cd[_0x7222('0x8b')]=_0x5d3d32[_0x7222('0x87')]+'/api/voice/recordings/'+_0x2693cd[_0x7222('0x8c')]+_0x7222('0x8d')+md5(_0x2693cd[_0x7222('0x8c')]);}else{_0x2693cd[_0x7222('0x8b')]='';}var _0x3dce5d=_0x5d3d32[_0x7222('0x85')]===_0x7222('0x8e')?'eu':'com';return getAccessToken(_0x5d3d32)['then'](function(_0x148e4f){_0x52a442=_0x148e4f;return getUser(_0x52a442,_0x3dce5d,_0x5d3d32,_0x4844b5[_0x7222('0x3e')]);})['then'](function(_0x30d806){_0x47b3f3=_0x30d806;logger[_0x7222('0x36')]('The\x20User\x20ID\x20is:',_0x47b3f3['id']);return getEndUser(_0x52a442,_0x3dce5d,_0x5d3d32,_0x2693cd[_0x7222('0x8f')],_0x2693cd[_0x7222('0x90')],_0x47b3f3,_0x73d14d);})[_0x7222('0x2f')](function(_0x3d306c){_0x154867=_0x3d306c;return getCall(_0x52a442,_0x3dce5d,_0x5d3d32,_0x47b3f3,_0x154867,_0x73d14d,_0x2693cd,_0x7222('0x91'));})[_0x7222('0x2f')](function(_0x32c1e5){if(_0x32c1e5){logger['info'](_0x7222('0x92'),_0x32c1e5['id']);logger[_0x7222('0x36')](_0x7222('0x89'),_0x7222('0x93'));emit(util[_0x7222('0x6d')](_0x7222('0x94'),_0x4844b5[_0x7222('0x1c')]),_0x7222('0x95'),{'uri':'https://crm.'+_0x5d3d32[_0x7222('0x85')]+_0x7222('0x96')+_0x32c1e5['id']});}})[_0x7222('0x32')](function(_0xe470e5){logger[_0x7222('0x33')](_0x7222('0x89'),JSON[_0x7222('0x10')](_0xe470e5));});};exports[_0x7222('0x7c')]=function(_0x11d37c,_0x134f6e,_0x357691,_0x3b07a5,_0x3917ee,_0x26a9ac,_0x536d00){var _0x2054e8,_0x950c2,_0x470b19;_0x26a9ac['host']=intUtil['stripTrailingSlash'](_0x26a9ac[_0x7222('0x85')]);_0x26a9ac['serverUrl']=intUtil[_0x7222('0x86')](_0x26a9ac[_0x7222('0x87')]);if(_0x536d00&&_0x536d00[_0x7222('0x97')]&&_0x536d00[_0x7222('0x97')]!==_0x7222('0x98')){logger[_0x7222('0x36')](_0x7222('0x99'),_0x7222('0x8a'));_0x134f6e[_0x7222('0x8b')]=_0x26a9ac[_0x7222('0x87')]+_0x7222('0x9a')+_0x134f6e['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x134f6e[_0x7222('0x8c')]);}var _0x555ef9=_0x26a9ac[_0x7222('0x85')]===_0x7222('0x8e')?'eu':_0x7222('0x9b');return getAccessToken(_0x26a9ac)['then'](function(_0x241ae9){_0x470b19=_0x241ae9;return getUser(_0x470b19,_0x555ef9,_0x26a9ac,_0x3b07a5[_0x7222('0x3e')]);})[_0x7222('0x2f')](function(_0x4b5499){_0x2054e8=_0x4b5499;logger['info']('The\x20User\x20ID\x20is:',_0x2054e8['id']);return getEndUser(_0x470b19,_0x555ef9,_0x26a9ac,_0x134f6e[_0x7222('0x9c')],_0x134f6e[_0x7222('0x9d')],_0x2054e8,_0x357691);})['then'](function(_0x18b98d){_0x950c2=_0x18b98d;return getCall(_0x470b19,_0x555ef9,_0x26a9ac,_0x2054e8,_0x950c2,_0x357691,_0x134f6e,'Outbound');})[_0x7222('0x2f')](function(_0x1cd192){if(_0x1cd192){logger['info'](_0x7222('0x92'),_0x1cd192['id']);logger[_0x7222('0x36')]('[OUTBOUND]',_0x7222('0x93'));emit(util[_0x7222('0x6d')](_0x7222('0x94'),_0x3b07a5[_0x7222('0x1c')]),_0x7222('0x95'),{'uri':_0x7222('0x9e')+_0x26a9ac[_0x7222('0x85')]+_0x7222('0x96')+_0x1cd192['id']});}})[_0x7222('0x32')](function(_0x54e88d){logger[_0x7222('0x33')](_0x7222('0x99'),JSON[_0x7222('0x10')](_0x54e88d));});};exports[_0x7222('0x9f')]=function(_0x28a94e,_0x51b3ce,_0x773760,_0x2ee711,_0x203f84,_0x24b486){var _0xf6d6d6,_0x2e734d,_0x239182;_0x24b486['host']=intUtil[_0x7222('0x86')](_0x24b486[_0x7222('0x85')]);_0x24b486['serverUrl']=intUtil['stripTrailingSlash'](_0x24b486[_0x7222('0x87')]);if(_0x203f84&&_0x203f84['monitor_format']){logger['info']('['+_0x51b3ce[_0x7222('0x74')][_0x7222('0xa0')]()+']','Recording\x20is\x20enabled!');_0x51b3ce['recordingURL']=_0x24b486[_0x7222('0x87')]+_0x7222('0x9a')+_0x51b3ce['uniqueid']+_0x7222('0x8d')+md5(_0x51b3ce['uniqueid']);}else{_0x51b3ce[_0x7222('0x8b')]='';}var _0x305b35=_0x24b486[_0x7222('0x85')]===_0x7222('0x8e')?'eu':_0x7222('0x9b');return getAccessToken(_0x24b486)[_0x7222('0x2f')](function(_0x419b6e){_0x239182=_0x419b6e;return getUser(_0x239182,_0x305b35,_0x24b486);})[_0x7222('0x2f')](function(_0x159df7){_0xf6d6d6=_0x159df7;logger[_0x7222('0x36')](_0x7222('0xa1'),_0xf6d6d6['id']);return getEndUser(_0x239182,_0x305b35,_0x24b486,_0x51b3ce['calleridname'],_0x51b3ce['calleridnum'],_0xf6d6d6,_0x773760);})[_0x7222('0x2f')](function(_0x29e39b){_0x2e734d=_0x29e39b;return getCall(_0x239182,_0x305b35,_0x24b486,_0xf6d6d6,_0x2e734d,_0x773760,_0x51b3ce,_0x7222('0x91'));})[_0x7222('0x2f')](function(_0x14c1ed){if(_0x14c1ed){logger['info']('The\x20Call\x20ID\x20is:',_0x14c1ed['id']);}})[_0x7222('0x32')](function(_0x168192){logger['error']('['+_0x51b3ce[_0x7222('0x74')][_0x7222('0xa0')]()+']',JSON[_0x7222('0x10')](_0x168192));});}; \ No newline at end of file +var _0x94ca=['First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','length','forEach','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','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','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name'];(function(_0x201a9e,_0x4a3cda){var _0x3cabd8=function(_0x2d88a7){while(--_0x2d88a7){_0x201a9e['push'](_0x201a9e['shift']());}};_0x3cabd8(++_0x4a3cda);}(_0x94ca,0xde));var _0xa94c=function(_0x511a19,_0x417e36){_0x511a19=_0x511a19-0x0;var _0x499aa6=_0x94ca[_0x511a19];return _0x499aa6;};'use strict';var _=require(_0xa94c('0x0'));var rp=require(_0xa94c('0x1'));var md5=require(_0xa94c('0x2'));var util=require(_0xa94c('0x3'));var intUtil=require(_0xa94c('0x4'));var moment=require(_0xa94c('0x5'));var Redis=require(_0xa94c('0x6'));var BPromise=require(_0xa94c('0x7'));var config=require(_0xa94c('0x8'));var logger=require(_0xa94c('0x9'))(_0xa94c('0xa'));config[_0xa94c('0xb')]=_[_0xa94c('0xc')](config['redis'],{'host':_0xa94c('0xd'),'port':0x18eb});var io=require(_0xa94c('0xe'))(new Redis(config[_0xa94c('0xb')]));function emit(_0x46f724,_0x579f29,_0x482c02){io['to'](_0x46f724)['emit'](_0x579f29,_0x482c02);}function request(_0x5dcf28){logger[_0xa94c('0xf')](_0xa94c('0x10'),JSON['stringify'](_0x5dcf28));return rp(_0x5dcf28);}function getCustomFields(_0x46fcd3,_0x26a4f3){var _0x2cb23e={};if(_0x46fcd3[_0xa94c('0x11')]>0x0){_[_0xa94c('0x12')](_0x46fcd3,function(_0x1a028d){if(_['includes'](['string','picklist'],_0x1a028d[_0xa94c('0x13')])&&_0x1a028d[_0xa94c('0x14')]){_0x2cb23e[_0x1a028d[_0xa94c('0x14')]]=_0x1a028d[_0xa94c('0x15')][_0xa94c('0x16')]();}else if(_0x1a028d[_0xa94c('0x13')]===_0xa94c('0x17')&&_0x1a028d[_0xa94c('0x18')]&&_0x1a028d[_0xa94c('0x14')]&&_0x26a4f3[_0x1a028d['variableName']]){_0x2cb23e[_0x1a028d[_0xa94c('0x14')]]=_0x26a4f3[_0x1a028d[_0xa94c('0x18')]][_0xa94c('0x16')]();}else if(_0x1a028d[_0xa94c('0x13')]==='customVariable'&&_0x1a028d[_0xa94c('0x19')]&&_0x1a028d[_0xa94c('0x19')][_0xa94c('0x1a')]&&_0x1a028d[_0xa94c('0x14')]&&_0x26a4f3[_0x1a028d['Variable']['name'][_0xa94c('0x1b')]()]){_0x2cb23e[_0x1a028d[_0xa94c('0x14')]]=_0x26a4f3[_0x1a028d['Variable'][_0xa94c('0x1a')][_0xa94c('0x1b')]()][_0xa94c('0x16')]();}});}return _0x2cb23e;}function getName(_0x37bb37){if(_0x37bb37[_0xa94c('0x1c')]('\x20')>0x0){var _0x351faa=_0x37bb37[_0xa94c('0x1d')](/ (.+)/);if(_0x351faa[0x1]){return _0x351faa;}}return[_0x37bb37,_0x37bb37];}var accountsTokens={};function getAccessToken(_0x3b925c){return new Promise(function(_0x26d61d,_0xbac76b){if(!_[_0xa94c('0x1e')](accountsTokens[_0x3b925c['id']])&&!_[_0xa94c('0x1e')](accountsTokens[_0x3b925c['id']][_0xa94c('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x3b925c['id']]['expires_in'])){_0x26d61d(accountsTokens[_0x3b925c['id']]['access_token']);}}var _0x4c1ac4;switch(_0x3b925c[_0xa94c('0x20')]){case'US':_0x4c1ac4=_0xa94c('0x21');break;case'AU':_0x4c1ac4=_0xa94c('0x22');break;case'EU':_0x4c1ac4='https://accounts.zoho.eu';break;case'IN':_0x4c1ac4=_0xa94c('0x23');break;case'CN':_0x4c1ac4=_0xa94c('0x24');break;default:_0x4c1ac4=_0xa94c('0x25');break;}var _0x48c9bd={'method':'POST','uri':_0x4c1ac4+_0xa94c('0x26'),'qs':{'refresh_token':_0x3b925c[_0xa94c('0x27')],'client_id':_0x3b925c[_0xa94c('0x28')],'client_secret':_0x3b925c[_0xa94c('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x48c9bd)[_0xa94c('0x2a')](function(_0x437e92){accountsTokens[_0x3b925c['id']]={'access_token':_0x437e92[_0xa94c('0x1f')],'expires_in':moment()[_0xa94c('0x2b')](_0x437e92['expires_in'],_0xa94c('0x2c'))};_0x26d61d(_0x437e92[_0xa94c('0x1f')]);})[_0xa94c('0x2d')](function(_0x58e079){logger[_0xa94c('0x2e')](_0xa94c('0x2f'),_0x58e079[_0xa94c('0x30')]);_0xbac76b(_0x58e079);});});}function getUser(_0x3c8ba2,_0x398e39,_0x9a36c3,_0x4b2b7e){logger[_0xa94c('0x31')](_0xa94c('0x32'));return request({'method':_0xa94c('0x33'),'uri':util[_0xa94c('0x34')]('https://www.zohoapis.%s/crm/v2/users',_0x398e39),'qs':{'type':_0xa94c('0x35')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3c8ba2},'json':!![]})[_0xa94c('0x2a')](function(_0x5acf0a){if(_0x5acf0a[_0xa94c('0x36')]){var _0x2f9edc=-0x1;if(_[_0xa94c('0x37')](_0x5acf0a[_0xa94c('0x36')])){if(!_[_0xa94c('0x1e')](_0x4b2b7e)){_0x2f9edc=_['findIndex'](_0x5acf0a[_0xa94c('0x36')],function(_0x4da282){return _0x4da282[_0xa94c('0x38')]===_0x4b2b7e;});}if(_0x2f9edc>=0x0){logger[_0xa94c('0x31')](_0xa94c('0x39'));}else{logger['info'](_0xa94c('0x3a'));_0x2f9edc=_[_0xa94c('0x3b')](_0x5acf0a[_0xa94c('0x36')],function(_0x3457a0){return _0x3457a0[_0xa94c('0x3c')][_0xa94c('0x1a')]===_0xa94c('0x3d');});}return _0x5acf0a[_0xa94c('0x36')][_0x2f9edc];}else{if(_0x5acf0a[_0xa94c('0x3e')][_0xa94c('0x3c')][_0xa94c('0x1a')]===_0xa94c('0x3d')){logger[_0xa94c('0x31')](_0xa94c('0x3a'));user=_0x5acf0a[_0xa94c('0x3e')];return user;}else{logger[_0xa94c('0x2e')](_0xa94c('0x3f'),JSON[_0xa94c('0x40')](_0x5acf0a));throw new Error(_0xa94c('0x41')+JSON[_0xa94c('0x40')](_0x5acf0a));}}}else{logger[_0xa94c('0x2e')]('The\x20failing\x20result\x20is',JSON[_0xa94c('0x40')](_0x5acf0a));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x5acf0a));}})[_0xa94c('0x2d')](function(_0x1f6d2b){console[_0xa94c('0x2e')](_0x1f6d2b);});}function getZohoUser(_0x562cf8,_0x13771b){return new BPromise(function(_0x511f65,_0x577153){request(_0x562cf8)[_0xa94c('0x2a')](function(_0x5a0769){var _0xfe5c5d=null;if(_0x5a0769){_0xfe5c5d=_0x5a0769[_0xa94c('0x42')][0x0];_0xfe5c5d[_0xa94c('0x43')]=_0x13771b;}_0x511f65(_0xfe5c5d);})[_0xa94c('0x2d')](function(_0x204919){_0x577153(_0x204919);});});}function createEndUser(_0x727d1c,_0x16c909,_0x16a838,_0x12f182,_0x44385f,_0x293adc){var _0x16a838=getName(_0x16a838);return request({'method':_0xa94c('0x44'),'uri':_0xa94c('0x45')+_0x16c909+_0xa94c('0x46')+_[_0xa94c('0x47')](_0x293adc[_0xa94c('0x48')])+'s','body':{'data':[{'Last_Name':_0x16a838[0x1],'First_Name':_0x16a838[0x0],'Phone':_0x12f182,'Owner':{'name':!_[_0xa94c('0x1e')](_0x44385f[_0xa94c('0x49')][_0xa94c('0x1a')])?_0x44385f['role'][_0xa94c('0x1a')]:!_['isNil'](_0x44385f[_0xa94c('0x4a')])?_0x44385f[_0xa94c('0x4a')]+'\x20'+_0x44385f[_0xa94c('0x4b')]:_0x44385f['last_name'],'id':_0x44385f['id']}}]},'headers':{'Authorization':_0xa94c('0x4c')+_0x727d1c},'json':!![]})['then'](function(_0x4f1214){if(_0x4f1214&&_0x4f1214[_0xa94c('0x42')][0x0]['code']===_0xa94c('0x4d')){var _0x157b9d=_0x4f1214[_0xa94c('0x42')][0x0][_0xa94c('0x4e')];_0x157b9d[_0xa94c('0x43')]=_[_0xa94c('0x47')](_0x293adc[_0xa94c('0x48')])+'s';return _0x157b9d;}logger[_0xa94c('0x2e')](_0xa94c('0x3f'),JSON['stringify'](data));throw new Error(_0xa94c('0x4f')+JSON['stringify'](data));})['catch'](function(_0x4caa6a){console[_0xa94c('0x50')](_0xa94c('0x51'),_0x4caa6a);});}function getEndUser(_0x127ebf,_0x3b5c91,_0x544cf2,_0x1b1fd4,_0xb8e33a,_0x363d26,_0xe9db61){var _0x97047d={'method':_0xa94c('0x33'),'uri':'','headers':{'Authorization':_0xa94c('0x4c')+_0x127ebf},'json':!![]};switch(_0xe9db61['moduleSearch']){case _0xa94c('0x52'):_0x97047d[_0xa94c('0x53')]=_0xa94c('0x45')+_0x3b5c91+_0xa94c('0x54')+_0xb8e33a+'))';return getZohoUser(_0x97047d,_0xa94c('0x55'))[_0xa94c('0x2a')](function(_0x3257e6){if(_0x3257e6)return _0x3257e6;_0x97047d['uri']=_0xa94c('0x45')+_0x3b5c91+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xb8e33a+'))';return getZohoUser(_0x97047d,'Leads')[_0xa94c('0x2a')](function(_0x1f33e6){if(_0x1f33e6)return _0x1f33e6;if(_0xe9db61[_0xa94c('0x48')]!=_0xa94c('0x56')){return createEndUser(_0x127ebf,_0x3b5c91,_0x1b1fd4,_0xb8e33a,_0x363d26,_0xe9db61);}else{return{};}});});break;case _0xa94c('0x57'):_0x97047d['uri']=_0xa94c('0x45')+_0x3b5c91+_0xa94c('0x54')+_0xb8e33a+'))';return getZohoUser(_0x97047d,_0xa94c('0x55'))['then'](function(_0x406ce2){if(_0x406ce2)return _0x406ce2;if(_0xe9db61[_0xa94c('0x48')]!=_0xa94c('0x56')){return createEndUser(_0x127ebf,_0x3b5c91,_0x1b1fd4,_0xb8e33a,_0x363d26,_0xe9db61);}else{return{};}});break;case _0xa94c('0x58'):_0x97047d[_0xa94c('0x53')]=_0xa94c('0x45')+_0x3b5c91+_0xa94c('0x59')+_0xb8e33a+'))';return getZohoUser(_0x97047d,_0xa94c('0x5a'))[_0xa94c('0x2a')](function(_0x20b522){if(_0x20b522)return _0x20b522;if(_0xe9db61[_0xa94c('0x48')]!=_0xa94c('0x56')){return createEndUser(_0x127ebf,_0x3b5c91,_0x1b1fd4,_0xb8e33a,_0x363d26,_0xe9db61);}else{return{};}});break;}}function getCall(_0x22378d,_0x1af1f9,_0x40cf97,_0xb05071,_0x44a2dd,_0x59d145,_0x3b6ca4,_0x4b2ac9){logger[_0xa94c('0x31')]('Creating\x20new\x20call...');var _0xa16dba={};_0xa16dba[_0xa94c('0x5b')]={'name':!_[_0xa94c('0x1e')](_0xb05071['role'][_0xa94c('0x1a')])&&!_[_0xa94c('0x1e')](_0xb05071['profile']['name'])&&_0xb05071[_0xa94c('0x3c')][_0xa94c('0x1a')]===_0xa94c('0x5c')?_0xb05071[_0xa94c('0x49')][_0xa94c('0x1a')]:!_[_0xa94c('0x1e')](_0xb05071[_0xa94c('0x4a')])?_0xb05071['first_name']+'\x20'+_0xb05071['last_name']:_0xb05071[_0xa94c('0x4b')],'id':_0xb05071['id']};_0xa16dba[_0xa94c('0x5d')]=intUtil[_0xa94c('0x5e')](_0x59d145[_0xa94c('0x5f')],_0x3b6ca4,'\x20');_0xa16dba[_0xa94c('0x60')]=intUtil[_0xa94c('0x5e')](_0x59d145[_0xa94c('0x61')],_0x3b6ca4,'\x0a');if(_0x44a2dd[_0xa94c('0x43')]===_0xa94c('0x55')){_0xa16dba[_0xa94c('0x62')]={'name':!_[_0xa94c('0x1e')](_0x44a2dd[_0xa94c('0x63')])?_0x44a2dd[_0xa94c('0x63')]:!_[_0xa94c('0x1e')](_0x44a2dd[_0xa94c('0x64')])?_0x44a2dd[_0xa94c('0x64')]+'\x20'+_0x44a2dd[_0xa94c('0x65')]:_0x44a2dd[_0xa94c('0x65')],'id':_0x44a2dd['id']};}if(_0x44a2dd[_0xa94c('0x43')]==='Leads'){_0xa16dba[_0xa94c('0x66')]={'name':!_['isNil'](_0x44a2dd[_0xa94c('0x63')])?_0x44a2dd['Full_Name']:!_[_0xa94c('0x1e')](_0x44a2dd[_0xa94c('0x64')])?_0x44a2dd[_0xa94c('0x64')]+'\x20'+_0x44a2dd[_0xa94c('0x65')]:_0x44a2dd[_0xa94c('0x65')],'id':_0x44a2dd['id']};_0xa16dba[_0xa94c('0x67')]=_[_0xa94c('0x47')](_0x44a2dd[_0xa94c('0x43')]);}if(_0x3b6ca4['talktime']){_0xa16dba[_0xa94c('0x68')]=moment[_0xa94c('0x69')](parseInt(_0x3b6ca4[_0xa94c('0x6a')])*0x3e8)['format'](_0xa94c('0x6b'));}else if(_0x3b6ca4[_0xa94c('0x6c')]&&_0x3b6ca4[_0xa94c('0x6d')]){_0xa16dba[_0xa94c('0x68')]=moment[_0xa94c('0x69')](moment(_0x3b6ca4[_0xa94c('0x6d')],_0xa94c('0x6e'))[_0xa94c('0x6f')](moment(_0x3b6ca4[_0xa94c('0x70')],_0xa94c('0x6e'))))['format'](_0xa94c('0x6b'));}switch(_0x3b6ca4[_0xa94c('0x71')]){case _0xa94c('0x72'):_0xa16dba[_0xa94c('0x73')]=_0xa94c('0x74');break;case _0xa94c('0x75'):case _0xa94c('0x76'):_0xa16dba[_0xa94c('0x73')]=_0xa94c('0x77');break;case _0xa94c('0x78'):_0xa16dba['Call_Result']=_0xa94c('0x79');break;case'abandoned':_0xa16dba[_0xa94c('0x73')]=_0xa94c('0x7a');break;case _0xa94c('0x7b'):_0xa16dba[_0xa94c('0x73')]=_0xa94c('0x7c');default:}_0xa16dba[_0xa94c('0x7d')]=(_0x4b2ac9===_0xa94c('0x7e')?moment(_0x3b6ca4[_0xa94c('0x70')])[_0xa94c('0x34')](_0xa94c('0x6e')):moment(_0x3b6ca4[_0xa94c('0x7f')])[_0xa94c('0x34')](_0xa94c('0x6e')))||moment()[_0xa94c('0x34')](_0xa94c('0x6e'));_0xa16dba[_0xa94c('0x80')]=_0x4b2ac9||_0xa94c('0x81');_0xa16dba=_[_0xa94c('0x82')](_0xa16dba,getCustomFields(_0x59d145['Fields'],_0x3b6ca4));return request({'method':_0xa94c('0x44'),'uri':_0xa94c('0x45')+_0x1af1f9+_0xa94c('0x83'),'headers':{'Authorization':_0xa94c('0x4c')+_0x22378d},'body':{'data':[_0xa16dba]},'json':!![]})[_0xa94c('0x2a')](function(_0x362415){if(_0x362415&&_0x362415[_0xa94c('0x42')][0x0]['code']==='SUCCESS'){logger[_0xa94c('0x31')](_0xa94c('0x84'));return{'id':_0x362415[_0xa94c('0x42')][0x0][_0xa94c('0x4e')]['id']};}})[_0xa94c('0x2d')](function(_0x107338){logger[_0xa94c('0x31')](_0xa94c('0x85'),_0x107338[_0xa94c('0x30')]);console['log']('err',_0x107338);});}exports['queue']=function(_0xb47e5f,_0x58a631,_0x44a8f9,_0x3acfdc,_0x1c3c2d,_0x42c243){var _0x190e1d,_0x5bc199,_0x1d38a9;_0x42c243[_0xa94c('0x86')]=intUtil[_0xa94c('0x87')](_0x42c243[_0xa94c('0x86')]);_0x42c243[_0xa94c('0x88')]=intUtil[_0xa94c('0x87')](_0x42c243[_0xa94c('0x88')]);if(_0x1c3c2d&&_0x1c3c2d[_0xa94c('0x89')]){logger[_0xa94c('0x31')](_0xa94c('0x8a'),'Recording\x20is\x20enabled!');_0x58a631[_0xa94c('0x8b')]=_0x42c243[_0xa94c('0x88')]+_0xa94c('0x8c')+_0x58a631[_0xa94c('0x8d')]+'/downloads?type=uniqueid&token='+md5(_0x58a631[_0xa94c('0x8d')]);}else{_0x58a631[_0xa94c('0x8b')]='';}var _0x7a5ad0=_0x42c243[_0xa94c('0x86')]===_0xa94c('0x8e')?'eu':_0xa94c('0x8f');return getAccessToken(_0x42c243)[_0xa94c('0x2a')](function(_0x461e36){_0x1d38a9=_0x461e36;return getUser(_0x1d38a9,_0x7a5ad0,_0x42c243,_0x3acfdc['email']);})['then'](function(_0x1e4f22){_0x190e1d=_0x1e4f22;logger[_0xa94c('0x31')](_0xa94c('0x90'),_0x190e1d['id']);return getEndUser(_0x1d38a9,_0x7a5ad0,_0x42c243,_0x58a631[_0xa94c('0x91')],_0x58a631[_0xa94c('0x92')],_0x190e1d,_0x44a8f9);})[_0xa94c('0x2a')](function(_0x5c18ca){_0x5bc199=_0x5c18ca;return getCall(_0x1d38a9,_0x7a5ad0,_0x42c243,_0x190e1d,_0x5bc199,_0x44a8f9,_0x58a631,_0xa94c('0x81'));})[_0xa94c('0x2a')](function(_0xd9c004){if(_0xd9c004){logger[_0xa94c('0x31')](_0xa94c('0x93'),_0xd9c004['id']);logger[_0xa94c('0x31')](_0xa94c('0x8a'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa94c('0x34')](_0xa94c('0x94'),_0x3acfdc['name']),_0xa94c('0x95'),{'uri':_0xa94c('0x96')+_0x42c243['host']+_0xa94c('0x97')+_0xd9c004['id']});}})[_0xa94c('0x2d')](function(_0x257877){logger['error'](_0xa94c('0x8a'),JSON[_0xa94c('0x40')](_0x257877));});};exports[_0xa94c('0x7e')]=function(_0x2300d6,_0x136991,_0x178c8d,_0x4c82e1,_0x2ba9f7,_0x493228,_0x5c6779){var _0xc628b4,_0x1faad7,_0x3153e7;_0x493228[_0xa94c('0x86')]=intUtil[_0xa94c('0x87')](_0x493228[_0xa94c('0x86')]);_0x493228[_0xa94c('0x88')]=intUtil[_0xa94c('0x87')](_0x493228[_0xa94c('0x88')]);if(_0x5c6779&&_0x5c6779['recordingFormat']&&_0x5c6779['recordingFormat']!=='none'){logger[_0xa94c('0x31')]('[OUTBOUND]',_0xa94c('0x98'));_0x136991[_0xa94c('0x8b')]=_0x493228[_0xa94c('0x88')]+'/api/voice/recordings/'+_0x136991[_0xa94c('0x8d')]+_0xa94c('0x99')+md5(_0x136991[_0xa94c('0x8d')]);}var _0x3cfa13=_0x493228[_0xa94c('0x86')]===_0xa94c('0x8e')?'eu':_0xa94c('0x8f');return getAccessToken(_0x493228)[_0xa94c('0x2a')](function(_0x551cdf){_0x3153e7=_0x551cdf;return getUser(_0x3153e7,_0x3cfa13,_0x493228,_0x4c82e1[_0xa94c('0x38')]);})[_0xa94c('0x2a')](function(_0x13dcd3){_0xc628b4=_0x13dcd3;logger['info'](_0xa94c('0x90'),_0xc628b4['id']);return getEndUser(_0x3153e7,_0x3cfa13,_0x493228,_0x136991[_0xa94c('0x9a')],_0x136991[_0xa94c('0x9b')],_0xc628b4,_0x178c8d);})[_0xa94c('0x2a')](function(_0x5ac905){_0x1faad7=_0x5ac905;return getCall(_0x3153e7,_0x3cfa13,_0x493228,_0xc628b4,_0x1faad7,_0x178c8d,_0x136991,_0xa94c('0x9c'));})[_0xa94c('0x2a')](function(_0x1e8ed8){if(_0x1e8ed8){logger[_0xa94c('0x31')](_0xa94c('0x93'),_0x1e8ed8['id']);logger[_0xa94c('0x31')](_0xa94c('0x9d'),_0xa94c('0x9e'));emit(util['format'](_0xa94c('0x94'),_0x4c82e1['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x493228[_0xa94c('0x86')]+_0xa94c('0x97')+_0x1e8ed8['id']});}})[_0xa94c('0x2d')](function(_0x5bf94c){logger[_0xa94c('0x2e')](_0xa94c('0x9d'),JSON[_0xa94c('0x40')](_0x5bf94c));});};exports[_0xa94c('0x9f')]=function(_0x1ae7a4,_0x4bdc0d,_0x40b714,_0x54632e,_0x5bae60,_0x462a6d){var _0x356801,_0x3514b7,_0x572579;_0x462a6d[_0xa94c('0x86')]=intUtil[_0xa94c('0x87')](_0x462a6d[_0xa94c('0x86')]);_0x462a6d[_0xa94c('0x88')]=intUtil[_0xa94c('0x87')](_0x462a6d[_0xa94c('0x88')]);if(_0x5bae60&&_0x5bae60[_0xa94c('0x89')]){logger[_0xa94c('0x31')]('['+_0x4bdc0d[_0xa94c('0x71')][_0xa94c('0xa0')]()+']',_0xa94c('0x98'));_0x4bdc0d[_0xa94c('0x8b')]=_0x462a6d[_0xa94c('0x88')]+_0xa94c('0x8c')+_0x4bdc0d[_0xa94c('0x8d')]+_0xa94c('0x99')+md5(_0x4bdc0d[_0xa94c('0x8d')]);}else{_0x4bdc0d[_0xa94c('0x8b')]='';}var _0x1b36c0=_0x462a6d[_0xa94c('0x86')]===_0xa94c('0x8e')?'eu':_0xa94c('0x8f');return getAccessToken(_0x462a6d)[_0xa94c('0x2a')](function(_0x5d394a){_0x572579=_0x5d394a;return getUser(_0x572579,_0x1b36c0,_0x462a6d);})['then'](function(_0x31ca30){_0x356801=_0x31ca30;logger[_0xa94c('0x31')](_0xa94c('0x90'),_0x356801['id']);return getEndUser(_0x572579,_0x1b36c0,_0x462a6d,_0x4bdc0d[_0xa94c('0x91')],_0x4bdc0d[_0xa94c('0x92')],_0x356801,_0x40b714);})[_0xa94c('0x2a')](function(_0x58b41c){_0x3514b7=_0x58b41c;return getCall(_0x572579,_0x1b36c0,_0x462a6d,_0x356801,_0x3514b7,_0x40b714,_0x4bdc0d,_0xa94c('0x81'));})['then'](function(_0x57848b){if(_0x57848b){logger[_0xa94c('0x31')](_0xa94c('0x93'),_0x57848b['id']);}})['catch'](function(_0x308207){logger[_0xa94c('0x2e')]('['+_0x4bdc0d[_0xa94c('0x71')][_0xa94c('0xa0')]()+']',JSON[_0xa94c('0x40')](_0x308207));});}; \ 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 194f91f..bbcf055 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 _0x37c9=['exec','data2','Script','data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','../../../../config/logger','trigger'];(function(_0x5a58bf,_0x352834){var _0x125bb1=function(_0x1f0053){while(--_0x1f0053){_0x5a58bf['push'](_0x5a58bf['shift']());}};_0x125bb1(++_0x352834);}(_0x37c9,0xfa));var _0x937c=function(_0x258c8d,_0x22914e){_0x258c8d=_0x258c8d-0x0;var _0x56a690=_0x37c9[_0x258c8d];return _0x56a690;};'use strict';var util=require('util');var sh=require(_0x937c('0x0'));var Mustache=require('mustache');var logger=require(_0x937c('0x1'))(_0x937c('0x2'));exports[_0x937c('0x3')]=function(_0x353d0b,_0x12ac4e){var _0xe339f5=_0x353d0b[_0x937c('0x4')]?_0x353d0b[_0x937c('0x4')]:_0x937c('0x5');var _0x1a9010=_0x353d0b[_0x937c('0x6')]?Mustache[_0x937c('0x7')](_0x353d0b[_0x937c('0x6')],_0x12ac4e):_0x12ac4e;sh[_0x937c('0x3')](_0x1a9010,function(_0x2469f5,_0x5be9c0,_0x5a8106){if(_0x2469f5!==0x0){logger['error'](util[_0x937c('0x8')](_0x937c('0x9'),_0xe339f5,_0x1a9010,_0x2469f5,_0x5a8106));}else{logger['info'](util['format'](_0x937c('0xa'),_0xe339f5,_0x1a9010,_0x5be9c0));}});}; \ No newline at end of file +var _0x32d9=['util','shelljs','trigger','exec','data2','Script','data3','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x131435,_0x33131d){var _0x5a3081=function(_0x49466a){while(--_0x49466a){_0x131435['push'](_0x131435['shift']());}};_0x5a3081(++_0x33131d);}(_0x32d9,0x18c));var _0x932d=function(_0x526d8c,_0xd26737){_0x526d8c=_0x526d8c-0x0;var _0x4934d1=_0x32d9[_0x526d8c];return _0x4934d1;};'use strict';var util=require(_0x932d('0x0'));var sh=require(_0x932d('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x932d('0x2'));exports[_0x932d('0x3')]=function(_0x549ccb,_0x5e3fc8){var _0x59653a=_0x549ccb[_0x932d('0x4')]?_0x549ccb[_0x932d('0x4')]:_0x932d('0x5');var _0xd0373a=_0x549ccb[_0x932d('0x6')]?Mustache['render'](_0x549ccb[_0x932d('0x6')],_0x5e3fc8):_0x5e3fc8;sh[_0x932d('0x3')](_0xd0373a,function(_0x8e19ef,_0x3da8aa,_0x9c0963){if(_0x8e19ef!==0x0){logger['error'](util[_0x932d('0x7')](_0x932d('0x8'),_0x59653a,_0xd0373a,_0x8e19ef,_0x9c0963));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x59653a,_0xd0373a,_0x3da8aa));}});}; \ 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 29742b3..57e9955 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 _0x8e25=['data1','stringify','then','isNil',',\x20request\x20body:\x20','body','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','toUpperCase','data2','data5','number','headers','data6','parse','render','error','GET','DELETE','POST','PUT','data7','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x8e25,0x17e));var _0x58e2=function(_0x222474,_0x15e5d2){_0x222474=_0x222474-0x0;var _0x15eec7=_0x8e25[_0x222474];return _0x15eec7;};'use strict';var rp=require(_0x58e2('0x0'));var util=require(_0x58e2('0x1'));var _=require(_0x58e2('0x2'));var Mustache=require(_0x58e2('0x3'));var logger=require(_0x58e2('0x4'))(_0x58e2('0x5'));exports['exec']=function(_0x2bb27a,_0x5dde17){var _0x428c33,_0x49dadb;var _0x1c82e7={'method':_0x2bb27a['data1'][_0x58e2('0x6')](),'uri':Mustache['render'](_0x2bb27a[_0x58e2('0x7')],_0x5dde17),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2bb27a[_0x58e2('0x8')])===_0x58e2('0x9')&&parseInt(_0x2bb27a[_0x58e2('0x8')])>=0x1&&parseInt(_0x2bb27a[_0x58e2('0x8')])<=0xa?parseInt(_0x2bb27a['data5'])*0x3e8:0x5*0x3e8};try{_0x1c82e7[_0x58e2('0xa')]=_0x2bb27a[_0x58e2('0xb')]?JSON[_0x58e2('0xc')](Mustache[_0x58e2('0xd')](_0x2bb27a['data6'],_0x5dde17)):{};}catch(_0x67c915){logger[_0x58e2('0xe')](_0x67c915['stack']);}switch(_0x2bb27a['data1'][_0x58e2('0x6')]()){case _0x58e2('0xf'):case _0x58e2('0x10'):_0x428c33=null;_0x1c82e7['qs']=_0x5dde17;break;case _0x58e2('0x11'):case _0x58e2('0x12'):if(_0x2bb27a['data7']){try{_0x428c33=JSON[_0x58e2('0xc')](Mustache[_0x58e2('0xd')](_0x2bb27a[_0x58e2('0x13')],_0x5dde17));_0x1c82e7['body']=_0x428c33;}catch(_0x836257){logger[_0x58e2('0xe')](_0x836257[_0x58e2('0x14')]);logger[_0x58e2('0xe')](_0x58e2('0x15'));}}else{_0x428c33=_0x5dde17;_0x1c82e7['body']=_0x428c33;}break;}logger[_0x58e2('0x16')](util[_0x58e2('0x17')](_0x58e2('0x18'),_0x2bb27a[_0x58e2('0x19')],_0x2bb27a[_0x58e2('0x7')],JSON[_0x58e2('0x1a')](_0x1c82e7)));rp(_0x1c82e7)[_0x58e2('0x1b')](function(_0x510c53){_0x428c33=!_[_0x58e2('0x1c')](_0x428c33)?_0x58e2('0x1d')+_0x428c33:'';_0x49dadb=typeof _0x510c53['body']==='object'?JSON[_0x58e2('0x1a')](_0x510c53[_0x58e2('0x1e')]):_0x510c53['body'];logger[_0x58e2('0x16')](util['format'](_0x58e2('0x1f'),_0x2bb27a[_0x58e2('0x19')],_0x2bb27a[_0x58e2('0x7')],_0x510c53[_0x58e2('0x20')],_0x49dadb));})[_0x58e2('0x21')](function(_0x83015f){logger['error'](util['format'](_0x58e2('0x22'),_0x2bb27a[_0x58e2('0x19')],_0x2bb27a['data2'],_0x83015f['statusCode'],_0x83015f[_0x58e2('0x23')],_0x83015f[_0x58e2('0x24')]));});}; \ No newline at end of file +var _0x3ab9=['format','%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','request-promise','mustache','../../../../config/logger','trigger','exec','render','data5','headers','data6','error','stack','data1','GET','POST','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then','isNil',',\x20request\x20body:\x20','object','stringify'];(function(_0x48a40e,_0x3e4b89){var _0x5c0cce=function(_0x39fe1f){while(--_0x39fe1f){_0x48a40e['push'](_0x48a40e['shift']());}};_0x5c0cce(++_0x3e4b89);}(_0x3ab9,0xa6));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x93ab('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0x93ab('0x1'));var logger=require(_0x93ab('0x2'))(_0x93ab('0x3'));exports[_0x93ab('0x4')]=function(_0x196fb4,_0x5b1d75){var _0x34ae7c,_0x45fc55;var _0x26f220={'method':_0x196fb4['data1']['toUpperCase'](),'uri':Mustache[_0x93ab('0x5')](_0x196fb4['data2'],_0x5b1d75),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x196fb4[_0x93ab('0x6')])==='number'&&parseInt(_0x196fb4[_0x93ab('0x6')])>=0x1&&parseInt(_0x196fb4[_0x93ab('0x6')])<=0xa?parseInt(_0x196fb4['data5'])*0x3e8:0x5*0x3e8};try{_0x26f220[_0x93ab('0x7')]=_0x196fb4['data6']?JSON['parse'](Mustache[_0x93ab('0x5')](_0x196fb4[_0x93ab('0x8')],_0x5b1d75)):{};}catch(_0x5a437e){logger[_0x93ab('0x9')](_0x5a437e[_0x93ab('0xa')]);}switch(_0x196fb4[_0x93ab('0xb')]['toUpperCase']()){case _0x93ab('0xc'):case'DELETE':_0x34ae7c=null;_0x26f220['qs']=_0x5b1d75;break;case _0x93ab('0xd'):case'PUT':if(_0x196fb4[_0x93ab('0xe')]){try{_0x34ae7c=JSON[_0x93ab('0xf')](Mustache['render'](_0x196fb4[_0x93ab('0xe')],_0x5b1d75));_0x26f220[_0x93ab('0x10')]=_0x34ae7c;}catch(_0x551a3e){logger[_0x93ab('0x9')](_0x551a3e['stack']);logger[_0x93ab('0x9')](_0x93ab('0x11'));}}else{_0x34ae7c=_0x5b1d75;_0x26f220[_0x93ab('0x10')]=_0x34ae7c;}break;}logger[_0x93ab('0x12')](util['format'](_0x93ab('0x13'),_0x196fb4[_0x93ab('0xb')],_0x196fb4[_0x93ab('0x14')],JSON['stringify'](_0x26f220)));rp(_0x26f220)[_0x93ab('0x15')](function(_0x5c68a7){_0x34ae7c=!_[_0x93ab('0x16')](_0x34ae7c)?_0x93ab('0x17')+_0x34ae7c:'';_0x45fc55=typeof _0x5c68a7['body']===_0x93ab('0x18')?JSON[_0x93ab('0x19')](_0x5c68a7[_0x93ab('0x10')]):_0x5c68a7[_0x93ab('0x10')];logger['info'](util[_0x93ab('0x1a')](_0x93ab('0x1b'),_0x196fb4[_0x93ab('0xb')],_0x196fb4[_0x93ab('0x14')],_0x5c68a7[_0x93ab('0x1c')],_0x45fc55));})[_0x93ab('0x1d')](function(_0x3f77df){logger[_0x93ab('0x9')](util[_0x93ab('0x1a')](_0x93ab('0x1e'),_0x196fb4[_0x93ab('0xb')],_0x196fb4[_0x93ab('0x14')],_0x3f77df['statusCode'],_0x3f77df[_0x93ab('0x1f')],_0x3f77df['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c91e204..aeebbcb 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 _0xec17=['bluebird','../../config/logger','http','Request','request','debug','rpc','routing','error','message','result','catch','exports','jayson/promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xec17,0x187));var _0x7ec1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xec17[_0x40a045];return _0x1a687c;};'use strict';var jayson=require(_0x7ec1('0x0'));var BPromise=require(_0x7ec1('0x1'));var logger=require(_0x7ec1('0x2'))('routing');var client=jayson['client'][_0x7ec1('0x3')]({'port':0x2329});client[_0x7ec1('0x4')]=function(_0x4a3aef,_0x33db95){return new BPromise(function(_0x3e4fa3,_0xcad530){return client[_0x7ec1('0x5')](_0x4a3aef,_0x33db95)['then'](function(_0xc5b2f3){logger[_0x7ec1('0x6')](_0x7ec1('0x7'),_0x7ec1('0x8'),_0x4a3aef,_0x33db95,_0xc5b2f3);if(_0xc5b2f3[_0x7ec1('0x9')]){logger[_0x7ec1('0x9')](_0x7ec1('0x7'),'routing',_0x4a3aef,_0xc5b2f3[_0x7ec1('0x9')][_0x7ec1('0xa')],_0x33db95);return _0xcad530(_0xc5b2f3[_0x7ec1('0x9')][_0x7ec1('0xa')]);}else{return _0x3e4fa3(_0xc5b2f3[_0x7ec1('0xb')]);}})[_0x7ec1('0xc')](function(_0x3a989c){logger['error'](_0x7ec1('0x7'),_0x7ec1('0x8'),_0x4a3aef,_0x3a989c,_0x33db95);return _0xcad530(_0x3a989c);});});};module[_0x7ec1('0xd')]=client; \ No newline at end of file +var _0xf916=['jayson/promise','bluebird','../../config/logger','routing','client','http','request','then','debug','error','message','result','catch','exports'];(function(_0x206379,_0x9cbd7e){var _0x8d8555=function(_0x683435){while(--_0x683435){_0x206379['push'](_0x206379['shift']());}};_0x8d8555(++_0x9cbd7e);}(_0xf916,0xa8));var _0x6f91=function(_0x51a995,_0x13db8b){_0x51a995=_0x51a995-0x0;var _0x465770=_0xf916[_0x51a995];return _0x465770;};'use strict';var jayson=require(_0x6f91('0x0'));var BPromise=require(_0x6f91('0x1'));var logger=require(_0x6f91('0x2'))(_0x6f91('0x3'));var client=jayson[_0x6f91('0x4')][_0x6f91('0x5')]({'port':0x2329});client['Request']=function(_0x181e29,_0x5bc321){return new BPromise(function(_0x523938,_0x3b6059){return client[_0x6f91('0x6')](_0x181e29,_0x5bc321)[_0x6f91('0x7')](function(_0x4077f8){logger[_0x6f91('0x8')]('rpc',_0x6f91('0x3'),_0x181e29,_0x5bc321,_0x4077f8);if(_0x4077f8[_0x6f91('0x9')]){logger[_0x6f91('0x9')]('rpc',_0x6f91('0x3'),_0x181e29,_0x4077f8[_0x6f91('0x9')][_0x6f91('0xa')],_0x5bc321);return _0x3b6059(_0x4077f8[_0x6f91('0x9')]['message']);}else{return _0x523938(_0x4077f8[_0x6f91('0xb')]);}})[_0x6f91('0xc')](function(_0x16e8a7){logger['error']('rpc','routing',_0x181e29,_0x16e8a7,_0x5bc321);return _0x3b6059(_0x16e8a7);});});};module[_0x6f91('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 13f001a..33bfec8 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 _0x8ef8=['catch','Email\x20service\x20initialization','./server','./lib/email','./rpc/setting','email','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x8ef8,0x12e));var _0x88ef=function(_0x3eb4f7,_0x135ecc){_0x3eb4f7=_0x3eb4f7-0x0;var _0x157316=_0x8ef8[_0x3eb4f7];return _0x157316;};'use strict';var server=require(_0x88ef('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x88ef('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x88ef('0x2'));var logger=require('../../config/logger')(_0x88ef('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x88ef('0x4')]()['then'](mailAccount[_0x88ef('0x5')]())[_0x88ef('0x6')](realtime[_0x88ef('0x7')]())[_0x88ef('0x6')](function(){email[_0x88ef('0x8')](realtime[_0x88ef('0x9')]);return realtime;});}function main(){return server[_0x88ef('0xa')](realtime,email)[_0x88ef('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0x88ef('0xb')]();})['then'](function(_0x2296ff){return setInterval(initRealtime,_0x2296ff[_0x88ef('0xc')]*0x3e8);})[_0x88ef('0xd')](function(_0x27218b){logger['error'](_0x88ef('0xe'),_0x27218b);});}main(); \ No newline at end of file +var _0xc347=['getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then'];(function(_0x16dd8d,_0x433387){var _0x317d95=function(_0x369efb){while(--_0x369efb){_0x16dd8d['push'](_0x16dd8d['shift']());}};_0x317d95(++_0x433387);}(_0xc347,0x10a));var _0x7c34=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc347[_0x432682];return _0x463d05;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x7c34('0x0'));var mailAccount=require(_0x7c34('0x1'));var setting=require('./rpc/setting');var logger=require(_0x7c34('0x2'))(_0x7c34('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7c34('0x4')]()[_0x7c34('0x5')](mailAccount[_0x7c34('0x6')]())[_0x7c34('0x5')](realtime[_0x7c34('0x7')]())[_0x7c34('0x5')](function(){email[_0x7c34('0x8')](realtime[_0x7c34('0x9')]);return realtime;});}function main(){return server[_0x7c34('0xa')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x7c34('0xb')]();})['then'](function(_0x3c64bc){return setInterval(initRealtime,_0x3c64bc[_0x7c34('0xc')]*0x3e8);})[_0x7c34('0xd')](function(_0x49519b){logger[_0x7c34('0xe')](_0x7c34('0xf'),_0x49519b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 40094a4..5028563 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 _0xa2ca=['from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','sendMail','smtp','verifySmtp','Smtp','lastSync','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','prototype','emit','name','active','status','messageStatus','Imap','total','isNil','stringify','mailAccount:update','refresh','service','provider','custom','hasOwnProperty','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','disabled','connected','messages','lastName'];(function(_0x56cb7c,_0x30e352){var _0x4d83e7=function(_0x3a8963){while(--_0x3a8963){_0x56cb7c['push'](_0x56cb7c['shift']());}};_0x4d83e7(++_0x30e352);}(_0xa2ca,0x19c));var _0xaa2c=function(_0x35b65e,_0x39b602){_0x35b65e=_0x35b65e-0x0;var _0xdaeb76=_0xa2ca[_0x35b65e];return _0xdaeb76;};'use strict';var _=require(_0xaa2c('0x0'));var moment=require(_0xaa2c('0x1'));var BPromise=require(_0xaa2c('0x2'));var md5=require(_0xaa2c('0x3'));var Redis=require(_0xaa2c('0x4'));var config=require('../../../config/environment');var logger=require(_0xaa2c('0x5'))(_0xaa2c('0x6'));config['redis']=_[_0xaa2c('0x7')](config[_0xaa2c('0x8')],{'host':_0xaa2c('0x9'),'port':0x18eb});var io=require(_0xaa2c('0xa'))(new Redis(config[_0xaa2c('0x8')]));var EmailImap=require(_0xaa2c('0xb'));var EmailSmtp=require(_0xaa2c('0xc'));var mailAccount=require(_0xaa2c('0xd'));var md5Accounts={};function EmailChannel(_0x56dbcf){logger[_0xaa2c('0xe')]('start\x20email\x20channel');this[_0xaa2c('0xf')]=_0x56dbcf['mailAccounts'];this[_0xaa2c('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xaa2c('0x11')][_0xaa2c('0x12')]=function(_0x59fc92){var _0x1ed1ac=this['mailAccounts'][_0x59fc92];var _0x157941={'id':_0x1ed1ac['id'],'name':_0x1ed1ac[_0xaa2c('0x13')],'key':_0x1ed1ac['key'],'active':_0x1ed1ac[_0xaa2c('0x14')],'Imap':{'status':_0x1ed1ac['Imap'][_0xaa2c('0x15')],'messageStatus':_0x1ed1ac['Imap'][_0xaa2c('0x16')],'total':_0x1ed1ac[_0xaa2c('0x17')][_0xaa2c('0x18')]}};if(_[_0xaa2c('0x19')](md5Accounts[_0x59fc92])){md5Accounts[_0x59fc92]={};}var _0x766654=md5(JSON[_0xaa2c('0x1a')](_0x157941));if(md5Accounts[_0x59fc92][_0xaa2c('0x3')]!==_0x766654){md5Accounts[_0x59fc92][_0xaa2c('0x3')]=_0x766654;io['emit'](_0xaa2c('0x1b'),_0x157941);}};EmailChannel[_0xaa2c('0x11')][_0xaa2c('0x1c')]=function(_0x2cf4d5){for(var _0xf246e6 in _0x2cf4d5){if(_0x2cf4d5['hasOwnProperty'](_0xf246e6)){if(_0x2cf4d5[_0xf246e6]['Imap']&&_0x2cf4d5[_0xf246e6][_0xaa2c('0x14')]){var _0x24a156=_0x2cf4d5[_0xf246e6][_0xaa2c('0x17')];if(!_0x24a156[_0xaa2c('0x1d')]&&_0x2cf4d5[_0xf246e6][_0xaa2c('0x1e')]!==_0xaa2c('0x1f'))_0x24a156[_0xaa2c('0x1d')]=_0x2cf4d5[_0xf246e6][_0xaa2c('0x1e')];if(!this[_0xaa2c('0x10')][_0xaa2c('0x20')](_0x24a156['id'])){this[_0xaa2c('0x10')][_0x24a156['id']]=new EmailImap(_0x24a156,_0x2cf4d5[_0xf246e6][_0xaa2c('0x6')]);this['imapAccounts'][_0x24a156['id']]['on'](_0xaa2c('0x21'),this[_0xaa2c('0x22')]['bind'](this,_0xf246e6));this[_0xaa2c('0x10')][_0x24a156['id']]['on'](_0xaa2c('0x6'),this[_0xaa2c('0x23')][_0xaa2c('0x24')](this,_0xf246e6));this[_0xaa2c('0x10')][_0x24a156['id']]['on'](_0xaa2c('0x25'),this[_0xaa2c('0x26')][_0xaa2c('0x24')](this,_0xf246e6));this[_0xaa2c('0x10')][_0x24a156['id']]['on'](_0xaa2c('0x27'),this['handleImapError']['bind'](this,_0xf246e6));}}else{if(_[_0xaa2c('0x19')](this[_0xaa2c('0xf')][_0xf246e6][_0xaa2c('0x17')])){this[_0xaa2c('0xf')][_0xf246e6][_0xaa2c('0x17')]={};}this['mailAccounts'][_0xf246e6][_0xaa2c('0x17')][_0xaa2c('0x15')]=_0xaa2c('0x28');this[_0xaa2c('0xf')][_0xf246e6][_0xaa2c('0x17')][_0xaa2c('0x16')]='';this['emit'](_0xf246e6);}}}};EmailChannel[_0xaa2c('0x11')][_0xaa2c('0x22')]=function(_0x45d584,_0x3aed80){if(this[_0xaa2c('0xf')][_0x45d584]){this[_0xaa2c('0xf')][_0x45d584][_0xaa2c('0x17')][_0xaa2c('0x15')]=_0xaa2c('0x29');this[_0xaa2c('0xf')][_0x45d584]['Imap'][_0xaa2c('0x16')]=_0x3aed80[_0xaa2c('0x13')];if(_0x3aed80[_0xaa2c('0x2a')]){this[_0xaa2c('0xf')][_0x45d584][_0xaa2c('0x17')][_0xaa2c('0x18')]=_0x3aed80[_0xaa2c('0x2a')]['total'];}return this[_0xaa2c('0x12')](_0x45d584);}};EmailChannel[_0xaa2c('0x11')][_0xaa2c('0x23')]=function(_0x24c969,_0x4da86d){logger[_0xaa2c('0xe')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4da86d['firstName'],_0x4da86d[_0xaa2c('0x2b')],_0x4da86d[_0xaa2c('0x2c')],_0x24c969);if(this['mailAccounts'][_0x24c969]){return mailAccount['notify'](_0x24c969,_0x4da86d)[_0xaa2c('0x2d')](function(_0x3d3ff0){if(_0x3d3ff0){logger[_0xaa2c('0xe')](_0xaa2c('0x2e'));}})[_0xaa2c('0x2f')](function(_0xee973){logger[_0xaa2c('0x27')](_0xaa2c('0x30'),JSON[_0xaa2c('0x1a')](_0xee973));});}};EmailChannel[_0xaa2c('0x11')][_0xaa2c('0x26')]=function(_0x327aff){if(this['mailAccounts'][_0x327aff]&&this[_0xaa2c('0xf')][_0x327aff]['Imap']){if(this[_0xaa2c('0x10')][this[_0xaa2c('0xf')][_0x327aff][_0xaa2c('0x17')]['id']]){delete this[_0xaa2c('0x10')][this[_0xaa2c('0xf')][_0x327aff]['Imap']['id']];}this[_0xaa2c('0xf')][_0x327aff][_0xaa2c('0x17')]['lastSync']=moment();this[_0xaa2c('0x12')](_0x327aff);}};EmailChannel[_0xaa2c('0x11')][_0xaa2c('0x31')]=function(_0x5dd1fc,_0x4eb695){if(this[_0xaa2c('0xf')][_0x5dd1fc]){this[_0xaa2c('0xf')][_0x5dd1fc]['Imap'][_0xaa2c('0x15')]='error';this[_0xaa2c('0xf')][_0x5dd1fc][_0xaa2c('0x17')]['messageStatus']=_0x4eb695;return this[_0xaa2c('0x12')](_0x5dd1fc);}};EmailChannel['prototype'][_0xaa2c('0x32')]=function(_0x80b642,_0x1d339d){return this[_0xaa2c('0x33')]['send'](_0x80b642,_0x1d339d);};EmailChannel[_0xaa2c('0x11')][_0xaa2c('0x34')]=function(_0x346a06){var _0x3f3d42=this;if(this[_0xaa2c('0xf')][_0x346a06['id']]){if(_[_0xaa2c('0x19')](this[_0xaa2c('0xf')][_0x346a06['id']][_0xaa2c('0x35')])){this[_0xaa2c('0xf')][_0x346a06['id']][_0xaa2c('0x35')]={};}this[_0xaa2c('0xf')][_0x346a06['id']]['Smtp'][_0xaa2c('0x36')]=moment();return new BPromise(function(_0x1d7747,_0x10f996){return _0x3f3d42[_0xaa2c('0x33')][_0xaa2c('0x37')](_0x346a06)[_0xaa2c('0x2d')](function(_0x22dd29){_0x3f3d42[_0xaa2c('0xf')][_0x346a06['id']][_0xaa2c('0x35')]['status']='verified';_0x3f3d42[_0xaa2c('0xf')][_0x346a06['id']][_0xaa2c('0x35')]['messageStatus']='';_0x3f3d42['emit'](_0x346a06['id']);_0x1d7747(_0x22dd29);})[_0xaa2c('0x2f')](function(_0x372d68){_0x3f3d42['mailAccounts'][_0x346a06['id']][_0xaa2c('0x35')][_0xaa2c('0x15')]=_0xaa2c('0x27');_0x3f3d42[_0xaa2c('0xf')][_0x346a06['id']][_0xaa2c('0x35')][_0xaa2c('0x16')]=_0x372d68;_0x3f3d42[_0xaa2c('0x12')](_0x346a06['id']);_0x10f996(_0x372d68);});});}return this[_0xaa2c('0x33')][_0xaa2c('0x37')](_0x346a06);};module[_0xaa2c('0x38')]=EmailChannel; \ No newline at end of file +var _0x14e5=['isNil','Smtp','verify','then','verified','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','total','stringify','refresh','hasOwnProperty','service','custom','box','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','messageStatus','messages','firstName','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','status','send','verifySmtp'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0x14e5,0x118));var _0x514e=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x14e5[_0x12a2a6];return _0x1754ae;};'use strict';var _=require(_0x514e('0x0'));var moment=require(_0x514e('0x1'));var BPromise=require(_0x514e('0x2'));var md5=require(_0x514e('0x3'));var Redis=require(_0x514e('0x4'));var config=require('../../../config/environment');var logger=require(_0x514e('0x5'))(_0x514e('0x6'));config[_0x514e('0x7')]=_[_0x514e('0x8')](config[_0x514e('0x7')],{'host':_0x514e('0x9'),'port':0x18eb});var io=require(_0x514e('0xa'))(new Redis(config[_0x514e('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x514e('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x394919){logger[_0x514e('0xc')](_0x514e('0xd'));this[_0x514e('0xe')]=_0x394919[_0x514e('0xe')];this[_0x514e('0xf')]={};this[_0x514e('0x10')]=new EmailSmtp();}EmailChannel[_0x514e('0x11')][_0x514e('0x12')]=function(_0x1856e5){var _0x3690e3=this[_0x514e('0xe')][_0x1856e5];var _0xfc734={'id':_0x3690e3['id'],'name':_0x3690e3[_0x514e('0x13')],'key':_0x3690e3[_0x514e('0x14')],'active':_0x3690e3[_0x514e('0x15')],'Imap':{'status':_0x3690e3[_0x514e('0x16')]['status'],'messageStatus':_0x3690e3[_0x514e('0x16')]['messageStatus'],'total':_0x3690e3[_0x514e('0x16')][_0x514e('0x17')]}};if(_['isNil'](md5Accounts[_0x1856e5])){md5Accounts[_0x1856e5]={};}var _0x226b13=md5(JSON[_0x514e('0x18')](_0xfc734));if(md5Accounts[_0x1856e5]['md5']!==_0x226b13){md5Accounts[_0x1856e5]['md5']=_0x226b13;io[_0x514e('0x12')]('mailAccount:update',_0xfc734);}};EmailChannel[_0x514e('0x11')][_0x514e('0x19')]=function(_0x2dcb58){for(var _0x26573e in _0x2dcb58){if(_0x2dcb58[_0x514e('0x1a')](_0x26573e)){if(_0x2dcb58[_0x26573e][_0x514e('0x16')]&&_0x2dcb58[_0x26573e][_0x514e('0x15')]){var _0x4cb372=_0x2dcb58[_0x26573e][_0x514e('0x16')];if(!_0x4cb372[_0x514e('0x1b')]&&_0x2dcb58[_0x26573e]['provider']!==_0x514e('0x1c'))_0x4cb372['service']=_0x2dcb58[_0x26573e]['provider'];if(!this[_0x514e('0xf')][_0x514e('0x1a')](_0x4cb372['id'])){this[_0x514e('0xf')][_0x4cb372['id']]=new EmailImap(_0x4cb372,_0x2dcb58[_0x26573e][_0x514e('0x6')]);this[_0x514e('0xf')][_0x4cb372['id']]['on'](_0x514e('0x1d'),this['handleImapBox']['bind'](this,_0x26573e));this[_0x514e('0xf')][_0x4cb372['id']]['on'](_0x514e('0x6'),this[_0x514e('0x1e')][_0x514e('0x1f')](this,_0x26573e));this[_0x514e('0xf')][_0x4cb372['id']]['on'](_0x514e('0x20'),this[_0x514e('0x21')]['bind'](this,_0x26573e));this[_0x514e('0xf')][_0x4cb372['id']]['on'](_0x514e('0x22'),this[_0x514e('0x23')][_0x514e('0x1f')](this,_0x26573e));}}else{if(_['isNil'](this[_0x514e('0xe')][_0x26573e][_0x514e('0x16')])){this[_0x514e('0xe')][_0x26573e]['Imap']={};}this[_0x514e('0xe')][_0x26573e][_0x514e('0x16')]['status']=_0x514e('0x24');this[_0x514e('0xe')][_0x26573e]['Imap']['messageStatus']='';this[_0x514e('0x12')](_0x26573e);}}}};EmailChannel[_0x514e('0x11')][_0x514e('0x25')]=function(_0x47cace,_0x493175){if(this[_0x514e('0xe')][_0x47cace]){this[_0x514e('0xe')][_0x47cace]['Imap']['status']=_0x514e('0x26');this[_0x514e('0xe')][_0x47cace][_0x514e('0x16')][_0x514e('0x27')]=_0x493175[_0x514e('0x13')];if(_0x493175[_0x514e('0x28')]){this[_0x514e('0xe')][_0x47cace][_0x514e('0x16')]['total']=_0x493175[_0x514e('0x28')][_0x514e('0x17')];}return this['emit'](_0x47cace);}};EmailChannel['prototype'][_0x514e('0x1e')]=function(_0x142d45,_0x363792){logger[_0x514e('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x363792[_0x514e('0x29')],_0x363792['lastName'],_0x363792[_0x514e('0x2a')],_0x142d45);if(this[_0x514e('0xe')][_0x142d45]){return mailAccount[_0x514e('0x2b')](_0x142d45,_0x363792)['then'](function(_0x2d0ee3){if(_0x2d0ee3){logger[_0x514e('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0x514e('0x2c')](function(_0x43b863){logger[_0x514e('0x22')](_0x514e('0x2d'),JSON[_0x514e('0x18')](_0x43b863));});}};EmailChannel[_0x514e('0x11')]['handleImapEnd']=function(_0x4003d9){if(this[_0x514e('0xe')][_0x4003d9]&&this[_0x514e('0xe')][_0x4003d9][_0x514e('0x16')]){if(this[_0x514e('0xf')][this[_0x514e('0xe')][_0x4003d9][_0x514e('0x16')]['id']]){delete this[_0x514e('0xf')][this[_0x514e('0xe')][_0x4003d9][_0x514e('0x16')]['id']];}this[_0x514e('0xe')][_0x4003d9][_0x514e('0x16')][_0x514e('0x2e')]=moment();this['emit'](_0x4003d9);}};EmailChannel[_0x514e('0x11')][_0x514e('0x23')]=function(_0x38cb69,_0x305c21){if(this['mailAccounts'][_0x38cb69]){this[_0x514e('0xe')][_0x38cb69][_0x514e('0x16')][_0x514e('0x2f')]=_0x514e('0x22');this[_0x514e('0xe')][_0x38cb69]['Imap']['messageStatus']=_0x305c21;return this[_0x514e('0x12')](_0x38cb69);}};EmailChannel[_0x514e('0x11')]['sendMail']=function(_0x2fbc4c,_0x2c2ec1){return this[_0x514e('0x10')][_0x514e('0x30')](_0x2fbc4c,_0x2c2ec1);};EmailChannel[_0x514e('0x11')][_0x514e('0x31')]=function(_0x1fbc28){var _0x7fabe1=this;if(this[_0x514e('0xe')][_0x1fbc28['id']]){if(_[_0x514e('0x32')](this[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')])){this[_0x514e('0xe')][_0x1fbc28['id']]['Smtp']={};}this[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')]['lastSync']=moment();return new BPromise(function(_0x11fe72,_0x479272){return _0x7fabe1[_0x514e('0x10')][_0x514e('0x34')](_0x1fbc28)[_0x514e('0x35')](function(_0x3f5407){_0x7fabe1[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')][_0x514e('0x2f')]=_0x514e('0x36');_0x7fabe1[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')][_0x514e('0x27')]='';_0x7fabe1[_0x514e('0x12')](_0x1fbc28['id']);_0x11fe72(_0x3f5407);})[_0x514e('0x2c')](function(_0x4d136e){_0x7fabe1[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')][_0x514e('0x2f')]=_0x514e('0x22');_0x7fabe1[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')][_0x514e('0x27')]=_0x4d136e;_0x7fabe1['emit'](_0x1fbc28['id']);_0x479272(_0x4d136e);});});}return this[_0x514e('0x10')][_0x514e('0x34')](_0x1fbc28);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a0ff552..65fc052 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 _0x9a42=['account','getAccount','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','prototype','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','anonymous@xcally.com','host','port','tls','openBox','handleOpenBox','emit','box','readUnseen','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleMessageAttributes','handleMessageBody','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','closeBox','handleCloseBox','stringify','hasOwnProperty','upperFirst','lodash','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox'];(function(_0x43a602,_0x4fe4ef){var _0x5b085c=function(_0xf6f6c4){while(--_0xf6f6c4){_0x43a602['push'](_0x43a602['shift']());}};_0x5b085c(++_0x4fe4ef);}(_0x9a42,0x69));var _0x29a4=function(_0x53f875,_0x5587b0){_0x53f875=_0x53f875-0x0;var _0x586381=_0x9a42[_0x53f875];return _0x586381;};'use strict';var _=require(_0x29a4('0x0'));var util=require('util');var Imap=require(_0x29a4('0x1'));var simpleParser=require(_0x29a4('0x2'))[_0x29a4('0x3')];var Iconv=require(_0x29a4('0x4'))[_0x29a4('0x5')];var EventEmitter=require(_0x29a4('0x6'))['EventEmitter'];var utils=require(_0x29a4('0x7'));var logger=require(_0x29a4('0x8'))(_0x29a4('0x9'));function EmailImap(_0x28ac73,_0x2aa85e){this[_0x29a4('0xa')]=_0x28ac73[_0x29a4('0xa')];this[_0x29a4('0xb')]=this[_0x29a4('0xc')](_0x28ac73,_0x2aa85e);this[_0x29a4('0x1')]=new Imap(this[_0x29a4('0xb')]);this[_0x29a4('0x1')][_0x29a4('0xd')](_0x29a4('0xe'),this[_0x29a4('0xf')]['bind'](this));this['imap']['once'](_0x29a4('0x10'),this[_0x29a4('0x11')][_0x29a4('0x12')](this));this[_0x29a4('0x1')]['on'](_0x29a4('0x13'),this[_0x29a4('0x14')][_0x29a4('0x12')](this));this[_0x29a4('0x1')][_0x29a4('0x15')]();}util[_0x29a4('0x16')](EmailImap,EventEmitter);EmailImap[_0x29a4('0x17')]['getAccount']=function(_0x388575,_0x2a2b4d){var _0x37eed5={'connTimeout':_0x388575['connTimeout']?_0x388575['connTimeout']*0x3e8:0x2710,'authTimeout':_0x388575[_0x29a4('0x18')]?_0x388575[_0x29a4('0x18')]*0x3e8:0x1388};if(_0x388575[_0x29a4('0x19')]){_0x37eed5['user']=_0x388575[_0x29a4('0x1a')];if(_0x388575[_0x29a4('0x1b')]){_0x37eed5[_0x29a4('0x1c')]=utils[_0x29a4('0x1d')](_0x388575[_0x29a4('0x1e')][_0x29a4('0x1f')],_0x388575[_0x29a4('0x1a')]);}else{_0x37eed5[_0x29a4('0x20')]=_0x388575[_0x29a4('0x20')];}}else{if(_0x388575['authentication']){_0x37eed5[_0x29a4('0x1a')]=_0x388575[_0x29a4('0x1a')];_0x37eed5[_0x29a4('0x20')]=_0x388575[_0x29a4('0x20')];}}_0x37eed5[_0x29a4('0x9')]=_0x2a2b4d||_0x388575[_0x29a4('0x1a')]||_0x29a4('0x21');_0x37eed5[_0x29a4('0x22')]=_0x388575['host'];_0x37eed5[_0x29a4('0x23')]=_0x388575[_0x29a4('0x23')]||0x3e1;if(_0x388575[_0x29a4('0x24')]){_0x37eed5[_0x29a4('0x24')]=!![];}else{_0x37eed5[_0x29a4('0x24')]=![];_0x37eed5['autotls']='required';}return _0x37eed5;};EmailImap[_0x29a4('0x17')][_0x29a4('0xf')]=function(){this['imap'][_0x29a4('0x25')](this['mailbox'],![],this[_0x29a4('0x26')][_0x29a4('0x12')](this));};EmailImap[_0x29a4('0x17')][_0x29a4('0x26')]=function(_0x4603a0,_0x2f3346){if(_0x4603a0){this[_0x29a4('0x14')](_0x4603a0,!![]);}else{this[_0x29a4('0x27')](_0x29a4('0x28'),_0x2f3346);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x40ed32){if(_0x40ed32){this['handleError'](_0x40ed32,!![]);}else{this['imap'][_0x29a4('0x10')]();}};EmailImap[_0x29a4('0x17')][_0x29a4('0x29')]=function(){this[_0x29a4('0x1')]['search'](['UNSEEN'],this[_0x29a4('0x2a')]['bind'](this));};EmailImap['prototype'][_0x29a4('0x2a')]=function(_0x16ff24,_0x14c62b){if(_0x16ff24){this[_0x29a4('0x14')](_0x16ff24,!![]);}else{if(_0x14c62b[_0x29a4('0x2b')]){try{var _0xfaece0=this[_0x29a4('0x1')]['fetch'](_0x14c62b,{'bodies':'','markSeen':!![]});_0xfaece0['on'](_0x29a4('0x2c'),this[_0x29a4('0x2d')][_0x29a4('0x12')](this));_0xfaece0[_0x29a4('0xd')]('error',this[_0x29a4('0x2e')][_0x29a4('0x12')](this));_0xfaece0[_0x29a4('0xd')](_0x29a4('0x10'),this['handleFetchEnd'][_0x29a4('0x12')](this));}catch(_0x3c2d53){logger[_0x29a4('0x13')](_0x3c2d53);}}else{this['imap']['closeBox'](!![],this['handleCloseBox'][_0x29a4('0x12')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x37dbe2){_0x37dbe2['on']('body',this['handleMessageBody'][_0x29a4('0x12')](this));_0x37dbe2[_0x29a4('0xd')]('attributes',this[_0x29a4('0x2f')][_0x29a4('0x12')](this));_0x37dbe2[_0x29a4('0xd')](_0x29a4('0x10'),this['handleMessageEnd'][_0x29a4('0x12')](this));};EmailImap[_0x29a4('0x17')][_0x29a4('0x30')]=function(_0x5350dd){simpleParser(_0x5350dd,{'Iconv':Iconv},this['handleSimpleParser'][_0x29a4('0x12')](this));};EmailImap['prototype'][_0x29a4('0x2f')]=function(){};EmailImap[_0x29a4('0x17')][_0x29a4('0x31')]=function(){};EmailImap['prototype'][_0x29a4('0x32')]=function(_0x5ebc92,_0x577322){if(_0x5ebc92){logger['error'](_0x5ebc92);}else{var _0x51690c=this;utils[_0x29a4('0x33')](this[_0x29a4('0xb')],_0x577322,function(_0x35403c){_0x51690c[_0x29a4('0x27')](_0x29a4('0x9'),_0x35403c);});}};EmailImap['prototype'][_0x29a4('0x34')]=function(){this[_0x29a4('0x1')][_0x29a4('0x35')](!![],this[_0x29a4('0x36')][_0x29a4('0x12')](this));};EmailImap['prototype'][_0x29a4('0x2e')]=function(_0x4dd48f){this[_0x29a4('0x14')](_0x4dd48f);this['imap']['closeBox'](!![],this[_0x29a4('0x36')][_0x29a4('0x12')](this));};EmailImap[_0x29a4('0x17')][_0x29a4('0x11')]=function(){this[_0x29a4('0x27')](_0x29a4('0x10'));};EmailImap['prototype'][_0x29a4('0x14')]=function(_0x38d79c,_0x5ad18f){logger[_0x29a4('0x13')]('handleError',this['account'][_0x29a4('0x9')],JSON[_0x29a4('0x37')](_0x38d79c));var _0x41b6b9='';if(_0x38d79c){if(_0x38d79c['textCode']){_0x41b6b9=_0x38d79c['textCode'];}else{for(var _0x52537a in _0x38d79c){if(_0x38d79c[_0x29a4('0x38')](_0x52537a)){_0x41b6b9+=_[_0x29a4('0x39')](_0x52537a)+':\x20'+_0x38d79c[_0x52537a]+'\x0a';}}}}if(_0x5ad18f){this[_0x29a4('0x1')][_0x29a4('0x10')]();}else{this[_0x29a4('0x27')](_0x29a4('0x13'),_0x41b6b9);this[_0x29a4('0x27')](_0x29a4('0x10'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x9f73=['host','port','tls','required','openBox','handleOpenBox','emit','box','readUnseen','UNSEEN','handleReadUnseen','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','xoauth2','generateXOAuth2Token','CloudProvider','user','password'];(function(_0x4a99d1,_0x45850a){var _0x13a22e=function(_0x35b7b1){while(--_0x35b7b1){_0x4a99d1['push'](_0x4a99d1['shift']());}};_0x13a22e(++_0x45850a);}(_0x9f73,0x108));var _0x39f7=function(_0x243e5e,_0x3a44be){_0x243e5e=_0x243e5e-0x0;var _0x15752f=_0x9f73[_0x243e5e];return _0x15752f;};'use strict';var _=require(_0x39f7('0x0'));var util=require(_0x39f7('0x1'));var Imap=require(_0x39f7('0x2'));var simpleParser=require(_0x39f7('0x3'))[_0x39f7('0x4')];var Iconv=require('iconv')[_0x39f7('0x5')];var EventEmitter=require(_0x39f7('0x6'))[_0x39f7('0x7')];var utils=require('./utils');var logger=require(_0x39f7('0x8'))(_0x39f7('0x9'));function EmailImap(_0x5d01fc,_0x398e29){this[_0x39f7('0xa')]=_0x5d01fc[_0x39f7('0xa')];this[_0x39f7('0xb')]=this[_0x39f7('0xc')](_0x5d01fc,_0x398e29);this[_0x39f7('0x2')]=new Imap(this[_0x39f7('0xb')]);this['imap']['once'](_0x39f7('0xd'),this[_0x39f7('0xe')][_0x39f7('0xf')](this));this[_0x39f7('0x2')][_0x39f7('0x10')](_0x39f7('0x11'),this[_0x39f7('0x12')][_0x39f7('0xf')](this));this[_0x39f7('0x2')]['on'](_0x39f7('0x13'),this[_0x39f7('0x14')]['bind'](this));this['imap']['connect']();}util[_0x39f7('0x15')](EmailImap,EventEmitter);EmailImap[_0x39f7('0x16')][_0x39f7('0xc')]=function(_0x2064d5,_0x1b5e2b){var _0x339d7a={'connTimeout':_0x2064d5[_0x39f7('0x17')]?_0x2064d5['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2064d5[_0x39f7('0x18')]?_0x2064d5[_0x39f7('0x18')]*0x3e8:0x1388};if(_0x2064d5[_0x39f7('0x19')]){_0x339d7a['user']=_0x2064d5['user'];if(_0x2064d5['modernAuthentication']){_0x339d7a[_0x39f7('0x1a')]=utils[_0x39f7('0x1b')](_0x2064d5[_0x39f7('0x1c')]['data5'],_0x2064d5[_0x39f7('0x1d')]);}else{_0x339d7a[_0x39f7('0x1e')]=_0x2064d5['password'];}}else{if(_0x2064d5['authentication']){_0x339d7a[_0x39f7('0x1d')]=_0x2064d5[_0x39f7('0x1d')];_0x339d7a[_0x39f7('0x1e')]=_0x2064d5[_0x39f7('0x1e')];}}_0x339d7a[_0x39f7('0x9')]=_0x1b5e2b||_0x2064d5[_0x39f7('0x1d')]||'anonymous@xcally.com';_0x339d7a[_0x39f7('0x1f')]=_0x2064d5[_0x39f7('0x1f')];_0x339d7a[_0x39f7('0x20')]=_0x2064d5[_0x39f7('0x20')]||0x3e1;if(_0x2064d5['tls']){_0x339d7a['tls']=!![];}else{_0x339d7a[_0x39f7('0x21')]=![];_0x339d7a['autotls']=_0x39f7('0x22');}return _0x339d7a;};EmailImap[_0x39f7('0x16')][_0x39f7('0xe')]=function(){this[_0x39f7('0x2')][_0x39f7('0x23')](this['mailbox'],![],this[_0x39f7('0x24')][_0x39f7('0xf')](this));};EmailImap[_0x39f7('0x16')][_0x39f7('0x24')]=function(_0x244009,_0x402b3e){if(_0x244009){this[_0x39f7('0x14')](_0x244009,!![]);}else{this[_0x39f7('0x25')](_0x39f7('0x26'),_0x402b3e);this[_0x39f7('0x27')]();}};EmailImap[_0x39f7('0x16')]['handleCloseBox']=function(_0x1f9d99){if(_0x1f9d99){this[_0x39f7('0x14')](_0x1f9d99,!![]);}else{this[_0x39f7('0x2')]['end']();}};EmailImap[_0x39f7('0x16')]['readUnseen']=function(){this[_0x39f7('0x2')]['search']([_0x39f7('0x28')],this[_0x39f7('0x29')][_0x39f7('0xf')](this));};EmailImap['prototype'][_0x39f7('0x29')]=function(_0xd80891,_0x5a307c){if(_0xd80891){this[_0x39f7('0x14')](_0xd80891,!![]);}else{if(_0x5a307c['length']){try{var _0x2be434=this['imap']['fetch'](_0x5a307c,{'bodies':'','markSeen':!![]});_0x2be434['on'](_0x39f7('0x2a'),this[_0x39f7('0x2b')]['bind'](this));_0x2be434[_0x39f7('0x10')](_0x39f7('0x13'),this[_0x39f7('0x2c')]['bind'](this));_0x2be434[_0x39f7('0x10')](_0x39f7('0x11'),this[_0x39f7('0x2d')][_0x39f7('0xf')](this));}catch(_0x54f12e){logger[_0x39f7('0x13')](_0x54f12e);}}else{this[_0x39f7('0x2')][_0x39f7('0x2e')](!![],this[_0x39f7('0x2f')][_0x39f7('0xf')](this));}}};EmailImap['prototype'][_0x39f7('0x2b')]=function(_0x315384){_0x315384['on'](_0x39f7('0x30'),this[_0x39f7('0x31')][_0x39f7('0xf')](this));_0x315384[_0x39f7('0x10')](_0x39f7('0x32'),this['handleMessageAttributes']['bind'](this));_0x315384[_0x39f7('0x10')](_0x39f7('0x11'),this[_0x39f7('0x33')][_0x39f7('0xf')](this));};EmailImap[_0x39f7('0x16')][_0x39f7('0x31')]=function(_0x24624f){simpleParser(_0x24624f,{'Iconv':Iconv},this[_0x39f7('0x34')][_0x39f7('0xf')](this));};EmailImap[_0x39f7('0x16')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x39f7('0x33')]=function(){};EmailImap[_0x39f7('0x16')][_0x39f7('0x34')]=function(_0x39338b,_0x2ab147){if(_0x39338b){logger[_0x39f7('0x13')](_0x39338b);}else{var _0x1b8a07=this;utils[_0x39f7('0x35')](this[_0x39f7('0xb')],_0x2ab147,function(_0x3c15ef){_0x1b8a07[_0x39f7('0x25')](_0x39f7('0x9'),_0x3c15ef);});}};EmailImap[_0x39f7('0x16')]['handleFetchEnd']=function(){this[_0x39f7('0x2')][_0x39f7('0x2e')](!![],this[_0x39f7('0x2f')][_0x39f7('0xf')](this));};EmailImap[_0x39f7('0x16')][_0x39f7('0x2c')]=function(_0x33f7ee){this[_0x39f7('0x14')](_0x33f7ee);this[_0x39f7('0x2')][_0x39f7('0x2e')](!![],this[_0x39f7('0x2f')][_0x39f7('0xf')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x39f7('0x25')](_0x39f7('0x11'));};EmailImap['prototype']['handleError']=function(_0x5b68ef,_0x5a4695){logger['error'](_0x39f7('0x14'),this[_0x39f7('0xb')]['email'],JSON[_0x39f7('0x36')](_0x5b68ef));var _0x57a629='';if(_0x5b68ef){if(_0x5b68ef['textCode']){_0x57a629=_0x5b68ef[_0x39f7('0x37')];}else{for(var _0x4278fa in _0x5b68ef){if(_0x5b68ef[_0x39f7('0x38')](_0x4278fa)){_0x57a629+=_[_0x39f7('0x39')](_0x4278fa)+':\x20'+_0x5b68ef[_0x4278fa]+'\x0a';}}}}if(_0x5a4695){this[_0x39f7('0x2')]['end']();}else{this[_0x39f7('0x25')]('error',_0x57a629);this[_0x39f7('0x25')](_0x39f7('0x11'));}};module[_0x39f7('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 1ac2d4b..971ac70 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 _0x4b68=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x4b68,0x68));var _0x84b6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4b68[_0xfae23b];return _0x200640;};'use strict';var nodemailer=require(_0x84b6('0x0'));var inlineBase64=require(_0x84b6('0x1'));function EmailSmtp(){}EmailSmtp[_0x84b6('0x2')]['send']=function(_0xca77f9,_0x2a5ebe){return new Promise(function(_0x102d95,_0x2db563){var _0xaed103=nodemailer[_0x84b6('0x3')](_0xca77f9);_0xaed103[_0x84b6('0x4')](_0x84b6('0x5'),inlineBase64());_0xaed103[_0x84b6('0x6')](_0x2a5ebe,function(_0x68faec,_0x3b36f6){if(_0x68faec){_0x2db563(_0x68faec[_0x84b6('0x7')]());}else{_0x102d95(_0x3b36f6);}});});};EmailSmtp[_0x84b6('0x2')]['verify']=function(_0x5e0f06){return new Promise(function(_0x5363e6,_0x2a0e9c){var _0x3bdee5=nodemailer[_0x84b6('0x3')](_0x5e0f06);_0x3bdee5[_0x84b6('0x8')](function(_0x2ba1a1,_0x32c628){if(_0x2ba1a1){_0x2a0e9c(_0x2ba1a1[_0x84b6('0x7')]());}else{if(_0x32c628){_0x5363e6(_0x32c628);}else{_0x2a0e9c(_0x84b6('0x9'));}}});});};module[_0x84b6('0xa')]=EmailSmtp; \ No newline at end of file +var _0x878f=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile'];(function(_0x57d367,_0x2d1b8b){var _0x21c22f=function(_0x15ced4){while(--_0x15ced4){_0x57d367['push'](_0x57d367['shift']());}};_0x21c22f(++_0x2d1b8b);}(_0x878f,0x118));var _0xf878=function(_0x186fea,_0x29ef55){_0x186fea=_0x186fea-0x0;var _0x5afd5a=_0x878f[_0x186fea];return _0x5afd5a;};'use strict';var nodemailer=require(_0xf878('0x0'));var inlineBase64=require(_0xf878('0x1'));function EmailSmtp(){}EmailSmtp[_0xf878('0x2')][_0xf878('0x3')]=function(_0x2b8d6e,_0x4f3a01){return new Promise(function(_0x2a5200,_0x1d504e){var _0x22a115=nodemailer[_0xf878('0x4')](_0x2b8d6e);_0x22a115['use'](_0xf878('0x5'),inlineBase64());_0x22a115[_0xf878('0x6')](_0x4f3a01,function(_0x54966e,_0x8a4be2){if(_0x54966e){_0x1d504e(_0x54966e[_0xf878('0x7')]());}else{_0x2a5200(_0x8a4be2);}});});};EmailSmtp[_0xf878('0x2')]['verify']=function(_0xfda73c){return new Promise(function(_0x42a5fb,_0x335b84){var _0x32cde7=nodemailer[_0xf878('0x4')](_0xfda73c);_0x32cde7[_0xf878('0x8')](function(_0x1c36a9,_0x5abb57){if(_0x1c36a9){_0x335b84(_0x1c36a9[_0xf878('0x7')]());}else{if(_0x5abb57){_0x42a5fb(_0x5abb57);}else{_0x335b84(_0xf878('0x9'));}}});});};module[_0xf878('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e40eb5b..59a2a2d 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 _0x36a0=['Precedence:\x20auto_reply','line','isAutoreply','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','@xcally.com','value','name','substring','indexOf','split','slice','pop','length','isEmpty','anonymous','generate','html','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','includes','originCc','attachment','filename','attachment-','format','%s-%s','now','join','root','server/files/attachments/','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x36a0,0x194));var _0x036a=function(_0x495bbb,_0x3735af){_0x495bbb=_0x495bbb-0x0;var _0x5acf04=_0x36a0[_0x495bbb];return _0x5acf04;};'use strict';var _=require('lodash');var moment=require(_0x036a('0x0'));var random=require(_0x036a('0x1'));var fs=require('fs');var path=require(_0x036a('0x2'));var util=require(_0x036a('0x3'));var tnef=require(_0x036a('0x4'));var logger=require(_0x036a('0x5'))(_0x036a('0x6'));var config=require(_0x036a('0x7'));function getAddress(_0x594808){var _0xf3eade=_[_0x036a('0x8')](_0x594808['value']);return _0xf3eade&&_0xf3eade[_0x036a('0x9')]?_0xf3eade[_0x036a('0x9')]:'anonymous'+random['generate'](0x6)+_0x036a('0xa');}function getFirstName(_0xad7d37){var _0x3e3b7e=_[_0x036a('0x8')](_0xad7d37[_0x036a('0xb')]);if(_0x3e3b7e&&_0x3e3b7e[_0x036a('0xc')]){if(_0x3e3b7e[_0x036a('0xc')]==_0x3e3b7e['address']){return _0x3e3b7e[_0x036a('0xc')][_0x036a('0xd')](0x0,_0x3e3b7e[_0x036a('0xc')][_0x036a('0xe')]('@'));}var _0x37512a=_0x3e3b7e['name'][_0x036a('0xf')](/\s+/);return _0x37512a['length']>0x1?_0x37512a[_0x036a('0x10')](0x0,-0x1)['join']('\x20'):_0x3e3b7e[_0x036a('0xc')];}return'Anonymous';}function getLastName(_0x234a27){var _0x3a9e42=_[_0x036a('0x8')](_0x234a27[_0x036a('0xb')]);if(_0x3a9e42&&_0x3a9e42[_0x036a('0xc')]){var _0x14d585=_0x3a9e42[_0x036a('0xc')][_0x036a('0xf')](/\s+/);return _0x14d585['length']>0x1?_0x14d585[_0x036a('0x11')]():'';}return'';}function getMails(_0x3e689b,_0x3e7fef){var _0x5b7be0='';for(var _0x5b584b=0x0;_0x5b584b<_0x3e7fef['value'][_0x036a('0x12')];_0x5b584b+=0x1){if(_0x3e7fef[_0x036a('0xb')][_0x5b584b]['address']!==_0x3e689b){if(!_[_0x036a('0x13')](_0x5b7be0)){_0x5b7be0+=',';}_0x5b7be0+=_0x3e7fef[_0x036a('0xb')][_0x5b584b][_0x036a('0xc')]||_0x3e7fef[_0x036a('0xb')][_0x5b584b]['address']||'';_0x5b7be0+='\x20<';_0x5b7be0+=_0x3e7fef['value'][_0x5b584b][_0x036a('0x9')]?_0x3e7fef[_0x036a('0xb')][_0x5b584b][_0x036a('0x9')]:_0x036a('0x14')+random[_0x036a('0x15')](0x6)+'@xcally.com';_0x5b7be0+='>';}}return _0x5b7be0;}function parseEmail(_0x331ebb,_0x286572,_0x5cf0f5){if(_0x286572[_0x036a('0x16')]){var _0x773941=/)<[^<]*)*<\/script>/gi;while(_0x773941['test'](_0x286572[_0x036a('0x16')])){_0x286572['html']=_0x286572[_0x036a('0x16')][_0x036a('0x17')](_0x773941,'');}if(_0x286572[_0x036a('0x16')]['includes'](_0x036a('0x18'))){var _0x5518ab=[];_0x286572[_0x036a('0x19')][_0x036a('0x1a')](_0x1c6f4f=>{_0x5518ab[_0x036a('0x1b')](_0x1c6f4f['filename']);});var _0x16f0a7=/]+>/g;var _0x356365=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x496152=_0x286572[_0x036a('0x16')][_0x036a('0x17')](_0x356365,_0x036a('0x1c'));var _0x18724e=_0x496152[_0x036a('0x17')](_0x16f0a7,_0x036a('0x1d'));for(let _0x269cff=0x0;_0x269cff<_0x5518ab[_0x036a('0x12')];_0x269cff++){var _0x4d2eae=_0x18724e[_0x036a('0x17')](_0x036a('0x1d'),_0x036a('0x1e')+_0x5518ab[_0x269cff]+_0x036a('0x1f'));_0x18724e=_0x4d2eae;}_0x286572[_0x036a('0x16')]=_0x18724e;}_0x5cf0f5['body']=_0x286572['html'];}else{_0x5cf0f5[_0x036a('0x20')]=_0x286572[_0x036a('0x21')];}if(_0x5cf0f5[_0x036a('0x20')]){_0x5cf0f5[_0x036a('0x20')]=_0x5cf0f5[_0x036a('0x20')]['replace'](/0x0){var _0x57ca26=[_0x036a('0x32'),_0x036a('0x33'),_0x036a('0x34')];for(var _0x2ff7b3=0x0;_0x2ff7b3<_0x286572[_0x036a('0x31')][_0x036a('0x12')];_0x2ff7b3++){var _0x4ea3fd=_[_0x036a('0xe')](_0x57ca26,_0x286572[_0x036a('0x31')][_0x2ff7b3][_0x036a('0x35')]);if(_0x4ea3fd>=0x0){_0x5cf0f5[_0x036a('0x36')]=!![];}}}return _0x5cf0f5;}exports['parser']=function(_0x41b8d6,_0x3af69f,_0x559bd8){var _0x58d1a0={'from':getAddress(_0x3af69f[_0x036a('0x37')]),'firstName':getFirstName(_0x3af69f[_0x036a('0x37')]),'lastName':getLastName(_0x3af69f[_0x036a('0x37')]),'mapKey':_0x036a('0x6'),'message':{'from':getMails(_0x41b8d6[_0x036a('0x6')],_0x3af69f[_0x036a('0x37')]),'to':_0x41b8d6[_0x036a('0x6')],'cc':'','subject':_0x3af69f['subject']||'','messageId':_0x3af69f[_0x036a('0x38')],'inReplyTo':_0x3af69f[_0x036a('0x39')],'sentAt':moment(_0x3af69f[_0x036a('0x3a')])[_0x036a('0x29')](_0x036a('0x3b')),'attach':![],'attachments':[]}};if(!_0x3af69f[_0x036a('0x16')]&&!_0x3af69f[_0x036a('0x21')]){var _0x32d716=_[_0x036a('0x3c')](_0x3af69f[_0x036a('0x19')],{'contentType':_0x036a('0x3d')});if(_0x32d716[_0x036a('0x12')]){logger[_0x036a('0x3e')](util[_0x036a('0x29')](_0x036a('0x3f'),_0x3af69f['messageId']));tnef[_0x036a('0x40')](_[_0x036a('0x41')](_0x32d716)['content'],function(_0x23d12d,_0x379e3f){if(_0x379e3f){_0x3af69f[_0x036a('0x16')]=_0x379e3f[_0x036a('0x42')]||_0x036a('0x43');if(_0x379e3f['Attachments']){for(var _0x2fb23a=0x0;_0x2fb23a<_0x379e3f[_0x036a('0x44')][_0x036a('0x12')];_0x2fb23a++){var _0x514f2d=_0x379e3f[_0x036a('0x44')][_0x2fb23a];_0x58d1a0['message']['attachments'][_0x036a('0x1b')]({'filename':_0x514f2d[_0x036a('0x45')],'content':Buffer[_0x036a('0x37')](_0x514f2d['Data'])});}}}_0x559bd8(parseEmail(_0x41b8d6,_0x3af69f,_0x58d1a0));});}else{_0x3af69f[_0x036a('0x16')]=_0x036a('0x43');_0x559bd8(parseEmail(_0x41b8d6,_0x3af69f,_0x58d1a0));}}else{_0x559bd8(parseEmail(_0x41b8d6,_0x3af69f,_0x58d1a0));}};exports[_0x036a('0x46')]=function(_0x57edad,_0xc83dc9){var _0x150da2=[_0x036a('0x47')+(_0xc83dc9||''),_0x036a('0x48')+_0x57edad,'',''];return Buffer[_0x036a('0x37')](_0x150da2[_0x036a('0x2c')](''),_0x036a('0x49'))[_0x036a('0x4a')](_0x036a('0x4b'));}; \ No newline at end of file +var _0xa1e4=['email','head','value','address','generate','name','substring','indexOf','split','length','slice','join','pop','isEmpty','anonymous','@xcally.com','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc','attach','type','attachment','format','%s-%s','root','server/files/attachments/','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','

Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger'];(function(_0x3f1014,_0x34bc1c){var _0x1cd499=function(_0x410820){while(--_0x410820){_0x3f1014['push'](_0x3f1014['shift']());}};_0x1cd499(++_0x34bc1c);}(_0xa1e4,0x15d));var _0x4a1e=function(_0xac3328,_0x23745a){_0xac3328=_0xac3328-0x0;var _0x33aec4=_0xa1e4[_0xac3328];return _0x33aec4;};'use strict';var _=require(_0x4a1e('0x0'));var moment=require(_0x4a1e('0x1'));var random=require(_0x4a1e('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x4a1e('0x3'));var tnef=require(_0x4a1e('0x4'));var logger=require(_0x4a1e('0x5'))(_0x4a1e('0x6'));var config=require('../../../config/environment');function getAddress(_0x65ab85){var _0x5b6294=_[_0x4a1e('0x7')](_0x65ab85[_0x4a1e('0x8')]);return _0x5b6294&&_0x5b6294['address']?_0x5b6294[_0x4a1e('0x9')]:'anonymous'+random[_0x4a1e('0xa')](0x6)+'@xcally.com';}function getFirstName(_0xf87a5c){var _0x44a735=_[_0x4a1e('0x7')](_0xf87a5c[_0x4a1e('0x8')]);if(_0x44a735&&_0x44a735[_0x4a1e('0xb')]){if(_0x44a735[_0x4a1e('0xb')]==_0x44a735[_0x4a1e('0x9')]){return _0x44a735[_0x4a1e('0xb')][_0x4a1e('0xc')](0x0,_0x44a735[_0x4a1e('0xb')][_0x4a1e('0xd')]('@'));}var _0x3b52c2=_0x44a735[_0x4a1e('0xb')][_0x4a1e('0xe')](/\s+/);return _0x3b52c2[_0x4a1e('0xf')]>0x1?_0x3b52c2[_0x4a1e('0x10')](0x0,-0x1)[_0x4a1e('0x11')]('\x20'):_0x44a735[_0x4a1e('0xb')];}return'Anonymous';}function getLastName(_0x55ec00){var _0x33bd83=_[_0x4a1e('0x7')](_0x55ec00['value']);if(_0x33bd83&&_0x33bd83[_0x4a1e('0xb')]){var _0x2e1d8e=_0x33bd83[_0x4a1e('0xb')][_0x4a1e('0xe')](/\s+/);return _0x2e1d8e['length']>0x1?_0x2e1d8e[_0x4a1e('0x12')]():'';}return'';}function getMails(_0x22e99d,_0x4c49c1){var _0x1a1472='';for(var _0x4be7cf=0x0;_0x4be7cf<_0x4c49c1[_0x4a1e('0x8')]['length'];_0x4be7cf+=0x1){if(_0x4c49c1['value'][_0x4be7cf][_0x4a1e('0x9')]!==_0x22e99d){if(!_[_0x4a1e('0x13')](_0x1a1472)){_0x1a1472+=',';}_0x1a1472+=_0x4c49c1[_0x4a1e('0x8')][_0x4be7cf]['name']||_0x4c49c1[_0x4a1e('0x8')][_0x4be7cf][_0x4a1e('0x9')]||'';_0x1a1472+='\x20<';_0x1a1472+=_0x4c49c1[_0x4a1e('0x8')][_0x4be7cf]['address']?_0x4c49c1[_0x4a1e('0x8')][_0x4be7cf]['address']:_0x4a1e('0x14')+random[_0x4a1e('0xa')](0x6)+_0x4a1e('0x15');_0x1a1472+='>';}}return _0x1a1472;}function parseEmail(_0x3f2f76,_0x3f87a4,_0x2bf5fd){if(_0x3f87a4[_0x4a1e('0x16')]){var _0xa46abf=/)<[^<]*)*<\/script>/gi;while(_0xa46abf['test'](_0x3f87a4[_0x4a1e('0x16')])){_0x3f87a4[_0x4a1e('0x16')]=_0x3f87a4[_0x4a1e('0x16')][_0x4a1e('0x17')](_0xa46abf,'');}if(_0x3f87a4['html'][_0x4a1e('0x18')](_0x4a1e('0x19'))){var _0xa6688e=[];_0x3f87a4[_0x4a1e('0x1a')][_0x4a1e('0x1b')](_0x525f62=>{_0xa6688e[_0x4a1e('0x1c')](_0x525f62[_0x4a1e('0x1d')]);});var _0xa916f3=/]+>/g;var _0x11145a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3c4dc7=_0x3f87a4['html'][_0x4a1e('0x17')](_0x11145a,'_SRC');var _0x5d1c7f=_0x3c4dc7[_0x4a1e('0x17')](_0xa916f3,_0x4a1e('0x1e'));for(let _0x35700f=0x0;_0x35700f<_0xa6688e[_0x4a1e('0xf')];_0x35700f++){var _0x7e9880=_0x5d1c7f[_0x4a1e('0x17')](_0x4a1e('0x1e'),_0x4a1e('0x1f')+_0xa6688e[_0x35700f]+_0x4a1e('0x20'));_0x5d1c7f=_0x7e9880;}_0x3f87a4['html']=_0x5d1c7f;}_0x2bf5fd[_0x4a1e('0x21')]=_0x3f87a4['html'];}else{_0x2bf5fd[_0x4a1e('0x21')]=_0x3f87a4[_0x4a1e('0x22')];}if(_0x2bf5fd[_0x4a1e('0x21')]){_0x2bf5fd[_0x4a1e('0x21')]=_0x2bf5fd[_0x4a1e('0x21')][_0x4a1e('0x17')](/0x0){var _0x197864=[_0x4a1e('0x31'),_0x4a1e('0x32'),'Precedence:\x20auto_reply'];for(var _0x4d3a9d=0x0;_0x4d3a9d<_0x3f87a4[_0x4a1e('0x30')]['length'];_0x4d3a9d++){var _0x567d20=_[_0x4a1e('0xd')](_0x197864,_0x3f87a4[_0x4a1e('0x30')][_0x4d3a9d][_0x4a1e('0x33')]);if(_0x567d20>=0x0){_0x2bf5fd[_0x4a1e('0x34')]=!![];}}}return _0x2bf5fd;}exports['parser']=function(_0x29f14d,_0x5887cf,_0x19f79a){var _0x5b09e9={'from':getAddress(_0x5887cf['from']),'firstName':getFirstName(_0x5887cf[_0x4a1e('0x35')]),'lastName':getLastName(_0x5887cf[_0x4a1e('0x35')]),'mapKey':_0x4a1e('0x6'),'message':{'from':getMails(_0x29f14d[_0x4a1e('0x6')],_0x5887cf[_0x4a1e('0x35')]),'to':_0x29f14d['email'],'cc':'','subject':_0x5887cf['subject']||'','messageId':_0x5887cf[_0x4a1e('0x36')],'inReplyTo':_0x5887cf[_0x4a1e('0x37')],'sentAt':moment(_0x5887cf[_0x4a1e('0x38')])['format'](_0x4a1e('0x39')),'attach':![],'attachments':[]}};if(!_0x5887cf[_0x4a1e('0x16')]&&!_0x5887cf[_0x4a1e('0x22')]){var _0x3a734c=_[_0x4a1e('0x3a')](_0x5887cf['attachments'],{'contentType':'application/ms-tnef'});if(_0x3a734c['length']){logger[_0x4a1e('0x3b')](util[_0x4a1e('0x2a')](_0x4a1e('0x3c'),_0x5887cf[_0x4a1e('0x36')]));tnef['parseBuffer'](_[_0x4a1e('0x3d')](_0x3a734c)['content'],function(_0x54ee60,_0x3fccab){if(_0x3fccab){_0x5887cf[_0x4a1e('0x16')]=_0x3fccab['BodyHTML']||_0x4a1e('0x3e');if(_0x3fccab[_0x4a1e('0x3f')]){for(var _0x5edcba=0x0;_0x5edcba<_0x3fccab[_0x4a1e('0x3f')][_0x4a1e('0xf')];_0x5edcba++){var _0x1b6724=_0x3fccab[_0x4a1e('0x3f')][_0x5edcba];_0x5b09e9[_0x4a1e('0x23')][_0x4a1e('0x1a')][_0x4a1e('0x1c')]({'filename':_0x1b6724[_0x4a1e('0x40')],'content':Buffer[_0x4a1e('0x35')](_0x1b6724[_0x4a1e('0x41')])});}}}_0x19f79a(parseEmail(_0x29f14d,_0x5887cf,_0x5b09e9));});}else{_0x5887cf[_0x4a1e('0x16')]=_0x4a1e('0x3e');_0x19f79a(parseEmail(_0x29f14d,_0x5887cf,_0x5b09e9));}}else{_0x19f79a(parseEmail(_0x29f14d,_0x5887cf,_0x5b09e9));}};exports['generateXOAuth2Token']=function(_0x2f9c54,_0x3b57ad){var _0xa64ffd=[_0x4a1e('0x42')+(_0x3b57ad||''),_0x4a1e('0x43')+_0x2f9c54,'',''];return Buffer[_0x4a1e('0x35')](_0xa64ffd[_0x4a1e('0x11')](''),_0x4a1e('0x44'))[_0x4a1e('0x45')](_0x4a1e('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 21335a7..28cf6e8 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 _0x19e4=['Service','key','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0xf330eb,_0x44f1ca){var _0x11c17c=function(_0x9fd221){while(--_0x9fd221){_0xf330eb['push'](_0xf330eb['shift']());}};_0x11c17c(++_0x44f1ca);}(_0x19e4,0x115));var _0x419e=function(_0x71fdbc,_0xc528f2){_0x71fdbc=_0x71fdbc-0x0;var _0x5ec9f8=_0x19e4[_0x71fdbc];return _0x5ec9f8;};'use strict';var _=require(_0x419e('0x0'));function MailAccount(_0x1ea416){this['id']=_0x1ea416['id']||0x0;this[_0x419e('0x1')]=_0x1ea416[_0x419e('0x1')]||_0x419e('0x2');this[_0x419e('0x3')]=_0x1ea416['key']||_0x419e('0x4');this['active']=_0x1ea416[_0x419e('0x5')]||![];this[_0x419e('0x6')]=_0x1ea416[_0x419e('0x6')]||[];this['Smtp']=_0x1ea416[_0x419e('0x7')]||[];}module[_0x419e('0x8')]=MailAccount; \ No newline at end of file +var _0xb0c4=['lodash','name','Service','key','SERV','active','Smtp'];(function(_0x351aad,_0x146763){var _0x3f4ef4=function(_0x51c4a2){while(--_0x51c4a2){_0x351aad['push'](_0x351aad['shift']());}};_0x3f4ef4(++_0x146763);}(_0xb0c4,0x10a));var _0x4b0c=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0xb0c4[_0x2850c0];return _0x21e830;};'use strict';var _=require(_0x4b0c('0x0'));function MailAccount(_0x34988e){this['id']=_0x34988e['id']||0x0;this[_0x4b0c('0x1')]=_0x34988e['name']||_0x4b0c('0x2');this[_0x4b0c('0x3')]=_0x34988e[_0x4b0c('0x3')]||_0x4b0c('0x4');this[_0x4b0c('0x5')]=_0x34988e[_0x4b0c('0x5')]||![];this['Imap']=_0x34988e['Imap']||[];this[_0x4b0c('0x6')]=_0x34988e[_0x4b0c('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 772dbf2..b932558 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 _0xa783=['merge','exports','lodash','../model/mailAccount','mapKeys','prototype','mergeFromDatabase','initMailAccounts','mailAccounts','isUndefined'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa783,0xca));var _0x3a78=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xa783[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x3a78('0x0'));var MailAccount=require(_0x3a78('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x59d333,_0x1d2533,_0x524fcc){var _0x58b138=_[_0x3a78('0x2')](_0x59d333,function(_0x544f1f,_0x72ea56){return _0x544f1f[_0x524fcc];});for(var _0x52b3d3 in _0x1d2533){if(_0x1d2533['hasOwnProperty'](_0x52b3d3)){if(!_0x58b138[_0x52b3d3]){delete _0x1d2533[_0x52b3d3];}}}}Realtime[_0x3a78('0x3')][_0x3a78('0x4')]=function(_0x2c639a,_0x114070){for(var _0x48be68 in _0x114070){if(_0x2c639a['hasOwnProperty'](_0x48be68)){_0x2c639a[_0x48be68]=_0x114070[_0x48be68];}}};Realtime['prototype'][_0x3a78('0x5')]=function(){var _0x30061f=this;return function(_0x5a358c){if(_0x5a358c){freeIsNotKey(_0x5a358c,_0x30061f[_0x3a78('0x6')],'id');for(var _0x5d6f30=0x0,_0x28bca4={},_0x3f3fa3={};_0x5d6f30<_0x5a358c['length'];_0x5d6f30+=0x1){_0x28bca4=_0x5a358c[_0x5d6f30];if(_[_0x3a78('0x7')](_0x30061f[_0x3a78('0x6')][_0x28bca4['id']])){_0x30061f[_0x3a78('0x6')][_0x28bca4['id']]=new MailAccount(_0x28bca4);}else{_[_0x3a78('0x8')](_0x30061f[_0x3a78('0x6')][_0x28bca4['id']],_0x28bca4);}}}return _0x30061f[_0x3a78('0x6')];};};module[_0x3a78('0x9')]=Realtime; \ No newline at end of file +var _0xbd69=['mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','merge','exports','lodash','../model/mailAccount'];(function(_0x2fd5c3,_0x2a5b6b){var _0x2752ca=function(_0x21162a){while(--_0x21162a){_0x2fd5c3['push'](_0x2fd5c3['shift']());}};_0x2752ca(++_0x2a5b6b);}(_0xbd69,0x198));var _0x9bd6=function(_0x25a081,_0xe0ca73){_0x25a081=_0x25a081-0x0;var _0x188ad7=_0xbd69[_0x25a081];return _0x188ad7;};'use strict';var _=require(_0x9bd6('0x0'));var MailAccount=require(_0x9bd6('0x1'));var Realtime=function(){this[_0x9bd6('0x2')]={};};function freeIsNotKey(_0xfc764c,_0x476c0a,_0x4bbff1){var _0x4a7853=_[_0x9bd6('0x3')](_0xfc764c,function(_0x3a9757,_0x1e7689){return _0x3a9757[_0x4bbff1];});for(var _0x27129c in _0x476c0a){if(_0x476c0a[_0x9bd6('0x4')](_0x27129c)){if(!_0x4a7853[_0x27129c]){delete _0x476c0a[_0x27129c];}}}}Realtime[_0x9bd6('0x5')]['mergeFromDatabase']=function(_0x16c0da,_0x12cb3d){for(var _0x5b1413 in _0x12cb3d){if(_0x16c0da[_0x9bd6('0x4')](_0x5b1413)){_0x16c0da[_0x5b1413]=_0x12cb3d[_0x5b1413];}}};Realtime[_0x9bd6('0x5')][_0x9bd6('0x6')]=function(){var _0x4548b4=this;return function(_0x5ee346){if(_0x5ee346){freeIsNotKey(_0x5ee346,_0x4548b4['mailAccounts'],'id');for(var _0x3e379e=0x0,_0x43754e={},_0x51a695={};_0x3e379e<_0x5ee346[_0x9bd6('0x7')];_0x3e379e+=0x1){_0x43754e=_0x5ee346[_0x3e379e];if(_['isUndefined'](_0x4548b4['mailAccounts'][_0x43754e['id']])){_0x4548b4[_0x9bd6('0x2')][_0x43754e['id']]=new MailAccount(_0x43754e);}else{_[_0x9bd6('0x8')](_0x4548b4[_0x9bd6('0x2')][_0x43754e['id']],_0x43754e);}}}return _0x4548b4[_0x9bd6('0x2')];};};module[_0x9bd6('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index b7ad0df..17c68b0 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 _0x326f=['NotifyMailAccount','../client','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','CloudProvider','type','Smtp','notify'];(function(_0x5d2a31,_0x4920fb){var _0x577a7e=function(_0x164c39){while(--_0x164c39){_0x5d2a31['push'](_0x5d2a31['shift']());}};_0x577a7e(++_0x4920fb);}(_0x326f,0xd1));var _0xf326=function(_0x3f4b07,_0x50f4fb){_0x3f4b07=_0x3f4b07-0x0;var _0x3b2a54=_0x326f[_0x3f4b07];return _0x3b2a54;};'use strict';var client=require(_0xf326('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9')],'raw':![],'include':[{'model':_0xf326('0xa'),'as':'Imap','include':[{'model':_0xf326('0xb'),'attributes':['id',_0xf326('0x2'),_0xf326('0x4'),_0xf326('0xc'),'data5'],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xf326('0xd'),'include':[{'model':_0xf326('0xb'),'attributes':['id',_0xf326('0x2'),_0xf326('0x4'),_0xf326('0xc'),'data5'],'as':_0xf326('0xb')}]}]},'log':'getMailAccount'});};};exports[_0xf326('0xe')]=function(_0x4aaf3a,_0x2e4b71){return client['Request'](_0xf326('0xf'),{'account':{'id':_0x4aaf3a},'body':_0x2e4b71,'log':_0xf326('0xf')});}; \ No newline at end of file +var _0xbff5=['getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','active','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','Smtp'];(function(_0x5da984,_0x47e5c1){var _0x4cf0aa=function(_0x3e804c){while(--_0x3e804c){_0x5da984['push'](_0x5da984['shift']());}};_0x4cf0aa(++_0x47e5c1);}(_0xbff5,0x1bc));var _0x5bff=function(_0x2c6cad,_0x1490a4){_0x2c6cad=_0x2c6cad-0x0;var _0x76eee=_0xbff5[_0x2c6cad];return _0x76eee;};'use strict';var client=require(_0x5bff('0x0'));exports[_0x5bff('0x1')]=function(){return function(){return client[_0x5bff('0x2')](_0x5bff('0x3'),{'options':{'attributes':['id',_0x5bff('0x4'),_0x5bff('0x5'),_0x5bff('0x6'),'email',_0x5bff('0x7'),'key','ListId',_0x5bff('0x8')],'raw':![],'include':[{'model':_0x5bff('0x9'),'as':_0x5bff('0xa'),'include':[{'model':_0x5bff('0xb'),'attributes':['id',_0x5bff('0x4'),_0x5bff('0x6'),_0x5bff('0xc'),_0x5bff('0xd')],'as':_0x5bff('0xb')}]},{'model':'MailServerOut','as':_0x5bff('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x5bff('0x4'),_0x5bff('0x6'),'type',_0x5bff('0xd')],'as':'CloudProvider'}]}]},'log':_0x5bff('0xf')});};};exports['notify']=function(_0x207835,_0x135003){return client['Request'](_0x5bff('0x10'),{'account':{'id':_0x207835},'body':_0x135003,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index a8be8e7..b47d51b 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 _0xc3e3=['getSettings','Request','loginMailFrequency','GetSettings','../client'];(function(_0xc673c0,_0x11e738){var _0x256ce5=function(_0x535c84){while(--_0x535c84){_0xc673c0['push'](_0xc673c0['shift']());}};_0x256ce5(++_0x11e738);}(_0xc3e3,0xfe));var _0x3c3e=function(_0x1268f4,_0x147117){_0x1268f4=_0x1268f4-0x0;var _0x2f1b05=_0xc3e3[_0x1268f4];return _0x2f1b05;};'use strict';var client=require(_0x3c3e('0x0'));exports[_0x3c3e('0x1')]=function(){return client[_0x3c3e('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3c3e('0x3')]},'log':_0x3c3e('0x4')});}; \ No newline at end of file +var _0x41a7=['GetSettings','../client','Request','ShowSetting'];(function(_0x2627e5,_0x5b8a5c){var _0x14a553=function(_0x3b2aff){while(--_0x3b2aff){_0x2627e5['push'](_0x2627e5['shift']());}};_0x14a553(++_0x5b8a5c);}(_0x41a7,0x101));var _0x741a=function(_0x3b87e6,_0xd3df37){_0x3b87e6=_0x3b87e6-0x0;var _0x132778=_0x41a7[_0x3b87e6];return _0x132778;};'use strict';var client=require(_0x741a('0x0'));exports['getSettings']=function(){return client[_0x741a('0x1')](_0x741a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x741a('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 9a28190..a6357a1 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(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 92c757d..3b8ac07 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 _0xb5cb=['ioredis','../../config/environment','createServer','timeout','socket.io','websocket','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express'];(function(_0x4edb51,_0x5c79ce){var _0x22fcf5=function(_0x4aefb6){while(--_0x4aefb6){_0x4edb51['push'](_0x4edb51['shift']());}};_0x22fcf5(++_0x5c79ce);}(_0xb5cb,0x173));var _0xbb5c=function(_0x243f64,_0x510ea8){_0x243f64=_0x243f64-0x0;var _0x44d876=_0xb5cb[_0x243f64];return _0x44d876;};'use strict';var _=require(_0xbb5c('0x0'));var http=require(_0xbb5c('0x1'));var express=require(_0xbb5c('0x2'));var sticky=require('sticky-session');var Redis=require(_0xbb5c('0x3'));var config=require(_0xbb5c('0x4'));var app=express();var server=http[_0xbb5c('0x5')](app);server[_0xbb5c('0x6')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xbb5c('0x7'))(server,{'transports':[_0xbb5c('0x8'),'polling']});config[_0xbb5c('0x9')]=_[_0xbb5c('0xa')](config['redis'],{'host':_0xbb5c('0xb'),'port':0x18eb});socketio[_0xbb5c('0xc')](require(_0xbb5c('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0xbb5c('0xe'))['default']();require('../../config/socketio')[_0xbb5c('0xf')](socketio);require(_0xbb5c('0x10'))['default'](app);require(_0xbb5c('0x11'))[_0xbb5c('0xf')](app);}else{server['once'](_0xbb5c('0x12'),function(){console[_0xbb5c('0x13')](_0xbb5c('0x14'),config['port']);});}exports=module[_0xbb5c('0x15')]=app; \ No newline at end of file +var _0xd9f9=['socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','express','sticky-session','../../config/environment','createServer','timeout','listen','socket.io','websocket','redis','defaults','localhost'];(function(_0x1d73ab,_0x4db32c){var _0x2ed1df=function(_0x245cc6){while(--_0x245cc6){_0x1d73ab['push'](_0x1d73ab['shift']());}};_0x2ed1df(++_0x4db32c);}(_0xd9f9,0x17b));var _0x9d9f=function(_0x5e9840,_0x1a8fac){_0x5e9840=_0x5e9840-0x0;var _0x213781=_0xd9f9[_0x5e9840];return _0x213781;};'use strict';var _=require(_0x9d9f('0x0'));var http=require('http');var express=require(_0x9d9f('0x1'));var sticky=require(_0x9d9f('0x2'));var Redis=require('ioredis');var config=require(_0x9d9f('0x3'));var app=express();var server=http[_0x9d9f('0x4')](app);server[_0x9d9f('0x5')]=0xdbba0;if(sticky[_0x9d9f('0x6')](server,config['port'])){var socketio=require(_0x9d9f('0x7'))(server,{'transports':[_0x9d9f('0x8'),'polling']});config[_0x9d9f('0x9')]=_[_0x9d9f('0xa')](config[_0x9d9f('0x9')],{'host':_0x9d9f('0xb'),'port':0x18eb});socketio['adapter'](require(_0x9d9f('0xc'))({'pubClient':new Redis(config[_0x9d9f('0x9')]),'subClient':new Redis(config[_0x9d9f('0x9')])}));require(_0x9d9f('0xd'))[_0x9d9f('0xe')]();require(_0x9d9f('0xf'))[_0x9d9f('0xe')](socketio);require(_0x9d9f('0x10'))[_0x9d9f('0xe')](app);require(_0x9d9f('0x11'))[_0x9d9f('0xe')](app);}else{server['once'](_0x9d9f('0x12'),function(){console[_0x9d9f('0x13')](_0x9d9f('0x14'),config[_0x9d9f('0x15')]);});}exports=module[_0x9d9f('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 6c4fda9..e600ac4 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 _0x450e=['error','message','catch','exports','jayson/promise','routing','debug','rpc'];(function(_0x5470ba,_0x21ea89){var _0x1ed61e=function(_0x187c11){while(--_0x187c11){_0x5470ba['push'](_0x5470ba['shift']());}};_0x1ed61e(++_0x21ea89);}(_0x450e,0xd4));var _0xe450=function(_0x38f0c3,_0xd4eaf7){_0x38f0c3=_0x38f0c3-0x0;var _0x4187a4=_0x450e[_0x38f0c3];return _0x4187a4;};'use strict';var jayson=require(_0xe450('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xe450('0x1'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x34599f,_0x12ee79){return new BPromise(function(_0x139418,_0x46225){return client['request'](_0x34599f,_0x12ee79)['then'](function(_0x3a1866){logger[_0xe450('0x2')](_0xe450('0x3'),_0xe450('0x1'),_0x34599f,_0x12ee79,_0x3a1866);if(_0x3a1866[_0xe450('0x4')]){logger[_0xe450('0x4')](_0xe450('0x3'),_0xe450('0x1'),_0x34599f,_0x3a1866['error'][_0xe450('0x5')],_0x12ee79);return _0x46225(_0x3a1866[_0xe450('0x4')][_0xe450('0x5')]);}else{return _0x139418(_0x3a1866['result']);}})[_0xe450('0x6')](function(_0x1c04ae){logger[_0xe450('0x4')](_0xe450('0x3'),_0xe450('0x1'),_0x34599f,_0x1c04ae,_0x12ee79);return _0x46225(_0x1c04ae);});});};module[_0xe450('0x7')]=client; \ No newline at end of file +var _0xc8a5=['debug','error','rpc','result','catch','exports','jayson/promise','bluebird','routing','Request','request'];(function(_0x1ac035,_0x31012b){var _0x1148bf=function(_0x515d7e){while(--_0x515d7e){_0x1ac035['push'](_0x1ac035['shift']());}};_0x1148bf(++_0x31012b);}(_0xc8a5,0x7f));var _0x5c8a=function(_0x47f00d,_0x536faf){_0x47f00d=_0x47f00d-0x0;var _0x24e599=_0xc8a5[_0x47f00d];return _0x24e599;};'use strict';var jayson=require(_0x5c8a('0x0'));var BPromise=require(_0x5c8a('0x1'));var logger=require('../../config/logger')(_0x5c8a('0x2'));var client=jayson['client']['http']({'port':0x2329});client[_0x5c8a('0x3')]=function(_0x1374cf,_0x2bf02b){return new BPromise(function(_0x1f5896,_0xdbd8e4){return client[_0x5c8a('0x4')](_0x1374cf,_0x2bf02b)['then'](function(_0x4b3da8){logger[_0x5c8a('0x5')]('rpc','routing',_0x1374cf,_0x2bf02b,_0x4b3da8);if(_0x4b3da8[_0x5c8a('0x6')]){logger[_0x5c8a('0x6')](_0x5c8a('0x7'),'routing',_0x1374cf,_0x4b3da8[_0x5c8a('0x6')]['message'],_0x2bf02b);return _0xdbd8e4(_0x4b3da8[_0x5c8a('0x6')]['message']);}else{return _0x1f5896(_0x4b3da8[_0x5c8a('0x8')]);}})[_0x5c8a('0x9')](function(_0x458335){logger[_0x5c8a('0x6')](_0x5c8a('0x7'),_0x5c8a('0x2'),_0x1374cf,_0x458335,_0x2bf02b);return _0xdbd8e4(_0x458335);});});};module[_0x5c8a('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index f7e45d3..7c54f29 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 _0x0767=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue'];(function(_0x19374f,_0x14862f){var _0xdcfeb=function(_0x3a995b){while(--_0x3a995b){_0x19374f['push'](_0x19374f['shift']());}};_0xdcfeb(++_0x14862f);}(_0x0767,0x78));var _0x7076=function(_0x42ce62,_0x41f020){_0x42ce62=_0x42ce62-0x0;var _0x417b6a=_0x0767[_0x42ce62];return _0x417b6a;};'use strict';var BPromise=require(_0x7076('0x0'));var server=require('./server');var Realtime=require(_0x7076('0x1'));var user=require(_0x7076('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x7076('0x3'));var chatQueue=require(_0x7076('0x4'));var smsQueue=require(_0x7076('0x5'));var mailQueue=require(_0x7076('0x6'));var faxQueue=require(_0x7076('0x7'));var whatsappQueue=require(_0x7076('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7076('0x9')]()[_0x7076('0xa')](user[_0x7076('0xb')]())[_0x7076('0xa')](realtime['initAgents']())[_0x7076('0xa')](interval[_0x7076('0xc')]())[_0x7076('0xa')](realtime['initIntervals']())[_0x7076('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x7076('0xa')](realtime[_0x7076('0xd')]())['then'](chatQueue[_0x7076('0xe')]())['then'](realtime[_0x7076('0xf')]())[_0x7076('0xa')](smsQueue[_0x7076('0x10')]())[_0x7076('0xa')](realtime['initSmsQueues']())[_0x7076('0xa')](mailQueue[_0x7076('0x11')]())['then'](realtime[_0x7076('0x12')]())['then'](faxQueue[_0x7076('0x13')]())['then'](realtime[_0x7076('0x14')]())[_0x7076('0xa')](whatsappQueue[_0x7076('0x15')]())[_0x7076('0xa')](realtime['initWhatsappQueues']())[_0x7076('0xa')](function(){return realtime;});}function main(){return server[_0x7076('0x16')](realtime)['then'](function(_0x43bc93){return initRealtime();})[_0x7076('0xa')](function(_0x106dce){return setInterval(initRealtime,0x1388);})[_0x7076('0x17')](function(_0x31842e){console[_0x7076('0x18')](_0x31842e);});}main(); \ No newline at end of file +var _0x7f17=['initWhatsappQueues','catch','bluebird','./server','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getFaxQueues'];(function(_0x492273,_0x4cd32c){var _0x1ace99=function(_0x516edb){while(--_0x516edb){_0x492273['push'](_0x492273['shift']());}};_0x1ace99(++_0x4cd32c);}(_0x7f17,0xca));var _0x77f1=function(_0x1249f4,_0x27226c){_0x1249f4=_0x1249f4-0x0;var _0x47c8a9=_0x7f17[_0x1249f4];return _0x47c8a9;};'use strict';var BPromise=require(_0x77f1('0x0'));var server=require(_0x77f1('0x1'));var Realtime=require('./realtime');var user=require(_0x77f1('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x77f1('0x3'));var chatQueue=require(_0x77f1('0x4'));var smsQueue=require(_0x77f1('0x5'));var mailQueue=require(_0x77f1('0x6'));var faxQueue=require(_0x77f1('0x7'));var whatsappQueue=require(_0x77f1('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x77f1('0x9')]()[_0x77f1('0xa')](user[_0x77f1('0xb')]())[_0x77f1('0xa')](realtime['initAgents']())['then'](interval[_0x77f1('0xc')]())[_0x77f1('0xa')](realtime['initIntervals']())[_0x77f1('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x77f1('0xa')](realtime[_0x77f1('0xd')]())[_0x77f1('0xa')](chatQueue[_0x77f1('0xe')]())[_0x77f1('0xa')](realtime['initChatQueues']())[_0x77f1('0xa')](smsQueue[_0x77f1('0xf')]())[_0x77f1('0xa')](realtime[_0x77f1('0x10')]())[_0x77f1('0xa')](mailQueue['getMailQueues']())[_0x77f1('0xa')](realtime['initMailQueues']())[_0x77f1('0xa')](faxQueue[_0x77f1('0x11')]())[_0x77f1('0xa')](realtime['initFaxQueues']())[_0x77f1('0xa')](whatsappQueue['getWhatsappQueues']())[_0x77f1('0xa')](realtime[_0x77f1('0x12')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x4f17fe){return initRealtime();})[_0x77f1('0xa')](function(_0x41a2d7){return setInterval(initRealtime,0x1388);})[_0x77f1('0x13')](function(_0x25bffb){console['log'](_0x25bffb);});}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 31ede43..e42c801 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0xc65834,_0x5df6fb){var _0x5da298=function(_0x30fbc2){while(--_0x30fbc2){_0xc65834['push'](_0xc65834['shift']());}};_0x5da298(++_0x5df6fb);}(_0x326f,0xd1));var _0xf326=function(_0x29f514,_0x4da99c){_0x29f514=_0x29f514-0x0;var _0x49b78b=_0x326f[_0x29f514];return _0x49b78b;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x27b0c4,_0xaf6d02){var _0xcb87b2=function(_0x2bd20f){while(--_0x2bd20f){_0x27b0c4['push'](_0x27b0c4['shift']());}};_0xcb87b2(++_0xaf6d02);}(_0x326f,0xd1));var _0xf326=function(_0x2b4a39,_0x4c7979){_0x2b4a39=_0x2b4a39-0x0;var _0x4e0f68=_0x326f[_0x2b4a39];return _0x4e0f68;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 69a0105..1a5116f 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 _0x9a51=['bluebird','jayson/promise','client','http','request','then','error','message','result','catch','SendMail'];(function(_0x2d1c86,_0xb2e508){var _0x3767e4=function(_0x187135){while(--_0x187135){_0x2d1c86['push'](_0x2d1c86['shift']());}};_0x3767e4(++_0xb2e508);}(_0x9a51,0xc6));var _0x19a5=function(_0x54bc96,_0x20cb68){_0x54bc96=_0x54bc96-0x0;var _0x4685b9=_0x9a51[_0x54bc96];return _0x4685b9;};'use strict';var BPromise=require(_0x19a5('0x0'));var jayson=require(_0x19a5('0x1'));var client=jayson[_0x19a5('0x2')][_0x19a5('0x3')]({'port':0x232b});function request(_0x1ce3bb,_0x18508f){return new BPromise(function(_0x174e69,_0x2a6a5f){return client[_0x19a5('0x4')](_0x1ce3bb,_0x18508f)[_0x19a5('0x5')](function(_0x5632da){if(_0x5632da['error']){return _0x2a6a5f(_0x5632da[_0x19a5('0x6')][_0x19a5('0x7')]);}else{return _0x174e69(_0x5632da[_0x19a5('0x8')]);}})[_0x19a5('0x9')](function(_0x523bce){return _0x2a6a5f(_0x523bce);});});}exports['sendMailMessage']=function(_0x2628dd,_0x4788a4){return request(_0x19a5('0xa'),{'account':_0x2628dd,'message':_0x4788a4});}; \ No newline at end of file +var _0x6249=['sendMailMessage','SendMail','bluebird','jayson/promise','http','request','then','error','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6249,0xd4));var _0x9624=function(_0x320584,_0x2e6e3b){_0x320584=_0x320584-0x0;var _0x9e355a=_0x6249[_0x320584];return _0x9e355a;};'use strict';var BPromise=require(_0x9624('0x0'));var jayson=require(_0x9624('0x1'));var client=jayson['client'][_0x9624('0x2')]({'port':0x232b});function request(_0x583ca9,_0x3085f3){return new BPromise(function(_0x1d338f,_0x166209){return client[_0x9624('0x3')](_0x583ca9,_0x3085f3)[_0x9624('0x4')](function(_0xe525dd){if(_0xe525dd[_0x9624('0x5')]){return _0x166209(_0xe525dd['error']['message']);}else{return _0x1d338f(_0xe525dd[_0x9624('0x6')]);}})[_0x9624('0x7')](function(_0x505e78){return _0x166209(_0x505e78);});});}exports[_0x9624('0x8')]=function(_0x442c9c,_0x5df602){return request(_0x9624('0x9'),{'account':_0x442c9c,'message':_0x5df602});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 30b6d58..5707759 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 _0x4c86=['openchannelStatusTime','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatPause','mailStatus','faxCurrentCapacity','smsStatus','smsCurrentCapacity','openchannelCapacity','busy','chatWaitingInteractions','openchannelWaitingInteractions','stringify','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus'];(function(_0x4b6e15,_0x6028d7){var _0x160e6c=function(_0x1c7337){while(--_0x1c7337){_0x4b6e15['push'](_0x4b6e15['shift']());}};_0x160e6c(++_0x6028d7);}(_0x4c86,0x68));var _0x64c8=function(_0x18a119,_0x18857e){_0x18a119=_0x18a119-0x0;var _0x46fd77=_0x4c86[_0x18a119];return _0x46fd77;};'use strict';var _=require(_0x64c8('0x0'));var moment=require(_0x64c8('0x1'));var md5=require(_0x64c8('0x2'));var Redis=require(_0x64c8('0x3'));var config=require(_0x64c8('0x4'));config['redis']=_[_0x64c8('0x5')](config[_0x64c8('0x6')],{'host':_0x64c8('0x7'),'port':0x18eb});var io=require(_0x64c8('0x8'))(new Redis(config[_0x64c8('0x6')]));function Agent(_0x127d08){this['id']=_0x127d08['id']||0x0;this[_0x64c8('0x9')]=_0x127d08[_0x64c8('0x9')]||'';this[_0x64c8('0xa')]=_0x127d08[_0x64c8('0xa')]||!![];this['voicePause']=_0x127d08['voicePause']||![];this['chatPause']=_0x127d08['chatPause']||![];this['mailPause']=_0x127d08[_0x64c8('0xb')]||![];this[_0x64c8('0xc')]=_0x127d08[_0x64c8('0xc')]||![];this[_0x64c8('0xd')]=_0x127d08[_0x64c8('0xd')]||![];this[_0x64c8('0xe')]=_0x127d08[_0x64c8('0xe')]||![];this[_0x64c8('0xf')]=_0x64c8('0x10');this[_0x64c8('0x11')]=0x0;this[_0x64c8('0x12')]=_0x127d08[_0x64c8('0x12')]||0x0;this[_0x64c8('0x13')]=0x0;this['mailStatus']=_0x64c8('0x10');this[_0x64c8('0x14')]=0x0;this[_0x64c8('0x15')]=_0x127d08['mailCapacity']||0x0;this[_0x64c8('0x16')]=0x0;this[_0x64c8('0x17')]=_0x64c8('0x10');this[_0x64c8('0x18')]=0x0;this['faxCapacity']=_0x127d08[_0x64c8('0x19')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']='unknown';this[_0x64c8('0x1a')]=0x0;this[_0x64c8('0x1b')]=_0x127d08['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0x64c8('0x10');this[_0x64c8('0x1c')]=0x0;this[_0x64c8('0x1d')]=_0x127d08[_0x64c8('0x1d')]||0x0;this[_0x64c8('0x1e')]=0x0;this[_0x64c8('0x1f')]=_0x64c8('0x10');this[_0x64c8('0x20')]=0x0;this['openchannelCapacity']=_0x127d08['openchannelCapacity']||0x0;this[_0x64c8('0x21')]=0x0;this['busy']=![];this[_0x64c8('0x22')]=undefined;this[_0x64c8('0x2')]='';this['chatWaitingInteractions']={};this[_0x64c8('0x23')]={};this[_0x64c8('0x24')]={};this['openchannelWaitingInteractions']={};this[_0x64c8('0x25')]={};this['whatsappWaitingInteractions']={};this[_0x64c8('0x26')]();}Agent[_0x64c8('0x27')][_0x64c8('0x28')]=function(_0x2f64b3){if(this[_0x2f64b3+_0x64c8('0x29')]>0x0){if(this[_0x2f64b3+_0x64c8('0x2a')]>0x0&&this[_0x2f64b3+_0x64c8('0x29')]>=this[_0x2f64b3+_0x64c8('0x2a')]){return _0x64c8('0x2b');}else{return _0x64c8('0x2c');}}else{return _0x64c8('0x2d');}};Agent['prototype'][_0x64c8('0x26')]=function(){var _0x1134b5=[_0x64c8('0x2e'),_0x64c8('0x2f'),'openchannel',_0x64c8('0x30'),_0x64c8('0x31'),_0x64c8('0x32')];for(var _0x539620=0x0;_0x539620<_0x1134b5[_0x64c8('0x33')];_0x539620+=0x1){var _0x3b1f25=this[_0x64c8('0x28')](_0x1134b5[_0x539620]);if(this[_0x1134b5[_0x539620]+_0x64c8('0x34')]!==_0x3b1f25){this[_0x1134b5[_0x539620]+_0x64c8('0x35')]=_[_0x64c8('0x36')](moment()[_0x64c8('0x37')]('x'));}this[_0x1134b5[_0x539620]+_0x64c8('0x34')]=_0x3b1f25;}var _0x23774b={'id':this['id'],'name':this[_0x64c8('0x9')],'online':this[_0x64c8('0xa')],'voicePause':this['voicePause'],'chatPause':this[_0x64c8('0x38')],'mailPause':this[_0x64c8('0xb')],'smsPause':this[_0x64c8('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0x64c8('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x64c8('0x12')],'chatCurrentCapacity':this[_0x64c8('0x13')],'mailStatus':this[_0x64c8('0x39')],'mailStatusTime':this[_0x64c8('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x64c8('0x16')],'faxStatus':this[_0x64c8('0x17')],'faxStatusTime':this[_0x64c8('0x18')],'faxCapacity':this[_0x64c8('0x19')],'faxCurrentCapacity':this[_0x64c8('0x3a')],'smsStatus':this[_0x64c8('0x3b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x64c8('0x1b')],'smsCurrentCapacity':this[_0x64c8('0x3c')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x64c8('0x1c')],'whatsappCapacity':this[_0x64c8('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x64c8('0x1f')],'openchannelStatusTime':this[_0x64c8('0x20')],'openchannelCapacity':this[_0x64c8('0x3d')],'openchannelCurrentCapacity':this[_0x64c8('0x21')],'busy':this[_0x64c8('0x3e')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x64c8('0x3f')],'faxWaitingInteractions':this[_0x64c8('0x23')],'mailWaitingInteractions':this[_0x64c8('0x24')],'openchannelWaitingInteractions':this[_0x64c8('0x40')],'smsWaitingInteractions':this[_0x64c8('0x25')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x2adca5=md5(JSON[_0x64c8('0x41')](_0x23774b));if(this['md5']!==_0x2adca5){this[_0x64c8('0x2')]=_0x2adca5;io[_0x64c8('0x42')]('user:save',_0x23774b);}};module[_0x64c8('0x43')]=Agent; \ No newline at end of file +var _0xf630=['stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','Capacity','CurrentCapacity','maxcapacity','working','idle','prototype','openchannel','fax','sms','whatsapp','length','getChannelStatus','StatusTime','toNumber','format','Status','mailStatus','faxStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy'];(function(_0x5da45a,_0xeb5d80){var _0xa7f98d=function(_0x3eefed){while(--_0x3eefed){_0x5da45a['push'](_0x5da45a['shift']());}};_0xa7f98d(++_0xeb5d80);}(_0xf630,0xd3));var _0x0f63=function(_0x1fd4f0,_0x5bac6d){_0x1fd4f0=_0x1fd4f0-0x0;var _0x1cd3d4=_0xf630[_0x1fd4f0];return _0x1cd3d4;};'use strict';var _=require(_0x0f63('0x0'));var moment=require(_0x0f63('0x1'));var md5=require(_0x0f63('0x2'));var Redis=require(_0x0f63('0x3'));var config=require(_0x0f63('0x4'));config[_0x0f63('0x5')]=_[_0x0f63('0x6')](config[_0x0f63('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0f63('0x7'))(new Redis(config[_0x0f63('0x5')]));function Agent(_0x35f889){this['id']=_0x35f889['id']||0x0;this['name']=_0x35f889[_0x0f63('0x8')]||'';this[_0x0f63('0x9')]=_0x35f889[_0x0f63('0x9')]||!![];this[_0x0f63('0xa')]=_0x35f889[_0x0f63('0xa')]||![];this[_0x0f63('0xb')]=_0x35f889[_0x0f63('0xb')]||![];this['mailPause']=_0x35f889[_0x0f63('0xc')]||![];this[_0x0f63('0xd')]=_0x35f889[_0x0f63('0xd')]||![];this['smsPause']=_0x35f889[_0x0f63('0xe')]||![];this[_0x0f63('0xf')]=_0x35f889[_0x0f63('0xf')]||![];this[_0x0f63('0x10')]=_0x0f63('0x11');this[_0x0f63('0x12')]=0x0;this[_0x0f63('0x13')]=_0x35f889[_0x0f63('0x13')]||0x0;this[_0x0f63('0x14')]=0x0;this['mailStatus']=_0x0f63('0x11');this[_0x0f63('0x15')]=0x0;this[_0x0f63('0x16')]=_0x35f889['mailCapacity']||0x0;this[_0x0f63('0x17')]=0x0;this[_0x0f63('0x18')]=_0x0f63('0x11');this['faxStatusTime']=0x0;this[_0x0f63('0x19')]=_0x35f889[_0x0f63('0x19')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x0f63('0x1a')]=_0x0f63('0x11');this[_0x0f63('0x1b')]=0x0;this['smsCapacity']=_0x35f889[_0x0f63('0x1c')]||0x0;this[_0x0f63('0x1d')]=0x0;this[_0x0f63('0x1e')]=_0x0f63('0x11');this[_0x0f63('0x1f')]=0x0;this[_0x0f63('0x20')]=_0x35f889[_0x0f63('0x20')]||0x0;this[_0x0f63('0x21')]=0x0;this[_0x0f63('0x22')]=_0x0f63('0x11');this[_0x0f63('0x23')]=0x0;this['openchannelCapacity']=_0x35f889['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x0f63('0x24')]=undefined;this['md5']='';this[_0x0f63('0x25')]={};this[_0x0f63('0x26')]={};this[_0x0f63('0x27')]={};this[_0x0f63('0x28')]={};this[_0x0f63('0x29')]={};this[_0x0f63('0x2a')]={};this[_0x0f63('0x2b')]();}Agent['prototype']['getChannelStatus']=function(_0x268ce5){if(this[_0x268ce5+'CurrentCapacity']>0x0){if(this[_0x268ce5+_0x0f63('0x2c')]>0x0&&this[_0x268ce5+_0x0f63('0x2d')]>=this[_0x268ce5+_0x0f63('0x2c')]){return _0x0f63('0x2e');}else{return _0x0f63('0x2f');}}else{return _0x0f63('0x30');}};Agent[_0x0f63('0x31')]['updateRealtime']=function(){var _0x14288e=['mail','chat',_0x0f63('0x32'),_0x0f63('0x33'),_0x0f63('0x34'),_0x0f63('0x35')];for(var _0x2b9ca2=0x0;_0x2b9ca2<_0x14288e[_0x0f63('0x36')];_0x2b9ca2+=0x1){var _0x3689f6=this[_0x0f63('0x37')](_0x14288e[_0x2b9ca2]);if(this[_0x14288e[_0x2b9ca2]+'Status']!==_0x3689f6){this[_0x14288e[_0x2b9ca2]+_0x0f63('0x38')]=_[_0x0f63('0x39')](moment()[_0x0f63('0x3a')]('x'));}this[_0x14288e[_0x2b9ca2]+_0x0f63('0x3b')]=_0x3689f6;}var _0x4eb075={'id':this['id'],'name':this[_0x0f63('0x8')],'online':this[_0x0f63('0x9')],'voicePause':this[_0x0f63('0xa')],'chatPause':this[_0x0f63('0xb')],'mailPause':this[_0x0f63('0xc')],'smsPause':this[_0x0f63('0xe')],'faxPause':this[_0x0f63('0xd')],'openchannelPause':this[_0x0f63('0xf')],'chatStatus':this[_0x0f63('0x10')],'chatStatusTime':this[_0x0f63('0x12')],'chatCapacity':this[_0x0f63('0x13')],'chatCurrentCapacity':this[_0x0f63('0x14')],'mailStatus':this[_0x0f63('0x3c')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x0f63('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x0f63('0x3d')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x0f63('0x1a')],'smsStatusTime':this[_0x0f63('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x0f63('0x1d')],'whatsappStatus':this[_0x0f63('0x1e')],'whatsappStatusTime':this[_0x0f63('0x1f')],'whatsappCapacity':this[_0x0f63('0x20')],'whatsappCurrentCapacity':this[_0x0f63('0x21')],'openchannelStatus':this[_0x0f63('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x0f63('0x3e')],'openchannelCurrentCapacity':this[_0x0f63('0x3f')],'busy':this[_0x0f63('0x40')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x0f63('0x25')],'faxWaitingInteractions':this[_0x0f63('0x26')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x0f63('0x29')],'whatsappWaitingInteractions':this[_0x0f63('0x2a')]};var _0x18e344=md5(JSON[_0x0f63('0x41')](_0x4eb075));if(this[_0x0f63('0x2')]!==_0x18e344){this[_0x0f63('0x2')]=_0x18e344;io[_0x0f63('0x42')](_0x0f63('0x43'),_0x4eb075);}};module[_0x0f63('0x44')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index df5b0ce..9551c9f 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 _0x64f1=['emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn','paused','length','chatPause','available','stringify','chat:queue:%s'];(function(_0x3015c5,_0x1e96e9){var _0x3d00eb=function(_0x1b5e9c){while(--_0x1b5e9c){_0x3015c5['push'](_0x3015c5['shift']());}};_0x3d00eb(++_0x1e96e9);}(_0x64f1,0x1a7));var _0x164f=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0x64f1[_0xb8cfbe];return _0x227d51;};'use strict';var _=require('lodash');var md5=require(_0x164f('0x0'));var util=require(_0x164f('0x1'));var Redis=require(_0x164f('0x2'));var config=require(_0x164f('0x3'));config['redis']=_[_0x164f('0x4')](config[_0x164f('0x5')],{'host':_0x164f('0x6'),'port':0x18eb});var io=require(_0x164f('0x7'))(new Redis(config[_0x164f('0x5')]));function ChatQueue(_0x179b82){this['id']=_0x179b82['id']||0x0;this[_0x164f('0x8')]=_0x179b82[_0x164f('0x8')]||'';this[_0x164f('0x9')]=_0x179b82[_0x164f('0x9')]||0xa;this[_0x164f('0xa')]=_0x179b82[_0x164f('0xa')]||_0x164f('0xb');this[_0x164f('0xc')]=_0x179b82[_0x164f('0xc')];this['mapAgentsId']={};this[_0x164f('0xd')]=0x0;this[_0x164f('0x0')]='';this[_0x164f('0xe')]();this['updateRealtime']();}ChatQueue['prototype'][_0x164f('0xe')]=function(){var _0x254731=this[_0x164f('0xf')]['_rr'];this[_0x164f('0xf')]=_['map'](this['Agents'],'id');this[_0x164f('0xf')][_0x164f('0x10')]=_0x254731;};ChatQueue['prototype'][_0x164f('0x11')]=function(){this[_0x164f('0x12')]=0x0;this[_0x164f('0x13')]=0x0;for(var _0x402675=0x0;_0x402675=0x0?this[_0x164f('0x16')]:0x0;var _0x1d6f23={'id':this['id'],'available':this[_0x164f('0x16')],'loggedIn':this[_0x164f('0x12')],'name':this['name'],'paused':this[_0x164f('0x13')],'waiting':this['waiting']};var _0x314a3f=md5(JSON[_0x164f('0x17')](_0x1d6f23));if(this[_0x164f('0x0')]!==_0x314a3f){this['md5']=_0x314a3f;io['to'](util['format'](_0x164f('0x18'),_0x1d6f23[_0x164f('0x8')]))[_0x164f('0x19')](_0x164f('0x1a'),_0x1d6f23);}};module[_0x164f('0x1b')]=ChatQueue; \ No newline at end of file +var _0x4033=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','chatPause','available','stringify','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x4a6896,_0x16bd71){var _0x47b1ca=function(_0x843733){while(--_0x843733){_0x4a6896['push'](_0x4a6896['shift']());}};_0x47b1ca(++_0x16bd71);}(_0x4033,0xff));var _0x3403=function(_0x2d0953,_0x30bcf9){_0x2d0953=_0x2d0953-0x0;var _0x1e824a=_0x4033[_0x2d0953];return _0x1e824a;};'use strict';var _=require(_0x3403('0x0'));var md5=require(_0x3403('0x1'));var util=require(_0x3403('0x2'));var Redis=require(_0x3403('0x3'));var config=require(_0x3403('0x4'));config[_0x3403('0x5')]=_[_0x3403('0x6')](config[_0x3403('0x5')],{'host':_0x3403('0x7'),'port':0x18eb});var io=require(_0x3403('0x8'))(new Redis(config[_0x3403('0x5')]));function ChatQueue(_0x5b82f3){this['id']=_0x5b82f3['id']||0x0;this[_0x3403('0x9')]=_0x5b82f3[_0x3403('0x9')]||'';this[_0x3403('0xa')]=_0x5b82f3[_0x3403('0xa')]||0xa;this[_0x3403('0xb')]=_0x5b82f3['strategy']||_0x3403('0xc');this[_0x3403('0xd')]=_0x5b82f3[_0x3403('0xd')];this[_0x3403('0xe')]={};this[_0x3403('0xf')]=0x0;this[_0x3403('0x1')]='';this[_0x3403('0x10')]();this[_0x3403('0x11')]();}ChatQueue[_0x3403('0x12')][_0x3403('0x10')]=function(){var _0x3db66a=this['mapAgentsId'][_0x3403('0x13')];this[_0x3403('0xe')]=_[_0x3403('0x14')](this['Agents'],'id');this[_0x3403('0xe')][_0x3403('0x13')]=_0x3db66a;};ChatQueue[_0x3403('0x12')][_0x3403('0x11')]=function(){this[_0x3403('0x15')]=0x0;this[_0x3403('0x16')]=0x0;for(var _0x339896=0x0;_0x339896=0x0?this[_0x3403('0x19')]:0x0;var _0x21fa3f={'id':this['id'],'available':this[_0x3403('0x19')],'loggedIn':this[_0x3403('0x15')],'name':this[_0x3403('0x9')],'paused':this['paused'],'waiting':this[_0x3403('0xf')]};var _0x29a63c=md5(JSON[_0x3403('0x1a')](_0x21fa3f));if(this[_0x3403('0x1')]!==_0x29a63c){this[_0x3403('0x1')]=_0x29a63c;io['to'](util['format']('chat:queue:%s',_0x21fa3f[_0x3403('0x9')]))[_0x3403('0x1b')]('chat_queue:save',_0x21fa3f);}};module[_0x3403('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 0276046..06ab92c 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 _0xc241=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','redis'];(function(_0x587f2a,_0xf47df8){var _0x1c89f2=function(_0x37a261){while(--_0x37a261){_0x587f2a['push'](_0x587f2a['shift']());}};_0x1c89f2(++_0xf47df8);}(_0xc241,0x75));var _0x1c24=function(_0x215c32,_0xf641a4){_0x215c32=_0x215c32-0x0;var _0x59660b=_0xc241[_0x215c32];return _0x59660b;};'use strict';var _=require('lodash');var md5=require(_0x1c24('0x0'));var util=require(_0x1c24('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x1c24('0x2')]=_[_0x1c24('0x3')](config[_0x1c24('0x2')],{'host':_0x1c24('0x4'),'port':0x18eb});var io=require(_0x1c24('0x5'))(new Redis(config[_0x1c24('0x2')]));function FaxQueue(_0x28f6ca){this['id']=_0x28f6ca['id']||0x0;this[_0x1c24('0x6')]=_0x28f6ca['name']||'';this[_0x1c24('0x7')]=_0x28f6ca[_0x1c24('0x7')]||0xa;this[_0x1c24('0x8')]=_0x28f6ca['strategy']||_0x1c24('0x9');this['Agents']=_0x28f6ca[_0x1c24('0xa')];this[_0x1c24('0xb')]={};this[_0x1c24('0xc')]=0x0;this[_0x1c24('0x0')]='';this[_0x1c24('0xd')]();this['updateRealtime']();}FaxQueue[_0x1c24('0xe')][_0x1c24('0xd')]=function(){var _0x21d235=this['mapAgentsId'][_0x1c24('0xf')];this[_0x1c24('0xb')]=_[_0x1c24('0x10')](this['Agents'],'id');this[_0x1c24('0xb')][_0x1c24('0xf')]=_0x21d235;};FaxQueue[_0x1c24('0xe')][_0x1c24('0x11')]=function(){this[_0x1c24('0x12')]=0x0;this[_0x1c24('0x13')]=0x0;for(var _0x3f4407=0x0;_0x3f4407=0x0?this['available']:0x0;var _0x6925fb={'id':this['id'],'available':this[_0x1c24('0x17')],'loggedIn':this[_0x1c24('0x12')],'name':this[_0x1c24('0x6')],'paused':this[_0x1c24('0x13')],'waiting':this[_0x1c24('0xc')]};var _0x149811=md5(JSON[_0x1c24('0x18')](_0x6925fb));if(this[_0x1c24('0x0')]!==_0x149811){this[_0x1c24('0x0')]=_0x149811;io['to'](util[_0x1c24('0x19')](_0x1c24('0x1a'),_0x6925fb[_0x1c24('0x6')]))[_0x1c24('0x1b')](_0x1c24('0x1c'),_0x6925fb);}};module[_0x1c24('0x1d')]=FaxQueue; \ No newline at end of file +var _0xe12b=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','faxPause','paused','available','stringify','md5','format','fax:queue:%s','emit','fax_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x3a4bf,_0x16a2cf){var _0x24b6e9=function(_0x49bdba){while(--_0x49bdba){_0x3a4bf['push'](_0x3a4bf['shift']());}};_0x24b6e9(++_0x16a2cf);}(_0xe12b,0x1bb));var _0xbe12=function(_0x3c7b09,_0x172698){_0x3c7b09=_0x3c7b09-0x0;var _0x55a91a=_0xe12b[_0x3c7b09];return _0x55a91a;};'use strict';var _=require(_0xbe12('0x0'));var md5=require('md5');var util=require(_0xbe12('0x1'));var Redis=require(_0xbe12('0x2'));var config=require(_0xbe12('0x3'));config[_0xbe12('0x4')]=_[_0xbe12('0x5')](config['redis'],{'host':_0xbe12('0x6'),'port':0x18eb});var io=require(_0xbe12('0x7'))(new Redis(config['redis']));function FaxQueue(_0x3dbd22){this['id']=_0x3dbd22['id']||0x0;this['name']=_0x3dbd22[_0xbe12('0x8')]||'';this[_0xbe12('0x9')]=_0x3dbd22[_0xbe12('0x9')]||0xa;this[_0xbe12('0xa')]=_0x3dbd22[_0xbe12('0xa')]||_0xbe12('0xb');this[_0xbe12('0xc')]=_0x3dbd22[_0xbe12('0xc')];this[_0xbe12('0xd')]={};this[_0xbe12('0xe')]=0x0;this['md5']='';this[_0xbe12('0xf')]();this[_0xbe12('0x10')]();}FaxQueue[_0xbe12('0x11')][_0xbe12('0xf')]=function(){var _0x8ec4d0=this[_0xbe12('0xd')]['_rr'];this['mapAgentsId']=_[_0xbe12('0x12')](this[_0xbe12('0xc')],'id');this['mapAgentsId'][_0xbe12('0x13')]=_0x8ec4d0;};FaxQueue[_0xbe12('0x11')][_0xbe12('0x10')]=function(){this[_0xbe12('0x14')]=0x0;this['paused']=0x0;for(var _0x499e39=0x0;_0x499e39=0x0?this[_0xbe12('0x17')]:0x0;var _0x895d23={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbe12('0x14')],'name':this[_0xbe12('0x8')],'paused':this[_0xbe12('0x16')],'waiting':this[_0xbe12('0xe')]};var _0x524362=md5(JSON[_0xbe12('0x18')](_0x895d23));if(this[_0xbe12('0x19')]!==_0x524362){this['md5']=_0x524362;io['to'](util[_0xbe12('0x1a')](_0xbe12('0x1b'),_0x895d23[_0xbe12('0x8')]))[_0xbe12('0x1c')](_0xbe12('0x1d'),_0x895d23);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d0a160c..799b7a2 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 _0x467d=['exports','name','Intervals'];(function(_0x58efa6,_0x2c00bd){var _0x5d643c=function(_0x1d1ef2){while(--_0x1d1ef2){_0x58efa6['push'](_0x58efa6['shift']());}};_0x5d643c(++_0x2c00bd);}(_0x467d,0x6a));var _0xd467=function(_0x58138c,_0xf5834a){_0x58138c=_0x58138c-0x0;var _0x30a2b7=_0x467d[_0x58138c];return _0x30a2b7;};'use strict';function Interval(_0x54d21d){this['id']=_0x54d21d['id']||0x0;this[_0xd467('0x0')]=_0x54d21d['name']||'';this['Intervals']=_0x54d21d[_0xd467('0x1')]||{};}module[_0xd467('0x2')]=Interval; \ No newline at end of file +var _0x78cb=['name','Intervals'];(function(_0x142c0c,_0x3f61c6){var _0x3aefb0=function(_0x5c96d6){while(--_0x5c96d6){_0x142c0c['push'](_0x142c0c['shift']());}};_0x3aefb0(++_0x3f61c6);}(_0x78cb,0xe4));var _0xb78c=function(_0x21972d,_0x4ad788){_0x21972d=_0x21972d-0x0;var _0xcf6d7b=_0x78cb[_0x21972d];return _0xcf6d7b;};'use strict';function Interval(_0xe76cd7){this['id']=_0xe76cd7['id']||0x0;this[_0xb78c('0x0')]=_0xe76cd7[_0xb78c('0x0')]||'';this[_0xb78c('0x1')]=_0xe76cd7[_0xb78c('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index dc9e78d..a65a230 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 _0x3be1=['util','../../../config/environment','redis','socket.io-emitter','name','timeout','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','length','paused','available','stringify','format','emit','mail_queue:save','exports','lodash','md5'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x3be1,0x19e));var _0x13be=function(_0x41c795,_0x485a2b){_0x41c795=_0x41c795-0x0;var _0x343aa4=_0x3be1[_0x41c795];return _0x343aa4;};'use strict';var _=require(_0x13be('0x0'));var md5=require(_0x13be('0x1'));var util=require(_0x13be('0x2'));var Redis=require('ioredis');var config=require(_0x13be('0x3'));config[_0x13be('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x13be('0x5'))(new Redis(config['redis']));function MailQueue(_0x2de8b3){this['id']=_0x2de8b3['id']||0x0;this[_0x13be('0x6')]=_0x2de8b3[_0x13be('0x6')]||'';this[_0x13be('0x7')]=_0x2de8b3[_0x13be('0x7')]||0xa;this['strategy']=_0x2de8b3['strategy']||_0x13be('0x8');this[_0x13be('0x9')]=_0x2de8b3['Agents'];this['mapAgentsId']={};this[_0x13be('0xa')]=0x0;this[_0x13be('0x1')]='';this[_0x13be('0xb')]();this[_0x13be('0xc')]();}MailQueue[_0x13be('0xd')]['updateRouting']=function(){var _0x1b0056=this['mapAgentsId'][_0x13be('0xe')];this[_0x13be('0xf')]=_[_0x13be('0x10')](this[_0x13be('0x9')],'id');this[_0x13be('0xf')]['_rr']=_0x1b0056;};MailQueue[_0x13be('0xd')][_0x13be('0xc')]=function(){this[_0x13be('0x11')]=0x0;this['paused']=0x0;for(var _0x57e62d=0x0;_0x57e62d=0x0?this[_0x13be('0x14')]:0x0;var _0x239a87={'id':this['id'],'available':this[_0x13be('0x14')],'loggedIn':this[_0x13be('0x11')],'name':this[_0x13be('0x6')],'paused':this[_0x13be('0x13')],'waiting':this['waiting']};var _0x43d776=md5(JSON[_0x13be('0x15')](_0x239a87));if(this[_0x13be('0x1')]!==_0x43d776){this[_0x13be('0x1')]=_0x43d776;io['to'](util[_0x13be('0x16')]('mail:queue:%s',_0x239a87[_0x13be('0x6')]))[_0x13be('0x17')](_0x13be('0x18'),_0x239a87);}};module[_0x13be('0x19')]=MailQueue; \ No newline at end of file +var _0x444e=['loggedIn','paused','length','mailPause','available','format','emit','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x41521f,_0x3809ba){var _0x4c91a3=function(_0x25386e){while(--_0x25386e){_0x41521f['push'](_0x41521f['shift']());}};_0x4c91a3(++_0x3809ba);}(_0x444e,0xe9));var _0xe444=function(_0x306040,_0x396ee8){_0x306040=_0x306040-0x0;var _0x42942c=_0x444e[_0x306040];return _0x42942c;};'use strict';var _=require(_0xe444('0x0'));var md5=require(_0xe444('0x1'));var util=require(_0xe444('0x2'));var Redis=require(_0xe444('0x3'));var config=require('../../../config/environment');config[_0xe444('0x4')]=_[_0xe444('0x5')](config[_0xe444('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe444('0x6'))(new Redis(config[_0xe444('0x4')]));function MailQueue(_0x3c7256){this['id']=_0x3c7256['id']||0x0;this[_0xe444('0x7')]=_0x3c7256[_0xe444('0x7')]||'';this[_0xe444('0x8')]=_0x3c7256['timeout']||0xa;this['strategy']=_0x3c7256[_0xe444('0x9')]||_0xe444('0xa');this['Agents']=_0x3c7256[_0xe444('0xb')];this[_0xe444('0xc')]={};this[_0xe444('0xd')]=0x0;this[_0xe444('0x1')]='';this[_0xe444('0xe')]();this[_0xe444('0xf')]();}MailQueue['prototype'][_0xe444('0xe')]=function(){var _0x2ffe5b=this['mapAgentsId']['_rr'];this[_0xe444('0xc')]=_['map'](this[_0xe444('0xb')],'id');this[_0xe444('0xc')]['_rr']=_0x2ffe5b;};MailQueue[_0xe444('0x10')][_0xe444('0xf')]=function(){this[_0xe444('0x11')]=0x0;this[_0xe444('0x12')]=0x0;for(var _0x5a079b=0x0;_0x5a079b=0x0?this[_0xe444('0x15')]:0x0;var _0x27716e={'id':this['id'],'available':this[_0xe444('0x15')],'loggedIn':this[_0xe444('0x11')],'name':this[_0xe444('0x7')],'paused':this['paused'],'waiting':this[_0xe444('0xd')]};var _0x2d9438=md5(JSON['stringify'](_0x27716e));if(this[_0xe444('0x1')]!==_0x2d9438){this['md5']=_0x2d9438;io['to'](util[_0xe444('0x16')]('mail:queue:%s',_0x27716e['name']))[_0xe444('0x17')]('mail_queue:save',_0x27716e);}};module[_0xe444('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 03392e5..2b2045f 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(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x3eb5b8,_0x3f5f48){var _0x588136=function(_0x5aa818){while(--_0x5aa818){_0x3eb5b8['push'](_0x3eb5b8['shift']());}};_0x588136(++_0x3f5f48);}(_0x814b,0x1a2));var _0xb814=function(_0x443520,_0x2fe333){_0x443520=_0x443520-0x0;var _0x20afa5=_0x814b[_0x443520];return _0x20afa5;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 51725c9..38aa381 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 _0x0487=['ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','available','format','sms:queue:%s','sms_queue:save','lodash','md5','util'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0x0487,0x14f));var _0x7048=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x0487[_0xadde88];return _0x3b8eb6;};'use strict';var _=require(_0x7048('0x0'));var md5=require(_0x7048('0x1'));var util=require(_0x7048('0x2'));var Redis=require(_0x7048('0x3'));var config=require(_0x7048('0x4'));config[_0x7048('0x5')]=_['defaults'](config[_0x7048('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7048('0x6'))(new Redis(config[_0x7048('0x5')]));function SmsQueue(_0x1f00bf){this['id']=_0x1f00bf['id']||0x0;this[_0x7048('0x7')]=_0x1f00bf['name']||'';this[_0x7048('0x8')]=_0x1f00bf[_0x7048('0x8')]||0xa;this[_0x7048('0x9')]=_0x1f00bf['strategy']||_0x7048('0xa');this['Agents']=_0x1f00bf[_0x7048('0xb')];this[_0x7048('0xc')]={};this[_0x7048('0xd')]=0x0;this[_0x7048('0x1')]='';this[_0x7048('0xe')]();this[_0x7048('0xf')]();}SmsQueue[_0x7048('0x10')]['updateRouting']=function(){var _0x2eba6e=this[_0x7048('0xc')][_0x7048('0x11')];this['mapAgentsId']=_[_0x7048('0x12')](this[_0x7048('0xb')],'id');this['mapAgentsId'][_0x7048('0x11')]=_0x2eba6e;};SmsQueue[_0x7048('0x10')][_0x7048('0xf')]=function(){this[_0x7048('0x13')]=0x0;this[_0x7048('0x14')]=0x0;for(var _0x546c51=0x0;_0x546c51=0x0?this[_0x7048('0x16')]:0x0;var _0xbef931={'id':this['id'],'available':this[_0x7048('0x16')],'loggedIn':this[_0x7048('0x13')],'name':this['name'],'paused':this[_0x7048('0x14')],'waiting':this['waiting']};var _0x521a61=md5(JSON['stringify'](_0xbef931));if(this[_0x7048('0x1')]!==_0x521a61){this[_0x7048('0x1')]=_0x521a61;io['to'](util[_0x7048('0x17')](_0x7048('0x18'),_0xbef931[_0x7048('0x7')]))['emit'](_0x7048('0x19'),_0xbef931);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x87f8=['updateRouting','updateRealtime','prototype','map','paused','length','loggedIn','smsPause','available','waiting','stringify','sms:queue:%s','sms_queue:save','exports','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x5b9842,_0x52a26b){var _0x3aab10=function(_0x4e844d){while(--_0x4e844d){_0x5b9842['push'](_0x5b9842['shift']());}};_0x3aab10(++_0x52a26b);}(_0x87f8,0x152));var _0x887f=function(_0x1ef1d4,_0x5cb4a7){_0x1ef1d4=_0x1ef1d4-0x0;var _0x1dc1b8=_0x87f8[_0x1ef1d4];return _0x1dc1b8;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x887f('0x0'));var config=require(_0x887f('0x1'));config['redis']=_[_0x887f('0x2')](config['redis'],{'host':_0x887f('0x3'),'port':0x18eb});var io=require(_0x887f('0x4'))(new Redis(config[_0x887f('0x5')]));function SmsQueue(_0x2d4cec){this['id']=_0x2d4cec['id']||0x0;this['name']=_0x2d4cec[_0x887f('0x6')]||'';this[_0x887f('0x7')]=_0x2d4cec[_0x887f('0x7')]||0xa;this[_0x887f('0x8')]=_0x2d4cec[_0x887f('0x8')]||_0x887f('0x9');this[_0x887f('0xa')]=_0x2d4cec['Agents'];this[_0x887f('0xb')]={};this['waiting']=0x0;this[_0x887f('0xc')]='';this[_0x887f('0xd')]();this[_0x887f('0xe')]();}SmsQueue[_0x887f('0xf')]['updateRouting']=function(){var _0x12383f=this[_0x887f('0xb')]['_rr'];this['mapAgentsId']=_[_0x887f('0x10')](this[_0x887f('0xa')],'id');this[_0x887f('0xb')]['_rr']=_0x12383f;};SmsQueue[_0x887f('0xf')][_0x887f('0xe')]=function(){this['loggedIn']=0x0;this[_0x887f('0x11')]=0x0;for(var _0x58152e=0x0;_0x58152e=0x0?this[_0x887f('0x15')]:0x0;var _0x3d3b0c={'id':this['id'],'available':this[_0x887f('0x15')],'loggedIn':this[_0x887f('0x13')],'name':this[_0x887f('0x6')],'paused':this[_0x887f('0x11')],'waiting':this[_0x887f('0x16')]};var _0x3964d6=md5(JSON[_0x887f('0x17')](_0x3d3b0c));if(this[_0x887f('0xc')]!==_0x3964d6){this[_0x887f('0xc')]=_0x3964d6;io['to'](util['format'](_0x887f('0x18'),_0x3d3b0c[_0x887f('0x6')]))['emit'](_0x887f('0x19'),_0x3d3b0c);}};module[_0x887f('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index accbb6d..fe8cb9f 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 _0x907b=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash'];(function(_0xe87a2c,_0x1d9ddc){var _0x560ecc=function(_0x54f20d){while(--_0x54f20d){_0xe87a2c['push'](_0xe87a2c['shift']());}};_0x560ecc(++_0x1d9ddc);}(_0x907b,0x17f));var _0xb907=function(_0x234318,_0xf22f31){_0x234318=_0x234318-0x0;var _0x1ab719=_0x907b[_0x234318];return _0x1ab719;};'use strict';var _=require(_0xb907('0x0'));var md5=require(_0xb907('0x1'));var util=require('util');var Redis=require(_0xb907('0x2'));var config=require(_0xb907('0x3'));config[_0xb907('0x4')]=_[_0xb907('0x5')](config['redis'],{'host':_0xb907('0x6'),'port':0x18eb});var io=require(_0xb907('0x7'))(new Redis(config[_0xb907('0x4')]));function WhatsappQueue(_0x426fb0){this['id']=_0x426fb0['id']||0x0;this[_0xb907('0x8')]=_0x426fb0[_0xb907('0x8')]||'';this[_0xb907('0x9')]=_0x426fb0[_0xb907('0x9')]||0xa;this[_0xb907('0xa')]=_0x426fb0[_0xb907('0xa')]||_0xb907('0xb');this[_0xb907('0xc')]=_0x426fb0[_0xb907('0xc')];this[_0xb907('0xd')]={};this[_0xb907('0xe')]=0x0;this[_0xb907('0x1')]='';this[_0xb907('0xf')]();this[_0xb907('0x10')]();}WhatsappQueue[_0xb907('0x11')][_0xb907('0xf')]=function(){var _0x2458aa=this[_0xb907('0xd')][_0xb907('0x12')];this[_0xb907('0xd')]=_[_0xb907('0x13')](this['Agents'],'id');this['mapAgentsId'][_0xb907('0x12')]=_0x2458aa;};WhatsappQueue[_0xb907('0x11')][_0xb907('0x10')]=function(){this['loggedIn']=0x0;this[_0xb907('0x14')]=0x0;for(var _0x28da64=0x0;_0x28da64=0x0?this[_0xb907('0x19')]:0x0;var _0x470f7c={'id':this['id'],'available':this[_0xb907('0x19')],'loggedIn':this[_0xb907('0x17')],'name':this[_0xb907('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x3964b2=md5(JSON[_0xb907('0x1a')](_0x470f7c));if(this[_0xb907('0x1')]!==_0x3964b2){this[_0xb907('0x1')]=_0x3964b2;io['to'](util[_0xb907('0x1b')](_0xb907('0x1c'),_0x470f7c[_0xb907('0x8')]))[_0xb907('0x1d')](_0xb907('0x1e'),_0x470f7c);}};module[_0xb907('0x1f')]=WhatsappQueue; \ No newline at end of file +var _0xe9a2=['lodash','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','available','format','whatsapp:queue:%s','emit'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0xe9a2,0x16c));var _0x2e9a=function(_0x19b2ca,_0x7a0686){_0x19b2ca=_0x19b2ca-0x0;var _0x36a946=_0xe9a2[_0x19b2ca];return _0x36a946;};'use strict';var _=require(_0x2e9a('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x2e9a('0x1'));var config=require(_0x2e9a('0x2'));config[_0x2e9a('0x3')]=_[_0x2e9a('0x4')](config['redis'],{'host':_0x2e9a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x3967fe){this['id']=_0x3967fe['id']||0x0;this[_0x2e9a('0x6')]=_0x3967fe['name']||'';this[_0x2e9a('0x7')]=_0x3967fe['timeout']||0xa;this['strategy']=_0x3967fe[_0x2e9a('0x8')]||_0x2e9a('0x9');this[_0x2e9a('0xa')]=_0x3967fe[_0x2e9a('0xa')];this[_0x2e9a('0xb')]={};this[_0x2e9a('0xc')]=0x0;this[_0x2e9a('0xd')]='';this[_0x2e9a('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x2e9a('0xf')][_0x2e9a('0xe')]=function(){var _0x4401b6=this[_0x2e9a('0xb')][_0x2e9a('0x10')];this['mapAgentsId']=_[_0x2e9a('0x11')](this[_0x2e9a('0xa')],'id');this[_0x2e9a('0xb')][_0x2e9a('0x10')]=_0x4401b6;};WhatsappQueue['prototype'][_0x2e9a('0x12')]=function(){this[_0x2e9a('0x13')]=0x0;this[_0x2e9a('0x14')]=0x0;for(var _0x3c1982=0x0;_0x3c1982=0x0?this[_0x2e9a('0x16')]:0x0;var _0x24c0d1={'id':this['id'],'available':this[_0x2e9a('0x16')],'loggedIn':this[_0x2e9a('0x13')],'name':this[_0x2e9a('0x6')],'paused':this[_0x2e9a('0x14')],'waiting':this['waiting']};var _0x382c88=md5(JSON['stringify'](_0x24c0d1));if(this[_0x2e9a('0xd')]!==_0x382c88){this[_0x2e9a('0xd')]=_0x382c88;io['to'](util[_0x2e9a('0x17')](_0x2e9a('0x18'),_0x24c0d1['name']))[_0x2e9a('0x19')]('whatsapp_queue:save',_0x24c0d1);}};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 2f4d747..b7ee07f 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x856507,_0x5e5f76){var _0x1bc06c=function(_0x1995a1){while(--_0x1995a1){_0x856507['push'](_0x856507['shift']());}};_0x1bc06c(++_0x5e5f76);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c8618,_0x54ada2){_0x3c8618=_0x3c8618-0x0;var _0x2deb98=_0xb10b[_0x3c8618];return _0x2deb98;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index c6fcfc9..138e624 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 _0x53d1=['AddTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','addTags','Request'];(function(_0x591963,_0x4b650c){var _0x1b42bc=function(_0x25359a){while(--_0x25359a){_0x591963['push'](_0x591963['shift']());}};_0x1b42bc(++_0x4b650c);}(_0x53d1,0x1c8));var _0x153d=function(_0x5b4967,_0x3d5dfb){_0x5b4967=_0x5b4967-0x0;var _0x2dce35=_0x53d1[_0x5b4967];return _0x2dce35;};'use strict';var client=require(_0x153d('0x0'));exports[_0x153d('0x1')]=function(_0x4ef398,_0x20a04b){return client['Request'](_0x153d('0x2'),{'body':_0x20a04b,'options':{'where':{'id':_0x4ef398}},'log':_0x153d('0x3')});};exports[_0x153d('0x4')]=function(_0x5091a6,_0x4ab70e){return client[_0x153d('0x5')](_0x153d('0x6'),{'body':_0x4ab70e,'options':{'where':{'id':_0x5091a6}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe97c=['addTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x46a5aa,_0x9952d1){var _0x4375cc=function(_0x50ab83){while(--_0x50ab83){_0x46a5aa['push'](_0x46a5aa['shift']());}};_0x4375cc(++_0x9952d1);}(_0xe97c,0x1a5));var _0xce97=function(_0x24dd85,_0x224447){_0x24dd85=_0x24dd85-0x0;var _0x1847d7=_0xe97c[_0x24dd85];return _0x1847d7;};'use strict';var client=require('../client');exports['update']=function(_0x32acad,_0x1fb064){return client[_0xce97('0x0')](_0xce97('0x1'),{'body':_0x1fb064,'options':{'where':{'id':_0x32acad}},'log':_0xce97('0x2')});};exports[_0xce97('0x3')]=function(_0x2be8c9,_0x297a47){return client[_0xce97('0x0')](_0xce97('0x4'),{'body':_0x297a47,'options':{'where':{'id':_0x2be8c9}},'log':_0xce97('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c497df0..bb85908 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 _0xdd12=['createChatMessage','../client','create','Request'];(function(_0x5ecf38,_0x450035){var _0x1092a7=function(_0x280c58){while(--_0x280c58){_0x5ecf38['push'](_0x5ecf38['shift']());}};_0x1092a7(++_0x450035);}(_0xdd12,0x17d));var _0x2dd1=function(_0xfa8b8f,_0x5d14ec){_0xfa8b8f=_0xfa8b8f-0x0;var _0xf0bf17=_0xdd12[_0xfa8b8f];return _0xf0bf17;};'use strict';var client=require(_0x2dd1('0x0'));exports[_0x2dd1('0x1')]=function(_0x16aaea){return client[_0x2dd1('0x2')]('CreateChatMessage',{'body':_0x16aaea,'log':_0x2dd1('0x3')});}; \ No newline at end of file +var _0x64d0=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x64d0,0x118));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x064d('0x0'));exports[_0x064d('0x1')]=function(_0x32013a){return client['Request'](_0x064d('0x2'),{'body':_0x32013a,'log':_0x064d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 4e00c17..8a23a0f 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 _0x06bf=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','online'];(function(_0x1d2195,_0x4b8096){var _0x4962cd=function(_0x301f5a){while(--_0x301f5a){_0x1d2195['push'](_0x1d2195['shift']());}};_0x4962cd(++_0x4b8096);}(_0x06bf,0x105));var _0xf06b=function(_0x582501,_0x14d823){_0x582501=_0x582501-0x0;var _0x5b9392=_0x06bf[_0x582501];return _0x5b9392;};'use strict';var client=require(_0xf06b('0x0'));exports[_0xf06b('0x1')]=function(){return function(){return client[_0xf06b('0x2')](_0xf06b('0x3'),{'options':{'raw':![],'attributes':['id',_0xf06b('0x4'),_0xf06b('0x5'),_0xf06b('0x6')],'include':[{'model':_0xf06b('0x7'),'as':'Agents','attributes':['id',_0xf06b('0x4'),_0xf06b('0x8'),_0xf06b('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xe105=['chatPause','../client','timeout','strategy','User','Agents','online'];(function(_0x3c1364,_0x3e7817){var _0x7631c6=function(_0x28857f){while(--_0x28857f){_0x3c1364['push'](_0x3c1364['shift']());}};_0x7631c6(++_0x3e7817);}(_0xe105,0xef));var _0x5e10=function(_0x46a3df,_0x4492b5){_0x46a3df=_0x46a3df-0x0;var _0x24c689=_0xe105[_0x46a3df];return _0x24c689;};'use strict';var client=require(_0x5e10('0x0'));exports['getChatQueues']=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x5e10('0x1'),_0x5e10('0x2')],'include':[{'model':_0x5e10('0x3'),'as':_0x5e10('0x4'),'attributes':['id','name',_0x5e10('0x5'),_0x5e10('0x6')]}]},'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 e0ec987..6d9fe14 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 _0x851e=['CreateChatQueueReport','update','Request','DESC','UpdateChatQueueReport','../client','create'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x851e,0x1e8));var _0xe851=function(_0x1a1131,_0x404e25){_0x1a1131=_0x1a1131-0x0;var _0x2a73ee=_0x851e[_0x1a1131];return _0x2a73ee;};'use strict';var client=require(_0xe851('0x0'));exports[_0xe851('0x1')]=function(_0x2bc74b){return client['Request']('CreateChatQueueReport',{'body':_0x2bc74b,'log':_0xe851('0x2')});};exports[_0xe851('0x3')]=function(_0x16b38a,_0x326b34){return client[_0xe851('0x4')]('UpdateChatQueueReport',{'body':_0x326b34,'options':{'where':{'uniqueid':_0x16b38a},'order':[['id',_0xe851('0x5')]],'limit':0x1},'log':_0xe851('0x6')});}; \ No newline at end of file +var _0xb492=['CreateChatQueueReport','UpdateChatQueueReport','create','Request'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb492,0x172));var _0x2b49=function(_0x2b6f91,_0x2dd3dd){_0x2b6f91=_0x2b6f91-0x0;var _0x558bdf=_0xb492[_0x2b6f91];return _0x558bdf;};'use strict';var client=require('../client');exports[_0x2b49('0x0')]=function(_0x32fdad){return client[_0x2b49('0x1')](_0x2b49('0x2'),{'body':_0x32fdad,'log':'CreateChatQueueReport'});};exports['update']=function(_0x31a7e5,_0x340296){return client[_0x2b49('0x1')](_0x2b49('0x3'),{'body':_0x340296,'options':{'where':{'uniqueid':_0x31a7e5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6695ece..2eca725 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0x7a54,0x106));var _0x47a5=function(_0x4b6e32,_0x56055d){_0x4b6e32=_0x4b6e32-0x0;var _0xb55baa=_0x7a54[_0x4b6e32];return _0xb55baa;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x7a54,0x106));var _0x47a5=function(_0x216886,_0x42f31f){_0x216886=_0x216886-0x0;var _0x5e3065=_0x7a54[_0x216886];return _0x5e3065;};'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 f8553d6..336edc5 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 _0x873e=['createFaxMessage','../client','create','Request'];(function(_0x47d39d,_0x5b7fd2){var _0x57e78b=function(_0x313e46){while(--_0x313e46){_0x47d39d['push'](_0x47d39d['shift']());}};_0x57e78b(++_0x5b7fd2);}(_0x873e,0x155));var _0xe873=function(_0x1e6b95,_0x15beb6){_0x1e6b95=_0x1e6b95-0x0;var _0x92f195=_0x873e[_0x1e6b95];return _0x92f195;};'use strict';var client=require(_0xe873('0x0'));exports[_0xe873('0x1')]=function(_0x97774e){return client[_0xe873('0x2')]('CreateFaxMessage',{'body':_0x97774e,'log':_0xe873('0x3')});}; \ No newline at end of file +var _0xe8be=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe8be,0x64));var _0xee8b=function(_0x2b81be,_0x544bdf){_0x2b81be=_0x2b81be-0x0;var _0x8ed4a7=_0xe8be[_0x2b81be];return _0x8ed4a7;};'use strict';var client=require(_0xee8b('0x0'));exports[_0xee8b('0x1')]=function(_0x1bcb66){return client[_0xee8b('0x2')](_0xee8b('0x3'),{'body':_0x1bcb66,'log':_0xee8b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 17015b2..a7753b0 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 _0x4f06=['strategy','Agents','name','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout'];(function(_0x3c4f9a,_0x5ec43b){var _0x8665f8=function(_0x2f77ca){while(--_0x2f77ca){_0x3c4f9a['push'](_0x3c4f9a['shift']());}};_0x8665f8(++_0x5ec43b);}(_0x4f06,0x113));var _0x64f0=function(_0x3c47d0,_0x331ad9){_0x3c47d0=_0x3c47d0-0x0;var _0x31391d=_0x4f06[_0x3c47d0];return _0x31391d;};'use strict';var client=require(_0x64f0('0x0'));exports[_0x64f0('0x1')]=function(){return function(){return client[_0x64f0('0x2')](_0x64f0('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x64f0('0x4'),_0x64f0('0x5')],'include':[{'model':'User','as':_0x64f0('0x6'),'attributes':['id',_0x64f0('0x7'),_0x64f0('0x8'),_0x64f0('0x9')]}]},'log':_0x64f0('0x1')});};}; \ No newline at end of file +var _0xcd02=['Agents','online','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User'];(function(_0x2b9aa2,_0x1ee287){var _0x3c9155=function(_0x8108fa){while(--_0x8108fa){_0x2b9aa2['push'](_0x2b9aa2['shift']());}};_0x3c9155(++_0x1ee287);}(_0xcd02,0x1ec));var _0x2cd0=function(_0x5bebc5,_0x39bdeb){_0x5bebc5=_0x5bebc5-0x0;var _0x538278=_0xcd02[_0x5bebc5];return _0x538278;};'use strict';var client=require(_0x2cd0('0x0'));exports[_0x2cd0('0x1')]=function(){return function(){return client[_0x2cd0('0x2')](_0x2cd0('0x3'),{'options':{'raw':![],'attributes':['id',_0x2cd0('0x4'),_0x2cd0('0x5'),_0x2cd0('0x6')],'include':[{'model':_0x2cd0('0x7'),'as':_0x2cd0('0x8'),'attributes':['id',_0x2cd0('0x4'),_0x2cd0('0x9'),'faxPause']}]},'log':_0x2cd0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e233b57..cc7e43f 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 _0x8385=['CreateFaxQueueReport','update','DESC','create','Request'];(function(_0x5ef51f,_0x5d971e){var _0x55985b=function(_0x5dcb65){while(--_0x5dcb65){_0x5ef51f['push'](_0x5ef51f['shift']());}};_0x55985b(++_0x5d971e);}(_0x8385,0x12a));var _0x5838=function(_0x356f5f,_0x2921f6){_0x356f5f=_0x356f5f-0x0;var _0x2d1e12=_0x8385[_0x356f5f];return _0x2d1e12;};'use strict';var client=require('../client');exports[_0x5838('0x0')]=function(_0x369080){return client[_0x5838('0x1')](_0x5838('0x2'),{'body':_0x369080,'log':'CreateFaxQueueReport'});};exports[_0x5838('0x3')]=function(_0x290599,_0x471e15){return client[_0x5838('0x1')]('UpdateFaxQueueReport',{'body':_0x471e15,'options':{'where':{'uniqueid':_0x290599},'order':[['id',_0x5838('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xfdf8=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x2586c7,_0x277605){var _0x11dae8=function(_0x3d1faa){while(--_0x3d1faa){_0x2586c7['push'](_0x2586c7['shift']());}};_0x11dae8(++_0x277605);}(_0xfdf8,0x1ec));var _0x8fdf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfdf8[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0x8fdf('0x0')]=function(_0x2ec45b){return client[_0x8fdf('0x1')](_0x8fdf('0x2'),{'body':_0x2ec45b,'log':_0x8fdf('0x2')});};exports[_0x8fdf('0x3')]=function(_0x19a5c9,_0x45e635){return client['Request'](_0x8fdf('0x4'),{'body':_0x45e635,'options':{'where':{'uniqueid':_0x19a5c9},'order':[['id',_0x8fdf('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index fce0df0..06afe85 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 _0xb715=['getIntervals','Request','GetInterval','Interval','Intervals','name','../client'];(function(_0x5d2d59,_0x323458){var _0x25e7ab=function(_0x47d37b){while(--_0x47d37b){_0x5d2d59['push'](_0x5d2d59['shift']());}};_0x25e7ab(++_0x323458);}(_0xb715,0x12c));var _0x5b71=function(_0x2ae9e0,_0x45151d){_0x2ae9e0=_0x2ae9e0-0x0;var _0xb2f720=_0xb715[_0x2ae9e0];return _0xb2f720;};'use strict';var client=require(_0x5b71('0x0'));exports[_0x5b71('0x1')]=function(){return function(){return client[_0x5b71('0x2')](_0x5b71('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x5b71('0x4'),'as':_0x5b71('0x5'),'attributes':['id',_0x5b71('0x6'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x97fe=['Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x3c74cc,_0x612d4d){var _0x3631aa=function(_0x2a638f){while(--_0x2a638f){_0x3c74cc['push'](_0x3c74cc['shift']());}};_0x3631aa(++_0x612d4d);}(_0x97fe,0x152));var _0xe97f=function(_0xefc910,_0x4a9dd1){_0xefc910=_0xefc910-0x0;var _0x5db0e3=_0x97fe[_0xefc910];return _0x5db0e3;};'use strict';var client=require(_0xe97f('0x0'));exports[_0xe97f('0x1')]=function(){return function(){return client[_0xe97f('0x2')](_0xe97f('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe97f('0x4')],'include':[{'model':'Interval','as':_0xe97f('0x5'),'attributes':['id','name',_0xe97f('0x6')]}]},'log':_0xe97f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 1bd412a..e2f3c27 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 _0x6d38=['updateMailInteraction','Request','addTagsToChatInteraction','update'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x6d38,0x1ef));var _0x86d3=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6d38[_0x31e29a];return _0x32d892;};'use strict';var client=require('../client');exports[_0x86d3('0x0')]=function(_0x4c9c06,_0x3db243){return client['Request']('UpdateMailInteraction',{'body':_0x3db243,'options':{'where':{'id':_0x4c9c06}},'log':_0x86d3('0x1')});};exports['addTags']=function(_0xe9198a,_0x455b9d){return client[_0x86d3('0x2')]('AddTagsToMailInteraction',{'body':_0x455b9d,'options':{'where':{'id':_0xe9198a}},'log':_0x86d3('0x3')});}; \ No newline at end of file +var _0x68b3=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b3,0x1d8));var _0x368b=function(_0x1a909a,_0x3103a2){_0x1a909a=_0x1a909a-0x0;var _0x222b98=_0x68b3[_0x1a909a];return _0x222b98;};'use strict';var client=require(_0x368b('0x0'));exports[_0x368b('0x1')]=function(_0x3e8034,_0xa371c){return client[_0x368b('0x2')]('UpdateMailInteraction',{'body':_0xa371c,'options':{'where':{'id':_0x3e8034}},'log':_0x368b('0x3')});};exports[_0x368b('0x4')]=function(_0xc40116,_0x404282){return client['Request'](_0x368b('0x5'),{'body':_0x404282,'options':{'where':{'id':_0xc40116}},'log':_0x368b('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 9008c7e..54063f1 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 _0x04d0=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x5c0210,_0x1b9a94){var _0x42f36b=function(_0x235e38){while(--_0x235e38){_0x5c0210['push'](_0x5c0210['shift']());}};_0x42f36b(++_0x1b9a94);}(_0x04d0,0x16e));var _0x004d=function(_0x4e558a,_0x4b60df){_0x4e558a=_0x4e558a-0x0;var _0x3b4ee8=_0x04d0[_0x4e558a];return _0x3b4ee8;};'use strict';var client=require(_0x004d('0x0'));exports[_0x004d('0x1')]=function(_0x1c806b){return client[_0x004d('0x2')](_0x004d('0x3'),{'body':_0x1c806b,'log':_0x004d('0x4')});}; \ No newline at end of file +var _0x7fe3=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x487bd7,_0x42e3db){var _0x2f363f=function(_0x52944d){while(--_0x52944d){_0x487bd7['push'](_0x487bd7['shift']());}};_0x2f363f(++_0x42e3db);}(_0x7fe3,0x17d));var _0x37fe=function(_0x36bcf2,_0x363835){_0x36bcf2=_0x36bcf2-0x0;var _0x200c4b=_0x7fe3[_0x36bcf2];return _0x200c4b;};'use strict';var client=require(_0x37fe('0x0'));exports[_0x37fe('0x1')]=function(_0x4b9f3e){return client['Request'](_0x37fe('0x2'),{'body':_0x4b9f3e,'log':_0x37fe('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 924615b..3ddfdc5 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 _0x6af6=['timeout','strategy','User','Agents','mailPause','getMailQueues','Request','GetMailQueue','name'];(function(_0x5046ea,_0x460958){var _0x3260f1=function(_0x3cb578){while(--_0x3cb578){_0x5046ea['push'](_0x5046ea['shift']());}};_0x3260f1(++_0x460958);}(_0x6af6,0x83));var _0x66af=function(_0x31522d,_0x5951e7){_0x31522d=_0x31522d-0x0;var _0x207c78=_0x6af6[_0x31522d];return _0x207c78;};'use strict';var client=require('../client');exports[_0x66af('0x0')]=function(){return function(){return client[_0x66af('0x1')](_0x66af('0x2'),{'options':{'raw':![],'attributes':['id',_0x66af('0x3'),_0x66af('0x4'),_0x66af('0x5')],'include':[{'model':_0x66af('0x6'),'as':_0x66af('0x7'),'attributes':['id',_0x66af('0x3'),'online',_0x66af('0x8')]}]},'log':_0x66af('0x0')});};}; \ No newline at end of file +var _0x8963=['Agents','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x8963,0xb6));var _0x3896=function(_0x1dfbb2,_0x37f1c7){_0x1dfbb2=_0x1dfbb2-0x0;var _0x5351f2=_0x8963[_0x1dfbb2];return _0x5351f2;};'use strict';var client=require(_0x3896('0x0'));exports[_0x3896('0x1')]=function(){return function(){return client[_0x3896('0x2')](_0x3896('0x3'),{'options':{'raw':![],'attributes':['id',_0x3896('0x4'),_0x3896('0x5'),_0x3896('0x6')],'include':[{'model':_0x3896('0x7'),'as':_0x3896('0x8'),'attributes':['id','name','online',_0x3896('0x9')]}]},'log':_0x3896('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 3dae9c9..c605849 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 _0x71bc=['../client','Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0x71bc,0x96));var _0xc71b=function(_0x3244a8,_0x30ddd9){_0x3244a8=_0x3244a8-0x0;var _0x4216f0=_0x71bc[_0x3244a8];return _0x4216f0;};'use strict';var client=require(_0xc71b('0x0'));exports['create']=function(_0x52305a){return client[_0xc71b('0x1')](_0xc71b('0x2'),{'body':_0x52305a,'log':_0xc71b('0x2')});};exports[_0xc71b('0x3')]=function(_0x390713,_0x1d5d25){return client[_0xc71b('0x1')]('UpdateMailQueueReport',{'body':_0x1d5d25,'options':{'where':{'uniqueid':_0x390713},'order':[['id',_0xc71b('0x4')]],'limit':0x1},'log':_0xc71b('0x5')});}; \ No newline at end of file +var _0x344e=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x344e,0x132));var _0xe344=function(_0x515984,_0x4cd902){_0x515984=_0x515984-0x0;var _0x54cd26=_0x344e[_0x515984];return _0x54cd26;};'use strict';var client=require(_0xe344('0x0'));exports[_0xe344('0x1')]=function(_0xa8f1b0){return client[_0xe344('0x2')](_0xe344('0x3'),{'body':_0xa8f1b0,'log':_0xe344('0x3')});};exports[_0xe344('0x4')]=function(_0x25e036,_0x1c9f46){return client[_0xe344('0x2')](_0xe344('0x5'),{'body':_0x1c9f46,'options':{'where':{'uniqueid':_0x25e036},'order':[['id',_0xe344('0x6')]],'limit':0x1},'log':_0xe344('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 59f3f4b..f26c34e 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 _0xcbdd=['../client','update','UpdateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x112267,_0x35a472){var _0x2657be=function(_0x14102b){while(--_0x14102b){_0x112267['push'](_0x112267['shift']());}};_0x2657be(++_0x35a472);}(_0xcbdd,0xb6));var _0xdcbd=function(_0xffd01,_0x1ff1df){_0xffd01=_0xffd01-0x0;var _0x464732=_0xcbdd[_0xffd01];return _0x464732;};'use strict';var client=require(_0xdcbd('0x0'));exports[_0xdcbd('0x1')]=function(_0x521c4a,_0x1b8f70){return client['Request'](_0xdcbd('0x2'),{'body':_0x1b8f70,'options':{'where':{'id':_0x521c4a}},'log':'updateOpenchannelInteraction'});};exports[_0xdcbd('0x3')]=function(_0x441bd3,_0x4887cd){return client[_0xdcbd('0x4')](_0xdcbd('0x5'),{'body':_0x4887cd,'options':{'where':{'id':_0x441bd3}},'log':_0xdcbd('0x6')});}; \ No newline at end of file +var _0xac12=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','update','Request'];(function(_0x45f9db,_0x1f3104){var _0x54f66d=function(_0x3524b9){while(--_0x3524b9){_0x45f9db['push'](_0x45f9db['shift']());}};_0x54f66d(++_0x1f3104);}(_0xac12,0x71));var _0x2ac1=function(_0x563173,_0x42d40){_0x563173=_0x563173-0x0;var _0x2f58d3=_0xac12[_0x563173];return _0x2f58d3;};'use strict';var client=require('../client');exports[_0x2ac1('0x0')]=function(_0x2e385d,_0x841ea7){return client[_0x2ac1('0x1')](_0x2ac1('0x2'),{'body':_0x841ea7,'options':{'where':{'id':_0x2e385d}},'log':_0x2ac1('0x3')});};exports['addTags']=function(_0x1c3b5b,_0x3238f4){return client[_0x2ac1('0x1')](_0x2ac1('0x4'),{'body':_0x3238f4,'options':{'where':{'id':_0x1c3b5b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index bc68916..a003ab2 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 _0x67d7=['createOpenchannelMessage','../client','Request'];(function(_0x275621,_0x524302){var _0x2ad056=function(_0x1e962f){while(--_0x1e962f){_0x275621['push'](_0x275621['shift']());}};_0x2ad056(++_0x524302);}(_0x67d7,0x1de));var _0x767d=function(_0x2d8667,_0x3a4ac6){_0x2d8667=_0x2d8667-0x0;var _0x2b6069=_0x67d7[_0x2d8667];return _0x2b6069;};'use strict';var client=require(_0x767d('0x0'));exports['create']=function(_0x32c3d3){return client[_0x767d('0x1')]('CreateOpenchannelMessage',{'body':_0x32c3d3,'log':_0x767d('0x2')});}; \ No newline at end of file +var _0xab7f=['createOpenchannelMessage','../client','Request','CreateOpenchannelMessage'];(function(_0x24892f,_0x3bdc63){var _0x18eb50=function(_0x5b3662){while(--_0x5b3662){_0x24892f['push'](_0x24892f['shift']());}};_0x18eb50(++_0x3bdc63);}(_0xab7f,0x109));var _0xfab7=function(_0x11cf75,_0xc423db){_0x11cf75=_0x11cf75-0x0;var _0x54d8cc=_0xab7f[_0x11cf75];return _0x54d8cc;};'use strict';var client=require(_0xfab7('0x0'));exports['create']=function(_0x547750){return client[_0xfab7('0x1')](_0xfab7('0x2'),{'body':_0x547750,'log':_0xfab7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index a1c7a49..a0867f2 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 _0xa32a=['openchannelPause','../client','Request','GetOpenchannelQueue','Agents','online'];(function(_0x409746,_0x1d3b05){var _0x52d368=function(_0x37ff83){while(--_0x37ff83){_0x409746['push'](_0x409746['shift']());}};_0x52d368(++_0x1d3b05);}(_0xa32a,0x1a5));var _0xaa32=function(_0x1c9108,_0x26f835){_0x1c9108=_0x1c9108-0x0;var _0x1ee828=_0xa32a[_0x1c9108];return _0x1ee828;};'use strict';var client=require(_0xaa32('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xaa32('0x1')](_0xaa32('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':'User','as':_0xaa32('0x3'),'attributes':['id','name',_0xaa32('0x4'),_0xaa32('0x5')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x31ee=['getOpenchannelQueues','Request','GetOpenchannelQueue','strategy','Agents','online','openchannelPause'];(function(_0x158d51,_0x43732f){var _0x441542=function(_0x38695c){while(--_0x38695c){_0x158d51['push'](_0x158d51['shift']());}};_0x441542(++_0x43732f);}(_0x31ee,0x181));var _0xe31e=function(_0x1b43e3,_0x9f8fed){_0x1b43e3=_0x1b43e3-0x0;var _0xbfcd48=_0x31ee[_0x1b43e3];return _0xbfcd48;};'use strict';var client=require('../client');exports[_0xe31e('0x0')]=function(){return function(){return client[_0xe31e('0x1')](_0xe31e('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xe31e('0x3')],'include':[{'model':'User','as':_0xe31e('0x4'),'attributes':['id','name',_0xe31e('0x5'),_0xe31e('0x6')]}]},'log':_0xe31e('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8fb80e4..c777381 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 _0x5eb8=['DESC','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x4afdce,_0x2d1a6a){var _0x5a163f=function(_0x392115){while(--_0x392115){_0x4afdce['push'](_0x4afdce['shift']());}};_0x5a163f(++_0x2d1a6a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0x5eb8[_0x4599b6];return _0x2e014c;};'use strict';var client=require('../client');exports['create']=function(_0x16de3e){return client[_0x85eb('0x0')](_0x85eb('0x1'),{'body':_0x16de3e,'log':_0x85eb('0x1')});};exports[_0x85eb('0x2')]=function(_0x13d8a9,_0x13b1df){return client[_0x85eb('0x0')](_0x85eb('0x3'),{'body':_0x13b1df,'options':{'where':{'uniqueid':_0x13d8a9},'order':[['id',_0x85eb('0x4')]],'limit':0x1},'log':_0x85eb('0x3')});}; \ No newline at end of file +var _0x3ee7=['UpdateOpenchannelQueueReport','DESC','create','CreateOpenchannelQueueReport','update','Request'];(function(_0x18d634,_0x37fe9f){var _0x29111e=function(_0x53262a){while(--_0x53262a){_0x18d634['push'](_0x18d634['shift']());}};_0x29111e(++_0x37fe9f);}(_0x3ee7,0x98));var _0x73ee=function(_0x2e68f3,_0x13dc10){_0x2e68f3=_0x2e68f3-0x0;var _0x977ca0=_0x3ee7[_0x2e68f3];return _0x977ca0;};'use strict';var client=require('../client');exports[_0x73ee('0x0')]=function(_0x5b474a){return client['Request'](_0x73ee('0x1'),{'body':_0x5b474a,'log':'CreateOpenchannelQueueReport'});};exports[_0x73ee('0x2')]=function(_0x241962,_0x2aebdc){return client[_0x73ee('0x3')](_0x73ee('0x4'),{'body':_0x2aebdc,'options':{'where':{'uniqueid':_0x241962},'order':[['id',_0x73ee('0x5')]],'limit':0x1},'log':_0x73ee('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 139a49e..d668eb5 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 _0x769c=['../client','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x2a07b0,_0x3732a5){var _0x1684ef=function(_0x598946){while(--_0x598946){_0x2a07b0['push'](_0x2a07b0['shift']());}};_0x1684ef(++_0x3732a5);}(_0x769c,0x96));var _0xc769=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x769c[_0x27af45];return _0x18df21;};'use strict';var client=require(_0xc769('0x0'));exports['update']=function(_0x2bcf3f,_0x463db3){return client['Request']('UpdateSmsInteraction',{'body':_0x463db3,'options':{'where':{'id':_0x2bcf3f}},'log':_0xc769('0x1')});};exports[_0xc769('0x2')]=function(_0x21f114,_0x3409d2){return client['Request'](_0xc769('0x3'),{'body':_0x3409d2,'options':{'where':{'id':_0x21f114}},'log':_0xc769('0x4')});}; \ No newline at end of file +var _0x3c6d=['addTags','Request','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x34d0a7,_0x5d4984){var _0x4fcb37=function(_0x50027a){while(--_0x50027a){_0x34d0a7['push'](_0x34d0a7['shift']());}};_0x4fcb37(++_0x5d4984);}(_0x3c6d,0x199));var _0xd3c6=function(_0x52d09e,_0x322ec4){_0x52d09e=_0x52d09e-0x0;var _0x8dc34d=_0x3c6d[_0x52d09e];return _0x8dc34d;};'use strict';var client=require(_0xd3c6('0x0'));exports[_0xd3c6('0x1')]=function(_0x223ca0,_0x272030){return client['Request'](_0xd3c6('0x2'),{'body':_0x272030,'options':{'where':{'id':_0x223ca0}},'log':_0xd3c6('0x3')});};exports[_0xd3c6('0x4')]=function(_0x28b706,_0x26c5b9){return client[_0xd3c6('0x5')]('AddTagsToSmsInteraction',{'body':_0x26c5b9,'options':{'where':{'id':_0x28b706}},'log':_0xd3c6('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 73aa3ae..687d633 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 _0xa370=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xa370,0x65));var _0x0a37=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xa370[_0xe39824];return _0x4bc31e;};'use strict';var client=require(_0x0a37('0x0'));exports[_0x0a37('0x1')]=function(_0x4eb9a8){return client['Request'](_0x0a37('0x2'),{'body':_0x4eb9a8,'log':_0x0a37('0x3')});}; \ No newline at end of file +var _0x8a97=['createSmsMessage','../client','create'];(function(_0x2ce9da,_0xb5c27a){var _0xa53326=function(_0x59e6d0){while(--_0x59e6d0){_0x2ce9da['push'](_0x2ce9da['shift']());}};_0xa53326(++_0xb5c27a);}(_0x8a97,0x67));var _0x78a9=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x8a97[_0xf50820];return _0x2a9b10;};'use strict';var client=require(_0x78a9('0x0'));exports[_0x78a9('0x1')]=function(_0x4852e5){return client['Request']('CreateSmsMessage',{'body':_0x4852e5,'log':_0x78a9('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 0d18c02..2ebb431 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x230575,_0x399b7f){var _0x4c0131=function(_0x2979f7){while(--_0x2979f7){_0x230575['push'](_0x230575['shift']());}};_0x4c0131(++_0x399b7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x4aa67d,_0x2558fe){var _0x20f5eb=function(_0xb9afbf){while(--_0xb9afbf){_0x4aa67d['push'](_0x4aa67d['shift']());}};_0x20f5eb(++_0x2558fe);}(_0xe706,0xa3));var _0x6e70=function(_0x54cfa4,_0x2d41ac){_0x54cfa4=_0x54cfa4-0x0;var _0x26ecf5=_0xe706[_0x54cfa4];return _0x26ecf5;};'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 ea4f5b0..13ea53d 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x390c73,_0x44cc5b){var _0x3a144e=function(_0x559df4){while(--_0x559df4){_0x390c73['push'](_0x390c73['shift']());}};_0x3a144e(++_0x44cc5b);}(_0x3e74,0x175));var _0x43e7=function(_0x2abb7b,_0x1e7144){_0x2abb7b=_0x2abb7b-0x0;var _0xcb485d=_0x3e74[_0x2abb7b];return _0xcb485d;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x3b0c67,_0x3edd6f){var _0x16cdd1=function(_0x198dbf){while(--_0x198dbf){_0x3b0c67['push'](_0x3b0c67['shift']());}};_0x16cdd1(++_0x3edd6f);}(_0x34e8,0x12c));var _0x834e=function(_0x388d2b,_0x36b89f){_0x388d2b=_0x388d2b-0x0;var _0x5018c1=_0x34e8[_0x388d2b];return _0x5018c1;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 0867d0f..e6353c5 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(_0x8d2bb2,_0x12f770){var _0x33473a=function(_0x4446b1){while(--_0x4446b1){_0x8d2bb2['push'](_0x8d2bb2['shift']());}};_0x33473a(++_0x12f770);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x485c22,_0x46cd95){var _0x35e3f8=function(_0x28bb50){while(--_0x28bb50){_0x485c22['push'](_0x485c22['shift']());}};_0x35e3f8(++_0x46cd95);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 a88844c..bf58f5d 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 _0x1a38=['addTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction'];(function(_0x58f647,_0x2d72e5){var _0x96606c=function(_0x33b72e){while(--_0x33b72e){_0x58f647['push'](_0x58f647['shift']());}};_0x96606c(++_0x2d72e5);}(_0x1a38,0xb0));var _0x81a3=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x1a38[_0x54b283];return _0x2462b3;};'use strict';var client=require(_0x81a3('0x0'));exports[_0x81a3('0x1')]=function(_0xfb6477,_0x5eb8e9){return client['Request']('UpdateWhatsappInteraction',{'body':_0x5eb8e9,'options':{'where':{'id':_0xfb6477}},'log':_0x81a3('0x2')});};exports[_0x81a3('0x3')]=function(_0x2faf46,_0x28fd86){return client[_0x81a3('0x4')](_0x81a3('0x5'),{'body':_0x28fd86,'options':{'where':{'id':_0x2faf46}},'log':_0x81a3('0x6')});}; \ No newline at end of file +var _0x93bb=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x3f528a,_0xbf8522){var _0x39ffb5=function(_0x574ab7){while(--_0x574ab7){_0x3f528a['push'](_0x3f528a['shift']());}};_0x39ffb5(++_0xbf8522);}(_0x93bb,0x135));var _0xb93b=function(_0x126f94,_0x3163bb){_0x126f94=_0x126f94-0x0;var _0x4defd1=_0x93bb[_0x126f94];return _0x4defd1;};'use strict';var client=require(_0xb93b('0x0'));exports[_0xb93b('0x1')]=function(_0x3f1712,_0x34b579){return client[_0xb93b('0x2')](_0xb93b('0x3'),{'body':_0x34b579,'options':{'where':{'id':_0x3f1712}},'log':_0xb93b('0x4')});};exports[_0xb93b('0x5')]=function(_0x3eb285,_0x355196){return client['Request'](_0xb93b('0x6'),{'body':_0x355196,'options':{'where':{'id':_0x3eb285}},'log':_0xb93b('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index dc4ed12..9d57ffb 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 _0x6106=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6106,0xf4));var _0x6610=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x6106[_0x411017];return _0x2adeea;};'use strict';var client=require(_0x6610('0x0'));exports[_0x6610('0x1')]=function(_0x133291){return client[_0x6610('0x2')](_0x6610('0x3'),{'body':_0x133291,'log':_0x6610('0x4')});}; \ No newline at end of file +var _0x13a0=['CreateWhatsappMessage','createWhatsappMessage','create','Request'];(function(_0x5b3e28,_0x2ad693){var _0x21a6f4=function(_0xea4216){while(--_0xea4216){_0x5b3e28['push'](_0x5b3e28['shift']());}};_0x21a6f4(++_0x2ad693);}(_0x13a0,0x1ce));var _0x013a=function(_0x501099,_0x223250){_0x501099=_0x501099-0x0;var _0x555ebf=_0x13a0[_0x501099];return _0x555ebf;};'use strict';var client=require('../client');exports[_0x013a('0x0')]=function(_0x4d443f){return client[_0x013a('0x1')](_0x013a('0x2'),{'body':_0x4d443f,'log':_0x013a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 25c3965..ad6480f 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 _0x0d71=['User','getWhatsappQueues','../client','GetWhatsappQueue','name','strategy'];(function(_0x46de88,_0x4b3dd9){var _0x511746=function(_0xa4e267){while(--_0xa4e267){_0x46de88['push'](_0x46de88['shift']());}};_0x511746(++_0x4b3dd9);}(_0x0d71,0x1f4));var _0x10d7=function(_0x3c8cae,_0x3931de){_0x3c8cae=_0x3c8cae-0x0;var _0x37ab4e=_0x0d71[_0x3c8cae];return _0x37ab4e;};'use strict';var client=require(_0x10d7('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x10d7('0x1'),{'options':{'raw':![],'attributes':['id',_0x10d7('0x2'),'timeout',_0x10d7('0x3')],'include':[{'model':_0x10d7('0x4'),'as':'Agents','attributes':['id',_0x10d7('0x2'),'online','whatsappPause']}]},'log':_0x10d7('0x5')});};}; \ No newline at end of file +var _0x71d2=['whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x13a219,_0x25acd3){var _0x50e371=function(_0x187aea){while(--_0x187aea){_0x13a219['push'](_0x13a219['shift']());}};_0x50e371(++_0x25acd3);}(_0x71d2,0x64));var _0x271d=function(_0x3a247e,_0x4b9170){_0x3a247e=_0x3a247e-0x0;var _0x372de8=_0x71d2[_0x3a247e];return _0x372de8;};'use strict';var client=require('../client');exports[_0x271d('0x0')]=function(){return function(){return client[_0x271d('0x1')](_0x271d('0x2'),{'options':{'raw':![],'attributes':['id',_0x271d('0x3'),_0x271d('0x4'),_0x271d('0x5')],'include':[{'model':_0x271d('0x6'),'as':_0x271d('0x7'),'attributes':['id','name','online',_0x271d('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3fc2f55..8337ee9 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 _0x8451=['UpdateWhatsappQueueReport','DESC','../client','CreateWhatsappQueueReport','update','Request'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0x8451,0x176));var _0x1845=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x8451[_0x36ed48];return _0x51c63a;};'use strict';var client=require(_0x1845('0x0'));exports['create']=function(_0x86c1b8){return client['Request'](_0x1845('0x1'),{'body':_0x86c1b8,'log':_0x1845('0x1')});};exports[_0x1845('0x2')]=function(_0x22d3db,_0x502d4d){return client[_0x1845('0x3')](_0x1845('0x4'),{'body':_0x502d4d,'options':{'where':{'uniqueid':_0x22d3db},'order':[['id',_0x1845('0x5')]],'limit':0x1},'log':_0x1845('0x4')});}; \ No newline at end of file +var _0xe18d=['Request','UpdateWhatsappQueueReport','DESC','../client','CreateWhatsappQueueReport','update'];(function(_0x28f8e4,_0x52349f){var _0x1f2ebd=function(_0xae7aab){while(--_0xae7aab){_0x28f8e4['push'](_0x28f8e4['shift']());}};_0x1f2ebd(++_0x52349f);}(_0xe18d,0x75));var _0xde18=function(_0x4dc161,_0x13b5f8){_0x4dc161=_0x4dc161-0x0;var _0x4c5572=_0xe18d[_0x4dc161];return _0x4c5572;};'use strict';var client=require(_0xde18('0x0'));exports['create']=function(_0x127ad0){return client['Request'](_0xde18('0x1'),{'body':_0x127ad0,'log':_0xde18('0x1')});};exports[_0xde18('0x2')]=function(_0x283528,_0x42a502){return client[_0xde18('0x3')](_0xde18('0x4'),{'body':_0x42a502,'options':{'where':{'uniqueid':_0x283528},'order':[['id',_0xde18('0x5')]],'limit':0x1},'log':_0xde18('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index b8c5a1a..1e3f4ac 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 _0xbb55=['error','[%s][AGENT]\x20%s','map','message','join','stop','timeout','createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence'];(function(_0x34dee,_0x308a9e){var _0x2dbda2=function(_0x15b6bc){while(--_0x15b6bc){_0x34dee['push'](_0x34dee['shift']());}};_0x2dbda2(++_0x308a9e);}(_0xbb55,0xc5));var _0x5bb5=function(_0x1c9bc2,_0x2f1aa6){_0x1c9bc2=_0x1c9bc2-0x0;var _0x26665a=_0xbb55[_0x1c9bc2];return _0x26665a;};'use strict';var schema=require(_0x5bb5('0x0'));var _=require(_0x5bb5('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x5bb5('0x2'))(_0x5bb5('0x3'));var strategy=require(_0x5bb5('0x4'));var queue=schema({'name':{'type':_0x5bb5('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x5bb5('0x6'),'message':_0x5bb5('0x7')}});function writeLog(_0x5bdd65,_0x144177,_0x56ab27){return logger[_0x5bb5('0x8')](util[_0x5bb5('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5bdd65,_0x144177[_0x5bb5('0xa')],_0x56ab27));}function handleFindAgent(_0x5595b4){return function(_0x5e3174){return _0x5e3174[_0x5bb5('0xa')][_0x5bb5('0xb')]()===_0x5595b4['toLowerCase']();};}exports[_0x5bb5('0xc')]=function(_0x4942dd,_0x2c7faa,_0x205022,_0x37a1b6){return function(_0x1b74ee){try{var _0x26bf30={'name':_0x2c7faa[0x0],'timeout':_0x2c7faa[0x1]};var _0x27f743=queue[_0x5bb5('0x0')](_0x26bf30,{'typecast':!![]});if(_0x27f743['length']){logger[_0x5bb5('0xd')](_0x5bb5('0xe'),_0x4942dd,_[_0x5bb5('0xf')](_0x27f743,_0x5bb5('0x10'))[_0x5bb5('0x11')](',\x20'));_0x1b74ee[_0x5bb5('0x12')]();}else{var _0x17a1f3=_['find'](_0x205022['agents'],handleFindAgent(_0x26bf30['name']));if(_0x17a1f3){var _0x388bb5=(_0x26bf30[_0x5bb5('0x13')]||0xa)*0x3e8;var _0x1b55b0,_0x189539;var _0x531f49=seqqueue[_0x5bb5('0x14')](_0x388bb5);_0x531f49['id']=_0x4942dd;_0x531f49[_0x5bb5('0x15')]=_0x388bb5;_0x531f49[_0x5bb5('0x16')]=_0x37a1b6[_0x5bb5('0x16')];writeLog(_0x4942dd,_0x17a1f3,util[_0x5bb5('0x9')](_0x5bb5('0x17'),_0x388bb5));_0x205022['rules'][_0x4942dd]['on'](_0x5bb5('0x18'),function(){logger[_0x5bb5('0x8')](_0x5bb5('0x19'),_0x4942dd);clearTimeout(_0x189539);_0x189539=undefined;_0x531f49['close']();if(_0x205022['rules'][_0x4942dd]){delete _0x205022[_0x5bb5('0x1a')][_0x4942dd];}_0x1b74ee['stop']();});_0x205022[_0x5bb5('0x1a')][_0x4942dd]['on'](_0x5bb5('0x1b'),function(){if(_0x205022[_0x5bb5('0x1a')][_0x4942dd]){delete _0x205022['rules'][_0x4942dd];}});_0x189539=setTimeout(function(){logger['info'](_0x5bb5('0x1c'),_0x4942dd);clearTimeout(_0x189539);_0x531f49['close']();_0x1b74ee[_0x5bb5('0x1d')]();},_0x388bb5);strategy[_0x5bb5('0x1e')](_0x531f49,_0x17a1f3,_0x205022,_0x37a1b6);}else{logger[_0x5bb5('0xd')](_0x5bb5('0x1f'),_0x4942dd,_0x26bf30[_0x5bb5('0xa')]);_0x1b74ee[_0x5bb5('0x12')]();}}}catch(_0x18f7ef){console[_0x5bb5('0x20')](_0x18f7ef);logger['error'](_0x5bb5('0x21'),_0x4942dd,_0x18f7ef[_0x5bb5('0x22')]);_0x1b74ee[_0x5bb5('0x12')]();}};}; \ No newline at end of file +var _0xf5cc=['info','format','name','toLowerCase','consequence','length','error','map','join','stop','find','agents','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xf5cc,0x1a5));var _0xcf5c=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xf5cc[_0x176329];return _0x31997c;};'use strict';var schema=require(_0xcf5c('0x0'));var _=require(_0xcf5c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0xcf5c('0x2'));var strategy=require(_0xcf5c('0x3'));var queue=schema({'name':{'type':_0xcf5c('0x4'),'required':!![],'message':_0xcf5c('0x5')},'timeout':{'type':_0xcf5c('0x6'),'message':_0xcf5c('0x7')}});function writeLog(_0x318cf5,_0x1dbede,_0xfa62c8){return logger[_0xcf5c('0x8')](util[_0xcf5c('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x318cf5,_0x1dbede[_0xcf5c('0xa')],_0xfa62c8));}function handleFindAgent(_0x2fae1b){return function(_0x36f6be){return _0x36f6be[_0xcf5c('0xa')][_0xcf5c('0xb')]()===_0x2fae1b['toLowerCase']();};}exports[_0xcf5c('0xc')]=function(_0xdf0ba3,_0x26c7ed,_0x285f00,_0x271642){return function(_0x1f1c49){try{var _0x255c4a={'name':_0x26c7ed[0x0],'timeout':_0x26c7ed[0x1]};var _0x5c5a22=queue[_0xcf5c('0x0')](_0x255c4a,{'typecast':!![]});if(_0x5c5a22[_0xcf5c('0xd')]){logger[_0xcf5c('0xe')]('[%s][AGENT]\x20%s',_0xdf0ba3,_[_0xcf5c('0xf')](_0x5c5a22,'message')[_0xcf5c('0x10')](',\x20'));_0x1f1c49[_0xcf5c('0x11')]();}else{var _0x34b035=_[_0xcf5c('0x12')](_0x285f00[_0xcf5c('0x13')],handleFindAgent(_0x255c4a[_0xcf5c('0xa')]));if(_0x34b035){var _0x271286=(_0x255c4a['timeout']||0xa)*0x3e8;var _0x2a6e4c,_0x32d917;var _0x37eee2=seqqueue['createQueue'](_0x271286);_0x37eee2['id']=_0xdf0ba3;_0x37eee2[_0xcf5c('0x14')]=_0x271286;_0x37eee2['channel']=_0x271642[_0xcf5c('0x15')];writeLog(_0xdf0ba3,_0x34b035,util[_0xcf5c('0x9')](_0xcf5c('0x16'),_0x271286));_0x285f00[_0xcf5c('0x17')][_0xdf0ba3]['on'](_0xcf5c('0x18'),function(){logger[_0xcf5c('0x8')](_0xcf5c('0x19'),_0xdf0ba3);clearTimeout(_0x32d917);_0x32d917=undefined;_0x37eee2['close']();if(_0x285f00[_0xcf5c('0x17')][_0xdf0ba3]){delete _0x285f00[_0xcf5c('0x17')][_0xdf0ba3];}_0x1f1c49[_0xcf5c('0x11')]();});_0x285f00['rules'][_0xdf0ba3]['on']('complete',function(){if(_0x285f00[_0xcf5c('0x17')][_0xdf0ba3]){delete _0x285f00[_0xcf5c('0x17')][_0xdf0ba3];}});_0x32d917=setTimeout(function(){logger[_0xcf5c('0x8')](_0xcf5c('0x1a'),_0xdf0ba3);clearTimeout(_0x32d917);_0x37eee2[_0xcf5c('0x1b')]();_0x1f1c49[_0xcf5c('0x1c')]();},_0x271286);strategy['agent'](_0x37eee2,_0x34b035,_0x285f00,_0x271642);}else{logger['error'](_0xcf5c('0x1d'),_0xdf0ba3,_0x255c4a[_0xcf5c('0xa')]);_0x1f1c49[_0xcf5c('0x11')]();}}}catch(_0xf3ddf){console[_0xcf5c('0x1e')](_0xf3ddf);logger[_0xcf5c('0xe')](_0xcf5c('0x1f'),_0xdf0ba3,_0xf3ddf[_0xcf5c('0x20')]);_0x1f1c49['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 4bb96b4..e61ec18 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 _0x78b3=['format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','created','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST','message','postText','amazonlex','providerResponse','dialogState','Failed','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact'];(function(_0x13d36c,_0x5e31df){var _0x82cd1a=function(_0x3f70e7){while(--_0x3f70e7){_0x13d36c['push'](_0x13d36c['shift']());}};_0x82cd1a(++_0x5e31df);}(_0x78b3,0xaa));var _0x378b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x378b('0x0'));var moment=require(_0x378b('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x378b('0x2'))(_0x378b('0x3'));var rpc={'chatMessage':require(_0x378b('0x4')),'openchannelMessage':require(_0x378b('0x5')),'mailMessage':require(_0x378b('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x378b('0x7'))};exports[_0x378b('0x8')]=function(_0x4c21d6,_0x36c320){return function(_0x52fa16){try{if(!_[_0x378b('0x9')](this[_0x378b('0xa')]['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4c21d6,_0x378b('0xb'));return _0x52fa16[_0x378b('0xc')]();}var _0x346a09={'ContactId':this[_0x378b('0xd')]['id'],'sentAt':moment()[_0x378b('0xe')](_0x378b('0xf')),'direction':'out'};if(this[_0x378b('0x10')]==='sms'||this[_0x378b('0x10')]===_0x378b('0x11')){_0x346a09[_0x378b('0x12')]=this[_0x378b('0xa')][_0x378b('0x12')];}var _0x3a24a0=this[_0x378b('0x10')];if(_0x3a24a0===_0x378b('0x13')){_0x346a09[_0x378b('0x14')]=this['account']['id'];}else{_0x346a09[_[_0x378b('0x15')](_0x3a24a0)+'AccountId']=this[_0x378b('0x16')]['id'];}_0x346a09[_[_0x378b('0x15')](_0x3a24a0)+_0x378b('0x17')]=this[_0x378b('0xa')]['id'];if(this[_0x378b('0xa')][_0x378b('0x18')]){var _0x17c6a8=_0x36c320[0x4];if(!_['isEmpty'](_0x17c6a8)){_0x346a09[_0x378b('0x19')]=utils[_0x378b('0x1a')](_0x17c6a8,this);return rpc[_0x3a24a0+_0x378b('0x1b')][_0x378b('0x1c')](_0x346a09)[_0x378b('0x1d')](function(_0x498d82){logger['info'](_0x378b('0x1e'),_0x4c21d6,_0x346a09[_0x378b('0x19')]);})[_0x378b('0x1f')](function(_0x1da5d4){logger[_0x378b('0x20')](_0x378b('0x1e'),_0x4c21d6,JSON[_0x378b('0x21')](_0x1da5d4));})[_0x378b('0x22')](function(){logger[_0x378b('0x23')](_0x378b('0x24'),_0x4c21d6);_0x52fa16['stop']();});}else{logger[_0x378b('0x23')](_0x378b('0x25'),_0x4c21d6);_0x52fa16[_0x378b('0x26')]();}}else{var _0x5b1dd3=this;var _0x52f4a5=new AWS['LexRuntime']({'accessKeyId':_0x36c320[0x0],'secretAccessKey':_0x36c320[0x1],'region':_0x36c320[0x2]});var _0x27f4ae={'botAlias':_0x378b('0x27'),'botName':_0x36c320[0x3],'inputText':this[_0x378b('0x28')][_0x378b('0x19')],'userId':this[_0x378b('0x10')]+':'+this['interaction']['id']['toString']()};_0x52f4a5[_0x378b('0x29')](_0x27f4ae,function(_0x34ab2d,_0x3cd94b){if(_0x34ab2d){logger[_0x378b('0x20')](_0x378b('0x1e'),_0x4c21d6,_0x34ab2d[_0x378b('0x28')]);_0x52fa16[_0x378b('0xc')]();}else if(_0x3cd94b&&_0x3cd94b[_0x378b('0x28')]){_0x5b1dd3[_0x378b('0x19')][_0x378b('0x2a')]=_0x3cd94b;_0x346a09[_0x378b('0x19')]=_0x3cd94b[_0x378b('0x28')];_0x346a09['providerName']=_0x378b('0x2a');_0x346a09[_0x378b('0x2b')]=JSON[_0x378b('0x21')](_0x3cd94b);return rpc[_0x3a24a0+_0x378b('0x1b')]['create'](_0x346a09)[_0x378b('0x1d')](function(_0x2c6403){logger[_0x378b('0x23')](_0x378b('0x1e'),_0x4c21d6,_0x346a09[_0x378b('0x19')]);if(_0x3cd94b[_0x378b('0x2c')]==_0x378b('0x2d')){_0x52fa16['next']();}else{_0x52fa16[_0x378b('0x26')]();}})[_0x378b('0x1f')](function(_0x2b5d8d){logger[_0x378b('0x20')]('[%s][AMAZONLEX]\x20%s',_0x4c21d6,JSON['stringify'](_0x2b5d8d));_0x52fa16['next']();});}else{_0x52fa16['next']();}});}}catch(_0x1998c0){logger[_0x378b('0x20')](_0x378b('0x1e'),_0x4c21d6,JSON['stringify'](_0x1998c0));_0x52fa16['stop']();}};}; \ No newline at end of file +var _0x0e1a=['finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','then','dialogState','Failed','lodash','moment','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','phone','chat','account','AccountId','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','body','catch','error','stringify'];(function(_0x46c5d3,_0x591ff9){var _0x280fc2=function(_0x5e7d2c){while(--_0x5e7d2c){_0x46c5d3['push'](_0x46c5d3['shift']());}};_0x280fc2(++_0x591ff9);}(_0x0e1a,0x1d0));var _0xa0e1=function(_0x260f5d,_0x43e929){_0x260f5d=_0x260f5d-0x0;var _0x5d1bcf=_0x0e1a[_0x260f5d];return _0x5d1bcf;};'use strict';var _=require(_0xa0e1('0x0'));var moment=require(_0xa0e1('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')(_0xa0e1('0x2'));var rpc={'chatMessage':require(_0xa0e1('0x3')),'openchannelMessage':require(_0xa0e1('0x4')),'mailMessage':require(_0xa0e1('0x5')),'smsMessage':require(_0xa0e1('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa0e1('0x7'))};exports[_0xa0e1('0x8')]=function(_0x3c14ae,_0x59b055){return function(_0x5e7398){try{if(!_[_0xa0e1('0x9')](this['interaction'][_0xa0e1('0xa')])){logger[_0xa0e1('0xb')](_0xa0e1('0xc'),_0x3c14ae,_0xa0e1('0xd'));return _0x5e7398[_0xa0e1('0xe')]();}var _0x174fb2={'ContactId':this[_0xa0e1('0xf')]['id'],'sentAt':moment()[_0xa0e1('0x10')](_0xa0e1('0x11')),'direction':_0xa0e1('0x12')};if(this[_0xa0e1('0x13')]===_0xa0e1('0x14')||this['channel']===_0xa0e1('0x15')){_0x174fb2['phone']=this[_0xa0e1('0x16')][_0xa0e1('0x17')];}var _0x32753d=this[_0xa0e1('0x13')];if(_0x32753d===_0xa0e1('0x18')){_0x174fb2['ChatWebsiteId']=this[_0xa0e1('0x19')]['id'];}else{_0x174fb2[_['upperFirst'](_0x32753d)+_0xa0e1('0x1a')]=this['account']['id'];}_0x174fb2[_[_0xa0e1('0x1b')](_0x32753d)+_0xa0e1('0x1c')]=this[_0xa0e1('0x16')]['id'];if(this[_0xa0e1('0x16')]['created']){var _0x3df9b1=_0x59b055[0x4];if(!_[_0xa0e1('0x1d')](_0x3df9b1)){_0x174fb2['body']=utils[_0xa0e1('0x1e')](_0x3df9b1,this);return rpc[_0x32753d+_0xa0e1('0x1f')]['create'](_0x174fb2)['then'](function(_0x3e3fe6){logger[_0xa0e1('0xb')](_0xa0e1('0xc'),_0x3c14ae,_0x174fb2[_0xa0e1('0x20')]);})[_0xa0e1('0x21')](function(_0x4b98c8){logger[_0xa0e1('0x22')]('[%s][AMAZONLEX]\x20%s',_0x3c14ae,JSON[_0xa0e1('0x23')](_0x4b98c8));})[_0xa0e1('0x24')](function(){logger[_0xa0e1('0xb')](_0xa0e1('0x25'),_0x3c14ae);_0x5e7398[_0xa0e1('0x26')]();});}else{logger[_0xa0e1('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3c14ae);_0x5e7398[_0xa0e1('0x26')]();}}else{var _0x589bb8=this;var _0x56130a=new AWS[(_0xa0e1('0x27'))]({'accessKeyId':_0x59b055[0x0],'secretAccessKey':_0x59b055[0x1],'region':_0x59b055[0x2]});var _0x494075={'botAlias':_0xa0e1('0x28'),'botName':_0x59b055[0x3],'inputText':this[_0xa0e1('0x29')][_0xa0e1('0x20')],'userId':this[_0xa0e1('0x13')]+':'+this['interaction']['id'][_0xa0e1('0x2a')]()};_0x56130a[_0xa0e1('0x2b')](_0x494075,function(_0x1e029f,_0x1e2c4c){if(_0x1e029f){logger[_0xa0e1('0x22')](_0xa0e1('0xc'),_0x3c14ae,_0x1e029f['message']);_0x5e7398[_0xa0e1('0xe')]();}else if(_0x1e2c4c&&_0x1e2c4c['message']){_0x589bb8[_0xa0e1('0x20')][_0xa0e1('0x2c')]=_0x1e2c4c;_0x174fb2[_0xa0e1('0x20')]=_0x1e2c4c[_0xa0e1('0x29')];_0x174fb2[_0xa0e1('0x2d')]='amazonlex';_0x174fb2[_0xa0e1('0x2e')]=JSON[_0xa0e1('0x23')](_0x1e2c4c);return rpc[_0x32753d+'Message']['create'](_0x174fb2)[_0xa0e1('0x2f')](function(_0x37468a){logger[_0xa0e1('0xb')](_0xa0e1('0xc'),_0x3c14ae,_0x174fb2['body']);if(_0x1e2c4c[_0xa0e1('0x30')]==_0xa0e1('0x31')){_0x5e7398[_0xa0e1('0xe')]();}else{_0x5e7398[_0xa0e1('0x26')]();}})['catch'](function(_0x37a2aa){logger[_0xa0e1('0x22')]('[%s][AMAZONLEX]\x20%s',_0x3c14ae,JSON['stringify'](_0x37a2aa));_0x5e7398[_0xa0e1('0xe')]();});}else{_0x5e7398[_0xa0e1('0xe')]();}});}}catch(_0x4fdd38){logger[_0xa0e1('0x22')](_0xa0e1('0xc'),_0x3c14ae,JSON[_0xa0e1('0x23')](_0x4fdd38));_0x5e7398[_0xa0e1('0x26')]();}};}; \ 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 c720fce..7a7f0d4 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 _0x1b8f=['message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender'];(function(_0x19f00f,_0x181deb){var _0x332a97=function(_0x21d60e){while(--_0x21d60e){_0x19f00f['push'](_0x19f00f['shift']());}};_0x332a97(++_0x181deb);}(_0x1b8f,0x6a));var _0xf1b8=function(_0x58669b,_0x4ffab0){_0x58669b=_0x58669b-0x0;var _0x19cc41=_0x1b8f[_0x58669b];return _0x19cc41;};'use strict';var _=require(_0xf1b8('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xf1b8('0x1'))(_0xf1b8('0x2'));var rpc={'chatMessage':require(_0xf1b8('0x3')),'openchannelMessage':require(_0xf1b8('0x4')),'mailMessage':require(_0xf1b8('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf1b8('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf1b8('0x7')),'mailInteraction':require(_0xf1b8('0x8')),'smsInteraction':require(_0xf1b8('0x9')),'faxInteraction':require(_0xf1b8('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xf1b8('0xb'));exports['consequence']=function(_0x39e583,_0x1ea7f5,_0x1bc2da,_0x503191){return function(_0x3007ff){try{var _0x148727=this[_0xf1b8('0xc')];if(_0x148727===_0xf1b8('0xd')&&_0x503191[_0xf1b8('0xe')]['isAutoreply']){logger[_0xf1b8('0xf')](_0xf1b8('0x10'),_0x39e583,_0xf1b8('0x11'));return _0x3007ff[_0xf1b8('0x12')]();}if(_0x1ea7f5[0x0]==='1'&&(_['isNil'](this[_0xf1b8('0x13')]['created'])||!this[_0xf1b8('0x13')][_0xf1b8('0x14')])){logger[_0xf1b8('0xf')](_0xf1b8('0x10'),_0x39e583,_0xf1b8('0x15'));return _0x3007ff[_0xf1b8('0x12')]();}if(_0x1ea7f5[0x0]==='2'&&this['interaction'][_0xf1b8('0x16')]){logger['info'](_0xf1b8('0x17'),_0x39e583,'One\x20Time\x20already\x20sent');return _0x3007ff[_0xf1b8('0x12')]();}var _0x1334ca={'ContactId':this[_0xf1b8('0x18')]['id'],'sentAt':moment()['format'](_0xf1b8('0x19')),'direction':_0xf1b8('0x1a')};if(this['channel']==='mail'){_0x1334ca[_0xf1b8('0xe')]=utils[_0xf1b8('0x1b')](_0x1ea7f5[0x2],this);}else{_0x1334ca[_0xf1b8('0xe')]=utils['getMustacheRender'](_0x1ea7f5[0x1],this);}if(this[_0xf1b8('0x1c')]){_0x1334ca['to']=this['message'][_0xf1b8('0x1d')]||'';if(this[_0xf1b8('0xc')]===_0xf1b8('0xd')&&_0x1ea7f5[0x1]==='1'){_0x1334ca['cc']=this[_0xf1b8('0x1c')]['cc']||'';}_0x1334ca[_0xf1b8('0x1d')]=this[_0xf1b8('0x1c')]['to']||'';_0x1334ca[_0xf1b8('0x1e')]=this[_0xf1b8('0x1c')][_0xf1b8('0x1e')]||'';_0x1334ca[_0xf1b8('0x1f')]=!![];if(this[_0xf1b8('0x1c')]['subject']){_0x1334ca['subject']='';_0x1334ca[_0xf1b8('0x20')]+=_[_0xf1b8('0x21')](this[_0xf1b8('0x1c')][_0xf1b8('0x20')],_0xf1b8('0x22'))?'':_0xf1b8('0x23');_0x1334ca[_0xf1b8('0x20')]+=this['message'][_0xf1b8('0x20')];}}if(this[_0xf1b8('0xc')]===_0xf1b8('0x24')){_0x1334ca['ChatWebsiteId']=this['account']['id'];}else{_0x1334ca[_[_0xf1b8('0x25')](this['channel'])+_0xf1b8('0x26')]=this['account']['id'];}_0x1334ca[_[_0xf1b8('0x25')](this['channel'])+_0xf1b8('0x27')]=this[_0xf1b8('0x13')]['id'];var _0x57495d=this['interaction'];if(rpc[this['channel']+_0xf1b8('0x28')]){if(this['channel']===_0xf1b8('0xd')){_0x1334ca[_0xf1b8('0x29')]=this[_0xf1b8('0x1c')][_0xf1b8('0x2a')];_0x1334ca[_0xf1b8('0x2b')]=_0xf1b8('0x2c')+_[_0xf1b8('0x2d')](_0x1334ca[_0xf1b8('0xe')],'','replace','','auto-replied','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','stop','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','format','mail','body','getMustacheRender','message','from','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c75,0x1ad));var _0x55c7=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0x5c75[_0x58da8a];return _0x5294b9;};'use strict';var _=require('lodash');var moment=require(_0x55c7('0x0'));var utils=require('./utils');var logger=require(_0x55c7('0x1'))('routing');var rpc={'chatMessage':require(_0x55c7('0x2')),'openchannelMessage':require(_0x55c7('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x55c7('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x55c7('0x5')),'openchannelInteraction':require(_0x55c7('0x6')),'mailInteraction':require(_0x55c7('0x7')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x55c7('0x8')),'whatsappInteraction':require(_0x55c7('0x9'))};var mailRpc=require('../../mailRpc');exports[_0x55c7('0xa')]=function(_0x5e0882,_0x37dd51,_0x4c617c,_0x269558){return function(_0x1bbaab){try{var _0x9e8630=this[_0x55c7('0xb')];if(_0x9e8630==='mail'&&_0x269558['body'][_0x55c7('0xc')]){logger[_0x55c7('0xd')](_0x55c7('0xe'),_0x5e0882,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x1bbaab[_0x55c7('0xf')]();}if(_0x37dd51[0x0]==='1'&&(_['isNil'](this[_0x55c7('0x10')][_0x55c7('0x11')])||!this[_0x55c7('0x10')][_0x55c7('0x11')])){logger[_0x55c7('0xd')]('[%s][AUTOREPLY]\x20%s',_0x5e0882,_0x55c7('0x12'));return _0x1bbaab[_0x55c7('0xf')]();}if(_0x37dd51[0x0]==='2'&&this[_0x55c7('0x10')][_0x55c7('0x13')]){logger[_0x55c7('0xd')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5e0882,'One\x20Time\x20already\x20sent');return _0x1bbaab[_0x55c7('0xf')]();}var _0x415f6e={'ContactId':this['contact']['id'],'sentAt':moment()[_0x55c7('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x55c7('0x15')){_0x415f6e[_0x55c7('0x16')]=utils[_0x55c7('0x17')](_0x37dd51[0x2],this);}else{_0x415f6e['body']=utils[_0x55c7('0x17')](_0x37dd51[0x1],this);}if(this[_0x55c7('0x18')]){_0x415f6e['to']=this['message'][_0x55c7('0x19')]||'';if(this[_0x55c7('0xb')]===_0x55c7('0x15')&&_0x37dd51[0x1]==='1'){_0x415f6e['cc']=this[_0x55c7('0x18')]['cc']||'';}_0x415f6e[_0x55c7('0x19')]=this[_0x55c7('0x18')]['to']||'';_0x415f6e['phone']=this[_0x55c7('0x18')]['phone']||'';_0x415f6e[_0x55c7('0x1a')]=!![];if(this[_0x55c7('0x18')]['subject']){_0x415f6e['subject']='';_0x415f6e[_0x55c7('0x1b')]+=_[_0x55c7('0x1c')](this[_0x55c7('0x18')]['subject'],_0x55c7('0x1d'))?'':_0x55c7('0x1e');_0x415f6e['subject']+=this[_0x55c7('0x18')]['subject'];}}if(this[_0x55c7('0xb')]==='chat'){_0x415f6e[_0x55c7('0x1f')]=this[_0x55c7('0x20')]['id'];}else{_0x415f6e[_[_0x55c7('0x21')](this['channel'])+_0x55c7('0x22')]=this['account']['id'];}_0x415f6e[_[_0x55c7('0x21')](this[_0x55c7('0xb')])+_0x55c7('0x23')]=this[_0x55c7('0x10')]['id'];var _0x59240e=this[_0x55c7('0x10')];if(rpc[this[_0x55c7('0xb')]+_0x55c7('0x24')]){if(this[_0x55c7('0xb')]===_0x55c7('0x15')){_0x415f6e['inReplyTo']=this['message'][_0x55c7('0x25')];_0x415f6e['html']=_0x55c7('0x26')+_[_0x55c7('0x27')](_0x415f6e[_0x55c7('0x16')],_0x55c7('0x28'),']+(>|$)/g,''),'priorityTrue':_0x143b2e[0x1],'priorityFalse':_0x143b2e[0x2]};var _0x164eda=gotoif['validate'](_0x7e156d,{'typecast':!![]});if(_0x164eda[_0xbf26('0xd')]){logger[_0xbf26('0xe')](_0xbf26('0xf'),_0x394a39,_['map'](_0x164eda,_0xbf26('0x10'))[_0xbf26('0x11')](',\x20'));_0x23e0b0[_0xbf26('0x12')]();}else{try{var _0x196d43=eval('('+_0x7e156d[_0xbf26('0x13')]+')');var _0x39489b=_0x196d43?_0x7e156d['priorityTrue']:_0x7e156d[_0xbf26('0x14')];logger[_0xbf26('0x15')](_0xbf26('0x16'),_0x394a39,_0x7e156d[_0xbf26('0x13')],_0x196d43,_0x39489b||'next');if(_0x39489b){var _0x4595f9=_[_0xbf26('0x17')](_0x23e0b0['rules'](),{'p':_0x39489b});if(_0x4595f9>=0x0){logger[_0xbf26('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x394a39,_0x39489b||_0xbf26('0x18'),_0x4595f9);_0x23e0b0[_0xbf26('0x18')](_0x4595f9);}else{logger[_0xbf26('0x15')](_0xbf26('0x19'),_0x394a39,_0x39489b||_0xbf26('0x18'));_0x23e0b0[_0xbf26('0x12')]();}}else{_0x23e0b0[_0xbf26('0x18')]();}}catch(_0x4a8184){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x394a39,_0x4a8184['message']);_0x23e0b0[_0xbf26('0x12')]();}}}catch(_0x381fe7){logger['error'](_0xbf26('0xf'),_0x394a39,JSON[_0xbf26('0x1a')](_0x381fe7));_0x23e0b0['stop']();}};}; \ No newline at end of file +var _0xc50a=['condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','map','message','stop'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xc50a,0x118));var _0xac50=function(_0x21d3d5,_0x38163c){_0x21d3d5=_0x21d3d5-0x0;var _0xf0057b=_0xc50a[_0x21d3d5];return _0xf0057b;};'use strict';var schema=require('validate');var _=require(_0xac50('0x0'));var htmlToText=require(_0xac50('0x1'));var utils=require('./utils');var logger=require(_0xac50('0x2'))(_0xac50('0x3'));var gotoif=schema({'condition':{'type':_0xac50('0x4'),'required':!![],'message':_0xac50('0x5')},'priorityTrue':{'type':_0xac50('0x6'),'message':_0xac50('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x466ba7,_0x79a1d4){return function(_0x56aa98){try{var _0x483976={'condition':htmlToText[_0xac50('0x8')](utils[_0xac50('0x9')](_0x79a1d4[0x0],this),{'wordwrap':![]})[_0xac50('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x79a1d4[0x1],'priorityFalse':_0x79a1d4[0x2]};var _0x354070=gotoif[_0xac50('0xb')](_0x483976,{'typecast':!![]});if(_0x354070['length']){logger[_0xac50('0xc')](_0xac50('0xd'),_0x466ba7,_[_0xac50('0xe')](_0x354070,_0xac50('0xf'))['join'](',\x20'));_0x56aa98[_0xac50('0x10')]();}else{try{var _0x3b0e25=eval('('+_0x483976[_0xac50('0x11')]+')');var _0x3a4d46=_0x3b0e25?_0x483976[_0xac50('0x12')]:_0x483976[_0xac50('0x13')];logger[_0xac50('0x14')](_0xac50('0x15'),_0x466ba7,_0x483976[_0xac50('0x11')],_0x3b0e25,_0x3a4d46||_0xac50('0x16'));if(_0x3a4d46){var _0x4d7ba4=_['findIndex'](_0x56aa98[_0xac50('0x17')](),{'p':_0x3a4d46});if(_0x4d7ba4>=0x0){logger['info'](_0xac50('0x18'),_0x466ba7,_0x3a4d46||_0xac50('0x16'),_0x4d7ba4);_0x56aa98[_0xac50('0x16')](_0x4d7ba4);}else{logger[_0xac50('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x466ba7,_0x3a4d46||'next');_0x56aa98[_0xac50('0x10')]();}}else{_0x56aa98[_0xac50('0x16')]();}}catch(_0x3933d1){logger[_0xac50('0xc')](_0xac50('0x19'),_0x466ba7,_0x3933d1['message']);_0x56aa98[_0xac50('0x10')]();}}}catch(_0x24ad69){logger[_0xac50('0xc')](_0xac50('0xd'),_0x466ba7,JSON[_0xac50('0x1a')](_0x24ad69));_0x56aa98[_0xac50('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 1f9e405..d82de69 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 _0x1f2d=['validate','lodash','../../../../config/logger','routing','number','consequence','length','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify'];(function(_0x5b3aca,_0x3d0d08){var _0x3c93b1=function(_0x11a2f5){while(--_0x11a2f5){_0x5b3aca['push'](_0x5b3aca['shift']());}};_0x3c93b1(++_0x3d0d08);}(_0x1f2d,0x1b8));var _0xd1f2=function(_0x40453a,_0x1ff061){_0x40453a=_0x40453a-0x0;var _0x2da74d=_0x1f2d[_0x40453a];return _0x2da74d;};'use strict';var schema=require(_0xd1f2('0x0'));var _=require(_0xd1f2('0x1'));var logger=require(_0xd1f2('0x2'))(_0xd1f2('0x3'));var gotop=schema({'priority':{'type':_0xd1f2('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xd1f2('0x5')]=function(_0x5cba58,_0x57e6d3){return function(_0x3f89f5){try{var _0x4db196={'priority':_0x57e6d3[0x0]};var _0xf99669=gotop[_0xd1f2('0x0')](_0x4db196,{'typecast':!![]});if(_0xf99669[_0xd1f2('0x6')]){logger[_0xd1f2('0x7')]('[%s][GOTOP]\x20%s',_0x5cba58,_[_0xd1f2('0x8')](_0xf99669,_0xd1f2('0x9'))[_0xd1f2('0xa')](',\x20'));_0x3f89f5[_0xd1f2('0xb')]();}else{logger[_0xd1f2('0xc')](_0xd1f2('0xd'),_0x5cba58,_0x4db196['priority']);if(_0x4db196[_0xd1f2('0xe')]){var _0x3c9804=_['findIndex'](_0x3f89f5[_0xd1f2('0xf')](),{'p':_0x4db196[_0xd1f2('0xe')]});if(_0x3c9804>=0x0){logger[_0xd1f2('0xc')](_0xd1f2('0x10'),_0x5cba58,_0x4db196[_0xd1f2('0xe')]||_0xd1f2('0x11'),_0x3c9804);_0x3f89f5[_0xd1f2('0x11')](_0x3c9804);}else{logger[_0xd1f2('0xc')](_0xd1f2('0x12'),_0x5cba58,_0x4db196[_0xd1f2('0xe')]||_0xd1f2('0x11'));_0x3f89f5['stop']();}}else{_0x3f89f5[_0xd1f2('0x11')]();}}}catch(_0x3df746){logger['error']('[%s][GOTOP]\x20%s',_0x5cba58,JSON[_0xd1f2('0x13')](_0x3df746));_0x3f89f5[_0xd1f2('0xb')]();}};}; \ No newline at end of file +var _0xbb7d=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','message','join','stop','priority','next','info'];(function(_0x214d4e,_0x5acd62){var _0x59468a=function(_0x52cc51){while(--_0x52cc51){_0x214d4e['push'](_0x214d4e['shift']());}};_0x59468a(++_0x5acd62);}(_0xbb7d,0xf1));var _0xdbb7=function(_0x279e82,_0xe025df){_0x279e82=_0x279e82-0x0;var _0x283623=_0xbb7d[_0x279e82];return _0x283623;};'use strict';var schema=require(_0xdbb7('0x0'));var _=require(_0xdbb7('0x1'));var logger=require(_0xdbb7('0x2'))(_0xdbb7('0x3'));var gotop=schema({'priority':{'type':_0xdbb7('0x4'),'required':!![],'message':_0xdbb7('0x5')}});exports['consequence']=function(_0x4a817e,_0x40ba31){return function(_0x2b1b14){try{var _0x560313={'priority':_0x40ba31[0x0]};var _0x2caedf=gotop['validate'](_0x560313,{'typecast':!![]});if(_0x2caedf[_0xdbb7('0x6')]){logger['error'](_0xdbb7('0x7'),_0x4a817e,_['map'](_0x2caedf,_0xdbb7('0x8'))[_0xdbb7('0x9')](',\x20'));_0x2b1b14[_0xdbb7('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x4a817e,_0x560313[_0xdbb7('0xb')]);if(_0x560313['priority']){var _0x5831eb=_['findIndex'](_0x2b1b14['rules'](),{'p':_0x560313[_0xdbb7('0xb')]});if(_0x5831eb>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4a817e,_0x560313[_0xdbb7('0xb')]||_0xdbb7('0xc'),_0x5831eb);_0x2b1b14['next'](_0x5831eb);}else{logger[_0xdbb7('0xd')](_0xdbb7('0xe'),_0x4a817e,_0x560313[_0xdbb7('0xb')]||_0xdbb7('0xc'));_0x2b1b14['stop']();}}else{_0x2b1b14['next']();}}}catch(_0x5af372){logger['error']('[%s][GOTOP]\x20%s',_0x4a817e,JSON['stringify'](_0x5af372));_0x2b1b14[_0xdbb7('0xa')]();}};}; \ 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 3ba34b4..39cb10f 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 _0x579a=['then','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create'];(function(_0x1e3e6a,_0xfef7b5){var _0x2d0f07=function(_0x10192b){while(--_0x10192b){_0x1e3e6a['push'](_0x1e3e6a['shift']());}};_0x2d0f07(++_0xfef7b5);}(_0x579a,0x9d));var _0xa579=function(_0x5c570d,_0x3fbc57){_0x5c570d=_0x5c570d-0x0;var _0x190ca1=_0x579a[_0x5c570d];return _0x190ca1;};'use strict';var _=require(_0xa579('0x0'));var utils=require(_0xa579('0x1'));var logger=require(_0xa579('0x2'))(_0xa579('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa579('0x4')),'smsMessage':require(_0xa579('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x4aac9,_0x4f522b){return function(_0x354f3b){try{var _0x14a544={'body':utils[_0xa579('0x6')](_0x4f522b[0x0],this),'ContactId':this[_0xa579('0x7')]['id']};if(this[_0xa579('0x8')]===_0xa579('0x9')){_0x14a544[_0xa579('0xa')]=this[_0xa579('0xb')]['id'];}else{_0x14a544[_['upperFirst'](this[_0xa579('0x8')])+_0xa579('0xc')]=this[_0xa579('0xb')]['id'];}_0x14a544[_[_0xa579('0xd')](this['channel'])+_0xa579('0xe')]=this[_0xa579('0xf')]['id'];if(rpc[this[_0xa579('0x8')]+_0xa579('0x10')]){return rpc[this['channel']+_0xa579('0x10')][_0xa579('0x11')](_0x14a544)[_0xa579('0x12')](function(_0x414bd5){logger[_0xa579('0x13')](_0xa579('0x14'),_0x4aac9,_0x14a544['body']);_0x354f3b[_0xa579('0x15')]();})['catch'](function(_0x45bf75){logger[_0xa579('0x16')](_0xa579('0x14'),_0x4aac9,JSON[_0xa579('0x17')](_0x45bf75));_0x354f3b[_0xa579('0x18')]();});}}catch(_0x1319b2){logger[_0xa579('0x16')](_0xa579('0x14'),_0x4aac9,JSON['stringify'](_0x1319b2));_0x354f3b[_0xa579('0x18')]();}};}; \ No newline at end of file +var _0x6b9d=['create','then','info','[%s][MESSAGE]\x20%s','body','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message'];(function(_0x12e0e2,_0x34a20e){var _0x5b1820=function(_0x4daff8){while(--_0x4daff8){_0x12e0e2['push'](_0x12e0e2['shift']());}};_0x5b1820(++_0x34a20e);}(_0x6b9d,0x1e4));var _0xd6b9=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x6b9d[_0x38537f];return _0x141e23;};'use strict';var _=require(_0xd6b9('0x0'));var utils=require(_0xd6b9('0x1'));var logger=require(_0xd6b9('0x2'))(_0xd6b9('0x3'));var rpc={'chatMessage':require(_0xd6b9('0x4')),'openchannelMessage':require(_0xd6b9('0x5')),'mailMessage':require(_0xd6b9('0x6')),'smsMessage':require(_0xd6b9('0x7')),'faxMessage':require(_0xd6b9('0x8')),'whatsappMessage':require(_0xd6b9('0x9'))};exports['consequence']=function(_0xc88d44,_0x2aac6e){return function(_0x394962){try{var _0x1b4f81={'body':utils[_0xd6b9('0xa')](_0x2aac6e[0x0],this),'ContactId':this[_0xd6b9('0xb')]['id']};if(this[_0xd6b9('0xc')]===_0xd6b9('0xd')){_0x1b4f81[_0xd6b9('0xe')]=this[_0xd6b9('0xf')]['id'];}else{_0x1b4f81[_[_0xd6b9('0x10')](this['channel'])+_0xd6b9('0x11')]=this['account']['id'];}_0x1b4f81[_[_0xd6b9('0x10')](this[_0xd6b9('0xc')])+'InteractionId']=this[_0xd6b9('0x12')]['id'];if(rpc[this[_0xd6b9('0xc')]+_0xd6b9('0x13')]){return rpc[this[_0xd6b9('0xc')]+'Message'][_0xd6b9('0x14')](_0x1b4f81)[_0xd6b9('0x15')](function(_0x3b55f3){logger[_0xd6b9('0x16')](_0xd6b9('0x17'),_0xc88d44,_0x1b4f81[_0xd6b9('0x18')]);_0x394962['next']();})['catch'](function(_0x4fa0a7){logger[_0xd6b9('0x19')](_0xd6b9('0x17'),_0xc88d44,JSON[_0xd6b9('0x1a')](_0x4fa0a7));_0x394962['stop']();});}}catch(_0x2ec76c){logger[_0xd6b9('0x19')](_0xd6b9('0x17'),_0xc88d44,JSON[_0xd6b9('0x1a')](_0x2ec76c));_0x394962[_0xd6b9('0x1b')]();}};}; \ 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 7fd1946..f07abc4 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 _0x2e46=['stop','routing','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x4e78bd,_0x3e094e){var _0x2a3e81=function(_0x323ad8){while(--_0x323ad8){_0x4e78bd['push'](_0x4e78bd['shift']());}};_0x2a3e81(++_0x3e094e);}(_0x2e46,0xf7));var _0x62e4=function(_0x1e79f4,_0x2e4769){_0x1e79f4=_0x1e79f4-0x0;var _0x279302=_0x2e46[_0x1e79f4];return _0x279302;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x62e4('0x0'));exports['consequence']=function(_0x4bd432,_0x31d97e){return function(_0x2b2a6d){try{logger['info'](_0x62e4('0x1'),_0x4bd432,utils[_0x62e4('0x2')](_0x31d97e[0x0],this));_0x2b2a6d[_0x62e4('0x3')]();}catch(_0x157c6a){logger[_0x62e4('0x4')](_0x62e4('0x1'),_0x4bd432,JSON['stringify'](_0x157c6a));_0x2b2a6d[_0x62e4('0x5')]();}};}; \ No newline at end of file +var _0x7984=['stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x44c8a6,_0x50ba98){var _0x15ab7f=function(_0x5e7d0e){while(--_0x5e7d0e){_0x44c8a6['push'](_0x44c8a6['shift']());}};_0x15ab7f(++_0x50ba98);}(_0x7984,0xc8));var _0x4798=function(_0x14be19,_0x3067bb){_0x14be19=_0x14be19-0x0;var _0x240fb4=_0x7984[_0x14be19];return _0x240fb4;};'use strict';var utils=require(_0x4798('0x0'));var logger=require(_0x4798('0x1'))(_0x4798('0x2'));exports[_0x4798('0x3')]=function(_0x215030,_0x34e4ad){return function(_0x3cc061){try{logger[_0x4798('0x4')](_0x4798('0x5'),_0x215030,utils[_0x4798('0x6')](_0x34e4ad[0x0],this));_0x3cc061[_0x4798('0x7')]();}catch(_0x48f2c6){logger[_0x4798('0x8')]('[%s][NOOP]\x20%s',_0x215030,JSON[_0x4798('0x9')](_0x48f2c6));_0x3cc061[_0x4798('0xa')]();}};}; \ 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 6e1763d..774935d 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 _0xa0da=['moment','ioredis','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','account','joinAt','emit','clone','queue','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','message','chat','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','Queues','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','stop','log','stack','validate','util','seq-queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0da,0x183));var _0xaa0d=function(_0x215cf3,_0x48545b){_0x215cf3=_0x215cf3-0x0;var _0x1e2e7c=_0xa0da[_0x215cf3];return _0x1e2e7c;};'use strict';var schema=require(_0xaa0d('0x0'));var _=require('lodash');var util=require(_0xaa0d('0x1'));var seqqueue=require(_0xaa0d('0x2'));var moment=require(_0xaa0d('0x3'));var Redis=require(_0xaa0d('0x4'));var config=require('../../../../config/environment');var logger=require(_0xaa0d('0x5'))(_0xaa0d('0x6'));var strategy=require('./strategy');config[_0xaa0d('0x7')]=_[_0xaa0d('0x8')](config['redis'],{'host':_0xaa0d('0x9'),'port':0x18eb});var io=require(_0xaa0d('0xa'))(new Redis(config['redis']));var attributes=['id',_0xaa0d('0xb'),_0xaa0d('0xc'),'queue','from',_0xaa0d('0xd')];function emit(_0x2f19e2,_0x47d69e,_0x463639){io['to'](_0x2f19e2)[_0xaa0d('0xe')](_0x47d69e,_0x463639);}function emitChannelQueueInteraction(_0x3807a8,_0x2c8118,_0xc32057,_0x531e5e,_0x5aef75,_0x4b61c1,_0xabd6d,_0xcf06cb){var _0x2f3267=_[_0xaa0d('0xf')](_0xc32057);_0x2f3267[_0xaa0d('0xb')]=_0xcf06cb;_0x2f3267[_0xaa0d('0x10')]=_0x2c8118;_0x2f3267[_0xaa0d('0xc')]=_0x531e5e;_0x2f3267['id']=_0x5aef75;if(_0x4b61c1){attributes[_0xaa0d('0x11')](_[_0xaa0d('0x12')](_0x3807a8)+_0xaa0d('0x13'));_0xabd6d[util[_0xaa0d('0x14')](_0xaa0d('0x15'),_0x3807a8)][_0x5aef75]=_[_0xaa0d('0x16')](_0x2f3267,attributes);}else{delete _0xabd6d[util[_0xaa0d('0x14')](_0xaa0d('0x15'),_0x3807a8)][_0x5aef75];}emit(util[_0xaa0d('0x14')](_0xaa0d('0x17'),_0x3807a8,_0x2c8118),util[_0xaa0d('0x14')](_0xaa0d('0x18'),_0x3807a8,_0x4b61c1?'save':_0xaa0d('0x19')),_[_0xaa0d('0x16')](_0x2f3267,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xaa0d('0x1a')),'chatQueueReport':require(_0xaa0d('0x1b')),'smsQueueReport':require(_0xaa0d('0x1c')),'faxQueueReport':require(_0xaa0d('0x1d')),'whatsappQueueReport':require(_0xaa0d('0x1e'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xaa0d('0x1f'),'message':_0xaa0d('0x20')}});function startRouting(_0x19c094,_0x635c95,_0x202bdd,_0x23eea1){if(_0x19c094&&_0x635c95&&_0x202bdd){_0x635c95[_0xaa0d('0x21')]+=0x1;var _0x5ee93b={'uniqueid':_0x19c094,'from':_0x202bdd[_0xaa0d('0x22')]?_0x202bdd['body'][_0xaa0d('0x23')]:'','joinAt':moment()[_0xaa0d('0x14')](_0xaa0d('0x24')),'ContactId':_0x202bdd[_0xaa0d('0x25')]?_0x202bdd['contact']['id']:null,'ListId':_0x202bdd['list']?_0x202bdd[_0xaa0d('0x26')]['id']:null};_0x5ee93b[_['upperFirst'](_0x202bdd[_0xaa0d('0x27')])+_0xaa0d('0x28')]=_0x635c95['id']||null;_0x5ee93b[_[_0xaa0d('0x29')](_0x202bdd['channel'])+_0xaa0d('0x13')]=_0x202bdd[_0xaa0d('0x2a')]?_0x202bdd[_0xaa0d('0x2a')]['id']:null;_0x5ee93b[_['upperFirst'](_0x202bdd[_0xaa0d('0x27')])+'MessageId']=_0x202bdd['message']?_0x202bdd[_0xaa0d('0x2b')]['id']:null;_0x5ee93b[_[_0xaa0d('0x29')](_0x202bdd[_0xaa0d('0x27')])+(_0x202bdd[_0xaa0d('0x27')]!==_0xaa0d('0x2c')?'AccountId':_0xaa0d('0x2d'))]=_0x202bdd[_0xaa0d('0xc')]?_0x202bdd[_0xaa0d('0xc')]['id']:null;logger['info'](util[_0xaa0d('0x14')](_0xaa0d('0x2e'),_0x19c094,_0x635c95['name']));emitChannelQueueInteraction(_0x202bdd[_0xaa0d('0x27')],_0x635c95[_0xaa0d('0x2f')],_0x5ee93b,_0x202bdd[_0xaa0d('0xc')][_0xaa0d('0x2f')],_0x202bdd[_0xaa0d('0x2b')]['id'],!![],_0x23eea1,_0x635c95['id']);if(rpc[_0x202bdd[_0xaa0d('0x27')]+_0xaa0d('0x30')]){return rpc[_0x202bdd[_0xaa0d('0x27')]+_0xaa0d('0x30')][_0xaa0d('0x31')](_0x5ee93b)[_0xaa0d('0x32')](function(_0x2cb31f){logger[_0xaa0d('0x33')](_0xaa0d('0x34'));});}}}function stopRouting(_0x407bf7,_0x58780b,_0x4f6df9,_0x36c719){if(_0x407bf7&&_0x58780b){_0x58780b[_0xaa0d('0x21')]-=0x1;var _0x366b99={'leaveAt':moment()[_0xaa0d('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0xaa0d('0x24')),'reason':'accepted'};logger[_0xaa0d('0x35')](util[_0xaa0d('0x14')](_0xaa0d('0x36'),_0x407bf7,_0x58780b[_0xaa0d('0x2f')]));emitChannelQueueInteraction(_0x4f6df9[_0xaa0d('0x27')],_0x58780b['name'],_0x4f6df9['body'],_0x4f6df9[_0xaa0d('0xc')]['name'],_0x4f6df9[_0xaa0d('0x2b')]['id'],![],_0x36c719,_0x58780b['id']);if(rpc[_0x4f6df9[_0xaa0d('0x27')]+_0xaa0d('0x30')]){return rpc[_0x4f6df9[_0xaa0d('0x27')]+'QueueReport'][_0xaa0d('0x37')](_0x407bf7,_0x366b99)[_0xaa0d('0x32')](function(_0x5177e0){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x1de41c,_0x42ab00,_0x2a5802,_0x1af09e){if(_0x1de41c&&_0x42ab00){_0x42ab00[_0xaa0d('0x21')]-=0x1;var _0x350eff={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xaa0d('0x14')](_0xaa0d('0x24')),'reason':_0xaa0d('0x38')};logger[_0xaa0d('0x35')](util['format'](_0xaa0d('0x39'),_0x1de41c,_0x42ab00['name']));emitChannelQueueInteraction(_0x2a5802['channel'],_0x42ab00['name'],_0x2a5802[_0xaa0d('0x22')],_0x2a5802[_0xaa0d('0xc')][_0xaa0d('0x2f')],_0x2a5802['message']['id'],![],_0x1af09e);if(rpc[_0x2a5802['channel']+_0xaa0d('0x30')]){return rpc[_0x2a5802[_0xaa0d('0x27')]+_0xaa0d('0x30')][_0xaa0d('0x37')](_0x1de41c,_0x350eff)[_0xaa0d('0x32')](function(_0x5cfd28){logger[_0xaa0d('0x33')](_0xaa0d('0x3a'));});}}}function handleFindQueue(_0x5669bb){return function(_0x64c913){return _0x64c913[_0xaa0d('0x2f')][_0xaa0d('0x3b')]()===_0x5669bb[_0xaa0d('0x3b')]();};}exports[_0xaa0d('0x3c')]=function(_0x18fdf7,_0x24e041,_0x5d2a2a,_0xdd786){return function(_0x432036){try{var _0x2218c8={'name':_0x24e041[0x0],'timeout':_0x24e041[0x1]};var _0x211e67=queue[_0xaa0d('0x0')](_0x2218c8,{'typecast':!![]});if(_0x211e67[_0xaa0d('0x3d')]){logger['error']('[%s][QUEUE]\x20%s',_0x18fdf7,_[_0xaa0d('0x3e')](_0x211e67,_0xaa0d('0x2b'))[_0xaa0d('0x3f')](',\x20'));_0x432036['stop']();}else{var _0x2859c2=_['find'](_0x5d2a2a[_0xdd786[_0xaa0d('0x27')]+_0xaa0d('0x40')],handleFindQueue(_0x2218c8[_0xaa0d('0x2f')]));if(_0x2859c2){startRouting(_0x18fdf7,_0x2859c2,_0xdd786,_0x5d2a2a);var _0x948531=(_0x2859c2[_0xaa0d('0x38')]||0xa)*0x3e8;var _0x564a3b=(_0x2218c8['timeout']||0x14)*0x3e8;var _0x586a1;if(_0x948531>_0x564a3b){_0x564a3b=_0x948531;}var _0x497f4a=seqqueue['createQueue'](_0x948531);_0x497f4a['id']=_0x18fdf7;_0x497f4a[_0xaa0d('0x41')]=_0x948531;_0x497f4a['qtimeout']=_0x564a3b;_0x497f4a[_0xaa0d('0x27')]=_0xdd786[_0xaa0d('0x27')];_0x5d2a2a[_0xaa0d('0x42')][_0x18fdf7]['on'](_0xaa0d('0x43'),function(){logger[_0xaa0d('0x35')](_0xaa0d('0x44'),_0x18fdf7);stopRouting(_0x18fdf7,_0x2859c2,_0xdd786,_0x5d2a2a);clearTimeout(_0x586a1);_0x586a1=undefined;_0x497f4a[_0xaa0d('0x45')](!![]);if(_0x5d2a2a['rules'][_0x18fdf7]){delete _0x5d2a2a[_0xaa0d('0x42')][_0x18fdf7];}_0x432036['stop']();});_0x5d2a2a[_0xaa0d('0x42')][_0x18fdf7]['on'](_0xaa0d('0x46'),function(){if(_0x5d2a2a[_0xaa0d('0x42')][_0x18fdf7]){delete _0x5d2a2a[_0xaa0d('0x42')][_0x18fdf7];}});_0x586a1=setTimeout(function(){logger[_0xaa0d('0x35')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x18fdf7);endRouting(_0x18fdf7,_0x2859c2,_0xdd786,_0x5d2a2a);clearTimeout(_0x586a1);_0x497f4a[_0xaa0d('0x45')](!![]);_0x432036[_0xaa0d('0x47')]();},_0x564a3b);switch(_0x2859c2[_0xaa0d('0x48')]){case _0xaa0d('0x49'):strategy['rrmemory'](_0x497f4a,_0x2859c2,_0x5d2a2a,_0xdd786);break;default:strategy[_0xaa0d('0x4a')](_0x497f4a,_0x2859c2,_0x5d2a2a,_0xdd786);}}else{logger[_0xaa0d('0x33')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x18fdf7,_0x2218c8['name']);_0x432036[_0xaa0d('0x4b')]();}}}catch(_0x3527cc){console[_0xaa0d('0x4c')](_0x3527cc);logger[_0xaa0d('0x33')]('[%s][QUEUE]\x20%s',_0x18fdf7,_0x3527cc[_0xaa0d('0x4d')]);_0x432036['stop']();}};}; \ No newline at end of file +var _0x2c6c=['number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','message','chat','WebsiteId','info','name','QueueReport','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','error','update\x20queue\x20report','timeout','catch','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','Queues','createQueue','atimeout','qtimeout','end','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','queue_id','account','from','emit','clone','queue','push','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c6c,0xc5));var _0xc2c6=function(_0x33adac,_0xffc778){_0x33adac=_0x33adac-0x0;var _0x2ceb31=_0x2c6c[_0x33adac];return _0x2ceb31;};'use strict';var schema=require('validate');var _=require(_0xc2c6('0x0'));var util=require(_0xc2c6('0x1'));var seqqueue=require('seq-queue');var moment=require(_0xc2c6('0x2'));var Redis=require(_0xc2c6('0x3'));var config=require(_0xc2c6('0x4'));var logger=require(_0xc2c6('0x5'))('routing');var strategy=require('./strategy');config[_0xc2c6('0x6')]=_['defaults'](config[_0xc2c6('0x6')],{'host':_0xc2c6('0x7'),'port':0x18eb});var io=require(_0xc2c6('0x8'))(new Redis(config['redis']));var attributes=['id',_0xc2c6('0x9'),_0xc2c6('0xa'),'queue',_0xc2c6('0xb'),'joinAt'];function emit(_0xf5e52,_0x4ce9d4,_0x549b20){io['to'](_0xf5e52)[_0xc2c6('0xc')](_0x4ce9d4,_0x549b20);}function emitChannelQueueInteraction(_0x5db459,_0x3dae43,_0xd6b6f,_0x48d40e,_0x840d27,_0x41ca9a,_0x747ca6,_0x1b6f3b){var _0x27eb9a=_[_0xc2c6('0xd')](_0xd6b6f);_0x27eb9a[_0xc2c6('0x9')]=_0x1b6f3b;_0x27eb9a[_0xc2c6('0xe')]=_0x3dae43;_0x27eb9a[_0xc2c6('0xa')]=_0x48d40e;_0x27eb9a['id']=_0x840d27;if(_0x41ca9a){attributes[_0xc2c6('0xf')](_['capitalize'](_0x5db459)+'InteractionId');_0x747ca6[util[_0xc2c6('0x10')](_0xc2c6('0x11'),_0x5db459)][_0x840d27]=_[_0xc2c6('0x12')](_0x27eb9a,attributes);}else{delete _0x747ca6[util[_0xc2c6('0x10')](_0xc2c6('0x11'),_0x5db459)][_0x840d27];}emit(util['format'](_0xc2c6('0x13'),_0x5db459,_0x3dae43),util[_0xc2c6('0x10')](_0xc2c6('0x14'),_0x5db459,_0x41ca9a?_0xc2c6('0x15'):_0xc2c6('0x16')),_['pick'](_0x27eb9a,attributes));}var rpc={'openchannelQueueReport':require(_0xc2c6('0x17')),'mailQueueReport':require(_0xc2c6('0x18')),'chatQueueReport':require(_0xc2c6('0x19')),'smsQueueReport':require(_0xc2c6('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc2c6('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xc2c6('0x1c'),'message':_0xc2c6('0x1d')}});function startRouting(_0xff2967,_0x1fe005,_0x481eb8,_0x58aa45){if(_0xff2967&&_0x1fe005&&_0x481eb8){_0x1fe005['waiting']+=0x1;var _0x3c0943={'uniqueid':_0xff2967,'from':_0x481eb8[_0xc2c6('0x1e')]?_0x481eb8[_0xc2c6('0x1e')][_0xc2c6('0xb')]:'','joinAt':moment()[_0xc2c6('0x10')](_0xc2c6('0x1f')),'ContactId':_0x481eb8['contact']?_0x481eb8['contact']['id']:null,'ListId':_0x481eb8['list']?_0x481eb8[_0xc2c6('0x20')]['id']:null};_0x3c0943[_[_0xc2c6('0x21')](_0x481eb8['channel'])+_0xc2c6('0x22')]=_0x1fe005['id']||null;_0x3c0943[_[_0xc2c6('0x21')](_0x481eb8['channel'])+_0xc2c6('0x23')]=_0x481eb8[_0xc2c6('0x24')]?_0x481eb8[_0xc2c6('0x24')]['id']:null;_0x3c0943[_[_0xc2c6('0x21')](_0x481eb8[_0xc2c6('0x25')])+_0xc2c6('0x26')]=_0x481eb8[_0xc2c6('0x27')]?_0x481eb8[_0xc2c6('0x27')]['id']:null;_0x3c0943[_[_0xc2c6('0x21')](_0x481eb8[_0xc2c6('0x25')])+(_0x481eb8[_0xc2c6('0x25')]!==_0xc2c6('0x28')?'AccountId':_0xc2c6('0x29'))]=_0x481eb8[_0xc2c6('0xa')]?_0x481eb8['account']['id']:null;logger[_0xc2c6('0x2a')](util[_0xc2c6('0x10')]('[%s][START:QUEUE][NAME:%s]',_0xff2967,_0x1fe005[_0xc2c6('0x2b')]));emitChannelQueueInteraction(_0x481eb8[_0xc2c6('0x25')],_0x1fe005[_0xc2c6('0x2b')],_0x3c0943,_0x481eb8['account'][_0xc2c6('0x2b')],_0x481eb8[_0xc2c6('0x27')]['id'],!![],_0x58aa45,_0x1fe005['id']);if(rpc[_0x481eb8[_0xc2c6('0x25')]+_0xc2c6('0x2c')]){return rpc[_0x481eb8[_0xc2c6('0x25')]+'QueueReport']['create'](_0x3c0943)['catch'](function(_0x125576){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x111e1f,_0x52a081,_0x14fca8,_0x57e307){if(_0x111e1f&&_0x52a081){_0x52a081[_0xc2c6('0x2d')]-=0x1;var _0xc2518e={'leaveAt':moment()[_0xc2c6('0x10')](_0xc2c6('0x1f')),'acceptAt':moment()[_0xc2c6('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xc2c6('0x2e')};logger[_0xc2c6('0x2a')](util['format'](_0xc2c6('0x2f'),_0x111e1f,_0x52a081[_0xc2c6('0x2b')]));emitChannelQueueInteraction(_0x14fca8['channel'],_0x52a081[_0xc2c6('0x2b')],_0x14fca8[_0xc2c6('0x1e')],_0x14fca8[_0xc2c6('0xa')][_0xc2c6('0x2b')],_0x14fca8[_0xc2c6('0x27')]['id'],![],_0x57e307,_0x52a081['id']);if(rpc[_0x14fca8[_0xc2c6('0x25')]+'QueueReport']){return rpc[_0x14fca8[_0xc2c6('0x25')]+_0xc2c6('0x2c')]['update'](_0x111e1f,_0xc2518e)['catch'](function(_0x453b9a){logger[_0xc2c6('0x30')](_0xc2c6('0x31'));});}}}function endRouting(_0x482359,_0x37a79f,_0x185b5f,_0xdebf3a){if(_0x482359&&_0x37a79f){_0x37a79f[_0xc2c6('0x2d')]-=0x1;var _0x202ea9={'leaveAt':moment()[_0xc2c6('0x10')](_0xc2c6('0x1f')),'exitAt':moment()[_0xc2c6('0x10')](_0xc2c6('0x1f')),'reason':_0xc2c6('0x32')};logger['info'](util[_0xc2c6('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x482359,_0x37a79f['name']));emitChannelQueueInteraction(_0x185b5f[_0xc2c6('0x25')],_0x37a79f['name'],_0x185b5f[_0xc2c6('0x1e')],_0x185b5f[_0xc2c6('0xa')]['name'],_0x185b5f[_0xc2c6('0x27')]['id'],![],_0xdebf3a);if(rpc[_0x185b5f[_0xc2c6('0x25')]+_0xc2c6('0x2c')]){return rpc[_0x185b5f[_0xc2c6('0x25')]+_0xc2c6('0x2c')]['update'](_0x482359,_0x202ea9)[_0xc2c6('0x33')](function(_0x27eeaf){logger[_0xc2c6('0x30')](_0xc2c6('0x31'));});}}}function handleFindQueue(_0x2c4673){return function(_0xceb7f9){return _0xceb7f9['name'][_0xc2c6('0x34')]()===_0x2c4673[_0xc2c6('0x34')]();};}exports[_0xc2c6('0x35')]=function(_0x5538ed,_0x24a691,_0x27c693,_0x32d09e){return function(_0x45678c){try{var _0x47999d={'name':_0x24a691[0x0],'timeout':_0x24a691[0x1]};var _0x5ac1ef=queue[_0xc2c6('0x36')](_0x47999d,{'typecast':!![]});if(_0x5ac1ef[_0xc2c6('0x37')]){logger[_0xc2c6('0x30')](_0xc2c6('0x38'),_0x5538ed,_['map'](_0x5ac1ef,_0xc2c6('0x27'))[_0xc2c6('0x39')](',\x20'));_0x45678c[_0xc2c6('0x3a')]();}else{var _0x29219e=_['find'](_0x27c693[_0x32d09e[_0xc2c6('0x25')]+_0xc2c6('0x3b')],handleFindQueue(_0x47999d['name']));if(_0x29219e){startRouting(_0x5538ed,_0x29219e,_0x32d09e,_0x27c693);var _0x119abb=(_0x29219e[_0xc2c6('0x32')]||0xa)*0x3e8;var _0x4a249c=(_0x47999d[_0xc2c6('0x32')]||0x14)*0x3e8;var _0x22304e;if(_0x119abb>_0x4a249c){_0x4a249c=_0x119abb;}var _0x55736c=seqqueue[_0xc2c6('0x3c')](_0x119abb);_0x55736c['id']=_0x5538ed;_0x55736c[_0xc2c6('0x3d')]=_0x119abb;_0x55736c[_0xc2c6('0x3e')]=_0x4a249c;_0x55736c['channel']=_0x32d09e[_0xc2c6('0x25')];_0x27c693['rules'][_0x5538ed]['on'](_0xc2c6('0x3f'),function(){logger[_0xc2c6('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5538ed);stopRouting(_0x5538ed,_0x29219e,_0x32d09e,_0x27c693);clearTimeout(_0x22304e);_0x22304e=undefined;_0x55736c[_0xc2c6('0x40')](!![]);if(_0x27c693['rules'][_0x5538ed]){delete _0x27c693[_0xc2c6('0x41')][_0x5538ed];}_0x45678c[_0xc2c6('0x3a')]();});_0x27c693[_0xc2c6('0x41')][_0x5538ed]['on'](_0xc2c6('0x42'),function(){if(_0x27c693[_0xc2c6('0x41')][_0x5538ed]){delete _0x27c693[_0xc2c6('0x41')][_0x5538ed];}});_0x22304e=setTimeout(function(){logger[_0xc2c6('0x2a')](_0xc2c6('0x43'),_0x5538ed);endRouting(_0x5538ed,_0x29219e,_0x32d09e,_0x27c693);clearTimeout(_0x22304e);_0x55736c[_0xc2c6('0x40')](!![]);_0x45678c[_0xc2c6('0x44')]();},_0x4a249c);switch(_0x29219e[_0xc2c6('0x45')]){case _0xc2c6('0x46'):strategy[_0xc2c6('0x46')](_0x55736c,_0x29219e,_0x27c693,_0x32d09e);break;default:strategy[_0xc2c6('0x47')](_0x55736c,_0x29219e,_0x27c693,_0x32d09e);}}else{logger[_0xc2c6('0x30')](_0xc2c6('0x48'),_0x5538ed,_0x47999d[_0xc2c6('0x2b')]);_0x45678c[_0xc2c6('0x3a')]();}}}catch(_0x19b4a4){console[_0xc2c6('0x49')](_0x19b4a4);logger[_0xc2c6('0x30')](_0xc2c6('0x38'),_0x5538ed,_0x19b4a4[_0xc2c6('0x4a')]);_0x45678c[_0xc2c6('0x3a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index e3a5deb..b94bd94 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 _0x0c02=['squeue','agent','realtime','handleTimeout','bind','timeout','push','handleRun','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','TIMEOUT','exports','uuid','./util','routing','notificationId'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var uuid=require(_0x20c0('0x0'));var util=require(_0x20c0('0x1'));var logger=require('../../../../../config/logger')(_0x20c0('0x2'));var Agent=function(_0x5c8750,_0x454922,_0x6d03d0,_0x38022e){this[_0x20c0('0x3')]=uuid['v4']();this[_0x20c0('0x4')]=_0x5c8750;this[_0x20c0('0x5')]=_0x454922;this[_0x20c0('0x6')]=_0x6d03d0;this[_0x20c0('0x2')]=_0x38022e;this['squeue']['push'](this['handleRun']['bind'](this),this[_0x20c0('0x7')][_0x20c0('0x8')](this));this[_0x20c0('0x4')]['on'](_0x20c0('0x9'),this[_0x20c0('0x7')][_0x20c0('0x8')](this));this['squeue']['on']('drained',this['handleDrained']['bind'](this));};Agent['prototype'][_0x20c0('0xa')]=function(){this[_0x20c0('0x4')][_0x20c0('0xa')](this[_0x20c0('0xb')]['bind'](this),this[_0x20c0('0x7')]['bind'](this));};Agent['prototype'][_0x20c0('0xc')]=function(){this[_0x20c0('0x7')](!![]);};Agent[_0x20c0('0xd')][_0x20c0('0xb')]=function(){logger[_0x20c0('0xe')](_0x20c0('0xf'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);if(_[_0x20c0('0x10')](this['realtime'][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']])){logger[_0x20c0('0xe')](_0x20c0('0x12'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0x20c0('0x13')]||util[_0x20c0('0x14')](this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')]['agents'][this[_0x20c0('0x5')]['id']],this[_0x20c0('0x4')][_0x20c0('0x15')],![])){this['realtime']['agents'][this[_0x20c0('0x5')]['id']][_0x20c0('0x16')]=!![];this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']]['busyQueue']=undefined;util[_0x20c0('0x17')](this[_0x20c0('0x6')],this[_0x20c0('0x2')],this[_0x20c0('0x5')],this['squeue'][_0x20c0('0x15')]);util[_0x20c0('0x18')](this[_0x20c0('0x3')],this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']],null,this['routing']);util[_0x20c0('0x19')](this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']],_0x20c0('0x1a')+(this['routing']['forcedOwnership']?_0x20c0('0x1b'):''));}else{logger[_0x20c0('0xe')](_0x20c0('0x1c'),this['squeue']['id'],this[_0x20c0('0x5')]['id']);setTimeout(this[_0x20c0('0xa')][_0x20c0('0x8')](this),0x3e8);}}};Agent[_0x20c0('0xd')]['handleTimeout']=function(_0x49b738){if(_[_0x20c0('0x10')](this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']])){return logger[_0x20c0('0xe')](_0x20c0('0x12'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);}else{logger[_0x20c0('0xe')](_0x20c0('0x1d'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);util[_0x20c0('0x1e')](this[_0x20c0('0x3')],this['squeue']['id'],this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']],null,this[_0x20c0('0x2')]);this['realtime'][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']][_0x20c0('0x16')]=![];this[_0x20c0('0x6')][_0x20c0('0x11')][this['agent']['id']][_0x20c0('0x1f')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x20c0('0x2')],this[_0x20c0('0x5')],this[_0x20c0('0x4')][_0x20c0('0x15')]);util[_0x20c0('0x19')](this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')]['agents'][this['agent']['id']],_0x49b738?'STOP':_0x20c0('0x20'));}if(!_0x49b738){setTimeout(this[_0x20c0('0xa')]['bind'](this),0x3e8);}};function agent(_0x346a04,_0x20d6f3,_0x550d2c,_0x5a7641){return new Agent(_0x346a04,_0x20d6f3,_0x550d2c,_0x5a7641);}module[_0x20c0('0x21')]=agent; \ No newline at end of file +var _0x7fbe=['notificationId','squeue','agent','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3378a5,_0x317f7f){_0x3378a5=_0x3378a5-0x0;var _0x43235f=_0x7fbe[_0x3378a5];return _0x43235f;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xe7fb('0x0'));var logger=require(_0xe7fb('0x1'))(_0xe7fb('0x2'));var Agent=function(_0x1703d5,_0x517d3a,_0x47625b,_0x11d2c4){this[_0xe7fb('0x3')]=uuid['v4']();this[_0xe7fb('0x4')]=_0x1703d5;this[_0xe7fb('0x5')]=_0x517d3a;this[_0xe7fb('0x6')]=_0x47625b;this[_0xe7fb('0x2')]=_0x11d2c4;this[_0xe7fb('0x4')][_0xe7fb('0x7')](this['handleRun'][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on']('timeout',this['handleTimeout'][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on'](_0xe7fb('0xa'),this[_0xe7fb('0xb')][_0xe7fb('0x8')](this));};Agent[_0xe7fb('0xc')][_0xe7fb('0x7')]=function(){this[_0xe7fb('0x4')][_0xe7fb('0x7')](this[_0xe7fb('0xd')][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));};Agent[_0xe7fb('0xc')][_0xe7fb('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xe7fb('0xc')][_0xe7fb('0xd')]=function(){logger['debug'](_0xe7fb('0xe'),this[_0xe7fb('0x4')]['id'],this['agent']['id']);if(_[_0xe7fb('0xf')](this['realtime'][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']])){logger[_0xe7fb('0x11')](_0xe7fb('0x12'),this['squeue']['id'],this[_0xe7fb('0x5')]['id']);setTimeout(this['push'][_0xe7fb('0x8')](this),0x3e8);}else{if(this['routing'][_0xe7fb('0x13')]||util[_0xe7fb('0x14')](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],this['squeue'][_0xe7fb('0x15')],![])){this['realtime'][_0xe7fb('0x10')][this['agent']['id']][_0xe7fb('0x16')]=!![];this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']][_0xe7fb('0x17')]=undefined;util[_0xe7fb('0x18')](this['realtime'],this[_0xe7fb('0x2')],this[_0xe7fb('0x5')],this['squeue']['channel']);util['showNotification'](this[_0xe7fb('0x3')],this['squeue']['id'],this['realtime'][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']],null,this[_0xe7fb('0x2')]);util['writeLog'](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']],_0xe7fb('0x19')+(this[_0xe7fb('0x2')][_0xe7fb('0x13')]?':FORCED':''));}else{logger['debug'](_0xe7fb('0x1a'),this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x5')]['id']);setTimeout(this['push'][_0xe7fb('0x8')](this),0x3e8);}}};Agent[_0xe7fb('0xc')][_0xe7fb('0x9')]=function(_0x5f265f){if(_[_0xe7fb('0xf')](this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']])){return logger['debug'](_0xe7fb('0x12'),this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe7fb('0x4')]['id'],this['agent']['id']);util[_0xe7fb('0x1b')](this[_0xe7fb('0x3')],this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],null,this[_0xe7fb('0x2')]);this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']]['busy']=![];this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']][_0xe7fb('0x17')]=undefined;util[_0xe7fb('0x1c')](this[_0xe7fb('0x6')],this[_0xe7fb('0x2')],this[_0xe7fb('0x5')],this[_0xe7fb('0x4')]['channel']);util[_0xe7fb('0x1d')](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],_0x5f265f?_0xe7fb('0x1e'):_0xe7fb('0x1f'));}if(!_0x5f265f){setTimeout(this[_0xe7fb('0x7')][_0xe7fb('0x8')](this),0x3e8);}};function agent(_0x35b828,_0xfeefb1,_0xc4e271,_0x195c35){return new Agent(_0x35b828,_0xfeefb1,_0xc4e271,_0x195c35);}module[_0xe7fb('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 3fb9efe..7e5f8f9 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 _0x6d77=['RINGING','busyQueue','name','saveWaitingNotification','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','busy','removeWaitingNotification','uuid','../../../../../config/logger','routing','queue','realtime','push','handleRun','bind','handleTimeout','squeue','timeout','handleDrained','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d77,0x160));var _0x76d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6d77[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var uuid=require(_0x76d7('0x0'));var util=require('./util');var logger=require(_0x76d7('0x1'))(_0x76d7('0x2'));var Beepall=function(_0x469acc,_0x5ae886,_0x5dd287,_0x185d32){this['notificationId']=uuid['v4']();this['squeue']=_0x469acc;this[_0x76d7('0x3')]=_0x5ae886;this[_0x76d7('0x4')]=_0x5dd287;this['routing']=_0x185d32;this['squeue'][_0x76d7('0x5')](this[_0x76d7('0x6')][_0x76d7('0x7')](this),this[_0x76d7('0x8')][_0x76d7('0x7')](this));this[_0x76d7('0x9')]['on'](_0x76d7('0xa'),this[_0x76d7('0x8')][_0x76d7('0x7')](this));this[_0x76d7('0x9')]['on']('drained',this[_0x76d7('0xb')][_0x76d7('0x7')](this));};Beepall[_0x76d7('0xc')][_0x76d7('0x5')]=function(){this['squeue'][_0x76d7('0x5')](this[_0x76d7('0x6')]['bind'](this),this[_0x76d7('0x8')][_0x76d7('0x7')](this));};Beepall[_0x76d7('0xc')][_0x76d7('0xb')]=function(){this[_0x76d7('0x8')](!![]);};Beepall[_0x76d7('0xc')]['handleRun']=function(){var _0x535be0=!![];if(!_[_0x76d7('0xd')](this[_0x76d7('0x3')])&&!_[_0x76d7('0xd')](this[_0x76d7('0x3')][_0x76d7('0xe')])&&this[_0x76d7('0x3')][_0x76d7('0xe')]['length']>0x0){for(var _0x216168=0x0,_0x253adf;_0x2161680x0){for(var _0x5de190=0x0,_0x32b0cf;_0x5de1900x0&&_0x1f0688[_0x4c9dad+_0x0860('0x25')]>=_0x1f0688[_0x4c9dad+_0x0860('0x24')]){writeLog(_0x40444f,_0x1f0688,_0x4c9dad['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x0860('0x26')]=function(_0x35d49f,_0x259972,_0x3923fe,_0x5b01f6,_0x2dc380){return sendNotification(!![],_0x35d49f,_0x259972,_0x3923fe,_0x5b01f6,_0x2dc380);};exports[_0x0860('0x27')]=function(_0x54808d,_0x3b4557,_0x7222bc,_0x285acb,_0x59d840){return sendNotification(![],_0x54808d,_0x3b4557,_0x7222bc,_0x285acb,_0x59d840);};exports['checkWaitingNotifications']=function(_0x3dbd9d,_0x2f2c17,_0x5bd349){var _0x27e86d=_0x2f2c17['interaction'][_0x0860('0x28')];if(!_0x27e86d&&_0x5bd349){_0x27e86d=_0x5bd349['id'];}var _0x3ee8e1=_[_0x0860('0x29')](_0x3dbd9d[_0x2f2c17[_0x0860('0x2a')]+_0x0860('0x2b')],function(_0x3104c1){var _0x595135=_[_0x0860('0x2c')](_0x2f2c17['channel'])+_0x0860('0x2d');return _0x3104c1[_0x595135]===_0x2f2c17[_0x0860('0x2e')]['id'];});if(!_0x3ee8e1&&_0x27e86d){_0x3ee8e1=_[_0x0860('0x29')](_0x3dbd9d[_0x0860('0x2f')][_0x27e86d][_0x2f2c17[_0x0860('0x2a')]+_0x0860('0x30')],function(_0x3d55f2){return _0x3d55f2['id']===_0x2f2c17['interaction']['id'];});}return _0x3ee8e1;};exports[_0x0860('0x31')]=function(_0x40c867,_0x227f45,_0xd359db,_0x535410){_0x40c867[_0x0860('0x2f')][_0xd359db['id']][_0x535410+_0x0860('0x30')][_0x227f45[_0x0860('0x18')]['id']]={'id':_0x227f45['interaction']['id']};};exports[_0x0860('0x32')]=function(_0x10b5fc,_0x50009f,_0x3fa770,_0x3cc4f5){delete _0x10b5fc['agents'][_0x3fa770['id']][_0x3cc4f5+_0x0860('0x30')][_0x50009f[_0x0860('0x18')]['id']];};exports[_0x0860('0x33')]=writeLog; \ No newline at end of file +var _0x9d64=['Pause','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','channel','QueuesWaitingInteractions','capitalize','InteractionId','interaction','some','agents','WaitingInteractions','saveWaitingNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','user:%s','name','emit','user:save','split','\x20interaction','notificationSound','account','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','debug','format','isAgentAvailable','busy','BUSY','OFFLINE'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9d64,0x7f));var _0x49d6=function(_0x51b294,_0x2e3564){_0x51b294=_0x51b294-0x0;var _0x686239=_0x9d64[_0x51b294];return _0x686239;};'use strict';var _=require(_0x49d6('0x0'));var util=require('util');var utils=require(_0x49d6('0x1'));var Redis=require(_0x49d6('0x2'));var config=require(_0x49d6('0x3'));var logger=require(_0x49d6('0x4'))(_0x49d6('0x5'));config[_0x49d6('0x6')]=_[_0x49d6('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49d6('0x8'))(new Redis(config[_0x49d6('0x6')]));function sendNotification(_0x489324,_0x2426fb,_0x4c29aa,_0x8ea0d4,_0x27afa4,_0x5b23cd){io['to'](util['format'](_0x49d6('0x9'),_0x8ea0d4[_0x49d6('0xa')]))[_0x49d6('0xb')](_0x49d6('0xc'),_0x8ea0d4);var _0xd3ad39=_0x5b23cd||{};var _0x35e931=_0x4c29aa[_0x49d6('0xd')]('.');var _0x4ebb01={'uniqueid':_0x2426fb,'channel':_0x35e931[0x0],'id':_0x35e931[0x1],'title':_0x35e931[0x0]+_0x49d6('0xe'),'interactionId':_0x35e931[0x2],'queue':_0x27afa4?_0x27afa4[_0x49d6('0xa')]:null,'sound':_0xd3ad39['account'][_0x49d6('0xf')],'shake':_0xd3ad39[_0x49d6('0x10')][_0x49d6('0x11')]};try{if(!_0xd3ad39['body']){_0xd3ad39[_0x49d6('0x12')]={};}if(_0x27afa4){_0xd3ad39[_0x49d6('0x12')]['queue']=_0x27afa4;}else if(_0xd3ad39[_0x49d6('0x12')][_0x49d6('0x13')]){delete _0xd3ad39[_0x49d6('0x12')]['queue'];}_0x4ebb01[_0x49d6('0x14')]=utils['getMustacheRender'](_0xd3ad39[_0x49d6('0x10')][_0x49d6('0x15')],_0xd3ad39);}catch(_0x101e9b){_0x4ebb01[_0x49d6('0x14')]=_0x49d6('0x16');logger[_0x49d6('0x17')](util['format'](_0x49d6('0x18'),_0x2426fb,_0x101e9b[_0x49d6('0x19')]));}io['to'](util['format']('user:%s',_0x8ea0d4[_0x49d6('0xa')]))[_0x49d6('0xb')](util['format'](_0x49d6('0x1a'),_0x489324?_0x49d6('0x1b'):_0x49d6('0x1c')),_0x4ebb01);}function writeLog(_0x46e095,_0x515100,_0x40aaa6){return logger[_0x49d6('0x1d')](util[_0x49d6('0x1e')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x46e095,_0x515100[_0x49d6('0xa')],_0x40aaa6));}exports[_0x49d6('0x1f')]=function(_0x5f4bf1,_0x1389e0,_0xa46f96,_0x57aaa5){if(_0x1389e0[_0x49d6('0x20')]){writeLog(_0x5f4bf1,_0x1389e0,_0x49d6('0x21'));return![];}if(!_0x1389e0['online']){writeLog(_0x5f4bf1,_0x1389e0,_0x49d6('0x22'));return![];}if(_0x1389e0[_0xa46f96+_0x49d6('0x23')]){writeLog(_0x5f4bf1,_0x1389e0,'PAUSE');return![];}if(_0x57aaa5&&_0x1389e0[_0x49d6('0x24')](_0xa46f96+'Capacity')&&_0x1389e0['hasOwnProperty'](_0xa46f96+_0x49d6('0x25'))){if(_0x1389e0[_0xa46f96+_0x49d6('0x26')]>0x0&&_0x1389e0[_0xa46f96+_0x49d6('0x25')]>=_0x1389e0[_0xa46f96+'Capacity']){writeLog(_0x5f4bf1,_0x1389e0,_0xa46f96[_0x49d6('0x27')]()+_0x49d6('0x28'));return![];}}return!![];};exports[_0x49d6('0x29')]=function(_0x178b2e,_0x40bd6c,_0x293bd6,_0x15168f,_0x56b13f){return sendNotification(!![],_0x178b2e,_0x40bd6c,_0x293bd6,_0x15168f,_0x56b13f);};exports[_0x49d6('0x2a')]=function(_0x1f17e8,_0x24d4d6,_0x57fa76,_0x9d2b71,_0x157135){return sendNotification(![],_0x1f17e8,_0x24d4d6,_0x57fa76,_0x9d2b71,_0x157135);};exports[_0x49d6('0x2b')]=function(_0x3a7721,_0x3a1713,_0x2ceda0){var _0x196058=_0x3a1713['interaction']['UserId'];if(!_0x196058&&_0x2ceda0){_0x196058=_0x2ceda0['id'];}var _0x517212=_['some'](_0x3a7721[_0x3a1713[_0x49d6('0x2c')]+_0x49d6('0x2d')],function(_0x5f0ff1){var _0x224f29=_[_0x49d6('0x2e')](_0x3a1713[_0x49d6('0x2c')])+_0x49d6('0x2f');return _0x5f0ff1[_0x224f29]===_0x3a1713[_0x49d6('0x30')]['id'];});if(!_0x517212&&_0x196058){_0x517212=_[_0x49d6('0x31')](_0x3a7721[_0x49d6('0x32')][_0x196058][_0x3a1713['channel']+_0x49d6('0x33')],function(_0x547f8d){return _0x547f8d['id']===_0x3a1713[_0x49d6('0x30')]['id'];});}return _0x517212;};exports[_0x49d6('0x34')]=function(_0x5a38ef,_0x4025da,_0x56783e,_0x21ab69){_0x5a38ef[_0x49d6('0x32')][_0x56783e['id']][_0x21ab69+_0x49d6('0x33')][_0x4025da[_0x49d6('0x19')]['id']]={'id':_0x4025da['interaction']['id']};};exports['removeWaitingNotification']=function(_0x438284,_0x3ddbe5,_0x508734,_0x1774a5){delete _0x438284[_0x49d6('0x32')][_0x508734['id']][_0x1774a5+_0x49d6('0x33')][_0x3ddbe5[_0x49d6('0x19')]['id']];};exports[_0x49d6('0x35')]=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 131e0a6..3931c9b 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 _0x01a3=['message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','map'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x01a3,0x13a));var _0x301a=function(_0x36f822,_0x49b4ca){_0x36f822=_0x36f822-0x0;var _0x5d0788=_0x01a3[_0x36f822];return _0x5d0788;};'use strict';var schema=require(_0x301a('0x0'));var sh=require(_0x301a('0x1'));var _=require(_0x301a('0x2'));var utils=require(_0x301a('0x3'));var logger=require(_0x301a('0x4'))(_0x301a('0x5'));var system=schema({'command':{'type':_0x301a('0x6'),'required':!![],'message':_0x301a('0x7')}});exports['consequence']=function(_0x50a660,_0x1e8199){return function(_0x12b2d9){try{var _0x33c685={'command':_0x1e8199[0x0]};var _0x506808=system[_0x301a('0x0')](_0x33c685,{'typecast':!![]});if(_0x506808['length']){logger[_0x301a('0x8')](_0x301a('0x9'),_0x50a660,_[_0x301a('0xa')](_0x506808,_0x301a('0xb'))[_0x301a('0xc')](',\x20'));logger['info'](_0x301a('0xd'),_0x50a660);_0x12b2d9[_0x301a('0xe')]();}else{var _0x19f4d1=this;var _0x2a6267=utils[_0x301a('0xf')](_0x1e8199[0x0],this);logger[_0x301a('0x10')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x50a660,_0x2a6267);sh[_0x301a('0x11')](_['trim'](_0x2a6267),function(_0x58d3c1,_0xccc885){logger['info'](_0x301a('0x12'),_0x50a660,_0x58d3c1);if(_0x58d3c1==0x0){var _0x121af9=_0xccc885[_0x301a('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x301a('0x14')](_0x1e8199[0x1])||_[_0x301a('0x15')](_0x1e8199[0x1])){logger[_0x301a('0x10')](_0x301a('0x16'),_0x50a660);_0x19f4d1[_0x301a('0x17')][_0x1e8199[0x1]]=_0x121af9;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x50a660,_0x1e8199[0x1],_0x121af9);_0x19f4d1['body'][_0x1e8199[0x1]]=_0x121af9;}}_0x12b2d9[_0x301a('0xe')]();});}}catch(_0x1a50ac){logger['error'](_0x301a('0x9'),_0x50a660,_[_0x301a('0x18')](_0x1a50ac)?JSON['stringify'](_0x1a50ac):_0x1a50ac);logger[_0x301a('0x10')](_0x301a('0xd'),_0x50a660);_0x12b2d9[_0x301a('0xe')]();}};}; \ No newline at end of file +var _0xa34c=['string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','lodash','./utils'];(function(_0x1ff085,_0xa5d361){var _0x229856=function(_0x5aea49){while(--_0x5aea49){_0x1ff085['push'](_0x1ff085['shift']());}};_0x229856(++_0xa5d361);}(_0xa34c,0x111));var _0xca34=function(_0x473f10,_0x1c91ea){_0x473f10=_0x473f10-0x0;var _0x4d9e6e=_0xa34c[_0x473f10];return _0x4d9e6e;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xca34('0x0'));var utils=require(_0xca34('0x1'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0xca34('0x2'),'required':!![],'message':_0xca34('0x3')}});exports[_0xca34('0x4')]=function(_0x4aada0,_0x5e0eb5){return function(_0x439bc4){try{var _0x3b4605={'command':_0x5e0eb5[0x0]};var _0x3e44e2=system[_0xca34('0x5')](_0x3b4605,{'typecast':!![]});if(_0x3e44e2[_0xca34('0x6')]){logger[_0xca34('0x7')](_0xca34('0x8'),_0x4aada0,_[_0xca34('0x9')](_0x3e44e2,'message')['join'](',\x20'));logger[_0xca34('0xa')](_0xca34('0xb'),_0x4aada0);_0x439bc4[_0xca34('0xc')]();}else{var _0x2c0d15=this;var _0x1867d3=utils[_0xca34('0xd')](_0x5e0eb5[0x0],this);logger['info'](_0xca34('0xe'),_0x4aada0,_0x1867d3);sh[_0xca34('0xf')](_[_0xca34('0x10')](_0x1867d3),function(_0x428c2f,_0x53ad0e){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x4aada0,_0x428c2f);if(_0x428c2f==0x0){var _0x2ba63e=_0x53ad0e[_0xca34('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xca34('0x12')](_0x5e0eb5[0x1])||_[_0xca34('0x13')](_0x5e0eb5[0x1])){logger[_0xca34('0xa')](_0xca34('0x14'),_0x4aada0);_0x2c0d15[_0xca34('0x15')][_0x5e0eb5[0x1]]=_0x2ba63e;}else{logger[_0xca34('0xa')](_0xca34('0x16'),_0x4aada0,_0x5e0eb5[0x1],_0x2ba63e);_0x2c0d15[_0xca34('0x15')][_0x5e0eb5[0x1]]=_0x2ba63e;}}_0x439bc4[_0xca34('0xc')]();});}}catch(_0x3d1fbe){logger[_0xca34('0x7')](_0xca34('0x8'),_0x4aada0,_[_0xca34('0x17')](_0x3d1fbe)?JSON[_0xca34('0x18')](_0x3d1fbe):_0x3d1fbe);logger[_0xca34('0xa')](_0xca34('0xb'),_0x4aada0);_0x439bc4['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 9e8be40..45c3ae6 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 _0xc8a3=['Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','next','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel'];(function(_0x364db1,_0x17ff9f){var _0x3fb823=function(_0x3f51de){while(--_0x3f51de){_0x364db1['push'](_0x364db1['shift']());}};_0x3fb823(++_0x17ff9f);}(_0xc8a3,0x70));var _0x3c8a=function(_0x562ce0,_0x1ebe08){_0x562ce0=_0x562ce0-0x0;var _0x14c632=_0xc8a3[_0x562ce0];return _0x14c632;};'use strict';var schema=require(_0x3c8a('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x3c8a('0x1')),'openchannelInteraction':require(_0x3c8a('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x3c8a('0x3')),'whatsappInteraction':require(_0x3c8a('0x4'))};var logger=require(_0x3c8a('0x5'))(_0x3c8a('0x6'));var tag=schema({'tag':{'type':_0x3c8a('0x7'),'required':!![],'message':_0x3c8a('0x8')}});exports['consequence']=function(_0x42fa92,_0x5bbd40,_0xcdd97b,_0x5daae0){return function(_0xb07148){try{var _0x3d9c09={'tag':_0x5bbd40[0x0]};var _0x485305=tag[_0x3c8a('0x0')](_0x3d9c09,{'typecast':!![]});if(_0x485305[_0x3c8a('0x9')]){logger[_0x3c8a('0xa')](_0x3c8a('0xb'),_0x42fa92,_[_0x3c8a('0xc')](_0x485305,_0x3c8a('0xd'))[_0x3c8a('0xe')](',\x20'));logger[_0x3c8a('0xf')](_0x3c8a('0x10'),_0x42fa92);_0xb07148['next']();}else{var _0x1d5ac0={'ids':[_0x5bbd40[0x0]]};if(rpc[_0x5daae0[_0x3c8a('0x11')]+'Interaction']){rpc[_0x5daae0[_0x3c8a('0x11')]+_0x3c8a('0x12')][_0x3c8a('0x13')](_0x5daae0[_0x3c8a('0x14')]['id'],_0x1d5ac0)[_0x3c8a('0x15')](function(_0x4006b9){logger['info'](_0x3c8a('0x16'),_0x42fa92,_0x5bbd40[0x1],_0x5daae0[_0x3c8a('0x11')],_0x5daae0[_0x3c8a('0x14')]['id']);})['catch'](function(_0x242f24){logger[_0x3c8a('0xa')](_0x3c8a('0xb'),_0x42fa92,JSON[_0x3c8a('0x17')](_0x242f24));logger[_0x3c8a('0xf')](_0x3c8a('0x10'),_0x42fa92);})[_0x3c8a('0x18')](function(){_0xb07148[_0x3c8a('0x19')]();});}}}catch(_0x123a9b){logger[_0x3c8a('0xa')](_0x3c8a('0xb'),_0x42fa92,_['isObject'](_0x123a9b)?JSON[_0x3c8a('0x17')](_0x123a9b):_0x123a9b);logger[_0x3c8a('0xf')](_0x3c8a('0x10'),_0x42fa92);_0xb07148[_0x3c8a('0x19')]();}};}; \ No newline at end of file +var _0xd1fa=['error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length'];(function(_0x35e643,_0x333824){var _0x167f63=function(_0x268230){while(--_0x268230){_0x35e643['push'](_0x35e643['shift']());}};_0x167f63(++_0x333824);}(_0xd1fa,0x96));var _0xad1f=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xd1fa[_0x160c73];return _0xd9302;};'use strict';var schema=require(_0xad1f('0x0'));var _=require(_0xad1f('0x1'));var rpc={'chatInteraction':require(_0xad1f('0x2')),'openchannelInteraction':require(_0xad1f('0x3')),'smsInteraction':require(_0xad1f('0x4')),'mailInteraction':require(_0xad1f('0x5')),'faxInteraction':require(_0xad1f('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xad1f('0x7'))(_0xad1f('0x8'));var tag=schema({'tag':{'type':_0xad1f('0x9'),'required':!![],'message':_0xad1f('0xa')}});exports['consequence']=function(_0x952040,_0x4e89ee,_0x53d2b3,_0x421231){return function(_0x1b683f){try{var _0x5ea71d={'tag':_0x4e89ee[0x0]};var _0x48025a=tag['validate'](_0x5ea71d,{'typecast':!![]});if(_0x48025a[_0xad1f('0xb')]){logger[_0xad1f('0xc')](_0xad1f('0xd'),_0x952040,_[_0xad1f('0xe')](_0x48025a,_0xad1f('0xf'))['join'](',\x20'));logger[_0xad1f('0x10')](_0xad1f('0x11'),_0x952040);_0x1b683f[_0xad1f('0x12')]();}else{var _0x38c1f0={'ids':[_0x4e89ee[0x0]]};if(rpc[_0x421231[_0xad1f('0x13')]+_0xad1f('0x14')]){rpc[_0x421231[_0xad1f('0x13')]+'Interaction'][_0xad1f('0x15')](_0x421231[_0xad1f('0x16')]['id'],_0x38c1f0)['then'](function(_0x3addc6){logger[_0xad1f('0x10')](_0xad1f('0x17'),_0x952040,_0x4e89ee[0x1],_0x421231['channel'],_0x421231[_0xad1f('0x16')]['id']);})['catch'](function(_0x1359f8){logger[_0xad1f('0xc')](_0xad1f('0xd'),_0x952040,JSON[_0xad1f('0x18')](_0x1359f8));logger[_0xad1f('0x10')](_0xad1f('0x11'),_0x952040);})[_0xad1f('0x19')](function(){_0x1b683f[_0xad1f('0x12')]();});}}}catch(_0x53b10c){logger[_0xad1f('0xc')](_0xad1f('0xd'),_0x952040,_[_0xad1f('0x1a')](_0x53b10c)?JSON[_0xad1f('0x18')](_0x53b10c):_0x53b10c);logger[_0xad1f('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x952040);_0x1b683f[_0xad1f('0x12')]();}};}; \ 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 f7831ad..2d4f242 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 _0x411c=['next','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','title','2.0','method','push','params','stringify','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x411c,0x156));var _0xc411=function(_0x56abec,_0x19ff2c){_0x56abec=_0x56abec-0x0;var _0x210fd1=_0x411c[_0x56abec];return _0x210fd1;};'use strict';var rp=require('request-promise');var logger=require(_0xc411('0x0'))('routing');var _=require(_0xc411('0x1'));var arr=[];exports[_0xc411('0x2')]=function(_0x2e72c7,_0xbd175f){return function(_0x3b4ff4){var _0x4154e6=_0xbd175f[0xa];var _0x1d82d1=_0xbd175f[0xb];var _0x158b59=_0xbd175f[0xc];var _0x3e37d5=_0xbd175f[0xd];var _0x545105=_0xbd175f[0xe];var _0x5aebd6=_0xbd175f[0xf][_0xc411('0x3')](/\n/g,_0xc411('0x4'));var _0x36e20a=_0xbd175f[0x10][_0xc411('0x3')](/\n/g,'\x20');if(!arr[_0xc411('0x5')](_0x1d82d1)){arr['push'](_0x1d82d1);var _0x312797=_0xbd175f[0x3];var _0x1eedde=_0xbd175f[0x4];var _0x1ac6ab=_0xbd175f[0x1];var _0x208521=_0xbd175f[0x0];var _0x379083={};_0x379083[_0xc411('0x6')]=_0xbd175f[0x8]+'?params='+_0x158b59+'|'+_0x4154e6+'|'+_0x3e37d5+'|'+_0x1d82d1+'|'+_0x545105;_0x379083['urlOnRing']=_0xbd175f[0x7]+_0xc411('0x7')+_0x158b59+'|'+_0x4154e6+'|'+_0x3e37d5+'|'+_0x1d82d1+'|'+_0x545105+'|'+_0x5aebd6+'|'+_0x36e20a;_0x379083[_0xc411('0x8')]=_0xbd175f[0x9];var _0x1a7edc={};_0x1a7edc['jsonrpc']=_0xc411('0x9');_0x1a7edc[_0xc411('0xa')]='login';var _0x4cc374=[];_0x4cc374[_0xc411('0xb')](_0xbd175f[0x2]);_0x4cc374[_0xc411('0xb')](_0xbd175f[0x5]);_0x4cc374[_0xc411('0xb')](_0xbd175f[0x6]);_0x1a7edc[_0xc411('0xc')]=_0x4cc374;_0x1a7edc['id']=0x1;var _0x4fa004=JSON[_0xc411('0xd')](_0x1a7edc);var _0x5cab50={'encoding':'utf8','method':_0xc411('0xe'),'timeout':0x2710,'url':_0x312797,'headers':{'Content-Type':_0xc411('0xf')},'body':_0x4fa004};return rp(_0x5cab50)[_0xc411('0x10')](function(_0x160bb8){const _0x20ecb2=JSON[_0xc411('0x11')](_0x160bb8);if(!_0x20ecb2['result'][_0xc411('0x12')]){throw new Error(_0xc411('0x13'));}var _0x18b677=_0x1d82d1;var _0x2a3672=_0xc411('0x14')+_0x1ac6ab+_0xc411('0x15')+_0x208521+_0xc411('0x16')+_0x18b677+'&data='+JSON[_0xc411('0xd')](_0x379083);var _0x534ba6=_0x1eedde+'?'+_0x2a3672;return rp(_0x534ba6);})[_0xc411('0x10')](function(_0x275054){logger[_0xc411('0x17')](_0xc411('0x18'),_0x2e72c7,_0x275054);_0x3b4ff4['stop']();})[_0xc411('0x19')](function(_0x4e1e68){logger['error'](_0xc411('0x1a'),_0x2e72c7,_[_0xc411('0x1b')](_0x4e1e68)?JSON[_0xc411('0xd')](_0x4e1e68):_0x4e1e68);_0x3b4ff4[_0xc411('0x1c')]();});}else{logger['info'](_0xc411('0x1d'),_0x2e72c7);_0x3b4ff4[_0xc411('0x1e')]();}};}; \ No newline at end of file +var _0x82ea=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','&data=','stringify','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','replace','includes','push','urlOnAnswer','urlOnRing','jsonrpc','2.0','method','login','utf8','application/json-rpc','parse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82ea,0xf6));var _0xa82e=function(_0xb9a9cb,_0x35753b){_0xb9a9cb=_0xb9a9cb-0x0;var _0x9b1e6c=_0x82ea[_0xb9a9cb];return _0x9b1e6c;};'use strict';var rp=require(_0xa82e('0x0'));var logger=require(_0xa82e('0x1'))(_0xa82e('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x4432cf,_0xbe3e80){return function(_0x57cafd){var _0x51e328=_0xbe3e80[0xa];var _0x482b99=_0xbe3e80[0xb];var _0x19b5f0=_0xbe3e80[0xc];var _0x267277=_0xbe3e80[0xd];var _0x4598d1=_0xbe3e80[0xe];var _0x367c22=_0xbe3e80[0xf][_0xa82e('0x3')](/\n/g,'\x20-\x20');var _0x5b4c11=_0xbe3e80[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xa82e('0x4')](_0x482b99)){arr[_0xa82e('0x5')](_0x482b99);var _0x2729b1=_0xbe3e80[0x3];var _0x276b5a=_0xbe3e80[0x4];var _0x17ac08=_0xbe3e80[0x1];var _0x254852=_0xbe3e80[0x0];var _0x4ec43a={};_0x4ec43a[_0xa82e('0x6')]=_0xbe3e80[0x8]+'?params='+_0x19b5f0+'|'+_0x51e328+'|'+_0x267277+'|'+_0x482b99+'|'+_0x4598d1;_0x4ec43a[_0xa82e('0x7')]=_0xbe3e80[0x7]+'?params='+_0x19b5f0+'|'+_0x51e328+'|'+_0x267277+'|'+_0x482b99+'|'+_0x4598d1+'|'+_0x367c22+'|'+_0x5b4c11;_0x4ec43a['title']=_0xbe3e80[0x9];var _0x1f2c0e={};_0x1f2c0e[_0xa82e('0x8')]=_0xa82e('0x9');_0x1f2c0e[_0xa82e('0xa')]=_0xa82e('0xb');var _0x4985be=[];_0x4985be[_0xa82e('0x5')](_0xbe3e80[0x2]);_0x4985be[_0xa82e('0x5')](_0xbe3e80[0x5]);_0x4985be[_0xa82e('0x5')](_0xbe3e80[0x6]);_0x1f2c0e['params']=_0x4985be;_0x1f2c0e['id']=0x1;var _0x2dd21f=JSON['stringify'](_0x1f2c0e);var _0x26e6ea={'encoding':_0xa82e('0xc'),'method':'POST','timeout':0x2710,'url':_0x2729b1,'headers':{'Content-Type':_0xa82e('0xd')},'body':_0x2dd21f};return rp(_0x26e6ea)['then'](function(_0xe1f183){const _0x46929f=JSON[_0xa82e('0xe')](_0xe1f183);if(!_0x46929f['result'][_0xa82e('0xf')]){throw new Error(_0xa82e('0x10'));}var _0x4421e8=_0x482b99;var _0x1c4daf='channelId='+_0x17ac08+_0xa82e('0x11')+_0x254852+_0xa82e('0x12')+_0x4421e8+_0xa82e('0x13')+JSON[_0xa82e('0x14')](_0x4ec43a);var _0x541d66=_0x276b5a+'?'+_0x1c4daf;return rp(_0x541d66);})[_0xa82e('0x15')](function(_0x54cd72){logger[_0xa82e('0x16')](_0xa82e('0x17'),_0x4432cf,_0x54cd72);_0x57cafd[_0xa82e('0x18')]();})[_0xa82e('0x19')](function(_0x9a84ad){logger['error'](_0xa82e('0x1a'),_0x4432cf,_[_0xa82e('0x1b')](_0x9a84ad)?JSON['stringify'](_0x9a84ad):_0x9a84ad);_0x57cafd[_0xa82e('0x18')]();});}else{logger[_0xa82e('0x16')](_0xa82e('0x1c'),_0x4432cf);_0x57cafd['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 2ef9001..6302e77 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x4db75f,_0x4aae97){var _0x2979bf=function(_0x431dc7){while(--_0x431dc7){_0x4db75f['push'](_0x4db75f['shift']());}};_0x2979bf(++_0x4aae97);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x2b1932,_0x5da007){var _0x2da643=function(_0x23ef90){while(--_0x23ef90){_0x2b1932['push'](_0x2b1932['shift']());}};_0x2da643(++_0x5da007);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 0eb9a8c..ccc5f51 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 _0x466c=['chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','notificationTemplate','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues'];(function(_0x14be3a,_0x301ddc){var _0xd4e7c9=function(_0x382699){while(--_0x382699){_0x14be3a['push'](_0x14be3a['shift']());}};_0xd4e7c9(++_0x301ddc);}(_0x466c,0x1ac));var _0xc466=function(_0x330304,_0x4e9347){_0x330304=_0x330304-0x0;var _0x288a85=_0x466c[_0x330304];return _0x288a85;};'use strict';var _=require(_0xc466('0x0'));var util=require(_0xc466('0x1'));var path=require(_0xc466('0x2'));var fs=require('fs');var jayson=require(_0xc466('0x3'));var BPromise=require(_0xc466('0x4'));var utils=require(_0xc466('0x5'));var sUtils=require(_0xc466('0x6'));var logger=require(_0xc466('0x7'))(_0xc466('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xc466('0x9')),'chatQueueReport':require(_0xc466('0xa')),'smsQueueReport':require(_0xc466('0xb')),'faxQueueReport':require(_0xc466('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xc466('0xd'));function getId(_0x580869,_0x2ac866,_0x180ed1){return util[_0xc466('0xe')](_0xc466('0xf'),_0x580869,_0x2ac866||0x0,_0x180ed1||0x0);}function getIntervals(_0x2d3db6,_0x44f163){var _0x8544d=[];if(!_[_0xc466('0x10')](_0x44f163[_0xc466('0x11')])&&!_[_0xc466('0x10')](_0x2d3db6[_0x44f163[_0xc466('0x11')]])&&!_[_0xc466('0x10')](_0x2d3db6[_0x44f163['IntervalId']][_0xc466('0x12')])){_0x8544d=_[_0xc466('0x13')](_0x2d3db6[_0x44f163['IntervalId']]['Intervals'],_0xc466('0x14'));}else if(!_['isNil'](_0x44f163[_0xc466('0x14')])){_0x8544d=[_0x44f163[_0xc466('0x14')]];}return _0x8544d;}exports[_0xc466('0x15')]=function(_0x203971){_0x203971[_0xc466('0x16')]={};return new BPromise(function(_0x49c7ff,_0x4462b6){var _0x447184={'Start':function(_0x32b22b){var _0x5be7f8=this;return new Promise(function(_0x4a5201,_0x22fec3){if(_0x32b22b){try{var _0x251b55=[];var _0x509368=getId(_0x32b22b[_0xc466('0x17')],_0x32b22b[_0xc466('0x18')]?_0x32b22b['message']['id']:0x0,_0x32b22b[_0xc466('0x19')]?_0x32b22b[_0xc466('0x19')]['id']:0x0);var _0x29db36=sUtils[_0xc466('0x1a')](_0x203971,_0x32b22b);if(!_0x29db36&&_0x32b22b[_0xc466('0x1b')]&&_[_0xc466('0x1c')](_0x32b22b[_0xc466('0x1b')])&&_0x32b22b[_0xc466('0x1b')][_0xc466('0x1d')]){for(var _0x11a119=0x0;_0x11a119<_0x32b22b[_0xc466('0x1b')][_0xc466('0x1d')];_0x11a119+=0x1){var _0x5cedee=_0x32b22b[_0xc466('0x1b')][_0x11a119];if(fs[_0xc466('0x1e')](path['join'](__dirname,_0xc466('0x1b'),_0x5cedee[_0xc466('0x1f')]+_0xc466('0x20')))){var _0x50fd1d=[];switch(_0x5cedee[_0xc466('0x1f')][_0xc466('0x21')]()){case _0xc466('0x22'):var _0x48b9ae=_0x5cedee[_0xc466('0x23')][_0xc466('0x24')](',');if(_0x32b22b[_0xc466('0x17')]===_0xc466('0x25')){_0x50fd1d[_0xc466('0x26')](_0x48b9ae[0x0]);_0x50fd1d[_0xc466('0x26')](_0x48b9ae[0x1]);_0x50fd1d['push'](_0x48b9ae[_0xc466('0x27')](0x2,_0x48b9ae['length'])[_0xc466('0x28')](','));}else{_0x50fd1d[_0xc466('0x26')](_0x48b9ae[0x0]);_0x50fd1d[_0xc466('0x26')](_0x48b9ae[_0xc466('0x27')](0x1,_0x48b9ae[_0xc466('0x1d')])[_0xc466('0x28')](','));}break;case _0xc466('0x29'):var _0x1199da=_0x5cedee[_0xc466('0x23')]['split'](',');_0x50fd1d[_0xc466('0x26')](_0x1199da[0x0]);_0x50fd1d['push'](_0x1199da[0x1]);_0x50fd1d[_0xc466('0x26')](_0x1199da['slice'](0x2,_0x1199da[_0xc466('0x1d')])[_0xc466('0x28')](','));break;case _0xc466('0x2a'):var _0x8cfb85=_0x5cedee['appdata'][_0xc466('0x24')](',');_0x50fd1d[_0xc466('0x26')](_0x8cfb85[0x0]);_0x50fd1d[_0xc466('0x26')](_0x8cfb85[0x1]);_0x50fd1d[_0xc466('0x26')](_0x8cfb85[0x2]);_0x50fd1d[_0xc466('0x26')](_0x8cfb85[0x3]);_0x50fd1d[_0xc466('0x26')](_0x8cfb85[_0xc466('0x27')](0x4,_0x8cfb85[_0xc466('0x1d')])[_0xc466('0x28')](','));break;case _0xc466('0x2b'):var _0x5ac5bb=_0x5cedee['appdata']['split'](',');_0x50fd1d[_0xc466('0x26')](_0x5ac5bb[0x0]);_0x50fd1d[_0xc466('0x26')](_0x5ac5bb[0x1]);_0x50fd1d[_0xc466('0x26')](_0x5ac5bb[0x2]);_0x50fd1d[_0xc466('0x26')](_0x5ac5bb[0x3]);_0x50fd1d[_0xc466('0x26')](_0x5ac5bb[_0xc466('0x27')](0x4,_0x5ac5bb['length'])['join'](','));break;case _0xc466('0x18'):_0x50fd1d['push'](_0x5cedee['appdata']);break;case'tag':_0x50fd1d['push'](_0x5cedee[_0xc466('0x2c')]);_0x50fd1d[_0xc466('0x26')](_0x5cedee[_0xc466('0x23')]);break;case _0xc466('0x2d'):var _0x1d6940=utils[_0xc466('0x2e')](_0x32b22b['account'][_0xc466('0x2f')],_0x32b22b);var _0x116b3b=_0x5cedee[_0xc466('0x23')]['split'](',');_0x50fd1d[_0xc466('0x26')](_0x116b3b[0x0]);_0x50fd1d[_0xc466('0x26')](_0x116b3b[0x1]);_0x50fd1d[_0xc466('0x26')](_0x116b3b[0x2]);_0x50fd1d['push'](_0x116b3b[0x3]);_0x50fd1d['push'](_0x116b3b[0x4]);_0x50fd1d[_0xc466('0x26')](_0x116b3b[0x5]);_0x50fd1d[_0xc466('0x26')](_0x116b3b[0x6]);_0x50fd1d['push'](_0x116b3b[0x7]);_0x50fd1d[_0xc466('0x26')](_0x116b3b[0x8]);_0x50fd1d['push'](_0x116b3b[0x9]);_0x50fd1d['push'](_0x116b3b[0xa]);_0x50fd1d[_0xc466('0x26')](_0x32b22b[_0xc466('0x19')]['id']);_0x50fd1d[_0xc466('0x26')](_0x32b22b[_0xc466('0x18')]['id']);_0x50fd1d[_0xc466('0x26')](_0x5cedee['ChatWebsiteId']);_0x50fd1d[_0xc466('0x26')](_0x32b22b[_0xc466('0x19')][_0xc466('0x30')]);_0x50fd1d[_0xc466('0x26')](_0x32b22b['body'][_0xc466('0x31')]);_0x50fd1d[_0xc466('0x26')](_0x1d6940);break;default:_0x50fd1d=_['isNil'](_0x5cedee[_0xc466('0x23')])?[]:_0x5cedee[_0xc466('0x23')][_0xc466('0x24')](',');}var _0x4303f4={'id':util[_0xc466('0xe')](_0xc466('0x32'),_0x509368,_0x5cedee['id'],_0x5cedee['app']),'condition':require(_0xc466('0x33'))[_0xc466('0x34')](_0x509368,getIntervals(_0x203971[_0xc466('0x35')],_0x5cedee),_0x203971),'consequence':require(_0xc466('0x36')+_0x5cedee[_0xc466('0x1f')])[_0xc466('0x37')](_0x509368,_0x50fd1d,_0x203971,_0x32b22b),'p':_0x5cedee['priority']||0x0};logger[_0xc466('0x38')]('Push\x20new\x20rule',_0x4303f4['id'],_0xc466('0x39'),getIntervals(_0x203971[_0xc466('0x35')],_0x5cedee)[_0xc466('0x28')](_0xc466('0x3a')));_0x251b55['push'](_0x4303f4);}else{logger['error'](_0xc466('0x3b'),path[_0xc466('0x28')](__dirname,_0xc466('0x1b'),_0x5cedee[_0xc466('0x1f')]+_0xc466('0x20')));}}_0x203971[_0xc466('0x16')][_0x509368]=new RuleEngine(_0x251b55);_0x203971[_0xc466('0x16')][_0x509368]['execute'](_0x32b22b,function(_0x3663d8){logger['info'](_0xc466('0x3c'),JSON['stringify'](_0x3663d8[_0xc466('0x3d')]));if(_0x203971[_0xc466('0x16')][_0x509368]){_0x203971[_0xc466('0x16')][_0x509368][_0xc466('0x3e')](_0xc466('0x3f'));}});return _0x4a5201({'code':0xc8,'message':_0x32b22b});}else{if(_0x29db36){logger[_0xc466('0x38')](util[_0xc466('0xe')](_0xc466('0x40'),_0x509368));}else{logger[_0xc466('0x38')](_0xc466('0x41'));}return _0x4a5201({'code':0xc8,'message':_0x32b22b});}}catch(_0x282999){logger[_0xc466('0x42')](_0x282999[_0xc466('0x43')]);return _0x22fec3(_0x5be7f8[_0xc466('0x42')](0x1f4,_0x282999));}}return _0x22fec3(_0xc466('0x44'));});},'AcceptMessage':function(_0x1958fe){var _0x1e93c6=this;return new Promise(function(_0x3e7b1f,_0x482b85){if(_0x1958fe[_0xc466('0x45')]&&_0x1958fe[_0xc466('0x45')]['id']){if(_0x203971[_0xc466('0x46')][_0x1958fe['agent']['id']]){_0x203971[_0xc466('0x46')][_0x1958fe[_0xc466('0x45')]['id']][_0xc466('0x47')]=![];_0x203971[_0xc466('0x46')][_0x1958fe[_0xc466('0x45')]['id']][_0xc466('0x48')]=undefined;}}if(_0x1958fe[_0xc466('0x18')]&&_0x1958fe[_0xc466('0x18')]['id']){try{var _0x176772=getId(_0x1958fe['channel'],_0x1958fe[_0xc466('0x18')]?_0x1958fe[_0xc466('0x18')]['id']:0x0,_0x1958fe[_0xc466('0x19')]?_0x1958fe[_0xc466('0x19')]['id']:0x0);if(_0x203971[_0xc466('0x16')][_0x176772]){_0x203971[_0xc466('0x16')][_0x176772][_0xc466('0x3e')]('end');if(rpc[_0x1958fe[_0xc466('0x17')]+_0xc466('0x49')]){rpc[_0x1958fe[_0xc466('0x17')]+_0xc466('0x49')][_0xc466('0x4a')](_0x176772,{'UserId':_0x1958fe['message'][_0xc466('0x4b')]})[_0xc466('0x4c')](function(){logger['error'](_0xc466('0x4d'));});}}return _0x3e7b1f({'code':0xc8,'message':_0x1958fe});}catch(_0xb63ee0){logger[_0xc466('0x42')](_0xb63ee0[_0xc466('0x43')]);return _0x482b85(_0x1e93c6[_0xc466('0x42')](0x1f4,_0xb63ee0));}}logger[_0xc466('0x42')](_0xc466('0x4e'));return _0x482b85(_0x1e93c6[_0xc466('0x42')](0x1f4,_0xc466('0x4e')));});},'RejectMessage':function(_0x18ca66){var _0x46fc14=this;return new Promise(function(_0x5b27b1,_0x3717aa){if(_0x18ca66[_0xc466('0x45')]&&_0x18ca66[_0xc466('0x45')]['id']){try{if(_0x203971['agents'][_0x18ca66[_0xc466('0x45')]['id']]){_0x203971[_0xc466('0x46')][_0x18ca66[_0xc466('0x45')]['id']][_0xc466('0x47')]=![];_0x203971[_0xc466('0x46')][_0x18ca66['agent']['id']][_0xc466('0x48')]=undefined;}return _0x5b27b1({'code':0xc8,'message':_0x18ca66});}catch(_0x469fd4){logger[_0xc466('0x42')](_0x469fd4[_0xc466('0x43')]);return _0x3717aa(_0x46fc14[_0xc466('0x42')](0x1f4,_0x469fd4));}}logger['error']('message\x20is\x20empty');return _0x3717aa(_0x46fc14[_0xc466('0x42')](0x1f4,_0xc466('0x4e')));});},'AbandonInteraction':function(_0x1d3f3a){var _0x568622=this;return new Promise(function(_0x4f149b,_0x237b21){if(_0x1d3f3a[_0xc466('0x17')]&&_0x1d3f3a[_0xc466('0x19')]&&_0x1d3f3a[_0xc466('0x19')]['id']){try{var _0x171127=getId(_0x1d3f3a[_0xc466('0x17')],_0x1d3f3a['message']?_0x1d3f3a[_0xc466('0x18')]['id']:0x0,_0x1d3f3a[_0xc466('0x19')]?_0x1d3f3a[_0xc466('0x19')]['id']:0x0);if(_0x203971[_0xc466('0x16')][_0x171127]){_0x203971[_0xc466('0x16')][_0x171127][_0xc466('0x3e')]('end');}return _0x4f149b({'code':0xc8,'message':_0x1d3f3a});}catch(_0x5a13a4){logger['error'](_0x5a13a4['stack']);return _0x237b21(_0x568622[_0xc466('0x42')](0x1f4,_0x5a13a4));}}logger[_0xc466('0x42')](_0xc466('0x4e'));return _0x237b21(_0x568622[_0xc466('0x42')](0x1f4,_0xc466('0x4e')));});},'AgentCapacity':function(_0x4a8468){var _0x386562=this;return new Promise(function(_0x585c68,_0xcde98e){if(_0x203971['agents'][_0xc466('0x4f')](_0x4a8468['id'])){for(var _0x561396 in _0x4a8468[_0xc466('0x50')]){if(_0x4a8468['capacity'][_0xc466('0x4f')](_0x561396)){if(_0x203971[_0xc466('0x46')][_0x4a8468['id']][_0xc466('0x4f')](_0x561396+_0xc466('0x51'))){_0x203971[_0xc466('0x46')][_0x4a8468['id']][_0x561396+_0xc466('0x51')]=parseInt(_0x4a8468['capacity'][_0x561396],0xa);}}}_0x203971[_0xc466('0x46')][_0x4a8468['id']][_0xc466('0x52')]();return _0x585c68({'code':0xc8,'message':_0x203971[_0xc466('0x46')][_0x4a8468['id']]});}else{return _0xcde98e(_0x386562[_0xc466('0x42')](0x1f4,_0xc466('0x53')));}});},'Agents':function(_0x425155){return new Promise(function(_0x339a92){var _0x379e2c=_[_0xc466('0x54')](_0x203971[_0xc466('0x46')]);if(_0x425155&&_0x425155['id']){var _0x2e6c20=_[_0xc466('0x55')](_0x379e2c,function(_0x3dd018){return _0x3dd018['id']===_0x425155['id'];});_0x339a92(_0x2e6c20);}else{_0x339a92({'count':_0x379e2c[_0xc466('0x1d')],'rows':_0x379e2c});}});},'ChatQueues':function(){return new Promise(function(_0xc328d7){var _0x5b6f44=[];for(var _0x41e943 in _0x203971[_0xc466('0x56')]){if(_0x203971['chatQueues'][_0xc466('0x4f')](_0x41e943)){var _0x3d8c9f=_0x203971[_0xc466('0x56')][_0x41e943];var _0x2e3e9a={'id':_0x3d8c9f['id'],'available':_0x3d8c9f[_0xc466('0x57')],'loggedIn':_0x3d8c9f[_0xc466('0x58')],'name':_0x3d8c9f[_0xc466('0x59')],'paused':_0x3d8c9f[_0xc466('0x5a')],'waiting':_0x3d8c9f[_0xc466('0x5b')]};_0x5b6f44[_0xc466('0x26')](_0x2e3e9a);}}_0xc328d7({'count':_0x5b6f44['length'],'rows':_0x5b6f44});});},'MailQueues':function(){return new Promise(function(_0x3a55e4){var _0x1e62ce=[];for(var _0x1e09cf in _0x203971[_0xc466('0x5c')]){if(_0x203971[_0xc466('0x5c')][_0xc466('0x4f')](_0x1e09cf)){var _0x4960ff=_0x203971[_0xc466('0x5c')][_0x1e09cf];var _0x109af8={'id':_0x4960ff['id'],'available':_0x4960ff[_0xc466('0x57')],'loggedIn':_0x4960ff[_0xc466('0x58')],'name':_0x4960ff['name'],'paused':_0x4960ff[_0xc466('0x5a')],'waiting':_0x4960ff['waiting']};_0x1e62ce[_0xc466('0x26')](_0x109af8);}}_0x3a55e4({'count':_0x1e62ce['length'],'rows':_0x1e62ce});});},'OpenchannelQueues':function(){return new Promise(function(_0x13023e){var _0x20d6d5=[];for(var _0x43949f in _0x203971['openchannelQueues']){if(_0x203971[_0xc466('0x5d')]['hasOwnProperty'](_0x43949f)){var _0x541071=_0x203971[_0xc466('0x5d')][_0x43949f];var _0x4585ed={'id':_0x541071['id'],'available':_0x541071[_0xc466('0x57')],'loggedIn':_0x541071[_0xc466('0x58')],'name':_0x541071[_0xc466('0x59')],'paused':_0x541071[_0xc466('0x5a')],'waiting':_0x541071[_0xc466('0x5b')]};_0x20d6d5[_0xc466('0x26')](_0x4585ed);}}_0x13023e({'count':_0x20d6d5[_0xc466('0x1d')],'rows':_0x20d6d5});});},'SmsQueues':function(){return new Promise(function(_0x3e2695){var _0x1c6432=[];for(var _0x1768c5 in _0x203971[_0xc466('0x5e')]){if(_0x203971[_0xc466('0x5e')]['hasOwnProperty'](_0x1768c5)){var _0x3bcf51=_0x203971['smsQueues'][_0x1768c5];var _0x316cea={'id':_0x3bcf51['id'],'available':_0x3bcf51['available'],'loggedIn':_0x3bcf51[_0xc466('0x58')],'name':_0x3bcf51['name'],'paused':_0x3bcf51[_0xc466('0x5a')],'waiting':_0x3bcf51[_0xc466('0x5b')]};_0x1c6432[_0xc466('0x26')](_0x316cea);}}_0x3e2695({'count':_0x1c6432[_0xc466('0x1d')],'rows':_0x1c6432});});},'FaxQueues':function(){return new Promise(function(_0x3205d9){var _0x2e5ea0=[];for(var _0x145b21 in _0x203971[_0xc466('0x5f')]){if(_0x203971[_0xc466('0x5f')][_0xc466('0x4f')](_0x145b21)){var _0x2c7269=_0x203971[_0xc466('0x5f')][_0x145b21];var _0x4546ca={'id':_0x2c7269['id'],'available':_0x2c7269[_0xc466('0x57')],'loggedIn':_0x2c7269[_0xc466('0x58')],'name':_0x2c7269['name'],'paused':_0x2c7269[_0xc466('0x5a')],'waiting':_0x2c7269['waiting']};_0x2e5ea0[_0xc466('0x26')](_0x4546ca);}}_0x3205d9({'count':_0x2e5ea0[_0xc466('0x1d')],'rows':_0x2e5ea0});});},'WhatsappQueues':function(){return new Promise(function(_0x1a152b){var _0x5dfb8b=[];for(var _0x19bdf2 in _0x203971['whatsappQueues']){if(_0x203971[_0xc466('0x60')][_0xc466('0x4f')](_0x19bdf2)){var _0x56c044=_0x203971['whatsappQueues'][_0x19bdf2];var _0x2c5356={'id':_0x56c044['id'],'available':_0x56c044[_0xc466('0x57')],'loggedIn':_0x56c044[_0xc466('0x58')],'name':_0x56c044[_0xc466('0x59')],'paused':_0x56c044['paused'],'waiting':_0x56c044[_0xc466('0x5b')]};_0x5dfb8b[_0xc466('0x26')](_0x2c5356);}}_0x1a152b({'count':_0x5dfb8b[_0xc466('0x1d')],'rows':_0x5dfb8b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x36970e){var _0x9b8a57=_[_0xc466('0x54')](_0x203971[_0xc466('0x61')]);_0x36970e({'count':_0x9b8a57[_0xc466('0x1d')],'rows':_0x9b8a57});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x20e703){var _0x4b5643=_[_0xc466('0x54')](_0x203971['mailQueuesWaitingInteractions']);_0x20e703({'count':_0x4b5643['length'],'rows':_0x4b5643});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xbd0c25){var _0x44056c=_[_0xc466('0x54')](_0x203971['openchannelQueuesWaitingInteractions']);_0xbd0c25({'count':_0x44056c[_0xc466('0x1d')],'rows':_0x44056c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x172c7f){var _0x272bb1=_[_0xc466('0x54')](_0x203971[_0xc466('0x62')]);_0x172c7f({'count':_0x272bb1[_0xc466('0x1d')],'rows':_0x272bb1});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3dcf97){var _0x1d464e=_[_0xc466('0x54')](_0x203971['faxQueuesWaitingInteractions']);_0x3dcf97({'count':_0x1d464e[_0xc466('0x1d')],'rows':_0x1d464e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4bef5a){var _0x50ab80=_[_0xc466('0x54')](_0x203971[_0xc466('0x63')]);_0x4bef5a({'count':_0x50ab80[_0xc466('0x1d')],'rows':_0x50ab80});});}};var _0x3e1d05=jayson[_0xc466('0x64')](_0x447184)['http']();_0x3e1d05['on'](_0xc466('0x42'),function(_0x52c2cb){logger[_0xc466('0x42')](JSON[_0xc466('0x65')](_0x52c2cb));return _0x4462b6(_0x52c2cb);});_0x3e1d05[_0xc466('0x15')](0x232c,_0xc466('0x66'),function(){console['log'](_0xc466('0x67'),0x232c);return _0x49c7ff(_0xc466('0x68')+0x232c);});});}; \ No newline at end of file +var _0x61a5=['app','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','find','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','existsSync','join','.js','toLowerCase','appdata','split','push','slice','length','dialogflow','dialogflowv2','amazonlex','tag','tvox','getMustacheRender','notificationTemplate','ContactId','body','%s:%s:%s'];(function(_0x29240d,_0x2d7d89){var _0x55f59d=function(_0x29c697){while(--_0x29c697){_0x29240d['push'](_0x29240d['shift']());}};_0x55f59d(++_0x2d7d89);}(_0x61a5,0x102));var _0x561a=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0x61a5[_0x2d3d0d];return _0xca35b6;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x561a('0x0'));var logger=require(_0x561a('0x1'))('routing');var rpc={'openchannelQueueReport':require(_0x561a('0x2')),'mailQueueReport':require(_0x561a('0x3')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x561a('0x4')),'faxQueueReport':require(_0x561a('0x5')),'whatsappQueueReport':require(_0x561a('0x6'))};var RuleEngine=require(_0x561a('0x7'));function getId(_0xae45d9,_0x14eec7,_0xa7a778){return util[_0x561a('0x8')](_0x561a('0x9'),_0xae45d9,_0x14eec7||0x0,_0xa7a778||0x0);}function getIntervals(_0x3dd4da,_0x4bf4b0){var _0x3e124b=[];if(!_[_0x561a('0xa')](_0x4bf4b0[_0x561a('0xb')])&&!_[_0x561a('0xa')](_0x3dd4da[_0x4bf4b0[_0x561a('0xb')]])&&!_[_0x561a('0xa')](_0x3dd4da[_0x4bf4b0[_0x561a('0xb')]][_0x561a('0xc')])){_0x3e124b=_[_0x561a('0xd')](_0x3dd4da[_0x4bf4b0['IntervalId']][_0x561a('0xc')],'interval');}else if(!_['isNil'](_0x4bf4b0['interval'])){_0x3e124b=[_0x4bf4b0[_0x561a('0xe')]];}return _0x3e124b;}exports[_0x561a('0xf')]=function(_0x8ba3fa){_0x8ba3fa[_0x561a('0x10')]={};return new BPromise(function(_0x164253,_0x1731ac){var _0x3545c2={'Start':function(_0x42fff2){var _0x11e2b7=this;return new Promise(function(_0x46d1bf,_0x851214){if(_0x42fff2){try{var _0x949f30=[];var _0x47ad4e=getId(_0x42fff2[_0x561a('0x11')],_0x42fff2['message']?_0x42fff2[_0x561a('0x12')]['id']:0x0,_0x42fff2['interaction']?_0x42fff2[_0x561a('0x13')]['id']:0x0);var _0xf75199=sUtils[_0x561a('0x14')](_0x8ba3fa,_0x42fff2);if(!_0xf75199&&_0x42fff2[_0x561a('0x15')]&&_[_0x561a('0x16')](_0x42fff2[_0x561a('0x15')])&&_0x42fff2[_0x561a('0x15')]['length']){for(var _0x2df785=0x0;_0x2df785<_0x42fff2[_0x561a('0x15')]['length'];_0x2df785+=0x1){var _0x5360f7=_0x42fff2['applications'][_0x2df785];if(fs[_0x561a('0x17')](path[_0x561a('0x18')](__dirname,_0x561a('0x15'),_0x5360f7['app']+_0x561a('0x19')))){var _0x4d2458=[];switch(_0x5360f7['app'][_0x561a('0x1a')]()){case'autoreply':var _0x443f07=_0x5360f7[_0x561a('0x1b')][_0x561a('0x1c')](',');if(_0x42fff2[_0x561a('0x11')]==='mail'){_0x4d2458['push'](_0x443f07[0x0]);_0x4d2458[_0x561a('0x1d')](_0x443f07[0x1]);_0x4d2458[_0x561a('0x1d')](_0x443f07[_0x561a('0x1e')](0x2,_0x443f07[_0x561a('0x1f')])[_0x561a('0x18')](','));}else{_0x4d2458['push'](_0x443f07[0x0]);_0x4d2458[_0x561a('0x1d')](_0x443f07[_0x561a('0x1e')](0x1,_0x443f07[_0x561a('0x1f')])[_0x561a('0x18')](','));}break;case _0x561a('0x20'):var _0x7ef8f2=_0x5360f7[_0x561a('0x1b')][_0x561a('0x1c')](',');_0x4d2458['push'](_0x7ef8f2[0x0]);_0x4d2458['push'](_0x7ef8f2[0x1]);_0x4d2458[_0x561a('0x1d')](_0x7ef8f2[_0x561a('0x1e')](0x2,_0x7ef8f2[_0x561a('0x1f')])[_0x561a('0x18')](','));break;case _0x561a('0x21'):var _0x8b67d=_0x5360f7[_0x561a('0x1b')][_0x561a('0x1c')](',');_0x4d2458[_0x561a('0x1d')](_0x8b67d[0x0]);_0x4d2458[_0x561a('0x1d')](_0x8b67d[0x1]);_0x4d2458['push'](_0x8b67d[0x2]);_0x4d2458[_0x561a('0x1d')](_0x8b67d[0x3]);_0x4d2458[_0x561a('0x1d')](_0x8b67d[_0x561a('0x1e')](0x4,_0x8b67d['length'])['join'](','));break;case _0x561a('0x22'):var _0x4c398f=_0x5360f7['appdata'][_0x561a('0x1c')](',');_0x4d2458[_0x561a('0x1d')](_0x4c398f[0x0]);_0x4d2458['push'](_0x4c398f[0x1]);_0x4d2458[_0x561a('0x1d')](_0x4c398f[0x2]);_0x4d2458['push'](_0x4c398f[0x3]);_0x4d2458[_0x561a('0x1d')](_0x4c398f[_0x561a('0x1e')](0x4,_0x4c398f[_0x561a('0x1f')])[_0x561a('0x18')](','));break;case _0x561a('0x12'):_0x4d2458[_0x561a('0x1d')](_0x5360f7['appdata']);break;case _0x561a('0x23'):_0x4d2458[_0x561a('0x1d')](_0x5360f7['TagId']);_0x4d2458[_0x561a('0x1d')](_0x5360f7[_0x561a('0x1b')]);break;case _0x561a('0x24'):var _0x2a0e12=utils[_0x561a('0x25')](_0x42fff2['account'][_0x561a('0x26')],_0x42fff2);var _0x518b52=_0x5360f7[_0x561a('0x1b')]['split'](',');_0x4d2458[_0x561a('0x1d')](_0x518b52[0x0]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x1]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x2]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x3]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x4]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x5]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x6]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x7]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x8]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x9]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0xa]);_0x4d2458['push'](_0x42fff2[_0x561a('0x13')]['id']);_0x4d2458[_0x561a('0x1d')](_0x42fff2[_0x561a('0x12')]['id']);_0x4d2458[_0x561a('0x1d')](_0x5360f7['ChatWebsiteId']);_0x4d2458[_0x561a('0x1d')](_0x42fff2[_0x561a('0x13')][_0x561a('0x27')]);_0x4d2458['push'](_0x42fff2[_0x561a('0x28')][_0x561a('0x28')]);_0x4d2458['push'](_0x2a0e12);break;default:_0x4d2458=_[_0x561a('0xa')](_0x5360f7[_0x561a('0x1b')])?[]:_0x5360f7[_0x561a('0x1b')]['split'](',');}var _0x228b73={'id':util[_0x561a('0x8')](_0x561a('0x29'),_0x47ad4e,_0x5360f7['id'],_0x5360f7[_0x561a('0x2a')]),'condition':require(_0x561a('0x2b'))[_0x561a('0x2c')](_0x47ad4e,getIntervals(_0x8ba3fa[_0x561a('0x2d')],_0x5360f7),_0x8ba3fa),'consequence':require(_0x561a('0x2e')+_0x5360f7['app'])[_0x561a('0x2f')](_0x47ad4e,_0x4d2458,_0x8ba3fa,_0x42fff2),'p':_0x5360f7[_0x561a('0x30')]||0x0};logger['info'](_0x561a('0x31'),_0x228b73['id'],_0x561a('0x32'),getIntervals(_0x8ba3fa[_0x561a('0x2d')],_0x5360f7)[_0x561a('0x18')](_0x561a('0x33')));_0x949f30[_0x561a('0x1d')](_0x228b73);}else{logger[_0x561a('0x34')](_0x561a('0x35'),path[_0x561a('0x18')](__dirname,'applications',_0x5360f7[_0x561a('0x2a')]+_0x561a('0x19')));}}_0x8ba3fa['rules'][_0x47ad4e]=new RuleEngine(_0x949f30);_0x8ba3fa[_0x561a('0x10')][_0x47ad4e]['execute'](_0x42fff2,function(_0x2280d3){logger[_0x561a('0x36')](_0x561a('0x37'),JSON[_0x561a('0x38')](_0x2280d3[_0x561a('0x39')]));if(_0x8ba3fa[_0x561a('0x10')][_0x47ad4e]){_0x8ba3fa[_0x561a('0x10')][_0x47ad4e][_0x561a('0x3a')](_0x561a('0x3b'));}});return _0x46d1bf({'code':0xc8,'message':_0x42fff2});}else{if(_0xf75199){logger[_0x561a('0x36')](util[_0x561a('0x8')]('Skipped\x20routing\x20for\x20%s',_0x47ad4e));}else{logger[_0x561a('0x36')]('No\x20applications\x20to\x20execute');}return _0x46d1bf({'code':0xc8,'message':_0x42fff2});}}catch(_0x49d07c){logger[_0x561a('0x34')](_0x49d07c[_0x561a('0x3c')]);return _0x851214(_0x11e2b7[_0x561a('0x34')](0x1f4,_0x49d07c));}}return _0x851214(_0x561a('0x3d'));});},'AcceptMessage':function(_0x396e7b){var _0x1ac2e1=this;return new Promise(function(_0x45d0ec,_0x38a44b){if(_0x396e7b[_0x561a('0x3e')]&&_0x396e7b[_0x561a('0x3e')]['id']){if(_0x8ba3fa[_0x561a('0x3f')][_0x396e7b[_0x561a('0x3e')]['id']]){_0x8ba3fa[_0x561a('0x3f')][_0x396e7b['agent']['id']][_0x561a('0x40')]=![];_0x8ba3fa[_0x561a('0x3f')][_0x396e7b[_0x561a('0x3e')]['id']][_0x561a('0x41')]=undefined;}}if(_0x396e7b[_0x561a('0x12')]&&_0x396e7b[_0x561a('0x12')]['id']){try{var _0x471e37=getId(_0x396e7b['channel'],_0x396e7b[_0x561a('0x12')]?_0x396e7b[_0x561a('0x12')]['id']:0x0,_0x396e7b[_0x561a('0x13')]?_0x396e7b[_0x561a('0x13')]['id']:0x0);if(_0x8ba3fa[_0x561a('0x10')][_0x471e37]){_0x8ba3fa[_0x561a('0x10')][_0x471e37][_0x561a('0x3a')](_0x561a('0x42'));if(rpc[_0x396e7b['channel']+_0x561a('0x43')]){rpc[_0x396e7b[_0x561a('0x11')]+'QueueReport'][_0x561a('0x44')](_0x471e37,{'UserId':_0x396e7b[_0x561a('0x12')]['UserId']})[_0x561a('0x45')](function(){logger[_0x561a('0x34')](_0x561a('0x46'));});}}return _0x45d0ec({'code':0xc8,'message':_0x396e7b});}catch(_0x35a546){logger[_0x561a('0x34')](_0x35a546['stack']);return _0x38a44b(_0x1ac2e1[_0x561a('0x34')](0x1f4,_0x35a546));}}logger[_0x561a('0x34')](_0x561a('0x47'));return _0x38a44b(_0x1ac2e1[_0x561a('0x34')](0x1f4,_0x561a('0x47')));});},'RejectMessage':function(_0x217b15){var _0xd9131c=this;return new Promise(function(_0x106ce0,_0x1b5360){if(_0x217b15['agent']&&_0x217b15['agent']['id']){try{if(_0x8ba3fa[_0x561a('0x3f')][_0x217b15[_0x561a('0x3e')]['id']]){_0x8ba3fa['agents'][_0x217b15[_0x561a('0x3e')]['id']][_0x561a('0x40')]=![];_0x8ba3fa[_0x561a('0x3f')][_0x217b15[_0x561a('0x3e')]['id']][_0x561a('0x41')]=undefined;}return _0x106ce0({'code':0xc8,'message':_0x217b15});}catch(_0x40ad2c){logger[_0x561a('0x34')](_0x40ad2c[_0x561a('0x3c')]);return _0x1b5360(_0xd9131c[_0x561a('0x34')](0x1f4,_0x40ad2c));}}logger['error']('message\x20is\x20empty');return _0x1b5360(_0xd9131c[_0x561a('0x34')](0x1f4,_0x561a('0x47')));});},'AbandonInteraction':function(_0x274f1c){var _0x6b40de=this;return new Promise(function(_0x5f31c2,_0x20fea6){if(_0x274f1c['channel']&&_0x274f1c[_0x561a('0x13')]&&_0x274f1c['interaction']['id']){try{var _0x13a04c=getId(_0x274f1c['channel'],_0x274f1c[_0x561a('0x12')]?_0x274f1c['message']['id']:0x0,_0x274f1c['interaction']?_0x274f1c[_0x561a('0x13')]['id']:0x0);if(_0x8ba3fa[_0x561a('0x10')][_0x13a04c]){_0x8ba3fa[_0x561a('0x10')][_0x13a04c]['emit'](_0x561a('0x42'));}return _0x5f31c2({'code':0xc8,'message':_0x274f1c});}catch(_0x1ce5cb){logger[_0x561a('0x34')](_0x1ce5cb[_0x561a('0x3c')]);return _0x20fea6(_0x6b40de['error'](0x1f4,_0x1ce5cb));}}logger[_0x561a('0x34')](_0x561a('0x47'));return _0x20fea6(_0x6b40de[_0x561a('0x34')](0x1f4,_0x561a('0x47')));});},'AgentCapacity':function(_0x4d5836){var _0xe38710=this;return new Promise(function(_0x1e21ff,_0x39c051){if(_0x8ba3fa[_0x561a('0x3f')]['hasOwnProperty'](_0x4d5836['id'])){for(var _0x27ca0a in _0x4d5836[_0x561a('0x48')]){if(_0x4d5836['capacity'][_0x561a('0x49')](_0x27ca0a)){if(_0x8ba3fa['agents'][_0x4d5836['id']]['hasOwnProperty'](_0x27ca0a+_0x561a('0x4a'))){_0x8ba3fa['agents'][_0x4d5836['id']][_0x27ca0a+_0x561a('0x4a')]=parseInt(_0x4d5836[_0x561a('0x48')][_0x27ca0a],0xa);}}}_0x8ba3fa[_0x561a('0x3f')][_0x4d5836['id']][_0x561a('0x4b')]();return _0x1e21ff({'code':0xc8,'message':_0x8ba3fa[_0x561a('0x3f')][_0x4d5836['id']]});}else{return _0x39c051(_0xe38710[_0x561a('0x34')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x29a5a8){return new Promise(function(_0x2ffad9){var _0x34a254=_[_0x561a('0x4c')](_0x8ba3fa[_0x561a('0x3f')]);if(_0x29a5a8&&_0x29a5a8['id']){var _0x408e9a=_[_0x561a('0x4d')](_0x34a254,function(_0xc9bb0a){return _0xc9bb0a['id']===_0x29a5a8['id'];});_0x2ffad9(_0x408e9a);}else{_0x2ffad9({'count':_0x34a254[_0x561a('0x1f')],'rows':_0x34a254});}});},'ChatQueues':function(){return new Promise(function(_0x1b4a7e){var _0x4d339d=[];for(var _0x30da72 in _0x8ba3fa[_0x561a('0x4e')]){if(_0x8ba3fa[_0x561a('0x4e')][_0x561a('0x49')](_0x30da72)){var _0x3cdd42=_0x8ba3fa[_0x561a('0x4e')][_0x30da72];var _0x34f35c={'id':_0x3cdd42['id'],'available':_0x3cdd42[_0x561a('0x4f')],'loggedIn':_0x3cdd42['loggedIn'],'name':_0x3cdd42[_0x561a('0x50')],'paused':_0x3cdd42[_0x561a('0x51')],'waiting':_0x3cdd42[_0x561a('0x52')]};_0x4d339d['push'](_0x34f35c);}}_0x1b4a7e({'count':_0x4d339d['length'],'rows':_0x4d339d});});},'MailQueues':function(){return new Promise(function(_0x43adfc){var _0x4a9cbe=[];for(var _0x2f50e9 in _0x8ba3fa[_0x561a('0x53')]){if(_0x8ba3fa[_0x561a('0x53')][_0x561a('0x49')](_0x2f50e9)){var _0x4b495d=_0x8ba3fa['mailQueues'][_0x2f50e9];var _0x5d60b6={'id':_0x4b495d['id'],'available':_0x4b495d[_0x561a('0x4f')],'loggedIn':_0x4b495d[_0x561a('0x54')],'name':_0x4b495d['name'],'paused':_0x4b495d[_0x561a('0x51')],'waiting':_0x4b495d['waiting']};_0x4a9cbe[_0x561a('0x1d')](_0x5d60b6);}}_0x43adfc({'count':_0x4a9cbe[_0x561a('0x1f')],'rows':_0x4a9cbe});});},'OpenchannelQueues':function(){return new Promise(function(_0x57e14b){var _0x53b19b=[];for(var _0x4c0e83 in _0x8ba3fa[_0x561a('0x55')]){if(_0x8ba3fa[_0x561a('0x55')][_0x561a('0x49')](_0x4c0e83)){var _0x181394=_0x8ba3fa[_0x561a('0x55')][_0x4c0e83];var _0x174ec6={'id':_0x181394['id'],'available':_0x181394[_0x561a('0x4f')],'loggedIn':_0x181394[_0x561a('0x54')],'name':_0x181394[_0x561a('0x50')],'paused':_0x181394[_0x561a('0x51')],'waiting':_0x181394[_0x561a('0x52')]};_0x53b19b[_0x561a('0x1d')](_0x174ec6);}}_0x57e14b({'count':_0x53b19b[_0x561a('0x1f')],'rows':_0x53b19b});});},'SmsQueues':function(){return new Promise(function(_0x55a925){var _0x17db59=[];for(var _0x104f84 in _0x8ba3fa[_0x561a('0x56')]){if(_0x8ba3fa[_0x561a('0x56')][_0x561a('0x49')](_0x104f84)){var _0x25af10=_0x8ba3fa['smsQueues'][_0x104f84];var _0x384b29={'id':_0x25af10['id'],'available':_0x25af10[_0x561a('0x4f')],'loggedIn':_0x25af10[_0x561a('0x54')],'name':_0x25af10[_0x561a('0x50')],'paused':_0x25af10[_0x561a('0x51')],'waiting':_0x25af10[_0x561a('0x52')]};_0x17db59['push'](_0x384b29);}}_0x55a925({'count':_0x17db59[_0x561a('0x1f')],'rows':_0x17db59});});},'FaxQueues':function(){return new Promise(function(_0x25ec86){var _0x349b98=[];for(var _0x1bd6c9 in _0x8ba3fa[_0x561a('0x57')]){if(_0x8ba3fa[_0x561a('0x57')][_0x561a('0x49')](_0x1bd6c9)){var _0x5148e3=_0x8ba3fa[_0x561a('0x57')][_0x1bd6c9];var _0x5e89ef={'id':_0x5148e3['id'],'available':_0x5148e3[_0x561a('0x4f')],'loggedIn':_0x5148e3[_0x561a('0x54')],'name':_0x5148e3[_0x561a('0x50')],'paused':_0x5148e3[_0x561a('0x51')],'waiting':_0x5148e3[_0x561a('0x52')]};_0x349b98['push'](_0x5e89ef);}}_0x25ec86({'count':_0x349b98[_0x561a('0x1f')],'rows':_0x349b98});});},'WhatsappQueues':function(){return new Promise(function(_0x1224a3){var _0x7e62f5=[];for(var _0xeb0024 in _0x8ba3fa[_0x561a('0x58')]){if(_0x8ba3fa[_0x561a('0x58')][_0x561a('0x49')](_0xeb0024)){var _0x59183b=_0x8ba3fa[_0x561a('0x58')][_0xeb0024];var _0x2e7f7a={'id':_0x59183b['id'],'available':_0x59183b[_0x561a('0x4f')],'loggedIn':_0x59183b[_0x561a('0x54')],'name':_0x59183b['name'],'paused':_0x59183b[_0x561a('0x51')],'waiting':_0x59183b['waiting']};_0x7e62f5[_0x561a('0x1d')](_0x2e7f7a);}}_0x1224a3({'count':_0x7e62f5[_0x561a('0x1f')],'rows':_0x7e62f5});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x94080c){var _0x4e9c8e=_[_0x561a('0x4c')](_0x8ba3fa[_0x561a('0x59')]);_0x94080c({'count':_0x4e9c8e[_0x561a('0x1f')],'rows':_0x4e9c8e});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x41d3ae){var _0x41110e=_['values'](_0x8ba3fa[_0x561a('0x5a')]);_0x41d3ae({'count':_0x41110e[_0x561a('0x1f')],'rows':_0x41110e});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x60ccc6){var _0x4dd7fc=_[_0x561a('0x4c')](_0x8ba3fa[_0x561a('0x5b')]);_0x60ccc6({'count':_0x4dd7fc[_0x561a('0x1f')],'rows':_0x4dd7fc});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3535e7){var _0x249f6d=_[_0x561a('0x4c')](_0x8ba3fa[_0x561a('0x5c')]);_0x3535e7({'count':_0x249f6d['length'],'rows':_0x249f6d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3c9ac3){var _0x46022e=_[_0x561a('0x4c')](_0x8ba3fa[_0x561a('0x5d')]);_0x3c9ac3({'count':_0x46022e[_0x561a('0x1f')],'rows':_0x46022e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x559285){var _0x1e800d=_['values'](_0x8ba3fa[_0x561a('0x5e')]);_0x559285({'count':_0x1e800d['length'],'rows':_0x1e800d});});}};var _0x3f000e=jayson[_0x561a('0x5f')](_0x3545c2)[_0x561a('0x60')]();_0x3f000e['on'](_0x561a('0x34'),function(_0x2bdc41){logger[_0x561a('0x34')](JSON[_0x561a('0x38')](_0x2bdc41));return _0x1731ac(_0x2bdc41);});_0x3f000e[_0x561a('0xf')](0x232c,_0x561a('0x61'),function(){console[_0x561a('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x164253(_0x561a('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 cd3183d..7ae8af0 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 _0xe390=['length','push','Command','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','stop','util','bluebird','lodash','../../../config/logger','client','request','error','message','result','catch','condition','rules','info'];(function(_0x49e67c,_0x269b2c){var _0x180cf2=function(_0x268f3c){while(--_0x268f3c){_0x49e67c['push'](_0x49e67c['shift']());}};_0x180cf2(++_0x269b2c);}(_0xe390,0x9b));var _0x0e39=function(_0x387845,_0x27712b){_0x387845=_0x387845-0x0;var _0x43c09e=_0xe390[_0x387845];return _0x43c09e;};'use strict';var util=require(_0x0e39('0x0'));var BPromise=require(_0x0e39('0x1'));var jayson=require('jayson/promise');var _=require(_0x0e39('0x2'));var logger=require(_0x0e39('0x3'))('routing');var client=jayson[_0x0e39('0x4')]['http']({'port':0x232a});function request(_0x26fbc2,_0x31d306){return new BPromise(function(_0x33bb13,_0x2efcf6){return client[_0x0e39('0x5')](_0x26fbc2,_0x31d306)['then'](function(_0x5b583d){if(_0x5b583d[_0x0e39('0x6')]){return _0x2efcf6(_0x5b583d['error'][_0x0e39('0x7')]);}else{return _0x33bb13(_0x5b583d[_0x0e39('0x8')]);}})[_0x0e39('0x9')](function(_0x2c7c98){return _0x2efcf6(_0x2c7c98);});});}exports[_0x0e39('0xa')]=function(_0x132107,_0x2a3569,_0xceae97){return function(_0x4d30fc){if(_0xceae97['rules']&&!_0xceae97[_0x0e39('0xb')][_0x132107]){logger[_0x0e39('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x132107);return _0x4d30fc['stop']();}var _0x40f8b9=[];for(var _0x1f32c5=0x0;_0x1f32c5<_0x2a3569[_0x0e39('0xd')];_0x1f32c5+=0x1){_0x40f8b9[_0x0e39('0xe')](request(_0x0e39('0xf'),{'command':util['format']('iftime\x20%s',_0x2a3569[_0x1f32c5])})[_0x0e39('0x10')](function(_0x4f628f){return _0x4f628f&&_0x4f628f[_0x0e39('0x7')]&&_0x4f628f[_0x0e39('0x7')][_0x0e39('0x11')](_0x0e39('0x12'))>=0x0?!![]:![];})[_0x0e39('0x9')](function(_0x49dce7){logger[_0x0e39('0x6')](_0x0e39('0x13'),_0x132107,_0x2a3569[_0x1f32c5]);}));}BPromise[_0x0e39('0x14')](_0x40f8b9)['then'](function(_0x26c2d4){var _0x4771a3=_[_0x0e39('0x15')](_0x26c2d4);logger['info'](_0x0e39('0x16'),_0x132107,_0x2a3569[_0x0e39('0x17')](_0x0e39('0x18')),_0x4771a3);_0x4d30fc[_0x0e39('0x19')](_0x4771a3);})['catch'](function(_0x4f9fb3){console['log'](_0x4f9fb3);logger[_0x0e39('0x6')](_0x0e39('0x16'),_0x132107,_0x2a3569[_0x0e39('0x17')](_0x0e39('0x18')),_0x4f9fb3[_0x0e39('0x1a')]);_0x4d30fc[_0x0e39('0x1b')]();});};}; \ No newline at end of file +var _0x5df9=['util','bluebird','jayson/promise','lodash','routing','client','http','request','then','error','catch','condition','rules','info','stop','push','Command','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0x5df9,0x122));var _0x95df=function(_0x4caf78,_0x389e8d){_0x4caf78=_0x4caf78-0x0;var _0x335527=_0x5df9[_0x4caf78];return _0x335527;};'use strict';var util=require(_0x95df('0x0'));var BPromise=require(_0x95df('0x1'));var jayson=require(_0x95df('0x2'));var _=require(_0x95df('0x3'));var logger=require('../../../config/logger')(_0x95df('0x4'));var client=jayson[_0x95df('0x5')][_0x95df('0x6')]({'port':0x232a});function request(_0x20a9e7,_0x588e91){return new BPromise(function(_0x549e2c,_0x37208e){return client[_0x95df('0x7')](_0x20a9e7,_0x588e91)[_0x95df('0x8')](function(_0x164236){if(_0x164236['error']){return _0x37208e(_0x164236[_0x95df('0x9')]['message']);}else{return _0x549e2c(_0x164236['result']);}})[_0x95df('0xa')](function(_0x2b31c8){return _0x37208e(_0x2b31c8);});});}exports[_0x95df('0xb')]=function(_0x4517d2,_0x5b8c7d,_0x2b7e8a){return function(_0x200f1a){if(_0x2b7e8a[_0x95df('0xc')]&&!_0x2b7e8a[_0x95df('0xc')][_0x4517d2]){logger[_0x95df('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4517d2);return _0x200f1a[_0x95df('0xe')]();}var _0x11fff5=[];for(var _0x45844d=0x0;_0x45844d<_0x5b8c7d['length'];_0x45844d+=0x1){_0x11fff5[_0x95df('0xf')](request(_0x95df('0x10'),{'command':util['format'](_0x95df('0x11'),_0x5b8c7d[_0x45844d])})[_0x95df('0x8')](function(_0x5aa3ec){return _0x5aa3ec&&_0x5aa3ec[_0x95df('0x12')]&&_0x5aa3ec[_0x95df('0x12')][_0x95df('0x13')](_0x95df('0x14'))>=0x0?!![]:![];})[_0x95df('0xa')](function(_0x49c319){logger[_0x95df('0x9')](_0x95df('0x15'),_0x4517d2,_0x5b8c7d[_0x45844d]);}));}BPromise[_0x95df('0x16')](_0x11fff5)['then'](function(_0x1eb750){var _0x5d8a56=_['some'](_0x1eb750);logger[_0x95df('0xd')](_0x95df('0x17'),_0x4517d2,_0x5b8c7d[_0x95df('0x18')](_0x95df('0x19')),_0x5d8a56);_0x200f1a[_0x95df('0x1a')](_0x5d8a56);})['catch'](function(_0x2d23ad){console[_0x95df('0x1b')](_0x2d23ad);logger[_0x95df('0x9')](_0x95df('0x17'),_0x4517d2,_0x5b8c7d[_0x95df('0x18')](_0x95df('0x19')),_0x2d23ad[_0x95df('0x1c')]);_0x200f1a[_0x95df('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index cfd3a51..c613f97 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 _0xbf6e=['[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','destuniqueid','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','holdtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','[%s][agents][hangup]','./utils','info','format'];(function(_0x26810f,_0x5c13c8){var _0x30b725=function(_0x5144a7){while(--_0x5144a7){_0x26810f['push'](_0x26810f['shift']());}};_0x30b725(++_0x5c13c8);}(_0xbf6e,0x149));var _0xebf6=function(_0x39a7bb,_0x3616b6){_0x39a7bb=_0x39a7bb-0x0;var _0x2e1027=_0xbf6e[_0x39a7bb];return _0x2e1027;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xebf6('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2b658d,_0x14bf01){utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x3'),_0x2b658d[_0xebf6('0x4')],_0x2b658d['channel'],_0x2b658d[_0xebf6('0x5')],_0x2b658d[_0xebf6('0x6')],_0x2b658d[_0xebf6('0x7')],_0x2b658d[_0xebf6('0x8')],_0x2b658d[_0xebf6('0x9')],_0x2b658d[_0xebf6('0xa')]));if(_0x2b658d[_0xebf6('0x5')]){utils['getVoiceQueueByName'](_0x2b658d[_0xebf6('0x5')])[_0xebf6('0xb')](function(_0x12ed12){if(_0x12ed12){_0x2b658d['type']=_0x12ed12[_0xebf6('0xc')];_0x2b658d[_0xebf6('0xd')]=_0x2b658d['agentcomplete']?_0x12ed12[_0xebf6('0xe')]:![];_0x2b658d[_0xebf6('0xf')]=_0x2b658d[_0xebf6('0xd')]?_0x12ed12[_0xebf6('0x10')]:0x0;}utils[_0xebf6('0x11')](_0xebf6('0x12'),_0x2b658d);});}else{utils['request'](_0xebf6('0x12'),_0x2b658d);}if(_0x14bf01){delete transfers[_0x2b658d[_0xebf6('0x4')]];}else{delete agents[_0x2b658d['destuniqueid']];}}exports[_0xebf6('0x13')]=function(_0x101a6c){try{utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x15'),_0x101a6c['uniqueid']),_0x101a6c);agents[_0x101a6c['destuniqueid']]=_0x101a6c;agents[_0x101a6c['destuniqueid']][_0xebf6('0x16')]=utils[_0xebf6('0x17')]();agents[_0x101a6c['destuniqueid']][_0xebf6('0xa')]=_0xebf6('0x18');agents[_0x101a6c[_0xebf6('0x19')]][_0xebf6('0x9')]=null;agents[_0x101a6c[_0xebf6('0x19')]][_0xebf6('0x1a')]=null;utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x1b'),_0x101a6c[_0xebf6('0x4')],agents[_0x101a6c['destuniqueid']]['membername'],_0x101a6c[_0xebf6('0x19')]));}catch(_0x38c9e3){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x15'),_0x101a6c[_0xebf6('0x4')]),_0x38c9e3);}};exports[_0xebf6('0x1d')]=function(_0x80f523){try{if(!_['isNil'](agents[_0x80f523[_0xebf6('0x19')]])){utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x1e'),_0x80f523[_0xebf6('0x4')]),_0x80f523);utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x1f'),_0x80f523[_0xebf6('0x4')],agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x6')],_0x80f523[_0xebf6('0x19')]));agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x1d')]=!![];agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x20')]=utils[_0xebf6('0x17')]();agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0xa')]='timeout';agents[_0x80f523['destuniqueid']][_0xebf6('0x21')]='timeout';agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x22')]=_0x80f523['ringtime']?parseInt(_0x80f523['ringtime'])/0x3e8:0x0;agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x23')]=0x0;unanswered[_0xebf6('0x24')](_0x80f523[_0xebf6('0x19')]);}}catch(_0xedaaeb){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x1e'),_0x80f523['uniqueid']),_0xedaaeb);}};exports[_0xebf6('0x25')]=function(_0x78cdf0){try{_['forIn'](agents,function(_0x2fe3ee,_0x28bbea){if(_0x2fe3ee['uniqueid']==_0x78cdf0[_0xebf6('0x4')]&&!_[_0xebf6('0x26')](unanswered,_0x2fe3ee[_0xebf6('0x19')])){utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x27'),_0x78cdf0['uniqueid']),_0x78cdf0);utils[_0xebf6('0x1')](util[_0xebf6('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x78cdf0['uniqueid'],_0x2fe3ee[_0xebf6('0x6')],_0x2fe3ee[_0xebf6('0x19')]));_0x2fe3ee['agentringnoanswer']=!![];_0x2fe3ee[_0xebf6('0x20')]=utils[_0xebf6('0x17')]();_0x2fe3ee['lastevent']=_0xebf6('0x28');_0x2fe3ee[_0xebf6('0x21')]=_0xebf6('0x28');_0x2fe3ee['holdtime']=_0x78cdf0[_0xebf6('0x22')];_0x2fe3ee[_0xebf6('0x23')]=0x0;writeDB(_0x2fe3ee);}});}catch(_0xed3a5b){utils[_0xebf6('0x1c')](util['format']('[%s][agents][queuecallerabandon]',_0x78cdf0[_0xebf6('0x4')]),_0xed3a5b);}};exports[_0xebf6('0x29')]=function(_0x562f76){try{if(agents[_0x562f76[_0xebf6('0x19')]]){utils[_0xebf6('0x14')](util['format'](_0xebf6('0x2a'),_0x562f76[_0xebf6('0x4')]),_0x562f76);utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x2b'),_0x562f76['uniqueid'],agents[_0x562f76[_0xebf6('0x19')]]['membername'],_0x562f76[_0xebf6('0x19')]));agents[_0x562f76['destuniqueid']][_0xebf6('0x2c')]=utils[_0xebf6('0x17')]();agents[_0x562f76[_0xebf6('0x19')]][_0xebf6('0x9')]=_0x562f76[_0xebf6('0x9')];agents[_0x562f76[_0xebf6('0x19')]]['connectedlinename']=_0x562f76[_0xebf6('0x1a')];agents[_0x562f76[_0xebf6('0x19')]][_0xebf6('0x22')]=_0x562f76[_0xebf6('0x2d')];agents[_0x562f76[_0xebf6('0x19')]][_0xebf6('0xa')]='connect';_[_0xebf6('0x2e')](agents,function(_0x2782a5,_0x3f8502){if(_0x2782a5[_0xebf6('0x19')]!=_0x562f76[_0xebf6('0x19')]&&_0x2782a5[_0xebf6('0x4')]==_0x562f76['uniqueid']){_0x2782a5['talktime']=0x0;_0x2782a5['holdtime']=_0x562f76[_0xebf6('0x2d')];_0x2782a5[_0xebf6('0x1d')]=!![];_0x2782a5[_0xebf6('0x20')]=utils['now']();_0x2782a5[_0xebf6('0xa')]=_0xebf6('0x2f');_0x2782a5[_0xebf6('0x21')]='answered_elsewhere';_0x2782a5[_0xebf6('0x30')]=_0x562f76[_0xebf6('0x19')];_0x2782a5['answeredelsewheremembername']=_0x562f76[_0xebf6('0x6')];writeDB(_0x2782a5);}});}}catch(_0x1de50e){utils[_0xebf6('0x1c')](util['format'](_0xebf6('0x2a'),_0x562f76['uniqueid']),_0x1de50e);}};exports['agentcomplete']=function(_0x256552){try{if(!_[_0xebf6('0x31')](agents[_0x256552[_0xebf6('0x19')]])){utils[_0xebf6('0x14')](util['format'](_0xebf6('0x32'),_0x256552['uniqueid']),_0x256552);utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x33'),_0x256552[_0xebf6('0x4')],agents[_0x256552[_0xebf6('0x19')]]['membername'],_0x256552['destuniqueid']));agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x34')]=!![];agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x35')]=utils['now']();agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x23')]=utils[_0xebf6('0x36')](agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x35')],agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x2c')]);agents[_0x256552['destuniqueid']][_0xebf6('0x21')]=_0x256552[_0xebf6('0x21')];agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0xa')]=_0xebf6('0x37');writeDB(agents[_0x256552[_0xebf6('0x19')]]);}}catch(_0x250cf4){utils['error'](util[_0xebf6('0x2')]('[%s][agents][agentcomplete]',_0x256552[_0xebf6('0x4')]),_0x250cf4);}};exports[_0xebf6('0x38')]=function(_0x5d84ac){try{if(!_[_0xebf6('0x31')](agents[_0x5d84ac['transfereruniqueid']])){utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x39'),_0x5d84ac[_0xebf6('0x4')]),_0x5d84ac);utils[_0xebf6('0x1')](util['format'](_0xebf6('0x3a'),_0x5d84ac[_0xebf6('0x4')],agents[_0x5d84ac['transfereruniqueid']][_0xebf6('0x6')],agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x4')]));agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x3c')]=!![];agents[_0x5d84ac['transfereruniqueid']][_0xebf6('0x3d')]=_0xebf6('0x3e');agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x3f')]=_0x5d84ac['extension'];agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x40')]=agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x4')];}}catch(_0x16abac){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x39'),_0x5d84ac[_0xebf6('0x4')]),_0x16abac);}};exports['attendedtransfer']=function(_0x22c3ad){try{utils[_0xebf6('0x14')](util[_0xebf6('0x2')]('[%s][agents][attendedtransfer]',_0x22c3ad[_0xebf6('0x41')]),_0x22c3ad);if(_0x22c3ad['origtransfereruniqueid']==_0x22c3ad['origtransfererlinkedid']){if(!_[_0xebf6('0x31')](agents[_0x22c3ad[_0xebf6('0x42')]])){utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x43'),_0x22c3ad['origtransfereruniqueid'],agents[_0x22c3ad[_0xebf6('0x42')]]['membername']));agents[_0x22c3ad['secondtransfereruniqueid']]['transfer']=!![];agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x3d')]='ATTENDED';agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x3f')]=_0x22c3ad[_0xebf6('0x44')];agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x40')]=_0x22c3ad[_0xebf6('0x41')];}if(_0x22c3ad[_0xebf6('0x45')]&&agents[_0x22c3ad['transfereeuniqueid']]){agents[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x46')]=0x1;transfers[_0x22c3ad[_0xebf6('0x45')]]=_[_0xebf6('0x47')](agents[_0x22c3ad[_0xebf6('0x45')]]);transfers[_0x22c3ad[_0xebf6('0x45')]]['calleridnum']=agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x8')];transfers[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x48')]=agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x48')];transfers[_0x22c3ad['transfereeuniqueid']][_0xebf6('0x16')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x2c')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad['transfereeuniqueid']][_0xebf6('0x22')]=0x0;transfers[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x46')]=0x2;}}else if(_0x22c3ad[_0xebf6('0x42')]==_0x22c3ad[_0xebf6('0x49')]){if(!_[_0xebf6('0x31')](agents[_0x22c3ad[_0xebf6('0x41')]])){utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x43'),_0x22c3ad[_0xebf6('0x41')],agents[_0x22c3ad['origtransfereruniqueid']][_0xebf6('0x6')]));agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x3c')]=!![];agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x3d')]=_0xebf6('0x4a');agents[_0x22c3ad['origtransfereruniqueid']][_0xebf6('0x3f')]=_0x22c3ad['secondtransfererexten'];agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x40')]=_0x22c3ad[_0xebf6('0x42')];}if(_0x22c3ad[_0xebf6('0x4b')]&&agents[_0x22c3ad[_0xebf6('0x4b')]]){agents[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x46')]=0x1;transfers[_0x22c3ad['transfertargetuniqueid']]=_['clone'](agents[_0x22c3ad[_0xebf6('0x4b')]]);transfers[_0x22c3ad[_0xebf6('0x4b')]]['calleridnum']=agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x8')];transfers[_0x22c3ad['transfertargetuniqueid']][_0xebf6('0x48')]=agents[_0x22c3ad[_0xebf6('0x41')]]['calleridname'];transfers[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x16')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x2c')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad[_0xebf6('0x4b')]]['holdtime']=0x0;transfers[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x46')]=0x2;}}}catch(_0x26d338){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x4c'),_0x22c3ad[_0xebf6('0x41')]),_0x26d338);}};exports[_0xebf6('0x4d')]=function(_0x3bc43){try{utils[_0xebf6('0x14')](util['format']('[%s][agents][hangup]',_0x3bc43[_0xebf6('0x4')]),_0x3bc43);if(agents[_0x3bc43[_0xebf6('0x4')]]&&agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')]==='timeout'){if(_0x3bc43[_0xebf6('0x4e')]==='21'){agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')]=_0xebf6('0x4f');agents[_0x3bc43['uniqueid']]['lastevent']='rejected';}utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x50'),_0x3bc43[_0xebf6('0x4')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x6')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')],agents[_0x3bc43['uniqueid']][_0xebf6('0xa')]));writeDB(agents[_0x3bc43[_0xebf6('0x4')]]);var _0x50169c=unanswered['indexOf'](_0x3bc43[_0xebf6('0x4')]);if(_0x50169c>-0x1){unanswered['splice'](_0x50169c,0x1);}}if(transfers[_0x3bc43[_0xebf6('0x4')]]){transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x34')]=!![];transfers[_0x3bc43['uniqueid']][_0xebf6('0x35')]=utils[_0xebf6('0x17')]();transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x23')]=utils[_0xebf6('0x36')](transfers[_0x3bc43[_0xebf6('0x4')]]['agentcompleteAt'],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x2c')]);transfers[_0x3bc43['uniqueid']][_0xebf6('0x21')]=_0xebf6('0x51');transfers[_0x3bc43[_0xebf6('0x4')]]['lastevent']=_0xebf6('0x37');utils[_0xebf6('0x1')](util['format'](_0xebf6('0x50'),_0x3bc43[_0xebf6('0x4')],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x6')],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0xa')]));writeDB(transfers[_0x3bc43[_0xebf6('0x4')]],!![]);}if(agents[_0x3bc43[_0xebf6('0x4')]]&&agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x2c')]){agents[_0x3bc43[_0xebf6('0x4')]]['agentcomplete']=!![];agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x35')]=utils[_0xebf6('0x17')]();agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x23')]=utils[_0xebf6('0x36')](agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x35')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x2c')]);agents[_0x3bc43['uniqueid']]['reason']=agents[_0x3bc43[_0xebf6('0x4')]]['transfer']?_0xebf6('0x3c'):_0xebf6('0x51');agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0xa')]=_0xebf6('0x37');utils['info'](util[_0xebf6('0x2')](_0xebf6('0x50'),_0x3bc43['uniqueid'],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x6')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')],agents[_0x3bc43[_0xebf6('0x4')]]['lastevent']));writeDB(agents[_0x3bc43['uniqueid']]);}}catch(_0x1b245d){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x52'),_0x3bc43[_0xebf6('0x4')]),_0x1b245d);}}; \ No newline at end of file +var _0x84a0=['transferexten','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','complete','lodash','util','./utils','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','timeout','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x84a0,0x66));var _0x084a=function(_0x1b9aa1,_0x3454cf){_0x1b9aa1=_0x1b9aa1-0x0;var _0x149c8f=_0x84a0[_0x1b9aa1];return _0x149c8f;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var utils=require(_0x084a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fff7f,_0x483bfa){utils[_0x084a('0x3')](util[_0x084a('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1fff7f['uniqueid'],_0x1fff7f[_0x084a('0x5')],_0x1fff7f[_0x084a('0x6')],_0x1fff7f['membername'],_0x1fff7f[_0x084a('0x7')],_0x1fff7f[_0x084a('0x8')],_0x1fff7f[_0x084a('0x9')],_0x1fff7f[_0x084a('0xa')]));if(_0x1fff7f[_0x084a('0x6')]){utils['getVoiceQueueByName'](_0x1fff7f[_0x084a('0x6')])[_0x084a('0xb')](function(_0x8198ad){if(_0x8198ad){_0x1fff7f[_0x084a('0xc')]=_0x8198ad[_0x084a('0xc')];_0x1fff7f['agentacw']=_0x1fff7f['agentcomplete']?_0x8198ad[_0x084a('0xd')]:![];_0x1fff7f[_0x084a('0xe')]=_0x1fff7f[_0x084a('0xf')]?_0x8198ad[_0x084a('0x10')]:0x0;}utils[_0x084a('0x11')]('CreateVoiceAgentReport',_0x1fff7f);});}else{utils['request'](_0x084a('0x12'),_0x1fff7f);}if(_0x483bfa){delete transfers[_0x1fff7f[_0x084a('0x13')]];}else{delete agents[_0x1fff7f[_0x084a('0x14')]];}}exports[_0x084a('0x15')]=function(_0x1bdfb8){try{utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8['uniqueid']),_0x1bdfb8);agents[_0x1bdfb8[_0x084a('0x14')]]=_0x1bdfb8;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x18')]=utils[_0x084a('0x19')]();agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x1a');agents[_0x1bdfb8['destuniqueid']][_0x084a('0x9')]=null;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x1b')]=null;utils[_0x084a('0x3')](util['format'](_0x084a('0x1c'),_0x1bdfb8[_0x084a('0x13')],agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0x1d')],_0x1bdfb8[_0x084a('0x14')]));}catch(_0x145636){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8[_0x084a('0x13')]),_0x145636);}};exports[_0x084a('0x1f')]=function(_0x279e25){try{if(!_[_0x084a('0x20')](agents[_0x279e25[_0x084a('0x14')]])){utils[_0x084a('0x16')](util['format'](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x279e25);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x22'),_0x279e25['uniqueid'],agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1d')],_0x279e25[_0x084a('0x14')]));agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1f')]=!![];agents[_0x279e25[_0x084a('0x14')]]['agentringnoanswerAt']=utils[_0x084a('0x19')]();agents[_0x279e25[_0x084a('0x14')]][_0x084a('0xa')]='timeout';agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x23')]=_0x084a('0x24');agents[_0x279e25['destuniqueid']]['holdtime']=_0x279e25['ringtime']?parseInt(_0x279e25['ringtime'])/0x3e8:0x0;agents[_0x279e25[_0x084a('0x14')]]['talktime']=0x0;unanswered['push'](_0x279e25['destuniqueid']);}}catch(_0x3b8176){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x3b8176);}};exports[_0x084a('0x25')]=function(_0x378de6){try{_[_0x084a('0x26')](agents,function(_0x5e6ea8,_0x2ed3cd){if(_0x5e6ea8[_0x084a('0x13')]==_0x378de6['uniqueid']&&!_[_0x084a('0x27')](unanswered,_0x5e6ea8[_0x084a('0x14')])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x378de6);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x29'),_0x378de6[_0x084a('0x13')],_0x5e6ea8[_0x084a('0x1d')],_0x5e6ea8[_0x084a('0x14')]));_0x5e6ea8[_0x084a('0x1f')]=!![];_0x5e6ea8['agentringnoanswerAt']=utils['now']();_0x5e6ea8[_0x084a('0xa')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x23')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x2b')]=_0x378de6['holdtime'];_0x5e6ea8[_0x084a('0x2c')]=0x0;writeDB(_0x5e6ea8);}});}catch(_0x1b56ad){utils[_0x084a('0x1e')](util['format'](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x1b56ad);}};exports[_0x084a('0x2d')]=function(_0x4c4c90){try{if(agents[_0x4c4c90['destuniqueid']]){utils['debug'](util[_0x084a('0x4')](_0x084a('0x2e'),_0x4c4c90[_0x084a('0x13')]),_0x4c4c90);utils['info'](util[_0x084a('0x4')](_0x084a('0x2f'),_0x4c4c90[_0x084a('0x13')],agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1d')],_0x4c4c90[_0x084a('0x14')]));agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x9')]=_0x4c4c90[_0x084a('0x9')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1b')]=_0x4c4c90[_0x084a('0x1b')];agents[_0x4c4c90['destuniqueid']][_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x32');_[_0x084a('0x26')](agents,function(_0xa7b652,_0x183e10){if(_0xa7b652[_0x084a('0x14')]!=_0x4c4c90['destuniqueid']&&_0xa7b652[_0x084a('0x13')]==_0x4c4c90[_0x084a('0x13')]){_0xa7b652[_0x084a('0x2c')]=0x0;_0xa7b652[_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];_0xa7b652[_0x084a('0x1f')]=!![];_0xa7b652['agentringnoanswerAt']=utils[_0x084a('0x19')]();_0xa7b652[_0x084a('0xa')]='answered_elsewhere';_0xa7b652[_0x084a('0x23')]=_0x084a('0x33');_0xa7b652[_0x084a('0x34')]=_0x4c4c90['destuniqueid'];_0xa7b652[_0x084a('0x35')]=_0x4c4c90[_0x084a('0x1d')];writeDB(_0xa7b652);}});}}catch(_0x4fe9c2){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentconnect]',_0x4c4c90['uniqueid']),_0x4fe9c2);}};exports[_0x084a('0x36')]=function(_0x17a8d4){try{if(!_[_0x084a('0x20')](agents[_0x17a8d4[_0x084a('0x14')]])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x37'),_0x17a8d4[_0x084a('0x13')]),_0x17a8d4);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x38'),_0x17a8d4['uniqueid'],agents[_0x17a8d4['destuniqueid']][_0x084a('0x1d')],_0x17a8d4[_0x084a('0x14')]));agents[_0x17a8d4[_0x084a('0x14')]]['agentcomplete']=!![];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x2c')]=utils['diffTime'](agents[_0x17a8d4[_0x084a('0x14')]]['agentcompleteAt'],agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x30')]);agents[_0x17a8d4[_0x084a('0x14')]]['reason']=_0x17a8d4['reason'];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0xa')]='complete';writeDB(agents[_0x17a8d4[_0x084a('0x14')]]);}}catch(_0x2c2c2e){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentcomplete]',_0x17a8d4[_0x084a('0x13')]),_0x2c2c2e);}};exports[_0x084a('0x3a')]=function(_0x31677b){try{if(!_[_0x084a('0x20')](agents[_0x31677b['transfereruniqueid']])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x31677b);utils['info'](util['format'](_0x084a('0x3c'),_0x31677b[_0x084a('0x13')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x1d')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')]));agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3e')]=!![];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3f')]=_0x084a('0x40');agents[_0x31677b[_0x084a('0x3d')]]['transferexten']=_0x31677b[_0x084a('0x41')];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x42')]=agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')];}}catch(_0x1c972c){utils[_0x084a('0x1e')](util['format'](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x1c972c);}};exports[_0x084a('0x43')]=function(_0x54aa6c){try{utils['debug'](util[_0x084a('0x4')]('[%s][agents][attendedtransfer]',_0x54aa6c[_0x084a('0x44')]),_0x54aa6c);if(_0x54aa6c[_0x084a('0x44')]==_0x54aa6c['origtransfererlinkedid']){if(!_[_0x084a('0x20')](agents[_0x54aa6c['secondtransfereruniqueid']])){utils['info'](util[_0x084a('0x4')](_0x084a('0x45'),_0x54aa6c[_0x084a('0x44')],agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x1d')]));agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x3e')]=!![];agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c[_0x084a('0x46')]]['transferexten']=_0x54aa6c[_0x084a('0x48')];agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x44')];}if(_0x54aa6c['transfereeuniqueid']&&agents[_0x54aa6c[_0x084a('0x49')]]){agents[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x1;transfers[_0x54aa6c[_0x084a('0x49')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfereeuniqueid']]);transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x46')]]['calleridnum'];transfers[_0x54aa6c[_0x084a('0x49')]]['calleridname']=agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x4c')];transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x18')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x2;}}else if(_0x54aa6c[_0x084a('0x46')]==_0x54aa6c[_0x084a('0x4d')]){if(!_['isNil'](agents[_0x54aa6c[_0x084a('0x44')]])){utils[_0x084a('0x3')](util['format'](_0x084a('0x45'),_0x54aa6c['origtransfereruniqueid'],agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x1d')]));agents[_0x54aa6c['origtransfereruniqueid']]['transfer']=!![];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x4e')]=_0x54aa6c[_0x084a('0x4f')];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x46')];}if(_0x54aa6c[_0x084a('0x50')]&&agents[_0x54aa6c[_0x084a('0x50')]]){agents[_0x54aa6c['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x54aa6c[_0x084a('0x50')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfertargetuniqueid']]);transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x8')];transfers[_0x54aa6c['transfertargetuniqueid']][_0x084a('0x4c')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x4c')];transfers[_0x54aa6c['transfertargetuniqueid']]['agentcalledAt']=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c[_0x084a('0x50')]]['agententerreason']=0x2;}}}catch(_0x22efb6){utils['error'](util['format'](_0x084a('0x51'),_0x54aa6c[_0x084a('0x44')]),_0x22efb6);}};exports[_0x084a('0x52')]=function(_0x4a2745){try{utils[_0x084a('0x16')](util['format'](_0x084a('0x53'),_0x4a2745[_0x084a('0x13')]),_0x4a2745);if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]===_0x084a('0x24')){if(_0x4a2745['cause']==='21'){agents[_0x4a2745['uniqueid']][_0x084a('0x23')]=_0x084a('0x54');agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]=_0x084a('0x54');}utils[_0x084a('0x3')](util['format'](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]]['lastevent']));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);var _0x38b5b6=unanswered[_0x084a('0x56')](_0x4a2745[_0x084a('0x13')]);if(_0x38b5b6>-0x1){unanswered[_0x084a('0x57')](_0x38b5b6,0x1);}}if(transfers[_0x4a2745[_0x084a('0x13')]]){transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils['now']();transfers[_0x4a2745['uniqueid']]['talktime']=utils[_0x084a('0x58')](transfers[_0x4a2745[_0x084a('0x13')]]['agentcompleteAt'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x30')]);transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]='agent';transfers[_0x4a2745['uniqueid']][_0x084a('0xa')]=_0x084a('0x59');utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],transfers[_0x4a2745[_0x084a('0x13')]]['membername'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(transfers[_0x4a2745[_0x084a('0x13')]],!![]);}if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']){agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x2c')]=utils[_0x084a('0x58')](agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')],agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']);agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]=agents[_0x4a2745['uniqueid']][_0x084a('0x3e')]?'transfer':'agent';agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]='complete';utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);}}catch(_0x7c85e3){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x53'),_0x4a2745['uniqueid']),_0x7c85e3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 834d129..3d29278 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 _0x2842=['./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','[%s][calls][newstate]','isNil','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','callerid','calleridname','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','noop','execif','util','./utils'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0x2842,0x1ba));var _0x2284=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2842[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x2284('0x0'));var utils=require(_0x2284('0x1'));var transfers=require(_0x2284('0x2'));var dispositions=[_0x2284('0x3'),_0x2284('0x4'),'FAILED',_0x2284('0x3'),_0x2284('0x3'),'NO\x20ANSWER',_0x2284('0x5'),_0x2284('0x6'),_0x2284('0x4'),_0x2284('0x4'),_0x2284('0x4')];var channels={};function writeDB(_0x2f43bf){var _0x4f9375;if(transfers[_0x2284('0x7')][_0x2f43bf['uniqueid']]){_0x4f9375=_0x2f43bf[_0x2284('0x8')];_0x2f43bf[_0x2284('0x8')]=transfers[_0x2284('0x7')][_0x2f43bf['uniqueid']][_0x2284('0x9')];}utils['info'](util[_0x2284('0xa')](_0x2284('0xb'),_0x2f43bf[_0x2284('0x8')],_0x2f43bf[_0x2284('0xc')],_0x2f43bf[_0x2284('0xd')],_0x2f43bf[_0x2284('0xe')],_0x2f43bf[_0x2284('0xf')],_0x2f43bf['calleridnum'],_0x2f43bf[_0x2284('0x10')],_0x2f43bf['lastevent']));if(_0x2f43bf[_0x2284('0x11')]){utils[_0x2284('0x12')](_0x2f43bf[_0x2284('0x11')])[_0x2284('0x13')](function(_0x56b45b){if(_0x56b45b){_0x2f43bf[_0x2284('0x14')]=_0x56b45b['id'];}utils[_0x2284('0x15')]('CreateVoiceCallReport',_0x2f43bf);});}else{utils[_0x2284('0x15')]('CreateVoiceCallReport',_0x2f43bf);}if(channels[_0x2f43bf['uniqueid']]){delete channels[_0x2f43bf[_0x2284('0x8')]];}else if(_0x4f9375&&channels[_0x4f9375]){if(!transfers[_0x2284('0x7')][_0x4f9375][_0x2284('0x16')])delete transfers[_0x2284('0x7')][_0x4f9375];delete channels[_0x4f9375];}}exports[_0x2284('0x17')]=function(_0x578eff){try{utils[_0x2284('0x18')](util[_0x2284('0xa')](_0x2284('0x19'),_0x578eff['uniqueid']),_0x578eff);if(_0x578eff[_0x2284('0x8')]==_0x578eff[_0x2284('0x1a')]&&_0x578eff[_0x2284('0xc')]!=_0x2284('0x1b')){utils['info'](util[_0x2284('0xa')](_0x2284('0x1c'),_0x578eff['uniqueid'],_0x578eff[_0x2284('0x1d')],_0x578eff['exten']));channels[_0x578eff[_0x2284('0x8')]]={'uniqueid':_0x578eff['uniqueid'],'accountcode':_0x578eff[_0x2284('0x11')],'source':_0x578eff['calleridnum'],'destination':_0x578eff[_0x2284('0x1e')],'destinationcontext':_0x578eff[_0x2284('0x1d')],'channel':_0x578eff[_0x2284('0xc')],'starttime':utils[_0x2284('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2284('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x3e8f59){utils[_0x2284('0x20')](util[_0x2284('0xa')](_0x2284('0x19'),_0x578eff[_0x2284('0x8')]),_0x3e8f59);}};exports['newstate']=function(_0x23e6f8){try{utils[_0x2284('0x18')](util[_0x2284('0xa')](_0x2284('0x21'),_0x23e6f8[_0x2284('0x8')]),_0x23e6f8);if(!_[_0x2284('0x22')](channels[_0x23e6f8[_0x2284('0x8')]])&&_0x23e6f8[_0x2284('0x23')]==0x6){utils[_0x2284('0x24')](util['format'](_0x2284('0x25'),_0x23e6f8[_0x2284('0x8')],_0x23e6f8[_0x2284('0x1d')],_0x23e6f8[_0x2284('0xc')]));if(_[_0x2284('0x22')](channels[_0x23e6f8[_0x2284('0x8')]]['systemanswertime'])){channels[_0x23e6f8[_0x2284('0x8')]][_0x2284('0x26')]=utils['now']();}}else if(!_[_0x2284('0x22')](channels[_0x23e6f8[_0x2284('0x1a')]])&&_0x23e6f8[_0x2284('0x23')]==0x6&&_0x23e6f8[_0x2284('0x1d')]!='transfer'){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x27'),_0x23e6f8[_0x2284('0x8')],_0x23e6f8[_0x2284('0x1a')],_0x23e6f8['context'],_0x23e6f8[_0x2284('0xc')]));channels[_0x23e6f8[_0x2284('0x1a')]][_0x2284('0x11')]=_0x23e6f8[_0x2284('0x11')];channels[_0x23e6f8[_0x2284('0x1a')]][_0x2284('0x28')]=_0x23e6f8[_0x2284('0xc')];if(_[_0x2284('0x22')](channels[_0x23e6f8[_0x2284('0x1a')]][_0x2284('0x29')])){channels[_0x23e6f8['linkedid']][_0x2284('0x29')]=utils['now']();}channels[_0x23e6f8[_0x2284('0x1a')]]['disposition']=dispositions[_[_0x2284('0x2a')](_0x23e6f8[_0x2284('0x23')])]||_0x2284('0x5');}}catch(_0x1d5b75){utils[_0x2284('0x20')](util[_0x2284('0xa')](_0x2284('0x21'),_0x23e6f8[_0x2284('0x8')]),_0x1d5b75);}};exports[_0x2284('0x2b')]=function(_0x39e489){try{if(!_[_0x2284('0x22')](channels[_0x39e489[_0x2284('0x8')]])){utils[_0x2284('0x18')](util[_0x2284('0xa')]('[%s][calls][hangup]',_0x39e489[_0x2284('0x8')]),_0x39e489);if(_[_0x2284('0x22')](channels[_0x39e489['uniqueid']][_0x2284('0x2c')])){channels[_0x39e489[_0x2284('0x8')]]['callerid']=_0x39e489[_0x2284('0x2d')]+'\x20<'+_0x39e489[_0x2284('0x2e')]+'>';}utils[_0x2284('0x24')](util['format'](_0x2284('0x2f'),_0x39e489[_0x2284('0x8')],channels[_0x39e489[_0x2284('0x8')]][_0x2284('0x2c')],_0x39e489[_0x2284('0x30')]));channels[_0x39e489[_0x2284('0x8')]][_0x2284('0x31')]=utils[_0x2284('0x1f')]();channels[_0x39e489[_0x2284('0x8')]][_0x2284('0x32')]=utils[_0x2284('0x33')](channels[_0x39e489['uniqueid']][_0x2284('0x31')],channels[_0x39e489['uniqueid']][_0x2284('0x34')]);channels[_0x39e489[_0x2284('0x8')]][_0x2284('0x35')]=channels[_0x39e489['uniqueid']][_0x2284('0x29')]?utils['diffTime'](channels[_0x39e489[_0x2284('0x8')]][_0x2284('0x31')],channels[_0x39e489['uniqueid']][_0x2284('0x29')]):0x0;writeDB(channels[_0x39e489['uniqueid']]);}}catch(_0x5621d5){utils[_0x2284('0x20')](util[_0x2284('0xa')](_0x2284('0x36'),_0x39e489[_0x2284('0x8')]),_0x5621d5);}};exports[_0x2284('0x37')]=function(_0x5912ef){try{if(!_['isNil'](channels[_0x5912ef[_0x2284('0x38')]])){utils[_0x2284('0x18')](util[_0x2284('0xa')](_0x2284('0x39'),_0x5912ef[_0x2284('0x3a')]),_0x5912ef);if(channels[_0x5912ef[_0x2284('0x38')]][_0x2284('0xc')]==_0x5912ef[_0x2284('0x3b')]){utils['info'](util[_0x2284('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5912ef[_0x2284('0x3a')],_0x5912ef[_0x2284('0x38')],_0x5912ef[_0x2284('0x3c')]));channels[_0x5912ef[_0x2284('0x38')]][_0x2284('0x28')]=_0x5912ef[_0x2284('0x3c')];channels[_0x5912ef['localtwolinkedid']][_0x2284('0x3d')]='_attended';}else if(channels[_0x5912ef[_0x2284('0x38')]][_0x2284('0xc')]=_0x5912ef[_0x2284('0x3e')]){utils[_0x2284('0x24')](util['format'](_0x2284('0x3f'),_0x5912ef[_0x2284('0x3a')],_0x5912ef[_0x2284('0x38')],_0x5912ef['origtransfererchannel']));channels[_0x5912ef[_0x2284('0x38')]][_0x2284('0x28')]=_0x5912ef['origtransfererchannel'];channels[_0x5912ef[_0x2284('0x38')]]['userfield']=_0x2284('0x40');}}}catch(_0x5d9ef0){utils[_0x2284('0x20')](util['format'](_0x2284('0x39'),_0x5912ef[_0x2284('0x3a')]),_0x5d9ef0);}};exports['musiconholdstart']=function(_0x414a87){try{if(!_['isNil'](channels[_0x414a87['uniqueid']])){utils[_0x2284('0x18')](util['format'](_0x2284('0x41'),_0x414a87[_0x2284('0x8')]),_0x414a87);channels[_0x414a87[_0x2284('0x8')]][_0x2284('0x42')]=utils[_0x2284('0x1f')]();utils[_0x2284('0x24')](util['format'](_0x2284('0x43'),_0x414a87[_0x2284('0x8')],channels[_0x414a87[_0x2284('0x8')]][_0x2284('0x42')]));}}catch(_0x4e33c1){utils[_0x2284('0x20')](util['format'](_0x2284('0x41'),_0x414a87['uniqueid']),_0x4e33c1);}};exports['musiconholdstop']=function(_0xeecfae){try{if(!_['isNil'](channels[_0xeecfae['uniqueid']])){utils[_0x2284('0x18')](util[_0x2284('0xa')](_0x2284('0x44'),_0xeecfae[_0x2284('0x8')]),_0xeecfae);if(!_[_0x2284('0x22')](channels[_0xeecfae[_0x2284('0x8')]][_0x2284('0x42')])){channels[_0xeecfae[_0x2284('0x8')]][_0x2284('0x45')]+=utils['diffTime'](utils[_0x2284('0x1f')](),channels[_0xeecfae[_0x2284('0x8')]][_0x2284('0x42')]);utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x46'),_0xeecfae[_0x2284('0x8')],channels[_0xeecfae[_0x2284('0x8')]][_0x2284('0x45')]));delete channels[_0xeecfae['uniqueid']]['musiconholdstartAt'];}}}catch(_0x489bb1){utils[_0x2284('0x20')](util['format'](_0x2284('0x44'),_0xeecfae[_0x2284('0x8')]),_0x489bb1);}};exports[_0x2284('0x47')]=function(_0x5758ad){try{if(!_[_0x2284('0x22')](channels[_0x5758ad['uniqueid']])){utils[_0x2284('0x18')](util[_0x2284('0xa')]('[%s][calls][varset]',_0x5758ad['uniqueid']),_0x5758ad);if(!_[_0x2284('0x22')](_0x5758ad['variable'][_0x2284('0x48')])){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x49'),_0x5758ad['uniqueid'],_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad[_0x2284('0x8')]]['source']=_0x5758ad[_0x2284('0x4a')];}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x4c')])){utils['info'](util[_0x2284('0xa')](_0x2284('0x4d'),_0x5758ad[_0x2284('0x8')],_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x4e')]=_0x5758ad[_0x2284('0x4a')];channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x2c')]='\x22'+_0x5758ad[_0x2284('0x4a')]+_0x2284('0x4f')+_0x5758ad[_0x2284('0x4a')]+'>';}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x50')])||!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x51')])){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x52'),_0x5758ad[_0x2284('0x8')],!_['isNil'](_0x5758ad[_0x2284('0x4b')]['xmd-callerid-preview'])?_0x2284('0x50'):'xmd-callerid',_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x2c')]=_0x5758ad[_0x2284('0x4a')];}if(!_['isNil'](_0x5758ad[_0x2284('0x4b')][_0x2284('0x53')])||!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')]['xmcs-queue'])){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x52'),_0x5758ad['uniqueid'],!_['isNil'](_0x5758ad[_0x2284('0x4b')][_0x2284('0x53')])?'xmd-queue':_0x2284('0x54'),_0x5758ad['value']));channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x55')]='Queue';channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x56')]=_0x5758ad[_0x2284('0x4a')];channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0xd')]=!![];}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x57')])){utils['info'](util[_0x2284('0xa')](_0x2284('0x58'),_0x5758ad[_0x2284('0x8')],_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x59')]=_0x5758ad[_0x2284('0x4a')];}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x5a')])){utils[_0x2284('0x24')](util[_0x2284('0xa')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5758ad['uniqueid'],_0x5758ad['value']));channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x5b')]=_0x5758ad[_0x2284('0x4a')];}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x5c')])){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x5d'),_0x5758ad[_0x2284('0x8')],_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad[_0x2284('0x8')]]['routeid']=_0x5758ad[_0x2284('0x4a')];}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')]['sipcallid'])){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x5e'),_0x5758ad[_0x2284('0x8')],_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad['uniqueid']][_0x2284('0x5f')]=_0x5758ad[_0x2284('0x4a')];}}}catch(_0x5c7e93){utils[_0x2284('0x20')](util['format'](_0x2284('0x60'),_0x5758ad[_0x2284('0x8')]),_0x5c7e93);}};exports[_0x2284('0x61')]=function(_0x5cfd46){try{if(!_[_0x2284('0x22')](channels[_0x5cfd46[_0x2284('0x8')]])){utils[_0x2284('0x18')](util[_0x2284('0xa')](_0x2284('0x62'),_0x5cfd46['uniqueid']),_0x5cfd46);utils[_0x2284('0x24')](util['format'](_0x2284('0x63'),_0x5cfd46['uniqueid'],_0x5cfd46[_0x2284('0x64')],_0x5cfd46[_0x2284('0x65')]));if(_0x5cfd46[_0x2284('0x64')][_0x2284('0x66')]()==_0x2284('0x67')&&_[_0x2284('0x68')](_0x5cfd46['appdata'][_0x2284('0x66')](),_0x2284('0x69'))){var _0x10f52a=_0x5cfd46[_0x2284('0x65')][_0x2284('0x6a')]('=');var _0x44af90=_0x10f52a[0x0][_0x2284('0x6b')](_0x10f52a[0x0][_0x2284('0x6c')]('(')+0x1,_0x10f52a[0x0]['lastIndexOf'](')'));var _0x41e9de=_0x10f52a[0x1];channels[_0x5cfd46['uniqueid']][_0x44af90]=_0x41e9de;}if(!_['includes']([_0x2284('0x2b'),_0x2284('0x6d'),_0x2284('0x6e'),'set','gotoif'],_0x5cfd46[_0x2284('0x64')][_0x2284('0x66')]())){channels[_0x5cfd46[_0x2284('0x8')]][_0x2284('0x55')]=_0x5cfd46[_0x2284('0x64')];channels[_0x5cfd46['uniqueid']]['lastdata']=_0x5cfd46[_0x2284('0x65')];}}}catch(_0x24419d){utils[_0x2284('0x20')](util[_0x2284('0xa')](_0x2284('0x62'),_0x5cfd46['uniqueid']),_0x24419d);}}; \ No newline at end of file +var _0xac73=['[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','execif','set','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','ANSWERED','FAILED','uniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','blinds','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','format','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','debug'];(function(_0x626f86,_0x7619b5){var _0x418916=function(_0x4a68f0){while(--_0x4a68f0){_0x626f86['push'](_0x626f86['shift']());}};_0x418916(++_0x7619b5);}(_0xac73,0x186));var _0x3ac7=function(_0x1a7d3a,_0x53e745){_0x1a7d3a=_0x1a7d3a-0x0;var _0x7728b0=_0xac73[_0x1a7d3a];return _0x7728b0;};'use strict';var _=require(_0x3ac7('0x0'));var util=require(_0x3ac7('0x1'));var utils=require(_0x3ac7('0x2'));var transfers=require(_0x3ac7('0x3'));var dispositions=[_0x3ac7('0x4'),'FAILED','FAILED',_0x3ac7('0x4'),_0x3ac7('0x4'),_0x3ac7('0x4'),_0x3ac7('0x5'),'BUSY',_0x3ac7('0x6'),_0x3ac7('0x6'),_0x3ac7('0x6')];var channels={};function writeDB(_0x245025){var _0x37917c;if(transfers['blinds'][_0x245025[_0x3ac7('0x7')]]){_0x37917c=_0x245025[_0x3ac7('0x7')];_0x245025[_0x3ac7('0x7')]=transfers['blinds'][_0x245025[_0x3ac7('0x7')]]['transfereeuniqueid'];}utils['info'](util['format'](_0x3ac7('0x8'),_0x245025[_0x3ac7('0x7')],_0x245025[_0x3ac7('0x9')],_0x245025[_0x3ac7('0xa')],_0x245025['membername'],_0x245025['interface'],_0x245025[_0x3ac7('0xb')],_0x245025[_0x3ac7('0xc')],_0x245025[_0x3ac7('0xd')]));if(_0x245025[_0x3ac7('0xe')]){utils[_0x3ac7('0xf')](_0x245025['accountcode'])['then'](function(_0x1c6733){if(_0x1c6733){_0x245025[_0x3ac7('0x10')]=_0x1c6733['id'];}utils[_0x3ac7('0x11')](_0x3ac7('0x12'),_0x245025);});}else{utils['request']('CreateVoiceCallReport',_0x245025);}if(channels[_0x245025[_0x3ac7('0x7')]]){delete channels[_0x245025[_0x3ac7('0x7')]];}else if(_0x37917c&&channels[_0x37917c]){if(!transfers['blinds'][_0x37917c]['recording'])delete transfers[_0x3ac7('0x13')][_0x37917c];delete channels[_0x37917c];}}exports[_0x3ac7('0x14')]=function(_0x13d240){try{utils['debug'](util['format'](_0x3ac7('0x15'),_0x13d240['uniqueid']),_0x13d240);if(_0x13d240[_0x3ac7('0x7')]==_0x13d240[_0x3ac7('0x16')]&&_0x13d240[_0x3ac7('0x9')]!=_0x3ac7('0x17')){utils[_0x3ac7('0x18')](util['format'](_0x3ac7('0x19'),_0x13d240[_0x3ac7('0x7')],_0x13d240[_0x3ac7('0x1a')],_0x13d240['exten']));channels[_0x13d240[_0x3ac7('0x7')]]={'uniqueid':_0x13d240[_0x3ac7('0x7')],'accountcode':_0x13d240[_0x3ac7('0xe')],'source':_0x13d240['calleridnum'],'destination':_0x13d240[_0x3ac7('0x1b')],'destinationcontext':_0x13d240['context'],'channel':_0x13d240['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x3ac7('0x1c')};}}catch(_0xebbe47){utils[_0x3ac7('0x1d')](util[_0x3ac7('0x1e')](_0x3ac7('0x15'),_0x13d240['uniqueid']),_0xebbe47);}};exports[_0x3ac7('0x1f')]=function(_0x430c51){try{utils['debug'](util['format'](_0x3ac7('0x20'),_0x430c51[_0x3ac7('0x7')]),_0x430c51);if(!_[_0x3ac7('0x21')](channels[_0x430c51['uniqueid']])&&_0x430c51[_0x3ac7('0x22')]==0x6){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x23'),_0x430c51['uniqueid'],_0x430c51[_0x3ac7('0x1a')],_0x430c51[_0x3ac7('0x9')]));if(_[_0x3ac7('0x21')](channels[_0x430c51[_0x3ac7('0x7')]][_0x3ac7('0x24')])){channels[_0x430c51['uniqueid']][_0x3ac7('0x24')]=utils[_0x3ac7('0x25')]();}}else if(!_[_0x3ac7('0x21')](channels[_0x430c51[_0x3ac7('0x16')]])&&_0x430c51[_0x3ac7('0x22')]==0x6&&_0x430c51[_0x3ac7('0x1a')]!='transfer'){utils['info'](util[_0x3ac7('0x1e')](_0x3ac7('0x26'),_0x430c51['uniqueid'],_0x430c51[_0x3ac7('0x16')],_0x430c51['context'],_0x430c51[_0x3ac7('0x9')]));channels[_0x430c51['linkedid']][_0x3ac7('0xe')]=_0x430c51[_0x3ac7('0xe')];channels[_0x430c51[_0x3ac7('0x16')]][_0x3ac7('0x27')]=_0x430c51['channel'];if(_[_0x3ac7('0x21')](channels[_0x430c51[_0x3ac7('0x16')]][_0x3ac7('0x28')])){channels[_0x430c51[_0x3ac7('0x16')]][_0x3ac7('0x28')]=utils['now']();}channels[_0x430c51[_0x3ac7('0x16')]][_0x3ac7('0x29')]=dispositions[_[_0x3ac7('0x2a')](_0x430c51[_0x3ac7('0x22')])]||'ANSWERED';}}catch(_0x2c8956){utils['error'](util[_0x3ac7('0x1e')]('[%s][calls][newstate]',_0x430c51[_0x3ac7('0x7')]),_0x2c8956);}};exports['hangup']=function(_0x3e19e1){try{if(!_[_0x3ac7('0x21')](channels[_0x3e19e1[_0x3ac7('0x7')]])){utils['debug'](util[_0x3ac7('0x1e')]('[%s][calls][hangup]',_0x3e19e1[_0x3ac7('0x7')]),_0x3e19e1);if(_[_0x3ac7('0x21')](channels[_0x3e19e1['uniqueid']][_0x3ac7('0x2b')])){channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x2b')]=_0x3e19e1[_0x3ac7('0x2c')]+'\x20<'+_0x3e19e1['calleridnum']+'>';}utils['info'](util[_0x3ac7('0x1e')](_0x3ac7('0x2d'),_0x3e19e1[_0x3ac7('0x7')],channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x2b')],_0x3e19e1[_0x3ac7('0x2e')]));channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x2f')]=utils[_0x3ac7('0x25')]();channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x30')]=utils[_0x3ac7('0x31')](channels[_0x3e19e1['uniqueid']][_0x3ac7('0x2f')],channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x32')]);channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x33')]=channels[_0x3e19e1[_0x3ac7('0x7')]]['answertime']?utils[_0x3ac7('0x31')](channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x2f')],channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x28')]):0x0;writeDB(channels[_0x3e19e1['uniqueid']]);}}catch(_0x5ad647){utils[_0x3ac7('0x1d')](util[_0x3ac7('0x1e')](_0x3ac7('0x34'),_0x3e19e1[_0x3ac7('0x7')]),_0x5ad647);}};exports[_0x3ac7('0x35')]=function(_0x4b6c36){try{if(!_[_0x3ac7('0x21')](channels[_0x4b6c36[_0x3ac7('0x36')]])){utils['debug'](util[_0x3ac7('0x1e')](_0x3ac7('0x37'),_0x4b6c36[_0x3ac7('0x38')]),_0x4b6c36);if(channels[_0x4b6c36['localtwolinkedid']][_0x3ac7('0x9')]==_0x4b6c36[_0x3ac7('0x39')]){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x3a'),_0x4b6c36[_0x3ac7('0x38')],_0x4b6c36[_0x3ac7('0x36')],_0x4b6c36[_0x3ac7('0x3b')]));channels[_0x4b6c36[_0x3ac7('0x36')]][_0x3ac7('0x27')]=_0x4b6c36[_0x3ac7('0x3b')];channels[_0x4b6c36['localtwolinkedid']][_0x3ac7('0x3c')]=_0x3ac7('0x3d');}else if(channels[_0x4b6c36['localtwolinkedid']][_0x3ac7('0x9')]=_0x4b6c36[_0x3ac7('0x3e')]){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4b6c36[_0x3ac7('0x38')],_0x4b6c36[_0x3ac7('0x36')],_0x4b6c36[_0x3ac7('0x3f')]));channels[_0x4b6c36['localtwolinkedid']][_0x3ac7('0x27')]=_0x4b6c36[_0x3ac7('0x3f')];channels[_0x4b6c36[_0x3ac7('0x36')]][_0x3ac7('0x3c')]=_0x3ac7('0x3d');}}}catch(_0xb76e3d){utils[_0x3ac7('0x1d')](util['format'](_0x3ac7('0x37'),_0x4b6c36[_0x3ac7('0x38')]),_0xb76e3d);}};exports[_0x3ac7('0x40')]=function(_0x38228f){try{if(!_[_0x3ac7('0x21')](channels[_0x38228f['uniqueid']])){utils[_0x3ac7('0x41')](util[_0x3ac7('0x1e')](_0x3ac7('0x42'),_0x38228f[_0x3ac7('0x7')]),_0x38228f);channels[_0x38228f['uniqueid']][_0x3ac7('0x43')]=utils[_0x3ac7('0x25')]();utils[_0x3ac7('0x18')](util['format'](_0x3ac7('0x44'),_0x38228f['uniqueid'],channels[_0x38228f['uniqueid']][_0x3ac7('0x43')]));}}catch(_0x5e555b){utils['error'](util[_0x3ac7('0x1e')](_0x3ac7('0x42'),_0x38228f[_0x3ac7('0x7')]),_0x5e555b);}};exports[_0x3ac7('0x45')]=function(_0x291116){try{if(!_[_0x3ac7('0x21')](channels[_0x291116[_0x3ac7('0x7')]])){utils[_0x3ac7('0x41')](util['format']('[%s][calls][musiconholdstop]',_0x291116[_0x3ac7('0x7')]),_0x291116);if(!_[_0x3ac7('0x21')](channels[_0x291116[_0x3ac7('0x7')]][_0x3ac7('0x43')])){channels[_0x291116[_0x3ac7('0x7')]][_0x3ac7('0x46')]+=utils[_0x3ac7('0x31')](utils['now'](),channels[_0x291116[_0x3ac7('0x7')]][_0x3ac7('0x43')]);utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x47'),_0x291116[_0x3ac7('0x7')],channels[_0x291116[_0x3ac7('0x7')]][_0x3ac7('0x46')]));delete channels[_0x291116['uniqueid']][_0x3ac7('0x43')];}}}catch(_0x39984c){utils[_0x3ac7('0x1d')](util['format'](_0x3ac7('0x48'),_0x291116[_0x3ac7('0x7')]),_0x39984c);}};exports['varset']=function(_0x294abd){try{if(!_['isNil'](channels[_0x294abd['uniqueid']])){utils[_0x3ac7('0x41')](util[_0x3ac7('0x1e')](_0x3ac7('0x49'),_0x294abd[_0x3ac7('0x7')]),_0x294abd);if(!_[_0x3ac7('0x21')](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x4b')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x4c'),_0x294abd['uniqueid'],_0x294abd['value']));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x4d')]=_0x294abd[_0x3ac7('0x4e')];}if(!_[_0x3ac7('0x21')](_0x294abd['variable'][_0x3ac7('0x4f')])){utils['info'](util['format'](_0x3ac7('0x50'),_0x294abd[_0x3ac7('0x7')],_0x294abd[_0x3ac7('0x4e')]));channels[_0x294abd[_0x3ac7('0x7')]]['destination']=_0x294abd[_0x3ac7('0x4e')];channels[_0x294abd[_0x3ac7('0x7')]]['callerid']='\x22'+_0x294abd[_0x3ac7('0x4e')]+_0x3ac7('0x51')+_0x294abd[_0x3ac7('0x4e')]+'>';}if(!_[_0x3ac7('0x21')](_0x294abd['variable'][_0x3ac7('0x52')])||!_['isNil'](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x53')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x294abd[_0x3ac7('0x7')],!_['isNil'](_0x294abd['variable'][_0x3ac7('0x52')])?_0x3ac7('0x52'):_0x3ac7('0x53'),_0x294abd['value']));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x2b')]=_0x294abd[_0x3ac7('0x4e')];}if(!_[_0x3ac7('0x21')](_0x294abd['variable']['xmd-queue'])||!_[_0x3ac7('0x21')](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x54')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x55'),_0x294abd[_0x3ac7('0x7')],!_[_0x3ac7('0x21')](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x56')])?'xmd-queue':_0x3ac7('0x54'),_0x294abd['value']));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x57')]=_0x3ac7('0x58');channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x59')]=_0x294abd[_0x3ac7('0x4e')];channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0xa')]=!![];}if(!_[_0x3ac7('0x21')](_0x294abd['variable'][_0x3ac7('0x5a')])){utils['info'](util[_0x3ac7('0x1e')](_0x3ac7('0x5b'),_0x294abd[_0x3ac7('0x7')],_0x294abd[_0x3ac7('0x4e')]));channels[_0x294abd[_0x3ac7('0x7')]]['ContactId']=_0x294abd[_0x3ac7('0x4e')];}if(!_[_0x3ac7('0x21')](_0x294abd['variable'][_0x3ac7('0x5c')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x5d'),_0x294abd['uniqueid'],_0x294abd[_0x3ac7('0x4e')]));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x5e')]=_0x294abd['value'];}if(!_[_0x3ac7('0x21')](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x5f')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x60'),_0x294abd['uniqueid'],_0x294abd[_0x3ac7('0x4e')]));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x61')]=_0x294abd['value'];}if(!_[_0x3ac7('0x21')](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x62')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x63'),_0x294abd[_0x3ac7('0x7')],_0x294abd['value']));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x62')]=_0x294abd[_0x3ac7('0x4e')];}}}catch(_0x1926fe){utils['error'](util[_0x3ac7('0x1e')](_0x3ac7('0x49'),_0x294abd[_0x3ac7('0x7')]),_0x1926fe);}};exports['newexten']=function(_0x2093c9){try{if(!_[_0x3ac7('0x21')](channels[_0x2093c9[_0x3ac7('0x7')]])){utils[_0x3ac7('0x41')](util[_0x3ac7('0x1e')](_0x3ac7('0x64'),_0x2093c9[_0x3ac7('0x7')]),_0x2093c9);utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x65'),_0x2093c9[_0x3ac7('0x7')],_0x2093c9[_0x3ac7('0x66')],_0x2093c9['appdata']));if(_0x2093c9[_0x3ac7('0x66')][_0x3ac7('0x67')]()=='set'&&_[_0x3ac7('0x68')](_0x2093c9[_0x3ac7('0x69')][_0x3ac7('0x67')](),_0x3ac7('0x6a'))){var _0x3dc13b=_0x2093c9['appdata'][_0x3ac7('0x6b')]('=');var _0x52b260=_0x3dc13b[0x0][_0x3ac7('0x6c')](_0x3dc13b[0x0][_0x3ac7('0x6d')]('(')+0x1,_0x3dc13b[0x0]['lastIndexOf'](')'));var _0xeb8dc6=_0x3dc13b[0x1];channels[_0x2093c9[_0x3ac7('0x7')]][_0x52b260]=_0xeb8dc6;}if(!_[_0x3ac7('0x6e')](['hangup','noop',_0x3ac7('0x6f'),_0x3ac7('0x70'),_0x3ac7('0x71')],_0x2093c9[_0x3ac7('0x66')][_0x3ac7('0x67')]())){channels[_0x2093c9[_0x3ac7('0x7')]][_0x3ac7('0x57')]=_0x2093c9[_0x3ac7('0x66')];channels[_0x2093c9[_0x3ac7('0x7')]][_0x3ac7('0x59')]=_0x2093c9[_0x3ac7('0x69')];}}}catch(_0x301727){utils[_0x3ac7('0x1d')](util[_0x3ac7('0x1e')](_0x3ac7('0x64'),_0x2093c9[_0x3ac7('0x7')]),_0x301727);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 2b2705d..bba2862 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 _0xaf2f=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','./utils'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xaf2f,0xc5));var _0xfaf2=function(_0x363b17,_0x4ebce){_0x363b17=_0x363b17-0x0;var _0x1103a0=_0xaf2f[_0x363b17];return _0x1103a0;};'use strict';var utils=require(_0xfaf2('0x0'));exports[_0xfaf2('0x1')]=function(){utils[_0xfaf2('0x2')](_0xfaf2('0x3'));};exports[_0xfaf2('0x4')]=function(){utils[_0xfaf2('0x2')](_0xfaf2('0x5'));};exports['fullybooted']=function(){utils[_0xfaf2('0x2')](_0xfaf2('0x6'));};exports[_0xfaf2('0x7')]=function(_0x577c9b){utils[_0xfaf2('0x7')](_0xfaf2('0x8'),_0x577c9b);};exports[_0xfaf2('0x9')]=function(){utils[_0xfaf2('0x2')](_0xfaf2('0xa'));};exports['managerevent']=function(_0x3e3b2d){}; \ No newline at end of file +var _0x8d05=['[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','./utils','info'];(function(_0x598fca,_0x533239){var _0x5f1509=function(_0x1aadf9){while(--_0x1aadf9){_0x598fca['push'](_0x598fca['shift']());}};_0x5f1509(++_0x533239);}(_0x8d05,0x6c));var _0x58d0=function(_0x2d8e9b,_0x3d4f9f){_0x2d8e9b=_0x2d8e9b-0x0;var _0x357afc=_0x8d05[_0x2d8e9b];return _0x357afc;};'use strict';var utils=require(_0x58d0('0x0'));exports['connect']=function(){utils[_0x58d0('0x1')](_0x58d0('0x2'));};exports['shutdown']=function(){utils[_0x58d0('0x1')](_0x58d0('0x3'));};exports[_0x58d0('0x4')]=function(){utils[_0x58d0('0x1')](_0x58d0('0x5'));};exports[_0x58d0('0x6')]=function(_0x5e2178){utils[_0x58d0('0x6')]('[core]\x20error',_0x5e2178);};exports[_0x58d0('0x7')]=function(){utils['info'](_0x58d0('0x8'));};exports[_0x58d0('0x9')]=function(_0x320542){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 89ad769..1115cd1 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 _0x2558=['[%s][dials][newexten]','application','toLowerCase','set','appdata','cdr(routeid)','split','varset','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','error','[%s][dials][dialend]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','debug'];(function(_0x4c1ec2,_0x4f42b7){var _0x3f6f1c=function(_0xc82652){while(--_0xc82652){_0x4c1ec2['push'](_0x4c1ec2['shift']());}};_0x3f6f1c(++_0x4f42b7);}(_0x2558,0x155));var _0x8255=function(_0x3ca0aa,_0x54136d){_0x3ca0aa=_0x3ca0aa-0x0;var _0xeb19d7=_0x2558[_0x3ca0aa];return _0xeb19d7;};'use strict';var _=require('lodash');var util=require(_0x8255('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x3ea403){utils[_0x8255('0x1')](util[_0x8255('0x2')](_0x8255('0x3'),_0x3ea403[_0x8255('0x4')],_0x3ea403[_0x8255('0x5')],_0x3ea403['dialstring'],_0x3ea403[_0x8255('0x6')],_0x3ea403[_0x8255('0x7')],_0x3ea403[_0x8255('0x8')]));utils[_0x8255('0x9')]('CreateVoiceDialReport',_0x3ea403);delete dials[_0x3ea403['uniqueid']];}exports['newexten']=function(_0x242cb6){try{utils[_0x8255('0xa')](util['format'](_0x8255('0xb'),_0x242cb6[_0x8255('0x4')]),_0x242cb6);utils[_0x8255('0x1')](util[_0x8255('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x242cb6[_0x8255('0x4')],_0x242cb6['application'],_0x242cb6['appdata']));if(_0x242cb6[_0x8255('0xc')][_0x8255('0xd')]()==_0x8255('0xe')&&_['startsWith'](_0x242cb6[_0x8255('0xf')][_0x8255('0xd')](),_0x8255('0x10'))){var _0x56e0c1=_0x242cb6[_0x8255('0xf')][_0x8255('0x11')]('=');dials[_0x242cb6['uniqueid']]={'routeId':_0x56e0c1[0x1]};}}catch(_0x11f067){utils['error'](util[_0x8255('0x2')]('[%s][dials][newexten]',_0x242cb6['uniqueid']),_0x11f067);}};exports[_0x8255('0x12')]=function(_0x288554){try{utils[_0x8255('0xa')](util[_0x8255('0x2')]('[%s][dials][varset]',_0x288554[_0x8255('0x4')]),_0x288554);if(!_[_0x8255('0x13')](_0x288554[_0x8255('0x14')]['outboundrouteid'])){utils[_0x8255('0x1')](util['format'](_0x8255('0x15'),_0x288554['uniqueid'],_0x288554[_0x8255('0x16')]));dials[_0x288554[_0x8255('0x4')]]={'routeId':_0x288554[_0x8255('0x16')]};}}catch(_0x152e70){utils['error'](util['format'](_0x8255('0x17'),_0x288554[_0x8255('0x4')]),_0x152e70);}};exports['dialbegin']=function(_0x423953){try{if(!_[_0x8255('0x13')](dials[_0x423953[_0x8255('0x4')]])){utils[_0x8255('0xa')](util[_0x8255('0x2')](_0x8255('0x18'),_0x423953[_0x8255('0x4')]),_0x423953);dials[_0x423953[_0x8255('0x4')]]=_[_0x8255('0x19')](dials[_0x423953['uniqueid']],_0x423953);dials[_0x423953[_0x8255('0x4')]][_0x8255('0x1a')]=utils['now']();dials[_0x423953[_0x8255('0x4')]][_0x8255('0x1b')]=_0x8255('0x1c');utils[_0x8255('0x1')](util[_0x8255('0x2')](_0x8255('0x1d'),_0x423953[_0x8255('0x4')],dials[_0x423953[_0x8255('0x4')]]['starttime']));}}catch(_0x527c2e){utils['error'](util[_0x8255('0x2')](_0x8255('0x18'),_0x423953[_0x8255('0x4')]),_0x527c2e);}};exports['dialend']=function(_0x43ae7c){try{if(!_['isNil'](dials[_0x43ae7c[_0x8255('0x4')]])){utils[_0x8255('0xa')](util[_0x8255('0x2')]('[%s][dials][dialend]',_0x43ae7c['uniqueid']),_0x43ae7c);dials[_0x43ae7c[_0x8255('0x4')]][_0x8255('0x8')]=_0x43ae7c[_0x8255('0x8')];if(_0x43ae7c['dialstatus']=='ANSWER'){dials[_0x43ae7c['uniqueid']]=_[_0x8255('0x19')](dials[_0x43ae7c[_0x8255('0x4')]],_0x43ae7c);dials[_0x43ae7c['uniqueid']][_0x8255('0x1e')]=utils[_0x8255('0x1f')]();dials[_0x43ae7c[_0x8255('0x4')]][_0x8255('0x1b')]=_0x8255('0x20');utils[_0x8255('0x1')](util[_0x8255('0x2')](_0x8255('0x21'),_0x43ae7c[_0x8255('0x4')],_0x43ae7c[_0x8255('0x8')],dials[_0x43ae7c[_0x8255('0x4')]]['answertime']));}else{utils[_0x8255('0x1')](util[_0x8255('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x43ae7c['uniqueid'],_0x43ae7c[_0x8255('0x8')]));}}}catch(_0x523ec3){utils[_0x8255('0x22')](util[_0x8255('0x2')](_0x8255('0x23'),_0x43ae7c[_0x8255('0x4')]),_0x523ec3);}};exports['hangup']=function(_0x4bdb7c){try{if(!_[_0x8255('0x13')](dials[_0x4bdb7c[_0x8255('0x4')]])){utils[_0x8255('0xa')](util[_0x8255('0x2')]('[%s][dials][hangup]',_0x4bdb7c[_0x8255('0x4')]),_0x4bdb7c);utils[_0x8255('0x1')](util[_0x8255('0x2')](_0x8255('0x24'),_0x4bdb7c[_0x8255('0x4')],_0x4bdb7c[_0x8255('0x6')],_0x4bdb7c[_0x8255('0x25')],_0x4bdb7c[_0x8255('0x26')]));dials[_0x4bdb7c[_0x8255('0x4')]]=_[_0x8255('0x19')](dials[_0x4bdb7c[_0x8255('0x4')]],{'endtime':utils[_0x8255('0x1f')](),'lastevent':_0x8255('0x27')});dials[_0x4bdb7c[_0x8255('0x4')]][_0x8255('0x28')]=utils[_0x8255('0x29')](dials[_0x4bdb7c[_0x8255('0x4')]][_0x8255('0x2a')],dials[_0x4bdb7c['uniqueid']][_0x8255('0x1a')]);dials[_0x4bdb7c[_0x8255('0x4')]][_0x8255('0x2b')]=utils[_0x8255('0x29')](dials[_0x4bdb7c[_0x8255('0x4')]][_0x8255('0x1e')]||dials[_0x4bdb7c[_0x8255('0x4')]][_0x8255('0x2a')],dials[_0x4bdb7c[_0x8255('0x4')]][_0x8255('0x1a')]);dials[_0x4bdb7c['uniqueid']]['billableseconds']=dials[_0x4bdb7c[_0x8255('0x4')]][_0x8255('0x1e')]?utils[_0x8255('0x29')](dials[_0x4bdb7c[_0x8255('0x4')]][_0x8255('0x2a')],dials[_0x4bdb7c[_0x8255('0x4')]][_0x8255('0x1e')]):0x0;writeDB(dials[_0x4bdb7c[_0x8255('0x4')]]);}}catch(_0x239e4d){utils[_0x8255('0x22')](util['format']('[%s][dials][hangup]',_0x4bdb7c[_0x8255('0x4')]),_0x239e4d);}}; \ No newline at end of file +var _0xa373=['[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','request','uniqueid','newexten','debug','format','toLowerCase','set','startsWith','cdr(routeid)','appdata','error','[%s][dials][newexten]','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','isNil','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect'];(function(_0x37e09b,_0x4c5ee9){var _0x26a1ed=function(_0x5c1d86){while(--_0x5c1d86){_0x37e09b['push'](_0x37e09b['shift']());}};_0x26a1ed(++_0x4c5ee9);}(_0xa373,0x71));var _0x3a37=function(_0x48ac79,_0x57a9be){_0x48ac79=_0x48ac79-0x0;var _0xd977f=_0xa373[_0x48ac79];return _0xd977f;};'use strict';var _=require('lodash');var util=require(_0x3a37('0x0'));var utils=require(_0x3a37('0x1'));var dials={};function writeDB(_0x2e860c){utils[_0x3a37('0x2')](util['format'](_0x3a37('0x3'),_0x2e860c['uniqueid'],_0x2e860c[_0x3a37('0x4')],_0x2e860c[_0x3a37('0x5')],_0x2e860c[_0x3a37('0x6')],_0x2e860c['connectedlinenum'],_0x2e860c['dialstatus']));utils[_0x3a37('0x7')]('CreateVoiceDialReport',_0x2e860c);delete dials[_0x2e860c[_0x3a37('0x8')]];}exports[_0x3a37('0x9')]=function(_0x4fd56a){try{utils[_0x3a37('0xa')](util[_0x3a37('0xb')]('[%s][dials][newexten]',_0x4fd56a['uniqueid']),_0x4fd56a);utils['info'](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4fd56a[_0x3a37('0x8')],_0x4fd56a['application'],_0x4fd56a['appdata']));if(_0x4fd56a['application'][_0x3a37('0xc')]()==_0x3a37('0xd')&&_[_0x3a37('0xe')](_0x4fd56a['appdata'][_0x3a37('0xc')](),_0x3a37('0xf'))){var _0x114121=_0x4fd56a[_0x3a37('0x10')]['split']('=');dials[_0x4fd56a[_0x3a37('0x8')]]={'routeId':_0x114121[0x1]};}}catch(_0x5b8013){utils[_0x3a37('0x11')](util['format'](_0x3a37('0x12'),_0x4fd56a['uniqueid']),_0x5b8013);}};exports[_0x3a37('0x13')]=function(_0x3e70ca){try{utils[_0x3a37('0xa')](util[_0x3a37('0xb')](_0x3a37('0x14'),_0x3e70ca[_0x3a37('0x8')]),_0x3e70ca);if(!_['isNil'](_0x3e70ca[_0x3a37('0x15')][_0x3a37('0x16')])){utils[_0x3a37('0x2')](util[_0x3a37('0xb')](_0x3a37('0x17'),_0x3e70ca[_0x3a37('0x8')],_0x3e70ca[_0x3a37('0x18')]));dials[_0x3e70ca[_0x3a37('0x8')]]={'routeId':_0x3e70ca[_0x3a37('0x18')]};}}catch(_0x24c154){utils[_0x3a37('0x11')](util['format'](_0x3a37('0x14'),_0x3e70ca[_0x3a37('0x8')]),_0x24c154);}};exports[_0x3a37('0x19')]=function(_0x2dbf1e){try{if(!_['isNil'](dials[_0x2dbf1e[_0x3a37('0x8')]])){utils[_0x3a37('0xa')](util[_0x3a37('0xb')](_0x3a37('0x1a'),_0x2dbf1e['uniqueid']),_0x2dbf1e);dials[_0x2dbf1e[_0x3a37('0x8')]]=_[_0x3a37('0x1b')](dials[_0x2dbf1e['uniqueid']],_0x2dbf1e);dials[_0x2dbf1e['uniqueid']][_0x3a37('0x1c')]=utils[_0x3a37('0x1d')]();dials[_0x2dbf1e[_0x3a37('0x8')]]['lastevent']=_0x3a37('0x1e');utils[_0x3a37('0x2')](util[_0x3a37('0xb')](_0x3a37('0x1f'),_0x2dbf1e['uniqueid'],dials[_0x2dbf1e[_0x3a37('0x8')]]['starttime']));}}catch(_0x1b5a07){utils[_0x3a37('0x11')](util[_0x3a37('0xb')](_0x3a37('0x1a'),_0x2dbf1e[_0x3a37('0x8')]),_0x1b5a07);}};exports[_0x3a37('0x20')]=function(_0x54db8b){try{if(!_[_0x3a37('0x21')](dials[_0x54db8b[_0x3a37('0x8')]])){utils[_0x3a37('0xa')](util[_0x3a37('0xb')](_0x3a37('0x22'),_0x54db8b[_0x3a37('0x8')]),_0x54db8b);dials[_0x54db8b[_0x3a37('0x8')]]['dialstatus']=_0x54db8b[_0x3a37('0x23')];if(_0x54db8b[_0x3a37('0x23')]==_0x3a37('0x24')){dials[_0x54db8b[_0x3a37('0x8')]]=_[_0x3a37('0x1b')](dials[_0x54db8b[_0x3a37('0x8')]],_0x54db8b);dials[_0x54db8b[_0x3a37('0x8')]][_0x3a37('0x25')]=utils[_0x3a37('0x1d')]();dials[_0x54db8b['uniqueid']]['lastevent']=_0x3a37('0x26');utils[_0x3a37('0x2')](util[_0x3a37('0xb')](_0x3a37('0x27'),_0x54db8b[_0x3a37('0x8')],_0x54db8b[_0x3a37('0x23')],dials[_0x54db8b[_0x3a37('0x8')]][_0x3a37('0x25')]));}else{utils[_0x3a37('0x2')](util[_0x3a37('0xb')](_0x3a37('0x28'),_0x54db8b[_0x3a37('0x8')],_0x54db8b[_0x3a37('0x23')]));}}}catch(_0x295e18){utils[_0x3a37('0x11')](util[_0x3a37('0xb')]('[%s][dials][dialend]',_0x54db8b[_0x3a37('0x8')]),_0x295e18);}};exports[_0x3a37('0x29')]=function(_0x5479f4){try{if(!_['isNil'](dials[_0x5479f4[_0x3a37('0x8')]])){utils['debug'](util[_0x3a37('0xb')](_0x3a37('0x2a'),_0x5479f4['uniqueid']),_0x5479f4);utils[_0x3a37('0x2')](util[_0x3a37('0xb')](_0x3a37('0x2b'),_0x5479f4[_0x3a37('0x8')],_0x5479f4[_0x3a37('0x6')],_0x5479f4[_0x3a37('0x2c')],_0x5479f4['cause-txt']));dials[_0x5479f4[_0x3a37('0x8')]]=_['assign'](dials[_0x5479f4['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x3a37('0x2d')});dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x2e')]=utils[_0x3a37('0x2f')](dials[_0x5479f4['uniqueid']][_0x3a37('0x30')],dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x1c')]);dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x31')]=utils[_0x3a37('0x2f')](dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x25')]||dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x30')],dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x1c')]);dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x32')]=dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x25')]?utils[_0x3a37('0x2f')](dials[_0x5479f4[_0x3a37('0x8')]]['endtime'],dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x25')]):0x0;writeDB(dials[_0x5479f4['uniqueid']]);}}catch(_0x54e064){utils[_0x3a37('0x11')](util['format'](_0x3a37('0x2a'),_0x5479f4[_0x3a37('0x8')]),_0x54e064);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 110716e..8eb3a76 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 _0xaa72=['info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected'];(function(_0x3c558b,_0x30549e){var _0x319b53=function(_0x38ec6d){while(--_0x38ec6d){_0x3c558b['push'](_0x3c558b['shift']());}};_0x319b53(++_0x30549e);}(_0xaa72,0x1ea));var _0x2aa7=function(_0x3f87a4,_0x33293d){_0x3f87a4=_0x3f87a4-0x0;var _0x53b24a=_0xaa72[_0x3f87a4];return _0x53b24a;};var AsteriskManager=require(_0x2aa7('0x0'));var config=require(_0x2aa7('0x1'));var utils=require(_0x2aa7('0x2'));var util=require(_0x2aa7('0x3'));var isXDREnabled=config[_0x2aa7('0x4')]&&config['xdr'][_0x2aa7('0x5')]?!config['xdr'][_0x2aa7('0x5')]:!![];var isProduction=config[_0x2aa7('0x6')]===_0x2aa7('0x7')||![];var isLocalAsterisk=config[_0x2aa7('0x4')]&&config[_0x2aa7('0x4')][_0x2aa7('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x2aa7('0x9')][_0x2aa7('0xa')],config[_0x2aa7('0x9')]['ip'],config['asterisk'][_0x2aa7('0xb')],config[_0x2aa7('0x9')][_0x2aa7('0xc')],!![]);ami[_0x2aa7('0xd')]();if(!isXDREnabled){utils[_0x2aa7('0xe')](_0x2aa7('0xf'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x2aa7('0xe')](_0x2aa7('0x10'));}else{var agents=require(_0x2aa7('0x11'));var calls=require(_0x2aa7('0x12'));var queues=require(_0x2aa7('0x13'));var recordings=require(_0x2aa7('0x14'));var members=require(_0x2aa7('0x15'));var dials=require('./dials.controller');var transfers=require(_0x2aa7('0x16'));var core=require(_0x2aa7('0x17'));ami['on'](_0x2aa7('0x18'),core[_0x2aa7('0x18')]);ami['on'](_0x2aa7('0x19'),core[_0x2aa7('0x19')]);ami['on'](_0x2aa7('0x1a'),core[_0x2aa7('0x1a')]);ami['on'](_0x2aa7('0x1b'),core[_0x2aa7('0x1b')]);ami['on'](_0x2aa7('0x1c'),core[_0x2aa7('0x1c')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x2aa7('0x1d'),function(_0x3db820){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')](_0x2aa7('0x20'),_0x3db820[_0x2aa7('0x21')]),_0x3db820);members['devicestatechange'](_0x3db820);}catch(_0x2dea41){utils[_0x2aa7('0x1b')](util['format'](_0x2aa7('0x20'),_0x3db820[_0x2aa7('0x21')]),_0x2dea41);}});ami['on'](_0x2aa7('0x22'),function(_0x186cf1){try{utils[_0x2aa7('0x1e')](util['format']('[%s][index][agentcalled]',_0x186cf1[_0x2aa7('0x23')]),_0x186cf1);agents['agentcalled'](_0x186cf1);}catch(_0x39296d){utils['error'](util[_0x2aa7('0x1f')]('[%s][index][agentcalled]',_0x186cf1[_0x2aa7('0x23')]),_0x39296d);}});ami['on'](_0x2aa7('0x24'),function(_0x293eec){try{utils[_0x2aa7('0x1e')](util['format'](_0x2aa7('0x25'),_0x293eec[_0x2aa7('0x23')]),_0x293eec);agents[_0x2aa7('0x24')](_0x293eec);}catch(_0x979653){utils[_0x2aa7('0x1b')](util['format'](_0x2aa7('0x25'),_0x293eec[_0x2aa7('0x23')]),_0x979653);}});ami['on'](_0x2aa7('0x26'),function(_0x4c92c8){try{utils['debug'](util[_0x2aa7('0x1f')](_0x2aa7('0x27'),_0x4c92c8[_0x2aa7('0x23')]),_0x4c92c8);agents[_0x2aa7('0x26')](_0x4c92c8);queues[_0x2aa7('0x26')](_0x4c92c8);}catch(_0x4bc26b){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')](_0x2aa7('0x27'),_0x4c92c8[_0x2aa7('0x23')]),_0x4bc26b);}});ami['on'](_0x2aa7('0x28'),function(_0x26328f){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')](_0x2aa7('0x29'),_0x26328f[_0x2aa7('0x23')]),_0x26328f);agents[_0x2aa7('0x28')](_0x26328f);queues[_0x2aa7('0x28')](_0x26328f);members['agentcomplete'](_0x26328f);}catch(_0x1f9834){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')](_0x2aa7('0x29'),_0x26328f[_0x2aa7('0x23')]),_0x1f9834);}});ami['on']('queuecallerabandon',function(_0x556fd5){try{utils['debug'](util['format'](_0x2aa7('0x2a'),_0x556fd5[_0x2aa7('0x23')]),_0x556fd5);agents[_0x2aa7('0x2b')](_0x556fd5);queues[_0x2aa7('0x2b')](_0x556fd5);}catch(_0x75357e){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')]('[%s][index][queuecallerabandon]',_0x556fd5['uniqueid']),_0x75357e);}});ami['on'](_0x2aa7('0x2c'),function(_0xfd79af){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')](_0x2aa7('0x2d'),_0xfd79af[_0x2aa7('0x23')]),_0xfd79af);queues[_0x2aa7('0x2c')](_0xfd79af);recordings[_0x2aa7('0x2c')](_0xfd79af);}catch(_0x2392e9){utils['error'](util[_0x2aa7('0x1f')]('[%s][index][queuecallerjoin]',_0xfd79af['uniqueid']),_0x2392e9);}});ami['on'](_0x2aa7('0x2e'),function(_0x93cd9c){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')]('[%s][index][queuecallerleave]',_0x93cd9c[_0x2aa7('0x23')]),_0x93cd9c);queues[_0x2aa7('0x2e')](_0x93cd9c);}catch(_0x2f54fb){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')](_0x2aa7('0x2f'),_0x93cd9c[_0x2aa7('0x23')]),_0x2f54fb);}});ami['on'](_0x2aa7('0x30'),function(_0x5626ce){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')](_0x2aa7('0x31'),_0x5626ce['uniqueid']),_0x5626ce);queues[_0x2aa7('0x30')](_0x5626ce);calls[_0x2aa7('0x30')](_0x5626ce);}catch(_0x54009c){utils['error'](util[_0x2aa7('0x1f')]('[%s][index][musiconholdstart]',_0x5626ce['uniqueid']),_0x54009c);}});ami['on'](_0x2aa7('0x32'),function(_0x39a399){try{utils['debug'](util['format'](_0x2aa7('0x33'),_0x39a399[_0x2aa7('0x23')]),_0x39a399);queues['musiconholdstop'](_0x39a399);calls[_0x2aa7('0x32')](_0x39a399);}catch(_0x375fed){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')](_0x2aa7('0x33'),_0x39a399[_0x2aa7('0x23')]),_0x375fed);}});ami['on'](_0x2aa7('0x34'),function(_0x1ac4dd){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')](_0x2aa7('0x35'),_0x1ac4dd[_0x2aa7('0x23')]),_0x1ac4dd);calls[_0x2aa7('0x34')](_0x1ac4dd);recordings[_0x2aa7('0x34')](_0x1ac4dd);}catch(_0x4ca527){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')](_0x2aa7('0x35'),_0x1ac4dd['uniqueid']),_0x4ca527);}});ami['on'](_0x2aa7('0x36'),function(_0x17c755){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')](_0x2aa7('0x37'),_0x17c755[_0x2aa7('0x23')]),_0x17c755);calls['hangup'](_0x17c755);recordings[_0x2aa7('0x36')](_0x17c755);dials[_0x2aa7('0x36')](_0x17c755);agents[_0x2aa7('0x36')](_0x17c755);queues[_0x2aa7('0x36')](_0x17c755);}catch(_0x4db55c){utils['error'](util[_0x2aa7('0x1f')](_0x2aa7('0x37'),_0x17c755[_0x2aa7('0x23')]),_0x4db55c);}});ami['on']('cdr',function(_0xb59dd8){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')](_0x2aa7('0x38'),_0xb59dd8[_0x2aa7('0x23')]),_0xb59dd8);members[_0x2aa7('0x39')](_0xb59dd8);}catch(_0x3f1a61){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')](_0x2aa7('0x38'),_0xb59dd8['uniqueid']),_0x3f1a61);}});ami['on']('blindtransfer',function(_0x396897){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')](_0x2aa7('0x3a'),_0x396897['uniqueid']),_0x396897);queues['blindtransfer'](_0x396897);agents[_0x2aa7('0x3b')](_0x396897);transfers[_0x2aa7('0x3b')](_0x396897);recordings['blindtransfer'](_0x396897);}catch(_0x2985d7){utils[_0x2aa7('0x1b')](util['format'](_0x2aa7('0x3a'),_0x396897['uniqueid']),_0x2985d7);}});ami['on']('attendedtransfer',function(_0x1d5e00){try{utils['debug'](util[_0x2aa7('0x1f')](_0x2aa7('0x3c'),_0x1d5e00[_0x2aa7('0x3d')]),_0x1d5e00);queues['attendedtransfer'](_0x1d5e00);transfers[_0x2aa7('0x3e')](_0x1d5e00);agents[_0x2aa7('0x3e')](_0x1d5e00);calls[_0x2aa7('0x3e')](_0x1d5e00);}catch(_0x1aea55){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')]('[%s][index][attendedtransfer]',_0x1d5e00[_0x2aa7('0x3d')]),_0x1aea55);}});ami['on']('varset',function(_0x544fa9){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')]('[%s][index][varset]',_0x544fa9[_0x2aa7('0x23')]),_0x544fa9);queues['varset'](_0x544fa9);recordings['varset'](_0x544fa9);calls[_0x2aa7('0x3f')](_0x544fa9);dials[_0x2aa7('0x3f')](_0x544fa9);}catch(_0x8e84f8){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')](_0x2aa7('0x40'),_0x544fa9['uniqueid']),_0x8e84f8);}});ami['on'](_0x2aa7('0x41'),function(_0x479812){try{utils[_0x2aa7('0x1e')](util[_0x2aa7('0x1f')]('[%s][index][newexten]',_0x479812['uniqueid']),_0x479812);calls['newexten'](_0x479812);recordings[_0x2aa7('0x41')](_0x479812);dials[_0x2aa7('0x41')](_0x479812);}catch(_0x9e8185){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')]('[%s][index][newexten]',_0x479812[_0x2aa7('0x23')]),_0x9e8185);}});ami['on'](_0x2aa7('0x42'),function(_0x2e7a71){try{utils['debug'](util[_0x2aa7('0x1f')](_0x2aa7('0x43'),_0x2e7a71[_0x2aa7('0x23')]),_0x2e7a71);calls[_0x2aa7('0x42')](_0x2e7a71);recordings['newchannel'](_0x2e7a71);}catch(_0x337b8f){utils['error'](util[_0x2aa7('0x1f')](_0x2aa7('0x43'),_0x2e7a71[_0x2aa7('0x23')]),_0x337b8f);}});ami['on'](_0x2aa7('0x44'),function(_0x3f950f){try{utils['debug'](util[_0x2aa7('0x1f')]('[%s][index][dialbegin]',_0x3f950f[_0x2aa7('0x23')]),_0x3f950f);dials[_0x2aa7('0x44')](_0x3f950f);}catch(_0x4fd0a5){utils[_0x2aa7('0x1b')](util[_0x2aa7('0x1f')](_0x2aa7('0x45'),_0x3f950f[_0x2aa7('0x23')]),_0x4fd0a5);}});ami['on'](_0x2aa7('0x46'),function(_0x1b96f3){try{utils['debug'](util[_0x2aa7('0x1f')]('[%s][index][dialend]',_0x1b96f3['uniqueid']),_0x1b96f3);dials['dialend'](_0x1b96f3);}catch(_0x51898f){utils['error'](util['format'](_0x2aa7('0x47'),_0x1b96f3[_0x2aa7('0x23')]),_0x51898f);}});} \ No newline at end of file +var _0xe418=['[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','debug','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel'];(function(_0x21e32e,_0x49c6f8){var _0x2a2eb2=function(_0x2e9554){while(--_0x2e9554){_0x21e32e['push'](_0x21e32e['shift']());}};_0x2a2eb2(++_0x49c6f8);}(_0xe418,0x126));var _0x8e41=function(_0x41ef4b,_0x60913f){_0x41ef4b=_0x41ef4b-0x0;var _0x25a0a1=_0xe418[_0x41ef4b];return _0x25a0a1;};var AsteriskManager=require(_0x8e41('0x0'));var config=require(_0x8e41('0x1'));var utils=require(_0x8e41('0x2'));var util=require(_0x8e41('0x3'));var isXDREnabled=config[_0x8e41('0x4')]&&config[_0x8e41('0x4')][_0x8e41('0x5')]?!config[_0x8e41('0x4')][_0x8e41('0x5')]:!![];var isProduction=config[_0x8e41('0x6')]===_0x8e41('0x7')||![];var isLocalAsterisk=config['xdr']&&config[_0x8e41('0x4')][_0x8e41('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x8e41('0x9')][_0x8e41('0xa')],config['asterisk']['ip'],config[_0x8e41('0x9')]['username'],config[_0x8e41('0x9')][_0x8e41('0xb')],!![]);ami[_0x8e41('0xc')]();if(!isXDREnabled){utils[_0x8e41('0xd')](_0x8e41('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8e41('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x8e41('0xf'));var queues=require('./queues.controller');var recordings=require(_0x8e41('0x10'));var members=require(_0x8e41('0x11'));var dials=require(_0x8e41('0x12'));var transfers=require(_0x8e41('0x13'));var core=require(_0x8e41('0x14'));ami['on'](_0x8e41('0x15'),core['connect']);ami['on'](_0x8e41('0x16'),core[_0x8e41('0x16')]);ami['on'](_0x8e41('0x17'),core[_0x8e41('0x17')]);ami['on'](_0x8e41('0x18'),core[_0x8e41('0x18')]);ami['on'](_0x8e41('0x19'),core['close']);ami['on'](_0x8e41('0x1a'),core[_0x8e41('0x1a')]);ami['on'](_0x8e41('0x1b'),function(_0xa39714){try{utils['debug'](util['format'](_0x8e41('0x1c'),_0xa39714['device']),_0xa39714);members['devicestatechange'](_0xa39714);}catch(_0x4f8505){utils['error'](util['format'](_0x8e41('0x1c'),_0xa39714[_0x8e41('0x1d')]),_0x4f8505);}});ami['on'](_0x8e41('0x1e'),function(_0x219881){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x21'),_0x219881[_0x8e41('0x22')]),_0x219881);agents['agentcalled'](_0x219881);}catch(_0x21bda8){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x21'),_0x219881[_0x8e41('0x22')]),_0x21bda8);}});ami['on'](_0x8e41('0x23'),function(_0x190a0d){try{utils['debug'](util['format'](_0x8e41('0x24'),_0x190a0d[_0x8e41('0x22')]),_0x190a0d);agents[_0x8e41('0x23')](_0x190a0d);}catch(_0x582499){utils['error'](util[_0x8e41('0x20')](_0x8e41('0x24'),_0x190a0d[_0x8e41('0x22')]),_0x582499);}});ami['on'](_0x8e41('0x25'),function(_0x239c90){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x26'),_0x239c90[_0x8e41('0x22')]),_0x239c90);agents[_0x8e41('0x25')](_0x239c90);queues[_0x8e41('0x25')](_0x239c90);}catch(_0x3cf555){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x26'),_0x239c90[_0x8e41('0x22')]),_0x3cf555);}});ami['on'](_0x8e41('0x27'),function(_0x1cc70b){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x28'),_0x1cc70b['uniqueid']),_0x1cc70b);agents['agentcomplete'](_0x1cc70b);queues[_0x8e41('0x27')](_0x1cc70b);members[_0x8e41('0x27')](_0x1cc70b);}catch(_0x5e36cf){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x28'),_0x1cc70b['uniqueid']),_0x5e36cf);}});ami['on'](_0x8e41('0x29'),function(_0x11e991){try{utils['debug'](util[_0x8e41('0x20')](_0x8e41('0x2a'),_0x11e991[_0x8e41('0x22')]),_0x11e991);agents['queuecallerabandon'](_0x11e991);queues[_0x8e41('0x29')](_0x11e991);}catch(_0x519788){utils['error'](util['format']('[%s][index][queuecallerabandon]',_0x11e991['uniqueid']),_0x519788);}});ami['on'](_0x8e41('0x2b'),function(_0x5d47c5){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x2c'),_0x5d47c5[_0x8e41('0x22')]),_0x5d47c5);queues[_0x8e41('0x2b')](_0x5d47c5);recordings['queuecallerjoin'](_0x5d47c5);}catch(_0x1b62e0){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x2c'),_0x5d47c5[_0x8e41('0x22')]),_0x1b62e0);}});ami['on'](_0x8e41('0x2d'),function(_0x5e5e85){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x2e'),_0x5e5e85[_0x8e41('0x22')]),_0x5e5e85);queues[_0x8e41('0x2d')](_0x5e5e85);}catch(_0x3c606c){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x2e'),_0x5e5e85['uniqueid']),_0x3c606c);}});ami['on']('musiconholdstart',function(_0x40d802){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x2f'),_0x40d802[_0x8e41('0x22')]),_0x40d802);queues[_0x8e41('0x30')](_0x40d802);calls[_0x8e41('0x30')](_0x40d802);}catch(_0x608acb){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x2f'),_0x40d802[_0x8e41('0x22')]),_0x608acb);}});ami['on']('musiconholdstop',function(_0x2e2c2d){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x31'),_0x2e2c2d[_0x8e41('0x22')]),_0x2e2c2d);queues[_0x8e41('0x32')](_0x2e2c2d);calls[_0x8e41('0x32')](_0x2e2c2d);}catch(_0x249f0b){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x31'),_0x2e2c2d[_0x8e41('0x22')]),_0x249f0b);}});ami['on'](_0x8e41('0x33'),function(_0x578010){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x34'),_0x578010[_0x8e41('0x22')]),_0x578010);calls['newstate'](_0x578010);recordings['newstate'](_0x578010);}catch(_0x36acf1){utils[_0x8e41('0x18')](util['format'](_0x8e41('0x34'),_0x578010[_0x8e41('0x22')]),_0x36acf1);}});ami['on'](_0x8e41('0x35'),function(_0x842759){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x36'),_0x842759[_0x8e41('0x22')]),_0x842759);calls['hangup'](_0x842759);recordings[_0x8e41('0x35')](_0x842759);dials['hangup'](_0x842759);agents[_0x8e41('0x35')](_0x842759);queues[_0x8e41('0x35')](_0x842759);}catch(_0x2d89b3){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x36'),_0x842759[_0x8e41('0x22')]),_0x2d89b3);}});ami['on'](_0x8e41('0x37'),function(_0x107c0c){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x38'),_0x107c0c['uniqueid']),_0x107c0c);members[_0x8e41('0x37')](_0x107c0c);}catch(_0x2be2cd){utils['error'](util[_0x8e41('0x20')](_0x8e41('0x38'),_0x107c0c[_0x8e41('0x22')]),_0x2be2cd);}});ami['on'](_0x8e41('0x39'),function(_0xe4308e){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x3a'),_0xe4308e[_0x8e41('0x22')]),_0xe4308e);queues[_0x8e41('0x39')](_0xe4308e);agents['blindtransfer'](_0xe4308e);transfers[_0x8e41('0x39')](_0xe4308e);recordings['blindtransfer'](_0xe4308e);}catch(_0x3dab61){utils['error'](util[_0x8e41('0x20')](_0x8e41('0x3a'),_0xe4308e[_0x8e41('0x22')]),_0x3dab61);}});ami['on']('attendedtransfer',function(_0x401b22){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')]('[%s][index][attendedtransfer]',_0x401b22[_0x8e41('0x3b')]),_0x401b22);queues[_0x8e41('0x3c')](_0x401b22);transfers[_0x8e41('0x3c')](_0x401b22);agents[_0x8e41('0x3c')](_0x401b22);calls[_0x8e41('0x3c')](_0x401b22);}catch(_0x216954){utils[_0x8e41('0x18')](util['format']('[%s][index][attendedtransfer]',_0x401b22[_0x8e41('0x3b')]),_0x216954);}});ami['on'](_0x8e41('0x3d'),function(_0x4ce00f){try{utils['debug'](util[_0x8e41('0x20')](_0x8e41('0x3e'),_0x4ce00f[_0x8e41('0x22')]),_0x4ce00f);queues['varset'](_0x4ce00f);recordings[_0x8e41('0x3d')](_0x4ce00f);calls[_0x8e41('0x3d')](_0x4ce00f);dials[_0x8e41('0x3d')](_0x4ce00f);}catch(_0x4a9ded){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x3e'),_0x4ce00f[_0x8e41('0x22')]),_0x4a9ded);}});ami['on'](_0x8e41('0x3f'),function(_0x1a51ad){try{utils['debug'](util[_0x8e41('0x20')](_0x8e41('0x40'),_0x1a51ad['uniqueid']),_0x1a51ad);calls[_0x8e41('0x3f')](_0x1a51ad);recordings[_0x8e41('0x3f')](_0x1a51ad);dials['newexten'](_0x1a51ad);}catch(_0x86acea){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x40'),_0x1a51ad[_0x8e41('0x22')]),_0x86acea);}});ami['on'](_0x8e41('0x41'),function(_0x31b1ee){try{utils['debug'](util[_0x8e41('0x20')](_0x8e41('0x42'),_0x31b1ee[_0x8e41('0x22')]),_0x31b1ee);calls[_0x8e41('0x41')](_0x31b1ee);recordings[_0x8e41('0x41')](_0x31b1ee);}catch(_0x4979fb){utils[_0x8e41('0x18')](util['format'](_0x8e41('0x42'),_0x31b1ee[_0x8e41('0x22')]),_0x4979fb);}});ami['on'](_0x8e41('0x43'),function(_0x471729){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x44'),_0x471729['uniqueid']),_0x471729);dials[_0x8e41('0x43')](_0x471729);}catch(_0x5028da){utils['error'](util[_0x8e41('0x20')](_0x8e41('0x45'),_0x471729[_0x8e41('0x22')]),_0x5028da);}});ami['on'](_0x8e41('0x46'),function(_0x41df3e){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')]('[%s][index][dialend]',_0x41df3e[_0x8e41('0x22')]),_0x41df3e);dials[_0x8e41('0x46')](_0x41df3e);}catch(_0x1aeab8){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x47'),_0x41df3e[_0x8e41('0x22')]),_0x1aeab8);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index f56597b..dcd49d6 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 _0xb583=['BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','assign','data2','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data3','destinationchannel','util','Local/_attended@transfer','Queue:','format','uniqueid','interface','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE'];(function(_0x4ef32f,_0x53ceef){var _0xfe32bc=function(_0x577116){while(--_0x577116){_0x4ef32f['push'](_0x4ef32f['shift']());}};_0xfe32bc(++_0x53ceef);}(_0xb583,0x7b));var _0x3b58=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb583[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x3b58('0x0'));var utils=require('./utils');var members={};var exclude=[_0x3b58('0x1'),_0x3b58('0x2')];function writeDB(_0xdb9418){utils['info'](util[_0x3b58('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0xdb9418[_0x3b58('0x4')],_0xdb9418[_0x3b58('0x5')],_0xdb9418['channel'],_0xdb9418['data2'],_0xdb9418['membername'],_0xdb9418[_0x3b58('0x6')]));if(_0xdb9418[_0x3b58('0x5')]){utils[_0x3b58('0x7')](_0xdb9418[_0x3b58('0x5')])[_0x3b58('0x8')](function(_0x4895ea){if(_0x4895ea){_0xdb9418[_0x3b58('0x9')]=_0x4895ea[_0x3b58('0xa')];_0xdb9418[_0x3b58('0xb')]=_0x4895ea[_0x3b58('0xb')];utils[_0x3b58('0xc')](_0x3b58('0xd'),_0xdb9418);}else{utils[_0x3b58('0xe')](_0xdb9418[_0x3b58('0x5')][_0x3b58('0xf')]('/')[0x1])['then'](function(_0x16cd3e){if(_0x16cd3e){_0xdb9418['membername']=_0x16cd3e[_0x3b58('0xa')];_0xdb9418[_0x3b58('0xb')]=_0x16cd3e[_0x3b58('0xb')];utils['request'](_0x3b58('0xd'),_0xdb9418);}});}})[_0x3b58('0x10')](function(_0xd92267){utils[_0x3b58('0x11')](util['format']('[%s][members][writeDB]',_0xdb9418[_0x3b58('0x4')]),_0xd92267);});}delete members[_0xdb9418[_0x3b58('0x5')]];}function startsWith(_0x3b4302,_0x2b5994){return _[_0x3b58('0x12')](_0x3b4302,function(_0x161244){return _['startsWith'](_0x2b5994,_0x161244);});}exports[_0x3b58('0x13')]=function(_0x319e77){try{utils[_0x3b58('0x14')](util[_0x3b58('0x3')](_0x3b58('0x15'),members[_0x319e77[_0x3b58('0x16')]]?members[_0x319e77[_0x3b58('0x16')]][_0x3b58('0x4')]:_0x319e77['device']),_0x319e77);utils[_0x3b58('0x17')](util[_0x3b58('0x3')](_0x3b58('0x18'),members[_0x319e77[_0x3b58('0x16')]]?members[_0x319e77[_0x3b58('0x16')]][_0x3b58('0x4')]:_0x319e77[_0x3b58('0x16')],_0x319e77[_0x3b58('0x19')],_0x319e77['device']));switch(_0x319e77[_0x3b58('0x19')]){case _0x3b58('0x1a'):case _0x3b58('0x1b'):if(!startsWith(exclude,_0x319e77[_0x3b58('0x16')])){members[_0x319e77[_0x3b58('0x16')]]={'channel':_0x3b58('0x1c'),'interface':_0x319e77['device'],'type':_0x3b58('0x1d'),'enterAt':utils[_0x3b58('0x1e')](),'role':'agent'};}break;case _0x3b58('0x1f'):if(!_[_0x3b58('0x20')](members[_0x319e77[_0x3b58('0x16')]])){members[_0x319e77[_0x3b58('0x16')]][_0x3b58('0x21')]=utils['now']();members[_0x319e77[_0x3b58('0x16')]][_0x3b58('0x22')]=utils[_0x3b58('0x23')](members[_0x319e77['device']][_0x3b58('0x21')],members[_0x319e77[_0x3b58('0x16')]][_0x3b58('0x24')]);if(members[_0x319e77[_0x3b58('0x16')]][_0x3b58('0x4')]){writeDB(members[_0x319e77[_0x3b58('0x16')]]);}}break;default:break;}}catch(_0x372caf){utils[_0x3b58('0x11')](util[_0x3b58('0x3')](_0x3b58('0x15'),members[_0x319e77[_0x3b58('0x16')]]?members[_0x319e77[_0x3b58('0x16')]][_0x3b58('0x4')]:_0x319e77[_0x3b58('0x16')]),_0x372caf);}};exports['agentcomplete']=function(_0x3aa498){try{if(!_[_0x3b58('0x20')](members[_0x3aa498[_0x3b58('0x5')]])){utils[_0x3b58('0x14')](util['format']('[%s][members][agentcomplete]',_0x3aa498[_0x3b58('0x4')]),_0x3aa498);utils[_0x3b58('0x17')](util['format'](_0x3b58('0x25'),_0x3aa498[_0x3b58('0x4')],_0x3aa498['interface'],_0x3aa498['queue']));members[_0x3aa498[_0x3b58('0x5')]]=_['assign'](members[_0x3aa498[_0x3b58('0x5')]],{'data4':_0x3aa498['queue'],'uniqueid':_0x3aa498[_0x3b58('0x4')]});}}catch(_0x2d2bf5){utils['error'](util[_0x3b58('0x3')](_0x3b58('0x26'),_0x3aa498[_0x3b58('0x4')]),_0x2d2bf5);}};exports[_0x3b58('0x27')]=function(_0x4ddf06){try{utils[_0x3b58('0x14')](util[_0x3b58('0x3')](_0x3b58('0x28'),_0x4ddf06[_0x3b58('0x4')]),_0x4ddf06);if(_0x4ddf06[_0x3b58('0x29')]){var _0x2be41d=_0x4ddf06[_0x3b58('0x29')][_0x3b58('0xf')]('-')[0x0];if(!_['isNil'](members[_0x2be41d])){members[_0x2be41d]=_[_0x3b58('0x2a')](members[_0x2be41d],{'data1':members[_0x2be41d]['data1']||_0x4ddf06['type'],'data2':members[_0x2be41d][_0x3b58('0x2b')]||_0x4ddf06[_0x3b58('0x2c')],'data3':members[_0x2be41d]['data3']||_0x4ddf06[_0x3b58('0x2d')],'uniqueid':members[_0x2be41d][_0x3b58('0x4')]||_0x4ddf06[_0x3b58('0x4')]});utils[_0x3b58('0x17')](util[_0x3b58('0x3')](_0x3b58('0x2e'),_0x4ddf06[_0x3b58('0x4')],members[_0x2be41d][_0x3b58('0x2f')],members[_0x2be41d][_0x3b58('0x2b')],members[_0x2be41d][_0x3b58('0x30')]));if(members[_0x2be41d]['exitAt']){writeDB(members[_0x2be41d]);}}}if(_0x4ddf06[_0x3b58('0x31')]){var _0x3e34e8=_0x4ddf06[_0x3b58('0x31')][_0x3b58('0xf')]('-')[0x0];if(!_[_0x3b58('0x20')](members[_0x3e34e8])){members[_0x3e34e8]=_[_0x3b58('0x2a')](members[_0x3e34e8],{'data1':members[_0x3e34e8][_0x3b58('0x2f')]||_0x4ddf06['type'],'data2':members[_0x3e34e8]['data2']||_0x4ddf06[_0x3b58('0x2c')],'data3':members[_0x3e34e8]['data3']||_0x4ddf06[_0x3b58('0x2d')],'uniqueid':members[_0x3e34e8][_0x3b58('0x4')]||_0x4ddf06[_0x3b58('0x4')]});utils['info'](util[_0x3b58('0x3')](_0x3b58('0x2e'),_0x4ddf06[_0x3b58('0x4')],members[_0x3e34e8]['data1'],members[_0x3e34e8][_0x3b58('0x2b')],members[_0x3e34e8][_0x3b58('0x30')]));if(members[_0x3e34e8][_0x3b58('0x21')]){writeDB(members[_0x3e34e8]);}}}}catch(_0x4eec0b){utils[_0x3b58('0x11')](util[_0x3b58('0x3')](_0x3b58('0x28'),_0x4ddf06['uniqueid']),_0x4eec0b);}}; \ No newline at end of file +var _0x00d6=['info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','then','membername','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','some','startsWith','[%s][members][devicestatechange]','device','state','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','debug','[%s][members][cdr]','assign','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:'];(function(_0x39cccb,_0x10d5e4){var _0x2a2a81=function(_0x31cea8){while(--_0x31cea8){_0x39cccb['push'](_0x39cccb['shift']());}};_0x2a2a81(++_0x10d5e4);}(_0x00d6,0x1e5));var _0x600d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x00d6[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x600d('0x0'));var util=require(_0x600d('0x1'));var utils=require(_0x600d('0x2'));var members={};var exclude=[_0x600d('0x3'),_0x600d('0x4')];function writeDB(_0x255be3){utils[_0x600d('0x5')](util[_0x600d('0x6')](_0x600d('0x7'),_0x255be3[_0x600d('0x8')],_0x255be3[_0x600d('0x9')],_0x255be3[_0x600d('0xa')],_0x255be3[_0x600d('0xb')],_0x255be3['membername'],_0x255be3['type']));if(_0x255be3[_0x600d('0x9')]){utils['getUserByInterface'](_0x255be3[_0x600d('0x9')])[_0x600d('0xc')](function(_0x150acd){if(_0x150acd){_0x255be3[_0x600d('0xd')]=_0x150acd[_0x600d('0xe')];_0x255be3[_0x600d('0xf')]=_0x150acd[_0x600d('0xf')];utils[_0x600d('0x10')]('CreateMemberReport',_0x255be3);}else{utils[_0x600d('0x11')](_0x255be3[_0x600d('0x9')][_0x600d('0x12')]('/')[0x1])[_0x600d('0xc')](function(_0x1f23ee){if(_0x1f23ee){_0x255be3['membername']=_0x1f23ee['name'];_0x255be3[_0x600d('0xf')]=_0x1f23ee[_0x600d('0xf')];utils[_0x600d('0x10')](_0x600d('0x13'),_0x255be3);}});}})[_0x600d('0x14')](function(_0x207862){utils[_0x600d('0x15')](util[_0x600d('0x6')]('[%s][members][writeDB]',_0x255be3[_0x600d('0x8')]),_0x207862);});}delete members[_0x255be3[_0x600d('0x9')]];}function startsWith(_0xe9a89a,_0x15c76d){return _[_0x600d('0x16')](_0xe9a89a,function(_0x484cbd){return _[_0x600d('0x17')](_0x15c76d,_0x484cbd);});}exports['devicestatechange']=function(_0x35fd38){try{utils['debug'](util[_0x600d('0x6')](_0x600d('0x18'),members[_0x35fd38[_0x600d('0x19')]]?members[_0x35fd38[_0x600d('0x19')]][_0x600d('0x8')]:_0x35fd38['device']),_0x35fd38);utils['info'](util[_0x600d('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x35fd38['device']]?members[_0x35fd38[_0x600d('0x19')]]['uniqueid']:_0x35fd38[_0x600d('0x19')],_0x35fd38[_0x600d('0x1a')],_0x35fd38['device']));switch(_0x35fd38[_0x600d('0x1a')]){case'INUSE':case _0x600d('0x1b'):if(!startsWith(exclude,_0x35fd38[_0x600d('0x19')])){members[_0x35fd38['device']]={'channel':'voice','interface':_0x35fd38['device'],'type':_0x600d('0x1c'),'enterAt':utils[_0x600d('0x1d')](),'role':_0x600d('0x1e')};}break;case _0x600d('0x1f'):if(!_[_0x600d('0x20')](members[_0x35fd38['device']])){members[_0x35fd38['device']][_0x600d('0x21')]=utils[_0x600d('0x1d')]();members[_0x35fd38[_0x600d('0x19')]][_0x600d('0x22')]=utils['diffTime'](members[_0x35fd38[_0x600d('0x19')]]['exitAt'],members[_0x35fd38[_0x600d('0x19')]][_0x600d('0x23')]);if(members[_0x35fd38[_0x600d('0x19')]][_0x600d('0x8')]){writeDB(members[_0x35fd38['device']]);}}break;default:break;}}catch(_0x286153){utils[_0x600d('0x15')](util[_0x600d('0x6')](_0x600d('0x18'),members[_0x35fd38[_0x600d('0x19')]]?members[_0x35fd38[_0x600d('0x19')]]['uniqueid']:_0x35fd38['device']),_0x286153);}};exports['agentcomplete']=function(_0x569379){try{if(!_[_0x600d('0x20')](members[_0x569379['interface']])){utils['debug'](util[_0x600d('0x6')]('[%s][members][agentcomplete]',_0x569379['uniqueid']),_0x569379);utils[_0x600d('0x5')](util[_0x600d('0x6')](_0x600d('0x24'),_0x569379[_0x600d('0x8')],_0x569379[_0x600d('0x9')],_0x569379[_0x600d('0x25')]));members[_0x569379[_0x600d('0x9')]]=_['assign'](members[_0x569379[_0x600d('0x9')]],{'data4':_0x569379[_0x600d('0x25')],'uniqueid':_0x569379['uniqueid']});}}catch(_0xefb8c4){utils[_0x600d('0x15')](util[_0x600d('0x6')]('[%s][members][agentcomplete]',_0x569379[_0x600d('0x8')]),_0xefb8c4);}};exports[_0x600d('0x26')]=function(_0x403030){try{utils[_0x600d('0x27')](util[_0x600d('0x6')](_0x600d('0x28'),_0x403030[_0x600d('0x8')]),_0x403030);if(_0x403030[_0x600d('0xa')]){var _0x21fb3d=_0x403030[_0x600d('0xa')][_0x600d('0x12')]('-')[0x0];if(!_['isNil'](members[_0x21fb3d])){members[_0x21fb3d]=_[_0x600d('0x29')](members[_0x21fb3d],{'data1':members[_0x21fb3d][_0x600d('0x2a')]||_0x403030[_0x600d('0x2b')],'data2':members[_0x21fb3d][_0x600d('0xb')]||_0x403030[_0x600d('0x2c')],'data3':members[_0x21fb3d][_0x600d('0x2d')]||_0x403030[_0x600d('0x2e')],'uniqueid':members[_0x21fb3d][_0x600d('0x8')]||_0x403030['uniqueid']});utils['info'](util[_0x600d('0x6')](_0x600d('0x2f'),_0x403030['uniqueid'],members[_0x21fb3d][_0x600d('0x2a')],members[_0x21fb3d][_0x600d('0xb')],members[_0x21fb3d]['data3']));if(members[_0x21fb3d][_0x600d('0x21')]){writeDB(members[_0x21fb3d]);}}}if(_0x403030[_0x600d('0x30')]){var _0x2b577a=_0x403030[_0x600d('0x30')]['split']('-')[0x0];if(!_[_0x600d('0x20')](members[_0x2b577a])){members[_0x2b577a]=_['assign'](members[_0x2b577a],{'data1':members[_0x2b577a][_0x600d('0x2a')]||_0x403030['type'],'data2':members[_0x2b577a]['data2']||_0x403030[_0x600d('0x2c')],'data3':members[_0x2b577a][_0x600d('0x2d')]||_0x403030['destination'],'uniqueid':members[_0x2b577a][_0x600d('0x8')]||_0x403030[_0x600d('0x8')]});utils[_0x600d('0x5')](util[_0x600d('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x403030[_0x600d('0x8')],members[_0x2b577a][_0x600d('0x2a')],members[_0x2b577a][_0x600d('0xb')],members[_0x2b577a][_0x600d('0x2d')]));if(members[_0x2b577a][_0x600d('0x21')]){writeDB(members[_0x2b577a]);}}}}catch(_0x251097){utils['error'](util[_0x600d('0x6')](_0x600d('0x28'),_0x403030[_0x600d('0x8')]),_0x251097);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 44bf93d..28835de 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 _0x7e7d=['queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','value','[%s][queues][varset]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerleaveAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','info','uniqueid','channel','calleridnum','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s'];(function(_0x1e3fc7,_0xa66c17){var _0x2aef56=function(_0x356278){while(--_0x356278){_0x1e3fc7['push'](_0x1e3fc7['shift']());}};_0x2aef56(++_0xa66c17);}(_0x7e7d,0xa2));var _0xd7e7=function(_0x26d54c,_0xa63fa7){_0x26d54c=_0x26d54c-0x0;var _0x3848ef=_0x7e7d[_0x26d54c];return _0x3848ef;};'use strict';var _=require(_0xd7e7('0x0'));var util=require(_0xd7e7('0x1'));var utils=require(_0xd7e7('0x2'));var queues={};function writeDB(_0x3021c1){utils[_0xd7e7('0x3')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x3021c1[_0xd7e7('0x4')],_0x3021c1[_0xd7e7('0x5')],_0x3021c1['queue'],_0x3021c1['lastAssignedTo'],_0x3021c1[_0xd7e7('0x6')],_0x3021c1['accountcode'],_0x3021c1[_0xd7e7('0x7')]));if(_0x3021c1[_0xd7e7('0x8')]){utils[_0xd7e7('0x9')](_0x3021c1[_0xd7e7('0x8')])['then'](function(_0x144788){if(_0x144788){_0x3021c1[_0xd7e7('0xa')]=_0x144788[_0xd7e7('0xa')];}utils[_0xd7e7('0xb')](_0xd7e7('0xc'),_0x3021c1);});}else{utils['request']('CreateVoiceQueueReport',_0x3021c1);}if(_0x3021c1[_0xd7e7('0xd')]){delete queues[_0x3021c1[_0xd7e7('0xd')]];}else{delete queues[_0x3021c1['uniqueid']];}}exports[_0xd7e7('0xe')]=function(_0x3c7ebd){try{utils[_0xd7e7('0xf')](util['format']('[%s][queues][queuecallerjoin]',_0x3c7ebd[_0xd7e7('0x4')]),_0x3c7ebd);utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')](_0xd7e7('0x11'),_0x3c7ebd[_0xd7e7('0x4')],_0x3c7ebd[_0xd7e7('0x8')],_0x3c7ebd[_0xd7e7('0x12')]));queues[_0x3c7ebd[_0xd7e7('0x4')]]=_[_0xd7e7('0x13')](_0x3c7ebd,{'originalposition':_0x3c7ebd[_0xd7e7('0x12')],'queuecallerjoinAt':utils[_0xd7e7('0x14')](),'mohtime':0x0});}catch(_0x1fc746){utils[_0xd7e7('0x15')](util[_0xd7e7('0x10')](_0xd7e7('0x16'),_0x3c7ebd[_0xd7e7('0x4')]),_0x1fc746);}};exports[_0xd7e7('0x17')]=function(_0x30bd00){try{if(!_[_0xd7e7('0x18')](queues[_0x30bd00[_0xd7e7('0x4')]])){utils[_0xd7e7('0xf')](util[_0xd7e7('0x10')](_0xd7e7('0x19'),_0x30bd00[_0xd7e7('0x4')]),_0x30bd00);if(queues[_0x30bd00[_0xd7e7('0x4')]]['queuecallerleaveAt']){if(!queues[_0x30bd00[_0xd7e7('0x4')]][_0xd7e7('0x1a')]&&!queues[_0x30bd00[_0xd7e7('0x4')]][_0xd7e7('0x1b')]){queues[_0x30bd00['uniqueid']][_0xd7e7('0x1c')]=!![];queues[_0x30bd00[_0xd7e7('0x4')]][_0xd7e7('0x1d')]=utils[_0xd7e7('0x14')]();queues[_0x30bd00[_0xd7e7('0x4')]][_0xd7e7('0x7')]=_0xd7e7('0x1e');}utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x30bd00['uniqueid'],queues[_0x30bd00[_0xd7e7('0x4')]][_0xd7e7('0x1f')],queues[_0x30bd00[_0xd7e7('0x4')]][_0xd7e7('0x7')]));writeDB(queues[_0x30bd00['uniqueid']]);}else if(queues[_0x30bd00[_0xd7e7('0x4')]][_0xd7e7('0xd')]){utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')](_0xd7e7('0x20'),_0x30bd00[_0xd7e7('0x4')],queues[_0x30bd00[_0xd7e7('0x4')]][_0xd7e7('0x1f')],queues[_0x30bd00[_0xd7e7('0x4')]][_0xd7e7('0xd')]));queues[queues[_0x30bd00[_0xd7e7('0x4')]][_0xd7e7('0xd')]]=queues[_0x30bd00[_0xd7e7('0x4')]];queues[queues[_0x30bd00['uniqueid']][_0xd7e7('0xd')]][_0xd7e7('0x21')]=0x2;delete queues[_0x30bd00[_0xd7e7('0x4')]];}}}catch(_0x529de7){utils[_0xd7e7('0x15')](util[_0xd7e7('0x10')](_0xd7e7('0x19'),_0x30bd00[_0xd7e7('0x4')]),_0x529de7);}};exports[_0xd7e7('0x22')]=function(_0x40fc8b){try{utils[_0xd7e7('0xf')](util['format']('[%s][queues][varset]',_0x40fc8b['uniqueid']),_0x40fc8b);if(!_[_0xd7e7('0x18')](_0x40fc8b[_0xd7e7('0x23')][_0xd7e7('0x24')])&&_0x40fc8b['value']['toUpperCase']()!==_0xd7e7('0x25')){if(!_['isNil'](queues[_0x40fc8b['uniqueid']])){queues[_0x40fc8b[_0xd7e7('0x4')]]['queuecallerabandon']=![];queues[_0x40fc8b[_0xd7e7('0x4')]][_0xd7e7('0x26')]=null;queues[_0x40fc8b[_0xd7e7('0x4')]][_0xd7e7('0x1b')]=!![];queues[_0x40fc8b['uniqueid']][_0xd7e7('0x27')]=utils[_0xd7e7('0x14')]();queues[_0x40fc8b['uniqueid']][_0xd7e7('0x7')]=_0x40fc8b['value'][_0xd7e7('0x28')]();utils['info'](util['format'](_0xd7e7('0x29'),_0x40fc8b[_0xd7e7('0x4')],queues[_0x40fc8b[_0xd7e7('0x4')]][_0xd7e7('0x1f')],_0x40fc8b['value'],queues[_0x40fc8b[_0xd7e7('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x40fc8b[_0xd7e7('0x4')]]);}}else if(!_[_0xd7e7('0x18')](_0x40fc8b[_0xd7e7('0x23')][_0xd7e7('0x2a')])){if(!_['isNil'](queues[_0x40fc8b[_0xd7e7('0x4')]])&&!queues[_0x40fc8b[_0xd7e7('0x4')]]['queuecallerabandon']){queues[_0x40fc8b['uniqueid']][_0xd7e7('0x1a')]=![];queues[_0x40fc8b[_0xd7e7('0x4')]][_0xd7e7('0x26')]=null;queues[_0x40fc8b[_0xd7e7('0x4')]][_0xd7e7('0x1b')]=!![];queues[_0x40fc8b[_0xd7e7('0x4')]][_0xd7e7('0x27')]=utils[_0xd7e7('0x14')]();queues[_0x40fc8b[_0xd7e7('0x4')]][_0xd7e7('0x7')]=_0xd7e7('0x2b');utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')](_0xd7e7('0x2c'),_0x40fc8b[_0xd7e7('0x4')],queues[_0x40fc8b[_0xd7e7('0x4')]][_0xd7e7('0x1f')],_0x40fc8b[_0xd7e7('0x2d')],queues[_0x40fc8b[_0xd7e7('0x4')]]['queuecallerexitreason']));}}}catch(_0x1effc3){utils[_0xd7e7('0x15')](util[_0xd7e7('0x10')](_0xd7e7('0x2e'),_0x40fc8b[_0xd7e7('0x4')]),_0x1effc3);}};exports[_0xd7e7('0x1a')]=function(_0x264f33){try{if(!_[_0xd7e7('0x18')](queues[_0x264f33[_0xd7e7('0x4')]])){utils['debug'](util[_0xd7e7('0x10')]('[%s][queues][queuecallerabandon]',_0x264f33['uniqueid']),_0x264f33);queues[_0x264f33['uniqueid']][_0xd7e7('0x1b')]=![];queues[_0x264f33[_0xd7e7('0x4')]]['queuecallerexitAt']=null;queues[_0x264f33['uniqueid']]['queuecallerabandon']=!![];queues[_0x264f33[_0xd7e7('0x4')]][_0xd7e7('0x26')]=utils['now']();queues[_0x264f33[_0xd7e7('0x4')]][_0xd7e7('0x7')]='ABANDONED';utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')](_0xd7e7('0x2f'),_0x264f33[_0xd7e7('0x4')],queues[_0x264f33[_0xd7e7('0x4')]][_0xd7e7('0x1f')],queues[_0x264f33[_0xd7e7('0x4')]]['queuecallerexitreason']));}}catch(_0x560047){utils['error'](util[_0xd7e7('0x10')](_0xd7e7('0x30'),_0x264f33[_0xd7e7('0x4')]),_0x560047);}};exports[_0xd7e7('0x31')]=function(_0x435f2c){try{if(!_['isNil'](queues[_0x435f2c[_0xd7e7('0x4')]])){utils[_0xd7e7('0xf')](util[_0xd7e7('0x10')](_0xd7e7('0x32'),_0x435f2c[_0xd7e7('0x4')]),_0x435f2c);utils[_0xd7e7('0x3')](util['format'](_0xd7e7('0x33'),_0x435f2c[_0xd7e7('0x4')],queues[_0x435f2c[_0xd7e7('0x4')]][_0xd7e7('0x1f')],_0x435f2c[_0xd7e7('0x34')],_0x435f2c[_0xd7e7('0x35')]));queues[_0x435f2c[_0xd7e7('0x4')]][_0xd7e7('0x31')]=!![];queues[_0x435f2c[_0xd7e7('0x4')]]['queuecallerleaveAt']=utils[_0xd7e7('0x14')]();queues[_0x435f2c[_0xd7e7('0x4')]][_0xd7e7('0x36')]=utils[_0xd7e7('0x37')](queues[_0x435f2c[_0xd7e7('0x4')]]['queuecallerleaveAt'],queues[_0x435f2c[_0xd7e7('0x4')]][_0xd7e7('0x38')]);queues[_0x435f2c['uniqueid']]['position']=_0x435f2c['position'];queues[_0x435f2c[_0xd7e7('0x4')]]['count']=_0x435f2c['count'];queues[_0x435f2c[_0xd7e7('0x4')]][_0xd7e7('0x34')]=_0x435f2c[_0xd7e7('0x34')];queues[_0x435f2c['uniqueid']][_0xd7e7('0x35')]=_0x435f2c[_0xd7e7('0x35')];}}catch(_0x21cf14){utils[_0xd7e7('0x15')](util[_0xd7e7('0x10')](_0xd7e7('0x32'),_0x435f2c['uniqueid']),_0x21cf14);}};exports[_0xd7e7('0x39')]=function(_0xcf0350){try{if(!_[_0xd7e7('0x18')](queues[_0xcf0350[_0xd7e7('0x4')]])){utils[_0xd7e7('0xf')](util[_0xd7e7('0x10')](_0xd7e7('0x3a'),_0xcf0350[_0xd7e7('0x4')]),_0xcf0350);utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')](_0xd7e7('0x3b'),_0xcf0350[_0xd7e7('0x4')],queues[_0xcf0350[_0xd7e7('0x4')]][_0xd7e7('0x1f')],_0xcf0350[_0xd7e7('0x3c')],_0xcf0350[_0xd7e7('0x3d')]));queues[_0xcf0350['uniqueid']][_0xd7e7('0x1a')]=![];queues[_0xcf0350[_0xd7e7('0x4')]]['queuecallerabandon']=![];queues[_0xcf0350['uniqueid']]['queuecallerabandonAt']=null;queues[_0xcf0350[_0xd7e7('0x4')]][_0xd7e7('0x1b')]=![];queues[_0xcf0350['uniqueid']]['queuecallerexitreason']=null;queues[_0xcf0350[_0xd7e7('0x4')]][_0xd7e7('0x27')]=null;queues[_0xcf0350['uniqueid']][_0xd7e7('0x3e')]=!![];queues[_0xcf0350[_0xd7e7('0x4')]]['accountcode']=_0xcf0350[_0xd7e7('0x3d')];queues[_0xcf0350[_0xd7e7('0x4')]][_0xd7e7('0x3f')]=_0xcf0350[_0xd7e7('0x3c')];}}catch(_0x1825be){utils[_0xd7e7('0x15')](util[_0xd7e7('0x10')]('[%s][queues][agentconnect]',_0xcf0350[_0xd7e7('0x4')]),_0x1825be);}};exports[_0xd7e7('0x40')]=function(_0x3494be){try{if(!_[_0xd7e7('0x18')](queues[_0x3494be[_0xd7e7('0x4')]])){if(queues[_0x3494be[_0xd7e7('0x4')]]['queuecallerleaveAt']){utils[_0xd7e7('0xf')](util[_0xd7e7('0x10')](_0xd7e7('0x41'),_0x3494be[_0xd7e7('0x4')]),_0x3494be);queues[_0x3494be[_0xd7e7('0x4')]][_0xd7e7('0x1a')]=![];queues[_0x3494be[_0xd7e7('0x4')]]['queuecallerabandon']=![];queues[_0x3494be[_0xd7e7('0x4')]][_0xd7e7('0x26')]=null;queues[_0x3494be[_0xd7e7('0x4')]][_0xd7e7('0x1b')]=![];queues[_0x3494be['uniqueid']][_0xd7e7('0x27')]=null;queues[_0x3494be[_0xd7e7('0x4')]]['assigned']=!![];queues[_0x3494be[_0xd7e7('0x4')]][_0xd7e7('0x3f')]=_0x3494be[_0xd7e7('0x3c')];queues[_0x3494be[_0xd7e7('0x4')]][_0xd7e7('0x1c')]=!![];queues[_0x3494be[_0xd7e7('0x4')]][_0xd7e7('0x1d')]=utils['now']();if(_0x3494be[_0xd7e7('0x42')]==_0xd7e7('0x43')){if(!queues[_0x3494be[_0xd7e7('0x4')]][_0xd7e7('0x43')]){queues[_0x3494be[_0xd7e7('0x4')]][_0xd7e7('0x7')]=_0xd7e7('0x44');}}else{queues[_0x3494be['uniqueid']][_0xd7e7('0x7')]='COMPLETEDBY'+_0x3494be['reason'][_0xd7e7('0x28')]();}utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')](_0xd7e7('0x45'),_0x3494be[_0xd7e7('0x4')],queues[_0x3494be['uniqueid']][_0xd7e7('0x1f')],_0x3494be['membername'],queues[_0x3494be['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x3494be[_0xd7e7('0x4')]]);}}}catch(_0x1291d3){utils['error'](util[_0xd7e7('0x10')]('[%s][queues][agentcomplete]',_0x3494be[_0xd7e7('0x4')]),_0x1291d3);}};exports[_0xd7e7('0x46')]=function(_0xe32a7c){try{if(!_['isNil'](queues[_0xe32a7c['transfereeuniqueid']])){utils[_0xd7e7('0xf')](util[_0xd7e7('0x10')](_0xd7e7('0x47'),_0xe32a7c[_0xd7e7('0x4')]),_0xe32a7c);queues[_0xe32a7c[_0xd7e7('0x48')]][_0xd7e7('0x43')]=!![];queues[_0xe32a7c[_0xd7e7('0x48')]][_0xd7e7('0x49')]=_0xd7e7('0x4a');queues[_0xe32a7c[_0xd7e7('0x48')]][_0xd7e7('0x4b')]=_0xe32a7c[_0xd7e7('0x4c')];queues[_0xe32a7c['transfereeuniqueid']][_0xd7e7('0x4d')]=_0xe32a7c[_0xd7e7('0x48')];queues[_0xe32a7c[_0xd7e7('0x48')]][_0xd7e7('0x7')]='BLINDTRANSFER';utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xe32a7c[_0xd7e7('0x4')],queues[_0xe32a7c['transfereeuniqueid']]['name'],_0xe32a7c[_0xd7e7('0x48')],_0xe32a7c[_0xd7e7('0x4c')]));}}catch(_0x47526c){utils['error'](util[_0xd7e7('0x10')]('[%s][queues][blindtransfer]',_0xe32a7c[_0xd7e7('0x4')]),_0x47526c);}};exports['attendedtransfer']=function(_0x59a4ed){try{utils[_0xd7e7('0xf')](util['format']('[%s][queues][attendedtransfer]',_0x59a4ed[_0xd7e7('0x4e')]),_0x59a4ed);if(_0x59a4ed[_0xd7e7('0x4e')]==_0x59a4ed[_0xd7e7('0x4f')]){if(!_[_0xd7e7('0x18')](queues[_0x59a4ed[_0xd7e7('0x50')]])){utils[_0xd7e7('0x3')](util['format'](_0xd7e7('0x51'),_0x59a4ed['origtransfereruniqueid'],queues[_0x59a4ed[_0xd7e7('0x50')]][_0xd7e7('0x1f')],_0x59a4ed[_0xd7e7('0x52')]));queues[_0x59a4ed[_0xd7e7('0x50')]]['transfer']=!![];queues[_0x59a4ed[_0xd7e7('0x50')]]['transfertype']=_0xd7e7('0x53');queues[_0x59a4ed[_0xd7e7('0x50')]][_0xd7e7('0x4b')]=_0x59a4ed[_0xd7e7('0x52')];queues[_0x59a4ed[_0xd7e7('0x50')]][_0xd7e7('0x4d')]=_0x59a4ed['origtransfereruniqueid'];queues[_0x59a4ed['secondtransfererlinkedid']][_0xd7e7('0x7')]='ATTENDEDTRANSFER';}if(!_[_0xd7e7('0x18')](queues[_0x59a4ed[_0xd7e7('0x4f')]])){if(_0x59a4ed[_0xd7e7('0x54')]&&queues[_0x59a4ed[_0xd7e7('0x54')]]){queues[_0x59a4ed['transfereelinkedid']][_0xd7e7('0x21')]=0x1;queues[_0x59a4ed['transfereeuniqueid']]=_['clone'](queues[_0x59a4ed[_0xd7e7('0x54')]]);queues[_0x59a4ed['transfereeuniqueid']][_0xd7e7('0xd')]=_0x59a4ed[_0xd7e7('0x55')];queues[_0x59a4ed[_0xd7e7('0x48')]][_0xd7e7('0x21')]=0x2;queues[_0x59a4ed['transfereeuniqueid']][_0xd7e7('0x6')]=queues[_0x59a4ed[_0xd7e7('0x50')]][_0xd7e7('0x6')];queues[_0x59a4ed[_0xd7e7('0x48')]][_0xd7e7('0x56')]=queues[_0x59a4ed[_0xd7e7('0x50')]][_0xd7e7('0x56')];queues[_0x59a4ed['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xd7e7('0x14')]();queues[_0x59a4ed['transfereeuniqueid']][_0xd7e7('0x57')]=utils[_0xd7e7('0x14')]();queues[_0x59a4ed[_0xd7e7('0x48')]][_0xd7e7('0x36')]=0x0;queues[_0x59a4ed[_0xd7e7('0x48')]][_0xd7e7('0x58')]=0x0;utils['info'](util[_0xd7e7('0x10')](_0xd7e7('0x59'),_0x59a4ed[_0xd7e7('0x4e')],queues[_0x59a4ed['transfereeuniqueid']]['name'],queues[_0x59a4ed[_0xd7e7('0x48')]][_0xd7e7('0x6')],queues[_0x59a4ed[_0xd7e7('0x48')]][_0xd7e7('0x56')]));}else{utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')](_0xd7e7('0x5a'),_0x59a4ed['origtransfereruniqueid'],queues[_0x59a4ed[_0xd7e7('0x4f')]][_0xd7e7('0x1f')],_0x59a4ed[_0xd7e7('0x50')]));queues[_0x59a4ed[_0xd7e7('0x4f')]]['transfereduniqueid']=_0x59a4ed[_0xd7e7('0x50')];}}}else if(_0x59a4ed['secondtransfereruniqueid']==_0x59a4ed[_0xd7e7('0x50')]){if(!_[_0xd7e7('0x18')](queues[_0x59a4ed['origtransfererlinkedid']])){utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')](_0xd7e7('0x5b'),_0x59a4ed[_0xd7e7('0x4e')],queues[_0x59a4ed[_0xd7e7('0x4f')]]['name'],_0x59a4ed['secondtransfereruniqueid'],_0x59a4ed[_0xd7e7('0x5c')]));queues[_0x59a4ed[_0xd7e7('0x4f')]][_0xd7e7('0x43')]=!![];queues[_0x59a4ed[_0xd7e7('0x4f')]][_0xd7e7('0x49')]=_0xd7e7('0x53');queues[_0x59a4ed[_0xd7e7('0x4f')]][_0xd7e7('0x4b')]=_0x59a4ed[_0xd7e7('0x5c')];queues[_0x59a4ed[_0xd7e7('0x4f')]]['transferuniqueid']=_0x59a4ed['secondtransfereruniqueid'];queues[_0x59a4ed[_0xd7e7('0x4f')]][_0xd7e7('0x7')]=_0xd7e7('0x5d');}if(!_['isNil'](queues[_0x59a4ed[_0xd7e7('0x50')]])){if(_0x59a4ed[_0xd7e7('0x5e')]&&queues[_0x59a4ed['transfertargetlinkedid']]){queues[_0x59a4ed[_0xd7e7('0x5e')]][_0xd7e7('0x21')]=0x1;queues[_0x59a4ed[_0xd7e7('0x55')]]=_['clone'](queues[_0x59a4ed[_0xd7e7('0x5e')]]);queues[_0x59a4ed[_0xd7e7('0x55')]][_0xd7e7('0xd')]=_0x59a4ed[_0xd7e7('0x55')];queues[_0x59a4ed['transfertargetuniqueid']][_0xd7e7('0x21')]=0x2;queues[_0x59a4ed[_0xd7e7('0x55')]][_0xd7e7('0x6')]=queues[_0x59a4ed[_0xd7e7('0x4f')]][_0xd7e7('0x6')];queues[_0x59a4ed[_0xd7e7('0x55')]][_0xd7e7('0x56')]=queues[_0x59a4ed[_0xd7e7('0x4f')]][_0xd7e7('0x56')];queues[_0x59a4ed[_0xd7e7('0x55')]]['queuecallerjoinAt']=utils[_0xd7e7('0x14')]();queues[_0x59a4ed['transfertargetuniqueid']][_0xd7e7('0x57')]=utils[_0xd7e7('0x14')]();queues[_0x59a4ed[_0xd7e7('0x55')]][_0xd7e7('0x36')]=0x0;queues[_0x59a4ed[_0xd7e7('0x55')]][_0xd7e7('0x58')]=0x0;utils['info'](util[_0xd7e7('0x10')](_0xd7e7('0x5f'),_0x59a4ed['origtransfereruniqueid'],queues[_0x59a4ed[_0xd7e7('0x55')]]['name'],queues[_0x59a4ed[_0xd7e7('0x55')]]['transfereduniqueid'],queues[_0x59a4ed[_0xd7e7('0x55')]]['calleridnum'],queues[_0x59a4ed[_0xd7e7('0x55')]]['calleridname']));}else{utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')](_0xd7e7('0x5a'),_0x59a4ed[_0xd7e7('0x4e')],queues[_0x59a4ed[_0xd7e7('0x50')]][_0xd7e7('0x1f')],_0x59a4ed[_0xd7e7('0x4f')]));queues[_0x59a4ed[_0xd7e7('0x50')]]['transfereduniqueid']=_0x59a4ed[_0xd7e7('0x4f')];}}}}catch(_0x48e7c1){utils[_0xd7e7('0x15')](util[_0xd7e7('0x10')](_0xd7e7('0x60'),_0x59a4ed[_0xd7e7('0x4e')]),_0x48e7c1);}};exports['musiconholdstart']=function(_0x44124c){try{if(!_['isNil'](queues[_0x44124c['uniqueid']])){utils['debug'](util[_0xd7e7('0x10')](_0xd7e7('0x61'),_0x44124c[_0xd7e7('0x4')]),_0x44124c);queues[_0x44124c[_0xd7e7('0x4')]]['musiconholdstartAt']=utils['now']();utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')](_0xd7e7('0x62'),_0x44124c['uniqueid'],queues[_0x44124c[_0xd7e7('0x4')]][_0xd7e7('0x1f')],queues[_0x44124c[_0xd7e7('0x4')]][_0xd7e7('0x63')]));}}catch(_0x551d38){utils[_0xd7e7('0x15')](util['format']('[%s][queues][musiconholdstart]',_0x44124c[_0xd7e7('0x4')]),_0x551d38);}};exports[_0xd7e7('0x64')]=function(_0x385016){try{if(!_['isNil'](queues[_0x385016[_0xd7e7('0x4')]])){if(!_[_0xd7e7('0x18')](queues[_0x385016['uniqueid']][_0xd7e7('0x63')])){utils[_0xd7e7('0xf')](util[_0xd7e7('0x10')]('[%s][queues][musiconholdstop]',_0x385016[_0xd7e7('0x4')]),_0x385016);queues[_0x385016[_0xd7e7('0x4')]]['mohtime']+=utils[_0xd7e7('0x37')](utils[_0xd7e7('0x14')](),queues[_0x385016[_0xd7e7('0x4')]][_0xd7e7('0x63')]);utils[_0xd7e7('0x3')](util[_0xd7e7('0x10')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x385016[_0xd7e7('0x4')],queues[_0x385016['uniqueid']][_0xd7e7('0x1f')],queues[_0x385016[_0xd7e7('0x4')]][_0xd7e7('0x58')]));delete queues[_0x385016[_0xd7e7('0x4')]][_0xd7e7('0x63')];}}}catch(_0x57c30d){utils[_0xd7e7('0x15')](util[_0xd7e7('0x10')](_0xd7e7('0x65'),_0x385016[_0xd7e7('0x4')]),_0x57c30d);}}; \ No newline at end of file +var _0x13bf=['request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','[%s][queues][queuecallerjoin]','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','origtransfererlinkedid','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','then','type'];(function(_0x516a8c,_0x3446a1){var _0x305378=function(_0x5b1698){while(--_0x5b1698){_0x516a8c['push'](_0x516a8c['shift']());}};_0x305378(++_0x3446a1);}(_0x13bf,0x184));var _0xf13b=function(_0x2f71b0,_0x5027cc){_0x2f71b0=_0x2f71b0-0x0;var _0x49e237=_0x13bf[_0x2f71b0];return _0x49e237;};'use strict';var _=require('lodash');var util=require(_0xf13b('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x3280a2){utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x3'),_0x3280a2[_0xf13b('0x4')],_0x3280a2[_0xf13b('0x5')],_0x3280a2[_0xf13b('0x6')],_0x3280a2['lastAssignedTo'],_0x3280a2[_0xf13b('0x7')],_0x3280a2[_0xf13b('0x8')],_0x3280a2[_0xf13b('0x9')]));if(_0x3280a2[_0xf13b('0x6')]){utils['getVoiceQueueByName'](_0x3280a2[_0xf13b('0x6')])[_0xf13b('0xa')](function(_0xf6ab39){if(_0xf6ab39){_0x3280a2['type']=_0xf6ab39[_0xf13b('0xb')];}utils[_0xf13b('0xc')](_0xf13b('0xd'),_0x3280a2);});}else{utils['request'](_0xf13b('0xd'),_0x3280a2);}if(_0x3280a2[_0xf13b('0xe')]){delete queues[_0x3280a2['transfereduniqueid']];}else{delete queues[_0x3280a2[_0xf13b('0x4')]];}}exports['queuecallerjoin']=function(_0x39c0fa){try{utils[_0xf13b('0xf')](util['format']('[%s][queues][queuecallerjoin]',_0x39c0fa[_0xf13b('0x4')]),_0x39c0fa);utils['info'](util['format'](_0xf13b('0x10'),_0x39c0fa[_0xf13b('0x4')],_0x39c0fa[_0xf13b('0x6')],_0x39c0fa[_0xf13b('0x11')]));queues[_0x39c0fa[_0xf13b('0x4')]]=_['assign'](_0x39c0fa,{'originalposition':_0x39c0fa['position'],'queuecallerjoinAt':utils[_0xf13b('0x12')](),'mohtime':0x0});}catch(_0x9e5334){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x14'),_0x39c0fa[_0xf13b('0x4')]),_0x9e5334);}};exports['hangup']=function(_0x126439){try{if(!_['isNil'](queues[_0x126439[_0xf13b('0x4')]])){utils['debug'](util['format'](_0xf13b('0x15'),_0x126439[_0xf13b('0x4')]),_0x126439);if(queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x16')]){if(!queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x17')]&&!queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x18')]){queues[_0x126439[_0xf13b('0x4')]]['queuecallercomplete']=!![];queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x19')]=utils[_0xf13b('0x12')]();queues[_0x126439['uniqueid']][_0xf13b('0x9')]=_0xf13b('0x1a');}utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x1b'),_0x126439['uniqueid'],queues[_0x126439['uniqueid']][_0xf13b('0x1c')],queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x9')]));writeDB(queues[_0x126439[_0xf13b('0x4')]]);}else if(queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0xe')]){utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x1d'),_0x126439[_0xf13b('0x4')],queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x1c')],queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0xe')]));queues[queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0xe')]]=queues[_0x126439['uniqueid']];queues[queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0xe')]][_0xf13b('0x1e')]=0x2;delete queues[_0x126439[_0xf13b('0x4')]];}}}catch(_0x3a7df5){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x15'),_0x126439[_0xf13b('0x4')]),_0x3a7df5);}};exports[_0xf13b('0x1f')]=function(_0x3b91be){try{utils[_0xf13b('0xf')](util['format'](_0xf13b('0x20'),_0x3b91be['uniqueid']),_0x3b91be);if(!_[_0xf13b('0x21')](_0x3b91be[_0xf13b('0x22')][_0xf13b('0x23')])&&_0x3b91be[_0xf13b('0x24')][_0xf13b('0x25')]()!==_0xf13b('0x26')){if(!_[_0xf13b('0x21')](queues[_0x3b91be[_0xf13b('0x4')]])){queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x17')]=![];queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x27')]=null;queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x18')]=!![];queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x28')]=utils[_0xf13b('0x12')]();queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x9')]=_0x3b91be[_0xf13b('0x24')]['toUpperCase']();utils[_0xf13b('0x1')](util['format'](_0xf13b('0x29'),_0x3b91be[_0xf13b('0x4')],queues[_0x3b91be['uniqueid']][_0xf13b('0x1c')],_0x3b91be[_0xf13b('0x24')],queues[_0x3b91be['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x3b91be[_0xf13b('0x4')]]);}}else if(!_['isNil'](_0x3b91be[_0xf13b('0x22')]['queueposition'])){if(!_[_0xf13b('0x21')](queues[_0x3b91be[_0xf13b('0x4')]])&&!queues[_0x3b91be['uniqueid']][_0xf13b('0x17')]){queues[_0x3b91be['uniqueid']][_0xf13b('0x17')]=![];queues[_0x3b91be['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3b91be['uniqueid']][_0xf13b('0x18')]=!![];queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x28')]=utils[_0xf13b('0x12')]();queues[_0x3b91be[_0xf13b('0x4')]]['queuecallerexitreason']=_0xf13b('0x2a');utils['info'](util[_0xf13b('0x2')](_0xf13b('0x2b'),_0x3b91be[_0xf13b('0x4')],queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x1c')],_0x3b91be[_0xf13b('0x24')],queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x9')]));}}}catch(_0x518079){utils['error'](util[_0xf13b('0x2')](_0xf13b('0x20'),_0x3b91be[_0xf13b('0x4')]),_0x518079);}};exports[_0xf13b('0x17')]=function(_0x29e939){try{if(!_[_0xf13b('0x21')](queues[_0x29e939[_0xf13b('0x4')]])){utils[_0xf13b('0xf')](util[_0xf13b('0x2')](_0xf13b('0x2c'),_0x29e939[_0xf13b('0x4')]),_0x29e939);queues[_0x29e939[_0xf13b('0x4')]][_0xf13b('0x18')]=![];queues[_0x29e939[_0xf13b('0x4')]][_0xf13b('0x28')]=null;queues[_0x29e939['uniqueid']][_0xf13b('0x17')]=!![];queues[_0x29e939['uniqueid']][_0xf13b('0x27')]=utils['now']();queues[_0x29e939[_0xf13b('0x4')]][_0xf13b('0x9')]='ABANDONED';utils['info'](util['format'](_0xf13b('0x2d'),_0x29e939[_0xf13b('0x4')],queues[_0x29e939[_0xf13b('0x4')]]['name'],queues[_0x29e939[_0xf13b('0x4')]][_0xf13b('0x9')]));}}catch(_0x2e5d84){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x2c'),_0x29e939['uniqueid']),_0x2e5d84);}};exports[_0xf13b('0x2e')]=function(_0x3dd169){try{if(!_[_0xf13b('0x21')](queues[_0x3dd169[_0xf13b('0x4')]])){utils[_0xf13b('0xf')](util[_0xf13b('0x2')](_0xf13b('0x2f'),_0x3dd169['uniqueid']),_0x3dd169);utils[_0xf13b('0x1')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3dd169['uniqueid'],queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x1c')],_0x3dd169['connectedlinenum'],_0x3dd169[_0xf13b('0x30')]));queues[_0x3dd169[_0xf13b('0x4')]]['queuecallerleave']=!![];queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x16')]=utils[_0xf13b('0x12')]();queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x31')]=utils[_0xf13b('0x32')](queues[_0x3dd169['uniqueid']][_0xf13b('0x16')],queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x33')]);queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x11')]=_0x3dd169['position'];queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x34')]=_0x3dd169[_0xf13b('0x34')];queues[_0x3dd169['uniqueid']][_0xf13b('0x35')]=_0x3dd169[_0xf13b('0x35')];queues[_0x3dd169['uniqueid']]['connectedlinename']=_0x3dd169[_0xf13b('0x30')];}}catch(_0x1470b2){utils[_0xf13b('0x13')](util[_0xf13b('0x2')]('[%s][queues][queuecallerleave]',_0x3dd169[_0xf13b('0x4')]),_0x1470b2);}};exports[_0xf13b('0x36')]=function(_0x133fef){try{if(!_['isNil'](queues[_0x133fef[_0xf13b('0x4')]])){utils[_0xf13b('0xf')](util['format'](_0xf13b('0x37'),_0x133fef['uniqueid']),_0x133fef);utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x38'),_0x133fef[_0xf13b('0x4')],queues[_0x133fef[_0xf13b('0x4')]]['name'],_0x133fef[_0xf13b('0x39')],_0x133fef[_0xf13b('0x3a')]));queues[_0x133fef['uniqueid']]['queuecallerabandon']=![];queues[_0x133fef[_0xf13b('0x4')]][_0xf13b('0x17')]=![];queues[_0x133fef[_0xf13b('0x4')]][_0xf13b('0x27')]=null;queues[_0x133fef[_0xf13b('0x4')]][_0xf13b('0x18')]=![];queues[_0x133fef[_0xf13b('0x4')]]['queuecallerexitreason']=null;queues[_0x133fef[_0xf13b('0x4')]]['queuecallerexitAt']=null;queues[_0x133fef[_0xf13b('0x4')]][_0xf13b('0x3b')]=!![];queues[_0x133fef[_0xf13b('0x4')]]['accountcode']=_0x133fef['destaccountcode'];queues[_0x133fef[_0xf13b('0x4')]][_0xf13b('0x3c')]=_0x133fef[_0xf13b('0x39')];}}catch(_0x266edc){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x37'),_0x133fef[_0xf13b('0x4')]),_0x266edc);}};exports[_0xf13b('0x3d')]=function(_0x53273d){try{if(!_['isNil'](queues[_0x53273d['uniqueid']])){if(queues[_0x53273d[_0xf13b('0x4')]]['queuecallerleaveAt']){utils[_0xf13b('0xf')](util[_0xf13b('0x2')]('[%s][queues][agentcomplete]',_0x53273d[_0xf13b('0x4')]),_0x53273d);queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x17')]=![];queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x17')]=![];queues[_0x53273d['uniqueid']]['queuecallerabandonAt']=null;queues[_0x53273d[_0xf13b('0x4')]]['queuecallerexit']=![];queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x28')]=null;queues[_0x53273d['uniqueid']]['assigned']=!![];queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x3c')]=_0x53273d['membername'];queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x3e')]=!![];queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x19')]=utils['now']();if(_0x53273d[_0xf13b('0x3f')]==_0xf13b('0x40')){if(!queues[_0x53273d['uniqueid']][_0xf13b('0x40')]){queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x9')]=_0xf13b('0x41');}}else{queues[_0x53273d['uniqueid']][_0xf13b('0x9')]=_0xf13b('0x42')+_0x53273d[_0xf13b('0x3f')]['toUpperCase']();}utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x43'),_0x53273d[_0xf13b('0x4')],queues[_0x53273d['uniqueid']][_0xf13b('0x1c')],_0x53273d['membername'],queues[_0x53273d[_0xf13b('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x53273d['uniqueid']]);}}}catch(_0x6135a3){utils['error'](util[_0xf13b('0x2')]('[%s][queues][agentcomplete]',_0x53273d[_0xf13b('0x4')]),_0x6135a3);}};exports[_0xf13b('0x44')]=function(_0xefccbf){try{if(!_['isNil'](queues[_0xefccbf[_0xf13b('0x45')]])){utils['debug'](util[_0xf13b('0x2')](_0xf13b('0x46'),_0xefccbf[_0xf13b('0x4')]),_0xefccbf);queues[_0xefccbf[_0xf13b('0x45')]][_0xf13b('0x40')]=!![];queues[_0xefccbf[_0xf13b('0x45')]]['transfertype']='BLIND';queues[_0xefccbf[_0xf13b('0x45')]][_0xf13b('0x47')]=_0xefccbf['extension'];queues[_0xefccbf[_0xf13b('0x45')]][_0xf13b('0x48')]=_0xefccbf[_0xf13b('0x45')];queues[_0xefccbf[_0xf13b('0x45')]][_0xf13b('0x9')]=_0xf13b('0x49');utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x4a'),_0xefccbf[_0xf13b('0x4')],queues[_0xefccbf[_0xf13b('0x45')]][_0xf13b('0x1c')],_0xefccbf[_0xf13b('0x45')],_0xefccbf[_0xf13b('0x4b')]));}}catch(_0x100ded){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x46'),_0xefccbf[_0xf13b('0x4')]),_0x100ded);}};exports['attendedtransfer']=function(_0x59faad){try{utils[_0xf13b('0xf')](util[_0xf13b('0x2')](_0xf13b('0x4c'),_0x59faad[_0xf13b('0x4d')]),_0x59faad);if(_0x59faad[_0xf13b('0x4d')]==_0x59faad['origtransfererlinkedid']){if(!_[_0xf13b('0x21')](queues[_0x59faad[_0xf13b('0x4e')]])){utils[_0xf13b('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x59faad[_0xf13b('0x4d')],queues[_0x59faad['secondtransfererlinkedid']][_0xf13b('0x1c')],_0x59faad['origtransfererexten']));queues[_0x59faad[_0xf13b('0x4e')]]['transfer']=!![];queues[_0x59faad[_0xf13b('0x4e')]][_0xf13b('0x4f')]=_0xf13b('0x50');queues[_0x59faad['secondtransfererlinkedid']]['transferexten']=_0x59faad[_0xf13b('0x51')];queues[_0x59faad[_0xf13b('0x4e')]][_0xf13b('0x48')]=_0x59faad[_0xf13b('0x4d')];queues[_0x59faad[_0xf13b('0x4e')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x59faad[_0xf13b('0x52')]])){if(_0x59faad[_0xf13b('0x53')]&&queues[_0x59faad[_0xf13b('0x53')]]){queues[_0x59faad[_0xf13b('0x53')]][_0xf13b('0x1e')]=0x1;queues[_0x59faad[_0xf13b('0x45')]]=_[_0xf13b('0x54')](queues[_0x59faad[_0xf13b('0x53')]]);queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0xe')]=_0x59faad['transfertargetuniqueid'];queues[_0x59faad['transfereeuniqueid']][_0xf13b('0x1e')]=0x2;queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x7')]=queues[_0x59faad[_0xf13b('0x4e')]]['calleridnum'];queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x55')]=queues[_0x59faad[_0xf13b('0x4e')]][_0xf13b('0x55')];queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x33')]=utils['now']();queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x16')]=utils[_0xf13b('0x12')]();queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x31')]=0x0;queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x56')]=0x0;utils[_0xf13b('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x59faad[_0xf13b('0x4d')],queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x1c')],queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x7')],queues[_0x59faad['transfereeuniqueid']][_0xf13b('0x55')]));}else{utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x57'),_0x59faad[_0xf13b('0x4d')],queues[_0x59faad['origtransfererlinkedid']][_0xf13b('0x1c')],_0x59faad['secondtransfererlinkedid']));queues[_0x59faad[_0xf13b('0x52')]][_0xf13b('0xe')]=_0x59faad[_0xf13b('0x4e')];}}}else if(_0x59faad[_0xf13b('0x58')]==_0x59faad[_0xf13b('0x4e')]){if(!_['isNil'](queues[_0x59faad[_0xf13b('0x52')]])){utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x59'),_0x59faad[_0xf13b('0x4d')],queues[_0x59faad[_0xf13b('0x52')]][_0xf13b('0x1c')],_0x59faad[_0xf13b('0x58')],_0x59faad['secondtransfererexten']));queues[_0x59faad[_0xf13b('0x52')]]['transfer']=!![];queues[_0x59faad[_0xf13b('0x52')]][_0xf13b('0x4f')]='ATTENDED';queues[_0x59faad[_0xf13b('0x52')]][_0xf13b('0x47')]=_0x59faad[_0xf13b('0x5a')];queues[_0x59faad[_0xf13b('0x52')]]['transferuniqueid']=_0x59faad[_0xf13b('0x58')];queues[_0x59faad[_0xf13b('0x52')]][_0xf13b('0x9')]='ATTENDEDTRANSFER';}if(!_[_0xf13b('0x21')](queues[_0x59faad[_0xf13b('0x4e')]])){if(_0x59faad[_0xf13b('0x5b')]&&queues[_0x59faad[_0xf13b('0x5b')]]){queues[_0x59faad['transfertargetlinkedid']][_0xf13b('0x1e')]=0x1;queues[_0x59faad[_0xf13b('0x5c')]]=_[_0xf13b('0x54')](queues[_0x59faad[_0xf13b('0x5b')]]);queues[_0x59faad['transfertargetuniqueid']][_0xf13b('0xe')]=_0x59faad[_0xf13b('0x5c')];queues[_0x59faad[_0xf13b('0x5c')]][_0xf13b('0x1e')]=0x2;queues[_0x59faad['transfertargetuniqueid']][_0xf13b('0x7')]=queues[_0x59faad['origtransfererlinkedid']][_0xf13b('0x7')];queues[_0x59faad[_0xf13b('0x5c')]][_0xf13b('0x55')]=queues[_0x59faad['origtransfererlinkedid']][_0xf13b('0x55')];queues[_0x59faad['transfertargetuniqueid']][_0xf13b('0x33')]=utils[_0xf13b('0x12')]();queues[_0x59faad[_0xf13b('0x5c')]]['queuecallerleaveAt']=utils[_0xf13b('0x12')]();queues[_0x59faad[_0xf13b('0x5c')]]['holdtime']=0x0;queues[_0x59faad[_0xf13b('0x5c')]][_0xf13b('0x56')]=0x0;utils[_0xf13b('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x59faad[_0xf13b('0x4d')],queues[_0x59faad[_0xf13b('0x5c')]][_0xf13b('0x1c')],queues[_0x59faad['transfertargetuniqueid']][_0xf13b('0xe')],queues[_0x59faad['transfertargetuniqueid']][_0xf13b('0x7')],queues[_0x59faad[_0xf13b('0x5c')]][_0xf13b('0x55')]));}else{utils['info'](util[_0xf13b('0x2')](_0xf13b('0x57'),_0x59faad['origtransfereruniqueid'],queues[_0x59faad['secondtransfererlinkedid']][_0xf13b('0x1c')],_0x59faad[_0xf13b('0x52')]));queues[_0x59faad[_0xf13b('0x4e')]]['transfereduniqueid']=_0x59faad[_0xf13b('0x52')];}}}}catch(_0x559363){utils['error'](util[_0xf13b('0x2')](_0xf13b('0x4c'),_0x59faad[_0xf13b('0x4d')]),_0x559363);}};exports[_0xf13b('0x5d')]=function(_0x3bd583){try{if(!_[_0xf13b('0x21')](queues[_0x3bd583[_0xf13b('0x4')]])){utils[_0xf13b('0xf')](util[_0xf13b('0x2')](_0xf13b('0x5e'),_0x3bd583[_0xf13b('0x4')]),_0x3bd583);queues[_0x3bd583[_0xf13b('0x4')]][_0xf13b('0x5f')]=utils[_0xf13b('0x12')]();utils['info'](util[_0xf13b('0x2')](_0xf13b('0x60'),_0x3bd583['uniqueid'],queues[_0x3bd583[_0xf13b('0x4')]][_0xf13b('0x1c')],queues[_0x3bd583[_0xf13b('0x4')]][_0xf13b('0x5f')]));}}catch(_0x404eb0){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x5e'),_0x3bd583[_0xf13b('0x4')]),_0x404eb0);}};exports[_0xf13b('0x61')]=function(_0x5c2ebb){try{if(!_[_0xf13b('0x21')](queues[_0x5c2ebb[_0xf13b('0x4')]])){if(!_[_0xf13b('0x21')](queues[_0x5c2ebb[_0xf13b('0x4')]][_0xf13b('0x5f')])){utils[_0xf13b('0xf')](util[_0xf13b('0x2')](_0xf13b('0x62'),_0x5c2ebb[_0xf13b('0x4')]),_0x5c2ebb);queues[_0x5c2ebb[_0xf13b('0x4')]][_0xf13b('0x56')]+=utils[_0xf13b('0x32')](utils['now'](),queues[_0x5c2ebb['uniqueid']][_0xf13b('0x5f')]);utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x63'),_0x5c2ebb[_0xf13b('0x4')],queues[_0x5c2ebb[_0xf13b('0x4')]][_0xf13b('0x1c')],queues[_0x5c2ebb[_0xf13b('0x4')]][_0xf13b('0x56')]));delete queues[_0x5c2ebb[_0xf13b('0x4')]]['musiconholdstartAt'];}}}catch(_0x39ba7c){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x62'),_0x5c2ebb[_0xf13b('0x4')]),_0x39ba7c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index ebb6846..7b11512 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 _0xb36b=['calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','then','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s'];(function(_0x31c5a3,_0x30e453){var _0x3439ba=function(_0x136b92){while(--_0x136b92){_0x31c5a3['push'](_0x31c5a3['shift']());}};_0x3439ba(++_0x30e453);}(_0xb36b,0x148));var _0xbb36=function(_0x50e898,_0xff1435){_0x50e898=_0x50e898-0x0;var _0x3263a3=_0xb36b[_0x50e898];return _0x3263a3;};'use strict';var _=require(_0xbb36('0x0'));var util=require(_0xbb36('0x1'));var utils=require(_0xbb36('0x2'));var transfers=require(_0xbb36('0x3'));var recordings={};function writeDB(_0x35451b){var _0x39c9cf;utils[_0xbb36('0x4')](util[_0xbb36('0x5')](_0xbb36('0x6'),_0x35451b[_0xbb36('0x7')]));if(transfers['blinds'][_0x35451b['uniqueid']]){_0x39c9cf=_0x35451b[_0xbb36('0x7')];_0x35451b[_0xbb36('0x7')]=transfers[_0xbb36('0x8')][_0x35451b['uniqueid']][_0xbb36('0x9')];}if(_0x35451b[_0xbb36('0xa')]){utils['getUserByInternal'](_0x35451b[_0xbb36('0xa')])[_0xbb36('0xb')](function(_0x2d9529){if(_0x2d9529){_0x35451b['membername']=_0x2d9529['name'];_0x35451b[_0xbb36('0xc')]=_0x2d9529['id'];}utils[_0xbb36('0xd')](_0xbb36('0xe'),_0x35451b);});}else{utils[_0xbb36('0xd')](_0xbb36('0xe'),_0x35451b);}if(_0x39c9cf)delete transfers[_0xbb36('0x8')][_0x39c9cf];}exports[_0xbb36('0xf')]=function(_0x90fa0b){try{utils[_0xbb36('0x10')](util[_0xbb36('0x5')]('[%s][recordings][newchannel]',_0x90fa0b['uniqueid']),_0x90fa0b);if(_0x90fa0b[_0xbb36('0x7')]==_0x90fa0b[_0xbb36('0x11')]){utils[_0xbb36('0x4')](util[_0xbb36('0x5')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x90fa0b[_0xbb36('0x7')],_0x90fa0b[_0xbb36('0x12')],_0x90fa0b['exten']));recordings[_0x90fa0b[_0xbb36('0x7')]]={'uniqueid':_0x90fa0b[_0xbb36('0x7')],'accountcode':_0x90fa0b[_0xbb36('0xa')],'exten':_0x90fa0b[_0xbb36('0x13')],'context':_0x90fa0b[_0xbb36('0x12')],'channel':_0x90fa0b[_0xbb36('0x14')],'monitors':[]};}}catch(_0x161d80){utils[_0xbb36('0x15')](util[_0xbb36('0x5')]('[%s][recordings][newchannel]',_0x90fa0b['uniqueid']),_0x161d80);}};exports[_0xbb36('0x16')]=function(_0x3bccfb){try{utils[_0xbb36('0x10')](util[_0xbb36('0x5')](_0xbb36('0x17'),_0x3bccfb['uniqueid']),_0x3bccfb);if(!_[_0xbb36('0x18')](recordings[_0x3bccfb[_0xbb36('0x7')]])&&_0x3bccfb['channelstate']==0x6){utils[_0xbb36('0x4')](util[_0xbb36('0x5')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3bccfb[_0xbb36('0x7')],_0x3bccfb['context'],_0x3bccfb[_0xbb36('0x14')]));}else if(!_[_0xbb36('0x18')](recordings[_0x3bccfb[_0xbb36('0x11')]])&&_0x3bccfb[_0xbb36('0x19')]==0x6&&_0x3bccfb[_0xbb36('0x12')]!=_0xbb36('0x1a')){utils[_0xbb36('0x4')](util[_0xbb36('0x5')](_0xbb36('0x1b'),_0x3bccfb[_0xbb36('0x7')],_0x3bccfb['linkedid'],_0x3bccfb[_0xbb36('0x12')],_0x3bccfb[_0xbb36('0x14')]));recordings[_0x3bccfb[_0xbb36('0x11')]][_0xbb36('0xa')]=_0x3bccfb[_0xbb36('0xa')];}}catch(_0x441ba){utils[_0xbb36('0x15')](util[_0xbb36('0x5')](_0xbb36('0x17'),_0x3bccfb[_0xbb36('0x7')]),_0x441ba);}};exports['varset']=function(_0x4fd148){try{if(!_[_0xbb36('0x18')](_0x4fd148[_0xbb36('0x1c')])&&!_[_0xbb36('0x18')](_0x4fd148[_0xbb36('0x1c')][_0xbb36('0x1d')])){utils['debug'](util['format'](_0xbb36('0x1e'),_0x4fd148[_0xbb36('0x7')]),_0x4fd148);utils[_0xbb36('0x4')](util[_0xbb36('0x5')](_0xbb36('0x1f'),_0x4fd148[_0xbb36('0x7')],_0x4fd148[_0xbb36('0x1c')],_0x4fd148[_0xbb36('0x20')]));if(_[_0xbb36('0x21')](_0x4fd148[_0xbb36('0x20')],'.wav49')){_0x4fd148[_0xbb36('0x20')]=_0x4fd148[_0xbb36('0x20')][_0xbb36('0x22')](_0xbb36('0x23'),_0xbb36('0x24'));}if(recordings[_0x4fd148[_0xbb36('0x11')]]){var _0x5d9639=_[_0xbb36('0x25')](recordings[_0x4fd148[_0xbb36('0x11')]]['monitors'],{'value':_0x4fd148[_0xbb36('0x20')]});if(_[_0xbb36('0x18')](_0x5d9639)){recordings[_0x4fd148[_0xbb36('0x11')]][_0xbb36('0x26')][_0xbb36('0x27')]({'value':_0x4fd148[_0xbb36('0x20')]});}}}}catch(_0x2ea5e1){utils[_0xbb36('0x15')](util[_0xbb36('0x5')](_0xbb36('0x1e'),_0x4fd148[_0xbb36('0x7')]),_0x2ea5e1);}};exports[_0xbb36('0x28')]=function(_0x1182cc){try{if(!_[_0xbb36('0x18')](recordings[_0x1182cc[_0xbb36('0x7')]])){utils[_0xbb36('0x10')](util[_0xbb36('0x5')]('[%s][recordings][hangup]',_0x1182cc[_0xbb36('0x7')]),_0x1182cc);utils[_0xbb36('0x4')](util[_0xbb36('0x5')](_0xbb36('0x29'),_0x1182cc[_0xbb36('0x7')],_0x1182cc['calleridnum'],_0x1182cc[_0xbb36('0x2a')],_0x1182cc[_0xbb36('0x2b')]));recordings[_0x1182cc[_0xbb36('0x7')]][_0xbb36('0x2c')]=_0x1182cc[_0xbb36('0x2c')];recordings[_0x1182cc[_0xbb36('0x7')]][_0xbb36('0x2a')]=_0x1182cc['calleridname'];recordings[_0x1182cc[_0xbb36('0x7')]][_0xbb36('0x2d')]=_0x1182cc['connectedlinenum'];recordings[_0x1182cc[_0xbb36('0x7')]][_0xbb36('0x2e')]=_0x1182cc['connectedlinename'];if(recordings[_0x1182cc[_0xbb36('0x7')]][_0xbb36('0x2f')]=='outbound'&&recordings[_0x1182cc[_0xbb36('0x7')]][_0xbb36('0xa')]){recordings[_0x1182cc[_0xbb36('0x7')]]['connectedlinenum']=recordings[_0x1182cc['uniqueid']][_0xbb36('0xa')];recordings[_0x1182cc[_0xbb36('0x7')]]['connectedlinename']='';}recordings[_0x1182cc[_0xbb36('0x7')]]['monitors']['forEach'](function(_0x12607d){var _0x4ed8bb=_[_0xbb36('0x30')](recordings[_0x1182cc['uniqueid']]);_0x4ed8bb[_0xbb36('0x20')]=_0x12607d[_0xbb36('0x20')];writeDB(_0x4ed8bb);});delete recordings[_0x1182cc[_0xbb36('0x7')]];}}catch(_0xaa373b){utils[_0xbb36('0x15')](util['format'](_0xbb36('0x31'),_0x1182cc[_0xbb36('0x7')]),_0xaa373b);}};exports[_0xbb36('0x32')]=function(_0x4fea0b){try{if(!_[_0xbb36('0x18')](recordings[_0x4fea0b[_0xbb36('0x7')]])){utils[_0xbb36('0x10')](util['format'](_0xbb36('0x33'),_0x4fea0b[_0xbb36('0x7')]),_0x4fea0b);utils[_0xbb36('0x4')](util[_0xbb36('0x5')](_0xbb36('0x34'),_0x4fea0b[_0xbb36('0x7')],_0x4fea0b['application'],_0x4fea0b[_0xbb36('0x35')]));if(_0x4fea0b[_0xbb36('0x36')][_0xbb36('0x37')]()==_0xbb36('0x38')&&_['startsWith'](_0x4fea0b['appdata'][_0xbb36('0x37')](),_0xbb36('0x39'))){var _0x2c3d97=_0x4fea0b[_0xbb36('0x35')][_0xbb36('0x3a')]('=');var _0x3be366=_0x2c3d97[0x0][_0xbb36('0x3b')](_0x2c3d97[0x0][_0xbb36('0x3c')]('(')+0x1,_0x2c3d97[0x0][_0xbb36('0x3c')](')'));var _0x59160f=_0x2c3d97[0x1];recordings[_0x4fea0b['uniqueid']][_0x3be366]=_0x59160f;}}}catch(_0x4fa2f1){utils[_0xbb36('0x15')](util[_0xbb36('0x5')](_0xbb36('0x33'),_0x4fea0b[_0xbb36('0x7')]),_0x4fa2f1);}};exports[_0xbb36('0x3d')]=function(_0x182fb3){try{if(!_['isNil'](recordings[_0x182fb3['uniqueid']])){utils[_0xbb36('0x10')](util[_0xbb36('0x5')](_0xbb36('0x3e'),_0x182fb3[_0xbb36('0x7')]),_0x182fb3);utils[_0xbb36('0x4')](util[_0xbb36('0x5')](_0xbb36('0x3f'),_0x182fb3[_0xbb36('0x7')],_0x182fb3[_0xbb36('0x40')]));recordings[_0x182fb3[_0xbb36('0x7')]]['queue']=_0x182fb3[_0xbb36('0x40')];}}catch(_0xb451bf){utils[_0xbb36('0x15')](util[_0xbb36('0x5')](_0xbb36('0x3e'),_0x182fb3[_0xbb36('0x7')]),_0xb451bf);}};exports[_0xbb36('0x41')]=function(_0x4312e5){try{utils[_0xbb36('0x10')](util[_0xbb36('0x5')](_0xbb36('0x42'),_0x4312e5[_0xbb36('0x7')]),_0x4312e5);utils[_0xbb36('0x4')](util['format'](_0xbb36('0x43'),_0x4312e5['uniqueid'],_0x4312e5[_0xbb36('0x44')],_0x4312e5[_0xbb36('0x45')],_0x4312e5[_0xbb36('0x46')],_0x4312e5[_0xbb36('0x47')]));if(recordings[_0x4312e5[_0xbb36('0x48')]]&&transfers[_0xbb36('0x8')][_0x4312e5[_0xbb36('0x48')]]){transfers[_0xbb36('0x8')][_0x4312e5['transfereruniqueid']][_0xbb36('0x49')]=!![];}}catch(_0x67ce2e){utils[_0xbb36('0x15')](util['format'](_0xbb36('0x42'),_0x4312e5[_0xbb36('0x7')]),_0x67ce2e);}}; \ No newline at end of file +var _0x5a8d=['connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','appdata','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereruniqueid','[%s][recordings][blindtransfer]','lodash','util','./transfers.controller','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','info','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newchannel]','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid','transfer','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','type','outbound'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x5a8d,0x12e));var _0xd5a8=function(_0x199a19,_0x3d7fba){_0x199a19=_0x199a19-0x0;var _0x292d09=_0x5a8d[_0x199a19];return _0x292d09;};'use strict';var _=require(_0xd5a8('0x0'));var util=require(_0xd5a8('0x1'));var utils=require('./utils');var transfers=require(_0xd5a8('0x2'));var recordings={};function writeDB(_0x42c97f){var _0x5871b1;utils['info'](util['format']('[%s][recordings][writeDB]',_0x42c97f[_0xd5a8('0x3')]));if(transfers[_0xd5a8('0x4')][_0x42c97f[_0xd5a8('0x3')]]){_0x5871b1=_0x42c97f[_0xd5a8('0x3')];_0x42c97f[_0xd5a8('0x3')]=transfers[_0xd5a8('0x4')][_0x42c97f[_0xd5a8('0x3')]][_0xd5a8('0x5')];}if(_0x42c97f[_0xd5a8('0x6')]){utils[_0xd5a8('0x7')](_0x42c97f[_0xd5a8('0x6')])[_0xd5a8('0x8')](function(_0x4fe418){if(_0x4fe418){_0x42c97f[_0xd5a8('0x9')]=_0x4fe418[_0xd5a8('0xa')];_0x42c97f['UserId']=_0x4fe418['id'];}utils[_0xd5a8('0xb')]('CreateVoiceRecording',_0x42c97f);});}else{utils[_0xd5a8('0xb')](_0xd5a8('0xc'),_0x42c97f);}if(_0x5871b1)delete transfers[_0xd5a8('0x4')][_0x5871b1];}exports[_0xd5a8('0xd')]=function(_0x5bceb0){try{utils[_0xd5a8('0xe')](util['format']('[%s][recordings][newchannel]',_0x5bceb0[_0xd5a8('0x3')]),_0x5bceb0);if(_0x5bceb0[_0xd5a8('0x3')]==_0x5bceb0['linkedid']){utils[_0xd5a8('0xf')](util[_0xd5a8('0x10')](_0xd5a8('0x11'),_0x5bceb0[_0xd5a8('0x3')],_0x5bceb0[_0xd5a8('0x12')],_0x5bceb0[_0xd5a8('0x13')]));recordings[_0x5bceb0[_0xd5a8('0x3')]]={'uniqueid':_0x5bceb0[_0xd5a8('0x3')],'accountcode':_0x5bceb0[_0xd5a8('0x6')],'exten':_0x5bceb0[_0xd5a8('0x13')],'context':_0x5bceb0[_0xd5a8('0x12')],'channel':_0x5bceb0['channel'],'monitors':[]};}}catch(_0x4571e5){utils[_0xd5a8('0x14')](util[_0xd5a8('0x10')](_0xd5a8('0x15'),_0x5bceb0[_0xd5a8('0x3')]),_0x4571e5);}};exports[_0xd5a8('0x16')]=function(_0x16116c){try{utils[_0xd5a8('0xe')](util[_0xd5a8('0x10')]('[%s][recordings][newstate]',_0x16116c['uniqueid']),_0x16116c);if(!_[_0xd5a8('0x17')](recordings[_0x16116c[_0xd5a8('0x3')]])&&_0x16116c[_0xd5a8('0x18')]==0x6){utils[_0xd5a8('0xf')](util[_0xd5a8('0x10')](_0xd5a8('0x19'),_0x16116c['uniqueid'],_0x16116c[_0xd5a8('0x12')],_0x16116c[_0xd5a8('0x1a')]));}else if(!_['isNil'](recordings[_0x16116c[_0xd5a8('0x1b')]])&&_0x16116c[_0xd5a8('0x18')]==0x6&&_0x16116c['context']!=_0xd5a8('0x1c')){utils[_0xd5a8('0xf')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x16116c[_0xd5a8('0x3')],_0x16116c[_0xd5a8('0x1b')],_0x16116c[_0xd5a8('0x12')],_0x16116c['channel']));recordings[_0x16116c[_0xd5a8('0x1b')]][_0xd5a8('0x6')]=_0x16116c[_0xd5a8('0x6')];}}catch(_0x2aaf51){utils[_0xd5a8('0x14')](util['format'](_0xd5a8('0x1d'),_0x16116c[_0xd5a8('0x3')]),_0x2aaf51);}};exports['varset']=function(_0x23c966){try{if(!_[_0xd5a8('0x17')](_0x23c966[_0xd5a8('0x1e')])&&!_[_0xd5a8('0x17')](_0x23c966[_0xd5a8('0x1e')][_0xd5a8('0x1f')])){utils[_0xd5a8('0xe')](util['format'](_0xd5a8('0x20'),_0x23c966[_0xd5a8('0x3')]),_0x23c966);utils[_0xd5a8('0xf')](util[_0xd5a8('0x10')](_0xd5a8('0x21'),_0x23c966[_0xd5a8('0x3')],_0x23c966[_0xd5a8('0x1e')],_0x23c966[_0xd5a8('0x22')]));if(_[_0xd5a8('0x23')](_0x23c966[_0xd5a8('0x22')],_0xd5a8('0x24'))){_0x23c966['value']=_0x23c966[_0xd5a8('0x22')][_0xd5a8('0x25')](_0xd5a8('0x24'),_0xd5a8('0x26'));}if(recordings[_0x23c966[_0xd5a8('0x1b')]]){var _0x580b3d=_[_0xd5a8('0x27')](recordings[_0x23c966[_0xd5a8('0x1b')]][_0xd5a8('0x28')],{'value':_0x23c966[_0xd5a8('0x22')]});if(_['isNil'](_0x580b3d)){recordings[_0x23c966['linkedid']]['monitors']['push']({'value':_0x23c966['value']});}}}}catch(_0xa0d003){utils['error'](util[_0xd5a8('0x10')](_0xd5a8('0x20'),_0x23c966[_0xd5a8('0x3')]),_0xa0d003);}};exports['hangup']=function(_0x560337){try{if(!_[_0xd5a8('0x17')](recordings[_0x560337[_0xd5a8('0x3')]])){utils['debug'](util[_0xd5a8('0x10')](_0xd5a8('0x29'),_0x560337['uniqueid']),_0x560337);utils[_0xd5a8('0xf')](util[_0xd5a8('0x10')](_0xd5a8('0x2a'),_0x560337[_0xd5a8('0x3')],_0x560337[_0xd5a8('0x2b')],_0x560337['calleridname'],_0x560337['cause-txt']));recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x2b')]=_0x560337[_0xd5a8('0x2b')];recordings[_0x560337['uniqueid']]['calleridname']=_0x560337[_0xd5a8('0x2c')];recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x2d')]=_0x560337[_0xd5a8('0x2d')];recordings[_0x560337['uniqueid']]['connectedlinename']=_0x560337['connectedlinename'];if(recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x2e')]==_0xd5a8('0x2f')&&recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x6')]){recordings[_0x560337[_0xd5a8('0x3')]]['connectedlinenum']=recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x6')];recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x30')]='';}recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x28')][_0xd5a8('0x31')](function(_0x268771){var _0x1d7205=_[_0xd5a8('0x32')](recordings[_0x560337['uniqueid']]);_0x1d7205[_0xd5a8('0x22')]=_0x268771[_0xd5a8('0x22')];writeDB(_0x1d7205);});delete recordings[_0x560337[_0xd5a8('0x3')]];}}catch(_0x44f37f){utils[_0xd5a8('0x14')](util[_0xd5a8('0x10')]('[%s][recordings][hangup]',_0x560337[_0xd5a8('0x3')]),_0x44f37f);}};exports[_0xd5a8('0x33')]=function(_0x5ed4b0){try{if(!_[_0xd5a8('0x17')](recordings[_0x5ed4b0[_0xd5a8('0x3')]])){utils[_0xd5a8('0xe')](util[_0xd5a8('0x10')]('[%s][recordings][newexten]',_0x5ed4b0[_0xd5a8('0x3')]),_0x5ed4b0);utils[_0xd5a8('0xf')](util[_0xd5a8('0x10')](_0xd5a8('0x34'),_0x5ed4b0[_0xd5a8('0x3')],_0x5ed4b0[_0xd5a8('0x35')],_0x5ed4b0['appdata']));if(_0x5ed4b0['application']['toLowerCase']()==_0xd5a8('0x36')&&_['startsWith'](_0x5ed4b0[_0xd5a8('0x37')][_0xd5a8('0x38')](),_0xd5a8('0x39'))){var _0x28d739=_0x5ed4b0[_0xd5a8('0x37')][_0xd5a8('0x3a')]('=');var _0x2011b2=_0x28d739[0x0][_0xd5a8('0x3b')](_0x28d739[0x0][_0xd5a8('0x3c')]('(')+0x1,_0x28d739[0x0][_0xd5a8('0x3c')](')'));var _0xb892b2=_0x28d739[0x1];recordings[_0x5ed4b0[_0xd5a8('0x3')]][_0x2011b2]=_0xb892b2;}}}catch(_0x5d8e05){utils['error'](util[_0xd5a8('0x10')](_0xd5a8('0x3d'),_0x5ed4b0[_0xd5a8('0x3')]),_0x5d8e05);}};exports[_0xd5a8('0x3e')]=function(_0x259ab7){try{if(!_[_0xd5a8('0x17')](recordings[_0x259ab7[_0xd5a8('0x3')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x259ab7[_0xd5a8('0x3')]),_0x259ab7);utils['info'](util['format'](_0xd5a8('0x3f'),_0x259ab7['uniqueid'],_0x259ab7['queue']));recordings[_0x259ab7[_0xd5a8('0x3')]][_0xd5a8('0x40')]=_0x259ab7[_0xd5a8('0x40')];}}catch(_0x5a4ca0){utils[_0xd5a8('0x14')](util[_0xd5a8('0x10')]('[%s][recordings][queuecallerjoin]',_0x259ab7['uniqueid']),_0x5a4ca0);}};exports[_0xd5a8('0x41')]=function(_0x3cccf2){try{utils[_0xd5a8('0xe')](util[_0xd5a8('0x10')]('[%s][recordings][blindtransfer]',_0x3cccf2[_0xd5a8('0x3')]),_0x3cccf2);utils[_0xd5a8('0xf')](util['format'](_0xd5a8('0x42'),_0x3cccf2[_0xd5a8('0x3')],_0x3cccf2['transferercalleridnum'],_0x3cccf2[_0xd5a8('0x43')],_0x3cccf2['transfereecalleridnum'],_0x3cccf2['transfereecalleridname']));if(recordings[_0x3cccf2[_0xd5a8('0x44')]]&&transfers[_0xd5a8('0x4')][_0x3cccf2[_0xd5a8('0x44')]]){transfers[_0xd5a8('0x4')][_0x3cccf2[_0xd5a8('0x44')]]['recording']=!![];}}catch(_0x35a5f0){utils['error'](util['format'](_0xd5a8('0x45'),_0x3cccf2[_0xd5a8('0x3')]),_0x35a5f0);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 243197b..03ee65f 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 _0x32af=['type','attended','origtransfereruniqueid','request','blinds','blindtransfer','format','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s'];(function(_0x19fec1,_0x1cc62f){var _0x29cd35=function(_0x712a4f){while(--_0x712a4f){_0x19fec1['push'](_0x19fec1['shift']());}};_0x29cd35(++_0x1cc62f);}(_0x32af,0x97));var _0xf32a=function(_0x1e1721,_0x337162){_0x1e1721=_0x1e1721-0x0;var _0x4791c3=_0x32af[_0x1e1721];return _0x4791c3;};'use strict';var _=require(_0xf32a('0x0'));var util=require(_0xf32a('0x1'));var utils=require(_0xf32a('0x2'));function writeDB(_0x15a611){utils[_0xf32a('0x3')](util['format'](_0xf32a('0x4'),_0x15a611[_0xf32a('0x5')]===_0xf32a('0x6')?_0x15a611[_0xf32a('0x7')]:_0x15a611['uniqueid'],_0x15a611[_0xf32a('0x5')]));utils[_0xf32a('0x8')]('CreateVoiceTransferReport',_0x15a611);}exports[_0xf32a('0x9')]={};exports[_0xf32a('0xa')]=function(_0x384084){try{utils['debug'](util[_0xf32a('0xb')](_0xf32a('0xc'),_0x384084[_0xf32a('0xd')]),_0x384084);utils[_0xf32a('0x3')](util[_0xf32a('0xb')](_0xf32a('0xe'),_0x384084[_0xf32a('0xd')],_0x384084[_0xf32a('0xf')],_0x384084[_0xf32a('0x10')],_0x384084['transfereecalleridnum'],_0x384084['transfereecalleridname']));_0x384084['type']=_0xf32a('0x11');exports[_0xf32a('0x9')][_0x384084[_0xf32a('0x12')]]=_0x384084;writeDB(_0x384084);}catch(_0x28a130){utils[_0xf32a('0x13')](util['format'](_0xf32a('0xc'),_0x384084['uniqueid']),_0x28a130);}};exports[_0xf32a('0x14')]=function(_0x1946f6){try{utils[_0xf32a('0x15')](util[_0xf32a('0xb')](_0xf32a('0x16'),_0x1946f6[_0xf32a('0x7')]),_0x1946f6);utils[_0xf32a('0x3')](util[_0xf32a('0xb')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1946f6[_0xf32a('0x7')],_0x1946f6[_0xf32a('0x17')],_0x1946f6[_0xf32a('0x18')],_0x1946f6[_0xf32a('0x19')],_0x1946f6[_0xf32a('0x1a')]));_0x1946f6=_['assign'](_0x1946f6,{'transfererchannel':_0x1946f6['origtransfererchannel'],'transferercalleridnum':_0x1946f6[_0xf32a('0x17')],'transferercalleridname':_0x1946f6[_0xf32a('0x18')],'transfererconnectedlinenum':_0x1946f6['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1946f6['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1946f6[_0xf32a('0x1b')],'transferercontext':_0x1946f6['secondtransferercontext'],'transfererexten':_0x1946f6[_0xf32a('0x1c')],'transfererlinkedid':_0x1946f6['origtransfererlinkedid'],'context':_0x1946f6[_0xf32a('0x1d')],'extension':_0x1946f6[_0xf32a('0x1e')],'type':_0xf32a('0x6')});if(_[_0xf32a('0x1f')](_0x1946f6[_0xf32a('0x20')])){_0x1946f6=_[_0xf32a('0x21')](_0x1946f6,{'transfereechannel':_0x1946f6[_0xf32a('0x22')],'transfereecalleridnum':_0x1946f6[_0xf32a('0x19')],'transfereecalleridname':_0x1946f6[_0xf32a('0x1a')],'transfereeconnectedlinenum':_0x1946f6['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1946f6['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1946f6[_0xf32a('0x23')],'transfereecontext':_0x1946f6[_0xf32a('0x24')],'transfereeexten':_0x1946f6[_0xf32a('0x25')],'transfereelinkedid':_0x1946f6[_0xf32a('0x26')]});}writeDB(_0x1946f6);}catch(_0x191174){utils[_0xf32a('0x13')](util[_0xf32a('0xb')]('[%s][transfers][attendedtransfer]',_0x1946f6[_0xf32a('0x7')]),_0x191174);}}; \ No newline at end of file +var _0xa70b=['[%s][transfers][attendedtransfer]','info','transfertargetcalleridnum','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','blind','transfereruniqueid','error','attendedtransfer'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa70b,0xcb));var _0xba70=function(_0x17fc20,_0x7d3f2f){_0x17fc20=_0x17fc20-0x0;var _0x29d108=_0xa70b[_0x17fc20];return _0x29d108;};'use strict';var _=require('lodash');var util=require(_0xba70('0x0'));var utils=require(_0xba70('0x1'));function writeDB(_0x28dbca){utils['info'](util[_0xba70('0x2')](_0xba70('0x3'),_0x28dbca[_0xba70('0x4')]===_0xba70('0x5')?_0x28dbca[_0xba70('0x6')]:_0x28dbca[_0xba70('0x7')],_0x28dbca[_0xba70('0x4')]));utils[_0xba70('0x8')]('CreateVoiceTransferReport',_0x28dbca);}exports[_0xba70('0x9')]={};exports[_0xba70('0xa')]=function(_0x228d18){try{utils[_0xba70('0xb')](util['format'](_0xba70('0xc'),_0x228d18[_0xba70('0x7')]),_0x228d18);utils['info'](util[_0xba70('0x2')](_0xba70('0xd'),_0x228d18[_0xba70('0x7')],_0x228d18['transferercalleridnum'],_0x228d18['transferercalleridname'],_0x228d18[_0xba70('0xe')],_0x228d18['transfereecalleridname']));_0x228d18[_0xba70('0x4')]=_0xba70('0xf');exports[_0xba70('0x9')][_0x228d18[_0xba70('0x10')]]=_0x228d18;writeDB(_0x228d18);}catch(_0x595b17){utils[_0xba70('0x11')](util[_0xba70('0x2')](_0xba70('0xc'),_0x228d18[_0xba70('0x7')]),_0x595b17);}};exports[_0xba70('0x12')]=function(_0x4af0bf){try{utils[_0xba70('0xb')](util[_0xba70('0x2')](_0xba70('0x13'),_0x4af0bf[_0xba70('0x6')]),_0x4af0bf);utils[_0xba70('0x14')](util[_0xba70('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4af0bf[_0xba70('0x6')],_0x4af0bf['origtransferercalleridnum'],_0x4af0bf['origtransferercalleridname'],_0x4af0bf[_0xba70('0x15')],_0x4af0bf['transfertargetcalleridname']));_0x4af0bf=_[_0xba70('0x16')](_0x4af0bf,{'transfererchannel':_0x4af0bf['origtransfererchannel'],'transferercalleridnum':_0x4af0bf[_0xba70('0x17')],'transferercalleridname':_0x4af0bf[_0xba70('0x18')],'transfererconnectedlinenum':_0x4af0bf[_0xba70('0x19')],'transfererconnectedlinename':_0x4af0bf[_0xba70('0x1a')],'transfereraccountcode':_0x4af0bf[_0xba70('0x1b')],'transferercontext':_0x4af0bf[_0xba70('0x1c')],'transfererexten':_0x4af0bf[_0xba70('0x1d')],'transfererlinkedid':_0x4af0bf['origtransfererlinkedid'],'context':_0x4af0bf[_0xba70('0x1e')],'extension':_0x4af0bf['origtransfererexten'],'type':_0xba70('0x5')});if(_['isNil'](_0x4af0bf['transfereechannel'])){_0x4af0bf=_[_0xba70('0x16')](_0x4af0bf,{'transfereechannel':_0x4af0bf[_0xba70('0x1f')],'transfereecalleridnum':_0x4af0bf[_0xba70('0x15')],'transfereecalleridname':_0x4af0bf['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4af0bf['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4af0bf[_0xba70('0x20')],'transfereeaccountcode':_0x4af0bf[_0xba70('0x21')],'transfereecontext':_0x4af0bf[_0xba70('0x22')],'transfereeexten':_0x4af0bf[_0xba70('0x23')],'transfereelinkedid':_0x4af0bf[_0xba70('0x24')]});}writeDB(_0x4af0bf);}catch(_0x51c8b3){utils[_0xba70('0x11')](util[_0xba70('0x2')](_0xba70('0x13'),_0x4af0bf[_0xba70('0x6')]),_0x51c8b3);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 90d34a1..ce94e2a 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 _0xe4e5=['request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','[utils][getUserByInternal]','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','found','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isAfter','util','client','xdr','info','inspect','debug','error'];(function(_0x601843,_0x805560){var _0x435aa5=function(_0x33aecd){while(--_0x33aecd){_0x601843['push'](_0x601843['shift']());}};_0x435aa5(++_0x805560);}(_0xe4e5,0xfb));var _0x5e4e=function(_0x5b2a34,_0x96398f){_0x5b2a34=_0x5b2a34-0x0;var _0x538925=_0xe4e5[_0x5b2a34];return _0x538925;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0x5e4e('0x0'));var client=jayson[_0x5e4e('0x1')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x5e4e('0x2'));exports[_0x5e4e('0x3')]=function(_0x23b072,_0x37cbea){logger[_0x5e4e('0x3')](_0x23b072,_0x37cbea?util[_0x5e4e('0x4')](_0x37cbea,{'showHidden':![],'depth':null}):'');};exports[_0x5e4e('0x5')]=function(_0x3b9ef0,_0x46587d){logger[_0x5e4e('0x5')](_0x3b9ef0,_0x46587d?util[_0x5e4e('0x4')](_0x46587d,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0xc1be,_0x236e43){logger[_0x5e4e('0x6')](_0xc1be,_0x236e43?util['inspect'](_0x236e43,{'showHidden':![],'depth':null}):'');};exports[_0x5e4e('0x7')]=function(_0x23decf,_0x5a595e){return client[_0x5e4e('0x7')](_0x23decf,{'body':_0x5a595e})[_0x5e4e('0x8')](function(_0xc53627){logger['debug'](_0x5e4e('0x9'),_0x23decf,_0xc53627?util[_0x5e4e('0x4')](_0xc53627,{'showHidden':![],'depth':null}):'');})[_0x5e4e('0xa')](function(_0x47e38f){logger['error'](_0x5e4e('0x9'),_0x23decf,_0x47e38f?util[_0x5e4e('0x4')](_0x47e38f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x258b95){return client[_0x5e4e('0x7')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x5e4e('0xb'),_0x5e4e('0xc'),_0x5e4e('0xd')],'where':_0x258b95,'limit':0x1}})[_0x5e4e('0x8')](function(_0x480889){logger[_0x5e4e('0x5')](_0x5e4e('0xe'),JSON[_0x5e4e('0xf')](_0x258b95),_0x480889?util[_0x5e4e('0x4')](_0x480889,{'showHidden':![],'depth':null}):'');return _0x480889['result'][_0x5e4e('0x10')]?_0x480889[_0x5e4e('0x11')][0x0]:null;});}exports[_0x5e4e('0x12')]=function(_0x7ee52b){return new BPromise(function(_0x537652,_0x10151c){if(_0x7ee52b){return getUser({'internal':_0x7ee52b})[_0x5e4e('0x8')](function(_0xa2abf1){logger[_0x5e4e('0x3')](_0x5e4e('0x13'),_0x7ee52b,_0xa2abf1?'found':'notfound');return _0x537652(_0xa2abf1);})['catch'](function(_0x34cd31){logger['error'](_0x5e4e('0x14'),_0x34cd31?util[_0x5e4e('0x4')](_0x34cd31,{'showHidden':![],'depth':null}):'');return _0x537652(null);});}return _0x537652(null);});};exports['getUserByInterface']=function(_0x209fb9){return new BPromise(function(_0x4b0060,_0x2ec5d7){if(_0x209fb9){return getUser({'interface':_0x209fb9})['then'](function(_0x5a1096){logger[_0x5e4e('0x3')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x209fb9,_0x5a1096?'found':_0x5e4e('0x15'));return _0x4b0060(_0x5a1096);})[_0x5e4e('0xa')](function(_0x2c9d9a){logger[_0x5e4e('0x6')]('[utils][getUserByInterface]',_0x2c9d9a?util['inspect'](_0x2c9d9a,{'showHidden':![],'depth':null}):'');return _0x4b0060(null);});}return _0x4b0060(null);});};exports[_0x5e4e('0x16')]=function(_0x34f414){return new BPromise(function(_0x24239a,_0x16696e){if(_0x34f414){return getUser({'name':_0x34f414})['then'](function(_0x28e614){logger[_0x5e4e('0x3')](_0x5e4e('0x17'),_0x34f414,_0x28e614?'found':'notfound');return _0x24239a(_0x28e614);})[_0x5e4e('0xa')](function(_0x34d770){logger[_0x5e4e('0x6')](_0x5e4e('0x18'),_0x34d770?util[_0x5e4e('0x4')](_0x34d770,{'showHidden':![],'depth':null}):'');return _0x24239a(null);});}return _0x24239a(null);});};exports['getVoiceQueueByName']=function(_0x481340){return new BPromise(function(_0x94dbb3,_0x550085){if(_0x481340){return client[_0x5e4e('0x7')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x5e4e('0xc'),_0x5e4e('0x19'),_0x5e4e('0x1a'),_0x5e4e('0x1b')],'where':{'name':_0x481340},'limit':0x1}})[_0x5e4e('0x8')](function(_0x2c3dbf){logger[_0x5e4e('0x5')](_0x5e4e('0x1c'),_0x481340,_0x2c3dbf?util[_0x5e4e('0x4')](_0x2c3dbf,{'showHidden':![],'depth':null}):'');logger[_0x5e4e('0x3')](_0x5e4e('0x1d'),_0x481340,_0x2c3dbf?_0x5e4e('0x1e'):'notfound');return _0x94dbb3(_0x2c3dbf[_0x5e4e('0x11')][_0x5e4e('0x10')]?_0x2c3dbf[_0x5e4e('0x11')][0x0]:null);})['catch'](function(_0x3ae2fa){logger['error'](_0x5e4e('0x1f'),_0x3ae2fa?util[_0x5e4e('0x4')](_0x3ae2fa,{'showHidden':![],'depth':null}):'');return _0x94dbb3(null);});}return _0x94dbb3(null);});};exports[_0x5e4e('0x20')]=function(_0x279a60,_0x4dcbd1){return moment(_0x279a60)[_0x5e4e('0x21')](_0x4dcbd1,_0x5e4e('0x22'))[_0x5e4e('0x23')](_0x5e4e('0x24'));};exports[_0x5e4e('0x25')]=function(_0xade3f7,_0x344d31){return moment(_0xade3f7)[_0x5e4e('0x26')](_0x344d31,_0x5e4e('0x22'))[_0x5e4e('0x23')](_0x5e4e('0x24'));};exports[_0x5e4e('0x27')]=function(_0x1b9393,_0x43d05d){return moment(_0x1b9393)[_0x5e4e('0x28')](moment(_0x43d05d),'seconds');};exports[_0x5e4e('0x29')]=function(_0x3bfe47,_0x281b59){return parseInt(_0x3bfe47,0xa)+parseInt(_0x281b59,0xa);};exports['now']=function(){return moment()[_0x5e4e('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5e4e('0x2a')]=function(_0x5a3378,_0x4b3e5e){if(_0x4b3e5e){return moment(_0x5a3378)[_0x5e4e('0x2a')](_0x4b3e5e);}return!![];};exports['isBefore']=function(_0x18c6b4,_0xbea3fa){if(_0xbea3fa){return moment(_0x18c6b4)['isBefore'](_0xbea3fa);}else if(_0x18c6b4){return!![];}return![];}; \ No newline at end of file +var _0xf34b=['length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','found','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify'];(function(_0x3f13d6,_0x1069c5){var _0x1bbca9=function(_0x636976){while(--_0x636976){_0x3f13d6['push'](_0x3f13d6['shift']());}};_0x1bbca9(++_0x1069c5);}(_0xf34b,0xb1));var _0xbf34=function(_0xb18cbc,_0x396ffe){_0xb18cbc=_0xb18cbc-0x0;var _0x39afb6=_0xf34b[_0xb18cbc];return _0x39afb6;};'use strict';var BPromise=require(_0xbf34('0x0'));var jayson=require(_0xbf34('0x1'));var moment=require(_0xbf34('0x2'));var util=require(_0xbf34('0x3'));var client=jayson['client'][_0xbf34('0x4')]({'port':0x2329});var logger=require(_0xbf34('0x5'))(_0xbf34('0x6'));exports[_0xbf34('0x7')]=function(_0x395c1d,_0x86aeaa){logger[_0xbf34('0x7')](_0x395c1d,_0x86aeaa?util[_0xbf34('0x8')](_0x86aeaa,{'showHidden':![],'depth':null}):'');};exports[_0xbf34('0x9')]=function(_0x4a809f,_0x596c61){logger[_0xbf34('0x9')](_0x4a809f,_0x596c61?util[_0xbf34('0x8')](_0x596c61,{'showHidden':![],'depth':null}):'');};exports[_0xbf34('0xa')]=function(_0x598e11,_0x1e6ba1){logger['error'](_0x598e11,_0x1e6ba1?util[_0xbf34('0x8')](_0x1e6ba1,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4b2769,_0x102afb){return client[_0xbf34('0xb')](_0x4b2769,{'body':_0x102afb})[_0xbf34('0xc')](function(_0x244b6f){logger[_0xbf34('0x9')](_0xbf34('0xd'),_0x4b2769,_0x244b6f?util[_0xbf34('0x8')](_0x244b6f,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4e3df7){logger[_0xbf34('0xa')](_0xbf34('0xd'),_0x4b2769,_0x4e3df7?util[_0xbf34('0x8')](_0x4e3df7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1bbe15){return client[_0xbf34('0xb')](_0xbf34('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbf34('0xf'),_0xbf34('0x10'),'interface'],'where':_0x1bbe15,'limit':0x1}})[_0xbf34('0xc')](function(_0x5151d2){logger['debug'](_0xbf34('0x11'),JSON[_0xbf34('0x12')](_0x1bbe15),_0x5151d2?util['inspect'](_0x5151d2,{'showHidden':![],'depth':null}):'');return _0x5151d2['result'][_0xbf34('0x13')]?_0x5151d2[_0xbf34('0x14')][0x0]:null;});}exports[_0xbf34('0x15')]=function(_0xeb360d){return new BPromise(function(_0x70b706,_0x5ef0c3){if(_0xeb360d){return getUser({'internal':_0xeb360d})[_0xbf34('0xc')](function(_0x1c5bed){logger[_0xbf34('0x7')](_0xbf34('0x16'),_0xeb360d,_0x1c5bed?'found':_0xbf34('0x17'));return _0x70b706(_0x1c5bed);})[_0xbf34('0x18')](function(_0x598f26){logger[_0xbf34('0xa')](_0xbf34('0x19'),_0x598f26?util[_0xbf34('0x8')](_0x598f26,{'showHidden':![],'depth':null}):'');return _0x70b706(null);});}return _0x70b706(null);});};exports[_0xbf34('0x1a')]=function(_0x4a75e1){return new BPromise(function(_0x6f2930,_0x465697){if(_0x4a75e1){return getUser({'interface':_0x4a75e1})[_0xbf34('0xc')](function(_0x1c4d12){logger['info'](_0xbf34('0x1b'),_0x4a75e1,_0x1c4d12?'found':_0xbf34('0x17'));return _0x6f2930(_0x1c4d12);})[_0xbf34('0x18')](function(_0x174f0f){logger[_0xbf34('0xa')]('[utils][getUserByInterface]',_0x174f0f?util[_0xbf34('0x8')](_0x174f0f,{'showHidden':![],'depth':null}):'');return _0x6f2930(null);});}return _0x6f2930(null);});};exports[_0xbf34('0x1c')]=function(_0x50932b){return new BPromise(function(_0x4b0163,_0x98d60d){if(_0x50932b){return getUser({'name':_0x50932b})[_0xbf34('0xc')](function(_0x3e29dd){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x50932b,_0x3e29dd?'found':_0xbf34('0x17'));return _0x4b0163(_0x3e29dd);})[_0xbf34('0x18')](function(_0x286137){logger['error'](_0xbf34('0x1d'),_0x286137?util['inspect'](_0x286137,{'showHidden':![],'depth':null}):'');return _0x4b0163(null);});}return _0x4b0163(null);});};exports[_0xbf34('0x1e')]=function(_0x4622c4){return new BPromise(function(_0x4c33aa,_0x566744){if(_0x4622c4){return client[_0xbf34('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xbf34('0x10'),_0xbf34('0x1f'),_0xbf34('0x20'),_0xbf34('0x21')],'where':{'name':_0x4622c4},'limit':0x1}})[_0xbf34('0xc')](function(_0x51174b){logger['debug'](_0xbf34('0x22'),_0x4622c4,_0x51174b?util[_0xbf34('0x8')](_0x51174b,{'showHidden':![],'depth':null}):'');logger['info'](_0xbf34('0x23'),_0x4622c4,_0x51174b?_0xbf34('0x24'):'notfound');return _0x4c33aa(_0x51174b[_0xbf34('0x14')][_0xbf34('0x13')]?_0x51174b['result'][0x0]:null);})[_0xbf34('0x18')](function(_0x169fa8){logger[_0xbf34('0xa')]('[utils][getVoiceQueueByName]',_0x169fa8?util['inspect'](_0x169fa8,{'showHidden':![],'depth':null}):'');return _0x4c33aa(null);});}return _0x4c33aa(null);});};exports[_0xbf34('0x25')]=function(_0x19df1b,_0x5213ab){return moment(_0x19df1b)[_0xbf34('0x26')](_0x5213ab,_0xbf34('0x27'))[_0xbf34('0x28')](_0xbf34('0x29'));};exports[_0xbf34('0x2a')]=function(_0x284168,_0x5a7c6f){return moment(_0x284168)[_0xbf34('0x2b')](_0x5a7c6f,_0xbf34('0x27'))[_0xbf34('0x28')](_0xbf34('0x29'));};exports[_0xbf34('0x2c')]=function(_0x2c2a6d,_0x608986){return moment(_0x2c2a6d)['diff'](moment(_0x608986),_0xbf34('0x27'));};exports[_0xbf34('0x2d')]=function(_0x932c61,_0x5297b9){return parseInt(_0x932c61,0xa)+parseInt(_0x5297b9,0xa);};exports[_0xbf34('0x2e')]=function(){return moment()[_0xbf34('0x28')](_0xbf34('0x29'));};exports[_0xbf34('0x2f')]=function(_0x253192,_0x113fac){if(_0x113fac){return moment(_0x253192)[_0xbf34('0x2f')](_0x113fac);}return!![];};exports[_0xbf34('0x30')]=function(_0x53918b,_0x3d0402){if(_0x3d0402){return moment(_0x53918b)[_0xbf34('0x30')](_0x3d0402);}else if(_0x53918b){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 8ff7aed..36a6472 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 _0x19e9=['inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','remoteAddress','statusCode','other','agent_name','test','fs-extra','lodash','express-winston','path','util','./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','then','user','timestamp','catch','error','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','method','headers','x-forwarded-for','connection','url','responseTime','name'];(function(_0x16fee7,_0x37cdbd){var _0x266774=function(_0x1cb0f8){while(--_0x1cb0f8){_0x16fee7['push'](_0x16fee7['shift']());}};_0x266774(++_0x37cdbd);}(_0x19e9,0x1a8));var _0x919e=function(_0x4b6b7d,_0x5ba63b){_0x4b6b7d=_0x4b6b7d-0x0;var _0x3ded45=_0x19e9[_0x4b6b7d];return _0x3ded45;};var fs=require(_0x919e('0x0'));var _=require(_0x919e('0x1'));var ewinston=require(_0x919e('0x2'));var path=require(_0x919e('0x3'));var util=require(_0x919e('0x4'));var fileLogger=require(_0x919e('0x5'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x919e('0x6')];var maskSensitiveData=require(_0x919e('0x7'))[_0x919e('0x8')];function ClientSideLogger(){function _0x392cf2(_0x5f3106){var _0x85309c=path[_0x919e('0x9')](_0x919e('0xa'),_0x919e('0xb'),_0x919e('0xc'));var _0x340c96=path[_0x919e('0x9')](_0x919e('0xd'),_0x5f3106[_0x919e('0xe')]+'-'+_0x5f3106['name']);return fs['ensureDir'](path[_0x919e('0x9')](_0x85309c,_0x340c96))['then'](function(){var _0x743a62=fileLogger('client',path[_0x919e('0x9')](_0x85309c,_0x340c96));return _0x743a62;})['catch'](function(_0x4f7c3c){throw _0x4f7c3c;});}this['log']=function(_0x5eb948,_0x5637ca,_0x174933,_0x7593f6){return _0x392cf2(_0x5eb948['user'])[_0x919e('0xf')](function(_0x563ba5){var _0x5704e7=_0x563ba5[_0x5637ca];return _0x5704e7;})[_0x919e('0xf')](function(_0x391d44){var _0x2b9066=_0x5eb948[_0x919e('0x10')]?_0x5eb948[_0x919e('0x10')]['id']:'no-user';var _0xf4d13f=_0x7593f6['data'];var _0x36411f=_0x7593f6[_0x919e('0x11')];var _0x3e4180=new Date(Number(_0x36411f));return _0x391d44(_0x2b9066,_0x3e4180,_0x174933,_0xf4d13f);})[_0x919e('0x12')](function(_0x26ed77){fileLogger(_0x919e('0xd'))[_0x919e('0x13')](_0x26ed77);});};}function setupLoggers(_0xf6ed3){return new Promise(function(_0x10c826){var _0x30ebf0=new ClientSideLogger();var _0x2b6c85=fileLogger(_0x919e('0x14'));var _0x32f515=fileLogger('auth');_0xf6ed3[_0x919e('0x15')](_0x919e('0x16'),_0x30ebf0);_0xf6ed3[_0x919e('0x17')](ewinston[_0x919e('0x18')]({'winstonInstance':_0x2b6c85,'meta':![],'statusLevels':!![],'msg':function(_0x2f5a5f,_0x2de601){var _0x4840be=_0x919e('0x19');if(!_[_0x919e('0x1a')](_0x2f5a5f['body'])){_0x4840be+=_0x919e('0x1b');var _0x76b7ba=_0x2f5a5f[_0x919e('0x1c')];maskSensitiveData(_0x76b7ba);}return safeTemplate(util['format'](_0x4840be,_0x2f5a5f[_0x919e('0x1d')],_0x2f5a5f[_0x919e('0x1e')][_0x919e('0x1f')]?_0x2f5a5f[_0x919e('0x1e')][_0x919e('0x1f')]:_0x2f5a5f[_0x919e('0x20')]['remoteAddress']||_0x2f5a5f['ip'],_0x2f5a5f[_0x919e('0x21')],_0x2de601['statusCode'],_0x2de601[_0x919e('0x22')],_0x2f5a5f[_0x919e('0x10')]?_0x2f5a5f[_0x919e('0x10')]['id']:null,_0x2f5a5f[_0x919e('0x10')]?_0x2f5a5f[_0x919e('0x10')][_0x919e('0x23')]:null,_0x2f5a5f['user']?_0x2f5a5f['user'][_0x919e('0xe')]:null,_0x76b7ba?util[_0x919e('0x24')](_0x76b7ba,![],null):''));}}));_0xf6ed3[_0x919e('0x17')](ewinston[_0x919e('0x18')]({'winstonInstance':_0x32f515,'meta':![],'statusLevels':!![],'msg':function(_0xd5bb3e,_0x73a404){var _0x451baf='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xd5bb3e[_0x919e('0x1c')]&&_0xd5bb3e['body'][_0x919e('0x25')]&&_0xd5bb3e[_0x919e('0x1c')][_0x919e('0x26')]){_0x451baf=_0x919e('0x27');}return util[_0x919e('0x28')](_0x451baf,_0xd5bb3e[_0x919e('0x1d')],_0xd5bb3e[_0x919e('0x1e')][_0x919e('0x1f')]?_0xd5bb3e[_0x919e('0x1e')][_0x919e('0x1f')]:_0xd5bb3e[_0x919e('0x20')][_0x919e('0x29')]||_0xd5bb3e['ip'],_0xd5bb3e[_0x919e('0x21')],_0x73a404[_0x919e('0x2a')],_0x73a404['responseTime'],_0xd5bb3e[_0x919e('0x10')]?_0xd5bb3e['user']['id']:null,_0xd5bb3e[_0x919e('0x10')]?_0xd5bb3e[_0x919e('0x10')]['name']:null,_0xd5bb3e[_0x919e('0x10')]?_0xd5bb3e[_0x919e('0x10')]['role']:null,_0xd5bb3e['body']&&_0xd5bb3e[_0x919e('0x1c')][_0x919e('0x25')]?_0xd5bb3e[_0x919e('0x1c')][_0x919e('0x25')]:_0x919e('0x2b'),_0xd5bb3e['body']&&_0xd5bb3e[_0x919e('0x1c')][_0x919e('0x26')]?_0xd5bb3e[_0x919e('0x1c')][_0x919e('0x26')]:'',_0xd5bb3e[_0x919e('0x1c')]&&_0xd5bb3e[_0x919e('0x1c')][_0x919e('0x2c')]?_0xd5bb3e[_0x919e('0x1c')][_0x919e('0x2c')]:'');},'ignoreRoute':function(_0x557864){var _0xc83d06=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xc83d06[_0x919e('0x2d')](_0x557864[_0x919e('0x21')]);}}));return _0x10c826();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x086d=['user','data','timestamp','error','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','remoteAddress','statusCode','responseTime','name','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','other','agent_name','test','fs-extra','lodash','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','role','then','client','catch'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0x086d,0x16e));var _0xd086=function(_0x5e3be8,_0x1814de){_0x5e3be8=_0x5e3be8-0x0;var _0xcf9d15=_0x086d[_0x5e3be8];return _0xcf9d15;};var fs=require(_0xd086('0x0'));var _=require(_0xd086('0x1'));var ewinston=require(_0xd086('0x2'));var path=require(_0xd086('0x3'));var util=require(_0xd086('0x4'));var fileLogger=require('./loggers')[_0xd086('0x5')];var safeTemplate=require(_0xd086('0x6'))[_0xd086('0x7')];var maskSensitiveData=require(_0xd086('0x8'))[_0xd086('0x9')];function ClientSideLogger(){function _0x5a479e(_0x50ec8b){var _0x5d68dd=path[_0xd086('0xa')](_0xd086('0xb'),_0xd086('0xc'),_0xd086('0xd'));var _0x1bd0c4=path[_0xd086('0xa')]('client',_0x50ec8b[_0xd086('0xe')]+'-'+_0x50ec8b['name']);return fs['ensureDir'](path[_0xd086('0xa')](_0x5d68dd,_0x1bd0c4))[_0xd086('0xf')](function(){var _0x3b5589=fileLogger(_0xd086('0x10'),path['join'](_0x5d68dd,_0x1bd0c4));return _0x3b5589;})[_0xd086('0x11')](function(_0x82b530){throw _0x82b530;});}this[_0xd086('0xc')]=function(_0x3ca982,_0x10efb5,_0x3f81b0,_0x4a953e){return _0x5a479e(_0x3ca982[_0xd086('0x12')])['then'](function(_0x29f364){var _0x477547=_0x29f364[_0x10efb5];return _0x477547;})[_0xd086('0xf')](function(_0x15cbe3){var _0x5a4911=_0x3ca982['user']?_0x3ca982[_0xd086('0x12')]['id']:'no-user';var _0x1682d8=_0x4a953e[_0xd086('0x13')];var _0xe1f476=_0x4a953e[_0xd086('0x14')];var _0x2979d7=new Date(Number(_0xe1f476));return _0x15cbe3(_0x5a4911,_0x2979d7,_0x3f81b0,_0x1682d8);})[_0xd086('0x11')](function(_0x33da26){fileLogger('client')[_0xd086('0x15')](_0x33da26);});};}function setupLoggers(_0xbab163){return new Promise(function(_0x357df7){var _0x20d50d=new ClientSideLogger();var _0x280188=fileLogger('api');var _0xed1a70=fileLogger(_0xd086('0x16'));_0xbab163[_0xd086('0x17')](_0xd086('0x18'),_0x20d50d);_0xbab163[_0xd086('0x19')](ewinston[_0xd086('0x1a')]({'winstonInstance':_0x280188,'meta':![],'statusLevels':!![],'msg':function(_0x55f7e5,_0x15d564){var _0xd130ac=_0xd086('0x1b');if(!_[_0xd086('0x1c')](_0x55f7e5[_0xd086('0x1d')])){_0xd130ac+=_0xd086('0x1e');var _0x41bfd4=_0x55f7e5[_0xd086('0x1d')];maskSensitiveData(_0x41bfd4);}return safeTemplate(util[_0xd086('0x1f')](_0xd130ac,_0x55f7e5[_0xd086('0x20')],_0x55f7e5['headers'][_0xd086('0x21')]?_0x55f7e5[_0xd086('0x22')]['x-forwarded-for']:_0x55f7e5[_0xd086('0x23')][_0xd086('0x24')]||_0x55f7e5['ip'],_0x55f7e5['url'],_0x15d564[_0xd086('0x25')],_0x15d564[_0xd086('0x26')],_0x55f7e5['user']?_0x55f7e5[_0xd086('0x12')]['id']:null,_0x55f7e5[_0xd086('0x12')]?_0x55f7e5[_0xd086('0x12')][_0xd086('0x27')]:null,_0x55f7e5[_0xd086('0x12')]?_0x55f7e5[_0xd086('0x12')][_0xd086('0xe')]:null,_0x41bfd4?util[_0xd086('0x28')](_0x41bfd4,![],null):''));}}));_0xbab163['use'](ewinston['logger']({'winstonInstance':_0xed1a70,'meta':![],'statusLevels':!![],'msg':function(_0x513363,_0x41d7bb){var _0x4e46cf='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x513363['body']&&_0x513363[_0xd086('0x1d')][_0xd086('0x29')]&&_0x513363[_0xd086('0x1d')][_0xd086('0x2a')]){_0x4e46cf=_0xd086('0x2b');}return util['format'](_0x4e46cf,_0x513363[_0xd086('0x20')],_0x513363[_0xd086('0x22')][_0xd086('0x21')]?_0x513363[_0xd086('0x22')]['x-forwarded-for']:_0x513363[_0xd086('0x23')][_0xd086('0x24')]||_0x513363['ip'],_0x513363[_0xd086('0x2c')],_0x41d7bb['statusCode'],_0x41d7bb[_0xd086('0x26')],_0x513363['user']?_0x513363[_0xd086('0x12')]['id']:null,_0x513363[_0xd086('0x12')]?_0x513363['user'][_0xd086('0x27')]:null,_0x513363['user']?_0x513363[_0xd086('0x12')][_0xd086('0xe')]:null,_0x513363[_0xd086('0x1d')]&&_0x513363['body'][_0xd086('0x29')]?_0x513363[_0xd086('0x1d')][_0xd086('0x29')]:_0xd086('0x2d'),_0x513363['body']&&_0x513363[_0xd086('0x1d')]['agent_id']?_0x513363[_0xd086('0x1d')][_0xd086('0x2a')]:'',_0x513363['body']&&_0x513363[_0xd086('0x1d')][_0xd086('0x2e')]?_0x513363['body'][_0xd086('0x2e')]:'');},'ignoreRoute':function(_0x1bc62a){var _0x1206be=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1206be[_0xd086('0x2f')](_0x1bc62a[_0xd086('0x2c')]);}}));return _0x357df7();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 4f68fd3..e03f921 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fa4=['slice','concat','circularDoWInterval','monthsShort','exports','clone','hours','minutes','startOf','day','isBetween','timeCompare','ddd','includes','dowCompare','date','daysInMonth','min','domCompare','format','monthCompare','guess','test','isMoment','padStart','length','lodash','moment-timezone','map','source','join','split','locale','toLowerCase','indexOf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fa4,0xa6));var _0x47fa=function(_0x3d2f04,_0x2af699){_0x3d2f04=_0x3d2f04-0x0;var _0x453593=_0x7fa4[_0x3d2f04];return _0x453593;};var _=require(_0x47fa('0x0'));var moment=require(_0x47fa('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][_0x47fa('0x2')](function(_0x2d96d2){return _0x2d96d2[_0x47fa('0x3')];})[_0x47fa('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x5826a9){if(!_0x5826a9['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4ce26d){var _0x469ee1=_0x4ce26d[_0x47fa('0x5')](':')[_0x47fa('0x2')](function(_0x4c2b43){return parseInt(_0x4c2b43,0xa);});var _0x5db200=_0x469ee1[0x0];var _0x18ff1a=_0x469ee1[0x1];if(_0x5db200<0x0||_0x5db200>0x17||_0x18ff1a<0x0||_0x18ff1a>0x3b){throw new Error(EINVALID_DATE);}return[_0x5db200,_0x18ff1a];}function circularDoWInterval(_0x4ce5d6,_0x474dd9){if(_0x4ce5d6===_0x474dd9){return[_0x4ce5d6];}else{var _0x3f7cf3=moment[_0x47fa('0x6')]();moment[_0x47fa('0x6')]('en');var _0x14a4f2=moment['weekdaysShort']()['map'](function(_0x1cf984){return _0x1cf984[_0x47fa('0x7')]();});moment[_0x47fa('0x6')](_0x3f7cf3);var _0x51953f=_0x14a4f2[_0x47fa('0x8')](_0x4ce5d6);var _0x377aef=_0x14a4f2[_0x47fa('0x8')](_0x474dd9);if(_0x377aef>_0x51953f){return _0x14a4f2[_0x47fa('0x9')](_0x51953f,_0x377aef+0x1);}else{var _0x5d6fe4=_0x14a4f2[_0x47fa('0x9')](0x0,_0x377aef+0x1);var _0x380828=_0x14a4f2[_0x47fa('0x9')](_0x51953f);return _0x380828[_0x47fa('0xa')](_0x5d6fe4);}}}module['exports'][_0x47fa('0xb')]=circularDoWInterval;function circularMonthInterval(_0x30b074,_0x4a2758){if(_0x30b074===_0x4a2758){return[_0x30b074];}else{var _0xb0ea3=moment['locale']();moment[_0x47fa('0x6')]('en');var _0x3d8689=moment[_0x47fa('0xc')]()['map'](function(_0x22ed9e){return _0x22ed9e[_0x47fa('0x7')]();});moment[_0x47fa('0x6')](_0xb0ea3);var _0x531920=_0x3d8689['indexOf'](_0x30b074);var _0x49bbcd=_0x3d8689[_0x47fa('0x8')](_0x4a2758);if(_0x49bbcd>_0x531920){return _0x3d8689['slice'](_0x531920,_0x49bbcd+0x1);}else{var _0x3272fb=_0x3d8689[_0x47fa('0x9')](0x0,_0x49bbcd+0x1);var _0xfa64a=_0x3d8689[_0x47fa('0x9')](_0x531920);return _0xfa64a[_0x47fa('0xa')](_0x3272fb);}}}module[_0x47fa('0xd')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x3e7526){var _0x1db03d=parseInt(_0x3e7526,0xa);if(_0x1db03d<0x1||_0x1db03d>0x1f){throw new Error(EINVALID_DATE);}return _0x1db03d;}function timeCompare(_0x34e5b6,_0x559f7a,_0x50362e){var _0x11720c=_0x34e5b6[_0x47fa('0xe')]();var _0x327fde=extractTime(_0x559f7a);var _0x2c806d=_0x327fde[0x0];var _0x5dd782=_0x327fde[0x1];var _0x13129a=_0x34e5b6['clone']()[_0x47fa('0xf')](_0x2c806d)[_0x47fa('0x10')](_0x5dd782);throwIfDateNotValid(_0x13129a);var _0x577e90=extractTime(_0x50362e);var _0x29071c=_0x577e90[0x0];var _0x480d19=_0x577e90[0x1];var _0x328523=_0x34e5b6[_0x47fa('0xe')]()[_0x47fa('0xf')](_0x29071c)['minutes'](_0x480d19);throwIfDateNotValid(_0x328523);if(_0x328523['isBefore'](_0x13129a)){var _0x1ad871=_0x11720c['clone']()[_0x47fa('0x11')]('day');var _0x2d2bd6=_0x11720c[_0x47fa('0xe')]()['endOf'](_0x47fa('0x12'));return _0x11720c[_0x47fa('0x13')](_0x13129a,_0x2d2bd6,undefined,'[]')||_0x11720c[_0x47fa('0x13')](_0x1ad871,_0x328523,undefined,'[]');}else{return _0x11720c[_0x47fa('0x13')](_0x13129a,_0x328523,undefined,'[]');}}module[_0x47fa('0xd')][_0x47fa('0x14')]=timeCompare;function dowCompare(_0x361cad,_0x4587c6,_0x3d12c8){var _0x16cf85=_0x361cad[_0x47fa('0x6')]('en')['format'](_0x47fa('0x15'))[_0x47fa('0x7')]();return circularDoWInterval(_0x4587c6,_0x3d12c8)[_0x47fa('0x16')](_0x16cf85);}module[_0x47fa('0xd')][_0x47fa('0x17')]=dowCompare;function domCompare(_0x208e84,_0x2ccb50,_0x59f64f){var _0xdc7199=_0x208e84[_0x47fa('0x18')]();if(_0x2ccb50===_0x59f64f){return _0xdc7199===_0x2ccb50;}else{var _0x359a76=_0x208e84[_0x47fa('0x19')]();var _0x35141b=_0x2ccb50<_0x59f64f;let _0x3ae809=![];var _0x11b87e=0x0;var _0x402b14=0x0;if(_0x35141b){_0x11b87e=Math['max'](0x1,_0x2ccb50);_0x402b14=Math[_0x47fa('0x1a')](_0x59f64f,_0x359a76);_0x3ae809=_0xdc7199>=_0x11b87e&&_0xdc7199<=_0x402b14;}else{_0x11b87e=Math['min'](_0x2ccb50,_0x359a76);_0x402b14=Math['max'](0x1,_0x59f64f);_0x3ae809=_0xdc7199>=_0x11b87e||_0xdc7199<=_0x402b14;}return _0x3ae809;}}module[_0x47fa('0xd')][_0x47fa('0x1b')]=domCompare;function monthCompare(_0x28ced9,_0x46bf3e,_0x5029fc){var _0xf2f386=_0x28ced9[_0x47fa('0x6')]('en')[_0x47fa('0x1c')]('MMM')['toLowerCase']();return circularMonthInterval(_0x46bf3e,_0x5029fc)[_0x47fa('0x16')](_0xf2f386);}module['exports'][_0x47fa('0x1d')]=monthCompare;function iftime(_0x3bddc7,_0x6905f0=moment['tz'][_0x47fa('0x1e')](),_0x19c7f9=moment()){if(!validateRx[_0x47fa('0x1f')](_0x3bddc7)){throw new Error(EINVALID_STRING);}else{var _0x2d8c0a=(moment[_0x47fa('0x20')](_0x19c7f9)?_0x19c7f9[_0x47fa('0xe')]():moment(_0x19c7f9))['tz'](_0x6905f0)[_0x47fa('0x6')]('en');throwIfDateNotValid(_0x2d8c0a);var _0x15f3f3=_0x3bddc7[_0x47fa('0x5')](',');var _0x2fbece=_0x15f3f3[0x0];var _0x4b2702=_0x15f3f3[0x1];var _0x5c270e=_0x15f3f3[0x2];var _0xb2540a=_0x15f3f3[0x3];let _0x519288=!![];if(_0x2fbece!=='*'){var _0xa85dd0=_0x2fbece['split']('-');var _0x2a2249=_[_0x47fa('0x21')](_0xa85dd0[0x0],0x5,'0');var _0x1cb368=_0xa85dd0[_0x47fa('0x22')]===0x2?_[_0x47fa('0x21')](_0xa85dd0[0x1],0x5,'0'):_0x2a2249;_0x519288=timeCompare(_0x2d8c0a,_0x2a2249,_0x1cb368);}let _0x3b480c=!![];if(_0x4b2702!=='*'){var _0x1e0a68=_0x4b2702[_0x47fa('0x5')]('-');var _0x170dcf=_0x1e0a68[0x0];var _0x5572a9=_0x1e0a68[_0x47fa('0x22')]===0x2?_0x1e0a68[0x1]:_0x170dcf;_0x3b480c=dowCompare(_0x2d8c0a,_0x170dcf,_0x5572a9);}let _0x43188e=!![];if(_0x5c270e!=='*'){var _0x2bca91=_0x5c270e[_0x47fa('0x5')]('-');var _0x1b69f1=parseDom(_0x2bca91[0x0]);var _0x35ff47=_0x2bca91[_0x47fa('0x22')]===0x2?parseDom(_0x2bca91[0x1]):_0x1b69f1;_0x43188e=domCompare(_0x2d8c0a,_0x1b69f1,_0x35ff47);}let _0x1b21a8=!![];if(_0xb2540a!=='*'){var _0x377e49=_0xb2540a[_0x47fa('0x5')]('-');var _0x5e76bb=_0x377e49[0x0];var _0x37ccef=_0x377e49[_0x47fa('0x22')]===0x2?_0x377e49[0x1]:_0x377e49[0x0];_0x1b21a8=monthCompare(_0x2d8c0a,_0x5e76bb,_0x37ccef);}return _0x519288&&_0x3b480c&&_0x43188e&&_0x1b21a8;}}module[_0x47fa('0xd')]['iftime']=iftime; \ No newline at end of file +var _0xad72=['length','padStart','iftime','moment-timezone','source','split','locale','weekdaysShort','map','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','minutes','hours','isBefore','startOf','day','isBetween','timeCompare','ddd','includes','dowCompare','max','min','MMM','guess','test','isMoment'];(function(_0x2a77ae,_0x4049ea){var _0x8df0e3=function(_0x3e6e05){while(--_0x3e6e05){_0x2a77ae['push'](_0x2a77ae['shift']());}};_0x8df0e3(++_0x4049ea);}(_0xad72,0x113));var _0x2ad7=function(_0x593b6f,_0x2189f2){_0x593b6f=_0x593b6f-0x0;var _0x58a501=_0xad72[_0x593b6f];return _0x58a501;};var _=require('lodash');var moment=require(_0x2ad7('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x32e2c7){return _0x32e2c7[_0x2ad7('0x1')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x324d4c){if(!_0x324d4c['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x154230){var _0x3eaf6b=_0x154230[_0x2ad7('0x2')](':')['map'](function(_0x2d86e8){return parseInt(_0x2d86e8,0xa);});var _0x475234=_0x3eaf6b[0x0];var _0x3f6f3e=_0x3eaf6b[0x1];if(_0x475234<0x0||_0x475234>0x17||_0x3f6f3e<0x0||_0x3f6f3e>0x3b){throw new Error(EINVALID_DATE);}return[_0x475234,_0x3f6f3e];}function circularDoWInterval(_0x4e9529,_0x53a926){if(_0x4e9529===_0x53a926){return[_0x4e9529];}else{var _0x1929aa=moment['locale']();moment[_0x2ad7('0x3')]('en');var _0x28f419=moment[_0x2ad7('0x4')]()[_0x2ad7('0x5')](function(_0x35163f){return _0x35163f[_0x2ad7('0x6')]();});moment[_0x2ad7('0x3')](_0x1929aa);var _0xc54984=_0x28f419['indexOf'](_0x4e9529);var _0x50faab=_0x28f419[_0x2ad7('0x7')](_0x53a926);if(_0x50faab>_0xc54984){return _0x28f419[_0x2ad7('0x8')](_0xc54984,_0x50faab+0x1);}else{var _0x424ae5=_0x28f419[_0x2ad7('0x8')](0x0,_0x50faab+0x1);var _0x2dae92=_0x28f419[_0x2ad7('0x8')](_0xc54984);return _0x2dae92[_0x2ad7('0x9')](_0x424ae5);}}}module[_0x2ad7('0xa')][_0x2ad7('0xb')]=circularDoWInterval;function circularMonthInterval(_0xd01846,_0x573a72){if(_0xd01846===_0x573a72){return[_0xd01846];}else{var _0x5c3a6a=moment[_0x2ad7('0x3')]();moment[_0x2ad7('0x3')]('en');var _0xb403c9=moment[_0x2ad7('0xc')]()['map'](function(_0x362a80){return _0x362a80[_0x2ad7('0x6')]();});moment[_0x2ad7('0x3')](_0x5c3a6a);var _0xd45791=_0xb403c9[_0x2ad7('0x7')](_0xd01846);var _0x35d7c0=_0xb403c9['indexOf'](_0x573a72);if(_0x35d7c0>_0xd45791){return _0xb403c9[_0x2ad7('0x8')](_0xd45791,_0x35d7c0+0x1);}else{var _0x128b23=_0xb403c9[_0x2ad7('0x8')](0x0,_0x35d7c0+0x1);var _0x401f08=_0xb403c9[_0x2ad7('0x8')](_0xd45791);return _0x401f08[_0x2ad7('0x9')](_0x128b23);}}}module[_0x2ad7('0xa')][_0x2ad7('0xd')]=circularMonthInterval;function parseDom(_0x599262){var _0x433f9c=parseInt(_0x599262,0xa);if(_0x433f9c<0x1||_0x433f9c>0x1f){throw new Error(EINVALID_DATE);}return _0x433f9c;}function timeCompare(_0x3c2534,_0x1beeb9,_0x1aaf9c){var _0x44efed=_0x3c2534[_0x2ad7('0xe')]();var _0x5726db=extractTime(_0x1beeb9);var _0x26f7e5=_0x5726db[0x0];var _0xdbb4b=_0x5726db[0x1];var _0x473158=_0x3c2534[_0x2ad7('0xe')]()['hours'](_0x26f7e5)[_0x2ad7('0xf')](_0xdbb4b);throwIfDateNotValid(_0x473158);var _0x247329=extractTime(_0x1aaf9c);var _0x3e0f07=_0x247329[0x0];var _0x2030af=_0x247329[0x1];var _0x56b8bd=_0x3c2534[_0x2ad7('0xe')]()[_0x2ad7('0x10')](_0x3e0f07)[_0x2ad7('0xf')](_0x2030af);throwIfDateNotValid(_0x56b8bd);if(_0x56b8bd[_0x2ad7('0x11')](_0x473158)){var _0x2ccddf=_0x44efed[_0x2ad7('0xe')]()[_0x2ad7('0x12')](_0x2ad7('0x13'));var _0x84c924=_0x44efed[_0x2ad7('0xe')]()['endOf']('day');return _0x44efed[_0x2ad7('0x14')](_0x473158,_0x84c924,undefined,'[]')||_0x44efed[_0x2ad7('0x14')](_0x2ccddf,_0x56b8bd,undefined,'[]');}else{return _0x44efed['isBetween'](_0x473158,_0x56b8bd,undefined,'[]');}}module[_0x2ad7('0xa')][_0x2ad7('0x15')]=timeCompare;function dowCompare(_0x4df22c,_0x4bd70a,_0x5dc4b8){var _0x589755=_0x4df22c[_0x2ad7('0x3')]('en')['format'](_0x2ad7('0x16'))[_0x2ad7('0x6')]();return circularDoWInterval(_0x4bd70a,_0x5dc4b8)[_0x2ad7('0x17')](_0x589755);}module[_0x2ad7('0xa')][_0x2ad7('0x18')]=dowCompare;function domCompare(_0x1e44f6,_0x235f52,_0x1528c1){var _0x50bbbd=_0x1e44f6['date']();if(_0x235f52===_0x1528c1){return _0x50bbbd===_0x235f52;}else{var _0x4c0295=_0x1e44f6['daysInMonth']();var _0x26198a=_0x235f52<_0x1528c1;let _0x3c178b=![];var _0x4721c8=0x0;var _0xd8bb7a=0x0;if(_0x26198a){_0x4721c8=Math[_0x2ad7('0x19')](0x1,_0x235f52);_0xd8bb7a=Math[_0x2ad7('0x1a')](_0x1528c1,_0x4c0295);_0x3c178b=_0x50bbbd>=_0x4721c8&&_0x50bbbd<=_0xd8bb7a;}else{_0x4721c8=Math[_0x2ad7('0x1a')](_0x235f52,_0x4c0295);_0xd8bb7a=Math['max'](0x1,_0x1528c1);_0x3c178b=_0x50bbbd>=_0x4721c8||_0x50bbbd<=_0xd8bb7a;}return _0x3c178b;}}module[_0x2ad7('0xa')]['domCompare']=domCompare;function monthCompare(_0x5ec771,_0x16684a,_0x5c0fae){var _0x38a1af=_0x5ec771['locale']('en')['format'](_0x2ad7('0x1b'))['toLowerCase']();return circularMonthInterval(_0x16684a,_0x5c0fae)[_0x2ad7('0x17')](_0x38a1af);}module[_0x2ad7('0xa')]['monthCompare']=monthCompare;function iftime(_0x3267ff,_0x281453=moment['tz'][_0x2ad7('0x1c')](),_0x2db2a8=moment()){if(!validateRx[_0x2ad7('0x1d')](_0x3267ff)){throw new Error(EINVALID_STRING);}else{var _0x285e11=(moment[_0x2ad7('0x1e')](_0x2db2a8)?_0x2db2a8[_0x2ad7('0xe')]():moment(_0x2db2a8))['tz'](_0x281453)[_0x2ad7('0x3')]('en');throwIfDateNotValid(_0x285e11);var _0x416869=_0x3267ff['split'](',');var _0x2d0f68=_0x416869[0x0];var _0xe1e14=_0x416869[0x1];var _0x5b16a5=_0x416869[0x2];var _0x510260=_0x416869[0x3];let _0xb9f135=!![];if(_0x2d0f68!=='*'){var _0x42638b=_0x2d0f68[_0x2ad7('0x2')]('-');var _0x9f5e6c=_['padStart'](_0x42638b[0x0],0x5,'0');var _0x277730=_0x42638b[_0x2ad7('0x1f')]===0x2?_[_0x2ad7('0x20')](_0x42638b[0x1],0x5,'0'):_0x9f5e6c;_0xb9f135=timeCompare(_0x285e11,_0x9f5e6c,_0x277730);}let _0x629651=!![];if(_0xe1e14!=='*'){var _0x344a59=_0xe1e14[_0x2ad7('0x2')]('-');var _0x546571=_0x344a59[0x0];var _0xb6a70d=_0x344a59[_0x2ad7('0x1f')]===0x2?_0x344a59[0x1]:_0x546571;_0x629651=dowCompare(_0x285e11,_0x546571,_0xb6a70d);}let _0x22a1a0=!![];if(_0x5b16a5!=='*'){var _0x3736e3=_0x5b16a5['split']('-');var _0x4bcfc1=parseDom(_0x3736e3[0x0]);var _0x1ceeeb=_0x3736e3['length']===0x2?parseDom(_0x3736e3[0x1]):_0x4bcfc1;_0x22a1a0=domCompare(_0x285e11,_0x4bcfc1,_0x1ceeeb);}let _0x2b0a65=!![];if(_0x510260!=='*'){var _0x4615b7=_0x510260[_0x2ad7('0x2')]('-');var _0x5d7cb2=_0x4615b7[0x0];var _0x21cdac=_0x4615b7[_0x2ad7('0x1f')]===0x2?_0x4615b7[0x1]:_0x4615b7[0x0];_0x2b0a65=monthCompare(_0x285e11,_0x5d7cb2,_0x21cdac);}return _0xb9f135&&_0x629651&&_0x22a1a0&&_0x2b0a65;}}module[_0x2ad7('0xa')][_0x2ad7('0x21')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 13c04c2..c8f42a2 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7058=['bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','{{{','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','File','error','Console','warn','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20green','gray'];(function(_0x41bd33,_0x8dd533){var _0x1ef83a=function(_0x5821aa){while(--_0x5821aa){_0x41bd33['push'](_0x41bd33['shift']());}};_0x1ef83a(++_0x8dd533);}(_0x7058,0x10b));var _0x8705=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x7058[_0x166d93];return _0xba708;};'use strict';var path=require(_0x8705('0x0'));var util=require(_0x8705('0x1'));var moment=require(_0x8705('0x2'));var winston=require(_0x8705('0x3'));var config=require(_0x8705('0x4'));var debugLevel=config[_0x8705('0x5')]?config[_0x8705('0x5')][_0x8705('0x6')]():_0x8705('0x7');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':_0x8705('0x8'),'error':_0x8705('0x9'),'warn':_0x8705('0xa'),'info':'white','print':'bold\x20white','success':_0x8705('0xb'),'http':_0x8705('0xc'),'verbose':_0x8705('0xd'),'debug':'bold\x20blue','silly':_0x8705('0xe')};winston[_0x8705('0xf')](XC_LOG_COLORS);function getLogFileName(_0x441d82,_0x35dc48,_0x3bfdf4){var _0x4b9474=_0x441d82||_0x8705('0x10');return path[_0x8705('0x11')](_0x4b9474,util[_0x8705('0x12')](_0x8705('0x13'),_0x35dc48,_0x3bfdf4));}function formatter(_0x294958,_0x175b44){_0x175b44[_0x8705('0x14')]=_0x175b44['message'][_0x8705('0x15')](/@@{/g,'{{{')[_0x8705('0x15')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x8705('0x15')](/}@/g,'}}');return util[_0x8705('0x12')](_0x8705('0x16'),moment()['format'](_0x8705('0x17')),_0x175b44['level'][_0x8705('0x18')](),_0x294958,_0x175b44[_0x8705('0x14')]);}function fileFormat(_0x3968e9,_0x357b5a){_0x357b5a[_0x8705('0x14')]=_0x357b5a[_0x8705('0x14')][_0x8705('0x15')](/@@{/g,_0x8705('0x19'))['replace'](/}@@/g,'}}}')[_0x8705('0x15')](/@{/g,'{{')[_0x8705('0x15')](/}@/g,'}}');var _0x9993c7=_0x357b5a[_0x8705('0x1a')]&&Object[_0x8705('0x1b')](_0x357b5a[_0x8705('0x1a')])[_0x8705('0x1c')]?'\x0a\x09'+JSON[_0x8705('0x1d')](_0x357b5a[_0x8705('0x1a')]):'';return util[_0x8705('0x12')](_0x8705('0x1e'),moment()[_0x8705('0x12')](_0x8705('0x17')),_0x357b5a[_0x8705('0x1f')][_0x8705('0x18')](),_0x3968e9,_0x357b5a['message'],_0x9993c7);}function consoleLogger(){var _0x177168=new winston[(_0x8705('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8705('0x21'))]['Console']({'level':'warn','json':![],'formatter':function(_0x371397){return formatter('',_0x371397);}})]});return _0x177168;}function fileLogger(_0x51d0e7,_0x2f9cfe){var _0x1e07e0=new winston[(_0x8705('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8705('0x21'))][(_0x8705('0x22'))]({'name':util[_0x8705('0x12')]('%s-%s',_0x51d0e7,_0x8705('0x23')),'filename':getLogFileName(_0x2f9cfe,_0x51d0e7,_0x8705('0x23')),'level':_0x8705('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4fecb1){return fileFormat(_0x51d0e7,_0x4fecb1);}}),new winston[(_0x8705('0x21'))][(_0x8705('0x22'))]({'name':util[_0x8705('0x12')]('%s-%s',_0x51d0e7,debugLevel),'filename':getLogFileName(_0x2f9cfe,_0x51d0e7,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x136460){return fileFormat(_0x51d0e7,_0x136460);}}),new winston['transports'][(_0x8705('0x24'))]({'level':_0x8705('0x25'),'json':![],'formatter':function(_0x2b00c6){return fileFormat(_0x51d0e7,_0x2b00c6);}})]});return _0x1e07e0;}exports[_0x8705('0x26')]=consoleLogger;exports[_0x8705('0x27')]=fileLogger; \ No newline at end of file +var _0x20eb=['util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','meta','length','stringify','level','toUpperCase','transports','Console','Logger','File','error','%s-%s','warn','consoleLogger','fileLogger','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x20eb,0xef));var _0xb20e=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x20eb[_0x565c49];return _0x20ca34;};'use strict';var path=require(_0xb20e('0x0'));var util=require(_0xb20e('0x1'));var moment=require(_0xb20e('0x2'));var winston=require(_0xb20e('0x3'));var config=require(_0xb20e('0x4'));var debugLevel=config['debugLevel']?config[_0xb20e('0x5')][_0xb20e('0x6')]():_0xb20e('0x7');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':_0xb20e('0x8'),'error':'red','warn':_0xb20e('0x9'),'info':_0xb20e('0xa'),'print':_0xb20e('0xb'),'success':_0xb20e('0xc'),'http':_0xb20e('0xd'),'verbose':_0xb20e('0xe'),'debug':_0xb20e('0xf'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x541e76,_0x4a5484,_0x2d41db){var _0x40b21e=_0x541e76||_0xb20e('0x10');return path[_0xb20e('0x11')](_0x40b21e,util[_0xb20e('0x12')](_0xb20e('0x13'),_0x4a5484,_0x2d41db));}function formatter(_0x3333d7,_0x28f4d0){_0x28f4d0[_0xb20e('0x14')]=_0x28f4d0[_0xb20e('0x14')][_0xb20e('0x15')](/@@{/g,_0xb20e('0x16'))[_0xb20e('0x15')](/}@@/g,_0xb20e('0x17'))[_0xb20e('0x15')](/@{/g,'{{')[_0xb20e('0x15')](/}@/g,'}}');return util[_0xb20e('0x12')](_0xb20e('0x18'),moment()[_0xb20e('0x12')](_0xb20e('0x19')),_0x28f4d0['level']['toUpperCase'](),_0x3333d7,_0x28f4d0[_0xb20e('0x14')]);}function fileFormat(_0x4dd077,_0x58e499){_0x58e499['message']=_0x58e499[_0xb20e('0x14')][_0xb20e('0x15')](/@@{/g,_0xb20e('0x16'))[_0xb20e('0x15')](/}@@/g,_0xb20e('0x17'))['replace'](/@{/g,'{{')[_0xb20e('0x15')](/}@/g,'}}');var _0x308801=_0x58e499[_0xb20e('0x1a')]&&Object['keys'](_0x58e499[_0xb20e('0x1a')])[_0xb20e('0x1b')]?'\x0a\x09'+JSON[_0xb20e('0x1c')](_0x58e499[_0xb20e('0x1a')]):'';return util[_0xb20e('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x58e499[_0xb20e('0x1d')][_0xb20e('0x1e')](),_0x4dd077,_0x58e499['message'],_0x308801);}function consoleLogger(){var _0xe7991c=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb20e('0x1f'))][(_0xb20e('0x20'))]({'level':'warn','json':![],'formatter':function(_0x34a373){return formatter('',_0x34a373);}})]});return _0xe7991c;}function fileLogger(_0x283410,_0x40f812){var _0xf1ab13=new winston[(_0xb20e('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xb20e('0x22'))]({'name':util['format']('%s-%s',_0x283410,_0xb20e('0x23')),'filename':getLogFileName(_0x40f812,_0x283410,_0xb20e('0x23')),'level':_0xb20e('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4a86d9){return fileFormat(_0x283410,_0x4a86d9);}}),new winston[(_0xb20e('0x1f'))][(_0xb20e('0x22'))]({'name':util[_0xb20e('0x12')](_0xb20e('0x24'),_0x283410,debugLevel),'filename':getLogFileName(_0x40f812,_0x283410,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x309e51){return fileFormat(_0x283410,_0x309e51);}}),new winston['transports'][(_0xb20e('0x20'))]({'level':_0xb20e('0x25'),'json':![],'formatter':function(_0x32bdaf){return fileFormat(_0x283410,_0x32bdaf);}})]});return _0xf1ab13;}exports[_0xb20e('0x26')]=consoleLogger;exports[_0xb20e('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 480a68d..1e2634b 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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x1a85,0x178));var _0x51a8=function(_0x235186,_0xf3fdc2){_0x235186=_0x235186-0x0;var _0x103007=_0x1a85[_0x235186];return _0x103007;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +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(_0x34419d,_0x35dc99){var _0x3989af=function(_0x3416a0){while(--_0x3416a0){_0x34419d['push'](_0x34419d['shift']());}};_0x3989af(++_0x35dc99);}(_0x2ef3,0xba));var _0x32ef=function(_0x27ef21,_0x5d0828){_0x27ef21=_0x27ef21-0x0;var _0x4483bd=_0x2ef3[_0x27ef21];return _0x4483bd;};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 diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index db543f8..0a86d87 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 _0x2032=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x2032,0xd9));var _0x2203=function(_0x153ebc,_0x49bf65){_0x153ebc=_0x153ebc-0x0;var _0x1781a5=_0x2032[_0x153ebc];return _0x1781a5;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2c2259){return _0x2c2259==='{{'?_0x2203('0x0'):_0x2203('0x1');}function safeTemplate(_0x4c28da){var _0x486390=_0x4c28da;if(typeof _0x4c28da===_0x2203('0x2')){_0x486390=_0x4c28da['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2203('0x3')](_0x4c28da)){_0x486390=_0x4c28da[_0x2203('0x4')](function(_0x44ccfd){return safeTemplate(_0x44ccfd);});}else if(_[_0x2203('0x5')](_0x4c28da)){_0x486390=Object[_0x2203('0x6')](_0x4c28da)[_0x2203('0x7')](function(_0x2e0f63,_0x2676aa){_0x2e0f63[_0x2676aa]=safeTemplate(_0x4c28da[_0x2676aa]);return _0x2e0f63;},{});}return _0x486390;}module[_0x2203('0x8')][_0x2203('0x9')]=safeTemplate; \ No newline at end of file +var _0xed3c=['{\x20{\x20','\x20}\x20}','string','replace','isPlainObject','keys','reduce','safeTemplate','lodash'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xed3c,0x1a6));var _0xced3=function(_0x22df9f,_0x9ec477){_0x22df9f=_0x22df9f-0x0;var _0x4ed906=_0xed3c[_0x22df9f];return _0x4ed906;};var _=require(_0xced3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x408853){return _0x408853==='{{'?_0xced3('0x1'):_0xced3('0x2');}function safeTemplate(_0x558ee8){var _0xfdc1ed=_0x558ee8;if(typeof _0x558ee8===_0xced3('0x3')){_0xfdc1ed=_0x558ee8[_0xced3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x558ee8)){_0xfdc1ed=_0x558ee8['map'](function(_0x3d3aa0){return safeTemplate(_0x3d3aa0);});}else if(_[_0xced3('0x5')](_0x558ee8)){_0xfdc1ed=Object[_0xced3('0x6')](_0x558ee8)[_0xced3('0x7')](function(_0x4795cd,_0x510164){_0x4795cd[_0x510164]=safeTemplate(_0x558ee8[_0x510164]);return _0x4795cd;},{});}return _0xfdc1ed;}module['exports'][_0xced3('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index fba1f44..19b099b 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 _0xf32b=['root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','env','NODE_PATH','string','pathExists','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xf32b,0x1d9));var _0xbf32=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xf32b[_0x2b10c6];return _0x3789d2;};var fs=require(_0xbf32('0x0'));var path=require(_0xbf32('0x1'));var config=require(_0xbf32('0x2'));var root=config[_0xbf32('0x3')];var APP_JSON_PATH=path[_0xbf32('0x4')](root,_0xbf32('0x5'));var NODEPATH=path[_0xbf32('0x4')](root,_0xbf32('0x6'));function setLegacyLibsNodeEnvPath(_0x80750f){let _0x467214=![];if(Array[_0xbf32('0x7')](_0x80750f[_0xbf32('0x8')])){var _0x1e2018=_0x80750f['apps'][_0xbf32('0x9')](function(_0x3763d2){return _0x3763d2['name']==='motion2';});if(_0x1e2018>-0x1){var _0x2420d4=_0x80750f[_0xbf32('0x8')][_0x1e2018];if(typeof _0x2420d4[_0xbf32('0xa')][_0xbf32('0xb')]!==_0xbf32('0xc')){_0x2420d4[_0xbf32('0xa')][_0xbf32('0xb')]=NODEPATH;_0x467214=!![];}}return{'appConfig':_0x80750f,'updated':_0x467214};}}function updateAppConfig(_0x5f4625){return fs[_0xbf32('0xd')](APP_JSON_PATH)['then'](function(_0x4625ff){if(_0x4625ff){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0x1c81c8){var _0x3c08d5=setLegacyLibsNodeEnvPath(_0x1c81c8);if(_0x3c08d5['updated']){_0x5f4625['info'](_0xbf32('0xe'));return fs[_0xbf32('0xf')](APP_JSON_PATH,_0x1c81c8,{'spaces':0x2});}else{return Promise[_0xbf32('0x4')]();}});}else{return Promise['resolve']();}});}module[_0xbf32('0x10')]=updateAppConfig; \ No newline at end of file +var _0xd35d=['fs-extra','path','../config/environment','root','resolve','legacy-libs','apps','findIndex','name','motion2','env','NODE_PATH','string','then','info','Updating\x20app.json','writeJSON','exports'];(function(_0x1bedb6,_0xfef025){var _0x2f5c38=function(_0x3961e5){while(--_0x3961e5){_0x1bedb6['push'](_0x1bedb6['shift']());}};_0x2f5c38(++_0xfef025);}(_0xd35d,0xb4));var _0xdd35=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xd35d[_0x3740fe];return _0x55492b;};var fs=require(_0xdd35('0x0'));var path=require(_0xdd35('0x1'));var config=require(_0xdd35('0x2'));var root=config[_0xdd35('0x3')];var APP_JSON_PATH=path[_0xdd35('0x4')](root,'server/app.json');var NODEPATH=path[_0xdd35('0x4')](root,_0xdd35('0x5'));function setLegacyLibsNodeEnvPath(_0x187e36){let _0x37fe3b=![];if(Array['isArray'](_0x187e36[_0xdd35('0x6')])){var _0x275981=_0x187e36[_0xdd35('0x6')][_0xdd35('0x7')](function(_0x2f9168){return _0x2f9168[_0xdd35('0x8')]===_0xdd35('0x9');});if(_0x275981>-0x1){var _0x1c53d2=_0x187e36[_0xdd35('0x6')][_0x275981];if(typeof _0x1c53d2[_0xdd35('0xa')][_0xdd35('0xb')]!==_0xdd35('0xc')){_0x1c53d2['env'][_0xdd35('0xb')]=NODEPATH;_0x37fe3b=!![];}}return{'appConfig':_0x187e36,'updated':_0x37fe3b};}}function updateAppConfig(_0x50e76b){return fs['pathExists'](APP_JSON_PATH)[_0xdd35('0xd')](function(_0x25871f){if(_0x25871f){return fs['readJSON'](APP_JSON_PATH)[_0xdd35('0xd')](function(_0x267749){var _0x452c3b=setLegacyLibsNodeEnvPath(_0x267749);if(_0x452c3b['updated']){_0x50e76b[_0xdd35('0xe')](_0xdd35('0xf'));return fs[_0xdd35('0x10')](APP_JSON_PATH,_0x267749,{'spaces':0x2});}else{return Promise[_0xdd35('0x4')]();}});}else{return Promise[_0xdd35('0x4')]();}});}module[_0xdd35('0x11')]=updateAppConfig; \ No newline at end of file